From: support Date: Fri, 28 Oct 2022 09:48:56 +0000 (+0000) Subject: Built motion from commit da24aabd.|2.6.20 X-Git-Tag: 2.6.20 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22javascript:void%28%27%7BtitleJs%7D%27%29/%22%22%29%20%27?a=commitdiff_plain;h=4baefdac9c37d4300115b8e539c5781a6d78e036;p=motion2.git Built motion from commit da24aabd.|2.6.20 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index d7b270a..9dc03eb 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1,6 +1,6 @@ define({ "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-25T13:44:33.464Z", + "time": "2022-10-28T09:41:53.671Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index aefad5f..d483aae 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1,6 +1,6 @@ { "name": "xCALLY Motion API", - "version": "2.6.19", + "version": "2.6.20", "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.", "title": "xCALLY MOTION API", "header": { @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-10-25T13:44:33.464Z", + "time": "2022-10-28T09:41:53.671Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 0549b25..1ceedbc 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "dependencies": { "@babel/code-frame": { "version": "7.18.6", diff --git a/package.json b/package.json index f66562f..79e37a8 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "motion", - "version": "2.6.19", + "version": "2.6.20", "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.", "main": "server/app.js", "engines": { diff --git a/server/api/action/action.attributes.js b/server/api/action/action.attributes.js index d965f07..342f5ba 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 _0xe5ff=['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[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe5ff,0xf7));var _0xfe5f=function(_0x3f1845,_0x446045){_0x3f1845=_0x3f1845-0x0;var _0x336743=_0xe5ff[_0x3f1845];return _0x336743;};'use strict';var Sequelize=require(_0xfe5f('0x0'));module[_0xfe5f('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x20fb10){return this[_0xfe5f('0x2')](_0xfe5f('0x3'));}},'action':{'type':Sequelize[_0xfe5f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xfe5f('0x5'),_0xfe5f('0x6'),_0xfe5f('0x7'),_0xfe5f('0x8'),_0xfe5f('0x9'),_0xfe5f('0xa'),_0xfe5f('0xb'),_0xfe5f('0xc')]],'msg':_0xfe5f('0xd')}},'comment':_0xfe5f('0xd')},'data1':{'type':Sequelize[_0xfe5f('0x4')](0x1000),'comment':_0xfe5f('0xe')},'data2':{'type':Sequelize[_0xfe5f('0x4')](0x1000),'comment':_0xfe5f('0xf')},'data3':{'type':Sequelize[_0xfe5f('0x4')](0x1000),'comment':_0xfe5f('0x10')},'data4':{'type':Sequelize[_0xfe5f('0x4')](0x1000),'comments':'browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xfe5f('0x4')],'comments':_0xfe5f('0x11')},'data7':{'type':Sequelize[_0xfe5f('0x12')],'comments':_0xfe5f('0x13')}}; \ No newline at end of file +var _0x94c1=['urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x94c1,0x8d));var _0x194c=function(_0x48f2c3,_0x1c998f){_0x48f2c3=_0x48f2c3-0x0;var _0x17bbf4=_0x94c1[_0x48f2c3];return _0x17bbf4;};'use strict';var Sequelize=require(_0x194c('0x0'));module[_0x194c('0x1')]={'name':{'type':Sequelize[_0x194c('0x2')],'get':function(_0x212086){return this[_0x194c('0x3')](_0x194c('0x4'));}},'action':{'type':Sequelize[_0x194c('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x194c('0x6'),_0x194c('0x7'),'motionbar',_0x194c('0x8'),_0x194c('0x9'),'browser',_0x194c('0xa'),_0x194c('0xb')]],'msg':_0x194c('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x194c('0x5')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x194c('0xd')},'data3':{'type':Sequelize[_0x194c('0x5')](0x1000),'comment':_0x194c('0xe')},'data4':{'type':Sequelize[_0x194c('0x5')](0x1000),'comments':_0x194c('0xf')},'data5':{'type':Sequelize[_0x194c('0x5')](0x1000),'comments':_0x194c('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x194c('0x11')},'data7':{'type':Sequelize[_0x194c('0x12')],'comments':_0x194c('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 2432bab..d4125ed 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 _0x9d23=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','destroy','then','error','name','body','Action','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto'];(function(_0x3f9221,_0x354a0f){var _0x4b09a8=function(_0x2661ab){while(--_0x2661ab){_0x3f9221['push'](_0x3f9221['shift']());}};_0x4b09a8(++_0x354a0f);}(_0x9d23,0x1d6));var _0x39d2=function(_0x517919,_0x54d4d7){_0x517919=_0x517919-0x0;var _0x4f1f20=_0x9d23[_0x517919];return _0x4f1f20;};'use strict';var emlformat=require(_0x39d2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x39d2('0x1'));var jsonpatch=require(_0x39d2('0x2'));var rp=require('request-promise');var moment=require(_0x39d2('0x3'));var BPromise=require(_0x39d2('0x4'));var Mustache=require(_0x39d2('0x5'));var util=require(_0x39d2('0x6'));var path=require('path');var sox=require(_0x39d2('0x7'));var csv=require(_0x39d2('0x8'));var ejs=require(_0x39d2('0x9'));var fs=require('fs');var fs_extra=require(_0x39d2('0xa'));var _=require(_0x39d2('0xb'));var squel=require(_0x39d2('0xc'));var crypto=require(_0x39d2('0xd'));var jsforce=require(_0x39d2('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x39d2('0x8'));var querystring=require(_0x39d2('0xf'));var Papa=require(_0x39d2('0x10'));var Redis=require('ioredis');var authService=require(_0x39d2('0x11'));var qs=require(_0x39d2('0x12'));var as=require(_0x39d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d2('0x14'))(_0x39d2('0x15'));var utils=require(_0x39d2('0x16'));var config=require(_0x39d2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x39d2('0x18'))['db'];function respondWithStatusCode(_0x1b7ceb,_0x526cf3){_0x526cf3=_0x526cf3||0xcc;return function(_0x5a1976){if(_0x5a1976){return _0x1b7ceb[_0x39d2('0x19')](_0x526cf3);}return _0x1b7ceb[_0x39d2('0x1a')](_0x526cf3)[_0x39d2('0x1b')]();};}function respondWithResult(_0xcf5439,_0x12c1ee){_0x12c1ee=_0x12c1ee||0xc8;return function(_0x573ce5){if(_0x573ce5){return _0xcf5439[_0x39d2('0x1a')](_0x12c1ee)[_0x39d2('0x1c')](_0x573ce5);}};}function respondWithFilteredResult(_0x38c7b5,_0x5120be){return function(_0x10bcc9){if(_0x10bcc9){var _0x46703b=typeof _0x5120be[_0x39d2('0x1d')]===_0x39d2('0x1e')&&typeof _0x5120be['limit']===_0x39d2('0x1e');var _0x4388bb=_0x10bcc9[_0x39d2('0x1f')];var _0x986e4d=_0x46703b?0x0:_0x5120be['offset'];var _0x102d1a=_0x46703b?_0x10bcc9['count']:_0x5120be[_0x39d2('0x1d')]+_0x5120be['limit'];var _0x4791c2;if(_0x102d1a>=_0x4388bb){_0x102d1a=_0x4388bb;_0x4791c2=0xc8;}else{_0x4791c2=0xce;}_0x38c7b5['status'](_0x4791c2);return _0x38c7b5[_0x39d2('0x20')](_0x39d2('0x21'),_0x986e4d+'-'+_0x102d1a+'/'+_0x4388bb)[_0x39d2('0x1c')](_0x10bcc9);}return null;};}function patchUpdates(_0xac2b56){return function(_0x56f564){try{jsonpatch[_0x39d2('0x22')](_0x56f564,_0xac2b56,!![]);}catch(_0x456cbc){return BPromise[_0x39d2('0x23')](_0x456cbc);}return _0x56f564['save']();};}function saveUpdates(_0x2dbf3c,_0x38f9b9){return function(_0x18af58){if(_0x18af58){return _0x18af58[_0x39d2('0x24')](_0x2dbf3c)['then'](function(_0xf50a74){return _0xf50a74;});}return null;};}function removeEntity(_0x2e78b9,_0x452671){return function(_0x26d089){if(_0x26d089){return _0x26d089[_0x39d2('0x25')]()[_0x39d2('0x26')](function(){_0x2e78b9[_0x39d2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43b86c,_0x53f555){return function(_0x4177f1){if(!_0x4177f1){_0x43b86c[_0x39d2('0x19')](0x194);}return _0x4177f1;};}function handleError(_0x400d47,_0x9c7cea){_0x9c7cea=_0x9c7cea||0x1f4;return function(_0x40b7c0){logger[_0x39d2('0x27')](_0x40b7c0['stack']);if(_0x40b7c0[_0x39d2('0x28')]){delete _0x40b7c0['name'];}_0x400d47[_0x39d2('0x1a')](_0x9c7cea)['send'](_0x40b7c0);};}exports[_0x39d2('0x24')]=function(_0xea1384,_0xc127eb){if(_0xea1384[_0x39d2('0x29')]['id']){delete _0xea1384[_0x39d2('0x29')]['id'];}return db['Action']['find']({'where':{'id':_0xea1384['params']['id']}})['then'](handleEntityNotFound(_0xc127eb,null))['then'](saveUpdates(_0xea1384[_0x39d2('0x29')],null))['then'](respondWithResult(_0xc127eb,null))['catch'](handleError(_0xc127eb,null));};exports[_0x39d2('0x25')]=function(_0x3173dc,_0x556fdd){return db[_0x39d2('0x2a')]['find']({'where':{'id':_0x3173dc[_0x39d2('0x2b')]['id']}})[_0x39d2('0x26')](handleEntityNotFound(_0x556fdd,null))[_0x39d2('0x26')](removeEntity(_0x556fdd,null))['catch'](handleError(_0x556fdd,null));}; \ No newline at end of file +var _0x3bb2=['destroy','sendStatus','error','stack','name','send','body','Action','params','catch','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','json','limit','undefined','offset','set','Content-Range','apply','reject','save','update','then'];(function(_0x42c6a5,_0x38d9ed){var _0x329344=function(_0x528046){while(--_0x528046){_0x42c6a5['push'](_0x42c6a5['shift']());}};_0x329344(++_0x38d9ed);}(_0x3bb2,0x15b));var _0x23bb=function(_0x5c8f64,_0x1f6264){_0x5c8f64=_0x5c8f64-0x0;var _0x44ee4f=_0x3bb2[_0x5c8f64];return _0x44ee4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x23bb('0x0'));var zipdir=require(_0x23bb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x23bb('0x2'));var moment=require(_0x23bb('0x3'));var BPromise=require(_0x23bb('0x4'));var Mustache=require(_0x23bb('0x5'));var util=require(_0x23bb('0x6'));var path=require(_0x23bb('0x7'));var sox=require(_0x23bb('0x8'));var csv=require(_0x23bb('0x9'));var ejs=require(_0x23bb('0xa'));var fs=require('fs');var fs_extra=require(_0x23bb('0xb'));var _=require(_0x23bb('0xc'));var squel=require(_0x23bb('0xd'));var crypto=require(_0x23bb('0xe'));var jsforce=require(_0x23bb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x23bb('0x9'));var querystring=require(_0x23bb('0x10'));var Papa=require(_0x23bb('0x11'));var Redis=require(_0x23bb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x23bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x23bb('0x14'));var logger=require('../../config/logger')(_0x23bb('0x15'));var utils=require(_0x23bb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x23bb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x448241,_0x2cdca8){_0x2cdca8=_0x2cdca8||0xcc;return function(_0x378532){if(_0x378532){return _0x448241['sendStatus'](_0x2cdca8);}return _0x448241[_0x23bb('0x18')](_0x2cdca8)[_0x23bb('0x19')]();};}function respondWithResult(_0x35a2b2,_0x543e3b){_0x543e3b=_0x543e3b||0xc8;return function(_0x3c3b86){if(_0x3c3b86){return _0x35a2b2[_0x23bb('0x18')](_0x543e3b)[_0x23bb('0x1a')](_0x3c3b86);}};}function respondWithFilteredResult(_0x11fbc4,_0x4d3fb2){return function(_0x356c28){if(_0x356c28){var _0xc38f77=typeof _0x4d3fb2['offset']==='undefined'&&typeof _0x4d3fb2[_0x23bb('0x1b')]===_0x23bb('0x1c');var _0x392d19=_0x356c28['count'];var _0x38a24e=_0xc38f77?0x0:_0x4d3fb2['offset'];var _0x374b43=_0xc38f77?_0x356c28['count']:_0x4d3fb2[_0x23bb('0x1d')]+_0x4d3fb2[_0x23bb('0x1b')];var _0x9255e2;if(_0x374b43>=_0x392d19){_0x374b43=_0x392d19;_0x9255e2=0xc8;}else{_0x9255e2=0xce;}_0x11fbc4[_0x23bb('0x18')](_0x9255e2);return _0x11fbc4[_0x23bb('0x1e')](_0x23bb('0x1f'),_0x38a24e+'-'+_0x374b43+'/'+_0x392d19)[_0x23bb('0x1a')](_0x356c28);}return null;};}function patchUpdates(_0x11d448){return function(_0x5dff7b){try{jsonpatch[_0x23bb('0x20')](_0x5dff7b,_0x11d448,!![]);}catch(_0x1847bb){return BPromise[_0x23bb('0x21')](_0x1847bb);}return _0x5dff7b[_0x23bb('0x22')]();};}function saveUpdates(_0x357f23,_0x40da39){return function(_0x46967f){if(_0x46967f){return _0x46967f[_0x23bb('0x23')](_0x357f23)[_0x23bb('0x24')](function(_0x2ff9f4){return _0x2ff9f4;});}return null;};}function removeEntity(_0x1aaa3f,_0x46aed6){return function(_0xf778e9){if(_0xf778e9){return _0xf778e9[_0x23bb('0x25')]()['then'](function(){_0x1aaa3f[_0x23bb('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f4c4c,_0x4186bd){return function(_0x525b16){if(!_0x525b16){_0x5f4c4c[_0x23bb('0x26')](0x194);}return _0x525b16;};}function handleError(_0x1418dd,_0x3ea971){_0x3ea971=_0x3ea971||0x1f4;return function(_0x55b594){logger[_0x23bb('0x27')](_0x55b594[_0x23bb('0x28')]);if(_0x55b594[_0x23bb('0x29')]){delete _0x55b594[_0x23bb('0x29')];}_0x1418dd['status'](_0x3ea971)[_0x23bb('0x2a')](_0x55b594);};}exports[_0x23bb('0x23')]=function(_0x2a27b9,_0x16a11f){if(_0x2a27b9[_0x23bb('0x2b')]['id']){delete _0x2a27b9[_0x23bb('0x2b')]['id'];}return db[_0x23bb('0x2c')]['find']({'where':{'id':_0x2a27b9[_0x23bb('0x2d')]['id']}})[_0x23bb('0x24')](handleEntityNotFound(_0x16a11f,null))[_0x23bb('0x24')](saveUpdates(_0x2a27b9[_0x23bb('0x2b')],null))[_0x23bb('0x24')](respondWithResult(_0x16a11f,null))[_0x23bb('0x2e')](handleError(_0x16a11f,null));};exports[_0x23bb('0x25')]=function(_0x2e00e5,_0xb525ce){return db[_0x23bb('0x2c')][_0x23bb('0x2f')]({'where':{'id':_0x2e00e5[_0x23bb('0x2d')]['id']}})[_0x23bb('0x24')](handleEntityNotFound(_0xb525ce,null))[_0x23bb('0x24')](removeEntity(_0xb525ce,null))[_0x23bb('0x2e')](handleError(_0xb525ce,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index ca4d014..f5e5698 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 _0xdeb7=['Action','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x36e65d,_0x442690){var _0x33bc42=function(_0x301b20){while(--_0x301b20){_0x36e65d['push'](_0x36e65d['shift']());}};_0x33bc42(++_0x442690);}(_0xdeb7,0xb1));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7deb('0x0'));var util=require(_0x7deb('0x1'));var logger=require(_0x7deb('0x2'))(_0x7deb('0x3'));var moment=require('moment');var BPromise=require(_0x7deb('0x4'));var rp=require(_0x7deb('0x5'));var fs=require('fs');var path=require(_0x7deb('0x6'));var rimraf=require(_0x7deb('0x7'));var config=require(_0x7deb('0x8'));var attributes=require('./action.attributes');module[_0x7deb('0x9')]=function(_0x1c1fd2,_0x407c52){return _0x1c1fd2['define'](_0x7deb('0xa'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d55=['exports','define','Action','tools_actions','lodash','util','moment','bluebird','request-promise','path','rimraf','./action.attributes'];(function(_0x39535b,_0x13f0bb){var _0x5eed0e=function(_0x5e7254){while(--_0x5e7254){_0x39535b['push'](_0x39535b['shift']());}};_0x5eed0e(++_0x13f0bb);}(_0x9d55,0x70));var _0x59d5=function(_0x47edf7,_0x3fd83e){_0x47edf7=_0x47edf7-0x0;var _0x12d8f5=_0x9d55[_0x47edf7];return _0x12d8f5;};'use strict';var _=require(_0x59d5('0x0'));var util=require(_0x59d5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x59d5('0x2'));var BPromise=require(_0x59d5('0x3'));var rp=require(_0x59d5('0x4'));var fs=require('fs');var path=require(_0x59d5('0x5'));var rimraf=require(_0x59d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x59d5('0x7'));module[_0x59d5('0x8')]=function(_0x19e407,_0x3ee520){return _0x19e407[_0x59d5('0x9')](_0x59d5('0xa'),attributes,{'tableName':_0x59d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 8a3da4d..100899f 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 _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2c603c,_0x6db19){var _0x5652da=function(_0xb65356){while(--_0xb65356){_0x2c603c['push'](_0x2c603c['shift']());}};_0x5652da(++_0x6db19);}(_0x5fab,0x177));var _0xb5fa=function(_0x546496,_0x51544c){_0x546496=_0x546496-0x0;var _0x3afe5a=_0x5fab[_0x546496];return _0x3afe5a;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0x4975,0x86));var _0x5497=function(_0xf13615,_0x5c11ed){_0xf13615=_0xf13615-0x0;var _0xd1aaa9=_0x4975[_0xf13615];return _0xd1aaa9;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e2cad20..c705662 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 _0xbfb1=['/:id','update','isAuthenticated','exports','multer','util','../../components/auth/service','./action.controller'];(function(_0x134a72,_0x5cf1f5){var _0x36d44b=function(_0x5ab9bd){while(--_0x5ab9bd){_0x134a72['push'](_0x134a72['shift']());}};_0x36d44b(++_0x5cf1f5);}(_0xbfb1,0x7c));var _0x1bfb=function(_0x1f336d,_0x5d0bee){_0x1f336d=_0x1f336d-0x0;var _0x49199d=_0xbfb1[_0x1f336d];return _0x49199d;};'use strict';var multer=require(_0x1bfb('0x0'));var util=require(_0x1bfb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1bfb('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1bfb('0x3'));router['put'](_0x1bfb('0x4'),auth['isAuthenticated'](),controller[_0x1bfb('0x5')]);router['delete'](_0x1bfb('0x4'),auth[_0x1bfb('0x6')](),controller['destroy']);module[_0x1bfb('0x7')]=router; \ No newline at end of file +var _0x0373=['update','delete','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id'];(function(_0x18033b,_0x342cbd){var _0x3b12e5=function(_0x39dd33){while(--_0x39dd33){_0x18033b['push'](_0x18033b['shift']());}};_0x3b12e5(++_0x342cbd);}(_0x0373,0x1c4));var _0x3037=function(_0x1dfc98,_0x3264e9){_0x1dfc98=_0x1dfc98-0x0;var _0x57430f=_0x0373[_0x1dfc98];return _0x57430f;};'use strict';var multer=require(_0x3037('0x0'));var util=require(_0x3037('0x1'));var path=require(_0x3037('0x2'));var timeout=require(_0x3037('0x3'));var express=require(_0x3037('0x4'));var router=express[_0x3037('0x5')]();var fs_extra=require(_0x3037('0x6'));var auth=require(_0x3037('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x3037('0x8'));var controller=require(_0x3037('0x9'));router[_0x3037('0xa')](_0x3037('0xb'),auth['isAuthenticated'](),controller[_0x3037('0xc')]);router[_0x3037('0xd')]('/:id',auth[_0x3037('0xe')](),controller['destroy']);module[_0x3037('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 60c48b2..0df4ad2 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 _0x5fab=['exports','STRING','TEXT','sequelize'];(function(_0x35f18a,_0x4e66d3){var _0x52d4e0=function(_0x267f42){while(--_0x267f42){_0x35f18a['push'](_0x35f18a['shift']());}};_0x52d4e0(++_0x4e66d3);}(_0x5fab,0x177));var _0xb5fa=function(_0x9c607a,_0x1cb2c6){_0x9c607a=_0x9c607a-0x0;var _0x3b1311=_0x5fab[_0x9c607a];return _0x3b1311;};'use strict';var Sequelize=require(_0xb5fa('0x0'));module[_0xb5fa('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xb5fa('0x2')]},'parent':{'type':Sequelize[_0xb5fa('0x2')]},'table':{'type':Sequelize[_0xb5fa('0x2')]},'conditions':{'type':Sequelize[_0xb5fa('0x3')]},'joins':{'type':Sequelize[_0xb5fa('0x3')]}}; \ No newline at end of file +var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x41d1b0,_0x30a15d){var _0x2659f4=function(_0x19cdc7){while(--_0x19cdc7){_0x41d1b0['push'](_0x41d1b0['shift']());}};_0x2659f4(++_0x30a15d);}(_0x31f0,0xb7));var _0x031f=function(_0x35753e,_0x329c1b){_0x35753e=_0x35753e-0x0;var _0xc7c60f=_0x31f0[_0x35753e];return _0xc7c60f;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 97580e6..e726022 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 _0x41fa=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','end','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','AnalyticCustomReport','includeAll','findAll','rows','catch','show','params','include','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MIN(%s)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','Sequelize','from','web','fullPath','%s-%s.%s','randomstring','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','output','../../files/reports','savename','countTable','SELECT','run','runReport','eml-format'];(function(_0x2f679e,_0x2c63c8){var _0x3ce213=function(_0x47b866){while(--_0x47b866){_0x2f679e['push'](_0x2f679e['shift']());}};_0x3ce213(++_0x2c63c8);}(_0x41fa,0x1f1));var _0xa41f=function(_0xa8d7ef,_0x4b8b3d){_0xa8d7ef=_0xa8d7ef-0x0;var _0x239d5e=_0x41fa[_0xa8d7ef];return _0x239d5e;};'use strict';var emlformat=require(_0xa41f('0x0'));var rimraf=require(_0xa41f('0x1'));var zipdir=require(_0xa41f('0x2'));var jsonpatch=require(_0xa41f('0x3'));var rp=require(_0xa41f('0x4'));var moment=require(_0xa41f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa41f('0x6'));var util=require(_0xa41f('0x7'));var path=require(_0xa41f('0x8'));var sox=require(_0xa41f('0x9'));var csv=require(_0xa41f('0xa'));var ejs=require(_0xa41f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa41f('0xc'));var squel=require(_0xa41f('0xd'));var crypto=require(_0xa41f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa41f('0xf'));var toCsv=require(_0xa41f('0xa'));var querystring=require(_0xa41f('0x10'));var Papa=require(_0xa41f('0x11'));var Redis=require(_0xa41f('0x12'));var authService=require(_0xa41f('0x13'));var qs=require(_0xa41f('0x14'));var as=require(_0xa41f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa41f('0x16'))(_0xa41f('0x17'));var utils=require(_0xa41f('0x18'));var config=require(_0xa41f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa41f('0x1a'))['db'];var dbH=require(_0xa41f('0x1a'))[_0xa41f('0x1b')];function respondWithStatusCode(_0x32b9d8,_0x13b4f4){_0x13b4f4=_0x13b4f4||0xcc;return function(_0x4b10d2){if(_0x4b10d2){return _0x32b9d8[_0xa41f('0x1c')](_0x13b4f4);}return _0x32b9d8[_0xa41f('0x1d')](_0x13b4f4)['end']();};}function respondWithResult(_0x5e050e,_0x2c80ae){_0x2c80ae=_0x2c80ae||0xc8;return function(_0x570ad5){if(_0x570ad5){return _0x5e050e['status'](_0x2c80ae)[_0xa41f('0x1e')](_0x570ad5);}};}function respondWithFilteredResult(_0x2de743,_0x56acbb){return function(_0x19b576){if(_0x19b576){var _0x56128b=typeof _0x56acbb[_0xa41f('0x1f')]===_0xa41f('0x20')&&typeof _0x56acbb[_0xa41f('0x21')]===_0xa41f('0x20');var _0x568d98=_0x19b576[_0xa41f('0x22')];var _0x1d363b=_0x56128b?0x0:_0x56acbb[_0xa41f('0x1f')];var _0x4d7564=_0x56128b?_0x19b576['count']:_0x56acbb[_0xa41f('0x1f')]+_0x56acbb[_0xa41f('0x21')];var _0x224d8c;if(_0x4d7564>=_0x568d98){_0x4d7564=_0x568d98;_0x224d8c=0xc8;}else{_0x224d8c=0xce;}_0x2de743['status'](_0x224d8c);return _0x2de743[_0xa41f('0x23')](_0xa41f('0x24'),_0x1d363b+'-'+_0x4d7564+'/'+_0x568d98)[_0xa41f('0x1e')](_0x19b576);}return null;};}function patchUpdates(_0x911489){return function(_0x44b0a7){try{jsonpatch[_0xa41f('0x25')](_0x44b0a7,_0x911489,!![]);}catch(_0x5b6214){return BPromise[_0xa41f('0x26')](_0x5b6214);}return _0x44b0a7['save']();};}function saveUpdates(_0x960cc0,_0x4bedde){return function(_0x5053a0){if(_0x5053a0){return _0x5053a0[_0xa41f('0x27')](_0x960cc0)[_0xa41f('0x28')](function(_0xe0302c){return _0xe0302c;});}return null;};}function removeEntity(_0x84a34f,_0x158cc2){return function(_0x54eef){if(_0x54eef){return _0x54eef[_0xa41f('0x29')]()[_0xa41f('0x28')](function(){var _0xa65f5c=_0x54eef['get']({'plain':!![]});var _0x386bc6='CustomReports';return db[_0xa41f('0x2a')][_0xa41f('0x29')]({'where':{'type':_0x386bc6,'resourceId':_0xa65f5c['id']}})[_0xa41f('0x28')](function(){return _0x54eef;});})[_0xa41f('0x28')](function(){_0x84a34f['status'](0xcc)[_0xa41f('0x2b')]();});}};}function handleEntityNotFound(_0x391014,_0x2c8360){return function(_0x2d4059){if(!_0x2d4059){_0x391014[_0xa41f('0x1c')](0x194);}return _0x2d4059;};}function handleError(_0xf2f543,_0x34f031){_0x34f031=_0x34f031||0x1f4;return function(_0x27fe53){logger[_0xa41f('0x2c')](_0x27fe53['stack']);if(_0x27fe53[_0xa41f('0x2d')]){delete _0x27fe53['name'];}_0xf2f543[_0xa41f('0x1d')](_0x34f031)[_0xa41f('0x2e')](_0x27fe53);};}exports['index']=function(_0x2034c5,_0x83e9e1){var _0x25db13={},_0x2a6e8a={},_0x1def27={'count':0x0,'rows':[]};var _0x54adda=_[_0xa41f('0x2f')](db['AnalyticCustomReport'][_0xa41f('0x30')],function(_0x57ce11){return{'name':_0x57ce11[_0xa41f('0x31')],'type':_0x57ce11[_0xa41f('0x32')]['key']};});_0x2a6e8a[_0xa41f('0x33')]=_[_0xa41f('0x2f')](_0x54adda,_0xa41f('0x2d'));_0x2a6e8a[_0xa41f('0x34')]=_[_0xa41f('0x35')](_0x2034c5['query']);_0x2a6e8a[_0xa41f('0x36')]=_['intersection'](_0x2a6e8a[_0xa41f('0x33')],_0x2a6e8a[_0xa41f('0x34')]);_0x25db13[_0xa41f('0x37')]=_[_0xa41f('0x38')](_0x2a6e8a['model'],qs[_0xa41f('0x39')](_0x2034c5['query'][_0xa41f('0x39')]));_0x25db13[_0xa41f('0x37')]=_0x25db13[_0xa41f('0x37')][_0xa41f('0x3a')]?_0x25db13[_0xa41f('0x37')]:_0x2a6e8a['model'];if(!_0x2034c5[_0xa41f('0x34')][_0xa41f('0x3b')](_0xa41f('0x3c'))){_0x25db13[_0xa41f('0x21')]=qs[_0xa41f('0x21')](_0x2034c5[_0xa41f('0x34')][_0xa41f('0x21')]);_0x25db13['offset']=qs[_0xa41f('0x1f')](_0x2034c5[_0xa41f('0x34')]['offset']);}_0x25db13[_0xa41f('0x3d')]=qs[_0xa41f('0x3e')](_0x2034c5['query'][_0xa41f('0x3e')]);_0x25db13[_0xa41f('0x3f')]=qs[_0xa41f('0x36')](_['pick'](_0x2034c5[_0xa41f('0x34')],_0x2a6e8a['filters']),_0x54adda);if(_0x2034c5[_0xa41f('0x34')]['filter']){_0x25db13['where']=_['merge'](_0x25db13[_0xa41f('0x3f')],{'$or':_[_0xa41f('0x2f')](_0x54adda,function(_0x499c77){if(_0x499c77[_0xa41f('0x32')]!==_0xa41f('0x40')){var _0x3dbee5={};_0x3dbee5[_0x499c77[_0xa41f('0x2d')]]={'$like':'%'+_0x2034c5[_0xa41f('0x34')][_0xa41f('0x41')]+'%'};return _0x3dbee5;}})});}_0x25db13=_[_0xa41f('0x42')]({},_0x25db13,_0x2034c5[_0xa41f('0x43')]);var _0x472f67={'where':_0x25db13[_0xa41f('0x3f')]};return db[_0xa41f('0x44')][_0xa41f('0x22')](_0x472f67)['then'](function(_0x2c0409){_0x1def27[_0xa41f('0x22')]=_0x2c0409;if(_0x2034c5['query'][_0xa41f('0x45')]){_0x25db13['include']=[{'all':!![]}];}return db[_0xa41f('0x44')][_0xa41f('0x46')](_0x25db13);})['then'](function(_0x14f24b){_0x1def27[_0xa41f('0x47')]=_0x14f24b;return _0x1def27;})[_0xa41f('0x28')](respondWithFilteredResult(_0x83e9e1,_0x25db13))[_0xa41f('0x48')](handleError(_0x83e9e1,null));};exports[_0xa41f('0x49')]=function(_0x3df786,_0x49ec0d){var _0x1c594f={'raw':![],'where':{'id':_0x3df786[_0xa41f('0x4a')]['id']}},_0x422bee={};_0x422bee[_0xa41f('0x33')]=_['keys'](db[_0xa41f('0x44')][_0xa41f('0x30')]);_0x422bee[_0xa41f('0x34')]=_['keys'](_0x3df786[_0xa41f('0x34')]);_0x422bee[_0xa41f('0x36')]=_['intersection'](_0x422bee[_0xa41f('0x33')],_0x422bee[_0xa41f('0x34')]);_0x1c594f[_0xa41f('0x37')]=_[_0xa41f('0x38')](_0x422bee[_0xa41f('0x33')],qs['fields'](_0x3df786[_0xa41f('0x34')][_0xa41f('0x39')]));_0x1c594f[_0xa41f('0x37')]=_0x1c594f['attributes'][_0xa41f('0x3a')]?_0x1c594f[_0xa41f('0x37')]:_0x422bee[_0xa41f('0x33')];if(_0x3df786[_0xa41f('0x34')][_0xa41f('0x45')]){_0x1c594f[_0xa41f('0x4b')]=[{'all':!![]}];}_0x1c594f=_[_0xa41f('0x42')]({},_0x1c594f,_0x3df786[_0xa41f('0x43')]);return db[_0xa41f('0x44')]['find'](_0x1c594f)['then'](handleEntityNotFound(_0x49ec0d,null))[_0xa41f('0x28')](respondWithResult(_0x49ec0d,null))[_0xa41f('0x48')](handleError(_0x49ec0d,null));};exports[_0xa41f('0x4c')]=function(_0x7abc07,_0x5c9f08){return db['AnalyticCustomReport'][_0xa41f('0x4c')](_0x7abc07['body'],{})[_0xa41f('0x28')](function(_0x8446ca){var _0x3159b1=_0x7abc07[_0xa41f('0x4d')][_0xa41f('0x4e')]({'plain':!![]});if(!_0x3159b1)throw new Error(_0xa41f('0x4f'));if(_0x3159b1[_0xa41f('0x50')]===_0xa41f('0x4d')){var _0xdd0316=_0x8446ca[_0xa41f('0x4e')]({'plain':!![]});var _0x47c004='Reports';return db[_0xa41f('0x51')][_0xa41f('0x52')]({'where':{'name':_0x47c004,'userProfileId':_0x3159b1['userProfileId']},'raw':!![]})[_0xa41f('0x28')](function(_0x46b795){if(_0x46b795&&_0x46b795[_0xa41f('0x53')]===0x0){return db['UserProfileResource'][_0xa41f('0x4c')]({'name':_0xdd0316[_0xa41f('0x2d')],'resourceId':_0xdd0316['id'],'type':'CustomReports','sectionId':_0x46b795['id']},{})[_0xa41f('0x28')](function(){return _0x8446ca;});}else{return _0x8446ca;}})['catch'](function(_0x52721e){logger[_0xa41f('0x2c')](_0xa41f('0x54'),_0x52721e);throw _0x52721e;});}return _0x8446ca;})[_0xa41f('0x28')](respondWithResult(_0x5c9f08,0xc9))[_0xa41f('0x48')](handleError(_0x5c9f08,null));};exports[_0xa41f('0x27')]=function(_0x477630,_0x58e3af){if(_0x477630[_0xa41f('0x55')]['id']){delete _0x477630[_0xa41f('0x55')]['id'];}return db[_0xa41f('0x44')][_0xa41f('0x52')]({'where':{'id':_0x477630[_0xa41f('0x4a')]['id']}})[_0xa41f('0x28')](handleEntityNotFound(_0x58e3af,null))[_0xa41f('0x28')](saveUpdates(_0x477630[_0xa41f('0x55')],null))['then'](respondWithResult(_0x58e3af,null))[_0xa41f('0x48')](handleError(_0x58e3af,null));};exports[_0xa41f('0x29')]=function(_0x54610,_0x313ce1){return db[_0xa41f('0x44')][_0xa41f('0x52')]({'where':{'id':_0x54610[_0xa41f('0x4a')]['id']}})[_0xa41f('0x28')](handleEntityNotFound(_0x313ce1,null))['then'](removeEntity(_0x313ce1,null))[_0xa41f('0x48')](handleError(_0x313ce1,null));};exports[_0xa41f('0x56')]=function(_0x4247e2,_0x50f1da){var _0x29bd00=0xa;var _0x5bcb4f=[_0xa41f('0x57'),_0xa41f('0x58'),_0xa41f('0x59'),_0xa41f('0x5a')];var _0x2b7975={'SUM':_0xa41f('0x5b'),'COUNT':_0xa41f('0x5c'),'COUNT DISTINCT':_0xa41f('0x5d'),'MAX':_0xa41f('0x5e'),'MIN':'MIN(%s)','AVG':_0xa41f('0x5f'),'GROUP_CONCAT':_0xa41f('0x60'),'GROUP_CONCAT ASC':_0xa41f('0x61'),'GROUP_CONCAT DESC':_0xa41f('0x62')};var _0x2678af={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xa41f('0x63'),'HOUR':_0xa41f('0x64'),'ROUND':_0xa41f('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x7a898b=function(_0x17a232){return!_[_0xa41f('0x66')]([_0xa41f('0x67'),'IS\x20NOT\x20NULL',_0xa41f('0x68'),_0xa41f('0x69')],_0x17a232);};var _0x1f6170=function(_0x367e1b){if(!_0x367e1b||!_0x367e1b[_0xa41f('0x6a')][_0xa41f('0x3a')]){return'';}for(var _0x598dde='(',_0x390153=0x0;_0x390153<_0x367e1b[_0xa41f('0x6a')]['length'];_0x390153+=0x1){_0x390153>0x0&&(_0x598dde+='\x20'+_0x367e1b[_0xa41f('0x6b')]+'\x20');_0x598dde+=_0x367e1b[_0xa41f('0x6a')][_0x390153][_0xa41f('0x6c')]?_0x1f6170(_0x367e1b['rules'][_0x390153][_0xa41f('0x6c')]):_0x367e1b[_0xa41f('0x6a')][_0x390153][_0xa41f('0x6d')]+'\x20'+_0x367e1b['rules'][_0x390153]['condition']+(_0x7a898b(_0x367e1b['rules'][_0x390153][_0xa41f('0x6e')])?'\x20'+_0x367e1b[_0xa41f('0x6a')][_0x390153][_0xa41f('0x6f')]:'');}return _0x598dde+')';};var _0x5bcab3={'where':{'id':_0x4247e2['params']['id']}},_0xf272d5,_0x5388fc,_0x549adc,_0x18295d,_0x264912;_0x5bcab3=_[_0xa41f('0x42')]({},_0x5bcab3,_0x4247e2[_0xa41f('0x43')]);return db['AnalyticCustomReport'][_0xa41f('0x52')](_0x5bcab3)[_0xa41f('0x28')](function(_0x28cf6b){if(_0x28cf6b){_0xf272d5=_0x28cf6b;return _0x28cf6b[_0xa41f('0x70')]();}return null;})['then'](function(_0x25bd80){if(_0x25bd80){if(!_0x25bd80[_0xa41f('0x3a')]){throw new db['Sequelize'][(_0xa41f('0x71'))](_0xa41f('0x72'),0x193);}_0x5388fc=_0x25bd80;return db[_0xa41f('0x73')][_0xa41f('0x46')]({'raw':!![]});}return null;})[_0xa41f('0x28')](function(_0x49fb7c){if(_0x49fb7c){_0x549adc=_[_0xa41f('0x74')](_0x49fb7c,'id');var _0x3cd9b5;var _0x2f4970=squel[_0xa41f('0x75')]();_0x2f4970['from'](_0xf272d5[_0xa41f('0x76')]);for(var _0x587ac7=0x0;_0x587ac7<_0x5388fc[_0xa41f('0x3a')];_0x587ac7+=0x1){_0x3cd9b5=_0x5388fc[_0x587ac7][_0xa41f('0x77')]?_0x549adc[_0x5388fc[_0x587ac7][_0xa41f('0x77')]][_0xa41f('0x78')]:_0x5388fc[_0x587ac7]['field'];_0x3cd9b5=_0x5388fc[_0x587ac7][_0xa41f('0x79')]?_[_0xa41f('0x7a')](_0x2b7975[_0x5388fc[_0x587ac7]['function']],'%s',_0x3cd9b5):_0x3cd9b5;_0x3cd9b5=_0x5388fc[_0x587ac7][_0xa41f('0x7b')]?_[_0xa41f('0x7a')](_0x2678af[_0x5388fc[_0x587ac7]['format']],'%s',_0x3cd9b5):_0x3cd9b5;if(_0x5388fc[_0x587ac7][_0xa41f('0x7c')]){_0x2f4970['group'](_0x3cd9b5);}_0x5388fc[_0x587ac7][_0xa41f('0x7d')]&&_0x2f4970[_0xa41f('0x3d')](_0x3cd9b5,_0x5388fc[_0x587ac7][_0xa41f('0x7d')]===_0xa41f('0x7e')?![]:!![]);_0x2f4970[_0xa41f('0x6d')](_0x3cd9b5,_0x5388fc[_0x587ac7][_0xa41f('0x7f')]||_0x3cd9b5);}if(_0xf272d5[_0xa41f('0x80')]){_0xf272d5[_0xa41f('0x80')]=JSON[_0xa41f('0x81')](_0xf272d5['joins']);for(var _0xe28d3b=0x0;_0xe28d3b<_0xf272d5[_0xa41f('0x80')][_0xa41f('0x3a')];_0xe28d3b+=0x1){if(_0xf272d5[_0xa41f('0x80')][_0xe28d3b][_0xa41f('0x32')]&&_[_0xa41f('0x66')](_0x5bcb4f,_0xf272d5[_0xa41f('0x80')][_0xe28d3b]['type'])&&_0xf272d5[_0xa41f('0x80')][_0xe28d3b][_0xa41f('0x82')]&&_0xf272d5[_0xa41f('0x80')][_0xe28d3b]['foreignTable']&&_0xf272d5[_0xa41f('0x80')][_0xe28d3b][_0xa41f('0x83')]){_0x2f4970[_0xf272d5['joins'][_0xe28d3b][_0xa41f('0x32')]](_0xf272d5[_0xa41f('0x80')][_0xe28d3b]['foreignTable'],null,util[_0xa41f('0x7b')](_0xa41f('0x84'),_0xf272d5[_0xa41f('0x76')],_0xf272d5['joins'][_0xe28d3b]['parentKey'],_0xf272d5[_0xa41f('0x80')][_0xe28d3b][_0xa41f('0x85')],_0xf272d5[_0xa41f('0x80')][_0xe28d3b][_0xa41f('0x83')]));}}}if(_0xf272d5['conditions']){_0xf272d5[_0xa41f('0x86')]=JSON['parse'](_0xf272d5[_0xa41f('0x86')]);_0x2f4970['where'](_0x1f6170(_0xf272d5[_0xa41f('0x86')][_0xa41f('0x6c')]));}_0x264912=_0x2f4970[_0xa41f('0x87')]();_0x2f4970[_0xa41f('0x21')](_0x29bd00);_0x2f4970[_0xa41f('0x1f')](0x0);logger[_0xa41f('0x88')](_0xa41f('0x89'),_0x2f4970[_0xa41f('0x8a')]());return dbH[_0xa41f('0x8b')][_0xa41f('0x34')](_0x2f4970['toString'](),{'type':dbH['sequelize'][_0xa41f('0x8c')]['SELECT']});}})[_0xa41f('0x28')](respondWithResult(_0x50f1da,null))[_0xa41f('0x48')](handleError(_0x50f1da,null));};function runReport(_0x9e50fd,_0x195a72,_0x2e55a2){var _0x537d85=_0x195a72[_0xa41f('0x2d')];var _0x3a6767=0xa;var _0x31d2a4=[_0xa41f('0x57'),_0xa41f('0x58'),_0xa41f('0x59'),_0xa41f('0x5a')];var _0x13887b={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xa41f('0x5e'),'MIN':_0xa41f('0x8d'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa41f('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa41f('0x62')};var _0x37af6a={'SEC_TO_TIME':_0xa41f('0x8e'),'DATE':_0xa41f('0x63'),'HOUR':_0xa41f('0x64'),'ROUND':_0xa41f('0x65'),'UNIX_TIMESTAMP':_0xa41f('0x8f')};var _0x57dadc=function(_0x4064b8){return!_[_0xa41f('0x66')]([_0xa41f('0x67'),_0xa41f('0x90'),_0xa41f('0x68'),_0xa41f('0x69')],_0x4064b8);};var _0x487397=function(_0x3d71ae){if(!_0x3d71ae||!_0x3d71ae[_0xa41f('0x6a')][_0xa41f('0x3a')]){return'';}for(var _0x42d265='(',_0x5c0949=0x0;_0x5c0949<_0x3d71ae[_0xa41f('0x6a')][_0xa41f('0x3a')];_0x5c0949+=0x1){_0x5c0949>0x0&&(_0x42d265+='\x20'+_0x3d71ae['operator']+'\x20');_0x42d265+=_0x3d71ae[_0xa41f('0x6a')][_0x5c0949][_0xa41f('0x6c')]?_0x487397(_0x3d71ae['rules'][_0x5c0949]['group']):_0x3d71ae['rules'][_0x5c0949][_0xa41f('0x6d')]+'\x20'+_0x3d71ae[_0xa41f('0x6a')][_0x5c0949]['condition']+(_0x57dadc(_0x3d71ae['rules'][_0x5c0949][_0xa41f('0x6e')])?'\x20'+_0x3d71ae[_0xa41f('0x6a')][_0x5c0949][_0xa41f('0x6f')]:'');}return _0x42d265+')';};var _0x294e52={'where':{'id':_0x9e50fd['id']}},_0x544085,_0x56d56c,_0x94c759,_0x114c31,_0x4a6096;_0x294e52=_['merge']({},_0x294e52,_0x2e55a2);return db[_0xa41f('0x44')]['find'](_0x294e52)[_0xa41f('0x28')](function(_0x41dac8){if(_0x41dac8){_0x544085=_0x41dac8;return _0x41dac8[_0xa41f('0x70')]();}return null;})[_0xa41f('0x28')](function(_0x2c7e37){if(_0x2c7e37){if(!_0x2c7e37[_0xa41f('0x3a')]){throw new db[(_0xa41f('0x91'))]['ValidationErrorItem'](_0xa41f('0x72'),0x193);}_0x56d56c=_0x2c7e37;return db[_0xa41f('0x73')]['findAll']({'raw':!![]});}return null;})[_0xa41f('0x28')](function(_0x335d36){if(_0x335d36){_0x94c759=_[_0xa41f('0x74')](_0x335d36,'id');var _0x305d32;var _0x455a79=squel['select']();_0x455a79[_0xa41f('0x92')](_0x544085[_0xa41f('0x76')]);for(var _0x202ee9=0x0;_0x202ee9<_0x56d56c['length'];_0x202ee9+=0x1){_0x305d32=_0x56d56c[_0x202ee9][_0xa41f('0x77')]?_0x94c759[_0x56d56c[_0x202ee9][_0xa41f('0x77')]][_0xa41f('0x78')]:_0x56d56c[_0x202ee9]['field'];_0x305d32=_0x56d56c[_0x202ee9][_0xa41f('0x79')]?_['replace'](_0x13887b[_0x56d56c[_0x202ee9][_0xa41f('0x79')]],'%s',_0x305d32):_0x305d32;_0x305d32=_0x56d56c[_0x202ee9][_0xa41f('0x7b')]?_[_0xa41f('0x7a')](_0x37af6a[_0x56d56c[_0x202ee9]['format']],'%s',_0x305d32):_0x305d32;if(_0x56d56c[_0x202ee9]['groupBy']){_0x455a79[_0xa41f('0x6c')](_0x305d32);}_0x56d56c[_0x202ee9][_0xa41f('0x7d')]&&_0x455a79['order'](_0x305d32,_0x56d56c[_0x202ee9]['orderBy']===_0xa41f('0x7e')?![]:!![]);_0x455a79['field'](_0x305d32,_0x56d56c[_0x202ee9]['alias']||_0x305d32);}if(_0x544085[_0xa41f('0x80')]){_0x544085[_0xa41f('0x80')]=JSON[_0xa41f('0x81')](_0x544085[_0xa41f('0x80')]);for(var _0x1680d0=0x0;_0x1680d0<_0x544085['joins'][_0xa41f('0x3a')];_0x1680d0+=0x1){if(_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x32')]&&_[_0xa41f('0x66')](_0x31d2a4,_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x32')])&&_0x544085[_0xa41f('0x80')][_0x1680d0]['parentKey']&&_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x85')]&&_0x544085[_0xa41f('0x80')][_0x1680d0]['foreignKey']){_0x455a79[_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x32')]](_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x85')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x544085[_0xa41f('0x76')],_0x544085[_0xa41f('0x80')][_0x1680d0]['parentKey'],_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x85')],_0x544085[_0xa41f('0x80')][_0x1680d0][_0xa41f('0x83')]));}}}if(_0x544085[_0xa41f('0x86')]){_0x544085[_0xa41f('0x86')]=JSON[_0xa41f('0x81')](_0x544085[_0xa41f('0x86')]);_0x455a79[_0xa41f('0x3f')](_0x487397(_0x544085['conditions'][_0xa41f('0x6c')]));}_0x4a6096=_0x455a79[_0xa41f('0x87')]();_0x455a79[_0xa41f('0x21')](_0x3a6767);_0x455a79[_0xa41f('0x1f')](0x0);return;}})[_0xa41f('0x28')](function(){if(_0x195a72['output']===_0xa41f('0x93')){return null;}var _0x33e573=_[_0xa41f('0x42')](_0x195a72,{'name':_0x195a72[_0xa41f('0x94')]||_0x195a72[_0xa41f('0x2d')]||_0x544085[_0xa41f('0x2d')],'basename':_0x537d85,'savename':util[_0xa41f('0x7b')](_0xa41f('0x95'),_0x195a72[_0xa41f('0x2d')]||_0x544085[_0xa41f('0x2d')],require(_0xa41f('0x96'))[_0xa41f('0x97')](0x4),_0x195a72['output']||_0xa41f('0x98')),'reportId':_0x544085['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0xa41f('0x4c')](_0x33e573,{'raw':!![]});})['then'](function(_0x30beae){if(_0x544085['table']===_0xa41f('0x99')){_0x4a6096[_0xa41f('0x3f')](_0x544085[_0xa41f('0x76')]+_0xa41f('0x9a'),_0x195a72['startDate'],_0x195a72[_0xa41f('0x9b')]);}else{_0x4a6096[_0xa41f('0x3f')](_0x544085[_0xa41f('0x76')]+_0xa41f('0x9c'),_0x195a72['startDate'],_0x195a72[_0xa41f('0x9b')]);}if(_0x30beae){logger['info'](_0xa41f('0x9d'),_0x4a6096[_0xa41f('0x8a')]());require(_0xa41f('0x9e'))['fork'](path[_0xa41f('0x57')](__dirname,'../../components/export/',_0x30beae[_0xa41f('0x9f')]),[_0x30beae['id'],_0x4a6096[_0xa41f('0x8a')](),path[_0xa41f('0x57')](__dirname,_0xa41f('0xa0'),_0x30beae[_0xa41f('0xa1')]),_0x537d85]);return _0x30beae;}else{var _0x5d5823=squel[_0xa41f('0x75')]();_0x5d5823[_0xa41f('0x92')]('('+_0x4a6096[_0xa41f('0x8a')]()+')',_0xa41f('0xa2'));_0x5d5823[_0xa41f('0x6d')]('COUNT(*)',_0xa41f('0x22'));_0x4a6096['limit'](_0x195a72[_0xa41f('0x21')]||_0x3a6767);_0x4a6096[_0xa41f('0x1f')](_0x195a72[_0xa41f('0x1f')]||0x0);return dbH['sequelize']['query'](_0x5d5823['toString'](),{'type':dbH[_0xa41f('0x8b')][_0xa41f('0x8c')][_0xa41f('0xa3')]})['then'](function(_0x1d02b4){if(!_0x1d02b4[_0xa41f('0x3a')]){_0x114c31=0x0;}else{_0x114c31=_0x1d02b4[0x0][_0xa41f('0x22')]||0x0;}return dbH[_0xa41f('0x8b')][_0xa41f('0x34')](_0x4a6096[_0xa41f('0x8a')](),{'type':dbH[_0xa41f('0x8b')][_0xa41f('0x8c')][_0xa41f('0xa3')]});})[_0xa41f('0x28')](function(_0x3cca4f){return{'rows':_0x3cca4f||[],'count':_0x114c31};});}});}exports[_0xa41f('0xa4')]=function(_0x258f71,_0x3157a2){return runReport(_0x258f71[_0xa41f('0x4a')],_0x258f71[_0xa41f('0x34')],_0x258f71[_0xa41f('0x43')])[_0xa41f('0x28')](respondWithResult(_0x3157a2,null))[_0xa41f('0x48')](handleError(_0x3157a2,null));};exports[_0xa41f('0xa5')]=runReport;exports[_0xa41f('0x34')]=function(_0x43e137,_0x1fc4cb){var _0x5890da=0xa;var _0x19c1e1=[_0xa41f('0x57'),_0xa41f('0x58'),_0xa41f('0x59'),_0xa41f('0x5a')];var _0x19c5fc={'SUM':_0xa41f('0x5b'),'COUNT':_0xa41f('0x5c'),'COUNT DISTINCT':_0xa41f('0x5d'),'MAX':_0xa41f('0x5e'),'MIN':'MIN(%s)','AVG':_0xa41f('0x5f'),'GROUP_CONCAT':_0xa41f('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xa41f('0x62')};var _0x101c3c={'SEC_TO_TIME':_0xa41f('0x8e'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0xa41f('0x65'),'UNIX_TIMESTAMP':_0xa41f('0x8f')};var _0x10673d=function(_0x5e7d1d){return!_['includes']([_0xa41f('0x67'),_0xa41f('0x90'),_0xa41f('0x68'),_0xa41f('0x69')],_0x5e7d1d);};var _0x2cec6f=function(_0x3681cd){if(!_0x3681cd||!_0x3681cd['rules'][_0xa41f('0x3a')]){return'';}for(var _0x1fbd61='(',_0x2d90c5=0x0;_0x2d90c5<_0x3681cd[_0xa41f('0x6a')][_0xa41f('0x3a')];_0x2d90c5+=0x1){_0x2d90c5>0x0&&(_0x1fbd61+='\x20'+_0x3681cd['operator']+'\x20');_0x1fbd61+=_0x3681cd[_0xa41f('0x6a')][_0x2d90c5]['group']?_0x2cec6f(_0x3681cd[_0xa41f('0x6a')][_0x2d90c5][_0xa41f('0x6c')]):_0x3681cd['rules'][_0x2d90c5]['field']+'\x20'+_0x3681cd[_0xa41f('0x6a')][_0x2d90c5]['condition']+(_0x10673d(_0x3681cd['rules'][_0x2d90c5][_0xa41f('0x6e')])?'\x20'+_0x3681cd[_0xa41f('0x6a')][_0x2d90c5]['value']:'');}return _0x1fbd61+')';};var _0x139e91={'where':{'id':_0x43e137[_0xa41f('0x4a')]['id']}},_0x1cb00e,_0x146885,_0x14361f,_0x223fcb,_0x8573fc;_0x139e91=_['merge']({},_0x139e91,_0x43e137[_0xa41f('0x43')]);return db[_0xa41f('0x44')]['find'](_0x139e91)['then'](function(_0x1a1cf4){if(_0x1a1cf4){_0x1cb00e=_0x1a1cf4;return _0x1a1cf4[_0xa41f('0x70')]();}return null;})[_0xa41f('0x28')](function(_0x5dbe5a){if(_0x5dbe5a){if(!_0x5dbe5a['length']){throw new db[(_0xa41f('0x91'))][(_0xa41f('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x146885=_0x5dbe5a;return db[_0xa41f('0x73')][_0xa41f('0x46')]({'raw':!![]});}return null;})[_0xa41f('0x28')](function(_0x18342c){if(_0x18342c){_0x14361f=_[_0xa41f('0x74')](_0x18342c,'id');var _0x39b255;var _0x448b5d=squel['select']();_0x448b5d[_0xa41f('0x92')](_0x1cb00e[_0xa41f('0x76')]);for(var _0x538a9a=0x0;_0x538a9a<_0x146885[_0xa41f('0x3a')];_0x538a9a+=0x1){_0x39b255=_0x146885[_0x538a9a]['MetricId']?_0x14361f[_0x146885[_0x538a9a]['MetricId']][_0xa41f('0x78')]:_0x146885[_0x538a9a][_0xa41f('0x6d')];_0x39b255=_0x146885[_0x538a9a][_0xa41f('0x79')]?_[_0xa41f('0x7a')](_0x19c5fc[_0x146885[_0x538a9a][_0xa41f('0x79')]],'%s',_0x39b255):_0x39b255;_0x39b255=_0x146885[_0x538a9a][_0xa41f('0x7b')]?_[_0xa41f('0x7a')](_0x101c3c[_0x146885[_0x538a9a][_0xa41f('0x7b')]],'%s',_0x39b255):_0x39b255;if(_0x146885[_0x538a9a][_0xa41f('0x7c')]){_0x448b5d['group'](_0x39b255);}_0x146885[_0x538a9a][_0xa41f('0x7d')]&&_0x448b5d['order'](_0x39b255,_0x146885[_0x538a9a][_0xa41f('0x7d')]===_0xa41f('0x7e')?![]:!![]);_0x448b5d['field'](_0x39b255,_0x146885[_0x538a9a][_0xa41f('0x7f')]||_0x39b255);}if(_0x1cb00e[_0xa41f('0x80')]){_0x1cb00e[_0xa41f('0x80')]=JSON[_0xa41f('0x81')](_0x1cb00e[_0xa41f('0x80')]);for(var _0x4766cf=0x0;_0x4766cf<_0x1cb00e[_0xa41f('0x80')][_0xa41f('0x3a')];_0x4766cf+=0x1){if(_0x1cb00e[_0xa41f('0x80')][_0x4766cf]['type']&&_['includes'](_0x19c1e1,_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x32')])&&_0x1cb00e[_0xa41f('0x80')][_0x4766cf]['parentKey']&&_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x85')]&&_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x83')]){_0x448b5d[_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x32')]](_0x1cb00e['joins'][_0x4766cf][_0xa41f('0x85')],null,util[_0xa41f('0x7b')]('%s.%s\x20=\x20%s.%s',_0x1cb00e[_0xa41f('0x76')],_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x82')],_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x85')],_0x1cb00e[_0xa41f('0x80')][_0x4766cf][_0xa41f('0x83')]));}}}if(_0x1cb00e[_0xa41f('0x86')]){_0x1cb00e[_0xa41f('0x86')]=JSON[_0xa41f('0x81')](_0x1cb00e[_0xa41f('0x86')]);_0x448b5d[_0xa41f('0x3f')](_0x2cec6f(_0x1cb00e[_0xa41f('0x86')]['group']));}_0x8573fc=_0x448b5d['clone']();_0x448b5d[_0xa41f('0x21')](_0x5890da);_0x448b5d['offset'](0x0);logger[_0xa41f('0x88')](_0xa41f('0x89'),_0x448b5d[_0xa41f('0x8a')]());return dbH[_0xa41f('0x8b')][_0xa41f('0x34')](_0x448b5d[_0xa41f('0x8a')](),{'type':dbH['sequelize'][_0xa41f('0x8c')]['SELECT']});}})[_0xa41f('0x28')](function(){return{'sql':_0x8573fc['toString']()};})[_0xa41f('0x28')](respondWithResult(_0x1fc4cb,null))['catch'](handleError(_0x1fc4cb,null));}; \ No newline at end of file +var _0x91d3=['attributes','fields','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','length','operator','field','condition','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','replace','function','format','groupBy','group','orderBy','DESC','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','MIN(%s)','IS\x20NULL','value','%s.%s\x20=\x20%s.%s','web','fullPath','%s-%s.%s','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../components/export/','output','../../files/reports','savename','countTable','runReport','ValidationErrorItem','alias','debug','rimraf','zip-dir','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/logger','api','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','CustomReports','destroy','error','name','send','index','map','AnalyticCustomReport','type','key','model','keys','query','filters','intersection'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x91d3,0x113));var _0x391d=function(_0x175a96,_0x230e06){_0x175a96=_0x175a96-0x0;var _0x52d627=_0x91d3[_0x175a96];return _0x52d627;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x391d('0x0'));var zipdir=require(_0x391d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x391d('0x2'));var BPromise=require(_0x391d('0x3'));var Mustache=require(_0x391d('0x4'));var util=require(_0x391d('0x5'));var path=require(_0x391d('0x6'));var sox=require(_0x391d('0x7'));var csv=require(_0x391d('0x8'));var ejs=require(_0x391d('0x9'));var fs=require('fs');var fs_extra=require(_0x391d('0xa'));var _=require(_0x391d('0xb'));var squel=require(_0x391d('0xc'));var crypto=require(_0x391d('0xd'));var jsforce=require(_0x391d('0xe'));var deskjs=require(_0x391d('0xf'));var toCsv=require('to-csv');var querystring=require(_0x391d('0x10'));var Papa=require(_0x391d('0x11'));var Redis=require(_0x391d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x391d('0x13'));var as=require(_0x391d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x391d('0x15'))(_0x391d('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var dbH=require(_0x391d('0x17'))[_0x391d('0x18')];function respondWithStatusCode(_0x47b75a,_0x37f445){_0x37f445=_0x37f445||0xcc;return function(_0x148cdb){if(_0x148cdb){return _0x47b75a[_0x391d('0x19')](_0x37f445);}return _0x47b75a['status'](_0x37f445)[_0x391d('0x1a')]();};}function respondWithResult(_0x4e1b4d,_0xdd6b41){_0xdd6b41=_0xdd6b41||0xc8;return function(_0x21d4b8){if(_0x21d4b8){return _0x4e1b4d[_0x391d('0x1b')](_0xdd6b41)[_0x391d('0x1c')](_0x21d4b8);}};}function respondWithFilteredResult(_0x425854,_0xbd4af1){return function(_0x28bf4e){if(_0x28bf4e){var _0x797c3=typeof _0xbd4af1[_0x391d('0x1d')]===_0x391d('0x1e')&&typeof _0xbd4af1['limit']===_0x391d('0x1e');var _0x38c06f=_0x28bf4e[_0x391d('0x1f')];var _0x1cfca8=_0x797c3?0x0:_0xbd4af1[_0x391d('0x1d')];var _0x4a5e9d=_0x797c3?_0x28bf4e['count']:_0xbd4af1[_0x391d('0x1d')]+_0xbd4af1[_0x391d('0x20')];var _0x3b3767;if(_0x4a5e9d>=_0x38c06f){_0x4a5e9d=_0x38c06f;_0x3b3767=0xc8;}else{_0x3b3767=0xce;}_0x425854[_0x391d('0x1b')](_0x3b3767);return _0x425854[_0x391d('0x21')](_0x391d('0x22'),_0x1cfca8+'-'+_0x4a5e9d+'/'+_0x38c06f)['json'](_0x28bf4e);}return null;};}function patchUpdates(_0x5e5829){return function(_0x5a2e16){try{jsonpatch[_0x391d('0x23')](_0x5a2e16,_0x5e5829,!![]);}catch(_0x5468a4){return BPromise[_0x391d('0x24')](_0x5468a4);}return _0x5a2e16['save']();};}function saveUpdates(_0x26f043,_0x10db8a){return function(_0x3c3583){if(_0x3c3583){return _0x3c3583[_0x391d('0x25')](_0x26f043)[_0x391d('0x26')](function(_0x123036){return _0x123036;});}return null;};}function removeEntity(_0x122499,_0x284d10){return function(_0x498443){if(_0x498443){return _0x498443['destroy']()['then'](function(){var _0x365470=_0x498443[_0x391d('0x27')]({'plain':!![]});var _0x43be64=_0x391d('0x28');return db['UserProfileResource'][_0x391d('0x29')]({'where':{'type':_0x43be64,'resourceId':_0x365470['id']}})[_0x391d('0x26')](function(){return _0x498443;});})[_0x391d('0x26')](function(){_0x122499['status'](0xcc)[_0x391d('0x1a')]();});}};}function handleEntityNotFound(_0x148074,_0x125dd6){return function(_0x20774e){if(!_0x20774e){_0x148074['sendStatus'](0x194);}return _0x20774e;};}function handleError(_0x3fb162,_0x395f5c){_0x395f5c=_0x395f5c||0x1f4;return function(_0x5206b8){logger[_0x391d('0x2a')](_0x5206b8['stack']);if(_0x5206b8[_0x391d('0x2b')]){delete _0x5206b8[_0x391d('0x2b')];}_0x3fb162[_0x391d('0x1b')](_0x395f5c)[_0x391d('0x2c')](_0x5206b8);};}exports[_0x391d('0x2d')]=function(_0x5d6424,_0x1ec697){var _0x3abb1e={},_0x14a05c={},_0x44449f={'count':0x0,'rows':[]};var _0x384560=_[_0x391d('0x2e')](db[_0x391d('0x2f')]['rawAttributes'],function(_0x245237){return{'name':_0x245237['fieldName'],'type':_0x245237[_0x391d('0x30')][_0x391d('0x31')]};});_0x14a05c[_0x391d('0x32')]=_[_0x391d('0x2e')](_0x384560,_0x391d('0x2b'));_0x14a05c['query']=_[_0x391d('0x33')](_0x5d6424[_0x391d('0x34')]);_0x14a05c[_0x391d('0x35')]=_[_0x391d('0x36')](_0x14a05c[_0x391d('0x32')],_0x14a05c[_0x391d('0x34')]);_0x3abb1e[_0x391d('0x37')]=_['intersection'](_0x14a05c[_0x391d('0x32')],qs[_0x391d('0x38')](_0x5d6424[_0x391d('0x34')]['fields']));_0x3abb1e[_0x391d('0x37')]=_0x3abb1e[_0x391d('0x37')]['length']?_0x3abb1e[_0x391d('0x37')]:_0x14a05c[_0x391d('0x32')];if(!_0x5d6424['query']['hasOwnProperty'](_0x391d('0x39'))){_0x3abb1e[_0x391d('0x20')]=qs[_0x391d('0x20')](_0x5d6424['query'][_0x391d('0x20')]);_0x3abb1e[_0x391d('0x1d')]=qs[_0x391d('0x1d')](_0x5d6424[_0x391d('0x34')][_0x391d('0x1d')]);}_0x3abb1e[_0x391d('0x3a')]=qs[_0x391d('0x3b')](_0x5d6424[_0x391d('0x34')][_0x391d('0x3b')]);_0x3abb1e['where']=qs[_0x391d('0x35')](_['pick'](_0x5d6424[_0x391d('0x34')],_0x14a05c[_0x391d('0x35')]),_0x384560);if(_0x5d6424[_0x391d('0x34')][_0x391d('0x3c')]){_0x3abb1e[_0x391d('0x3d')]=_[_0x391d('0x3e')](_0x3abb1e[_0x391d('0x3d')],{'$or':_[_0x391d('0x2e')](_0x384560,function(_0x2a8955){if(_0x2a8955[_0x391d('0x30')]!==_0x391d('0x3f')){var _0x59917d={};_0x59917d[_0x2a8955[_0x391d('0x2b')]]={'$like':'%'+_0x5d6424[_0x391d('0x34')][_0x391d('0x3c')]+'%'};return _0x59917d;}})});}_0x3abb1e=_['merge']({},_0x3abb1e,_0x5d6424[_0x391d('0x40')]);var _0x5dca4d={'where':_0x3abb1e[_0x391d('0x3d')]};return db[_0x391d('0x2f')][_0x391d('0x1f')](_0x5dca4d)[_0x391d('0x26')](function(_0x2b311b){_0x44449f[_0x391d('0x1f')]=_0x2b311b;if(_0x5d6424[_0x391d('0x34')][_0x391d('0x41')]){_0x3abb1e[_0x391d('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport']['findAll'](_0x3abb1e);})['then'](function(_0x1a7d56){_0x44449f[_0x391d('0x43')]=_0x1a7d56;return _0x44449f;})[_0x391d('0x26')](respondWithFilteredResult(_0x1ec697,_0x3abb1e))[_0x391d('0x44')](handleError(_0x1ec697,null));};exports[_0x391d('0x45')]=function(_0x513d2d,_0x21d28){var _0x3dab2d={'raw':![],'where':{'id':_0x513d2d[_0x391d('0x46')]['id']}},_0x58c70c={};_0x58c70c['model']=_[_0x391d('0x33')](db[_0x391d('0x2f')][_0x391d('0x47')]);_0x58c70c[_0x391d('0x34')]=_['keys'](_0x513d2d[_0x391d('0x34')]);_0x58c70c[_0x391d('0x35')]=_[_0x391d('0x36')](_0x58c70c['model'],_0x58c70c[_0x391d('0x34')]);_0x3dab2d[_0x391d('0x37')]=_[_0x391d('0x36')](_0x58c70c[_0x391d('0x32')],qs['fields'](_0x513d2d[_0x391d('0x34')]['fields']));_0x3dab2d['attributes']=_0x3dab2d[_0x391d('0x37')]['length']?_0x3dab2d['attributes']:_0x58c70c['model'];if(_0x513d2d[_0x391d('0x34')]['includeAll']){_0x3dab2d[_0x391d('0x42')]=[{'all':!![]}];}_0x3dab2d=_[_0x391d('0x3e')]({},_0x3dab2d,_0x513d2d[_0x391d('0x40')]);return db['AnalyticCustomReport'][_0x391d('0x48')](_0x3dab2d)[_0x391d('0x26')](handleEntityNotFound(_0x21d28,null))['then'](respondWithResult(_0x21d28,null))[_0x391d('0x44')](handleError(_0x21d28,null));};exports['create']=function(_0x5986ca,_0x3be349){return db[_0x391d('0x2f')][_0x391d('0x49')](_0x5986ca[_0x391d('0x4a')],{})[_0x391d('0x26')](function(_0x455dc0){var _0x27f2fc=_0x5986ca[_0x391d('0x4b')]['get']({'plain':!![]});if(!_0x27f2fc)throw new Error(_0x391d('0x4c'));if(_0x27f2fc[_0x391d('0x4d')]===_0x391d('0x4b')){var _0x413c8f=_0x455dc0[_0x391d('0x27')]({'plain':!![]});var _0x562a7e=_0x391d('0x4e');return db['UserProfileSection'][_0x391d('0x48')]({'where':{'name':_0x562a7e,'userProfileId':_0x27f2fc[_0x391d('0x4f')]},'raw':!![]})[_0x391d('0x26')](function(_0x3b5555){if(_0x3b5555&&_0x3b5555[_0x391d('0x50')]===0x0){return db[_0x391d('0x51')]['create']({'name':_0x413c8f[_0x391d('0x2b')],'resourceId':_0x413c8f['id'],'type':_0x391d('0x28'),'sectionId':_0x3b5555['id']},{})['then'](function(){return _0x455dc0;});}else{return _0x455dc0;}})['catch'](function(_0x4308b){logger[_0x391d('0x2a')](_0x391d('0x52'),_0x4308b);throw _0x4308b;});}return _0x455dc0;})[_0x391d('0x26')](respondWithResult(_0x3be349,0xc9))[_0x391d('0x44')](handleError(_0x3be349,null));};exports[_0x391d('0x25')]=function(_0x1d6e29,_0x280596){if(_0x1d6e29[_0x391d('0x4a')]['id']){delete _0x1d6e29[_0x391d('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x391d('0x48')]({'where':{'id':_0x1d6e29[_0x391d('0x46')]['id']}})[_0x391d('0x26')](handleEntityNotFound(_0x280596,null))[_0x391d('0x26')](saveUpdates(_0x1d6e29[_0x391d('0x4a')],null))[_0x391d('0x26')](respondWithResult(_0x280596,null))['catch'](handleError(_0x280596,null));};exports[_0x391d('0x29')]=function(_0x1ce8ed,_0x527a69){return db[_0x391d('0x2f')][_0x391d('0x48')]({'where':{'id':_0x1ce8ed[_0x391d('0x46')]['id']}})[_0x391d('0x26')](handleEntityNotFound(_0x527a69,null))[_0x391d('0x26')](removeEntity(_0x527a69,null))[_0x391d('0x44')](handleError(_0x527a69,null));};exports[_0x391d('0x53')]=function(_0x4f1736,_0x300c78){var _0x491a5e=0xa;var _0x4af717=[_0x391d('0x54'),_0x391d('0x55'),_0x391d('0x56'),_0x391d('0x57')];var _0x503f54={'SUM':_0x391d('0x58'),'COUNT':_0x391d('0x59'),'COUNT DISTINCT':_0x391d('0x5a'),'MAX':_0x391d('0x5b'),'MIN':'MIN(%s)','AVG':_0x391d('0x5c'),'GROUP_CONCAT':_0x391d('0x5d'),'GROUP_CONCAT ASC':_0x391d('0x5e'),'GROUP_CONCAT DESC':_0x391d('0x5f')};var _0x55cc9d={'SEC_TO_TIME':_0x391d('0x60'),'DATE':_0x391d('0x61'),'HOUR':_0x391d('0x62'),'ROUND':_0x391d('0x63'),'UNIX_TIMESTAMP':_0x391d('0x64')};var _0x346b4a=function(_0x1f54c2){return!_[_0x391d('0x65')](['IS\x20NULL',_0x391d('0x66'),_0x391d('0x67'),_0x391d('0x68')],_0x1f54c2);};var _0x2d69d9=function(_0x4a4c09){if(!_0x4a4c09||!_0x4a4c09[_0x391d('0x69')]['length']){return'';}for(var _0xa022='(',_0x4e3bd9=0x0;_0x4e3bd9<_0x4a4c09[_0x391d('0x69')][_0x391d('0x6a')];_0x4e3bd9+=0x1){_0x4e3bd9>0x0&&(_0xa022+='\x20'+_0x4a4c09[_0x391d('0x6b')]+'\x20');_0xa022+=_0x4a4c09[_0x391d('0x69')][_0x4e3bd9]['group']?_0x2d69d9(_0x4a4c09['rules'][_0x4e3bd9]['group']):_0x4a4c09[_0x391d('0x69')][_0x4e3bd9][_0x391d('0x6c')]+'\x20'+_0x4a4c09[_0x391d('0x69')][_0x4e3bd9][_0x391d('0x6d')]+(_0x346b4a(_0x4a4c09['rules'][_0x4e3bd9][_0x391d('0x6d')])?'\x20'+_0x4a4c09[_0x391d('0x69')][_0x4e3bd9]['value']:'');}return _0xa022+')';};var _0x19ff5e={'where':{'id':_0x4f1736[_0x391d('0x46')]['id']}},_0x32056e,_0x3dcedb,_0x21b7d7,_0x2a6c56,_0x4d04c2;_0x19ff5e=_['merge']({},_0x19ff5e,_0x4f1736['options']);return db[_0x391d('0x2f')][_0x391d('0x48')](_0x19ff5e)['then'](function(_0x4f710a){if(_0x4f710a){_0x32056e=_0x4f710a;return _0x4f710a[_0x391d('0x6e')]();}return null;})['then'](function(_0x58a9a4){if(_0x58a9a4){if(!_0x58a9a4[_0x391d('0x6a')]){throw new db[(_0x391d('0x6f'))]['ValidationErrorItem'](_0x391d('0x70'),0x193);}_0x3dcedb=_0x58a9a4;return db[_0x391d('0x71')][_0x391d('0x72')]({'raw':!![]});}return null;})[_0x391d('0x26')](function(_0x457cd8){if(_0x457cd8){_0x21b7d7=_[_0x391d('0x73')](_0x457cd8,'id');var _0x1ca4cf;var _0x90d7af=squel[_0x391d('0x74')]();_0x90d7af[_0x391d('0x75')](_0x32056e[_0x391d('0x76')]);for(var _0x254e23=0x0;_0x254e23<_0x3dcedb[_0x391d('0x6a')];_0x254e23+=0x1){_0x1ca4cf=_0x3dcedb[_0x254e23]['MetricId']?_0x21b7d7[_0x3dcedb[_0x254e23][_0x391d('0x77')]][_0x391d('0x78')]:_0x3dcedb[_0x254e23][_0x391d('0x6c')];_0x1ca4cf=_0x3dcedb[_0x254e23]['function']?_[_0x391d('0x79')](_0x503f54[_0x3dcedb[_0x254e23][_0x391d('0x7a')]],'%s',_0x1ca4cf):_0x1ca4cf;_0x1ca4cf=_0x3dcedb[_0x254e23][_0x391d('0x7b')]?_[_0x391d('0x79')](_0x55cc9d[_0x3dcedb[_0x254e23][_0x391d('0x7b')]],'%s',_0x1ca4cf):_0x1ca4cf;if(_0x3dcedb[_0x254e23][_0x391d('0x7c')]){_0x90d7af[_0x391d('0x7d')](_0x1ca4cf);}_0x3dcedb[_0x254e23]['orderBy']&&_0x90d7af['order'](_0x1ca4cf,_0x3dcedb[_0x254e23][_0x391d('0x7e')]===_0x391d('0x7f')?![]:!![]);_0x90d7af['field'](_0x1ca4cf,_0x3dcedb[_0x254e23]['alias']||_0x1ca4cf);}if(_0x32056e[_0x391d('0x80')]){_0x32056e[_0x391d('0x80')]=JSON[_0x391d('0x81')](_0x32056e[_0x391d('0x80')]);for(var _0xfd6a4d=0x0;_0xfd6a4d<_0x32056e[_0x391d('0x80')][_0x391d('0x6a')];_0xfd6a4d+=0x1){if(_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x30')]&&_[_0x391d('0x65')](_0x4af717,_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x30')])&&_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x82')]&&_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x83')]&&_0x32056e[_0x391d('0x80')][_0xfd6a4d]['foreignKey']){_0x90d7af[_0x32056e[_0x391d('0x80')][_0xfd6a4d]['type']](_0x32056e[_0x391d('0x80')][_0xfd6a4d]['foreignTable'],null,util[_0x391d('0x7b')]('%s.%s\x20=\x20%s.%s',_0x32056e['table'],_0x32056e[_0x391d('0x80')][_0xfd6a4d]['parentKey'],_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x83')],_0x32056e[_0x391d('0x80')][_0xfd6a4d][_0x391d('0x84')]));}}}if(_0x32056e['conditions']){_0x32056e['conditions']=JSON['parse'](_0x32056e[_0x391d('0x85')]);_0x90d7af[_0x391d('0x3d')](_0x2d69d9(_0x32056e['conditions'][_0x391d('0x7d')]));}_0x4d04c2=_0x90d7af[_0x391d('0x86')]();_0x90d7af['limit'](_0x491a5e);_0x90d7af[_0x391d('0x1d')](0x0);logger['debug'](_0x391d('0x87'),_0x90d7af['toString']());return dbH['sequelize'][_0x391d('0x34')](_0x90d7af[_0x391d('0x88')](),{'type':dbH[_0x391d('0x89')]['QueryTypes'][_0x391d('0x8a')]});}})['then'](respondWithResult(_0x300c78,null))[_0x391d('0x44')](handleError(_0x300c78,null));};function runReport(_0x57d9dc,_0x5a5f6f,_0x5c955e){var _0x19fbe0=_0x5a5f6f[_0x391d('0x2b')];var _0x1daf45=0xa;var _0x4e8789=[_0x391d('0x54'),_0x391d('0x55'),_0x391d('0x56'),_0x391d('0x57')];var _0x352e75={'SUM':_0x391d('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x391d('0x5a'),'MAX':_0x391d('0x5b'),'MIN':_0x391d('0x8b'),'AVG':_0x391d('0x5c'),'GROUP_CONCAT':_0x391d('0x5d'),'GROUP_CONCAT ASC':_0x391d('0x5e'),'GROUP_CONCAT DESC':_0x391d('0x5f')};var _0x201f31={'SEC_TO_TIME':_0x391d('0x60'),'DATE':_0x391d('0x61'),'HOUR':'HOUR(%s)','ROUND':_0x391d('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x29e6c0=function(_0x47df29){return!_[_0x391d('0x65')]([_0x391d('0x8c'),_0x391d('0x66'),_0x391d('0x67'),_0x391d('0x68')],_0x47df29);};var _0x595ebe=function(_0x14c19e){if(!_0x14c19e||!_0x14c19e['rules'][_0x391d('0x6a')]){return'';}for(var _0x1a0464='(',_0x28b203=0x0;_0x28b203<_0x14c19e[_0x391d('0x69')][_0x391d('0x6a')];_0x28b203+=0x1){_0x28b203>0x0&&(_0x1a0464+='\x20'+_0x14c19e[_0x391d('0x6b')]+'\x20');_0x1a0464+=_0x14c19e['rules'][_0x28b203][_0x391d('0x7d')]?_0x595ebe(_0x14c19e[_0x391d('0x69')][_0x28b203][_0x391d('0x7d')]):_0x14c19e[_0x391d('0x69')][_0x28b203]['field']+'\x20'+_0x14c19e[_0x391d('0x69')][_0x28b203]['condition']+(_0x29e6c0(_0x14c19e[_0x391d('0x69')][_0x28b203][_0x391d('0x6d')])?'\x20'+_0x14c19e[_0x391d('0x69')][_0x28b203][_0x391d('0x8d')]:'');}return _0x1a0464+')';};var _0x4741eb={'where':{'id':_0x57d9dc['id']}},_0x4a1601,_0x1861de,_0x3df054,_0x3d0765,_0x3908a8;_0x4741eb=_['merge']({},_0x4741eb,_0x5c955e);return db['AnalyticCustomReport'][_0x391d('0x48')](_0x4741eb)[_0x391d('0x26')](function(_0x5cc8f3){if(_0x5cc8f3){_0x4a1601=_0x5cc8f3;return _0x5cc8f3['getFields']();}return null;})[_0x391d('0x26')](function(_0x5ca497){if(_0x5ca497){if(!_0x5ca497[_0x391d('0x6a')]){throw new db[(_0x391d('0x6f'))]['ValidationErrorItem'](_0x391d('0x70'),0x193);}_0x1861de=_0x5ca497;return db[_0x391d('0x71')][_0x391d('0x72')]({'raw':!![]});}return null;})[_0x391d('0x26')](function(_0x2423fc){if(_0x2423fc){_0x3df054=_[_0x391d('0x73')](_0x2423fc,'id');var _0xff55cc;var _0x22a244=squel['select']();_0x22a244[_0x391d('0x75')](_0x4a1601[_0x391d('0x76')]);for(var _0x33b5f7=0x0;_0x33b5f7<_0x1861de[_0x391d('0x6a')];_0x33b5f7+=0x1){_0xff55cc=_0x1861de[_0x33b5f7]['MetricId']?_0x3df054[_0x1861de[_0x33b5f7][_0x391d('0x77')]][_0x391d('0x78')]:_0x1861de[_0x33b5f7][_0x391d('0x6c')];_0xff55cc=_0x1861de[_0x33b5f7][_0x391d('0x7a')]?_[_0x391d('0x79')](_0x352e75[_0x1861de[_0x33b5f7][_0x391d('0x7a')]],'%s',_0xff55cc):_0xff55cc;_0xff55cc=_0x1861de[_0x33b5f7][_0x391d('0x7b')]?_[_0x391d('0x79')](_0x201f31[_0x1861de[_0x33b5f7]['format']],'%s',_0xff55cc):_0xff55cc;if(_0x1861de[_0x33b5f7][_0x391d('0x7c')]){_0x22a244[_0x391d('0x7d')](_0xff55cc);}_0x1861de[_0x33b5f7][_0x391d('0x7e')]&&_0x22a244[_0x391d('0x3a')](_0xff55cc,_0x1861de[_0x33b5f7][_0x391d('0x7e')]===_0x391d('0x7f')?![]:!![]);_0x22a244[_0x391d('0x6c')](_0xff55cc,_0x1861de[_0x33b5f7]['alias']||_0xff55cc);}if(_0x4a1601[_0x391d('0x80')]){_0x4a1601[_0x391d('0x80')]=JSON[_0x391d('0x81')](_0x4a1601[_0x391d('0x80')]);for(var _0x21680a=0x0;_0x21680a<_0x4a1601[_0x391d('0x80')][_0x391d('0x6a')];_0x21680a+=0x1){if(_0x4a1601[_0x391d('0x80')][_0x21680a][_0x391d('0x30')]&&_[_0x391d('0x65')](_0x4e8789,_0x4a1601[_0x391d('0x80')][_0x21680a][_0x391d('0x30')])&&_0x4a1601[_0x391d('0x80')][_0x21680a][_0x391d('0x82')]&&_0x4a1601[_0x391d('0x80')][_0x21680a]['foreignTable']&&_0x4a1601['joins'][_0x21680a][_0x391d('0x84')]){_0x22a244[_0x4a1601[_0x391d('0x80')][_0x21680a][_0x391d('0x30')]](_0x4a1601['joins'][_0x21680a][_0x391d('0x83')],null,util['format'](_0x391d('0x8e'),_0x4a1601[_0x391d('0x76')],_0x4a1601['joins'][_0x21680a]['parentKey'],_0x4a1601['joins'][_0x21680a][_0x391d('0x83')],_0x4a1601[_0x391d('0x80')][_0x21680a][_0x391d('0x84')]));}}}if(_0x4a1601[_0x391d('0x85')]){_0x4a1601['conditions']=JSON['parse'](_0x4a1601['conditions']);_0x22a244[_0x391d('0x3d')](_0x595ebe(_0x4a1601[_0x391d('0x85')]['group']));}_0x3908a8=_0x22a244[_0x391d('0x86')]();_0x22a244['limit'](_0x1daf45);_0x22a244[_0x391d('0x1d')](0x0);return;}})['then'](function(){if(_0x5a5f6f['output']===_0x391d('0x8f')){return null;}var _0x537eca=_['merge'](_0x5a5f6f,{'name':_0x5a5f6f[_0x391d('0x90')]||_0x5a5f6f['name']||_0x4a1601[_0x391d('0x2b')],'basename':_0x19fbe0,'savename':util[_0x391d('0x7b')](_0x391d('0x91'),_0x5a5f6f[_0x391d('0x2b')]||_0x4a1601['name'],require('randomstring')[_0x391d('0x92')](0x4),_0x5a5f6f['output']||_0x391d('0x93')),'reportId':_0x4a1601['id'],'reportType':'custom'});return db[_0x391d('0x94')][_0x391d('0x49')](_0x537eca,{'raw':!![]});})[_0x391d('0x26')](function(_0x545933){if(_0x4a1601[_0x391d('0x76')]===_0x391d('0x95')){_0x3908a8[_0x391d('0x3d')](_0x4a1601[_0x391d('0x76')]+_0x391d('0x96'),_0x5a5f6f[_0x391d('0x97')],_0x5a5f6f['endDate']);}else{_0x3908a8[_0x391d('0x3d')](_0x4a1601[_0x391d('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a5f6f[_0x391d('0x97')],_0x5a5f6f[_0x391d('0x98')]);}if(_0x545933){logger['info'](_0x391d('0x99'),_0x3908a8[_0x391d('0x88')]());require(_0x391d('0x9a'))[_0x391d('0x9b')](path[_0x391d('0x54')](__dirname,_0x391d('0x9c'),_0x545933[_0x391d('0x9d')]),[_0x545933['id'],_0x3908a8['toString'](),path[_0x391d('0x54')](__dirname,_0x391d('0x9e'),_0x545933[_0x391d('0x9f')]),_0x19fbe0]);return _0x545933;}else{var _0x51e29d=squel[_0x391d('0x74')]();_0x51e29d['from']('('+_0x3908a8[_0x391d('0x88')]()+')',_0x391d('0xa0'));_0x51e29d[_0x391d('0x6c')]('COUNT(*)',_0x391d('0x1f'));_0x3908a8[_0x391d('0x20')](_0x5a5f6f['limit']||_0x1daf45);_0x3908a8[_0x391d('0x1d')](_0x5a5f6f[_0x391d('0x1d')]||0x0);return dbH[_0x391d('0x89')]['query'](_0x51e29d[_0x391d('0x88')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']})[_0x391d('0x26')](function(_0x2012b3){if(!_0x2012b3[_0x391d('0x6a')]){_0x3d0765=0x0;}else{_0x3d0765=_0x2012b3[0x0]['count']||0x0;}return dbH[_0x391d('0x89')][_0x391d('0x34')](_0x3908a8[_0x391d('0x88')](),{'type':dbH[_0x391d('0x89')]['QueryTypes'][_0x391d('0x8a')]});})[_0x391d('0x26')](function(_0x550e95){return{'rows':_0x550e95||[],'count':_0x3d0765};});}});}exports['run']=function(_0x403488,_0x50dd31){return runReport(_0x403488[_0x391d('0x46')],_0x403488['query'],_0x403488[_0x391d('0x40')])['then'](respondWithResult(_0x50dd31,null))[_0x391d('0x44')](handleError(_0x50dd31,null));};exports[_0x391d('0xa1')]=runReport;exports['query']=function(_0x33409f,_0x215abf){var _0x4c6a06=0xa;var _0x5d843d=[_0x391d('0x54'),_0x391d('0x55'),_0x391d('0x56'),_0x391d('0x57')];var _0x1ed0f={'SUM':_0x391d('0x58'),'COUNT':_0x391d('0x59'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x391d('0x8b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x391d('0x5e'),'GROUP_CONCAT DESC':_0x391d('0x5f')};var _0x43ce05={'SEC_TO_TIME':_0x391d('0x60'),'DATE':'DATE(%s)','HOUR':_0x391d('0x62'),'ROUND':_0x391d('0x63'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5f8df1=function(_0x142f91){return!_[_0x391d('0x65')]([_0x391d('0x8c'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0x391d('0x68')],_0x142f91);};var _0x513a83=function(_0x67fb8d){if(!_0x67fb8d||!_0x67fb8d[_0x391d('0x69')][_0x391d('0x6a')]){return'';}for(var _0x37acd0='(',_0x2a6637=0x0;_0x2a6637<_0x67fb8d['rules']['length'];_0x2a6637+=0x1){_0x2a6637>0x0&&(_0x37acd0+='\x20'+_0x67fb8d['operator']+'\x20');_0x37acd0+=_0x67fb8d[_0x391d('0x69')][_0x2a6637][_0x391d('0x7d')]?_0x513a83(_0x67fb8d[_0x391d('0x69')][_0x2a6637][_0x391d('0x7d')]):_0x67fb8d[_0x391d('0x69')][_0x2a6637][_0x391d('0x6c')]+'\x20'+_0x67fb8d[_0x391d('0x69')][_0x2a6637][_0x391d('0x6d')]+(_0x5f8df1(_0x67fb8d[_0x391d('0x69')][_0x2a6637][_0x391d('0x6d')])?'\x20'+_0x67fb8d['rules'][_0x2a6637][_0x391d('0x8d')]:'');}return _0x37acd0+')';};var _0x470237={'where':{'id':_0x33409f[_0x391d('0x46')]['id']}},_0x26cb23,_0x2a9547,_0xe69c48,_0x4f863d,_0x591d75;_0x470237=_[_0x391d('0x3e')]({},_0x470237,_0x33409f[_0x391d('0x40')]);return db[_0x391d('0x2f')][_0x391d('0x48')](_0x470237)[_0x391d('0x26')](function(_0x4f1814){if(_0x4f1814){_0x26cb23=_0x4f1814;return _0x4f1814[_0x391d('0x6e')]();}return null;})[_0x391d('0x26')](function(_0x5d9463){if(_0x5d9463){if(!_0x5d9463[_0x391d('0x6a')]){throw new db[(_0x391d('0x6f'))][(_0x391d('0xa2'))](_0x391d('0x70'),0x193);}_0x2a9547=_0x5d9463;return db['AnalyticMetric'][_0x391d('0x72')]({'raw':!![]});}return null;})[_0x391d('0x26')](function(_0x1b3972){if(_0x1b3972){_0xe69c48=_[_0x391d('0x73')](_0x1b3972,'id');var _0x2ac3d1;var _0x4ad22e=squel[_0x391d('0x74')]();_0x4ad22e[_0x391d('0x75')](_0x26cb23[_0x391d('0x76')]);for(var _0x4398f1=0x0;_0x4398f1<_0x2a9547[_0x391d('0x6a')];_0x4398f1+=0x1){_0x2ac3d1=_0x2a9547[_0x4398f1][_0x391d('0x77')]?_0xe69c48[_0x2a9547[_0x4398f1][_0x391d('0x77')]][_0x391d('0x78')]:_0x2a9547[_0x4398f1]['field'];_0x2ac3d1=_0x2a9547[_0x4398f1][_0x391d('0x7a')]?_['replace'](_0x1ed0f[_0x2a9547[_0x4398f1]['function']],'%s',_0x2ac3d1):_0x2ac3d1;_0x2ac3d1=_0x2a9547[_0x4398f1][_0x391d('0x7b')]?_[_0x391d('0x79')](_0x43ce05[_0x2a9547[_0x4398f1][_0x391d('0x7b')]],'%s',_0x2ac3d1):_0x2ac3d1;if(_0x2a9547[_0x4398f1][_0x391d('0x7c')]){_0x4ad22e[_0x391d('0x7d')](_0x2ac3d1);}_0x2a9547[_0x4398f1][_0x391d('0x7e')]&&_0x4ad22e[_0x391d('0x3a')](_0x2ac3d1,_0x2a9547[_0x4398f1][_0x391d('0x7e')]===_0x391d('0x7f')?![]:!![]);_0x4ad22e[_0x391d('0x6c')](_0x2ac3d1,_0x2a9547[_0x4398f1][_0x391d('0xa3')]||_0x2ac3d1);}if(_0x26cb23[_0x391d('0x80')]){_0x26cb23['joins']=JSON[_0x391d('0x81')](_0x26cb23[_0x391d('0x80')]);for(var _0xb10c01=0x0;_0xb10c01<_0x26cb23[_0x391d('0x80')][_0x391d('0x6a')];_0xb10c01+=0x1){if(_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x30')]&&_[_0x391d('0x65')](_0x5d843d,_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x30')])&&_0x26cb23[_0x391d('0x80')][_0xb10c01]['parentKey']&&_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x83')]&&_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x84')]){_0x4ad22e[_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x30')]](_0x26cb23['joins'][_0xb10c01][_0x391d('0x83')],null,util[_0x391d('0x7b')](_0x391d('0x8e'),_0x26cb23[_0x391d('0x76')],_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x82')],_0x26cb23[_0x391d('0x80')][_0xb10c01][_0x391d('0x83')],_0x26cb23[_0x391d('0x80')][_0xb10c01]['foreignKey']));}}}if(_0x26cb23[_0x391d('0x85')]){_0x26cb23[_0x391d('0x85')]=JSON['parse'](_0x26cb23['conditions']);_0x4ad22e['where'](_0x513a83(_0x26cb23[_0x391d('0x85')]['group']));}_0x591d75=_0x4ad22e[_0x391d('0x86')]();_0x4ad22e['limit'](_0x4c6a06);_0x4ad22e[_0x391d('0x1d')](0x0);logger[_0x391d('0xa4')](_0x391d('0x87'),_0x4ad22e[_0x391d('0x88')]());return dbH['sequelize'][_0x391d('0x34')](_0x4ad22e[_0x391d('0x88')](),{'type':dbH[_0x391d('0x89')]['QueryTypes'][_0x391d('0x8a')]});}})['then'](function(){return{'sql':_0x591d75['toString']()};})[_0x391d('0x26')](respondWithResult(_0x215abf,null))['catch'](handleError(_0x215abf,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 82afa16..6406cb1 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 _0x4273=['exports','define','AnalyticCustomReport','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x41658f,_0x31abed){var _0x1b559c=function(_0x5e7c79){while(--_0x5e7c79){_0x41658f['push'](_0x41658f['shift']());}};_0x1b559c(++_0x31abed);}(_0x4273,0x18f));var _0x3427=function(_0x353ae1,_0x315275){_0x353ae1=_0x353ae1-0x0;var _0x903142=_0x4273[_0x353ae1];return _0x903142;};'use strict';var _=require(_0x3427('0x0'));var util=require(_0x3427('0x1'));var logger=require('../../config/logger')(_0x3427('0x2'));var moment=require(_0x3427('0x3'));var BPromise=require(_0x3427('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3427('0x5'));var rimraf=require(_0x3427('0x6'));var config=require(_0x3427('0x7'));var attributes=require('./analyticCustomReport.attributes');module[_0x3427('0x8')]=function(_0x21857c,_0x37bcef){return _0x21857c[_0x3427('0x9')](_0x3427('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6f7=['./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x183f27,_0x276411){var _0x452ae4=function(_0x30cb0e){while(--_0x30cb0e){_0x183f27['push'](_0x183f27['shift']());}};_0x452ae4(++_0x276411);}(_0xf6f7,0x87));var _0x7f6f=function(_0x4afac5,_0x1ab4ed){_0x4afac5=_0x4afac5-0x0;var _0x2404b3=_0xf6f7[_0x4afac5];return _0x2404b3;};'use strict';var _=require(_0x7f6f('0x0'));var util=require(_0x7f6f('0x1'));var logger=require(_0x7f6f('0x2'))(_0x7f6f('0x3'));var moment=require('moment');var BPromise=require(_0x7f6f('0x4'));var rp=require(_0x7f6f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f6f('0x6'));var config=require(_0x7f6f('0x7'));var attributes=require(_0x7f6f('0x8'));module[_0x7f6f('0x9')]=function(_0x3ece5f,_0x575423){return _0x3ece5f[_0x7f6f('0xa')](_0x7f6f('0xb'),attributes,{'tableName':_0x7f6f('0xc'),'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 5dea886..cd0139a 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 _0xd85a=['client','http','then','request\x20sent','debug','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4ef1b6,_0x502ac2){var _0x164c1f=function(_0x3c6ee2){while(--_0x3c6ee2){_0x4ef1b6['push'](_0x4ef1b6['shift']());}};_0x164c1f(++_0x502ac2);}(_0xd85a,0x115));var _0xad85=function(_0x4ec80e,_0x374028){_0x4ec80e=_0x4ec80e-0x0;var _0x2a19b8=_0xd85a[_0x4ec80e];return _0x2a19b8;};'use strict';var _=require(_0xad85('0x0'));var util=require(_0xad85('0x1'));var moment=require(_0xad85('0x2'));var BPromise=require('bluebird');var rs=require(_0xad85('0x3'));var fs=require('fs');var Redis=require(_0xad85('0x4'));var db=require(_0xad85('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xad85('0x6'))('rpc');var config=require(_0xad85('0x7'));var jayson=require(_0xad85('0x8'));var client=jayson[_0xad85('0x9')][_0xad85('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20f3b7,_0x2f28c6,_0x4d8b6b){return new BPromise(function(_0x4edae7,_0x54a005){return client['request'](_0x20f3b7,_0x4d8b6b)[_0xad85('0xb')](function(_0x5c23ee){logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x2f28c6,_0xad85('0xc'));logger[_0xad85('0xd')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x2f28c6,_0xad85('0xc'),JSON[_0xad85('0xe')](_0x5c23ee));if(_0x5c23ee[_0xad85('0xf')]){if(_0x5c23ee[_0xad85('0xf')][_0xad85('0x10')]===0x1f4){logger['error'](_0xad85('0x11'),_0x2f28c6,_0x5c23ee[_0xad85('0xf')][_0xad85('0x12')]);return _0x54a005(_0x5c23ee['error'][_0xad85('0x12')]);}logger[_0xad85('0xf')](_0xad85('0x11'),_0x2f28c6,_0x5c23ee[_0xad85('0xf')][_0xad85('0x12')]);return _0x4edae7(_0x5c23ee[_0xad85('0xf')]['message']);}else{logger[_0xad85('0x13')](_0xad85('0x11'),_0x2f28c6,'request\x20sent');_0x4edae7(_0x5c23ee[_0xad85('0x14')]['message']);}})[_0xad85('0x15')](function(_0x1ae719){logger[_0xad85('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x2f28c6,_0x1ae719);_0x54a005(_0x1ae719);});});} \ No newline at end of file +var _0x29f4=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0x29f4,0x16d));var _0x429f=function(_0x152a10,_0x5bff18){_0x152a10=_0x152a10-0x0;var _0x22861a=_0x29f4[_0x152a10];return _0x22861a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x429f('0x0'));var BPromise=require('bluebird');var rs=require(_0x429f('0x1'));var fs=require('fs');var Redis=require(_0x429f('0x2'));var db=require(_0x429f('0x3'))['db'];var utils=require(_0x429f('0x4'));var logger=require(_0x429f('0x5'))(_0x429f('0x6'));var config=require(_0x429f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x429f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b710e,_0x285d3e,_0x27f969){return new BPromise(function(_0x5b5eeb,_0x2cc2f1){return client[_0x429f('0x9')](_0x5b710e,_0x27f969)[_0x429f('0xa')](function(_0x1c4488){logger[_0x429f('0xb')](_0x429f('0xc'),_0x285d3e,'request\x20sent');logger[_0x429f('0xd')](_0x429f('0xe'),_0x285d3e,_0x429f('0xf'),JSON[_0x429f('0x10')](_0x1c4488));if(_0x1c4488[_0x429f('0x11')]){if(_0x1c4488['error'][_0x429f('0x12')]===0x1f4){logger[_0x429f('0x11')]('AnalyticCustomReport,\x20%s,\x20%s',_0x285d3e,_0x1c4488[_0x429f('0x11')][_0x429f('0x13')]);return _0x2cc2f1(_0x1c4488['error'][_0x429f('0x13')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x285d3e,_0x1c4488[_0x429f('0x11')][_0x429f('0x13')]);return _0x5b5eeb(_0x1c4488['error'][_0x429f('0x13')]);}else{logger[_0x429f('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0x285d3e,_0x429f('0xf'));_0x5b5eeb(_0x1c4488['result'][_0x429f('0x13')]);}})[_0x429f('0x14')](function(_0x11b2f7){logger[_0x429f('0x11')](_0x429f('0xc'),_0x285d3e,_0x11b2f7);_0x2cc2f1(_0x11b2f7);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index a17eddf..3303a03 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 _0xb174=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports'];(function(_0x4d3b1f,_0x25ef1e){var _0x5a0429=function(_0x32a1e2){while(--_0x32a1e2){_0x4d3b1f['push'](_0x4d3b1f['shift']());}};_0x5a0429(++_0x25ef1e);}(_0xb174,0x1c2));var _0x4b17=function(_0x593d46,_0x510490){_0x593d46=_0x593d46-0x0;var _0x176807=_0xb174[_0x593d46];return _0x176807;};'use strict';var multer=require('multer');var util=require(_0x4b17('0x0'));var path=require(_0x4b17('0x1'));var timeout=require(_0x4b17('0x2'));var express=require(_0x4b17('0x3'));var router=express[_0x4b17('0x4')]();var fs_extra=require(_0x4b17('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4b17('0x6'));var config=require(_0x4b17('0x7'));var controller=require(_0x4b17('0x8'));router['get']('/',auth[_0x4b17('0x9')](),controller[_0x4b17('0xa')]);router[_0x4b17('0xb')](_0x4b17('0xc'),auth['isAuthenticated'](),controller[_0x4b17('0xd')]);router[_0x4b17('0xb')](_0x4b17('0xe'),auth['isAuthenticated'](),controller['preview']);router[_0x4b17('0xb')]('/:id/run',auth[_0x4b17('0x9')](),controller[_0x4b17('0xf')]);router[_0x4b17('0xb')](_0x4b17('0x10'),auth[_0x4b17('0x9')](),controller[_0x4b17('0x11')]);router[_0x4b17('0x12')]('/',auth['isAuthenticated'](),controller[_0x4b17('0x13')]);router[_0x4b17('0x14')](_0x4b17('0xc'),auth[_0x4b17('0x9')](),controller[_0x4b17('0x15')]);router[_0x4b17('0x16')](_0x4b17('0xc'),auth[_0x4b17('0x9')](),controller[_0x4b17('0x17')]);module[_0x4b17('0x18')]=router; \ No newline at end of file +var _0x55ff=['./analyticCustomReport.controller','isAuthenticated','index','get','/:id','show','/:id/run','/:id/query','query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54895a,_0x52eb0f){var _0x209f0a=function(_0x2172ff){while(--_0x2172ff){_0x54895a['push'](_0x54895a['shift']());}};_0x209f0a(++_0x52eb0f);}(_0x55ff,0x196));var _0xf55f=function(_0x3e954f,_0x4e97bd){_0x3e954f=_0x3e954f-0x0;var _0x415de6=_0x55ff[_0x3e954f];return _0x415de6;};'use strict';var multer=require(_0xf55f('0x0'));var util=require(_0xf55f('0x1'));var path=require(_0xf55f('0x2'));var timeout=require(_0xf55f('0x3'));var express=require('express');var router=express[_0xf55f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf55f('0x5'));var interaction=require(_0xf55f('0x6'));var config=require(_0xf55f('0x7'));var controller=require(_0xf55f('0x8'));router['get']('/',auth[_0xf55f('0x9')](),controller[_0xf55f('0xa')]);router[_0xf55f('0xb')](_0xf55f('0xc'),auth[_0xf55f('0x9')](),controller[_0xf55f('0xd')]);router[_0xf55f('0xb')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0xf55f('0xb')](_0xf55f('0xe'),auth['isAuthenticated'](),controller['run']);router[_0xf55f('0xb')](_0xf55f('0xf'),auth['isAuthenticated'](),controller[_0xf55f('0x10')]);router[_0xf55f('0x11')]('/',auth[_0xf55f('0x9')](),controller['create']);router[_0xf55f('0x12')](_0xf55f('0xc'),auth[_0xf55f('0x9')](),controller[_0xf55f('0x13')]);router[_0xf55f('0x14')]('/:id',auth[_0xf55f('0x9')](),controller[_0xf55f('0x15')]);module[_0xf55f('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index b6b5ce6..9643461 100644 --- a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js +++ b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x33c5=['STRING','TEXT','exports'];(function(_0xc4219b,_0x35b505){var _0x3a09a5=function(_0x15349a){while(--_0x15349a){_0xc4219b['push'](_0xc4219b['shift']());}};_0x3a09a5(++_0x35b505);}(_0x33c5,0xe6));var _0x533c=function(_0x1820f1,_0x1403e7){_0x1820f1=_0x1820f1-0x0;var _0x167aed=_0x33c5[_0x1820f1];return _0x167aed;};'use strict';var Sequelize=require('sequelize');module[_0x533c('0x0')]={'name':{'type':Sequelize[_0x533c('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x533c('0x1')]},'table':{'type':Sequelize[_0x533c('0x1')]},'conditions':{'type':Sequelize[_0x533c('0x2')]},'joins':{'type':Sequelize[_0x533c('0x2')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0x6aa7,0x178));var _0x76aa=function(_0x21a955,_0x4d8ba0){_0x21a955=_0x21a955-0x0;var _0x41bb28=_0x6aa7[_0x21a955];return _0x41bb28;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 98559e9..a607121 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 _0xabce=['where','findAll','show','includeAll','options','find','catch','create','body','user','role','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','table','MetricId','field','function','replace','format','groupBy','orderBy','joins','parse','includes','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','SELECT','COUNT(DISTINCT\x20%s)','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ValidationErrorItem','AnalyticMetric','keyBy','select','metric','DESC','foreignKey','output','web','%s-%s.%s','default','cdr','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','from','countTable','COUNT(*)','sequelize','QueryTypes','run','runReport','Sequelize','alias','clone','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','ejs','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','../../config/license/util','../../mysqldb','dbH','sendStatus','status','offset','limit','undefined','count','set','json','apply','save','update','then','get','DefaultReports','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','filter','merge'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xabce,0x103));var _0xeabc=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xabce[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require(_0xeabc('0x0'));var rimraf=require(_0xeabc('0x1'));var zipdir=require(_0xeabc('0x2'));var jsonpatch=require(_0xeabc('0x3'));var rp=require(_0xeabc('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabc('0x5'));var util=require(_0xeabc('0x6'));var path=require(_0xeabc('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xeabc('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeabc('0x9'));var squel=require('squel');var crypto=require(_0xeabc('0xa'));var jsforce=require(_0xeabc('0xb'));var deskjs=require(_0xeabc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xeabc('0xd'));var Papa=require(_0xeabc('0xe'));var Redis=require(_0xeabc('0xf'));var authService=require(_0xeabc('0x10'));var qs=require(_0xeabc('0x11'));var as=require(_0xeabc('0x12'));var hardwareService=require(_0xeabc('0x13'));var logger=require(_0xeabc('0x14'))(_0xeabc('0x15'));var utils=require(_0xeabc('0x16'));var config=require(_0xeabc('0x17'));var licenseUtil=require(_0xeabc('0x18'));var db=require(_0xeabc('0x19'))['db'];var dbH=require(_0xeabc('0x19'))[_0xeabc('0x1a')];function respondWithStatusCode(_0xcfbf06,_0x53df9c){_0x53df9c=_0x53df9c||0xcc;return function(_0x235c2d){if(_0x235c2d){return _0xcfbf06[_0xeabc('0x1b')](_0x53df9c);}return _0xcfbf06[_0xeabc('0x1c')](_0x53df9c)['end']();};}function respondWithResult(_0x5f4ee8,_0x3170ea){_0x3170ea=_0x3170ea||0xc8;return function(_0x3ae954){if(_0x3ae954){return _0x5f4ee8[_0xeabc('0x1c')](_0x3170ea)['json'](_0x3ae954);}};}function respondWithFilteredResult(_0xf913d7,_0x638976){return function(_0x49f2d8){if(_0x49f2d8){var _0x53fe28=typeof _0x638976[_0xeabc('0x1d')]==='undefined'&&typeof _0x638976[_0xeabc('0x1e')]===_0xeabc('0x1f');var _0x58a3c0=_0x49f2d8[_0xeabc('0x20')];var _0x31dd53=_0x53fe28?0x0:_0x638976[_0xeabc('0x1d')];var _0x384be5=_0x53fe28?_0x49f2d8[_0xeabc('0x20')]:_0x638976['offset']+_0x638976[_0xeabc('0x1e')];var _0x4d68ea;if(_0x384be5>=_0x58a3c0){_0x384be5=_0x58a3c0;_0x4d68ea=0xc8;}else{_0x4d68ea=0xce;}_0xf913d7[_0xeabc('0x1c')](_0x4d68ea);return _0xf913d7[_0xeabc('0x21')]('Content-Range',_0x31dd53+'-'+_0x384be5+'/'+_0x58a3c0)[_0xeabc('0x22')](_0x49f2d8);}return null;};}function patchUpdates(_0x41d67a){return function(_0x254590){try{jsonpatch[_0xeabc('0x23')](_0x254590,_0x41d67a,!![]);}catch(_0x3c9611){return BPromise['reject'](_0x3c9611);}return _0x254590[_0xeabc('0x24')]();};}function saveUpdates(_0x10c675,_0x91ab00){return function(_0x5bdd57){if(_0x5bdd57){return _0x5bdd57[_0xeabc('0x25')](_0x10c675)[_0xeabc('0x26')](function(_0x214953){return _0x214953;});}return null;};}function removeEntity(_0x319119,_0x5b8838){return function(_0x109e1d){if(_0x109e1d){return _0x109e1d['destroy']()[_0xeabc('0x26')](function(){var _0x4d4e29=_0x109e1d[_0xeabc('0x27')]({'plain':!![]});var _0x12acbd=_0xeabc('0x28');return db[_0xeabc('0x29')][_0xeabc('0x2a')]({'where':{'type':_0x12acbd,'resourceId':_0x4d4e29['id']}})[_0xeabc('0x26')](function(){return _0x109e1d;});})[_0xeabc('0x26')](function(){_0x319119['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x459c8a,_0x5bf8f2){return function(_0x3c1b5b){if(!_0x3c1b5b){_0x459c8a[_0xeabc('0x1b')](0x194);}return _0x3c1b5b;};}function handleError(_0x48fb52,_0x2163e6){_0x2163e6=_0x2163e6||0x1f4;return function(_0x38572d){logger[_0xeabc('0x2b')](_0x38572d[_0xeabc('0x2c')]);if(_0x38572d[_0xeabc('0x2d')]){delete _0x38572d[_0xeabc('0x2d')];}_0x48fb52[_0xeabc('0x1c')](_0x2163e6)[_0xeabc('0x2e')](_0x38572d);};}exports[_0xeabc('0x2f')]=function(_0x5ebb86,_0x5b34dd){var _0x5bb1f1={},_0x2f03e8={},_0x2d027e={'count':0x0,'rows':[]};var _0x98b445=_[_0xeabc('0x30')](db[_0xeabc('0x31')][_0xeabc('0x32')],function(_0x61c0af){return{'name':_0x61c0af['fieldName'],'type':_0x61c0af[_0xeabc('0x33')][_0xeabc('0x34')]};});_0x2f03e8[_0xeabc('0x35')]=_['map'](_0x98b445,_0xeabc('0x2d'));_0x2f03e8[_0xeabc('0x36')]=_[_0xeabc('0x37')](_0x5ebb86['query']);_0x2f03e8[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0x2f03e8[_0xeabc('0x35')],_0x2f03e8['query']);_0x5bb1f1[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0x2f03e8['model'],qs['fields'](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x5bb1f1['attributes']=_0x5bb1f1[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x5bb1f1[_0xeabc('0x3a')]:_0x2f03e8[_0xeabc('0x35')];if(!_0x5ebb86[_0xeabc('0x36')]['hasOwnProperty'](_0xeabc('0x3d'))){_0x5bb1f1['limit']=qs[_0xeabc('0x1e')](_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x1e')]);_0x5bb1f1['offset']=qs['offset'](_0x5ebb86[_0xeabc('0x36')]['offset']);}_0x5bb1f1[_0xeabc('0x3e')]=qs['sort'](_0x5ebb86['query']['sort']);_0x5bb1f1['where']=qs[_0xeabc('0x38')](_['pick'](_0x5ebb86[_0xeabc('0x36')],_0x2f03e8[_0xeabc('0x38')]),_0x98b445);if(_0x5ebb86['query'][_0xeabc('0x3f')]){_0x5bb1f1['where']=_[_0xeabc('0x40')](_0x5bb1f1['where'],{'$or':_[_0xeabc('0x30')](_0x98b445,function(_0xf1b7ef){if(_0xf1b7ef[_0xeabc('0x33')]!=='VIRTUAL'){var _0x5a00d0={};_0x5a00d0[_0xf1b7ef['name']]={'$like':'%'+_0x5ebb86[_0xeabc('0x36')][_0xeabc('0x3f')]+'%'};return _0x5a00d0;}})});}_0x5bb1f1=_[_0xeabc('0x40')]({},_0x5bb1f1,_0x5ebb86['options']);var _0x4f1897={'where':_0x5bb1f1[_0xeabc('0x41')]};return db[_0xeabc('0x31')]['count'](_0x4f1897)[_0xeabc('0x26')](function(_0x5e0b78){_0x2d027e[_0xeabc('0x20')]=_0x5e0b78;if(_0x5ebb86['query']['includeAll']){_0x5bb1f1['include']=[{'all':!![]}];}return db[_0xeabc('0x31')][_0xeabc('0x42')](_0x5bb1f1);})[_0xeabc('0x26')](function(_0x3eeeb5){_0x2d027e['rows']=_0x3eeeb5;return _0x2d027e;})[_0xeabc('0x26')](respondWithFilteredResult(_0x5b34dd,_0x5bb1f1))['catch'](handleError(_0x5b34dd,null));};exports[_0xeabc('0x43')]=function(_0x1a4bbe,_0x3a7807){var _0x17a0df={'raw':!![],'where':{'id':_0x1a4bbe['params']['id']}},_0xc849c9={};_0xc849c9['model']=_[_0xeabc('0x37')](db['AnalyticDefaultReport'][_0xeabc('0x32')]);_0xc849c9[_0xeabc('0x36')]=_['keys'](_0x1a4bbe[_0xeabc('0x36')]);_0xc849c9[_0xeabc('0x38')]=_[_0xeabc('0x39')](_0xc849c9[_0xeabc('0x35')],_0xc849c9[_0xeabc('0x36')]);_0x17a0df[_0xeabc('0x3a')]=_[_0xeabc('0x39')](_0xc849c9['model'],qs[_0xeabc('0x3b')](_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x3b')]));_0x17a0df[_0xeabc('0x3a')]=_0x17a0df[_0xeabc('0x3a')][_0xeabc('0x3c')]?_0x17a0df[_0xeabc('0x3a')]:_0xc849c9[_0xeabc('0x35')];if(_0x1a4bbe[_0xeabc('0x36')][_0xeabc('0x44')]){_0x17a0df['include']=[{'all':!![]}];}_0x17a0df=_[_0xeabc('0x40')]({},_0x17a0df,_0x1a4bbe[_0xeabc('0x45')]);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x17a0df)[_0xeabc('0x26')](handleEntityNotFound(_0x3a7807,null))[_0xeabc('0x26')](respondWithResult(_0x3a7807,null))[_0xeabc('0x47')](handleError(_0x3a7807,null));};exports['create']=function(_0x766743,_0x32e09b){return db[_0xeabc('0x31')][_0xeabc('0x48')](_0x766743[_0xeabc('0x49')],{})['then'](function(_0x305946){var _0x2b2b9c=_0x766743[_0xeabc('0x4a')][_0xeabc('0x27')]({'plain':!![]});if(!_0x2b2b9c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b2b9c[_0xeabc('0x4b')]===_0xeabc('0x4a')){var _0x568847=_0x305946[_0xeabc('0x27')]({'plain':!![]});var _0x5a0d4d=_0xeabc('0x4c');return db['UserProfileSection'][_0xeabc('0x46')]({'where':{'name':_0x5a0d4d,'userProfileId':_0x2b2b9c[_0xeabc('0x4d')]},'raw':!![]})[_0xeabc('0x26')](function(_0x1524c3){if(_0x1524c3&&_0x1524c3[_0xeabc('0x4e')]===0x0){return db[_0xeabc('0x29')][_0xeabc('0x48')]({'name':_0x568847[_0xeabc('0x2d')],'resourceId':_0x568847['id'],'type':_0xeabc('0x28'),'sectionId':_0x1524c3['id']},{})[_0xeabc('0x26')](function(){return _0x305946;});}else{return _0x305946;}})['catch'](function(_0x180a14){logger[_0xeabc('0x2b')](_0xeabc('0x4f'),_0x180a14);throw _0x180a14;});}return _0x305946;})[_0xeabc('0x26')](respondWithResult(_0x32e09b,0xc9))['catch'](handleError(_0x32e09b,null));};exports[_0xeabc('0x25')]=function(_0x392913,_0x10d56f){if(_0x392913[_0xeabc('0x49')]['id']){delete _0x392913['body']['id'];}return db[_0xeabc('0x31')][_0xeabc('0x46')]({'where':{'id':_0x392913[_0xeabc('0x50')]['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x10d56f,null))[_0xeabc('0x26')](saveUpdates(_0x392913[_0xeabc('0x49')],null))[_0xeabc('0x26')](respondWithResult(_0x10d56f,null))[_0xeabc('0x47')](handleError(_0x10d56f,null));};exports[_0xeabc('0x2a')]=function(_0x58ab08,_0x4546c4){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x58ab08['params']['id']}})[_0xeabc('0x26')](handleEntityNotFound(_0x4546c4,null))[_0xeabc('0x26')](removeEntity(_0x4546c4,null))[_0xeabc('0x47')](handleError(_0x4546c4,null));};exports[_0xeabc('0x51')]=function(_0xe89728,_0x2f78f3){var _0x4a2ad6=0xa;var _0x4358d7=[_0xeabc('0x52'),_0xeabc('0x53'),_0xeabc('0x54'),_0xeabc('0x55')];var _0x2c7b4e={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x536f42={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x26c784=function(_0xc2ef0c){return!_['includes']([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0xc2ef0c);};var _0x11cc1f=function(_0x514787){if(!_0x514787||!_0x514787['rules'][_0xeabc('0x3c')]){return'';}for(var _0x7b659f='(',_0x1b6675=0x0;_0x1b6675<_0x514787[_0xeabc('0x64')][_0xeabc('0x3c')];_0x1b6675+=0x1){_0x1b6675>0x0&&(_0x7b659f+='\x20'+_0x514787[_0xeabc('0x65')]+'\x20');_0x7b659f+=_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x66')]?_0x11cc1f(_0x514787[_0xeabc('0x64')][_0x1b6675]['group']):_0x514787[_0xeabc('0x64')][_0x1b6675]['field']+'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')]+(_0x26c784(_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x67')])?'\x20'+_0x514787[_0xeabc('0x64')][_0x1b6675][_0xeabc('0x68')]:'');}return _0x7b659f+')';};var _0xf48062={'where':{'id':_0xe89728[_0xeabc('0x50')]['id']}},_0xb59a2a,_0x5d4bc2,_0x24d0e5,_0x5702cb,_0x3fa31b;_0xf48062=_[_0xeabc('0x40')]({},_0xf48062,_0xe89728[_0xeabc('0x45')]);return db['AnalyticDefaultReport'][_0xeabc('0x46')](_0xf48062)['then'](function(_0x54e7d6){if(_0x54e7d6){_0xb59a2a=_0x54e7d6;return _0x54e7d6[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x23270a){if(_0x23270a){if(!_0x23270a[_0xeabc('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0xeabc('0x6a'),0x193);}_0x5d4bc2=_0x23270a;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0xeabc('0x26')](function(_0x4f1a4f){if(_0x4f1a4f){_0x24d0e5=_['keyBy'](_0x4f1a4f,'id');var _0xa44f2d;var _0x1c84b5=squel['select']();_0x1c84b5['from'](_0xb59a2a[_0xeabc('0x6b')]);for(var _0x5d183a=0x0;_0x5d183a<_0x5d4bc2[_0xeabc('0x3c')];_0x5d183a+=0x1){_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6c')]?_0x24d0e5[_0x5d4bc2[_0x5d183a]['MetricId']]['metric']:_0x5d4bc2[_0x5d183a][_0xeabc('0x6d')];_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x2c7b4e[_0x5d4bc2[_0x5d183a][_0xeabc('0x6e')]],'%s',_0xa44f2d):_0xa44f2d;_0xa44f2d=_0x5d4bc2[_0x5d183a][_0xeabc('0x70')]?_['replace'](_0x536f42[_0x5d4bc2[_0x5d183a]['format']],'%s',_0xa44f2d):_0xa44f2d;if(_0x5d4bc2[_0x5d183a][_0xeabc('0x71')]){_0x1c84b5['group'](_0xa44f2d);}_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]&&_0x1c84b5['order'](_0xa44f2d,_0x5d4bc2[_0x5d183a][_0xeabc('0x72')]==='DESC'?![]:!![]);_0x1c84b5[_0xeabc('0x6d')](_0xa44f2d,_0x5d4bc2[_0x5d183a]['alias']||_0xa44f2d);}if(_0xb59a2a[_0xeabc('0x73')]){_0xb59a2a[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x73')]);for(var _0x5e121c=0x0;_0x5e121c<_0xb59a2a[_0xeabc('0x73')]['length'];_0x5e121c+=0x1){if(_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x4358d7,_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')])&&_0xb59a2a['joins'][_0x5e121c][_0xeabc('0x76')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')]&&_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']){_0x1c84b5[_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x33')]](_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x77')],null,util['format'](_0xeabc('0x78'),_0xb59a2a[_0xeabc('0x6b')],_0xb59a2a[_0xeabc('0x73')][_0x5e121c][_0xeabc('0x76')],_0xb59a2a['joins'][_0x5e121c]['foreignTable'],_0xb59a2a[_0xeabc('0x73')][_0x5e121c]['foreignKey']));}}}if(_0xb59a2a['conditions']){_0xb59a2a[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0xb59a2a[_0xeabc('0x79')]);_0x1c84b5['where'](_0x11cc1f(_0xb59a2a[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3fa31b=_0x1c84b5['clone']();_0x1c84b5[_0xeabc('0x1e')](_0x4a2ad6);_0x1c84b5[_0xeabc('0x1d')](0x0);logger[_0xeabc('0x7a')](_0xeabc('0x7b'),_0x1c84b5[_0xeabc('0x7c')]());return dbH['sequelize'][_0xeabc('0x36')](_0x1c84b5['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](respondWithResult(_0x2f78f3,null))[_0xeabc('0x47')](handleError(_0x2f78f3,null));};function runReport(_0x4424ce,_0x33fa74,_0x51368f){var _0x39f961=_0x33fa74['name'];var _0x1795fe=0xa;var _0x2f95c7=['join',_0xeabc('0x53'),'right_join','cross_join'];var _0x952dc7={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':'MIN(%s)','AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x348064={'SEC_TO_TIME':_0xeabc('0x81'),'DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':_0xeabc('0x5e'),'UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x522c6e=function(_0x436f8e){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),'IS\x20NOT\x20NULL','IS\x20EMPTY',_0xeabc('0x63')],_0x436f8e);};var _0x273ca5=function(_0xe90200){if(!_0xe90200||!_0xe90200[_0xeabc('0x64')][_0xeabc('0x3c')]){return'';}for(var _0x5f5a47='(',_0x289f98=0x0;_0x289f98<_0xe90200['rules']['length'];_0x289f98+=0x1){_0x289f98>0x0&&(_0x5f5a47+='\x20'+_0xe90200[_0xeabc('0x65')]+'\x20');_0x5f5a47+=_0xe90200[_0xeabc('0x64')][_0x289f98]['group']?_0x273ca5(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x66')]):_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x6d')]+'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')]+(_0x522c6e(_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x67')])?'\x20'+_0xe90200[_0xeabc('0x64')][_0x289f98][_0xeabc('0x68')]:'');}return _0x5f5a47+')';};var _0x1f8197={'where':{'id':_0x4424ce['id']}},_0x485c13,_0xb54c35,_0x5c9d6f,_0x1caaa7,_0x3e764a;_0x1f8197=_[_0xeabc('0x40')]({},_0x1f8197,_0x51368f);return db[_0xeabc('0x31')][_0xeabc('0x46')](_0x1f8197)[_0xeabc('0x26')](function(_0x40f51e){if(_0x40f51e){_0x485c13=_0x40f51e;return _0x40f51e[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x156e20){if(_0x156e20){if(!_0x156e20[_0xeabc('0x3c')]){throw new db['Sequelize'][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0xb54c35=_0x156e20;return db[_0xeabc('0x83')][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x26c595){if(_0x26c595){_0x5c9d6f=_[_0xeabc('0x84')](_0x26c595,'id');var _0x580661;var _0x3de927=squel[_0xeabc('0x85')]();_0x3de927['from'](_0x485c13['table']);for(var _0x489b1d=0x0;_0x489b1d<_0xb54c35['length'];_0x489b1d+=0x1){_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6c')]?_0x5c9d6f[_0xb54c35[_0x489b1d][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0xb54c35[_0x489b1d][_0xeabc('0x6d')];_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x6e')]?_[_0xeabc('0x6f')](_0x952dc7[_0xb54c35[_0x489b1d][_0xeabc('0x6e')]],'%s',_0x580661):_0x580661;_0x580661=_0xb54c35[_0x489b1d][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x348064[_0xb54c35[_0x489b1d][_0xeabc('0x70')]],'%s',_0x580661):_0x580661;if(_0xb54c35[_0x489b1d]['groupBy']){_0x3de927[_0xeabc('0x66')](_0x580661);}_0xb54c35[_0x489b1d][_0xeabc('0x72')]&&_0x3de927['order'](_0x580661,_0xb54c35[_0x489b1d][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x3de927[_0xeabc('0x6d')](_0x580661,_0xb54c35[_0x489b1d]['alias']||_0x580661);}if(_0x485c13[_0xeabc('0x73')]){_0x485c13['joins']=JSON[_0xeabc('0x74')](_0x485c13[_0xeabc('0x73')]);for(var _0x1841f0=0x0;_0x1841f0<_0x485c13[_0xeabc('0x73')][_0xeabc('0x3c')];_0x1841f0+=0x1){if(_0x485c13['joins'][_0x1841f0]['type']&&_['includes'](_0x2f95c7,_0x485c13['joins'][_0x1841f0][_0xeabc('0x33')])&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')]&&_0x485c13['joins'][_0x1841f0][_0xeabc('0x77')]&&_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x88')]){_0x3de927[_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x33')]](_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x77')],null,util[_0xeabc('0x70')](_0xeabc('0x78'),_0x485c13[_0xeabc('0x6b')],_0x485c13[_0xeabc('0x73')][_0x1841f0][_0xeabc('0x76')],_0x485c13['joins'][_0x1841f0]['foreignTable'],_0x485c13[_0xeabc('0x73')][_0x1841f0]['foreignKey']));}}}if(_0x485c13[_0xeabc('0x79')]){_0x485c13[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x485c13['conditions']);_0x3de927[_0xeabc('0x41')](_0x273ca5(_0x485c13[_0xeabc('0x79')][_0xeabc('0x66')]));}_0x3e764a=_0x3de927['clone']();_0x3de927['limit'](_0x1795fe);_0x3de927[_0xeabc('0x1d')](0x0);return;}})[_0xeabc('0x26')](function(){if(_0x33fa74[_0xeabc('0x89')]===_0xeabc('0x8a')){return null;}var _0x2cc9b3=_[_0xeabc('0x40')](_0x33fa74,{'name':_0x33fa74['fullPath']||_0x33fa74['name']||_0x485c13[_0xeabc('0x2d')],'basename':_0x39f961,'savename':util[_0xeabc('0x70')](_0xeabc('0x8b'),_0x33fa74[_0xeabc('0x2d')]||_0x485c13['name'],require('randomstring')['generate'](0x4),_0x33fa74[_0xeabc('0x89')]||'csv'),'reportId':_0x485c13['id'],'reportType':_0xeabc('0x8c')});return db['AnalyticExtractedReport'][_0xeabc('0x48')](_0x2cc9b3,{'raw':!![]});})['then'](function(_0x6e6ab2){if(_0x485c13[_0xeabc('0x6b')]===_0xeabc('0x8d')){_0x3e764a[_0xeabc('0x41')](_0x485c13[_0xeabc('0x6b')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}else{_0x3e764a[_0xeabc('0x41')](_0x485c13['table']+_0xeabc('0x90'),_0x33fa74[_0xeabc('0x8e')],_0x33fa74[_0xeabc('0x8f')]);}if(_0x6e6ab2){logger[_0xeabc('0x91')](_0xeabc('0x92'),_0x3e764a['toString']());require(_0xeabc('0x93'))[_0xeabc('0x94')](path['join'](__dirname,_0xeabc('0x95'),_0x6e6ab2[_0xeabc('0x89')]),[_0x6e6ab2['id'],_0x3e764a['toString'](),path[_0xeabc('0x52')](__dirname,_0xeabc('0x96'),_0x6e6ab2[_0xeabc('0x97')]),_0x39f961]);return _0x6e6ab2;}else{var _0x307d26=squel[_0xeabc('0x85')]();_0x307d26[_0xeabc('0x98')]('('+_0x3e764a[_0xeabc('0x7c')]()+')',_0xeabc('0x99'));_0x307d26[_0xeabc('0x6d')](_0xeabc('0x9a'),_0xeabc('0x20'));_0x3e764a[_0xeabc('0x1e')](_0x33fa74[_0xeabc('0x1e')]||_0x1795fe);_0x3e764a['offset'](_0x33fa74['offset']||0x0);return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x307d26[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')]['QueryTypes'][_0xeabc('0x7d')]})['then'](function(_0x49fba2){if(!_0x49fba2['length']){_0x1caaa7=0x0;}else{_0x1caaa7=_0x49fba2[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x3e764a[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});})[_0xeabc('0x26')](function(_0xe27492){return{'rows':_0xe27492||[],'count':_0x1caaa7};});}});}exports[_0xeabc('0x9d')]=function(_0x3eaedf,_0x44dc85){return runReport(_0x3eaedf['params'],_0x3eaedf[_0xeabc('0x36')],_0x3eaedf[_0xeabc('0x45')])[_0xeabc('0x26')](respondWithResult(_0x44dc85,null))[_0xeabc('0x47')](handleError(_0x44dc85,null));};exports[_0xeabc('0x9e')]=runReport;exports[_0xeabc('0x36')]=function(_0x2a29d7,_0x5bb5d6){var _0x3513ce=0xa;var _0x58cb5d=[_0xeabc('0x52'),_0xeabc('0x53'),'right_join',_0xeabc('0x55')];var _0x4c8bf3={'SUM':_0xeabc('0x56'),'COUNT':_0xeabc('0x57'),'COUNT DISTINCT':_0xeabc('0x7e'),'MAX':_0xeabc('0x7f'),'MIN':_0xeabc('0x58'),'AVG':_0xeabc('0x59'),'GROUP_CONCAT':_0xeabc('0x5a'),'GROUP_CONCAT ASC':_0xeabc('0x80'),'GROUP_CONCAT DESC':_0xeabc('0x5b')};var _0x484c75={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xeabc('0x5c'),'HOUR':_0xeabc('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xeabc('0x5f')};var _0x580f72=function(_0x37907a){return!_[_0xeabc('0x75')]([_0xeabc('0x60'),_0xeabc('0x61'),_0xeabc('0x62'),_0xeabc('0x63')],_0x37907a);};var _0x57db6d=function(_0x13cc55){if(!_0x13cc55||!_0x13cc55['rules'][_0xeabc('0x3c')]){return'';}for(var _0x43b88e='(',_0x1fa464=0x0;_0x1fa464<_0x13cc55[_0xeabc('0x64')]['length'];_0x1fa464+=0x1){_0x1fa464>0x0&&(_0x43b88e+='\x20'+_0x13cc55[_0xeabc('0x65')]+'\x20');_0x43b88e+=_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x66')]?_0x57db6d(_0x13cc55['rules'][_0x1fa464][_0xeabc('0x66')]):_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x6d')]+'\x20'+_0x13cc55['rules'][_0x1fa464]['condition']+(_0x580f72(_0x13cc55['rules'][_0x1fa464]['condition'])?'\x20'+_0x13cc55[_0xeabc('0x64')][_0x1fa464][_0xeabc('0x68')]:'');}return _0x43b88e+')';};var _0x52e84f={'where':{'id':_0x2a29d7[_0xeabc('0x50')]['id']}},_0x12f024,_0x1d35da,_0x2695a4,_0x199251,_0x1899d6;_0x52e84f=_[_0xeabc('0x40')]({},_0x52e84f,_0x2a29d7[_0xeabc('0x45')]);return db[_0xeabc('0x31')]['find'](_0x52e84f)[_0xeabc('0x26')](function(_0x5bb015){if(_0x5bb015){_0x12f024=_0x5bb015;return _0x5bb015[_0xeabc('0x69')]();}return null;})[_0xeabc('0x26')](function(_0x438ce3){if(_0x438ce3){if(!_0x438ce3[_0xeabc('0x3c')]){throw new db[(_0xeabc('0x9f'))][(_0xeabc('0x82'))](_0xeabc('0x6a'),0x193);}_0x1d35da=_0x438ce3;return db['AnalyticMetric'][_0xeabc('0x42')]({'raw':!![]});}return null;})['then'](function(_0x475160){if(_0x475160){_0x2695a4=_['keyBy'](_0x475160,'id');var _0x10d66b;var _0x12a042=squel[_0xeabc('0x85')]();_0x12a042[_0xeabc('0x98')](_0x12f024[_0xeabc('0x6b')]);for(var _0x49bf0f=0x0;_0x49bf0f<_0x1d35da[_0xeabc('0x3c')];_0x49bf0f+=0x1){_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]?_0x2695a4[_0x1d35da[_0x49bf0f][_0xeabc('0x6c')]][_0xeabc('0x86')]:_0x1d35da[_0x49bf0f][_0xeabc('0x6d')];_0x10d66b=_0x1d35da[_0x49bf0f]['function']?_[_0xeabc('0x6f')](_0x4c8bf3[_0x1d35da[_0x49bf0f][_0xeabc('0x6e')]],'%s',_0x10d66b):_0x10d66b;_0x10d66b=_0x1d35da[_0x49bf0f][_0xeabc('0x70')]?_[_0xeabc('0x6f')](_0x484c75[_0x1d35da[_0x49bf0f][_0xeabc('0x70')]],'%s',_0x10d66b):_0x10d66b;if(_0x1d35da[_0x49bf0f]['groupBy']){_0x12a042[_0xeabc('0x66')](_0x10d66b);}_0x1d35da[_0x49bf0f]['orderBy']&&_0x12a042[_0xeabc('0x3e')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0x72')]===_0xeabc('0x87')?![]:!![]);_0x12a042[_0xeabc('0x6d')](_0x10d66b,_0x1d35da[_0x49bf0f][_0xeabc('0xa0')]||_0x10d66b);}if(_0x12f024[_0xeabc('0x73')]){_0x12f024[_0xeabc('0x73')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x73')]);for(var _0x223a3=0x0;_0x223a3<_0x12f024['joins'][_0xeabc('0x3c')];_0x223a3+=0x1){if(_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]&&_[_0xeabc('0x75')](_0x58cb5d,_0x12f024['joins'][_0x223a3][_0xeabc('0x33')])&&_0x12f024['joins'][_0x223a3]['parentKey']&&_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')]&&_0x12f024[_0xeabc('0x73')][_0x223a3]['foreignKey']){_0x12a042[_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x33')]](_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x77')],null,util[_0xeabc('0x70')]('%s.%s\x20=\x20%s.%s',_0x12f024[_0xeabc('0x6b')],_0x12f024[_0xeabc('0x73')][_0x223a3]['parentKey'],_0x12f024['joins'][_0x223a3][_0xeabc('0x77')],_0x12f024[_0xeabc('0x73')][_0x223a3][_0xeabc('0x88')]));}}}if(_0x12f024[_0xeabc('0x79')]){_0x12f024[_0xeabc('0x79')]=JSON[_0xeabc('0x74')](_0x12f024[_0xeabc('0x79')]);_0x12a042[_0xeabc('0x41')](_0x57db6d(_0x12f024[_0xeabc('0x79')]['group']));}_0x1899d6=_0x12a042[_0xeabc('0xa1')]();_0x12a042['limit'](_0x3513ce);_0x12a042[_0xeabc('0x1d')](0x0);logger['debug'](_0xeabc('0x7b'),_0x12a042[_0xeabc('0x7c')]());return dbH[_0xeabc('0x9b')][_0xeabc('0x36')](_0x12a042[_0xeabc('0x7c')](),{'type':dbH[_0xeabc('0x9b')][_0xeabc('0x9c')][_0xeabc('0x7d')]});}})[_0xeabc('0x26')](function(){return{'sql':_0x1899d6[_0xeabc('0x7c')]()};})['then'](respondWithResult(_0x5bb5d6,null))['catch'](handleError(_0x5bb5d6,null));}; \ No newline at end of file +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x2dd761,_0x52a102){var _0x4fa784=function(_0x5cb6cd){while(--_0x5cb6cd){_0x2dd761['push'](_0x2dd761['shift']());}};_0x4fa784(++_0x52a102);}(_0x1967,0x173));var _0x7196=function(_0x146a5b,_0x4dbea1){_0x146a5b=_0x146a5b-0x0;var _0x1c88a5=_0x1967[_0x146a5b];return _0x1c88a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index e9c037c..9d8903d 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 _0xa677=['util','../../config/logger','api','request-promise','path','rimraf','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash'];(function(_0x1a458a,_0x4b141d){var _0x39a3dd=function(_0x342476){while(--_0x342476){_0x1a458a['push'](_0x1a458a['shift']());}};_0x39a3dd(++_0x4b141d);}(_0xa677,0x18b));var _0x7a67=function(_0x2db667,_0x193cf5){_0x2db667=_0x2db667-0x0;var _0x83ff9=_0xa677[_0x2db667];return _0x83ff9;};'use strict';var _=require(_0x7a67('0x0'));var util=require(_0x7a67('0x1'));var logger=require(_0x7a67('0x2'))(_0x7a67('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7a67('0x4'));var fs=require('fs');var path=require(_0x7a67('0x5'));var rimraf=require(_0x7a67('0x6'));var config=require('../../config/environment');var attributes=require(_0x7a67('0x7'));module[_0x7a67('0x8')]=function(_0x51898e,_0x5a0e3b){return _0x51898e[_0x7a67('0x9')](_0x7a67('0xa'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3dc4=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xadfc89,_0x2d821c){var _0x29fe9f=function(_0x1b93dc){while(--_0x1b93dc){_0xadfc89['push'](_0xadfc89['shift']());}};_0x29fe9f(++_0x2d821c);}(_0x3dc4,0x1b8));var _0x43dc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3dc4[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x43dc('0x0'));var util=require(_0x43dc('0x1'));var logger=require(_0x43dc('0x2'))(_0x43dc('0x3'));var moment=require(_0x43dc('0x4'));var BPromise=require(_0x43dc('0x5'));var rp=require(_0x43dc('0x6'));var fs=require('fs');var path=require(_0x43dc('0x7'));var rimraf=require(_0x43dc('0x8'));var config=require(_0x43dc('0x9'));var attributes=require(_0x43dc('0xa'));module[_0x43dc('0xb')]=function(_0x49f426,_0x16ce65){return _0x49f426[_0x43dc('0xc')](_0x43dc('0xd'),attributes,{'tableName':_0x43dc('0xe'),'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 0b2dd1f..be54a42 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 _0x019d=['http','request','then','info','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticDefaultReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x1516e6,_0x5b179b){var _0x1a3110=function(_0x33a006){while(--_0x33a006){_0x1516e6['push'](_0x1516e6['shift']());}};_0x1a3110(++_0x5b179b);}(_0x019d,0x146));var _0xd019=function(_0x5473ec,_0x3a2195){_0x5473ec=_0x5473ec-0x0;var _0x4a3356=_0x019d[_0x5473ec];return _0x4a3356;};'use strict';var _=require(_0xd019('0x0'));var util=require(_0xd019('0x1'));var moment=require(_0xd019('0x2'));var BPromise=require(_0xd019('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd019('0x4'));var db=require(_0xd019('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd019('0x6'))('rpc');var config=require(_0xd019('0x7'));var jayson=require(_0xd019('0x8'));var client=jayson[_0xd019('0x9')][_0xd019('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32a4f6,_0x1aedd6,_0x23bee8){return new BPromise(function(_0x3954ef,_0x16bd73){return client[_0xd019('0xb')](_0x32a4f6,_0x23bee8)[_0xd019('0xc')](function(_0xbd1e42){logger[_0xd019('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x1aedd6,_0xd019('0xe'));logger[_0xd019('0xf')](_0xd019('0x10'),_0x1aedd6,'request\x20sent',JSON[_0xd019('0x11')](_0xbd1e42));if(_0xbd1e42[_0xd019('0x12')]){if(_0xbd1e42['error'][_0xd019('0x13')]===0x1f4){logger['error'](_0xd019('0x14'),_0x1aedd6,_0xbd1e42[_0xd019('0x12')]['message']);return _0x16bd73(_0xbd1e42[_0xd019('0x12')][_0xd019('0x15')]);}logger[_0xd019('0x12')](_0xd019('0x14'),_0x1aedd6,_0xbd1e42['error'][_0xd019('0x15')]);return _0x3954ef(_0xbd1e42[_0xd019('0x12')]['message']);}else{logger['info'](_0xd019('0x14'),_0x1aedd6,'request\x20sent');_0x3954ef(_0xbd1e42[_0xd019('0x16')]['message']);}})[_0xd019('0x17')](function(_0x169dee){logger[_0xd019('0x12')](_0xd019('0x14'),_0x1aedd6,_0x169dee);_0x16bd73(_0x169dee);});});} \ No newline at end of file +var _0x99f0=['jayson/promise','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x1a61db,_0x3ad3af){var _0x5ac3bf=function(_0x2eca5b){while(--_0x2eca5b){_0x1a61db['push'](_0x1a61db['shift']());}};_0x5ac3bf(++_0x3ad3af);}(_0x99f0,0x1f2));var _0x099f=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0x99f0[_0x2f4c1c];return _0x25e0f2;};'use strict';var _=require(_0x099f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x099f('0x1'));var rs=require(_0x099f('0x2'));var fs=require('fs');var Redis=require(_0x099f('0x3'));var db=require(_0x099f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x099f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x099f('0x6'));var client=jayson['client'][_0x099f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x36e962,_0x424437,_0x48a745){return new BPromise(function(_0x1a0418,_0x268894){return client['request'](_0x36e962,_0x48a745)[_0x099f('0x8')](function(_0x192eb5){logger[_0x099f('0x9')](_0x099f('0xa'),_0x424437,_0x099f('0xb'));logger[_0x099f('0xc')](_0x099f('0xd'),_0x424437,_0x099f('0xb'),JSON[_0x099f('0xe')](_0x192eb5));if(_0x192eb5[_0x099f('0xf')]){if(_0x192eb5['error']['code']===0x1f4){logger[_0x099f('0xf')](_0x099f('0xa'),_0x424437,_0x192eb5[_0x099f('0xf')][_0x099f('0x10')]);return _0x268894(_0x192eb5[_0x099f('0xf')][_0x099f('0x10')]);}logger[_0x099f('0xf')](_0x099f('0xa'),_0x424437,_0x192eb5[_0x099f('0xf')]['message']);return _0x1a0418(_0x192eb5[_0x099f('0xf')][_0x099f('0x10')]);}else{logger[_0x099f('0x9')](_0x099f('0xa'),_0x424437,_0x099f('0xb'));_0x1a0418(_0x192eb5['result']['message']);}})[_0x099f('0x11')](function(_0x5d85fb){logger[_0x099f('0xf')](_0x099f('0xa'),_0x424437,_0x5d85fb);_0x268894(_0x5d85fb);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index e300650..79bba17 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 _0xb458=['preview','/:id/run','run','query','post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','/:id/preview'];(function(_0x306f46,_0x4b77fc){var _0x531eb5=function(_0x41b870){while(--_0x41b870){_0x306f46['push'](_0x306f46['shift']());}};_0x531eb5(++_0x4b77fc);}(_0xb458,0x94));var _0x8b45=function(_0x5bf565,_0x113b2f){_0x5bf565=_0x5bf565-0x0;var _0xa2321c=_0xb458[_0x5bf565];return _0xa2321c;};'use strict';var multer=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var path=require(_0x8b45('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8b45('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8b45('0x4'));var interaction=require(_0x8b45('0x5'));var config=require(_0x8b45('0x6'));var controller=require(_0x8b45('0x7'));router['get']('/',auth[_0x8b45('0x8')](),controller[_0x8b45('0x9')]);router[_0x8b45('0xa')](_0x8b45('0xb'),auth[_0x8b45('0x8')](),controller['show']);router['get'](_0x8b45('0xc'),auth[_0x8b45('0x8')](),controller[_0x8b45('0xd')]);router[_0x8b45('0xa')](_0x8b45('0xe'),auth[_0x8b45('0x8')](),controller[_0x8b45('0xf')]);router[_0x8b45('0xa')]('/:id/query',auth[_0x8b45('0x8')](),controller[_0x8b45('0x10')]);router[_0x8b45('0x11')]('/',auth[_0x8b45('0x8')](),controller[_0x8b45('0x12')]);router[_0x8b45('0x13')]('/:id',auth[_0x8b45('0x8')](),controller[_0x8b45('0x14')]);router[_0x8b45('0x15')](_0x8b45('0xb'),auth[_0x8b45('0x8')](),controller['destroy']);module[_0x8b45('0x16')]=router; \ No newline at end of file +var _0x76cc=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','show','/:id/preview','/:id/run','run','/:id/query','query','create','put','update','delete','/:id','destroy'];(function(_0x166338,_0x586863){var _0x47bd03=function(_0x35eb7c){while(--_0x35eb7c){_0x166338['push'](_0x166338['shift']());}};_0x47bd03(++_0x586863);}(_0x76cc,0x7e));var _0xc76c=function(_0x1c1a2c,_0x12cf5a){_0x1c1a2c=_0x1c1a2c-0x0;var _0x16c655=_0x76cc[_0x1c1a2c];return _0x16c655;};'use strict';var multer=require(_0xc76c('0x0'));var util=require(_0xc76c('0x1'));var path=require('path');var timeout=require(_0xc76c('0x2'));var express=require('express');var router=express[_0xc76c('0x3')]();var fs_extra=require(_0xc76c('0x4'));var auth=require(_0xc76c('0x5'));var interaction=require(_0xc76c('0x6'));var config=require(_0xc76c('0x7'));var controller=require(_0xc76c('0x8'));router[_0xc76c('0x9')]('/',auth[_0xc76c('0xa')](),controller[_0xc76c('0xb')]);router[_0xc76c('0x9')]('/:id',auth[_0xc76c('0xa')](),controller[_0xc76c('0xc')]);router[_0xc76c('0x9')](_0xc76c('0xd'),auth[_0xc76c('0xa')](),controller['preview']);router[_0xc76c('0x9')](_0xc76c('0xe'),auth[_0xc76c('0xa')](),controller[_0xc76c('0xf')]);router[_0xc76c('0x9')](_0xc76c('0x10'),auth[_0xc76c('0xa')](),controller[_0xc76c('0x11')]);router['post']('/',auth[_0xc76c('0xa')](),controller[_0xc76c('0x12')]);router[_0xc76c('0x13')]('/:id',auth[_0xc76c('0xa')](),controller[_0xc76c('0x14')]);router[_0xc76c('0x15')](_0xc76c('0x16'),auth[_0xc76c('0xa')](),controller[_0xc76c('0x17')]);module[_0xc76c('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index c8b9480..7633fe3 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 _0x3d69=['DATE','Loading','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','pdf','xlsx'];(function(_0x4df725,_0x2e098d){var _0x4e38fb=function(_0x22cfed){while(--_0x22cfed){_0x4df725['push'](_0x4df725['shift']());}};_0x4e38fb(++_0x2e098d);}(_0x3d69,0x95));var _0x93d6=function(_0x13d9e1,_0x258da6){_0x13d9e1=_0x13d9e1-0x0;var _0x3e1f83=_0x3d69[_0x13d9e1];return _0x3e1f83;};'use strict';var Sequelize=require(_0x93d6('0x0'));var moment=require('moment');module[_0x93d6('0x1')]={'name':{'type':Sequelize[_0x93d6('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x93d6('0x3')](_0x93d6('0x4'),_0x93d6('0x5'),_0x93d6('0x6')),'allowNull':![],'defaultValue':_0x93d6('0x4')},'savename':{'type':Sequelize[_0x93d6('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x93d6('0x7')]},'status':{'type':Sequelize[_0x93d6('0x2')],'defaultValue':_0x93d6('0x8')},'type':{'type':Sequelize[_0x93d6('0x3')]('manual','scheduled'),'allowNull':![],'defaultValue':_0x93d6('0x9')},'reportId':{'type':Sequelize[_0x93d6('0xa')](0xb)[_0x93d6('0xb')]},'reportType':{'type':Sequelize[_0x93d6('0x2')]}}; \ No newline at end of file +var _0x9aa6=['scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','xlsx','DATE','Loading','manual'];(function(_0x5ade21,_0x174d4f){var _0x703a72=function(_0x2f135a){while(--_0x2f135a){_0x5ade21['push'](_0x5ade21['shift']());}};_0x703a72(++_0x174d4f);}(_0x9aa6,0xe0));var _0x69aa=function(_0x282577,_0x3e98e0){_0x282577=_0x282577-0x0;var _0x175982=_0x9aa6[_0x282577];return _0x175982;};'use strict';var Sequelize=require(_0x69aa('0x0'));var moment=require(_0x69aa('0x1'));module[_0x69aa('0x2')]={'name':{'type':Sequelize[_0x69aa('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x69aa('0x4')](_0x69aa('0x5'),'pdf',_0x69aa('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x69aa('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x69aa('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x69aa('0x3')],'defaultValue':_0x69aa('0x8')},'type':{'type':Sequelize[_0x69aa('0x4')](_0x69aa('0x9'),_0x69aa('0xa')),'allowNull':![],'defaultValue':_0x69aa('0x9')},'reportId':{'type':Sequelize[_0x69aa('0xb')](0xb)[_0x69aa('0xc')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index ccb1c12..ca00a68 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 _0x9f20=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','params','download','basename','savename','output','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','then','get','UserProfileResource','end','name','send','map','AnalyticExtractedReport','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','include'];(function(_0x830273,_0x241529){var _0x233b29=function(_0x534c1c){while(--_0x534c1c){_0x830273['push'](_0x830273['shift']());}};_0x233b29(++_0x241529);}(_0x9f20,0x187));var _0x09f2=function(_0x52de19,_0x3ef22b){_0x52de19=_0x52de19-0x0;var _0x43789e=_0x9f20[_0x52de19];return _0x43789e;};'use strict';var emlformat=require(_0x09f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x09f2('0x1'));var jsonpatch=require(_0x09f2('0x2'));var rp=require(_0x09f2('0x3'));var moment=require(_0x09f2('0x4'));var BPromise=require(_0x09f2('0x5'));var Mustache=require('mustache');var util=require(_0x09f2('0x6'));var path=require('path');var sox=require(_0x09f2('0x7'));var csv=require('to-csv');var ejs=require(_0x09f2('0x8'));var fs=require('fs');var fs_extra=require(_0x09f2('0x9'));var _=require('lodash');var squel=require(_0x09f2('0xa'));var crypto=require(_0x09f2('0xb'));var jsforce=require(_0x09f2('0xc'));var deskjs=require(_0x09f2('0xd'));var toCsv=require(_0x09f2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09f2('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09f2('0x10'));var logger=require(_0x09f2('0x11'))(_0x09f2('0x12'));var utils=require(_0x09f2('0x13'));var config=require(_0x09f2('0x14'));var licenseUtil=require(_0x09f2('0x15'));var db=require(_0x09f2('0x16'))['db'];function respondWithStatusCode(_0x157467,_0x24525b){_0x24525b=_0x24525b||0xcc;return function(_0x306d2b){if(_0x306d2b){return _0x157467['sendStatus'](_0x24525b);}return _0x157467[_0x09f2('0x17')](_0x24525b)['end']();};}function respondWithResult(_0x29d825,_0x174884){_0x174884=_0x174884||0xc8;return function(_0x4f6afa){if(_0x4f6afa){return _0x29d825[_0x09f2('0x17')](_0x174884)['json'](_0x4f6afa);}};}function respondWithFilteredResult(_0x44da95,_0x1404aa){return function(_0x8e17a7){if(_0x8e17a7){var _0x3f0a3c=typeof _0x1404aa[_0x09f2('0x18')]===_0x09f2('0x19')&&typeof _0x1404aa[_0x09f2('0x1a')]===_0x09f2('0x19');var _0xddd7f1=_0x8e17a7[_0x09f2('0x1b')];var _0xd35993=_0x3f0a3c?0x0:_0x1404aa[_0x09f2('0x18')];var _0x153e44=_0x3f0a3c?_0x8e17a7['count']:_0x1404aa[_0x09f2('0x18')]+_0x1404aa[_0x09f2('0x1a')];var _0x456004;if(_0x153e44>=_0xddd7f1){_0x153e44=_0xddd7f1;_0x456004=0xc8;}else{_0x456004=0xce;}_0x44da95[_0x09f2('0x17')](_0x456004);return _0x44da95['set'](_0x09f2('0x1c'),_0xd35993+'-'+_0x153e44+'/'+_0xddd7f1)[_0x09f2('0x1d')](_0x8e17a7);}return null;};}function patchUpdates(_0x4d25be){return function(_0x31ba91){try{jsonpatch['apply'](_0x31ba91,_0x4d25be,!![]);}catch(_0x12ae53){return BPromise[_0x09f2('0x1e')](_0x12ae53);}return _0x31ba91[_0x09f2('0x1f')]();};}function saveUpdates(_0x487a20,_0x384c93){return function(_0x2016ea){if(_0x2016ea){return _0x2016ea[_0x09f2('0x20')](_0x487a20)['then'](function(_0x4733b1){return _0x4733b1;});}return null;};}function removeEntity(_0x29a530,_0x5689a0){return function(_0x4afb3d){if(_0x4afb3d){return _0x4afb3d[_0x09f2('0x21')]()[_0x09f2('0x22')](function(){var _0x20d062=_0x4afb3d[_0x09f2('0x23')]({'plain':!![]});var _0x55f74a='ExtractedReports';return db[_0x09f2('0x24')][_0x09f2('0x21')]({'where':{'type':_0x55f74a,'resourceId':_0x20d062['id']}})['then'](function(){return _0x4afb3d;});})[_0x09f2('0x22')](function(){_0x29a530[_0x09f2('0x17')](0xcc)[_0x09f2('0x25')]();});}};}function handleEntityNotFound(_0x22578c,_0x43b849){return function(_0x567600){if(!_0x567600){_0x22578c['sendStatus'](0x194);}return _0x567600;};}function handleError(_0x134be7,_0x572ffc){_0x572ffc=_0x572ffc||0x1f4;return function(_0xb55568){logger['error'](_0xb55568['stack']);if(_0xb55568[_0x09f2('0x26')]){delete _0xb55568['name'];}_0x134be7[_0x09f2('0x17')](_0x572ffc)[_0x09f2('0x27')](_0xb55568);};}exports['index']=function(_0x3234a1,_0x2868eb){var _0x3d8814={},_0x145704={},_0x20bbdc={'count':0x0,'rows':[]};var _0x5cb5ee=_[_0x09f2('0x28')](db[_0x09f2('0x29')]['rawAttributes'],function(_0x4dbbb6){return{'name':_0x4dbbb6[_0x09f2('0x2a')],'type':_0x4dbbb6[_0x09f2('0x2b')]['key']};});_0x145704[_0x09f2('0x2c')]=_[_0x09f2('0x28')](_0x5cb5ee,_0x09f2('0x26'));_0x145704[_0x09f2('0x2d')]=_['keys'](_0x3234a1[_0x09f2('0x2d')]);_0x145704[_0x09f2('0x2e')]=_['intersection'](_0x145704[_0x09f2('0x2c')],_0x145704['query']);_0x3d8814[_0x09f2('0x2f')]=_[_0x09f2('0x30')](_0x145704['model'],qs[_0x09f2('0x31')](_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x31')]));_0x3d8814[_0x09f2('0x2f')]=_0x3d8814[_0x09f2('0x2f')][_0x09f2('0x32')]?_0x3d8814[_0x09f2('0x2f')]:_0x145704[_0x09f2('0x2c')];if(!_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x33')](_0x09f2('0x34'))){_0x3d8814[_0x09f2('0x1a')]=qs[_0x09f2('0x1a')](_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x1a')]);_0x3d8814['offset']=qs[_0x09f2('0x18')](_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x18')]);}_0x3d8814[_0x09f2('0x35')]=qs['sort'](_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x36')]);_0x3d8814[_0x09f2('0x37')]=qs[_0x09f2('0x2e')](_[_0x09f2('0x38')](_0x3234a1[_0x09f2('0x2d')],_0x145704[_0x09f2('0x2e')]),_0x5cb5ee);if(_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x39')]){_0x3d8814[_0x09f2('0x37')]=_[_0x09f2('0x3a')](_0x3d8814[_0x09f2('0x37')],{'$or':_[_0x09f2('0x28')](_0x5cb5ee,function(_0x18cdef){if(_0x18cdef['type']!==_0x09f2('0x3b')){var _0x2549cc={};_0x2549cc[_0x18cdef['name']]={'$like':'%'+_0x3234a1['query'][_0x09f2('0x39')]+'%'};return _0x2549cc;}})});}_0x3d8814=_['merge']({},_0x3d8814,_0x3234a1[_0x09f2('0x3c')]);var _0x29936f={'where':_0x3d8814['where']};return db[_0x09f2('0x29')][_0x09f2('0x1b')](_0x29936f)[_0x09f2('0x22')](function(_0x42bef3){_0x20bbdc[_0x09f2('0x1b')]=_0x42bef3;if(_0x3234a1[_0x09f2('0x2d')][_0x09f2('0x3d')]){_0x3d8814['include']=[{'all':!![]}];}return db[_0x09f2('0x29')][_0x09f2('0x3e')](_0x3d8814);})[_0x09f2('0x22')](function(_0x434eca){_0x20bbdc[_0x09f2('0x3f')]=_0x434eca;return _0x20bbdc;})[_0x09f2('0x22')](respondWithFilteredResult(_0x2868eb,_0x3d8814))[_0x09f2('0x40')](handleError(_0x2868eb,null));};exports[_0x09f2('0x41')]=function(_0x19a386,_0xea62bc){var _0x1d0ef4={'raw':!![],'where':{'id':_0x19a386['params']['id']}},_0x1913c0={};_0x1913c0['model']=_[_0x09f2('0x42')](db[_0x09f2('0x29')][_0x09f2('0x43')]);_0x1913c0['query']=_[_0x09f2('0x42')](_0x19a386['query']);_0x1913c0['filters']=_[_0x09f2('0x30')](_0x1913c0['model'],_0x1913c0[_0x09f2('0x2d')]);_0x1d0ef4[_0x09f2('0x2f')]=_['intersection'](_0x1913c0[_0x09f2('0x2c')],qs[_0x09f2('0x31')](_0x19a386['query'][_0x09f2('0x31')]));_0x1d0ef4[_0x09f2('0x2f')]=_0x1d0ef4[_0x09f2('0x2f')][_0x09f2('0x32')]?_0x1d0ef4[_0x09f2('0x2f')]:_0x1913c0[_0x09f2('0x2c')];if(_0x19a386[_0x09f2('0x2d')][_0x09f2('0x3d')]){_0x1d0ef4[_0x09f2('0x44')]=[{'all':!![]}];}_0x1d0ef4=_['merge']({},_0x1d0ef4,_0x19a386[_0x09f2('0x3c')]);return db['AnalyticExtractedReport'][_0x09f2('0x45')](_0x1d0ef4)[_0x09f2('0x22')](handleEntityNotFound(_0xea62bc,null))['then'](respondWithResult(_0xea62bc,null))[_0x09f2('0x40')](handleError(_0xea62bc,null));};exports['create']=function(_0x16f731,_0x473d05){return db[_0x09f2('0x29')][_0x09f2('0x46')](_0x16f731[_0x09f2('0x47')],{})[_0x09f2('0x22')](function(_0x10c5de){var _0x291306=_0x16f731['user'][_0x09f2('0x23')]({'plain':!![]});if(!_0x291306)throw new Error(_0x09f2('0x48'));if(_0x291306[_0x09f2('0x49')]===_0x09f2('0x4a')){var _0x45dcd5=_0x10c5de[_0x09f2('0x23')]({'plain':!![]});var _0x144c66='ExtractedReports';return db['UserProfileSection'][_0x09f2('0x45')]({'where':{'name':_0x144c66,'userProfileId':_0x291306['userProfileId']},'raw':!![]})[_0x09f2('0x22')](function(_0x4db99c){if(_0x4db99c&&_0x4db99c[_0x09f2('0x4b')]===0x0){return db['UserProfileResource'][_0x09f2('0x46')]({'name':_0x45dcd5[_0x09f2('0x26')],'resourceId':_0x45dcd5['id'],'type':_0x4db99c[_0x09f2('0x26')],'sectionId':_0x4db99c['id']},{})['then'](function(){return _0x10c5de;});}else{return _0x10c5de;}})['catch'](function(_0x5d20c7){logger[_0x09f2('0x4c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d20c7);throw _0x5d20c7;});}return _0x10c5de;})['then'](respondWithResult(_0x473d05,0xc9))['catch'](handleError(_0x473d05,null));};exports['update']=function(_0x4aadca,_0x176a71){if(_0x4aadca[_0x09f2('0x47')]['id']){delete _0x4aadca['body']['id'];}return db[_0x09f2('0x29')]['find']({'where':{'id':_0x4aadca[_0x09f2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x176a71,null))[_0x09f2('0x22')](saveUpdates(_0x4aadca[_0x09f2('0x47')],null))['then'](respondWithResult(_0x176a71,null))[_0x09f2('0x40')](handleError(_0x176a71,null));};exports[_0x09f2('0x21')]=function(_0x427755,_0x2a8699){return db[_0x09f2('0x29')]['find']({'where':{'id':_0x427755[_0x09f2('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2a8699,null))[_0x09f2('0x22')](removeEntity(_0x2a8699,null))[_0x09f2('0x40')](handleError(_0x2a8699,null));};exports[_0x09f2('0x4e')]=function(_0x5d14bf,_0xcdd86e,_0x173f4b){return db[_0x09f2('0x29')][_0x09f2('0x45')]({'where':{'id':_0x5d14bf[_0x09f2('0x4d')]['id']},'attributes':['name',_0x09f2('0x4f'),_0x09f2('0x50'),_0x09f2('0x51')],'raw':!![]})[_0x09f2('0x22')](handleEntityNotFound(_0xcdd86e,null))[_0x09f2('0x22')](function(_0xc53ed5){if(_0xc53ed5){if(!fs['existsSync'](path[_0x09f2('0x52')](config['root'],_0x09f2('0x53'),_0xc53ed5['savename']))){throw new db[(_0x09f2('0x54'))][(_0x09f2('0x55'))](_0x09f2('0x56'));}if(_0x5d14bf[_0x09f2('0x2d')][_0x09f2('0x57')]){return _0xcdd86e['sendStatus'](0xc8);}return _0xcdd86e['download'](path['join'](config[_0x09f2('0x58')],_0x09f2('0x53'),_0xc53ed5['savename']),util[_0x09f2('0x59')](_0x09f2('0x5a'),_0xc53ed5['basename']||_0xc53ed5[_0x09f2('0x26')],_0xc53ed5[_0x09f2('0x51')][_0x09f2('0x5b')]()));}})[_0x09f2('0x40')](handleError(_0xcdd86e,null));}; \ No newline at end of file +var _0xed67=['offset','undefined','limit','count','Content-Range','apply','reject','then','get','destroy','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','download','output','existsSync','root','server/files/reports','savename','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format','%s.%s','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x3b2370,_0x3add2e){var _0xf8a798=function(_0x37bcf5){while(--_0x37bcf5){_0x3b2370['push'](_0x3b2370['shift']());}};_0xf8a798(++_0x3add2e);}(_0xed67,0x9f));var _0x7ed6=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0xed67[_0x1bc013];return _0x55df36;};'use strict';var emlformat=require(_0x7ed6('0x0'));var rimraf=require(_0x7ed6('0x1'));var zipdir=require(_0x7ed6('0x2'));var jsonpatch=require(_0x7ed6('0x3'));var rp=require('request-promise');var moment=require(_0x7ed6('0x4'));var BPromise=require(_0x7ed6('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7ed6('0x6'));var sox=require(_0x7ed6('0x7'));var csv=require(_0x7ed6('0x8'));var ejs=require(_0x7ed6('0x9'));var fs=require('fs');var fs_extra=require(_0x7ed6('0xa'));var _=require(_0x7ed6('0xb'));var squel=require('squel');var crypto=require(_0x7ed6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7ed6('0xd'));var toCsv=require(_0x7ed6('0x8'));var querystring=require(_0x7ed6('0xe'));var Papa=require(_0x7ed6('0xf'));var Redis=require('ioredis');var authService=require(_0x7ed6('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7ed6('0x11'));var hardwareService=require(_0x7ed6('0x12'));var logger=require(_0x7ed6('0x13'))(_0x7ed6('0x14'));var utils=require('../../config/utils');var config=require(_0x7ed6('0x15'));var licenseUtil=require(_0x7ed6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4da7e9,_0x9825a1){_0x9825a1=_0x9825a1||0xcc;return function(_0x6ca96b){if(_0x6ca96b){return _0x4da7e9[_0x7ed6('0x17')](_0x9825a1);}return _0x4da7e9[_0x7ed6('0x18')](_0x9825a1)[_0x7ed6('0x19')]();};}function respondWithResult(_0x53bc02,_0x4235f3){_0x4235f3=_0x4235f3||0xc8;return function(_0x501a77){if(_0x501a77){return _0x53bc02[_0x7ed6('0x18')](_0x4235f3)[_0x7ed6('0x1a')](_0x501a77);}};}function respondWithFilteredResult(_0x7da8ec,_0xff699e){return function(_0xf14d5){if(_0xf14d5){var _0x509775=typeof _0xff699e[_0x7ed6('0x1b')]===_0x7ed6('0x1c')&&typeof _0xff699e[_0x7ed6('0x1d')]===_0x7ed6('0x1c');var _0x391230=_0xf14d5[_0x7ed6('0x1e')];var _0x36b774=_0x509775?0x0:_0xff699e[_0x7ed6('0x1b')];var _0x3f9b6e=_0x509775?_0xf14d5[_0x7ed6('0x1e')]:_0xff699e[_0x7ed6('0x1b')]+_0xff699e['limit'];var _0x229464;if(_0x3f9b6e>=_0x391230){_0x3f9b6e=_0x391230;_0x229464=0xc8;}else{_0x229464=0xce;}_0x7da8ec[_0x7ed6('0x18')](_0x229464);return _0x7da8ec['set'](_0x7ed6('0x1f'),_0x36b774+'-'+_0x3f9b6e+'/'+_0x391230)['json'](_0xf14d5);}return null;};}function patchUpdates(_0x3f09d5){return function(_0x534007){try{jsonpatch[_0x7ed6('0x20')](_0x534007,_0x3f09d5,!![]);}catch(_0x11015f){return BPromise[_0x7ed6('0x21')](_0x11015f);}return _0x534007['save']();};}function saveUpdates(_0x10f792,_0x4ef839){return function(_0x6ae4c6){if(_0x6ae4c6){return _0x6ae4c6['update'](_0x10f792)[_0x7ed6('0x22')](function(_0x338fe0){return _0x338fe0;});}return null;};}function removeEntity(_0x5ada38,_0x6d1ae7){return function(_0x5abc1b){if(_0x5abc1b){return _0x5abc1b['destroy']()[_0x7ed6('0x22')](function(){var _0x5d7d78=_0x5abc1b[_0x7ed6('0x23')]({'plain':!![]});var _0x49c264='ExtractedReports';return db['UserProfileResource'][_0x7ed6('0x24')]({'where':{'type':_0x49c264,'resourceId':_0x5d7d78['id']}})['then'](function(){return _0x5abc1b;});})[_0x7ed6('0x22')](function(){_0x5ada38[_0x7ed6('0x18')](0xcc)[_0x7ed6('0x19')]();});}};}function handleEntityNotFound(_0x4163a8,_0x32ef12){return function(_0x1a232){if(!_0x1a232){_0x4163a8['sendStatus'](0x194);}return _0x1a232;};}function handleError(_0x2f1d87,_0x105a12){_0x105a12=_0x105a12||0x1f4;return function(_0x442e92){logger['error'](_0x442e92[_0x7ed6('0x25')]);if(_0x442e92[_0x7ed6('0x26')]){delete _0x442e92['name'];}_0x2f1d87['status'](_0x105a12)['send'](_0x442e92);};}exports[_0x7ed6('0x27')]=function(_0x440f33,_0x2d4d82){var _0x1c99b7={},_0x58a008={},_0x3bec38={'count':0x0,'rows':[]};var _0x5dc7c9=_[_0x7ed6('0x28')](db[_0x7ed6('0x29')][_0x7ed6('0x2a')],function(_0x2a2816){return{'name':_0x2a2816[_0x7ed6('0x2b')],'type':_0x2a2816[_0x7ed6('0x2c')][_0x7ed6('0x2d')]};});_0x58a008[_0x7ed6('0x2e')]=_[_0x7ed6('0x28')](_0x5dc7c9,'name');_0x58a008['query']=_[_0x7ed6('0x2f')](_0x440f33[_0x7ed6('0x30')]);_0x58a008[_0x7ed6('0x31')]=_['intersection'](_0x58a008[_0x7ed6('0x2e')],_0x58a008[_0x7ed6('0x30')]);_0x1c99b7[_0x7ed6('0x32')]=_[_0x7ed6('0x33')](_0x58a008[_0x7ed6('0x2e')],qs[_0x7ed6('0x34')](_0x440f33[_0x7ed6('0x30')][_0x7ed6('0x34')]));_0x1c99b7[_0x7ed6('0x32')]=_0x1c99b7[_0x7ed6('0x32')]['length']?_0x1c99b7[_0x7ed6('0x32')]:_0x58a008[_0x7ed6('0x2e')];if(!_0x440f33[_0x7ed6('0x30')][_0x7ed6('0x35')]('nolimit')){_0x1c99b7[_0x7ed6('0x1d')]=qs[_0x7ed6('0x1d')](_0x440f33[_0x7ed6('0x30')]['limit']);_0x1c99b7[_0x7ed6('0x1b')]=qs['offset'](_0x440f33[_0x7ed6('0x30')][_0x7ed6('0x1b')]);}_0x1c99b7['order']=qs[_0x7ed6('0x36')](_0x440f33[_0x7ed6('0x30')][_0x7ed6('0x36')]);_0x1c99b7[_0x7ed6('0x37')]=qs[_0x7ed6('0x31')](_[_0x7ed6('0x38')](_0x440f33[_0x7ed6('0x30')],_0x58a008[_0x7ed6('0x31')]),_0x5dc7c9);if(_0x440f33[_0x7ed6('0x30')]['filter']){_0x1c99b7['where']=_[_0x7ed6('0x39')](_0x1c99b7[_0x7ed6('0x37')],{'$or':_[_0x7ed6('0x28')](_0x5dc7c9,function(_0x2e2b7b){if(_0x2e2b7b[_0x7ed6('0x2c')]!==_0x7ed6('0x3a')){var _0x7c6725={};_0x7c6725[_0x2e2b7b[_0x7ed6('0x26')]]={'$like':'%'+_0x440f33['query'][_0x7ed6('0x3b')]+'%'};return _0x7c6725;}})});}_0x1c99b7=_[_0x7ed6('0x39')]({},_0x1c99b7,_0x440f33['options']);var _0x2d388f={'where':_0x1c99b7[_0x7ed6('0x37')]};return db['AnalyticExtractedReport'][_0x7ed6('0x1e')](_0x2d388f)[_0x7ed6('0x22')](function(_0x358355){_0x3bec38[_0x7ed6('0x1e')]=_0x358355;if(_0x440f33[_0x7ed6('0x30')][_0x7ed6('0x3c')]){_0x1c99b7[_0x7ed6('0x3d')]=[{'all':!![]}];}return db[_0x7ed6('0x29')][_0x7ed6('0x3e')](_0x1c99b7);})[_0x7ed6('0x22')](function(_0x4a5d35){_0x3bec38[_0x7ed6('0x3f')]=_0x4a5d35;return _0x3bec38;})[_0x7ed6('0x22')](respondWithFilteredResult(_0x2d4d82,_0x1c99b7))[_0x7ed6('0x40')](handleError(_0x2d4d82,null));};exports[_0x7ed6('0x41')]=function(_0x496f14,_0x253c43){var _0x3ee36b={'raw':!![],'where':{'id':_0x496f14[_0x7ed6('0x42')]['id']}},_0x354556={};_0x354556['model']=_[_0x7ed6('0x2f')](db[_0x7ed6('0x29')][_0x7ed6('0x2a')]);_0x354556[_0x7ed6('0x30')]=_['keys'](_0x496f14[_0x7ed6('0x30')]);_0x354556[_0x7ed6('0x31')]=_[_0x7ed6('0x33')](_0x354556[_0x7ed6('0x2e')],_0x354556[_0x7ed6('0x30')]);_0x3ee36b[_0x7ed6('0x32')]=_[_0x7ed6('0x33')](_0x354556['model'],qs['fields'](_0x496f14[_0x7ed6('0x30')][_0x7ed6('0x34')]));_0x3ee36b['attributes']=_0x3ee36b[_0x7ed6('0x32')][_0x7ed6('0x43')]?_0x3ee36b[_0x7ed6('0x32')]:_0x354556[_0x7ed6('0x2e')];if(_0x496f14[_0x7ed6('0x30')][_0x7ed6('0x3c')]){_0x3ee36b[_0x7ed6('0x3d')]=[{'all':!![]}];}_0x3ee36b=_[_0x7ed6('0x39')]({},_0x3ee36b,_0x496f14['options']);return db[_0x7ed6('0x29')][_0x7ed6('0x44')](_0x3ee36b)[_0x7ed6('0x22')](handleEntityNotFound(_0x253c43,null))[_0x7ed6('0x22')](respondWithResult(_0x253c43,null))[_0x7ed6('0x40')](handleError(_0x253c43,null));};exports[_0x7ed6('0x45')]=function(_0x5411ec,_0x26d74d){return db[_0x7ed6('0x29')][_0x7ed6('0x45')](_0x5411ec[_0x7ed6('0x46')],{})[_0x7ed6('0x22')](function(_0x10ad8f){var _0x42ec13=_0x5411ec[_0x7ed6('0x47')][_0x7ed6('0x23')]({'plain':!![]});if(!_0x42ec13)throw new Error(_0x7ed6('0x48'));if(_0x42ec13['role']==='user'){var _0x161084=_0x10ad8f[_0x7ed6('0x23')]({'plain':!![]});var _0x22a521='ExtractedReports';return db[_0x7ed6('0x49')]['find']({'where':{'name':_0x22a521,'userProfileId':_0x42ec13[_0x7ed6('0x4a')]},'raw':!![]})[_0x7ed6('0x22')](function(_0x4cad40){if(_0x4cad40&&_0x4cad40[_0x7ed6('0x4b')]===0x0){return db['UserProfileResource'][_0x7ed6('0x45')]({'name':_0x161084[_0x7ed6('0x26')],'resourceId':_0x161084['id'],'type':_0x4cad40[_0x7ed6('0x26')],'sectionId':_0x4cad40['id']},{})[_0x7ed6('0x22')](function(){return _0x10ad8f;});}else{return _0x10ad8f;}})[_0x7ed6('0x40')](function(_0x34b428){logger[_0x7ed6('0x4c')](_0x7ed6('0x4d'),_0x34b428);throw _0x34b428;});}return _0x10ad8f;})[_0x7ed6('0x22')](respondWithResult(_0x26d74d,0xc9))[_0x7ed6('0x40')](handleError(_0x26d74d,null));};exports[_0x7ed6('0x4e')]=function(_0x57be40,_0x2ff9ed){if(_0x57be40[_0x7ed6('0x46')]['id']){delete _0x57be40[_0x7ed6('0x46')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0x57be40[_0x7ed6('0x42')]['id']}})[_0x7ed6('0x22')](handleEntityNotFound(_0x2ff9ed,null))[_0x7ed6('0x22')](saveUpdates(_0x57be40[_0x7ed6('0x46')],null))[_0x7ed6('0x22')](respondWithResult(_0x2ff9ed,null))[_0x7ed6('0x40')](handleError(_0x2ff9ed,null));};exports['destroy']=function(_0x5228a1,_0x14309d){return db['AnalyticExtractedReport'][_0x7ed6('0x44')]({'where':{'id':_0x5228a1['params']['id']}})[_0x7ed6('0x22')](handleEntityNotFound(_0x14309d,null))[_0x7ed6('0x22')](removeEntity(_0x14309d,null))[_0x7ed6('0x40')](handleError(_0x14309d,null));};exports[_0x7ed6('0x4f')]=function(_0x375bff,_0x481ad1,_0x12ba12){return db[_0x7ed6('0x29')][_0x7ed6('0x44')]({'where':{'id':_0x375bff[_0x7ed6('0x42')]['id']},'attributes':[_0x7ed6('0x26'),'basename','savename',_0x7ed6('0x50')],'raw':!![]})[_0x7ed6('0x22')](handleEntityNotFound(_0x481ad1,null))[_0x7ed6('0x22')](function(_0x2aceac){if(_0x2aceac){if(!fs[_0x7ed6('0x51')](path['join'](config[_0x7ed6('0x52')],_0x7ed6('0x53'),_0x2aceac[_0x7ed6('0x54')]))){throw new db['Sequelize'][(_0x7ed6('0x55'))](_0x7ed6('0x56'));}if(_0x375bff['query'][_0x7ed6('0x57')]){return _0x481ad1[_0x7ed6('0x17')](0xc8);}return _0x481ad1[_0x7ed6('0x4f')](path[_0x7ed6('0x58')](config[_0x7ed6('0x52')],_0x7ed6('0x53'),_0x2aceac[_0x7ed6('0x54')]),util[_0x7ed6('0x59')](_0x7ed6('0x5a'),_0x2aceac[_0x7ed6('0x5b')]||_0x2aceac[_0x7ed6('0x26')],_0x2aceac[_0x7ed6('0x50')][_0x7ed6('0x5c')]()));}})[_0x7ed6('0x40')](handleError(_0x481ad1,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 5a6bdf7..06f5a67 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 _0xfbb0=['path','rimraf','../../config/environment','define','AnalyticExtractedReport','lodash','util','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfbb0,0x127));var _0x0fbb=function(_0x2b52b2,_0x41fac1){_0x2b52b2=_0x2b52b2-0x0;var _0x3b9452=_0xfbb0[_0x2b52b2];return _0x3b9452;};'use strict';var _=require(_0x0fbb('0x0'));var util=require(_0x0fbb('0x1'));var logger=require('../../config/logger')(_0x0fbb('0x2'));var moment=require('moment');var BPromise=require(_0x0fbb('0x3'));var rp=require(_0x0fbb('0x4'));var fs=require('fs');var path=require(_0x0fbb('0x5'));var rimraf=require(_0x0fbb('0x6'));var config=require(_0x0fbb('0x7'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x37916c,_0xde0e1f){return _0x37916c[_0x0fbb('0x8')](_0x0fbb('0x9'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9698=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports','lodash','util'];(function(_0x18e875,_0x54fff7){var _0x1643c6=function(_0x5f09ff){while(--_0x5f09ff){_0x18e875['push'](_0x18e875['shift']());}};_0x1643c6(++_0x54fff7);}(_0x9698,0xb4));var _0x8969=function(_0x2ed554,_0x2c7516){_0x2ed554=_0x2ed554-0x0;var _0x4f9928=_0x9698[_0x2ed554];return _0x4f9928;};'use strict';var _=require(_0x8969('0x0'));var util=require(_0x8969('0x1'));var logger=require(_0x8969('0x2'))(_0x8969('0x3'));var moment=require(_0x8969('0x4'));var BPromise=require(_0x8969('0x5'));var rp=require(_0x8969('0x6'));var fs=require('fs');var path=require(_0x8969('0x7'));var rimraf=require(_0x8969('0x8'));var config=require('../../config/environment');var attributes=require(_0x8969('0x9'));module[_0x8969('0xa')]=function(_0x30deb7,_0x36b27e){return _0x30deb7[_0x8969('0xb')]('AnalyticExtractedReport',attributes,{'tableName':_0x8969('0xc'),'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 e700673..6393f0b 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 _0x4171=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','AnalyticExtractedReport,\x20%s,\x20%s','result','catch','moment','randomstring'];(function(_0x2a2b20,_0x12b369){var _0x719640=function(_0x1e8c5c){while(--_0x1e8c5c){_0x2a2b20['push'](_0x2a2b20['shift']());}};_0x719640(++_0x12b369);}(_0x4171,0xcf));var _0x1417=function(_0x5284b0,_0x93b154){_0x5284b0=_0x5284b0-0x0;var _0x2983b1=_0x4171[_0x5284b0];return _0x2983b1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1417('0x0'));var BPromise=require('bluebird');var rs=require(_0x1417('0x1'));var fs=require('fs');var Redis=require(_0x1417('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x1417('0x3'));var logger=require(_0x1417('0x4'))(_0x1417('0x5'));var config=require(_0x1417('0x6'));var jayson=require(_0x1417('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x130817,_0x12374b,_0x146796){return new BPromise(function(_0x5e1a35,_0xa233ba){return client[_0x1417('0x8')](_0x130817,_0x146796)['then'](function(_0x2ad490){logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x12374b,_0x1417('0x9'));logger['debug'](_0x1417('0xa'),_0x12374b,_0x1417('0x9'),JSON[_0x1417('0xb')](_0x2ad490));if(_0x2ad490[_0x1417('0xc')]){if(_0x2ad490[_0x1417('0xc')][_0x1417('0xd')]===0x1f4){logger[_0x1417('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x12374b,_0x2ad490['error'][_0x1417('0xe')]);return _0xa233ba(_0x2ad490[_0x1417('0xc')][_0x1417('0xe')]);}logger[_0x1417('0xc')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x12374b,_0x2ad490['error']['message']);return _0x5e1a35(_0x2ad490[_0x1417('0xc')][_0x1417('0xe')]);}else{logger[_0x1417('0xf')](_0x1417('0x10'),_0x12374b,_0x1417('0x9'));_0x5e1a35(_0x2ad490[_0x1417('0x11')][_0x1417('0xe')]);}})[_0x1417('0x12')](function(_0x55afd7){logger[_0x1417('0xc')](_0x1417('0x10'),_0x12374b,_0x55afd7);_0xa233ba(_0x55afd7);});});} \ No newline at end of file +var _0x6570=['client','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x6570,0xe6));var _0x0657=function(_0x169c29,_0x1a4749){_0x169c29=_0x169c29-0x0;var _0x589d5c=_0x6570[_0x169c29];return _0x589d5c;};'use strict';var _=require(_0x0657('0x0'));var util=require(_0x0657('0x1'));var moment=require('moment');var BPromise=require(_0x0657('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0657('0x3'));var db=require(_0x0657('0x4'))['db'];var utils=require(_0x0657('0x5'));var logger=require(_0x0657('0x6'))(_0x0657('0x7'));var config=require(_0x0657('0x8'));var jayson=require(_0x0657('0x9'));var client=jayson[_0x0657('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a9b99,_0x512f1f,_0x107268){return new BPromise(function(_0x4c2390,_0x1a4cba){return client[_0x0657('0xb')](_0x2a9b99,_0x107268)[_0x0657('0xc')](function(_0x10a56b){logger[_0x0657('0xd')](_0x0657('0xe'),_0x512f1f,_0x0657('0xf'));logger[_0x0657('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x512f1f,'request\x20sent',JSON['stringify'](_0x10a56b));if(_0x10a56b[_0x0657('0x11')]){if(_0x10a56b[_0x0657('0x11')][_0x0657('0x12')]===0x1f4){logger[_0x0657('0x11')](_0x0657('0xe'),_0x512f1f,_0x10a56b['error'][_0x0657('0x13')]);return _0x1a4cba(_0x10a56b[_0x0657('0x11')]['message']);}logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x512f1f,_0x10a56b['error']['message']);return _0x4c2390(_0x10a56b['error'][_0x0657('0x13')]);}else{logger[_0x0657('0xd')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x512f1f,_0x0657('0xf'));_0x4c2390(_0x10a56b['result'][_0x0657('0x13')]);}})['catch'](function(_0x1cba95){logger[_0x0657('0x11')](_0x0657('0xe'),_0x512f1f,_0x1cba95);_0x1a4cba(_0x1cba95);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8d8da12..09fafcf 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 _0xbf67=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','download','post'];(function(_0x469e9b,_0x44e1cf){var _0x2d6269=function(_0x24491e){while(--_0x24491e){_0x469e9b['push'](_0x469e9b['shift']());}};_0x2d6269(++_0x44e1cf);}(_0xbf67,0x1a4));var _0x7bf6=function(_0x3131bd,_0x4da42e){_0x3131bd=_0x3131bd-0x0;var _0x5355d8=_0xbf67[_0x3131bd];return _0x5355d8;};'use strict';var multer=require(_0x7bf6('0x0'));var util=require(_0x7bf6('0x1'));var path=require(_0x7bf6('0x2'));var timeout=require(_0x7bf6('0x3'));var express=require(_0x7bf6('0x4'));var router=express[_0x7bf6('0x5')]();var fs_extra=require(_0x7bf6('0x6'));var auth=require(_0x7bf6('0x7'));var interaction=require(_0x7bf6('0x8'));var config=require(_0x7bf6('0x9'));var controller=require(_0x7bf6('0xa'));router[_0x7bf6('0xb')]('/',auth[_0x7bf6('0xc')](),controller['index']);router[_0x7bf6('0xb')](_0x7bf6('0xd'),auth['isAuthenticated'](),controller[_0x7bf6('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x7bf6('0xf')]);router[_0x7bf6('0x10')]('/',auth[_0x7bf6('0xc')](),controller[_0x7bf6('0x11')]);router[_0x7bf6('0x12')](_0x7bf6('0xd'),auth[_0x7bf6('0xc')](),controller[_0x7bf6('0x13')]);router[_0x7bf6('0x14')](_0x7bf6('0xd'),auth['isAuthenticated'](),controller[_0x7bf6('0x15')]);module[_0x7bf6('0x16')]=router; \ No newline at end of file +var _0x6b0e=['put','update','delete','destroy','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create'];(function(_0x365f2a,_0x566ba8){var _0x41216b=function(_0x2a1427){while(--_0x2a1427){_0x365f2a['push'](_0x365f2a['shift']());}};_0x41216b(++_0x566ba8);}(_0x6b0e,0x19c));var _0xe6b0=function(_0x1f44b2,_0x1fb330){_0x1f44b2=_0x1f44b2-0x0;var _0x58a2f2=_0x6b0e[_0x1f44b2];return _0x58a2f2;};'use strict';var multer=require('multer');var util=require(_0xe6b0('0x0'));var path=require(_0xe6b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe6b0('0x2'));var router=express[_0xe6b0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe6b0('0x4'));var interaction=require(_0xe6b0('0x5'));var config=require(_0xe6b0('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0xe6b0('0x7')]('/',auth[_0xe6b0('0x8')](),controller[_0xe6b0('0x9')]);router[_0xe6b0('0x7')](_0xe6b0('0xa'),auth[_0xe6b0('0x8')](),controller[_0xe6b0('0xb')]);router[_0xe6b0('0x7')]('/:id/download',auth[_0xe6b0('0x8')](),controller['download']);router['post']('/',auth[_0xe6b0('0x8')](),controller[_0xe6b0('0xc')]);router[_0xe6b0('0xd')](_0xe6b0('0xa'),auth[_0xe6b0('0x8')](),controller[_0xe6b0('0xe')]);router[_0xe6b0('0xf')](_0xe6b0('0xa'),auth[_0xe6b0('0x8')](),controller[_0xe6b0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index dafba22..6ba1f27 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 _0xa704=['BOOLEAN','exports','TEXT','STRING'];(function(_0x4b49cc,_0x24c7f5){var _0x3e60aa=function(_0x7c2fd8){while(--_0x7c2fd8){_0x4b49cc['push'](_0x4b49cc['shift']());}};_0x3e60aa(++_0x24c7f5);}(_0xa704,0xe1));var _0x4a70=function(_0x404eff,_0x4ef653){_0x404eff=_0x404eff-0x0;var _0x46cc25=_0xa704[_0x404eff];return _0x46cc25;};'use strict';var Sequelize=require('sequelize');module[_0x4a70('0x0')]={'field':{'type':Sequelize[_0x4a70('0x1')]},'alias':{'type':Sequelize[_0x4a70('0x2')]},'function':{'type':Sequelize[_0x4a70('0x2')]},'format':{'type':Sequelize[_0x4a70('0x2')]},'groupBy':{'type':Sequelize[_0x4a70('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x4a70('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe439=['exports','TEXT','STRING','BOOLEAN'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xe439,0x19c));var _0x9e43=function(_0x16dd70,_0x4ea63b){_0x16dd70=_0x16dd70-0x0;var _0x222754=_0xe439[_0x16dd70];return _0x222754;};'use strict';var Sequelize=require('sequelize');module[_0x9e43('0x0')]={'field':{'type':Sequelize[_0x9e43('0x1')]},'alias':{'type':Sequelize[_0x9e43('0x2')]},'function':{'type':Sequelize[_0x9e43('0x2')]},'format':{'type':Sequelize[_0x9e43('0x2')]},'groupBy':{'type':Sequelize[_0x9e43('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x9e43('0x2')]},'custom':{'type':Sequelize[_0x9e43('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 99b4695..5aec812 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 _0x924e=['bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','save','update','then','destroy','end','name','send','map','AnalyticFieldReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','rawAttributes','include','find','create','body','bulkCreate','params','bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x95e3ac,_0x4aa242){var _0xb1fad0=function(_0x5739de){while(--_0x5739de){_0x95e3ac['push'](_0x95e3ac['shift']());}};_0xb1fad0(++_0x4aa242);}(_0x924e,0x1e1));var _0xe924=function(_0x5a2722,_0x17dfe9){_0x5a2722=_0x5a2722-0x0;var _0x4ea915=_0x924e[_0x5a2722];return _0x4ea915;};'use strict';var emlformat=require(_0xe924('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe924('0x1'));var jsonpatch=require(_0xe924('0x2'));var rp=require(_0xe924('0x3'));var moment=require(_0xe924('0x4'));var BPromise=require(_0xe924('0x5'));var Mustache=require(_0xe924('0x6'));var util=require(_0xe924('0x7'));var path=require(_0xe924('0x8'));var sox=require(_0xe924('0x9'));var csv=require(_0xe924('0xa'));var ejs=require(_0xe924('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe924('0xc'));var squel=require(_0xe924('0xd'));var crypto=require(_0xe924('0xe'));var jsforce=require(_0xe924('0xf'));var deskjs=require(_0xe924('0x10'));var toCsv=require(_0xe924('0xa'));var querystring=require(_0xe924('0x11'));var Papa=require('papaparse');var Redis=require(_0xe924('0x12'));var authService=require(_0xe924('0x13'));var qs=require(_0xe924('0x14'));var as=require(_0xe924('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe924('0x16'));var utils=require(_0xe924('0x17'));var config=require(_0xe924('0x18'));var licenseUtil=require(_0xe924('0x19'));var db=require(_0xe924('0x1a'))['db'];function respondWithStatusCode(_0x3431cf,_0x170297){_0x170297=_0x170297||0xcc;return function(_0x3178c3){if(_0x3178c3){return _0x3431cf[_0xe924('0x1b')](_0x170297);}return _0x3431cf[_0xe924('0x1c')](_0x170297)['end']();};}function respondWithResult(_0x3e1f4d,_0x5e03a2){_0x5e03a2=_0x5e03a2||0xc8;return function(_0x3fd089){if(_0x3fd089){return _0x3e1f4d['status'](_0x5e03a2)[_0xe924('0x1d')](_0x3fd089);}};}function respondWithFilteredResult(_0x2f8bbc,_0x57b043){return function(_0x1a1d76){if(_0x1a1d76){var _0x270815=typeof _0x57b043[_0xe924('0x1e')]==='undefined'&&typeof _0x57b043['limit']==='undefined';var _0x19cd42=_0x1a1d76[_0xe924('0x1f')];var _0x2e069d=_0x270815?0x0:_0x57b043[_0xe924('0x1e')];var _0x18613c=_0x270815?_0x1a1d76[_0xe924('0x1f')]:_0x57b043['offset']+_0x57b043[_0xe924('0x20')];var _0x40f5a6;if(_0x18613c>=_0x19cd42){_0x18613c=_0x19cd42;_0x40f5a6=0xc8;}else{_0x40f5a6=0xce;}_0x2f8bbc[_0xe924('0x1c')](_0x40f5a6);return _0x2f8bbc[_0xe924('0x21')](_0xe924('0x22'),_0x2e069d+'-'+_0x18613c+'/'+_0x19cd42)[_0xe924('0x1d')](_0x1a1d76);}return null;};}function patchUpdates(_0x20d5ea){return function(_0x5968fa){try{jsonpatch['apply'](_0x5968fa,_0x20d5ea,!![]);}catch(_0x3d2c57){return BPromise['reject'](_0x3d2c57);}return _0x5968fa[_0xe924('0x23')]();};}function saveUpdates(_0x1714c5,_0x47a9b7){return function(_0x540d2a){if(_0x540d2a){return _0x540d2a[_0xe924('0x24')](_0x1714c5)[_0xe924('0x25')](function(_0x43e0eb){return _0x43e0eb;});}return null;};}function removeEntity(_0x38b771,_0x32f83b){return function(_0x2f10ca){if(_0x2f10ca){return _0x2f10ca[_0xe924('0x26')]()[_0xe924('0x25')](function(){_0x38b771['status'](0xcc)[_0xe924('0x27')]();});}};}function handleEntityNotFound(_0x1366b1,_0x34548c){return function(_0xe5dfbc){if(!_0xe5dfbc){_0x1366b1[_0xe924('0x1b')](0x194);}return _0xe5dfbc;};}function handleError(_0x11bd04,_0x59d895){_0x59d895=_0x59d895||0x1f4;return function(_0x1df6cf){logger['error'](_0x1df6cf['stack']);if(_0x1df6cf[_0xe924('0x28')]){delete _0x1df6cf[_0xe924('0x28')];}_0x11bd04[_0xe924('0x1c')](_0x59d895)[_0xe924('0x29')](_0x1df6cf);};}exports['index']=function(_0x281e1b,_0x3ada8c){var _0x446c11={},_0x49ae53={},_0x15a522={'count':0x0,'rows':[]};var _0x3adb09=_[_0xe924('0x2a')](db[_0xe924('0x2b')]['rawAttributes'],function(_0x485d41){return{'name':_0x485d41['fieldName'],'type':_0x485d41[_0xe924('0x2c')]['key']};});_0x49ae53[_0xe924('0x2d')]=_[_0xe924('0x2a')](_0x3adb09,_0xe924('0x28'));_0x49ae53[_0xe924('0x2e')]=_[_0xe924('0x2f')](_0x281e1b[_0xe924('0x2e')]);_0x49ae53[_0xe924('0x30')]=_[_0xe924('0x31')](_0x49ae53[_0xe924('0x2d')],_0x49ae53['query']);_0x446c11[_0xe924('0x32')]=_[_0xe924('0x31')](_0x49ae53[_0xe924('0x2d')],qs[_0xe924('0x33')](_0x281e1b[_0xe924('0x2e')][_0xe924('0x33')]));_0x446c11[_0xe924('0x32')]=_0x446c11[_0xe924('0x32')][_0xe924('0x34')]?_0x446c11[_0xe924('0x32')]:_0x49ae53[_0xe924('0x2d')];if(!_0x281e1b[_0xe924('0x2e')][_0xe924('0x35')](_0xe924('0x36'))){_0x446c11['limit']=qs[_0xe924('0x20')](_0x281e1b[_0xe924('0x2e')][_0xe924('0x20')]);_0x446c11['offset']=qs[_0xe924('0x1e')](_0x281e1b[_0xe924('0x2e')]['offset']);}_0x446c11[_0xe924('0x37')]=qs[_0xe924('0x38')](_0x281e1b[_0xe924('0x2e')]['sort']);_0x446c11[_0xe924('0x39')]=qs[_0xe924('0x30')](_[_0xe924('0x3a')](_0x281e1b[_0xe924('0x2e')],_0x49ae53[_0xe924('0x30')]),_0x3adb09);if(_0x281e1b[_0xe924('0x2e')][_0xe924('0x3b')]){_0x446c11[_0xe924('0x39')]=_[_0xe924('0x3c')](_0x446c11[_0xe924('0x39')],{'$or':_[_0xe924('0x2a')](_0x3adb09,function(_0x891415){if(_0x891415[_0xe924('0x2c')]!==_0xe924('0x3d')){var _0x4bc39d={};_0x4bc39d[_0x891415[_0xe924('0x28')]]={'$like':'%'+_0x281e1b[_0xe924('0x2e')][_0xe924('0x3b')]+'%'};return _0x4bc39d;}})});}_0x446c11=_[_0xe924('0x3c')]({},_0x446c11,_0x281e1b[_0xe924('0x3e')]);var _0x4c3352={'where':_0x446c11[_0xe924('0x39')]};return db[_0xe924('0x2b')][_0xe924('0x1f')](_0x4c3352)[_0xe924('0x25')](function(_0x153d09){_0x15a522[_0xe924('0x1f')]=_0x153d09;if(_0x281e1b['query'][_0xe924('0x3f')]){_0x446c11['include']=[{'all':!![]}];}return db[_0xe924('0x2b')]['findAll'](_0x446c11);})['then'](function(_0x16430b){_0x15a522['rows']=_0x16430b;return _0x15a522;})[_0xe924('0x25')](respondWithFilteredResult(_0x3ada8c,_0x446c11))[_0xe924('0x40')](handleError(_0x3ada8c,null));};exports[_0xe924('0x41')]=function(_0x51c8ce,_0xbdd09f){var _0x416b36={'raw':![],'where':{'id':_0x51c8ce['params']['id']}},_0xebe90={};_0xebe90['model']=_[_0xe924('0x2f')](db[_0xe924('0x2b')][_0xe924('0x42')]);_0xebe90[_0xe924('0x2e')]=_[_0xe924('0x2f')](_0x51c8ce[_0xe924('0x2e')]);_0xebe90[_0xe924('0x30')]=_[_0xe924('0x31')](_0xebe90[_0xe924('0x2d')],_0xebe90[_0xe924('0x2e')]);_0x416b36['attributes']=_[_0xe924('0x31')](_0xebe90[_0xe924('0x2d')],qs['fields'](_0x51c8ce[_0xe924('0x2e')][_0xe924('0x33')]));_0x416b36[_0xe924('0x32')]=_0x416b36[_0xe924('0x32')][_0xe924('0x34')]?_0x416b36[_0xe924('0x32')]:_0xebe90[_0xe924('0x2d')];if(_0x51c8ce[_0xe924('0x2e')][_0xe924('0x3f')]){_0x416b36[_0xe924('0x43')]=[{'all':!![]}];}_0x416b36=_[_0xe924('0x3c')]({},_0x416b36,_0x51c8ce[_0xe924('0x3e')]);return db[_0xe924('0x2b')][_0xe924('0x44')](_0x416b36)[_0xe924('0x25')](handleEntityNotFound(_0xbdd09f,null))[_0xe924('0x25')](respondWithResult(_0xbdd09f,null))[_0xe924('0x40')](handleError(_0xbdd09f,null));};exports[_0xe924('0x45')]=function(_0xa192d7,_0x4a4705){return db['AnalyticFieldReport'][_0xe924('0x45')](_0xa192d7[_0xe924('0x46')],{})[_0xe924('0x25')](respondWithResult(_0x4a4705,0xc9))[_0xe924('0x40')](handleError(_0x4a4705,null));};exports[_0xe924('0x47')]=function(_0x29d138,_0x5463a4){return db[_0xe924('0x2b')]['bulkCreate'](_0x29d138[_0xe924('0x46')],{'raw':![],'individualHooks':!![]})[_0xe924('0x25')](respondWithResult(_0x5463a4,0xc9))['catch'](handleError(_0x5463a4,null));};exports[_0xe924('0x24')]=function(_0x156e81,_0x5c0dce){if(_0x156e81['body']['id']){delete _0x156e81[_0xe924('0x46')]['id'];}return db['AnalyticFieldReport'][_0xe924('0x44')]({'where':{'id':_0x156e81[_0xe924('0x48')]['id']}})[_0xe924('0x25')](handleEntityNotFound(_0x5c0dce,null))['then'](saveUpdates(_0x156e81[_0xe924('0x46')],null))[_0xe924('0x25')](respondWithResult(_0x5c0dce,null))['catch'](handleError(_0x5c0dce,null));};exports[_0xe924('0x26')]=function(_0x3c6ff6,_0x1a5483){return db[_0xe924('0x2b')]['find']({'where':{'id':_0x3c6ff6['params']['id']}})['then'](handleEntityNotFound(_0x1a5483,null))['then'](removeEntity(_0x1a5483,null))[_0xe924('0x40')](handleError(_0x1a5483,null));};exports[_0xe924('0x49')]=function(_0x403e6f,_0x58ea5f){return db[_0xe924('0x2b')][_0xe924('0x26')]({'where':{'id':_0x403e6f[_0xe924('0x2e')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0xe924('0x25')](respondWithResult(_0x58ea5f,0xcc))[_0xe924('0x40')](handleError(_0x58ea5f,null));};exports[_0xe924('0x4a')]=function(_0x222f09,_0x9e8e67,_0x183b27){return db[_0xe924('0x4b')][_0xe924('0x4c')]({'where':{'id':_0x222f09[_0xe924('0x48')]['id']}})[_0xe924('0x25')](handleEntityNotFound(_0x9e8e67,null))[_0xe924('0x25')](function(_0x3fe4ec){if(_0x3fe4ec){return db[_0xe924('0x4d')][_0xe924('0x4e')](function(_0x4297e0){return db[_0xe924('0x2b')]['destroy']({'where':{'CustomReportId':_0x222f09[_0xe924('0x48')]['id']},'transaction':_0x4297e0})[_0xe924('0x25')](function(_0x426a18){var _0x5b4a33=_[_0xe924('0x2a')](_0x222f09['body'],function(_0x25e951){delete _0x25e951['id'];_0x25e951[_0xe924('0x4f')]=_0x222f09[_0xe924('0x48')]['id'];return _0x25e951;});return db[_0xe924('0x2b')][_0xe924('0x47')](_0x5b4a33,{'transaction':_0x4297e0});});})[_0xe924('0x25')](function(){return db['AnalyticFieldReport'][_0xe924('0x50')]({'where':{'CustomReportId':_0x222f09['params']['id']}});});}})[_0xe924('0x25')](respondWithResult(_0x9e8e67,null))[_0xe924('0x40')](handleError(_0x9e8e67,null));}; \ No newline at end of file +var _0x2fa7=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','bulkCreate','destroy','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','rimraf','zip-dir','request-promise','moment'];(function(_0x169282,_0x434986){var _0xceaf0a=function(_0x845141){while(--_0x845141){_0x169282['push'](_0x169282['shift']());}};_0xceaf0a(++_0x434986);}(_0x2fa7,0x1aa));var _0x72fa=function(_0x58085f,_0x51f950){_0x58085f=_0x58085f-0x0;var _0x4ec671=_0x2fa7[_0x58085f];return _0x4ec671;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x72fa('0x0'));var zipdir=require(_0x72fa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x72fa('0x2'));var moment=require(_0x72fa('0x3'));var BPromise=require(_0x72fa('0x4'));var Mustache=require(_0x72fa('0x5'));var util=require('util');var path=require(_0x72fa('0x6'));var sox=require('sox');var csv=require(_0x72fa('0x7'));var ejs=require(_0x72fa('0x8'));var fs=require('fs');var fs_extra=require(_0x72fa('0x9'));var _=require(_0x72fa('0xa'));var squel=require(_0x72fa('0xb'));var crypto=require('crypto');var jsforce=require(_0x72fa('0xc'));var deskjs=require(_0x72fa('0xd'));var toCsv=require(_0x72fa('0x7'));var querystring=require('querystring');var Papa=require(_0x72fa('0xe'));var Redis=require(_0x72fa('0xf'));var authService=require(_0x72fa('0x10'));var qs=require(_0x72fa('0x11'));var as=require(_0x72fa('0x12'));var hardwareService=require(_0x72fa('0x13'));var logger=require(_0x72fa('0x14'))(_0x72fa('0x15'));var utils=require('../../config/utils');var config=require(_0x72fa('0x16'));var licenseUtil=require(_0x72fa('0x17'));var db=require(_0x72fa('0x18'))['db'];function respondWithStatusCode(_0x5a3797,_0x57af88){_0x57af88=_0x57af88||0xcc;return function(_0x440e9a){if(_0x440e9a){return _0x5a3797['sendStatus'](_0x57af88);}return _0x5a3797[_0x72fa('0x19')](_0x57af88)[_0x72fa('0x1a')]();};}function respondWithResult(_0x4455ce,_0xa2cd02){_0xa2cd02=_0xa2cd02||0xc8;return function(_0x4466bd){if(_0x4466bd){return _0x4455ce[_0x72fa('0x19')](_0xa2cd02)[_0x72fa('0x1b')](_0x4466bd);}};}function respondWithFilteredResult(_0x112c1d,_0x20724a){return function(_0x352191){if(_0x352191){var _0x20ac7f=typeof _0x20724a[_0x72fa('0x1c')]===_0x72fa('0x1d')&&typeof _0x20724a[_0x72fa('0x1e')]==='undefined';var _0x390472=_0x352191['count'];var _0x252a20=_0x20ac7f?0x0:_0x20724a[_0x72fa('0x1c')];var _0x16625e=_0x20ac7f?_0x352191[_0x72fa('0x1f')]:_0x20724a[_0x72fa('0x1c')]+_0x20724a[_0x72fa('0x1e')];var _0x1ace33;if(_0x16625e>=_0x390472){_0x16625e=_0x390472;_0x1ace33=0xc8;}else{_0x1ace33=0xce;}_0x112c1d['status'](_0x1ace33);return _0x112c1d[_0x72fa('0x20')](_0x72fa('0x21'),_0x252a20+'-'+_0x16625e+'/'+_0x390472)[_0x72fa('0x1b')](_0x352191);}return null;};}function patchUpdates(_0x16534e){return function(_0x4999c7){try{jsonpatch[_0x72fa('0x22')](_0x4999c7,_0x16534e,!![]);}catch(_0x56613e){return BPromise[_0x72fa('0x23')](_0x56613e);}return _0x4999c7[_0x72fa('0x24')]();};}function saveUpdates(_0x5d0485,_0x3d1ed0){return function(_0xea9818){if(_0xea9818){return _0xea9818[_0x72fa('0x25')](_0x5d0485)[_0x72fa('0x26')](function(_0x341e08){return _0x341e08;});}return null;};}function removeEntity(_0x13542f,_0x20b44f){return function(_0x1cd657){if(_0x1cd657){return _0x1cd657['destroy']()[_0x72fa('0x26')](function(){_0x13542f['status'](0xcc)[_0x72fa('0x1a')]();});}};}function handleEntityNotFound(_0x4ec447,_0x32f22c){return function(_0x1c8e59){if(!_0x1c8e59){_0x4ec447[_0x72fa('0x27')](0x194);}return _0x1c8e59;};}function handleError(_0x54b359,_0x949fcd){_0x949fcd=_0x949fcd||0x1f4;return function(_0x51746f){logger[_0x72fa('0x28')](_0x51746f[_0x72fa('0x29')]);if(_0x51746f[_0x72fa('0x2a')]){delete _0x51746f[_0x72fa('0x2a')];}_0x54b359[_0x72fa('0x19')](_0x949fcd)['send'](_0x51746f);};}exports[_0x72fa('0x2b')]=function(_0x227fa1,_0x205b5b){var _0x14a01f={},_0x1abee4={},_0x593620={'count':0x0,'rows':[]};var _0x4bc57f=_[_0x72fa('0x2c')](db[_0x72fa('0x2d')][_0x72fa('0x2e')],function(_0x5e1e49){return{'name':_0x5e1e49[_0x72fa('0x2f')],'type':_0x5e1e49['type'][_0x72fa('0x30')]};});_0x1abee4[_0x72fa('0x31')]=_[_0x72fa('0x2c')](_0x4bc57f,'name');_0x1abee4[_0x72fa('0x32')]=_['keys'](_0x227fa1[_0x72fa('0x32')]);_0x1abee4[_0x72fa('0x33')]=_[_0x72fa('0x34')](_0x1abee4[_0x72fa('0x31')],_0x1abee4[_0x72fa('0x32')]);_0x14a01f['attributes']=_[_0x72fa('0x34')](_0x1abee4[_0x72fa('0x31')],qs[_0x72fa('0x35')](_0x227fa1[_0x72fa('0x32')][_0x72fa('0x35')]));_0x14a01f[_0x72fa('0x36')]=_0x14a01f['attributes']['length']?_0x14a01f[_0x72fa('0x36')]:_0x1abee4[_0x72fa('0x31')];if(!_0x227fa1['query'][_0x72fa('0x37')]('nolimit')){_0x14a01f['limit']=qs['limit'](_0x227fa1[_0x72fa('0x32')][_0x72fa('0x1e')]);_0x14a01f[_0x72fa('0x1c')]=qs['offset'](_0x227fa1[_0x72fa('0x32')][_0x72fa('0x1c')]);}_0x14a01f[_0x72fa('0x38')]=qs['sort'](_0x227fa1[_0x72fa('0x32')][_0x72fa('0x39')]);_0x14a01f[_0x72fa('0x3a')]=qs[_0x72fa('0x33')](_[_0x72fa('0x3b')](_0x227fa1['query'],_0x1abee4['filters']),_0x4bc57f);if(_0x227fa1['query'][_0x72fa('0x3c')]){_0x14a01f[_0x72fa('0x3a')]=_[_0x72fa('0x3d')](_0x14a01f[_0x72fa('0x3a')],{'$or':_[_0x72fa('0x2c')](_0x4bc57f,function(_0x3fd15c){if(_0x3fd15c[_0x72fa('0x3e')]!=='VIRTUAL'){var _0x6b1f5c={};_0x6b1f5c[_0x3fd15c[_0x72fa('0x2a')]]={'$like':'%'+_0x227fa1[_0x72fa('0x32')][_0x72fa('0x3c')]+'%'};return _0x6b1f5c;}})});}_0x14a01f=_['merge']({},_0x14a01f,_0x227fa1['options']);var _0x535e38={'where':_0x14a01f[_0x72fa('0x3a')]};return db[_0x72fa('0x2d')][_0x72fa('0x1f')](_0x535e38)[_0x72fa('0x26')](function(_0x305052){_0x593620[_0x72fa('0x1f')]=_0x305052;if(_0x227fa1[_0x72fa('0x32')][_0x72fa('0x3f')]){_0x14a01f[_0x72fa('0x40')]=[{'all':!![]}];}return db[_0x72fa('0x2d')][_0x72fa('0x41')](_0x14a01f);})[_0x72fa('0x26')](function(_0x2f84aa){_0x593620[_0x72fa('0x42')]=_0x2f84aa;return _0x593620;})[_0x72fa('0x26')](respondWithFilteredResult(_0x205b5b,_0x14a01f))[_0x72fa('0x43')](handleError(_0x205b5b,null));};exports[_0x72fa('0x44')]=function(_0x2bcdd,_0x816b92){var _0x28fe90={'raw':![],'where':{'id':_0x2bcdd[_0x72fa('0x45')]['id']}},_0x559f5a={};_0x559f5a[_0x72fa('0x31')]=_[_0x72fa('0x46')](db[_0x72fa('0x2d')][_0x72fa('0x2e')]);_0x559f5a[_0x72fa('0x32')]=_['keys'](_0x2bcdd[_0x72fa('0x32')]);_0x559f5a[_0x72fa('0x33')]=_[_0x72fa('0x34')](_0x559f5a[_0x72fa('0x31')],_0x559f5a[_0x72fa('0x32')]);_0x28fe90[_0x72fa('0x36')]=_[_0x72fa('0x34')](_0x559f5a[_0x72fa('0x31')],qs['fields'](_0x2bcdd['query'][_0x72fa('0x35')]));_0x28fe90['attributes']=_0x28fe90[_0x72fa('0x36')][_0x72fa('0x47')]?_0x28fe90[_0x72fa('0x36')]:_0x559f5a['model'];if(_0x2bcdd[_0x72fa('0x32')][_0x72fa('0x3f')]){_0x28fe90[_0x72fa('0x40')]=[{'all':!![]}];}_0x28fe90=_['merge']({},_0x28fe90,_0x2bcdd[_0x72fa('0x48')]);return db[_0x72fa('0x2d')][_0x72fa('0x49')](_0x28fe90)[_0x72fa('0x26')](handleEntityNotFound(_0x816b92,null))[_0x72fa('0x26')](respondWithResult(_0x816b92,null))['catch'](handleError(_0x816b92,null));};exports['create']=function(_0x3916b3,_0x5aa661){return db[_0x72fa('0x2d')][_0x72fa('0x4a')](_0x3916b3[_0x72fa('0x4b')],{})['then'](respondWithResult(_0x5aa661,0xc9))[_0x72fa('0x43')](handleError(_0x5aa661,null));};exports[_0x72fa('0x4c')]=function(_0x1e91f1,_0x180c88){return db[_0x72fa('0x2d')][_0x72fa('0x4c')](_0x1e91f1[_0x72fa('0x4b')],{'raw':![],'individualHooks':!![]})[_0x72fa('0x26')](respondWithResult(_0x180c88,0xc9))[_0x72fa('0x43')](handleError(_0x180c88,null));};exports[_0x72fa('0x25')]=function(_0x3c0f86,_0x3dc36c){if(_0x3c0f86[_0x72fa('0x4b')]['id']){delete _0x3c0f86['body']['id'];}return db[_0x72fa('0x2d')][_0x72fa('0x49')]({'where':{'id':_0x3c0f86['params']['id']}})[_0x72fa('0x26')](handleEntityNotFound(_0x3dc36c,null))[_0x72fa('0x26')](saveUpdates(_0x3c0f86['body'],null))[_0x72fa('0x26')](respondWithResult(_0x3dc36c,null))[_0x72fa('0x43')](handleError(_0x3dc36c,null));};exports[_0x72fa('0x4d')]=function(_0x425d4d,_0x11f8ab){return db[_0x72fa('0x2d')]['find']({'where':{'id':_0x425d4d[_0x72fa('0x45')]['id']}})[_0x72fa('0x26')](handleEntityNotFound(_0x11f8ab,null))[_0x72fa('0x26')](removeEntity(_0x11f8ab,null))[_0x72fa('0x43')](handleError(_0x11f8ab,null));};exports[_0x72fa('0x4e')]=function(_0x2e5e4c,_0x1dcffe){return db[_0x72fa('0x2d')][_0x72fa('0x4d')]({'where':{'id':_0x2e5e4c['query'][_0x72fa('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0x72fa('0x26')](respondWithResult(_0x1dcffe,0xcc))[_0x72fa('0x43')](handleError(_0x1dcffe,null));};exports[_0x72fa('0x50')]=function(_0x306112,_0x48e5e7,_0xe03305){return db[_0x72fa('0x51')][_0x72fa('0x52')]({'where':{'id':_0x306112['params']['id']}})[_0x72fa('0x26')](handleEntityNotFound(_0x48e5e7,null))[_0x72fa('0x26')](function(_0x1b8cf3){if(_0x1b8cf3){return db[_0x72fa('0x53')][_0x72fa('0x54')](function(_0x4a4120){return db[_0x72fa('0x2d')][_0x72fa('0x4d')]({'where':{'CustomReportId':_0x306112[_0x72fa('0x45')]['id']},'transaction':_0x4a4120})[_0x72fa('0x26')](function(_0x7ec0af){var _0x1ff8f3=_[_0x72fa('0x2c')](_0x306112[_0x72fa('0x4b')],function(_0x1c823c){delete _0x1c823c['id'];_0x1c823c[_0x72fa('0x55')]=_0x306112[_0x72fa('0x45')]['id'];return _0x1c823c;});return db[_0x72fa('0x2d')][_0x72fa('0x4c')](_0x1ff8f3,{'transaction':_0x4a4120});});})[_0x72fa('0x26')](function(){return db[_0x72fa('0x2d')][_0x72fa('0x41')]({'where':{'CustomReportId':_0x306112['params']['id']}});});}})[_0x72fa('0x26')](respondWithResult(_0x48e5e7,null))[_0x72fa('0x43')](handleError(_0x48e5e7,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ebe8ebc..e207777 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 _0x53a3=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define'];(function(_0x56bcaa,_0x123fb1){var _0x29ee20=function(_0x1c1e20){while(--_0x1c1e20){_0x56bcaa['push'](_0x56bcaa['shift']());}};_0x29ee20(++_0x123fb1);}(_0x53a3,0xf0));var _0x353a=function(_0x3217d3,_0xf66fcf){_0x3217d3=_0x3217d3-0x0;var _0x260f43=_0x53a3[_0x3217d3];return _0x260f43;};'use strict';var _=require(_0x353a('0x0'));var util=require('util');var logger=require(_0x353a('0x1'))(_0x353a('0x2'));var moment=require(_0x353a('0x3'));var BPromise=require(_0x353a('0x4'));var rp=require(_0x353a('0x5'));var fs=require('fs');var path=require(_0x353a('0x6'));var rimraf=require(_0x353a('0x7'));var config=require(_0x353a('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x3f8b6e,_0xa61563){return _0x3f8b6e[_0x353a('0x9')]('AnalyticFieldReport',attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x768b=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','api','moment','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x768b,0x7f));var _0xb768=function(_0x5c8c24,_0x4f81bb){_0x5c8c24=_0x5c8c24-0x0;var _0x4570ce=_0x768b[_0x5c8c24];return _0x4570ce;};'use strict';var _=require('lodash');var util=require(_0xb768('0x0'));var logger=require('../../config/logger')(_0xb768('0x1'));var moment=require(_0xb768('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb768('0x3'));var rimraf=require(_0xb768('0x4'));var config=require(_0xb768('0x5'));var attributes=require(_0xb768('0x6'));module[_0xb768('0x7')]=function(_0x280acc,_0x1c285f){return _0x280acc[_0xb768('0x8')](_0xb768('0x9'),attributes,{'tableName':_0xb768('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 95a6072..7d38d43 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 _0xcefd=['../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcefd,0x126));var _0xdcef=function(_0x1ce595,_0x1069cb){_0x1ce595=_0x1ce595-0x0;var _0x525dfe=_0xcefd[_0x1ce595];return _0x525dfe;};'use strict';var _=require(_0xdcef('0x0'));var util=require(_0xdcef('0x1'));var moment=require(_0xdcef('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcef('0x3'));var fs=require('fs');var Redis=require(_0xdcef('0x4'));var db=require(_0xdcef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcef('0x6'))(_0xdcef('0x7'));var config=require(_0xdcef('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdcef('0x9')][_0xdcef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fb1b7,_0x3260fe,_0x53e707){return new BPromise(function(_0x56ee48,_0x8b30d4){return client[_0xdcef('0xb')](_0x3fb1b7,_0x53e707)[_0xdcef('0xc')](function(_0x5d601b){logger[_0xdcef('0xd')](_0xdcef('0xe'),_0x3260fe,_0xdcef('0xf'));logger[_0xdcef('0x10')](_0xdcef('0x11'),_0x3260fe,_0xdcef('0xf'),JSON['stringify'](_0x5d601b));if(_0x5d601b['error']){if(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x13')]===0x1f4){logger['error'](_0xdcef('0xe'),_0x3260fe,_0x5d601b['error']['message']);return _0x8b30d4(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);}logger[_0xdcef('0x12')](_0xdcef('0xe'),_0x3260fe,_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);return _0x56ee48(_0x5d601b[_0xdcef('0x12')][_0xdcef('0x14')]);}else{logger[_0xdcef('0xd')](_0xdcef('0xe'),_0x3260fe,_0xdcef('0xf'));_0x56ee48(_0x5d601b[_0xdcef('0x15')]['message']);}})[_0xdcef('0x16')](function(_0x4dd058){logger[_0xdcef('0x12')](_0xdcef('0xe'),_0x3260fe,_0x4dd058);_0x8b30d4(_0x4dd058);});});} \ No newline at end of file +var _0xc56f=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xc56f,0xd8));var _0xfc56=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xc56f[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfc56('0x0'));var BPromise=require(_0xfc56('0x1'));var rs=require(_0xfc56('0x2'));var fs=require('fs');var Redis=require(_0xfc56('0x3'));var db=require(_0xfc56('0x4'))['db'];var utils=require(_0xfc56('0x5'));var logger=require(_0xfc56('0x6'))('rpc');var config=require(_0xfc56('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfc56('0x8')][_0xfc56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9a3fcb,_0x82f54a,_0x4a699c){return new BPromise(function(_0x21ce4b,_0x54b9e3){return client[_0xfc56('0xa')](_0x9a3fcb,_0x4a699c)[_0xfc56('0xb')](function(_0x26c753){logger['info'](_0xfc56('0xc'),_0x82f54a,_0xfc56('0xd'));logger[_0xfc56('0xe')](_0xfc56('0xf'),_0x82f54a,_0xfc56('0xd'),JSON[_0xfc56('0x10')](_0x26c753));if(_0x26c753['error']){if(_0x26c753[_0xfc56('0x11')][_0xfc56('0x12')]===0x1f4){logger[_0xfc56('0x11')](_0xfc56('0xc'),_0x82f54a,_0x26c753['error'][_0xfc56('0x13')]);return _0x54b9e3(_0x26c753[_0xfc56('0x11')][_0xfc56('0x13')]);}logger[_0xfc56('0x11')](_0xfc56('0xc'),_0x82f54a,_0x26c753[_0xfc56('0x11')]['message']);return _0x21ce4b(_0x26c753[_0xfc56('0x11')][_0xfc56('0x13')]);}else{logger['info'](_0xfc56('0xc'),_0x82f54a,_0xfc56('0xd'));_0x21ce4b(_0x26c753[_0xfc56('0x14')]['message']);}})[_0xfc56('0x15')](function(_0x5e5496){logger[_0xfc56('0x11')]('AnalyticFieldReport,\x20%s,\x20%s',_0x82f54a,_0x5e5496);_0x54b9e3(_0x5e5496);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 78472a3..3304735 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(_0x5be315,_0x3af6cd){var _0x5a1100=function(_0x311287){while(--_0x311287){_0x5be315['push'](_0x5be315['shift']());}};_0x5a1100(++_0x3af6cd);}(_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['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(_0x5accb4,_0x398655){var _0x53f6a6=function(_0x20bea6){while(--_0x20bea6){_0x5accb4['push'](_0x5accb4['shift']());}};_0x53f6a6(++_0x398655);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 36819c7..3382214 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 _0xcbde=['TEXT','sequelize','STRING','name'];(function(_0x269ee8,_0x477226){var _0x4d98bd=function(_0x20d4c4){while(--_0x20d4c4){_0x269ee8['push'](_0x269ee8['shift']());}};_0x4d98bd(++_0x477226);}(_0xcbde,0x141));var _0xecbd=function(_0x30a94a,_0x29a6ef){_0x30a94a=_0x30a94a-0x0;var _0x4c14c6=_0xcbde[_0x30a94a];return _0x4c14c6;};'use strict';var Sequelize=require(_0xecbd('0x0'));module['exports']={'name':{'type':Sequelize[_0xecbd('0x1')],'allowNull':![],'unique':_0xecbd('0x2')},'table':{'type':Sequelize[_0xecbd('0x1')]},'metric':{'type':Sequelize[_0xecbd('0x3')]},'description':{'type':Sequelize[_0xecbd('0x1')]}}; \ No newline at end of file +var _0x58e5=['exports','STRING','name','TEXT','sequelize'];(function(_0x51401a,_0xc9e377){var _0x3175ab=function(_0x4f593d){while(--_0x4f593d){_0x51401a['push'](_0x51401a['shift']());}};_0x3175ab(++_0xc9e377);}(_0x58e5,0xd1));var _0x558e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x58e5[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x558e('0x0'));module[_0x558e('0x1')]={'name':{'type':Sequelize[_0x558e('0x2')],'allowNull':![],'unique':_0x558e('0x3')},'table':{'type':Sequelize[_0x558e('0x2')]},'metric':{'type':Sequelize[_0x558e('0x4')]},'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 1c3d61d..73dfe0f 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 _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x23f543,_0xf1ac51){var _0x3e2fc4=function(_0x3f9aee){while(--_0x3f9aee){_0x23f543['push'](_0x23f543['shift']());}};_0x3e2fc4(++_0xf1ac51);}(_0xe5b3,0x133));var _0x3e5b=function(_0x24abba,_0x48f743){_0x24abba=_0x24abba-0x0;var _0x27afd2=_0xe5b3[_0x24abba];return _0x27afd2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));}; \ No newline at end of file +var _0xa41a=['attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Metrics','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','error','stack','name','send','map','AnalyticMetric','type','key','model','query','keys','intersection','fields'];(function(_0x3f139e,_0x45097c){var _0x165970=function(_0x4d6884){while(--_0x4d6884){_0x3f139e['push'](_0x3f139e['shift']());}};_0x165970(++_0x45097c);}(_0xa41a,0x6b));var _0xaa41=function(_0x219364,_0x180757){_0x219364=_0x219364-0x0;var _0x7dac47=_0xa41a[_0x219364];return _0x7dac47;};'use strict';var emlformat=require(_0xaa41('0x0'));var rimraf=require(_0xaa41('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaa41('0x2'));var rp=require(_0xaa41('0x3'));var moment=require(_0xaa41('0x4'));var BPromise=require(_0xaa41('0x5'));var Mustache=require(_0xaa41('0x6'));var util=require(_0xaa41('0x7'));var path=require(_0xaa41('0x8'));var sox=require(_0xaa41('0x9'));var csv=require('to-csv');var ejs=require(_0xaa41('0xa'));var fs=require('fs');var fs_extra=require(_0xaa41('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaa41('0xc'));var jsforce=require(_0xaa41('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaa41('0xe'));var querystring=require(_0xaa41('0xf'));var Papa=require(_0xaa41('0x10'));var Redis=require(_0xaa41('0x11'));var authService=require(_0xaa41('0x12'));var qs=require(_0xaa41('0x13'));var as=require(_0xaa41('0x14'));var hardwareService=require(_0xaa41('0x15'));var logger=require(_0xaa41('0x16'))('api');var utils=require(_0xaa41('0x17'));var config=require(_0xaa41('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0a54,_0x518b5b){_0x518b5b=_0x518b5b||0xcc;return function(_0x19bd69){if(_0x19bd69){return _0x1d0a54[_0xaa41('0x19')](_0x518b5b);}return _0x1d0a54[_0xaa41('0x1a')](_0x518b5b)[_0xaa41('0x1b')]();};}function respondWithResult(_0x6f9ade,_0x4eaf81){_0x4eaf81=_0x4eaf81||0xc8;return function(_0x1e9d7f){if(_0x1e9d7f){return _0x6f9ade[_0xaa41('0x1a')](_0x4eaf81)[_0xaa41('0x1c')](_0x1e9d7f);}};}function respondWithFilteredResult(_0x1ef7d9,_0x2a6988){return function(_0x2005ae){if(_0x2005ae){var _0x1e1e02=typeof _0x2a6988['offset']===_0xaa41('0x1d')&&typeof _0x2a6988[_0xaa41('0x1e')]===_0xaa41('0x1d');var _0x391b01=_0x2005ae[_0xaa41('0x1f')];var _0xd20ddf=_0x1e1e02?0x0:_0x2a6988[_0xaa41('0x20')];var _0x46e6d3=_0x1e1e02?_0x2005ae[_0xaa41('0x1f')]:_0x2a6988['offset']+_0x2a6988['limit'];var _0x1f502a;if(_0x46e6d3>=_0x391b01){_0x46e6d3=_0x391b01;_0x1f502a=0xc8;}else{_0x1f502a=0xce;}_0x1ef7d9[_0xaa41('0x1a')](_0x1f502a);return _0x1ef7d9[_0xaa41('0x21')]('Content-Range',_0xd20ddf+'-'+_0x46e6d3+'/'+_0x391b01)[_0xaa41('0x1c')](_0x2005ae);}return null;};}function patchUpdates(_0x1f692b){return function(_0x4e768e){try{jsonpatch['apply'](_0x4e768e,_0x1f692b,!![]);}catch(_0x1b1910){return BPromise['reject'](_0x1b1910);}return _0x4e768e[_0xaa41('0x22')]();};}function saveUpdates(_0x209c83,_0x3e2175){return function(_0x1f27f3){if(_0x1f27f3){return _0x1f27f3[_0xaa41('0x23')](_0x209c83)['then'](function(_0x43c430){return _0x43c430;});}return null;};}function removeEntity(_0x43a85c,_0x448a21){return function(_0x21f596){if(_0x21f596){return _0x21f596[_0xaa41('0x24')]()[_0xaa41('0x25')](function(){var _0x5c3074=_0x21f596['get']({'plain':!![]});var _0x16aec5='Metrics';return db['UserProfileResource'][_0xaa41('0x24')]({'where':{'type':_0x16aec5,'resourceId':_0x5c3074['id']}})['then'](function(){return _0x21f596;});})['then'](function(){_0x43a85c[_0xaa41('0x1a')](0xcc)[_0xaa41('0x1b')]();});}};}function handleEntityNotFound(_0x392214,_0x632fd2){return function(_0x3f5272){if(!_0x3f5272){_0x392214[_0xaa41('0x19')](0x194);}return _0x3f5272;};}function handleError(_0x57ef96,_0x30a174){_0x30a174=_0x30a174||0x1f4;return function(_0x1f0275){logger[_0xaa41('0x26')](_0x1f0275[_0xaa41('0x27')]);if(_0x1f0275[_0xaa41('0x28')]){delete _0x1f0275[_0xaa41('0x28')];}_0x57ef96[_0xaa41('0x1a')](_0x30a174)[_0xaa41('0x29')](_0x1f0275);};}exports['index']=function(_0x377add,_0x48b48b){var _0x5dad80={},_0x714537={},_0x1176bd={'count':0x0,'rows':[]};var _0x534a85=_[_0xaa41('0x2a')](db[_0xaa41('0x2b')]['rawAttributes'],function(_0x5022fb){return{'name':_0x5022fb['fieldName'],'type':_0x5022fb[_0xaa41('0x2c')][_0xaa41('0x2d')]};});_0x714537[_0xaa41('0x2e')]=_[_0xaa41('0x2a')](_0x534a85,'name');_0x714537[_0xaa41('0x2f')]=_[_0xaa41('0x30')](_0x377add[_0xaa41('0x2f')]);_0x714537['filters']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],_0x714537[_0xaa41('0x2f')]);_0x5dad80['attributes']=_[_0xaa41('0x31')](_0x714537[_0xaa41('0x2e')],qs['fields'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x5dad80[_0xaa41('0x33')]=_0x5dad80['attributes'][_0xaa41('0x34')]?_0x5dad80['attributes']:_0x714537[_0xaa41('0x2e')];if(!_0x377add[_0xaa41('0x2f')][_0xaa41('0x35')]('nolimit')){_0x5dad80['limit']=qs['limit'](_0x377add[_0xaa41('0x2f')][_0xaa41('0x1e')]);_0x5dad80[_0xaa41('0x20')]=qs[_0xaa41('0x20')](_0x377add['query']['offset']);}_0x5dad80[_0xaa41('0x36')]=qs[_0xaa41('0x37')](_0x377add[_0xaa41('0x2f')][_0xaa41('0x37')]);_0x5dad80[_0xaa41('0x38')]=qs[_0xaa41('0x39')](_[_0xaa41('0x3a')](_0x377add['query'],_0x714537[_0xaa41('0x39')]),_0x534a85);if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]){_0x5dad80[_0xaa41('0x38')]=_['merge'](_0x5dad80['where'],{'$or':_[_0xaa41('0x2a')](_0x534a85,function(_0x275fa3){if(_0x275fa3['type']!==_0xaa41('0x3c')){var _0x563687={};_0x563687[_0x275fa3[_0xaa41('0x28')]]={'$like':'%'+_0x377add[_0xaa41('0x2f')][_0xaa41('0x3b')]+'%'};return _0x563687;}})});}_0x5dad80=_[_0xaa41('0x3d')]({},_0x5dad80,_0x377add[_0xaa41('0x3e')]);var _0x12ba1a={'where':_0x5dad80[_0xaa41('0x38')]};return db[_0xaa41('0x2b')]['count'](_0x12ba1a)[_0xaa41('0x25')](function(_0x2abf39){_0x1176bd[_0xaa41('0x1f')]=_0x2abf39;if(_0x377add[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x5dad80[_0xaa41('0x40')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x5dad80);})[_0xaa41('0x25')](function(_0x4f9086){_0x1176bd[_0xaa41('0x41')]=_0x4f9086;return _0x1176bd;})[_0xaa41('0x25')](respondWithFilteredResult(_0x48b48b,_0x5dad80))[_0xaa41('0x42')](handleError(_0x48b48b,null));};exports[_0xaa41('0x43')]=function(_0x2aac10,_0x10bf09){var _0x2db8d6={'raw':!![],'where':{'id':_0x2aac10[_0xaa41('0x44')]['id']}},_0x5ee74c={};_0x5ee74c['model']=_['keys'](db[_0xaa41('0x2b')]['rawAttributes']);_0x5ee74c['query']=_['keys'](_0x2aac10[_0xaa41('0x2f')]);_0x5ee74c['filters']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],_0x5ee74c['query']);_0x2db8d6['attributes']=_[_0xaa41('0x31')](_0x5ee74c[_0xaa41('0x2e')],qs[_0xaa41('0x32')](_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x32')]));_0x2db8d6[_0xaa41('0x33')]=_0x2db8d6[_0xaa41('0x33')][_0xaa41('0x34')]?_0x2db8d6[_0xaa41('0x33')]:_0x5ee74c['model'];if(_0x2aac10[_0xaa41('0x2f')][_0xaa41('0x3f')]){_0x2db8d6[_0xaa41('0x40')]=[{'all':!![]}];}_0x2db8d6=_[_0xaa41('0x3d')]({},_0x2db8d6,_0x2aac10[_0xaa41('0x3e')]);return db[_0xaa41('0x2b')]['find'](_0x2db8d6)[_0xaa41('0x25')](handleEntityNotFound(_0x10bf09,null))[_0xaa41('0x25')](respondWithResult(_0x10bf09,null))[_0xaa41('0x42')](handleError(_0x10bf09,null));};exports[_0xaa41('0x45')]=function(_0x57d1f6,_0x23bc61){return db['AnalyticMetric']['create'](_0x57d1f6[_0xaa41('0x46')],{})[_0xaa41('0x25')](function(_0x3e16ef){var _0x4ca114=_0x57d1f6[_0xaa41('0x47')][_0xaa41('0x48')]({'plain':!![]});if(!_0x4ca114)throw new Error(_0xaa41('0x49'));if(_0x4ca114['role']===_0xaa41('0x47')){var _0x3c4f24=_0x3e16ef[_0xaa41('0x48')]({'plain':!![]});var _0x1378f9=_0xaa41('0x4a');return db[_0xaa41('0x4b')][_0xaa41('0x4c')]({'where':{'name':_0x1378f9,'userProfileId':_0x4ca114[_0xaa41('0x4d')]},'raw':!![]})['then'](function(_0x9f0a81){if(_0x9f0a81&&_0x9f0a81['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa41('0x45')]({'name':_0x3c4f24[_0xaa41('0x28')],'resourceId':_0x3c4f24['id'],'type':_0x9f0a81[_0xaa41('0x28')],'sectionId':_0x9f0a81['id']},{})[_0xaa41('0x25')](function(){return _0x3e16ef;});}else{return _0x3e16ef;}})[_0xaa41('0x42')](function(_0x288db3){logger[_0xaa41('0x26')](_0xaa41('0x4e'),_0x288db3);throw _0x288db3;});}return _0x3e16ef;})['then'](respondWithResult(_0x23bc61,0xc9))[_0xaa41('0x42')](handleError(_0x23bc61,null));};exports[_0xaa41('0x23')]=function(_0x1d518f,_0x4f9e92){if(_0x1d518f[_0xaa41('0x46')]['id']){delete _0x1d518f[_0xaa41('0x46')]['id'];}return db['AnalyticMetric'][_0xaa41('0x4c')]({'where':{'id':_0x1d518f[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x4f9e92,null))['then'](saveUpdates(_0x1d518f[_0xaa41('0x46')],null))[_0xaa41('0x25')](respondWithResult(_0x4f9e92,null))['catch'](handleError(_0x4f9e92,null));};exports['destroy']=function(_0x3745ed,_0x3cd14f){return db[_0xaa41('0x2b')]['find']({'where':{'id':_0x3745ed[_0xaa41('0x44')]['id']}})[_0xaa41('0x25')](handleEntityNotFound(_0x3cd14f,null))[_0xaa41('0x25')](removeEntity(_0x3cd14f,null))[_0xaa41('0x42')](handleError(_0x3cd14f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 9462d7f..6598b10 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 _0x6333=['./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','api','bluebird','request-promise','rimraf'];(function(_0x5392a9,_0x3306d0){var _0x13460f=function(_0xb1b3d9){while(--_0xb1b3d9){_0x5392a9['push'](_0x5392a9['shift']());}};_0x13460f(++_0x3306d0);}(_0x6333,0x83));var _0x3633=function(_0x7b7a7e,_0x567124){_0x7b7a7e=_0x7b7a7e-0x0;var _0x2f9373=_0x6333[_0x7b7a7e];return _0x2f9373;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3633('0x0'));var moment=require('moment');var BPromise=require(_0x3633('0x1'));var rp=require(_0x3633('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3633('0x3'));var config=require('../../config/environment');var attributes=require(_0x3633('0x4'));module[_0x3633('0x5')]=function(_0x566b21,_0x547e6d){return _0x566b21[_0x3633('0x6')](_0x3633('0x7'),attributes,{'tableName':_0x3633('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b8e=['exports','define','AnalyticMetric','analytics_metrics','lodash','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x4e8cd6,_0x23ac39){var _0x2424d4=function(_0x461852){while(--_0x461852){_0x4e8cd6['push'](_0x4e8cd6['shift']());}};_0x2424d4(++_0x23ac39);}(_0x9b8e,0x158));var _0xe9b8=function(_0x5cc66a,_0x539f5e){_0x5cc66a=_0x5cc66a-0x0;var _0x4cc3d7=_0x9b8e[_0x5cc66a];return _0x4cc3d7;};'use strict';var _=require(_0xe9b8('0x0'));var util=require('util');var logger=require(_0xe9b8('0x1'))(_0xe9b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe9b8('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9b8('0x4'));var config=require(_0xe9b8('0x5'));var attributes=require('./analyticMetric.attributes');module[_0xe9b8('0x6')]=function(_0x3d24e3,_0x3f6b50){return _0x3d24e3[_0xe9b8('0x7')](_0xe9b8('0x8'),attributes,{'tableName':_0xe9b8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 167b8f3..3ee93e9 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 _0xec95=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request'];(function(_0x5b27da,_0x4a6532){var _0x3254f4=function(_0x4194c6){while(--_0x4194c6){_0x5b27da['push'](_0x5b27da['shift']());}};_0x3254f4(++_0x4a6532);}(_0xec95,0xa0));var _0x5ec9=function(_0x3a4f18,_0x1af741){_0x3a4f18=_0x3a4f18-0x0;var _0x4c20fc=_0xec95[_0x3a4f18];return _0x4c20fc;};'use strict';var _=require(_0x5ec9('0x0'));var util=require(_0x5ec9('0x1'));var moment=require(_0x5ec9('0x2'));var BPromise=require(_0x5ec9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5ec9('0x4'));var db=require(_0x5ec9('0x5'))['db'];var utils=require(_0x5ec9('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5ec9('0x7'));var jayson=require(_0x5ec9('0x8'));var client=jayson['client'][_0x5ec9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2181f8,_0x467f29,_0x1746bc){return new BPromise(function(_0x3babde,_0x46ef45){return client[_0x5ec9('0xa')](_0x2181f8,_0x1746bc)[_0x5ec9('0xb')](function(_0x526402){logger[_0x5ec9('0xc')](_0x5ec9('0xd'),_0x467f29,_0x5ec9('0xe'));logger['debug']('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x467f29,'request\x20sent',JSON[_0x5ec9('0xf')](_0x526402));if(_0x526402[_0x5ec9('0x10')]){if(_0x526402[_0x5ec9('0x10')][_0x5ec9('0x11')]===0x1f4){logger[_0x5ec9('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x467f29,_0x526402[_0x5ec9('0x10')][_0x5ec9('0x12')]);return _0x46ef45(_0x526402['error']['message']);}logger[_0x5ec9('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x467f29,_0x526402[_0x5ec9('0x10')]['message']);return _0x3babde(_0x526402[_0x5ec9('0x10')][_0x5ec9('0x12')]);}else{logger[_0x5ec9('0xc')](_0x5ec9('0xd'),_0x467f29,_0x5ec9('0xe'));_0x3babde(_0x526402['result'][_0x5ec9('0x12')]);}})['catch'](function(_0x5f44aa){logger[_0x5ec9('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x467f29,_0x5f44aa);_0x46ef45(_0x5f44aa);});});} \ No newline at end of file +var _0x0993=['then','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','AnalyticMetric,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x0993,0x12b));var _0x3099=function(_0xece529,_0xef79a8){_0xece529=_0xece529-0x0;var _0x20abcb=_0x0993[_0xece529];return _0x20abcb;};'use strict';var _=require('lodash');var util=require(_0x3099('0x0'));var moment=require(_0x3099('0x1'));var BPromise=require(_0x3099('0x2'));var rs=require(_0x3099('0x3'));var fs=require('fs');var Redis=require(_0x3099('0x4'));var db=require(_0x3099('0x5'))['db'];var utils=require(_0x3099('0x6'));var logger=require(_0x3099('0x7'))('rpc');var config=require(_0x3099('0x8'));var jayson=require(_0x3099('0x9'));var client=jayson[_0x3099('0xa')][_0x3099('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46b8ad,_0x5e528b,_0x5cabbe){return new BPromise(function(_0x5af45c,_0x524539){return client[_0x3099('0xc')](_0x46b8ad,_0x5cabbe)[_0x3099('0xd')](function(_0x360a40){logger[_0x3099('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x5e528b,_0x3099('0xf'));logger[_0x3099('0x10')](_0x3099('0x11'),_0x5e528b,_0x3099('0xf'),JSON[_0x3099('0x12')](_0x360a40));if(_0x360a40[_0x3099('0x13')]){if(_0x360a40[_0x3099('0x13')]['code']===0x1f4){logger['error'](_0x3099('0x14'),_0x5e528b,_0x360a40[_0x3099('0x13')]['message']);return _0x524539(_0x360a40[_0x3099('0x13')][_0x3099('0x15')]);}logger[_0x3099('0x13')](_0x3099('0x14'),_0x5e528b,_0x360a40[_0x3099('0x13')][_0x3099('0x15')]);return _0x5af45c(_0x360a40[_0x3099('0x13')]['message']);}else{logger[_0x3099('0xe')](_0x3099('0x14'),_0x5e528b,_0x3099('0xf'));_0x5af45c(_0x360a40[_0x3099('0x16')][_0x3099('0x15')]);}})[_0x3099('0x17')](function(_0x2d22e5){logger[_0x3099('0x13')](_0x3099('0x14'),_0x5e528b,_0x2d22e5);_0x524539(_0x2d22e5);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 0d0f05a..614344a 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 _0x444e=['isAuthenticated','index','/:id','show','create','put','update','delete','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get'];(function(_0x163f58,_0x1c8ae4){var _0x472ed9=function(_0xca7deb){while(--_0xca7deb){_0x163f58['push'](_0x163f58['shift']());}};_0x472ed9(++_0x1c8ae4);}(_0x444e,0xe8));var _0xe444=function(_0x1a0383,_0x44ba85){_0x1a0383=_0x1a0383-0x0;var _0x22583f=_0x444e[_0x1a0383];return _0x22583f;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['post']('/',auth[_0xe444('0x8')](),controller[_0xe444('0xc')]);router[_0xe444('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xe444('0xe')]);router[_0xe444('0xf')]('/:id',auth[_0xe444('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc3a8=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x4ee35d,_0x2b6c40){var _0x534e29=function(_0x52dc86){while(--_0x52dc86){_0x4ee35d['push'](_0x4ee35d['shift']());}};_0x534e29(++_0x2b6c40);}(_0xc3a8,0xe8));var _0x8c3a=function(_0x1f5974,_0x11540c){_0x1f5974=_0x1f5974-0x0;var _0x5cb353=_0xc3a8[_0x1f5974];return _0x5cb353;};'use strict';var multer=require(_0x8c3a('0x0'));var util=require(_0x8c3a('0x1'));var path=require(_0x8c3a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8c3a('0x3'));var router=express['Router']();var fs_extra=require(_0x8c3a('0x4'));var auth=require(_0x8c3a('0x5'));var interaction=require(_0x8c3a('0x6'));var config=require(_0x8c3a('0x7'));var controller=require('./analyticMetric.controller');router[_0x8c3a('0x8')]('/',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0xa')]);router[_0x8c3a('0x8')](_0x8c3a('0xb'),auth[_0x8c3a('0x9')](),controller['show']);router[_0x8c3a('0xc')]('/',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0xd')]);router[_0x8c3a('0xe')](_0x8c3a('0xb'),auth['isAuthenticated'](),controller[_0x8c3a('0xf')]);router[_0x8c3a('0x10')]('/:id',auth[_0x8c3a('0x9')](),controller[_0x8c3a('0x11')]);module[_0x8c3a('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 81cb79a..9f23b75 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 _0xc7be=['sequelize','exports','TEXT'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc7be,0x78));var _0xec7b=function(_0x5775c4,_0xa84fd5){_0x5775c4=_0x5775c4-0x0;var _0x536b1c=_0xc7be[_0x5775c4];return _0x536b1c;};'use strict';var Sequelize=require(_0xec7b('0x0'));module[_0xec7b('0x1')]={'tree':{'type':Sequelize[_0xec7b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xeb88=['exports'];(function(_0x5cc3b6,_0x249e4f){var _0x3ea2e0=function(_0x8ab600){while(--_0x8ab600){_0x5cc3b6['push'](_0x5cc3b6['shift']());}};_0x3ea2e0(++_0x249e4f);}(_0xeb88,0x1b7));var _0x8eb8=function(_0x135865,_0x33d810){_0x135865=_0x135865-0x0;var _0xdeb434=_0xeb88[_0x135865];return _0xdeb434;};'use strict';var Sequelize=require('sequelize');module[_0x8eb8('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index ee249fb..bdc39a7 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 _0x7ee6=['api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','query','filters','intersection','attributes','fields','length','model','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','catch','show','params','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x2584c0,_0xb31a75){var _0x314c0b=function(_0x539f7d){while(--_0x539f7d){_0x2584c0['push'](_0x2584c0['shift']());}};_0x314c0b(++_0xb31a75);}(_0x7ee6,0x108));var _0x67ee=function(_0x1542df,_0x363d0d){_0x1542df=_0x1542df-0x0;var _0x338f0b=_0x7ee6[_0x1542df];return _0x338f0b;};'use strict';var emlformat=require(_0x67ee('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67ee('0x1'));var jsonpatch=require(_0x67ee('0x2'));var rp=require(_0x67ee('0x3'));var moment=require('moment');var BPromise=require(_0x67ee('0x4'));var Mustache=require(_0x67ee('0x5'));var util=require('util');var path=require(_0x67ee('0x6'));var sox=require(_0x67ee('0x7'));var csv=require(_0x67ee('0x8'));var ejs=require(_0x67ee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x67ee('0xa'));var squel=require(_0x67ee('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x67ee('0xc'));var toCsv=require(_0x67ee('0x8'));var querystring=require(_0x67ee('0xd'));var Papa=require(_0x67ee('0xe'));var Redis=require(_0x67ee('0xf'));var authService=require(_0x67ee('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x67ee('0x11'));var hardwareService=require(_0x67ee('0x12'));var logger=require(_0x67ee('0x13'))(_0x67ee('0x14'));var utils=require(_0x67ee('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x427bc9,_0x39e31d){_0x39e31d=_0x39e31d||0xcc;return function(_0x3f112){if(_0x3f112){return _0x427bc9[_0x67ee('0x16')](_0x39e31d);}return _0x427bc9[_0x67ee('0x17')](_0x39e31d)[_0x67ee('0x18')]();};}function respondWithResult(_0x2c9b64,_0xa1a8f8){_0xa1a8f8=_0xa1a8f8||0xc8;return function(_0xb62125){if(_0xb62125){return _0x2c9b64[_0x67ee('0x17')](_0xa1a8f8)[_0x67ee('0x19')](_0xb62125);}};}function respondWithFilteredResult(_0x4a48d3,_0x480a11){return function(_0x23b829){if(_0x23b829){var _0xd4cd3c=typeof _0x480a11[_0x67ee('0x1a')]===_0x67ee('0x1b')&&typeof _0x480a11[_0x67ee('0x1c')]===_0x67ee('0x1b');var _0x2134c3=_0x23b829[_0x67ee('0x1d')];var _0x52df4e=_0xd4cd3c?0x0:_0x480a11[_0x67ee('0x1a')];var _0x2490c2=_0xd4cd3c?_0x23b829[_0x67ee('0x1d')]:_0x480a11[_0x67ee('0x1a')]+_0x480a11['limit'];var _0x158596;if(_0x2490c2>=_0x2134c3){_0x2490c2=_0x2134c3;_0x158596=0xc8;}else{_0x158596=0xce;}_0x4a48d3['status'](_0x158596);return _0x4a48d3[_0x67ee('0x1e')](_0x67ee('0x1f'),_0x52df4e+'-'+_0x2490c2+'/'+_0x2134c3)[_0x67ee('0x19')](_0x23b829);}return null;};}function patchUpdates(_0x4ac07f){return function(_0x1d2a58){try{jsonpatch[_0x67ee('0x20')](_0x1d2a58,_0x4ac07f,!![]);}catch(_0x18cc3e){return BPromise[_0x67ee('0x21')](_0x18cc3e);}return _0x1d2a58[_0x67ee('0x22')]();};}function saveUpdates(_0x4ec461,_0x45c468){return function(_0x5729a0){if(_0x5729a0){return _0x5729a0[_0x67ee('0x23')](_0x4ec461)[_0x67ee('0x24')](function(_0x40e731){return _0x40e731;});}return null;};}function removeEntity(_0x3f80af,_0x449706){return function(_0x1338a7){if(_0x1338a7){return _0x1338a7[_0x67ee('0x25')]()[_0x67ee('0x24')](function(){_0x3f80af[_0x67ee('0x17')](0xcc)[_0x67ee('0x18')]();});}};}function handleEntityNotFound(_0x51fb5f,_0x2ba5b3){return function(_0x28056a){if(!_0x28056a){_0x51fb5f[_0x67ee('0x16')](0x194);}return _0x28056a;};}function handleError(_0x268989,_0x586b1b){_0x586b1b=_0x586b1b||0x1f4;return function(_0x31565f){logger[_0x67ee('0x26')](_0x31565f[_0x67ee('0x27')]);if(_0x31565f[_0x67ee('0x28')]){delete _0x31565f[_0x67ee('0x28')];}_0x268989[_0x67ee('0x17')](_0x586b1b)[_0x67ee('0x29')](_0x31565f);};}exports[_0x67ee('0x2a')]=function(_0xe0cb5b,_0x5898a8){var _0x2fe744={},_0x4660d7={},_0x3faae2={'count':0x0,'rows':[]};var _0x4f74b9=_[_0x67ee('0x2b')](db[_0x67ee('0x2c')][_0x67ee('0x2d')],function(_0x2a2387){return{'name':_0x2a2387['fieldName'],'type':_0x2a2387[_0x67ee('0x2e')][_0x67ee('0x2f')]};});_0x4660d7['model']=_[_0x67ee('0x2b')](_0x4f74b9,_0x67ee('0x28'));_0x4660d7[_0x67ee('0x30')]=_['keys'](_0xe0cb5b[_0x67ee('0x30')]);_0x4660d7[_0x67ee('0x31')]=_[_0x67ee('0x32')](_0x4660d7['model'],_0x4660d7[_0x67ee('0x30')]);_0x2fe744[_0x67ee('0x33')]=_[_0x67ee('0x32')](_0x4660d7['model'],qs[_0x67ee('0x34')](_0xe0cb5b['query'][_0x67ee('0x34')]));_0x2fe744[_0x67ee('0x33')]=_0x2fe744[_0x67ee('0x33')][_0x67ee('0x35')]?_0x2fe744[_0x67ee('0x33')]:_0x4660d7[_0x67ee('0x36')];if(!_0xe0cb5b[_0x67ee('0x30')]['hasOwnProperty'](_0x67ee('0x37'))){_0x2fe744[_0x67ee('0x1c')]=qs[_0x67ee('0x1c')](_0xe0cb5b[_0x67ee('0x30')][_0x67ee('0x1c')]);_0x2fe744[_0x67ee('0x1a')]=qs[_0x67ee('0x1a')](_0xe0cb5b[_0x67ee('0x30')][_0x67ee('0x1a')]);}_0x2fe744[_0x67ee('0x38')]=qs[_0x67ee('0x39')](_0xe0cb5b[_0x67ee('0x30')][_0x67ee('0x39')]);_0x2fe744[_0x67ee('0x3a')]=qs[_0x67ee('0x31')](_[_0x67ee('0x3b')](_0xe0cb5b[_0x67ee('0x30')],_0x4660d7[_0x67ee('0x31')]),_0x4f74b9);if(_0xe0cb5b['query']['filter']){_0x2fe744[_0x67ee('0x3a')]=_['merge'](_0x2fe744['where'],{'$or':_[_0x67ee('0x2b')](_0x4f74b9,function(_0x192b74){if(_0x192b74['type']!==_0x67ee('0x3c')){var _0x3c552f={};_0x3c552f[_0x192b74[_0x67ee('0x28')]]={'$like':'%'+_0xe0cb5b['query'][_0x67ee('0x3d')]+'%'};return _0x3c552f;}})});}_0x2fe744=_[_0x67ee('0x3e')]({},_0x2fe744,_0xe0cb5b['options']);var _0x361eaf={'where':_0x2fe744[_0x67ee('0x3a')]};return db[_0x67ee('0x2c')]['count'](_0x361eaf)[_0x67ee('0x24')](function(_0x1a7844){_0x3faae2[_0x67ee('0x1d')]=_0x1a7844;if(_0xe0cb5b[_0x67ee('0x30')][_0x67ee('0x3f')]){_0x2fe744['include']=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x2fe744);})[_0x67ee('0x24')](function(_0x29a880){_0x3faae2['rows']=_0x29a880;return _0x3faae2;})['then'](respondWithFilteredResult(_0x5898a8,_0x2fe744))[_0x67ee('0x40')](handleError(_0x5898a8,null));};exports[_0x67ee('0x41')]=function(_0x28d5d1,_0x395367){var _0x2c5780={'raw':!![],'where':{'id':_0x28d5d1[_0x67ee('0x42')]['id']}},_0x198c9e={};_0x198c9e[_0x67ee('0x36')]=_['keys'](db[_0x67ee('0x2c')][_0x67ee('0x2d')]);_0x198c9e[_0x67ee('0x30')]=_['keys'](_0x28d5d1['query']);_0x198c9e['filters']=_[_0x67ee('0x32')](_0x198c9e['model'],_0x198c9e[_0x67ee('0x30')]);_0x2c5780[_0x67ee('0x33')]=_[_0x67ee('0x32')](_0x198c9e[_0x67ee('0x36')],qs[_0x67ee('0x34')](_0x28d5d1[_0x67ee('0x30')][_0x67ee('0x34')]));_0x2c5780[_0x67ee('0x33')]=_0x2c5780[_0x67ee('0x33')][_0x67ee('0x35')]?_0x2c5780[_0x67ee('0x33')]:_0x198c9e[_0x67ee('0x36')];if(_0x28d5d1[_0x67ee('0x30')][_0x67ee('0x3f')]){_0x2c5780[_0x67ee('0x43')]=[{'all':!![]}];}_0x2c5780=_[_0x67ee('0x3e')]({},_0x2c5780,_0x28d5d1['options']);return db['AnalyticTreeReport'][_0x67ee('0x44')](_0x2c5780)['then'](handleEntityNotFound(_0x395367,null))[_0x67ee('0x24')](respondWithResult(_0x395367,null))[_0x67ee('0x40')](handleError(_0x395367,null));};exports['create']=function(_0x27eeb2,_0x461025){return db[_0x67ee('0x2c')][_0x67ee('0x45')](_0x27eeb2[_0x67ee('0x46')],{})['then'](respondWithResult(_0x461025,0xc9))[_0x67ee('0x40')](handleError(_0x461025,null));};exports['update']=function(_0xd1d1c9,_0x4581a6){if(_0xd1d1c9[_0x67ee('0x46')]['id']){delete _0xd1d1c9[_0x67ee('0x46')]['id'];}return db[_0x67ee('0x2c')][_0x67ee('0x44')]({'where':{'id':_0xd1d1c9[_0x67ee('0x42')]['id']}})['then'](handleEntityNotFound(_0x4581a6,null))[_0x67ee('0x24')](saveUpdates(_0xd1d1c9[_0x67ee('0x46')],null))['then'](respondWithResult(_0x4581a6,null))[_0x67ee('0x40')](handleError(_0x4581a6,null));};exports['destroy']=function(_0xda957b,_0x5455d2){return db['AnalyticTreeReport'][_0x67ee('0x44')]({'where':{'id':_0xda957b[_0x67ee('0x42')]['id']}})['then'](handleEntityNotFound(_0x5455d2,null))[_0x67ee('0x24')](removeEntity(_0x5455d2,null))[_0x67ee('0x40')](handleError(_0x5455d2,null));}; \ No newline at end of file +var _0x5f93=['reject','save','update','then','destroy','end','error','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','map','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','apply'];(function(_0x4e7e03,_0x5b0f86){var _0x50b732=function(_0x170c2c){while(--_0x170c2c){_0x4e7e03['push'](_0x4e7e03['shift']());}};_0x50b732(++_0x5b0f86);}(_0x5f93,0x10d));var _0x35f9=function(_0x5e3e18,_0xd16a93){_0x5e3e18=_0x5e3e18-0x0;var _0x2502b2=_0x5f93[_0x5e3e18];return _0x2502b2;};'use strict';var emlformat=require(_0x35f9('0x0'));var rimraf=require(_0x35f9('0x1'));var zipdir=require(_0x35f9('0x2'));var jsonpatch=require(_0x35f9('0x3'));var rp=require(_0x35f9('0x4'));var moment=require(_0x35f9('0x5'));var BPromise=require(_0x35f9('0x6'));var Mustache=require('mustache');var util=require(_0x35f9('0x7'));var path=require('path');var sox=require(_0x35f9('0x8'));var csv=require(_0x35f9('0x9'));var ejs=require(_0x35f9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35f9('0xb'));var squel=require('squel');var crypto=require(_0x35f9('0xc'));var jsforce=require(_0x35f9('0xd'));var deskjs=require(_0x35f9('0xe'));var toCsv=require('to-csv');var querystring=require(_0x35f9('0xf'));var Papa=require(_0x35f9('0x10'));var Redis=require(_0x35f9('0x11'));var authService=require(_0x35f9('0x12'));var qs=require(_0x35f9('0x13'));var as=require(_0x35f9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35f9('0x15'))(_0x35f9('0x16'));var utils=require(_0x35f9('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x35f9('0x18'));var db=require(_0x35f9('0x19'))['db'];function respondWithStatusCode(_0x5656f4,_0x2d960b){_0x2d960b=_0x2d960b||0xcc;return function(_0xa5c57f){if(_0xa5c57f){return _0x5656f4[_0x35f9('0x1a')](_0x2d960b);}return _0x5656f4['status'](_0x2d960b)['end']();};}function respondWithResult(_0x2d2896,_0x215272){_0x215272=_0x215272||0xc8;return function(_0xe60b2c){if(_0xe60b2c){return _0x2d2896[_0x35f9('0x1b')](_0x215272)[_0x35f9('0x1c')](_0xe60b2c);}};}function respondWithFilteredResult(_0xb58759,_0xabebb5){return function(_0x3220f8){if(_0x3220f8){var _0xcb0c8d=typeof _0xabebb5[_0x35f9('0x1d')]===_0x35f9('0x1e')&&typeof _0xabebb5['limit']===_0x35f9('0x1e');var _0x15631e=_0x3220f8[_0x35f9('0x1f')];var _0x172718=_0xcb0c8d?0x0:_0xabebb5[_0x35f9('0x1d')];var _0x42ad48=_0xcb0c8d?_0x3220f8[_0x35f9('0x1f')]:_0xabebb5[_0x35f9('0x1d')]+_0xabebb5[_0x35f9('0x20')];var _0x5b7a62;if(_0x42ad48>=_0x15631e){_0x42ad48=_0x15631e;_0x5b7a62=0xc8;}else{_0x5b7a62=0xce;}_0xb58759['status'](_0x5b7a62);return _0xb58759[_0x35f9('0x21')]('Content-Range',_0x172718+'-'+_0x42ad48+'/'+_0x15631e)['json'](_0x3220f8);}return null;};}function patchUpdates(_0x5af511){return function(_0x5e0a36){try{jsonpatch[_0x35f9('0x22')](_0x5e0a36,_0x5af511,!![]);}catch(_0x4c6c4b){return BPromise[_0x35f9('0x23')](_0x4c6c4b);}return _0x5e0a36[_0x35f9('0x24')]();};}function saveUpdates(_0x32effc,_0x3e33e0){return function(_0x4f4165){if(_0x4f4165){return _0x4f4165[_0x35f9('0x25')](_0x32effc)[_0x35f9('0x26')](function(_0x58ccbe){return _0x58ccbe;});}return null;};}function removeEntity(_0xa06b49,_0x53c33a){return function(_0x48f98b){if(_0x48f98b){return _0x48f98b[_0x35f9('0x27')]()[_0x35f9('0x26')](function(){_0xa06b49[_0x35f9('0x1b')](0xcc)[_0x35f9('0x28')]();});}};}function handleEntityNotFound(_0x5bfe29,_0x51c4b4){return function(_0x76ca49){if(!_0x76ca49){_0x5bfe29[_0x35f9('0x1a')](0x194);}return _0x76ca49;};}function handleError(_0x383625,_0x37d273){_0x37d273=_0x37d273||0x1f4;return function(_0x27b5e7){logger[_0x35f9('0x29')](_0x27b5e7[_0x35f9('0x2a')]);if(_0x27b5e7[_0x35f9('0x2b')]){delete _0x27b5e7[_0x35f9('0x2b')];}_0x383625['status'](_0x37d273)['send'](_0x27b5e7);};}exports[_0x35f9('0x2c')]=function(_0x591461,_0x2fdb4c){var _0x4293d0={},_0x324f93={},_0x5049d6={'count':0x0,'rows':[]};var _0x2831d6=_['map'](db[_0x35f9('0x2d')][_0x35f9('0x2e')],function(_0x4ed1de){return{'name':_0x4ed1de[_0x35f9('0x2f')],'type':_0x4ed1de[_0x35f9('0x30')][_0x35f9('0x31')]};});_0x324f93['model']=_['map'](_0x2831d6,'name');_0x324f93['query']=_[_0x35f9('0x32')](_0x591461[_0x35f9('0x33')]);_0x324f93['filters']=_[_0x35f9('0x34')](_0x324f93[_0x35f9('0x35')],_0x324f93[_0x35f9('0x33')]);_0x4293d0[_0x35f9('0x36')]=_['intersection'](_0x324f93['model'],qs[_0x35f9('0x37')](_0x591461[_0x35f9('0x33')][_0x35f9('0x37')]));_0x4293d0[_0x35f9('0x36')]=_0x4293d0[_0x35f9('0x36')][_0x35f9('0x38')]?_0x4293d0[_0x35f9('0x36')]:_0x324f93[_0x35f9('0x35')];if(!_0x591461[_0x35f9('0x33')][_0x35f9('0x39')]('nolimit')){_0x4293d0[_0x35f9('0x20')]=qs[_0x35f9('0x20')](_0x591461['query'][_0x35f9('0x20')]);_0x4293d0['offset']=qs[_0x35f9('0x1d')](_0x591461[_0x35f9('0x33')][_0x35f9('0x1d')]);}_0x4293d0[_0x35f9('0x3a')]=qs[_0x35f9('0x3b')](_0x591461[_0x35f9('0x33')][_0x35f9('0x3b')]);_0x4293d0[_0x35f9('0x3c')]=qs[_0x35f9('0x3d')](_[_0x35f9('0x3e')](_0x591461[_0x35f9('0x33')],_0x324f93[_0x35f9('0x3d')]),_0x2831d6);if(_0x591461[_0x35f9('0x33')]['filter']){_0x4293d0[_0x35f9('0x3c')]=_['merge'](_0x4293d0[_0x35f9('0x3c')],{'$or':_[_0x35f9('0x3f')](_0x2831d6,function(_0x40bc4c){if(_0x40bc4c['type']!=='VIRTUAL'){var _0x54e652={};_0x54e652[_0x40bc4c[_0x35f9('0x2b')]]={'$like':'%'+_0x591461[_0x35f9('0x33')][_0x35f9('0x40')]+'%'};return _0x54e652;}})});}_0x4293d0=_[_0x35f9('0x41')]({},_0x4293d0,_0x591461['options']);var _0xf64f19={'where':_0x4293d0['where']};return db[_0x35f9('0x2d')][_0x35f9('0x1f')](_0xf64f19)[_0x35f9('0x26')](function(_0x429da7){_0x5049d6[_0x35f9('0x1f')]=_0x429da7;if(_0x591461[_0x35f9('0x33')][_0x35f9('0x42')]){_0x4293d0[_0x35f9('0x43')]=[{'all':!![]}];}return db[_0x35f9('0x2d')][_0x35f9('0x44')](_0x4293d0);})[_0x35f9('0x26')](function(_0x9488fc){_0x5049d6[_0x35f9('0x45')]=_0x9488fc;return _0x5049d6;})[_0x35f9('0x26')](respondWithFilteredResult(_0x2fdb4c,_0x4293d0))[_0x35f9('0x46')](handleError(_0x2fdb4c,null));};exports['show']=function(_0x2f37b6,_0x44f293){var _0x53ccb7={'raw':!![],'where':{'id':_0x2f37b6[_0x35f9('0x47')]['id']}},_0x240800={};_0x240800[_0x35f9('0x35')]=_[_0x35f9('0x32')](db[_0x35f9('0x2d')]['rawAttributes']);_0x240800[_0x35f9('0x33')]=_[_0x35f9('0x32')](_0x2f37b6[_0x35f9('0x33')]);_0x240800['filters']=_[_0x35f9('0x34')](_0x240800[_0x35f9('0x35')],_0x240800[_0x35f9('0x33')]);_0x53ccb7['attributes']=_[_0x35f9('0x34')](_0x240800[_0x35f9('0x35')],qs[_0x35f9('0x37')](_0x2f37b6[_0x35f9('0x33')][_0x35f9('0x37')]));_0x53ccb7['attributes']=_0x53ccb7[_0x35f9('0x36')]['length']?_0x53ccb7[_0x35f9('0x36')]:_0x240800['model'];if(_0x2f37b6[_0x35f9('0x33')][_0x35f9('0x42')]){_0x53ccb7[_0x35f9('0x43')]=[{'all':!![]}];}_0x53ccb7=_['merge']({},_0x53ccb7,_0x2f37b6[_0x35f9('0x48')]);return db[_0x35f9('0x2d')][_0x35f9('0x49')](_0x53ccb7)[_0x35f9('0x26')](handleEntityNotFound(_0x44f293,null))[_0x35f9('0x26')](respondWithResult(_0x44f293,null))['catch'](handleError(_0x44f293,null));};exports[_0x35f9('0x4a')]=function(_0x42e93a,_0x3a02da){return db['AnalyticTreeReport']['create'](_0x42e93a['body'],{})[_0x35f9('0x26')](respondWithResult(_0x3a02da,0xc9))[_0x35f9('0x46')](handleError(_0x3a02da,null));};exports[_0x35f9('0x25')]=function(_0x4121bd,_0x450214){if(_0x4121bd[_0x35f9('0x4b')]['id']){delete _0x4121bd[_0x35f9('0x4b')]['id'];}return db['AnalyticTreeReport'][_0x35f9('0x49')]({'where':{'id':_0x4121bd[_0x35f9('0x47')]['id']}})[_0x35f9('0x26')](handleEntityNotFound(_0x450214,null))[_0x35f9('0x26')](saveUpdates(_0x4121bd['body'],null))[_0x35f9('0x26')](respondWithResult(_0x450214,null))[_0x35f9('0x46')](handleError(_0x450214,null));};exports['destroy']=function(_0x5be265,_0x5979f4){return db['AnalyticTreeReport'][_0x35f9('0x49')]({'where':{'id':_0x5be265[_0x35f9('0x47')]['id']}})['then'](handleEntityNotFound(_0x5979f4,null))[_0x35f9('0x26')](removeEntity(_0x5979f4,null))[_0x35f9('0x46')](handleError(_0x5979f4,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index ada5ee1..c55fcb9 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 _0xfebb=['analytics_report_trees','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xfebb,0xa6));var _0xbfeb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfebb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfeb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbfeb('0x1'));var moment=require(_0xbfeb('0x2'));var BPromise=require(_0xbfeb('0x3'));var rp=require(_0xbfeb('0x4'));var fs=require('fs');var path=require(_0xbfeb('0x5'));var rimraf=require('rimraf');var config=require(_0xbfeb('0x6'));var attributes=require(_0xbfeb('0x7'));module[_0xbfeb('0x8')]=function(_0x5b4fef,_0x3dff6a){return _0x5b4fef['define'](_0xbfeb('0x9'),attributes,{'tableName':_0xbfeb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafff=['AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','request-promise','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xafff,0x1a6));var _0xfaff=function(_0xb5b851,_0x4fbbf0){_0xb5b851=_0xb5b851-0x0;var _0x231288=_0xafff[_0xb5b851];return _0x231288;};'use strict';var _=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var logger=require(_0xfaff('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfaff('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfaff('0x4'));var attributes=require(_0xfaff('0x5'));module[_0xfaff('0x6')]=function(_0x4f85c0,_0x5ce3c3){return _0x4f85c0[_0xfaff('0x7')](_0xfaff('0x8'),attributes,{'tableName':_0xfaff('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index da5b435..c80e4bc 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x20ba97,_0x639c4){var _0x530734=function(_0x12b758){while(--_0x12b758){_0x20ba97['push'](_0x20ba97['shift']());}};_0x530734(++_0x639c4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xc4aa[_0x2064e5];return _0x21a233;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x5074ed,_0x458b66){var _0x2f0f6a=function(_0x351e0b){while(--_0x351e0b){_0x5074ed['push'](_0x5074ed['shift']());}};_0x2f0f6a(++_0x458b66);}(_0xdb28,0x106));var _0x8db2=function(_0x3ce9f5,_0x57efed){_0x3ce9f5=_0x3ce9f5-0x0;var _0x149c10=_0xdb28[_0x3ce9f5];return _0x149c10;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 033b235..374503f 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 _0x48dc=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated'];(function(_0x46fd15,_0x47fb06){var _0x394cbe=function(_0x24c597){while(--_0x24c597){_0x46fd15['push'](_0x46fd15['shift']());}};_0x394cbe(++_0x47fb06);}(_0x48dc,0xb0));var _0xc48d=function(_0x377a39,_0x210428){_0x377a39=_0x377a39-0x0;var _0x564166=_0x48dc[_0x377a39];return _0x564166;};'use strict';var multer=require(_0xc48d('0x0'));var util=require(_0xc48d('0x1'));var path=require(_0xc48d('0x2'));var timeout=require(_0xc48d('0x3'));var express=require('express');var router=express[_0xc48d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc48d('0x5'));var interaction=require(_0xc48d('0x6'));var config=require(_0xc48d('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xc48d('0x8')]('/',auth['isAuthenticated'](),controller[_0xc48d('0x9')]);router[_0xc48d('0x8')]('/:id',auth[_0xc48d('0xa')](),controller['show']);router['post']('/',auth[_0xc48d('0xa')](),controller['create']);router[_0xc48d('0xb')](_0xc48d('0xc'),auth[_0xc48d('0xa')](),controller[_0xc48d('0xd')]);router[_0xc48d('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xc48d('0xf')]);module[_0xc48d('0x10')]=router; \ No newline at end of file +var _0xd242=['update','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','create'];(function(_0x3611ef,_0x4fbb05){var _0x246a54=function(_0x2bbd56){while(--_0x2bbd56){_0x3611ef['push'](_0x3611ef['shift']());}};_0x246a54(++_0x4fbb05);}(_0xd242,0x133));var _0x2d24=function(_0x2a9bf4,_0x5e0ffb){_0x2a9bf4=_0x2a9bf4-0x0;var _0x5f5ff1=_0xd242[_0x2a9bf4];return _0x5f5ff1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2d24('0x0'));var timeout=require('connect-timeout');var express=require(_0x2d24('0x1'));var router=express[_0x2d24('0x2')]();var fs_extra=require(_0x2d24('0x3'));var auth=require(_0x2d24('0x4'));var interaction=require(_0x2d24('0x5'));var config=require(_0x2d24('0x6'));var controller=require('./analyticTreeReport.controller');router[_0x2d24('0x7')]('/',auth[_0x2d24('0x8')](),controller[_0x2d24('0x9')]);router[_0x2d24('0x7')](_0x2d24('0xa'),auth[_0x2d24('0x8')](),controller['show']);router[_0x2d24('0xb')]('/',auth[_0x2d24('0x8')](),controller[_0x2d24('0xc')]);router['put'](_0x2d24('0xa'),auth[_0x2d24('0x8')](),controller[_0x2d24('0xd')]);router['delete'](_0x2d24('0xa'),auth[_0x2d24('0x8')](),controller[_0x2d24('0xe')]);module[_0x2d24('0xf')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index e459343..a989398 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 _0xe8f7=['STRING','sequelize'];(function(_0x3dc4a0,_0x1fa04d){var _0x13afa7=function(_0x13ad66){while(--_0x13ad66){_0x3dc4a0['push'](_0x3dc4a0['shift']());}};_0x13afa7(++_0x1fa04d);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e8f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7e8f('0x1')]},'basename':{'type':Sequelize[_0x7e8f('0x1')]},'type':{'type':Sequelize[_0x7e8f('0x1')]}}; \ No newline at end of file +var _0xb3ea=['exports','STRING','sequelize'];(function(_0x2c3f8c,_0x3ec5d0){var _0x59fcaa=function(_0x494874){while(--_0x494874){_0x2c3f8c['push'](_0x2c3f8c['shift']());}};_0x59fcaa(++_0x3ec5d0);}(_0xb3ea,0x10d));var _0xab3e=function(_0x38b2e2,_0x4a3566){_0x38b2e2=_0x38b2e2-0x0;var _0x1d8faa=_0xb3ea[_0x38b2e2];return _0x1d8faa;};'use strict';var Sequelize=require(_0xab3e('0x0'));module[_0xab3e('0x1')]={'name':{'type':Sequelize[_0xab3e('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xab3e('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index fe4ce4d..66ba77c 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 _0x7618=['options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','clone','get','omit','createdAt','updatedAt','create','body','originalname','basename','file','filename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','save','update','then','destroy','error','stack','send','index','map','Attachment','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x3dcc5a,_0x5d81d9){var _0x5ac286=function(_0x2f4e23){while(--_0x2f4e23){_0x3dcc5a['push'](_0x3dcc5a['shift']());}};_0x5ac286(++_0x5d81d9);}(_0x7618,0x76));var _0x8761=function(_0x557d80,_0x3a2a33){_0x557d80=_0x557d80-0x0;var _0x5314f6=_0x7618[_0x557d80];return _0x5314f6;};'use strict';var emlformat=require(_0x8761('0x0'));var rimraf=require(_0x8761('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8761('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8761('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8761('0x4'));var sox=require(_0x8761('0x5'));var csv=require(_0x8761('0x6'));var ejs=require(_0x8761('0x7'));var fs=require('fs');var fs_extra=require(_0x8761('0x8'));var _=require(_0x8761('0x9'));var squel=require(_0x8761('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8761('0x6'));var querystring=require(_0x8761('0xb'));var Papa=require(_0x8761('0xc'));var Redis=require(_0x8761('0xd'));var authService=require(_0x8761('0xe'));var qs=require(_0x8761('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8761('0x10'));var logger=require(_0x8761('0x11'))(_0x8761('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8761('0x13'));var db=require(_0x8761('0x14'))['db'];function respondWithStatusCode(_0x28e091,_0x37bccc){_0x37bccc=_0x37bccc||0xcc;return function(_0x38bbd9){if(_0x38bbd9){return _0x28e091[_0x8761('0x15')](_0x37bccc);}return _0x28e091['status'](_0x37bccc)[_0x8761('0x16')]();};}function respondWithResult(_0x225dba,_0x22b82a){_0x22b82a=_0x22b82a||0xc8;return function(_0x2f2fe6){if(_0x2f2fe6){return _0x225dba[_0x8761('0x17')](_0x22b82a)[_0x8761('0x18')](_0x2f2fe6);}};}function respondWithFilteredResult(_0x2c1d5c,_0x55de8b){return function(_0x56d92b){if(_0x56d92b){var _0x5b9155=typeof _0x55de8b['offset']===_0x8761('0x19')&&typeof _0x55de8b[_0x8761('0x1a')]==='undefined';var _0x1372d4=_0x56d92b[_0x8761('0x1b')];var _0x3a9a39=_0x5b9155?0x0:_0x55de8b['offset'];var _0x356eb2=_0x5b9155?_0x56d92b['count']:_0x55de8b[_0x8761('0x1c')]+_0x55de8b['limit'];var _0x5680f7;if(_0x356eb2>=_0x1372d4){_0x356eb2=_0x1372d4;_0x5680f7=0xc8;}else{_0x5680f7=0xce;}_0x2c1d5c[_0x8761('0x17')](_0x5680f7);return _0x2c1d5c[_0x8761('0x1d')](_0x8761('0x1e'),_0x3a9a39+'-'+_0x356eb2+'/'+_0x1372d4)[_0x8761('0x18')](_0x56d92b);}return null;};}function patchUpdates(_0x2bc9a3){return function(_0x736703){try{jsonpatch['apply'](_0x736703,_0x2bc9a3,!![]);}catch(_0x21a316){return BPromise['reject'](_0x21a316);}return _0x736703[_0x8761('0x1f')]();};}function saveUpdates(_0x150e25,_0x290099){return function(_0xd1ee7f){if(_0xd1ee7f){return _0xd1ee7f[_0x8761('0x20')](_0x150e25)[_0x8761('0x21')](function(_0x37d990){return _0x37d990;});}return null;};}function removeEntity(_0x408329,_0x1c9952){return function(_0x30dc44){if(_0x30dc44){return _0x30dc44[_0x8761('0x22')]()[_0x8761('0x21')](function(){_0x408329[_0x8761('0x17')](0xcc)[_0x8761('0x16')]();});}};}function handleEntityNotFound(_0xc94e5b,_0x1422f4){return function(_0x4f08c2){if(!_0x4f08c2){_0xc94e5b[_0x8761('0x15')](0x194);}return _0x4f08c2;};}function handleError(_0x4cca00,_0x31b358){_0x31b358=_0x31b358||0x1f4;return function(_0x49090b){logger[_0x8761('0x23')](_0x49090b[_0x8761('0x24')]);if(_0x49090b['name']){delete _0x49090b['name'];}_0x4cca00[_0x8761('0x17')](_0x31b358)[_0x8761('0x25')](_0x49090b);};}exports[_0x8761('0x26')]=function(_0x38b6ac,_0x20e3c7){var _0x2864a7={},_0x6d9f2f={},_0x443f82={'count':0x0,'rows':[]};var _0x374a62=_[_0x8761('0x27')](db[_0x8761('0x28')]['rawAttributes'],function(_0x4cc0f7){return{'name':_0x4cc0f7[_0x8761('0x29')],'type':_0x4cc0f7[_0x8761('0x2a')]['key']};});_0x6d9f2f[_0x8761('0x2b')]=_[_0x8761('0x27')](_0x374a62,_0x8761('0x2c'));_0x6d9f2f[_0x8761('0x2d')]=_[_0x8761('0x2e')](_0x38b6ac[_0x8761('0x2d')]);_0x6d9f2f[_0x8761('0x2f')]=_[_0x8761('0x30')](_0x6d9f2f[_0x8761('0x2b')],_0x6d9f2f[_0x8761('0x2d')]);_0x2864a7[_0x8761('0x31')]=_[_0x8761('0x30')](_0x6d9f2f[_0x8761('0x2b')],qs[_0x8761('0x32')](_0x38b6ac['query'][_0x8761('0x32')]));_0x2864a7[_0x8761('0x31')]=_0x2864a7[_0x8761('0x31')][_0x8761('0x33')]?_0x2864a7['attributes']:_0x6d9f2f[_0x8761('0x2b')];if(!_0x38b6ac[_0x8761('0x2d')][_0x8761('0x34')](_0x8761('0x35'))){_0x2864a7[_0x8761('0x1a')]=qs[_0x8761('0x1a')](_0x38b6ac[_0x8761('0x2d')]['limit']);_0x2864a7['offset']=qs[_0x8761('0x1c')](_0x38b6ac[_0x8761('0x2d')][_0x8761('0x1c')]);}_0x2864a7[_0x8761('0x36')]=qs[_0x8761('0x37')](_0x38b6ac[_0x8761('0x2d')][_0x8761('0x37')]);_0x2864a7[_0x8761('0x38')]=qs['filters'](_[_0x8761('0x39')](_0x38b6ac[_0x8761('0x2d')],_0x6d9f2f[_0x8761('0x2f')]),_0x374a62);if(_0x38b6ac[_0x8761('0x2d')][_0x8761('0x3a')]){_0x2864a7[_0x8761('0x38')]=_[_0x8761('0x3b')](_0x2864a7['where'],{'$or':_[_0x8761('0x27')](_0x374a62,function(_0x15ed86){if(_0x15ed86[_0x8761('0x2a')]!=='VIRTUAL'){var _0x281385={};_0x281385[_0x15ed86[_0x8761('0x2c')]]={'$like':'%'+_0x38b6ac[_0x8761('0x2d')][_0x8761('0x3a')]+'%'};return _0x281385;}})});}_0x2864a7=_[_0x8761('0x3b')]({},_0x2864a7,_0x38b6ac[_0x8761('0x3c')]);var _0x3f06cd={'where':_0x2864a7[_0x8761('0x38')]};return db[_0x8761('0x28')][_0x8761('0x1b')](_0x3f06cd)[_0x8761('0x21')](function(_0x2d25c8){_0x443f82[_0x8761('0x1b')]=_0x2d25c8;if(_0x38b6ac[_0x8761('0x2d')][_0x8761('0x3d')]){_0x2864a7[_0x8761('0x3e')]=[{'all':!![]}];}return db['Attachment'][_0x8761('0x3f')](_0x2864a7);})['then'](function(_0x3571fe){_0x443f82[_0x8761('0x40')]=_0x3571fe;return _0x443f82;})[_0x8761('0x21')](respondWithFilteredResult(_0x20e3c7,_0x2864a7))[_0x8761('0x41')](handleError(_0x20e3c7,null));};exports[_0x8761('0x42')]=function(_0x128698,_0x1e44c6){var _0x5aa99f={'raw':!![],'where':{'id':_0x128698[_0x8761('0x43')]['id']}},_0x56254b={};_0x56254b['model']=_['keys'](db[_0x8761('0x28')][_0x8761('0x44')]);_0x56254b[_0x8761('0x2d')]=_[_0x8761('0x2e')](_0x128698['query']);_0x56254b['filters']=_[_0x8761('0x30')](_0x56254b['model'],_0x56254b[_0x8761('0x2d')]);_0x5aa99f[_0x8761('0x31')]=_[_0x8761('0x30')](_0x56254b[_0x8761('0x2b')],qs[_0x8761('0x32')](_0x128698[_0x8761('0x2d')][_0x8761('0x32')]));_0x5aa99f[_0x8761('0x31')]=_0x5aa99f[_0x8761('0x31')][_0x8761('0x33')]?_0x5aa99f['attributes']:_0x56254b['model'];if(_0x128698[_0x8761('0x2d')][_0x8761('0x3d')]){_0x5aa99f[_0x8761('0x3e')]=[{'all':!![]}];}_0x5aa99f=_['merge']({},_0x5aa99f,_0x128698['options']);return db['Attachment'][_0x8761('0x45')](_0x5aa99f)[_0x8761('0x21')](handleEntityNotFound(_0x1e44c6,null))[_0x8761('0x21')](respondWithResult(_0x1e44c6,null))[_0x8761('0x41')](handleError(_0x1e44c6,null));};exports[_0x8761('0x46')]=function(_0x127b4f,_0x43320f){var _0xf5573a={'where':{'id':_0x127b4f[_0x8761('0x43')]['id']}},_0x2125c1={};_0x2125c1[_0x8761('0x2b')]=_[_0x8761('0x2e')](db['Attachment'][_0x8761('0x44')]);_0xf5573a[_0x8761('0x31')]=_[_0x8761('0x30')](_0x2125c1[_0x8761('0x2b')],qs[_0x8761('0x32')](_0x127b4f[_0x8761('0x2d')][_0x8761('0x32')]));_0xf5573a[_0x8761('0x31')]=_0xf5573a[_0x8761('0x31')][_0x8761('0x33')]?_0xf5573a[_0x8761('0x31')]:_0x2125c1[_0x8761('0x2b')];if(_0x127b4f[_0x8761('0x2d')][_0x8761('0x3d')]){_0xf5573a[_0x8761('0x3e')]=[{'all':!![]}];}_0xf5573a=_[_0x8761('0x3b')]({},_0xf5573a,_0x127b4f['options']);return db[_0x8761('0x28')][_0x8761('0x45')](_0xf5573a)[_0x8761('0x21')](handleEntityNotFound(_0x43320f,null))[_0x8761('0x21')](function(_0x5ba31f){if(_0x5ba31f){var _0x253a0e=_0x5ba31f[_0x8761('0x47')]({'plain':!![]});_0x253a0e=qs[_0x8761('0x48')](_0x253a0e,['id','createdAt','updatedAt']);_0x127b4f['body']=_[_0x8761('0x48')](_0x127b4f['body'],['id',_0x8761('0x49'),_0x8761('0x4a')]);return db[_0x8761('0x28')][_0x8761('0x4b')](_['merge'](_0x253a0e,_0x127b4f['body']),{'include':_0x127b4f[_0x8761('0x2d')][_0x8761('0x3d')]?[{'all':!![]}]:undefined});}})[_0x8761('0x21')](respondWithResult(_0x43320f,0xc9))[_0x8761('0x41')](handleError(_0x43320f,null));};exports['update']=function(_0x101c11,_0x3fa637){if(_0x101c11[_0x8761('0x4c')]['id']){delete _0x101c11[_0x8761('0x4c')]['id'];}return db[_0x8761('0x28')][_0x8761('0x45')]({'where':{'id':_0x101c11[_0x8761('0x43')]['id']}})[_0x8761('0x21')](handleEntityNotFound(_0x3fa637,null))[_0x8761('0x21')](saveUpdates(_0x101c11[_0x8761('0x4c')],null))['then'](respondWithResult(_0x3fa637,null))[_0x8761('0x41')](handleError(_0x3fa637,null));};exports[_0x8761('0x22')]=function(_0x11e85e,_0x473773){return db[_0x8761('0x28')]['find']({'where':{'id':_0x11e85e[_0x8761('0x43')]['id']}})[_0x8761('0x21')](handleEntityNotFound(_0x473773,null))[_0x8761('0x21')](removeEntity(_0x473773,null))[_0x8761('0x41')](handleError(_0x473773,null));};exports[_0x8761('0x4b')]=function(_0xc2794d,_0x352365,_0x47b107){_0xc2794d[_0x8761('0x4c')]['name']=_0xc2794d['file'][_0x8761('0x4d')];_0xc2794d[_0x8761('0x4c')][_0x8761('0x4e')]=_0xc2794d[_0x8761('0x4f')][_0x8761('0x50')];_0xc2794d[_0x8761('0x4c')][_0x8761('0x2a')]=_0xc2794d[_0x8761('0x4f')][_0x8761('0x51')];return db['Attachment'][_0x8761('0x4b')](_0xc2794d[_0x8761('0x4c')])[_0x8761('0x21')](respondWithResult(_0x352365,0xc9))['catch'](handleError(_0x352365,null));};exports[_0x8761('0x52')]=function(_0x1c90ed,_0x4a2b83,_0x2dad6d){return db[_0x8761('0x28')][_0x8761('0x53')]({'where':{'id':_0x1c90ed[_0x8761('0x43')]['id']},'raw':!![]})[_0x8761('0x21')](handleEntityNotFound(_0x4a2b83,null))[_0x8761('0x21')](function(_0x2a1a8e){if(_0x2a1a8e){var _0x2f2946=_0x2a1a8e[_0x8761('0x54')]!==null;var _0x3118ff=path[_0x8761('0x55')](config[_0x8761('0x56')],_0x8761('0x57'));if(_0x2f2946){_0x3118ff=path[_0x8761('0x55')](_0x3118ff,_0x8761('0x58'));}var _0x95485b=path[_0x8761('0x55')](_0x3118ff,_0x2a1a8e[_0x8761('0x4e')]);return _0x4a2b83[_0x8761('0x52')](_0x95485b);}})['catch'](handleError(_0x4a2b83,null));}; \ No newline at end of file +var _0xbdce=['show','keys','clone','find','get','omit','createdAt','body','updatedAt','create','file','originalname','mimetype','download','findOne','params','ChatOfflineMessageId','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','merge','options','includeAll','include','findAll','catch'];(function(_0x24dfd2,_0x504fac){var _0x3abda1=function(_0x55bc85){while(--_0x55bc85){_0x24dfd2['push'](_0x24dfd2['shift']());}};_0x3abda1(++_0x504fac);}(_0xbdce,0xc7));var _0xebdc=function(_0x2a7b47,_0x35e24d){_0x2a7b47=_0x2a7b47-0x0;var _0x30deb6=_0xbdce[_0x2a7b47];return _0x30deb6;};'use strict';var emlformat=require(_0xebdc('0x0'));var rimraf=require(_0xebdc('0x1'));var zipdir=require(_0xebdc('0x2'));var jsonpatch=require(_0xebdc('0x3'));var rp=require(_0xebdc('0x4'));var moment=require('moment');var BPromise=require(_0xebdc('0x5'));var Mustache=require(_0xebdc('0x6'));var util=require(_0xebdc('0x7'));var path=require(_0xebdc('0x8'));var sox=require(_0xebdc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xebdc('0xa'));var _=require(_0xebdc('0xb'));var squel=require(_0xebdc('0xc'));var crypto=require('crypto');var jsforce=require(_0xebdc('0xd'));var deskjs=require(_0xebdc('0xe'));var toCsv=require(_0xebdc('0xf'));var querystring=require(_0xebdc('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xebdc('0x11'));var as=require(_0xebdc('0x12'));var hardwareService=require(_0xebdc('0x13'));var logger=require('../../config/logger')(_0xebdc('0x14'));var utils=require(_0xebdc('0x15'));var config=require(_0xebdc('0x16'));var licenseUtil=require(_0xebdc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f5936,_0x354eff){_0x354eff=_0x354eff||0xcc;return function(_0x3b579c){if(_0x3b579c){return _0x4f5936['sendStatus'](_0x354eff);}return _0x4f5936[_0xebdc('0x18')](_0x354eff)['end']();};}function respondWithResult(_0x130487,_0x54679a){_0x54679a=_0x54679a||0xc8;return function(_0xe1e304){if(_0xe1e304){return _0x130487['status'](_0x54679a)[_0xebdc('0x19')](_0xe1e304);}};}function respondWithFilteredResult(_0x2b2900,_0x4075c3){return function(_0x1bfd30){if(_0x1bfd30){var _0x1a43d1=typeof _0x4075c3[_0xebdc('0x1a')]===_0xebdc('0x1b')&&typeof _0x4075c3['limit']==='undefined';var _0x36ee47=_0x1bfd30[_0xebdc('0x1c')];var _0x2551d6=_0x1a43d1?0x0:_0x4075c3['offset'];var _0x5f599e=_0x1a43d1?_0x1bfd30[_0xebdc('0x1c')]:_0x4075c3[_0xebdc('0x1a')]+_0x4075c3['limit'];var _0x44566a;if(_0x5f599e>=_0x36ee47){_0x5f599e=_0x36ee47;_0x44566a=0xc8;}else{_0x44566a=0xce;}_0x2b2900[_0xebdc('0x18')](_0x44566a);return _0x2b2900[_0xebdc('0x1d')](_0xebdc('0x1e'),_0x2551d6+'-'+_0x5f599e+'/'+_0x36ee47)[_0xebdc('0x19')](_0x1bfd30);}return null;};}function patchUpdates(_0x289ccf){return function(_0x3f4fe9){try{jsonpatch['apply'](_0x3f4fe9,_0x289ccf,!![]);}catch(_0x539a8c){return BPromise[_0xebdc('0x1f')](_0x539a8c);}return _0x3f4fe9[_0xebdc('0x20')]();};}function saveUpdates(_0x3b6c5b,_0x5ced96){return function(_0x697a29){if(_0x697a29){return _0x697a29[_0xebdc('0x21')](_0x3b6c5b)['then'](function(_0x430572){return _0x430572;});}return null;};}function removeEntity(_0x1b96d0,_0x2a41cb){return function(_0x407752){if(_0x407752){return _0x407752[_0xebdc('0x22')]()[_0xebdc('0x23')](function(){_0x1b96d0[_0xebdc('0x18')](0xcc)[_0xebdc('0x24')]();});}};}function handleEntityNotFound(_0x49ef81,_0x11abf3){return function(_0x12fa69){if(!_0x12fa69){_0x49ef81[_0xebdc('0x25')](0x194);}return _0x12fa69;};}function handleError(_0x37c2e2,_0x3756d2){_0x3756d2=_0x3756d2||0x1f4;return function(_0x165558){logger[_0xebdc('0x26')](_0x165558[_0xebdc('0x27')]);if(_0x165558[_0xebdc('0x28')]){delete _0x165558[_0xebdc('0x28')];}_0x37c2e2[_0xebdc('0x18')](_0x3756d2)[_0xebdc('0x29')](_0x165558);};}exports[_0xebdc('0x2a')]=function(_0x1f6444,_0xb665b0){var _0x30e3e1={},_0x17e5be={},_0x5c9109={'count':0x0,'rows':[]};var _0x67d252=_[_0xebdc('0x2b')](db[_0xebdc('0x2c')][_0xebdc('0x2d')],function(_0x2a08e7){return{'name':_0x2a08e7['fieldName'],'type':_0x2a08e7[_0xebdc('0x2e')][_0xebdc('0x2f')]};});_0x17e5be['model']=_[_0xebdc('0x2b')](_0x67d252,_0xebdc('0x28'));_0x17e5be[_0xebdc('0x30')]=_['keys'](_0x1f6444[_0xebdc('0x30')]);_0x17e5be[_0xebdc('0x31')]=_['intersection'](_0x17e5be[_0xebdc('0x32')],_0x17e5be[_0xebdc('0x30')]);_0x30e3e1[_0xebdc('0x33')]=_[_0xebdc('0x34')](_0x17e5be[_0xebdc('0x32')],qs[_0xebdc('0x35')](_0x1f6444['query'][_0xebdc('0x35')]));_0x30e3e1[_0xebdc('0x33')]=_0x30e3e1[_0xebdc('0x33')][_0xebdc('0x36')]?_0x30e3e1[_0xebdc('0x33')]:_0x17e5be[_0xebdc('0x32')];if(!_0x1f6444[_0xebdc('0x30')][_0xebdc('0x37')](_0xebdc('0x38'))){_0x30e3e1[_0xebdc('0x39')]=qs[_0xebdc('0x39')](_0x1f6444[_0xebdc('0x30')][_0xebdc('0x39')]);_0x30e3e1['offset']=qs[_0xebdc('0x1a')](_0x1f6444[_0xebdc('0x30')]['offset']);}_0x30e3e1[_0xebdc('0x3a')]=qs['sort'](_0x1f6444['query']['sort']);_0x30e3e1[_0xebdc('0x3b')]=qs[_0xebdc('0x31')](_[_0xebdc('0x3c')](_0x1f6444[_0xebdc('0x30')],_0x17e5be[_0xebdc('0x31')]),_0x67d252);if(_0x1f6444[_0xebdc('0x30')][_0xebdc('0x3d')]){_0x30e3e1[_0xebdc('0x3b')]=_['merge'](_0x30e3e1[_0xebdc('0x3b')],{'$or':_[_0xebdc('0x2b')](_0x67d252,function(_0x53bc15){if(_0x53bc15[_0xebdc('0x2e')]!=='VIRTUAL'){var _0x240cc5={};_0x240cc5[_0x53bc15[_0xebdc('0x28')]]={'$like':'%'+_0x1f6444['query'][_0xebdc('0x3d')]+'%'};return _0x240cc5;}})});}_0x30e3e1=_[_0xebdc('0x3e')]({},_0x30e3e1,_0x1f6444[_0xebdc('0x3f')]);var _0x274ef8={'where':_0x30e3e1['where']};return db['Attachment'][_0xebdc('0x1c')](_0x274ef8)['then'](function(_0x3c4bdc){_0x5c9109[_0xebdc('0x1c')]=_0x3c4bdc;if(_0x1f6444['query'][_0xebdc('0x40')]){_0x30e3e1[_0xebdc('0x41')]=[{'all':!![]}];}return db[_0xebdc('0x2c')][_0xebdc('0x42')](_0x30e3e1);})[_0xebdc('0x23')](function(_0x4b024f){_0x5c9109['rows']=_0x4b024f;return _0x5c9109;})[_0xebdc('0x23')](respondWithFilteredResult(_0xb665b0,_0x30e3e1))[_0xebdc('0x43')](handleError(_0xb665b0,null));};exports[_0xebdc('0x44')]=function(_0x4336af,_0x326bab){var _0x48bd4e={'raw':!![],'where':{'id':_0x4336af['params']['id']}},_0x3a8c94={};_0x3a8c94[_0xebdc('0x32')]=_['keys'](db['Attachment'][_0xebdc('0x2d')]);_0x3a8c94['query']=_[_0xebdc('0x45')](_0x4336af[_0xebdc('0x30')]);_0x3a8c94[_0xebdc('0x31')]=_[_0xebdc('0x34')](_0x3a8c94[_0xebdc('0x32')],_0x3a8c94['query']);_0x48bd4e[_0xebdc('0x33')]=_['intersection'](_0x3a8c94['model'],qs[_0xebdc('0x35')](_0x4336af[_0xebdc('0x30')][_0xebdc('0x35')]));_0x48bd4e[_0xebdc('0x33')]=_0x48bd4e[_0xebdc('0x33')][_0xebdc('0x36')]?_0x48bd4e[_0xebdc('0x33')]:_0x3a8c94[_0xebdc('0x32')];if(_0x4336af['query']['includeAll']){_0x48bd4e[_0xebdc('0x41')]=[{'all':!![]}];}_0x48bd4e=_[_0xebdc('0x3e')]({},_0x48bd4e,_0x4336af[_0xebdc('0x3f')]);return db['Attachment']['find'](_0x48bd4e)[_0xebdc('0x23')](handleEntityNotFound(_0x326bab,null))[_0xebdc('0x23')](respondWithResult(_0x326bab,null))[_0xebdc('0x43')](handleError(_0x326bab,null));};exports[_0xebdc('0x46')]=function(_0xee31e3,_0x168cae){var _0x3ea21e={'where':{'id':_0xee31e3['params']['id']}},_0x4c363f={};_0x4c363f[_0xebdc('0x32')]=_[_0xebdc('0x45')](db[_0xebdc('0x2c')]['rawAttributes']);_0x3ea21e[_0xebdc('0x33')]=_['intersection'](_0x4c363f['model'],qs[_0xebdc('0x35')](_0xee31e3[_0xebdc('0x30')][_0xebdc('0x35')]));_0x3ea21e[_0xebdc('0x33')]=_0x3ea21e[_0xebdc('0x33')][_0xebdc('0x36')]?_0x3ea21e['attributes']:_0x4c363f[_0xebdc('0x32')];if(_0xee31e3[_0xebdc('0x30')][_0xebdc('0x40')]){_0x3ea21e[_0xebdc('0x41')]=[{'all':!![]}];}_0x3ea21e=_[_0xebdc('0x3e')]({},_0x3ea21e,_0xee31e3[_0xebdc('0x3f')]);return db[_0xebdc('0x2c')][_0xebdc('0x47')](_0x3ea21e)[_0xebdc('0x23')](handleEntityNotFound(_0x168cae,null))[_0xebdc('0x23')](function(_0x25a785){if(_0x25a785){var _0x6ab7f9=_0x25a785[_0xebdc('0x48')]({'plain':!![]});_0x6ab7f9=qs[_0xebdc('0x49')](_0x6ab7f9,['id',_0xebdc('0x4a'),'updatedAt']);_0xee31e3[_0xebdc('0x4b')]=_[_0xebdc('0x49')](_0xee31e3['body'],['id',_0xebdc('0x4a'),_0xebdc('0x4c')]);return db[_0xebdc('0x2c')][_0xebdc('0x4d')](_[_0xebdc('0x3e')](_0x6ab7f9,_0xee31e3[_0xebdc('0x4b')]),{'include':_0xee31e3[_0xebdc('0x30')][_0xebdc('0x40')]?[{'all':!![]}]:undefined});}})[_0xebdc('0x23')](respondWithResult(_0x168cae,0xc9))[_0xebdc('0x43')](handleError(_0x168cae,null));};exports[_0xebdc('0x21')]=function(_0x1c4252,_0x1f644b){if(_0x1c4252[_0xebdc('0x4b')]['id']){delete _0x1c4252[_0xebdc('0x4b')]['id'];}return db['Attachment'][_0xebdc('0x47')]({'where':{'id':_0x1c4252['params']['id']}})[_0xebdc('0x23')](handleEntityNotFound(_0x1f644b,null))['then'](saveUpdates(_0x1c4252[_0xebdc('0x4b')],null))[_0xebdc('0x23')](respondWithResult(_0x1f644b,null))[_0xebdc('0x43')](handleError(_0x1f644b,null));};exports[_0xebdc('0x22')]=function(_0x42014e,_0x165d8e){return db['Attachment'][_0xebdc('0x47')]({'where':{'id':_0x42014e['params']['id']}})[_0xebdc('0x23')](handleEntityNotFound(_0x165d8e,null))[_0xebdc('0x23')](removeEntity(_0x165d8e,null))[_0xebdc('0x43')](handleError(_0x165d8e,null));};exports[_0xebdc('0x4d')]=function(_0x5c04cd,_0x3bde10,_0x4322ed){_0x5c04cd[_0xebdc('0x4b')][_0xebdc('0x28')]=_0x5c04cd[_0xebdc('0x4e')][_0xebdc('0x4f')];_0x5c04cd[_0xebdc('0x4b')]['basename']=_0x5c04cd[_0xebdc('0x4e')]['filename'];_0x5c04cd[_0xebdc('0x4b')][_0xebdc('0x2e')]=_0x5c04cd[_0xebdc('0x4e')][_0xebdc('0x50')];return db[_0xebdc('0x2c')][_0xebdc('0x4d')](_0x5c04cd['body'])[_0xebdc('0x23')](respondWithResult(_0x3bde10,0xc9))['catch'](handleError(_0x3bde10,null));};exports[_0xebdc('0x51')]=function(_0x1dd006,_0x404367,_0x2923d0){return db[_0xebdc('0x2c')][_0xebdc('0x52')]({'where':{'id':_0x1dd006[_0xebdc('0x53')]['id']},'raw':!![]})[_0xebdc('0x23')](handleEntityNotFound(_0x404367,null))[_0xebdc('0x23')](function(_0x4312d9){if(_0x4312d9){var _0x3797fa=_0x4312d9[_0xebdc('0x54')]!==null;var _0x4f7902=path[_0xebdc('0x55')](config[_0xebdc('0x56')],_0xebdc('0x57'));if(_0x3797fa){_0x4f7902=path[_0xebdc('0x55')](_0x4f7902,'offline-chat/');}var _0x36013d=path[_0xebdc('0x55')](_0x4f7902,_0x4312d9[_0xebdc('0x58')]);return _0x404367['download'](_0x36013d);}})[_0xebdc('0x43')](handleError(_0x404367,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index f7811ac..39e57ec 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 _0x0c09=['exports','define','Attachment','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x570717,_0x2f9220){var _0x2667b5=function(_0x245a8f){while(--_0x245a8f){_0x570717['push'](_0x570717['shift']());}};_0x2667b5(++_0x2f9220);}(_0x0c09,0xcb));var _0x90c0=function(_0x54d213,_0xa0f779){_0x54d213=_0x54d213-0x0;var _0x1f18c6=_0x0c09[_0x54d213];return _0x1f18c6;};'use strict';var _=require('lodash');var util=require(_0x90c0('0x0'));var logger=require(_0x90c0('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x90c0('0x2'));var fs=require('fs');var path=require(_0x90c0('0x3'));var rimraf=require(_0x90c0('0x4'));var config=require(_0x90c0('0x5'));var attributes=require(_0x90c0('0x6'));module[_0x90c0('0x7')]=function(_0x837aed,_0x8faac2){return _0x837aed[_0x90c0('0x8')](_0x90c0('0x9'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x94f4=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','define','attachments','lodash'];(function(_0x3219ed,_0x441891){var _0xe0783a=function(_0x4b666e){while(--_0x4b666e){_0x3219ed['push'](_0x3219ed['shift']());}};_0xe0783a(++_0x441891);}(_0x94f4,0xdb));var _0x494f=function(_0x445b6d,_0x31af9b){_0x445b6d=_0x445b6d-0x0;var _0x1bcd5c=_0x94f4[_0x445b6d];return _0x1bcd5c;};'use strict';var _=require(_0x494f('0x0'));var util=require('util');var logger=require(_0x494f('0x1'))(_0x494f('0x2'));var moment=require(_0x494f('0x3'));var BPromise=require(_0x494f('0x4'));var rp=require(_0x494f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x494f('0x6'));var config=require(_0x494f('0x7'));var attributes=require(_0x494f('0x8'));module['exports']=function(_0x22abea,_0x5c9b07){return _0x22abea[_0x494f('0x9')]('Attachment',attributes,{'tableName':_0x494f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index a44b7c9..662a107 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 _0x4b1f=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','then','info','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Attachment,\x20%s,\x20%s','message','Attachment','create','options','CreateAttachment','lodash','util','bluebird'];(function(_0x33c7a9,_0x463a29){var _0x3aec79=function(_0x374dee){while(--_0x374dee){_0x33c7a9['push'](_0x33c7a9['shift']());}};_0x3aec79(++_0x463a29);}(_0x4b1f,0x195));var _0xf4b1=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x4b1f[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0xf4b1('0x0'));var util=require(_0xf4b1('0x1'));var moment=require('moment');var BPromise=require(_0xf4b1('0x2'));var rs=require(_0xf4b1('0x3'));var fs=require('fs');var Redis=require(_0xf4b1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf4b1('0x5'));var logger=require(_0xf4b1('0x6'))(_0xf4b1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf4b1('0x8')][_0xf4b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310db5,_0x3b9c78,_0x1abfc7){return new BPromise(function(_0x50738c,_0x59cf77){return client['request'](_0x310db5,_0x1abfc7)[_0xf4b1('0xa')](function(_0x53a786){logger[_0xf4b1('0xb')]('Attachment,\x20%s,\x20%s',_0x3b9c78,'request\x20sent');logger[_0xf4b1('0xc')](_0xf4b1('0xd'),_0x3b9c78,_0xf4b1('0xe'),JSON[_0xf4b1('0xf')](_0x53a786));if(_0x53a786[_0xf4b1('0x10')]){if(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x11')]===0x1f4){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);return _0x59cf77(_0x53a786[_0xf4b1('0x10')][_0xf4b1('0x13')]);}logger['error']('Attachment,\x20%s,\x20%s',_0x3b9c78,_0x53a786[_0xf4b1('0x10')]['message']);return _0x50738c(_0x53a786['error'][_0xf4b1('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x3b9c78,_0xf4b1('0xe'));_0x50738c(_0x53a786['result']['message']);}})['catch'](function(_0x5cb2a1){logger[_0xf4b1('0x10')](_0xf4b1('0x12'),_0x3b9c78,_0x5cb2a1);_0x59cf77(_0x5cb2a1);});});}exports['CreateAttachment']=function(_0x3b378e){var _0x420f9e=this;return new Promise(function(_0x322b38,_0x465da2){return db[_0xf4b1('0x14')][_0xf4b1('0x15')](_0x3b378e['body'],{'raw':_0x3b378e[_0xf4b1('0x16')]?_0x3b378e[_0xf4b1('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xf4b1('0xa')](function(_0x30c239){logger['info'](_0xf4b1('0x17'),_0x3b378e);logger[_0xf4b1('0xc')](_0xf4b1('0x17'),_0x3b378e,JSON[_0xf4b1('0xf')](_0x30c239));_0x322b38(_0x30c239);})['catch'](function(_0x20013c){logger[_0xf4b1('0x10')](_0xf4b1('0x17'),_0x20013c[_0xf4b1('0x13')],_0x3b378e);_0x465da2(_0x420f9e['error'](0x1f4,_0x20013c[_0xf4b1('0x13')]));});});}; \ No newline at end of file +var _0x34b2=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','body','options','raw','then','lodash','util','moment','bluebird'];(function(_0x1e67f3,_0x491f16){var _0x2bb38c=function(_0x55c3d0){while(--_0x55c3d0){_0x1e67f3['push'](_0x1e67f3['shift']());}};_0x2bb38c(++_0x491f16);}(_0x34b2,0x11c));var _0x234b=function(_0x1d0c7e,_0x40b36c){_0x1d0c7e=_0x1d0c7e-0x0;var _0x30cf02=_0x34b2[_0x1d0c7e];return _0x30cf02;};'use strict';var _=require(_0x234b('0x0'));var util=require(_0x234b('0x1'));var moment=require(_0x234b('0x2'));var BPromise=require(_0x234b('0x3'));var rs=require(_0x234b('0x4'));var fs=require('fs');var Redis=require(_0x234b('0x5'));var db=require(_0x234b('0x6'))['db'];var utils=require(_0x234b('0x7'));var logger=require(_0x234b('0x8'))(_0x234b('0x9'));var config=require(_0x234b('0xa'));var jayson=require(_0x234b('0xb'));var client=jayson[_0x234b('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fac7,_0x5e71ac,_0x2eb07e){return new BPromise(function(_0x84f1f0,_0x153974){return client[_0x234b('0xd')](_0x52fac7,_0x2eb07e)['then'](function(_0x4f4899){logger[_0x234b('0xe')](_0x234b('0xf'),_0x5e71ac,_0x234b('0x10'));logger[_0x234b('0x11')](_0x234b('0x12'),_0x5e71ac,_0x234b('0x10'),JSON[_0x234b('0x13')](_0x4f4899));if(_0x4f4899[_0x234b('0x14')]){if(_0x4f4899[_0x234b('0x14')][_0x234b('0x15')]===0x1f4){logger[_0x234b('0x14')](_0x234b('0xf'),_0x5e71ac,_0x4f4899[_0x234b('0x14')]['message']);return _0x153974(_0x4f4899[_0x234b('0x14')][_0x234b('0x16')]);}logger['error'](_0x234b('0xf'),_0x5e71ac,_0x4f4899[_0x234b('0x14')]['message']);return _0x84f1f0(_0x4f4899[_0x234b('0x14')][_0x234b('0x16')]);}else{logger[_0x234b('0xe')](_0x234b('0xf'),_0x5e71ac,_0x234b('0x10'));_0x84f1f0(_0x4f4899[_0x234b('0x17')][_0x234b('0x16')]);}})[_0x234b('0x18')](function(_0x1fb3d8){logger['error'](_0x234b('0xf'),_0x5e71ac,_0x1fb3d8);_0x153974(_0x1fb3d8);});});}exports[_0x234b('0x19')]=function(_0x18153a){var _0x22696d=this;return new Promise(function(_0x4424a1,_0x530e4a){return db[_0x234b('0x1a')][_0x234b('0x1b')](_0x18153a[_0x234b('0x1c')],{'raw':_0x18153a[_0x234b('0x1d')]?_0x18153a['options'][_0x234b('0x1e')]===undefined?!![]:![]:!![]})[_0x234b('0x1f')](function(_0x2a47e1){logger[_0x234b('0xe')](_0x234b('0x19'),_0x18153a);logger['debug'](_0x234b('0x19'),_0x18153a,JSON[_0x234b('0x13')](_0x2a47e1));_0x4424a1(_0x2a47e1);})['catch'](function(_0x184e98){logger[_0x234b('0x14')](_0x234b('0x19'),_0x184e98[_0x234b('0x16')],_0x18153a);_0x530e4a(_0x22696d[_0x234b('0x14')](0x1f4,_0x184e98[_0x234b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index f82649d..e669ecc 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['root','format','%s-%s','originalname','replace','file','put','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','post','/:id/clone'];(function(_0x2e5753,_0x578b92){var _0xd00a9b=function(_0xb10184){while(--_0xb10184){_0x2e5753['push'](_0x2e5753['shift']());}};_0xd00a9b(++_0x578b92);}(_0xadb5,0xad));var _0x5adb=function(_0x237f31,_0x2fc654){_0x237f31=_0x237f31-0x0;var _0x4de10f=_0xadb5[_0x237f31];return _0x4de10f;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./attachment.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller['clone']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1a8f66,_0x1ea238,_0x82e67e){_0x82e67e(null,path['join'](config[_0x5adb('0x10')],'server/files/attachments/'));},'filename':function(_0x2a0b70,_0x5433bf,_0x8cfcc6){_0x8cfcc6(null,util[_0x5adb('0x11')](_0x5adb('0x12'),Date['now'](),_0x5433bf[_0x5adb('0x13')][_0x5adb('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x5adb('0xe')]('/',upload['single'](_0x5adb('0x15')),controller['create']);router[_0x5adb('0x16')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x17')]);router[_0x5adb('0x18')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x19')]);module[_0x5adb('0x1a')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x3a1ea5,_0x349f01){var _0xfac9b2=function(_0xd5310c){while(--_0xd5310c){_0x3a1ea5['push'](_0x3a1ea5['shift']());}};_0xfac9b2(++_0x349f01);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0d2b981..365beb7 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 _0xefe9=['baseDN','url','domain','authenticate','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','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','user','agent','add','minutes','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','Strategy','activedirectory2','bluebird','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','api','activedirectory'];(function(_0x5271ec,_0x295a44){var _0x257e8e=function(_0x31c5af){while(--_0x31c5af){_0x5271ec['push'](_0x5271ec['shift']());}};_0x257e8e(++_0x295a44);}(_0xefe9,0x83));var _0x9efe=function(_0x5ba002,_0x44935a){_0x5ba002=_0x5ba002-0x0;var _0xd3b69b=_0xefe9[_0x5ba002];return _0xd3b69b;};'use strict';var passport=require(_0x9efe('0x0'));var LocalStrategy=require('passport-local')[_0x9efe('0x1')];var moment=require('moment');var ActiveDirectory=require(_0x9efe('0x2'));var BPromise=require(_0x9efe('0x3'));var util=require('util');var db=require(_0x9efe('0x4'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x9efe('0x5'));var config=require(_0x9efe('0x6'));var logger=require(_0x9efe('0x7'))(_0x9efe('0x8'));function isActiveDirectoryConfigured(_0x333ef7){var _0xb8b973=![];if(typeof _0x333ef7[_0x9efe('0x9')]!=='undefined'){_0xb8b973=_0x333ef7[_0x9efe('0x9')][_0x9efe('0xa')]&&_0x333ef7[_0x9efe('0x9')][_0x9efe('0xb')]&&_0x333ef7[_0x9efe('0x9')][_0x9efe('0xc')];}return _0xb8b973;}function adAuthenticate(_0x1d3a65,_0xcc0b43,_0x1ba171){return new BPromise(function(_0x6f12c7,_0x512054){try{var _0x1e0fb0=new ActiveDirectory(_0x1d3a65);_0x1e0fb0[_0x9efe('0xd')](_0xcc0b43,_0x1ba171,function(_0x536ea4,_0x5e3473){if(_0x536ea4){logger['error'](_0x9efe('0xe'),_0xcc0b43,util[_0x9efe('0xf')](_0x536ea4,{'showHidden':![],'depth':null}));_0x512054(_0x9efe('0x10'));}else if(!_0x5e3473){logger[_0x9efe('0x11')](_0x9efe('0x12'),_0xcc0b43);_0x512054(_0x9efe('0x10'));}else{_0x6f12c7(_0x5e3473);}});}catch(_0x548b7f){_0x512054(_0x548b7f);}});}function ActiveDirectoryAuthenticate(_0xc0c734,_0x54df74,_0x199594,_0x2e78f8){var _0x34cf83,_0x577595;if(!isActiveDirectoryConfigured(config)){logger[_0x9efe('0x11')](_0x9efe('0x13'),_0x54df74);return _0x2e78f8(null,![],{'message':_0x9efe('0x10')});}return db[_0x9efe('0x14')]['findOne']({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x9efe('0x15')],'raw':!![]})[_0x9efe('0x16')](function(_0x5ad3fa){_0x34cf83=_0x5ad3fa;if(!_0x34cf83['adSsoEnabled']){logger[_0x9efe('0x11')](_0x9efe('0x17'),_0x54df74);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0xc0c734['findOne']({'attributes':['id',_0x9efe('0x18'),_0x9efe('0x19'),_0x9efe('0x1a'),_0x9efe('0x1b'),_0x9efe('0x1c'),_0x9efe('0x1d'),_0x9efe('0x1e'),_0x9efe('0x1f')],'where':{'name':_0x54df74,'role':{'$or':['admin',_0x9efe('0x20'),_0x9efe('0x21')]},'adSsoEnabled':!![]}});})[_0x9efe('0x16')](function(_0x99f380){if(!_0x99f380||_0x99f380&&_0x99f380[_0x9efe('0x18')]!==_0x54df74){throw new Error(_0x9efe('0x10'));}_0x577595=_0x99f380;var _0x445257=_0x577595['name']+'@'+config[_0x9efe('0x9')][_0x9efe('0xc')];return adAuthenticate(config[_0x9efe('0x9')],_0x445257,_0x199594);})['then'](function(_0x2490f8){if(_0x577595['disabled']){throw new Error(_0x9efe('0x10'));}if(_0x34cf83['blockDuration']>0x0){if(_0x577595[_0x9efe('0x1d')]){if(moment(_0x577595['blockedAt'])[_0x9efe('0x22')](_0x34cf83[_0x9efe('0x15')],_0x9efe('0x23'))>moment()){throw new Error(_0x9efe('0x10'));}return utils['clearBlockUser'](_0x577595,0x0,![],null)[_0x9efe('0x16')](function(){return utils[_0x9efe('0x24')](_0x577595);})[_0x9efe('0x16')](function(){return _0x2e78f8(null,_0x577595);});}else{return utils['getLicense'](_0x577595)[_0x9efe('0x16')](function(){return _0x2e78f8(null,_0x577595);});}}else{return utils['getLicense'](_0x577595)[_0x9efe('0x16')](function(){return _0x2e78f8(null,_0x577595);});}})['catch'](function(_0x5e07cb){return _0x2e78f8(null,![],_0x5e07cb);});}function handleError(_0x160869,_0x43f07f,_0x424a72){return _0x160869[_0x9efe('0x25')](_0x43f07f||0x1f4)[_0x9efe('0x26')]({'message':_0x424a72?_0x424a72[_0x9efe('0x27')]||_0x424a72:''});}exports[_0x9efe('0x28')]=function(_0x4234cf,_0x32071c,_0x403ca1){passport[_0x9efe('0xd')](_0x9efe('0x29'),function(_0xde9b38,_0x4002f1,_0x1e0208){var _0x231790=_0xde9b38||_0x1e0208;if(_0x231790){return handleError(_0x32071c,0x191,_0x231790);}if(!_0x4002f1){return handleError(_0x32071c,0x194,{'message':_0x9efe('0x2a')});}else{var _0x2f4869={'payload':{'id':_0x4002f1['id'],'role':_0x4002f1[_0x9efe('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x9efe('0x2b')](_0x2f4869)['then'](function(_0x2912c4){_0x32071c[_0x9efe('0x2c')]({'id':_0x4002f1['id'],'token':_0x2912c4,'statusCall':'','isAlreadyLogged':_0x4002f1[_0x9efe('0x1f')]});});}})(_0x4234cf,_0x32071c,_0x403ca1);};passport[_0x9efe('0x2d')](_0x9efe('0x29'),new LocalStrategy({'usernameField':_0x9efe('0x18'),'passwordField':_0x9efe('0x19')},function(_0x399abb,_0x3b7cb1,_0x1b4711){return ActiveDirectoryAuthenticate(db[_0x9efe('0x2e')],_0x399abb,_0x3b7cb1,_0x1b4711);})); \ No newline at end of file +var _0xbb27=['password','salt','role','blockedAt','admin','user','name','blocked','add','clearBlockUser','getLicense','status','send','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','use','User','passport','passport-local','moment','activedirectory2','util','../../mysqldb','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','domain','authenticate','error','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbb27,0x1cd));var _0x7bb2=function(_0x41339a,_0x28fdc4){_0x41339a=_0x41339a-0x0;var _0x3fe50a=_0xbb27[_0x41339a];return _0x3fe50a;};'use strict';var passport=require(_0x7bb2('0x0'));var LocalStrategy=require(_0x7bb2('0x1'))['Strategy'];var moment=require(_0x7bb2('0x2'));var ActiveDirectory=require(_0x7bb2('0x3'));var BPromise=require('bluebird');var util=require(_0x7bb2('0x4'));var db=require(_0x7bb2('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x7bb2('0x6'));var config=require(_0x7bb2('0x7'));var logger=require(_0x7bb2('0x8'))('api');function isActiveDirectoryConfigured(_0x2a42c7){var _0x35e860=![];if(typeof _0x2a42c7[_0x7bb2('0x9')]!==_0x7bb2('0xa')){_0x35e860=_0x2a42c7[_0x7bb2('0x9')][_0x7bb2('0xb')]&&_0x2a42c7['activedirectory']['url']&&_0x2a42c7[_0x7bb2('0x9')][_0x7bb2('0xc')];}return _0x35e860;}function adAuthenticate(_0x2971a3,_0x4a4e9d,_0x16e33b){return new BPromise(function(_0x4ed512,_0x381ffc){try{var _0x34070f=new ActiveDirectory(_0x2971a3);_0x34070f[_0x7bb2('0xd')](_0x4a4e9d,_0x16e33b,function(_0x1d49e4,_0x349bb5){if(_0x1d49e4){logger[_0x7bb2('0xe')]('Error\x20authenticate\x20%s:\x20%s',_0x4a4e9d,util[_0x7bb2('0xf')](_0x1d49e4,{'showHidden':![],'depth':null}));_0x381ffc('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x349bb5){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x4a4e9d);_0x381ffc(_0x7bb2('0x10'));}else{_0x4ed512(_0x349bb5);}});}catch(_0x4d467c){_0x381ffc(_0x4d467c);}});}function ActiveDirectoryAuthenticate(_0x3c7c7c,_0x32ebd4,_0x1745ec,_0x5f5c31){var _0x512585,_0x205116;if(!isActiveDirectoryConfigured(config)){logger[_0x7bb2('0xe')](_0x7bb2('0x11'),_0x32ebd4);return _0x5f5c31(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db[_0x7bb2('0x12')][_0x7bb2('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled',_0x7bb2('0x14')],'raw':!![]})[_0x7bb2('0x15')](function(_0x3dc2e5){_0x512585=_0x3dc2e5;if(!_0x512585['adSsoEnabled']){logger['error'](_0x7bb2('0x16'),_0x32ebd4);throw new Error(_0x7bb2('0x10'));}return _0x3c7c7c[_0x7bb2('0x13')]({'attributes':['id','name',_0x7bb2('0x17'),_0x7bb2('0x18'),_0x7bb2('0x19'),'disabled','blocked',_0x7bb2('0x1a'),'online'],'where':{'name':_0x32ebd4,'role':{'$or':[_0x7bb2('0x1b'),_0x7bb2('0x1c'),'agent']},'adSsoEnabled':!![]}});})[_0x7bb2('0x15')](function(_0x4fcacf){if(!_0x4fcacf||_0x4fcacf&&_0x4fcacf[_0x7bb2('0x1d')]!==_0x32ebd4){throw new Error(_0x7bb2('0x10'));}_0x205116=_0x4fcacf;var _0x27b2fe=_0x205116[_0x7bb2('0x1d')]+'@'+config[_0x7bb2('0x9')][_0x7bb2('0xc')];return adAuthenticate(config[_0x7bb2('0x9')],_0x27b2fe,_0x1745ec);})[_0x7bb2('0x15')](function(_0x1e73db){if(_0x205116['disabled']){throw new Error(_0x7bb2('0x10'));}if(_0x512585[_0x7bb2('0x14')]>0x0){if(_0x205116[_0x7bb2('0x1e')]){if(moment(_0x205116[_0x7bb2('0x1a')])[_0x7bb2('0x1f')](_0x512585[_0x7bb2('0x14')],'minutes')>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x7bb2('0x20')](_0x205116,0x0,![],null)[_0x7bb2('0x15')](function(){return utils['getLicense'](_0x205116);})[_0x7bb2('0x15')](function(){return _0x5f5c31(null,_0x205116);});}else{return utils[_0x7bb2('0x21')](_0x205116)[_0x7bb2('0x15')](function(){return _0x5f5c31(null,_0x205116);});}}else{return utils['getLicense'](_0x205116)['then'](function(){return _0x5f5c31(null,_0x205116);});}})['catch'](function(_0x13ec8a){return _0x5f5c31(null,![],_0x13ec8a);});}function handleError(_0x2fa7d2,_0x3c3ac5,_0x5622cb){return _0x2fa7d2[_0x7bb2('0x22')](_0x3c3ac5||0x1f4)[_0x7bb2('0x23')]({'message':_0x5622cb?_0x5622cb['message']||_0x5622cb:''});}exports[_0x7bb2('0x24')]=function(_0x184636,_0x2a1f44,_0x346087){passport[_0x7bb2('0xd')](_0x7bb2('0x25'),function(_0x16756c,_0x2afb7f,_0x19f1e5){var _0x1870c9=_0x16756c||_0x19f1e5;if(_0x1870c9){return handleError(_0x2a1f44,0x191,_0x1870c9);}if(!_0x2afb7f){return handleError(_0x2a1f44,0x194,{'message':_0x7bb2('0x26')});}else{var _0x34cda4={'payload':{'id':_0x2afb7f['id'],'role':_0x2afb7f[_0x7bb2('0x19')]},'options':{'expiresIn':0x15180}};return authService[_0x7bb2('0x27')](_0x34cda4)[_0x7bb2('0x15')](function(_0x62e935){_0x2a1f44[_0x7bb2('0x28')]({'id':_0x2afb7f['id'],'token':_0x62e935,'statusCall':'','isAlreadyLogged':_0x2afb7f[_0x7bb2('0x29')]});});}})(_0x184636,_0x2a1f44,_0x346087);};passport[_0x7bb2('0x2a')](_0x7bb2('0x25'),new LocalStrategy({'usernameField':_0x7bb2('0x1d'),'passwordField':_0x7bb2('0x17')},function(_0x256437,_0x543eaf,_0x10ccde){return ActiveDirectoryAuthenticate(db[_0x7bb2('0x2b')],_0x256437,_0x543eaf,_0x10ccde);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 735ee33..5ea1ec2 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 _0x0b03=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x5631c2,_0xd87182){var _0x2cd5cb=function(_0x292f74){while(--_0x292f74){_0x5631c2['push'](_0x5631c2['shift']());}};_0x2cd5cb(++_0xd87182);}(_0x0b03,0xb8));var _0x30b0=function(_0x44cf57,_0x13a9e4){_0x44cf57=_0x44cf57-0x0;var _0x3b9f1d=_0x0b03[_0x44cf57];return _0x3b9f1d;};'use strict';var express=require(_0x30b0('0x0'));var router=express[_0x30b0('0x1')]();var controller=require(_0x30b0('0x2'));router[_0x30b0('0x3')]('/',controller[_0x30b0('0x4')]);module[_0x30b0('0x5')]=router; \ No newline at end of file +var _0xb28a=['exports','express','Router','post','login'];(function(_0x38680b,_0x39c732){var _0x239598=function(_0x782464){while(--_0x782464){_0x38680b['push'](_0x38680b['shift']());}};_0x239598(++_0x39c732);}(_0xb28a,0x1b9));var _0xab28=function(_0x33e233,_0x31495f){_0x33e233=_0x33e233-0x0;var _0x689d90=_0xb28a[_0x33e233];return _0x689d90;};'use strict';var express=require(_0xab28('0x0'));var router=express[_0xab28('0x1')]();var controller=require('./authActiveDirectory.controller');router[_0xab28('0x2')]('/',controller[_0xab28('0x3')]);module[_0xab28('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 c4935f9..43cd369 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x7a54,0x106));var _0x47a5=function(_0x3ba5ce,_0x426c44){_0x3ba5ce=_0x3ba5ce-0x0;var _0x4b95ad=_0x7a54[_0x3ba5ce];return _0x4b95ad;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x7a54,0x106));var _0x47a5=function(_0x489f92,_0x2b8830){_0x489f92=_0x489f92-0x0;var _0x459455=_0x7a54[_0x489f92];return _0x459455;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2e013d1..899ed04 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 _0xd246=['login','/callback','isMiddleware','setTokenCookie','exports','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x36186a,_0x4ab8de){var _0x4fb753=function(_0x514766){while(--_0x514766){_0x36186a['push'](_0x36186a['shift']());}};_0x4fb753(++_0x4ab8de);}(_0xd246,0xf5));var _0x6d24=function(_0x2111bc,_0x2d65d5){_0x2111bc=_0x2111bc-0x0;var _0x1ff93b=_0xd246[_0x2111bc];return _0x1ff93b;};'use strict';var express=require(_0x6d24('0x0'));var passport=require(_0x6d24('0x1'));var router=express[_0x6d24('0x2')]();var controller=require(_0x6d24('0x3'));var userController=require(_0x6d24('0x4'));var authService=require(_0x6d24('0x5'));router[_0x6d24('0x6')]('/',controller[_0x6d24('0x7')]);router['get'](_0x6d24('0x8'),controller['callback'],authService[_0x6d24('0x9')],userController['login'],authService[_0x6d24('0xa')]);module[_0x6d24('0xb')]=router; \ No newline at end of file +var _0x7710=['../user/user.controller.js','../../components/auth/service','get','login','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller'];(function(_0x36f7da,_0xb27fe0){var _0x106ef1=function(_0x24271f){while(--_0x24271f){_0x36f7da['push'](_0x36f7da['shift']());}};_0x106ef1(++_0xb27fe0);}(_0x7710,0x130));var _0x0771=function(_0x13cab2,_0x148058){_0x13cab2=_0x13cab2-0x0;var _0x292c90=_0x7710[_0x13cab2];return _0x292c90;};'use strict';var express=require('express');var passport=require(_0x0771('0x0'));var router=express['Router']();var controller=require(_0x0771('0x1'));var userController=require(_0x0771('0x2'));var authService=require(_0x0771('0x3'));router[_0x0771('0x4')]('/',controller[_0x0771('0x5')]);router['get']('/callback',controller['callback'],authService[_0x0771('0x6')],userController[_0x0771('0x5')],authService[_0x0771('0x7')]);module[_0x0771('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 ae9e2d9..6c2fc78 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 _0x152b=['If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','password','resetPasswordToken','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','find','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','host','/reset/'];(function(_0x1d72d6,_0x1517de){var _0x5d7e7b=function(_0xe589d8){while(--_0xe589d8){_0x1d72d6['push'](_0x1d72d6['shift']());}};_0x5d7e7b(++_0x1517de);}(_0x152b,0x109));var _0xb152=function(_0x53a7af,_0x1408a5){_0x53a7af=_0x53a7af-0x0;var _0x3cc7f6=_0x152b[_0x53a7af];return _0x3cc7f6;};'use strict';var util=require(_0xb152('0x0'));var passport=require(_0xb152('0x1'));var LocalStrategy=require(_0xb152('0x2'))[_0xb152('0x3')];var jayson=require(_0xb152('0x4'));var _=require(_0xb152('0x5'));var rs=require('randomstring');var moment=require(_0xb152('0x6'));var db=require(_0xb152('0x7'))['db'];var authService=require(_0xb152('0x8'));var utils=require(_0xb152('0x9'));var client=jayson[_0xb152('0xa')][_0xb152('0xb')]({'port':0x232b});function localAuthenticate(_0x111ce7,_0xdbcdb5,_0x443751,_0x25ec24){var _0xdb8a00,_0x5e114e;return db[_0xb152('0xc')][_0xb152('0xd')]({'where':{'id':0x1},'attributes':[_0xb152('0xe'),_0xb152('0xf')],'raw':!![]})[_0xb152('0x10')](function(_0x47220c){_0xdb8a00=_0x47220c;return _0x111ce7[_0xb152('0xd')]({'attributes':['id',_0xb152('0x11'),'password','salt','role','disabled',_0xb152('0x12'),_0xb152('0x13'),_0xb152('0x14')],'where':{'name':_0xdbcdb5,'role':{'$or':[_0xb152('0x15'),_0xb152('0x16'),_0xb152('0x17')]}}});})[_0xb152('0x10')](function(_0x5a31bf){if(!_0x5a31bf||_0x5a31bf&&_0x5a31bf[_0xb152('0x11')]!==_0xdbcdb5){throw new Error(_0xb152('0x18'));}else{_0x5e114e=_0x5a31bf;return _0x5e114e;}})['then'](function(){_0x5e114e['authenticate'](_0x443751,function(_0x1001ca,_0x299c32){var _0x4646dd=_0x5e114e[_0xb152('0x14')]+0x1;if(_0x1001ca){return _0x25ec24(_0x1001ca);}else if(!_0x299c32){if(_0x5e114e[_0xb152('0x19')]){return _0x25ec24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0xdb8a00[_0xb152('0xe')]>0x0){if(_0x5e114e['blocked']){if(_0xdb8a00[_0xb152('0xf')]>0x0){if(moment(_0x5e114e[_0xb152('0x13')])[_0xb152('0x1a')](_0xdb8a00[_0xb152('0xf')],_0xb152('0x1b'))>moment()){return _0x25ec24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb152('0x1c')](_0x5e114e,_0x4646dd,![],null)[_0xb152('0x10')](function(){return _0x25ec24(null,![],{'message':_0xb152('0x18')});});}}else{return _0x25ec24(null,![],{'message':_0xb152('0x18')});}}else{if(_0x4646dd>=_0xdb8a00[_0xb152('0xe')]){return utils['clearBlockUser'](_0x5e114e,0x0,!![],moment())[_0xb152('0x10')](function(){return _0x25ec24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x5e114e,_0x4646dd,![],null)['then'](function(){return _0x25ec24(null,![],{'message':_0xb152('0x18')});});}}}else{return _0x25ec24(null,![],{'message':_0xb152('0x18')});}}else{if(_0x5e114e[_0xb152('0x19')]){return _0x25ec24(null,![],{'message':_0xb152('0x18')});}else if(_0xdb8a00['allowedLoginAttempts']>0x0){if(_0x5e114e[_0xb152('0x12')]){if(_0xdb8a00['blockDuration']>0x0){if(moment(_0x5e114e[_0xb152('0x13')])['add'](_0xdb8a00[_0xb152('0xf')],_0xb152('0x1b'))>moment()){return _0x25ec24(null,![],{'message':_0xb152('0x18')});}else{return utils[_0xb152('0x1c')](_0x5e114e,0x0,![],null)[_0xb152('0x10')](function(){return utils[_0xb152('0x1d')](_0x5e114e);})[_0xb152('0x10')](function(){return _0x25ec24(null,_0x5e114e);});}}else{return _0x25ec24(null,![],{'message':_0xb152('0x18')});}}else{return utils[_0xb152('0x1c')](_0x5e114e,0x0,![],null)[_0xb152('0x10')](function(){return utils[_0xb152('0x1d')](_0x5e114e);})[_0xb152('0x10')](function(){return _0x25ec24(null,_0x5e114e);})[_0xb152('0x1e')](function(_0x51f6b2){return _0x25ec24(null,![],_0x51f6b2);});}}else{if(_0x5e114e[_0xb152('0x12')]){return _0x25ec24(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xb152('0x1d')](_0x5e114e)[_0xb152('0x10')](function(){return _0x25ec24(null,_0x5e114e);});}}}});})[_0xb152('0x1e')](function(_0x53a704){return _0x25ec24(null,![],_0x53a704);});}function sendServiceMail(_0x296f0c){return db[_0xb152('0x1f')]['find']({'where':{'service':!![]},'attributes':['id','name',_0xb152('0x20')],'include':[{'model':db[_0xb152('0x21')],'as':_0xb152('0x22'),'include':[{'model':db['CloudProvider'],'as':_0xb152('0x23')}]}]})['then'](function(_0x4f74e2){if(!_0x4f74e2){throw new Error(_0xb152('0x24'));}var _0x397166=_0x4f74e2[_0xb152('0x25')]();var _0x569ffd={'account':_0x397166,'message':_[_0xb152('0x26')]({'from':util[_0xb152('0x27')](_0xb152('0x28'),_0x4f74e2[_0xb152('0x11')],_0x4f74e2['email']||_0x4f74e2[_0xb152('0x22')]['user'])},_0x296f0c)};return client[_0xb152('0x29')]('SendMail',_0x569ffd);})[_0xb152('0x10')](function(_0x2ac248){if(_0x2ac248[_0xb152('0x2a')]){throw new Error(util[_0xb152('0x27')](_0xb152('0x2b'),_0x2ac248['error'][_0xb152('0x2c')]||JSON['stringify'](_0x2ac248[_0xb152('0x2a')])));}return!![];});}function handleError(_0x413bd2,_0x26831f,_0x386088){return _0x413bd2[_0xb152('0x2d')](_0x26831f||0x1f4)['send']({'message':_0x386088?_0x386088[_0xb152('0x2c')]||_0x386088:''});}exports[_0xb152('0x2e')]=function(_0x237a8d,_0x3ba2ee,_0x42167c){passport[_0xb152('0x2f')](_0xb152('0x30'),function(_0x136c29,_0x126758,_0x5310ec){var _0x26579e=_0x136c29||_0x5310ec;if(_0x26579e){return handleError(_0x3ba2ee,0x191,_0x26579e);}if(!_0x126758){return handleError(_0x3ba2ee,0x194,{'message':_0xb152('0x31')});}else{var _0x32ab8c={'payload':{'id':_0x126758['id'],'role':_0x126758[_0xb152('0x32')]},'options':{'expiresIn':0x15180}};return authService[_0xb152('0x33')](_0x32ab8c)[_0xb152('0x10')](function(_0x256f08){_0x3ba2ee[_0xb152('0x34')]({'id':_0x126758['id'],'token':_0x256f08,'statusCall':'','isAlreadyLogged':_0x126758[_0xb152('0x35')]});});}})(_0x237a8d,_0x3ba2ee,_0x42167c);};exports[_0xb152('0x36')]=function(_0x4a6806,_0x479e7e){if(!_0x4a6806[_0xb152('0x37')][_0xb152('0x20')]){return handleError(_0x479e7e,0x1f4,{'message':_0xb152('0x38')});}var _0x57d836=rs[_0xb152('0x39')]();_0x4a6806['body'][_0xb152('0x20')]=_0x4a6806[_0xb152('0x37')][_0xb152('0x20')][_0xb152('0x3a')]()[_0xb152('0x3b')]();var _0x2c5e90;return db['Setting'][_0xb152('0xd')]({'where':{'id':0x1},'attributes':[_0xb152('0xe'),_0xb152('0xf')],'raw':!![]})['then'](function(_0x3dc09d){_0x2c5e90=_0x3dc09d;return db['User'][_0xb152('0x3c')]({'where':{'email':_0x4a6806['body']['email']}});})['then'](function(_0x4b5344){if(!_0x4b5344){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4b5344['disabled']){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x4b5344[_0xb152('0x12')]){if(moment(_0x4b5344[_0xb152('0x13')])[_0xb152('0x1a')](_0x2c5e90['blockDuration'],_0xb152('0x1b'))>moment()){throw new Error(_0xb152('0x3d'));}else{_0x4b5344[_0xb152('0x12')]=![];_0x4b5344[_0xb152('0x13')]=null;}}_0x4b5344['resetPasswordToken']=_0x57d836;_0x4b5344['resetPasswordExpires']=Date[_0xb152('0x3e')]()+0x36ee80;return _0x4b5344[_0xb152('0x3f')]();})[_0xb152('0x10')](function(){return sendServiceMail({'to':_0x4a6806[_0xb152('0x37')][_0xb152('0x20')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xb152('0x40')+'https://'+_0x4a6806['headers'][_0xb152('0x41')]+_0xb152('0x42')+_0x57d836+'\x0a\x0a'+_0xb152('0x43')});})['then'](function(){_0x479e7e[_0xb152('0x2d')](0xc8)['send']({'message':_0xb152('0x44')});})[_0xb152('0x1e')](function(_0x5d66d6){return handleError(_0x479e7e,0x1f4,_0x5d66d6);});};exports[_0xb152('0x45')]=function(_0x512ac7,_0x3139a9){return db[_0xb152('0x46')]['find']({'where':{'resetPasswordToken':_0x512ac7['params'][_0xb152('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0xb152('0x10')](function(_0x358305){if(!_0x358305){throw new Error(_0xb152('0x48'));}return db[_0xb152('0xc')][_0xb152('0xd')]({'attributes':['id',_0xb152('0x49'),_0xb152('0x4a'),_0xb152('0x4b')]})[_0xb152('0x10')](function(_0x4b414a){if(_0x4b414a[_0xb152('0x49')])authService[_0xb152('0x4c')](_0x512ac7[_0xb152('0x37')]['password']);if(!_0x4b414a[_0xb152('0x4a')]||!_0x358305[_0xb152('0x4d')])return _0x358305;authService['validatePasswordHistory'](_0x512ac7['body'][_0xb152('0x4e')],_0x358305[_0xb152('0x4d')],_0x4b414a[_0xb152('0x4b')]);return _0x358305;})[_0xb152('0x10')](function(){_0x358305[_0xb152('0x4e')]=_0x512ac7['body'][_0xb152('0x4e')];_0x358305[_0xb152('0x4f')]=null;_0x358305[_0xb152('0x50')]=null;return _0x358305['save']();});})[_0xb152('0x10')](function(){_0x3139a9['status'](0xc8)['send']({'message':_0xb152('0x51')});})['catch'](function(_0x28f38f){return handleError(_0x3139a9,0x1f4,_0x28f38f);});};passport[_0xb152('0x52')](_0xb152('0x30'),new LocalStrategy({'usernameField':_0xb152('0x11'),'passwordField':'password'},function(_0x6633ff,_0xefc06c,_0x19a1d0){return localAuthenticate(db[_0xb152('0x46')],_0x6633ff,_0xefc06c,_0x19a1d0);})); \ No newline at end of file +var _0xba10=['Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','Password\x20reset!','use','passport','passport-local','Strategy','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','salt','role','disabled','blocked','blockedAt','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','allowedLoginAttempts','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','\x22%s\x22\x20<%s>','request','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login'];(function(_0x2b6793,_0x5aa576){var _0x314d0d=function(_0x3cbf54){while(--_0x3cbf54){_0x2b6793['push'](_0x2b6793['shift']());}};_0x314d0d(++_0x5aa576);}(_0xba10,0xc8));var _0x0ba1=function(_0x200733,_0xfe1ffb){_0x200733=_0x200733-0x0;var _0xb926be=_0xba10[_0x200733];return _0xb926be;};'use strict';var util=require('util');var passport=require(_0x0ba1('0x0'));var LocalStrategy=require(_0x0ba1('0x1'))[_0x0ba1('0x2')];var jayson=require('jayson/promise');var _=require(_0x0ba1('0x3'));var rs=require(_0x0ba1('0x4'));var moment=require(_0x0ba1('0x5'));var db=require(_0x0ba1('0x6'))['db'];var authService=require(_0x0ba1('0x7'));var utils=require(_0x0ba1('0x8'));var client=jayson[_0x0ba1('0x9')][_0x0ba1('0xa')]({'port':0x232b});function localAuthenticate(_0x552444,_0x46d1ba,_0x17e51e,_0x16cd19){var _0x315e47,_0x343d62;return db[_0x0ba1('0xb')][_0x0ba1('0xc')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x0ba1('0xd')],'raw':!![]})[_0x0ba1('0xe')](function(_0x16e8ad){_0x315e47=_0x16e8ad;return _0x552444[_0x0ba1('0xc')]({'attributes':['id',_0x0ba1('0xf'),_0x0ba1('0x10'),_0x0ba1('0x11'),_0x0ba1('0x12'),_0x0ba1('0x13'),_0x0ba1('0x14'),_0x0ba1('0x15'),'loginAttempts'],'where':{'name':_0x46d1ba,'role':{'$or':[_0x0ba1('0x16'),_0x0ba1('0x17'),'agent']}}});})[_0x0ba1('0xe')](function(_0x2ff8fc){if(!_0x2ff8fc||_0x2ff8fc&&_0x2ff8fc[_0x0ba1('0xf')]!==_0x46d1ba){throw new Error(_0x0ba1('0x18'));}else{_0x343d62=_0x2ff8fc;return _0x343d62;}})[_0x0ba1('0xe')](function(){_0x343d62[_0x0ba1('0x19')](_0x17e51e,function(_0x743264,_0x1a29b8){var _0x4cc551=_0x343d62[_0x0ba1('0x1a')]+0x1;if(_0x743264){return _0x16cd19(_0x743264);}else if(!_0x1a29b8){if(_0x343d62['disabled']){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}else if(_0x315e47[_0x0ba1('0x1b')]>0x0){if(_0x343d62['blocked']){if(_0x315e47[_0x0ba1('0xd')]>0x0){if(moment(_0x343d62['blockedAt'])[_0x0ba1('0x1c')](_0x315e47[_0x0ba1('0xd')],_0x0ba1('0x1d'))>moment()){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}else{return utils[_0x0ba1('0x1e')](_0x343d62,_0x4cc551,![],null)[_0x0ba1('0xe')](function(){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});});}}else{return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}}else{if(_0x4cc551>=_0x315e47[_0x0ba1('0x1b')]){return utils[_0x0ba1('0x1e')](_0x343d62,0x0,!![],moment())[_0x0ba1('0xe')](function(){return _0x16cd19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x343d62,_0x4cc551,![],null)[_0x0ba1('0xe')](function(){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});});}}}else{return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}}else{if(_0x343d62[_0x0ba1('0x13')]){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}else if(_0x315e47[_0x0ba1('0x1b')]>0x0){if(_0x343d62[_0x0ba1('0x14')]){if(_0x315e47[_0x0ba1('0xd')]>0x0){if(moment(_0x343d62[_0x0ba1('0x15')])['add'](_0x315e47[_0x0ba1('0xd')],_0x0ba1('0x1d'))>moment()){return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}else{return utils[_0x0ba1('0x1e')](_0x343d62,0x0,![],null)['then'](function(){return utils[_0x0ba1('0x1f')](_0x343d62);})[_0x0ba1('0xe')](function(){return _0x16cd19(null,_0x343d62);});}}else{return _0x16cd19(null,![],{'message':_0x0ba1('0x18')});}}else{return utils['clearBlockUser'](_0x343d62,0x0,![],null)['then'](function(){return utils[_0x0ba1('0x1f')](_0x343d62);})[_0x0ba1('0xe')](function(){return _0x16cd19(null,_0x343d62);})[_0x0ba1('0x20')](function(_0x2c9b3a){return _0x16cd19(null,![],_0x2c9b3a);});}}else{if(_0x343d62[_0x0ba1('0x14')]){return _0x16cd19(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x0ba1('0x1f')](_0x343d62)[_0x0ba1('0xe')](function(){return _0x16cd19(null,_0x343d62);});}}}});})[_0x0ba1('0x20')](function(_0x523ac2){return _0x16cd19(null,![],_0x523ac2);});}function sendServiceMail(_0xd66399){return db['MailAccount'][_0x0ba1('0x21')]({'where':{'service':!![]},'attributes':['id',_0x0ba1('0xf'),_0x0ba1('0x22')],'include':[{'model':db[_0x0ba1('0x23')],'as':_0x0ba1('0x24'),'include':[{'model':db[_0x0ba1('0x25')],'as':_0x0ba1('0x25')}]}]})[_0x0ba1('0xe')](function(_0x1ea6eb){if(!_0x1ea6eb){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x24db66=_0x1ea6eb[_0x0ba1('0x26')]();var _0x3424a5={'account':_0x24db66,'message':_[_0x0ba1('0x27')]({'from':util['format'](_0x0ba1('0x28'),_0x1ea6eb['name'],_0x1ea6eb[_0x0ba1('0x22')]||_0x1ea6eb[_0x0ba1('0x24')]['user'])},_0xd66399)};return client[_0x0ba1('0x29')](_0x0ba1('0x2a'),_0x3424a5);})[_0x0ba1('0xe')](function(_0x4b5d1e){if(_0x4b5d1e[_0x0ba1('0x2b')]){throw new Error(util[_0x0ba1('0x2c')](_0x0ba1('0x2d'),_0x4b5d1e[_0x0ba1('0x2b')][_0x0ba1('0x2e')]||JSON[_0x0ba1('0x2f')](_0x4b5d1e['error'])));}return!![];});}function handleError(_0x5c7923,_0x1de1c0,_0x4e7c0e){return _0x5c7923[_0x0ba1('0x30')](_0x1de1c0||0x1f4)[_0x0ba1('0x31')]({'message':_0x4e7c0e?_0x4e7c0e[_0x0ba1('0x2e')]||_0x4e7c0e:''});}exports[_0x0ba1('0x32')]=function(_0x3bd497,_0x2b2092,_0x48c6db){passport[_0x0ba1('0x19')](_0x0ba1('0x33'),function(_0x30d170,_0x5e139e,_0x47380e){var _0x4e0d09=_0x30d170||_0x47380e;if(_0x4e0d09){return handleError(_0x2b2092,0x191,_0x4e0d09);}if(!_0x5e139e){return handleError(_0x2b2092,0x194,{'message':_0x0ba1('0x34')});}else{var _0x34e495={'payload':{'id':_0x5e139e['id'],'role':_0x5e139e['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x34e495)[_0x0ba1('0xe')](function(_0x4fd45a){_0x2b2092[_0x0ba1('0x35')]({'id':_0x5e139e['id'],'token':_0x4fd45a,'statusCall':'','isAlreadyLogged':_0x5e139e[_0x0ba1('0x36')]});});}})(_0x3bd497,_0x2b2092,_0x48c6db);};exports['forgot']=function(_0x43776e,_0x288da0){if(!_0x43776e[_0x0ba1('0x37')][_0x0ba1('0x22')]){return handleError(_0x288da0,0x1f4,{'message':_0x0ba1('0x38')});}var _0xc24b28=rs[_0x0ba1('0x39')]();_0x43776e[_0x0ba1('0x37')][_0x0ba1('0x22')]=_0x43776e[_0x0ba1('0x37')][_0x0ba1('0x22')][_0x0ba1('0x3a')]()[_0x0ba1('0x3b')]();var _0x3c5e67;return db[_0x0ba1('0xb')][_0x0ba1('0xc')]({'where':{'id':0x1},'attributes':[_0x0ba1('0x1b'),'blockDuration'],'raw':!![]})[_0x0ba1('0xe')](function(_0x14426a){_0x3c5e67=_0x14426a;return db[_0x0ba1('0x3c')][_0x0ba1('0x21')]({'where':{'email':_0x43776e[_0x0ba1('0x37')][_0x0ba1('0x22')]}});})[_0x0ba1('0xe')](function(_0xa78e71){if(!_0xa78e71){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0xa78e71[_0x0ba1('0x13')]){throw new Error(_0x0ba1('0x3d'));}if(_0xa78e71[_0x0ba1('0x14')]){if(moment(_0xa78e71[_0x0ba1('0x15')])[_0x0ba1('0x1c')](_0x3c5e67[_0x0ba1('0xd')],_0x0ba1('0x1d'))>moment()){throw new Error(_0x0ba1('0x3e'));}else{_0xa78e71['blocked']=![];_0xa78e71[_0x0ba1('0x15')]=null;}}_0xa78e71[_0x0ba1('0x3f')]=_0xc24b28;_0xa78e71[_0x0ba1('0x40')]=Date[_0x0ba1('0x41')]()+0x36ee80;return _0xa78e71[_0x0ba1('0x42')]();})[_0x0ba1('0xe')](function(){return sendServiceMail({'to':_0x43776e[_0x0ba1('0x37')]['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x0ba1('0x43')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x0ba1('0x44')+_0x43776e[_0x0ba1('0x45')][_0x0ba1('0x46')]+_0x0ba1('0x47')+_0xc24b28+'\x0a\x0a'+_0x0ba1('0x48')});})[_0x0ba1('0xe')](function(){_0x288da0['status'](0xc8)[_0x0ba1('0x31')]({'message':_0x0ba1('0x49')});})[_0x0ba1('0x20')](function(_0x4ed000){return handleError(_0x288da0,0x1f4,_0x4ed000);});};exports['reset']=function(_0xbb235f,_0x20f76d){return db['User'][_0x0ba1('0x21')]({'where':{'resetPasswordToken':_0xbb235f[_0x0ba1('0x4a')][_0x0ba1('0x4b')],'resetPasswordExpires':{'$gt':Date[_0x0ba1('0x41')]()}}})[_0x0ba1('0xe')](function(_0x4a40bc){if(!_0x4a40bc){throw new Error(_0x0ba1('0x4c'));}return db[_0x0ba1('0xb')][_0x0ba1('0xc')]({'attributes':['id','securePassword',_0x0ba1('0x4d'),_0x0ba1('0x4e')]})[_0x0ba1('0xe')](function(_0x3cd22f){if(_0x3cd22f[_0x0ba1('0x4f')])authService['validatePasswordPattern'](_0xbb235f[_0x0ba1('0x37')][_0x0ba1('0x10')]);if(!_0x3cd22f[_0x0ba1('0x4d')]||!_0x4a40bc[_0x0ba1('0x50')])return _0x4a40bc;authService[_0x0ba1('0x51')](_0xbb235f[_0x0ba1('0x37')][_0x0ba1('0x10')],_0x4a40bc[_0x0ba1('0x50')],_0x3cd22f[_0x0ba1('0x4e')]);return _0x4a40bc;})[_0x0ba1('0xe')](function(){_0x4a40bc[_0x0ba1('0x10')]=_0xbb235f[_0x0ba1('0x37')][_0x0ba1('0x10')];_0x4a40bc[_0x0ba1('0x3f')]=null;_0x4a40bc[_0x0ba1('0x40')]=null;return _0x4a40bc[_0x0ba1('0x42')]();});})[_0x0ba1('0xe')](function(){_0x20f76d['status'](0xc8)[_0x0ba1('0x31')]({'message':_0x0ba1('0x52')});})[_0x0ba1('0x20')](function(_0x17dde1){return handleError(_0x20f76d,0x1f4,_0x17dde1);});};passport[_0x0ba1('0x53')](_0x0ba1('0x33'),new LocalStrategy({'usernameField':'name','passwordField':_0x0ba1('0x10')},function(_0x2760ee,_0x553e4a,_0x17ce67){return localAuthenticate(db[_0x0ba1('0x3c')],_0x2760ee,_0x553e4a,_0x17ce67);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 288f6e8..c93f10b 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 _0xa879=['login','/forgot','/reset/:token','express','Router','./authLocal.controller','post'];(function(_0x2730da,_0x1098bd){var _0xfe9991=function(_0x2ea521){while(--_0x2ea521){_0x2730da['push'](_0x2730da['shift']());}};_0xfe9991(++_0x1098bd);}(_0xa879,0x1c3));var _0x9a87=function(_0x371c9e,_0x3b80d1){_0x371c9e=_0x371c9e-0x0;var _0x3ae1b7=_0xa879[_0x371c9e];return _0x3ae1b7;};'use strict';var express=require(_0x9a87('0x0'));var router=express[_0x9a87('0x1')]();var controller=require(_0x9a87('0x2'));router[_0x9a87('0x3')]('/',controller[_0x9a87('0x4')]);router['post'](_0x9a87('0x5'),controller['forgot']);router['post'](_0x9a87('0x6'),controller['reset']);module['exports']=router; \ No newline at end of file +var _0x3d2a=['reset','post','login','/forgot','forgot','/reset/:token'];(function(_0x1132d1,_0x1a2f80){var _0x13b103=function(_0x743de8){while(--_0x743de8){_0x1132d1['push'](_0x1132d1['shift']());}};_0x13b103(++_0x1a2f80);}(_0x3d2a,0x139));var _0xa3d2=function(_0x493a51,_0x45128c){_0x493a51=_0x493a51-0x0;var _0xc85756=_0x3d2a[_0x493a51];return _0xc85756;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router[_0xa3d2('0x0')]('/',controller[_0xa3d2('0x1')]);router[_0xa3d2('0x0')](_0xa3d2('0x2'),controller[_0xa3d2('0x3')]);router['post'](_0xa3d2('0x4'),controller[_0xa3d2('0x5')]);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 2cf439b..03c5c13 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 _0x91b4=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x5b3288,_0x23cdab){var _0x1e67ab=function(_0x4f7a4b){while(--_0x4f7a4b){_0x5b3288['push'](_0x5b3288['shift']());}};_0x1e67ab(++_0x23cdab);}(_0x91b4,0x190));var _0x491b=function(_0x7d5fa1,_0x244cac){_0x7d5fa1=_0x7d5fa1-0x0;var _0x2b17ae=_0x91b4[_0x7d5fa1];return _0x2b17ae;};'use strict';var Sequelize=require(_0x491b('0x0'));module[_0x491b('0x1')]={'name':{'type':Sequelize[_0x491b('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x491b('0x2')]},'description':{'type':Sequelize[_0x491b('0x2')]},'status':{'type':Sequelize[_0x491b('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x491b('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0x130f=['STRING','BOOLEAN','exports'];(function(_0x7fb1c8,_0x4d9750){var _0x58eb12=function(_0x46b406){while(--_0x46b406){_0x7fb1c8['push'](_0x7fb1c8['shift']());}};_0x58eb12(++_0x4d9750);}(_0x130f,0x155));var _0xf130=function(_0x395b66,_0x5290de){_0x395b66=_0x395b66-0x0;var _0x1024e0=_0x130f[_0x395b66];return _0x1024e0;};'use strict';var Sequelize=require('sequelize');module[_0xf130('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xf130('0x1')]},'description':{'type':Sequelize[_0xf130('0x1')]},'status':{'type':Sequelize[_0xf130('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 ef09a0f..5353f13 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 _0x9a69=['map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','filter','merge','where','options','then','findAll','rows','catch','show','params','includeAll','include','find','create','body','addConditions','ids','omit','getConditions','findOne','Condition','length','sort','pick','nolimit','addActions','Action','getActions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','index','Automation','rawAttributes','type','model'];(function(_0x1aaa7d,_0x2525c7){var _0x5b7c03=function(_0x497e22){while(--_0x497e22){_0x1aaa7d['push'](_0x1aaa7d['shift']());}};_0x5b7c03(++_0x2525c7);}(_0x9a69,0x1ce));var _0x99a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a69[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x99a6('0x0'));var zipdir=require(_0x99a6('0x1'));var jsonpatch=require(_0x99a6('0x2'));var rp=require('request-promise');var moment=require(_0x99a6('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x99a6('0x4'));var util=require(_0x99a6('0x5'));var path=require(_0x99a6('0x6'));var sox=require(_0x99a6('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x99a6('0x8'));var _=require(_0x99a6('0x9'));var squel=require('squel');var crypto=require(_0x99a6('0xa'));var jsforce=require(_0x99a6('0xb'));var deskjs=require(_0x99a6('0xc'));var toCsv=require(_0x99a6('0xd'));var querystring=require(_0x99a6('0xe'));var Papa=require(_0x99a6('0xf'));var Redis=require(_0x99a6('0x10'));var authService=require(_0x99a6('0x11'));var qs=require(_0x99a6('0x12'));var as=require(_0x99a6('0x13'));var hardwareService=require(_0x99a6('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x99a6('0x15'));var config=require(_0x99a6('0x16'));var licenseUtil=require(_0x99a6('0x17'));var db=require(_0x99a6('0x18'))['db'];function respondWithStatusCode(_0xeef1e,_0x446a28){_0x446a28=_0x446a28||0xcc;return function(_0x57e6d3){if(_0x57e6d3){return _0xeef1e[_0x99a6('0x19')](_0x446a28);}return _0xeef1e['status'](_0x446a28)['end']();};}function respondWithResult(_0x49f6b6,_0x5bdc13){_0x5bdc13=_0x5bdc13||0xc8;return function(_0x2261e5){if(_0x2261e5){return _0x49f6b6[_0x99a6('0x1a')](_0x5bdc13)[_0x99a6('0x1b')](_0x2261e5);}};}function respondWithFilteredResult(_0x13b1bc,_0x161297){return function(_0x445f10){if(_0x445f10){var _0x3d5437=typeof _0x161297['offset']===_0x99a6('0x1c')&&typeof _0x161297[_0x99a6('0x1d')]===_0x99a6('0x1c');var _0x11a385=_0x445f10[_0x99a6('0x1e')];var _0x57d4b7=_0x3d5437?0x0:_0x161297[_0x99a6('0x1f')];var _0x473e99=_0x3d5437?_0x445f10['count']:_0x161297['offset']+_0x161297[_0x99a6('0x1d')];var _0x28b66b;if(_0x473e99>=_0x11a385){_0x473e99=_0x11a385;_0x28b66b=0xc8;}else{_0x28b66b=0xce;}_0x13b1bc[_0x99a6('0x1a')](_0x28b66b);return _0x13b1bc[_0x99a6('0x20')](_0x99a6('0x21'),_0x57d4b7+'-'+_0x473e99+'/'+_0x11a385)[_0x99a6('0x1b')](_0x445f10);}return null;};}function patchUpdates(_0x1bfc6a){return function(_0x5b0302){try{jsonpatch[_0x99a6('0x22')](_0x5b0302,_0x1bfc6a,!![]);}catch(_0x373815){return BPromise[_0x99a6('0x23')](_0x373815);}return _0x5b0302[_0x99a6('0x24')]();};}function saveUpdates(_0x449fc3,_0x2a0df1){return function(_0x2bd638){if(_0x2bd638){return _0x2bd638[_0x99a6('0x25')](_0x449fc3)['then'](function(_0x1f8302){return _0x1f8302;});}return null;};}function removeEntity(_0x5e393e,_0x3a4c4f){return function(_0x2167ed){if(_0x2167ed){return _0x2167ed[_0x99a6('0x26')]()['then'](function(){_0x5e393e[_0x99a6('0x1a')](0xcc)[_0x99a6('0x27')]();});}};}function handleEntityNotFound(_0x44c8b1,_0x4dcb12){return function(_0x302eca){if(!_0x302eca){_0x44c8b1[_0x99a6('0x19')](0x194);}return _0x302eca;};}function handleError(_0x333f67,_0x3edf6f){_0x3edf6f=_0x3edf6f||0x1f4;return function(_0xa0a42){logger[_0x99a6('0x28')](_0xa0a42[_0x99a6('0x29')]);if(_0xa0a42[_0x99a6('0x2a')]){delete _0xa0a42[_0x99a6('0x2a')];}_0x333f67[_0x99a6('0x1a')](_0x3edf6f)['send'](_0xa0a42);};}exports[_0x99a6('0x2b')]=function(_0x4898a2,_0x52eaf3){var _0x4cc937={},_0x3edfdd={},_0x52a07f={'count':0x0,'rows':[]};var _0x57286b=_['map'](db[_0x99a6('0x2c')][_0x99a6('0x2d')],function(_0x3795b2){return{'name':_0x3795b2['fieldName'],'type':_0x3795b2[_0x99a6('0x2e')]['key']};});_0x3edfdd[_0x99a6('0x2f')]=_[_0x99a6('0x30')](_0x57286b,_0x99a6('0x2a'));_0x3edfdd['query']=_[_0x99a6('0x31')](_0x4898a2[_0x99a6('0x32')]);_0x3edfdd[_0x99a6('0x33')]=_[_0x99a6('0x34')](_0x3edfdd[_0x99a6('0x2f')],_0x3edfdd[_0x99a6('0x32')]);_0x4cc937[_0x99a6('0x35')]=_[_0x99a6('0x34')](_0x3edfdd[_0x99a6('0x2f')],qs[_0x99a6('0x36')](_0x4898a2['query'][_0x99a6('0x36')]));_0x4cc937[_0x99a6('0x35')]=_0x4cc937[_0x99a6('0x35')]['length']?_0x4cc937[_0x99a6('0x35')]:_0x3edfdd['model'];if(!_0x4898a2[_0x99a6('0x32')][_0x99a6('0x37')]('nolimit')){_0x4cc937[_0x99a6('0x1d')]=qs[_0x99a6('0x1d')](_0x4898a2[_0x99a6('0x32')]['limit']);_0x4cc937['offset']=qs['offset'](_0x4898a2[_0x99a6('0x32')]['offset']);}_0x4cc937[_0x99a6('0x38')]=qs['sort'](_0x4898a2['query']['sort']);_0x4cc937['where']=qs[_0x99a6('0x33')](_['pick'](_0x4898a2['query'],_0x3edfdd[_0x99a6('0x33')]),_0x57286b);if(_0x4898a2[_0x99a6('0x32')][_0x99a6('0x39')]){_0x4cc937['where']=_[_0x99a6('0x3a')](_0x4cc937[_0x99a6('0x3b')],{'$or':_[_0x99a6('0x30')](_0x57286b,function(_0x4dac27){if(_0x4dac27['type']!=='VIRTUAL'){var _0x38e4e1={};_0x38e4e1[_0x4dac27[_0x99a6('0x2a')]]={'$like':'%'+_0x4898a2[_0x99a6('0x32')][_0x99a6('0x39')]+'%'};return _0x38e4e1;}})});}_0x4cc937=_[_0x99a6('0x3a')]({},_0x4cc937,_0x4898a2[_0x99a6('0x3c')]);var _0x52604a={'where':_0x4cc937[_0x99a6('0x3b')]};return db[_0x99a6('0x2c')][_0x99a6('0x1e')](_0x52604a)[_0x99a6('0x3d')](function(_0x21846d){_0x52a07f['count']=_0x21846d;if(_0x4898a2[_0x99a6('0x32')]['includeAll']){_0x4cc937['include']=[{'all':!![]}];}return db[_0x99a6('0x2c')][_0x99a6('0x3e')](_0x4cc937);})[_0x99a6('0x3d')](function(_0x2bed4e){_0x52a07f[_0x99a6('0x3f')]=_0x2bed4e;return _0x52a07f;})['then'](respondWithFilteredResult(_0x52eaf3,_0x4cc937))[_0x99a6('0x40')](handleError(_0x52eaf3,null));};exports[_0x99a6('0x41')]=function(_0x370066,_0x3fc3a6){var _0x3083d6={'raw':![],'where':{'id':_0x370066[_0x99a6('0x42')]['id']}},_0x548b47={};_0x548b47[_0x99a6('0x2f')]=_[_0x99a6('0x31')](db[_0x99a6('0x2c')][_0x99a6('0x2d')]);_0x548b47[_0x99a6('0x32')]=_[_0x99a6('0x31')](_0x370066[_0x99a6('0x32')]);_0x548b47[_0x99a6('0x33')]=_[_0x99a6('0x34')](_0x548b47['model'],_0x548b47[_0x99a6('0x32')]);_0x3083d6['attributes']=_[_0x99a6('0x34')](_0x548b47['model'],qs[_0x99a6('0x36')](_0x370066[_0x99a6('0x32')]['fields']));_0x3083d6[_0x99a6('0x35')]=_0x3083d6[_0x99a6('0x35')]['length']?_0x3083d6['attributes']:_0x548b47[_0x99a6('0x2f')];if(_0x370066[_0x99a6('0x32')][_0x99a6('0x43')]){_0x3083d6[_0x99a6('0x44')]=[{'all':!![]}];}_0x3083d6=_[_0x99a6('0x3a')]({},_0x3083d6,_0x370066[_0x99a6('0x3c')]);return db[_0x99a6('0x2c')][_0x99a6('0x45')](_0x3083d6)[_0x99a6('0x3d')](handleEntityNotFound(_0x3fc3a6,null))[_0x99a6('0x3d')](respondWithResult(_0x3fc3a6,null))['catch'](handleError(_0x3fc3a6,null));};exports[_0x99a6('0x46')]=function(_0x1d267d,_0x39f585){return db[_0x99a6('0x2c')][_0x99a6('0x46')](_0x1d267d['body'],{})[_0x99a6('0x3d')](respondWithResult(_0x39f585,0xc9))[_0x99a6('0x40')](handleError(_0x39f585,null));};exports['update']=function(_0x464c79,_0x5d7657){if(_0x464c79[_0x99a6('0x47')]['id']){delete _0x464c79[_0x99a6('0x47')]['id'];}return db['Automation'][_0x99a6('0x45')]({'where':{'id':_0x464c79[_0x99a6('0x42')]['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x5d7657,null))['then'](saveUpdates(_0x464c79[_0x99a6('0x47')],null))['then'](respondWithResult(_0x5d7657,null))['catch'](handleError(_0x5d7657,null));};exports[_0x99a6('0x26')]=function(_0x193b2b,_0x55ecb6){return db['Automation'][_0x99a6('0x45')]({'where':{'id':_0x193b2b[_0x99a6('0x42')]['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x55ecb6,null))[_0x99a6('0x3d')](removeEntity(_0x55ecb6,null))['catch'](handleError(_0x55ecb6,null));};exports[_0x99a6('0x48')]=function(_0x507439,_0x570c51,_0x52408b){return db['Condition'][_0x99a6('0x45')]({'where':{'id':_0x507439[_0x99a6('0x42')]['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x570c51,null))[_0x99a6('0x3d')](function(_0x36c4ca){if(_0x36c4ca){return _0x36c4ca['addConditions'](_0x507439[_0x99a6('0x47')][_0x99a6('0x49')],_[_0x99a6('0x4a')](_0x507439[_0x99a6('0x47')],[_0x99a6('0x49'),'id'])||{});}})[_0x99a6('0x3d')](respondWithResult(_0x570c51,null))[_0x99a6('0x40')](handleError(_0x570c51,null));};exports[_0x99a6('0x4b')]=function(_0x72f1,_0x260d3c,_0x5147df){var _0x389d40={};var _0x3162c6={};var _0x4c97c8;var _0x24c076;return db['Automation'][_0x99a6('0x4c')]({'where':{'id':_0x72f1[_0x99a6('0x42')]['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x260d3c,null))['then'](function(_0x3419f4){if(_0x3419f4){_0x4c97c8=_0x3419f4;_0x3162c6[_0x99a6('0x2f')]=_[_0x99a6('0x31')](db[_0x99a6('0x4d')][_0x99a6('0x2d')]);_0x3162c6['query']=_[_0x99a6('0x31')](_0x72f1[_0x99a6('0x32')]);_0x3162c6[_0x99a6('0x33')]=_[_0x99a6('0x34')](_0x3162c6[_0x99a6('0x2f')],_0x3162c6[_0x99a6('0x32')]);_0x389d40['attributes']=_[_0x99a6('0x34')](_0x3162c6['model'],qs[_0x99a6('0x36')](_0x72f1['query'][_0x99a6('0x36')]));_0x389d40[_0x99a6('0x35')]=_0x389d40[_0x99a6('0x35')][_0x99a6('0x4e')]?_0x389d40[_0x99a6('0x35')]:_0x3162c6[_0x99a6('0x2f')];_0x389d40[_0x99a6('0x38')]=qs[_0x99a6('0x4f')](_0x72f1[_0x99a6('0x32')][_0x99a6('0x4f')]);_0x389d40['where']=qs[_0x99a6('0x33')](_[_0x99a6('0x50')](_0x72f1[_0x99a6('0x32')],_0x3162c6[_0x99a6('0x33')]));if(_0x72f1['query'][_0x99a6('0x39')]){_0x389d40[_0x99a6('0x3b')]=_['merge'](_0x389d40[_0x99a6('0x3b')],{'$or':_[_0x99a6('0x30')](_0x389d40[_0x99a6('0x35')],function(_0x1daba1){var _0x17c84b={};_0x17c84b[_0x1daba1]={'$like':'%'+_0x72f1[_0x99a6('0x32')][_0x99a6('0x39')]+'%'};return _0x17c84b;})});}_0x389d40=_[_0x99a6('0x3a')]({},_0x389d40,_0x72f1[_0x99a6('0x3c')]);return _0x4c97c8[_0x99a6('0x4b')](_0x389d40);}})[_0x99a6('0x3d')](function(_0x7aae66){if(_0x7aae66){_0x24c076=_0x7aae66['length'];if(!_0x72f1[_0x99a6('0x32')][_0x99a6('0x37')](_0x99a6('0x51'))){_0x389d40[_0x99a6('0x1d')]=qs[_0x99a6('0x1d')](_0x72f1[_0x99a6('0x32')][_0x99a6('0x1d')]);_0x389d40['offset']=qs[_0x99a6('0x1f')](_0x72f1[_0x99a6('0x32')][_0x99a6('0x1f')]);}return _0x4c97c8[_0x99a6('0x4b')](_0x389d40);}})[_0x99a6('0x3d')](function(_0x5ad87a){if(_0x5ad87a){return _0x5ad87a?{'count':_0x24c076,'rows':_0x5ad87a}:null;}})['then'](respondWithResult(_0x260d3c,null))[_0x99a6('0x40')](handleError(_0x260d3c,null));};exports[_0x99a6('0x52')]=function(_0xc7284,_0x26a5d3,_0x5b8af4){return db[_0x99a6('0x53')][_0x99a6('0x45')]({'where':{'id':_0xc7284[_0x99a6('0x42')]['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x26a5d3,null))[_0x99a6('0x3d')](function(_0x2a57bf){if(_0x2a57bf){return _0x2a57bf[_0x99a6('0x52')](_0xc7284[_0x99a6('0x47')][_0x99a6('0x49')],_[_0x99a6('0x4a')](_0xc7284['body'],['ids','id'])||{});}})[_0x99a6('0x3d')](respondWithResult(_0x26a5d3,null))[_0x99a6('0x40')](handleError(_0x26a5d3,null));};exports[_0x99a6('0x54')]=function(_0x475daa,_0x2527ff,_0x1958c5){var _0x44f63f={};var _0x16a6eb={};var _0x5b82b8;var _0x11c23b;return db[_0x99a6('0x2c')]['findOne']({'where':{'id':_0x475daa['params']['id']}})[_0x99a6('0x3d')](handleEntityNotFound(_0x2527ff,null))[_0x99a6('0x3d')](function(_0x4b87dd){if(_0x4b87dd){_0x5b82b8=_0x4b87dd;_0x16a6eb[_0x99a6('0x2f')]=_['keys'](db[_0x99a6('0x53')][_0x99a6('0x2d')]);_0x16a6eb[_0x99a6('0x32')]=_[_0x99a6('0x31')](_0x475daa[_0x99a6('0x32')]);_0x16a6eb[_0x99a6('0x33')]=_[_0x99a6('0x34')](_0x16a6eb['model'],_0x16a6eb[_0x99a6('0x32')]);_0x44f63f[_0x99a6('0x35')]=_[_0x99a6('0x34')](_0x16a6eb['model'],qs[_0x99a6('0x36')](_0x475daa[_0x99a6('0x32')][_0x99a6('0x36')]));_0x44f63f[_0x99a6('0x35')]=_0x44f63f[_0x99a6('0x35')]['length']?_0x44f63f[_0x99a6('0x35')]:_0x16a6eb[_0x99a6('0x2f')];_0x44f63f[_0x99a6('0x38')]=qs[_0x99a6('0x4f')](_0x475daa['query'][_0x99a6('0x4f')]);_0x44f63f[_0x99a6('0x3b')]=qs['filters'](_[_0x99a6('0x50')](_0x475daa[_0x99a6('0x32')],_0x16a6eb[_0x99a6('0x33')]));if(_0x475daa[_0x99a6('0x32')][_0x99a6('0x39')]){_0x44f63f[_0x99a6('0x3b')]=_[_0x99a6('0x3a')](_0x44f63f[_0x99a6('0x3b')],{'$or':_[_0x99a6('0x30')](_0x44f63f[_0x99a6('0x35')],function(_0x245048){var _0x30fa5d={};_0x30fa5d[_0x245048]={'$like':'%'+_0x475daa['query']['filter']+'%'};return _0x30fa5d;})});}_0x44f63f=_[_0x99a6('0x3a')]({},_0x44f63f,_0x475daa[_0x99a6('0x3c')]);return _0x5b82b8[_0x99a6('0x54')](_0x44f63f);}})['then'](function(_0x3fd5ed){if(_0x3fd5ed){_0x11c23b=_0x3fd5ed[_0x99a6('0x4e')];if(!_0x475daa[_0x99a6('0x32')][_0x99a6('0x37')](_0x99a6('0x51'))){_0x44f63f[_0x99a6('0x1d')]=qs['limit'](_0x475daa[_0x99a6('0x32')][_0x99a6('0x1d')]);_0x44f63f[_0x99a6('0x1f')]=qs['offset'](_0x475daa[_0x99a6('0x32')]['offset']);}return _0x5b82b8['getActions'](_0x44f63f);}})['then'](function(_0x3c3e3f){if(_0x3c3e3f){return _0x3c3e3f?{'count':_0x11c23b,'rows':_0x3c3e3f}:null;}})['then'](respondWithResult(_0x2527ff,null))['catch'](handleError(_0x2527ff,null));}; \ No newline at end of file +var _0xadd4=['findAll','rows','catch','show','params','length','create','body','find','Condition','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','options','getActions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','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','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','name','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','includeAll','include'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xadd4,0x1ad));var _0x4add=function(_0x27488f,_0x58085d){_0x27488f=_0x27488f-0x0;var _0x3a0d9d=_0xadd4[_0x27488f];return _0x3a0d9d;};'use strict';var emlformat=require(_0x4add('0x0'));var rimraf=require(_0x4add('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4add('0x2'));var rp=require(_0x4add('0x3'));var moment=require(_0x4add('0x4'));var BPromise=require(_0x4add('0x5'));var Mustache=require('mustache');var util=require(_0x4add('0x6'));var path=require(_0x4add('0x7'));var sox=require(_0x4add('0x8'));var csv=require(_0x4add('0x9'));var ejs=require(_0x4add('0xa'));var fs=require('fs');var fs_extra=require(_0x4add('0xb'));var _=require(_0x4add('0xc'));var squel=require(_0x4add('0xd'));var crypto=require(_0x4add('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4add('0xf'));var toCsv=require(_0x4add('0x9'));var querystring=require(_0x4add('0x10'));var Papa=require(_0x4add('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4add('0x12'));var hardwareService=require(_0x4add('0x13'));var logger=require(_0x4add('0x14'))(_0x4add('0x15'));var utils=require(_0x4add('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4add('0x17'));var db=require(_0x4add('0x18'))['db'];function respondWithStatusCode(_0x5ddf8f,_0xf52d33){_0xf52d33=_0xf52d33||0xcc;return function(_0x109b21){if(_0x109b21){return _0x5ddf8f[_0x4add('0x19')](_0xf52d33);}return _0x5ddf8f[_0x4add('0x1a')](_0xf52d33)[_0x4add('0x1b')]();};}function respondWithResult(_0x291bf1,_0x2589df){_0x2589df=_0x2589df||0xc8;return function(_0x488040){if(_0x488040){return _0x291bf1[_0x4add('0x1a')](_0x2589df)[_0x4add('0x1c')](_0x488040);}};}function respondWithFilteredResult(_0x28387d,_0x377e05){return function(_0x40e4eb){if(_0x40e4eb){var _0x417dd1=typeof _0x377e05[_0x4add('0x1d')]===_0x4add('0x1e')&&typeof _0x377e05[_0x4add('0x1f')]===_0x4add('0x1e');var _0x98b6e1=_0x40e4eb[_0x4add('0x20')];var _0x1decc8=_0x417dd1?0x0:_0x377e05[_0x4add('0x1d')];var _0xfdca0=_0x417dd1?_0x40e4eb[_0x4add('0x20')]:_0x377e05[_0x4add('0x1d')]+_0x377e05[_0x4add('0x1f')];var _0x495940;if(_0xfdca0>=_0x98b6e1){_0xfdca0=_0x98b6e1;_0x495940=0xc8;}else{_0x495940=0xce;}_0x28387d[_0x4add('0x1a')](_0x495940);return _0x28387d[_0x4add('0x21')]('Content-Range',_0x1decc8+'-'+_0xfdca0+'/'+_0x98b6e1)['json'](_0x40e4eb);}return null;};}function patchUpdates(_0x52ea50){return function(_0x48851b){try{jsonpatch['apply'](_0x48851b,_0x52ea50,!![]);}catch(_0x317c53){return BPromise[_0x4add('0x22')](_0x317c53);}return _0x48851b[_0x4add('0x23')]();};}function saveUpdates(_0x354472,_0x22528e){return function(_0x25067f){if(_0x25067f){return _0x25067f[_0x4add('0x24')](_0x354472)[_0x4add('0x25')](function(_0x2cf388){return _0x2cf388;});}return null;};}function removeEntity(_0x22d1ef,_0x5e38a2){return function(_0x326234){if(_0x326234){return _0x326234[_0x4add('0x26')]()['then'](function(){_0x22d1ef[_0x4add('0x1a')](0xcc)[_0x4add('0x1b')]();});}};}function handleEntityNotFound(_0x10ab27,_0x4106be){return function(_0xe97b81){if(!_0xe97b81){_0x10ab27[_0x4add('0x19')](0x194);}return _0xe97b81;};}function handleError(_0x29b041,_0x5dd20a){_0x5dd20a=_0x5dd20a||0x1f4;return function(_0x3c5411){logger[_0x4add('0x27')](_0x3c5411['stack']);if(_0x3c5411[_0x4add('0x28')]){delete _0x3c5411[_0x4add('0x28')];}_0x29b041[_0x4add('0x1a')](_0x5dd20a)['send'](_0x3c5411);};}exports['index']=function(_0xcf6ec3,_0x3fa07b){var _0x1b0c62={},_0x397838={},_0x526e77={'count':0x0,'rows':[]};var _0x491cbb=_[_0x4add('0x29')](db[_0x4add('0x2a')][_0x4add('0x2b')],function(_0x4437c6){return{'name':_0x4437c6[_0x4add('0x2c')],'type':_0x4437c6[_0x4add('0x2d')][_0x4add('0x2e')]};});_0x397838[_0x4add('0x2f')]=_[_0x4add('0x29')](_0x491cbb,_0x4add('0x28'));_0x397838['query']=_[_0x4add('0x30')](_0xcf6ec3[_0x4add('0x31')]);_0x397838[_0x4add('0x32')]=_['intersection'](_0x397838['model'],_0x397838[_0x4add('0x31')]);_0x1b0c62['attributes']=_[_0x4add('0x33')](_0x397838[_0x4add('0x2f')],qs[_0x4add('0x34')](_0xcf6ec3[_0x4add('0x31')][_0x4add('0x34')]));_0x1b0c62[_0x4add('0x35')]=_0x1b0c62[_0x4add('0x35')]['length']?_0x1b0c62[_0x4add('0x35')]:_0x397838[_0x4add('0x2f')];if(!_0xcf6ec3['query']['hasOwnProperty'](_0x4add('0x36'))){_0x1b0c62[_0x4add('0x1f')]=qs['limit'](_0xcf6ec3['query'][_0x4add('0x1f')]);_0x1b0c62['offset']=qs[_0x4add('0x1d')](_0xcf6ec3['query'][_0x4add('0x1d')]);}_0x1b0c62[_0x4add('0x37')]=qs[_0x4add('0x38')](_0xcf6ec3[_0x4add('0x31')][_0x4add('0x38')]);_0x1b0c62[_0x4add('0x39')]=qs[_0x4add('0x32')](_[_0x4add('0x3a')](_0xcf6ec3[_0x4add('0x31')],_0x397838['filters']),_0x491cbb);if(_0xcf6ec3[_0x4add('0x31')][_0x4add('0x3b')]){_0x1b0c62[_0x4add('0x39')]=_[_0x4add('0x3c')](_0x1b0c62[_0x4add('0x39')],{'$or':_[_0x4add('0x29')](_0x491cbb,function(_0x2ad396){if(_0x2ad396[_0x4add('0x2d')]!=='VIRTUAL'){var _0x37cb07={};_0x37cb07[_0x2ad396[_0x4add('0x28')]]={'$like':'%'+_0xcf6ec3[_0x4add('0x31')][_0x4add('0x3b')]+'%'};return _0x37cb07;}})});}_0x1b0c62=_[_0x4add('0x3c')]({},_0x1b0c62,_0xcf6ec3['options']);var _0x377098={'where':_0x1b0c62[_0x4add('0x39')]};return db[_0x4add('0x2a')][_0x4add('0x20')](_0x377098)[_0x4add('0x25')](function(_0x391f53){_0x526e77[_0x4add('0x20')]=_0x391f53;if(_0xcf6ec3['query'][_0x4add('0x3d')]){_0x1b0c62[_0x4add('0x3e')]=[{'all':!![]}];}return db[_0x4add('0x2a')][_0x4add('0x3f')](_0x1b0c62);})[_0x4add('0x25')](function(_0x211fad){_0x526e77[_0x4add('0x40')]=_0x211fad;return _0x526e77;})[_0x4add('0x25')](respondWithFilteredResult(_0x3fa07b,_0x1b0c62))[_0x4add('0x41')](handleError(_0x3fa07b,null));};exports[_0x4add('0x42')]=function(_0xdff76a,_0x57851d){var _0x468761={'raw':![],'where':{'id':_0xdff76a[_0x4add('0x43')]['id']}},_0x5709e3={};_0x5709e3[_0x4add('0x2f')]=_['keys'](db[_0x4add('0x2a')][_0x4add('0x2b')]);_0x5709e3[_0x4add('0x31')]=_['keys'](_0xdff76a['query']);_0x5709e3[_0x4add('0x32')]=_[_0x4add('0x33')](_0x5709e3[_0x4add('0x2f')],_0x5709e3[_0x4add('0x31')]);_0x468761[_0x4add('0x35')]=_[_0x4add('0x33')](_0x5709e3[_0x4add('0x2f')],qs[_0x4add('0x34')](_0xdff76a['query'][_0x4add('0x34')]));_0x468761[_0x4add('0x35')]=_0x468761[_0x4add('0x35')][_0x4add('0x44')]?_0x468761['attributes']:_0x5709e3[_0x4add('0x2f')];if(_0xdff76a[_0x4add('0x31')]['includeAll']){_0x468761[_0x4add('0x3e')]=[{'all':!![]}];}_0x468761=_['merge']({},_0x468761,_0xdff76a['options']);return db[_0x4add('0x2a')]['find'](_0x468761)[_0x4add('0x25')](handleEntityNotFound(_0x57851d,null))[_0x4add('0x25')](respondWithResult(_0x57851d,null))[_0x4add('0x41')](handleError(_0x57851d,null));};exports['create']=function(_0x4e84be,_0x51652a){return db[_0x4add('0x2a')][_0x4add('0x45')](_0x4e84be[_0x4add('0x46')],{})[_0x4add('0x25')](respondWithResult(_0x51652a,0xc9))['catch'](handleError(_0x51652a,null));};exports[_0x4add('0x24')]=function(_0x353ebc,_0x5ab267){if(_0x353ebc[_0x4add('0x46')]['id']){delete _0x353ebc[_0x4add('0x46')]['id'];}return db[_0x4add('0x2a')]['find']({'where':{'id':_0x353ebc[_0x4add('0x43')]['id']}})[_0x4add('0x25')](handleEntityNotFound(_0x5ab267,null))[_0x4add('0x25')](saveUpdates(_0x353ebc[_0x4add('0x46')],null))[_0x4add('0x25')](respondWithResult(_0x5ab267,null))[_0x4add('0x41')](handleError(_0x5ab267,null));};exports[_0x4add('0x26')]=function(_0x1e8a93,_0x5599fb){return db['Automation'][_0x4add('0x47')]({'where':{'id':_0x1e8a93[_0x4add('0x43')]['id']}})['then'](handleEntityNotFound(_0x5599fb,null))[_0x4add('0x25')](removeEntity(_0x5599fb,null))[_0x4add('0x41')](handleError(_0x5599fb,null));};exports['addConditions']=function(_0x366852,_0xf4a85e,_0x1e61bf){return db[_0x4add('0x48')]['find']({'where':{'id':_0x366852[_0x4add('0x43')]['id']}})[_0x4add('0x25')](handleEntityNotFound(_0xf4a85e,null))['then'](function(_0x284f38){if(_0x284f38){return _0x284f38['addConditions'](_0x366852[_0x4add('0x46')][_0x4add('0x49')],_[_0x4add('0x4a')](_0x366852['body'],[_0x4add('0x49'),'id'])||{});}})[_0x4add('0x25')](respondWithResult(_0xf4a85e,null))[_0x4add('0x41')](handleError(_0xf4a85e,null));};exports[_0x4add('0x4b')]=function(_0x37e37d,_0x57af9c,_0x46f6d1){var _0x197823={};var _0x2340fd={};var _0x5a18f9;var _0x200564;return db[_0x4add('0x2a')][_0x4add('0x4c')]({'where':{'id':_0x37e37d[_0x4add('0x43')]['id']}})['then'](handleEntityNotFound(_0x57af9c,null))['then'](function(_0x13e5bb){if(_0x13e5bb){_0x5a18f9=_0x13e5bb;_0x2340fd[_0x4add('0x2f')]=_['keys'](db[_0x4add('0x48')][_0x4add('0x2b')]);_0x2340fd['query']=_[_0x4add('0x30')](_0x37e37d[_0x4add('0x31')]);_0x2340fd['filters']=_[_0x4add('0x33')](_0x2340fd[_0x4add('0x2f')],_0x2340fd[_0x4add('0x31')]);_0x197823[_0x4add('0x35')]=_[_0x4add('0x33')](_0x2340fd['model'],qs[_0x4add('0x34')](_0x37e37d['query'][_0x4add('0x34')]));_0x197823[_0x4add('0x35')]=_0x197823[_0x4add('0x35')]['length']?_0x197823[_0x4add('0x35')]:_0x2340fd[_0x4add('0x2f')];_0x197823[_0x4add('0x37')]=qs[_0x4add('0x38')](_0x37e37d[_0x4add('0x31')][_0x4add('0x38')]);_0x197823[_0x4add('0x39')]=qs[_0x4add('0x32')](_['pick'](_0x37e37d['query'],_0x2340fd[_0x4add('0x32')]));if(_0x37e37d[_0x4add('0x31')]['filter']){_0x197823[_0x4add('0x39')]=_[_0x4add('0x3c')](_0x197823[_0x4add('0x39')],{'$or':_[_0x4add('0x29')](_0x197823[_0x4add('0x35')],function(_0xe7044f){var _0x4a4a9e={};_0x4a4a9e[_0xe7044f]={'$like':'%'+_0x37e37d[_0x4add('0x31')][_0x4add('0x3b')]+'%'};return _0x4a4a9e;})});}_0x197823=_[_0x4add('0x3c')]({},_0x197823,_0x37e37d['options']);return _0x5a18f9[_0x4add('0x4b')](_0x197823);}})[_0x4add('0x25')](function(_0x548753){if(_0x548753){_0x200564=_0x548753[_0x4add('0x44')];if(!_0x37e37d[_0x4add('0x31')][_0x4add('0x4d')](_0x4add('0x36'))){_0x197823[_0x4add('0x1f')]=qs[_0x4add('0x1f')](_0x37e37d[_0x4add('0x31')][_0x4add('0x1f')]);_0x197823[_0x4add('0x1d')]=qs[_0x4add('0x1d')](_0x37e37d['query']['offset']);}return _0x5a18f9[_0x4add('0x4b')](_0x197823);}})[_0x4add('0x25')](function(_0x432e84){if(_0x432e84){return _0x432e84?{'count':_0x200564,'rows':_0x432e84}:null;}})['then'](respondWithResult(_0x57af9c,null))['catch'](handleError(_0x57af9c,null));};exports[_0x4add('0x4e')]=function(_0x3674c7,_0x33e499,_0x80828d){return db[_0x4add('0x4f')][_0x4add('0x47')]({'where':{'id':_0x3674c7['params']['id']}})[_0x4add('0x25')](handleEntityNotFound(_0x33e499,null))[_0x4add('0x25')](function(_0x5dd1ab){if(_0x5dd1ab){return _0x5dd1ab['addActions'](_0x3674c7['body'][_0x4add('0x49')],_[_0x4add('0x4a')](_0x3674c7[_0x4add('0x46')],[_0x4add('0x49'),'id'])||{});}})['then'](respondWithResult(_0x33e499,null))[_0x4add('0x41')](handleError(_0x33e499,null));};exports['getActions']=function(_0xab3e90,_0x417347,_0x105471){var _0x261bf1={};var _0x5597ee={};var _0x3cb33f;var _0x469102;return db[_0x4add('0x2a')]['findOne']({'where':{'id':_0xab3e90['params']['id']}})[_0x4add('0x25')](handleEntityNotFound(_0x417347,null))[_0x4add('0x25')](function(_0x4fba7c){if(_0x4fba7c){_0x3cb33f=_0x4fba7c;_0x5597ee['model']=_[_0x4add('0x30')](db[_0x4add('0x4f')][_0x4add('0x2b')]);_0x5597ee[_0x4add('0x31')]=_[_0x4add('0x30')](_0xab3e90[_0x4add('0x31')]);_0x5597ee['filters']=_[_0x4add('0x33')](_0x5597ee[_0x4add('0x2f')],_0x5597ee[_0x4add('0x31')]);_0x261bf1[_0x4add('0x35')]=_[_0x4add('0x33')](_0x5597ee['model'],qs[_0x4add('0x34')](_0xab3e90[_0x4add('0x31')]['fields']));_0x261bf1[_0x4add('0x35')]=_0x261bf1[_0x4add('0x35')][_0x4add('0x44')]?_0x261bf1[_0x4add('0x35')]:_0x5597ee['model'];_0x261bf1[_0x4add('0x37')]=qs[_0x4add('0x38')](_0xab3e90['query'][_0x4add('0x38')]);_0x261bf1[_0x4add('0x39')]=qs[_0x4add('0x32')](_[_0x4add('0x3a')](_0xab3e90[_0x4add('0x31')],_0x5597ee[_0x4add('0x32')]));if(_0xab3e90['query']['filter']){_0x261bf1[_0x4add('0x39')]=_[_0x4add('0x3c')](_0x261bf1['where'],{'$or':_[_0x4add('0x29')](_0x261bf1['attributes'],function(_0x622299){var _0x471def={};_0x471def[_0x622299]={'$like':'%'+_0xab3e90[_0x4add('0x31')]['filter']+'%'};return _0x471def;})});}_0x261bf1=_[_0x4add('0x3c')]({},_0x261bf1,_0xab3e90[_0x4add('0x50')]);return _0x3cb33f['getActions'](_0x261bf1);}})[_0x4add('0x25')](function(_0x25c6f1){if(_0x25c6f1){_0x469102=_0x25c6f1[_0x4add('0x44')];if(!_0xab3e90[_0x4add('0x31')][_0x4add('0x4d')](_0x4add('0x36'))){_0x261bf1[_0x4add('0x1f')]=qs[_0x4add('0x1f')](_0xab3e90[_0x4add('0x31')][_0x4add('0x1f')]);_0x261bf1[_0x4add('0x1d')]=qs[_0x4add('0x1d')](_0xab3e90[_0x4add('0x31')][_0x4add('0x1d')]);}return _0x3cb33f[_0x4add('0x51')](_0x261bf1);}})[_0x4add('0x25')](function(_0x428586){if(_0x428586){return _0x428586?{'count':_0x469102,'rows':_0x428586}:null;}})[_0x4add('0x25')](respondWithResult(_0x417347,null))[_0x4add('0x41')](handleError(_0x417347,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c81a8ec..5002901 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 _0x52d6=['define','Automation','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./automation.attributes','exports'];(function(_0x10c612,_0x297612){var _0x4ccc48=function(_0x5051e2){while(--_0x5051e2){_0x10c612['push'](_0x10c612['shift']());}};_0x4ccc48(++_0x297612);}(_0x52d6,0x16a));var _0x652d=function(_0x423a06,_0x37195a){_0x423a06=_0x423a06-0x0;var _0x1373b5=_0x52d6[_0x423a06];return _0x1373b5;};'use strict';var _=require('lodash');var util=require(_0x652d('0x0'));var logger=require(_0x652d('0x1'))('api');var moment=require('moment');var BPromise=require(_0x652d('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x652d('0x3'));var rimraf=require(_0x652d('0x4'));var config=require(_0x652d('0x5'));var attributes=require(_0x652d('0x6'));module[_0x652d('0x7')]=function(_0x1eab60,_0x39e76b){return _0x1eab60[_0x652d('0x8')](_0x652d('0x9'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ac8=['./automation.attributes','exports','define','Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e4fb5,_0xf386ea){var _0x43c401=function(_0x2f33af){while(--_0x2f33af){_0x2e4fb5['push'](_0x2e4fb5['shift']());}};_0x43c401(++_0xf386ea);}(_0x6ac8,0xee));var _0x86ac=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6ac8[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x86ac('0x0'));var util=require(_0x86ac('0x1'));var logger=require(_0x86ac('0x2'))(_0x86ac('0x3'));var moment=require(_0x86ac('0x4'));var BPromise=require(_0x86ac('0x5'));var rp=require(_0x86ac('0x6'));var fs=require('fs');var path=require(_0x86ac('0x7'));var rimraf=require(_0x86ac('0x8'));var config=require('../../config/environment');var attributes=require(_0x86ac('0x9'));module[_0x86ac('0xa')]=function(_0x209a78,_0xe2597d){return _0x209a78[_0x86ac('0xb')](_0x86ac('0xc'),attributes,{'tableName':'tools_automations','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 287d536..cfb35b0 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 _0xd05a=['info','result','catch','util','moment','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','Automation,\x20%s,\x20%s','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd05a,0x143));var _0xad05=function(_0x3d97ae,_0x1afe32){_0x3d97ae=_0x3d97ae-0x0;var _0x262043=_0xd05a[_0x3d97ae];return _0x262043;};'use strict';var _=require('lodash');var util=require(_0xad05('0x0'));var moment=require(_0xad05('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(_0xad05('0x2'));var logger=require(_0xad05('0x3'))(_0xad05('0x4'));var config=require(_0xad05('0x5'));var jayson=require(_0xad05('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x39ddaf,_0x45303c,_0xd12d76){return new BPromise(function(_0x565f85,_0x17ec26){return client[_0xad05('0x7')](_0x39ddaf,_0xd12d76)[_0xad05('0x8')](function(_0x573acb){logger['info'](_0xad05('0x9'),_0x45303c,'request\x20sent');logger[_0xad05('0xa')](_0xad05('0xb'),_0x45303c,_0xad05('0xc'),JSON[_0xad05('0xd')](_0x573acb));if(_0x573acb[_0xad05('0xe')]){if(_0x573acb[_0xad05('0xe')][_0xad05('0xf')]===0x1f4){logger[_0xad05('0xe')](_0xad05('0x9'),_0x45303c,_0x573acb[_0xad05('0xe')]['message']);return _0x17ec26(_0x573acb[_0xad05('0xe')]['message']);}logger[_0xad05('0xe')]('Automation,\x20%s,\x20%s',_0x45303c,_0x573acb[_0xad05('0xe')][_0xad05('0x10')]);return _0x565f85(_0x573acb[_0xad05('0xe')]['message']);}else{logger[_0xad05('0x11')]('Automation,\x20%s,\x20%s',_0x45303c,_0xad05('0xc'));_0x565f85(_0x573acb[_0xad05('0x12')][_0xad05('0x10')]);}})[_0xad05('0x13')](function(_0x43ab03){logger[_0xad05('0xe')]('Automation,\x20%s,\x20%s',_0x45303c,_0x43ab03);_0x17ec26(_0x43ab03);});});} \ No newline at end of file +var _0xf954=['error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x335c07,_0x6e82f2){var _0x24ddf0=function(_0x5b08c1){while(--_0x5b08c1){_0x335c07['push'](_0x335c07['shift']());}};_0x24ddf0(++_0x6e82f2);}(_0xf954,0x10e));var _0x4f95=function(_0x33cb97,_0x2be8e8){_0x33cb97=_0x33cb97-0x0;var _0xe85595=_0xf954[_0x33cb97];return _0xe85595;};'use strict';var _=require(_0x4f95('0x0'));var util=require(_0x4f95('0x1'));var moment=require(_0x4f95('0x2'));var BPromise=require(_0x4f95('0x3'));var rs=require(_0x4f95('0x4'));var fs=require('fs');var Redis=require(_0x4f95('0x5'));var db=require(_0x4f95('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f95('0x7'));var config=require(_0x4f95('0x8'));var jayson=require(_0x4f95('0x9'));var client=jayson[_0x4f95('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d6129,_0x414fb1,_0x2b4724){return new BPromise(function(_0x3f8c9a,_0x4a61f7){return client['request'](_0x9d6129,_0x2b4724)[_0x4f95('0xb')](function(_0x22ecb1){logger[_0x4f95('0xc')]('Automation,\x20%s,\x20%s',_0x414fb1,'request\x20sent');logger['debug'](_0x4f95('0xd'),_0x414fb1,_0x4f95('0xe'),JSON[_0x4f95('0xf')](_0x22ecb1));if(_0x22ecb1[_0x4f95('0x10')]){if(_0x22ecb1['error'][_0x4f95('0x11')]===0x1f4){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);return _0x4a61f7(_0x22ecb1['error'][_0x4f95('0x13')]);}logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x22ecb1[_0x4f95('0x10')]['message']);return _0x3f8c9a(_0x22ecb1[_0x4f95('0x10')][_0x4f95('0x13')]);}else{logger[_0x4f95('0xc')]('Automation,\x20%s,\x20%s',_0x414fb1,_0x4f95('0xe'));_0x3f8c9a(_0x22ecb1[_0x4f95('0x14')][_0x4f95('0x13')]);}})[_0x4f95('0x15')](function(_0x3ea415){logger[_0x4f95('0x10')](_0x4f95('0x12'),_0x414fb1,_0x3ea415);_0x4a61f7(_0x3ea415);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 45f0c4d..140d7b4 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 _0xe64a=['connect-timeout','express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','/:id/conditions','getConditions','create','post','addConditions','addActions','put','update','delete','exports','multer','util','path'];(function(_0x34ebf3,_0x5935c5){var _0x3a634d=function(_0x4f5d92){while(--_0x4f5d92){_0x34ebf3['push'](_0x34ebf3['shift']());}};_0x3a634d(++_0x5935c5);}(_0xe64a,0x1e0));var _0xae64=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe64a[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xa')](_0xae64('0xd'),auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xa')]('/:id/actions',auth[_0xae64('0x8')](),controller['getActions']);router['post']('/',auth[_0xae64('0x8')](),controller[_0xae64('0xf')]);router[_0xae64('0x10')](_0xae64('0xd'),auth['isAuthenticated'](),controller[_0xae64('0x11')]);router['post']('/:id/actions',auth[_0xae64('0x8')](),controller[_0xae64('0x12')]);router[_0xae64('0x13')]('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x14')]);router[_0xae64('0x15')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller['destroy']);module[_0xae64('0x16')]=router; \ No newline at end of file +var _0xca8d=['../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addActions','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c90c4,_0x1b45a2){var _0xd58210=function(_0x2ff818){while(--_0x2ff818){_0x3c90c4['push'](_0x3c90c4['shift']());}};_0xd58210(++_0x1b45a2);}(_0xca8d,0x172));var _0xdca8=function(_0x621bee,_0x58f8c0){_0x621bee=_0x621bee-0x0;var _0x3076c8=_0xca8d[_0x621bee];return _0x3076c8;};'use strict';var multer=require(_0xdca8('0x0'));var util=require(_0xdca8('0x1'));var path=require(_0xdca8('0x2'));var timeout=require(_0xdca8('0x3'));var express=require(_0xdca8('0x4'));var router=express[_0xdca8('0x5')]();var fs_extra=require(_0xdca8('0x6'));var auth=require(_0xdca8('0x7'));var interaction=require(_0xdca8('0x8'));var config=require(_0xdca8('0x9'));var controller=require(_0xdca8('0xa'));router[_0xdca8('0xb')]('/',auth['isAuthenticated'](),controller[_0xdca8('0xc')]);router[_0xdca8('0xb')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0xf')]);router['get'](_0xdca8('0x10'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x11')]);router['get'](_0xdca8('0x12'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x13')]);router[_0xdca8('0x14')]('/',auth[_0xdca8('0xe')](),controller[_0xdca8('0x15')]);router[_0xdca8('0x14')](_0xdca8('0x10'),auth[_0xdca8('0xe')](),controller['addConditions']);router['post'](_0xdca8('0x12'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x16')]);router[_0xdca8('0x17')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x18')]);router[_0xdca8('0x19')](_0xdca8('0xd'),auth[_0xdca8('0xe')](),controller[_0xdca8('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e887690..607f87f 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 _0x53d6=['Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\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\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','BOOLEAN'];(function(_0x2f31ad,_0x646527){var _0x4ac734=function(_0x3ab636){while(--_0x3ab636){_0x2f31ad['push'](_0x2f31ad['shift']());}};_0x4ac734(++_0x646527);}(_0x53d6,0x113));var _0x653d=function(_0x919bbb,_0x55ef48){_0x919bbb=_0x919bbb-0x0;var _0x40971a=_0x53d6[_0x919bbb];return _0x40971a;};'use strict';var Sequelize=require('sequelize');module[_0x653d('0x0')]={'name':{'type':Sequelize[_0x653d('0x1')],'unique':_0x653d('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x653d('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x653d('0x1')]},'active':{'type':Sequelize[_0x653d('0x4')],'defaultValue':0x0,'comment':_0x653d('0x5')},'limitCalls':{'type':Sequelize[_0x653d('0x6')](0x4)[_0x653d('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x653d('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0x653d('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x653d('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x653d('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x653d('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x653d('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x653d('0xf')},'dialTimezone':{'type':Sequelize[_0x653d('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x653d('0x1')],'defaultValue':_0x653d('0x10')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x653d('0x11'),'never',_0x653d('0x12')),'defaultValue':_0x653d('0x11')},'dialAMDActive':{'type':Sequelize[_0x653d('0x4')],'defaultValue':0x0,'comment':_0x653d('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0x653d('0x6')](0x9)[_0x653d('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x653d('0x14')},'dialAMDGreeting':{'type':Sequelize[_0x653d('0x6')](0x9)[_0x653d('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x653d('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x653d('0x6')](0x9)[_0x653d('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x653d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x653d('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x653d('0x6')](0x9)[_0x653d('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x653d('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x653d('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x653d('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x653d('0x6')](0x9)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x653d('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x653d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x653d('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x653d('0x3')](_0x653d('0x1b'),_0x653d('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x653d('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x653d('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x653d('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x653d('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x653d('0x6')](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x653d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x653d('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x653d('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x653d('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x653d('0x22')}}; \ No newline at end of file +var _0x4b02=['never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','DESC','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always'];(function(_0x1dc278,_0x336c7f){var _0x346018=function(_0x202138){while(--_0x202138){_0x1dc278['push'](_0x1dc278['shift']());}};_0x346018(++_0x336c7f);}(_0x4b02,0xcd));var _0x24b0=function(_0x1b2be5,_0x143697){_0x1b2be5=_0x1b2be5-0x0;var _0x1f9972=_0x4b02[_0x1b2be5];return _0x1f9972;};'use strict';var Sequelize=require('sequelize');module[_0x24b0('0x0')]={'name':{'type':Sequelize[_0x24b0('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x24b0('0x2')](_0x24b0('0x3')),'allowNull':![],'defaultValue':_0x24b0('0x3')},'description':{'type':Sequelize[_0x24b0('0x1')]},'active':{'type':Sequelize[_0x24b0('0x4')],'defaultValue':0x0,'comment':_0x24b0('0x5')},'limitCalls':{'type':Sequelize[_0x24b0('0x6')](0x4)[_0x24b0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x24b0('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x24b0('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24b0('0x8')},'dialBusyMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x24b0('0x9')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x24b0('0xa')},'dialTimezone':{'type':Sequelize[_0x24b0('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x24b0('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x24b0('0x2')](_0x24b0('0xb'),_0x24b0('0xc'),_0x24b0('0xd')),'defaultValue':_0x24b0('0xb')},'dialAMDActive':{'type':Sequelize[_0x24b0('0x4')],'defaultValue':0x0,'comment':_0x24b0('0xe')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x24b0('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x24b0('0xf')},'dialAMDGreeting':{'type':Sequelize[_0x24b0('0x6')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x24b0('0x10')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x24b0('0x6')](0x9)[_0x24b0('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x24b0('0x11')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x24b0('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x24b0('0x12')},'dialAMDMinWordLength':{'type':Sequelize[_0x24b0('0x6')](0x9)[_0x24b0('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x24b0('0x6')](0x9)[_0x24b0('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x24b0('0x6')](0x9)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x24b0('0x13')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x24b0('0x6')](0x5)[_0x24b0('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x24b0('0x6')](0x9)[_0x24b0('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x24b0('0x14'),'ASC'),'defaultValue':_0x24b0('0x14')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x24b0('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x24b0('0x6')](0x3)[_0x24b0('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x24b0('0x15')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24b0('0x16')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x24b0('0x6')](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24b0('0x17')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24b0('0x18')},'dialDropRetryFrequency':{'type':Sequelize[_0x24b0('0x6')](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24b0('0x19')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x24b0('0x6')](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24b0('0x1a')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24b0('0x1b')},'dialMachineRetryFrequency':{'type':Sequelize[_0x24b0('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24b0('0x1c')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x24b0('0x6')](0x3)[_0x24b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x24b0('0x1d')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x24b0('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x24b0('0x1e')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 615f1e0..53ce267 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 _0xf150=['undefined','limit','count','set','Content-Range','then','destroy','get','IvrCampaigns','UserProfileResource','sendStatus','error','name','send','index','map','Campaign','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','keys','omit','createdAt','updatedAt','autoAssociation','update','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','order','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','cmHopperId','h.id','ci.item','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','format','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset'];(function(_0x15f5e4,_0x5b6b4c){var _0x4830e5=function(_0x112a4d){while(--_0x112a4d){_0x15f5e4['push'](_0x15f5e4['shift']());}};_0x4830e5(++_0x5b6b4c);}(_0xf150,0x106));var _0x0f15=function(_0x4865d8,_0x898ff5){_0x4865d8=_0x4865d8-0x0;var _0x134ccf=_0xf150[_0x4865d8];return _0x134ccf;};'use strict';var emlformat=require(_0x0f15('0x0'));var rimraf=require(_0x0f15('0x1'));var zipdir=require(_0x0f15('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f15('0x3'));var moment=require(_0x0f15('0x4'));var BPromise=require(_0x0f15('0x5'));var Mustache=require(_0x0f15('0x6'));var util=require(_0x0f15('0x7'));var path=require(_0x0f15('0x8'));var sox=require(_0x0f15('0x9'));var csv=require(_0x0f15('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0f15('0xb'));var squel=require(_0x0f15('0xc'));var crypto=require(_0x0f15('0xd'));var jsforce=require(_0x0f15('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0f15('0xa'));var querystring=require('querystring');var Papa=require(_0x0f15('0xf'));var Redis=require(_0x0f15('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0f15('0x11'));var hardwareService=require(_0x0f15('0x12'));var logger=require(_0x0f15('0x13'))('api');var utils=require(_0x0f15('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0f15('0x15'))['db'];function respondWithStatusCode(_0x2d9cc1,_0x3146d2){_0x3146d2=_0x3146d2||0xcc;return function(_0x446cce){if(_0x446cce){return _0x2d9cc1['sendStatus'](_0x3146d2);}return _0x2d9cc1[_0x0f15('0x16')](_0x3146d2)[_0x0f15('0x17')]();};}function respondWithResult(_0x47060d,_0x4a54ea){_0x4a54ea=_0x4a54ea||0xc8;return function(_0x5ab21b){if(_0x5ab21b){return _0x47060d['status'](_0x4a54ea)[_0x0f15('0x18')](_0x5ab21b);}};}function respondWithFilteredResult(_0x33b604,_0x48138c){return function(_0x5827a9){if(_0x5827a9){var _0x46d54b=typeof _0x48138c[_0x0f15('0x19')]===_0x0f15('0x1a')&&typeof _0x48138c[_0x0f15('0x1b')]===_0x0f15('0x1a');var _0x1657e2=_0x5827a9[_0x0f15('0x1c')];var _0x47fb13=_0x46d54b?0x0:_0x48138c[_0x0f15('0x19')];var _0xae2a06=_0x46d54b?_0x5827a9['count']:_0x48138c[_0x0f15('0x19')]+_0x48138c['limit'];var _0x40e739;if(_0xae2a06>=_0x1657e2){_0xae2a06=_0x1657e2;_0x40e739=0xc8;}else{_0x40e739=0xce;}_0x33b604['status'](_0x40e739);return _0x33b604[_0x0f15('0x1d')](_0x0f15('0x1e'),_0x47fb13+'-'+_0xae2a06+'/'+_0x1657e2)['json'](_0x5827a9);}return null;};}function patchUpdates(_0x45b7ed){return function(_0x2b10fd){try{jsonpatch['apply'](_0x2b10fd,_0x45b7ed,!![]);}catch(_0x179c70){return BPromise['reject'](_0x179c70);}return _0x2b10fd['save']();};}function saveUpdates(_0x8e5c1,_0x5d5adf){return function(_0x55a9d8){if(_0x55a9d8){return _0x55a9d8['update'](_0x8e5c1)[_0x0f15('0x1f')](function(_0x179c15){return _0x179c15;});}return null;};}function removeEntity(_0x349de2,_0x2ace21){return function(_0x159ba6){if(_0x159ba6){return _0x159ba6[_0x0f15('0x20')]()[_0x0f15('0x1f')](function(){var _0x26008e=_0x159ba6[_0x0f15('0x21')]({'plain':!![]});var _0x5c9187=_0x0f15('0x22');return db[_0x0f15('0x23')][_0x0f15('0x20')]({'where':{'type':_0x5c9187,'resourceId':_0x26008e['id']}})['then'](function(){return _0x159ba6;});})[_0x0f15('0x1f')](function(){_0x349de2[_0x0f15('0x16')](0xcc)[_0x0f15('0x17')]();});}};}function handleEntityNotFound(_0x23b58e,_0x262a11){return function(_0x455139){if(!_0x455139){_0x23b58e[_0x0f15('0x24')](0x194);}return _0x455139;};}function handleError(_0x1940dd,_0xdc54c3){_0xdc54c3=_0xdc54c3||0x1f4;return function(_0xcc9776){logger[_0x0f15('0x25')](_0xcc9776['stack']);if(_0xcc9776[_0x0f15('0x26')]){delete _0xcc9776[_0x0f15('0x26')];}_0x1940dd[_0x0f15('0x16')](_0xdc54c3)[_0x0f15('0x27')](_0xcc9776);};}exports[_0x0f15('0x28')]=function(_0x38759a,_0x552c80){var _0xa3177c={},_0x57ea7c={},_0x12fea1={'count':0x0,'rows':[]};var _0x32a284=_[_0x0f15('0x29')](db[_0x0f15('0x2a')]['rawAttributes'],function(_0x56d7ff){return{'name':_0x56d7ff['fieldName'],'type':_0x56d7ff[_0x0f15('0x2b')][_0x0f15('0x2c')]};});_0x57ea7c['model']=_[_0x0f15('0x29')](_0x32a284,_0x0f15('0x26'));_0x57ea7c[_0x0f15('0x2d')]=_['keys'](_0x38759a[_0x0f15('0x2d')]);_0x57ea7c[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x57ea7c[_0x0f15('0x30')],_0x57ea7c['query']);_0xa3177c['attributes']=_[_0x0f15('0x2f')](_0x57ea7c[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x38759a[_0x0f15('0x2d')][_0x0f15('0x31')]));_0xa3177c[_0x0f15('0x32')]=_0xa3177c[_0x0f15('0x32')][_0x0f15('0x33')]?_0xa3177c[_0x0f15('0x32')]:_0x57ea7c[_0x0f15('0x30')];if(!_0x38759a[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0xa3177c['limit']=qs[_0x0f15('0x1b')](_0x38759a['query']['limit']);_0xa3177c[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x38759a['query'][_0x0f15('0x19')]);}_0xa3177c['order']=qs['sort'](_0x38759a['query'][_0x0f15('0x36')]);_0xa3177c[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x38759a[_0x0f15('0x2d')],_0x57ea7c[_0x0f15('0x2e')]),_0x32a284);if(_0x38759a['query'][_0x0f15('0x39')]){_0xa3177c[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0xa3177c[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x32a284,function(_0x4e21f4){if(_0x4e21f4[_0x0f15('0x2b')]!==_0x0f15('0x3b')){var _0x3fe0c0={};_0x3fe0c0[_0x4e21f4[_0x0f15('0x26')]]={'$like':'%'+_0x38759a['query']['filter']+'%'};return _0x3fe0c0;}})});}_0xa3177c=_[_0x0f15('0x3a')]({},_0xa3177c,_0x38759a[_0x0f15('0x3c')]);var _0x12ba44={'where':_0xa3177c['where']};return db[_0x0f15('0x2a')][_0x0f15('0x1c')](_0x12ba44)[_0x0f15('0x1f')](function(_0x15cc38){_0x12fea1['count']=_0x15cc38;if(_0x38759a[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0xa3177c[_0x0f15('0x3e')]=[{'all':!![]}];}return db['Campaign'][_0x0f15('0x3f')](_0xa3177c);})[_0x0f15('0x1f')](function(_0x1f80a4){_0x12fea1[_0x0f15('0x40')]=_0x1f80a4;return _0x12fea1;})[_0x0f15('0x1f')](respondWithFilteredResult(_0x552c80,_0xa3177c))[_0x0f15('0x41')](handleError(_0x552c80,null));};exports[_0x0f15('0x42')]=function(_0x203255,_0x3348c2){var _0x3cdf3={'raw':![],'where':{'id':_0x203255[_0x0f15('0x43')]['id']}},_0x5ae190={};_0x5ae190[_0x0f15('0x30')]=_['keys'](db[_0x0f15('0x2a')][_0x0f15('0x44')]);_0x5ae190['query']=_['keys'](_0x203255[_0x0f15('0x2d')]);_0x5ae190[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x5ae190['model'],_0x5ae190['query']);_0x3cdf3[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x5ae190[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x203255[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x3cdf3[_0x0f15('0x32')]=_0x3cdf3['attributes'][_0x0f15('0x33')]?_0x3cdf3[_0x0f15('0x32')]:_0x5ae190[_0x0f15('0x30')];if(_0x203255['query']['includeAll']){_0x3cdf3[_0x0f15('0x3e')]=[{'all':!![]}];}_0x3cdf3=_['merge']({},_0x3cdf3,_0x203255[_0x0f15('0x3c')]);return db['Campaign'][_0x0f15('0x45')](_0x3cdf3)[_0x0f15('0x1f')](handleEntityNotFound(_0x3348c2,null))[_0x0f15('0x1f')](respondWithResult(_0x3348c2,null))[_0x0f15('0x41')](handleError(_0x3348c2,null));};exports[_0x0f15('0x46')]=function(_0x40e051,_0x5ec882){return db[_0x0f15('0x2a')][_0x0f15('0x46')](_0x40e051[_0x0f15('0x47')],{})['then'](function(_0x4de6d9){var _0x505882=_0x40e051[_0x0f15('0x48')][_0x0f15('0x21')]({'plain':!![]});if(!_0x505882)throw new Error(_0x0f15('0x49'));if(_0x505882[_0x0f15('0x4a')]===_0x0f15('0x48')){var _0x21a6a7=_0x4de6d9[_0x0f15('0x21')]({'plain':!![]});var _0x406eda='IvrCampaigns';return db[_0x0f15('0x4b')]['find']({'where':{'name':_0x406eda,'userProfileId':_0x505882[_0x0f15('0x4c')]},'raw':!![]})[_0x0f15('0x1f')](function(_0x1301b2){if(_0x1301b2&&_0x1301b2['autoAssociation']===0x0){return db['UserProfileResource'][_0x0f15('0x46')]({'name':_0x21a6a7[_0x0f15('0x26')],'resourceId':_0x21a6a7['id'],'type':_0x1301b2[_0x0f15('0x26')],'sectionId':_0x1301b2['id']},{})[_0x0f15('0x1f')](function(){return _0x4de6d9;});}else{return _0x4de6d9;}})['catch'](function(_0x5156d0){logger[_0x0f15('0x25')](_0x0f15('0x4d'),_0x5156d0);throw _0x5156d0;});}return _0x4de6d9;})[_0x0f15('0x1f')](respondWithResult(_0x5ec882,0xc9))[_0x0f15('0x41')](handleError(_0x5ec882,null));};exports[_0x0f15('0x4e')]=function(_0x1a1a39,_0x3d4eb0){var _0x354719={'where':{'id':_0x1a1a39[_0x0f15('0x43')]['id']}},_0x362d9b={};_0x362d9b['model']=_[_0x0f15('0x4f')](db['Campaign'][_0x0f15('0x44')]);_0x354719['attributes']=_[_0x0f15('0x2f')](_0x362d9b['model'],qs[_0x0f15('0x31')](_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x354719[_0x0f15('0x32')]=_0x354719[_0x0f15('0x32')][_0x0f15('0x33')]?_0x354719[_0x0f15('0x32')]:_0x362d9b[_0x0f15('0x30')];if(_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x354719[_0x0f15('0x3e')]=[{'all':!![]}];}_0x354719=_[_0x0f15('0x3a')]({},_0x354719,_0x1a1a39[_0x0f15('0x3c')]);return db[_0x0f15('0x2a')]['find'](_0x354719)['then'](handleEntityNotFound(_0x3d4eb0,null))[_0x0f15('0x1f')](function(_0x5f7b10){if(_0x5f7b10){var _0x509b42=_0x5f7b10[_0x0f15('0x21')]({'plain':!![]});_0x509b42=qs[_0x0f15('0x50')](_0x509b42,['id',_0x0f15('0x51'),_0x0f15('0x52')]);_0x1a1a39[_0x0f15('0x47')]=_[_0x0f15('0x50')](_0x1a1a39[_0x0f15('0x47')],['id',_0x0f15('0x51'),_0x0f15('0x52')]);return db[_0x0f15('0x2a')][_0x0f15('0x46')](_['merge'](_0x509b42,_0x1a1a39[_0x0f15('0x47')]),{'include':_0x1a1a39[_0x0f15('0x2d')][_0x0f15('0x3d')]?[{'all':!![]}]:undefined})[_0x0f15('0x1f')](function(_0x425a9c){var _0x272977=_0x1a1a39[_0x0f15('0x48')][_0x0f15('0x21')]({'plain':!![]});if(!_0x272977)throw new Error(_0x0f15('0x49'));if(_0x272977['role']==='user'){var _0x48eb5a=_0x425a9c['get']({'plain':!![]});var _0x54dfd8='IvrCampaigns';return db[_0x0f15('0x4b')][_0x0f15('0x45')]({'where':{'name':_0x54dfd8,'userProfileId':_0x272977[_0x0f15('0x4c')]},'raw':!![]})[_0x0f15('0x1f')](function(_0x26341a){if(_0x26341a&&_0x26341a[_0x0f15('0x53')]===0x0){return db[_0x0f15('0x23')][_0x0f15('0x46')]({'name':_0x48eb5a['name'],'resourceId':_0x48eb5a['id'],'type':_0x26341a[_0x0f15('0x26')],'sectionId':_0x26341a['id']},{})[_0x0f15('0x1f')](function(){return _0x425a9c;});}else{return _0x425a9c;}})[_0x0f15('0x41')](function(_0x3c8960){logger[_0x0f15('0x25')](_0x0f15('0x4d'),_0x3c8960);throw _0x3c8960;});}return _0x425a9c;});}})[_0x0f15('0x1f')](respondWithResult(_0x3d4eb0,0xc9))[_0x0f15('0x41')](handleError(_0x3d4eb0,null));};exports[_0x0f15('0x54')]=function(_0x5374d0,_0x113531){if(_0x5374d0['body']['id']){delete _0x5374d0[_0x0f15('0x47')]['id'];}return db[_0x0f15('0x2a')]['find']({'where':{'id':_0x5374d0[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x113531,null))[_0x0f15('0x1f')](saveUpdates(_0x5374d0[_0x0f15('0x47')],null))['then'](respondWithResult(_0x113531,null))['catch'](handleError(_0x113531,null));};exports[_0x0f15('0x20')]=function(_0x2395c6,_0x1ded63){return db['Campaign'][_0x0f15('0x45')]({'where':{'id':_0x2395c6[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x1ded63,null))[_0x0f15('0x1f')](removeEntity(_0x1ded63,null))[_0x0f15('0x41')](handleError(_0x1ded63,null));};exports['getHoppers']=function(_0x1b4b64,_0x51ad6d,_0x30b3f2){var _0xc17fee={'raw':!![],'where':{}};var _0x2d8a39={};var _0x46cb18={'count':0x0,'rows':[]};return db['Campaign'][_0x0f15('0x55')]({'where':{'id':_0x1b4b64[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x51ad6d,null))[_0x0f15('0x1f')](function(_0x4408e){if(_0x4408e){_0x2d8a39[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x56')][_0x0f15('0x44')]);_0x2d8a39[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x1b4b64[_0x0f15('0x2d')]);_0x2d8a39[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x2d8a39[_0x0f15('0x30')],_0x2d8a39['query']);_0xc17fee[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x2d8a39[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x1b4b64['query'][_0x0f15('0x31')]));_0xc17fee['attributes']=_0xc17fee[_0x0f15('0x32')][_0x0f15('0x33')]?_0xc17fee[_0x0f15('0x32')]:_0x2d8a39[_0x0f15('0x30')];if(!_0x1b4b64['query'][_0x0f15('0x34')](_0x0f15('0x35'))){_0xc17fee[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x1b4b64[_0x0f15('0x2d')]['limit']);_0xc17fee[_0x0f15('0x19')]=qs['offset'](_0x1b4b64['query'][_0x0f15('0x19')]);}_0xc17fee['order']=qs[_0x0f15('0x36')](_0x1b4b64['query'][_0x0f15('0x36')]);_0xc17fee[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x1b4b64[_0x0f15('0x2d')],_0x2d8a39['filters']));_0xc17fee[_0x0f15('0x37')][_0x0f15('0x57')]=_0x4408e['id'];if(_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x39')]){_0xc17fee['where']=_[_0x0f15('0x3a')](_0xc17fee[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0xc17fee[_0x0f15('0x32')],function(_0x537f80){var _0x370c04={};_0x370c04[_0x537f80]={'$like':'%'+_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x370c04;})});}_0xc17fee=_[_0x0f15('0x3a')]({},_0xc17fee,_0x1b4b64[_0x0f15('0x3c')]);return db[_0x0f15('0x56')][_0x0f15('0x1c')]({'where':_0xc17fee[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x51082a){_0x46cb18['count']=_0x51082a;if(_0x1b4b64[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0xc17fee[_0x0f15('0x3e')]=[{'all':!![]}];}return db[_0x0f15('0x56')]['findAll'](_0xc17fee);})[_0x0f15('0x1f')](function(_0x2b0fd6){_0x46cb18[_0x0f15('0x40')]=_0x2b0fd6;return _0x46cb18;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x51ad6d,_0xc17fee))['catch'](handleError(_0x51ad6d,null));};exports[_0x0f15('0x58')]=function(_0xad1b45,_0x388c62,_0x1319fd){var _0x1e198c={'raw':!![],'where':{}};var _0x26ee7b={};var _0x22ac0e={'count':0x0,'rows':[]};return db[_0x0f15('0x2a')][_0x0f15('0x55')]({'where':{'id':_0xad1b45[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x388c62,null))[_0x0f15('0x1f')](function(_0x24cd99){if(_0x24cd99){_0x26ee7b['model']=_['keys'](db[_0x0f15('0x59')]['rawAttributes']);_0x26ee7b[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0xad1b45['query']);_0x26ee7b[_0x0f15('0x2e')]=_['intersection'](_0x26ee7b['model'],_0x26ee7b[_0x0f15('0x2d')]);_0x1e198c[_0x0f15('0x32')]=_[_0x0f15('0x2f')](_0x26ee7b[_0x0f15('0x30')],qs['fields'](_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x1e198c[_0x0f15('0x32')]=_0x1e198c[_0x0f15('0x32')]['length']?_0x1e198c[_0x0f15('0x32')]:_0x26ee7b[_0x0f15('0x30')];if(!_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x1e198c[_0x0f15('0x1b')]=qs['limit'](_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x1e198c[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0xad1b45['query']['offset']);}_0x1e198c[_0x0f15('0x5a')]=qs[_0x0f15('0x36')](_0xad1b45['query'][_0x0f15('0x36')]);_0x1e198c[_0x0f15('0x37')]=qs['filters'](_['pick'](_0xad1b45[_0x0f15('0x2d')],_0x26ee7b[_0x0f15('0x2e')]));_0x1e198c[_0x0f15('0x37')]['CampaignId']=_0x24cd99['id'];if(_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x39')]){_0x1e198c[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x1e198c[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x1e198c[_0x0f15('0x32')],function(_0x1166ef){var _0x467368={};_0x467368[_0x1166ef]={'$like':'%'+_0xad1b45[_0x0f15('0x2d')]['filter']+'%'};return _0x467368;})});}_0x1e198c=_['merge']({},_0x1e198c,_0xad1b45[_0x0f15('0x3c')]);return db[_0x0f15('0x59')]['count']({'where':_0x1e198c[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x33861b){_0x22ac0e[_0x0f15('0x1c')]=_0x33861b;if(_0xad1b45[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x1e198c[_0x0f15('0x3e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0f15('0x3f')](_0x1e198c);})[_0x0f15('0x1f')](function(_0x55ee1e){_0x22ac0e[_0x0f15('0x40')]=_0x55ee1e;return _0x22ac0e;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x388c62,_0x1e198c))[_0x0f15('0x41')](handleError(_0x388c62,null));};exports['getHopperFinals']=function(_0x3e5ab0,_0xf82f66,_0x331300){var _0x2571e8={'raw':!![],'where':{}};var _0x1c2ed7={};var _0x5ad3c5={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x3e5ab0[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0xf82f66,null))['then'](function(_0x52bea2){if(_0x52bea2){_0x1c2ed7[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db['CmHopperFinal']['rawAttributes']);_0x1c2ed7[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x3e5ab0[_0x0f15('0x2d')]);_0x1c2ed7[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x1c2ed7[_0x0f15('0x30')],_0x1c2ed7['query']);_0x2571e8['attributes']=_['intersection'](_0x1c2ed7[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x2571e8['attributes']=_0x2571e8[_0x0f15('0x32')]['length']?_0x2571e8['attributes']:_0x1c2ed7[_0x0f15('0x30')];if(!_0x3e5ab0['query'][_0x0f15('0x34')](_0x0f15('0x35'))){_0x2571e8[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x3e5ab0[_0x0f15('0x2d')]['limit']);_0x2571e8[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x19')]);}_0x2571e8['order']=qs[_0x0f15('0x36')](_0x3e5ab0['query'][_0x0f15('0x36')]);_0x2571e8[_0x0f15('0x37')]=qs['filters'](_[_0x0f15('0x38')](_0x3e5ab0[_0x0f15('0x2d')],_0x1c2ed7['filters']));_0x2571e8[_0x0f15('0x37')][_0x0f15('0x57')]=_0x52bea2['id'];if(_0x3e5ab0[_0x0f15('0x2d')]['filter']){_0x2571e8[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x2571e8[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x2571e8[_0x0f15('0x32')],function(_0x69aca7){var _0x9f511c={};_0x9f511c[_0x69aca7]={'$like':'%'+_0x3e5ab0[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x9f511c;})});}_0x2571e8=_[_0x0f15('0x3a')]({},_0x2571e8,_0x3e5ab0[_0x0f15('0x3c')]);return db[_0x0f15('0x5b')][_0x0f15('0x1c')]({'where':_0x2571e8[_0x0f15('0x37')]})['then'](function(_0x4a68a8){_0x5ad3c5[_0x0f15('0x1c')]=_0x4a68a8;if(_0x3e5ab0['query'][_0x0f15('0x3d')]){_0x2571e8[_0x0f15('0x3e')]=[{'all':!![]}];}return db[_0x0f15('0x5b')][_0x0f15('0x3f')](_0x2571e8);})['then'](function(_0x352f5d){_0x5ad3c5['rows']=_0x352f5d;return _0x5ad3c5;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0xf82f66,_0x2571e8))[_0x0f15('0x41')](handleError(_0xf82f66,null));};exports[_0x0f15('0x5c')]=function(_0xc8d0cb,_0x198650,_0x50f2ea){var _0x4286d6={'raw':!![],'where':{}};var _0x26a1b2={};var _0x3ec85d={'count':0x0,'rows':[]};return db[_0x0f15('0x2a')]['findOne']({'where':{'id':_0xc8d0cb[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x198650,null))[_0x0f15('0x1f')](function(_0x21bce5){if(_0x21bce5){_0x26a1b2[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x5d')]['rawAttributes']);_0x26a1b2[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0xc8d0cb[_0x0f15('0x2d')]);_0x26a1b2[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x26a1b2['model'],_0x26a1b2[_0x0f15('0x2d')]);_0x4286d6['attributes']=_[_0x0f15('0x2f')](_0x26a1b2[_0x0f15('0x30')],qs['fields'](_0xc8d0cb['query'][_0x0f15('0x31')]));_0x4286d6[_0x0f15('0x32')]=_0x4286d6['attributes']['length']?_0x4286d6[_0x0f15('0x32')]:_0x26a1b2['model'];if(!_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x4286d6[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x4286d6['offset']=qs[_0x0f15('0x19')](_0xc8d0cb[_0x0f15('0x2d')]['offset']);}_0x4286d6[_0x0f15('0x5a')]=qs[_0x0f15('0x36')](_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x36')]);_0x4286d6['where']=qs[_0x0f15('0x2e')](_['pick'](_0xc8d0cb[_0x0f15('0x2d')],_0x26a1b2[_0x0f15('0x2e')]));_0x4286d6[_0x0f15('0x37')][_0x0f15('0x57')]=_0x21bce5['id'];if(_0xc8d0cb[_0x0f15('0x2d')]['filter']){_0x4286d6['where']=_['merge'](_0x4286d6[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x4286d6[_0x0f15('0x32')],function(_0x1b6554){var _0x3789a5={};_0x3789a5[_0x1b6554]={'$like':'%'+_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x3789a5;})});}_0x4286d6=_['merge']({},_0x4286d6,_0xc8d0cb[_0x0f15('0x3c')]);return db[_0x0f15('0x5d')][_0x0f15('0x1c')]({'where':_0x4286d6[_0x0f15('0x37')]})[_0x0f15('0x1f')](function(_0x3f3608){_0x3ec85d[_0x0f15('0x1c')]=_0x3f3608;if(_0xc8d0cb[_0x0f15('0x2d')][_0x0f15('0x3d')]){_0x4286d6[_0x0f15('0x3e')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x4286d6);})[_0x0f15('0x1f')](function(_0x279ac5){_0x3ec85d[_0x0f15('0x40')]=_0x279ac5;return _0x3ec85d;});}})[_0x0f15('0x1f')](respondWithFilteredResult(_0x198650,_0x4286d6))[_0x0f15('0x41')](handleError(_0x198650,null));};exports['getLists']=function(_0x40e1e4,_0x45db14,_0x2f1969){var _0x33b2f2={};var _0x2b72a7={};var _0x3c0387;var _0x20b219;return db[_0x0f15('0x2a')][_0x0f15('0x55')]({'where':{'id':_0x40e1e4[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x45db14,null))[_0x0f15('0x1f')](function(_0x21deec){if(_0x21deec){_0x3c0387=_0x21deec;_0x2b72a7[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db[_0x0f15('0x5e')]['rawAttributes']);_0x2b72a7[_0x0f15('0x2d')]=_[_0x0f15('0x4f')](_0x40e1e4[_0x0f15('0x2d')]);_0x2b72a7[_0x0f15('0x2e')]=_['intersection'](_0x2b72a7[_0x0f15('0x30')],_0x2b72a7[_0x0f15('0x2d')]);_0x33b2f2[_0x0f15('0x32')]=_['intersection'](_0x2b72a7[_0x0f15('0x30')],qs[_0x0f15('0x31')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x31')]));_0x33b2f2['attributes']=_0x33b2f2['attributes'][_0x0f15('0x33')]?_0x33b2f2[_0x0f15('0x32')]:_0x2b72a7['model'];_0x33b2f2['order']=qs[_0x0f15('0x36')](_0x40e1e4['query'][_0x0f15('0x36')]);_0x33b2f2[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_[_0x0f15('0x38')](_0x40e1e4[_0x0f15('0x2d')],_0x2b72a7[_0x0f15('0x2e')]));if(_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x39')]){_0x33b2f2[_0x0f15('0x37')]=_[_0x0f15('0x3a')](_0x33b2f2[_0x0f15('0x37')],{'$or':_[_0x0f15('0x29')](_0x33b2f2[_0x0f15('0x32')],function(_0x21e48c){var _0x587cde={};_0x587cde[_0x21e48c]={'$like':'%'+_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x587cde;})});}_0x33b2f2=_[_0x0f15('0x3a')]({},_0x33b2f2,_0x40e1e4[_0x0f15('0x3c')]);return _0x3c0387['getLists'](_0x33b2f2);}})[_0x0f15('0x1f')](function(_0x1a3352){if(_0x1a3352){_0x20b219=_0x1a3352[_0x0f15('0x33')];if(!_0x40e1e4[_0x0f15('0x2d')]['hasOwnProperty']('nolimit')){_0x33b2f2['limit']=qs[_0x0f15('0x1b')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x33b2f2[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x40e1e4[_0x0f15('0x2d')][_0x0f15('0x19')]);}return _0x3c0387['getLists'](_0x33b2f2);}})[_0x0f15('0x1f')](function(_0x3442d6){if(_0x3442d6){return _0x3442d6?{'count':_0x20b219,'rows':_0x3442d6}:null;}})[_0x0f15('0x1f')](respondWithResult(_0x45db14,null))[_0x0f15('0x41')](handleError(_0x45db14,null));};exports[_0x0f15('0x5f')]=function(_0x4b3747,_0x2da705,_0x62a577){var _0x38bd84,_0xadcce8;var _0x1ec4fb=[];var _0x4ea4a3=moment()['format'](_0x0f15('0x60'));return db['Campaign'][_0x0f15('0x45')]({'where':{'id':_0x4b3747['params']['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x2da705,null))[_0x0f15('0x1f')](function(_0x284d9a){if(_0x284d9a){_0xadcce8=_0x284d9a;return _0x284d9a[_0x0f15('0x5f')](_0x4b3747[_0x0f15('0x47')][_0x0f15('0x61')],_['omit'](_0x4b3747['body'],['ids','id'])||{});}return null;})[_0x0f15('0x62')](function(_0x342516){var _0x30c890;var _0x3d985c;_0x38bd84=_0x342516||[];var _0x2382ab=[];if(_0x342516){for(var _0x54bdc6=0x0;_0x54bdc6<_0x342516['length'];_0x54bdc6+=0x1){var _0x1f2a6f=_0x342516[_0x54bdc6][_0x0f15('0x21')]({'plain':!![]});_0xadcce8[_0x0f15('0x63')]=_0x4b3747[_0x0f15('0x47')][_0x0f15('0x63')]?_0x4b3747[_0x0f15('0x47')][_0x0f15('0x63')]:_0xadcce8[_0x0f15('0x63')];switch(_0xadcce8[_0x0f15('0x63')]){case'always':_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x66'))[_0x0f15('0x67')]([_0x0f15('0x68'),'scheduledAt',_0x0f15('0x69'),_0x0f15('0x6a'),'CampaignId',_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')]('phone',_0x0f15('0x68'))[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')]('id','ContactId')[_0x0f15('0x6c')](_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')](),_0x0f15('0x6a'))['field'](_0x4b3747[_0x0f15('0x43')]['id']['toString'](),'CampaignId')[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')](_0x0f15('0x73'))[_0x0f15('0x37')]('ListId\x20=\x20?',_0x1f2a6f['CmListId'][_0x0f15('0x70')]())[_0x0f15('0x37')]('phone\x20IS\x20NOT\x20NULL')[_0x0f15('0x37')](_0x0f15('0x74'),squel['select']()[_0x0f15('0x6c')](_0x0f15('0x75'))[_0x0f15('0x71')](_0x0f15('0x76'))[_0x0f15('0x37')](_0x0f15('0x77'),_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')]()))['where'](_0x0f15('0x74'),squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')](_0x0f15('0x78'))[_0x0f15('0x71')](_0x0f15('0x66'))[_0x0f15('0x37')]('CampaignId\x20=\x20?',_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')]())))[_0x0f15('0x70')]();break;case _0x0f15('0x79'):_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')]('cm_hopper')[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x6e'),_0x0f15('0x69'),_0x0f15('0x6a'),_0x0f15('0x57'),'createdAt',_0x0f15('0x52')],squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')]('phone',_0x0f15('0x68'))['field'](_0x0f15('0x6d'),'scheduledAt')[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x1f2a6f[_0x0f15('0x6f')]['toString'](),'ListId')[_0x0f15('0x6c')](_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')]('deletedAt\x20IS\x20NULL')[_0x0f15('0x37')](_0x0f15('0x7a'),_0x1f2a6f['CmListId']['toString']())['where']('phone\x20IS\x20NOT\x20NULL')[_0x0f15('0x37')](_0x0f15('0x74'),squel[_0x0f15('0x6b')]()[_0x0f15('0x6c')](_0x0f15('0x78'))['from'](_0x0f15('0x66'))[_0x0f15('0x37')](_0x0f15('0x77'),_0x4b3747['params']['id'][_0x0f15('0x70')]())))[_0x0f15('0x70')]();break;default:_0x30c890=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x66'))[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x6e'),'ContactId',_0x0f15('0x6a'),_0x0f15('0x57'),_0x0f15('0x51'),_0x0f15('0x52')],squel['select']()[_0x0f15('0x6c')](_0x0f15('0x68'),'phone')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')](),_0x0f15('0x6a'))[_0x0f15('0x6c')](_0x4b3747[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27','createdAt')[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27','updatedAt')[_0x0f15('0x71')](_0x0f15('0x72'))[_0x0f15('0x37')](_0x0f15('0x73'))[_0x0f15('0x37')](_0x0f15('0x7a'),_0x1f2a6f[_0x0f15('0x6f')][_0x0f15('0x70')]())['where'](_0x0f15('0x7b')))[_0x0f15('0x70')]();}_0x3d985c=squel[_0x0f15('0x64')]()['into']('cm_hopper_additional_phones')['fromQuery']([_0x0f15('0x7c'),_0x0f15('0x6e'),_0x0f15('0x68'),'OrderBy',_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()['field'](_0x0f15('0x7d'),'id')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x6e'))[_0x0f15('0x6c')](_0x0f15('0x7e'),_0x0f15('0x68'))[_0x0f15('0x6c')](_0x0f15('0x7f'),_0x0f15('0x80'))['field']('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x51'))[_0x0f15('0x6c')]('\x27'+_0x4ea4a3+'\x27',_0x0f15('0x52'))[_0x0f15('0x71')](_0x0f15('0x81'),'ci')[_0x0f15('0x82')]('cm_hopper','h',_0x0f15('0x83'))[_0x0f15('0x37')](_0x0f15('0x84'),_0x1f2a6f[_0x0f15('0x6f')]['toString']())[_0x0f15('0x37')](_0x0f15('0x85'),_0x4b3747[_0x0f15('0x43')]['id']['toString']())[_0x0f15('0x37')](_0x0f15('0x86'),_0x4ea4a3))[_0x0f15('0x70')]();_0x2382ab[_0x0f15('0x87')](db['sequelize'][_0x0f15('0x2d')](_0x30c890));_0x1ec4fb[_0x0f15('0x87')](db[_0x0f15('0x88')][_0x0f15('0x2d')](_0x3d985c));}return BPromise[_0x0f15('0x89')](_0x2382ab);}})[_0x0f15('0x1f')](function(){return BPromise[_0x0f15('0x89')](_0x1ec4fb);})[_0x0f15('0x1f')](function(){return _0x38bd84;})[_0x0f15('0x1f')](respondWithResult(_0x2da705,null))[_0x0f15('0x41')](handleError(_0x2da705,null));};exports[_0x0f15('0x8a')]=function(_0x5e1ec9,_0x4a291e,_0x361b46){return db[_0x0f15('0x2a')][_0x0f15('0x45')]({'where':{'id':_0x5e1ec9[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x4a291e,null))['then'](function(_0x593b4a){if(_0x593b4a){return _0x593b4a[_0x0f15('0x8a')](_0x5e1ec9[_0x0f15('0x2d')][_0x0f15('0x61')]);}})[_0x0f15('0x1f')](function(_0x42e655){if(_0x42e655){return db[_0x0f15('0x56')][_0x0f15('0x20')]({'where':{'ListId':_0x5e1ec9[_0x0f15('0x2d')]['ids'],'CampaignId':_0x5e1ec9[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](function(){return _0x42e655;});}})[_0x0f15('0x1f')](respondWithStatusCode(_0x4a291e,null))[_0x0f15('0x41')](handleError(_0x4a291e,null));};exports[_0x0f15('0x8b')]=function(_0x2d7b10,_0x4c5fce,_0x18d4a0){var _0x4cdf30={};var _0x31b1be={};var _0x32f15b;var _0x181426;return db['Campaign']['findOne']({'where':{'id':_0x2d7b10[_0x0f15('0x43')]['id']}})['then'](handleEntityNotFound(_0x4c5fce,null))[_0x0f15('0x1f')](function(_0x9e1991){if(_0x9e1991){_0x32f15b=_0x9e1991;_0x31b1be[_0x0f15('0x30')]=_[_0x0f15('0x4f')](db['CmList'][_0x0f15('0x44')]);_0x31b1be['query']=_['keys'](_0x2d7b10[_0x0f15('0x2d')]);_0x31b1be[_0x0f15('0x2e')]=_[_0x0f15('0x2f')](_0x31b1be[_0x0f15('0x30')],_0x31b1be[_0x0f15('0x2d')]);_0x4cdf30['attributes']=_['intersection'](_0x31b1be['model'],qs['fields'](_0x2d7b10['query'][_0x0f15('0x31')]));_0x4cdf30['attributes']=_0x4cdf30[_0x0f15('0x32')]['length']?_0x4cdf30[_0x0f15('0x32')]:_0x31b1be[_0x0f15('0x30')];_0x4cdf30['order']=qs[_0x0f15('0x36')](_0x2d7b10['query'][_0x0f15('0x36')]);_0x4cdf30[_0x0f15('0x37')]=qs[_0x0f15('0x2e')](_['pick'](_0x2d7b10[_0x0f15('0x2d')],_0x31b1be[_0x0f15('0x2e')]));if(_0x2d7b10[_0x0f15('0x2d')]['filter']){_0x4cdf30[_0x0f15('0x37')]=_['merge'](_0x4cdf30['where'],{'$or':_[_0x0f15('0x29')](_0x4cdf30[_0x0f15('0x32')],function(_0x3e68a6){var _0x43024f={};_0x43024f[_0x3e68a6]={'$like':'%'+_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x39')]+'%'};return _0x43024f;})});}_0x4cdf30=_[_0x0f15('0x3a')]({},_0x4cdf30,_0x2d7b10[_0x0f15('0x3c')]);return _0x32f15b[_0x0f15('0x8b')](_0x4cdf30);}})['then'](function(_0xf4d29b){if(_0xf4d29b){_0x181426=_0xf4d29b[_0x0f15('0x33')];if(!_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x34')](_0x0f15('0x35'))){_0x4cdf30[_0x0f15('0x1b')]=qs[_0x0f15('0x1b')](_0x2d7b10[_0x0f15('0x2d')][_0x0f15('0x1b')]);_0x4cdf30[_0x0f15('0x19')]=qs[_0x0f15('0x19')](_0x2d7b10['query'][_0x0f15('0x19')]);}return _0x32f15b['getBlackLists'](_0x4cdf30);}})[_0x0f15('0x1f')](function(_0x5e4c0e){if(_0x5e4c0e){return _0x5e4c0e?{'count':_0x181426,'rows':_0x5e4c0e}:null;}})['then'](respondWithResult(_0x4c5fce,null))['catch'](handleError(_0x4c5fce,null));};exports[_0x0f15('0x8c')]=function(_0x76969a,_0x5488b7,_0x3d0fa2){var _0x1aefa1,_0x4ed614;var _0x52dc22=[];var _0x13af67=moment()[_0x0f15('0x8d')](_0x0f15('0x60'));return db[_0x0f15('0x2a')][_0x0f15('0x45')]({'where':{'id':_0x76969a['params']['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x5488b7,null))[_0x0f15('0x1f')](function(_0x3f051f){if(_0x3f051f){_0x4ed614=_0x3f051f;return _0x3f051f[_0x0f15('0x8c')](_0x76969a['body'][_0x0f15('0x61')],_[_0x0f15('0x50')](_0x76969a[_0x0f15('0x47')],[_0x0f15('0x61'),'id'])||{});}return null;})[_0x0f15('0x62')](function(_0x51e994){var _0x4f85ec;var _0x2ec92a;_0x1aefa1=_0x51e994||[];var _0x2996bd=[];if(_0x51e994){for(var _0x36d9c0=0x0;_0x36d9c0<_0x51e994['length'];_0x36d9c0+=0x1){var _0x23c9c6=_0x51e994[_0x36d9c0][_0x0f15('0x21')]({'plain':!![]});_0x4f85ec=squel[_0x0f15('0x64')]()[_0x0f15('0x65')](_0x0f15('0x8e'))[_0x0f15('0x67')]([_0x0f15('0x68'),_0x0f15('0x69'),_0x0f15('0x6a'),_0x0f15('0x57'),_0x0f15('0x51'),_0x0f15('0x52')],squel[_0x0f15('0x6b')]()['field'](_0x0f15('0x68'),'phone')[_0x0f15('0x6c')]('id',_0x0f15('0x69'))['field'](_0x23c9c6[_0x0f15('0x6f')][_0x0f15('0x70')](),'ListId')['field'](_0x76969a[_0x0f15('0x43')]['id'][_0x0f15('0x70')](),_0x0f15('0x57'))[_0x0f15('0x6c')](_0x0f15('0x6d'),'createdAt')[_0x0f15('0x6c')](_0x0f15('0x6d'),_0x0f15('0x52'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x0f15('0x37')]('ListId\x20=\x20?',_0x23c9c6[_0x0f15('0x6f')][_0x0f15('0x70')]())[_0x0f15('0x37')](_0x0f15('0x7b')))['toString']();_0x2996bd[_0x0f15('0x87')](db[_0x0f15('0x88')][_0x0f15('0x2d')](_0x4f85ec));}return BPromise[_0x0f15('0x89')](_0x2996bd);}})[_0x0f15('0x1f')](function(){return _0x1aefa1;})[_0x0f15('0x1f')](respondWithResult(_0x5488b7,null))[_0x0f15('0x41')](handleError(_0x5488b7,null));};exports[_0x0f15('0x8f')]=function(_0x625c73,_0x5f0f4b,_0x589af0){return db[_0x0f15('0x2a')]['find']({'where':{'id':_0x625c73[_0x0f15('0x43')]['id']}})[_0x0f15('0x1f')](handleEntityNotFound(_0x5f0f4b,null))[_0x0f15('0x1f')](function(_0x28662c){if(_0x28662c){return _0x28662c[_0x0f15('0x8f')](_0x625c73['query'][_0x0f15('0x61')]);}})[_0x0f15('0x1f')](function(_0xd86a3){if(_0xd86a3){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x625c73[_0x0f15('0x2d')][_0x0f15('0x61')],'CampaignId':_0x625c73['params']['id']}})[_0x0f15('0x1f')](function(){return _0xd86a3;});}})['then'](respondWithStatusCode(_0x5f0f4b,null))[_0x0f15('0x41')](handleError(_0x5f0f4b,null));}; \ No newline at end of file +var _0x4dd2=['order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','body','updatedAt','update','getHoppers','findOne','CmHopper','nolimit','CampaignId','getHopperHistories','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ListId','field','NOW()','ContactId','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','fromQuery','ListId\x20=\x20?','cm_hopper_additional_phones','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','get','UserProfileResource','then','sendStatus','stack','name','send','map','Campaign','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x2abaae,_0x29fd8b){var _0x5b5745=function(_0x2f6218){while(--_0x2f6218){_0x2abaae['push'](_0x2abaae['shift']());}};_0x5b5745(++_0x29fd8b);}(_0x4dd2,0xf1));var _0x24dd=function(_0x5d4460,_0x400e28){_0x5d4460=_0x5d4460-0x0;var _0x5bdc5e=_0x4dd2[_0x5d4460];return _0x5bdc5e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24dd('0x0'));var zipdir=require(_0x24dd('0x1'));var jsonpatch=require(_0x24dd('0x2'));var rp=require('request-promise');var moment=require(_0x24dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x24dd('0x4'));var util=require('util');var path=require(_0x24dd('0x5'));var sox=require(_0x24dd('0x6'));var csv=require(_0x24dd('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x24dd('0x8'));var squel=require(_0x24dd('0x9'));var crypto=require(_0x24dd('0xa'));var jsforce=require(_0x24dd('0xb'));var deskjs=require(_0x24dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0x24dd('0xd'));var Papa=require(_0x24dd('0xe'));var Redis=require(_0x24dd('0xf'));var authService=require(_0x24dd('0x10'));var qs=require(_0x24dd('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x24dd('0x12'));var logger=require(_0x24dd('0x13'))(_0x24dd('0x14'));var utils=require(_0x24dd('0x15'));var config=require(_0x24dd('0x16'));var licenseUtil=require(_0x24dd('0x17'));var db=require(_0x24dd('0x18'))['db'];function respondWithStatusCode(_0x167581,_0x4d8c55){_0x4d8c55=_0x4d8c55||0xcc;return function(_0x46b06c){if(_0x46b06c){return _0x167581['sendStatus'](_0x4d8c55);}return _0x167581[_0x24dd('0x19')](_0x4d8c55)[_0x24dd('0x1a')]();};}function respondWithResult(_0x4b3f0d,_0x5498a6){_0x5498a6=_0x5498a6||0xc8;return function(_0x45da78){if(_0x45da78){return _0x4b3f0d[_0x24dd('0x19')](_0x5498a6)[_0x24dd('0x1b')](_0x45da78);}};}function respondWithFilteredResult(_0x4c5ced,_0xa40b5c){return function(_0x5a4a2c){if(_0x5a4a2c){var _0x397e7e=typeof _0xa40b5c[_0x24dd('0x1c')]===_0x24dd('0x1d')&&typeof _0xa40b5c[_0x24dd('0x1e')]==='undefined';var _0x1fbef8=_0x5a4a2c[_0x24dd('0x1f')];var _0x593c8c=_0x397e7e?0x0:_0xa40b5c['offset'];var _0x2962d0=_0x397e7e?_0x5a4a2c['count']:_0xa40b5c[_0x24dd('0x1c')]+_0xa40b5c[_0x24dd('0x1e')];var _0x362d37;if(_0x2962d0>=_0x1fbef8){_0x2962d0=_0x1fbef8;_0x362d37=0xc8;}else{_0x362d37=0xce;}_0x4c5ced[_0x24dd('0x19')](_0x362d37);return _0x4c5ced[_0x24dd('0x20')](_0x24dd('0x21'),_0x593c8c+'-'+_0x2962d0+'/'+_0x1fbef8)['json'](_0x5a4a2c);}return null;};}function patchUpdates(_0x54a753){return function(_0x1e2ea9){try{jsonpatch[_0x24dd('0x22')](_0x1e2ea9,_0x54a753,!![]);}catch(_0x4bafcf){return BPromise['reject'](_0x4bafcf);}return _0x1e2ea9[_0x24dd('0x23')]();};}function saveUpdates(_0x57f7b0,_0x13fda2){return function(_0x22f177){if(_0x22f177){return _0x22f177['update'](_0x57f7b0)['then'](function(_0x44c71e){return _0x44c71e;});}return null;};}function removeEntity(_0x41a654,_0x930681){return function(_0xa3262){if(_0xa3262){return _0xa3262[_0x24dd('0x24')]()['then'](function(){var _0x359cd9=_0xa3262[_0x24dd('0x25')]({'plain':!![]});var _0xab4def='IvrCampaigns';return db[_0x24dd('0x26')][_0x24dd('0x24')]({'where':{'type':_0xab4def,'resourceId':_0x359cd9['id']}})[_0x24dd('0x27')](function(){return _0xa3262;});})[_0x24dd('0x27')](function(){_0x41a654[_0x24dd('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50061f,_0x56d0e4){return function(_0x23c3f8){if(!_0x23c3f8){_0x50061f[_0x24dd('0x28')](0x194);}return _0x23c3f8;};}function handleError(_0x20c92,_0x4bf5f9){_0x4bf5f9=_0x4bf5f9||0x1f4;return function(_0x48b1c8){logger['error'](_0x48b1c8[_0x24dd('0x29')]);if(_0x48b1c8[_0x24dd('0x2a')]){delete _0x48b1c8[_0x24dd('0x2a')];}_0x20c92[_0x24dd('0x19')](_0x4bf5f9)[_0x24dd('0x2b')](_0x48b1c8);};}exports['index']=function(_0x3d0ec7,_0x561d10){var _0xbf954a={},_0x3058c7={},_0x23ea3d={'count':0x0,'rows':[]};var _0x49925b=_[_0x24dd('0x2c')](db[_0x24dd('0x2d')]['rawAttributes'],function(_0x3ee42c){return{'name':_0x3ee42c['fieldName'],'type':_0x3ee42c[_0x24dd('0x2e')][_0x24dd('0x2f')]};});_0x3058c7['model']=_['map'](_0x49925b,_0x24dd('0x2a'));_0x3058c7[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x3d0ec7[_0x24dd('0x30')]);_0x3058c7[_0x24dd('0x32')]=_[_0x24dd('0x33')](_0x3058c7[_0x24dd('0x34')],_0x3058c7[_0x24dd('0x30')]);_0xbf954a[_0x24dd('0x35')]=_[_0x24dd('0x33')](_0x3058c7[_0x24dd('0x34')],qs[_0x24dd('0x36')](_0x3d0ec7['query'][_0x24dd('0x36')]));_0xbf954a[_0x24dd('0x35')]=_0xbf954a['attributes'][_0x24dd('0x37')]?_0xbf954a['attributes']:_0x3058c7['model'];if(!_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x38')]('nolimit')){_0xbf954a[_0x24dd('0x1e')]=qs['limit'](_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x1e')]);_0xbf954a[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x1c')]);}_0xbf954a[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x3a')]);_0xbf954a[_0x24dd('0x3b')]=qs[_0x24dd('0x32')](_[_0x24dd('0x3c')](_0x3d0ec7[_0x24dd('0x30')],_0x3058c7[_0x24dd('0x32')]),_0x49925b);if(_0x3d0ec7['query'][_0x24dd('0x3d')]){_0xbf954a['where']=_[_0x24dd('0x3e')](_0xbf954a[_0x24dd('0x3b')],{'$or':_[_0x24dd('0x2c')](_0x49925b,function(_0x1ca07c){if(_0x1ca07c[_0x24dd('0x2e')]!==_0x24dd('0x3f')){var _0x467884={};_0x467884[_0x1ca07c['name']]={'$like':'%'+_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x3d')]+'%'};return _0x467884;}})});}_0xbf954a=_[_0x24dd('0x3e')]({},_0xbf954a,_0x3d0ec7[_0x24dd('0x40')]);var _0x1b7f52={'where':_0xbf954a[_0x24dd('0x3b')]};return db[_0x24dd('0x2d')][_0x24dd('0x1f')](_0x1b7f52)['then'](function(_0xac4680){_0x23ea3d[_0x24dd('0x1f')]=_0xac4680;if(_0x3d0ec7[_0x24dd('0x30')][_0x24dd('0x41')]){_0xbf954a[_0x24dd('0x42')]=[{'all':!![]}];}return db[_0x24dd('0x2d')][_0x24dd('0x43')](_0xbf954a);})[_0x24dd('0x27')](function(_0x3fe634){_0x23ea3d[_0x24dd('0x44')]=_0x3fe634;return _0x23ea3d;})[_0x24dd('0x27')](respondWithFilteredResult(_0x561d10,_0xbf954a))[_0x24dd('0x45')](handleError(_0x561d10,null));};exports[_0x24dd('0x46')]=function(_0x5c0acc,_0x146bb0){var _0x1559e1={'raw':![],'where':{'id':_0x5c0acc[_0x24dd('0x47')]['id']}},_0x43015c={};_0x43015c[_0x24dd('0x34')]=_[_0x24dd('0x31')](db[_0x24dd('0x2d')]['rawAttributes']);_0x43015c[_0x24dd('0x30')]=_['keys'](_0x5c0acc['query']);_0x43015c[_0x24dd('0x32')]=_[_0x24dd('0x33')](_0x43015c[_0x24dd('0x34')],_0x43015c['query']);_0x1559e1[_0x24dd('0x35')]=_[_0x24dd('0x33')](_0x43015c[_0x24dd('0x34')],qs['fields'](_0x5c0acc[_0x24dd('0x30')][_0x24dd('0x36')]));_0x1559e1[_0x24dd('0x35')]=_0x1559e1[_0x24dd('0x35')][_0x24dd('0x37')]?_0x1559e1[_0x24dd('0x35')]:_0x43015c[_0x24dd('0x34')];if(_0x5c0acc[_0x24dd('0x30')]['includeAll']){_0x1559e1[_0x24dd('0x42')]=[{'all':!![]}];}_0x1559e1=_[_0x24dd('0x3e')]({},_0x1559e1,_0x5c0acc[_0x24dd('0x40')]);return db[_0x24dd('0x2d')][_0x24dd('0x48')](_0x1559e1)[_0x24dd('0x27')](handleEntityNotFound(_0x146bb0,null))[_0x24dd('0x27')](respondWithResult(_0x146bb0,null))[_0x24dd('0x45')](handleError(_0x146bb0,null));};exports['create']=function(_0x79a332,_0x515b53){return db[_0x24dd('0x2d')][_0x24dd('0x49')](_0x79a332['body'],{})[_0x24dd('0x27')](function(_0x494884){var _0x2b1516=_0x79a332[_0x24dd('0x4a')][_0x24dd('0x25')]({'plain':!![]});if(!_0x2b1516)throw new Error(_0x24dd('0x4b'));if(_0x2b1516[_0x24dd('0x4c')]===_0x24dd('0x4a')){var _0x1edcc5=_0x494884[_0x24dd('0x25')]({'plain':!![]});var _0x426004='IvrCampaigns';return db[_0x24dd('0x4d')]['find']({'where':{'name':_0x426004,'userProfileId':_0x2b1516[_0x24dd('0x4e')]},'raw':!![]})['then'](function(_0x4f98dc){if(_0x4f98dc&&_0x4f98dc[_0x24dd('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x1edcc5['name'],'resourceId':_0x1edcc5['id'],'type':_0x4f98dc[_0x24dd('0x2a')],'sectionId':_0x4f98dc['id']},{})[_0x24dd('0x27')](function(){return _0x494884;});}else{return _0x494884;}})[_0x24dd('0x45')](function(_0x18a65b){logger[_0x24dd('0x50')](_0x24dd('0x51'),_0x18a65b);throw _0x18a65b;});}return _0x494884;})[_0x24dd('0x27')](respondWithResult(_0x515b53,0xc9))['catch'](handleError(_0x515b53,null));};exports[_0x24dd('0x52')]=function(_0x434ae0,_0x3b7782){var _0x20ed1e={'where':{'id':_0x434ae0[_0x24dd('0x47')]['id']}},_0x257c3f={};_0x257c3f[_0x24dd('0x34')]=_[_0x24dd('0x31')](db[_0x24dd('0x2d')][_0x24dd('0x53')]);_0x20ed1e[_0x24dd('0x35')]=_[_0x24dd('0x33')](_0x257c3f[_0x24dd('0x34')],qs['fields'](_0x434ae0[_0x24dd('0x30')][_0x24dd('0x36')]));_0x20ed1e['attributes']=_0x20ed1e[_0x24dd('0x35')][_0x24dd('0x37')]?_0x20ed1e[_0x24dd('0x35')]:_0x257c3f[_0x24dd('0x34')];if(_0x434ae0[_0x24dd('0x30')][_0x24dd('0x41')]){_0x20ed1e[_0x24dd('0x42')]=[{'all':!![]}];}_0x20ed1e=_[_0x24dd('0x3e')]({},_0x20ed1e,_0x434ae0[_0x24dd('0x40')]);return db[_0x24dd('0x2d')]['find'](_0x20ed1e)['then'](handleEntityNotFound(_0x3b7782,null))['then'](function(_0x584328){if(_0x584328){var _0x25014c=_0x584328[_0x24dd('0x25')]({'plain':!![]});_0x25014c=qs[_0x24dd('0x54')](_0x25014c,['id',_0x24dd('0x55'),'updatedAt']);_0x434ae0[_0x24dd('0x56')]=_['omit'](_0x434ae0[_0x24dd('0x56')],['id',_0x24dd('0x55'),_0x24dd('0x57')]);return db[_0x24dd('0x2d')][_0x24dd('0x49')](_[_0x24dd('0x3e')](_0x25014c,_0x434ae0['body']),{'include':_0x434ae0['query']['includeAll']?[{'all':!![]}]:undefined})[_0x24dd('0x27')](function(_0xbef9db){var _0x1fd500=_0x434ae0['user'][_0x24dd('0x25')]({'plain':!![]});if(!_0x1fd500)throw new Error(_0x24dd('0x4b'));if(_0x1fd500['role']==='user'){var _0x1bc067=_0xbef9db[_0x24dd('0x25')]({'plain':!![]});var _0x48f765='IvrCampaigns';return db[_0x24dd('0x4d')]['find']({'where':{'name':_0x48f765,'userProfileId':_0x1fd500['userProfileId']},'raw':!![]})[_0x24dd('0x27')](function(_0x4ea4fd){if(_0x4ea4fd&&_0x4ea4fd[_0x24dd('0x4f')]===0x0){return db[_0x24dd('0x26')][_0x24dd('0x49')]({'name':_0x1bc067[_0x24dd('0x2a')],'resourceId':_0x1bc067['id'],'type':_0x4ea4fd[_0x24dd('0x2a')],'sectionId':_0x4ea4fd['id']},{})[_0x24dd('0x27')](function(){return _0xbef9db;});}else{return _0xbef9db;}})['catch'](function(_0x3de567){logger[_0x24dd('0x50')](_0x24dd('0x51'),_0x3de567);throw _0x3de567;});}return _0xbef9db;});}})[_0x24dd('0x27')](respondWithResult(_0x3b7782,0xc9))[_0x24dd('0x45')](handleError(_0x3b7782,null));};exports[_0x24dd('0x58')]=function(_0x4e186a,_0x59be02){if(_0x4e186a[_0x24dd('0x56')]['id']){delete _0x4e186a['body']['id'];}return db[_0x24dd('0x2d')][_0x24dd('0x48')]({'where':{'id':_0x4e186a[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x59be02,null))[_0x24dd('0x27')](saveUpdates(_0x4e186a[_0x24dd('0x56')],null))[_0x24dd('0x27')](respondWithResult(_0x59be02,null))['catch'](handleError(_0x59be02,null));};exports[_0x24dd('0x24')]=function(_0x4f26d0,_0xe768c9){return db[_0x24dd('0x2d')][_0x24dd('0x48')]({'where':{'id':_0x4f26d0[_0x24dd('0x47')]['id']}})['then'](handleEntityNotFound(_0xe768c9,null))[_0x24dd('0x27')](removeEntity(_0xe768c9,null))[_0x24dd('0x45')](handleError(_0xe768c9,null));};exports[_0x24dd('0x59')]=function(_0x4098ac,_0x4c1e01,_0x275cbe){var _0x428ac3={'raw':!![],'where':{}};var _0x2562f7={};var _0x1fbecb={'count':0x0,'rows':[]};return db[_0x24dd('0x2d')][_0x24dd('0x5a')]({'where':{'id':_0x4098ac['params']['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x4c1e01,null))[_0x24dd('0x27')](function(_0xd60dbd){if(_0xd60dbd){_0x2562f7['model']=_[_0x24dd('0x31')](db[_0x24dd('0x5b')][_0x24dd('0x53')]);_0x2562f7[_0x24dd('0x30')]=_['keys'](_0x4098ac[_0x24dd('0x30')]);_0x2562f7['filters']=_['intersection'](_0x2562f7['model'],_0x2562f7[_0x24dd('0x30')]);_0x428ac3['attributes']=_['intersection'](_0x2562f7[_0x24dd('0x34')],qs[_0x24dd('0x36')](_0x4098ac[_0x24dd('0x30')]['fields']));_0x428ac3['attributes']=_0x428ac3[_0x24dd('0x35')][_0x24dd('0x37')]?_0x428ac3[_0x24dd('0x35')]:_0x2562f7[_0x24dd('0x34')];if(!_0x4098ac[_0x24dd('0x30')]['hasOwnProperty'](_0x24dd('0x5c'))){_0x428ac3[_0x24dd('0x1e')]=qs['limit'](_0x4098ac[_0x24dd('0x30')][_0x24dd('0x1e')]);_0x428ac3[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x4098ac[_0x24dd('0x30')]['offset']);}_0x428ac3[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0x4098ac[_0x24dd('0x30')][_0x24dd('0x3a')]);_0x428ac3[_0x24dd('0x3b')]=qs[_0x24dd('0x32')](_[_0x24dd('0x3c')](_0x4098ac['query'],_0x2562f7[_0x24dd('0x32')]));_0x428ac3[_0x24dd('0x3b')][_0x24dd('0x5d')]=_0xd60dbd['id'];if(_0x4098ac[_0x24dd('0x30')][_0x24dd('0x3d')]){_0x428ac3['where']=_[_0x24dd('0x3e')](_0x428ac3[_0x24dd('0x3b')],{'$or':_['map'](_0x428ac3[_0x24dd('0x35')],function(_0x52ebfa){var _0x1e5e34={};_0x1e5e34[_0x52ebfa]={'$like':'%'+_0x4098ac['query'][_0x24dd('0x3d')]+'%'};return _0x1e5e34;})});}_0x428ac3=_['merge']({},_0x428ac3,_0x4098ac['options']);return db[_0x24dd('0x5b')][_0x24dd('0x1f')]({'where':_0x428ac3[_0x24dd('0x3b')]})[_0x24dd('0x27')](function(_0x5be566){_0x1fbecb[_0x24dd('0x1f')]=_0x5be566;if(_0x4098ac[_0x24dd('0x30')][_0x24dd('0x41')]){_0x428ac3[_0x24dd('0x42')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x428ac3);})[_0x24dd('0x27')](function(_0x4e6cf0){_0x1fbecb['rows']=_0x4e6cf0;return _0x1fbecb;});}})['then'](respondWithFilteredResult(_0x4c1e01,_0x428ac3))[_0x24dd('0x45')](handleError(_0x4c1e01,null));};exports[_0x24dd('0x5e')]=function(_0x20feb8,_0x36d4a7,_0x38d467){var _0x1cf204={'raw':!![],'where':{}};var _0x15fffa={};var _0x5babe5={'count':0x0,'rows':[]};return db['Campaign'][_0x24dd('0x5a')]({'where':{'id':_0x20feb8[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x36d4a7,null))[_0x24dd('0x27')](function(_0x36caec){if(_0x36caec){_0x15fffa['model']=_[_0x24dd('0x31')](db[_0x24dd('0x5f')][_0x24dd('0x53')]);_0x15fffa[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x20feb8[_0x24dd('0x30')]);_0x15fffa[_0x24dd('0x32')]=_[_0x24dd('0x33')](_0x15fffa[_0x24dd('0x34')],_0x15fffa['query']);_0x1cf204['attributes']=_[_0x24dd('0x33')](_0x15fffa[_0x24dd('0x34')],qs[_0x24dd('0x36')](_0x20feb8[_0x24dd('0x30')][_0x24dd('0x36')]));_0x1cf204['attributes']=_0x1cf204[_0x24dd('0x35')][_0x24dd('0x37')]?_0x1cf204[_0x24dd('0x35')]:_0x15fffa[_0x24dd('0x34')];if(!_0x20feb8['query'][_0x24dd('0x38')]('nolimit')){_0x1cf204[_0x24dd('0x1e')]=qs[_0x24dd('0x1e')](_0x20feb8[_0x24dd('0x30')][_0x24dd('0x1e')]);_0x1cf204[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x20feb8['query'][_0x24dd('0x1c')]);}_0x1cf204[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0x20feb8[_0x24dd('0x30')]['sort']);_0x1cf204[_0x24dd('0x3b')]=qs[_0x24dd('0x32')](_[_0x24dd('0x3c')](_0x20feb8[_0x24dd('0x30')],_0x15fffa[_0x24dd('0x32')]));_0x1cf204[_0x24dd('0x3b')][_0x24dd('0x5d')]=_0x36caec['id'];if(_0x20feb8[_0x24dd('0x30')][_0x24dd('0x3d')]){_0x1cf204['where']=_['merge'](_0x1cf204[_0x24dd('0x3b')],{'$or':_['map'](_0x1cf204[_0x24dd('0x35')],function(_0x17583e){var _0x5ff6ac={};_0x5ff6ac[_0x17583e]={'$like':'%'+_0x20feb8[_0x24dd('0x30')][_0x24dd('0x3d')]+'%'};return _0x5ff6ac;})});}_0x1cf204=_['merge']({},_0x1cf204,_0x20feb8[_0x24dd('0x40')]);return db[_0x24dd('0x5f')]['count']({'where':_0x1cf204[_0x24dd('0x3b')]})[_0x24dd('0x27')](function(_0x41c6b8){_0x5babe5[_0x24dd('0x1f')]=_0x41c6b8;if(_0x20feb8[_0x24dd('0x30')][_0x24dd('0x41')]){_0x1cf204[_0x24dd('0x42')]=[{'all':!![]}];}return db[_0x24dd('0x5f')][_0x24dd('0x43')](_0x1cf204);})[_0x24dd('0x27')](function(_0x46afc2){_0x5babe5[_0x24dd('0x44')]=_0x46afc2;return _0x5babe5;});}})[_0x24dd('0x27')](respondWithFilteredResult(_0x36d4a7,_0x1cf204))[_0x24dd('0x45')](handleError(_0x36d4a7,null));};exports['getHopperFinals']=function(_0x2cda5b,_0x272b6d,_0x3bee82){var _0x1f4fdc={'raw':!![],'where':{}};var _0x39324a={};var _0x218869={'count':0x0,'rows':[]};return db['Campaign'][_0x24dd('0x5a')]({'where':{'id':_0x2cda5b[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x272b6d,null))[_0x24dd('0x27')](function(_0x176536){if(_0x176536){_0x39324a[_0x24dd('0x34')]=_[_0x24dd('0x31')](db[_0x24dd('0x60')]['rawAttributes']);_0x39324a[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x2cda5b[_0x24dd('0x30')]);_0x39324a[_0x24dd('0x32')]=_['intersection'](_0x39324a['model'],_0x39324a[_0x24dd('0x30')]);_0x1f4fdc[_0x24dd('0x35')]=_[_0x24dd('0x33')](_0x39324a['model'],qs['fields'](_0x2cda5b[_0x24dd('0x30')][_0x24dd('0x36')]));_0x1f4fdc['attributes']=_0x1f4fdc['attributes']['length']?_0x1f4fdc['attributes']:_0x39324a['model'];if(!_0x2cda5b[_0x24dd('0x30')][_0x24dd('0x38')](_0x24dd('0x5c'))){_0x1f4fdc['limit']=qs['limit'](_0x2cda5b['query'][_0x24dd('0x1e')]);_0x1f4fdc[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x2cda5b[_0x24dd('0x30')][_0x24dd('0x1c')]);}_0x1f4fdc[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0x2cda5b['query'][_0x24dd('0x3a')]);_0x1f4fdc[_0x24dd('0x3b')]=qs['filters'](_[_0x24dd('0x3c')](_0x2cda5b[_0x24dd('0x30')],_0x39324a[_0x24dd('0x32')]));_0x1f4fdc[_0x24dd('0x3b')]['CampaignId']=_0x176536['id'];if(_0x2cda5b[_0x24dd('0x30')]['filter']){_0x1f4fdc[_0x24dd('0x3b')]=_[_0x24dd('0x3e')](_0x1f4fdc[_0x24dd('0x3b')],{'$or':_[_0x24dd('0x2c')](_0x1f4fdc[_0x24dd('0x35')],function(_0x24b7c9){var _0x3f8d60={};_0x3f8d60[_0x24b7c9]={'$like':'%'+_0x2cda5b[_0x24dd('0x30')][_0x24dd('0x3d')]+'%'};return _0x3f8d60;})});}_0x1f4fdc=_['merge']({},_0x1f4fdc,_0x2cda5b[_0x24dd('0x40')]);return db['CmHopperFinal']['count']({'where':_0x1f4fdc[_0x24dd('0x3b')]})[_0x24dd('0x27')](function(_0x5e2537){_0x218869[_0x24dd('0x1f')]=_0x5e2537;if(_0x2cda5b[_0x24dd('0x30')][_0x24dd('0x41')]){_0x1f4fdc[_0x24dd('0x42')]=[{'all':!![]}];}return db[_0x24dd('0x60')][_0x24dd('0x43')](_0x1f4fdc);})[_0x24dd('0x27')](function(_0x472580){_0x218869[_0x24dd('0x44')]=_0x472580;return _0x218869;});}})[_0x24dd('0x27')](respondWithFilteredResult(_0x272b6d,_0x1f4fdc))['catch'](handleError(_0x272b6d,null));};exports[_0x24dd('0x61')]=function(_0x260fa8,_0x5cc4c2,_0x2d1841){var _0x5339b0={'raw':!![],'where':{}};var _0x3b230d={};var _0x24babd={'count':0x0,'rows':[]};return db[_0x24dd('0x2d')][_0x24dd('0x5a')]({'where':{'id':_0x260fa8['params']['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x5cc4c2,null))[_0x24dd('0x27')](function(_0xe1446b){if(_0xe1446b){_0x3b230d['model']=_['keys'](db['CmHopperBlack']['rawAttributes']);_0x3b230d[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x260fa8[_0x24dd('0x30')]);_0x3b230d['filters']=_[_0x24dd('0x33')](_0x3b230d['model'],_0x3b230d[_0x24dd('0x30')]);_0x5339b0['attributes']=_[_0x24dd('0x33')](_0x3b230d[_0x24dd('0x34')],qs['fields'](_0x260fa8[_0x24dd('0x30')]['fields']));_0x5339b0[_0x24dd('0x35')]=_0x5339b0[_0x24dd('0x35')][_0x24dd('0x37')]?_0x5339b0[_0x24dd('0x35')]:_0x3b230d['model'];if(!_0x260fa8[_0x24dd('0x30')][_0x24dd('0x38')](_0x24dd('0x5c'))){_0x5339b0[_0x24dd('0x1e')]=qs[_0x24dd('0x1e')](_0x260fa8[_0x24dd('0x30')][_0x24dd('0x1e')]);_0x5339b0[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x260fa8[_0x24dd('0x30')][_0x24dd('0x1c')]);}_0x5339b0[_0x24dd('0x39')]=qs['sort'](_0x260fa8[_0x24dd('0x30')]['sort']);_0x5339b0[_0x24dd('0x3b')]=qs[_0x24dd('0x32')](_[_0x24dd('0x3c')](_0x260fa8['query'],_0x3b230d[_0x24dd('0x32')]));_0x5339b0[_0x24dd('0x3b')][_0x24dd('0x5d')]=_0xe1446b['id'];if(_0x260fa8[_0x24dd('0x30')][_0x24dd('0x3d')]){_0x5339b0['where']=_[_0x24dd('0x3e')](_0x5339b0[_0x24dd('0x3b')],{'$or':_['map'](_0x5339b0['attributes'],function(_0x1fe782){var _0x57e886={};_0x57e886[_0x1fe782]={'$like':'%'+_0x260fa8[_0x24dd('0x30')][_0x24dd('0x3d')]+'%'};return _0x57e886;})});}_0x5339b0=_[_0x24dd('0x3e')]({},_0x5339b0,_0x260fa8[_0x24dd('0x40')]);return db[_0x24dd('0x62')][_0x24dd('0x1f')]({'where':_0x5339b0[_0x24dd('0x3b')]})[_0x24dd('0x27')](function(_0xb256ad){_0x24babd[_0x24dd('0x1f')]=_0xb256ad;if(_0x260fa8[_0x24dd('0x30')]['includeAll']){_0x5339b0[_0x24dd('0x42')]=[{'all':!![]}];}return db[_0x24dd('0x62')][_0x24dd('0x43')](_0x5339b0);})['then'](function(_0x2a48fc){_0x24babd[_0x24dd('0x44')]=_0x2a48fc;return _0x24babd;});}})[_0x24dd('0x27')](respondWithFilteredResult(_0x5cc4c2,_0x5339b0))[_0x24dd('0x45')](handleError(_0x5cc4c2,null));};exports[_0x24dd('0x63')]=function(_0xc1cc10,_0x7d94e8,_0x155f51){var _0x49407d={};var _0x29c162={};var _0x496cb2;var _0x32f382;return db[_0x24dd('0x2d')][_0x24dd('0x5a')]({'where':{'id':_0xc1cc10[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x7d94e8,null))[_0x24dd('0x27')](function(_0x358959){if(_0x358959){_0x496cb2=_0x358959;_0x29c162[_0x24dd('0x34')]=_[_0x24dd('0x31')](db[_0x24dd('0x64')][_0x24dd('0x53')]);_0x29c162[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0xc1cc10[_0x24dd('0x30')]);_0x29c162['filters']=_[_0x24dd('0x33')](_0x29c162[_0x24dd('0x34')],_0x29c162[_0x24dd('0x30')]);_0x49407d['attributes']=_['intersection'](_0x29c162[_0x24dd('0x34')],qs[_0x24dd('0x36')](_0xc1cc10[_0x24dd('0x30')]['fields']));_0x49407d[_0x24dd('0x35')]=_0x49407d[_0x24dd('0x35')][_0x24dd('0x37')]?_0x49407d[_0x24dd('0x35')]:_0x29c162[_0x24dd('0x34')];_0x49407d[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0xc1cc10[_0x24dd('0x30')][_0x24dd('0x3a')]);_0x49407d[_0x24dd('0x3b')]=qs['filters'](_[_0x24dd('0x3c')](_0xc1cc10['query'],_0x29c162[_0x24dd('0x32')]));if(_0xc1cc10['query'][_0x24dd('0x3d')]){_0x49407d[_0x24dd('0x3b')]=_[_0x24dd('0x3e')](_0x49407d[_0x24dd('0x3b')],{'$or':_['map'](_0x49407d[_0x24dd('0x35')],function(_0x17c4fe){var _0x1ac3e8={};_0x1ac3e8[_0x17c4fe]={'$like':'%'+_0xc1cc10['query'][_0x24dd('0x3d')]+'%'};return _0x1ac3e8;})});}_0x49407d=_[_0x24dd('0x3e')]({},_0x49407d,_0xc1cc10[_0x24dd('0x40')]);return _0x496cb2['getLists'](_0x49407d);}})[_0x24dd('0x27')](function(_0x5b08fa){if(_0x5b08fa){_0x32f382=_0x5b08fa['length'];if(!_0xc1cc10[_0x24dd('0x30')][_0x24dd('0x38')](_0x24dd('0x5c'))){_0x49407d[_0x24dd('0x1e')]=qs[_0x24dd('0x1e')](_0xc1cc10['query']['limit']);_0x49407d[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0xc1cc10[_0x24dd('0x30')][_0x24dd('0x1c')]);}return _0x496cb2[_0x24dd('0x63')](_0x49407d);}})[_0x24dd('0x27')](function(_0x29ad43){if(_0x29ad43){return _0x29ad43?{'count':_0x32f382,'rows':_0x29ad43}:null;}})[_0x24dd('0x27')](respondWithResult(_0x7d94e8,null))['catch'](handleError(_0x7d94e8,null));};exports[_0x24dd('0x65')]=function(_0x53f9b7,_0x41b324,_0x46c599){var _0x2f09b8,_0x4c5ed7;var _0x354bcd=[];var _0x36564d=moment()[_0x24dd('0x66')](_0x24dd('0x67'));return db['Campaign'][_0x24dd('0x48')]({'where':{'id':_0x53f9b7[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x41b324,null))['then'](function(_0x176c9b){if(_0x176c9b){_0x4c5ed7=_0x176c9b;return _0x176c9b['addLists'](_0x53f9b7['body'][_0x24dd('0x68')],_[_0x24dd('0x54')](_0x53f9b7[_0x24dd('0x56')],[_0x24dd('0x68'),'id'])||{});}return null;})[_0x24dd('0x69')](function(_0x4ece7d){var _0x5401bd;var _0xa9aad3;_0x2f09b8=_0x4ece7d||[];var _0x1b8b4d=[];if(_0x4ece7d){for(var _0x12ef69=0x0;_0x12ef69<_0x4ece7d['length'];_0x12ef69+=0x1){var _0xa6e277=_0x4ece7d[_0x12ef69][_0x24dd('0x25')]({'plain':!![]});_0x4c5ed7[_0x24dd('0x6a')]=_0x53f9b7[_0x24dd('0x56')][_0x24dd('0x6a')]?_0x53f9b7[_0x24dd('0x56')][_0x24dd('0x6a')]:_0x4c5ed7['dialCheckDuplicateType'];switch(_0x4c5ed7[_0x24dd('0x6a')]){case _0x24dd('0x6b'):_0x5401bd=squel[_0x24dd('0x6c')]()[_0x24dd('0x6d')](_0x24dd('0x6e'))['fromQuery']([_0x24dd('0x6f'),_0x24dd('0x70'),'ContactId',_0x24dd('0x71'),_0x24dd('0x5d'),'createdAt',_0x24dd('0x57')],squel['select']()[_0x24dd('0x72')](_0x24dd('0x6f'),_0x24dd('0x6f'))[_0x24dd('0x72')](_0x24dd('0x73'),_0x24dd('0x70'))[_0x24dd('0x72')]('id',_0x24dd('0x74'))[_0x24dd('0x72')](_0xa6e277[_0x24dd('0x75')][_0x24dd('0x76')](),_0x24dd('0x71'))[_0x24dd('0x72')](_0x53f9b7[_0x24dd('0x47')]['id'][_0x24dd('0x76')](),_0x24dd('0x5d'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x55'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x57'))[_0x24dd('0x77')](_0x24dd('0x78'))[_0x24dd('0x3b')](_0x24dd('0x79'))[_0x24dd('0x3b')]('ListId\x20=\x20?',_0xa6e277[_0x24dd('0x75')][_0x24dd('0x76')]())[_0x24dd('0x3b')](_0x24dd('0x7a'))[_0x24dd('0x3b')](_0x24dd('0x7b'),squel['select']()[_0x24dd('0x72')](_0x24dd('0x7c'))[_0x24dd('0x77')](_0x24dd('0x7d'))[_0x24dd('0x3b')](_0x24dd('0x7e'),_0x53f9b7['params']['id']['toString']()))[_0x24dd('0x3b')](_0x24dd('0x7b'),squel[_0x24dd('0x7f')]()[_0x24dd('0x72')](_0x24dd('0x80'))['from'](_0x24dd('0x6e'))['where']('CampaignId\x20=\x20?',_0x53f9b7[_0x24dd('0x47')]['id'][_0x24dd('0x76')]())))['toString']();break;case _0x24dd('0x81'):_0x5401bd=squel[_0x24dd('0x6c')]()[_0x24dd('0x6d')](_0x24dd('0x6e'))[_0x24dd('0x82')](['phone',_0x24dd('0x70'),'ContactId','ListId','CampaignId',_0x24dd('0x55'),_0x24dd('0x57')],squel[_0x24dd('0x7f')]()['field'](_0x24dd('0x6f'),_0x24dd('0x6f'))[_0x24dd('0x72')]('NOW()',_0x24dd('0x70'))['field']('id',_0x24dd('0x74'))['field'](_0xa6e277['CmListId'][_0x24dd('0x76')](),_0x24dd('0x71'))[_0x24dd('0x72')](_0x53f9b7['params']['id'][_0x24dd('0x76')](),_0x24dd('0x5d'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x55'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27','updatedAt')['from']('cm_contacts')[_0x24dd('0x3b')](_0x24dd('0x79'))[_0x24dd('0x3b')](_0x24dd('0x83'),_0xa6e277['CmListId'][_0x24dd('0x76')]())[_0x24dd('0x3b')](_0x24dd('0x7a'))[_0x24dd('0x3b')](_0x24dd('0x7b'),squel[_0x24dd('0x7f')]()[_0x24dd('0x72')]('COALESCE(phone,\x27\x27)')[_0x24dd('0x77')]('cm_hopper')[_0x24dd('0x3b')]('CampaignId\x20=\x20?',_0x53f9b7[_0x24dd('0x47')]['id'][_0x24dd('0x76')]())))[_0x24dd('0x76')]();break;default:_0x5401bd=squel['insert']()[_0x24dd('0x6d')](_0x24dd('0x6e'))[_0x24dd('0x82')](['phone',_0x24dd('0x70'),'ContactId','ListId',_0x24dd('0x5d'),_0x24dd('0x55'),_0x24dd('0x57')],squel[_0x24dd('0x7f')]()[_0x24dd('0x72')](_0x24dd('0x6f'),_0x24dd('0x6f'))[_0x24dd('0x72')](_0x24dd('0x73'),_0x24dd('0x70'))[_0x24dd('0x72')]('id',_0x24dd('0x74'))[_0x24dd('0x72')](_0xa6e277[_0x24dd('0x75')]['toString'](),_0x24dd('0x71'))[_0x24dd('0x72')](_0x53f9b7['params']['id'][_0x24dd('0x76')](),_0x24dd('0x5d'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x55'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27','updatedAt')[_0x24dd('0x77')]('cm_contacts')[_0x24dd('0x3b')]('deletedAt\x20IS\x20NULL')[_0x24dd('0x3b')]('ListId\x20=\x20?',_0xa6e277[_0x24dd('0x75')][_0x24dd('0x76')]())[_0x24dd('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x24dd('0x76')]();}_0xa9aad3=squel[_0x24dd('0x6c')]()['into'](_0x24dd('0x84'))[_0x24dd('0x82')](['cmHopperId',_0x24dd('0x70'),_0x24dd('0x6f'),_0x24dd('0x85'),_0x24dd('0x55'),_0x24dd('0x57')],squel['select']()[_0x24dd('0x72')](_0x24dd('0x86'),'id')['field']('NOW()',_0x24dd('0x70'))[_0x24dd('0x72')](_0x24dd('0x87'),'phone')[_0x24dd('0x72')](_0x24dd('0x88'),_0x24dd('0x85'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x55'))[_0x24dd('0x72')]('\x27'+_0x36564d+'\x27',_0x24dd('0x57'))[_0x24dd('0x77')](_0x24dd('0x89'),'ci')[_0x24dd('0x8a')](_0x24dd('0x6e'),'h',_0x24dd('0x8b'))[_0x24dd('0x3b')]('h.ListId\x20=\x20?',_0xa6e277[_0x24dd('0x75')][_0x24dd('0x76')]())['where']('h.CampaignId=?',_0x53f9b7[_0x24dd('0x47')]['id'][_0x24dd('0x76')]())[_0x24dd('0x3b')](_0x24dd('0x8c'),_0x36564d))['toString']();_0x1b8b4d[_0x24dd('0x8d')](db[_0x24dd('0x8e')][_0x24dd('0x30')](_0x5401bd));_0x354bcd[_0x24dd('0x8d')](db['sequelize'][_0x24dd('0x30')](_0xa9aad3));}return BPromise[_0x24dd('0x8f')](_0x1b8b4d);}})[_0x24dd('0x27')](function(){return BPromise['all'](_0x354bcd);})[_0x24dd('0x27')](function(){return _0x2f09b8;})[_0x24dd('0x27')](respondWithResult(_0x41b324,null))[_0x24dd('0x45')](handleError(_0x41b324,null));};exports['removeLists']=function(_0x53014c,_0x2af97a,_0x2fa934){return db[_0x24dd('0x2d')][_0x24dd('0x48')]({'where':{'id':_0x53014c[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x2af97a,null))['then'](function(_0x4cdc79){if(_0x4cdc79){return _0x4cdc79[_0x24dd('0x90')](_0x53014c[_0x24dd('0x30')][_0x24dd('0x68')]);}})[_0x24dd('0x27')](function(_0x14b9cf){if(_0x14b9cf){return db[_0x24dd('0x5b')][_0x24dd('0x24')]({'where':{'ListId':_0x53014c[_0x24dd('0x30')][_0x24dd('0x68')],'CampaignId':_0x53014c[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](function(){return _0x14b9cf;});}})[_0x24dd('0x27')](respondWithStatusCode(_0x2af97a,null))[_0x24dd('0x45')](handleError(_0x2af97a,null));};exports[_0x24dd('0x91')]=function(_0x5f4eb5,_0xcd5e80,_0x3f830e){var _0x370684={};var _0x2964c7={};var _0x3a5c6c;var _0x558f2d;return db['Campaign']['findOne']({'where':{'id':_0x5f4eb5[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0xcd5e80,null))[_0x24dd('0x27')](function(_0x22a2f1){if(_0x22a2f1){_0x3a5c6c=_0x22a2f1;_0x2964c7[_0x24dd('0x34')]=_[_0x24dd('0x31')](db[_0x24dd('0x64')][_0x24dd('0x53')]);_0x2964c7[_0x24dd('0x30')]=_[_0x24dd('0x31')](_0x5f4eb5[_0x24dd('0x30')]);_0x2964c7[_0x24dd('0x32')]=_['intersection'](_0x2964c7['model'],_0x2964c7[_0x24dd('0x30')]);_0x370684[_0x24dd('0x35')]=_['intersection'](_0x2964c7[_0x24dd('0x34')],qs['fields'](_0x5f4eb5[_0x24dd('0x30')][_0x24dd('0x36')]));_0x370684[_0x24dd('0x35')]=_0x370684['attributes'][_0x24dd('0x37')]?_0x370684['attributes']:_0x2964c7[_0x24dd('0x34')];_0x370684[_0x24dd('0x39')]=qs[_0x24dd('0x3a')](_0x5f4eb5['query'][_0x24dd('0x3a')]);_0x370684['where']=qs['filters'](_[_0x24dd('0x3c')](_0x5f4eb5[_0x24dd('0x30')],_0x2964c7['filters']));if(_0x5f4eb5['query'][_0x24dd('0x3d')]){_0x370684['where']=_[_0x24dd('0x3e')](_0x370684[_0x24dd('0x3b')],{'$or':_[_0x24dd('0x2c')](_0x370684[_0x24dd('0x35')],function(_0x2e9a41){var _0x5bb74e={};_0x5bb74e[_0x2e9a41]={'$like':'%'+_0x5f4eb5[_0x24dd('0x30')][_0x24dd('0x3d')]+'%'};return _0x5bb74e;})});}_0x370684=_['merge']({},_0x370684,_0x5f4eb5[_0x24dd('0x40')]);return _0x3a5c6c[_0x24dd('0x91')](_0x370684);}})[_0x24dd('0x27')](function(_0x33bfd5){if(_0x33bfd5){_0x558f2d=_0x33bfd5[_0x24dd('0x37')];if(!_0x5f4eb5[_0x24dd('0x30')]['hasOwnProperty'](_0x24dd('0x5c'))){_0x370684[_0x24dd('0x1e')]=qs[_0x24dd('0x1e')](_0x5f4eb5['query'][_0x24dd('0x1e')]);_0x370684[_0x24dd('0x1c')]=qs[_0x24dd('0x1c')](_0x5f4eb5['query'][_0x24dd('0x1c')]);}return _0x3a5c6c[_0x24dd('0x91')](_0x370684);}})[_0x24dd('0x27')](function(_0x2f992c){if(_0x2f992c){return _0x2f992c?{'count':_0x558f2d,'rows':_0x2f992c}:null;}})[_0x24dd('0x27')](respondWithResult(_0xcd5e80,null))[_0x24dd('0x45')](handleError(_0xcd5e80,null));};exports[_0x24dd('0x92')]=function(_0x4906cd,_0x908fe7,_0x15ae9f){var _0x2daede,_0x5578d6;var _0x1b6b86=[];var _0x2bca96=moment()[_0x24dd('0x66')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x24dd('0x2d')][_0x24dd('0x48')]({'where':{'id':_0x4906cd['params']['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x908fe7,null))['then'](function(_0x418afc){if(_0x418afc){_0x5578d6=_0x418afc;return _0x418afc['addBlackLists'](_0x4906cd[_0x24dd('0x56')][_0x24dd('0x68')],_[_0x24dd('0x54')](_0x4906cd[_0x24dd('0x56')],['ids','id'])||{});}return null;})[_0x24dd('0x69')](function(_0x210323){var _0x28ea10;var _0x3dba71;_0x2daede=_0x210323||[];var _0x326ed3=[];if(_0x210323){for(var _0x2e24c0=0x0;_0x2e24c0<_0x210323[_0x24dd('0x37')];_0x2e24c0+=0x1){var _0x45421b=_0x210323[_0x2e24c0][_0x24dd('0x25')]({'plain':!![]});_0x28ea10=squel['insert']()[_0x24dd('0x6d')](_0x24dd('0x93'))[_0x24dd('0x82')]([_0x24dd('0x6f'),'ContactId','ListId',_0x24dd('0x5d'),_0x24dd('0x55'),_0x24dd('0x57')],squel[_0x24dd('0x7f')]()[_0x24dd('0x72')](_0x24dd('0x6f'),_0x24dd('0x6f'))[_0x24dd('0x72')]('id',_0x24dd('0x74'))[_0x24dd('0x72')](_0x45421b[_0x24dd('0x75')][_0x24dd('0x76')](),'ListId')['field'](_0x4906cd[_0x24dd('0x47')]['id'][_0x24dd('0x76')](),_0x24dd('0x5d'))[_0x24dd('0x72')](_0x24dd('0x73'),_0x24dd('0x55'))['field'](_0x24dd('0x73'),_0x24dd('0x57'))[_0x24dd('0x77')](_0x24dd('0x78'))['where'](_0x24dd('0x79'))[_0x24dd('0x3b')](_0x24dd('0x83'),_0x45421b['CmListId']['toString']())[_0x24dd('0x3b')]('phone\x20IS\x20NOT\x20NULL'))[_0x24dd('0x76')]();_0x326ed3[_0x24dd('0x8d')](db[_0x24dd('0x8e')]['query'](_0x28ea10));}return BPromise['all'](_0x326ed3);}})[_0x24dd('0x27')](function(){return _0x2daede;})['then'](respondWithResult(_0x908fe7,null))['catch'](handleError(_0x908fe7,null));};exports[_0x24dd('0x94')]=function(_0x1d29fc,_0x7e1604,_0x173e69){return db[_0x24dd('0x2d')][_0x24dd('0x48')]({'where':{'id':_0x1d29fc['params']['id']}})[_0x24dd('0x27')](handleEntityNotFound(_0x7e1604,null))['then'](function(_0x46b542){if(_0x46b542){return _0x46b542[_0x24dd('0x94')](_0x1d29fc[_0x24dd('0x30')]['ids']);}})['then'](function(_0x480e80){if(_0x480e80){return db[_0x24dd('0x62')][_0x24dd('0x24')]({'where':{'ListId':_0x1d29fc[_0x24dd('0x30')]['ids'],'CampaignId':_0x1d29fc[_0x24dd('0x47')]['id']}})[_0x24dd('0x27')](function(){return _0x480e80;});}})[_0x24dd('0x27')](respondWithStatusCode(_0x7e1604,null))[_0x24dd('0x45')](handleError(_0x7e1604,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 6621078..34c5c0b 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(_0x177f58,_0x7eb824){var _0x30c13d=function(_0x24d737){while(--_0x24d737){_0x177f58['push'](_0x177f58['shift']());}};_0x30c13d(++_0x7eb824);}(_0x7a54,0x106));var _0x47a5=function(_0x2fd0f8,_0x5c1565){_0x2fd0f8=_0x2fd0f8-0x0;var _0x3f8b69=_0x7a54[_0x2fd0f8];return _0x3f8b69;};'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(_0x3b1cf8,_0x5b79f9){var _0x5d0434=function(_0x1b6559){while(--_0x1b6559){_0x3b1cf8['push'](_0x3b1cf8['shift']());}};_0x5d0434(++_0x5b79f9);}(_0x7a54,0x106));var _0x47a5=function(_0x50e146,_0x2d6330){_0x50e146=_0x50e146-0x0;var _0x3e9c17=_0x7a54[_0x50e146];return _0x3e9c17;};'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 9a38232..4591c25 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 _0xe0b2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Campaign','options','raw','where','attributes','limit','include','map','model','GetCampaign','util','moment'];(function(_0x51a6af,_0x219d20){var _0x190e2c=function(_0x1f391b){while(--_0x1f391b){_0x51a6af['push'](_0x51a6af['shift']());}};_0x190e2c(++_0x219d20);}(_0xe0b2,0xec));var _0x2e0b=function(_0x9b7953,_0x27678e){_0x9b7953=_0x9b7953-0x0;var _0x32df61=_0xe0b2[_0x9b7953];return _0x32df61;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('Campaign,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});}exports['GetCampaign']=function(_0x1d6bf2){var _0x477af9=this;return new Promise(function(_0x1c86a6,_0xfa98b1){return db[_0x2e0b('0x18')]['findAll']({'raw':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1b')]||null:null,'attributes':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2[_0x2e0b('0x19')][_0x2e0b('0x1c')]||null:null,'limit':_0x1d6bf2[_0x2e0b('0x19')]?_0x1d6bf2['options'][_0x2e0b('0x1d')]||null:null,'include':_0x1d6bf2['options']?_0x1d6bf2['options'][_0x2e0b('0x1e')]?_[_0x2e0b('0x1f')](_0x1d6bf2[_0x2e0b('0x19')]['include'],function(_0x40e3e5){return{'model':db[_0x40e3e5[_0x2e0b('0x20')]],'as':_0x40e3e5['as'],'attributes':_0x40e3e5[_0x2e0b('0x1c')],'include':_0x40e3e5[_0x2e0b('0x1e')]?_[_0x2e0b('0x1f')](_0x40e3e5[_0x2e0b('0x1e')],function(_0x3109f4){return{'model':db[_0x3109f4[_0x2e0b('0x20')]],'as':_0x3109f4['as'],'attributes':_0x3109f4['attributes'],'include':_0x3109f4['include']?_['map'](_0x3109f4[_0x2e0b('0x1e')],function(_0x100770){return{'model':db[_0x100770[_0x2e0b('0x20')]],'as':_0x100770['as'],'attributes':_0x100770[_0x2e0b('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2e0b('0xd')](function(_0x1260ab){logger[_0x2e0b('0xe')]('GetCampaign',_0x1d6bf2);logger[_0x2e0b('0x11')](_0x2e0b('0x21'),_0x1d6bf2,JSON[_0x2e0b('0x13')](_0x1260ab));_0x1c86a6(_0x1260ab);})[_0x2e0b('0x17')](function(_0x5e19c6){logger[_0x2e0b('0x14')]('GetCampaign',_0x5e19c6['message'],_0x1d6bf2);_0xfa98b1(_0x477af9[_0x2e0b('0x14')](0x1f4,_0x5e19c6[_0x2e0b('0x15')]));});});}; \ No newline at end of file +var _0xaf5a=['include','map','model','GetCampaign','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','Campaign,\x20%s,\x20%s','message','result','catch','Campaign','options','raw','where','attributes','limit'];(function(_0x4aa9aa,_0xc47ab4){var _0x1ef7b7=function(_0x3ddfca){while(--_0x3ddfca){_0x4aa9aa['push'](_0x4aa9aa['shift']());}};_0x1ef7b7(++_0xc47ab4);}(_0xaf5a,0x144));var _0xaaf5=function(_0x493503,_0x351993){_0x493503=_0x493503-0x0;var _0x1986d0=_0xaf5a[_0x493503];return _0x1986d0;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var moment=require('moment');var BPromise=require(_0xaaf5('0x1'));var rs=require(_0xaaf5('0x2'));var fs=require('fs');var Redis=require(_0xaaf5('0x3'));var db=require(_0xaaf5('0x4'))['db'];var utils=require(_0xaaf5('0x5'));var logger=require(_0xaaf5('0x6'))(_0xaaf5('0x7'));var config=require(_0xaaf5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xaaf5('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39dfd9,_0x34e141,_0x1160d2){return new BPromise(function(_0x2eee5e,_0x3582a5){return client['request'](_0x39dfd9,_0x1160d2)[_0xaaf5('0xa')](function(_0x32c5e6){logger[_0xaaf5('0xb')]('Campaign,\x20%s,\x20%s',_0x34e141,_0xaaf5('0xc'));logger[_0xaaf5('0xd')](_0xaaf5('0xe'),_0x34e141,_0xaaf5('0xc'),JSON[_0xaaf5('0xf')](_0x32c5e6));if(_0x32c5e6[_0xaaf5('0x10')]){if(_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x11')]===0x1f4){logger[_0xaaf5('0x10')](_0xaaf5('0x12'),_0x34e141,_0x32c5e6['error'][_0xaaf5('0x13')]);return _0x3582a5(_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x13')]);}logger[_0xaaf5('0x10')](_0xaaf5('0x12'),_0x34e141,_0x32c5e6[_0xaaf5('0x10')][_0xaaf5('0x13')]);return _0x2eee5e(_0x32c5e6[_0xaaf5('0x10')]['message']);}else{logger['info']('Campaign,\x20%s,\x20%s',_0x34e141,_0xaaf5('0xc'));_0x2eee5e(_0x32c5e6[_0xaaf5('0x14')]['message']);}})[_0xaaf5('0x15')](function(_0x431f5e){logger[_0xaaf5('0x10')]('Campaign,\x20%s,\x20%s',_0x34e141,_0x431f5e);_0x3582a5(_0x431f5e);});});}exports['GetCampaign']=function(_0x236371){var _0x29d42a=this;return new Promise(function(_0x2f7bdc,_0x37b34a){return db[_0xaaf5('0x16')]['findAll']({'raw':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x18')]===undefined?!![]:![]:!![],'where':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x19')]||null:null,'attributes':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1a')]||null:null,'limit':_0x236371['options']?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1b')]||null:null,'include':_0x236371[_0xaaf5('0x17')]?_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x236371[_0xaaf5('0x17')][_0xaaf5('0x1c')],function(_0x577761){return{'model':db[_0x577761[_0xaaf5('0x1e')]],'as':_0x577761['as'],'attributes':_0x577761[_0xaaf5('0x1a')],'include':_0x577761[_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x577761[_0xaaf5('0x1c')],function(_0x46dacd){return{'model':db[_0x46dacd[_0xaaf5('0x1e')]],'as':_0x46dacd['as'],'attributes':_0x46dacd[_0xaaf5('0x1a')],'include':_0x46dacd[_0xaaf5('0x1c')]?_[_0xaaf5('0x1d')](_0x46dacd['include'],function(_0x8b417e){return{'model':db[_0x8b417e[_0xaaf5('0x1e')]],'as':_0x8b417e['as'],'attributes':_0x8b417e[_0xaaf5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xaaf5('0xa')](function(_0x6915e6){logger[_0xaaf5('0xb')](_0xaaf5('0x1f'),_0x236371);logger['debug'](_0xaaf5('0x1f'),_0x236371,JSON[_0xaaf5('0xf')](_0x6915e6));_0x2f7bdc(_0x6915e6);})[_0xaaf5('0x15')](function(_0x49c7f2){logger['error'](_0xaaf5('0x1f'),_0x49c7f2['message'],_0x236371);_0x37b34a(_0x29d42a[_0xaaf5('0x10')](0x1f4,_0x49c7f2['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index fb69da7..c7d4409 100644 --- a/server/api/campaign/index.js +++ b/server/api/campaign/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x63f1=['index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','clone','/:id/blacklists','put','destroy','delete','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./campaign.controller','get','isAuthenticated'];(function(_0x2ee6a5,_0x3cc712){var _0x5081d9=function(_0x3d2258){while(--_0x3d2258){_0x2ee6a5['push'](_0x2ee6a5['shift']());}};_0x5081d9(++_0x3cc712);}(_0x63f1,0x71));var _0x163f=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x63f1[_0x2112d4];return _0x434972;};'use strict';var multer=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var path=require(_0x163f('0x2'));var timeout=require(_0x163f('0x3'));var express=require(_0x163f('0x4'));var router=express[_0x163f('0x5')]();var fs_extra=require(_0x163f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x163f('0x7'));var config=require('../../config/environment');var controller=require(_0x163f('0x8'));router[_0x163f('0x9')]('/',auth[_0x163f('0xa')](),controller[_0x163f('0xb')]);router[_0x163f('0x9')](_0x163f('0xc'),auth[_0x163f('0xa')](),controller[_0x163f('0xd')]);router[_0x163f('0x9')](_0x163f('0xe'),auth[_0x163f('0xa')](),controller[_0x163f('0xf')]);router[_0x163f('0x9')](_0x163f('0x10'),auth[_0x163f('0xa')](),controller[_0x163f('0x11')]);router[_0x163f('0x9')]('/:id/hopper_finals',auth[_0x163f('0xa')](),controller['getHopperFinals']);router[_0x163f('0x9')](_0x163f('0x12'),auth[_0x163f('0xa')](),controller[_0x163f('0x13')]);router[_0x163f('0x9')](_0x163f('0x14'),auth['isAuthenticated'](),controller[_0x163f('0x15')]);router[_0x163f('0x9')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x163f('0x16')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x163f('0x17')]('/:id/clone',auth[_0x163f('0xa')](),controller[_0x163f('0x18')]);router[_0x163f('0x17')](_0x163f('0x14'),auth[_0x163f('0xa')](),controller['addLists']);router['post'](_0x163f('0x19'),auth[_0x163f('0xa')](),controller['addBlackLists']);router[_0x163f('0x1a')](_0x163f('0xc'),auth[_0x163f('0xa')](),controller['update']);router['delete'](_0x163f('0xc'),auth[_0x163f('0xa')](),controller[_0x163f('0x1b')]);router[_0x163f('0x1c')](_0x163f('0x14'),auth['isAuthenticated'](),controller['removeLists']);router['delete'](_0x163f('0x19'),auth[_0x163f('0xa')](),controller[_0x163f('0x1d')]);module[_0x163f('0x1e')]=router; \ No newline at end of file +var _0xe672=['/:id/lists','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','show','isAuthenticated','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','getHopperBlacks','getLists','/:id/blacklists','post','create','/:id/clone','clone','addBlackLists','put','update','destroy','delete'];(function(_0x64302c,_0x569d88){var _0x4d1472=function(_0x1e1bcc){while(--_0x1e1bcc){_0x64302c['push'](_0x64302c['shift']());}};_0x4d1472(++_0x569d88);}(_0xe672,0x8c));var _0x2e67=function(_0x31c113,_0xb6597e){_0x31c113=_0x31c113-0x0;var _0x3e0252=_0xe672[_0x31c113];return _0x3e0252;};'use strict';var multer=require(_0x2e67('0x0'));var util=require(_0x2e67('0x1'));var path=require(_0x2e67('0x2'));var timeout=require(_0x2e67('0x3'));var express=require(_0x2e67('0x4'));var router=express[_0x2e67('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2e67('0x6'));var config=require(_0x2e67('0x7'));var controller=require(_0x2e67('0x8'));router[_0x2e67('0x9')]('/',auth['isAuthenticated'](),controller[_0x2e67('0xa')]);router[_0x2e67('0x9')](_0x2e67('0xb'),auth['isAuthenticated'](),controller[_0x2e67('0xc')]);router['get']('/:id/hoppers',auth[_0x2e67('0xd')](),controller[_0x2e67('0xe')]);router[_0x2e67('0x9')](_0x2e67('0xf'),auth[_0x2e67('0xd')](),controller[_0x2e67('0x10')]);router[_0x2e67('0x9')]('/:id/hopper_finals',auth[_0x2e67('0xd')](),controller[_0x2e67('0x11')]);router[_0x2e67('0x9')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0x2e67('0x12')]);router[_0x2e67('0x9')]('/:id/lists',auth[_0x2e67('0xd')](),controller[_0x2e67('0x13')]);router['get'](_0x2e67('0x14'),auth[_0x2e67('0xd')](),controller['getBlackLists']);router[_0x2e67('0x15')]('/',auth[_0x2e67('0xd')](),controller[_0x2e67('0x16')]);router[_0x2e67('0x15')](_0x2e67('0x17'),auth[_0x2e67('0xd')](),controller[_0x2e67('0x18')]);router['post']('/:id/lists',auth[_0x2e67('0xd')](),controller['addLists']);router[_0x2e67('0x15')](_0x2e67('0x14'),auth['isAuthenticated'](),controller[_0x2e67('0x19')]);router[_0x2e67('0x1a')]('/:id',auth[_0x2e67('0xd')](),controller[_0x2e67('0x1b')]);router['delete'](_0x2e67('0xb'),auth['isAuthenticated'](),controller[_0x2e67('0x1c')]);router[_0x2e67('0x1d')](_0x2e67('0x1e'),auth['isAuthenticated'](),controller[_0x2e67('0x1f')]);router[_0x2e67('0x1d')](_0x2e67('0x14'),auth[_0x2e67('0xd')](),controller[_0x2e67('0x20')]);module[_0x2e67('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 0840b0e..a2ae1fd 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 _0x9ff4=['medium','VIRTUAL','getDataValue','key'];(function(_0xc43b89,_0x5262cb){var _0x46ffb1=function(_0x3a0db5){while(--_0x3a0db5){_0xc43b89['push'](_0xc43b89['shift']());}};_0x46ffb1(++_0x5262cb);}(_0x9ff4,0xbc));var _0x49ff=function(_0x5a0f46,_0x77efbc){_0x5a0f46=_0x5a0f46-0x0;var _0x8937a8=_0x9ff4[_0x5a0f46];return _0x8937a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x49ff('0x0'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x49ff('0x1')],'get':function(){return this[_0x49ff('0x2')](_0x49ff('0x3'));}}}; \ No newline at end of file +var _0xe237=['sequelize','exports','STRING','medium','VIRTUAL','getDataValue','key'];(function(_0x19f690,_0xdbce5f){var _0x53a7df=function(_0x2a7568){while(--_0x2a7568){_0x19f690['push'](_0x19f690['shift']());}};_0x53a7df(++_0xdbce5f);}(_0xe237,0xaf));var _0x7e23=function(_0x112555,_0x13c538){_0x112555=_0x112555-0x0;var _0x3a635f=_0xe237[_0x112555];return _0x3a635f;};'use strict';var Sequelize=require(_0x7e23('0x0'));module[_0x7e23('0x1')]={'key':{'type':Sequelize[_0x7e23('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x7e23('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7e23('0x2')]},'name':{'type':Sequelize[_0x7e23('0x4')],'get':function(){return this[_0x7e23('0x5')](_0x7e23('0x6'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0fad67d..9611396 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 _0x490b=['fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','get','CannedAnswers','then','error','name','send','map','CannedAnswer','key','model','query','keys','filters','intersection','attributes'];(function(_0x43b3e5,_0xf9a63){var _0x52307c=function(_0x5612cf){while(--_0x5612cf){_0x43b3e5['push'](_0x43b3e5['shift']());}};_0x52307c(++_0xf9a63);}(_0x490b,0x1c3));var _0xb490=function(_0x151418,_0x2cbffa){_0x151418=_0x151418-0x0;var _0x40e29a=_0x490b[_0x151418];return _0x40e29a;};'use strict';var emlformat=require(_0xb490('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb490('0x1'));var jsonpatch=require(_0xb490('0x2'));var rp=require(_0xb490('0x3'));var moment=require(_0xb490('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb490('0x5'));var path=require('path');var sox=require(_0xb490('0x6'));var csv=require('to-csv');var ejs=require(_0xb490('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb490('0x8'));var squel=require(_0xb490('0x9'));var crypto=require(_0xb490('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xb490('0xb'));var toCsv=require(_0xb490('0xc'));var querystring=require(_0xb490('0xd'));var Papa=require(_0xb490('0xe'));var Redis=require(_0xb490('0xf'));var authService=require(_0xb490('0x10'));var qs=require(_0xb490('0x11'));var as=require(_0xb490('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb490('0x13'))(_0xb490('0x14'));var utils=require(_0xb490('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb490('0x16'));var db=require(_0xb490('0x17'))['db'];function respondWithStatusCode(_0x467ea4,_0x21af1e){_0x21af1e=_0x21af1e||0xcc;return function(_0x2d2522){if(_0x2d2522){return _0x467ea4[_0xb490('0x18')](_0x21af1e);}return _0x467ea4[_0xb490('0x19')](_0x21af1e)[_0xb490('0x1a')]();};}function respondWithResult(_0x215d5e,_0x57dc3e){_0x57dc3e=_0x57dc3e||0xc8;return function(_0x38bc71){if(_0x38bc71){return _0x215d5e[_0xb490('0x19')](_0x57dc3e)[_0xb490('0x1b')](_0x38bc71);}};}function respondWithFilteredResult(_0x543f46,_0x26c3aa){return function(_0x311a1f){if(_0x311a1f){var _0x145429=typeof _0x26c3aa[_0xb490('0x1c')]==='undefined'&&typeof _0x26c3aa[_0xb490('0x1d')]===_0xb490('0x1e');var _0x5253af=_0x311a1f[_0xb490('0x1f')];var _0x4901d1=_0x145429?0x0:_0x26c3aa[_0xb490('0x1c')];var _0x3bc713=_0x145429?_0x311a1f['count']:_0x26c3aa[_0xb490('0x1c')]+_0x26c3aa[_0xb490('0x1d')];var _0xa7a066;if(_0x3bc713>=_0x5253af){_0x3bc713=_0x5253af;_0xa7a066=0xc8;}else{_0xa7a066=0xce;}_0x543f46[_0xb490('0x19')](_0xa7a066);return _0x543f46['set'](_0xb490('0x20'),_0x4901d1+'-'+_0x3bc713+'/'+_0x5253af)[_0xb490('0x1b')](_0x311a1f);}return null;};}function patchUpdates(_0x140301){return function(_0x5d22c7){try{jsonpatch[_0xb490('0x21')](_0x5d22c7,_0x140301,!![]);}catch(_0x3bfb26){return BPromise[_0xb490('0x22')](_0x3bfb26);}return _0x5d22c7[_0xb490('0x23')]();};}function saveUpdates(_0x7d96a0,_0x439229){return function(_0x5f0874){if(_0x5f0874){return _0x5f0874[_0xb490('0x24')](_0x7d96a0)['then'](function(_0x485afb){return _0x485afb;});}return null;};}function removeEntity(_0x2327dd,_0x55785e){return function(_0x6cf490){if(_0x6cf490){return _0x6cf490[_0xb490('0x25')]()['then'](function(){var _0x365911=_0x6cf490[_0xb490('0x26')]({'plain':!![]});var _0x423634=_0xb490('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x423634,'resourceId':_0x365911['id']}})[_0xb490('0x28')](function(){return _0x6cf490;});})[_0xb490('0x28')](function(){_0x2327dd[_0xb490('0x19')](0xcc)[_0xb490('0x1a')]();});}};}function handleEntityNotFound(_0x3ec8ea,_0x2c5c24){return function(_0x386ea1){if(!_0x386ea1){_0x3ec8ea[_0xb490('0x18')](0x194);}return _0x386ea1;};}function handleError(_0xeeb396,_0x24b9f8){_0x24b9f8=_0x24b9f8||0x1f4;return function(_0x39d6c6){logger[_0xb490('0x29')](_0x39d6c6['stack']);if(_0x39d6c6[_0xb490('0x2a')]){delete _0x39d6c6[_0xb490('0x2a')];}_0xeeb396['status'](_0x24b9f8)[_0xb490('0x2b')](_0x39d6c6);};}exports['index']=function(_0x169672,_0x2932c0){var _0x547b47={},_0x3cd019={},_0x44ec12={'count':0x0,'rows':[]};var _0x547f14=_[_0xb490('0x2c')](db[_0xb490('0x2d')]['rawAttributes'],function(_0x230b3c){return{'name':_0x230b3c['fieldName'],'type':_0x230b3c['type'][_0xb490('0x2e')]};});_0x3cd019[_0xb490('0x2f')]=_[_0xb490('0x2c')](_0x547f14,_0xb490('0x2a'));_0x3cd019[_0xb490('0x30')]=_[_0xb490('0x31')](_0x169672[_0xb490('0x30')]);_0x3cd019[_0xb490('0x32')]=_[_0xb490('0x33')](_0x3cd019[_0xb490('0x2f')],_0x3cd019['query']);_0x547b47[_0xb490('0x34')]=_['intersection'](_0x3cd019[_0xb490('0x2f')],qs[_0xb490('0x35')](_0x169672[_0xb490('0x30')]['fields']));_0x547b47[_0xb490('0x34')]=_0x547b47[_0xb490('0x34')]['length']?_0x547b47[_0xb490('0x34')]:_0x3cd019[_0xb490('0x2f')];if(!_0x169672[_0xb490('0x30')][_0xb490('0x36')](_0xb490('0x37'))){_0x547b47[_0xb490('0x1d')]=qs[_0xb490('0x1d')](_0x169672[_0xb490('0x30')][_0xb490('0x1d')]);_0x547b47['offset']=qs[_0xb490('0x1c')](_0x169672['query'][_0xb490('0x1c')]);}_0x547b47[_0xb490('0x38')]=qs[_0xb490('0x39')](_0x169672[_0xb490('0x30')]['sort']);_0x547b47[_0xb490('0x3a')]=qs[_0xb490('0x32')](_[_0xb490('0x3b')](_0x169672[_0xb490('0x30')],_0x3cd019[_0xb490('0x32')]),_0x547f14);if(_0x169672[_0xb490('0x30')][_0xb490('0x3c')]){_0x547b47[_0xb490('0x3a')]=_['merge'](_0x547b47[_0xb490('0x3a')],{'$or':[{'key':{'$like':'%'+_0x169672['query'][_0xb490('0x3c')]+'%'}},{'value':{'$like':'%'+_0x169672[_0xb490('0x30')]['filter']+'%'}}]});}_0x547b47=_['merge']({},_0x547b47,_0x169672[_0xb490('0x3d')]);var _0x5b8f6b={'where':_0x547b47[_0xb490('0x3a')]};return db[_0xb490('0x2d')][_0xb490('0x1f')](_0x5b8f6b)[_0xb490('0x28')](function(_0x20b5be){_0x44ec12['count']=_0x20b5be;if(_0x169672[_0xb490('0x30')][_0xb490('0x3e')]){_0x547b47[_0xb490('0x3f')]=[{'all':!![]}];}return db['CannedAnswer'][_0xb490('0x40')](_0x547b47);})[_0xb490('0x28')](function(_0x355bd3){_0x44ec12[_0xb490('0x41')]=_0x355bd3;return _0x44ec12;})[_0xb490('0x28')](respondWithFilteredResult(_0x2932c0,_0x547b47))[_0xb490('0x42')](handleError(_0x2932c0,null));};exports[_0xb490('0x43')]=function(_0x36a867,_0x366d74){var _0x59a5e9={'raw':!![],'where':{'id':_0x36a867[_0xb490('0x44')]['id']}},_0x24eea3={};_0x24eea3[_0xb490('0x2f')]=_[_0xb490('0x31')](db[_0xb490('0x2d')][_0xb490('0x45')]);_0x24eea3[_0xb490('0x30')]=_['keys'](_0x36a867[_0xb490('0x30')]);_0x24eea3[_0xb490('0x32')]=_[_0xb490('0x33')](_0x24eea3[_0xb490('0x2f')],_0x24eea3['query']);_0x59a5e9[_0xb490('0x34')]=_['intersection'](_0x24eea3[_0xb490('0x2f')],qs[_0xb490('0x35')](_0x36a867[_0xb490('0x30')][_0xb490('0x35')]));_0x59a5e9[_0xb490('0x34')]=_0x59a5e9[_0xb490('0x34')]['length']?_0x59a5e9[_0xb490('0x34')]:_0x24eea3['model'];if(_0x36a867[_0xb490('0x30')]['includeAll']){_0x59a5e9['include']=[{'all':!![]}];}_0x59a5e9=_['merge']({},_0x59a5e9,_0x36a867[_0xb490('0x3d')]);return db['CannedAnswer'][_0xb490('0x46')](_0x59a5e9)[_0xb490('0x28')](handleEntityNotFound(_0x366d74,null))['then'](respondWithResult(_0x366d74,null))[_0xb490('0x42')](handleError(_0x366d74,null));};exports[_0xb490('0x24')]=function(_0x415256,_0x10bf15){if(_0x415256['body']['id']){delete _0x415256[_0xb490('0x47')]['id'];}return db[_0xb490('0x2d')][_0xb490('0x46')]({'where':{'id':_0x415256['params']['id']}})[_0xb490('0x28')](handleEntityNotFound(_0x10bf15,null))[_0xb490('0x28')](saveUpdates(_0x415256[_0xb490('0x47')],null))[_0xb490('0x28')](respondWithResult(_0x10bf15,null))['catch'](handleError(_0x10bf15,null));};exports[_0xb490('0x25')]=function(_0x6e4802,_0x1070bc){return db[_0xb490('0x2d')]['find']({'where':{'id':_0x6e4802[_0xb490('0x44')]['id']}})['then'](handleEntityNotFound(_0x1070bc,null))['then'](removeEntity(_0x1070bc,null))['catch'](handleError(_0x1070bc,null));};exports[_0xb490('0x48')]=function(_0x2a5236,_0xaec795){var _0x37c435={'key':_0x2a5236[_0xb490('0x47')][_0xb490('0x2e')]};if(_0x2a5236['body'][_0xb490('0x49')]){_0x37c435['MailAccountId']=_0x2a5236[_0xb490('0x47')][_0xb490('0x49')];}else if(_0x2a5236[_0xb490('0x47')][_0xb490('0x4a')]){_0x37c435['SmsAccountId']=_0x2a5236['body'][_0xb490('0x4a')];}else if(_0x2a5236[_0xb490('0x47')][_0xb490('0x4b')]){_0x37c435[_0xb490('0x4b')]=_0x2a5236[_0xb490('0x47')][_0xb490('0x4b')];}else if(_0x2a5236['body'][_0xb490('0x4c')]){_0x37c435[_0xb490('0x4c')]=_0x2a5236['body']['ChatWebsiteId'];}return db['CannedAnswer'][_0xb490('0x46')]({'where':_0x37c435})[_0xb490('0x28')](function(_0x37fdcb){if(_0x37fdcb){throw new db[(_0xb490('0x4d'))]['ValidationError'](_0xb490('0x4e'));}return db[_0xb490('0x2d')][_0xb490('0x48')](_0x2a5236[_0xb490('0x47')]);})[_0xb490('0x28')](function(_0x331a61){var _0x29aca5=_0x2a5236['user']['get']({'plain':!![]});if(!_0x29aca5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29aca5['role']===_0xb490('0x4f')){var _0x49731d=_0x331a61[_0xb490('0x26')]({'plain':!![]});return db[_0xb490('0x50')][_0xb490('0x46')]({'where':{'name':_0xb490('0x27'),'userProfileId':_0x29aca5[_0xb490('0x51')]},'raw':!![]})[_0xb490('0x28')](function(_0x5d1539){if(_0x5d1539&&_0x5d1539['autoAssociation']===0x0){return db[_0xb490('0x52')][_0xb490('0x48')]({'name':_0x49731d[_0xb490('0x2a')],'resourceId':_0x49731d['id'],'type':_0x5d1539['name'],'sectionId':_0x5d1539['id']},{})['then'](function(){return _0x331a61;});}else{return _0x331a61;}})[_0xb490('0x42')](function(_0x3bfa97){logger['error'](_0xb490('0x53'),_0x3bfa97);throw _0x3bfa97;});}return _0x331a61;})[_0xb490('0x28')](respondWithResult(_0xaec795,0xc9))['catch'](handleError(_0xaec795,null));}; \ No newline at end of file +var _0x31fe=['filter','merge','options','CannedAnswer','includeAll','include','findAll','rows','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','The\x20inserted\x20key\x20already\x20exists.','user','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','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x31fe,0x183));var _0xe31f=function(_0x51855a,_0x18ac87){_0x51855a=_0x51855a-0x0;var _0x32d730=_0x31fe[_0x51855a];return _0x32d730;};'use strict';var emlformat=require(_0xe31f('0x0'));var rimraf=require(_0xe31f('0x1'));var zipdir=require(_0xe31f('0x2'));var jsonpatch=require(_0xe31f('0x3'));var rp=require(_0xe31f('0x4'));var moment=require('moment');var BPromise=require(_0xe31f('0x5'));var Mustache=require(_0xe31f('0x6'));var util=require('util');var path=require(_0xe31f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe31f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe31f('0x9'));var squel=require(_0xe31f('0xa'));var crypto=require(_0xe31f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xe31f('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe31f('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe31f('0xe'));var qs=require(_0xe31f('0xf'));var as=require(_0xe31f('0x10'));var hardwareService=require(_0xe31f('0x11'));var logger=require('../../config/logger')(_0xe31f('0x12'));var utils=require(_0xe31f('0x13'));var config=require(_0xe31f('0x14'));var licenseUtil=require(_0xe31f('0x15'));var db=require(_0xe31f('0x16'))['db'];function respondWithStatusCode(_0x4b853d,_0x385141){_0x385141=_0x385141||0xcc;return function(_0x4cc0dd){if(_0x4cc0dd){return _0x4b853d['sendStatus'](_0x385141);}return _0x4b853d['status'](_0x385141)[_0xe31f('0x17')]();};}function respondWithResult(_0x40043d,_0x5496dc){_0x5496dc=_0x5496dc||0xc8;return function(_0x25ff39){if(_0x25ff39){return _0x40043d[_0xe31f('0x18')](_0x5496dc)[_0xe31f('0x19')](_0x25ff39);}};}function respondWithFilteredResult(_0x4f02ee,_0x1de17d){return function(_0x852404){if(_0x852404){var _0x71ca66=typeof _0x1de17d[_0xe31f('0x1a')]===_0xe31f('0x1b')&&typeof _0x1de17d[_0xe31f('0x1c')]===_0xe31f('0x1b');var _0x166345=_0x852404[_0xe31f('0x1d')];var _0x3a87d4=_0x71ca66?0x0:_0x1de17d[_0xe31f('0x1a')];var _0xf9d673=_0x71ca66?_0x852404[_0xe31f('0x1d')]:_0x1de17d[_0xe31f('0x1a')]+_0x1de17d[_0xe31f('0x1c')];var _0xd3b708;if(_0xf9d673>=_0x166345){_0xf9d673=_0x166345;_0xd3b708=0xc8;}else{_0xd3b708=0xce;}_0x4f02ee[_0xe31f('0x18')](_0xd3b708);return _0x4f02ee[_0xe31f('0x1e')](_0xe31f('0x1f'),_0x3a87d4+'-'+_0xf9d673+'/'+_0x166345)[_0xe31f('0x19')](_0x852404);}return null;};}function patchUpdates(_0x48df98){return function(_0x86700e){try{jsonpatch[_0xe31f('0x20')](_0x86700e,_0x48df98,!![]);}catch(_0x370e0f){return BPromise[_0xe31f('0x21')](_0x370e0f);}return _0x86700e['save']();};}function saveUpdates(_0x528542,_0x498ecd){return function(_0x57d9db){if(_0x57d9db){return _0x57d9db[_0xe31f('0x22')](_0x528542)[_0xe31f('0x23')](function(_0x4c4fc8){return _0x4c4fc8;});}return null;};}function removeEntity(_0x212157,_0x1bdfc3){return function(_0x3de15f){if(_0x3de15f){return _0x3de15f[_0xe31f('0x24')]()[_0xe31f('0x23')](function(){var _0x45a334=_0x3de15f[_0xe31f('0x25')]({'plain':!![]});var _0x20f986='CannedAnswers';return db[_0xe31f('0x26')][_0xe31f('0x24')]({'where':{'type':_0x20f986,'resourceId':_0x45a334['id']}})[_0xe31f('0x23')](function(){return _0x3de15f;});})[_0xe31f('0x23')](function(){_0x212157[_0xe31f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5230dd,_0x3be51e){return function(_0x12536a){if(!_0x12536a){_0x5230dd[_0xe31f('0x27')](0x194);}return _0x12536a;};}function handleError(_0x374d06,_0xc294d4){_0xc294d4=_0xc294d4||0x1f4;return function(_0xb31076){logger[_0xe31f('0x28')](_0xb31076[_0xe31f('0x29')]);if(_0xb31076[_0xe31f('0x2a')]){delete _0xb31076[_0xe31f('0x2a')];}_0x374d06[_0xe31f('0x18')](_0xc294d4)[_0xe31f('0x2b')](_0xb31076);};}exports[_0xe31f('0x2c')]=function(_0x4a9e62,_0x3caf85){var _0x404734={},_0x226434={},_0x557655={'count':0x0,'rows':[]};var _0x1b75db=_['map'](db['CannedAnswer'][_0xe31f('0x2d')],function(_0xa77a75){return{'name':_0xa77a75[_0xe31f('0x2e')],'type':_0xa77a75[_0xe31f('0x2f')][_0xe31f('0x30')]};});_0x226434[_0xe31f('0x31')]=_[_0xe31f('0x32')](_0x1b75db,_0xe31f('0x2a'));_0x226434[_0xe31f('0x33')]=_[_0xe31f('0x34')](_0x4a9e62[_0xe31f('0x33')]);_0x226434['filters']=_[_0xe31f('0x35')](_0x226434[_0xe31f('0x31')],_0x226434[_0xe31f('0x33')]);_0x404734['attributes']=_['intersection'](_0x226434[_0xe31f('0x31')],qs[_0xe31f('0x36')](_0x4a9e62[_0xe31f('0x33')][_0xe31f('0x36')]));_0x404734['attributes']=_0x404734[_0xe31f('0x37')][_0xe31f('0x38')]?_0x404734[_0xe31f('0x37')]:_0x226434[_0xe31f('0x31')];if(!_0x4a9e62[_0xe31f('0x33')]['hasOwnProperty'](_0xe31f('0x39'))){_0x404734[_0xe31f('0x1c')]=qs[_0xe31f('0x1c')](_0x4a9e62[_0xe31f('0x33')][_0xe31f('0x1c')]);_0x404734['offset']=qs[_0xe31f('0x1a')](_0x4a9e62['query'][_0xe31f('0x1a')]);}_0x404734[_0xe31f('0x3a')]=qs[_0xe31f('0x3b')](_0x4a9e62['query'][_0xe31f('0x3b')]);_0x404734[_0xe31f('0x3c')]=qs[_0xe31f('0x3d')](_[_0xe31f('0x3e')](_0x4a9e62[_0xe31f('0x33')],_0x226434[_0xe31f('0x3d')]),_0x1b75db);if(_0x4a9e62['query'][_0xe31f('0x3f')]){_0x404734[_0xe31f('0x3c')]=_[_0xe31f('0x40')](_0x404734['where'],{'$or':[{'key':{'$like':'%'+_0x4a9e62[_0xe31f('0x33')][_0xe31f('0x3f')]+'%'}},{'value':{'$like':'%'+_0x4a9e62[_0xe31f('0x33')][_0xe31f('0x3f')]+'%'}}]});}_0x404734=_[_0xe31f('0x40')]({},_0x404734,_0x4a9e62[_0xe31f('0x41')]);var _0x3f7e90={'where':_0x404734[_0xe31f('0x3c')]};return db[_0xe31f('0x42')][_0xe31f('0x1d')](_0x3f7e90)['then'](function(_0x3ddc3f){_0x557655[_0xe31f('0x1d')]=_0x3ddc3f;if(_0x4a9e62[_0xe31f('0x33')][_0xe31f('0x43')]){_0x404734[_0xe31f('0x44')]=[{'all':!![]}];}return db[_0xe31f('0x42')][_0xe31f('0x45')](_0x404734);})['then'](function(_0x5c0ad1){_0x557655[_0xe31f('0x46')]=_0x5c0ad1;return _0x557655;})[_0xe31f('0x23')](respondWithFilteredResult(_0x3caf85,_0x404734))['catch'](handleError(_0x3caf85,null));};exports[_0xe31f('0x47')]=function(_0x109304,_0x271730){var _0x148067={'raw':!![],'where':{'id':_0x109304[_0xe31f('0x48')]['id']}},_0x3e82c5={};_0x3e82c5[_0xe31f('0x31')]=_[_0xe31f('0x34')](db[_0xe31f('0x42')]['rawAttributes']);_0x3e82c5['query']=_[_0xe31f('0x34')](_0x109304[_0xe31f('0x33')]);_0x3e82c5[_0xe31f('0x3d')]=_['intersection'](_0x3e82c5[_0xe31f('0x31')],_0x3e82c5['query']);_0x148067[_0xe31f('0x37')]=_[_0xe31f('0x35')](_0x3e82c5[_0xe31f('0x31')],qs['fields'](_0x109304[_0xe31f('0x33')]['fields']));_0x148067['attributes']=_0x148067[_0xe31f('0x37')][_0xe31f('0x38')]?_0x148067[_0xe31f('0x37')]:_0x3e82c5[_0xe31f('0x31')];if(_0x109304[_0xe31f('0x33')][_0xe31f('0x43')]){_0x148067['include']=[{'all':!![]}];}_0x148067=_[_0xe31f('0x40')]({},_0x148067,_0x109304[_0xe31f('0x41')]);return db[_0xe31f('0x42')][_0xe31f('0x49')](_0x148067)[_0xe31f('0x23')](handleEntityNotFound(_0x271730,null))[_0xe31f('0x23')](respondWithResult(_0x271730,null))[_0xe31f('0x4a')](handleError(_0x271730,null));};exports[_0xe31f('0x22')]=function(_0x155a48,_0x3950a1){if(_0x155a48[_0xe31f('0x4b')]['id']){delete _0x155a48[_0xe31f('0x4b')]['id'];}return db[_0xe31f('0x42')][_0xe31f('0x49')]({'where':{'id':_0x155a48[_0xe31f('0x48')]['id']}})[_0xe31f('0x23')](handleEntityNotFound(_0x3950a1,null))[_0xe31f('0x23')](saveUpdates(_0x155a48[_0xe31f('0x4b')],null))[_0xe31f('0x23')](respondWithResult(_0x3950a1,null))[_0xe31f('0x4a')](handleError(_0x3950a1,null));};exports[_0xe31f('0x24')]=function(_0x56a7c2,_0x130b8f){return db['CannedAnswer'][_0xe31f('0x49')]({'where':{'id':_0x56a7c2[_0xe31f('0x48')]['id']}})[_0xe31f('0x23')](handleEntityNotFound(_0x130b8f,null))['then'](removeEntity(_0x130b8f,null))[_0xe31f('0x4a')](handleError(_0x130b8f,null));};exports[_0xe31f('0x4c')]=function(_0x4fa243,_0x306961){var _0xbedd92={'key':_0x4fa243['body']['key']};if(_0x4fa243[_0xe31f('0x4b')][_0xe31f('0x4d')]){_0xbedd92[_0xe31f('0x4d')]=_0x4fa243[_0xe31f('0x4b')]['MailAccountId'];}else if(_0x4fa243[_0xe31f('0x4b')][_0xe31f('0x4e')]){_0xbedd92['SmsAccountId']=_0x4fa243[_0xe31f('0x4b')][_0xe31f('0x4e')];}else if(_0x4fa243['body'][_0xe31f('0x4f')]){_0xbedd92[_0xe31f('0x4f')]=_0x4fa243[_0xe31f('0x4b')][_0xe31f('0x4f')];}else if(_0x4fa243['body']['ChatWebsiteId']){_0xbedd92['ChatWebsiteId']=_0x4fa243['body'][_0xe31f('0x50')];}return db['CannedAnswer'][_0xe31f('0x49')]({'where':_0xbedd92})['then'](function(_0x15a0d1){if(_0x15a0d1){throw new db[(_0xe31f('0x51'))]['ValidationError'](_0xe31f('0x52'));}return db[_0xe31f('0x42')][_0xe31f('0x4c')](_0x4fa243[_0xe31f('0x4b')]);})['then'](function(_0x41fcea){var _0x5c6344=_0x4fa243[_0xe31f('0x53')]['get']({'plain':!![]});if(!_0x5c6344)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c6344[_0xe31f('0x54')]===_0xe31f('0x53')){var _0x7c533b=_0x41fcea[_0xe31f('0x25')]({'plain':!![]});return db[_0xe31f('0x55')][_0xe31f('0x49')]({'where':{'name':_0xe31f('0x56'),'userProfileId':_0x5c6344[_0xe31f('0x57')]},'raw':!![]})['then'](function(_0x50756b){if(_0x50756b&&_0x50756b[_0xe31f('0x58')]===0x0){return db[_0xe31f('0x26')][_0xe31f('0x4c')]({'name':_0x7c533b[_0xe31f('0x2a')],'resourceId':_0x7c533b['id'],'type':_0x50756b[_0xe31f('0x2a')],'sectionId':_0x50756b['id']},{})[_0xe31f('0x23')](function(){return _0x41fcea;});}else{return _0x41fcea;}})[_0xe31f('0x4a')](function(_0x2b2586){logger[_0xe31f('0x28')](_0xe31f('0x59'),_0x2b2586);throw _0x2b2586;});}return _0x41fcea;})['then'](respondWithResult(_0x306961,0xc9))[_0xe31f('0x4a')](handleError(_0x306961,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index d64b256..a45f889 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 _0x1d28=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x1d28,0x16e));var _0x81d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x81d2('0x0'));var util=require('util');var logger=require(_0x81d2('0x1'))(_0x81d2('0x2'));var moment=require(_0x81d2('0x3'));var BPromise=require(_0x81d2('0x4'));var rp=require(_0x81d2('0x5'));var fs=require('fs');var path=require(_0x81d2('0x6'));var rimraf=require('rimraf');var config=require(_0x81d2('0x7'));var attributes=require(_0x81d2('0x8'));module[_0x81d2('0x9')]=function(_0x5579cb,_0x567206){return _0x5579cb[_0x81d2('0xa')]('CannedAnswer',attributes,{'tableName':_0x81d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x81d2('0xc'),'collate':_0x81d2('0xd')});}; \ No newline at end of file +var _0xfaae=['rimraf','../../config/environment','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x5a3cf0,_0x160a68){var _0x5a64ee=function(_0x34cd1d){while(--_0x34cd1d){_0x5a3cf0['push'](_0x5a3cf0['shift']());}};_0x5a64ee(++_0x160a68);}(_0xfaae,0x1aa));var _0xefaa=function(_0xa072cf,_0x42cdc3){_0xa072cf=_0xa072cf-0x0;var _0x374793=_0xfaae[_0xa072cf];return _0x374793;};'use strict';var _=require(_0xefaa('0x0'));var util=require(_0xefaa('0x1'));var logger=require(_0xefaa('0x2'))(_0xefaa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xefaa('0x4'));var fs=require('fs');var path=require(_0xefaa('0x5'));var rimraf=require(_0xefaa('0x6'));var config=require(_0xefaa('0x7'));var attributes=require('./cannedAnswer.attributes');module['exports']=function(_0x3db728,_0x1c65a3){return _0x3db728['define'](_0xefaa('0x8'),attributes,{'tableName':_0xefaa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xefaa('0xa'),'collate':_0xefaa('0xb')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 5516933..55af5d9 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(_0x4a9f14,_0x20cf43){var _0x486d7e=function(_0x4431c6){while(--_0x4431c6){_0x4a9f14['push'](_0x4a9f14['shift']());}};_0x486d7e(++_0x20cf43);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'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(_0x2c4379,_0x23d81a){var _0x3b454c=function(_0x3a3a67){while(--_0x3a3a67){_0x2c4379['push'](_0x2c4379['shift']());}};_0x3b454c(++_0x23d81a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index bb85d6a..c6f0ab1 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 _0xee1b=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5b7788,_0x309ae5){var _0x573871=function(_0x5c79fd){while(--_0x5c79fd){_0x5b7788['push'](_0x5b7788['shift']());}};_0x573871(++_0x309ae5);}(_0xee1b,0x159));var _0xbee1=function(_0x1df917,_0x36516){_0x1df917=_0x1df917-0x0;var _0x46981f=_0xee1b[_0x1df917];return _0x46981f;};'use strict';var multer=require(_0xbee1('0x0'));var util=require(_0xbee1('0x1'));var path=require(_0xbee1('0x2'));var timeout=require(_0xbee1('0x3'));var express=require(_0xbee1('0x4'));var router=express[_0xbee1('0x5')]();var fs_extra=require(_0xbee1('0x6'));var auth=require(_0xbee1('0x7'));var interaction=require(_0xbee1('0x8'));var config=require(_0xbee1('0x9'));var controller=require(_0xbee1('0xa'));router[_0xbee1('0xb')]('/',auth[_0xbee1('0xc')](),controller[_0xbee1('0xd')]);router[_0xbee1('0xb')](_0xbee1('0xe'),auth['isAuthenticated'](),controller[_0xbee1('0xf')]);router[_0xbee1('0x10')]('/',auth[_0xbee1('0xc')](),controller[_0xbee1('0x11')]);router[_0xbee1('0x12')](_0xbee1('0xe'),auth[_0xbee1('0xc')](),controller[_0xbee1('0x13')]);router['delete'](_0xbee1('0xe'),auth[_0xbee1('0xc')](),controller[_0xbee1('0x14')]);module[_0xbee1('0x15')]=router; \ No newline at end of file +var _0x50db=['./cannedAnswer.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x50db,0x1aa));var _0xb50d=function(_0x5bec8c,_0x5ec20d){_0x5bec8c=_0x5bec8c-0x0;var _0xb046d3=_0x50db[_0x5bec8c];return _0xb046d3;};'use strict';var multer=require('multer');var util=require(_0xb50d('0x0'));var path=require('path');var timeout=require(_0xb50d('0x1'));var express=require(_0xb50d('0x2'));var router=express[_0xb50d('0x3')]();var fs_extra=require(_0xb50d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb50d('0x5'));var config=require('../../config/environment');var controller=require(_0xb50d('0x6'));router[_0xb50d('0x7')]('/',auth[_0xb50d('0x8')](),controller['index']);router['get'](_0xb50d('0x9'),auth[_0xb50d('0x8')](),controller['show']);router[_0xb50d('0xa')]('/',auth[_0xb50d('0x8')](),controller[_0xb50d('0xb')]);router[_0xb50d('0xc')](_0xb50d('0x9'),auth[_0xb50d('0x8')](),controller[_0xb50d('0xd')]);router[_0xb50d('0xe')]('/:id',auth[_0xb50d('0x8')](),controller[_0xb50d('0xf')]);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 a3e3a06..4ba3622 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 _0xc547=['1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x2e6c19,_0x131233){var _0x52885d=function(_0x38f224){while(--_0x38f224){_0x2e6c19['push'](_0x2e6c19['shift']());}};_0x52885d(++_0x131233);}(_0xc547,0x153));var _0x7c54=function(_0x354417,_0x36a9c5){_0x354417=_0x354417-0x0;var _0x4a6e62=_0xc547[_0x354417];return _0x4a6e62;};'use strict';var Sequelize=require('sequelize');module[_0x7c54('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x7c54('0x1')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x7c54('0x2')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7c54('0x2')]},'dstchannel':{'type':Sequelize[_0x7c54('0x2')]},'lastapp':{'type':Sequelize[_0x7c54('0x2')]},'lastdata':{'type':Sequelize[_0x7c54('0x2')]},'duration':{'type':Sequelize[_0x7c54('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x7c54('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x7c54('0x2')]},'userfield':{'type':Sequelize[_0x7c54('0x2')]},'uniqueid':{'type':Sequelize[_0x7c54('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x7c54('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7c54('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd5b6=['INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x19fc2b,_0x20bcc0){var _0x10c83a=function(_0x1db40f){while(--_0x1db40f){_0x19fc2b['push'](_0x19fc2b['shift']());}};_0x10c83a(++_0x20bcc0);}(_0xd5b6,0x73));var _0x6d5b=function(_0x111d54,_0x1e10a7){_0x111d54=_0x111d54-0x0;var _0x40561f=_0xd5b6[_0x111d54];return _0x40561f;};'use strict';var Sequelize=require(_0x6d5b('0x0'));module[_0x6d5b('0x1')]={'calldate':{'type':Sequelize[_0x6d5b('0x2')],'allowNull':![],'defaultValue':_0x6d5b('0x3')},'clid':{'type':Sequelize[_0x6d5b('0x4')]},'src':{'type':Sequelize[_0x6d5b('0x4')]},'dst':{'type':Sequelize[_0x6d5b('0x4')]},'dcontext':{'type':Sequelize[_0x6d5b('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6d5b('0x4')]},'lastapp':{'type':Sequelize[_0x6d5b('0x4')]},'lastdata':{'type':Sequelize[_0x6d5b('0x4')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x6d5b('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6d5b('0x4')]},'amaflags':{'type':Sequelize[_0x6d5b('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6d5b('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x6d5b('0x4')]},'sequence':{'type':Sequelize[_0x6d5b('0x4')]},'peeraccount':{'type':Sequelize[_0x6d5b('0x4')]},'type':{'type':Sequelize[_0x6d5b('0x4')]},'tag':{'type':Sequelize[_0x6d5b('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 20a3ead..da33a5f 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 _0xcb81=['save','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x1f1489,_0xf4dda3){var _0x40a863=function(_0x35aa01){while(--_0x35aa01){_0x1f1489['push'](_0x1f1489['shift']());}};_0x40a863(++_0xf4dda3);}(_0xcb81,0x154));var _0x1cb8=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0xcb81[_0x2440fe];return _0x5cf734;};'use strict';var emlformat=require(_0x1cb8('0x0'));var rimraf=require(_0x1cb8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1cb8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1cb8('0x3'));var util=require(_0x1cb8('0x4'));var path=require(_0x1cb8('0x5'));var sox=require(_0x1cb8('0x6'));var csv=require(_0x1cb8('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1cb8('0x8'));var _=require(_0x1cb8('0x9'));var squel=require('squel');var crypto=require(_0x1cb8('0xa'));var jsforce=require(_0x1cb8('0xb'));var deskjs=require(_0x1cb8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1cb8('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1cb8('0xe'));var qs=require(_0x1cb8('0xf'));var as=require(_0x1cb8('0x10'));var hardwareService=require(_0x1cb8('0x11'));var logger=require(_0x1cb8('0x12'))(_0x1cb8('0x13'));var utils=require(_0x1cb8('0x14'));var config=require(_0x1cb8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x1cb8('0x16'))['db'];function respondWithStatusCode(_0x1ffe94,_0x1938ee){_0x1938ee=_0x1938ee||0xcc;return function(_0x299eea){if(_0x299eea){return _0x1ffe94[_0x1cb8('0x17')](_0x1938ee);}return _0x1ffe94['status'](_0x1938ee)[_0x1cb8('0x18')]();};}function respondWithResult(_0x2c600,_0xcb6ad1){_0xcb6ad1=_0xcb6ad1||0xc8;return function(_0x14d84d){if(_0x14d84d){return _0x2c600[_0x1cb8('0x19')](_0xcb6ad1)[_0x1cb8('0x1a')](_0x14d84d);}};}function respondWithFilteredResult(_0x339ad0,_0x243930){return function(_0x5af4a3){if(_0x5af4a3){var _0x17a95d=typeof _0x243930['offset']===_0x1cb8('0x1b')&&typeof _0x243930[_0x1cb8('0x1c')]===_0x1cb8('0x1b');var _0x46abd0=_0x5af4a3[_0x1cb8('0x1d')];var _0x308088=_0x17a95d?0x0:_0x243930[_0x1cb8('0x1e')];var _0x9f0adb=_0x17a95d?_0x5af4a3[_0x1cb8('0x1d')]:_0x243930[_0x1cb8('0x1e')]+_0x243930[_0x1cb8('0x1c')];var _0x3cda27;if(_0x9f0adb>=_0x46abd0){_0x9f0adb=_0x46abd0;_0x3cda27=0xc8;}else{_0x3cda27=0xce;}_0x339ad0['status'](_0x3cda27);return _0x339ad0[_0x1cb8('0x1f')](_0x1cb8('0x20'),_0x308088+'-'+_0x9f0adb+'/'+_0x46abd0)[_0x1cb8('0x1a')](_0x5af4a3);}return null;};}function patchUpdates(_0x3d1682){return function(_0x4abf3a){try{jsonpatch[_0x1cb8('0x21')](_0x4abf3a,_0x3d1682,!![]);}catch(_0x4f9220){return BPromise[_0x1cb8('0x22')](_0x4f9220);}return _0x4abf3a[_0x1cb8('0x23')]();};}function saveUpdates(_0x40b914,_0x38ff3a){return function(_0x559916){if(_0x559916){return _0x559916['update'](_0x40b914)[_0x1cb8('0x24')](function(_0x4040be){return _0x4040be;});}return null;};}function removeEntity(_0x22dafe,_0x44a00d){return function(_0x2473b8){if(_0x2473b8){return _0x2473b8[_0x1cb8('0x25')]()[_0x1cb8('0x24')](function(){_0x22dafe['status'](0xcc)[_0x1cb8('0x18')]();});}};}function handleEntityNotFound(_0x4554d5,_0x35c890){return function(_0xeeb21d){if(!_0xeeb21d){_0x4554d5[_0x1cb8('0x17')](0x194);}return _0xeeb21d;};}function handleError(_0x41ab56,_0x4ca3be){_0x4ca3be=_0x4ca3be||0x1f4;return function(_0x1ec995){logger[_0x1cb8('0x26')](_0x1ec995[_0x1cb8('0x27')]);if(_0x1ec995[_0x1cb8('0x28')]){delete _0x1ec995[_0x1cb8('0x28')];}_0x41ab56['status'](_0x4ca3be)[_0x1cb8('0x29')](_0x1ec995);};}exports[_0x1cb8('0x2a')]=function(_0x3a8b53,_0x21c17a){var _0x4fda96={},_0x2a79e0={},_0x2ba8c8={'count':0x0,'rows':[]};var _0x3a6a67=_['map'](db[_0x1cb8('0x2b')][_0x1cb8('0x2c')],function(_0x17abe1){return{'name':_0x17abe1['fieldName'],'type':_0x17abe1[_0x1cb8('0x2d')][_0x1cb8('0x2e')]};});_0x2a79e0[_0x1cb8('0x2f')]=_[_0x1cb8('0x30')](_0x3a6a67,_0x1cb8('0x28'));_0x2a79e0['query']=_[_0x1cb8('0x31')](_0x3a8b53[_0x1cb8('0x32')]);_0x2a79e0[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],_0x2a79e0[_0x1cb8('0x32')]);_0x4fda96[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x2a79e0[_0x1cb8('0x2f')],qs['fields'](_0x3a8b53['query'][_0x1cb8('0x36')]));_0x4fda96[_0x1cb8('0x35')]=_0x4fda96[_0x1cb8('0x35')]['length']?_0x4fda96['attributes']:_0x2a79e0[_0x1cb8('0x2f')];if(!_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x37')](_0x1cb8('0x38'))){_0x4fda96[_0x1cb8('0x1c')]=qs[_0x1cb8('0x1c')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1c')]);_0x4fda96['offset']=qs[_0x1cb8('0x1e')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x1e')]);}_0x4fda96[_0x1cb8('0x39')]=qs[_0x1cb8('0x3a')](_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x3a')]);_0x4fda96[_0x1cb8('0x3b')]=qs[_0x1cb8('0x33')](_['pick'](_0x3a8b53[_0x1cb8('0x32')],_0x2a79e0[_0x1cb8('0x33')]),_0x3a6a67);if(_0x3a8b53['query'][_0x1cb8('0x3c')]){_0x4fda96[_0x1cb8('0x3b')]=_[_0x1cb8('0x3d')](_0x4fda96[_0x1cb8('0x3b')],{'$or':_[_0x1cb8('0x30')](_0x3a6a67,function(_0x5dc4c0){if(_0x5dc4c0[_0x1cb8('0x2d')]!==_0x1cb8('0x3e')){var _0x2989c6={};_0x2989c6[_0x5dc4c0['name']]={'$like':'%'+_0x3a8b53['query']['filter']+'%'};return _0x2989c6;}})});}_0x4fda96=_[_0x1cb8('0x3d')]({},_0x4fda96,_0x3a8b53[_0x1cb8('0x3f')]);var _0x328f7e={'where':_0x4fda96[_0x1cb8('0x3b')]};return db['Cdr']['count'](_0x328f7e)[_0x1cb8('0x24')](function(_0x25f0a3){_0x2ba8c8[_0x1cb8('0x1d')]=_0x25f0a3;if(_0x3a8b53[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x4fda96[_0x1cb8('0x41')]=[{'all':!![]}];}return db[_0x1cb8('0x2b')][_0x1cb8('0x42')](_0x4fda96);})['then'](function(_0x2044d1){_0x2ba8c8[_0x1cb8('0x43')]=_0x2044d1;return _0x2ba8c8;})[_0x1cb8('0x24')](respondWithFilteredResult(_0x21c17a,_0x4fda96))[_0x1cb8('0x44')](handleError(_0x21c17a,null));};exports['show']=function(_0x156298,_0x47c18a){var _0x2060a6={'raw':!![],'where':{'id':_0x156298['params']['id']}},_0x37230e={};_0x37230e[_0x1cb8('0x2f')]=_[_0x1cb8('0x31')](db[_0x1cb8('0x2b')]['rawAttributes']);_0x37230e['query']=_[_0x1cb8('0x31')](_0x156298['query']);_0x37230e[_0x1cb8('0x33')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],_0x37230e[_0x1cb8('0x32')]);_0x2060a6[_0x1cb8('0x35')]=_[_0x1cb8('0x34')](_0x37230e[_0x1cb8('0x2f')],qs['fields'](_0x156298[_0x1cb8('0x32')][_0x1cb8('0x36')]));_0x2060a6[_0x1cb8('0x35')]=_0x2060a6[_0x1cb8('0x35')]['length']?_0x2060a6[_0x1cb8('0x35')]:_0x37230e[_0x1cb8('0x2f')];if(_0x156298[_0x1cb8('0x32')][_0x1cb8('0x40')]){_0x2060a6[_0x1cb8('0x41')]=[{'all':!![]}];}_0x2060a6=_['merge']({},_0x2060a6,_0x156298[_0x1cb8('0x3f')]);return db[_0x1cb8('0x2b')][_0x1cb8('0x45')](_0x2060a6)[_0x1cb8('0x24')](handleEntityNotFound(_0x47c18a,null))[_0x1cb8('0x24')](respondWithResult(_0x47c18a,null))['catch'](handleError(_0x47c18a,null));};exports[_0x1cb8('0x46')]=function(_0x3a4ec4,_0x5598b1){return db[_0x1cb8('0x2b')][_0x1cb8('0x46')](_0x3a4ec4[_0x1cb8('0x47')],{})[_0x1cb8('0x24')](respondWithResult(_0x5598b1,0xc9))[_0x1cb8('0x44')](handleError(_0x5598b1,null));};exports[_0x1cb8('0x48')]=function(_0x3b063c,_0x219541){if(_0x3b063c[_0x1cb8('0x47')]['id']){delete _0x3b063c[_0x1cb8('0x47')]['id'];}return db[_0x1cb8('0x2b')][_0x1cb8('0x45')]({'where':{'id':_0x3b063c[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x219541,null))['then'](saveUpdates(_0x3b063c[_0x1cb8('0x47')],null))[_0x1cb8('0x24')](respondWithResult(_0x219541,null))[_0x1cb8('0x44')](handleError(_0x219541,null));};exports[_0x1cb8('0x25')]=function(_0x21aba7,_0x15f0ba){return db[_0x1cb8('0x2b')]['find']({'where':{'id':_0x21aba7[_0x1cb8('0x49')]['id']}})[_0x1cb8('0x24')](handleEntityNotFound(_0x15f0ba,null))[_0x1cb8('0x24')](removeEntity(_0x15f0ba,null))['catch'](handleError(_0x15f0ba,null));};exports['describe']=function(_0x1c12aa,_0x42cc81){return db[_0x1cb8('0x2b')][_0x1cb8('0x4a')]()[_0x1cb8('0x24')](respondWithResult(_0x42cc81,null))['catch'](handleError(_0x42cc81,null));}; \ No newline at end of file +var _0x25fa=['json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','Cdr','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x25fa,0x109));var _0xa25f=function(_0x43fd03,_0x4ae580){_0x43fd03=_0x43fd03-0x0;var _0x344f96=_0x25fa[_0x43fd03];return _0x344f96;};'use strict';var emlformat=require(_0xa25f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa25f('0x1'));var jsonpatch=require(_0xa25f('0x2'));var rp=require('request-promise');var moment=require(_0xa25f('0x3'));var BPromise=require(_0xa25f('0x4'));var Mustache=require(_0xa25f('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa25f('0x6'));var csv=require('to-csv');var ejs=require(_0xa25f('0x7'));var fs=require('fs');var fs_extra=require(_0xa25f('0x8'));var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0xe'));var querystring=require(_0xa25f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa25f('0x10'));var authService=require(_0xa25f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x12'));var hardwareService=require(_0xa25f('0x13'));var logger=require(_0xa25f('0x14'))(_0xa25f('0x15'));var utils=require('../../config/utils');var config=require(_0xa25f('0x16'));var licenseUtil=require(_0xa25f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e970c,_0x465e41){_0x465e41=_0x465e41||0xcc;return function(_0x50bb78){if(_0x50bb78){return _0x3e970c[_0xa25f('0x18')](_0x465e41);}return _0x3e970c[_0xa25f('0x19')](_0x465e41)[_0xa25f('0x1a')]();};}function respondWithResult(_0x4b3792,_0x199e18){_0x199e18=_0x199e18||0xc8;return function(_0x2a627f){if(_0x2a627f){return _0x4b3792[_0xa25f('0x19')](_0x199e18)[_0xa25f('0x1b')](_0x2a627f);}};}function respondWithFilteredResult(_0x465809,_0x2d2417){return function(_0x1e5836){if(_0x1e5836){var _0x1859ba=typeof _0x2d2417['offset']===_0xa25f('0x1c')&&typeof _0x2d2417[_0xa25f('0x1d')]===_0xa25f('0x1c');var _0x451a6e=_0x1e5836[_0xa25f('0x1e')];var _0x427105=_0x1859ba?0x0:_0x2d2417['offset'];var _0x292171=_0x1859ba?_0x1e5836['count']:_0x2d2417[_0xa25f('0x1f')]+_0x2d2417['limit'];var _0x559c89;if(_0x292171>=_0x451a6e){_0x292171=_0x451a6e;_0x559c89=0xc8;}else{_0x559c89=0xce;}_0x465809[_0xa25f('0x19')](_0x559c89);return _0x465809['set'](_0xa25f('0x20'),_0x427105+'-'+_0x292171+'/'+_0x451a6e)[_0xa25f('0x1b')](_0x1e5836);}return null;};}function patchUpdates(_0x2aaf3a){return function(_0x3c2665){try{jsonpatch[_0xa25f('0x21')](_0x3c2665,_0x2aaf3a,!![]);}catch(_0x504135){return BPromise[_0xa25f('0x22')](_0x504135);}return _0x3c2665[_0xa25f('0x23')]();};}function saveUpdates(_0x371716,_0x14b7f6){return function(_0x5d2803){if(_0x5d2803){return _0x5d2803[_0xa25f('0x24')](_0x371716)[_0xa25f('0x25')](function(_0x248c0c){return _0x248c0c;});}return null;};}function removeEntity(_0x3675b5,_0x4c6f4d){return function(_0x2b710f){if(_0x2b710f){return _0x2b710f[_0xa25f('0x26')]()[_0xa25f('0x25')](function(){_0x3675b5[_0xa25f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2812d7,_0x898446){return function(_0x53f011){if(!_0x53f011){_0x2812d7[_0xa25f('0x18')](0x194);}return _0x53f011;};}function handleError(_0x51dbf8,_0x2df893){_0x2df893=_0x2df893||0x1f4;return function(_0x4eb7b7){logger[_0xa25f('0x27')](_0x4eb7b7[_0xa25f('0x28')]);if(_0x4eb7b7['name']){delete _0x4eb7b7[_0xa25f('0x29')];}_0x51dbf8[_0xa25f('0x19')](_0x2df893)['send'](_0x4eb7b7);};}exports[_0xa25f('0x2a')]=function(_0x5d39c7,_0x1030c4){var _0x41a847={},_0x472114={},_0x208518={'count':0x0,'rows':[]};var _0x334629=_['map'](db[_0xa25f('0x2b')][_0xa25f('0x2c')],function(_0x119ffc){return{'name':_0x119ffc[_0xa25f('0x2d')],'type':_0x119ffc[_0xa25f('0x2e')]['key']};});_0x472114[_0xa25f('0x2f')]=_[_0xa25f('0x30')](_0x334629,_0xa25f('0x29'));_0x472114[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0x5d39c7[_0xa25f('0x31')]);_0x472114[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x472114[_0xa25f('0x2f')],_0x472114['query']);_0x41a847['attributes']=_['intersection'](_0x472114[_0xa25f('0x2f')],qs[_0xa25f('0x35')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x35')]));_0x41a847[_0xa25f('0x36')]=_0x41a847[_0xa25f('0x36')][_0xa25f('0x37')]?_0x41a847[_0xa25f('0x36')]:_0x472114[_0xa25f('0x2f')];if(!_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x38')]('nolimit')){_0x41a847['limit']=qs[_0xa25f('0x1d')](_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x1d')]);_0x41a847['offset']=qs['offset'](_0x5d39c7['query'][_0xa25f('0x1f')]);}_0x41a847[_0xa25f('0x39')]=qs[_0xa25f('0x3a')](_0x5d39c7['query']['sort']);_0x41a847[_0xa25f('0x3b')]=qs[_0xa25f('0x33')](_['pick'](_0x5d39c7['query'],_0x472114[_0xa25f('0x33')]),_0x334629);if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]){_0x41a847['where']=_[_0xa25f('0x3d')](_0x41a847[_0xa25f('0x3b')],{'$or':_[_0xa25f('0x30')](_0x334629,function(_0x49556e){if(_0x49556e['type']!==_0xa25f('0x3e')){var _0x44c9c8={};_0x44c9c8[_0x49556e[_0xa25f('0x29')]]={'$like':'%'+_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x3c')]+'%'};return _0x44c9c8;}})});}_0x41a847=_[_0xa25f('0x3d')]({},_0x41a847,_0x5d39c7[_0xa25f('0x3f')]);var _0x3382f4={'where':_0x41a847['where']};return db[_0xa25f('0x2b')][_0xa25f('0x1e')](_0x3382f4)[_0xa25f('0x25')](function(_0x2e886f){_0x208518[_0xa25f('0x1e')]=_0x2e886f;if(_0x5d39c7[_0xa25f('0x31')][_0xa25f('0x40')]){_0x41a847[_0xa25f('0x41')]=[{'all':!![]}];}return db[_0xa25f('0x2b')][_0xa25f('0x42')](_0x41a847);})[_0xa25f('0x25')](function(_0x3267a0){_0x208518[_0xa25f('0x43')]=_0x3267a0;return _0x208518;})['then'](respondWithFilteredResult(_0x1030c4,_0x41a847))[_0xa25f('0x44')](handleError(_0x1030c4,null));};exports['show']=function(_0xace015,_0x320119){var _0x36afe4={'raw':!![],'where':{'id':_0xace015[_0xa25f('0x45')]['id']}},_0x559874={};_0x559874[_0xa25f('0x2f')]=_[_0xa25f('0x32')](db[_0xa25f('0x2b')]['rawAttributes']);_0x559874[_0xa25f('0x31')]=_[_0xa25f('0x32')](_0xace015[_0xa25f('0x31')]);_0x559874[_0xa25f('0x33')]=_[_0xa25f('0x34')](_0x559874[_0xa25f('0x2f')],_0x559874['query']);_0x36afe4[_0xa25f('0x36')]=_[_0xa25f('0x34')](_0x559874['model'],qs[_0xa25f('0x35')](_0xace015[_0xa25f('0x31')][_0xa25f('0x35')]));_0x36afe4[_0xa25f('0x36')]=_0x36afe4[_0xa25f('0x36')][_0xa25f('0x37')]?_0x36afe4[_0xa25f('0x36')]:_0x559874[_0xa25f('0x2f')];if(_0xace015[_0xa25f('0x31')][_0xa25f('0x40')]){_0x36afe4[_0xa25f('0x41')]=[{'all':!![]}];}_0x36afe4=_[_0xa25f('0x3d')]({},_0x36afe4,_0xace015[_0xa25f('0x3f')]);return db['Cdr'][_0xa25f('0x46')](_0x36afe4)[_0xa25f('0x25')](handleEntityNotFound(_0x320119,null))[_0xa25f('0x25')](respondWithResult(_0x320119,null))[_0xa25f('0x44')](handleError(_0x320119,null));};exports['create']=function(_0x34717c,_0x43888b){return db[_0xa25f('0x2b')]['create'](_0x34717c[_0xa25f('0x47')],{})[_0xa25f('0x25')](respondWithResult(_0x43888b,0xc9))[_0xa25f('0x44')](handleError(_0x43888b,null));};exports[_0xa25f('0x24')]=function(_0x18c9f2,_0x3b6d34){if(_0x18c9f2[_0xa25f('0x47')]['id']){delete _0x18c9f2[_0xa25f('0x47')]['id'];}return db['Cdr'][_0xa25f('0x46')]({'where':{'id':_0x18c9f2[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0x3b6d34,null))[_0xa25f('0x25')](saveUpdates(_0x18c9f2[_0xa25f('0x47')],null))[_0xa25f('0x25')](respondWithResult(_0x3b6d34,null))[_0xa25f('0x44')](handleError(_0x3b6d34,null));};exports[_0xa25f('0x26')]=function(_0x26a096,_0xe04d67){return db[_0xa25f('0x2b')][_0xa25f('0x46')]({'where':{'id':_0x26a096[_0xa25f('0x45')]['id']}})[_0xa25f('0x25')](handleEntityNotFound(_0xe04d67,null))[_0xa25f('0x25')](removeEntity(_0xe04d67,null))[_0xa25f('0x44')](handleError(_0xe04d67,null));};exports[_0xa25f('0x48')]=function(_0x2fedba,_0x32f719){return db[_0xa25f('0x2b')][_0xa25f('0x48')]()[_0xa25f('0x25')](respondWithResult(_0x32f719,null))['catch'](handleError(_0x32f719,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2088f70..d50a8f9 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x3b734c,_0x2d2e5b){var _0x1de3b4=function(_0x40b992){while(--_0x40b992){_0x3b734c['push'](_0x3b734c['shift']());}};_0x1de3b4(++_0x2d2e5b);}(_0x7a54,0x106));var _0x47a5=function(_0x3218fc,_0x303e46){_0x3218fc=_0x3218fc-0x0;var _0x45b944=_0x7a54[_0x3218fc];return _0x45b944;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x4f4f85,_0x278a6b){var _0x118417=function(_0x19cd31){while(--_0x19cd31){_0x4f4f85['push'](_0x4f4f85['shift']());}};_0x118417(++_0x278a6b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 731ecd3..ca97f97 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 _0x5ecb=['code','message','info','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4d6eec,_0x5631c0){var _0x37f079=function(_0x2f9fc7){while(--_0x2f9fc7){_0x4d6eec['push'](_0x4d6eec['shift']());}};_0x37f079(++_0x5631c0);}(_0x5ecb,0x1e5));var _0xb5ec=function(_0x4953da,_0x5adaca){_0x4953da=_0x4953da-0x0;var _0x2d3780=_0x5ecb[_0x4953da];return _0x2d3780;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb5ec('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb5ec('0x1'));var db=require(_0xb5ec('0x2'))['db'];var utils=require(_0xb5ec('0x3'));var logger=require(_0xb5ec('0x4'))(_0xb5ec('0x5'));var config=require(_0xb5ec('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5163bf,_0x389d74,_0x165091){return new BPromise(function(_0x4c4143,_0x53588c){return client[_0xb5ec('0x7')](_0x5163bf,_0x165091)[_0xb5ec('0x8')](function(_0x2781a2){logger['info'](_0xb5ec('0x9'),_0x389d74,_0xb5ec('0xa'));logger[_0xb5ec('0xb')](_0xb5ec('0xc'),_0x389d74,'request\x20sent',JSON[_0xb5ec('0xd')](_0x2781a2));if(_0x2781a2[_0xb5ec('0xe')]){if(_0x2781a2[_0xb5ec('0xe')][_0xb5ec('0xf')]===0x1f4){logger[_0xb5ec('0xe')](_0xb5ec('0x9'),_0x389d74,_0x2781a2[_0xb5ec('0xe')][_0xb5ec('0x10')]);return _0x53588c(_0x2781a2['error'][_0xb5ec('0x10')]);}logger[_0xb5ec('0xe')](_0xb5ec('0x9'),_0x389d74,_0x2781a2[_0xb5ec('0xe')]['message']);return _0x4c4143(_0x2781a2[_0xb5ec('0xe')][_0xb5ec('0x10')]);}else{logger[_0xb5ec('0x11')](_0xb5ec('0x9'),_0x389d74,_0xb5ec('0xa'));_0x4c4143(_0x2781a2[_0xb5ec('0x12')][_0xb5ec('0x10')]);}})[_0xb5ec('0x13')](function(_0x26c565){logger[_0xb5ec('0xe')](_0xb5ec('0x9'),_0x389d74,_0x26c565);_0x53588c(_0x26c565);});});} \ No newline at end of file +var _0xf977=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util'];(function(_0x3f3d4a,_0x29db30){var _0x32e876=function(_0x815fdd){while(--_0x815fdd){_0x3f3d4a['push'](_0x3f3d4a['shift']());}};_0x32e876(++_0x29db30);}(_0xf977,0x82));var _0x7f97=function(_0x41d436,_0x2b97f2){_0x41d436=_0x41d436-0x0;var _0x19e918=_0xf977[_0x41d436];return _0x19e918;};'use strict';var _=require(_0x7f97('0x0'));var util=require(_0x7f97('0x1'));var moment=require(_0x7f97('0x2'));var BPromise=require(_0x7f97('0x3'));var rs=require(_0x7f97('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7f97('0x5'));var logger=require('../../config/logger')(_0x7f97('0x6'));var config=require(_0x7f97('0x7'));var jayson=require(_0x7f97('0x8'));var client=jayson[_0x7f97('0x9')][_0x7f97('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x542d00,_0x4c86ca,_0x48523d){return new BPromise(function(_0x3fdcaa,_0x56cde7){return client[_0x7f97('0xb')](_0x542d00,_0x48523d)[_0x7f97('0xc')](function(_0x583a76){logger[_0x7f97('0xd')](_0x7f97('0xe'),_0x4c86ca,_0x7f97('0xf'));logger['debug'](_0x7f97('0x10'),_0x4c86ca,'request\x20sent',JSON['stringify'](_0x583a76));if(_0x583a76[_0x7f97('0x11')]){if(_0x583a76[_0x7f97('0x11')][_0x7f97('0x12')]===0x1f4){logger[_0x7f97('0x11')]('Cdr,\x20%s,\x20%s',_0x4c86ca,_0x583a76[_0x7f97('0x11')][_0x7f97('0x13')]);return _0x56cde7(_0x583a76['error'][_0x7f97('0x13')]);}logger[_0x7f97('0x11')](_0x7f97('0xe'),_0x4c86ca,_0x583a76['error']['message']);return _0x3fdcaa(_0x583a76[_0x7f97('0x11')][_0x7f97('0x13')]);}else{logger[_0x7f97('0xd')]('Cdr,\x20%s,\x20%s',_0x4c86ca,_0x7f97('0xf'));_0x3fdcaa(_0x583a76[_0x7f97('0x14')][_0x7f97('0x13')]);}})[_0x7f97('0x15')](function(_0x5db77c){logger[_0x7f97('0x11')](_0x7f97('0xe'),_0x4c86ca,_0x5db77c);_0x56cde7(_0x5db77c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index d5263f5..b2d97b7 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(_0x57c4ff,_0x102e4e){var _0x21649c=function(_0x5a4fa9){while(--_0x5a4fa9){_0x57c4ff['push'](_0x57c4ff['shift']());}};_0x21649c(++_0x102e4e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cdr.controller','get','index','/describe','show','post'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 11e8bfa..8f45911 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 _0x5603=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x570fe8,_0x53a83f){var _0x5492c9=function(_0x2547e2){while(--_0x2547e2){_0x570fe8['push'](_0x570fe8['shift']());}};_0x5492c9(++_0x53a83f);}(_0x5603,0xec));var _0x3560=function(_0xdf7019,_0x35080c){_0xdf7019=_0xdf7019-0x0;var _0x50769f=_0x5603[_0xdf7019];return _0x50769f;};'use strict';var Sequelize=require(_0x3560('0x0'));module[_0x3560('0x1')]={'priority':{'type':Sequelize[_0x3560('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x3560('0x3')],'allowNull':![],'defaultValue':_0x3560('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x3560('0x3')]},'interval':{'type':Sequelize[_0x3560('0x3')],'defaultValue':_0x3560('0x5')}}; \ No newline at end of file +var _0xcd89=['INTEGER','STRING','TEXT','exports'];(function(_0x5fe7ce,_0x1a0d39){var _0x3b5793=function(_0x221d2a){while(--_0x221d2a){_0x5fe7ce['push'](_0x5fe7ce['shift']());}};_0x3b5793(++_0x1a0d39);}(_0xcd89,0x67));var _0x9cd8=function(_0x3567ca,_0x2e214f){_0x3567ca=_0x3567ca-0x0;var _0x47f8b1=_0xcd89[_0x3567ca];return _0x47f8b1;};'use strict';var Sequelize=require('sequelize');module[_0x9cd8('0x0')]={'priority':{'type':Sequelize[_0x9cd8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x9cd8('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x9cd8('0x3')]()},'description':{'type':Sequelize[_0x9cd8('0x2')]},'interval':{'type':Sequelize[_0x9cd8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ce74945..aecc6fa 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 _0xca2b=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','stack','name','send','show','model','ChatApplication','keys','filters','intersection','attributes','fields','query','length','includeAll','include','merge','find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xb1f27d,_0x4500f0){var _0x4d3503=function(_0x5d888b){while(--_0x5d888b){_0xb1f27d['push'](_0xb1f27d['shift']());}};_0x4d3503(++_0x4500f0);}(_0xca2b,0x156));var _0xbca2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xca2b[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xbca2('0x0'));var rimraf=require(_0xbca2('0x1'));var zipdir=require(_0xbca2('0x2'));var jsonpatch=require(_0xbca2('0x3'));var rp=require(_0xbca2('0x4'));var moment=require(_0xbca2('0x5'));var BPromise=require(_0xbca2('0x6'));var Mustache=require(_0xbca2('0x7'));var util=require('util');var path=require(_0xbca2('0x8'));var sox=require(_0xbca2('0x9'));var csv=require('to-csv');var ejs=require(_0xbca2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbca2('0xb'));var squel=require(_0xbca2('0xc'));var crypto=require(_0xbca2('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbca2('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbca2('0xf'));var authService=require(_0xbca2('0x10'));var qs=require(_0xbca2('0x11'));var as=require(_0xbca2('0x12'));var hardwareService=require(_0xbca2('0x13'));var logger=require(_0xbca2('0x14'))(_0xbca2('0x15'));var utils=require(_0xbca2('0x16'));var config=require(_0xbca2('0x17'));var licenseUtil=require(_0xbca2('0x18'));var db=require(_0xbca2('0x19'))['db'];function respondWithStatusCode(_0x9f02bf,_0x26bca0){_0x26bca0=_0x26bca0||0xcc;return function(_0x562689){if(_0x562689){return _0x9f02bf[_0xbca2('0x1a')](_0x26bca0);}return _0x9f02bf[_0xbca2('0x1b')](_0x26bca0)[_0xbca2('0x1c')]();};}function respondWithResult(_0xbf283,_0x1e84d5){_0x1e84d5=_0x1e84d5||0xc8;return function(_0x170913){if(_0x170913){return _0xbf283[_0xbca2('0x1b')](_0x1e84d5)[_0xbca2('0x1d')](_0x170913);}};}function respondWithFilteredResult(_0x124085,_0x5f2a39){return function(_0x4dadaf){if(_0x4dadaf){var _0x11e7c6=typeof _0x5f2a39[_0xbca2('0x1e')]==='undefined'&&typeof _0x5f2a39[_0xbca2('0x1f')]===_0xbca2('0x20');var _0x158361=_0x4dadaf['count'];var _0x390095=_0x11e7c6?0x0:_0x5f2a39[_0xbca2('0x1e')];var _0x298b00=_0x11e7c6?_0x4dadaf[_0xbca2('0x21')]:_0x5f2a39[_0xbca2('0x1e')]+_0x5f2a39['limit'];var _0x595030;if(_0x298b00>=_0x158361){_0x298b00=_0x158361;_0x595030=0xc8;}else{_0x595030=0xce;}_0x124085[_0xbca2('0x1b')](_0x595030);return _0x124085[_0xbca2('0x22')]('Content-Range',_0x390095+'-'+_0x298b00+'/'+_0x158361)[_0xbca2('0x1d')](_0x4dadaf);}return null;};}function patchUpdates(_0x109b44){return function(_0x434699){try{jsonpatch[_0xbca2('0x23')](_0x434699,_0x109b44,!![]);}catch(_0x3977eb){return BPromise[_0xbca2('0x24')](_0x3977eb);}return _0x434699['save']();};}function saveUpdates(_0x1dceb2,_0x20b65d){return function(_0x37c911){if(_0x37c911){return _0x37c911[_0xbca2('0x25')](_0x1dceb2)[_0xbca2('0x26')](function(_0x1155f9){return _0x1155f9;});}return null;};}function removeEntity(_0x1e0756,_0x204c89){return function(_0x8cdb5d){if(_0x8cdb5d){return _0x8cdb5d[_0xbca2('0x27')]()[_0xbca2('0x26')](function(){_0x1e0756[_0xbca2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x331260,_0x2b4d8b){return function(_0x3119dd){if(!_0x3119dd){_0x331260[_0xbca2('0x1a')](0x194);}return _0x3119dd;};}function handleError(_0x94f9de,_0x1be0e5){_0x1be0e5=_0x1be0e5||0x1f4;return function(_0x3cf9da){logger['error'](_0x3cf9da[_0xbca2('0x28')]);if(_0x3cf9da[_0xbca2('0x29')]){delete _0x3cf9da[_0xbca2('0x29')];}_0x94f9de[_0xbca2('0x1b')](_0x1be0e5)[_0xbca2('0x2a')](_0x3cf9da);};}exports[_0xbca2('0x2b')]=function(_0xc7d89f,_0x21d0f5){var _0x28e5c9={'raw':!![],'where':{'id':_0xc7d89f['params']['id']}},_0x89c900={};_0x89c900[_0xbca2('0x2c')]=_['keys'](db[_0xbca2('0x2d')]['rawAttributes']);_0x89c900['query']=_[_0xbca2('0x2e')](_0xc7d89f['query']);_0x89c900[_0xbca2('0x2f')]=_[_0xbca2('0x30')](_0x89c900['model'],_0x89c900['query']);_0x28e5c9[_0xbca2('0x31')]=_[_0xbca2('0x30')](_0x89c900[_0xbca2('0x2c')],qs[_0xbca2('0x32')](_0xc7d89f[_0xbca2('0x33')][_0xbca2('0x32')]));_0x28e5c9[_0xbca2('0x31')]=_0x28e5c9[_0xbca2('0x31')][_0xbca2('0x34')]?_0x28e5c9[_0xbca2('0x31')]:_0x89c900[_0xbca2('0x2c')];if(_0xc7d89f['query'][_0xbca2('0x35')]){_0x28e5c9[_0xbca2('0x36')]=[{'all':!![]}];}_0x28e5c9=_[_0xbca2('0x37')]({},_0x28e5c9,_0xc7d89f['options']);return db[_0xbca2('0x2d')][_0xbca2('0x38')](_0x28e5c9)[_0xbca2('0x26')](handleEntityNotFound(_0x21d0f5,null))[_0xbca2('0x26')](respondWithResult(_0x21d0f5,null))[_0xbca2('0x39')](handleError(_0x21d0f5,null));};exports[_0xbca2('0x25')]=function(_0x1e82a1,_0x45a237){if(_0x1e82a1[_0xbca2('0x3a')]['id']){delete _0x1e82a1[_0xbca2('0x3a')]['id'];}return db[_0xbca2('0x2d')]['find']({'where':{'id':_0x1e82a1['params']['id']}})[_0xbca2('0x26')](handleEntityNotFound(_0x45a237,null))[_0xbca2('0x26')](saveUpdates(_0x1e82a1[_0xbca2('0x3a')],null))[_0xbca2('0x26')](respondWithResult(_0x45a237,null))[_0xbca2('0x39')](handleError(_0x45a237,null));};exports['destroy']=function(_0x446ef6,_0x2af188){return db[_0xbca2('0x2d')][_0xbca2('0x38')]({'where':{'id':_0x446ef6[_0xbca2('0x3b')]['id']}})[_0xbca2('0x26')](handleEntityNotFound(_0x2af188,null))[_0xbca2('0x26')](removeEntity(_0x2af188,null))[_0xbca2('0x39')](handleError(_0x2af188,null));}; \ No newline at end of file +var _0x4fdc=['params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','show'];(function(_0x53049d,_0x25d2dd){var _0x10cdda=function(_0x2b8bea){while(--_0x2b8bea){_0x53049d['push'](_0x53049d['shift']());}};_0x10cdda(++_0x25d2dd);}(_0x4fdc,0x84));var _0xc4fd=function(_0x57a3a2,_0x456290){_0x57a3a2=_0x57a3a2-0x0;var _0x1bfe4d=_0x4fdc[_0x57a3a2];return _0x1bfe4d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4fd('0x1'));var rp=require(_0xc4fd('0x2'));var moment=require(_0xc4fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x4'));var util=require(_0xc4fd('0x5'));var path=require(_0xc4fd('0x6'));var sox=require(_0xc4fd('0x7'));var csv=require(_0xc4fd('0x8'));var ejs=require(_0xc4fd('0x9'));var fs=require('fs');var fs_extra=require(_0xc4fd('0xa'));var _=require('lodash');var squel=require(_0xc4fd('0xb'));var crypto=require(_0xc4fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4fd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4fd('0xe'));var Redis=require(_0xc4fd('0xf'));var authService=require(_0xc4fd('0x10'));var qs=require(_0xc4fd('0x11'));var as=require(_0xc4fd('0x12'));var hardwareService=require(_0xc4fd('0x13'));var logger=require(_0xc4fd('0x14'))(_0xc4fd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4fd('0x16'));var db=require(_0xc4fd('0x17'))['db'];function respondWithStatusCode(_0x25fc9a,_0x4cecec){_0x4cecec=_0x4cecec||0xcc;return function(_0x31d6c0){if(_0x31d6c0){return _0x25fc9a[_0xc4fd('0x18')](_0x4cecec);}return _0x25fc9a[_0xc4fd('0x19')](_0x4cecec)[_0xc4fd('0x1a')]();};}function respondWithResult(_0x4577a8,_0x29d08c){_0x29d08c=_0x29d08c||0xc8;return function(_0x1d67f0){if(_0x1d67f0){return _0x4577a8[_0xc4fd('0x19')](_0x29d08c)[_0xc4fd('0x1b')](_0x1d67f0);}};}function respondWithFilteredResult(_0x553121,_0x75a44f){return function(_0x4c96e5){if(_0x4c96e5){var _0x5a248c=typeof _0x75a44f[_0xc4fd('0x1c')]===_0xc4fd('0x1d')&&typeof _0x75a44f['limit']==='undefined';var _0x6c739e=_0x4c96e5[_0xc4fd('0x1e')];var _0x2bc246=_0x5a248c?0x0:_0x75a44f[_0xc4fd('0x1c')];var _0xaf6c46=_0x5a248c?_0x4c96e5[_0xc4fd('0x1e')]:_0x75a44f[_0xc4fd('0x1c')]+_0x75a44f['limit'];var _0x1e440f;if(_0xaf6c46>=_0x6c739e){_0xaf6c46=_0x6c739e;_0x1e440f=0xc8;}else{_0x1e440f=0xce;}_0x553121[_0xc4fd('0x19')](_0x1e440f);return _0x553121[_0xc4fd('0x1f')]('Content-Range',_0x2bc246+'-'+_0xaf6c46+'/'+_0x6c739e)['json'](_0x4c96e5);}return null;};}function patchUpdates(_0x1a21ef){return function(_0x254278){try{jsonpatch[_0xc4fd('0x20')](_0x254278,_0x1a21ef,!![]);}catch(_0x3f6fe3){return BPromise[_0xc4fd('0x21')](_0x3f6fe3);}return _0x254278[_0xc4fd('0x22')]();};}function saveUpdates(_0x5bcb6c,_0x5271f8){return function(_0x30900b){if(_0x30900b){return _0x30900b[_0xc4fd('0x23')](_0x5bcb6c)[_0xc4fd('0x24')](function(_0x2eba79){return _0x2eba79;});}return null;};}function removeEntity(_0x1b206b,_0x433eb4){return function(_0x3006ad){if(_0x3006ad){return _0x3006ad[_0xc4fd('0x25')]()[_0xc4fd('0x24')](function(){_0x1b206b['status'](0xcc)[_0xc4fd('0x1a')]();});}};}function handleEntityNotFound(_0x18b1a8,_0x2ce202){return function(_0x2c8831){if(!_0x2c8831){_0x18b1a8[_0xc4fd('0x18')](0x194);}return _0x2c8831;};}function handleError(_0xb6052a,_0x331f1){_0x331f1=_0x331f1||0x1f4;return function(_0x15022d){logger[_0xc4fd('0x26')](_0x15022d['stack']);if(_0x15022d['name']){delete _0x15022d[_0xc4fd('0x27')];}_0xb6052a[_0xc4fd('0x19')](_0x331f1)[_0xc4fd('0x28')](_0x15022d);};}exports[_0xc4fd('0x29')]=function(_0x38ac21,_0x23435e){var _0x546a39={'raw':!![],'where':{'id':_0x38ac21[_0xc4fd('0x2a')]['id']}},_0x15d61b={};_0x15d61b[_0xc4fd('0x2b')]=_[_0xc4fd('0x2c')](db[_0xc4fd('0x2d')][_0xc4fd('0x2e')]);_0x15d61b[_0xc4fd('0x2f')]=_[_0xc4fd('0x2c')](_0x38ac21['query']);_0x15d61b['filters']=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2b')],_0x15d61b[_0xc4fd('0x2f')]);_0x546a39[_0xc4fd('0x31')]=_['intersection'](_0x15d61b[_0xc4fd('0x2b')],qs['fields'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x546a39['attributes']=_0x546a39[_0xc4fd('0x31')][_0xc4fd('0x33')]?_0x546a39[_0xc4fd('0x31')]:_0x15d61b[_0xc4fd('0x2b')];if(_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x34')]){_0x546a39['include']=[{'all':!![]}];}_0x546a39=_[_0xc4fd('0x35')]({},_0x546a39,_0x38ac21[_0xc4fd('0x36')]);return db[_0xc4fd('0x2d')][_0xc4fd('0x37')](_0x546a39)[_0xc4fd('0x24')](handleEntityNotFound(_0x23435e,null))[_0xc4fd('0x24')](respondWithResult(_0x23435e,null))[_0xc4fd('0x38')](handleError(_0x23435e,null));};exports['update']=function(_0x258d35,_0x5875c6){if(_0x258d35['body']['id']){delete _0x258d35[_0xc4fd('0x39')]['id'];}return db['ChatApplication'][_0xc4fd('0x37')]({'where':{'id':_0x258d35[_0xc4fd('0x2a')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x5875c6,null))['then'](saveUpdates(_0x258d35[_0xc4fd('0x39')],null))[_0xc4fd('0x24')](respondWithResult(_0x5875c6,null))[_0xc4fd('0x38')](handleError(_0x5875c6,null));};exports[_0xc4fd('0x25')]=function(_0x59d19e,_0x3390f6){return db[_0xc4fd('0x2d')][_0xc4fd('0x37')]({'where':{'id':_0x59d19e[_0xc4fd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3390f6,null))[_0xc4fd('0x24')](removeEntity(_0x3390f6,null))[_0xc4fd('0x38')](handleError(_0x3390f6,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 5f842a5..216806c 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 _0x255f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x262e14,_0x24b9a2){var _0x581c93=function(_0xe0c50c){while(--_0xe0c50c){_0x262e14['push'](_0x262e14['shift']());}};_0x581c93(++_0x24b9a2);}(_0x255f,0x185));var _0xf255=function(_0x345e4c,_0x3e73ba){_0x345e4c=_0x345e4c-0x0;var _0x40c41c=_0x255f[_0x345e4c];return _0x40c41c;};'use strict';var _=require(_0xf255('0x0'));var util=require('util');var logger=require(_0xf255('0x1'))(_0xf255('0x2'));var moment=require(_0xf255('0x3'));var BPromise=require('bluebird');var rp=require(_0xf255('0x4'));var fs=require('fs');var path=require(_0xf255('0x5'));var rimraf=require(_0xf255('0x6'));var config=require(_0xf255('0x7'));var attributes=require(_0xf255('0x8'));module[_0xf255('0x9')]=function(_0xc1d19f,_0x5bbed0){return _0xc1d19f[_0xf255('0xa')]('ChatApplication',attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf255('0xb'),'collate':_0xf255('0xc')});}; \ No newline at end of file +var _0x5156=['utf8mb4','util','../../config/logger','../../config/environment','./chatApplication.attributes','exports','define','chat_applications'];(function(_0x2e821f,_0x49ba22){var _0x3e1348=function(_0x540a3f){while(--_0x540a3f){_0x2e821f['push'](_0x2e821f['shift']());}};_0x3e1348(++_0x49ba22);}(_0x5156,0xf1));var _0x6515=function(_0x41cdde,_0x4bd78c){_0x41cdde=_0x41cdde-0x0;var _0x2dec1e=_0x5156[_0x41cdde];return _0x2dec1e;};'use strict';var _=require('lodash');var util=require(_0x6515('0x0'));var logger=require(_0x6515('0x1'))('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('rimraf');var config=require(_0x6515('0x2'));var attributes=require(_0x6515('0x3'));module[_0x6515('0x4')]=function(_0x345565,_0x5b63ee){return _0x345565[_0x6515('0x5')]('ChatApplication',attributes,{'tableName':_0x6515('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6515('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0cd857c..99fb5b0 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 _0x998f=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x18b344,_0x271f68){var _0x5ef6bb=function(_0x3345b3){while(--_0x3345b3){_0x18b344['push'](_0x18b344['shift']());}};_0x5ef6bb(++_0x271f68);}(_0x998f,0x89));var _0xf998=function(_0x2b068e,_0x59da22){_0x2b068e=_0x2b068e-0x0;var _0x4bed64=_0x998f[_0x2b068e];return _0x4bed64;};'use strict';var _=require(_0xf998('0x0'));var util=require(_0xf998('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf998('0x2'));var fs=require('fs');var Redis=require(_0xf998('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf998('0x4'));var logger=require(_0xf998('0x5'))('rpc');var config=require(_0xf998('0x6'));var jayson=require(_0xf998('0x7'));var client=jayson['client'][_0xf998('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d14ca,_0x22c554,_0x2016ff){return new BPromise(function(_0x2b82ea,_0x2d9edf){return client[_0xf998('0x9')](_0x4d14ca,_0x2016ff)['then'](function(_0x40c918){logger[_0xf998('0xa')](_0xf998('0xb'),_0x22c554,_0xf998('0xc'));logger[_0xf998('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x22c554,'request\x20sent',JSON[_0xf998('0xe')](_0x40c918));if(_0x40c918['error']){if(_0x40c918[_0xf998('0xf')][_0xf998('0x10')]===0x1f4){logger['error']('ChatApplication,\x20%s,\x20%s',_0x22c554,_0x40c918['error']['message']);return _0x2d9edf(_0x40c918[_0xf998('0xf')]['message']);}logger[_0xf998('0xf')]('ChatApplication,\x20%s,\x20%s',_0x22c554,_0x40c918['error']['message']);return _0x2b82ea(_0x40c918[_0xf998('0xf')][_0xf998('0x11')]);}else{logger['info'](_0xf998('0xb'),_0x22c554,'request\x20sent');_0x2b82ea(_0x40c918[_0xf998('0x12')]['message']);}})[_0xf998('0x13')](function(_0x273bd6){logger[_0xf998('0xf')](_0xf998('0xb'),_0x22c554,_0x273bd6);_0x2d9edf(_0x273bd6);});});} \ No newline at end of file +var _0x6ee9=['client','http','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x6ee9,0x136));var _0x96ee=function(_0x1b0ec2,_0x54316a){_0x1b0ec2=_0x1b0ec2-0x0;var _0x172a60=_0x6ee9[_0x1b0ec2];return _0x172a60;};'use strict';var _=require('lodash');var util=require(_0x96ee('0x0'));var moment=require(_0x96ee('0x1'));var BPromise=require(_0x96ee('0x2'));var rs=require(_0x96ee('0x3'));var fs=require('fs');var Redis=require(_0x96ee('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x96ee('0x5'));var logger=require(_0x96ee('0x6'))(_0x96ee('0x7'));var config=require(_0x96ee('0x8'));var jayson=require(_0x96ee('0x9'));var client=jayson[_0x96ee('0xa')][_0x96ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a8afa,_0x19eeaf,_0x25e147){return new BPromise(function(_0x2d88e5,_0xdb372a){return client['request'](_0x1a8afa,_0x25e147)['then'](function(_0x2cb7d6){logger[_0x96ee('0xc')](_0x96ee('0xd'),_0x19eeaf,_0x96ee('0xe'));logger[_0x96ee('0xf')](_0x96ee('0x10'),_0x19eeaf,_0x96ee('0xe'),JSON['stringify'](_0x2cb7d6));if(_0x2cb7d6[_0x96ee('0x11')]){if(_0x2cb7d6[_0x96ee('0x11')]['code']===0x1f4){logger[_0x96ee('0x11')](_0x96ee('0xd'),_0x19eeaf,_0x2cb7d6[_0x96ee('0x11')][_0x96ee('0x12')]);return _0xdb372a(_0x2cb7d6[_0x96ee('0x11')]['message']);}logger[_0x96ee('0x11')](_0x96ee('0xd'),_0x19eeaf,_0x2cb7d6[_0x96ee('0x11')][_0x96ee('0x12')]);return _0x2d88e5(_0x2cb7d6[_0x96ee('0x11')][_0x96ee('0x12')]);}else{logger['info'](_0x96ee('0xd'),_0x19eeaf,_0x96ee('0xe'));_0x2d88e5(_0x2cb7d6[_0x96ee('0x13')][_0x96ee('0x12')]);}})['catch'](function(_0x1a64b9){logger['error'](_0x96ee('0xd'),_0x19eeaf,_0x1a64b9);_0xdb372a(_0x1a64b9);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index f6c1103..6ebb3ae 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 _0xd726=['../../components/interaction/service','/:id','show','put','isAuthenticated','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2ba015,_0x150788){var _0x3967ca=function(_0x44169c){while(--_0x44169c){_0x2ba015['push'](_0x2ba015['shift']());}};_0x3967ca(++_0x150788);}(_0xd726,0x1ca));var _0x6d72=function(_0x2663bf,_0x2e695b){_0x2663bf=_0x2663bf-0x0;var _0x5777f2=_0xd726[_0x2663bf];return _0x5777f2;};'use strict';var multer=require(_0x6d72('0x0'));var util=require(_0x6d72('0x1'));var path=require('path');var timeout=require(_0x6d72('0x2'));var express=require(_0x6d72('0x3'));var router=express[_0x6d72('0x4')]();var fs_extra=require(_0x6d72('0x5'));var auth=require(_0x6d72('0x6'));var interaction=require(_0x6d72('0x7'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x6d72('0x8'),auth['isAuthenticated'](),controller[_0x6d72('0x9')]);router[_0x6d72('0xa')](_0x6d72('0x8'),auth[_0x6d72('0xb')](),controller[_0x6d72('0xc')]);router[_0x6d72('0xd')](_0x6d72('0x8'),auth[_0x6d72('0xb')](),controller[_0x6d72('0xe')]);module['exports']=router; \ No newline at end of file +var _0x3a4e=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','destroy','exports','multer'];(function(_0x27fd6d,_0x5eba91){var _0x40c5a4=function(_0x5d651b){while(--_0x5d651b){_0x27fd6d['push'](_0x27fd6d['shift']());}};_0x40c5a4(++_0x5eba91);}(_0x3a4e,0xdf));var _0xe3a4=function(_0xee7879,_0x25c9bf){_0xee7879=_0xee7879-0x0;var _0x478649=_0x3a4e[_0xee7879];return _0x478649;};'use strict';var multer=require(_0xe3a4('0x0'));var util=require(_0xe3a4('0x1'));var path=require(_0xe3a4('0x2'));var timeout=require(_0xe3a4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe3a4('0x4'));var auth=require(_0xe3a4('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe3a4('0x6'));var controller=require(_0xe3a4('0x7'));router[_0xe3a4('0x8')](_0xe3a4('0x9'),auth[_0xe3a4('0xa')](),controller[_0xe3a4('0xb')]);router[_0xe3a4('0xc')](_0xe3a4('0x9'),auth[_0xe3a4('0xa')](),controller[_0xe3a4('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xe3a4('0xe')]);module[_0xe3a4('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 815d04c..b677c3b 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 _0x5f88=['STRING','BOOLEAN','sequelize'];(function(_0x5381b1,_0x33d42e){var _0x4ff573=function(_0x40203b){while(--_0x40203b){_0x5381b1['push'](_0x5381b1['shift']());}};_0x4ff573(++_0x33d42e);}(_0x5f88,0x1bb));var _0x85f8=function(_0x1758b0,_0xe80924){_0x1758b0=_0x1758b0-0x0;var _0x976f64=_0x5f88[_0x1758b0];return _0x976f64;};'use strict';var Sequelize=require(_0x85f8('0x0'));module['exports']={'name':{'type':Sequelize[_0x85f8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x85f8('0x1')]},'write':{'type':Sequelize[_0x85f8('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x2a8b=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2c6d19,_0x538dc2){var _0x1045d2=function(_0x25d839){while(--_0x25d839){_0x2c6d19['push'](_0x2c6d19['shift']());}};_0x1045d2(++_0x538dc2);}(_0x2a8b,0x10a));var _0xb2a8=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x2a8b[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0xb2a8('0x0'));module[_0xb2a8('0x1')]={'name':{'type':Sequelize[_0xb2a8('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xb2a8('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 199bd26..c3b767e 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 _0x593e=['create','body','update','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','stack','name','ChatGroup','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch'];(function(_0x29111e,_0x4bdea7){var _0x1f87cd=function(_0x9c94ac){while(--_0x9c94ac){_0x29111e['push'](_0x29111e['shift']());}};_0x1f87cd(++_0x4bdea7);}(_0x593e,0xd5));var _0xe593=function(_0x3d31ba,_0x4802af){_0x3d31ba=_0x3d31ba-0x0;var _0x35bcd4=_0x593e[_0x3d31ba];return _0x35bcd4;};'use strict';var emlformat=require(_0xe593('0x0'));var rimraf=require(_0xe593('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe593('0x2'));var rp=require(_0xe593('0x3'));var moment=require(_0xe593('0x4'));var BPromise=require(_0xe593('0x5'));var Mustache=require(_0xe593('0x6'));var util=require(_0xe593('0x7'));var path=require(_0xe593('0x8'));var sox=require('sox');var csv=require(_0xe593('0x9'));var ejs=require(_0xe593('0xa'));var fs=require('fs');var fs_extra=require(_0xe593('0xb'));var _=require(_0xe593('0xc'));var squel=require('squel');var crypto=require(_0xe593('0xd'));var jsforce=require(_0xe593('0xe'));var deskjs=require(_0xe593('0xf'));var toCsv=require(_0xe593('0x9'));var querystring=require(_0xe593('0x10'));var Papa=require(_0xe593('0x11'));var Redis=require(_0xe593('0x12'));var authService=require(_0xe593('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe593('0x14'));var utils=require(_0xe593('0x15'));var config=require(_0xe593('0x16'));var licenseUtil=require(_0xe593('0x17'));var db=require(_0xe593('0x18'))['db'];config[_0xe593('0x19')]=_[_0xe593('0x1a')](config[_0xe593('0x19')],{'host':_0xe593('0x1b'),'port':0x18eb});var socket=require(_0xe593('0x1c'))(new Redis(config[_0xe593('0x19')]));require('./chatGroup.socket')[_0xe593('0x1d')](socket);function respondWithStatusCode(_0x25c78b,_0x3a567f){_0x3a567f=_0x3a567f||0xcc;return function(_0x58a6f8){if(_0x58a6f8){return _0x25c78b[_0xe593('0x1e')](_0x3a567f);}return _0x25c78b['status'](_0x3a567f)[_0xe593('0x1f')]();};}function respondWithResult(_0x585f51,_0x34b6d9){_0x34b6d9=_0x34b6d9||0xc8;return function(_0x1aa2c7){if(_0x1aa2c7){return _0x585f51[_0xe593('0x20')](_0x34b6d9)[_0xe593('0x21')](_0x1aa2c7);}};}function respondWithFilteredResult(_0x468fa3,_0x1b9bce){return function(_0x1f967d){if(_0x1f967d){var _0x54b742=typeof _0x1b9bce[_0xe593('0x22')]===_0xe593('0x23')&&typeof _0x1b9bce[_0xe593('0x24')]===_0xe593('0x23');var _0x504cc4=_0x1f967d[_0xe593('0x25')];var _0x2ac486=_0x54b742?0x0:_0x1b9bce[_0xe593('0x22')];var _0x362e3c=_0x54b742?_0x1f967d[_0xe593('0x25')]:_0x1b9bce[_0xe593('0x22')]+_0x1b9bce[_0xe593('0x24')];var _0x1dac8c;if(_0x362e3c>=_0x504cc4){_0x362e3c=_0x504cc4;_0x1dac8c=0xc8;}else{_0x1dac8c=0xce;}_0x468fa3[_0xe593('0x20')](_0x1dac8c);return _0x468fa3['set'](_0xe593('0x26'),_0x2ac486+'-'+_0x362e3c+'/'+_0x504cc4)[_0xe593('0x21')](_0x1f967d);}return null;};}function patchUpdates(_0x31df86){return function(_0x4a1203){try{jsonpatch[_0xe593('0x27')](_0x4a1203,_0x31df86,!![]);}catch(_0x5d5521){return BPromise[_0xe593('0x28')](_0x5d5521);}return _0x4a1203[_0xe593('0x29')]();};}function saveUpdates(_0x3c8289,_0x46481a){return function(_0x4d3177){if(_0x4d3177){return _0x4d3177['update'](_0x3c8289)['then'](function(_0x5c5161){return _0x5c5161;});}return null;};}function removeEntity(_0x31e848,_0xd9c952){return function(_0x2befb9){if(_0x2befb9){return _0x2befb9[_0xe593('0x2a')]()[_0xe593('0x2b')](function(){_0x31e848['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1de89b,_0x29489f){return function(_0x498433){if(!_0x498433){_0x1de89b[_0xe593('0x1e')](0x194);}return _0x498433;};}function handleError(_0xadeeb9,_0x15beed){_0x15beed=_0x15beed||0x1f4;return function(_0x3f5e5f){logger['error'](_0x3f5e5f[_0xe593('0x2c')]);if(_0x3f5e5f['name']){delete _0x3f5e5f[_0xe593('0x2d')];}_0xadeeb9[_0xe593('0x20')](_0x15beed)['send'](_0x3f5e5f);};}exports['index']=function(_0x20491f,_0x2b43aa){var _0x218696={},_0x39b096={},_0x35c3a5={'count':0x0,'rows':[]};var _0x7246d0=_['map'](db[_0xe593('0x2e')][_0xe593('0x2f')],function(_0xaea795){return{'name':_0xaea795[_0xe593('0x30')],'type':_0xaea795[_0xe593('0x31')]['key']};});_0x39b096[_0xe593('0x32')]=_[_0xe593('0x33')](_0x7246d0,_0xe593('0x2d'));_0x39b096[_0xe593('0x34')]=_[_0xe593('0x35')](_0x20491f[_0xe593('0x34')]);_0x39b096['filters']=_['intersection'](_0x39b096['model'],_0x39b096['query']);_0x218696[_0xe593('0x36')]=_[_0xe593('0x37')](_0x39b096[_0xe593('0x32')],qs['fields'](_0x20491f[_0xe593('0x34')][_0xe593('0x38')]));_0x218696[_0xe593('0x36')]=_0x218696['attributes'][_0xe593('0x39')]?_0x218696[_0xe593('0x36')]:_0x39b096['model'];if(!_0x20491f[_0xe593('0x34')]['hasOwnProperty'](_0xe593('0x3a'))){_0x218696[_0xe593('0x24')]=qs[_0xe593('0x24')](_0x20491f[_0xe593('0x34')][_0xe593('0x24')]);_0x218696[_0xe593('0x22')]=qs['offset'](_0x20491f[_0xe593('0x34')][_0xe593('0x22')]);}_0x218696[_0xe593('0x3b')]=qs[_0xe593('0x3c')](_0x20491f[_0xe593('0x34')]['sort']);_0x218696[_0xe593('0x3d')]=qs[_0xe593('0x3e')](_['pick'](_0x20491f['query'],_0x39b096['filters']),_0x7246d0);if(_0x20491f['query'][_0xe593('0x3f')]){_0x218696[_0xe593('0x3d')]=_['merge'](_0x218696[_0xe593('0x3d')],{'$or':_[_0xe593('0x33')](_0x7246d0,function(_0x5029ab){if(_0x5029ab[_0xe593('0x31')]!==_0xe593('0x40')){var _0x5a2b4b={};_0x5a2b4b[_0x5029ab[_0xe593('0x2d')]]={'$like':'%'+_0x20491f[_0xe593('0x34')][_0xe593('0x3f')]+'%'};return _0x5a2b4b;}})});}_0x218696=_[_0xe593('0x41')]({},_0x218696,_0x20491f[_0xe593('0x42')]);var _0x54a2c5={'where':_0x218696[_0xe593('0x3d')]};return db[_0xe593('0x2e')][_0xe593('0x25')](_0x54a2c5)[_0xe593('0x2b')](function(_0x1937db){_0x35c3a5['count']=_0x1937db;if(_0x20491f[_0xe593('0x34')][_0xe593('0x43')]){_0x218696[_0xe593('0x44')]=[{'all':!![]}];}return db[_0xe593('0x2e')][_0xe593('0x45')](_0x218696);})[_0xe593('0x2b')](function(_0x21d19c){_0x35c3a5[_0xe593('0x46')]=_0x21d19c;return _0x35c3a5;})[_0xe593('0x2b')](respondWithFilteredResult(_0x2b43aa,_0x218696))['catch'](handleError(_0x2b43aa,null));};exports[_0xe593('0x47')]=function(_0x2e2770,_0x1e341a){var _0xd001da={'raw':!![],'where':{'id':_0x2e2770[_0xe593('0x48')]['id']}},_0x3b4061={};_0x3b4061['model']=_['keys'](db[_0xe593('0x2e')][_0xe593('0x2f')]);_0x3b4061[_0xe593('0x34')]=_[_0xe593('0x35')](_0x2e2770[_0xe593('0x34')]);_0x3b4061[_0xe593('0x3e')]=_[_0xe593('0x37')](_0x3b4061[_0xe593('0x32')],_0x3b4061['query']);_0xd001da[_0xe593('0x36')]=_['intersection'](_0x3b4061['model'],qs[_0xe593('0x38')](_0x2e2770[_0xe593('0x34')][_0xe593('0x38')]));_0xd001da[_0xe593('0x36')]=_0xd001da[_0xe593('0x36')]['length']?_0xd001da['attributes']:_0x3b4061['model'];if(_0x2e2770[_0xe593('0x34')]['includeAll']){_0xd001da[_0xe593('0x44')]=[{'all':!![]}];}_0xd001da=_[_0xe593('0x41')]({},_0xd001da,_0x2e2770['options']);return db[_0xe593('0x2e')][_0xe593('0x49')](_0xd001da)['then'](handleEntityNotFound(_0x1e341a,null))['then'](respondWithResult(_0x1e341a,null))[_0xe593('0x4a')](handleError(_0x1e341a,null));};exports[_0xe593('0x4b')]=function(_0x10dbbf,_0x16a6a9){return db[_0xe593('0x2e')][_0xe593('0x4b')](_0x10dbbf[_0xe593('0x4c')],{})[_0xe593('0x2b')](respondWithResult(_0x16a6a9,0xc9))[_0xe593('0x4a')](handleError(_0x16a6a9,null));};exports[_0xe593('0x4d')]=function(_0x65e2eb,_0x325b9d){if(_0x65e2eb['body']['id']){delete _0x65e2eb[_0xe593('0x4c')]['id'];}return db[_0xe593('0x2e')][_0xe593('0x49')]({'where':{'id':_0x65e2eb[_0xe593('0x48')]['id']}})['then'](handleEntityNotFound(_0x325b9d,null))[_0xe593('0x2b')](saveUpdates(_0x65e2eb[_0xe593('0x4c')],null))[_0xe593('0x2b')](respondWithResult(_0x325b9d,null))[_0xe593('0x4a')](handleError(_0x325b9d,null));};exports[_0xe593('0x2a')]=function(_0x4c6981,_0x58e412){return db[_0xe593('0x2e')]['find']({'where':{'id':_0x4c6981[_0xe593('0x48')]['id']}})[_0xe593('0x2b')](handleEntityNotFound(_0x58e412,null))[_0xe593('0x2b')](removeEntity(_0x58e412,null))[_0xe593('0x4a')](handleError(_0x58e412,null));};exports[_0xe593('0x4e')]=function(_0x5c4b92,_0x379561){return db[_0xe593('0x2e')][_0xe593('0x4e')]()['then'](respondWithResult(_0x379561,null))[_0xe593('0x4a')](handleError(_0x379561,null));};exports['getUnread']=function(_0xe06baf,_0x559930,_0x3777db){return db[_0xe593('0x4f')]['count']({'where':{'ChatGroupId':_0xe06baf[_0xe593('0x48')]['id'],'ToId':_0xe06baf[_0xe593('0x50')]['id'],'read':![]}})[_0xe593('0x2b')](function(_0x3f76dd){return{'id':_[_0xe593('0x51')](_0xe06baf['params']['id']),'count':_0x3f76dd};})[_0xe593('0x2b')](respondWithResult(_0x559930,null))[_0xe593('0x4a')](handleError(_0x559930,null));};exports[_0xe593('0x52')]=function(_0x33f1ee,_0x57604d,_0x9349a9){return db[_0xe593('0x2e')][_0xe593('0x49')]({'where':{'id':_0x33f1ee[_0xe593('0x48')]['id']}})['then'](handleEntityNotFound(_0x57604d,null))[_0xe593('0x2b')](function(_0x4d304c){if(_0x4d304c){return _0x4d304c[_0xe593('0x52')](_0x33f1ee[_0xe593('0x4c')][_0xe593('0x53')],_[_0xe593('0x54')](_0x33f1ee[_0xe593('0x4c')],[_0xe593('0x53'),'id'])||{});}})[_0xe593('0x2b')](respondWithResult(_0x57604d,null))[_0xe593('0x4a')](handleError(_0x57604d,null));};exports[_0xe593('0x55')]=function(_0x1b3170,_0x516dd9,_0x3c1cd0){var _0x372192={};var _0x40edf0={};var _0x509e5b;var _0x7359cf;return db[_0xe593('0x2e')][_0xe593('0x56')]({'where':{'id':_0x1b3170[_0xe593('0x48')]['id']}})[_0xe593('0x2b')](handleEntityNotFound(_0x516dd9,null))[_0xe593('0x2b')](function(_0x2d576d){if(_0x2d576d){_0x509e5b=_0x2d576d;_0x40edf0[_0xe593('0x32')]=_[_0xe593('0x35')](db[_0xe593('0x57')][_0xe593('0x2f')]);_0x40edf0[_0xe593('0x34')]=_[_0xe593('0x35')](_0x1b3170[_0xe593('0x34')]);_0x40edf0['filters']=_[_0xe593('0x37')](_0x40edf0['model'],_0x40edf0['query']);_0x372192[_0xe593('0x36')]=_['intersection'](_0x40edf0['model'],qs[_0xe593('0x38')](_0x1b3170[_0xe593('0x34')][_0xe593('0x38')]));_0x372192[_0xe593('0x36')]=_0x372192['attributes']['length']?_0x372192[_0xe593('0x36')]:_0x40edf0[_0xe593('0x32')];_0x372192[_0xe593('0x3b')]=qs[_0xe593('0x3c')](_0x1b3170[_0xe593('0x34')][_0xe593('0x3c')]);_0x372192[_0xe593('0x3d')]=qs[_0xe593('0x3e')](_['pick'](_0x1b3170[_0xe593('0x34')],_0x40edf0[_0xe593('0x3e')]));if(_0x1b3170[_0xe593('0x34')][_0xe593('0x3f')]){_0x372192[_0xe593('0x3d')]=_[_0xe593('0x41')](_0x372192[_0xe593('0x3d')],{'$or':_['map'](_0x372192[_0xe593('0x36')],function(_0x4162fb){var _0x35562b={};_0x35562b[_0x4162fb]={'$like':'%'+_0x1b3170['query']['filter']+'%'};return _0x35562b;})});}_0x372192=_[_0xe593('0x41')]({},_0x372192,_0x1b3170[_0xe593('0x42')]);return _0x509e5b[_0xe593('0x55')](_0x372192);}})[_0xe593('0x2b')](function(_0x18eceb){if(_0x18eceb){_0x7359cf=_0x18eceb[_0xe593('0x39')];if(!_0x1b3170[_0xe593('0x34')]['hasOwnProperty'](_0xe593('0x3a'))){_0x372192[_0xe593('0x24')]=qs['limit'](_0x1b3170['query']['limit']);_0x372192[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x1b3170[_0xe593('0x34')][_0xe593('0x22')]);}return _0x509e5b[_0xe593('0x55')](_0x372192);}})[_0xe593('0x2b')](function(_0x4810ee){if(_0x4810ee){return _0x4810ee?{'count':_0x7359cf,'rows':_0x4810ee}:null;}})[_0xe593('0x2b')](respondWithResult(_0x516dd9,null))[_0xe593('0x4a')](handleError(_0x516dd9,null));};exports[_0xe593('0x58')]=function(_0x591d36,_0xea5fc8,_0x546e3c){return db[_0xe593('0x2e')]['find']({'where':{'id':_0x591d36['params']['id']}})[_0xe593('0x2b')](handleEntityNotFound(_0xea5fc8,null))[_0xe593('0x2b')](function(_0x42b165){if(_0x42b165){return _0x42b165[_0xe593('0x58')](_0x591d36[_0xe593('0x34')]['ids']);}})[_0xe593('0x2b')](respondWithStatusCode(_0xea5fc8,null))[_0xe593('0x4a')](handleError(_0xea5fc8,null));};exports['addMessage']=function(_0x114e82,_0x1d0e30,_0x3cce51){if(_0x114e82[_0xe593('0x4c')]['id']){delete _0x114e82[_0xe593('0x4c')]['id'];}return db[_0xe593('0x2e')]['find']({'where':{'id':_0x114e82['params']['id']}})[_0xe593('0x2b')](handleEntityNotFound(_0x1d0e30,null))['then'](function(_0x1810e2){if(_0x1810e2){_0x114e82[_0xe593('0x4c')][_0xe593('0x59')]=_0x1810e2['id'];return db[_0xe593('0x4f')][_0xe593('0x4b')](_0x114e82[_0xe593('0x4c')]);}})['then'](respondWithResult(_0x1d0e30,null))[_0xe593('0x4a')](handleError(_0x1d0e30,null));};exports['getMessages']=function(_0x1d71ce,_0x4411f7,_0x342057){var _0x2dcb8e={};var _0x49e730={};var _0x175353;var _0x46f475;return db['ChatGroup'][_0xe593('0x56')]({'where':{'id':_0x1d71ce[_0xe593('0x48')]['id']}})[_0xe593('0x2b')](handleEntityNotFound(_0x4411f7,null))[_0xe593('0x2b')](function(_0x3bade3){if(_0x3bade3){_0x175353=_0x3bade3;_0x49e730[_0xe593('0x32')]=_[_0xe593('0x35')](db['ChatInternalMessage'][_0xe593('0x2f')]);_0x49e730[_0xe593('0x34')]=_[_0xe593('0x35')](_0x1d71ce[_0xe593('0x34')]);_0x49e730[_0xe593('0x3e')]=_[_0xe593('0x37')](_0x49e730[_0xe593('0x32')],_0x49e730[_0xe593('0x34')]);_0x2dcb8e[_0xe593('0x36')]=_['intersection'](_0x49e730['model'],qs['fields'](_0x1d71ce[_0xe593('0x34')][_0xe593('0x38')]));_0x2dcb8e['attributes']=_0x2dcb8e['attributes'][_0xe593('0x39')]?_0x2dcb8e['attributes']:_0x49e730['model'];_0x2dcb8e['order']=qs['sort'](_0x1d71ce[_0xe593('0x34')][_0xe593('0x3c')]);_0x2dcb8e[_0xe593('0x3d')]=qs['filters'](_['pick'](_0x1d71ce[_0xe593('0x34')],_0x49e730['filters']));if(_0x1d71ce[_0xe593('0x34')][_0xe593('0x3f')]){_0x2dcb8e[_0xe593('0x3d')]=_[_0xe593('0x41')](_0x2dcb8e[_0xe593('0x3d')],{'$or':_[_0xe593('0x33')](_0x2dcb8e[_0xe593('0x36')],function(_0x149232){var _0x5f0b17={};_0x5f0b17[_0x149232]={'$like':'%'+_0x1d71ce['query'][_0xe593('0x3f')]+'%'};return _0x5f0b17;})});}if(_0x1d71ce['query'][_0xe593('0x5a')]){var _0x1dff05=_0x1d71ce[_0xe593('0x34')][_0xe593('0x5a')][_0xe593('0x5b')](',');var _0x4f64f9={};_0x4f64f9[_0x1dff05[0x0]]={'$gte':moment(_0x1dff05[0x1])[_0xe593('0x5c')](_0xe593('0x5d'))};_0x2dcb8e['where']=_['merge'](_0x2dcb8e[_0xe593('0x3d')],_0x4f64f9);}_0x2dcb8e=_['merge']({},_0x2dcb8e,_0x1d71ce[_0xe593('0x42')]);return _0x175353[_0xe593('0x5e')](_0x2dcb8e);}})[_0xe593('0x2b')](function(_0x316d30){if(_0x316d30){_0x46f475=_0x316d30[_0xe593('0x39')];if(!_0x1d71ce[_0xe593('0x34')][_0xe593('0x5f')](_0xe593('0x3a'))){_0x2dcb8e[_0xe593('0x24')]=qs[_0xe593('0x24')](_0x1d71ce['query']['limit']);_0x2dcb8e[_0xe593('0x22')]=qs[_0xe593('0x22')](_0x1d71ce[_0xe593('0x34')][_0xe593('0x22')]);}return _0x175353[_0xe593('0x5e')](_0x2dcb8e);}})[_0xe593('0x2b')](function(_0x139f68){if(_0x139f68){return _0x139f68?{'count':_0x46f475,'rows':_0x139f68}:null;}})[_0xe593('0x2b')](respondWithResult(_0x4411f7,null))[_0xe593('0x4a')](handleError(_0x4411f7,null));}; \ No newline at end of file +var _0x0afa=['ids','omit','getMembers','findOne','order','removeMembers','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','socket.io-emitter','./chatGroup.socket','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','error','stack','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','name','keys','filters','intersection','attributes','query','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','show','create','body','catch','find','params','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers'];(function(_0x5aae33,_0x13c33a){var _0x2bddf4=function(_0x5c3ffd){while(--_0x5c3ffd){_0x5aae33['push'](_0x5aae33['shift']());}};_0x2bddf4(++_0x13c33a);}(_0x0afa,0x141));var _0xa0af=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x0afa[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xa0af('0x0'));var rimraf=require(_0xa0af('0x1'));var zipdir=require(_0xa0af('0x2'));var jsonpatch=require(_0xa0af('0x3'));var rp=require(_0xa0af('0x4'));var moment=require('moment');var BPromise=require(_0xa0af('0x5'));var Mustache=require(_0xa0af('0x6'));var util=require(_0xa0af('0x7'));var path=require(_0xa0af('0x8'));var sox=require(_0xa0af('0x9'));var csv=require(_0xa0af('0xa'));var ejs=require(_0xa0af('0xb'));var fs=require('fs');var fs_extra=require(_0xa0af('0xc'));var _=require(_0xa0af('0xd'));var squel=require(_0xa0af('0xe'));var crypto=require(_0xa0af('0xf'));var jsforce=require(_0xa0af('0x10'));var deskjs=require(_0xa0af('0x11'));var toCsv=require(_0xa0af('0xa'));var querystring=require(_0xa0af('0x12'));var Papa=require(_0xa0af('0x13'));var Redis=require(_0xa0af('0x14'));var authService=require(_0xa0af('0x15'));var qs=require(_0xa0af('0x16'));var as=require(_0xa0af('0x17'));var hardwareService=require(_0xa0af('0x18'));var logger=require(_0xa0af('0x19'))(_0xa0af('0x1a'));var utils=require(_0xa0af('0x1b'));var config=require(_0xa0af('0x1c'));var licenseUtil=require(_0xa0af('0x1d'));var db=require(_0xa0af('0x1e'))['db'];config[_0xa0af('0x1f')]=_[_0xa0af('0x20')](config[_0xa0af('0x1f')],{'host':'localhost','port':0x18eb});var socket=require(_0xa0af('0x21'))(new Redis(config[_0xa0af('0x1f')]));require(_0xa0af('0x22'))['register'](socket);function respondWithStatusCode(_0x976dd0,_0x3416d0){_0x3416d0=_0x3416d0||0xcc;return function(_0xda07e6){if(_0xda07e6){return _0x976dd0[_0xa0af('0x23')](_0x3416d0);}return _0x976dd0[_0xa0af('0x24')](_0x3416d0)[_0xa0af('0x25')]();};}function respondWithResult(_0x16c190,_0x48c020){_0x48c020=_0x48c020||0xc8;return function(_0xe8d724){if(_0xe8d724){return _0x16c190['status'](_0x48c020)['json'](_0xe8d724);}};}function respondWithFilteredResult(_0x53a3fd,_0x1c3b9b){return function(_0x26bcb8){if(_0x26bcb8){var _0x335781=typeof _0x1c3b9b[_0xa0af('0x26')]===_0xa0af('0x27')&&typeof _0x1c3b9b[_0xa0af('0x28')]==='undefined';var _0x2ead35=_0x26bcb8[_0xa0af('0x29')];var _0x425354=_0x335781?0x0:_0x1c3b9b[_0xa0af('0x26')];var _0x1a0d9b=_0x335781?_0x26bcb8[_0xa0af('0x29')]:_0x1c3b9b[_0xa0af('0x26')]+_0x1c3b9b[_0xa0af('0x28')];var _0x31f3fb;if(_0x1a0d9b>=_0x2ead35){_0x1a0d9b=_0x2ead35;_0x31f3fb=0xc8;}else{_0x31f3fb=0xce;}_0x53a3fd[_0xa0af('0x24')](_0x31f3fb);return _0x53a3fd['set']('Content-Range',_0x425354+'-'+_0x1a0d9b+'/'+_0x2ead35)[_0xa0af('0x2a')](_0x26bcb8);}return null;};}function patchUpdates(_0x4b9acc){return function(_0x172e8b){try{jsonpatch[_0xa0af('0x2b')](_0x172e8b,_0x4b9acc,!![]);}catch(_0x55855b){return BPromise[_0xa0af('0x2c')](_0x55855b);}return _0x172e8b[_0xa0af('0x2d')]();};}function saveUpdates(_0x536397,_0x49d381){return function(_0x534a2e){if(_0x534a2e){return _0x534a2e[_0xa0af('0x2e')](_0x536397)['then'](function(_0x3731d5){return _0x3731d5;});}return null;};}function removeEntity(_0x2f6708,_0x3ce3a8){return function(_0x5127d1){if(_0x5127d1){return _0x5127d1['destroy']()[_0xa0af('0x2f')](function(){_0x2f6708['status'](0xcc)[_0xa0af('0x25')]();});}};}function handleEntityNotFound(_0x1d92e7,_0x399aea){return function(_0x56ba29){if(!_0x56ba29){_0x1d92e7[_0xa0af('0x23')](0x194);}return _0x56ba29;};}function handleError(_0x182f27,_0x181b67){_0x181b67=_0x181b67||0x1f4;return function(_0x5997fe){logger[_0xa0af('0x30')](_0x5997fe[_0xa0af('0x31')]);if(_0x5997fe['name']){delete _0x5997fe['name'];}_0x182f27[_0xa0af('0x24')](_0x181b67)[_0xa0af('0x32')](_0x5997fe);};}exports[_0xa0af('0x33')]=function(_0x1208e7,_0x455210){var _0x2cc67e={},_0x51ff7c={},_0x74bbbc={'count':0x0,'rows':[]};var _0x5d072b=_[_0xa0af('0x34')](db[_0xa0af('0x35')][_0xa0af('0x36')],function(_0x8aa8e){return{'name':_0x8aa8e[_0xa0af('0x37')],'type':_0x8aa8e[_0xa0af('0x38')][_0xa0af('0x39')]};});_0x51ff7c[_0xa0af('0x3a')]=_['map'](_0x5d072b,_0xa0af('0x3b'));_0x51ff7c['query']=_[_0xa0af('0x3c')](_0x1208e7['query']);_0x51ff7c[_0xa0af('0x3d')]=_[_0xa0af('0x3e')](_0x51ff7c[_0xa0af('0x3a')],_0x51ff7c['query']);_0x2cc67e[_0xa0af('0x3f')]=_[_0xa0af('0x3e')](_0x51ff7c[_0xa0af('0x3a')],qs['fields'](_0x1208e7[_0xa0af('0x40')][_0xa0af('0x41')]));_0x2cc67e[_0xa0af('0x3f')]=_0x2cc67e['attributes'][_0xa0af('0x42')]?_0x2cc67e['attributes']:_0x51ff7c[_0xa0af('0x3a')];if(!_0x1208e7[_0xa0af('0x40')][_0xa0af('0x43')](_0xa0af('0x44'))){_0x2cc67e[_0xa0af('0x28')]=qs['limit'](_0x1208e7[_0xa0af('0x40')]['limit']);_0x2cc67e[_0xa0af('0x26')]=qs[_0xa0af('0x26')](_0x1208e7[_0xa0af('0x40')][_0xa0af('0x26')]);}_0x2cc67e['order']=qs[_0xa0af('0x45')](_0x1208e7[_0xa0af('0x40')][_0xa0af('0x45')]);_0x2cc67e[_0xa0af('0x46')]=qs[_0xa0af('0x3d')](_[_0xa0af('0x47')](_0x1208e7[_0xa0af('0x40')],_0x51ff7c[_0xa0af('0x3d')]),_0x5d072b);if(_0x1208e7[_0xa0af('0x40')][_0xa0af('0x48')]){_0x2cc67e[_0xa0af('0x46')]=_['merge'](_0x2cc67e[_0xa0af('0x46')],{'$or':_[_0xa0af('0x34')](_0x5d072b,function(_0xc9bd1c){if(_0xc9bd1c[_0xa0af('0x38')]!==_0xa0af('0x49')){var _0x242a2b={};_0x242a2b[_0xc9bd1c['name']]={'$like':'%'+_0x1208e7[_0xa0af('0x40')][_0xa0af('0x48')]+'%'};return _0x242a2b;}})});}_0x2cc67e=_[_0xa0af('0x4a')]({},_0x2cc67e,_0x1208e7[_0xa0af('0x4b')]);var _0xbcd206={'where':_0x2cc67e['where']};return db[_0xa0af('0x35')]['count'](_0xbcd206)[_0xa0af('0x2f')](function(_0x13cb00){_0x74bbbc[_0xa0af('0x29')]=_0x13cb00;if(_0x1208e7[_0xa0af('0x40')][_0xa0af('0x4c')]){_0x2cc67e['include']=[{'all':!![]}];}return db[_0xa0af('0x35')][_0xa0af('0x4d')](_0x2cc67e);})[_0xa0af('0x2f')](function(_0x5a99c1){_0x74bbbc[_0xa0af('0x4e')]=_0x5a99c1;return _0x74bbbc;})['then'](respondWithFilteredResult(_0x455210,_0x2cc67e))['catch'](handleError(_0x455210,null));};exports[_0xa0af('0x4f')]=function(_0x4356b5,_0x2d22c6){var _0x5ca4c9={'raw':!![],'where':{'id':_0x4356b5['params']['id']}},_0x42d64a={};_0x42d64a['model']=_[_0xa0af('0x3c')](db[_0xa0af('0x35')][_0xa0af('0x36')]);_0x42d64a[_0xa0af('0x40')]=_['keys'](_0x4356b5[_0xa0af('0x40')]);_0x42d64a[_0xa0af('0x3d')]=_['intersection'](_0x42d64a[_0xa0af('0x3a')],_0x42d64a[_0xa0af('0x40')]);_0x5ca4c9[_0xa0af('0x3f')]=_[_0xa0af('0x3e')](_0x42d64a[_0xa0af('0x3a')],qs[_0xa0af('0x41')](_0x4356b5[_0xa0af('0x40')][_0xa0af('0x41')]));_0x5ca4c9['attributes']=_0x5ca4c9[_0xa0af('0x3f')][_0xa0af('0x42')]?_0x5ca4c9[_0xa0af('0x3f')]:_0x42d64a[_0xa0af('0x3a')];if(_0x4356b5[_0xa0af('0x40')]['includeAll']){_0x5ca4c9['include']=[{'all':!![]}];}_0x5ca4c9=_[_0xa0af('0x4a')]({},_0x5ca4c9,_0x4356b5[_0xa0af('0x4b')]);return db['ChatGroup']['find'](_0x5ca4c9)[_0xa0af('0x2f')](handleEntityNotFound(_0x2d22c6,null))['then'](respondWithResult(_0x2d22c6,null))['catch'](handleError(_0x2d22c6,null));};exports['create']=function(_0x2d6f86,_0x1da7f1){return db[_0xa0af('0x35')][_0xa0af('0x50')](_0x2d6f86[_0xa0af('0x51')],{})[_0xa0af('0x2f')](respondWithResult(_0x1da7f1,0xc9))[_0xa0af('0x52')](handleError(_0x1da7f1,null));};exports[_0xa0af('0x2e')]=function(_0x337950,_0x4cb6cc){if(_0x337950[_0xa0af('0x51')]['id']){delete _0x337950[_0xa0af('0x51')]['id'];}return db[_0xa0af('0x35')][_0xa0af('0x53')]({'where':{'id':_0x337950[_0xa0af('0x54')]['id']}})[_0xa0af('0x2f')](handleEntityNotFound(_0x4cb6cc,null))[_0xa0af('0x2f')](saveUpdates(_0x337950['body'],null))[_0xa0af('0x2f')](respondWithResult(_0x4cb6cc,null))['catch'](handleError(_0x4cb6cc,null));};exports['destroy']=function(_0x5b1611,_0x14d274){return db['ChatGroup'][_0xa0af('0x53')]({'where':{'id':_0x5b1611[_0xa0af('0x54')]['id']}})['then'](handleEntityNotFound(_0x14d274,null))[_0xa0af('0x2f')](removeEntity(_0x14d274,null))[_0xa0af('0x52')](handleError(_0x14d274,null));};exports[_0xa0af('0x55')]=function(_0x3071bf,_0x3a90f2){return db['ChatGroup'][_0xa0af('0x55')]()[_0xa0af('0x2f')](respondWithResult(_0x3a90f2,null))['catch'](handleError(_0x3a90f2,null));};exports[_0xa0af('0x56')]=function(_0x7325c2,_0x48c86c,_0x8c1860){return db[_0xa0af('0x57')]['count']({'where':{'ChatGroupId':_0x7325c2[_0xa0af('0x54')]['id'],'ToId':_0x7325c2[_0xa0af('0x58')]['id'],'read':![]}})[_0xa0af('0x2f')](function(_0x12e78d){return{'id':_[_0xa0af('0x59')](_0x7325c2['params']['id']),'count':_0x12e78d};})[_0xa0af('0x2f')](respondWithResult(_0x48c86c,null))[_0xa0af('0x52')](handleError(_0x48c86c,null));};exports[_0xa0af('0x5a')]=function(_0xc87cd9,_0x140f40,_0x7cb869){return db[_0xa0af('0x35')][_0xa0af('0x53')]({'where':{'id':_0xc87cd9[_0xa0af('0x54')]['id']}})[_0xa0af('0x2f')](handleEntityNotFound(_0x140f40,null))['then'](function(_0x37ba4c){if(_0x37ba4c){return _0x37ba4c['addMembers'](_0xc87cd9['body'][_0xa0af('0x5b')],_[_0xa0af('0x5c')](_0xc87cd9[_0xa0af('0x51')],[_0xa0af('0x5b'),'id'])||{});}})[_0xa0af('0x2f')](respondWithResult(_0x140f40,null))[_0xa0af('0x52')](handleError(_0x140f40,null));};exports[_0xa0af('0x5d')]=function(_0xcf0f17,_0x56bc62,_0x57dae8){var _0x1fcce6={};var _0x404806={};var _0x48bfa0;var _0x102c39;return db[_0xa0af('0x35')][_0xa0af('0x5e')]({'where':{'id':_0xcf0f17['params']['id']}})[_0xa0af('0x2f')](handleEntityNotFound(_0x56bc62,null))[_0xa0af('0x2f')](function(_0x247552){if(_0x247552){_0x48bfa0=_0x247552;_0x404806[_0xa0af('0x3a')]=_[_0xa0af('0x3c')](db['User'][_0xa0af('0x36')]);_0x404806[_0xa0af('0x40')]=_['keys'](_0xcf0f17[_0xa0af('0x40')]);_0x404806[_0xa0af('0x3d')]=_['intersection'](_0x404806[_0xa0af('0x3a')],_0x404806[_0xa0af('0x40')]);_0x1fcce6['attributes']=_[_0xa0af('0x3e')](_0x404806[_0xa0af('0x3a')],qs[_0xa0af('0x41')](_0xcf0f17[_0xa0af('0x40')][_0xa0af('0x41')]));_0x1fcce6[_0xa0af('0x3f')]=_0x1fcce6[_0xa0af('0x3f')][_0xa0af('0x42')]?_0x1fcce6[_0xa0af('0x3f')]:_0x404806[_0xa0af('0x3a')];_0x1fcce6[_0xa0af('0x5f')]=qs[_0xa0af('0x45')](_0xcf0f17[_0xa0af('0x40')][_0xa0af('0x45')]);_0x1fcce6[_0xa0af('0x46')]=qs[_0xa0af('0x3d')](_[_0xa0af('0x47')](_0xcf0f17[_0xa0af('0x40')],_0x404806[_0xa0af('0x3d')]));if(_0xcf0f17[_0xa0af('0x40')]['filter']){_0x1fcce6[_0xa0af('0x46')]=_['merge'](_0x1fcce6[_0xa0af('0x46')],{'$or':_[_0xa0af('0x34')](_0x1fcce6[_0xa0af('0x3f')],function(_0x1a7b7d){var _0x3ded5e={};_0x3ded5e[_0x1a7b7d]={'$like':'%'+_0xcf0f17[_0xa0af('0x40')][_0xa0af('0x48')]+'%'};return _0x3ded5e;})});}_0x1fcce6=_[_0xa0af('0x4a')]({},_0x1fcce6,_0xcf0f17[_0xa0af('0x4b')]);return _0x48bfa0[_0xa0af('0x5d')](_0x1fcce6);}})[_0xa0af('0x2f')](function(_0x49b550){if(_0x49b550){_0x102c39=_0x49b550[_0xa0af('0x42')];if(!_0xcf0f17[_0xa0af('0x40')][_0xa0af('0x43')]('nolimit')){_0x1fcce6[_0xa0af('0x28')]=qs[_0xa0af('0x28')](_0xcf0f17[_0xa0af('0x40')][_0xa0af('0x28')]);_0x1fcce6[_0xa0af('0x26')]=qs[_0xa0af('0x26')](_0xcf0f17['query']['offset']);}return _0x48bfa0[_0xa0af('0x5d')](_0x1fcce6);}})[_0xa0af('0x2f')](function(_0x55d5a0){if(_0x55d5a0){return _0x55d5a0?{'count':_0x102c39,'rows':_0x55d5a0}:null;}})[_0xa0af('0x2f')](respondWithResult(_0x56bc62,null))[_0xa0af('0x52')](handleError(_0x56bc62,null));};exports['removeMembers']=function(_0x401e1d,_0x2ddd90,_0x575450){return db['ChatGroup'][_0xa0af('0x53')]({'where':{'id':_0x401e1d[_0xa0af('0x54')]['id']}})[_0xa0af('0x2f')](handleEntityNotFound(_0x2ddd90,null))[_0xa0af('0x2f')](function(_0x47e682){if(_0x47e682){return _0x47e682[_0xa0af('0x60')](_0x401e1d[_0xa0af('0x40')][_0xa0af('0x5b')]);}})['then'](respondWithStatusCode(_0x2ddd90,null))[_0xa0af('0x52')](handleError(_0x2ddd90,null));};exports['addMessage']=function(_0x227375,_0x4f3533,_0xd8188){if(_0x227375[_0xa0af('0x51')]['id']){delete _0x227375[_0xa0af('0x51')]['id'];}return db[_0xa0af('0x35')][_0xa0af('0x53')]({'where':{'id':_0x227375[_0xa0af('0x54')]['id']}})['then'](handleEntityNotFound(_0x4f3533,null))[_0xa0af('0x2f')](function(_0x1e1824){if(_0x1e1824){_0x227375[_0xa0af('0x51')][_0xa0af('0x61')]=_0x1e1824['id'];return db[_0xa0af('0x57')][_0xa0af('0x50')](_0x227375[_0xa0af('0x51')]);}})[_0xa0af('0x2f')](respondWithResult(_0x4f3533,null))['catch'](handleError(_0x4f3533,null));};exports[_0xa0af('0x62')]=function(_0x29d477,_0xba0c6c,_0x1f9271){var _0x2de20a={};var _0x45202a={};var _0xccfd67;var _0x134343;return db[_0xa0af('0x35')][_0xa0af('0x5e')]({'where':{'id':_0x29d477[_0xa0af('0x54')]['id']}})['then'](handleEntityNotFound(_0xba0c6c,null))[_0xa0af('0x2f')](function(_0x97fb4c){if(_0x97fb4c){_0xccfd67=_0x97fb4c;_0x45202a[_0xa0af('0x3a')]=_[_0xa0af('0x3c')](db[_0xa0af('0x57')][_0xa0af('0x36')]);_0x45202a[_0xa0af('0x40')]=_['keys'](_0x29d477[_0xa0af('0x40')]);_0x45202a[_0xa0af('0x3d')]=_[_0xa0af('0x3e')](_0x45202a['model'],_0x45202a['query']);_0x2de20a[_0xa0af('0x3f')]=_[_0xa0af('0x3e')](_0x45202a['model'],qs[_0xa0af('0x41')](_0x29d477[_0xa0af('0x40')]['fields']));_0x2de20a['attributes']=_0x2de20a['attributes'][_0xa0af('0x42')]?_0x2de20a['attributes']:_0x45202a[_0xa0af('0x3a')];_0x2de20a['order']=qs[_0xa0af('0x45')](_0x29d477[_0xa0af('0x40')]['sort']);_0x2de20a[_0xa0af('0x46')]=qs[_0xa0af('0x3d')](_['pick'](_0x29d477[_0xa0af('0x40')],_0x45202a['filters']));if(_0x29d477[_0xa0af('0x40')][_0xa0af('0x48')]){_0x2de20a[_0xa0af('0x46')]=_['merge'](_0x2de20a[_0xa0af('0x46')],{'$or':_[_0xa0af('0x34')](_0x2de20a['attributes'],function(_0xd684e5){var _0x5da84a={};_0x5da84a[_0xd684e5]={'$like':'%'+_0x29d477[_0xa0af('0x40')][_0xa0af('0x48')]+'%'};return _0x5da84a;})});}if(_0x29d477[_0xa0af('0x40')]['$gte']){var _0xad00d=_0x29d477[_0xa0af('0x40')][_0xa0af('0x63')][_0xa0af('0x64')](',');var _0x3c19d8={};_0x3c19d8[_0xad00d[0x0]]={'$gte':moment(_0xad00d[0x1])[_0xa0af('0x65')](_0xa0af('0x66'))};_0x2de20a[_0xa0af('0x46')]=_[_0xa0af('0x4a')](_0x2de20a[_0xa0af('0x46')],_0x3c19d8);}_0x2de20a=_['merge']({},_0x2de20a,_0x29d477[_0xa0af('0x4b')]);return _0xccfd67['getMessages'](_0x2de20a);}})[_0xa0af('0x2f')](function(_0x97eb69){if(_0x97eb69){_0x134343=_0x97eb69[_0xa0af('0x42')];if(!_0x29d477['query'][_0xa0af('0x43')]('nolimit')){_0x2de20a[_0xa0af('0x28')]=qs[_0xa0af('0x28')](_0x29d477[_0xa0af('0x40')]['limit']);_0x2de20a[_0xa0af('0x26')]=qs[_0xa0af('0x26')](_0x29d477[_0xa0af('0x40')][_0xa0af('0x26')]);}return _0xccfd67[_0xa0af('0x62')](_0x2de20a);}})[_0xa0af('0x2f')](function(_0x2ecf75){if(_0x2ecf75){return _0x2ecf75?{'count':_0x134343,'rows':_0x2ecf75}:null;}})['then'](respondWithResult(_0xba0c6c,null))[_0xa0af('0x52')](handleError(_0xba0c6c,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 5e259c0..8de2505 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 _0x2fb7=['../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2fb7,0x90));var _0x72fb=function(_0x5cd2c4,_0x59317c){_0x5cd2c4=_0x5cd2c4-0x0;var _0x34b74e=_0x2fb7[_0x5cd2c4];return _0x34b74e;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x72fb('0x0'))['db'][_0x72fb('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x72fb('0x2')](0x0);var events={'afterCreate':_0x72fb('0x3'),'afterUpdate':'update','afterDestroy':_0x72fb('0x4')};function emitEvent(_0x171f47){return function(_0x1a7ac7,_0x4e959b,_0x198c0a){ChatGroupEvents[_0x72fb('0x5')](_0x171f47+':'+_0x1a7ac7['id'],_0x1a7ac7);ChatGroupEvents[_0x72fb('0x5')](_0x171f47,_0x1a7ac7);_0x198c0a(null);};}for(var e in events){if(events[_0x72fb('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x72fb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0x75b6=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','update'];(function(_0x237546,_0xa81b26){var _0x233e29=function(_0x728aa4){while(--_0x728aa4){_0x237546['push'](_0x237546['shift']());}};_0x233e29(++_0xa81b26);}(_0x75b6,0x1a4));var _0x675b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x75b6[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x675b('0x0'));var ChatGroup=require('../../mysqldb')['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x675b('0x1')](0x0);var events={'afterCreate':_0x675b('0x2'),'afterUpdate':_0x675b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x21c7a0){return function(_0x37de04,_0x1face0,_0x4944bd){ChatGroupEvents[_0x675b('0x4')](_0x21c7a0+':'+_0x37de04['id'],_0x37de04);ChatGroupEvents['emit'](_0x21c7a0,_0x37de04);_0x4944bd(null);};}for(var e in events){if(events[_0x675b('0x5')](e)){var event=events[e];ChatGroup[_0x675b('0x6')](e,emitEvent(event));}}module[_0x675b('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 6f67ab2..8cdacfc 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 _0x9077=['path','rimraf','../../config/environment','ChatGroup','chat_groups','util','../../config/logger','bluebird','request-promise'];(function(_0x3d1643,_0x18c2b3){var _0x4a87ce=function(_0x5c4b41){while(--_0x5c4b41){_0x3d1643['push'](_0x3d1643['shift']());}};_0x4a87ce(++_0x18c2b3);}(_0x9077,0x15b));var _0x7907=function(_0x1d1912,_0xcff770){_0x1d1912=_0x1d1912-0x0;var _0x4957e4=_0x9077[_0x1d1912];return _0x4957e4;};'use strict';var _=require('lodash');var util=require(_0x7907('0x0'));var logger=require(_0x7907('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7907('0x2'));var rp=require(_0x7907('0x3'));var fs=require('fs');var path=require(_0x7907('0x4'));var rimraf=require(_0x7907('0x5'));var config=require(_0x7907('0x6'));var attributes=require('./chatGroup.attributes');module['exports']=function(_0x44ac7c,_0x5625e2){return _0x44ac7c['define'](_0x7907('0x7'),attributes,{'tableName':_0x7907('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dce=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','ChatGroup','lodash'];(function(_0x1e6b18,_0x2c23ef){var _0x19e8d5=function(_0x1acb29){while(--_0x1acb29){_0x1e6b18['push'](_0x1e6b18['shift']());}};_0x19e8d5(++_0x2c23ef);}(_0x7dce,0x1b7));var _0xe7dc=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0x7dce[_0x6d6a66];return _0x11eb6e;};'use strict';var _=require(_0xe7dc('0x0'));var util=require(_0xe7dc('0x1'));var logger=require(_0xe7dc('0x2'))(_0xe7dc('0x3'));var moment=require('moment');var BPromise=require(_0xe7dc('0x4'));var rp=require(_0xe7dc('0x5'));var fs=require('fs');var path=require(_0xe7dc('0x6'));var rimraf=require(_0xe7dc('0x7'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xe7dc('0x8')]=function(_0x19ed43,_0x48e794){return _0x19ed43['define'](_0xe7dc('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index a0554d2..5b8e9a7 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 _0x2a56=['./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter'];(function(_0x248703,_0xa58c07){var _0x12daa9=function(_0x53250b){while(--_0x53250b){_0x248703['push'](_0x248703['shift']());}};_0x12daa9(++_0xa58c07);}(_0x2a56,0xaf));var _0x62a5=function(_0x51b36e,_0x3213f1){_0x51b36e=_0x51b36e-0x0;var _0x5de3f8=_0x2a56[_0x51b36e];return _0x5de3f8;};'use strict';var _=require('lodash');var util=require(_0x62a5('0x0'));var moment=require('moment');var BPromise=require(_0x62a5('0x1'));var rs=require(_0x62a5('0x2'));var fs=require('fs');var Redis=require(_0x62a5('0x3'));var db=require(_0x62a5('0x4'))['db'];var utils=require(_0x62a5('0x5'));var logger=require('../../config/logger')(_0x62a5('0x6'));var config=require(_0x62a5('0x7'));var jayson=require(_0x62a5('0x8'));var client=jayson[_0x62a5('0x9')][_0x62a5('0xa')]({'port':0x232a});config[_0x62a5('0xb')]=_[_0x62a5('0xc')](config[_0x62a5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x62a5('0xd'))(new Redis(config[_0x62a5('0xb')]));require(_0x62a5('0xe'))[_0x62a5('0xf')](socket);function respondWithRpcPromise(_0x1edf69,_0x4e95ab,_0x2afe61){return new BPromise(function(_0x32f1b4,_0x45df15){return client[_0x62a5('0x10')](_0x1edf69,_0x2afe61)[_0x62a5('0x11')](function(_0x1379f6){logger[_0x62a5('0x12')](_0x62a5('0x13'),_0x4e95ab,_0x62a5('0x14'));logger['debug'](_0x62a5('0x15'),_0x4e95ab,_0x62a5('0x14'),JSON[_0x62a5('0x16')](_0x1379f6));if(_0x1379f6[_0x62a5('0x17')]){if(_0x1379f6['error'][_0x62a5('0x18')]===0x1f4){logger['error'](_0x62a5('0x13'),_0x4e95ab,_0x1379f6['error'][_0x62a5('0x19')]);return _0x45df15(_0x1379f6['error'][_0x62a5('0x19')]);}logger[_0x62a5('0x17')](_0x62a5('0x13'),_0x4e95ab,_0x1379f6['error'][_0x62a5('0x19')]);return _0x32f1b4(_0x1379f6['error']['message']);}else{logger[_0x62a5('0x12')]('ChatGroup,\x20%s,\x20%s',_0x4e95ab,'request\x20sent');_0x32f1b4(_0x1379f6['result'][_0x62a5('0x19')]);}})[_0x62a5('0x1a')](function(_0x5e6b6d){logger[_0x62a5('0x17')](_0x62a5('0x13'),_0x4e95ab,_0x5e6b6d);_0x45df15(_0x5e6b6d);});});} \ No newline at end of file +var _0x83f7=['message','result','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s'];(function(_0x4be009,_0x3b5635){var _0x2eddfc=function(_0x500cc0){while(--_0x500cc0){_0x4be009['push'](_0x4be009['shift']());}};_0x2eddfc(++_0x3b5635);}(_0x83f7,0x84));var _0x783f=function(_0x14850d,_0xac0cbd){_0x14850d=_0x14850d-0x0;var _0x3f7406=_0x83f7[_0x14850d];return _0x3f7406;};'use strict';var _=require(_0x783f('0x0'));var util=require(_0x783f('0x1'));var moment=require(_0x783f('0x2'));var BPromise=require('bluebird');var rs=require(_0x783f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x783f('0x4'));var logger=require(_0x783f('0x5'))(_0x783f('0x6'));var config=require(_0x783f('0x7'));var jayson=require(_0x783f('0x8'));var client=jayson[_0x783f('0x9')][_0x783f('0xa')]({'port':0x232a});config[_0x783f('0xb')]=_['defaults'](config[_0x783f('0xb')],{'host':_0x783f('0xc'),'port':0x18eb});var socket=require(_0x783f('0xd'))(new Redis(config[_0x783f('0xb')]));require('./chatGroup.socket')[_0x783f('0xe')](socket);function respondWithRpcPromise(_0x53b61d,_0x195d40,_0x3f6d1b){return new BPromise(function(_0xc94050,_0x3deb73){return client[_0x783f('0xf')](_0x53b61d,_0x3f6d1b)[_0x783f('0x10')](function(_0x1661c9){logger[_0x783f('0x11')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'));logger[_0x783f('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x195d40,_0x783f('0x12'),JSON[_0x783f('0x14')](_0x1661c9));if(_0x1661c9[_0x783f('0x15')]){if(_0x1661c9[_0x783f('0x15')][_0x783f('0x16')]===0x1f4){logger['error'](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0x3deb73(_0x1661c9['error']['message']);}logger[_0x783f('0x15')](_0x783f('0x17'),_0x195d40,_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);return _0xc94050(_0x1661c9[_0x783f('0x15')][_0x783f('0x18')]);}else{logger['info'](_0x783f('0x17'),_0x195d40,_0x783f('0x12'));_0xc94050(_0x1661c9[_0x783f('0x19')][_0x783f('0x18')]);}})['catch'](function(_0x1ef1bb){logger[_0x783f('0x15')]('ChatGroup,\x20%s,\x20%s',_0x195d40,_0x1ef1bb);_0x3deb73(_0x1ef1bb);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index b3694b9..81d0330 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 _0x2297=['length','chatGroup:','save','emit','register'];(function(_0x240ae9,_0x3a0229){var _0x4ceaae=function(_0x4b122c){while(--_0x4b122c){_0x240ae9['push'](_0x240ae9['shift']());}};_0x4ceaae(++_0x3a0229);}(_0x2297,0x93));var _0x7229=function(_0x1f926d,_0x1ec305){_0x1f926d=_0x1f926d-0x0;var _0x1452d3=_0x2297[_0x1f926d];return _0x1452d3;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x7229('0x0'),'remove','update'];function createListener(_0x331140,_0x2b8edc){return function(_0x1468a4){_0x2b8edc[_0x7229('0x1')](_0x331140,_0x1468a4);};}function removeListener(_0x37e8cd,_0x2d0944){return function(){ChatGroupEvents['removeListener'](_0x37e8cd,_0x2d0944);};}exports[_0x7229('0x2')]=function(_0x41bb0e){for(var _0x1051c=0x0,_0x1ade79=events[_0x7229('0x3')];_0x1051c<_0x1ade79;_0x1051c++){var _0x2e6a09=events[_0x1051c];var _0x3329b1=createListener(_0x7229('0x4')+_0x2e6a09,_0x41bb0e);ChatGroupEvents['on'](_0x2e6a09,_0x3329b1);}}; \ No newline at end of file +var _0x609b=['removeListener','register','length','chatGroup:','./chatGroup.events','remove','emit'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x609b,0x154));var _0xb609=function(_0x591122,_0x3da906){_0x591122=_0x591122-0x0;var _0x3f8a95=_0x609b[_0x591122];return _0x3f8a95;};'use strict';var ChatGroupEvents=require(_0xb609('0x0'));var events=['save',_0xb609('0x1'),'update'];function createListener(_0x47fbf2,_0x488577){return function(_0x149a91){_0x488577[_0xb609('0x2')](_0x47fbf2,_0x149a91);};}function removeListener(_0x5dc424,_0x24d5b7){return function(){ChatGroupEvents[_0xb609('0x3')](_0x5dc424,_0x24d5b7);};}exports[_0xb609('0x4')]=function(_0x43e792){for(var _0x139d1a=0x0,_0x540c1f=events[_0xb609('0x5')];_0x139d1a<_0x540c1f;_0x139d1a++){var _0x1e25d2=events[_0x139d1a];var _0x5a630b=createListener(_0xb609('0x6')+_0x1e25d2,_0x43e792);ChatGroupEvents['on'](_0x1e25d2,_0x5a630b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 731d557..e880ff4 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 _0x9025=['/:id/members','getMembers','/:id/messages','getMessages','create','post','addMessage','put','update','delete','destroy','removeMembers','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread'];(function(_0x47aa48,_0x222931){var _0x52def5=function(_0x12b98f){while(--_0x12b98f){_0x47aa48['push'](_0x47aa48['shift']());}};_0x52def5(++_0x222931);}(_0x9025,0x1ac));var _0x5902=function(_0x43d13c,_0x5d982d){_0x43d13c=_0x43d13c-0x0;var _0x2cd1ea=_0x9025[_0x43d13c];return _0x2cd1ea;};'use strict';var multer=require('multer');var util=require(_0x5902('0x0'));var path=require(_0x5902('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5902('0x2'));var interaction=require(_0x5902('0x3'));var config=require(_0x5902('0x4'));var controller=require(_0x5902('0x5'));router[_0x5902('0x6')]('/',auth[_0x5902('0x7')](),controller[_0x5902('0x8')]);router[_0x5902('0x6')](_0x5902('0x9'),auth[_0x5902('0x7')](),controller[_0x5902('0xa')]);router[_0x5902('0x6')](_0x5902('0xb'),auth[_0x5902('0x7')](),controller[_0x5902('0xc')]);router[_0x5902('0x6')](_0x5902('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0x5902('0x6')](_0x5902('0xe'),auth[_0x5902('0x7')](),controller[_0x5902('0xf')]);router[_0x5902('0x6')](_0x5902('0x10'),auth[_0x5902('0x7')](),controller[_0x5902('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5902('0x12')]);router[_0x5902('0x13')](_0x5902('0xe'),auth[_0x5902('0x7')](),controller['addMembers']);router[_0x5902('0x13')](_0x5902('0x10'),auth[_0x5902('0x7')](),controller[_0x5902('0x14')]);router[_0x5902('0x15')](_0x5902('0xb'),auth[_0x5902('0x7')](),controller[_0x5902('0x16')]);router[_0x5902('0x17')](_0x5902('0xb'),auth['isAuthenticated'](),controller[_0x5902('0x18')]);router[_0x5902('0x17')](_0x5902('0xe'),auth['isAuthenticated'](),controller[_0x5902('0x19')]);module['exports']=router; \ No newline at end of file +var _0x9043=['getMessages','post','create','/:id/members','addMembers','put','delete','removeMembers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','/:id/messages'];(function(_0x398859,_0x4abdc2){var _0x34bff8=function(_0x3bb2bb){while(--_0x3bb2bb){_0x398859['push'](_0x398859['shift']());}};_0x34bff8(++_0x4abdc2);}(_0x9043,0x159));var _0x3904=function(_0x5674f9,_0x214d3e){_0x5674f9=_0x5674f9-0x0;var _0x5d2abf=_0x9043[_0x5674f9];return _0x5d2abf;};'use strict';var multer=require(_0x3904('0x0'));var util=require(_0x3904('0x1'));var path=require(_0x3904('0x2'));var timeout=require(_0x3904('0x3'));var express=require(_0x3904('0x4'));var router=express[_0x3904('0x5')]();var fs_extra=require(_0x3904('0x6'));var auth=require(_0x3904('0x7'));var interaction=require(_0x3904('0x8'));var config=require(_0x3904('0x9'));var controller=require(_0x3904('0xa'));router[_0x3904('0xb')]('/',auth[_0x3904('0xc')](),controller[_0x3904('0xd')]);router[_0x3904('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3904('0xb')](_0x3904('0xe'),auth['isAuthenticated'](),controller[_0x3904('0xf')]);router[_0x3904('0xb')](_0x3904('0x10'),auth[_0x3904('0xc')](),controller[_0x3904('0x11')]);router['get']('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get'](_0x3904('0x12'),auth[_0x3904('0xc')](),controller[_0x3904('0x13')]);router[_0x3904('0x14')]('/',auth[_0x3904('0xc')](),controller[_0x3904('0x15')]);router[_0x3904('0x14')](_0x3904('0x16'),auth[_0x3904('0xc')](),controller[_0x3904('0x17')]);router[_0x3904('0x14')]('/:id/messages',auth[_0x3904('0xc')](),controller['addMessage']);router[_0x3904('0x18')](_0x3904('0xe'),auth[_0x3904('0xc')](),controller['update']);router[_0x3904('0x19')](_0x3904('0xe'),auth[_0x3904('0xc')](),controller['destroy']);router[_0x3904('0x19')](_0x3904('0x16'),auth[_0x3904('0xc')](),controller[_0x3904('0x1a')]);module[_0x3904('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 35fba76..1adfffe 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 _0x6294=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize','exports'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6294,0x8e));var _0x4629=function(_0x3a15a6,_0x530210){_0x3a15a6=_0x3a15a6-0x0;var _0x416a07=_0x6294[_0x3a15a6];return _0x416a07;};'use strict';var Sequelize=require(_0x4629('0x0'));module[_0x4629('0x1')]={'closed':{'type':Sequelize[_0x4629('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x4629('0x3')]},'ratingType':{'type':Sequelize[_0x4629('0x4')](_0x4629('0x5'),_0x4629('0x6')),'defaultValue':_0x4629('0x5')},'ratingMessage':{'type':Sequelize[_0x4629('0x7')]},'pathTranscript':{'type':Sequelize[_0x4629('0x7')]},'mailTranscript':{'type':Sequelize[_0x4629('0x8')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x4629('0x9')]},'disposition':{'type':Sequelize[_0x4629('0x8')]},'secondDisposition':{'type':Sequelize[_0x4629('0x8')]},'thirdDisposition':{'type':Sequelize[_0x4629('0x8')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x4629('0x8')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x4629('0x8')]},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x4629('0x8')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x4629('0x8')]},'formData':{'type':Sequelize[_0x4629('0x7')](_0x4629('0xa'))},'read1stAt':{'type':Sequelize[_0x4629('0x9')]},'lastMsgAt':{'type':Sequelize[_0x4629('0x9')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4629('0xb')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x4629('0x8')]},'customerPort':{'type':Sequelize[_0x4629('0x8')]},'vidaooSessionId':{'type':Sequelize[_0x4629('0x7')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4629('0x3')]}}; \ No newline at end of file +var _0x382e=['star','TEXT','STRING','DATE','out','INTEGER','sequelize','exports','BOOLEAN','ENUM'];(function(_0x484a60,_0x63e920){var _0x18217b=function(_0x15ff9a){while(--_0x15ff9a){_0x484a60['push'](_0x484a60['shift']());}};_0x18217b(++_0x63e920);}(_0x382e,0x178));var _0xe382=function(_0x3b6376,_0x351f18){_0x3b6376=_0x3b6376-0x0;var _0x35291d=_0x382e[_0x3b6376];return _0x35291d;};'use strict';var Sequelize=require(_0xe382('0x0'));module[_0xe382('0x1')]={'closed':{'type':Sequelize[_0xe382('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0xe382('0x3')](_0xe382('0x4'),'thumb'),'defaultValue':_0xe382('0x4')},'ratingMessage':{'type':Sequelize[_0xe382('0x5')]},'pathTranscript':{'type':Sequelize[_0xe382('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe382('0x6')]},'secondDisposition':{'type':Sequelize[_0xe382('0x6')]},'thirdDisposition':{'type':Sequelize[_0xe382('0x6')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0xe382('0x6')]},'browserVersion':{'type':Sequelize[_0xe382('0x6')]},'osName':{'type':Sequelize[_0xe382('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0xe382('0x6')]},'deviceVendor':{'type':Sequelize[_0xe382('0x6')]},'deviceType':{'type':Sequelize[_0xe382('0x6')]},'referer':{'type':Sequelize[_0xe382('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0xe382('0x7')]},'lastMsgAt':{'type':Sequelize[_0xe382('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xe382('0x3')]('in',_0xe382('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xe382('0x6')]},'customerPort':{'type':Sequelize[_0xe382('0x6')]},'vidaooSessionId':{'type':Sequelize[_0xe382('0x5')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe382('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 1544906..af1c794 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 _0xf4bf=['debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','catch','end','json','undefined','limit','count','offset','update','then','sendStatus','stack','name','status','send','render','merge','contact','interaction','account','map','ChatInteraction','fieldName','findAll','chat','query','show','model','keys','filters','intersection','attributes','fields','length','include','options','find','create','body','params','describe','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooTopic','vidaooNote','vidaooMetadata','vidaooEscalation','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','filename','type','file','mimetype','Attachment','findOne','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','basename','download','close','server/files/chat/upload/','format','transcript-%s.txt','ChatMessage','Messages','User','ContactId','agentAlias','System','Visitor','agentIdentifier','agent_alias','alias','%s%d','[%s]\x20%s:\x20%s\x0a','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','rawAttributes','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','nolimit','push','omit','spread','Tag','color','emit','removeTags','unix','server','files','tmp','transcript-%d-%s.zip','firstName','lastName','createdAt','direction','Owner','get','mkdirSync','Chat','Account','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','pipe','createWriteStream','out','read','renderFile','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','info'];(function(_0x13a961,_0x49e831){var _0x5e5f65=function(_0x1da53b){while(--_0x1da53b){_0x13a961['push'](_0x13a961['shift']());}};_0x5e5f65(++_0x49e831);}(_0xf4bf,0xb1));var _0xff4b=function(_0x3f3bad,_0x193f06){_0x3f3bad=_0x3f3bad-0x0;var _0x4f0801=_0xf4bf[_0x3f3bad];return _0x4f0801;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xff4b('0x0'));var rp=require(_0xff4b('0x1'));var moment=require(_0xff4b('0x2'));var BPromise=require(_0xff4b('0x3'));var Mustache=require(_0xff4b('0x4'));var util=require(_0xff4b('0x5'));var path=require(_0xff4b('0x6'));var ejs=require(_0xff4b('0x7'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xff4b('0x8'));var interaction=require('../../components/interaction/service');var qs=require(_0xff4b('0x9'));var pdf=require(_0xff4b('0xa'));var logger=require('../../config/logger')(_0xff4b('0xb'));var config=require(_0xff4b('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xff4b('0xd')],{'host':_0xff4b('0xe'),'port':0x18eb});var socket=require(_0xff4b('0xf'))(new Redis(config['redis']));require(_0xff4b('0x10'))[_0xff4b('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0xff4b('0x12')][_0xff4b('0x13')]({'port':0x232b});var client9004=jayson[_0xff4b('0x12')][_0xff4b('0x13')]({'port':0x232c});function respondWithRpcPromise(_0x9fc5af,_0x4b517b,_0x54853c,_0xe6e5eb){return new BPromise(function(_0x3df58e,_0x5f493e){var _0x487cd9=_0xe6e5eb||client;return _0x487cd9[_0xff4b('0x14')](_0x9fc5af,_0x54853c)['then'](function(_0x3576c0){logger[_0xff4b('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x4b517b,'request\x20sent');logger[_0xff4b('0x16')](_0xff4b('0x17'),_0x4b517b,_0xff4b('0x18'),JSON[_0xff4b('0x19')](_0x3576c0));if(_0x3576c0[_0xff4b('0x1a')]){if(_0x3576c0[_0xff4b('0x1a')][_0xff4b('0x1b')]===0x1f4){logger['error'](_0xff4b('0x1c'),_0x4b517b,_0x3576c0[_0xff4b('0x1a')][_0xff4b('0x1d')]);return _0x5f493e(_0x3576c0[_0xff4b('0x1a')][_0xff4b('0x1d')]);}logger[_0xff4b('0x1a')](_0xff4b('0x1c'),_0x4b517b,_0x3576c0[_0xff4b('0x1a')][_0xff4b('0x1d')]);return _0x3df58e(_0x3576c0[_0xff4b('0x1a')][_0xff4b('0x1d')]);}else{logger[_0xff4b('0x15')](_0xff4b('0x1c'),_0x4b517b,_0xff4b('0x18'));_0x3df58e(_0x3576c0['result'][_0xff4b('0x1d')]);}})[_0xff4b('0x1e')](function(_0x4610f6){logger['error'](_0xff4b('0x1c'),_0x4b517b,_0x4610f6);_0x5f493e(_0x4610f6);});});}function respondWithStatusCode(_0x37eeae,_0x3fa834){_0x3fa834=_0x3fa834||0xcc;return function(_0x335b5b){if(_0x335b5b){return _0x37eeae['sendStatus'](_0x3fa834);}return _0x37eeae['status'](_0x3fa834)[_0xff4b('0x1f')]();};}function respondWithResult(_0x598d62,_0x534aad){_0x534aad=_0x534aad||0xc8;return function(_0x42c600){if(_0x42c600){return _0x598d62['status'](_0x534aad)[_0xff4b('0x20')](_0x42c600);}};}function respondWithFilteredResult(_0x4aec27,_0x15ca74){return function(_0x2507c9){if(_0x2507c9){var _0x546b21=typeof _0x15ca74['offset']===_0xff4b('0x21')&&typeof _0x15ca74[_0xff4b('0x22')]===_0xff4b('0x21');var _0x3f7efe=_0x2507c9[_0xff4b('0x23')];var _0x3976bd=_0x546b21?0x0:_0x15ca74[_0xff4b('0x24')];var _0x53b2a1=_0x546b21?_0x2507c9[_0xff4b('0x23')]:_0x15ca74['offset']+_0x15ca74[_0xff4b('0x22')];var _0x4c10a7;if(_0x53b2a1>=_0x3f7efe){_0x53b2a1=_0x3f7efe;_0x4c10a7=0xc8;}else{_0x4c10a7=0xce;}_0x4aec27['status'](_0x4c10a7);return _0x4aec27['set']('Content-Range',_0x3976bd+'-'+_0x53b2a1+'/'+_0x3f7efe)[_0xff4b('0x20')](_0x2507c9);}return null;};}function saveUpdates(_0x52ef68){return function(_0x48d53e){if(_0x48d53e){return _0x48d53e[_0xff4b('0x25')](_0x52ef68)[_0xff4b('0x26')](function(_0x28539f){return _0x28539f;});}return null;};}function removeEntity(_0x335490){return function(_0x12965f){if(_0x12965f){return _0x12965f['destroy']()['then'](function(){_0x335490['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5910c0){return function(_0x236057){if(!_0x236057){_0x5910c0[_0xff4b('0x27')](0x194);}return _0x236057;};}function handleError(_0x248876,_0x5de365){_0x5de365=_0x5de365||0x1f4;return function(_0x57cd4e){logger[_0xff4b('0x1a')](_0x57cd4e[_0xff4b('0x28')]);if(_0x57cd4e['name']){delete _0x57cd4e[_0xff4b('0x29')];}_0x248876[_0xff4b('0x2a')](_0x5de365)[_0xff4b('0x2b')](_0x57cd4e);};}function getMustacheRender(_0x5d348e,_0x243ebc){return Mustache[_0xff4b('0x2c')](_0x5d348e,_[_0xff4b('0x2d')](_0x243ebc['body'],{'contact':_0x243ebc[_0xff4b('0x2e')],'message':_0x243ebc[_0xff4b('0x1d')],'agent':_0x243ebc['agent'],'interaction':_0x243ebc[_0xff4b('0x2f')],'account':_0x243ebc[_0xff4b('0x30')]}))||'';}exports['index']=function(_0x12b8cc,_0x4e3963){var _0x478eb2={};var _0x14045e=_[_0xff4b('0x31')](db[_0xff4b('0x32')]['rawAttributes'],function(_0x1ab261){return{'name':_0x1ab261[_0xff4b('0x33')],'type':_0x1ab261['type']['key']};});_0x478eb2=qs['getOptions'](_0x14045e,_0x12b8cc);return interaction[_0xff4b('0x34')](_0xff4b('0x35'),_0x12b8cc[_0xff4b('0x36')],_0x12b8cc['user'],_0x478eb2,_0x14045e)[_0xff4b('0x26')](respondWithFilteredResult(_0x4e3963,_0x478eb2))[_0xff4b('0x1e')](handleError(_0x4e3963,null));};exports[_0xff4b('0x37')]=function(_0x4ae40e,_0x1f71b7){var _0x50b5be={'raw':![],'where':{'id':_0x4ae40e['params']['id']}},_0x533c73={};_0x533c73[_0xff4b('0x38')]=_[_0xff4b('0x39')](db[_0xff4b('0x32')]['rawAttributes']);_0x533c73[_0xff4b('0x36')]=_[_0xff4b('0x39')](_0x4ae40e[_0xff4b('0x36')]);_0x533c73[_0xff4b('0x3a')]=_[_0xff4b('0x3b')](_0x533c73[_0xff4b('0x38')],_0x533c73[_0xff4b('0x36')]);_0x50b5be[_0xff4b('0x3c')]=_['intersection'](_0x533c73['model'],qs[_0xff4b('0x3d')](_0x4ae40e['query'][_0xff4b('0x3d')]));_0x50b5be[_0xff4b('0x3c')]=_0x50b5be[_0xff4b('0x3c')][_0xff4b('0x3e')]?_0x50b5be[_0xff4b('0x3c')]:_0x533c73[_0xff4b('0x38')];if(_0x4ae40e[_0xff4b('0x36')]['includeAll']){_0x50b5be[_0xff4b('0x3f')]=[{'all':!![]}];}_0x50b5be=_[_0xff4b('0x2d')]({},_0x50b5be,_0x4ae40e[_0xff4b('0x40')]);return db[_0xff4b('0x32')][_0xff4b('0x41')](_0x50b5be)['then'](handleEntityNotFound(_0x1f71b7,null))[_0xff4b('0x26')](respondWithResult(_0x1f71b7,null))[_0xff4b('0x1e')](handleError(_0x1f71b7,null));};exports['create']=function(_0x5b4e40,_0x2e705c){return db[_0xff4b('0x32')][_0xff4b('0x42')](_0x5b4e40['body'],{})['then'](respondWithResult(_0x2e705c,0xc9))[_0xff4b('0x1e')](handleError(_0x2e705c,null));};exports[_0xff4b('0x25')]=function(_0x17b122,_0x34b2e3){if(_0x17b122[_0xff4b('0x43')]['id']){delete _0x17b122[_0xff4b('0x43')]['id'];}return db[_0xff4b('0x32')]['find']({'where':{'id':_0x17b122[_0xff4b('0x44')]['id']}})[_0xff4b('0x26')](handleEntityNotFound(_0x34b2e3,null))[_0xff4b('0x26')](saveUpdates(_0x17b122[_0xff4b('0x43')],null))[_0xff4b('0x26')](respondWithResult(_0x34b2e3,null))['catch'](handleError(_0x34b2e3,null));};exports['destroy']=function(_0x4e7e6f,_0x1830ea){return db[_0xff4b('0x32')]['find']({'where':{'id':_0x4e7e6f[_0xff4b('0x44')]['id']}})[_0xff4b('0x26')](handleEntityNotFound(_0x1830ea,null))[_0xff4b('0x26')](removeEntity(_0x1830ea,null))[_0xff4b('0x1e')](handleError(_0x1830ea,null));};exports[_0xff4b('0x45')]=function(_0xbdaafb,_0x330d20){return db[_0xff4b('0x32')][_0xff4b('0x45')]()[_0xff4b('0x26')](respondWithResult(_0x330d20,null))[_0xff4b('0x1e')](handleError(_0x330d20,null));};exports['createVidaooSession']=function(_0x353ab7,_0x54becd){var _0xa4054=_0x353ab7[_0xff4b('0x44')]['id'];var _0x487c72;var _0x2c2f23;var _0x24c518;return db['ChatInteraction']['findOne']({'where':{'id':_0xa4054}})['then'](function(_0x45ef16){_0x487c72=_0x45ef16;return db[_0xff4b('0x46')]['findOne']({'where':{'id':_0x45ef16[_0xff4b('0x47')]},'attributes':['id',_0xff4b('0x48'),'vidaooEscalation',_0xff4b('0x49'),_0xff4b('0x4a'),_0xff4b('0x4b')],'raw':!![]});})[_0xff4b('0x26')](function(_0x301c20){if(_0x301c20&&_0x301c20[_0xff4b('0x48')]&&_0x301c20[_0xff4b('0x4c')]){_0x2c2f23=_0x301c20;var _0x49f870={'interaction':{'id':_0xa4054},'agent':{'id':_0x353ab7[_0xff4b('0x4d')]['id'],'name':_0x353ab7[_0xff4b('0x4d')][_0xff4b('0x29')],'fullname':_0x353ab7[_0xff4b('0x4d')][_0xff4b('0x4e')],'email':_0x353ab7[_0xff4b('0x4d')][_0xff4b('0x4f')]},'contact':_0x353ab7['body']['contact'],'account':_0x353ab7['body']['account']};var _0x341c15={'rejectUnauthorized':![],'method':_0xff4b('0x50'),'url':_0xff4b('0x51'),'headers':{'X-APIKEY':_0x301c20[_0xff4b('0x48')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x353ab7[_0xff4b('0x4d')]['email']],'buttons':null,'topic':_0x2c2f23[_0xff4b('0x49')],'note':_[_0xff4b('0x52')](_0x2c2f23[_0xff4b('0x4a')])?null:getMustacheRender(_0x2c2f23['vidaooNote'],_0x49f870),'metadata':null},'redirect':_0xff4b('0x53'),'json':!![]};try{if(!_[_0xff4b('0x52')](_0x2c2f23[_0xff4b('0x4b')])){var _0x53c578=getMustacheRender(_0x2c2f23[_0xff4b('0x4b')],_0x49f870);var _0x27b9ee=JSON[_0xff4b('0x54')](_0x53c578);_0x341c15['body'][_0xff4b('0x55')]=_0x27b9ee;}}catch(_0x2362b5){throw new db['Sequelize'][(_0xff4b('0x56'))](_0xff4b('0x57'));}return rp(_0x341c15);}else{throw new db['Sequelize']['ValidationError'](_0xff4b('0x58'));}})['then'](function(_0x161356){_0x24c518=_0x161356;if(_0x24c518['id']){var _0x193c2b={'body':_0x24c518['join_url'],'ChatWebsiteId':_0x2c2f23['id'],'ChatInteractionId':_0x487c72['id'],'direction':'out','UserId':_0x353ab7['user']['id']};return db['ChatMessage'][_0xff4b('0x42')](_0x193c2b,{});}else{throw new db[(_0xff4b('0x59'))]['ValidationError'](_0xff4b('0x5a'));}})[_0xff4b('0x26')](function(){return _0x487c72['updateAttributes']({'vidaooSessionId':_0x24c518['id']});})[_0xff4b('0x26')](respondWithResult(_0x54becd,null))['catch'](handleError(_0x54becd,null));};exports[_0xff4b('0x5b')]=function(_0x12c60d,_0x5e6f58){if(_0x12c60d[_0xff4b('0x43')]['id']){delete _0x12c60d[_0xff4b('0x43')]['id'];}return db[_0xff4b('0x32')][_0xff4b('0x41')]({'where':{'id':_0x12c60d['params']['id']},'include':[{'model':db[_0xff4b('0x5c')],'as':_0xff4b('0x5d')}]})[_0xff4b('0x26')](handleEntityNotFound(_0x5e6f58,null))[_0xff4b('0x26')](saveUpdates(_0x12c60d[_0xff4b('0x43')],null))[_0xff4b('0x26')](respondWithResult(_0x5e6f58,null))[_0xff4b('0x1e')](handleError(_0x5e6f58,null));};exports[_0xff4b('0x5e')]=function(_0x5c07a0,_0x3eda73){if(_0x5c07a0[_0xff4b('0x43')]['id']){delete _0x5c07a0[_0xff4b('0x43')]['id'];}return db[_0xff4b('0x32')][_0xff4b('0x41')]({'where':{'id':_0x5c07a0[_0xff4b('0x44')]['id']}})['then'](function(_0x10a67c){if(!_0x10a67c){logger[_0xff4b('0x1a')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xff4b('0x5e'),0x194,'entity\x20not\x20found');_0x3eda73['sendStatus'](0x194);}else{if(_0x10a67c[_0xff4b('0x5f')]){throw new db['Sequelize'][(_0xff4b('0x56'))](_0xff4b('0x60'));}}return _0x10a67c;})[_0xff4b('0x26')](function(_0x49d211){if(_0x49d211){return _0x49d211['update']({'closed':_0x5c07a0[_0xff4b('0x43')][_0xff4b('0x61')],'disposition':_0x5c07a0['body'][_0xff4b('0x62')]})[_0xff4b('0x26')](function(_0x15765d){return _0x15765d;});}})[_0xff4b('0x26')](function(){return respondWithRpcPromise(_0xff4b('0x63'),_0xff4b('0x5e'),_0x5c07a0[_0xff4b('0x43')],client9004);})[_0xff4b('0x26')](respondWithResult(_0x3eda73,null))[_0xff4b('0x1e')](handleError(_0x3eda73,null));};exports[_0xff4b('0x64')]=function(_0x3a0b1d,_0x4fc070){_0x3a0b1d['body'][_0xff4b('0x29')]=_0x3a0b1d['file']['originalname'];_0x3a0b1d[_0xff4b('0x43')]['basename']=_0x3a0b1d['file'][_0xff4b('0x65')];_0x3a0b1d[_0xff4b('0x43')][_0xff4b('0x66')]=_0x3a0b1d[_0xff4b('0x67')][_0xff4b('0x68')];return db[_0xff4b('0x69')][_0xff4b('0x42')](_0x3a0b1d[_0xff4b('0x43')])[_0xff4b('0x26')](respondWithResult(_0x4fc070,0xc9))[_0xff4b('0x1e')](handleError(_0x4fc070,null));};exports['attachmentDownload']=function(_0x1a5f45,_0x38eac6){return db[_0xff4b('0x32')][_0xff4b('0x6a')]({'where':{'id':_0x1a5f45[_0xff4b('0x44')]['id']},'raw':!![]})[_0xff4b('0x26')](handleEntityNotFound(_0x38eac6,null))['then'](function(_0x4df0bb){if(_0x4df0bb){if(_0x4df0bb[_0xff4b('0x61')]){return _0x38eac6[_0xff4b('0x2a')](0x193)[_0xff4b('0x20')]({'status':0x193,'message':'Unauthorized'});}return db[_0xff4b('0x69')][_0xff4b('0x6a')]({'where':{'id':_0x1a5f45[_0xff4b('0x36')][_0xff4b('0x6b')]},'raw':!![]})[_0xff4b('0x26')](handleEntityNotFound(_0x38eac6,null));}})['then'](function(_0x2043ae){if(_0x2043ae){var _0x51bc7f=_0x2043ae[_0xff4b('0x6c')]!==null;var _0x16a1a0=path[_0xff4b('0x6d')](config[_0xff4b('0x6e')],_0xff4b('0x6f'));if(_0x51bc7f){_0x16a1a0=path['join'](_0x16a1a0,_0xff4b('0x70'));}var _0x17cca2=path[_0xff4b('0x6d')](_0x16a1a0,_0x2043ae[_0xff4b('0x71')]);return _0x38eac6[_0xff4b('0x72')](_0x17cca2);}})[_0xff4b('0x1e')](handleError(_0x38eac6,null));};exports[_0xff4b('0x73')]=function(_0x428c35,_0x1c247a){var _0x274949=null;var _0x20e531=null;var _0x15b6dd=null;if(_0x428c35['body']['id']){delete _0x428c35[_0xff4b('0x43')]['id'];}if(_0x428c35['body']['mailTranscript']){_0x15b6dd=path['join'](config[_0xff4b('0x6e')],_0xff4b('0x74'),util[_0xff4b('0x75')](_0xff4b('0x76'),Date['now']()));_0x428c35['body']['pathTranscript']=_0x15b6dd;}return db[_0xff4b('0x32')][_0xff4b('0x41')]({'where':{'id':_0x428c35[_0xff4b('0x44')]['id']},'include':[{'model':db[_0xff4b('0x77')],'as':_0xff4b('0x78'),'include':[{'model':db['User'],'as':_0xff4b('0x79')}]}]})[_0xff4b('0x26')](handleEntityNotFound(_0x1c247a,null))['then'](saveUpdates(_0x428c35[_0xff4b('0x43')],null))[_0xff4b('0x26')](function(_0x3b99f6){if(_0x3b99f6){_0x274949=_0x3b99f6;return db[_0xff4b('0x46')][_0xff4b('0x41')]({'where':{'id':_0x274949[_0xff4b('0x47')]}});}})[_0xff4b('0x26')](function(_0x244f94){if(_0x244f94){_0x20e531=_0x244f94;return db[_0xff4b('0x5c')][_0xff4b('0x41')]({'where':{'id':_0x274949[_0xff4b('0x7a')]}});}})['then'](function(_0x429463){if(_0x429463){if(_0x15b6dd){var _0x2e0a10=null;for(var _0x2448c5=0x1;_0x2448c5<_0x274949['Messages'][_0xff4b('0x3e')];++_0x2448c5){_0x2e0a10=_0x274949['Messages'][_0x2448c5];var _0x150bdc=_0x2e0a10[_0xff4b('0x5f')]?util[_0xff4b('0x75')]('%s%d',_0x20e531[_0xff4b('0x7b')],_0x2e0a10['UserId']):_0xff4b('0x7c');var _0xef64bb=_0x428c35[_0xff4b('0x43')]['customer']||util['format']('%s%d',_0xff4b('0x7d'),_0x2e0a10[_0xff4b('0x7a')]);switch(_0x20e531[_0xff4b('0x7e')]){case'website_alias':_0x150bdc=_0x2e0a10['UserId']?util['format']('%s%d',_0x20e531['agentAlias'],_0x2e0a10['UserId']):_0xff4b('0x7c');break;case _0xff4b('0x7f'):_0x150bdc=_0x2e0a10[_0xff4b('0x5f')]?_0x2e0a10[_0xff4b('0x79')][_0xff4b('0x80')]||_0x2e0a10[_0xff4b('0x79')][_0xff4b('0x4e')]:_0xff4b('0x7c');break;case'agent_fullname':_0x150bdc=_0x2e0a10[_0xff4b('0x5f')]?_0x2e0a10[_0xff4b('0x79')][_0xff4b('0x4e')]:'System';break;default:_0x150bdc=_0x2e0a10['UserId']?util[_0xff4b('0x75')](_0xff4b('0x81'),_0x20e531[_0xff4b('0x7b')],_0x2e0a10[_0xff4b('0x5f')]):_0xff4b('0x7c');}var _0x32bb98=util['format'](_0xff4b('0x82'),moment(_0x2e0a10['createdAt'])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x2e0a10['direction']==='in'?_0xef64bb:_0x150bdc,_0x2e0a10['body']);if(!_0x2e0a10[_0xff4b('0x83')]){fs[_0xff4b('0x84')](_0x15b6dd,_0x32bb98);}}return db[_0xff4b('0x85')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xff4b('0x86')],'as':_0xff4b('0x87'),'raw':!![],'include':[{'model':db[_0xff4b('0x88')],'as':_0xff4b('0x88'),'raw':!![]}]}]});}}})[_0xff4b('0x26')](function(_0x1a1e72){if(!_0x1a1e72||!_0x1a1e72[_0xff4b('0x87')]||!_0x428c35['body'])return _0x274949;var _0x304f7f=_0x1a1e72[_0xff4b('0x89')]();return respondWithRpcPromise(_0xff4b('0x8a'),_0xff4b('0x8b'),{'account':_0x304f7f,'message':{'from':util[_0xff4b('0x75')]('\x22%s\x22\x20<%s>',_0x1a1e72[_0xff4b('0x29')],_0x1a1e72[_0xff4b('0x4f')]||_0x1a1e72[_0xff4b('0x87')][_0xff4b('0x4d')]),'to':_0x428c35['body'][_0xff4b('0x8c')],'subject':_0xff4b('0x8d'),'text':util[_0xff4b('0x75')](_0xff4b('0x8e'),_0x428c35[_0xff4b('0x43')][_0xff4b('0x8c')]),'attachments':[{'path':_0x15b6dd}]}})[_0xff4b('0x26')](function(){return _0x274949;})[_0xff4b('0x1e')](function(_0x269d6e){logger[_0xff4b('0x1a')](_0x269d6e);});})[_0xff4b('0x26')](respondWithStatusCode(_0x1c247a,0xc8))['catch'](handleError(_0x1c247a,null));};exports[_0xff4b('0x8f')]=function(_0x1f8df7,_0x39785b){return db[_0xff4b('0x77')][_0xff4b('0x41')]({'where':{'id':_0x1f8df7[_0xff4b('0x44')]['id']}})[_0xff4b('0x26')](handleEntityNotFound(_0x39785b,null))[_0xff4b('0x26')](function(_0x4000cf){if(_0x4000cf){return _0x4000cf[_0xff4b('0x8f')](_0x1f8df7[_0xff4b('0x43')][_0xff4b('0x90')],_['omit'](_0x1f8df7[_0xff4b('0x43')],[_0xff4b('0x90'),'id'])||{});}})[_0xff4b('0x26')](respondWithResult(_0x39785b,null))[_0xff4b('0x1e')](handleError(_0x39785b,null));};exports['getMessages']=function(_0x29a045,_0xf5a831){var _0x48f310={'raw':![],'where':{}};var _0xf289eb={};var _0x39ea8c={'count':0x0,'rows':[]};return db[_0xff4b('0x32')][_0xff4b('0x6a')]({'where':{'id':_0x29a045[_0xff4b('0x44')]['id']}})['then'](handleEntityNotFound(_0xf5a831,null))['then'](function(_0x274e18){if(_0x274e18){_0xf289eb[_0xff4b('0x38')]=_['keys'](db['ChatMessage'][_0xff4b('0x91')]);_0xf289eb['query']=_[_0xff4b('0x39')](_0x29a045[_0xff4b('0x36')]);_0xf289eb['filters']=_[_0xff4b('0x3b')](_0xf289eb['model'],_0xf289eb['query']);_0x48f310[_0xff4b('0x3c')]=_['intersection'](_0xf289eb[_0xff4b('0x38')],qs[_0xff4b('0x3d')](_0x29a045[_0xff4b('0x36')][_0xff4b('0x3d')]));_0x48f310[_0xff4b('0x3c')]=_0x48f310[_0xff4b('0x3c')][_0xff4b('0x3e')]?_0x48f310['attributes']:_0xf289eb['model'];if(!_0x29a045[_0xff4b('0x36')][_0xff4b('0x92')]('nolimit')){_0x48f310[_0xff4b('0x22')]=qs[_0xff4b('0x22')](_0x29a045[_0xff4b('0x36')][_0xff4b('0x22')]);_0x48f310['offset']=qs[_0xff4b('0x24')](_0x29a045[_0xff4b('0x36')][_0xff4b('0x24')]);}_0x48f310[_0xff4b('0x93')]=qs[_0xff4b('0x94')](_0x29a045[_0xff4b('0x36')][_0xff4b('0x94')]);_0x48f310[_0xff4b('0x95')]=qs[_0xff4b('0x3a')](_[_0xff4b('0x96')](_0x29a045['query'],_0xf289eb[_0xff4b('0x3a')]));_0x48f310['where'][_0xff4b('0x97')]=_0x274e18['id'];if(_0x29a045[_0xff4b('0x36')]['filter']){_0x48f310[_0xff4b('0x95')]=_[_0xff4b('0x2d')](_0x48f310[_0xff4b('0x95')],{'$or':_[_0xff4b('0x31')](_0x48f310[_0xff4b('0x3c')],function(_0x1f8f59){var _0x2af02a={};_0x2af02a[_0x1f8f59]={'$like':'%'+_0x29a045[_0xff4b('0x36')][_0xff4b('0x98')]+'%'};return _0x2af02a;})});}if(_0x29a045['query']['$gte']){var _0x583489=_0x29a045['query']['$gte'][_0xff4b('0x99')](',');var _0x18b81a={};_0x18b81a[_0x583489[0x0]]={'$gte':moment(_0x583489[0x1])[_0xff4b('0x75')](_0xff4b('0x9a'))};_0x48f310[_0xff4b('0x95')]=_[_0xff4b('0x2d')](_0x48f310[_0xff4b('0x95')],_0x18b81a);}_0x48f310=_['merge']({},_0x48f310,_0x29a045[_0xff4b('0x40')]);return db[_0xff4b('0x77')][_0xff4b('0x23')]({'where':_0x48f310[_0xff4b('0x95')]})[_0xff4b('0x26')](function(_0x737d27){_0x39ea8c[_0xff4b('0x23')]=_0x737d27;if(_0x29a045[_0xff4b('0x36')][_0xff4b('0x9b')]){_0x48f310[_0xff4b('0x3f')]=[{'all':!![]}];}return db[_0xff4b('0x77')]['findAll'](_0x48f310);})[_0xff4b('0x26')](function(_0x2e6e42){_0x39ea8c[_0xff4b('0x9c')]=_0x2e6e42;return _0x39ea8c;});}})[_0xff4b('0x26')](respondWithFilteredResult(_0xf5a831,_0x48f310))['catch'](handleError(_0xf5a831,null));};exports['getMyMessages']=function(_0x583084,_0x2ffda8){var _0x1964a3={'where':{}},_0xd6f994={},_0x219d17={'count':0x0,'rows':[]};return db[_0xff4b('0x32')]['findOne']({'where':{'id':_0x583084[_0xff4b('0x44')]['id']}})[_0xff4b('0x26')](handleEntityNotFound(_0x2ffda8,null))[_0xff4b('0x26')](function(_0x1d62d2){if(_0x1d62d2){_0xd6f994[_0xff4b('0x38')]=_[_0xff4b('0x39')](db[_0xff4b('0x77')][_0xff4b('0x91')]);_0xd6f994['query']=_[_0xff4b('0x39')](_0x583084[_0xff4b('0x36')]);_0xd6f994[_0xff4b('0x3a')]=_[_0xff4b('0x3b')](_0xd6f994[_0xff4b('0x38')],_0xd6f994['query']);_0x1964a3['attributes']=_['intersection'](_0xd6f994['model'],qs[_0xff4b('0x3d')](_0x583084['query'][_0xff4b('0x3d')]));_0x1964a3[_0xff4b('0x3c')]=_0x1964a3[_0xff4b('0x3c')][_0xff4b('0x3e')]?_0x1964a3['attributes']:_0xd6f994[_0xff4b('0x38')];if(!_0x583084[_0xff4b('0x36')][_0xff4b('0x92')](_0xff4b('0x9d'))){_0x1964a3['limit']=qs[_0xff4b('0x22')](_0x583084[_0xff4b('0x36')][_0xff4b('0x22')]);_0x1964a3[_0xff4b('0x24')]=qs['offset'](_0x583084[_0xff4b('0x36')][_0xff4b('0x24')]);}_0x1964a3[_0xff4b('0x93')]=qs['sort'](_0x583084[_0xff4b('0x36')][_0xff4b('0x94')]);_0x1964a3[_0xff4b('0x95')]=qs[_0xff4b('0x3a')](_[_0xff4b('0x96')](_0x583084[_0xff4b('0x36')],_0xd6f994[_0xff4b('0x3a')]));_0x1964a3[_0xff4b('0x95')][_0xff4b('0x97')]=_0x1d62d2['id'];if(_0x583084['query'][_0xff4b('0x98')]){_0x1964a3[_0xff4b('0x95')]=_[_0xff4b('0x2d')](_0x1964a3[_0xff4b('0x95')],{'$or':_['map'](_0x1964a3['attributes'],function(_0x4baef4){var _0x1f7493={};_0x1f7493[_0x4baef4]={'$like':'%'+_0x583084[_0xff4b('0x36')][_0xff4b('0x98')]+'%'};return _0x1f7493;})});}_0x1964a3[_0xff4b('0x95')][_0xff4b('0x83')]=![];if(_0x583084[_0xff4b('0x36')]['id']){_0x1964a3['where']['id']={'$gt':_0x583084[_0xff4b('0x36')]['id']};}_0x1964a3=_[_0xff4b('0x2d')]({},_0x1964a3,_0x583084[_0xff4b('0x40')]);return db[_0xff4b('0x77')][_0xff4b('0x23')]({'where':_0x1964a3['where']})[_0xff4b('0x26')](function(_0x5e5906){_0x219d17[_0xff4b('0x23')]=_0x5e5906;_0x1964a3[_0xff4b('0x3f')]=[];if(_0x583084['query']['includeAgent']){_0x1964a3[_0xff4b('0x3f')][_0xff4b('0x9e')]({'model':db[_0xff4b('0x79')],'as':_0xff4b('0x79'),'attributes':['id',_0xff4b('0x4e'),'alias']});}if(_0x583084[_0xff4b('0x36')][_0xff4b('0x9b')]){_0x1964a3[_0xff4b('0x3f')]=[{'all':!![]}];}return db['ChatMessage'][_0xff4b('0x34')](_0x1964a3);})['then'](function(_0x250a38){_0x219d17['rows']=_0x250a38;return _0x219d17;});}})[_0xff4b('0x26')](respondWithFilteredResult(_0x2ffda8,_0x1964a3))['catch'](handleError(_0x2ffda8,null));};exports['addTags']=function(_0x263b74,_0x255b1b){return db[_0xff4b('0x32')][_0xff4b('0x41')]({'where':{'id':_0x263b74[_0xff4b('0x44')]['id']}})['then'](handleEntityNotFound(_0x255b1b,null))[_0xff4b('0x26')](function(_0x3c6300){if(_0x3c6300){return _0x3c6300['setTags'](_0x263b74[_0xff4b('0x43')][_0xff4b('0x90')],_[_0xff4b('0x9f')](_0x263b74[_0xff4b('0x43')],[_0xff4b('0x90'),'id'])||{})[_0xff4b('0xa0')](function(){return db[_0xff4b('0xa1')][_0xff4b('0x34')]({'attributes':['id',_0xff4b('0x29'),_0xff4b('0xa2')],'where':{'id':_0x263b74[_0xff4b('0x43')][_0xff4b('0x90')]}});})['then'](function(_0x2ee8fa){socket[_0xff4b('0xa3')]('chatInteractionTags:save',{'id':Number(_0x263b74['params']['id']),'tags':_0x2ee8fa||[]});return{'id':Number(_0x263b74[_0xff4b('0x44')]['id']),'tags':_0x2ee8fa||[]};});}})[_0xff4b('0x26')](respondWithResult(_0x255b1b,null))[_0xff4b('0x1e')](handleError(_0x255b1b,null));};exports[_0xff4b('0xa4')]=function(_0x2e2f22,_0x338e6f){return db[_0xff4b('0x32')][_0xff4b('0x41')]({'where':{'id':_0x2e2f22[_0xff4b('0x44')]['id']}})[_0xff4b('0x26')](handleEntityNotFound(_0x338e6f,null))[_0xff4b('0x26')](function(_0x304b1e){if(_0x304b1e){return _0x304b1e[_0xff4b('0xa4')](_0x2e2f22['query'][_0xff4b('0x90')]);}})['then'](respondWithStatusCode(_0x338e6f,null))[_0xff4b('0x1e')](handleError(_0x338e6f,null));};exports['download']=function(_0xd65f17,_0x58a9c5){var _0xc8b5ed=moment()[_0xff4b('0xa5')]()['toString']();var _0x34c435=path[_0xff4b('0x6d')](config[_0xff4b('0x6e')],_0xff4b('0xa6'),_0xff4b('0xa7'),_0xff4b('0xa8'));var _0x37b5e2=path[_0xff4b('0x6d')](config[_0xff4b('0x6e')],_0xff4b('0xa6'),_0xff4b('0xa7'),'attachments');var _0x340887=path[_0xff4b('0x6d')](_0x34c435,_0xc8b5ed);var _0x36eab4=util[_0xff4b('0x75')](_0xff4b('0xa9'),_0xd65f17[_0xff4b('0x44')]['id'],_0xc8b5ed);var _0x1e6b3a=path['join'](_0x34c435,_0x36eab4);var _0x3542b6=[];_0x3542b6['push']({'model':db['User'],'as':_0xff4b('0x79'),'attributes':['id',_0xff4b('0x4e')],'raw':!![]});_0x3542b6[_0xff4b('0x9e')]({'model':db[_0xff4b('0x5c')],'as':'Contact','attributes':['id',_0xff4b('0xaa'),_0xff4b('0xab')],'raw':!![]});if(_0xd65f17[_0xff4b('0x36')]['attachments']){_0x3542b6['push']({'model':db[_0xff4b('0x69')],'as':_0xff4b('0x69'),'raw':!![]});}var _0x407fb7=[{'model':db[_0xff4b('0x77')],'as':_0xff4b('0x78'),'attributes':['id',_0xff4b('0x43'),_0xff4b('0xac'),_0xff4b('0xad'),'secret','read'],'include':_0x3542b6}];_0x407fb7[_0xff4b('0x9e')]({'model':db[_0xff4b('0x46')],'as':'Account','attributes':['id',_0xff4b('0x29')]});_0x407fb7[_0xff4b('0x9e')]({'model':db[_0xff4b('0x79')],'as':_0xff4b('0xae'),'attributes':['id',_0xff4b('0x4e')]});return db[_0xff4b('0x32')]['find']({'where':{'id':_0xd65f17['params']['id']},'include':_0x407fb7})[_0xff4b('0x26')](handleEntityNotFound(_0x58a9c5,null))[_0xff4b('0x26')](function(_0x31443a){if(_0x31443a){var _0x4a2f5d=_0x31443a[_0xff4b('0xaf')]({'plain':!![]});fs[_0xff4b('0xb0')](_0x340887);var _0x6ecd2e={'channel':_0xff4b('0xb1'),'account':_0x4a2f5d[_0xff4b('0xb2')][_0xff4b('0x29')],'agent':_0x4a2f5d[_0xff4b('0xae')]?_0x4a2f5d['Owner'][_0xff4b('0x4e')]:_0xff4b('0xb3'),'createdAt':moment(_0x4a2f5d[_0xff4b('0xac')])[_0xff4b('0x75')](_0xff4b('0x9a'))[_0xff4b('0xb4')](),'closedAt':_0x4a2f5d[_0xff4b('0x61')]?moment(_0x4a2f5d[_0xff4b('0xb5')])[_0xff4b('0x75')](_0xff4b('0x9a'))['toString']():'','disposition':_0x4a2f5d[_0xff4b('0x62')],'chatInfo':{'browser':_0x4a2f5d[_0xff4b('0xb6')],'os':_0x4a2f5d[_0xff4b('0xb7')],'referer':_0x4a2f5d[_0xff4b('0xb8')],'customerIp':_0x4a2f5d[_0xff4b('0xb9')],'customerPort':_0x4a2f5d[_0xff4b('0xba')]?_0x4a2f5d[_0xff4b('0xba')]:_0xff4b('0xb3')},'messages':_(_0x4a2f5d[_0xff4b('0x78')])[_0xff4b('0xbb')]()[_0xff4b('0x98')]({'secret':![]})[_0xff4b('0x31')](function(_0x205a44){if(_0x205a44[_0xff4b('0x69')]){var _0x2539bd=path[_0xff4b('0x6d')](_0x37b5e2,_0x205a44['Attachment'][_0xff4b('0x71')]);if(fs[_0xff4b('0xbc')](_0x2539bd)){fs['createReadStream'](_0x2539bd)[_0xff4b('0xbd')](fs[_0xff4b('0xbe')](path[_0xff4b('0x6d')](_0x340887,_0x205a44[_0xff4b('0x69')]['basename'])));}}return{'date':moment(_0x205a44['createdAt'])[_0xff4b('0x75')]('YYYY-MM-DD\x20HH:mm:ss')[_0xff4b('0xb4')](),'sender':_0x205a44['direction']===_0xff4b('0xbf')?_0x205a44[_0xff4b('0x79')]?_0x205a44[_0xff4b('0x79')][_0xff4b('0x4e')]:_0xff4b('0x7c'):_0x205a44['Contact'][_0xff4b('0xaa')]+(_0x205a44['Contact'][_0xff4b('0xab')]?'\x20'+_0x205a44[_0xff4b('0x5d')][_0xff4b('0xab')]:''),'body':_0x205a44[_0xff4b('0x69')]?_0x205a44['Attachment'][_0xff4b('0x71')]:_0x205a44[_0xff4b('0x43')],'direction':_0x205a44['direction']===_0xff4b('0xbf')?'A':'C','secret':_0x205a44[_0xff4b('0x83')],'read':_0x205a44[_0xff4b('0xc0')],'attachment':_0x205a44[_0xff4b('0x69')]};})['value']()};return ejs[_0xff4b('0xc1')](path['join'](config[_0xff4b('0x6e')],_0xff4b('0xa6'),'views','downloadInteraction.ejs'),{'interaction':_0x6ecd2e})[_0xff4b('0x26')](function(_0x35f36c){var _0x4838ac=path[_0xff4b('0x6d')](_0x340887,_0xff4b('0xc2')+_0x4a2f5d['id']+'-'+_0xc8b5ed+_0xff4b('0xc3'));var _0x29f3b0={'path':_0x4838ac,'channel':_0xff4b('0xb1'),'interactionId':_0x4a2f5d['id']};return pdf[_0xff4b('0xc4')](_0x35f36c,_0x29f3b0);})['then'](function(){return new Promise(function(_0x55b8ea,_0x3be294){zipdir(_0x340887,{'saveTo':_0x1e6b3a},function(_0x23a1a9,_0x268b54){if(_0x23a1a9)return _0x3be294(_0x23a1a9);return _0x55b8ea(_0x268b54);});})['then'](function(){return new BPromise(function(_0x30a756,_0x2e71bd){rimraf(_0x340887,function(_0x3c1826){if(_0x3c1826)_0x2e71bd(_0x3c1826);return _0x30a756();});});})['then'](function(){return _0x58a9c5[_0xff4b('0x72')](_0x1e6b3a,_0x36eab4,function(_0x2521f2){if(_0x2521f2){logger['error'](_0xff4b('0xc5'),_0x2521f2);}else{fs[_0xff4b('0xc6')](_0x1e6b3a);}});});});}else{return _0x58a9c5['sendStatus'](0xc8);}})['catch'](handleError(_0x58a9c5,null));}; \ No newline at end of file +var _0xca2a=['ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','options','rows','getMyMessages','nolimit','pick','push','addTags','setTags','Tag','chatInteractionTags:save','removeTags','unix','toString','files','tmp','server','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','Chat','Account','Owner','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','createReadStream','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','rimraf','zip-dir','moment','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','stack','name','render','merge','agent','interaction','account','index','map','fieldName','type','key','getOptions','findAll','chat','query','user','show','model','keys','ChatInteraction','rawAttributes','filters','attributes','length','includeAll','include','create','body','find','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','isNull','Sequelize','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','out','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','abandon','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','User','ChatWebsite','CmContact','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','agent_alias','alias','fullname','agent_fullname','createdAt','secret','appendFileSync','CloudProvider','SendMail','sendMail','\x22%s\x22\x20<%s>','Smtp','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','intersection','fields','hasOwnProperty','sort','where'];(function(_0x479650,_0x2bee99){var _0x26b288=function(_0x1ba49f){while(--_0x1ba49f){_0x479650['push'](_0x479650['shift']());}};_0x26b288(++_0x2bee99);}(_0xca2a,0x1be));var _0xaca2=function(_0x5024d7,_0x784883){_0x5024d7=_0x5024d7-0x0;var _0x19c8af=_0xca2a[_0x5024d7];return _0x19c8af;};'use strict';var rimraf=require(_0xaca2('0x0'));var zipdir=require(_0xaca2('0x1'));var rp=require('request-promise');var moment=require(_0xaca2('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xaca2('0x3'));var util=require(_0xaca2('0x4'));var path=require(_0xaca2('0x5'));var ejs=require(_0xaca2('0x6'));var fs=require('fs');var _=require(_0xaca2('0x7'));var Redis=require(_0xaca2('0x8'));var interaction=require(_0xaca2('0x9'));var qs=require(_0xaca2('0xa'));var pdf=require(_0xaca2('0xb'));var logger=require(_0xaca2('0xc'))(_0xaca2('0xd'));var config=require(_0xaca2('0xe'));var db=require(_0xaca2('0xf'))['db'];config[_0xaca2('0x10')]=_[_0xaca2('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xaca2('0x12'))(new Redis(config[_0xaca2('0x10')]));require('./chatInteraction.socket')[_0xaca2('0x13')](socket);var jayson=require(_0xaca2('0x14'));var client=jayson[_0xaca2('0x15')][_0xaca2('0x16')]({'port':0x232b});var client9004=jayson[_0xaca2('0x15')][_0xaca2('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x237267,_0x36bcec,_0x3eeb15,_0x2e81ff){return new BPromise(function(_0x3e111e,_0x18d053){var _0x451c8b=_0x2e81ff||client;return _0x451c8b['request'](_0x237267,_0x3eeb15)[_0xaca2('0x17')](function(_0xda1a85){logger[_0xaca2('0x18')](_0xaca2('0x19'),_0x36bcec,_0xaca2('0x1a'));logger[_0xaca2('0x1b')](_0xaca2('0x1c'),_0x36bcec,_0xaca2('0x1a'),JSON['stringify'](_0xda1a85));if(_0xda1a85['error']){if(_0xda1a85[_0xaca2('0x1d')]['code']===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x36bcec,_0xda1a85[_0xaca2('0x1d')][_0xaca2('0x1e')]);return _0x18d053(_0xda1a85['error'][_0xaca2('0x1e')]);}logger[_0xaca2('0x1d')](_0xaca2('0x19'),_0x36bcec,_0xda1a85[_0xaca2('0x1d')][_0xaca2('0x1e')]);return _0x3e111e(_0xda1a85[_0xaca2('0x1d')][_0xaca2('0x1e')]);}else{logger[_0xaca2('0x18')](_0xaca2('0x19'),_0x36bcec,_0xaca2('0x1a'));_0x3e111e(_0xda1a85[_0xaca2('0x1f')][_0xaca2('0x1e')]);}})[_0xaca2('0x20')](function(_0x3b6afe){logger[_0xaca2('0x1d')](_0xaca2('0x19'),_0x36bcec,_0x3b6afe);_0x18d053(_0x3b6afe);});});}function respondWithStatusCode(_0x2906c8,_0x4dce56){_0x4dce56=_0x4dce56||0xcc;return function(_0x2261b0){if(_0x2261b0){return _0x2906c8[_0xaca2('0x21')](_0x4dce56);}return _0x2906c8[_0xaca2('0x22')](_0x4dce56)[_0xaca2('0x23')]();};}function respondWithResult(_0x1779b4,_0x307092){_0x307092=_0x307092||0xc8;return function(_0x12890c){if(_0x12890c){return _0x1779b4[_0xaca2('0x22')](_0x307092)[_0xaca2('0x24')](_0x12890c);}};}function respondWithFilteredResult(_0x395dd8,_0x283472){return function(_0x28ee8a){if(_0x28ee8a){var _0x15c75a=typeof _0x283472[_0xaca2('0x25')]===_0xaca2('0x26')&&typeof _0x283472[_0xaca2('0x27')]===_0xaca2('0x26');var _0x376e94=_0x28ee8a['count'];var _0x6a7b87=_0x15c75a?0x0:_0x283472['offset'];var _0xb4657f=_0x15c75a?_0x28ee8a[_0xaca2('0x28')]:_0x283472[_0xaca2('0x25')]+_0x283472[_0xaca2('0x27')];var _0x3fdc07;if(_0xb4657f>=_0x376e94){_0xb4657f=_0x376e94;_0x3fdc07=0xc8;}else{_0x3fdc07=0xce;}_0x395dd8[_0xaca2('0x22')](_0x3fdc07);return _0x395dd8[_0xaca2('0x29')](_0xaca2('0x2a'),_0x6a7b87+'-'+_0xb4657f+'/'+_0x376e94)['json'](_0x28ee8a);}return null;};}function saveUpdates(_0x3a36a1){return function(_0xc6cd42){if(_0xc6cd42){return _0xc6cd42['update'](_0x3a36a1)['then'](function(_0x1b74f2){return _0x1b74f2;});}return null;};}function removeEntity(_0x7f30ad){return function(_0x5dd503){if(_0x5dd503){return _0x5dd503[_0xaca2('0x2b')]()[_0xaca2('0x17')](function(){_0x7f30ad[_0xaca2('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a0441){return function(_0x42be0a){if(!_0x42be0a){_0x4a0441[_0xaca2('0x21')](0x194);}return _0x42be0a;};}function handleError(_0x271373,_0x1edc59){_0x1edc59=_0x1edc59||0x1f4;return function(_0x5d2dc0){logger[_0xaca2('0x1d')](_0x5d2dc0[_0xaca2('0x2c')]);if(_0x5d2dc0['name']){delete _0x5d2dc0[_0xaca2('0x2d')];}_0x271373[_0xaca2('0x22')](_0x1edc59)['send'](_0x5d2dc0);};}function getMustacheRender(_0x4357a2,_0x1adbd5){return Mustache[_0xaca2('0x2e')](_0x4357a2,_[_0xaca2('0x2f')](_0x1adbd5['body'],{'contact':_0x1adbd5['contact'],'message':_0x1adbd5[_0xaca2('0x1e')],'agent':_0x1adbd5[_0xaca2('0x30')],'interaction':_0x1adbd5[_0xaca2('0x31')],'account':_0x1adbd5[_0xaca2('0x32')]}))||'';}exports[_0xaca2('0x33')]=function(_0x377090,_0x18b242){var _0x8b31af={};var _0x27c88d=_[_0xaca2('0x34')](db['ChatInteraction']['rawAttributes'],function(_0x188551){return{'name':_0x188551[_0xaca2('0x35')],'type':_0x188551[_0xaca2('0x36')][_0xaca2('0x37')]};});_0x8b31af=qs[_0xaca2('0x38')](_0x27c88d,_0x377090);return interaction[_0xaca2('0x39')](_0xaca2('0x3a'),_0x377090[_0xaca2('0x3b')],_0x377090[_0xaca2('0x3c')],_0x8b31af,_0x27c88d)['then'](respondWithFilteredResult(_0x18b242,_0x8b31af))[_0xaca2('0x20')](handleError(_0x18b242,null));};exports[_0xaca2('0x3d')]=function(_0x5def1d,_0x263cc6){var _0x3b0bcf={'raw':![],'where':{'id':_0x5def1d['params']['id']}},_0x2d3300={};_0x2d3300[_0xaca2('0x3e')]=_[_0xaca2('0x3f')](db[_0xaca2('0x40')][_0xaca2('0x41')]);_0x2d3300[_0xaca2('0x3b')]=_[_0xaca2('0x3f')](_0x5def1d['query']);_0x2d3300[_0xaca2('0x42')]=_['intersection'](_0x2d3300[_0xaca2('0x3e')],_0x2d3300['query']);_0x3b0bcf[_0xaca2('0x43')]=_['intersection'](_0x2d3300[_0xaca2('0x3e')],qs['fields'](_0x5def1d['query']['fields']));_0x3b0bcf['attributes']=_0x3b0bcf[_0xaca2('0x43')][_0xaca2('0x44')]?_0x3b0bcf['attributes']:_0x2d3300[_0xaca2('0x3e')];if(_0x5def1d[_0xaca2('0x3b')][_0xaca2('0x45')]){_0x3b0bcf[_0xaca2('0x46')]=[{'all':!![]}];}_0x3b0bcf=_['merge']({},_0x3b0bcf,_0x5def1d['options']);return db[_0xaca2('0x40')]['find'](_0x3b0bcf)[_0xaca2('0x17')](handleEntityNotFound(_0x263cc6,null))['then'](respondWithResult(_0x263cc6,null))['catch'](handleError(_0x263cc6,null));};exports['create']=function(_0x5cf2a8,_0x5010d1){return db[_0xaca2('0x40')][_0xaca2('0x47')](_0x5cf2a8[_0xaca2('0x48')],{})[_0xaca2('0x17')](respondWithResult(_0x5010d1,0xc9))[_0xaca2('0x20')](handleError(_0x5010d1,null));};exports['update']=function(_0x348124,_0x111e9e){if(_0x348124[_0xaca2('0x48')]['id']){delete _0x348124['body']['id'];}return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0x348124[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x111e9e,null))['then'](saveUpdates(_0x348124[_0xaca2('0x48')],null))[_0xaca2('0x17')](respondWithResult(_0x111e9e,null))[_0xaca2('0x20')](handleError(_0x111e9e,null));};exports['destroy']=function(_0x523582,_0x34c851){return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0x523582[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x34c851,null))['then'](removeEntity(_0x34c851,null))['catch'](handleError(_0x34c851,null));};exports['describe']=function(_0x594559,_0x2c9cbb){return db[_0xaca2('0x40')][_0xaca2('0x4b')]()[_0xaca2('0x17')](respondWithResult(_0x2c9cbb,null))[_0xaca2('0x20')](handleError(_0x2c9cbb,null));};exports[_0xaca2('0x4c')]=function(_0x2e150a,_0x1f3727){var _0x5b72be=_0x2e150a[_0xaca2('0x4a')]['id'];var _0x48c2fa;var _0x21a52f;var _0x4bba50;return db[_0xaca2('0x40')][_0xaca2('0x4d')]({'where':{'id':_0x5b72be}})[_0xaca2('0x17')](function(_0x56f1c0){_0x48c2fa=_0x56f1c0;return db['ChatWebsite'][_0xaca2('0x4d')]({'where':{'id':_0x56f1c0[_0xaca2('0x4e')]},'attributes':['id','vidaooApiKey',_0xaca2('0x4f'),_0xaca2('0x50'),_0xaca2('0x51'),_0xaca2('0x52')],'raw':!![]});})[_0xaca2('0x17')](function(_0xa1926e){if(_0xa1926e&&_0xa1926e['vidaooApiKey']&&_0xa1926e[_0xaca2('0x4f')]){_0x21a52f=_0xa1926e;var _0x4b273={'interaction':{'id':_0x5b72be},'agent':{'id':_0x2e150a['user']['id'],'name':_0x2e150a[_0xaca2('0x3c')][_0xaca2('0x2d')],'fullname':_0x2e150a[_0xaca2('0x3c')]['fullname'],'email':_0x2e150a[_0xaca2('0x3c')]['email']},'contact':_0x2e150a[_0xaca2('0x48')][_0xaca2('0x53')],'account':_0x2e150a[_0xaca2('0x48')]['account']};var _0xd96649={'rejectUnauthorized':![],'method':_0xaca2('0x54'),'url':_0xaca2('0x55'),'headers':{'X-APIKEY':_0xa1926e[_0xaca2('0x56')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2e150a[_0xaca2('0x3c')][_0xaca2('0x57')]],'buttons':null,'topic':_0x21a52f[_0xaca2('0x50')],'note':_[_0xaca2('0x58')](_0x21a52f[_0xaca2('0x51')])?null:getMustacheRender(_0x21a52f[_0xaca2('0x51')],_0x4b273),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xaca2('0x58')](_0x21a52f['vidaooMetadata'])){var _0x12b595=getMustacheRender(_0x21a52f['vidaooMetadata'],_0x4b273);var _0xcb0ba1=JSON['parse'](_0x12b595);_0xd96649[_0xaca2('0x48')]['metadata']=_0xcb0ba1;}}catch(_0xe9b994){throw new db[(_0xaca2('0x59'))][(_0xaca2('0x5a'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xd96649);}else{throw new db[(_0xaca2('0x59'))]['ValidationError'](_0xaca2('0x5b'));}})[_0xaca2('0x17')](function(_0x1762d7){_0x4bba50=_0x1762d7;if(_0x4bba50['id']){var _0xb1e07a={'body':_0x4bba50[_0xaca2('0x5c')],'ChatWebsiteId':_0x21a52f['id'],'ChatInteractionId':_0x48c2fa['id'],'direction':_0xaca2('0x5d'),'UserId':_0x2e150a[_0xaca2('0x3c')]['id']};return db['ChatMessage'][_0xaca2('0x47')](_0xb1e07a,{});}else{throw new db[(_0xaca2('0x59'))][(_0xaca2('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xaca2('0x17')](function(){return _0x48c2fa[_0xaca2('0x5e')]({'vidaooSessionId':_0x4bba50['id']});})['then'](respondWithResult(_0x1f3727,null))[_0xaca2('0x20')](handleError(_0x1f3727,null));};exports[_0xaca2('0x5f')]=function(_0x2f6802,_0x2d3de8){if(_0x2f6802['body']['id']){delete _0x2f6802[_0xaca2('0x48')]['id'];}return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0x2f6802[_0xaca2('0x4a')]['id']},'include':[{'model':db['CmContact'],'as':_0xaca2('0x60')}]})[_0xaca2('0x17')](handleEntityNotFound(_0x2d3de8,null))[_0xaca2('0x17')](saveUpdates(_0x2f6802['body'],null))[_0xaca2('0x17')](respondWithResult(_0x2d3de8,null))[_0xaca2('0x20')](handleError(_0x2d3de8,null));};exports['abandon']=function(_0xb6033f,_0x39556f){if(_0xb6033f['body']['id']){delete _0xb6033f['body']['id'];}return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0xb6033f[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](function(_0x1f8897){if(!_0x1f8897){logger['error'](_0xaca2('0x61'),'abandon',0x194,_0xaca2('0x62'));_0x39556f['sendStatus'](0x194);}else{if(_0x1f8897[_0xaca2('0x63')]){throw new db[(_0xaca2('0x59'))][(_0xaca2('0x5a'))](_0xaca2('0x64'));}}return _0x1f8897;})[_0xaca2('0x17')](function(_0xdde30){if(_0xdde30){return _0xdde30['update']({'closed':_0xb6033f['body'][_0xaca2('0x65')],'disposition':_0xb6033f[_0xaca2('0x48')][_0xaca2('0x66')]})[_0xaca2('0x17')](function(_0x3bd92f){return _0x3bd92f;});}})[_0xaca2('0x17')](function(){return respondWithRpcPromise(_0xaca2('0x67'),_0xaca2('0x68'),_0xb6033f['body'],client9004);})['then'](respondWithResult(_0x39556f,null))[_0xaca2('0x20')](handleError(_0x39556f,null));};exports[_0xaca2('0x69')]=function(_0x15c89b,_0x1f8a68){_0x15c89b[_0xaca2('0x48')][_0xaca2('0x2d')]=_0x15c89b[_0xaca2('0x6a')][_0xaca2('0x6b')];_0x15c89b[_0xaca2('0x48')][_0xaca2('0x6c')]=_0x15c89b['file'][_0xaca2('0x6d')];_0x15c89b[_0xaca2('0x48')]['type']=_0x15c89b[_0xaca2('0x6a')][_0xaca2('0x6e')];return db[_0xaca2('0x6f')]['create'](_0x15c89b[_0xaca2('0x48')])[_0xaca2('0x17')](respondWithResult(_0x1f8a68,0xc9))[_0xaca2('0x20')](handleError(_0x1f8a68,null));};exports['attachmentDownload']=function(_0x5e3e00,_0x469a31){return db['ChatInteraction']['findOne']({'where':{'id':_0x5e3e00[_0xaca2('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x469a31,null))[_0xaca2('0x17')](function(_0x5b5354){if(_0x5b5354){if(_0x5b5354[_0xaca2('0x65')]){return _0x469a31['status'](0x193)['json']({'status':0x193,'message':_0xaca2('0x70')});}return db[_0xaca2('0x6f')][_0xaca2('0x4d')]({'where':{'id':_0x5e3e00[_0xaca2('0x3b')][_0xaca2('0x71')]},'raw':!![]})[_0xaca2('0x17')](handleEntityNotFound(_0x469a31,null));}})[_0xaca2('0x17')](function(_0x49ee60){if(_0x49ee60){var _0x52c7b0=_0x49ee60['ChatOfflineMessageId']!==null;var _0x512c3e=path[_0xaca2('0x72')](config[_0xaca2('0x73')],_0xaca2('0x74'));if(_0x52c7b0){_0x512c3e=path[_0xaca2('0x72')](_0x512c3e,_0xaca2('0x75'));}var _0x490c07=path['join'](_0x512c3e,_0x49ee60[_0xaca2('0x6c')]);return _0x469a31[_0xaca2('0x76')](_0x490c07);}})[_0xaca2('0x20')](handleError(_0x469a31,null));};exports['close']=function(_0x1ba197,_0x3def79){var _0x3ffd5c=null;var _0x471bec=null;var _0x25161e=null;if(_0x1ba197['body']['id']){delete _0x1ba197[_0xaca2('0x48')]['id'];}if(_0x1ba197[_0xaca2('0x48')][_0xaca2('0x77')]){_0x25161e=path[_0xaca2('0x72')](config[_0xaca2('0x73')],_0xaca2('0x78'),util[_0xaca2('0x79')](_0xaca2('0x7a'),Date[_0xaca2('0x7b')]()));_0x1ba197[_0xaca2('0x48')][_0xaca2('0x7c')]=_0x25161e;}return db[_0xaca2('0x40')]['find']({'where':{'id':_0x1ba197[_0xaca2('0x4a')]['id']},'include':[{'model':db[_0xaca2('0x7d')],'as':'Messages','include':[{'model':db[_0xaca2('0x7e')],'as':_0xaca2('0x7e')}]}]})['then'](handleEntityNotFound(_0x3def79,null))[_0xaca2('0x17')](saveUpdates(_0x1ba197[_0xaca2('0x48')],null))[_0xaca2('0x17')](function(_0x31e05a){if(_0x31e05a){_0x3ffd5c=_0x31e05a;return db[_0xaca2('0x7f')]['find']({'where':{'id':_0x3ffd5c[_0xaca2('0x4e')]}});}})[_0xaca2('0x17')](function(_0x54a963){if(_0x54a963){_0x471bec=_0x54a963;return db[_0xaca2('0x80')][_0xaca2('0x49')]({'where':{'id':_0x3ffd5c['ContactId']}});}})[_0xaca2('0x17')](function(_0x7459be){if(_0x7459be){if(_0x25161e){var _0x742027=null;for(var _0xfebcf0=0x1;_0xfebcf0<_0x3ffd5c[_0xaca2('0x81')][_0xaca2('0x44')];++_0xfebcf0){_0x742027=_0x3ffd5c[_0xaca2('0x81')][_0xfebcf0];var _0x40d032=_0x742027['UserId']?util[_0xaca2('0x79')](_0xaca2('0x82'),_0x471bec[_0xaca2('0x83')],_0x742027[_0xaca2('0x63')]):'System';var _0x4edabe=_0x1ba197['body'][_0xaca2('0x84')]||util[_0xaca2('0x79')](_0xaca2('0x82'),_0xaca2('0x85'),_0x742027['ContactId']);switch(_0x471bec[_0xaca2('0x86')]){case'website_alias':_0x40d032=_0x742027[_0xaca2('0x63')]?util['format'](_0xaca2('0x82'),_0x471bec[_0xaca2('0x83')],_0x742027[_0xaca2('0x63')]):_0xaca2('0x87');break;case _0xaca2('0x88'):_0x40d032=_0x742027['UserId']?_0x742027[_0xaca2('0x7e')][_0xaca2('0x89')]||_0x742027[_0xaca2('0x7e')][_0xaca2('0x8a')]:_0xaca2('0x87');break;case _0xaca2('0x8b'):_0x40d032=_0x742027[_0xaca2('0x63')]?_0x742027['User'][_0xaca2('0x8a')]:'System';break;default:_0x40d032=_0x742027[_0xaca2('0x63')]?util['format'](_0xaca2('0x82'),_0x471bec[_0xaca2('0x83')],_0x742027[_0xaca2('0x63')]):'System';}var _0xed6f3a=util[_0xaca2('0x79')]('[%s]\x20%s:\x20%s\x0a',moment(_0x742027[_0xaca2('0x8c')])[_0xaca2('0x79')]('MM/DD/YYYY\x20HH:mm:ss'),_0x742027['direction']==='in'?_0x4edabe:_0x40d032,_0x742027[_0xaca2('0x48')]);if(!_0x742027[_0xaca2('0x8d')]){fs[_0xaca2('0x8e')](_0x25161e,_0xed6f3a);}}return db['MailAccount'][_0xaca2('0x4d')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xaca2('0x8f')],'as':_0xaca2('0x8f'),'raw':!![]}]}]});}}})[_0xaca2('0x17')](function(_0x16c2bf){if(!_0x16c2bf||!_0x16c2bf['Smtp']||!_0x1ba197[_0xaca2('0x48')])return _0x3ffd5c;var _0x512ef4=_0x16c2bf['getSmtpOptions']();return respondWithRpcPromise(_0xaca2('0x90'),_0xaca2('0x91'),{'account':_0x512ef4,'message':{'from':util[_0xaca2('0x79')](_0xaca2('0x92'),_0x16c2bf['name'],_0x16c2bf[_0xaca2('0x57')]||_0x16c2bf[_0xaca2('0x93')][_0xaca2('0x3c')]),'to':_0x1ba197[_0xaca2('0x48')][_0xaca2('0x77')],'subject':_0xaca2('0x94'),'text':util['format'](_0xaca2('0x95'),_0x1ba197[_0xaca2('0x48')][_0xaca2('0x77')]),'attachments':[{'path':_0x25161e}]}})['then'](function(){return _0x3ffd5c;})['catch'](function(_0x520f4c){logger['error'](_0x520f4c);});})[_0xaca2('0x17')](respondWithStatusCode(_0x3def79,0xc8))[_0xaca2('0x20')](handleError(_0x3def79,null));};exports[_0xaca2('0x96')]=function(_0x313f21,_0x5a480b){return db['ChatMessage']['find']({'where':{'id':_0x313f21[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x5a480b,null))['then'](function(_0x1cb233){if(_0x1cb233){return _0x1cb233[_0xaca2('0x96')](_0x313f21[_0xaca2('0x48')][_0xaca2('0x97')],_['omit'](_0x313f21[_0xaca2('0x48')],['ids','id'])||{});}})['then'](respondWithResult(_0x5a480b,null))[_0xaca2('0x20')](handleError(_0x5a480b,null));};exports['getMessages']=function(_0x4cfed2,_0x3e1834){var _0x38c562={'raw':![],'where':{}};var _0x96da20={};var _0x429711={'count':0x0,'rows':[]};return db[_0xaca2('0x40')]['findOne']({'where':{'id':_0x4cfed2[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x3e1834,null))['then'](function(_0x46803a){if(_0x46803a){_0x96da20[_0xaca2('0x3e')]=_[_0xaca2('0x3f')](db[_0xaca2('0x7d')][_0xaca2('0x41')]);_0x96da20[_0xaca2('0x3b')]=_[_0xaca2('0x3f')](_0x4cfed2[_0xaca2('0x3b')]);_0x96da20[_0xaca2('0x42')]=_['intersection'](_0x96da20['model'],_0x96da20[_0xaca2('0x3b')]);_0x38c562['attributes']=_[_0xaca2('0x98')](_0x96da20[_0xaca2('0x3e')],qs[_0xaca2('0x99')](_0x4cfed2['query'][_0xaca2('0x99')]));_0x38c562[_0xaca2('0x43')]=_0x38c562[_0xaca2('0x43')][_0xaca2('0x44')]?_0x38c562[_0xaca2('0x43')]:_0x96da20[_0xaca2('0x3e')];if(!_0x4cfed2['query'][_0xaca2('0x9a')]('nolimit')){_0x38c562[_0xaca2('0x27')]=qs[_0xaca2('0x27')](_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x27')]);_0x38c562[_0xaca2('0x25')]=qs[_0xaca2('0x25')](_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x25')]);}_0x38c562['order']=qs[_0xaca2('0x9b')](_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x9b')]);_0x38c562['where']=qs[_0xaca2('0x42')](_['pick'](_0x4cfed2[_0xaca2('0x3b')],_0x96da20[_0xaca2('0x42')]));_0x38c562[_0xaca2('0x9c')][_0xaca2('0x9d')]=_0x46803a['id'];if(_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x9e')]){_0x38c562[_0xaca2('0x9c')]=_[_0xaca2('0x2f')](_0x38c562[_0xaca2('0x9c')],{'$or':_[_0xaca2('0x34')](_0x38c562[_0xaca2('0x43')],function(_0x249a28){var _0x374a80={};_0x374a80[_0x249a28]={'$like':'%'+_0x4cfed2['query'][_0xaca2('0x9e')]+'%'};return _0x374a80;})});}if(_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x9f')]){var _0x4f0ff8=_0x4cfed2['query'][_0xaca2('0x9f')]['split'](',');var _0x461a51={};_0x461a51[_0x4f0ff8[0x0]]={'$gte':moment(_0x4f0ff8[0x1])['format'](_0xaca2('0xa0'))};_0x38c562[_0xaca2('0x9c')]=_[_0xaca2('0x2f')](_0x38c562[_0xaca2('0x9c')],_0x461a51);}_0x38c562=_['merge']({},_0x38c562,_0x4cfed2[_0xaca2('0xa1')]);return db[_0xaca2('0x7d')][_0xaca2('0x28')]({'where':_0x38c562[_0xaca2('0x9c')]})['then'](function(_0x516a20){_0x429711[_0xaca2('0x28')]=_0x516a20;if(_0x4cfed2[_0xaca2('0x3b')][_0xaca2('0x45')]){_0x38c562[_0xaca2('0x46')]=[{'all':!![]}];}return db[_0xaca2('0x7d')][_0xaca2('0x39')](_0x38c562);})[_0xaca2('0x17')](function(_0x404c81){_0x429711[_0xaca2('0xa2')]=_0x404c81;return _0x429711;});}})[_0xaca2('0x17')](respondWithFilteredResult(_0x3e1834,_0x38c562))['catch'](handleError(_0x3e1834,null));};exports[_0xaca2('0xa3')]=function(_0x1b2d77,_0x29cd63){var _0x5909e0={'where':{}},_0x796965={},_0x15d2b8={'count':0x0,'rows':[]};return db[_0xaca2('0x40')]['findOne']({'where':{'id':_0x1b2d77[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x29cd63,null))['then'](function(_0x2ec2ba){if(_0x2ec2ba){_0x796965[_0xaca2('0x3e')]=_[_0xaca2('0x3f')](db[_0xaca2('0x7d')]['rawAttributes']);_0x796965['query']=_[_0xaca2('0x3f')](_0x1b2d77[_0xaca2('0x3b')]);_0x796965[_0xaca2('0x42')]=_[_0xaca2('0x98')](_0x796965['model'],_0x796965[_0xaca2('0x3b')]);_0x5909e0[_0xaca2('0x43')]=_[_0xaca2('0x98')](_0x796965[_0xaca2('0x3e')],qs[_0xaca2('0x99')](_0x1b2d77[_0xaca2('0x3b')][_0xaca2('0x99')]));_0x5909e0[_0xaca2('0x43')]=_0x5909e0[_0xaca2('0x43')][_0xaca2('0x44')]?_0x5909e0[_0xaca2('0x43')]:_0x796965['model'];if(!_0x1b2d77[_0xaca2('0x3b')][_0xaca2('0x9a')](_0xaca2('0xa4'))){_0x5909e0['limit']=qs['limit'](_0x1b2d77[_0xaca2('0x3b')]['limit']);_0x5909e0[_0xaca2('0x25')]=qs['offset'](_0x1b2d77[_0xaca2('0x3b')]['offset']);}_0x5909e0['order']=qs[_0xaca2('0x9b')](_0x1b2d77['query']['sort']);_0x5909e0[_0xaca2('0x9c')]=qs[_0xaca2('0x42')](_[_0xaca2('0xa5')](_0x1b2d77[_0xaca2('0x3b')],_0x796965[_0xaca2('0x42')]));_0x5909e0[_0xaca2('0x9c')][_0xaca2('0x9d')]=_0x2ec2ba['id'];if(_0x1b2d77[_0xaca2('0x3b')]['filter']){_0x5909e0[_0xaca2('0x9c')]=_['merge'](_0x5909e0[_0xaca2('0x9c')],{'$or':_[_0xaca2('0x34')](_0x5909e0[_0xaca2('0x43')],function(_0xb38041){var _0x5e11d9={};_0x5e11d9[_0xb38041]={'$like':'%'+_0x1b2d77[_0xaca2('0x3b')]['filter']+'%'};return _0x5e11d9;})});}_0x5909e0[_0xaca2('0x9c')]['secret']=![];if(_0x1b2d77[_0xaca2('0x3b')]['id']){_0x5909e0[_0xaca2('0x9c')]['id']={'$gt':_0x1b2d77[_0xaca2('0x3b')]['id']};}_0x5909e0=_[_0xaca2('0x2f')]({},_0x5909e0,_0x1b2d77[_0xaca2('0xa1')]);return db[_0xaca2('0x7d')][_0xaca2('0x28')]({'where':_0x5909e0['where']})['then'](function(_0x455b81){_0x15d2b8[_0xaca2('0x28')]=_0x455b81;_0x5909e0[_0xaca2('0x46')]=[];if(_0x1b2d77[_0xaca2('0x3b')]['includeAgent']){_0x5909e0[_0xaca2('0x46')][_0xaca2('0xa6')]({'model':db['User'],'as':'User','attributes':['id',_0xaca2('0x8a'),'alias']});}if(_0x1b2d77[_0xaca2('0x3b')][_0xaca2('0x45')]){_0x5909e0['include']=[{'all':!![]}];}return db[_0xaca2('0x7d')]['findAll'](_0x5909e0);})[_0xaca2('0x17')](function(_0x5cdb94){_0x15d2b8['rows']=_0x5cdb94;return _0x15d2b8;});}})[_0xaca2('0x17')](respondWithFilteredResult(_0x29cd63,_0x5909e0))[_0xaca2('0x20')](handleError(_0x29cd63,null));};exports[_0xaca2('0xa7')]=function(_0x52baab,_0x546cd0){return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0x52baab[_0xaca2('0x4a')]['id']}})[_0xaca2('0x17')](handleEntityNotFound(_0x546cd0,null))[_0xaca2('0x17')](function(_0x4e564e){if(_0x4e564e){return _0x4e564e[_0xaca2('0xa8')](_0x52baab[_0xaca2('0x48')][_0xaca2('0x97')],_['omit'](_0x52baab[_0xaca2('0x48')],[_0xaca2('0x97'),'id'])||{})['spread'](function(){return db[_0xaca2('0xa9')][_0xaca2('0x39')]({'attributes':['id',_0xaca2('0x2d'),'color'],'where':{'id':_0x52baab['body'][_0xaca2('0x97')]}});})[_0xaca2('0x17')](function(_0x341445){socket['emit'](_0xaca2('0xaa'),{'id':Number(_0x52baab[_0xaca2('0x4a')]['id']),'tags':_0x341445||[]});return{'id':Number(_0x52baab['params']['id']),'tags':_0x341445||[]};});}})['then'](respondWithResult(_0x546cd0,null))['catch'](handleError(_0x546cd0,null));};exports[_0xaca2('0xab')]=function(_0x1b0166,_0x3d9ad0){return db[_0xaca2('0x40')][_0xaca2('0x49')]({'where':{'id':_0x1b0166[_0xaca2('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d9ad0,null))['then'](function(_0x5dcdf0){if(_0x5dcdf0){return _0x5dcdf0[_0xaca2('0xab')](_0x1b0166[_0xaca2('0x3b')][_0xaca2('0x97')]);}})[_0xaca2('0x17')](respondWithStatusCode(_0x3d9ad0,null))['catch'](handleError(_0x3d9ad0,null));};exports[_0xaca2('0x76')]=function(_0x2c3cef,_0x565050){var _0x368a1c=moment()[_0xaca2('0xac')]()[_0xaca2('0xad')]();var _0x58fd7e=path[_0xaca2('0x72')](config[_0xaca2('0x73')],'server',_0xaca2('0xae'),_0xaca2('0xaf'));var _0xfcd60a=path[_0xaca2('0x72')](config[_0xaca2('0x73')],_0xaca2('0xb0'),_0xaca2('0xae'),_0xaca2('0xb1'));var _0x4465ea=path['join'](_0x58fd7e,_0x368a1c);var _0x223f6f=util[_0xaca2('0x79')](_0xaca2('0xb2'),_0x2c3cef['params']['id'],_0x368a1c);var _0x126859=path[_0xaca2('0x72')](_0x58fd7e,_0x223f6f);var _0x580db3=[];_0x580db3[_0xaca2('0xa6')]({'model':db['User'],'as':_0xaca2('0x7e'),'attributes':['id','fullname'],'raw':!![]});_0x580db3[_0xaca2('0xa6')]({'model':db[_0xaca2('0x80')],'as':_0xaca2('0x60'),'attributes':['id',_0xaca2('0xb3'),_0xaca2('0xb4')],'raw':!![]});if(_0x2c3cef[_0xaca2('0x3b')][_0xaca2('0xb1')]){_0x580db3['push']({'model':db[_0xaca2('0x6f')],'as':_0xaca2('0x6f'),'raw':!![]});}var _0x5677eb=[{'model':db[_0xaca2('0x7d')],'as':_0xaca2('0x81'),'attributes':['id','body','createdAt',_0xaca2('0xb5'),_0xaca2('0x8d'),_0xaca2('0xb6')],'include':_0x580db3}];_0x5677eb[_0xaca2('0xa6')]({'model':db[_0xaca2('0x7f')],'as':'Account','attributes':['id',_0xaca2('0x2d')]});_0x5677eb[_0xaca2('0xa6')]({'model':db[_0xaca2('0x7e')],'as':'Owner','attributes':['id',_0xaca2('0x8a')]});return db['ChatInteraction']['find']({'where':{'id':_0x2c3cef[_0xaca2('0x4a')]['id']},'include':_0x5677eb})[_0xaca2('0x17')](handleEntityNotFound(_0x565050,null))[_0xaca2('0x17')](function(_0x368840){if(_0x368840){var _0x32b9bc=_0x368840['get']({'plain':!![]});fs['mkdirSync'](_0x4465ea);var _0x5331fa={'channel':_0xaca2('0xb7'),'account':_0x32b9bc[_0xaca2('0xb8')][_0xaca2('0x2d')],'agent':_0x32b9bc['Owner']?_0x32b9bc[_0xaca2('0xb9')][_0xaca2('0x8a')]:_0xaca2('0xba'),'createdAt':moment(_0x32b9bc['createdAt'])[_0xaca2('0x79')](_0xaca2('0xa0'))[_0xaca2('0xad')](),'closedAt':_0x32b9bc[_0xaca2('0x65')]?moment(_0x32b9bc['closedAt'])[_0xaca2('0x79')](_0xaca2('0xa0'))['toString']():'','disposition':_0x32b9bc[_0xaca2('0x66')],'chatInfo':{'browser':_0x32b9bc[_0xaca2('0xbb')],'os':_0x32b9bc['osName'],'referer':_0x32b9bc[_0xaca2('0xbc')],'customerIp':_0x32b9bc[_0xaca2('0xbd')],'customerPort':_0x32b9bc['customerPort']?_0x32b9bc[_0xaca2('0xbe')]:'N.A.'},'messages':_(_0x32b9bc[_0xaca2('0x81')])[_0xaca2('0xbf')]()['filter']({'secret':![]})[_0xaca2('0x34')](function(_0x5b3946){if(_0x5b3946[_0xaca2('0x6f')]){var _0x4012a9=path[_0xaca2('0x72')](_0xfcd60a,_0x5b3946[_0xaca2('0x6f')][_0xaca2('0x6c')]);if(fs[_0xaca2('0xc0')](_0x4012a9)){fs[_0xaca2('0xc1')](_0x4012a9)['pipe'](fs['createWriteStream'](path[_0xaca2('0x72')](_0x4465ea,_0x5b3946['Attachment']['basename'])));}}return{'date':moment(_0x5b3946[_0xaca2('0x8c')])[_0xaca2('0x79')](_0xaca2('0xa0'))[_0xaca2('0xad')](),'sender':_0x5b3946[_0xaca2('0xb5')]==='out'?_0x5b3946[_0xaca2('0x7e')]?_0x5b3946[_0xaca2('0x7e')][_0xaca2('0x8a')]:_0xaca2('0x87'):_0x5b3946['Contact'][_0xaca2('0xb3')]+(_0x5b3946[_0xaca2('0x60')][_0xaca2('0xb4')]?'\x20'+_0x5b3946[_0xaca2('0x60')][_0xaca2('0xb4')]:''),'body':_0x5b3946[_0xaca2('0x6f')]?_0x5b3946['Attachment'][_0xaca2('0x6c')]:_0x5b3946['body'],'direction':_0x5b3946['direction']===_0xaca2('0x5d')?'A':'C','secret':_0x5b3946[_0xaca2('0x8d')],'read':_0x5b3946[_0xaca2('0xb6')],'attachment':_0x5b3946[_0xaca2('0x6f')]};})[_0xaca2('0xc2')]()};return ejs[_0xaca2('0xc3')](path['join'](config[_0xaca2('0x73')],_0xaca2('0xb0'),_0xaca2('0xc4'),_0xaca2('0xc5')),{'interaction':_0x5331fa})[_0xaca2('0x17')](function(_0x22a060){var _0x1c23be=path[_0xaca2('0x72')](_0x4465ea,_0xaca2('0xc6')+_0x32b9bc['id']+'-'+_0x368a1c+'.pdf');var _0x1a6065={'path':_0x1c23be,'channel':'Chat','interactionId':_0x32b9bc['id']};return pdf[_0xaca2('0xc7')](_0x22a060,_0x1a6065);})['then'](function(){return new Promise(function(_0x267b56,_0x2c07cb){zipdir(_0x4465ea,{'saveTo':_0x126859},function(_0xd05007,_0x10d805){if(_0xd05007)return _0x2c07cb(_0xd05007);return _0x267b56(_0x10d805);});})[_0xaca2('0x17')](function(){return new BPromise(function(_0x5460bd,_0x2e6235){rimraf(_0x4465ea,function(_0x59d418){if(_0x59d418)_0x2e6235(_0x59d418);return _0x5460bd();});});})['then'](function(){return _0x565050['download'](_0x126859,_0x223f6f,function(_0x3d692e){if(_0x3d692e){logger[_0xaca2('0x1d')](_0xaca2('0xc8'),_0x3d692e);}else{fs['unlinkSync'](_0x126859);}});});});}else{return _0x565050['sendStatus'](0xc8);}})['catch'](handleError(_0x565050,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index d29d710..fdb4fc4 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 _0x7f0c=['getUsers','then','Users','map','findAll','setDataValue','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x3a735b,_0x5d9823){var _0x227aec=function(_0x36b9e5){while(--_0x36b9e5){_0x3a735b['push'](_0x3a735b['shift']());}};_0x227aec(++_0x5d9823);}(_0x7f0c,0x19a));var _0xc7f0=function(_0x4276de,_0x1765bb){_0x4276de=_0x4276de-0x0;var _0x4655ad=_0x7f0c[_0x4276de];return _0x4655ad;};'use strict';var EventEmitter=require(_0xc7f0('0x0'));var ChatInteraction=require(_0xc7f0('0x1'))['db'][_0xc7f0('0x2')];var ChatMessage=require(_0xc7f0('0x1'))['db'][_0xc7f0('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc7f0('0x4')](0x0);var events={'afterCreate':_0xc7f0('0x5'),'afterUpdate':_0xc7f0('0x6'),'afterDestroy':_0xc7f0('0x7')};function emitEvent(_0x210b81){return function(_0x2073ef,_0x53cd0f,_0x1badb2){_0x2073ef[_0xc7f0('0x8')]({'attributes':['id'],'raw':!![]})[_0xc7f0('0x9')](function(_0x3c4487){_0x2073ef['setDataValue'](_0xc7f0('0xa'),_0x3c4487[_0xc7f0('0xb')](function(_0x297d24){return{'id':_0x297d24['id']};}));return ChatMessage[_0xc7f0('0xc')]({'where':{'ChatInteractionId':_0x2073ef['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc7f0('0x9')](function(_0x17a3fe){_0x2073ef[_0xc7f0('0xd')]('unreadMessages',_0x17a3fe[_0xc7f0('0xe')]);ChatInteractionEvents['emit'](_0x210b81+':'+_0x2073ef['id'],_0x2073ef);ChatInteractionEvents[_0xc7f0('0xf')](_0x210b81,_0x2073ef);_0x1badb2(null);})[_0xc7f0('0x10')](_0x1badb2(null));};}for(var e in events){if(events[_0xc7f0('0x11')](e)){var event=events[e];ChatInteraction[_0xc7f0('0x12')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xe4e9=['events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit'];(function(_0x2603ed,_0x425837){var _0x492143=function(_0x2dc3e7){while(--_0x2dc3e7){_0x2603ed['push'](_0x2603ed['shift']());}};_0x492143(++_0x425837);}(_0xe4e9,0x87));var _0x9e4e=function(_0xee534,_0x3bb196){_0xee534=_0xee534-0x0;var _0x36465a=_0xe4e9[_0xee534];return _0x36465a;};'use strict';var EventEmitter=require(_0x9e4e('0x0'));var ChatInteraction=require(_0x9e4e('0x1'))['db'][_0x9e4e('0x2')];var ChatMessage=require(_0x9e4e('0x1'))['db'][_0x9e4e('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x9e4e('0x4')](0x0);var events={'afterCreate':_0x9e4e('0x5'),'afterUpdate':_0x9e4e('0x6'),'afterDestroy':_0x9e4e('0x7')};function emitEvent(_0x187f13){return function(_0x3e711c,_0x2739ce,_0x9c3c76){_0x3e711c[_0x9e4e('0x8')]({'attributes':['id'],'raw':!![]})[_0x9e4e('0x9')](function(_0x2846e8){_0x3e711c[_0x9e4e('0xa')](_0x9e4e('0xb'),_0x2846e8['map'](function(_0x2c8ac8){return{'id':_0x2c8ac8['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3e711c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9e4e('0x9')](function(_0xad688){_0x3e711c[_0x9e4e('0xa')](_0x9e4e('0xc'),_0xad688[_0x9e4e('0xd')]);ChatInteractionEvents[_0x9e4e('0xe')](_0x187f13+':'+_0x3e711c['id'],_0x3e711c);ChatInteractionEvents[_0x9e4e('0xe')](_0x187f13,_0x3e711c);_0x9c3c76(null);})['catch'](_0x9c3c76(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index ffcf7b9..ed78d63 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 _0x2340=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','moment','request-promise','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed'];(function(_0x2f167e,_0x38473d){var _0x30ba5f=function(_0x348744){while(--_0x348744){_0x2f167e['push'](_0x2f167e['shift']());}};_0x30ba5f(++_0x38473d);}(_0x2340,0xc6));var _0x0234=function(_0xda372b,_0x16c791){_0xda372b=_0xda372b-0x0;var _0x2afb00=_0x2340[_0xda372b];return _0x2afb00;};'use strict';var _=require(_0x0234('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0234('0x1'));var BPromise=require('bluebird');var rp=require(_0x0234('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0234('0x3'));var attributes=require(_0x0234('0x4'));module[_0x0234('0x5')]=function(_0x34e460,_0x4eebe2){return _0x34e460[_0x0234('0x6')](_0x0234('0x7'),attributes,{'tableName':_0x0234('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x53fe4f,_0x5927af,_0x1fc86e){if(_0x53fe4f[_0x0234('0x9')](_0x0234('0xa'))){_0x53fe4f[_0x0234('0xb')]=moment()[_0x0234('0xc')](_0x0234('0xd'));}_0x1fc86e(null,_0x53fe4f);}},'charset':_0x0234('0xe'),'collate':_0x0234('0xf')});}; \ No newline at end of file +var _0x2019=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4_unicode_ci','lodash','util'];(function(_0x400d78,_0x89ed0e){var _0x508538=function(_0x48d49d){while(--_0x48d49d){_0x400d78['push'](_0x400d78['shift']());}};_0x508538(++_0x89ed0e);}(_0x2019,0x64));var _0x9201=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2019[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x9201('0x0'));var util=require(_0x9201('0x1'));var logger=require(_0x9201('0x2'))(_0x9201('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9201('0x4'));var fs=require('fs');var path=require(_0x9201('0x5'));var rimraf=require(_0x9201('0x6'));var config=require(_0x9201('0x7'));var attributes=require(_0x9201('0x8'));module[_0x9201('0x9')]=function(_0x38ef70,_0x4b2e83){return _0x38ef70['define']('ChatInteraction',attributes,{'tableName':_0x9201('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x47b400,_0x26515f,_0x485d7c){if(_0x47b400[_0x9201('0xb')](_0x9201('0xc'))){_0x47b400[_0x9201('0xd')]=moment()[_0x9201('0xe')](_0x9201('0xf'));}_0x485d7c(null,_0x47b400);}},'charset':'utf8mb4','collate':_0x9201('0x10')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 733ddeb..48f8410 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 _0x6885=['stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','raw','attributes','limit','AddTagsToChatInteraction','ChatInteraction','where','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x5a6db4,_0x3c2cd4){var _0x50b8d9=function(_0x3c1faa){while(--_0x3c1faa){_0x5a6db4['push'](_0x5a6db4['shift']());}};_0x50b8d9(++_0x3c2cd4);}(_0x6885,0xc4));var _0x5688=function(_0x39ee70,_0xf9ad42){_0x39ee70=_0x39ee70-0x0;var _0x5ea1f6=_0x6885[_0x39ee70];return _0x5ea1f6;};'use strict';var _=require(_0x5688('0x0'));var util=require(_0x5688('0x1'));var moment=require(_0x5688('0x2'));var BPromise=require(_0x5688('0x3'));var rs=require(_0x5688('0x4'));var fs=require('fs');var Redis=require(_0x5688('0x5'));var db=require(_0x5688('0x6'))['db'];var utils=require(_0x5688('0x7'));var logger=require(_0x5688('0x8'))(_0x5688('0x9'));var config=require(_0x5688('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x5688('0xb')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x5688('0xc')],{'host':_0x5688('0xd'),'port':0x18eb});var socket=require(_0x5688('0xe'))(new Redis(config[_0x5688('0xc')]));require(_0x5688('0xf'))[_0x5688('0x10')](socket);function respondWithRpcPromise(_0xd7c19b,_0x2b3d34,_0xcefddf){return new BPromise(function(_0x5dfd7f,_0x121968){return client[_0x5688('0x11')](_0xd7c19b,_0xcefddf)[_0x5688('0x12')](function(_0x1e801e){logger[_0x5688('0x13')](_0x5688('0x14'),_0x2b3d34,_0x5688('0x15'));logger[_0x5688('0x16')](_0x5688('0x17'),_0x2b3d34,_0x5688('0x15'),JSON[_0x5688('0x18')](_0x1e801e));if(_0x1e801e[_0x5688('0x19')]){if(_0x1e801e['error'][_0x5688('0x1a')]===0x1f4){logger['error'](_0x5688('0x14'),_0x2b3d34,_0x1e801e[_0x5688('0x19')][_0x5688('0x1b')]);return _0x121968(_0x1e801e[_0x5688('0x19')][_0x5688('0x1b')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x2b3d34,_0x1e801e[_0x5688('0x19')][_0x5688('0x1b')]);return _0x5dfd7f(_0x1e801e[_0x5688('0x19')][_0x5688('0x1b')]);}else{logger[_0x5688('0x13')](_0x5688('0x14'),_0x2b3d34,_0x5688('0x15'));_0x5dfd7f(_0x1e801e[_0x5688('0x1c')][_0x5688('0x1b')]);}})[_0x5688('0x1d')](function(_0x48e768){logger[_0x5688('0x19')](_0x5688('0x14'),_0x2b3d34,_0x48e768);_0x121968(_0x48e768);});});}exports[_0x5688('0x1e')]=function(_0x42231d){var _0x5a2e1c=this;return new Promise(function(_0x25a718,_0x2dbc8d){return db['ChatInteraction'][_0x5688('0x1f')](_0x42231d[_0x5688('0x20')],{'raw':_0x42231d[_0x5688('0x21')]?_0x42231d[_0x5688('0x21')][_0x5688('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42231d['options']?_0x42231d['options']['where']||null:null,'attributes':_0x42231d['options']?_0x42231d[_0x5688('0x21')][_0x5688('0x23')]||null:null,'limit':_0x42231d[_0x5688('0x21')]?_0x42231d[_0x5688('0x21')][_0x5688('0x24')]||null:null})[_0x5688('0x12')](function(_0x17785c){logger['info']('UpdateChatInteraction',_0x42231d);logger[_0x5688('0x16')]('UpdateChatInteraction',_0x42231d,JSON[_0x5688('0x18')](_0x17785c));_0x25a718(_0x17785c);})[_0x5688('0x1d')](function(_0x5db433){logger['error'](_0x5688('0x1e'),_0x5db433['message'],_0x42231d);_0x2dbc8d(_0x5a2e1c[_0x5688('0x19')](0x1f4,_0x5db433[_0x5688('0x1b')]));});});};exports[_0x5688('0x25')]=function(_0x461d5d){return new Promise(function(_0xc2f1a0,_0x2a6ed9){return db[_0x5688('0x26')]['find']({'where':_0x461d5d[_0x5688('0x21')]?_0x461d5d[_0x5688('0x21')][_0x5688('0x27')]||null:null})[_0x5688('0x12')](function(_0x49b3e5){if(_0x49b3e5){return _0x49b3e5[_0x5688('0x28')](_0x461d5d[_0x5688('0x20')][_0x5688('0x29')],_[_0x5688('0x2a')](_0x461d5d[_0x5688('0x20')],['ids','id'])||{});}})['spread'](function(_0xeaa469){logger[_0x5688('0x13')](_0x5688('0x2b'),_0x461d5d);logger[_0x5688('0x16')](_0x5688('0x2b'),_0x461d5d,JSON[_0x5688('0x18')](_0xeaa469));_0xc2f1a0(_0xeaa469);})[_0x5688('0x1d')](function(_0xf10275){logger[_0x5688('0x19')]('AddTags',_0xf10275[_0x5688('0x1b')],_0x461d5d);_0x2a6ed9(_this[_0x5688('0x19')](0x1f4,_0xf10275['message']));});});}; \ No newline at end of file +var _0x6c10=['message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x6c10,0xd3));var _0x06c1=function(_0x3df517,_0x373364){_0x3df517=_0x3df517-0x0;var _0x25ddd5=_0x6c10[_0x3df517];return _0x25ddd5;};'use strict';var _=require(_0x06c1('0x0'));var util=require(_0x06c1('0x1'));var moment=require(_0x06c1('0x2'));var BPromise=require(_0x06c1('0x3'));var rs=require(_0x06c1('0x4'));var fs=require('fs');var Redis=require(_0x06c1('0x5'));var db=require(_0x06c1('0x6'))['db'];var utils=require(_0x06c1('0x7'));var logger=require(_0x06c1('0x8'))(_0x06c1('0x9'));var config=require('../../config/environment');var jayson=require(_0x06c1('0xa'));var client=jayson[_0x06c1('0xb')][_0x06c1('0xc')]({'port':0x232a});config['redis']=_[_0x06c1('0xd')](config[_0x06c1('0xe')],{'host':_0x06c1('0xf'),'port':0x18eb});var socket=require(_0x06c1('0x10'))(new Redis(config[_0x06c1('0xe')]));require(_0x06c1('0x11'))[_0x06c1('0x12')](socket);function respondWithRpcPromise(_0x586019,_0x45a970,_0x407cbe){return new BPromise(function(_0x3df2ea,_0x55b2b9){return client[_0x06c1('0x13')](_0x586019,_0x407cbe)[_0x06c1('0x14')](function(_0x326411){logger[_0x06c1('0x15')](_0x06c1('0x16'),_0x45a970,'request\x20sent');logger[_0x06c1('0x17')](_0x06c1('0x18'),_0x45a970,_0x06c1('0x19'),JSON[_0x06c1('0x1a')](_0x326411));if(_0x326411[_0x06c1('0x1b')]){if(_0x326411['error'][_0x06c1('0x1c')]===0x1f4){logger[_0x06c1('0x1b')](_0x06c1('0x16'),_0x45a970,_0x326411[_0x06c1('0x1b')][_0x06c1('0x1d')]);return _0x55b2b9(_0x326411[_0x06c1('0x1b')]['message']);}logger[_0x06c1('0x1b')](_0x06c1('0x16'),_0x45a970,_0x326411[_0x06c1('0x1b')][_0x06c1('0x1d')]);return _0x3df2ea(_0x326411[_0x06c1('0x1b')]['message']);}else{logger[_0x06c1('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x45a970,_0x06c1('0x19'));_0x3df2ea(_0x326411[_0x06c1('0x1e')][_0x06c1('0x1d')]);}})[_0x06c1('0x1f')](function(_0x4cc95e){logger[_0x06c1('0x1b')](_0x06c1('0x16'),_0x45a970,_0x4cc95e);_0x55b2b9(_0x4cc95e);});});}exports[_0x06c1('0x20')]=function(_0x2bbf36){var _0x1d77d5=this;return new Promise(function(_0x4d4883,_0xf0d7ec){return db[_0x06c1('0x21')][_0x06c1('0x22')](_0x2bbf36[_0x06c1('0x23')],{'raw':_0x2bbf36[_0x06c1('0x24')]?_0x2bbf36[_0x06c1('0x24')][_0x06c1('0x25')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2bbf36[_0x06c1('0x24')]?_0x2bbf36[_0x06c1('0x24')][_0x06c1('0x26')]||null:null,'attributes':_0x2bbf36[_0x06c1('0x24')]?_0x2bbf36['options'][_0x06c1('0x27')]||null:null,'limit':_0x2bbf36[_0x06c1('0x24')]?_0x2bbf36[_0x06c1('0x24')][_0x06c1('0x28')]||null:null})[_0x06c1('0x14')](function(_0x1f0b63){logger[_0x06c1('0x15')](_0x06c1('0x20'),_0x2bbf36);logger[_0x06c1('0x17')](_0x06c1('0x20'),_0x2bbf36,JSON[_0x06c1('0x1a')](_0x1f0b63));_0x4d4883(_0x1f0b63);})[_0x06c1('0x1f')](function(_0x5c562b){logger[_0x06c1('0x1b')](_0x06c1('0x20'),_0x5c562b[_0x06c1('0x1d')],_0x2bbf36);_0xf0d7ec(_0x1d77d5['error'](0x1f4,_0x5c562b['message']));});});};exports[_0x06c1('0x29')]=function(_0x34a7bd){return new Promise(function(_0x564176,_0x33b537){return db[_0x06c1('0x21')][_0x06c1('0x2a')]({'where':_0x34a7bd[_0x06c1('0x24')]?_0x34a7bd[_0x06c1('0x24')][_0x06c1('0x26')]||null:null})[_0x06c1('0x14')](function(_0x581b16){if(_0x581b16){return _0x581b16[_0x06c1('0x2b')](_0x34a7bd[_0x06c1('0x23')][_0x06c1('0x2c')],_[_0x06c1('0x2d')](_0x34a7bd[_0x06c1('0x23')],[_0x06c1('0x2c'),'id'])||{});}})[_0x06c1('0x2e')](function(_0x570919){logger['info']('AddTags',_0x34a7bd);logger[_0x06c1('0x17')](_0x06c1('0x2f'),_0x34a7bd,JSON['stringify'](_0x570919));_0x564176(_0x570919);})[_0x06c1('0x1f')](function(_0x276401){logger['error'](_0x06c1('0x2f'),_0x276401[_0x06c1('0x1d')],_0x34a7bd);_0x33b537(_this[_0x06c1('0x1b')](0x1f4,_0x276401['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f845c80..f48020d 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 _0x4529=['register','length','chatInteraction:','./chatInteraction.events','update','emit','removeListener'];(function(_0x525bcf,_0x428c0c){var _0x4c3486=function(_0xf87f2){while(--_0xf87f2){_0x525bcf['push'](_0x525bcf['shift']());}};_0x4c3486(++_0x428c0c);}(_0x4529,0xea));var _0x9452=function(_0x3c560a,_0x542333){_0x3c560a=_0x3c560a-0x0;var _0x332610=_0x4529[_0x3c560a];return _0x332610;};'use strict';var ChatInteractionEvents=require(_0x9452('0x0'));var events=['save','remove',_0x9452('0x1')];function createListener(_0x25c708,_0x5c37af){return function(_0x50b50a){_0x5c37af[_0x9452('0x2')](_0x25c708,_0x50b50a);};}function removeListener(_0x7ccd5f,_0x4d0690){return function(){ChatInteractionEvents[_0x9452('0x3')](_0x7ccd5f,_0x4d0690);};}exports[_0x9452('0x4')]=function(_0x2f1f58){for(var _0xd8abf6=0x0,_0x267165=events[_0x9452('0x5')];_0xd8abf6<_0x267165;_0xd8abf6++){var _0x326fcd=events[_0xd8abf6];var _0x17d565=createListener(_0x9452('0x6')+_0x326fcd,_0x2f1f58);ChatInteractionEvents['on'](_0x326fcd,_0x17d565);}}; \ No newline at end of file +var _0x49df=['removeListener','length','save','update','emit'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0x49df,0x156));var _0xf49d=function(_0x12f58e,_0x1ea042){_0x12f58e=_0x12f58e-0x0;var _0x1f88d7=_0x49df[_0x12f58e];return _0x1f88d7;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0xf49d('0x0'),'remove',_0xf49d('0x1')];function createListener(_0x50238b,_0xe47e93){return function(_0x3f650f){_0xe47e93[_0xf49d('0x2')](_0x50238b,_0x3f650f);};}function removeListener(_0x3a13f1,_0x3ec5f6){return function(){ChatInteractionEvents[_0xf49d('0x3')](_0x3a13f1,_0x3ec5f6);};}exports['register']=function(_0x4e6992){for(var _0x38724d=0x0,_0x44bab9=events[_0xf49d('0x4')];_0x38724d<_0x44bab9;_0x38724d++){var _0x34c100=events[_0x38724d];var _0x19a6e8=createListener('chatInteraction:'+_0x34c100,_0x4e6992);ChatInteractionEvents['on'](_0x34c100,_0x19a6e8);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 599cf06..360f020 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 _0x0b59=['/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','/:id/attachment_upload','single','file','attachmentUpload','/:id/messages','addMessage','post','/:id/tags','chatinteraction:addtags','chat','chatinteraction:update','update','put','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','tracked','removeTags','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','get','/:id/my_messages','/:id/download','download'];(function(_0x532c55,_0x4dab9a){var _0x1eefe9=function(_0x13b8cb){while(--_0x13b8cb){_0x532c55['push'](_0x532c55['shift']());}};_0x1eefe9(++_0x4dab9a);}(_0x0b59,0x1c7));var _0x90b5=function(_0x587d78,_0x179cfb){_0x587d78=_0x587d78-0x0;var _0x465676=_0x0b59[_0x587d78];return _0x465676;};'use strict';var multer=require(_0x90b5('0x0'));var util=require(_0x90b5('0x1'));var path=require(_0x90b5('0x2'));var timeout=require(_0x90b5('0x3'));var express=require(_0x90b5('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90b5('0x5'));var interaction=require(_0x90b5('0x6'));var config=require(_0x90b5('0x7'));var controller=require(_0x90b5('0x8'));router['get']('/',auth[_0x90b5('0x9')](),controller[_0x90b5('0xa')]);router['get'](_0x90b5('0xb'),auth[_0x90b5('0x9')](),controller[_0x90b5('0xc')]);router['get'](_0x90b5('0xd'),auth[_0x90b5('0xe')](),controller[_0x90b5('0xf')]);router['get'](_0x90b5('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x90b5('0x11')]);router['get']('/:id/messages',auth[_0x90b5('0x9')](),controller['getMessages']);router[_0x90b5('0x12')](_0x90b5('0x13'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router[_0x90b5('0x12')](_0x90b5('0x14'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x15')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x90b5('0x16'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x296ec7,_0x55303e,_0x477390){_0x477390(null,path[_0x90b5('0x18')](config[_0x90b5('0x19')],_0x90b5('0x1a')));},'filename':function(_0x182e03,_0x412727,_0x4cc7e3){_0x4cc7e3(null,util[_0x90b5('0x1b')](_0x90b5('0x1c'),Date[_0x90b5('0x1d')](),_0x412727[_0x90b5('0x1e')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x90b5('0x1f'),upload[_0x90b5('0x20')](_0x90b5('0x21')),controller[_0x90b5('0x22')]);router['post'](_0x90b5('0x23'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x24')]);router[_0x90b5('0x25')](_0x90b5('0x26'),auth[_0x90b5('0x9')](),interaction['tracked']('chat',_0x90b5('0x27')),controller['addTags']);router['put'](_0x90b5('0xd'),auth[_0x90b5('0x9')](),interaction['tracked'](_0x90b5('0x28'),_0x90b5('0x29')),controller[_0x90b5('0x2a')]);router[_0x90b5('0x2b')]('/:id/custom_update',controller[_0x90b5('0x2c')]);router[_0x90b5('0x2b')](_0x90b5('0x2d'),auth[_0x90b5('0xe')](),controller[_0x90b5('0x2e')]);router[_0x90b5('0x2b')](_0x90b5('0x2f'),controller[_0x90b5('0x30')]);router[_0x90b5('0x31')]('/:id',auth[_0x90b5('0x9')](),interaction[_0x90b5('0x32')](_0x90b5('0x28'),'chatinteraction:destroy'),controller['destroy']);router[_0x90b5('0x31')](_0x90b5('0x26'),auth[_0x90b5('0x9')](),controller[_0x90b5('0x33')]);module[_0x90b5('0x34')]=router; \ No newline at end of file +var _0x844a=['isAuthenticated','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','replace','/:id/attachment_upload','single','file','/:id/tags','chatinteraction:addtags','addTags','put','tracked','chat','chatinteraction:update','customUpdate','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x844a,0x1e9));var _0xa844=function(_0x2865b6,_0xe2f090){_0x2865b6=_0x2865b6-0x0;var _0x57278d=_0x844a[_0x2865b6];return _0x57278d;};'use strict';var multer=require(_0xa844('0x0'));var util=require(_0xa844('0x1'));var path=require(_0xa844('0x2'));var timeout=require('connect-timeout');var express=require(_0xa844('0x3'));var router=express['Router']();var fs_extra=require(_0xa844('0x4'));var auth=require(_0xa844('0x5'));var interaction=require(_0xa844('0x6'));var config=require(_0xa844('0x7'));var controller=require(_0xa844('0x8'));router[_0xa844('0x9')]('/',auth['isAuthenticated'](),controller[_0xa844('0xa')]);router[_0xa844('0x9')]('/describe',auth[_0xa844('0xb')](),controller[_0xa844('0xc')]);router[_0xa844('0x9')](_0xa844('0xd'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0xa844('0x9')](_0xa844('0xe'),auth[_0xa844('0xf')](),controller[_0xa844('0x10')]);router[_0xa844('0x9')](_0xa844('0x11'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xa844('0x12'),auth[_0xa844('0xf')](),controller['getMyMessages']);router['get'](_0xa844('0x13'),auth[_0xa844('0xb')](),controller[_0xa844('0x14')]);router[_0xa844('0x15')]('/',auth[_0xa844('0xb')](),controller[_0xa844('0x16')]);router[_0xa844('0x15')](_0xa844('0x17'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xa844('0x18')]({'destination':function(_0x304758,_0x209424,_0x528c72){_0x528c72(null,path[_0xa844('0x19')](config[_0xa844('0x1a')],_0xa844('0x1b')));},'filename':function(_0x43e893,_0x390ac6,_0x370a5e){_0x370a5e(null,util[_0xa844('0x1c')](_0xa844('0x1d'),Date['now'](),_0x390ac6['originalname'][_0xa844('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa844('0x15')](_0xa844('0x1f'),upload[_0xa844('0x20')](_0xa844('0x21')),controller['attachmentUpload']);router[_0xa844('0x15')](_0xa844('0x11'),auth[_0xa844('0xf')](),controller['addMessage']);router['post'](_0xa844('0x22'),auth['isAuthenticated'](),interaction['tracked']('chat',_0xa844('0x23')),controller[_0xa844('0x24')]);router[_0xa844('0x25')](_0xa844('0xd'),auth['isAuthenticated'](),interaction[_0xa844('0x26')](_0xa844('0x27'),_0xa844('0x28')),controller['update']);router[_0xa844('0x25')]('/:id/custom_update',controller[_0xa844('0x29')]);router[_0xa844('0x25')]('/:id/abandon',auth[_0xa844('0xf')](),controller[_0xa844('0x2a')]);router[_0xa844('0x25')](_0xa844('0x2b'),controller[_0xa844('0x2c')]);router[_0xa844('0x2d')](_0xa844('0xd'),auth[_0xa844('0xb')](),interaction[_0xa844('0x26')](_0xa844('0x27'),_0xa844('0x2e')),controller[_0xa844('0x2f')]);router[_0xa844('0x2d')](_0xa844('0x22'),auth[_0xa844('0xb')](),controller[_0xa844('0x30')]);module[_0xa844('0x31')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 2251587..7a976ad 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 _0x9790=['BOOLEAN','INTEGER','sequelize','TEXT'];(function(_0x330e77,_0x5118c6){var _0x2095b3=function(_0x1c5dfb){while(--_0x1c5dfb){_0x330e77['push'](_0x330e77['shift']());}};_0x2095b3(++_0x5118c6);}(_0x9790,0xfa));var _0x0979=function(_0x525cb5,_0x292a6e){_0x525cb5=_0x525cb5-0x0;var _0x46857b=_0x9790[_0x525cb5];return _0x46857b;};'use strict';var Sequelize=require(_0x0979('0x0'));module['exports']={'body':{'type':Sequelize[_0x0979('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0979('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x0979('0x3')]}}; \ No newline at end of file +var _0xf88f=['BOOLEAN','INTEGER','sequelize','exports','TEXT','medium'];(function(_0x4043b6,_0x226266){var _0x39b43f=function(_0x96f1e3){while(--_0x96f1e3){_0x4043b6['push'](_0x4043b6['shift']());}};_0x39b43f(++_0x226266);}(_0xf88f,0x1e8));var _0xff88=function(_0x4b779d,_0x571509){_0x4b779d=_0x4b779d-0x0;var _0x590d78=_0xf88f[_0x4b779d];return _0x590d78;};'use strict';var Sequelize=require(_0xff88('0x0'));module[_0xff88('0x1')]={'body':{'type':Sequelize[_0xff88('0x2')](_0xff88('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xff88('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xff88('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index bebdfc8..d2ee630 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 _0xd800=['zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','filter','includeAll','include','findAll','then','rows','show','keys','length','options','find','catch','body','params','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','admin','user','fullname','userpic','internal','online','allowmessenger','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','agent','resourceId','push','FromId','ToId','read','-createdAt'];(function(_0x402565,_0x431efa){var _0x2ed987=function(_0x3d1fff){while(--_0x3d1fff){_0x402565['push'](_0x402565['shift']());}};_0x2ed987(++_0x431efa);}(_0xd800,0xda));var _0x0d80=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xd800[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0d80('0x0'));var jsonpatch=require(_0x0d80('0x1'));var rp=require('request-promise');var moment=require(_0x0d80('0x2'));var BPromise=require(_0x0d80('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0d80('0x4'));var sox=require(_0x0d80('0x5'));var csv=require(_0x0d80('0x6'));var ejs=require(_0x0d80('0x7'));var fs=require('fs');var fs_extra=require(_0x0d80('0x8'));var _=require(_0x0d80('0x9'));var squel=require(_0x0d80('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d80('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0d80('0xb'));var authService=require(_0x0d80('0xc'));var qs=require(_0x0d80('0xd'));var as=require(_0x0d80('0xe'));var hardwareService=require(_0x0d80('0xf'));var logger=require(_0x0d80('0x10'))(_0x0d80('0x11'));var utils=require('../../config/utils');var config=require(_0x0d80('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d80('0x13'))['db'];config[_0x0d80('0x14')]=_[_0x0d80('0x15')](config[_0x0d80('0x14')],{'host':_0x0d80('0x16'),'port':0x18eb});var socket=require(_0x0d80('0x17'))(new Redis(config[_0x0d80('0x14')]));require('./chatInternalMessage.socket')[_0x0d80('0x18')](socket);function respondWithStatusCode(_0x19578b,_0x52f1cf){_0x52f1cf=_0x52f1cf||0xcc;return function(_0x200fcd){if(_0x200fcd){return _0x19578b[_0x0d80('0x19')](_0x52f1cf);}return _0x19578b[_0x0d80('0x1a')](_0x52f1cf)[_0x0d80('0x1b')]();};}function respondWithResult(_0x1bced4,_0x27e68d){_0x27e68d=_0x27e68d||0xc8;return function(_0x59add3){if(_0x59add3){return _0x1bced4[_0x0d80('0x1a')](_0x27e68d)[_0x0d80('0x1c')](_0x59add3);}};}function respondWithFilteredResult(_0x5eaa80,_0x5fba2a){return function(_0x369d1e){if(_0x369d1e){var _0x15e903=typeof _0x5fba2a[_0x0d80('0x1d')]===_0x0d80('0x1e')&&typeof _0x5fba2a[_0x0d80('0x1f')]==='undefined';var _0x109347=_0x369d1e[_0x0d80('0x20')];var _0x4f0afc=_0x15e903?0x0:_0x5fba2a[_0x0d80('0x1d')];var _0x106c68=_0x15e903?_0x369d1e[_0x0d80('0x20')]:_0x5fba2a[_0x0d80('0x1d')]+_0x5fba2a[_0x0d80('0x1f')];var _0x4d881b;if(_0x106c68>=_0x109347){_0x106c68=_0x109347;_0x4d881b=0xc8;}else{_0x4d881b=0xce;}_0x5eaa80['status'](_0x4d881b);return _0x5eaa80[_0x0d80('0x21')](_0x0d80('0x22'),_0x4f0afc+'-'+_0x106c68+'/'+_0x109347)['json'](_0x369d1e);}return null;};}function patchUpdates(_0x31f8f3){return function(_0x4c0f25){try{jsonpatch[_0x0d80('0x23')](_0x4c0f25,_0x31f8f3,!![]);}catch(_0x44ecc2){return BPromise[_0x0d80('0x24')](_0x44ecc2);}return _0x4c0f25[_0x0d80('0x25')]();};}function saveUpdates(_0x2191b3,_0x1bf249){return function(_0x28f15e){if(_0x28f15e){return _0x28f15e[_0x0d80('0x26')](_0x2191b3)['then'](function(_0x301d7f){return _0x301d7f;});}return null;};}function removeEntity(_0x97f8b0,_0x509d31){return function(_0xb57925){if(_0xb57925){return _0xb57925[_0x0d80('0x27')]()['then'](function(){_0x97f8b0[_0x0d80('0x1a')](0xcc)[_0x0d80('0x1b')]();});}};}function handleEntityNotFound(_0x23c49c,_0x344e95){return function(_0x16c804){if(!_0x16c804){_0x23c49c[_0x0d80('0x19')](0x194);}return _0x16c804;};}function handleError(_0x4f9951,_0x32e688){_0x32e688=_0x32e688||0x1f4;return function(_0x1144f4){logger[_0x0d80('0x28')](_0x1144f4[_0x0d80('0x29')]);if(_0x1144f4[_0x0d80('0x2a')]){delete _0x1144f4[_0x0d80('0x2a')];}_0x4f9951[_0x0d80('0x1a')](_0x32e688)[_0x0d80('0x2b')](_0x1144f4);};}exports[_0x0d80('0x2c')]=function(_0x4be887,_0x26ee64){var _0x13e969={},_0x472e71={},_0x123049={'count':0x0,'rows':[]};var _0x410719=_['map'](db[_0x0d80('0x2d')][_0x0d80('0x2e')],function(_0x36fdf1){return{'name':_0x36fdf1[_0x0d80('0x2f')],'type':_0x36fdf1['type'][_0x0d80('0x30')]};});_0x472e71[_0x0d80('0x31')]=_[_0x0d80('0x32')](_0x410719,_0x0d80('0x2a'));_0x472e71[_0x0d80('0x33')]=_['keys'](_0x4be887[_0x0d80('0x33')]);_0x472e71[_0x0d80('0x34')]=_[_0x0d80('0x35')](_0x472e71[_0x0d80('0x31')],_0x472e71['query']);_0x13e969[_0x0d80('0x36')]=_[_0x0d80('0x35')](_0x472e71[_0x0d80('0x31')],qs['fields'](_0x4be887[_0x0d80('0x33')][_0x0d80('0x37')]));_0x13e969[_0x0d80('0x36')]=_0x13e969[_0x0d80('0x36')]['length']?_0x13e969['attributes']:_0x472e71[_0x0d80('0x31')];if(!_0x4be887[_0x0d80('0x33')][_0x0d80('0x38')](_0x0d80('0x39'))){_0x13e969['limit']=qs[_0x0d80('0x1f')](_0x4be887[_0x0d80('0x33')]['limit']);_0x13e969['offset']=qs[_0x0d80('0x1d')](_0x4be887[_0x0d80('0x33')][_0x0d80('0x1d')]);}_0x13e969['order']=qs['sort'](_0x4be887[_0x0d80('0x33')][_0x0d80('0x3a')]);_0x13e969[_0x0d80('0x3b')]=qs[_0x0d80('0x34')](_[_0x0d80('0x3c')](_0x4be887['query'],_0x472e71[_0x0d80('0x34')]),_0x410719);if(_0x4be887[_0x0d80('0x33')]['filter']){_0x13e969['where']=_[_0x0d80('0x3d')](_0x13e969[_0x0d80('0x3b')],{'$or':_[_0x0d80('0x32')](_0x410719,function(_0x3323f2){if(_0x3323f2[_0x0d80('0x3e')]!=='VIRTUAL'){var _0x353793={};_0x353793[_0x3323f2[_0x0d80('0x2a')]]={'$like':'%'+_0x4be887[_0x0d80('0x33')][_0x0d80('0x3f')]+'%'};return _0x353793;}})});}_0x13e969=_[_0x0d80('0x3d')]({},_0x13e969,_0x4be887['options']);var _0x31fc91={'where':_0x13e969[_0x0d80('0x3b')]};return db['ChatInternalMessage'][_0x0d80('0x20')](_0x31fc91)['then'](function(_0x2a1888){_0x123049[_0x0d80('0x20')]=_0x2a1888;if(_0x4be887[_0x0d80('0x33')][_0x0d80('0x40')]){_0x13e969[_0x0d80('0x41')]=[{'all':!![]}];}return db[_0x0d80('0x2d')][_0x0d80('0x42')](_0x13e969);})[_0x0d80('0x43')](function(_0x15a165){_0x123049[_0x0d80('0x44')]=_0x15a165;return _0x123049;})['then'](respondWithFilteredResult(_0x26ee64,_0x13e969))['catch'](handleError(_0x26ee64,null));};exports[_0x0d80('0x45')]=function(_0x4d9311,_0x2262a2){var _0x83c0a4={'raw':!![],'where':{'id':_0x4d9311['params']['id']}},_0x118895={};_0x118895[_0x0d80('0x31')]=_['keys'](db[_0x0d80('0x2d')][_0x0d80('0x2e')]);_0x118895['query']=_[_0x0d80('0x46')](_0x4d9311['query']);_0x118895[_0x0d80('0x34')]=_[_0x0d80('0x35')](_0x118895['model'],_0x118895['query']);_0x83c0a4[_0x0d80('0x36')]=_['intersection'](_0x118895[_0x0d80('0x31')],qs[_0x0d80('0x37')](_0x4d9311[_0x0d80('0x33')][_0x0d80('0x37')]));_0x83c0a4['attributes']=_0x83c0a4[_0x0d80('0x36')][_0x0d80('0x47')]?_0x83c0a4[_0x0d80('0x36')]:_0x118895[_0x0d80('0x31')];if(_0x4d9311['query'][_0x0d80('0x40')]){_0x83c0a4[_0x0d80('0x41')]=[{'all':!![]}];}_0x83c0a4=_[_0x0d80('0x3d')]({},_0x83c0a4,_0x4d9311[_0x0d80('0x48')]);return db[_0x0d80('0x2d')][_0x0d80('0x49')](_0x83c0a4)[_0x0d80('0x43')](handleEntityNotFound(_0x2262a2,null))[_0x0d80('0x43')](respondWithResult(_0x2262a2,null))[_0x0d80('0x4a')](handleError(_0x2262a2,null));};exports['create']=function(_0x2440c9,_0x34f260){return db[_0x0d80('0x2d')]['create'](_0x2440c9[_0x0d80('0x4b')],{})['then'](respondWithResult(_0x34f260,0xc9))[_0x0d80('0x4a')](handleError(_0x34f260,null));};exports[_0x0d80('0x26')]=function(_0x117e56,_0x539c72){if(_0x117e56[_0x0d80('0x4b')]['id']){delete _0x117e56[_0x0d80('0x4b')]['id'];}return db['ChatInternalMessage'][_0x0d80('0x49')]({'where':{'id':_0x117e56['params']['id']}})[_0x0d80('0x43')](handleEntityNotFound(_0x539c72,null))[_0x0d80('0x43')](saveUpdates(_0x117e56[_0x0d80('0x4b')],null))[_0x0d80('0x43')](respondWithResult(_0x539c72,null))['catch'](handleError(_0x539c72,null));};exports[_0x0d80('0x27')]=function(_0x12c951,_0x30dda4){return db[_0x0d80('0x2d')][_0x0d80('0x49')]({'where':{'id':_0x12c951[_0x0d80('0x4c')]['id']}})[_0x0d80('0x43')](handleEntityNotFound(_0x30dda4,null))[_0x0d80('0x43')](removeEntity(_0x30dda4,null))[_0x0d80('0x4a')](handleError(_0x30dda4,null));};exports[_0x0d80('0x4d')]=function(_0x3bdc01,_0x57f8d6){return db[_0x0d80('0x2d')]['describe']()['then'](respondWithResult(_0x57f8d6,null))[_0x0d80('0x4a')](handleError(_0x57f8d6,null));};function wrapUser(_0x4d2beb){return function(_0x4d372c){var _0x2b84ac=_0x4d2beb[_0x0d80('0x4e')]({'plain':!![]});_0x2b84ac[_0x0d80('0x4f')]=[];if(_0x4d372c){_0x2b84ac[_0x0d80('0x50')]=_0x4d372c[_0x0d80('0x51')];_0x2b84ac[_0x0d80('0x52')]=_0x4d372c;}else{_0x2b84ac[_0x0d80('0x50')]=moment(0x0)[_0x0d80('0x53')](_0x0d80('0x54'));_0x2b84ac[_0x0d80('0x52')]={};}return _0x2b84ac;};}exports['getUsers']=function(_0x5d1553,_0x1c041d,_0x2fc797){var _0x49ca08=[];return db['User'][_0x0d80('0x42')]({'where':{'role':['agent',_0x0d80('0x55'),_0x0d80('0x56')]},'attributes':['id',_0x0d80('0x57'),_0x0d80('0x2a'),'role',_0x0d80('0x58'),_0x0d80('0x59'),_0x0d80('0x5a'),'lastLoginAt',_0x0d80('0x5b'),'showWebBar'],'order':qs[_0x0d80('0x3a')](_0x0d80('0x5c')),'include':[{'model':db[_0x0d80('0x5d')],'as':_0x0d80('0x5e'),'attributes':['id',_0x0d80('0x2a'),_0x0d80('0x3e')],'through':{'attributes':[]}}]})[_0x0d80('0x43')](function(_0x590fff){if(_0x590fff){var _0x3ccc85=_0x5d1553[_0x0d80('0x56')][_0x0d80('0x4e')]({'plain':!![]});if(!_0x3ccc85)throw new Error(_0x0d80('0x5f'));if(_0x3ccc85[_0x0d80('0x60')]==='user'){return db['UserProfileSection'][_0x0d80('0x49')]({'where':{'name':_0x0d80('0x61'),'userProfileId':_0x3ccc85[_0x0d80('0x62')]},'raw':!![]})['then'](function(_0x58df08){if(_0x58df08){if(_0x58df08[_0x0d80('0x63')]===0x0){return db[_0x0d80('0x64')][_0x0d80('0x42')]({'where':{'sectionId':_0x58df08['id']},'raw':!![]})['then'](function(_0x3a93b8){var _0x47c7fb=[];if(_[_0x0d80('0x65')](_0x3a93b8)){_0x47c7fb=_['filter'](_0x590fff,function(_0x37e5d2){if(_0x37e5d2[_0x0d80('0x60')]!==_0x0d80('0x66')){return _0x37e5d2;}});return _0x47c7fb;}else{for(var _0x33b053=0x0;_0x33b053<_0x590fff['length'];_0x33b053++){var _0x325171=_0x590fff[_0x33b053];if(_0x325171[_0x0d80('0x60')]==='agent'){var _0x182af2=_['find'](_0x3a93b8,function(_0x11860c){return _0x11860c[_0x0d80('0x67')]===_0x325171['id'];});if(_0x182af2)_0x47c7fb['push'](_0x325171);}else{_0x47c7fb[_0x0d80('0x68')](_0x325171);}}return _0x47c7fb;}});}else{return _0x590fff;}}else{var _0x39ee6e=_[_0x0d80('0x3f')](_0x590fff,function(_0xb72b4a){if(_0xb72b4a[_0x0d80('0x60')]!=='agent'){return _0xb72b4a;}});return _0x39ee6e;}});}else{return _0x590fff;}}})[_0x0d80('0x43')](function(_0xb5dc94){var _0x911949=[];if(_0xb5dc94){_0x49ca08=_0xb5dc94;for(var _0x4ee1ae=0x0;_0x4ee1ae<_0xb5dc94[_0x0d80('0x47')];_0x4ee1ae+=0x1){_0x49ca08[_0x4ee1ae][_0x0d80('0x4f')]=[];_0x911949[_0x0d80('0x68')](db[_0x0d80('0x2d')][_0x0d80('0x49')]({'where':{'FromId':[_0x5d1553[_0x0d80('0x56')]['id'],_0xb5dc94[_0x4ee1ae]['id']],'ToId':[_0x5d1553[_0x0d80('0x56')]['id'],_0xb5dc94[_0x4ee1ae]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x0d80('0x69'),_0x0d80('0x6a'),_0x0d80('0x6b'),_0x0d80('0x4b')],'order':qs['sort'](_0x0d80('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0d80('0x43')](wrapUser(_0xb5dc94[_0x4ee1ae])));}return BPromise['all'](_0x911949);}return[];})[_0x0d80('0x43')](function(_0x42afc3){return{'rows':_0x42afc3,'count':_0x42afc3[_0x0d80('0x47')]};})[_0x0d80('0x43')](respondWithResult(_0x1c041d,null))[_0x0d80('0x4a')](handleError(_0x1c041d,null));}; \ No newline at end of file +var _0x660e=['includeAll','include','findAll','rows','catch','show','params','options','find','body','update','describe','messages','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','user','internal','lastLoginAt','allowmessenger','showWebBar','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Agents','autoAssociation','isEmpty','agent','length','resourceId','push','FromId','ToId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x11786a,_0xbbf2d5){var _0x4f59ae=function(_0x2d2d84){while(--_0x2d2d84){_0x11786a['push'](_0x11786a['shift']());}};_0x4f59ae(++_0xbbf2d5);}(_0x660e,0xf4));var _0xe660=function(_0x439a85,_0x4b8860){_0x439a85=_0x439a85-0x0;var _0x351741=_0x660e[_0x439a85];return _0x351741;};'use strict';var emlformat=require(_0xe660('0x0'));var rimraf=require(_0xe660('0x1'));var zipdir=require(_0xe660('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe660('0x3'));var moment=require(_0xe660('0x4'));var BPromise=require(_0xe660('0x5'));var Mustache=require(_0xe660('0x6'));var util=require(_0xe660('0x7'));var path=require(_0xe660('0x8'));var sox=require(_0xe660('0x9'));var csv=require(_0xe660('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe660('0xb'));var _=require(_0xe660('0xc'));var squel=require(_0xe660('0xd'));var crypto=require(_0xe660('0xe'));var jsforce=require(_0xe660('0xf'));var deskjs=require(_0xe660('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe660('0x11'));var Papa=require(_0xe660('0x12'));var Redis=require('ioredis');var authService=require(_0xe660('0x13'));var qs=require(_0xe660('0x14'));var as=require(_0xe660('0x15'));var hardwareService=require(_0xe660('0x16'));var logger=require('../../config/logger')(_0xe660('0x17'));var utils=require('../../config/utils');var config=require(_0xe660('0x18'));var licenseUtil=require(_0xe660('0x19'));var db=require('../../mysqldb')['db'];config[_0xe660('0x1a')]=_['defaults'](config['redis'],{'host':_0xe660('0x1b'),'port':0x18eb});var socket=require(_0xe660('0x1c'))(new Redis(config[_0xe660('0x1a')]));require(_0xe660('0x1d'))['register'](socket);function respondWithStatusCode(_0x1189d4,_0x471dac){_0x471dac=_0x471dac||0xcc;return function(_0xbb65f1){if(_0xbb65f1){return _0x1189d4[_0xe660('0x1e')](_0x471dac);}return _0x1189d4[_0xe660('0x1f')](_0x471dac)[_0xe660('0x20')]();};}function respondWithResult(_0x218968,_0x257a67){_0x257a67=_0x257a67||0xc8;return function(_0xd7f513){if(_0xd7f513){return _0x218968['status'](_0x257a67)[_0xe660('0x21')](_0xd7f513);}};}function respondWithFilteredResult(_0x13ef5c,_0xe6fa72){return function(_0x5bc38e){if(_0x5bc38e){var _0x10ed81=typeof _0xe6fa72[_0xe660('0x22')]==='undefined'&&typeof _0xe6fa72['limit']===_0xe660('0x23');var _0x357f98=_0x5bc38e[_0xe660('0x24')];var _0x124fb9=_0x10ed81?0x0:_0xe6fa72[_0xe660('0x22')];var _0x61e01e=_0x10ed81?_0x5bc38e[_0xe660('0x24')]:_0xe6fa72['offset']+_0xe6fa72[_0xe660('0x25')];var _0x174163;if(_0x61e01e>=_0x357f98){_0x61e01e=_0x357f98;_0x174163=0xc8;}else{_0x174163=0xce;}_0x13ef5c[_0xe660('0x1f')](_0x174163);return _0x13ef5c[_0xe660('0x26')](_0xe660('0x27'),_0x124fb9+'-'+_0x61e01e+'/'+_0x357f98)[_0xe660('0x21')](_0x5bc38e);}return null;};}function patchUpdates(_0x285ea1){return function(_0x1a3d14){try{jsonpatch[_0xe660('0x28')](_0x1a3d14,_0x285ea1,!![]);}catch(_0x4d2d48){return BPromise[_0xe660('0x29')](_0x4d2d48);}return _0x1a3d14[_0xe660('0x2a')]();};}function saveUpdates(_0x2fc869,_0x2faa60){return function(_0x528cb4){if(_0x528cb4){return _0x528cb4['update'](_0x2fc869)[_0xe660('0x2b')](function(_0x2533f5){return _0x2533f5;});}return null;};}function removeEntity(_0x3a54f1,_0x2a82f7){return function(_0xf9aee3){if(_0xf9aee3){return _0xf9aee3[_0xe660('0x2c')]()[_0xe660('0x2b')](function(){_0x3a54f1[_0xe660('0x1f')](0xcc)[_0xe660('0x20')]();});}};}function handleEntityNotFound(_0x76e3a7,_0x8d1c37){return function(_0x757227){if(!_0x757227){_0x76e3a7['sendStatus'](0x194);}return _0x757227;};}function handleError(_0xe4260d,_0x26135c){_0x26135c=_0x26135c||0x1f4;return function(_0x31d7a2){logger[_0xe660('0x2d')](_0x31d7a2[_0xe660('0x2e')]);if(_0x31d7a2['name']){delete _0x31d7a2[_0xe660('0x2f')];}_0xe4260d[_0xe660('0x1f')](_0x26135c)[_0xe660('0x30')](_0x31d7a2);};}exports[_0xe660('0x31')]=function(_0x5ef8e0,_0x30d0ad){var _0x1fc543={},_0x18234b={},_0x4b7d25={'count':0x0,'rows':[]};var _0x12c6ba=_['map'](db[_0xe660('0x32')][_0xe660('0x33')],function(_0x5dab59){return{'name':_0x5dab59[_0xe660('0x34')],'type':_0x5dab59[_0xe660('0x35')]['key']};});_0x18234b[_0xe660('0x36')]=_[_0xe660('0x37')](_0x12c6ba,_0xe660('0x2f'));_0x18234b[_0xe660('0x38')]=_[_0xe660('0x39')](_0x5ef8e0[_0xe660('0x38')]);_0x18234b[_0xe660('0x3a')]=_[_0xe660('0x3b')](_0x18234b['model'],_0x18234b[_0xe660('0x38')]);_0x1fc543['attributes']=_[_0xe660('0x3b')](_0x18234b[_0xe660('0x36')],qs[_0xe660('0x3c')](_0x5ef8e0['query'][_0xe660('0x3c')]));_0x1fc543['attributes']=_0x1fc543[_0xe660('0x3d')]['length']?_0x1fc543[_0xe660('0x3d')]:_0x18234b[_0xe660('0x36')];if(!_0x5ef8e0[_0xe660('0x38')][_0xe660('0x3e')](_0xe660('0x3f'))){_0x1fc543[_0xe660('0x25')]=qs[_0xe660('0x25')](_0x5ef8e0[_0xe660('0x38')]['limit']);_0x1fc543[_0xe660('0x22')]=qs['offset'](_0x5ef8e0[_0xe660('0x38')][_0xe660('0x22')]);}_0x1fc543[_0xe660('0x40')]=qs[_0xe660('0x41')](_0x5ef8e0[_0xe660('0x38')]['sort']);_0x1fc543[_0xe660('0x42')]=qs[_0xe660('0x3a')](_[_0xe660('0x43')](_0x5ef8e0[_0xe660('0x38')],_0x18234b[_0xe660('0x3a')]),_0x12c6ba);if(_0x5ef8e0[_0xe660('0x38')]['filter']){_0x1fc543[_0xe660('0x42')]=_[_0xe660('0x44')](_0x1fc543[_0xe660('0x42')],{'$or':_[_0xe660('0x37')](_0x12c6ba,function(_0x14db31){if(_0x14db31[_0xe660('0x35')]!==_0xe660('0x45')){var _0x1884b3={};_0x1884b3[_0x14db31['name']]={'$like':'%'+_0x5ef8e0['query'][_0xe660('0x46')]+'%'};return _0x1884b3;}})});}_0x1fc543=_[_0xe660('0x44')]({},_0x1fc543,_0x5ef8e0['options']);var _0x30fdad={'where':_0x1fc543[_0xe660('0x42')]};return db[_0xe660('0x32')][_0xe660('0x24')](_0x30fdad)[_0xe660('0x2b')](function(_0x4a5ee0){_0x4b7d25[_0xe660('0x24')]=_0x4a5ee0;if(_0x5ef8e0[_0xe660('0x38')][_0xe660('0x47')]){_0x1fc543[_0xe660('0x48')]=[{'all':!![]}];}return db[_0xe660('0x32')][_0xe660('0x49')](_0x1fc543);})[_0xe660('0x2b')](function(_0xdd20b1){_0x4b7d25[_0xe660('0x4a')]=_0xdd20b1;return _0x4b7d25;})['then'](respondWithFilteredResult(_0x30d0ad,_0x1fc543))[_0xe660('0x4b')](handleError(_0x30d0ad,null));};exports[_0xe660('0x4c')]=function(_0x517792,_0x56f3ae){var _0x3943f4={'raw':!![],'where':{'id':_0x517792[_0xe660('0x4d')]['id']}},_0x2e344f={};_0x2e344f[_0xe660('0x36')]=_['keys'](db[_0xe660('0x32')][_0xe660('0x33')]);_0x2e344f['query']=_[_0xe660('0x39')](_0x517792[_0xe660('0x38')]);_0x2e344f['filters']=_['intersection'](_0x2e344f[_0xe660('0x36')],_0x2e344f['query']);_0x3943f4[_0xe660('0x3d')]=_['intersection'](_0x2e344f[_0xe660('0x36')],qs[_0xe660('0x3c')](_0x517792['query'][_0xe660('0x3c')]));_0x3943f4[_0xe660('0x3d')]=_0x3943f4[_0xe660('0x3d')]['length']?_0x3943f4[_0xe660('0x3d')]:_0x2e344f[_0xe660('0x36')];if(_0x517792[_0xe660('0x38')][_0xe660('0x47')]){_0x3943f4[_0xe660('0x48')]=[{'all':!![]}];}_0x3943f4=_['merge']({},_0x3943f4,_0x517792[_0xe660('0x4e')]);return db[_0xe660('0x32')][_0xe660('0x4f')](_0x3943f4)[_0xe660('0x2b')](handleEntityNotFound(_0x56f3ae,null))[_0xe660('0x2b')](respondWithResult(_0x56f3ae,null))[_0xe660('0x4b')](handleError(_0x56f3ae,null));};exports['create']=function(_0x5bca62,_0x1cc312){return db[_0xe660('0x32')]['create'](_0x5bca62[_0xe660('0x50')],{})[_0xe660('0x2b')](respondWithResult(_0x1cc312,0xc9))['catch'](handleError(_0x1cc312,null));};exports[_0xe660('0x51')]=function(_0x483a9a,_0x59f7aa){if(_0x483a9a[_0xe660('0x50')]['id']){delete _0x483a9a[_0xe660('0x50')]['id'];}return db['ChatInternalMessage'][_0xe660('0x4f')]({'where':{'id':_0x483a9a[_0xe660('0x4d')]['id']}})[_0xe660('0x2b')](handleEntityNotFound(_0x59f7aa,null))['then'](saveUpdates(_0x483a9a[_0xe660('0x50')],null))[_0xe660('0x2b')](respondWithResult(_0x59f7aa,null))['catch'](handleError(_0x59f7aa,null));};exports[_0xe660('0x2c')]=function(_0x334368,_0x12a67c){return db['ChatInternalMessage'][_0xe660('0x4f')]({'where':{'id':_0x334368[_0xe660('0x4d')]['id']}})[_0xe660('0x2b')](handleEntityNotFound(_0x12a67c,null))[_0xe660('0x2b')](removeEntity(_0x12a67c,null))[_0xe660('0x4b')](handleError(_0x12a67c,null));};exports[_0xe660('0x52')]=function(_0x2a6228,_0x11f0b3){return db[_0xe660('0x32')][_0xe660('0x52')]()['then'](respondWithResult(_0x11f0b3,null))[_0xe660('0x4b')](handleError(_0x11f0b3,null));};function wrapUser(_0x229fb0){return function(_0x19dfc4){var _0x53930b=_0x229fb0['get']({'plain':!![]});_0x53930b[_0xe660('0x53')]=[];if(_0x19dfc4){_0x53930b['lastMessageAt']=_0x19dfc4['createdAt'];_0x53930b[_0xe660('0x54')]=_0x19dfc4;}else{_0x53930b['lastMessageAt']=moment(0x0)[_0xe660('0x55')](_0xe660('0x56'));_0x53930b[_0xe660('0x54')]={};}return _0x53930b;};}exports[_0xe660('0x57')]=function(_0x4dd743,_0x49f7a4,_0x3982cd){var _0x451f87=[];return db[_0xe660('0x58')][_0xe660('0x49')]({'where':{'role':['agent','admin',_0xe660('0x59')]},'attributes':['id','fullname',_0xe660('0x2f'),'role','userpic',_0xe660('0x5a'),'online',_0xe660('0x5b'),_0xe660('0x5c'),_0xe660('0x5d')],'order':qs[_0xe660('0x41')]('-online'),'include':[{'model':db['VoiceQueue'],'as':'VoiceQueues','attributes':['id','name',_0xe660('0x35')],'through':{'attributes':[]}}]})[_0xe660('0x2b')](function(_0x3a500e){if(_0x3a500e){var _0x5c0528=_0x4dd743['user']['get']({'plain':!![]});if(!_0x5c0528)throw new Error(_0xe660('0x5e'));if(_0x5c0528[_0xe660('0x5f')]===_0xe660('0x59')){return db['UserProfileSection'][_0xe660('0x4f')]({'where':{'name':_0xe660('0x60'),'userProfileId':_0x5c0528['userProfileId']},'raw':!![]})['then'](function(_0x184b25){if(_0x184b25){if(_0x184b25[_0xe660('0x61')]===0x0){return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x184b25['id']},'raw':!![]})['then'](function(_0xd2f8e9){var _0x136f0e=[];if(_[_0xe660('0x62')](_0xd2f8e9)){_0x136f0e=_['filter'](_0x3a500e,function(_0x2fc6a8){if(_0x2fc6a8[_0xe660('0x5f')]!==_0xe660('0x63')){return _0x2fc6a8;}});return _0x136f0e;}else{for(var _0x3a60ff=0x0;_0x3a60ff<_0x3a500e[_0xe660('0x64')];_0x3a60ff++){var _0x438845=_0x3a500e[_0x3a60ff];if(_0x438845[_0xe660('0x5f')]==='agent'){var _0x3929b8=_[_0xe660('0x4f')](_0xd2f8e9,function(_0x4ec1ea){return _0x4ec1ea[_0xe660('0x65')]===_0x438845['id'];});if(_0x3929b8)_0x136f0e[_0xe660('0x66')](_0x438845);}else{_0x136f0e['push'](_0x438845);}}return _0x136f0e;}});}else{return _0x3a500e;}}else{var _0x56c7ca=_[_0xe660('0x46')](_0x3a500e,function(_0xd941bb){if(_0xd941bb[_0xe660('0x5f')]!=='agent'){return _0xd941bb;}});return _0x56c7ca;}});}else{return _0x3a500e;}}})['then'](function(_0x42c58d){var _0x343497=[];if(_0x42c58d){_0x451f87=_0x42c58d;for(var _0x36dff7=0x0;_0x36dff7<_0x42c58d[_0xe660('0x64')];_0x36dff7+=0x1){_0x451f87[_0x36dff7]['messages']=[];_0x343497[_0xe660('0x66')](db[_0xe660('0x32')][_0xe660('0x4f')]({'where':{'FromId':[_0x4dd743['user']['id'],_0x42c58d[_0x36dff7]['id']],'ToId':[_0x4dd743[_0xe660('0x59')]['id'],_0x42c58d[_0x36dff7]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0xe660('0x67'),_0xe660('0x68'),'read',_0xe660('0x50')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})[_0xe660('0x2b')](wrapUser(_0x42c58d[_0x36dff7])));}return BPromise['all'](_0x343497);}return[];})[_0xe660('0x2b')](function(_0x3c4351){return{'rows':_0x3c4351,'count':_0x3c4351[_0xe660('0x64')]};})[_0xe660('0x2b')](respondWithResult(_0x49f7a4,null))[_0xe660('0x4b')](handleError(_0x49f7a4,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f3d6773..5ece1cb 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 _0x05de=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x19dc82,_0x26e762){var _0xfa8836=function(_0x4f5f49){while(--_0x4f5f49){_0x19dc82['push'](_0x19dc82['shift']());}};_0xfa8836(++_0x26e762);}(_0x05de,0xe3));var _0xe05d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x05de[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xe05d('0x0'));var ChatInternalMessage=require(_0xe05d('0x1'))['db'][_0xe05d('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xe05d('0x3')](0x0);var events={'afterCreate':_0xe05d('0x4'),'afterUpdate':'update','afterDestroy':_0xe05d('0x5')};function emitEvent(_0x2a1b70){return function(_0x54973d,_0x6356e5,_0x455301){ChatInternalMessageEvents['emit'](_0x2a1b70+':'+_0x54973d['id'],_0x54973d);ChatInternalMessageEvents[_0xe05d('0x6')](_0x2a1b70,_0x54973d);_0x455301(null);};}for(var e in events){if(events[_0xe05d('0x7')](e)){var event=events[e];ChatInternalMessage[_0xe05d('0x8')](e,emitEvent(event));}}module[_0xe05d('0x9')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x71bf=['setMaxListeners','save','update','remove','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x71bf,0x8e));var _0xf71b=function(_0x3c38c7,_0x14dd97){_0x3c38c7=_0x3c38c7-0x0;var _0x4aa4b1=_0x71bf[_0x3c38c7];return _0x4aa4b1;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xf71b('0x0'))['db'][_0xf71b('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf71b('0x2')](0x0);var events={'afterCreate':_0xf71b('0x3'),'afterUpdate':_0xf71b('0x4'),'afterDestroy':_0xf71b('0x5')};function emitEvent(_0x4c5bb8){return function(_0x4614f9,_0x5d38b9,_0x3b877a){ChatInternalMessageEvents['emit'](_0x4c5bb8+':'+_0x4614f9['id'],_0x4614f9);ChatInternalMessageEvents['emit'](_0x4c5bb8,_0x4614f9);_0x3b877a(null);};}for(var e in events){if(events[_0xf71b('0x6')](e)){var event=events[e];ChatInternalMessage[_0xf71b('0x7')](e,emitEvent(event));}}module[_0xf71b('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 30635b9..7a344fa 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 _0xc7f5=['chat_internal_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xc7f5,0x76));var _0x5c7f=function(_0x77aabe,_0x3068b8){_0x77aabe=_0x77aabe-0x0;var _0x2916ba=_0xc7f5[_0x77aabe];return _0x2916ba;};'use strict';var _=require(_0x5c7f('0x0'));var util=require('util');var logger=require(_0x5c7f('0x1'))(_0x5c7f('0x2'));var moment=require(_0x5c7f('0x3'));var BPromise=require(_0x5c7f('0x4'));var rp=require(_0x5c7f('0x5'));var fs=require('fs');var path=require(_0x5c7f('0x6'));var rimraf=require(_0x5c7f('0x7'));var config=require(_0x5c7f('0x8'));var attributes=require(_0x5c7f('0x9'));module[_0x5c7f('0xa')]=function(_0x3ae86e,_0x53a838){return _0x3ae86e[_0x5c7f('0xb')]('ChatInternalMessage',attributes,{'tableName':_0x5c7f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xef98=['../../config/environment','./chatInternalMessage.attributes','exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0x425382,_0x1ce463){var _0x56d8b9=function(_0x5f3a6b){while(--_0x5f3a6b){_0x425382['push'](_0x425382['shift']());}};_0x56d8b9(++_0x1ce463);}(_0xef98,0x157));var _0x8ef9=function(_0x106fb1,_0x492d48){_0x106fb1=_0x106fb1-0x0;var _0x5dc998=_0xef98[_0x106fb1];return _0x5dc998;};'use strict';var _=require(_0x8ef9('0x0'));var util=require(_0x8ef9('0x1'));var logger=require(_0x8ef9('0x2'))(_0x8ef9('0x3'));var moment=require(_0x8ef9('0x4'));var BPromise=require(_0x8ef9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8ef9('0x6'));var config=require(_0x8ef9('0x7'));var attributes=require(_0x8ef9('0x8'));module[_0x8ef9('0x9')]=function(_0x5da4d9,_0x27f778){return _0x5da4d9['define'](_0x8ef9('0xa'),attributes,{'tableName':_0x8ef9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8ef9('0xc'),'collate':_0x8ef9('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index b1e1764..b01cae9 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 _0x9491=['../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5a4f52,_0x2a835d){var _0x329b0a=function(_0x2801c8){while(--_0x2801c8){_0x5a4f52['push'](_0x5a4f52['shift']());}};_0x329b0a(++_0x2a835d);}(_0x9491,0xb6));var _0x1949=function(_0xa02649,_0x225956){_0xa02649=_0xa02649-0x0;var _0x50ad8c=_0x9491[_0xa02649];return _0x50ad8c;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var moment=require(_0x1949('0x2'));var BPromise=require(_0x1949('0x3'));var rs=require(_0x1949('0x4'));var fs=require('fs');var Redis=require(_0x1949('0x5'));var db=require(_0x1949('0x6'))['db'];var utils=require(_0x1949('0x7'));var logger=require(_0x1949('0x8'))(_0x1949('0x9'));var config=require('../../config/environment');var jayson=require(_0x1949('0xa'));var client=jayson['client'][_0x1949('0xb')]({'port':0x232a});config[_0x1949('0xc')]=_['defaults'](config[_0x1949('0xc')],{'host':_0x1949('0xd'),'port':0x18eb});var socket=require(_0x1949('0xe'))(new Redis(config[_0x1949('0xc')]));require(_0x1949('0xf'))[_0x1949('0x10')](socket);function respondWithRpcPromise(_0x236585,_0x34140a,_0x3b7381){return new BPromise(function(_0x73e0fc,_0x2e0516){return client['request'](_0x236585,_0x3b7381)[_0x1949('0x11')](function(_0x3b3e9f){logger[_0x1949('0x12')](_0x1949('0x13'),_0x34140a,_0x1949('0x14'));logger[_0x1949('0x15')]('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0x34140a,_0x1949('0x14'),JSON['stringify'](_0x3b3e9f));if(_0x3b3e9f['error']){if(_0x3b3e9f[_0x1949('0x16')][_0x1949('0x17')]===0x1f4){logger[_0x1949('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x34140a,_0x3b3e9f[_0x1949('0x16')][_0x1949('0x18')]);return _0x2e0516(_0x3b3e9f[_0x1949('0x16')]['message']);}logger['error'](_0x1949('0x13'),_0x34140a,_0x3b3e9f[_0x1949('0x16')][_0x1949('0x18')]);return _0x73e0fc(_0x3b3e9f['error'][_0x1949('0x18')]);}else{logger[_0x1949('0x12')]('ChatInternalMessage,\x20%s,\x20%s',_0x34140a,_0x1949('0x14'));_0x73e0fc(_0x3b3e9f[_0x1949('0x19')][_0x1949('0x18')]);}})[_0x1949('0x1a')](function(_0x32b91f){logger[_0x1949('0x16')](_0x1949('0x13'),_0x34140a,_0x32b91f);_0x2e0516(_0x32b91f);});});} \ No newline at end of file +var _0x2ce1=['socket.io-emitter','redis','register','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x28ee57,_0x5f4455){var _0x4c0693=function(_0x2a23f6){while(--_0x2a23f6){_0x28ee57['push'](_0x28ee57['shift']());}};_0x4c0693(++_0x5f4455);}(_0x2ce1,0x8b));var _0x12ce=function(_0x17a773,_0x47b25d){_0x17a773=_0x17a773-0x0;var _0x14c8ed=_0x2ce1[_0x17a773];return _0x14c8ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x12ce('0x0'));var rs=require(_0x12ce('0x1'));var fs=require('fs');var Redis=require(_0x12ce('0x2'));var db=require(_0x12ce('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x12ce('0x4'))(_0x12ce('0x5'));var config=require('../../config/environment');var jayson=require(_0x12ce('0x6'));var client=jayson[_0x12ce('0x7')][_0x12ce('0x8')]({'port':0x232a});config['redis']=_[_0x12ce('0x9')](config['redis'],{'host':_0x12ce('0xa'),'port':0x18eb});var socket=require(_0x12ce('0xb'))(new Redis(config[_0x12ce('0xc')]));require('./chatInternalMessage.socket')[_0x12ce('0xd')](socket);function respondWithRpcPromise(_0x23b72f,_0x3e1ee9,_0x1bf7f1){return new BPromise(function(_0x4b5b43,_0x3bd46d){return client['request'](_0x23b72f,_0x1bf7f1)[_0x12ce('0xe')](function(_0x5ee0eb){logger['info'](_0x12ce('0xf'),_0x3e1ee9,_0x12ce('0x10'));logger[_0x12ce('0x11')](_0x12ce('0x12'),_0x3e1ee9,_0x12ce('0x10'),JSON[_0x12ce('0x13')](_0x5ee0eb));if(_0x5ee0eb['error']){if(_0x5ee0eb[_0x12ce('0x14')]['code']===0x1f4){logger[_0x12ce('0x14')](_0x12ce('0xf'),_0x3e1ee9,_0x5ee0eb[_0x12ce('0x14')]['message']);return _0x3bd46d(_0x5ee0eb[_0x12ce('0x14')][_0x12ce('0x15')]);}logger[_0x12ce('0x14')](_0x12ce('0xf'),_0x3e1ee9,_0x5ee0eb[_0x12ce('0x14')][_0x12ce('0x15')]);return _0x4b5b43(_0x5ee0eb['error']['message']);}else{logger[_0x12ce('0x16')]('ChatInternalMessage,\x20%s,\x20%s',_0x3e1ee9,_0x12ce('0x10'));_0x4b5b43(_0x5ee0eb[_0x12ce('0x17')]['message']);}})[_0x12ce('0x18')](function(_0x53d01b){logger[_0x12ce('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x3e1ee9,_0x53d01b);_0x3bd46d(_0x53d01b);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 352404c..f583cae 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 _0xd678=['remove','update','emit','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x3670e5,_0x225999){var _0x2c20db=function(_0x5b11c0){while(--_0x5b11c0){_0x3670e5['push'](_0x3670e5['shift']());}};_0x2c20db(++_0x225999);}(_0xd678,0xcf));var _0x8d67=function(_0x5dcae8,_0x14040a){_0x5dcae8=_0x5dcae8-0x0;var _0xa7a0c6=_0xd678[_0x5dcae8];return _0xa7a0c6;};'use strict';var ChatInternalMessageEvents=require(_0x8d67('0x0'));var events=['save',_0x8d67('0x1'),_0x8d67('0x2')];function createListener(_0x39bf3a,_0x5d547d){return function(_0x5379b4){_0x5d547d[_0x8d67('0x3')](_0x39bf3a,_0x5379b4);};}function removeListener(_0x1372d6,_0xf6f585){return function(){ChatInternalMessageEvents[_0x8d67('0x4')](_0x1372d6,_0xf6f585);};}exports[_0x8d67('0x5')]=function(_0x1daf9b){for(var _0x1ea85a=0x0,_0xb28a40=events[_0x8d67('0x6')];_0x1ea85a<_0xb28a40;_0x1ea85a++){var _0x3f531d=events[_0x1ea85a];var _0x2e3990=createListener(_0x8d67('0x7')+_0x3f531d,_0x1daf9b);ChatInternalMessageEvents['on'](_0x3f531d,_0x2e3990);}}; \ No newline at end of file +var _0xc070=['update','removeListener','length','./chatInternalMessage.events','save'];(function(_0x57ff31,_0x5477b8){var _0xd82dee=function(_0xed9ffc){while(--_0xed9ffc){_0x57ff31['push'](_0x57ff31['shift']());}};_0xd82dee(++_0x5477b8);}(_0xc070,0x94));var _0x0c07=function(_0x179f57,_0xc73ee4){_0x179f57=_0x179f57-0x0;var _0x2c5295=_0xc070[_0x179f57];return _0x2c5295;};'use strict';var ChatInternalMessageEvents=require(_0x0c07('0x0'));var events=[_0x0c07('0x1'),'remove',_0x0c07('0x2')];function createListener(_0x823d2e,_0x23823d){return function(_0x29d907){_0x23823d['emit'](_0x823d2e,_0x29d907);};}function removeListener(_0xb59971,_0x17f8dd){return function(){ChatInternalMessageEvents[_0x0c07('0x3')](_0xb59971,_0x17f8dd);};}exports['register']=function(_0x2cd460){for(var _0x15f966=0x0,_0x3d1e62=events[_0x0c07('0x4')];_0x15f966<_0x3d1e62;_0x15f966++){var _0x207b96=events[_0x15f966];var _0x545140=createListener('chatInternalMessage:'+_0x207b96,_0x2cd460);ChatInternalMessageEvents['on'](_0x207b96,_0x545140);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 3f845f3..7164e84 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 _0x0ade=['../../config/environment','./chatInternalMessage.controller','isAuthenticated','get','/describe','describe','/users','/:id','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service'];(function(_0x5534e3,_0x5e40c4){var _0xd605df=function(_0x113330){while(--_0x113330){_0x5534e3['push'](_0x5534e3['shift']());}};_0xd605df(++_0x5e40c4);}(_0x0ade,0x1bb));var _0xe0ad=function(_0x41818a,_0x3cd403){_0x41818a=_0x41818a-0x0;var _0x1c2c2a=_0x0ade[_0x41818a];return _0x1c2c2a;};'use strict';var multer=require(_0xe0ad('0x0'));var util=require(_0xe0ad('0x1'));var path=require(_0xe0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xe0ad('0x3'));var router=express[_0xe0ad('0x4')]();var fs_extra=require(_0xe0ad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe0ad('0x6'));var config=require(_0xe0ad('0x7'));var controller=require(_0xe0ad('0x8'));router['get']('/',auth[_0xe0ad('0x9')](),controller['index']);router[_0xe0ad('0xa')](_0xe0ad('0xb'),auth['isAuthenticated'](),controller[_0xe0ad('0xc')]);router[_0xe0ad('0xa')](_0xe0ad('0xd'),auth[_0xe0ad('0x9')](),controller['getUsers']);router[_0xe0ad('0xa')](_0xe0ad('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xe0ad('0x9')](),controller['create']);router[_0xe0ad('0xf')](_0xe0ad('0xe'),controller['update']);router[_0xe0ad('0x10')](_0xe0ad('0xe'),auth['isAuthenticated'](),controller[_0xe0ad('0x11')]);module['exports']=router; \ No newline at end of file +var _0x4495=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x399baf,_0x57593d){var _0x4c287e=function(_0xe19dba){while(--_0xe19dba){_0x399baf['push'](_0x399baf['shift']());}};_0x4c287e(++_0x57593d);}(_0x4495,0xd7));var _0x5449=function(_0x2d0f6a,_0x4d4344){_0x2d0f6a=_0x2d0f6a-0x0;var _0x73d83c=_0x4495[_0x2d0f6a];return _0x73d83c;};'use strict';var multer=require(_0x5449('0x0'));var util=require(_0x5449('0x1'));var path=require(_0x5449('0x2'));var timeout=require(_0x5449('0x3'));var express=require(_0x5449('0x4'));var router=express[_0x5449('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5449('0x6'));var interaction=require(_0x5449('0x7'));var config=require('../../config/environment');var controller=require(_0x5449('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x5449('0x9')](_0x5449('0xa'),auth[_0x5449('0xb')](),controller[_0x5449('0xc')]);router[_0x5449('0x9')](_0x5449('0xd'),auth[_0x5449('0xb')](),controller[_0x5449('0xe')]);router[_0x5449('0x9')](_0x5449('0xf'),auth[_0x5449('0xb')](),controller[_0x5449('0x10')]);router[_0x5449('0x11')]('/',auth['isAuthenticated'](),controller[_0x5449('0x12')]);router[_0x5449('0x13')](_0x5449('0xf'),controller[_0x5449('0x14')]);router[_0x5449('0x15')](_0x5449('0xf'),auth['isAuthenticated'](),controller[_0x5449('0x16')]);module[_0x5449('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f5bf17d..9718084 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 _0x1d21=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0x1d21,0x158));var _0x11d2=function(_0x32b542,_0x4512fa){_0x32b542=_0x32b542-0x0;var _0x554d54=_0x1d21[_0x32b542];return _0x554d54;};'use strict';var Sequelize=require(_0x11d2('0x0'));module[_0x11d2('0x1')]={'body':{'type':Sequelize[_0x11d2('0x2')](_0x11d2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x11d2('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x11d2('0x5')]('in',_0x11d2('0x6')),'defaultValue':_0x11d2('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x11d2('0x7')]},'providerResponse':{'type':Sequelize[_0x11d2('0x2')]}}; \ No newline at end of file +var _0x8227=['BOOLEAN','ENUM','out','DATE','STRING','TEXT','exports','medium'];(function(_0x26a490,_0x1d54cf){var _0x4f14c1=function(_0x47922f){while(--_0x47922f){_0x26a490['push'](_0x26a490['shift']());}};_0x4f14c1(++_0x1d54cf);}(_0x8227,0x146));var _0x7822=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8227[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7822('0x0')]={'body':{'type':Sequelize['TEXT'](_0x7822('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7822('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7822('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7822('0x3')]('in','out'),'defaultValue':_0x7822('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7822('0x5')]},'providerName':{'type':Sequelize[_0x7822('0x6')]},'providerResponse':{'type':Sequelize[_0x7822('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index b4709fa..455a2e4 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 _0xdc3f=['isNil','read1stAt','format','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','User','email','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','save','update','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','chat-interactions','accept','chat','read','UserId','user','agent','get','ChatInteraction','ChatInteractionId'];(function(_0x176254,_0x4f4306){var _0x3b2728=function(_0x476d0d){while(--_0x476d0d){_0x176254['push'](_0x176254['shift']());}};_0x3b2728(++_0x4f4306);}(_0xdc3f,0xa1));var _0xfdc3=function(_0xa71e1a,_0x45dd9e){_0xa71e1a=_0xa71e1a-0x0;var _0x169868=_0xdc3f[_0xa71e1a];return _0x169868;};'use strict';var emlformat=require(_0xfdc3('0x0'));var rimraf=require(_0xfdc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfdc3('0x2'));var rp=require(_0xfdc3('0x3'));var moment=require(_0xfdc3('0x4'));var BPromise=require(_0xfdc3('0x5'));var Mustache=require(_0xfdc3('0x6'));var util=require(_0xfdc3('0x7'));var path=require(_0xfdc3('0x8'));var sox=require(_0xfdc3('0x9'));var csv=require(_0xfdc3('0xa'));var ejs=require(_0xfdc3('0xb'));var fs=require('fs');var fs_extra=require(_0xfdc3('0xc'));var _=require('lodash');var squel=require(_0xfdc3('0xd'));var crypto=require(_0xfdc3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfdc3('0xf'));var toCsv=require(_0xfdc3('0xa'));var querystring=require(_0xfdc3('0x10'));var Papa=require('papaparse');var Redis=require(_0xfdc3('0x11'));var authService=require(_0xfdc3('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfdc3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfdc3('0x14'))(_0xfdc3('0x15'));var utils=require(_0xfdc3('0x16'));var config=require(_0xfdc3('0x17'));var licenseUtil=require(_0xfdc3('0x18'));var db=require(_0xfdc3('0x19'))['db'];config[_0xfdc3('0x1a')]=_[_0xfdc3('0x1b')](config[_0xfdc3('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdc3('0x1c'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfdc3('0x1d')][_0xfdc3('0x1e')]({'port':0x232c});var client9002=jayson[_0xfdc3('0x1d')][_0xfdc3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1b4420,_0x3a97ce,_0x422a9c,_0x14047c){return new BPromise(function(_0x27f389,_0x15ca0e){var _0x26c440=_0x14047c||client;return _0x26c440[_0xfdc3('0x1f')](_0x1b4420,_0x422a9c)[_0xfdc3('0x20')](function(_0x5119a8){logger[_0xfdc3('0x21')](_0xfdc3('0x22'),_0x3a97ce,_0xfdc3('0x23'));logger['debug'](_0xfdc3('0x24'),_0x3a97ce,_0xfdc3('0x23'),JSON[_0xfdc3('0x25')](_0x5119a8));if(_0x5119a8[_0xfdc3('0x26')]){if(_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x27')]===0x1f4){logger[_0xfdc3('0x26')](_0xfdc3('0x22'),_0x3a97ce,_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);return _0x15ca0e(_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);}logger[_0xfdc3('0x26')](_0xfdc3('0x22'),_0x3a97ce,_0x5119a8[_0xfdc3('0x26')][_0xfdc3('0x28')]);return _0x27f389(_0x5119a8['error'][_0xfdc3('0x28')]);}else{logger[_0xfdc3('0x21')](_0xfdc3('0x22'),_0x3a97ce,_0xfdc3('0x23'));_0x27f389(_0x5119a8[_0xfdc3('0x29')][_0xfdc3('0x28')]);}})['catch'](function(_0x6caa20){logger[_0xfdc3('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3a97ce,_0x6caa20);_0x15ca0e(_0x6caa20);});});}function respondWithStatusCode(_0xa5070c,_0x58c241){_0x58c241=_0x58c241||0xcc;return function(_0x10804f){if(_0x10804f){return _0xa5070c[_0xfdc3('0x2a')](_0x58c241);}return _0xa5070c[_0xfdc3('0x2b')](_0x58c241)[_0xfdc3('0x2c')]();};}function respondWithResult(_0x3ae40e,_0x1ca52b){_0x1ca52b=_0x1ca52b||0xc8;return function(_0x1c3508){if(_0x1c3508){return _0x3ae40e[_0xfdc3('0x2b')](_0x1ca52b)[_0xfdc3('0x2d')](_0x1c3508);}};}function respondWithFilteredResult(_0x514fe1,_0x44b188){return function(_0x4882bf){if(_0x4882bf){var _0x44ddca=typeof _0x44b188['offset']==='undefined'&&typeof _0x44b188['limit']===_0xfdc3('0x2e');var _0x1122c1=_0x4882bf[_0xfdc3('0x2f')];var _0x2d0843=_0x44ddca?0x0:_0x44b188[_0xfdc3('0x30')];var _0x594673=_0x44ddca?_0x4882bf[_0xfdc3('0x2f')]:_0x44b188[_0xfdc3('0x30')]+_0x44b188['limit'];var _0x4dd2a5;if(_0x594673>=_0x1122c1){_0x594673=_0x1122c1;_0x4dd2a5=0xc8;}else{_0x4dd2a5=0xce;}_0x514fe1[_0xfdc3('0x2b')](_0x4dd2a5);return _0x514fe1[_0xfdc3('0x31')]('Content-Range',_0x2d0843+'-'+_0x594673+'/'+_0x1122c1)[_0xfdc3('0x2d')](_0x4882bf);}return null;};}function patchUpdates(_0x5da869){return function(_0x352499){try{jsonpatch[_0xfdc3('0x32')](_0x352499,_0x5da869,!![]);}catch(_0xa048be){return BPromise[_0xfdc3('0x33')](_0xa048be);}return _0x352499[_0xfdc3('0x34')]();};}function saveUpdates(_0x1be186,_0x497796){return function(_0x159615){if(_0x159615){return _0x159615[_0xfdc3('0x35')](_0x1be186)['then'](function(_0x31e91f){return _0x31e91f;});}return null;};}function removeEntity(_0x4a8d48,_0x323127){return function(_0x447e8e){if(_0x447e8e){return _0x447e8e[_0xfdc3('0x36')]()[_0xfdc3('0x20')](function(){_0x4a8d48['status'](0xcc)[_0xfdc3('0x2c')]();});}};}function handleEntityNotFound(_0x4ec5c6,_0x3c20e0){return function(_0x141cb0){if(!_0x141cb0){_0x4ec5c6[_0xfdc3('0x2a')](0x194);}return _0x141cb0;};}function handleError(_0x23d0de,_0x4ba21d){_0x4ba21d=_0x4ba21d||0x1f4;return function(_0x46d01a){logger[_0xfdc3('0x26')](_0x46d01a[_0xfdc3('0x37')]);if(_0x46d01a['name']){delete _0x46d01a[_0xfdc3('0x38')];}_0x23d0de['status'](_0x4ba21d)[_0xfdc3('0x39')](_0x46d01a);};}exports[_0xfdc3('0x3a')]=function(_0x1998bf,_0x1c1315){var _0x1ca07c={},_0x45a551={},_0x109a89={'count':0x0,'rows':[]};var _0x527914=_[_0xfdc3('0x3b')](db[_0xfdc3('0x3c')][_0xfdc3('0x3d')],function(_0x326f5d){return{'name':_0x326f5d['fieldName'],'type':_0x326f5d[_0xfdc3('0x3e')][_0xfdc3('0x3f')]};});_0x45a551['model']=_['map'](_0x527914,'name');_0x45a551['query']=_[_0xfdc3('0x40')](_0x1998bf['query']);_0x45a551['filters']=_[_0xfdc3('0x41')](_0x45a551[_0xfdc3('0x42')],_0x45a551[_0xfdc3('0x43')]);_0x1ca07c[_0xfdc3('0x44')]=_[_0xfdc3('0x41')](_0x45a551[_0xfdc3('0x42')],qs[_0xfdc3('0x45')](_0x1998bf['query'][_0xfdc3('0x45')]));_0x1ca07c['attributes']=_0x1ca07c[_0xfdc3('0x44')][_0xfdc3('0x46')]?_0x1ca07c[_0xfdc3('0x44')]:_0x45a551[_0xfdc3('0x42')];if(!_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x47')](_0xfdc3('0x48'))){_0x1ca07c[_0xfdc3('0x49')]=qs[_0xfdc3('0x49')](_0x1998bf['query'][_0xfdc3('0x49')]);_0x1ca07c[_0xfdc3('0x30')]=qs[_0xfdc3('0x30')](_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x30')]);}_0x1ca07c['order']=qs[_0xfdc3('0x4a')](_0x1998bf['query'][_0xfdc3('0x4a')]);_0x1ca07c[_0xfdc3('0x4b')]=qs[_0xfdc3('0x4c')](_['pick'](_0x1998bf[_0xfdc3('0x43')],_0x45a551[_0xfdc3('0x4c')]),_0x527914);if(_0x1998bf['query'][_0xfdc3('0x4d')]){_0x1ca07c[_0xfdc3('0x4b')]=_[_0xfdc3('0x4e')](_0x1ca07c[_0xfdc3('0x4b')],{'$or':_[_0xfdc3('0x3b')](_0x527914,function(_0x1fda7c){if(_0x1fda7c[_0xfdc3('0x3e')]!==_0xfdc3('0x4f')){var _0x3eedcc={};_0x3eedcc[_0x1fda7c[_0xfdc3('0x38')]]={'$like':'%'+_0x1998bf[_0xfdc3('0x43')]['filter']+'%'};return _0x3eedcc;}})});}_0x1ca07c=_[_0xfdc3('0x4e')]({},_0x1ca07c,_0x1998bf[_0xfdc3('0x50')]);var _0x5d5f26={'where':_0x1ca07c[_0xfdc3('0x4b')]};return db['ChatMessage'][_0xfdc3('0x2f')](_0x5d5f26)['then'](function(_0x5a8f75){_0x109a89[_0xfdc3('0x2f')]=_0x5a8f75;if(_0x1998bf[_0xfdc3('0x43')][_0xfdc3('0x51')]){_0x1ca07c[_0xfdc3('0x52')]=[{'all':!![]}];}return db[_0xfdc3('0x3c')][_0xfdc3('0x53')](_0x1ca07c);})[_0xfdc3('0x20')](function(_0x31d5ba){_0x109a89['rows']=_0x31d5ba;return _0x109a89;})[_0xfdc3('0x20')](respondWithFilteredResult(_0x1c1315,_0x1ca07c))[_0xfdc3('0x54')](handleError(_0x1c1315,null));};exports[_0xfdc3('0x55')]=function(_0x3894d1,_0x438092){var _0x4d2ae4={'raw':!![],'where':{'id':_0x3894d1['params']['id']}},_0x3b0008={};_0x3b0008['model']=_[_0xfdc3('0x40')](db[_0xfdc3('0x3c')][_0xfdc3('0x3d')]);_0x3b0008[_0xfdc3('0x43')]=_[_0xfdc3('0x40')](_0x3894d1['query']);_0x3b0008[_0xfdc3('0x4c')]=_[_0xfdc3('0x41')](_0x3b0008[_0xfdc3('0x42')],_0x3b0008[_0xfdc3('0x43')]);_0x4d2ae4[_0xfdc3('0x44')]=_[_0xfdc3('0x41')](_0x3b0008[_0xfdc3('0x42')],qs['fields'](_0x3894d1[_0xfdc3('0x43')]['fields']));_0x4d2ae4['attributes']=_0x4d2ae4[_0xfdc3('0x44')][_0xfdc3('0x46')]?_0x4d2ae4[_0xfdc3('0x44')]:_0x3b0008[_0xfdc3('0x42')];if(_0x3894d1[_0xfdc3('0x43')][_0xfdc3('0x51')]){_0x4d2ae4[_0xfdc3('0x52')]=[{'all':!![]}];}_0x4d2ae4=_[_0xfdc3('0x4e')]({},_0x4d2ae4,_0x3894d1[_0xfdc3('0x50')]);return db[_0xfdc3('0x3c')][_0xfdc3('0x56')](_0x4d2ae4)[_0xfdc3('0x20')](handleEntityNotFound(_0x438092,null))['then'](respondWithResult(_0x438092,null))[_0xfdc3('0x54')](handleError(_0x438092,null));};exports['create']=function(_0x24dfdf,_0x75c0a9){return db[_0xfdc3('0x3c')][_0xfdc3('0x57')](_0x24dfdf[_0xfdc3('0x58')],{})[_0xfdc3('0x20')](respondWithResult(_0x75c0a9,0xc9))[_0xfdc3('0x54')](handleError(_0x75c0a9,null));};exports[_0xfdc3('0x35')]=function(_0x5c62c0,_0x5519c4){if(_0x5c62c0[_0xfdc3('0x58')]['id']){delete _0x5c62c0[_0xfdc3('0x58')]['id'];}return db[_0xfdc3('0x3c')][_0xfdc3('0x56')]({'where':{'id':_0x5c62c0[_0xfdc3('0x59')]['id']}})[_0xfdc3('0x20')](handleEntityNotFound(_0x5519c4,null))[_0xfdc3('0x20')](saveUpdates(_0x5c62c0['body'],null))['then'](respondWithResult(_0x5519c4,null))['catch'](handleError(_0x5519c4,null));};exports[_0xfdc3('0x36')]=function(_0x5d1d63,_0x24304a){return db['ChatMessage'][_0xfdc3('0x56')]({'where':{'id':_0x5d1d63[_0xfdc3('0x59')]['id']}})[_0xfdc3('0x20')](handleEntityNotFound(_0x24304a,null))['then'](removeEntity(_0x24304a,null))[_0xfdc3('0x54')](handleError(_0x24304a,null));};exports[_0xfdc3('0x5a')]=function(_0x30a061,_0x4b7146){return db[_0xfdc3('0x3c')][_0xfdc3('0x5a')]()[_0xfdc3('0x20')](respondWithResult(_0x4b7146,null))['catch'](handleError(_0x4b7146,null));};var interaction_log=require(_0xfdc3('0x14'))(_0xfdc3('0x5b'));exports[_0xfdc3('0x5c')]=function(_0x1334a6,_0x4a51a4,_0x541753){var _0x126a06={'agent':{},'channel':_0xfdc3('0x5d')};if(_0x1334a6[_0xfdc3('0x58')]['id']){delete _0x1334a6['body']['id'];}_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5e')]=!![];_0x1334a6[_0xfdc3('0x58')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')]=_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')]||_0x1334a6[_0xfdc3('0x60')]['id'];_0x126a06[_0xfdc3('0x61')]['id']=_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')];return db[_0xfdc3('0x3c')]['find']({'where':{'id':_0x1334a6[_0xfdc3('0x59')]['id'],'UserId':null}})[_0xfdc3('0x20')](handleEntityNotFound(_0x4a51a4,null))[_0xfdc3('0x20')](saveUpdates(_0x1334a6['body'],null))[_0xfdc3('0x20')](function(_0x14e6da){if(_0x14e6da){_0x126a06[_0xfdc3('0x28')]=_0x14e6da[_0xfdc3('0x62')]({'plain':!![]});return db[_0xfdc3('0x63')][_0xfdc3('0x56')]({'where':{'id':_0x14e6da[_0xfdc3('0x64')]}});}return null;})[_0xfdc3('0x20')](handleEntityNotFound(_0x4a51a4,null))[_0xfdc3('0x20')](function(_0x682933){if(_0x682933){return _0x682933['update']({'UserId':_0x1334a6['body'][_0xfdc3('0x5f')],'read1stAt':_[_0xfdc3('0x65')](_0x682933[_0xfdc3('0x66')])?moment()[_0xfdc3('0x67')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfdc3('0x20')](function(_0x56761f){if(_0x56761f){_0x126a06[_0xfdc3('0x68')]=_0x56761f[_0xfdc3('0x62')]({'plain':!![]});interaction_log[_0xfdc3('0x21')](_0xfdc3('0x69'),_0x1334a6[_0xfdc3('0x60')]['id'],_0x1334a6[_0xfdc3('0x60')]['name'],_0x1334a6['user'][_0xfdc3('0x6a')],_0x126a06['interaction']['id'],_0x1334a6[_0xfdc3('0x58')]?JSON[_0xfdc3('0x25')](_0x1334a6[_0xfdc3('0x58')]):_0xfdc3('0x6b'));return respondWithRpcPromise(_0xfdc3('0x6c'),'acceptMessage',_0x126a06);}return null;})[_0xfdc3('0x20')](function(_0x1ce8f8){var _0x574c07=_0xfdc3('0x6d')+_0x1ce8f8[_0xfdc3('0x28')]['ContactId'];return db[_0xfdc3('0x6e')]['query'](_0x574c07,{'type':db['Sequelize'][_0xfdc3('0x6f')][_0xfdc3('0x70')],'raw':!![]})[_0xfdc3('0x20')](function(_0x40c6ee){return _0x40c6ee;});})[_0xfdc3('0x20')](function(_0x2dfcc2){if(_0x2dfcc2){_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x71')]=_0x2dfcc2[0x0];if(!_0x1334a6['body'][_0xfdc3('0x5f')])return;return db['User']['find']({'where':{'id':_0x1334a6[_0xfdc3('0x58')][_0xfdc3('0x5f')],'role':'agent'},'attributes':['id',_0xfdc3('0x38'),_0xfdc3('0x72'),'email',_0xfdc3('0x73')],'raw':!![]});}return null;})[_0xfdc3('0x20')](function(_0x46b0ac){if(!_0x46b0ac)return null;_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x61')]=_0x46b0ac;return _0x126a06;})['then'](function(_0x44b97f){if(_0x44b97f){if(_0x1334a6['body']['manual']){_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x74')]=util[_0xfdc3('0x67')](_0xfdc3('0x75'),_0x1334a6[_0xfdc3('0x60')][_0xfdc3('0x38')]);_0x126a06['message'][_0xfdc3('0x76')]=_0x126a06[_0xfdc3('0x76')];_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x77')]=_0x126a06[_0xfdc3('0x76')];_0x126a06[_0xfdc3('0x28')][_0xfdc3('0x78')]=_0xfdc3('0x5c');return respondWithRpcPromise('EventManager',_0xfdc3('0x79'),{'event':'acceptmessage','message':_[_0xfdc3('0x4e')](_0x126a06[_0xfdc3('0x28')],JSON[_0xfdc3('0x7a')](_0x126a06[_0xfdc3('0x68')][_0xfdc3('0x7b')]))},client9002)['then'](function(){return _0x126a06;});}return _0x126a06;}return null;})[_0xfdc3('0x20')](respondWithResult(_0x4a51a4,null))[_0xfdc3('0x54')](handleError(_0x4a51a4,null));};var interaction_log=require(_0xfdc3('0x14'))(_0xfdc3('0x5b'));exports[_0xfdc3('0x33')]=function(_0xf58a05,_0x5051ee,_0x130c98){var _0x16d297={'agent':{},'channel':'chat'};if(_0xf58a05['body']['id']){delete _0xf58a05['body']['id'];}_0xf58a05['body'][_0xfdc3('0x5f')]=_0xf58a05[_0xfdc3('0x58')]['UserId']||_0xf58a05[_0xfdc3('0x60')]['id'];_0x16d297[_0xfdc3('0x61')]['id']=_0xf58a05['body']['UserId'];return db['ChatMessage']['find']({'where':{'id':_0xf58a05[_0xfdc3('0x59')]['id'],'UserId':null}})[_0xfdc3('0x20')](handleEntityNotFound(_0x5051ee,null))[_0xfdc3('0x20')](function(_0x598471){if(_0x598471){_0x16d297[_0xfdc3('0x28')]=_0x598471['get']({'plain':!![]});return db[_0xfdc3('0x63')]['find']({'where':{'id':_0x598471['ChatInteractionId']}});}return null;})[_0xfdc3('0x20')](handleEntityNotFound(_0x5051ee,null))[_0xfdc3('0x20')](function(_0x5a8abc){if(_0x5a8abc){_0x16d297[_0xfdc3('0x68')]=_0x5a8abc[_0xfdc3('0x62')]({'plain':!![]});interaction_log[_0xfdc3('0x21')](_0xfdc3('0x7c'),_0xf58a05[_0xfdc3('0x60')]['id'],_0xf58a05[_0xfdc3('0x60')]['name'],_0xf58a05[_0xfdc3('0x60')][_0xfdc3('0x6a')],_0x16d297['interaction']['id'],_0xf58a05[_0xfdc3('0x58')]?JSON[_0xfdc3('0x25')](_0xf58a05['body']):_0xfdc3('0x6b'));return respondWithRpcPromise(_0xfdc3('0x7d'),_0xfdc3('0x7e'),_0x16d297);}return null;})[_0xfdc3('0x20')](function(_0x196b9d){var _0x4e9a24=_0xfdc3('0x6d')+_0x196b9d['message'][_0xfdc3('0x7f')];return db[_0xfdc3('0x6e')]['query'](_0x4e9a24,{'type':db[_0xfdc3('0x80')][_0xfdc3('0x6f')][_0xfdc3('0x70')],'raw':!![]})['then'](function(_0x3a542e){return _0x3a542e;});})[_0xfdc3('0x20')](function(_0x271a7e){if(_0x271a7e){_0x16d297[_0xfdc3('0x28')]['contact']=_0x271a7e[0x0];if(!_0xf58a05[_0xfdc3('0x58')]['UserId'])return;return db[_0xfdc3('0x81')]['find']({'where':{'id':_0xf58a05[_0xfdc3('0x58')][_0xfdc3('0x5f')],'role':_0xfdc3('0x61')},'attributes':['id',_0xfdc3('0x38'),_0xfdc3('0x72'),_0xfdc3('0x82'),_0xfdc3('0x73')],'raw':!![]});}return null;})['then'](function(_0x4b4024){if(!_0x4b4024)return null;_0x16d297[_0xfdc3('0x28')][_0xfdc3('0x61')]=_0x4b4024;return _0x16d297;})['then'](function(_0x604d53){if(_0x604d53){_0x604d53['message']['interface']=util[_0xfdc3('0x67')](_0xfdc3('0x75'),_0xf58a05['user'][_0xfdc3('0x38')]);_0x604d53['message'][_0xfdc3('0x76')]=_0x16d297[_0xfdc3('0x76')];_0x604d53['message'][_0xfdc3('0x77')]=_0x16d297[_0xfdc3('0x76')];_0x604d53[_0xfdc3('0x28')][_0xfdc3('0x78')]=_0xfdc3('0x33');respondWithRpcPromise(_0xfdc3('0x79'),_0xfdc3('0x79'),{'event':'rejectmessage','message':_[_0xfdc3('0x4e')](_0x16d297[_0xfdc3('0x28')],JSON[_0xfdc3('0x7a')](_0x16d297[_0xfdc3('0x68')][_0xfdc3('0x7b')]))},client9002);return _0x16d297;}return null;})[_0xfdc3('0x20')](respondWithResult(_0x5051ee,null))['catch'](handleError(_0x5051ee,null));}; \ No newline at end of file +var _0xf753=['limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','index','map','ChatMessage','rawAttributes','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','params','keys','includeAll','find','create','body','destroy','describe','chat-interactions','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','QueryTypes','User','reject','rejectmessage','rimraf','zip-dir','fast-json-patch','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','offset','undefined'];(function(_0x2d069d,_0x52790a){var _0x8a2ada=function(_0x2798f2){while(--_0x2798f2){_0x2d069d['push'](_0x2d069d['shift']());}};_0x8a2ada(++_0x52790a);}(_0xf753,0xd9));var _0x3f75=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0xf753[_0x4e7d25];return _0x526fe6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3f75('0x0'));var zipdir=require(_0x3f75('0x1'));var jsonpatch=require(_0x3f75('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3f75('0x3'));var Mustache=require('mustache');var util=require(_0x3f75('0x4'));var path=require(_0x3f75('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3f75('0x6'));var fs=require('fs');var fs_extra=require(_0x3f75('0x7'));var _=require(_0x3f75('0x8'));var squel=require(_0x3f75('0x9'));var crypto=require(_0x3f75('0xa'));var jsforce=require(_0x3f75('0xb'));var deskjs=require(_0x3f75('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3f75('0xd'));var Papa=require(_0x3f75('0xe'));var Redis=require('ioredis');var authService=require(_0x3f75('0xf'));var qs=require(_0x3f75('0x10'));var as=require(_0x3f75('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f75('0x12'))('api');var utils=require(_0x3f75('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3f75('0x14'))['db'];config[_0x3f75('0x15')]=_['defaults'](config[_0x3f75('0x15')],{'host':_0x3f75('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3f75('0x17'))[_0x3f75('0x18')](socket);var jayson=require(_0x3f75('0x19'));var client=jayson[_0x3f75('0x1a')][_0x3f75('0x1b')]({'port':0x232c});var client9002=jayson[_0x3f75('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x288775,_0x2e486b,_0x41f55d,_0x42881b){return new BPromise(function(_0x119b1f,_0x2ed751){var _0x4d4407=_0x42881b||client;return _0x4d4407[_0x3f75('0x1c')](_0x288775,_0x41f55d)[_0x3f75('0x1d')](function(_0x309314){logger[_0x3f75('0x1e')](_0x3f75('0x1f'),_0x2e486b,_0x3f75('0x20'));logger['debug'](_0x3f75('0x21'),_0x2e486b,'request\x20sent',JSON[_0x3f75('0x22')](_0x309314));if(_0x309314[_0x3f75('0x23')]){if(_0x309314[_0x3f75('0x23')]['code']===0x1f4){logger[_0x3f75('0x23')](_0x3f75('0x1f'),_0x2e486b,_0x309314[_0x3f75('0x23')]['message']);return _0x2ed751(_0x309314['error'][_0x3f75('0x24')]);}logger[_0x3f75('0x23')](_0x3f75('0x1f'),_0x2e486b,_0x309314[_0x3f75('0x23')][_0x3f75('0x24')]);return _0x119b1f(_0x309314[_0x3f75('0x23')]['message']);}else{logger[_0x3f75('0x1e')](_0x3f75('0x1f'),_0x2e486b,_0x3f75('0x20'));_0x119b1f(_0x309314['result'][_0x3f75('0x24')]);}})[_0x3f75('0x25')](function(_0x7652d6){logger['error']('ChatMessage,\x20%s,\x20%s',_0x2e486b,_0x7652d6);_0x2ed751(_0x7652d6);});});}function respondWithStatusCode(_0x1e11fd,_0x3af1a0){_0x3af1a0=_0x3af1a0||0xcc;return function(_0x492aad){if(_0x492aad){return _0x1e11fd['sendStatus'](_0x3af1a0);}return _0x1e11fd[_0x3f75('0x26')](_0x3af1a0)[_0x3f75('0x27')]();};}function respondWithResult(_0x372893,_0x5ec901){_0x5ec901=_0x5ec901||0xc8;return function(_0x208917){if(_0x208917){return _0x372893['status'](_0x5ec901)[_0x3f75('0x28')](_0x208917);}};}function respondWithFilteredResult(_0x42d372,_0x7ee4e0){return function(_0x182be4){if(_0x182be4){var _0x4967dc=typeof _0x7ee4e0[_0x3f75('0x29')]===_0x3f75('0x2a')&&typeof _0x7ee4e0[_0x3f75('0x2b')]==='undefined';var _0x587acd=_0x182be4[_0x3f75('0x2c')];var _0x143b9c=_0x4967dc?0x0:_0x7ee4e0[_0x3f75('0x29')];var _0x5d8d66=_0x4967dc?_0x182be4[_0x3f75('0x2c')]:_0x7ee4e0[_0x3f75('0x29')]+_0x7ee4e0[_0x3f75('0x2b')];var _0x516db4;if(_0x5d8d66>=_0x587acd){_0x5d8d66=_0x587acd;_0x516db4=0xc8;}else{_0x516db4=0xce;}_0x42d372[_0x3f75('0x26')](_0x516db4);return _0x42d372[_0x3f75('0x2d')](_0x3f75('0x2e'),_0x143b9c+'-'+_0x5d8d66+'/'+_0x587acd)['json'](_0x182be4);}return null;};}function patchUpdates(_0x1cfcb6){return function(_0x2f37ab){try{jsonpatch[_0x3f75('0x2f')](_0x2f37ab,_0x1cfcb6,!![]);}catch(_0x52e409){return BPromise['reject'](_0x52e409);}return _0x2f37ab[_0x3f75('0x30')]();};}function saveUpdates(_0x339135,_0x1eeb58){return function(_0x319228){if(_0x319228){return _0x319228[_0x3f75('0x31')](_0x339135)[_0x3f75('0x1d')](function(_0x161786){return _0x161786;});}return null;};}function removeEntity(_0x52cabc,_0x340c51){return function(_0x56e010){if(_0x56e010){return _0x56e010['destroy']()[_0x3f75('0x1d')](function(){_0x52cabc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x37a824,_0x40a651){return function(_0x49269f){if(!_0x49269f){_0x37a824[_0x3f75('0x32')](0x194);}return _0x49269f;};}function handleError(_0x221014,_0x18192e){_0x18192e=_0x18192e||0x1f4;return function(_0x389d47){logger[_0x3f75('0x23')](_0x389d47[_0x3f75('0x33')]);if(_0x389d47[_0x3f75('0x34')]){delete _0x389d47[_0x3f75('0x34')];}_0x221014['status'](_0x18192e)['send'](_0x389d47);};}exports[_0x3f75('0x35')]=function(_0x1aa009,_0x3a832c){var _0x529662={},_0x118d5b={},_0x375e22={'count':0x0,'rows':[]};var _0x4e5d83=_[_0x3f75('0x36')](db[_0x3f75('0x37')][_0x3f75('0x38')],function(_0xff7726){return{'name':_0xff7726['fieldName'],'type':_0xff7726[_0x3f75('0x39')]['key']};});_0x118d5b['model']=_[_0x3f75('0x36')](_0x4e5d83,_0x3f75('0x34'));_0x118d5b['query']=_['keys'](_0x1aa009[_0x3f75('0x3a')]);_0x118d5b[_0x3f75('0x3b')]=_[_0x3f75('0x3c')](_0x118d5b[_0x3f75('0x3d')],_0x118d5b['query']);_0x529662[_0x3f75('0x3e')]=_['intersection'](_0x118d5b['model'],qs[_0x3f75('0x3f')](_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x3f')]));_0x529662[_0x3f75('0x3e')]=_0x529662[_0x3f75('0x3e')][_0x3f75('0x40')]?_0x529662['attributes']:_0x118d5b[_0x3f75('0x3d')];if(!_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x41')](_0x3f75('0x42'))){_0x529662[_0x3f75('0x2b')]=qs[_0x3f75('0x2b')](_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x2b')]);_0x529662['offset']=qs[_0x3f75('0x29')](_0x1aa009[_0x3f75('0x3a')]['offset']);}_0x529662[_0x3f75('0x43')]=qs[_0x3f75('0x44')](_0x1aa009[_0x3f75('0x3a')]['sort']);_0x529662[_0x3f75('0x45')]=qs[_0x3f75('0x3b')](_[_0x3f75('0x46')](_0x1aa009[_0x3f75('0x3a')],_0x118d5b[_0x3f75('0x3b')]),_0x4e5d83);if(_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x47')]){_0x529662[_0x3f75('0x45')]=_[_0x3f75('0x48')](_0x529662['where'],{'$or':_['map'](_0x4e5d83,function(_0x513899){if(_0x513899[_0x3f75('0x39')]!==_0x3f75('0x49')){var _0x2e87f0={};_0x2e87f0[_0x513899[_0x3f75('0x34')]]={'$like':'%'+_0x1aa009[_0x3f75('0x3a')][_0x3f75('0x47')]+'%'};return _0x2e87f0;}})});}_0x529662=_[_0x3f75('0x48')]({},_0x529662,_0x1aa009[_0x3f75('0x4a')]);var _0x497f77={'where':_0x529662[_0x3f75('0x45')]};return db[_0x3f75('0x37')][_0x3f75('0x2c')](_0x497f77)[_0x3f75('0x1d')](function(_0x2f1054){_0x375e22[_0x3f75('0x2c')]=_0x2f1054;if(_0x1aa009[_0x3f75('0x3a')]['includeAll']){_0x529662[_0x3f75('0x4b')]=[{'all':!![]}];}return db[_0x3f75('0x37')]['findAll'](_0x529662);})[_0x3f75('0x1d')](function(_0x2be58e){_0x375e22[_0x3f75('0x4c')]=_0x2be58e;return _0x375e22;})[_0x3f75('0x1d')](respondWithFilteredResult(_0x3a832c,_0x529662))[_0x3f75('0x25')](handleError(_0x3a832c,null));};exports[_0x3f75('0x4d')]=function(_0x4bed43,_0x40e7b3){var _0x3fbd23={'raw':!![],'where':{'id':_0x4bed43[_0x3f75('0x4e')]['id']}},_0x33c4ca={};_0x33c4ca[_0x3f75('0x3d')]=_[_0x3f75('0x4f')](db[_0x3f75('0x37')][_0x3f75('0x38')]);_0x33c4ca[_0x3f75('0x3a')]=_[_0x3f75('0x4f')](_0x4bed43['query']);_0x33c4ca[_0x3f75('0x3b')]=_[_0x3f75('0x3c')](_0x33c4ca[_0x3f75('0x3d')],_0x33c4ca[_0x3f75('0x3a')]);_0x3fbd23['attributes']=_[_0x3f75('0x3c')](_0x33c4ca[_0x3f75('0x3d')],qs[_0x3f75('0x3f')](_0x4bed43[_0x3f75('0x3a')][_0x3f75('0x3f')]));_0x3fbd23[_0x3f75('0x3e')]=_0x3fbd23[_0x3f75('0x3e')][_0x3f75('0x40')]?_0x3fbd23[_0x3f75('0x3e')]:_0x33c4ca[_0x3f75('0x3d')];if(_0x4bed43[_0x3f75('0x3a')][_0x3f75('0x50')]){_0x3fbd23[_0x3f75('0x4b')]=[{'all':!![]}];}_0x3fbd23=_[_0x3f75('0x48')]({},_0x3fbd23,_0x4bed43[_0x3f75('0x4a')]);return db[_0x3f75('0x37')][_0x3f75('0x51')](_0x3fbd23)[_0x3f75('0x1d')](handleEntityNotFound(_0x40e7b3,null))[_0x3f75('0x1d')](respondWithResult(_0x40e7b3,null))['catch'](handleError(_0x40e7b3,null));};exports[_0x3f75('0x52')]=function(_0x88e95a,_0x4807ae){return db['ChatMessage'][_0x3f75('0x52')](_0x88e95a[_0x3f75('0x53')],{})['then'](respondWithResult(_0x4807ae,0xc9))[_0x3f75('0x25')](handleError(_0x4807ae,null));};exports['update']=function(_0x2b8dea,_0x4966c5){if(_0x2b8dea[_0x3f75('0x53')]['id']){delete _0x2b8dea[_0x3f75('0x53')]['id'];}return db[_0x3f75('0x37')][_0x3f75('0x51')]({'where':{'id':_0x2b8dea['params']['id']}})[_0x3f75('0x1d')](handleEntityNotFound(_0x4966c5,null))[_0x3f75('0x1d')](saveUpdates(_0x2b8dea[_0x3f75('0x53')],null))[_0x3f75('0x1d')](respondWithResult(_0x4966c5,null))[_0x3f75('0x25')](handleError(_0x4966c5,null));};exports[_0x3f75('0x54')]=function(_0x431729,_0x3a3980){return db[_0x3f75('0x37')][_0x3f75('0x51')]({'where':{'id':_0x431729[_0x3f75('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a3980,null))[_0x3f75('0x1d')](removeEntity(_0x3a3980,null))['catch'](handleError(_0x3a3980,null));};exports[_0x3f75('0x55')]=function(_0x4fc22a,_0x16df12){return db[_0x3f75('0x37')][_0x3f75('0x55')]()[_0x3f75('0x1d')](respondWithResult(_0x16df12,null))[_0x3f75('0x25')](handleError(_0x16df12,null));};var interaction_log=require(_0x3f75('0x12'))(_0x3f75('0x56'));exports[_0x3f75('0x57')]=function(_0x17b5cf,_0x1b5806,_0x53f618){var _0x36df3b={'agent':{},'channel':_0x3f75('0x58')};if(_0x17b5cf[_0x3f75('0x53')]['id']){delete _0x17b5cf['body']['id'];}_0x17b5cf['body'][_0x3f75('0x59')]=!![];_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5a')]=moment()[_0x3f75('0x5b')](_0x3f75('0x5c'));_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')]=_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')]||_0x17b5cf[_0x3f75('0x5e')]['id'];_0x36df3b[_0x3f75('0x5f')]['id']=_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')];return db[_0x3f75('0x37')]['find']({'where':{'id':_0x17b5cf[_0x3f75('0x4e')]['id'],'UserId':null}})[_0x3f75('0x1d')](handleEntityNotFound(_0x1b5806,null))['then'](saveUpdates(_0x17b5cf[_0x3f75('0x53')],null))[_0x3f75('0x1d')](function(_0x187c43){if(_0x187c43){_0x36df3b[_0x3f75('0x24')]=_0x187c43[_0x3f75('0x60')]({'plain':!![]});return db[_0x3f75('0x61')][_0x3f75('0x51')]({'where':{'id':_0x187c43[_0x3f75('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x1b5806,null))['then'](function(_0xc207b7){if(_0xc207b7){return _0xc207b7[_0x3f75('0x31')]({'UserId':_0x17b5cf[_0x3f75('0x53')]['UserId'],'read1stAt':_['isNil'](_0xc207b7[_0x3f75('0x63')])?moment()[_0x3f75('0x5b')](_0x3f75('0x5c')):undefined});}return null;})[_0x3f75('0x1d')](function(_0x339e9b){if(_0x339e9b){_0x36df3b[_0x3f75('0x64')]=_0x339e9b[_0x3f75('0x60')]({'plain':!![]});interaction_log[_0x3f75('0x1e')](_0x3f75('0x65'),_0x17b5cf['user']['id'],_0x17b5cf[_0x3f75('0x5e')]['name'],_0x17b5cf[_0x3f75('0x5e')][_0x3f75('0x66')],_0x36df3b[_0x3f75('0x64')]['id'],_0x17b5cf[_0x3f75('0x53')]?JSON[_0x3f75('0x22')](_0x17b5cf[_0x3f75('0x53')]):_0x3f75('0x67'));return respondWithRpcPromise(_0x3f75('0x68'),'acceptMessage',_0x36df3b);}return null;})[_0x3f75('0x1d')](function(_0x44a8b8){var _0x1ec4b4=_0x3f75('0x69')+_0x44a8b8[_0x3f75('0x24')][_0x3f75('0x6a')];return db[_0x3f75('0x6b')][_0x3f75('0x3a')](_0x1ec4b4,{'type':db[_0x3f75('0x6c')]['QueryTypes'][_0x3f75('0x6d')],'raw':!![]})[_0x3f75('0x1d')](function(_0x142c36){return _0x142c36;});})['then'](function(_0x4f2d00){if(_0x4f2d00){_0x36df3b['message'][_0x3f75('0x6e')]=_0x4f2d00[0x0];if(!_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')])return;return db['User']['find']({'where':{'id':_0x17b5cf[_0x3f75('0x53')][_0x3f75('0x5d')],'role':'agent'},'attributes':['id',_0x3f75('0x34'),_0x3f75('0x6f'),_0x3f75('0x70'),_0x3f75('0x71')],'raw':!![]});}return null;})[_0x3f75('0x1d')](function(_0x5f5922){if(!_0x5f5922)return null;_0x36df3b[_0x3f75('0x24')][_0x3f75('0x5f')]=_0x5f5922;return _0x36df3b;})[_0x3f75('0x1d')](function(_0x4c629b){if(_0x4c629b){if(_0x17b5cf['body'][_0x3f75('0x72')]){_0x36df3b[_0x3f75('0x24')][_0x3f75('0x73')]=util[_0x3f75('0x5b')](_0x3f75('0x74'),_0x17b5cf['user'][_0x3f75('0x34')]);_0x36df3b[_0x3f75('0x24')]['channel']=_0x36df3b[_0x3f75('0x75')];_0x36df3b['message'][_0x3f75('0x76')]=_0x36df3b['channel'];_0x36df3b[_0x3f75('0x24')][_0x3f75('0x77')]=_0x3f75('0x57');return respondWithRpcPromise(_0x3f75('0x78'),'EventManager',{'event':_0x3f75('0x79'),'message':_[_0x3f75('0x48')](_0x36df3b['message'],JSON[_0x3f75('0x7a')](_0x36df3b['interaction'][_0x3f75('0x7b')]))},client9002)[_0x3f75('0x1d')](function(){return _0x36df3b;});}return _0x36df3b;}return null;})['then'](respondWithResult(_0x1b5806,null))['catch'](handleError(_0x1b5806,null));};var interaction_log=require(_0x3f75('0x12'))(_0x3f75('0x56'));exports['reject']=function(_0x365917,_0x53b864,_0x4ecd53){var _0x53d420={'agent':{},'channel':_0x3f75('0x58')};if(_0x365917[_0x3f75('0x53')]['id']){delete _0x365917[_0x3f75('0x53')]['id'];}_0x365917['body'][_0x3f75('0x5d')]=_0x365917[_0x3f75('0x53')][_0x3f75('0x5d')]||_0x365917[_0x3f75('0x5e')]['id'];_0x53d420[_0x3f75('0x5f')]['id']=_0x365917['body'][_0x3f75('0x5d')];return db['ChatMessage'][_0x3f75('0x51')]({'where':{'id':_0x365917['params']['id'],'UserId':null}})[_0x3f75('0x1d')](handleEntityNotFound(_0x53b864,null))[_0x3f75('0x1d')](function(_0x34e8bf){if(_0x34e8bf){_0x53d420[_0x3f75('0x24')]=_0x34e8bf[_0x3f75('0x60')]({'plain':!![]});return db[_0x3f75('0x61')]['find']({'where':{'id':_0x34e8bf['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x53b864,null))['then'](function(_0x105c90){if(_0x105c90){_0x53d420[_0x3f75('0x64')]=_0x105c90[_0x3f75('0x60')]({'plain':!![]});interaction_log[_0x3f75('0x1e')](_0x3f75('0x7c'),_0x365917[_0x3f75('0x5e')]['id'],_0x365917[_0x3f75('0x5e')]['name'],_0x365917[_0x3f75('0x5e')][_0x3f75('0x66')],_0x53d420[_0x3f75('0x64')]['id'],_0x365917['body']?JSON[_0x3f75('0x22')](_0x365917[_0x3f75('0x53')]):_0x3f75('0x67'));return respondWithRpcPromise(_0x3f75('0x7d'),'rejectMessage',_0x53d420);}return null;})[_0x3f75('0x1d')](function(_0x479c69){var _0x2d2db0=_0x3f75('0x69')+_0x479c69['message'][_0x3f75('0x6a')];return db['sequelize'][_0x3f75('0x3a')](_0x2d2db0,{'type':db[_0x3f75('0x6c')][_0x3f75('0x7e')][_0x3f75('0x6d')],'raw':!![]})[_0x3f75('0x1d')](function(_0x244ff1){return _0x244ff1;});})[_0x3f75('0x1d')](function(_0x1c8207){if(_0x1c8207){_0x53d420[_0x3f75('0x24')][_0x3f75('0x6e')]=_0x1c8207[0x0];if(!_0x365917[_0x3f75('0x53')]['UserId'])return;return db[_0x3f75('0x7f')][_0x3f75('0x51')]({'where':{'id':_0x365917[_0x3f75('0x53')][_0x3f75('0x5d')],'role':_0x3f75('0x5f')},'attributes':['id',_0x3f75('0x34'),_0x3f75('0x6f'),_0x3f75('0x70'),_0x3f75('0x71')],'raw':!![]});}return null;})[_0x3f75('0x1d')](function(_0x2924e6){if(!_0x2924e6)return null;_0x53d420[_0x3f75('0x24')]['agent']=_0x2924e6;return _0x53d420;})[_0x3f75('0x1d')](function(_0x4ba416){if(_0x4ba416){_0x4ba416[_0x3f75('0x24')]['interface']=util[_0x3f75('0x5b')](_0x3f75('0x74'),_0x365917[_0x3f75('0x5e')]['name']);_0x4ba416[_0x3f75('0x24')][_0x3f75('0x75')]=_0x53d420[_0x3f75('0x75')];_0x4ba416[_0x3f75('0x24')]['motionChannel']=_0x53d420[_0x3f75('0x75')];_0x4ba416[_0x3f75('0x24')][_0x3f75('0x77')]=_0x3f75('0x80');respondWithRpcPromise(_0x3f75('0x78'),_0x3f75('0x78'),{'event':_0x3f75('0x81'),'message':_[_0x3f75('0x48')](_0x53d420[_0x3f75('0x24')],JSON[_0x3f75('0x7a')](_0x53d420[_0x3f75('0x64')]['formData']))},client9002);return _0x53d420;}return null;})[_0x3f75('0x1d')](respondWithResult(_0x53b864,null))[_0x3f75('0x25')](handleError(_0x53b864,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index c7c065b..27979ca 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 _0xae0c=['save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','ChatMessage','setMaxListeners'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0xae0c,0x180));var _0xcae0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xae0c[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xcae0('0x0'))['db'][_0xcae0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xcae0('0x2')](0x0);var events={'afterCreate':_0xcae0('0x3'),'afterUpdate':'update','afterDestroy':_0xcae0('0x4')};function emitEvent(_0x7f2b1d){return function(_0x309ef7,_0x1fa3d1,_0x1efe55){ChatMessageEvents[_0xcae0('0x5')](_0x7f2b1d+':'+_0x309ef7['id'],_0x309ef7);ChatMessageEvents['emit'](_0x7f2b1d,_0x309ef7);_0x1efe55(null);};}for(var e in events){if(events[_0xcae0('0x6')](e)){var event=events[e];ChatMessage[_0xcae0('0x7')](e,emitEvent(event));}}module[_0xcae0('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xdef8=['remove','emit','hook','exports','events','ChatMessage','setMaxListeners','update'];(function(_0x59937b,_0x24ce73){var _0x2927e5=function(_0x11de04){while(--_0x11de04){_0x59937b['push'](_0x59937b['shift']());}};_0x2927e5(++_0x24ce73);}(_0xdef8,0xb4));var _0x8def=function(_0x351f2d,_0x4931c4){_0x351f2d=_0x351f2d-0x0;var _0x348213=_0xdef8[_0x351f2d];return _0x348213;};'use strict';var EventEmitter=require(_0x8def('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8def('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8def('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8def('0x3'),'afterDestroy':_0x8def('0x4')};function emitEvent(_0x32242c){return function(_0x31ae09,_0x24cd4f,_0x47b474){ChatMessageEvents[_0x8def('0x5')](_0x32242c+':'+_0x31ae09['id'],_0x31ae09);ChatMessageEvents[_0x8def('0x5')](_0x32242c,_0x31ae09);_0x47b474(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x8def('0x6')](e,emitEvent(event));}}module[_0x8def('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 53028d8..edb3a45 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 _0x5231=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0xef57,_0x53adab){var _0xb6bd40=function(_0x530367){while(--_0x530367){_0xef57['push'](_0xef57['shift']());}};_0xb6bd40(++_0x53adab);}(_0x5231,0x1af));var _0x1523=function(_0x1163c3,_0x3aedc6){_0x1163c3=_0x1163c3-0x0;var _0x7a7cb5=_0x5231[_0x1163c3];return _0x7a7cb5;};'use strict';var _=require(_0x1523('0x0'));var util=require(_0x1523('0x1'));var logger=require(_0x1523('0x2'))(_0x1523('0x3'));var moment=require(_0x1523('0x4'));var BPromise=require(_0x1523('0x5'));var rp=require(_0x1523('0x6'));var fs=require('fs');var path=require(_0x1523('0x7'));var rimraf=require(_0x1523('0x8'));var config=require(_0x1523('0x9'));var attributes=require(_0x1523('0xa'));module['exports']=function(_0x4530f4,_0x1551c6){return _0x4530f4[_0x1523('0xb')]('ChatMessage',attributes,{'tableName':_0x1523('0xc'),'paranoid':![],'indexes':[{'name':_0x1523('0xd'),'fields':[_0x1523('0xe')],'type':_0x1523('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x471c09,_0x1a5cff,_0x99aae1){var _0x2ee9dc=_0x4530f4[_0x1523('0x10')];var _0x14c684=_0x471c09['get']({'plain':!![]});if(_0x14c684[_0x1523('0x11')][_0x1523('0x12')]()==='in'||_0x14c684[_0x1523('0x11')]['toLowerCase']()==='out'&&!_0x14c684[_0x1523('0x13')]&&!_[_0x1523('0x14')](_0x14c684[_0x1523('0x15')])){_0x2ee9dc[_0x1523('0x16')][_0x1523('0x17')]({'where':{'id':_0x14c684[_0x1523('0x18')]}})['then'](function(_0x143779){if(_0x143779){_0x143779['update']({'lastMsgAt':_0x14c684[_0x1523('0x19')],'lastMsgDirection':_0x14c684[_0x1523('0x11')][_0x1523('0x12')]()});}})[_0x1523('0x1a')](function(_0x1b1a4a){console[_0x1523('0x1b')](_0x1b1a4a);});}_0x99aae1();}},'charset':'utf8mb4','collate':_0x1523('0x1c')});}; \ No newline at end of file +var _0x5089=['request-promise','path','../../config/environment','exports','ChatMessage','chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird'];(function(_0x3735f0,_0x548291){var _0x75dd43=function(_0x1e647b){while(--_0x1e647b){_0x3735f0['push'](_0x3735f0['shift']());}};_0x75dd43(++_0x548291);}(_0x5089,0x1bb));var _0x9508=function(_0x5db657,_0x2f40b3){_0x5db657=_0x5db657-0x0;var _0x2d6e70=_0x5089[_0x5db657];return _0x2d6e70;};'use strict';var _=require(_0x9508('0x0'));var util=require(_0x9508('0x1'));var logger=require('../../config/logger')(_0x9508('0x2'));var moment=require(_0x9508('0x3'));var BPromise=require(_0x9508('0x4'));var rp=require(_0x9508('0x5'));var fs=require('fs');var path=require(_0x9508('0x6'));var rimraf=require('rimraf');var config=require(_0x9508('0x7'));var attributes=require('./chatMessage.attributes');module[_0x9508('0x8')]=function(_0x4538dd,_0x257318){return _0x4538dd['define'](_0x9508('0x9'),attributes,{'tableName':_0x9508('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x9508('0xb')],'type':_0x9508('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4f6720,_0x342ddd,_0x5c9dc9){var _0x424e6a=_0x4538dd[_0x9508('0xd')];var _0x852feb=_0x4f6720[_0x9508('0xe')]({'plain':!![]});if(_0x852feb[_0x9508('0xf')][_0x9508('0x10')]()==='in'||_0x852feb['direction'][_0x9508('0x10')]()==='out'&&!_0x852feb[_0x9508('0x11')]&&!_[_0x9508('0x12')](_0x852feb['UserId'])){_0x424e6a[_0x9508('0x13')][_0x9508('0x14')]({'where':{'id':_0x852feb[_0x9508('0x15')]}})[_0x9508('0x16')](function(_0x51ef92){if(_0x51ef92){_0x51ef92[_0x9508('0x17')]({'lastMsgAt':_0x852feb[_0x9508('0x18')],'lastMsgDirection':_0x852feb['direction'][_0x9508('0x10')]()});}})['catch'](function(_0x25d4d6){console[_0x9508('0x19')](_0x25d4d6);});}_0x5c9dc9();}},'charset':_0x9508('0x1a'),'collate':_0x9508('0x1b')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 03a9031..455c629 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 _0xd56e=['debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateChatMessage','ChatMessage','create','body','options','raw','stringify','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xd56e,0xd1));var _0xed56=function(_0x3dfb56,_0xfe844d){_0x3dfb56=_0x3dfb56-0x0;var _0x5e6e1b=_0xd56e[_0x3dfb56];return _0x5e6e1b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xed56('0x0'));var BPromise=require(_0xed56('0x1'));var rs=require(_0xed56('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xed56('0x3'));var logger=require(_0xed56('0x4'))(_0xed56('0x5'));var config=require(_0xed56('0x6'));var jayson=require(_0xed56('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xed56('0x8')]=_['defaults'](config[_0xed56('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed56('0x8')]));require('./chatMessage.socket')[_0xed56('0x9')](socket);function respondWithRpcPromise(_0x11608c,_0x20aa22,_0x329ca5){return new BPromise(function(_0x3a0513,_0x244c0f){return client[_0xed56('0xa')](_0x11608c,_0x329ca5)[_0xed56('0xb')](function(_0x5b0d71){logger[_0xed56('0xc')](_0xed56('0xd'),_0x20aa22,_0xed56('0xe'));logger[_0xed56('0xf')](_0xed56('0x10'),_0x20aa22,_0xed56('0xe'),JSON['stringify'](_0x5b0d71));if(_0x5b0d71['error']){if(_0x5b0d71[_0xed56('0x11')][_0xed56('0x12')]===0x1f4){logger[_0xed56('0x11')](_0xed56('0xd'),_0x20aa22,_0x5b0d71[_0xed56('0x11')]['message']);return _0x244c0f(_0x5b0d71['error'][_0xed56('0x13')]);}logger['error'](_0xed56('0xd'),_0x20aa22,_0x5b0d71[_0xed56('0x11')]['message']);return _0x3a0513(_0x5b0d71['error'][_0xed56('0x13')]);}else{logger[_0xed56('0xc')]('ChatMessage,\x20%s,\x20%s',_0x20aa22,_0xed56('0xe'));_0x3a0513(_0x5b0d71[_0xed56('0x14')][_0xed56('0x13')]);}})['catch'](function(_0x5ae91c){logger[_0xed56('0x11')](_0xed56('0xd'),_0x20aa22,_0x5ae91c);_0x244c0f(_0x5ae91c);});});}exports[_0xed56('0x15')]=function(_0x4d2144){var _0xf1110d=this;return new Promise(function(_0x44f9e3,_0x47b124){return db[_0xed56('0x16')][_0xed56('0x17')](_0x4d2144[_0xed56('0x18')],{'raw':_0x4d2144[_0xed56('0x19')]?_0x4d2144[_0xed56('0x19')][_0xed56('0x1a')]===undefined?!![]:![]:!![]})[_0xed56('0xb')](function(_0xab2d65){logger['info'](_0xed56('0x15'),_0x4d2144);logger[_0xed56('0xf')](_0xed56('0x15'),_0x4d2144,JSON[_0xed56('0x1b')](_0xab2d65));_0x44f9e3(_0xab2d65);})['catch'](function(_0x4eff03){logger[_0xed56('0x11')](_0xed56('0x15'),_0x4eff03['message'],_0x4d2144);_0x47b124(_0xf1110d[_0xed56('0x11')](0x1f4,_0x4eff03[_0xed56('0x13')]));});});}; \ No newline at end of file +var _0x0b06=['client','http','redis','defaults','socket.io-emitter','./chatMessage.socket','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateChatMessage','ChatMessage','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x856298,_0x456bdb){var _0x2ba365=function(_0xfb7655){while(--_0xfb7655){_0x856298['push'](_0x856298['shift']());}};_0x2ba365(++_0x456bdb);}(_0x0b06,0x11f));var _0x60b0=function(_0x4fc956,_0xccc2fe){_0x4fc956=_0x4fc956-0x0;var _0x3d914d=_0x0b06[_0x4fc956];return _0x3d914d;};'use strict';var _=require(_0x60b0('0x0'));var util=require(_0x60b0('0x1'));var moment=require(_0x60b0('0x2'));var BPromise=require(_0x60b0('0x3'));var rs=require(_0x60b0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x60b0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x60b0('0x6'))(_0x60b0('0x7'));var config=require(_0x60b0('0x8'));var jayson=require(_0x60b0('0x9'));var client=jayson[_0x60b0('0xa')][_0x60b0('0xb')]({'port':0x232a});config[_0x60b0('0xc')]=_[_0x60b0('0xd')](config[_0x60b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x60b0('0xe'))(new Redis(config[_0x60b0('0xc')]));require(_0x60b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x5e1ba5,_0x14691c,_0x542716){return new BPromise(function(_0x44f793,_0x50aefb){return client['request'](_0x5e1ba5,_0x542716)[_0x60b0('0x10')](function(_0x5c3a49){logger[_0x60b0('0x11')](_0x60b0('0x12'),_0x14691c,_0x60b0('0x13'));logger[_0x60b0('0x14')](_0x60b0('0x15'),_0x14691c,_0x60b0('0x13'),JSON['stringify'](_0x5c3a49));if(_0x5c3a49[_0x60b0('0x16')]){if(_0x5c3a49[_0x60b0('0x16')][_0x60b0('0x17')]===0x1f4){logger[_0x60b0('0x16')]('ChatMessage,\x20%s,\x20%s',_0x14691c,_0x5c3a49[_0x60b0('0x16')][_0x60b0('0x18')]);return _0x50aefb(_0x5c3a49[_0x60b0('0x16')][_0x60b0('0x18')]);}logger[_0x60b0('0x16')]('ChatMessage,\x20%s,\x20%s',_0x14691c,_0x5c3a49['error'][_0x60b0('0x18')]);return _0x44f793(_0x5c3a49['error'][_0x60b0('0x18')]);}else{logger['info'](_0x60b0('0x12'),_0x14691c,'request\x20sent');_0x44f793(_0x5c3a49[_0x60b0('0x19')][_0x60b0('0x18')]);}})[_0x60b0('0x1a')](function(_0x21eee5){logger[_0x60b0('0x16')]('ChatMessage,\x20%s,\x20%s',_0x14691c,_0x21eee5);_0x50aefb(_0x21eee5);});});}exports[_0x60b0('0x1b')]=function(_0x5a1acc){var _0x405fe0=this;return new Promise(function(_0x378a7f,_0x3c5f4c){return db[_0x60b0('0x1c')]['create'](_0x5a1acc[_0x60b0('0x1d')],{'raw':_0x5a1acc[_0x60b0('0x1e')]?_0x5a1acc[_0x60b0('0x1e')][_0x60b0('0x1f')]===undefined?!![]:![]:!![]})[_0x60b0('0x10')](function(_0x5d4081){logger['info'](_0x60b0('0x1b'),_0x5a1acc);logger[_0x60b0('0x14')](_0x60b0('0x1b'),_0x5a1acc,JSON[_0x60b0('0x20')](_0x5d4081));_0x378a7f(_0x5d4081);})[_0x60b0('0x1a')](function(_0x21acd6){logger[_0x60b0('0x16')](_0x60b0('0x1b'),_0x21acd6['message'],_0x5a1acc);_0x3c5f4c(_0x405fe0[_0x60b0('0x16')](0x1f4,_0x21acd6['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index f6863b0..cd82966 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 _0x7118=['length','chatMessage:','remove','update','emit','removeListener','register'];(function(_0x46012c,_0x66bacf){var _0x26d30f=function(_0x3a281a){while(--_0x3a281a){_0x46012c['push'](_0x46012c['shift']());}};_0x26d30f(++_0x66bacf);}(_0x7118,0x159));var _0x8711=function(_0x22abb5,_0x290001){_0x22abb5=_0x22abb5-0x0;var _0x5f1e57=_0x7118[_0x22abb5];return _0x5f1e57;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x8711('0x0'),_0x8711('0x1')];function createListener(_0x5c64d4,_0x1758c5){return function(_0x3ea36f){_0x1758c5[_0x8711('0x2')](_0x5c64d4,_0x3ea36f);};}function removeListener(_0x259c36,_0x12496b){return function(){ChatMessageEvents[_0x8711('0x3')](_0x259c36,_0x12496b);};}exports[_0x8711('0x4')]=function(_0x54885e){for(var _0x385033=0x0,_0x2244c2=events[_0x8711('0x5')];_0x385033<_0x2244c2;_0x385033++){var _0x3d82f2=events[_0x385033];var _0x189349=createListener(_0x8711('0x6')+_0x3d82f2,_0x54885e);ChatMessageEvents['on'](_0x3d82f2,_0x189349);}}; \ No newline at end of file +var _0x1561=['chatMessage:','remove','update','removeListener','register','length'];(function(_0xc285b4,_0x569050){var _0x327c95=function(_0x140aec){while(--_0x140aec){_0xc285b4['push'](_0xc285b4['shift']());}};_0x327c95(++_0x569050);}(_0x1561,0x1bd));var _0x1156=function(_0x5bc4a8,_0x288dbf){_0x5bc4a8=_0x5bc4a8-0x0;var _0x8d22b9=_0x1561[_0x5bc4a8];return _0x8d22b9;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=['save',_0x1156('0x0'),_0x1156('0x1')];function createListener(_0x14f74b,_0x1ce4ca){return function(_0x1f66f7){_0x1ce4ca['emit'](_0x14f74b,_0x1f66f7);};}function removeListener(_0x1be639,_0x2b0b90){return function(){ChatMessageEvents[_0x1156('0x2')](_0x1be639,_0x2b0b90);};}exports[_0x1156('0x3')]=function(_0x5c989c){for(var _0xb0dab7=0x0,_0x4a7048=events[_0x1156('0x4')];_0xb0dab7<_0x4a7048;_0xb0dab7++){var _0x6c3476=events[_0xb0dab7];var _0x273b53=createListener(_0x1156('0x5')+_0x6c3476,_0x5c989c);ChatMessageEvents['on'](_0x6c3476,_0x273b53);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 6a167e7..08b3a62 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 _0x3689=['isAuthenticated','index','/describe','show','post','tracked','chat','chatmessage:create','create','/:id','put','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get'];(function(_0x573e09,_0x4115c0){var _0x419b52=function(_0x1e8dd5){while(--_0x1e8dd5){_0x573e09['push'](_0x573e09['shift']());}};_0x419b52(++_0x4115c0);}(_0x3689,0xb2));var _0x9368=function(_0x49f184,_0xad43ce){_0x49f184=_0x49f184-0x0;var _0x3b57ee=_0x3689[_0x49f184];return _0x3b57ee;};'use strict';var multer=require(_0x9368('0x0'));var util=require(_0x9368('0x1'));var path=require(_0x9368('0x2'));var timeout=require(_0x9368('0x3'));var express=require('express');var router=express[_0x9368('0x4')]();var fs_extra=require(_0x9368('0x5'));var auth=require(_0x9368('0x6'));var interaction=require(_0x9368('0x7'));var config=require(_0x9368('0x8'));var controller=require(_0x9368('0x9'));router[_0x9368('0xa')]('/',auth[_0x9368('0xb')](),controller[_0x9368('0xc')]);router['get'](_0x9368('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x9368('0xa')]('/:id',auth[_0x9368('0xb')](),controller[_0x9368('0xe')]);router[_0x9368('0xf')]('/',auth[_0x9368('0xb')](),interaction[_0x9368('0x10')](_0x9368('0x11'),_0x9368('0x12')),controller[_0x9368('0x13')]);router['put'](_0x9368('0x14'),controller['update']);router[_0x9368('0x15')]('/:id/accept',auth[_0x9368('0xb')](),controller[_0x9368('0x16')]);router[_0x9368('0x15')](_0x9368('0x17'),auth[_0x9368('0xb')](),controller[_0x9368('0x18')]);router['delete'](_0x9368('0x14'),auth[_0x9368('0xb')](),controller[_0x9368('0x19')]);module[_0x9368('0x1a')]=router; \ No newline at end of file +var _0x6001=['accept','/:id/reject','reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept'];(function(_0x11dc3a,_0x59fa38){var _0x52a9a1=function(_0x1f6515){while(--_0x1f6515){_0x11dc3a['push'](_0x11dc3a['shift']());}};_0x52a9a1(++_0x59fa38);}(_0x6001,0x1b5));var _0x1600=function(_0x24dfb7,_0x2bf1bf){_0x24dfb7=_0x24dfb7-0x0;var _0x525851=_0x6001[_0x24dfb7];return _0x525851;};'use strict';var multer=require(_0x1600('0x0'));var util=require(_0x1600('0x1'));var path=require('path');var timeout=require(_0x1600('0x2'));var express=require(_0x1600('0x3'));var router=express[_0x1600('0x4')]();var fs_extra=require(_0x1600('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x1600('0x6'));var config=require(_0x1600('0x7'));var controller=require('./chatMessage.controller');router[_0x1600('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1600('0x8')](_0x1600('0x9'),auth[_0x1600('0xa')](),controller[_0x1600('0xb')]);router['get'](_0x1600('0xc'),auth[_0x1600('0xa')](),controller[_0x1600('0xd')]);router[_0x1600('0xe')]('/',auth[_0x1600('0xa')](),interaction[_0x1600('0xf')](_0x1600('0x10'),_0x1600('0x11')),controller[_0x1600('0x12')]);router[_0x1600('0x13')](_0x1600('0xc'),controller[_0x1600('0x14')]);router[_0x1600('0x13')](_0x1600('0x15'),auth[_0x1600('0xa')](),controller[_0x1600('0x16')]);router[_0x1600('0x13')](_0x1600('0x17'),auth[_0x1600('0xa')](),controller[_0x1600('0x18')]);router[_0x1600('0x19')](_0x1600('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1600('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 5fa901f..b4eccaf 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 _0x757a=['exports','TEXT'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x757a,0xde));var _0xa757=function(_0x47b75f,_0x4ed82a){_0x47b75f=_0x47b75f-0x0;var _0x593eab=_0x757a[_0x47b75f];return _0x593eab;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'body':{'type':Sequelize[_0xa757('0x1')]('medium'),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT']('medium'),'allowNull':![]}}; \ No newline at end of file +var _0xadb5=['medium','TEXT','exports'];(function(_0x50444e,_0x2cda69){var _0x4b10c9=function(_0x5012b8){while(--_0x5012b8){_0x50444e['push'](_0x50444e['shift']());}};_0x4b10c9(++_0x2cda69);}(_0xadb5,0xad));var _0x5adb=function(_0x36ce0d,_0x6b4a74){_0x36ce0d=_0x36ce0d-0x0;var _0x6ab73b=_0xadb5[_0x36ce0d];return _0x6ab73b;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9e2b985..42fbdfb 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(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x7a54,0x106));var _0x47a5=function(_0x999742,_0x277e7a){_0x999742=_0x999742-0x0;var _0x47b204=_0x7a54[_0x999742];return _0x47b204;};'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(_0x5b14e4,_0x5bfa03){var _0xf6610b=function(_0x53868e){while(--_0x53868e){_0x5b14e4['push'](_0x5b14e4['shift']());}};_0xf6610b(++_0x5bfa03);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 f58952a..2e0d9ff 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 _0x02a6=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','save'];(function(_0x209ec9,_0x30378c){var _0x129b1b=function(_0x2f2b9e){while(--_0x2f2b9e){_0x209ec9['push'](_0x209ec9['shift']());}};_0x129b1b(++_0x30378c);}(_0x02a6,0x72));var _0x602a=function(_0x547393,_0x524cf9){_0x547393=_0x547393-0x0;var _0x65abab=_0x02a6[_0x547393];return _0x65abab;};'use strict';var EventEmitter=require(_0x602a('0x0'));var ChatOfflineMessage=require(_0x602a('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x602a('0x2'),'afterUpdate':_0x602a('0x3'),'afterDestroy':_0x602a('0x4')};function emitEvent(_0x5289e0){return function(_0x41d0d3,_0x314c53,_0x2ff344){ChatOfflineMessageEvents['emit'](_0x5289e0+':'+_0x41d0d3['id'],_0x41d0d3);ChatOfflineMessageEvents[_0x602a('0x5')](_0x5289e0,_0x41d0d3);_0x2ff344(null);};}for(var e in events){if(events[_0x602a('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x602a('0x7')](e,emitEvent(event));}}module[_0x602a('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x21ff=['events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x275d85,_0x5a883e){var _0x3cd754=function(_0x209dee){while(--_0x209dee){_0x275d85['push'](_0x275d85['shift']());}};_0x3cd754(++_0x5a883e);}(_0x21ff,0x8c));var _0xf21f=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x21ff[_0xaa6a4];return _0xdc31a4;};'use strict';var EventEmitter=require(_0xf21f('0x0'));var ChatOfflineMessage=require(_0xf21f('0x1'))['db'][_0xf21f('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xf21f('0x3')](0x0);var events={'afterCreate':_0xf21f('0x4'),'afterUpdate':_0xf21f('0x5'),'afterDestroy':_0xf21f('0x6')};function emitEvent(_0x136816){return function(_0x3af570,_0xa17c56,_0x2c76e7){ChatOfflineMessageEvents[_0xf21f('0x7')](_0x136816+':'+_0x3af570['id'],_0x3af570);ChatOfflineMessageEvents[_0xf21f('0x7')](_0x136816,_0x3af570);_0x2c76e7(null);};}for(var e in events){if(events[_0xf21f('0x8')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0xf21f('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 53ef3ed..17f60b4 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 _0x335c=['ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define'];(function(_0x4f9476,_0x3eadc7){var _0x3296a4=function(_0x79c859){while(--_0x79c859){_0x4f9476['push'](_0x4f9476['shift']());}};_0x3296a4(++_0x3eadc7);}(_0x335c,0xc9));var _0xc335=function(_0x5f3884,_0x6f7e80){_0x5f3884=_0x5f3884-0x0;var _0x355860=_0x335c[_0x5f3884];return _0x355860;};'use strict';var attributes=require(_0xc335('0x0'));module[_0xc335('0x1')]=function(_0x385b16){return _0x385b16[_0xc335('0x2')](_0xc335('0x3'),attributes,{'tableName':_0xc335('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc335('0x5')});}; \ No newline at end of file +var _0xf6bd=['ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x304b67,_0x31cb39){var _0x493afb=function(_0x21dce3){while(--_0x21dce3){_0x304b67['push'](_0x304b67['shift']());}};_0x493afb(++_0x31cb39);}(_0xf6bd,0x76));var _0xdf6b=function(_0x1cdabe,_0x286194){_0x1cdabe=_0x1cdabe-0x0;var _0x3dcc9c=_0xf6bd[_0x1cdabe];return _0x3dcc9c;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xdf6b('0x0')]=function(_0x248819){return _0x248819[_0xdf6b('0x1')](_0xdf6b('0x2'),attributes,{'tableName':_0xdf6b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdf6b('0x4'),'collate':_0xdf6b('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 1b92d1e..390ea82 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 _0xa2c8=['jayson/promise','client','http','info','ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x4b630c,_0x5da947){var _0x1be67a=function(_0x2da6ce){while(--_0x2da6ce){_0x4b630c['push'](_0x4b630c['shift']());}};_0x1be67a(++_0x5da947);}(_0xa2c8,0x99));var _0x8a2c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa2c8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8a2c('0x0'));var util=require(_0x8a2c('0x1'));var moment=require(_0x8a2c('0x2'));var BPromise=require(_0x8a2c('0x3'));var rs=require(_0x8a2c('0x4'));var fs=require('fs');var Redis=require(_0x8a2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8a2c('0x7'));var client=jayson[_0x8a2c('0x8')][_0x8a2c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1031fb,_0x4e007c,_0xe1e335){return new BPromise(function(_0x1d2885,_0x43745f){return client['request'](_0x1031fb,_0xe1e335)['then'](function(_0x4c237a){logger[_0x8a2c('0xa')](_0x8a2c('0xb'),_0x4e007c,'request\x20sent');logger[_0x8a2c('0xc')](_0x8a2c('0xd'),_0x4e007c,_0x8a2c('0xe'),JSON[_0x8a2c('0xf')](_0x4c237a));if(_0x4c237a[_0x8a2c('0x10')]){if(_0x4c237a[_0x8a2c('0x10')]['code']===0x1f4){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x43745f(_0x4c237a[_0x8a2c('0x10')]['message']);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4e007c,_0x4c237a['error'][_0x8a2c('0x11')]);return _0x1d2885(_0x4c237a[_0x8a2c('0x10')][_0x8a2c('0x11')]);}else{logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x4e007c,_0x8a2c('0xe'));_0x1d2885(_0x4c237a[_0x8a2c('0x12')][_0x8a2c('0x11')]);}})[_0x8a2c('0x13')](function(_0x4388b0){logger[_0x8a2c('0x10')](_0x8a2c('0xb'),_0x4e007c,_0x4388b0);_0x43745f(_0x4388b0);});});} \ No newline at end of file +var _0x5eb0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','message','ChatOfflineMessage,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3a916b,_0x52c081){var _0xd79daa=function(_0x54fc6b){while(--_0x54fc6b){_0x3a916b['push'](_0x3a916b['shift']());}};_0xd79daa(++_0x52c081);}(_0x5eb0,0x1c6));var _0x05eb=function(_0x1c54d9,_0x103787){_0x1c54d9=_0x1c54d9-0x0;var _0x5cfd93=_0x5eb0[_0x1c54d9];return _0x5cfd93;};'use strict';var _=require(_0x05eb('0x0'));var util=require(_0x05eb('0x1'));var moment=require(_0x05eb('0x2'));var BPromise=require(_0x05eb('0x3'));var rs=require(_0x05eb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x05eb('0x5'))['db'];var utils=require(_0x05eb('0x6'));var logger=require('../../config/logger')(_0x05eb('0x7'));var config=require(_0x05eb('0x8'));var jayson=require(_0x05eb('0x9'));var client=jayson[_0x05eb('0xa')][_0x05eb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24e619,_0x2cb40a,_0xd9edd9){return new BPromise(function(_0x1be049,_0x2b591c){return client[_0x05eb('0xc')](_0x24e619,_0xd9edd9)['then'](function(_0x4f9c8a){logger['info']('ChatOfflineMessage,\x20%s,\x20%s',_0x2cb40a,_0x05eb('0xd'));logger[_0x05eb('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x2cb40a,'request\x20sent',JSON[_0x05eb('0xf')](_0x4f9c8a));if(_0x4f9c8a[_0x05eb('0x10')]){if(_0x4f9c8a[_0x05eb('0x10')]['code']===0x1f4){logger[_0x05eb('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x2cb40a,_0x4f9c8a[_0x05eb('0x10')][_0x05eb('0x11')]);return _0x2b591c(_0x4f9c8a[_0x05eb('0x10')][_0x05eb('0x11')]);}logger[_0x05eb('0x10')](_0x05eb('0x12'),_0x2cb40a,_0x4f9c8a['error'][_0x05eb('0x11')]);return _0x1be049(_0x4f9c8a[_0x05eb('0x10')]['message']);}else{logger['info'](_0x05eb('0x12'),_0x2cb40a,_0x05eb('0xd'));_0x1be049(_0x4f9c8a['result'][_0x05eb('0x11')]);}})[_0x05eb('0x13')](function(_0x90fc54){logger[_0x05eb('0x10')](_0x05eb('0x12'),_0x2cb40a,_0x90fc54);_0x2b591c(_0x90fc54);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 8b03186..89fb7d7 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 _0xe0de=['index','/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x3f0792,_0x2040df){var _0x698224=function(_0x5c5b90){while(--_0x5c5b90){_0x3f0792['push'](_0x3f0792['shift']());}};_0x698224(++_0x2040df);}(_0xe0de,0x187));var _0xee0d=function(_0x31723f,_0x451ad6){_0x31723f=_0x31723f-0x0;var _0x3632c1=_0xe0de[_0x31723f];return _0x3632c1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xee0d('0x0'));var express=require(_0xee0d('0x1'));var router=express[_0xee0d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xee0d('0x3'));var interaction=require(_0xee0d('0x4'));var config=require(_0xee0d('0x5'));var controller=require(_0xee0d('0x6'));router[_0xee0d('0x7')]('/',auth['isAuthenticated'](),controller[_0xee0d('0x8')]);router[_0xee0d('0x7')](_0xee0d('0x9'),auth[_0xee0d('0xa')](),controller[_0xee0d('0xb')]);router[_0xee0d('0x7')](_0xee0d('0xc'),auth[_0xee0d('0xa')](),controller['show']);router[_0xee0d('0xd')]('/',auth[_0xee0d('0xa')](),controller[_0xee0d('0xe')]);router['put'](_0xee0d('0xc'),auth[_0xee0d('0xa')](),controller[_0xee0d('0xf')]);router[_0xee0d('0x10')](_0xee0d('0xc'),auth['isAuthenticated'](),controller[_0xee0d('0x11')]);module[_0xee0d('0x12')]=router; \ No newline at end of file +var _0x67a2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x5a8aa3,_0x2294d5){var _0x5d0458=function(_0x62d096){while(--_0x62d096){_0x5a8aa3['push'](_0x5a8aa3['shift']());}};_0x5d0458(++_0x2294d5);}(_0x67a2,0x1a3));var _0x267a=function(_0xa2d41,_0x29a7bf){_0xa2d41=_0xa2d41-0x0;var _0x164681=_0x67a2[_0xa2d41];return _0x164681;};'use strict';var multer=require(_0x267a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x267a('0x1'));var express=require(_0x267a('0x2'));var router=express[_0x267a('0x3')]();var fs_extra=require(_0x267a('0x4'));var auth=require(_0x267a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x267a('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0x267a('0x7')]('/',auth[_0x267a('0x8')](),controller[_0x267a('0x9')]);router[_0x267a('0x7')](_0x267a('0xa'),auth[_0x267a('0x8')](),controller[_0x267a('0xb')]);router[_0x267a('0x7')](_0x267a('0xc'),auth[_0x267a('0x8')](),controller[_0x267a('0xd')]);router[_0x267a('0xe')]('/',auth[_0x267a('0x8')](),controller[_0x267a('0xf')]);router[_0x267a('0x10')](_0x267a('0xc'),auth[_0x267a('0x8')](),controller[_0x267a('0x11')]);router[_0x267a('0x12')](_0x267a('0xc'),auth[_0x267a('0x8')](),controller[_0x267a('0x13')]);module[_0x267a('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 8a79aa8..d0b34ce 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 _0x7103=['ENUM','mouseOver','timeout','INTEGER','STRING'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x7103,0xb3));var _0x3710=function(_0x4839a2,_0x1f67eb){_0x4839a2=_0x4839a2-0x0;var _0x465147=_0x7103[_0x4839a2];return _0x465147;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3710('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x3710('0x1')](_0x3710('0x2'),_0x3710('0x3')),'defaultValue':_0x3710('0x2')},'selector':{'type':Sequelize[_0x3710('0x0')]},'timeout':{'type':Sequelize[_0x3710('0x4')]}}; \ No newline at end of file +var _0x0e17=['ENUM','mouseOver','timeout','INTEGER','STRING'];(function(_0x4ec3de,_0x1c67c4){var _0x37478a=function(_0x5afbd3){while(--_0x5afbd3){_0x4ec3de['push'](_0x4ec3de['shift']());}};_0x37478a(++_0x1c67c4);}(_0x0e17,0x8b));var _0x70e1=function(_0x2aa9dc,_0x52b1d7){_0x2aa9dc=_0x2aa9dc-0x0;var _0x3b27ac=_0x0e17[_0x2aa9dc];return _0x3b27ac;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x70e1('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x70e1('0x1')](_0x70e1('0x2'),_0x70e1('0x3')),'defaultValue':_0x70e1('0x2')},'selector':{'type':Sequelize[_0x70e1('0x0')]},'timeout':{'type':Sequelize[_0x70e1('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 103efe9..c37328f 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 _0xc15b=['show','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','merge','options','create','catch','body','find','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','update','then','error','stack','name','send'];(function(_0x74ad38,_0x49d438){var _0x35d762=function(_0x53322e){while(--_0x53322e){_0x74ad38['push'](_0x74ad38['shift']());}};_0x35d762(++_0x49d438);}(_0xc15b,0xe4));var _0xbc15=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xc15b[_0x5cc8];return _0x450661;};'use strict';var emlformat=require(_0xbc15('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc15('0x1'));var jsonpatch=require(_0xbc15('0x2'));var rp=require(_0xbc15('0x3'));var moment=require(_0xbc15('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xbc15('0x5'));var path=require(_0xbc15('0x6'));var sox=require(_0xbc15('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbc15('0x8'));var squel=require(_0xbc15('0x9'));var crypto=require(_0xbc15('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbc15('0xb'));var Papa=require('papaparse');var Redis=require(_0xbc15('0xc'));var authService=require(_0xbc15('0xd'));var qs=require(_0xbc15('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbc15('0xf'));var logger=require(_0xbc15('0x10'))('api');var utils=require(_0xbc15('0x11'));var config=require(_0xbc15('0x12'));var licenseUtil=require(_0xbc15('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52a50b,_0x5a659d){_0x5a659d=_0x5a659d||0xcc;return function(_0x299ad3){if(_0x299ad3){return _0x52a50b[_0xbc15('0x14')](_0x5a659d);}return _0x52a50b[_0xbc15('0x15')](_0x5a659d)[_0xbc15('0x16')]();};}function respondWithResult(_0x171c23,_0x105dd6){_0x105dd6=_0x105dd6||0xc8;return function(_0x309e59){if(_0x309e59){return _0x171c23[_0xbc15('0x15')](_0x105dd6)[_0xbc15('0x17')](_0x309e59);}};}function respondWithFilteredResult(_0x2cc035,_0xaebbd4){return function(_0x3dbb38){if(_0x3dbb38){var _0x110934=typeof _0xaebbd4[_0xbc15('0x18')]==='undefined'&&typeof _0xaebbd4[_0xbc15('0x19')]==='undefined';var _0x218054=_0x3dbb38[_0xbc15('0x1a')];var _0xa29e5f=_0x110934?0x0:_0xaebbd4[_0xbc15('0x18')];var _0x38a6b5=_0x110934?_0x3dbb38[_0xbc15('0x1a')]:_0xaebbd4[_0xbc15('0x18')]+_0xaebbd4[_0xbc15('0x19')];var _0x3a02a4;if(_0x38a6b5>=_0x218054){_0x38a6b5=_0x218054;_0x3a02a4=0xc8;}else{_0x3a02a4=0xce;}_0x2cc035[_0xbc15('0x15')](_0x3a02a4);return _0x2cc035[_0xbc15('0x1b')](_0xbc15('0x1c'),_0xa29e5f+'-'+_0x38a6b5+'/'+_0x218054)['json'](_0x3dbb38);}return null;};}function patchUpdates(_0x247ce3){return function(_0xa0eaa3){try{jsonpatch['apply'](_0xa0eaa3,_0x247ce3,!![]);}catch(_0x3e7f97){return BPromise[_0xbc15('0x1d')](_0x3e7f97);}return _0xa0eaa3[_0xbc15('0x1e')]();};}function saveUpdates(_0x278320,_0x2f8327){return function(_0x118266){if(_0x118266){return _0x118266[_0xbc15('0x1f')](_0x278320)[_0xbc15('0x20')](function(_0x5ac08d){return _0x5ac08d;});}return null;};}function removeEntity(_0x28a37a,_0x128ce2){return function(_0x212d52){if(_0x212d52){return _0x212d52['destroy']()[_0xbc15('0x20')](function(){_0x28a37a[_0xbc15('0x15')](0xcc)[_0xbc15('0x16')]();});}};}function handleEntityNotFound(_0x15f6a9,_0x20d167){return function(_0x2a76de){if(!_0x2a76de){_0x15f6a9['sendStatus'](0x194);}return _0x2a76de;};}function handleError(_0x3094f3,_0xd51ff2){_0xd51ff2=_0xd51ff2||0x1f4;return function(_0x136852){logger[_0xbc15('0x21')](_0x136852[_0xbc15('0x22')]);if(_0x136852[_0xbc15('0x23')]){delete _0x136852[_0xbc15('0x23')];}_0x3094f3[_0xbc15('0x15')](_0xd51ff2)[_0xbc15('0x24')](_0x136852);};}exports[_0xbc15('0x25')]=function(_0x2497de,_0x71e718){var _0x4f2350={'raw':!![],'where':{'id':_0x2497de['params']['id']}},_0x53f5c8={};_0x53f5c8[_0xbc15('0x26')]=_[_0xbc15('0x27')](db[_0xbc15('0x28')][_0xbc15('0x29')]);_0x53f5c8[_0xbc15('0x2a')]=_[_0xbc15('0x27')](_0x2497de[_0xbc15('0x2a')]);_0x53f5c8['filters']=_[_0xbc15('0x2b')](_0x53f5c8[_0xbc15('0x26')],_0x53f5c8['query']);_0x4f2350[_0xbc15('0x2c')]=_['intersection'](_0x53f5c8[_0xbc15('0x26')],qs[_0xbc15('0x2d')](_0x2497de['query'][_0xbc15('0x2d')]));_0x4f2350['attributes']=_0x4f2350[_0xbc15('0x2c')]['length']?_0x4f2350['attributes']:_0x53f5c8['model'];if(_0x2497de[_0xbc15('0x2a')]['includeAll']){_0x4f2350['include']=[{'all':!![]}];}_0x4f2350=_[_0xbc15('0x2e')]({},_0x4f2350,_0x2497de[_0xbc15('0x2f')]);return db['ChatProactiveAction']['find'](_0x4f2350)['then'](handleEntityNotFound(_0x71e718,null))[_0xbc15('0x20')](respondWithResult(_0x71e718,null))['catch'](handleError(_0x71e718,null));};exports[_0xbc15('0x30')]=function(_0x16c57b,_0x1b2737){return db[_0xbc15('0x28')][_0xbc15('0x30')](_0x16c57b['body'],{})[_0xbc15('0x20')](respondWithResult(_0x1b2737,0xc9))[_0xbc15('0x31')](handleError(_0x1b2737,null));};exports[_0xbc15('0x1f')]=function(_0x3d193b,_0x28b281){if(_0x3d193b['body']['id']){delete _0x3d193b[_0xbc15('0x32')]['id'];}return db[_0xbc15('0x28')][_0xbc15('0x33')]({'where':{'id':_0x3d193b[_0xbc15('0x34')]['id']}})[_0xbc15('0x20')](handleEntityNotFound(_0x28b281,null))[_0xbc15('0x20')](saveUpdates(_0x3d193b[_0xbc15('0x32')],null))['then'](respondWithResult(_0x28b281,null))['catch'](handleError(_0x28b281,null));};exports['destroy']=function(_0x514352,_0x9bcde6){return db[_0xbc15('0x28')][_0xbc15('0x33')]({'where':{'id':_0x514352[_0xbc15('0x34')]['id']}})[_0xbc15('0x20')](handleEntityNotFound(_0x9bcde6,null))['then'](removeEntity(_0x9bcde6,null))[_0xbc15('0x31')](handleError(_0x9bcde6,null));}; \ No newline at end of file +var _0xcca7=['query','keys','filters','intersection','attributes','model','length','includeAll','include','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','show','params','ChatProactiveAction','rawAttributes'];(function(_0x190d2c,_0x159734){var _0x83d998=function(_0x291357){while(--_0x291357){_0x190d2c['push'](_0x190d2c['shift']());}};_0x83d998(++_0x159734);}(_0xcca7,0x1aa));var _0x7cca=function(_0x3b1a5b,_0x11e93e){_0x3b1a5b=_0x3b1a5b-0x0;var _0x1775d2=_0xcca7[_0x3b1a5b];return _0x1775d2;};'use strict';var emlformat=require(_0x7cca('0x0'));var rimraf=require(_0x7cca('0x1'));var zipdir=require(_0x7cca('0x2'));var jsonpatch=require(_0x7cca('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7cca('0x4'));var Mustache=require('mustache');var util=require(_0x7cca('0x5'));var path=require(_0x7cca('0x6'));var sox=require(_0x7cca('0x7'));var csv=require(_0x7cca('0x8'));var ejs=require(_0x7cca('0x9'));var fs=require('fs');var fs_extra=require(_0x7cca('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x7cca('0xb'));var jsforce=require(_0x7cca('0xc'));var deskjs=require(_0x7cca('0xd'));var toCsv=require(_0x7cca('0x8'));var querystring=require(_0x7cca('0xe'));var Papa=require(_0x7cca('0xf'));var Redis=require(_0x7cca('0x10'));var authService=require(_0x7cca('0x11'));var qs=require(_0x7cca('0x12'));var as=require(_0x7cca('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cca('0x14'))(_0x7cca('0x15'));var utils=require(_0x7cca('0x16'));var config=require(_0x7cca('0x17'));var licenseUtil=require(_0x7cca('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a14cc,_0x41e0a2){_0x41e0a2=_0x41e0a2||0xcc;return function(_0x2854c7){if(_0x2854c7){return _0x2a14cc['sendStatus'](_0x41e0a2);}return _0x2a14cc['status'](_0x41e0a2)[_0x7cca('0x19')]();};}function respondWithResult(_0x20c1b2,_0x27d671){_0x27d671=_0x27d671||0xc8;return function(_0x847cce){if(_0x847cce){return _0x20c1b2[_0x7cca('0x1a')](_0x27d671)[_0x7cca('0x1b')](_0x847cce);}};}function respondWithFilteredResult(_0x45143d,_0x5a357d){return function(_0x216d4b){if(_0x216d4b){var _0x533608=typeof _0x5a357d['offset']==='undefined'&&typeof _0x5a357d[_0x7cca('0x1c')]===_0x7cca('0x1d');var _0x1dd043=_0x216d4b[_0x7cca('0x1e')];var _0x44294b=_0x533608?0x0:_0x5a357d['offset'];var _0xb35e1d=_0x533608?_0x216d4b['count']:_0x5a357d['offset']+_0x5a357d['limit'];var _0x370469;if(_0xb35e1d>=_0x1dd043){_0xb35e1d=_0x1dd043;_0x370469=0xc8;}else{_0x370469=0xce;}_0x45143d[_0x7cca('0x1a')](_0x370469);return _0x45143d[_0x7cca('0x1f')](_0x7cca('0x20'),_0x44294b+'-'+_0xb35e1d+'/'+_0x1dd043)[_0x7cca('0x1b')](_0x216d4b);}return null;};}function patchUpdates(_0x45db2f){return function(_0x2e023c){try{jsonpatch[_0x7cca('0x21')](_0x2e023c,_0x45db2f,!![]);}catch(_0x4d7804){return BPromise[_0x7cca('0x22')](_0x4d7804);}return _0x2e023c[_0x7cca('0x23')]();};}function saveUpdates(_0x165d13,_0x4343a3){return function(_0x55b689){if(_0x55b689){return _0x55b689[_0x7cca('0x24')](_0x165d13)[_0x7cca('0x25')](function(_0x4367f9){return _0x4367f9;});}return null;};}function removeEntity(_0x119d76,_0x823d7d){return function(_0x3fc157){if(_0x3fc157){return _0x3fc157[_0x7cca('0x26')]()[_0x7cca('0x25')](function(){_0x119d76['status'](0xcc)[_0x7cca('0x19')]();});}};}function handleEntityNotFound(_0x1dd3b3,_0x1774fc){return function(_0xdaf07f){if(!_0xdaf07f){_0x1dd3b3[_0x7cca('0x27')](0x194);}return _0xdaf07f;};}function handleError(_0x21da68,_0x35ebe8){_0x35ebe8=_0x35ebe8||0x1f4;return function(_0x40ac86){logger['error'](_0x40ac86[_0x7cca('0x28')]);if(_0x40ac86['name']){delete _0x40ac86[_0x7cca('0x29')];}_0x21da68[_0x7cca('0x1a')](_0x35ebe8)['send'](_0x40ac86);};}exports[_0x7cca('0x2a')]=function(_0x3d91b1,_0x5533fb){var _0x249442={'raw':!![],'where':{'id':_0x3d91b1[_0x7cca('0x2b')]['id']}},_0x1cd53a={};_0x1cd53a['model']=_['keys'](db[_0x7cca('0x2c')][_0x7cca('0x2d')]);_0x1cd53a[_0x7cca('0x2e')]=_[_0x7cca('0x2f')](_0x3d91b1[_0x7cca('0x2e')]);_0x1cd53a[_0x7cca('0x30')]=_[_0x7cca('0x31')](_0x1cd53a['model'],_0x1cd53a['query']);_0x249442[_0x7cca('0x32')]=_[_0x7cca('0x31')](_0x1cd53a[_0x7cca('0x33')],qs['fields'](_0x3d91b1[_0x7cca('0x2e')]['fields']));_0x249442[_0x7cca('0x32')]=_0x249442[_0x7cca('0x32')][_0x7cca('0x34')]?_0x249442[_0x7cca('0x32')]:_0x1cd53a['model'];if(_0x3d91b1[_0x7cca('0x2e')][_0x7cca('0x35')]){_0x249442[_0x7cca('0x36')]=[{'all':!![]}];}_0x249442=_['merge']({},_0x249442,_0x3d91b1['options']);return db['ChatProactiveAction'][_0x7cca('0x37')](_0x249442)[_0x7cca('0x25')](handleEntityNotFound(_0x5533fb,null))['then'](respondWithResult(_0x5533fb,null))[_0x7cca('0x38')](handleError(_0x5533fb,null));};exports[_0x7cca('0x39')]=function(_0x193a4c,_0x1d6db0){return db[_0x7cca('0x2c')][_0x7cca('0x39')](_0x193a4c[_0x7cca('0x3a')],{})['then'](respondWithResult(_0x1d6db0,0xc9))[_0x7cca('0x38')](handleError(_0x1d6db0,null));};exports[_0x7cca('0x24')]=function(_0x4128e5,_0x147cf8){if(_0x4128e5['body']['id']){delete _0x4128e5[_0x7cca('0x3a')]['id'];}return db[_0x7cca('0x2c')][_0x7cca('0x37')]({'where':{'id':_0x4128e5['params']['id']}})[_0x7cca('0x25')](handleEntityNotFound(_0x147cf8,null))['then'](saveUpdates(_0x4128e5[_0x7cca('0x3a')],null))[_0x7cca('0x25')](respondWithResult(_0x147cf8,null))[_0x7cca('0x38')](handleError(_0x147cf8,null));};exports[_0x7cca('0x26')]=function(_0x44fbd7,_0x25b3a9){return db[_0x7cca('0x2c')][_0x7cca('0x37')]({'where':{'id':_0x44fbd7[_0x7cca('0x2b')]['id']}})['then'](handleEntityNotFound(_0x25b3a9,null))['then'](removeEntity(_0x25b3a9,null))[_0x7cca('0x38')](handleError(_0x25b3a9,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 6e3fb23..e838b60 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 _0xfb3c=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions'];(function(_0x579bc0,_0x34c0cc){var _0x379218=function(_0x1afd20){while(--_0x1afd20){_0x579bc0['push'](_0x579bc0['shift']());}};_0x379218(++_0x34c0cc);}(_0xfb3c,0xa9));var _0xcfb3=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xfb3c[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xcfb3('0x0'));var util=require(_0xcfb3('0x1'));var logger=require(_0xcfb3('0x2'))(_0xcfb3('0x3'));var moment=require(_0xcfb3('0x4'));var BPromise=require(_0xcfb3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcfb3('0x6'));var rimraf=require(_0xcfb3('0x7'));var config=require(_0xcfb3('0x8'));var attributes=require(_0xcfb3('0x9'));module[_0xcfb3('0xa')]=function(_0x49c6f7,_0x3d9ff1){return _0x49c6f7['define'](_0xcfb3('0xb'),attributes,{'tableName':_0xcfb3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc2a=['./chatProactiveAction.attributes','ChatProactiveAction','chat_proactive_actions','util','bluebird','../../config/environment'];(function(_0x1d9a84,_0x157084){var _0x418754=function(_0xfc0e01){while(--_0xfc0e01){_0x1d9a84['push'](_0x1d9a84['shift']());}};_0x418754(++_0x157084);}(_0xbc2a,0x17d));var _0xabc2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xabc2('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xabc2('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xabc2('0x2'));var attributes=require(_0xabc2('0x3'));module['exports']=function(_0x2462fe,_0x29cc36){return _0x2462fe['define'](_0xabc2('0x4'),attributes,{'tableName':_0xabc2('0x5'),'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 5466348..0efdc7d 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 _0xa2c9=['request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x25ae13,_0x3515f5){var _0x372648=function(_0x1f79e7){while(--_0x1f79e7){_0x25ae13['push'](_0x25ae13['shift']());}};_0x372648(++_0x3515f5);}(_0xa2c9,0x7f));var _0x9a2c=function(_0x5c590d,_0x58422a){_0x5c590d=_0x5c590d-0x0;var _0x32b090=_0xa2c9[_0x5c590d];return _0x32b090;};'use strict';var _=require('lodash');var util=require(_0x9a2c('0x0'));var moment=require(_0x9a2c('0x1'));var BPromise=require(_0x9a2c('0x2'));var rs=require(_0x9a2c('0x3'));var fs=require('fs');var Redis=require(_0x9a2c('0x4'));var db=require(_0x9a2c('0x5'))['db'];var utils=require(_0x9a2c('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9a2c('0x7'));var jayson=require(_0x9a2c('0x8'));var client=jayson[_0x9a2c('0x9')][_0x9a2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x588128,_0x507a42,_0x583adc){return new BPromise(function(_0x17c0bc,_0x366933){return client[_0x9a2c('0xb')](_0x588128,_0x583adc)[_0x9a2c('0xc')](function(_0x128d11){logger[_0x9a2c('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x507a42,_0x9a2c('0xe'));logger[_0x9a2c('0xf')](_0x9a2c('0x10'),_0x507a42,_0x9a2c('0xe'),JSON[_0x9a2c('0x11')](_0x128d11));if(_0x128d11[_0x9a2c('0x12')]){if(_0x128d11['error']['code']===0x1f4){logger[_0x9a2c('0x12')](_0x9a2c('0x13'),_0x507a42,_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);return _0x366933(_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);}logger['error'](_0x9a2c('0x13'),_0x507a42,_0x128d11[_0x9a2c('0x12')]['message']);return _0x17c0bc(_0x128d11[_0x9a2c('0x12')][_0x9a2c('0x14')]);}else{logger[_0x9a2c('0xd')](_0x9a2c('0x13'),_0x507a42,_0x9a2c('0xe'));_0x17c0bc(_0x128d11[_0x9a2c('0x15')][_0x9a2c('0x14')]);}})[_0x9a2c('0x16')](function(_0x47be0c){logger['error'](_0x9a2c('0x13'),_0x507a42,_0x47be0c);_0x366933(_0x47be0c);});});} \ No newline at end of file +var _0xa548=['ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','ioredis','../../mysqldb','../../config/utils','client','request','then'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0xa548,0x119));var _0x8a54=function(_0x591a91,_0x1970cd){_0x591a91=_0x591a91-0x0;var _0x3fe834=_0xa548[_0x591a91];return _0x3fe834;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x8a54('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a54('0x1'));var db=require(_0x8a54('0x2'))['db'];var utils=require(_0x8a54('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8a54('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9885,_0x45cc1d,_0x5b03bf){return new BPromise(function(_0x1dd753,_0x2f286b){return client[_0x8a54('0x5')](_0x2b9885,_0x5b03bf)[_0x8a54('0x6')](function(_0x2686a3){logger['info'](_0x8a54('0x7'),_0x45cc1d,_0x8a54('0x8'));logger[_0x8a54('0x9')](_0x8a54('0xa'),_0x45cc1d,_0x8a54('0x8'),JSON[_0x8a54('0xb')](_0x2686a3));if(_0x2686a3['error']){if(_0x2686a3[_0x8a54('0xc')]['code']===0x1f4){logger[_0x8a54('0xc')](_0x8a54('0x7'),_0x45cc1d,_0x2686a3['error']['message']);return _0x2f286b(_0x2686a3[_0x8a54('0xc')]['message']);}logger[_0x8a54('0xc')](_0x8a54('0x7'),_0x45cc1d,_0x2686a3['error'][_0x8a54('0xd')]);return _0x1dd753(_0x2686a3[_0x8a54('0xc')][_0x8a54('0xd')]);}else{logger['info'](_0x8a54('0x7'),_0x45cc1d,_0x8a54('0x8'));_0x1dd753(_0x2686a3[_0x8a54('0xe')][_0x8a54('0xd')]);}})[_0x8a54('0xf')](function(_0x260590){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x45cc1d,_0x260590);_0x2f286b(_0x260590);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 485b16c..82f699a 100644 --- a/server/api/chatProactiveAction/index.js +++ b/server/api/chatProactiveAction/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7217=['Router','fs-extra','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x16043a,_0x4285ed){var _0x318fb8=function(_0x3bf20e){while(--_0x3bf20e){_0x16043a['push'](_0x16043a['shift']());}};_0x318fb8(++_0x4285ed);}(_0x7217,0x19e));var _0x7721=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x7217[_0xbe200f];return _0x192597;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xb')]);router[_0x7721('0xc')]('/',auth[_0x7721('0xa')](),controller[_0x7721('0xd')]);router[_0x7721('0xe')](_0x7721('0x9'),auth[_0x7721('0xa')](),controller[_0x7721('0xf')]);router[_0x7721('0x10')](_0x7721('0x9'),auth['isAuthenticated'](),controller[_0x7721('0x11')]);module[_0x7721('0x12')]=router; \ No newline at end of file +var _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x1fcf3a,_0x5c2aa9){var _0x50b607=function(_0x29fecd){while(--_0x29fecd){_0x1fcf3a['push'](_0x1fcf3a['shift']());}};_0x50b607(++_0x5c2aa9);}(_0x032e,0x124));var _0xe032=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x032e[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b385108..734c445 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 _0xe6a0=['ENUM','beepall','roundrobin','exports','STRING','INTEGER'];(function(_0xa01c9a,_0x543429){var _0x48fff9=function(_0xe8911d){while(--_0xe8911d){_0xa01c9a['push'](_0xa01c9a['shift']());}};_0x48fff9(++_0x543429);}(_0xe6a0,0xc3));var _0x0e6a=function(_0x176aac,_0x5ebc5f){_0x176aac=_0x176aac-0x0;var _0xbabab6=_0xe6a0[_0x176aac];return _0xbabab6;};'use strict';var Sequelize=require('sequelize');module[_0x0e6a('0x0')]={'name':{'type':Sequelize[_0x0e6a('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0e6a('0x1')]},'timeout':{'type':Sequelize[_0x0e6a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0e6a('0x3')]('rrmemory',_0x0e6a('0x4'),_0x0e6a('0x5'))}}; \ No newline at end of file +var _0xd281=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x17c22b,_0x583b15){var _0x1f7b84=function(_0x2a65c9){while(--_0x2a65c9){_0x17c22b['push'](_0x17c22b['shift']());}};_0x1f7b84(++_0x583b15);}(_0xd281,0xc5));var _0x1d28=function(_0x496309,_0xf77de8){_0x496309=_0x496309-0x0;var _0x4e95df=_0xd281[_0x496309];return _0x4e95df;};'use strict';var Sequelize=require(_0x1d28('0x0'));module[_0x1d28('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1d28('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1d28('0x3')]},'timeout':{'type':Sequelize[_0x1d28('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1d28('0x5')](_0x1d28('0x6'),_0x1d28('0x7'),_0x1d28('0x8'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 057dd35..94b5de3 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 _0x457f=['field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','sequelize','QueryTypes','SELECT','every','TeamId','union','compact','ids','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','ChatQueues','error','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','fields','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','pick','filter','UserChatQueue','User','findAndCountAll','chatPause','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','options','addTeams','Agents','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','select'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x457f,0x18b));var _0xf457=function(_0x150e01,_0x3fd606){_0x150e01=_0x150e01-0x0;var _0x174a2d=_0x457f[_0x150e01];return _0x174a2d;};'use strict';var BPromise=require(_0xf457('0x0'));var util=require(_0xf457('0x1'));var _=require(_0xf457('0x2'));var squel=require(_0xf457('0x3'));var Redis=require(_0xf457('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0xf457('0x5'))(_0xf457('0x6'));var config=require(_0xf457('0x7'));var db=require(_0xf457('0x8'))['db'];config[_0xf457('0x9')]=_['defaults'](config[_0xf457('0x9')],{'host':_0xf457('0xa'),'port':0x18eb});var socket=require(_0xf457('0xb'))(new Redis(config[_0xf457('0x9')]));require(_0xf457('0xc'))[_0xf457('0xd')](socket);function respondWithStatusCode(_0x21f323,_0x5eb880){_0x5eb880=_0x5eb880||0xcc;return function(_0x3e195d){if(_0x3e195d){return _0x21f323[_0xf457('0xe')](_0x5eb880);}return _0x21f323['status'](_0x5eb880)[_0xf457('0xf')]();};}function respondWithResult(_0x5cb88e,_0x12a9b6){_0x12a9b6=_0x12a9b6||0xc8;return function(_0x13848c){if(_0x13848c){return _0x5cb88e[_0xf457('0x10')](_0x12a9b6)[_0xf457('0x11')](_0x13848c);}};}function respondWithFilteredResult(_0x25efe2,_0x2f29dd){return function(_0x5bde9a){if(_0x5bde9a){var _0x1c7f8e=typeof _0x2f29dd[_0xf457('0x12')]==='undefined'&&typeof _0x2f29dd[_0xf457('0x13')]===_0xf457('0x14');var _0x1718dd=_0x5bde9a['count'];var _0x255120=_0x1c7f8e?0x0:_0x2f29dd[_0xf457('0x12')];var _0x3ab74a=_0x1c7f8e?_0x5bde9a[_0xf457('0x15')]:_0x2f29dd['offset']+_0x2f29dd[_0xf457('0x13')];var _0x5f3359;if(_0x3ab74a>=_0x1718dd){_0x3ab74a=_0x1718dd;_0x5f3359=0xc8;}else{_0x5f3359=0xce;}_0x25efe2[_0xf457('0x10')](_0x5f3359);return _0x25efe2[_0xf457('0x16')](_0xf457('0x17'),_0x255120+'-'+_0x3ab74a+'/'+_0x1718dd)[_0xf457('0x11')](_0x5bde9a);}return null;};}function saveUpdates(_0x4c4b61){return function(_0x24f294){if(_0x24f294){return _0x24f294['update'](_0x4c4b61)[_0xf457('0x18')](function(_0x11e7d1){return _0x11e7d1;});}return null;};}function removeEntity(_0x5a8bad){return function(_0x3bf9b9){if(_0x3bf9b9){return _0x3bf9b9[_0xf457('0x19')]()[_0xf457('0x18')](function(){var _0x6608e4=_0x3bf9b9[_0xf457('0x1a')]({'plain':!![]});var _0x4d68e3=_0xf457('0x1b');return db['UserProfileResource']['destroy']({'where':{'type':_0x4d68e3,'resourceId':_0x6608e4['id']}})['then'](function(){return _0x3bf9b9;});})[_0xf457('0x18')](function(){_0x5a8bad[_0xf457('0x10')](0xcc)[_0xf457('0xf')]();});}};}function handleEntityNotFound(_0x57f491){return function(_0x396a86){if(!_0x396a86){_0x57f491[_0xf457('0xe')](0x194);}return _0x396a86;};}function handleError(_0x51933f,_0x11fd9d){_0x11fd9d=_0x11fd9d||0x1f4;return function(_0x5c7035){logger[_0xf457('0x1c')](_0x5c7035[_0xf457('0x1d')]);if(_0x5c7035[_0xf457('0x1e')]){delete _0x5c7035[_0xf457('0x1e')];}_0x51933f['status'](_0x11fd9d)[_0xf457('0x1f')](_0x5c7035);};}exports[_0xf457('0x20')]=function(_0x37f398,_0xb8414c){var _0xb9e7c4={};var _0x176ae3={'count':0x0,'rows':[]};var _0x30e8f2=_[_0xf457('0x21')](db[_0xf457('0x22')][_0xf457('0x23')],function(_0x1e214d){return{'name':_0x1e214d['fieldName'],'type':_0x1e214d[_0xf457('0x24')][_0xf457('0x25')]};});_0xb9e7c4=qs[_0xf457('0x26')](_0x30e8f2,_0x37f398);var _0x2ba9e0={'where':_0xb9e7c4[_0xf457('0x27')]};return db[_0xf457('0x22')][_0xf457('0x15')](_0x2ba9e0)[_0xf457('0x18')](function(_0x2d4bda){_0x176ae3[_0xf457('0x15')]=_0x2d4bda;_0xb9e7c4['include']=qs[_0xf457('0x28')](_0x37f398[_0xf457('0x29')]);return db[_0xf457('0x22')][_0xf457('0x2a')](_0xb9e7c4);})['then'](function(_0x2c1f98){_0x176ae3['rows']=_0x2c1f98;return _0x176ae3;})[_0xf457('0x18')](respondWithFilteredResult(_0xb8414c,_0xb9e7c4))[_0xf457('0x2b')](handleError(_0xb8414c,null));};exports[_0xf457('0x2c')]=function(_0x2b4f02,_0x2256c2){var _0x117e5d={'raw':!![],'where':{'id':_0x2b4f02['params']['id']}},_0x5289e8={};_0x5289e8[_0xf457('0x2d')]=_[_0xf457('0x2e')](db[_0xf457('0x22')][_0xf457('0x23')]);_0x5289e8[_0xf457('0x29')]=_['keys'](_0x2b4f02[_0xf457('0x29')]);_0x5289e8[_0xf457('0x2f')]=_[_0xf457('0x30')](_0x5289e8[_0xf457('0x2d')],_0x5289e8[_0xf457('0x29')]);_0x117e5d[_0xf457('0x31')]=_[_0xf457('0x30')](_0x5289e8[_0xf457('0x2d')],qs['fields'](_0x2b4f02[_0xf457('0x29')][_0xf457('0x32')]));_0x117e5d[_0xf457('0x31')]=_0x117e5d[_0xf457('0x31')][_0xf457('0x33')]?_0x117e5d[_0xf457('0x31')]:_0x5289e8[_0xf457('0x2d')];if(_0x2b4f02[_0xf457('0x29')]['includeAll']){_0x117e5d[_0xf457('0x28')]=[{'all':!![]}];}_0x117e5d=_[_0xf457('0x34')]({},_0x117e5d,_0x2b4f02['options']);return db['ChatQueue'][_0xf457('0x35')](_0x117e5d)[_0xf457('0x18')](handleEntityNotFound(_0x2256c2,null))[_0xf457('0x18')](respondWithResult(_0x2256c2,null))[_0xf457('0x2b')](handleError(_0x2256c2,null));};exports[_0xf457('0x36')]=function(_0x4537d1,_0x5e4474){return db[_0xf457('0x22')][_0xf457('0x36')](_0x4537d1[_0xf457('0x37')],{})['then'](function(_0x539468){var _0x4a58c1=_0x4537d1[_0xf457('0x38')][_0xf457('0x1a')]({'plain':!![]});if(!_0x4a58c1)throw new Error(_0xf457('0x39'));if(_0x4a58c1[_0xf457('0x3a')]===_0xf457('0x38')){var _0x3141c1=_0x539468[_0xf457('0x1a')]({'plain':!![]});var _0x2b64a6=_0xf457('0x1b');return db[_0xf457('0x3b')][_0xf457('0x35')]({'where':{'name':_0x2b64a6,'userProfileId':_0x4a58c1[_0xf457('0x3c')]},'raw':!![]})[_0xf457('0x18')](function(_0x505da9){if(_0x505da9&&_0x505da9[_0xf457('0x3d')]===0x0){return db[_0xf457('0x3e')]['create']({'name':_0x3141c1[_0xf457('0x1e')],'resourceId':_0x3141c1['id'],'type':_0x505da9[_0xf457('0x1e')],'sectionId':_0x505da9['id']},{})['then'](function(){return _0x539468;});}else{return _0x539468;}})[_0xf457('0x2b')](function(_0x1c65ef){logger[_0xf457('0x1c')](_0xf457('0x3f'),_0x1c65ef);throw _0x1c65ef;});}return _0x539468;})[_0xf457('0x18')](respondWithResult(_0x5e4474,0xc9))['catch'](handleError(_0x5e4474,null));};exports[_0xf457('0x40')]=function(_0x19f1ad,_0x393d27){if(_0x19f1ad[_0xf457('0x37')]['id']){delete _0x19f1ad['body']['id'];}return db[_0xf457('0x22')][_0xf457('0x35')]({'where':{'id':_0x19f1ad['params']['id']}})[_0xf457('0x18')](handleEntityNotFound(_0x393d27,null))['then'](saveUpdates(_0x19f1ad['body'],null))[_0xf457('0x18')](respondWithResult(_0x393d27,null))['catch'](handleError(_0x393d27,null));};exports[_0xf457('0x19')]=function(_0x2fcb45,_0x22ca76){return db['ChatQueue']['find']({'where':{'id':_0x2fcb45[_0xf457('0x41')]['id']}})['then'](handleEntityNotFound(_0x22ca76,null))['then'](removeEntity(_0x22ca76,null))[_0xf457('0x2b')](handleError(_0x22ca76,null));};exports[_0xf457('0x42')]=function(_0xdf7a1,_0x1bdb1d){return db['ChatQueue']['describe']()[_0xf457('0x18')](respondWithResult(_0x1bdb1d,null))[_0xf457('0x2b')](handleError(_0x1bdb1d,null));};exports[_0xf457('0x43')]=function(_0xbc4d3f,_0x335b25){var _0x2f1dbe={'raw':!![],'where':{}},_0x2698cb={},_0xdb7060;return db[_0xf457('0x22')][_0xf457('0x44')]({'where':{'id':_0xbc4d3f[_0xf457('0x41')]['id']}})[_0xf457('0x18')](handleEntityNotFound(_0x335b25,null))['then'](function(_0xa807c3){if(_0xa807c3){_0xdb7060=_0xa807c3[_0xf457('0x1a')]({'plain':!![]});_0x2698cb[_0xf457('0x2d')]=_[_0xf457('0x2e')](db['UserChatQueue']['rawAttributes']);_0x2698cb['query']=_['keys'](_0xbc4d3f['query']);_0x2698cb[_0xf457('0x2f')]=_[_0xf457('0x30')](_0x2698cb[_0xf457('0x2d')],_0x2698cb[_0xf457('0x29')]);_0x2f1dbe[_0xf457('0x31')]=_['intersection'](_0x2698cb[_0xf457('0x2d')],qs[_0xf457('0x32')](_0xbc4d3f[_0xf457('0x29')][_0xf457('0x32')]));_0x2f1dbe['attributes']=_0x2f1dbe[_0xf457('0x31')][_0xf457('0x33')]?_0x2f1dbe[_0xf457('0x31')]:_0x2698cb['model'];if(!_0xbc4d3f['query'][_0xf457('0x45')](_0xf457('0x46'))){_0x2f1dbe['limit']=qs['limit'](_0xbc4d3f['query'][_0xf457('0x13')]);_0x2f1dbe[_0xf457('0x12')]=qs[_0xf457('0x12')](_0xbc4d3f[_0xf457('0x29')][_0xf457('0x12')]);}_0x2f1dbe[_0xf457('0x47')]=qs[_0xf457('0x48')](_0xbc4d3f['query'][_0xf457('0x48')]);_0x2f1dbe[_0xf457('0x27')]=qs[_0xf457('0x2f')](_[_0xf457('0x49')](_0xbc4d3f[_0xf457('0x29')],_0x2698cb[_0xf457('0x2f')]));_0x2f1dbe[_0xf457('0x27')]['ChatQueueId']=_0xa807c3['id'];if(_0xbc4d3f[_0xf457('0x29')]['filter']){_0x2f1dbe[_0xf457('0x27')]=_[_0xf457('0x34')](_0x2f1dbe[_0xf457('0x27')],{'$or':_[_0xf457('0x21')](_0x2f1dbe[_0xf457('0x31')],function(_0x1e6c6a){var _0x482589={};_0x482589[_0x1e6c6a]={'$like':'%'+_0xbc4d3f['query'][_0xf457('0x4a')]+'%'};return _0x482589;})});}_0x2f1dbe=_[_0xf457('0x34')]({},_0x2f1dbe,_0xbc4d3f['options']);return db[_0xf457('0x4b')][_0xf457('0x2a')](_0x2f1dbe);}})[_0xf457('0x18')](function(_0x4bf555){if(_0x4bf555){return db[_0xf457('0x4c')][_0xf457('0x4d')]({'where':{'id':_[_0xf457('0x21')](_0x4bf555,'UserId'),'role':'agent'},'attributes':['id',_0xf457('0x1e'),_0xf457('0x4e'),'updatedAt',_0xf457('0x4f')]});}})[_0xf457('0x18')](function(_0x39223a){if(_0x39223a){return{'count':_0x39223a[_0xf457('0x15')],'rows':_['map'](_0x39223a[_0xf457('0x50')],function(_0x199b6c){return{'membername':_0x199b6c[_0xf457('0x1e')],'UserId':_0x199b6c['id'],'queue_name':_0xdb7060[_0xf457('0x1e')],'ChatQueueId':_0xdb7060['id'],'interface':util[_0xf457('0x51')](_0xf457('0x52'),_0xf457('0x53'),_0x199b6c[_0xf457('0x1e')]),'penalty':0x0,'paused':_0x199b6c[_0xf457('0x4e')],'createdAt':_0x199b6c[_0xf457('0x4f')],'updatedAt':_0x199b6c[_0xf457('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf457('0x18')](respondWithFilteredResult(_0x335b25,_0x2f1dbe))[_0xf457('0x2b')](handleError(_0x335b25,null));};exports[_0xf457('0x55')]=function(_0x4d5bdc,_0x4fe83b){var _0x5dd23c={};var _0x1156ae={};var _0x4213f0;var _0xb41770;return db['ChatQueue']['findOne']({'where':{'id':_0x4d5bdc[_0xf457('0x41')]['id']}})['then'](handleEntityNotFound(_0x4fe83b,null))[_0xf457('0x18')](function(_0x2f6ec0){if(_0x2f6ec0){_0x4213f0=_0x2f6ec0;_0x1156ae['model']=_['keys'](db['Team']['rawAttributes']);_0x1156ae[_0xf457('0x29')]=_[_0xf457('0x2e')](_0x4d5bdc[_0xf457('0x29')]);_0x1156ae[_0xf457('0x2f')]=_[_0xf457('0x30')](_0x1156ae['model'],_0x1156ae[_0xf457('0x29')]);_0x5dd23c['attributes']=_[_0xf457('0x30')](_0x1156ae[_0xf457('0x2d')],qs[_0xf457('0x32')](_0x4d5bdc[_0xf457('0x29')][_0xf457('0x32')]));_0x5dd23c[_0xf457('0x31')]=_0x5dd23c[_0xf457('0x31')][_0xf457('0x33')]?_0x5dd23c[_0xf457('0x31')]:_0x1156ae['model'];_0x5dd23c[_0xf457('0x47')]=qs[_0xf457('0x48')](_0x4d5bdc['query']['sort']);_0x5dd23c[_0xf457('0x27')]=qs[_0xf457('0x2f')](_[_0xf457('0x49')](_0x4d5bdc[_0xf457('0x29')],_0x1156ae[_0xf457('0x2f')]));if(_0x4d5bdc[_0xf457('0x29')][_0xf457('0x4a')]){_0x5dd23c[_0xf457('0x27')]=_[_0xf457('0x34')](_0x5dd23c['where'],{'$or':_[_0xf457('0x21')](_0x5dd23c[_0xf457('0x31')],function(_0x384a4f){var _0x21da05={};_0x21da05[_0x384a4f]={'$like':'%'+_0x4d5bdc['query']['filter']+'%'};return _0x21da05;})});}_0x5dd23c=_[_0xf457('0x34')]({},_0x5dd23c,_0x4d5bdc[_0xf457('0x56')]);return _0x4213f0[_0xf457('0x55')](_0x5dd23c);}})['then'](function(_0x45dc11){if(_0x45dc11){_0xb41770=_0x45dc11[_0xf457('0x33')];if(!_0x4d5bdc[_0xf457('0x29')][_0xf457('0x45')](_0xf457('0x46'))){_0x5dd23c[_0xf457('0x13')]=qs[_0xf457('0x13')](_0x4d5bdc[_0xf457('0x29')][_0xf457('0x13')]);_0x5dd23c[_0xf457('0x12')]=qs['offset'](_0x4d5bdc[_0xf457('0x29')]['offset']);}return _0x4213f0[_0xf457('0x55')](_0x5dd23c);}})[_0xf457('0x18')](function(_0xf80866){if(_0xf80866){return _0xf80866?{'count':_0xb41770,'rows':_0xf80866}:null;}})['then'](respondWithResult(_0x4fe83b,null))[_0xf457('0x2b')](handleError(_0x4fe83b,null));};exports[_0xf457('0x57')]=function(_0x337a3c,_0x3c8c1e){var _0x3649b3=_0x337a3c['body']['ids'];return db['Team'][_0xf457('0x2a')]({'where':{'id':_0x3649b3},'attributes':['id'],'include':[{'model':db['User'],'as':_0xf457('0x58'),'attributes':['id','name',_0xf457('0x59'),_0xf457('0x5a'),'interface'],'raw':!![]}]})[_0xf457('0x18')](function(_0x13dfc8){if(_0x13dfc8){var _0x3f3529=_[_0xf457('0x5b')](_0x13dfc8,function(_0x16e653){var _0x3c6530=_0x16e653['get']({'plain':!![]});return _0x3c6530['Agents'];});return db[_0xf457('0x22')]['find']({'where':{'id':_0x337a3c[_0xf457('0x41')]['id']}})[_0xf457('0x18')](function(_0x4858f0){return db['sequelize'][_0xf457('0x5c')](function(_0x3db878){return _0x4858f0['addTeams'](_0x3649b3,{'transaction':_0x3db878})[_0xf457('0x18')](function(){return BPromise[_0xf457('0x5d')](_0x3f3529,function(_0x34dfe1){return db[_0xf457('0x4b')][_0xf457('0x5e')]({'where':{'UserId':_0x34dfe1['id'],'ChatQueueId':_0x337a3c[_0xf457('0x41')]['id']},'transaction':_0x3db878});});})[_0xf457('0x18')](function(){_0x3f3529[_0xf457('0x5f')](function(_0x1daa56){socket[_0xf457('0x60')](_0xf457('0x61'),{'UserId':_0x1daa56['id'],'ChatQueueId':_0x4858f0['id']});});});});});}})[_0xf457('0x18')](respondWithStatusCode(_0x3c8c1e,null))['catch'](handleError(_0x3c8c1e,null));};exports[_0xf457('0x62')]=function(_0x1ddcb9,_0x2cc6b4){return db[_0xf457('0x63')]['findAll']({'where':{'id':_0x1ddcb9[_0xf457('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0xf457('0x4c')],'as':_0xf457('0x58'),'attributes':['id'],'raw':!![]}]})[_0xf457('0x18')](handleEntityNotFound(_0x2cc6b4,null))[_0xf457('0x18')](function(_0x5c24f7){var _0x925346=_[_0xf457('0x21')](_0x5c24f7,'id');var _0x3b3f5d=[];var _0x3e2d61=[];var _0x1c0501=squel[_0xf457('0x64')]();_0x1c0501[_0xf457('0x65')]('tq.TeamId')[_0xf457('0x66')](_0xf457('0x67'),'tq')['join'](_0xf457('0x68'),'ut',_0xf457('0x69'))['where'](_0xf457('0x6a'),_0x1ddcb9[_0xf457('0x41')]['id']);for(var _0x3ea697=0x0;_0x3ea697<_0x5c24f7[_0xf457('0x33')];_0x3ea697+=0x1){let _0x560faa=_0x5c24f7[_0x3ea697];for(var _0x347fcb=0x0;_0x347fcb<_0x560faa[_0xf457('0x58')][_0xf457('0x33')];_0x347fcb+=0x1){let _0x1a7eef=_0x560faa[_0xf457('0x58')][_0x347fcb];var _0x331b68=_0x1c0501[_0xf457('0x6b')]();_0x331b68[_0xf457('0x27')]('ut.UserId\x20=\x20?',_0x1a7eef['id']);_0x3e2d61[_0xf457('0x6c')](db[_0xf457('0x6d')]['query'](_0x331b68['toString'](),{'type':db[_0xf457('0x6d')][_0xf457('0x6e')][_0xf457('0x6f')]})[_0xf457('0x18')](function(_0x268111){if(_0x268111[_0xf457('0x33')]===0x1){return _0x1a7eef['id'];}else{var _0x51af24=_[_0xf457('0x70')](_['map'](_0x268111,_0xf457('0x71')),function(_0x22163c){return _['includes'](_0x925346,_0x22163c);});if(_0x51af24){return _0x1a7eef['id'];}}}));}}return BPromise['all'](_0x3e2d61)[_0xf457('0x18')](function(_0x1b17f4){_0x3b3f5d=_(_0x3b3f5d)[_0xf457('0x72')](_0x1b17f4)[_0xf457('0x73')]()['value']();return db[_0xf457('0x22')][_0xf457('0x35')]({'where':{'id':_0x1ddcb9['params']['id']}})[_0xf457('0x18')](function(_0x5ce9c7){return db[_0xf457('0x6d')]['transaction'](function(_0x5520a2){return _0x5ce9c7[_0xf457('0x62')](_0x1ddcb9['query'][_0xf457('0x74')],{'transaction':_0x5520a2})[_0xf457('0x18')](function(){if(!_[_0xf457('0x75')](_0x3b3f5d)){return _0x5ce9c7[_0xf457('0x76')](_0x3b3f5d,{'transaction':_0x5520a2});}})[_0xf457('0x18')](function(){_0x3b3f5d[_0xf457('0x5f')](function(_0x10d748){socket[_0xf457('0x60')](_0xf457('0x77'),{'UserId':_0x10d748,'ChatQueueId':_0x5ce9c7['id']});});});});});});})['then'](respondWithStatusCode(_0x2cc6b4,null))['catch'](handleError(_0x2cc6b4,null));};exports[_0xf457('0x78')]=function(_0x7f1478,_0xf50db6){return db[_0xf457('0x22')][_0xf457('0x35')]({'where':{'id':_0x7f1478[_0xf457('0x41')]['id']}})[_0xf457('0x18')](handleEntityNotFound(_0xf50db6,null))[_0xf457('0x18')](function(_0x3c7531){if(_0x3c7531){return _0x3c7531[_0xf457('0x78')](_0x7f1478[_0xf457('0x37')][_0xf457('0x74')],_['omit'](_0x7f1478['body'],[_0xf457('0x74'),'id'])||{})[_0xf457('0x79')](function(_0xda8eb){for(var _0x53c5f5=0x0;_0x53c5f5<_0x7f1478[_0xf457('0x37')][_0xf457('0x74')][_0xf457('0x33')];_0x53c5f5+=0x1){socket[_0xf457('0x60')](_0xf457('0x61'),{'UserId':Number(_0x7f1478[_0xf457('0x37')]['ids'][_0x53c5f5]),'ChatQueueId':Number(_0x7f1478[_0xf457('0x41')]['id'])});}return _0xda8eb;});}})[_0xf457('0x18')](respondWithResult(_0xf50db6,null))[_0xf457('0x2b')](handleError(_0xf50db6,null));};exports[_0xf457('0x76')]=function(_0x159184,_0x311743){return db[_0xf457('0x22')]['find']({'where':{'id':_0x159184[_0xf457('0x41')]['id']}})[_0xf457('0x18')](handleEntityNotFound(_0x311743,null))[_0xf457('0x18')](function(_0x197ec7){if(_0x197ec7){return _0x197ec7['removeAgents'](_0x159184[_0xf457('0x29')]['ids'])['then'](function(){if(_[_0xf457('0x7a')](_0x159184['query'][_0xf457('0x74')])){for(var _0x128533=0x0;_0x128533<_0x159184['query'][_0xf457('0x74')][_0xf457('0x33')];_0x128533+=0x1){socket['emit'](_0xf457('0x77'),{'UserId':Number(_0x159184[_0xf457('0x29')]['ids'][_0x128533]),'ChatQueueId':Number(_0x159184[_0xf457('0x41')]['id'])});}}else{socket[_0xf457('0x60')](_0xf457('0x77'),{'UserId':Number(_0x159184[_0xf457('0x29')][_0xf457('0x74')]),'ChatQueueId':Number(_0x159184['params']['id'])});}});}})[_0xf457('0x18')](respondWithStatusCode(_0x311743,null))['catch'](handleError(_0x311743,null));};exports[_0xf457('0x7b')]=function(_0x3380c1,_0x22b5b9){var _0xdf0cf5={};var _0x524ce2={};var _0x56c117;var _0x317d77;return db[_0xf457('0x22')][_0xf457('0x44')]({'where':{'id':_0x3380c1['params']['id']}})['then'](handleEntityNotFound(_0x22b5b9,null))['then'](function(_0x500a83){if(_0x500a83){_0x56c117=_0x500a83;_0x524ce2[_0xf457('0x2d')]=_['keys'](db[_0xf457('0x4c')][_0xf457('0x23')]);_0x524ce2[_0xf457('0x29')]=_[_0xf457('0x2e')](_0x3380c1['query']);_0x524ce2[_0xf457('0x2f')]=_['intersection'](_0x524ce2[_0xf457('0x2d')],_0x524ce2[_0xf457('0x29')]);_0xdf0cf5[_0xf457('0x31')]=_[_0xf457('0x30')](_0x524ce2[_0xf457('0x2d')],qs['fields'](_0x3380c1[_0xf457('0x29')][_0xf457('0x32')]));_0xdf0cf5[_0xf457('0x31')]=_0xdf0cf5[_0xf457('0x31')][_0xf457('0x33')]?_0xdf0cf5['attributes']:_0x524ce2[_0xf457('0x2d')];_0xdf0cf5[_0xf457('0x47')]=qs[_0xf457('0x48')](_0x3380c1[_0xf457('0x29')][_0xf457('0x48')]);_0xdf0cf5[_0xf457('0x27')]=qs[_0xf457('0x2f')](_[_0xf457('0x49')](_0x3380c1['query'],_0x524ce2[_0xf457('0x2f')]));if(_0x3380c1[_0xf457('0x29')][_0xf457('0x4a')]){_0xdf0cf5[_0xf457('0x27')]=_[_0xf457('0x34')](_0xdf0cf5[_0xf457('0x27')],{'$or':_[_0xf457('0x21')](_0xdf0cf5[_0xf457('0x31')],function(_0x4380c1){var _0x153515={};_0x153515[_0x4380c1]={'$like':'%'+_0x3380c1[_0xf457('0x29')]['filter']+'%'};return _0x153515;})});}_0xdf0cf5=_['merge']({},_0xdf0cf5,_0x3380c1[_0xf457('0x56')]);return _0x56c117[_0xf457('0x7b')](_0xdf0cf5);}})[_0xf457('0x18')](function(_0x1a5dd6){if(_0x1a5dd6){_0x317d77=_0x1a5dd6[_0xf457('0x33')];if(!_0x3380c1['query'][_0xf457('0x45')](_0xf457('0x46'))){_0xdf0cf5[_0xf457('0x13')]=qs[_0xf457('0x13')](_0x3380c1[_0xf457('0x29')][_0xf457('0x13')]);_0xdf0cf5[_0xf457('0x12')]=qs['offset'](_0x3380c1[_0xf457('0x29')]['offset']);}return _0x56c117[_0xf457('0x7b')](_0xdf0cf5);}})[_0xf457('0x18')](function(_0x32456a){if(_0x32456a){return _0x32456a?{'count':_0x317d77,'rows':_0x32456a}:null;}})[_0xf457('0x18')](respondWithResult(_0x22b5b9,null))[_0xf457('0x2b')](handleError(_0x22b5b9,null));}; \ No newline at end of file +var _0x7b3b=['voicePause','flatMap','sequelize','transaction','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeAgents','addAgents','spread','userChatQueue:save','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','ChatQueues','error','stack','name','send','index','map','ChatQueue','rawAttributes','type','key','getOptions','where','include','query','catch','params','model','keys','filters','intersection','attributes','length','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserChatQueue','fields','nolimit','order','sort','pick','ChatQueueId','filter','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online'];(function(_0x24d8ec,_0x5f1552){var _0x409280=function(_0x3d085b){while(--_0x3d085b){_0x24d8ec['push'](_0x24d8ec['shift']());}};_0x409280(++_0x5f1552);}(_0x7b3b,0x92));var _0xb7b3=function(_0x23fa2a,_0x3816a3){_0x23fa2a=_0x23fa2a-0x0;var _0x783fba=_0x7b3b[_0x23fa2a];return _0x783fba;};'use strict';var BPromise=require(_0xb7b3('0x0'));var util=require(_0xb7b3('0x1'));var _=require(_0xb7b3('0x2'));var squel=require(_0xb7b3('0x3'));var Redis=require(_0xb7b3('0x4'));var qs=require(_0xb7b3('0x5'));var logger=require('../../config/logger')(_0xb7b3('0x6'));var config=require(_0xb7b3('0x7'));var db=require('../../mysqldb')['db'];config[_0xb7b3('0x8')]=_[_0xb7b3('0x9')](config[_0xb7b3('0x8')],{'host':_0xb7b3('0xa'),'port':0x18eb});var socket=require(_0xb7b3('0xb'))(new Redis(config[_0xb7b3('0x8')]));require('./chatQueue.socket')[_0xb7b3('0xc')](socket);function respondWithStatusCode(_0x187639,_0x202d7e){_0x202d7e=_0x202d7e||0xcc;return function(_0x4a000a){if(_0x4a000a){return _0x187639['sendStatus'](_0x202d7e);}return _0x187639[_0xb7b3('0xd')](_0x202d7e)[_0xb7b3('0xe')]();};}function respondWithResult(_0x58ad4c,_0x46a558){_0x46a558=_0x46a558||0xc8;return function(_0x2e1acd){if(_0x2e1acd){return _0x58ad4c[_0xb7b3('0xd')](_0x46a558)[_0xb7b3('0xf')](_0x2e1acd);}};}function respondWithFilteredResult(_0x281146,_0x4ce771){return function(_0x5e950e){if(_0x5e950e){var _0x2650fc=typeof _0x4ce771[_0xb7b3('0x10')]===_0xb7b3('0x11')&&typeof _0x4ce771[_0xb7b3('0x12')]==='undefined';var _0x21b5fe=_0x5e950e['count'];var _0x2bee56=_0x2650fc?0x0:_0x4ce771[_0xb7b3('0x10')];var _0x5780ec=_0x2650fc?_0x5e950e[_0xb7b3('0x13')]:_0x4ce771[_0xb7b3('0x10')]+_0x4ce771['limit'];var _0x279a15;if(_0x5780ec>=_0x21b5fe){_0x5780ec=_0x21b5fe;_0x279a15=0xc8;}else{_0x279a15=0xce;}_0x281146['status'](_0x279a15);return _0x281146[_0xb7b3('0x14')](_0xb7b3('0x15'),_0x2bee56+'-'+_0x5780ec+'/'+_0x21b5fe)[_0xb7b3('0xf')](_0x5e950e);}return null;};}function saveUpdates(_0x22f42e){return function(_0x3e85ce){if(_0x3e85ce){return _0x3e85ce[_0xb7b3('0x16')](_0x22f42e)['then'](function(_0x2086c3){return _0x2086c3;});}return null;};}function removeEntity(_0x381d18){return function(_0x28c4be){if(_0x28c4be){return _0x28c4be[_0xb7b3('0x17')]()[_0xb7b3('0x18')](function(){var _0x3ebfea=_0x28c4be[_0xb7b3('0x19')]({'plain':!![]});var _0xc0e079=_0xb7b3('0x1a');return db['UserProfileResource'][_0xb7b3('0x17')]({'where':{'type':_0xc0e079,'resourceId':_0x3ebfea['id']}})[_0xb7b3('0x18')](function(){return _0x28c4be;});})[_0xb7b3('0x18')](function(){_0x381d18[_0xb7b3('0xd')](0xcc)[_0xb7b3('0xe')]();});}};}function handleEntityNotFound(_0xae4788){return function(_0x524e72){if(!_0x524e72){_0xae4788['sendStatus'](0x194);}return _0x524e72;};}function handleError(_0x2271ad,_0x18cba1){_0x18cba1=_0x18cba1||0x1f4;return function(_0x261634){logger[_0xb7b3('0x1b')](_0x261634[_0xb7b3('0x1c')]);if(_0x261634[_0xb7b3('0x1d')]){delete _0x261634[_0xb7b3('0x1d')];}_0x2271ad[_0xb7b3('0xd')](_0x18cba1)[_0xb7b3('0x1e')](_0x261634);};}exports[_0xb7b3('0x1f')]=function(_0x27fd41,_0x1b5ce5){var _0x4e8ccb={};var _0x2dc648={'count':0x0,'rows':[]};var _0x58222a=_[_0xb7b3('0x20')](db[_0xb7b3('0x21')][_0xb7b3('0x22')],function(_0xd0bea4){return{'name':_0xd0bea4['fieldName'],'type':_0xd0bea4[_0xb7b3('0x23')][_0xb7b3('0x24')]};});_0x4e8ccb=qs[_0xb7b3('0x25')](_0x58222a,_0x27fd41);var _0x18b938={'where':_0x4e8ccb[_0xb7b3('0x26')]};return db[_0xb7b3('0x21')]['count'](_0x18b938)['then'](function(_0x5612b8){_0x2dc648[_0xb7b3('0x13')]=_0x5612b8;_0x4e8ccb['include']=qs[_0xb7b3('0x27')](_0x27fd41[_0xb7b3('0x28')]);return db['ChatQueue']['findAll'](_0x4e8ccb);})[_0xb7b3('0x18')](function(_0x5f19cc){_0x2dc648['rows']=_0x5f19cc;return _0x2dc648;})[_0xb7b3('0x18')](respondWithFilteredResult(_0x1b5ce5,_0x4e8ccb))[_0xb7b3('0x29')](handleError(_0x1b5ce5,null));};exports['show']=function(_0x102c7f,_0xef5975){var _0x3d858e={'raw':!![],'where':{'id':_0x102c7f[_0xb7b3('0x2a')]['id']}},_0x53d006={};_0x53d006[_0xb7b3('0x2b')]=_[_0xb7b3('0x2c')](db['ChatQueue'][_0xb7b3('0x22')]);_0x53d006[_0xb7b3('0x28')]=_[_0xb7b3('0x2c')](_0x102c7f[_0xb7b3('0x28')]);_0x53d006[_0xb7b3('0x2d')]=_[_0xb7b3('0x2e')](_0x53d006[_0xb7b3('0x2b')],_0x53d006[_0xb7b3('0x28')]);_0x3d858e[_0xb7b3('0x2f')]=_[_0xb7b3('0x2e')](_0x53d006['model'],qs['fields'](_0x102c7f['query']['fields']));_0x3d858e[_0xb7b3('0x2f')]=_0x3d858e[_0xb7b3('0x2f')][_0xb7b3('0x30')]?_0x3d858e[_0xb7b3('0x2f')]:_0x53d006[_0xb7b3('0x2b')];if(_0x102c7f[_0xb7b3('0x28')]['includeAll']){_0x3d858e[_0xb7b3('0x27')]=[{'all':!![]}];}_0x3d858e=_[_0xb7b3('0x31')]({},_0x3d858e,_0x102c7f[_0xb7b3('0x32')]);return db[_0xb7b3('0x21')][_0xb7b3('0x33')](_0x3d858e)['then'](handleEntityNotFound(_0xef5975,null))[_0xb7b3('0x18')](respondWithResult(_0xef5975,null))[_0xb7b3('0x29')](handleError(_0xef5975,null));};exports['create']=function(_0xa6615c,_0x6c473e){return db[_0xb7b3('0x21')][_0xb7b3('0x34')](_0xa6615c[_0xb7b3('0x35')],{})[_0xb7b3('0x18')](function(_0x24c940){var _0x3e4cd5=_0xa6615c['user']['get']({'plain':!![]});if(!_0x3e4cd5)throw new Error(_0xb7b3('0x36'));if(_0x3e4cd5[_0xb7b3('0x37')]===_0xb7b3('0x38')){var _0x5a2075=_0x24c940[_0xb7b3('0x19')]({'plain':!![]});var _0xe7f5a8='ChatQueues';return db['UserProfileSection']['find']({'where':{'name':_0xe7f5a8,'userProfileId':_0x3e4cd5[_0xb7b3('0x39')]},'raw':!![]})[_0xb7b3('0x18')](function(_0x446fc7){if(_0x446fc7&&_0x446fc7[_0xb7b3('0x3a')]===0x0){return db[_0xb7b3('0x3b')][_0xb7b3('0x34')]({'name':_0x5a2075[_0xb7b3('0x1d')],'resourceId':_0x5a2075['id'],'type':_0x446fc7[_0xb7b3('0x1d')],'sectionId':_0x446fc7['id']},{})[_0xb7b3('0x18')](function(){return _0x24c940;});}else{return _0x24c940;}})['catch'](function(_0x4219a4){logger[_0xb7b3('0x1b')](_0xb7b3('0x3c'),_0x4219a4);throw _0x4219a4;});}return _0x24c940;})['then'](respondWithResult(_0x6c473e,0xc9))[_0xb7b3('0x29')](handleError(_0x6c473e,null));};exports['update']=function(_0x45ee14,_0x27d95f){if(_0x45ee14[_0xb7b3('0x35')]['id']){delete _0x45ee14[_0xb7b3('0x35')]['id'];}return db[_0xb7b3('0x21')][_0xb7b3('0x33')]({'where':{'id':_0x45ee14['params']['id']}})[_0xb7b3('0x18')](handleEntityNotFound(_0x27d95f,null))[_0xb7b3('0x18')](saveUpdates(_0x45ee14[_0xb7b3('0x35')],null))['then'](respondWithResult(_0x27d95f,null))['catch'](handleError(_0x27d95f,null));};exports[_0xb7b3('0x17')]=function(_0x273c2d,_0x4aa25a){return db['ChatQueue'][_0xb7b3('0x33')]({'where':{'id':_0x273c2d[_0xb7b3('0x2a')]['id']}})[_0xb7b3('0x18')](handleEntityNotFound(_0x4aa25a,null))[_0xb7b3('0x18')](removeEntity(_0x4aa25a,null))[_0xb7b3('0x29')](handleError(_0x4aa25a,null));};exports[_0xb7b3('0x3d')]=function(_0x53454d,_0x1b1936){return db[_0xb7b3('0x21')][_0xb7b3('0x3d')]()[_0xb7b3('0x18')](respondWithResult(_0x1b1936,null))[_0xb7b3('0x29')](handleError(_0x1b1936,null));};exports['getMembers']=function(_0x300009,_0x16ad16){var _0x9899cf={'raw':!![],'where':{}},_0x5b429a={},_0x355b7f;return db[_0xb7b3('0x21')][_0xb7b3('0x3e')]({'where':{'id':_0x300009[_0xb7b3('0x2a')]['id']}})[_0xb7b3('0x18')](handleEntityNotFound(_0x16ad16,null))[_0xb7b3('0x18')](function(_0x56c874){if(_0x56c874){_0x355b7f=_0x56c874['get']({'plain':!![]});_0x5b429a[_0xb7b3('0x2b')]=_[_0xb7b3('0x2c')](db[_0xb7b3('0x3f')][_0xb7b3('0x22')]);_0x5b429a['query']=_['keys'](_0x300009[_0xb7b3('0x28')]);_0x5b429a[_0xb7b3('0x2d')]=_[_0xb7b3('0x2e')](_0x5b429a[_0xb7b3('0x2b')],_0x5b429a[_0xb7b3('0x28')]);_0x9899cf[_0xb7b3('0x2f')]=_['intersection'](_0x5b429a[_0xb7b3('0x2b')],qs[_0xb7b3('0x40')](_0x300009[_0xb7b3('0x28')][_0xb7b3('0x40')]));_0x9899cf[_0xb7b3('0x2f')]=_0x9899cf[_0xb7b3('0x2f')][_0xb7b3('0x30')]?_0x9899cf[_0xb7b3('0x2f')]:_0x5b429a[_0xb7b3('0x2b')];if(!_0x300009['query']['hasOwnProperty'](_0xb7b3('0x41'))){_0x9899cf['limit']=qs['limit'](_0x300009[_0xb7b3('0x28')]['limit']);_0x9899cf[_0xb7b3('0x10')]=qs[_0xb7b3('0x10')](_0x300009['query'][_0xb7b3('0x10')]);}_0x9899cf[_0xb7b3('0x42')]=qs[_0xb7b3('0x43')](_0x300009[_0xb7b3('0x28')][_0xb7b3('0x43')]);_0x9899cf[_0xb7b3('0x26')]=qs[_0xb7b3('0x2d')](_[_0xb7b3('0x44')](_0x300009[_0xb7b3('0x28')],_0x5b429a[_0xb7b3('0x2d')]));_0x9899cf['where'][_0xb7b3('0x45')]=_0x56c874['id'];if(_0x300009['query'][_0xb7b3('0x46')]){_0x9899cf[_0xb7b3('0x26')]=_[_0xb7b3('0x31')](_0x9899cf['where'],{'$or':_[_0xb7b3('0x20')](_0x9899cf['attributes'],function(_0x370392){var _0x5d9e2c={};_0x5d9e2c[_0x370392]={'$like':'%'+_0x300009[_0xb7b3('0x28')][_0xb7b3('0x46')]+'%'};return _0x5d9e2c;})});}_0x9899cf=_[_0xb7b3('0x31')]({},_0x9899cf,_0x300009[_0xb7b3('0x32')]);return db[_0xb7b3('0x3f')][_0xb7b3('0x47')](_0x9899cf);}})[_0xb7b3('0x18')](function(_0x552415){if(_0x552415){return db[_0xb7b3('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x552415,_0xb7b3('0x49')),'role':_0xb7b3('0x4a')},'attributes':['id',_0xb7b3('0x1d'),_0xb7b3('0x4b'),_0xb7b3('0x4c'),_0xb7b3('0x4d')]});}})[_0xb7b3('0x18')](function(_0x1c6797){if(_0x1c6797){return{'count':_0x1c6797[_0xb7b3('0x13')],'rows':_['map'](_0x1c6797[_0xb7b3('0x4e')],function(_0x2bb5b1){return{'membername':_0x2bb5b1[_0xb7b3('0x1d')],'UserId':_0x2bb5b1['id'],'queue_name':_0x355b7f[_0xb7b3('0x1d')],'ChatQueueId':_0x355b7f['id'],'interface':util[_0xb7b3('0x4f')](_0xb7b3('0x50'),_0xb7b3('0x51'),_0x2bb5b1[_0xb7b3('0x1d')]),'penalty':0x0,'paused':_0x2bb5b1[_0xb7b3('0x4b')],'createdAt':_0x2bb5b1[_0xb7b3('0x4d')],'updatedAt':_0x2bb5b1[_0xb7b3('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb7b3('0x18')](respondWithFilteredResult(_0x16ad16,_0x9899cf))[_0xb7b3('0x29')](handleError(_0x16ad16,null));};exports[_0xb7b3('0x52')]=function(_0x44bc4b,_0x40a7f9){var _0x2fdbe5={};var _0x3d9ce5={};var _0x293c83;var _0x633055;return db['ChatQueue'][_0xb7b3('0x3e')]({'where':{'id':_0x44bc4b[_0xb7b3('0x2a')]['id']}})[_0xb7b3('0x18')](handleEntityNotFound(_0x40a7f9,null))[_0xb7b3('0x18')](function(_0x2ca86d){if(_0x2ca86d){_0x293c83=_0x2ca86d;_0x3d9ce5[_0xb7b3('0x2b')]=_[_0xb7b3('0x2c')](db[_0xb7b3('0x53')]['rawAttributes']);_0x3d9ce5['query']=_[_0xb7b3('0x2c')](_0x44bc4b[_0xb7b3('0x28')]);_0x3d9ce5[_0xb7b3('0x2d')]=_[_0xb7b3('0x2e')](_0x3d9ce5['model'],_0x3d9ce5[_0xb7b3('0x28')]);_0x2fdbe5['attributes']=_['intersection'](_0x3d9ce5[_0xb7b3('0x2b')],qs[_0xb7b3('0x40')](_0x44bc4b[_0xb7b3('0x28')][_0xb7b3('0x40')]));_0x2fdbe5[_0xb7b3('0x2f')]=_0x2fdbe5[_0xb7b3('0x2f')][_0xb7b3('0x30')]?_0x2fdbe5[_0xb7b3('0x2f')]:_0x3d9ce5['model'];_0x2fdbe5['order']=qs[_0xb7b3('0x43')](_0x44bc4b[_0xb7b3('0x28')][_0xb7b3('0x43')]);_0x2fdbe5['where']=qs['filters'](_[_0xb7b3('0x44')](_0x44bc4b[_0xb7b3('0x28')],_0x3d9ce5[_0xb7b3('0x2d')]));if(_0x44bc4b[_0xb7b3('0x28')]['filter']){_0x2fdbe5[_0xb7b3('0x26')]=_['merge'](_0x2fdbe5['where'],{'$or':_['map'](_0x2fdbe5[_0xb7b3('0x2f')],function(_0x3c05a6){var _0x5f6362={};_0x5f6362[_0x3c05a6]={'$like':'%'+_0x44bc4b['query'][_0xb7b3('0x46')]+'%'};return _0x5f6362;})});}_0x2fdbe5=_[_0xb7b3('0x31')]({},_0x2fdbe5,_0x44bc4b[_0xb7b3('0x32')]);return _0x293c83[_0xb7b3('0x52')](_0x2fdbe5);}})[_0xb7b3('0x18')](function(_0x4ad27d){if(_0x4ad27d){_0x633055=_0x4ad27d[_0xb7b3('0x30')];if(!_0x44bc4b[_0xb7b3('0x28')]['hasOwnProperty']('nolimit')){_0x2fdbe5[_0xb7b3('0x12')]=qs['limit'](_0x44bc4b[_0xb7b3('0x28')][_0xb7b3('0x12')]);_0x2fdbe5['offset']=qs[_0xb7b3('0x10')](_0x44bc4b[_0xb7b3('0x28')][_0xb7b3('0x10')]);}return _0x293c83['getTeams'](_0x2fdbe5);}})[_0xb7b3('0x18')](function(_0x10df96){if(_0x10df96){return _0x10df96?{'count':_0x633055,'rows':_0x10df96}:null;}})[_0xb7b3('0x18')](respondWithResult(_0x40a7f9,null))[_0xb7b3('0x29')](handleError(_0x40a7f9,null));};exports[_0xb7b3('0x54')]=function(_0x44cb51,_0x2afb57){var _0x19006a=_0x44cb51['body'][_0xb7b3('0x55')];return db[_0xb7b3('0x53')][_0xb7b3('0x47')]({'where':{'id':_0x19006a},'attributes':['id'],'include':[{'model':db[_0xb7b3('0x48')],'as':_0xb7b3('0x56'),'attributes':['id',_0xb7b3('0x1d'),_0xb7b3('0x57'),_0xb7b3('0x58'),'interface'],'raw':!![]}]})['then'](function(_0x2618ea){if(_0x2618ea){var _0x4fa4d5=_[_0xb7b3('0x59')](_0x2618ea,function(_0x270be7){var _0x367418=_0x270be7[_0xb7b3('0x19')]({'plain':!![]});return _0x367418[_0xb7b3('0x56')];});return db[_0xb7b3('0x21')][_0xb7b3('0x33')]({'where':{'id':_0x44cb51[_0xb7b3('0x2a')]['id']}})[_0xb7b3('0x18')](function(_0x1d4f86){return db[_0xb7b3('0x5a')][_0xb7b3('0x5b')](function(_0x265bfd){return _0x1d4f86['addTeams'](_0x19006a,{'transaction':_0x265bfd})[_0xb7b3('0x18')](function(){return BPromise['each'](_0x4fa4d5,function(_0x39de53){return db[_0xb7b3('0x3f')]['findOrCreate']({'where':{'UserId':_0x39de53['id'],'ChatQueueId':_0x44cb51[_0xb7b3('0x2a')]['id']},'transaction':_0x265bfd});});})[_0xb7b3('0x18')](function(){_0x4fa4d5[_0xb7b3('0x5c')](function(_0x5e2943){socket[_0xb7b3('0x5d')]('userChatQueue:save',{'UserId':_0x5e2943['id'],'ChatQueueId':_0x1d4f86['id']});});});});});}})[_0xb7b3('0x18')](respondWithStatusCode(_0x2afb57,null))[_0xb7b3('0x29')](handleError(_0x2afb57,null));};exports[_0xb7b3('0x5e')]=function(_0x4f7461,_0xd56f49){return db['Team'][_0xb7b3('0x47')]({'where':{'id':_0x4f7461[_0xb7b3('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb7b3('0x48')],'as':_0xb7b3('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xd56f49,null))[_0xb7b3('0x18')](function(_0x389fac){var _0x23bf90=_[_0xb7b3('0x20')](_0x389fac,'id');var _0x4e7f24=[];var _0x5c6b27=[];var _0x2e383c=squel['select']();_0x2e383c[_0xb7b3('0x5f')](_0xb7b3('0x60'))[_0xb7b3('0x61')](_0xb7b3('0x62'),'tq')[_0xb7b3('0x63')](_0xb7b3('0x64'),'ut',_0xb7b3('0x65'))[_0xb7b3('0x26')](_0xb7b3('0x66'),_0x4f7461['params']['id']);for(var _0x4b46f5=0x0;_0x4b46f5<_0x389fac['length'];_0x4b46f5+=0x1){let _0x2e1ae3=_0x389fac[_0x4b46f5];for(var _0x4dec0a=0x0;_0x4dec0a<_0x2e1ae3[_0xb7b3('0x56')]['length'];_0x4dec0a+=0x1){let _0x17ffee=_0x2e1ae3['Agents'][_0x4dec0a];var _0x41eb65=_0x2e383c['clone']();_0x41eb65[_0xb7b3('0x26')]('ut.UserId\x20=\x20?',_0x17ffee['id']);_0x5c6b27[_0xb7b3('0x67')](db[_0xb7b3('0x5a')][_0xb7b3('0x28')](_0x41eb65[_0xb7b3('0x68')](),{'type':db[_0xb7b3('0x5a')][_0xb7b3('0x69')][_0xb7b3('0x6a')]})['then'](function(_0x47a65a){if(_0x47a65a[_0xb7b3('0x30')]===0x1){return _0x17ffee['id'];}else{var _0x2be45a=_[_0xb7b3('0x6b')](_[_0xb7b3('0x20')](_0x47a65a,_0xb7b3('0x6c')),function(_0x3583b2){return _[_0xb7b3('0x6d')](_0x23bf90,_0x3583b2);});if(_0x2be45a){return _0x17ffee['id'];}}}));}}return BPromise[_0xb7b3('0x6e')](_0x5c6b27)[_0xb7b3('0x18')](function(_0x25d8bd){_0x4e7f24=_(_0x4e7f24)['union'](_0x25d8bd)['compact']()['value']();return db[_0xb7b3('0x21')][_0xb7b3('0x33')]({'where':{'id':_0x4f7461[_0xb7b3('0x2a')]['id']}})['then'](function(_0x20f337){return db['sequelize'][_0xb7b3('0x5b')](function(_0x400032){return _0x20f337[_0xb7b3('0x5e')](_0x4f7461[_0xb7b3('0x28')][_0xb7b3('0x55')],{'transaction':_0x400032})[_0xb7b3('0x18')](function(){if(!_['isEmpty'](_0x4e7f24)){return _0x20f337[_0xb7b3('0x6f')](_0x4e7f24,{'transaction':_0x400032});}})[_0xb7b3('0x18')](function(){_0x4e7f24[_0xb7b3('0x5c')](function(_0x43a2bf){socket[_0xb7b3('0x5d')]('userChatQueue:remove',{'UserId':_0x43a2bf,'ChatQueueId':_0x20f337['id']});});});});});});})[_0xb7b3('0x18')](respondWithStatusCode(_0xd56f49,null))[_0xb7b3('0x29')](handleError(_0xd56f49,null));};exports['addAgents']=function(_0x4f2e10,_0x17332d){return db[_0xb7b3('0x21')]['find']({'where':{'id':_0x4f2e10[_0xb7b3('0x2a')]['id']}})[_0xb7b3('0x18')](handleEntityNotFound(_0x17332d,null))[_0xb7b3('0x18')](function(_0x2d23d6){if(_0x2d23d6){return _0x2d23d6[_0xb7b3('0x70')](_0x4f2e10['body']['ids'],_['omit'](_0x4f2e10['body'],['ids','id'])||{})[_0xb7b3('0x71')](function(_0x31d5d9){for(var _0x13cd15=0x0;_0x13cd15<_0x4f2e10[_0xb7b3('0x35')][_0xb7b3('0x55')][_0xb7b3('0x30')];_0x13cd15+=0x1){socket[_0xb7b3('0x5d')](_0xb7b3('0x72'),{'UserId':Number(_0x4f2e10[_0xb7b3('0x35')]['ids'][_0x13cd15]),'ChatQueueId':Number(_0x4f2e10['params']['id'])});}return _0x31d5d9;});}})['then'](respondWithResult(_0x17332d,null))['catch'](handleError(_0x17332d,null));};exports[_0xb7b3('0x6f')]=function(_0x239445,_0x5ed5e5){return db[_0xb7b3('0x21')][_0xb7b3('0x33')]({'where':{'id':_0x239445[_0xb7b3('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5ed5e5,null))[_0xb7b3('0x18')](function(_0x292b07){if(_0x292b07){return _0x292b07[_0xb7b3('0x6f')](_0x239445[_0xb7b3('0x28')][_0xb7b3('0x55')])['then'](function(){if(_['isArray'](_0x239445['query'][_0xb7b3('0x55')])){for(var _0x4f7ec3=0x0;_0x4f7ec3<_0x239445[_0xb7b3('0x28')][_0xb7b3('0x55')][_0xb7b3('0x30')];_0x4f7ec3+=0x1){socket[_0xb7b3('0x5d')]('userChatQueue:remove',{'UserId':Number(_0x239445[_0xb7b3('0x28')][_0xb7b3('0x55')][_0x4f7ec3]),'ChatQueueId':Number(_0x239445['params']['id'])});}}else{socket[_0xb7b3('0x5d')]('userChatQueue:remove',{'UserId':Number(_0x239445[_0xb7b3('0x28')][_0xb7b3('0x55')]),'ChatQueueId':Number(_0x239445['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5ed5e5,null))[_0xb7b3('0x29')](handleError(_0x5ed5e5,null));};exports[_0xb7b3('0x73')]=function(_0x525e23,_0xb37a68){var _0x54adff={};var _0x1b4f42={};var _0x576079;var _0xea55b;return db[_0xb7b3('0x21')]['findOne']({'where':{'id':_0x525e23[_0xb7b3('0x2a')]['id']}})['then'](handleEntityNotFound(_0xb37a68,null))[_0xb7b3('0x18')](function(_0x12b4c5){if(_0x12b4c5){_0x576079=_0x12b4c5;_0x1b4f42['model']=_[_0xb7b3('0x2c')](db['User'][_0xb7b3('0x22')]);_0x1b4f42[_0xb7b3('0x28')]=_[_0xb7b3('0x2c')](_0x525e23['query']);_0x1b4f42[_0xb7b3('0x2d')]=_['intersection'](_0x1b4f42[_0xb7b3('0x2b')],_0x1b4f42[_0xb7b3('0x28')]);_0x54adff[_0xb7b3('0x2f')]=_[_0xb7b3('0x2e')](_0x1b4f42[_0xb7b3('0x2b')],qs['fields'](_0x525e23[_0xb7b3('0x28')][_0xb7b3('0x40')]));_0x54adff[_0xb7b3('0x2f')]=_0x54adff['attributes'][_0xb7b3('0x30')]?_0x54adff[_0xb7b3('0x2f')]:_0x1b4f42['model'];_0x54adff['order']=qs[_0xb7b3('0x43')](_0x525e23[_0xb7b3('0x28')][_0xb7b3('0x43')]);_0x54adff[_0xb7b3('0x26')]=qs[_0xb7b3('0x2d')](_[_0xb7b3('0x44')](_0x525e23[_0xb7b3('0x28')],_0x1b4f42[_0xb7b3('0x2d')]));if(_0x525e23[_0xb7b3('0x28')][_0xb7b3('0x46')]){_0x54adff[_0xb7b3('0x26')]=_[_0xb7b3('0x31')](_0x54adff['where'],{'$or':_['map'](_0x54adff[_0xb7b3('0x2f')],function(_0x4696c7){var _0x6e3f63={};_0x6e3f63[_0x4696c7]={'$like':'%'+_0x525e23[_0xb7b3('0x28')][_0xb7b3('0x46')]+'%'};return _0x6e3f63;})});}_0x54adff=_['merge']({},_0x54adff,_0x525e23['options']);return _0x576079[_0xb7b3('0x73')](_0x54adff);}})[_0xb7b3('0x18')](function(_0x19c3d3){if(_0x19c3d3){_0xea55b=_0x19c3d3[_0xb7b3('0x30')];if(!_0x525e23['query'][_0xb7b3('0x74')]('nolimit')){_0x54adff['limit']=qs[_0xb7b3('0x12')](_0x525e23[_0xb7b3('0x28')]['limit']);_0x54adff[_0xb7b3('0x10')]=qs['offset'](_0x525e23[_0xb7b3('0x28')][_0xb7b3('0x10')]);}return _0x576079['getAgents'](_0x54adff);}})[_0xb7b3('0x18')](function(_0xf97ab8){if(_0xf97ab8){return _0xf97ab8?{'count':_0xea55b,'rows':_0xf97ab8}:null;}})[_0xb7b3('0x18')](respondWithResult(_0xb37a68,null))[_0xb7b3('0x29')](handleError(_0xb37a68,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e79a7bc..454c7cf 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 _0x5229=['remove','emit','hook','exports','events','../../mysqldb','ChatQueue','save','update'];(function(_0x21d9c3,_0x4dab3c){var _0x48b76a=function(_0x242805){while(--_0x242805){_0x21d9c3['push'](_0x21d9c3['shift']());}};_0x48b76a(++_0x4dab3c);}(_0x5229,0x148));var _0x9522=function(_0x5d1c62,_0x44e5b8){_0x5d1c62=_0x5d1c62-0x0;var _0x24d552=_0x5229[_0x5d1c62];return _0x24d552;};'use strict';var EventEmitter=require(_0x9522('0x0'));var ChatQueue=require(_0x9522('0x1'))['db'][_0x9522('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9522('0x3'),'afterUpdate':_0x9522('0x4'),'afterDestroy':_0x9522('0x5')};function emitEvent(_0x176e8b){return function(_0x22539e,_0x416cab,_0x5759a1){ChatQueueEvents[_0x9522('0x6')](_0x176e8b+':'+_0x22539e['id'],_0x22539e);ChatQueueEvents[_0x9522('0x6')](_0x176e8b,_0x22539e);_0x5759a1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0x9522('0x7')](e,emitEvent(event));}}module[_0x9522('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x4814=['hook','exports','events','../../mysqldb','ChatQueue','save','update','remove','emit','hasOwnProperty'];(function(_0x13a69e,_0x7d914e){var _0x51d513=function(_0x6f9b91){while(--_0x6f9b91){_0x13a69e['push'](_0x13a69e['shift']());}};_0x51d513(++_0x7d914e);}(_0x4814,0xde));var _0x4481=function(_0x5dc0b3,_0xb624a6){_0x5dc0b3=_0x5dc0b3-0x0;var _0x3ec2ed=_0x4814[_0x5dc0b3];return _0x3ec2ed;};'use strict';var EventEmitter=require(_0x4481('0x0'));var ChatQueue=require(_0x4481('0x1'))['db'][_0x4481('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4481('0x3'),'afterUpdate':_0x4481('0x4'),'afterDestroy':_0x4481('0x5')};function emitEvent(_0x244e9e){return function(_0x5cf522,_0x5196fa,_0x257112){ChatQueueEvents[_0x4481('0x6')](_0x244e9e+':'+_0x5cf522['id'],_0x5cf522);ChatQueueEvents['emit'](_0x244e9e,_0x5cf522);_0x257112(null);};}for(var e in events){if(events[_0x4481('0x7')](e)){var event=events[e];ChatQueue[_0x4481('0x8')](e,emitEvent(event));}}module[_0x4481('0x9')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index d9d8835..c582bf6 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 _0xabe1=['chat_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatQueue.attributes','define','ChatQueue'];(function(_0x3634e5,_0x16540a){var _0x4982b5=function(_0x42f2f7){while(--_0x42f2f7){_0x3634e5['push'](_0x3634e5['shift']());}};_0x4982b5(++_0x16540a);}(_0xabe1,0x1bb));var _0x1abe=function(_0x281a65,_0x12ec13){_0x281a65=_0x281a65-0x0;var _0x28339f=_0xabe1[_0x281a65];return _0x28339f;};'use strict';var _=require(_0x1abe('0x0'));var util=require(_0x1abe('0x1'));var logger=require(_0x1abe('0x2'))(_0x1abe('0x3'));var moment=require(_0x1abe('0x4'));var BPromise=require(_0x1abe('0x5'));var rp=require(_0x1abe('0x6'));var fs=require('fs');var path=require(_0x1abe('0x7'));var rimraf=require(_0x1abe('0x8'));var config=require('../../config/environment');var attributes=require(_0x1abe('0x9'));module['exports']=function(_0x32fc11,_0x4344d9){return _0x32fc11[_0x1abe('0xa')](_0x1abe('0xb'),attributes,{'tableName':_0x1abe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1dcc=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','chat_queues'];(function(_0x53cfbf,_0x51df2d){var _0x51f6ca=function(_0x15fe12){while(--_0x15fe12){_0x53cfbf['push'](_0x53cfbf['shift']());}};_0x51f6ca(++_0x51df2d);}(_0x1dcc,0x1b8));var _0xc1dc=function(_0x165d0b,_0x5a3346){_0x165d0b=_0x165d0b-0x0;var _0x13b9f4=_0x1dcc[_0x165d0b];return _0x13b9f4;};'use strict';var _=require(_0xc1dc('0x0'));var util=require(_0xc1dc('0x1'));var logger=require('../../config/logger')(_0xc1dc('0x2'));var moment=require(_0xc1dc('0x3'));var BPromise=require(_0xc1dc('0x4'));var rp=require(_0xc1dc('0x5'));var fs=require('fs');var path=require(_0xc1dc('0x6'));var rimraf=require('rimraf');var config=require(_0xc1dc('0x7'));var attributes=require('./chatQueue.attributes');module[_0xc1dc('0x8')]=function(_0x19d693,_0x23e5df){return _0x19d693[_0xc1dc('0x9')]('ChatQueue',attributes,{'tableName':_0xc1dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index aed67db..9f548a2 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 _0xa72d=['request\x20sent','stringify','error','code','message','catch','GetChatQueue','ChatQueue','findAll','options','where','include','map','attributes','ShowChatQueue','raw','model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s'];(function(_0x2a9274,_0x2b3adc){var _0x19952c=function(_0x41a879){while(--_0x41a879){_0x2a9274['push'](_0x2a9274['shift']());}};_0x19952c(++_0x2b3adc);}(_0xa72d,0x1bf));var _0xda72=function(_0x25955d,_0x2e2e22){_0x25955d=_0x25955d-0x0;var _0x193fdd=_0xa72d[_0x25955d];return _0x193fdd;};'use strict';var _=require(_0xda72('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xda72('0x1'));var rs=require(_0xda72('0x2'));var fs=require('fs');var Redis=require(_0xda72('0x3'));var db=require(_0xda72('0x4'))['db'];var utils=require(_0xda72('0x5'));var logger=require(_0xda72('0x6'))(_0xda72('0x7'));var config=require(_0xda72('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xda72('0x9')][_0xda72('0xa')]({'port':0x232a});config[_0xda72('0xb')]=_['defaults'](config[_0xda72('0xb')],{'host':_0xda72('0xc'),'port':0x18eb});var socket=require(_0xda72('0xd'))(new Redis(config[_0xda72('0xb')]));require(_0xda72('0xe'))[_0xda72('0xf')](socket);function respondWithRpcPromise(_0x261f98,_0x1859ff,_0x44b519){return new BPromise(function(_0x4d97cf,_0x531bd2){return client[_0xda72('0x10')](_0x261f98,_0x44b519)['then'](function(_0x4b8e49){logger[_0xda72('0x11')](_0xda72('0x12'),_0x1859ff,'request\x20sent');logger[_0xda72('0x13')](_0xda72('0x14'),_0x1859ff,_0xda72('0x15'),JSON[_0xda72('0x16')](_0x4b8e49));if(_0x4b8e49[_0xda72('0x17')]){if(_0x4b8e49['error'][_0xda72('0x18')]===0x1f4){logger[_0xda72('0x17')](_0xda72('0x12'),_0x1859ff,_0x4b8e49[_0xda72('0x17')][_0xda72('0x19')]);return _0x531bd2(_0x4b8e49[_0xda72('0x17')][_0xda72('0x19')]);}logger[_0xda72('0x17')]('ChatQueue,\x20%s,\x20%s',_0x1859ff,_0x4b8e49['error'][_0xda72('0x19')]);return _0x4d97cf(_0x4b8e49[_0xda72('0x17')][_0xda72('0x19')]);}else{logger[_0xda72('0x11')](_0xda72('0x12'),_0x1859ff,_0xda72('0x15'));_0x4d97cf(_0x4b8e49['result'][_0xda72('0x19')]);}})[_0xda72('0x1a')](function(_0xd136f9){logger[_0xda72('0x17')](_0xda72('0x12'),_0x1859ff,_0xd136f9);_0x531bd2(_0xd136f9);});});}exports[_0xda72('0x1b')]=function(_0x2e511c){var _0x4d9602=this;return new Promise(function(_0x948e7a,_0x38f51b){return db[_0xda72('0x1c')][_0xda72('0x1d')]({'raw':_0x2e511c['options']?_0x2e511c[_0xda72('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2e511c[_0xda72('0x1e')]?_0x2e511c[_0xda72('0x1e')][_0xda72('0x1f')]||null:null,'attributes':_0x2e511c[_0xda72('0x1e')]?_0x2e511c[_0xda72('0x1e')]['attributes']||null:null,'limit':_0x2e511c[_0xda72('0x1e')]?_0x2e511c['options']['limit']||null:null,'include':_0x2e511c['options']?_0x2e511c[_0xda72('0x1e')][_0xda72('0x20')]?_[_0xda72('0x21')](_0x2e511c[_0xda72('0x1e')][_0xda72('0x20')],function(_0x1eb770){return{'model':db[_0x1eb770['model']],'as':_0x1eb770['as'],'attributes':_0x1eb770[_0xda72('0x22')],'include':_0x1eb770[_0xda72('0x20')]?_['map'](_0x1eb770[_0xda72('0x20')],function(_0x257775){return{'model':db[_0x257775['model']],'as':_0x257775['as'],'attributes':_0x257775['attributes'],'include':_0x257775[_0xda72('0x20')]?_[_0xda72('0x21')](_0x257775['include'],function(_0x4c7be5){return{'model':db[_0x4c7be5['model']],'as':_0x4c7be5['as'],'attributes':_0x4c7be5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4df546){logger[_0xda72('0x11')](_0xda72('0x1b'),_0x2e511c);logger[_0xda72('0x13')](_0xda72('0x1b'),_0x2e511c,JSON[_0xda72('0x16')](_0x4df546));_0x948e7a(_0x4df546);})['catch'](function(_0x42075){logger[_0xda72('0x17')](_0xda72('0x1b'),_0x42075[_0xda72('0x19')],_0x2e511c);_0x38f51b(_0x4d9602[_0xda72('0x17')](0x1f4,_0x42075[_0xda72('0x19')]));});});};exports[_0xda72('0x23')]=function(_0x5ee5d3){var _0x3805d4=this;return new Promise(function(_0x59f739,_0x5d15ad){return db[_0xda72('0x1c')]['find']({'raw':_0x5ee5d3[_0xda72('0x1e')]?_0x5ee5d3['options'][_0xda72('0x24')]===undefined?!![]:![]:!![],'where':_0x5ee5d3['options']?_0x5ee5d3[_0xda72('0x1e')][_0xda72('0x1f')]||null:null,'attributes':_0x5ee5d3[_0xda72('0x1e')]?_0x5ee5d3[_0xda72('0x1e')][_0xda72('0x22')]||null:null,'include':_0x5ee5d3[_0xda72('0x1e')]?_0x5ee5d3['options'][_0xda72('0x20')]?_['map'](_0x5ee5d3[_0xda72('0x1e')][_0xda72('0x20')],function(_0x14be48){return{'model':db[_0x14be48['model']],'as':_0x14be48['as'],'attributes':_0x14be48[_0xda72('0x22')],'include':_0x14be48[_0xda72('0x20')]?_[_0xda72('0x21')](_0x14be48[_0xda72('0x20')],function(_0x24db5a){return{'model':db[_0x24db5a[_0xda72('0x25')]],'as':_0x24db5a['as'],'attributes':_0x24db5a[_0xda72('0x22')],'include':_0x24db5a[_0xda72('0x20')]?_['map'](_0x24db5a['include'],function(_0x338188){return{'model':db[_0x338188[_0xda72('0x25')]],'as':_0x338188['as'],'attributes':_0x338188[_0xda72('0x22')]};}):[]};}):[]};}):[]:[]})[_0xda72('0x26')](function(_0x153b1f){logger['info']('ShowChatQueue',_0x5ee5d3);logger[_0xda72('0x13')](_0xda72('0x23'),_0x5ee5d3,JSON[_0xda72('0x16')](_0x153b1f));_0x59f739(_0x153b1f);})[_0xda72('0x1a')](function(_0x422b76){logger[_0xda72('0x17')](_0xda72('0x23'),_0x422b76[_0xda72('0x19')],_0x5ee5d3);_0x5d15ad(_0x3805d4[_0xda72('0x17')](0x1f4,_0x422b76['message']));});});}; \ No newline at end of file +var _0x1280=['map','include','model','attributes','find','where','ShowChatQueue','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','limit'];(function(_0x122935,_0x170b66){var _0x27af29=function(_0x580ab0){while(--_0x580ab0){_0x122935['push'](_0x122935['shift']());}};_0x27af29(++_0x170b66);}(_0x1280,0xac));var _0x0128=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x1280[_0x2fdce0];return _0x36f07e;};'use strict';var _=require(_0x0128('0x0'));var util=require('util');var moment=require(_0x0128('0x1'));var BPromise=require(_0x0128('0x2'));var rs=require(_0x0128('0x3'));var fs=require('fs');var Redis=require(_0x0128('0x4'));var db=require(_0x0128('0x5'))['db'];var utils=require(_0x0128('0x6'));var logger=require('../../config/logger')(_0x0128('0x7'));var config=require(_0x0128('0x8'));var jayson=require(_0x0128('0x9'));var client=jayson[_0x0128('0xa')]['http']({'port':0x232a});config['redis']=_[_0x0128('0xb')](config[_0x0128('0xc')],{'host':_0x0128('0xd'),'port':0x18eb});var socket=require(_0x0128('0xe'))(new Redis(config['redis']));require(_0x0128('0xf'))[_0x0128('0x10')](socket);function respondWithRpcPromise(_0x4f1ac6,_0x1ac826,_0x12e938){return new BPromise(function(_0x67c079,_0x55da9d){return client['request'](_0x4f1ac6,_0x12e938)[_0x0128('0x11')](function(_0x404cb2){logger[_0x0128('0x12')]('ChatQueue,\x20%s,\x20%s',_0x1ac826,_0x0128('0x13'));logger['debug'](_0x0128('0x14'),_0x1ac826,'request\x20sent',JSON[_0x0128('0x15')](_0x404cb2));if(_0x404cb2['error']){if(_0x404cb2[_0x0128('0x16')]['code']===0x1f4){logger[_0x0128('0x16')](_0x0128('0x17'),_0x1ac826,_0x404cb2[_0x0128('0x16')][_0x0128('0x18')]);return _0x55da9d(_0x404cb2[_0x0128('0x16')][_0x0128('0x18')]);}logger['error'](_0x0128('0x17'),_0x1ac826,_0x404cb2[_0x0128('0x16')][_0x0128('0x18')]);return _0x67c079(_0x404cb2[_0x0128('0x16')][_0x0128('0x18')]);}else{logger[_0x0128('0x12')]('ChatQueue,\x20%s,\x20%s',_0x1ac826,_0x0128('0x13'));_0x67c079(_0x404cb2[_0x0128('0x19')][_0x0128('0x18')]);}})[_0x0128('0x1a')](function(_0xe5b7d2){logger[_0x0128('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1ac826,_0xe5b7d2);_0x55da9d(_0xe5b7d2);});});}exports[_0x0128('0x1b')]=function(_0x2da481){var _0x5d946e=this;return new Promise(function(_0x4ad121,_0x2c000a){return db[_0x0128('0x1c')][_0x0128('0x1d')]({'raw':_0x2da481[_0x0128('0x1e')]?_0x2da481[_0x0128('0x1e')][_0x0128('0x1f')]===undefined?!![]:![]:!![],'where':_0x2da481[_0x0128('0x1e')]?_0x2da481[_0x0128('0x1e')]['where']||null:null,'attributes':_0x2da481['options']?_0x2da481[_0x0128('0x1e')]['attributes']||null:null,'limit':_0x2da481[_0x0128('0x1e')]?_0x2da481[_0x0128('0x1e')][_0x0128('0x20')]||null:null,'include':_0x2da481['options']?_0x2da481[_0x0128('0x1e')]['include']?_[_0x0128('0x21')](_0x2da481[_0x0128('0x1e')][_0x0128('0x22')],function(_0x415073){return{'model':db[_0x415073[_0x0128('0x23')]],'as':_0x415073['as'],'attributes':_0x415073['attributes'],'include':_0x415073[_0x0128('0x22')]?_[_0x0128('0x21')](_0x415073['include'],function(_0x2b1819){return{'model':db[_0x2b1819[_0x0128('0x23')]],'as':_0x2b1819['as'],'attributes':_0x2b1819['attributes'],'include':_0x2b1819[_0x0128('0x22')]?_[_0x0128('0x21')](_0x2b1819[_0x0128('0x22')],function(_0x555b25){return{'model':db[_0x555b25['model']],'as':_0x555b25['as'],'attributes':_0x555b25[_0x0128('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57a838){logger['info'](_0x0128('0x1b'),_0x2da481);logger['debug'](_0x0128('0x1b'),_0x2da481,JSON[_0x0128('0x15')](_0x57a838));_0x4ad121(_0x57a838);})[_0x0128('0x1a')](function(_0x41f198){logger['error'](_0x0128('0x1b'),_0x41f198[_0x0128('0x18')],_0x2da481);_0x2c000a(_0x5d946e[_0x0128('0x16')](0x1f4,_0x41f198[_0x0128('0x18')]));});});};exports['ShowChatQueue']=function(_0x45278e){var _0x40b088=this;return new Promise(function(_0x32d622,_0x20f35f){return db[_0x0128('0x1c')][_0x0128('0x25')]({'raw':_0x45278e[_0x0128('0x1e')]?_0x45278e['options']['raw']===undefined?!![]:![]:!![],'where':_0x45278e['options']?_0x45278e[_0x0128('0x1e')][_0x0128('0x26')]||null:null,'attributes':_0x45278e[_0x0128('0x1e')]?_0x45278e['options'][_0x0128('0x24')]||null:null,'include':_0x45278e['options']?_0x45278e[_0x0128('0x1e')][_0x0128('0x22')]?_[_0x0128('0x21')](_0x45278e[_0x0128('0x1e')]['include'],function(_0x5b354e){return{'model':db[_0x5b354e[_0x0128('0x23')]],'as':_0x5b354e['as'],'attributes':_0x5b354e[_0x0128('0x24')],'include':_0x5b354e[_0x0128('0x22')]?_[_0x0128('0x21')](_0x5b354e['include'],function(_0x4de8dc){return{'model':db[_0x4de8dc[_0x0128('0x23')]],'as':_0x4de8dc['as'],'attributes':_0x4de8dc[_0x0128('0x24')],'include':_0x4de8dc[_0x0128('0x22')]?_[_0x0128('0x21')](_0x4de8dc[_0x0128('0x22')],function(_0x478d57){return{'model':db[_0x478d57[_0x0128('0x23')]],'as':_0x478d57['as'],'attributes':_0x478d57[_0x0128('0x24')]};}):[]};}):[]};}):[]:[]})[_0x0128('0x11')](function(_0x5bf049){logger['info'](_0x0128('0x27'),_0x45278e);logger[_0x0128('0x28')](_0x0128('0x27'),_0x45278e,JSON[_0x0128('0x15')](_0x5bf049));_0x32d622(_0x5bf049);})[_0x0128('0x1a')](function(_0x5b3671){logger[_0x0128('0x16')](_0x0128('0x27'),_0x5b3671['message'],_0x45278e);_0x20f35f(_0x40b088[_0x0128('0x16')](0x1f4,_0x5b3671[_0x0128('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index fab6132..7337d5e 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 _0x4fdb=['removeListener','length','./chatQueue.events','save','remove','update','emit'];(function(_0x3d1f8e,_0x279486){var _0x3ebcb3=function(_0x544b2e){while(--_0x544b2e){_0x3d1f8e['push'](_0x3d1f8e['shift']());}};_0x3ebcb3(++_0x279486);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xc7d0e4,_0x40fc27){_0xc7d0e4=_0xc7d0e4-0x0;var _0xfc0b7e=_0x4fdb[_0xc7d0e4];return _0xfc0b7e;};'use strict';var ChatQueueEvents=require(_0xb4fd('0x0'));var events=[_0xb4fd('0x1'),_0xb4fd('0x2'),_0xb4fd('0x3')];function createListener(_0x3b399e,_0xafe34b){return function(_0x260a35){_0xafe34b[_0xb4fd('0x4')](_0x3b399e,_0x260a35);};}function removeListener(_0x1c0b08,_0x5b73bb){return function(){ChatQueueEvents[_0xb4fd('0x5')](_0x1c0b08,_0x5b73bb);};}exports['register']=function(_0x14052b){for(var _0x5d8b39=0x0,_0x53273f=events[_0xb4fd('0x6')];_0x5d8b39<_0x53273f;_0x5d8b39++){var _0x3af8e3=events[_0x5d8b39];var _0x1151b5=createListener('chatQueue:'+_0x3af8e3,_0x14052b);ChatQueueEvents['on'](_0x3af8e3,_0x1151b5);}}; \ No newline at end of file +var _0xe107=['remove','update','removeListener','register','length','./chatQueue.events'];(function(_0x3931d1,_0x32979d){var _0x37ac89=function(_0x40f463){while(--_0x40f463){_0x3931d1['push'](_0x3931d1['shift']());}};_0x37ac89(++_0x32979d);}(_0xe107,0xb3));var _0x7e10=function(_0x1dae87,_0x58e46d){_0x1dae87=_0x1dae87-0x0;var _0x1a3923=_0xe107[_0x1dae87];return _0x1a3923;};'use strict';var ChatQueueEvents=require(_0x7e10('0x0'));var events=['save',_0x7e10('0x1'),_0x7e10('0x2')];function createListener(_0x2871b0,_0x570b2a){return function(_0x31212d){_0x570b2a['emit'](_0x2871b0,_0x31212d);};}function removeListener(_0x4db676,_0x2bdf3c){return function(){ChatQueueEvents[_0x7e10('0x3')](_0x4db676,_0x2bdf3c);};}exports[_0x7e10('0x4')]=function(_0x5be19f){for(var _0x5f1edf=0x0,_0x1dd3de=events[_0x7e10('0x5')];_0x5f1edf<_0x1dd3de;_0x5f1edf++){var _0x156c56=events[_0x5f1edf];var _0x3413f7=createListener('chatQueue:'+_0x156c56,_0x5be19f);ChatQueueEvents['on'](_0x156c56,_0x3413f7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 249f952..20af19d 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x208961,_0x5e6cf6){var _0x4236f5=function(_0x28856f){while(--_0x28856f){_0x208961['push'](_0x208961['shift']());}};_0x4236f5(++_0x5e6cf6);}(_0xe14b,0x93));var _0xbe14=function(_0x59eee8,_0x5ccd90){_0x59eee8=_0x59eee8-0x0;var _0x227bc2=_0xe14b[_0x59eee8];return _0x227bc2;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x337551,_0x532ead){var _0x2c5761=function(_0x33120a){while(--_0x33120a){_0x337551['push'](_0x337551['shift']());}};_0x2c5761(++_0x532ead);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 29a1d2f..a1905aa 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 _0xee54=['DATE','moment','sequelize','exports','STRING'];(function(_0x5dfff5,_0x34e32e){var _0x504a80=function(_0x22b06b){while(--_0x22b06b){_0x5dfff5['push'](_0x5dfff5['shift']());}};_0x504a80(++_0x34e32e);}(_0xee54,0x1f0));var _0x4ee5=function(_0x2c9d94,_0x291ca8){_0x2c9d94=_0x2c9d94-0x0;var _0x7339bb=_0xee54[_0x2c9d94];return _0x7339bb;};'use strict';var moment=require(_0x4ee5('0x0'));var Sequelize=require(_0x4ee5('0x1'));module[_0x4ee5('0x2')]={'uniqueid':{'type':Sequelize[_0x4ee5('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4ee5('0x3')]},'joinAt':{'type':Sequelize[_0x4ee5('0x4')]},'leaveAt':{'type':Sequelize[_0x4ee5('0x4')]},'acceptAt':{'type':Sequelize[_0x4ee5('0x4')]},'exitAt':{'type':Sequelize[_0x4ee5('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9917=['exports','STRING','DATE','moment'];(function(_0x563f83,_0x1b0868){var _0x4f633d=function(_0x3166a4){while(--_0x3166a4){_0x563f83['push'](_0x563f83['shift']());}};_0x4f633d(++_0x1b0868);}(_0x9917,0x8f));var _0x7991=function(_0x437d50,_0x45e2cf){_0x437d50=_0x437d50-0x0;var _0x257991=_0x9917[_0x437d50];return _0x257991;};'use strict';var moment=require(_0x7991('0x0'));var Sequelize=require('sequelize');module[_0x7991('0x1')]={'uniqueid':{'type':Sequelize[_0x7991('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7991('0x2')]},'joinAt':{'type':Sequelize[_0x7991('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x7991('0x3')]},'exitAt':{'type':Sequelize[_0x7991('0x3')]},'reason':{'type':Sequelize[_0x7991('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index fdcb43b..af9abeb 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 _0x806b=['end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','name','options','ChatQueueReport','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus'];(function(_0x4de94d,_0xdd6680){var _0x5a74f5=function(_0x3e7181){while(--_0x3e7181){_0x4de94d['push'](_0x4de94d['shift']());}};_0x5a74f5(++_0xdd6680);}(_0x806b,0x163));var _0xb806=function(_0x146d5c,_0x589288){_0x146d5c=_0x146d5c-0x0;var _0x21af6f=_0x806b[_0x146d5c];return _0x21af6f;};'use strict';var emlformat=require(_0xb806('0x0'));var rimraf=require(_0xb806('0x1'));var zipdir=require(_0xb806('0x2'));var jsonpatch=require(_0xb806('0x3'));var rp=require(_0xb806('0x4'));var moment=require(_0xb806('0x5'));var BPromise=require(_0xb806('0x6'));var Mustache=require(_0xb806('0x7'));var util=require('util');var path=require(_0xb806('0x8'));var sox=require(_0xb806('0x9'));var csv=require(_0xb806('0xa'));var ejs=require(_0xb806('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb806('0xc'));var squel=require(_0xb806('0xd'));var crypto=require('crypto');var jsforce=require(_0xb806('0xe'));var deskjs=require(_0xb806('0xf'));var toCsv=require(_0xb806('0xa'));var querystring=require(_0xb806('0x10'));var Papa=require('papaparse');var Redis=require(_0xb806('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb806('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb806('0x13'));var logger=require('../../config/logger')(_0xb806('0x14'));var utils=require(_0xb806('0x15'));var config=require(_0xb806('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb806('0x17'))['db'];function respondWithStatusCode(_0x5e83e3,_0x5f46d4){_0x5f46d4=_0x5f46d4||0xcc;return function(_0x2b2f90){if(_0x2b2f90){return _0x5e83e3[_0xb806('0x18')](_0x5f46d4);}return _0x5e83e3['status'](_0x5f46d4)[_0xb806('0x19')]();};}function respondWithResult(_0x4394c5,_0x58fdc3){_0x58fdc3=_0x58fdc3||0xc8;return function(_0x282777){if(_0x282777){return _0x4394c5[_0xb806('0x1a')](_0x58fdc3)[_0xb806('0x1b')](_0x282777);}};}function respondWithFilteredResult(_0x1a3258,_0x3d7ef9){return function(_0x49b02c){if(_0x49b02c){var _0x549bb6=typeof _0x3d7ef9[_0xb806('0x1c')]==='undefined'&&typeof _0x3d7ef9[_0xb806('0x1d')]===_0xb806('0x1e');var _0x2fd643=_0x49b02c[_0xb806('0x1f')];var _0x5375c1=_0x549bb6?0x0:_0x3d7ef9[_0xb806('0x1c')];var _0x1e17d2=_0x549bb6?_0x49b02c[_0xb806('0x1f')]:_0x3d7ef9[_0xb806('0x1c')]+_0x3d7ef9[_0xb806('0x1d')];var _0x21ed1d;if(_0x1e17d2>=_0x2fd643){_0x1e17d2=_0x2fd643;_0x21ed1d=0xc8;}else{_0x21ed1d=0xce;}_0x1a3258['status'](_0x21ed1d);return _0x1a3258[_0xb806('0x20')](_0xb806('0x21'),_0x5375c1+'-'+_0x1e17d2+'/'+_0x2fd643)['json'](_0x49b02c);}return null;};}function patchUpdates(_0x34b1fa){return function(_0x2dbb8a){try{jsonpatch[_0xb806('0x22')](_0x2dbb8a,_0x34b1fa,!![]);}catch(_0x1f2841){return BPromise['reject'](_0x1f2841);}return _0x2dbb8a[_0xb806('0x23')]();};}function saveUpdates(_0x44e06e,_0x201f1f){return function(_0x49ae70){if(_0x49ae70){return _0x49ae70['update'](_0x44e06e)[_0xb806('0x24')](function(_0x2130ef){return _0x2130ef;});}return null;};}function removeEntity(_0x52f12d,_0x570837){return function(_0x4e5dac){if(_0x4e5dac){return _0x4e5dac[_0xb806('0x25')]()['then'](function(){_0x52f12d['status'](0xcc)[_0xb806('0x19')]();});}};}function handleEntityNotFound(_0x3c4556,_0x3c6d4a){return function(_0x425956){if(!_0x425956){_0x3c4556[_0xb806('0x18')](0x194);}return _0x425956;};}function handleError(_0x2f8443,_0x3494c5){_0x3494c5=_0x3494c5||0x1f4;return function(_0xcd8bb7){logger[_0xb806('0x26')](_0xcd8bb7['stack']);if(_0xcd8bb7['name']){delete _0xcd8bb7['name'];}_0x2f8443['status'](_0x3494c5)[_0xb806('0x27')](_0xcd8bb7);};}exports[_0xb806('0x28')]=function(_0x512571,_0x35a540){var _0x1d34ba={},_0x34d9e1={},_0x538ce4={'count':0x0,'rows':[]};var _0x1ad3da=_[_0xb806('0x29')](db['ChatQueueReport'][_0xb806('0x2a')],function(_0x4fd393){return{'name':_0x4fd393[_0xb806('0x2b')],'type':_0x4fd393[_0xb806('0x2c')][_0xb806('0x2d')]};});_0x34d9e1[_0xb806('0x2e')]=_[_0xb806('0x29')](_0x1ad3da,'name');_0x34d9e1[_0xb806('0x2f')]=_[_0xb806('0x30')](_0x512571[_0xb806('0x2f')]);_0x34d9e1['filters']=_[_0xb806('0x31')](_0x34d9e1[_0xb806('0x2e')],_0x34d9e1['query']);_0x1d34ba[_0xb806('0x32')]=_['intersection'](_0x34d9e1[_0xb806('0x2e')],qs[_0xb806('0x33')](_0x512571[_0xb806('0x2f')][_0xb806('0x33')]));_0x1d34ba[_0xb806('0x32')]=_0x1d34ba['attributes'][_0xb806('0x34')]?_0x1d34ba[_0xb806('0x32')]:_0x34d9e1[_0xb806('0x2e')];if(!_0x512571[_0xb806('0x2f')][_0xb806('0x35')](_0xb806('0x36'))){_0x1d34ba[_0xb806('0x1d')]=qs[_0xb806('0x1d')](_0x512571[_0xb806('0x2f')]['limit']);_0x1d34ba[_0xb806('0x1c')]=qs[_0xb806('0x1c')](_0x512571[_0xb806('0x2f')][_0xb806('0x1c')]);}_0x1d34ba[_0xb806('0x37')]=qs[_0xb806('0x38')](_0x512571[_0xb806('0x2f')][_0xb806('0x38')]);_0x1d34ba[_0xb806('0x39')]=qs['filters'](_[_0xb806('0x3a')](_0x512571[_0xb806('0x2f')],_0x34d9e1[_0xb806('0x3b')]),_0x1ad3da);if(_0x512571[_0xb806('0x2f')][_0xb806('0x3c')]){_0x1d34ba[_0xb806('0x39')]=_[_0xb806('0x3d')](_0x1d34ba[_0xb806('0x39')],{'$or':_[_0xb806('0x29')](_0x1ad3da,function(_0x176383){if(_0x176383[_0xb806('0x2c')]!==_0xb806('0x3e')){var _0x3b209e={};_0x3b209e[_0x176383[_0xb806('0x3f')]]={'$like':'%'+_0x512571[_0xb806('0x2f')]['filter']+'%'};return _0x3b209e;}})});}_0x1d34ba=_[_0xb806('0x3d')]({},_0x1d34ba,_0x512571[_0xb806('0x40')]);var _0x20b9e1={'where':_0x1d34ba[_0xb806('0x39')]};return db[_0xb806('0x41')][_0xb806('0x1f')](_0x20b9e1)[_0xb806('0x24')](function(_0x2e9ff8){_0x538ce4[_0xb806('0x1f')]=_0x2e9ff8;if(_0x512571[_0xb806('0x2f')][_0xb806('0x42')]){_0x1d34ba[_0xb806('0x43')]=[{'all':!![]}];}return db[_0xb806('0x41')][_0xb806('0x44')](_0x1d34ba);})[_0xb806('0x24')](function(_0x6d103f){_0x538ce4[_0xb806('0x45')]=_0x6d103f;return _0x538ce4;})[_0xb806('0x24')](respondWithFilteredResult(_0x35a540,_0x1d34ba))[_0xb806('0x46')](handleError(_0x35a540,null));};exports[_0xb806('0x47')]=function(_0x3f0973,_0x361fe6){var _0x58477c={'raw':!![],'where':{'id':_0x3f0973['params']['id']}},_0x52662f={};_0x52662f['model']=_[_0xb806('0x30')](db['ChatQueueReport'][_0xb806('0x2a')]);_0x52662f[_0xb806('0x2f')]=_[_0xb806('0x30')](_0x3f0973[_0xb806('0x2f')]);_0x52662f[_0xb806('0x3b')]=_[_0xb806('0x31')](_0x52662f['model'],_0x52662f['query']);_0x58477c[_0xb806('0x32')]=_[_0xb806('0x31')](_0x52662f[_0xb806('0x2e')],qs[_0xb806('0x33')](_0x3f0973[_0xb806('0x2f')]['fields']));_0x58477c['attributes']=_0x58477c[_0xb806('0x32')][_0xb806('0x34')]?_0x58477c[_0xb806('0x32')]:_0x52662f['model'];if(_0x3f0973[_0xb806('0x2f')]['includeAll']){_0x58477c[_0xb806('0x43')]=[{'all':!![]}];}_0x58477c=_['merge']({},_0x58477c,_0x3f0973['options']);return db['ChatQueueReport'][_0xb806('0x48')](_0x58477c)['then'](handleEntityNotFound(_0x361fe6,null))['then'](respondWithResult(_0x361fe6,null))['catch'](handleError(_0x361fe6,null));};exports['create']=function(_0x71bc6e,_0x3e45eb){return db[_0xb806('0x41')]['create'](_0x71bc6e[_0xb806('0x49')],{})['then'](respondWithResult(_0x3e45eb,0xc9))[_0xb806('0x46')](handleError(_0x3e45eb,null));};exports['update']=function(_0x517855,_0x34743e){if(_0x517855[_0xb806('0x49')]['id']){delete _0x517855[_0xb806('0x49')]['id'];}return db[_0xb806('0x41')][_0xb806('0x48')]({'where':{'id':_0x517855[_0xb806('0x4a')]['id']}})[_0xb806('0x24')](handleEntityNotFound(_0x34743e,null))[_0xb806('0x24')](saveUpdates(_0x517855[_0xb806('0x49')],null))['then'](respondWithResult(_0x34743e,null))[_0xb806('0x46')](handleError(_0x34743e,null));};exports[_0xb806('0x25')]=function(_0x242b53,_0xa4547){return db['ChatQueueReport']['find']({'where':{'id':_0x242b53[_0xb806('0x4a')]['id']}})[_0xb806('0x24')](handleEntityNotFound(_0xa4547,null))[_0xb806('0x24')](removeEntity(_0xa4547,null))[_0xb806('0x46')](handleError(_0xa4547,null));};exports['describe']=function(_0x5285c1,_0x1fca8e){return db[_0xb806('0x41')][_0xb806('0x4b')]()[_0xb806('0x24')](respondWithResult(_0x1fca8e,null))[_0xb806('0x46')](handleError(_0x1fca8e,null));}; \ No newline at end of file +var _0x61f1=['find','create','body','describe','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','ChatQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params'];(function(_0x424d98,_0xae5075){var _0xdad5cd=function(_0x227acd){while(--_0x227acd){_0x424d98['push'](_0x424d98['shift']());}};_0xdad5cd(++_0xae5075);}(_0x61f1,0x18a));var _0x161f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x61f1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x161f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x161f('0x1'));var rp=require(_0x161f('0x2'));var moment=require(_0x161f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x161f('0x4'));var path=require(_0x161f('0x5'));var sox=require('sox');var csv=require(_0x161f('0x6'));var ejs=require(_0x161f('0x7'));var fs=require('fs');var fs_extra=require(_0x161f('0x8'));var _=require(_0x161f('0x9'));var squel=require(_0x161f('0xa'));var crypto=require('crypto');var jsforce=require(_0x161f('0xb'));var deskjs=require(_0x161f('0xc'));var toCsv=require(_0x161f('0x6'));var querystring=require(_0x161f('0xd'));var Papa=require(_0x161f('0xe'));var Redis=require(_0x161f('0xf'));var authService=require(_0x161f('0x10'));var qs=require(_0x161f('0x11'));var as=require(_0x161f('0x12'));var hardwareService=require(_0x161f('0x13'));var logger=require(_0x161f('0x14'))('api');var utils=require(_0x161f('0x15'));var config=require(_0x161f('0x16'));var licenseUtil=require(_0x161f('0x17'));var db=require(_0x161f('0x18'))['db'];function respondWithStatusCode(_0x113346,_0x4b0917){_0x4b0917=_0x4b0917||0xcc;return function(_0x30b9fb){if(_0x30b9fb){return _0x113346[_0x161f('0x19')](_0x4b0917);}return _0x113346[_0x161f('0x1a')](_0x4b0917)[_0x161f('0x1b')]();};}function respondWithResult(_0x4b34db,_0xc6108b){_0xc6108b=_0xc6108b||0xc8;return function(_0x3a80c4){if(_0x3a80c4){return _0x4b34db[_0x161f('0x1a')](_0xc6108b)[_0x161f('0x1c')](_0x3a80c4);}};}function respondWithFilteredResult(_0x4470d9,_0x1ceffb){return function(_0x594742){if(_0x594742){var _0x486261=typeof _0x1ceffb[_0x161f('0x1d')]===_0x161f('0x1e')&&typeof _0x1ceffb[_0x161f('0x1f')]==='undefined';var _0x325d4c=_0x594742[_0x161f('0x20')];var _0x2cf920=_0x486261?0x0:_0x1ceffb['offset'];var _0x420818=_0x486261?_0x594742['count']:_0x1ceffb[_0x161f('0x1d')]+_0x1ceffb[_0x161f('0x1f')];var _0x10fd8e;if(_0x420818>=_0x325d4c){_0x420818=_0x325d4c;_0x10fd8e=0xc8;}else{_0x10fd8e=0xce;}_0x4470d9[_0x161f('0x1a')](_0x10fd8e);return _0x4470d9[_0x161f('0x21')](_0x161f('0x22'),_0x2cf920+'-'+_0x420818+'/'+_0x325d4c)[_0x161f('0x1c')](_0x594742);}return null;};}function patchUpdates(_0x3a3a61){return function(_0x1153ce){try{jsonpatch[_0x161f('0x23')](_0x1153ce,_0x3a3a61,!![]);}catch(_0xdba48d){return BPromise[_0x161f('0x24')](_0xdba48d);}return _0x1153ce[_0x161f('0x25')]();};}function saveUpdates(_0x5a92b8,_0x3ae0dc){return function(_0xc6fc5e){if(_0xc6fc5e){return _0xc6fc5e[_0x161f('0x26')](_0x5a92b8)['then'](function(_0x5966d6){return _0x5966d6;});}return null;};}function removeEntity(_0xca1a9f,_0xaf2a44){return function(_0x161d91){if(_0x161d91){return _0x161d91[_0x161f('0x27')]()[_0x161f('0x28')](function(){_0xca1a9f['status'](0xcc)[_0x161f('0x1b')]();});}};}function handleEntityNotFound(_0x2b501f,_0x2ad3d2){return function(_0x4c1cac){if(!_0x4c1cac){_0x2b501f[_0x161f('0x19')](0x194);}return _0x4c1cac;};}function handleError(_0x378423,_0xe900b0){_0xe900b0=_0xe900b0||0x1f4;return function(_0x413c75){logger[_0x161f('0x29')](_0x413c75[_0x161f('0x2a')]);if(_0x413c75['name']){delete _0x413c75[_0x161f('0x2b')];}_0x378423[_0x161f('0x1a')](_0xe900b0)[_0x161f('0x2c')](_0x413c75);};}exports[_0x161f('0x2d')]=function(_0x94935,_0xc3a866){var _0x589793={},_0x18e910={},_0x3c5717={'count':0x0,'rows':[]};var _0x264d09=_['map'](db[_0x161f('0x2e')][_0x161f('0x2f')],function(_0x151bf4){return{'name':_0x151bf4[_0x161f('0x30')],'type':_0x151bf4[_0x161f('0x31')][_0x161f('0x32')]};});_0x18e910[_0x161f('0x33')]=_[_0x161f('0x34')](_0x264d09,'name');_0x18e910['query']=_[_0x161f('0x35')](_0x94935[_0x161f('0x36')]);_0x18e910[_0x161f('0x37')]=_['intersection'](_0x18e910['model'],_0x18e910['query']);_0x589793[_0x161f('0x38')]=_[_0x161f('0x39')](_0x18e910['model'],qs[_0x161f('0x3a')](_0x94935[_0x161f('0x36')][_0x161f('0x3a')]));_0x589793[_0x161f('0x38')]=_0x589793['attributes'][_0x161f('0x3b')]?_0x589793['attributes']:_0x18e910[_0x161f('0x33')];if(!_0x94935[_0x161f('0x36')][_0x161f('0x3c')](_0x161f('0x3d'))){_0x589793[_0x161f('0x1f')]=qs[_0x161f('0x1f')](_0x94935[_0x161f('0x36')][_0x161f('0x1f')]);_0x589793[_0x161f('0x1d')]=qs[_0x161f('0x1d')](_0x94935['query'][_0x161f('0x1d')]);}_0x589793['order']=qs[_0x161f('0x3e')](_0x94935[_0x161f('0x36')]['sort']);_0x589793[_0x161f('0x3f')]=qs[_0x161f('0x37')](_[_0x161f('0x40')](_0x94935[_0x161f('0x36')],_0x18e910['filters']),_0x264d09);if(_0x94935[_0x161f('0x36')][_0x161f('0x41')]){_0x589793['where']=_['merge'](_0x589793['where'],{'$or':_[_0x161f('0x34')](_0x264d09,function(_0x1dc384){if(_0x1dc384['type']!==_0x161f('0x42')){var _0x4cdb1a={};_0x4cdb1a[_0x1dc384['name']]={'$like':'%'+_0x94935[_0x161f('0x36')][_0x161f('0x41')]+'%'};return _0x4cdb1a;}})});}_0x589793=_[_0x161f('0x43')]({},_0x589793,_0x94935['options']);var _0x779e5f={'where':_0x589793[_0x161f('0x3f')]};return db[_0x161f('0x2e')][_0x161f('0x20')](_0x779e5f)[_0x161f('0x28')](function(_0x44b437){_0x3c5717[_0x161f('0x20')]=_0x44b437;if(_0x94935[_0x161f('0x36')][_0x161f('0x44')]){_0x589793[_0x161f('0x45')]=[{'all':!![]}];}return db[_0x161f('0x2e')][_0x161f('0x46')](_0x589793);})[_0x161f('0x28')](function(_0x49a60b){_0x3c5717['rows']=_0x49a60b;return _0x3c5717;})[_0x161f('0x28')](respondWithFilteredResult(_0xc3a866,_0x589793))[_0x161f('0x47')](handleError(_0xc3a866,null));};exports[_0x161f('0x48')]=function(_0xbf283e,_0x51076d){var _0xebcfb1={'raw':!![],'where':{'id':_0xbf283e[_0x161f('0x49')]['id']}},_0x2972d3={};_0x2972d3[_0x161f('0x33')]=_[_0x161f('0x35')](db[_0x161f('0x2e')][_0x161f('0x2f')]);_0x2972d3['query']=_[_0x161f('0x35')](_0xbf283e[_0x161f('0x36')]);_0x2972d3['filters']=_['intersection'](_0x2972d3[_0x161f('0x33')],_0x2972d3['query']);_0xebcfb1[_0x161f('0x38')]=_[_0x161f('0x39')](_0x2972d3[_0x161f('0x33')],qs[_0x161f('0x3a')](_0xbf283e[_0x161f('0x36')][_0x161f('0x3a')]));_0xebcfb1[_0x161f('0x38')]=_0xebcfb1[_0x161f('0x38')]['length']?_0xebcfb1[_0x161f('0x38')]:_0x2972d3[_0x161f('0x33')];if(_0xbf283e[_0x161f('0x36')][_0x161f('0x44')]){_0xebcfb1[_0x161f('0x45')]=[{'all':!![]}];}_0xebcfb1=_[_0x161f('0x43')]({},_0xebcfb1,_0xbf283e['options']);return db[_0x161f('0x2e')][_0x161f('0x4a')](_0xebcfb1)[_0x161f('0x28')](handleEntityNotFound(_0x51076d,null))[_0x161f('0x28')](respondWithResult(_0x51076d,null))[_0x161f('0x47')](handleError(_0x51076d,null));};exports['create']=function(_0x5bbc82,_0x5d8ef8){return db['ChatQueueReport'][_0x161f('0x4b')](_0x5bbc82['body'],{})[_0x161f('0x28')](respondWithResult(_0x5d8ef8,0xc9))['catch'](handleError(_0x5d8ef8,null));};exports[_0x161f('0x26')]=function(_0x23c4ce,_0x913df3){if(_0x23c4ce['body']['id']){delete _0x23c4ce[_0x161f('0x4c')]['id'];}return db[_0x161f('0x2e')]['find']({'where':{'id':_0x23c4ce['params']['id']}})[_0x161f('0x28')](handleEntityNotFound(_0x913df3,null))['then'](saveUpdates(_0x23c4ce[_0x161f('0x4c')],null))['then'](respondWithResult(_0x913df3,null))[_0x161f('0x47')](handleError(_0x913df3,null));};exports[_0x161f('0x27')]=function(_0x165aff,_0x3f2ebb){return db[_0x161f('0x2e')][_0x161f('0x4a')]({'where':{'id':_0x165aff[_0x161f('0x49')]['id']}})[_0x161f('0x28')](handleEntityNotFound(_0x3f2ebb,null))[_0x161f('0x28')](removeEntity(_0x3f2ebb,null))[_0x161f('0x47')](handleError(_0x3f2ebb,null));};exports[_0x161f('0x4d')]=function(_0x67219b,_0x26623f){return db[_0x161f('0x2e')][_0x161f('0x4d')]()[_0x161f('0x28')](respondWithResult(_0x26623f,null))[_0x161f('0x47')](handleError(_0x26623f,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 746737e..d18eb12 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x316c42,_0x3391f0){var _0x2b38f7=function(_0x38d2cf){while(--_0x38d2cf){_0x316c42['push'](_0x316c42['shift']());}};_0x2b38f7(++_0x3391f0);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0xc2fc17,_0x2b78be){var _0x5b4fe0=function(_0x5f1e00){while(--_0x5f1e00){_0xc2fc17['push'](_0xc2fc17['shift']());}};_0x5b4fe0(++_0x2b78be);}(_0xe706,0xa3));var _0x6e70=function(_0xedc5db,_0x210b81){_0xedc5db=_0xedc5db-0x0;var _0x319879=_0xe706[_0xedc5db];return _0x319879;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 8a131ae..89b0044 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 _0xbd5d=['where','attributes','limit','UpdateChatQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','then','debug','update'];(function(_0x3857b0,_0xca298e){var _0x35c95d=function(_0x5eb72c){while(--_0x5eb72c){_0x3857b0['push'](_0x3857b0['shift']());}};_0x35c95d(++_0xca298e);}(_0xbd5d,0x13f));var _0xdbd5=function(_0x55e5dc,_0x1361df){_0x55e5dc=_0x55e5dc-0x0;var _0x41aa6b=_0xbd5d[_0x55e5dc];return _0x41aa6b;};'use strict';var _=require(_0xdbd5('0x0'));var util=require(_0xdbd5('0x1'));var moment=require('moment');var BPromise=require(_0xdbd5('0x2'));var rs=require(_0xdbd5('0x3'));var fs=require('fs');var Redis=require(_0xdbd5('0x4'));var db=require(_0xdbd5('0x5'))['db'];var utils=require(_0xdbd5('0x6'));var logger=require(_0xdbd5('0x7'))('rpc');var config=require(_0xdbd5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xdbd5('0x9')][_0xdbd5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11b4de,_0x3687d1,_0x2a7696){return new BPromise(function(_0x1b9f54,_0x44bc3e){return client[_0xdbd5('0xb')](_0x11b4de,_0x2a7696)['then'](function(_0x45d81e){logger[_0xdbd5('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x3687d1,_0xdbd5('0xd'));logger['debug'](_0xdbd5('0xe'),_0x3687d1,_0xdbd5('0xd'),JSON[_0xdbd5('0xf')](_0x45d81e));if(_0x45d81e[_0xdbd5('0x10')]){if(_0x45d81e[_0xdbd5('0x10')][_0xdbd5('0x11')]===0x1f4){logger[_0xdbd5('0x10')](_0xdbd5('0x12'),_0x3687d1,_0x45d81e[_0xdbd5('0x10')]['message']);return _0x44bc3e(_0x45d81e['error']['message']);}logger[_0xdbd5('0x10')](_0xdbd5('0x12'),_0x3687d1,_0x45d81e[_0xdbd5('0x10')][_0xdbd5('0x13')]);return _0x1b9f54(_0x45d81e[_0xdbd5('0x10')][_0xdbd5('0x13')]);}else{logger[_0xdbd5('0xc')](_0xdbd5('0x12'),_0x3687d1,_0xdbd5('0xd'));_0x1b9f54(_0x45d81e[_0xdbd5('0x14')][_0xdbd5('0x13')]);}})[_0xdbd5('0x15')](function(_0x6f7410){logger[_0xdbd5('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3687d1,_0x6f7410);_0x44bc3e(_0x6f7410);});});}exports[_0xdbd5('0x16')]=function(_0x327c53){var _0x1a47c4=this;return new Promise(function(_0x225a1b,_0x2250cb){return db[_0xdbd5('0x17')][_0xdbd5('0x18')](_0x327c53[_0xdbd5('0x19')],{'raw':_0x327c53[_0xdbd5('0x1a')]?_0x327c53['options'][_0xdbd5('0x1b')]===undefined?!![]:![]:!![]})[_0xdbd5('0x1c')](function(_0x3fe3e7){logger['info'](_0xdbd5('0x16'),_0x327c53);logger[_0xdbd5('0x1d')](_0xdbd5('0x16'),_0x327c53,JSON[_0xdbd5('0xf')](_0x3fe3e7));_0x225a1b(_0x3fe3e7);})[_0xdbd5('0x15')](function(_0x1ebd4d){logger[_0xdbd5('0x10')]('CreateChatQueueReport',_0x1ebd4d['message'],_0x327c53);_0x2250cb(_0x1a47c4[_0xdbd5('0x10')](0x1f4,_0x1ebd4d[_0xdbd5('0x13')]));});});};exports['UpdateChatQueueReport']=function(_0x58a14e){var _0x206222=this;return new Promise(function(_0x46e2df,_0x4511fb){return db['ChatQueueReport'][_0xdbd5('0x1e')](_0x58a14e['body'],{'raw':_0x58a14e[_0xdbd5('0x1a')]?_0x58a14e[_0xdbd5('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58a14e[_0xdbd5('0x1a')]?_0x58a14e[_0xdbd5('0x1a')][_0xdbd5('0x1f')]||null:null,'attributes':_0x58a14e[_0xdbd5('0x1a')]?_0x58a14e['options'][_0xdbd5('0x20')]||null:null,'limit':_0x58a14e['options']?_0x58a14e[_0xdbd5('0x1a')][_0xdbd5('0x21')]||null:null})[_0xdbd5('0x1c')](function(_0x478e94){logger[_0xdbd5('0xc')](_0xdbd5('0x22'),_0x58a14e);logger[_0xdbd5('0x1d')]('UpdateChatQueueReport',_0x58a14e,JSON[_0xdbd5('0xf')](_0x478e94));_0x46e2df(_0x478e94);})[_0xdbd5('0x15')](function(_0x494cdc){logger[_0xdbd5('0x10')]('UpdateChatQueueReport',_0x494cdc[_0xdbd5('0x13')],_0x58a14e);_0x4511fb(_0x206222[_0xdbd5('0x10')](0x1f4,_0x494cdc['message']));});});}; \ No newline at end of file +var _0xb052=['http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','body','options','then','CreateChatQueueReport','UpdateChatQueueReport','ChatQueueReport','raw','attributes','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb052,0x1e6));var _0x2b05=function(_0x349148,_0x31eabb){_0x349148=_0x349148-0x0;var _0x2f2b0f=_0xb052[_0x349148];return _0x2f2b0f;};'use strict';var _=require(_0x2b05('0x0'));var util=require('util');var moment=require(_0x2b05('0x1'));var BPromise=require(_0x2b05('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2b05('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2b05('0x4'));var logger=require(_0x2b05('0x5'))(_0x2b05('0x6'));var config=require(_0x2b05('0x7'));var jayson=require(_0x2b05('0x8'));var client=jayson[_0x2b05('0x9')][_0x2b05('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x335662,_0x17c9e2,_0x51693c){return new BPromise(function(_0x307f61,_0x12eacf){return client[_0x2b05('0xb')](_0x335662,_0x51693c)['then'](function(_0x5ecdb2){logger[_0x2b05('0xc')](_0x2b05('0xd'),_0x17c9e2,_0x2b05('0xe'));logger[_0x2b05('0xf')](_0x2b05('0x10'),_0x17c9e2,_0x2b05('0xe'),JSON[_0x2b05('0x11')](_0x5ecdb2));if(_0x5ecdb2[_0x2b05('0x12')]){if(_0x5ecdb2[_0x2b05('0x12')][_0x2b05('0x13')]===0x1f4){logger['error'](_0x2b05('0xd'),_0x17c9e2,_0x5ecdb2[_0x2b05('0x12')]['message']);return _0x12eacf(_0x5ecdb2[_0x2b05('0x12')][_0x2b05('0x14')]);}logger[_0x2b05('0x12')](_0x2b05('0xd'),_0x17c9e2,_0x5ecdb2['error'][_0x2b05('0x14')]);return _0x307f61(_0x5ecdb2[_0x2b05('0x12')]['message']);}else{logger['info'](_0x2b05('0xd'),_0x17c9e2,_0x2b05('0xe'));_0x307f61(_0x5ecdb2[_0x2b05('0x15')][_0x2b05('0x14')]);}})[_0x2b05('0x16')](function(_0x5a9456){logger[_0x2b05('0x12')]('ChatQueueReport,\x20%s,\x20%s',_0x17c9e2,_0x5a9456);_0x12eacf(_0x5a9456);});});}exports['CreateChatQueueReport']=function(_0x1e4f35){var _0x293c4d=this;return new Promise(function(_0x4bf0d4,_0x4d4d80){return db['ChatQueueReport']['create'](_0x1e4f35[_0x2b05('0x17')],{'raw':_0x1e4f35[_0x2b05('0x18')]?_0x1e4f35[_0x2b05('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x2b05('0x19')](function(_0x177303){logger[_0x2b05('0xc')](_0x2b05('0x1a'),_0x1e4f35);logger[_0x2b05('0xf')]('CreateChatQueueReport',_0x1e4f35,JSON[_0x2b05('0x11')](_0x177303));_0x4bf0d4(_0x177303);})['catch'](function(_0xbfa8f3){logger[_0x2b05('0x12')](_0x2b05('0x1a'),_0xbfa8f3[_0x2b05('0x14')],_0x1e4f35);_0x4d4d80(_0x293c4d[_0x2b05('0x12')](0x1f4,_0xbfa8f3[_0x2b05('0x14')]));});});};exports[_0x2b05('0x1b')]=function(_0x3fc9ae){var _0x58aea2=this;return new Promise(function(_0x585077,_0x2f4a70){return db[_0x2b05('0x1c')]['update'](_0x3fc9ae[_0x2b05('0x17')],{'raw':_0x3fc9ae['options']?_0x3fc9ae['options'][_0x2b05('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3fc9ae[_0x2b05('0x18')]?_0x3fc9ae[_0x2b05('0x18')]['where']||null:null,'attributes':_0x3fc9ae[_0x2b05('0x18')]?_0x3fc9ae[_0x2b05('0x18')][_0x2b05('0x1e')]||null:null,'limit':_0x3fc9ae[_0x2b05('0x18')]?_0x3fc9ae[_0x2b05('0x18')]['limit']||null:null})['then'](function(_0x1bcda1){logger[_0x2b05('0xc')](_0x2b05('0x1b'),_0x3fc9ae);logger[_0x2b05('0xf')](_0x2b05('0x1b'),_0x3fc9ae,JSON['stringify'](_0x1bcda1));_0x585077(_0x1bcda1);})[_0x2b05('0x16')](function(_0x29f4d6){logger['error']('UpdateChatQueueReport',_0x29f4d6[_0x2b05('0x14')],_0x3fc9ae);_0x2f4a70(_0x58aea2[_0x2b05('0x12')](0x1f4,_0x29f4d6[_0x2b05('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 5a2d2c0..2b6dd6c 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 _0x73d0=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','destroy','exports','multer','path','connect-timeout'];(function(_0x1c2936,_0x3b4150){var _0x14bd15=function(_0x24fdb4){while(--_0x24fdb4){_0x1c2936['push'](_0x1c2936['shift']());}};_0x14bd15(++_0x3b4150);}(_0x73d0,0xed));var _0x073d=function(_0x423e4b,_0x1bb75b){_0x423e4b=_0x423e4b-0x0;var _0x626fd4=_0x73d0[_0x423e4b];return _0x626fd4;};'use strict';var multer=require(_0x073d('0x0'));var util=require('util');var path=require(_0x073d('0x1'));var timeout=require(_0x073d('0x2'));var express=require(_0x073d('0x3'));var router=express[_0x073d('0x4')]();var fs_extra=require(_0x073d('0x5'));var auth=require(_0x073d('0x6'));var interaction=require(_0x073d('0x7'));var config=require(_0x073d('0x8'));var controller=require('./chatQueueReport.controller');router[_0x073d('0x9')]('/',auth[_0x073d('0xa')](),controller[_0x073d('0xb')]);router[_0x073d('0x9')](_0x073d('0xc'),auth['isAuthenticated'](),controller[_0x073d('0xd')]);router[_0x073d('0x9')](_0x073d('0xe'),auth['isAuthenticated'](),controller[_0x073d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x073d('0x10')](_0x073d('0xe'),auth['isAuthenticated'](),controller[_0x073d('0x11')]);router['delete'](_0x073d('0xe'),auth[_0x073d('0xa')](),controller[_0x073d('0x12')]);module[_0x073d('0x13')]=router; \ No newline at end of file +var _0x2753=['update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','get','/describe','describe','post','put','/:id'];(function(_0x2f3191,_0x4b7e5c){var _0x2d68f2=function(_0x36d34f){while(--_0x36d34f){_0x2f3191['push'](_0x2f3191['shift']());}};_0x2d68f2(++_0x4b7e5c);}(_0x2753,0x143));var _0x3275=function(_0x1fe2e8,_0x947821){_0x1fe2e8=_0x1fe2e8-0x0;var _0x3383c0=_0x2753[_0x1fe2e8];return _0x3383c0;};'use strict';var multer=require(_0x3275('0x0'));var util=require('util');var path=require(_0x3275('0x1'));var timeout=require(_0x3275('0x2'));var express=require(_0x3275('0x3'));var router=express['Router']();var fs_extra=require(_0x3275('0x4'));var auth=require(_0x3275('0x5'));var interaction=require(_0x3275('0x6'));var config=require(_0x3275('0x7'));var controller=require(_0x3275('0x8'));router['get']('/',auth[_0x3275('0x9')](),controller[_0x3275('0xa')]);router[_0x3275('0xb')](_0x3275('0xc'),auth[_0x3275('0x9')](),controller[_0x3275('0xd')]);router[_0x3275('0xb')]('/:id',auth[_0x3275('0x9')](),controller['show']);router[_0x3275('0xe')]('/',auth[_0x3275('0x9')](),controller['create']);router[_0x3275('0xf')](_0x3275('0x10'),auth[_0x3275('0x9')](),controller[_0x3275('0x11')]);router['delete'](_0x3275('0x10'),auth[_0x3275('0x9')](),controller[_0x3275('0x12')]);module[_0x3275('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 0932fc8..5b3fd80 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x2587b6,_0x77b30d){var _0x465a2b=function(_0x288f70){while(--_0x288f70){_0x2587b6['push'](_0x2587b6['shift']());}};_0x465a2b(++_0x77b30d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x319000,_0x5cff40){var _0x43e0c7=function(_0x2c5125){while(--_0x2c5125){_0x319000['push'](_0x319000['shift']());}};_0x43e0c7(++_0x5cff40);}(_0xaa88,0x137));var _0x8aa8=function(_0x16051a,_0x5e4326){_0x16051a=_0x16051a-0x0;var _0x35d20d=_0xaa88[_0x16051a];return _0x35d20d;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 0e2f480..0e9b647 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 _0x737b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','send','index','map','ChatTransferReport','fieldName','type','model','name','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','show','params','rawAttributes','include','options','find','catch','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x213811,_0x1aed63){var _0x927a97=function(_0x425db9){while(--_0x425db9){_0x213811['push'](_0x213811['shift']());}};_0x927a97(++_0x1aed63);}(_0x737b,0x16c));var _0xb737=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x737b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb737('0x0'));var rimraf=require(_0xb737('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb737('0x2'));var rp=require(_0xb737('0x3'));var moment=require(_0xb737('0x4'));var BPromise=require(_0xb737('0x5'));var Mustache=require(_0xb737('0x6'));var util=require(_0xb737('0x7'));var path=require(_0xb737('0x8'));var sox=require(_0xb737('0x9'));var csv=require(_0xb737('0xa'));var ejs=require(_0xb737('0xb'));var fs=require('fs');var fs_extra=require(_0xb737('0xc'));var _=require(_0xb737('0xd'));var squel=require(_0xb737('0xe'));var crypto=require(_0xb737('0xf'));var jsforce=require(_0xb737('0x10'));var deskjs=require(_0xb737('0x11'));var toCsv=require(_0xb737('0xa'));var querystring=require(_0xb737('0x12'));var Papa=require(_0xb737('0x13'));var Redis=require(_0xb737('0x14'));var authService=require(_0xb737('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb737('0x16'));var logger=require(_0xb737('0x17'))('api');var utils=require(_0xb737('0x18'));var config=require(_0xb737('0x19'));var licenseUtil=require(_0xb737('0x1a'));var db=require(_0xb737('0x1b'))['db'];function respondWithStatusCode(_0x11be59,_0x22fdf2){_0x22fdf2=_0x22fdf2||0xcc;return function(_0x4069f6){if(_0x4069f6){return _0x11be59[_0xb737('0x1c')](_0x22fdf2);}return _0x11be59[_0xb737('0x1d')](_0x22fdf2)[_0xb737('0x1e')]();};}function respondWithResult(_0x4829b8,_0x4ea686){_0x4ea686=_0x4ea686||0xc8;return function(_0x26554c){if(_0x26554c){return _0x4829b8[_0xb737('0x1d')](_0x4ea686)[_0xb737('0x1f')](_0x26554c);}};}function respondWithFilteredResult(_0x4b06ca,_0x1610c6){return function(_0x52ab4a){if(_0x52ab4a){var _0x22a60b=typeof _0x1610c6[_0xb737('0x20')]===_0xb737('0x21')&&typeof _0x1610c6[_0xb737('0x22')]===_0xb737('0x21');var _0x4e66f4=_0x52ab4a[_0xb737('0x23')];var _0x54d452=_0x22a60b?0x0:_0x1610c6[_0xb737('0x20')];var _0x569e39=_0x22a60b?_0x52ab4a[_0xb737('0x23')]:_0x1610c6[_0xb737('0x20')]+_0x1610c6[_0xb737('0x22')];var _0x186de9;if(_0x569e39>=_0x4e66f4){_0x569e39=_0x4e66f4;_0x186de9=0xc8;}else{_0x186de9=0xce;}_0x4b06ca[_0xb737('0x1d')](_0x186de9);return _0x4b06ca['set'](_0xb737('0x24'),_0x54d452+'-'+_0x569e39+'/'+_0x4e66f4)[_0xb737('0x1f')](_0x52ab4a);}return null;};}function patchUpdates(_0x457bdd){return function(_0x292ed0){try{jsonpatch[_0xb737('0x25')](_0x292ed0,_0x457bdd,!![]);}catch(_0x50aeaa){return BPromise[_0xb737('0x26')](_0x50aeaa);}return _0x292ed0[_0xb737('0x27')]();};}function saveUpdates(_0x454c06,_0xf5775){return function(_0x506433){if(_0x506433){return _0x506433['update'](_0x454c06)[_0xb737('0x28')](function(_0x25d070){return _0x25d070;});}return null;};}function removeEntity(_0x7c1746,_0x45d186){return function(_0x4778d6){if(_0x4778d6){return _0x4778d6['destroy']()['then'](function(){_0x7c1746[_0xb737('0x1d')](0xcc)[_0xb737('0x1e')]();});}};}function handleEntityNotFound(_0xa1f040,_0x145e29){return function(_0x13f9a2){if(!_0x13f9a2){_0xa1f040[_0xb737('0x1c')](0x194);}return _0x13f9a2;};}function handleError(_0x16adc6,_0x3d7f9b){_0x3d7f9b=_0x3d7f9b||0x1f4;return function(_0x104f68){logger[_0xb737('0x29')](_0x104f68['stack']);if(_0x104f68['name']){delete _0x104f68['name'];}_0x16adc6[_0xb737('0x1d')](_0x3d7f9b)[_0xb737('0x2a')](_0x104f68);};}exports[_0xb737('0x2b')]=function(_0x5f0592,_0x17e0c8){var _0x2efee5={},_0x13a4bf={},_0x214d90={'count':0x0,'rows':[]};var _0x40ecdd=_[_0xb737('0x2c')](db[_0xb737('0x2d')]['rawAttributes'],function(_0x57a101){return{'name':_0x57a101[_0xb737('0x2e')],'type':_0x57a101[_0xb737('0x2f')]['key']};});_0x13a4bf[_0xb737('0x30')]=_[_0xb737('0x2c')](_0x40ecdd,_0xb737('0x31'));_0x13a4bf[_0xb737('0x32')]=_[_0xb737('0x33')](_0x5f0592[_0xb737('0x32')]);_0x13a4bf['filters']=_['intersection'](_0x13a4bf[_0xb737('0x30')],_0x13a4bf['query']);_0x2efee5[_0xb737('0x34')]=_[_0xb737('0x35')](_0x13a4bf[_0xb737('0x30')],qs[_0xb737('0x36')](_0x5f0592[_0xb737('0x32')][_0xb737('0x36')]));_0x2efee5[_0xb737('0x34')]=_0x2efee5[_0xb737('0x34')][_0xb737('0x37')]?_0x2efee5[_0xb737('0x34')]:_0x13a4bf[_0xb737('0x30')];if(!_0x5f0592[_0xb737('0x32')][_0xb737('0x38')](_0xb737('0x39'))){_0x2efee5[_0xb737('0x22')]=qs[_0xb737('0x22')](_0x5f0592[_0xb737('0x32')][_0xb737('0x22')]);_0x2efee5['offset']=qs[_0xb737('0x20')](_0x5f0592[_0xb737('0x32')][_0xb737('0x20')]);}_0x2efee5[_0xb737('0x3a')]=qs['sort'](_0x5f0592[_0xb737('0x32')][_0xb737('0x3b')]);_0x2efee5[_0xb737('0x3c')]=qs[_0xb737('0x3d')](_['pick'](_0x5f0592[_0xb737('0x32')],_0x13a4bf[_0xb737('0x3d')]),_0x40ecdd);if(_0x5f0592[_0xb737('0x32')][_0xb737('0x3e')]){_0x2efee5['where']=_[_0xb737('0x3f')](_0x2efee5['where'],{'$or':_[_0xb737('0x2c')](_0x40ecdd,function(_0x2f5e30){if(_0x2f5e30[_0xb737('0x2f')]!==_0xb737('0x40')){var _0x954b60={};_0x954b60[_0x2f5e30['name']]={'$like':'%'+_0x5f0592[_0xb737('0x32')]['filter']+'%'};return _0x954b60;}})});}_0x2efee5=_[_0xb737('0x3f')]({},_0x2efee5,_0x5f0592['options']);var _0x5a0ae5={'where':_0x2efee5[_0xb737('0x3c')]};return db[_0xb737('0x2d')][_0xb737('0x23')](_0x5a0ae5)['then'](function(_0x1afba1){_0x214d90['count']=_0x1afba1;if(_0x5f0592[_0xb737('0x32')][_0xb737('0x41')]){_0x2efee5['include']=[{'all':!![]}];}return db[_0xb737('0x2d')]['findAll'](_0x2efee5);})[_0xb737('0x28')](function(_0x2ac3da){_0x214d90[_0xb737('0x42')]=_0x2ac3da;return _0x214d90;})[_0xb737('0x28')](respondWithFilteredResult(_0x17e0c8,_0x2efee5))['catch'](handleError(_0x17e0c8,null));};exports[_0xb737('0x43')]=function(_0x5b82b7,_0x16c1f1){var _0x325273={'raw':!![],'where':{'id':_0x5b82b7[_0xb737('0x44')]['id']}},_0x5c88ba={};_0x5c88ba[_0xb737('0x30')]=_[_0xb737('0x33')](db[_0xb737('0x2d')][_0xb737('0x45')]);_0x5c88ba[_0xb737('0x32')]=_[_0xb737('0x33')](_0x5b82b7['query']);_0x5c88ba['filters']=_['intersection'](_0x5c88ba[_0xb737('0x30')],_0x5c88ba[_0xb737('0x32')]);_0x325273[_0xb737('0x34')]=_[_0xb737('0x35')](_0x5c88ba[_0xb737('0x30')],qs['fields'](_0x5b82b7[_0xb737('0x32')][_0xb737('0x36')]));_0x325273[_0xb737('0x34')]=_0x325273[_0xb737('0x34')][_0xb737('0x37')]?_0x325273['attributes']:_0x5c88ba[_0xb737('0x30')];if(_0x5b82b7['query'][_0xb737('0x41')]){_0x325273[_0xb737('0x46')]=[{'all':!![]}];}_0x325273=_[_0xb737('0x3f')]({},_0x325273,_0x5b82b7[_0xb737('0x47')]);return db[_0xb737('0x2d')][_0xb737('0x48')](_0x325273)['then'](handleEntityNotFound(_0x16c1f1,null))[_0xb737('0x28')](respondWithResult(_0x16c1f1,null))[_0xb737('0x49')](handleError(_0x16c1f1,null));};exports[_0xb737('0x4a')]=function(_0x4a2676,_0x45ffff){return db[_0xb737('0x2d')][_0xb737('0x4a')](_0x4a2676[_0xb737('0x4b')],{})[_0xb737('0x28')](respondWithResult(_0x45ffff,0xc9))[_0xb737('0x49')](handleError(_0x45ffff,null));};exports[_0xb737('0x4c')]=function(_0x46e0b8,_0x2aff74){if(_0x46e0b8[_0xb737('0x4b')]['id']){delete _0x46e0b8[_0xb737('0x4b')]['id'];}return db[_0xb737('0x2d')][_0xb737('0x48')]({'where':{'id':_0x46e0b8[_0xb737('0x44')]['id']}})['then'](handleEntityNotFound(_0x2aff74,null))['then'](saveUpdates(_0x46e0b8[_0xb737('0x4b')],null))['then'](respondWithResult(_0x2aff74,null))[_0xb737('0x49')](handleError(_0x2aff74,null));};exports[_0xb737('0x4d')]=function(_0x13e4ea,_0x1663c5){return db[_0xb737('0x2d')][_0xb737('0x48')]({'where':{'id':_0x13e4ea['params']['id']}})[_0xb737('0x28')](handleEntityNotFound(_0x1663c5,null))[_0xb737('0x28')](removeEntity(_0x1663c5,null))[_0xb737('0x49')](handleError(_0x1663c5,null));};exports['describe']=function(_0x16a9d7,_0x4153a5){return db['ChatTransferReport'][_0xb737('0x4e')]()[_0xb737('0x28')](respondWithResult(_0x4153a5,null))[_0xb737('0x49')](handleError(_0x4153a5,null));}; \ No newline at end of file +var _0x1928=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','name','send','index','map','ChatTransferReport','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','rawAttributes','create','body','params','destroy','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x173c0d,_0x14c2cb){var _0x7714ce=function(_0x3e89f8){while(--_0x3e89f8){_0x173c0d['push'](_0x173c0d['shift']());}};_0x7714ce(++_0x14c2cb);}(_0x1928,0x117));var _0x8192=function(_0x3f6dc2,_0x2c8a01){_0x3f6dc2=_0x3f6dc2-0x0;var _0x81307=_0x1928[_0x3f6dc2];return _0x81307;};'use strict';var emlformat=require(_0x8192('0x0'));var rimraf=require(_0x8192('0x1'));var zipdir=require(_0x8192('0x2'));var jsonpatch=require(_0x8192('0x3'));var rp=require(_0x8192('0x4'));var moment=require('moment');var BPromise=require(_0x8192('0x5'));var Mustache=require(_0x8192('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8192('0x7'));var ejs=require(_0x8192('0x8'));var fs=require('fs');var fs_extra=require(_0x8192('0x9'));var _=require(_0x8192('0xa'));var squel=require(_0x8192('0xb'));var crypto=require(_0x8192('0xc'));var jsforce=require(_0x8192('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8192('0x7'));var querystring=require(_0x8192('0xe'));var Papa=require(_0x8192('0xf'));var Redis=require('ioredis');var authService=require(_0x8192('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8192('0x11'));var hardwareService=require(_0x8192('0x12'));var logger=require(_0x8192('0x13'))(_0x8192('0x14'));var utils=require(_0x8192('0x15'));var config=require(_0x8192('0x16'));var licenseUtil=require(_0x8192('0x17'));var db=require(_0x8192('0x18'))['db'];function respondWithStatusCode(_0x8b56a6,_0x2d77c7){_0x2d77c7=_0x2d77c7||0xcc;return function(_0x21074e){if(_0x21074e){return _0x8b56a6[_0x8192('0x19')](_0x2d77c7);}return _0x8b56a6[_0x8192('0x1a')](_0x2d77c7)[_0x8192('0x1b')]();};}function respondWithResult(_0x4438ee,_0x1eb412){_0x1eb412=_0x1eb412||0xc8;return function(_0x42679f){if(_0x42679f){return _0x4438ee[_0x8192('0x1a')](_0x1eb412)['json'](_0x42679f);}};}function respondWithFilteredResult(_0x5b719,_0x236042){return function(_0x120508){if(_0x120508){var _0x603416=typeof _0x236042[_0x8192('0x1c')]===_0x8192('0x1d')&&typeof _0x236042[_0x8192('0x1e')]===_0x8192('0x1d');var _0x39ddab=_0x120508[_0x8192('0x1f')];var _0x3fbc3e=_0x603416?0x0:_0x236042[_0x8192('0x1c')];var _0x206351=_0x603416?_0x120508[_0x8192('0x1f')]:_0x236042[_0x8192('0x1c')]+_0x236042[_0x8192('0x1e')];var _0x5023f0;if(_0x206351>=_0x39ddab){_0x206351=_0x39ddab;_0x5023f0=0xc8;}else{_0x5023f0=0xce;}_0x5b719[_0x8192('0x1a')](_0x5023f0);return _0x5b719[_0x8192('0x20')](_0x8192('0x21'),_0x3fbc3e+'-'+_0x206351+'/'+_0x39ddab)[_0x8192('0x22')](_0x120508);}return null;};}function patchUpdates(_0x419d37){return function(_0x5ba292){try{jsonpatch['apply'](_0x5ba292,_0x419d37,!![]);}catch(_0x3a04d6){return BPromise[_0x8192('0x23')](_0x3a04d6);}return _0x5ba292[_0x8192('0x24')]();};}function saveUpdates(_0x288526,_0x1b1ddf){return function(_0x20e71b){if(_0x20e71b){return _0x20e71b[_0x8192('0x25')](_0x288526)[_0x8192('0x26')](function(_0x4e8236){return _0x4e8236;});}return null;};}function removeEntity(_0x46399d,_0x4b6516){return function(_0xf2557d){if(_0xf2557d){return _0xf2557d['destroy']()[_0x8192('0x26')](function(){_0x46399d[_0x8192('0x1a')](0xcc)[_0x8192('0x1b')]();});}};}function handleEntityNotFound(_0x125df7,_0x3f5143){return function(_0xb0a9ec){if(!_0xb0a9ec){_0x125df7[_0x8192('0x19')](0x194);}return _0xb0a9ec;};}function handleError(_0x1c038b,_0x3ee1af){_0x3ee1af=_0x3ee1af||0x1f4;return function(_0x2a3050){logger[_0x8192('0x27')](_0x2a3050['stack']);if(_0x2a3050[_0x8192('0x28')]){delete _0x2a3050[_0x8192('0x28')];}_0x1c038b[_0x8192('0x1a')](_0x3ee1af)[_0x8192('0x29')](_0x2a3050);};}exports[_0x8192('0x2a')]=function(_0x397a64,_0x151f4e){var _0x42a127={},_0x360859={},_0x363c24={'count':0x0,'rows':[]};var _0x251a4c=_[_0x8192('0x2b')](db[_0x8192('0x2c')]['rawAttributes'],function(_0x386e17){return{'name':_0x386e17['fieldName'],'type':_0x386e17[_0x8192('0x2d')][_0x8192('0x2e')]};});_0x360859[_0x8192('0x2f')]=_[_0x8192('0x2b')](_0x251a4c,_0x8192('0x28'));_0x360859[_0x8192('0x30')]=_[_0x8192('0x31')](_0x397a64[_0x8192('0x30')]);_0x360859[_0x8192('0x32')]=_[_0x8192('0x33')](_0x360859['model'],_0x360859[_0x8192('0x30')]);_0x42a127[_0x8192('0x34')]=_[_0x8192('0x33')](_0x360859[_0x8192('0x2f')],qs[_0x8192('0x35')](_0x397a64[_0x8192('0x30')]['fields']));_0x42a127[_0x8192('0x34')]=_0x42a127[_0x8192('0x34')][_0x8192('0x36')]?_0x42a127[_0x8192('0x34')]:_0x360859[_0x8192('0x2f')];if(!_0x397a64['query'][_0x8192('0x37')](_0x8192('0x38'))){_0x42a127[_0x8192('0x1e')]=qs['limit'](_0x397a64[_0x8192('0x30')][_0x8192('0x1e')]);_0x42a127[_0x8192('0x1c')]=qs[_0x8192('0x1c')](_0x397a64[_0x8192('0x30')]['offset']);}_0x42a127[_0x8192('0x39')]=qs[_0x8192('0x3a')](_0x397a64[_0x8192('0x30')]['sort']);_0x42a127[_0x8192('0x3b')]=qs[_0x8192('0x32')](_[_0x8192('0x3c')](_0x397a64['query'],_0x360859[_0x8192('0x32')]),_0x251a4c);if(_0x397a64[_0x8192('0x30')]['filter']){_0x42a127[_0x8192('0x3b')]=_['merge'](_0x42a127[_0x8192('0x3b')],{'$or':_[_0x8192('0x2b')](_0x251a4c,function(_0x6328b){if(_0x6328b['type']!==_0x8192('0x3d')){var _0x50b825={};_0x50b825[_0x6328b[_0x8192('0x28')]]={'$like':'%'+_0x397a64[_0x8192('0x30')][_0x8192('0x3e')]+'%'};return _0x50b825;}})});}_0x42a127=_[_0x8192('0x3f')]({},_0x42a127,_0x397a64[_0x8192('0x40')]);var _0x413eab={'where':_0x42a127['where']};return db['ChatTransferReport']['count'](_0x413eab)['then'](function(_0x2b5769){_0x363c24[_0x8192('0x1f')]=_0x2b5769;if(_0x397a64[_0x8192('0x30')]['includeAll']){_0x42a127[_0x8192('0x41')]=[{'all':!![]}];}return db[_0x8192('0x2c')][_0x8192('0x42')](_0x42a127);})[_0x8192('0x26')](function(_0x320fbf){_0x363c24['rows']=_0x320fbf;return _0x363c24;})[_0x8192('0x26')](respondWithFilteredResult(_0x151f4e,_0x42a127))[_0x8192('0x43')](handleError(_0x151f4e,null));};exports['show']=function(_0x56541d,_0x5c6c68){var _0x33d2ee={'raw':!![],'where':{'id':_0x56541d['params']['id']}},_0x3e128d={};_0x3e128d[_0x8192('0x2f')]=_[_0x8192('0x31')](db['ChatTransferReport'][_0x8192('0x44')]);_0x3e128d[_0x8192('0x30')]=_[_0x8192('0x31')](_0x56541d[_0x8192('0x30')]);_0x3e128d[_0x8192('0x32')]=_[_0x8192('0x33')](_0x3e128d[_0x8192('0x2f')],_0x3e128d[_0x8192('0x30')]);_0x33d2ee['attributes']=_[_0x8192('0x33')](_0x3e128d[_0x8192('0x2f')],qs[_0x8192('0x35')](_0x56541d[_0x8192('0x30')]['fields']));_0x33d2ee[_0x8192('0x34')]=_0x33d2ee[_0x8192('0x34')]['length']?_0x33d2ee[_0x8192('0x34')]:_0x3e128d['model'];if(_0x56541d[_0x8192('0x30')]['includeAll']){_0x33d2ee[_0x8192('0x41')]=[{'all':!![]}];}_0x33d2ee=_[_0x8192('0x3f')]({},_0x33d2ee,_0x56541d[_0x8192('0x40')]);return db[_0x8192('0x2c')]['find'](_0x33d2ee)[_0x8192('0x26')](handleEntityNotFound(_0x5c6c68,null))[_0x8192('0x26')](respondWithResult(_0x5c6c68,null))['catch'](handleError(_0x5c6c68,null));};exports[_0x8192('0x45')]=function(_0x3b1e84,_0x14df30){return db[_0x8192('0x2c')][_0x8192('0x45')](_0x3b1e84[_0x8192('0x46')],{})[_0x8192('0x26')](respondWithResult(_0x14df30,0xc9))[_0x8192('0x43')](handleError(_0x14df30,null));};exports[_0x8192('0x25')]=function(_0x271344,_0xfa94fe){if(_0x271344['body']['id']){delete _0x271344[_0x8192('0x46')]['id'];}return db[_0x8192('0x2c')]['find']({'where':{'id':_0x271344[_0x8192('0x47')]['id']}})[_0x8192('0x26')](handleEntityNotFound(_0xfa94fe,null))[_0x8192('0x26')](saveUpdates(_0x271344['body'],null))[_0x8192('0x26')](respondWithResult(_0xfa94fe,null))[_0x8192('0x43')](handleError(_0xfa94fe,null));};exports[_0x8192('0x48')]=function(_0x2e195f,_0x133bf4){return db['ChatTransferReport'][_0x8192('0x49')]({'where':{'id':_0x2e195f[_0x8192('0x47')]['id']}})[_0x8192('0x26')](handleEntityNotFound(_0x133bf4,null))['then'](removeEntity(_0x133bf4,null))['catch'](handleError(_0x133bf4,null));};exports[_0x8192('0x4a')]=function(_0x5d02c8,_0x50a7e5){return db[_0x8192('0x2c')]['describe']()[_0x8192('0x26')](respondWithResult(_0x50a7e5,null))[_0x8192('0x43')](handleError(_0x50a7e5,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 260c31c..ee5d64c 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 _0x28c0=['exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes'];(function(_0x329166,_0x25aefb){var _0x26591b=function(_0x43ae69){while(--_0x43ae69){_0x329166['push'](_0x329166['shift']());}};_0x26591b(++_0x25aefb);}(_0x28c0,0x93));var _0x028c=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x28c0[_0x29d94e];return _0x106237;};'use strict';var _=require(_0x028c('0x0'));var util=require(_0x028c('0x1'));var logger=require(_0x028c('0x2'))(_0x028c('0x3'));var moment=require(_0x028c('0x4'));var BPromise=require('bluebird');var rp=require(_0x028c('0x5'));var fs=require('fs');var path=require(_0x028c('0x6'));var rimraf=require('rimraf');var config=require(_0x028c('0x7'));var attributes=require(_0x028c('0x8'));module[_0x028c('0x9')]=function(_0x52101d,_0x37ea72){return _0x52101d[_0x028c('0xa')]('ChatTransferReport',attributes,{'tableName':_0x028c('0xb'),'paranoid':![],'indexes':[{'name':_0x028c('0xc'),'fields':[_0x028c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa408=['api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','../../config/logger'];(function(_0x534c61,_0x2e7fae){var _0x51cf56=function(_0x34e45e){while(--_0x34e45e){_0x534c61['push'](_0x534c61['shift']());}};_0x51cf56(++_0x2e7fae);}(_0xa408,0x166));var _0x8a40=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0xa408[_0x31b9cf];return _0x357b8a;};'use strict';var _=require(_0x8a40('0x0'));var util=require('util');var logger=require(_0x8a40('0x1'))(_0x8a40('0x2'));var moment=require(_0x8a40('0x3'));var BPromise=require(_0x8a40('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a40('0x5'));var rimraf=require('rimraf');var config=require(_0x8a40('0x6'));var attributes=require(_0x8a40('0x7'));module[_0x8a40('0x8')]=function(_0x2d1fca,_0xcbf868){return _0x2d1fca[_0x8a40('0x9')]('ChatTransferReport',attributes,{'tableName':_0x8a40('0xa'),'paranoid':![],'indexes':[{'name':_0x8a40('0xb'),'fields':[_0x8a40('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 45c05e1..7746668 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 _0x90e6=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','ChatTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring'];(function(_0x4f39fd,_0x36d85f){var _0x4ef809=function(_0x52ef4c){while(--_0x52ef4c){_0x4f39fd['push'](_0x4f39fd['shift']());}};_0x4ef809(++_0x36d85f);}(_0x90e6,0xe3));var _0x690e=function(_0x5400a1,_0x2275aa){_0x5400a1=_0x5400a1-0x0;var _0x4006c7=_0x90e6[_0x5400a1];return _0x4006c7;};'use strict';var _=require(_0x690e('0x0'));var util=require(_0x690e('0x1'));var moment=require(_0x690e('0x2'));var BPromise=require('bluebird');var rs=require(_0x690e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x690e('0x4'))['db'];var utils=require(_0x690e('0x5'));var logger=require(_0x690e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x690e('0x7'));var client=jayson[_0x690e('0x8')][_0x690e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe4356f,_0x219e87,_0x5d8a15){return new BPromise(function(_0x3e2cf7,_0x2ed153){return client[_0x690e('0xa')](_0xe4356f,_0x5d8a15)[_0x690e('0xb')](function(_0x30dae6){logger[_0x690e('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x219e87,_0x690e('0xd'));logger['debug'](_0x690e('0xe'),_0x219e87,_0x690e('0xd'),JSON['stringify'](_0x30dae6));if(_0x30dae6['error']){if(_0x30dae6[_0x690e('0xf')][_0x690e('0x10')]===0x1f4){logger[_0x690e('0xf')](_0x690e('0x11'),_0x219e87,_0x30dae6[_0x690e('0xf')][_0x690e('0x12')]);return _0x2ed153(_0x30dae6['error']['message']);}logger[_0x690e('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x219e87,_0x30dae6[_0x690e('0xf')]['message']);return _0x3e2cf7(_0x30dae6['error'][_0x690e('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x219e87,_0x690e('0xd'));_0x3e2cf7(_0x30dae6[_0x690e('0x13')][_0x690e('0x12')]);}})[_0x690e('0x14')](function(_0x62c1b7){logger[_0x690e('0xf')](_0x690e('0x11'),_0x219e87,_0x62c1b7);_0x2ed153(_0x62c1b7);});});} \ No newline at end of file +var _0xbfc9=['error','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4f5670,_0x3ef7e4){var _0x5a7277=function(_0x1de56f){while(--_0x1de56f){_0x4f5670['push'](_0x4f5670['shift']());}};_0x5a7277(++_0x3ef7e4);}(_0xbfc9,0x8e));var _0x9bfc=function(_0xeb7b15,_0x3faeb1){_0xeb7b15=_0xeb7b15-0x0;var _0x2107ee=_0xbfc9[_0xeb7b15];return _0x2107ee;};'use strict';var _=require(_0x9bfc('0x0'));var util=require('util');var moment=require(_0x9bfc('0x1'));var BPromise=require(_0x9bfc('0x2'));var rs=require(_0x9bfc('0x3'));var fs=require('fs');var Redis=require(_0x9bfc('0x4'));var db=require(_0x9bfc('0x5'))['db'];var utils=require(_0x9bfc('0x6'));var logger=require(_0x9bfc('0x7'))(_0x9bfc('0x8'));var config=require('../../config/environment');var jayson=require(_0x9bfc('0x9'));var client=jayson[_0x9bfc('0xa')][_0x9bfc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58295e,_0x1c4690,_0x26247b){return new BPromise(function(_0x4572da,_0x365314){return client[_0x9bfc('0xc')](_0x58295e,_0x26247b)[_0x9bfc('0xd')](function(_0x5743e7){logger['info'](_0x9bfc('0xe'),_0x1c4690,_0x9bfc('0xf'));logger[_0x9bfc('0x10')](_0x9bfc('0x11'),_0x1c4690,_0x9bfc('0xf'),JSON[_0x9bfc('0x12')](_0x5743e7));if(_0x5743e7[_0x9bfc('0x13')]){if(_0x5743e7[_0x9bfc('0x13')]['code']===0x1f4){logger[_0x9bfc('0x13')](_0x9bfc('0xe'),_0x1c4690,_0x5743e7[_0x9bfc('0x13')][_0x9bfc('0x14')]);return _0x365314(_0x5743e7['error'][_0x9bfc('0x14')]);}logger[_0x9bfc('0x13')](_0x9bfc('0xe'),_0x1c4690,_0x5743e7[_0x9bfc('0x13')]['message']);return _0x4572da(_0x5743e7[_0x9bfc('0x13')]['message']);}else{logger[_0x9bfc('0x15')](_0x9bfc('0xe'),_0x1c4690,_0x9bfc('0xf'));_0x4572da(_0x5743e7['result'][_0x9bfc('0x14')]);}})[_0x9bfc('0x16')](function(_0x2e183a){logger['error'](_0x9bfc('0xe'),_0x1c4690,_0x2e183a);_0x365314(_0x2e183a);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 7ab5797..67af8af 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 _0x00c6=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x00c6,0x124));var _0x600c=function(_0x374d1e,_0x56bc57){_0x374d1e=_0x374d1e-0x0;var _0x50acbd=_0x00c6[_0x374d1e];return _0x50acbd;};'use strict';var multer=require('multer');var util=require(_0x600c('0x0'));var path=require(_0x600c('0x1'));var timeout=require(_0x600c('0x2'));var express=require('express');var router=express[_0x600c('0x3')]();var fs_extra=require(_0x600c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x600c('0x5'));var config=require(_0x600c('0x6'));var controller=require(_0x600c('0x7'));router[_0x600c('0x8')]('/',auth['isAuthenticated'](),controller[_0x600c('0x9')]);router[_0x600c('0x8')](_0x600c('0xa'),auth[_0x600c('0xb')](),controller[_0x600c('0xc')]);router[_0x600c('0x8')](_0x600c('0xd'),auth[_0x600c('0xb')](),controller[_0x600c('0xe')]);router[_0x600c('0xf')]('/',auth[_0x600c('0xb')](),controller[_0x600c('0x10')]);router[_0x600c('0x11')](_0x600c('0xd'),auth[_0x600c('0xb')](),controller['update']);router['delete'](_0x600c('0xd'),auth[_0x600c('0xb')](),controller[_0x600c('0x12')]);module[_0x600c('0x13')]=router; \ No newline at end of file +var _0xacdd=['post','create','put','update','delete','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0xf0f04,_0x3dfb0d){var _0x4bd136=function(_0x2d3fbb){while(--_0x2d3fbb){_0xf0f04['push'](_0xf0f04['shift']());}};_0x4bd136(++_0x3dfb0d);}(_0xacdd,0x109));var _0xdacd=function(_0x65a0db,_0x55c5a0){_0x65a0db=_0x65a0db-0x0;var _0x987620=_0xacdd[_0x65a0db];return _0x987620;};'use strict';var multer=require('multer');var util=require(_0xdacd('0x0'));var path=require(_0xdacd('0x1'));var timeout=require(_0xdacd('0x2'));var express=require('express');var router=express[_0xdacd('0x3')]();var fs_extra=require(_0xdacd('0x4'));var auth=require(_0xdacd('0x5'));var interaction=require(_0xdacd('0x6'));var config=require(_0xdacd('0x7'));var controller=require(_0xdacd('0x8'));router[_0xdacd('0x9')]('/',auth[_0xdacd('0xa')](),controller['index']);router['get'](_0xdacd('0xb'),auth['isAuthenticated'](),controller[_0xdacd('0xc')]);router[_0xdacd('0x9')](_0xdacd('0xd'),auth['isAuthenticated'](),controller[_0xdacd('0xe')]);router[_0xdacd('0xf')]('/',auth[_0xdacd('0xa')](),controller[_0xdacd('0x10')]);router[_0xdacd('0x11')](_0xdacd('0xd'),auth[_0xdacd('0xa')](),controller[_0xdacd('0x12')]);router[_0xdacd('0x13')](_0xdacd('0xd'),auth[_0xdacd('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index a0929c7..86dbed3 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 _0x87bd=['Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','textarea','Comments','offlineForm','setDataValue','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','website_alias','bottom_right','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error'];(function(_0x21aec2,_0x7a2d11){var _0x32dc9e=function(_0x573b2d){while(--_0x573b2d){_0x21aec2['push'](_0x21aec2['shift']());}};_0x32dc9e(++_0x7a2d11);}(_0x87bd,0x1a2));var _0xd87b=function(_0xfa4453,_0x4e18a2){_0xfa4453=_0xfa4453-0x0;var _0x2a1704=_0x87bd[_0xfa4453];return _0x2a1704;};'use strict';var Sequelize=require(_0xd87b('0x0'));var rs=require(_0xd87b('0x1'));module[_0xd87b('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![],'unique':_0xd87b('0x4')},'description':{'type':Sequelize[_0xd87b('0x3')]},'mapKey':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd87b('0x5')},'key':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![],'defaultValue':_0xd87b('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd87b('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd87b('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd87b('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xd87b('0x3')]},'animation':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xd87b('0xa')](_0xd87b('0xb'),_0xd87b('0xc')),'defaultValue':_0xd87b('0xb')},'header_online':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0xd')},'start_chat_button':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0xe')},'offline_chat_button':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0xf')},'header_offline':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x10')},'download_transcript':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xd87b('0x12')]},'closingQuestion':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x13')},'formSubmitSuccessMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x14')},'formSubmitFailureMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x15')},'noteTitle':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x16')},'placeholderMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x17')},'closingMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x18')},'closingMessageButton':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd87b('0x19')},'conditionAgreement':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x1a')},'ratingType':{'type':Sequelize[_0xd87b('0xa')](_0xd87b('0x1b'),_0xd87b('0x1c')),'defaultValue':_0xd87b('0x1b')},'ratingStarsNumber':{'type':Sequelize[_0xd87b('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd87b('0x12')],'defaultValue':function(){return JSON[_0xd87b('0x1d')]({'items':[{'type':_0xd87b('0x1e'),'variable':null,'config':{'placeholder':_0xd87b('0x1f'),'type':_0xd87b('0x20'),'required':!![]},'props':{'title':_0xd87b('0x1f'),'helpText':''}},{'type':_0xd87b('0x1e'),'props':{'title':_0xd87b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd87b('0x5'),'type':_0xd87b('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd87b('0x21')](_0xd87b('0x22'))?JSON[_0xd87b('0x23')](this['getDataValue'](_0xd87b('0x22'))):{};},'set':function(_0x5bb8e6){return this['setDataValue']('onlineForm',JSON['stringify'](_0x5bb8e6));}},'offlineForm':{'type':Sequelize[_0xd87b('0x12')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xd87b('0x1e'),'props':{'title':_0xd87b('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xd87b('0x5'),'type':'email'},'variable':null},{'type':_0xd87b('0x24'),'config':{'placeholder':'Comments'},'props':{'title':_0xd87b('0x25'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0xd87b('0x23')](this['getDataValue'](_0xd87b('0x26'))):{};},'set':function(_0x1af8aa){return this[_0xd87b('0x27')](_0xd87b('0x26'),JSON[_0xd87b('0x1d')](_0x1af8aa));}},'token':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':function(){return rs[_0xd87b('0x28')]();}},'autoclose':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd87b('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xd87b('0x3')]},'waitingTitle':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x29')},'waitingMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2a')},'offlineMessageSubject':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2b')},'offlineMessageBody':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2c')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2d')},'skipUnmanaged':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd87b('0x3')]},'notificationTemplate':{'type':Sequelize[_0xd87b('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2e')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x2f')},'verticalAlignment':{'type':Sequelize[_0xd87b('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xd87b('0x3')]},'customerAvatar':{'type':Sequelize[_0xd87b('0x12')]},'showCustomerAvatar':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xd87b('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd87b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd87b('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xd87b('0x3')],'defaultValue':_0xd87b('0x30')},'systemAvatar':{'type':Sequelize[_0xd87b('0x12')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd87b('0x8')],'comment':_0xd87b('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![],'comment':_0xd87b('0x32'),'set':function(_0x27c662){if(!_0x27c662)this['setDataValue'](_0xd87b('0x33'),null);this[_0xd87b('0x27')](_0xd87b('0x34'),_0x27c662);}},'vidaooEscalation':{'type':Sequelize[_0xd87b('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd87b('0x3')]},'vidaooTopic':{'type':Sequelize[_0xd87b('0x3')],'allowNull':![],'defaultValue':_0xd87b('0x35')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xd87b('0x36');}},'vidaooMetadata':{'type':Sequelize[_0xd87b('0x12')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf687=['name','getDataValue','onlineForm','parse','Comments','offlineForm','setDataValue','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Feedback','star','stringify','input','text'];(function(_0x465643,_0x44dc4e){var _0x38ab86=function(_0x2d5496){while(--_0x2d5496){_0x465643['push'](_0x465643['shift']());}};_0x38ab86(++_0x44dc4e);}(_0xf687,0x13f));var _0x7f68=function(_0x5e7f1f,_0x74fce9){_0x5e7f1f=_0x5e7f1f-0x0;var _0x205a70=_0xf687[_0x5e7f1f];return _0x205a70;};'use strict';var Sequelize=require(_0x7f68('0x0'));var rs=require('randomstring');module[_0x7f68('0x1')]={'name':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0x7f68('0x2')]},'mapKey':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x3')},'mapKeyOffline':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x3')},'key':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x4')},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7f68('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7f68('0x2')]},'animation':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7f68('0x9')](_0x7f68('0xa'),'squared'),'defaultValue':_0x7f68('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0xb')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0xc')},'offline_chat_button':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0xd')},'header_offline':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x7f68('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7f68('0xf')]},'closingQuestion':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0x11')},'placeholderMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x12')},'closingMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x13')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0x14')},'ratingType':{'type':Sequelize[_0x7f68('0x9')](_0x7f68('0x15'),'thumb'),'defaultValue':_0x7f68('0x15')},'ratingStarsNumber':{'type':Sequelize[_0x7f68('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7f68('0x16')]({'items':[{'type':_0x7f68('0x17'),'variable':null,'config':{'placeholder':'name','type':_0x7f68('0x18'),'required':!![]},'props':{'title':_0x7f68('0x19'),'helpText':''}},{'type':'input','props':{'title':_0x7f68('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x7f68('0x3'),'type':_0x7f68('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x7f68('0x1a')](_0x7f68('0x1b'))?JSON[_0x7f68('0x1c')](this[_0x7f68('0x1a')](_0x7f68('0x1b'))):{};},'set':function(_0x25fd19){return this['setDataValue'](_0x7f68('0x1b'),JSON[_0x7f68('0x16')](_0x25fd19));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7f68('0x16')]({'items':[{'type':_0x7f68('0x17'),'props':{'title':_0x7f68('0x3'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x7f68('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x7f68('0x1d')},'props':{'title':_0x7f68('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7f68('0x1a')](_0x7f68('0x1e'))?JSON['parse'](this[_0x7f68('0x1a')]('offlineForm')):{};},'set':function(_0x4034d9){return this[_0x7f68('0x1f')](_0x7f68('0x1e'),JSON[_0x7f68('0x16')](_0x4034d9));}},'token':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7f68('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0x20')},'enableUnmanagedNote':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x21')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0x22')},'sendUnmanaged':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0xd')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x7f68('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x7f68('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7f68('0xf')],'defaultValue':function(){return _0x7f68('0x23');}},'notificationSound':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x7f68('0x24')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':_0x7f68('0x25')},'verticalAlignment':{'type':Sequelize[_0x7f68('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0x7f68('0x2')]},'customerAvatar':{'type':Sequelize[_0x7f68('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7f68('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x26'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7f68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f68('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7f68('0x2')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7f68('0x7')],'comment':_0x7f68('0x27')},'mandatoryDisposition':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![],'comment':_0x7f68('0x28'),'set':function(_0x24280d){if(!_0x24280d)this[_0x7f68('0x1f')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x7f68('0x29'),_0x24280d);}},'vidaooEscalation':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x7f68('0x2')]},'vidaooTopic':{'type':Sequelize[_0x7f68('0x2')],'allowNull':![],'defaultValue':_0x7f68('0x2a')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7f68('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7f68('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index e834d76..3526ac2 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 _0x1a14=['forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','mapValues','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','fullname','internal','color','tag','../../config/license/util','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','address','origin','3.5.0','remote','headers','connection','remoteAddress','replace','alignment','verticalAlignment','textColor','textButtonColor','hideWhenOffline','IntervalId','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../config/logger','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','destroy','get','UserProfileResource','stack','name','send','Command','getSnippet','iftime\x20%s,%s','interval','timezone','iftime\x20%s','true','OFFLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','map','Interval','all','some','user-agent-parser','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','x-real-port','referer','browser','format','version','unknown','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','ChatWebsite','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','filename','addAvatar','agentAvatar','file','customerAvatar','addSystemAvatar','systemAvatar','getLogo','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','join','server/files/images/logos/','server/files/images/avatars/','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','download','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','Contacts','updatedAt','DESC','ChatApplication','Applications','Intervals','spread','List','account','list','applications','orderBy','priority','asc','contact','threadId','ChatInteraction','ContactId','lastName','messageId','interaction','created','push','close','unmanaged','*,*,*,*','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','mapKeyOffline','MailAccount','findOrCreate','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','server','files','offline-chat','openNewInteraction','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','SendMail','sendMail','\x22%s\x22\x20<%s>','email'];(function(_0x377a6e,_0x59b99d){var _0x37f751=function(_0x2ed25c){while(--_0x2ed25c){_0x377a6e['push'](_0x377a6e['shift']());}};_0x37f751(++_0x59b99d);}(_0x1a14,0x170));var _0x41a1=function(_0x9b212a,_0x25f819){_0x9b212a=_0x9b212a-0x0;var _0x10fa10=_0x1a14[_0x9b212a];return _0x10fa10;};'use strict';var Mustache=require(_0x41a1('0x0'));var util=require(_0x41a1('0x1'));var path=require(_0x41a1('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x41a1('0x3'));var _=require(_0x41a1('0x4'));var querystring=require(_0x41a1('0x5'));var htmlToText=require(_0x41a1('0x6'));var Redis=require(_0x41a1('0x7'));var jayson=require(_0x41a1('0x8'));var url=require('url');var qs=require('../../components/parsers/qs');var logger=require(_0x41a1('0x9'))(_0x41a1('0xa'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0x41a1('0xb'))[_0x41a1('0xc')];var APINotFoundError=require(_0x41a1('0xb'))[_0x41a1('0xd')];var APIHandleError=require(_0x41a1('0xb'))['handleError'];var db=require(_0x41a1('0xe'))['db'];config[_0x41a1('0xf')]=_[_0x41a1('0x10')](config['redis'],{'host':_0x41a1('0x11'),'port':0x18eb});var socket=require(_0x41a1('0x12'))(new Redis(config[_0x41a1('0xf')]));require(_0x41a1('0x13'))[_0x41a1('0x14')](socket);var client=jayson[_0x41a1('0x15')]['http']({'port':0x232c});var client9002=jayson['client'][_0x41a1('0x16')]({'port':0x232a});var client9003=jayson[_0x41a1('0x15')]['http']({'port':0x232b});var client9001=jayson['client'][_0x41a1('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x372b40,_0x3afb6a,_0x41f3c1,_0x39bcfe){return new Promise(function(_0x342a9b,_0x2d0d71){var _0x1687e2=_0x39bcfe||client;return _0x1687e2[_0x41a1('0x17')](_0x372b40,_0x41f3c1)[_0x41a1('0x18')](function(_0x3d359c){logger[_0x41a1('0x19')](_0x41a1('0x1a'),_0x3afb6a,'request\x20sent');logger[_0x41a1('0x1b')](_0x41a1('0x1c'),_0x3afb6a,_0x41a1('0x1d'),JSON[_0x41a1('0x1e')](_0x3d359c));if(_0x3d359c[_0x41a1('0x1f')]){if(_0x3d359c['error'][_0x41a1('0x20')]===0x1f4){logger[_0x41a1('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x3afb6a,_0x3d359c[_0x41a1('0x1f')][_0x41a1('0x21')]);return _0x2d0d71(_0x3d359c[_0x41a1('0x1f')][_0x41a1('0x21')]);}logger[_0x41a1('0x1f')](_0x41a1('0x1a'),_0x3afb6a,_0x3d359c[_0x41a1('0x1f')][_0x41a1('0x21')]);return _0x342a9b(_0x3d359c['error'][_0x41a1('0x21')]);}else{logger[_0x41a1('0x19')](_0x41a1('0x1a'),_0x3afb6a,_0x41a1('0x1d'));_0x342a9b(_0x3d359c[_0x41a1('0x22')][_0x41a1('0x21')]);}})[_0x41a1('0x23')](function(_0xe5bb7){logger['error'](_0x41a1('0x1a'),_0x3afb6a,_0xe5bb7);_0x2d0d71(_0xe5bb7);});});}function respondWithStatusCode(_0x50daa6,_0x485d17){_0x485d17=_0x485d17||0xcc;return function(_0x451ac6){if(_0x451ac6){return _0x50daa6[_0x41a1('0x24')](_0x485d17);}return _0x50daa6[_0x41a1('0x25')](_0x485d17)[_0x41a1('0x26')]();};}function respondWithResult(_0x81a799,_0x4d54aa){_0x4d54aa=_0x4d54aa||0xc8;return function(_0x33a3ab){if(_0x33a3ab){return _0x81a799[_0x41a1('0x25')](_0x4d54aa)[_0x41a1('0x27')](_0x33a3ab);}};}function respondWithFilteredResult(_0x120d5b,_0x3011a3){return function(_0x32862a){if(_0x32862a){var _0x48f3b1=typeof _0x3011a3['offset']===_0x41a1('0x28')&&typeof _0x3011a3[_0x41a1('0x29')]===_0x41a1('0x28');var _0xfd49b2=_0x32862a['count'];var _0x2fbd28=_0x48f3b1?0x0:_0x3011a3[_0x41a1('0x2a')];var _0x22cbfb=_0x48f3b1?_0x32862a['count']:_0x3011a3[_0x41a1('0x2a')]+_0x3011a3[_0x41a1('0x29')];var _0x25e546;if(_0x22cbfb>=_0xfd49b2){_0x22cbfb=_0xfd49b2;_0x25e546=0xc8;}else{_0x25e546=0xce;}_0x120d5b[_0x41a1('0x25')](_0x25e546);return _0x120d5b[_0x41a1('0x2b')](_0x41a1('0x2c'),_0x2fbd28+'-'+_0x22cbfb+'/'+_0xfd49b2)[_0x41a1('0x27')](_0x32862a);}return null;};}function saveUpdates(_0x4ba251){return function(_0x47af21){if(_0x47af21){return _0x47af21['update'](_0x4ba251)[_0x41a1('0x18')](function(_0x499d09){return _0x499d09;});}return null;};}function removeEntity(_0x330690){return function(_0x47babe){if(_0x47babe){return _0x47babe[_0x41a1('0x2d')]()[_0x41a1('0x18')](function(){var _0x59de6b=_0x47babe[_0x41a1('0x2e')]({'plain':!![]});var _0x36b3d1='ChatWebsites';return db[_0x41a1('0x2f')]['destroy']({'where':{'type':_0x36b3d1,'resourceId':_0x59de6b['id']}})[_0x41a1('0x18')](function(){return _0x47babe;});})[_0x41a1('0x18')](function(){_0x330690[_0x41a1('0x25')](0xcc)[_0x41a1('0x26')]();});}};}function handleEntityNotFound(_0x158913){return function(_0x4ad9aa){if(!_0x4ad9aa){_0x158913[_0x41a1('0x24')](0x194);}return _0x4ad9aa;};}function handleError(_0x57db25,_0x1aca96){_0x1aca96=_0x1aca96||0x1f4;return function(_0x3f128a){logger[_0x41a1('0x1f')](_0x3f128a[_0x41a1('0x30')]);if(_0x3f128a[_0x41a1('0x31')]){delete _0x3f128a['name'];}_0x57db25['status'](_0x1aca96)[_0x41a1('0x32')](_0x3f128a);};}function iftimePromise(_0x2784a8,_0x2c9ce2){return respondWithRpcPromise(_0x41a1('0x33'),_0x41a1('0x34'),{'command':_0x2c9ce2['timezone']?util['format'](_0x41a1('0x35'),_0x2784a8[_0x41a1('0x36')],_0x2c9ce2[_0x41a1('0x37')]):util['format'](_0x41a1('0x38'),_0x2784a8[_0x41a1('0x36')])},client9002)[_0x41a1('0x18')](function(_0x5dda93){var _0xea7e3a=_0x5dda93&&_0x5dda93['indexOf'](_0x41a1('0x39'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x2c9ce2['id'],_0x2784a8['id'],_0x2784a8[_0x41a1('0x36')],_0xea7e3a?'ONLINE':_0x41a1('0x3a'),_0x2c9ce2[_0x41a1('0x37')]?_0x2c9ce2['timezone']:'No\x20timezone');return _0xea7e3a;})[_0x41a1('0x23')](function(_0x1a5736){logger[_0x41a1('0x1f')](_0x41a1('0x3b'),_0x2c9ce2['id'],_0x2784a8['id'],_0x2784a8['interval'],util[_0x41a1('0x3c')](_0x1a5736,{'showHidden':![],'depth':null}),_0x2c9ce2[_0x41a1('0x37')]?_0x2c9ce2[_0x41a1('0x37')]:_0x41a1('0x3d'));return![];});}function checkWebsiteIntervals(_0x241290){var _0x63230a=_[_0x41a1('0x3e')](_0x241290[_0x41a1('0x3f')]['Intervals'],function(_0x56954d){var _0xc12107=_0x56954d[_0x41a1('0x2e')]({'plain':!![]});return iftimePromise(_0xc12107,_0x241290);});return Promise[_0x41a1('0x40')](_0x63230a)[_0x41a1('0x18')](function(_0x3df026){return _[_0x41a1('0x41')](_0x3df026);});}function createInteractionObject(_0x18ab68,_0x1bee1a,_0x19dea9,_0x1455ac){var _0x58d06d=require(_0x41a1('0x42'));var _0x1b8e59=new _0x58d06d();var _0x4c3e8e=_0x1b8e59['setUA'](_0x19dea9['user-agent'])['getResult']();var _0x347f99=_0x1bee1a[_0x41a1('0x43')];if(_0x19dea9['cf-connecting-ip']){_0x347f99=_0x19dea9[_0x41a1('0x44')];}else if(_0x19dea9[_0x41a1('0x45')]){_0x347f99=_['first'](_0x19dea9[_0x41a1('0x45')][_0x41a1('0x46')](','));}return{'ContactId':_0x1455ac['id'],'ChatWebsiteId':_0x18ab68,'from':(_0x1455ac[_0x41a1('0x47')]||'')+'\x20'+(_0x1455ac['lastName']||''),'customerIp':_0x347f99,'customerPort':_0x19dea9[_0x41a1('0x48')]?_0x19dea9[_0x41a1('0x48')]:null,'referer':_0x1bee1a[_0x41a1('0x49')],'browserName':_0x4c3e8e[_0x41a1('0x4a')][_0x41a1('0x31')]&&_0x4c3e8e[_0x41a1('0x4a')]['version']?util[_0x41a1('0x4b')]('%s\x20%s',_0x4c3e8e[_0x41a1('0x4a')][_0x41a1('0x31')],_0x4c3e8e[_0x41a1('0x4a')][_0x41a1('0x4c')]):_0x41a1('0x4d'),'browserVersion':_0x4c3e8e['browser']['version']||'unknown','osName':util[_0x41a1('0x4b')]('%s\x20%s',_0x4c3e8e['os']['name'],_0x4c3e8e['os'][_0x41a1('0x4c')]),'osVersion':_0x4c3e8e['os'][_0x41a1('0x4c')],'deviceModel':_0x4c3e8e[_0x41a1('0x4e')][_0x41a1('0x4f')]&&_0x4c3e8e['device'][_0x41a1('0x50')]?util[_0x41a1('0x4b')](_0x41a1('0x51'),_0x4c3e8e[_0x41a1('0x4e')]['model'],_0x4c3e8e[_0x41a1('0x4e')][_0x41a1('0x50')],_0x4c3e8e[_0x41a1('0x4e')][_0x41a1('0x52')]):null,'deviceVendor':_0x4c3e8e[_0x41a1('0x4e')][_0x41a1('0x50')],'deviceType':_0x4c3e8e[_0x41a1('0x4e')][_0x41a1('0x52')],'formData':JSON[_0x41a1('0x1e')](_0x1bee1a)};}exports[_0x41a1('0x53')]=function(_0x27a781,_0x49d92e){var _0x33dfe9={'include':[{'model':db[_0x41a1('0x54')],'as':'mandatoryDispositionPause'}]},_0x1ffcfe={},_0x136f48={'count':0x0,'rows':[]};var _0x134a87=_[_0x41a1('0x3e')](db[_0x41a1('0x55')][_0x41a1('0x56')],function(_0x395df2){return{'name':_0x395df2[_0x41a1('0x57')],'type':_0x395df2[_0x41a1('0x52')][_0x41a1('0x58')]};});_0x1ffcfe[_0x41a1('0x4f')]=_[_0x41a1('0x3e')](_0x134a87,_0x41a1('0x31'));_0x1ffcfe[_0x41a1('0x59')]=_['keys'](_0x27a781[_0x41a1('0x59')]);_0x1ffcfe[_0x41a1('0x5a')]=_[_0x41a1('0x5b')](_0x1ffcfe[_0x41a1('0x4f')],_0x1ffcfe[_0x41a1('0x59')]);_0x33dfe9['attributes']=_[_0x41a1('0x5b')](_0x1ffcfe[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0x27a781[_0x41a1('0x59')]['fields']));_0x33dfe9[_0x41a1('0x5d')]=_0x33dfe9['attributes'][_0x41a1('0x5e')]?_0x33dfe9[_0x41a1('0x5d')]:_0x1ffcfe[_0x41a1('0x4f')];if(!_0x27a781[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x33dfe9[_0x41a1('0x29')]=qs[_0x41a1('0x29')](_0x27a781[_0x41a1('0x59')][_0x41a1('0x29')]);_0x33dfe9[_0x41a1('0x2a')]=qs[_0x41a1('0x2a')](_0x27a781[_0x41a1('0x59')][_0x41a1('0x2a')]);}_0x33dfe9[_0x41a1('0x61')]=qs[_0x41a1('0x62')](_0x27a781[_0x41a1('0x59')]['sort']);_0x33dfe9[_0x41a1('0x63')]=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0x27a781[_0x41a1('0x59')],_0x1ffcfe['filters']),_0x134a87);if(_0x27a781['query'][_0x41a1('0x65')]){_0x33dfe9[_0x41a1('0x63')]=_['merge'](_0x33dfe9[_0x41a1('0x63')],{'$or':_[_0x41a1('0x3e')](_0x134a87,function(_0x1d24fa){if(_0x1d24fa[_0x41a1('0x52')]!==_0x41a1('0x66')){var _0x5c95d2={};_0x5c95d2[_0x1d24fa['name']]={'$like':'%'+_0x27a781[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x5c95d2;}})});}_0x33dfe9=_[_0x41a1('0x67')]({},_0x33dfe9,_0x27a781['options']);var _0x39b800={'where':_0x33dfe9['where']};return db[_0x41a1('0x55')][_0x41a1('0x68')](_0x39b800)[_0x41a1('0x18')](function(_0x1b9203){_0x136f48[_0x41a1('0x68')]=_0x1b9203;if(_0x27a781[_0x41a1('0x59')][_0x41a1('0x69')]){_0x33dfe9[_0x41a1('0x6a')]=[{'all':!![]}];}return db[_0x41a1('0x55')][_0x41a1('0x6b')](_0x33dfe9);})[_0x41a1('0x18')](function(_0x40fa2a){_0x136f48[_0x41a1('0x6c')]=_0x40fa2a;return _0x136f48;})['then'](respondWithFilteredResult(_0x49d92e,_0x33dfe9))[_0x41a1('0x23')](handleError(_0x49d92e,null));};exports[_0x41a1('0x6d')]=function(_0xa11c2f,_0x4858da){var _0x593ccc={'raw':![],'where':{'id':_0xa11c2f['params']['id']},'include':[{'model':db[_0x41a1('0x54')],'as':'mandatoryDispositionPause'}]},_0xab5da9={};_0xab5da9[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db['ChatWebsite']['rawAttributes']);_0xab5da9[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0xa11c2f[_0x41a1('0x59')]);_0xab5da9['filters']=_['intersection'](_0xab5da9[_0x41a1('0x4f')],_0xab5da9['query']);_0x593ccc[_0x41a1('0x5d')]=_[_0x41a1('0x5b')](_0xab5da9[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0xa11c2f[_0x41a1('0x59')]['fields']));_0x593ccc[_0x41a1('0x5d')]=_0x593ccc[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x593ccc[_0x41a1('0x5d')]:_0xab5da9[_0x41a1('0x4f')];if(_0xa11c2f[_0x41a1('0x59')][_0x41a1('0x69')]){_0x593ccc[_0x41a1('0x6a')]=[{'all':!![]}];}_0x593ccc=_[_0x41a1('0x67')]({},_0x593ccc,_0xa11c2f[_0x41a1('0x6f')]);return db[_0x41a1('0x55')][_0x41a1('0x70')](_0x593ccc)[_0x41a1('0x18')](handleEntityNotFound(_0x4858da,null))[_0x41a1('0x18')](respondWithResult(_0x4858da,null))['catch'](handleError(_0x4858da,null));};exports['create']=function(_0x1b851b,_0x58b28d){return db[_0x41a1('0x55')][_0x41a1('0x71')](_0x1b851b[_0x41a1('0x72')],{})[_0x41a1('0x18')](function(_0x14c040){var _0x34ff3a=_0x1b851b[_0x41a1('0x73')]['get']({'plain':!![]});if(!_0x34ff3a)throw new Error(_0x41a1('0x74'));if(_0x34ff3a[_0x41a1('0x75')]===_0x41a1('0x73')){var _0x52a92b=_0x14c040[_0x41a1('0x2e')]({'plain':!![]});var _0x34091a='ChatWebsites';return db[_0x41a1('0x76')][_0x41a1('0x70')]({'where':{'name':_0x34091a,'userProfileId':_0x34ff3a['userProfileId']},'raw':!![]})[_0x41a1('0x18')](function(_0x1326a3){if(_0x1326a3&&_0x1326a3[_0x41a1('0x77')]===0x0){return db[_0x41a1('0x2f')][_0x41a1('0x71')]({'name':_0x52a92b[_0x41a1('0x31')],'resourceId':_0x52a92b['id'],'type':_0x1326a3[_0x41a1('0x31')],'sectionId':_0x1326a3['id']},{})[_0x41a1('0x18')](function(){return _0x14c040;});}else{return _0x14c040;}})[_0x41a1('0x23')](function(_0x428d83){logger[_0x41a1('0x1f')](_0x41a1('0x78'),_0x428d83);throw _0x428d83;});}return _0x14c040;})[_0x41a1('0x18')](respondWithResult(_0x58b28d,0xc9))['catch'](handleError(_0x58b28d,null));};exports[_0x41a1('0x79')]=function(_0x4f019b,_0x50651f){if(_0x4f019b[_0x41a1('0x72')]['id']){delete _0x4f019b[_0x41a1('0x72')]['id'];}return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0x4f019b[_0x41a1('0x7a')]['id']},'include':[{'model':db[_0x41a1('0x54')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x50651f,null))['then'](saveUpdates(_0x4f019b['body'],null))['then'](respondWithResult(_0x50651f,null))[_0x41a1('0x23')](handleError(_0x50651f,null));};exports[_0x41a1('0x2d')]=function(_0x15c14e,_0x252200){return db['ChatWebsite']['find']({'where':{'id':_0x15c14e[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x252200,null))[_0x41a1('0x18')](removeEntity(_0x252200,null))[_0x41a1('0x23')](handleError(_0x252200,null));};exports[_0x41a1('0x7b')]=function(_0x5500d9,_0x3a7922){return db[_0x41a1('0x55')]['describe']()[_0x41a1('0x18')](respondWithResult(_0x3a7922,null))[_0x41a1('0x23')](handleError(_0x3a7922,null));};exports['addDisposition']=function(_0xc9bceb,_0x2fa4a0){if(_0xc9bceb[_0x41a1('0x72')]['id']){delete _0xc9bceb['body']['id'];}return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0xc9bceb['params']['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x2fa4a0,null))[_0x41a1('0x18')](function(_0x3fc40e){if(_0x3fc40e){_0xc9bceb['body'][_0x41a1('0x7c')]=_0x3fc40e['id'];return db[_0x41a1('0x7d')][_0x41a1('0x71')](_0xc9bceb[_0x41a1('0x72')]);}})['then'](respondWithResult(_0x2fa4a0,null))[_0x41a1('0x23')](handleError(_0x2fa4a0,null));};exports[_0x41a1('0x7e')]=function(_0xed7ff1,_0x4264ef){var _0x105896={'raw':![],'where':{}};var _0x50b20e={};var _0x423bb0={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x41a1('0x7f')]({'where':{'id':_0xed7ff1[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x4264ef,null))[_0x41a1('0x18')](function(_0x46c42a){if(_0x46c42a){_0x50b20e[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db[_0x41a1('0x7d')][_0x41a1('0x56')]);_0x50b20e[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0xed7ff1['query']);_0x50b20e[_0x41a1('0x5a')]=_[_0x41a1('0x5b')](_0x50b20e[_0x41a1('0x4f')],_0x50b20e[_0x41a1('0x59')]);_0x105896[_0x41a1('0x5d')]=_[_0x41a1('0x5b')](_0x50b20e[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0xed7ff1[_0x41a1('0x59')]['fields']));_0x105896['attributes']=_0x105896[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x105896[_0x41a1('0x5d')]:_0x50b20e[_0x41a1('0x4f')];if(!_0xed7ff1['query'][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x105896['limit']=qs[_0x41a1('0x29')](_0xed7ff1['query'][_0x41a1('0x29')]);_0x105896[_0x41a1('0x2a')]=qs[_0x41a1('0x2a')](_0xed7ff1[_0x41a1('0x59')][_0x41a1('0x2a')]);}_0x105896['order']=qs[_0x41a1('0x62')](_0xed7ff1[_0x41a1('0x59')]['sort']);_0x105896['where']=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0xed7ff1[_0x41a1('0x59')],_0x50b20e[_0x41a1('0x5a')]));_0x105896[_0x41a1('0x63')][_0x41a1('0x7c')]=_0x46c42a['id'];if(_0xed7ff1[_0x41a1('0x59')]['filter']){_0x105896[_0x41a1('0x63')]=_['merge'](_0x105896[_0x41a1('0x63')],{'$or':_['map'](_0x105896[_0x41a1('0x5d')],function(_0x55c74e){var _0x56fbfe={};_0x56fbfe[_0x55c74e]={'$like':'%'+_0xed7ff1['query'][_0x41a1('0x65')]+'%'};return _0x56fbfe;})});}_0x105896=_[_0x41a1('0x67')]({},_0x105896,_0xed7ff1[_0x41a1('0x6f')]);return db[_0x41a1('0x7d')][_0x41a1('0x68')]({'where':_0x105896[_0x41a1('0x63')]})[_0x41a1('0x18')](function(_0x812f30){_0x423bb0[_0x41a1('0x68')]=_0x812f30;if(_0xed7ff1[_0x41a1('0x59')][_0x41a1('0x69')]){_0x105896['include']=[{'all':!![]}];}return db[_0x41a1('0x7d')][_0x41a1('0x6b')](_0x105896);})[_0x41a1('0x18')](function(_0x2d9563){_0x423bb0[_0x41a1('0x6c')]=_0x2d9563;return _0x423bb0;});}})[_0x41a1('0x18')](respondWithFilteredResult(_0x4264ef,_0x105896))['catch'](handleError(_0x4264ef,null));};exports[_0x41a1('0x80')]=function(_0x24a505,_0x1fc925){return db[_0x41a1('0x55')]['find']({'where':{'id':_0x24a505[_0x41a1('0x7a')]['id']}})['then'](handleEntityNotFound(_0x1fc925,null))[_0x41a1('0x18')](function(_0xeeae5c){if(_0xeeae5c){return _0xeeae5c['removeDispositions'](_0x24a505['query']['ids']);}})[_0x41a1('0x18')](respondWithStatusCode(_0x1fc925,null))[_0x41a1('0x23')](handleError(_0x1fc925,null));};exports[_0x41a1('0x81')]=function(_0x4a854d,_0x461df5){if(_0x4a854d[_0x41a1('0x72')]['id']){delete _0x4a854d['body']['id'];}return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0x4a854d[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x461df5,null))['then'](function(_0x25ee34){if(_0x25ee34){_0x4a854d[_0x41a1('0x72')][_0x41a1('0x7c')]=_0x25ee34['id'];return db[_0x41a1('0x82')][_0x41a1('0x71')](_0x4a854d[_0x41a1('0x72')]);}})[_0x41a1('0x18')](respondWithResult(_0x461df5,null))[_0x41a1('0x23')](handleError(_0x461df5,null));};exports[_0x41a1('0x83')]=function(_0x4903a6,_0x4a1f8f){var _0x13798d={'raw':![],'where':{}};var _0x17e0d2={};var _0xa0ee0b={'count':0x0,'rows':[]};return db[_0x41a1('0x55')][_0x41a1('0x7f')]({'where':{'id':_0x4903a6[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x4a1f8f,null))['then'](function(_0x529d2d){if(_0x529d2d){_0x17e0d2[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db['CannedAnswer'][_0x41a1('0x56')]);_0x17e0d2[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0x4903a6[_0x41a1('0x59')]);_0x17e0d2['filters']=_[_0x41a1('0x5b')](_0x17e0d2[_0x41a1('0x4f')],_0x17e0d2[_0x41a1('0x59')]);_0x13798d['attributes']=_[_0x41a1('0x5b')](_0x17e0d2[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0x4903a6[_0x41a1('0x59')][_0x41a1('0x5c')]));_0x13798d[_0x41a1('0x5d')]=_0x13798d[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x13798d[_0x41a1('0x5d')]:_0x17e0d2['model'];if(!_0x4903a6['query'][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x13798d[_0x41a1('0x29')]=qs[_0x41a1('0x29')](_0x4903a6[_0x41a1('0x59')][_0x41a1('0x29')]);_0x13798d[_0x41a1('0x2a')]=qs['offset'](_0x4903a6[_0x41a1('0x59')][_0x41a1('0x2a')]);}_0x13798d['order']=qs[_0x41a1('0x62')](_0x4903a6['query']['sort']);_0x13798d[_0x41a1('0x63')]=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0x4903a6[_0x41a1('0x59')],_0x17e0d2[_0x41a1('0x5a')]));_0x13798d[_0x41a1('0x63')][_0x41a1('0x7c')]=_0x529d2d['id'];if(_0x4903a6[_0x41a1('0x59')][_0x41a1('0x65')]){_0x13798d[_0x41a1('0x63')]=_['merge'](_0x13798d['where'],{'$or':_[_0x41a1('0x3e')](_0x13798d[_0x41a1('0x5d')],function(_0x5469f7){var _0x1992b3={};_0x1992b3[_0x5469f7]={'$like':'%'+_0x4903a6[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x1992b3;})});}_0x13798d=_[_0x41a1('0x67')]({},_0x13798d,_0x4903a6['options']);return db[_0x41a1('0x82')][_0x41a1('0x68')]({'where':_0x13798d['where']})['then'](function(_0xb4d133){_0xa0ee0b[_0x41a1('0x68')]=_0xb4d133;if(_0x4903a6[_0x41a1('0x59')][_0x41a1('0x69')]){_0x13798d['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x41a1('0x6b')](_0x13798d);})[_0x41a1('0x18')](function(_0x359a26){_0xa0ee0b[_0x41a1('0x6c')]=_0x359a26;return _0xa0ee0b;});}})[_0x41a1('0x18')](respondWithFilteredResult(_0x4a1f8f,_0x13798d))[_0x41a1('0x23')](handleError(_0x4a1f8f,null));};exports[_0x41a1('0x84')]=function(_0xd2e303,_0x4cffcf){return db['ChatWebsite'][_0x41a1('0x70')]({'where':{'id':_0xd2e303['params']['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x4cffcf,null))['then'](function(_0xc03811){if(_0xc03811){return _0xc03811[_0x41a1('0x84')](_0xd2e303[_0x41a1('0x59')][_0x41a1('0x85')]);}})[_0x41a1('0x18')](respondWithStatusCode(_0x4cffcf,null))['catch'](handleError(_0x4cffcf,null));};exports[_0x41a1('0x86')]=function(_0x553b45,_0x3e3b7f){_0x553b45['body'][_0x41a1('0x87')]=_0x553b45['file'][_0x41a1('0x88')];return db[_0x41a1('0x55')]['find']({'where':{'id':_0x553b45[_0x41a1('0x7a')]['id']}})['then'](handleEntityNotFound(_0x3e3b7f,null))[_0x41a1('0x18')](saveUpdates(_0x553b45[_0x41a1('0x72')],null))[_0x41a1('0x18')](respondWithResult(_0x3e3b7f,null))[_0x41a1('0x23')](handleError(_0x3e3b7f,null));};exports[_0x41a1('0x89')]=function(_0x1b55c6,_0x27a0ed){_0x1b55c6[_0x41a1('0x72')][_0x41a1('0x8a')]=_0x1b55c6[_0x41a1('0x8b')]['filename'];return db[_0x41a1('0x55')]['find']({'where':{'id':_0x1b55c6[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x27a0ed,null))['then'](saveUpdates(_0x1b55c6[_0x41a1('0x72')],null))[_0x41a1('0x18')](respondWithResult(_0x27a0ed,null))[_0x41a1('0x23')](handleError(_0x27a0ed,null));};exports['addCustomerAvatar']=function(_0x27e027,_0x5d66cc){_0x27e027[_0x41a1('0x72')][_0x41a1('0x8c')]=_0x27e027[_0x41a1('0x8b')][_0x41a1('0x88')];return db[_0x41a1('0x55')]['find']({'where':{'id':_0x27e027[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x5d66cc,null))[_0x41a1('0x18')](saveUpdates(_0x27e027[_0x41a1('0x72')],null))[_0x41a1('0x18')](respondWithResult(_0x5d66cc,null))['catch'](handleError(_0x5d66cc,null));};exports[_0x41a1('0x8d')]=function(_0x29306d,_0x592489){_0x29306d[_0x41a1('0x72')][_0x41a1('0x8e')]=_0x29306d[_0x41a1('0x8b')]['filename'];return db[_0x41a1('0x55')]['find']({'where':{'id':_0x29306d[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x592489,null))[_0x41a1('0x18')](saveUpdates(_0x29306d[_0x41a1('0x72')],null))[_0x41a1('0x18')](respondWithResult(_0x592489,null))[_0x41a1('0x23')](handleError(_0x592489,null));};exports[_0x41a1('0x8f')]=function(_0x4f85d8,_0x449885){var _0x5cac46=path['join'](config[_0x41a1('0x90')],_0x41a1('0x91'));var _0x50f0d5={'where':{'id':_0x4f85d8[_0x41a1('0x7a')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x64e00f=![];return require('../../config/license/util')[_0x41a1('0x92')]()['then'](function(_0x1803f4){if(_0x1803f4){_0x64e00f=_0x1803f4[_0x41a1('0x93')];}})[_0x41a1('0x18')](function(){return db[_0x41a1('0x55')]['find'](_0x50f0d5);})[_0x41a1('0x18')](handleEntityNotFound(_0x449885,null))['then'](function(_0x2b2b02){if(_0x2b2b02){if(!_[_0x41a1('0x94')](_0x2b2b02[_0x41a1('0x87')])){if(fs[_0x41a1('0x95')](path[_0x41a1('0x96')](config[_0x41a1('0x90')],'server/files/images/logos/',_0x2b2b02['sitepic']))&&_0x64e00f){_0x5cac46=path[_0x41a1('0x96')](config['root'],_0x41a1('0x97'),_0x2b2b02[_0x41a1('0x87')]);}}return _0x449885['download'](_0x5cac46);}})['catch'](handleError(_0x449885,null));};exports['getAvatar']=function(_0x88b0ac,_0x86502a){var _0x1c8c78=path[_0x41a1('0x96')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x13c1a4={'where':{'id':_0x88b0ac[_0x41a1('0x7a')]['id']},'attributes':['id',_0x41a1('0x8a')],'raw':!![]};return db[_0x41a1('0x55')][_0x41a1('0x70')](_0x13c1a4)[_0x41a1('0x18')](handleEntityNotFound(_0x86502a,null))['then'](function(_0x4edbf5){if(_0x4edbf5){if(!_['isNil'](_0x4edbf5[_0x41a1('0x8a')])){if(fs[_0x41a1('0x95')](path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0x98'),_0x4edbf5[_0x41a1('0x8a')]))){_0x1c8c78=path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0x98'),_0x4edbf5[_0x41a1('0x8a')]);}}return _0x86502a['download'](_0x1c8c78);}})[_0x41a1('0x23')](handleError(_0x86502a,null));};exports['getCustomerAvatar']=function(_0x203215,_0x4edfad){var _0x133912=path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0x99'));var _0x270b3c={'where':{'id':_0x203215[_0x41a1('0x7a')]['id']},'attributes':['id',_0x41a1('0x8c'),'showCustomerAvatar'],'raw':!![]};return db[_0x41a1('0x55')][_0x41a1('0x70')](_0x270b3c)[_0x41a1('0x18')](handleEntityNotFound(_0x4edfad,null))[_0x41a1('0x18')](function(_0x14fad9){if(_0x14fad9){if(!_[_0x41a1('0x94')](_0x14fad9['customerAvatar'])){if(fs['existsSync'](path['join'](config[_0x41a1('0x90')],'server/files/images/avatars/',_0x14fad9[_0x41a1('0x8c')]))&&_0x14fad9[_0x41a1('0x9a')]){_0x133912=path['join'](config[_0x41a1('0x90')],_0x41a1('0x98'),_0x14fad9[_0x41a1('0x8c')]);}}return _0x4edfad[_0x41a1('0x9b')](_0x133912);}})[_0x41a1('0x23')](handleError(_0x4edfad,null));};exports['getSystemAvatar']=function(_0x48fca9,_0x7323){var _0x483fb0=path[_0x41a1('0x96')](config['root'],_0x41a1('0x9c'));var _0x4e1706={'where':{'id':_0x48fca9['params']['id']},'attributes':['id',_0x41a1('0x8e')],'raw':!![]};return db[_0x41a1('0x55')]['find'](_0x4e1706)[_0x41a1('0x18')](handleEntityNotFound(_0x7323,null))[_0x41a1('0x18')](function(_0x9f925f){if(_0x9f925f){if(!_[_0x41a1('0x94')](_0x9f925f[_0x41a1('0x8e')])){if(fs['existsSync'](path['join'](config['root'],_0x41a1('0x98'),_0x9f925f[_0x41a1('0x8e')]))){_0x483fb0=path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0x98'),_0x9f925f['systemAvatar']);}}return _0x7323[_0x41a1('0x9b')](_0x483fb0);}})[_0x41a1('0x23')](handleError(_0x7323,null));};exports[_0x41a1('0x9d')]=function(_0xad8abf,_0x9ffff3){var _0x14e34f={'body':_0xad8abf[_0x41a1('0x72')],'channel':_0x41a1('0x9e')};var _0xc45c2f=[];var _0x276aba=[];var _0x511586={};var _0x4e1ee3=![];return db[_0x41a1('0x9f')][_0x41a1('0x7b')]()['then'](function(_0x1a4104){if(!_0x1a4104){throw new db['Sequelize']['ValidationError'](_0x41a1('0xa0'));}_0xc45c2f=_[_0x41a1('0xa1')](_['keys'](_0x1a4104),['createdAt','updatedAt']);_0x276aba=_['difference'](_[_0x41a1('0x6e')](_0x1a4104),[_0x41a1('0xa2'),'updatedAt',_0x41a1('0xa3'),_0x41a1('0xa4')]);if(_0xad8abf[_0x41a1('0x72')]['id']){delete _0xad8abf[_0x41a1('0x72')]['id'];}if(_[_0x41a1('0x94')](_0xad8abf[_0x41a1('0x72')][_0x41a1('0xa5')])){throw new db['Sequelize'][(_0x41a1('0xa6'))](_0x41a1('0xa7'));}if(_['isNil'](_0xad8abf[_0x41a1('0x72')][_0x41a1('0x72')])||_0xad8abf[_0x41a1('0x72')]['body']===''){throw new db[(_0x41a1('0xa8'))][(_0x41a1('0xa6'))](_0x41a1('0xa9'));}if(_[_0x41a1('0x94')](_0xad8abf[_0x41a1('0x72')][_0x41a1('0xaa')])){throw new db[(_0x41a1('0xa8'))]['ValidationError'](_0x41a1('0xab')+_0x276aba);}if(!_[_0x41a1('0xac')](_0x276aba,_0xad8abf[_0x41a1('0x72')]['mapKey'])){throw new db[(_0x41a1('0xa8'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x276aba);}_0x511586[_0xad8abf['body'][_0x41a1('0xaa')]]=_0xad8abf['body'][_0x41a1('0xa5')];})[_0x41a1('0x18')](function(){return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0xad8abf[_0x41a1('0x7a')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x41a1('0xad'),'where':_0x511586,'limit':0x1,'order':[[_0x41a1('0xae'),_0x41a1('0xaf')]]}]},{'model':db[_0x41a1('0xb0')],'as':_0x41a1('0xb1')},{'model':db[_0x41a1('0x3f')],'as':_0x41a1('0x3f'),'include':[{'model':db[_0x41a1('0x3f')],'as':_0x41a1('0xb2'),'attributes':['id',_0x41a1('0x36')],'raw':!![]}]}]});})[_0x41a1('0x18')](function(_0x486e1f){if(!_0x486e1f)throw new APINotFoundError(util[_0x41a1('0x4b')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0xad8abf[_0x41a1('0x7a')]['id']));if(!_0x486e1f['Interval']||!_0x486e1f[_0x41a1('0x3f')][_0x41a1('0xb2')])return[_0x486e1f,!![]];return[_0x486e1f,checkWebsiteIntervals(_0x486e1f)];})[_0x41a1('0xb3')](function(_0x2ee86b,_0x429052){if(!_0x429052)throw new APIOutOfIntervalError();if(!_0x2ee86b[_0x41a1('0xb4')])return;_0x14e34f[_0x41a1('0xb5')]=_0x2ee86b;_0x14e34f[_0x41a1('0xb6')]=_0x2ee86b[_0x41a1('0xb4')];_0x14e34f[_0x41a1('0xb7')]=_[_0x41a1('0xb8')](_0x2ee86b[_0x41a1('0xb1')],[_0x41a1('0xb9')],[_0x41a1('0xba')]);if(_0x14e34f[_0x41a1('0xb5')]['Applications']){delete _0x14e34f[_0x41a1('0xb5')][_0x41a1('0xb1')];}if(_0x14e34f[_0x41a1('0xb5')][_0x41a1('0xb4')]&&_0x14e34f['account'][_0x41a1('0xb4')][_0x41a1('0xad')][_0x41a1('0x5e')]){return _0x14e34f[_0x41a1('0xb5')][_0x41a1('0xb4')]['Contacts'][0x0];}var _0x3a66bc=_[_0x41a1('0x10')](_0xad8abf[_0x41a1('0x72')],{'firstName':_0xad8abf[_0x41a1('0x72')]['from'],'ListId':_0x2ee86b['ListId']});_0x3a66bc[_0xad8abf[_0x41a1('0x72')][_0x41a1('0xaa')]]=_0xad8abf[_0x41a1('0x72')][_0x41a1('0xa5')];return db[_0x41a1('0x9f')][_0x41a1('0x71')](_0x3a66bc,{'fields':_0xc45c2f,'raw':!![]});})[_0x41a1('0x18')](function(_0x3a6137){_0x14e34f[_0x41a1('0xbb')]=_0x3a6137;var _0x221370=createInteractionObject(_0xad8abf[_0x41a1('0x7a')]['id'],_0xad8abf['body'],_0xad8abf['headers'],_0x3a6137);var _0x432ad0={'ChatWebsiteId':_0xad8abf[_0x41a1('0x7a')]['id'],'closed':![]};if(_0xad8abf[_0x41a1('0x72')][_0x41a1('0xbc')]){_0x432ad0[_0x41a1('0xbc')]=_0xad8abf[_0x41a1('0x72')][_0x41a1('0xbc')];return db[_0x41a1('0xbd')]['find']({'where':_0x432ad0})[_0x41a1('0x18')](function(_0x18d1d1){if(_0x18d1d1){_0x4e1ee3=!![];return _0x18d1d1;}_0x221370['threadId']=_0xad8abf[_0x41a1('0x72')][_0x41a1('0xbc')];_0x221370['externalUrl']=_0xad8abf[_0x41a1('0x72')]['externalUrl'];return db[_0x41a1('0xbd')][_0x41a1('0x71')](_0x221370);});}_0x432ad0[_0x41a1('0xbe')]=_0x3a6137['id'];if(_0xad8abf[_0x41a1('0x72')]['interaction']&&_0xad8abf[_0x41a1('0x72')]['interaction']['id']){_0x432ad0['id']=_0xad8abf[_0x41a1('0x72')]['interaction']['id'];return db[_0x41a1('0xbd')][_0x41a1('0x70')]({'where':_0x432ad0})['then'](function(_0x53a92f){if(_0x53a92f){_0x4e1ee3=!![];return _0x53a92f;}return db[_0x41a1('0xbd')][_0x41a1('0x71')](_0x221370);});}return db[_0x41a1('0xbd')][_0x41a1('0x71')](_0x221370);})[_0x41a1('0x18')](function(_0x3b9086){if(!_0x4e1ee3)return _0x3b9086;var _0x3457a3={'from':(_0x14e34f['contact'][_0x41a1('0x47')]||'')+'\x20'+(_0x14e34f[_0x41a1('0xbb')][_0x41a1('0xbf')]||'')};if(_0xad8abf[_0x41a1('0x72')][_0x41a1('0xbc')]&&_0xad8abf[_0x41a1('0x72')][_0x41a1('0xc0')]&&_0xad8abf[_0x41a1('0x72')][_0x41a1('0xbc')]!=_0xad8abf[_0x41a1('0x72')]['messageId']){_0x3457a3[_0x41a1('0xbc')]=_0xad8abf[_0x41a1('0x72')][_0x41a1('0xc0')];}return _0x3b9086['update'](_0x3457a3);})[_0x41a1('0x18')](function(_0x331bbe){_0x14e34f['interaction']=_0x331bbe[_0x41a1('0x2e')]({'plain':!![]});_0x14e34f[_0x41a1('0xc1')]['created']=!_0x4e1ee3;if(_0x14e34f[_0x41a1('0xc1')][_0x41a1('0xc2')]){if(_0x14e34f[_0x41a1('0xb5')]['autoclose']){_0x14e34f[_0x41a1('0xb7')][_0x41a1('0xc3')]({'id':0x0,'priority':_0x14e34f[_0x41a1('0xb7')]['length']+0x1,'app':_0x41a1('0xc4'),'appdata':_0x41a1('0xc5'),'interval':_0x41a1('0xc6')});}}return db['ChatMessage'][_0x41a1('0x71')]({'body':_0xad8abf[_0x41a1('0x72')]['body'],'ChatWebsiteId':_0xad8abf[_0x41a1('0x7a')]['id'],'ChatInteractionId':_0x331bbe['id'],'direction':'in','ContactId':_0x14e34f[_0x41a1('0xbb')]['id'],'AttachmentId':_0xad8abf['body'][_0x41a1('0xc7')]});})[_0x41a1('0x18')](function(_0x1d037a){_0x14e34f[_0x41a1('0x21')]=_0x1d037a;if(!_0x14e34f[_0x41a1('0xc1')]['UserId']){return;}return db[_0x41a1('0xc8')][_0x41a1('0x70')]({'attributes':['id','name'],'where':{'id':_0x14e34f[_0x41a1('0xc1')][_0x41a1('0xc9')]}});})[_0x41a1('0x18')](function(_0x33b316){if(_0x33b316){_0x14e34f[_0x41a1('0xb7')][_0x41a1('0xca')]({'id':0x0,'priority':0x0,'app':_0x41a1('0xcb'),'appdata':_0x33b316[_0x41a1('0x31')]+','+(_0x14e34f['account'][_0x41a1('0xcc')]||0xa),'interval':_0x41a1('0xc6')});_0x14e34f[_0x41a1('0xcd')]=!![];}if(!_0x14e34f['interaction'][_0x41a1('0xce')]){return;}return db[_0x41a1('0xcf')][_0x41a1('0x70')]({'attributes':['id','name'],'where':{'id':_0x14e34f[_0x41a1('0xc1')][_0x41a1('0xce')]}});})[_0x41a1('0x18')](function(_0x27a80f){if(_0x27a80f){_0x14e34f[_0x41a1('0xb7')]['unshift']({'id':0x0,'priority':0x1,'app':_0x41a1('0xd0'),'appdata':_0x27a80f[_0x41a1('0x31')]+','+(_0x14e34f['account'][_0x41a1('0xd1')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x41a1('0xd2'),_0x41a1('0xd3'),_0x14e34f);})['then'](function(_0xabde4e){respondWithRpcPromise(_0x41a1('0xd4'),_0x41a1('0xd4'),{'event':_0x41a1('0x9d'),'message':_0xabde4e},client9002);return _0xabde4e;})[_0x41a1('0x18')](respondWithResult(_0x9ffff3,null))[_0x41a1('0x23')](APIHandleError(_0x9ffff3));};exports[_0x41a1('0xd5')]=function(_0x1715c6,_0x55ebe3){var _0x252dfa,_0x1ce46a,_0x110051;var _0x3abd24=[];var _0x70e266={};var _0x3c565d=_0x1715c6['files']||[];var _0x5d9e49=[];var _0x2d9eb2;return db[_0x41a1('0x9f')][_0x41a1('0x7b')]()[_0x41a1('0x18')](function(_0x50a13c){if(!_0x50a13c){throw new db['Sequelize']['ValidationError'](_0x41a1('0xa0'));}_0x3abd24=_[_0x41a1('0xa1')](_['keys'](_0x50a13c),['createdAt','updatedAt','CompanyId',_0x41a1('0xa4')]);if(_0x1715c6[_0x41a1('0x72')]['id']){delete _0x1715c6[_0x41a1('0x72')]['id'];}if(_[_0x41a1('0x94')](_0x1715c6['body'][_0x41a1('0xa5')])){throw _0x55ebe3['status'](0x1f4)[_0x41a1('0x32')](new db[(_0x41a1('0xa8'))][(_0x41a1('0xa6'))](_0x41a1('0xa7')));}if(_[_0x41a1('0x94')](_0x1715c6[_0x41a1('0x72')][_0x41a1('0x72')])||_0x1715c6['body'][_0x41a1('0x72')]===''){throw _0x55ebe3[_0x41a1('0x25')](0x1f4)[_0x41a1('0x32')](new db[(_0x41a1('0xa8'))][(_0x41a1('0xa6'))](_0x41a1('0xa9')));}if(_['isNil'](_0x1715c6['body'][_0x41a1('0xd6')])){throw _0x55ebe3['status'](0x1f4)[_0x41a1('0x32')](new db[(_0x41a1('0xa8'))][(_0x41a1('0xa6'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3abd24));}if(!_[_0x41a1('0xac')](_0x3abd24,_0x1715c6[_0x41a1('0x72')][_0x41a1('0xd6')])){throw _0x55ebe3[_0x41a1('0x25')](0x1f4)[_0x41a1('0x32')](new db['Sequelize'][(_0x41a1('0xa6'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3abd24));}_0x70e266[_0x1715c6['body'][_0x41a1('0xd6')]]=_0x1715c6[_0x41a1('0x72')][_0x41a1('0xa5')];})[_0x41a1('0x18')](function(){return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0x1715c6[_0x41a1('0x7a')]['id']},'include':[{'model':db['CmList'],'as':_0x41a1('0xb4')},{'model':db[_0x41a1('0xd7')],'as':_0x41a1('0xd7')}]});})['then'](handleEntityNotFound(_0x55ebe3,null))[_0x41a1('0x18')](function(_0x3b9cbf){if(_0x3b9cbf&&_0x3b9cbf['List']){_0x1ce46a=_0x3b9cbf;var _0x1d9775=_[_0x41a1('0x10')](_0x1715c6[_0x41a1('0x72')],{'firstName':_0x1715c6['body'][_0x41a1('0xa5')],'phone':_0x1715c6[_0x41a1('0x72')]['from'],'ListId':_0x3b9cbf[_0x41a1('0xa4')]});_0x1d9775[_0x1715c6[_0x41a1('0x72')]['mapKeyOffline']]=_0x1715c6[_0x41a1('0x72')][_0x41a1('0xa5')];return db[_0x41a1('0x9f')][_0x41a1('0xd8')]({'where':_0x70e266,'defaults':_0x1d9775});}})['spread'](function(_0x101dff){if(_0x101dff){_0x110051=_0x101dff;var _0x3e4bfd=fs['readFileSync'](path[_0x41a1('0x96')](config[_0x41a1('0x90')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x36c447=ejs[_0x41a1('0xd9')](_0x3e4bfd,{'body':_[_0x41a1('0xda')](_0x1715c6[_0x41a1('0x72')][_0x41a1('0x72')]),'bodyTitle':_0x1ce46a[_0x41a1('0xdb')]});return db['ChatOfflineMessage'][_0x41a1('0x71')]({'body':_0x36c447,'plainBody':htmlToText[_0x41a1('0xdc')](_0x36c447),'ContactId':_0x101dff['id'],'ChatWebsiteId':_0x1ce46a['id']});}})[_0x41a1('0x18')](function(_0x448113){_0x2d9eb2=_0x448113;if(_0x3c565d['length']){var _0x75630f=_0x3c565d[_0x41a1('0x3e')](function(_0x320da4){return{'name':_0x320da4[_0x41a1('0xdd')],'basename':_0x320da4[_0x41a1('0x88')],'type':_0x320da4[_0x41a1('0xde')],'ChatOfflineMessageId':_0x448113['id']};});_0x5d9e49=_0x75630f['map'](_0x5abb8c=>{var _0x1117f9={'filename':_0x5abb8c[_0x41a1('0x31')],'path':path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0xdf'),_0x41a1('0xe0'),'attachments',_0x41a1('0xe1'),_0x5abb8c['basename'])};return _0x1117f9;});if(!_0x1ce46a[_0x41a1('0xe2')]){return db['sequelize']['transaction'](function(_0x14af49){return db['Attachment'][_0x41a1('0xe3')](_0x75630f,{'transaction':_0x14af49});});}}})['then'](function(){if(_0x2d9eb2){_0x252dfa=_0x2d9eb2;return db[_0x41a1('0xd7')][_0x41a1('0x7f')]({'where':{'service':!![]},'include':[{'model':db[_0x41a1('0xe4')],'as':_0x41a1('0xe5'),'raw':!![],'include':[{'model':db[_0x41a1('0xe6')],'as':_0x41a1('0xe6'),'raw':!![]}]}]});}})['then'](function(_0x162fb6){if(_0x162fb6&&_0x162fb6['Smtp']&&_0x1ce46a[_0x41a1('0xe7')]&&_0x1ce46a['forwardOfflineAddress']){var _0xd1f749=_0x162fb6['getSmtpOptions']();return respondWithRpcPromise(_0x41a1('0xe8'),_0x41a1('0xe9'),{'account':_0xd1f749,'message':{'from':util[_0x41a1('0x4b')](_0x41a1('0xea'),_0x162fb6['name'],_0x162fb6[_0x41a1('0xeb')]||_0x162fb6[_0x41a1('0xe5')][_0x41a1('0x73')]),'to':_0x1ce46a[_0x41a1('0xec')],'subject':_0x1ce46a[_0x41a1('0xed')],'html':_0x252dfa[_0x41a1('0x72')],'attachments':_0x5d9e49}},client9003)[_0x41a1('0x18')](function(){return _0x252dfa;})[_0x41a1('0x23')](function(_0x442650){logger[_0x41a1('0x1f')](_0x442650);});}})[_0x41a1('0x18')](function(){if(_0x1ce46a&&_0x1ce46a['openNewInteraction']&&_0x1ce46a[_0x41a1('0xee')]){var _0x4f157d=[];if(_0x3c565d[_0x41a1('0x5e')]){_0x4f157d=_0x3c565d[_0x41a1('0x3e')](function(_0x479153){return{'name':_0x479153['originalname'],'basename':_0x479153[_0x41a1('0x88')],'type':_0x479153['mimetype'],'ChatOfflineMessageId':_0x2d9eb2['id']};});}var _0x26ad5e;if(!_['isNil'](_0x1ce46a[_0x41a1('0xef')])){var _0x443d13=_[_0x41a1('0x3e')](_0x1715c6[_0x41a1('0x72')],function(_0x224a84){return _0x224a84;});var _0x15dfdc=_[_0x41a1('0xf0')](_0x443d13)[0x0];var _0x4913d1=_[_0x41a1('0xf1')](_0x15dfdc,function(_0x1f4c90){return _0x1f4c90;});_0x26ad5e=_0x4913d1[0x1][_0x1ce46a['subjectOffline']];}var _0x27b33c={'from':_0x110051[_0x41a1('0xeb')],'firstName':_0x110051[_0x41a1('0x47')],'lastName':_0x110051['lastName'],'mapKey':'email','message':{'from':_0x110051[_0x41a1('0xeb')],'to':_0x1ce46a[_0x41a1('0xd7')][_0x41a1('0xeb')],'cc':'','subject':_['isNil'](_0x26ad5e)?_0x1ce46a['offlineMessageSubject']:_0x26ad5e,'messageId':'','sentAt':new Date(),'attach':_0x4f157d['length'],'attachments':_0x4f157d,'originChannel':'Chat','ChatWebsiteId':_0x1ce46a['id'],'ChatOfflineMessageId':_0x252dfa['id'],'originTo':_0x1ce46a['MailAccount'][_0x41a1('0xeb')]},'body':_0x252dfa[_0x41a1('0x72')]};var _0x2f0e3c={'account':{'id':_0x1ce46a[_0x41a1('0xee')]},'body':_0x27b33c,'log':_0x41a1('0xf2')};return respondWithRpcPromise(_0x41a1('0xf2'),_0x41a1('0xf3'),_0x2f0e3c,client9001)[_0x41a1('0x18')](function(){return _0x252dfa;})[_0x41a1('0x23')](function(_0x22c8df){logger[_0x41a1('0x1f')](_0x22c8df);});}return;})[_0x41a1('0x18')](function(){if(_0x252dfa){return _0x252dfa;}})[_0x41a1('0x18')](respondWithResult(_0x55ebe3,null))[_0x41a1('0x23')](function(){for(var _0x27c83f of _0x3c565d){var _0x1123e9=path[_0x41a1('0x96')](config[_0x41a1('0x90')],_0x41a1('0xdf'),_0x41a1('0xe0'),'attachments',_0x41a1('0xe1'),_0x27c83f[_0x41a1('0x88')]);fs_extra['remove'](_0x1123e9)[_0x41a1('0x23')](function(_0x55f436){logger[_0x41a1('0x1f')](_0x41a1('0xf4'),_0x1123e9,_0x55f436);});}});};exports[_0x41a1('0xf5')]=function(_0x22ff42,_0x189d1e){return db['ChatInteraction'][_0x41a1('0x70')]({'where':{'id':_0x22ff42[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x189d1e,null))[_0x41a1('0x18')](function(_0x4dcb20){if(_0x4dcb20){return _0x4dcb20[_0x41a1('0xf5')](_0x22ff42[_0x41a1('0x72')][_0x41a1('0x85')],_[_0x41a1('0xf6')](_0x22ff42[_0x41a1('0x72')],['ids','id'])||{});}})[_0x41a1('0x18')](respondWithResult(_0x189d1e,null))[_0x41a1('0x23')](handleError(_0x189d1e,null));};exports[_0x41a1('0xf7')]=function(_0x78ee57,_0x360c08){var _0x5b0684={'raw':![],'where':{}};var _0x1e8624={};var _0x537b97={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x78ee57[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x360c08,null))[_0x41a1('0x18')](function(_0x5c802c){if(_0x5c802c){_0x1e8624['model']=_[_0x41a1('0x6e')](db[_0x41a1('0xbd')][_0x41a1('0x56')]);_0x1e8624[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0x78ee57[_0x41a1('0x59')]);_0x1e8624[_0x41a1('0x5a')]=_[_0x41a1('0x5b')](_0x1e8624[_0x41a1('0x4f')],_0x1e8624[_0x41a1('0x59')]);_0x5b0684[_0x41a1('0x5d')]=_[_0x41a1('0x5b')](_0x1e8624[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0x78ee57[_0x41a1('0x59')]['fields']));_0x5b0684[_0x41a1('0x5d')]=_0x5b0684[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x5b0684[_0x41a1('0x5d')]:_0x1e8624[_0x41a1('0x4f')];if(!_0x78ee57[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x5b0684[_0x41a1('0x29')]=qs[_0x41a1('0x29')](_0x78ee57[_0x41a1('0x59')][_0x41a1('0x29')]);_0x5b0684['offset']=qs[_0x41a1('0x2a')](_0x78ee57[_0x41a1('0x59')][_0x41a1('0x2a')]);}_0x5b0684['order']=qs['sort'](_0x78ee57[_0x41a1('0x59')][_0x41a1('0x62')]);_0x5b0684[_0x41a1('0x63')]=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0x78ee57['query'],_0x1e8624[_0x41a1('0x5a')]));_0x5b0684[_0x41a1('0x63')]['ChatWebsiteId']=_0x5c802c['id'];if(_0x78ee57[_0x41a1('0x59')][_0x41a1('0x65')]){_0x5b0684[_0x41a1('0x63')]=_[_0x41a1('0x67')](_0x5b0684[_0x41a1('0x63')],{'$or':_['map'](_0x5b0684[_0x41a1('0x5d')],function(_0x188eec){var _0x301f66={};_0x301f66[_0x188eec]={'$like':'%'+_0x78ee57[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x301f66;})});}_0x5b0684=_[_0x41a1('0x67')]({},_0x5b0684,_0x78ee57[_0x41a1('0x6f')]);return db[_0x41a1('0xbd')][_0x41a1('0x68')]({'where':_0x5b0684[_0x41a1('0x63')]})[_0x41a1('0x18')](function(_0x184f7e){_0x537b97[_0x41a1('0x68')]=_0x184f7e;if(_0x78ee57['query'][_0x41a1('0x69')]){_0x5b0684['include']=[{'model':db[_0x41a1('0x9f')],'as':_0x41a1('0xf8'),'required':![]},{'model':db[_0x41a1('0xc8')],'as':'Owner','attributes':[_0x41a1('0x31'),_0x41a1('0xf9'),_0x41a1('0xfa')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x41a1('0x31'),_0x41a1('0xfb')],'where':_0x78ee57[_0x41a1('0x59')][_0x41a1('0xfc')]?{'id':_0x78ee57[_0x41a1('0x59')][_0x41a1('0xfc')]}:undefined,'required':_0x78ee57[_0x41a1('0x59')][_0x41a1('0xfc')]?!![]:![]}];}return db[_0x41a1('0xbd')][_0x41a1('0x6b')](_0x5b0684);})[_0x41a1('0x18')](function(_0x13f178){_0x537b97[_0x41a1('0x6c')]=_0x13f178;return _0x537b97;});}})[_0x41a1('0x18')](respondWithFilteredResult(_0x360c08,_0x5b0684))[_0x41a1('0x23')](handleError(_0x360c08,null));};exports['getSnippet']=function(_0x869357,_0x54085f){var _0x4a4b2e=0x0;var _0x374561=0x0;var _0x55966f=![];var _0x58e734;var _0x5cff53;return db['ChatWebsite'][_0x41a1('0x70')]({'where':{'id':_0x869357[_0x41a1('0x7a')]['id']},'include':[{'model':db[_0x41a1('0x3f')],'as':'Interval','include':[{'model':db['Interval'],'as':_0x41a1('0xb2'),'attributes':['id',_0x41a1('0x36')]}]}]})['then'](handleEntityNotFound(_0x54085f,null))[_0x41a1('0x18')](function(_0x545536){if(_0x545536){_0x58e734=_0x545536;return _0x545536['getProactiveActions']({'raw':!![]});}})['then'](function(_0x183eb8){if(_0x58e734){if(_0x183eb8){_0x5cff53=_0x183eb8;}}return require(_0x41a1('0xfd'))[_0x41a1('0x92')]();})[_0x41a1('0x18')](function(_0x1e14c4){if(_0x1e14c4){_0x374561=_0x1e14c4[_0x41a1('0xfe')];_0x55966f=_0x1e14c4[_0x41a1('0x93')];}})['then'](function(){return db[_0x41a1('0xbd')][_0x41a1('0x68')]({'where':{'closed':![]}});})['then'](function(_0x210820){_0x4a4b2e=_0x210820;if(_0x374561&&_0x210820>_0x374561){return db[_0x41a1('0xff')]['findOne']({'where':{'id':0x1}})[_0x41a1('0x18')](function(_0x1dc093){if(_0x1dc093){_0x1dc093[_0x41a1('0x100')](_0x41a1('0x101'));}});}})[_0x41a1('0x18')](function(){if(!_0x58e734['Interval']||!_0x58e734['Interval'][_0x41a1('0xb2')])return!![];return checkWebsiteIntervals(_0x58e734);})['then'](function(_0x43d278){var _0x3059ac=fs['readFileSync'](path[_0x41a1('0x96')](config['root'],_0x41a1('0x102')),_0x41a1('0x103'));var _0x12d329=new url[(_0x41a1('0x104'))](_0x58e734[_0x41a1('0x105')])[_0x41a1('0x106')];var _0x5a5824=_0x41a1('0x107');var _0x2e5707=![];var _0x2f05b8={'chatVersion':_0x5a5824,'chatWebsiteAddressOrigin':_0x12d329,'remote':_0x58e734[_0x41a1('0x108')],'query':querystring[_0x41a1('0x1e')](_[_0x41a1('0x67')](_0x58e734[_0x41a1('0x2e')]({'plain':!![]}),{'customerIp':_0x869357[_0x41a1('0x109')][_0x41a1('0x45')]||_0x869357[_0x41a1('0x109')]['x-real-ip']||_0x869357[_0x41a1('0x10a')][_0x41a1('0x10b')]||_0x869357['ip'],'referer':_0x869357['headers'][_0x41a1('0x49')],'openedInteractions':_0x4a4b2e,'maxInteractions':_0x374561,'virtual':_0x55966f[_0x41a1('0xfe')],'online':_0x43d278,'custom':_0x55966f}))[_0x41a1('0x10c')](/'/g,'\x5c\x27')};_0x54085f[_0x41a1('0x32')](ejs['render'](Mustache[_0x41a1('0xd9')](_0x3059ac,_0x2f05b8),{'proactiveActions':_0x5cff53,'alignment':_0x58e734[_0x41a1('0x10d')],'verticalAlignment':_0x58e734[_0x41a1('0x10e')],'div_color':_0x58e734['color'],'labelText':_0x58e734['labelText'],'text_color':_0x58e734[_0x41a1('0x10f')],'text_button_color':_0x58e734[_0x41a1('0x110')],'button_color':_0x58e734['color_button'],'background_color':_0x58e734['backgroundColor'],'hideWhenOffline':_0x58e734[_0x41a1('0x111')],'intervalId':_0x58e734[_0x41a1('0x112')],'isDevelopment':_0x2e5707,'chatVersion':_0x5a5824}));})[_0x41a1('0x23')](handleError(_0x54085f,null));};exports['addApplications']=function(_0x21abb8,_0x4d1419){var _0x1e22ef=_0x21abb8[_0x41a1('0x7a')]['id'];var _0x4a1ebf=_0x21abb8[_0x41a1('0x72')];var _0x54dd56=0xc8;var _0x179d06=null;return db[_0x41a1('0x113')][_0x41a1('0x114')]({'isolationLevel':db[_0x41a1('0x113')][_0x41a1('0x115')][_0x41a1('0x116')][_0x41a1('0x117')]},function(_0x46e547){return db[_0x41a1('0x55')]['findOne']({'where':{'id':_0x1e22ef},'transaction':_0x46e547})[_0x41a1('0x18')](function(_0x51b25c){if(_0x51b25c){return db[_0x41a1('0xb0')]['destroy']({'where':{'ChatWebsiteId':_0x1e22ef},'transaction':_0x46e547})[_0x41a1('0x18')](function(){var _0x17e845=_[_0x41a1('0x3e')](_0x4a1ebf,function(_0x4df496){_0x4df496['ChatWebsiteId']=_0x1e22ef;return _0x4df496;});return db[_0x41a1('0xb0')][_0x41a1('0xe3')](_0x17e845,{'transaction':_0x46e547});});}else{_0x54dd56=0x194;_0x179d06=[];}});})[_0x41a1('0x18')](function(){if(_0x54dd56!==0x194){return db[_0x41a1('0xb0')][_0x41a1('0x118')]({'where':{'ChatWebsiteId':_0x1e22ef},'order':'priority'})[_0x41a1('0x18')](function(_0x40bb5a){_0x179d06=_0x40bb5a;});}})[_0x41a1('0x23')](function(_0x48d24a){_0x54dd56=0x1f4;logger['error'](_0x48d24a[_0x41a1('0x30')]);if(_0x48d24a[_0x41a1('0x31')]){delete _0x48d24a[_0x41a1('0x31')];}_0x179d06=_0x48d24a;})[_0x41a1('0x119')](function(){if(_0x179d06===null){_0x4d1419[_0x41a1('0x24')](_0x54dd56);}else{if(_0x54dd56===0x1f4){_0x4d1419[_0x41a1('0x25')](_0x54dd56)[_0x41a1('0x32')](_0x179d06);}else{_0x4d1419[_0x41a1('0x25')](_0x54dd56)[_0x41a1('0x27')](_0x179d06);}}});};exports['getApplications']=function(_0xc61a6b,_0x2293e1){var _0x1fdd5c={};var _0x577a97={};var _0x372ac3;var _0x2c33ea;return db[_0x41a1('0x55')][_0x41a1('0x7f')]({'where':{'id':_0xc61a6b[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x2293e1,null))[_0x41a1('0x18')](function(_0x2d4a5b){if(_0x2d4a5b){_0x372ac3=_0x2d4a5b;_0x577a97[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db[_0x41a1('0xb0')][_0x41a1('0x56')]);_0x577a97[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0xc61a6b[_0x41a1('0x59')]);_0x577a97[_0x41a1('0x5a')]=_[_0x41a1('0x5b')](_0x577a97[_0x41a1('0x4f')],_0x577a97[_0x41a1('0x59')]);_0x1fdd5c['attributes']=_['intersection'](_0x577a97[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0xc61a6b['query'][_0x41a1('0x5c')]));_0x1fdd5c[_0x41a1('0x5d')]=_0x1fdd5c[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x1fdd5c[_0x41a1('0x5d')]:_0x577a97[_0x41a1('0x4f')];_0x1fdd5c['order']=qs['sort'](_0xc61a6b[_0x41a1('0x59')][_0x41a1('0x62')]);_0x1fdd5c[_0x41a1('0x63')]=qs['filters'](_[_0x41a1('0x64')](_0xc61a6b[_0x41a1('0x59')],_0x577a97[_0x41a1('0x5a')]));if(_0xc61a6b[_0x41a1('0x59')][_0x41a1('0x65')]){_0x1fdd5c[_0x41a1('0x63')]=_[_0x41a1('0x67')](_0x1fdd5c[_0x41a1('0x63')],{'$or':_[_0x41a1('0x3e')](_0x1fdd5c[_0x41a1('0x5d')],function(_0x473cd6){var _0x2340d6={};_0x2340d6[_0x473cd6]={'$like':'%'+_0xc61a6b[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x2340d6;})});}_0x1fdd5c=_[_0x41a1('0x67')]({},_0x1fdd5c,_0xc61a6b[_0x41a1('0x6f')]);return _0x372ac3[_0x41a1('0x11a')](_0x1fdd5c);}})[_0x41a1('0x18')](function(_0x1ef7ae){if(_0x1ef7ae){_0x2c33ea=_0x1ef7ae[_0x41a1('0x5e')];if(!_0xc61a6b[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x1fdd5c['limit']=qs[_0x41a1('0x29')](_0xc61a6b[_0x41a1('0x59')][_0x41a1('0x29')]);_0x1fdd5c[_0x41a1('0x2a')]=qs[_0x41a1('0x2a')](_0xc61a6b['query'][_0x41a1('0x2a')]);}return _0x372ac3[_0x41a1('0x11a')](_0x1fdd5c);}})[_0x41a1('0x18')](function(_0x14d538){if(_0x14d538){return _0x14d538?{'count':_0x2c33ea,'rows':_0x14d538}:null;}})['then'](respondWithResult(_0x2293e1,null))['catch'](handleError(_0x2293e1,null));};exports[_0x41a1('0x11b')]=function(_0x44f30e,_0x12c011){return db['chatProactiveAction']['find']({'where':{'id':_0x44f30e[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x12c011,null))['then'](function(_0x27ca99){if(_0x27ca99){return _0x27ca99[_0x41a1('0x11b')](_0x44f30e[_0x41a1('0x72')][_0x41a1('0x85')],_[_0x41a1('0xf6')](_0x44f30e['body'],['ids','id'])||{});}})[_0x41a1('0x18')](respondWithResult(_0x12c011,null))['catch'](handleError(_0x12c011,null));};exports[_0x41a1('0x11c')]=function(_0xb18a3d,_0x9d4e4){var _0x587e93={};var _0x1c4a9c={};var _0x1db40d;var _0x503bd5;return db[_0x41a1('0x55')][_0x41a1('0x7f')]({'where':{'id':_0xb18a3d[_0x41a1('0x7a')]['id']}})['then'](handleEntityNotFound(_0x9d4e4,null))['then'](function(_0x42167a){if(_0x42167a){_0x1db40d=_0x42167a;_0x1c4a9c[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db[_0x41a1('0x11d')][_0x41a1('0x56')]);_0x1c4a9c[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0xb18a3d[_0x41a1('0x59')]);_0x1c4a9c[_0x41a1('0x5a')]=_[_0x41a1('0x5b')](_0x1c4a9c[_0x41a1('0x4f')],_0x1c4a9c['query']);_0x587e93['attributes']=_[_0x41a1('0x5b')](_0x1c4a9c['model'],qs[_0x41a1('0x5c')](_0xb18a3d['query'][_0x41a1('0x5c')]));_0x587e93[_0x41a1('0x5d')]=_0x587e93[_0x41a1('0x5d')]['length']?_0x587e93[_0x41a1('0x5d')]:_0x1c4a9c[_0x41a1('0x4f')];_0x587e93['order']=qs[_0x41a1('0x62')](_0xb18a3d['query'][_0x41a1('0x62')]);_0x587e93[_0x41a1('0x63')]=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0xb18a3d['query'],_0x1c4a9c['filters']));if(_0xb18a3d[_0x41a1('0x59')][_0x41a1('0x65')]){_0x587e93[_0x41a1('0x63')]=_[_0x41a1('0x67')](_0x587e93[_0x41a1('0x63')],{'$or':_[_0x41a1('0x3e')](_0x587e93[_0x41a1('0x5d')],function(_0x3aa2b5){var _0x7d3f34={};_0x7d3f34[_0x3aa2b5]={'$like':'%'+_0xb18a3d[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x7d3f34;})});}_0x587e93=_[_0x41a1('0x67')]({},_0x587e93,_0xb18a3d['options']);return _0x1db40d['getProactiveActions'](_0x587e93);}})[_0x41a1('0x18')](function(_0x38f157){if(_0x38f157){_0x503bd5=_0x38f157['length'];if(!_0xb18a3d[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x587e93[_0x41a1('0x29')]=qs['limit'](_0xb18a3d[_0x41a1('0x59')][_0x41a1('0x29')]);_0x587e93['offset']=qs[_0x41a1('0x2a')](_0xb18a3d[_0x41a1('0x59')][_0x41a1('0x2a')]);}return _0x1db40d[_0x41a1('0x11c')](_0x587e93);}})[_0x41a1('0x18')](function(_0x111b7c){if(_0x111b7c){return _0x111b7c?{'count':_0x503bd5,'rows':_0x111b7c}:null;}})['then'](respondWithResult(_0x9d4e4,null))[_0x41a1('0x23')](handleError(_0x9d4e4,null));};exports[_0x41a1('0x11e')]=function(_0x5d1b4c,_0x18e39b){var _0x531ccf=_0x5d1b4c[_0x41a1('0x59')]['online']===_0x41a1('0x11f')?'offlineForm':_0x41a1('0x120');return db[_0x41a1('0x55')]['find']({'attributes':['id',_0x531ccf],'where':{'id':_0x5d1b4c[_0x41a1('0x7a')]['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x18e39b,null))['then'](function(_0x31567b){if(_0x31567b){var _0x4729fb=_0x31567b[_0x531ccf];var _0x21a505=_0x4729fb&&_0x4729fb[_0x41a1('0x121')]?_0x4729fb['items']:[];_0x18e39b[_0x41a1('0x32')]({'fromKey':_[_0x41a1('0x94')](_0x4729fb['fromKey'])?undefined:_0x4729fb[_0x41a1('0x122')],'count':_0x21a505[_0x41a1('0x5e')],'rows':_0x21a505});}})[_0x41a1('0x23')](handleError(_0x18e39b,null));};exports[_0x41a1('0x123')]=function(_0x4e7b2b,_0x195cc9){var _0x32b905={'raw':![],'where':{}};var _0x403a1b={};var _0x65ee09={'count':0x0,'rows':[]};return db[_0x41a1('0x55')]['findOne']({'where':{'id':_0x4e7b2b['params']['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x195cc9,null))[_0x41a1('0x18')](function(_0x583b63){if(_0x583b63){_0x403a1b[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db[_0x41a1('0x124')][_0x41a1('0x56')]);_0x403a1b[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0x4e7b2b[_0x41a1('0x59')]);_0x403a1b[_0x41a1('0x5a')]=_['intersection'](_0x403a1b[_0x41a1('0x4f')],_0x403a1b[_0x41a1('0x59')]);_0x32b905['attributes']=_[_0x41a1('0x5b')](_0x403a1b[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0x4e7b2b['query'][_0x41a1('0x5c')]));_0x32b905[_0x41a1('0x5d')]=_0x32b905[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x32b905[_0x41a1('0x5d')]:_0x403a1b[_0x41a1('0x4f')];if(!_0x4e7b2b[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x32b905[_0x41a1('0x29')]=qs[_0x41a1('0x29')](_0x4e7b2b[_0x41a1('0x59')]['limit']);_0x32b905['offset']=qs[_0x41a1('0x2a')](_0x4e7b2b[_0x41a1('0x59')][_0x41a1('0x2a')]);}_0x32b905[_0x41a1('0x61')]=qs['sort'](_0x4e7b2b[_0x41a1('0x59')][_0x41a1('0x62')]);_0x32b905['where']=qs[_0x41a1('0x5a')](_[_0x41a1('0x64')](_0x4e7b2b[_0x41a1('0x59')],_0x403a1b[_0x41a1('0x5a')]));_0x32b905[_0x41a1('0x63')][_0x41a1('0x7c')]=_0x583b63['id'];if(_0x4e7b2b['query'][_0x41a1('0x65')]){_0x32b905[_0x41a1('0x63')]=_[_0x41a1('0x67')](_0x32b905['where'],{'$or':_[_0x41a1('0x3e')](_0x32b905[_0x41a1('0x5d')],function(_0x342820){var _0x10ef2c={};_0x10ef2c[_0x342820]={'$like':'%'+_0x4e7b2b[_0x41a1('0x59')][_0x41a1('0x65')]+'%'};return _0x10ef2c;})});}_0x32b905=_[_0x41a1('0x67')]({},_0x32b905,_0x4e7b2b[_0x41a1('0x6f')]);return db[_0x41a1('0x124')]['count']({'where':_0x32b905[_0x41a1('0x63')]})['then'](function(_0x26bb16){_0x65ee09['count']=_0x26bb16;if(_0x4e7b2b['query'][_0x41a1('0x69')]){_0x32b905[_0x41a1('0x6a')]=[{'all':!![]}];}else{_0x32b905[_0x41a1('0x6a')]=[{'model':db[_0x41a1('0x9f')],'as':_0x41a1('0xf8'),'required':![]},{'model':db[_0x41a1('0x125')],'as':_0x41a1('0x126'),'required':![]}];}return db[_0x41a1('0x124')][_0x41a1('0x6b')](_0x32b905);})[_0x41a1('0x18')](function(_0x99b7ab){_0x65ee09[_0x41a1('0x6c')]=_0x99b7ab;return _0x65ee09;});}})['then'](respondWithFilteredResult(_0x195cc9,_0x32b905))[_0x41a1('0x23')](handleError(_0x195cc9,null));};exports[_0x41a1('0x127')]=function(_0x59d829,_0x32c817){return db[_0x41a1('0x55')]['find']({'where':{'id':_0x59d829[_0x41a1('0x7a')]['id']}})['then'](handleEntityNotFound(_0x32c817,null))[_0x41a1('0x18')](function(_0x9e9f62){if(_0x9e9f62){return _0x9e9f62[_0x41a1('0x127')](_0x59d829['body'][_0x41a1('0x85')],_[_0x41a1('0xf6')](_0x59d829[_0x41a1('0x72')],[_0x41a1('0x85'),'id'])||{})['spread'](function(_0x4e19b8){for(var _0x23c26c=0x0;_0x23c26c<_0x59d829[_0x41a1('0x72')]['ids'][_0x41a1('0x5e')];_0x23c26c+=0x1){socket[_0x41a1('0x128')](_0x41a1('0x129'),{'UserId':Number(_0x59d829[_0x41a1('0x72')][_0x41a1('0x85')][_0x23c26c]),'ChatWebsiteId':Number(_0x59d829[_0x41a1('0x7a')]['id'])});}return _0x4e19b8;});}})[_0x41a1('0x18')](respondWithResult(_0x32c817,null))[_0x41a1('0x23')](handleError(_0x32c817,null));};exports['removeAgents']=function(_0x22f94a,_0x5ce597){return db[_0x41a1('0x55')][_0x41a1('0x70')]({'where':{'id':_0x22f94a['params']['id']}})[_0x41a1('0x18')](handleEntityNotFound(_0x5ce597,null))['then'](function(_0x2fdd8b){if(_0x2fdd8b){return _0x2fdd8b[_0x41a1('0x12a')](_0x22f94a[_0x41a1('0x59')]['ids'])[_0x41a1('0x18')](function(){if(_[_0x41a1('0x12b')](_0x22f94a[_0x41a1('0x59')][_0x41a1('0x85')])){for(var _0x26239d=0x0;_0x26239d<_0x22f94a[_0x41a1('0x59')][_0x41a1('0x85')][_0x41a1('0x5e')];_0x26239d+=0x1){socket[_0x41a1('0x128')](_0x41a1('0x12c'),{'UserId':Number(_0x22f94a['query'][_0x41a1('0x85')][_0x26239d]),'ChatWebsiteId':Number(_0x22f94a[_0x41a1('0x7a')]['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x22f94a[_0x41a1('0x59')][_0x41a1('0x85')]),'ChatWebsiteId':Number(_0x22f94a[_0x41a1('0x7a')]['id'])});}});}})[_0x41a1('0x18')](respondWithStatusCode(_0x5ce597,null))['catch'](handleError(_0x5ce597,null));};exports['getAgents']=function(_0x1d6997,_0x24e9c5){var _0x4335c2={};var _0x2541b7={};var _0x1eda0e;var _0x56bfcd;return db[_0x41a1('0x55')][_0x41a1('0x7f')]({'where':{'id':_0x1d6997[_0x41a1('0x7a')]['id']}})['then'](handleEntityNotFound(_0x24e9c5,null))[_0x41a1('0x18')](function(_0xc5fc61){if(_0xc5fc61){_0x1eda0e=_0xc5fc61;_0x2541b7[_0x41a1('0x4f')]=_[_0x41a1('0x6e')](db[_0x41a1('0xc8')][_0x41a1('0x56')]);_0x2541b7[_0x41a1('0x59')]=_[_0x41a1('0x6e')](_0x1d6997[_0x41a1('0x59')]);_0x2541b7['filters']=_[_0x41a1('0x5b')](_0x2541b7[_0x41a1('0x4f')],_0x2541b7[_0x41a1('0x59')]);_0x4335c2[_0x41a1('0x5d')]=_[_0x41a1('0x5b')](_0x2541b7[_0x41a1('0x4f')],qs[_0x41a1('0x5c')](_0x1d6997[_0x41a1('0x59')][_0x41a1('0x5c')]));_0x4335c2[_0x41a1('0x5d')]=_0x4335c2[_0x41a1('0x5d')][_0x41a1('0x5e')]?_0x4335c2[_0x41a1('0x5d')]:_0x2541b7['model'];_0x4335c2[_0x41a1('0x61')]=qs[_0x41a1('0x62')](_0x1d6997[_0x41a1('0x59')]['sort']);_0x4335c2[_0x41a1('0x63')]=qs[_0x41a1('0x5a')](_['pick'](_0x1d6997[_0x41a1('0x59')],_0x2541b7[_0x41a1('0x5a')]));if(_0x1d6997[_0x41a1('0x59')]['filter']){_0x4335c2[_0x41a1('0x63')]=_[_0x41a1('0x67')](_0x4335c2[_0x41a1('0x63')],{'$or':_[_0x41a1('0x3e')](_0x4335c2['attributes'],function(_0x20f8d2){var _0x1ca4b5={};_0x1ca4b5[_0x20f8d2]={'$like':'%'+_0x1d6997[_0x41a1('0x59')]['filter']+'%'};return _0x1ca4b5;})});}_0x4335c2=_['merge']({},_0x4335c2,_0x1d6997[_0x41a1('0x6f')]);return _0x1eda0e['getAgents'](_0x4335c2);}})['then'](function(_0x35337c){if(_0x35337c){_0x56bfcd=_0x35337c[_0x41a1('0x5e')];if(!_0x1d6997[_0x41a1('0x59')][_0x41a1('0x5f')](_0x41a1('0x60'))){_0x4335c2[_0x41a1('0x29')]=qs[_0x41a1('0x29')](_0x1d6997['query'][_0x41a1('0x29')]);_0x4335c2[_0x41a1('0x2a')]=qs[_0x41a1('0x2a')](_0x1d6997['query'][_0x41a1('0x2a')]);}return _0x1eda0e[_0x41a1('0x12d')](_0x4335c2);}})[_0x41a1('0x18')](function(_0x2dc55f){if(_0x2dc55f){return _0x2dc55f?{'count':_0x56bfcd,'rows':_0x2dc55f}:null;}})[_0x41a1('0x18')](respondWithResult(_0x24e9c5,null))[_0x41a1('0x23')](handleError(_0x24e9c5,null));}; \ No newline at end of file +var _0x671a=['../../errors/api','APINotFoundError','../../mysqldb','redis','localhost','./chatWebsite.socket','register','http','client','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','Command','getSnippet','timezone','format','interval','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','inspect','No\x20timezone','map','all','some','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','%s\x20%s','unknown','version','device','vendor','%s\x20%s\x20%s','model','type','index','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','key','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','options','includeAll','findAll','include','find','create','body','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','order','ChatWebsiteId','merge','rows','removeDispositions','ids','CannedAnswer','getAnswers','keys','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','chat','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','ListId','from','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Applications','Interval','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','list','applications','orderBy','priority','asc','Contacts','defaults','contact','threadId','externalUrl','ChatInteraction','interaction','messageId','created','autoclose','push','close','unmanaged','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','offline','files','CompanyId','send','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','server','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','user','offlineMessageSubject','MailAccountId','originalname','mimetype','subjectOffline','toPairsIn','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','License','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','URL','origin','3.5.0','remote','headers','x-real-ip','remoteAddress','virtual','replace','render','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','getProactiveActions','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','isArray','emit','userChatWebsite:remove','User','getAgents','mustache','util','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIOutOfIntervalError'];(function(_0x333f19,_0x3f6eed){var _0x453f98=function(_0x1d025c){while(--_0x1d025c){_0x333f19['push'](_0x333f19['shift']());}};_0x453f98(++_0x3f6eed);}(_0x671a,0x12b));var _0xa671=function(_0x598408,_0x5e6f74){_0x598408=_0x598408-0x0;var _0x560720=_0x671a[_0x598408];return _0x560720;};'use strict';var Mustache=require(_0xa671('0x0'));var util=require(_0xa671('0x1'));var path=require('path');var ejs=require(_0xa671('0x2'));var fs=require('fs');var fs_extra=require(_0xa671('0x3'));var _=require(_0xa671('0x4'));var querystring=require(_0xa671('0x5'));var htmlToText=require(_0xa671('0x6'));var Redis=require(_0xa671('0x7'));var jayson=require(_0xa671('0x8'));var url=require('url');var qs=require(_0xa671('0x9'));var logger=require(_0xa671('0xa'))(_0xa671('0xb'));var config=require(_0xa671('0xc'));var APIOutOfIntervalError=require('../../errors/api')[_0xa671('0xd')];var APINotFoundError=require(_0xa671('0xe'))[_0xa671('0xf')];var APIHandleError=require(_0xa671('0xe'))['handleError'];var db=require(_0xa671('0x10'))['db'];config[_0xa671('0x11')]=_['defaults'](config[_0xa671('0x11')],{'host':_0xa671('0x12'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa671('0x11')]));require(_0xa671('0x13'))[_0xa671('0x14')](socket);var client=jayson['client'][_0xa671('0x15')]({'port':0x232c});var client9002=jayson[_0xa671('0x16')]['http']({'port':0x232a});var client9003=jayson[_0xa671('0x16')]['http']({'port':0x232b});var client9001=jayson[_0xa671('0x16')][_0xa671('0x15')]({'port':0x2329});function respondWithRpcPromise(_0x4b1d0e,_0x2e2c18,_0x459c24,_0x4bc393){return new Promise(function(_0xddcb05,_0x373dd5){var _0x1c8475=_0x4bc393||client;return _0x1c8475[_0xa671('0x17')](_0x4b1d0e,_0x459c24)[_0xa671('0x18')](function(_0x9e6765){logger['info'](_0xa671('0x19'),_0x2e2c18,_0xa671('0x1a'));logger['debug'](_0xa671('0x1b'),_0x2e2c18,'request\x20sent',JSON[_0xa671('0x1c')](_0x9e6765));if(_0x9e6765[_0xa671('0x1d')]){if(_0x9e6765[_0xa671('0x1d')][_0xa671('0x1e')]===0x1f4){logger[_0xa671('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x2e2c18,_0x9e6765[_0xa671('0x1d')]['message']);return _0x373dd5(_0x9e6765[_0xa671('0x1d')][_0xa671('0x1f')]);}logger[_0xa671('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x2e2c18,_0x9e6765['error'][_0xa671('0x1f')]);return _0xddcb05(_0x9e6765[_0xa671('0x1d')]['message']);}else{logger[_0xa671('0x20')](_0xa671('0x19'),_0x2e2c18,_0xa671('0x1a'));_0xddcb05(_0x9e6765[_0xa671('0x21')][_0xa671('0x1f')]);}})[_0xa671('0x22')](function(_0x3f5d85){logger[_0xa671('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x2e2c18,_0x3f5d85);_0x373dd5(_0x3f5d85);});});}function respondWithStatusCode(_0x28d586,_0xf2110f){_0xf2110f=_0xf2110f||0xcc;return function(_0x31ab5a){if(_0x31ab5a){return _0x28d586[_0xa671('0x23')](_0xf2110f);}return _0x28d586[_0xa671('0x24')](_0xf2110f)[_0xa671('0x25')]();};}function respondWithResult(_0x306648,_0x1ff023){_0x1ff023=_0x1ff023||0xc8;return function(_0x2cd231){if(_0x2cd231){return _0x306648[_0xa671('0x24')](_0x1ff023)[_0xa671('0x26')](_0x2cd231);}};}function respondWithFilteredResult(_0x48efd0,_0x461a6d){return function(_0x563ad5){if(_0x563ad5){var _0x3b6702=typeof _0x461a6d[_0xa671('0x27')]==='undefined'&&typeof _0x461a6d['limit']===_0xa671('0x28');var _0x46ddd2=_0x563ad5[_0xa671('0x29')];var _0xc5d732=_0x3b6702?0x0:_0x461a6d[_0xa671('0x27')];var _0x2b3b1c=_0x3b6702?_0x563ad5[_0xa671('0x29')]:_0x461a6d[_0xa671('0x27')]+_0x461a6d[_0xa671('0x2a')];var _0xcfbc74;if(_0x2b3b1c>=_0x46ddd2){_0x2b3b1c=_0x46ddd2;_0xcfbc74=0xc8;}else{_0xcfbc74=0xce;}_0x48efd0[_0xa671('0x24')](_0xcfbc74);return _0x48efd0[_0xa671('0x2b')](_0xa671('0x2c'),_0xc5d732+'-'+_0x2b3b1c+'/'+_0x46ddd2)[_0xa671('0x26')](_0x563ad5);}return null;};}function saveUpdates(_0x2689ed){return function(_0x5be149){if(_0x5be149){return _0x5be149[_0xa671('0x2d')](_0x2689ed)[_0xa671('0x18')](function(_0x2f3697){return _0x2f3697;});}return null;};}function removeEntity(_0x4a5c17){return function(_0x431c9b){if(_0x431c9b){return _0x431c9b[_0xa671('0x2e')]()[_0xa671('0x18')](function(){var _0x12e528=_0x431c9b[_0xa671('0x2f')]({'plain':!![]});var _0x32ff1b=_0xa671('0x30');return db[_0xa671('0x31')][_0xa671('0x2e')]({'where':{'type':_0x32ff1b,'resourceId':_0x12e528['id']}})[_0xa671('0x18')](function(){return _0x431c9b;});})[_0xa671('0x18')](function(){_0x4a5c17[_0xa671('0x24')](0xcc)[_0xa671('0x25')]();});}};}function handleEntityNotFound(_0x4e4713){return function(_0x3aaa82){if(!_0x3aaa82){_0x4e4713[_0xa671('0x23')](0x194);}return _0x3aaa82;};}function handleError(_0x23f20d,_0x1374ff){_0x1374ff=_0x1374ff||0x1f4;return function(_0x263b40){logger[_0xa671('0x1d')](_0x263b40[_0xa671('0x32')]);if(_0x263b40[_0xa671('0x33')]){delete _0x263b40[_0xa671('0x33')];}_0x23f20d[_0xa671('0x24')](_0x1374ff)['send'](_0x263b40);};}function iftimePromise(_0x231cdb,_0x1c0c44){return respondWithRpcPromise(_0xa671('0x34'),_0xa671('0x35'),{'command':_0x1c0c44[_0xa671('0x36')]?util[_0xa671('0x37')]('iftime\x20%s,%s',_0x231cdb[_0xa671('0x38')],_0x1c0c44[_0xa671('0x36')]):util[_0xa671('0x37')]('iftime\x20%s',_0x231cdb[_0xa671('0x38')])},client9002)[_0xa671('0x18')](function(_0x3e8ee0){var _0x4f166d=_0x3e8ee0&&_0x3e8ee0[_0xa671('0x39')]('true')>=0x0?!![]:![];logger['info'](_0xa671('0x3a'),_0x1c0c44['id'],_0x231cdb['id'],_0x231cdb[_0xa671('0x38')],_0x4f166d?_0xa671('0x3b'):'OFFLINE',_0x1c0c44[_0xa671('0x36')]?_0x1c0c44[_0xa671('0x36')]:'No\x20timezone');return _0x4f166d;})[_0xa671('0x22')](function(_0x3b7566){logger[_0xa671('0x1d')](_0xa671('0x3a'),_0x1c0c44['id'],_0x231cdb['id'],_0x231cdb['interval'],util[_0xa671('0x3c')](_0x3b7566,{'showHidden':![],'depth':null}),_0x1c0c44['timezone']?_0x1c0c44[_0xa671('0x36')]:_0xa671('0x3d'));return![];});}function checkWebsiteIntervals(_0x3a7879){var _0xfa06ae=_[_0xa671('0x3e')](_0x3a7879['Interval']['Intervals'],function(_0x49cf9f){var _0x36158c=_0x49cf9f[_0xa671('0x2f')]({'plain':!![]});return iftimePromise(_0x36158c,_0x3a7879);});return Promise[_0xa671('0x3f')](_0xfa06ae)[_0xa671('0x18')](function(_0x23fb31){return _[_0xa671('0x40')](_0x23fb31);});}function createInteractionObject(_0x2ea5da,_0x3c1173,_0x4a6dfb,_0x10b51f){var _0x1bb826=require('user-agent-parser');var _0x455bb4=new _0x1bb826();var _0x5786c5=_0x455bb4[_0xa671('0x41')](_0x4a6dfb[_0xa671('0x42')])[_0xa671('0x43')]();var _0x4aed93=_0x3c1173[_0xa671('0x44')];if(_0x4a6dfb[_0xa671('0x45')]){_0x4aed93=_0x4a6dfb['cf-connecting-ip'];}else if(_0x4a6dfb['x-forwarded-for']){_0x4aed93=_[_0xa671('0x46')](_0x4a6dfb[_0xa671('0x47')][_0xa671('0x48')](','));}return{'ContactId':_0x10b51f['id'],'ChatWebsiteId':_0x2ea5da,'from':(_0x10b51f[_0xa671('0x49')]||'')+'\x20'+(_0x10b51f[_0xa671('0x4a')]||''),'customerIp':_0x4aed93,'customerPort':_0x4a6dfb[_0xa671('0x4b')]?_0x4a6dfb['x-real-port']:null,'referer':_0x3c1173[_0xa671('0x4c')],'browserName':_0x5786c5[_0xa671('0x4d')][_0xa671('0x33')]&&_0x5786c5[_0xa671('0x4d')]['version']?util[_0xa671('0x37')](_0xa671('0x4e'),_0x5786c5['browser'][_0xa671('0x33')],_0x5786c5[_0xa671('0x4d')]['version']):_0xa671('0x4f'),'browserVersion':_0x5786c5[_0xa671('0x4d')][_0xa671('0x50')]||'unknown','osName':util[_0xa671('0x37')](_0xa671('0x4e'),_0x5786c5['os']['name'],_0x5786c5['os'][_0xa671('0x50')]),'osVersion':_0x5786c5['os'][_0xa671('0x50')],'deviceModel':_0x5786c5[_0xa671('0x51')]['model']&&_0x5786c5[_0xa671('0x51')][_0xa671('0x52')]?util['format'](_0xa671('0x53'),_0x5786c5[_0xa671('0x51')][_0xa671('0x54')],_0x5786c5[_0xa671('0x51')][_0xa671('0x52')],_0x5786c5[_0xa671('0x51')][_0xa671('0x55')]):null,'deviceVendor':_0x5786c5['device'][_0xa671('0x52')],'deviceType':_0x5786c5[_0xa671('0x51')]['type'],'formData':JSON[_0xa671('0x1c')](_0x3c1173)};}exports[_0xa671('0x56')]=function(_0x3133d4,_0x1a1200){var _0x29fcd8={'include':[{'model':db[_0xa671('0x57')],'as':_0xa671('0x58')}]},_0x25abdb={},_0x43f71f={'count':0x0,'rows':[]};var _0x163c20=_[_0xa671('0x3e')](db[_0xa671('0x59')][_0xa671('0x5a')],function(_0x2eaa05){return{'name':_0x2eaa05[_0xa671('0x5b')],'type':_0x2eaa05[_0xa671('0x55')][_0xa671('0x5c')]};});_0x25abdb[_0xa671('0x54')]=_[_0xa671('0x3e')](_0x163c20,_0xa671('0x33'));_0x25abdb[_0xa671('0x5d')]=_['keys'](_0x3133d4[_0xa671('0x5d')]);_0x25abdb['filters']=_[_0xa671('0x5e')](_0x25abdb[_0xa671('0x54')],_0x25abdb[_0xa671('0x5d')]);_0x29fcd8[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x25abdb[_0xa671('0x54')],qs[_0xa671('0x60')](_0x3133d4[_0xa671('0x5d')]['fields']));_0x29fcd8[_0xa671('0x5f')]=_0x29fcd8[_0xa671('0x5f')][_0xa671('0x61')]?_0x29fcd8[_0xa671('0x5f')]:_0x25abdb['model'];if(!_0x3133d4[_0xa671('0x5d')][_0xa671('0x62')](_0xa671('0x63'))){_0x29fcd8[_0xa671('0x2a')]=qs[_0xa671('0x2a')](_0x3133d4['query'][_0xa671('0x2a')]);_0x29fcd8['offset']=qs[_0xa671('0x27')](_0x3133d4[_0xa671('0x5d')][_0xa671('0x27')]);}_0x29fcd8['order']=qs[_0xa671('0x64')](_0x3133d4[_0xa671('0x5d')]['sort']);_0x29fcd8[_0xa671('0x65')]=qs[_0xa671('0x66')](_[_0xa671('0x67')](_0x3133d4['query'],_0x25abdb[_0xa671('0x66')]),_0x163c20);if(_0x3133d4[_0xa671('0x5d')][_0xa671('0x68')]){_0x29fcd8[_0xa671('0x65')]=_['merge'](_0x29fcd8[_0xa671('0x65')],{'$or':_['map'](_0x163c20,function(_0x5cc41b){if(_0x5cc41b[_0xa671('0x55')]!=='VIRTUAL'){var _0x136280={};_0x136280[_0x5cc41b[_0xa671('0x33')]]={'$like':'%'+_0x3133d4[_0xa671('0x5d')]['filter']+'%'};return _0x136280;}})});}_0x29fcd8=_['merge']({},_0x29fcd8,_0x3133d4[_0xa671('0x69')]);var _0x48c0b3={'where':_0x29fcd8[_0xa671('0x65')]};return db[_0xa671('0x59')][_0xa671('0x29')](_0x48c0b3)['then'](function(_0x2b95d1){_0x43f71f[_0xa671('0x29')]=_0x2b95d1;if(_0x3133d4[_0xa671('0x5d')][_0xa671('0x6a')]){_0x29fcd8['include']=[{'all':!![]}];}return db[_0xa671('0x59')][_0xa671('0x6b')](_0x29fcd8);})[_0xa671('0x18')](function(_0x589a2b){_0x43f71f['rows']=_0x589a2b;return _0x43f71f;})[_0xa671('0x18')](respondWithFilteredResult(_0x1a1200,_0x29fcd8))[_0xa671('0x22')](handleError(_0x1a1200,null));};exports['show']=function(_0x4d7930,_0x4596e4){var _0x466f69={'raw':![],'where':{'id':_0x4d7930['params']['id']},'include':[{'model':db['Pause'],'as':_0xa671('0x58')}]},_0x1397ac={};_0x1397ac[_0xa671('0x54')]=_['keys'](db['ChatWebsite'][_0xa671('0x5a')]);_0x1397ac['query']=_['keys'](_0x4d7930[_0xa671('0x5d')]);_0x1397ac[_0xa671('0x66')]=_[_0xa671('0x5e')](_0x1397ac[_0xa671('0x54')],_0x1397ac[_0xa671('0x5d')]);_0x466f69[_0xa671('0x5f')]=_['intersection'](_0x1397ac[_0xa671('0x54')],qs[_0xa671('0x60')](_0x4d7930[_0xa671('0x5d')][_0xa671('0x60')]));_0x466f69['attributes']=_0x466f69['attributes'][_0xa671('0x61')]?_0x466f69[_0xa671('0x5f')]:_0x1397ac['model'];if(_0x4d7930[_0xa671('0x5d')][_0xa671('0x6a')]){_0x466f69[_0xa671('0x6c')]=[{'all':!![]}];}_0x466f69=_['merge']({},_0x466f69,_0x4d7930[_0xa671('0x69')]);return db[_0xa671('0x59')][_0xa671('0x6d')](_0x466f69)['then'](handleEntityNotFound(_0x4596e4,null))['then'](respondWithResult(_0x4596e4,null))[_0xa671('0x22')](handleError(_0x4596e4,null));};exports[_0xa671('0x6e')]=function(_0x44b859,_0x1ff0e0){return db[_0xa671('0x59')][_0xa671('0x6e')](_0x44b859[_0xa671('0x6f')],{})[_0xa671('0x18')](function(_0x83cee0){var _0x18a93a=_0x44b859['user'][_0xa671('0x2f')]({'plain':!![]});if(!_0x18a93a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18a93a[_0xa671('0x70')]==='user'){var _0x4e4332=_0x83cee0[_0xa671('0x2f')]({'plain':!![]});var _0x13541f='ChatWebsites';return db[_0xa671('0x71')][_0xa671('0x6d')]({'where':{'name':_0x13541f,'userProfileId':_0x18a93a[_0xa671('0x72')]},'raw':!![]})['then'](function(_0x262a92){if(_0x262a92&&_0x262a92[_0xa671('0x73')]===0x0){return db[_0xa671('0x31')][_0xa671('0x6e')]({'name':_0x4e4332[_0xa671('0x33')],'resourceId':_0x4e4332['id'],'type':_0x262a92[_0xa671('0x33')],'sectionId':_0x262a92['id']},{})[_0xa671('0x18')](function(){return _0x83cee0;});}else{return _0x83cee0;}})[_0xa671('0x22')](function(_0xbfd306){logger[_0xa671('0x1d')](_0xa671('0x74'),_0xbfd306);throw _0xbfd306;});}return _0x83cee0;})[_0xa671('0x18')](respondWithResult(_0x1ff0e0,0xc9))['catch'](handleError(_0x1ff0e0,null));};exports['update']=function(_0x1c3627,_0x1566aa){if(_0x1c3627['body']['id']){delete _0x1c3627[_0xa671('0x6f')]['id'];}return db[_0xa671('0x59')]['find']({'where':{'id':_0x1c3627[_0xa671('0x75')]['id']},'include':[{'model':db[_0xa671('0x57')],'as':_0xa671('0x58')}]})[_0xa671('0x18')](handleEntityNotFound(_0x1566aa,null))[_0xa671('0x18')](saveUpdates(_0x1c3627[_0xa671('0x6f')],null))[_0xa671('0x18')](respondWithResult(_0x1566aa,null))['catch'](handleError(_0x1566aa,null));};exports[_0xa671('0x2e')]=function(_0x492be5,_0x4b0e7a){return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x492be5['params']['id']}})['then'](handleEntityNotFound(_0x4b0e7a,null))[_0xa671('0x18')](removeEntity(_0x4b0e7a,null))[_0xa671('0x22')](handleError(_0x4b0e7a,null));};exports[_0xa671('0x76')]=function(_0x2c3611,_0x3f6f3a){return db[_0xa671('0x59')]['describe']()[_0xa671('0x18')](respondWithResult(_0x3f6f3a,null))[_0xa671('0x22')](handleError(_0x3f6f3a,null));};exports['addDisposition']=function(_0x615d9,_0x42c381){if(_0x615d9[_0xa671('0x6f')]['id']){delete _0x615d9[_0xa671('0x6f')]['id'];}return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x615d9[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x42c381,null))[_0xa671('0x18')](function(_0x210ec7){if(_0x210ec7){_0x615d9[_0xa671('0x6f')]['ChatWebsiteId']=_0x210ec7['id'];return db[_0xa671('0x77')][_0xa671('0x6e')](_0x615d9[_0xa671('0x6f')]);}})['then'](respondWithResult(_0x42c381,null))[_0xa671('0x22')](handleError(_0x42c381,null));};exports[_0xa671('0x78')]=function(_0x5f83e4,_0x113b33){var _0x18b906={'raw':![],'where':{}};var _0x13eef0={};var _0x3ff43f={'count':0x0,'rows':[]};return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x5f83e4[_0xa671('0x75')]['id']}})['then'](handleEntityNotFound(_0x113b33,null))[_0xa671('0x18')](function(_0x3a4bd3){if(_0x3a4bd3){_0x13eef0[_0xa671('0x54')]=_['keys'](db[_0xa671('0x77')][_0xa671('0x5a')]);_0x13eef0[_0xa671('0x5d')]=_['keys'](_0x5f83e4['query']);_0x13eef0[_0xa671('0x66')]=_[_0xa671('0x5e')](_0x13eef0[_0xa671('0x54')],_0x13eef0[_0xa671('0x5d')]);_0x18b906[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x13eef0[_0xa671('0x54')],qs[_0xa671('0x60')](_0x5f83e4[_0xa671('0x5d')][_0xa671('0x60')]));_0x18b906[_0xa671('0x5f')]=_0x18b906[_0xa671('0x5f')]['length']?_0x18b906[_0xa671('0x5f')]:_0x13eef0['model'];if(!_0x5f83e4['query'][_0xa671('0x62')](_0xa671('0x63'))){_0x18b906[_0xa671('0x2a')]=qs['limit'](_0x5f83e4[_0xa671('0x5d')][_0xa671('0x2a')]);_0x18b906[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x5f83e4[_0xa671('0x5d')]['offset']);}_0x18b906[_0xa671('0x7a')]=qs['sort'](_0x5f83e4['query']['sort']);_0x18b906[_0xa671('0x65')]=qs[_0xa671('0x66')](_[_0xa671('0x67')](_0x5f83e4['query'],_0x13eef0[_0xa671('0x66')]));_0x18b906[_0xa671('0x65')][_0xa671('0x7b')]=_0x3a4bd3['id'];if(_0x5f83e4[_0xa671('0x5d')][_0xa671('0x68')]){_0x18b906[_0xa671('0x65')]=_[_0xa671('0x7c')](_0x18b906[_0xa671('0x65')],{'$or':_[_0xa671('0x3e')](_0x18b906[_0xa671('0x5f')],function(_0x3b3a50){var _0x51f406={};_0x51f406[_0x3b3a50]={'$like':'%'+_0x5f83e4[_0xa671('0x5d')][_0xa671('0x68')]+'%'};return _0x51f406;})});}_0x18b906=_['merge']({},_0x18b906,_0x5f83e4[_0xa671('0x69')]);return db[_0xa671('0x77')][_0xa671('0x29')]({'where':_0x18b906[_0xa671('0x65')]})[_0xa671('0x18')](function(_0x27587a){_0x3ff43f[_0xa671('0x29')]=_0x27587a;if(_0x5f83e4[_0xa671('0x5d')][_0xa671('0x6a')]){_0x18b906['include']=[{'all':!![]}];}return db[_0xa671('0x77')][_0xa671('0x6b')](_0x18b906);})[_0xa671('0x18')](function(_0x3fd62d){_0x3ff43f[_0xa671('0x7d')]=_0x3fd62d;return _0x3ff43f;});}})['then'](respondWithFilteredResult(_0x113b33,_0x18b906))['catch'](handleError(_0x113b33,null));};exports[_0xa671('0x7e')]=function(_0x44a4ad,_0x3aae7e){return db['ChatWebsite'][_0xa671('0x6d')]({'where':{'id':_0x44a4ad[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x3aae7e,null))[_0xa671('0x18')](function(_0x12574e){if(_0x12574e){return _0x12574e[_0xa671('0x7e')](_0x44a4ad[_0xa671('0x5d')][_0xa671('0x7f')]);}})['then'](respondWithStatusCode(_0x3aae7e,null))[_0xa671('0x22')](handleError(_0x3aae7e,null));};exports['addAnswer']=function(_0x5c34a6,_0x124a98){if(_0x5c34a6[_0xa671('0x6f')]['id']){delete _0x5c34a6[_0xa671('0x6f')]['id'];}return db['ChatWebsite'][_0xa671('0x6d')]({'where':{'id':_0x5c34a6[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x124a98,null))[_0xa671('0x18')](function(_0x37a335){if(_0x37a335){_0x5c34a6[_0xa671('0x6f')][_0xa671('0x7b')]=_0x37a335['id'];return db[_0xa671('0x80')][_0xa671('0x6e')](_0x5c34a6[_0xa671('0x6f')]);}})[_0xa671('0x18')](respondWithResult(_0x124a98,null))[_0xa671('0x22')](handleError(_0x124a98,null));};exports[_0xa671('0x81')]=function(_0x30f0f9,_0x3dac8c){var _0x2194d7={'raw':![],'where':{}};var _0x27d61c={};var _0x8492d1={'count':0x0,'rows':[]};return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x30f0f9[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x3dac8c,null))[_0xa671('0x18')](function(_0x18906c){if(_0x18906c){_0x27d61c[_0xa671('0x54')]=_[_0xa671('0x82')](db['CannedAnswer'][_0xa671('0x5a')]);_0x27d61c['query']=_[_0xa671('0x82')](_0x30f0f9['query']);_0x27d61c['filters']=_[_0xa671('0x5e')](_0x27d61c['model'],_0x27d61c[_0xa671('0x5d')]);_0x2194d7['attributes']=_[_0xa671('0x5e')](_0x27d61c[_0xa671('0x54')],qs[_0xa671('0x60')](_0x30f0f9['query']['fields']));_0x2194d7[_0xa671('0x5f')]=_0x2194d7[_0xa671('0x5f')][_0xa671('0x61')]?_0x2194d7[_0xa671('0x5f')]:_0x27d61c['model'];if(!_0x30f0f9['query'][_0xa671('0x62')](_0xa671('0x63'))){_0x2194d7['limit']=qs['limit'](_0x30f0f9['query'][_0xa671('0x2a')]);_0x2194d7[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x30f0f9['query'][_0xa671('0x27')]);}_0x2194d7[_0xa671('0x7a')]=qs[_0xa671('0x64')](_0x30f0f9[_0xa671('0x5d')]['sort']);_0x2194d7[_0xa671('0x65')]=qs['filters'](_['pick'](_0x30f0f9[_0xa671('0x5d')],_0x27d61c['filters']));_0x2194d7['where']['ChatWebsiteId']=_0x18906c['id'];if(_0x30f0f9['query'][_0xa671('0x68')]){_0x2194d7[_0xa671('0x65')]=_[_0xa671('0x7c')](_0x2194d7[_0xa671('0x65')],{'$or':_[_0xa671('0x3e')](_0x2194d7[_0xa671('0x5f')],function(_0x44f87a){var _0x36352c={};_0x36352c[_0x44f87a]={'$like':'%'+_0x30f0f9['query']['filter']+'%'};return _0x36352c;})});}_0x2194d7=_[_0xa671('0x7c')]({},_0x2194d7,_0x30f0f9[_0xa671('0x69')]);return db[_0xa671('0x80')]['count']({'where':_0x2194d7[_0xa671('0x65')]})[_0xa671('0x18')](function(_0x31836b){_0x8492d1[_0xa671('0x29')]=_0x31836b;if(_0x30f0f9['query']['includeAll']){_0x2194d7[_0xa671('0x6c')]=[{'all':!![]}];}return db[_0xa671('0x80')]['findAll'](_0x2194d7);})[_0xa671('0x18')](function(_0xa20825){_0x8492d1[_0xa671('0x7d')]=_0xa20825;return _0x8492d1;});}})['then'](respondWithFilteredResult(_0x3dac8c,_0x2194d7))['catch'](handleError(_0x3dac8c,null));};exports[_0xa671('0x83')]=function(_0x542735,_0x5c0e4a){return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x542735['params']['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x5c0e4a,null))['then'](function(_0x2c7e77){if(_0x2c7e77){return _0x2c7e77[_0xa671('0x83')](_0x542735['query'][_0xa671('0x7f')]);}})[_0xa671('0x18')](respondWithStatusCode(_0x5c0e4a,null))[_0xa671('0x22')](handleError(_0x5c0e4a,null));};exports[_0xa671('0x84')]=function(_0x361e3b,_0x31abe8){_0x361e3b[_0xa671('0x6f')][_0xa671('0x85')]=_0x361e3b[_0xa671('0x86')][_0xa671('0x87')];return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x361e3b[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x31abe8,null))[_0xa671('0x18')](saveUpdates(_0x361e3b['body'],null))[_0xa671('0x18')](respondWithResult(_0x31abe8,null))['catch'](handleError(_0x31abe8,null));};exports[_0xa671('0x88')]=function(_0x439141,_0x195019){_0x439141['body'][_0xa671('0x89')]=_0x439141[_0xa671('0x86')][_0xa671('0x87')];return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x439141[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x195019,null))[_0xa671('0x18')](saveUpdates(_0x439141[_0xa671('0x6f')],null))[_0xa671('0x18')](respondWithResult(_0x195019,null))[_0xa671('0x22')](handleError(_0x195019,null));};exports['addCustomerAvatar']=function(_0x51eed8,_0x8b5a88){_0x51eed8['body']['customerAvatar']=_0x51eed8[_0xa671('0x86')][_0xa671('0x87')];return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x51eed8[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x8b5a88,null))[_0xa671('0x18')](saveUpdates(_0x51eed8[_0xa671('0x6f')],null))[_0xa671('0x18')](respondWithResult(_0x8b5a88,null))[_0xa671('0x22')](handleError(_0x8b5a88,null));};exports[_0xa671('0x8a')]=function(_0x11cf22,_0x3fc688){_0x11cf22[_0xa671('0x6f')][_0xa671('0x8b')]=_0x11cf22[_0xa671('0x86')][_0xa671('0x87')];return db[_0xa671('0x59')]['find']({'where':{'id':_0x11cf22[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x3fc688,null))[_0xa671('0x18')](saveUpdates(_0x11cf22[_0xa671('0x6f')],null))['then'](respondWithResult(_0x3fc688,null))[_0xa671('0x22')](handleError(_0x3fc688,null));};exports[_0xa671('0x8c')]=function(_0x3879da,_0x443f39){var _0x239417=path[_0xa671('0x8d')](config[_0xa671('0x8e')],'server/files/images/logos/default_logo.svg');var _0x3223c6={'where':{'id':_0x3879da[_0xa671('0x75')]['id']},'attributes':['id',_0xa671('0x85')],'raw':!![]};var _0x321345=![];return require(_0xa671('0x8f'))[_0xa671('0x90')]()['then'](function(_0x28e306){if(_0x28e306){_0x321345=_0x28e306[_0xa671('0x91')];}})[_0xa671('0x18')](function(){return db[_0xa671('0x59')][_0xa671('0x6d')](_0x3223c6);})[_0xa671('0x18')](handleEntityNotFound(_0x443f39,null))[_0xa671('0x18')](function(_0x257c65){if(_0x257c65){if(!_[_0xa671('0x92')](_0x257c65[_0xa671('0x85')])){if(fs[_0xa671('0x93')](path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x94'),_0x257c65[_0xa671('0x85')]))&&_0x321345){_0x239417=path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x94'),_0x257c65['sitepic']);}}return _0x443f39[_0xa671('0x95')](_0x239417);}})[_0xa671('0x22')](handleError(_0x443f39,null));};exports['getAvatar']=function(_0x5d3057,_0x2f3514){var _0x4893d3=path['join'](config['root'],_0xa671('0x96'));var _0x276831={'where':{'id':_0x5d3057[_0xa671('0x75')]['id']},'attributes':['id',_0xa671('0x89')],'raw':!![]};return db[_0xa671('0x59')][_0xa671('0x6d')](_0x276831)[_0xa671('0x18')](handleEntityNotFound(_0x2f3514,null))[_0xa671('0x18')](function(_0x8eb126){if(_0x8eb126){if(!_['isNil'](_0x8eb126['agentAvatar'])){if(fs[_0xa671('0x93')](path['join'](config[_0xa671('0x8e')],_0xa671('0x97'),_0x8eb126['agentAvatar']))){_0x4893d3=path[_0xa671('0x8d')](config[_0xa671('0x8e')],'server/files/images/avatars/',_0x8eb126[_0xa671('0x89')]);}}return _0x2f3514[_0xa671('0x95')](_0x4893d3);}})['catch'](handleError(_0x2f3514,null));};exports[_0xa671('0x98')]=function(_0x5a2e12,_0x1a789b){var _0x1d1ff4=path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x99'));var _0x441ecb={'where':{'id':_0x5a2e12['params']['id']},'attributes':['id','customerAvatar',_0xa671('0x9a')],'raw':!![]};return db['ChatWebsite'][_0xa671('0x6d')](_0x441ecb)[_0xa671('0x18')](handleEntityNotFound(_0x1a789b,null))[_0xa671('0x18')](function(_0x3e09d0){if(_0x3e09d0){if(!_[_0xa671('0x92')](_0x3e09d0[_0xa671('0x9b')])){if(fs[_0xa671('0x93')](path[_0xa671('0x8d')](config['root'],_0xa671('0x97'),_0x3e09d0[_0xa671('0x9b')]))&&_0x3e09d0[_0xa671('0x9a')]){_0x1d1ff4=path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x97'),_0x3e09d0[_0xa671('0x9b')]);}}return _0x1a789b['download'](_0x1d1ff4);}})[_0xa671('0x22')](handleError(_0x1a789b,null));};exports[_0xa671('0x9c')]=function(_0x362c31,_0x42098e){var _0x44838a=path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x9d'));var _0x45da4b={'where':{'id':_0x362c31['params']['id']},'attributes':['id',_0xa671('0x8b')],'raw':!![]};return db[_0xa671('0x59')][_0xa671('0x6d')](_0x45da4b)[_0xa671('0x18')](handleEntityNotFound(_0x42098e,null))['then'](function(_0x150978){if(_0x150978){if(!_['isNil'](_0x150978[_0xa671('0x8b')])){if(fs[_0xa671('0x93')](path[_0xa671('0x8d')](config['root'],_0xa671('0x97'),_0x150978[_0xa671('0x8b')]))){_0x44838a=path[_0xa671('0x8d')](config[_0xa671('0x8e')],'server/files/images/avatars/',_0x150978[_0xa671('0x8b')]);}}return _0x42098e[_0xa671('0x95')](_0x44838a);}})[_0xa671('0x22')](handleError(_0x42098e,null));};exports[_0xa671('0x9e')]=function(_0xd3307a,_0x2d126b){var _0x231a8d={'body':_0xd3307a[_0xa671('0x6f')],'channel':_0xa671('0x9f')};var _0x10d739=[];var _0x167912=[];var _0x26a137={};var _0x33786f=![];return db[_0xa671('0xa0')][_0xa671('0x76')]()[_0xa671('0x18')](function(_0x41e31c){if(!_0x41e31c){throw new db[(_0xa671('0xa1'))]['ValidationError'](_0xa671('0xa2'));}_0x10d739=_['difference'](_[_0xa671('0x82')](_0x41e31c),[_0xa671('0xa3'),'updatedAt']);_0x167912=_[_0xa671('0xa4')](_[_0xa671('0x82')](_0x41e31c),['createdAt',_0xa671('0xa5'),'CompanyId',_0xa671('0xa6')]);if(_0xd3307a[_0xa671('0x6f')]['id']){delete _0xd3307a[_0xa671('0x6f')]['id'];}if(_[_0xa671('0x92')](_0xd3307a[_0xa671('0x6f')][_0xa671('0xa7')])){throw new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))](_0xa671('0xa9'));}if(_[_0xa671('0x92')](_0xd3307a[_0xa671('0x6f')]['body'])||_0xd3307a[_0xa671('0x6f')]['body']===''){throw new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xd3307a[_0xa671('0x6f')][_0xa671('0xaa')])){throw new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))](_0xa671('0xab')+_0x167912);}if(!_[_0xa671('0xac')](_0x167912,_0xd3307a[_0xa671('0x6f')][_0xa671('0xaa')])){throw new db['Sequelize'][(_0xa671('0xa8'))](_0xa671('0xad')+_0x167912);}_0x26a137[_0xd3307a['body'][_0xa671('0xaa')]]=_0xd3307a[_0xa671('0x6f')]['from'];})[_0xa671('0x18')](function(){return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0xd3307a[_0xa671('0x75')]['id']},'include':[{'model':db[_0xa671('0xae')],'as':_0xa671('0xaf'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x26a137,'limit':0x1,'order':[[_0xa671('0xa5'),_0xa671('0xb0')]]}]},{'model':db[_0xa671('0xb1')],'as':_0xa671('0xb2')},{'model':db[_0xa671('0xb3')],'as':_0xa671('0xb3'),'include':[{'model':db[_0xa671('0xb3')],'as':_0xa671('0xb4'),'attributes':['id',_0xa671('0x38')],'raw':!![]}]}]});})[_0xa671('0x18')](function(_0x1a5606){if(!_0x1a5606)throw new APINotFoundError(util['format'](_0xa671('0xb5'),_0xd3307a['params']['id']));if(!_0x1a5606[_0xa671('0xb3')]||!_0x1a5606[_0xa671('0xb3')][_0xa671('0xb4')])return[_0x1a5606,!![]];return[_0x1a5606,checkWebsiteIntervals(_0x1a5606)];})['spread'](function(_0x40c7fe,_0x5db064){if(!_0x5db064)throw new APIOutOfIntervalError();if(!_0x40c7fe['List'])return;_0x231a8d[_0xa671('0xb6')]=_0x40c7fe;_0x231a8d[_0xa671('0xb7')]=_0x40c7fe[_0xa671('0xaf')];_0x231a8d[_0xa671('0xb8')]=_[_0xa671('0xb9')](_0x40c7fe[_0xa671('0xb2')],[_0xa671('0xba')],[_0xa671('0xbb')]);if(_0x231a8d[_0xa671('0xb6')][_0xa671('0xb2')]){delete _0x231a8d[_0xa671('0xb6')][_0xa671('0xb2')];}if(_0x231a8d[_0xa671('0xb6')][_0xa671('0xaf')]&&_0x231a8d[_0xa671('0xb6')][_0xa671('0xaf')][_0xa671('0xbc')][_0xa671('0x61')]){return _0x231a8d[_0xa671('0xb6')][_0xa671('0xaf')][_0xa671('0xbc')][0x0];}var _0x268793=_[_0xa671('0xbd')](_0xd3307a[_0xa671('0x6f')],{'firstName':_0xd3307a['body'][_0xa671('0xa7')],'ListId':_0x40c7fe['ListId']});_0x268793[_0xd3307a[_0xa671('0x6f')][_0xa671('0xaa')]]=_0xd3307a[_0xa671('0x6f')][_0xa671('0xa7')];return db[_0xa671('0xa0')]['create'](_0x268793,{'fields':_0x10d739,'raw':!![]});})[_0xa671('0x18')](function(_0x3c1892){_0x231a8d[_0xa671('0xbe')]=_0x3c1892;var _0x454ade=createInteractionObject(_0xd3307a['params']['id'],_0xd3307a['body'],_0xd3307a['headers'],_0x3c1892);var _0xcdd55c={'ChatWebsiteId':_0xd3307a[_0xa671('0x75')]['id'],'closed':![]};if(_0xd3307a['body']['threadId']){_0xcdd55c['threadId']=_0xd3307a[_0xa671('0x6f')]['threadId'];return db['ChatInteraction'][_0xa671('0x6d')]({'where':_0xcdd55c})[_0xa671('0x18')](function(_0x174dd0){if(_0x174dd0){_0x33786f=!![];return _0x174dd0;}_0x454ade[_0xa671('0xbf')]=_0xd3307a['body'][_0xa671('0xbf')];_0x454ade['externalUrl']=_0xd3307a[_0xa671('0x6f')][_0xa671('0xc0')];return db[_0xa671('0xc1')][_0xa671('0x6e')](_0x454ade);});}_0xcdd55c['ContactId']=_0x3c1892['id'];if(_0xd3307a[_0xa671('0x6f')][_0xa671('0xc2')]&&_0xd3307a[_0xa671('0x6f')][_0xa671('0xc2')]['id']){_0xcdd55c['id']=_0xd3307a[_0xa671('0x6f')][_0xa671('0xc2')]['id'];return db[_0xa671('0xc1')][_0xa671('0x6d')]({'where':_0xcdd55c})['then'](function(_0x2c5482){if(_0x2c5482){_0x33786f=!![];return _0x2c5482;}return db[_0xa671('0xc1')][_0xa671('0x6e')](_0x454ade);});}return db[_0xa671('0xc1')]['create'](_0x454ade);})[_0xa671('0x18')](function(_0x48368c){if(!_0x33786f)return _0x48368c;var _0x54a174={'from':(_0x231a8d[_0xa671('0xbe')][_0xa671('0x49')]||'')+'\x20'+(_0x231a8d[_0xa671('0xbe')][_0xa671('0x4a')]||'')};if(_0xd3307a[_0xa671('0x6f')][_0xa671('0xbf')]&&_0xd3307a[_0xa671('0x6f')][_0xa671('0xc3')]&&_0xd3307a['body'][_0xa671('0xbf')]!=_0xd3307a[_0xa671('0x6f')][_0xa671('0xc3')]){_0x54a174['threadId']=_0xd3307a[_0xa671('0x6f')][_0xa671('0xc3')];}return _0x48368c[_0xa671('0x2d')](_0x54a174);})[_0xa671('0x18')](function(_0x50bca0){_0x231a8d[_0xa671('0xc2')]=_0x50bca0['get']({'plain':!![]});_0x231a8d[_0xa671('0xc2')][_0xa671('0xc4')]=!_0x33786f;if(_0x231a8d[_0xa671('0xc2')][_0xa671('0xc4')]){if(_0x231a8d[_0xa671('0xb6')][_0xa671('0xc5')]){_0x231a8d['applications'][_0xa671('0xc6')]({'id':0x0,'priority':_0x231a8d[_0xa671('0xb8')]['length']+0x1,'app':_0xa671('0xc7'),'appdata':_0xa671('0xc8'),'interval':'*,*,*,*'});}}return db[_0xa671('0xc9')][_0xa671('0x6e')]({'body':_0xd3307a['body'][_0xa671('0x6f')],'ChatWebsiteId':_0xd3307a[_0xa671('0x75')]['id'],'ChatInteractionId':_0x50bca0['id'],'direction':'in','ContactId':_0x231a8d[_0xa671('0xbe')]['id'],'AttachmentId':_0xd3307a[_0xa671('0x6f')][_0xa671('0xca')]});})['then'](function(_0x5812b3){_0x231a8d[_0xa671('0x1f')]=_0x5812b3;if(!_0x231a8d[_0xa671('0xc2')][_0xa671('0xcb')]){return;}return db['User']['find']({'attributes':['id',_0xa671('0x33')],'where':{'id':_0x231a8d[_0xa671('0xc2')]['UserId']}});})[_0xa671('0x18')](function(_0x402863){if(_0x402863){_0x231a8d[_0xa671('0xb8')]['unshift']({'id':0x0,'priority':0x0,'app':_0xa671('0xcc'),'appdata':_0x402863[_0xa671('0x33')]+','+(_0x231a8d[_0xa671('0xb6')][_0xa671('0xcd')]||0xa),'interval':_0xa671('0xce')});_0x231a8d[_0xa671('0xcf')]=!![];}if(!_0x231a8d[_0xa671('0xc2')][_0xa671('0xd0')]){return;}return db[_0xa671('0xd1')][_0xa671('0x6d')]({'attributes':['id',_0xa671('0x33')],'where':{'id':_0x231a8d[_0xa671('0xc2')][_0xa671('0xd0')]}});})[_0xa671('0x18')](function(_0x33ad5c){if(_0x33ad5c){_0x231a8d['applications'][_0xa671('0xd2')]({'id':0x0,'priority':0x1,'app':_0xa671('0xd3'),'appdata':_0x33ad5c[_0xa671('0x33')]+','+(_0x231a8d[_0xa671('0xb6')][_0xa671('0xd4')]||0x12c),'interval':_0xa671('0xce')});}return respondWithRpcPromise(_0xa671('0xd5'),_0xa671('0xd6'),_0x231a8d);})[_0xa671('0x18')](function(_0x585c86){respondWithRpcPromise(_0xa671('0xd7'),_0xa671('0xd7'),{'event':_0xa671('0x9e'),'message':_0x585c86},client9002);return _0x585c86;})[_0xa671('0x18')](respondWithResult(_0x2d126b,null))[_0xa671('0x22')](APIHandleError(_0x2d126b));};exports[_0xa671('0xd8')]=function(_0x5a1f38,_0x4dbeb5){var _0x21b488,_0x315f1e,_0x5e28e8;var _0x4c3d6d=[];var _0x9ca8c2={};var _0xb50ab9=_0x5a1f38[_0xa671('0xd9')]||[];var _0x6baa4d=[];var _0x37a5b9;return db[_0xa671('0xa0')][_0xa671('0x76')]()[_0xa671('0x18')](function(_0x32295e){if(!_0x32295e){throw new db['Sequelize'][(_0xa671('0xa8'))](_0xa671('0xa2'));}_0x4c3d6d=_['difference'](_['keys'](_0x32295e),[_0xa671('0xa3'),_0xa671('0xa5'),_0xa671('0xda'),'ListId']);if(_0x5a1f38[_0xa671('0x6f')]['id']){delete _0x5a1f38[_0xa671('0x6f')]['id'];}if(_[_0xa671('0x92')](_0x5a1f38[_0xa671('0x6f')][_0xa671('0xa7')])){throw _0x4dbeb5[_0xa671('0x24')](0x1f4)['send'](new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))](_0xa671('0xa9')));}if(_[_0xa671('0x92')](_0x5a1f38[_0xa671('0x6f')][_0xa671('0x6f')])||_0x5a1f38[_0xa671('0x6f')][_0xa671('0x6f')]===''){throw _0x4dbeb5[_0xa671('0x24')](0x1f4)[_0xa671('0xdb')](new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xa671('0x92')](_0x5a1f38[_0xa671('0x6f')]['mapKeyOffline'])){throw _0x4dbeb5[_0xa671('0x24')](0x1f4)[_0xa671('0xdb')](new db[(_0xa671('0xa1'))][(_0xa671('0xa8'))](_0xa671('0xdc')+_0x4c3d6d));}if(!_[_0xa671('0xac')](_0x4c3d6d,_0x5a1f38[_0xa671('0x6f')][_0xa671('0xdd')])){throw _0x4dbeb5[_0xa671('0x24')](0x1f4)[_0xa671('0xdb')](new db['Sequelize']['ValidationError'](_0xa671('0xde')+_0x4c3d6d));}_0x9ca8c2[_0x5a1f38[_0xa671('0x6f')][_0xa671('0xdd')]]=_0x5a1f38[_0xa671('0x6f')]['from'];})[_0xa671('0x18')](function(){return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x5a1f38[_0xa671('0x75')]['id']},'include':[{'model':db['CmList'],'as':_0xa671('0xaf')},{'model':db[_0xa671('0xdf')],'as':_0xa671('0xdf')}]});})[_0xa671('0x18')](handleEntityNotFound(_0x4dbeb5,null))['then'](function(_0x44688e){if(_0x44688e&&_0x44688e['List']){_0x315f1e=_0x44688e;var _0x3f1ed2=_[_0xa671('0xbd')](_0x5a1f38[_0xa671('0x6f')],{'firstName':_0x5a1f38[_0xa671('0x6f')][_0xa671('0xa7')],'phone':_0x5a1f38['body'][_0xa671('0xa7')],'ListId':_0x44688e[_0xa671('0xa6')]});_0x3f1ed2[_0x5a1f38[_0xa671('0x6f')][_0xa671('0xdd')]]=_0x5a1f38[_0xa671('0x6f')][_0xa671('0xa7')];return db[_0xa671('0xa0')][_0xa671('0xe0')]({'where':_0x9ca8c2,'defaults':_0x3f1ed2});}})[_0xa671('0xe1')](function(_0xa34564){if(_0xa34564){_0x5e28e8=_0xa34564;var _0x2a3d8e=fs[_0xa671('0xe2')](path['join'](config[_0xa671('0x8e')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x244e61=ejs['render'](_0x2a3d8e,{'body':_[_0xa671('0xe3')](_0x5a1f38['body'][_0xa671('0x6f')]),'bodyTitle':_0x315f1e[_0xa671('0xe4')]});return db[_0xa671('0xe5')]['create']({'body':_0x244e61,'plainBody':htmlToText[_0xa671('0xe6')](_0x244e61),'ContactId':_0xa34564['id'],'ChatWebsiteId':_0x315f1e['id']});}})[_0xa671('0x18')](function(_0x2ef7a6){_0x37a5b9=_0x2ef7a6;if(_0xb50ab9['length']){var _0x220a1b=_0xb50ab9['map'](function(_0x194bf5){return{'name':_0x194bf5['originalname'],'basename':_0x194bf5[_0xa671('0x87')],'type':_0x194bf5['mimetype'],'ChatOfflineMessageId':_0x2ef7a6['id']};});_0x6baa4d=_0x220a1b[_0xa671('0x3e')](_0x5603b5=>{var _0x4ba825={'filename':_0x5603b5[_0xa671('0x33')],'path':path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0xe7'),'files',_0xa671('0xe8'),_0xa671('0xe9'),_0x5603b5[_0xa671('0xea')])};return _0x4ba825;});if(!_0x315f1e[_0xa671('0xeb')]){return db['sequelize'][_0xa671('0xec')](function(_0x62f02f){return db[_0xa671('0xed')]['bulkCreate'](_0x220a1b,{'transaction':_0x62f02f});});}}})['then'](function(){if(_0x37a5b9){_0x21b488=_0x37a5b9;return db[_0xa671('0xdf')][_0xa671('0x79')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xa671('0xee'),'raw':!![],'include':[{'model':db[_0xa671('0xef')],'as':_0xa671('0xef'),'raw':!![]}]}]});}})['then'](function(_0x24274b){if(_0x24274b&&_0x24274b[_0xa671('0xee')]&&_0x315f1e[_0xa671('0xf0')]&&_0x315f1e[_0xa671('0xf1')]){var _0x58a2bf=_0x24274b[_0xa671('0xf2')]();return respondWithRpcPromise(_0xa671('0xf3'),'sendMail',{'account':_0x58a2bf,'message':{'from':util[_0xa671('0x37')](_0xa671('0xf4'),_0x24274b['name'],_0x24274b[_0xa671('0xf5')]||_0x24274b[_0xa671('0xee')][_0xa671('0xf6')]),'to':_0x315f1e[_0xa671('0xf1')],'subject':_0x315f1e[_0xa671('0xf7')],'html':_0x21b488['body'],'attachments':_0x6baa4d}},client9003)[_0xa671('0x18')](function(){return _0x21b488;})[_0xa671('0x22')](function(_0x2cc72e){logger[_0xa671('0x1d')](_0x2cc72e);});}})['then'](function(){if(_0x315f1e&&_0x315f1e['openNewInteraction']&&_0x315f1e[_0xa671('0xf8')]){var _0xde4625=[];if(_0xb50ab9['length']){_0xde4625=_0xb50ab9['map'](function(_0x1f6e3a){return{'name':_0x1f6e3a[_0xa671('0xf9')],'basename':_0x1f6e3a[_0xa671('0x87')],'type':_0x1f6e3a[_0xa671('0xfa')],'ChatOfflineMessageId':_0x37a5b9['id']};});}var _0x6d444f;if(!_['isNil'](_0x315f1e[_0xa671('0xfb')])){var _0x389ef5=_['map'](_0x5a1f38[_0xa671('0x6f')],function(_0x56a103){return _0x56a103;});var _0x3c52b1=_[_0xa671('0xfc')](_0x389ef5)[0x0];var _0x21b4f1=_['mapValues'](_0x3c52b1,function(_0x3db0c4){return _0x3db0c4;});_0x6d444f=_0x21b4f1[0x1][_0x315f1e[_0xa671('0xfb')]];}var _0x416a0c={'from':_0x5e28e8[_0xa671('0xf5')],'firstName':_0x5e28e8[_0xa671('0x49')],'lastName':_0x5e28e8[_0xa671('0x4a')],'mapKey':_0xa671('0xf5'),'message':{'from':_0x5e28e8[_0xa671('0xf5')],'to':_0x315f1e['MailAccount'][_0xa671('0xf5')],'cc':'','subject':_[_0xa671('0x92')](_0x6d444f)?_0x315f1e[_0xa671('0xf7')]:_0x6d444f,'messageId':'','sentAt':new Date(),'attach':_0xde4625['length'],'attachments':_0xde4625,'originChannel':'Chat','ChatWebsiteId':_0x315f1e['id'],'ChatOfflineMessageId':_0x21b488['id'],'originTo':_0x315f1e['MailAccount'][_0xa671('0xf5')]},'body':_0x21b488[_0xa671('0x6f')]};var _0x180f0d={'account':{'id':_0x315f1e[_0xa671('0xf8')]},'body':_0x416a0c,'log':'NotifyMailAccount'};return respondWithRpcPromise(_0xa671('0xfd'),_0xa671('0xfe'),_0x180f0d,client9001)[_0xa671('0x18')](function(){return _0x21b488;})[_0xa671('0x22')](function(_0x416384){logger[_0xa671('0x1d')](_0x416384);});}return;})['then'](function(){if(_0x21b488){return _0x21b488;}})[_0xa671('0x18')](respondWithResult(_0x4dbeb5,null))[_0xa671('0x22')](function(){for(var _0x50dde1 of _0xb50ab9){var _0x3ef76a=path[_0xa671('0x8d')](config['root'],_0xa671('0xe7'),_0xa671('0xd9'),'attachments',_0xa671('0xe9'),_0x50dde1[_0xa671('0x87')]);fs_extra['remove'](_0x3ef76a)['catch'](function(_0x41e0b3){logger['error'](_0xa671('0xff'),_0x3ef76a,_0x41e0b3);});}});};exports[_0xa671('0x100')]=function(_0x1fa555,_0x59a8bb){return db[_0xa671('0xc1')]['find']({'where':{'id':_0x1fa555[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x59a8bb,null))[_0xa671('0x18')](function(_0x16fdfd){if(_0x16fdfd){return _0x16fdfd[_0xa671('0x100')](_0x1fa555['body'][_0xa671('0x7f')],_[_0xa671('0x101')](_0x1fa555['body'],[_0xa671('0x7f'),'id'])||{});}})['then'](respondWithResult(_0x59a8bb,null))[_0xa671('0x22')](handleError(_0x59a8bb,null));};exports[_0xa671('0x102')]=function(_0x57255b,_0x4fd3cc){var _0x50371f={'raw':![],'where':{}};var _0x36a3b9={};var _0x53d56f={'count':0x0,'rows':[]};return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x57255b[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x4fd3cc,null))[_0xa671('0x18')](function(_0x3b4cd7){if(_0x3b4cd7){_0x36a3b9[_0xa671('0x54')]=_[_0xa671('0x82')](db[_0xa671('0xc1')][_0xa671('0x5a')]);_0x36a3b9[_0xa671('0x5d')]=_[_0xa671('0x82')](_0x57255b[_0xa671('0x5d')]);_0x36a3b9[_0xa671('0x66')]=_[_0xa671('0x5e')](_0x36a3b9['model'],_0x36a3b9['query']);_0x50371f[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x36a3b9['model'],qs[_0xa671('0x60')](_0x57255b[_0xa671('0x5d')]['fields']));_0x50371f[_0xa671('0x5f')]=_0x50371f[_0xa671('0x5f')][_0xa671('0x61')]?_0x50371f[_0xa671('0x5f')]:_0x36a3b9[_0xa671('0x54')];if(!_0x57255b['query'][_0xa671('0x62')]('nolimit')){_0x50371f['limit']=qs[_0xa671('0x2a')](_0x57255b[_0xa671('0x5d')]['limit']);_0x50371f[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x57255b[_0xa671('0x5d')][_0xa671('0x27')]);}_0x50371f[_0xa671('0x7a')]=qs[_0xa671('0x64')](_0x57255b[_0xa671('0x5d')][_0xa671('0x64')]);_0x50371f['where']=qs['filters'](_[_0xa671('0x67')](_0x57255b['query'],_0x36a3b9[_0xa671('0x66')]));_0x50371f[_0xa671('0x65')][_0xa671('0x7b')]=_0x3b4cd7['id'];if(_0x57255b[_0xa671('0x5d')][_0xa671('0x68')]){_0x50371f[_0xa671('0x65')]=_[_0xa671('0x7c')](_0x50371f['where'],{'$or':_['map'](_0x50371f[_0xa671('0x5f')],function(_0x390352){var _0x479ecd={};_0x479ecd[_0x390352]={'$like':'%'+_0x57255b[_0xa671('0x5d')]['filter']+'%'};return _0x479ecd;})});}_0x50371f=_['merge']({},_0x50371f,_0x57255b[_0xa671('0x69')]);return db[_0xa671('0xc1')]['count']({'where':_0x50371f[_0xa671('0x65')]})[_0xa671('0x18')](function(_0x5a7b1a){_0x53d56f['count']=_0x5a7b1a;if(_0x57255b[_0xa671('0x5d')][_0xa671('0x6a')]){_0x50371f[_0xa671('0x6c')]=[{'model':db[_0xa671('0xa0')],'as':_0xa671('0x103'),'required':![]},{'model':db['User'],'as':_0xa671('0x104'),'attributes':['name',_0xa671('0x105'),'internal'],'required':![]},{'model':db[_0xa671('0x106')],'as':_0xa671('0x107'),'attributes':['id',_0xa671('0x33'),_0xa671('0x108')],'where':_0x57255b[_0xa671('0x5d')]['tag']?{'id':_0x57255b['query'][_0xa671('0x109')]}:undefined,'required':_0x57255b[_0xa671('0x5d')]['tag']?!![]:![]}];}return db[_0xa671('0xc1')]['findAll'](_0x50371f);})[_0xa671('0x18')](function(_0xb90da4){_0x53d56f['rows']=_0xb90da4;return _0x53d56f;});}})[_0xa671('0x18')](respondWithFilteredResult(_0x4fd3cc,_0x50371f))[_0xa671('0x22')](handleError(_0x4fd3cc,null));};exports[_0xa671('0x35')]=function(_0x521972,_0xfc8411){var _0x5c6dbe=0x0;var _0x52fea4=0x0;var _0x5aeae1=![];var _0x9e00af;var _0x2540f7;return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x521972[_0xa671('0x75')]['id']},'include':[{'model':db[_0xa671('0xb3')],'as':_0xa671('0xb3'),'include':[{'model':db[_0xa671('0xb3')],'as':'Intervals','attributes':['id','interval']}]}]})[_0xa671('0x18')](handleEntityNotFound(_0xfc8411,null))[_0xa671('0x18')](function(_0x5b9266){if(_0x5b9266){_0x9e00af=_0x5b9266;return _0x5b9266['getProactiveActions']({'raw':!![]});}})[_0xa671('0x18')](function(_0x1b77ff){if(_0x9e00af){if(_0x1b77ff){_0x2540f7=_0x1b77ff;}}return require('../../config/license/util')[_0xa671('0x90')]();})[_0xa671('0x18')](function(_0x337e9b){if(_0x337e9b){_0x52fea4=_0x337e9b['virtual'];_0x5aeae1=_0x337e9b[_0xa671('0x91')];}})[_0xa671('0x18')](function(){return db['ChatInteraction'][_0xa671('0x29')]({'where':{'closed':![]}});})[_0xa671('0x18')](function(_0x597081){_0x5c6dbe=_0x597081;if(_0x52fea4&&_0x597081>_0x52fea4){return db[_0xa671('0x10a')][_0xa671('0x79')]({'where':{'id':0x1}})[_0xa671('0x18')](function(_0x49deae){if(_0x49deae){_0x49deae['increment'](_0xa671('0x10b'));}});}})[_0xa671('0x18')](function(){if(!_0x9e00af[_0xa671('0xb3')]||!_0x9e00af['Interval'][_0xa671('0xb4')])return!![];return checkWebsiteIntervals(_0x9e00af);})[_0xa671('0x18')](function(_0x1e0044){var _0x397098=fs['readFileSync'](path[_0xa671('0x8d')](config[_0xa671('0x8e')],_0xa671('0x10c')),_0xa671('0x10d'));var _0x3eddb1=new url[(_0xa671('0x10e'))](_0x9e00af['address'])[_0xa671('0x10f')];var _0x2b7a58=_0xa671('0x110');var _0x31f00a=![];var _0x5822cb={'chatVersion':_0x2b7a58,'chatWebsiteAddressOrigin':_0x3eddb1,'remote':_0x9e00af[_0xa671('0x111')],'query':querystring[_0xa671('0x1c')](_['merge'](_0x9e00af[_0xa671('0x2f')]({'plain':!![]}),{'customerIp':_0x521972[_0xa671('0x112')][_0xa671('0x47')]||_0x521972[_0xa671('0x112')][_0xa671('0x113')]||_0x521972['connection'][_0xa671('0x114')]||_0x521972['ip'],'referer':_0x521972[_0xa671('0x112')][_0xa671('0x4c')],'openedInteractions':_0x5c6dbe,'maxInteractions':_0x52fea4,'virtual':_0x5aeae1[_0xa671('0x115')],'online':_0x1e0044,'custom':_0x5aeae1}))[_0xa671('0x116')](/'/g,'\x5c\x27')};_0xfc8411['send'](ejs['render'](Mustache[_0xa671('0x117')](_0x397098,_0x5822cb),{'proactiveActions':_0x2540f7,'alignment':_0x9e00af[_0xa671('0x118')],'verticalAlignment':_0x9e00af[_0xa671('0x119')],'div_color':_0x9e00af['color'],'labelText':_0x9e00af[_0xa671('0x11a')],'text_color':_0x9e00af['textColor'],'text_button_color':_0x9e00af[_0xa671('0x11b')],'button_color':_0x9e00af[_0xa671('0x11c')],'background_color':_0x9e00af[_0xa671('0x11d')],'hideWhenOffline':_0x9e00af[_0xa671('0x11e')],'intervalId':_0x9e00af[_0xa671('0x11f')],'isDevelopment':_0x31f00a,'chatVersion':_0x2b7a58}));})[_0xa671('0x22')](handleError(_0xfc8411,null));};exports[_0xa671('0x120')]=function(_0x120c67,_0x16b53a){var _0x1d8dc2=_0x120c67[_0xa671('0x75')]['id'];var _0x321f05=_0x120c67[_0xa671('0x6f')];var _0x4cbcde=0xc8;var _0xbd77db=null;return db[_0xa671('0x121')][_0xa671('0xec')]({'isolationLevel':db['sequelize'][_0xa671('0x122')][_0xa671('0x123')][_0xa671('0x124')]},function(_0x21930d){return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x1d8dc2},'transaction':_0x21930d})[_0xa671('0x18')](function(_0x5abd3e){if(_0x5abd3e){return db[_0xa671('0xb1')]['destroy']({'where':{'ChatWebsiteId':_0x1d8dc2},'transaction':_0x21930d})[_0xa671('0x18')](function(){var _0x22e985=_[_0xa671('0x3e')](_0x321f05,function(_0x2fc56f){_0x2fc56f[_0xa671('0x7b')]=_0x1d8dc2;return _0x2fc56f;});return db['ChatApplication']['bulkCreate'](_0x22e985,{'transaction':_0x21930d});});}else{_0x4cbcde=0x194;_0xbd77db=[];}});})[_0xa671('0x18')](function(){if(_0x4cbcde!==0x194){return db[_0xa671('0xb1')][_0xa671('0x125')]({'where':{'ChatWebsiteId':_0x1d8dc2},'order':_0xa671('0xba')})['then'](function(_0x31feef){_0xbd77db=_0x31feef;});}})['catch'](function(_0x2987cf){_0x4cbcde=0x1f4;logger['error'](_0x2987cf[_0xa671('0x32')]);if(_0x2987cf[_0xa671('0x33')]){delete _0x2987cf['name'];}_0xbd77db=_0x2987cf;})[_0xa671('0x126')](function(){if(_0xbd77db===null){_0x16b53a['sendStatus'](_0x4cbcde);}else{if(_0x4cbcde===0x1f4){_0x16b53a[_0xa671('0x24')](_0x4cbcde)['send'](_0xbd77db);}else{_0x16b53a[_0xa671('0x24')](_0x4cbcde)[_0xa671('0x26')](_0xbd77db);}}});};exports['getApplications']=function(_0x501737,_0x3d30ff){var _0x2fa4d0={};var _0x1ec719={};var _0x2e289e;var _0x4e24e0;return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x501737[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x3d30ff,null))['then'](function(_0x190d20){if(_0x190d20){_0x2e289e=_0x190d20;_0x1ec719[_0xa671('0x54')]=_[_0xa671('0x82')](db[_0xa671('0xb1')][_0xa671('0x5a')]);_0x1ec719[_0xa671('0x5d')]=_[_0xa671('0x82')](_0x501737[_0xa671('0x5d')]);_0x1ec719['filters']=_['intersection'](_0x1ec719[_0xa671('0x54')],_0x1ec719['query']);_0x2fa4d0[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x1ec719[_0xa671('0x54')],qs[_0xa671('0x60')](_0x501737[_0xa671('0x5d')][_0xa671('0x60')]));_0x2fa4d0[_0xa671('0x5f')]=_0x2fa4d0[_0xa671('0x5f')][_0xa671('0x61')]?_0x2fa4d0['attributes']:_0x1ec719[_0xa671('0x54')];_0x2fa4d0[_0xa671('0x7a')]=qs['sort'](_0x501737[_0xa671('0x5d')]['sort']);_0x2fa4d0[_0xa671('0x65')]=qs[_0xa671('0x66')](_[_0xa671('0x67')](_0x501737[_0xa671('0x5d')],_0x1ec719[_0xa671('0x66')]));if(_0x501737['query']['filter']){_0x2fa4d0['where']=_['merge'](_0x2fa4d0[_0xa671('0x65')],{'$or':_[_0xa671('0x3e')](_0x2fa4d0[_0xa671('0x5f')],function(_0x5624b6){var _0x4043f6={};_0x4043f6[_0x5624b6]={'$like':'%'+_0x501737[_0xa671('0x5d')]['filter']+'%'};return _0x4043f6;})});}_0x2fa4d0=_[_0xa671('0x7c')]({},_0x2fa4d0,_0x501737[_0xa671('0x69')]);return _0x2e289e[_0xa671('0x127')](_0x2fa4d0);}})['then'](function(_0x498ace){if(_0x498ace){_0x4e24e0=_0x498ace[_0xa671('0x61')];if(!_0x501737[_0xa671('0x5d')][_0xa671('0x62')](_0xa671('0x63'))){_0x2fa4d0['limit']=qs['limit'](_0x501737['query'][_0xa671('0x2a')]);_0x2fa4d0[_0xa671('0x27')]=qs['offset'](_0x501737[_0xa671('0x5d')]['offset']);}return _0x2e289e[_0xa671('0x127')](_0x2fa4d0);}})[_0xa671('0x18')](function(_0x2f2a4e){if(_0x2f2a4e){return _0x2f2a4e?{'count':_0x4e24e0,'rows':_0x2f2a4e}:null;}})['then'](respondWithResult(_0x3d30ff,null))[_0xa671('0x22')](handleError(_0x3d30ff,null));};exports[_0xa671('0x128')]=function(_0x5ed53c,_0x865393){return db['chatProactiveAction'][_0xa671('0x6d')]({'where':{'id':_0x5ed53c[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x865393,null))[_0xa671('0x18')](function(_0x4c46e8){if(_0x4c46e8){return _0x4c46e8[_0xa671('0x128')](_0x5ed53c[_0xa671('0x6f')][_0xa671('0x7f')],_[_0xa671('0x101')](_0x5ed53c[_0xa671('0x6f')],['ids','id'])||{});}})[_0xa671('0x18')](respondWithResult(_0x865393,null))[_0xa671('0x22')](handleError(_0x865393,null));};exports[_0xa671('0x129')]=function(_0x3fa742,_0xbfbc0a){var _0x264652={};var _0x2daf8f={};var _0x9c44ce;var _0x229bbc;return db['ChatWebsite']['findOne']({'where':{'id':_0x3fa742['params']['id']}})[_0xa671('0x18')](handleEntityNotFound(_0xbfbc0a,null))[_0xa671('0x18')](function(_0x151ca9){if(_0x151ca9){_0x9c44ce=_0x151ca9;_0x2daf8f[_0xa671('0x54')]=_['keys'](db[_0xa671('0x12a')][_0xa671('0x5a')]);_0x2daf8f['query']=_['keys'](_0x3fa742[_0xa671('0x5d')]);_0x2daf8f[_0xa671('0x66')]=_['intersection'](_0x2daf8f['model'],_0x2daf8f[_0xa671('0x5d')]);_0x264652[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x2daf8f[_0xa671('0x54')],qs[_0xa671('0x60')](_0x3fa742['query']['fields']));_0x264652['attributes']=_0x264652[_0xa671('0x5f')][_0xa671('0x61')]?_0x264652['attributes']:_0x2daf8f[_0xa671('0x54')];_0x264652[_0xa671('0x7a')]=qs[_0xa671('0x64')](_0x3fa742[_0xa671('0x5d')][_0xa671('0x64')]);_0x264652[_0xa671('0x65')]=qs['filters'](_[_0xa671('0x67')](_0x3fa742[_0xa671('0x5d')],_0x2daf8f['filters']));if(_0x3fa742[_0xa671('0x5d')][_0xa671('0x68')]){_0x264652[_0xa671('0x65')]=_[_0xa671('0x7c')](_0x264652['where'],{'$or':_[_0xa671('0x3e')](_0x264652[_0xa671('0x5f')],function(_0x535e9b){var _0x54a2e5={};_0x54a2e5[_0x535e9b]={'$like':'%'+_0x3fa742['query'][_0xa671('0x68')]+'%'};return _0x54a2e5;})});}_0x264652=_[_0xa671('0x7c')]({},_0x264652,_0x3fa742[_0xa671('0x69')]);return _0x9c44ce[_0xa671('0x129')](_0x264652);}})[_0xa671('0x18')](function(_0x121d94){if(_0x121d94){_0x229bbc=_0x121d94['length'];if(!_0x3fa742[_0xa671('0x5d')][_0xa671('0x62')](_0xa671('0x63'))){_0x264652['limit']=qs[_0xa671('0x2a')](_0x3fa742[_0xa671('0x5d')]['limit']);_0x264652[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x3fa742['query']['offset']);}return _0x9c44ce['getProactiveActions'](_0x264652);}})[_0xa671('0x18')](function(_0x352a8d){if(_0x352a8d){return _0x352a8d?{'count':_0x229bbc,'rows':_0x352a8d}:null;}})['then'](respondWithResult(_0xbfbc0a,null))[_0xa671('0x22')](handleError(_0xbfbc0a,null));};exports[_0xa671('0x12b')]=function(_0x12e571,_0x122484){var _0x5cd8ec=_0x12e571[_0xa671('0x5d')][_0xa671('0x12c')]==='false'?_0xa671('0x12d'):'onlineForm';return db[_0xa671('0x59')]['find']({'attributes':['id',_0x5cd8ec],'where':{'id':_0x12e571['params']['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x122484,null))[_0xa671('0x18')](function(_0x8c001e){if(_0x8c001e){var _0x57dff4=_0x8c001e[_0x5cd8ec];var _0x234a0e=_0x57dff4&&_0x57dff4['items']?_0x57dff4[_0xa671('0x12e')]:[];_0x122484[_0xa671('0xdb')]({'fromKey':_[_0xa671('0x92')](_0x57dff4[_0xa671('0x12f')])?undefined:_0x57dff4[_0xa671('0x12f')],'count':_0x234a0e[_0xa671('0x61')],'rows':_0x234a0e});}})[_0xa671('0x22')](handleError(_0x122484,null));};exports[_0xa671('0x130')]=function(_0x1bd02e,_0x118962){var _0x19696a={'raw':![],'where':{}};var _0x4a0a08={};var _0x5c40e7={'count':0x0,'rows':[]};return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x1bd02e[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x118962,null))[_0xa671('0x18')](function(_0x13502f){if(_0x13502f){_0x4a0a08['model']=_['keys'](db[_0xa671('0xe5')]['rawAttributes']);_0x4a0a08[_0xa671('0x5d')]=_[_0xa671('0x82')](_0x1bd02e[_0xa671('0x5d')]);_0x4a0a08['filters']=_['intersection'](_0x4a0a08[_0xa671('0x54')],_0x4a0a08[_0xa671('0x5d')]);_0x19696a[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x4a0a08[_0xa671('0x54')],qs[_0xa671('0x60')](_0x1bd02e[_0xa671('0x5d')][_0xa671('0x60')]));_0x19696a[_0xa671('0x5f')]=_0x19696a[_0xa671('0x5f')][_0xa671('0x61')]?_0x19696a['attributes']:_0x4a0a08[_0xa671('0x54')];if(!_0x1bd02e[_0xa671('0x5d')][_0xa671('0x62')]('nolimit')){_0x19696a[_0xa671('0x2a')]=qs[_0xa671('0x2a')](_0x1bd02e['query'][_0xa671('0x2a')]);_0x19696a[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x1bd02e[_0xa671('0x5d')][_0xa671('0x27')]);}_0x19696a[_0xa671('0x7a')]=qs[_0xa671('0x64')](_0x1bd02e[_0xa671('0x5d')][_0xa671('0x64')]);_0x19696a[_0xa671('0x65')]=qs[_0xa671('0x66')](_[_0xa671('0x67')](_0x1bd02e['query'],_0x4a0a08[_0xa671('0x66')]));_0x19696a[_0xa671('0x65')][_0xa671('0x7b')]=_0x13502f['id'];if(_0x1bd02e[_0xa671('0x5d')][_0xa671('0x68')]){_0x19696a[_0xa671('0x65')]=_[_0xa671('0x7c')](_0x19696a[_0xa671('0x65')],{'$or':_['map'](_0x19696a[_0xa671('0x5f')],function(_0x49c6d8){var _0x1e1a36={};_0x1e1a36[_0x49c6d8]={'$like':'%'+_0x1bd02e[_0xa671('0x5d')][_0xa671('0x68')]+'%'};return _0x1e1a36;})});}_0x19696a=_[_0xa671('0x7c')]({},_0x19696a,_0x1bd02e[_0xa671('0x69')]);return db[_0xa671('0xe5')][_0xa671('0x29')]({'where':_0x19696a[_0xa671('0x65')]})[_0xa671('0x18')](function(_0x73202e){_0x5c40e7['count']=_0x73202e;if(_0x1bd02e[_0xa671('0x5d')][_0xa671('0x6a')]){_0x19696a[_0xa671('0x6c')]=[{'all':!![]}];}else{_0x19696a[_0xa671('0x6c')]=[{'model':db[_0xa671('0xa0')],'as':_0xa671('0x103'),'required':![]},{'model':db[_0xa671('0xed')],'as':_0xa671('0x131'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x19696a);})[_0xa671('0x18')](function(_0x45da8){_0x5c40e7[_0xa671('0x7d')]=_0x45da8;return _0x5c40e7;});}})[_0xa671('0x18')](respondWithFilteredResult(_0x118962,_0x19696a))[_0xa671('0x22')](handleError(_0x118962,null));};exports['addAgents']=function(_0x2dde91,_0x1b31f9){return db[_0xa671('0x59')][_0xa671('0x6d')]({'where':{'id':_0x2dde91['params']['id']}})['then'](handleEntityNotFound(_0x1b31f9,null))[_0xa671('0x18')](function(_0xe280ef){if(_0xe280ef){return _0xe280ef[_0xa671('0x132')](_0x2dde91[_0xa671('0x6f')]['ids'],_[_0xa671('0x101')](_0x2dde91['body'],[_0xa671('0x7f'),'id'])||{})['spread'](function(_0x405da2){for(var _0x37b5e4=0x0;_0x37b5e4<_0x2dde91[_0xa671('0x6f')][_0xa671('0x7f')][_0xa671('0x61')];_0x37b5e4+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x2dde91['body'][_0xa671('0x7f')][_0x37b5e4]),'ChatWebsiteId':Number(_0x2dde91[_0xa671('0x75')]['id'])});}return _0x405da2;});}})['then'](respondWithResult(_0x1b31f9,null))['catch'](handleError(_0x1b31f9,null));};exports[_0xa671('0x133')]=function(_0x50a31a,_0x2e0525){return db[_0xa671('0x59')]['find']({'where':{'id':_0x50a31a[_0xa671('0x75')]['id']}})['then'](handleEntityNotFound(_0x2e0525,null))['then'](function(_0x220bc6){if(_0x220bc6){return _0x220bc6[_0xa671('0x133')](_0x50a31a['query'][_0xa671('0x7f')])['then'](function(){if(_[_0xa671('0x134')](_0x50a31a[_0xa671('0x5d')][_0xa671('0x7f')])){for(var _0xcfe4eb=0x0;_0xcfe4eb<_0x50a31a[_0xa671('0x5d')][_0xa671('0x7f')][_0xa671('0x61')];_0xcfe4eb+=0x1){socket[_0xa671('0x135')](_0xa671('0x136'),{'UserId':Number(_0x50a31a[_0xa671('0x5d')]['ids'][_0xcfe4eb]),'ChatWebsiteId':Number(_0x50a31a[_0xa671('0x75')]['id'])});}}else{socket[_0xa671('0x135')](_0xa671('0x136'),{'UserId':Number(_0x50a31a[_0xa671('0x5d')]['ids']),'ChatWebsiteId':Number(_0x50a31a[_0xa671('0x75')]['id'])});}});}})[_0xa671('0x18')](respondWithStatusCode(_0x2e0525,null))[_0xa671('0x22')](handleError(_0x2e0525,null));};exports['getAgents']=function(_0x4c1050,_0x55f1cd){var _0x38c97b={};var _0x3e5133={};var _0x339aa3;var _0x129955;return db[_0xa671('0x59')][_0xa671('0x79')]({'where':{'id':_0x4c1050[_0xa671('0x75')]['id']}})[_0xa671('0x18')](handleEntityNotFound(_0x55f1cd,null))[_0xa671('0x18')](function(_0x1bccab){if(_0x1bccab){_0x339aa3=_0x1bccab;_0x3e5133[_0xa671('0x54')]=_[_0xa671('0x82')](db[_0xa671('0x137')][_0xa671('0x5a')]);_0x3e5133[_0xa671('0x5d')]=_[_0xa671('0x82')](_0x4c1050[_0xa671('0x5d')]);_0x3e5133[_0xa671('0x66')]=_[_0xa671('0x5e')](_0x3e5133[_0xa671('0x54')],_0x3e5133[_0xa671('0x5d')]);_0x38c97b[_0xa671('0x5f')]=_[_0xa671('0x5e')](_0x3e5133['model'],qs[_0xa671('0x60')](_0x4c1050[_0xa671('0x5d')][_0xa671('0x60')]));_0x38c97b[_0xa671('0x5f')]=_0x38c97b['attributes'][_0xa671('0x61')]?_0x38c97b[_0xa671('0x5f')]:_0x3e5133[_0xa671('0x54')];_0x38c97b['order']=qs[_0xa671('0x64')](_0x4c1050[_0xa671('0x5d')][_0xa671('0x64')]);_0x38c97b[_0xa671('0x65')]=qs['filters'](_[_0xa671('0x67')](_0x4c1050[_0xa671('0x5d')],_0x3e5133[_0xa671('0x66')]));if(_0x4c1050[_0xa671('0x5d')][_0xa671('0x68')]){_0x38c97b[_0xa671('0x65')]=_['merge'](_0x38c97b[_0xa671('0x65')],{'$or':_[_0xa671('0x3e')](_0x38c97b[_0xa671('0x5f')],function(_0xcc01fb){var _0x15f8b4={};_0x15f8b4[_0xcc01fb]={'$like':'%'+_0x4c1050['query'][_0xa671('0x68')]+'%'};return _0x15f8b4;})});}_0x38c97b=_[_0xa671('0x7c')]({},_0x38c97b,_0x4c1050['options']);return _0x339aa3[_0xa671('0x138')](_0x38c97b);}})[_0xa671('0x18')](function(_0x387377){if(_0x387377){_0x129955=_0x387377['length'];if(!_0x4c1050['query']['hasOwnProperty']('nolimit')){_0x38c97b[_0xa671('0x2a')]=qs['limit'](_0x4c1050['query']['limit']);_0x38c97b[_0xa671('0x27')]=qs[_0xa671('0x27')](_0x4c1050[_0xa671('0x5d')]['offset']);}return _0x339aa3[_0xa671('0x138')](_0x38c97b);}})[_0xa671('0x18')](function(_0x13779a){if(_0x13779a){return _0x13779a?{'count':_0x129955,'rows':_0x13779a}:null;}})[_0xa671('0x18')](respondWithResult(_0x55f1cd,null))[_0xa671('0x22')](handleError(_0x55f1cd,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 180898c..69133f4 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 _0xac95=['events','../../mysqldb','ChatWebsite','setMaxListeners','remove','emit','hasOwnProperty','hook'];(function(_0x53ac41,_0x1a9fc2){var _0x2b0a52=function(_0x36d2e4){while(--_0x36d2e4){_0x53ac41['push'](_0x53ac41['shift']());}};_0x2b0a52(++_0x1a9fc2);}(_0xac95,0xa8));var _0x5ac9=function(_0x291c6e,_0x5b5c21){_0x291c6e=_0x291c6e-0x0;var _0x227fd1=_0xac95[_0x291c6e];return _0x227fd1;};'use strict';var EventEmitter=require(_0x5ac9('0x0'));var ChatWebsite=require(_0x5ac9('0x1'))['db'][_0x5ac9('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x5ac9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5ac9('0x4')};function emitEvent(_0x1ebdea){return function(_0x550511,_0xafa08d,_0x3790d1){ChatWebsiteEvents['emit'](_0x1ebdea+':'+_0x550511['id'],_0x550511);ChatWebsiteEvents[_0x5ac9('0x5')](_0x1ebdea,_0x550511);_0x3790d1(null);};}for(var e in events){if(events[_0x5ac9('0x6')](e)){var event=events[e];ChatWebsite[_0x5ac9('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xf29c=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0xc95cd2,_0xabae69){var _0xbaaf68=function(_0x73fd37){while(--_0x73fd37){_0xc95cd2['push'](_0xc95cd2['shift']());}};_0xbaaf68(++_0xabae69);}(_0xf29c,0xc7));var _0xcf29=function(_0x561f29,_0x40a336){_0x561f29=_0x561f29-0x0;var _0x4d1989=_0xf29c[_0x561f29];return _0x4d1989;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xcf29('0x0'))['db'][_0xcf29('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcf29('0x2')](0x0);var events={'afterCreate':_0xcf29('0x3'),'afterUpdate':_0xcf29('0x4'),'afterDestroy':_0xcf29('0x5')};function emitEvent(_0x46fd65){return function(_0x148004,_0x1f2b5d,_0x1a85d7){ChatWebsiteEvents[_0xcf29('0x6')](_0x46fd65+':'+_0x148004['id'],_0x148004);ChatWebsiteEvents[_0xcf29('0x6')](_0x46fd65,_0x148004);_0x1a85d7(null);};}for(var e in events){if(events[_0xcf29('0x7')](e)){var event=events[e];ChatWebsite[_0xcf29('0x8')](e,emitEvent(event));}}module[_0xcf29('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index a988dcc..31a6f34 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 _0x36ec=['exports','define','ChatWebsite','chat_websites','lodash','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36ec,0x1da));var _0xc36e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x36ec[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc36e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc36e('0x1'));var BPromise=require(_0xc36e('0x2'));var rp=require(_0xc36e('0x3'));var fs=require('fs');var path=require(_0xc36e('0x4'));var rimraf=require('rimraf');var config=require(_0xc36e('0x5'));var attributes=require('./chatWebsite.attributes');module[_0xc36e('0x6')]=function(_0x4dc1f6,_0x17d34c){return _0x4dc1f6[_0xc36e('0x7')](_0xc36e('0x8'),attributes,{'tableName':_0xc36e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcdce=['exports','define','ChatWebsite','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatWebsite.attributes'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xcdce,0x179));var _0xecdc=function(_0x1e2781,_0x9d9341){_0x1e2781=_0x1e2781-0x0;var _0x2ef260=_0xcdce[_0x1e2781];return _0x2ef260;};'use strict';var _=require('lodash');var util=require(_0xecdc('0x0'));var logger=require(_0xecdc('0x1'))(_0xecdc('0x2'));var moment=require(_0xecdc('0x3'));var BPromise=require(_0xecdc('0x4'));var rp=require(_0xecdc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xecdc('0x6'));var attributes=require(_0xecdc('0x7'));module[_0xecdc('0x8')]=function(_0x5bb0d3,_0x5eb356){return _0x5bb0d3[_0xecdc('0x9')](_0xecdc('0xa'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 0d5453c..6fc4ec6 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 _0x5bbd=['message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2a82f8,_0x2f587d){var _0x4feb98=function(_0x680976){while(--_0x680976){_0x2a82f8['push'](_0x2a82f8['shift']());}};_0x4feb98(++_0x2f587d);}(_0x5bbd,0x112));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var moment=require(_0xd5bb('0x2'));var BPromise=require(_0xd5bb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5bb('0x4'));var db=require(_0xd5bb('0x5'))['db'];var utils=require(_0xd5bb('0x6'));var logger=require(_0xd5bb('0x7'))(_0xd5bb('0x8'));var config=require(_0xd5bb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd5bb('0xa')][_0xd5bb('0xb')]({'port':0x232a});config[_0xd5bb('0xc')]=_[_0xd5bb('0xd')](config[_0xd5bb('0xc')],{'host':_0xd5bb('0xe'),'port':0x18eb});var socket=require(_0xd5bb('0xf'))(new Redis(config[_0xd5bb('0xc')]));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x23e670,_0x249a78,_0x551b8c){return new BPromise(function(_0x4ed337,_0x185011){return client[_0xd5bb('0x10')](_0x23e670,_0x551b8c)['then'](function(_0xb06582){logger['info'](_0xd5bb('0x11'),_0x249a78,'request\x20sent');logger[_0xd5bb('0x12')](_0xd5bb('0x13'),_0x249a78,_0xd5bb('0x14'),JSON[_0xd5bb('0x15')](_0xb06582));if(_0xb06582[_0xd5bb('0x16')]){if(_0xb06582[_0xd5bb('0x16')]['code']===0x1f4){logger[_0xd5bb('0x16')](_0xd5bb('0x11'),_0x249a78,_0xb06582[_0xd5bb('0x16')][_0xd5bb('0x17')]);return _0x185011(_0xb06582[_0xd5bb('0x16')]['message']);}logger[_0xd5bb('0x16')](_0xd5bb('0x11'),_0x249a78,_0xb06582[_0xd5bb('0x16')]['message']);return _0x4ed337(_0xb06582[_0xd5bb('0x16')][_0xd5bb('0x17')]);}else{logger[_0xd5bb('0x18')](_0xd5bb('0x11'),_0x249a78,_0xd5bb('0x14'));_0x4ed337(_0xb06582[_0xd5bb('0x19')]['message']);}})[_0xd5bb('0x1a')](function(_0x4ee27f){logger[_0xd5bb('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x249a78,_0x4ee27f);_0x185011(_0x4ee27f);});});} \ No newline at end of file +var _0x0e43=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','request','then','info','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4145d8,_0x3c031c){var _0x312d18=function(_0x1c4e90){while(--_0x1c4e90){_0x4145d8['push'](_0x4145d8['shift']());}};_0x312d18(++_0x3c031c);}(_0x0e43,0x118));var _0x30e4=function(_0x333729,_0x14ce4f){_0x333729=_0x333729-0x0;var _0x3e3846=_0x0e43[_0x333729];return _0x3e3846;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x30e4('0x0'));var BPromise=require(_0x30e4('0x1'));var rs=require(_0x30e4('0x2'));var fs=require('fs');var Redis=require(_0x30e4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30e4('0x4'))(_0x30e4('0x5'));var config=require('../../config/environment');var jayson=require(_0x30e4('0x6'));var client=jayson[_0x30e4('0x7')][_0x30e4('0x8')]({'port':0x232a});config[_0x30e4('0x9')]=_[_0x30e4('0xa')](config[_0x30e4('0x9')],{'host':_0x30e4('0xb'),'port':0x18eb});var socket=require(_0x30e4('0xc'))(new Redis(config['redis']));require(_0x30e4('0xd'))[_0x30e4('0xe')](socket);function respondWithRpcPromise(_0xe18ee9,_0x99917,_0x2bfb55){return new BPromise(function(_0x47a0d7,_0x5f0c6e){return client[_0x30e4('0xf')](_0xe18ee9,_0x2bfb55)[_0x30e4('0x10')](function(_0x20f725){logger[_0x30e4('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x99917,'request\x20sent');logger[_0x30e4('0x12')](_0x30e4('0x13'),_0x99917,_0x30e4('0x14'),JSON['stringify'](_0x20f725));if(_0x20f725[_0x30e4('0x15')]){if(_0x20f725[_0x30e4('0x15')]['code']===0x1f4){logger['error'](_0x30e4('0x16'),_0x99917,_0x20f725['error'][_0x30e4('0x17')]);return _0x5f0c6e(_0x20f725[_0x30e4('0x15')][_0x30e4('0x17')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x99917,_0x20f725[_0x30e4('0x15')][_0x30e4('0x17')]);return _0x47a0d7(_0x20f725[_0x30e4('0x15')]['message']);}else{logger[_0x30e4('0x11')](_0x30e4('0x16'),_0x99917,'request\x20sent');_0x47a0d7(_0x20f725[_0x30e4('0x18')]['message']);}})[_0x30e4('0x19')](function(_0x4827c1){logger[_0x30e4('0x15')](_0x30e4('0x16'),_0x99917,_0x4827c1);_0x5f0c6e(_0x4827c1);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 5d4c98f..eba7c93 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 _0x330d=['update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x3a8ec7,_0x22b2a0){var _0x579591=function(_0x3673a6){while(--_0x3673a6){_0x3a8ec7['push'](_0x3a8ec7['shift']());}};_0x579591(++_0x22b2a0);}(_0x330d,0x1e6));var _0xd330=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x330d[_0x3e6729];return _0x535bcd;};'use strict';var ChatWebsiteEvents=require(_0xd330('0x0'));var events=[_0xd330('0x1'),'remove',_0xd330('0x2')];function createListener(_0xe1857c,_0x5ec631){return function(_0x4d15ee){_0x5ec631[_0xd330('0x3')](_0xe1857c,_0x4d15ee);};}function removeListener(_0x4e0fd0,_0xe61b81){return function(){ChatWebsiteEvents[_0xd330('0x4')](_0x4e0fd0,_0xe61b81);};}exports[_0xd330('0x5')]=function(_0x76e6b2){for(var _0x3824a7=0x0,_0x17b132=events[_0xd330('0x6')];_0x3824a7<_0x17b132;_0x3824a7++){var _0x2cff07=events[_0x3824a7];var _0x18efc4=createListener(_0xd330('0x7')+_0x2cff07,_0x76e6b2);ChatWebsiteEvents['on'](_0x2cff07,_0x18efc4);}}; \ No newline at end of file +var _0xb858=['remove','emit','removeListener','register','length','chatWebsite:','save'];(function(_0x470195,_0xdb2af5){var _0x3671d9=function(_0x593aaa){while(--_0x593aaa){_0x470195['push'](_0x470195['shift']());}};_0x3671d9(++_0xdb2af5);}(_0xb858,0x141));var _0x8b85=function(_0x26d55b,_0x550a26){_0x26d55b=_0x26d55b-0x0;var _0x46743b=_0xb858[_0x26d55b];return _0x46743b;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x8b85('0x0'),_0x8b85('0x1'),'update'];function createListener(_0x5bbd60,_0xc523f8){return function(_0x4db9a3){_0xc523f8[_0x8b85('0x2')](_0x5bbd60,_0x4db9a3);};}function removeListener(_0x550bce,_0x3fbb72){return function(){ChatWebsiteEvents[_0x8b85('0x3')](_0x550bce,_0x3fbb72);};}exports[_0x8b85('0x4')]=function(_0x3e3611){for(var _0x164dd2=0x0,_0x3079ff=events[_0x8b85('0x5')];_0x164dd2<_0x3079ff;_0x164dd2++){var _0x3e49ee=events[_0x164dd2];var _0x35ed90=createListener(_0x8b85('0x6')+_0x3e49ee,_0x3e3611);ChatWebsiteEvents['on'](_0x3e49ee,_0x35ed90);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index f62ee73..657d0fd 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 _0x17e0=['addCustomerAvatar','single','addSystemAvatar','notify','offline-chat','ensureDir','replace','extname','/:id/interactions','addApplications','/:id/proactive_actions','addProactiveActions','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/snippet','getSnippet','/:id/applications','getApplications','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','file','addAvatar','server/files/images/avatars/'];(function(_0x1ebee9,_0x334bce){var _0x5b2eeb=function(_0x3aa009){while(--_0x3aa009){_0x1ebee9['push'](_0x1ebee9['shift']());}};_0x5b2eeb(++_0x334bce);}(_0x17e0,0x117));var _0x017e=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x17e0[_0x82129b];return _0x2ae5dc;};'use strict';var multer=require(_0x017e('0x0'));var util=require('util');var path=require(_0x017e('0x1'));var timeout=require(_0x017e('0x2'));var express=require(_0x017e('0x3'));var router=express[_0x017e('0x4')]();var fs_extra=require(_0x017e('0x5'));var auth=require(_0x017e('0x6'));var interaction=require(_0x017e('0x7'));var config=require(_0x017e('0x8'));var controller=require('./chatWebsite.controller');router[_0x017e('0x9')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0xb')]);router[_0x017e('0x9')](_0x017e('0xc'),auth['isAuthenticated'](),controller[_0x017e('0xd')]);router[_0x017e('0x9')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller['show']);router[_0x017e('0x9')](_0x017e('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x017e('0x9')](_0x017e('0x10'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x017e('0x11'),controller['getLogo']);router['get'](_0x017e('0x12'),controller[_0x017e('0x13')]);router[_0x017e('0x9')](_0x017e('0x14'),controller['getCustomerAvatar']);router[_0x017e('0x9')](_0x017e('0x15'),controller['getSystemAvatar']);router[_0x017e('0x9')]('/:id/interactions',auth['isAuthenticated'](),controller['getInteractions']);router[_0x017e('0x9')](_0x017e('0x16'),controller[_0x017e('0x17')]);router[_0x017e('0x9')](_0x017e('0x18'),auth[_0x017e('0xa')](),controller[_0x017e('0x19')]);router['get']('/:id/proactive_actions',auth[_0x017e('0xa')](),controller[_0x017e('0x1a')]);router[_0x017e('0x9')](_0x017e('0x1b'),controller[_0x017e('0x1c')]);router[_0x017e('0x9')](_0x017e('0x1d'),auth[_0x017e('0xa')](),controller[_0x017e('0x1e')]);router['get'](_0x017e('0x1f'),auth[_0x017e('0xa')](),controller['getAgents']);router[_0x017e('0x20')]('/',auth[_0x017e('0xa')](),controller[_0x017e('0x21')]);router[_0x017e('0x20')]('/:id/dispositions',auth[_0x017e('0xa')](),controller[_0x017e('0x22')]);router[_0x017e('0x20')]('/:id/canned_answers',auth[_0x017e('0xa')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x017e('0x23')]({'destination':function(_0x494943,_0x46ae64,_0x483bd9){_0x483bd9(null,path[_0x017e('0x24')](config[_0x017e('0x25')],_0x017e('0x26')));},'filename':function(_0x4017a4,_0x27e276,_0x364361){_0x364361(null,util[_0x017e('0x27')](_0x017e('0x28'),Date[_0x017e('0x29')](),_0x27e276[_0x017e('0x2a')]));}})});router[_0x017e('0x20')](_0x017e('0x11'),upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x017e('0x23')]({'destination':function(_0x54601c,_0x2a113c,_0x12ce76){_0x12ce76(null,path[_0x017e('0x24')](config[_0x017e('0x25')],'server/files/images/avatars/'));},'filename':function(_0x47163e,_0x4ef889,_0x307903){_0x307903(null,util[_0x017e('0x27')]('%s-%s',Date[_0x017e('0x29')](),_0x4ef889[_0x017e('0x2a')]));}})});router[_0x017e('0x20')](_0x017e('0x12'),upload['single'](_0x017e('0x2b')),controller[_0x017e('0x2c')]);var upload=multer({'storage':multer[_0x017e('0x23')]({'destination':function(_0x10c789,_0x1bf716,_0x557b64){_0x557b64(null,path[_0x017e('0x24')](config[_0x017e('0x25')],_0x017e('0x2d')));},'filename':function(_0x352c5a,_0xf445ff,_0xbc8778){_0xbc8778(null,util[_0x017e('0x27')](_0x017e('0x28'),Date[_0x017e('0x29')](),_0xf445ff['originalname']));}})});router[_0x017e('0x20')]('/:id/customer_avatar',upload['single'](_0x017e('0x2b')),controller[_0x017e('0x2e')]);var upload=multer({'storage':multer[_0x017e('0x23')]({'destination':function(_0x4ab4b8,_0x190f1f,_0xeacbbb){_0xeacbbb(null,path[_0x017e('0x24')](config[_0x017e('0x25')],_0x017e('0x2d')));},'filename':function(_0x45ee53,_0x4ad0e0,_0x198fc2){_0x198fc2(null,util[_0x017e('0x27')](_0x017e('0x28'),Date[_0x017e('0x29')](),_0x4ad0e0['originalname']));}})});router[_0x017e('0x20')](_0x017e('0x15'),upload[_0x017e('0x2f')]('file'),controller[_0x017e('0x30')]);router[_0x017e('0x20')]('/:id/notify',controller[_0x017e('0x31')]);const offlineUploadMulter=multer({'storage':multer[_0x017e('0x23')]({'destination':function(_0x5b74d7,_0x5d3a91,_0x4de38e){const _0x8705be=path[_0x017e('0x24')](config[_0x017e('0x25')],'server/files','attachments',_0x017e('0x32'));fs_extra[_0x017e('0x33')](_0x8705be,function(){_0x4de38e(null,_0x8705be);});},'filename':function(_0x8a9b45,_0x1ea8d9,_0xb5ab38){const _0x33d4d5=_0x1ea8d9[_0x017e('0x2a')][_0x017e('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x18dc5e=path[_0x017e('0x35')](_0x33d4d5);const _0x341a28=Date[_0x017e('0x29')]()+'-'+_0x33d4d5['replace'](_0x18dc5e,'')+_0x18dc5e;_0xb5ab38(null,_0x341a28);}})});router[_0x017e('0x20')]('/:id/offline',offlineUploadMulter['any'](),controller['offline']);router[_0x017e('0x20')](_0x017e('0x36'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x017e('0x20')](_0x017e('0x18'),auth[_0x017e('0xa')](),controller[_0x017e('0x37')]);router['post'](_0x017e('0x38'),auth['isAuthenticated'](),controller[_0x017e('0x39')]);router['post'](_0x017e('0x1f'),auth[_0x017e('0xa')](),controller['addAgents']);router[_0x017e('0x3a')](_0x017e('0xe'),auth['isAuthenticated'](),controller[_0x017e('0x3b')]);router[_0x017e('0x3c')](_0x017e('0xe'),auth[_0x017e('0xa')](),controller['destroy']);router[_0x017e('0x3c')](_0x017e('0xf'),auth[_0x017e('0xa')](),controller[_0x017e('0x3d')]);router[_0x017e('0x3c')]('/:id/canned_answers',auth[_0x017e('0xa')](),controller[_0x017e('0x3e')]);router[_0x017e('0x3c')](_0x017e('0x1f'),auth['isAuthenticated'](),controller[_0x017e('0x3f')]);module[_0x017e('0x40')]=router; \ No newline at end of file +var _0x8326=['/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','getAgents','post','/:id/dispositions','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','now','originalname','single','file','server/files/images/avatars/','%s-%s','addAvatar','format','/:id/notify','notify','server/files','attachments','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addProactiveActions','put','update','delete','destroy','removeDispositions','removeAnswers','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','getAnswers'];(function(_0x217b9d,_0xb13550){var _0x10c572=function(_0x4aed5f){while(--_0x4aed5f){_0x217b9d['push'](_0x217b9d['shift']());}};_0x10c572(++_0xb13550);}(_0x8326,0x1e0));var _0x6832=function(_0x282a38,_0x2acad1){_0x282a38=_0x282a38-0x0;var _0x2f5113=_0x8326[_0x282a38];return _0x2f5113;};'use strict';var multer=require(_0x6832('0x0'));var util=require('util');var path=require(_0x6832('0x1'));var timeout=require(_0x6832('0x2'));var express=require(_0x6832('0x3'));var router=express['Router']();var fs_extra=require(_0x6832('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6832('0x5'));var config=require(_0x6832('0x6'));var controller=require(_0x6832('0x7'));router[_0x6832('0x8')]('/',auth[_0x6832('0x9')](),controller[_0x6832('0xa')]);router[_0x6832('0x8')](_0x6832('0xb'),auth['isAuthenticated'](),controller[_0x6832('0xc')]);router[_0x6832('0x8')](_0x6832('0xd'),auth[_0x6832('0x9')](),controller[_0x6832('0xe')]);router[_0x6832('0x8')]('/:id/dispositions',auth[_0x6832('0x9')](),controller[_0x6832('0xf')]);router[_0x6832('0x8')]('/:id/canned_answers',auth[_0x6832('0x9')](),controller[_0x6832('0x10')]);router[_0x6832('0x8')](_0x6832('0x11'),controller[_0x6832('0x12')]);router[_0x6832('0x8')](_0x6832('0x13'),controller['getAvatar']);router[_0x6832('0x8')](_0x6832('0x14'),controller['getCustomerAvatar']);router['get'](_0x6832('0x15'),controller[_0x6832('0x16')]);router[_0x6832('0x8')](_0x6832('0x17'),auth['isAuthenticated'](),controller[_0x6832('0x18')]);router['get']('/:id/snippet',controller[_0x6832('0x19')]);router[_0x6832('0x8')]('/:id/applications',auth[_0x6832('0x9')](),controller[_0x6832('0x1a')]);router[_0x6832('0x8')](_0x6832('0x1b'),auth[_0x6832('0x9')](),controller[_0x6832('0x1c')]);router['get'](_0x6832('0x1d'),controller['getFields']);router[_0x6832('0x8')](_0x6832('0x1e'),auth['isAuthenticated'](),controller[_0x6832('0x1f')]);router['get']('/:id/users',auth[_0x6832('0x9')](),controller[_0x6832('0x20')]);router[_0x6832('0x21')]('/',auth[_0x6832('0x9')](),controller['create']);router[_0x6832('0x21')](_0x6832('0x22'),auth[_0x6832('0x9')](),controller[_0x6832('0x23')]);router['post'](_0x6832('0x24'),auth[_0x6832('0x9')](),controller[_0x6832('0x25')]);var upload=multer({'storage':multer[_0x6832('0x26')]({'destination':function(_0x1f6b96,_0x4caf0e,_0x35bd79){_0x35bd79(null,path[_0x6832('0x27')](config[_0x6832('0x28')],_0x6832('0x29')));},'filename':function(_0x4d4f53,_0x52e04e,_0x505dd5){_0x505dd5(null,util['format']('%s-%s',Date[_0x6832('0x2a')](),_0x52e04e[_0x6832('0x2b')]));}})});router['post'](_0x6832('0x11'),upload[_0x6832('0x2c')](_0x6832('0x2d')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a0563,_0x157d7b,_0x27b74f){_0x27b74f(null,path[_0x6832('0x27')](config[_0x6832('0x28')],_0x6832('0x2e')));},'filename':function(_0x618200,_0x3e7c63,_0x2c24eb){_0x2c24eb(null,util['format'](_0x6832('0x2f'),Date[_0x6832('0x2a')](),_0x3e7c63['originalname']));}})});router[_0x6832('0x21')]('/:id/avatar',upload[_0x6832('0x2c')](_0x6832('0x2d')),controller[_0x6832('0x30')]);var upload=multer({'storage':multer[_0x6832('0x26')]({'destination':function(_0xf84bea,_0x103b5d,_0x419e20){_0x419e20(null,path[_0x6832('0x27')](config[_0x6832('0x28')],_0x6832('0x2e')));},'filename':function(_0x34e88c,_0x3ffc97,_0x28957e){_0x28957e(null,util[_0x6832('0x31')](_0x6832('0x2f'),Date[_0x6832('0x2a')](),_0x3ffc97[_0x6832('0x2b')]));}})});router[_0x6832('0x21')](_0x6832('0x14'),upload['single'](_0x6832('0x2d')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x6832('0x26')]({'destination':function(_0x38f2b6,_0x5d3599,_0x1ca38d){_0x1ca38d(null,path[_0x6832('0x27')](config[_0x6832('0x28')],_0x6832('0x2e')));},'filename':function(_0x4402d5,_0x299124,_0xcf1c93){_0xcf1c93(null,util[_0x6832('0x31')](_0x6832('0x2f'),Date[_0x6832('0x2a')](),_0x299124[_0x6832('0x2b')]));}})});router[_0x6832('0x21')](_0x6832('0x15'),upload['single'](_0x6832('0x2d')),controller['addSystemAvatar']);router[_0x6832('0x21')](_0x6832('0x32'),controller[_0x6832('0x33')]);const offlineUploadMulter=multer({'storage':multer[_0x6832('0x26')]({'destination':function(_0x3b3c83,_0x50d2eb,_0x461eb4){const _0x4c4ddd=path['join'](config[_0x6832('0x28')],_0x6832('0x34'),_0x6832('0x35'),'offline-chat');fs_extra[_0x6832('0x36')](_0x4c4ddd,function(){_0x461eb4(null,_0x4c4ddd);});},'filename':function(_0x4c6c3e,_0x19e6a2,_0x17eb18){const _0x1c9571=_0x19e6a2[_0x6832('0x2b')][_0x6832('0x37')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x22b216=path[_0x6832('0x38')](_0x1c9571);const _0x18a377=Date[_0x6832('0x2a')]()+'-'+_0x1c9571[_0x6832('0x37')](_0x22b216,'')+_0x22b216;_0x17eb18(null,_0x18a377);}})});router[_0x6832('0x21')]('/:id/offline',offlineUploadMulter[_0x6832('0x39')](),controller[_0x6832('0x3a')]);router[_0x6832('0x21')](_0x6832('0x17'),auth[_0x6832('0x9')](),controller[_0x6832('0x3b')]);router['post'](_0x6832('0x3c'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6832('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x6832('0x3d')]);router[_0x6832('0x21')]('/:id/users',auth[_0x6832('0x9')](),controller['addAgents']);router[_0x6832('0x3e')]('/:id',auth['isAuthenticated'](),controller[_0x6832('0x3f')]);router[_0x6832('0x40')](_0x6832('0xd'),auth[_0x6832('0x9')](),controller[_0x6832('0x41')]);router[_0x6832('0x40')](_0x6832('0x22'),auth[_0x6832('0x9')](),controller[_0x6832('0x42')]);router[_0x6832('0x40')]('/:id/canned_answers',auth[_0x6832('0x9')](),controller[_0x6832('0x43')]);router[_0x6832('0x40')](_0x6832('0x44'),auth[_0x6832('0x9')](),controller[_0x6832('0x45')]);module[_0x6832('0x46')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 1d2afbe..8e81a50 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 _0x3e9b=['exports','beaver-logger/server','express','../config/environment','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated'];(function(_0x347ef4,_0x20317f){var _0x157a9e=function(_0x5783c6){while(--_0x5783c6){_0x347ef4['push'](_0x347ef4['shift']());}};_0x157a9e(++_0x20317f);}(_0x3e9b,0xf1));var _0xb3e9=function(_0x2d909a,_0x5200bc){_0x2d909a=_0x2d909a-0x0;var _0x3352ff=_0x3e9b[_0x2d909a];return _0x3352ff;};var beaverLogger=require(_0xb3e9('0x0'));var express=require(_0xb3e9('0x1'));var auth=require('../components/auth/service');var config=require(_0xb3e9('0x2'));var router=express['Router']();var isProduction=config[_0xb3e9('0x3')]==='production'||![];function clientSideLogs(_0x54f537,_0x70eb70,_0x22e453){var _0x3fb8d1=_0x54f537[_0xb3e9('0x4')][_0xb3e9('0x5')](_0xb3e9('0x6'));if(!_0x3fb8d1){throw new Error(_0xb3e9('0x7'));}return beaverLogger[_0xb3e9('0x8')]({'uri':'/client-logs','logger':_0x3fb8d1,'enableCors':!isProduction})(_0x54f537,_0x70eb70,_0x22e453);}router[_0xb3e9('0x9')](auth[_0xb3e9('0xa')](),clientSideLogs);module[_0xb3e9('0xb')]=router; \ No newline at end of file +var _0x463d=['use','isAuthenticated','exports','beaver-logger/server','../components/auth/service','../config/environment','Router','env','production','get','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs'];(function(_0x12916d,_0x37865a){var _0x127b87=function(_0x57d8b9){while(--_0x57d8b9){_0x12916d['push'](_0x12916d['shift']());}};_0x127b87(++_0x37865a);}(_0x463d,0x107));var _0xd463=function(_0x31548a,_0x6aaa8a){_0x31548a=_0x31548a-0x0;var _0xb40221=_0x463d[_0x31548a];return _0xb40221;};var beaverLogger=require(_0xd463('0x0'));var express=require('express');var auth=require(_0xd463('0x1'));var config=require(_0xd463('0x2'));var router=express[_0xd463('0x3')]();var isProduction=config[_0xd463('0x4')]===_0xd463('0x5')||![];function clientSideLogs(_0x48664e,_0x4b1ea9,_0x2269b6){var _0x235d6e=_0x48664e['app'][_0xd463('0x6')]('client-side-logger');if(!_0x235d6e){throw new Error(_0xd463('0x7'));}return beaverLogger[_0xd463('0x8')]({'uri':_0xd463('0x9'),'logger':_0x235d6e,'enableCors':!isProduction})(_0x48664e,_0x4b1ea9,_0x2269b6);}router[_0xd463('0xa')](auth[_0xd463('0xb')](),clientSideLogs);module[_0xd463('0xc')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index a1418f4..3e2c845 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 _0xabb4=['ENUM','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','exports','STRING','AmazonAWS','Google','MicrosoftAzure'];(function(_0x462169,_0x1ca2af){var _0x37e920=function(_0x457dcc){while(--_0x457dcc){_0x462169['push'](_0x462169['shift']());}};_0x37e920(++_0x1ca2af);}(_0xabb4,0x163));var _0x4abb=function(_0x1d1e6b,_0x63bc19){_0x1d1e6b=_0x1d1e6b-0x0;var _0xe52cd4=_0xabb4[_0x1d1e6b];return _0xe52cd4;};'use strict';var Sequelize=require('sequelize');module[_0x4abb('0x0')]={'name':{'type':Sequelize[_0x4abb('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x4abb('0x2'),_0x4abb('0x3'),_0x4abb('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4abb('0x5')](_0x4abb('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x4abb('0x1')],'comment':_0x4abb('0x7')},'data2':{'type':Sequelize[_0x4abb('0x1')],'comment':_0x4abb('0x8')},'data3':{'type':Sequelize[_0x4abb('0x1')],'comment':_0x4abb('0x9')},'data4':{'type':Sequelize[_0x4abb('0x1')],'comment':_0x4abb('0xa')},'data5':{'type':Sequelize[_0x4abb('0xb')],'comment':_0x4abb('0xc')},'data6':{'type':Sequelize[_0x4abb('0xb')],'comment':_0x4abb('0xd')},'data7':{'type':Sequelize[_0x4abb('0xb')],'comment':_0x4abb('0xe')}}; \ No newline at end of file +var _0x7269=['Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure'];(function(_0x1fd29b,_0x160305){var _0x4f97f8=function(_0x5ac295){while(--_0x5ac295){_0x1fd29b['push'](_0x1fd29b['shift']());}};_0x4f97f8(++_0x160305);}(_0x7269,0xe7));var _0x9726=function(_0x262600,_0x140123){_0x262600=_0x262600-0x0;var _0x1c0a4a=_0x7269[_0x262600];return _0x1c0a4a;};'use strict';var Sequelize=require(_0x9726('0x0'));module[_0x9726('0x1')]={'name':{'type':Sequelize[_0x9726('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9726('0x3')](_0x9726('0x4'),_0x9726('0x5'),_0x9726('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9726('0x3')](_0x9726('0x7'),_0x9726('0x8'))},'data1':{'type':Sequelize['STRING'],'comment':_0x9726('0x9')},'data2':{'type':Sequelize[_0x9726('0x2')],'comment':_0x9726('0xa')},'data3':{'type':Sequelize[_0x9726('0x2')],'comment':_0x9726('0xb')},'data4':{'type':Sequelize[_0x9726('0x2')],'comment':_0x9726('0xc')},'data5':{'type':Sequelize[_0x9726('0xd')],'comment':_0x9726('0xe')},'data6':{'type':Sequelize[_0x9726('0xd')],'comment':_0x9726('0xf')},'data7':{'type':Sequelize['TEXT'],'comment':_0x9726('0x10')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e8f0088..fe1c638 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 _0x03da=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','merge','options','includeAll','findAll','MicrosoftAzure','decryptString','data3','catch','params','keys','length','find','create','body','Name\x20parameter\x20not\x20specified','service','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','Invalid\x20state\x20parameter','from','state','base64','toString','ascii','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:error','send','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','status','offset','undefined','limit','count','Content-Range','update','then','end','sendStatus','error','name','padEnd','index','map','CloudProvider','rawAttributes','type','key','model','query'];(function(_0x3ad0ca,_0x52f303){var _0xd2a678=function(_0x5bb8c5){while(--_0x5bb8c5){_0x3ad0ca['push'](_0x3ad0ca['shift']());}};_0xd2a678(++_0x52f303);}(_0x03da,0x1e4));var _0xa03d=function(_0x12c262,_0x25f1b5){_0x12c262=_0x12c262-0x0;var _0x34577f=_0x03da[_0x12c262];return _0x34577f;};'use strict';var _=require(_0xa03d('0x0'));var Redis=require(_0xa03d('0x1'));var qs=require(_0xa03d('0x2'));var encryptor=require(_0xa03d('0x3'));var config=require(_0xa03d('0x4'));var logger=require(_0xa03d('0x5'))('api');var db=require(_0xa03d('0x6'))['db'];var oauth=require(_0xa03d('0x7'));config[_0xa03d('0x8')]=_[_0xa03d('0x9')](config[_0xa03d('0x8')],{'host':_0xa03d('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa03d('0x8')]));var redis=new Redis(config[_0xa03d('0x8')]);function respondWithStatusCode(_0xc45360,_0x4ddf25){_0x4ddf25=_0x4ddf25||0xcc;return function(_0x3ef22a){if(_0x3ef22a){return _0xc45360['sendStatus'](_0x4ddf25);}return _0xc45360[_0xa03d('0xb')](_0x4ddf25)['end']();};}function respondWithResult(_0x57a4b8,_0x5b28b3){_0x5b28b3=_0x5b28b3||0xc8;return function(_0x6919ae){if(_0x6919ae){return _0x57a4b8[_0xa03d('0xb')](_0x5b28b3)['json'](_0x6919ae);}};}function respondWithFilteredResult(_0xaf583e,_0x3f90df){return function(_0x46f4ac){if(_0x46f4ac){var _0x9d568=typeof _0x3f90df[_0xa03d('0xc')]===_0xa03d('0xd')&&typeof _0x3f90df[_0xa03d('0xe')]==='undefined';var _0x48c430=_0x46f4ac[_0xa03d('0xf')];var _0x5dc394=_0x9d568?0x0:_0x3f90df[_0xa03d('0xc')];var _0x3ed847=_0x9d568?_0x46f4ac[_0xa03d('0xf')]:_0x3f90df[_0xa03d('0xc')]+_0x3f90df[_0xa03d('0xe')];var _0x2d1b3c;if(_0x3ed847>=_0x48c430){_0x3ed847=_0x48c430;_0x2d1b3c=0xc8;}else{_0x2d1b3c=0xce;}_0xaf583e[_0xa03d('0xb')](_0x2d1b3c);return _0xaf583e['set'](_0xa03d('0x10'),_0x5dc394+'-'+_0x3ed847+'/'+_0x48c430)['json'](_0x46f4ac);}return null;};}function saveUpdates(_0x251492){return function(_0x357377){if(_0x357377){return _0x357377[_0xa03d('0x11')](_0x251492)[_0xa03d('0x12')](function(_0x34aa6c){return _0x34aa6c;});}return null;};}function removeEntity(_0x282606){return function(_0x2c1b89){if(_0x2c1b89){return _0x2c1b89['destroy']()['then'](function(){_0x282606[_0xa03d('0xb')](0xcc)[_0xa03d('0x13')]();});}};}function handleEntityNotFound(_0x13cff6){return function(_0x50d55b){if(!_0x50d55b){_0x13cff6[_0xa03d('0x14')](0x194);}return _0x50d55b;};}function handleError(_0x1150ee,_0xda7365){_0xda7365=_0xda7365||0x1f4;return function(_0x587e2e){logger[_0xa03d('0x15')](_0x587e2e['stack']);if(_0x587e2e['name']){delete _0x587e2e[_0xa03d('0x16')];}_0x1150ee['status'](_0xda7365)['send'](_0x587e2e);};}function maskClientSecret(_0x44129f){return _[_0xa03d('0x17')](_0x44129f['slice'](0x0,0x3),0x14,'*');}exports[_0xa03d('0x18')]=function(_0x4db7f5,_0x58fea1){var _0x4b3a10={},_0x24c257={},_0x99f36={'count':0x0,'rows':[]};var _0x6e05af=_[_0xa03d('0x19')](db[_0xa03d('0x1a')][_0xa03d('0x1b')],function(_0x1e2add){return{'name':_0x1e2add['fieldName'],'type':_0x1e2add[_0xa03d('0x1c')][_0xa03d('0x1d')]};});_0x24c257[_0xa03d('0x1e')]=_[_0xa03d('0x19')](_0x6e05af,'name');_0x24c257[_0xa03d('0x1f')]=_['keys'](_0x4db7f5[_0xa03d('0x1f')]);_0x24c257[_0xa03d('0x20')]=_[_0xa03d('0x21')](_0x24c257['model'],_0x24c257['query']);_0x4b3a10[_0xa03d('0x22')]=_['intersection'](_0x24c257[_0xa03d('0x1e')],qs[_0xa03d('0x23')](_0x4db7f5['query'][_0xa03d('0x23')]));_0x4b3a10[_0xa03d('0x22')]=_0x4b3a10[_0xa03d('0x22')]['length']?_0x4b3a10['attributes']:_0x24c257['model'];if(!_0x4db7f5[_0xa03d('0x1f')][_0xa03d('0x24')](_0xa03d('0x25'))){_0x4b3a10[_0xa03d('0xe')]=qs[_0xa03d('0xe')](_0x4db7f5['query'][_0xa03d('0xe')]);_0x4b3a10[_0xa03d('0xc')]=qs[_0xa03d('0xc')](_0x4db7f5[_0xa03d('0x1f')][_0xa03d('0xc')]);}_0x4b3a10['order']=qs[_0xa03d('0x26')](_0x4db7f5[_0xa03d('0x1f')][_0xa03d('0x26')]);_0x4b3a10[_0xa03d('0x27')]=qs[_0xa03d('0x20')](_['pick'](_0x4db7f5['query'],_0x24c257['filters']),_0x6e05af);if(_0x4db7f5[_0xa03d('0x1f')]['filter']){_0x4b3a10[_0xa03d('0x27')]=_[_0xa03d('0x28')](_0x4b3a10[_0xa03d('0x27')],{'$or':_[_0xa03d('0x19')](_0x6e05af,function(_0x43c29d){if(_0x43c29d[_0xa03d('0x1c')]!=='VIRTUAL'){var _0x2dafa5={};_0x2dafa5[_0x43c29d[_0xa03d('0x16')]]={'$like':'%'+_0x4db7f5[_0xa03d('0x1f')]['filter']+'%'};return _0x2dafa5;}})});}_0x4b3a10=_['merge']({},_0x4b3a10,_0x4db7f5[_0xa03d('0x29')]);var _0x58bf42={'where':_0x4b3a10[_0xa03d('0x27')]};return db[_0xa03d('0x1a')][_0xa03d('0xf')](_0x58bf42)[_0xa03d('0x12')](function(_0x5d695f){_0x99f36[_0xa03d('0xf')]=_0x5d695f;if(_0x4db7f5[_0xa03d('0x1f')][_0xa03d('0x2a')]){_0x4b3a10['include']=[{'all':!![]}];}return db[_0xa03d('0x1a')][_0xa03d('0x2b')](_0x4b3a10);})[_0xa03d('0x12')](function(_0x18f050){_0x99f36['rows']=_[_0xa03d('0x19')](_0x18f050,function(_0x29d68e){if(_0x29d68e['service']===_0xa03d('0x2c')){var _0x4bb5bb=encryptor[_0xa03d('0x2d')](_0x29d68e['data3']);_0x29d68e[_0xa03d('0x2e')]=maskClientSecret(_0x4bb5bb);}return _0x29d68e;});return _0x99f36;})['then'](respondWithFilteredResult(_0x58fea1,_0x4b3a10))[_0xa03d('0x2f')](handleError(_0x58fea1,null));};exports['show']=function(_0x2a312f,_0x27970a){var _0x470d20={'raw':!![],'where':{'id':_0x2a312f[_0xa03d('0x30')]['id']}},_0x29eaf9={};_0x29eaf9['model']=_[_0xa03d('0x31')](db[_0xa03d('0x1a')][_0xa03d('0x1b')]);_0x29eaf9[_0xa03d('0x1f')]=_[_0xa03d('0x31')](_0x2a312f[_0xa03d('0x1f')]);_0x29eaf9[_0xa03d('0x20')]=_[_0xa03d('0x21')](_0x29eaf9[_0xa03d('0x1e')],_0x29eaf9['query']);_0x470d20[_0xa03d('0x22')]=_[_0xa03d('0x21')](_0x29eaf9[_0xa03d('0x1e')],qs[_0xa03d('0x23')](_0x2a312f['query'][_0xa03d('0x23')]));_0x470d20[_0xa03d('0x22')]=_0x470d20['attributes'][_0xa03d('0x32')]?_0x470d20[_0xa03d('0x22')]:_0x29eaf9[_0xa03d('0x1e')];if(_0x2a312f[_0xa03d('0x1f')][_0xa03d('0x2a')]){_0x470d20['include']=[{'all':!![]}];}_0x470d20=_[_0xa03d('0x28')]({},_0x470d20,_0x2a312f[_0xa03d('0x29')]);return db['CloudProvider'][_0xa03d('0x33')](_0x470d20)['then'](handleEntityNotFound(_0x27970a,null))[_0xa03d('0x12')](function(_0x200e2c){if(_0x200e2c['service']===_0xa03d('0x2c')){var _0x42a329=encryptor[_0xa03d('0x2d')](_0x200e2c[_0xa03d('0x2e')]);_0x200e2c['data3']=maskClientSecret(_0x42a329);}return _0x200e2c;})[_0xa03d('0x12')](respondWithResult(_0x27970a,null))[_0xa03d('0x2f')](handleError(_0x27970a,null));};exports[_0xa03d('0x34')]=function(_0x442baa,_0x5ced48){if(!_0x442baa[_0xa03d('0x35')][_0xa03d('0x16')])throw new Error(_0xa03d('0x36'));if(!_0x442baa[_0xa03d('0x35')][_0xa03d('0x37')])throw new Error(_0xa03d('0x38'));var _0x4648c2=db['CloudProvider'][_0xa03d('0x1b')][_0xa03d('0x37')]['values'];if(!_0x4648c2['includes'](_0x442baa['body'][_0xa03d('0x37')]))throw new Error(_0xa03d('0x39')+_0x4648c2[_0xa03d('0x3a')](',\x20'));if(_0x442baa[_0xa03d('0x35')]['service']===_0xa03d('0x2c')&&_0x442baa[_0xa03d('0x35')]['data3']){_0x442baa[_0xa03d('0x35')]['data3']=encryptor[_0xa03d('0x3b')](_0x442baa[_0xa03d('0x35')][_0xa03d('0x2e')]);}return db[_0xa03d('0x1a')][_0xa03d('0x34')](_0x442baa['body'],{})[_0xa03d('0x12')](respondWithResult(_0x5ced48,0xc9))[_0xa03d('0x2f')](handleError(_0x5ced48,null));};exports[_0xa03d('0x11')]=function(_0xafe512,_0x567eab){if(_0xafe512[_0xa03d('0x35')]['id']){delete _0xafe512[_0xa03d('0x35')]['id'];}return db[_0xa03d('0x1a')][_0xa03d('0x33')]({'where':{'id':_0xafe512[_0xa03d('0x30')]['id']}})['then'](handleEntityNotFound(_0x567eab,null))[_0xa03d('0x12')](function(_0x4cf155){if(_0x4cf155[_0xa03d('0x37')]==='MicrosoftAzure'&&_0xafe512['body']['data3']){_0xafe512['body'][_0xa03d('0x2e')]=encryptor[_0xa03d('0x3b')](_0xafe512['body'][_0xa03d('0x2e')]);}return _0x4cf155;})[_0xa03d('0x12')](saveUpdates(_0xafe512[_0xa03d('0x35')],null))['then'](respondWithResult(_0x567eab,null))[_0xa03d('0x2f')](handleError(_0x567eab,null));};exports['destroy']=function(_0x569e68,_0x3ee05f){return db[_0xa03d('0x1a')]['find']({'where':{'id':_0x569e68['params']['id']}})[_0xa03d('0x12')](handleEntityNotFound(_0x3ee05f,null))['then'](removeEntity(_0x3ee05f,null))[_0xa03d('0x2f')](handleError(_0x3ee05f,null));};exports[_0xa03d('0x3c')]=function(_0x33c06d,_0x343e61){return db[_0xa03d('0x1a')]['findOne']({'where':{'id':_0x33c06d[_0xa03d('0x30')]['id']},'raw':!![]})[_0xa03d('0x12')](function(_0x2936f1){if(!_0x2936f1)return _0x343e61[_0xa03d('0x14')](0x194);return{'url':oauth[_0xa03d('0x3d')](_0x2936f1,_0x33c06d[_0xa03d('0x3e')]['id'])};})[_0xa03d('0x12')](respondWithResult(_0x343e61,null))[_0xa03d('0x2f')](handleError(_0x343e61,null));};exports[_0xa03d('0x3f')]=function(_0x5de08c,_0x5d8af5){var _0xc2ad9f=_0x5de08c[_0xa03d('0x35')];var _0x5aa652;var _0x52052c;if(_0xc2ad9f[_0xa03d('0x15')])throw _0xc2ad9f;redis[_0xa03d('0x40')](_0xc2ad9f['state'])[_0xa03d('0x12')](function(_0x1868c2){if(!_0x1868c2)throw new Error(_0xa03d('0x41'));_0x5aa652=JSON['parse'](_0x1868c2);var _0x222006=Buffer[_0xa03d('0x42')](_0xc2ad9f[_0xa03d('0x43')],_0xa03d('0x44'))[_0xa03d('0x45')](_0xa03d('0x46'));_0x52052c=JSON['parse'](_0x222006);if(!oauth['isValidIdToken'](_0xc2ad9f['id_token'],_0x5aa652[_0xa03d('0x47')]))throw new Error(_0xa03d('0x48'));redis[_0xa03d('0x49')](_0xc2ad9f[_0xa03d('0x43')]);return oauth['getOauth2MicrosoftAccessToken'](_0xc2ad9f[_0xa03d('0x4a')],_0x5aa652);})[_0xa03d('0x12')](function(_0x309f57){_0x5aa652[_0xa03d('0x4b')]=_0x309f57[_0xa03d('0x4c')];_0x5aa652[_0xa03d('0x4d')]=_0x309f57[_0xa03d('0x4e')];return db['CloudProvider'][_0xa03d('0x11')]({'data5':_0x5aa652[_0xa03d('0x4b')],'data6':_0x5aa652['data6']},{'where':{'id':_0x5aa652['id']}});})[_0xa03d('0x12')](function(){oauth[_0xa03d('0x4f')](_0x5aa652);socket['emit']('microsoftAuthorization:success',{'id':_0x52052c['id']});return;})['then'](respondWithStatusCode(_0x5d8af5,null))['catch'](function(_0x3d8997){if(_0x52052c){socket[_0xa03d('0x50')](_0xa03d('0x51'),{'id':_0x52052c['id']});}if(!_0x5aa652){logger[_0xa03d('0x15')]('Invalid\x20authentication\x20state\x20parameter',_0x3d8997);return _0x5d8af5[_0xa03d('0xb')](0x1f4)[_0xa03d('0x52')](_0x3d8997[_0xa03d('0x53')]);}logger[_0xa03d('0x15')](_0xa03d('0x54'),_0x5aa652['id'],JSON[_0xa03d('0x55')](_0x3d8997));});}; \ No newline at end of file +var _0xee5d=['Name\x20parameter\x20not\x20specified','values','includes','join','encryptString','findOne','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','ascii','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','code','data5','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','emit','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','find','create','body'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xee5d,0x7a));var _0xdee5=function(_0x54b895,_0x221507){_0x54b895=_0x54b895-0x0;var _0x5314e3=_0xee5d[_0x54b895];return _0x5314e3;};'use strict';var _=require(_0xdee5('0x0'));var Redis=require('ioredis');var qs=require(_0xdee5('0x1'));var encryptor=require(_0xdee5('0x2'));var config=require(_0xdee5('0x3'));var logger=require('../../config/logger')(_0xdee5('0x4'));var db=require(_0xdee5('0x5'))['db'];var oauth=require(_0xdee5('0x6'));config[_0xdee5('0x7')]=_[_0xdee5('0x8')](config[_0xdee5('0x7')],{'host':_0xdee5('0x9'),'port':0x18eb});var socket=require(_0xdee5('0xa'))(new Redis(config[_0xdee5('0x7')]));var redis=new Redis(config[_0xdee5('0x7')]);function respondWithStatusCode(_0x19ffc0,_0x899262){_0x899262=_0x899262||0xcc;return function(_0x4b45ad){if(_0x4b45ad){return _0x19ffc0[_0xdee5('0xb')](_0x899262);}return _0x19ffc0[_0xdee5('0xc')](_0x899262)[_0xdee5('0xd')]();};}function respondWithResult(_0x22ed6d,_0x5db752){_0x5db752=_0x5db752||0xc8;return function(_0x489108){if(_0x489108){return _0x22ed6d[_0xdee5('0xc')](_0x5db752)[_0xdee5('0xe')](_0x489108);}};}function respondWithFilteredResult(_0x44771f,_0x4b3f51){return function(_0x48c9f4){if(_0x48c9f4){var _0x488ddd=typeof _0x4b3f51['offset']===_0xdee5('0xf')&&typeof _0x4b3f51[_0xdee5('0x10')]===_0xdee5('0xf');var _0xe40d00=_0x48c9f4[_0xdee5('0x11')];var _0x233265=_0x488ddd?0x0:_0x4b3f51[_0xdee5('0x12')];var _0x5a384a=_0x488ddd?_0x48c9f4['count']:_0x4b3f51[_0xdee5('0x12')]+_0x4b3f51[_0xdee5('0x10')];var _0x2f1df0;if(_0x5a384a>=_0xe40d00){_0x5a384a=_0xe40d00;_0x2f1df0=0xc8;}else{_0x2f1df0=0xce;}_0x44771f[_0xdee5('0xc')](_0x2f1df0);return _0x44771f[_0xdee5('0x13')]('Content-Range',_0x233265+'-'+_0x5a384a+'/'+_0xe40d00)[_0xdee5('0xe')](_0x48c9f4);}return null;};}function saveUpdates(_0x468fb8){return function(_0x5db97d){if(_0x5db97d){return _0x5db97d[_0xdee5('0x14')](_0x468fb8)[_0xdee5('0x15')](function(_0x98ed4c){return _0x98ed4c;});}return null;};}function removeEntity(_0x1de445){return function(_0x37036f){if(_0x37036f){return _0x37036f[_0xdee5('0x16')]()[_0xdee5('0x15')](function(){_0x1de445[_0xdee5('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e81a2){return function(_0x1e70e4){if(!_0x1e70e4){_0x3e81a2[_0xdee5('0xb')](0x194);}return _0x1e70e4;};}function handleError(_0x1b8bdb,_0x36fc1d){_0x36fc1d=_0x36fc1d||0x1f4;return function(_0x5f1cd1){logger[_0xdee5('0x17')](_0x5f1cd1[_0xdee5('0x18')]);if(_0x5f1cd1['name']){delete _0x5f1cd1[_0xdee5('0x19')];}_0x1b8bdb['status'](_0x36fc1d)[_0xdee5('0x1a')](_0x5f1cd1);};}function maskClientSecret(_0x342932){return _[_0xdee5('0x1b')](_0x342932['slice'](0x0,0x3),0x14,'*');}exports[_0xdee5('0x1c')]=function(_0x32598d,_0xb2d1fc){var _0x56fc56={},_0x3f62dc={},_0x52f8da={'count':0x0,'rows':[]};var _0x419d02=_[_0xdee5('0x1d')](db[_0xdee5('0x1e')][_0xdee5('0x1f')],function(_0x3ea684){return{'name':_0x3ea684['fieldName'],'type':_0x3ea684[_0xdee5('0x20')][_0xdee5('0x21')]};});_0x3f62dc['model']=_[_0xdee5('0x1d')](_0x419d02,'name');_0x3f62dc[_0xdee5('0x22')]=_[_0xdee5('0x23')](_0x32598d[_0xdee5('0x22')]);_0x3f62dc[_0xdee5('0x24')]=_[_0xdee5('0x25')](_0x3f62dc[_0xdee5('0x26')],_0x3f62dc['query']);_0x56fc56[_0xdee5('0x27')]=_[_0xdee5('0x25')](_0x3f62dc[_0xdee5('0x26')],qs[_0xdee5('0x28')](_0x32598d[_0xdee5('0x22')][_0xdee5('0x28')]));_0x56fc56[_0xdee5('0x27')]=_0x56fc56[_0xdee5('0x27')][_0xdee5('0x29')]?_0x56fc56[_0xdee5('0x27')]:_0x3f62dc[_0xdee5('0x26')];if(!_0x32598d[_0xdee5('0x22')][_0xdee5('0x2a')](_0xdee5('0x2b'))){_0x56fc56['limit']=qs['limit'](_0x32598d['query'][_0xdee5('0x10')]);_0x56fc56['offset']=qs[_0xdee5('0x12')](_0x32598d[_0xdee5('0x22')]['offset']);}_0x56fc56['order']=qs[_0xdee5('0x2c')](_0x32598d['query'][_0xdee5('0x2c')]);_0x56fc56[_0xdee5('0x2d')]=qs['filters'](_[_0xdee5('0x2e')](_0x32598d[_0xdee5('0x22')],_0x3f62dc[_0xdee5('0x24')]),_0x419d02);if(_0x32598d[_0xdee5('0x22')][_0xdee5('0x2f')]){_0x56fc56[_0xdee5('0x2d')]=_[_0xdee5('0x30')](_0x56fc56[_0xdee5('0x2d')],{'$or':_['map'](_0x419d02,function(_0x298a6d){if(_0x298a6d[_0xdee5('0x20')]!=='VIRTUAL'){var _0x8efda3={};_0x8efda3[_0x298a6d[_0xdee5('0x19')]]={'$like':'%'+_0x32598d[_0xdee5('0x22')][_0xdee5('0x2f')]+'%'};return _0x8efda3;}})});}_0x56fc56=_[_0xdee5('0x30')]({},_0x56fc56,_0x32598d[_0xdee5('0x31')]);var _0x19751e={'where':_0x56fc56['where']};return db[_0xdee5('0x1e')]['count'](_0x19751e)[_0xdee5('0x15')](function(_0x47ba45){_0x52f8da['count']=_0x47ba45;if(_0x32598d[_0xdee5('0x22')][_0xdee5('0x32')]){_0x56fc56[_0xdee5('0x33')]=[{'all':!![]}];}return db[_0xdee5('0x1e')][_0xdee5('0x34')](_0x56fc56);})[_0xdee5('0x15')](function(_0x3497fb){_0x52f8da[_0xdee5('0x35')]=_['map'](_0x3497fb,function(_0x4d5694){if(_0x4d5694[_0xdee5('0x36')]===_0xdee5('0x37')){var _0x5445a1=encryptor[_0xdee5('0x38')](_0x4d5694['data3']);_0x4d5694[_0xdee5('0x39')]=maskClientSecret(_0x5445a1);}return _0x4d5694;});return _0x52f8da;})['then'](respondWithFilteredResult(_0xb2d1fc,_0x56fc56))[_0xdee5('0x3a')](handleError(_0xb2d1fc,null));};exports[_0xdee5('0x3b')]=function(_0x283d72,_0x1fe59e){var _0x5b5359={'raw':!![],'where':{'id':_0x283d72[_0xdee5('0x3c')]['id']}},_0x228c99={};_0x228c99[_0xdee5('0x26')]=_[_0xdee5('0x23')](db[_0xdee5('0x1e')][_0xdee5('0x1f')]);_0x228c99[_0xdee5('0x22')]=_['keys'](_0x283d72[_0xdee5('0x22')]);_0x228c99[_0xdee5('0x24')]=_['intersection'](_0x228c99[_0xdee5('0x26')],_0x228c99['query']);_0x5b5359[_0xdee5('0x27')]=_['intersection'](_0x228c99[_0xdee5('0x26')],qs['fields'](_0x283d72[_0xdee5('0x22')]['fields']));_0x5b5359['attributes']=_0x5b5359[_0xdee5('0x27')][_0xdee5('0x29')]?_0x5b5359[_0xdee5('0x27')]:_0x228c99['model'];if(_0x283d72[_0xdee5('0x22')][_0xdee5('0x32')]){_0x5b5359[_0xdee5('0x33')]=[{'all':!![]}];}_0x5b5359=_['merge']({},_0x5b5359,_0x283d72['options']);return db[_0xdee5('0x1e')][_0xdee5('0x3d')](_0x5b5359)[_0xdee5('0x15')](handleEntityNotFound(_0x1fe59e,null))['then'](function(_0x48b166){if(_0x48b166['service']===_0xdee5('0x37')){var _0x40cd32=encryptor[_0xdee5('0x38')](_0x48b166[_0xdee5('0x39')]);_0x48b166[_0xdee5('0x39')]=maskClientSecret(_0x40cd32);}return _0x48b166;})[_0xdee5('0x15')](respondWithResult(_0x1fe59e,null))[_0xdee5('0x3a')](handleError(_0x1fe59e,null));};exports[_0xdee5('0x3e')]=function(_0x1b2a84,_0x4d387a){if(!_0x1b2a84[_0xdee5('0x3f')]['name'])throw new Error(_0xdee5('0x40'));if(!_0x1b2a84['body']['service'])throw new Error('Service\x20parameter\x20not\x20specified');var _0x499431=db[_0xdee5('0x1e')][_0xdee5('0x1f')]['service'][_0xdee5('0x41')];if(!_0x499431[_0xdee5('0x42')](_0x1b2a84['body'][_0xdee5('0x36')]))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x499431[_0xdee5('0x43')](',\x20'));if(_0x1b2a84[_0xdee5('0x3f')][_0xdee5('0x36')]===_0xdee5('0x37')&&_0x1b2a84[_0xdee5('0x3f')]['data3']){_0x1b2a84['body'][_0xdee5('0x39')]=encryptor['encryptString'](_0x1b2a84[_0xdee5('0x3f')][_0xdee5('0x39')]);}return db['CloudProvider'][_0xdee5('0x3e')](_0x1b2a84[_0xdee5('0x3f')],{})['then'](respondWithResult(_0x4d387a,0xc9))[_0xdee5('0x3a')](handleError(_0x4d387a,null));};exports[_0xdee5('0x14')]=function(_0x433fe2,_0x537873){if(_0x433fe2[_0xdee5('0x3f')]['id']){delete _0x433fe2['body']['id'];}return db[_0xdee5('0x1e')]['find']({'where':{'id':_0x433fe2[_0xdee5('0x3c')]['id']}})[_0xdee5('0x15')](handleEntityNotFound(_0x537873,null))[_0xdee5('0x15')](function(_0x328516){if(_0x328516['service']===_0xdee5('0x37')&&_0x433fe2[_0xdee5('0x3f')][_0xdee5('0x39')]){_0x433fe2[_0xdee5('0x3f')][_0xdee5('0x39')]=encryptor[_0xdee5('0x44')](_0x433fe2[_0xdee5('0x3f')][_0xdee5('0x39')]);}return _0x328516;})['then'](saveUpdates(_0x433fe2[_0xdee5('0x3f')],null))[_0xdee5('0x15')](respondWithResult(_0x537873,null))[_0xdee5('0x3a')](handleError(_0x537873,null));};exports[_0xdee5('0x16')]=function(_0x3059f7,_0x51f858){return db[_0xdee5('0x1e')][_0xdee5('0x3d')]({'where':{'id':_0x3059f7[_0xdee5('0x3c')]['id']}})[_0xdee5('0x15')](handleEntityNotFound(_0x51f858,null))[_0xdee5('0x15')](removeEntity(_0x51f858,null))[_0xdee5('0x3a')](handleError(_0x51f858,null));};exports['oauth2MicrosoftAuthorize']=function(_0x2fd062,_0x120bae){return db[_0xdee5('0x1e')][_0xdee5('0x45')]({'where':{'id':_0x2fd062['params']['id']},'raw':!![]})[_0xdee5('0x15')](function(_0x557a88){if(!_0x557a88)return _0x120bae[_0xdee5('0xb')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x557a88,_0x2fd062[_0xdee5('0x46')]['id'])};})['then'](respondWithResult(_0x120bae,null))[_0xdee5('0x3a')](handleError(_0x120bae,null));};exports[_0xdee5('0x47')]=function(_0x589038,_0x509e6d){var _0x3c912c=_0x589038[_0xdee5('0x3f')];var _0x2a0323;var _0x7da53f;if(_0x3c912c[_0xdee5('0x17')])throw _0x3c912c;redis[_0xdee5('0x48')](_0x3c912c[_0xdee5('0x49')])['then'](function(_0x553762){if(!_0x553762)throw new Error(_0xdee5('0x4a'));_0x2a0323=JSON[_0xdee5('0x4b')](_0x553762);var _0x27a12c=Buffer[_0xdee5('0x4c')](_0x3c912c[_0xdee5('0x49')],_0xdee5('0x4d'))['toString'](_0xdee5('0x4e'));_0x7da53f=JSON[_0xdee5('0x4b')](_0x27a12c);if(!oauth[_0xdee5('0x4f')](_0x3c912c[_0xdee5('0x50')],_0x2a0323['oauth2Claims']))throw new Error(_0xdee5('0x51'));redis['del'](_0x3c912c[_0xdee5('0x49')]);return oauth['getOauth2MicrosoftAccessToken'](_0x3c912c[_0xdee5('0x52')],_0x2a0323);})[_0xdee5('0x15')](function(_0xe94171){_0x2a0323[_0xdee5('0x53')]=_0xe94171['access_token'];_0x2a0323[_0xdee5('0x54')]=_0xe94171[_0xdee5('0x55')];return db[_0xdee5('0x1e')][_0xdee5('0x14')]({'data5':_0x2a0323['data5'],'data6':_0x2a0323[_0xdee5('0x54')]},{'where':{'id':_0x2a0323['id']}});})[_0xdee5('0x15')](function(){oauth[_0xdee5('0x56')](_0x2a0323);socket['emit'](_0xdee5('0x57'),{'id':_0x7da53f['id']});return;})[_0xdee5('0x15')](respondWithStatusCode(_0x509e6d,null))[_0xdee5('0x3a')](function(_0x59215f){if(_0x7da53f){socket[_0xdee5('0x58')](_0xdee5('0x59'),{'id':_0x7da53f['id']});}if(!_0x2a0323){logger[_0xdee5('0x17')](_0xdee5('0x5a'),_0x59215f);return _0x509e6d['status'](0x1f4)[_0xdee5('0x1a')](_0x59215f[_0xdee5('0x5b')]);}logger[_0xdee5('0x17')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x2a0323['id'],JSON[_0xdee5('0x5c')](_0x59215f));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index b446269..65611d6 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 _0x3ec7=['rimraf','../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','api','bluebird','path'];(function(_0x6d01fd,_0xed4656){var _0x3a1002=function(_0x5f05cb){while(--_0x5f05cb){_0x6d01fd['push'](_0x6d01fd['shift']());}};_0x3a1002(++_0xed4656);}(_0x3ec7,0x69));var _0x73ec=function(_0x1612e0,_0x56275f){_0x1612e0=_0x1612e0-0x0;var _0x2fd5d5=_0x3ec7[_0x1612e0];return _0x2fd5d5;};'use strict';var _=require(_0x73ec('0x0'));var util=require(_0x73ec('0x1'));var logger=require('../../config/logger')(_0x73ec('0x2'));var moment=require('moment');var BPromise=require(_0x73ec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x73ec('0x4'));var rimraf=require(_0x73ec('0x5'));var config=require(_0x73ec('0x6'));var attributes=require(_0x73ec('0x7'));module['exports']=function(_0x44b999,_0x20459e){return _0x44b999[_0x73ec('0x8')](_0x73ec('0x9'),attributes,{'tableName':_0x73ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x062e=['request-promise','exports','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x546ca4,_0x2f0016){var _0x47e1bd=function(_0x1fbb51){while(--_0x1fbb51){_0x546ca4['push'](_0x546ca4['shift']());}};_0x47e1bd(++_0x2f0016);}(_0x062e,0x73));var _0xe062=function(_0x5cbefb,_0x18d3fe){_0x5cbefb=_0x5cbefb-0x0;var _0x2792b9=_0x062e[_0x5cbefb];return _0x2792b9;};'use strict';var _=require(_0xe062('0x0'));var util=require(_0xe062('0x1'));var logger=require(_0xe062('0x2'))(_0xe062('0x3'));var moment=require(_0xe062('0x4'));var BPromise=require(_0xe062('0x5'));var rp=require(_0xe062('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cloudProvider.attributes');module[_0xe062('0x7')]=function(_0x1f720a,_0x17f618){return _0x1f720a[_0xe062('0x8')](_0xe062('0x9'),attributes,{'tableName':_0xe062('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 a2b5731..b583cbb 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 _0xd474=['exports','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','push','/.default','join','Dynamics365','data7','replace','{TENANT_ID}','data2','code','id_token','stringify','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','scope','state','nonce','login','key','oauth2Claims','oauth2/','set','decode','payload','aud','audience','isAfter','exp','resolve','then','refresh_token','data6','decryptString','access_token','CloudProvider','update','catch','error','authorization_code','data3','POST','intervals','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s'];(function(_0x1c71ef,_0x565714){var _0x395d3a=function(_0x33a6ff){while(--_0x33a6ff){_0x1c71ef['push'](_0x1c71ef['shift']());}};_0x395d3a(++_0x565714);}(_0xd474,0x125));var _0x4d47=function(_0x354a8e,_0x23f6ea){_0x354a8e=_0x354a8e-0x0;var _0x30f96e=_0xd474[_0x354a8e];return _0x30f96e;};'use strict';var _=require('lodash');var crypto=require(_0x4d47('0x0'));var jwt=require(_0x4d47('0x1'));var moment=require(_0x4d47('0x2'));var Redis=require(_0x4d47('0x3'));var rp=require('request-promise');var util=require(_0x4d47('0x4'));var encryptor=require(_0x4d47('0x5'));var config=require(_0x4d47('0x6'));var logger=require(_0x4d47('0x7'))('api');var schedule=require(_0x4d47('0x8'));var db=require(_0x4d47('0x9'))['db'];config[_0x4d47('0xa')]=_[_0x4d47('0xb')](config[_0x4d47('0xa')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4d47('0xa')]);var MICROSOFT_AUTH_URL=_0x4d47('0xc');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x4d47('0xd'),_0x4d47('0xe'),_0x4d47('0xf'),_0x4d47('0x10'),'https://outlook.office.com/POP.AccessAsUser.All',_0x4d47('0x11')],'Dynamics365':[_0x4d47('0x12'),_0x4d47('0xf')]};var MICROSOFT_AUTH_ENDPOINT=_0x4d47('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0x4d47('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4b1af7){var _0x339695=_[_0x4d47('0x15')](AZURE_AUTH_SCOPES[_0x4b1af7[_0x4d47('0x16')]]);if(_0x4b1af7[_0x4d47('0x16')]==='Dynamics365')_0x339695[_0x4d47('0x17')](_0x4b1af7['data7']+_0x4d47('0x18'));return _0x339695[_0x4d47('0x19')]('\x20');}function getAccessTokenScope(_0xeb54d2){if(_0xeb54d2['type']==='Outlook365')return _0x4d47('0x10');if(_0xeb54d2[_0x4d47('0x16')]===_0x4d47('0x1a'))return _0xeb54d2[_0x4d47('0x1b')]+_0x4d47('0x18');}function generateMicrosoftAuthorizationUrl(_0x450468,_0x5ebc71){var _0x325c45=MICROSOFT_AUTH_URL[_0x4d47('0x1c')](_0x4d47('0x1d'),_0x450468[_0x4d47('0x1e')]);var _0x5a0997=[_0x4d47('0x1f'),_0x4d47('0x20')];var _0x5c63eb=Buffer['from'](JSON[_0x4d47('0x21')]({'id':_0x5ebc71}))[_0x4d47('0x22')](_0x4d47('0x23'));var _0x2cace0=crypto['randomBytes'](0x10)[_0x4d47('0x22')](_0x4d47('0x24'));var _0x3952b7=getAuthorizationScopes(_0x450468);var _0xbb44a0=[{'key':_0x4d47('0x25'),'value':_0x450468[_0x4d47('0x26')]},{'key':_0x4d47('0x27'),'value':encodeURIComponent(_0x5a0997[_0x4d47('0x19')]('\x20'))},{'key':_0x4d47('0x28'),'value':_0x450468[_0x4d47('0x29')]},{'key':_0x4d47('0x2a'),'value':'form_post'},{'key':_0x4d47('0x2b'),'value':encodeURIComponent(_0x3952b7)},{'key':_0x4d47('0x2c'),'value':_0x5c63eb},{'key':_0x4d47('0x2d'),'value':_0x2cace0},{'key':'prompt','value':_0x4d47('0x2e')}];var _0x4636d7=_0x325c45+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4d47('0x15')](_0xbb44a0,function(_0x56a1a0){return _0x56a1a0[_0x4d47('0x2f')]+'='+_0x56a1a0['value'];})[_0x4d47('0x19')]('&');_0x450468[_0x4d47('0x30')]={'issuer':_0x325c45['replace'](_0x4d47('0x31'),''),'audience':_0x450468[_0x4d47('0x26')],'state':_0x5c63eb,'nonce':_0x2cace0};redis[_0x4d47('0x32')](_0x5c63eb,JSON[_0x4d47('0x21')](_0x450468));return _0x4636d7;}function isValidIdToken(_0x2a05a3,_0x5b581b){try{var _0x63c270=jwt[_0x4d47('0x33')](_0x2a05a3,{'complete':!![]});var _0xbeefe9=_0x63c270[_0x4d47('0x34')];if(_0xbeefe9['iss']!==_0x5b581b['issuer'])return![];if(_0xbeefe9[_0x4d47('0x35')]!==_0x5b581b[_0x4d47('0x36')])return![];if(_0xbeefe9[_0x4d47('0x2d')]!==_0x5b581b['nonce'])return![];if(moment()[_0x4d47('0x37')](moment['unix'](_0xbeefe9[_0x4d47('0x38')])))return![];return!![];}catch(_0x1d4007){throw _0x1d4007;}}function refreshOauth2MicrosoftAccessToken(_0x361dcb){return Promise[_0x4d47('0x39')]()[_0x4d47('0x3a')](function(){if(_0x361dcb['data3'])return _0x361dcb;return db['CloudProvider']['findOne']({'where':{'id':_0x361dcb['id']},'raw':!![]});})[_0x4d47('0x3a')](function(_0x2e1c88){var _0x4e7bcd={'grant_type':_0x4d47('0x3b'),'refresh_token':_0x2e1c88[_0x4d47('0x3c')],'scope':getAccessTokenScope(_0x2e1c88),'redirect_uri':_0x2e1c88[_0x4d47('0x29')],'client_id':_0x2e1c88[_0x4d47('0x26')],'client_secret':encryptor[_0x4d47('0x3d')](_0x2e1c88['data3'])};var _0x1950c8={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x4d47('0x1c')]('{TENANT_ID}',_0x2e1c88[_0x4d47('0x1e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4e7bcd,'json':!![]};return rp(_0x1950c8);})[_0x4d47('0x3a')](function(_0x254455){_0x361dcb['data5']=_0x254455[_0x4d47('0x3e')];_0x361dcb['data6']=_0x254455[_0x4d47('0x3b')];return db[_0x4d47('0x3f')][_0x4d47('0x40')]({'data5':_0x361dcb['data5'],'data6':_0x361dcb[_0x4d47('0x3c')]},{'where':{'id':_0x361dcb['id']}});})[_0x4d47('0x3a')](function(){return _0x361dcb;})[_0x4d47('0x41')](function(_0x2858b6){logger[_0x4d47('0x42')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x361dcb['id'],_0x2858b6);});}function getOauth2MicrosoftAccessToken(_0x3ed79f,_0x858bb9){var _0x231cc6={'grant_type':_0x4d47('0x43'),'code':_0x3ed79f,'scope':getAccessTokenScope(_0x858bb9),'redirect_uri':_0x858bb9[_0x4d47('0x29')],'client_id':_0x858bb9[_0x4d47('0x26')],'client_secret':encryptor[_0x4d47('0x3d')](_0x858bb9[_0x4d47('0x44')])};var _0x373d70={'method':_0x4d47('0x45'),'uri':MICROSOFT_AUTH_URL[_0x4d47('0x1c')](_0x4d47('0x1d'),_0x858bb9['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x231cc6,'json':!![]};return rp(_0x373d70);}function startRefreshInterval(_0x40cf0f){var _0x5ac5af=schedule['intervals'];if(_0x5ac5af[_0x40cf0f['id']])clearInterval(_0x5ac5af[_0x40cf0f['id']]);_0x5ac5af[_0x40cf0f['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x40cf0f['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4d47('0x46')]=_0x5ac5af;}function startAllRefreshIntervals(){return db[_0x4d47('0x3f')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4d47('0x3a')](function(_0x157288){var _0x4334d9=_0x157288[_0x4d47('0x15')](function(_0x34cf07){return refreshOauth2MicrosoftAccessToken(_0x34cf07)[_0x4d47('0x3a')](function(_0x2b1150){startRefreshInterval(_0x2b1150);});});return Promise['all'](_0x4334d9);})['catch'](function(_0x46bb93){var _0x5a8683=_0x46bb93?util['inspect'](_0x46bb93,{'showHidden':![],'depth':null}):'';logger[_0x4d47('0x42')](_0x4d47('0x47'),_0x5a8683);});}module[_0x4d47('0x48')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x441b=['payload','iss','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','POST','data5','access_token','update','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','{TENANT_ID}','intervals','findAll','all','catch','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','api','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','data2','code','id_token','from','stringify','randomBytes','toString','data1','redirect_uri','data4','response_mode','form_post','state','nonce','login','key','oauth2/','decode'];(function(_0x5abe5a,_0x5747c0){var _0x5abba2=function(_0x36c001){while(--_0x36c001){_0x5abe5a['push'](_0x5abe5a['shift']());}};_0x5abba2(++_0x5747c0);}(_0x441b,0x143));var _0xb441=function(_0x5d9454,_0x519530){_0x5d9454=_0x5d9454-0x0;var _0x9618c9=_0x441b[_0x5d9454];return _0x9618c9;};'use strict';var _=require(_0xb441('0x0'));var crypto=require(_0xb441('0x1'));var jwt=require(_0xb441('0x2'));var moment=require(_0xb441('0x3'));var Redis=require(_0xb441('0x4'));var rp=require(_0xb441('0x5'));var util=require(_0xb441('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0xb441('0x7'));var logger=require('../../config/logger')(_0xb441('0x8'));var schedule=require('../../config/schedule/cloud-provider');var db=require('../../mysqldb')['db'];config[_0xb441('0x9')]=_['defaults'](config[_0xb441('0x9')],{'host':_0xb441('0xa'),'port':0x18eb});var redis=new Redis(config[_0xb441('0x9')]);var MICROSOFT_AUTH_URL=_0xb441('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb441('0xc'),_0xb441('0xd'),_0xb441('0xe'),_0xb441('0xf'),_0xb441('0x10'),_0xb441('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb441('0xc'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0xb441('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xb441('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x65d3){var _0x51c334=_[_0xb441('0x14')](AZURE_AUTH_SCOPES[_0x65d3['type']]);if(_0x65d3[_0xb441('0x15')]===_0xb441('0x16'))_0x51c334[_0xb441('0x17')](_0x65d3[_0xb441('0x18')]+_0xb441('0x19'));return _0x51c334[_0xb441('0x1a')]('\x20');}function getAccessTokenScope(_0x23671a){if(_0x23671a['type']===_0xb441('0x1b'))return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x23671a[_0xb441('0x15')]==='Dynamics365')return _0x23671a[_0xb441('0x18')]+_0xb441('0x19');}function generateMicrosoftAuthorizationUrl(_0x38631a,_0x4539a5){var _0x1002a8=MICROSOFT_AUTH_URL[_0xb441('0x1c')]('{TENANT_ID}',_0x38631a[_0xb441('0x1d')]);var _0x22283f=[_0xb441('0x1e'),_0xb441('0x1f')];var _0x4d4fbf=Buffer[_0xb441('0x20')](JSON[_0xb441('0x21')]({'id':_0x4539a5}))['toString']('base64');var _0x17d7cf=crypto[_0xb441('0x22')](0x10)[_0xb441('0x23')]('hex');var _0x175f5d=getAuthorizationScopes(_0x38631a);var _0x149fb8=[{'key':'client_id','value':_0x38631a[_0xb441('0x24')]},{'key':'response_type','value':encodeURIComponent(_0x22283f['join']('\x20'))},{'key':_0xb441('0x25'),'value':_0x38631a[_0xb441('0x26')]},{'key':_0xb441('0x27'),'value':_0xb441('0x28')},{'key':'scope','value':encodeURIComponent(_0x175f5d)},{'key':_0xb441('0x29'),'value':_0x4d4fbf},{'key':_0xb441('0x2a'),'value':_0x17d7cf},{'key':'prompt','value':_0xb441('0x2b')}];var _0x20837e=_0x1002a8+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x149fb8,function(_0x2c4e97){return _0x2c4e97[_0xb441('0x2c')]+'='+_0x2c4e97['value'];})[_0xb441('0x1a')]('&');_0x38631a['oauth2Claims']={'issuer':_0x1002a8[_0xb441('0x1c')](_0xb441('0x2d'),''),'audience':_0x38631a[_0xb441('0x24')],'state':_0x4d4fbf,'nonce':_0x17d7cf};redis['set'](_0x4d4fbf,JSON[_0xb441('0x21')](_0x38631a));return _0x20837e;}function isValidIdToken(_0x36d53d,_0xfe2c0b){try{var _0x17cbe6=jwt[_0xb441('0x2e')](_0x36d53d,{'complete':!![]});var _0x3f3006=_0x17cbe6[_0xb441('0x2f')];if(_0x3f3006[_0xb441('0x30')]!==_0xfe2c0b['issuer'])return![];if(_0x3f3006[_0xb441('0x31')]!==_0xfe2c0b[_0xb441('0x32')])return![];if(_0x3f3006['nonce']!==_0xfe2c0b[_0xb441('0x2a')])return![];if(moment()[_0xb441('0x33')](moment[_0xb441('0x34')](_0x3f3006['exp'])))return![];return!![];}catch(_0x54b22e){throw _0x54b22e;}}function refreshOauth2MicrosoftAccessToken(_0x945501){return Promise[_0xb441('0x35')]()[_0xb441('0x36')](function(){if(_0x945501[_0xb441('0x37')])return _0x945501;return db[_0xb441('0x38')][_0xb441('0x39')]({'where':{'id':_0x945501['id']},'raw':!![]});})[_0xb441('0x36')](function(_0x40c30a){var _0x4c5233={'grant_type':_0xb441('0x3a'),'refresh_token':_0x40c30a[_0xb441('0x3b')],'scope':getAccessTokenScope(_0x40c30a),'redirect_uri':_0x40c30a[_0xb441('0x26')],'client_id':_0x40c30a[_0xb441('0x24')],'client_secret':encryptor['decryptString'](_0x40c30a['data3'])};var _0x550c73={'method':_0xb441('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xb441('0x1c')]('{TENANT_ID}',_0x40c30a['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4c5233,'json':!![]};return rp(_0x550c73);})['then'](function(_0x45896c){_0x945501[_0xb441('0x3d')]=_0x45896c[_0xb441('0x3e')];_0x945501[_0xb441('0x3b')]=_0x45896c[_0xb441('0x3a')];return db['CloudProvider'][_0xb441('0x3f')]({'data5':_0x945501[_0xb441('0x3d')],'data6':_0x945501[_0xb441('0x3b')]},{'where':{'id':_0x945501['id']}});})['then'](function(){return _0x945501;})['catch'](function(_0x517598){logger[_0xb441('0x40')](_0xb441('0x41'),_0x945501['id'],_0x517598);});}function getOauth2MicrosoftAccessToken(_0x386495,_0x433b6c){var _0x5bab47={'grant_type':_0xb441('0x42'),'code':_0x386495,'scope':getAccessTokenScope(_0x433b6c),'redirect_uri':_0x433b6c[_0xb441('0x26')],'client_id':_0x433b6c[_0xb441('0x24')],'client_secret':encryptor['decryptString'](_0x433b6c[_0xb441('0x37')])};var _0x3d62bc={'method':_0xb441('0x3c'),'uri':MICROSOFT_AUTH_URL[_0xb441('0x1c')](_0xb441('0x43'),_0x433b6c[_0xb441('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5bab47,'json':!![]};return rp(_0x3d62bc);}function startRefreshInterval(_0x558af1){var _0x5522db=schedule['intervals'];if(_0x5522db[_0x558af1['id']])clearInterval(_0x5522db[_0x558af1['id']]);_0x5522db[_0x558af1['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x558af1['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb441('0x44')]=_0x5522db;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xb441('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb441('0x36')](function(_0x554117){var _0xed6a23=_0x554117[_0xb441('0x14')](function(_0x253013){return refreshOauth2MicrosoftAccessToken(_0x253013)[_0xb441('0x36')](function(_0x47ba24){startRefreshInterval(_0x47ba24);});});return Promise[_0xb441('0x46')](_0xed6a23);})[_0xb441('0x47')](function(_0x53649a){var _0xd88e59=_0x53649a?util['inspect'](_0x53649a,{'showHidden':![],'depth':null}):'';logger['error'](_0xb441('0x48'),_0xd88e59);});}module[_0xb441('0x49')]={'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 4f6829c..b6b96fb 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 _0xbca0=['stringify','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0xbca0,0x8b));var _0x0bca=function(_0x5803bf,_0x111d24){_0x5803bf=_0x5803bf-0x0;var _0x568aaf=_0xbca0[_0x5803bf];return _0x568aaf;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bca('0x2'));var db=require(_0x0bca('0x3'))['db'];var utils=require(_0x0bca('0x4'));var logger=require(_0x0bca('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bca('0x6'));var client=jayson[_0x0bca('0x7')][_0x0bca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454627,_0x4dcba6,_0x48260c){return new BPromise(function(_0x55fbf0,_0x241ca5){return client[_0x0bca('0x9')](_0x454627,_0x48260c)[_0x0bca('0xa')](function(_0x206194){logger[_0x0bca('0xb')]('CloudProvider,\x20%s,\x20%s',_0x4dcba6,'request\x20sent');logger[_0x0bca('0xc')](_0x0bca('0xd'),_0x4dcba6,_0x0bca('0xe'),JSON[_0x0bca('0xf')](_0x206194));if(_0x206194[_0x0bca('0x10')]){if(_0x206194[_0x0bca('0x10')][_0x0bca('0x11')]===0x1f4){logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x241ca5(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x55fbf0(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}else{logger['info'](_0x0bca('0x12'),_0x4dcba6,_0x0bca('0xe'));_0x55fbf0(_0x206194[_0x0bca('0x14')][_0x0bca('0x13')]);}})[_0x0bca('0x15')](function(_0x2ed970){logger[_0x0bca('0x10')]('CloudProvider,\x20%s,\x20%s',_0x4dcba6,_0x2ed970);_0x241ca5(_0x2ed970);});});} \ No newline at end of file +var _0xcd4d=['http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xcd4d,0xe4));var _0xdcd4=function(_0xa1b35b,_0x39fee5){_0xa1b35b=_0xa1b35b-0x0;var _0xd6942e=_0xcd4d[_0xa1b35b];return _0xd6942e;};'use strict';var _=require(_0xdcd4('0x0'));var util=require(_0xdcd4('0x1'));var moment=require('moment');var BPromise=require(_0xdcd4('0x2'));var rs=require(_0xdcd4('0x3'));var fs=require('fs');var Redis=require(_0xdcd4('0x4'));var db=require(_0xdcd4('0x5'))['db'];var utils=require(_0xdcd4('0x6'));var logger=require(_0xdcd4('0x7'))(_0xdcd4('0x8'));var config=require(_0xdcd4('0x9'));var jayson=require(_0xdcd4('0xa'));var client=jayson[_0xdcd4('0xb')][_0xdcd4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302b60,_0x5b57f6,_0x17f848){return new BPromise(function(_0x198d6c,_0xc0cf59){return client['request'](_0x302b60,_0x17f848)[_0xdcd4('0xd')](function(_0x3cae6d){logger['info'](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));logger[_0xdcd4('0x10')](_0xdcd4('0x11'),_0x5b57f6,_0xdcd4('0xf'),JSON['stringify'](_0x3cae6d));if(_0x3cae6d[_0xdcd4('0x12')]){if(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x13')]===0x1f4){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error'][_0xdcd4('0x14')]);return _0xc0cf59(_0x3cae6d[_0xdcd4('0x12')]['message']);}logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0x3cae6d['error']['message']);return _0x198d6c(_0x3cae6d[_0xdcd4('0x12')][_0xdcd4('0x14')]);}else{logger[_0xdcd4('0x15')](_0xdcd4('0xe'),_0x5b57f6,_0xdcd4('0xf'));_0x198d6c(_0x3cae6d[_0xdcd4('0x16')][_0xdcd4('0x14')]);}})[_0xdcd4('0x17')](function(_0xf57175){logger[_0xdcd4('0x12')](_0xdcd4('0xe'),_0x5b57f6,_0xf57175);_0xc0cf59(_0xf57175);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 92faf9d..c08d34f 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x2bcddb,_0x3eaf37){var _0x12a9e8=function(_0xeeb678){while(--_0xeeb678){_0x2bcddb['push'](_0x2bcddb['shift']());}};_0x12a9e8(++_0x3eaf37);}(_0x1261,0x144));var _0x1126=function(_0x4a9a17,_0x273a09){_0x4a9a17=_0x4a9a17-0x0;var _0x30e831=_0x1261[_0x4a9a17];return _0x30e831;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x4e55a9,_0x241b22){var _0x4a9b67=function(_0x2a3bd1){while(--_0x2a3bd1){_0x4e55a9['push'](_0x4e55a9['shift']());}};_0x4a9b67(++_0x241b22);}(_0x1261,0x144));var _0x1126=function(_0x549cad,_0xc32566){_0x549cad=_0x549cad-0x0;var _0x5a9eed=_0x1261[_0x549cad];return _0x5a9eed;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('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 81ecc17..ab99770 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 _0xa0e7=['name','STRING','sequelize','exports'];(function(_0x111919,_0x5e55c0){var _0x3b7740=function(_0x28ae0c){while(--_0x28ae0c){_0x111919['push'](_0x111919['shift']());}};_0x3b7740(++_0x5e55c0);}(_0xa0e7,0xaa));var _0x7a0e=function(_0x3177f3,_0x2f80bc){_0x3177f3=_0x3177f3-0x0;var _0x43f31e=_0xa0e7[_0x3177f3];return _0x43f31e;};'use strict';var Sequelize=require(_0x7a0e('0x0'));module[_0x7a0e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7a0e('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x7a0e('0x3')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x7a0e('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7a0e('0x3')]},'country':{'type':Sequelize[_0x7a0e('0x3')]},'email':{'type':Sequelize[_0x7a0e('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7a0e('0x3')]},'sStreet':{'type':Sequelize[_0x7a0e('0x3')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x7a0e('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd859=['name','STRING'];(function(_0x26acd7,_0x4466fd){var _0x193640=function(_0x3016ee){while(--_0x3016ee){_0x26acd7['push'](_0x26acd7['shift']());}};_0x193640(++_0x4466fd);}(_0xd859,0x189));var _0x9d85=function(_0x4eed89,_0x108efd){_0x4eed89=_0x4eed89-0x0;var _0x1d6ded=_0xd859[_0x4eed89];return _0x1d6ded;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9d85('0x0')],'unique':_0x9d85('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9d85('0x0')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0x9d85('0x0')]},'phone':{'type':Sequelize[_0x9d85('0x0')]},'fax':{'type':Sequelize[_0x9d85('0x0')]},'type':{'type':Sequelize[_0x9d85('0x0')]},'street':{'type':Sequelize[_0x9d85('0x0')]},'postalCode':{'type':Sequelize[_0x9d85('0x0')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x9d85('0x0')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9d85('0x0')]},'sStreet':{'type':Sequelize[_0x9d85('0x0')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9d85('0x0')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3f3fc77..466b138 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 _0x9f51=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','getContacts','findOne','rawAttributes','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','index','CmCompany','keys','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find','body','user','role','UserProfileSection','userProfileId','create','name'];(function(_0x33f685,_0x4e971f){var _0x150be3=function(_0x434e45){while(--_0x434e45){_0x33f685['push'](_0x33f685['shift']());}};_0x150be3(++_0x4e971f);}(_0x9f51,0x1c7));var _0x19f5=function(_0x54fc68,_0x4d6cd3){_0x54fc68=_0x54fc68-0x0;var _0x23d6d8=_0x9f51[_0x54fc68];return _0x23d6d8;};'use strict';var emlformat=require(_0x19f5('0x0'));var rimraf=require(_0x19f5('0x1'));var zipdir=require(_0x19f5('0x2'));var jsonpatch=require(_0x19f5('0x3'));var rp=require(_0x19f5('0x4'));var moment=require('moment');var BPromise=require(_0x19f5('0x5'));var Mustache=require(_0x19f5('0x6'));var util=require(_0x19f5('0x7'));var path=require(_0x19f5('0x8'));var sox=require(_0x19f5('0x9'));var csv=require(_0x19f5('0xa'));var ejs=require(_0x19f5('0xb'));var fs=require('fs');var fs_extra=require(_0x19f5('0xc'));var _=require(_0x19f5('0xd'));var squel=require(_0x19f5('0xe'));var crypto=require(_0x19f5('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x19f5('0x10'));var toCsv=require(_0x19f5('0xa'));var querystring=require(_0x19f5('0x11'));var Papa=require('papaparse');var Redis=require(_0x19f5('0x12'));var authService=require(_0x19f5('0x13'));var qs=require(_0x19f5('0x14'));var as=require(_0x19f5('0x15'));var hardwareService=require(_0x19f5('0x16'));var logger=require(_0x19f5('0x17'))('api');var utils=require(_0x19f5('0x18'));var config=require(_0x19f5('0x19'));var licenseUtil=require(_0x19f5('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c7d16,_0x4b0d9b){_0x4b0d9b=_0x4b0d9b||0xcc;return function(_0x40c159){if(_0x40c159){return _0x3c7d16[_0x19f5('0x1b')](_0x4b0d9b);}return _0x3c7d16[_0x19f5('0x1c')](_0x4b0d9b)[_0x19f5('0x1d')]();};}function respondWithResult(_0x547f4b,_0x46ab5f){_0x46ab5f=_0x46ab5f||0xc8;return function(_0x50ec26){if(_0x50ec26){return _0x547f4b[_0x19f5('0x1c')](_0x46ab5f)[_0x19f5('0x1e')](_0x50ec26);}};}function respondWithFilteredResult(_0x275056,_0x583342){return function(_0x470562){if(_0x470562){var _0x4ea005=typeof _0x583342[_0x19f5('0x1f')]===_0x19f5('0x20')&&typeof _0x583342[_0x19f5('0x21')]===_0x19f5('0x20');var _0x39e097=_0x470562[_0x19f5('0x22')];var _0x3b69b1=_0x4ea005?0x0:_0x583342[_0x19f5('0x1f')];var _0x37ba30=_0x4ea005?_0x470562['count']:_0x583342['offset']+_0x583342['limit'];var _0x2260b7;if(_0x37ba30>=_0x39e097){_0x37ba30=_0x39e097;_0x2260b7=0xc8;}else{_0x2260b7=0xce;}_0x275056[_0x19f5('0x1c')](_0x2260b7);return _0x275056[_0x19f5('0x23')](_0x19f5('0x24'),_0x3b69b1+'-'+_0x37ba30+'/'+_0x39e097)[_0x19f5('0x1e')](_0x470562);}return null;};}function patchUpdates(_0x525180){return function(_0x4e2ece){try{jsonpatch[_0x19f5('0x25')](_0x4e2ece,_0x525180,!![]);}catch(_0x59ab23){return BPromise[_0x19f5('0x26')](_0x59ab23);}return _0x4e2ece[_0x19f5('0x27')]();};}function saveUpdates(_0x55029f,_0x21b04f){return function(_0x416fda){if(_0x416fda){return _0x416fda[_0x19f5('0x28')](_0x55029f)[_0x19f5('0x29')](function(_0x1bc5ef){return _0x1bc5ef;});}return null;};}function removeEntity(_0x258817,_0x5bd91c){return function(_0x362ae8){if(_0x362ae8){return _0x362ae8[_0x19f5('0x2a')]()[_0x19f5('0x29')](function(){var _0x426dab=_0x362ae8[_0x19f5('0x2b')]({'plain':!![]});var _0x287381=_0x19f5('0x2c');return db[_0x19f5('0x2d')][_0x19f5('0x2a')]({'where':{'type':_0x287381,'resourceId':_0x426dab['id']}})[_0x19f5('0x29')](function(){return _0x362ae8;});})[_0x19f5('0x29')](function(){_0x258817[_0x19f5('0x1c')](0xcc)[_0x19f5('0x1d')]();});}};}function handleEntityNotFound(_0x428f50,_0x2e288){return function(_0x1bf24b){if(!_0x1bf24b){_0x428f50[_0x19f5('0x1b')](0x194);}return _0x1bf24b;};}function handleError(_0x2a4e07,_0x21e689){_0x21e689=_0x21e689||0x1f4;return function(_0x28c8b0){logger[_0x19f5('0x2e')](_0x28c8b0[_0x19f5('0x2f')]);if(_0x28c8b0['name']){delete _0x28c8b0['name'];}_0x2a4e07[_0x19f5('0x1c')](_0x21e689)['send'](_0x28c8b0);};}exports[_0x19f5('0x30')]=function(_0x137aae,_0x4fdd00){var _0xf3c88c={},_0x4003c5={},_0x2da6ea={'count':0x0,'rows':[]};return db[_0x19f5('0x31')]['describe']()[_0x19f5('0x29')](function(_0x29dc91){_0x4003c5['model']=_[_0x19f5('0x32')](_0x29dc91);_0x4003c5[_0x19f5('0x33')]=_[_0x19f5('0x32')](_0x137aae['query']);_0x4003c5[_0x19f5('0x34')]=_[_0x19f5('0x35')](_0x4003c5[_0x19f5('0x36')],_0x4003c5['query']);_0xf3c88c[_0x19f5('0x37')]=_[_0x19f5('0x35')](_0x4003c5[_0x19f5('0x36')],qs[_0x19f5('0x38')](_0x137aae['query'][_0x19f5('0x38')]));_0xf3c88c[_0x19f5('0x37')]=_0xf3c88c[_0x19f5('0x37')][_0x19f5('0x39')]?_0xf3c88c[_0x19f5('0x37')]:_0x4003c5[_0x19f5('0x36')];if(!_0x137aae[_0x19f5('0x33')]['hasOwnProperty']('nolimit')){_0xf3c88c['limit']=qs[_0x19f5('0x21')](_0x137aae['query']['limit']);_0xf3c88c[_0x19f5('0x1f')]=qs[_0x19f5('0x1f')](_0x137aae[_0x19f5('0x33')][_0x19f5('0x1f')]);}_0xf3c88c[_0x19f5('0x3a')]=qs[_0x19f5('0x3b')](_0x137aae[_0x19f5('0x33')][_0x19f5('0x3b')]);_0xf3c88c[_0x19f5('0x3c')]=qs[_0x19f5('0x34')](_[_0x19f5('0x3d')](_0x137aae[_0x19f5('0x33')],_0x4003c5[_0x19f5('0x34')]),_0x29dc91);if(_0x137aae[_0x19f5('0x33')][_0x19f5('0x3e')]){_0xf3c88c[_0x19f5('0x3c')]=_[_0x19f5('0x3f')](_0xf3c88c[_0x19f5('0x3c')],{'$or':_['map'](_0xf3c88c[_0x19f5('0x37')],function(_0x1a3a89){var _0x164df0={};_0x164df0[_0x1a3a89]={'$like':'%'+_0x137aae[_0x19f5('0x33')][_0x19f5('0x3e')]+'%'};return _0x164df0;})});}_0xf3c88c=_[_0x19f5('0x3f')]({},_0xf3c88c,_0x137aae[_0x19f5('0x40')]);var _0x49d31f={'where':_0xf3c88c['where']};return db['CmCompany']['count'](_0x49d31f)['then'](function(_0x444044){_0x2da6ea[_0x19f5('0x22')]=_0x444044;if(_0x137aae['query'][_0x19f5('0x41')]){_0xf3c88c[_0x19f5('0x42')]=[{'all':!![]}];}return db[_0x19f5('0x31')]['findAll'](_0xf3c88c);})[_0x19f5('0x29')](function(_0x4af39a){_0x2da6ea[_0x19f5('0x43')]=_0x4af39a;return _0x2da6ea;})[_0x19f5('0x29')](respondWithFilteredResult(_0x4fdd00,_0xf3c88c))[_0x19f5('0x44')](handleError(_0x4fdd00,null));})['catch'](handleError(_0x4fdd00,null));};exports[_0x19f5('0x45')]=function(_0x3cec0b,_0x4cdf58){var _0x396b1d={'raw':![],'where':{'id':_0x3cec0b[_0x19f5('0x46')]['id']}},_0x27e308={};_0x27e308[_0x19f5('0x36')]=_[_0x19f5('0x32')](db[_0x19f5('0x31')]['rawAttributes']);_0x27e308[_0x19f5('0x33')]=_[_0x19f5('0x32')](_0x3cec0b[_0x19f5('0x33')]);_0x27e308[_0x19f5('0x34')]=_[_0x19f5('0x35')](_0x27e308[_0x19f5('0x36')],_0x27e308[_0x19f5('0x33')]);_0x396b1d['attributes']=_[_0x19f5('0x35')](_0x27e308[_0x19f5('0x36')],qs[_0x19f5('0x38')](_0x3cec0b[_0x19f5('0x33')][_0x19f5('0x38')]));_0x396b1d[_0x19f5('0x37')]=_0x396b1d[_0x19f5('0x37')][_0x19f5('0x39')]?_0x396b1d['attributes']:_0x27e308[_0x19f5('0x36')];if(_0x3cec0b[_0x19f5('0x33')][_0x19f5('0x41')]){_0x396b1d[_0x19f5('0x42')]=[{'all':!![]}];}_0x396b1d=_['merge']({},_0x396b1d,_0x3cec0b[_0x19f5('0x40')]);return db[_0x19f5('0x31')][_0x19f5('0x47')](_0x396b1d)[_0x19f5('0x29')](handleEntityNotFound(_0x4cdf58,null))['then'](respondWithResult(_0x4cdf58,null))[_0x19f5('0x44')](handleError(_0x4cdf58,null));};exports['create']=function(_0x1f878d,_0x778b7){return db[_0x19f5('0x31')]['create'](_0x1f878d[_0x19f5('0x48')],{})[_0x19f5('0x29')](function(_0x20f1d9){var _0x53da1e=_0x1f878d[_0x19f5('0x49')]['get']({'plain':!![]});if(!_0x53da1e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53da1e[_0x19f5('0x4a')]==='user'){var _0x49b7d3=_0x20f1d9['get']({'plain':!![]});var _0x59c759='Companies';return db[_0x19f5('0x4b')][_0x19f5('0x47')]({'where':{'name':_0x59c759,'userProfileId':_0x53da1e[_0x19f5('0x4c')]},'raw':!![]})[_0x19f5('0x29')](function(_0xa9cd25){if(_0xa9cd25&&_0xa9cd25['autoAssociation']===0x0){return db[_0x19f5('0x2d')][_0x19f5('0x4d')]({'name':_0x49b7d3[_0x19f5('0x4e')],'resourceId':_0x49b7d3['id'],'type':_0xa9cd25[_0x19f5('0x4e')],'sectionId':_0xa9cd25['id']},{})[_0x19f5('0x29')](function(){return _0x20f1d9;});}else{return _0x20f1d9;}})['catch'](function(_0x131678){logger[_0x19f5('0x2e')](_0x19f5('0x4f'),_0x131678);throw _0x131678;});}return _0x20f1d9;})[_0x19f5('0x29')](respondWithResult(_0x778b7,0xc9))['catch'](handleError(_0x778b7,null));};exports[_0x19f5('0x28')]=function(_0x42d9b4,_0x96e33c){if(_0x42d9b4['body']['id']){delete _0x42d9b4[_0x19f5('0x48')]['id'];}return db[_0x19f5('0x31')][_0x19f5('0x47')]({'where':{'id':_0x42d9b4[_0x19f5('0x46')]['id']}})[_0x19f5('0x29')](handleEntityNotFound(_0x96e33c,null))['then'](saveUpdates(_0x42d9b4[_0x19f5('0x48')],null))[_0x19f5('0x29')](respondWithResult(_0x96e33c,null))[_0x19f5('0x44')](handleError(_0x96e33c,null));};exports[_0x19f5('0x2a')]=function(_0x39fabf,_0x2b4bd5){return db['CmCompany'][_0x19f5('0x47')]({'where':{'id':_0x39fabf[_0x19f5('0x46')]['id']}})['then'](handleEntityNotFound(_0x2b4bd5,null))[_0x19f5('0x29')](removeEntity(_0x2b4bd5,null))[_0x19f5('0x44')](handleError(_0x2b4bd5,null));};exports[_0x19f5('0x50')]=function(_0x12f52b,_0x18eec2){return db['CmCompany'][_0x19f5('0x50')]()[_0x19f5('0x29')](respondWithResult(_0x18eec2,null))[_0x19f5('0x44')](handleError(_0x18eec2,null));};exports[_0x19f5('0x51')]=function(_0x4ccae7,_0x4d8e24,_0x2104ee){return db[_0x19f5('0x52')]['find']({'where':{'id':_0x4ccae7['params']['id']}})[_0x19f5('0x29')](handleEntityNotFound(_0x4d8e24,null))[_0x19f5('0x29')](function(_0x408ac2){if(_0x408ac2){return _0x408ac2['addContacts'](_0x4ccae7[_0x19f5('0x48')][_0x19f5('0x53')],_['omit'](_0x4ccae7[_0x19f5('0x48')],[_0x19f5('0x53'),'id'])||{});}})[_0x19f5('0x29')](respondWithResult(_0x4d8e24,null))[_0x19f5('0x44')](handleError(_0x4d8e24,null));};exports[_0x19f5('0x54')]=function(_0x2edc7a,_0x4c9943,_0x30df9d){var _0x508b6d={};var _0x1860f2={};var _0x31e5ac;var _0x20897d;return db['CmCompany'][_0x19f5('0x55')]({'where':{'id':_0x2edc7a[_0x19f5('0x46')]['id']}})[_0x19f5('0x29')](handleEntityNotFound(_0x4c9943,null))[_0x19f5('0x29')](function(_0x176ca8){if(_0x176ca8){_0x31e5ac=_0x176ca8;_0x1860f2[_0x19f5('0x36')]=_[_0x19f5('0x32')](db[_0x19f5('0x52')][_0x19f5('0x56')]);_0x1860f2[_0x19f5('0x33')]=_[_0x19f5('0x32')](_0x2edc7a[_0x19f5('0x33')]);_0x1860f2[_0x19f5('0x34')]=_[_0x19f5('0x35')](_0x1860f2[_0x19f5('0x36')],_0x1860f2[_0x19f5('0x33')]);_0x508b6d['attributes']=_[_0x19f5('0x35')](_0x1860f2[_0x19f5('0x36')],qs[_0x19f5('0x38')](_0x2edc7a[_0x19f5('0x33')][_0x19f5('0x38')]));_0x508b6d[_0x19f5('0x37')]=_0x508b6d[_0x19f5('0x37')]['length']?_0x508b6d[_0x19f5('0x37')]:_0x1860f2[_0x19f5('0x36')];_0x508b6d['order']=qs['sort'](_0x2edc7a['query'][_0x19f5('0x3b')]);_0x508b6d['where']=qs['filters'](_[_0x19f5('0x3d')](_0x2edc7a[_0x19f5('0x33')],_0x1860f2[_0x19f5('0x34')]));if(_0x2edc7a[_0x19f5('0x33')][_0x19f5('0x3e')]){_0x508b6d[_0x19f5('0x3c')]=_[_0x19f5('0x3f')](_0x508b6d[_0x19f5('0x3c')],{'$or':_[_0x19f5('0x57')](_0x508b6d['attributes'],function(_0x3f5606){var _0x4fdb36={};_0x4fdb36[_0x3f5606]={'$like':'%'+_0x2edc7a['query']['filter']+'%'};return _0x4fdb36;})});}_0x508b6d=_[_0x19f5('0x3f')]({},_0x508b6d,_0x2edc7a['options']);return _0x31e5ac['getContacts'](_0x508b6d);}})['then'](function(_0x326e88){if(_0x326e88){_0x20897d=_0x326e88[_0x19f5('0x39')];if(!_0x2edc7a['query']['hasOwnProperty'](_0x19f5('0x58'))){_0x508b6d[_0x19f5('0x21')]=qs[_0x19f5('0x21')](_0x2edc7a[_0x19f5('0x33')][_0x19f5('0x21')]);_0x508b6d['offset']=qs[_0x19f5('0x1f')](_0x2edc7a['query'][_0x19f5('0x1f')]);}return _0x31e5ac[_0x19f5('0x54')](_0x508b6d);}})['then'](function(_0x3fcbd3){if(_0x3fcbd3){return _0x3fcbd3?{'count':_0x20897d,'rows':_0x3fcbd3}:null;}})['then'](respondWithResult(_0x4c9943,null))['catch'](handleError(_0x4c9943,null));}; \ No newline at end of file +var _0xc17f=['offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Companies','UserProfileResource','sendStatus','error','stack','name','send','index','CmCompany','keys','intersection','model','query','attributes','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','describe','addContacts','CmContact','find','omit','ids','findOne','map','getContacts','eml-format','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','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'];(function(_0x1fe5e1,_0x16ab87){var _0x29246f=function(_0x300bcf){while(--_0x300bcf){_0x1fe5e1['push'](_0x1fe5e1['shift']());}};_0x29246f(++_0x16ab87);}(_0xc17f,0x199));var _0xfc17=function(_0x496495,_0x454522){_0x496495=_0x496495-0x0;var _0x5a795d=_0xc17f[_0x496495];return _0x5a795d;};'use strict';var emlformat=require(_0xfc17('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc17('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc17('0x2'));var Mustache=require(_0xfc17('0x3'));var util=require(_0xfc17('0x4'));var path=require('path');var sox=require(_0xfc17('0x5'));var csv=require(_0xfc17('0x6'));var ejs=require(_0xfc17('0x7'));var fs=require('fs');var fs_extra=require(_0xfc17('0x8'));var _=require('lodash');var squel=require(_0xfc17('0x9'));var crypto=require(_0xfc17('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc17('0x6'));var querystring=require(_0xfc17('0xb'));var Papa=require(_0xfc17('0xc'));var Redis=require(_0xfc17('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xfc17('0xe'));var as=require(_0xfc17('0xf'));var hardwareService=require(_0xfc17('0x10'));var logger=require(_0xfc17('0x11'))(_0xfc17('0x12'));var utils=require(_0xfc17('0x13'));var config=require(_0xfc17('0x14'));var licenseUtil=require(_0xfc17('0x15'));var db=require(_0xfc17('0x16'))['db'];function respondWithStatusCode(_0x52b04c,_0x1a26e0){_0x1a26e0=_0x1a26e0||0xcc;return function(_0x5a2312){if(_0x5a2312){return _0x52b04c['sendStatus'](_0x1a26e0);}return _0x52b04c[_0xfc17('0x17')](_0x1a26e0)[_0xfc17('0x18')]();};}function respondWithResult(_0x386525,_0x1d4117){_0x1d4117=_0x1d4117||0xc8;return function(_0x49d080){if(_0x49d080){return _0x386525[_0xfc17('0x17')](_0x1d4117)[_0xfc17('0x19')](_0x49d080);}};}function respondWithFilteredResult(_0x108daf,_0x348826){return function(_0x41c1d7){if(_0x41c1d7){var _0x286468=typeof _0x348826[_0xfc17('0x1a')]===_0xfc17('0x1b')&&typeof _0x348826['limit']==='undefined';var _0x23b67e=_0x41c1d7[_0xfc17('0x1c')];var _0x1a4822=_0x286468?0x0:_0x348826[_0xfc17('0x1a')];var _0x22d650=_0x286468?_0x41c1d7['count']:_0x348826[_0xfc17('0x1a')]+_0x348826[_0xfc17('0x1d')];var _0x208a41;if(_0x22d650>=_0x23b67e){_0x22d650=_0x23b67e;_0x208a41=0xc8;}else{_0x208a41=0xce;}_0x108daf[_0xfc17('0x17')](_0x208a41);return _0x108daf[_0xfc17('0x1e')](_0xfc17('0x1f'),_0x1a4822+'-'+_0x22d650+'/'+_0x23b67e)[_0xfc17('0x19')](_0x41c1d7);}return null;};}function patchUpdates(_0x3018c9){return function(_0x293bea){try{jsonpatch[_0xfc17('0x20')](_0x293bea,_0x3018c9,!![]);}catch(_0xb4b549){return BPromise['reject'](_0xb4b549);}return _0x293bea[_0xfc17('0x21')]();};}function saveUpdates(_0x41926e,_0x192f78){return function(_0x31736f){if(_0x31736f){return _0x31736f[_0xfc17('0x22')](_0x41926e)[_0xfc17('0x23')](function(_0x2d3805){return _0x2d3805;});}return null;};}function removeEntity(_0x59d0df,_0x3c7969){return function(_0x2bb479){if(_0x2bb479){return _0x2bb479[_0xfc17('0x24')]()['then'](function(){var _0x84d516=_0x2bb479[_0xfc17('0x25')]({'plain':!![]});var _0x2eefe4=_0xfc17('0x26');return db[_0xfc17('0x27')]['destroy']({'where':{'type':_0x2eefe4,'resourceId':_0x84d516['id']}})[_0xfc17('0x23')](function(){return _0x2bb479;});})[_0xfc17('0x23')](function(){_0x59d0df[_0xfc17('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xde8f5d,_0xa35608){return function(_0x13ae07){if(!_0x13ae07){_0xde8f5d[_0xfc17('0x28')](0x194);}return _0x13ae07;};}function handleError(_0x454e21,_0x30fb76){_0x30fb76=_0x30fb76||0x1f4;return function(_0x188665){logger[_0xfc17('0x29')](_0x188665[_0xfc17('0x2a')]);if(_0x188665[_0xfc17('0x2b')]){delete _0x188665[_0xfc17('0x2b')];}_0x454e21[_0xfc17('0x17')](_0x30fb76)[_0xfc17('0x2c')](_0x188665);};}exports[_0xfc17('0x2d')]=function(_0x5edf41,_0x5da99b){var _0x3a23b5={},_0x5384b1={},_0x1020e2={'count':0x0,'rows':[]};return db[_0xfc17('0x2e')]['describe']()[_0xfc17('0x23')](function(_0x4a6e66){_0x5384b1['model']=_[_0xfc17('0x2f')](_0x4a6e66);_0x5384b1['query']=_[_0xfc17('0x2f')](_0x5edf41['query']);_0x5384b1['filters']=_[_0xfc17('0x30')](_0x5384b1[_0xfc17('0x31')],_0x5384b1[_0xfc17('0x32')]);_0x3a23b5[_0xfc17('0x33')]=_['intersection'](_0x5384b1[_0xfc17('0x31')],qs['fields'](_0x5edf41[_0xfc17('0x32')]['fields']));_0x3a23b5[_0xfc17('0x33')]=_0x3a23b5[_0xfc17('0x33')]['length']?_0x3a23b5[_0xfc17('0x33')]:_0x5384b1[_0xfc17('0x31')];if(!_0x5edf41[_0xfc17('0x32')]['hasOwnProperty'](_0xfc17('0x34'))){_0x3a23b5[_0xfc17('0x1d')]=qs[_0xfc17('0x1d')](_0x5edf41[_0xfc17('0x32')]['limit']);_0x3a23b5['offset']=qs[_0xfc17('0x1a')](_0x5edf41[_0xfc17('0x32')]['offset']);}_0x3a23b5[_0xfc17('0x35')]=qs['sort'](_0x5edf41[_0xfc17('0x32')][_0xfc17('0x36')]);_0x3a23b5['where']=qs[_0xfc17('0x37')](_[_0xfc17('0x38')](_0x5edf41[_0xfc17('0x32')],_0x5384b1['filters']),_0x4a6e66);if(_0x5edf41[_0xfc17('0x32')][_0xfc17('0x39')]){_0x3a23b5[_0xfc17('0x3a')]=_[_0xfc17('0x3b')](_0x3a23b5['where'],{'$or':_['map'](_0x3a23b5['attributes'],function(_0x44f8d1){var _0x1f2714={};_0x1f2714[_0x44f8d1]={'$like':'%'+_0x5edf41['query'][_0xfc17('0x39')]+'%'};return _0x1f2714;})});}_0x3a23b5=_[_0xfc17('0x3b')]({},_0x3a23b5,_0x5edf41[_0xfc17('0x3c')]);var _0x2cb613={'where':_0x3a23b5[_0xfc17('0x3a')]};return db[_0xfc17('0x2e')][_0xfc17('0x1c')](_0x2cb613)[_0xfc17('0x23')](function(_0x49c332){_0x1020e2[_0xfc17('0x1c')]=_0x49c332;if(_0x5edf41[_0xfc17('0x32')][_0xfc17('0x3d')]){_0x3a23b5['include']=[{'all':!![]}];}return db[_0xfc17('0x2e')][_0xfc17('0x3e')](_0x3a23b5);})[_0xfc17('0x23')](function(_0x345803){_0x1020e2[_0xfc17('0x3f')]=_0x345803;return _0x1020e2;})[_0xfc17('0x23')](respondWithFilteredResult(_0x5da99b,_0x3a23b5))[_0xfc17('0x40')](handleError(_0x5da99b,null));})[_0xfc17('0x40')](handleError(_0x5da99b,null));};exports[_0xfc17('0x41')]=function(_0x13d535,_0x31d487){var _0x385fdd={'raw':![],'where':{'id':_0x13d535[_0xfc17('0x42')]['id']}},_0x220f00={};_0x220f00['model']=_[_0xfc17('0x2f')](db[_0xfc17('0x2e')][_0xfc17('0x43')]);_0x220f00[_0xfc17('0x32')]=_[_0xfc17('0x2f')](_0x13d535['query']);_0x220f00['filters']=_[_0xfc17('0x30')](_0x220f00[_0xfc17('0x31')],_0x220f00[_0xfc17('0x32')]);_0x385fdd[_0xfc17('0x33')]=_[_0xfc17('0x30')](_0x220f00[_0xfc17('0x31')],qs[_0xfc17('0x44')](_0x13d535[_0xfc17('0x32')]['fields']));_0x385fdd['attributes']=_0x385fdd['attributes'][_0xfc17('0x45')]?_0x385fdd[_0xfc17('0x33')]:_0x220f00[_0xfc17('0x31')];if(_0x13d535[_0xfc17('0x32')][_0xfc17('0x3d')]){_0x385fdd[_0xfc17('0x46')]=[{'all':!![]}];}_0x385fdd=_['merge']({},_0x385fdd,_0x13d535[_0xfc17('0x3c')]);return db[_0xfc17('0x2e')]['find'](_0x385fdd)[_0xfc17('0x23')](handleEntityNotFound(_0x31d487,null))[_0xfc17('0x23')](respondWithResult(_0x31d487,null))[_0xfc17('0x40')](handleError(_0x31d487,null));};exports[_0xfc17('0x47')]=function(_0x47e0e6,_0x44b366){return db['CmCompany'][_0xfc17('0x47')](_0x47e0e6[_0xfc17('0x48')],{})[_0xfc17('0x23')](function(_0x5c80c5){var _0x282e70=_0x47e0e6[_0xfc17('0x49')][_0xfc17('0x25')]({'plain':!![]});if(!_0x282e70)throw new Error(_0xfc17('0x4a'));if(_0x282e70[_0xfc17('0x4b')]===_0xfc17('0x49')){var _0x82c33d=_0x5c80c5[_0xfc17('0x25')]({'plain':!![]});var _0x30b810=_0xfc17('0x26');return db[_0xfc17('0x4c')]['find']({'where':{'name':_0x30b810,'userProfileId':_0x282e70['userProfileId']},'raw':!![]})[_0xfc17('0x23')](function(_0x6a99a0){if(_0x6a99a0&&_0x6a99a0[_0xfc17('0x4d')]===0x0){return db[_0xfc17('0x27')][_0xfc17('0x47')]({'name':_0x82c33d[_0xfc17('0x2b')],'resourceId':_0x82c33d['id'],'type':_0x6a99a0['name'],'sectionId':_0x6a99a0['id']},{})[_0xfc17('0x23')](function(){return _0x5c80c5;});}else{return _0x5c80c5;}})[_0xfc17('0x40')](function(_0x382f9f){logger[_0xfc17('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x382f9f);throw _0x382f9f;});}return _0x5c80c5;})[_0xfc17('0x23')](respondWithResult(_0x44b366,0xc9))['catch'](handleError(_0x44b366,null));};exports[_0xfc17('0x22')]=function(_0x4f9bfc,_0x44342c){if(_0x4f9bfc[_0xfc17('0x48')]['id']){delete _0x4f9bfc[_0xfc17('0x48')]['id'];}return db[_0xfc17('0x2e')]['find']({'where':{'id':_0x4f9bfc[_0xfc17('0x42')]['id']}})[_0xfc17('0x23')](handleEntityNotFound(_0x44342c,null))[_0xfc17('0x23')](saveUpdates(_0x4f9bfc[_0xfc17('0x48')],null))[_0xfc17('0x23')](respondWithResult(_0x44342c,null))['catch'](handleError(_0x44342c,null));};exports[_0xfc17('0x24')]=function(_0xb18f4c,_0x351178){return db[_0xfc17('0x2e')]['find']({'where':{'id':_0xb18f4c[_0xfc17('0x42')]['id']}})[_0xfc17('0x23')](handleEntityNotFound(_0x351178,null))['then'](removeEntity(_0x351178,null))[_0xfc17('0x40')](handleError(_0x351178,null));};exports[_0xfc17('0x4e')]=function(_0x4c3663,_0x14866c){return db['CmCompany'][_0xfc17('0x4e')]()[_0xfc17('0x23')](respondWithResult(_0x14866c,null))['catch'](handleError(_0x14866c,null));};exports[_0xfc17('0x4f')]=function(_0xa12d71,_0x5e0d33,_0x48d788){return db[_0xfc17('0x50')][_0xfc17('0x51')]({'where':{'id':_0xa12d71[_0xfc17('0x42')]['id']}})[_0xfc17('0x23')](handleEntityNotFound(_0x5e0d33,null))[_0xfc17('0x23')](function(_0x7dbb81){if(_0x7dbb81){return _0x7dbb81[_0xfc17('0x4f')](_0xa12d71[_0xfc17('0x48')]['ids'],_[_0xfc17('0x52')](_0xa12d71['body'],[_0xfc17('0x53'),'id'])||{});}})[_0xfc17('0x23')](respondWithResult(_0x5e0d33,null))[_0xfc17('0x40')](handleError(_0x5e0d33,null));};exports['getContacts']=function(_0x4dedeb,_0x1d57a8,_0xfda52f){var _0x302678={};var _0x2c22b3={};var _0x535d93;var _0x5924c3;return db[_0xfc17('0x2e')][_0xfc17('0x54')]({'where':{'id':_0x4dedeb[_0xfc17('0x42')]['id']}})[_0xfc17('0x23')](handleEntityNotFound(_0x1d57a8,null))[_0xfc17('0x23')](function(_0x2c4456){if(_0x2c4456){_0x535d93=_0x2c4456;_0x2c22b3[_0xfc17('0x31')]=_[_0xfc17('0x2f')](db['CmContact'][_0xfc17('0x43')]);_0x2c22b3[_0xfc17('0x32')]=_[_0xfc17('0x2f')](_0x4dedeb[_0xfc17('0x32')]);_0x2c22b3['filters']=_['intersection'](_0x2c22b3[_0xfc17('0x31')],_0x2c22b3[_0xfc17('0x32')]);_0x302678['attributes']=_[_0xfc17('0x30')](_0x2c22b3['model'],qs[_0xfc17('0x44')](_0x4dedeb['query'][_0xfc17('0x44')]));_0x302678[_0xfc17('0x33')]=_0x302678[_0xfc17('0x33')][_0xfc17('0x45')]?_0x302678['attributes']:_0x2c22b3[_0xfc17('0x31')];_0x302678[_0xfc17('0x35')]=qs[_0xfc17('0x36')](_0x4dedeb[_0xfc17('0x32')][_0xfc17('0x36')]);_0x302678['where']=qs[_0xfc17('0x37')](_[_0xfc17('0x38')](_0x4dedeb[_0xfc17('0x32')],_0x2c22b3[_0xfc17('0x37')]));if(_0x4dedeb[_0xfc17('0x32')][_0xfc17('0x39')]){_0x302678[_0xfc17('0x3a')]=_[_0xfc17('0x3b')](_0x302678[_0xfc17('0x3a')],{'$or':_[_0xfc17('0x55')](_0x302678[_0xfc17('0x33')],function(_0x74ad5f){var _0x163fcf={};_0x163fcf[_0x74ad5f]={'$like':'%'+_0x4dedeb[_0xfc17('0x32')]['filter']+'%'};return _0x163fcf;})});}_0x302678=_[_0xfc17('0x3b')]({},_0x302678,_0x4dedeb[_0xfc17('0x3c')]);return _0x535d93['getContacts'](_0x302678);}})['then'](function(_0x3b4d37){if(_0x3b4d37){_0x5924c3=_0x3b4d37[_0xfc17('0x45')];if(!_0x4dedeb[_0xfc17('0x32')]['hasOwnProperty'](_0xfc17('0x34'))){_0x302678['limit']=qs[_0xfc17('0x1d')](_0x4dedeb[_0xfc17('0x32')][_0xfc17('0x1d')]);_0x302678[_0xfc17('0x1a')]=qs[_0xfc17('0x1a')](_0x4dedeb[_0xfc17('0x32')]['offset']);}return _0x535d93[_0xfc17('0x56')](_0x302678);}})[_0xfc17('0x23')](function(_0x274b18){if(_0x274b18){return _0x274b18?{'count':_0x5924c3,'rows':_0x274b18}:null;}})[_0xfc17('0x23')](respondWithResult(_0x1d57a8,null))[_0xfc17('0x40')](handleError(_0x1d57a8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index dde601f..c7689cf 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 _0x94ba=['request-promise','path','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','moment','bluebird'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x94ba,0xb6));var _0xa94b=function(_0x6f2ce5,_0x4231eb){_0x6f2ce5=_0x6f2ce5-0x0;var _0x28a54a=_0x94ba[_0x6f2ce5];return _0x28a54a;};'use strict';var _=require(_0xa94b('0x0'));var util=require(_0xa94b('0x1'));var logger=require('../../config/logger')(_0xa94b('0x2'));var moment=require(_0xa94b('0x3'));var BPromise=require(_0xa94b('0x4'));var rp=require(_0xa94b('0x5'));var fs=require('fs');var path=require(_0xa94b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa94b('0x7'));module[_0xa94b('0x8')]=function(_0x3e9316,_0x16c6d0){return _0x3e9316['define'](_0xa94b('0x9'),attributes,{'tableName':_0xa94b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb23=['moment','bluebird','path','rimraf','./cmCompany.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x2cd1e4,_0x23d906){var _0x167374=function(_0x496435){while(--_0x496435){_0x2cd1e4['push'](_0x2cd1e4['shift']());}};_0x167374(++_0x23d906);}(_0xdb23,0x193));var _0x3db2=function(_0x288162,_0x24ed5e){_0x288162=_0x288162-0x0;var _0x532710=_0xdb23[_0x288162];return _0x532710;};'use strict';var _=require(_0x3db2('0x0'));var util=require(_0x3db2('0x1'));var logger=require(_0x3db2('0x2'))(_0x3db2('0x3'));var moment=require(_0x3db2('0x4'));var BPromise=require(_0x3db2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3db2('0x6'));var rimraf=require(_0x3db2('0x7'));var config=require('../../config/environment');var attributes=require(_0x3db2('0x8'));module[_0x3db2('0x9')]=function(_0x12e547,_0x11255a){return _0x12e547[_0x3db2('0xa')]('CmCompany',attributes,{'tableName':'cm_companies','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 7d2f473..07cb4e4 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 _0x2e88=['error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x13d0e0,_0x2a661b){var _0x18deff=function(_0x396cd1){while(--_0x396cd1){_0x13d0e0['push'](_0x13d0e0['shift']());}};_0x18deff(++_0x2a661b);}(_0x2e88,0x6e));var _0x82e8=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x2e88[_0x65c50e];return _0x4573e7;};'use strict';var _=require(_0x82e8('0x0'));var util=require('util');var moment=require(_0x82e8('0x1'));var BPromise=require(_0x82e8('0x2'));var rs=require(_0x82e8('0x3'));var fs=require('fs');var Redis=require(_0x82e8('0x4'));var db=require(_0x82e8('0x5'))['db'];var utils=require(_0x82e8('0x6'));var logger=require('../../config/logger')(_0x82e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x82e8('0x8'));var client=jayson['client'][_0x82e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa76301,_0x16f39e,_0x4e4076){return new BPromise(function(_0x3310b7,_0x558128){return client[_0x82e8('0xa')](_0xa76301,_0x4e4076)[_0x82e8('0xb')](function(_0x5a1c88){logger['info'](_0x82e8('0xc'),_0x16f39e,_0x82e8('0xd'));logger['debug'](_0x82e8('0xe'),_0x16f39e,_0x82e8('0xd'),JSON[_0x82e8('0xf')](_0x5a1c88));if(_0x5a1c88[_0x82e8('0x10')]){if(_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x11')]===0x1f4){logger[_0x82e8('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f39e,_0x5a1c88['error'][_0x82e8('0x12')]);return _0x558128(_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x12')]);}logger[_0x82e8('0x10')](_0x82e8('0xc'),_0x16f39e,_0x5a1c88[_0x82e8('0x10')][_0x82e8('0x12')]);return _0x3310b7(_0x5a1c88['error'][_0x82e8('0x12')]);}else{logger[_0x82e8('0x13')](_0x82e8('0xc'),_0x16f39e,_0x82e8('0xd'));_0x3310b7(_0x5a1c88['result']['message']);}})[_0x82e8('0x14')](function(_0x475741){logger[_0x82e8('0x10')]('CmCompany,\x20%s,\x20%s',_0x16f39e,_0x475741);_0x558128(_0x475741);});});} \ No newline at end of file +var _0x41f2=['../../config/logger','rpc','../../config/environment','client','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x2e88a9,_0x1af88b){var _0x3032e9=function(_0x51f335){while(--_0x51f335){_0x2e88a9['push'](_0x2e88a9['shift']());}};_0x3032e9(++_0x1af88b);}(_0x41f2,0x12f));var _0x241f=function(_0x3eee8e,_0x5cd9a5){_0x3eee8e=_0x3eee8e-0x0;var _0x1ff3c9=_0x41f2[_0x3eee8e];return _0x1ff3c9;};'use strict';var _=require(_0x241f('0x0'));var util=require(_0x241f('0x1'));var moment=require(_0x241f('0x2'));var BPromise=require('bluebird');var rs=require(_0x241f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x241f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x241f('0x5'))(_0x241f('0x6'));var config=require(_0x241f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x241f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a3256,_0x29c5ea,_0x2598e9){return new BPromise(function(_0x61d7f7,_0x1d62f6){return client[_0x241f('0x9')](_0x4a3256,_0x2598e9)[_0x241f('0xa')](function(_0xb2f985){logger[_0x241f('0xb')](_0x241f('0xc'),_0x29c5ea,_0x241f('0xd'));logger[_0x241f('0xe')](_0x241f('0xf'),_0x29c5ea,_0x241f('0xd'),JSON[_0x241f('0x10')](_0xb2f985));if(_0xb2f985['error']){if(_0xb2f985[_0x241f('0x11')][_0x241f('0x12')]===0x1f4){logger['error'](_0x241f('0xc'),_0x29c5ea,_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);return _0x1d62f6(_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);}logger[_0x241f('0x11')]('CmCompany,\x20%s,\x20%s',_0x29c5ea,_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);return _0x61d7f7(_0xb2f985[_0x241f('0x11')][_0x241f('0x13')]);}else{logger[_0x241f('0xb')](_0x241f('0xc'),_0x29c5ea,'request\x20sent');_0x61d7f7(_0xb2f985[_0x241f('0x14')]['message']);}})[_0x241f('0x15')](function(_0x4afe6d){logger[_0x241f('0x11')](_0x241f('0xc'),_0x29c5ea,_0x4afe6d);_0x1d62f6(_0x4afe6d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index a410e84..f53ce1b 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 _0x13f0=['describe','/:id','/:id/contacts','post','addContacts','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x54c9e2,_0x5ba1b8){var _0x5762a5=function(_0x4127e7){while(--_0x4127e7){_0x54c9e2['push'](_0x54c9e2['shift']());}};_0x5762a5(++_0x5ba1b8);}(_0x13f0,0x105));var _0x013f=function(_0xc563c0,_0x43cd8c){_0xc563c0=_0xc563c0-0x0;var _0x254edb=_0x13f0[_0xc563c0];return _0x254edb;};'use strict';var multer=require('multer');var util=require(_0x013f('0x0'));var path=require(_0x013f('0x1'));var timeout=require('connect-timeout');var express=require(_0x013f('0x2'));var router=express[_0x013f('0x3')]();var fs_extra=require(_0x013f('0x4'));var auth=require(_0x013f('0x5'));var interaction=require(_0x013f('0x6'));var config=require('../../config/environment');var controller=require(_0x013f('0x7'));router[_0x013f('0x8')]('/',auth[_0x013f('0x9')](),controller[_0x013f('0xa')]);router['get'](_0x013f('0xb'),auth[_0x013f('0x9')](),controller[_0x013f('0xc')]);router[_0x013f('0x8')](_0x013f('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x013f('0x8')](_0x013f('0xe'),auth[_0x013f('0x9')](),controller['getContacts']);router['post']('/',auth[_0x013f('0x9')](),controller['create']);router[_0x013f('0xf')](_0x013f('0xe'),auth['isAuthenticated'](),controller[_0x013f('0x10')]);router[_0x013f('0x11')](_0x013f('0xd'),auth[_0x013f('0x9')](),controller[_0x013f('0x12')]);router[_0x013f('0x13')](_0x013f('0xd'),auth[_0x013f('0x9')](),controller['destroy']);module[_0x013f('0x14')]=router; \ No newline at end of file +var _0x7535=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','/describe','isAuthenticated','describe','show','/:id/contacts','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x5e9e44,_0x4ed138){var _0x3ff2ed=function(_0x4d4e2c){while(--_0x4d4e2c){_0x5e9e44['push'](_0x5e9e44['shift']());}};_0x3ff2ed(++_0x4ed138);}(_0x7535,0x19b));var _0x5753=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x7535[_0x2b4448];return _0xb4b465;};'use strict';var multer=require(_0x5753('0x0'));var util=require(_0x5753('0x1'));var path=require('path');var timeout=require(_0x5753('0x2'));var express=require('express');var router=express[_0x5753('0x3')]();var fs_extra=require(_0x5753('0x4'));var auth=require(_0x5753('0x5'));var interaction=require(_0x5753('0x6'));var config=require(_0x5753('0x7'));var controller=require(_0x5753('0x8'));router[_0x5753('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5753('0x9')](_0x5753('0xa'),auth[_0x5753('0xb')](),controller[_0x5753('0xc')]);router[_0x5753('0x9')]('/:id',auth[_0x5753('0xb')](),controller[_0x5753('0xd')]);router['get'](_0x5753('0xe'),auth[_0x5753('0xb')](),controller['getContacts']);router[_0x5753('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x5753('0xe'),auth[_0x5753('0xb')](),controller[_0x5753('0x10')]);router[_0x5753('0x11')](_0x5753('0x12'),auth[_0x5753('0xb')](),controller[_0x5753('0x13')]);router[_0x5753('0x14')]('/:id',auth[_0x5753('0xb')](),controller[_0x5753('0x15')]);module[_0x5753('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 efc8519..23aa146 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 _0xa92e=['STRING','TEXT','INTEGER','UNSIGNED','NOW','lodash','exports'];(function(_0x16d23e,_0x4e7a32){var _0x2eb8bd=function(_0x54189c){while(--_0x54189c){_0x16d23e['push'](_0x16d23e['shift']());}};_0x2eb8bd(++_0x4e7a32);}(_0xa92e,0x155));var _0xea92=function(_0x3b852e,_0x55abf4){_0x3b852e=_0x3b852e-0x0;var _0x765ea8=_0xa92e[_0x3b852e];return _0x765ea8;};'use strict';var _=require(_0xea92('0x0'));var Sequelize=require('sequelize');module[_0xea92('0x1')]={'firstName':{'type':Sequelize[_0xea92('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xea92('0x2')]},'street':{'type':Sequelize[_0xea92('0x2')]},'postalCode':{'type':Sequelize[_0xea92('0x2')]},'city':{'type':Sequelize[_0xea92('0x2')]},'country':{'type':Sequelize[_0xea92('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xea92('0x3')]},'phone':{'type':Sequelize[_0xea92('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xea92('0x2')]},'url':{'type':Sequelize[_0xea92('0x2')]},'facebook':{'type':Sequelize[_0xea92('0x2')]},'fb_data':{'type':Sequelize[_0xea92('0x2')]},'twitter':{'type':Sequelize[_0xea92('0x2')]},'skype':{'type':Sequelize[_0xea92('0x2')]},'teams':{'type':Sequelize[_0xea92('0x2')]},'viber':{'type':Sequelize[_0xea92('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xea92('0x2')]},'telegram':{'type':Sequelize[_0xea92('0x2')]},'UserId':{'type':Sequelize[_0xea92('0x4')]},'AdditionalPhones':{'type':Sequelize[_0xea92('0x2')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xea92('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xea92('0x6')]},'dialTimezone':{'type':Sequelize[_0xea92('0x2')]},'utcOffset':{'type':Sequelize[_0xea92('0x4')]}}; \ No newline at end of file +var _0x538c=['INTEGER','DATE','NOW','lodash','sequelize','STRING'];(function(_0x15d38b,_0x2f6cbb){var _0x43614e=function(_0x10377d){while(--_0x10377d){_0x15d38b['push'](_0x15d38b['shift']());}};_0x43614e(++_0x2f6cbb);}(_0x538c,0x15f));var _0xc538=function(_0x4e7d22,_0x368b79){_0x4e7d22=_0x4e7d22-0x0;var _0x2c7b4f=_0x538c[_0x4e7d22];return _0x2c7b4f;};'use strict';var _=require(_0xc538('0x0'));var Sequelize=require(_0xc538('0x1'));module['exports']={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xc538('0x2')]},'street':{'type':Sequelize[_0xc538('0x2')]},'postalCode':{'type':Sequelize[_0xc538('0x2')]},'city':{'type':Sequelize[_0xc538('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize['TEXT']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xc538('0x2')]},'fax':{'type':Sequelize[_0xc538('0x2')]},'email':{'type':Sequelize[_0xc538('0x2')]},'url':{'type':Sequelize[_0xc538('0x2')]},'facebook':{'type':Sequelize[_0xc538('0x2')]},'fb_data':{'type':Sequelize[_0xc538('0x2')]},'twitter':{'type':Sequelize[_0xc538('0x2')]},'skype':{'type':Sequelize[_0xc538('0x2')]},'teams':{'type':Sequelize[_0xc538('0x2')]},'viber':{'type':Sequelize[_0xc538('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc538('0x2')]},'telegram':{'type':Sequelize[_0xc538('0x2')]},'UserId':{'type':Sequelize[_0xc538('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xc538('0x2')]},'priority':{'type':Sequelize[_0xc538('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc538('0x4')],'defaultValue':Sequelize[_0xc538('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xc538('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 9e350fb..93df52f 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 _0xa467=['Website','Account','closedAt','disposition','key','Owner','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','util','lodash','ioredis','../../components/contacts','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','describe','then','getOptions','findAll','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','columnName','displayName','analytics','query','CmCustomField','length','alias','custom','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','findOrCreate','spread','all','show','Tags','color','Phones','ContactItemType','ItemType','literal','ListId','$and','omit','map','format','pickBy','cf_%d','table','cm_contacts','toParam','sequelize','values','CmHopper','phone','getTags','model','Tag','intersection','attributes','fields','order','sort','filters','pick','filter','options','nolimit','setTags','ids','setAdditionalPhones','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','findOne','rawAttributes','ContactId','includeAll','getHopperHistories','include','rows','getHopperFinals','CmHopperFinal','getJscriptySessions','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','server/files/tmp','filename','chmodSync','child_process','fork','../../components/import/cm/csv','File\x20uploaded\x20correctly!','pid','upload','createReadStream','file','parse','meta','User','binding','firstName','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','importUpdates','agent','No\x20ListId\x20specified','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','-createdAt','resolve','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','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','DESC','findAndCountAll','fullname','startCase'];(function(_0x5b897c,_0x8cf2a6){var _0x44767f=function(_0x554e55){while(--_0x554e55){_0x5b897c['push'](_0x5b897c['shift']());}};_0x44767f(++_0x8cf2a6);}(_0xa467,0x118));var _0x7a46=function(_0x493c6f,_0x29f930){_0x493c6f=_0x493c6f-0x0;var _0x23ab5a=_0xa467[_0x493c6f];return _0x23ab5a;};'use strict';var moment=require(_0x7a46('0x0'));var BPromise=require(_0x7a46('0x1'));var util=require(_0x7a46('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x7a46('0x3'));var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x7a46('0x4'));var contacts=require(_0x7a46('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x7a46('0x6'))('api');var config=require(_0x7a46('0x7'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config[_0x7a46('0x8')]=_[_0x7a46('0x9')](config['redis'],{'host':_0x7a46('0xa'),'port':0x18eb});var socket=require(_0x7a46('0xb'))(new Redis(config[_0x7a46('0x8')]));require(_0x7a46('0xc'))[_0x7a46('0xd')](socket);function respondWithResult(_0xb1a7bb,_0x1a0f0c){_0x1a0f0c=_0x1a0f0c||0xc8;return function(_0x3dd476){if(_0x3dd476){return _0xb1a7bb[_0x7a46('0xe')](_0x1a0f0c)['json'](_0x3dd476);}};}function respondWithFilteredResult(_0x44f553,_0x4ad9e4){return function(_0x3597ea){if(_0x3597ea){var _0x5346ba=typeof _0x4ad9e4[_0x7a46('0xf')]===_0x7a46('0x10')&&typeof _0x4ad9e4[_0x7a46('0x11')]===_0x7a46('0x10');var _0x4eaeec=_0x3597ea[_0x7a46('0x12')];var _0x4355de=_0x5346ba?0x0:_0x4ad9e4[_0x7a46('0xf')];var _0x1201c8=_0x5346ba?_0x3597ea[_0x7a46('0x12')]:_0x4ad9e4[_0x7a46('0xf')]+_0x4ad9e4[_0x7a46('0x11')];var _0x36511a;if(_0x1201c8>=_0x4eaeec){_0x1201c8=_0x4eaeec;_0x36511a=0xc8;}else{_0x36511a=0xce;}_0x44f553[_0x7a46('0xe')](_0x36511a);return _0x44f553[_0x7a46('0x13')](_0x7a46('0x14'),_0x4355de+'-'+_0x1201c8+'/'+_0x4eaeec)[_0x7a46('0x15')](_0x3597ea);}return null;};}function saveUpdates(_0x4477c5){return function(_0x4434eb){if(_0x4434eb){return _0x4434eb[_0x7a46('0x16')](_0x4477c5)['then'](function(_0x80667){return _0x80667;});}return null;};}function removeEntity(_0x378328){return function(_0x5ef89d){if(_0x5ef89d){return _0x5ef89d[_0x7a46('0x17')]()['then'](function(){_0x378328[_0x7a46('0xe')](0xcc)[_0x7a46('0x18')]();});}};}function handleEntityNotFound(_0xe29521){return function(_0x407677){if(!_0x407677){_0xe29521[_0x7a46('0x19')](0x194);}return _0x407677;};}function handleError(_0x12c75a,_0x38d5a6){_0x38d5a6=_0x38d5a6||0x1f4;return function(_0x2c6912){logger['error'](_0x2c6912[_0x7a46('0x1a')]);if(_0x2c6912[_0x7a46('0x1b')]){delete _0x2c6912['name'];}_0x12c75a['status'](_0x38d5a6)[_0x7a46('0x1c')](_0x2c6912);};}exports[_0x7a46('0x1d')]=function(_0x58c2d5,_0x444e7e){var _0x259454={};return contacts[_0x7a46('0x1e')]()[_0x7a46('0x1f')](function(_0x1f3f54){_0x259454=qs[_0x7a46('0x20')](_0x1f3f54,_0x58c2d5);return contacts[_0x7a46('0x21')](_0x58c2d5['query'],_0x58c2d5[_0x7a46('0x22')],_0x259454,_0x1f3f54);})[_0x7a46('0x1f')](respondWithFilteredResult(_0x444e7e,_0x259454))[_0x7a46('0x23')](handleError(_0x444e7e,null));};exports[_0x7a46('0x17')]=function(_0x5bd8ed,_0x10bff5){return db[_0x7a46('0x24')][_0x7a46('0x25')]({'where':{'id':_0x5bd8ed[_0x7a46('0x26')]['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0x10bff5,null))[_0x7a46('0x1f')](removeEntity(_0x10bff5,null))[_0x7a46('0x23')](handleError(_0x10bff5,null));};exports[_0x7a46('0x1e')]=function(_0x187c6a,_0x1fb7b3){return db['CmContact']['describe']()[_0x7a46('0x1f')](function(_0x45d30e){delete _0x45d30e[_0x7a46('0x27')];for(var _0x3a60f4=0x0;_0x3a60f40x0){return new Promise(function(_0x45ea0e){var _0xd6f659=[];for(var _0x5ce2f8=0x0;_0x5ce2f8<_0x414e05[_0x7a46('0x30')];_0x5ce2f8++){_0xd6f659['push'](insertAdditionalPhones(_0x414e05[_0x5ce2f8]['contact'],_0x414e05[_0x5ce2f8][_0x7a46('0x54')]));}Promise[_0x7a46('0x5d')](_0xd6f659)['then'](function(){_0x45ea0e(0x1);});})[_0x7a46('0x1f')](function(){return{'success':_0x55767e,'failure':_0x5de092,'duplicates':_0x45b8b7};});}else{return{'success':_0x55767e,'failure':_0x5de092,'duplicates':_0x45b8b7};}}})[_0x7a46('0x1f')](respondWithResult(_0x451dc3,0xc9))['catch'](handleError(_0x451dc3,null));};exports[_0x7a46('0x5e')]=function(_0x4b1676,_0x27b0b9){var _0x27e588;return db[_0x7a46('0x24')][_0x7a46('0x1e')]()[_0x7a46('0x1f')](function(_0x308fd3){return db[_0x7a46('0x24')][_0x7a46('0x25')]({'where':{'id':_0x4b1676[_0x7a46('0x26')]['id']},'include':[{'model':db['Tag'],'as':_0x7a46('0x5f'),'attributes':['id',_0x7a46('0x1b'),_0x7a46('0x60')],'required':_0x4b1676[_0x7a46('0x2e')]['tag']?!![]:![]},{'model':db[_0x7a46('0x45')],'as':_0x7a46('0x61'),'where':{'CmContactId':_0x4b1676[_0x7a46('0x26')]['id']},'required':![],'include':[{'model':db[_0x7a46('0x62')],'as':_0x7a46('0x63')}]}],'order':[db['sequelize'][_0x7a46('0x64')]('Phones.OrderBy')],'attributes':_[_0x7a46('0x28')](_0x308fd3)});})['then'](function(_0x4b66eb){if(!_['isNil'](_0x4b66eb)){_0x27e588=_0x4b66eb[_0x7a46('0x3a')]({'plain':!![]});var _0x6952fc={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4b66eb&&_0x4b66eb[_0x7a46('0x65')]){if(_0x4b66eb[_0x7a46('0x65')]){_0x6952fc[_0x7a46('0x5a')][_0x7a46('0x66')][_0x7a46('0x59')]({'ListId':{'$ne':_0x4b66eb['ListId']}});}}return db[_0x7a46('0x2f')][_0x7a46('0x21')](_0x6952fc);}})['then'](function(_0x4390c8){if(!_[_0x7a46('0x51')](_0x4390c8)){return _[_0x7a46('0x67')](_0x27e588,_[_0x7a46('0x68')](_0x4390c8,function(_0x22f2cc){return util[_0x7a46('0x69')]('cf_%d',_0x22f2cc['id']);}));}})['then'](handleEntityNotFound(_0x27b0b9,null))[_0x7a46('0x1f')](respondWithResult(_0x27b0b9,null))[_0x7a46('0x23')](handleError(_0x27b0b9,null));};exports[_0x7a46('0x16')]=function(_0x25870d,_0xaa4c0b){var _0x44f1b2;if(_0x25870d['body']['id']){delete _0x25870d[_0x7a46('0x38')]['id'];}if(!_['isNil'](_0x25870d[_0x7a46('0x38')]['dialTimezone'])){var _0xd89215=_0x25870d['body'][_0x7a46('0x50')];if(!_[_0x7a46('0x51')](shared[_0x7a46('0x52')][_0xd89215]))_0x25870d[_0x7a46('0x38')][_0x7a46('0x53')]=shared[_0x7a46('0x52')][_0xd89215]['utcOffset'];}return db[_0x7a46('0x24')]['find']({'where':{'id':_0x25870d[_0x7a46('0x26')]['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0xaa4c0b,null))[_0x7a46('0x1f')](saveUpdates(_0x25870d[_0x7a46('0x38')],null))[_0x7a46('0x1f')](function(_0x28863a){_0x44f1b2=_0x28863a;var _0x98011c={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x28863a&&_0x28863a[_0x7a46('0x65')]){if(_0x28863a[_0x7a46('0x65')]){_0x98011c[_0x7a46('0x5a')][_0x7a46('0x66')]['push']({'ListId':{'$ne':_0x28863a[_0x7a46('0x65')]}});}}return db[_0x7a46('0x2f')]['findAll'](_0x98011c);})[_0x7a46('0x1f')](function(_0x18b781){if(_0x18b781){return _[_0x7a46('0x67')](_[_0x7a46('0x6a')](_0x25870d[_0x7a46('0x38')],function(_0x4569c5,_0x41df29){return _['startsWith'](_0x41df29,_0x7a46('0x2a'));}),_[_0x7a46('0x68')](_0x18b781,function(_0x2be1c8){return util[_0x7a46('0x69')](_0x7a46('0x6b'),_0x2be1c8['id']);}));}})['then'](function(_0xc0d790){if(_0xc0d790&&!_['isEmpty'](_0xc0d790)){var _0x20ce32=squel[_0x7a46('0x16')]()[_0x7a46('0x6c')](_0x7a46('0x6d'))['setFields'](_0xc0d790)[_0x7a46('0x5a')]('id\x20=\x20?',_0x25870d[_0x7a46('0x26')]['id'])[_0x7a46('0x6e')]();return db[_0x7a46('0x6f')]['query'](_0x20ce32['text'],{'replacements':_0x20ce32[_0x7a46('0x70')]});}})[_0x7a46('0x1f')](function(){if(_0x25870d[_0x7a46('0x38')]['phone']&&_0x44f1b2){return db[_0x7a46('0x71')][_0x7a46('0x16')]({'phone':_0x25870d['body'][_0x7a46('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x44f1b2['id']}});}})[_0x7a46('0x1f')](function(){return _0x44f1b2;})[_0x7a46('0x1f')](respondWithResult(_0xaa4c0b,null))[_0x7a46('0x23')](handleError(_0xaa4c0b,null));};exports[_0x7a46('0x73')]=function(_0x30dca5,_0x460b18){var _0x1fbe42={};var _0x32ec50={};var _0x13c7dd;var _0xcb7b5d;return db[_0x7a46('0x24')]['findOne']({'where':{'id':_0x30dca5[_0x7a46('0x26')]['id']}})['then'](handleEntityNotFound(_0x460b18,null))[_0x7a46('0x1f')](function(_0x3b3119){if(_0x3b3119){_0x13c7dd=_0x3b3119;_0x32ec50[_0x7a46('0x74')]=_['keys'](db[_0x7a46('0x75')]['rawAttributes']);_0x32ec50[_0x7a46('0x2e')]=_['keys'](_0x30dca5['query']);_0x32ec50['filters']=_[_0x7a46('0x76')](_0x32ec50[_0x7a46('0x74')],_0x32ec50[_0x7a46('0x2e')]);_0x1fbe42[_0x7a46('0x77')]=_[_0x7a46('0x76')](_0x32ec50['model'],qs[_0x7a46('0x78')](_0x30dca5[_0x7a46('0x2e')][_0x7a46('0x78')]));_0x1fbe42[_0x7a46('0x77')]=_0x1fbe42[_0x7a46('0x77')][_0x7a46('0x30')]?_0x1fbe42['attributes']:_0x32ec50[_0x7a46('0x74')];_0x1fbe42[_0x7a46('0x79')]=qs[_0x7a46('0x7a')](_0x30dca5['query']['sort']);_0x1fbe42['where']=qs[_0x7a46('0x7b')](_[_0x7a46('0x7c')](_0x30dca5[_0x7a46('0x2e')],_0x32ec50[_0x7a46('0x7b')]));if(_0x30dca5[_0x7a46('0x2e')][_0x7a46('0x7d')]){_0x1fbe42[_0x7a46('0x5a')]=_[_0x7a46('0x37')](_0x1fbe42[_0x7a46('0x5a')],{'$or':_[_0x7a46('0x68')](_0x1fbe42[_0x7a46('0x77')],function(_0x1a4483){var _0x348aac={};_0x348aac[_0x1a4483]={'$like':'%'+_0x30dca5[_0x7a46('0x2e')][_0x7a46('0x7d')]+'%'};return _0x348aac;})});}_0x1fbe42=_['merge']({},_0x1fbe42,_0x30dca5[_0x7a46('0x7e')]);return _0x13c7dd[_0x7a46('0x73')](_0x1fbe42);}})['then'](function(_0xc03790){if(_0xc03790){_0xcb7b5d=_0xc03790[_0x7a46('0x30')];if(!_0x30dca5[_0x7a46('0x2e')]['hasOwnProperty'](_0x7a46('0x7f'))){_0x1fbe42[_0x7a46('0x11')]=qs[_0x7a46('0x11')](_0x30dca5['query']['limit']);_0x1fbe42[_0x7a46('0xf')]=qs[_0x7a46('0xf')](_0x30dca5[_0x7a46('0x2e')][_0x7a46('0xf')]);}return _0x13c7dd['getTags'](_0x1fbe42);}})['then'](function(_0x577abc){if(_0x577abc){return _0x577abc?{'count':_0xcb7b5d,'rows':_0x577abc}:null;}})[_0x7a46('0x1f')](respondWithResult(_0x460b18,null))[_0x7a46('0x23')](handleError(_0x460b18,null));};exports[_0x7a46('0x80')]=function(_0x4dc7dd,_0x1ae607){if(_0x4dc7dd[_0x7a46('0x38')]['id']){delete _0x4dc7dd[_0x7a46('0x38')]['id'];}return db[_0x7a46('0x24')]['findOne']({'where':{'id':_0x4dc7dd['params']['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0x1ae607,null))[_0x7a46('0x1f')](function(_0x221fbc){if(_0x221fbc){return _0x221fbc[_0x7a46('0x80')](_0x4dc7dd[_0x7a46('0x38')][_0x7a46('0x81')]||[]);}return null;})[_0x7a46('0x1f')](respondWithResult(_0x1ae607,null))[_0x7a46('0x23')](handleError(_0x1ae607,null));};exports[_0x7a46('0x82')]=function(_0x11f0e5,_0x2804ba){var _0x5ac295=[];_0x5ac295[_0x7a46('0x59')](addAdditionalPhones(_0x11f0e5[_0x7a46('0x38')]));Promise['all'](_0x5ac295)[_0x7a46('0x1f')](function(){_0x5ac295=[];_0x5ac295[_0x7a46('0x59')](deleteCmHopperPhones(_0x11f0e5[_0x7a46('0x38')]['id']));_0x5ac295[_0x7a46('0x59')](addCmHopperPhones(_0x11f0e5[_0x7a46('0x38')]['id']));Promise['all'](_0x5ac295)[_0x7a46('0x1f')](function(){return[0x1];})['then'](respondWithResult(_0x2804ba,null));});};function addAdditionalPhones(_0x2b54c1){var _0x343342;return new Promise(function(_0x10986b){return db[_0x7a46('0x45')][_0x7a46('0x17')]({'where':{'CmContactId':_0x2b54c1['id']}})['then'](function(){db[_0x7a46('0x62')][_0x7a46('0x21')]({'raw':!![],'attributes':['id','OrderBy']})[_0x7a46('0x1f')](function(_0x490dcc){var _0x135513=[];for(var _0x8bc755=0x0;_0x8bc755<_0x2b54c1[_0x7a46('0x83')][_0x7a46('0x30')];_0x8bc755++){var _0x3aab66=_0x2b54c1['item_types']?_[_0x7a46('0x51')](_0x2b54c1[_0x7a46('0x84')][_0x8bc755])?'':_0x2b54c1[_0x7a46('0x84')][_0x8bc755]:_0x2b54c1[_0x7a46('0x83')][_0x8bc755][_0x7a46('0x85')]?_0x2b54c1['items'][_0x8bc755][_0x7a46('0x85')]:'';var _0x714f4e=_[_0x7a46('0x51')](_0x2b54c1[_0x7a46('0x83')][_0x8bc755]['description'])?'':_0x2b54c1['items'][_0x8bc755][_0x7a46('0x86')];var _0xc6f28f=_0x3aab66+':'+_0x2b54c1['items'][_0x8bc755]['phone']+'§'+_0x714f4e;if(_[_0x7a46('0x51')](_0x343342))_0x343342=_0xc6f28f;else _0x343342+=';'+_0xc6f28f;var _0x113f67=null;var _0x2162cb=null;if(_0x2b54c1['item_types']){if(!_[_0x7a46('0x51')](_0x2b54c1[_0x7a46('0x84')][_0x8bc755])){_0x2162cb=_[_0x7a46('0x25')](_0x490dcc,function(_0x346361){return _0x346361['id']===_0x2b54c1[_0x7a46('0x84')][_0x8bc755];});if(!_[_0x7a46('0x51')](_0x2162cb)){_0x113f67=_0x2162cb[_0x7a46('0x87')];}}}else{if(!_[_0x7a46('0x51')](_0x2b54c1[_0x7a46('0x83')][_0x8bc755])){_0x2162cb=_[_0x7a46('0x25')](_0x490dcc,function(_0x3ced76){return _0x3ced76['id']===_0x2b54c1[_0x7a46('0x83')][_0x8bc755][_0x7a46('0x85')];});if(!_[_0x7a46('0x51')](_0x2162cb)){_0x113f67=_0x8bc755;}}}if(_['isNil'](_0x113f67)){_0x113f67=0x64;}_0x135513[_0x7a46('0x59')](addAdditionalPhone(_0x2b54c1['id'],_0x2b54c1[_0x7a46('0x83')][_0x8bc755]['phone'],_0x2b54c1['item_types']?_[_0x7a46('0x51')](_0x2b54c1[_0x7a46('0x84')][_0x8bc755])?null:_0x2b54c1['item_types'][_0x8bc755]:_0x2b54c1[_0x7a46('0x83')][_0x8bc755]['ItemTypeId']?_0x2b54c1[_0x7a46('0x83')][_0x8bc755][_0x7a46('0x85')]:null,_0x113f67,_0x714f4e));}Promise[_0x7a46('0x5d')](_0x135513)[_0x7a46('0x1f')](function(){db[_0x7a46('0x24')][_0x7a46('0x16')]({'AdditionalPhones':_0x343342},{'where':{'id':_0x2b54c1['id']}})[_0x7a46('0x1f')](function(){_0x10986b(0x1);});});});});});}function addAdditionalPhone(_0x2ea48f,_0x4b7ec3,_0x395720,_0x29ede7,_0x29a268){return db[_0x7a46('0x45')][_0x7a46('0x25')]({'where':{'CmContactId':_0x2ea48f,'item':_0x4b7ec3}})[_0x7a46('0x1f')](function(_0x51309e){if(_0x51309e)logger[_0x7a46('0x33')](_0x7a46('0x88'),_0x51309e);else{db[_0x7a46('0x45')]['create']({'CmContactId':_0x2ea48f,'item':_0x4b7ec3,'ItemTypeId':_0x395720,'OrderBy':_0x29ede7,'ItemClass':_0x7a46('0x89'),'description':_0x29a268});}});}function deleteCmHopperPhones(_0x4f0612){return new Promise(function(_0x8e9f77){return db[_0x7a46('0x71')][_0x7a46('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4f0612}})[_0x7a46('0x1f')](function(_0x23da08){db[_0x7a46('0x8a')][_0x7a46('0x17')]({'where':{'CmHopperId':{'$in':_[_0x7a46('0x68')](_0x23da08,'id')}}});})[_0x7a46('0x1f')](function(){_0x8e9f77(0x1);});});}function addCmHopperPhones(_0x5b82df){return new Promise(function(_0x43adf7){return db['CmHopper'][_0x7a46('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5b82df}})['then'](function(_0x370ee4){var _0x25d426=[];_[_0x7a46('0x68')](_0x370ee4,function(_0xd4f756){_0x25d426[_0x7a46('0x59')](createCmHopperPhone(_0x5b82df,_0xd4f756['id']));});Promise[_0x7a46('0x5d')](_0x25d426)[_0x7a46('0x1f')](function(){_0x43adf7(0x1);});});});}function createCmHopperPhone(_0x1b9c58,_0x4bc75c){return new Promise(function(_0x8c1da8){db[_0x7a46('0x45')]['findAll']({'raw':!![],'attributes':[_0x7a46('0x8b'),_0x7a46('0x87')],'where':{'CmContactId':_0x1b9c58,'ItemClass':_0x7a46('0x89')},'include':[{'model':db[_0x7a46('0x62')],'attributes':['OrderBy'],'as':'ItemType'}],'order':['OrderBy',db[_0x7a46('0x6f')][_0x7a46('0x64')](_0x7a46('0x8c'))]})[_0x7a46('0x1f')](function(_0x37ccb1){var _0x247027=0x1;var _0x32950c=_[_0x7a46('0x68')](_0x37ccb1,function(_0x22c5ba){_0x22c5ba[_0x7a46('0x8d')]=_0x4bc75c;_0x22c5ba['phone']=_0x22c5ba[_0x7a46('0x8b')];_0x22c5ba['OrderBy']=_0x247027;delete _0x22c5ba[_0x7a46('0x8e')];_0x247027=_0x247027+0x1;return _0x22c5ba;});return db[_0x7a46('0x8a')][_0x7a46('0x55')](_0x32950c,{});})[_0x7a46('0x1f')](function(){_0x8c1da8(0x1);});});}function insertAdditionalPhones(_0x5ee6e2,_0x1a0ec8){return new Promise(function(_0x438a78){var _0x24171f=[];for(var _0x3208f1=0x0;_0x3208f1<_0x1a0ec8[_0x7a46('0x30')];_0x3208f1++){var _0x42efcd=_0x1a0ec8[_0x3208f1];_0x24171f['push'](parseContactItemType(_0x42efcd));}Promise[_0x7a46('0x5d')](_0x24171f)['then'](function(){var _0x320b9f={'id':_0x5ee6e2['id'],'items':_0x1a0ec8};return addAdditionalPhones(_0x320b9f)[_0x7a46('0x1f')](function(){return addCmHopperPhones(_0x5ee6e2['id']);});})[_0x7a46('0x1f')](function(){_0x438a78(_0x5ee6e2);});});}function parseContactItemType(_0xef39f3){return new Promise(function(_0x10d6da){if(_0xef39f3[_0x7a46('0x36')](_0x7a46('0x85'))){_0x10d6da(_0xef39f3);}else{return db[_0x7a46('0x62')][_0x7a46('0x25')]({'where':{'name':_0xef39f3['ItemType']}})[_0x7a46('0x1f')](function(_0x379d27){if(_[_0x7a46('0x51')](_0x379d27))_0xef39f3['ItemTypeId']=null;else _0xef39f3[_0x7a46('0x85')]=_0x379d27['id'];_0x10d6da(_0xef39f3);});}});}exports[_0x7a46('0x8f')]=function(_0x69a445,_0x580018){return db[_0x7a46('0x45')][_0x7a46('0x21')]({'raw':!![],'where':{'CmContactId':_0x69a445[_0x7a46('0x26')]['id'],'ItemClass':_0x7a46('0x89')},'include':[{'model':db['ContactItemType'],'as':_0x7a46('0x63')}],'order':[[_0x7a46('0x87')],[db[_0x7a46('0x6f')][_0x7a46('0x64')](_0x7a46('0x8c'))]]})['then'](function(_0x7edcd4){return _0x7edcd4;})[_0x7a46('0x1f')](respondWithResult(_0x580018,null))[_0x7a46('0x23')](handleError(_0x580018,null));};exports[_0x7a46('0x90')]=function(_0xc2f5d8,_0x747abe){return db['CmContactHasItem'][_0x7a46('0x21')]({'raw':!![],'where':{'CmContactId':_0xc2f5d8[_0x7a46('0x38')][_0x7a46('0x91')]}})[_0x7a46('0x1f')](function(_0x559d02){var _0x45b18f=_[_0x7a46('0x68')](_0x559d02,function(_0x4f60aa){_0x4f60aa[_0x7a46('0x92')]=_0xc2f5d8[_0x7a46('0x38')][_0x7a46('0x93')];return _0x4f60aa;});return db[_0x7a46('0x45')][_0x7a46('0x55')](_0x45b18f,{});})[_0x7a46('0x1f')](function(){return addCmHopperPhones(_0xc2f5d8[_0x7a46('0x38')][_0x7a46('0x93')]);})['then'](function(){return['ok'];})[_0x7a46('0x1f')](respondWithResult(_0x747abe,null))[_0x7a46('0x23')](handleError(_0x747abe,null));};exports[_0x7a46('0x94')]=function(_0x58011a,_0x317d93){var _0x169905=[];_0x169905['push'](createCmHopperPhone(_0x58011a['body']['id'],_0x58011a['body'][_0x7a46('0x95')]));Promise['all'](_0x169905)[_0x7a46('0x1f')](function(){return[0x1];})['then'](respondWithResult(_0x317d93,null));};exports['getHoppers']=function(_0x2e29f1,_0x1fd6cf){var _0x1cec3c={'raw':![],'where':{}};var _0x2cd59d={};var _0xd58273={'count':0x0,'rows':[]};return db['CmContact'][_0x7a46('0x96')]({'where':{'id':_0x2e29f1[_0x7a46('0x26')]['id']}})['then'](handleEntityNotFound(_0x1fd6cf,null))[_0x7a46('0x1f')](function(_0x1285d4){if(_0x1285d4){_0x2cd59d[_0x7a46('0x74')]=_[_0x7a46('0x28')](db[_0x7a46('0x71')][_0x7a46('0x97')]);_0x2cd59d['query']=_['keys'](_0x2e29f1[_0x7a46('0x2e')]);_0x2cd59d[_0x7a46('0x7b')]=_['intersection'](_0x2cd59d['model'],_0x2cd59d['query']);_0x1cec3c['attributes']=_[_0x7a46('0x76')](_0x2cd59d['model'],qs[_0x7a46('0x78')](_0x2e29f1['query']['fields']));_0x1cec3c[_0x7a46('0x77')]=_0x1cec3c[_0x7a46('0x77')][_0x7a46('0x30')]?_0x1cec3c[_0x7a46('0x77')]:_0x2cd59d[_0x7a46('0x74')];if(!_0x2e29f1[_0x7a46('0x2e')][_0x7a46('0x36')]('nolimit')){_0x1cec3c[_0x7a46('0x11')]=qs[_0x7a46('0x11')](_0x2e29f1['query'][_0x7a46('0x11')]);_0x1cec3c[_0x7a46('0xf')]=qs[_0x7a46('0xf')](_0x2e29f1[_0x7a46('0x2e')][_0x7a46('0xf')]);}_0x1cec3c[_0x7a46('0x79')]=qs['sort'](_0x2e29f1[_0x7a46('0x2e')][_0x7a46('0x7a')]);_0x1cec3c[_0x7a46('0x5a')]=qs[_0x7a46('0x7b')](_[_0x7a46('0x7c')](_0x2e29f1['query'],_0x2cd59d[_0x7a46('0x7b')]));_0x1cec3c[_0x7a46('0x5a')][_0x7a46('0x98')]=_0x1285d4['id'];if(_0x2e29f1[_0x7a46('0x2e')]['filter']){_0x1cec3c[_0x7a46('0x5a')]=_[_0x7a46('0x37')](_0x1cec3c[_0x7a46('0x5a')],{'$or':_[_0x7a46('0x68')](_0x1cec3c[_0x7a46('0x77')],function(_0x5ae603){var _0x5b1802={};_0x5b1802[_0x5ae603]={'$like':'%'+_0x2e29f1[_0x7a46('0x2e')][_0x7a46('0x7d')]+'%'};return _0x5b1802;})});}_0x1cec3c=_[_0x7a46('0x37')]({},_0x1cec3c,_0x2e29f1['options']);return db[_0x7a46('0x71')][_0x7a46('0x12')]({'where':_0x1cec3c[_0x7a46('0x5a')]})[_0x7a46('0x1f')](function(_0x19511b){_0xd58273[_0x7a46('0x12')]=_0x19511b;if(_0x2e29f1['query'][_0x7a46('0x99')]){_0x1cec3c['include']=[{'all':!![]}];}return db[_0x7a46('0x71')]['findAll'](_0x1cec3c);})[_0x7a46('0x1f')](function(_0x3a7b1a){_0xd58273['rows']=_0x3a7b1a;return _0xd58273;});}})[_0x7a46('0x1f')](respondWithFilteredResult(_0x1fd6cf,_0x1cec3c))['catch'](handleError(_0x1fd6cf,null));};exports[_0x7a46('0x9a')]=function(_0x2c85e6,_0x1d8d38){var _0x57f60d={'raw':!![],'where':{}};var _0x4dfbec={};var _0x32136c={'count':0x0,'rows':[]};return db[_0x7a46('0x24')][_0x7a46('0x96')]({'where':{'id':_0x2c85e6[_0x7a46('0x26')]['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0x1d8d38,null))[_0x7a46('0x1f')](function(_0x35f7f4){if(_0x35f7f4){_0x4dfbec[_0x7a46('0x74')]=_[_0x7a46('0x28')](db[_0x7a46('0x46')][_0x7a46('0x97')]);_0x4dfbec[_0x7a46('0x2e')]=_[_0x7a46('0x28')](_0x2c85e6[_0x7a46('0x2e')]);_0x4dfbec[_0x7a46('0x7b')]=_[_0x7a46('0x76')](_0x4dfbec[_0x7a46('0x74')],_0x4dfbec['query']);_0x57f60d[_0x7a46('0x77')]=_[_0x7a46('0x76')](_0x4dfbec[_0x7a46('0x74')],qs[_0x7a46('0x78')](_0x2c85e6[_0x7a46('0x2e')]['fields']));_0x57f60d[_0x7a46('0x77')]=_0x57f60d[_0x7a46('0x77')][_0x7a46('0x30')]?_0x57f60d[_0x7a46('0x77')]:_0x4dfbec[_0x7a46('0x74')];if(!_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0x36')]('nolimit')){_0x57f60d[_0x7a46('0x11')]=qs['limit'](_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0x11')]);_0x57f60d[_0x7a46('0xf')]=qs[_0x7a46('0xf')](_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0xf')]);}_0x57f60d[_0x7a46('0x79')]=qs['sort'](_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0x7a')]);_0x57f60d[_0x7a46('0x5a')]=qs[_0x7a46('0x7b')](_[_0x7a46('0x7c')](_0x2c85e6['query'],_0x4dfbec['filters']));_0x57f60d['where'][_0x7a46('0x98')]=_0x35f7f4['id'];if(_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0x7d')]){_0x57f60d[_0x7a46('0x5a')]=_[_0x7a46('0x37')](_0x57f60d[_0x7a46('0x5a')],{'$or':_['map'](_0x57f60d['attributes'],function(_0x48c783){var _0x5eebbf={};_0x5eebbf[_0x48c783]={'$like':'%'+_0x2c85e6['query']['filter']+'%'};return _0x5eebbf;})});}_0x57f60d=_[_0x7a46('0x37')]({},_0x57f60d,_0x2c85e6['options']);return db[_0x7a46('0x46')][_0x7a46('0x12')]({'where':_0x57f60d[_0x7a46('0x5a')]})[_0x7a46('0x1f')](function(_0xc210e7){_0x32136c['count']=_0xc210e7;if(_0x2c85e6[_0x7a46('0x2e')][_0x7a46('0x99')]){_0x57f60d[_0x7a46('0x9b')]=[{'all':!![]}];}return db[_0x7a46('0x46')][_0x7a46('0x21')](_0x57f60d);})[_0x7a46('0x1f')](function(_0x2177bf){_0x32136c[_0x7a46('0x9c')]=_0x2177bf;return _0x32136c;});}})[_0x7a46('0x1f')](respondWithFilteredResult(_0x1d8d38,_0x57f60d))[_0x7a46('0x23')](handleError(_0x1d8d38,null));};exports[_0x7a46('0x9d')]=function(_0x388d99,_0x396e2f){var _0x144e5a={'raw':!![],'where':{}};var _0x408c49={};var _0x348ac5={'count':0x0,'rows':[]};return db[_0x7a46('0x24')][_0x7a46('0x96')]({'where':{'id':_0x388d99[_0x7a46('0x26')]['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0x396e2f,null))['then'](function(_0x16fbcb){if(_0x16fbcb){_0x408c49['model']=_[_0x7a46('0x28')](db[_0x7a46('0x9e')]['rawAttributes']);_0x408c49[_0x7a46('0x2e')]=_[_0x7a46('0x28')](_0x388d99[_0x7a46('0x2e')]);_0x408c49[_0x7a46('0x7b')]=_[_0x7a46('0x76')](_0x408c49['model'],_0x408c49[_0x7a46('0x2e')]);_0x144e5a[_0x7a46('0x77')]=_[_0x7a46('0x76')](_0x408c49[_0x7a46('0x74')],qs[_0x7a46('0x78')](_0x388d99[_0x7a46('0x2e')][_0x7a46('0x78')]));_0x144e5a['attributes']=_0x144e5a[_0x7a46('0x77')][_0x7a46('0x30')]?_0x144e5a[_0x7a46('0x77')]:_0x408c49['model'];if(!_0x388d99['query'][_0x7a46('0x36')](_0x7a46('0x7f'))){_0x144e5a['limit']=qs[_0x7a46('0x11')](_0x388d99[_0x7a46('0x2e')][_0x7a46('0x11')]);_0x144e5a[_0x7a46('0xf')]=qs[_0x7a46('0xf')](_0x388d99[_0x7a46('0x2e')][_0x7a46('0xf')]);}_0x144e5a[_0x7a46('0x79')]=qs[_0x7a46('0x7a')](_0x388d99['query'][_0x7a46('0x7a')]);_0x144e5a[_0x7a46('0x5a')]=qs[_0x7a46('0x7b')](_[_0x7a46('0x7c')](_0x388d99[_0x7a46('0x2e')],_0x408c49[_0x7a46('0x7b')]));_0x144e5a[_0x7a46('0x5a')][_0x7a46('0x98')]=_0x16fbcb['id'];if(_0x388d99[_0x7a46('0x2e')][_0x7a46('0x7d')]){_0x144e5a['where']=_[_0x7a46('0x37')](_0x144e5a[_0x7a46('0x5a')],{'$or':_[_0x7a46('0x68')](_0x144e5a[_0x7a46('0x77')],function(_0x3e899b){var _0x36da4d={};_0x36da4d[_0x3e899b]={'$like':'%'+_0x388d99[_0x7a46('0x2e')][_0x7a46('0x7d')]+'%'};return _0x36da4d;})});}_0x144e5a=_[_0x7a46('0x37')]({},_0x144e5a,_0x388d99[_0x7a46('0x7e')]);return db[_0x7a46('0x9e')][_0x7a46('0x12')]({'where':_0x144e5a['where']})['then'](function(_0x45ee9d){_0x348ac5[_0x7a46('0x12')]=_0x45ee9d;if(_0x388d99['query'][_0x7a46('0x99')]){_0x144e5a['include']=[{'all':!![]}];}return db[_0x7a46('0x9e')]['findAll'](_0x144e5a);})[_0x7a46('0x1f')](function(_0x560baf){_0x348ac5[_0x7a46('0x9c')]=_0x560baf;return _0x348ac5;});}})[_0x7a46('0x1f')](respondWithFilteredResult(_0x396e2f,_0x144e5a))[_0x7a46('0x23')](handleError(_0x396e2f,null));};exports[_0x7a46('0x9f')]=function(_0xbdd111,_0x249882){var _0x4ec6e3={'raw':!![],'where':{}};var _0x19a69a={};var _0x42050b={'count':0x0,'rows':[]};return db[_0x7a46('0x24')][_0x7a46('0x96')]({'where':{'id':_0xbdd111['params']['id']}})[_0x7a46('0x1f')](handleEntityNotFound(_0x249882,null))[_0x7a46('0x1f')](function(_0x395d67){if(_0x395d67){_0x19a69a['model']=_[_0x7a46('0x28')](db[_0x7a46('0x4d')][_0x7a46('0x97')]);_0x19a69a['query']=_[_0x7a46('0x28')](_0xbdd111[_0x7a46('0x2e')]);_0x19a69a[_0x7a46('0x7b')]=_['intersection'](_0x19a69a['model'],_0x19a69a[_0x7a46('0x2e')]);_0x4ec6e3[_0x7a46('0x77')]=_[_0x7a46('0x76')](_0x19a69a[_0x7a46('0x74')],qs[_0x7a46('0x78')](_0xbdd111['query'][_0x7a46('0x78')]));_0x4ec6e3['attributes']=_0x4ec6e3['attributes']['length']?_0x4ec6e3[_0x7a46('0x77')]:_0x19a69a[_0x7a46('0x74')];if(!_0xbdd111[_0x7a46('0x2e')][_0x7a46('0x36')](_0x7a46('0x7f'))){_0x4ec6e3[_0x7a46('0x11')]=qs[_0x7a46('0x11')](_0xbdd111[_0x7a46('0x2e')][_0x7a46('0x11')]);_0x4ec6e3[_0x7a46('0xf')]=qs['offset'](_0xbdd111[_0x7a46('0x2e')]['offset']);}_0x4ec6e3[_0x7a46('0x79')]=qs[_0x7a46('0x7a')](_0xbdd111[_0x7a46('0x2e')]['sort']);_0x4ec6e3['where']=qs[_0x7a46('0x7b')](_['pick'](_0xbdd111['query'],_0x19a69a['filters']));_0x4ec6e3[_0x7a46('0x5a')][_0x7a46('0x98')]=_0x395d67['id'];if(_0xbdd111['query']['filter']){_0x4ec6e3[_0x7a46('0x5a')]=_[_0x7a46('0x37')](_0x4ec6e3[_0x7a46('0x5a')],{'$or':_['map'](_0x4ec6e3[_0x7a46('0x77')],function(_0x328ad7){var _0x4d1ded={};_0x4d1ded[_0x328ad7]={'$like':'%'+_0xbdd111[_0x7a46('0x2e')][_0x7a46('0x7d')]+'%'};return _0x4d1ded;})});}_0x4ec6e3=_['merge']({},_0x4ec6e3,_0xbdd111['options']);return db['JscriptySessionReport'][_0x7a46('0x12')]({'where':_0x4ec6e3['where']})['then'](function(_0x320f22){_0x42050b[_0x7a46('0x12')]=_0x320f22;if(_0xbdd111[_0x7a46('0x2e')][_0x7a46('0x99')]){_0x4ec6e3[_0x7a46('0x9b')]=[{'all':!![]}];}return db[_0x7a46('0x4d')][_0x7a46('0x21')](_0x4ec6e3);})[_0x7a46('0x1f')](function(_0x2caeb7){_0x42050b[_0x7a46('0x9c')]=_0x2caeb7;return _0x42050b;});}})['then'](respondWithFilteredResult(_0x249882,_0x4ec6e3))['catch'](handleError(_0x249882,null));};exports['uploadCsv']=function(_0x3e6c5a,_0x1552e1){try{if(!_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0xa0')]){throw new Error(_0x7a46('0xa1'));}if(!_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0xa2')]){throw new Error(_0x7a46('0xa3'));}if(!_0x3e6c5a['body'][_0x7a46('0xa4')]){throw new Error(_0x7a46('0xa5'));}var _0x5d2e9f=_0x3e6c5a[_0x7a46('0x38')]['binding_keys']['split'](',');var _0x398eb4=_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0xa2')][_0x7a46('0xa6')](',');if(!_0x5d2e9f[_0x7a46('0x30')]||!_0x398eb4['length']||_0x5d2e9f[_0x7a46('0x30')]!==_0x398eb4[_0x7a46('0x30')]){throw new Error(_0x7a46('0xa7'));}_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0x78')]=_[_0x7a46('0xa8')](_0x5d2e9f,_0x398eb4);if(!_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0x78')][_0x7a46('0x72')]){throw new Error(_0x7a46('0xa9'));}if(!_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0x78')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x28781a=path['join'](config[_0x7a46('0xaa')],_0x7a46('0xab'),_0x3e6c5a['file'][_0x7a46('0xac')]);fs[_0x7a46('0xad')](_0x28781a,parseInt('0777',0x8));var _0x11b675=require(_0x7a46('0xae'))[_0x7a46('0xaf')](path['join'](__dirname,_0x7a46('0xb0')),[_0x28781a,_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0xa0')],_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0xa2')],_0x3e6c5a['body'][_0x7a46('0x65')],_0x3e6c5a['body']['CompanyId'],_0x3e6c5a[_0x7a46('0x38')][_0x7a46('0x57')],_0x3e6c5a[_0x7a46('0x38')]['socket_timestamp']]);return _0x1552e1['status'](0xc8)[_0x7a46('0x15')]({'message':_0x7a46('0xb1'),'pid':_0x11b675[_0x7a46('0xb2')]});}catch(_0x2de974){return _0x1552e1[_0x7a46('0xe')](0x1f4)['send'](_0x2de974);}};exports[_0x7a46('0xb3')]=function(_0x4f7e4b,_0xbde1){var _0x1a23d7=fs[_0x7a46('0xb4')](_0x4f7e4b[_0x7a46('0xb5')]['path']);Papa[_0x7a46('0xb6')](_0x1a23d7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x56dfd3){return _0xbde1['status'](0xc8)[_0x7a46('0x15')]({'file':_0x4f7e4b['file'],'fields':_0x56dfd3[_0x7a46('0xb7')][_0x7a46('0x78')]});}});};exports['import']=function(_0x4df328,_0x10f836){return db[_0x7a46('0xb8')][_0x7a46('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x7a46('0x1f')](function(_0x1b3759){var _0x3a478b=![];if(!_0x4df328['body'][_0x7a46('0x65')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4df328[_0x7a46('0x38')][_0x7a46('0xb9')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x4df328[_0x7a46('0x38')][_0x7a46('0xb9')][_0x7a46('0xba')]){throw new Error(_0x7a46('0xbb'));}if(!_0x4df328[_0x7a46('0x38')][_0x7a46('0xa4')]){throw new Error(_0x7a46('0xa5'));}var _0x316254=require(_0x7a46('0xae'))[_0x7a46('0xaf')](path[_0x7a46('0x3c')](__dirname,_0x7a46('0xbc')),[_0x4df328[_0x7a46('0x26')]['id'],JSON[_0x7a46('0xbd')](_0x4df328[_0x7a46('0x38')]),JSON[_0x7a46('0xbd')](_0x1b3759)]);_0x316254['on'](_0x7a46('0xbe'),function(){_0x3a478b=!![];return _0x10f836[_0x7a46('0xe')](0xc8)['json']({'message':_0x7a46('0xbf'),'pid':_0x316254['pid']});});_0x316254['on'](_0x7a46('0xc0'),function(_0x1f5c3a){if(_0x1f5c3a&&!_0x3a478b){return _0x10f836[_0x7a46('0xe')](0x1f4)[_0x7a46('0x15')]({'message':_0x7a46('0xc1'),'pid':_0x316254['pid']});}});})[_0x7a46('0x23')](handleError(_0x10f836,null));};exports[_0x7a46('0xc2')]=function(_0x184fe4,_0x2aff32){return db[_0x7a46('0xb8')][_0x7a46('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0x7a46('0xc3')}})[_0x7a46('0x1f')](function(_0x194633){var _0x3f8213=![];if(!_0x184fe4[_0x7a46('0x38')][_0x7a46('0x65')]){throw new Error(_0x7a46('0xc4'));}if(!_0x184fe4[_0x7a46('0x38')][_0x7a46('0xb9')][_0x7a46('0x72')]){throw new Error(_0x7a46('0xa9'));}if(!_0x184fe4[_0x7a46('0x38')][_0x7a46('0xb9')][_0x7a46('0xba')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x184fe4[_0x7a46('0x38')]['socket_timestamp']){throw new Error(_0x7a46('0xa5'));}var _0x5d9e35=require(_0x7a46('0xae'))['fork'](path[_0x7a46('0x3c')](__dirname,_0x7a46('0xc5')),[_0x184fe4['params']['id'],JSON[_0x7a46('0xbd')](_0x184fe4[_0x7a46('0x38')]),JSON['stringify'](_0x194633)]);_0x5d9e35['on'](_0x7a46('0xbe'),function(){_0x3f8213=!![];return _0x2aff32['status'](0xc8)['json']({'message':'start\x20child\x20process\x20correctly!','pid':_0x5d9e35[_0x7a46('0xb2')]});});_0x5d9e35['on']('exit',function(_0x18357e){if(_0x18357e&&!_0x3f8213){return _0x2aff32[_0x7a46('0xe')](0x1f4)[_0x7a46('0x15')]({'message':'error\x20child\x20process','pid':_0x5d9e35[_0x7a46('0xb2')]});}});})[_0x7a46('0x23')](handleError(_0x2aff32,null));};exports[_0x7a46('0xc6')]=function(_0x2d8391,_0x35e6ba){var _0x27842b=[_0x7a46('0xc7'),_0x7a46('0xc8'),_0x7a46('0xc9'),_0x7a46('0xca'),_0x7a46('0xcb'),'whatsapp','voice'];var _0x6f55a3={'offset':0x0,'order':qs[_0x7a46('0x7a')](_0x7a46('0xcc'))},_0x3206fe={'count':0x0,'rows':[]};Promise[_0x7a46('0xcd')]()[_0x7a46('0x1f')](function(){if(_0x2d8391[_0x7a46('0x2e')][_0x7a46('0xce')]){if(!_[_0x7a46('0xcf')](_0x27842b,_0x2d8391[_0x7a46('0x2e')][_0x7a46('0xce')][_0x7a46('0xd0')]())){throw new Error(_0x7a46('0xd1'));}_0x27842b=[_0x2d8391[_0x7a46('0x2e')][_0x7a46('0xce')][_0x7a46('0xd0')]()];}if(_0x2d8391[_0x7a46('0x2e')][_0x7a46('0xd2')]){try{var _0x35cb16=JSON[_0x7a46('0xb6')](_0x2d8391['query'][_0x7a46('0xd2')]);if(!moment(_0x35cb16[_0x7a46('0x39')])[_0x7a46('0xd3')]()){throw new Error(_0x7a46('0xd4'));}if(!moment(_0x35cb16['to'])[_0x7a46('0xd3')]()){throw new Error(_0x7a46('0xd5'));}}catch(_0x1d9250){throw new Error(_0x7a46('0xd6'));}}if(!_0x2d8391[_0x7a46('0x2e')]['hasOwnProperty'](_0x7a46('0x7f'))){_0x6f55a3[_0x7a46('0x11')]=qs[_0x7a46('0x11')](_0x2d8391[_0x7a46('0x2e')][_0x7a46('0x11')]||0xa);_0x6f55a3[_0x7a46('0xf')]=qs['offset'](_0x2d8391[_0x7a46('0x2e')][_0x7a46('0xf')]);}var _0xecbcd1=_0x27842b[_0x7a46('0x68')](function(_0x5befbf){if(_0x5befbf===_0x7a46('0xd7')){var _0x190602={'attributes':['id',_0x7a46('0xd8'),_0x7a46('0xd9'),_0x7a46('0xda'),_0x7a46('0xdb'),_0x7a46('0xdc'),_0x7a46('0xdd'),_0x7a46('0xde'),_0x7a46('0xdf'),_0x7a46('0xe0'),_0x7a46('0xe1'),_0x7a46('0xe2'),_0x7a46('0xe3'),_0x7a46('0xe4'),_0x7a46('0xe5')],'where':{'ContactId':_0x2d8391[_0x7a46('0x26')]['id']},'include':[{'model':db[_0x7a46('0xb8')],'as':_0x7a46('0xb8'),'attributes':['id',_0x7a46('0x1b'),'fullname',_0x7a46('0x31')]}],'order':[[_0x7a46('0xe1'),_0x7a46('0xe6')]]};if(_0x2d8391[_0x7a46('0x2e')]['range']){_0x190602[_0x7a46('0x5a')][_0x7a46('0xe1')]={'$gte':_0x35cb16[_0x7a46('0x39')],'$lte':_0x35cb16['to']};}return db[_0x7a46('0x48')][_0x7a46('0xe7')](_0x190602)['then'](function(_0x19113e){_0x3206fe[_0x7a46('0x12')]+=_0x19113e[_0x7a46('0x12')];return _[_0x7a46('0x68')](_0x19113e[_0x7a46('0x9c')],function(_0x53a74b){var _0x4f7582=_0x53a74b[_0x7a46('0x3a')]({'plain':!![]});_0x4f7582[_0x7a46('0xce')]=_0x5befbf;if(_0x4f7582['User']){_0x4f7582[_0x7a46('0xb8')]={'id':_0x4f7582[_0x7a46('0xb8')]['id'],'name':_0x4f7582[_0x7a46('0xb8')][_0x7a46('0x1b')],'fullname':_0x4f7582[_0x7a46('0xb8')][_0x7a46('0xe8')],'alias':_0x4f7582[_0x7a46('0xb8')]['alias']};}return _0x4f7582;});});}else{var _0x2713ee=_[_0x7a46('0xe9')](_0x5befbf)+(_0x5befbf==='chat'?_0x7a46('0xea'):_0x7a46('0xeb'));var _0x13f1c6={'attributes':['id','closed',_0x7a46('0xec'),_0x7a46('0xe1'),_0x7a46('0xe0'),_0x7a46('0xed'),'secondDisposition','thirdDisposition',_0x7a46('0xe5'),_0x2713ee+'Id'],'where':{'ContactId':_0x2d8391[_0x7a46('0x26')]['id']},'include':[{'model':db[_0x2713ee],'as':'Account','attributes':['id',_0x7a46('0x1b'),_0x7a46('0xee')]},{'model':db['User'],'as':_0x7a46('0xef'),'attributes':['id',_0x7a46('0x1b'),_0x7a46('0xe8')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x7a46('0x1b'),_0x7a46('0x60')],'through':{'attributes':[]}}],'order':[[_0x7a46('0xe1'),_0x7a46('0xe6')]]};if(_0x2d8391[_0x7a46('0x2e')]['range']){_0x13f1c6['where']['createdAt']={'$gte':_0x35cb16[_0x7a46('0x39')],'$lte':_0x35cb16['to']};}switch(_0x5befbf){case _0x7a46('0xc8'):_0x13f1c6[_0x7a46('0x77')][_0x7a46('0x59')](_0x7a46('0xf0'),_0x7a46('0xf1'),_0x7a46('0xf2'),_0x7a46('0xf3'),'osName',_0x7a46('0xf4'),_0x7a46('0xf5'),_0x7a46('0xf6'),_0x7a46('0xf7'));break;case _0x7a46('0xc7'):_0x13f1c6[_0x7a46('0x77')][_0x7a46('0x59')](_0x7a46('0xf8'),'substatus');break;case _0x7a46('0xca'):_0x13f1c6[_0x7a46('0x77')]['push'](_0x7a46('0xf9'),_0x7a46('0xfa'));break;}return db[_[_0x7a46('0xe9')](_0x5befbf)+_0x7a46('0xfb')][_0x7a46('0xe7')](_0x13f1c6)[_0x7a46('0x1f')](function(_0x5d4d01){_0x3206fe[_0x7a46('0x12')]+=_0x5d4d01[_0x7a46('0x12')];return _[_0x7a46('0x68')](_0x5d4d01[_0x7a46('0x9c')],function(_0x4106c2){var _0xd9d58=_0x4106c2[_0x7a46('0x3a')]({'plain':!![]});_0xd9d58[_0x7a46('0xce')]=_0x5befbf;if(_0xd9d58[_0x7a46('0xef')]){_0xd9d58[_0x7a46('0xef')]={'id':_0xd9d58['Owner']['id'],'name':_0xd9d58[_0x7a46('0xef')]['name'],'fullname':_0xd9d58[_0x7a46('0xef')][_0x7a46('0xe8')]};}return _0xd9d58;});});}});return Promise[_0x7a46('0x5d')](_0xecbcd1);})[_0x7a46('0x1f')](function(_0x7444b4){return _(_0x7444b4)[_0x7a46('0xfc')]()[_0x7a46('0xfd')](_0x7a46('0xe1'))[_0x7a46('0xfe')]()[_0x7a46('0xff')]();})[_0x7a46('0x1f')](function(_0x2d2428){_0x3206fe['rows']=_0x6f55a3[_0x7a46('0x11')]?_0x2d2428[_0x7a46('0x100')](_0x6f55a3[_0x7a46('0xf')],_0x6f55a3[_0x7a46('0xf')]+_0x6f55a3['limit']):_0x2d2428;return _0x3206fe;})['then'](respondWithFilteredResult(_0x35e6ba,_0x6f55a3))[_0x7a46('0x23')](handleError(_0x35e6ba,null));}; \ No newline at end of file +var _0xb94d=['where','$or','push','ListId','findOrCreate','spread','contact','all','show','find','Tags','name','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','isNil','$and','omit','map','format','cf_%d','pickBy','cf_','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','text','phone','getTags','findOne','model','Tag','rawAttributes','filters','attributes','intersection','fields','order','sort','filter','nolimit','setTags','setAdditionalPhones','OrderBy','items','item_types','description','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopper','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','hopperId','getHoppers','pick','ContactId','options','include','rows','getHopperHistories','includeAll','getHopperFinals','uploadCsv','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','upload','meta','import','User','agent','No\x20ListId\x20specified','binding','../../components/import/cm/csv2','stringify','message','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','chat','openchannel','fax','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','VoiceCallReport','findAndCountAll','startCase','Website','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Account','key','Owner','color','DESC','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','mail','subject','externalUrl','threadId','fullname','flatten','sortBy','value','slice','moment','lodash','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','sendStatus','error','send','index','findAll','query','catch','params','describe','CmContact','tags','keys','length','startsWith','columnName','analytics','CmCustomField','displayName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','from','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','utcOffset','timezones','additionalPhones','bulkCreate','duplicates'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0xb94d,0xa6));var _0xdb94=function(_0x152121,_0x120c53){_0x152121=_0x152121-0x0;var _0x592a85=_0xb94d[_0x152121];return _0x592a85;};'use strict';var moment=require(_0xdb94('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0xdb94('0x1'));var squel=require(_0xdb94('0x2'));var Papa=require('papaparse');var Redis=require(_0xdb94('0x3'));var contacts=require(_0xdb94('0x4'));var qs=require(_0xdb94('0x5'));var logger=require(_0xdb94('0x6'))('api');var config=require(_0xdb94('0x7'));var shared=require('../../config/environment/shared');var db=require(_0xdb94('0x8'))['db'];config[_0xdb94('0x9')]=_[_0xdb94('0xa')](config[_0xdb94('0x9')],{'host':_0xdb94('0xb'),'port':0x18eb});var socket=require(_0xdb94('0xc'))(new Redis(config[_0xdb94('0x9')]));require(_0xdb94('0xd'))[_0xdb94('0xe')](socket);function respondWithResult(_0x3ffc6e,_0x2d7f4c){_0x2d7f4c=_0x2d7f4c||0xc8;return function(_0x31daeb){if(_0x31daeb){return _0x3ffc6e[_0xdb94('0xf')](_0x2d7f4c)[_0xdb94('0x10')](_0x31daeb);}};}function respondWithFilteredResult(_0x23b044,_0x329646){return function(_0x4650a9){if(_0x4650a9){var _0x34310c=typeof _0x329646[_0xdb94('0x11')]===_0xdb94('0x12')&&typeof _0x329646[_0xdb94('0x13')]===_0xdb94('0x12');var _0x59cbb3=_0x4650a9[_0xdb94('0x14')];var _0x4db975=_0x34310c?0x0:_0x329646[_0xdb94('0x11')];var _0x307725=_0x34310c?_0x4650a9[_0xdb94('0x14')]:_0x329646[_0xdb94('0x11')]+_0x329646[_0xdb94('0x13')];var _0x341c8c;if(_0x307725>=_0x59cbb3){_0x307725=_0x59cbb3;_0x341c8c=0xc8;}else{_0x341c8c=0xce;}_0x23b044[_0xdb94('0xf')](_0x341c8c);return _0x23b044[_0xdb94('0x15')](_0xdb94('0x16'),_0x4db975+'-'+_0x307725+'/'+_0x59cbb3)[_0xdb94('0x10')](_0x4650a9);}return null;};}function saveUpdates(_0x37e716){return function(_0x1dd952){if(_0x1dd952){return _0x1dd952[_0xdb94('0x17')](_0x37e716)[_0xdb94('0x18')](function(_0x4c5994){return _0x4c5994;});}return null;};}function removeEntity(_0x38fa25){return function(_0x512ccd){if(_0x512ccd){return _0x512ccd[_0xdb94('0x19')]()[_0xdb94('0x18')](function(){_0x38fa25[_0xdb94('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39695c){return function(_0x5b12d5){if(!_0x5b12d5){_0x39695c[_0xdb94('0x1a')](0x194);}return _0x5b12d5;};}function handleError(_0xd074be,_0x3d7285){_0x3d7285=_0x3d7285||0x1f4;return function(_0x2be650){logger[_0xdb94('0x1b')](_0x2be650['stack']);if(_0x2be650['name']){delete _0x2be650['name'];}_0xd074be[_0xdb94('0xf')](_0x3d7285)[_0xdb94('0x1c')](_0x2be650);};}exports[_0xdb94('0x1d')]=function(_0x37ae65,_0x2ca1a9){var _0x5e4b61={};return contacts['describe']()['then'](function(_0xdab26){_0x5e4b61=qs['getOptions'](_0xdab26,_0x37ae65);return contacts[_0xdb94('0x1e')](_0x37ae65[_0xdb94('0x1f')],_0x37ae65['user'],_0x5e4b61,_0xdab26);})[_0xdb94('0x18')](respondWithFilteredResult(_0x2ca1a9,_0x5e4b61))[_0xdb94('0x20')](handleError(_0x2ca1a9,null));};exports[_0xdb94('0x19')]=function(_0x594b82,_0xb549aa){return db['CmContact']['find']({'where':{'id':_0x594b82[_0xdb94('0x21')]['id']}})['then'](handleEntityNotFound(_0xb549aa,null))[_0xdb94('0x18')](removeEntity(_0xb549aa,null))['catch'](handleError(_0xb549aa,null));};exports[_0xdb94('0x22')]=function(_0x34c70b,_0x5d4f28){return db[_0xdb94('0x23')][_0xdb94('0x22')]()[_0xdb94('0x18')](function(_0x5d9a22){delete _0x5d9a22[_0xdb94('0x24')];for(var _0xbc39a9=0x0;_0xbc39a90x0){return new Promise(function(_0x248bf3){var _0x22cd79=[];for(var _0x1ec6f9=0x0;_0x1ec6f9<_0xe78a79[_0xdb94('0x26')];_0x1ec6f9++){_0x22cd79[_0xdb94('0x57')](insertAdditionalPhones(_0xe78a79[_0x1ec6f9][_0xdb94('0x5b')],_0xe78a79[_0x1ec6f9][_0xdb94('0x52')]));}Promise[_0xdb94('0x5c')](_0x22cd79)[_0xdb94('0x18')](function(){_0x248bf3(0x1);});})['then'](function(){return{'success':_0x26dfda,'failure':_0x20c72d,'duplicates':_0x3656b2};});}else{return{'success':_0x26dfda,'failure':_0x20c72d,'duplicates':_0x3656b2};}}})['then'](respondWithResult(_0x4cf70b,0xc9))['catch'](handleError(_0x4cf70b,null));};exports[_0xdb94('0x5d')]=function(_0x371055,_0x32e173){var _0x3a6ee6;return db[_0xdb94('0x23')][_0xdb94('0x22')]()['then'](function(_0x228fb6){return db[_0xdb94('0x23')][_0xdb94('0x5e')]({'where':{'id':_0x371055['params']['id']},'include':[{'model':db['Tag'],'as':_0xdb94('0x5f'),'attributes':['id',_0xdb94('0x60'),'color'],'required':_0x371055[_0xdb94('0x1f')]['tag']?!![]:![]},{'model':db[_0xdb94('0x44')],'as':'Phones','where':{'CmContactId':_0x371055[_0xdb94('0x21')]['id']},'required':![],'include':[{'model':db[_0xdb94('0x61')],'as':_0xdb94('0x62')}]}],'order':[db[_0xdb94('0x63')][_0xdb94('0x64')](_0xdb94('0x65'))],'attributes':_['keys'](_0x228fb6)});})[_0xdb94('0x18')](function(_0x551e5a){if(!_[_0xdb94('0x66')](_0x551e5a)){_0x3a6ee6=_0x551e5a[_0xdb94('0x35')]({'plain':!![]});var _0x5f0291={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x551e5a&&_0x551e5a[_0xdb94('0x58')]){if(_0x551e5a[_0xdb94('0x58')]){_0x5f0291[_0xdb94('0x55')][_0xdb94('0x67')]['push']({'ListId':{'$ne':_0x551e5a['ListId']}});}}return db[_0xdb94('0x2a')][_0xdb94('0x1e')](_0x5f0291);}})[_0xdb94('0x18')](function(_0x3ffd48){if(!_[_0xdb94('0x66')](_0x3ffd48)){return _[_0xdb94('0x68')](_0x3a6ee6,_[_0xdb94('0x69')](_0x3ffd48,function(_0x683597){return util[_0xdb94('0x6a')](_0xdb94('0x6b'),_0x683597['id']);}));}})[_0xdb94('0x18')](handleEntityNotFound(_0x32e173,null))[_0xdb94('0x18')](respondWithResult(_0x32e173,null))[_0xdb94('0x20')](handleError(_0x32e173,null));};exports[_0xdb94('0x17')]=function(_0x31f2c1,_0x3bbe09){var _0x3e1df4;if(_0x31f2c1[_0xdb94('0x34')]['id']){delete _0x31f2c1[_0xdb94('0x34')]['id'];}if(!_[_0xdb94('0x66')](_0x31f2c1['body'][_0xdb94('0x4f')])){var _0x5a7e1f=_0x31f2c1[_0xdb94('0x34')][_0xdb94('0x4f')];if(!_[_0xdb94('0x66')](shared['timezones'][_0x5a7e1f]))_0x31f2c1[_0xdb94('0x34')][_0xdb94('0x50')]=shared['timezones'][_0x5a7e1f][_0xdb94('0x50')];}return db[_0xdb94('0x23')][_0xdb94('0x5e')]({'where':{'id':_0x31f2c1[_0xdb94('0x21')]['id']}})['then'](handleEntityNotFound(_0x3bbe09,null))['then'](saveUpdates(_0x31f2c1[_0xdb94('0x34')],null))[_0xdb94('0x18')](function(_0x2a3279){_0x3e1df4=_0x2a3279;var _0x333dac={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2a3279&&_0x2a3279[_0xdb94('0x58')]){if(_0x2a3279[_0xdb94('0x58')]){_0x333dac[_0xdb94('0x55')]['$and']['push']({'ListId':{'$ne':_0x2a3279['ListId']}});}}return db[_0xdb94('0x2a')]['findAll'](_0x333dac);})[_0xdb94('0x18')](function(_0x1d1b4b){if(_0x1d1b4b){return _[_0xdb94('0x68')](_[_0xdb94('0x6c')](_0x31f2c1[_0xdb94('0x34')],function(_0xbf088c,_0x43f245){return _[_0xdb94('0x27')](_0x43f245,_0xdb94('0x6d'));}),_[_0xdb94('0x69')](_0x1d1b4b,function(_0x38a2ab){return util['format']('cf_%d',_0x38a2ab['id']);}));}})['then'](function(_0x1f9bf0){if(_0x1f9bf0&&!_[_0xdb94('0x6e')](_0x1f9bf0)){var _0x563559=squel[_0xdb94('0x17')]()[_0xdb94('0x6f')](_0xdb94('0x70'))[_0xdb94('0x71')](_0x1f9bf0)['where'](_0xdb94('0x72'),_0x31f2c1['params']['id'])['toParam']();return db[_0xdb94('0x63')][_0xdb94('0x1f')](_0x563559[_0xdb94('0x73')],{'replacements':_0x563559[_0xdb94('0x2e')]});}})['then'](function(){if(_0x31f2c1[_0xdb94('0x34')][_0xdb94('0x74')]&&_0x3e1df4){return db['CmHopper']['update']({'phone':_0x31f2c1[_0xdb94('0x34')][_0xdb94('0x74')],'OrderBy':0x0},{'where':{'ContactId':_0x3e1df4['id']}});}})[_0xdb94('0x18')](function(){return _0x3e1df4;})[_0xdb94('0x18')](respondWithResult(_0x3bbe09,null))[_0xdb94('0x20')](handleError(_0x3bbe09,null));};exports[_0xdb94('0x75')]=function(_0x416769,_0x3bca46){var _0xc8f95e={};var _0x58b06b={};var _0x8fc959;var _0x996f22;return db[_0xdb94('0x23')][_0xdb94('0x76')]({'where':{'id':_0x416769[_0xdb94('0x21')]['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0x3bca46,null))[_0xdb94('0x18')](function(_0x1da82d){if(_0x1da82d){_0x8fc959=_0x1da82d;_0x58b06b[_0xdb94('0x77')]=_[_0xdb94('0x25')](db[_0xdb94('0x78')][_0xdb94('0x79')]);_0x58b06b[_0xdb94('0x1f')]=_[_0xdb94('0x25')](_0x416769[_0xdb94('0x1f')]);_0x58b06b[_0xdb94('0x7a')]=_['intersection'](_0x58b06b['model'],_0x58b06b[_0xdb94('0x1f')]);_0xc8f95e[_0xdb94('0x7b')]=_[_0xdb94('0x7c')](_0x58b06b[_0xdb94('0x77')],qs[_0xdb94('0x7d')](_0x416769[_0xdb94('0x1f')]['fields']));_0xc8f95e[_0xdb94('0x7b')]=_0xc8f95e[_0xdb94('0x7b')][_0xdb94('0x26')]?_0xc8f95e[_0xdb94('0x7b')]:_0x58b06b['model'];_0xc8f95e[_0xdb94('0x7e')]=qs[_0xdb94('0x7f')](_0x416769[_0xdb94('0x1f')][_0xdb94('0x7f')]);_0xc8f95e[_0xdb94('0x55')]=qs['filters'](_['pick'](_0x416769['query'],_0x58b06b[_0xdb94('0x7a')]));if(_0x416769[_0xdb94('0x1f')][_0xdb94('0x80')]){_0xc8f95e['where']=_[_0xdb94('0x33')](_0xc8f95e['where'],{'$or':_[_0xdb94('0x69')](_0xc8f95e[_0xdb94('0x7b')],function(_0x2674b1){var _0x46bb58={};_0x46bb58[_0x2674b1]={'$like':'%'+_0x416769[_0xdb94('0x1f')][_0xdb94('0x80')]+'%'};return _0x46bb58;})});}_0xc8f95e=_[_0xdb94('0x33')]({},_0xc8f95e,_0x416769['options']);return _0x8fc959[_0xdb94('0x75')](_0xc8f95e);}})[_0xdb94('0x18')](function(_0x44858c){if(_0x44858c){_0x996f22=_0x44858c[_0xdb94('0x26')];if(!_0x416769[_0xdb94('0x1f')][_0xdb94('0x32')](_0xdb94('0x81'))){_0xc8f95e[_0xdb94('0x13')]=qs[_0xdb94('0x13')](_0x416769[_0xdb94('0x1f')][_0xdb94('0x13')]);_0xc8f95e[_0xdb94('0x11')]=qs[_0xdb94('0x11')](_0x416769[_0xdb94('0x1f')]['offset']);}return _0x8fc959['getTags'](_0xc8f95e);}})[_0xdb94('0x18')](function(_0x3ba98d){if(_0x3ba98d){return _0x3ba98d?{'count':_0x996f22,'rows':_0x3ba98d}:null;}})[_0xdb94('0x18')](respondWithResult(_0x3bca46,null))[_0xdb94('0x20')](handleError(_0x3bca46,null));};exports['setTags']=function(_0x38a3c3,_0x128863){if(_0x38a3c3[_0xdb94('0x34')]['id']){delete _0x38a3c3['body']['id'];}return db[_0xdb94('0x23')][_0xdb94('0x76')]({'where':{'id':_0x38a3c3[_0xdb94('0x21')]['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0x128863,null))[_0xdb94('0x18')](function(_0x1fab19){if(_0x1fab19){return _0x1fab19[_0xdb94('0x82')](_0x38a3c3[_0xdb94('0x34')]['ids']||[]);}return null;})[_0xdb94('0x18')](respondWithResult(_0x128863,null))['catch'](handleError(_0x128863,null));};exports[_0xdb94('0x83')]=function(_0x50f76f,_0x36e191){var _0x21a825=[];_0x21a825[_0xdb94('0x57')](addAdditionalPhones(_0x50f76f[_0xdb94('0x34')]));Promise['all'](_0x21a825)[_0xdb94('0x18')](function(){_0x21a825=[];_0x21a825[_0xdb94('0x57')](deleteCmHopperPhones(_0x50f76f[_0xdb94('0x34')]['id']));_0x21a825[_0xdb94('0x57')](addCmHopperPhones(_0x50f76f[_0xdb94('0x34')]['id']));Promise['all'](_0x21a825)[_0xdb94('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x36e191,null));});};function addAdditionalPhones(_0x10b9db){var _0x4faecf;return new Promise(function(_0x3169a3){return db['CmContactHasItem'][_0xdb94('0x19')]({'where':{'CmContactId':_0x10b9db['id']}})[_0xdb94('0x18')](function(){db[_0xdb94('0x61')][_0xdb94('0x1e')]({'raw':!![],'attributes':['id',_0xdb94('0x84')]})['then'](function(_0x21b693){var _0x1e5bd3=[];for(var _0x21c234=0x0;_0x21c234<_0x10b9db[_0xdb94('0x85')][_0xdb94('0x26')];_0x21c234++){var _0x44d35c=_0x10b9db['item_types']?_['isNil'](_0x10b9db['item_types'][_0x21c234])?'':_0x10b9db[_0xdb94('0x86')][_0x21c234]:_0x10b9db[_0xdb94('0x85')][_0x21c234]['ItemTypeId']?_0x10b9db[_0xdb94('0x85')][_0x21c234]['ItemTypeId']:'';var _0x45747b=_['isNil'](_0x10b9db[_0xdb94('0x85')][_0x21c234]['description'])?'':_0x10b9db[_0xdb94('0x85')][_0x21c234][_0xdb94('0x87')];var _0x43359e=_0x44d35c+':'+_0x10b9db[_0xdb94('0x85')][_0x21c234][_0xdb94('0x74')]+'§'+_0x45747b;if(_[_0xdb94('0x66')](_0x4faecf))_0x4faecf=_0x43359e;else _0x4faecf+=';'+_0x43359e;var _0x24525a=null;var _0x196af6=null;if(_0x10b9db[_0xdb94('0x86')]){if(!_[_0xdb94('0x66')](_0x10b9db[_0xdb94('0x86')][_0x21c234])){_0x196af6=_[_0xdb94('0x5e')](_0x21b693,function(_0x9d863b){return _0x9d863b['id']===_0x10b9db['item_types'][_0x21c234];});if(!_[_0xdb94('0x66')](_0x196af6)){_0x24525a=_0x196af6['OrderBy'];}}}else{if(!_[_0xdb94('0x66')](_0x10b9db['items'][_0x21c234])){_0x196af6=_[_0xdb94('0x5e')](_0x21b693,function(_0x1b2071){return _0x1b2071['id']===_0x10b9db[_0xdb94('0x85')][_0x21c234][_0xdb94('0x88')];});if(!_[_0xdb94('0x66')](_0x196af6)){_0x24525a=_0x21c234;}}}if(_[_0xdb94('0x66')](_0x24525a)){_0x24525a=0x64;}_0x1e5bd3[_0xdb94('0x57')](addAdditionalPhone(_0x10b9db['id'],_0x10b9db[_0xdb94('0x85')][_0x21c234]['phone'],_0x10b9db[_0xdb94('0x86')]?_[_0xdb94('0x66')](_0x10b9db['item_types'][_0x21c234])?null:_0x10b9db[_0xdb94('0x86')][_0x21c234]:_0x10b9db[_0xdb94('0x85')][_0x21c234][_0xdb94('0x88')]?_0x10b9db[_0xdb94('0x85')][_0x21c234][_0xdb94('0x88')]:null,_0x24525a,_0x45747b));}Promise['all'](_0x1e5bd3)['then'](function(){db[_0xdb94('0x23')]['update']({'AdditionalPhones':_0x4faecf},{'where':{'id':_0x10b9db['id']}})[_0xdb94('0x18')](function(){_0x3169a3(0x1);});});});});});}function addAdditionalPhone(_0x4bd1cc,_0x549da3,_0x2c7920,_0x49ad0f,_0x4cc783){return db[_0xdb94('0x44')][_0xdb94('0x5e')]({'where':{'CmContactId':_0x4bd1cc,'item':_0x549da3}})[_0xdb94('0x18')](function(_0x1feae0){if(_0x1feae0)logger[_0xdb94('0x2f')](_0xdb94('0x89'),_0x1feae0);else{db[_0xdb94('0x44')][_0xdb94('0x4e')]({'CmContactId':_0x4bd1cc,'item':_0x549da3,'ItemTypeId':_0x2c7920,'OrderBy':_0x49ad0f,'ItemClass':_0xdb94('0x8a'),'description':_0x4cc783});}});}function deleteCmHopperPhones(_0x249924){return new Promise(function(_0x2de5fe){return db[_0xdb94('0x8b')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x249924}})[_0xdb94('0x18')](function(_0x5d683c){db[_0xdb94('0x8c')][_0xdb94('0x19')]({'where':{'CmHopperId':{'$in':_[_0xdb94('0x69')](_0x5d683c,'id')}}});})[_0xdb94('0x18')](function(){_0x2de5fe(0x1);});});}function addCmHopperPhones(_0xbcfeb6){return new Promise(function(_0x357d29){return db['CmHopper'][_0xdb94('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xbcfeb6}})[_0xdb94('0x18')](function(_0x359cf1){var _0x1f4771=[];_[_0xdb94('0x69')](_0x359cf1,function(_0x543185){_0x1f4771[_0xdb94('0x57')](createCmHopperPhone(_0xbcfeb6,_0x543185['id']));});Promise['all'](_0x1f4771)['then'](function(){_0x357d29(0x1);});});});}function createCmHopperPhone(_0x1c821b,_0x3f32ac){return new Promise(function(_0x101355){db[_0xdb94('0x44')]['findAll']({'raw':!![],'attributes':[_0xdb94('0x8d'),_0xdb94('0x84')],'where':{'CmContactId':_0x1c821b,'ItemClass':_0xdb94('0x8a')},'include':[{'model':db[_0xdb94('0x61')],'attributes':[_0xdb94('0x84')],'as':_0xdb94('0x62')}],'order':[_0xdb94('0x84'),db[_0xdb94('0x63')]['literal'](_0xdb94('0x8e'))]})['then'](function(_0x1ce70b){var _0x3c8dd8=0x1;var _0x1e5711=_[_0xdb94('0x69')](_0x1ce70b,function(_0x3324f4){_0x3324f4[_0xdb94('0x8f')]=_0x3f32ac;_0x3324f4['phone']=_0x3324f4[_0xdb94('0x8d')];_0x3324f4[_0xdb94('0x84')]=_0x3c8dd8;delete _0x3324f4[_0xdb94('0x90')];_0x3c8dd8=_0x3c8dd8+0x1;return _0x3324f4;});return db[_0xdb94('0x8c')]['bulkCreate'](_0x1e5711,{});})['then'](function(){_0x101355(0x1);});});}function insertAdditionalPhones(_0x5266a2,_0x448417){return new Promise(function(_0xf6465d){var _0xcb545=[];for(var _0x4c9e36=0x0;_0x4c9e36<_0x448417[_0xdb94('0x26')];_0x4c9e36++){var _0x5cbf1a=_0x448417[_0x4c9e36];_0xcb545['push'](parseContactItemType(_0x5cbf1a));}Promise['all'](_0xcb545)[_0xdb94('0x18')](function(){var _0x22169c={'id':_0x5266a2['id'],'items':_0x448417};return addAdditionalPhones(_0x22169c)['then'](function(){return addCmHopperPhones(_0x5266a2['id']);});})[_0xdb94('0x18')](function(){_0xf6465d(_0x5266a2);});});}function parseContactItemType(_0xcd661){return new Promise(function(_0x5b1069){if(_0xcd661['hasOwnProperty'](_0xdb94('0x88'))){_0x5b1069(_0xcd661);}else{return db[_0xdb94('0x61')][_0xdb94('0x5e')]({'where':{'name':_0xcd661[_0xdb94('0x62')]}})['then'](function(_0x6b6190){if(_[_0xdb94('0x66')](_0x6b6190))_0xcd661[_0xdb94('0x88')]=null;else _0xcd661['ItemTypeId']=_0x6b6190['id'];_0x5b1069(_0xcd661);});}});}exports[_0xdb94('0x91')]=function(_0x22ff73,_0x3218b7){return db[_0xdb94('0x44')][_0xdb94('0x1e')]({'raw':!![],'where':{'CmContactId':_0x22ff73[_0xdb94('0x21')]['id'],'ItemClass':_0xdb94('0x8a')},'include':[{'model':db[_0xdb94('0x61')],'as':'ItemType'}],'order':[['OrderBy'],[db['sequelize'][_0xdb94('0x64')](_0xdb94('0x8e'))]]})[_0xdb94('0x18')](function(_0x54ee3d){return _0x54ee3d;})[_0xdb94('0x18')](respondWithResult(_0x3218b7,null))['catch'](handleError(_0x3218b7,null));};exports[_0xdb94('0x92')]=function(_0x454bae,_0x5d3f66){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x454bae[_0xdb94('0x34')][_0xdb94('0x93')]}})[_0xdb94('0x18')](function(_0x173f98){var _0x3487ce=_['map'](_0x173f98,function(_0x28742e){_0x28742e[_0xdb94('0x94')]=_0x454bae[_0xdb94('0x34')][_0xdb94('0x95')];return _0x28742e;});return db[_0xdb94('0x44')][_0xdb94('0x53')](_0x3487ce,{});})[_0xdb94('0x18')](function(){return addCmHopperPhones(_0x454bae[_0xdb94('0x34')][_0xdb94('0x95')]);})[_0xdb94('0x18')](function(){return['ok'];})[_0xdb94('0x18')](respondWithResult(_0x5d3f66,null))[_0xdb94('0x20')](handleError(_0x5d3f66,null));};exports['rescheduleAdditionalPhones']=function(_0x404fb6,_0x11ec5f){var _0x15f845=[];_0x15f845[_0xdb94('0x57')](createCmHopperPhone(_0x404fb6[_0xdb94('0x34')]['id'],_0x404fb6['body'][_0xdb94('0x96')]));Promise[_0xdb94('0x5c')](_0x15f845)[_0xdb94('0x18')](function(){return[0x1];})[_0xdb94('0x18')](respondWithResult(_0x11ec5f,null));};exports[_0xdb94('0x97')]=function(_0x39b8ba,_0x210343){var _0x215997={'raw':![],'where':{}};var _0x269cd4={};var _0x48c9da={'count':0x0,'rows':[]};return db[_0xdb94('0x23')]['findOne']({'where':{'id':_0x39b8ba[_0xdb94('0x21')]['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0x210343,null))['then'](function(_0x23f35e){if(_0x23f35e){_0x269cd4[_0xdb94('0x77')]=_[_0xdb94('0x25')](db['CmHopper'][_0xdb94('0x79')]);_0x269cd4[_0xdb94('0x1f')]=_[_0xdb94('0x25')](_0x39b8ba[_0xdb94('0x1f')]);_0x269cd4[_0xdb94('0x7a')]=_[_0xdb94('0x7c')](_0x269cd4[_0xdb94('0x77')],_0x269cd4['query']);_0x215997[_0xdb94('0x7b')]=_[_0xdb94('0x7c')](_0x269cd4['model'],qs[_0xdb94('0x7d')](_0x39b8ba['query'][_0xdb94('0x7d')]));_0x215997[_0xdb94('0x7b')]=_0x215997[_0xdb94('0x7b')][_0xdb94('0x26')]?_0x215997[_0xdb94('0x7b')]:_0x269cd4[_0xdb94('0x77')];if(!_0x39b8ba[_0xdb94('0x1f')][_0xdb94('0x32')](_0xdb94('0x81'))){_0x215997['limit']=qs[_0xdb94('0x13')](_0x39b8ba['query'][_0xdb94('0x13')]);_0x215997['offset']=qs[_0xdb94('0x11')](_0x39b8ba[_0xdb94('0x1f')][_0xdb94('0x11')]);}_0x215997[_0xdb94('0x7e')]=qs[_0xdb94('0x7f')](_0x39b8ba[_0xdb94('0x1f')][_0xdb94('0x7f')]);_0x215997[_0xdb94('0x55')]=qs[_0xdb94('0x7a')](_[_0xdb94('0x98')](_0x39b8ba['query'],_0x269cd4[_0xdb94('0x7a')]));_0x215997[_0xdb94('0x55')][_0xdb94('0x99')]=_0x23f35e['id'];if(_0x39b8ba[_0xdb94('0x1f')][_0xdb94('0x80')]){_0x215997[_0xdb94('0x55')]=_[_0xdb94('0x33')](_0x215997[_0xdb94('0x55')],{'$or':_[_0xdb94('0x69')](_0x215997[_0xdb94('0x7b')],function(_0x350bf8){var _0x45821f={};_0x45821f[_0x350bf8]={'$like':'%'+_0x39b8ba[_0xdb94('0x1f')][_0xdb94('0x80')]+'%'};return _0x45821f;})});}_0x215997=_[_0xdb94('0x33')]({},_0x215997,_0x39b8ba[_0xdb94('0x9a')]);return db[_0xdb94('0x8b')][_0xdb94('0x14')]({'where':_0x215997['where']})[_0xdb94('0x18')](function(_0x5015f){_0x48c9da[_0xdb94('0x14')]=_0x5015f;if(_0x39b8ba[_0xdb94('0x1f')]['includeAll']){_0x215997[_0xdb94('0x9b')]=[{'all':!![]}];}return db[_0xdb94('0x8b')][_0xdb94('0x1e')](_0x215997);})[_0xdb94('0x18')](function(_0xc08a68){_0x48c9da[_0xdb94('0x9c')]=_0xc08a68;return _0x48c9da;});}})['then'](respondWithFilteredResult(_0x210343,_0x215997))[_0xdb94('0x20')](handleError(_0x210343,null));};exports[_0xdb94('0x9d')]=function(_0x2e04e3,_0xbe8234){var _0x350761={'raw':!![],'where':{}};var _0x4081a1={};var _0x195c90={'count':0x0,'rows':[]};return db[_0xdb94('0x23')][_0xdb94('0x76')]({'where':{'id':_0x2e04e3[_0xdb94('0x21')]['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0xbe8234,null))['then'](function(_0x1a13b9){if(_0x1a13b9){_0x4081a1['model']=_['keys'](db[_0xdb94('0x46')][_0xdb94('0x79')]);_0x4081a1[_0xdb94('0x1f')]=_[_0xdb94('0x25')](_0x2e04e3[_0xdb94('0x1f')]);_0x4081a1[_0xdb94('0x7a')]=_['intersection'](_0x4081a1[_0xdb94('0x77')],_0x4081a1[_0xdb94('0x1f')]);_0x350761[_0xdb94('0x7b')]=_[_0xdb94('0x7c')](_0x4081a1[_0xdb94('0x77')],qs[_0xdb94('0x7d')](_0x2e04e3['query'][_0xdb94('0x7d')]));_0x350761[_0xdb94('0x7b')]=_0x350761[_0xdb94('0x7b')][_0xdb94('0x26')]?_0x350761[_0xdb94('0x7b')]:_0x4081a1[_0xdb94('0x77')];if(!_0x2e04e3[_0xdb94('0x1f')]['hasOwnProperty'](_0xdb94('0x81'))){_0x350761[_0xdb94('0x13')]=qs[_0xdb94('0x13')](_0x2e04e3[_0xdb94('0x1f')][_0xdb94('0x13')]);_0x350761[_0xdb94('0x11')]=qs[_0xdb94('0x11')](_0x2e04e3[_0xdb94('0x1f')][_0xdb94('0x11')]);}_0x350761['order']=qs[_0xdb94('0x7f')](_0x2e04e3[_0xdb94('0x1f')][_0xdb94('0x7f')]);_0x350761[_0xdb94('0x55')]=qs[_0xdb94('0x7a')](_['pick'](_0x2e04e3[_0xdb94('0x1f')],_0x4081a1['filters']));_0x350761[_0xdb94('0x55')]['ContactId']=_0x1a13b9['id'];if(_0x2e04e3[_0xdb94('0x1f')][_0xdb94('0x80')]){_0x350761['where']=_['merge'](_0x350761[_0xdb94('0x55')],{'$or':_[_0xdb94('0x69')](_0x350761[_0xdb94('0x7b')],function(_0x13b8fa){var _0x477a63={};_0x477a63[_0x13b8fa]={'$like':'%'+_0x2e04e3[_0xdb94('0x1f')]['filter']+'%'};return _0x477a63;})});}_0x350761=_[_0xdb94('0x33')]({},_0x350761,_0x2e04e3['options']);return db[_0xdb94('0x46')][_0xdb94('0x14')]({'where':_0x350761[_0xdb94('0x55')]})[_0xdb94('0x18')](function(_0x4f4109){_0x195c90[_0xdb94('0x14')]=_0x4f4109;if(_0x2e04e3[_0xdb94('0x1f')][_0xdb94('0x9e')]){_0x350761[_0xdb94('0x9b')]=[{'all':!![]}];}return db[_0xdb94('0x46')][_0xdb94('0x1e')](_0x350761);})[_0xdb94('0x18')](function(_0x791e36){_0x195c90[_0xdb94('0x9c')]=_0x791e36;return _0x195c90;});}})[_0xdb94('0x18')](respondWithFilteredResult(_0xbe8234,_0x350761))[_0xdb94('0x20')](handleError(_0xbe8234,null));};exports[_0xdb94('0x9f')]=function(_0x243de5,_0x14d124){var _0x40d014={'raw':!![],'where':{}};var _0x4ece04={};var _0x40054e={'count':0x0,'rows':[]};return db[_0xdb94('0x23')][_0xdb94('0x76')]({'where':{'id':_0x243de5[_0xdb94('0x21')]['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0x14d124,null))[_0xdb94('0x18')](function(_0x4818f7){if(_0x4818f7){_0x4ece04[_0xdb94('0x77')]=_[_0xdb94('0x25')](db[_0xdb94('0x45')][_0xdb94('0x79')]);_0x4ece04['query']=_[_0xdb94('0x25')](_0x243de5[_0xdb94('0x1f')]);_0x4ece04[_0xdb94('0x7a')]=_[_0xdb94('0x7c')](_0x4ece04[_0xdb94('0x77')],_0x4ece04['query']);_0x40d014[_0xdb94('0x7b')]=_[_0xdb94('0x7c')](_0x4ece04[_0xdb94('0x77')],qs['fields'](_0x243de5[_0xdb94('0x1f')][_0xdb94('0x7d')]));_0x40d014[_0xdb94('0x7b')]=_0x40d014['attributes']['length']?_0x40d014['attributes']:_0x4ece04[_0xdb94('0x77')];if(!_0x243de5['query'][_0xdb94('0x32')](_0xdb94('0x81'))){_0x40d014['limit']=qs[_0xdb94('0x13')](_0x243de5[_0xdb94('0x1f')][_0xdb94('0x13')]);_0x40d014['offset']=qs['offset'](_0x243de5[_0xdb94('0x1f')][_0xdb94('0x11')]);}_0x40d014[_0xdb94('0x7e')]=qs['sort'](_0x243de5[_0xdb94('0x1f')][_0xdb94('0x7f')]);_0x40d014['where']=qs[_0xdb94('0x7a')](_[_0xdb94('0x98')](_0x243de5[_0xdb94('0x1f')],_0x4ece04['filters']));_0x40d014[_0xdb94('0x55')][_0xdb94('0x99')]=_0x4818f7['id'];if(_0x243de5[_0xdb94('0x1f')][_0xdb94('0x80')]){_0x40d014[_0xdb94('0x55')]=_[_0xdb94('0x33')](_0x40d014['where'],{'$or':_[_0xdb94('0x69')](_0x40d014[_0xdb94('0x7b')],function(_0x1f5328){var _0x5be65c={};_0x5be65c[_0x1f5328]={'$like':'%'+_0x243de5[_0xdb94('0x1f')][_0xdb94('0x80')]+'%'};return _0x5be65c;})});}_0x40d014=_[_0xdb94('0x33')]({},_0x40d014,_0x243de5[_0xdb94('0x9a')]);return db[_0xdb94('0x45')][_0xdb94('0x14')]({'where':_0x40d014[_0xdb94('0x55')]})['then'](function(_0x2f53d3){_0x40054e[_0xdb94('0x14')]=_0x2f53d3;if(_0x243de5['query']['includeAll']){_0x40d014['include']=[{'all':!![]}];}return db[_0xdb94('0x45')][_0xdb94('0x1e')](_0x40d014);})[_0xdb94('0x18')](function(_0x564abf){_0x40054e[_0xdb94('0x9c')]=_0x564abf;return _0x40054e;});}})[_0xdb94('0x18')](respondWithFilteredResult(_0x14d124,_0x40d014))[_0xdb94('0x20')](handleError(_0x14d124,null));};exports['getJscriptySessions']=function(_0x117e9f,_0xfb2007){var _0x2fea6d={'raw':!![],'where':{}};var _0x480790={};var _0x3c48f4={'count':0x0,'rows':[]};return db[_0xdb94('0x23')][_0xdb94('0x76')]({'where':{'id':_0x117e9f['params']['id']}})[_0xdb94('0x18')](handleEntityNotFound(_0xfb2007,null))['then'](function(_0x51d1ed){if(_0x51d1ed){_0x480790['model']=_['keys'](db[_0xdb94('0x4a')][_0xdb94('0x79')]);_0x480790[_0xdb94('0x1f')]=_[_0xdb94('0x25')](_0x117e9f[_0xdb94('0x1f')]);_0x480790[_0xdb94('0x7a')]=_[_0xdb94('0x7c')](_0x480790[_0xdb94('0x77')],_0x480790[_0xdb94('0x1f')]);_0x2fea6d['attributes']=_[_0xdb94('0x7c')](_0x480790['model'],qs[_0xdb94('0x7d')](_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x7d')]));_0x2fea6d[_0xdb94('0x7b')]=_0x2fea6d[_0xdb94('0x7b')][_0xdb94('0x26')]?_0x2fea6d['attributes']:_0x480790['model'];if(!_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x32')](_0xdb94('0x81'))){_0x2fea6d[_0xdb94('0x13')]=qs[_0xdb94('0x13')](_0x117e9f[_0xdb94('0x1f')]['limit']);_0x2fea6d[_0xdb94('0x11')]=qs[_0xdb94('0x11')](_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x11')]);}_0x2fea6d[_0xdb94('0x7e')]=qs[_0xdb94('0x7f')](_0x117e9f['query'][_0xdb94('0x7f')]);_0x2fea6d[_0xdb94('0x55')]=qs[_0xdb94('0x7a')](_[_0xdb94('0x98')](_0x117e9f[_0xdb94('0x1f')],_0x480790[_0xdb94('0x7a')]));_0x2fea6d['where'][_0xdb94('0x99')]=_0x51d1ed['id'];if(_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x80')]){_0x2fea6d[_0xdb94('0x55')]=_[_0xdb94('0x33')](_0x2fea6d[_0xdb94('0x55')],{'$or':_[_0xdb94('0x69')](_0x2fea6d['attributes'],function(_0x17f28c){var _0x32e32a={};_0x32e32a[_0x17f28c]={'$like':'%'+_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x80')]+'%'};return _0x32e32a;})});}_0x2fea6d=_[_0xdb94('0x33')]({},_0x2fea6d,_0x117e9f[_0xdb94('0x9a')]);return db[_0xdb94('0x4a')][_0xdb94('0x14')]({'where':_0x2fea6d[_0xdb94('0x55')]})[_0xdb94('0x18')](function(_0x55d3ab){_0x3c48f4[_0xdb94('0x14')]=_0x55d3ab;if(_0x117e9f[_0xdb94('0x1f')][_0xdb94('0x9e')]){_0x2fea6d[_0xdb94('0x9b')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xdb94('0x1e')](_0x2fea6d);})['then'](function(_0x160178){_0x3c48f4['rows']=_0x160178;return _0x3c48f4;});}})[_0xdb94('0x18')](respondWithFilteredResult(_0xfb2007,_0x2fea6d))[_0xdb94('0x20')](handleError(_0xfb2007,null));};exports[_0xdb94('0xa0')]=function(_0x46661c,_0x30f04c){try{if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0x58')]){throw new Error('No\x20ListId\x20specified');}if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0xa1')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0xa2')]){throw new Error(_0xdb94('0xa3'));}if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0xa4')]){throw new Error(_0xdb94('0xa5'));}var _0x20d0b0=_0x46661c['body'][_0xdb94('0xa1')][_0xdb94('0xa6')](',');var _0x4ce05e=_0x46661c[_0xdb94('0x34')][_0xdb94('0xa2')][_0xdb94('0xa6')](',');if(!_0x20d0b0[_0xdb94('0x26')]||!_0x4ce05e['length']||_0x20d0b0[_0xdb94('0x26')]!==_0x4ce05e[_0xdb94('0x26')]){throw new Error(_0xdb94('0xa7'));}_0x46661c[_0xdb94('0x34')]['fields']=_['zipObject'](_0x20d0b0,_0x4ce05e);if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0x7d')][_0xdb94('0x74')]){throw new Error(_0xdb94('0xa8'));}if(!_0x46661c[_0xdb94('0x34')][_0xdb94('0x7d')][_0xdb94('0xa9')]){throw new Error(_0xdb94('0xaa'));}var _0x3c5db9=path[_0xdb94('0x38')](config[_0xdb94('0xab')],_0xdb94('0xac'),_0x46661c[_0xdb94('0xad')]['filename']);fs['chmodSync'](_0x3c5db9,parseInt('0777',0x8));var _0xe04dea=require(_0xdb94('0xae'))[_0xdb94('0xaf')](path['join'](__dirname,_0xdb94('0xb0')),[_0x3c5db9,_0x46661c[_0xdb94('0x34')][_0xdb94('0xa1')],_0x46661c[_0xdb94('0x34')][_0xdb94('0xa2')],_0x46661c['body'][_0xdb94('0x58')],_0x46661c['body'][_0xdb94('0xb1')],_0x46661c['body'][_0xdb94('0x54')],_0x46661c[_0xdb94('0x34')][_0xdb94('0xa4')]]);return _0x30f04c[_0xdb94('0xf')](0xc8)['json']({'message':_0xdb94('0xb2'),'pid':_0xe04dea[_0xdb94('0xb3')]});}catch(_0x40d6fd){return _0x30f04c[_0xdb94('0xf')](0x1f4)['send'](_0x40d6fd);}};exports[_0xdb94('0xb4')]=function(_0x357a12,_0x2b3d3f){var _0x1b8197=fs['createReadStream'](_0x357a12[_0xdb94('0xad')]['path']);Papa['parse'](_0x1b8197,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5824cc){return _0x2b3d3f['status'](0xc8)[_0xdb94('0x10')]({'file':_0x357a12[_0xdb94('0xad')],'fields':_0x5824cc[_0xdb94('0xb5')]['fields']});}});};exports[_0xdb94('0xb6')]=function(_0x2cfab7,_0x497cf6){return db[_0xdb94('0xb7')][_0xdb94('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0xdb94('0xb8')}})[_0xdb94('0x18')](function(_0x2bb0d8){var _0x431f29=![];if(!_0x2cfab7[_0xdb94('0x34')][_0xdb94('0x58')]){throw new Error(_0xdb94('0xb9'));}if(!_0x2cfab7[_0xdb94('0x34')]['binding'][_0xdb94('0x74')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x2cfab7[_0xdb94('0x34')][_0xdb94('0xba')][_0xdb94('0xa9')]){throw new Error(_0xdb94('0xaa'));}if(!_0x2cfab7['body'][_0xdb94('0xa4')]){throw new Error(_0xdb94('0xa5'));}var _0x3676ba=require(_0xdb94('0xae'))[_0xdb94('0xaf')](path[_0xdb94('0x38')](__dirname,_0xdb94('0xbb')),[_0x2cfab7[_0xdb94('0x21')]['id'],JSON['stringify'](_0x2cfab7[_0xdb94('0x34')]),JSON[_0xdb94('0xbc')](_0x2bb0d8)]);_0x3676ba['on'](_0xdb94('0xbd'),function(){_0x431f29=!![];return _0x497cf6[_0xdb94('0xf')](0xc8)[_0xdb94('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x3676ba[_0xdb94('0xb3')]});});_0x3676ba['on'](_0xdb94('0xbe'),function(_0x2fb36c){if(_0x2fb36c&&!_0x431f29){return _0x497cf6[_0xdb94('0xf')](0x1f4)[_0xdb94('0x10')]({'message':_0xdb94('0xbf'),'pid':_0x3676ba['pid']});}});})[_0xdb94('0x20')](handleError(_0x497cf6,null));};exports[_0xdb94('0xc0')]=function(_0x39f7f6,_0x1ae6f4){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xdb94('0xb8')}})[_0xdb94('0x18')](function(_0x30363f){var _0x5545cd=![];if(!_0x39f7f6['body'][_0xdb94('0x58')]){throw new Error(_0xdb94('0xb9'));}if(!_0x39f7f6[_0xdb94('0x34')][_0xdb94('0xba')][_0xdb94('0x74')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x39f7f6[_0xdb94('0x34')][_0xdb94('0xba')][_0xdb94('0xa9')]){throw new Error(_0xdb94('0xaa'));}if(!_0x39f7f6[_0xdb94('0x34')][_0xdb94('0xa4')]){throw new Error(_0xdb94('0xa5'));}var _0x44bbf2=require(_0xdb94('0xae'))[_0xdb94('0xaf')](path[_0xdb94('0x38')](__dirname,_0xdb94('0xc1')),[_0x39f7f6[_0xdb94('0x21')]['id'],JSON[_0xdb94('0xbc')](_0x39f7f6[_0xdb94('0x34')]),JSON['stringify'](_0x30363f)]);_0x44bbf2['on'](_0xdb94('0xbd'),function(){_0x5545cd=!![];return _0x1ae6f4['status'](0xc8)[_0xdb94('0x10')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x44bbf2[_0xdb94('0xb3')]});});_0x44bbf2['on'](_0xdb94('0xbe'),function(_0x4dc8a8){if(_0x4dc8a8&&!_0x5545cd){return _0x1ae6f4[_0xdb94('0xf')](0x1f4)[_0xdb94('0x10')]({'message':_0xdb94('0xbf'),'pid':_0x44bbf2[_0xdb94('0xb3')]});}});})[_0xdb94('0x20')](handleError(_0x1ae6f4,null));};exports[_0xdb94('0xc2')]=function(_0x1f1ea3,_0x2128f6){var _0x13e689=['mail',_0xdb94('0xc3'),'sms',_0xdb94('0xc4'),_0xdb94('0xc5'),'whatsapp',_0xdb94('0xc6')];var _0x6e0474={'offset':0x0,'order':qs['sort'](_0xdb94('0xc7'))},_0x265782={'count':0x0,'rows':[]};Promise[_0xdb94('0xc8')]()[_0xdb94('0x18')](function(){if(_0x1f1ea3[_0xdb94('0x1f')]['channel']){if(!_[_0xdb94('0xc9')](_0x13e689,_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0xca')][_0xdb94('0xcb')]())){throw new Error(_0xdb94('0xcc'));}_0x13e689=[_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0xca')][_0xdb94('0xcb')]()];}if(_0x1f1ea3[_0xdb94('0x1f')]['range']){try{var _0x4042e2=JSON['parse'](_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0xcd')]);if(!moment(_0x4042e2['from'])[_0xdb94('0xce')]()){throw new Error(_0xdb94('0xcf'));}if(!moment(_0x4042e2['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x5f599f){throw new Error(_0xdb94('0xd0'));}}if(!_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0x32')](_0xdb94('0x81'))){_0x6e0474[_0xdb94('0x13')]=qs[_0xdb94('0x13')](_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0x13')]||0xa);_0x6e0474[_0xdb94('0x11')]=qs[_0xdb94('0x11')](_0x1f1ea3[_0xdb94('0x1f')][_0xdb94('0x11')]);}var _0x254fb0=_0x13e689[_0xdb94('0x69')](function(_0x28c17c){if(_0x28c17c===_0xdb94('0xc6')){var _0x2b5eb1={'attributes':['id',_0xdb94('0xd1'),_0xdb94('0x2d'),_0xdb94('0xd2'),_0xdb94('0xd3'),_0xdb94('0xd4'),_0xdb94('0xd5'),_0xdb94('0xd6'),_0xdb94('0xd7'),_0xdb94('0xd8'),_0xdb94('0xd9'),_0xdb94('0xda'),_0xdb94('0xdb'),_0xdb94('0xdc'),'UserId'],'where':{'ContactId':_0x1f1ea3[_0xdb94('0x21')]['id']},'include':[{'model':db[_0xdb94('0xb7')],'as':'User','attributes':['id','name','fullname',_0xdb94('0x2c')]}],'order':[[_0xdb94('0xd9'),'DESC']]};if(_0x1f1ea3[_0xdb94('0x1f')]['range']){_0x2b5eb1['where'][_0xdb94('0xd9')]={'$gte':_0x4042e2['from'],'$lte':_0x4042e2['to']};}return db[_0xdb94('0xdd')][_0xdb94('0xde')](_0x2b5eb1)[_0xdb94('0x18')](function(_0x3aee7c){_0x265782['count']+=_0x3aee7c[_0xdb94('0x14')];return _[_0xdb94('0x69')](_0x3aee7c['rows'],function(_0x336902){var _0x4c8e62=_0x336902[_0xdb94('0x35')]({'plain':!![]});_0x4c8e62['channel']=_0x28c17c;if(_0x4c8e62[_0xdb94('0xb7')]){_0x4c8e62[_0xdb94('0xb7')]={'id':_0x4c8e62[_0xdb94('0xb7')]['id'],'name':_0x4c8e62[_0xdb94('0xb7')]['name'],'fullname':_0x4c8e62[_0xdb94('0xb7')]['fullname'],'alias':_0x4c8e62['User'][_0xdb94('0x2c')]};}return _0x4c8e62;});});}else{var _0x2fd3cf=_[_0xdb94('0xdf')](_0x28c17c)+(_0x28c17c===_0xdb94('0xc3')?_0xdb94('0xe0'):'Account');var _0x597af9={'attributes':['id',_0xdb94('0xe1'),_0xdb94('0xe2'),_0xdb94('0xd9'),_0xdb94('0xd8'),_0xdb94('0xe3'),_0xdb94('0xe4'),_0xdb94('0xe5'),_0xdb94('0xe6'),_0x2fd3cf+'Id'],'where':{'ContactId':_0x1f1ea3[_0xdb94('0x21')]['id']},'include':[{'model':db[_0x2fd3cf],'as':_0xdb94('0xe7'),'attributes':['id',_0xdb94('0x60'),_0xdb94('0xe8')]},{'model':db[_0xdb94('0xb7')],'as':_0xdb94('0xe9'),'attributes':['id','name','fullname']},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xdb94('0xea')],'through':{'attributes':[]}}],'order':[[_0xdb94('0xd9'),_0xdb94('0xeb')]]};if(_0x1f1ea3[_0xdb94('0x1f')]['range']){_0x597af9[_0xdb94('0x55')][_0xdb94('0xd9')]={'$gte':_0x4042e2[_0xdb94('0x39')],'$lte':_0x4042e2['to']};}switch(_0x28c17c){case _0xdb94('0xc3'):_0x597af9[_0xdb94('0x7b')]['push'](_0xdb94('0xec'),_0xdb94('0xed'),_0xdb94('0xee'),_0xdb94('0xef'),'osName',_0xdb94('0xf0'),_0xdb94('0xf1'),'ratingValue','referer');break;case _0xdb94('0xf2'):_0x597af9[_0xdb94('0x7b')][_0xdb94('0x57')](_0xdb94('0xf3'),'substatus');break;case'openchannel':_0x597af9[_0xdb94('0x7b')]['push'](_0xdb94('0xf4'),_0xdb94('0xf5'));break;}return db[_[_0xdb94('0xdf')](_0x28c17c)+'Interaction'][_0xdb94('0xde')](_0x597af9)[_0xdb94('0x18')](function(_0x4ef47e){_0x265782['count']+=_0x4ef47e[_0xdb94('0x14')];return _[_0xdb94('0x69')](_0x4ef47e[_0xdb94('0x9c')],function(_0x303e39){var _0x114c1a=_0x303e39[_0xdb94('0x35')]({'plain':!![]});_0x114c1a[_0xdb94('0xca')]=_0x28c17c;if(_0x114c1a[_0xdb94('0xe9')]){_0x114c1a[_0xdb94('0xe9')]={'id':_0x114c1a[_0xdb94('0xe9')]['id'],'name':_0x114c1a[_0xdb94('0xe9')][_0xdb94('0x60')],'fullname':_0x114c1a[_0xdb94('0xe9')][_0xdb94('0xf6')]};}return _0x114c1a;});});}});return Promise['all'](_0x254fb0);})[_0xdb94('0x18')](function(_0x5220f8){return _(_0x5220f8)[_0xdb94('0xf7')]()[_0xdb94('0xf8')]('createdAt')['reverse']()[_0xdb94('0xf9')]();})[_0xdb94('0x18')](function(_0x19e647){_0x265782['rows']=_0x6e0474[_0xdb94('0x13')]?_0x19e647[_0xdb94('0xfa')](_0x6e0474[_0xdb94('0x11')],_0x6e0474[_0xdb94('0x11')]+_0x6e0474[_0xdb94('0x13')]):_0x19e647;return _0x265782;})[_0xdb94('0x18')](respondWithFilteredResult(_0x2128f6,_0x6e0474))[_0xdb94('0x20')](handleError(_0x2128f6,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index edefb8b..f06bdb8 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 _0x8aee=['remove','emit','exports','events','../../mysqldb','CmContact','setMaxListeners','save','update'];(function(_0x1b0ec6,_0x35b618){var _0x38c14e=function(_0x447369){while(--_0x447369){_0x1b0ec6['push'](_0x1b0ec6['shift']());}};_0x38c14e(++_0x35b618);}(_0x8aee,0x66));var _0xe8ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aee[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe8ae('0x0'));var CmContact=require(_0xe8ae('0x1'))['db'][_0xe8ae('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xe8ae('0x3')](0x0);var events={'afterCreate':_0xe8ae('0x4'),'afterUpdate':_0xe8ae('0x5'),'afterDestroy':_0xe8ae('0x6')};function emitEvent(_0x32fa3e){return function(_0x3bba0b,_0x462ed8,_0x27ece4){CmContactEvents[_0xe8ae('0x7')](_0x32fa3e+':'+_0x3bba0b['id'],_0x3bba0b);CmContactEvents['emit'](_0x32fa3e,_0x3bba0b);_0x27ece4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xe8ae('0x8')]=CmContactEvents; \ No newline at end of file +var _0xbaba=['hasOwnProperty','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x5d7b33,_0x39c6f9){var _0x50a053=function(_0x44dafe){while(--_0x44dafe){_0x5d7b33['push'](_0x5d7b33['shift']());}};_0x50a053(++_0x39c6f9);}(_0xbaba,0x1a0));var _0xabab=function(_0x249ec0,_0x115aa4){_0x249ec0=_0x249ec0-0x0;var _0x379c4a=_0xbaba[_0x249ec0];return _0x379c4a;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xabab('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xabab('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xabab('0x2')};function emitEvent(_0xc645c2){return function(_0x5e97e0,_0x536490,_0x14892b){CmContactEvents[_0xabab('0x3')](_0xc645c2+':'+_0x5e97e0['id'],_0x5e97e0);CmContactEvents['emit'](_0xc645c2,_0x5e97e0);_0x14892b(null);};}for(var e in events){if(events[_0xabab('0x4')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xabab('0x5')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 9ab4aaa..703373c 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 _0x8dc1=['ContactId','VoiceQueueId','all','[CmContact][afterDestroy][Succesfull]','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','phone','fti_cm_contacts','firstName','lastName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','scheduledat','minutes','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','format','callbackUniqueid','YYYY-MM-DD\x20HH:mm:ss','CmHopper','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','catch','inspect','Campaign','add','ret','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','cmContact,\x20%s,\x20%s','message','CmHopperBlack','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8dc1,0xdc));var _0x18dc=function(_0x1045d4,_0x15a9cb){_0x1045d4=_0x1045d4-0x0;var _0x1c48d3=_0x8dc1[_0x1045d4];return _0x1c48d3;};'use strict';var _=require(_0x18dc('0x0'));var util=require('util');var logger=require(_0x18dc('0x1'))(_0x18dc('0x2'));var moment=require(_0x18dc('0x3'));var BPromise=require(_0x18dc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x18dc('0x5'));var rimraf=require(_0x18dc('0x6'));var config=require(_0x18dc('0x7'));var shared=require(_0x18dc('0x8'));var attributes=require(_0x18dc('0x9'));module[_0x18dc('0xa')]=function(_0x20abbf,_0x3718cd){return _0x20abbf[_0x18dc('0xb')]('CmContact',attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x18dc('0xc'),'fields':['phone']},{'name':_0x18dc('0xd'),'fields':[_0x18dc('0xe'),_0x18dc('0xf'),_0x18dc('0xc'),_0x18dc('0x10'),_0x18dc('0x11'),_0x18dc('0x12')],'type':_0x18dc('0x13')}],'timestamps':!![],'charset':_0x18dc('0x14'),'collate':_0x18dc('0x15'),'hooks':{'afterCreate':function(_0x54464e,_0x46e6d3,_0x582886){var _0xf24fef=_0x20abbf[_0x18dc('0x16')];var _0x298365=_0x54464e[_0x18dc('0x17')]({'plain':!![]});function _0x11de26(){return function(_0x369309){logger[_0x18dc('0x18')](_0x18dc('0x19'),_0x18dc('0x1a'),util['inspect'](_0x369309,{'showHidden':![],'depth':null}));};}function _0x89a018(_0x547362,_0x869471){var _0x1c891c=_0x869471['scheduledat']?_0x869471['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x5aab85,_0x2dbc4c){if(_[_0x18dc('0x1b')](_0x869471[_0x18dc('0x1c')])){_0x5aab85({'ret':_0x1c891c});}else{_0xf24fef[_0x18dc('0x1d')][_0x18dc('0x1e')]({'where':{'id':_0x547362['id']}})['then'](function(_0x26d7d7){if(!_[_0x18dc('0x1b')](_0x26d7d7)){var _0x58e980=_0x26d7d7[_0x18dc('0x1c')];if(!_[_0x18dc('0x1b')](_0x58e980)){var _0x5b4ba5=shared[_0x18dc('0x1f')];var _0xab6ec=_0x5b4ba5[_0x58e980];var _0x2c4635=_0x5b4ba5[_0x869471[_0x18dc('0x1c')]];if(!_[_0x18dc('0x1b')](_0xab6ec)&&!_[_0x18dc('0x1b')](_0x2c4635)){var _0x163f28=_0xab6ec[_0x18dc('0x20')]-_0x2c4635[_0x18dc('0x20')];_0x1c891c=_0x869471[_0x18dc('0x21')]?_0x869471[_0x18dc('0x21')]:moment();var _0x1f3677=moment(_0x1c891c)['add'](_0x163f28,_0x18dc('0x22'));_0x5aab85({'ret':_0x1f3677['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x5aab85({'ret':_0x1c891c});}else _0x5aab85({'ret':_0x1c891c});}else{_0x5aab85({'ret':_0x1c891c});}});}});return 0xa;}var _0x23121b=function(_0x23383b){return new BPromise(function(_0x5d0968,_0x427d28){_0x89a018(_0x23383b,_0x298365)[_0x18dc('0x23')](function(_0x2cc8cd){_0x298365['scheduledat']=_0x2cc8cd['ret'];_0xf24fef['CmHopper']['findOne']({'where':{'phone':_0x298365[_0x18dc('0xc')],'VoiceQueueId':_0x23383b['id']}})[_0x18dc('0x23')](function(_0x174576){if(!_[_0x18dc('0x1b')](_0x174576)){throw new Error('cmContact,\x20afterCreate\x20'+_0x298365[_0x18dc('0xc')]+_0x18dc('0x24')+_0x23383b['id']);}return _0xf24fef['CmHopper'][_0x18dc('0x25')]({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'priority':_0x298365[_0x18dc('0x27')]?_0x298365[_0x18dc('0x27')]:0x2,'scheduledat':_0x298365[_0x18dc('0x21')]?_0x298365[_0x18dc('0x21')]:moment()[_0x18dc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x298365[_0x18dc('0x29')]?!![]:![],'callbackuniqueid':_0x298365[_0x18dc('0x29')]?_0x298365[_0x18dc('0x29')]:undefined,'callbackat':_0x298365[_0x18dc('0x29')]?moment()[_0x18dc('0x28')](_0x18dc('0x2a')):undefined,'VoiceQueueId':_0x23383b['id']});})['catch'](function(_0x316afb){_0x427d28(_0x316afb);});});});};var _0x2d49d9=function(_0x1567bb){return new BPromise(function(_0x59f21b,_0x5016f3){_0x89a018(_0x1567bb,_0x298365)[_0x18dc('0x23')](function(_0x1113fa){_0x298365[_0x18dc('0x21')]=_0x1113fa['ret'];_0xf24fef[_0x18dc('0x2b')]['findOne']({'where':{'phone':_0x298365[_0x18dc('0xc')],'VoiceQueueId':_0x1567bb['id']}})['then'](function(_0x1ad22f){if(!_[_0x18dc('0x1b')](_0x1ad22f)){throw new Error(_0x18dc('0x2c')+_0x298365[_0x18dc('0xc')]+_0x18dc('0x2d')+_0x1567bb['id']);}return _0xf24fef[_0x18dc('0x2e')][_0x18dc('0x1e')]({'where':{'calleridnum':_0x298365[_0x18dc('0xc')],'VoiceQueueId':_0x1567bb['id']}});})[_0x18dc('0x23')](function(_0x251392){if(!_[_0x18dc('0x1b')](_0x251392)){throw new Error(_0x18dc('0x2f')+_0x298365[_0x18dc('0xc')]+_0x18dc('0x30')+_0x1567bb['id']);}return _0xf24fef[_0x18dc('0x2b')][_0x18dc('0x25')]({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'priority':_0x298365['priority']?_0x298365[_0x18dc('0x27')]:0x2,'scheduledat':_0x298365[_0x18dc('0x21')]?_0x298365[_0x18dc('0x21')]:moment()['format'](_0x18dc('0x2a')),'callback':_0x298365[_0x18dc('0x29')]?!![]:![],'callbackuniqueid':_0x298365[_0x18dc('0x29')]?_0x298365[_0x18dc('0x29')]:undefined,'callbackat':_0x298365[_0x18dc('0x29')]?moment()['format'](_0x18dc('0x2a')):undefined,'VoiceQueueId':_0x1567bb['id']});})[_0x18dc('0x31')](function(_0x56a181){_0x5016f3(_0x56a181);});});});};function _0x546f9a(){return function(_0x1b54f0){logger[_0x18dc('0x18')]('cmContact',_0x18dc('0x1a'),util[_0x18dc('0x32')](_0x1b54f0,{'showHidden':![],'depth':null}));};}function _0x2dea42(_0x5c958a,_0x2c3010){var _0x1f4150=_0x2c3010['scheduledat']?_0x2c3010[_0x18dc('0x21')]:moment()[_0x18dc('0x28')](_0x18dc('0x2a'));return new BPromise(function(_0x586f33,_0x4a561e){if(_[_0x18dc('0x1b')](_0x2c3010[_0x18dc('0x1c')])){_0x586f33({'ret':_0x1f4150});}else{_0xf24fef[_0x18dc('0x33')]['findOne']({'where':{'id':_0x5c958a['id']}})['then'](function(_0x4de482){if(!_[_0x18dc('0x1b')](_0x4de482)){var _0x11f286=_0x4de482['dialTimezone'];if(!_[_0x18dc('0x1b')](_0x11f286)){var _0x23e2a8=shared[_0x18dc('0x1f')];var _0x240f36=_0x23e2a8[_0x11f286];var _0x31ef1c=_0x23e2a8[_0x2c3010['dialTimezone']];if(!_['isNil'](_0x240f36)&&!_[_0x18dc('0x1b')](_0x31ef1c)){var _0x2bc94b=_0x240f36[_0x18dc('0x20')]-_0x31ef1c['utcOffset'];_0x1f4150=_0x2c3010[_0x18dc('0x21')]?_0x2c3010['scheduledat']:moment();var _0x29da0a=moment(_0x1f4150)[_0x18dc('0x34')](_0x2bc94b,_0x18dc('0x22'));_0x586f33({'ret':_0x29da0a[_0x18dc('0x28')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x586f33({'ret':_0x1f4150});}else _0x586f33({'ret':_0x1f4150});}else{_0x586f33({'ret':_0x1f4150});}});}});return 0xa;}var _0x390f40=function(_0x587006){return new BPromise(function(_0xc3bcf5,_0x58c127){_0x2dea42(_0x587006,_0x298365)[_0x18dc('0x23')](function(_0x18e911){_0x298365['scheduledat']=_0x18e911[_0x18dc('0x35')];_0xf24fef[_0x18dc('0x2b')][_0x18dc('0x1e')]({'where':{'phone':_0x298365['phone'],'CampaignId':_0x587006['id']}})[_0x18dc('0x23')](function(_0x2456ed){if(!_['isNil'](_0x2456ed)){throw new Error(_0x18dc('0x2c')+_0x298365['phone']+_0x18dc('0x36')+_0x587006['id']);}return _0xf24fef['CmHopper'][_0x18dc('0x25')]({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365['ListId'],'priority':_0x298365[_0x18dc('0x27')]?_0x298365['priority']:0x2,'scheduledat':_0x298365['scheduledat']?_0x298365[_0x18dc('0x21')]:moment()[_0x18dc('0x28')](_0x18dc('0x2a')),'callback':_0x298365['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x298365[_0x18dc('0x29')]?_0x298365[_0x18dc('0x29')]:undefined,'callbackat':_0x298365[_0x18dc('0x29')]?moment()[_0x18dc('0x28')](_0x18dc('0x2a')):undefined,'CampaignId':_0x587006['id']});})['catch'](function(_0x424109){_0x58c127(_0x424109);});});});};var _0x21be35=function(_0x1d28b2){return new BPromise(function(_0x4c4a6f,_0x12f013){_0x2dea42(_0x1d28b2,_0x298365)['then'](function(_0x1bbcb8){_0x298365[_0x18dc('0x21')]=_0x1bbcb8['ret'];_0xf24fef[_0x18dc('0x2b')]['findOne']({'where':{'phone':_0x298365[_0x18dc('0xc')],'CampaignId':_0x1d28b2['id']}})[_0x18dc('0x23')](function(_0x2080b0){if(!_[_0x18dc('0x1b')](_0x2080b0)){throw new Error(_0x18dc('0x2c')+_0x298365['phone']+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20'+_0x1d28b2['id']);}return _0xf24fef[_0x18dc('0x2e')][_0x18dc('0x1e')]({'where':{'calleridnum':_0x298365['phone'],'CampaignId':_0x1d28b2['id']}});})[_0x18dc('0x23')](function(_0x211430){if(!_['isNil'](_0x211430)){throw new Error(_0x18dc('0x2f')+_0x298365[_0x18dc('0xc')]+_0x18dc('0x37')+_0x1d28b2['id']);}return _0xf24fef['CmHopper'][_0x18dc('0x25')]({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365['ListId'],'priority':_0x298365[_0x18dc('0x27')]?_0x298365[_0x18dc('0x27')]:0x2,'scheduledat':_0x298365[_0x18dc('0x21')]?_0x298365[_0x18dc('0x21')]:moment()[_0x18dc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x298365[_0x18dc('0x29')]?!![]:![],'callbackuniqueid':_0x298365[_0x18dc('0x29')]?_0x298365[_0x18dc('0x29')]:undefined,'callbackat':_0x298365[_0x18dc('0x29')]?moment()[_0x18dc('0x28')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x1d28b2['id']});})[_0x18dc('0x31')](function(_0x121805){_0x12f013(_0x121805);});});});};if(_0x298365[_0x18dc('0x26')]){_0xf24fef[_0x18dc('0x1d')][_0x18dc('0x38')]({'where':{'type':_0x18dc('0x39')},'attributes':['id',_0x18dc('0x3a'),_0x18dc('0x1c')],'include':[{'model':_0xf24fef[_0x18dc('0x3b')],'as':_0x18dc('0x3c'),'where':{'id':_0x298365[_0x18dc('0x26')]}}]})[_0x18dc('0x23')](function(_0xd2ecad){if(_0xd2ecad){var _0x4ea3b9=[];for(var _0x145224=0x0,_0x5e8d43;_0x145224<_0xd2ecad[_0x18dc('0x3d')];_0x145224+=0x1){_0x5e8d43=_0xd2ecad[_0x145224]['get']({'plain':!![]});switch(_0x5e8d43['dialCheckDuplicateType']){case _0x18dc('0x3e'):_0x2d49d9(_0x5e8d43)[_0x18dc('0x31')](_0x11de26());break;case _0x18dc('0x3f'):_0x23121b(_0x5e8d43)[_0x18dc('0x31')](_0x11de26());break;default:_0x2dea42(_0x5e8d43,_0x298365)[_0x18dc('0x23')](function(_0x346f41){_0x298365[_0x18dc('0x21')]=_0x346f41[_0x18dc('0x35')];_0xf24fef[_0x18dc('0x2b')]['create']({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'scheduledat':_0x298365[_0x18dc('0x21')]?_0x298365[_0x18dc('0x21')]:moment()[_0x18dc('0x28')](_0x18dc('0x2a')),'priority':_0x298365['priority']?_0x298365[_0x18dc('0x27')]:0x2,'callback':_0x298365['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x298365['callbackUniqueid']?_0x298365['callbackUniqueid']:undefined,'callbackat':_0x298365['callbackUniqueid']?moment()[_0x18dc('0x28')](_0x18dc('0x2a')):undefined,'VoiceQueueId':_0x5e8d43['id']})[_0x18dc('0x31')](_0x11de26());});}}}})[_0x18dc('0x23')](function(){return _0xf24fef[_0x18dc('0x1d')][_0x18dc('0x38')]({'where':{'type':_0x18dc('0x39')},'attributes':['id'],'include':[{'model':_0xf24fef[_0x18dc('0x3b')],'as':'BlackLists','where':{'id':_0x298365['ListId']}}]})[_0x18dc('0x23')](function(_0x40b883){if(_0x40b883){var _0x2be09c=[];for(var _0x204be6=0x0,_0x3a194b;_0x204be6<_0x40b883[_0x18dc('0x3d')];_0x204be6+=0x1){_0x3a194b=_0x40b883[_0x204be6][_0x18dc('0x17')]({'plain':!![]});_0xf24fef['CmHopperBlack']['create']({'phone':_0x298365[_0x18dc('0xc')],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'VoiceQueueId':_0x3a194b['id']})[_0x18dc('0x31')](function(_0x16203c){logger[_0x18dc('0x18')](_0x18dc('0x40'),_0x18dc('0x1a'),_0x16203c[_0x18dc('0x41')]);});}}});})[_0x18dc('0x23')](function(){return _0xf24fef[_0x18dc('0x33')][_0x18dc('0x38')]({'attributes':['id',_0x18dc('0x3a'),_0x18dc('0x1c')],'include':[{'model':_0xf24fef[_0x18dc('0x3b')],'as':_0x18dc('0x3c'),'where':{'id':_0x298365[_0x18dc('0x26')]}}]})[_0x18dc('0x23')](function(_0x5b8b38){if(_0x5b8b38){var _0x4d910f=[];for(var _0x5be296=0x0,_0x3d0b17;_0x5be296<_0x5b8b38[_0x18dc('0x3d')];_0x5be296+=0x1){_0x3d0b17=_0x5b8b38[_0x5be296][_0x18dc('0x17')]({'plain':!![]});switch(_0x3d0b17['dialCheckDuplicateType']){case _0x18dc('0x3e'):_0x21be35(_0x3d0b17)['catch'](_0x546f9a());break;case'onlyIfOpen':_0x390f40(_0x3d0b17)[_0x18dc('0x31')](_0x546f9a());break;default:_0xf24fef[_0x18dc('0x2b')][_0x18dc('0x25')]({'phone':_0x298365['phone'],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'scheduledat':_0x298365[_0x18dc('0x21')]?_0x298365['scheduledat']:moment()[_0x18dc('0x28')](_0x18dc('0x2a')),'priority':_0x298365[_0x18dc('0x27')]?_0x298365[_0x18dc('0x27')]:0x2,'callback':_0x298365[_0x18dc('0x29')]?!![]:![],'callbackuniqueid':_0x298365[_0x18dc('0x29')]?_0x298365[_0x18dc('0x29')]:undefined,'callbackat':_0x298365[_0x18dc('0x29')]?moment()[_0x18dc('0x28')](_0x18dc('0x2a')):undefined,'CampaignId':_0x3d0b17['id']})['catch'](_0x546f9a());}}}});})['then'](function(){return _0xf24fef[_0x18dc('0x33')][_0x18dc('0x38')]({'attributes':['id'],'include':[{'model':_0xf24fef[_0x18dc('0x3b')],'as':'BlackLists','where':{'id':_0x298365['ListId']}}]})[_0x18dc('0x23')](function(_0x512cc2){if(_0x512cc2){var _0x12a64a=[];for(var _0x462a92=0x0,_0x3654b7;_0x462a92<_0x512cc2[_0x18dc('0x3d')];_0x462a92+=0x1){_0x3654b7=_0x512cc2[_0x462a92][_0x18dc('0x17')]({'plain':!![]});_0xf24fef[_0x18dc('0x42')][_0x18dc('0x25')]({'phone':_0x298365['phone'],'ContactId':_0x298365['id'],'ListId':_0x298365[_0x18dc('0x26')],'CampaignId':_0x3654b7['id']})[_0x18dc('0x31')](function(_0xc1007b){logger[_0x18dc('0x18')]('cmContact,\x20%s,\x20%s',_0x18dc('0x1a'),_0xc1007b[_0x18dc('0x41')]);});}}});})['then'](function(){_0x582886();})[_0x18dc('0x31')](function(_0x131018){logger[_0x18dc('0x18')]('cmContact,\x20%s,\x20%s','afterCreate',_0x131018['message']);_0x582886(_0x131018);});}else{_0x582886(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x46651a,_0x1ae446,_0xfa6ec0){var _0x2c568c=_0x20abbf[_0x18dc('0x16')];var _0x54b165=_0x46651a[_0x18dc('0x17')]({'plain':!![]});return _0x2c568c[_0x18dc('0x2b')][_0x18dc('0x38')]({'raw':!![],'where':{'ListId':_0x54b165[_0x18dc('0x26')],'ContactId':_0x54b165['id']}})[_0x18dc('0x23')](function(_0x440105){if(!_['isEmpty'](_0x440105)){var _0x35eb6c=[];for(var _0x54a888=0x0;_0x54a888<_0x440105[_0x18dc('0x3d')];_0x54a888+=0x1){var _0x349e36=_0x2c568c[_0x18dc('0x2b')][_0x18dc('0x43')]({'where':{'ListId':_0x440105[_0x54a888]['ListId'],'ContactId':_0x440105[_0x54a888][_0x18dc('0x44')],'VoiceQueueId':_0x440105[_0x54a888][_0x18dc('0x45')],'CampaignId':_0x440105[_0x54a888]['CampaignId']}});_0x35eb6c['push'](_0x349e36);}return BPromise[_0x18dc('0x46')](_0x35eb6c);}})['then'](function(_0x3bde25){logger['info'](_0x18dc('0x47'),util[_0x18dc('0x32')](_0x3bde25,{'showHidden':![],'depth':null}));_0xfa6ec0();})['catch'](function(_0x598e30){logger['error']('[CmContact][afterDestroy][Error]',util['inspect'](_0x598e30,{'showHidden':![],'depth':null}));_0xfa6ec0(_0x598e30);});}}});}; \ No newline at end of file +var _0xcb5b=['path','rimraf','../../config/environment','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','mobile','fax','email','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','then','timezones','utcOffset','minutes','ret','cmContact,\x20afterCreate\x20','phone','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','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','ListId','add','\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','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','outbound','dialCheckDuplicateType','CmList','Lists','length','always','onlyIfOpen','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','findAll','isEmpty','destroy','ContactId','VoiceQueueId','[CmContact][afterDestroy][Succesfull]','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x404bb0,_0x552c8b){var _0x5845b7=function(_0x182fb6){while(--_0x182fb6){_0x404bb0['push'](_0x404bb0['shift']());}};_0x5845b7(++_0x552c8b);}(_0xcb5b,0x122));var _0xbcb5=function(_0x420bae,_0x5b773f){_0x420bae=_0x420bae-0x0;var _0x263e20=_0xcb5b[_0x420bae];return _0x263e20;};'use strict';var _=require(_0xbcb5('0x0'));var util=require(_0xbcb5('0x1'));var logger=require(_0xbcb5('0x2'))('api');var moment=require(_0xbcb5('0x3'));var BPromise=require(_0xbcb5('0x4'));var rp=require(_0xbcb5('0x5'));var fs=require('fs');var path=require(_0xbcb5('0x6'));var rimraf=require(_0xbcb5('0x7'));var config=require(_0xbcb5('0x8'));var shared=require(_0xbcb5('0x9'));var attributes=require(_0xbcb5('0xa'));module[_0xbcb5('0xb')]=function(_0x51d4f0,_0x5af491){return _0x51d4f0[_0xbcb5('0xc')]('CmContact',attributes,{'tableName':_0xbcb5('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0xbcb5('0xe'),'fields':[_0xbcb5('0xf'),_0xbcb5('0x10'),'phone',_0xbcb5('0x11'),_0xbcb5('0x12'),_0xbcb5('0x13')],'type':'FULLTEXT'}],'timestamps':!![],'charset':'utf8mb4','collate':_0xbcb5('0x14'),'hooks':{'afterCreate':function(_0x2b32b7,_0x1dd47e,_0x4db4bc){var _0xa20316=_0x51d4f0[_0xbcb5('0x15')];var _0x12a15a=_0x2b32b7[_0xbcb5('0x16')]({'plain':!![]});function _0x36b95e(){return function(_0xdcbd94){logger[_0xbcb5('0x17')](_0xbcb5('0x18'),_0xbcb5('0x19'),util[_0xbcb5('0x1a')](_0xdcbd94,{'showHidden':![],'depth':null}));};}function _0x1d51d4(_0x455910,_0x1d818a){var _0x4741ac=_0x1d818a['scheduledat']?_0x1d818a[_0xbcb5('0x1b')]:moment()[_0xbcb5('0x1c')](_0xbcb5('0x1d'));return new BPromise(function(_0x239cfd,_0x533470){if(_[_0xbcb5('0x1e')](_0x1d818a[_0xbcb5('0x1f')])){_0x239cfd({'ret':_0x4741ac});}else{_0xa20316[_0xbcb5('0x20')][_0xbcb5('0x21')]({'where':{'id':_0x455910['id']}})[_0xbcb5('0x22')](function(_0x4ca8be){if(!_['isNil'](_0x4ca8be)){var _0x16b75e=_0x4ca8be[_0xbcb5('0x1f')];if(!_[_0xbcb5('0x1e')](_0x16b75e)){var _0x3ad5d5=shared[_0xbcb5('0x23')];var _0x890dd8=_0x3ad5d5[_0x16b75e];var _0x14f502=_0x3ad5d5[_0x1d818a[_0xbcb5('0x1f')]];if(!_['isNil'](_0x890dd8)&&!_[_0xbcb5('0x1e')](_0x14f502)){var _0xfe952=_0x890dd8['utcOffset']-_0x14f502[_0xbcb5('0x24')];_0x4741ac=_0x1d818a['scheduledat']?_0x1d818a['scheduledat']:moment();var _0x1d70e7=moment(_0x4741ac)['add'](_0xfe952,_0xbcb5('0x25'));_0x239cfd({'ret':_0x1d70e7[_0xbcb5('0x1c')](_0xbcb5('0x1d'))});}else _0x239cfd({'ret':_0x4741ac});}else _0x239cfd({'ret':_0x4741ac});}else{_0x239cfd({'ret':_0x4741ac});}});}});return 0xa;}var _0x2823bb=function(_0x374134){return new BPromise(function(_0x1d3c64,_0x466c3a){_0x1d51d4(_0x374134,_0x12a15a)[_0xbcb5('0x22')](function(_0x48a16f){_0x12a15a['scheduledat']=_0x48a16f[_0xbcb5('0x26')];_0xa20316['CmHopper']['findOne']({'where':{'phone':_0x12a15a['phone'],'VoiceQueueId':_0x374134['id']}})[_0xbcb5('0x22')](function(_0x1e4ada){if(!_['isNil'](_0x1e4ada)){throw new Error(_0xbcb5('0x27')+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x29')+_0x374134['id']);}return _0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a['ListId'],'priority':_0x12a15a['priority']?_0x12a15a[_0xbcb5('0x2c')]:0x2,'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a[_0xbcb5('0x1b')]:moment()[_0xbcb5('0x1c')](_0xbcb5('0x1d')),'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a['callbackUniqueid']?_0x12a15a[_0xbcb5('0x2d')]:undefined,'callbackat':_0x12a15a['callbackUniqueid']?moment()[_0xbcb5('0x1c')](_0xbcb5('0x1d')):undefined,'VoiceQueueId':_0x374134['id']});})[_0xbcb5('0x2e')](function(_0x531f4e){_0x466c3a(_0x531f4e);});});});};var _0x2ea415=function(_0x2fc99f){return new BPromise(function(_0x26b680,_0x54041c){_0x1d51d4(_0x2fc99f,_0x12a15a)[_0xbcb5('0x22')](function(_0x43ca61){_0x12a15a['scheduledat']=_0x43ca61['ret'];_0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x21')]({'where':{'phone':_0x12a15a[_0xbcb5('0x28')],'VoiceQueueId':_0x2fc99f['id']}})[_0xbcb5('0x22')](function(_0x56f9c8){if(!_[_0xbcb5('0x1e')](_0x56f9c8)){throw new Error(_0xbcb5('0x27')+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x2f')+_0x2fc99f['id']);}return _0xa20316['CmHopperFinal']['findOne']({'where':{'calleridnum':_0x12a15a[_0xbcb5('0x28')],'VoiceQueueId':_0x2fc99f['id']}});})[_0xbcb5('0x22')](function(_0x3fe379){if(!_[_0xbcb5('0x1e')](_0x3fe379)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x30')+_0x2fc99f['id']);}return _0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'priority':_0x12a15a['priority']?_0x12a15a['priority']:0x2,'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a[_0xbcb5('0x1b')]:moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a[_0xbcb5('0x2d')]?_0x12a15a['callbackUniqueid']:undefined,'callbackat':_0x12a15a['callbackUniqueid']?moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x2fc99f['id']});})[_0xbcb5('0x2e')](function(_0x3c5ae3){_0x54041c(_0x3c5ae3);});});});};function _0x907ed5(){return function(_0x53f20b){logger[_0xbcb5('0x17')](_0xbcb5('0x18'),_0xbcb5('0x19'),util['inspect'](_0x53f20b,{'showHidden':![],'depth':null}));};}function _0x3f346a(_0x40d9b5,_0x225d41){var _0x350699=_0x225d41[_0xbcb5('0x1b')]?_0x225d41['scheduledat']:moment()[_0xbcb5('0x1c')](_0xbcb5('0x1d'));return new BPromise(function(_0x3f46d6,_0x22be2f){if(_['isNil'](_0x225d41[_0xbcb5('0x1f')])){_0x3f46d6({'ret':_0x350699});}else{_0xa20316['Campaign'][_0xbcb5('0x21')]({'where':{'id':_0x40d9b5['id']}})[_0xbcb5('0x22')](function(_0x5b6c5d){if(!_[_0xbcb5('0x1e')](_0x5b6c5d)){var _0x38dff8=_0x5b6c5d[_0xbcb5('0x1f')];if(!_[_0xbcb5('0x1e')](_0x38dff8)){var _0x39637f=shared[_0xbcb5('0x23')];var _0x22859d=_0x39637f[_0x38dff8];var _0x48cca9=_0x39637f[_0x225d41[_0xbcb5('0x1f')]];if(!_[_0xbcb5('0x1e')](_0x22859d)&&!_[_0xbcb5('0x1e')](_0x48cca9)){var _0x4e8627=_0x22859d[_0xbcb5('0x24')]-_0x48cca9['utcOffset'];_0x350699=_0x225d41[_0xbcb5('0x1b')]?_0x225d41['scheduledat']:moment();var _0x3ef4d7=moment(_0x350699)[_0xbcb5('0x32')](_0x4e8627,_0xbcb5('0x25'));_0x3f46d6({'ret':_0x3ef4d7[_0xbcb5('0x1c')](_0xbcb5('0x1d'))});}else _0x3f46d6({'ret':_0x350699});}else _0x3f46d6({'ret':_0x350699});}else{_0x3f46d6({'ret':_0x350699});}});}});return 0xa;}var _0x451687=function(_0x4e9447){return new BPromise(function(_0x1f746d,_0x277ba7){_0x3f346a(_0x4e9447,_0x12a15a)[_0xbcb5('0x22')](function(_0x370b9c){_0x12a15a['scheduledat']=_0x370b9c[_0xbcb5('0x26')];_0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x21')]({'where':{'phone':_0x12a15a[_0xbcb5('0x28')],'CampaignId':_0x4e9447['id']}})[_0xbcb5('0x22')](function(_0x5d4d04){if(!_[_0xbcb5('0x1e')](_0x5d4d04)){throw new Error(_0xbcb5('0x27')+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x33')+_0x4e9447['id']);}return _0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'priority':_0x12a15a[_0xbcb5('0x2c')]?_0x12a15a[_0xbcb5('0x2c')]:0x2,'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a[_0xbcb5('0x1b')]:moment()['format'](_0xbcb5('0x1d')),'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a['callbackUniqueid']?_0x12a15a[_0xbcb5('0x2d')]:undefined,'callbackat':_0x12a15a[_0xbcb5('0x2d')]?moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4e9447['id']});})[_0xbcb5('0x2e')](function(_0xf5865c){_0x277ba7(_0xf5865c);});});});};var _0x5de481=function(_0x4a74f3){return new BPromise(function(_0x4df068,_0x4e63da){_0x3f346a(_0x4a74f3,_0x12a15a)['then'](function(_0x1c3aaa){_0x12a15a['scheduledat']=_0x1c3aaa[_0xbcb5('0x26')];_0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x21')]({'where':{'phone':_0x12a15a['phone'],'CampaignId':_0x4a74f3['id']}})[_0xbcb5('0x22')](function(_0x22a3ac){if(!_[_0xbcb5('0x1e')](_0x22a3ac)){throw new Error(_0xbcb5('0x27')+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x34')+_0x4a74f3['id']);}return _0xa20316[_0xbcb5('0x35')][_0xbcb5('0x21')]({'where':{'calleridnum':_0x12a15a[_0xbcb5('0x28')],'CampaignId':_0x4a74f3['id']}});})[_0xbcb5('0x22')](function(_0x458df8){if(!_[_0xbcb5('0x1e')](_0x458df8)){throw new Error(_0xbcb5('0x36')+_0x12a15a[_0xbcb5('0x28')]+_0xbcb5('0x37')+_0x4a74f3['id']);}return _0xa20316['CmHopper']['create']({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'priority':_0x12a15a['priority']?_0x12a15a[_0xbcb5('0x2c')]:0x2,'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a[_0xbcb5('0x1b')]:moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a['callbackUniqueid']?_0x12a15a[_0xbcb5('0x2d')]:undefined,'callbackat':_0x12a15a['callbackUniqueid']?moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4a74f3['id']});})['catch'](function(_0x2cfd15){_0x4e63da(_0x2cfd15);});});});};if(_0x12a15a['ListId']){_0xa20316[_0xbcb5('0x20')]['findAll']({'where':{'type':_0xbcb5('0x38')},'attributes':['id',_0xbcb5('0x39'),_0xbcb5('0x1f')],'include':[{'model':_0xa20316[_0xbcb5('0x3a')],'as':_0xbcb5('0x3b'),'where':{'id':_0x12a15a[_0xbcb5('0x31')]}}]})['then'](function(_0x41f932){if(_0x41f932){var _0x446b28=[];for(var _0x5d783b=0x0,_0x5f11e0;_0x5d783b<_0x41f932[_0xbcb5('0x3c')];_0x5d783b+=0x1){_0x5f11e0=_0x41f932[_0x5d783b][_0xbcb5('0x16')]({'plain':!![]});switch(_0x5f11e0[_0xbcb5('0x39')]){case _0xbcb5('0x3d'):_0x2ea415(_0x5f11e0)[_0xbcb5('0x2e')](_0x36b95e());break;case _0xbcb5('0x3e'):_0x2823bb(_0x5f11e0)[_0xbcb5('0x2e')](_0x36b95e());break;default:_0x3f346a(_0x5f11e0,_0x12a15a)[_0xbcb5('0x22')](function(_0x1dbfd){_0x12a15a[_0xbcb5('0x1b')]=_0x1dbfd['ret'];_0xa20316['CmHopper'][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a['scheduledat']:moment()['format'](_0xbcb5('0x1d')),'priority':_0x12a15a[_0xbcb5('0x2c')]?_0x12a15a[_0xbcb5('0x2c')]:0x2,'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a['callbackUniqueid']?_0x12a15a[_0xbcb5('0x2d')]:undefined,'callbackat':_0x12a15a[_0xbcb5('0x2d')]?moment()['format'](_0xbcb5('0x1d')):undefined,'VoiceQueueId':_0x5f11e0['id']})['catch'](_0x36b95e());});}}}})[_0xbcb5('0x22')](function(){return _0xa20316[_0xbcb5('0x20')]['findAll']({'where':{'type':_0xbcb5('0x38')},'attributes':['id'],'include':[{'model':_0xa20316[_0xbcb5('0x3a')],'as':_0xbcb5('0x3f'),'where':{'id':_0x12a15a[_0xbcb5('0x31')]}}]})[_0xbcb5('0x22')](function(_0x4b2f07){if(_0x4b2f07){var _0x59acf2=[];for(var _0x1af2dd=0x0,_0x202676;_0x1af2dd<_0x4b2f07['length'];_0x1af2dd+=0x1){_0x202676=_0x4b2f07[_0x1af2dd][_0xbcb5('0x16')]({'plain':!![]});_0xa20316[_0xbcb5('0x40')][_0xbcb5('0x2b')]({'phone':_0x12a15a['phone'],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'VoiceQueueId':_0x202676['id']})[_0xbcb5('0x2e')](function(_0x41d056){logger['error'](_0xbcb5('0x41'),_0xbcb5('0x19'),_0x41d056[_0xbcb5('0x42')]);});}}});})[_0xbcb5('0x22')](function(){return _0xa20316[_0xbcb5('0x43')]['findAll']({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0xa20316[_0xbcb5('0x3a')],'as':_0xbcb5('0x3b'),'where':{'id':_0x12a15a[_0xbcb5('0x31')]}}]})[_0xbcb5('0x22')](function(_0x1ba5dc){if(_0x1ba5dc){var _0x153123=[];for(var _0x3e11cc=0x0,_0x1654c9;_0x3e11cc<_0x1ba5dc[_0xbcb5('0x3c')];_0x3e11cc+=0x1){_0x1654c9=_0x1ba5dc[_0x3e11cc][_0xbcb5('0x16')]({'plain':!![]});switch(_0x1654c9[_0xbcb5('0x39')]){case _0xbcb5('0x3d'):_0x5de481(_0x1654c9)[_0xbcb5('0x2e')](_0x907ed5());break;case _0xbcb5('0x3e'):_0x451687(_0x1654c9)[_0xbcb5('0x2e')](_0x907ed5());break;default:_0xa20316[_0xbcb5('0x2a')][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'scheduledat':_0x12a15a[_0xbcb5('0x1b')]?_0x12a15a['scheduledat']:moment()[_0xbcb5('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x12a15a[_0xbcb5('0x2c')]?_0x12a15a[_0xbcb5('0x2c')]:0x2,'callback':_0x12a15a[_0xbcb5('0x2d')]?!![]:![],'callbackuniqueid':_0x12a15a[_0xbcb5('0x2d')]?_0x12a15a[_0xbcb5('0x2d')]:undefined,'callbackat':_0x12a15a[_0xbcb5('0x2d')]?moment()[_0xbcb5('0x1c')](_0xbcb5('0x1d')):undefined,'CampaignId':_0x1654c9['id']})['catch'](_0x907ed5());}}}});})['then'](function(){return _0xa20316[_0xbcb5('0x43')][_0xbcb5('0x44')]({'attributes':['id'],'include':[{'model':_0xa20316['CmList'],'as':'BlackLists','where':{'id':_0x12a15a[_0xbcb5('0x31')]}}]})[_0xbcb5('0x22')](function(_0x47bc16){if(_0x47bc16){var _0xecd136=[];for(var _0x32483e=0x0,_0x4565fe;_0x32483e<_0x47bc16[_0xbcb5('0x3c')];_0x32483e+=0x1){_0x4565fe=_0x47bc16[_0x32483e][_0xbcb5('0x16')]({'plain':!![]});_0xa20316[_0xbcb5('0x40')][_0xbcb5('0x2b')]({'phone':_0x12a15a[_0xbcb5('0x28')],'ContactId':_0x12a15a['id'],'ListId':_0x12a15a[_0xbcb5('0x31')],'CampaignId':_0x4565fe['id']})['catch'](function(_0xb30821){logger[_0xbcb5('0x17')]('cmContact,\x20%s,\x20%s',_0xbcb5('0x19'),_0xb30821[_0xbcb5('0x42')]);});}}});})[_0xbcb5('0x22')](function(){_0x4db4bc();})[_0xbcb5('0x2e')](function(_0x463b78){logger[_0xbcb5('0x17')](_0xbcb5('0x41'),_0xbcb5('0x19'),_0x463b78[_0xbcb5('0x42')]);_0x4db4bc(_0x463b78);});}else{_0x4db4bc(new Error('List\x20not\x20found'));}},'afterDestroy':function(_0x411a83,_0x32acdf,_0x28bf96){var _0x32ab2b=_0x51d4f0[_0xbcb5('0x15')];var _0x5e6c14=_0x411a83['get']({'plain':!![]});return _0x32ab2b['CmHopper'][_0xbcb5('0x44')]({'raw':!![],'where':{'ListId':_0x5e6c14[_0xbcb5('0x31')],'ContactId':_0x5e6c14['id']}})[_0xbcb5('0x22')](function(_0x539689){if(!_[_0xbcb5('0x45')](_0x539689)){var _0x3bbee3=[];for(var _0x5f00c7=0x0;_0x5f00c7<_0x539689[_0xbcb5('0x3c')];_0x5f00c7+=0x1){var _0x537b20=_0x32ab2b[_0xbcb5('0x2a')][_0xbcb5('0x46')]({'where':{'ListId':_0x539689[_0x5f00c7][_0xbcb5('0x31')],'ContactId':_0x539689[_0x5f00c7][_0xbcb5('0x47')],'VoiceQueueId':_0x539689[_0x5f00c7][_0xbcb5('0x48')],'CampaignId':_0x539689[_0x5f00c7]['CampaignId']}});_0x3bbee3['push'](_0x537b20);}return BPromise['all'](_0x3bbee3);}})[_0xbcb5('0x22')](function(_0x27acd){logger['info'](_0xbcb5('0x49'),util[_0xbcb5('0x1a')](_0x27acd,{'showHidden':![],'depth':null}));_0x28bf96();})['catch'](function(_0x37b197){logger['error']('[CmContact][afterDestroy][Error]',util[_0xbcb5('0x1a')](_0x37b197,{'showHidden':![],'depth':null}));_0x28bf96(_0x37b197);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 4bef711..f5bf823 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 _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\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(_0x3af07d,_0x5d73af){var _0x22282d=function(_0x402161){while(--_0x402161){_0x3af07d['push'](_0x3af07d['shift']());}};_0x22282d(++_0x5d73af);}(_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['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 972494a..d2096b1 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 _0xb43b=['INTEGER','STRING','PHONE','sequelize'];(function(_0x186591,_0x41385c){var _0x54d42d=function(_0x50e4f9){while(--_0x50e4f9){_0x186591['push'](_0x186591['shift']());}};_0x54d42d(++_0x41385c);}(_0xb43b,0xbf));var _0xbb43=function(_0x12b72c,_0x3bd498){_0x12b72c=_0x12b72c-0x0;var _0x76f65c=_0xb43b[_0x12b72c];return _0x76f65c;};'use strict';var Sequelize=require(_0xbb43('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xbb43('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':_0xbb43('0x3')},'OrderBy':{'type':Sequelize[_0xbb43('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xbb43('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x2bbb=['PHONE','exports','INTEGER','STRING'];(function(_0x4d4e98,_0x4455d1){var _0x1063f9=function(_0x473462){while(--_0x473462){_0x4d4e98['push'](_0x4d4e98['shift']());}};_0x1063f9(++_0x4455d1);}(_0x2bbb,0x85));var _0xb2bb=function(_0x3190a,_0x5b1e45){_0x3190a=_0x3190a-0x0;var _0x3f2ce0=_0x2bbb[_0x3190a];return _0x3f2ce0;};'use strict';var Sequelize=require('sequelize');module[_0xb2bb('0x0')]={'CmContactId':{'type':Sequelize[_0xb2bb('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xb2bb('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xb2bb('0x2')],'defaultValue':_0xb2bb('0x3')},'OrderBy':{'type':Sequelize[_0xb2bb('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xb2bb('0x2')],'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 dbf87fb..63664aa 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 _0x9fc1=['UserProfileResource','end','error','name','send','index','CmContactHasItem','fieldName','key','model','map','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','rawAttributes','filters','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','update','destroy','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','apply','then','get','CmContactHasItems'];(function(_0x51d165,_0x32ec7e){var _0x4a8f42=function(_0x191f93){while(--_0x191f93){_0x51d165['push'](_0x51d165['shift']());}};_0x4a8f42(++_0x32ec7e);}(_0x9fc1,0xd2));var _0x19fc=function(_0x45f0db,_0x5bbb3c){_0x45f0db=_0x45f0db-0x0;var _0x1f820a=_0x9fc1[_0x45f0db];return _0x1f820a;};'use strict';var emlformat=require(_0x19fc('0x0'));var rimraf=require(_0x19fc('0x1'));var zipdir=require(_0x19fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19fc('0x3'));var moment=require(_0x19fc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x19fc('0x5'));var util=require(_0x19fc('0x6'));var path=require(_0x19fc('0x7'));var sox=require(_0x19fc('0x8'));var csv=require('to-csv');var ejs=require(_0x19fc('0x9'));var fs=require('fs');var fs_extra=require(_0x19fc('0xa'));var _=require(_0x19fc('0xb'));var squel=require(_0x19fc('0xc'));var crypto=require(_0x19fc('0xd'));var jsforce=require(_0x19fc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x19fc('0xf'));var querystring=require(_0x19fc('0x10'));var Papa=require(_0x19fc('0x11'));var Redis=require(_0x19fc('0x12'));var authService=require(_0x19fc('0x13'));var qs=require(_0x19fc('0x14'));var as=require(_0x19fc('0x15'));var hardwareService=require(_0x19fc('0x16'));var logger=require(_0x19fc('0x17'))(_0x19fc('0x18'));var utils=require(_0x19fc('0x19'));var config=require(_0x19fc('0x1a'));var licenseUtil=require(_0x19fc('0x1b'));var db=require(_0x19fc('0x1c'))['db'];function respondWithStatusCode(_0x36e431,_0xa9ad87){_0xa9ad87=_0xa9ad87||0xcc;return function(_0x5c6989){if(_0x5c6989){return _0x36e431[_0x19fc('0x1d')](_0xa9ad87);}return _0x36e431['status'](_0xa9ad87)['end']();};}function respondWithResult(_0x11f635,_0x136c9c){_0x136c9c=_0x136c9c||0xc8;return function(_0x24c8f2){if(_0x24c8f2){return _0x11f635[_0x19fc('0x1e')](_0x136c9c)[_0x19fc('0x1f')](_0x24c8f2);}};}function respondWithFilteredResult(_0x144572,_0x4f91aa){return function(_0x5b7344){if(_0x5b7344){var _0x22be5a=typeof _0x4f91aa[_0x19fc('0x20')]==='undefined'&&typeof _0x4f91aa[_0x19fc('0x21')]==='undefined';var _0x4ab80d=_0x5b7344[_0x19fc('0x22')];var _0x2d9cee=_0x22be5a?0x0:_0x4f91aa[_0x19fc('0x20')];var _0x3ec1ed=_0x22be5a?_0x5b7344[_0x19fc('0x22')]:_0x4f91aa[_0x19fc('0x20')]+_0x4f91aa[_0x19fc('0x21')];var _0x4c29ba;if(_0x3ec1ed>=_0x4ab80d){_0x3ec1ed=_0x4ab80d;_0x4c29ba=0xc8;}else{_0x4c29ba=0xce;}_0x144572[_0x19fc('0x1e')](_0x4c29ba);return _0x144572['set']('Content-Range',_0x2d9cee+'-'+_0x3ec1ed+'/'+_0x4ab80d)[_0x19fc('0x1f')](_0x5b7344);}return null;};}function patchUpdates(_0x3288fc){return function(_0x26cadf){try{jsonpatch[_0x19fc('0x23')](_0x26cadf,_0x3288fc,!![]);}catch(_0x101e1c){return BPromise['reject'](_0x101e1c);}return _0x26cadf['save']();};}function saveUpdates(_0x489286,_0x12b946){return function(_0x2f0a01){if(_0x2f0a01){return _0x2f0a01['update'](_0x489286)[_0x19fc('0x24')](function(_0xfffa70){return _0xfffa70;});}return null;};}function removeEntity(_0x258e65,_0x5c4509){return function(_0x1fa1c7){if(_0x1fa1c7){return _0x1fa1c7['destroy']()[_0x19fc('0x24')](function(){var _0x5b4448=_0x1fa1c7[_0x19fc('0x25')]({'plain':!![]});var _0x223003=_0x19fc('0x26');return db[_0x19fc('0x27')]['destroy']({'where':{'type':_0x223003,'resourceId':_0x5b4448['id']}})[_0x19fc('0x24')](function(){return _0x1fa1c7;});})[_0x19fc('0x24')](function(){_0x258e65[_0x19fc('0x1e')](0xcc)[_0x19fc('0x28')]();});}};}function handleEntityNotFound(_0x18fdec,_0x33ddda){return function(_0x773f05){if(!_0x773f05){_0x18fdec['sendStatus'](0x194);}return _0x773f05;};}function handleError(_0x5bf802,_0x559ac4){_0x559ac4=_0x559ac4||0x1f4;return function(_0x3b9089){logger[_0x19fc('0x29')](_0x3b9089['stack']);if(_0x3b9089[_0x19fc('0x2a')]){delete _0x3b9089[_0x19fc('0x2a')];}_0x5bf802[_0x19fc('0x1e')](_0x559ac4)[_0x19fc('0x2b')](_0x3b9089);};}exports[_0x19fc('0x2c')]=function(_0x177254,_0xb0e629){var _0x589c5e={},_0x34ebe0={},_0xea4a22={'count':0x0,'rows':[]};var _0x2eeb76=_['map'](db[_0x19fc('0x2d')]['rawAttributes'],function(_0x330231){return{'name':_0x330231[_0x19fc('0x2e')],'type':_0x330231['type'][_0x19fc('0x2f')]};});_0x34ebe0[_0x19fc('0x30')]=_[_0x19fc('0x31')](_0x2eeb76,_0x19fc('0x2a'));_0x34ebe0['query']=_['keys'](_0x177254[_0x19fc('0x32')]);_0x34ebe0['filters']=_[_0x19fc('0x33')](_0x34ebe0[_0x19fc('0x30')],_0x34ebe0['query']);_0x589c5e['attributes']=_[_0x19fc('0x33')](_0x34ebe0[_0x19fc('0x30')],qs[_0x19fc('0x34')](_0x177254[_0x19fc('0x32')][_0x19fc('0x34')]));_0x589c5e[_0x19fc('0x35')]=_0x589c5e[_0x19fc('0x35')]['length']?_0x589c5e['attributes']:_0x34ebe0[_0x19fc('0x30')];if(!_0x177254['query'][_0x19fc('0x36')](_0x19fc('0x37'))){_0x589c5e[_0x19fc('0x21')]=qs[_0x19fc('0x21')](_0x177254[_0x19fc('0x32')]['limit']);_0x589c5e[_0x19fc('0x20')]=qs[_0x19fc('0x20')](_0x177254[_0x19fc('0x32')][_0x19fc('0x20')]);}_0x589c5e[_0x19fc('0x38')]=qs[_0x19fc('0x39')](_0x177254[_0x19fc('0x32')]['sort']);_0x589c5e[_0x19fc('0x3a')]=qs['filters'](_[_0x19fc('0x3b')](_0x177254[_0x19fc('0x32')],_0x34ebe0['filters']),_0x2eeb76);if(_0x177254[_0x19fc('0x32')]['filter']){_0x589c5e[_0x19fc('0x3a')]=_[_0x19fc('0x3c')](_0x589c5e['where'],{'$or':_['map'](_0x2eeb76,function(_0x5635af){if(_0x5635af['type']!==_0x19fc('0x3d')){var _0x5b416c={};_0x5b416c[_0x5635af['name']]={'$like':'%'+_0x177254[_0x19fc('0x32')]['filter']+'%'};return _0x5b416c;}})});}_0x589c5e=_[_0x19fc('0x3c')]({},_0x589c5e,_0x177254['options']);var _0x43c5a5={'where':_0x589c5e[_0x19fc('0x3a')]};return db[_0x19fc('0x2d')][_0x19fc('0x22')](_0x43c5a5)[_0x19fc('0x24')](function(_0x402cf1){_0xea4a22[_0x19fc('0x22')]=_0x402cf1;if(_0x177254[_0x19fc('0x32')][_0x19fc('0x3e')]){_0x589c5e[_0x19fc('0x3f')]=[{'all':!![]}];}return db[_0x19fc('0x2d')]['findAll'](_0x589c5e);})[_0x19fc('0x24')](function(_0x5dfbc7){_0xea4a22[_0x19fc('0x40')]=_0x5dfbc7;return _0xea4a22;})[_0x19fc('0x24')](respondWithFilteredResult(_0xb0e629,_0x589c5e))[_0x19fc('0x41')](handleError(_0xb0e629,null));};exports['show']=function(_0xa266f,_0x3b8f81){var _0x11b51d={'raw':!![],'where':{'id':_0xa266f[_0x19fc('0x42')]['id']}},_0x46b654={};_0x46b654['model']=_[_0x19fc('0x43')](db[_0x19fc('0x2d')][_0x19fc('0x44')]);_0x46b654[_0x19fc('0x32')]=_['keys'](_0xa266f[_0x19fc('0x32')]);_0x46b654[_0x19fc('0x45')]=_[_0x19fc('0x33')](_0x46b654['model'],_0x46b654['query']);_0x11b51d['attributes']=_[_0x19fc('0x33')](_0x46b654[_0x19fc('0x30')],qs[_0x19fc('0x34')](_0xa266f[_0x19fc('0x32')][_0x19fc('0x34')]));_0x11b51d[_0x19fc('0x35')]=_0x11b51d[_0x19fc('0x35')]['length']?_0x11b51d[_0x19fc('0x35')]:_0x46b654[_0x19fc('0x30')];if(_0xa266f['query'][_0x19fc('0x3e')]){_0x11b51d[_0x19fc('0x3f')]=[{'all':!![]}];}_0x11b51d=_[_0x19fc('0x3c')]({},_0x11b51d,_0xa266f[_0x19fc('0x46')]);return db[_0x19fc('0x2d')][_0x19fc('0x47')](_0x11b51d)[_0x19fc('0x24')](handleEntityNotFound(_0x3b8f81,null))[_0x19fc('0x24')](respondWithResult(_0x3b8f81,null))[_0x19fc('0x41')](handleError(_0x3b8f81,null));};exports[_0x19fc('0x48')]=function(_0x5a74ce,_0x5b64c9){return db[_0x19fc('0x2d')][_0x19fc('0x48')](_0x5a74ce[_0x19fc('0x49')],{})['then'](function(_0x1f41f0){var _0x581a9f=_0x5a74ce[_0x19fc('0x4a')][_0x19fc('0x25')]({'plain':!![]});if(!_0x581a9f)throw new Error(_0x19fc('0x4b'));if(_0x581a9f[_0x19fc('0x4c')]===_0x19fc('0x4a')){var _0x4423ef=_0x1f41f0['get']({'plain':!![]});var _0x2b9f13=_0x19fc('0x26');return db[_0x19fc('0x4d')][_0x19fc('0x47')]({'where':{'name':_0x2b9f13,'userProfileId':_0x581a9f[_0x19fc('0x4e')]},'raw':!![]})[_0x19fc('0x24')](function(_0x547304){if(_0x547304&&_0x547304[_0x19fc('0x4f')]===0x0){return db[_0x19fc('0x27')][_0x19fc('0x48')]({'name':_0x4423ef[_0x19fc('0x2a')],'resourceId':_0x4423ef['id'],'type':_0x547304['name'],'sectionId':_0x547304['id']},{})[_0x19fc('0x24')](function(){return _0x1f41f0;});}else{return _0x1f41f0;}})['catch'](function(_0xce328d){logger[_0x19fc('0x29')](_0x19fc('0x50'),_0xce328d);throw _0xce328d;});}return _0x1f41f0;})[_0x19fc('0x24')](respondWithResult(_0x5b64c9,0xc9))[_0x19fc('0x41')](handleError(_0x5b64c9,null));};exports[_0x19fc('0x51')]=function(_0x5defb3,_0x42a67f){if(_0x5defb3[_0x19fc('0x49')]['id']){delete _0x5defb3['body']['id'];}return db[_0x19fc('0x2d')][_0x19fc('0x47')]({'where':{'id':_0x5defb3[_0x19fc('0x42')]['id']}})[_0x19fc('0x24')](handleEntityNotFound(_0x42a67f,null))[_0x19fc('0x24')](saveUpdates(_0x5defb3[_0x19fc('0x49')],null))[_0x19fc('0x24')](respondWithResult(_0x42a67f,null))[_0x19fc('0x41')](handleError(_0x42a67f,null));};exports[_0x19fc('0x52')]=function(_0x55b924,_0x2ad749){return db[_0x19fc('0x2d')][_0x19fc('0x47')]({'where':{'id':_0x55b924[_0x19fc('0x42')]['id']}})[_0x19fc('0x24')](handleEntityNotFound(_0x2ad749,null))['then'](removeEntity(_0x2ad749,null))[_0x19fc('0x41')](handleError(_0x2ad749,null));}; \ No newline at end of file +var _0xa91d=['filters','intersection','fields','attributes','length','sort','filter','where','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','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','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','json','apply','save','update','then','destroy','get','UserProfileResource','error','name','index','CmContactHasItem','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0xd9a55e,_0x3841a7){var _0x1345b1=function(_0x47662b){while(--_0x47662b){_0xd9a55e['push'](_0xd9a55e['shift']());}};_0x1345b1(++_0x3841a7);}(_0xa91d,0x69));var _0xda91=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa91d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda91('0x0'));var zipdir=require(_0xda91('0x1'));var jsonpatch=require(_0xda91('0x2'));var rp=require(_0xda91('0x3'));var moment=require(_0xda91('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xda91('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xda91('0x6'));var fs=require('fs');var fs_extra=require(_0xda91('0x7'));var _=require(_0xda91('0x8'));var squel=require('squel');var crypto=require(_0xda91('0x9'));var jsforce=require(_0xda91('0xa'));var deskjs=require(_0xda91('0xb'));var toCsv=require(_0xda91('0xc'));var querystring=require(_0xda91('0xd'));var Papa=require(_0xda91('0xe'));var Redis=require('ioredis');var authService=require(_0xda91('0xf'));var qs=require(_0xda91('0x10'));var as=require(_0xda91('0x11'));var hardwareService=require(_0xda91('0x12'));var logger=require(_0xda91('0x13'))(_0xda91('0x14'));var utils=require('../../config/utils');var config=require(_0xda91('0x15'));var licenseUtil=require(_0xda91('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ff8a8,_0x31b1b8){_0x31b1b8=_0x31b1b8||0xcc;return function(_0x2b3aa9){if(_0x2b3aa9){return _0x3ff8a8[_0xda91('0x17')](_0x31b1b8);}return _0x3ff8a8[_0xda91('0x18')](_0x31b1b8)[_0xda91('0x19')]();};}function respondWithResult(_0x5366fa,_0x1042fb){_0x1042fb=_0x1042fb||0xc8;return function(_0x3b0b1b){if(_0x3b0b1b){return _0x5366fa['status'](_0x1042fb)['json'](_0x3b0b1b);}};}function respondWithFilteredResult(_0x13b811,_0x49f5df){return function(_0x13fc83){if(_0x13fc83){var _0x2490f2=typeof _0x49f5df[_0xda91('0x1a')]===_0xda91('0x1b')&&typeof _0x49f5df['limit']===_0xda91('0x1b');var _0x1a9486=_0x13fc83['count'];var _0x5b7088=_0x2490f2?0x0:_0x49f5df[_0xda91('0x1a')];var _0xc2ae77=_0x2490f2?_0x13fc83[_0xda91('0x1c')]:_0x49f5df['offset']+_0x49f5df[_0xda91('0x1d')];var _0x4b5548;if(_0xc2ae77>=_0x1a9486){_0xc2ae77=_0x1a9486;_0x4b5548=0xc8;}else{_0x4b5548=0xce;}_0x13b811[_0xda91('0x18')](_0x4b5548);return _0x13b811['set'](_0xda91('0x1e'),_0x5b7088+'-'+_0xc2ae77+'/'+_0x1a9486)[_0xda91('0x1f')](_0x13fc83);}return null;};}function patchUpdates(_0x78dd91){return function(_0x5642d4){try{jsonpatch[_0xda91('0x20')](_0x5642d4,_0x78dd91,!![]);}catch(_0x3422f2){return BPromise['reject'](_0x3422f2);}return _0x5642d4[_0xda91('0x21')]();};}function saveUpdates(_0x21783a,_0x181b92){return function(_0x274df5){if(_0x274df5){return _0x274df5[_0xda91('0x22')](_0x21783a)[_0xda91('0x23')](function(_0x315784){return _0x315784;});}return null;};}function removeEntity(_0x58e008,_0x3d2c59){return function(_0x1c3e3f){if(_0x1c3e3f){return _0x1c3e3f[_0xda91('0x24')]()[_0xda91('0x23')](function(){var _0x4899fb=_0x1c3e3f[_0xda91('0x25')]({'plain':!![]});var _0x58e11d='CmContactHasItems';return db[_0xda91('0x26')][_0xda91('0x24')]({'where':{'type':_0x58e11d,'resourceId':_0x4899fb['id']}})[_0xda91('0x23')](function(){return _0x1c3e3f;});})[_0xda91('0x23')](function(){_0x58e008[_0xda91('0x18')](0xcc)[_0xda91('0x19')]();});}};}function handleEntityNotFound(_0x9e8838,_0xabbce6){return function(_0x2fd5a4){if(!_0x2fd5a4){_0x9e8838[_0xda91('0x17')](0x194);}return _0x2fd5a4;};}function handleError(_0x222a24,_0x4e3b54){_0x4e3b54=_0x4e3b54||0x1f4;return function(_0x3ccd14){logger[_0xda91('0x27')](_0x3ccd14['stack']);if(_0x3ccd14[_0xda91('0x28')]){delete _0x3ccd14[_0xda91('0x28')];}_0x222a24[_0xda91('0x18')](_0x4e3b54)['send'](_0x3ccd14);};}exports[_0xda91('0x29')]=function(_0x201224,_0x26f924){var _0x36cea6={},_0x5aa0e2={},_0x86e09f={'count':0x0,'rows':[]};var _0x10142c=_['map'](db[_0xda91('0x2a')][_0xda91('0x2b')],function(_0x55ef8a){return{'name':_0x55ef8a[_0xda91('0x2c')],'type':_0x55ef8a[_0xda91('0x2d')][_0xda91('0x2e')]};});_0x5aa0e2[_0xda91('0x2f')]=_[_0xda91('0x30')](_0x10142c,_0xda91('0x28'));_0x5aa0e2[_0xda91('0x31')]=_[_0xda91('0x32')](_0x201224[_0xda91('0x31')]);_0x5aa0e2[_0xda91('0x33')]=_[_0xda91('0x34')](_0x5aa0e2[_0xda91('0x2f')],_0x5aa0e2[_0xda91('0x31')]);_0x36cea6['attributes']=_[_0xda91('0x34')](_0x5aa0e2[_0xda91('0x2f')],qs[_0xda91('0x35')](_0x201224[_0xda91('0x31')][_0xda91('0x35')]));_0x36cea6[_0xda91('0x36')]=_0x36cea6[_0xda91('0x36')][_0xda91('0x37')]?_0x36cea6[_0xda91('0x36')]:_0x5aa0e2['model'];if(!_0x201224[_0xda91('0x31')]['hasOwnProperty']('nolimit')){_0x36cea6[_0xda91('0x1d')]=qs[_0xda91('0x1d')](_0x201224['query'][_0xda91('0x1d')]);_0x36cea6[_0xda91('0x1a')]=qs[_0xda91('0x1a')](_0x201224[_0xda91('0x31')][_0xda91('0x1a')]);}_0x36cea6['order']=qs[_0xda91('0x38')](_0x201224[_0xda91('0x31')][_0xda91('0x38')]);_0x36cea6['where']=qs[_0xda91('0x33')](_['pick'](_0x201224[_0xda91('0x31')],_0x5aa0e2[_0xda91('0x33')]),_0x10142c);if(_0x201224[_0xda91('0x31')][_0xda91('0x39')]){_0x36cea6[_0xda91('0x3a')]=_[_0xda91('0x3b')](_0x36cea6[_0xda91('0x3a')],{'$or':_[_0xda91('0x30')](_0x10142c,function(_0xf3e026){if(_0xf3e026[_0xda91('0x2d')]!=='VIRTUAL'){var _0x35595e={};_0x35595e[_0xf3e026[_0xda91('0x28')]]={'$like':'%'+_0x201224[_0xda91('0x31')][_0xda91('0x39')]+'%'};return _0x35595e;}})});}_0x36cea6=_[_0xda91('0x3b')]({},_0x36cea6,_0x201224[_0xda91('0x3c')]);var _0x1d3b6f={'where':_0x36cea6[_0xda91('0x3a')]};return db[_0xda91('0x2a')][_0xda91('0x1c')](_0x1d3b6f)[_0xda91('0x23')](function(_0x49fe37){_0x86e09f['count']=_0x49fe37;if(_0x201224['query'][_0xda91('0x3d')]){_0x36cea6[_0xda91('0x3e')]=[{'all':!![]}];}return db['CmContactHasItem'][_0xda91('0x3f')](_0x36cea6);})[_0xda91('0x23')](function(_0xd491fe){_0x86e09f[_0xda91('0x40')]=_0xd491fe;return _0x86e09f;})[_0xda91('0x23')](respondWithFilteredResult(_0x26f924,_0x36cea6))[_0xda91('0x41')](handleError(_0x26f924,null));};exports['show']=function(_0x3410c4,_0x22d8de){var _0x3063ed={'raw':!![],'where':{'id':_0x3410c4['params']['id']}},_0x1fe39c={};_0x1fe39c['model']=_[_0xda91('0x32')](db[_0xda91('0x2a')]['rawAttributes']);_0x1fe39c[_0xda91('0x31')]=_[_0xda91('0x32')](_0x3410c4[_0xda91('0x31')]);_0x1fe39c[_0xda91('0x33')]=_[_0xda91('0x34')](_0x1fe39c[_0xda91('0x2f')],_0x1fe39c['query']);_0x3063ed[_0xda91('0x36')]=_[_0xda91('0x34')](_0x1fe39c[_0xda91('0x2f')],qs[_0xda91('0x35')](_0x3410c4[_0xda91('0x31')]['fields']));_0x3063ed['attributes']=_0x3063ed[_0xda91('0x36')][_0xda91('0x37')]?_0x3063ed[_0xda91('0x36')]:_0x1fe39c[_0xda91('0x2f')];if(_0x3410c4[_0xda91('0x31')][_0xda91('0x3d')]){_0x3063ed[_0xda91('0x3e')]=[{'all':!![]}];}_0x3063ed=_[_0xda91('0x3b')]({},_0x3063ed,_0x3410c4[_0xda91('0x3c')]);return db['CmContactHasItem'][_0xda91('0x42')](_0x3063ed)[_0xda91('0x23')](handleEntityNotFound(_0x22d8de,null))[_0xda91('0x23')](respondWithResult(_0x22d8de,null))[_0xda91('0x41')](handleError(_0x22d8de,null));};exports[_0xda91('0x43')]=function(_0xfad63d,_0x2ec88f){return db[_0xda91('0x2a')]['create'](_0xfad63d[_0xda91('0x44')],{})[_0xda91('0x23')](function(_0x5c24fe){var _0x48ae8f=_0xfad63d[_0xda91('0x45')][_0xda91('0x25')]({'plain':!![]});if(!_0x48ae8f)throw new Error(_0xda91('0x46'));if(_0x48ae8f[_0xda91('0x47')]===_0xda91('0x45')){var _0x18d7a8=_0x5c24fe['get']({'plain':!![]});var _0x23fbf3=_0xda91('0x48');return db[_0xda91('0x49')][_0xda91('0x42')]({'where':{'name':_0x23fbf3,'userProfileId':_0x48ae8f[_0xda91('0x4a')]},'raw':!![]})[_0xda91('0x23')](function(_0x5c5f7f){if(_0x5c5f7f&&_0x5c5f7f[_0xda91('0x4b')]===0x0){return db['UserProfileResource'][_0xda91('0x43')]({'name':_0x18d7a8[_0xda91('0x28')],'resourceId':_0x18d7a8['id'],'type':_0x5c5f7f[_0xda91('0x28')],'sectionId':_0x5c5f7f['id']},{})[_0xda91('0x23')](function(){return _0x5c24fe;});}else{return _0x5c24fe;}})[_0xda91('0x41')](function(_0x3f3eb4){logger[_0xda91('0x27')](_0xda91('0x4c'),_0x3f3eb4);throw _0x3f3eb4;});}return _0x5c24fe;})[_0xda91('0x23')](respondWithResult(_0x2ec88f,0xc9))[_0xda91('0x41')](handleError(_0x2ec88f,null));};exports[_0xda91('0x22')]=function(_0x11aad8,_0x32bdcd){if(_0x11aad8[_0xda91('0x44')]['id']){delete _0x11aad8[_0xda91('0x44')]['id'];}return db[_0xda91('0x2a')][_0xda91('0x42')]({'where':{'id':_0x11aad8[_0xda91('0x4d')]['id']}})[_0xda91('0x23')](handleEntityNotFound(_0x32bdcd,null))[_0xda91('0x23')](saveUpdates(_0x11aad8[_0xda91('0x44')],null))['then'](respondWithResult(_0x32bdcd,null))[_0xda91('0x41')](handleError(_0x32bdcd,null));};exports[_0xda91('0x24')]=function(_0x4f8860,_0x478e71){return db[_0xda91('0x2a')][_0xda91('0x42')]({'where':{'id':_0x4f8860['params']['id']}})[_0xda91('0x23')](handleEntityNotFound(_0x478e71,null))[_0xda91('0x23')](removeEntity(_0x478e71,null))[_0xda91('0x41')](handleError(_0x478e71,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 0f43569..2b7fa35 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 _0xa9e9=['define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e9,0x1e7));var _0x9a9e=function(_0x307729,_0x38e7c0){_0x307729=_0x307729-0x0;var _0x26ea8e=_0xa9e9[_0x307729];return _0x26ea8e;};'use strict';var _=require(_0x9a9e('0x0'));var util=require(_0x9a9e('0x1'));var logger=require(_0x9a9e('0x2'))('api');var moment=require(_0x9a9e('0x3'));var BPromise=require(_0x9a9e('0x4'));var rp=require(_0x9a9e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a9e('0x6'));var config=require('../../config/environment');var attributes=require('./cmContactHasItem.attributes');module[_0x9a9e('0x7')]=function(_0x2e2e3b,_0x527f9d){return _0x2e2e3b[_0x9a9e('0x8')](_0x9a9e('0x9'),attributes,{'tableName':_0x9a9e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf05=['CmContactHasItem','cm_contact_has_items','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','define'];(function(_0x3a4e77,_0x3349ba){var _0x35a151=function(_0x3fb70b){while(--_0x3fb70b){_0x3a4e77['push'](_0x3a4e77['shift']());}};_0x35a151(++_0x3349ba);}(_0xcf05,0x1d6));var _0x5cf0=function(_0x5aada6,_0x13266d){_0x5aada6=_0x5aada6-0x0;var _0x4614df=_0xcf05[_0x5aada6];return _0x4614df;};'use strict';var _=require(_0x5cf0('0x0'));var util=require('util');var logger=require(_0x5cf0('0x1'))(_0x5cf0('0x2'));var moment=require(_0x5cf0('0x3'));var BPromise=require(_0x5cf0('0x4'));var rp=require(_0x5cf0('0x5'));var fs=require('fs');var path=require(_0x5cf0('0x6'));var rimraf=require('rimraf');var config=require(_0x5cf0('0x7'));var attributes=require(_0x5cf0('0x8'));module['exports']=function(_0x533bb0,_0x5228da){return _0x533bb0[_0x5cf0('0x9')](_0x5cf0('0xa'),attributes,{'tableName':_0x5cf0('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 8543bd9..d26be4e 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 _0x790a=['then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x357e45,_0x362fe5){var _0x4d5d2a=function(_0x3bf67a){while(--_0x3bf67a){_0x357e45['push'](_0x357e45['shift']());}};_0x4d5d2a(++_0x362fe5);}(_0x790a,0xab));var _0xa790=function(_0x53bcc3,_0x364374){_0x53bcc3=_0x53bcc3-0x0;var _0x47c959=_0x790a[_0x53bcc3];return _0x47c959;};'use strict';var _=require('lodash');var util=require(_0xa790('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa790('0x1'));var fs=require('fs');var Redis=require(_0xa790('0x2'));var db=require(_0xa790('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa790('0x4'))('rpc');var config=require(_0xa790('0x5'));var jayson=require(_0xa790('0x6'));var client=jayson['client'][_0xa790('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54a942,_0x2f1f02,_0x5144ad){return new BPromise(function(_0x24a8fa,_0x4eb694){return client[_0xa790('0x8')](_0x54a942,_0x5144ad)[_0xa790('0x9')](function(_0x4e76d3){logger[_0xa790('0xa')](_0xa790('0xb'),_0x2f1f02,_0xa790('0xc'));logger[_0xa790('0xd')](_0xa790('0xe'),_0x2f1f02,_0xa790('0xc'),JSON[_0xa790('0xf')](_0x4e76d3));if(_0x4e76d3[_0xa790('0x10')]){if(_0x4e76d3[_0xa790('0x10')]['code']===0x1f4){logger[_0xa790('0x10')](_0xa790('0xb'),_0x2f1f02,_0x4e76d3['error'][_0xa790('0x11')]);return _0x4eb694(_0x4e76d3[_0xa790('0x10')][_0xa790('0x11')]);}logger[_0xa790('0x10')](_0xa790('0xb'),_0x2f1f02,_0x4e76d3['error'][_0xa790('0x11')]);return _0x24a8fa(_0x4e76d3[_0xa790('0x10')][_0xa790('0x11')]);}else{logger[_0xa790('0xa')](_0xa790('0xb'),_0x2f1f02,_0xa790('0xc'));_0x24a8fa(_0x4e76d3[_0xa790('0x12')]['message']);}})[_0xa790('0x13')](function(_0x1fffff){logger[_0xa790('0x10')](_0xa790('0xb'),_0x2f1f02,_0x1fffff);_0x4eb694(_0x1fffff);});});} \ No newline at end of file +var _0x5be7=['../../config/environment','jayson/promise','http','then','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','CmContactHasItem,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xd0dff3,_0x13fd28){var _0x3852aa=function(_0x46ed21){while(--_0x46ed21){_0xd0dff3['push'](_0xd0dff3['shift']());}};_0x3852aa(++_0x13fd28);}(_0x5be7,0xdd));var _0x75be=function(_0xbb824c,_0x32aeea){_0xbb824c=_0xbb824c-0x0;var _0x2b5d4c=_0x5be7[_0xbb824c];return _0x2b5d4c;};'use strict';var _=require(_0x75be('0x0'));var util=require(_0x75be('0x1'));var moment=require(_0x75be('0x2'));var BPromise=require(_0x75be('0x3'));var rs=require(_0x75be('0x4'));var fs=require('fs');var Redis=require(_0x75be('0x5'));var db=require(_0x75be('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x75be('0x7'));var jayson=require(_0x75be('0x8'));var client=jayson['client'][_0x75be('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b803a,_0x44f331,_0x11b6f0){return new BPromise(function(_0x57d8fb,_0x1a5f9f){return client['request'](_0x4b803a,_0x11b6f0)[_0x75be('0xa')](function(_0xad5215){logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x44f331,_0x75be('0xb'));logger[_0x75be('0xc')](_0x75be('0xd'),_0x44f331,'request\x20sent',JSON[_0x75be('0xe')](_0xad5215));if(_0xad5215[_0x75be('0xf')]){if(_0xad5215[_0x75be('0xf')]['code']===0x1f4){logger[_0x75be('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x44f331,_0xad5215[_0x75be('0xf')][_0x75be('0x10')]);return _0x1a5f9f(_0xad5215[_0x75be('0xf')][_0x75be('0x10')]);}logger['error'](_0x75be('0x11'),_0x44f331,_0xad5215[_0x75be('0xf')][_0x75be('0x10')]);return _0x57d8fb(_0xad5215[_0x75be('0xf')]['message']);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x44f331,_0x75be('0xb'));_0x57d8fb(_0xad5215['result'][_0x75be('0x10')]);}})[_0x75be('0x12')](function(_0x435ead){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x44f331,_0x435ead);_0x1a5f9f(_0x435ead);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 2381938..41df296 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 _0x9ebf=['./cmContactHasItem.controller','get','index','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x1629c3,_0x534c78){var _0xbfa251=function(_0x1d209d){while(--_0x1d209d){_0x1629c3['push'](_0x1629c3['shift']());}};_0xbfa251(++_0x534c78);}(_0x9ebf,0x9b));var _0xf9eb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x9ebf[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0xf9eb('0x0'));var util=require(_0xf9eb('0x1'));var path=require('path');var timeout=require(_0xf9eb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf9eb('0x3'));var auth=require(_0xf9eb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf9eb('0x5'));router[_0xf9eb('0x6')]('/',auth['isAuthenticated'](),controller[_0xf9eb('0x7')]);router[_0xf9eb('0x6')](_0xf9eb('0x8'),auth[_0xf9eb('0x9')](),controller[_0xf9eb('0xa')]);router['post']('/',auth[_0xf9eb('0x9')](),controller[_0xf9eb('0xb')]);router[_0xf9eb('0xc')](_0xf9eb('0x8'),auth[_0xf9eb('0x9')](),controller[_0xf9eb('0xd')]);router['delete'](_0xf9eb('0x8'),auth[_0xf9eb('0x9')](),controller[_0xf9eb('0xe')]);module[_0xf9eb('0xf')]=router; \ No newline at end of file +var _0xce15=['Router','fs-extra','../../components/auth/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','post','create','put','/:id','destroy','exports','multer','path','connect-timeout','express'];(function(_0x40c043,_0x1d064e){var _0x5c2c8d=function(_0xab4403){while(--_0xab4403){_0x40c043['push'](_0x40c043['shift']());}};_0x5c2c8d(++_0x1d064e);}(_0xce15,0x152));var _0x5ce1=function(_0x1d4eed,_0x4922b2){_0x1d4eed=_0x1d4eed-0x0;var _0x10911b=_0xce15[_0x1d4eed];return _0x10911b;};'use strict';var multer=require(_0x5ce1('0x0'));var util=require('util');var path=require(_0x5ce1('0x1'));var timeout=require(_0x5ce1('0x2'));var express=require(_0x5ce1('0x3'));var router=express[_0x5ce1('0x4')]();var fs_extra=require(_0x5ce1('0x5'));var auth=require(_0x5ce1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5ce1('0x7'));var controller=require(_0x5ce1('0x8'));router[_0x5ce1('0x9')]('/',auth[_0x5ce1('0xa')](),controller[_0x5ce1('0xb')]);router['get']('/:id',auth[_0x5ce1('0xa')](),controller['show']);router[_0x5ce1('0xc')]('/',auth[_0x5ce1('0xa')](),controller[_0x5ce1('0xd')]);router[_0x5ce1('0xe')](_0x5ce1('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x5ce1('0xf'),auth['isAuthenticated'](),controller[_0x5ce1('0x10')]);module[_0x5ce1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 8466254..cb43e2a 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 _0x3c68=['name','TEXT','long','type','select','parse','values','stringify','BOOLEAN','ENUM','voice','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x5b2747,_0x7d55d2){var _0x2307fb=function(_0x5d8f61){while(--_0x5d8f61){_0x5b2747['push'](_0x5b2747['shift']());}};_0x2307fb(++_0x7d55d2);}(_0x3c68,0x1bb));var _0x83c6=function(_0x508047,_0x2e955d){_0x508047=_0x508047-0x0;var _0x411d48=_0x3c68[_0x508047];return _0x411d48;};'use strict';var Sequelize=require('sequelize');var _=require(_0x83c6('0x0'));module[_0x83c6('0x1')]={'name':{'type':Sequelize[_0x83c6('0x2')],'get':function(_0x3a30ac){return this[_0x83c6('0x3')](_0x83c6('0x4'));}},'alias':{'type':Sequelize[_0x83c6('0x5')],'allowNull':![],'set':function(_0x1258f6){this[_0x83c6('0x6')](_0x83c6('0x4'),_0x1258f6?_0x1258f6:this[_0x83c6('0x3')](_0x83c6('0x7')));}},'type':{'type':Sequelize[_0x83c6('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x83c6('0x8')](_0x83c6('0x9')),'get':function(){if(this['getDataValue'](_0x83c6('0xa'))===_0x83c6('0xb')){return JSON[_0x83c6('0xc')](this[_0x83c6('0x3')](_0x83c6('0xd')));}else{return this[_0x83c6('0x3')]('values');}},'set':function(_0x565f35){if(Array['isArray'](_0x565f35)){this[_0x83c6('0x6')](_0x83c6('0xd'),JSON[_0x83c6('0xe')](_0x565f35));}else{this[_0x83c6('0x6')](_0x83c6('0xd'),_0x565f35);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x83c6('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x83c6('0x10')](_0x83c6('0x11'))}}; \ No newline at end of file +var _0x0ece=['BOOLEAN','voice','sequelize','lodash','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','values','isArray','stringify'];(function(_0x57d821,_0x31e5de){var _0x111ffa=function(_0x407bc9){while(--_0x407bc9){_0x57d821['push'](_0x57d821['shift']());}};_0x111ffa(++_0x31e5de);}(_0x0ece,0x142));var _0xe0ec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ece[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe0ec('0x0'));var _=require(_0xe0ec('0x1'));module['exports']={'name':{'type':Sequelize[_0xe0ec('0x2')],'get':function(_0x666722){return this[_0xe0ec('0x3')](_0xe0ec('0x4'));}},'alias':{'type':Sequelize[_0xe0ec('0x5')],'allowNull':![],'set':function(_0x290400){this[_0xe0ec('0x6')]('alias',_0x290400?_0x290400:this[_0xe0ec('0x3')](_0xe0ec('0x7')));}},'type':{'type':Sequelize[_0xe0ec('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xe0ec('0x8')](_0xe0ec('0x9')),'get':function(){if(this['getDataValue'](_0xe0ec('0xa'))==='select'){return JSON['parse'](this[_0xe0ec('0x3')](_0xe0ec('0xb')));}else{return this['getDataValue']('values');}},'set':function(_0x3f6ac2){if(Array[_0xe0ec('0xc')](_0x3f6ac2)){this['setDataValue'](_0xe0ec('0xb'),JSON[_0xe0ec('0xd')](_0x3f6ac2));}else{this['setDataValue'](_0xe0ec('0xb'),_0x3f6ac2);}}},'required':{'type':Sequelize[_0xe0ec('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xe0ec('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0xe0ec('0xf'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 2a903a0..9a34724 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 _0x7915=['fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','CmCustomField','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','body','find','create','sequelize','transaction','Sequelize','TEXT','text','type','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs'];(function(_0x1b8f5a,_0x57c154){var _0x594189=function(_0x15b277){while(--_0x15b277){_0x1b8f5a['push'](_0x1b8f5a['shift']());}};_0x594189(++_0x57c154);}(_0x7915,0x1a9));var _0x5791=function(_0x1598f5,_0x1f70ee){_0x1598f5=_0x1598f5-0x0;var _0x58248d=_0x7915[_0x1598f5];return _0x58248d;};'use strict';var emlformat=require(_0x5791('0x0'));var rimraf=require(_0x5791('0x1'));var zipdir=require(_0x5791('0x2'));var jsonpatch=require(_0x5791('0x3'));var rp=require(_0x5791('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5791('0x5'));var util=require(_0x5791('0x6'));var path=require(_0x5791('0x7'));var sox=require(_0x5791('0x8'));var csv=require('to-csv');var ejs=require(_0x5791('0x9'));var fs=require('fs');var fs_extra=require(_0x5791('0xa'));var _=require(_0x5791('0xb'));var squel=require(_0x5791('0xc'));var crypto=require(_0x5791('0xd'));var jsforce=require(_0x5791('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5791('0xf'));var querystring=require(_0x5791('0x10'));var Papa=require(_0x5791('0x11'));var Redis=require('ioredis');var authService=require(_0x5791('0x12'));var qs=require(_0x5791('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5791('0x14'));var logger=require(_0x5791('0x15'))(_0x5791('0x16'));var utils=require(_0x5791('0x17'));var config=require(_0x5791('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5791('0x19'))['db'];function respondWithStatusCode(_0x28dcfb,_0x37934e){_0x37934e=_0x37934e||0xcc;return function(_0x53eb50){if(_0x53eb50){return _0x28dcfb[_0x5791('0x1a')](_0x37934e);}return _0x28dcfb[_0x5791('0x1b')](_0x37934e)[_0x5791('0x1c')]();};}function respondWithResult(_0x2f6462,_0x16874a){_0x16874a=_0x16874a||0xc8;return function(_0x1209a1){if(_0x1209a1){return _0x2f6462[_0x5791('0x1b')](_0x16874a)[_0x5791('0x1d')](_0x1209a1);}};}function respondWithFilteredResult(_0x453f19,_0x345af3){return function(_0x5c4a6e){if(_0x5c4a6e){var _0x328e26=typeof _0x345af3[_0x5791('0x1e')]===_0x5791('0x1f')&&typeof _0x345af3[_0x5791('0x20')]===_0x5791('0x1f');var _0x11a449=_0x5c4a6e[_0x5791('0x21')];var _0x4f342c=_0x328e26?0x0:_0x345af3[_0x5791('0x1e')];var _0x42633c=_0x328e26?_0x5c4a6e[_0x5791('0x21')]:_0x345af3[_0x5791('0x1e')]+_0x345af3['limit'];var _0x23cdc2;if(_0x42633c>=_0x11a449){_0x42633c=_0x11a449;_0x23cdc2=0xc8;}else{_0x23cdc2=0xce;}_0x453f19[_0x5791('0x1b')](_0x23cdc2);return _0x453f19[_0x5791('0x22')](_0x5791('0x23'),_0x4f342c+'-'+_0x42633c+'/'+_0x11a449)[_0x5791('0x1d')](_0x5c4a6e);}return null;};}function patchUpdates(_0x5841bf){return function(_0x1cbedd){try{jsonpatch[_0x5791('0x24')](_0x1cbedd,_0x5841bf,!![]);}catch(_0x178fc5){return BPromise[_0x5791('0x25')](_0x178fc5);}return _0x1cbedd['save']();};}function saveUpdates(_0x4da09c,_0x3e6b17){return function(_0x25a1b1){if(_0x25a1b1){return _0x25a1b1[_0x5791('0x26')](_0x4da09c)[_0x5791('0x27')](function(_0x57900d){return _0x57900d;});}return null;};}function removeEntity(_0x4f9f81,_0x1bd93b){return function(_0xe8a1dd){if(_0xe8a1dd){return _0xe8a1dd[_0x5791('0x28')]()[_0x5791('0x27')](function(){_0x4f9f81['status'](0xcc)[_0x5791('0x1c')]();});}};}function handleEntityNotFound(_0x5eeb03,_0x17e85f){return function(_0x95262c){if(!_0x95262c){_0x5eeb03[_0x5791('0x1a')](0x194);}return _0x95262c;};}function handleError(_0x579797,_0x4eaa5d){_0x4eaa5d=_0x4eaa5d||0x1f4;return function(_0x5b2d42){logger[_0x5791('0x29')](_0x5b2d42['stack']);if(_0x5b2d42['name']){delete _0x5b2d42[_0x5791('0x2a')];}_0x579797['status'](_0x4eaa5d)[_0x5791('0x2b')](_0x5b2d42);};}exports[_0x5791('0x2c')]=function(_0x4c1c7f,_0x538d76){var _0x92421a={},_0x226f90={},_0x5eadc7={'count':0x0,'rows':[]};var _0x2769d3=_[_0x5791('0x2d')](db[_0x5791('0x2e')][_0x5791('0x2f')],function(_0x342875){return{'name':_0x342875[_0x5791('0x30')],'type':_0x342875['type'][_0x5791('0x31')]};});_0x226f90['model']=_['differenceBy'](_[_0x5791('0x2d')](_0x2769d3,_0x5791('0x2a')),['name']);_0x226f90[_0x5791('0x32')]=_[_0x5791('0x33')](_0x4c1c7f[_0x5791('0x32')]);_0x226f90[_0x5791('0x34')]=_['intersection'](_0x226f90[_0x5791('0x35')],_0x226f90[_0x5791('0x32')]);_0x92421a[_0x5791('0x36')]=_[_0x5791('0x37')](_0x226f90[_0x5791('0x35')],qs[_0x5791('0x38')](_0x4c1c7f[_0x5791('0x32')][_0x5791('0x38')]));_0x92421a[_0x5791('0x36')]=_0x92421a['attributes'][_0x5791('0x39')]?_0x92421a[_0x5791('0x36')]:_0x226f90[_0x5791('0x35')];if(!_0x4c1c7f['query']['hasOwnProperty'](_0x5791('0x3a'))){_0x92421a['limit']=qs[_0x5791('0x20')](_0x4c1c7f[_0x5791('0x32')][_0x5791('0x20')]);_0x92421a[_0x5791('0x1e')]=qs[_0x5791('0x1e')](_0x4c1c7f['query'][_0x5791('0x1e')]);}_0x92421a[_0x5791('0x3b')]=qs[_0x5791('0x3c')](_0x4c1c7f[_0x5791('0x32')][_0x5791('0x3c')]);_0x92421a[_0x5791('0x3d')]=qs[_0x5791('0x34')](_[_0x5791('0x3e')](_0x4c1c7f[_0x5791('0x32')],_0x226f90[_0x5791('0x34')]),_0x2769d3);if(_0x4c1c7f[_0x5791('0x32')][_0x5791('0x3f')]){_0x92421a[_0x5791('0x3d')]=_[_0x5791('0x40')](_0x92421a[_0x5791('0x3d')],{'$or':_[_0x5791('0x2d')](_0x2769d3,function(_0x4db048){if(_0x4db048['type']!==_0x5791('0x41')){var _0x4ecd9d={};_0x4ecd9d[_0x4db048[_0x5791('0x2a')]]={'$like':'%'+_0x4c1c7f[_0x5791('0x32')][_0x5791('0x3f')]+'%'};return _0x4ecd9d;}})});}_0x92421a=_[_0x5791('0x40')]({},_0x92421a,_0x4c1c7f[_0x5791('0x42')]);var _0x32019a={'where':_0x92421a[_0x5791('0x3d')]};return db[_0x5791('0x2e')]['count'](_0x32019a)[_0x5791('0x27')](function(_0x2b2fa5){_0x5eadc7[_0x5791('0x21')]=_0x2b2fa5;if(_0x4c1c7f['query']['includeAll']){_0x92421a[_0x5791('0x43')]=[{'all':!![]}];}return db[_0x5791('0x2e')][_0x5791('0x44')](_0x92421a);})[_0x5791('0x27')](function(_0x4cf025){_0x5eadc7['rows']=_0x4cf025;return _0x5eadc7;})[_0x5791('0x27')](respondWithFilteredResult(_0x538d76,_0x92421a))[_0x5791('0x45')](handleError(_0x538d76,null));};exports[_0x5791('0x46')]=function(_0x5660b8,_0x359055){var _0x474fdc={'raw':!![],'where':{'id':_0x5660b8[_0x5791('0x47')]['id']}},_0x3580da={};_0x3580da[_0x5791('0x35')]=_['keys'](db[_0x5791('0x2e')][_0x5791('0x2f')]);_0x3580da[_0x5791('0x32')]=_[_0x5791('0x33')](_0x5660b8[_0x5791('0x32')]);_0x3580da[_0x5791('0x34')]=_[_0x5791('0x37')](_0x3580da['model'],_0x3580da[_0x5791('0x32')]);_0x474fdc[_0x5791('0x36')]=_[_0x5791('0x37')](_0x3580da[_0x5791('0x35')],qs['fields'](_0x5660b8[_0x5791('0x32')][_0x5791('0x38')]));_0x474fdc['attributes']=_0x474fdc['attributes'][_0x5791('0x39')]?_0x474fdc[_0x5791('0x36')]:_0x3580da[_0x5791('0x35')];if(_0x5660b8[_0x5791('0x32')]['includeAll']){_0x474fdc[_0x5791('0x43')]=[{'all':!![]}];}_0x474fdc=_['merge']({},_0x474fdc,_0x5660b8[_0x5791('0x42')]);return db[_0x5791('0x2e')]['find'](_0x474fdc)[_0x5791('0x27')](handleEntityNotFound(_0x359055,null))['then'](respondWithResult(_0x359055,null))[_0x5791('0x45')](handleError(_0x359055,null));};exports[_0x5791('0x26')]=function(_0x1c6982,_0x5168ae){if(_0x1c6982[_0x5791('0x48')]['id']){delete _0x1c6982['body']['id'];}return db[_0x5791('0x2e')][_0x5791('0x49')]({'where':{'id':_0x1c6982['params']['id']}})[_0x5791('0x27')](handleEntityNotFound(_0x5168ae,null))[_0x5791('0x27')](saveUpdates(_0x1c6982[_0x5791('0x48')],null))[_0x5791('0x27')](respondWithResult(_0x5168ae,null))[_0x5791('0x45')](handleError(_0x5168ae,null));};exports['destroy']=function(_0x42d3ab,_0x464c56){return db['CmCustomField'][_0x5791('0x49')]({'where':{'id':_0x42d3ab[_0x5791('0x47')]['id']}})[_0x5791('0x27')](handleEntityNotFound(_0x464c56,null))[_0x5791('0x27')](removeEntity(_0x464c56,null))[_0x5791('0x45')](handleError(_0x464c56,null));};exports[_0x5791('0x4a')]=function(_0x3125ba,_0x175929){var _0x3639ac;return db[_0x5791('0x4b')][_0x5791('0x4c')](function(_0x408fe4){return db[_0x5791('0x2e')][_0x5791('0x4a')](_0x3125ba[_0x5791('0x48')],{'transaction':_0x408fe4})[_0x5791('0x27')](function(_0x34fb59){_0x3639ac=_0x34fb59;var _0x40a8bb={'type':db[_0x5791('0x4d')][_0x5791('0x4e')],'transaction':_0x408fe4};switch(_0x3125ba[_0x5791('0x48')]['type']){case _0x5791('0x4f'):_0x40a8bb[_0x5791('0x50')]=db[_0x5791('0x4d')][_0x5791('0x4e')];break;case'number':_0x40a8bb[_0x5791('0x50')]=db['Sequelize'][_0x5791('0x51')];break;case _0x5791('0x52'):_0x40a8bb[_0x5791('0x50')]=db[_0x5791('0x4d')]['BOOLEAN'];_0x40a8bb[_0x5791('0x53')]=![];break;default:}return db[_0x5791('0x4b')][_0x5791('0x54')][_0x5791('0x55')]('cm_contacts',util['format'](_0x5791('0x56'),_0x3639ac['id']),_0x40a8bb);})['then'](function(){return _0x3639ac;});})[_0x5791('0x27')](respondWithResult(_0x175929,0xc9))[_0x5791('0x45')](handleError(_0x175929,null));}; \ No newline at end of file +var _0x67d5=['CmCustomField','rawAttributes','type','model','differenceBy','map','query','keys','intersection','attributes','fields','nolimit','limit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','length','find','update','body','params','create','sequelize','Sequelize','TEXT','text','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','save','then','destroy','end','error','stack','name','index'];(function(_0x36e1a2,_0x67de6c){var _0x2aa224=function(_0x9db573){while(--_0x9db573){_0x36e1a2['push'](_0x36e1a2['shift']());}};_0x2aa224(++_0x67de6c);}(_0x67d5,0x16c));var _0x567d=function(_0x376ce7,_0x39c7d7){_0x376ce7=_0x376ce7-0x0;var _0x497c1e=_0x67d5[_0x376ce7];return _0x497c1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x567d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x567d('0x1'));var moment=require(_0x567d('0x2'));var BPromise=require(_0x567d('0x3'));var Mustache=require(_0x567d('0x4'));var util=require('util');var path=require(_0x567d('0x5'));var sox=require(_0x567d('0x6'));var csv=require(_0x567d('0x7'));var ejs=require(_0x567d('0x8'));var fs=require('fs');var fs_extra=require(_0x567d('0x9'));var _=require(_0x567d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x567d('0xb'));var deskjs=require(_0x567d('0xc'));var toCsv=require(_0x567d('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x567d('0xd'));var authService=require(_0x567d('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x567d('0xf'));var hardwareService=require(_0x567d('0x10'));var logger=require(_0x567d('0x11'))(_0x567d('0x12'));var utils=require(_0x567d('0x13'));var config=require(_0x567d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x567d('0x15'))['db'];function respondWithStatusCode(_0x2bb48a,_0x3921c9){_0x3921c9=_0x3921c9||0xcc;return function(_0x5e1093){if(_0x5e1093){return _0x2bb48a[_0x567d('0x16')](_0x3921c9);}return _0x2bb48a[_0x567d('0x17')](_0x3921c9)['end']();};}function respondWithResult(_0x575aa7,_0x3071a1){_0x3071a1=_0x3071a1||0xc8;return function(_0x3acb79){if(_0x3acb79){return _0x575aa7[_0x567d('0x17')](_0x3071a1)[_0x567d('0x18')](_0x3acb79);}};}function respondWithFilteredResult(_0x135315,_0x148bc9){return function(_0x3129b7){if(_0x3129b7){var _0xbb932=typeof _0x148bc9[_0x567d('0x19')]==='undefined'&&typeof _0x148bc9['limit']===_0x567d('0x1a');var _0x587aba=_0x3129b7[_0x567d('0x1b')];var _0x52b075=_0xbb932?0x0:_0x148bc9['offset'];var _0x5a7b1d=_0xbb932?_0x3129b7[_0x567d('0x1b')]:_0x148bc9[_0x567d('0x19')]+_0x148bc9['limit'];var _0x1e29d2;if(_0x5a7b1d>=_0x587aba){_0x5a7b1d=_0x587aba;_0x1e29d2=0xc8;}else{_0x1e29d2=0xce;}_0x135315[_0x567d('0x17')](_0x1e29d2);return _0x135315['set']('Content-Range',_0x52b075+'-'+_0x5a7b1d+'/'+_0x587aba)[_0x567d('0x18')](_0x3129b7);}return null;};}function patchUpdates(_0x296d8b){return function(_0x2d96fb){try{jsonpatch['apply'](_0x2d96fb,_0x296d8b,!![]);}catch(_0x3e6554){return BPromise['reject'](_0x3e6554);}return _0x2d96fb[_0x567d('0x1c')]();};}function saveUpdates(_0xdea105,_0x28b2a5){return function(_0x50247d){if(_0x50247d){return _0x50247d['update'](_0xdea105)[_0x567d('0x1d')](function(_0x2c9eed){return _0x2c9eed;});}return null;};}function removeEntity(_0x3a040a,_0x2752d9){return function(_0x4eb516){if(_0x4eb516){return _0x4eb516[_0x567d('0x1e')]()[_0x567d('0x1d')](function(){_0x3a040a[_0x567d('0x17')](0xcc)[_0x567d('0x1f')]();});}};}function handleEntityNotFound(_0x3caf85,_0x4bd5d9){return function(_0x22bfe8){if(!_0x22bfe8){_0x3caf85['sendStatus'](0x194);}return _0x22bfe8;};}function handleError(_0x4d39ce,_0x3ff2b0){_0x3ff2b0=_0x3ff2b0||0x1f4;return function(_0x178a04){logger[_0x567d('0x20')](_0x178a04[_0x567d('0x21')]);if(_0x178a04[_0x567d('0x22')]){delete _0x178a04[_0x567d('0x22')];}_0x4d39ce[_0x567d('0x17')](_0x3ff2b0)['send'](_0x178a04);};}exports[_0x567d('0x23')]=function(_0xe9d55,_0x856dc){var _0xafb313={},_0x27191d={},_0x2f6ea9={'count':0x0,'rows':[]};var _0x241c87=_['map'](db[_0x567d('0x24')][_0x567d('0x25')],function(_0x3e6660){return{'name':_0x3e6660['fieldName'],'type':_0x3e6660[_0x567d('0x26')]['key']};});_0x27191d[_0x567d('0x27')]=_[_0x567d('0x28')](_[_0x567d('0x29')](_0x241c87,_0x567d('0x22')),[_0x567d('0x22')]);_0x27191d[_0x567d('0x2a')]=_[_0x567d('0x2b')](_0xe9d55[_0x567d('0x2a')]);_0x27191d['filters']=_[_0x567d('0x2c')](_0x27191d[_0x567d('0x27')],_0x27191d[_0x567d('0x2a')]);_0xafb313[_0x567d('0x2d')]=_[_0x567d('0x2c')](_0x27191d['model'],qs[_0x567d('0x2e')](_0xe9d55['query'][_0x567d('0x2e')]));_0xafb313[_0x567d('0x2d')]=_0xafb313[_0x567d('0x2d')]['length']?_0xafb313[_0x567d('0x2d')]:_0x27191d[_0x567d('0x27')];if(!_0xe9d55[_0x567d('0x2a')]['hasOwnProperty'](_0x567d('0x2f'))){_0xafb313[_0x567d('0x30')]=qs[_0x567d('0x30')](_0xe9d55[_0x567d('0x2a')][_0x567d('0x30')]);_0xafb313[_0x567d('0x19')]=qs[_0x567d('0x19')](_0xe9d55[_0x567d('0x2a')][_0x567d('0x19')]);}_0xafb313[_0x567d('0x31')]=qs[_0x567d('0x32')](_0xe9d55['query'][_0x567d('0x32')]);_0xafb313[_0x567d('0x33')]=qs[_0x567d('0x34')](_['pick'](_0xe9d55[_0x567d('0x2a')],_0x27191d[_0x567d('0x34')]),_0x241c87);if(_0xe9d55[_0x567d('0x2a')][_0x567d('0x35')]){_0xafb313[_0x567d('0x33')]=_[_0x567d('0x36')](_0xafb313[_0x567d('0x33')],{'$or':_[_0x567d('0x29')](_0x241c87,function(_0xd15e76){if(_0xd15e76[_0x567d('0x26')]!==_0x567d('0x37')){var _0xc90c2b={};_0xc90c2b[_0xd15e76[_0x567d('0x22')]]={'$like':'%'+_0xe9d55[_0x567d('0x2a')]['filter']+'%'};return _0xc90c2b;}})});}_0xafb313=_[_0x567d('0x36')]({},_0xafb313,_0xe9d55[_0x567d('0x38')]);var _0x1f53e8={'where':_0xafb313[_0x567d('0x33')]};return db['CmCustomField']['count'](_0x1f53e8)[_0x567d('0x1d')](function(_0x64bfa3){_0x2f6ea9[_0x567d('0x1b')]=_0x64bfa3;if(_0xe9d55['query'][_0x567d('0x39')]){_0xafb313[_0x567d('0x3a')]=[{'all':!![]}];}return db[_0x567d('0x24')][_0x567d('0x3b')](_0xafb313);})[_0x567d('0x1d')](function(_0x3d191d){_0x2f6ea9['rows']=_0x3d191d;return _0x2f6ea9;})[_0x567d('0x1d')](respondWithFilteredResult(_0x856dc,_0xafb313))[_0x567d('0x3c')](handleError(_0x856dc,null));};exports['show']=function(_0x315d6a,_0x5c0ac2){var _0x126039={'raw':!![],'where':{'id':_0x315d6a['params']['id']}},_0x41ce35={};_0x41ce35[_0x567d('0x27')]=_[_0x567d('0x2b')](db[_0x567d('0x24')][_0x567d('0x25')]);_0x41ce35[_0x567d('0x2a')]=_[_0x567d('0x2b')](_0x315d6a['query']);_0x41ce35[_0x567d('0x34')]=_[_0x567d('0x2c')](_0x41ce35[_0x567d('0x27')],_0x41ce35[_0x567d('0x2a')]);_0x126039[_0x567d('0x2d')]=_[_0x567d('0x2c')](_0x41ce35[_0x567d('0x27')],qs[_0x567d('0x2e')](_0x315d6a['query'][_0x567d('0x2e')]));_0x126039[_0x567d('0x2d')]=_0x126039[_0x567d('0x2d')][_0x567d('0x3d')]?_0x126039[_0x567d('0x2d')]:_0x41ce35[_0x567d('0x27')];if(_0x315d6a[_0x567d('0x2a')][_0x567d('0x39')]){_0x126039[_0x567d('0x3a')]=[{'all':!![]}];}_0x126039=_['merge']({},_0x126039,_0x315d6a[_0x567d('0x38')]);return db[_0x567d('0x24')][_0x567d('0x3e')](_0x126039)[_0x567d('0x1d')](handleEntityNotFound(_0x5c0ac2,null))['then'](respondWithResult(_0x5c0ac2,null))['catch'](handleError(_0x5c0ac2,null));};exports[_0x567d('0x3f')]=function(_0x27821d,_0x1a16d1){if(_0x27821d[_0x567d('0x40')]['id']){delete _0x27821d['body']['id'];}return db[_0x567d('0x24')][_0x567d('0x3e')]({'where':{'id':_0x27821d[_0x567d('0x41')]['id']}})[_0x567d('0x1d')](handleEntityNotFound(_0x1a16d1,null))['then'](saveUpdates(_0x27821d['body'],null))[_0x567d('0x1d')](respondWithResult(_0x1a16d1,null))[_0x567d('0x3c')](handleError(_0x1a16d1,null));};exports[_0x567d('0x1e')]=function(_0x6a4f18,_0x3671f6){return db[_0x567d('0x24')][_0x567d('0x3e')]({'where':{'id':_0x6a4f18[_0x567d('0x41')]['id']}})[_0x567d('0x1d')](handleEntityNotFound(_0x3671f6,null))[_0x567d('0x1d')](removeEntity(_0x3671f6,null))['catch'](handleError(_0x3671f6,null));};exports[_0x567d('0x42')]=function(_0x2ccec5,_0x2c8893){var _0x453eb9;return db[_0x567d('0x43')]['transaction'](function(_0x55fbc7){return db[_0x567d('0x24')]['create'](_0x2ccec5[_0x567d('0x40')],{'transaction':_0x55fbc7})[_0x567d('0x1d')](function(_0x4317cf){_0x453eb9=_0x4317cf;var _0x1c40e6={'type':db[_0x567d('0x44')][_0x567d('0x45')],'transaction':_0x55fbc7};switch(_0x2ccec5[_0x567d('0x40')][_0x567d('0x26')]){case _0x567d('0x46'):_0x1c40e6[_0x567d('0x26')]=db[_0x567d('0x44')][_0x567d('0x45')];break;case _0x567d('0x47'):_0x1c40e6[_0x567d('0x26')]=db[_0x567d('0x44')][_0x567d('0x48')];break;case _0x567d('0x49'):_0x1c40e6[_0x567d('0x26')]=db[_0x567d('0x44')]['BOOLEAN'];_0x1c40e6[_0x567d('0x4a')]=![];break;default:}return db['sequelize'][_0x567d('0x4b')][_0x567d('0x4c')](_0x567d('0x4d'),util[_0x567d('0x4e')](_0x567d('0x4f'),_0x453eb9['id']),_0x1c40e6);})[_0x567d('0x1d')](function(){return _0x453eb9;});})[_0x567d('0x1d')](respondWithResult(_0x2c8893,0xc9))['catch'](handleError(_0x2c8893,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 22ca806..08c0f2f 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 _0xcf55=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger'];(function(_0xe4bfe7,_0x86af39){var _0x598fa2=function(_0x279724){while(--_0x279724){_0xe4bfe7['push'](_0xe4bfe7['shift']());}};_0x598fa2(++_0x86af39);}(_0xcf55,0x66));var _0x5cf5=function(_0x1ddc91,_0x132ec7){_0x1ddc91=_0x1ddc91-0x0;var _0x3559bb=_0xcf55[_0x1ddc91];return _0x3559bb;};'use strict';var _=require(_0x5cf5('0x0'));var util=require(_0x5cf5('0x1'));var logger=require(_0x5cf5('0x2'))(_0x5cf5('0x3'));var moment=require(_0x5cf5('0x4'));var BPromise=require(_0x5cf5('0x5'));var rp=require(_0x5cf5('0x6'));var fs=require('fs');var path=require(_0x5cf5('0x7'));var rimraf=require(_0x5cf5('0x8'));var config=require(_0x5cf5('0x9'));var attributes=require(_0x5cf5('0xa'));module[_0x5cf5('0xb')]=function(_0x23365f,_0x1c7287){return _0x23365f[_0x5cf5('0xc')](_0x5cf5('0xd'),attributes,{'tableName':_0x5cf5('0xe'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d8d=['util','../../config/logger','api','moment','request-promise','rimraf','./cmCustomField.attributes','exports','define','cm_custom_fields','lodash'];(function(_0x18be37,_0x2b1493){var _0x4b27fd=function(_0x5a2266){while(--_0x5a2266){_0x18be37['push'](_0x18be37['shift']());}};_0x4b27fd(++_0x2b1493);}(_0x5d8d,0x13e));var _0xd5d8=function(_0x57cf97,_0x4c47bc){_0x57cf97=_0x57cf97-0x0;var _0x124bc7=_0x5d8d[_0x57cf97];return _0x124bc7;};'use strict';var _=require(_0xd5d8('0x0'));var util=require(_0xd5d8('0x1'));var logger=require(_0xd5d8('0x2'))(_0xd5d8('0x3'));var moment=require(_0xd5d8('0x4'));var BPromise=require('bluebird');var rp=require(_0xd5d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd5d8('0x6'));var config=require('../../config/environment');var attributes=require(_0xd5d8('0x7'));module[_0xd5d8('0x8')]=function(_0x4aa67a,_0xce93b9){return _0x4aa67a[_0xd5d8('0x9')]('CmCustomField',attributes,{'tableName':_0xd5d8('0xa'),'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 f658dff..ffa59e4 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 _0xae35=['code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x174767,_0x5b603e){var _0x2a7fbd=function(_0x377894){while(--_0x377894){_0x174767['push'](_0x174767['shift']());}};_0x2a7fbd(++_0x5b603e);}(_0xae35,0x119));var _0x5ae3=function(_0x72fe41,_0x2dbc9c){_0x72fe41=_0x72fe41-0x0;var _0x3971a7=_0xae35[_0x72fe41];return _0x3971a7;};'use strict';var _=require(_0x5ae3('0x0'));var util=require(_0x5ae3('0x1'));var moment=require(_0x5ae3('0x2'));var BPromise=require(_0x5ae3('0x3'));var rs=require(_0x5ae3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ae3('0x5'))(_0x5ae3('0x6'));var config=require(_0x5ae3('0x7'));var jayson=require(_0x5ae3('0x8'));var client=jayson[_0x5ae3('0x9')][_0x5ae3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x420e4c,_0x352a82,_0x36bad7){return new BPromise(function(_0x30e77b,_0x302737){return client[_0x5ae3('0xb')](_0x420e4c,_0x36bad7)['then'](function(_0x5a5cd1){logger['info'](_0x5ae3('0xc'),_0x352a82,_0x5ae3('0xd'));logger[_0x5ae3('0xe')](_0x5ae3('0xf'),_0x352a82,_0x5ae3('0xd'),JSON[_0x5ae3('0x10')](_0x5a5cd1));if(_0x5a5cd1[_0x5ae3('0x11')]){if(_0x5a5cd1['error'][_0x5ae3('0x12')]===0x1f4){logger[_0x5ae3('0x11')]('CmCustomField,\x20%s,\x20%s',_0x352a82,_0x5a5cd1[_0x5ae3('0x11')][_0x5ae3('0x13')]);return _0x302737(_0x5a5cd1['error']['message']);}logger[_0x5ae3('0x11')](_0x5ae3('0xc'),_0x352a82,_0x5a5cd1[_0x5ae3('0x11')][_0x5ae3('0x13')]);return _0x30e77b(_0x5a5cd1[_0x5ae3('0x11')][_0x5ae3('0x13')]);}else{logger[_0x5ae3('0x14')](_0x5ae3('0xc'),_0x352a82,_0x5ae3('0xd'));_0x30e77b(_0x5a5cd1[_0x5ae3('0x15')][_0x5ae3('0x13')]);}})[_0x5ae3('0x16')](function(_0x5d3a68){logger[_0x5ae3('0x11')]('CmCustomField,\x20%s,\x20%s',_0x352a82,_0x5d3a68);_0x302737(_0x5d3a68);});});} \ No newline at end of file +var _0xb08f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x486df7,_0x5f803a){var _0x3c0d43=function(_0x154c7c){while(--_0x154c7c){_0x486df7['push'](_0x486df7['shift']());}};_0x3c0d43(++_0x5f803a);}(_0xb08f,0x1d7));var _0xfb08=function(_0x4b802b,_0x4b55bb){_0x4b802b=_0x4b802b-0x0;var _0x70ff8e=_0xb08f[_0x4b802b];return _0x70ff8e;};'use strict';var _=require(_0xfb08('0x0'));var util=require('util');var moment=require(_0xfb08('0x1'));var BPromise=require(_0xfb08('0x2'));var rs=require(_0xfb08('0x3'));var fs=require('fs');var Redis=require(_0xfb08('0x4'));var db=require(_0xfb08('0x5'))['db'];var utils=require(_0xfb08('0x6'));var logger=require(_0xfb08('0x7'))(_0xfb08('0x8'));var config=require(_0xfb08('0x9'));var jayson=require(_0xfb08('0xa'));var client=jayson[_0xfb08('0xb')][_0xfb08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd6db73,_0x191159,_0x23af57){return new BPromise(function(_0x59f4a5,_0x505268){return client[_0xfb08('0xd')](_0xd6db73,_0x23af57)[_0xfb08('0xe')](function(_0x35e109){logger['info'](_0xfb08('0xf'),_0x191159,_0xfb08('0x10'));logger[_0xfb08('0x11')](_0xfb08('0x12'),_0x191159,_0xfb08('0x10'),JSON['stringify'](_0x35e109));if(_0x35e109[_0xfb08('0x13')]){if(_0x35e109['error'][_0xfb08('0x14')]===0x1f4){logger[_0xfb08('0x13')]('CmCustomField,\x20%s,\x20%s',_0x191159,_0x35e109[_0xfb08('0x13')][_0xfb08('0x15')]);return _0x505268(_0x35e109[_0xfb08('0x13')][_0xfb08('0x15')]);}logger['error'](_0xfb08('0xf'),_0x191159,_0x35e109['error'][_0xfb08('0x15')]);return _0x59f4a5(_0x35e109['error'][_0xfb08('0x15')]);}else{logger[_0xfb08('0x16')](_0xfb08('0xf'),_0x191159,_0xfb08('0x10'));_0x59f4a5(_0x35e109[_0xfb08('0x17')][_0xfb08('0x15')]);}})[_0xfb08('0x18')](function(_0x2108a6){logger[_0xfb08('0x13')](_0xfb08('0xf'),_0x191159,_0x2108a6);_0x505268(_0x2108a6);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 3af205c..8a018cd 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 _0x7e1e=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','index','/:id','isAuthenticated'];(function(_0x39f9f2,_0x37fc06){var _0x3febf8=function(_0x2811f2){while(--_0x2811f2){_0x39f9f2['push'](_0x39f9f2['shift']());}};_0x3febf8(++_0x37fc06);}(_0x7e1e,0x183));var _0xe7e1=function(_0x4cc1ed,_0x5586e3){_0x4cc1ed=_0x4cc1ed-0x0;var _0x287ab6=_0x7e1e[_0x4cc1ed];return _0x287ab6;};'use strict';var multer=require(_0xe7e1('0x0'));var util=require(_0xe7e1('0x1'));var path=require(_0xe7e1('0x2'));var timeout=require(_0xe7e1('0x3'));var express=require('express');var router=express[_0xe7e1('0x4')]();var fs_extra=require(_0xe7e1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xe7e1('0x6'));var config=require(_0xe7e1('0x7'));var controller=require(_0xe7e1('0x8'));router[_0xe7e1('0x9')]('/',auth['isAuthenticated'](),controller[_0xe7e1('0xa')]);router[_0xe7e1('0x9')](_0xe7e1('0xb'),auth[_0xe7e1('0xc')](),controller[_0xe7e1('0xd')]);router[_0xe7e1('0xe')]('/',auth[_0xe7e1('0xc')](),controller[_0xe7e1('0xf')]);router[_0xe7e1('0x10')](_0xe7e1('0xb'),auth[_0xe7e1('0xc')](),controller[_0xe7e1('0x11')]);router['delete'](_0xe7e1('0xb'),auth[_0xe7e1('0xc')](),controller[_0xe7e1('0x12')]);module[_0xe7e1('0x13')]=router; \ No newline at end of file +var _0xf4d9=['isAuthenticated','index','get','post','create','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller'];(function(_0x1f038e,_0x37f443){var _0x32fdfd=function(_0x44e783){while(--_0x44e783){_0x1f038e['push'](_0x1f038e['shift']());}};_0x32fdfd(++_0x37f443);}(_0xf4d9,0x7c));var _0x9f4d=function(_0x2de263,_0x33d064){_0x2de263=_0x2de263-0x0;var _0x20dc09=_0xf4d9[_0x2de263];return _0x20dc09;};'use strict';var multer=require(_0x9f4d('0x0'));var util=require('util');var path=require(_0x9f4d('0x1'));var timeout=require(_0x9f4d('0x2'));var express=require(_0x9f4d('0x3'));var router=express[_0x9f4d('0x4')]();var fs_extra=require(_0x9f4d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f4d('0x6'));var config=require(_0x9f4d('0x7'));var controller=require(_0x9f4d('0x8'));router['get']('/',auth[_0x9f4d('0x9')](),controller[_0x9f4d('0xa')]);router[_0x9f4d('0xb')]('/:id',auth[_0x9f4d('0x9')](),controller['show']);router[_0x9f4d('0xc')]('/',auth['isAuthenticated'](),controller[_0x9f4d('0xd')]);router[_0x9f4d('0xe')](_0x9f4d('0xf'),auth[_0x9f4d('0x9')](),controller['update']);router[_0x9f4d('0x10')](_0x9f4d('0xf'),auth[_0x9f4d('0x9')](),controller[_0x9f4d('0x11')]);module[_0x9f4d('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 9f89242..5dcf9db 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 _0x28a5=['DATE','INTEGER','UNSIGNED','BOOLEAN','contactListQueue','moment','sequelize','exports','STRING'];(function(_0x517c97,_0x3fd275){var _0x244ef3=function(_0x2a858d){while(--_0x2a858d){_0x517c97['push'](_0x517c97['shift']());}};_0x244ef3(++_0x3fd275);}(_0x28a5,0x71));var _0x528a=function(_0x911353,_0x1648ed){_0x911353=_0x911353-0x0;var _0x2f05fa=_0x28a5[_0x911353];return _0x2f05fa;};'use strict';var moment=require(_0x528a('0x0'));var Sequelize=require(_0x528a('0x1'));module[_0x528a('0x2')]={'phone':{'type':Sequelize[_0x528a('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x528a('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x528a('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x528a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x528a('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x528a('0x5')],'unique':_0x528a('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x528a('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x528a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x528a('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x528a('0x3')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x60a7=['contactListQueue','sequelize','exports','format','INTEGER','STRING','DATE','UNSIGNED','BOOLEAN'];(function(_0x16dac6,_0x3a759f){var _0x707749=function(_0x1606d6){while(--_0x1606d6){_0x16dac6['push'](_0x16dac6['shift']());}};_0x707749(++_0x3a759f);}(_0x60a7,0xd9));var _0x760a=function(_0x3bd818,_0x17705d){_0x3bd818=_0x3bd818-0x0;var _0x3af3fa=_0x60a7[_0x3bd818];return _0x3af3fa;};'use strict';var moment=require('moment');var Sequelize=require(_0x760a('0x0'));module[_0x760a('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x760a('0x2')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x760a('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x760a('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x760a('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x760a('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x760a('0x7')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x760a('0x3')],'unique':_0x760a('0x8')},'ListId':{'type':Sequelize[_0x760a('0x3')],'unique':_0x760a('0x8')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x760a('0x8')},'CampaignId':{'type':Sequelize[_0x760a('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x760a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x760a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x760a('0x3')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x760a('0x4')]},'recallmeNotifiedDate':{'type':Sequelize[_0x760a('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index ebc7a24..444f044 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 _0x04de=['getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','then','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','filters','concat','$and','$gt','$lt','$lte','$ne','$eq','$not','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','CmHopper','includeAll','findAll','rows','show','params','keys','include','find','create','body','catch','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','updatedAt','deleted','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','ContactId','firstName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','dialPreviewAutoRecallMe','length','sequelize','transaction','direction','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','priority','literal','findOne','scheduledat','recallme','LOCK','UPDATE','CmContact','CmCompany','Company','CmList','Queue','dialActive','getOpenContacts','getVoiceQueues','outbound','preview','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','push','utcOffset'];(function(_0x544960,_0x48b4df){var _0x15da05=function(_0x2dbb0d){while(--_0x2dbb0d){_0x544960['push'](_0x544960['shift']());}};_0x15da05(++_0x48b4df);}(_0x04de,0x107));var _0xe04d=function(_0x359246,_0xa686f){_0x359246=_0x359246-0x0;var _0xa4bc34=_0x04de[_0x359246];return _0xa4bc34;};'use strict';var moment=require(_0xe04d('0x0'));var _=require(_0xe04d('0x1'));var qs=require(_0xe04d('0x2'));var logger=require(_0xe04d('0x3'))(_0xe04d('0x4'));var shared=require(_0xe04d('0x5'));var db=require(_0xe04d('0x6'))['db'];function respondWithResult(_0x43c4b1,_0x2593a4){_0x2593a4=_0x2593a4||0xc8;return function(_0x70ead0){if(_0x70ead0){return _0x43c4b1[_0xe04d('0x7')](_0x2593a4)['json'](_0x70ead0);}};}function respondWithFilteredResult(_0x4bb925,_0x4f7637){return function(_0x531688){if(_0x531688){var _0x55efb5=typeof _0x4f7637[_0xe04d('0x8')]===_0xe04d('0x9')&&typeof _0x4f7637[_0xe04d('0xa')]===_0xe04d('0x9');var _0x2a1f43=_0x531688[_0xe04d('0xb')];var _0x433350=_0x55efb5?0x0:_0x4f7637['offset'];var _0x160d4f=_0x55efb5?_0x531688[_0xe04d('0xb')]:_0x4f7637[_0xe04d('0x8')]+_0x4f7637[_0xe04d('0xa')];var _0xad5c34;if(_0x160d4f>=_0x2a1f43){_0x160d4f=_0x2a1f43;_0xad5c34=0xc8;}else{_0xad5c34=0xce;}_0x4bb925[_0xe04d('0x7')](_0xad5c34);return _0x4bb925[_0xe04d('0xc')](_0xe04d('0xd'),_0x433350+'-'+_0x160d4f+'/'+_0x2a1f43)[_0xe04d('0xe')](_0x531688);}return null;};}function saveUpdates(_0x53f59a,_0x8bf2d2){return function(_0x1d3f03){if(_0x1d3f03){return _0x1d3f03[_0xe04d('0xf')](_0x53f59a)[_0xe04d('0x10')](function(_0x2f7f51){return _0x2f7f51;});}return null;};}function handleEntityNotFound(_0xa2521,_0xf205f5){return function(_0x143019){if(!_0x143019){_0xa2521[_0xe04d('0x11')](0x194);}return _0x143019;};}function handleError(_0x16b305,_0xbc5cc7){_0xbc5cc7=_0xbc5cc7||0x1f4;return function(_0x1aa69b){logger['error'](_0x1aa69b[_0xe04d('0x12')]);if(_0x1aa69b['name']){delete _0x1aa69b[_0xe04d('0x13')];}_0x16b305['status'](_0xbc5cc7)[_0xe04d('0x14')](_0x1aa69b);};}exports[_0xe04d('0x15')]=function(_0x4221aa,_0x93b107){var _0x4090e0={},_0x35a2b4={},_0x251772={'count':0x0,'rows':[]};var _0x399aa0=_[_0xe04d('0x16')](db['CmHopper'][_0xe04d('0x17')],function(_0x3e0fa9){return{'name':_0x3e0fa9[_0xe04d('0x18')],'type':_0x3e0fa9[_0xe04d('0x19')][_0xe04d('0x1a')]};});_0x35a2b4[_0xe04d('0x1b')]=_['map'](_0x399aa0,_0xe04d('0x13'));_0x35a2b4[_0xe04d('0x1c')]=_['keys'](_0x4221aa['query']);_0x35a2b4['filters']=_[_0xe04d('0x1d')](_0x35a2b4['model'],_0x35a2b4['query']);_0x35a2b4[_0xe04d('0x1e')]=_[_0xe04d('0x1f')](_0x35a2b4['filters'],[_0xe04d('0x20'),'$or',_0xe04d('0x21'),'$gte',_0xe04d('0x22'),_0xe04d('0x23'),_0xe04d('0x24'),_0xe04d('0x25'),_0xe04d('0x26'),'$between',_0xe04d('0x27'),_0xe04d('0x28'),_0xe04d('0x29'),_0xe04d('0x2a'),'$notLike',_0xe04d('0x2b'),_0xe04d('0x2c'),_0xe04d('0x2a'),'$overlap',_0xe04d('0x2d'),'$contained','$any']);_0x4090e0['attributes']=_[_0xe04d('0x1d')](_0x35a2b4[_0xe04d('0x1b')],qs['fields'](_0x4221aa['query'][_0xe04d('0x2e')]));_0x4090e0[_0xe04d('0x2f')]=_0x4090e0[_0xe04d('0x2f')]['length']?_0x4090e0[_0xe04d('0x2f')]:_0x35a2b4[_0xe04d('0x1b')];if(!_0x4221aa['query'][_0xe04d('0x30')]('nolimit')){_0x4090e0[_0xe04d('0xa')]=qs[_0xe04d('0xa')](_0x4221aa['query'][_0xe04d('0xa')]);_0x4090e0['offset']=qs[_0xe04d('0x8')](_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x8')]);}_0x4090e0[_0xe04d('0x31')]=qs[_0xe04d('0x32')](_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x32')]);_0x4090e0['where']=qs[_0xe04d('0x1e')](_[_0xe04d('0x33')](_0x4221aa[_0xe04d('0x1c')],_0x35a2b4[_0xe04d('0x1e')]),_0x399aa0);if(_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x34')]){_0x4090e0[_0xe04d('0x35')]=_[_0xe04d('0x36')](_0x4090e0[_0xe04d('0x35')],{'$or':_['map'](_0x399aa0,function(_0x151057){if(_0x151057['type']!==_0xe04d('0x37')){var _0x547f56={};_0x547f56[_0x151057['name']]={'$like':'%'+_0x4221aa[_0xe04d('0x1c')][_0xe04d('0x34')]+'%'};return _0x547f56;}})});}_0x4090e0=_[_0xe04d('0x36')]({},_0x4090e0,_0x4221aa[_0xe04d('0x38')]);var _0x56e74d={'where':_0x4090e0[_0xe04d('0x35')]};return db[_0xe04d('0x39')][_0xe04d('0xb')](_0x56e74d)[_0xe04d('0x10')](function(_0x322228){_0x251772['count']=_0x322228;if(_0x4221aa['query'][_0xe04d('0x3a')]){_0x4090e0['include']=[{'all':!![]}];}return db['CmHopper'][_0xe04d('0x3b')](_0x4090e0);})[_0xe04d('0x10')](function(_0x3a7320){_0x251772[_0xe04d('0x3c')]=_0x3a7320;return _0x251772;})['then'](respondWithFilteredResult(_0x93b107,_0x4090e0))['catch'](handleError(_0x93b107,null));};exports[_0xe04d('0x3d')]=function(_0x164b3f,_0x8bb80a){var _0x148a1b={'raw':!![],'where':{'id':_0x164b3f[_0xe04d('0x3e')]['id']}},_0x3f215d={};_0x3f215d['model']=_[_0xe04d('0x3f')](db['CmHopper'][_0xe04d('0x17')]);_0x3f215d[_0xe04d('0x1c')]=_[_0xe04d('0x3f')](_0x164b3f[_0xe04d('0x1c')]);_0x3f215d[_0xe04d('0x1e')]=_[_0xe04d('0x1d')](_0x3f215d[_0xe04d('0x1b')],_0x3f215d[_0xe04d('0x1c')]);_0x148a1b['attributes']=_[_0xe04d('0x1d')](_0x3f215d[_0xe04d('0x1b')],qs['fields'](_0x164b3f[_0xe04d('0x1c')]['fields']));_0x148a1b[_0xe04d('0x2f')]=_0x148a1b[_0xe04d('0x2f')]['length']?_0x148a1b[_0xe04d('0x2f')]:_0x3f215d[_0xe04d('0x1b')];if(_0x164b3f[_0xe04d('0x1c')][_0xe04d('0x3a')]){_0x148a1b[_0xe04d('0x40')]=[{'all':!![]}];}_0x148a1b=_[_0xe04d('0x36')]({},_0x148a1b,_0x164b3f[_0xe04d('0x38')]);return db[_0xe04d('0x39')][_0xe04d('0x41')](_0x148a1b)['then'](handleEntityNotFound(_0x8bb80a,null))['then'](respondWithResult(_0x8bb80a,null))['catch'](handleError(_0x8bb80a,null));};exports[_0xe04d('0x42')]=function(_0x4bf286,_0x1868bb){return db[_0xe04d('0x39')][_0xe04d('0x42')](_0x4bf286[_0xe04d('0x43')],{})[_0xe04d('0x10')](respondWithResult(_0x1868bb,0xc9))[_0xe04d('0x44')](handleError(_0x1868bb,null));};exports['update']=function(_0x24d976,_0x3d20ac){if(_0x24d976['body']['id']){delete _0x24d976['body']['id'];}return db[_0xe04d('0x39')][_0xe04d('0x41')]({'where':{'id':_0x24d976['params']['id']}})[_0xe04d('0x10')](handleEntityNotFound(_0x3d20ac,null))['then'](saveUpdates(_0x24d976[_0xe04d('0x43')],null))[_0xe04d('0x10')](respondWithResult(_0x3d20ac,null))[_0xe04d('0x44')](handleError(_0x3d20ac,null));};exports[_0xe04d('0x45')]=function(_0xa9d536,_0x3ed027){return db[_0xe04d('0x39')][_0xe04d('0x45')]()[_0xe04d('0x10')](respondWithResult(_0x3ed027,null))[_0xe04d('0x44')](handleError(_0x3ed027,null));};exports['destroy']=function(_0x52f4c5,_0x35e4cb){var _0x4b8822;var _0x5c4e24=_0x52f4c5['params']['id'];return db[_0xe04d('0x39')][_0xe04d('0x41')]({'where':{'id':_0x52f4c5[_0xe04d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x35e4cb,null))['then'](function(_0x1b239a){if(_0x1b239a){return _0x1b239a[_0xe04d('0x46')]()['then'](function(_0x5a57d2){return _0x5a57d2;});}})[_0xe04d('0x10')](function(_0x5c6dda){_0x4b8822=_0x5c6dda;if(_0x5c6dda){if(_0x5c6dda[_0xe04d('0x47')]||_0x5c6dda[_0xe04d('0x48')]){return db[_0x5c6dda[_0xe04d('0x47')]?_0xe04d('0x49'):_0xe04d('0x4a')][_0xe04d('0x41')]({'where':{'id':_0x5c6dda[_0xe04d('0x47')]?_0x5c6dda[_0xe04d('0x47')]:_0x5c6dda['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0xe04d('0x10')](function(_0x3fee58){var _0x3dd446={};if(_0x3fee58){_[_0xe04d('0x36')](_0x3dd446,_[_0xe04d('0x4b')](_0x4b8822['dataValues'],['createdAt',_0xe04d('0x4c'),'id']));_0x3dd446['state']=0x15;_0x3dd446['statedesc']=_0xe04d('0x4d');_0x3dd446['campaign']=_0x3fee58[_0xe04d('0x13')];_0x3dd446['membername']=_0x52f4c5[_0xe04d('0x4e')]['name'];_0x3dd446['UserId']=_0x52f4c5[_0xe04d('0x4e')]['id'];_0x3dd446[_0xe04d('0x4d')]=!![];_0x3dd446[_0xe04d('0x4f')]=moment()[_0xe04d('0x50')](_0xe04d('0x51'));_0x3dd446[_0xe04d('0x52')]=_0x4b8822[_0xe04d('0x53')];_0x3dd446[_0xe04d('0x54')]=_0x4b8822[_0xe04d('0x47')]?_0xe04d('0x55'):_0xe04d('0x56');return db['CmContact'][_0xe04d('0x41')]({'where':{'id':_0x3dd446[_0xe04d('0x57')]},'attributes':[_0xe04d('0x58'),'lastName']})[_0xe04d('0x10')](function(_0x48a753){if(!_[_0xe04d('0x59')](_0x35e4cb)&&!_[_0xe04d('0x59')](_0x48a753['firstName'])){_0x3dd446[_0xe04d('0x5a')]=_0x48a753[_0xe04d('0x58')];if(!_[_0xe04d('0x59')](_0x48a753['lastName'])){_0x3dd446[_0xe04d('0x5a')]+='\x20'+_0x48a753['lastName'];}}})[_0xe04d('0x5b')](function(){return db[_0xe04d('0x5c')][_0xe04d('0x42')](_0x3dd446);});}})[_0xe04d('0x10')](function(_0x5e6228){return db[_0xe04d('0x5d')]['destroy']({'where':{'CmHopperId':_0x5c4e24}});})[_0xe04d('0x10')](function(){return _0x35e4cb['status'](0xcc)[_0xe04d('0x5e')]();})[_0xe04d('0x44')](handleError(_0x35e4cb,null));};exports[_0xe04d('0x5f')]=function(_0x174143,_0x504fab){var _0x143909=[];return db['CmContact']['describe']()[_0xe04d('0x10')](function(_0x4195a1){_0x143909=_[_0xe04d('0x3f')](_0x4195a1);return _0x174143[_0xe04d('0x4e')]['getVoiceQueues']({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt',_0xe04d('0x60')],'raw':!![]});})[_0xe04d('0x10')](function(_0x4972d4){if(_0x4972d4&&_0x4972d4[_0xe04d('0x61')]){return db[_0xe04d('0x62')][_0xe04d('0x63')](function(_0x129397){var _0x45eda3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0xe04d('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x4972d4,'id')},'$or':[{'UserId':null},{'UserId':_0x174143[_0xe04d('0x4e')]['id']}]};var _0x5870e3={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4972d4)[_0xe04d('0x34')]([_0xe04d('0x60'),0x0])[_0xe04d('0x16')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x174143[_0xe04d('0x4e')]['id']}]};var _0x2434b4={'$or':[_0x45eda3,_0x5870e3]};var _0x143940=[];if(_0x174143[_0xe04d('0x43')][_0xe04d('0x64')]&&_0x174143[_0xe04d('0x43')][_0xe04d('0x64')]==='prev'){if(!_['isEmpty'](_0x174143[_0xe04d('0x43')][_0xe04d('0x65')])){_0x2434b4['id']={'$in':_0x174143[_0xe04d('0x43')][_0xe04d('0x65')]};}_0x143940=[['priority',_0xe04d('0x66')],[_0xe04d('0x67'),_0x4972d4[0x0][_0xe04d('0x68')]===_0xe04d('0x66')?'DESC':_0xe04d('0x66')],db[_0xe04d('0x62')]['literal'](_0xe04d('0x69')),['id',_0xe04d('0x6a')]];}else{if(!_[_0xe04d('0x6b')](_0x174143['body'][_0xe04d('0x65')])){_0x2434b4['id']={'$notIn':_0x174143[_0xe04d('0x43')][_0xe04d('0x65')]};}_0x143940=[[_0xe04d('0x6c'),_0xe04d('0x6a')],[_0xe04d('0x67'),_0x4972d4[0x0][_0xe04d('0x68')]],db[_0xe04d('0x62')][_0xe04d('0x6d')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0xe04d('0x66')]];}return db[_0xe04d('0x39')][_0xe04d('0x6e')]({'attributes':['id',_0xe04d('0x6f'),_0xe04d('0x53'),_0xe04d('0x70')],'where':_0x2434b4,'order':_0x143940,'transaction':_0x129397,'lock':_0x129397[_0xe04d('0x71')][_0xe04d('0x72')],'include':[{'model':db[_0xe04d('0x73')],'as':'Contact','attributes':_0x143909,'include':[{'model':db[_0xe04d('0x74')],'as':_0xe04d('0x75'),'attributes':['id','name']}]},{'model':db[_0xe04d('0x76')],'as':'List','attributes':['id','name']},{'model':db[_0xe04d('0x49')],'as':_0xe04d('0x77'),'attributes':['id',_0xe04d('0x13'),_0xe04d('0x78')]}]})[_0xe04d('0x10')](function(_0x5416f7){if(_0x5416f7){return _0x5416f7[_0xe04d('0xf')]({'UserId':_0x174143[_0xe04d('0x4e')]['id']},{'transaction':_0x129397});}});});}})['then'](handleEntityNotFound(_0x504fab,null))[_0xe04d('0x10')](respondWithResult(_0x504fab,null))['catch'](handleError(_0x504fab,null));};exports['getPreviewRecall']=function(_0x5f222e,_0x3370bf,_0x5a6d0d){var _0x18c3dc=[];var _0x58199f=_0x5f222e[_0xe04d('0x3e')]['id'];var _0x1d075e=_0x5f222e['user']['id'];return db[_0xe04d('0x73')]['describe']()[_0xe04d('0x10')](function(_0x5e2199){_0x18c3dc=_[_0xe04d('0x3f')](_0x5e2199);return db[_0xe04d('0x62')][_0xe04d('0x63')](function(_0x2a22c3){const _0xf49816={'id':_0x58199f};return db[_0xe04d('0x39')][_0xe04d('0x6e')]({'attributes':['id','scheduledat',_0xe04d('0x70')],'where':_0xf49816,'transaction':_0x2a22c3,'lock':_0x2a22c3['LOCK'][_0xe04d('0x72')],'include':[{'model':db[_0xe04d('0x73')],'as':'Contact','attributes':_0x18c3dc,'include':[{'model':db[_0xe04d('0x74')],'as':_0xe04d('0x75'),'attributes':['id',_0xe04d('0x13')]}]},{'model':db[_0xe04d('0x76')],'as':'List','attributes':['id',_0xe04d('0x13')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xe04d('0x13'),_0xe04d('0x78')]}]})[_0xe04d('0x10')](function(_0x2b68ad){if(_0x2b68ad){return _0x2b68ad[_0xe04d('0xf')]({'UserId':_0x1d075e},{'transaction':_0x2a22c3});}});});})[_0xe04d('0x10')](handleEntityNotFound(_0x3370bf,null))[_0xe04d('0x10')](respondWithResult(_0x3370bf,null))['catch'](handleError(_0x3370bf,null));};exports[_0xe04d('0x79')]=function(_0xc6d30e,_0x3727fe){return _0xc6d30e[_0xe04d('0x4e')][_0xe04d('0x7a')]({'where':{'type':_0xe04d('0x7b'),'dialActive':!![],'dialMethod':_0xe04d('0x7c')},'attributes':['id'],'raw':!![]})[_0xe04d('0x10')](function(_0x20cf56){if(_0x20cf56&&_0x20cf56[_0xe04d('0x61')]){return db[_0xe04d('0x39')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe04d('0x50')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xe04d('0x16')](_0x20cf56,'id')},'$or':[{'UserId':null},{'UserId':_0xc6d30e[_0xe04d('0x4e')]['id']}]}});}return 0x0;})[_0xe04d('0x10')](function(_0x40e0a9){if(!_[_0xe04d('0x59')](_0x40e0a9)&&_['isNumber'](_0x40e0a9)){return _0x3727fe['status'](0xc8)['json']({'contacts':_0x40e0a9});}else{logger['error'](_0xe04d('0x7d'),'getOpenContacts',0x194,_0xe04d('0x7e'));_0x3727fe['sendStatus'](0x194);}})[_0xe04d('0x44')](handleError(_0x3727fe,null));};exports[_0xe04d('0x7f')]=function(_0x5c5a07,_0x1afeeb){var _0xbc81af=shared['timezones'];var _0x5cec62=[];_['map'](_0xbc81af,function(_0x4ea198){_0x5cec62[_0xe04d('0x80')]({'id':_0x4ea198[_0xe04d('0x13')],'name':_0x4ea198['name'],'utcOffset':_0x4ea198[_0xe04d('0x81')]});});return _0x1afeeb[_0xe04d('0x7')](0xc8)[_0xe04d('0xe')]({'tz':_0x5cec62});};exports[_0xe04d('0x82')]=function(_0x36d086,_0x4676d7){var _0x1140ec=shared['timezones'];var _0x770284={};if(!_['isNil'](_0x1140ec[_0x36d086['body']['id']]))_0x770284=_0x1140ec[_0x36d086[_0xe04d('0x43')]['id']];return _0x4676d7[_0xe04d('0x7')](0xc8)[_0xe04d('0xe')](_0x770284);}; \ No newline at end of file +var _0x50a6=['CmHopperFinal','getPreview','CmContact','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','ASC','scheduledAt','dialOrderByScheduledAt','DESC','literal','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','UPDATE','Contact','CmCompany','Company','CmList','Queue','dialActive','scheduledat','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts','entity\x20not\x20found','getTimezones','timezones','moment','lodash','api','../../mysqldb','status','offset','limit','count','set','json','update','sendStatus','stack','name','rawAttributes','type','key','map','query','keys','intersection','filters','concat','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$iLike','$notILike','$contains','$contained','$any','attributes','model','fields','length','nolimit','order','where','pick','filter','merge','options','CmHopper','then','includeAll','include','findAll','catch','show','params','find','create','body','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ContactId','isNil','calleridname','lastName','finally'];(function(_0x4131c3,_0x3317b1){var _0x31b229=function(_0x5af9c8){while(--_0x5af9c8){_0x4131c3['push'](_0x4131c3['shift']());}};_0x31b229(++_0x3317b1);}(_0x50a6,0xa4));var _0x650a=function(_0x5e70f7,_0x344ec4){_0x5e70f7=_0x5e70f7-0x0;var _0x51aa64=_0x50a6[_0x5e70f7];return _0x51aa64;};'use strict';var moment=require(_0x650a('0x0'));var _=require(_0x650a('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x650a('0x2'));var shared=require('../../config/environment');var db=require(_0x650a('0x3'))['db'];function respondWithResult(_0x15dd02,_0x2c71ba){_0x2c71ba=_0x2c71ba||0xc8;return function(_0x4a0147){if(_0x4a0147){return _0x15dd02[_0x650a('0x4')](_0x2c71ba)['json'](_0x4a0147);}};}function respondWithFilteredResult(_0x4eabde,_0x2d486d){return function(_0x2d1bb4){if(_0x2d1bb4){var _0x2c22b9=typeof _0x2d486d[_0x650a('0x5')]==='undefined'&&typeof _0x2d486d[_0x650a('0x6')]==='undefined';var _0x3b50e7=_0x2d1bb4[_0x650a('0x7')];var _0x495fca=_0x2c22b9?0x0:_0x2d486d[_0x650a('0x5')];var _0x3bbdca=_0x2c22b9?_0x2d1bb4['count']:_0x2d486d[_0x650a('0x5')]+_0x2d486d['limit'];var _0x142cdb;if(_0x3bbdca>=_0x3b50e7){_0x3bbdca=_0x3b50e7;_0x142cdb=0xc8;}else{_0x142cdb=0xce;}_0x4eabde['status'](_0x142cdb);return _0x4eabde[_0x650a('0x8')]('Content-Range',_0x495fca+'-'+_0x3bbdca+'/'+_0x3b50e7)[_0x650a('0x9')](_0x2d1bb4);}return null;};}function saveUpdates(_0x48077a,_0x33e73d){return function(_0x163e5f){if(_0x163e5f){return _0x163e5f[_0x650a('0xa')](_0x48077a)['then'](function(_0x10fb8f){return _0x10fb8f;});}return null;};}function handleEntityNotFound(_0x3919a7,_0x2f727d){return function(_0x15f2fd){if(!_0x15f2fd){_0x3919a7[_0x650a('0xb')](0x194);}return _0x15f2fd;};}function handleError(_0x24f11f,_0x5b7c74){_0x5b7c74=_0x5b7c74||0x1f4;return function(_0x2460a3){logger['error'](_0x2460a3[_0x650a('0xc')]);if(_0x2460a3[_0x650a('0xd')]){delete _0x2460a3[_0x650a('0xd')];}_0x24f11f['status'](_0x5b7c74)['send'](_0x2460a3);};}exports['index']=function(_0x52e5bb,_0x2ad2d7){var _0x359314={},_0x41d2fa={},_0xd0f717={'count':0x0,'rows':[]};var _0x2a0f0c=_['map'](db['CmHopper'][_0x650a('0xe')],function(_0x1c65f6){return{'name':_0x1c65f6['fieldName'],'type':_0x1c65f6[_0x650a('0xf')][_0x650a('0x10')]};});_0x41d2fa['model']=_[_0x650a('0x11')](_0x2a0f0c,_0x650a('0xd'));_0x41d2fa[_0x650a('0x12')]=_[_0x650a('0x13')](_0x52e5bb[_0x650a('0x12')]);_0x41d2fa['filters']=_[_0x650a('0x14')](_0x41d2fa['model'],_0x41d2fa[_0x650a('0x12')]);_0x41d2fa[_0x650a('0x15')]=_[_0x650a('0x16')](_0x41d2fa[_0x650a('0x15')],[_0x650a('0x17'),_0x650a('0x18'),_0x650a('0x19'),_0x650a('0x1a'),_0x650a('0x1b'),_0x650a('0x1c'),_0x650a('0x1d'),_0x650a('0x1e'),_0x650a('0x1f'),_0x650a('0x20'),_0x650a('0x21'),_0x650a('0x22'),_0x650a('0x23'),_0x650a('0x24'),'$notLike',_0x650a('0x25'),_0x650a('0x26'),_0x650a('0x24'),'$overlap',_0x650a('0x27'),_0x650a('0x28'),_0x650a('0x29')]);_0x359314[_0x650a('0x2a')]=_[_0x650a('0x14')](_0x41d2fa[_0x650a('0x2b')],qs['fields'](_0x52e5bb[_0x650a('0x12')][_0x650a('0x2c')]));_0x359314[_0x650a('0x2a')]=_0x359314[_0x650a('0x2a')][_0x650a('0x2d')]?_0x359314[_0x650a('0x2a')]:_0x41d2fa[_0x650a('0x2b')];if(!_0x52e5bb[_0x650a('0x12')]['hasOwnProperty'](_0x650a('0x2e'))){_0x359314[_0x650a('0x6')]=qs[_0x650a('0x6')](_0x52e5bb['query'][_0x650a('0x6')]);_0x359314[_0x650a('0x5')]=qs['offset'](_0x52e5bb[_0x650a('0x12')][_0x650a('0x5')]);}_0x359314[_0x650a('0x2f')]=qs['sort'](_0x52e5bb['query']['sort']);_0x359314[_0x650a('0x30')]=qs[_0x650a('0x15')](_[_0x650a('0x31')](_0x52e5bb[_0x650a('0x12')],_0x41d2fa['filters']),_0x2a0f0c);if(_0x52e5bb[_0x650a('0x12')][_0x650a('0x32')]){_0x359314['where']=_[_0x650a('0x33')](_0x359314[_0x650a('0x30')],{'$or':_[_0x650a('0x11')](_0x2a0f0c,function(_0xd2256b){if(_0xd2256b[_0x650a('0xf')]!=='VIRTUAL'){var _0x14260e={};_0x14260e[_0xd2256b['name']]={'$like':'%'+_0x52e5bb[_0x650a('0x12')][_0x650a('0x32')]+'%'};return _0x14260e;}})});}_0x359314=_['merge']({},_0x359314,_0x52e5bb[_0x650a('0x34')]);var _0xa0e8ec={'where':_0x359314['where']};return db[_0x650a('0x35')][_0x650a('0x7')](_0xa0e8ec)[_0x650a('0x36')](function(_0x53179e){_0xd0f717[_0x650a('0x7')]=_0x53179e;if(_0x52e5bb[_0x650a('0x12')][_0x650a('0x37')]){_0x359314[_0x650a('0x38')]=[{'all':!![]}];}return db['CmHopper'][_0x650a('0x39')](_0x359314);})[_0x650a('0x36')](function(_0x2ace75){_0xd0f717['rows']=_0x2ace75;return _0xd0f717;})['then'](respondWithFilteredResult(_0x2ad2d7,_0x359314))[_0x650a('0x3a')](handleError(_0x2ad2d7,null));};exports[_0x650a('0x3b')]=function(_0x5b33c9,_0x1acbe5){var _0x48bdd4={'raw':!![],'where':{'id':_0x5b33c9[_0x650a('0x3c')]['id']}},_0x3ebe8b={};_0x3ebe8b[_0x650a('0x2b')]=_[_0x650a('0x13')](db[_0x650a('0x35')]['rawAttributes']);_0x3ebe8b[_0x650a('0x12')]=_['keys'](_0x5b33c9[_0x650a('0x12')]);_0x3ebe8b[_0x650a('0x15')]=_[_0x650a('0x14')](_0x3ebe8b[_0x650a('0x2b')],_0x3ebe8b[_0x650a('0x12')]);_0x48bdd4[_0x650a('0x2a')]=_[_0x650a('0x14')](_0x3ebe8b['model'],qs['fields'](_0x5b33c9[_0x650a('0x12')]['fields']));_0x48bdd4['attributes']=_0x48bdd4[_0x650a('0x2a')]['length']?_0x48bdd4[_0x650a('0x2a')]:_0x3ebe8b['model'];if(_0x5b33c9[_0x650a('0x12')][_0x650a('0x37')]){_0x48bdd4[_0x650a('0x38')]=[{'all':!![]}];}_0x48bdd4=_[_0x650a('0x33')]({},_0x48bdd4,_0x5b33c9[_0x650a('0x34')]);return db[_0x650a('0x35')][_0x650a('0x3d')](_0x48bdd4)[_0x650a('0x36')](handleEntityNotFound(_0x1acbe5,null))[_0x650a('0x36')](respondWithResult(_0x1acbe5,null))[_0x650a('0x3a')](handleError(_0x1acbe5,null));};exports[_0x650a('0x3e')]=function(_0x381632,_0x4ac78e){return db[_0x650a('0x35')][_0x650a('0x3e')](_0x381632[_0x650a('0x3f')],{})[_0x650a('0x36')](respondWithResult(_0x4ac78e,0xc9))[_0x650a('0x3a')](handleError(_0x4ac78e,null));};exports[_0x650a('0xa')]=function(_0x5b23b5,_0x2c692b){if(_0x5b23b5[_0x650a('0x3f')]['id']){delete _0x5b23b5[_0x650a('0x3f')]['id'];}return db[_0x650a('0x35')][_0x650a('0x3d')]({'where':{'id':_0x5b23b5[_0x650a('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2c692b,null))['then'](saveUpdates(_0x5b23b5[_0x650a('0x3f')],null))[_0x650a('0x36')](respondWithResult(_0x2c692b,null))[_0x650a('0x3a')](handleError(_0x2c692b,null));};exports['describe']=function(_0x16fc65,_0x5b360a){return db[_0x650a('0x35')][_0x650a('0x40')]()['then'](respondWithResult(_0x5b360a,null))[_0x650a('0x3a')](handleError(_0x5b360a,null));};exports[_0x650a('0x41')]=function(_0x39e8e6,_0x47ec0d){var _0x40f9eb;var _0x3e7cfc=_0x39e8e6[_0x650a('0x3c')]['id'];return db['CmHopper'][_0x650a('0x3d')]({'where':{'id':_0x39e8e6[_0x650a('0x3c')]['id']}})[_0x650a('0x36')](handleEntityNotFound(_0x47ec0d,null))[_0x650a('0x36')](function(_0x134cb5){if(_0x134cb5){return _0x134cb5['destroy']()['then'](function(_0x215f2e){return _0x215f2e;});}})[_0x650a('0x36')](function(_0x5b2907){_0x40f9eb=_0x5b2907;if(_0x5b2907){if(_0x5b2907[_0x650a('0x42')]||_0x5b2907[_0x650a('0x43')]){return db[_0x5b2907[_0x650a('0x42')]?_0x650a('0x44'):_0x650a('0x45')][_0x650a('0x3d')]({'where':{'id':_0x5b2907['VoiceQueueId']?_0x5b2907[_0x650a('0x42')]:_0x5b2907[_0x650a('0x43')]},'attributes':['id',_0x650a('0xd')],'raw':!![]});}}})[_0x650a('0x36')](function(_0xeb5d49){var _0x5206bf={};if(_0xeb5d49){_[_0x650a('0x33')](_0x5206bf,_[_0x650a('0x46')](_0x40f9eb[_0x650a('0x47')],[_0x650a('0x48'),'updatedAt','id']));_0x5206bf['state']=0x15;_0x5206bf[_0x650a('0x49')]=_0x650a('0x4a');_0x5206bf['campaign']=_0xeb5d49[_0x650a('0xd')];_0x5206bf[_0x650a('0x4b')]=_0x39e8e6[_0x650a('0x4c')][_0x650a('0xd')];_0x5206bf[_0x650a('0x4d')]=_0x39e8e6[_0x650a('0x4c')]['id'];_0x5206bf[_0x650a('0x4a')]=!![];_0x5206bf[_0x650a('0x4e')]=moment()[_0x650a('0x4f')](_0x650a('0x50'));_0x5206bf[_0x650a('0x51')]=_0x40f9eb[_0x650a('0x52')];_0x5206bf[_0x650a('0x53')]=_0x40f9eb[_0x650a('0x42')]?_0x650a('0x54'):'ivr';return db['CmContact'][_0x650a('0x3d')]({'where':{'id':_0x5206bf[_0x650a('0x55')]},'attributes':['firstName','lastName']})[_0x650a('0x36')](function(_0x56031a){if(!_[_0x650a('0x56')](_0x47ec0d)&&!_['isNil'](_0x56031a['firstName'])){_0x5206bf[_0x650a('0x57')]=_0x56031a['firstName'];if(!_[_0x650a('0x56')](_0x56031a[_0x650a('0x58')])){_0x5206bf['calleridname']+='\x20'+_0x56031a[_0x650a('0x58')];}}})[_0x650a('0x59')](function(){return db[_0x650a('0x5a')][_0x650a('0x3e')](_0x5206bf);});}})[_0x650a('0x36')](function(_0x2e7347){return db['CmHopperAdditionalPhone'][_0x650a('0x41')]({'where':{'CmHopperId':_0x3e7cfc}});})[_0x650a('0x36')](function(){return _0x47ec0d[_0x650a('0x4')](0xcc)['end']();})[_0x650a('0x3a')](handleError(_0x47ec0d,null));};exports[_0x650a('0x5b')]=function(_0x431ef9,_0x5920a6){var _0x581ead=[];return db[_0x650a('0x5c')][_0x650a('0x40')]()['then'](function(_0x2fa55b){_0x581ead=_[_0x650a('0x13')](_0x2fa55b);return _0x431ef9[_0x650a('0x4c')][_0x650a('0x5d')]({'where':{'type':_0x650a('0x5e'),'dialActive':!![],'dialMethod':_0x650a('0x5f')},'attributes':['id','dialOrderByScheduledAt',_0x650a('0x60')],'raw':!![]});})[_0x650a('0x36')](function(_0x19f11b){if(_0x19f11b&&_0x19f11b['length']){return db[_0x650a('0x61')][_0x650a('0x62')](function(_0x576834){var _0x2ca5c0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x650a('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x19f11b,'id')},'$or':[{'UserId':null},{'UserId':_0x431ef9[_0x650a('0x4c')]['id']}]};var _0x1564c0={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x19f11b)['filter']([_0x650a('0x60'),0x0])[_0x650a('0x11')]('id')[_0x650a('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x431ef9[_0x650a('0x4c')]['id']}]};var _0x3205e4={'$or':[_0x2ca5c0,_0x1564c0]};var _0x3bd508=[];if(_0x431ef9[_0x650a('0x3f')][_0x650a('0x64')]&&_0x431ef9[_0x650a('0x3f')][_0x650a('0x64')]===_0x650a('0x65')){if(!_[_0x650a('0x66')](_0x431ef9[_0x650a('0x3f')]['hopperIds'])){_0x3205e4['id']={'$in':_0x431ef9['body'][_0x650a('0x67')]};}_0x3bd508=[['priority',_0x650a('0x68')],[_0x650a('0x69'),_0x19f11b[0x0][_0x650a('0x6a')]===_0x650a('0x68')?_0x650a('0x6b'):_0x650a('0x68')],db['sequelize'][_0x650a('0x6c')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x650a('0x6b')]];}else{if(!_[_0x650a('0x66')](_0x431ef9[_0x650a('0x3f')][_0x650a('0x67')])){_0x3205e4['id']={'$notIn':_0x431ef9[_0x650a('0x3f')]['hopperIds']};}_0x3bd508=[[_0x650a('0x6d'),_0x650a('0x6b')],[_0x650a('0x69'),_0x19f11b[0x0][_0x650a('0x6a')]],db[_0x650a('0x61')][_0x650a('0x6c')](_0x650a('0x6e')),['id',_0x650a('0x68')]];}return db[_0x650a('0x35')][_0x650a('0x6f')]({'attributes':['id','scheduledat','phone','recallme'],'where':_0x3205e4,'order':_0x3bd508,'transaction':_0x576834,'lock':_0x576834[_0x650a('0x70')][_0x650a('0x71')],'include':[{'model':db['CmContact'],'as':_0x650a('0x72'),'attributes':_0x581ead,'include':[{'model':db[_0x650a('0x73')],'as':_0x650a('0x74'),'attributes':['id','name']}]},{'model':db[_0x650a('0x75')],'as':'List','attributes':['id',_0x650a('0xd')]},{'model':db[_0x650a('0x44')],'as':_0x650a('0x76'),'attributes':['id',_0x650a('0xd'),_0x650a('0x77')]}]})['then'](function(_0x5e0dd7){if(_0x5e0dd7){return _0x5e0dd7[_0x650a('0xa')]({'UserId':_0x431ef9[_0x650a('0x4c')]['id']},{'transaction':_0x576834});}});});}})[_0x650a('0x36')](handleEntityNotFound(_0x5920a6,null))['then'](respondWithResult(_0x5920a6,null))[_0x650a('0x3a')](handleError(_0x5920a6,null));};exports['getPreviewRecall']=function(_0x4c29ba,_0x3767e1,_0x409f8b){var _0x383fb3=[];var _0x39b2d2=_0x4c29ba[_0x650a('0x3c')]['id'];var _0x50dfbb=_0x4c29ba[_0x650a('0x4c')]['id'];return db[_0x650a('0x5c')][_0x650a('0x40')]()['then'](function(_0x537688){_0x383fb3=_[_0x650a('0x13')](_0x537688);return db['sequelize']['transaction'](function(_0x48b3f4){const _0x14211e={'id':_0x39b2d2};return db['CmHopper']['findOne']({'attributes':['id',_0x650a('0x78'),'recallme'],'where':_0x14211e,'transaction':_0x48b3f4,'lock':_0x48b3f4[_0x650a('0x70')]['UPDATE'],'include':[{'model':db[_0x650a('0x5c')],'as':_0x650a('0x72'),'attributes':_0x383fb3,'include':[{'model':db[_0x650a('0x73')],'as':_0x650a('0x74'),'attributes':['id','name']}]},{'model':db[_0x650a('0x75')],'as':'List','attributes':['id','name']},{'model':db[_0x650a('0x44')],'as':_0x650a('0x76'),'attributes':['id',_0x650a('0xd'),_0x650a('0x77')]}]})[_0x650a('0x36')](function(_0x7701cc){if(_0x7701cc){return _0x7701cc['update']({'UserId':_0x50dfbb},{'transaction':_0x48b3f4});}});});})[_0x650a('0x36')](handleEntityNotFound(_0x3767e1,null))[_0x650a('0x36')](respondWithResult(_0x3767e1,null))[_0x650a('0x3a')](handleError(_0x3767e1,null));};exports['getOpenContacts']=function(_0x13e6fe,_0x1fec64){return _0x13e6fe[_0x650a('0x4c')][_0x650a('0x5d')]({'where':{'type':_0x650a('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x650a('0x36')](function(_0x2e62f3){if(_0x2e62f3&&_0x2e62f3['length']){return db[_0x650a('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x650a('0x50'))},'VoiceQueueId':{'$in':_[_0x650a('0x11')](_0x2e62f3,'id')},'$or':[{'UserId':null},{'UserId':_0x13e6fe['user']['id']}]}});}return 0x0;})[_0x650a('0x36')](function(_0x446c6f){if(!_[_0x650a('0x56')](_0x446c6f)&&_[_0x650a('0x79')](_0x446c6f)){return _0x1fec64[_0x650a('0x4')](0xc8)[_0x650a('0x9')]({'contacts':_0x446c6f});}else{logger['error'](_0x650a('0x7a'),_0x650a('0x7b'),0x194,_0x650a('0x7c'));_0x1fec64[_0x650a('0xb')](0x194);}})[_0x650a('0x3a')](handleError(_0x1fec64,null));};exports[_0x650a('0x7d')]=function(_0x5631bf,_0x16e596){var _0xcf6cb3=shared[_0x650a('0x7e')];var _0x2fb487=[];_[_0x650a('0x11')](_0xcf6cb3,function(_0x273943){_0x2fb487['push']({'id':_0x273943[_0x650a('0xd')],'name':_0x273943[_0x650a('0xd')],'utcOffset':_0x273943['utcOffset']});});return _0x16e596[_0x650a('0x4')](0xc8)[_0x650a('0x9')]({'tz':_0x2fb487});};exports['getTimezone']=function(_0x47e6a6,_0x5dd509){var _0x137bdd=shared[_0x650a('0x7e')];var _0x20780e={};if(!_['isNil'](_0x137bdd[_0x47e6a6[_0x650a('0x3f')]['id']]))_0x20780e=_0x137bdd[_0x47e6a6[_0x650a('0x3f')]['id']];return _0x5dd509[_0x650a('0x4')](0xc8)[_0x650a('0x9')](_0x20780e);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 083bbbe..1e0032f 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 _0xc6ac=['./cmHopper.attributes','exports','CmHopper','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x44d42b,_0x5612ed){_0x44d42b=_0x44d42b-0x0;var _0x56aed7=_0xc6ac[_0x44d42b];return _0x56aed7;};'use strict';var _=require(_0xcc6a('0x0'));var util=require(_0xcc6a('0x1'));var logger=require(_0xcc6a('0x2'))(_0xcc6a('0x3'));var moment=require(_0xcc6a('0x4'));var BPromise=require(_0xcc6a('0x5'));var rp=require(_0xcc6a('0x6'));var fs=require('fs');var path=require(_0xcc6a('0x7'));var rimraf=require(_0xcc6a('0x8'));var config=require(_0xcc6a('0x9'));var attributes=require(_0xcc6a('0xa'));module[_0xcc6a('0xb')]=function(_0x12330e,_0x197bd7){return _0x12330e['define'](_0xcc6a('0xc'),attributes,{'tableName':_0xcc6a('0xd'),'paranoid':![],'indexes':[{'name':_0xcc6a('0xe'),'fields':['scheduledat']},{'name':_0xcc6a('0xf'),'fields':[_0xcc6a('0xf')]},{'name':_0xcc6a('0x10'),'fields':[_0xcc6a('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api','moment','bluebird'];(function(_0x20e863,_0x366d98){var _0x5c6f10=function(_0x544902){while(--_0x544902){_0x20e863['push'](_0x20e863['shift']());}};_0x5c6f10(++_0x366d98);}(_0x33af,0xec));var _0xf33a=function(_0x229a03,_0x36fefc){_0x229a03=_0x229a03-0x0;var _0x2d6e11=_0x33af[_0x229a03];return _0x2d6e11;};'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'));module[_0xf33a('0x8')]=function(_0x583e54,_0xc0dd13){return _0x583e54[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('0xb'),'paranoid':![],'indexes':[{'name':_0xf33a('0xc'),'fields':[_0xf33a('0xc')]},{'name':'phone','fields':[_0xf33a('0xd')]},{'name':_0xf33a('0xe'),'fields':[_0xf33a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 5bbcfb3..1b1682d 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 _0x459c=['message','find','ShowCmHopper','CreateCmHopper','create','debug','update','body','UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','includes','push','dataValues','ContactId','MoveContactManagedDialer','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','literal','NOW()','util','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','raw','options','where','attributes','limit','include','model','map','then','info','stringify','catch','error'];(function(_0x51dc5c,_0x551ae8){var _0x3d0e41=function(_0x217efa){while(--_0x217efa){_0x51dc5c['push'](_0x51dc5c['shift']());}};_0x3d0e41(++_0x551ae8);}(_0x459c,0x12b));var _0xc459=function(_0x423db6,_0x2b5597){_0x423db6=_0x423db6-0x0;var _0x3f8b22=_0x459c[_0x423db6];return _0x3f8b22;};'use strict';var _=require('lodash');var util=require(_0xc459('0x0'));var moment=require('moment');var BPromise=require(_0xc459('0x1'));var db=require(_0xc459('0x2'))['db'];var logger=require(_0xc459('0x3'))(_0xc459('0x4'));exports[_0xc459('0x5')]=function(_0x23fd3c){var _0xaf1655=this;return new Promise(function(_0x14bdb6,_0x58493e){return db[_0xc459('0x6')][_0xc459('0x7')]({'raw':_0x23fd3c['options']?_0x23fd3c['options'][_0xc459('0x8')]===undefined?!![]:![]:!![],'where':_0x23fd3c[_0xc459('0x9')]?_0x23fd3c[_0xc459('0x9')][_0xc459('0xa')]||null:null,'attributes':_0x23fd3c[_0xc459('0x9')]?_0x23fd3c[_0xc459('0x9')][_0xc459('0xb')]||null:null,'limit':_0x23fd3c['options']?_0x23fd3c[_0xc459('0x9')][_0xc459('0xc')]||null:null,'include':_0x23fd3c[_0xc459('0x9')]?_0x23fd3c['options'][_0xc459('0xd')]?_['map'](_0x23fd3c[_0xc459('0x9')]['include'],function(_0xc4cd91){return{'model':db[_0xc4cd91[_0xc459('0xe')]],'as':_0xc4cd91['as'],'attributes':_0xc4cd91[_0xc459('0xb')],'include':_0xc4cd91['include']?_[_0xc459('0xf')](_0xc4cd91['include'],function(_0x46577c){return{'model':db[_0x46577c['model']],'as':_0x46577c['as'],'attributes':_0x46577c[_0xc459('0xb')],'include':_0x46577c[_0xc459('0xd')]?_[_0xc459('0xf')](_0x46577c[_0xc459('0xd')],function(_0x5b3c92){return{'model':db[_0x5b3c92[_0xc459('0xe')]],'as':_0x5b3c92['as'],'attributes':_0x5b3c92['attributes']};}):[]};}):[]};}):[]:[]})[_0xc459('0x10')](function(_0x4b6099){logger[_0xc459('0x11')](_0xc459('0x5'),_0x23fd3c);logger['debug'](_0xc459('0x5'),_0x23fd3c,JSON[_0xc459('0x12')](_0x4b6099));_0x14bdb6(_0x4b6099);})[_0xc459('0x13')](function(_0x49ace2){logger['error'](_0xc459('0x5'),_0x49ace2['message'],_0x23fd3c);_0x58493e(_0xaf1655[_0xc459('0x14')](0x1f4,_0x49ace2[_0xc459('0x15')]));});});};exports['ShowCmHopper']=function(_0x55e2f0){var _0x63848b=this;return new Promise(function(_0x312a8b,_0xa7752e){return db['CmHopper'][_0xc459('0x16')]({'raw':_0x55e2f0[_0xc459('0x9')]?_0x55e2f0[_0xc459('0x9')][_0xc459('0x8')]===undefined?!![]:![]:!![],'where':_0x55e2f0['options']?_0x55e2f0[_0xc459('0x9')][_0xc459('0xa')]||null:null,'attributes':_0x55e2f0[_0xc459('0x9')]?_0x55e2f0['options'][_0xc459('0xb')]||null:null,'include':_0x55e2f0[_0xc459('0x9')]?_0x55e2f0[_0xc459('0x9')][_0xc459('0xd')]?_[_0xc459('0xf')](_0x55e2f0['options'][_0xc459('0xd')],function(_0x4ec160){return{'model':db[_0x4ec160['model']],'as':_0x4ec160['as'],'attributes':_0x4ec160[_0xc459('0xb')],'include':_0x4ec160[_0xc459('0xd')]?_[_0xc459('0xf')](_0x4ec160['include'],function(_0x5f535c){return{'model':db[_0x5f535c[_0xc459('0xe')]],'as':_0x5f535c['as'],'attributes':_0x5f535c[_0xc459('0xb')],'include':_0x5f535c[_0xc459('0xd')]?_[_0xc459('0xf')](_0x5f535c['include'],function(_0x2ab81d){return{'model':db[_0x2ab81d[_0xc459('0xe')]],'as':_0x2ab81d['as'],'attributes':_0x2ab81d[_0xc459('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc459('0x10')](function(_0x301064){logger[_0xc459('0x11')]('ShowCmHopper',_0x55e2f0);logger['debug'](_0xc459('0x17'),_0x55e2f0,JSON['stringify'](_0x301064));_0x312a8b(_0x301064);})[_0xc459('0x13')](function(_0x593d91){logger[_0xc459('0x14')](_0xc459('0x17'),_0x593d91[_0xc459('0x15')],_0x55e2f0);_0xa7752e(_0x63848b[_0xc459('0x14')](0x1f4,_0x593d91[_0xc459('0x15')]));});});};exports[_0xc459('0x18')]=function(_0x3c8617){var _0x1d4028=this;return new Promise(function(_0x307cb8,_0x43e88a){return db[_0xc459('0x6')][_0xc459('0x19')](_0x3c8617['body'],{'raw':_0x3c8617[_0xc459('0x9')]?_0x3c8617[_0xc459('0x9')][_0xc459('0x8')]===undefined?!![]:![]:!![]})[_0xc459('0x10')](function(_0x3f0eca){logger['info'](_0xc459('0x18'),_0x3c8617);logger[_0xc459('0x1a')]('CreateCmHopper',_0x3c8617,JSON[_0xc459('0x12')](_0x3f0eca));_0x307cb8(_0x3f0eca);})[_0xc459('0x13')](function(_0x1ba1f1){logger[_0xc459('0x14')](_0xc459('0x18'),_0x1ba1f1[_0xc459('0x15')],_0x3c8617);_0x43e88a(_0x1d4028[_0xc459('0x14')](0x1f4,_0x1ba1f1['message']));});});};exports['UpdateCmHopper']=function(_0x23ae76){var _0x50037f=this;return new Promise(function(_0x176574,_0x14181b){return db['CmHopper'][_0xc459('0x1b')](_0x23ae76[_0xc459('0x1c')],{'raw':_0x23ae76['options']?_0x23ae76[_0xc459('0x9')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23ae76['options']?_0x23ae76['options']['where']||null:null,'attributes':_0x23ae76[_0xc459('0x9')]?_0x23ae76[_0xc459('0x9')][_0xc459('0xb')]||null:null,'limit':_0x23ae76[_0xc459('0x9')]?_0x23ae76[_0xc459('0x9')]['limit']||null:null})[_0xc459('0x10')](function(_0x5d9327){logger[_0xc459('0x11')](_0xc459('0x1d'),_0x23ae76);logger[_0xc459('0x11')](_0xc459('0x1e'),JSON[_0xc459('0x12')](_0x23ae76['options'][_0xc459('0xa')]),_0x23ae76[_0xc459('0x1c')][_0xc459('0x1f')]);logger[_0xc459('0x1a')](_0xc459('0x1d'),_0x23ae76,JSON[_0xc459('0x12')](_0x5d9327));_0x176574(_0x5d9327);})['catch'](function(_0x4f008f){logger[_0xc459('0x14')](_0xc459('0x1d'),_0x4f008f['message'],_0x23ae76);_0x14181b(_0x50037f[_0xc459('0x14')](0x1f4,_0x4f008f[_0xc459('0x15')]));});});};exports[_0xc459('0x20')]=function(_0x28b2a6){var _0x470a53=this;return new Promise(function(_0x144b8a,_0x289997){return db[_0xc459('0x6')][_0xc459('0x21')]({'where':_0x28b2a6[_0xc459('0x9')]?_0x28b2a6[_0xc459('0x9')][_0xc459('0xa')]||null:null})['then'](function(_0x102b4d){logger[_0xc459('0x11')]('DestroyCmHopper',_0x28b2a6);logger[_0xc459('0x1a')]('DestroyCmHopper',_0x28b2a6,JSON[_0xc459('0x12')](_0x102b4d));_0x144b8a(_0x102b4d);})[_0xc459('0x13')](function(_0x48f101){logger[_0xc459('0x14')](_0xc459('0x20'),_0x48f101['message'],_0x28b2a6);_0x289997(_0x470a53['error'](0x1f4,_0x48f101[_0xc459('0x15')]));});});};exports[_0xc459('0x22')]=function(_0x44e08e){var _0x43a550=this;return new Promise(function(_0x2adf90,_0x128cf5){return db[_0xc459('0x23')][_0xc459('0x24')]()['then'](function(_0x4839e1){return db[_0xc459('0x25')][_0xc459('0x26')](function(_0x464da3){return db['CmHopper'][_0xc459('0x7')]({'where':_0x44e08e['options']?_0x44e08e['options'][_0xc459('0xa')]||null:null,'attributes':_0x44e08e[_0xc459('0x9')]?_0x44e08e['options'][_0xc459('0xb')]||null:null,'limit':_0x44e08e[_0xc459('0x9')]?_0x44e08e[_0xc459('0x9')]['limit']||null:null,'order':_0x44e08e[_0xc459('0x9')]?_0x44e08e[_0xc459('0x9')][_0xc459('0x27')]||null:null,'transaction':_0x464da3,'lock':_0x464da3[_0xc459('0x28')][_0xc459('0x29')],'include':[{'model':db[_0xc459('0x23')],'as':_0xc459('0x2a'),'attributes':_['keys'](_0x4839e1)},{'model':db[_0xc459('0x2b')],'as':_0xc459('0x2c'),'attributes':['id',_0xc459('0x2d'),_0xc459('0x2e')]}]})[_0xc459('0x10')](function(_0x4e77c5){var _0x58f0bd=[];var _0x3e07fe=[];for(var _0xb2c1a2=0x0;_0xb2c1a2<_0x4e77c5[_0xc459('0x2f')];_0xb2c1a2+=0x1){var _0x35389c=_0x4e77c5[_0xb2c1a2]['UserId'];if(_0x35389c===null){_0x58f0bd['push'](_0x4e77c5[_0xb2c1a2][_0xc459('0x1b')](_0x44e08e[_0xc459('0x1c')],{'transaction':_0x464da3}));}else if(!_0x3e07fe[_0xc459('0x30')](_0x35389c)){_0x3e07fe[_0xc459('0x31')](_0x35389c);_0x58f0bd[_0xc459('0x31')](_0x4e77c5[_0xb2c1a2]['update'](_0x44e08e['body'],{'transaction':_0x464da3}));}}return BPromise['all'](_0x58f0bd);});})['then'](function(_0x31d868){logger[_0xc459('0x11')]('GetContactDialer',_0x44e08e);if(_0x31d868[_0xc459('0x2f')]>0x0){logger['info']('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x31d868[0x0][_0xc459('0x32')]['id'],_0x31d868[0x0]['dataValues'][_0xc459('0x33')],_0x31d868[0x0][_0xc459('0x32')]['active']);}logger[_0xc459('0x1a')](_0xc459('0x22'),_0x44e08e,JSON[_0xc459('0x12')](_0x31d868));_0x2adf90(_0x31d868);})['catch'](function(_0x31693f){logger[_0xc459('0x14')]('GetContactDialer',_0x31693f[_0xc459('0x15')],_0x44e08e);_0x128cf5(_0x43a550[_0xc459('0x14')](0x1f4,_0x31693f[_0xc459('0x15')]));});});});};exports[_0xc459('0x34')]=function(_0x1f8b7c){var _0x2c3c5f=this;return new Promise(function(_0x1be21c,_0x4811c0){return db[_0xc459('0x25')][_0xc459('0x26')](function(_0x2b25ab){return db['CmHopperFinal'][_0xc459('0x19')](_0x1f8b7c['body'],{'raw':_0x1f8b7c['options']?_0x1f8b7c[_0xc459('0x9')][_0xc459('0x8')]===undefined?!![]:![]:!![],'transaction':_0x2b25ab})[_0xc459('0x10')](function(){logger[_0xc459('0x11')](_0xc459('0x35'),JSON[_0xc459('0x12')](_0x1f8b7c[_0xc459('0x9')][_0xc459('0xa')]),_0x1f8b7c[_0xc459('0x9')][_0xc459('0xa')]['active']);return db[_0xc459('0x6')][_0xc459('0x21')]({'where':_0x1f8b7c[_0xc459('0x9')]?_0x1f8b7c['options']['where']||null:null,'transaction':_0x2b25ab});});})[_0xc459('0x10')](function(_0x42a5ac){logger[_0xc459('0x11')](_0xc459('0x34'),_0x1f8b7c);logger[_0xc459('0x1a')](_0xc459('0x34'),_0x1f8b7c,JSON[_0xc459('0x12')](_0x42a5ac));_0x1be21c(_0x42a5ac);})[_0xc459('0x13')](function(_0x53abc0){logger[_0xc459('0x14')]('MoveContactManagedDialer',_0x53abc0['message'],_0x1f8b7c);_0x4811c0(_0x2c3c5f[_0xc459('0x14')](0x1f4,_0x53abc0[_0xc459('0x15')]));});});};exports[_0xc459('0x36')]=function(_0x59e932){var _0x45b6f8=this;return new Promise(function(_0x20ae93,_0x32d6ac){return db[_0xc459('0x6')][_0xc459('0x7')]({'raw':_0x59e932[_0xc459('0x9')]?_0x59e932[_0xc459('0x9')][_0xc459('0x8')]===undefined?!![]:![]:!![],'where':_0x59e932[_0xc459('0x9')]?_0x59e932['options'][_0xc459('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc459('0x37'),db['sequelize']['fn']('IF',db[_0xc459('0x25')]['literal'](_0xc459('0x38')+util[_0xc459('0x39')](_0xc459('0x3a'),moment()[_0xc459('0x39')](_0xc459('0x3b')))+_0xc459('0x3c')))),_0xc459('0x3d')]]})[_0xc459('0x10')](function(_0x2e387a){logger[_0xc459('0x11')](_0xc459('0x36'),_0x59e932);logger[_0xc459('0x1a')](_0xc459('0x36'),_0x59e932,JSON[_0xc459('0x12')](_0x2e387a));_0x20ae93(_0x2e387a);})[_0xc459('0x13')](function(_0x306a74){logger[_0xc459('0x14')](_0xc459('0x36'),_0x306a74['message'],_0x59e932);_0x32d6ac(_0x45b6f8['error'](0x1f4,_0x306a74[_0xc459('0x15')]));});});};exports[_0xc459('0x3e')]=function(_0x4c8f12){var _0xf3602e=this;return new Promise(function(_0x593c04,_0x475968){return db[_0xc459('0x23')][_0xc459('0x24')]()[_0xc459('0x10')](function(){return db[_0xc459('0x25')]['transaction'](function(_0x38c6e9){return db['CmHopper'][_0xc459('0x7')]({'where':_0x4c8f12['options']?_0x4c8f12[_0xc459('0x9')]['where']||null:null,'attributes':_0x4c8f12[_0xc459('0x9')]?_0x4c8f12['options']['attributes']||null:null,'limit':0x1,'order':_0x4c8f12[_0xc459('0x9')]?_0x4c8f12[_0xc459('0x9')][_0xc459('0x27')]||null:null,'group':db[_0xc459('0x6')][_0xc459('0x3f')],'transaction':_0x38c6e9,'lock':_0x38c6e9[_0xc459('0x28')]['UPDATE'],'include':_0x4c8f12[_0xc459('0x9')]?_0x4c8f12['options'][_0xc459('0xd')]?_[_0xc459('0xf')](_0x4c8f12[_0xc459('0x9')][_0xc459('0xd')],function(_0x4ea77f){return{'model':db[_0x4ea77f[_0xc459('0xe')]],'as':_0x4ea77f['as'],'attributes':_0x4ea77f[_0xc459('0xb')],'include':_0x4ea77f['include']?_['map'](_0x4ea77f[_0xc459('0xd')],function(_0x166811){return{'model':db[_0x166811['model']],'as':_0x166811['as'],'attributes':_0x166811[_0xc459('0xb')],'include':_0x166811[_0xc459('0xd')]?_[_0xc459('0xf')](_0x166811[_0xc459('0xd')],function(_0x3fcc7f){return{'model':db[_0x3fcc7f['model']],'as':_0x3fcc7f['as'],'attributes':_0x3fcc7f['attributes']};}):[]};}):[]};}):[]:[]})[_0xc459('0x10')](function(_0x48ab0f){var _0x36d603=[];for(var _0x58ed8f=0x0;_0x58ed8f<_0x48ab0f[_0xc459('0x2f')];_0x58ed8f+=0x1){_0x36d603[_0xc459('0x31')](_0x48ab0f[_0x58ed8f][_0xc459('0x1b')](_0x4c8f12['body'],{'transaction':_0x38c6e9}));}return BPromise['all'](_0x36d603);});})[_0xc459('0x10')](function(_0x406bf9){logger[_0xc459('0x11')]('GetContactRecallMe',_0x4c8f12);logger['debug'](_0xc459('0x3e'),_0x4c8f12,JSON[_0xc459('0x12')](_0x406bf9));_0x593c04(_0x406bf9);})[_0xc459('0x13')](function(_0x1ecd8f){logger[_0xc459('0x14')](_0xc459('0x3e'),_0x1ecd8f[_0xc459('0x15')],_0x4c8f12);_0x475968(_0xf3602e[_0xc459('0x14')](0x1f4,_0x1ecd8f[_0xc459('0x15')]));});});});};exports[_0xc459('0x40')]=function(_0x1d9c0a){var _0x16b646=this;return new Promise(function(_0x13e0df,_0x53a09e){db[_0xc459('0x23')]['describe']()[_0xc459('0x10')](function(_0x1aecaa){return db[_0xc459('0x6')]['findAll']({'raw':_0x1d9c0a['options']?_0x1d9c0a[_0xc459('0x9')][_0xc459('0x8')]===undefined?!![]:![]:!![],'where':_0x1d9c0a[_0xc459('0x9')]?_0x1d9c0a[_0xc459('0x9')][_0xc459('0xa')]||null:null,'attributes':_0x1d9c0a[_0xc459('0x9')]?_0x1d9c0a[_0xc459('0x9')][_0xc459('0xb')]||null:null,'limit':_0x1d9c0a[_0xc459('0x9')]?_0x1d9c0a['options'][_0xc459('0xc')]||null:null,'include':_0x1d9c0a[_0xc459('0x9')]?_0x1d9c0a['options'][_0xc459('0xd')]?_[_0xc459('0xf')](_0x1d9c0a[_0xc459('0x9')][_0xc459('0xd')],function(_0x3a4abb){return{'model':db[_0x3a4abb[_0xc459('0xe')]],'as':_0x3a4abb['as'],'attributes':_0x3a4abb['as']===_0xc459('0x2a')?_[_0xc459('0x41')](_0x1aecaa):_0x3a4abb['attributes'],'include':_0x3a4abb[_0xc459('0xd')]?_[_0xc459('0xf')](_0x3a4abb['include'],function(_0x595e31){return{'model':db[_0x595e31[_0xc459('0xe')]],'as':_0x595e31['as'],'attributes':_0x595e31['attributes'],'include':_0x595e31[_0xc459('0xd')]?_[_0xc459('0xf')](_0x595e31['include'],function(_0x12b1bc){return{'model':db[_0x12b1bc[_0xc459('0xe')]],'as':_0x12b1bc['as'],'attributes':_0x12b1bc[_0xc459('0xb')]};}):[]};}):[]};}):[]:[]})[_0xc459('0x10')](function(_0x420f5d){logger[_0xc459('0x11')]('GetCmHopper',_0x1d9c0a);logger[_0xc459('0x1a')](_0xc459('0x5'),_0x1d9c0a,JSON['stringify'](_0x420f5d));_0x13e0df(_0x420f5d);})[_0xc459('0x13')](function(_0x6c958d){logger['error'](_0xc459('0x5'),_0x6c958d['message'],_0x1d9c0a);_0x53a09e(_0x16b646[_0xc459('0x14')](0x1f4,_0x6c958d[_0xc459('0x15')]));});});});};exports[_0xc459('0x42')]=function(_0xb3e3b8){var _0x456df9=this;return new Promise(function(_0x13a003,_0x2f482e){return db['CmContact'][_0xc459('0x43')]({'raw':!![],'where':{'phone':_0xb3e3b8['options'][_0xc459('0xa')][_0xc459('0x44')]},'attributes':['id',_0xc459('0x45')],'order':[['id','DESC']]})[_0xc459('0x10')](function(_0x9f76d6){logger[_0xc459('0x11')](_0xc459('0x46'),_0xb3e3b8);logger['debug'](_0xc459('0x46'),_0xb3e3b8,JSON[_0xc459('0x12')](_0x9f76d6));_0x13a003(_0x9f76d6);})[_0xc459('0x13')](function(_0x5e61fd){logger[_0xc459('0x14')](_0xc459('0x46'),_0x5e61fd['message'],_0xb3e3b8);_0x2f482e(_0x456df9['error'](0x1f4,_0x5e61fd[_0xc459('0x15')]));});});};exports[_0xc459('0x47')]=function(_0x55f0ff){var _0x3f6293=this;return new Promise(function(_0x50b74c,_0x3e4330){return db[_0xc459('0x25')][_0xc459('0x26')](function(_0xcc511a){var _0x5a34db=_0x55f0ff[_0xc459('0x9')]&&_0x55f0ff[_0xc459('0x9')]['where']?_0x55f0ff[_0xc459('0x9')][_0xc459('0xa')]:{};return db[_0xc459('0x6')]['update'](_0x55f0ff['body'],{'where':_0x5a34db,'transaction':_0xcc511a})[_0xc459('0x10')](function(_0xdfecc2){logger[_0xc459('0x11')]('ResetActiveCalls',_0x55f0ff);logger[_0xc459('0x1a')](_0xc459('0x47'),_0x55f0ff,JSON['stringify'](_0xdfecc2));_0x50b74c(_0xdfecc2);})[_0xc459('0x13')](function(_0x563c59){logger['error']('ResetActiveCalls',_0x563c59['message'],_0x55f0ff);_0x3e4330(_0x3f6293['error'](0x1f4,_0x563c59[_0xc459('0x15')]));});});});};exports[_0xc459('0x48')]=function(_0x376e66){var _0x1a90ea=this;var _0x40734b=_0x376e66[_0xc459('0x1c')]['where'][_0xc459('0x49')];var _0xbabdb4=_0x376e66[_0xc459('0x1c')]['where'][_0xc459('0x4a')];var _0xfd5605=_0x376e66['body'][_0xc459('0xa')][_0xc459('0x4b')];return new Promise(function(_0x1ab77b,_0x33f177){return db[_0xc459('0x6')][_0xc459('0x7')]({'where':{'voiceQueueId':{'$in':_0x40734b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0xc459('0x4c')+_0xbabdb4+_0xc459('0x4d')),'$gt':db['sequelize'][_0xc459('0x4e')](_0xc459('0x4f'))}},'UserId':{'$in':_0xfd5605}},'include':[{'model':db[_0xc459('0x23')],'as':_0xc459('0x2a')},{'model':db[_0xc459('0x2b')],'as':_0xc459('0x2c'),'attributes':['id','name','voicePause']},{'model':db['CmList'],'as':'List'}]})[_0xc459('0x10')](function(_0x20bf46){if(_0x20bf46[_0xc459('0x2f')]>0x0){return db[_0xc459('0x25')][_0xc459('0x26')](function(_0x166880){return db[_0xc459('0x6')][_0xc459('0x1b')]({'recallmeNotifiedDate':db['sequelize']['literal'](_0xc459('0x4f'))},{'where':{'id':{'$in':_[_0xc459('0xf')](_0x20bf46,'id')}},'transaction':_0x166880})[_0xc459('0x10')](function(){_0x1ab77b(_0x20bf46);})[_0xc459('0x13')](function(_0x2dafe7){logger[_0xc459('0x14')]('CmHopperHandlePreviewRecallNotifications',_0x2dafe7['message'],_0x376e66);_0x33f177(_0x1a90ea[_0xc459('0x14')](0x1f4,_0x2dafe7[_0xc459('0x15')]));});})['catch'](function(_0x20b549){logger[_0xc459('0x14')](_0xc459('0x48'),_0x20b549['message'],_0x376e66);_0x33f177(_0x1a90ea['error'](0x1f4,_0x20b549[_0xc459('0x15')]));});}else{_0x1ab77b(_0x20bf46);}});});}; \ No newline at end of file +var _0x7711=['findAll','raw','options','where','attributes','limit','include','model','map','then','info','catch','error','message','ShowCmHopper','find','debug','stringify','body','CreateCmHopper','update','active','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','UserId','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','create','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','\x22%s\x22','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','GetCmHopperPreview','keys','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','NOW()\x20+\x20INTERVAL\x20','List','NOW()','util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper'];(function(_0x1a4cac,_0x116f47){var _0x142f2f=function(_0x4a1e47){while(--_0x4a1e47){_0x1a4cac['push'](_0x1a4cac['shift']());}};_0x142f2f(++_0x116f47);}(_0x7711,0x17a));var _0x1771=function(_0x1070e6,_0x14a3b0){_0x1070e6=_0x1070e6-0x0;var _0x15925b=_0x7711[_0x1070e6];return _0x15925b;};'use strict';var _=require('lodash');var util=require(_0x1771('0x0'));var moment=require(_0x1771('0x1'));var BPromise=require('bluebird');var db=require(_0x1771('0x2'))['db'];var logger=require(_0x1771('0x3'))(_0x1771('0x4'));exports[_0x1771('0x5')]=function(_0x2adc04){var _0x47f6dd=this;return new Promise(function(_0x4a14ef,_0x158ea0){return db[_0x1771('0x6')][_0x1771('0x7')]({'raw':_0x2adc04['options']?_0x2adc04['options'][_0x1771('0x8')]===undefined?!![]:![]:!![],'where':_0x2adc04[_0x1771('0x9')]?_0x2adc04[_0x1771('0x9')][_0x1771('0xa')]||null:null,'attributes':_0x2adc04['options']?_0x2adc04[_0x1771('0x9')][_0x1771('0xb')]||null:null,'limit':_0x2adc04[_0x1771('0x9')]?_0x2adc04[_0x1771('0x9')][_0x1771('0xc')]||null:null,'include':_0x2adc04[_0x1771('0x9')]?_0x2adc04[_0x1771('0x9')][_0x1771('0xd')]?_['map'](_0x2adc04[_0x1771('0x9')]['include'],function(_0x2d8e1){return{'model':db[_0x2d8e1[_0x1771('0xe')]],'as':_0x2d8e1['as'],'attributes':_0x2d8e1['attributes'],'include':_0x2d8e1[_0x1771('0xd')]?_[_0x1771('0xf')](_0x2d8e1[_0x1771('0xd')],function(_0x2a9c23){return{'model':db[_0x2a9c23['model']],'as':_0x2a9c23['as'],'attributes':_0x2a9c23[_0x1771('0xb')],'include':_0x2a9c23[_0x1771('0xd')]?_[_0x1771('0xf')](_0x2a9c23[_0x1771('0xd')],function(_0x342d34){return{'model':db[_0x342d34[_0x1771('0xe')]],'as':_0x342d34['as'],'attributes':_0x342d34[_0x1771('0xb')]};}):[]};}):[]};}):[]:[]})[_0x1771('0x10')](function(_0x2fd68c){logger[_0x1771('0x11')](_0x1771('0x5'),_0x2adc04);logger['debug']('GetCmHopper',_0x2adc04,JSON['stringify'](_0x2fd68c));_0x4a14ef(_0x2fd68c);})[_0x1771('0x12')](function(_0x2d3866){logger[_0x1771('0x13')]('GetCmHopper',_0x2d3866[_0x1771('0x14')],_0x2adc04);_0x158ea0(_0x47f6dd[_0x1771('0x13')](0x1f4,_0x2d3866[_0x1771('0x14')]));});});};exports[_0x1771('0x15')]=function(_0x31213f){var _0x5461ee=this;return new Promise(function(_0x1864e1,_0x1efe76){return db['CmHopper'][_0x1771('0x16')]({'raw':_0x31213f[_0x1771('0x9')]?_0x31213f[_0x1771('0x9')][_0x1771('0x8')]===undefined?!![]:![]:!![],'where':_0x31213f[_0x1771('0x9')]?_0x31213f[_0x1771('0x9')][_0x1771('0xa')]||null:null,'attributes':_0x31213f[_0x1771('0x9')]?_0x31213f[_0x1771('0x9')][_0x1771('0xb')]||null:null,'include':_0x31213f[_0x1771('0x9')]?_0x31213f[_0x1771('0x9')][_0x1771('0xd')]?_[_0x1771('0xf')](_0x31213f['options'][_0x1771('0xd')],function(_0xfdbb93){return{'model':db[_0xfdbb93['model']],'as':_0xfdbb93['as'],'attributes':_0xfdbb93[_0x1771('0xb')],'include':_0xfdbb93['include']?_[_0x1771('0xf')](_0xfdbb93[_0x1771('0xd')],function(_0x5c18b9){return{'model':db[_0x5c18b9[_0x1771('0xe')]],'as':_0x5c18b9['as'],'attributes':_0x5c18b9[_0x1771('0xb')],'include':_0x5c18b9[_0x1771('0xd')]?_[_0x1771('0xf')](_0x5c18b9[_0x1771('0xd')],function(_0x56aaf8){return{'model':db[_0x56aaf8[_0x1771('0xe')]],'as':_0x56aaf8['as'],'attributes':_0x56aaf8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b397d){logger[_0x1771('0x11')](_0x1771('0x15'),_0x31213f);logger[_0x1771('0x17')](_0x1771('0x15'),_0x31213f,JSON[_0x1771('0x18')](_0x6b397d));_0x1864e1(_0x6b397d);})[_0x1771('0x12')](function(_0x196484){logger[_0x1771('0x13')](_0x1771('0x15'),_0x196484[_0x1771('0x14')],_0x31213f);_0x1efe76(_0x5461ee['error'](0x1f4,_0x196484[_0x1771('0x14')]));});});};exports['CreateCmHopper']=function(_0x267cf3){var _0x6d477f=this;return new Promise(function(_0x2ab225,_0x3cd99d){return db[_0x1771('0x6')]['create'](_0x267cf3[_0x1771('0x19')],{'raw':_0x267cf3[_0x1771('0x9')]?_0x267cf3[_0x1771('0x9')][_0x1771('0x8')]===undefined?!![]:![]:!![]})[_0x1771('0x10')](function(_0x3e7349){logger[_0x1771('0x11')]('CreateCmHopper',_0x267cf3);logger[_0x1771('0x17')](_0x1771('0x1a'),_0x267cf3,JSON[_0x1771('0x18')](_0x3e7349));_0x2ab225(_0x3e7349);})[_0x1771('0x12')](function(_0x208d68){logger[_0x1771('0x13')]('CreateCmHopper',_0x208d68[_0x1771('0x14')],_0x267cf3);_0x3cd99d(_0x6d477f[_0x1771('0x13')](0x1f4,_0x208d68[_0x1771('0x14')]));});});};exports['UpdateCmHopper']=function(_0x40f178){var _0x4511dd=this;return new Promise(function(_0x16a8cc,_0x3d3f32){return db[_0x1771('0x6')][_0x1771('0x1b')](_0x40f178[_0x1771('0x19')],{'raw':_0x40f178[_0x1771('0x9')]?_0x40f178[_0x1771('0x9')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40f178[_0x1771('0x9')]?_0x40f178['options'][_0x1771('0xa')]||null:null,'attributes':_0x40f178[_0x1771('0x9')]?_0x40f178[_0x1771('0x9')][_0x1771('0xb')]||null:null,'limit':_0x40f178['options']?_0x40f178[_0x1771('0x9')][_0x1771('0xc')]||null:null})[_0x1771('0x10')](function(_0x42dbb9){logger[_0x1771('0x11')]('UpdateCmHopper',_0x40f178);logger[_0x1771('0x11')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x1771('0x18')](_0x40f178['options'][_0x1771('0xa')]),_0x40f178[_0x1771('0x19')][_0x1771('0x1c')]);logger[_0x1771('0x17')](_0x1771('0x1d'),_0x40f178,JSON[_0x1771('0x18')](_0x42dbb9));_0x16a8cc(_0x42dbb9);})[_0x1771('0x12')](function(_0x2ddae9){logger[_0x1771('0x13')](_0x1771('0x1d'),_0x2ddae9['message'],_0x40f178);_0x3d3f32(_0x4511dd['error'](0x1f4,_0x2ddae9[_0x1771('0x14')]));});});};exports[_0x1771('0x1e')]=function(_0x4f4318){var _0x487453=this;return new Promise(function(_0x3beb03,_0x223222){return db[_0x1771('0x6')][_0x1771('0x1f')]({'where':_0x4f4318[_0x1771('0x9')]?_0x4f4318[_0x1771('0x9')]['where']||null:null})[_0x1771('0x10')](function(_0xf1414c){logger[_0x1771('0x11')](_0x1771('0x1e'),_0x4f4318);logger[_0x1771('0x17')](_0x1771('0x1e'),_0x4f4318,JSON['stringify'](_0xf1414c));_0x3beb03(_0xf1414c);})['catch'](function(_0xef8cd6){logger['error'](_0x1771('0x1e'),_0xef8cd6[_0x1771('0x14')],_0x4f4318);_0x223222(_0x487453['error'](0x1f4,_0xef8cd6[_0x1771('0x14')]));});});};exports[_0x1771('0x20')]=function(_0x4ed931){var _0x1c4718=this;return new Promise(function(_0x37fb4c,_0x330be3){return db[_0x1771('0x21')][_0x1771('0x22')]()[_0x1771('0x10')](function(_0x3c435c){return db[_0x1771('0x23')]['transaction'](function(_0x31a35b){return db[_0x1771('0x6')][_0x1771('0x7')]({'where':_0x4ed931[_0x1771('0x9')]?_0x4ed931[_0x1771('0x9')]['where']||null:null,'attributes':_0x4ed931[_0x1771('0x9')]?_0x4ed931['options'][_0x1771('0xb')]||null:null,'limit':_0x4ed931[_0x1771('0x9')]?_0x4ed931['options'][_0x1771('0xc')]||null:null,'order':_0x4ed931[_0x1771('0x9')]?_0x4ed931[_0x1771('0x9')][_0x1771('0x24')]||null:null,'transaction':_0x31a35b,'lock':_0x31a35b[_0x1771('0x25')][_0x1771('0x26')],'include':[{'model':db['CmContact'],'as':_0x1771('0x27'),'attributes':_['keys'](_0x3c435c)},{'model':db[_0x1771('0x28')],'as':_0x1771('0x29'),'attributes':['id',_0x1771('0x2a'),_0x1771('0x2b')]}]})[_0x1771('0x10')](function(_0x58e03a){var _0x333303=[];var _0x3a3ba9=[];for(var _0x3e520b=0x0;_0x3e520b<_0x58e03a['length'];_0x3e520b+=0x1){var _0x203edc=_0x58e03a[_0x3e520b][_0x1771('0x2c')];if(_0x203edc===null){_0x333303[_0x1771('0x2d')](_0x58e03a[_0x3e520b][_0x1771('0x1b')](_0x4ed931[_0x1771('0x19')],{'transaction':_0x31a35b}));}else if(!_0x3a3ba9['includes'](_0x203edc)){_0x3a3ba9[_0x1771('0x2d')](_0x203edc);_0x333303[_0x1771('0x2d')](_0x58e03a[_0x3e520b]['update'](_0x4ed931[_0x1771('0x19')],{'transaction':_0x31a35b}));}}return BPromise[_0x1771('0x2e')](_0x333303);});})[_0x1771('0x10')](function(_0x2b7a27){logger[_0x1771('0x11')]('GetContactDialer',_0x4ed931);if(_0x2b7a27[_0x1771('0x2f')]>0x0){logger[_0x1771('0x11')](_0x1771('0x30'),_0x2b7a27[0x0][_0x1771('0x31')]['id'],_0x2b7a27[0x0][_0x1771('0x31')][_0x1771('0x32')],_0x2b7a27[0x0][_0x1771('0x31')][_0x1771('0x1c')]);}logger['debug'](_0x1771('0x20'),_0x4ed931,JSON['stringify'](_0x2b7a27));_0x37fb4c(_0x2b7a27);})[_0x1771('0x12')](function(_0x49f2d7){logger[_0x1771('0x13')](_0x1771('0x20'),_0x49f2d7[_0x1771('0x14')],_0x4ed931);_0x330be3(_0x1c4718[_0x1771('0x13')](0x1f4,_0x49f2d7[_0x1771('0x14')]));});});});};exports[_0x1771('0x33')]=function(_0x3f0d26){var _0x33cee0=this;return new Promise(function(_0x47315d,_0xf7b301){return db[_0x1771('0x23')][_0x1771('0x34')](function(_0x3a9971){return db[_0x1771('0x35')][_0x1771('0x36')](_0x3f0d26[_0x1771('0x19')],{'raw':_0x3f0d26[_0x1771('0x9')]?_0x3f0d26[_0x1771('0x9')][_0x1771('0x8')]===undefined?!![]:![]:!![],'transaction':_0x3a9971})[_0x1771('0x10')](function(){logger[_0x1771('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x3f0d26['options'][_0x1771('0xa')]),_0x3f0d26[_0x1771('0x9')][_0x1771('0xa')][_0x1771('0x1c')]);return db[_0x1771('0x6')]['destroy']({'where':_0x3f0d26[_0x1771('0x9')]?_0x3f0d26[_0x1771('0x9')][_0x1771('0xa')]||null:null,'transaction':_0x3a9971});});})[_0x1771('0x10')](function(_0x790059){logger[_0x1771('0x11')](_0x1771('0x33'),_0x3f0d26);logger[_0x1771('0x17')](_0x1771('0x33'),_0x3f0d26,JSON[_0x1771('0x18')](_0x790059));_0x47315d(_0x790059);})['catch'](function(_0x29cb6b){logger[_0x1771('0x13')](_0x1771('0x33'),_0x29cb6b[_0x1771('0x14')],_0x3f0d26);_0xf7b301(_0x33cee0[_0x1771('0x13')](0x1f4,_0x29cb6b[_0x1771('0x14')]));});});};exports[_0x1771('0x37')]=function(_0x55072a){var _0x49275b=this;return new Promise(function(_0x984345,_0x3ccf7f){return db[_0x1771('0x6')][_0x1771('0x7')]({'raw':_0x55072a[_0x1771('0x9')]?_0x55072a[_0x1771('0x9')][_0x1771('0x8')]===undefined?!![]:![]:!![],'where':_0x55072a[_0x1771('0x9')]?_0x55072a[_0x1771('0x9')][_0x1771('0xa')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1771('0x38'),db[_0x1771('0x23')]['fn']('IF',db[_0x1771('0x23')][_0x1771('0x39')](_0x1771('0x3a')+util['format'](_0x1771('0x3b'),moment()[_0x1771('0x3c')](_0x1771('0x3d')))+_0x1771('0x3e')))),'contactsRescheduled']]})['then'](function(_0x58f273){logger[_0x1771('0x11')](_0x1771('0x37'),_0x55072a);logger[_0x1771('0x17')](_0x1771('0x37'),_0x55072a,JSON[_0x1771('0x18')](_0x58f273));_0x984345(_0x58f273);})[_0x1771('0x12')](function(_0xba1cd8){logger[_0x1771('0x13')](_0x1771('0x37'),_0xba1cd8['message'],_0x55072a);_0x3ccf7f(_0x49275b[_0x1771('0x13')](0x1f4,_0xba1cd8[_0x1771('0x14')]));});});};exports[_0x1771('0x3f')]=function(_0x3aa2de){var _0x3f685e=this;return new Promise(function(_0x366802,_0x406182){return db[_0x1771('0x21')]['describe']()['then'](function(){return db[_0x1771('0x23')][_0x1771('0x34')](function(_0x47e0d3){return db[_0x1771('0x6')][_0x1771('0x7')]({'where':_0x3aa2de[_0x1771('0x9')]?_0x3aa2de[_0x1771('0x9')][_0x1771('0xa')]||null:null,'attributes':_0x3aa2de[_0x1771('0x9')]?_0x3aa2de['options'][_0x1771('0xb')]||null:null,'limit':0x1,'order':_0x3aa2de[_0x1771('0x9')]?_0x3aa2de[_0x1771('0x9')][_0x1771('0x24')]||null:null,'group':db[_0x1771('0x6')]['UserId'],'transaction':_0x47e0d3,'lock':_0x47e0d3[_0x1771('0x25')][_0x1771('0x26')],'include':_0x3aa2de[_0x1771('0x9')]?_0x3aa2de[_0x1771('0x9')][_0x1771('0xd')]?_['map'](_0x3aa2de[_0x1771('0x9')][_0x1771('0xd')],function(_0x45faf8){return{'model':db[_0x45faf8[_0x1771('0xe')]],'as':_0x45faf8['as'],'attributes':_0x45faf8[_0x1771('0xb')],'include':_0x45faf8[_0x1771('0xd')]?_[_0x1771('0xf')](_0x45faf8[_0x1771('0xd')],function(_0x5a676d){return{'model':db[_0x5a676d['model']],'as':_0x5a676d['as'],'attributes':_0x5a676d[_0x1771('0xb')],'include':_0x5a676d[_0x1771('0xd')]?_['map'](_0x5a676d[_0x1771('0xd')],function(_0x3d9976){return{'model':db[_0x3d9976[_0x1771('0xe')]],'as':_0x3d9976['as'],'attributes':_0x3d9976[_0x1771('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b7b43){var _0x54de83=[];for(var _0x25a9d5=0x0;_0x25a9d5<_0x1b7b43[_0x1771('0x2f')];_0x25a9d5+=0x1){_0x54de83['push'](_0x1b7b43[_0x25a9d5][_0x1771('0x1b')](_0x3aa2de[_0x1771('0x19')],{'transaction':_0x47e0d3}));}return BPromise[_0x1771('0x2e')](_0x54de83);});})[_0x1771('0x10')](function(_0x5a081f){logger[_0x1771('0x11')](_0x1771('0x3f'),_0x3aa2de);logger[_0x1771('0x17')](_0x1771('0x3f'),_0x3aa2de,JSON[_0x1771('0x18')](_0x5a081f));_0x366802(_0x5a081f);})['catch'](function(_0xbff740){logger[_0x1771('0x13')]('GetContactRecallMe',_0xbff740['message'],_0x3aa2de);_0x406182(_0x3f685e[_0x1771('0x13')](0x1f4,_0xbff740['message']));});});});};exports[_0x1771('0x40')]=function(_0x4e4803){var _0x1c8660=this;return new Promise(function(_0x176219,_0x305df8){db[_0x1771('0x21')][_0x1771('0x22')]()[_0x1771('0x10')](function(_0x18c9ff){return db[_0x1771('0x6')]['findAll']({'raw':_0x4e4803[_0x1771('0x9')]?_0x4e4803['options'][_0x1771('0x8')]===undefined?!![]:![]:!![],'where':_0x4e4803[_0x1771('0x9')]?_0x4e4803[_0x1771('0x9')][_0x1771('0xa')]||null:null,'attributes':_0x4e4803[_0x1771('0x9')]?_0x4e4803['options'][_0x1771('0xb')]||null:null,'limit':_0x4e4803[_0x1771('0x9')]?_0x4e4803[_0x1771('0x9')][_0x1771('0xc')]||null:null,'include':_0x4e4803['options']?_0x4e4803[_0x1771('0x9')][_0x1771('0xd')]?_[_0x1771('0xf')](_0x4e4803[_0x1771('0x9')][_0x1771('0xd')],function(_0x32292b){return{'model':db[_0x32292b[_0x1771('0xe')]],'as':_0x32292b['as'],'attributes':_0x32292b['as']===_0x1771('0x27')?_[_0x1771('0x41')](_0x18c9ff):_0x32292b['attributes'],'include':_0x32292b[_0x1771('0xd')]?_[_0x1771('0xf')](_0x32292b[_0x1771('0xd')],function(_0x4b1e7b){return{'model':db[_0x4b1e7b[_0x1771('0xe')]],'as':_0x4b1e7b['as'],'attributes':_0x4b1e7b[_0x1771('0xb')],'include':_0x4b1e7b[_0x1771('0xd')]?_[_0x1771('0xf')](_0x4b1e7b['include'],function(_0x56c5fc){return{'model':db[_0x56c5fc['model']],'as':_0x56c5fc['as'],'attributes':_0x56c5fc[_0x1771('0xb')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x11a967){logger[_0x1771('0x11')](_0x1771('0x5'),_0x4e4803);logger[_0x1771('0x17')](_0x1771('0x5'),_0x4e4803,JSON[_0x1771('0x18')](_0x11a967));_0x176219(_0x11a967);})[_0x1771('0x12')](function(_0x41d5b7){logger[_0x1771('0x13')](_0x1771('0x5'),_0x41d5b7['message'],_0x4e4803);_0x305df8(_0x1c8660['error'](0x1f4,_0x41d5b7[_0x1771('0x14')]));});});});};exports[_0x1771('0x42')]=function(_0x202f5e){var _0x2eca50=this;return new Promise(function(_0x227829,_0x2ed23c){return db['CmContact'][_0x1771('0x43')]({'raw':!![],'where':{'phone':_0x202f5e[_0x1771('0x9')][_0x1771('0xa')][_0x1771('0x44')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0x139cc3){logger[_0x1771('0x11')](_0x1771('0x45'),_0x202f5e);logger[_0x1771('0x17')]('getContactByPhone',_0x202f5e,JSON[_0x1771('0x18')](_0x139cc3));_0x227829(_0x139cc3);})['catch'](function(_0x5208ad){logger['error'](_0x1771('0x45'),_0x5208ad['message'],_0x202f5e);_0x2ed23c(_0x2eca50[_0x1771('0x13')](0x1f4,_0x5208ad[_0x1771('0x14')]));});});};exports[_0x1771('0x46')]=function(_0x83e523){var _0x2419d6=this;return new Promise(function(_0x28be0c,_0x602258){return db[_0x1771('0x23')]['transaction'](function(_0x3565fb){var _0x2e59f9=_0x83e523[_0x1771('0x9')]&&_0x83e523[_0x1771('0x9')]['where']?_0x83e523[_0x1771('0x9')][_0x1771('0xa')]:{};return db['CmHopper']['update'](_0x83e523[_0x1771('0x19')],{'where':_0x2e59f9,'transaction':_0x3565fb})[_0x1771('0x10')](function(_0xd6a33c){logger['info']('ResetActiveCalls',_0x83e523);logger[_0x1771('0x17')](_0x1771('0x46'),_0x83e523,JSON['stringify'](_0xd6a33c));_0x28be0c(_0xd6a33c);})[_0x1771('0x12')](function(_0x14c1d6){logger['error'](_0x1771('0x46'),_0x14c1d6[_0x1771('0x14')],_0x83e523);_0x602258(_0x2419d6[_0x1771('0x13')](0x1f4,_0x14c1d6['message']));});});});};exports[_0x1771('0x47')]=function(_0x3f8e33){var _0x5cf1b2=this;var _0x4aec9b=_0x3f8e33[_0x1771('0x19')][_0x1771('0xa')][_0x1771('0x48')];var _0x320033=_0x3f8e33[_0x1771('0x19')][_0x1771('0xa')][_0x1771('0x49')];var _0x138597=_0x3f8e33[_0x1771('0x19')]['where']['availableAgentsIds'];return new Promise(function(_0x944a6b,_0x1045e4){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x4aec9b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1771('0x23')][_0x1771('0x39')](_0x1771('0x4a')+_0x320033+'\x20MINUTE'),'$gt':db[_0x1771('0x23')]['literal']('NOW()')}},'UserId':{'$in':_0x138597}},'include':[{'model':db['CmContact'],'as':_0x1771('0x27')},{'model':db[_0x1771('0x28')],'as':'Agent','attributes':['id',_0x1771('0x2a'),_0x1771('0x2b')]},{'model':db['CmList'],'as':_0x1771('0x4b')}]})[_0x1771('0x10')](function(_0x273c64){if(_0x273c64['length']>0x0){return db[_0x1771('0x23')][_0x1771('0x34')](function(_0x51e472){return db[_0x1771('0x6')][_0x1771('0x1b')]({'recallmeNotifiedDate':db[_0x1771('0x23')][_0x1771('0x39')](_0x1771('0x4c'))},{'where':{'id':{'$in':_['map'](_0x273c64,'id')}},'transaction':_0x51e472})[_0x1771('0x10')](function(){_0x944a6b(_0x273c64);})[_0x1771('0x12')](function(_0x2d3d7e){logger[_0x1771('0x13')](_0x1771('0x47'),_0x2d3d7e[_0x1771('0x14')],_0x3f8e33);_0x1045e4(_0x5cf1b2[_0x1771('0x13')](0x1f4,_0x2d3d7e[_0x1771('0x14')]));});})[_0x1771('0x12')](function(_0x22e5b0){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x22e5b0[_0x1771('0x14')],_0x3f8e33);_0x1045e4(_0x5cf1b2['error'](0x1f4,_0x22e5b0[_0x1771('0x14')]));});}else{_0x944a6b(_0x273c64);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index ed1ac6a..ea02b96 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 _0x89df=['delete','Router','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','create','/preview','getPreview','post','/timezone','getTimezone','put'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x89df,0x65));var _0xf89d=function(_0x36313b,_0x22a61b){_0x36313b=_0x36313b-0x0;var _0x554ff3=_0x89df[_0x36313b];return _0x554ff3;};'use strict';var express=require('express');var router=express[_0xf89d('0x0')]();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router[_0xf89d('0x1')]('/',auth[_0xf89d('0x2')](),controller[_0xf89d('0x3')]);router[_0xf89d('0x1')](_0xf89d('0x4'),auth[_0xf89d('0x2')](),controller[_0xf89d('0x5')]);router[_0xf89d('0x1')]('/opencontacts',auth[_0xf89d('0x2')](),controller[_0xf89d('0x6')]);router['get'](_0xf89d('0x7'),auth[_0xf89d('0x2')](),controller[_0xf89d('0x8')]);router[_0xf89d('0x1')](_0xf89d('0x9'),auth[_0xf89d('0x2')](),controller[_0xf89d('0xa')]);router['get'](_0xf89d('0xb'),auth[_0xf89d('0x2')](),controller['getPreviewRecall']);router['post']('/',auth[_0xf89d('0x2')](),controller[_0xf89d('0xc')]);router['post'](_0xf89d('0xd'),auth['isAuthenticated'](),controller[_0xf89d('0xe')]);router[_0xf89d('0xf')](_0xf89d('0x10'),auth['isAuthenticated'](),controller[_0xf89d('0x11')]);router[_0xf89d('0x12')](_0xf89d('0x9'),auth[_0xf89d('0x2')](),controller['update']);router[_0xf89d('0x13')]('/:id',auth[_0xf89d('0x2')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0def=['/preview','getPreview','/timezone','getTimezone','put','delete','exports','express','Router','../../components/auth/service','isAuthenticated','index','/describe','describe','get','/opencontacts','/timezones','getTimezones','/:id','show','getPreviewRecall','create','post'];(function(_0x3017f9,_0x36ce57){var _0x6bbe96=function(_0x29057c){while(--_0x29057c){_0x3017f9['push'](_0x3017f9['shift']());}};_0x6bbe96(++_0x36ce57);}(_0x0def,0x1bc));var _0xf0de=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x0def[_0x3c04ef];return _0x6a3a69;};'use strict';var express=require(_0xf0de('0x0'));var router=express[_0xf0de('0x1')]();var auth=require(_0xf0de('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0xf0de('0x3')](),controller[_0xf0de('0x4')]);router['get'](_0xf0de('0x5'),auth['isAuthenticated'](),controller[_0xf0de('0x6')]);router[_0xf0de('0x7')](_0xf0de('0x8'),auth[_0xf0de('0x3')](),controller['getOpenContacts']);router[_0xf0de('0x7')](_0xf0de('0x9'),auth['isAuthenticated'](),controller[_0xf0de('0xa')]);router[_0xf0de('0x7')](_0xf0de('0xb'),auth['isAuthenticated'](),controller[_0xf0de('0xc')]);router[_0xf0de('0x7')]('/:id/previewrecall',auth[_0xf0de('0x3')](),controller[_0xf0de('0xd')]);router['post']('/',auth[_0xf0de('0x3')](),controller[_0xf0de('0xe')]);router[_0xf0de('0xf')](_0xf0de('0x10'),auth[_0xf0de('0x3')](),controller[_0xf0de('0x11')]);router[_0xf0de('0xf')](_0xf0de('0x12'),auth['isAuthenticated'](),controller[_0xf0de('0x13')]);router[_0xf0de('0x14')](_0xf0de('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xf0de('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf0de('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 f2ab704..f3ae04b 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 _0x86f7=['YYYY-MM-DD\x20HH:mm:ss','STRING','INTEGER','DATE','format'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x86f7,0x191));var _0x786f=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x86f7[_0x3e5086];return _0xfeb102;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x786f('0x0')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x786f('0x2')],'defaultValue':moment()[_0x786f('0x3')](_0x786f('0x4'))},'countbusyretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x786f('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0c46=['moment','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1a79c6,_0x5bad0b){var _0x301647=function(_0x9d3817){while(--_0x9d3817){_0x1a79c6['push'](_0x1a79c6['shift']());}};_0x301647(++_0x5bad0b);}(_0x0c46,0x165));var _0x60c4=function(_0x19259f,_0x43371f){_0x19259f=_0x19259f-0x0;var _0x1c51be=_0x0c46[_0x19259f];return _0x1c51be;};'use strict';var moment=require(_0x60c4('0x0'));var Sequelize=require('sequelize');module[_0x60c4('0x1')]={'CmHopperId':{'type':Sequelize[_0x60c4('0x2')]},'phone':{'type':Sequelize[_0x60c4('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x60c4('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x60c4('0x4')],'defaultValue':moment()[_0x60c4('0x5')](_0x60c4('0x6'))},'countbusyretry':{'type':Sequelize[_0x60c4('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x60c4('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x60c4('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x60c4('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x60c4('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 1409cf2..c411309 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 _0xb609=['sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','get','CmHopperAdditionalPhones','error','stack','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0xb609,0x14f));var _0x9b60=function(_0x16d9eb,_0x20c50f){_0x16d9eb=_0x16d9eb-0x0;var _0x48c4c7=_0xb609[_0x16d9eb];return _0x48c4c7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9b60('0x0'));var jsonpatch=require(_0x9b60('0x1'));var rp=require(_0x9b60('0x2'));var moment=require(_0x9b60('0x3'));var BPromise=require(_0x9b60('0x4'));var Mustache=require(_0x9b60('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9b60('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b60('0x7'));var squel=require(_0x9b60('0x8'));var crypto=require('crypto');var jsforce=require(_0x9b60('0x9'));var deskjs=require(_0x9b60('0xa'));var toCsv=require(_0x9b60('0x6'));var querystring=require('querystring');var Papa=require(_0x9b60('0xb'));var Redis=require('ioredis');var authService=require(_0x9b60('0xc'));var qs=require(_0x9b60('0xd'));var as=require(_0x9b60('0xe'));var hardwareService=require(_0x9b60('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x9b60('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9b60('0x11'))['db'];function respondWithStatusCode(_0x274bee,_0x58a8b5){_0x58a8b5=_0x58a8b5||0xcc;return function(_0x27d972){if(_0x27d972){return _0x274bee[_0x9b60('0x12')](_0x58a8b5);}return _0x274bee[_0x9b60('0x13')](_0x58a8b5)[_0x9b60('0x14')]();};}function respondWithResult(_0xcb99cd,_0x4b2d42){_0x4b2d42=_0x4b2d42||0xc8;return function(_0x4ef581){if(_0x4ef581){return _0xcb99cd[_0x9b60('0x13')](_0x4b2d42)[_0x9b60('0x15')](_0x4ef581);}};}function respondWithFilteredResult(_0x480216,_0x38ff93){return function(_0x350861){if(_0x350861){var _0x2282e5=typeof _0x38ff93[_0x9b60('0x16')]===_0x9b60('0x17')&&typeof _0x38ff93[_0x9b60('0x18')]===_0x9b60('0x17');var _0x421368=_0x350861['count'];var _0x136f30=_0x2282e5?0x0:_0x38ff93['offset'];var _0x399ac2=_0x2282e5?_0x350861[_0x9b60('0x19')]:_0x38ff93[_0x9b60('0x16')]+_0x38ff93[_0x9b60('0x18')];var _0x2f91ec;if(_0x399ac2>=_0x421368){_0x399ac2=_0x421368;_0x2f91ec=0xc8;}else{_0x2f91ec=0xce;}_0x480216[_0x9b60('0x13')](_0x2f91ec);return _0x480216[_0x9b60('0x1a')]('Content-Range',_0x136f30+'-'+_0x399ac2+'/'+_0x421368)['json'](_0x350861);}return null;};}function patchUpdates(_0x372af6){return function(_0x1ed93f){try{jsonpatch['apply'](_0x1ed93f,_0x372af6,!![]);}catch(_0x2e4442){return BPromise[_0x9b60('0x1b')](_0x2e4442);}return _0x1ed93f[_0x9b60('0x1c')]();};}function saveUpdates(_0x22967b,_0x1bf2f7){return function(_0x13b1a5){if(_0x13b1a5){return _0x13b1a5[_0x9b60('0x1d')](_0x22967b)['then'](function(_0x34894c){return _0x34894c;});}return null;};}function removeEntity(_0x3b9e99,_0x5e470e){return function(_0x5ac5cb){if(_0x5ac5cb){return _0x5ac5cb[_0x9b60('0x1e')]()[_0x9b60('0x1f')](function(){var _0x48f574=_0x5ac5cb[_0x9b60('0x20')]({'plain':!![]});var _0xbf4f8b=_0x9b60('0x21');return db['UserProfileResource'][_0x9b60('0x1e')]({'where':{'type':_0xbf4f8b,'resourceId':_0x48f574['id']}})[_0x9b60('0x1f')](function(){return _0x5ac5cb;});})[_0x9b60('0x1f')](function(){_0x3b9e99[_0x9b60('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6aed,_0x1cbfe6){return function(_0xcd96a9){if(!_0xcd96a9){_0x2c6aed['sendStatus'](0x194);}return _0xcd96a9;};}function handleError(_0x462aa6,_0x2184a7){_0x2184a7=_0x2184a7||0x1f4;return function(_0x1a5fec){logger[_0x9b60('0x22')](_0x1a5fec[_0x9b60('0x23')]);if(_0x1a5fec[_0x9b60('0x24')]){delete _0x1a5fec[_0x9b60('0x24')];}_0x462aa6[_0x9b60('0x13')](_0x2184a7)[_0x9b60('0x25')](_0x1a5fec);};}exports[_0x9b60('0x26')]=function(_0x37a96e,_0x4a59c2){var _0x1ff43b={},_0x564083={},_0x5422f={'count':0x0,'rows':[]};var _0x1a9a8e=_['map'](db[_0x9b60('0x27')][_0x9b60('0x28')],function(_0x213963){return{'name':_0x213963[_0x9b60('0x29')],'type':_0x213963[_0x9b60('0x2a')][_0x9b60('0x2b')]};});_0x564083[_0x9b60('0x2c')]=_['map'](_0x1a9a8e,_0x9b60('0x24'));_0x564083[_0x9b60('0x2d')]=_[_0x9b60('0x2e')](_0x37a96e[_0x9b60('0x2d')]);_0x564083[_0x9b60('0x2f')]=_[_0x9b60('0x30')](_0x564083['model'],_0x564083[_0x9b60('0x2d')]);_0x1ff43b[_0x9b60('0x31')]=_[_0x9b60('0x30')](_0x564083[_0x9b60('0x2c')],qs[_0x9b60('0x32')](_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x32')]));_0x1ff43b['attributes']=_0x1ff43b[_0x9b60('0x31')][_0x9b60('0x33')]?_0x1ff43b[_0x9b60('0x31')]:_0x564083[_0x9b60('0x2c')];if(!_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x34')](_0x9b60('0x35'))){_0x1ff43b[_0x9b60('0x18')]=qs[_0x9b60('0x18')](_0x37a96e[_0x9b60('0x2d')]['limit']);_0x1ff43b['offset']=qs['offset'](_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x16')]);}_0x1ff43b[_0x9b60('0x36')]=qs['sort'](_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x37')]);_0x1ff43b[_0x9b60('0x38')]=qs[_0x9b60('0x2f')](_[_0x9b60('0x39')](_0x37a96e[_0x9b60('0x2d')],_0x564083[_0x9b60('0x2f')]),_0x1a9a8e);if(_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x3a')]){_0x1ff43b[_0x9b60('0x38')]=_[_0x9b60('0x3b')](_0x1ff43b[_0x9b60('0x38')],{'$or':_['map'](_0x1a9a8e,function(_0x25a051){if(_0x25a051[_0x9b60('0x2a')]!==_0x9b60('0x3c')){var _0x141821={};_0x141821[_0x25a051[_0x9b60('0x24')]]={'$like':'%'+_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x3a')]+'%'};return _0x141821;}})});}_0x1ff43b=_[_0x9b60('0x3b')]({},_0x1ff43b,_0x37a96e['options']);var _0x40deac={'where':_0x1ff43b[_0x9b60('0x38')]};return db['CmHopperAdditionalPhone']['count'](_0x40deac)[_0x9b60('0x1f')](function(_0xc68c7b){_0x5422f[_0x9b60('0x19')]=_0xc68c7b;if(_0x37a96e[_0x9b60('0x2d')][_0x9b60('0x3d')]){_0x1ff43b[_0x9b60('0x3e')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x9b60('0x3f')](_0x1ff43b);})[_0x9b60('0x1f')](function(_0x3152f7){_0x5422f['rows']=_0x3152f7;return _0x5422f;})[_0x9b60('0x1f')](respondWithFilteredResult(_0x4a59c2,_0x1ff43b))[_0x9b60('0x40')](handleError(_0x4a59c2,null));};exports[_0x9b60('0x41')]=function(_0x5957e8,_0x2399c9){var _0x195e70={'raw':!![],'where':{'id':_0x5957e8[_0x9b60('0x42')]['id']}},_0xbafa75={};_0xbafa75[_0x9b60('0x2c')]=_[_0x9b60('0x2e')](db[_0x9b60('0x27')][_0x9b60('0x28')]);_0xbafa75[_0x9b60('0x2d')]=_[_0x9b60('0x2e')](_0x5957e8[_0x9b60('0x2d')]);_0xbafa75[_0x9b60('0x2f')]=_[_0x9b60('0x30')](_0xbafa75['model'],_0xbafa75[_0x9b60('0x2d')]);_0x195e70['attributes']=_[_0x9b60('0x30')](_0xbafa75[_0x9b60('0x2c')],qs['fields'](_0x5957e8['query'][_0x9b60('0x32')]));_0x195e70[_0x9b60('0x31')]=_0x195e70['attributes'][_0x9b60('0x33')]?_0x195e70[_0x9b60('0x31')]:_0xbafa75[_0x9b60('0x2c')];if(_0x5957e8['query'][_0x9b60('0x3d')]){_0x195e70[_0x9b60('0x3e')]=[{'all':!![]}];}_0x195e70=_['merge']({},_0x195e70,_0x5957e8[_0x9b60('0x43')]);return db[_0x9b60('0x27')][_0x9b60('0x44')](_0x195e70)['then'](handleEntityNotFound(_0x2399c9,null))['then'](respondWithResult(_0x2399c9,null))['catch'](handleError(_0x2399c9,null));};exports[_0x9b60('0x45')]=function(_0x228bdc,_0x53ed97){return db['CmHopperAdditionalPhone'][_0x9b60('0x45')](_0x228bdc[_0x9b60('0x46')],{})[_0x9b60('0x1f')](function(_0x1bd3d6){var _0x10f078=_0x228bdc[_0x9b60('0x47')][_0x9b60('0x20')]({'plain':!![]});if(!_0x10f078)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x10f078[_0x9b60('0x48')]==='user'){var _0x360098=_0x1bd3d6[_0x9b60('0x20')]({'plain':!![]});var _0x5753b8=_0x9b60('0x21');return db[_0x9b60('0x49')][_0x9b60('0x44')]({'where':{'name':_0x5753b8,'userProfileId':_0x10f078[_0x9b60('0x4a')]},'raw':!![]})[_0x9b60('0x1f')](function(_0x43998e){if(_0x43998e&&_0x43998e[_0x9b60('0x4b')]===0x0){return db[_0x9b60('0x4c')]['create']({'name':_0x360098[_0x9b60('0x24')],'resourceId':_0x360098['id'],'type':_0x43998e[_0x9b60('0x24')],'sectionId':_0x43998e['id']},{})[_0x9b60('0x1f')](function(){return _0x1bd3d6;});}else{return _0x1bd3d6;}})[_0x9b60('0x40')](function(_0x77b6b3){logger[_0x9b60('0x22')](_0x9b60('0x4d'),_0x77b6b3);throw _0x77b6b3;});}return _0x1bd3d6;})[_0x9b60('0x1f')](respondWithResult(_0x53ed97,0xc9))[_0x9b60('0x40')](handleError(_0x53ed97,null));};exports[_0x9b60('0x1d')]=function(_0x47cc29,_0x19705d){if(_0x47cc29['body']['id']){delete _0x47cc29[_0x9b60('0x46')]['id'];}return db[_0x9b60('0x27')]['find']({'where':{'id':_0x47cc29[_0x9b60('0x42')]['id']}})['then'](handleEntityNotFound(_0x19705d,null))[_0x9b60('0x1f')](saveUpdates(_0x47cc29['body'],null))[_0x9b60('0x1f')](respondWithResult(_0x19705d,null))[_0x9b60('0x40')](handleError(_0x19705d,null));};exports['destroy']=function(_0xf1bec0,_0x4b34fc){return db[_0x9b60('0x27')][_0x9b60('0x44')]({'where':{'id':_0xf1bec0[_0x9b60('0x42')]['id']}})[_0x9b60('0x1f')](handleEntityNotFound(_0x4b34fc,null))['then'](removeEntity(_0x4b34fc,null))[_0x9b60('0x40')](handleError(_0x4b34fc,null));}; \ No newline at end of file +var _0x0aa8=['show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','error','name','send','index','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch'];(function(_0xed1deb,_0x147800){var _0x187a22=function(_0xdcc0dd){while(--_0xdcc0dd){_0xed1deb['push'](_0xed1deb['shift']());}};_0x187a22(++_0x147800);}(_0x0aa8,0x1a2));var _0x80aa=function(_0x37cc52,_0x459a9b){_0x37cc52=_0x37cc52-0x0;var _0x2b4a90=_0x0aa8[_0x37cc52];return _0x2b4a90;};'use strict';var emlformat=require(_0x80aa('0x0'));var rimraf=require(_0x80aa('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x80aa('0x2'));var rp=require(_0x80aa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x80aa('0x4'));var path=require(_0x80aa('0x5'));var sox=require(_0x80aa('0x6'));var csv=require(_0x80aa('0x7'));var ejs=require(_0x80aa('0x8'));var fs=require('fs');var fs_extra=require(_0x80aa('0x9'));var _=require(_0x80aa('0xa'));var squel=require(_0x80aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x80aa('0xc'));var deskjs=require(_0x80aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x80aa('0xe'));var Papa=require('papaparse');var Redis=require(_0x80aa('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x80aa('0x10'));var as=require(_0x80aa('0x11'));var hardwareService=require(_0x80aa('0x12'));var logger=require(_0x80aa('0x13'))('api');var utils=require(_0x80aa('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80aa('0x15'))['db'];function respondWithStatusCode(_0x51e698,_0x392dd3){_0x392dd3=_0x392dd3||0xcc;return function(_0x324b27){if(_0x324b27){return _0x51e698[_0x80aa('0x16')](_0x392dd3);}return _0x51e698[_0x80aa('0x17')](_0x392dd3)[_0x80aa('0x18')]();};}function respondWithResult(_0x3f7ff3,_0xbdc68f){_0xbdc68f=_0xbdc68f||0xc8;return function(_0x37d600){if(_0x37d600){return _0x3f7ff3['status'](_0xbdc68f)[_0x80aa('0x19')](_0x37d600);}};}function respondWithFilteredResult(_0x13b622,_0x136b63){return function(_0x2c6bc5){if(_0x2c6bc5){var _0x20f93d=typeof _0x136b63[_0x80aa('0x1a')]===_0x80aa('0x1b')&&typeof _0x136b63[_0x80aa('0x1c')]===_0x80aa('0x1b');var _0x1f7753=_0x2c6bc5[_0x80aa('0x1d')];var _0x418103=_0x20f93d?0x0:_0x136b63['offset'];var _0x3b0126=_0x20f93d?_0x2c6bc5[_0x80aa('0x1d')]:_0x136b63['offset']+_0x136b63['limit'];var _0x34bfe0;if(_0x3b0126>=_0x1f7753){_0x3b0126=_0x1f7753;_0x34bfe0=0xc8;}else{_0x34bfe0=0xce;}_0x13b622[_0x80aa('0x17')](_0x34bfe0);return _0x13b622[_0x80aa('0x1e')](_0x80aa('0x1f'),_0x418103+'-'+_0x3b0126+'/'+_0x1f7753)[_0x80aa('0x19')](_0x2c6bc5);}return null;};}function patchUpdates(_0x4fa4f1){return function(_0x4c52f5){try{jsonpatch[_0x80aa('0x20')](_0x4c52f5,_0x4fa4f1,!![]);}catch(_0x909bb0){return BPromise['reject'](_0x909bb0);}return _0x4c52f5[_0x80aa('0x21')]();};}function saveUpdates(_0x17fb5b,_0x584d93){return function(_0x5756b0){if(_0x5756b0){return _0x5756b0[_0x80aa('0x22')](_0x17fb5b)[_0x80aa('0x23')](function(_0x10c419){return _0x10c419;});}return null;};}function removeEntity(_0x2df17e,_0x12ca82){return function(_0x2939d0){if(_0x2939d0){return _0x2939d0[_0x80aa('0x24')]()[_0x80aa('0x23')](function(){var _0x55aa93=_0x2939d0[_0x80aa('0x25')]({'plain':!![]});var _0x2423f2='CmHopperAdditionalPhones';return db[_0x80aa('0x26')][_0x80aa('0x24')]({'where':{'type':_0x2423f2,'resourceId':_0x55aa93['id']}})[_0x80aa('0x23')](function(){return _0x2939d0;});})[_0x80aa('0x23')](function(){_0x2df17e[_0x80aa('0x17')](0xcc)[_0x80aa('0x18')]();});}};}function handleEntityNotFound(_0x842121,_0x25df0f){return function(_0x58c5b4){if(!_0x58c5b4){_0x842121[_0x80aa('0x16')](0x194);}return _0x58c5b4;};}function handleError(_0x9801c4,_0x18c6bd){_0x18c6bd=_0x18c6bd||0x1f4;return function(_0x65e68a){logger[_0x80aa('0x27')](_0x65e68a['stack']);if(_0x65e68a[_0x80aa('0x28')]){delete _0x65e68a[_0x80aa('0x28')];}_0x9801c4[_0x80aa('0x17')](_0x18c6bd)[_0x80aa('0x29')](_0x65e68a);};}exports[_0x80aa('0x2a')]=function(_0x10d7ad,_0x432ee6){var _0x346c44={},_0x5f503c={},_0x4c78f2={'count':0x0,'rows':[]};var _0x4fe6fa=_['map'](db[_0x80aa('0x2b')][_0x80aa('0x2c')],function(_0x2e3824){return{'name':_0x2e3824[_0x80aa('0x2d')],'type':_0x2e3824[_0x80aa('0x2e')]['key']};});_0x5f503c[_0x80aa('0x2f')]=_[_0x80aa('0x30')](_0x4fe6fa,_0x80aa('0x28'));_0x5f503c[_0x80aa('0x31')]=_[_0x80aa('0x32')](_0x10d7ad[_0x80aa('0x31')]);_0x5f503c[_0x80aa('0x33')]=_[_0x80aa('0x34')](_0x5f503c['model'],_0x5f503c['query']);_0x346c44[_0x80aa('0x35')]=_[_0x80aa('0x34')](_0x5f503c[_0x80aa('0x2f')],qs['fields'](_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x36')]));_0x346c44['attributes']=_0x346c44[_0x80aa('0x35')][_0x80aa('0x37')]?_0x346c44[_0x80aa('0x35')]:_0x5f503c[_0x80aa('0x2f')];if(!_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x38')](_0x80aa('0x39'))){_0x346c44[_0x80aa('0x1c')]=qs['limit'](_0x10d7ad['query'][_0x80aa('0x1c')]);_0x346c44[_0x80aa('0x1a')]=qs[_0x80aa('0x1a')](_0x10d7ad[_0x80aa('0x31')]['offset']);}_0x346c44[_0x80aa('0x3a')]=qs[_0x80aa('0x3b')](_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x3b')]);_0x346c44[_0x80aa('0x3c')]=qs['filters'](_['pick'](_0x10d7ad[_0x80aa('0x31')],_0x5f503c[_0x80aa('0x33')]),_0x4fe6fa);if(_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x3d')]){_0x346c44[_0x80aa('0x3c')]=_['merge'](_0x346c44[_0x80aa('0x3c')],{'$or':_[_0x80aa('0x30')](_0x4fe6fa,function(_0x805688){if(_0x805688[_0x80aa('0x2e')]!=='VIRTUAL'){var _0x2c0a8d={};_0x2c0a8d[_0x805688[_0x80aa('0x28')]]={'$like':'%'+_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x3d')]+'%'};return _0x2c0a8d;}})});}_0x346c44=_[_0x80aa('0x3e')]({},_0x346c44,_0x10d7ad[_0x80aa('0x3f')]);var _0x180e13={'where':_0x346c44[_0x80aa('0x3c')]};return db[_0x80aa('0x2b')][_0x80aa('0x1d')](_0x180e13)['then'](function(_0xbcbbd2){_0x4c78f2[_0x80aa('0x1d')]=_0xbcbbd2;if(_0x10d7ad[_0x80aa('0x31')][_0x80aa('0x40')]){_0x346c44[_0x80aa('0x41')]=[{'all':!![]}];}return db[_0x80aa('0x2b')]['findAll'](_0x346c44);})[_0x80aa('0x23')](function(_0x27ba11){_0x4c78f2[_0x80aa('0x42')]=_0x27ba11;return _0x4c78f2;})[_0x80aa('0x23')](respondWithFilteredResult(_0x432ee6,_0x346c44))[_0x80aa('0x43')](handleError(_0x432ee6,null));};exports[_0x80aa('0x44')]=function(_0x32ae74,_0x594648){var _0x4987d3={'raw':!![],'where':{'id':_0x32ae74[_0x80aa('0x45')]['id']}},_0x1ec6e4={};_0x1ec6e4[_0x80aa('0x2f')]=_[_0x80aa('0x32')](db[_0x80aa('0x2b')][_0x80aa('0x2c')]);_0x1ec6e4[_0x80aa('0x31')]=_[_0x80aa('0x32')](_0x32ae74['query']);_0x1ec6e4[_0x80aa('0x33')]=_[_0x80aa('0x34')](_0x1ec6e4[_0x80aa('0x2f')],_0x1ec6e4[_0x80aa('0x31')]);_0x4987d3[_0x80aa('0x35')]=_[_0x80aa('0x34')](_0x1ec6e4[_0x80aa('0x2f')],qs[_0x80aa('0x36')](_0x32ae74[_0x80aa('0x31')][_0x80aa('0x36')]));_0x4987d3[_0x80aa('0x35')]=_0x4987d3[_0x80aa('0x35')]['length']?_0x4987d3['attributes']:_0x1ec6e4['model'];if(_0x32ae74['query'][_0x80aa('0x40')]){_0x4987d3[_0x80aa('0x41')]=[{'all':!![]}];}_0x4987d3=_[_0x80aa('0x3e')]({},_0x4987d3,_0x32ae74['options']);return db[_0x80aa('0x2b')][_0x80aa('0x46')](_0x4987d3)[_0x80aa('0x23')](handleEntityNotFound(_0x594648,null))[_0x80aa('0x23')](respondWithResult(_0x594648,null))[_0x80aa('0x43')](handleError(_0x594648,null));};exports[_0x80aa('0x47')]=function(_0x2c3882,_0x3cddc8){return db[_0x80aa('0x2b')][_0x80aa('0x47')](_0x2c3882[_0x80aa('0x48')],{})['then'](function(_0x53a8fa){var _0x3ec0ff=_0x2c3882['user'][_0x80aa('0x25')]({'plain':!![]});if(!_0x3ec0ff)throw new Error(_0x80aa('0x49'));if(_0x3ec0ff[_0x80aa('0x4a')]===_0x80aa('0x4b')){var _0x2febe5=_0x53a8fa[_0x80aa('0x25')]({'plain':!![]});var _0x241962=_0x80aa('0x4c');return db[_0x80aa('0x4d')][_0x80aa('0x46')]({'where':{'name':_0x241962,'userProfileId':_0x3ec0ff[_0x80aa('0x4e')]},'raw':!![]})['then'](function(_0x2def49){if(_0x2def49&&_0x2def49[_0x80aa('0x4f')]===0x0){return db[_0x80aa('0x26')][_0x80aa('0x47')]({'name':_0x2febe5[_0x80aa('0x28')],'resourceId':_0x2febe5['id'],'type':_0x2def49[_0x80aa('0x28')],'sectionId':_0x2def49['id']},{})[_0x80aa('0x23')](function(){return _0x53a8fa;});}else{return _0x53a8fa;}})[_0x80aa('0x43')](function(_0x10843e){logger[_0x80aa('0x27')](_0x80aa('0x50'),_0x10843e);throw _0x10843e;});}return _0x53a8fa;})[_0x80aa('0x23')](respondWithResult(_0x3cddc8,0xc9))['catch'](handleError(_0x3cddc8,null));};exports[_0x80aa('0x22')]=function(_0x3bd51e,_0x340979){if(_0x3bd51e['body']['id']){delete _0x3bd51e[_0x80aa('0x48')]['id'];}return db[_0x80aa('0x2b')]['find']({'where':{'id':_0x3bd51e[_0x80aa('0x45')]['id']}})['then'](handleEntityNotFound(_0x340979,null))[_0x80aa('0x23')](saveUpdates(_0x3bd51e[_0x80aa('0x48')],null))['then'](respondWithResult(_0x340979,null))['catch'](handleError(_0x340979,null));};exports[_0x80aa('0x24')]=function(_0x3dae14,_0x3fb9aa){return db[_0x80aa('0x2b')]['find']({'where':{'id':_0x3dae14[_0x80aa('0x45')]['id']}})['then'](handleEntityNotFound(_0x3fb9aa,null))[_0x80aa('0x23')](removeEntity(_0x3fb9aa,null))[_0x80aa('0x43')](handleError(_0x3fb9aa,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f194d96..5bd2417 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 _0xfd76=['./cmHopperAdditionalPhone.attributes','define','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x259044,_0x293804){var _0x2080f4=function(_0x5d5e0e){while(--_0x5d5e0e){_0x259044['push'](_0x259044['shift']());}};_0x2080f4(++_0x293804);}(_0xfd76,0x101));var _0x6fd7=function(_0x587411,_0x31e0b7){_0x587411=_0x587411-0x0;var _0xc05af9=_0xfd76[_0x587411];return _0xc05af9;};'use strict';var _=require(_0x6fd7('0x0'));var util=require(_0x6fd7('0x1'));var logger=require(_0x6fd7('0x2'))(_0x6fd7('0x3'));var moment=require(_0x6fd7('0x4'));var BPromise=require('bluebird');var rp=require(_0x6fd7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6fd7('0x6'));var config=require('../../config/environment');var attributes=require(_0x6fd7('0x7'));module['exports']=function(_0x5dc439,_0x2861f){return _0x5dc439[_0x6fd7('0x8')](_0x6fd7('0x9'),attributes,{'tableName':_0x6fd7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d07=['request-promise','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x170ff7,_0x9e5c0f){var _0x223e27=function(_0x5937c1){while(--_0x5937c1){_0x170ff7['push'](_0x170ff7['shift']());}};_0x223e27(++_0x9e5c0f);}(_0x1d07,0x1e6));var _0x71d0=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1d07[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x71d0('0x0'));var util=require(_0x71d0('0x1'));var logger=require(_0x71d0('0x2'))(_0x71d0('0x3'));var moment=require(_0x71d0('0x4'));var BPromise=require(_0x71d0('0x5'));var rp=require(_0x71d0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x71d0('0x7'));var attributes=require(_0x71d0('0x8'));module[_0x71d0('0x9')]=function(_0x26b1b3,_0xcd6c1e){return _0x26b1b3[_0x71d0('0xa')](_0x71d0('0xb'),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 c50d49d..386d69a 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 _0x649d=['VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','CmHopperAdditionalPhone','waitTime','duration','scheduledat','add','isNil','minutes','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','catch'];(function(_0x2aac37,_0x8bbcf6){var _0x27ac09=function(_0x16bb57){while(--_0x16bb57){_0x2aac37['push'](_0x2aac37['shift']());}};_0x27ac09(++_0x8bbcf6);}(_0x649d,0xc7));var _0xd649=function(_0x1c1bf2,_0x270319){_0x1c1bf2=_0x1c1bf2-0x0;var _0x21b809=_0x649d[_0x1c1bf2];return _0x21b809;};'use strict';var _=require(_0xd649('0x0'));var util=require('util');var moment=require(_0xd649('0x1'));var BPromise=require(_0xd649('0x2'));var rs=require(_0xd649('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd649('0x4'))['db'];var utils=require(_0xd649('0x5'));var logger=require(_0xd649('0x6'))(_0xd649('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd649('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45c5e1,_0x85dda7,_0x97380){return new BPromise(function(_0x1b81e7,_0x2cd1fd){return client[_0xd649('0x9')](_0x45c5e1,_0x97380)[_0xd649('0xa')](function(_0x35441b){logger[_0xd649('0xb')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x85dda7,_0xd649('0xc'));logger[_0xd649('0xd')](_0xd649('0xe'),_0x85dda7,'request\x20sent',JSON[_0xd649('0xf')](_0x35441b));if(_0x35441b[_0xd649('0x10')]){if(_0x35441b[_0xd649('0x10')][_0xd649('0x11')]===0x1f4){logger[_0xd649('0x10')](_0xd649('0x12'),_0x85dda7,_0x35441b[_0xd649('0x10')][_0xd649('0x13')]);return _0x2cd1fd(_0x35441b[_0xd649('0x10')]['message']);}logger['error'](_0xd649('0x12'),_0x85dda7,_0x35441b[_0xd649('0x10')][_0xd649('0x13')]);return _0x1b81e7(_0x35441b[_0xd649('0x10')]['message']);}else{logger[_0xd649('0xb')](_0xd649('0x12'),_0x85dda7,_0xd649('0xc'));_0x1b81e7(_0x35441b['result'][_0xd649('0x13')]);}})[_0xd649('0x14')](function(_0xbfc9b6){logger[_0xd649('0x10')](_0xd649('0x12'),_0x85dda7,_0xbfc9b6);_0x2cd1fd(_0xbfc9b6);});});}exports[_0xd649('0x15')]=function(_0x1e67aa){var _0x4f9993=this;return new Promise(function(_0x529c79,_0x3cf75c){return db[_0xd649('0x16')][_0xd649('0x17')]({'raw':!![],'where':{'ContactId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x19')],'ListId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1a')],'VoiceQueueId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1b')]===undefined?null:_0x1e67aa[_0xd649('0x18')]['VoiceQueueId'],'CampaignId':_0x1e67aa[_0xd649('0x18')][_0xd649('0x1c')]===undefined?null:_0x1e67aa['body'][_0xd649('0x1c')]}})['then'](function(_0x30d98c){if(_0x30d98c!=null){return db['CmHopperAdditionalPhone'][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x30d98c['id'],'OrderBy':{'$gt':_0x30d98c[_0xd649('0x1d')]}},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x21a856){var _0xfc61ca=0x0;if(_0x21a856){if(_0x21a856[_0xd649('0x1f')]+_0x21a856[_0xd649('0x20')]+_0x21a856[_0xd649('0x21')]+_0x21a856[_0xd649('0x22')]+_0x21a856[_0xd649('0x23')]+_0x21a856[_0xd649('0x24')]+_0x21a856[_0xd649('0x25')]+_0x21a856[_0xd649('0x26')]<_0x1e67aa[_0xd649('0x27')]['dialGlobalMaxRetry'])_0xfc61ca=0x1;_0x529c79({'additional':_0xfc61ca});}else{return db[_0xd649('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x30d98c['id']},'order':[['OrderBy','ASC']]})[_0xd649('0xa')](function(_0x19fd76){var _0xeba77b=0x0;if(_0x19fd76){if(_0x19fd76['countbusyretry']+_0x19fd76[_0xd649('0x20')]+_0x19fd76[_0xd649('0x21')]+_0x19fd76[_0xd649('0x22')]+_0x19fd76['countdropretry']+_0x19fd76[_0xd649('0x24')]+_0x19fd76[_0xd649('0x25')]+_0x19fd76[_0xd649('0x26')]<_0x1e67aa[_0xd649('0x27')]['dialGlobalMaxRetry'])_0xeba77b=0x1;_0x529c79({'additional':_0xeba77b});}else{_0x529c79({'additional':0x0});}})[_0xd649('0x14')](function(_0x561a06){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x561a06[_0xd649('0x13')]);_0x3cf75c(_0x4f9993[_0xd649('0x10')](0x1f4,_0x561a06[_0xd649('0x13')]));});}})[_0xd649('0x14')](function(_0x32f26e){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x32f26e[_0xd649('0x13')]);_0x3cf75c(_0x4f9993[_0xd649('0x10')](0x1f4,_0x32f26e[_0xd649('0x13')]));});}else _0x529c79({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x20b4a9){var _0x359733=this;return new Promise(function(_0x599db8,_0x51c866){return db[_0xd649('0x16')][_0xd649('0x17')]({'raw':!![],'where':{'ContactId':_0x20b4a9[_0xd649('0x18')][_0xd649('0x19')],'ListId':_0x20b4a9[_0xd649('0x18')]['ListId'],'VoiceQueueId':_0x20b4a9[_0xd649('0x18')]['VoiceQueueId']===undefined?null:_0x20b4a9[_0xd649('0x18')][_0xd649('0x1b')],'CampaignId':_0x20b4a9['body'][_0xd649('0x1c')]===undefined?null:_0x20b4a9[_0xd649('0x18')][_0xd649('0x1c')]}})[_0xd649('0xa')](function(_0x297910){if(_0x297910!=null){return db['CmHopperAdditionalPhone'][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x297910['id'],'OrderBy':{'$gte':_0x297910['OrderBy']}},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x3f8dd3){if(_0x3f8dd3)return activateAdditionalPhone(_0x297910,_0x20b4a9[_0xd649('0x18')],_0x3f8dd3,_0x20b4a9['duration'],_0x20b4a9[_0xd649('0x29')])[_0xd649('0xa')](function(_0x5b4530){_0x599db8(_0x5b4530);});else{return db[_0xd649('0x28')][_0xd649('0x17')]({'raw':!![],'where':{'CmHopperId':_0x297910['id']},'order':[['OrderBy',_0xd649('0x1e')]]})[_0xd649('0xa')](function(_0x118cce){if(_0x118cce)return activateAdditionalPhone(_0x297910,_0x20b4a9[_0xd649('0x18')],_0x118cce,_0x20b4a9[_0xd649('0x2a')],_0x20b4a9[_0xd649('0x29')])['then'](function(_0x4a9cbf){_0x599db8(_0x4a9cbf);});else{_0x599db8({'id':_0x297910['id'],'phone':''});}})[_0xd649('0x14')](function(_0x195358){logger[_0xd649('0x10')]('VerifyAdditionalPhones',_0x195358[_0xd649('0x13')]);_0x51c866(_0x359733[_0xd649('0x10')](0x1f4,_0x195358[_0xd649('0x13')]));});}})[_0xd649('0x14')](function(_0x100ac5){logger[_0xd649('0x10')](_0xd649('0x15'),_0x100ac5[_0xd649('0x13')]);_0x51c866(_0x359733[_0xd649('0x10')](0x1f4,_0x100ac5[_0xd649('0x13')]));});}else _0x599db8(0x1);});});};function activateAdditionalPhone(_0x237135,_0x145b61,_0x20a63d,_0x3f6d92,_0xec4487){return new Promise(function(_0x344153,_0x3d2adc){var _0x8e2c4f;if(_['isNil'](_0x20a63d[_0xd649('0x2b')])){_0x20a63d[_0xd649('0x2b')]=moment();}if(moment()>moment(_0x20a63d['scheduledat'])){_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,'minutes');}else{if(_0x20a63d['OrderBy']==0x0){_0x8e2c4f=moment(_0x20a63d[_0xd649('0x2b')]);}else{_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,'minutes');}}if(_[_0xd649('0x2d')](_0x8e2c4f)){_0x8e2c4f=moment()[_0xd649('0x2c')](_0xec4487||0x3,_0xd649('0x2e'));}var _0xf91a18={'phone':_0x237135[_0xd649('0x2f')],'active':0x0,'OrderBy':_['isNil'](_0x237135[_0xd649('0x1d')])?0x0:_0x237135[_0xd649('0x1d')],'scheduledat':moment()[_0xd649('0x2c')](_0x3f6d92||0x1,_0xd649('0x2e')),'countbusyretry':_0x145b61['countbusyretry'],'countcongestionretry':_0x145b61[_0xd649('0x20')],'countnoanswerretry':_0x145b61['countnoanswerretry'],'countnosuchnumberretry':_0x145b61[_0xd649('0x22')],'countdropretry':_0x145b61['countdropretry'],'countabandonedretry':_0x145b61[_0xd649('0x24')],'countmachineretry':_0x145b61[_0xd649('0x25')],'countagentrejectretry':_0x145b61['countagentrejectretry'],'createdAt':_0x145b61[_0xd649('0x30')],'updatedAt':_0x145b61[_0xd649('0x31')]};var _0x70d7e4={'CmHopperId':_0x237135['id'],'phone':_0x20a63d['phone'],'active':0x0,'OrderBy':_[_0xd649('0x2d')](_0x20a63d[_0xd649('0x1d')])?0x0:_0x20a63d[_0xd649('0x1d')],'scheduledat':_0x8e2c4f,'countbusyretry':_0x20a63d[_0xd649('0x1f')],'countcongestionretry':_0x20a63d[_0xd649('0x20')],'countnoanswerretry':_0x20a63d[_0xd649('0x21')],'countnosuchnumberretry':_0x20a63d[_0xd649('0x22')],'countdropretry':_0x20a63d['countdropretry'],'countabandonedretry':_0x20a63d[_0xd649('0x24')],'countmachineretry':_0x20a63d[_0xd649('0x25')],'countagentrejectretry':_0x20a63d[_0xd649('0x26')],'createdAt':_0x20a63d[_0xd649('0x30')],'updatedAt':_0x20a63d[_0xd649('0x31')]};return db[_0xd649('0x32')][_0xd649('0x33')](function(_0x583106){return db[_0xd649('0x28')][_0xd649('0x34')](_0xf91a18,{'where':{'id':_0x20a63d['id']}},{'transaction':_0x583106})['then'](function(){return db['CmHopper'][_0xd649('0x34')](_0x70d7e4,{'where':{'id':_0x237135['id']}},{'transaction':_0x583106});});})[_0xd649('0xa')](function(_0x121ce6){_0x344153({'id':_0x237135['id'],'phone':_0x20a63d[_0xd649('0x2f')]});})[_0xd649('0x14')](function(_0x4ebae7){logger[_0xd649('0x10')]('activateAdditionalPhone',_0x4ebae7[_0xd649('0x13')]);_0x3d2adc({'error':_0x4ebae7[_0xd649('0x13')]});});});}exports[_0xd649('0x35')]=function(_0x34cbde){var _0x19e894=this;return new Promise(function(_0x3510a7,_0x3f1b67){return db[_0xd649('0x16')][_0xd649('0x34')](_0x34cbde[_0xd649('0x18')][_0xd649('0x36')],{'where':{'id':_0x34cbde[_0xd649('0x18')]['id']}})[_0xd649('0xa')](function(_0x35849a){_0x3510a7(_0x35849a);})['catch'](function(_0xea4ed9){logger[_0xd649('0x10')](_0xd649('0x35'),_0xea4ed9[_0xd649('0x13')]);_0x3f1b67(_0x19e894[_0xd649('0x10')](0x1f4,_0xea4ed9[_0xd649('0x13')]));});});}; \ No newline at end of file +var _0x240f=['entity','dialGlobalMaxRetry','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','update','activateAdditionalPhone','IncrementPreviewCounters','field','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','CmHopperAdditionalPhone','countdropretry','countagentrejectretry'];(function(_0x458b06,_0x12f681){var _0x5e0eb3=function(_0x1cbec0){while(--_0x1cbec0){_0x458b06['push'](_0x458b06['shift']());}};_0x5e0eb3(++_0x12f681);}(_0x240f,0x1ad));var _0xf240=function(_0x278dde,_0x22456d){_0x278dde=_0x278dde-0x0;var _0x24c1ab=_0x240f[_0x278dde];return _0x24c1ab;};'use strict';var _=require('lodash');var util=require(_0xf240('0x0'));var moment=require(_0xf240('0x1'));var BPromise=require(_0xf240('0x2'));var rs=require(_0xf240('0x3'));var fs=require('fs');var Redis=require(_0xf240('0x4'));var db=require(_0xf240('0x5'))['db'];var utils=require(_0xf240('0x6'));var logger=require(_0xf240('0x7'))(_0xf240('0x8'));var config=require(_0xf240('0x9'));var jayson=require(_0xf240('0xa'));var client=jayson[_0xf240('0xb')][_0xf240('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ecfc3,_0x36ba90,_0x3d6d22){return new BPromise(function(_0x21d1bb,_0x1f4772){return client[_0xf240('0xd')](_0x1ecfc3,_0x3d6d22)[_0xf240('0xe')](function(_0x1af42a){logger[_0xf240('0xf')](_0xf240('0x10'),_0x36ba90,'request\x20sent');logger[_0xf240('0x11')](_0xf240('0x12'),_0x36ba90,_0xf240('0x13'),JSON[_0xf240('0x14')](_0x1af42a));if(_0x1af42a['error']){if(_0x1af42a[_0xf240('0x15')]['code']===0x1f4){logger[_0xf240('0x15')](_0xf240('0x10'),_0x36ba90,_0x1af42a[_0xf240('0x15')][_0xf240('0x16')]);return _0x1f4772(_0x1af42a[_0xf240('0x15')][_0xf240('0x16')]);}logger[_0xf240('0x15')](_0xf240('0x10'),_0x36ba90,_0x1af42a[_0xf240('0x15')][_0xf240('0x16')]);return _0x21d1bb(_0x1af42a[_0xf240('0x15')]['message']);}else{logger[_0xf240('0xf')](_0xf240('0x10'),_0x36ba90,_0xf240('0x13'));_0x21d1bb(_0x1af42a[_0xf240('0x17')]['message']);}})[_0xf240('0x18')](function(_0xc1a47c){logger[_0xf240('0x15')](_0xf240('0x10'),_0x36ba90,_0xc1a47c);_0x1f4772(_0xc1a47c);});});}exports['VerifyAdditionalPhones']=function(_0x5ead2b){var _0xa6301a=this;return new Promise(function(_0xd2ee7,_0x1e971a){return db[_0xf240('0x19')][_0xf240('0x1a')]({'raw':!![],'where':{'ContactId':_0x5ead2b[_0xf240('0x1b')][_0xf240('0x1c')],'ListId':_0x5ead2b[_0xf240('0x1b')][_0xf240('0x1d')],'VoiceQueueId':_0x5ead2b[_0xf240('0x1b')][_0xf240('0x1e')]===undefined?null:_0x5ead2b[_0xf240('0x1b')]['VoiceQueueId'],'CampaignId':_0x5ead2b['body'][_0xf240('0x1f')]===undefined?null:_0x5ead2b['body'][_0xf240('0x1f')]}})[_0xf240('0xe')](function(_0x3b7824){if(_0x3b7824!=null){return db['CmHopperAdditionalPhone'][_0xf240('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3b7824['id'],'OrderBy':{'$gt':_0x3b7824[_0xf240('0x20')]}},'order':[[_0xf240('0x20'),_0xf240('0x21')]]})[_0xf240('0xe')](function(_0x1bce31){var _0x213fea=0x0;if(_0x1bce31){if(_0x1bce31[_0xf240('0x22')]+_0x1bce31[_0xf240('0x23')]+_0x1bce31[_0xf240('0x24')]+_0x1bce31[_0xf240('0x25')]+_0x1bce31['countdropretry']+_0x1bce31[_0xf240('0x26')]+_0x1bce31[_0xf240('0x27')]+_0x1bce31['countagentrejectretry']<_0x5ead2b['entity']['dialGlobalMaxRetry'])_0x213fea=0x1;_0xd2ee7({'additional':_0x213fea});}else{return db[_0xf240('0x28')][_0xf240('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x3b7824['id']},'order':[[_0xf240('0x20'),_0xf240('0x21')]]})[_0xf240('0xe')](function(_0x150ee4){var _0x19605c=0x0;if(_0x150ee4){if(_0x150ee4[_0xf240('0x22')]+_0x150ee4[_0xf240('0x23')]+_0x150ee4[_0xf240('0x24')]+_0x150ee4['countnosuchnumberretry']+_0x150ee4[_0xf240('0x29')]+_0x150ee4['countabandonedretry']+_0x150ee4['countmachineretry']+_0x150ee4[_0xf240('0x2a')]<_0x5ead2b[_0xf240('0x2b')][_0xf240('0x2c')])_0x19605c=0x1;_0xd2ee7({'additional':_0x19605c});}else{_0xd2ee7({'additional':0x0});}})[_0xf240('0x18')](function(_0x448fc2){logger[_0xf240('0x15')]('VerifyAdditionalPhones',_0x448fc2[_0xf240('0x16')]);_0x1e971a(_0xa6301a[_0xf240('0x15')](0x1f4,_0x448fc2['message']));});}})[_0xf240('0x18')](function(_0x56cb17){logger[_0xf240('0x15')](_0xf240('0x2d'),_0x56cb17['message']);_0x1e971a(_0xa6301a[_0xf240('0x15')](0x1f4,_0x56cb17[_0xf240('0x16')]));});}else _0xd2ee7({'additional':0x0});});});};exports[_0xf240('0x2e')]=function(_0x177d03){var _0x52b7a2=this;return new Promise(function(_0x39a4a9,_0x11c28d){return db[_0xf240('0x19')][_0xf240('0x1a')]({'raw':!![],'where':{'ContactId':_0x177d03[_0xf240('0x1b')][_0xf240('0x1c')],'ListId':_0x177d03['body'][_0xf240('0x1d')],'VoiceQueueId':_0x177d03['body'][_0xf240('0x1e')]===undefined?null:_0x177d03[_0xf240('0x1b')][_0xf240('0x1e')],'CampaignId':_0x177d03['body']['CampaignId']===undefined?null:_0x177d03['body'][_0xf240('0x1f')]}})[_0xf240('0xe')](function(_0x16b383){if(_0x16b383!=null){return db[_0xf240('0x28')][_0xf240('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x16b383['id'],'OrderBy':{'$gte':_0x16b383[_0xf240('0x20')]}},'order':[['OrderBy',_0xf240('0x21')]]})[_0xf240('0xe')](function(_0x1fc035){if(_0x1fc035)return activateAdditionalPhone(_0x16b383,_0x177d03['body'],_0x1fc035,_0x177d03[_0xf240('0x2f')],_0x177d03[_0xf240('0x30')])[_0xf240('0xe')](function(_0x2e18eb){_0x39a4a9(_0x2e18eb);});else{return db[_0xf240('0x28')][_0xf240('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x16b383['id']},'order':[[_0xf240('0x20'),_0xf240('0x21')]]})[_0xf240('0xe')](function(_0x2bf4ff){if(_0x2bf4ff)return activateAdditionalPhone(_0x16b383,_0x177d03[_0xf240('0x1b')],_0x2bf4ff,_0x177d03['duration'],_0x177d03[_0xf240('0x30')])[_0xf240('0xe')](function(_0x16a78f){_0x39a4a9(_0x16a78f);});else{_0x39a4a9({'id':_0x16b383['id'],'phone':''});}})['catch'](function(_0x32bdf9){logger[_0xf240('0x15')](_0xf240('0x2d'),_0x32bdf9[_0xf240('0x16')]);_0x11c28d(_0x52b7a2[_0xf240('0x15')](0x1f4,_0x32bdf9[_0xf240('0x16')]));});}})['catch'](function(_0x5b7006){logger['error'](_0xf240('0x2d'),_0x5b7006['message']);_0x11c28d(_0x52b7a2[_0xf240('0x15')](0x1f4,_0x5b7006[_0xf240('0x16')]));});}else _0x39a4a9(0x1);});});};function activateAdditionalPhone(_0x36fee0,_0x59d224,_0x411c52,_0x343c06,_0x189f85){return new Promise(function(_0x3b9509,_0x11e7b4){var _0x45ea2a;if(_[_0xf240('0x31')](_0x411c52[_0xf240('0x32')])){_0x411c52[_0xf240('0x32')]=moment();}if(moment()>moment(_0x411c52['scheduledat'])){_0x45ea2a=moment()[_0xf240('0x33')](_0x189f85||0x3,_0xf240('0x34'));}else{if(_0x411c52[_0xf240('0x20')]==0x0){_0x45ea2a=moment(_0x411c52[_0xf240('0x32')]);}else{_0x45ea2a=moment()[_0xf240('0x33')](_0x189f85||0x3,_0xf240('0x34'));}}if(_[_0xf240('0x31')](_0x45ea2a)){_0x45ea2a=moment()[_0xf240('0x33')](_0x189f85||0x3,'minutes');}var _0x47018b={'phone':_0x36fee0[_0xf240('0x35')],'active':0x0,'OrderBy':_[_0xf240('0x31')](_0x36fee0['OrderBy'])?0x0:_0x36fee0[_0xf240('0x20')],'scheduledat':moment()[_0xf240('0x33')](_0x343c06||0x1,_0xf240('0x34')),'countbusyretry':_0x59d224[_0xf240('0x22')],'countcongestionretry':_0x59d224[_0xf240('0x23')],'countnoanswerretry':_0x59d224[_0xf240('0x24')],'countnosuchnumberretry':_0x59d224['countnosuchnumberretry'],'countdropretry':_0x59d224[_0xf240('0x29')],'countabandonedretry':_0x59d224[_0xf240('0x26')],'countmachineretry':_0x59d224[_0xf240('0x27')],'countagentrejectretry':_0x59d224[_0xf240('0x2a')],'createdAt':_0x59d224[_0xf240('0x36')],'updatedAt':_0x59d224['updatedAt']};var _0x2a4686={'CmHopperId':_0x36fee0['id'],'phone':_0x411c52[_0xf240('0x35')],'active':0x0,'OrderBy':_[_0xf240('0x31')](_0x411c52[_0xf240('0x20')])?0x0:_0x411c52['OrderBy'],'scheduledat':_0x45ea2a,'countbusyretry':_0x411c52[_0xf240('0x22')],'countcongestionretry':_0x411c52[_0xf240('0x23')],'countnoanswerretry':_0x411c52[_0xf240('0x24')],'countnosuchnumberretry':_0x411c52[_0xf240('0x25')],'countdropretry':_0x411c52[_0xf240('0x29')],'countabandonedretry':_0x411c52[_0xf240('0x26')],'countmachineretry':_0x411c52[_0xf240('0x27')],'countagentrejectretry':_0x411c52[_0xf240('0x2a')],'createdAt':_0x411c52[_0xf240('0x36')],'updatedAt':_0x411c52['updatedAt']};return db['sequelize']['transaction'](function(_0x4f4d1b){return db[_0xf240('0x28')]['update'](_0x47018b,{'where':{'id':_0x411c52['id']}},{'transaction':_0x4f4d1b})[_0xf240('0xe')](function(){return db['CmHopper'][_0xf240('0x37')](_0x2a4686,{'where':{'id':_0x36fee0['id']}},{'transaction':_0x4f4d1b});});})[_0xf240('0xe')](function(_0x4d9da5){_0x3b9509({'id':_0x36fee0['id'],'phone':_0x411c52[_0xf240('0x35')]});})[_0xf240('0x18')](function(_0x1c59da){logger[_0xf240('0x15')](_0xf240('0x38'),_0x1c59da[_0xf240('0x16')]);_0x11e7b4({'error':_0x1c59da[_0xf240('0x16')]});});});}exports[_0xf240('0x39')]=function(_0x5d02b6){var _0x29bd9f=this;return new Promise(function(_0x201f72,_0x4b18f4){return db[_0xf240('0x19')][_0xf240('0x37')](_0x5d02b6[_0xf240('0x1b')][_0xf240('0x3a')],{'where':{'id':_0x5d02b6[_0xf240('0x1b')]['id']}})[_0xf240('0xe')](function(_0x284436){_0x201f72(_0x284436);})[_0xf240('0x18')](function(_0x4eace0){logger[_0xf240('0x15')](_0xf240('0x39'),_0x4eace0['message']);_0x4b18f4(_0x29bd9f[_0xf240('0x15')](0x1f4,_0x4eace0[_0xf240('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 1d6403c..149321e 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 _0x3152=['index','/:id','show','post','create','put','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x3152,0x147));var _0x2315=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x3152[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require(_0x2315('0x0'));var util=require(_0x2315('0x1'));var path=require(_0x2315('0x2'));var timeout=require(_0x2315('0x3'));var express=require(_0x2315('0x4'));var router=express['Router']();var fs_extra=require(_0x2315('0x5'));var auth=require(_0x2315('0x6'));var interaction=require(_0x2315('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x2315('0x8')](),controller[_0x2315('0x9')]);router['get'](_0x2315('0xa'),auth[_0x2315('0x8')](),controller[_0x2315('0xb')]);router[_0x2315('0xc')]('/',auth[_0x2315('0x8')](),controller[_0x2315('0xd')]);router[_0x2315('0xe')](_0x2315('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x2315('0x8')](),controller['destroy']);module[_0x2315('0xf')]=router; \ No newline at end of file +var _0x5651=['exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy'];(function(_0x3ba1f1,_0xe46190){var _0x29b9d2=function(_0x4e2e43){while(--_0x4e2e43){_0x3ba1f1['push'](_0x3ba1f1['shift']());}};_0x29b9d2(++_0xe46190);}(_0x5651,0x8d));var _0x1565=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0x5651[_0x25d2fb];return _0x1ded53;};'use strict';var multer=require(_0x1565('0x0'));var util=require(_0x1565('0x1'));var path=require(_0x1565('0x2'));var timeout=require(_0x1565('0x3'));var express=require(_0x1565('0x4'));var router=express[_0x1565('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1565('0x6'));var config=require('../../config/environment');var controller=require(_0x1565('0x7'));router[_0x1565('0x8')]('/',auth['isAuthenticated'](),controller[_0x1565('0x9')]);router[_0x1565('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1565('0xa')]);router[_0x1565('0xb')]('/',auth[_0x1565('0xc')](),controller[_0x1565('0xd')]);router[_0x1565('0xe')](_0x1565('0xf'),auth[_0x1565('0xc')](),controller[_0x1565('0x10')]);router[_0x1565('0x11')](_0x1565('0xf'),auth[_0x1565('0xc')](),controller[_0x1565('0x12')]);module[_0x1565('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 961eb63..95d7b3f 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 _0xe55d=['sequelize','STRING','INTEGER','contactListQueue','moment'];(function(_0x1159ed,_0x2ad385){var _0x981564=function(_0x1a2c0c){while(--_0x1a2c0c){_0x1159ed['push'](_0x1159ed['shift']());}};_0x981564(++_0x2ad385);}(_0xe55d,0x126));var _0xde55=function(_0x320a13,_0x56fd6f){_0x320a13=_0x320a13-0x0;var _0x14d117=_0xe55d[_0x320a13];return _0x14d117;};'use strict';var moment=require(_0xde55('0x0'));var Sequelize=require(_0xde55('0x1'));module['exports']={'phone':{'type':Sequelize[_0xde55('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xde55('0x3')],'unique':_0xde55('0x4')},'ListId':{'type':Sequelize[_0xde55('0x3')],'unique':_0xde55('0x4')},'VoiceQueueId':{'type':Sequelize[_0xde55('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file +var _0x3bf5=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x413e48,_0x2bf197){var _0x22c817=function(_0x5e3293){while(--_0x5e3293){_0x413e48['push'](_0x413e48['shift']());}};_0x22c817(++_0x2bf197);}(_0x3bf5,0x17e));var _0x53bf=function(_0x4653f7,_0x3d3ae3){_0x4653f7=_0x4653f7-0x0;var _0x5454da=_0x3bf5[_0x4653f7];return _0x5454da;};'use strict';var moment=require(_0x53bf('0x0'));var Sequelize=require(_0x53bf('0x1'));module['exports']={'phone':{'type':Sequelize[_0x53bf('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x53bf('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x53bf('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x53bf('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 7731a1f..f743f94 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 _0xcefb=['index','map','CmHopperBlack','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','include','body','find','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','sendStatus','stack','name','send'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0xcefb,0x1cb));var _0xbcef=function(_0x52ac6b,_0xb00fc8){_0x52ac6b=_0x52ac6b-0x0;var _0x2473af=_0xcefb[_0x52ac6b];return _0x2473af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbcef('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcef('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbcef('0x2'));var Mustache=require(_0xbcef('0x3'));var util=require(_0xbcef('0x4'));var path=require(_0xbcef('0x5'));var sox=require(_0xbcef('0x6'));var csv=require('to-csv');var ejs=require(_0xbcef('0x7'));var fs=require('fs');var fs_extra=require(_0xbcef('0x8'));var _=require('lodash');var squel=require(_0xbcef('0x9'));var crypto=require('crypto');var jsforce=require(_0xbcef('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbcef('0xb'));var Papa=require('papaparse');var Redis=require(_0xbcef('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xbcef('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbcef('0xe'))(_0xbcef('0xf'));var utils=require(_0xbcef('0x10'));var config=require(_0xbcef('0x11'));var licenseUtil=require(_0xbcef('0x12'));var db=require(_0xbcef('0x13'))['db'];function respondWithStatusCode(_0xd10324,_0x193bf2){_0x193bf2=_0x193bf2||0xcc;return function(_0xebb4d2){if(_0xebb4d2){return _0xd10324['sendStatus'](_0x193bf2);}return _0xd10324[_0xbcef('0x14')](_0x193bf2)[_0xbcef('0x15')]();};}function respondWithResult(_0x54f06d,_0x4183e0){_0x4183e0=_0x4183e0||0xc8;return function(_0xeb57ca){if(_0xeb57ca){return _0x54f06d[_0xbcef('0x14')](_0x4183e0)[_0xbcef('0x16')](_0xeb57ca);}};}function respondWithFilteredResult(_0x20d5f7,_0x52afa9){return function(_0x252a00){if(_0x252a00){var _0x5e1af9=typeof _0x52afa9[_0xbcef('0x17')]===_0xbcef('0x18')&&typeof _0x52afa9['limit']===_0xbcef('0x18');var _0x4c9a24=_0x252a00[_0xbcef('0x19')];var _0x52f856=_0x5e1af9?0x0:_0x52afa9[_0xbcef('0x17')];var _0x5ea0e1=_0x5e1af9?_0x252a00['count']:_0x52afa9[_0xbcef('0x17')]+_0x52afa9[_0xbcef('0x1a')];var _0x57e078;if(_0x5ea0e1>=_0x4c9a24){_0x5ea0e1=_0x4c9a24;_0x57e078=0xc8;}else{_0x57e078=0xce;}_0x20d5f7[_0xbcef('0x14')](_0x57e078);return _0x20d5f7[_0xbcef('0x1b')]('Content-Range',_0x52f856+'-'+_0x5ea0e1+'/'+_0x4c9a24)[_0xbcef('0x16')](_0x252a00);}return null;};}function patchUpdates(_0x1b1238){return function(_0x32c2b1){try{jsonpatch[_0xbcef('0x1c')](_0x32c2b1,_0x1b1238,!![]);}catch(_0xf59172){return BPromise[_0xbcef('0x1d')](_0xf59172);}return _0x32c2b1[_0xbcef('0x1e')]();};}function saveUpdates(_0x4690d7,_0x59cc37){return function(_0x1c3d28){if(_0x1c3d28){return _0x1c3d28[_0xbcef('0x1f')](_0x4690d7)['then'](function(_0x4e4ac6){return _0x4e4ac6;});}return null;};}function removeEntity(_0x487fd2,_0x193956){return function(_0x547e9c){if(_0x547e9c){return _0x547e9c[_0xbcef('0x20')]()[_0xbcef('0x21')](function(){_0x487fd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc76a7b,_0x445ba1){return function(_0x3fb166){if(!_0x3fb166){_0xc76a7b[_0xbcef('0x22')](0x194);}return _0x3fb166;};}function handleError(_0x4aa557,_0x328ccf){_0x328ccf=_0x328ccf||0x1f4;return function(_0x2feb7f){logger['error'](_0x2feb7f[_0xbcef('0x23')]);if(_0x2feb7f[_0xbcef('0x24')]){delete _0x2feb7f['name'];}_0x4aa557['status'](_0x328ccf)[_0xbcef('0x25')](_0x2feb7f);};}exports[_0xbcef('0x26')]=function(_0x3800fc,_0x1bac61){var _0xdf6a9={},_0x2ee8c8={},_0xb0db40={'count':0x0,'rows':[]};var _0x11d09a=_[_0xbcef('0x27')](db[_0xbcef('0x28')][_0xbcef('0x29')],function(_0x470c7f){return{'name':_0x470c7f['fieldName'],'type':_0x470c7f[_0xbcef('0x2a')][_0xbcef('0x2b')]};});_0x2ee8c8[_0xbcef('0x2c')]=_[_0xbcef('0x27')](_0x11d09a,_0xbcef('0x24'));_0x2ee8c8[_0xbcef('0x2d')]=_[_0xbcef('0x2e')](_0x3800fc[_0xbcef('0x2d')]);_0x2ee8c8[_0xbcef('0x2f')]=_[_0xbcef('0x30')](_0x2ee8c8[_0xbcef('0x2c')],_0x2ee8c8[_0xbcef('0x2d')]);_0xdf6a9['attributes']=_[_0xbcef('0x30')](_0x2ee8c8[_0xbcef('0x2c')],qs[_0xbcef('0x31')](_0x3800fc['query'][_0xbcef('0x31')]));_0xdf6a9[_0xbcef('0x32')]=_0xdf6a9[_0xbcef('0x32')][_0xbcef('0x33')]?_0xdf6a9[_0xbcef('0x32')]:_0x2ee8c8[_0xbcef('0x2c')];if(!_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x34')](_0xbcef('0x35'))){_0xdf6a9[_0xbcef('0x1a')]=qs[_0xbcef('0x1a')](_0x3800fc['query'][_0xbcef('0x1a')]);_0xdf6a9[_0xbcef('0x17')]=qs[_0xbcef('0x17')](_0x3800fc['query'][_0xbcef('0x17')]);}_0xdf6a9[_0xbcef('0x36')]=qs[_0xbcef('0x37')](_0x3800fc['query'][_0xbcef('0x37')]);_0xdf6a9[_0xbcef('0x38')]=qs['filters'](_[_0xbcef('0x39')](_0x3800fc[_0xbcef('0x2d')],_0x2ee8c8[_0xbcef('0x2f')]),_0x11d09a);if(_0x3800fc['query'][_0xbcef('0x3a')]){_0xdf6a9[_0xbcef('0x38')]=_['merge'](_0xdf6a9['where'],{'$or':_[_0xbcef('0x27')](_0x11d09a,function(_0x5b1491){if(_0x5b1491[_0xbcef('0x2a')]!==_0xbcef('0x3b')){var _0x27314b={};_0x27314b[_0x5b1491[_0xbcef('0x24')]]={'$like':'%'+_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x3a')]+'%'};return _0x27314b;}})});}_0xdf6a9=_[_0xbcef('0x3c')]({},_0xdf6a9,_0x3800fc[_0xbcef('0x3d')]);var _0x49911e={'where':_0xdf6a9[_0xbcef('0x38')]};return db['CmHopperBlack'][_0xbcef('0x19')](_0x49911e)[_0xbcef('0x21')](function(_0x48d302){_0xb0db40['count']=_0x48d302;if(_0x3800fc[_0xbcef('0x2d')][_0xbcef('0x3e')]){_0xdf6a9['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xbcef('0x3f')](_0xdf6a9);})[_0xbcef('0x21')](function(_0xb34091){_0xb0db40[_0xbcef('0x40')]=_0xb34091;return _0xb0db40;})[_0xbcef('0x21')](respondWithFilteredResult(_0x1bac61,_0xdf6a9))[_0xbcef('0x41')](handleError(_0x1bac61,null));};exports[_0xbcef('0x42')]=function(_0x36d3ed,_0x5efd2a){var _0x23cb78={'raw':!![],'where':{'id':_0x36d3ed[_0xbcef('0x43')]['id']}},_0x3004b2={};_0x3004b2[_0xbcef('0x2c')]=_[_0xbcef('0x2e')](db[_0xbcef('0x28')]['rawAttributes']);_0x3004b2['query']=_[_0xbcef('0x2e')](_0x36d3ed[_0xbcef('0x2d')]);_0x3004b2[_0xbcef('0x2f')]=_[_0xbcef('0x30')](_0x3004b2['model'],_0x3004b2[_0xbcef('0x2d')]);_0x23cb78[_0xbcef('0x32')]=_[_0xbcef('0x30')](_0x3004b2['model'],qs[_0xbcef('0x31')](_0x36d3ed[_0xbcef('0x2d')][_0xbcef('0x31')]));_0x23cb78[_0xbcef('0x32')]=_0x23cb78[_0xbcef('0x32')][_0xbcef('0x33')]?_0x23cb78[_0xbcef('0x32')]:_0x3004b2[_0xbcef('0x2c')];if(_0x36d3ed['query'][_0xbcef('0x3e')]){_0x23cb78[_0xbcef('0x44')]=[{'all':!![]}];}_0x23cb78=_[_0xbcef('0x3c')]({},_0x23cb78,_0x36d3ed[_0xbcef('0x3d')]);return db['CmHopperBlack']['find'](_0x23cb78)[_0xbcef('0x21')](handleEntityNotFound(_0x5efd2a,null))[_0xbcef('0x21')](respondWithResult(_0x5efd2a,null))[_0xbcef('0x41')](handleError(_0x5efd2a,null));};exports[_0xbcef('0x1f')]=function(_0x1ab3cd,_0x1bbd0b){if(_0x1ab3cd['body']['id']){delete _0x1ab3cd[_0xbcef('0x45')]['id'];}return db[_0xbcef('0x28')][_0xbcef('0x46')]({'where':{'id':_0x1ab3cd[_0xbcef('0x43')]['id']}})[_0xbcef('0x21')](handleEntityNotFound(_0x1bbd0b,null))[_0xbcef('0x21')](saveUpdates(_0x1ab3cd[_0xbcef('0x45')],null))[_0xbcef('0x21')](respondWithResult(_0x1bbd0b,null))[_0xbcef('0x41')](handleError(_0x1bbd0b,null));};exports['destroy']=function(_0xbc3e2,_0x23b6db){return db[_0xbcef('0x28')][_0xbcef('0x46')]({'where':{'id':_0xbc3e2[_0xbcef('0x43')]['id']}})[_0xbcef('0x21')](handleEntityNotFound(_0x23b6db,null))[_0xbcef('0x21')](removeEntity(_0x23b6db,null))['catch'](handleError(_0x23b6db,null));};exports['describe']=function(_0x2de9a4,_0x14c703){return db[_0xbcef('0x28')]['describe']()[_0xbcef('0x21')](respondWithResult(_0x14c703,null))[_0xbcef('0x41')](handleError(_0x14c703,null));}; \ No newline at end of file +var _0x3fdb=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','filter','where','merge','map','VIRTUAL','includeAll','findAll','rows','show','params','keys','include','find','catch','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path'];(function(_0x53ee5,_0x256a9e){var _0x5cf7fa=function(_0x312507){while(--_0x312507){_0x53ee5['push'](_0x53ee5['shift']());}};_0x5cf7fa(++_0x256a9e);}(_0x3fdb,0x89));var _0xb3fd=function(_0x2e2086,_0xaab49){_0x2e2086=_0x2e2086-0x0;var _0x225d25=_0x3fdb[_0x2e2086];return _0x225d25;};'use strict';var emlformat=require(_0xb3fd('0x0'));var rimraf=require(_0xb3fd('0x1'));var zipdir=require(_0xb3fd('0x2'));var jsonpatch=require(_0xb3fd('0x3'));var rp=require(_0xb3fd('0x4'));var moment=require('moment');var BPromise=require(_0xb3fd('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb3fd('0x6'));var sox=require(_0xb3fd('0x7'));var csv=require(_0xb3fd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb3fd('0x9'));var squel=require(_0xb3fd('0xa'));var crypto=require(_0xb3fd('0xb'));var jsforce=require(_0xb3fd('0xc'));var deskjs=require(_0xb3fd('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb3fd('0xe'));var Papa=require(_0xb3fd('0xf'));var Redis=require('ioredis');var authService=require(_0xb3fd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb3fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb3fd('0x12'))(_0xb3fd('0x13'));var utils=require('../../config/utils');var config=require(_0xb3fd('0x14'));var licenseUtil=require(_0xb3fd('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ac7b3,_0x1ab4e5){_0x1ab4e5=_0x1ab4e5||0xcc;return function(_0x1fa744){if(_0x1fa744){return _0x2ac7b3[_0xb3fd('0x16')](_0x1ab4e5);}return _0x2ac7b3[_0xb3fd('0x17')](_0x1ab4e5)[_0xb3fd('0x18')]();};}function respondWithResult(_0x19d6ad,_0x277952){_0x277952=_0x277952||0xc8;return function(_0x59434d){if(_0x59434d){return _0x19d6ad['status'](_0x277952)[_0xb3fd('0x19')](_0x59434d);}};}function respondWithFilteredResult(_0x399b15,_0x4405a8){return function(_0x3f4814){if(_0x3f4814){var _0x2a0a69=typeof _0x4405a8[_0xb3fd('0x1a')]==='undefined'&&typeof _0x4405a8[_0xb3fd('0x1b')]===_0xb3fd('0x1c');var _0x4bfd63=_0x3f4814['count'];var _0x56748b=_0x2a0a69?0x0:_0x4405a8[_0xb3fd('0x1a')];var _0x453ce5=_0x2a0a69?_0x3f4814[_0xb3fd('0x1d')]:_0x4405a8[_0xb3fd('0x1a')]+_0x4405a8[_0xb3fd('0x1b')];var _0x1101a7;if(_0x453ce5>=_0x4bfd63){_0x453ce5=_0x4bfd63;_0x1101a7=0xc8;}else{_0x1101a7=0xce;}_0x399b15[_0xb3fd('0x17')](_0x1101a7);return _0x399b15['set']('Content-Range',_0x56748b+'-'+_0x453ce5+'/'+_0x4bfd63)[_0xb3fd('0x19')](_0x3f4814);}return null;};}function patchUpdates(_0x56ff52){return function(_0xebdbad){try{jsonpatch[_0xb3fd('0x1e')](_0xebdbad,_0x56ff52,!![]);}catch(_0x59c1a1){return BPromise[_0xb3fd('0x1f')](_0x59c1a1);}return _0xebdbad[_0xb3fd('0x20')]();};}function saveUpdates(_0x28115f,_0xaf162){return function(_0x485172){if(_0x485172){return _0x485172[_0xb3fd('0x21')](_0x28115f)[_0xb3fd('0x22')](function(_0x2e5732){return _0x2e5732;});}return null;};}function removeEntity(_0xe1cb4c,_0x53d541){return function(_0x4cf595){if(_0x4cf595){return _0x4cf595[_0xb3fd('0x23')]()[_0xb3fd('0x22')](function(){_0xe1cb4c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc92fa2,_0x1287ed){return function(_0x7b7686){if(!_0x7b7686){_0xc92fa2[_0xb3fd('0x16')](0x194);}return _0x7b7686;};}function handleError(_0x308746,_0x532255){_0x532255=_0x532255||0x1f4;return function(_0x4d33cf){logger[_0xb3fd('0x24')](_0x4d33cf[_0xb3fd('0x25')]);if(_0x4d33cf[_0xb3fd('0x26')]){delete _0x4d33cf[_0xb3fd('0x26')];}_0x308746['status'](_0x532255)[_0xb3fd('0x27')](_0x4d33cf);};}exports[_0xb3fd('0x28')]=function(_0x1f26e8,_0x399de9){var _0x56558d={},_0x59c0c2={},_0x296398={'count':0x0,'rows':[]};var _0x480f06=_['map'](db[_0xb3fd('0x29')][_0xb3fd('0x2a')],function(_0x38bfdb){return{'name':_0x38bfdb[_0xb3fd('0x2b')],'type':_0x38bfdb[_0xb3fd('0x2c')][_0xb3fd('0x2d')]};});_0x59c0c2[_0xb3fd('0x2e')]=_['map'](_0x480f06,_0xb3fd('0x26'));_0x59c0c2[_0xb3fd('0x2f')]=_['keys'](_0x1f26e8['query']);_0x59c0c2['filters']=_[_0xb3fd('0x30')](_0x59c0c2[_0xb3fd('0x2e')],_0x59c0c2[_0xb3fd('0x2f')]);_0x56558d[_0xb3fd('0x31')]=_[_0xb3fd('0x30')](_0x59c0c2[_0xb3fd('0x2e')],qs[_0xb3fd('0x32')](_0x1f26e8[_0xb3fd('0x2f')]['fields']));_0x56558d['attributes']=_0x56558d[_0xb3fd('0x31')][_0xb3fd('0x33')]?_0x56558d[_0xb3fd('0x31')]:_0x59c0c2[_0xb3fd('0x2e')];if(!_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x34')](_0xb3fd('0x35'))){_0x56558d[_0xb3fd('0x1b')]=qs[_0xb3fd('0x1b')](_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x1b')]);_0x56558d[_0xb3fd('0x1a')]=qs[_0xb3fd('0x1a')](_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x1a')]);}_0x56558d['order']=qs['sort'](_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x36')]);_0x56558d['where']=qs[_0xb3fd('0x37')](_['pick'](_0x1f26e8[_0xb3fd('0x2f')],_0x59c0c2[_0xb3fd('0x37')]),_0x480f06);if(_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x38')]){_0x56558d[_0xb3fd('0x39')]=_[_0xb3fd('0x3a')](_0x56558d[_0xb3fd('0x39')],{'$or':_[_0xb3fd('0x3b')](_0x480f06,function(_0xd9dae3){if(_0xd9dae3[_0xb3fd('0x2c')]!==_0xb3fd('0x3c')){var _0x53b50b={};_0x53b50b[_0xd9dae3[_0xb3fd('0x26')]]={'$like':'%'+_0x1f26e8[_0xb3fd('0x2f')][_0xb3fd('0x38')]+'%'};return _0x53b50b;}})});}_0x56558d=_['merge']({},_0x56558d,_0x1f26e8['options']);var _0xcdcf24={'where':_0x56558d['where']};return db[_0xb3fd('0x29')][_0xb3fd('0x1d')](_0xcdcf24)[_0xb3fd('0x22')](function(_0x575382){_0x296398[_0xb3fd('0x1d')]=_0x575382;if(_0x1f26e8['query'][_0xb3fd('0x3d')]){_0x56558d['include']=[{'all':!![]}];}return db[_0xb3fd('0x29')][_0xb3fd('0x3e')](_0x56558d);})[_0xb3fd('0x22')](function(_0x299aa1){_0x296398[_0xb3fd('0x3f')]=_0x299aa1;return _0x296398;})[_0xb3fd('0x22')](respondWithFilteredResult(_0x399de9,_0x56558d))['catch'](handleError(_0x399de9,null));};exports[_0xb3fd('0x40')]=function(_0x1862c2,_0x361db2){var _0x497393={'raw':!![],'where':{'id':_0x1862c2[_0xb3fd('0x41')]['id']}},_0x30377d={};_0x30377d[_0xb3fd('0x2e')]=_['keys'](db[_0xb3fd('0x29')][_0xb3fd('0x2a')]);_0x30377d[_0xb3fd('0x2f')]=_[_0xb3fd('0x42')](_0x1862c2['query']);_0x30377d['filters']=_['intersection'](_0x30377d[_0xb3fd('0x2e')],_0x30377d[_0xb3fd('0x2f')]);_0x497393[_0xb3fd('0x31')]=_[_0xb3fd('0x30')](_0x30377d[_0xb3fd('0x2e')],qs[_0xb3fd('0x32')](_0x1862c2[_0xb3fd('0x2f')][_0xb3fd('0x32')]));_0x497393['attributes']=_0x497393[_0xb3fd('0x31')][_0xb3fd('0x33')]?_0x497393['attributes']:_0x30377d[_0xb3fd('0x2e')];if(_0x1862c2[_0xb3fd('0x2f')][_0xb3fd('0x3d')]){_0x497393[_0xb3fd('0x43')]=[{'all':!![]}];}_0x497393=_['merge']({},_0x497393,_0x1862c2['options']);return db[_0xb3fd('0x29')][_0xb3fd('0x44')](_0x497393)[_0xb3fd('0x22')](handleEntityNotFound(_0x361db2,null))[_0xb3fd('0x22')](respondWithResult(_0x361db2,null))[_0xb3fd('0x45')](handleError(_0x361db2,null));};exports[_0xb3fd('0x21')]=function(_0x5b91a1,_0x46d717){if(_0x5b91a1[_0xb3fd('0x46')]['id']){delete _0x5b91a1[_0xb3fd('0x46')]['id'];}return db[_0xb3fd('0x29')]['find']({'where':{'id':_0x5b91a1[_0xb3fd('0x41')]['id']}})[_0xb3fd('0x22')](handleEntityNotFound(_0x46d717,null))['then'](saveUpdates(_0x5b91a1['body'],null))[_0xb3fd('0x22')](respondWithResult(_0x46d717,null))[_0xb3fd('0x45')](handleError(_0x46d717,null));};exports[_0xb3fd('0x23')]=function(_0x3520f1,_0x4a41f1){return db[_0xb3fd('0x29')][_0xb3fd('0x44')]({'where':{'id':_0x3520f1['params']['id']}})[_0xb3fd('0x22')](handleEntityNotFound(_0x4a41f1,null))[_0xb3fd('0x22')](removeEntity(_0x4a41f1,null))[_0xb3fd('0x45')](handleError(_0x4a41f1,null));};exports[_0xb3fd('0x47')]=function(_0x2fc51e,_0x14eb05){return db[_0xb3fd('0x29')]['describe']()[_0xb3fd('0x22')](respondWithResult(_0x14eb05,null))[_0xb3fd('0x45')](handleError(_0x14eb05,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a465089..079e887 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 _0x07cf=['cm_hopper_black','util','../../config/logger','api','moment','bluebird','request-promise','path','./cmHopperBlack.attributes','define','CmHopperBlack'];(function(_0x23cada,_0x1044a0){var _0x427774=function(_0x5f04e3){while(--_0x5f04e3){_0x23cada['push'](_0x23cada['shift']());}};_0x427774(++_0x1044a0);}(_0x07cf,0x140));var _0xf07c=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x07cf[_0x329664];return _0x4e346e;};'use strict';var _=require('lodash');var util=require(_0xf07c('0x0'));var logger=require(_0xf07c('0x1'))(_0xf07c('0x2'));var moment=require(_0xf07c('0x3'));var BPromise=require(_0xf07c('0x4'));var rp=require(_0xf07c('0x5'));var fs=require('fs');var path=require(_0xf07c('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf07c('0x7'));module['exports']=function(_0x2708cf,_0x1611ef){return _0x2708cf[_0xf07c('0x8')](_0xf07c('0x9'),attributes,{'tableName':_0xf07c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdaab=['util','../../config/logger','api','bluebird','request-promise','path','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash'];(function(_0x2eb4d5,_0x1e0b0f){var _0x15e033=function(_0x18004a){while(--_0x18004a){_0x2eb4d5['push'](_0x2eb4d5['shift']());}};_0x15e033(++_0x1e0b0f);}(_0xdaab,0x6d));var _0xbdaa=function(_0x134bfc,_0x144d5f){_0x134bfc=_0x134bfc-0x0;var _0x2f4dcc=_0xdaab[_0x134bfc];return _0x2f4dcc;};'use strict';var _=require(_0xbdaa('0x0'));var util=require(_0xbdaa('0x1'));var logger=require(_0xbdaa('0x2'))(_0xbdaa('0x3'));var moment=require('moment');var BPromise=require(_0xbdaa('0x4'));var rp=require(_0xbdaa('0x5'));var fs=require('fs');var path=require(_0xbdaa('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbdaa('0x7'));module[_0xbdaa('0x8')]=function(_0x596ad8,_0x264dd5){return _0x596ad8[_0xbdaa('0x9')]('CmHopperBlack',attributes,{'tableName':_0xbdaa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 5862f42..d778186 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 _0x1d60=['UpdateCmHopperBlack','DestroyCmHopperBlack','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','attributes','limit','map','include','model','update','where'];(function(_0x54462d,_0x4b8340){var _0x4b5094=function(_0x5f2203){while(--_0x5f2203){_0x54462d['push'](_0x54462d['shift']());}};_0x4b5094(++_0x4b8340);}(_0x1d60,0x1b2));var _0x01d6=function(_0x22417c,_0x5d6a68){_0x22417c=_0x22417c-0x0;var _0x3fc568=_0x1d60[_0x22417c];return _0x3fc568;};'use strict';var _=require(_0x01d6('0x0'));var util=require(_0x01d6('0x1'));var moment=require(_0x01d6('0x2'));var BPromise=require(_0x01d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01d6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x01d6('0x5'))(_0x01d6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x01d6('0x7')][_0x01d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fa3c7,_0x5d5700,_0x55d020){return new BPromise(function(_0x2e050a,_0x3755e4){return client[_0x01d6('0x9')](_0x3fa3c7,_0x55d020)[_0x01d6('0xa')](function(_0x12b454){logger[_0x01d6('0xb')](_0x01d6('0xc'),_0x5d5700,_0x01d6('0xd'));logger[_0x01d6('0xe')](_0x01d6('0xf'),_0x5d5700,_0x01d6('0xd'),JSON[_0x01d6('0x10')](_0x12b454));if(_0x12b454['error']){if(_0x12b454['error'][_0x01d6('0x11')]===0x1f4){logger[_0x01d6('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x5d5700,_0x12b454[_0x01d6('0x12')][_0x01d6('0x13')]);return _0x3755e4(_0x12b454[_0x01d6('0x12')]['message']);}logger[_0x01d6('0x12')](_0x01d6('0xc'),_0x5d5700,_0x12b454[_0x01d6('0x12')][_0x01d6('0x13')]);return _0x2e050a(_0x12b454[_0x01d6('0x12')][_0x01d6('0x13')]);}else{logger[_0x01d6('0xb')](_0x01d6('0xc'),_0x5d5700,_0x01d6('0xd'));_0x2e050a(_0x12b454[_0x01d6('0x14')]['message']);}})[_0x01d6('0x15')](function(_0x295957){logger[_0x01d6('0x12')](_0x01d6('0xc'),_0x5d5700,_0x295957);_0x3755e4(_0x295957);});});}exports[_0x01d6('0x16')]=function(_0x47b03f){var _0x108467=this;return new Promise(function(_0x14ad8a,_0x40e173){return db[_0x01d6('0x17')][_0x01d6('0x18')]({'raw':_0x47b03f['options']?_0x47b03f['options'][_0x01d6('0x19')]===undefined?!![]:![]:!![],'where':_0x47b03f[_0x01d6('0x1a')]?_0x47b03f['options']['where']||null:null,'attributes':_0x47b03f[_0x01d6('0x1a')]?_0x47b03f['options'][_0x01d6('0x1b')]||null:null,'limit':_0x47b03f[_0x01d6('0x1a')]?_0x47b03f['options'][_0x01d6('0x1c')]||null:null,'include':_0x47b03f[_0x01d6('0x1a')]?_0x47b03f[_0x01d6('0x1a')]['include']?_[_0x01d6('0x1d')](_0x47b03f['options'][_0x01d6('0x1e')],function(_0x1f96ca){return{'model':db[_0x1f96ca[_0x01d6('0x1f')]],'as':_0x1f96ca['as'],'attributes':_0x1f96ca[_0x01d6('0x1b')],'include':_0x1f96ca['include']?_[_0x01d6('0x1d')](_0x1f96ca[_0x01d6('0x1e')],function(_0x1277c4){return{'model':db[_0x1277c4[_0x01d6('0x1f')]],'as':_0x1277c4['as'],'attributes':_0x1277c4['attributes'],'include':_0x1277c4[_0x01d6('0x1e')]?_['map'](_0x1277c4[_0x01d6('0x1e')],function(_0x2b037f){return{'model':db[_0x2b037f[_0x01d6('0x1f')]],'as':_0x2b037f['as'],'attributes':_0x2b037f[_0x01d6('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29dcd8){logger[_0x01d6('0xb')](_0x01d6('0x16'),_0x47b03f);logger[_0x01d6('0xe')]('GetCmHopperBlack',_0x47b03f,JSON[_0x01d6('0x10')](_0x29dcd8));_0x14ad8a(_0x29dcd8);})[_0x01d6('0x15')](function(_0x1080fe){logger[_0x01d6('0x12')](_0x01d6('0x16'),_0x1080fe['message'],_0x47b03f);_0x40e173(_0x108467[_0x01d6('0x12')](0x1f4,_0x1080fe[_0x01d6('0x13')]));});});};exports['UpdateCmHopperBlack']=function(_0x54197d){var _0x185743=this;return new Promise(function(_0x5c4aaa,_0x4e9d61){return db[_0x01d6('0x17')][_0x01d6('0x20')](_0x54197d['body'],{'raw':_0x54197d[_0x01d6('0x1a')]?_0x54197d[_0x01d6('0x1a')][_0x01d6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54197d[_0x01d6('0x1a')]?_0x54197d[_0x01d6('0x1a')][_0x01d6('0x21')]||null:null,'attributes':_0x54197d[_0x01d6('0x1a')]?_0x54197d[_0x01d6('0x1a')][_0x01d6('0x1b')]||null:null,'limit':_0x54197d[_0x01d6('0x1a')]?_0x54197d[_0x01d6('0x1a')][_0x01d6('0x1c')]||null:null})['then'](function(_0x1884a1){logger['info'](_0x01d6('0x22'),_0x54197d);logger[_0x01d6('0xe')]('UpdateCmHopperBlack',_0x54197d,JSON['stringify'](_0x1884a1));_0x5c4aaa(_0x1884a1);})['catch'](function(_0x5cefaf){logger[_0x01d6('0x12')](_0x01d6('0x22'),_0x5cefaf['message'],_0x54197d);_0x4e9d61(_0x185743[_0x01d6('0x12')](0x1f4,_0x5cefaf['message']));});});};exports[_0x01d6('0x23')]=function(_0x2bcce1){var _0x2eadce=this;return new Promise(function(_0x3ec790,_0x4a46db){return db['CmHopperBlack']['destroy']({'where':_0x2bcce1['options']?_0x2bcce1[_0x01d6('0x1a')][_0x01d6('0x21')]||null:null})[_0x01d6('0xa')](function(_0x540452){logger[_0x01d6('0xb')](_0x01d6('0x23'),_0x2bcce1);logger[_0x01d6('0xe')](_0x01d6('0x23'),_0x2bcce1,JSON[_0x01d6('0x10')](_0x540452));_0x3ec790(_0x540452);})[_0x01d6('0x15')](function(_0xb26499){logger[_0x01d6('0x12')](_0x01d6('0x23'),_0xb26499[_0x01d6('0x13')],_0x2bcce1);_0x4a46db(_0x2eadce['error'](0x1f4,_0xb26499['message']));});});}; \ No newline at end of file +var _0x15f8=['client','request','then','info','CmHopperBlack,\x20%s,\x20%s','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CmHopperBlack','findAll','options','raw','attributes','limit','map','include','model','GetCmHopperBlack','debug','catch','UpdateCmHopperBlack','update','body','where','DestroyCmHopperBlack','destroy','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise'];(function(_0x5b5879,_0x22f9d3){var _0x3210e6=function(_0x50fd86){while(--_0x50fd86){_0x5b5879['push'](_0x5b5879['shift']());}};_0x3210e6(++_0x22f9d3);}(_0x15f8,0x1f2));var _0x815f=function(_0x37f4b4,_0x37f4cd){_0x37f4b4=_0x37f4b4-0x0;var _0x2d1fc1=_0x15f8[_0x37f4b4];return _0x2d1fc1;};'use strict';var _=require(_0x815f('0x0'));var util=require(_0x815f('0x1'));var moment=require(_0x815f('0x2'));var BPromise=require(_0x815f('0x3'));var rs=require(_0x815f('0x4'));var fs=require('fs');var Redis=require(_0x815f('0x5'));var db=require(_0x815f('0x6'))['db'];var utils=require(_0x815f('0x7'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x815f('0x8'));var client=jayson[_0x815f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39f17c,_0x4a467a,_0x47478f){return new BPromise(function(_0x32dea3,_0x1db23f){return client[_0x815f('0xa')](_0x39f17c,_0x47478f)[_0x815f('0xb')](function(_0x5d8239){logger[_0x815f('0xc')](_0x815f('0xd'),_0x4a467a,'request\x20sent');logger['debug'](_0x815f('0xe'),_0x4a467a,_0x815f('0xf'),JSON[_0x815f('0x10')](_0x5d8239));if(_0x5d8239['error']){if(_0x5d8239[_0x815f('0x11')][_0x815f('0x12')]===0x1f4){logger['error'](_0x815f('0xd'),_0x4a467a,_0x5d8239[_0x815f('0x11')][_0x815f('0x13')]);return _0x1db23f(_0x5d8239[_0x815f('0x11')][_0x815f('0x13')]);}logger[_0x815f('0x11')](_0x815f('0xd'),_0x4a467a,_0x5d8239[_0x815f('0x11')]['message']);return _0x32dea3(_0x5d8239[_0x815f('0x11')][_0x815f('0x13')]);}else{logger[_0x815f('0xc')](_0x815f('0xd'),_0x4a467a,'request\x20sent');_0x32dea3(_0x5d8239[_0x815f('0x14')][_0x815f('0x13')]);}})['catch'](function(_0x4b2ad6){logger[_0x815f('0x11')](_0x815f('0xd'),_0x4a467a,_0x4b2ad6);_0x1db23f(_0x4b2ad6);});});}exports['GetCmHopperBlack']=function(_0x3c2201){var _0x3adf4c=this;return new Promise(function(_0x550135,_0x2fd632){return db[_0x815f('0x15')][_0x815f('0x16')]({'raw':_0x3c2201[_0x815f('0x17')]?_0x3c2201[_0x815f('0x17')][_0x815f('0x18')]===undefined?!![]:![]:!![],'where':_0x3c2201[_0x815f('0x17')]?_0x3c2201[_0x815f('0x17')]['where']||null:null,'attributes':_0x3c2201['options']?_0x3c2201[_0x815f('0x17')][_0x815f('0x19')]||null:null,'limit':_0x3c2201['options']?_0x3c2201[_0x815f('0x17')][_0x815f('0x1a')]||null:null,'include':_0x3c2201[_0x815f('0x17')]?_0x3c2201[_0x815f('0x17')]['include']?_[_0x815f('0x1b')](_0x3c2201['options'][_0x815f('0x1c')],function(_0x2d91a8){return{'model':db[_0x2d91a8[_0x815f('0x1d')]],'as':_0x2d91a8['as'],'attributes':_0x2d91a8[_0x815f('0x19')],'include':_0x2d91a8['include']?_[_0x815f('0x1b')](_0x2d91a8[_0x815f('0x1c')],function(_0x3d5f48){return{'model':db[_0x3d5f48['model']],'as':_0x3d5f48['as'],'attributes':_0x3d5f48[_0x815f('0x19')],'include':_0x3d5f48[_0x815f('0x1c')]?_[_0x815f('0x1b')](_0x3d5f48[_0x815f('0x1c')],function(_0x2de3db){return{'model':db[_0x2de3db['model']],'as':_0x2de3db['as'],'attributes':_0x2de3db[_0x815f('0x19')]};}):[]};}):[]};}):[]:[]})[_0x815f('0xb')](function(_0x56b6fe){logger[_0x815f('0xc')](_0x815f('0x1e'),_0x3c2201);logger[_0x815f('0x1f')](_0x815f('0x1e'),_0x3c2201,JSON[_0x815f('0x10')](_0x56b6fe));_0x550135(_0x56b6fe);})[_0x815f('0x20')](function(_0x152157){logger['error'](_0x815f('0x1e'),_0x152157[_0x815f('0x13')],_0x3c2201);_0x2fd632(_0x3adf4c['error'](0x1f4,_0x152157['message']));});});};exports[_0x815f('0x21')]=function(_0x793973){var _0x37822e=this;return new Promise(function(_0x2522c4,_0x126e6d){return db[_0x815f('0x15')][_0x815f('0x22')](_0x793973[_0x815f('0x23')],{'raw':_0x793973['options']?_0x793973[_0x815f('0x17')][_0x815f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x793973[_0x815f('0x17')]?_0x793973[_0x815f('0x17')][_0x815f('0x24')]||null:null,'attributes':_0x793973[_0x815f('0x17')]?_0x793973['options']['attributes']||null:null,'limit':_0x793973[_0x815f('0x17')]?_0x793973[_0x815f('0x17')][_0x815f('0x1a')]||null:null})[_0x815f('0xb')](function(_0x55ccdd){logger[_0x815f('0xc')](_0x815f('0x21'),_0x793973);logger[_0x815f('0x1f')](_0x815f('0x21'),_0x793973,JSON[_0x815f('0x10')](_0x55ccdd));_0x2522c4(_0x55ccdd);})['catch'](function(_0x333f30){logger[_0x815f('0x11')](_0x815f('0x21'),_0x333f30[_0x815f('0x13')],_0x793973);_0x126e6d(_0x37822e[_0x815f('0x11')](0x1f4,_0x333f30[_0x815f('0x13')]));});});};exports[_0x815f('0x25')]=function(_0x585aa7){var _0x5decfc=this;return new Promise(function(_0x41ebf9,_0x2729b7){return db['CmHopperBlack'][_0x815f('0x26')]({'where':_0x585aa7[_0x815f('0x17')]?_0x585aa7[_0x815f('0x17')][_0x815f('0x24')]||null:null})[_0x815f('0xb')](function(_0x53976c){logger['info']('DestroyCmHopperBlack',_0x585aa7);logger[_0x815f('0x1f')](_0x815f('0x25'),_0x585aa7,JSON['stringify'](_0x53976c));_0x41ebf9(_0x53976c);})[_0x815f('0x20')](function(_0x3a76e7){logger['error'](_0x815f('0x25'),_0x3a76e7[_0x815f('0x13')],_0x585aa7);_0x2729b7(_0x5decfc[_0x815f('0x11')](0x1f4,_0x3a76e7[_0x815f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 0eed7b7..5eb6af1 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 _0x0adf=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','get','/describe','describe','/:id','put','update','delete','multer','util'];(function(_0x138676,_0x27a8d5){var _0xf72f74=function(_0xc6036a){while(--_0xc6036a){_0x138676['push'](_0x138676['shift']());}};_0xf72f74(++_0x27a8d5);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x253969,_0x3ca1f1){_0x253969=_0x253969-0x0;var _0x84ff8b=_0x0adf[_0x253969];return _0x84ff8b;};'use strict';var multer=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var path=require(_0xf0ad('0x2'));var timeout=require('connect-timeout');var express=require(_0xf0ad('0x3'));var router=express[_0xf0ad('0x4')]();var fs_extra=require(_0xf0ad('0x5'));var auth=require(_0xf0ad('0x6'));var interaction=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var controller=require(_0xf0ad('0x9'));router['get']('/',auth[_0xf0ad('0xa')](),controller['index']);router[_0xf0ad('0xb')](_0xf0ad('0xc'),auth[_0xf0ad('0xa')](),controller[_0xf0ad('0xd')]);router[_0xf0ad('0xb')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['show']);router[_0xf0ad('0xf')]('/:id',auth[_0xf0ad('0xa')](),controller[_0xf0ad('0x10')]);router[_0xf0ad('0x11')](_0xf0ad('0xe'),auth[_0xf0ad('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xfb65=['put','update','destroy','exports','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x162377,_0xdea672){var _0x4d5a79=function(_0x244bef){while(--_0x244bef){_0x162377['push'](_0x162377['shift']());}};_0x4d5a79(++_0xdea672);}(_0xfb65,0x82));var _0x5fb6=function(_0x3fe0fe,_0x3bdc49){_0x3fe0fe=_0x3fe0fe-0x0;var _0x5c11f4=_0xfb65[_0x3fe0fe];return _0x5c11f4;};'use strict';var multer=require('multer');var util=require(_0x5fb6('0x0'));var path=require(_0x5fb6('0x1'));var timeout=require('connect-timeout');var express=require(_0x5fb6('0x2'));var router=express['Router']();var fs_extra=require(_0x5fb6('0x3'));var auth=require(_0x5fb6('0x4'));var interaction=require(_0x5fb6('0x5'));var config=require(_0x5fb6('0x6'));var controller=require(_0x5fb6('0x7'));router[_0x5fb6('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5fb6('0x8')](_0x5fb6('0x9'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xb')]);router['get'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xd')]);router[_0x5fb6('0xe')]('/:id',auth[_0x5fb6('0xa')](),controller[_0x5fb6('0xf')]);router['delete'](_0x5fb6('0xc'),auth[_0x5fb6('0xa')](),controller[_0x5fb6('0x10')]);module[_0x5fb6('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index d49e721..721e64e 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 _0xe1f7=['INTEGER','STRING','DATE','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment','exports'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xe1f7,0xce));var _0x7e1f=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe1f7[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0x7e1f('0x0'));var moment=require(_0x7e1f('0x1'));module[_0x7e1f('0x2')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x7e1f('0x4')]},'originatecalleridname':{'type':Sequelize[_0x7e1f('0x4')]},'calleridnum':{'type':Sequelize[_0x7e1f('0x4')]},'calleridname':{'type':Sequelize[_0x7e1f('0x4')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x7e1f('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x7e1f('0x5')]},'ringtime':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x7e1f('0x4')]},'membername':{'type':Sequelize[_0x7e1f('0x4')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7e1f('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7e1f('0x4')]},'dispositionat':{'type':Sequelize[_0x7e1f('0x5')],'set':function(_0x5c81fd){var _0x4f2535=this['getDataValue'](_0x7e1f('0x6'));if(_0x4f2535&&_0x5c81fd){this[_0x7e1f('0x7')](_0x7e1f('0x8'),moment(_0x5c81fd)['diff'](moment(_0x4f2535),_0x7e1f('0x9')));}}},'amd':{'type':Sequelize[_0x7e1f('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x7e1f('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x7e1f('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x7e1f('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x7e1f('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x7e1f('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x7e1f('0x5')]},'recallme':{'type':Sequelize[_0x7e1f('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x7e1f('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7e1f('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa852=['seconds','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff'];(function(_0x5c851b,_0x50dd16){var _0x39d867=function(_0x3d054f){while(--_0x3d054f){_0x5c851b['push'](_0x5c851b['shift']());}};_0x39d867(++_0x50dd16);}(_0xa852,0x1a6));var _0x2a85=function(_0x53ae05,_0x3caf1a){_0x53ae05=_0x53ae05-0x0;var _0x20b4c2=_0xa852[_0x53ae05];return _0x20b4c2;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x2a85('0x0'));module[_0x2a85('0x1')]={'state':{'type':Sequelize[_0x2a85('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x2a85('0x3')]},'scheduledat':{'type':Sequelize[_0x2a85('0x4')]},'countbusyretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x2a85('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x2a85('0x3')]},'originatecalleridname':{'type':Sequelize[_0x2a85('0x3')]},'calleridnum':{'type':Sequelize[_0x2a85('0x3')]},'calleridname':{'type':Sequelize[_0x2a85('0x3')]},'starttime':{'type':Sequelize[_0x2a85('0x4')]},'responsetime':{'type':Sequelize[_0x2a85('0x4')]},'answertime':{'type':Sequelize[_0x2a85('0x4')]},'droptime':{'type':Sequelize[_0x2a85('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x2a85('0x3')]},'campaign':{'type':Sequelize[_0x2a85('0x3')]},'campaigntype':{'type':Sequelize[_0x2a85('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x2a85('0x3')]},'disposition':{'type':Sequelize[_0x2a85('0x3')]},'secondDisposition':{'type':Sequelize[_0x2a85('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2a85('0x3')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x1ed09a){var _0x3f530b=this[_0x2a85('0x5')](_0x2a85('0x6'));if(_0x3f530b&&_0x1ed09a){this[_0x2a85('0x7')](_0x2a85('0x8'),moment(_0x1ed09a)[_0x2a85('0x9')](moment(_0x3f530b),_0x2a85('0xa')));}}},'amd':{'type':Sequelize[_0x2a85('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x2a85('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x2a85('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x2a85('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x2a85('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x2a85('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x2a85('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x2a85('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x2a85('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2a85('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index d8fac8c..e6c8738 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 _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0x5d17,0x114));var _0x75d1=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0x5d17[_0x2d7226];return _0x59b03f;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0xafc4=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','CmHopperFinal','includeAll','catch','show','params','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','ANY_VALUE(calleridnum)','NOW()','ContactId','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','Campaign','fromQuery','CampaignId','CampaignId\x20=\x20?','group','CmHopper','findOne','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api'];(function(_0x20752f,_0x30e207){var _0x5906cd=function(_0x3d6ca1){while(--_0x3d6ca1){_0x20752f['push'](_0x20752f['shift']());}};_0x5906cd(++_0x30e207);}(_0xafc4,0x69));var _0x4afc=function(_0x28d90b,_0x3dd25b){_0x28d90b=_0x28d90b-0x0;var _0xeddda8=_0xafc4[_0x28d90b];return _0xeddda8;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['CmHopperFinal'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':!![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['CmHopperFinal']['describe']()['then'](respondWithResult(_0x19a0ac,null))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x42e274,_0x269c24){if(_0x42e274[_0x4afc('0x43')][_0x4afc('0x44')]){delete _0x42e274[_0x4afc('0x43')][_0x4afc('0x44')];}return db[_0x4afc('0x3d')][_0x4afc('0x45')]({'where':{'uniqueid':_0x42e274['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x269c24,null))['then'](saveUpdates(_0x42e274['body'],null))[_0x4afc('0x25')](respondWithResult(_0x269c24,null))['catch'](handleError(_0x269c24,null));};exports[_0x4afc('0x46')]=function(_0x355198,_0x2fe2ae,_0x2cafc3){return db['CmHopperFinal'][_0x4afc('0x47')]({'raw':![],'where':{'VoiceQueueId':_0x355198['params']['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x203,\x201,\x20null'))),_0x4afc('0x4d')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x208,\x201,\x20null'))),_0x4afc('0x50')],[db['sequelize']['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x51')))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x53')))),_0x4afc('0x54')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})[_0x4afc('0x25')](handleEntityNotFound(_0x2fe2ae,null))[_0x4afc('0x25')](respondWithResult(_0x2fe2ae,null))[_0x4afc('0x3f')](handleError(_0x2fe2ae,null));};exports[_0x4afc('0x57')]=function(_0x4985c6,_0x1771e8,_0x323c65){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x4985c6[_0x4afc('0x41')]['id']},'attributes':[[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x4b')))),_0x4afc('0x4c')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x58')))),'noAnswerContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x4e')))),_0x4afc('0x4f')],[db['sequelize']['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x59')))),_0x4afc('0x50')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db[_0x4afc('0x48')][_0x4afc('0x4a')](_0x4afc('0x5a')))),'dropContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4afc('0x52')],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db['sequelize']['fn']('IF',db[_0x4afc('0x48')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x4afc('0x48')]['fn'](_0x4afc('0x49'),db[_0x4afc('0x48')]['fn']('IF',db['sequelize'][_0x4afc('0x4a')](_0x4afc('0x55')))),_0x4afc('0x56')]]})['then'](handleEntityNotFound(_0x1771e8,null))[_0x4afc('0x25')](respondWithResult(_0x1771e8,null))[_0x4afc('0x3f')](handleError(_0x1771e8,null));};exports[_0x4afc('0x5b')]=function(_0x392252,_0x1f652a,_0x481263){return db['VoiceQueue'][_0x4afc('0x45')]({'where':{'id':_0x392252[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x1f652a,null))['then'](function(_0x380c56){var _0x14a216;if(_0x380c56){_0x14a216=squel[_0x4afc('0x5c')]()[_0x4afc('0x5d')](_0x4afc('0x5e'))['fromQuery']([_0x4afc('0x5f'),_0x4afc('0x60'),'ContactId',_0x4afc('0x61'),_0x4afc('0x62'),_0x4afc('0x63'),'updatedAt'],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))['field']('ANY_VALUE(ListId)',_0x4afc('0x61'))[_0x4afc('0x65')](_0x4afc('0x69'),'VoiceQueueId')['field'](_0x4afc('0x67'),_0x4afc('0x63'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x6a'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x392252[_0x4afc('0x43')][_0x4afc('0x70')][_0x4afc('0x6e')]())['where'](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))[_0x4afc('0x37')]('VoiceQueueId\x20=\x20?',_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x6d'),_0x392252[_0x4afc('0x41')]['id'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x74')))['group'](_0x4afc('0x68')))[_0x4afc('0x6e')]();return db['sequelize'][_0x4afc('0x2d')](_0x14a216);}return[];})[_0x4afc('0x25')](respondWithResult(_0x1f652a,null))[_0x4afc('0x3f')](handleError(_0x1f652a,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1c3d20,_0x3478aa,_0x24553b){return db[_0x4afc('0x75')]['find']({'where':{'id':_0x1c3d20[_0x4afc('0x41')]['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x3478aa,null))['then'](function(_0x2dc8a1){var _0x36f3ea;if(_0x2dc8a1){_0x36f3ea=squel[_0x4afc('0x5c')]()['into']('cm_hopper')[_0x4afc('0x76')]([_0x4afc('0x5f'),_0x4afc('0x60'),_0x4afc('0x68'),_0x4afc('0x61'),_0x4afc('0x77'),_0x4afc('0x63'),_0x4afc('0x6a')],squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x66'),_0x4afc('0x5f'))[_0x4afc('0x65')](_0x4afc('0x67'),_0x4afc('0x60'))[_0x4afc('0x65')]('ANY_VALUE(ContactId)',_0x4afc('0x68'))[_0x4afc('0x65')]('ANY_VALUE(ListId)',_0x4afc('0x61'))['field']('ANY_VALUE(CampaignId)',_0x4afc('0x77'))['field']('NOW()',_0x4afc('0x63'))['field'](_0x4afc('0x67'),'updatedAt')[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')](_0x4afc('0x6f'),_0x1c3d20['body']['state'][_0x4afc('0x6e')]())[_0x4afc('0x37')](_0x4afc('0x71'))[_0x4afc('0x37')](_0x4afc('0x72'),squel['select']()[_0x4afc('0x65')](_0x4afc('0x5f'))[_0x4afc('0x6b')](_0x4afc('0x5e'))['where'](_0x4afc('0x78'),_0x1c3d20['params']['id'][_0x4afc('0x6e')]()))[_0x4afc('0x37')](_0x4afc('0x72'),squel[_0x4afc('0x64')]()[_0x4afc('0x65')](_0x4afc('0x73'))[_0x4afc('0x6b')](_0x4afc('0x6c'))[_0x4afc('0x37')](_0x4afc('0x78'),_0x1c3d20[_0x4afc('0x41')]['id']['toString']())[_0x4afc('0x37')]('state\x20=\x204'))[_0x4afc('0x79')]('ContactId'))['toString']();return db[_0x4afc('0x48')]['query'](_0x36f3ea);}return[];})['then'](respondWithResult(_0x3478aa,null))[_0x4afc('0x3f')](handleError(_0x3478aa,null));};exports['checkContactHopper']=function(_0x272e36,_0x24bf53,_0x5b1421){return db[_0x4afc('0x7a')][_0x4afc('0x7b')]({'where':{'VoiceQueueId':_0x272e36['body'][_0x4afc('0x62')],'CampaignId':_0x272e36[_0x4afc('0x43')][_0x4afc('0x77')],'ContactId':_0x272e36['body'][_0x4afc('0x68')]}})[_0x4afc('0x25')](handleEntityNotFound(_0x24bf53,null))[_0x4afc('0x25')](function(_0x16eb6d){if(_0x16eb6d){return _0x16eb6d;}return null;})[_0x4afc('0x25')](respondWithResult(_0x24bf53,null))[_0x4afc('0x3f')](handleError(_0x24bf53,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 37c6e77..1f5f0d7 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 _0x6ac8=['./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum','uniqueid','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x6ac8,0x68));var _0x86ac=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0x6ac8[_0x4bfac3];return _0x15f0f2;};'use strict';var _=require('lodash');var util=require(_0x86ac('0x0'));var logger=require(_0x86ac('0x1'))('api');var moment=require(_0x86ac('0x2'));var BPromise=require(_0x86ac('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x86ac('0x4'));var rimraf=require(_0x86ac('0x5'));var config=require('../../config/environment');var attributes=require(_0x86ac('0x6'));module[_0x86ac('0x7')]=function(_0x13e41c,_0x1e3c50){return _0x13e41c['define'](_0x86ac('0x8'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x86ac('0x9'),'fields':['calleridnum']},{'name':_0x86ac('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbcfd=['uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum'];(function(_0x28ef59,_0xea5c6){var _0x5bc80e=function(_0x9f4b64){while(--_0x9f4b64){_0x28ef59['push'](_0x28ef59['shift']());}};_0x5bc80e(++_0xea5c6);}(_0xbcfd,0xf8));var _0xdbcf=function(_0x40b139,_0x48bc76){_0x40b139=_0x40b139-0x0;var _0xea7239=_0xbcfd[_0x40b139];return _0xea7239;};'use strict';var _=require(_0xdbcf('0x0'));var util=require(_0xdbcf('0x1'));var logger=require('../../config/logger')(_0xdbcf('0x2'));var moment=require('moment');var BPromise=require(_0xdbcf('0x3'));var rp=require(_0xdbcf('0x4'));var fs=require('fs');var path=require(_0xdbcf('0x5'));var rimraf=require(_0xdbcf('0x6'));var config=require(_0xdbcf('0x7'));var attributes=require(_0xdbcf('0x8'));module[_0xdbcf('0x9')]=function(_0x19d044,_0x142b48){return _0x19d044['define'](_0xdbcf('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xdbcf('0xb'),'fields':[_0xdbcf('0xb')]},{'name':'uniqueid','fields':[_0xdbcf('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index d0d9422..4447057 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x50059c,_0x157c3e){var _0x5d7d3c=function(_0xb21c99){while(--_0xb21c99){_0x50059c['push'](_0x50059c['shift']());}};_0x5d7d3c(++_0x157c3e);}(_0xb10b,0x12a));var _0xbb10=function(_0xe8b9c7,_0x534838){_0xe8b9c7=_0xe8b9c7-0x0;var _0x4b606f=_0xb10b[_0xe8b9c7];return _0x4b606f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x169091,_0x4b0101){var _0x7ac8b6=function(_0x19e948){while(--_0x19e948){_0x169091['push'](_0x169091['shift']());}};_0x7ac8b6(++_0x4b0101);}(_0xb10b,0x12a));var _0xbb10=function(_0x5cc61d,_0x4fe17b){_0x5cc61d=_0x5cc61d-0x0;var _0x2e25d0=_0xb10b[_0x5cc61d];return _0x2e25d0;};'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 012ec2b..4c05c00 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 _0x11b2=['/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','post','/checkContactHopper','put','/:id','update','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x477d3e,_0x25003b){var _0x4addc1=function(_0x169e9e){while(--_0x169e9e){_0x477d3e['push'](_0x477d3e['shift']());}};_0x4addc1(++_0x25003b);}(_0x11b2,0x1e9));var _0x211b=function(_0x550b9d,_0x2636bc){_0x550b9d=_0x550b9d-0x0;var _0x1163b9=_0x11b2[_0x550b9d];return _0x1163b9;};'use strict';var multer=require(_0x211b('0x0'));var util=require(_0x211b('0x1'));var path=require(_0x211b('0x2'));var timeout=require('connect-timeout');var express=require(_0x211b('0x3'));var router=express['Router']();var fs_extra=require(_0x211b('0x4'));var auth=require(_0x211b('0x5'));var interaction=require(_0x211b('0x6'));var config=require(_0x211b('0x7'));var controller=require(_0x211b('0x8'));router[_0x211b('0x9')]('/',auth[_0x211b('0xa')](),controller[_0x211b('0xb')]);router[_0x211b('0x9')](_0x211b('0xc'),auth['isAuthenticated'](),controller[_0x211b('0xd')]);router[_0x211b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x211b('0xe')]);router[_0x211b('0x9')](_0x211b('0xf'),auth['isAuthenticated'](),controller[_0x211b('0x10')]);router[_0x211b('0x9')](_0x211b('0x11'),auth[_0x211b('0xa')](),controller[_0x211b('0x12')]);router['post'](_0x211b('0x13'),auth[_0x211b('0xa')](),controller[_0x211b('0x14')]);router['post'](_0x211b('0x15'),auth[_0x211b('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x211b('0x16')](_0x211b('0x17'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x211b('0x18')](_0x211b('0x19'),auth[_0x211b('0xa')](),controller[_0x211b('0x1a')]);module[_0x211b('0x1b')]=router; \ No newline at end of file +var _0x390a=['../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','get','isAuthenticated','/describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x1ee3d4,_0x38f6f2){var _0x1bd4e7=function(_0x17cec9){while(--_0x17cec9){_0x1ee3d4['push'](_0x1ee3d4['shift']());}};_0x1bd4e7(++_0x38f6f2);}(_0x390a,0xc9));var _0xa390=function(_0x5e3b42,_0x37748f){_0x5e3b42=_0x5e3b42-0x0;var _0x19c964=_0x390a[_0x5e3b42];return _0x19c964;};'use strict';var multer=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var path=require(_0xa390('0x2'));var timeout=require(_0xa390('0x3'));var express=require('express');var router=express[_0xa390('0x4')]();var fs_extra=require(_0xa390('0x5'));var auth=require(_0xa390('0x6'));var interaction=require(_0xa390('0x7'));var config=require('../../config/environment');var controller=require(_0xa390('0x8'));router[_0xa390('0x9')]('/',auth[_0xa390('0xa')](),controller['index']);router[_0xa390('0x9')](_0xa390('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xa390('0x9')](_0xa390('0xc'),auth[_0xa390('0xa')](),controller[_0xa390('0xd')]);router[_0xa390('0x9')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0xa390('0xe')]);router[_0xa390('0x9')](_0xa390('0xf'),auth['isAuthenticated'](),controller[_0xa390('0x10')]);router[_0xa390('0x11')]('/voice/queue/moveContacts/:id',auth[_0xa390('0xa')](),controller[_0xa390('0x12')]);router['post']('/voice/campaign/moveContacts/:id',auth[_0xa390('0xa')](),controller[_0xa390('0x13')]);router['post'](_0xa390('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router['put'](_0xa390('0xc'),auth['isAuthenticated'](),controller[_0xa390('0x15')]);module[_0xa390('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 0021ece..8625e1e 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 _0x33de=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x310cc4,_0x5d438a){var _0x1e7617=function(_0x4e2c62){while(--_0x4e2c62){_0x310cc4['push'](_0x310cc4['shift']());}};_0x1e7617(++_0x5d438a);}(_0x33de,0x14b));var _0xe33d=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x33de[_0x55cdc5];return _0x29acd5;};'use strict';var Sequelize=require(_0xe33d('0x0'));module[_0xe33d('0x1')]={'state':{'type':Sequelize[_0xe33d('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe33d('0x3')]},'scheduledat':{'type':Sequelize[_0xe33d('0x4')]},'countbusyretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe33d('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xe33d('0x3')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe33d('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe33d('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xe33d('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe33d('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0xe33d('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0xe33d('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe33d('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe33d('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xe33d('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe33d('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe33d('0x3')]}}; \ No newline at end of file +var _0x633b=['sequelize','exports','INTEGER','STRING','DATE','BOOLEAN'];(function(_0x41af75,_0x123ae5){var _0x317f57=function(_0x198173){while(--_0x198173){_0x41af75['push'](_0x41af75['shift']());}};_0x317f57(++_0x123ae5);}(_0x633b,0xd8));var _0xb633=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x633b[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb633('0x0'));module[_0xb633('0x1')]={'state':{'type':Sequelize[_0xb633('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb633('0x3')]},'scheduledat':{'type':Sequelize[_0xb633('0x4')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb633('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb633('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb633('0x3')]},'calleridnum':{'type':Sequelize[_0xb633('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xb633('0x4')]},'responsetime':{'type':Sequelize[_0xb633('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb633('0x4')]},'endtime':{'type':Sequelize[_0xb633('0x4')]},'ringtime':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb633('0x3')]},'campaign':{'type':Sequelize[_0xb633('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb633('0x3')]},'reason':{'type':Sequelize[_0xb633('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xb633('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb633('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb633('0x4')]},'recallme':{'type':Sequelize[_0xb633('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xb633('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb633('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb633('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 84b2784..496b851 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 _0x5c56=['options','include','rows','catch','params','length','includeAll','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','CmHopperHistory','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL'];(function(_0x23c0af,_0x56a715){var _0x495cd0=function(_0x124b41){while(--_0x124b41){_0x23c0af['push'](_0x23c0af['shift']());}};_0x495cd0(++_0x56a715);}(_0x5c56,0x1e0));var _0x65c5=function(_0x14a1df,_0x3657e2){_0x14a1df=_0x14a1df-0x0;var _0x2dd91e=_0x5c56[_0x14a1df];return _0x2dd91e;};'use strict';var emlformat=require(_0x65c5('0x0'));var rimraf=require(_0x65c5('0x1'));var zipdir=require(_0x65c5('0x2'));var jsonpatch=require(_0x65c5('0x3'));var rp=require(_0x65c5('0x4'));var moment=require(_0x65c5('0x5'));var BPromise=require(_0x65c5('0x6'));var Mustache=require('mustache');var util=require(_0x65c5('0x7'));var path=require('path');var sox=require(_0x65c5('0x8'));var csv=require(_0x65c5('0x9'));var ejs=require(_0x65c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x65c5('0xb'));var squel=require(_0x65c5('0xc'));var crypto=require(_0x65c5('0xd'));var jsforce=require(_0x65c5('0xe'));var deskjs=require(_0x65c5('0xf'));var toCsv=require(_0x65c5('0x9'));var querystring=require(_0x65c5('0x10'));var Papa=require(_0x65c5('0x11'));var Redis=require(_0x65c5('0x12'));var authService=require(_0x65c5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x65c5('0x14'));var hardwareService=require(_0x65c5('0x15'));var logger=require('../../config/logger')(_0x65c5('0x16'));var utils=require(_0x65c5('0x17'));var config=require(_0x65c5('0x18'));var licenseUtil=require(_0x65c5('0x19'));var db=require(_0x65c5('0x1a'))['db'];function respondWithStatusCode(_0x448959,_0x4f9866){_0x4f9866=_0x4f9866||0xcc;return function(_0x68dddd){if(_0x68dddd){return _0x448959['sendStatus'](_0x4f9866);}return _0x448959[_0x65c5('0x1b')](_0x4f9866)[_0x65c5('0x1c')]();};}function respondWithResult(_0x9c489b,_0x384dd2){_0x384dd2=_0x384dd2||0xc8;return function(_0x456518){if(_0x456518){return _0x9c489b[_0x65c5('0x1b')](_0x384dd2)[_0x65c5('0x1d')](_0x456518);}};}function respondWithFilteredResult(_0x5695fa,_0x2fb1a4){return function(_0x6e0713){if(_0x6e0713){var _0x26632d=typeof _0x2fb1a4['offset']==='undefined'&&typeof _0x2fb1a4['limit']===_0x65c5('0x1e');var _0x3df78d=_0x6e0713['count'];var _0x22b570=_0x26632d?0x0:_0x2fb1a4[_0x65c5('0x1f')];var _0x1f4171=_0x26632d?_0x6e0713[_0x65c5('0x20')]:_0x2fb1a4[_0x65c5('0x1f')]+_0x2fb1a4[_0x65c5('0x21')];var _0x557d7b;if(_0x1f4171>=_0x3df78d){_0x1f4171=_0x3df78d;_0x557d7b=0xc8;}else{_0x557d7b=0xce;}_0x5695fa[_0x65c5('0x1b')](_0x557d7b);return _0x5695fa[_0x65c5('0x22')](_0x65c5('0x23'),_0x22b570+'-'+_0x1f4171+'/'+_0x3df78d)['json'](_0x6e0713);}return null;};}function patchUpdates(_0x1c1a9c){return function(_0x4a2f26){try{jsonpatch[_0x65c5('0x24')](_0x4a2f26,_0x1c1a9c,!![]);}catch(_0x150d65){return BPromise[_0x65c5('0x25')](_0x150d65);}return _0x4a2f26[_0x65c5('0x26')]();};}function saveUpdates(_0x3e3542,_0xc8c9ef){return function(_0x2514a1){if(_0x2514a1){return _0x2514a1['update'](_0x3e3542)[_0x65c5('0x27')](function(_0x484f17){return _0x484f17;});}return null;};}function removeEntity(_0x3a0a44,_0x5d6db9){return function(_0x2866d8){if(_0x2866d8){return _0x2866d8[_0x65c5('0x28')]()[_0x65c5('0x27')](function(){_0x3a0a44[_0x65c5('0x1b')](0xcc)[_0x65c5('0x1c')]();});}};}function handleEntityNotFound(_0x18344d,_0x12ec99){return function(_0x47d62c){if(!_0x47d62c){_0x18344d['sendStatus'](0x194);}return _0x47d62c;};}function handleError(_0x1ad828,_0x4a0c73){_0x4a0c73=_0x4a0c73||0x1f4;return function(_0x8e6748){logger[_0x65c5('0x29')](_0x8e6748['stack']);if(_0x8e6748[_0x65c5('0x2a')]){delete _0x8e6748[_0x65c5('0x2a')];}_0x1ad828[_0x65c5('0x1b')](_0x4a0c73)[_0x65c5('0x2b')](_0x8e6748);};}exports['index']=function(_0x5c02f9,_0x52372d){var _0x1d8e91={},_0x3cf657={},_0xc74652={'count':0x0,'rows':[]};var _0x167597=_[_0x65c5('0x2c')](db[_0x65c5('0x2d')][_0x65c5('0x2e')],function(_0x3e0ecb){return{'name':_0x3e0ecb[_0x65c5('0x2f')],'type':_0x3e0ecb[_0x65c5('0x30')][_0x65c5('0x31')]};});_0x3cf657['model']=_[_0x65c5('0x2c')](_0x167597,_0x65c5('0x2a'));_0x3cf657[_0x65c5('0x32')]=_[_0x65c5('0x33')](_0x5c02f9[_0x65c5('0x32')]);_0x3cf657[_0x65c5('0x34')]=_[_0x65c5('0x35')](_0x3cf657[_0x65c5('0x36')],_0x3cf657[_0x65c5('0x32')]);_0x1d8e91[_0x65c5('0x37')]=_[_0x65c5('0x35')](_0x3cf657['model'],qs[_0x65c5('0x38')](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x38')]));_0x1d8e91[_0x65c5('0x37')]=_0x1d8e91['attributes']['length']?_0x1d8e91['attributes']:_0x3cf657[_0x65c5('0x36')];if(!_0x5c02f9['query'][_0x65c5('0x39')](_0x65c5('0x3a'))){_0x1d8e91['limit']=qs['limit'](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x21')]);_0x1d8e91[_0x65c5('0x1f')]=qs[_0x65c5('0x1f')](_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x1f')]);}_0x1d8e91[_0x65c5('0x3b')]=qs[_0x65c5('0x3c')](_0x5c02f9['query'][_0x65c5('0x3c')]);_0x1d8e91['where']=qs[_0x65c5('0x34')](_[_0x65c5('0x3d')](_0x5c02f9[_0x65c5('0x32')],_0x3cf657[_0x65c5('0x34')]),_0x167597);if(_0x5c02f9['query'][_0x65c5('0x3e')]){_0x1d8e91[_0x65c5('0x3f')]=_[_0x65c5('0x40')](_0x1d8e91['where'],{'$or':_[_0x65c5('0x2c')](_0x167597,function(_0x46e442){if(_0x46e442['type']!==_0x65c5('0x41')){var _0x465c35={};_0x465c35[_0x46e442[_0x65c5('0x2a')]]={'$like':'%'+_0x5c02f9[_0x65c5('0x32')][_0x65c5('0x3e')]+'%'};return _0x465c35;}})});}_0x1d8e91=_['merge']({},_0x1d8e91,_0x5c02f9[_0x65c5('0x42')]);var _0x4da0e5={'where':_0x1d8e91[_0x65c5('0x3f')]};return db[_0x65c5('0x2d')]['count'](_0x4da0e5)[_0x65c5('0x27')](function(_0x435e95){_0xc74652[_0x65c5('0x20')]=_0x435e95;if(_0x5c02f9['query']['includeAll']){_0x1d8e91[_0x65c5('0x43')]=[{'all':!![]}];}return db[_0x65c5('0x2d')]['findAll'](_0x1d8e91);})['then'](function(_0x4283b4){_0xc74652[_0x65c5('0x44')]=_0x4283b4;return _0xc74652;})[_0x65c5('0x27')](respondWithFilteredResult(_0x52372d,_0x1d8e91))[_0x65c5('0x45')](handleError(_0x52372d,null));};exports['show']=function(_0x1586c1,_0x4f97ca){var _0x4b6e9f={'raw':!![],'where':{'id':_0x1586c1[_0x65c5('0x46')]['id']}},_0x3ca88f={};_0x3ca88f[_0x65c5('0x36')]=_[_0x65c5('0x33')](db[_0x65c5('0x2d')]['rawAttributes']);_0x3ca88f[_0x65c5('0x32')]=_['keys'](_0x1586c1[_0x65c5('0x32')]);_0x3ca88f[_0x65c5('0x34')]=_['intersection'](_0x3ca88f['model'],_0x3ca88f[_0x65c5('0x32')]);_0x4b6e9f[_0x65c5('0x37')]=_[_0x65c5('0x35')](_0x3ca88f[_0x65c5('0x36')],qs[_0x65c5('0x38')](_0x1586c1[_0x65c5('0x32')][_0x65c5('0x38')]));_0x4b6e9f[_0x65c5('0x37')]=_0x4b6e9f[_0x65c5('0x37')][_0x65c5('0x47')]?_0x4b6e9f[_0x65c5('0x37')]:_0x3ca88f[_0x65c5('0x36')];if(_0x1586c1[_0x65c5('0x32')][_0x65c5('0x48')]){_0x4b6e9f['include']=[{'all':!![]}];}_0x4b6e9f=_[_0x65c5('0x40')]({},_0x4b6e9f,_0x1586c1['options']);return db[_0x65c5('0x2d')]['find'](_0x4b6e9f)['then'](handleEntityNotFound(_0x4f97ca,null))[_0x65c5('0x27')](respondWithResult(_0x4f97ca,null))[_0x65c5('0x45')](handleError(_0x4f97ca,null));};exports['create']=function(_0x5e533c,_0x464c08){return db[_0x65c5('0x2d')][_0x65c5('0x49')](_0x5e533c[_0x65c5('0x4a')],{})[_0x65c5('0x27')](respondWithResult(_0x464c08,0xc9))[_0x65c5('0x45')](handleError(_0x464c08,null));};exports[_0x65c5('0x4b')]=function(_0x4e10e5,_0x53761d){return db[_0x65c5('0x2d')][_0x65c5('0x4b')]()[_0x65c5('0x27')](respondWithResult(_0x53761d,null))[_0x65c5('0x45')](handleError(_0x53761d,null));};exports['update']=function(_0x2e5165,_0x146648){if(_0x2e5165[_0x65c5('0x4a')][_0x65c5('0x4c')]){delete _0x2e5165[_0x65c5('0x4a')][_0x65c5('0x4c')];}return db[_0x65c5('0x2d')][_0x65c5('0x4d')]({'where':{'uniqueid':_0x2e5165[_0x65c5('0x46')]['id']}})['then'](handleEntityNotFound(_0x146648,null))['then'](saveUpdates(_0x2e5165[_0x65c5('0x4a')],null))[_0x65c5('0x27')](respondWithResult(_0x146648,null))['catch'](handleError(_0x146648,null));}; \ No newline at end of file +var _0x58df=['save','update','then','destroy','sendStatus','error','stack','name','index','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','CmHopperHistory','rows','catch','show','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x354315,_0x4eacf9){var _0x193970=function(_0x1790f4){while(--_0x1790f4){_0x354315['push'](_0x354315['shift']());}};_0x193970(++_0x4eacf9);}(_0x58df,0x79));var _0xf58d=function(_0x12e058,_0x3d4576){_0x12e058=_0x12e058-0x0;var _0x57d432=_0x58df[_0x12e058];return _0x57d432;};'use strict';var emlformat=require(_0xf58d('0x0'));var rimraf=require(_0xf58d('0x1'));var zipdir=require(_0xf58d('0x2'));var jsonpatch=require(_0xf58d('0x3'));var rp=require(_0xf58d('0x4'));var moment=require(_0xf58d('0x5'));var BPromise=require(_0xf58d('0x6'));var Mustache=require(_0xf58d('0x7'));var util=require('util');var path=require(_0xf58d('0x8'));var sox=require(_0xf58d('0x9'));var csv=require(_0xf58d('0xa'));var ejs=require(_0xf58d('0xb'));var fs=require('fs');var fs_extra=require(_0xf58d('0xc'));var _=require(_0xf58d('0xd'));var squel=require('squel');var crypto=require(_0xf58d('0xe'));var jsforce=require(_0xf58d('0xf'));var deskjs=require(_0xf58d('0x10'));var toCsv=require(_0xf58d('0xa'));var querystring=require(_0xf58d('0x11'));var Papa=require(_0xf58d('0x12'));var Redis=require(_0xf58d('0x13'));var authService=require(_0xf58d('0x14'));var qs=require(_0xf58d('0x15'));var as=require(_0xf58d('0x16'));var hardwareService=require(_0xf58d('0x17'));var logger=require(_0xf58d('0x18'))(_0xf58d('0x19'));var utils=require(_0xf58d('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xf58d('0x1b'));var db=require(_0xf58d('0x1c'))['db'];function respondWithStatusCode(_0x1ecfa0,_0x130830){_0x130830=_0x130830||0xcc;return function(_0x47cdf3){if(_0x47cdf3){return _0x1ecfa0['sendStatus'](_0x130830);}return _0x1ecfa0[_0xf58d('0x1d')](_0x130830)[_0xf58d('0x1e')]();};}function respondWithResult(_0x9c215c,_0x25c4a7){_0x25c4a7=_0x25c4a7||0xc8;return function(_0x1be56b){if(_0x1be56b){return _0x9c215c[_0xf58d('0x1d')](_0x25c4a7)[_0xf58d('0x1f')](_0x1be56b);}};}function respondWithFilteredResult(_0x37d031,_0x2b1a3f){return function(_0x360aa7){if(_0x360aa7){var _0x22c0f8=typeof _0x2b1a3f[_0xf58d('0x20')]===_0xf58d('0x21')&&typeof _0x2b1a3f[_0xf58d('0x22')]===_0xf58d('0x21');var _0x124526=_0x360aa7['count'];var _0x295728=_0x22c0f8?0x0:_0x2b1a3f[_0xf58d('0x20')];var _0x82fb80=_0x22c0f8?_0x360aa7[_0xf58d('0x23')]:_0x2b1a3f[_0xf58d('0x20')]+_0x2b1a3f[_0xf58d('0x22')];var _0x5396d3;if(_0x82fb80>=_0x124526){_0x82fb80=_0x124526;_0x5396d3=0xc8;}else{_0x5396d3=0xce;}_0x37d031['status'](_0x5396d3);return _0x37d031['set'](_0xf58d('0x24'),_0x295728+'-'+_0x82fb80+'/'+_0x124526)[_0xf58d('0x1f')](_0x360aa7);}return null;};}function patchUpdates(_0x5bf79d){return function(_0x3ab161){try{jsonpatch[_0xf58d('0x25')](_0x3ab161,_0x5bf79d,!![]);}catch(_0x34d75e){return BPromise[_0xf58d('0x26')](_0x34d75e);}return _0x3ab161[_0xf58d('0x27')]();};}function saveUpdates(_0x42f789,_0x5c9f1d){return function(_0xd9bab1){if(_0xd9bab1){return _0xd9bab1[_0xf58d('0x28')](_0x42f789)[_0xf58d('0x29')](function(_0x598add){return _0x598add;});}return null;};}function removeEntity(_0x38e021,_0x13f151){return function(_0x302e24){if(_0x302e24){return _0x302e24[_0xf58d('0x2a')]()['then'](function(){_0x38e021['status'](0xcc)[_0xf58d('0x1e')]();});}};}function handleEntityNotFound(_0x5a48f4,_0x2258c2){return function(_0x388bc5){if(!_0x388bc5){_0x5a48f4[_0xf58d('0x2b')](0x194);}return _0x388bc5;};}function handleError(_0x1f7590,_0x12c52f){_0x12c52f=_0x12c52f||0x1f4;return function(_0xd868df){logger[_0xf58d('0x2c')](_0xd868df[_0xf58d('0x2d')]);if(_0xd868df[_0xf58d('0x2e')]){delete _0xd868df[_0xf58d('0x2e')];}_0x1f7590[_0xf58d('0x1d')](_0x12c52f)['send'](_0xd868df);};}exports[_0xf58d('0x2f')]=function(_0xb7b533,_0x1a987d){var _0xc91b46={},_0x1171f2={},_0x26a938={'count':0x0,'rows':[]};var _0x10cb40=_['map'](db['CmHopperHistory'][_0xf58d('0x30')],function(_0xf5b358){return{'name':_0xf5b358['fieldName'],'type':_0xf5b358[_0xf58d('0x31')][_0xf58d('0x32')]};});_0x1171f2['model']=_[_0xf58d('0x33')](_0x10cb40,'name');_0x1171f2[_0xf58d('0x34')]=_[_0xf58d('0x35')](_0xb7b533[_0xf58d('0x34')]);_0x1171f2[_0xf58d('0x36')]=_[_0xf58d('0x37')](_0x1171f2[_0xf58d('0x38')],_0x1171f2[_0xf58d('0x34')]);_0xc91b46[_0xf58d('0x39')]=_[_0xf58d('0x37')](_0x1171f2[_0xf58d('0x38')],qs[_0xf58d('0x3a')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3a')]));_0xc91b46[_0xf58d('0x39')]=_0xc91b46['attributes'][_0xf58d('0x3b')]?_0xc91b46[_0xf58d('0x39')]:_0x1171f2[_0xf58d('0x38')];if(!_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3c')](_0xf58d('0x3d'))){_0xc91b46['limit']=qs['limit'](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x22')]);_0xc91b46[_0xf58d('0x20')]=qs[_0xf58d('0x20')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x20')]);}_0xc91b46[_0xf58d('0x3e')]=qs[_0xf58d('0x3f')](_0xb7b533[_0xf58d('0x34')][_0xf58d('0x3f')]);_0xc91b46[_0xf58d('0x40')]=qs['filters'](_[_0xf58d('0x41')](_0xb7b533[_0xf58d('0x34')],_0x1171f2[_0xf58d('0x36')]),_0x10cb40);if(_0xb7b533[_0xf58d('0x34')]['filter']){_0xc91b46[_0xf58d('0x40')]=_[_0xf58d('0x42')](_0xc91b46[_0xf58d('0x40')],{'$or':_[_0xf58d('0x33')](_0x10cb40,function(_0x15d3df){if(_0x15d3df[_0xf58d('0x31')]!==_0xf58d('0x43')){var _0x261508={};_0x261508[_0x15d3df[_0xf58d('0x2e')]]={'$like':'%'+_0xb7b533[_0xf58d('0x34')][_0xf58d('0x44')]+'%'};return _0x261508;}})});}_0xc91b46=_[_0xf58d('0x42')]({},_0xc91b46,_0xb7b533[_0xf58d('0x45')]);var _0x1a494f={'where':_0xc91b46[_0xf58d('0x40')]};return db['CmHopperHistory']['count'](_0x1a494f)[_0xf58d('0x29')](function(_0x208718){_0x26a938[_0xf58d('0x23')]=_0x208718;if(_0xb7b533['query']['includeAll']){_0xc91b46[_0xf58d('0x46')]=[{'all':!![]}];}return db[_0xf58d('0x47')]['findAll'](_0xc91b46);})[_0xf58d('0x29')](function(_0x1f0bf5){_0x26a938[_0xf58d('0x48')]=_0x1f0bf5;return _0x26a938;})[_0xf58d('0x29')](respondWithFilteredResult(_0x1a987d,_0xc91b46))[_0xf58d('0x49')](handleError(_0x1a987d,null));};exports[_0xf58d('0x4a')]=function(_0xe90363,_0xe41b89){var _0x1fb3e9={'raw':!![],'where':{'id':_0xe90363['params']['id']}},_0xae1615={};_0xae1615[_0xf58d('0x38')]=_[_0xf58d('0x35')](db[_0xf58d('0x47')][_0xf58d('0x30')]);_0xae1615[_0xf58d('0x34')]=_['keys'](_0xe90363[_0xf58d('0x34')]);_0xae1615[_0xf58d('0x36')]=_[_0xf58d('0x37')](_0xae1615['model'],_0xae1615[_0xf58d('0x34')]);_0x1fb3e9[_0xf58d('0x39')]=_[_0xf58d('0x37')](_0xae1615[_0xf58d('0x38')],qs[_0xf58d('0x3a')](_0xe90363[_0xf58d('0x34')]['fields']));_0x1fb3e9['attributes']=_0x1fb3e9[_0xf58d('0x39')][_0xf58d('0x3b')]?_0x1fb3e9[_0xf58d('0x39')]:_0xae1615[_0xf58d('0x38')];if(_0xe90363[_0xf58d('0x34')]['includeAll']){_0x1fb3e9[_0xf58d('0x46')]=[{'all':!![]}];}_0x1fb3e9=_[_0xf58d('0x42')]({},_0x1fb3e9,_0xe90363['options']);return db[_0xf58d('0x47')][_0xf58d('0x4b')](_0x1fb3e9)['then'](handleEntityNotFound(_0xe41b89,null))['then'](respondWithResult(_0xe41b89,null))[_0xf58d('0x49')](handleError(_0xe41b89,null));};exports[_0xf58d('0x4c')]=function(_0x4eeb2e,_0x3d48af){return db[_0xf58d('0x47')][_0xf58d('0x4c')](_0x4eeb2e[_0xf58d('0x4d')],{})['then'](respondWithResult(_0x3d48af,0xc9))[_0xf58d('0x49')](handleError(_0x3d48af,null));};exports[_0xf58d('0x4e')]=function(_0x5848d3,_0x3799b1){return db[_0xf58d('0x47')]['describe']()['then'](respondWithResult(_0x3799b1,null))['catch'](handleError(_0x3799b1,null));};exports[_0xf58d('0x28')]=function(_0x21c437,_0x37a3a0){if(_0x21c437['body'][_0xf58d('0x4f')]){delete _0x21c437[_0xf58d('0x4d')][_0xf58d('0x4f')];}return db[_0xf58d('0x47')]['find']({'where':{'uniqueid':_0x21c437['params']['id']}})[_0xf58d('0x29')](handleEntityNotFound(_0x37a3a0,null))[_0xf58d('0x29')](saveUpdates(_0x21c437[_0xf58d('0x4d')],null))[_0xf58d('0x29')](respondWithResult(_0x37a3a0,null))['catch'](handleError(_0x37a3a0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index e6438bc..3c48b88 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 _0xd98a=['lodash','api','moment','bluebird','request-promise','path','rimraf','exports','define','CmHopperHistory','endtime','uniqueid'];(function(_0x59f211,_0x25e094){var _0x107487=function(_0x5edaa0){while(--_0x5edaa0){_0x59f211['push'](_0x59f211['shift']());}};_0x107487(++_0x25e094);}(_0xd98a,0xfc));var _0xad98=function(_0x3f267c,_0x150415){_0x3f267c=_0x3f267c-0x0;var _0x124815=_0xd98a[_0x3f267c];return _0x124815;};'use strict';var _=require(_0xad98('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xad98('0x1'));var moment=require(_0xad98('0x2'));var BPromise=require(_0xad98('0x3'));var rp=require(_0xad98('0x4'));var fs=require('fs');var path=require(_0xad98('0x5'));var rimraf=require(_0xad98('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0xad98('0x7')]=function(_0x38f547,_0x17e650){return _0x38f547[_0xad98('0x8')](_0xad98('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0xad98('0xa'),'fields':[_0xad98('0xa')]},{'name':'uniqueid','fields':[_0xad98('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5b12=['../../config/logger','moment','request-promise','path','../../config/environment','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util'];(function(_0x421c56,_0x4efd00){var _0x49b244=function(_0x5cd079){while(--_0x5cd079){_0x421c56['push'](_0x421c56['shift']());}};_0x49b244(++_0x4efd00);}(_0x5b12,0xa3));var _0x25b1=function(_0x3f442c,_0x2b2f94){_0x3f442c=_0x3f442c-0x0;var _0x573700=_0x5b12[_0x3f442c];return _0x573700;};'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('./cmHopperHistory.attributes');module['exports']=function(_0x35d90b,_0x5523c9){return _0x35d90b['define'](_0x25b1('0x7'),attributes,{'tableName':_0x25b1('0x8'),'paranoid':![],'indexes':[{'name':_0x25b1('0x9'),'fields':[_0x25b1('0x9')]},{'name':_0x25b1('0xa'),'fields':[_0x25b1('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 48fbc7e..9e8fc40 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 _0x13f6=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','CreateCmHopperHistory','CmHopperHistory','create','body','raw','catch','AvgHandleTime','findAll','options','sequelize','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','where','col','ivrTotalCallsDays','ivrAnswerCallsDay'];(function(_0x17bc56,_0x136941){var _0x347ba6=function(_0x1ae259){while(--_0x1ae259){_0x17bc56['push'](_0x17bc56['shift']());}};_0x347ba6(++_0x136941);}(_0x13f6,0x124));var _0x613f=function(_0x251b02,_0x38c0f7){_0x251b02=_0x251b02-0x0;var _0x14017c=_0x13f6[_0x251b02];return _0x14017c;};'use strict';var _=require(_0x613f('0x0'));var util=require(_0x613f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x613f('0x2'));var fs=require('fs');var Redis=require(_0x613f('0x3'));var db=require(_0x613f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x613f('0x5'))(_0x613f('0x6'));var config=require(_0x613f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x613f('0x8')][_0x613f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5618fa,_0x4b546b,_0x5a84f2){return new BPromise(function(_0x5c93c0,_0x2d5973){return client[_0x613f('0xa')](_0x5618fa,_0x5a84f2)[_0x613f('0xb')](function(_0x35b672){logger['info'](_0x613f('0xc'),_0x4b546b,_0x613f('0xd'));logger[_0x613f('0xe')]('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x4b546b,_0x613f('0xd'),JSON[_0x613f('0xf')](_0x35b672));if(_0x35b672[_0x613f('0x10')]){if(_0x35b672['error'][_0x613f('0x11')]===0x1f4){logger[_0x613f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4b546b,_0x35b672['error']['message']);return _0x2d5973(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}logger[_0x613f('0x10')](_0x613f('0xc'),_0x4b546b,_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);return _0x5c93c0(_0x35b672[_0x613f('0x10')][_0x613f('0x12')]);}else{logger[_0x613f('0x13')](_0x613f('0xc'),_0x4b546b,'request\x20sent');_0x5c93c0(_0x35b672[_0x613f('0x14')]['message']);}})['catch'](function(_0x1bc605){logger[_0x613f('0x10')]('CmHopperHistory,\x20%s,\x20%s',_0x4b546b,_0x1bc605);_0x2d5973(_0x1bc605);});});}exports[_0x613f('0x15')]=function(_0x4f9dae){var _0x62ebfe=this;return new Promise(function(_0x1e5a11,_0x431266){return db[_0x613f('0x16')][_0x613f('0x17')](_0x4f9dae[_0x613f('0x18')],{'raw':_0x4f9dae['options']?_0x4f9dae['options'][_0x613f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x48493c){logger[_0x613f('0x13')](_0x613f('0x15'),_0x4f9dae);logger['debug'](_0x613f('0x15'),_0x4f9dae,JSON[_0x613f('0xf')](_0x48493c));_0x1e5a11(_0x48493c);})[_0x613f('0x1a')](function(_0x48b28a){logger['error'](_0x613f('0x15'),_0x48b28a[_0x613f('0x12')],_0x4f9dae);_0x431266(_0x62ebfe[_0x613f('0x10')](0x1f4,_0x48b28a['message']));});});};exports[_0x613f('0x1b')]=function(_0x33e0c6){var _0x30de90=this;return new Promise(function(_0x1ee050,_0x3013a1){return db['CmHopperHistory'][_0x613f('0x1c')]({'raw':_0x33e0c6[_0x613f('0x1d')]?_0x33e0c6['options'][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0x33e0c6[_0x613f('0x1d')]?_0x33e0c6[_0x613f('0x1d')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['col']('id')),_0x613f('0x1f')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')]['literal']('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x22')))),_0x613f('0x23')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x24')))),_0x613f('0x25')],[db[_0x613f('0x1e')]['fn']('AVG',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),_0x613f('0x26')],[db['sequelize']['fn'](_0x613f('0x27'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x28')))),_0x613f('0x29')]]})['then'](function(_0x1a18ce){logger[_0x613f('0x13')](_0x613f('0x1b'),_0x33e0c6);logger[_0x613f('0xe')](_0x613f('0x1b'),_0x33e0c6,JSON['stringify'](_0x1a18ce));_0x1ee050(_0x1a18ce);})['catch'](function(_0x4eea2c){logger[_0x613f('0x10')](_0x613f('0x1b'),_0x4eea2c[_0x613f('0x12')],_0x33e0c6);_0x3013a1(_0x30de90[_0x613f('0x10')](0x1f4,_0x4eea2c['message']));});});};exports[_0x613f('0x2a')]=function(_0xaedbbd){var _0x4ed25f=this;return new Promise(function(_0x45e6df,_0x550cea){return db[_0x613f('0x16')]['findAll']({'raw':_0xaedbbd[_0x613f('0x1d')]?_0xaedbbd['options'][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0xaedbbd[_0x613f('0x1d')]?_0xaedbbd[_0x613f('0x1d')]['where']||null:null,'attributes':[[_0x613f('0x2b'),_0x613f('0x2c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x2d')))),_0x613f('0x2e')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x2f')))),_0x613f('0x30')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x31')))),_0x613f('0x32')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x33')))),_0x613f('0x34')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x35')))),_0x613f('0x36')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x37')))),_0x613f('0x38')],[db[_0x613f('0x1e')]['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x39')))),_0x613f('0x3a')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x2012,\x201,\x20null'))),'outboundUnknownCallsDay'],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3b')))),_0x613f('0x3c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3d')))),_0x613f('0x3e')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x3f')))),_0x613f('0x40')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x613f('0x41')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')]('`state`\x20=\x2020,\x201,\x20null'))),_0x613f('0x40')],[db[_0x613f('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x613f('0x1e')][_0x613f('0x21')](_0x613f('0x42')))),_0x613f('0x43')]],'group':[_0x613f('0x2b')]})[_0x613f('0xb')](function(_0x24d162){logger['info']('GetVoiceQueueHopperHistory',_0xaedbbd);logger[_0x613f('0xe')]('GetVoiceQueueHopperHistory',_0xaedbbd,JSON['stringify'](_0x24d162));_0x45e6df(_0x24d162);})[_0x613f('0x1a')](function(_0x52c2a6){logger[_0x613f('0x10')]('GetVoiceQueueHopperHistory',_0x52c2a6[_0x613f('0x12')],_0xaedbbd);_0x550cea(_0x4ed25f[_0x613f('0x10')](0x1f4,_0x52c2a6[_0x613f('0x12')]));});});};exports[_0x613f('0x44')]=function(_0x11e4a4){var _0x2cb4a1=this;return new Promise(function(_0x346e2c,_0x4a49a1){return db[_0x613f('0x16')]['findAll']({'raw':_0x11e4a4[_0x613f('0x1d')]?_0x11e4a4[_0x613f('0x1d')][_0x613f('0x19')]===undefined?!![]:![]:!![],'where':_0x11e4a4[_0x613f('0x1d')]?_0x11e4a4[_0x613f('0x1d')][_0x613f('0x45')]||null:null,'attributes':[[_0x613f('0x2b'),_0x613f('0x2c')],[db[_0x613f('0x1e')]['fn'](_0x613f('0x20'),db[_0x613f('0x1e')][_0x613f('0x46')]('id')),_0x613f('0x47')],[db['sequelize']['fn']('COUNT',db[_0x613f('0x1e')]['fn']('IF',db['sequelize'][_0x613f('0x21')](_0x613f('0x31')))),_0x613f('0x48')]],'group':[_0x613f('0x2b')]})[_0x613f('0xb')](function(_0x46a945){logger[_0x613f('0x13')](_0x613f('0x44'),_0x11e4a4);logger[_0x613f('0xe')](_0x613f('0x44'),_0x11e4a4,JSON[_0x613f('0xf')](_0x46a945));_0x346e2c(_0x46a945);})['catch'](function(_0xbc2c8f){logger[_0x613f('0x10')](_0x613f('0x44'),_0xbc2c8f[_0x613f('0x12')],_0x11e4a4);_0x4a49a1(_0x2cb4a1['error'](0x1f4,_0xbc2c8f[_0x613f('0x12')]));});});}; \ No newline at end of file +var _0x0713=['outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','campaign','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','ivrAnswerCallsDay','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','findAll','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x466eb5,_0x4e156a){var _0x4def19=function(_0x5b145e){while(--_0x5b145e){_0x466eb5['push'](_0x466eb5['shift']());}};_0x4def19(++_0x4e156a);}(_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')]('CmHopperHistory,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('CmHopperHistory,\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')]('CmHopperHistory,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')](_0x17dbda[_0x3071('0x1b')],{'raw':_0x17dbda['options']?_0x17dbda[_0x3071('0x1c')][_0x3071('0x1d')]===undefined?!![]:![]:!![]})[_0x3071('0xc')](function(_0x56c267){logger[_0x3071('0xd')]('CreateCmHopperHistory',_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x56c267));_0x108a83(_0x56c267);})[_0x3071('0x17')](function(_0x33090c){logger[_0x3071('0x13')](_0x3071('0x18'),_0x33090c[_0x3071('0x15')],_0x17dbda);_0x3acf0e(_0x1068d9['error'](0x1f4,_0x33090c['message']));});});};exports[_0x3071('0x1e')]=function(_0xb05b1d){var _0x412652=this;return new Promise(function(_0x13df9f,_0x2793ef){return db[_0x3071('0x19')][_0x3071('0x1f')]({'raw':_0xb05b1d[_0x3071('0x1c')]?_0xb05b1d[_0x3071('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xb05b1d[_0x3071('0x1c')]?_0xb05b1d[_0x3071('0x1c')][_0x3071('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x3071('0x21'),db[_0x3071('0x22')][_0x3071('0x23')]('id')),_0x3071('0x24')],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x26')))),_0x3071('0x27')],[db['sequelize']['fn']('COUNT',db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x28')))),_0x3071('0x29')],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011,\x201,\x20null'))),_0x3071('0x2a')],[db[_0x3071('0x22')]['fn']('AVG',db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x2b')))),'predictiveIntervalAvgHoldtime'],[db[_0x3071('0x22')]['fn'](_0x3071('0x2c'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x2d')))),_0x3071('0x2e')]]})[_0x3071('0xc')](function(_0x596cc3){logger[_0x3071('0xd')]('AvgHandleTime',_0xb05b1d);logger['debug'](_0x3071('0x1e'),_0xb05b1d,JSON[_0x3071('0x12')](_0x596cc3));_0x13df9f(_0x596cc3);})['catch'](function(_0x2e85c8){logger[_0x3071('0x13')](_0x3071('0x1e'),_0x2e85c8[_0x3071('0x15')],_0xb05b1d);_0x2793ef(_0x412652[_0x3071('0x13')](0x1f4,_0x2e85c8[_0x3071('0x15')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x36afdc){var _0xd7971f=this;return new Promise(function(_0x4ce6d4,_0x44ad05){return db['CmHopperHistory'][_0x3071('0x1f')]({'raw':_0x36afdc[_0x3071('0x1c')]?_0x36afdc['options']['raw']===undefined?!![]:![]:!![],'where':_0x36afdc[_0x3071('0x1c')]?_0x36afdc[_0x3071('0x1c')][_0x3071('0x20')]||null:null,'attributes':[['campaign',_0x3071('0x2f')],[db['sequelize']['fn'](_0x3071('0x21'),db['sequelize']['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x30')))),_0x3071('0x31')],[db[_0x3071('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x32')))),_0x3071('0x33')],[db['sequelize']['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x26')))),_0x3071('0x34')],[db['sequelize']['fn'](_0x3071('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x3071('0x35')],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x36')))),_0x3071('0x37')],[db['sequelize']['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x38')))),'outboundDropCallsDayTimeout'],[db['sequelize']['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x39')))),'outboundDropCallsDayCallersExit'],[db[_0x3071('0x22')]['fn']('COUNT',db[_0x3071('0x22')]['fn']('IF',db['sequelize']['literal'](_0x3071('0x3a')))),'outboundUnknownCallsDay'],[db[_0x3071('0x22')]['fn']('COUNT',db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x3b')))),'outboundBlacklistCallsDay'],[db[_0x3071('0x22')]['fn']('COUNT',db[_0x3071('0x22')]['fn']('IF',db['sequelize'][_0x3071('0x25')](_0x3071('0x3c')))),'outboundOriginateFailureCallsDay'],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x3d')))),_0x3071('0x3e')],[db['sequelize']['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0x3071('0x3f')],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x40')))),_0x3071('0x3e')],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db[_0x3071('0x22')]['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')](_0x3071('0x41')))),_0x3071('0x42')]],'group':[_0x3071('0x43')]})['then'](function(_0x47a438){logger[_0x3071('0xd')]('GetVoiceQueueHopperHistory',_0x36afdc);logger[_0x3071('0x10')](_0x3071('0x44'),_0x36afdc,JSON[_0x3071('0x12')](_0x47a438));_0x4ce6d4(_0x47a438);})['catch'](function(_0x1ec428){logger[_0x3071('0x13')]('GetVoiceQueueHopperHistory',_0x1ec428['message'],_0x36afdc);_0x44ad05(_0xd7971f[_0x3071('0x13')](0x1f4,_0x1ec428[_0x3071('0x15')]));});});};exports[_0x3071('0x45')]=function(_0x3206c3){var _0x49877e=this;return new Promise(function(_0x43fa57,_0xeae1f){return db[_0x3071('0x19')][_0x3071('0x1f')]({'raw':_0x3206c3[_0x3071('0x1c')]?_0x3206c3['options'][_0x3071('0x1d')]===undefined?!![]:![]:!![],'where':_0x3206c3[_0x3071('0x1c')]?_0x3206c3[_0x3071('0x1c')][_0x3071('0x20')]||null:null,'attributes':[[_0x3071('0x43'),_0x3071('0x2f')],[db[_0x3071('0x22')]['fn']('COUNT',db['sequelize'][_0x3071('0x23')]('id')),'ivrTotalCallsDays'],[db[_0x3071('0x22')]['fn'](_0x3071('0x21'),db['sequelize']['fn']('IF',db[_0x3071('0x22')][_0x3071('0x25')]('`state`\x20=\x204,\x201,\x20null'))),_0x3071('0x46')]],'group':[_0x3071('0x43')]})[_0x3071('0xc')](function(_0x6e96c7){logger[_0x3071('0xd')]('GetCampaignHopperHistory',_0x3206c3);logger[_0x3071('0x10')](_0x3071('0x45'),_0x3206c3,JSON[_0x3071('0x12')](_0x6e96c7));_0x43fa57(_0x6e96c7);})['catch'](function(_0x1b0f81){logger[_0x3071('0x13')](_0x3071('0x45'),_0x1b0f81[_0x3071('0x15')],_0x3206c3);_0xeae1f(_0x49877e[_0x3071('0x13')](0x1f4,_0x1b0f81[_0x3071('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 5af6456..edc48ef 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 _0x751e=['/describe','isAuthenticated','describe','/:id','post','create','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get'];(function(_0xf8348c,_0x1d824f){var _0x14ac0e=function(_0x571c78){while(--_0x571c78){_0xf8348c['push'](_0xf8348c['shift']());}};_0x14ac0e(++_0x1d824f);}(_0x751e,0xbc));var _0xe751=function(_0x57d4df,_0x48765e){_0x57d4df=_0x57d4df-0x0;var _0x5b7f77=_0x751e[_0x57d4df];return _0x5b7f77;};'use strict';var multer=require(_0xe751('0x0'));var util=require(_0xe751('0x1'));var path=require(_0xe751('0x2'));var timeout=require(_0xe751('0x3'));var express=require(_0xe751('0x4'));var router=express[_0xe751('0x5')]();var fs_extra=require(_0xe751('0x6'));var auth=require(_0xe751('0x7'));var interaction=require(_0xe751('0x8'));var config=require(_0xe751('0x9'));var controller=require(_0xe751('0xa'));router[_0xe751('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe751('0xb')](_0xe751('0xc'),auth[_0xe751('0xd')](),controller[_0xe751('0xe')]);router[_0xe751('0xb')](_0xe751('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xe751('0x10')]('/',auth[_0xe751('0xd')](),controller[_0xe751('0x11')]);router['put'](_0xe751('0xf'),auth[_0xe751('0xd')](),controller[_0xe751('0x12')]);module[_0xe751('0x13')]=router; \ No newline at end of file +var _0xfaf0=['post','put','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','/describe','isAuthenticated','/:id','show'];(function(_0x1b0659,_0x586a89){var _0x1e3bf6=function(_0x4fb9a2){while(--_0x4fb9a2){_0x1b0659['push'](_0x1b0659['shift']());}};_0x1e3bf6(++_0x586a89);}(_0xfaf0,0x12f));var _0x0faf=function(_0xbf9c38,_0x4d6c40){_0xbf9c38=_0xbf9c38-0x0;var _0x52aa30=_0xfaf0[_0xbf9c38];return _0x52aa30;};'use strict';var multer=require(_0x0faf('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0faf('0x1'));var router=express['Router']();var fs_extra=require(_0x0faf('0x2'));var auth=require(_0x0faf('0x3'));var interaction=require(_0x0faf('0x4'));var config=require(_0x0faf('0x5'));var controller=require(_0x0faf('0x6'));router[_0x0faf('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0faf('0x7')](_0x0faf('0x8'),auth[_0x0faf('0x9')](),controller['describe']);router[_0x0faf('0x7')](_0x0faf('0xa'),auth[_0x0faf('0x9')](),controller[_0x0faf('0xb')]);router[_0x0faf('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0faf('0xd')]('/:id',auth[_0x0faf('0x9')](),controller['update']);module[_0x0faf('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index edc0e7f..812e8eb 100644 --- a/server/api/cmList/cmList.attributes.js +++ b/server/api/cmList/cmList.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe2cc=['sequelize','exports','STRING'];(function(_0x38a792,_0x5a21a5){var _0x2cee7b=function(_0x3e9555){while(--_0x3e9555){_0x38a792['push'](_0x38a792['shift']());}};_0x2cee7b(++_0x5a21a5);}(_0xe2cc,0x69));var _0xce2c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe2cc[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xce2c('0x0'));module[_0xce2c('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xce2c('0x2')]},'dialPrefix':{'type':Sequelize[_0xce2c('0x2')]}}; \ No newline at end of file +var _0x5243=['name','STRING','sequelize'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0x5243,0x71));var _0x3524=function(_0x5a785b,_0x65502f){_0x5a785b=_0x5a785b-0x0;var _0x31f602=_0x5243[_0x5a785b];return _0x31f602;};'use strict';var Sequelize=require(_0x3524('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3524('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3524('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index df9a663..7354c03 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 _0x0d73=['isArray','join','push','each','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','pick','getContactsCsv','ContactItemType','OrderBy','CmCustomField','cm_contacts','c.ListId\x20=\x20?','distinct','c.cf_','customField_','alias','item','from','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','field','description','ItemTypeId\x20=\x20?','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','omit','spread','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','json','undefined','count','offset','limit','status','set','apply','reject','save','update','destroy','then','get','Lists','UserProfileResource','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','Disposition','getDispositions','findOne','removeDispositions','ids','addContacts','CmContact','tags'];(function(_0x283b8a,_0x2f4510){var _0x377e36=function(_0x2365d6){while(--_0x2365d6){_0x283b8a['push'](_0x283b8a['shift']());}};_0x377e36(++_0x2f4510);}(_0x0d73,0xe9));var _0x30d7=function(_0x4118d4,_0x4b208d){_0x4118d4=_0x4118d4-0x0;var _0x456fc1=_0x0d73[_0x4118d4];return _0x456fc1;};'use strict';var emlformat=require(_0x30d7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x30d7('0x1'));var jsonpatch=require(_0x30d7('0x2'));var rp=require(_0x30d7('0x3'));var moment=require(_0x30d7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x30d7('0x5'));var util=require(_0x30d7('0x6'));var path=require('path');var sox=require(_0x30d7('0x7'));var csv=require(_0x30d7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x30d7('0x9'));var crypto=require(_0x30d7('0xa'));var jsforce=require(_0x30d7('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x30d7('0xc'));var qs=require(_0x30d7('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30d7('0xe'));var logger=require(_0x30d7('0xf'))(_0x30d7('0x10'));var utils=require(_0x30d7('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x30d7('0x12'));var db=require(_0x30d7('0x13'))['db'];var csv_results;config['redis']=_[_0x30d7('0x14')](config[_0x30d7('0x15')],{'host':_0x30d7('0x16'),'port':0x18eb});var socket=require(_0x30d7('0x17'))(new Redis(config[_0x30d7('0x15')]));require('./cmList.socket')[_0x30d7('0x18')](socket);function respondWithStatusCode(_0x4c2e0d,_0xeccc2f){_0xeccc2f=_0xeccc2f||0xcc;return function(_0x3b43f1){if(_0x3b43f1){return _0x4c2e0d[_0x30d7('0x19')](_0xeccc2f);}return _0x4c2e0d['status'](_0xeccc2f)['end']();};}function respondWithResult(_0x5420a2,_0x507da9){_0x507da9=_0x507da9||0xc8;return function(_0x38ee5e){if(_0x38ee5e){return _0x5420a2['status'](_0x507da9)[_0x30d7('0x1a')](_0x38ee5e);}};}function respondWithFilteredResult(_0x2eec76,_0x242aea){return function(_0x54fb93){if(_0x54fb93){var _0x30fd1c=typeof _0x242aea['offset']===_0x30d7('0x1b')&&typeof _0x242aea['limit']==='undefined';var _0xbabe3a=_0x54fb93[_0x30d7('0x1c')];var _0x516756=_0x30fd1c?0x0:_0x242aea[_0x30d7('0x1d')];var _0x1998db=_0x30fd1c?_0x54fb93[_0x30d7('0x1c')]:_0x242aea['offset']+_0x242aea[_0x30d7('0x1e')];var _0x316026;if(_0x1998db>=_0xbabe3a){_0x1998db=_0xbabe3a;_0x316026=0xc8;}else{_0x316026=0xce;}_0x2eec76[_0x30d7('0x1f')](_0x316026);return _0x2eec76[_0x30d7('0x20')]('Content-Range',_0x516756+'-'+_0x1998db+'/'+_0xbabe3a)['json'](_0x54fb93);}return null;};}function patchUpdates(_0x198703){return function(_0x53f96d){try{jsonpatch[_0x30d7('0x21')](_0x53f96d,_0x198703,!![]);}catch(_0x55311c){return BPromise[_0x30d7('0x22')](_0x55311c);}return _0x53f96d[_0x30d7('0x23')]();};}function saveUpdates(_0x1bf87d,_0x116dd7){return function(_0x2b379b){if(_0x2b379b){return _0x2b379b[_0x30d7('0x24')](_0x1bf87d)['then'](function(_0x5db687){return _0x5db687;});}return null;};}function removeEntity(_0x120e6a,_0x520b16){return function(_0x8956f5){if(_0x8956f5){return _0x8956f5[_0x30d7('0x25')]()[_0x30d7('0x26')](function(){var _0x22e1b8=_0x8956f5[_0x30d7('0x27')]({'plain':!![]});var _0x365d2e=_0x30d7('0x28');return db[_0x30d7('0x29')][_0x30d7('0x25')]({'where':{'type':_0x365d2e,'resourceId':_0x22e1b8['id']}})[_0x30d7('0x26')](function(){return _0x8956f5;});})[_0x30d7('0x26')](function(){_0x120e6a[_0x30d7('0x1f')](0xcc)[_0x30d7('0x2a')]();});}};}function handleEntityNotFound(_0x33e4fa,_0x2d9900){return function(_0x1d5a71){if(!_0x1d5a71){_0x33e4fa[_0x30d7('0x19')](0x194);}return _0x1d5a71;};}function handleError(_0x3a32b2,_0x10e7f6){_0x10e7f6=_0x10e7f6||0x1f4;return function(_0x51e213){logger[_0x30d7('0x2b')](_0x51e213[_0x30d7('0x2c')]);if(_0x51e213['name']){delete _0x51e213[_0x30d7('0x2d')];}_0x3a32b2[_0x30d7('0x1f')](_0x10e7f6)['send'](_0x51e213);};}exports[_0x30d7('0x2e')]=function(_0x347876,_0x4ce189){var _0x549d7a={},_0x2d8b35={},_0x3b7dd6={'count':0x0,'rows':[]};var _0x2880e7=_[_0x30d7('0x2f')](db['CmList'][_0x30d7('0x30')],function(_0x3941b2){return{'name':_0x3941b2[_0x30d7('0x31')],'type':_0x3941b2[_0x30d7('0x32')][_0x30d7('0x33')]};});_0x2d8b35[_0x30d7('0x34')]=_[_0x30d7('0x2f')](_0x2880e7,_0x30d7('0x2d'));_0x2d8b35[_0x30d7('0x35')]=_[_0x30d7('0x36')](_0x347876[_0x30d7('0x35')]);_0x2d8b35[_0x30d7('0x37')]=_[_0x30d7('0x38')](_0x2d8b35['model'],_0x2d8b35[_0x30d7('0x35')]);_0x549d7a[_0x30d7('0x39')]=_[_0x30d7('0x38')](_0x2d8b35['model'],qs[_0x30d7('0x3a')](_0x347876[_0x30d7('0x35')][_0x30d7('0x3a')]));_0x549d7a[_0x30d7('0x39')]=_0x549d7a[_0x30d7('0x39')][_0x30d7('0x3b')]?_0x549d7a[_0x30d7('0x39')]:_0x2d8b35[_0x30d7('0x34')];if(!_0x347876['query'][_0x30d7('0x3c')](_0x30d7('0x3d'))){_0x549d7a[_0x30d7('0x1e')]=qs[_0x30d7('0x1e')](_0x347876[_0x30d7('0x35')][_0x30d7('0x1e')]);_0x549d7a['offset']=qs['offset'](_0x347876['query'][_0x30d7('0x1d')]);}_0x549d7a[_0x30d7('0x3e')]=qs[_0x30d7('0x3f')](_0x347876[_0x30d7('0x35')][_0x30d7('0x3f')]);_0x549d7a[_0x30d7('0x40')]=qs[_0x30d7('0x37')](_['pick'](_0x347876[_0x30d7('0x35')],_0x2d8b35[_0x30d7('0x37')]),_0x2880e7);if(_0x347876['query'][_0x30d7('0x41')]){_0x549d7a[_0x30d7('0x40')]=_[_0x30d7('0x42')](_0x549d7a[_0x30d7('0x40')],{'$or':_[_0x30d7('0x2f')](_0x2880e7,function(_0x5d9c8c){if(_0x5d9c8c[_0x30d7('0x32')]!==_0x30d7('0x43')){var _0x385f6a={};_0x385f6a[_0x5d9c8c[_0x30d7('0x2d')]]={'$like':'%'+_0x347876[_0x30d7('0x35')][_0x30d7('0x41')]+'%'};return _0x385f6a;}})});}_0x549d7a=_['merge']({},_0x549d7a,_0x347876[_0x30d7('0x44')]);var _0x553e53={'where':_0x549d7a[_0x30d7('0x40')]};return db[_0x30d7('0x45')][_0x30d7('0x1c')](_0x553e53)[_0x30d7('0x26')](function(_0x3190c7){_0x3b7dd6[_0x30d7('0x1c')]=_0x3190c7;if(_0x347876[_0x30d7('0x35')][_0x30d7('0x46')]){_0x549d7a[_0x30d7('0x47')]=[{'all':!![]}];}return db['CmList'][_0x30d7('0x48')](_0x549d7a);})[_0x30d7('0x26')](function(_0x5187b4){_0x3b7dd6[_0x30d7('0x49')]=_0x5187b4;return _0x3b7dd6;})[_0x30d7('0x26')](respondWithFilteredResult(_0x4ce189,_0x549d7a))[_0x30d7('0x4a')](handleError(_0x4ce189,null));};exports[_0x30d7('0x4b')]=function(_0x9ce092,_0x10ae70){var _0x281015={'raw':![],'where':{'id':_0x9ce092['params']['id']}},_0x117033={};_0x117033[_0x30d7('0x34')]=_['keys'](db['CmList'][_0x30d7('0x30')]);_0x117033[_0x30d7('0x35')]=_[_0x30d7('0x36')](_0x9ce092[_0x30d7('0x35')]);_0x117033[_0x30d7('0x37')]=_[_0x30d7('0x38')](_0x117033['model'],_0x117033[_0x30d7('0x35')]);_0x281015['attributes']=_['intersection'](_0x117033[_0x30d7('0x34')],qs[_0x30d7('0x3a')](_0x9ce092[_0x30d7('0x35')][_0x30d7('0x3a')]));_0x281015[_0x30d7('0x39')]=_0x281015[_0x30d7('0x39')]['length']?_0x281015['attributes']:_0x117033[_0x30d7('0x34')];if(_0x9ce092['query'][_0x30d7('0x46')]){_0x281015['include']=[{'all':!![]}];}_0x281015=_['merge']({},_0x281015,_0x9ce092[_0x30d7('0x44')]);return db[_0x30d7('0x45')][_0x30d7('0x4c')](_0x281015)[_0x30d7('0x26')](handleEntityNotFound(_0x10ae70,null))[_0x30d7('0x26')](respondWithResult(_0x10ae70,null))[_0x30d7('0x4a')](handleError(_0x10ae70,null));};exports[_0x30d7('0x4d')]=function(_0x495602,_0x1dc661){return db[_0x30d7('0x45')][_0x30d7('0x4d')](_0x495602[_0x30d7('0x4e')],{})['then'](function(_0x176a1c){var _0x49a0e6=_0x495602['user'][_0x30d7('0x27')]({'plain':!![]});if(!_0x49a0e6)throw new Error(_0x30d7('0x4f'));if(_0x49a0e6['role']===_0x30d7('0x50')){var _0x1181c0=_0x176a1c['get']({'plain':!![]});var _0x5cc52e=_0x30d7('0x28');return db['UserProfileSection'][_0x30d7('0x4c')]({'where':{'name':_0x5cc52e,'userProfileId':_0x49a0e6[_0x30d7('0x51')]},'raw':!![]})[_0x30d7('0x26')](function(_0x4b1fb5){if(_0x4b1fb5&&_0x4b1fb5[_0x30d7('0x52')]===0x0){return db['UserProfileResource'][_0x30d7('0x4d')]({'name':_0x1181c0[_0x30d7('0x2d')],'resourceId':_0x1181c0['id'],'type':_0x4b1fb5[_0x30d7('0x2d')],'sectionId':_0x4b1fb5['id']},{})['then'](function(){return _0x176a1c;});}else{return _0x176a1c;}})[_0x30d7('0x4a')](function(_0x24da16){logger[_0x30d7('0x2b')](_0x30d7('0x53'),_0x24da16);throw _0x24da16;});}return _0x176a1c;})['then'](respondWithResult(_0x1dc661,0xc9))[_0x30d7('0x4a')](handleError(_0x1dc661,null));};exports['update']=function(_0x52f097,_0x52b2f2){if(_0x52f097[_0x30d7('0x4e')]['id']){delete _0x52f097[_0x30d7('0x4e')]['id'];}return db[_0x30d7('0x45')][_0x30d7('0x4c')]({'where':{'id':_0x52f097[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x52b2f2,null))[_0x30d7('0x26')](saveUpdates(_0x52f097[_0x30d7('0x4e')],null))[_0x30d7('0x26')](respondWithResult(_0x52b2f2,null))[_0x30d7('0x4a')](handleError(_0x52b2f2,null));};exports[_0x30d7('0x25')]=function(_0x39272e,_0x4b490b){return db['CmList'][_0x30d7('0x4c')]({'where':{'id':_0x39272e['params']['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x4b490b,null))[_0x30d7('0x26')](removeEntity(_0x4b490b,null))[_0x30d7('0x4a')](handleError(_0x4b490b,null));};exports['describe']=function(_0x3150b3,_0x28f3ff){return db[_0x30d7('0x45')][_0x30d7('0x55')]()[_0x30d7('0x26')](respondWithResult(_0x28f3ff,null))['catch'](handleError(_0x28f3ff,null));};exports['addDisposition']=function(_0x120df1,_0x270b02,_0x375665){if(_0x120df1['body']['id']){delete _0x120df1[_0x30d7('0x4e')]['id'];}return db[_0x30d7('0x45')]['find']({'where':{'id':_0x120df1['params']['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x270b02,null))[_0x30d7('0x26')](function(_0x223cf8){if(_0x223cf8){_0x120df1[_0x30d7('0x4e')][_0x30d7('0x56')]=_0x223cf8['id'];return db[_0x30d7('0x57')][_0x30d7('0x4d')](_0x120df1[_0x30d7('0x4e')]);}})['then'](respondWithResult(_0x270b02,null))[_0x30d7('0x4a')](handleError(_0x270b02,null));};exports[_0x30d7('0x58')]=function(_0x3383da,_0x374fa3,_0x26804d){var _0xb3406f={'raw':![],'where':{}};var _0x49c624={};var _0x549c46={'count':0x0,'rows':[]};return db[_0x30d7('0x45')][_0x30d7('0x59')]({'where':{'id':_0x3383da[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x374fa3,null))[_0x30d7('0x26')](function(_0x29148c){if(_0x29148c){_0x49c624['model']=_[_0x30d7('0x36')](db[_0x30d7('0x57')][_0x30d7('0x30')]);_0x49c624[_0x30d7('0x35')]=_[_0x30d7('0x36')](_0x3383da['query']);_0x49c624[_0x30d7('0x37')]=_[_0x30d7('0x38')](_0x49c624[_0x30d7('0x34')],_0x49c624[_0x30d7('0x35')]);_0xb3406f[_0x30d7('0x39')]=_[_0x30d7('0x38')](_0x49c624['model'],qs[_0x30d7('0x3a')](_0x3383da['query']['fields']));_0xb3406f[_0x30d7('0x39')]=_0xb3406f['attributes'][_0x30d7('0x3b')]?_0xb3406f[_0x30d7('0x39')]:_0x49c624['model'];if(!_0x3383da[_0x30d7('0x35')][_0x30d7('0x3c')](_0x30d7('0x3d'))){_0xb3406f['limit']=qs['limit'](_0x3383da[_0x30d7('0x35')][_0x30d7('0x1e')]);_0xb3406f['offset']=qs[_0x30d7('0x1d')](_0x3383da[_0x30d7('0x35')]['offset']);}_0xb3406f[_0x30d7('0x3e')]=qs[_0x30d7('0x3f')](_0x3383da[_0x30d7('0x35')][_0x30d7('0x3f')]);_0xb3406f['where']=qs[_0x30d7('0x37')](_['pick'](_0x3383da[_0x30d7('0x35')],_0x49c624['filters']));_0xb3406f[_0x30d7('0x40')][_0x30d7('0x56')]=_0x29148c['id'];if(_0x3383da['query'][_0x30d7('0x41')]){_0xb3406f['where']=_[_0x30d7('0x42')](_0xb3406f['where'],{'$or':_[_0x30d7('0x2f')](_0xb3406f[_0x30d7('0x39')],function(_0x1420df){var _0x5e0e2a={};_0x5e0e2a[_0x1420df]={'$like':'%'+_0x3383da[_0x30d7('0x35')][_0x30d7('0x41')]+'%'};return _0x5e0e2a;})});}_0xb3406f=_[_0x30d7('0x42')]({},_0xb3406f,_0x3383da[_0x30d7('0x44')]);return db[_0x30d7('0x57')][_0x30d7('0x1c')]({'where':_0xb3406f[_0x30d7('0x40')]})[_0x30d7('0x26')](function(_0x142016){_0x549c46[_0x30d7('0x1c')]=_0x142016;if(_0x3383da[_0x30d7('0x35')][_0x30d7('0x46')]){_0xb3406f[_0x30d7('0x47')]=[{'all':!![]}];}return db[_0x30d7('0x57')]['findAll'](_0xb3406f);})[_0x30d7('0x26')](function(_0x44bfb1){_0x549c46[_0x30d7('0x49')]=_0x44bfb1;return _0x549c46;});}})[_0x30d7('0x26')](respondWithFilteredResult(_0x374fa3,_0xb3406f))['catch'](handleError(_0x374fa3,null));};exports[_0x30d7('0x5a')]=function(_0x12ca8c,_0x329fb6,_0x43a6e4){return db['CmList'][_0x30d7('0x4c')]({'where':{'id':_0x12ca8c[_0x30d7('0x54')]['id']}})['then'](handleEntityNotFound(_0x329fb6,null))['then'](function(_0x534764){if(_0x534764){return _0x534764[_0x30d7('0x5a')](_0x12ca8c[_0x30d7('0x35')][_0x30d7('0x5b')]);}})[_0x30d7('0x26')](respondWithStatusCode(_0x329fb6,null))[_0x30d7('0x4a')](handleError(_0x329fb6,null));};exports[_0x30d7('0x5c')]=function(_0x15c187,_0x22cc98,_0x330a86){return db[_0x30d7('0x45')][_0x30d7('0x4c')]({'where':{'id':_0x15c187[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x22cc98,null))['then'](function(_0x56e708){if(_0x56e708){var _0x1c2b2f=[];var _0x397ebe={'success':[],'errors':[]};return db[_0x30d7('0x5d')]['describe']()[_0x30d7('0x26')](function(_0x517e65){if(_0x15c187['body'][_0x30d7('0x5e')]&&_[_0x30d7('0x5f')](_0x15c187[_0x30d7('0x4e')][_0x30d7('0x5e')])){if(_0x15c187[_0x30d7('0x4e')][_0x30d7('0x5e')][_0x30d7('0x3b')]){_0x15c187[_0x30d7('0x4e')][_0x30d7('0x5e')]=_0x15c187['body'][_0x30d7('0x5e')][_0x30d7('0x60')](';')+';';}else{_0x15c187[_0x30d7('0x4e')][_0x30d7('0x5e')]=null;}}else{_0x15c187[_0x30d7('0x4e')][_0x30d7('0x5e')]=null;}if(_0x15c187['body']&&_[_0x30d7('0x5f')](_0x15c187[_0x30d7('0x4e')])){for(var _0x2c4bf8=0x0;_0x2c4bf8<_0x15c187[_0x30d7('0x4e')][_0x30d7('0x3b')];_0x2c4bf8+=0x1){_0x15c187[_0x30d7('0x4e')][_0x2c4bf8]['ListId']=_0x15c187[_0x30d7('0x54')]['id'];_0x1c2b2f[_0x30d7('0x61')](_0x15c187[_0x30d7('0x4e')][_0x2c4bf8]);}return BPromise[_0x30d7('0x62')](_0x1c2b2f,function(_0x42f72a){return db['CmContact']['create'](_['omit'](_0x42f72a,[_0x30d7('0x5b'),'id'])||{},{'fields':_['keys'](_0x517e65),'raw':!![]})['then'](function(_0x1ef3f0){_0x397ebe[_0x30d7('0x63')]['push'](_0x1ef3f0[_0x30d7('0x64')]);})[_0x30d7('0x4a')](function(_0x4c4afc){_0x397ebe[_0x30d7('0x65')][_0x30d7('0x61')]({'data':_0x42f72a,'error':_0x4c4afc[_0x30d7('0x66')]});});})[_0x30d7('0x26')](function(_0x4d6738){return _0x397ebe;})[_0x30d7('0x4a')](function(_0x418f70){return _0x418f70;});}else{_0x22cc98[_0x30d7('0x1f')](0x190)['json']({'message':_0x30d7('0x67')});}});}})[_0x30d7('0x26')](respondWithResult(_0x22cc98,null))['catch'](handleError(_0x22cc98,null));};exports[_0x30d7('0x68')]=function(_0x4f0263,_0x372a18,_0x129c4e){var _0x1c7ba2;return db[_0x30d7('0x45')][_0x30d7('0x4c')]({'where':{'id':_0x4f0263[_0x30d7('0x54')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x30d7('0x69')}]})['then'](handleEntityNotFound(_0x372a18,null))[_0x30d7('0x26')](function(_0x53c4ad){if(_0x53c4ad){_0x1c7ba2=_0x53c4ad;return db[_0x30d7('0x5d')][_0x30d7('0x30')];}})[_0x30d7('0x26')](function(_0x251f61){if(_0x251f61){var _0x48cdb3={};var _0x1b100d={};_0x1b100d[_0x30d7('0x34')]=_[_0x30d7('0x6a')](_[_0x30d7('0x36')](_0x251f61),_[_0x30d7('0x2f')](_0x1c7ba2[_0x30d7('0x69')],function(_0x476da4){return util[_0x30d7('0x6b')](_0x30d7('0x6c'),_0x476da4['id']);}));_0x1b100d[_0x30d7('0x35')]=_[_0x30d7('0x36')](_0x4f0263[_0x30d7('0x35')]);_0x1b100d[_0x30d7('0x37')]=_['intersection'](_0x1b100d['model'],_0x1b100d[_0x30d7('0x35')]);_0x48cdb3[_0x30d7('0x39')]=_['intersection'](_0x1b100d[_0x30d7('0x34')],qs[_0x30d7('0x3a')](_0x4f0263[_0x30d7('0x35')]['fields']));_0x48cdb3[_0x30d7('0x39')]=_0x48cdb3[_0x30d7('0x39')][_0x30d7('0x3b')]?_0x48cdb3[_0x30d7('0x39')]:_0x1b100d['model'];if(!_0x4f0263[_0x30d7('0x35')]['hasOwnProperty']('nolimit')){_0x48cdb3['limit']=qs[_0x30d7('0x1e')](_0x4f0263[_0x30d7('0x35')][_0x30d7('0x1e')]);_0x48cdb3[_0x30d7('0x1d')]=qs[_0x30d7('0x1d')](_0x4f0263[_0x30d7('0x35')][_0x30d7('0x1d')]);}_0x48cdb3['order']=qs[_0x30d7('0x3f')](_0x4f0263[_0x30d7('0x35')][_0x30d7('0x3f')]);_0x48cdb3[_0x30d7('0x40')]=qs[_0x30d7('0x37')](_[_0x30d7('0x6d')](_0x4f0263[_0x30d7('0x35')],_0x1b100d[_0x30d7('0x37')]));_0x48cdb3['raw']=!![];if(_0x4f0263[_0x30d7('0x35')][_0x30d7('0x41')]){_0x48cdb3[_0x30d7('0x40')]=_[_0x30d7('0x42')](_0x48cdb3[_0x30d7('0x40')],{'$or':_['map'](_0x48cdb3[_0x30d7('0x39')],function(_0x4dbcec){var _0x4e21c1={};_0x4e21c1[_0x4dbcec]={'$like':'%'+_0x4f0263[_0x30d7('0x35')][_0x30d7('0x41')]+'%'};return _0x4e21c1;})});}_0x48cdb3=_[_0x30d7('0x42')]({},_0x48cdb3,_0x4f0263[_0x30d7('0x44')]);return _0x1c7ba2[_0x30d7('0x68')](_0x48cdb3);}})[_0x30d7('0x26')](respondWithResult(_0x372a18,null))[_0x30d7('0x4a')](handleError(_0x372a18,null));};exports[_0x30d7('0x6e')]=function(_0x5408b2,_0x54eb00,_0xe56caf){var _0xebb685;var _0x3d3ab7;var _0x5a5880;var _0x427e56=_0x5408b2[_0x30d7('0x54')]['id'];csv_results=[];return db[_0x30d7('0x6f')][_0x30d7('0x48')]({'attributes':['id',_0x30d7('0x2d')],'raw':!![],'order':[_0x30d7('0x70')]})[_0x30d7('0x26')](function(_0x35b3ed){_0xebb685=_0x35b3ed;var _0x1c5eda=_['keys'](db['CmContact'][_0x30d7('0x30')]);return db[_0x30d7('0x71')]['findAll']({'raw':!![],'attributes':['id','alias']})[_0x30d7('0x26')](function(_0x511633){_0x3d3ab7=_0x511633;var _0x400e66=squel['select']()[_0x30d7('0x3a')](_0x1c5eda)['from'](_0x30d7('0x72'),'c')['where'](_0x30d7('0x73'),_0x427e56)[_0x30d7('0x40')]('c.deletedAt\x20is\x20null')[_0x30d7('0x74')]();for(var _0x4d7726=0x0;_0x4d7726<_0x3d3ab7[_0x30d7('0x3b')];_0x4d7726++){_0x400e66['field'](_0x30d7('0x75')+_0x3d3ab7[_0x4d7726]['id'],_0x30d7('0x76')+_0x3d3ab7[_0x4d7726][_0x30d7('0x77')]);}for(var _0x4d7726=0x0;_0x4d7726<_0xebb685[_0x30d7('0x3b')];_0x4d7726++){_0x400e66['field'](squel['select']()['field'](_0x30d7('0x78'))[_0x30d7('0x79')](_0x30d7('0x7a'))[_0x30d7('0x40')]('ItemTypeId\x20=\x20?',_0xebb685[_0x4d7726]['id'])[_0x30d7('0x40')](_0x30d7('0x7b')),_0x30d7('0x7c')+_0xebb685[_0x4d7726]['name']);_0x400e66[_0x30d7('0x7d')](squel['select']()['field'](_0x30d7('0x7e'))[_0x30d7('0x79')](_0x30d7('0x7a'))['where'](_0x30d7('0x7f'),_0xebb685[_0x4d7726]['id'])[_0x30d7('0x40')](_0x30d7('0x7b')),_0x30d7('0x80')+_0xebb685[_0x4d7726][_0x30d7('0x2d')]);}var _0xe9804c=[];_0xe9804c[_0x30d7('0x61')](_0x400e66['toString']());BPromise[_0x30d7('0x62')](_0xe9804c,handleQuery)[_0x30d7('0x26')](function(_0x1d096c){handleQuery(_0x400e66[_0x30d7('0x81')]());var _0x5ec348=csv_results[0x0];if(!_[_0x30d7('0x82')](_0x5ec348)){var _0x124378=toCsv(_0x5ec348);var _0x2d437b=Date[_0x30d7('0x83')]();fs[_0x30d7('0x84')](util[_0x30d7('0x6b')](_0x30d7('0x85'),_0x427e56,_0x2d437b),_0x124378);_0x54eb00['setHeader'](_0x30d7('0x86'),_0x30d7('0x87')+util['format'](_0x30d7('0x88'),_0x427e56,_0x2d437b));_0x54eb00['setHeader'](_0x30d7('0x89'),_0x30d7('0x8a'));return _0x54eb00[_0x30d7('0x8b')](util['format'](_0x30d7('0x85'),_0x427e56,_0x2d437b));}else{return _0x54eb00[_0x30d7('0x19')](0xcc);}});});});};exports[_0x30d7('0x8c')]=function(_0x44a133,_0x37613b,_0x26a337){var _0x4b2909;delete _0x44a133[_0x30d7('0x4e')]['id'];return db[_0x30d7('0x45')][_0x30d7('0x59')]({'where':{'id':_0x44a133[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x37613b,null))[_0x30d7('0x26')](function(_0x2a3434){if(_0x2a3434){return db[_0x30d7('0x8d')]['transaction'](function(_0x193f5e){return db['CmCustomField'][_0x30d7('0x4d')](_0x44a133['body'],{'transaction':_0x193f5e})['then'](function(_0x162f12){_0x4b2909=_0x162f12;return _0x2a3434[_0x30d7('0x8e')](_0x162f12,{'transaction':_0x193f5e});})[_0x30d7('0x26')](function(){var _0x2c4e20={'type':db[_0x30d7('0x8f')]['TEXT'],'transaction':_0x193f5e};switch(_0x44a133[_0x30d7('0x4e')]['type']){case _0x30d7('0x90'):_0x2c4e20['type']=db[_0x30d7('0x8f')][_0x30d7('0x91')];break;case _0x30d7('0x92'):_0x2c4e20['type']=db[_0x30d7('0x8f')][_0x30d7('0x93')];break;case _0x30d7('0x94'):_0x2c4e20[_0x30d7('0x32')]=db[_0x30d7('0x8f')][_0x30d7('0x95')];_0x2c4e20[_0x30d7('0x96')]=![];break;default:}return db[_0x30d7('0x8d')][_0x30d7('0x97')][_0x30d7('0x98')]('cm_contacts',util[_0x30d7('0x6b')](_0x30d7('0x99'),_0x4b2909['id']),_0x2c4e20);})['then'](function(){return _0x4b2909;});});}})[_0x30d7('0x26')](respondWithResult(_0x37613b,null))['catch'](handleError(_0x37613b,null));};exports['getCustomFields']=function(_0x5e1fd2,_0x73fc36,_0x3473d7){var _0x179c04={};var _0x12fe3d={};var _0x2595ac;var _0x5c16ab;return db['CmList'][_0x30d7('0x59')]({'where':{'id':_0x5e1fd2[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x73fc36,null))[_0x30d7('0x26')](function(_0x5db04c){if(_0x5db04c){_0x2595ac=_0x5db04c;_0x12fe3d[_0x30d7('0x34')]=_[_0x30d7('0x36')](db['CmCustomField'][_0x30d7('0x30')]);_0x12fe3d['query']=_[_0x30d7('0x36')](_0x5e1fd2['query']);_0x12fe3d[_0x30d7('0x37')]=_['intersection'](_0x12fe3d[_0x30d7('0x34')],_0x12fe3d[_0x30d7('0x35')]);_0x179c04['attributes']=_[_0x30d7('0x38')](_0x12fe3d[_0x30d7('0x34')],qs[_0x30d7('0x3a')](_0x5e1fd2[_0x30d7('0x35')][_0x30d7('0x3a')]));_0x179c04[_0x30d7('0x39')]=_0x179c04[_0x30d7('0x39')][_0x30d7('0x3b')]?_0x179c04[_0x30d7('0x39')]:_0x12fe3d['model'];_0x179c04[_0x30d7('0x3e')]=qs['sort'](_0x5e1fd2[_0x30d7('0x35')][_0x30d7('0x3f')]);_0x179c04[_0x30d7('0x40')]=qs['filters'](_[_0x30d7('0x6d')](_0x5e1fd2[_0x30d7('0x35')],_0x12fe3d[_0x30d7('0x37')]));_0x179c04[_0x30d7('0x40')]=_['merge'](_0x179c04['where'],{'$or':[{'ListId':_0x5db04c['id']},{'ListId':null}]});if(_0x5e1fd2[_0x30d7('0x35')]['filter']){_0x179c04[_0x30d7('0x40')]=_['merge'](_0x179c04['where'],{'$or':_[_0x30d7('0x2f')](_0x179c04[_0x30d7('0x39')],function(_0xeb752f){var _0x2bf811={};_0x2bf811[_0xeb752f]={'$like':'%'+_0x5e1fd2[_0x30d7('0x35')][_0x30d7('0x41')]+'%'};return _0x2bf811;})});}_0x179c04=_[_0x30d7('0x42')]({},_0x179c04,_0x5e1fd2[_0x30d7('0x44')]);return db['CmCustomField'][_0x30d7('0x9a')](_0x179c04);}})[_0x30d7('0x26')](respondWithResult(_0x73fc36,null))[_0x30d7('0x4a')](handleError(_0x73fc36,null));};exports[_0x30d7('0x9b')]=function(_0x50b40a,_0x192013){return db[_0x30d7('0x71')]['findAndCountAll']({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x192013,null))[_0x30d7('0x26')](function(_0x5ee6d5){return _0x5ee6d5;})[_0x30d7('0x26')](respondWithResult(_0x192013,null))[_0x30d7('0x4a')](handleError(_0x192013,null));};exports['addAgents']=function(_0x39885c,_0x27b01b,_0x5b2fe1){return db['CmList'][_0x30d7('0x4c')]({'where':{'id':_0x39885c[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x27b01b,null))[_0x30d7('0x26')](function(_0x2727f1){if(_0x2727f1){return _0x2727f1[_0x30d7('0x9c')](_0x39885c[_0x30d7('0x4e')][_0x30d7('0x5b')],_[_0x30d7('0x9d')](_0x39885c['body'],['ids','id'])||{})[_0x30d7('0x9e')](function(_0x18fbb1){for(var _0x2d043a=0x0;_0x2d043a<_0x39885c[_0x30d7('0x4e')][_0x30d7('0x5b')][_0x30d7('0x3b')];_0x2d043a+=0x1){socket[_0x30d7('0x9f')]('userCmList:save',{'UserId':Number(_0x39885c[_0x30d7('0x4e')][_0x30d7('0x5b')][_0x2d043a]),'CmListId':Number(_0x39885c['params']['id'])});}return _0x18fbb1;});}})[_0x30d7('0x26')](respondWithResult(_0x27b01b,null))[_0x30d7('0x4a')](handleError(_0x27b01b,null));};exports['removeAgents']=function(_0x4b43f3,_0x56b04b,_0x3b6a0e){return db[_0x30d7('0x45')][_0x30d7('0x4c')]({'where':{'id':_0x4b43f3[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x56b04b,null))['then'](function(_0x50cb8b){if(_0x50cb8b){return _0x50cb8b[_0x30d7('0xa0')](_0x4b43f3[_0x30d7('0x35')][_0x30d7('0x5b')])['then'](function(){if(_['isArray'](_0x4b43f3[_0x30d7('0x35')][_0x30d7('0x5b')])){for(var _0x523448=0x0;_0x523448<_0x4b43f3[_0x30d7('0x35')][_0x30d7('0x5b')][_0x30d7('0x3b')];_0x523448+=0x1){socket[_0x30d7('0x9f')](_0x30d7('0xa1'),{'UserId':Number(_0x4b43f3[_0x30d7('0x35')][_0x30d7('0x5b')][_0x523448]),'CmListId':Number(_0x4b43f3[_0x30d7('0x54')]['id'])});}}else{socket['emit'](_0x30d7('0xa1'),{'UserId':Number(_0x4b43f3[_0x30d7('0x35')][_0x30d7('0x5b')]),'CmListId':Number(_0x4b43f3['params']['id'])});}});}})[_0x30d7('0x26')](respondWithStatusCode(_0x56b04b,null))[_0x30d7('0x4a')](handleError(_0x56b04b,null));};exports[_0x30d7('0xa2')]=function(_0x742513,_0x30f260,_0x45b22d){var _0x5b1675={};var _0x3fe4f4={};var _0x1bc07d;var _0xbcbc0d;return db[_0x30d7('0x45')][_0x30d7('0x59')]({'where':{'id':_0x742513[_0x30d7('0x54')]['id']}})[_0x30d7('0x26')](handleEntityNotFound(_0x30f260,null))[_0x30d7('0x26')](function(_0x1e2b21){if(_0x1e2b21){_0x1bc07d=_0x1e2b21;_0x3fe4f4[_0x30d7('0x34')]=_[_0x30d7('0x36')](db['User'][_0x30d7('0x30')]);_0x3fe4f4[_0x30d7('0x35')]=_[_0x30d7('0x36')](_0x742513[_0x30d7('0x35')]);_0x3fe4f4[_0x30d7('0x37')]=_[_0x30d7('0x38')](_0x3fe4f4[_0x30d7('0x34')],_0x3fe4f4[_0x30d7('0x35')]);_0x5b1675[_0x30d7('0x39')]=_['intersection'](_0x3fe4f4[_0x30d7('0x34')],qs['fields'](_0x742513['query']['fields']));_0x5b1675['attributes']=_0x5b1675[_0x30d7('0x39')][_0x30d7('0x3b')]?_0x5b1675['attributes']:_0x3fe4f4[_0x30d7('0x34')];_0x5b1675[_0x30d7('0x3e')]=qs[_0x30d7('0x3f')](_0x742513['query'][_0x30d7('0x3f')]);_0x5b1675['where']=qs[_0x30d7('0x37')](_[_0x30d7('0x6d')](_0x742513[_0x30d7('0x35')],_0x3fe4f4[_0x30d7('0x37')]));if(_0x742513[_0x30d7('0x35')][_0x30d7('0x41')]){_0x5b1675[_0x30d7('0x40')]=_[_0x30d7('0x42')](_0x5b1675['where'],{'$or':_[_0x30d7('0x2f')](_0x5b1675[_0x30d7('0x39')],function(_0x37a422){var _0x57c09f={};_0x57c09f[_0x37a422]={'$like':'%'+_0x742513[_0x30d7('0x35')][_0x30d7('0x41')]+'%'};return _0x57c09f;})});}_0x5b1675=_[_0x30d7('0x42')]({},_0x5b1675,_0x742513[_0x30d7('0x44')]);return _0x1bc07d[_0x30d7('0xa2')](_0x5b1675);}})[_0x30d7('0x26')](function(_0x8e4a7d){if(_0x8e4a7d){_0xbcbc0d=_0x8e4a7d['length'];if(!_0x742513['query'][_0x30d7('0x3c')](_0x30d7('0x3d'))){_0x5b1675[_0x30d7('0x1e')]=qs[_0x30d7('0x1e')](_0x742513[_0x30d7('0x35')]['limit']);_0x5b1675[_0x30d7('0x1d')]=qs[_0x30d7('0x1d')](_0x742513[_0x30d7('0x35')][_0x30d7('0x1d')]);}return _0x1bc07d[_0x30d7('0xa2')](_0x5b1675);}})[_0x30d7('0x26')](function(_0x1f6b7b){if(_0x1f6b7b){return _0x1f6b7b?{'count':_0xbcbc0d,'rows':_0x1f6b7b}:null;}})[_0x30d7('0x26')](respondWithResult(_0x30f260,null))[_0x30d7('0x4a')](handleError(_0x30f260,null));};function handleQuery(_0x1a8dfa){logger[_0x30d7('0xa3')](_0x1a8dfa);return db[_0x30d7('0x8d')][_0x30d7('0x35')](_0x1a8dfa)[_0x30d7('0x9e')](function(_0x4630e4){csv_results['push'](_0x4630e4);})['catch'](function(_0x2926e5){logger[_0x30d7('0x2b')](_0x2926e5['message']);});} \ No newline at end of file +var _0x7a8d=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','index','map','rawAttributes','type','key','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','CmList','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','ListId','Disposition','findOne','removeDispositions','ids','addContacts','tags','isArray','push','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','CustomFields','CmContact','cf_%d','raw','getContacts','getContactsCsv','alias','cm_contacts','distinct','field','c.cf_','customField_','select','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','description','CmContactId\x20=\x20c.id','description_additionalPhone_','toString','now','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','message','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x5ca1f5,_0x245726){var _0x9b8aa4=function(_0x310862){while(--_0x310862){_0x5ca1f5['push'](_0x5ca1f5['shift']());}};_0x9b8aa4(++_0x245726);}(_0x7a8d,0x8d));var _0xd7a8=function(_0x22b2b8,_0x49e83d){_0x22b2b8=_0x22b2b8-0x0;var _0x514365=_0x7a8d[_0x22b2b8];return _0x514365;};'use strict';var emlformat=require(_0xd7a8('0x0'));var rimraf=require(_0xd7a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd7a8('0x2'));var rp=require(_0xd7a8('0x3'));var moment=require(_0xd7a8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd7a8('0x5'));var util=require(_0xd7a8('0x6'));var path=require(_0xd7a8('0x7'));var sox=require(_0xd7a8('0x8'));var csv=require(_0xd7a8('0x9'));var ejs=require(_0xd7a8('0xa'));var fs=require('fs');var fs_extra=require(_0xd7a8('0xb'));var _=require(_0xd7a8('0xc'));var squel=require(_0xd7a8('0xd'));var crypto=require(_0xd7a8('0xe'));var jsforce=require(_0xd7a8('0xf'));var deskjs=require(_0xd7a8('0x10'));var toCsv=require('to-csv');var querystring=require(_0xd7a8('0x11'));var Papa=require('papaparse');var Redis=require(_0xd7a8('0x12'));var authService=require(_0xd7a8('0x13'));var qs=require(_0xd7a8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd7a8('0x15'));var logger=require(_0xd7a8('0x16'))(_0xd7a8('0x17'));var utils=require(_0xd7a8('0x18'));var config=require(_0xd7a8('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7a8('0x1a'))['db'];var csv_results;config[_0xd7a8('0x1b')]=_[_0xd7a8('0x1c')](config['redis'],{'host':_0xd7a8('0x1d'),'port':0x18eb});var socket=require(_0xd7a8('0x1e'))(new Redis(config[_0xd7a8('0x1b')]));require(_0xd7a8('0x1f'))[_0xd7a8('0x20')](socket);function respondWithStatusCode(_0x3be159,_0x344a10){_0x344a10=_0x344a10||0xcc;return function(_0x36dda1){if(_0x36dda1){return _0x3be159[_0xd7a8('0x21')](_0x344a10);}return _0x3be159[_0xd7a8('0x22')](_0x344a10)[_0xd7a8('0x23')]();};}function respondWithResult(_0x176714,_0x4f13f8){_0x4f13f8=_0x4f13f8||0xc8;return function(_0x21d7d0){if(_0x21d7d0){return _0x176714[_0xd7a8('0x22')](_0x4f13f8)['json'](_0x21d7d0);}};}function respondWithFilteredResult(_0xdfd7c9,_0x1c23df){return function(_0x3d7be7){if(_0x3d7be7){var _0x48dab2=typeof _0x1c23df[_0xd7a8('0x24')]==='undefined'&&typeof _0x1c23df[_0xd7a8('0x25')]===_0xd7a8('0x26');var _0x3a5c3b=_0x3d7be7[_0xd7a8('0x27')];var _0xd53a48=_0x48dab2?0x0:_0x1c23df[_0xd7a8('0x24')];var _0x14b6b9=_0x48dab2?_0x3d7be7['count']:_0x1c23df['offset']+_0x1c23df[_0xd7a8('0x25')];var _0x187fd9;if(_0x14b6b9>=_0x3a5c3b){_0x14b6b9=_0x3a5c3b;_0x187fd9=0xc8;}else{_0x187fd9=0xce;}_0xdfd7c9['status'](_0x187fd9);return _0xdfd7c9[_0xd7a8('0x28')](_0xd7a8('0x29'),_0xd53a48+'-'+_0x14b6b9+'/'+_0x3a5c3b)[_0xd7a8('0x2a')](_0x3d7be7);}return null;};}function patchUpdates(_0x2f73ec){return function(_0x391cb7){try{jsonpatch[_0xd7a8('0x2b')](_0x391cb7,_0x2f73ec,!![]);}catch(_0x13cce2){return BPromise[_0xd7a8('0x2c')](_0x13cce2);}return _0x391cb7[_0xd7a8('0x2d')]();};}function saveUpdates(_0x51636a,_0x44b3c9){return function(_0x3995ed){if(_0x3995ed){return _0x3995ed[_0xd7a8('0x2e')](_0x51636a)[_0xd7a8('0x2f')](function(_0x5746e3){return _0x5746e3;});}return null;};}function removeEntity(_0x39bfa1,_0xc0101c){return function(_0x434a65){if(_0x434a65){return _0x434a65[_0xd7a8('0x30')]()[_0xd7a8('0x2f')](function(){var _0x52d355=_0x434a65[_0xd7a8('0x31')]({'plain':!![]});var _0x2c5835='Lists';return db[_0xd7a8('0x32')][_0xd7a8('0x30')]({'where':{'type':_0x2c5835,'resourceId':_0x52d355['id']}})[_0xd7a8('0x2f')](function(){return _0x434a65;});})[_0xd7a8('0x2f')](function(){_0x39bfa1[_0xd7a8('0x22')](0xcc)[_0xd7a8('0x23')]();});}};}function handleEntityNotFound(_0x370333,_0x1858a3){return function(_0x3fc0e2){if(!_0x3fc0e2){_0x370333['sendStatus'](0x194);}return _0x3fc0e2;};}function handleError(_0x47fbdc,_0x2eb298){_0x2eb298=_0x2eb298||0x1f4;return function(_0x524fd5){logger[_0xd7a8('0x33')](_0x524fd5[_0xd7a8('0x34')]);if(_0x524fd5[_0xd7a8('0x35')]){delete _0x524fd5['name'];}_0x47fbdc[_0xd7a8('0x22')](_0x2eb298)['send'](_0x524fd5);};}exports[_0xd7a8('0x36')]=function(_0x303e09,_0x1a6b45){var _0x584d54={},_0x13f96d={},_0x4f793e={'count':0x0,'rows':[]};var _0x204a60=_[_0xd7a8('0x37')](db['CmList'][_0xd7a8('0x38')],function(_0x30b0ac){return{'name':_0x30b0ac['fieldName'],'type':_0x30b0ac[_0xd7a8('0x39')][_0xd7a8('0x3a')]};});_0x13f96d['model']=_['map'](_0x204a60,'name');_0x13f96d[_0xd7a8('0x3b')]=_[_0xd7a8('0x3c')](_0x303e09[_0xd7a8('0x3b')]);_0x13f96d['filters']=_['intersection'](_0x13f96d[_0xd7a8('0x3d')],_0x13f96d[_0xd7a8('0x3b')]);_0x584d54[_0xd7a8('0x3e')]=_[_0xd7a8('0x3f')](_0x13f96d[_0xd7a8('0x3d')],qs[_0xd7a8('0x40')](_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x40')]));_0x584d54['attributes']=_0x584d54[_0xd7a8('0x3e')][_0xd7a8('0x41')]?_0x584d54[_0xd7a8('0x3e')]:_0x13f96d[_0xd7a8('0x3d')];if(!_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x42')](_0xd7a8('0x43'))){_0x584d54[_0xd7a8('0x25')]=qs[_0xd7a8('0x25')](_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x25')]);_0x584d54[_0xd7a8('0x24')]=qs['offset'](_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x24')]);}_0x584d54[_0xd7a8('0x44')]=qs[_0xd7a8('0x45')](_0x303e09['query'][_0xd7a8('0x45')]);_0x584d54[_0xd7a8('0x46')]=qs[_0xd7a8('0x47')](_[_0xd7a8('0x48')](_0x303e09['query'],_0x13f96d['filters']),_0x204a60);if(_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x49')]){_0x584d54['where']=_[_0xd7a8('0x4a')](_0x584d54[_0xd7a8('0x46')],{'$or':_['map'](_0x204a60,function(_0x53ab93){if(_0x53ab93[_0xd7a8('0x39')]!==_0xd7a8('0x4b')){var _0x36c700={};_0x36c700[_0x53ab93[_0xd7a8('0x35')]]={'$like':'%'+_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x49')]+'%'};return _0x36c700;}})});}_0x584d54=_[_0xd7a8('0x4a')]({},_0x584d54,_0x303e09[_0xd7a8('0x4c')]);var _0x53ee1d={'where':_0x584d54[_0xd7a8('0x46')]};return db[_0xd7a8('0x4d')]['count'](_0x53ee1d)[_0xd7a8('0x2f')](function(_0x31b616){_0x4f793e[_0xd7a8('0x27')]=_0x31b616;if(_0x303e09[_0xd7a8('0x3b')][_0xd7a8('0x4e')]){_0x584d54[_0xd7a8('0x4f')]=[{'all':!![]}];}return db[_0xd7a8('0x4d')][_0xd7a8('0x50')](_0x584d54);})[_0xd7a8('0x2f')](function(_0x159662){_0x4f793e[_0xd7a8('0x51')]=_0x159662;return _0x4f793e;})[_0xd7a8('0x2f')](respondWithFilteredResult(_0x1a6b45,_0x584d54))[_0xd7a8('0x52')](handleError(_0x1a6b45,null));};exports['show']=function(_0x5f362b,_0x19e020){var _0xb28677={'raw':![],'where':{'id':_0x5f362b['params']['id']}},_0x20d1e0={};_0x20d1e0[_0xd7a8('0x3d')]=_[_0xd7a8('0x3c')](db[_0xd7a8('0x4d')][_0xd7a8('0x38')]);_0x20d1e0[_0xd7a8('0x3b')]=_[_0xd7a8('0x3c')](_0x5f362b[_0xd7a8('0x3b')]);_0x20d1e0[_0xd7a8('0x47')]=_[_0xd7a8('0x3f')](_0x20d1e0[_0xd7a8('0x3d')],_0x20d1e0[_0xd7a8('0x3b')]);_0xb28677[_0xd7a8('0x3e')]=_['intersection'](_0x20d1e0[_0xd7a8('0x3d')],qs['fields'](_0x5f362b[_0xd7a8('0x3b')][_0xd7a8('0x40')]));_0xb28677[_0xd7a8('0x3e')]=_0xb28677[_0xd7a8('0x3e')][_0xd7a8('0x41')]?_0xb28677[_0xd7a8('0x3e')]:_0x20d1e0[_0xd7a8('0x3d')];if(_0x5f362b[_0xd7a8('0x3b')][_0xd7a8('0x4e')]){_0xb28677[_0xd7a8('0x4f')]=[{'all':!![]}];}_0xb28677=_[_0xd7a8('0x4a')]({},_0xb28677,_0x5f362b[_0xd7a8('0x4c')]);return db[_0xd7a8('0x4d')][_0xd7a8('0x53')](_0xb28677)['then'](handleEntityNotFound(_0x19e020,null))[_0xd7a8('0x2f')](respondWithResult(_0x19e020,null))[_0xd7a8('0x52')](handleError(_0x19e020,null));};exports['create']=function(_0x9730f3,_0xfe2189){return db['CmList'][_0xd7a8('0x54')](_0x9730f3[_0xd7a8('0x55')],{})[_0xd7a8('0x2f')](function(_0x282050){var _0x165103=_0x9730f3[_0xd7a8('0x56')][_0xd7a8('0x31')]({'plain':!![]});if(!_0x165103)throw new Error(_0xd7a8('0x57'));if(_0x165103[_0xd7a8('0x58')]===_0xd7a8('0x56')){var _0xbb295d=_0x282050['get']({'plain':!![]});var _0x2895e6=_0xd7a8('0x59');return db[_0xd7a8('0x5a')][_0xd7a8('0x53')]({'where':{'name':_0x2895e6,'userProfileId':_0x165103['userProfileId']},'raw':!![]})[_0xd7a8('0x2f')](function(_0x5afb00){if(_0x5afb00&&_0x5afb00['autoAssociation']===0x0){return db[_0xd7a8('0x32')][_0xd7a8('0x54')]({'name':_0xbb295d[_0xd7a8('0x35')],'resourceId':_0xbb295d['id'],'type':_0x5afb00[_0xd7a8('0x35')],'sectionId':_0x5afb00['id']},{})[_0xd7a8('0x2f')](function(){return _0x282050;});}else{return _0x282050;}})['catch'](function(_0x333c36){logger[_0xd7a8('0x33')](_0xd7a8('0x5b'),_0x333c36);throw _0x333c36;});}return _0x282050;})[_0xd7a8('0x2f')](respondWithResult(_0xfe2189,0xc9))[_0xd7a8('0x52')](handleError(_0xfe2189,null));};exports[_0xd7a8('0x2e')]=function(_0xb20cc3,_0x186856){if(_0xb20cc3[_0xd7a8('0x55')]['id']){delete _0xb20cc3[_0xd7a8('0x55')]['id'];}return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0xb20cc3[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x186856,null))[_0xd7a8('0x2f')](saveUpdates(_0xb20cc3[_0xd7a8('0x55')],null))[_0xd7a8('0x2f')](respondWithResult(_0x186856,null))[_0xd7a8('0x52')](handleError(_0x186856,null));};exports[_0xd7a8('0x30')]=function(_0x511e83,_0x383d93){return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0x511e83[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x383d93,null))[_0xd7a8('0x2f')](removeEntity(_0x383d93,null))[_0xd7a8('0x52')](handleError(_0x383d93,null));};exports[_0xd7a8('0x5d')]=function(_0x5ae80f,_0x3fda7e){return db[_0xd7a8('0x4d')]['describe']()['then'](respondWithResult(_0x3fda7e,null))['catch'](handleError(_0x3fda7e,null));};exports[_0xd7a8('0x5e')]=function(_0x2daade,_0x3bea06,_0x4d27e9){if(_0x2daade[_0xd7a8('0x55')]['id']){delete _0x2daade['body']['id'];}return db[_0xd7a8('0x4d')]['find']({'where':{'id':_0x2daade[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x3bea06,null))[_0xd7a8('0x2f')](function(_0x23d664){if(_0x23d664){_0x2daade[_0xd7a8('0x55')][_0xd7a8('0x5f')]=_0x23d664['id'];return db[_0xd7a8('0x60')][_0xd7a8('0x54')](_0x2daade['body']);}})[_0xd7a8('0x2f')](respondWithResult(_0x3bea06,null))['catch'](handleError(_0x3bea06,null));};exports['getDispositions']=function(_0x49b304,_0x420613,_0x126f3a){var _0x586e8a={'raw':![],'where':{}};var _0x341619={};var _0x4c1988={'count':0x0,'rows':[]};return db[_0xd7a8('0x4d')][_0xd7a8('0x61')]({'where':{'id':_0x49b304[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x420613,null))[_0xd7a8('0x2f')](function(_0x3265d0){if(_0x3265d0){_0x341619['model']=_[_0xd7a8('0x3c')](db[_0xd7a8('0x60')]['rawAttributes']);_0x341619[_0xd7a8('0x3b')]=_['keys'](_0x49b304[_0xd7a8('0x3b')]);_0x341619[_0xd7a8('0x47')]=_[_0xd7a8('0x3f')](_0x341619[_0xd7a8('0x3d')],_0x341619[_0xd7a8('0x3b')]);_0x586e8a['attributes']=_[_0xd7a8('0x3f')](_0x341619[_0xd7a8('0x3d')],qs['fields'](_0x49b304[_0xd7a8('0x3b')][_0xd7a8('0x40')]));_0x586e8a[_0xd7a8('0x3e')]=_0x586e8a['attributes'][_0xd7a8('0x41')]?_0x586e8a[_0xd7a8('0x3e')]:_0x341619['model'];if(!_0x49b304['query']['hasOwnProperty']('nolimit')){_0x586e8a[_0xd7a8('0x25')]=qs['limit'](_0x49b304['query']['limit']);_0x586e8a[_0xd7a8('0x24')]=qs['offset'](_0x49b304[_0xd7a8('0x3b')][_0xd7a8('0x24')]);}_0x586e8a[_0xd7a8('0x44')]=qs[_0xd7a8('0x45')](_0x49b304[_0xd7a8('0x3b')][_0xd7a8('0x45')]);_0x586e8a[_0xd7a8('0x46')]=qs[_0xd7a8('0x47')](_['pick'](_0x49b304[_0xd7a8('0x3b')],_0x341619['filters']));_0x586e8a[_0xd7a8('0x46')][_0xd7a8('0x5f')]=_0x3265d0['id'];if(_0x49b304[_0xd7a8('0x3b')]['filter']){_0x586e8a[_0xd7a8('0x46')]=_[_0xd7a8('0x4a')](_0x586e8a[_0xd7a8('0x46')],{'$or':_[_0xd7a8('0x37')](_0x586e8a[_0xd7a8('0x3e')],function(_0x4ebf3a){var _0x16b3fd={};_0x16b3fd[_0x4ebf3a]={'$like':'%'+_0x49b304[_0xd7a8('0x3b')]['filter']+'%'};return _0x16b3fd;})});}_0x586e8a=_[_0xd7a8('0x4a')]({},_0x586e8a,_0x49b304[_0xd7a8('0x4c')]);return db[_0xd7a8('0x60')][_0xd7a8('0x27')]({'where':_0x586e8a[_0xd7a8('0x46')]})[_0xd7a8('0x2f')](function(_0x3ba485){_0x4c1988[_0xd7a8('0x27')]=_0x3ba485;if(_0x49b304['query'][_0xd7a8('0x4e')]){_0x586e8a[_0xd7a8('0x4f')]=[{'all':!![]}];}return db[_0xd7a8('0x60')][_0xd7a8('0x50')](_0x586e8a);})[_0xd7a8('0x2f')](function(_0x55f343){_0x4c1988[_0xd7a8('0x51')]=_0x55f343;return _0x4c1988;});}})[_0xd7a8('0x2f')](respondWithFilteredResult(_0x420613,_0x586e8a))['catch'](handleError(_0x420613,null));};exports[_0xd7a8('0x62')]=function(_0x3fd4ba,_0x27c89c,_0x530c42){return db[_0xd7a8('0x4d')]['find']({'where':{'id':_0x3fd4ba[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x27c89c,null))['then'](function(_0x175d9c){if(_0x175d9c){return _0x175d9c[_0xd7a8('0x62')](_0x3fd4ba[_0xd7a8('0x3b')][_0xd7a8('0x63')]);}})[_0xd7a8('0x2f')](respondWithStatusCode(_0x27c89c,null))['catch'](handleError(_0x27c89c,null));};exports[_0xd7a8('0x64')]=function(_0xf0d27d,_0x52351c,_0xc9a2c4){return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0xf0d27d[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x52351c,null))['then'](function(_0x26d3bf){if(_0x26d3bf){var _0x4e60af=[];var _0x5d12ed={'success':[],'errors':[]};return db['CmContact'][_0xd7a8('0x5d')]()[_0xd7a8('0x2f')](function(_0x3b8740){if(_0xf0d27d['body'][_0xd7a8('0x65')]&&_[_0xd7a8('0x66')](_0xf0d27d[_0xd7a8('0x55')]['tags'])){if(_0xf0d27d[_0xd7a8('0x55')][_0xd7a8('0x65')][_0xd7a8('0x41')]){_0xf0d27d[_0xd7a8('0x55')][_0xd7a8('0x65')]=_0xf0d27d[_0xd7a8('0x55')]['tags']['join'](';')+';';}else{_0xf0d27d[_0xd7a8('0x55')][_0xd7a8('0x65')]=null;}}else{_0xf0d27d[_0xd7a8('0x55')][_0xd7a8('0x65')]=null;}if(_0xf0d27d[_0xd7a8('0x55')]&&_[_0xd7a8('0x66')](_0xf0d27d[_0xd7a8('0x55')])){for(var _0x302507=0x0;_0x302507<_0xf0d27d[_0xd7a8('0x55')][_0xd7a8('0x41')];_0x302507+=0x1){_0xf0d27d['body'][_0x302507][_0xd7a8('0x5f')]=_0xf0d27d[_0xd7a8('0x5c')]['id'];_0x4e60af[_0xd7a8('0x67')](_0xf0d27d['body'][_0x302507]);}return BPromise['each'](_0x4e60af,function(_0x378172){return db['CmContact']['create'](_[_0xd7a8('0x68')](_0x378172,[_0xd7a8('0x63'),'id'])||{},{'fields':_[_0xd7a8('0x3c')](_0x3b8740),'raw':!![]})[_0xd7a8('0x2f')](function(_0x181c1c){_0x5d12ed[_0xd7a8('0x69')][_0xd7a8('0x67')](_0x181c1c[_0xd7a8('0x6a')]);})['catch'](function(_0x35ce40){_0x5d12ed[_0xd7a8('0x6b')][_0xd7a8('0x67')]({'data':_0x378172,'error':_0x35ce40['message']});});})[_0xd7a8('0x2f')](function(_0x5c4f7b){return _0x5d12ed;})['catch'](function(_0x9c0e94){return _0x9c0e94;});}else{_0x52351c[_0xd7a8('0x22')](0x190)[_0xd7a8('0x2a')]({'message':_0xd7a8('0x6c')});}});}})['then'](respondWithResult(_0x52351c,null))[_0xd7a8('0x52')](handleError(_0x52351c,null));};exports['getContacts']=function(_0x8b0931,_0x80121c,_0x1e3fd4){var _0x2a0a1a;return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0x8b0931['params']['id']},'include':[{'model':db[_0xd7a8('0x6d')],'as':_0xd7a8('0x6e')}]})['then'](handleEntityNotFound(_0x80121c,null))[_0xd7a8('0x2f')](function(_0x31f733){if(_0x31f733){_0x2a0a1a=_0x31f733;return db[_0xd7a8('0x6f')][_0xd7a8('0x38')];}})['then'](function(_0x29c9c6){if(_0x29c9c6){var _0x43dcb2={};var _0x2147c2={};_0x2147c2['model']=_['concat'](_[_0xd7a8('0x3c')](_0x29c9c6),_[_0xd7a8('0x37')](_0x2a0a1a[_0xd7a8('0x6e')],function(_0x3681a3){return util['format'](_0xd7a8('0x70'),_0x3681a3['id']);}));_0x2147c2[_0xd7a8('0x3b')]=_[_0xd7a8('0x3c')](_0x8b0931[_0xd7a8('0x3b')]);_0x2147c2['filters']=_[_0xd7a8('0x3f')](_0x2147c2[_0xd7a8('0x3d')],_0x2147c2[_0xd7a8('0x3b')]);_0x43dcb2[_0xd7a8('0x3e')]=_[_0xd7a8('0x3f')](_0x2147c2[_0xd7a8('0x3d')],qs[_0xd7a8('0x40')](_0x8b0931[_0xd7a8('0x3b')][_0xd7a8('0x40')]));_0x43dcb2[_0xd7a8('0x3e')]=_0x43dcb2[_0xd7a8('0x3e')][_0xd7a8('0x41')]?_0x43dcb2[_0xd7a8('0x3e')]:_0x2147c2[_0xd7a8('0x3d')];if(!_0x8b0931['query'][_0xd7a8('0x42')]('nolimit')){_0x43dcb2['limit']=qs[_0xd7a8('0x25')](_0x8b0931[_0xd7a8('0x3b')]['limit']);_0x43dcb2[_0xd7a8('0x24')]=qs[_0xd7a8('0x24')](_0x8b0931[_0xd7a8('0x3b')][_0xd7a8('0x24')]);}_0x43dcb2[_0xd7a8('0x44')]=qs[_0xd7a8('0x45')](_0x8b0931[_0xd7a8('0x3b')][_0xd7a8('0x45')]);_0x43dcb2[_0xd7a8('0x46')]=qs[_0xd7a8('0x47')](_[_0xd7a8('0x48')](_0x8b0931[_0xd7a8('0x3b')],_0x2147c2['filters']));_0x43dcb2[_0xd7a8('0x71')]=!![];if(_0x8b0931[_0xd7a8('0x3b')][_0xd7a8('0x49')]){_0x43dcb2[_0xd7a8('0x46')]=_[_0xd7a8('0x4a')](_0x43dcb2[_0xd7a8('0x46')],{'$or':_['map'](_0x43dcb2[_0xd7a8('0x3e')],function(_0x1ea595){var _0xd0f993={};_0xd0f993[_0x1ea595]={'$like':'%'+_0x8b0931[_0xd7a8('0x3b')][_0xd7a8('0x49')]+'%'};return _0xd0f993;})});}_0x43dcb2=_['merge']({},_0x43dcb2,_0x8b0931[_0xd7a8('0x4c')]);return _0x2a0a1a[_0xd7a8('0x72')](_0x43dcb2);}})[_0xd7a8('0x2f')](respondWithResult(_0x80121c,null))[_0xd7a8('0x52')](handleError(_0x80121c,null));};exports[_0xd7a8('0x73')]=function(_0x4f0c42,_0x441ba9,_0x28b024){var _0x32e09e;var _0x27cc9e;var _0x297a75;var _0x49aefa=_0x4f0c42['params']['id'];csv_results=[];return db['ContactItemType'][_0xd7a8('0x50')]({'attributes':['id',_0xd7a8('0x35')],'raw':!![],'order':['OrderBy']})[_0xd7a8('0x2f')](function(_0x52f019){_0x32e09e=_0x52f019;var _0x2be92d=_[_0xd7a8('0x3c')](db['CmContact'][_0xd7a8('0x38')]);return db[_0xd7a8('0x6d')][_0xd7a8('0x50')]({'raw':!![],'attributes':['id',_0xd7a8('0x74')]})['then'](function(_0x5b4bdc){_0x27cc9e=_0x5b4bdc;var _0x5cf299=squel['select']()[_0xd7a8('0x40')](_0x2be92d)['from'](_0xd7a8('0x75'),'c')[_0xd7a8('0x46')]('c.ListId\x20=\x20?',_0x49aefa)[_0xd7a8('0x46')]('c.deletedAt\x20is\x20null')[_0xd7a8('0x76')]();for(var _0x2c175c=0x0;_0x2c175c<_0x27cc9e[_0xd7a8('0x41')];_0x2c175c++){_0x5cf299[_0xd7a8('0x77')](_0xd7a8('0x78')+_0x27cc9e[_0x2c175c]['id'],_0xd7a8('0x79')+_0x27cc9e[_0x2c175c][_0xd7a8('0x74')]);}for(var _0x2c175c=0x0;_0x2c175c<_0x32e09e['length'];_0x2c175c++){_0x5cf299[_0xd7a8('0x77')](squel[_0xd7a8('0x7a')]()[_0xd7a8('0x77')](_0xd7a8('0x7b'))[_0xd7a8('0x7c')](_0xd7a8('0x7d'))[_0xd7a8('0x46')](_0xd7a8('0x7e'),_0x32e09e[_0x2c175c]['id'])[_0xd7a8('0x46')]('CmContactId\x20=\x20c.id'),'additionalPhone_'+_0x32e09e[_0x2c175c][_0xd7a8('0x35')]);_0x5cf299['field'](squel[_0xd7a8('0x7a')]()['field'](_0xd7a8('0x7f'))[_0xd7a8('0x7c')](_0xd7a8('0x7d'))[_0xd7a8('0x46')]('ItemTypeId\x20=\x20?',_0x32e09e[_0x2c175c]['id'])[_0xd7a8('0x46')](_0xd7a8('0x80')),_0xd7a8('0x81')+_0x32e09e[_0x2c175c][_0xd7a8('0x35')]);}var _0x4ac24b=[];_0x4ac24b[_0xd7a8('0x67')](_0x5cf299[_0xd7a8('0x82')]());BPromise['each'](_0x4ac24b,handleQuery)[_0xd7a8('0x2f')](function(_0xcac1f3){handleQuery(_0x5cf299[_0xd7a8('0x82')]());var _0x421dbe=csv_results[0x0];if(!_['isEmpty'](_0x421dbe)){var _0x948c16=toCsv(_0x421dbe);var _0x2db9ce=Date[_0xd7a8('0x83')]();fs[_0xd7a8('0x84')](util[_0xd7a8('0x85')](_0xd7a8('0x86'),_0x49aefa,_0x2db9ce),_0x948c16);_0x441ba9[_0xd7a8('0x87')](_0xd7a8('0x88'),'attachment;\x20filename='+util['format'](_0xd7a8('0x89'),_0x49aefa,_0x2db9ce));_0x441ba9[_0xd7a8('0x87')]('Content-type',_0xd7a8('0x8a'));return _0x441ba9[_0xd7a8('0x8b')](util['format'](_0xd7a8('0x86'),_0x49aefa,_0x2db9ce));}else{return _0x441ba9[_0xd7a8('0x21')](0xcc);}});});});};exports[_0xd7a8('0x8c')]=function(_0x53289c,_0x2f14f1,_0x5621ce){var _0x5a425f;delete _0x53289c[_0xd7a8('0x55')]['id'];return db['CmList'][_0xd7a8('0x61')]({'where':{'id':_0x53289c[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x2f14f1,null))[_0xd7a8('0x2f')](function(_0xb1df09){if(_0xb1df09){return db[_0xd7a8('0x8d')][_0xd7a8('0x8e')](function(_0x3f14fe){return db[_0xd7a8('0x6d')][_0xd7a8('0x54')](_0x53289c['body'],{'transaction':_0x3f14fe})['then'](function(_0x8ecf6b){_0x5a425f=_0x8ecf6b;return _0xb1df09[_0xd7a8('0x8f')](_0x8ecf6b,{'transaction':_0x3f14fe});})[_0xd7a8('0x2f')](function(){var _0x42e60e={'type':db[_0xd7a8('0x90')][_0xd7a8('0x91')],'transaction':_0x3f14fe};switch(_0x53289c['body'][_0xd7a8('0x39')]){case _0xd7a8('0x92'):_0x42e60e['type']=db['Sequelize'][_0xd7a8('0x91')];break;case _0xd7a8('0x93'):_0x42e60e[_0xd7a8('0x39')]=db[_0xd7a8('0x90')][_0xd7a8('0x94')];break;case _0xd7a8('0x95'):_0x42e60e['type']=db[_0xd7a8('0x90')][_0xd7a8('0x96')];_0x42e60e[_0xd7a8('0x97')]=![];break;default:}return db[_0xd7a8('0x8d')]['queryInterface'][_0xd7a8('0x98')](_0xd7a8('0x75'),util[_0xd7a8('0x85')](_0xd7a8('0x99'),_0x5a425f['id']),_0x42e60e);})[_0xd7a8('0x2f')](function(){return _0x5a425f;});});}})[_0xd7a8('0x2f')](respondWithResult(_0x2f14f1,null))[_0xd7a8('0x52')](handleError(_0x2f14f1,null));};exports['getCustomFields']=function(_0xdbadc1,_0x218718,_0x4b4a03){var _0xfdba74={};var _0x10d943={};var _0x1f33af;var _0x2daeed;return db[_0xd7a8('0x4d')]['findOne']({'where':{'id':_0xdbadc1[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x218718,null))[_0xd7a8('0x2f')](function(_0x3f0f17){if(_0x3f0f17){_0x1f33af=_0x3f0f17;_0x10d943['model']=_[_0xd7a8('0x3c')](db[_0xd7a8('0x6d')][_0xd7a8('0x38')]);_0x10d943['query']=_[_0xd7a8('0x3c')](_0xdbadc1[_0xd7a8('0x3b')]);_0x10d943['filters']=_['intersection'](_0x10d943[_0xd7a8('0x3d')],_0x10d943[_0xd7a8('0x3b')]);_0xfdba74[_0xd7a8('0x3e')]=_['intersection'](_0x10d943[_0xd7a8('0x3d')],qs[_0xd7a8('0x40')](_0xdbadc1[_0xd7a8('0x3b')][_0xd7a8('0x40')]));_0xfdba74['attributes']=_0xfdba74[_0xd7a8('0x3e')][_0xd7a8('0x41')]?_0xfdba74[_0xd7a8('0x3e')]:_0x10d943[_0xd7a8('0x3d')];_0xfdba74['order']=qs['sort'](_0xdbadc1[_0xd7a8('0x3b')]['sort']);_0xfdba74[_0xd7a8('0x46')]=qs[_0xd7a8('0x47')](_['pick'](_0xdbadc1[_0xd7a8('0x3b')],_0x10d943[_0xd7a8('0x47')]));_0xfdba74[_0xd7a8('0x46')]=_['merge'](_0xfdba74['where'],{'$or':[{'ListId':_0x3f0f17['id']},{'ListId':null}]});if(_0xdbadc1['query'][_0xd7a8('0x49')]){_0xfdba74[_0xd7a8('0x46')]=_[_0xd7a8('0x4a')](_0xfdba74[_0xd7a8('0x46')],{'$or':_[_0xd7a8('0x37')](_0xfdba74[_0xd7a8('0x3e')],function(_0x18921b){var _0x4b97b8={};_0x4b97b8[_0x18921b]={'$like':'%'+_0xdbadc1['query'][_0xd7a8('0x49')]+'%'};return _0x4b97b8;})});}_0xfdba74=_['merge']({},_0xfdba74,_0xdbadc1['options']);return db[_0xd7a8('0x6d')][_0xd7a8('0x9a')](_0xfdba74);}})[_0xd7a8('0x2f')](respondWithResult(_0x218718,null))[_0xd7a8('0x52')](handleError(_0x218718,null));};exports[_0xd7a8('0x9b')]=function(_0xe78f58,_0x104283){return db[_0xd7a8('0x6d')][_0xd7a8('0x9a')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x104283,null))[_0xd7a8('0x2f')](function(_0x2c41b7){return _0x2c41b7;})[_0xd7a8('0x2f')](respondWithResult(_0x104283,null))[_0xd7a8('0x52')](handleError(_0x104283,null));};exports[_0xd7a8('0x9c')]=function(_0x4136b8,_0x46579e,_0x2de9c5){return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0x4136b8['params']['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x46579e,null))[_0xd7a8('0x2f')](function(_0x147431){if(_0x147431){return _0x147431[_0xd7a8('0x9c')](_0x4136b8['body']['ids'],_[_0xd7a8('0x68')](_0x4136b8[_0xd7a8('0x55')],[_0xd7a8('0x63'),'id'])||{})['spread'](function(_0x26c16d){for(var _0x31c6d3=0x0;_0x31c6d3<_0x4136b8['body'][_0xd7a8('0x63')][_0xd7a8('0x41')];_0x31c6d3+=0x1){socket[_0xd7a8('0x9d')](_0xd7a8('0x9e'),{'UserId':Number(_0x4136b8[_0xd7a8('0x55')][_0xd7a8('0x63')][_0x31c6d3]),'CmListId':Number(_0x4136b8[_0xd7a8('0x5c')]['id'])});}return _0x26c16d;});}})[_0xd7a8('0x2f')](respondWithResult(_0x46579e,null))[_0xd7a8('0x52')](handleError(_0x46579e,null));};exports[_0xd7a8('0x9f')]=function(_0x13b1e4,_0x498eec,_0x57bc91){return db[_0xd7a8('0x4d')][_0xd7a8('0x53')]({'where':{'id':_0x13b1e4['params']['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x498eec,null))[_0xd7a8('0x2f')](function(_0x32d361){if(_0x32d361){return _0x32d361['removeAgents'](_0x13b1e4['query'][_0xd7a8('0x63')])[_0xd7a8('0x2f')](function(){if(_[_0xd7a8('0x66')](_0x13b1e4[_0xd7a8('0x3b')][_0xd7a8('0x63')])){for(var _0x5516ce=0x0;_0x5516ce<_0x13b1e4[_0xd7a8('0x3b')]['ids'][_0xd7a8('0x41')];_0x5516ce+=0x1){socket[_0xd7a8('0x9d')](_0xd7a8('0xa0'),{'UserId':Number(_0x13b1e4[_0xd7a8('0x3b')]['ids'][_0x5516ce]),'CmListId':Number(_0x13b1e4[_0xd7a8('0x5c')]['id'])});}}else{socket[_0xd7a8('0x9d')](_0xd7a8('0xa0'),{'UserId':Number(_0x13b1e4['query']['ids']),'CmListId':Number(_0x13b1e4['params']['id'])});}});}})[_0xd7a8('0x2f')](respondWithStatusCode(_0x498eec,null))[_0xd7a8('0x52')](handleError(_0x498eec,null));};exports[_0xd7a8('0xa1')]=function(_0x2bdba1,_0x4b9795,_0x5d0c8b){var _0x1f61b3={};var _0x3aa147={};var _0xde480d;var _0x29296e;return db[_0xd7a8('0x4d')]['findOne']({'where':{'id':_0x2bdba1[_0xd7a8('0x5c')]['id']}})[_0xd7a8('0x2f')](handleEntityNotFound(_0x4b9795,null))[_0xd7a8('0x2f')](function(_0x4ec72d){if(_0x4ec72d){_0xde480d=_0x4ec72d;_0x3aa147['model']=_[_0xd7a8('0x3c')](db[_0xd7a8('0xa2')][_0xd7a8('0x38')]);_0x3aa147[_0xd7a8('0x3b')]=_[_0xd7a8('0x3c')](_0x2bdba1['query']);_0x3aa147[_0xd7a8('0x47')]=_[_0xd7a8('0x3f')](_0x3aa147['model'],_0x3aa147['query']);_0x1f61b3[_0xd7a8('0x3e')]=_['intersection'](_0x3aa147[_0xd7a8('0x3d')],qs[_0xd7a8('0x40')](_0x2bdba1['query'][_0xd7a8('0x40')]));_0x1f61b3['attributes']=_0x1f61b3[_0xd7a8('0x3e')][_0xd7a8('0x41')]?_0x1f61b3[_0xd7a8('0x3e')]:_0x3aa147['model'];_0x1f61b3[_0xd7a8('0x44')]=qs[_0xd7a8('0x45')](_0x2bdba1[_0xd7a8('0x3b')]['sort']);_0x1f61b3[_0xd7a8('0x46')]=qs['filters'](_['pick'](_0x2bdba1[_0xd7a8('0x3b')],_0x3aa147[_0xd7a8('0x47')]));if(_0x2bdba1[_0xd7a8('0x3b')]['filter']){_0x1f61b3[_0xd7a8('0x46')]=_['merge'](_0x1f61b3[_0xd7a8('0x46')],{'$or':_[_0xd7a8('0x37')](_0x1f61b3[_0xd7a8('0x3e')],function(_0x488b96){var _0x30f0e3={};_0x30f0e3[_0x488b96]={'$like':'%'+_0x2bdba1['query'][_0xd7a8('0x49')]+'%'};return _0x30f0e3;})});}_0x1f61b3=_[_0xd7a8('0x4a')]({},_0x1f61b3,_0x2bdba1['options']);return _0xde480d['getAgents'](_0x1f61b3);}})[_0xd7a8('0x2f')](function(_0x4f5f17){if(_0x4f5f17){_0x29296e=_0x4f5f17[_0xd7a8('0x41')];if(!_0x2bdba1['query'][_0xd7a8('0x42')]('nolimit')){_0x1f61b3[_0xd7a8('0x25')]=qs['limit'](_0x2bdba1[_0xd7a8('0x3b')][_0xd7a8('0x25')]);_0x1f61b3[_0xd7a8('0x24')]=qs['offset'](_0x2bdba1[_0xd7a8('0x3b')][_0xd7a8('0x24')]);}return _0xde480d['getAgents'](_0x1f61b3);}})[_0xd7a8('0x2f')](function(_0x4e3718){if(_0x4e3718){return _0x4e3718?{'count':_0x29296e,'rows':_0x4e3718}:null;}})[_0xd7a8('0x2f')](respondWithResult(_0x4b9795,null))[_0xd7a8('0x52')](handleError(_0x4b9795,null));};function handleQuery(_0x49384d){logger['info'](_0x49384d);return db[_0xd7a8('0x8d')]['query'](_0x49384d)['spread'](function(_0x66009c){csv_results[_0xd7a8('0x67')](_0x66009c);})['catch'](function(_0x1a99ea){logger[_0xd7a8('0x33')](_0x1a99ea[_0xd7a8('0xa3')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6856cda..a9264be 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 _0x326f=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x326f,0xd1));var _0xf326=function(_0x4ac0f8,_0x30088c){_0x4ac0f8=_0x4ac0f8-0x0;var _0x5a5af4=_0x326f[_0x4ac0f8];return _0x5a5af4;};'use strict';var EventEmitter=require(_0xf326('0x0'));var CmList=require('../../mysqldb')['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0xf326('0x1')](0x0);var events={'afterCreate':_0xf326('0x2'),'afterUpdate':_0xf326('0x3'),'afterDestroy':_0xf326('0x4')};function emitEvent(_0x27e8d7){return function(_0x120a26,_0x9445c6,_0xf1c243){CmListEvents[_0xf326('0x5')](_0x27e8d7+':'+_0x120a26['id'],_0x120a26);CmListEvents[_0xf326('0x5')](_0x27e8d7,_0x120a26);_0xf1c243(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xf326('0x6')](e,emitEvent(event));}}module[_0xf326('0x7')]=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x126bd2,_0x2bab5b){var _0x3b806b=function(_0x9c2f74){while(--_0x9c2f74){_0x126bd2['push'](_0x126bd2['shift']());}};_0x3b806b(++_0x2bab5b);}(_0x814b,0x1a2));var _0xb814=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x814b[_0x2ad1b8];return _0x52547d;};'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 b9efd98..e888c44 100644 --- a/server/api/cmList/cmList.model.js +++ b/server/api/cmList/cmList.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','../../config/logger','api'];(function(_0x192dc1,_0x17efe9){var _0xf869a2=function(_0x4c074f){while(--_0x4c074f){_0x192dc1['push'](_0x192dc1['shift']());}};_0xf869a2(++_0x17efe9);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3c81=['moment','../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','api'];(function(_0x54d42e,_0x155b8d){var _0x17ebf0=function(_0x50ebc3){while(--_0x50ebc3){_0x54d42e['push'](_0x54d42e['shift']());}};_0x17ebf0(++_0x155b8d);}(_0x3c81,0x102));var _0x13c8=function(_0x1378ec,_0x27e9ea){_0x1378ec=_0x1378ec-0x0;var _0x34319c=_0x3c81[_0x1378ec];return _0x34319c;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var logger=require('../../config/logger')(_0x13c8('0x2'));var moment=require(_0x13c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x13c8('0x4'));var attributes=require(_0x13c8('0x5'));module[_0x13c8('0x6')]=function(_0x1c16f1,_0x2a4d66){return _0x1c16f1[_0x13c8('0x7')](_0x13c8('0x8'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index a986ca8..b8722e8 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 _0x5b76=['lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch'];(function(_0x352b43,_0x290f58){var _0x1fcad9=function(_0x5d3865){while(--_0x5d3865){_0x352b43['push'](_0x352b43['shift']());}};_0x1fcad9(++_0x290f58);}(_0x5b76,0x16c));var _0x65b7=function(_0x22d2fa,_0x363807){_0x22d2fa=_0x22d2fa-0x0;var _0x539fac=_0x5b76[_0x22d2fa];return _0x539fac;};'use strict';var _=require(_0x65b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x65b7('0x1'));var fs=require('fs');var Redis=require(_0x65b7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x65b7('0x3'));var logger=require(_0x65b7('0x4'))(_0x65b7('0x5'));var config=require(_0x65b7('0x6'));var jayson=require(_0x65b7('0x7'));var client=jayson[_0x65b7('0x8')][_0x65b7('0x9')]({'port':0x232a});config[_0x65b7('0xa')]=_[_0x65b7('0xb')](config[_0x65b7('0xa')],{'host':_0x65b7('0xc'),'port':0x18eb});var socket=require(_0x65b7('0xd'))(new Redis(config[_0x65b7('0xa')]));require(_0x65b7('0xe'))[_0x65b7('0xf')](socket);function respondWithRpcPromise(_0x35413f,_0x489967,_0x47f296){return new BPromise(function(_0xb34322,_0xa56bc1){return client[_0x65b7('0x10')](_0x35413f,_0x47f296)['then'](function(_0x277e41){logger[_0x65b7('0x11')](_0x65b7('0x12'),_0x489967,'request\x20sent');logger['debug'](_0x65b7('0x13'),_0x489967,_0x65b7('0x14'),JSON['stringify'](_0x277e41));if(_0x277e41['error']){if(_0x277e41['error'][_0x65b7('0x15')]===0x1f4){logger['error'](_0x65b7('0x12'),_0x489967,_0x277e41[_0x65b7('0x16')][_0x65b7('0x17')]);return _0xa56bc1(_0x277e41[_0x65b7('0x16')]['message']);}logger['error'](_0x65b7('0x12'),_0x489967,_0x277e41[_0x65b7('0x16')][_0x65b7('0x17')]);return _0xb34322(_0x277e41[_0x65b7('0x16')]['message']);}else{logger[_0x65b7('0x11')](_0x65b7('0x12'),_0x489967,_0x65b7('0x14'));_0xb34322(_0x277e41[_0x65b7('0x18')][_0x65b7('0x17')]);}})[_0x65b7('0x19')](function(_0x28a248){logger[_0x65b7('0x16')](_0x65b7('0x12'),_0x489967,_0x28a248);_0xa56bc1(_0x28a248);});});} \ No newline at end of file +var _0xbdf0=['../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','register','request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','ioredis','../../config/utils'];(function(_0x285720,_0x3711b1){var _0x18b66a=function(_0x175e51){while(--_0x175e51){_0x285720['push'](_0x285720['shift']());}};_0x18b66a(++_0x3711b1);}(_0xbdf0,0xd8));var _0x0bdf=function(_0x3fe4b5,_0x2b167e){_0x3fe4b5=_0x3fe4b5-0x0;var _0xde0f13=_0xbdf0[_0x3fe4b5];return _0xde0f13;};'use strict';var _=require(_0x0bdf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0bdf('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bdf('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bdf('0x3'));var logger=require(_0x0bdf('0x4'))(_0x0bdf('0x5'));var config=require(_0x0bdf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0bdf('0x7')]['http']({'port':0x232a});config[_0x0bdf('0x8')]=_['defaults'](config[_0x0bdf('0x8')],{'host':_0x0bdf('0x9'),'port':0x18eb});var socket=require(_0x0bdf('0xa'))(new Redis(config[_0x0bdf('0x8')]));require('./cmList.socket')[_0x0bdf('0xb')](socket);function respondWithRpcPromise(_0x1c4a4a,_0x585cbb,_0x228ad9){return new BPromise(function(_0x72f7eb,_0x1741f0){return client[_0x0bdf('0xc')](_0x1c4a4a,_0x228ad9)['then'](function(_0x25644a){logger[_0x0bdf('0xd')](_0x0bdf('0xe'),_0x585cbb,_0x0bdf('0xf'));logger[_0x0bdf('0x10')](_0x0bdf('0x11'),_0x585cbb,'request\x20sent',JSON['stringify'](_0x25644a));if(_0x25644a[_0x0bdf('0x12')]){if(_0x25644a[_0x0bdf('0x12')]['code']===0x1f4){logger[_0x0bdf('0x12')](_0x0bdf('0xe'),_0x585cbb,_0x25644a['error'][_0x0bdf('0x13')]);return _0x1741f0(_0x25644a[_0x0bdf('0x12')]['message']);}logger[_0x0bdf('0x12')](_0x0bdf('0xe'),_0x585cbb,_0x25644a[_0x0bdf('0x12')][_0x0bdf('0x13')]);return _0x72f7eb(_0x25644a[_0x0bdf('0x12')]['message']);}else{logger[_0x0bdf('0xd')](_0x0bdf('0xe'),_0x585cbb,_0x0bdf('0xf'));_0x72f7eb(_0x25644a[_0x0bdf('0x14')][_0x0bdf('0x13')]);}})[_0x0bdf('0x15')](function(_0x186617){logger['error'](_0x0bdf('0xe'),_0x585cbb,_0x186617);_0x1741f0(_0x186617);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 942e83b..edf00c7 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 _0xde0d=['length','cmList:','remove','removeListener','register'];(function(_0x3b53ab,_0xdada1b){var _0x58afc4=function(_0x4ef163){while(--_0x4ef163){_0x3b53ab['push'](_0x3b53ab['shift']());}};_0x58afc4(++_0xdada1b);}(_0xde0d,0x147));var _0xdde0=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xde0d[_0x4a0e68];return _0x4fb274;};'use strict';var CmListEvents=require('./cmList.events');var events=['save',_0xdde0('0x0'),'update'];function createListener(_0x3cd145,_0xba9745){return function(_0x11ae8f){_0xba9745['emit'](_0x3cd145,_0x11ae8f);};}function removeListener(_0x113d13,_0x241d40){return function(){CmListEvents[_0xdde0('0x1')](_0x113d13,_0x241d40);};}exports[_0xdde0('0x2')]=function(_0x1efb1d){for(var _0x1348d9=0x0,_0x3f1118=events[_0xdde0('0x3')];_0x1348d9<_0x3f1118;_0x1348d9++){var _0x2a59d8=events[_0x1348d9];var _0x89ba27=createListener(_0xdde0('0x4')+_0x2a59d8,_0x1efb1d);CmListEvents['on'](_0x2a59d8,_0x89ba27);}}; \ No newline at end of file +var _0xb09a=['emit','length','save','remove'];(function(_0x25fd31,_0x19372e){var _0x531147=function(_0x22f049){while(--_0x22f049){_0x25fd31['push'](_0x25fd31['shift']());}};_0x531147(++_0x19372e);}(_0xb09a,0x10e));var _0xab09=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xb09a[_0x589aee];return _0x2f5ed4;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xab09('0x0'),_0xab09('0x1'),'update'];function createListener(_0x3c5629,_0x19c3b6){return function(_0x4879ae){_0x19c3b6[_0xab09('0x2')](_0x3c5629,_0x4879ae);};}function removeListener(_0x442018,_0xd24bbd){return function(){CmListEvents['removeListener'](_0x442018,_0xd24bbd);};}exports['register']=function(_0x3fa1fe){for(var _0x280096=0x0,_0x27761e=events[_0xab09('0x3')];_0x280096<_0x27761e;_0x280096++){var _0x50e8de=events[_0x280096];var _0x4acb6d=createListener('cmList:'+_0x50e8de,_0x3fa1fe);CmListEvents['on'](_0x50e8de,_0x4acb6d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 42b8598..07a96c6 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 _0xb790=['/:id','update','delete','destroy','removeAgents','util','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','create','post','addDisposition','addCustomField','/:id/users','addAgents','put'];(function(_0x1fd973,_0x47e406){var _0x19fed6=function(_0x19e8b0){while(--_0x19e8b0){_0x1fd973['push'](_0x1fd973['shift']());}};_0x19fed6(++_0x47e406);}(_0xb790,0xe5));var _0x0b79=function(_0x5ea797,_0x2d39dd){_0x5ea797=_0x5ea797-0x0;var _0x500783=_0xb790[_0x5ea797];return _0x500783;};'use strict';var multer=require('multer');var util=require(_0x0b79('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0b79('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0b79('0x2'));var config=require(_0x0b79('0x3'));var controller=require('./cmList.controller');router[_0x0b79('0x4')]('/',auth[_0x0b79('0x5')](),controller[_0x0b79('0x6')]);router[_0x0b79('0x4')](_0x0b79('0x7'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x8')]);router[_0x0b79('0x4')](_0x0b79('0x9'),auth[_0x0b79('0x5')](),controller[_0x0b79('0xa')]);router[_0x0b79('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x0b79('0xb')]);router[_0x0b79('0x4')](_0x0b79('0xc'),auth[_0x0b79('0x5')](),controller[_0x0b79('0xd')]);router['get'](_0x0b79('0xe'),auth[_0x0b79('0x5')](),controller['getContacts']);router[_0x0b79('0x4')](_0x0b79('0xf'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x10')]);router['get'](_0x0b79('0x11'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x12')]);router[_0x0b79('0x4')]('/:id/users',auth[_0x0b79('0x5')](),controller[_0x0b79('0x13')]);router['post']('/',auth[_0x0b79('0x5')](),controller[_0x0b79('0x14')]);router[_0x0b79('0x15')](_0x0b79('0xc'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x16')]);router[_0x0b79('0x15')](_0x0b79('0xe'),auth['isAuthenticated'](),controller['addContacts']);router['post'](_0x0b79('0x11'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x17')]);router['post'](_0x0b79('0x18'),auth['isAuthenticated'](),controller[_0x0b79('0x19')]);router[_0x0b79('0x1a')](_0x0b79('0x1b'),auth['isAuthenticated'](),controller[_0x0b79('0x1c')]);router[_0x0b79('0x1d')](_0x0b79('0x1b'),auth['isAuthenticated'](),controller[_0x0b79('0x1e')]);router['delete']('/:id/dispositions',auth[_0x0b79('0x5')](),controller['removeDispositions']);router[_0x0b79('0x1d')](_0x0b79('0x18'),auth[_0x0b79('0x5')](),controller[_0x0b79('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x99e9=['get','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','create','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','isAuthenticated','index'];(function(_0x254f31,_0x141d44){var _0x50c871=function(_0x90f5ef){while(--_0x90f5ef){_0x254f31['push'](_0x254f31['shift']());}};_0x50c871(++_0x141d44);}(_0x99e9,0xb4));var _0x999e=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x99e9[_0x459423];return _0x42ed14;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xa')](_0x999e('0xf'),auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0xa')](_0x999e('0x11'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0xa')](_0x999e('0x13'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);router['get'](_0x999e('0x15'),auth['isAuthenticated'](),controller[_0x999e('0x16')]);router[_0x999e('0xa')](_0x999e('0x17'),auth['isAuthenticated'](),controller[_0x999e('0x18')]);router['get'](_0x999e('0x19'),auth['isAuthenticated'](),controller['getAgents']);router[_0x999e('0x1a')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x1b')]);router[_0x999e('0x1a')](_0x999e('0x11'),auth[_0x999e('0x8')](),controller['addDisposition']);router['post']('/:id/contacts',auth[_0x999e('0x8')](),controller[_0x999e('0x1c')]);router[_0x999e('0x1a')](_0x999e('0x17'),auth[_0x999e('0x8')](),controller[_0x999e('0x1d')]);router['post']('/:id/users',auth[_0x999e('0x8')](),controller[_0x999e('0x1e')]);router[_0x999e('0x1f')]('/:id',auth[_0x999e('0x8')](),controller[_0x999e('0x20')]);router[_0x999e('0x21')](_0x999e('0xf'),auth[_0x999e('0x8')](),controller[_0x999e('0x22')]);router[_0x999e('0x21')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x999e('0x23')]);router[_0x999e('0x21')]('/:id/users',auth[_0x999e('0x8')](),controller[_0x999e('0x24')]);module[_0x999e('0x25')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 5d71784..e3d6d1f 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 _0x8ebf=['sequelize','exports','STRING'];(function(_0xe576b7,_0x1771a3){var _0x575b90=function(_0x5634cc){while(--_0x5634cc){_0xe576b7['push'](_0xe576b7['shift']());}};_0x575b90(++_0x1771a3);}(_0x8ebf,0x1bc));var _0xf8eb=function(_0x124f88,_0x3ad501){_0x124f88=_0x124f88-0x0;var _0xed0e3b=_0x8ebf[_0x124f88];return _0xed0e3b;};'use strict';var Sequelize=require(_0xf8eb('0x0'));module[_0xf8eb('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5c8d64){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0xf8eb('0x2')],'allowNull':![]},'operator':{'type':Sequelize[_0xf8eb('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xf8eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2eb4=['getDataValue','STRING','sequelize','exports','VIRTUAL'];(function(_0x1e3923,_0x477ce9){var _0x36cd0f=function(_0x48e77d){while(--_0x48e77d){_0x1e3923['push'](_0x1e3923['shift']());}};_0x36cd0f(++_0x477ce9);}(_0x2eb4,0xcf));var _0x42eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2eb4[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x42eb('0x0'));module[_0x42eb('0x1')]={'name':{'type':Sequelize[_0x42eb('0x2')],'get':function(_0x4e96d2){return this[_0x42eb('0x3')]('field');}},'field':{'type':Sequelize[_0x42eb('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0x42eb('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x42eb('0x4')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index e90d8bb..a85ede1 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(_0x545ccf,_0x4e546d){var _0x388d7c=function(_0x39c589){while(--_0x39c589){_0x545ccf['push'](_0x545ccf['shift']());}};_0x388d7c(++_0x4e546d);}(_0x7a54,0x106));var _0x47a5=function(_0x223eb5,_0x24d5cf){_0x223eb5=_0x223eb5-0x0;var _0x2c4a0f=_0x7a54[_0x223eb5];return _0x2c4a0f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x5e247e,_0x292285){var _0x32d36c=function(_0x4be20c){while(--_0x4be20c){_0x5e247e['push'](_0x5e247e['shift']());}};_0x32d36c(++_0x292285);}(_0x7a54,0x106));var _0x47a5=function(_0x3dfc7a,_0x5c3c51){_0x3dfc7a=_0x3dfc7a-0x0;var _0x3940ee=_0x7a54[_0x3dfc7a];return _0x3940ee;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 9a53455..3d8951f 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 _0x13e5=['moment','bluebird','request-promise','path','../../config/environment','./condition.attributes','define','Condition','tools_conditions','../../config/logger','api'];(function(_0x971797,_0x14ac98){var _0x504341=function(_0x34f271){while(--_0x34f271){_0x971797['push'](_0x971797['shift']());}};_0x504341(++_0x14ac98);}(_0x13e5,0x77));var _0x513e=function(_0x57cc22,_0x2d351f){_0x57cc22=_0x57cc22-0x0;var _0x6f7bdc=_0x13e5[_0x57cc22];return _0x6f7bdc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x513e('0x0'))(_0x513e('0x1'));var moment=require(_0x513e('0x2'));var BPromise=require(_0x513e('0x3'));var rp=require(_0x513e('0x4'));var fs=require('fs');var path=require(_0x513e('0x5'));var rimraf=require('rimraf');var config=require(_0x513e('0x6'));var attributes=require(_0x513e('0x7'));module['exports']=function(_0x27c3c7,_0x203f16){return _0x27c3c7[_0x513e('0x8')](_0x513e('0x9'),attributes,{'tableName':_0x513e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5c4a=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','lodash','../../config/logger','api','moment'];(function(_0x437339,_0x5ef32b){var _0x3b4c70=function(_0x227cab){while(--_0x227cab){_0x437339['push'](_0x437339['shift']());}};_0x3b4c70(++_0x5ef32b);}(_0x5c4a,0x8b));var _0xa5c4=function(_0x193dc2,_0x2892e8){_0x193dc2=_0x193dc2-0x0;var _0x10e507=_0x5c4a[_0x193dc2];return _0x10e507;};'use strict';var _=require(_0xa5c4('0x0'));var util=require('util');var logger=require(_0xa5c4('0x1'))(_0xa5c4('0x2'));var moment=require(_0xa5c4('0x3'));var BPromise=require(_0xa5c4('0x4'));var rp=require(_0xa5c4('0x5'));var fs=require('fs');var path=require(_0xa5c4('0x6'));var rimraf=require(_0xa5c4('0x7'));var config=require(_0xa5c4('0x8'));var attributes=require(_0xa5c4('0x9'));module[_0xa5c4('0xa')]=function(_0x2b5674,_0x59182e){return _0x2b5674[_0xa5c4('0xb')]('Condition',attributes,{'tableName':_0xa5c4('0xc'),'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 1ec3787..4a8fe0d 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 _0x3993=['code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x3993,0x17a));var _0x3399=function(_0x394091,_0x1776c8){_0x394091=_0x394091-0x0;var _0x1c1c0d=_0x3993[_0x394091];return _0x1c1c0d;};'use strict';var _=require('lodash');var util=require(_0x3399('0x0'));var moment=require(_0x3399('0x1'));var BPromise=require(_0x3399('0x2'));var rs=require(_0x3399('0x3'));var fs=require('fs');var Redis=require(_0x3399('0x4'));var db=require(_0x3399('0x5'))['db'];var utils=require(_0x3399('0x6'));var logger=require(_0x3399('0x7'))(_0x3399('0x8'));var config=require('../../config/environment');var jayson=require(_0x3399('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e075d,_0x145934,_0x196f2d){return new BPromise(function(_0x57956e,_0x2d63f7){return client[_0x3399('0xa')](_0x3e075d,_0x196f2d)[_0x3399('0xb')](function(_0x1b9de2){logger[_0x3399('0xc')](_0x3399('0xd'),_0x145934,_0x3399('0xe'));logger[_0x3399('0xf')](_0x3399('0x10'),_0x145934,'request\x20sent',JSON['stringify'](_0x1b9de2));if(_0x1b9de2[_0x3399('0x11')]){if(_0x1b9de2[_0x3399('0x11')][_0x3399('0x12')]===0x1f4){logger[_0x3399('0x11')]('Condition,\x20%s,\x20%s',_0x145934,_0x1b9de2[_0x3399('0x11')][_0x3399('0x13')]);return _0x2d63f7(_0x1b9de2[_0x3399('0x11')][_0x3399('0x13')]);}logger[_0x3399('0x11')]('Condition,\x20%s,\x20%s',_0x145934,_0x1b9de2[_0x3399('0x11')]['message']);return _0x57956e(_0x1b9de2['error'][_0x3399('0x13')]);}else{logger[_0x3399('0xc')]('Condition,\x20%s,\x20%s',_0x145934,_0x3399('0xe'));_0x57956e(_0x1b9de2[_0x3399('0x14')][_0x3399('0x13')]);}})[_0x3399('0x15')](function(_0x16fd03){logger[_0x3399('0x11')](_0x3399('0xd'),_0x145934,_0x16fd03);_0x2d63f7(_0x16fd03);});});} \ No newline at end of file +var _0xb72a=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','Condition,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x195f71,_0x40c2bd){var _0x3bb3bc=function(_0x4827fb){while(--_0x4827fb){_0x195f71['push'](_0x195f71['shift']());}};_0x3bb3bc(++_0x40c2bd);}(_0xb72a,0xcb));var _0xab72=function(_0x2a283f,_0x5a0b5b){_0x2a283f=_0x2a283f-0x0;var _0x5d5634=_0xb72a[_0x2a283f];return _0x5d5634;};'use strict';var _=require(_0xab72('0x0'));var util=require(_0xab72('0x1'));var moment=require(_0xab72('0x2'));var BPromise=require(_0xab72('0x3'));var rs=require(_0xab72('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab72('0x5'))['db'];var utils=require(_0xab72('0x6'));var logger=require(_0xab72('0x7'))(_0xab72('0x8'));var config=require(_0xab72('0x9'));var jayson=require(_0xab72('0xa'));var client=jayson[_0xab72('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x186d65,_0x213ecd,_0x45239d){return new BPromise(function(_0x69c3ff,_0x4a27bb){return client[_0xab72('0xc')](_0x186d65,_0x45239d)[_0xab72('0xd')](function(_0x12fec3){logger[_0xab72('0xe')]('Condition,\x20%s,\x20%s',_0x213ecd,_0xab72('0xf'));logger[_0xab72('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x213ecd,_0xab72('0xf'),JSON[_0xab72('0x11')](_0x12fec3));if(_0x12fec3[_0xab72('0x12')]){if(_0x12fec3[_0xab72('0x12')]['code']===0x1f4){logger[_0xab72('0x12')](_0xab72('0x13'),_0x213ecd,_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);return _0x4a27bb(_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);}logger['error']('Condition,\x20%s,\x20%s',_0x213ecd,_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);return _0x69c3ff(_0x12fec3[_0xab72('0x12')][_0xab72('0x14')]);}else{logger[_0xab72('0xe')](_0xab72('0x13'),_0x213ecd,_0xab72('0xf'));_0x69c3ff(_0x12fec3['result']['message']);}})['catch'](function(_0xea2fd7){logger[_0xab72('0x12')](_0xab72('0x13'),_0x213ecd,_0xea2fd7);_0x4a27bb(_0xea2fd7);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 0e64d4c..c6eaef4 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 _0x45fb=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','destroy','exports','util'];(function(_0x2fc4a9,_0x5706b8){var _0x4e15eb=function(_0x46a1d2){while(--_0x46a1d2){_0x2fc4a9['push'](_0x2fc4a9['shift']());}};_0x4e15eb(++_0x5706b8);}(_0x45fb,0x1e0));var _0xb45f=function(_0x4f2c67,_0x382e13){_0x4f2c67=_0x4f2c67-0x0;var _0x56f07c=_0x45fb[_0x4f2c67];return _0x56f07c;};'use strict';var multer=require('multer');var util=require(_0xb45f('0x0'));var path=require(_0xb45f('0x1'));var timeout=require(_0xb45f('0x2'));var express=require(_0xb45f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb45f('0x4'));var interaction=require(_0xb45f('0x5'));var config=require(_0xb45f('0x6'));var controller=require(_0xb45f('0x7'));router[_0xb45f('0x8')](_0xb45f('0x9'),auth['isAuthenticated'](),controller[_0xb45f('0xa')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xb45f('0xb')]);module[_0xb45f('0xc')]=router; \ No newline at end of file +var _0x0152=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','isAuthenticated','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x4f05b4,_0x571783){var _0xb965e9=function(_0x5cc78e){while(--_0x5cc78e){_0x4f05b4['push'](_0x4f05b4['shift']());}};_0xb965e9(++_0x571783);}(_0x0152,0x1c8));var _0x2015=function(_0x26987c,_0x20d1f1){_0x26987c=_0x26987c-0x0;var _0xb08105=_0x0152[_0x26987c];return _0xb08105;};'use strict';var multer=require(_0x2015('0x0'));var util=require('util');var path=require(_0x2015('0x1'));var timeout=require(_0x2015('0x2'));var express=require(_0x2015('0x3'));var router=express['Router']();var fs_extra=require(_0x2015('0x4'));var auth=require(_0x2015('0x5'));var interaction=require(_0x2015('0x6'));var config=require(_0x2015('0x7'));var controller=require(_0x2015('0x8'));router[_0x2015('0x9')](_0x2015('0xa'),auth['isAuthenticated'](),controller[_0x2015('0xb')]);router['delete'](_0x2015('0xa'),auth[_0x2015('0xc')](),controller[_0x2015('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 80f79a3..0a73877 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 _0xf304=['STRING','name','INTEGER','sequelize'];(function(_0x42d1f8,_0x22e529){var _0x40d234=function(_0xd59b57){while(--_0xd59b57){_0x42d1f8['push'](_0x42d1f8['shift']());}};_0x40d234(++_0x22e529);}(_0xf304,0x1eb));var _0x4f30=function(_0x3bc3b4,_0x5acff4){_0x3bc3b4=_0x3bc3b4-0x0;var _0x4c546b=_0xf304[_0x3bc3b4];return _0x4c546b;};'use strict';var Sequelize=require(_0x4f30('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f30('0x1')],'allowNull':![],'unique':_0x4f30('0x2')},'OrderBy':{'type':Sequelize[_0x4f30('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4f30('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x2054=['sequelize','exports','STRING','name','INTEGER'];(function(_0x2975fd,_0x268020){var _0x38c2b5=function(_0x389cc8){while(--_0x389cc8){_0x2975fd['push'](_0x2975fd['shift']());}};_0x38c2b5(++_0x268020);}(_0x2054,0x1b3));var _0x4205=function(_0x129102,_0x3ac9c9){_0x129102=_0x129102-0x0;var _0x346551=_0x2054[_0x129102];return _0x346551;};'use strict';var Sequelize=require(_0x4205('0x0'));module[_0x4205('0x1')]={'name':{'type':Sequelize[_0x4205('0x2')],'allowNull':![],'unique':_0x4205('0x3')},'OrderBy':{'type':Sequelize[_0x4205('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4205('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 6684154..beae94f 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 _0xefda=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','UserProfileResource','error','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','length','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x459ee0,_0x1e950d){var _0x1b87c8=function(_0x377855){while(--_0x377855){_0x459ee0['push'](_0x459ee0['shift']());}};_0x1b87c8(++_0x1e950d);}(_0xefda,0x96));var _0xaefd=function(_0x55d926,_0x5e90c4){_0x55d926=_0x55d926-0x0;var _0x419422=_0xefda[_0x55d926];return _0x419422;};'use strict';var emlformat=require(_0xaefd('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaefd('0x1'));var rp=require(_0xaefd('0x2'));var moment=require('moment');var BPromise=require(_0xaefd('0x3'));var Mustache=require(_0xaefd('0x4'));var util=require(_0xaefd('0x5'));var path=require(_0xaefd('0x6'));var sox=require(_0xaefd('0x7'));var csv=require(_0xaefd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaefd('0x9'));var _=require(_0xaefd('0xa'));var squel=require(_0xaefd('0xb'));var crypto=require(_0xaefd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xaefd('0xd'));var toCsv=require(_0xaefd('0x8'));var querystring=require(_0xaefd('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaefd('0xf'));var as=require(_0xaefd('0x10'));var hardwareService=require(_0xaefd('0x11'));var logger=require(_0xaefd('0x12'))(_0xaefd('0x13'));var utils=require(_0xaefd('0x14'));var config=require(_0xaefd('0x15'));var licenseUtil=require(_0xaefd('0x16'));var db=require(_0xaefd('0x17'))['db'];function respondWithStatusCode(_0x382983,_0x2a310c){_0x2a310c=_0x2a310c||0xcc;return function(_0x4b2b5c){if(_0x4b2b5c){return _0x382983[_0xaefd('0x18')](_0x2a310c);}return _0x382983['status'](_0x2a310c)[_0xaefd('0x19')]();};}function respondWithResult(_0x1725af,_0x9dfdf6){_0x9dfdf6=_0x9dfdf6||0xc8;return function(_0x43b82a){if(_0x43b82a){return _0x1725af['status'](_0x9dfdf6)[_0xaefd('0x1a')](_0x43b82a);}};}function respondWithFilteredResult(_0x13492c,_0x41f345){return function(_0x411701){if(_0x411701){var _0x10ee28=typeof _0x41f345[_0xaefd('0x1b')]===_0xaefd('0x1c')&&typeof _0x41f345[_0xaefd('0x1d')]==='undefined';var _0x9d9c29=_0x411701[_0xaefd('0x1e')];var _0x9748f4=_0x10ee28?0x0:_0x41f345[_0xaefd('0x1b')];var _0x2db61b=_0x10ee28?_0x411701[_0xaefd('0x1e')]:_0x41f345['offset']+_0x41f345[_0xaefd('0x1d')];var _0x182f9a;if(_0x2db61b>=_0x9d9c29){_0x2db61b=_0x9d9c29;_0x182f9a=0xc8;}else{_0x182f9a=0xce;}_0x13492c[_0xaefd('0x1f')](_0x182f9a);return _0x13492c[_0xaefd('0x20')](_0xaefd('0x21'),_0x9748f4+'-'+_0x2db61b+'/'+_0x9d9c29)[_0xaefd('0x1a')](_0x411701);}return null;};}function patchUpdates(_0x5282ed){return function(_0x463d48){try{jsonpatch[_0xaefd('0x22')](_0x463d48,_0x5282ed,!![]);}catch(_0x2dcdd8){return BPromise[_0xaefd('0x23')](_0x2dcdd8);}return _0x463d48[_0xaefd('0x24')]();};}function saveUpdates(_0x577fb7,_0x479486){return function(_0x5b9967){if(_0x5b9967){return _0x5b9967[_0xaefd('0x25')](_0x577fb7)[_0xaefd('0x26')](function(_0x313a6f){return _0x313a6f;});}return null;};}function removeEntity(_0x5a44ed,_0x23060f){return function(_0x4cd9b2){if(_0x4cd9b2){return _0x4cd9b2[_0xaefd('0x27')]()[_0xaefd('0x26')](function(){var _0x1a05eb=_0x4cd9b2['get']({'plain':!![]});var _0x435413=_0xaefd('0x28');return db[_0xaefd('0x29')][_0xaefd('0x27')]({'where':{'type':_0x435413,'resourceId':_0x1a05eb['id']}})[_0xaefd('0x26')](function(){return _0x4cd9b2;});})['then'](function(){_0x5a44ed[_0xaefd('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x810bf,_0x16f10f){return function(_0x5470bd){if(!_0x5470bd){_0x810bf[_0xaefd('0x18')](0x194);}return _0x5470bd;};}function handleError(_0x2a8fa8,_0x521839){_0x521839=_0x521839||0x1f4;return function(_0xbeb1b8){logger[_0xaefd('0x2a')](_0xbeb1b8[_0xaefd('0x2b')]);if(_0xbeb1b8['name']){delete _0xbeb1b8[_0xaefd('0x2c')];}_0x2a8fa8['status'](_0x521839)[_0xaefd('0x2d')](_0xbeb1b8);};}exports['index']=function(_0x4a1acb,_0x1d89c4){var _0x1b470c={},_0x4a032d={},_0x578378={'count':0x0,'rows':[]};var _0x4ee0c1=_[_0xaefd('0x2e')](db[_0xaefd('0x2f')]['rawAttributes'],function(_0x5503d0){return{'name':_0x5503d0[_0xaefd('0x30')],'type':_0x5503d0[_0xaefd('0x31')][_0xaefd('0x32')]};});_0x4a032d[_0xaefd('0x33')]=_['map'](_0x4ee0c1,_0xaefd('0x2c'));_0x4a032d[_0xaefd('0x34')]=_[_0xaefd('0x35')](_0x4a1acb[_0xaefd('0x34')]);_0x4a032d[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],_0x4a032d[_0xaefd('0x34')]);_0x1b470c[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x4a032d[_0xaefd('0x33')],qs[_0xaefd('0x39')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x39')]));_0x1b470c[_0xaefd('0x38')]=_0x1b470c[_0xaefd('0x38')]['length']?_0x1b470c[_0xaefd('0x38')]:_0x4a032d[_0xaefd('0x33')];if(!_0x4a1acb[_0xaefd('0x34')]['hasOwnProperty'](_0xaefd('0x3a'))){_0x1b470c['limit']=qs[_0xaefd('0x1d')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1d')]);_0x1b470c[_0xaefd('0x1b')]=qs[_0xaefd('0x1b')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x1b')]);}_0x1b470c[_0xaefd('0x3b')]=qs[_0xaefd('0x3c')](_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x3c')]);_0x1b470c[_0xaefd('0x3d')]=qs[_0xaefd('0x36')](_[_0xaefd('0x3e')](_0x4a1acb['query'],_0x4a032d[_0xaefd('0x36')]),_0x4ee0c1);if(_0x4a1acb['query'][_0xaefd('0x3f')]){_0x1b470c[_0xaefd('0x3d')]=_[_0xaefd('0x40')](_0x1b470c[_0xaefd('0x3d')],{'$or':_[_0xaefd('0x2e')](_0x4ee0c1,function(_0x3c9331){if(_0x3c9331[_0xaefd('0x31')]!==_0xaefd('0x41')){var _0x3c7022={};_0x3c7022[_0x3c9331[_0xaefd('0x2c')]]={'$like':'%'+_0x4a1acb['query'][_0xaefd('0x3f')]+'%'};return _0x3c7022;}})});}_0x1b470c=_[_0xaefd('0x40')]({},_0x1b470c,_0x4a1acb['options']);var _0x427f00={'where':_0x1b470c[_0xaefd('0x3d')]};return db[_0xaefd('0x2f')]['count'](_0x427f00)['then'](function(_0x43b6a6){_0x578378[_0xaefd('0x1e')]=_0x43b6a6;if(_0x4a1acb[_0xaefd('0x34')][_0xaefd('0x42')]){_0x1b470c[_0xaefd('0x43')]=[{'all':!![]}];}return db[_0xaefd('0x2f')][_0xaefd('0x44')](_0x1b470c);})[_0xaefd('0x26')](function(_0x48a7af){_0x578378[_0xaefd('0x45')]=_0x48a7af;return _0x578378;})[_0xaefd('0x26')](respondWithFilteredResult(_0x1d89c4,_0x1b470c))[_0xaefd('0x46')](handleError(_0x1d89c4,null));};exports[_0xaefd('0x47')]=function(_0x20d5fd,_0x197f3f){var _0x3633ec={'raw':!![],'where':{'id':_0x20d5fd['params']['id']}},_0x1f4a15={};_0x1f4a15['model']=_[_0xaefd('0x35')](db[_0xaefd('0x2f')]['rawAttributes']);_0x1f4a15['query']=_[_0xaefd('0x35')](_0x20d5fd[_0xaefd('0x34')]);_0x1f4a15[_0xaefd('0x36')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],_0x1f4a15[_0xaefd('0x34')]);_0x3633ec[_0xaefd('0x38')]=_[_0xaefd('0x37')](_0x1f4a15[_0xaefd('0x33')],qs['fields'](_0x20d5fd[_0xaefd('0x34')][_0xaefd('0x39')]));_0x3633ec[_0xaefd('0x38')]=_0x3633ec[_0xaefd('0x38')][_0xaefd('0x48')]?_0x3633ec[_0xaefd('0x38')]:_0x1f4a15[_0xaefd('0x33')];if(_0x20d5fd['query'][_0xaefd('0x42')]){_0x3633ec['include']=[{'all':!![]}];}_0x3633ec=_[_0xaefd('0x40')]({},_0x3633ec,_0x20d5fd[_0xaefd('0x49')]);return db[_0xaefd('0x2f')][_0xaefd('0x4a')](_0x3633ec)['then'](handleEntityNotFound(_0x197f3f,null))['then'](respondWithResult(_0x197f3f,null))[_0xaefd('0x46')](handleError(_0x197f3f,null));};exports[_0xaefd('0x4b')]=function(_0x179b8b,_0x4eeb56){return db[_0xaefd('0x2f')][_0xaefd('0x4b')](_0x179b8b['body'],{})[_0xaefd('0x26')](function(_0xf2783d){var _0x3c6a3e=_0x179b8b[_0xaefd('0x4c')][_0xaefd('0x4d')]({'plain':!![]});if(!_0x3c6a3e)throw new Error(_0xaefd('0x4e'));if(_0x3c6a3e[_0xaefd('0x4f')]===_0xaefd('0x4c')){var _0x4dc674=_0xf2783d['get']({'plain':!![]});var _0x1406b8=_0xaefd('0x28');return db['UserProfileSection'][_0xaefd('0x4a')]({'where':{'name':_0x1406b8,'userProfileId':_0x3c6a3e['userProfileId']},'raw':!![]})[_0xaefd('0x26')](function(_0x47296d){if(_0x47296d&&_0x47296d[_0xaefd('0x50')]===0x0){return db[_0xaefd('0x29')][_0xaefd('0x4b')]({'name':_0x4dc674[_0xaefd('0x2c')],'resourceId':_0x4dc674['id'],'type':_0x47296d['name'],'sectionId':_0x47296d['id']},{})['then'](function(){return _0xf2783d;});}else{return _0xf2783d;}})[_0xaefd('0x46')](function(_0x338823){logger['error'](_0xaefd('0x51'),_0x338823);throw _0x338823;});}return _0xf2783d;})[_0xaefd('0x26')](respondWithResult(_0x4eeb56,0xc9))[_0xaefd('0x46')](handleError(_0x4eeb56,null));};exports[_0xaefd('0x25')]=function(_0x4a883b,_0x583caa){if(_0x4a883b[_0xaefd('0x52')]['id']){delete _0x4a883b[_0xaefd('0x52')]['id'];}return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x4a883b[_0xaefd('0x53')]['id']}})['then'](handleEntityNotFound(_0x583caa,null))[_0xaefd('0x26')](saveUpdates(_0x4a883b[_0xaefd('0x52')],null))['then'](respondWithResult(_0x583caa,null))[_0xaefd('0x46')](handleError(_0x583caa,null));};exports[_0xaefd('0x27')]=function(_0x5f2925,_0x108e35){return db[_0xaefd('0x2f')][_0xaefd('0x4a')]({'where':{'id':_0x5f2925['params']['id']}})[_0xaefd('0x26')](handleEntityNotFound(_0x108e35,null))[_0xaefd('0x26')](db['CmContactHasItem'][_0xaefd('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x5f2925[_0xaefd('0x53')]['id']}}))[_0xaefd('0x26')](removeEntity(_0x108e35,null))[_0xaefd('0x46')](handleError(_0x108e35,null));}; \ No newline at end of file +var _0x4fc2=['keys','rawAttributes','include','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','stack','name','send','map','ContactItemType','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','merge','options','includeAll','findAll','rows','show','params'];(function(_0x2b86c3,_0x116624){var _0x1a2e09=function(_0x42e960){while(--_0x42e960){_0x2b86c3['push'](_0x2b86c3['shift']());}};_0x1a2e09(++_0x116624);}(_0x4fc2,0x111));var _0x24fc=function(_0x4ce960,_0x4258e9){_0x4ce960=_0x4ce960-0x0;var _0x43a9d1=_0x4fc2[_0x4ce960];return _0x43a9d1;};'use strict';var emlformat=require(_0x24fc('0x0'));var rimraf=require(_0x24fc('0x1'));var zipdir=require(_0x24fc('0x2'));var jsonpatch=require(_0x24fc('0x3'));var rp=require('request-promise');var moment=require(_0x24fc('0x4'));var BPromise=require(_0x24fc('0x5'));var Mustache=require(_0x24fc('0x6'));var util=require('util');var path=require(_0x24fc('0x7'));var sox=require(_0x24fc('0x8'));var csv=require('to-csv');var ejs=require(_0x24fc('0x9'));var fs=require('fs');var fs_extra=require(_0x24fc('0xa'));var _=require('lodash');var squel=require(_0x24fc('0xb'));var crypto=require(_0x24fc('0xc'));var jsforce=require(_0x24fc('0xd'));var deskjs=require(_0x24fc('0xe'));var toCsv=require(_0x24fc('0xf'));var querystring=require(_0x24fc('0x10'));var Papa=require('papaparse');var Redis=require(_0x24fc('0x11'));var authService=require(_0x24fc('0x12'));var qs=require(_0x24fc('0x13'));var as=require(_0x24fc('0x14'));var hardwareService=require(_0x24fc('0x15'));var logger=require(_0x24fc('0x16'))(_0x24fc('0x17'));var utils=require(_0x24fc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x24fc('0x19'));var db=require(_0x24fc('0x1a'))['db'];function respondWithStatusCode(_0x5cc65e,_0x306873){_0x306873=_0x306873||0xcc;return function(_0x76cb25){if(_0x76cb25){return _0x5cc65e[_0x24fc('0x1b')](_0x306873);}return _0x5cc65e[_0x24fc('0x1c')](_0x306873)[_0x24fc('0x1d')]();};}function respondWithResult(_0x326276,_0x537b5c){_0x537b5c=_0x537b5c||0xc8;return function(_0x2a0971){if(_0x2a0971){return _0x326276[_0x24fc('0x1c')](_0x537b5c)[_0x24fc('0x1e')](_0x2a0971);}};}function respondWithFilteredResult(_0x42cbe8,_0x4acd36){return function(_0x2ac989){if(_0x2ac989){var _0x588543=typeof _0x4acd36[_0x24fc('0x1f')]===_0x24fc('0x20')&&typeof _0x4acd36[_0x24fc('0x21')]===_0x24fc('0x20');var _0x25cb40=_0x2ac989['count'];var _0x23873c=_0x588543?0x0:_0x4acd36[_0x24fc('0x1f')];var _0x6cfa0a=_0x588543?_0x2ac989[_0x24fc('0x22')]:_0x4acd36['offset']+_0x4acd36[_0x24fc('0x21')];var _0x4073e0;if(_0x6cfa0a>=_0x25cb40){_0x6cfa0a=_0x25cb40;_0x4073e0=0xc8;}else{_0x4073e0=0xce;}_0x42cbe8[_0x24fc('0x1c')](_0x4073e0);return _0x42cbe8['set'](_0x24fc('0x23'),_0x23873c+'-'+_0x6cfa0a+'/'+_0x25cb40)[_0x24fc('0x1e')](_0x2ac989);}return null;};}function patchUpdates(_0xbf1d6b){return function(_0x2d0e3d){try{jsonpatch['apply'](_0x2d0e3d,_0xbf1d6b,!![]);}catch(_0x323beb){return BPromise['reject'](_0x323beb);}return _0x2d0e3d[_0x24fc('0x24')]();};}function saveUpdates(_0x591c8f,_0x3ed464){return function(_0x44c121){if(_0x44c121){return _0x44c121[_0x24fc('0x25')](_0x591c8f)['then'](function(_0x313a25){return _0x313a25;});}return null;};}function removeEntity(_0x552035,_0x35a9c7){return function(_0x2bb93a){if(_0x2bb93a){return _0x2bb93a[_0x24fc('0x26')]()[_0x24fc('0x27')](function(){var _0x3296fc=_0x2bb93a[_0x24fc('0x28')]({'plain':!![]});var _0x3f0875=_0x24fc('0x29');return db[_0x24fc('0x2a')][_0x24fc('0x26')]({'where':{'type':_0x3f0875,'resourceId':_0x3296fc['id']}})['then'](function(){return _0x2bb93a;});})[_0x24fc('0x27')](function(){_0x552035[_0x24fc('0x1c')](0xcc)[_0x24fc('0x1d')]();});}};}function handleEntityNotFound(_0x5bb4c8,_0xf2f77d){return function(_0x3d1ec8){if(!_0x3d1ec8){_0x5bb4c8[_0x24fc('0x1b')](0x194);}return _0x3d1ec8;};}function handleError(_0x290f84,_0x8f2528){_0x8f2528=_0x8f2528||0x1f4;return function(_0x443796){logger['error'](_0x443796[_0x24fc('0x2b')]);if(_0x443796[_0x24fc('0x2c')]){delete _0x443796[_0x24fc('0x2c')];}_0x290f84[_0x24fc('0x1c')](_0x8f2528)[_0x24fc('0x2d')](_0x443796);};}exports['index']=function(_0x55c27f,_0x4e6f73){var _0x3df6f4={},_0x574ba3={},_0x3f2464={'count':0x0,'rows':[]};var _0x3e6389=_[_0x24fc('0x2e')](db[_0x24fc('0x2f')]['rawAttributes'],function(_0x66eec0){return{'name':_0x66eec0[_0x24fc('0x30')],'type':_0x66eec0['type'][_0x24fc('0x31')]};});_0x574ba3[_0x24fc('0x32')]=_['map'](_0x3e6389,'name');_0x574ba3[_0x24fc('0x33')]=_['keys'](_0x55c27f[_0x24fc('0x33')]);_0x574ba3[_0x24fc('0x34')]=_['intersection'](_0x574ba3[_0x24fc('0x32')],_0x574ba3[_0x24fc('0x33')]);_0x3df6f4[_0x24fc('0x35')]=_[_0x24fc('0x36')](_0x574ba3[_0x24fc('0x32')],qs[_0x24fc('0x37')](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x37')]));_0x3df6f4[_0x24fc('0x35')]=_0x3df6f4['attributes'][_0x24fc('0x38')]?_0x3df6f4[_0x24fc('0x35')]:_0x574ba3[_0x24fc('0x32')];if(!_0x55c27f[_0x24fc('0x33')][_0x24fc('0x39')]('nolimit')){_0x3df6f4['limit']=qs[_0x24fc('0x21')](_0x55c27f['query'][_0x24fc('0x21')]);_0x3df6f4[_0x24fc('0x1f')]=qs[_0x24fc('0x1f')](_0x55c27f[_0x24fc('0x33')]['offset']);}_0x3df6f4[_0x24fc('0x3a')]=qs['sort'](_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3b')]);_0x3df6f4[_0x24fc('0x3c')]=qs[_0x24fc('0x34')](_[_0x24fc('0x3d')](_0x55c27f['query'],_0x574ba3[_0x24fc('0x34')]),_0x3e6389);if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]){_0x3df6f4[_0x24fc('0x3c')]=_['merge'](_0x3df6f4[_0x24fc('0x3c')],{'$or':_[_0x24fc('0x2e')](_0x3e6389,function(_0x56306e){if(_0x56306e[_0x24fc('0x3f')]!=='VIRTUAL'){var _0x320f7b={};_0x320f7b[_0x56306e[_0x24fc('0x2c')]]={'$like':'%'+_0x55c27f[_0x24fc('0x33')][_0x24fc('0x3e')]+'%'};return _0x320f7b;}})});}_0x3df6f4=_[_0x24fc('0x40')]({},_0x3df6f4,_0x55c27f[_0x24fc('0x41')]);var _0x77b959={'where':_0x3df6f4[_0x24fc('0x3c')]};return db['ContactItemType'][_0x24fc('0x22')](_0x77b959)[_0x24fc('0x27')](function(_0x32f72c){_0x3f2464['count']=_0x32f72c;if(_0x55c27f[_0x24fc('0x33')][_0x24fc('0x42')]){_0x3df6f4['include']=[{'all':!![]}];}return db[_0x24fc('0x2f')][_0x24fc('0x43')](_0x3df6f4);})[_0x24fc('0x27')](function(_0x5e4e9b){_0x3f2464[_0x24fc('0x44')]=_0x5e4e9b;return _0x3f2464;})[_0x24fc('0x27')](respondWithFilteredResult(_0x4e6f73,_0x3df6f4))['catch'](handleError(_0x4e6f73,null));};exports[_0x24fc('0x45')]=function(_0x169982,_0x158f7b){var _0x2a0ac4={'raw':!![],'where':{'id':_0x169982[_0x24fc('0x46')]['id']}},_0x4c8dad={};_0x4c8dad[_0x24fc('0x32')]=_[_0x24fc('0x47')](db[_0x24fc('0x2f')][_0x24fc('0x48')]);_0x4c8dad['query']=_[_0x24fc('0x47')](_0x169982[_0x24fc('0x33')]);_0x4c8dad[_0x24fc('0x34')]=_[_0x24fc('0x36')](_0x4c8dad['model'],_0x4c8dad[_0x24fc('0x33')]);_0x2a0ac4[_0x24fc('0x35')]=_['intersection'](_0x4c8dad['model'],qs[_0x24fc('0x37')](_0x169982['query']['fields']));_0x2a0ac4[_0x24fc('0x35')]=_0x2a0ac4['attributes'][_0x24fc('0x38')]?_0x2a0ac4[_0x24fc('0x35')]:_0x4c8dad[_0x24fc('0x32')];if(_0x169982['query'][_0x24fc('0x42')]){_0x2a0ac4[_0x24fc('0x49')]=[{'all':!![]}];}_0x2a0ac4=_[_0x24fc('0x40')]({},_0x2a0ac4,_0x169982[_0x24fc('0x41')]);return db[_0x24fc('0x2f')][_0x24fc('0x4a')](_0x2a0ac4)[_0x24fc('0x27')](handleEntityNotFound(_0x158f7b,null))[_0x24fc('0x27')](respondWithResult(_0x158f7b,null))['catch'](handleError(_0x158f7b,null));};exports['create']=function(_0x266378,_0x2f1a99){return db[_0x24fc('0x2f')]['create'](_0x266378['body'],{})[_0x24fc('0x27')](function(_0x213439){var _0x179a60=_0x266378[_0x24fc('0x4b')][_0x24fc('0x28')]({'plain':!![]});if(!_0x179a60)throw new Error(_0x24fc('0x4c'));if(_0x179a60[_0x24fc('0x4d')]===_0x24fc('0x4b')){var _0x1671b0=_0x213439[_0x24fc('0x28')]({'plain':!![]});var _0x434700=_0x24fc('0x29');return db['UserProfileSection'][_0x24fc('0x4a')]({'where':{'name':_0x434700,'userProfileId':_0x179a60[_0x24fc('0x4e')]},'raw':!![]})[_0x24fc('0x27')](function(_0xb0fc00){if(_0xb0fc00&&_0xb0fc00[_0x24fc('0x4f')]===0x0){return db['UserProfileResource'][_0x24fc('0x50')]({'name':_0x1671b0['name'],'resourceId':_0x1671b0['id'],'type':_0xb0fc00[_0x24fc('0x2c')],'sectionId':_0xb0fc00['id']},{})[_0x24fc('0x27')](function(){return _0x213439;});}else{return _0x213439;}})[_0x24fc('0x51')](function(_0x41ddfb){logger[_0x24fc('0x52')](_0x24fc('0x53'),_0x41ddfb);throw _0x41ddfb;});}return _0x213439;})['then'](respondWithResult(_0x2f1a99,0xc9))[_0x24fc('0x51')](handleError(_0x2f1a99,null));};exports[_0x24fc('0x25')]=function(_0xc49d9f,_0x31a2ef){if(_0xc49d9f[_0x24fc('0x54')]['id']){delete _0xc49d9f[_0x24fc('0x54')]['id'];}return db['ContactItemType'][_0x24fc('0x4a')]({'where':{'id':_0xc49d9f[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x31a2ef,null))[_0x24fc('0x27')](saveUpdates(_0xc49d9f[_0x24fc('0x54')],null))[_0x24fc('0x27')](respondWithResult(_0x31a2ef,null))[_0x24fc('0x51')](handleError(_0x31a2ef,null));};exports['destroy']=function(_0xd673f8,_0x11690f){return db['ContactItemType'][_0x24fc('0x4a')]({'where':{'id':_0xd673f8[_0x24fc('0x46')]['id']}})[_0x24fc('0x27')](handleEntityNotFound(_0x11690f,null))[_0x24fc('0x27')](db[_0x24fc('0x55')][_0x24fc('0x25')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0xd673f8['params']['id']}}))[_0x24fc('0x27')](removeEntity(_0x11690f,null))['catch'](handleError(_0x11690f,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 9782e3c..b7d402a 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 _0xae20=['api','bluebird','request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x4a3898,_0x4c9853){var _0x25ceb0=function(_0x528b6d){while(--_0x528b6d){_0x4a3898['push'](_0x4a3898['shift']());}};_0x25ceb0(++_0x4c9853);}(_0xae20,0x1c4));var _0x0ae2=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xae20[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0ae2('0x0'));var util=require(_0x0ae2('0x1'));var logger=require(_0x0ae2('0x2'))(_0x0ae2('0x3'));var moment=require('moment');var BPromise=require(_0x0ae2('0x4'));var rp=require(_0x0ae2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0ae2('0x6'));var config=require(_0x0ae2('0x7'));var attributes=require(_0x0ae2('0x8'));module[_0x0ae2('0x9')]=function(_0x55442f,_0x15a302){return _0x55442f[_0x0ae2('0xa')](_0x0ae2('0xb'),attributes,{'tableName':_0x0ae2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4347=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash'];(function(_0x4386ff,_0x15ad4a){var _0x163ffa=function(_0x1bc49d){while(--_0x1bc49d){_0x4386ff['push'](_0x4386ff['shift']());}};_0x163ffa(++_0x15ad4a);}(_0x4347,0x10d));var _0x7434=function(_0x42eaf1,_0x504e39){_0x42eaf1=_0x42eaf1-0x0;var _0x3c5189=_0x4347[_0x42eaf1];return _0x3c5189;};'use strict';var _=require(_0x7434('0x0'));var util=require(_0x7434('0x1'));var logger=require(_0x7434('0x2'))(_0x7434('0x3'));var moment=require(_0x7434('0x4'));var BPromise=require(_0x7434('0x5'));var rp=require(_0x7434('0x6'));var fs=require('fs');var path=require(_0x7434('0x7'));var rimraf=require(_0x7434('0x8'));var config=require(_0x7434('0x9'));var attributes=require(_0x7434('0xa'));module[_0x7434('0xb')]=function(_0x37f892,_0x278a15){return _0x37f892[_0x7434('0xc')](_0x7434('0xd'),attributes,{'tableName':_0x7434('0xe'),'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 1e788e9..5c7059d 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 _0x3407=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird'];(function(_0x180f68,_0xf2efe9){var _0x5db9c4=function(_0x447cf5){while(--_0x447cf5){_0x180f68['push'](_0x180f68['shift']());}};_0x5db9c4(++_0xf2efe9);}(_0x3407,0x1c8));var _0x7340=function(_0x568696,_0x9a9454){_0x568696=_0x568696-0x0;var _0x27ec2b=_0x3407[_0x568696];return _0x27ec2b;};'use strict';var _=require(_0x7340('0x0'));var util=require(_0x7340('0x1'));var moment=require(_0x7340('0x2'));var BPromise=require(_0x7340('0x3'));var rs=require(_0x7340('0x4'));var fs=require('fs');var Redis=require(_0x7340('0x5'));var db=require(_0x7340('0x6'))['db'];var utils=require(_0x7340('0x7'));var logger=require(_0x7340('0x8'))(_0x7340('0x9'));var config=require(_0x7340('0xa'));var jayson=require(_0x7340('0xb'));var client=jayson[_0x7340('0xc')][_0x7340('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5ea01b,_0xd132c7,_0x2bc5d4){return new BPromise(function(_0x57b87c,_0x3645fc){return client['request'](_0x5ea01b,_0x2bc5d4)[_0x7340('0xe')](function(_0x4efc73){logger['info'](_0x7340('0xf'),_0xd132c7,_0x7340('0x10'));logger[_0x7340('0x11')](_0x7340('0x12'),_0xd132c7,_0x7340('0x10'),JSON[_0x7340('0x13')](_0x4efc73));if(_0x4efc73['error']){if(_0x4efc73[_0x7340('0x14')]['code']===0x1f4){logger[_0x7340('0x14')](_0x7340('0xf'),_0xd132c7,_0x4efc73[_0x7340('0x14')][_0x7340('0x15')]);return _0x3645fc(_0x4efc73[_0x7340('0x14')]['message']);}logger[_0x7340('0x14')](_0x7340('0xf'),_0xd132c7,_0x4efc73['error']['message']);return _0x57b87c(_0x4efc73['error']['message']);}else{logger['info'](_0x7340('0xf'),_0xd132c7,'request\x20sent');_0x57b87c(_0x4efc73['result'][_0x7340('0x15')]);}})[_0x7340('0x16')](function(_0x224f9b){logger['error'](_0x7340('0xf'),_0xd132c7,_0x224f9b);_0x3645fc(_0x224f9b);});});} \ No newline at end of file +var _0x546b=['stringify','error','code','message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x546b,0x17a));var _0xb546=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x546b[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0xb546('0x0'));var util=require('util');var moment=require(_0xb546('0x1'));var BPromise=require(_0xb546('0x2'));var rs=require(_0xb546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb546('0x4'))['db'];var utils=require(_0xb546('0x5'));var logger=require(_0xb546('0x6'))(_0xb546('0x7'));var config=require(_0xb546('0x8'));var jayson=require(_0xb546('0x9'));var client=jayson[_0xb546('0xa')][_0xb546('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x359bc5,_0x5f305b,_0x5a04ad){return new BPromise(function(_0x3421d4,_0x31233a){return client[_0xb546('0xc')](_0x359bc5,_0x5a04ad)['then'](function(_0x3fb559){logger[_0xb546('0xd')](_0xb546('0xe'),_0x5f305b,_0xb546('0xf'));logger[_0xb546('0x10')](_0xb546('0x11'),_0x5f305b,'request\x20sent',JSON[_0xb546('0x12')](_0x3fb559));if(_0x3fb559[_0xb546('0x13')]){if(_0x3fb559['error'][_0xb546('0x14')]===0x1f4){logger[_0xb546('0x13')]('ContactItemType,\x20%s,\x20%s',_0x5f305b,_0x3fb559[_0xb546('0x13')][_0xb546('0x15')]);return _0x31233a(_0x3fb559[_0xb546('0x13')][_0xb546('0x15')]);}logger[_0xb546('0x13')](_0xb546('0xe'),_0x5f305b,_0x3fb559['error']['message']);return _0x3421d4(_0x3fb559[_0xb546('0x13')]['message']);}else{logger[_0xb546('0xd')](_0xb546('0xe'),_0x5f305b,_0xb546('0xf'));_0x3421d4(_0x3fb559['result'][_0xb546('0x15')]);}})['catch'](function(_0x4e7ca9){logger[_0xb546('0x13')](_0xb546('0xe'),_0x5f305b,_0x4e7ca9);_0x31233a(_0x4e7ca9);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index b043fd2..439ec20 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 _0x83f2=['put','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./contactItemType.controller','/:id','isAuthenticated','show','post','create'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x83f2,0x70));var _0x283f=function(_0x41a221,_0x4ccaa4){_0x41a221=_0x41a221-0x0;var _0x2a7933=_0x83f2[_0x41a221];return _0x2a7933;};'use strict';var multer=require(_0x283f('0x0'));var util=require('util');var path=require(_0x283f('0x1'));var timeout=require(_0x283f('0x2'));var express=require(_0x283f('0x3'));var router=express[_0x283f('0x4')]();var fs_extra=require(_0x283f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x283f('0x6'));var config=require(_0x283f('0x7'));var controller=require(_0x283f('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x283f('0x9'),auth[_0x283f('0xa')](),controller[_0x283f('0xb')]);router[_0x283f('0xc')]('/',auth[_0x283f('0xa')](),controller[_0x283f('0xd')]);router[_0x283f('0xe')](_0x283f('0x9'),auth[_0x283f('0xa')](),controller[_0x283f('0xf')]);router[_0x283f('0x10')](_0x283f('0x9'),auth['isAuthenticated'](),controller[_0x283f('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa86e=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4c706c,_0x560495){var _0x28dcef=function(_0x4fbf56){while(--_0x4fbf56){_0x4c706c['push'](_0x4c706c['shift']());}};_0x28dcef(++_0x560495);}(_0xa86e,0xf8));var _0xea86=function(_0x277d47,_0x3faf96){_0x277d47=_0x277d47-0x0;var _0x298765=_0xa86e[_0x277d47];return _0x298765;};'use strict';var multer=require(_0xea86('0x0'));var util=require(_0xea86('0x1'));var path=require(_0xea86('0x2'));var timeout=require(_0xea86('0x3'));var express=require(_0xea86('0x4'));var router=express[_0xea86('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xea86('0x6'));var interaction=require(_0xea86('0x7'));var config=require(_0xea86('0x8'));var controller=require('./contactItemType.controller');router[_0xea86('0x9')]('/',auth[_0xea86('0xa')](),controller[_0xea86('0xb')]);router['get'](_0xea86('0xc'),auth[_0xea86('0xa')](),controller[_0xea86('0xd')]);router[_0xea86('0xe')]('/',auth['isAuthenticated'](),controller[_0xea86('0xf')]);router[_0xea86('0x10')](_0xea86('0xc'),auth[_0xea86('0xa')](),controller[_0xea86('0x11')]);router[_0xea86('0x12')](_0xea86('0xc'),auth[_0xea86('0xa')](),controller[_0xea86('0x13')]);module[_0xea86('0x14')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 5fe71df..5bfd74e 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['exports','STRING'];(function(_0x365c91,_0xc944b4){var _0x4231ab=function(_0x5a6be2){while(--_0x5a6be2){_0x365c91['push'](_0x365c91['shift']());}};_0x4231ab(++_0xc944b4);}(_0x757a,0xde));var _0xa757=function(_0x4d054d,_0x168a41){_0x4d054d=_0x4d054d-0x0;var _0x171bfd=_0x757a[_0x4d054d];return _0x171bfd;};'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(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xb7e7,0x121));var _0x7b7e=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0xb7e7[_0x174ef5];return _0x1cc379;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 82cd1e1..87ed67f 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 _0x6618=['stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','destroy','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie3','web-report','attrReport','reportType','widgetAttributes:\x20%s','stringify','DashboardId','getItems','findOne','DashboardItem','pick','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../config/logger','api','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','status','json','offset','undefined','limit','set','apply','save','then','get','CustomDashboards','UserProfileResource','error'];(function(_0x460ec3,_0x1cbd3d){var _0xaca5b2=function(_0x55e462){while(--_0x55e462){_0x460ec3['push'](_0x460ec3['shift']());}};_0xaca5b2(++_0x1cbd3d);}(_0x6618,0xdb));var _0x8661=function(_0x3ab18c,_0x21829f){_0x3ab18c=_0x3ab18c-0x0;var _0x50216e=_0x6618[_0x3ab18c];return _0x50216e;};'use strict';var emlformat=require(_0x8661('0x0'));var rimraf=require(_0x8661('0x1'));var zipdir=require(_0x8661('0x2'));var jsonpatch=require(_0x8661('0x3'));var rp=require(_0x8661('0x4'));var moment=require(_0x8661('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8661('0x6'));var path=require(_0x8661('0x7'));var sox=require(_0x8661('0x8'));var csv=require(_0x8661('0x9'));var ejs=require(_0x8661('0xa'));var fs=require('fs');var fs_extra=require(_0x8661('0xb'));var _=require(_0x8661('0xc'));var squel=require(_0x8661('0xd'));var crypto=require('crypto');var jsforce=require(_0x8661('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x8661('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8661('0xf'));var authService=require(_0x8661('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8661('0x11'))(_0x8661('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8661('0x13'));var db=require(_0x8661('0x14'))['db'];config[_0x8661('0x15')]=_['defaults'](config[_0x8661('0x15')],{'host':_0x8661('0x16'),'port':0x18eb});var socket=require(_0x8661('0x17'))(new Redis(config[_0x8661('0x15')]));require(_0x8661('0x18'))[_0x8661('0x19')](socket);function respondWithStatusCode(_0x27a103,_0x561a6d){_0x561a6d=_0x561a6d||0xcc;return function(_0x38aa05){if(_0x38aa05){return _0x27a103[_0x8661('0x1a')](_0x561a6d);}return _0x27a103['status'](_0x561a6d)[_0x8661('0x1b')]();};}function respondWithResult(_0x473191,_0x3fa6b7){_0x3fa6b7=_0x3fa6b7||0xc8;return function(_0x159d62){if(_0x159d62){return _0x473191[_0x8661('0x1c')](_0x3fa6b7)[_0x8661('0x1d')](_0x159d62);}};}function respondWithFilteredResult(_0x3c6599,_0x3636a3){return function(_0x45b888){if(_0x45b888){var _0x330d18=typeof _0x3636a3[_0x8661('0x1e')]===_0x8661('0x1f')&&typeof _0x3636a3[_0x8661('0x20')]==='undefined';var _0x4262da=_0x45b888['count'];var _0x29a631=_0x330d18?0x0:_0x3636a3[_0x8661('0x1e')];var _0x1607c2=_0x330d18?_0x45b888['count']:_0x3636a3[_0x8661('0x1e')]+_0x3636a3[_0x8661('0x20')];var _0x38b2f8;if(_0x1607c2>=_0x4262da){_0x1607c2=_0x4262da;_0x38b2f8=0xc8;}else{_0x38b2f8=0xce;}_0x3c6599[_0x8661('0x1c')](_0x38b2f8);return _0x3c6599[_0x8661('0x21')]('Content-Range',_0x29a631+'-'+_0x1607c2+'/'+_0x4262da)[_0x8661('0x1d')](_0x45b888);}return null;};}function patchUpdates(_0x557be4){return function(_0x2e3a09){try{jsonpatch[_0x8661('0x22')](_0x2e3a09,_0x557be4,!![]);}catch(_0x198291){return BPromise['reject'](_0x198291);}return _0x2e3a09[_0x8661('0x23')]();};}function saveUpdates(_0x231ca0,_0x5e970b){return function(_0x172ba5){if(_0x172ba5){return _0x172ba5['update'](_0x231ca0)[_0x8661('0x24')](function(_0x517e20){return _0x517e20;});}return null;};}function removeEntity(_0x336087,_0x65e425){return function(_0x4311b6){if(_0x4311b6){return _0x4311b6['destroy']()['then'](function(){var _0x209aef=_0x4311b6[_0x8661('0x25')]({'plain':!![]});var _0x10fcda=_0x8661('0x26');return db[_0x8661('0x27')]['destroy']({'where':{'type':_0x10fcda,'resourceId':_0x209aef['id']}})['then'](function(){return _0x4311b6;});})[_0x8661('0x24')](function(){_0x336087[_0x8661('0x1c')](0xcc)[_0x8661('0x1b')]();});}};}function handleEntityNotFound(_0x4b40f0,_0x56a387){return function(_0x169f57){if(!_0x169f57){_0x4b40f0[_0x8661('0x1a')](0x194);}return _0x169f57;};}function handleError(_0x284eb9,_0x1244ae){_0x1244ae=_0x1244ae||0x1f4;return function(_0x17c8e4){logger[_0x8661('0x28')](_0x17c8e4[_0x8661('0x29')]);if(_0x17c8e4['name']){delete _0x17c8e4[_0x8661('0x2a')];}_0x284eb9[_0x8661('0x1c')](_0x1244ae)[_0x8661('0x2b')](_0x17c8e4);};}exports[_0x8661('0x2c')]=function(_0x1b9862,_0x36a95e){var _0x57916c={},_0x516862={},_0x418d26={'count':0x0,'rows':[]};var _0x3fa91a=_[_0x8661('0x2d')](db[_0x8661('0x2e')][_0x8661('0x2f')],function(_0x1c82e1){return{'name':_0x1c82e1[_0x8661('0x30')],'type':_0x1c82e1[_0x8661('0x31')][_0x8661('0x32')]};});_0x516862[_0x8661('0x33')]=_['map'](_0x3fa91a,_0x8661('0x2a'));_0x516862['query']=_[_0x8661('0x34')](_0x1b9862[_0x8661('0x35')]);_0x516862['filters']=_['intersection'](_0x516862[_0x8661('0x33')],_0x516862[_0x8661('0x35')]);_0x57916c[_0x8661('0x36')]=_[_0x8661('0x37')](_0x516862[_0x8661('0x33')],qs[_0x8661('0x38')](_0x1b9862['query'][_0x8661('0x38')]));_0x57916c['attributes']=_0x57916c[_0x8661('0x36')][_0x8661('0x39')]?_0x57916c[_0x8661('0x36')]:_0x516862[_0x8661('0x33')];if(!_0x1b9862['query'][_0x8661('0x3a')](_0x8661('0x3b'))){_0x57916c[_0x8661('0x20')]=qs[_0x8661('0x20')](_0x1b9862[_0x8661('0x35')][_0x8661('0x20')]);_0x57916c[_0x8661('0x1e')]=qs['offset'](_0x1b9862[_0x8661('0x35')][_0x8661('0x1e')]);}_0x57916c[_0x8661('0x3c')]=qs[_0x8661('0x3d')](_0x1b9862['query']['sort']);_0x57916c['where']=qs[_0x8661('0x3e')](_['pick'](_0x1b9862[_0x8661('0x35')],_0x516862[_0x8661('0x3e')]),_0x3fa91a);if(_0x1b9862[_0x8661('0x35')][_0x8661('0x3f')]){_0x57916c['where']=_[_0x8661('0x40')](_0x57916c[_0x8661('0x41')],{'$or':_[_0x8661('0x2d')](_0x3fa91a,function(_0x48442f){if(_0x48442f['type']!==_0x8661('0x42')){var _0x4b012d={};_0x4b012d[_0x48442f[_0x8661('0x2a')]]={'$like':'%'+_0x1b9862[_0x8661('0x35')][_0x8661('0x3f')]+'%'};return _0x4b012d;}})});}_0x57916c=_[_0x8661('0x40')]({},_0x57916c,_0x1b9862[_0x8661('0x43')]);var _0x259a2a={'where':_0x57916c['where']};return db['Dashboard'][_0x8661('0x44')](_0x259a2a)[_0x8661('0x24')](function(_0x554a81){_0x418d26[_0x8661('0x44')]=_0x554a81;if(_0x1b9862['query'][_0x8661('0x45')]){_0x57916c[_0x8661('0x46')]=[{'all':!![]}];}return db[_0x8661('0x2e')][_0x8661('0x47')](_0x57916c);})['then'](function(_0xd0bcfe){_0x418d26[_0x8661('0x48')]=_0xd0bcfe;return _0x418d26;})['then'](respondWithFilteredResult(_0x36a95e,_0x57916c))[_0x8661('0x49')](handleError(_0x36a95e,null));};exports[_0x8661('0x4a')]=function(_0x4ffead,_0x3bf49a){var _0x2b8f6b={'raw':![],'where':{'id':_0x4ffead[_0x8661('0x4b')]['id']}},_0x14a8eb={};_0x14a8eb[_0x8661('0x33')]=_['keys'](db[_0x8661('0x2e')][_0x8661('0x2f')]);_0x14a8eb[_0x8661('0x35')]=_['keys'](_0x4ffead['query']);_0x14a8eb[_0x8661('0x3e')]=_[_0x8661('0x37')](_0x14a8eb[_0x8661('0x33')],_0x14a8eb[_0x8661('0x35')]);_0x2b8f6b[_0x8661('0x36')]=_['intersection'](_0x14a8eb[_0x8661('0x33')],qs['fields'](_0x4ffead[_0x8661('0x35')][_0x8661('0x38')]));_0x2b8f6b[_0x8661('0x36')]=_0x2b8f6b[_0x8661('0x36')]['length']?_0x2b8f6b[_0x8661('0x36')]:_0x14a8eb['model'];if(_0x4ffead['query']['includeAll']){_0x2b8f6b['include']=[{'all':!![]}];}_0x2b8f6b=_[_0x8661('0x40')]({},_0x2b8f6b,_0x4ffead['options']);return db[_0x8661('0x2e')]['find'](_0x2b8f6b)[_0x8661('0x24')](handleEntityNotFound(_0x3bf49a,null))[_0x8661('0x24')](respondWithResult(_0x3bf49a,null))[_0x8661('0x49')](handleError(_0x3bf49a,null));};exports['create']=function(_0xa692b4,_0x3b5878){return db[_0x8661('0x2e')][_0x8661('0x4c')](_0xa692b4[_0x8661('0x4d')],{})['then'](function(_0x57d7fd){var _0x53c04e=_0xa692b4[_0x8661('0x4e')][_0x8661('0x25')]({'plain':!![]});if(!_0x53c04e)throw new Error(_0x8661('0x4f'));if(_0x53c04e[_0x8661('0x50')]===_0x8661('0x4e')){var _0x3d3c61=_0x57d7fd[_0x8661('0x25')]({'plain':!![]});var _0x2719fd=_0x8661('0x26');return db[_0x8661('0x51')][_0x8661('0x52')]({'where':{'name':_0x2719fd,'userProfileId':_0x53c04e['userProfileId']},'raw':!![]})[_0x8661('0x24')](function(_0x25d4dd){if(_0x25d4dd&&_0x25d4dd[_0x8661('0x53')]===0x0){return db[_0x8661('0x27')]['create']({'name':_0x3d3c61[_0x8661('0x2a')],'resourceId':_0x3d3c61['id'],'type':_0x25d4dd[_0x8661('0x2a')],'sectionId':_0x25d4dd['id']},{})[_0x8661('0x24')](function(){return _0x57d7fd;});}else{return _0x57d7fd;}})['catch'](function(_0xb6b5ea){logger[_0x8661('0x28')](_0x8661('0x54'),_0xb6b5ea);throw _0xb6b5ea;});}return _0x57d7fd;})[_0x8661('0x24')](respondWithResult(_0x3b5878,0xc9))[_0x8661('0x49')](handleError(_0x3b5878,null));};exports[_0x8661('0x55')]=function(_0x2b2cf3,_0x3a8e81){var _0x100897={'where':{'id':_0x2b2cf3[_0x8661('0x4b')]['id']}},_0x3062f2={};_0x3062f2[_0x8661('0x33')]=_[_0x8661('0x34')](db[_0x8661('0x2e')][_0x8661('0x2f')]);_0x100897[_0x8661('0x36')]=_[_0x8661('0x37')](_0x3062f2[_0x8661('0x33')],qs[_0x8661('0x38')](_0x2b2cf3[_0x8661('0x35')][_0x8661('0x38')]));_0x100897[_0x8661('0x36')]=_0x100897['attributes'][_0x8661('0x39')]?_0x100897[_0x8661('0x36')]:_0x3062f2[_0x8661('0x33')];if(_0x2b2cf3['query'][_0x8661('0x45')]){_0x100897['include']=[{'all':!![]}];}_0x100897=_['merge']({},_0x100897,_0x2b2cf3[_0x8661('0x43')]);return db['Dashboard']['find'](_0x100897)[_0x8661('0x24')](handleEntityNotFound(_0x3a8e81,null))[_0x8661('0x24')](function(_0x1986b1){if(_0x1986b1){var _0x280cdb=_0x1986b1['get']({'plain':!![]});_0x280cdb=qs[_0x8661('0x56')](_0x280cdb,['id',_0x8661('0x57'),_0x8661('0x58')]);_0x2b2cf3['body']=_[_0x8661('0x56')](_0x2b2cf3[_0x8661('0x4d')],['id',_0x8661('0x57'),'updatedAt']);return db['Dashboard']['create'](_[_0x8661('0x40')](_0x280cdb,_0x2b2cf3['body']),{'include':_0x2b2cf3[_0x8661('0x35')][_0x8661('0x45')]?[{'all':!![]}]:undefined})[_0x8661('0x24')](function(_0x5dddf7){var _0x49fcd4=_0x2b2cf3[_0x8661('0x4e')]['get']({'plain':!![]});if(!_0x49fcd4)throw new Error(_0x8661('0x4f'));if(_0x49fcd4[_0x8661('0x50')]===_0x8661('0x4e')){var _0xce1e1c=_0x5dddf7[_0x8661('0x25')]({'plain':!![]});var _0x30c9aa=_0x8661('0x26');return db[_0x8661('0x51')][_0x8661('0x52')]({'where':{'name':_0x30c9aa,'userProfileId':_0x49fcd4[_0x8661('0x59')]},'raw':!![]})[_0x8661('0x24')](function(_0x294f08){if(_0x294f08&&_0x294f08['autoAssociation']===0x0){return db[_0x8661('0x27')][_0x8661('0x4c')]({'name':_0xce1e1c[_0x8661('0x2a')],'resourceId':_0xce1e1c['id'],'type':_0x294f08[_0x8661('0x2a')],'sectionId':_0x294f08['id']},{})[_0x8661('0x24')](function(){return _0x5dddf7;});}else{return _0x5dddf7;}})[_0x8661('0x49')](function(_0x2f4c57){logger['error'](_0x8661('0x54'),_0x2f4c57);throw _0x2f4c57;});}return _0x5dddf7;});}})['then'](respondWithResult(_0x3a8e81,0xc9))[_0x8661('0x49')](handleError(_0x3a8e81,null));};exports['update']=function(_0x47a370,_0x22f898){if(_0x47a370['body']['id']){delete _0x47a370[_0x8661('0x4d')]['id'];}return db[_0x8661('0x2e')][_0x8661('0x52')]({'where':{'id':_0x47a370[_0x8661('0x4b')]['id']}})[_0x8661('0x24')](handleEntityNotFound(_0x22f898,null))[_0x8661('0x24')](saveUpdates(_0x47a370[_0x8661('0x4d')],null))['then'](respondWithResult(_0x22f898,null))[_0x8661('0x49')](handleError(_0x22f898,null));};exports[_0x8661('0x5a')]=function(_0x17aca1,_0x146d00){return db[_0x8661('0x2e')][_0x8661('0x52')]({'where':{'id':_0x17aca1[_0x8661('0x4b')]['id']}})['then'](handleEntityNotFound(_0x146d00,null))['then'](removeEntity(_0x146d00,null))[_0x8661('0x49')](handleError(_0x146d00,null));};function widgetAttributes(_0x233725){try{switch(_0x233725[_0x8661('0x31')]){case _0x8661('0x5b'):return[{'name':_0x8661('0x5c'),'value':_0x233725[_0x8661('0x5c')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x0]?_0x233725[_0x8661('0x5d')][0x0]['value']:undefined)||_0x8661('0x5e')}];case _0x8661('0x5f'):return[{'name':_0x8661('0x60'),'value':_0x233725[_0x8661('0x60')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x0]?_0x233725[_0x8661('0x5d')][0x0][_0x8661('0x61')]:undefined)||''}];case _0x8661('0x62'):return[{'name':_0x8661('0x63'),'value':_0x233725[_0x8661('0x63')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x0]?_0x233725[_0x8661('0x5d')][0x0]['value']:undefined)||_0x8661('0x64')},{'name':_0x8661('0x65'),'value':_0x233725['attrTimezone']||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x1]?_0x233725[_0x8661('0x5d')][0x1][_0x8661('0x61')]:undefined)||_0x8661('0x66')},{'name':_0x8661('0x67'),'value':_0x233725[_0x8661('0x67')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x2]?_0x233725['attrs'][0x2][_0x8661('0x61')]:undefined)||0xc}];case _0x8661('0x68'):return[{'name':'attrMetric','value':_0x233725[_0x8661('0x69')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x0]?_0x233725['attrs'][0x0][_0x8661('0x61')]:undefined)||_0x8661('0x6a')},{'name':'attrVoiceQueues','value':_0x233725[_0x8661('0x6b')]||(_0x233725['attrs']&&_0x233725[_0x8661('0x5d')][0x1]?_0x233725[_0x8661('0x5d')][0x1][_0x8661('0x61')]:undefined)||[]},{'name':_0x8661('0x67'),'value':_0x233725['attrFontSize']||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x2]?_0x233725[_0x8661('0x5d')][0x2][_0x8661('0x61')]:undefined)||0x14},{'name':'attrChannel','value':_0x233725[_0x8661('0x6c')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x3]?_0x233725[_0x8661('0x5d')][0x3][_0x8661('0x61')]:undefined)||_0x8661('0x6d')},{'name':_0x8661('0x6e'),'value':_0x233725[_0x8661('0x6e')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x4]?_0x233725[_0x8661('0x5d')][0x4][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x6f'),'value':_0x233725[_0x8661('0x6f')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x5]?_0x233725[_0x8661('0x5d')][0x5]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x233725[_0x8661('0x70')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x6]?_0x233725[_0x8661('0x5d')][0x6][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x71'),'value':_0x233725[_0x8661('0x71')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x7]?_0x233725[_0x8661('0x5d')][0x7]['value']:undefined)||''},{'name':_0x8661('0x72'),'value':_0x233725[_0x8661('0x72')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x8]?_0x233725[_0x8661('0x5d')][0x8][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x73'),'value':_0x233725[_0x8661('0x73')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x9]?_0x233725[_0x8661('0x5d')][0x9][_0x8661('0x61')]:undefined)||''}];case _0x8661('0x74'):case _0x8661('0x75'):return[{'name':'attrSerie1','value':_0x233725[_0x8661('0x76')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x0]?_0x233725[_0x8661('0x5d')][0x0][_0x8661('0x61')]:undefined)||'total'},{'name':'attrSerie2','value':_0x233725['attrSerie2']||(_0x233725['attrs']&&_0x233725['attrs'][0x1]?_0x233725[_0x8661('0x5d')][0x1][_0x8661('0x61')]:undefined)||null},{'name':_0x8661('0x77'),'value':_0x233725[_0x8661('0x77')]||(_0x233725['attrs']&&_0x233725[_0x8661('0x5d')][0x2]?_0x233725[_0x8661('0x5d')][0x2][_0x8661('0x61')]:undefined)||null},{'name':_0x8661('0x6b'),'value':_0x233725['attrVoiceQueues']||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x3]?_0x233725[_0x8661('0x5d')][0x3]['value']:undefined)||[]},{'name':_0x8661('0x6c'),'value':_0x233725[_0x8661('0x6c')]||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x4]?_0x233725[_0x8661('0x5d')][0x4][_0x8661('0x61')]:undefined)||'voice'},{'name':_0x8661('0x6e'),'value':_0x233725['attrEmailAccounts']||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x5]?_0x233725[_0x8661('0x5d')][0x5][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x6f'),'value':_0x233725[_0x8661('0x6f')]||(_0x233725['attrs']&&_0x233725[_0x8661('0x5d')][0x6]?_0x233725['attrs'][0x6][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x70'),'value':_0x233725['attrSmsAccounts']||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x7]?_0x233725[_0x8661('0x5d')][0x7][_0x8661('0x61')]:undefined)||''},{'name':_0x8661('0x71'),'value':_0x233725[_0x8661('0x71')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x8]?_0x233725[_0x8661('0x5d')][0x8][_0x8661('0x61')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x233725[_0x8661('0x72')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x9]?_0x233725['attrs'][0x9][_0x8661('0x61')]:undefined)||''},{'name':'attrChatWebsites','value':_0x233725[_0x8661('0x73')]||(_0x233725['attrs']&&_0x233725[_0x8661('0x5d')][0xa]?_0x233725['attrs'][0xa][_0x8661('0x61')]:undefined)||''}];case _0x8661('0x78'):return[{'name':_0x8661('0x79'),'type':_0x233725[_0x8661('0x7a')]||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x0]?_0x233725['attrs'][0x0][_0x8661('0x31')]:undefined)||null,'value':_0x233725['attrReport']||(_0x233725[_0x8661('0x5d')]&&_0x233725['attrs'][0x0]?_0x233725['attrs'][0x0][_0x8661('0x61')]:undefined)||null},{'name':'attrRefresh','value':_0x233725['attrRefresh']||(_0x233725[_0x8661('0x5d')]&&_0x233725[_0x8661('0x5d')][0x1]?_0x233725['attrs'][0x1][_0x8661('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x5a7684){logger[_0x8661('0x28')](_0x8661('0x7b'),JSON[_0x8661('0x7c')](_0x5a7684));return[];}}exports['addItem']=function(_0x2820d9,_0x1369e5,_0x397612){if(_0x2820d9[_0x8661('0x4d')]['id']){delete _0x2820d9[_0x8661('0x4d')]['id'];}return db[_0x8661('0x2e')][_0x8661('0x52')]({'where':{'id':_0x2820d9[_0x8661('0x4b')]['id']}})[_0x8661('0x24')](handleEntityNotFound(_0x1369e5,null))[_0x8661('0x24')](function(_0x1317f2){if(_0x1317f2){_0x2820d9['body'][_0x8661('0x7d')]=_0x1317f2['id'];_0x2820d9['body'][_0x8661('0x5d')]=widgetAttributes(_0x2820d9['body']);return db['DashboardItem']['create'](_0x2820d9['body']);}})[_0x8661('0x24')](respondWithResult(_0x1369e5,null))['catch'](handleError(_0x1369e5,null));};exports[_0x8661('0x7e')]=function(_0x20f57d,_0x54fc9e,_0x1af33a){var _0x2d3bc7={};var _0x2d3b17={};var _0x470247;var _0x1e77f7;return db[_0x8661('0x2e')][_0x8661('0x7f')]({'where':{'id':_0x20f57d[_0x8661('0x4b')]['id']}})[_0x8661('0x24')](handleEntityNotFound(_0x54fc9e,null))['then'](function(_0x1c299c){if(_0x1c299c){_0x470247=_0x1c299c;_0x2d3b17['model']=_[_0x8661('0x34')](db[_0x8661('0x80')][_0x8661('0x2f')]);_0x2d3b17['query']=_[_0x8661('0x34')](_0x20f57d[_0x8661('0x35')]);_0x2d3b17['filters']=_[_0x8661('0x37')](_0x2d3b17[_0x8661('0x33')],_0x2d3b17['query']);_0x2d3bc7['attributes']=_[_0x8661('0x37')](_0x2d3b17['model'],qs['fields'](_0x20f57d[_0x8661('0x35')][_0x8661('0x38')]));_0x2d3bc7[_0x8661('0x36')]=_0x2d3bc7['attributes'][_0x8661('0x39')]?_0x2d3bc7[_0x8661('0x36')]:_0x2d3b17[_0x8661('0x33')];_0x2d3bc7[_0x8661('0x3c')]=qs[_0x8661('0x3d')](_0x20f57d[_0x8661('0x35')]['sort']);_0x2d3bc7[_0x8661('0x41')]=qs[_0x8661('0x3e')](_[_0x8661('0x81')](_0x20f57d[_0x8661('0x35')],_0x2d3b17[_0x8661('0x3e')]));if(_0x20f57d[_0x8661('0x35')][_0x8661('0x3f')]){_0x2d3bc7[_0x8661('0x41')]=_['merge'](_0x2d3bc7[_0x8661('0x41')],{'$or':_['map'](_0x2d3bc7[_0x8661('0x36')],function(_0x5684f8){var _0x493fc6={};_0x493fc6[_0x5684f8]={'$like':'%'+_0x20f57d[_0x8661('0x35')][_0x8661('0x3f')]+'%'};return _0x493fc6;})});}_0x2d3bc7=_['merge']({},_0x2d3bc7,_0x20f57d[_0x8661('0x43')]);return _0x470247[_0x8661('0x7e')](_0x2d3bc7);}})['then'](function(_0x2de2c1){if(_0x2de2c1){_0x1e77f7=_0x2de2c1[_0x8661('0x39')];if(!_0x20f57d[_0x8661('0x35')][_0x8661('0x3a')](_0x8661('0x3b'))){_0x2d3bc7['limit']=qs['limit'](_0x20f57d['query'][_0x8661('0x20')]);_0x2d3bc7[_0x8661('0x1e')]=qs[_0x8661('0x1e')](_0x20f57d[_0x8661('0x35')][_0x8661('0x1e')]);}return _0x470247['getItems'](_0x2d3bc7);}})[_0x8661('0x24')](function(_0x388d72){if(_0x388d72){return _0x388d72?{'count':_0x1e77f7,'rows':_0x388d72}:null;}})[_0x8661('0x24')](respondWithResult(_0x54fc9e,null))[_0x8661('0x49')](handleError(_0x54fc9e,null));}; \ No newline at end of file +var _0x2894=['web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','findOne','map','getItems','eml-format','rimraf','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./dashboard.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','CustomDashboards','UserProfileResource','end','error','name','index','Dashboard','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrFaxAccounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2894,0x10e));var _0x4289=function(_0x2731f0,_0x126b1b){_0x2731f0=_0x2731f0-0x0;var _0x36a180=_0x2894[_0x2731f0];return _0x36a180;};'use strict';var emlformat=require(_0x4289('0x0'));var rimraf=require(_0x4289('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4289('0x2'));var moment=require(_0x4289('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4289('0x4'));var util=require('util');var path=require(_0x4289('0x5'));var sox=require(_0x4289('0x6'));var csv=require(_0x4289('0x7'));var ejs=require(_0x4289('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4289('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4289('0xa'));var deskjs=require(_0x4289('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4289('0xc'));var authService=require(_0x4289('0xd'));var qs=require(_0x4289('0xe'));var as=require(_0x4289('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4289('0x10'))('api');var utils=require(_0x4289('0x11'));var config=require(_0x4289('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x4289('0x13'))['db'];config[_0x4289('0x14')]=_[_0x4289('0x15')](config[_0x4289('0x14')],{'host':_0x4289('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4289('0x14')]));require(_0x4289('0x17'))[_0x4289('0x18')](socket);function respondWithStatusCode(_0x25c0de,_0xf008db){_0xf008db=_0xf008db||0xcc;return function(_0x4b0a41){if(_0x4b0a41){return _0x25c0de[_0x4289('0x19')](_0xf008db);}return _0x25c0de[_0x4289('0x1a')](_0xf008db)['end']();};}function respondWithResult(_0x13e6a4,_0x4e5322){_0x4e5322=_0x4e5322||0xc8;return function(_0x481c97){if(_0x481c97){return _0x13e6a4['status'](_0x4e5322)[_0x4289('0x1b')](_0x481c97);}};}function respondWithFilteredResult(_0x47e258,_0x12bd1e){return function(_0x5a685f){if(_0x5a685f){var _0x1da894=typeof _0x12bd1e[_0x4289('0x1c')]===_0x4289('0x1d')&&typeof _0x12bd1e['limit']===_0x4289('0x1d');var _0x40c127=_0x5a685f[_0x4289('0x1e')];var _0x520b87=_0x1da894?0x0:_0x12bd1e[_0x4289('0x1c')];var _0x2d7ff7=_0x1da894?_0x5a685f['count']:_0x12bd1e[_0x4289('0x1c')]+_0x12bd1e[_0x4289('0x1f')];var _0x3ce04a;if(_0x2d7ff7>=_0x40c127){_0x2d7ff7=_0x40c127;_0x3ce04a=0xc8;}else{_0x3ce04a=0xce;}_0x47e258['status'](_0x3ce04a);return _0x47e258[_0x4289('0x20')](_0x4289('0x21'),_0x520b87+'-'+_0x2d7ff7+'/'+_0x40c127)['json'](_0x5a685f);}return null;};}function patchUpdates(_0x4842e7){return function(_0x3d2078){try{jsonpatch['apply'](_0x3d2078,_0x4842e7,!![]);}catch(_0x331a65){return BPromise[_0x4289('0x22')](_0x331a65);}return _0x3d2078[_0x4289('0x23')]();};}function saveUpdates(_0x2604fa,_0x30bd5a){return function(_0x2fbcdf){if(_0x2fbcdf){return _0x2fbcdf[_0x4289('0x24')](_0x2604fa)[_0x4289('0x25')](function(_0x2ec9fa){return _0x2ec9fa;});}return null;};}function removeEntity(_0x460365,_0x1a82a2){return function(_0x5e0938){if(_0x5e0938){return _0x5e0938[_0x4289('0x26')]()[_0x4289('0x25')](function(){var _0x21ee9a=_0x5e0938['get']({'plain':!![]});var _0x54cc59=_0x4289('0x27');return db[_0x4289('0x28')][_0x4289('0x26')]({'where':{'type':_0x54cc59,'resourceId':_0x21ee9a['id']}})[_0x4289('0x25')](function(){return _0x5e0938;});})[_0x4289('0x25')](function(){_0x460365[_0x4289('0x1a')](0xcc)[_0x4289('0x29')]();});}};}function handleEntityNotFound(_0x2e506c,_0x5e765a){return function(_0x5b516d){if(!_0x5b516d){_0x2e506c[_0x4289('0x19')](0x194);}return _0x5b516d;};}function handleError(_0x3c5f91,_0x22e5e4){_0x22e5e4=_0x22e5e4||0x1f4;return function(_0x267e4d){logger[_0x4289('0x2a')](_0x267e4d['stack']);if(_0x267e4d[_0x4289('0x2b')]){delete _0x267e4d[_0x4289('0x2b')];}_0x3c5f91['status'](_0x22e5e4)['send'](_0x267e4d);};}exports[_0x4289('0x2c')]=function(_0x5bd834,_0x1fbc77){var _0x12a8b3={},_0x3c3484={},_0x4220ee={'count':0x0,'rows':[]};var _0x1ba1c6=_['map'](db[_0x4289('0x2d')][_0x4289('0x2e')],function(_0x35fa5c){return{'name':_0x35fa5c['fieldName'],'type':_0x35fa5c['type'][_0x4289('0x2f')]};});_0x3c3484[_0x4289('0x30')]=_['map'](_0x1ba1c6,_0x4289('0x2b'));_0x3c3484[_0x4289('0x31')]=_[_0x4289('0x32')](_0x5bd834[_0x4289('0x31')]);_0x3c3484['filters']=_['intersection'](_0x3c3484[_0x4289('0x30')],_0x3c3484[_0x4289('0x31')]);_0x12a8b3[_0x4289('0x33')]=_[_0x4289('0x34')](_0x3c3484[_0x4289('0x30')],qs[_0x4289('0x35')](_0x5bd834[_0x4289('0x31')][_0x4289('0x35')]));_0x12a8b3[_0x4289('0x33')]=_0x12a8b3['attributes'][_0x4289('0x36')]?_0x12a8b3[_0x4289('0x33')]:_0x3c3484[_0x4289('0x30')];if(!_0x5bd834['query'][_0x4289('0x37')](_0x4289('0x38'))){_0x12a8b3[_0x4289('0x1f')]=qs[_0x4289('0x1f')](_0x5bd834[_0x4289('0x31')][_0x4289('0x1f')]);_0x12a8b3['offset']=qs[_0x4289('0x1c')](_0x5bd834[_0x4289('0x31')][_0x4289('0x1c')]);}_0x12a8b3[_0x4289('0x39')]=qs[_0x4289('0x3a')](_0x5bd834[_0x4289('0x31')][_0x4289('0x3a')]);_0x12a8b3[_0x4289('0x3b')]=qs[_0x4289('0x3c')](_[_0x4289('0x3d')](_0x5bd834['query'],_0x3c3484['filters']),_0x1ba1c6);if(_0x5bd834[_0x4289('0x31')][_0x4289('0x3e')]){_0x12a8b3[_0x4289('0x3b')]=_[_0x4289('0x3f')](_0x12a8b3[_0x4289('0x3b')],{'$or':_['map'](_0x1ba1c6,function(_0x86b22e){if(_0x86b22e[_0x4289('0x40')]!==_0x4289('0x41')){var _0x4bf0f1={};_0x4bf0f1[_0x86b22e[_0x4289('0x2b')]]={'$like':'%'+_0x5bd834[_0x4289('0x31')][_0x4289('0x3e')]+'%'};return _0x4bf0f1;}})});}_0x12a8b3=_[_0x4289('0x3f')]({},_0x12a8b3,_0x5bd834['options']);var _0x5de38d={'where':_0x12a8b3[_0x4289('0x3b')]};return db[_0x4289('0x2d')][_0x4289('0x1e')](_0x5de38d)['then'](function(_0x3f1120){_0x4220ee[_0x4289('0x1e')]=_0x3f1120;if(_0x5bd834['query'][_0x4289('0x42')]){_0x12a8b3[_0x4289('0x43')]=[{'all':!![]}];}return db[_0x4289('0x2d')][_0x4289('0x44')](_0x12a8b3);})[_0x4289('0x25')](function(_0x34608f){_0x4220ee[_0x4289('0x45')]=_0x34608f;return _0x4220ee;})['then'](respondWithFilteredResult(_0x1fbc77,_0x12a8b3))[_0x4289('0x46')](handleError(_0x1fbc77,null));};exports[_0x4289('0x47')]=function(_0xe12fe0,_0x10b66d){var _0x173106={'raw':![],'where':{'id':_0xe12fe0[_0x4289('0x48')]['id']}},_0x569ba8={};_0x569ba8[_0x4289('0x30')]=_['keys'](db[_0x4289('0x2d')][_0x4289('0x2e')]);_0x569ba8[_0x4289('0x31')]=_[_0x4289('0x32')](_0xe12fe0['query']);_0x569ba8[_0x4289('0x3c')]=_['intersection'](_0x569ba8[_0x4289('0x30')],_0x569ba8[_0x4289('0x31')]);_0x173106[_0x4289('0x33')]=_[_0x4289('0x34')](_0x569ba8[_0x4289('0x30')],qs[_0x4289('0x35')](_0xe12fe0['query']['fields']));_0x173106[_0x4289('0x33')]=_0x173106[_0x4289('0x33')]['length']?_0x173106[_0x4289('0x33')]:_0x569ba8[_0x4289('0x30')];if(_0xe12fe0[_0x4289('0x31')]['includeAll']){_0x173106[_0x4289('0x43')]=[{'all':!![]}];}_0x173106=_[_0x4289('0x3f')]({},_0x173106,_0xe12fe0[_0x4289('0x49')]);return db[_0x4289('0x2d')][_0x4289('0x4a')](_0x173106)[_0x4289('0x25')](handleEntityNotFound(_0x10b66d,null))[_0x4289('0x25')](respondWithResult(_0x10b66d,null))[_0x4289('0x46')](handleError(_0x10b66d,null));};exports[_0x4289('0x4b')]=function(_0x2815da,_0x21ed77){return db[_0x4289('0x2d')][_0x4289('0x4b')](_0x2815da[_0x4289('0x4c')],{})[_0x4289('0x25')](function(_0x1cb47c){var _0x4d5bbb=_0x2815da['user'][_0x4289('0x4d')]({'plain':!![]});if(!_0x4d5bbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d5bbb['role']==='user'){var _0xc47818=_0x1cb47c[_0x4289('0x4d')]({'plain':!![]});var _0x50a5c0=_0x4289('0x27');return db[_0x4289('0x4e')][_0x4289('0x4a')]({'where':{'name':_0x50a5c0,'userProfileId':_0x4d5bbb[_0x4289('0x4f')]},'raw':!![]})[_0x4289('0x25')](function(_0x57d02f){if(_0x57d02f&&_0x57d02f[_0x4289('0x50')]===0x0){return db['UserProfileResource'][_0x4289('0x4b')]({'name':_0xc47818['name'],'resourceId':_0xc47818['id'],'type':_0x57d02f[_0x4289('0x2b')],'sectionId':_0x57d02f['id']},{})['then'](function(){return _0x1cb47c;});}else{return _0x1cb47c;}})['catch'](function(_0x4716eb){logger[_0x4289('0x2a')](_0x4289('0x51'),_0x4716eb);throw _0x4716eb;});}return _0x1cb47c;})['then'](respondWithResult(_0x21ed77,0xc9))[_0x4289('0x46')](handleError(_0x21ed77,null));};exports[_0x4289('0x52')]=function(_0x39ca1f,_0x148a82){var _0x2ac953={'where':{'id':_0x39ca1f[_0x4289('0x48')]['id']}},_0x747564={};_0x747564[_0x4289('0x30')]=_[_0x4289('0x32')](db[_0x4289('0x2d')][_0x4289('0x2e')]);_0x2ac953[_0x4289('0x33')]=_[_0x4289('0x34')](_0x747564[_0x4289('0x30')],qs['fields'](_0x39ca1f[_0x4289('0x31')][_0x4289('0x35')]));_0x2ac953[_0x4289('0x33')]=_0x2ac953[_0x4289('0x33')]['length']?_0x2ac953['attributes']:_0x747564[_0x4289('0x30')];if(_0x39ca1f[_0x4289('0x31')][_0x4289('0x42')]){_0x2ac953[_0x4289('0x43')]=[{'all':!![]}];}_0x2ac953=_[_0x4289('0x3f')]({},_0x2ac953,_0x39ca1f['options']);return db['Dashboard'][_0x4289('0x4a')](_0x2ac953)['then'](handleEntityNotFound(_0x148a82,null))[_0x4289('0x25')](function(_0x19f253){if(_0x19f253){var _0x52bcea=_0x19f253[_0x4289('0x4d')]({'plain':!![]});_0x52bcea=qs[_0x4289('0x53')](_0x52bcea,['id','createdAt',_0x4289('0x54')]);_0x39ca1f[_0x4289('0x4c')]=_[_0x4289('0x53')](_0x39ca1f['body'],['id',_0x4289('0x55'),_0x4289('0x54')]);return db[_0x4289('0x2d')]['create'](_['merge'](_0x52bcea,_0x39ca1f[_0x4289('0x4c')]),{'include':_0x39ca1f[_0x4289('0x31')][_0x4289('0x42')]?[{'all':!![]}]:undefined})[_0x4289('0x25')](function(_0x2e2cd7){var _0xeb4987=_0x39ca1f[_0x4289('0x56')][_0x4289('0x4d')]({'plain':!![]});if(!_0xeb4987)throw new Error(_0x4289('0x57'));if(_0xeb4987[_0x4289('0x58')]===_0x4289('0x56')){var _0x1e6890=_0x2e2cd7['get']({'plain':!![]});var _0x5b4a92='CustomDashboards';return db[_0x4289('0x4e')]['find']({'where':{'name':_0x5b4a92,'userProfileId':_0xeb4987[_0x4289('0x4f')]},'raw':!![]})[_0x4289('0x25')](function(_0x59baf0){if(_0x59baf0&&_0x59baf0[_0x4289('0x50')]===0x0){return db['UserProfileResource'][_0x4289('0x4b')]({'name':_0x1e6890[_0x4289('0x2b')],'resourceId':_0x1e6890['id'],'type':_0x59baf0[_0x4289('0x2b')],'sectionId':_0x59baf0['id']},{})['then'](function(){return _0x2e2cd7;});}else{return _0x2e2cd7;}})['catch'](function(_0xa24ee6){logger['error'](_0x4289('0x51'),_0xa24ee6);throw _0xa24ee6;});}return _0x2e2cd7;});}})[_0x4289('0x25')](respondWithResult(_0x148a82,0xc9))[_0x4289('0x46')](handleError(_0x148a82,null));};exports[_0x4289('0x24')]=function(_0x1def61,_0x317e41){if(_0x1def61['body']['id']){delete _0x1def61[_0x4289('0x4c')]['id'];}return db[_0x4289('0x2d')][_0x4289('0x4a')]({'where':{'id':_0x1def61[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x317e41,null))[_0x4289('0x25')](saveUpdates(_0x1def61[_0x4289('0x4c')],null))[_0x4289('0x25')](respondWithResult(_0x317e41,null))[_0x4289('0x46')](handleError(_0x317e41,null));};exports[_0x4289('0x26')]=function(_0x43bc7b,_0x571998){return db[_0x4289('0x2d')][_0x4289('0x4a')]({'where':{'id':_0x43bc7b[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x571998,null))[_0x4289('0x25')](removeEntity(_0x571998,null))[_0x4289('0x46')](handleError(_0x571998,null));};function widgetAttributes(_0x19c535){try{switch(_0x19c535[_0x4289('0x40')]){case _0x4289('0x59'):return[{'name':_0x4289('0x5a'),'value':_0x19c535[_0x4289('0x5a')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535['attrs'][0x0]['value']:undefined)||_0x4289('0x5c')}];case _0x4289('0x5d'):return[{'name':_0x4289('0x5e'),'value':_0x19c535[_0x4289('0x5e')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||''}];case _0x4289('0x60'):return[{'name':'attrHourFormat','value':_0x19c535[_0x4289('0x61')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x62')},{'name':_0x4289('0x63'),'value':_0x19c535[_0x4289('0x63')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535['attrs'][0x1]['value']:undefined)||_0x4289('0x64')},{'name':_0x4289('0x65'),'value':_0x19c535[_0x4289('0x65')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x2]?_0x19c535['attrs'][0x2][_0x4289('0x5f')]:undefined)||0xc}];case _0x4289('0x66'):return[{'name':'attrMetric','value':_0x19c535[_0x4289('0x67')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x68')},{'name':'attrVoiceQueues','value':_0x19c535[_0x4289('0x69')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535['attrs'][0x1]['value']:undefined)||[]},{'name':_0x4289('0x65'),'value':_0x19c535[_0x4289('0x65')]||(_0x19c535['attrs']&&_0x19c535['attrs'][0x2]?_0x19c535[_0x4289('0x5b')][0x2][_0x4289('0x5f')]:undefined)||0x14},{'name':_0x4289('0x6a'),'value':_0x19c535[_0x4289('0x6a')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x3]?_0x19c535[_0x4289('0x5b')][0x3][_0x4289('0x5f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x19c535[_0x4289('0x6b')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x4]?_0x19c535[_0x4289('0x5b')][0x4][_0x4289('0x5f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x19c535['attrFaxAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x5]?_0x19c535['attrs'][0x5][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6c'),'value':_0x19c535[_0x4289('0x6c')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x6]?_0x19c535['attrs'][0x6][_0x4289('0x5f')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x19c535[_0x4289('0x6d')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x7]?_0x19c535[_0x4289('0x5b')][0x7][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6e'),'value':_0x19c535[_0x4289('0x6e')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x8]?_0x19c535['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x19c535[_0x4289('0x6f')]||(_0x19c535['attrs']&&_0x19c535['attrs'][0x9]?_0x19c535['attrs'][0x9][_0x4289('0x5f')]:undefined)||''}];case _0x4289('0x70'):case _0x4289('0x71'):return[{'name':_0x4289('0x72'),'value':_0x19c535[_0x4289('0x72')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||_0x4289('0x68')},{'name':_0x4289('0x73'),'value':_0x19c535[_0x4289('0x73')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535[_0x4289('0x5b')][0x1][_0x4289('0x5f')]:undefined)||null},{'name':'attrSerie3','value':_0x19c535['attrSerie3']||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x2]?_0x19c535[_0x4289('0x5b')][0x2][_0x4289('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x19c535[_0x4289('0x69')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x3]?_0x19c535[_0x4289('0x5b')][0x3][_0x4289('0x5f')]:undefined)||[]},{'name':_0x4289('0x6a'),'value':_0x19c535[_0x4289('0x6a')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x4]?_0x19c535[_0x4289('0x5b')][0x4]['value']:undefined)||'voice'},{'name':_0x4289('0x6b'),'value':_0x19c535[_0x4289('0x6b')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x5]?_0x19c535['attrs'][0x5][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x74'),'value':_0x19c535[_0x4289('0x74')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x6]?_0x19c535[_0x4289('0x5b')][0x6][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6c'),'value':_0x19c535['attrSmsAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x7]?_0x19c535[_0x4289('0x5b')][0x7][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6d'),'value':_0x19c535['attrOpenchannelAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x8]?_0x19c535['attrs'][0x8]['value']:undefined)||''},{'name':_0x4289('0x6e'),'value':_0x19c535['attrWhatsappAccounts']||(_0x19c535[_0x4289('0x5b')]&&_0x19c535['attrs'][0x9]?_0x19c535[_0x4289('0x5b')][0x9][_0x4289('0x5f')]:undefined)||''},{'name':_0x4289('0x6f'),'value':_0x19c535[_0x4289('0x6f')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0xa]?_0x19c535[_0x4289('0x5b')][0xa]['value']:undefined)||''}];case _0x4289('0x75'):return[{'name':'attrReport','type':_0x19c535[_0x4289('0x76')]||(_0x19c535['attrs']&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535['attrs'][0x0][_0x4289('0x40')]:undefined)||null,'value':_0x19c535[_0x4289('0x77')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x0]?_0x19c535[_0x4289('0x5b')][0x0][_0x4289('0x5f')]:undefined)||null},{'name':_0x4289('0x78'),'value':_0x19c535[_0x4289('0x78')]||(_0x19c535[_0x4289('0x5b')]&&_0x19c535[_0x4289('0x5b')][0x1]?_0x19c535[_0x4289('0x5b')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2c9283){logger[_0x4289('0x2a')](_0x4289('0x79'),JSON[_0x4289('0x7a')](_0x2c9283));return[];}}exports[_0x4289('0x7b')]=function(_0x301696,_0x28fc5c,_0x43e139){if(_0x301696[_0x4289('0x4c')]['id']){delete _0x301696[_0x4289('0x4c')]['id'];}return db['Dashboard'][_0x4289('0x4a')]({'where':{'id':_0x301696[_0x4289('0x48')]['id']}})[_0x4289('0x25')](handleEntityNotFound(_0x28fc5c,null))[_0x4289('0x25')](function(_0x197c2b){if(_0x197c2b){_0x301696[_0x4289('0x4c')][_0x4289('0x7c')]=_0x197c2b['id'];_0x301696[_0x4289('0x4c')][_0x4289('0x5b')]=widgetAttributes(_0x301696['body']);return db[_0x4289('0x7d')][_0x4289('0x4b')](_0x301696['body']);}})['then'](respondWithResult(_0x28fc5c,null))[_0x4289('0x46')](handleError(_0x28fc5c,null));};exports['getItems']=function(_0x3632e1,_0x24cd88,_0x52a016){var _0x2eb954={};var _0x1852f4={};var _0x54defb;var _0x2d961a;return db[_0x4289('0x2d')][_0x4289('0x7e')]({'where':{'id':_0x3632e1[_0x4289('0x48')]['id']}})['then'](handleEntityNotFound(_0x24cd88,null))[_0x4289('0x25')](function(_0x104942){if(_0x104942){_0x54defb=_0x104942;_0x1852f4['model']=_[_0x4289('0x32')](db['DashboardItem'][_0x4289('0x2e')]);_0x1852f4[_0x4289('0x31')]=_[_0x4289('0x32')](_0x3632e1['query']);_0x1852f4[_0x4289('0x3c')]=_['intersection'](_0x1852f4['model'],_0x1852f4[_0x4289('0x31')]);_0x2eb954['attributes']=_[_0x4289('0x34')](_0x1852f4[_0x4289('0x30')],qs[_0x4289('0x35')](_0x3632e1[_0x4289('0x31')][_0x4289('0x35')]));_0x2eb954[_0x4289('0x33')]=_0x2eb954['attributes'][_0x4289('0x36')]?_0x2eb954['attributes']:_0x1852f4['model'];_0x2eb954['order']=qs[_0x4289('0x3a')](_0x3632e1[_0x4289('0x31')]['sort']);_0x2eb954[_0x4289('0x3b')]=qs[_0x4289('0x3c')](_['pick'](_0x3632e1[_0x4289('0x31')],_0x1852f4['filters']));if(_0x3632e1[_0x4289('0x31')][_0x4289('0x3e')]){_0x2eb954[_0x4289('0x3b')]=_[_0x4289('0x3f')](_0x2eb954[_0x4289('0x3b')],{'$or':_[_0x4289('0x7f')](_0x2eb954[_0x4289('0x33')],function(_0x3e3b7d){var _0x36b68d={};_0x36b68d[_0x3e3b7d]={'$like':'%'+_0x3632e1[_0x4289('0x31')][_0x4289('0x3e')]+'%'};return _0x36b68d;})});}_0x2eb954=_[_0x4289('0x3f')]({},_0x2eb954,_0x3632e1['options']);return _0x54defb[_0x4289('0x80')](_0x2eb954);}})[_0x4289('0x25')](function(_0x42cbe7){if(_0x42cbe7){_0x2d961a=_0x42cbe7[_0x4289('0x36')];if(!_0x3632e1['query'][_0x4289('0x37')](_0x4289('0x38'))){_0x2eb954[_0x4289('0x1f')]=qs[_0x4289('0x1f')](_0x3632e1[_0x4289('0x31')][_0x4289('0x1f')]);_0x2eb954[_0x4289('0x1c')]=qs[_0x4289('0x1c')](_0x3632e1[_0x4289('0x31')][_0x4289('0x1c')]);}return _0x54defb[_0x4289('0x80')](_0x2eb954);}})[_0x4289('0x25')](function(_0x3e0505){if(_0x3e0505){return _0x3e0505?{'count':_0x2d961a,'rows':_0x3e0505}:null;}})[_0x4289('0x25')](respondWithResult(_0x24cd88,null))[_0x4289('0x46')](handleError(_0x24cd88,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 768be9a..38008ef 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 _0x5f83=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x37cecb,_0x19ff88){var _0x2afff8=function(_0x5d76d9){while(--_0x5d76d9){_0x37cecb['push'](_0x37cecb['shift']());}};_0x2afff8(++_0x19ff88);}(_0x5f83,0x8f));var _0x35f8=function(_0x29757d,_0x5a099f){_0x29757d=_0x29757d-0x0;var _0x2f126d=_0x5f83[_0x29757d];return _0x2f126d;};'use strict';var EventEmitter=require(_0x35f8('0x0'));var Dashboard=require(_0x35f8('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x35f8('0x2')](0x0);var events={'afterCreate':_0x35f8('0x3'),'afterUpdate':_0x35f8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1943e2){return function(_0x1d2ecf,_0x452604,_0x5296da){DashboardEvents[_0x35f8('0x5')](_0x1943e2+':'+_0x1d2ecf['id'],_0x1d2ecf);DashboardEvents['emit'](_0x1943e2,_0x1d2ecf);_0x5296da(null);};}for(var e in events){if(events[_0x35f8('0x6')](e)){var event=events[e];Dashboard[_0x35f8('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file +var _0x8068=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x4128b4,_0x16b449){var _0x26ac2f=function(_0x181ae0){while(--_0x181ae0){_0x4128b4['push'](_0x4128b4['shift']());}};_0x26ac2f(++_0x16b449);}(_0x8068,0x1a0));var _0x8806=function(_0x57ed68,_0x13cab4){_0x57ed68=_0x57ed68-0x0;var _0x5a46f9=_0x8068[_0x57ed68];return _0x5a46f9;};'use strict';var EventEmitter=require(_0x8806('0x0'));var Dashboard=require(_0x8806('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8806('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8806('0x3'),'afterDestroy':_0x8806('0x4')};function emitEvent(_0x374e57){return function(_0x230d06,_0x49db26,_0x42ca84){DashboardEvents['emit'](_0x374e57+':'+_0x230d06['id'],_0x230d06);DashboardEvents[_0x8806('0x5')](_0x374e57,_0x230d06);_0x42ca84(null);};}for(var e in events){if(events[_0x8806('0x6')](e)){var event=events[e];Dashboard[_0x8806('0x7')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index f3c725d..deaf0de 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 _0xb659=['util','../../config/logger','bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','Dashboard','dashboards','lodash'];(function(_0x346d45,_0x6db175){var _0x548330=function(_0x41e453){while(--_0x41e453){_0x346d45['push'](_0x346d45['shift']());}};_0x548330(++_0x6db175);}(_0xb659,0x15f));var _0x9b65=function(_0x397396,_0x4f2b10){_0x397396=_0x397396-0x0;var _0x3c1c53=_0xb659[_0x397396];return _0x3c1c53;};'use strict';var _=require(_0x9b65('0x0'));var util=require(_0x9b65('0x1'));var logger=require(_0x9b65('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9b65('0x3'));var rp=require(_0x9b65('0x4'));var fs=require('fs');var path=require(_0x9b65('0x5'));var rimraf=require(_0x9b65('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b65('0x7'));module[_0x9b65('0x8')]=function(_0x11e37d,_0xff3f20){return _0x11e37d['define'](_0x9b65('0x9'),attributes,{'tableName':_0x9b65('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0bb5=['bluebird','request-promise','path','rimraf','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','api','moment'];(function(_0x28ac84,_0x2a75fa){var _0x10c42a=function(_0x90b045){while(--_0x90b045){_0x28ac84['push'](_0x28ac84['shift']());}};_0x10c42a(++_0x2a75fa);}(_0x0bb5,0xb1));var _0x50bb=function(_0x519dbb,_0x30cdb8){_0x519dbb=_0x519dbb-0x0;var _0x378c23=_0x0bb5[_0x519dbb];return _0x378c23;};'use strict';var _=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var logger=require(_0x50bb('0x2'))(_0x50bb('0x3'));var moment=require(_0x50bb('0x4'));var BPromise=require(_0x50bb('0x5'));var rp=require(_0x50bb('0x6'));var fs=require('fs');var path=require(_0x50bb('0x7'));var rimraf=require(_0x50bb('0x8'));var config=require('../../config/environment');var attributes=require(_0x50bb('0x9'));module[_0x50bb('0xa')]=function(_0x34d854,_0x29a0e8){return _0x34d854[_0x50bb('0xb')](_0x50bb('0xc'),attributes,{'tableName':_0x50bb('0xd'),'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 f38628f..c88c0a8 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 _0xc2b7=['client','http','redis','localhost','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4500cd,_0x2464a5){var _0x482596=function(_0x207fb0){while(--_0x207fb0){_0x4500cd['push'](_0x4500cd['shift']());}};_0x482596(++_0x2464a5);}(_0xc2b7,0x197));var _0x7c2b=function(_0x72e945,_0x109cc9){_0x72e945=_0x72e945-0x0;var _0x36f91a=_0xc2b7[_0x72e945];return _0x36f91a;};'use strict';var _=require(_0x7c2b('0x0'));var util=require(_0x7c2b('0x1'));var moment=require(_0x7c2b('0x2'));var BPromise=require('bluebird');var rs=require(_0x7c2b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7c2b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c2b('0x5'))(_0x7c2b('0x6'));var config=require(_0x7c2b('0x7'));var jayson=require(_0x7c2b('0x8'));var client=jayson[_0x7c2b('0x9')][_0x7c2b('0xa')]({'port':0x232a});config[_0x7c2b('0xb')]=_['defaults'](config[_0x7c2b('0xb')],{'host':_0x7c2b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c2b('0xb')]));require(_0x7c2b('0xd'))[_0x7c2b('0xe')](socket);function respondWithRpcPromise(_0x40c7ee,_0xceed83,_0x2cd001){return new BPromise(function(_0x18adbf,_0x398505){return client[_0x7c2b('0xf')](_0x40c7ee,_0x2cd001)['then'](function(_0x597f03){logger[_0x7c2b('0x10')](_0x7c2b('0x11'),_0xceed83,_0x7c2b('0x12'));logger['debug'](_0x7c2b('0x13'),_0xceed83,_0x7c2b('0x12'),JSON[_0x7c2b('0x14')](_0x597f03));if(_0x597f03[_0x7c2b('0x15')]){if(_0x597f03['error'][_0x7c2b('0x16')]===0x1f4){logger['error'](_0x7c2b('0x11'),_0xceed83,_0x597f03['error'][_0x7c2b('0x17')]);return _0x398505(_0x597f03['error'][_0x7c2b('0x17')]);}logger[_0x7c2b('0x15')](_0x7c2b('0x11'),_0xceed83,_0x597f03[_0x7c2b('0x15')][_0x7c2b('0x17')]);return _0x18adbf(_0x597f03[_0x7c2b('0x15')]['message']);}else{logger[_0x7c2b('0x10')](_0x7c2b('0x11'),_0xceed83,_0x7c2b('0x12'));_0x18adbf(_0x597f03[_0x7c2b('0x18')]['message']);}})[_0x7c2b('0x19')](function(_0x25a3eb){logger[_0x7c2b('0x15')](_0x7c2b('0x11'),_0xceed83,_0x25a3eb);_0x398505(_0x25a3eb);});});} \ No newline at end of file +var _0x2705=['localhost','./dashboard.socket','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults'];(function(_0x1de42f,_0x360043){var _0x5a9ac4=function(_0x1141a9){while(--_0x1141a9){_0x1de42f['push'](_0x1de42f['shift']());}};_0x5a9ac4(++_0x360043);}(_0x2705,0x11d));var _0x5270=function(_0x1cc9f7,_0x3f250c){_0x1cc9f7=_0x1cc9f7-0x0;var _0x52257a=_0x2705[_0x1cc9f7];return _0x52257a;};'use strict';var _=require(_0x5270('0x0'));var util=require(_0x5270('0x1'));var moment=require(_0x5270('0x2'));var BPromise=require(_0x5270('0x3'));var rs=require(_0x5270('0x4'));var fs=require('fs');var Redis=require(_0x5270('0x5'));var db=require(_0x5270('0x6'))['db'];var utils=require(_0x5270('0x7'));var logger=require(_0x5270('0x8'))(_0x5270('0x9'));var config=require(_0x5270('0xa'));var jayson=require(_0x5270('0xb'));var client=jayson[_0x5270('0xc')]['http']({'port':0x232a});config[_0x5270('0xd')]=_[_0x5270('0xe')](config['redis'],{'host':_0x5270('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5270('0xd')]));require(_0x5270('0x10'))[_0x5270('0x11')](socket);function respondWithRpcPromise(_0x58610f,_0x327167,_0x46111e){return new BPromise(function(_0x194305,_0x5757aa){return client[_0x5270('0x12')](_0x58610f,_0x46111e)[_0x5270('0x13')](function(_0x18e37e){logger['info']('Dashboard,\x20%s,\x20%s',_0x327167,_0x5270('0x14'));logger[_0x5270('0x15')](_0x5270('0x16'),_0x327167,'request\x20sent',JSON['stringify'](_0x18e37e));if(_0x18e37e[_0x5270('0x17')]){if(_0x18e37e[_0x5270('0x17')][_0x5270('0x18')]===0x1f4){logger[_0x5270('0x17')]('Dashboard,\x20%s,\x20%s',_0x327167,_0x18e37e['error'][_0x5270('0x19')]);return _0x5757aa(_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);}logger[_0x5270('0x17')](_0x5270('0x1a'),_0x327167,_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);return _0x194305(_0x18e37e[_0x5270('0x17')][_0x5270('0x19')]);}else{logger[_0x5270('0x1b')](_0x5270('0x1a'),_0x327167,_0x5270('0x14'));_0x194305(_0x18e37e[_0x5270('0x1c')][_0x5270('0x19')]);}})[_0x5270('0x1d')](function(_0xdd3a0d){logger[_0x5270('0x17')](_0x5270('0x1a'),_0x327167,_0xdd3a0d);_0x5757aa(_0xdd3a0d);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index dcc523f..7eb8a11 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 _0xa2f7=['emit','removeListener','register','length','dashboard:','./dashboard.events','save','remove'];(function(_0x445d05,_0x6b7fba){var _0x19ca7d=function(_0x1e6e2c){while(--_0x1e6e2c){_0x445d05['push'](_0x445d05['shift']());}};_0x19ca7d(++_0x6b7fba);}(_0xa2f7,0x115));var _0x7a2f=function(_0x2e44f9,_0x339904){_0x2e44f9=_0x2e44f9-0x0;var _0x147ee7=_0xa2f7[_0x2e44f9];return _0x147ee7;};'use strict';var DashboardEvents=require(_0x7a2f('0x0'));var events=[_0x7a2f('0x1'),_0x7a2f('0x2'),'update'];function createListener(_0x7ddbd3,_0xd2df70){return function(_0x4dc70d){_0xd2df70[_0x7a2f('0x3')](_0x7ddbd3,_0x4dc70d);};}function removeListener(_0xb5a2af,_0x4853b5){return function(){DashboardEvents[_0x7a2f('0x4')](_0xb5a2af,_0x4853b5);};}exports[_0x7a2f('0x5')]=function(_0xefb8b8){for(var _0x150800=0x0,_0x3e5597=events[_0x7a2f('0x6')];_0x150800<_0x3e5597;_0x150800++){var _0x114a8d=events[_0x150800];var _0x479736=createListener(_0x7a2f('0x7')+_0x114a8d,_0xefb8b8);DashboardEvents['on'](_0x114a8d,_0x479736);}}; \ No newline at end of file +var _0x20c5=['update','removeListener','register','./dashboard.events','save','remove'];(function(_0x567751,_0x4287c3){var _0x21a84c=function(_0x2471d4){while(--_0x2471d4){_0x567751['push'](_0x567751['shift']());}};_0x21a84c(++_0x4287c3);}(_0x20c5,0xc9));var _0x520c=function(_0x16a6b4,_0x4455a3){_0x16a6b4=_0x16a6b4-0x0;var _0x1342cd=_0x20c5[_0x16a6b4];return _0x1342cd;};'use strict';var DashboardEvents=require(_0x520c('0x0'));var events=[_0x520c('0x1'),_0x520c('0x2'),_0x520c('0x3')];function createListener(_0x2bc2fd,_0x2ce64b){return function(_0x5ea869){_0x2ce64b['emit'](_0x2bc2fd,_0x5ea869);};}function removeListener(_0x5bafbd,_0x4e3d5f){return function(){DashboardEvents[_0x520c('0x4')](_0x5bafbd,_0x4e3d5f);};}exports[_0x520c('0x5')]=function(_0x23cb69){for(var _0xaae461=0x0,_0x457bf9=events['length'];_0xaae461<_0x457bf9;_0xaae461++){var _0x5891cf=events[_0xaae461];var _0x7d35e5=createListener('dashboard:'+_0x5891cf,_0x23cb69);DashboardEvents['on'](_0x5891cf,_0x7d35e5);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0872b86..f222387 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 _0x3fbb=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','multer'];(function(_0x3d4449,_0x2b4f48){var _0x3c603c=function(_0x5d546c){while(--_0x5d546c){_0x3d4449['push'](_0x3d4449['shift']());}};_0x3c603c(++_0x2b4f48);}(_0x3fbb,0xc7));var _0xb3fb=function(_0x5cb3de,_0x4ae1f7){_0x5cb3de=_0x5cb3de-0x0;var _0x16279a=_0x3fbb[_0x5cb3de];return _0x16279a;};'use strict';var multer=require(_0xb3fb('0x0'));var util=require(_0xb3fb('0x1'));var path=require(_0xb3fb('0x2'));var timeout=require(_0xb3fb('0x3'));var express=require(_0xb3fb('0x4'));var router=express[_0xb3fb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb3fb('0x6'));var interaction=require(_0xb3fb('0x7'));var config=require(_0xb3fb('0x8'));var controller=require(_0xb3fb('0x9'));router[_0xb3fb('0xa')]('/',auth[_0xb3fb('0xb')](),controller[_0xb3fb('0xc')]);router['get'](_0xb3fb('0xd'),auth[_0xb3fb('0xb')](),controller[_0xb3fb('0xe')]);router[_0xb3fb('0xa')](_0xb3fb('0xf'),auth['isAuthenticated'](),controller['getItems']);router[_0xb3fb('0x10')]('/',auth[_0xb3fb('0xb')](),controller[_0xb3fb('0x11')]);router[_0xb3fb('0x10')](_0xb3fb('0x12'),auth[_0xb3fb('0xb')](),controller[_0xb3fb('0x13')]);router[_0xb3fb('0x10')](_0xb3fb('0xf'),auth[_0xb3fb('0xb')](),controller[_0xb3fb('0x14')]);router[_0xb3fb('0x15')]('/:id',auth[_0xb3fb('0xb')](),controller[_0xb3fb('0x16')]);router[_0xb3fb('0x17')](_0xb3fb('0xd'),auth[_0xb3fb('0xb')](),controller[_0xb3fb('0x18')]);module['exports']=router; \ No newline at end of file +var _0x2fde=['/:id/items','post','create','/:id/clone','clone','addItem','put','update','delete','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show'];(function(_0x335d63,_0x5d8378){var _0x49bcda=function(_0x4b3ea4){while(--_0x4b3ea4){_0x335d63['push'](_0x335d63['shift']());}};_0x49bcda(++_0x5d8378);}(_0x2fde,0xcf));var _0xe2fd=function(_0x11006a,_0x3685c6){_0x11006a=_0x11006a-0x0;var _0x372dd8=_0x2fde[_0x11006a];return _0x372dd8;};'use strict';var multer=require(_0xe2fd('0x0'));var util=require('util');var path=require(_0xe2fd('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2fd('0x2'));var router=express[_0xe2fd('0x3')]();var fs_extra=require(_0xe2fd('0x4'));var auth=require(_0xe2fd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2fd('0x6'));var controller=require(_0xe2fd('0x7'));router[_0xe2fd('0x8')]('/',auth[_0xe2fd('0x9')](),controller[_0xe2fd('0xa')]);router[_0xe2fd('0x8')](_0xe2fd('0xb'),auth[_0xe2fd('0x9')](),controller[_0xe2fd('0xc')]);router[_0xe2fd('0x8')](_0xe2fd('0xd'),auth[_0xe2fd('0x9')](),controller['getItems']);router[_0xe2fd('0xe')]('/',auth[_0xe2fd('0x9')](),controller[_0xe2fd('0xf')]);router[_0xe2fd('0xe')](_0xe2fd('0x10'),auth[_0xe2fd('0x9')](),controller[_0xe2fd('0x11')]);router[_0xe2fd('0xe')]('/:id/items',auth[_0xe2fd('0x9')](),controller[_0xe2fd('0x12')]);router[_0xe2fd('0x13')]('/:id',auth[_0xe2fd('0x9')](),controller[_0xe2fd('0x14')]);router[_0xe2fd('0x15')](_0xe2fd('0xb'),auth[_0xe2fd('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index f9a8b1f..1937d1a 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 _0x71ab=['setDataValue','stringify','INTEGER','#2196f3','squel','exports','STRING','TEXT','long','parse','getDataValue','attrs'];(function(_0x3c04ef,_0x9d110c){var _0x6a3a69=function(_0x333514){while(--_0x333514){_0x3c04ef['push'](_0x3c04ef['shift']());}};_0x6a3a69(++_0x9d110c);}(_0x71ab,0x64));var _0xb71a=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x71ab[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xb71a('0x0'));var _=require('lodash');module[_0xb71a('0x1')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb71a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb71a('0x3')](_0xb71a('0x4')),'get':function(){try{return JSON[_0xb71a('0x5')](this[_0xb71a('0x6')](_0xb71a('0x7')));}catch(_0x2192e8){return[];}},'set':function(_0x38d931){try{this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')](_0x38d931));}catch(_0x2a4c86){this[_0xb71a('0x8')](_0xb71a('0x7'),JSON[_0xb71a('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb71a('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xb71a('0xa')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb71a('0x2')],'allowNull':![],'defaultValue':_0xb71a('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb71a('0x2')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0x4c60=['attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0xab54d0,_0x2676f7){var _0x631beb=function(_0x4e5941){while(--_0x4e5941){_0xab54d0['push'](_0xab54d0['shift']());}};_0x631beb(++_0x2676f7);}(_0x4c60,0xc1));var _0x04c6=function(_0x56c7b9,_0x55dfc2){_0x56c7b9=_0x56c7b9-0x0;var _0x2b3ff9=_0x4c60[_0x56c7b9];return _0x2b3ff9;};'use strict';var Sequelize=require(_0x04c6('0x0'));var squel=require(_0x04c6('0x1'));var _=require(_0x04c6('0x2'));module[_0x04c6('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x04c6('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT']('long'),'get':function(){try{return JSON['parse'](this['getDataValue'](_0x04c6('0x5')));}catch(_0xc6e772){return[];}},'set':function(_0x2054da){try{this[_0x04c6('0x6')](_0x04c6('0x5'),JSON[_0x04c6('0x7')](_0x2054da));}catch(_0x8f9b13){this['setDataValue'](_0x04c6('0x5'),JSON[_0x04c6('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x04c6('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0x9'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x04c6('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x04c6('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 8947929..ffdc2f6 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 _0xd69e=['defaults','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','send','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','find','catch','type','iframe','attrUrl','attrs','https://','attrPath','clock','attrHourFormat','value','attrTimezone','0.00','attrFontSize','counter','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','body','DashboardItem','create','eml-format','rimraf','zip-dir','request-promise','moment','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','redis'];(function(_0x21d0e6,_0x5a7aa6){var _0x1cc2d1=function(_0x25ded8){while(--_0x25ded8){_0x21d0e6['push'](_0x21d0e6['shift']());}};_0x1cc2d1(++_0x5a7aa6);}(_0xd69e,0xa0));var _0xed69=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd69e[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0xed69('0x0'));var rimraf=require(_0xed69('0x1'));var zipdir=require(_0xed69('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed69('0x3'));var moment=require(_0xed69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xed69('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed69('0x6'));var _=require(_0xed69('0x7'));var squel=require(_0xed69('0x8'));var crypto=require(_0xed69('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xed69('0xa'));var toCsv=require('to-csv');var querystring=require(_0xed69('0xb'));var Papa=require(_0xed69('0xc'));var Redis=require('ioredis');var authService=require(_0xed69('0xd'));var qs=require(_0xed69('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed69('0xf'));var logger=require('../../config/logger')(_0xed69('0x10'));var utils=require(_0xed69('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0xed69('0x12'));var db=require('../../mysqldb')['db'];config[_0xed69('0x13')]=_[_0xed69('0x14')](config[_0xed69('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xed69('0x13')]));require(_0xed69('0x15'))[_0xed69('0x16')](socket);function respondWithStatusCode(_0x476524,_0x12cfd5){_0x12cfd5=_0x12cfd5||0xcc;return function(_0x5a9ffd){if(_0x5a9ffd){return _0x476524[_0xed69('0x17')](_0x12cfd5);}return _0x476524[_0xed69('0x18')](_0x12cfd5)[_0xed69('0x19')]();};}function respondWithResult(_0x118ab3,_0x35d924){_0x35d924=_0x35d924||0xc8;return function(_0x2990fa){if(_0x2990fa){return _0x118ab3[_0xed69('0x18')](_0x35d924)[_0xed69('0x1a')](_0x2990fa);}};}function respondWithFilteredResult(_0x1e7446,_0xa510c1){return function(_0x4df35e){if(_0x4df35e){var _0x4843bf=typeof _0xa510c1['offset']===_0xed69('0x1b')&&typeof _0xa510c1[_0xed69('0x1c')]===_0xed69('0x1b');var _0x576a71=_0x4df35e[_0xed69('0x1d')];var _0x11c1fc=_0x4843bf?0x0:_0xa510c1['offset'];var _0x3ed869=_0x4843bf?_0x4df35e[_0xed69('0x1d')]:_0xa510c1[_0xed69('0x1e')]+_0xa510c1[_0xed69('0x1c')];var _0x4ef2fe;if(_0x3ed869>=_0x576a71){_0x3ed869=_0x576a71;_0x4ef2fe=0xc8;}else{_0x4ef2fe=0xce;}_0x1e7446[_0xed69('0x18')](_0x4ef2fe);return _0x1e7446[_0xed69('0x1f')]('Content-Range',_0x11c1fc+'-'+_0x3ed869+'/'+_0x576a71)[_0xed69('0x1a')](_0x4df35e);}return null;};}function patchUpdates(_0x350f01){return function(_0x257550){try{jsonpatch[_0xed69('0x20')](_0x257550,_0x350f01,!![]);}catch(_0xa3486a){return BPromise[_0xed69('0x21')](_0xa3486a);}return _0x257550['save']();};}function saveUpdates(_0x35e7ec,_0x91b170){return function(_0x115558){if(_0x115558){return _0x115558[_0xed69('0x22')](_0x35e7ec)[_0xed69('0x23')](function(_0xd182bd){return _0xd182bd;});}return null;};}function removeEntity(_0x33f01f,_0x1e34c8){return function(_0x2156ad){if(_0x2156ad){return _0x2156ad[_0xed69('0x24')]()[_0xed69('0x23')](function(){_0x33f01f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x383a83,_0x228091){return function(_0x2c77d4){if(!_0x2c77d4){_0x383a83[_0xed69('0x17')](0x194);}return _0x2c77d4;};}function handleError(_0xbb7904,_0x21be83){_0x21be83=_0x21be83||0x1f4;return function(_0x5b6ee3){logger[_0xed69('0x25')](_0x5b6ee3[_0xed69('0x26')]);if(_0x5b6ee3[_0xed69('0x27')]){delete _0x5b6ee3['name'];}_0xbb7904['status'](_0x21be83)[_0xed69('0x28')](_0x5b6ee3);};}exports['show']=function(_0x379706,_0x234c8a){var _0x164316={'raw':![],'where':{'id':_0x379706[_0xed69('0x29')]['id']}},_0x1f4e54={};_0x1f4e54[_0xed69('0x2a')]=_[_0xed69('0x2b')](db['DashboardItem'][_0xed69('0x2c')]);_0x1f4e54[_0xed69('0x2d')]=_[_0xed69('0x2b')](_0x379706[_0xed69('0x2d')]);_0x1f4e54[_0xed69('0x2e')]=_[_0xed69('0x2f')](_0x1f4e54[_0xed69('0x2a')],_0x1f4e54['query']);_0x164316['attributes']=_[_0xed69('0x2f')](_0x1f4e54[_0xed69('0x2a')],qs[_0xed69('0x30')](_0x379706[_0xed69('0x2d')][_0xed69('0x30')]));_0x164316[_0xed69('0x31')]=_0x164316['attributes'][_0xed69('0x32')]?_0x164316[_0xed69('0x31')]:_0x1f4e54[_0xed69('0x2a')];if(_0x379706[_0xed69('0x2d')][_0xed69('0x33')]){_0x164316[_0xed69('0x34')]=[{'all':!![]}];}_0x164316=_['merge']({},_0x164316,_0x379706['options']);return db['DashboardItem'][_0xed69('0x35')](_0x164316)[_0xed69('0x23')](handleEntityNotFound(_0x234c8a,null))[_0xed69('0x23')](respondWithResult(_0x234c8a,null))[_0xed69('0x36')](handleError(_0x234c8a,null));};exports['destroy']=function(_0x347311,_0x338be3){return db['DashboardItem'][_0xed69('0x35')]({'where':{'id':_0x347311[_0xed69('0x29')]['id']}})[_0xed69('0x23')](handleEntityNotFound(_0x338be3,null))[_0xed69('0x23')](removeEntity(_0x338be3,null))['catch'](handleError(_0x338be3,null));};function widgetAttributes(_0x13f04c){try{switch(_0x13f04c[_0xed69('0x37')]){case _0xed69('0x38'):return[{'name':_0xed69('0x39'),'value':_0x13f04c[_0xed69('0x39')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x0]?_0x13f04c[_0xed69('0x3a')][0x0]['value']:undefined)||_0xed69('0x3b')}];case'custom':return[{'name':_0xed69('0x3c'),'value':_0x13f04c[_0xed69('0x3c')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x0]?_0x13f04c[_0xed69('0x3a')][0x0]['value']:undefined)||''}];case _0xed69('0x3d'):return[{'name':_0xed69('0x3e'),'value':_0x13f04c[_0xed69('0x3e')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x0]?_0x13f04c[_0xed69('0x3a')][0x0][_0xed69('0x3f')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x13f04c[_0xed69('0x40')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x1]?_0x13f04c[_0xed69('0x3a')][0x1]['value']:undefined)||_0xed69('0x41')},{'name':_0xed69('0x42'),'value':_0x13f04c[_0xed69('0x42')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x2]?_0x13f04c[_0xed69('0x3a')][0x2][_0xed69('0x3f')]:undefined)||0xc}];case _0xed69('0x43'):return[{'name':'attrMetric','value':_0x13f04c['attrMetric']||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x0]?_0x13f04c[_0xed69('0x3a')][0x0]['value']:undefined)||_0xed69('0x44')},{'name':_0xed69('0x45'),'value':_0x13f04c[_0xed69('0x45')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x1]?_0x13f04c[_0xed69('0x3a')][0x1][_0xed69('0x3f')]:undefined)||[]},{'name':_0xed69('0x42'),'value':_0x13f04c['attrFontSize']||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x2]?_0x13f04c[_0xed69('0x3a')][0x2]['value']:undefined)||0x14},{'name':_0xed69('0x46'),'value':_0x13f04c[_0xed69('0x46')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x3]?_0x13f04c['attrs'][0x3][_0xed69('0x3f')]:undefined)||'voice'},{'name':_0xed69('0x47'),'value':_0x13f04c[_0xed69('0x47')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x4]?_0x13f04c[_0xed69('0x3a')][0x4][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x48'),'value':_0x13f04c[_0xed69('0x48')]||(_0x13f04c['attrs']&&_0x13f04c[_0xed69('0x3a')][0x5]?_0x13f04c[_0xed69('0x3a')][0x5][_0xed69('0x3f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x13f04c[_0xed69('0x49')]||(_0x13f04c['attrs']&&_0x13f04c[_0xed69('0x3a')][0x6]?_0x13f04c[_0xed69('0x3a')][0x6][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x4a'),'value':_0x13f04c[_0xed69('0x4a')]||(_0x13f04c['attrs']&&_0x13f04c[_0xed69('0x3a')][0x7]?_0x13f04c[_0xed69('0x3a')][0x7]['value']:undefined)||''},{'name':_0xed69('0x4b'),'value':_0x13f04c[_0xed69('0x4b')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x8]?_0x13f04c['attrs'][0x8]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x13f04c[_0xed69('0x4c')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x9]?_0x13f04c[_0xed69('0x3a')][0x9]['value']:undefined)||''}];case _0xed69('0x4d'):case'pie-chart':return[{'name':'attrSerie1','value':_0x13f04c[_0xed69('0x4e')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x0]?_0x13f04c[_0xed69('0x3a')][0x0]['value']:undefined)||'total'},{'name':_0xed69('0x4f'),'value':_0x13f04c['attrSerie2']||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x1]?_0x13f04c[_0xed69('0x3a')][0x1]['value']:undefined)||null},{'name':_0xed69('0x50'),'value':_0x13f04c[_0xed69('0x50')]||(_0x13f04c['attrs']&&_0x13f04c[_0xed69('0x3a')][0x2]?_0x13f04c[_0xed69('0x3a')][0x2][_0xed69('0x3f')]:undefined)||null},{'name':_0xed69('0x45'),'value':_0x13f04c['attrVoiceQueues']||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x3]?_0x13f04c['attrs'][0x3][_0xed69('0x3f')]:undefined)||[]},{'name':_0xed69('0x46'),'value':_0x13f04c[_0xed69('0x46')]||(_0x13f04c['attrs']&&_0x13f04c['attrs'][0x4]?_0x13f04c[_0xed69('0x3a')][0x4][_0xed69('0x3f')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x13f04c[_0xed69('0x47')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x5]?_0x13f04c[_0xed69('0x3a')][0x5][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x48'),'value':_0x13f04c[_0xed69('0x48')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x6]?_0x13f04c['attrs'][0x6][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x49'),'value':_0x13f04c[_0xed69('0x49')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c['attrs'][0x7]?_0x13f04c[_0xed69('0x3a')][0x7][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x4a'),'value':_0x13f04c[_0xed69('0x4a')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x8]?_0x13f04c['attrs'][0x8][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x4b'),'value':_0x13f04c['attrWhatsappAccounts']||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x9]?_0x13f04c[_0xed69('0x3a')][0x9][_0xed69('0x3f')]:undefined)||''},{'name':_0xed69('0x4c'),'value':_0x13f04c[_0xed69('0x4c')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0xa]?_0x13f04c[_0xed69('0x3a')][0xa][_0xed69('0x3f')]:undefined)||''}];case _0xed69('0x51'):return[{'name':_0xed69('0x52'),'type':_0x13f04c[_0xed69('0x53')]||(_0x13f04c[_0xed69('0x3a')]&&_0x13f04c[_0xed69('0x3a')][0x0]?_0x13f04c[_0xed69('0x3a')][0x0][_0xed69('0x37')]:undefined)||null,'value':_0x13f04c[_0xed69('0x52')]||(_0x13f04c['attrs']&&_0x13f04c['attrs'][0x0]?_0x13f04c[_0xed69('0x3a')][0x0][_0xed69('0x3f')]:undefined)||null},{'name':_0xed69('0x54'),'value':_0x13f04c[_0xed69('0x54')]||(_0x13f04c['attrs']&&_0x13f04c['attrs'][0x1]?_0x13f04c[_0xed69('0x3a')][0x1][_0xed69('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x3fb6b5){logger[_0xed69('0x25')](_0xed69('0x55'),JSON[_0xed69('0x56')](_0x3fb6b5));return[];}}exports['create']=function(_0x39d520,_0x271a43){if(_0x39d520[_0xed69('0x57')]){_0x39d520[_0xed69('0x57')][_0xed69('0x3a')]=widgetAttributes(_0x39d520[_0xed69('0x57')]);}return db[_0xed69('0x58')][_0xed69('0x59')](_0x39d520[_0xed69('0x57')],{})[_0xed69('0x23')](respondWithResult(_0x271a43,0xc9))['catch'](handleError(_0x271a43,null));};exports['update']=function(_0x47f006,_0x5bed4b){if(_0x47f006[_0xed69('0x57')]['id']){delete _0x47f006['body']['id'];}_0x47f006[_0xed69('0x57')][_0xed69('0x3a')]=widgetAttributes(_0x47f006[_0xed69('0x57')]);return db[_0xed69('0x58')][_0xed69('0x35')]({'where':{'id':_0x47f006[_0xed69('0x29')]['id']}})[_0xed69('0x23')](handleEntityNotFound(_0x5bed4b,null))['then'](saveUpdates(_0x47f006[_0xed69('0x57')],null))[_0xed69('0x23')](respondWithResult(_0x5bed4b,null))['catch'](handleError(_0x5bed4b,null));}; \ No newline at end of file +var _0x8085=['attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrEmailAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./dashboardItem.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','then','destroy','error','stack','send','show','params','model','keys','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','DashboardItem','catch','find','type','iframe','attrUrl','attrs','https://','attrPath','attrHourFormat','value','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts'];(function(_0x539c59,_0x520284){var _0x4fcbcf=function(_0x2263b6){while(--_0x2263b6){_0x539c59['push'](_0x539c59['shift']());}};_0x4fcbcf(++_0x520284);}(_0x8085,0x71));var _0x5808=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x8085[_0x19159a];return _0xa677f4;};'use strict';var emlformat=require(_0x5808('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5808('0x1'));var rp=require(_0x5808('0x2'));var moment=require(_0x5808('0x3'));var BPromise=require(_0x5808('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5808('0x5'));var sox=require(_0x5808('0x6'));var csv=require('to-csv');var ejs=require(_0x5808('0x7'));var fs=require('fs');var fs_extra=require(_0x5808('0x8'));var _=require(_0x5808('0x9'));var squel=require(_0x5808('0xa'));var crypto=require(_0x5808('0xb'));var jsforce=require(_0x5808('0xc'));var deskjs=require(_0x5808('0xd'));var toCsv=require(_0x5808('0xe'));var querystring=require(_0x5808('0xf'));var Papa=require(_0x5808('0x10'));var Redis=require(_0x5808('0x11'));var authService=require(_0x5808('0x12'));var qs=require(_0x5808('0x13'));var as=require(_0x5808('0x14'));var hardwareService=require(_0x5808('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5808('0x16'));var config=require(_0x5808('0x17'));var licenseUtil=require(_0x5808('0x18'));var db=require(_0x5808('0x19'))['db'];config[_0x5808('0x1a')]=_[_0x5808('0x1b')](config[_0x5808('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5808('0x1a')]));require(_0x5808('0x1c'))[_0x5808('0x1d')](socket);function respondWithStatusCode(_0x3e7c09,_0x89198e){_0x89198e=_0x89198e||0xcc;return function(_0x37d739){if(_0x37d739){return _0x3e7c09[_0x5808('0x1e')](_0x89198e);}return _0x3e7c09[_0x5808('0x1f')](_0x89198e)[_0x5808('0x20')]();};}function respondWithResult(_0x46dd8a,_0x29785d){_0x29785d=_0x29785d||0xc8;return function(_0x478e29){if(_0x478e29){return _0x46dd8a[_0x5808('0x1f')](_0x29785d)['json'](_0x478e29);}};}function respondWithFilteredResult(_0x406e65,_0x25dc4e){return function(_0x3bf0ee){if(_0x3bf0ee){var _0x529a0d=typeof _0x25dc4e[_0x5808('0x21')]===_0x5808('0x22')&&typeof _0x25dc4e['limit']==='undefined';var _0x3c7c02=_0x3bf0ee['count'];var _0x40cfbd=_0x529a0d?0x0:_0x25dc4e[_0x5808('0x21')];var _0x480165=_0x529a0d?_0x3bf0ee[_0x5808('0x23')]:_0x25dc4e['offset']+_0x25dc4e['limit'];var _0xe82ad0;if(_0x480165>=_0x3c7c02){_0x480165=_0x3c7c02;_0xe82ad0=0xc8;}else{_0xe82ad0=0xce;}_0x406e65[_0x5808('0x1f')](_0xe82ad0);return _0x406e65[_0x5808('0x24')](_0x5808('0x25'),_0x40cfbd+'-'+_0x480165+'/'+_0x3c7c02)[_0x5808('0x26')](_0x3bf0ee);}return null;};}function patchUpdates(_0x33b583){return function(_0x1027ba){try{jsonpatch[_0x5808('0x27')](_0x1027ba,_0x33b583,!![]);}catch(_0x3a575e){return BPromise['reject'](_0x3a575e);}return _0x1027ba['save']();};}function saveUpdates(_0x130590,_0x168a67){return function(_0x5048a1){if(_0x5048a1){return _0x5048a1['update'](_0x130590)[_0x5808('0x28')](function(_0x467500){return _0x467500;});}return null;};}function removeEntity(_0x1dddbd,_0x4a4d05){return function(_0x49fc46){if(_0x49fc46){return _0x49fc46[_0x5808('0x29')]()[_0x5808('0x28')](function(){_0x1dddbd[_0x5808('0x1f')](0xcc)[_0x5808('0x20')]();});}};}function handleEntityNotFound(_0x1da724,_0x507a82){return function(_0x398744){if(!_0x398744){_0x1da724[_0x5808('0x1e')](0x194);}return _0x398744;};}function handleError(_0x8c6742,_0x2f878f){_0x2f878f=_0x2f878f||0x1f4;return function(_0x28c1eb){logger[_0x5808('0x2a')](_0x28c1eb[_0x5808('0x2b')]);if(_0x28c1eb['name']){delete _0x28c1eb['name'];}_0x8c6742[_0x5808('0x1f')](_0x2f878f)[_0x5808('0x2c')](_0x28c1eb);};}exports[_0x5808('0x2d')]=function(_0x5ad84b,_0x3faa07){var _0x3438be={'raw':![],'where':{'id':_0x5ad84b[_0x5808('0x2e')]['id']}},_0x269810={};_0x269810[_0x5808('0x2f')]=_[_0x5808('0x30')](db['DashboardItem'][_0x5808('0x31')]);_0x269810[_0x5808('0x32')]=_[_0x5808('0x30')](_0x5ad84b['query']);_0x269810['filters']=_[_0x5808('0x33')](_0x269810['model'],_0x269810[_0x5808('0x32')]);_0x3438be[_0x5808('0x34')]=_['intersection'](_0x269810[_0x5808('0x2f')],qs[_0x5808('0x35')](_0x5ad84b['query']['fields']));_0x3438be[_0x5808('0x34')]=_0x3438be['attributes'][_0x5808('0x36')]?_0x3438be['attributes']:_0x269810[_0x5808('0x2f')];if(_0x5ad84b[_0x5808('0x32')][_0x5808('0x37')]){_0x3438be['include']=[{'all':!![]}];}_0x3438be=_[_0x5808('0x38')]({},_0x3438be,_0x5ad84b['options']);return db[_0x5808('0x39')]['find'](_0x3438be)['then'](handleEntityNotFound(_0x3faa07,null))[_0x5808('0x28')](respondWithResult(_0x3faa07,null))[_0x5808('0x3a')](handleError(_0x3faa07,null));};exports[_0x5808('0x29')]=function(_0x570234,_0x5f3dcd){return db[_0x5808('0x39')][_0x5808('0x3b')]({'where':{'id':_0x570234['params']['id']}})[_0x5808('0x28')](handleEntityNotFound(_0x5f3dcd,null))[_0x5808('0x28')](removeEntity(_0x5f3dcd,null))[_0x5808('0x3a')](handleError(_0x5f3dcd,null));};function widgetAttributes(_0x490024){try{switch(_0x490024[_0x5808('0x3c')]){case _0x5808('0x3d'):return[{'name':_0x5808('0x3e'),'value':_0x490024['attrUrl']||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x0]?_0x490024['attrs'][0x0]['value']:undefined)||_0x5808('0x40')}];case'custom':return[{'name':_0x5808('0x41'),'value':_0x490024[_0x5808('0x41')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x0]?_0x490024[_0x5808('0x3f')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x5808('0x42'),'value':_0x490024[_0x5808('0x42')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x0]?_0x490024[_0x5808('0x3f')][0x0][_0x5808('0x43')]:undefined)||_0x5808('0x44')},{'name':_0x5808('0x45'),'value':_0x490024[_0x5808('0x45')]||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0x1]?_0x490024[_0x5808('0x3f')][0x1][_0x5808('0x43')]:undefined)||'0.00'},{'name':_0x5808('0x46'),'value':_0x490024[_0x5808('0x46')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x2]?_0x490024['attrs'][0x2][_0x5808('0x43')]:undefined)||0xc}];case _0x5808('0x47'):return[{'name':_0x5808('0x48'),'value':_0x490024[_0x5808('0x48')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x0]?_0x490024[_0x5808('0x3f')][0x0][_0x5808('0x43')]:undefined)||_0x5808('0x49')},{'name':_0x5808('0x4a'),'value':_0x490024[_0x5808('0x4a')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x1]?_0x490024['attrs'][0x1]['value']:undefined)||[]},{'name':_0x5808('0x46'),'value':_0x490024[_0x5808('0x46')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x2]?_0x490024[_0x5808('0x3f')][0x2][_0x5808('0x43')]:undefined)||0x14},{'name':_0x5808('0x4b'),'value':_0x490024['attrChannel']||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x3]?_0x490024[_0x5808('0x3f')][0x3]['value']:undefined)||_0x5808('0x4c')},{'name':'attrEmailAccounts','value':_0x490024['attrEmailAccounts']||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0x4]?_0x490024[_0x5808('0x3f')][0x4]['value']:undefined)||''},{'name':_0x5808('0x4d'),'value':_0x490024[_0x5808('0x4d')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x5]?_0x490024[_0x5808('0x3f')][0x5]['value']:undefined)||''},{'name':_0x5808('0x4e'),'value':_0x490024[_0x5808('0x4e')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x6]?_0x490024[_0x5808('0x3f')][0x6][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x4f'),'value':_0x490024[_0x5808('0x4f')]||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0x7]?_0x490024[_0x5808('0x3f')][0x7][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x50'),'value':_0x490024[_0x5808('0x50')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x8]?_0x490024[_0x5808('0x3f')][0x8][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x51'),'value':_0x490024[_0x5808('0x51')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x9]?_0x490024[_0x5808('0x3f')][0x9][_0x5808('0x43')]:undefined)||''}];case _0x5808('0x52'):case _0x5808('0x53'):return[{'name':_0x5808('0x54'),'value':_0x490024[_0x5808('0x54')]||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0x0]?_0x490024['attrs'][0x0][_0x5808('0x43')]:undefined)||_0x5808('0x49')},{'name':'attrSerie2','value':_0x490024[_0x5808('0x55')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x1]?_0x490024['attrs'][0x1][_0x5808('0x43')]:undefined)||null},{'name':_0x5808('0x56'),'value':_0x490024['attrSerie3']||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x2]?_0x490024['attrs'][0x2]['value']:undefined)||null},{'name':_0x5808('0x4a'),'value':_0x490024['attrVoiceQueues']||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x3]?_0x490024['attrs'][0x3][_0x5808('0x43')]:undefined)||[]},{'name':_0x5808('0x4b'),'value':_0x490024[_0x5808('0x4b')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x4]?_0x490024[_0x5808('0x3f')][0x4][_0x5808('0x43')]:undefined)||_0x5808('0x4c')},{'name':_0x5808('0x57'),'value':_0x490024[_0x5808('0x57')]||(_0x490024['attrs']&&_0x490024['attrs'][0x5]?_0x490024['attrs'][0x5][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x4d'),'value':_0x490024['attrFaxAccounts']||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x6]?_0x490024[_0x5808('0x3f')][0x6][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x4e'),'value':_0x490024[_0x5808('0x4e')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x7]?_0x490024[_0x5808('0x3f')][0x7][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x4f'),'value':_0x490024[_0x5808('0x4f')]||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0x8]?_0x490024[_0x5808('0x3f')][0x8][_0x5808('0x43')]:undefined)||''},{'name':_0x5808('0x50'),'value':_0x490024[_0x5808('0x50')]||(_0x490024[_0x5808('0x3f')]&&_0x490024['attrs'][0x9]?_0x490024['attrs'][0x9]['value']:undefined)||''},{'name':_0x5808('0x51'),'value':_0x490024[_0x5808('0x51')]||(_0x490024['attrs']&&_0x490024[_0x5808('0x3f')][0xa]?_0x490024[_0x5808('0x3f')][0xa][_0x5808('0x43')]:undefined)||''}];case _0x5808('0x58'):return[{'name':_0x5808('0x59'),'type':_0x490024[_0x5808('0x5a')]||(_0x490024['attrs']&&_0x490024['attrs'][0x0]?_0x490024[_0x5808('0x3f')][0x0][_0x5808('0x3c')]:undefined)||null,'value':_0x490024[_0x5808('0x59')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x0]?_0x490024['attrs'][0x0][_0x5808('0x43')]:undefined)||null},{'name':_0x5808('0x5b'),'value':_0x490024[_0x5808('0x5b')]||(_0x490024[_0x5808('0x3f')]&&_0x490024[_0x5808('0x3f')][0x1]?_0x490024['attrs'][0x1][_0x5808('0x43')]:undefined)||0x0}];default:return[];}}catch(_0x383d36){logger[_0x5808('0x2a')](_0x5808('0x5c'),JSON[_0x5808('0x5d')](_0x383d36));return[];}}exports[_0x5808('0x5e')]=function(_0x46cfdb,_0x192eee){if(_0x46cfdb[_0x5808('0x5f')]){_0x46cfdb[_0x5808('0x5f')][_0x5808('0x3f')]=widgetAttributes(_0x46cfdb['body']);}return db['DashboardItem'][_0x5808('0x5e')](_0x46cfdb[_0x5808('0x5f')],{})[_0x5808('0x28')](respondWithResult(_0x192eee,0xc9))['catch'](handleError(_0x192eee,null));};exports[_0x5808('0x60')]=function(_0x16f264,_0x52752b){if(_0x16f264[_0x5808('0x5f')]['id']){delete _0x16f264[_0x5808('0x5f')]['id'];}_0x16f264['body'][_0x5808('0x3f')]=widgetAttributes(_0x16f264[_0x5808('0x5f')]);return db[_0x5808('0x39')][_0x5808('0x3b')]({'where':{'id':_0x16f264['params']['id']}})['then'](handleEntityNotFound(_0x52752b,null))[_0x5808('0x28')](saveUpdates(_0x16f264[_0x5808('0x5f')],null))[_0x5808('0x28')](respondWithResult(_0x52752b,null))[_0x5808('0x3a')](handleError(_0x52752b,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index a317709..993d473 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 _0xa93a=['update','emit','hasOwnProperty','exports','DashboardItem'];(function(_0x585275,_0x2d4844){var _0x4ac940=function(_0x3d0baf){while(--_0x3d0baf){_0x585275['push'](_0x585275['shift']());}};_0x4ac940(++_0x2d4844);}(_0xa93a,0xb8));var _0xaa93=function(_0x151d31,_0x622f39){_0x151d31=_0x151d31-0x0;var _0x4c479d=_0xa93a[_0x151d31];return _0x4c479d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xaa93('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa93('0x1'),'afterDestroy':'remove'};function emitEvent(_0xdb8133){return function(_0x4deab1,_0x242aa2,_0x181549){DashboardItemEvents[_0xaa93('0x2')](_0xdb8133+':'+_0x4deab1['id'],_0x4deab1);DashboardItemEvents[_0xaa93('0x2')](_0xdb8133,_0x4deab1);_0x181549(null);};}for(var e in events){if(events[_0xaa93('0x3')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xaa93('0x4')]=DashboardItemEvents; \ No newline at end of file +var _0xd991=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x499e97,_0x106a76){var _0x5b4f4d=function(_0x190701){while(--_0x190701){_0x499e97['push'](_0x499e97['shift']());}};_0x5b4f4d(++_0x106a76);}(_0xd991,0x1a8));var _0x1d99=function(_0x5ec25e,_0x3fff60){_0x5ec25e=_0x5ec25e-0x0;var _0x2f31d1=_0xd991[_0x5ec25e];return _0x2f31d1;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var DashboardItem=require(_0x1d99('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1d99('0x2'),'afterUpdate':_0x1d99('0x3'),'afterDestroy':_0x1d99('0x4')};function emitEvent(_0x46ec21){return function(_0x1c603d,_0x8a598e,_0x51fd54){DashboardItemEvents[_0x1d99('0x5')](_0x46ec21+':'+_0x1c603d['id'],_0x1c603d);DashboardItemEvents[_0x1d99('0x5')](_0x46ec21,_0x1c603d);_0x51fd54(null);};}for(var e in events){if(events[_0x1d99('0x6')](e)){var event=events[e];DashboardItem[_0x1d99('0x7')](e,emitEvent(event));}}module[_0x1d99('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index fc24b8e..95cfc2e 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 _0x6fb8=['rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','../../config/logger','api','bluebird'];(function(_0x4a69d0,_0x764d45){var _0x393ad6=function(_0x4a7d5a){while(--_0x4a7d5a){_0x4a69d0['push'](_0x4a69d0['shift']());}};_0x393ad6(++_0x764d45);}(_0x6fb8,0x104));var _0x86fb=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x6fb8[_0x845505];return _0x2513b9;};'use strict';var _=require(_0x86fb('0x0'));var util=require('util');var logger=require(_0x86fb('0x1'))(_0x86fb('0x2'));var moment=require('moment');var BPromise=require(_0x86fb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x86fb('0x4'));var config=require(_0x86fb('0x5'));var attributes=require(_0x86fb('0x6'));module[_0x86fb('0x7')]=function(_0x1aa956,_0x7ba395){return _0x1aa956[_0x86fb('0x8')](_0x86fb('0x9'),attributes,{'tableName':_0x86fb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4262=['util','../../config/logger','moment','request-promise','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x4262,0x15f));var _0x2426=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4262[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x2426('0x0'));var util=require(_0x2426('0x1'));var logger=require(_0x2426('0x2'))('api');var moment=require(_0x2426('0x3'));var BPromise=require('bluebird');var rp=require(_0x2426('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2426('0x5'));var attributes=require(_0x2426('0x6'));module[_0x2426('0x7')]=function(_0x127500,_0x4a6553){return _0x127500[_0x2426('0x8')](_0x2426('0x9'),attributes,{'tableName':_0x2426('0xa'),'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 d732332..1dfc3d8 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 _0xc359=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register'];(function(_0x183fb4,_0x399f06){var _0x46157c=function(_0x2c7393){while(--_0x2c7393){_0x183fb4['push'](_0x183fb4['shift']());}};_0x46157c(++_0x399f06);}(_0xc359,0x194));var _0x9c35=function(_0x5ac84c,_0x287781){_0x5ac84c=_0x5ac84c-0x0;var _0x3c53d2=_0xc359[_0x5ac84c];return _0x3c53d2;};'use strict';var _=require(_0x9c35('0x0'));var util=require(_0x9c35('0x1'));var moment=require(_0x9c35('0x2'));var BPromise=require(_0x9c35('0x3'));var rs=require(_0x9c35('0x4'));var fs=require('fs');var Redis=require(_0x9c35('0x5'));var db=require(_0x9c35('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c35('0x7'))(_0x9c35('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x9'));var client=jayson['client'][_0x9c35('0xa')]({'port':0x232a});config[_0x9c35('0xb')]=_[_0x9c35('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9c35('0xd'))(new Redis(config[_0x9c35('0xb')]));require(_0x9c35('0xe'))[_0x9c35('0xf')](socket);function respondWithRpcPromise(_0x356c6c,_0x524a91,_0x8e1de7){return new BPromise(function(_0x152b3e,_0x404e22){return client[_0x9c35('0x10')](_0x356c6c,_0x8e1de7)[_0x9c35('0x11')](function(_0x5743e0){logger[_0x9c35('0x12')](_0x9c35('0x13'),_0x524a91,_0x9c35('0x14'));logger[_0x9c35('0x15')]('DashboardItem,\x20%s,\x20%s,\x20%s',_0x524a91,_0x9c35('0x14'),JSON[_0x9c35('0x16')](_0x5743e0));if(_0x5743e0[_0x9c35('0x17')]){if(_0x5743e0[_0x9c35('0x17')][_0x9c35('0x18')]===0x1f4){logger[_0x9c35('0x17')](_0x9c35('0x13'),_0x524a91,_0x5743e0[_0x9c35('0x17')][_0x9c35('0x19')]);return _0x404e22(_0x5743e0[_0x9c35('0x17')][_0x9c35('0x19')]);}logger['error'](_0x9c35('0x13'),_0x524a91,_0x5743e0[_0x9c35('0x17')][_0x9c35('0x19')]);return _0x152b3e(_0x5743e0['error'][_0x9c35('0x19')]);}else{logger[_0x9c35('0x12')](_0x9c35('0x13'),_0x524a91,_0x9c35('0x14'));_0x152b3e(_0x5743e0[_0x9c35('0x1a')][_0x9c35('0x19')]);}})[_0x9c35('0x1b')](function(_0x3de5b9){logger[_0x9c35('0x17')](_0x9c35('0x13'),_0x524a91,_0x3de5b9);_0x404e22(_0x3de5b9);});});} \ No newline at end of file +var _0x1bf0=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x1bf0,0xa0));var _0x01bf=function(_0x8c448f,_0x2835e9){_0x8c448f=_0x8c448f-0x0;var _0x9cf51=_0x1bf0[_0x8c448f];return _0x9cf51;};'use strict';var _=require('lodash');var util=require(_0x01bf('0x0'));var moment=require(_0x01bf('0x1'));var BPromise=require(_0x01bf('0x2'));var rs=require(_0x01bf('0x3'));var fs=require('fs');var Redis=require(_0x01bf('0x4'));var db=require(_0x01bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x01bf('0x6'))(_0x01bf('0x7'));var config=require(_0x01bf('0x8'));var jayson=require(_0x01bf('0x9'));var client=jayson[_0x01bf('0xa')]['http']({'port':0x232a});config[_0x01bf('0xb')]=_[_0x01bf('0xc')](config[_0x01bf('0xb')],{'host':_0x01bf('0xd'),'port':0x18eb});var socket=require(_0x01bf('0xe'))(new Redis(config[_0x01bf('0xb')]));require(_0x01bf('0xf'))['register'](socket);function respondWithRpcPromise(_0x377143,_0x24b265,_0x265b38){return new BPromise(function(_0x45197b,_0x1176ba){return client[_0x01bf('0x10')](_0x377143,_0x265b38)[_0x01bf('0x11')](function(_0x5ef6c8){logger[_0x01bf('0x12')](_0x01bf('0x13'),_0x24b265,_0x01bf('0x14'));logger['debug'](_0x01bf('0x15'),_0x24b265,'request\x20sent',JSON['stringify'](_0x5ef6c8));if(_0x5ef6c8[_0x01bf('0x16')]){if(_0x5ef6c8[_0x01bf('0x16')][_0x01bf('0x17')]===0x1f4){logger['error'](_0x01bf('0x13'),_0x24b265,_0x5ef6c8[_0x01bf('0x16')][_0x01bf('0x18')]);return _0x1176ba(_0x5ef6c8[_0x01bf('0x16')]['message']);}logger['error'](_0x01bf('0x13'),_0x24b265,_0x5ef6c8[_0x01bf('0x16')]['message']);return _0x45197b(_0x5ef6c8[_0x01bf('0x16')][_0x01bf('0x18')]);}else{logger['info'](_0x01bf('0x13'),_0x24b265,'request\x20sent');_0x45197b(_0x5ef6c8[_0x01bf('0x19')][_0x01bf('0x18')]);}})[_0x01bf('0x1a')](function(_0x496810){logger[_0x01bf('0x16')](_0x01bf('0x13'),_0x24b265,_0x496810);_0x1176ba(_0x496810);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index bd64916..c83f147 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 _0x269e=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0xaca348,_0x4d3993){var _0x560057=function(_0x41e145){while(--_0x41e145){_0xaca348['push'](_0xaca348['shift']());}};_0x560057(++_0x4d3993);}(_0x269e,0x14e));var _0xe269=function(_0x4b52da,_0x39bf67){_0x4b52da=_0x4b52da-0x0;var _0x261576=_0x269e[_0x4b52da];return _0x261576;};'use strict';var DashboardItemEvents=require(_0xe269('0x0'));var events=[_0xe269('0x1'),_0xe269('0x2'),_0xe269('0x3')];function createListener(_0x5e6ed5,_0x1941be){return function(_0x4483c9){_0x1941be['emit'](_0x5e6ed5,_0x4483c9);};}function removeListener(_0x12f268,_0x2af8b4){return function(){DashboardItemEvents[_0xe269('0x4')](_0x12f268,_0x2af8b4);};}exports[_0xe269('0x5')]=function(_0x57dc05){for(var _0x25a447=0x0,_0x55c11a=events[_0xe269('0x6')];_0x25a447<_0x55c11a;_0x25a447++){var _0x39a7c0=events[_0x25a447];var _0x4c85c1=createListener(_0xe269('0x7')+_0x39a7c0,_0x57dc05);DashboardItemEvents['on'](_0x39a7c0,_0x4c85c1);}}; \ No newline at end of file +var _0xd442=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xd442,0x106));var _0x2d44=function(_0x1bf423,_0x1fe81c){_0x1bf423=_0x1bf423-0x0;var _0x26d05f=_0xd442[_0x1bf423];return _0x26d05f;};'use strict';var DashboardItemEvents=require(_0x2d44('0x0'));var events=[_0x2d44('0x1'),_0x2d44('0x2'),'update'];function createListener(_0x47c5fb,_0x1c700b){return function(_0x1c94c8){_0x1c700b[_0x2d44('0x3')](_0x47c5fb,_0x1c94c8);};}function removeListener(_0x2a1b5e,_0x3ff954){return function(){DashboardItemEvents[_0x2d44('0x4')](_0x2a1b5e,_0x3ff954);};}exports[_0x2d44('0x5')]=function(_0x2beedb){for(var _0x44df37=0x0,_0x33048b=events[_0x2d44('0x6')];_0x44df37<_0x33048b;_0x44df37++){var _0x2d4355=events[_0x44df37];var _0x303a21=createListener(_0x2d44('0x7')+_0x2d4355,_0x2beedb);DashboardItemEvents['on'](_0x2d4355,_0x303a21);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 1c813e9..bfeaba0 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 _0x81ef=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x81ef,0xc2));var _0xf81e=function(_0x185598,_0x542172){_0x185598=_0x185598-0x0;var _0x2ad07e=_0x81ef[_0x185598];return _0x2ad07e;};'use strict';var multer=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var path=require(_0xf81e('0x2'));var timeout=require('connect-timeout');var express=require(_0xf81e('0x3'));var router=express['Router']();var fs_extra=require(_0xf81e('0x4'));var auth=require(_0xf81e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf81e('0x6'));var controller=require(_0xf81e('0x7'));router[_0xf81e('0x8')](_0xf81e('0x9'),auth[_0xf81e('0xa')](),controller[_0xf81e('0xb')]);router[_0xf81e('0xc')]('/',auth[_0xf81e('0xa')](),controller[_0xf81e('0xd')]);router[_0xf81e('0xe')]('/:id',auth[_0xf81e('0xa')](),controller[_0xf81e('0xf')]);router[_0xf81e('0x10')](_0xf81e('0x9'),auth['isAuthenticated'](),controller[_0xf81e('0x11')]);module[_0xf81e('0x12')]=router; \ No newline at end of file +var _0xa129=['exports','util','path','connect-timeout','Router','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','destroy'];(function(_0x551c63,_0x21c721){var _0x2d227a=function(_0x1b426c){while(--_0x1b426c){_0x551c63['push'](_0x551c63['shift']());}};_0x2d227a(++_0x21c721);}(_0xa129,0xb1));var _0x9a12=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa129[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9a12('0x0'));var path=require(_0x9a12('0x1'));var timeout=require(_0x9a12('0x2'));var express=require('express');var router=express[_0x9a12('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9a12('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a12('0x5'));router[_0x9a12('0x6')](_0x9a12('0x7'),auth[_0x9a12('0x8')](),controller[_0x9a12('0x9')]);router[_0x9a12('0xa')]('/',auth['isAuthenticated'](),controller[_0x9a12('0xb')]);router[_0x9a12('0xc')]('/:id',auth[_0x9a12('0x8')](),controller[_0x9a12('0xd')]);router['delete'](_0x9a12('0x7'),auth[_0x9a12('0x8')](),controller[_0x9a12('0xe')]);module[_0x9a12('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index a0c6157..6358363 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 _0x6dc4=['exports','STRING','ENUM','first','third','sequelize'];(function(_0xee3c05,_0x5c27c6){var _0x2b2f62=function(_0x1b0591){while(--_0x1b0591){_0xee3c05['push'](_0xee3c05['shift']());}};_0x2b2f62(++_0x5c27c6);}(_0x6dc4,0x149));var _0x46dc=function(_0x510883,_0x3d834c){_0x510883=_0x510883-0x0;var _0x57d3a3=_0x6dc4[_0x510883];return _0x57d3a3;};'use strict';var Sequelize=require(_0x46dc('0x0'));module[_0x46dc('0x1')]={'name':{'type':Sequelize[_0x46dc('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x46dc('0x3')](_0x46dc('0x4'),'second',_0x46dc('0x5')),'allowNull':![],'defaultValue':_0x46dc('0x4')},'description':{'type':Sequelize[_0x46dc('0x2')]}}; \ No newline at end of file +var _0x8fa5=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0x2b55bd,_0x32605c){var _0x4ceff0=function(_0x257be3){while(--_0x257be3){_0x2b55bd['push'](_0x2b55bd['shift']());}};_0x4ceff0(++_0x32605c);}(_0x8fa5,0x152));var _0x58fa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8fa5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x58fa('0x0'));module[_0x58fa('0x1')]={'name':{'type':Sequelize[_0x58fa('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x58fa('0x3')](_0x58fa('0x4'),_0x58fa('0x5'),_0x58fa('0x6')),'allowNull':![],'defaultValue':_0x58fa('0x4')},'description':{'type':Sequelize[_0x58fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 31e5f8a..3df5dbd 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 _0x1618=['destroy','then','get','Dispositions','name','send','index','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','options','Disposition','includeAll','include','findAll','rows','params','keys','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','reject','save'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x1618,0x7f));var _0x8161=function(_0x34bbb9,_0x4866f9){_0x34bbb9=_0x34bbb9-0x0;var _0x39f790=_0x1618[_0x34bbb9];return _0x39f790;};'use strict';var emlformat=require(_0x8161('0x0'));var rimraf=require(_0x8161('0x1'));var zipdir=require(_0x8161('0x2'));var jsonpatch=require(_0x8161('0x3'));var rp=require('request-promise');var moment=require(_0x8161('0x4'));var BPromise=require(_0x8161('0x5'));var Mustache=require(_0x8161('0x6'));var util=require(_0x8161('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8161('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8161('0x9'));var squel=require(_0x8161('0xa'));var crypto=require(_0x8161('0xb'));var jsforce=require(_0x8161('0xc'));var deskjs=require(_0x8161('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8161('0xe'));var authService=require(_0x8161('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8161('0x10'));var logger=require(_0x8161('0x11'))('api');var utils=require(_0x8161('0x12'));var config=require(_0x8161('0x13'));var licenseUtil=require(_0x8161('0x14'));var db=require(_0x8161('0x15'))['db'];function respondWithStatusCode(_0x3b6ff5,_0x4fc512){_0x4fc512=_0x4fc512||0xcc;return function(_0x27ede5){if(_0x27ede5){return _0x3b6ff5[_0x8161('0x16')](_0x4fc512);}return _0x3b6ff5[_0x8161('0x17')](_0x4fc512)[_0x8161('0x18')]();};}function respondWithResult(_0x2d208d,_0x45ab2d){_0x45ab2d=_0x45ab2d||0xc8;return function(_0x25b182){if(_0x25b182){return _0x2d208d[_0x8161('0x17')](_0x45ab2d)['json'](_0x25b182);}};}function respondWithFilteredResult(_0x149258,_0x16f372){return function(_0x42bc99){if(_0x42bc99){var _0x44d9af=typeof _0x16f372['offset']===_0x8161('0x19')&&typeof _0x16f372[_0x8161('0x1a')]==='undefined';var _0x7ffe4b=_0x42bc99[_0x8161('0x1b')];var _0x1ae8c3=_0x44d9af?0x0:_0x16f372[_0x8161('0x1c')];var _0x8e547=_0x44d9af?_0x42bc99['count']:_0x16f372['offset']+_0x16f372[_0x8161('0x1a')];var _0x4f3a1c;if(_0x8e547>=_0x7ffe4b){_0x8e547=_0x7ffe4b;_0x4f3a1c=0xc8;}else{_0x4f3a1c=0xce;}_0x149258[_0x8161('0x17')](_0x4f3a1c);return _0x149258[_0x8161('0x1d')]('Content-Range',_0x1ae8c3+'-'+_0x8e547+'/'+_0x7ffe4b)[_0x8161('0x1e')](_0x42bc99);}return null;};}function patchUpdates(_0x4977cc){return function(_0x1f090c){try{jsonpatch['apply'](_0x1f090c,_0x4977cc,!![]);}catch(_0x1e522d){return BPromise[_0x8161('0x1f')](_0x1e522d);}return _0x1f090c[_0x8161('0x20')]();};}function saveUpdates(_0x3ba4c4,_0x120c67){return function(_0x28995f){if(_0x28995f){return _0x28995f['update'](_0x3ba4c4)['then'](function(_0x504cc0){return _0x504cc0;});}return null;};}function removeEntity(_0x3c8930,_0x402e3c){return function(_0x106528){if(_0x106528){return _0x106528[_0x8161('0x21')]()[_0x8161('0x22')](function(){var _0xcc5cbd=_0x106528[_0x8161('0x23')]({'plain':!![]});var _0x4a51e0=_0x8161('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x4a51e0,'resourceId':_0xcc5cbd['id']}})[_0x8161('0x22')](function(){return _0x106528;});})[_0x8161('0x22')](function(){_0x3c8930['status'](0xcc)[_0x8161('0x18')]();});}};}function handleEntityNotFound(_0x424532,_0xef789b){return function(_0x3e71d0){if(!_0x3e71d0){_0x424532[_0x8161('0x16')](0x194);}return _0x3e71d0;};}function handleError(_0x285e5b,_0x2186e4){_0x2186e4=_0x2186e4||0x1f4;return function(_0x2a0d60){logger['error'](_0x2a0d60['stack']);if(_0x2a0d60[_0x8161('0x25')]){delete _0x2a0d60[_0x8161('0x25')];}_0x285e5b['status'](_0x2186e4)[_0x8161('0x26')](_0x2a0d60);};}exports[_0x8161('0x27')]=function(_0x448806,_0x1d6ab9){var _0x791f2e={},_0x144d91={},_0x462746={'count':0x0,'rows':[]};var _0x1ae9b0=_['map'](db['Disposition']['rawAttributes'],function(_0x2ef986){return{'name':_0x2ef986[_0x8161('0x28')],'type':_0x2ef986[_0x8161('0x29')]['key']};});_0x144d91[_0x8161('0x2a')]=_['map'](_0x1ae9b0,'name');_0x144d91['query']=_['keys'](_0x448806[_0x8161('0x2b')]);_0x144d91[_0x8161('0x2c')]=_[_0x8161('0x2d')](_0x144d91[_0x8161('0x2a')],_0x144d91['query']);_0x791f2e[_0x8161('0x2e')]=_[_0x8161('0x2d')](_0x144d91[_0x8161('0x2a')],qs[_0x8161('0x2f')](_0x448806[_0x8161('0x2b')]['fields']));_0x791f2e[_0x8161('0x2e')]=_0x791f2e[_0x8161('0x2e')][_0x8161('0x30')]?_0x791f2e[_0x8161('0x2e')]:_0x144d91[_0x8161('0x2a')];if(!_0x448806[_0x8161('0x2b')][_0x8161('0x31')](_0x8161('0x32'))){_0x791f2e[_0x8161('0x1a')]=qs[_0x8161('0x1a')](_0x448806['query'][_0x8161('0x1a')]);_0x791f2e[_0x8161('0x1c')]=qs['offset'](_0x448806[_0x8161('0x2b')][_0x8161('0x1c')]);}_0x791f2e[_0x8161('0x33')]=qs['sort'](_0x448806[_0x8161('0x2b')][_0x8161('0x34')]);_0x791f2e[_0x8161('0x35')]=qs[_0x8161('0x2c')](_[_0x8161('0x36')](_0x448806[_0x8161('0x2b')],_0x144d91[_0x8161('0x2c')]),_0x1ae9b0);if(_0x448806[_0x8161('0x2b')][_0x8161('0x37')]){_0x791f2e[_0x8161('0x35')]=_[_0x8161('0x38')](_0x791f2e[_0x8161('0x35')],{'$or':_[_0x8161('0x39')](_0x1ae9b0,function(_0x161817){if(_0x161817[_0x8161('0x29')]!=='VIRTUAL'){var _0x2bf4d4={};_0x2bf4d4[_0x161817['name']]={'$like':'%'+_0x448806[_0x8161('0x2b')][_0x8161('0x37')]+'%'};return _0x2bf4d4;}})});}_0x791f2e=_[_0x8161('0x38')]({},_0x791f2e,_0x448806[_0x8161('0x3a')]);var _0x8414da={'where':_0x791f2e[_0x8161('0x35')]};return db[_0x8161('0x3b')][_0x8161('0x1b')](_0x8414da)[_0x8161('0x22')](function(_0x4be210){_0x462746[_0x8161('0x1b')]=_0x4be210;if(_0x448806[_0x8161('0x2b')][_0x8161('0x3c')]){_0x791f2e[_0x8161('0x3d')]=[{'all':!![]}];}return db[_0x8161('0x3b')][_0x8161('0x3e')](_0x791f2e);})[_0x8161('0x22')](function(_0x154386){_0x462746[_0x8161('0x3f')]=_0x154386;return _0x462746;})[_0x8161('0x22')](respondWithFilteredResult(_0x1d6ab9,_0x791f2e))['catch'](handleError(_0x1d6ab9,null));};exports['show']=function(_0x1df167,_0x2f5b59){var _0x59b8f7={'raw':!![],'where':{'id':_0x1df167[_0x8161('0x40')]['id']}},_0x3c7d88={};_0x3c7d88[_0x8161('0x2a')]=_[_0x8161('0x41')](db[_0x8161('0x3b')][_0x8161('0x42')]);_0x3c7d88[_0x8161('0x2b')]=_['keys'](_0x1df167[_0x8161('0x2b')]);_0x3c7d88[_0x8161('0x2c')]=_['intersection'](_0x3c7d88[_0x8161('0x2a')],_0x3c7d88[_0x8161('0x2b')]);_0x59b8f7[_0x8161('0x2e')]=_['intersection'](_0x3c7d88['model'],qs['fields'](_0x1df167[_0x8161('0x2b')][_0x8161('0x2f')]));_0x59b8f7[_0x8161('0x2e')]=_0x59b8f7[_0x8161('0x2e')][_0x8161('0x30')]?_0x59b8f7[_0x8161('0x2e')]:_0x3c7d88[_0x8161('0x2a')];if(_0x1df167[_0x8161('0x2b')][_0x8161('0x3c')]){_0x59b8f7[_0x8161('0x3d')]=[{'all':!![]}];}_0x59b8f7=_[_0x8161('0x38')]({},_0x59b8f7,_0x1df167[_0x8161('0x3a')]);return db['Disposition'][_0x8161('0x43')](_0x59b8f7)[_0x8161('0x22')](handleEntityNotFound(_0x2f5b59,null))[_0x8161('0x22')](respondWithResult(_0x2f5b59,null))[_0x8161('0x44')](handleError(_0x2f5b59,null));};exports[_0x8161('0x45')]=function(_0x38fe95,_0x445aec){return db[_0x8161('0x3b')][_0x8161('0x45')](_0x38fe95[_0x8161('0x46')],{})[_0x8161('0x22')](function(_0x34dcc9){var _0x2829d0=_0x38fe95[_0x8161('0x47')][_0x8161('0x23')]({'plain':!![]});if(!_0x2829d0)throw new Error(_0x8161('0x48'));if(_0x2829d0[_0x8161('0x49')]===_0x8161('0x47')){var _0x4d679a=_0x34dcc9['get']({'plain':!![]});var _0x220bd5=_0x8161('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x220bd5,'userProfileId':_0x2829d0[_0x8161('0x4a')]},'raw':!![]})[_0x8161('0x22')](function(_0x53855e){if(_0x53855e&&_0x53855e[_0x8161('0x4b')]===0x0){return db[_0x8161('0x4c')][_0x8161('0x45')]({'name':_0x4d679a[_0x8161('0x25')],'resourceId':_0x4d679a['id'],'type':_0x53855e[_0x8161('0x25')],'sectionId':_0x53855e['id']},{})['then'](function(){return _0x34dcc9;});}else{return _0x34dcc9;}})['catch'](function(_0x5a48d8){logger[_0x8161('0x4d')](_0x8161('0x4e'),_0x5a48d8);throw _0x5a48d8;});}return _0x34dcc9;})['then'](respondWithResult(_0x445aec,0xc9))['catch'](handleError(_0x445aec,null));};exports[_0x8161('0x4f')]=function(_0x51cb3c,_0x26d83f){if(_0x51cb3c[_0x8161('0x46')]['id']){delete _0x51cb3c['body']['id'];}return db[_0x8161('0x3b')]['find']({'where':{'id':_0x51cb3c[_0x8161('0x40')]['id']}})[_0x8161('0x22')](handleEntityNotFound(_0x26d83f,null))['then'](saveUpdates(_0x51cb3c[_0x8161('0x46')],null))[_0x8161('0x22')](respondWithResult(_0x26d83f,null))[_0x8161('0x44')](handleError(_0x26d83f,null));};exports[_0x8161('0x21')]=function(_0x2a8836,_0x39b520){return db[_0x8161('0x3b')][_0x8161('0x43')]({'where':{'id':_0x2a8836[_0x8161('0x40')]['id']}})['then'](handleEntityNotFound(_0x39b520,null))['then'](removeEntity(_0x39b520,null))[_0x8161('0x44')](handleError(_0x39b520,null));}; \ No newline at end of file +var _0xa23f=['UserProfileResource','destroy','sendStatus','error','stack','name','index','map','Disposition','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','findAll','show','params','include','options','find','catch','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','get','Dispositions'];(function(_0x4bb711,_0x52865d){var _0x172e39=function(_0xc32ef7){while(--_0xc32ef7){_0x4bb711['push'](_0x4bb711['shift']());}};_0x172e39(++_0x52865d);}(_0xa23f,0x7c));var _0xfa23=function(_0x256953,_0x94c74e){_0x256953=_0x256953-0x0;var _0x54b751=_0xa23f[_0x256953];return _0x54b751;};'use strict';var emlformat=require(_0xfa23('0x0'));var rimraf=require(_0xfa23('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfa23('0x2'));var moment=require(_0xfa23('0x3'));var BPromise=require(_0xfa23('0x4'));var Mustache=require(_0xfa23('0x5'));var util=require('util');var path=require(_0xfa23('0x6'));var sox=require('sox');var csv=require(_0xfa23('0x7'));var ejs=require(_0xfa23('0x8'));var fs=require('fs');var fs_extra=require(_0xfa23('0x9'));var _=require(_0xfa23('0xa'));var squel=require('squel');var crypto=require(_0xfa23('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfa23('0xc'));var toCsv=require(_0xfa23('0x7'));var querystring=require(_0xfa23('0xd'));var Papa=require(_0xfa23('0xe'));var Redis=require(_0xfa23('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfa23('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa23('0x11'))('api');var utils=require(_0xfa23('0x12'));var config=require(_0xfa23('0x13'));var licenseUtil=require(_0xfa23('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5ffe,_0x42380){_0x42380=_0x42380||0xcc;return function(_0x46f991){if(_0x46f991){return _0x1e5ffe['sendStatus'](_0x42380);}return _0x1e5ffe['status'](_0x42380)[_0xfa23('0x15')]();};}function respondWithResult(_0x23712b,_0x3f50f0){_0x3f50f0=_0x3f50f0||0xc8;return function(_0x36252c){if(_0x36252c){return _0x23712b['status'](_0x3f50f0)[_0xfa23('0x16')](_0x36252c);}};}function respondWithFilteredResult(_0xb7d11a,_0x2095a5){return function(_0x9611e0){if(_0x9611e0){var _0x542d9a=typeof _0x2095a5[_0xfa23('0x17')]===_0xfa23('0x18')&&typeof _0x2095a5[_0xfa23('0x19')]===_0xfa23('0x18');var _0x3fa5f6=_0x9611e0['count'];var _0x59610c=_0x542d9a?0x0:_0x2095a5['offset'];var _0x445bd0=_0x542d9a?_0x9611e0[_0xfa23('0x1a')]:_0x2095a5['offset']+_0x2095a5[_0xfa23('0x19')];var _0x2c456b;if(_0x445bd0>=_0x3fa5f6){_0x445bd0=_0x3fa5f6;_0x2c456b=0xc8;}else{_0x2c456b=0xce;}_0xb7d11a[_0xfa23('0x1b')](_0x2c456b);return _0xb7d11a['set'](_0xfa23('0x1c'),_0x59610c+'-'+_0x445bd0+'/'+_0x3fa5f6)[_0xfa23('0x16')](_0x9611e0);}return null;};}function patchUpdates(_0x47c323){return function(_0x16e4f9){try{jsonpatch[_0xfa23('0x1d')](_0x16e4f9,_0x47c323,!![]);}catch(_0x148f3b){return BPromise[_0xfa23('0x1e')](_0x148f3b);}return _0x16e4f9[_0xfa23('0x1f')]();};}function saveUpdates(_0x10ef95,_0x31eedb){return function(_0x485838){if(_0x485838){return _0x485838[_0xfa23('0x20')](_0x10ef95)[_0xfa23('0x21')](function(_0x34a2ce){return _0x34a2ce;});}return null;};}function removeEntity(_0xe4680f,_0x542cde){return function(_0x4500a2){if(_0x4500a2){return _0x4500a2['destroy']()[_0xfa23('0x21')](function(){var _0x1abb42=_0x4500a2[_0xfa23('0x22')]({'plain':!![]});var _0x26bdce=_0xfa23('0x23');return db[_0xfa23('0x24')][_0xfa23('0x25')]({'where':{'type':_0x26bdce,'resourceId':_0x1abb42['id']}})[_0xfa23('0x21')](function(){return _0x4500a2;});})['then'](function(){_0xe4680f[_0xfa23('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ae38a,_0x5de208){return function(_0x4ea972){if(!_0x4ea972){_0x1ae38a[_0xfa23('0x26')](0x194);}return _0x4ea972;};}function handleError(_0x1a9a90,_0xbf9d19){_0xbf9d19=_0xbf9d19||0x1f4;return function(_0x3b00a8){logger[_0xfa23('0x27')](_0x3b00a8[_0xfa23('0x28')]);if(_0x3b00a8[_0xfa23('0x29')]){delete _0x3b00a8['name'];}_0x1a9a90[_0xfa23('0x1b')](_0xbf9d19)['send'](_0x3b00a8);};}exports[_0xfa23('0x2a')]=function(_0x6bf719,_0x5df1f9){var _0x1c83d0={},_0x3a6966={},_0xf9c420={'count':0x0,'rows':[]};var _0x3dadc0=_[_0xfa23('0x2b')](db[_0xfa23('0x2c')][_0xfa23('0x2d')],function(_0x19c7bc){return{'name':_0x19c7bc[_0xfa23('0x2e')],'type':_0x19c7bc['type'][_0xfa23('0x2f')]};});_0x3a6966['model']=_[_0xfa23('0x2b')](_0x3dadc0,_0xfa23('0x29'));_0x3a6966[_0xfa23('0x30')]=_[_0xfa23('0x31')](_0x6bf719[_0xfa23('0x30')]);_0x3a6966[_0xfa23('0x32')]=_[_0xfa23('0x33')](_0x3a6966[_0xfa23('0x34')],_0x3a6966[_0xfa23('0x30')]);_0x1c83d0['attributes']=_[_0xfa23('0x33')](_0x3a6966['model'],qs[_0xfa23('0x35')](_0x6bf719[_0xfa23('0x30')][_0xfa23('0x35')]));_0x1c83d0[_0xfa23('0x36')]=_0x1c83d0[_0xfa23('0x36')][_0xfa23('0x37')]?_0x1c83d0[_0xfa23('0x36')]:_0x3a6966['model'];if(!_0x6bf719[_0xfa23('0x30')][_0xfa23('0x38')](_0xfa23('0x39'))){_0x1c83d0[_0xfa23('0x19')]=qs['limit'](_0x6bf719['query']['limit']);_0x1c83d0[_0xfa23('0x17')]=qs[_0xfa23('0x17')](_0x6bf719['query'][_0xfa23('0x17')]);}_0x1c83d0[_0xfa23('0x3a')]=qs[_0xfa23('0x3b')](_0x6bf719['query'][_0xfa23('0x3b')]);_0x1c83d0['where']=qs[_0xfa23('0x32')](_[_0xfa23('0x3c')](_0x6bf719[_0xfa23('0x30')],_0x3a6966[_0xfa23('0x32')]),_0x3dadc0);if(_0x6bf719[_0xfa23('0x30')][_0xfa23('0x3d')]){_0x1c83d0['where']=_[_0xfa23('0x3e')](_0x1c83d0[_0xfa23('0x3f')],{'$or':_[_0xfa23('0x2b')](_0x3dadc0,function(_0x245f49){if(_0x245f49['type']!==_0xfa23('0x40')){var _0xa4d21f={};_0xa4d21f[_0x245f49[_0xfa23('0x29')]]={'$like':'%'+_0x6bf719[_0xfa23('0x30')][_0xfa23('0x3d')]+'%'};return _0xa4d21f;}})});}_0x1c83d0=_[_0xfa23('0x3e')]({},_0x1c83d0,_0x6bf719['options']);var _0x93ebd4={'where':_0x1c83d0['where']};return db['Disposition'][_0xfa23('0x1a')](_0x93ebd4)[_0xfa23('0x21')](function(_0x5937e0){_0xf9c420[_0xfa23('0x1a')]=_0x5937e0;if(_0x6bf719[_0xfa23('0x30')][_0xfa23('0x41')]){_0x1c83d0['include']=[{'all':!![]}];}return db[_0xfa23('0x2c')][_0xfa23('0x42')](_0x1c83d0);})[_0xfa23('0x21')](function(_0x539271){_0xf9c420['rows']=_0x539271;return _0xf9c420;})[_0xfa23('0x21')](respondWithFilteredResult(_0x5df1f9,_0x1c83d0))['catch'](handleError(_0x5df1f9,null));};exports[_0xfa23('0x43')]=function(_0xd391f,_0x448e45){var _0x4a4028={'raw':!![],'where':{'id':_0xd391f[_0xfa23('0x44')]['id']}},_0x352e66={};_0x352e66[_0xfa23('0x34')]=_[_0xfa23('0x31')](db['Disposition'][_0xfa23('0x2d')]);_0x352e66[_0xfa23('0x30')]=_[_0xfa23('0x31')](_0xd391f['query']);_0x352e66['filters']=_[_0xfa23('0x33')](_0x352e66['model'],_0x352e66[_0xfa23('0x30')]);_0x4a4028[_0xfa23('0x36')]=_[_0xfa23('0x33')](_0x352e66[_0xfa23('0x34')],qs[_0xfa23('0x35')](_0xd391f[_0xfa23('0x30')]['fields']));_0x4a4028[_0xfa23('0x36')]=_0x4a4028[_0xfa23('0x36')][_0xfa23('0x37')]?_0x4a4028[_0xfa23('0x36')]:_0x352e66[_0xfa23('0x34')];if(_0xd391f[_0xfa23('0x30')]['includeAll']){_0x4a4028[_0xfa23('0x45')]=[{'all':!![]}];}_0x4a4028=_[_0xfa23('0x3e')]({},_0x4a4028,_0xd391f[_0xfa23('0x46')]);return db[_0xfa23('0x2c')][_0xfa23('0x47')](_0x4a4028)['then'](handleEntityNotFound(_0x448e45,null))[_0xfa23('0x21')](respondWithResult(_0x448e45,null))[_0xfa23('0x48')](handleError(_0x448e45,null));};exports[_0xfa23('0x49')]=function(_0x5e4633,_0x253faf){return db[_0xfa23('0x2c')][_0xfa23('0x49')](_0x5e4633[_0xfa23('0x4a')],{})[_0xfa23('0x21')](function(_0x312267){var _0x709755=_0x5e4633['user'][_0xfa23('0x22')]({'plain':!![]});if(!_0x709755)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x709755[_0xfa23('0x4b')]===_0xfa23('0x4c')){var _0x3824a9=_0x312267[_0xfa23('0x22')]({'plain':!![]});var _0x12a984=_0xfa23('0x23');return db['UserProfileSection'][_0xfa23('0x47')]({'where':{'name':_0x12a984,'userProfileId':_0x709755[_0xfa23('0x4d')]},'raw':!![]})[_0xfa23('0x21')](function(_0x47459e){if(_0x47459e&&_0x47459e[_0xfa23('0x4e')]===0x0){return db[_0xfa23('0x24')][_0xfa23('0x49')]({'name':_0x3824a9['name'],'resourceId':_0x3824a9['id'],'type':_0x47459e[_0xfa23('0x29')],'sectionId':_0x47459e['id']},{})[_0xfa23('0x21')](function(){return _0x312267;});}else{return _0x312267;}})[_0xfa23('0x48')](function(_0xd64189){logger['error'](_0xfa23('0x4f'),_0xd64189);throw _0xd64189;});}return _0x312267;})[_0xfa23('0x21')](respondWithResult(_0x253faf,0xc9))[_0xfa23('0x48')](handleError(_0x253faf,null));};exports[_0xfa23('0x20')]=function(_0x401309,_0x2993a3){if(_0x401309['body']['id']){delete _0x401309[_0xfa23('0x4a')]['id'];}return db['Disposition'][_0xfa23('0x47')]({'where':{'id':_0x401309[_0xfa23('0x44')]['id']}})['then'](handleEntityNotFound(_0x2993a3,null))[_0xfa23('0x21')](saveUpdates(_0x401309[_0xfa23('0x4a')],null))['then'](respondWithResult(_0x2993a3,null))[_0xfa23('0x48')](handleError(_0x2993a3,null));};exports[_0xfa23('0x25')]=function(_0x5d3777,_0x123116){return db[_0xfa23('0x2c')][_0xfa23('0x47')]({'where':{'id':_0x5d3777[_0xfa23('0x44')]['id']}})['then'](handleEntityNotFound(_0x123116,null))[_0xfa23('0x21')](removeEntity(_0x123116,null))[_0xfa23('0x48')](handleError(_0x123116,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index d25dcf1..11592c4 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 _0xfddc=['name_mail','MailAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId'];(function(_0xef4b6c,_0x169bc1){var _0x31f2a4=function(_0x1ba28c){while(--_0x1ba28c){_0xef4b6c['push'](_0xef4b6c['shift']());}};_0x31f2a4(++_0x169bc1);}(_0xfddc,0x1a8));var _0xcfdd=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xfddc[_0x35da42];return _0x370035;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcfdd('0x0'))(_0xcfdd('0x1'));var moment=require(_0xcfdd('0x2'));var BPromise=require(_0xcfdd('0x3'));var rp=require(_0xcfdd('0x4'));var fs=require('fs');var path=require(_0xcfdd('0x5'));var rimraf=require(_0xcfdd('0x6'));var config=require(_0xcfdd('0x7'));var attributes=require(_0xcfdd('0x8'));module['exports']=function(_0x3ec795,_0x3ddedb){return _0x3ec795['define'](_0xcfdd('0x9'),attributes,{'tableName':_0xcfdd('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcfdd('0xb'),'fields':[_0xcfdd('0xc'),_0xcfdd('0xd')]},{'unique':!![],'name':_0xcfdd('0xe'),'fields':[_0xcfdd('0xc'),_0xcfdd('0xf')]},{'unique':!![],'name':_0xcfdd('0x10'),'fields':[_0xcfdd('0xc'),_0xcfdd('0x11')]},{'unique':!![],'name':'name_sms','fields':[_0xcfdd('0xc'),'SmsAccountId']},{'unique':!![],'name':'name_fax','fields':[_0xcfdd('0xc'),_0xcfdd('0x12')]},{'unique':!![],'name':_0xcfdd('0x13'),'fields':[_0xcfdd('0xc'),_0xcfdd('0x14')]},{'unique':!![],'name':_0xcfdd('0x15'),'fields':[_0xcfdd('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x101a=['define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','request-promise','rimraf','./disposition.attributes'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0x101a,0x162));var _0xa101=function(_0xa60a88,_0x52dc31){_0xa60a88=_0xa60a88-0x0;var _0x4307ef=_0x101a[_0xa60a88];return _0x4307ef;};'use strict';var _=require(_0xa101('0x0'));var util=require(_0xa101('0x1'));var logger=require('../../config/logger')(_0xa101('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa101('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa101('0x4'));var config=require('../../config/environment');var attributes=require(_0xa101('0x5'));module['exports']=function(_0x21fc3,_0x2245b3){return _0x21fc3[_0xa101('0x6')](_0xa101('0x7'),attributes,{'tableName':_0xa101('0x8'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xa101('0x9'),'fields':[_0xa101('0xa'),'ListId']},{'unique':!![],'name':_0xa101('0xb'),'fields':[_0xa101('0xa'),_0xa101('0xc')]},{'unique':!![],'name':_0xa101('0xd'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0xa101('0xe'),'fields':[_0xa101('0xa'),'SmsAccountId']},{'unique':!![],'name':_0xa101('0xf'),'fields':[_0xa101('0xa'),_0xa101('0x10')]},{'unique':!![],'name':_0xa101('0x11'),'fields':['name',_0xa101('0x12')]},{'unique':!![],'name':'name_whatsapp','fields':['name',_0xa101('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 3aeeefc..9a2ace6 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(_0x5d367d,_0x5acc35){var _0x34ce73=function(_0x46a7c4){while(--_0x46a7c4){_0x5d367d['push'](_0x5d367d['shift']());}};_0x34ce73(++_0x5acc35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'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(_0x4d26ef,_0x211f64){var _0x201f07=function(_0x42c49b){while(--_0x42c49b){_0x4d26ef['push'](_0x4d26ef['shift']());}};_0x201f07(++_0x211f64);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 5ad129c..7d0e643 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 _0xd608=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','post','create','put','delete','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xd608,0xa7));var _0x8d60=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd608[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8d60('0x0'));var util=require(_0x8d60('0x1'));var path=require(_0x8d60('0x2'));var timeout=require(_0x8d60('0x3'));var express=require(_0x8d60('0x4'));var router=express[_0x8d60('0x5')]();var fs_extra=require(_0x8d60('0x6'));var auth=require(_0x8d60('0x7'));var interaction=require(_0x8d60('0x8'));var config=require(_0x8d60('0x9'));var controller=require(_0x8d60('0xa'));router['get']('/',auth[_0x8d60('0xb')](),controller[_0x8d60('0xc')]);router[_0x8d60('0xd')](_0x8d60('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x8d60('0xf')]('/',auth[_0x8d60('0xb')](),controller[_0x8d60('0x10')]);router[_0x8d60('0x11')]('/:id',auth[_0x8d60('0xb')](),controller['update']);router[_0x8d60('0x12')](_0x8d60('0xe'),auth['isAuthenticated'](),controller[_0x8d60('0x13')]);module[_0x8d60('0x14')]=router; \ No newline at end of file +var _0x78ec=['post','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./disposition.controller','isAuthenticated','index','get','/:id','show'];(function(_0x2762df,_0xe18da){var _0x19e348=function(_0xa13065){while(--_0xa13065){_0x2762df['push'](_0x2762df['shift']());}};_0x19e348(++_0xe18da);}(_0x78ec,0x195));var _0xc78e=function(_0x3081c1,_0x1dad8b){_0x3081c1=_0x3081c1-0x0;var _0x5b31de=_0x78ec[_0x3081c1];return _0x5b31de;};'use strict';var multer=require('multer');var util=require(_0xc78e('0x0'));var path=require(_0xc78e('0x1'));var timeout=require(_0xc78e('0x2'));var express=require('express');var router=express[_0xc78e('0x3')]();var fs_extra=require(_0xc78e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc78e('0x5'));var config=require(_0xc78e('0x6'));var controller=require(_0xc78e('0x7'));router['get']('/',auth[_0xc78e('0x8')](),controller[_0xc78e('0x9')]);router[_0xc78e('0xa')](_0xc78e('0xb'),auth[_0xc78e('0x8')](),controller[_0xc78e('0xc')]);router[_0xc78e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc78e('0xe')](_0xc78e('0xb'),auth['isAuthenticated'](),controller[_0xc78e('0xf')]);router[_0xc78e('0x10')](_0xc78e('0xb'),auth[_0xc78e('0x8')](),controller[_0xc78e('0x11')]);module[_0xc78e('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index f671da0..00451b4 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 _0x9f5a=['sequelize','exports','STRING','yes','ENUM','2400','7200','9600','12000','14400','4800','INTEGER','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x9f5a,0xbd));var _0xa9f5=function(_0x428f3b,_0x3c2b17){_0x428f3b=_0x428f3b-0x0;var _0x46a7f7=_0x9f5a[_0x428f3b];return _0x46a7f7;};'use strict';var Sequelize=require(_0xa9f5('0x0'));module[_0xa9f5('0x1')]={'name':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa9f5('0x2')]},'ecm':{'type':Sequelize['ENUM'](_0xa9f5('0x3'),'no'),'defaultValue':_0xa9f5('0x3')},'headerinfo':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0xa9f5('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),_0xa9f5('0x8'),_0xa9f5('0x9')),'defaultValue':_0xa9f5('0xa')},'maxrate':{'type':Sequelize[_0xa9f5('0x4')](_0xa9f5('0x5'),'4800',_0xa9f5('0x6'),_0xa9f5('0x7'),'12000',_0xa9f5('0x9')),'defaultValue':_0xa9f5('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xa9f5('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xa9f5('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xa9f5('0x4')]('SIP',_0xa9f5('0xc'),_0xa9f5('0xd'),_0xa9f5('0xe')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xa9f5('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa9f5('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa9f5('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa9f5('0xb')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xa9f5('0x10')],'defaultValue':![],'comment':_0xa9f5('0x11'),'set':function(_0x230fc2){if(!_0x230fc2)this[_0xa9f5('0x12')](_0xa9f5('0x13'),null);this[_0xa9f5('0x12')](_0xa9f5('0x14'),_0x230fc2);}}}; \ No newline at end of file +var _0x6c7b=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','yes','STRING','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','9600','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT'];(function(_0xebaba9,_0x15a246){var _0xca52ea=function(_0x2f76e6){while(--_0x2f76e6){_0xebaba9['push'](_0xebaba9['shift']());}};_0xca52ea(++_0x15a246);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x350560,_0x3c5a69){_0x350560=_0x350560-0x0;var _0x562132=_0x6c7b[_0x350560];return _0x562132;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xb6c7('0x1')]('yes','no'),'defaultValue':_0xb6c7('0x2')},'headerinfo':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':_0xb6c7('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xb6c7('0x5')},'minrate':{'type':Sequelize[_0xb6c7('0x1')](_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),'9600',_0xb6c7('0x9'),_0xb6c7('0xa')),'defaultValue':_0xb6c7('0x7')},'maxrate':{'type':Sequelize[_0xb6c7('0x1')](_0xb6c7('0x6'),_0xb6c7('0x7'),_0xb6c7('0x8'),_0xb6c7('0xb'),'12000','14400'),'defaultValue':_0xb6c7('0xa')},'modem':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':_0xb6c7('0xc')},'gateway':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xb6c7('0x3')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xb6c7('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xb6c7('0x1')]('SIP',_0xb6c7('0xe'),_0xb6c7('0xf'),_0xb6c7('0x10')),'defaultValue':_0xb6c7('0x11')},'key':{'type':Sequelize[_0xb6c7('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xb6c7('0x12')],'defaultValue':function(){return _0xb6c7('0x13');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb6c7('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb6c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb6c7('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb6c7('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0xb6c7('0x15')},'mandatoryDisposition':{'type':Sequelize[_0xb6c7('0x14')],'defaultValue':![],'comment':_0xb6c7('0x16'),'set':function(_0x200833){if(!_0x200833)this[_0xb6c7('0x17')](_0xb6c7('0x18'),null);this[_0xb6c7('0x17')](_0xb6c7('0x19'),_0x200833);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index c626e7c..16496dd 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 _0x4739=['options','includeAll','include','catch','show','Pause','length','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxAccounts','UserProfileSection','find','userProfileId','autoAssociation','body','params','describe','addDisposition','FaxAccountId','getDispositions','hasOwnProperty','nolimit','Disposition','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','findAll','rows','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','fullname','internal','Tags','color','tag','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','sequelize','VoiceExtension','updateAccountApplications','update','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','$gte','split','YYYY-MM-DD\x20HH:mm:ss','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','fax','Contacts','ListId','List\x20not\x20found','Send\x20Fax\x20failed','Messages','Contact\x20not\x20found','spread','out','filename','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','defaults','socket.io-emitter','redis','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','key','model','keys','query','intersection','fields','attributes','order','sort','where','filters','pick','filter','merge'];(function(_0x341df4,_0x6bf546){var _0x13c42b=function(_0x53bc85){while(--_0x53bc85){_0x341df4['push'](_0x341df4['shift']());}};_0x13c42b(++_0x6bf546);}(_0x4739,0x76));var _0x9473=function(_0x2cc2e7,_0x10c9c7){_0x2cc2e7=_0x2cc2e7-0x0;var _0x37ff7c=_0x4739[_0x2cc2e7];return _0x37ff7c;};'use strict';var emlformat=require(_0x9473('0x0'));var rimraf=require(_0x9473('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9473('0x2'));var moment=require(_0x9473('0x3'));var BPromise=require(_0x9473('0x4'));var Mustache=require(_0x9473('0x5'));var util=require(_0x9473('0x6'));var path=require('path');var sox=require(_0x9473('0x7'));var csv=require('to-csv');var ejs=require(_0x9473('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9473('0x9'));var squel=require(_0x9473('0xa'));var crypto=require(_0x9473('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9473('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9473('0xd'));var Papa=require(_0x9473('0xe'));var Redis=require(_0x9473('0xf'));var authService=require(_0x9473('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9473('0x11'));var hardwareService=require(_0x9473('0x12'));var logger=require(_0x9473('0x13'))(_0x9473('0x14'));var utils=require(_0x9473('0x15'));var config=require(_0x9473('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x9473('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9473('0x18'))(new Redis(config[_0x9473('0x19')]));require('./faxAccount.socket')[_0x9473('0x1a')](socket);var jayson=require(_0x9473('0x1b'));var client=jayson[_0x9473('0x1c')][_0x9473('0x1d')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e96bf,_0x1b50ac,_0x34be7a,_0x2a5206){return new BPromise(function(_0x1dde73,_0x3ef066){var _0x25b7c2=_0x2a5206||client;return _0x25b7c2[_0x9473('0x1e')](_0x3e96bf,_0x34be7a)[_0x9473('0x1f')](function(_0x5307f1){logger[_0x9473('0x20')](_0x9473('0x21'),_0x1b50ac,_0x9473('0x22'));logger[_0x9473('0x23')](_0x9473('0x24'),_0x1b50ac,_0x9473('0x22'),JSON[_0x9473('0x25')](_0x5307f1));if(_0x5307f1[_0x9473('0x26')]){if(_0x5307f1['error'][_0x9473('0x27')]===0x1f4){logger[_0x9473('0x26')](_0x9473('0x21'),_0x1b50ac,_0x5307f1[_0x9473('0x26')][_0x9473('0x28')]);return _0x3ef066(_0x5307f1['error'][_0x9473('0x28')]);}logger['error'](_0x9473('0x21'),_0x1b50ac,_0x5307f1[_0x9473('0x26')]['message']);return _0x1dde73(_0x5307f1[_0x9473('0x26')][_0x9473('0x28')]);}else{logger[_0x9473('0x20')](_0x9473('0x21'),_0x1b50ac,_0x9473('0x22'));_0x1dde73(_0x5307f1[_0x9473('0x29')][_0x9473('0x28')]);}})['catch'](function(_0x1cff9b){logger[_0x9473('0x26')](_0x9473('0x21'),_0x1b50ac,_0x1cff9b);_0x3ef066(_0x1cff9b);});});}function respondWithStatusCode(_0x1d281b,_0x5bf807){_0x5bf807=_0x5bf807||0xcc;return function(_0x3e4609){if(_0x3e4609){return _0x1d281b[_0x9473('0x2a')](_0x5bf807);}return _0x1d281b[_0x9473('0x2b')](_0x5bf807)[_0x9473('0x2c')]();};}function respondWithResult(_0x1adb11,_0x236626){_0x236626=_0x236626||0xc8;return function(_0xad0b81){if(_0xad0b81){return _0x1adb11[_0x9473('0x2b')](_0x236626)[_0x9473('0x2d')](_0xad0b81);}};}function respondWithFilteredResult(_0x2db32a,_0x2e29f9){return function(_0xdc097a){if(_0xdc097a){var _0x3a9c89=typeof _0x2e29f9[_0x9473('0x2e')]===_0x9473('0x2f')&&typeof _0x2e29f9[_0x9473('0x30')]===_0x9473('0x2f');var _0x40da3e=_0xdc097a['count'];var _0x5db787=_0x3a9c89?0x0:_0x2e29f9[_0x9473('0x2e')];var _0x25bf5e=_0x3a9c89?_0xdc097a[_0x9473('0x31')]:_0x2e29f9['offset']+_0x2e29f9['limit'];var _0x41d09b;if(_0x25bf5e>=_0x40da3e){_0x25bf5e=_0x40da3e;_0x41d09b=0xc8;}else{_0x41d09b=0xce;}_0x2db32a[_0x9473('0x2b')](_0x41d09b);return _0x2db32a[_0x9473('0x32')](_0x9473('0x33'),_0x5db787+'-'+_0x25bf5e+'/'+_0x40da3e)[_0x9473('0x2d')](_0xdc097a);}return null;};}function patchUpdates(_0x368ce0){return function(_0x27d999){try{jsonpatch[_0x9473('0x34')](_0x27d999,_0x368ce0,!![]);}catch(_0xf7dde4){return BPromise[_0x9473('0x35')](_0xf7dde4);}return _0x27d999[_0x9473('0x36')]();};}function saveUpdates(_0x4b9258,_0x8339b8){return function(_0x2280d0){if(_0x2280d0){return _0x2280d0['update'](_0x4b9258)[_0x9473('0x1f')](function(_0x57d243){return _0x57d243;});}return null;};}function removeEntity(_0x2bfa53,_0x28ffbf){return function(_0x3a0e1b){if(_0x3a0e1b){return _0x3a0e1b[_0x9473('0x37')]()[_0x9473('0x1f')](function(){var _0x331ac1=_0x3a0e1b[_0x9473('0x38')]({'plain':!![]});var _0x422a65='FaxAccounts';return db[_0x9473('0x39')][_0x9473('0x37')]({'where':{'type':_0x422a65,'resourceId':_0x331ac1['id']}})[_0x9473('0x1f')](function(){return _0x3a0e1b;});})[_0x9473('0x1f')](function(){_0x2bfa53[_0x9473('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39f639,_0x440f20){return function(_0x43498b){if(!_0x43498b){_0x39f639[_0x9473('0x2a')](0x194);}return _0x43498b;};}function handleError(_0x416b22,_0x246275){_0x246275=_0x246275||0x1f4;return function(_0x5569cb){logger['error'](_0x5569cb[_0x9473('0x3a')]);if(_0x5569cb[_0x9473('0x3b')]){delete _0x5569cb[_0x9473('0x3b')];}_0x416b22[_0x9473('0x2b')](_0x246275)[_0x9473('0x3c')](_0x5569cb);};}exports[_0x9473('0x3d')]=function(_0x241580,_0x15ab76){var _0x3c0d17={'include':[{'model':db['Pause'],'as':_0x9473('0x3e')}]},_0x32c6e2={},_0x55273={'count':0x0,'rows':[]};var _0x2235cf=_[_0x9473('0x3f')](db[_0x9473('0x40')][_0x9473('0x41')],function(_0x5860c0){return{'name':_0x5860c0['fieldName'],'type':_0x5860c0[_0x9473('0x42')][_0x9473('0x43')]};});_0x32c6e2[_0x9473('0x44')]=_[_0x9473('0x3f')](_0x2235cf,_0x9473('0x3b'));_0x32c6e2['query']=_[_0x9473('0x45')](_0x241580[_0x9473('0x46')]);_0x32c6e2['filters']=_[_0x9473('0x47')](_0x32c6e2[_0x9473('0x44')],_0x32c6e2[_0x9473('0x46')]);_0x3c0d17['attributes']=_[_0x9473('0x47')](_0x32c6e2[_0x9473('0x44')],qs[_0x9473('0x48')](_0x241580[_0x9473('0x46')][_0x9473('0x48')]));_0x3c0d17[_0x9473('0x49')]=_0x3c0d17[_0x9473('0x49')]['length']?_0x3c0d17[_0x9473('0x49')]:_0x32c6e2[_0x9473('0x44')];if(!_0x241580[_0x9473('0x46')]['hasOwnProperty']('nolimit')){_0x3c0d17[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x241580[_0x9473('0x46')][_0x9473('0x30')]);_0x3c0d17['offset']=qs['offset'](_0x241580[_0x9473('0x46')][_0x9473('0x2e')]);}_0x3c0d17[_0x9473('0x4a')]=qs[_0x9473('0x4b')](_0x241580[_0x9473('0x46')]['sort']);_0x3c0d17[_0x9473('0x4c')]=qs[_0x9473('0x4d')](_[_0x9473('0x4e')](_0x241580[_0x9473('0x46')],_0x32c6e2[_0x9473('0x4d')]),_0x2235cf);if(_0x241580['query'][_0x9473('0x4f')]){_0x3c0d17['where']=_['merge'](_0x3c0d17[_0x9473('0x4c')],{'$or':_[_0x9473('0x3f')](_0x2235cf,function(_0x2d14df){if(_0x2d14df[_0x9473('0x42')]!=='VIRTUAL'){var _0x31b57b={};_0x31b57b[_0x2d14df['name']]={'$like':'%'+_0x241580['query'][_0x9473('0x4f')]+'%'};return _0x31b57b;}})});}_0x3c0d17=_[_0x9473('0x50')]({},_0x3c0d17,_0x241580[_0x9473('0x51')]);var _0x2ffbc7={'where':_0x3c0d17[_0x9473('0x4c')]};return db[_0x9473('0x40')][_0x9473('0x31')](_0x2ffbc7)[_0x9473('0x1f')](function(_0x48b205){_0x55273['count']=_0x48b205;if(_0x241580[_0x9473('0x46')][_0x9473('0x52')]){_0x3c0d17[_0x9473('0x53')]=[{'all':!![]}];}return db[_0x9473('0x40')]['findAll'](_0x3c0d17);})['then'](function(_0x4a863a){_0x55273['rows']=_0x4a863a;return _0x55273;})['then'](respondWithFilteredResult(_0x15ab76,_0x3c0d17))[_0x9473('0x54')](handleError(_0x15ab76,null));};exports[_0x9473('0x55')]=function(_0x33d940,_0x24700){var _0x5c7fbd={'raw':![],'where':{'id':_0x33d940['params']['id']},'include':[{'model':db[_0x9473('0x56')],'as':_0x9473('0x3e')}]},_0x1f9da2={};_0x1f9da2[_0x9473('0x44')]=_[_0x9473('0x45')](db['FaxAccount']['rawAttributes']);_0x1f9da2[_0x9473('0x46')]=_[_0x9473('0x45')](_0x33d940[_0x9473('0x46')]);_0x1f9da2[_0x9473('0x4d')]=_[_0x9473('0x47')](_0x1f9da2[_0x9473('0x44')],_0x1f9da2['query']);_0x5c7fbd[_0x9473('0x49')]=_[_0x9473('0x47')](_0x1f9da2[_0x9473('0x44')],qs[_0x9473('0x48')](_0x33d940[_0x9473('0x46')][_0x9473('0x48')]));_0x5c7fbd['attributes']=_0x5c7fbd[_0x9473('0x49')][_0x9473('0x57')]?_0x5c7fbd[_0x9473('0x49')]:_0x1f9da2[_0x9473('0x44')];if(_0x33d940[_0x9473('0x46')][_0x9473('0x52')]){_0x5c7fbd[_0x9473('0x53')]=[{'all':!![]}];}_0x5c7fbd=_[_0x9473('0x50')]({},_0x5c7fbd,_0x33d940[_0x9473('0x51')]);return db[_0x9473('0x40')]['find'](_0x5c7fbd)['then'](handleEntityNotFound(_0x24700,null))['then'](respondWithResult(_0x24700,null))[_0x9473('0x54')](handleError(_0x24700,null));};exports['create']=function(_0x134c32,_0x5340a7){return db[_0x9473('0x40')][_0x9473('0x58')](_0x134c32['body'],{})[_0x9473('0x1f')](function(_0x39a315){var _0x545b41=_0x134c32['user'][_0x9473('0x38')]({'plain':!![]});if(!_0x545b41)throw new Error(_0x9473('0x59'));if(_0x545b41[_0x9473('0x5a')]===_0x9473('0x5b')){var _0x2f4ca4=_0x39a315[_0x9473('0x38')]({'plain':!![]});var _0x582287=_0x9473('0x5c');return db[_0x9473('0x5d')][_0x9473('0x5e')]({'where':{'name':_0x582287,'userProfileId':_0x545b41[_0x9473('0x5f')]},'raw':!![]})['then'](function(_0x2ccf27){if(_0x2ccf27&&_0x2ccf27[_0x9473('0x60')]===0x0){return db[_0x9473('0x39')][_0x9473('0x58')]({'name':_0x2f4ca4[_0x9473('0x3b')],'resourceId':_0x2f4ca4['id'],'type':_0x2ccf27[_0x9473('0x3b')],'sectionId':_0x2ccf27['id']},{})[_0x9473('0x1f')](function(){return _0x39a315;});}else{return _0x39a315;}})[_0x9473('0x54')](function(_0x5f0e8b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5f0e8b);throw _0x5f0e8b;});}return _0x39a315;})[_0x9473('0x1f')](respondWithResult(_0x5340a7,0xc9))[_0x9473('0x54')](handleError(_0x5340a7,null));};exports['update']=function(_0x33bee4,_0x2aeb65){if(_0x33bee4['body']['id']){delete _0x33bee4[_0x9473('0x61')]['id'];}return db['FaxAccount'][_0x9473('0x5e')]({'where':{'id':_0x33bee4[_0x9473('0x62')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9473('0x1f')](handleEntityNotFound(_0x2aeb65,null))[_0x9473('0x1f')](saveUpdates(_0x33bee4[_0x9473('0x61')],null))[_0x9473('0x1f')](respondWithResult(_0x2aeb65,null))[_0x9473('0x54')](handleError(_0x2aeb65,null));};exports['destroy']=function(_0x4f4356,_0x10d8f3){return db[_0x9473('0x40')][_0x9473('0x5e')]({'where':{'id':_0x4f4356['params']['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x10d8f3,null))['then'](removeEntity(_0x10d8f3,null))[_0x9473('0x54')](handleError(_0x10d8f3,null));};exports[_0x9473('0x63')]=function(_0x14d031,_0xd7aaf0){return db['FaxAccount'][_0x9473('0x63')]()[_0x9473('0x1f')](respondWithResult(_0xd7aaf0,null))['catch'](handleError(_0xd7aaf0,null));};exports[_0x9473('0x64')]=function(_0x433850,_0x500ca1,_0x422eba){if(_0x433850[_0x9473('0x61')]['id']){delete _0x433850[_0x9473('0x61')]['id'];}return db[_0x9473('0x40')][_0x9473('0x5e')]({'where':{'id':_0x433850[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x500ca1,null))[_0x9473('0x1f')](function(_0x38d6b2){if(_0x38d6b2){_0x433850[_0x9473('0x61')][_0x9473('0x65')]=_0x38d6b2['id'];return db['Disposition'][_0x9473('0x58')](_0x433850['body']);}})[_0x9473('0x1f')](respondWithResult(_0x500ca1,null))['catch'](handleError(_0x500ca1,null));};exports[_0x9473('0x66')]=function(_0x403929,_0x10935d,_0x18b393){var _0x10df04={'raw':![],'where':{}};var _0x34caf4={};var _0x14f650={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x403929[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x10935d,null))[_0x9473('0x1f')](function(_0x2b0f13){if(_0x2b0f13){_0x34caf4['model']=_[_0x9473('0x45')](db['Disposition']['rawAttributes']);_0x34caf4['query']=_[_0x9473('0x45')](_0x403929[_0x9473('0x46')]);_0x34caf4[_0x9473('0x4d')]=_[_0x9473('0x47')](_0x34caf4[_0x9473('0x44')],_0x34caf4[_0x9473('0x46')]);_0x10df04[_0x9473('0x49')]=_[_0x9473('0x47')](_0x34caf4['model'],qs[_0x9473('0x48')](_0x403929[_0x9473('0x46')]['fields']));_0x10df04[_0x9473('0x49')]=_0x10df04[_0x9473('0x49')][_0x9473('0x57')]?_0x10df04[_0x9473('0x49')]:_0x34caf4['model'];if(!_0x403929[_0x9473('0x46')][_0x9473('0x67')](_0x9473('0x68'))){_0x10df04[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x403929[_0x9473('0x46')][_0x9473('0x30')]);_0x10df04['offset']=qs[_0x9473('0x2e')](_0x403929[_0x9473('0x46')][_0x9473('0x2e')]);}_0x10df04[_0x9473('0x4a')]=qs[_0x9473('0x4b')](_0x403929[_0x9473('0x46')]['sort']);_0x10df04['where']=qs[_0x9473('0x4d')](_[_0x9473('0x4e')](_0x403929['query'],_0x34caf4[_0x9473('0x4d')]));_0x10df04[_0x9473('0x4c')]['FaxAccountId']=_0x2b0f13['id'];if(_0x403929['query'][_0x9473('0x4f')]){_0x10df04[_0x9473('0x4c')]=_[_0x9473('0x50')](_0x10df04[_0x9473('0x4c')],{'$or':_['map'](_0x10df04[_0x9473('0x49')],function(_0x370e64){var _0x1886c8={};_0x1886c8[_0x370e64]={'$like':'%'+_0x403929['query'][_0x9473('0x4f')]+'%'};return _0x1886c8;})});}_0x10df04=_[_0x9473('0x50')]({},_0x10df04,_0x403929['options']);return db[_0x9473('0x69')][_0x9473('0x31')]({'where':_0x10df04['where']})[_0x9473('0x1f')](function(_0x27b24e){_0x14f650[_0x9473('0x31')]=_0x27b24e;if(_0x403929['query']['includeAll']){_0x10df04[_0x9473('0x53')]=[{'all':!![]}];}return db[_0x9473('0x69')]['findAll'](_0x10df04);})[_0x9473('0x1f')](function(_0x5565ea){_0x14f650['rows']=_0x5565ea;return _0x14f650;});}})[_0x9473('0x1f')](respondWithFilteredResult(_0x10935d,_0x10df04))[_0x9473('0x54')](handleError(_0x10935d,null));};exports[_0x9473('0x6a')]=function(_0x2cd07a,_0x5bc5a0,_0x65efc2){return db[_0x9473('0x40')]['find']({'where':{'id':_0x2cd07a[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x5bc5a0,null))[_0x9473('0x1f')](function(_0x10aad2){if(_0x10aad2){return _0x10aad2[_0x9473('0x6a')](_0x2cd07a[_0x9473('0x46')][_0x9473('0x6b')]);}})[_0x9473('0x1f')](respondWithStatusCode(_0x5bc5a0,null))[_0x9473('0x54')](handleError(_0x5bc5a0,null));};exports[_0x9473('0x6c')]=function(_0x5b7c91,_0x400e54,_0x1d4821){if(_0x5b7c91[_0x9473('0x61')]['id']){delete _0x5b7c91[_0x9473('0x61')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x5b7c91[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x400e54,null))[_0x9473('0x1f')](function(_0x4e5544){if(_0x4e5544){_0x5b7c91['body']['FaxAccountId']=_0x4e5544['id'];return db['CannedAnswer'][_0x9473('0x58')](_0x5b7c91[_0x9473('0x61')]);}})['then'](respondWithResult(_0x400e54,null))[_0x9473('0x54')](handleError(_0x400e54,null));};exports[_0x9473('0x6d')]=function(_0x21b367,_0x5393e0,_0xf9ed96){var _0x352cf3={'raw':![],'where':{}};var _0xcd74b8={};var _0x5326e3={'count':0x0,'rows':[]};return db[_0x9473('0x40')][_0x9473('0x6e')]({'where':{'id':_0x21b367[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x5393e0,null))[_0x9473('0x1f')](function(_0x31403c){if(_0x31403c){_0xcd74b8[_0x9473('0x44')]=_[_0x9473('0x45')](db[_0x9473('0x6f')][_0x9473('0x41')]);_0xcd74b8[_0x9473('0x46')]=_[_0x9473('0x45')](_0x21b367[_0x9473('0x46')]);_0xcd74b8[_0x9473('0x4d')]=_[_0x9473('0x47')](_0xcd74b8[_0x9473('0x44')],_0xcd74b8['query']);_0x352cf3[_0x9473('0x49')]=_[_0x9473('0x47')](_0xcd74b8[_0x9473('0x44')],qs['fields'](_0x21b367[_0x9473('0x46')][_0x9473('0x48')]));_0x352cf3[_0x9473('0x49')]=_0x352cf3[_0x9473('0x49')][_0x9473('0x57')]?_0x352cf3['attributes']:_0xcd74b8[_0x9473('0x44')];if(!_0x21b367[_0x9473('0x46')][_0x9473('0x67')](_0x9473('0x68'))){_0x352cf3[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x21b367[_0x9473('0x46')][_0x9473('0x30')]);_0x352cf3['offset']=qs['offset'](_0x21b367[_0x9473('0x46')][_0x9473('0x2e')]);}_0x352cf3['order']=qs[_0x9473('0x4b')](_0x21b367[_0x9473('0x46')]['sort']);_0x352cf3[_0x9473('0x4c')]=qs[_0x9473('0x4d')](_[_0x9473('0x4e')](_0x21b367[_0x9473('0x46')],_0xcd74b8[_0x9473('0x4d')]));_0x352cf3['where'][_0x9473('0x65')]=_0x31403c['id'];if(_0x21b367['query'][_0x9473('0x4f')]){_0x352cf3[_0x9473('0x4c')]=_[_0x9473('0x50')](_0x352cf3[_0x9473('0x4c')],{'$or':_[_0x9473('0x3f')](_0x352cf3[_0x9473('0x49')],function(_0x10cf2e){var _0x78ec35={};_0x78ec35[_0x10cf2e]={'$like':'%'+_0x21b367[_0x9473('0x46')][_0x9473('0x4f')]+'%'};return _0x78ec35;})});}_0x352cf3=_['merge']({},_0x352cf3,_0x21b367[_0x9473('0x51')]);return db[_0x9473('0x6f')][_0x9473('0x31')]({'where':_0x352cf3[_0x9473('0x4c')]})['then'](function(_0x315770){_0x5326e3[_0x9473('0x31')]=_0x315770;if(_0x21b367['query'][_0x9473('0x52')]){_0x352cf3[_0x9473('0x53')]=[{'all':!![]}];}return db[_0x9473('0x6f')][_0x9473('0x70')](_0x352cf3);})['then'](function(_0x49eae4){_0x5326e3[_0x9473('0x71')]=_0x49eae4;return _0x5326e3;});}})[_0x9473('0x1f')](respondWithFilteredResult(_0x5393e0,_0x352cf3))[_0x9473('0x54')](handleError(_0x5393e0,null));};exports['removeAnswers']=function(_0x3b9160,_0x125687,_0x29589c){return db['FaxAccount'][_0x9473('0x5e')]({'where':{'id':_0x3b9160[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x125687,null))['then'](function(_0x1e0205){if(_0x1e0205){return _0x1e0205[_0x9473('0x72')](_0x3b9160['query']['ids']);}})[_0x9473('0x1f')](respondWithStatusCode(_0x125687,null))['catch'](handleError(_0x125687,null));};exports[_0x9473('0x73')]=function(_0x15c3e3,_0x4ed458,_0x3cf167){return db['FaxInteraction'][_0x9473('0x5e')]({'where':{'id':_0x15c3e3[_0x9473('0x62')]['id']}})['then'](handleEntityNotFound(_0x4ed458,null))[_0x9473('0x1f')](function(_0x2d9d51){if(_0x2d9d51){return _0x2d9d51[_0x9473('0x73')](_0x15c3e3[_0x9473('0x61')][_0x9473('0x6b')],_[_0x9473('0x74')](_0x15c3e3['body'],[_0x9473('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x4ed458,null))[_0x9473('0x54')](handleError(_0x4ed458,null));};exports[_0x9473('0x75')]=function(_0x33d033,_0x3c6243,_0x225e6f){var _0x21af19={'raw':![],'where':{}};var _0xc358e5={};var _0x461490={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9473('0x6e')]({'where':{'id':_0x33d033[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x3c6243,null))['then'](function(_0x5e7caa){if(_0x5e7caa){_0xc358e5[_0x9473('0x44')]=_[_0x9473('0x45')](db[_0x9473('0x76')][_0x9473('0x41')]);_0xc358e5[_0x9473('0x46')]=_[_0x9473('0x45')](_0x33d033['query']);_0xc358e5[_0x9473('0x4d')]=_[_0x9473('0x47')](_0xc358e5[_0x9473('0x44')],_0xc358e5['query']);_0x21af19[_0x9473('0x49')]=_[_0x9473('0x47')](_0xc358e5[_0x9473('0x44')],qs['fields'](_0x33d033[_0x9473('0x46')]['fields']));_0x21af19[_0x9473('0x49')]=_0x21af19[_0x9473('0x49')][_0x9473('0x57')]?_0x21af19['attributes']:_0xc358e5[_0x9473('0x44')];if(!_0x33d033[_0x9473('0x46')][_0x9473('0x67')](_0x9473('0x68'))){_0x21af19[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x33d033[_0x9473('0x46')]['limit']);_0x21af19[_0x9473('0x2e')]=qs[_0x9473('0x2e')](_0x33d033[_0x9473('0x46')]['offset']);}_0x21af19[_0x9473('0x4a')]=qs[_0x9473('0x4b')](_0x33d033[_0x9473('0x46')][_0x9473('0x4b')]);_0x21af19[_0x9473('0x4c')]=qs['filters'](_[_0x9473('0x4e')](_0x33d033[_0x9473('0x46')],_0xc358e5['filters']));_0x21af19[_0x9473('0x4c')]['FaxAccountId']=_0x5e7caa['id'];if(_0x33d033['query'][_0x9473('0x4f')]){_0x21af19[_0x9473('0x4c')]=_[_0x9473('0x50')](_0x21af19['where'],{'$or':_[_0x9473('0x3f')](_0x21af19['attributes'],function(_0x2c994f){var _0x6d373a={};_0x6d373a[_0x2c994f]={'$like':'%'+_0x33d033['query']['filter']+'%'};return _0x6d373a;})});}_0x21af19=_['merge']({},_0x21af19,_0x33d033['options']);return db[_0x9473('0x76')]['count']({'where':_0x21af19[_0x9473('0x4c')]})['then'](function(_0x1b1cd4){_0x461490[_0x9473('0x31')]=_0x1b1cd4;if(_0x33d033[_0x9473('0x46')]['includeAll']){_0x21af19[_0x9473('0x53')]=[{'model':db[_0x9473('0x77')],'as':_0x9473('0x78'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9473('0x3b'),_0x9473('0x79'),_0x9473('0x7a')],'required':![]},{'model':db['Tag'],'as':_0x9473('0x7b'),'attributes':['id',_0x9473('0x3b'),_0x9473('0x7c')],'where':_0x33d033[_0x9473('0x46')][_0x9473('0x7d')]?{'id':_0x33d033[_0x9473('0x46')][_0x9473('0x7d')]}:undefined,'required':_0x33d033[_0x9473('0x46')][_0x9473('0x7d')]?!![]:![]}];}return db[_0x9473('0x76')]['findAll'](_0x21af19);})[_0x9473('0x1f')](function(_0x1299b3){_0x461490[_0x9473('0x71')]=_0x1299b3;return _0x461490;});}})['then'](respondWithFilteredResult(_0x3c6243,_0x21af19))[_0x9473('0x54')](handleError(_0x3c6243,null));};exports[_0x9473('0x7e')]=function(_0x4f16e9,_0x507a16){var _0x31314a=_0x4f16e9[_0x9473('0x62')]['id'];var _0x5b52b6=_0x4f16e9['body'];var _0x1ead6f=0xc8;var _0x3404c8=null;return db['sequelize'][_0x9473('0x7f')]({'isolationLevel':db['sequelize'][_0x9473('0x80')][_0x9473('0x81')][_0x9473('0x82')]},function(_0x290edb){return db['FaxAccount'][_0x9473('0x6e')]({'where':{'id':_0x31314a},'transaction':_0x290edb})[_0x9473('0x1f')](function(_0x4753c6){if(_0x4753c6){return db[_0x9473('0x83')]['destroy']({'where':{'FaxAccountId':_0x31314a},'transaction':_0x290edb})['then'](function(){var _0x3e2e36=_[_0x9473('0x3f')](_0x5b52b6,function(_0x27d134){_0x27d134[_0x9473('0x65')]=_0x31314a;return _0x27d134;});return db[_0x9473('0x83')][_0x9473('0x84')](_0x3e2e36,{'transaction':_0x290edb});});}else{_0x1ead6f=0x194;_0x3404c8=[];}});})['then'](function(){if(_0x1ead6f!==0x194){return db['FaxApplication'][_0x9473('0x85')]({'where':{'FaxAccountId':_0x31314a},'order':_0x9473('0x86')})['then'](function(_0x32680a){_0x3404c8=_0x32680a;});}})[_0x9473('0x54')](function(_0x12c06b){_0x1ead6f=0x1f4;logger[_0x9473('0x26')](_0x12c06b['stack']);if(_0x12c06b[_0x9473('0x3b')]){delete _0x12c06b[_0x9473('0x3b')];}_0x3404c8=_0x12c06b;})[_0x9473('0x87')](function(){if(_0x3404c8===null){_0x507a16[_0x9473('0x2a')](_0x1ead6f);}else{if(_0x1ead6f===0x1f4){_0x507a16['status'](_0x1ead6f)[_0x9473('0x3c')](_0x3404c8);}else{_0x507a16[_0x9473('0x2b')](_0x1ead6f)[_0x9473('0x2d')](_0x3404c8);}}});};exports[_0x9473('0x88')]=function(_0x914fde,_0x5a38e1,_0x2cf2a8){var _0x2d23f4={};var _0xd3e2af={};var _0x14e0e8;var _0x12ad0f;return db[_0x9473('0x40')][_0x9473('0x6e')]({'where':{'id':_0x914fde[_0x9473('0x62')]['id']}})['then'](handleEntityNotFound(_0x5a38e1,null))[_0x9473('0x1f')](function(_0x4b97ea){if(_0x4b97ea){_0x14e0e8=_0x4b97ea;_0xd3e2af[_0x9473('0x44')]=_[_0x9473('0x45')](db[_0x9473('0x83')][_0x9473('0x41')]);_0xd3e2af['query']=_[_0x9473('0x45')](_0x914fde[_0x9473('0x46')]);_0xd3e2af['filters']=_[_0x9473('0x47')](_0xd3e2af[_0x9473('0x44')],_0xd3e2af[_0x9473('0x46')]);_0x2d23f4[_0x9473('0x49')]=_[_0x9473('0x47')](_0xd3e2af[_0x9473('0x44')],qs['fields'](_0x914fde[_0x9473('0x46')][_0x9473('0x48')]));_0x2d23f4[_0x9473('0x49')]=_0x2d23f4['attributes'][_0x9473('0x57')]?_0x2d23f4[_0x9473('0x49')]:_0xd3e2af[_0x9473('0x44')];_0x2d23f4['order']=qs['sort'](_0x914fde[_0x9473('0x46')][_0x9473('0x4b')]);_0x2d23f4[_0x9473('0x4c')]=qs[_0x9473('0x4d')](_[_0x9473('0x4e')](_0x914fde[_0x9473('0x46')],_0xd3e2af[_0x9473('0x4d')]));if(_0x914fde[_0x9473('0x46')]['filter']){_0x2d23f4[_0x9473('0x4c')]=_[_0x9473('0x50')](_0x2d23f4['where'],{'$or':_[_0x9473('0x3f')](_0x2d23f4['attributes'],function(_0x395aaa){var _0x1fe7c4={};_0x1fe7c4[_0x395aaa]={'$like':'%'+_0x914fde[_0x9473('0x46')][_0x9473('0x4f')]+'%'};return _0x1fe7c4;})});}_0x2d23f4=_['merge']({},_0x2d23f4,_0x914fde[_0x9473('0x51')]);return _0x14e0e8[_0x9473('0x88')](_0x2d23f4);}})[_0x9473('0x1f')](function(_0x31a4b5){if(_0x31a4b5){_0x12ad0f=_0x31a4b5['length'];if(!_0x914fde[_0x9473('0x46')]['hasOwnProperty'](_0x9473('0x68'))){_0x2d23f4[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x914fde[_0x9473('0x46')][_0x9473('0x30')]);_0x2d23f4[_0x9473('0x2e')]=qs[_0x9473('0x2e')](_0x914fde[_0x9473('0x46')]['offset']);}return _0x14e0e8['getApplications'](_0x2d23f4);}})[_0x9473('0x1f')](function(_0x1d2173){if(_0x1d2173){return _0x1d2173?{'count':_0x12ad0f,'rows':_0x1d2173}:null;}})[_0x9473('0x1f')](respondWithResult(_0x5a38e1,null))[_0x9473('0x54')](handleError(_0x5a38e1,null));};function Extension(_0x31b90c,_0x57f37f,_0x16795f,_0x216b9d){this['context']='from-voip-provider';this[_0x9473('0x89')]=_0x31b90c[_0x9473('0x8a')];this[_0x9473('0x8b')]=_0x216b9d;this[_0x9473('0x42')]=_0x9473('0x8c');this[_0x9473('0x8d')]=_0x9473('0x8e');this['FaxAccountId']=_0x31b90c['id'];this[_0x9473('0x86')]=_0x57f37f;this['appdata']=_0x16795f;}function createExtensionsReciveFax(_0x1b98b5){var _0x2fff27=0x1;var _0x17d88c=[];_0x17d88c[_0x9473('0x8f')](new Extension(_0x1b98b5,_0x2fff27,'',_0x9473('0x90')));_0x2fff27+=0x1;_0x17d88c[_0x9473('0x8f')](new Extension(_0x1b98b5,_0x2fff27,_0x9473('0x91'),_0x9473('0x92')));_0x2fff27+=0x1;for(var _0x533c3b in _0x1b98b5){if(_0x1b98b5[_0x9473('0x67')](_0x533c3b)&&(_0x533c3b==='ecm'||_0x533c3b==='localstationid'||_0x533c3b===_0x9473('0x93')||_0x533c3b===_0x9473('0x94')||_0x533c3b==='headerinfo'||_0x533c3b===_0x9473('0x95')||_0x533c3b===_0x9473('0x96')||_0x533c3b===_0x9473('0x97')||_0x533c3b==='t38timeout')){_0x17d88c[_0x9473('0x8f')](new Extension(_0x1b98b5,_0x2fff27,_0x9473('0x98')+_0x533c3b+')='+_0x1b98b5[_0x533c3b],_0x9473('0x92')));_0x2fff27+=0x1;}}_0x17d88c[_0x9473('0x8f')](new Extension(_0x1b98b5,_0x2fff27,'6',_0x9473('0x99')));_0x2fff27+=0x1;_0x17d88c[_0x9473('0x8f')](new Extension(_0x1b98b5,_0x2fff27,'/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',_0x9473('0x9a')));_0x2fff27=0x0;return _0x17d88c;}exports['addAccountApplications']=function(_0x5d1367,_0x5c5bbe,_0xefc81e){var _0x2df180;return db[_0x9473('0x9b')][_0x9473('0x7f')](function(_0x15fe29){return db[_0x9473('0x40')][_0x9473('0x58')](_0x5d1367[_0x9473('0x61')],{'transaction':_0x15fe29})[_0x9473('0x1f')](function(_0x58fbe9){_0x2df180=_0x58fbe9['get']({'plain':!![]});return db[_0x9473('0x9c')]['bulkCreate'](createExtensionsReciveFax(_0x2df180),{'transaction':_0x15fe29});});})[_0x9473('0x1f')](function(){return _0x2df180;})[_0x9473('0x1f')](respondWithResult(_0x5c5bbe,null))[_0x9473('0x54')](handleError(_0x5c5bbe,null));};exports[_0x9473('0x9d')]=function(_0x5b8726,_0x119368,_0x300237){var _0x5a5098;return db[_0x9473('0x9b')][_0x9473('0x7f')](function(_0x14cdec){return db[_0x9473('0x40')][_0x9473('0x9e')](_0x5b8726['body'],{'where':{'id':_0x5b8726[_0x9473('0x61')]['id']},'transaction':_0x14cdec})['then'](function(_0x5c5d75){return db[_0x9473('0x9c')][_0x9473('0x37')]({'where':{'FaxAccountId':_0x5b8726['body']['id']},'transaction':_0x14cdec})[_0x9473('0x1f')](function(_0x1c7781){return db[_0x9473('0x9c')]['bulkCreate'](createExtensionsReciveFax(_[_0x9473('0x74')](_0x5b8726[_0x9473('0x61')],[_0x9473('0x9f'),'key',_0x9473('0xa0'),_0x9473('0xa1'),_0x9473('0xa2'),'ListId'])),{'transaction':_0x14cdec});});});})[_0x9473('0x1f')](function(){return db[_0x9473('0x40')][_0x9473('0xa3')](_0x5b8726[_0x9473('0x61')]['id']);})[_0x9473('0x1f')](respondWithResult(_0x119368,null))[_0x9473('0x54')](handleError(_0x119368,null));};exports['getMessages']=function(_0x2b8443,_0x177c6f,_0x30ea5e){var _0x371a18={'raw':!![],'where':{}};var _0x36b84c={};var _0x4694da={'count':0x0,'rows':[]};return db['FaxAccount'][_0x9473('0x6e')]({'where':{'id':_0x2b8443[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x177c6f,null))[_0x9473('0x1f')](function(_0x134db5){if(_0x134db5){_0x36b84c[_0x9473('0x44')]=_[_0x9473('0x45')](db[_0x9473('0xa4')][_0x9473('0x41')]);_0x36b84c[_0x9473('0x46')]=_[_0x9473('0x45')](_0x2b8443[_0x9473('0x46')]);_0x36b84c['filters']=_[_0x9473('0x47')](_0x36b84c[_0x9473('0x44')],_0x36b84c[_0x9473('0x46')]);_0x371a18['attributes']=_['intersection'](_0x36b84c[_0x9473('0x44')],qs[_0x9473('0x48')](_0x2b8443['query'][_0x9473('0x48')]));_0x371a18[_0x9473('0x49')]=_0x371a18[_0x9473('0x49')][_0x9473('0x57')]?_0x371a18[_0x9473('0x49')]:_0x36b84c[_0x9473('0x44')];if(!_0x2b8443[_0x9473('0x46')][_0x9473('0x67')](_0x9473('0x68'))){_0x371a18[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x2b8443[_0x9473('0x46')][_0x9473('0x30')]);_0x371a18['offset']=qs[_0x9473('0x2e')](_0x2b8443[_0x9473('0x46')][_0x9473('0x2e')]);}_0x371a18['order']=qs[_0x9473('0x4b')](_0x2b8443['query'][_0x9473('0x4b')]);_0x371a18['where']=qs[_0x9473('0x4d')](_['pick'](_0x2b8443['query'],_0x36b84c[_0x9473('0x4d')]));_0x371a18[_0x9473('0x4c')][_0x9473('0x65')]=_0x134db5['id'];if(_0x2b8443[_0x9473('0x46')][_0x9473('0x4f')]){_0x371a18['where']=_[_0x9473('0x50')](_0x371a18[_0x9473('0x4c')],{'$or':_[_0x9473('0x3f')](_0x371a18['attributes'],function(_0x20715f){var _0x310b2d={};_0x310b2d[_0x20715f]={'$like':'%'+_0x2b8443[_0x9473('0x46')][_0x9473('0x4f')]+'%'};return _0x310b2d;})});}if(_0x2b8443[_0x9473('0x46')][_0x9473('0xa5')]){var _0x85b965=_0x2b8443['query'][_0x9473('0xa5')][_0x9473('0xa6')](',');var _0x13b4f4={};_0x13b4f4[_0x85b965[0x0]]={'$gte':moment(_0x85b965[0x1])['format'](_0x9473('0xa7'))};_0x371a18['where']=_[_0x9473('0x50')](_0x371a18['where'],_0x13b4f4);}_0x371a18=_[_0x9473('0x50')]({},_0x371a18,_0x2b8443[_0x9473('0x51')]);return db[_0x9473('0xa4')][_0x9473('0x31')]({'where':_0x371a18['where']})[_0x9473('0x1f')](function(_0x450ccc){_0x4694da[_0x9473('0x31')]=_0x450ccc;if(_0x2b8443[_0x9473('0x46')][_0x9473('0x52')]){_0x371a18[_0x9473('0x53')]=[{'all':!![]}];}return db[_0x9473('0xa4')][_0x9473('0x70')](_0x371a18);})['then'](function(_0x2897d5){_0x4694da[_0x9473('0x71')]=_0x2897d5;return _0x4694da;});}})[_0x9473('0x1f')](respondWithFilteredResult(_0x177c6f,_0x371a18))[_0x9473('0x54')](handleError(_0x177c6f,null));};exports[_0x9473('0x3c')]=function(_0x4fe30d,_0x2d4b8c,_0x40269f){var _0xcd3a81,_0x1a7f4c={},_0x40e0da;if(_0x4fe30d[_0x9473('0x61')]['to']){_0x40e0da=_0x4fe30d[_0x9473('0x61')]['to'][0x0];}return db[_0x9473('0x40')][_0x9473('0x5e')]({'where':{'id':_0x4fe30d[_0x9473('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x9473('0xa8'),'include':[{'model':db[_0x9473('0x77')],'as':'Contacts','where':{'fax':_0x40e0da},'limit':0x1,'order':[['updatedAt',_0x9473('0xa9')]]}]}]})[_0x9473('0x1f')](handleEntityNotFound(_0x2d4b8c,null))['then'](function(_0x43ca7d){_0xcd3a81=_0x43ca7d;if(_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')]&&_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')]['length']){for(var _0x272921=0x0;_0x272921<_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')]['length'];_0x272921+=0x1){_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][_0x272921]={'filename':_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][_0x272921]['name'],'id':_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][_0x272921]['id'],'path':path[_0x9473('0xab')](config[_0x9473('0xac')],_0x9473('0xad'),_0x4fe30d[_0x9473('0x61')]['attachments'][_0x272921][_0x9473('0xae')])};}}return respondWithRpcPromise(_0x9473('0xaf'),_0x9473('0xaf'),{'FaxAccountId':_[_0x9473('0xb0')](_0x4fe30d[_0x9473('0x62')]['id'])?undefined:_0x4fe30d[_0x9473('0x62')]['id'],'path':_['isNil'](_0x4fe30d[_0x9473('0x61')]['attachments'][0x0][_0x9473('0xb1')])?undefined:_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][0x0][_0x9473('0xb1')],'fax':_[_0x9473('0xb0')](_0x4fe30d['body']['to'][0x0])?undefined:_0x4fe30d['body']['to'][0x0]},client9002);})[_0x9473('0x1f')](function(){if(_0xcd3a81){if(_[_0x9473('0xb0')](_0x4fe30d['body'][_0x9473('0xb2')])){_0x4fe30d[_0x9473('0x61')][_0x9473('0xb2')]=util[_0x9473('0xb3')]('\x22%s\x22\x20<%s>',_0xcd3a81[_0x9473('0x3b')],_0xcd3a81[_0x9473('0xb4')]);}if(_0xcd3a81['List']){if(_0xcd3a81[_0x9473('0xa8')][_0x9473('0xb5')][_0x9473('0x57')]){return _0xcd3a81[_0x9473('0xa8')][_0x9473('0xb5')][0x0];}else{return db[_0x9473('0x77')][_0x9473('0x58')](_[_0x9473('0x17')](_0x4fe30d[_0x9473('0x61')],{'firstName':_0x4fe30d[_0x9473('0x61')]['to'][0x0],'phone':_0x4fe30d[_0x9473('0x61')]['to'][0x0],'fax':_0x4fe30d['body']['to'][0x0],'ListId':_0xcd3a81[_0x9473('0xb6')]}));}}else{throw new Error(_0x9473('0xb7'));}}else{throw new Error(_0x9473('0xb8'));}})[_0x9473('0x1f')](function(_0x5afaf6){if(_0x5afaf6){return db['FaxInteraction'][_0x9473('0x5e')]({'where':{'ContactId':_0x5afaf6['id'],'closed':![],'FaxAccountId':_0xcd3a81['id']}})[_0x9473('0x1f')](function(_0x2a2995){if(_0x2a2995){return[_0x2a2995,![]];}return db[_0x9473('0x76')][_0x9473('0x58')]({'UserId':_0x4fe30d[_0x9473('0x5b')]['id'],'ContactId':_0x5afaf6['id'],'FaxAccountId':_0xcd3a81['id'],'fax':_0x4fe30d[_0x9473('0x61')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x9473('0x50')](_0x4fe30d[_0x9473('0x61')],{'read':![],'body':_0x4fe30d['body'][_0x9473('0xaa')][0x0]['filename'],'FaxAccountId':_0xcd3a81['id'],'UserId':_0x4fe30d[_0x9473('0x5b')]['id'],'ContactId':_0x5afaf6['id'],'AttachmentId':_0x4fe30d['body'][_0x9473('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x9473('0xa4')],'as':_0x9473('0xb9')}]})[_0x9473('0x1f')](function(_0x532a42){return[_0x532a42,!![]];});});}else{throw new Error(_0x9473('0xba'));}})[_0x9473('0xbb')](function(_0x58fae3,_0x1b8f19){if(_0x1b8f19){return _0x58fae3;}return db['FaxMessage']['create']({'direction':_0x9473('0xbc'),'read':![],'body':_0x4fe30d['body']['attachments'][0x0][_0x9473('0xbd')],'FaxAccountId':_0xcd3a81['id'],'FaxInteractionId':_0x58fae3['id'],'UserId':_0x4fe30d['user']['id'],'ContactId':_0x58fae3['ContactId'],'AttachmentId':_0x4fe30d[_0x9473('0x61')]['attachments'][0x0]['id']})[_0x9473('0x1f')](function(_0x3e2689){_0x58fae3['dataValues'][_0x9473('0xb9')]=[];_0x58fae3[_0x9473('0xbe')][_0x9473('0xb9')][_0x9473('0x8f')](_0x3e2689[_0x9473('0xbe')]);return _0x58fae3;});})[_0x9473('0x1f')](function(_0x25ee62){respondWithRpcPromise(_0x9473('0xbf'),_0x9473('0xbf'),{'FaxAccountId':_[_0x9473('0xb0')](_0x4fe30d[_0x9473('0x62')]['id'])?undefined:_0x4fe30d[_0x9473('0x62')]['id'],'path':_['isNil'](_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][0x0][_0x9473('0xb1')])?undefined:_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][0x0][_0x9473('0xb1')],'fax':_[_0x9473('0xb0')](_0x4fe30d[_0x9473('0x61')]['to'][0x0])?undefined:_0x4fe30d[_0x9473('0x61')]['to'][0x0],'AttachmentId':_0x4fe30d[_0x9473('0x61')][_0x9473('0xaa')][0x0]['id']},client9002)[_0x9473('0x1f')](function(_0x32d515){logger[_0x9473('0x20')](_0x9473('0xc0'),_0x32d515);})[_0x9473('0x54')](function(_0x5ad12c){logger['info'](_0x9473('0xc0'),_0x5ad12c);});return _0x25ee62;})[_0x9473('0x1f')](respondWithResult(_0x2d4b8c,null))['catch'](handleError(_0x2d4b8c,null));};exports[_0x9473('0xc1')]=function(_0x55a676,_0x35b5d1,_0x308228){return db['FaxAccount'][_0x9473('0x5e')]({'where':{'id':_0x55a676['params']['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x35b5d1,null))['then'](function(_0x5ed5b5){if(_0x5ed5b5){return _0x5ed5b5['addAgents'](_0x55a676[_0x9473('0x61')][_0x9473('0x6b')],_['omit'](_0x55a676[_0x9473('0x61')],[_0x9473('0x6b'),'id'])||{})[_0x9473('0xbb')](function(_0x17f2a5){for(var _0x43ea51=0x0;_0x43ea51<_0x55a676['body']['ids'][_0x9473('0x57')];_0x43ea51+=0x1){socket[_0x9473('0xc2')](_0x9473('0xc3'),{'UserId':Number(_0x55a676[_0x9473('0x61')][_0x9473('0x6b')][_0x43ea51]),'FaxAccountId':Number(_0x55a676['params']['id'])});}return _0x17f2a5;});}})[_0x9473('0x1f')](respondWithResult(_0x35b5d1,null))[_0x9473('0x54')](handleError(_0x35b5d1,null));};exports['removeAgents']=function(_0x526449,_0x5d0712,_0x240f27){return db[_0x9473('0x40')][_0x9473('0x5e')]({'where':{'id':_0x526449[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x5d0712,null))['then'](function(_0x328d0e){if(_0x328d0e){return _0x328d0e[_0x9473('0xc4')](_0x526449['query'][_0x9473('0x6b')])[_0x9473('0x1f')](function(){if(_['isArray'](_0x526449[_0x9473('0x46')]['ids'])){for(var _0x518d26=0x0;_0x518d26<_0x526449[_0x9473('0x46')][_0x9473('0x6b')][_0x9473('0x57')];_0x518d26+=0x1){socket['emit'](_0x9473('0xc5'),{'UserId':Number(_0x526449[_0x9473('0x46')]['ids'][_0x518d26]),'FaxAccountId':Number(_0x526449['params']['id'])});}}else{socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x526449['query'][_0x9473('0x6b')]),'FaxAccountId':Number(_0x526449['params']['id'])});}});}})[_0x9473('0x1f')](respondWithStatusCode(_0x5d0712,null))[_0x9473('0x54')](handleError(_0x5d0712,null));};exports[_0x9473('0xc6')]=function(_0x33af05,_0x580fd2,_0x210b45){var _0x283e83={};var _0x3797b9={};var _0x3435a2;var _0x569378;return db[_0x9473('0x40')][_0x9473('0x6e')]({'where':{'id':_0x33af05[_0x9473('0x62')]['id']}})[_0x9473('0x1f')](handleEntityNotFound(_0x580fd2,null))[_0x9473('0x1f')](function(_0x2db298){if(_0x2db298){_0x3435a2=_0x2db298;_0x3797b9[_0x9473('0x44')]=_[_0x9473('0x45')](db['User'][_0x9473('0x41')]);_0x3797b9[_0x9473('0x46')]=_[_0x9473('0x45')](_0x33af05['query']);_0x3797b9[_0x9473('0x4d')]=_[_0x9473('0x47')](_0x3797b9[_0x9473('0x44')],_0x3797b9[_0x9473('0x46')]);_0x283e83[_0x9473('0x49')]=_['intersection'](_0x3797b9['model'],qs[_0x9473('0x48')](_0x33af05[_0x9473('0x46')][_0x9473('0x48')]));_0x283e83['attributes']=_0x283e83[_0x9473('0x49')]['length']?_0x283e83['attributes']:_0x3797b9[_0x9473('0x44')];_0x283e83[_0x9473('0x4a')]=qs[_0x9473('0x4b')](_0x33af05[_0x9473('0x46')]['sort']);_0x283e83[_0x9473('0x4c')]=qs[_0x9473('0x4d')](_[_0x9473('0x4e')](_0x33af05['query'],_0x3797b9[_0x9473('0x4d')]));if(_0x33af05[_0x9473('0x46')][_0x9473('0x4f')]){_0x283e83[_0x9473('0x4c')]=_[_0x9473('0x50')](_0x283e83['where'],{'$or':_[_0x9473('0x3f')](_0x283e83[_0x9473('0x49')],function(_0x4a0bc3){var _0x870a74={};_0x870a74[_0x4a0bc3]={'$like':'%'+_0x33af05[_0x9473('0x46')][_0x9473('0x4f')]+'%'};return _0x870a74;})});}_0x283e83=_[_0x9473('0x50')]({},_0x283e83,_0x33af05[_0x9473('0x51')]);return _0x3435a2[_0x9473('0xc6')](_0x283e83);}})['then'](function(_0x255b51){if(_0x255b51){_0x569378=_0x255b51[_0x9473('0x57')];if(!_0x33af05['query'][_0x9473('0x67')](_0x9473('0x68'))){_0x283e83[_0x9473('0x30')]=qs[_0x9473('0x30')](_0x33af05[_0x9473('0x46')][_0x9473('0x30')]);_0x283e83[_0x9473('0x2e')]=qs[_0x9473('0x2e')](_0x33af05['query'][_0x9473('0x2e')]);}return _0x3435a2['getAgents'](_0x283e83);}})[_0x9473('0x1f')](function(_0x4e83dd){if(_0x4e83dd){return _0x4e83dd?{'count':_0x569378,'rows':_0x4e83dd}:null;}})[_0x9473('0x1f')](respondWithResult(_0x580fd2,null))['catch'](handleError(_0x580fd2,null));}; \ No newline at end of file +var _0x4de4=['ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','finally','send','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','priority','appdata','push','Set','ecm','headerinfo','maxrate','t38timeout','FAXOPT(','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','bulkCreate','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','CmContact','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','from','fax','List\x20not\x20found','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','apply','update','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','mandatoryDispositionPause','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','FaxAccount','includeAll','include','findAll','Pause','length','options','find','create','body','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','pick','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags','tag','sequelize','transaction','Transaction'];(function(_0x237052,_0x28636d){var _0x627e37=function(_0x4686c9){while(--_0x4686c9){_0x237052['push'](_0x237052['shift']());}};_0x627e37(++_0x28636d);}(_0x4de4,0x1e1));var _0x44de=function(_0x3f0ce6,_0xb507c3){_0x3f0ce6=_0x3f0ce6-0x0;var _0x4ee207=_0x4de4[_0x3f0ce6];return _0x4ee207;};'use strict';var emlformat=require(_0x44de('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44de('0x1'));var jsonpatch=require(_0x44de('0x2'));var rp=require(_0x44de('0x3'));var moment=require(_0x44de('0x4'));var BPromise=require(_0x44de('0x5'));var Mustache=require(_0x44de('0x6'));var util=require('util');var path=require(_0x44de('0x7'));var sox=require(_0x44de('0x8'));var csv=require(_0x44de('0x9'));var ejs=require(_0x44de('0xa'));var fs=require('fs');var fs_extra=require(_0x44de('0xb'));var _=require(_0x44de('0xc'));var squel=require(_0x44de('0xd'));var crypto=require(_0x44de('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x44de('0xf'));var toCsv=require(_0x44de('0x9'));var querystring=require(_0x44de('0x10'));var Papa=require(_0x44de('0x11'));var Redis=require(_0x44de('0x12'));var authService=require(_0x44de('0x13'));var qs=require(_0x44de('0x14'));var as=require(_0x44de('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x44de('0x16'))(_0x44de('0x17'));var utils=require('../../config/utils');var config=require(_0x44de('0x18'));var licenseUtil=require(_0x44de('0x19'));var db=require(_0x44de('0x1a'))['db'];config['redis']=_['defaults'](config[_0x44de('0x1b')],{'host':_0x44de('0x1c'),'port':0x18eb});var socket=require(_0x44de('0x1d'))(new Redis(config['redis']));require(_0x44de('0x1e'))[_0x44de('0x1f')](socket);var jayson=require(_0x44de('0x20'));var client=jayson[_0x44de('0x21')][_0x44de('0x22')]({'port':0x232c});var client9002=jayson['client'][_0x44de('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x21327e,_0x104c6e,_0x4c72ce,_0x5961a2){return new BPromise(function(_0x51e728,_0x547a61){var _0x14bb7b=_0x5961a2||client;return _0x14bb7b[_0x44de('0x23')](_0x21327e,_0x4c72ce)['then'](function(_0x9aa01e){logger[_0x44de('0x24')](_0x44de('0x25'),_0x104c6e,_0x44de('0x26'));logger['debug'](_0x44de('0x27'),_0x104c6e,_0x44de('0x26'),JSON[_0x44de('0x28')](_0x9aa01e));if(_0x9aa01e['error']){if(_0x9aa01e['error'][_0x44de('0x29')]===0x1f4){logger['error'](_0x44de('0x25'),_0x104c6e,_0x9aa01e[_0x44de('0x2a')][_0x44de('0x2b')]);return _0x547a61(_0x9aa01e['error']['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x104c6e,_0x9aa01e[_0x44de('0x2a')][_0x44de('0x2b')]);return _0x51e728(_0x9aa01e['error'][_0x44de('0x2b')]);}else{logger['info'](_0x44de('0x25'),_0x104c6e,_0x44de('0x26'));_0x51e728(_0x9aa01e[_0x44de('0x2c')][_0x44de('0x2b')]);}})[_0x44de('0x2d')](function(_0x390f82){logger['error']('FaxAccount,\x20%s,\x20%s',_0x104c6e,_0x390f82);_0x547a61(_0x390f82);});});}function respondWithStatusCode(_0x1c4f62,_0x759798){_0x759798=_0x759798||0xcc;return function(_0x1c36a6){if(_0x1c36a6){return _0x1c4f62[_0x44de('0x2e')](_0x759798);}return _0x1c4f62['status'](_0x759798)[_0x44de('0x2f')]();};}function respondWithResult(_0x349f1b,_0x5c8430){_0x5c8430=_0x5c8430||0xc8;return function(_0x3b93b9){if(_0x3b93b9){return _0x349f1b['status'](_0x5c8430)['json'](_0x3b93b9);}};}function respondWithFilteredResult(_0x41e044,_0x4fdd17){return function(_0x2a5148){if(_0x2a5148){var _0x410744=typeof _0x4fdd17[_0x44de('0x30')]==='undefined'&&typeof _0x4fdd17[_0x44de('0x31')]===_0x44de('0x32');var _0x156715=_0x2a5148['count'];var _0x396b43=_0x410744?0x0:_0x4fdd17['offset'];var _0x37ec93=_0x410744?_0x2a5148[_0x44de('0x33')]:_0x4fdd17[_0x44de('0x30')]+_0x4fdd17[_0x44de('0x31')];var _0x1e3719;if(_0x37ec93>=_0x156715){_0x37ec93=_0x156715;_0x1e3719=0xc8;}else{_0x1e3719=0xce;}_0x41e044[_0x44de('0x34')](_0x1e3719);return _0x41e044[_0x44de('0x35')](_0x44de('0x36'),_0x396b43+'-'+_0x37ec93+'/'+_0x156715)[_0x44de('0x37')](_0x2a5148);}return null;};}function patchUpdates(_0x4bf7ec){return function(_0x20b734){try{jsonpatch[_0x44de('0x38')](_0x20b734,_0x4bf7ec,!![]);}catch(_0x99013f){return BPromise['reject'](_0x99013f);}return _0x20b734['save']();};}function saveUpdates(_0xaadf4d,_0x47b9f2){return function(_0x2f2ee9){if(_0x2f2ee9){return _0x2f2ee9[_0x44de('0x39')](_0xaadf4d)[_0x44de('0x3a')](function(_0x44b6e7){return _0x44b6e7;});}return null;};}function removeEntity(_0x243f66,_0x476284){return function(_0x40a45a){if(_0x40a45a){return _0x40a45a['destroy']()['then'](function(){var _0x570a84=_0x40a45a[_0x44de('0x3b')]({'plain':!![]});var _0x5c2c4c=_0x44de('0x3c');return db[_0x44de('0x3d')][_0x44de('0x3e')]({'where':{'type':_0x5c2c4c,'resourceId':_0x570a84['id']}})[_0x44de('0x3a')](function(){return _0x40a45a;});})['then'](function(){_0x243f66['status'](0xcc)[_0x44de('0x2f')]();});}};}function handleEntityNotFound(_0x5e5a96,_0x313670){return function(_0x3f64f6){if(!_0x3f64f6){_0x5e5a96[_0x44de('0x2e')](0x194);}return _0x3f64f6;};}function handleError(_0x408a27,_0x543574){_0x543574=_0x543574||0x1f4;return function(_0x81d41a){logger[_0x44de('0x2a')](_0x81d41a[_0x44de('0x3f')]);if(_0x81d41a['name']){delete _0x81d41a[_0x44de('0x40')];}_0x408a27['status'](_0x543574)['send'](_0x81d41a);};}exports[_0x44de('0x41')]=function(_0x429564,_0x2d0585){var _0x2236f2={'include':[{'model':db['Pause'],'as':_0x44de('0x42')}]},_0x1d76ce={},_0x446d91={'count':0x0,'rows':[]};var _0x2a78ee=_['map'](db['FaxAccount'][_0x44de('0x43')],function(_0x1a8486){return{'name':_0x1a8486[_0x44de('0x44')],'type':_0x1a8486[_0x44de('0x45')][_0x44de('0x46')]};});_0x1d76ce[_0x44de('0x47')]=_[_0x44de('0x48')](_0x2a78ee,_0x44de('0x40'));_0x1d76ce['query']=_[_0x44de('0x49')](_0x429564[_0x44de('0x4a')]);_0x1d76ce[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x1d76ce['model'],_0x1d76ce[_0x44de('0x4a')]);_0x2236f2['attributes']=_[_0x44de('0x4c')](_0x1d76ce[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x429564[_0x44de('0x4a')][_0x44de('0x4d')]));_0x2236f2[_0x44de('0x4e')]=_0x2236f2[_0x44de('0x4e')]['length']?_0x2236f2[_0x44de('0x4e')]:_0x1d76ce[_0x44de('0x47')];if(!_0x429564[_0x44de('0x4a')][_0x44de('0x4f')](_0x44de('0x50'))){_0x2236f2[_0x44de('0x31')]=qs['limit'](_0x429564[_0x44de('0x4a')][_0x44de('0x31')]);_0x2236f2[_0x44de('0x30')]=qs[_0x44de('0x30')](_0x429564[_0x44de('0x4a')]['offset']);}_0x2236f2[_0x44de('0x51')]=qs[_0x44de('0x52')](_0x429564[_0x44de('0x4a')][_0x44de('0x52')]);_0x2236f2[_0x44de('0x53')]=qs['filters'](_['pick'](_0x429564[_0x44de('0x4a')],_0x1d76ce[_0x44de('0x4b')]),_0x2a78ee);if(_0x429564[_0x44de('0x4a')]['filter']){_0x2236f2['where']=_[_0x44de('0x54')](_0x2236f2[_0x44de('0x53')],{'$or':_['map'](_0x2a78ee,function(_0x122311){if(_0x122311[_0x44de('0x45')]!==_0x44de('0x55')){var _0x4d4e97={};_0x4d4e97[_0x122311[_0x44de('0x40')]]={'$like':'%'+_0x429564[_0x44de('0x4a')][_0x44de('0x56')]+'%'};return _0x4d4e97;}})});}_0x2236f2=_[_0x44de('0x54')]({},_0x2236f2,_0x429564['options']);var _0x3f4ae0={'where':_0x2236f2[_0x44de('0x53')]};return db[_0x44de('0x57')][_0x44de('0x33')](_0x3f4ae0)['then'](function(_0x21012a){_0x446d91[_0x44de('0x33')]=_0x21012a;if(_0x429564[_0x44de('0x4a')][_0x44de('0x58')]){_0x2236f2[_0x44de('0x59')]=[{'all':!![]}];}return db['FaxAccount'][_0x44de('0x5a')](_0x2236f2);})[_0x44de('0x3a')](function(_0x9a51a2){_0x446d91['rows']=_0x9a51a2;return _0x446d91;})[_0x44de('0x3a')](respondWithFilteredResult(_0x2d0585,_0x2236f2))[_0x44de('0x2d')](handleError(_0x2d0585,null));};exports['show']=function(_0x1d0e7c,_0x20b371){var _0x479e7a={'raw':![],'where':{'id':_0x1d0e7c['params']['id']},'include':[{'model':db[_0x44de('0x5b')],'as':'mandatoryDispositionPause'}]},_0x181344={};_0x181344['model']=_[_0x44de('0x49')](db[_0x44de('0x57')][_0x44de('0x43')]);_0x181344[_0x44de('0x4a')]=_[_0x44de('0x49')](_0x1d0e7c[_0x44de('0x4a')]);_0x181344[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x181344[_0x44de('0x47')],_0x181344[_0x44de('0x4a')]);_0x479e7a['attributes']=_[_0x44de('0x4c')](_0x181344[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x1d0e7c['query'][_0x44de('0x4d')]));_0x479e7a[_0x44de('0x4e')]=_0x479e7a[_0x44de('0x4e')][_0x44de('0x5c')]?_0x479e7a['attributes']:_0x181344[_0x44de('0x47')];if(_0x1d0e7c[_0x44de('0x4a')]['includeAll']){_0x479e7a[_0x44de('0x59')]=[{'all':!![]}];}_0x479e7a=_[_0x44de('0x54')]({},_0x479e7a,_0x1d0e7c[_0x44de('0x5d')]);return db[_0x44de('0x57')][_0x44de('0x5e')](_0x479e7a)['then'](handleEntityNotFound(_0x20b371,null))['then'](respondWithResult(_0x20b371,null))['catch'](handleError(_0x20b371,null));};exports[_0x44de('0x5f')]=function(_0x25ed2c,_0x432038){return db['FaxAccount']['create'](_0x25ed2c[_0x44de('0x60')],{})[_0x44de('0x3a')](function(_0x34adc9){var _0x1c7ab4=_0x25ed2c['user'][_0x44de('0x3b')]({'plain':!![]});if(!_0x1c7ab4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1c7ab4[_0x44de('0x61')]===_0x44de('0x62')){var _0x85f19e=_0x34adc9[_0x44de('0x3b')]({'plain':!![]});var _0x5436b9=_0x44de('0x3c');return db[_0x44de('0x63')][_0x44de('0x5e')]({'where':{'name':_0x5436b9,'userProfileId':_0x1c7ab4[_0x44de('0x64')]},'raw':!![]})[_0x44de('0x3a')](function(_0x235649){if(_0x235649&&_0x235649[_0x44de('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x85f19e['name'],'resourceId':_0x85f19e['id'],'type':_0x235649[_0x44de('0x40')],'sectionId':_0x235649['id']},{})[_0x44de('0x3a')](function(){return _0x34adc9;});}else{return _0x34adc9;}})[_0x44de('0x2d')](function(_0x5b4054){logger[_0x44de('0x2a')](_0x44de('0x66'),_0x5b4054);throw _0x5b4054;});}return _0x34adc9;})['then'](respondWithResult(_0x432038,0xc9))[_0x44de('0x2d')](handleError(_0x432038,null));};exports[_0x44de('0x39')]=function(_0x53de1f,_0x22a9ba){if(_0x53de1f[_0x44de('0x60')]['id']){delete _0x53de1f[_0x44de('0x60')]['id'];}return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x53de1f[_0x44de('0x67')]['id']},'include':[{'model':db['Pause'],'as':_0x44de('0x42')}]})['then'](handleEntityNotFound(_0x22a9ba,null))[_0x44de('0x3a')](saveUpdates(_0x53de1f[_0x44de('0x60')],null))[_0x44de('0x3a')](respondWithResult(_0x22a9ba,null))['catch'](handleError(_0x22a9ba,null));};exports[_0x44de('0x3e')]=function(_0x104c3c,_0x12c551){return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x104c3c[_0x44de('0x67')]['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x12c551,null))[_0x44de('0x3a')](removeEntity(_0x12c551,null))['catch'](handleError(_0x12c551,null));};exports[_0x44de('0x68')]=function(_0x4219a7,_0x38b20e){return db[_0x44de('0x57')][_0x44de('0x68')]()[_0x44de('0x3a')](respondWithResult(_0x38b20e,null))[_0x44de('0x2d')](handleError(_0x38b20e,null));};exports[_0x44de('0x69')]=function(_0x36c187,_0x5c0068,_0x191282){if(_0x36c187['body']['id']){delete _0x36c187[_0x44de('0x60')]['id'];}return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x36c187[_0x44de('0x67')]['id']}})['then'](handleEntityNotFound(_0x5c0068,null))[_0x44de('0x3a')](function(_0x11ef64){if(_0x11ef64){_0x36c187[_0x44de('0x60')][_0x44de('0x6a')]=_0x11ef64['id'];return db[_0x44de('0x6b')][_0x44de('0x5f')](_0x36c187['body']);}})[_0x44de('0x3a')](respondWithResult(_0x5c0068,null))[_0x44de('0x2d')](handleError(_0x5c0068,null));};exports[_0x44de('0x6c')]=function(_0x2d28e0,_0xbfb573,_0x5428ef){var _0x4c0045={'raw':![],'where':{}};var _0x4a7a28={};var _0x44f99f={'count':0x0,'rows':[]};return db['FaxAccount'][_0x44de('0x6d')]({'where':{'id':_0x2d28e0[_0x44de('0x67')]['id']}})['then'](handleEntityNotFound(_0xbfb573,null))[_0x44de('0x3a')](function(_0x5acadc){if(_0x5acadc){_0x4a7a28[_0x44de('0x47')]=_[_0x44de('0x49')](db[_0x44de('0x6b')][_0x44de('0x43')]);_0x4a7a28[_0x44de('0x4a')]=_[_0x44de('0x49')](_0x2d28e0[_0x44de('0x4a')]);_0x4a7a28['filters']=_[_0x44de('0x4c')](_0x4a7a28[_0x44de('0x47')],_0x4a7a28[_0x44de('0x4a')]);_0x4c0045[_0x44de('0x4e')]=_[_0x44de('0x4c')](_0x4a7a28[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x2d28e0[_0x44de('0x4a')][_0x44de('0x4d')]));_0x4c0045[_0x44de('0x4e')]=_0x4c0045['attributes'][_0x44de('0x5c')]?_0x4c0045[_0x44de('0x4e')]:_0x4a7a28[_0x44de('0x47')];if(!_0x2d28e0[_0x44de('0x4a')][_0x44de('0x4f')](_0x44de('0x50'))){_0x4c0045[_0x44de('0x31')]=qs[_0x44de('0x31')](_0x2d28e0['query'][_0x44de('0x31')]);_0x4c0045[_0x44de('0x30')]=qs[_0x44de('0x30')](_0x2d28e0[_0x44de('0x4a')][_0x44de('0x30')]);}_0x4c0045[_0x44de('0x51')]=qs[_0x44de('0x52')](_0x2d28e0['query']['sort']);_0x4c0045[_0x44de('0x53')]=qs[_0x44de('0x4b')](_[_0x44de('0x6e')](_0x2d28e0[_0x44de('0x4a')],_0x4a7a28['filters']));_0x4c0045['where'][_0x44de('0x6a')]=_0x5acadc['id'];if(_0x2d28e0['query']['filter']){_0x4c0045[_0x44de('0x53')]=_[_0x44de('0x54')](_0x4c0045[_0x44de('0x53')],{'$or':_[_0x44de('0x48')](_0x4c0045[_0x44de('0x4e')],function(_0x2e7127){var _0x2dd1b6={};_0x2dd1b6[_0x2e7127]={'$like':'%'+_0x2d28e0[_0x44de('0x4a')][_0x44de('0x56')]+'%'};return _0x2dd1b6;})});}_0x4c0045=_[_0x44de('0x54')]({},_0x4c0045,_0x2d28e0['options']);return db['Disposition'][_0x44de('0x33')]({'where':_0x4c0045[_0x44de('0x53')]})['then'](function(_0x3e9127){_0x44f99f[_0x44de('0x33')]=_0x3e9127;if(_0x2d28e0[_0x44de('0x4a')]['includeAll']){_0x4c0045['include']=[{'all':!![]}];}return db['Disposition'][_0x44de('0x5a')](_0x4c0045);})[_0x44de('0x3a')](function(_0x275813){_0x44f99f[_0x44de('0x6f')]=_0x275813;return _0x44f99f;});}})[_0x44de('0x3a')](respondWithFilteredResult(_0xbfb573,_0x4c0045))[_0x44de('0x2d')](handleError(_0xbfb573,null));};exports[_0x44de('0x70')]=function(_0x272aa5,_0x45ddc9,_0x52f614){return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x272aa5[_0x44de('0x67')]['id']}})['then'](handleEntityNotFound(_0x45ddc9,null))[_0x44de('0x3a')](function(_0x3173a6){if(_0x3173a6){return _0x3173a6[_0x44de('0x70')](_0x272aa5[_0x44de('0x4a')][_0x44de('0x71')]);}})[_0x44de('0x3a')](respondWithStatusCode(_0x45ddc9,null))[_0x44de('0x2d')](handleError(_0x45ddc9,null));};exports[_0x44de('0x72')]=function(_0x65f0e2,_0x54fa6c,_0x254877){if(_0x65f0e2[_0x44de('0x60')]['id']){delete _0x65f0e2[_0x44de('0x60')]['id'];}return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x65f0e2[_0x44de('0x67')]['id']}})['then'](handleEntityNotFound(_0x54fa6c,null))[_0x44de('0x3a')](function(_0x1120d1){if(_0x1120d1){_0x65f0e2[_0x44de('0x60')][_0x44de('0x6a')]=_0x1120d1['id'];return db['CannedAnswer'][_0x44de('0x5f')](_0x65f0e2[_0x44de('0x60')]);}})[_0x44de('0x3a')](respondWithResult(_0x54fa6c,null))['catch'](handleError(_0x54fa6c,null));};exports[_0x44de('0x73')]=function(_0x1be851,_0x23a8a8,_0x3ad308){var _0x362c66={'raw':![],'where':{}};var _0x41278d={};var _0x305e16={'count':0x0,'rows':[]};return db[_0x44de('0x57')][_0x44de('0x6d')]({'where':{'id':_0x1be851['params']['id']}})['then'](handleEntityNotFound(_0x23a8a8,null))[_0x44de('0x3a')](function(_0x5b9bcd){if(_0x5b9bcd){_0x41278d['model']=_[_0x44de('0x49')](db[_0x44de('0x74')]['rawAttributes']);_0x41278d[_0x44de('0x4a')]=_[_0x44de('0x49')](_0x1be851['query']);_0x41278d[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x41278d[_0x44de('0x47')],_0x41278d[_0x44de('0x4a')]);_0x362c66['attributes']=_[_0x44de('0x4c')](_0x41278d[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x1be851[_0x44de('0x4a')][_0x44de('0x4d')]));_0x362c66[_0x44de('0x4e')]=_0x362c66[_0x44de('0x4e')][_0x44de('0x5c')]?_0x362c66[_0x44de('0x4e')]:_0x41278d[_0x44de('0x47')];if(!_0x1be851[_0x44de('0x4a')][_0x44de('0x4f')](_0x44de('0x50'))){_0x362c66[_0x44de('0x31')]=qs[_0x44de('0x31')](_0x1be851['query'][_0x44de('0x31')]);_0x362c66[_0x44de('0x30')]=qs[_0x44de('0x30')](_0x1be851['query'][_0x44de('0x30')]);}_0x362c66['order']=qs[_0x44de('0x52')](_0x1be851[_0x44de('0x4a')][_0x44de('0x52')]);_0x362c66[_0x44de('0x53')]=qs[_0x44de('0x4b')](_[_0x44de('0x6e')](_0x1be851[_0x44de('0x4a')],_0x41278d[_0x44de('0x4b')]));_0x362c66[_0x44de('0x53')][_0x44de('0x6a')]=_0x5b9bcd['id'];if(_0x1be851[_0x44de('0x4a')][_0x44de('0x56')]){_0x362c66[_0x44de('0x53')]=_[_0x44de('0x54')](_0x362c66[_0x44de('0x53')],{'$or':_[_0x44de('0x48')](_0x362c66[_0x44de('0x4e')],function(_0x1e5aad){var _0x1d99c4={};_0x1d99c4[_0x1e5aad]={'$like':'%'+_0x1be851[_0x44de('0x4a')][_0x44de('0x56')]+'%'};return _0x1d99c4;})});}_0x362c66=_['merge']({},_0x362c66,_0x1be851[_0x44de('0x5d')]);return db[_0x44de('0x74')][_0x44de('0x33')]({'where':_0x362c66['where']})[_0x44de('0x3a')](function(_0x4d4d68){_0x305e16[_0x44de('0x33')]=_0x4d4d68;if(_0x1be851[_0x44de('0x4a')][_0x44de('0x58')]){_0x362c66['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x362c66);})[_0x44de('0x3a')](function(_0x396e15){_0x305e16['rows']=_0x396e15;return _0x305e16;});}})[_0x44de('0x3a')](respondWithFilteredResult(_0x23a8a8,_0x362c66))[_0x44de('0x2d')](handleError(_0x23a8a8,null));};exports[_0x44de('0x75')]=function(_0x5a47f,_0x2f3fed,_0x26fb83){return db[_0x44de('0x57')]['find']({'where':{'id':_0x5a47f[_0x44de('0x67')]['id']}})['then'](handleEntityNotFound(_0x2f3fed,null))[_0x44de('0x3a')](function(_0x32192b){if(_0x32192b){return _0x32192b['removeAnswers'](_0x5a47f[_0x44de('0x4a')][_0x44de('0x71')]);}})['then'](respondWithStatusCode(_0x2f3fed,null))[_0x44de('0x2d')](handleError(_0x2f3fed,null));};exports[_0x44de('0x76')]=function(_0x39744c,_0x344ad5,_0x287f1e){return db[_0x44de('0x77')][_0x44de('0x5e')]({'where':{'id':_0x39744c['params']['id']}})['then'](handleEntityNotFound(_0x344ad5,null))[_0x44de('0x3a')](function(_0x52cc3c){if(_0x52cc3c){return _0x52cc3c[_0x44de('0x76')](_0x39744c[_0x44de('0x60')][_0x44de('0x71')],_[_0x44de('0x78')](_0x39744c[_0x44de('0x60')],[_0x44de('0x71'),'id'])||{});}})[_0x44de('0x3a')](respondWithResult(_0x344ad5,null))[_0x44de('0x2d')](handleError(_0x344ad5,null));};exports[_0x44de('0x79')]=function(_0x5033ce,_0x5067b4,_0x5dbc2b){var _0x2107a2={'raw':![],'where':{}};var _0x491d00={};var _0x3de5b7={'count':0x0,'rows':[]};return db[_0x44de('0x57')][_0x44de('0x6d')]({'where':{'id':_0x5033ce[_0x44de('0x67')]['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x5067b4,null))[_0x44de('0x3a')](function(_0x2017f5){if(_0x2017f5){_0x491d00[_0x44de('0x47')]=_[_0x44de('0x49')](db['FaxInteraction'][_0x44de('0x43')]);_0x491d00['query']=_[_0x44de('0x49')](_0x5033ce['query']);_0x491d00[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x491d00['model'],_0x491d00[_0x44de('0x4a')]);_0x2107a2['attributes']=_[_0x44de('0x4c')](_0x491d00['model'],qs[_0x44de('0x4d')](_0x5033ce[_0x44de('0x4a')][_0x44de('0x4d')]));_0x2107a2['attributes']=_0x2107a2[_0x44de('0x4e')]['length']?_0x2107a2[_0x44de('0x4e')]:_0x491d00['model'];if(!_0x5033ce['query'][_0x44de('0x4f')]('nolimit')){_0x2107a2[_0x44de('0x31')]=qs[_0x44de('0x31')](_0x5033ce[_0x44de('0x4a')][_0x44de('0x31')]);_0x2107a2[_0x44de('0x30')]=qs['offset'](_0x5033ce[_0x44de('0x4a')][_0x44de('0x30')]);}_0x2107a2[_0x44de('0x51')]=qs[_0x44de('0x52')](_0x5033ce[_0x44de('0x4a')][_0x44de('0x52')]);_0x2107a2['where']=qs['filters'](_[_0x44de('0x6e')](_0x5033ce[_0x44de('0x4a')],_0x491d00[_0x44de('0x4b')]));_0x2107a2['where'][_0x44de('0x6a')]=_0x2017f5['id'];if(_0x5033ce[_0x44de('0x4a')][_0x44de('0x56')]){_0x2107a2['where']=_[_0x44de('0x54')](_0x2107a2[_0x44de('0x53')],{'$or':_['map'](_0x2107a2['attributes'],function(_0x500449){var _0x2fc594={};_0x2fc594[_0x500449]={'$like':'%'+_0x5033ce['query'][_0x44de('0x56')]+'%'};return _0x2fc594;})});}_0x2107a2=_[_0x44de('0x54')]({},_0x2107a2,_0x5033ce['options']);return db['FaxInteraction'][_0x44de('0x33')]({'where':_0x2107a2['where']})['then'](function(_0x5650e9){_0x3de5b7[_0x44de('0x33')]=_0x5650e9;if(_0x5033ce[_0x44de('0x4a')]['includeAll']){_0x2107a2[_0x44de('0x59')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db['User'],'as':_0x44de('0x7a'),'attributes':['name',_0x44de('0x7b'),_0x44de('0x7c')],'required':![]},{'model':db[_0x44de('0x7d')],'as':_0x44de('0x7e'),'attributes':['id',_0x44de('0x40'),'color'],'where':_0x5033ce[_0x44de('0x4a')][_0x44de('0x7f')]?{'id':_0x5033ce['query'][_0x44de('0x7f')]}:undefined,'required':_0x5033ce[_0x44de('0x4a')]['tag']?!![]:![]}];}return db[_0x44de('0x77')][_0x44de('0x5a')](_0x2107a2);})[_0x44de('0x3a')](function(_0xcad592){_0x3de5b7[_0x44de('0x6f')]=_0xcad592;return _0x3de5b7;});}})[_0x44de('0x3a')](respondWithFilteredResult(_0x5067b4,_0x2107a2))[_0x44de('0x2d')](handleError(_0x5067b4,null));};exports['addApplications']=function(_0x227d89,_0x4687cf){var _0x7325b2=_0x227d89['params']['id'];var _0x569f95=_0x227d89[_0x44de('0x60')];var _0x1a04fc=0xc8;var _0x4639aa=null;return db[_0x44de('0x80')][_0x44de('0x81')]({'isolationLevel':db['sequelize'][_0x44de('0x82')][_0x44de('0x83')][_0x44de('0x84')]},function(_0x92ff7f){return db[_0x44de('0x57')][_0x44de('0x6d')]({'where':{'id':_0x7325b2},'transaction':_0x92ff7f})[_0x44de('0x3a')](function(_0x3f3a3c){if(_0x3f3a3c){return db[_0x44de('0x85')][_0x44de('0x3e')]({'where':{'FaxAccountId':_0x7325b2},'transaction':_0x92ff7f})['then'](function(){var _0x2e236c=_[_0x44de('0x48')](_0x569f95,function(_0x20549e){_0x20549e['FaxAccountId']=_0x7325b2;return _0x20549e;});return db[_0x44de('0x85')]['bulkCreate'](_0x2e236c,{'transaction':_0x92ff7f});});}else{_0x1a04fc=0x194;_0x4639aa=[];}});})['then'](function(){if(_0x1a04fc!==0x194){return db[_0x44de('0x85')][_0x44de('0x86')]({'where':{'FaxAccountId':_0x7325b2},'order':'priority'})[_0x44de('0x3a')](function(_0x4218fb){_0x4639aa=_0x4218fb;});}})['catch'](function(_0x12eb8c){_0x1a04fc=0x1f4;logger[_0x44de('0x2a')](_0x12eb8c[_0x44de('0x3f')]);if(_0x12eb8c[_0x44de('0x40')]){delete _0x12eb8c[_0x44de('0x40')];}_0x4639aa=_0x12eb8c;})[_0x44de('0x87')](function(){if(_0x4639aa===null){_0x4687cf[_0x44de('0x2e')](_0x1a04fc);}else{if(_0x1a04fc===0x1f4){_0x4687cf[_0x44de('0x34')](_0x1a04fc)[_0x44de('0x88')](_0x4639aa);}else{_0x4687cf['status'](_0x1a04fc)[_0x44de('0x37')](_0x4639aa);}}});};exports['getApplications']=function(_0x59aa7d,_0x3ac3cf,_0x511e0a){var _0x2f66b2={};var _0x4e5c74={};var _0x16c60f;var _0x269586;return db[_0x44de('0x57')][_0x44de('0x6d')]({'where':{'id':_0x59aa7d[_0x44de('0x67')]['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x3ac3cf,null))[_0x44de('0x3a')](function(_0x24bcd0){if(_0x24bcd0){_0x16c60f=_0x24bcd0;_0x4e5c74[_0x44de('0x47')]=_['keys'](db[_0x44de('0x85')][_0x44de('0x43')]);_0x4e5c74['query']=_['keys'](_0x59aa7d[_0x44de('0x4a')]);_0x4e5c74[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x4e5c74[_0x44de('0x47')],_0x4e5c74[_0x44de('0x4a')]);_0x2f66b2[_0x44de('0x4e')]=_[_0x44de('0x4c')](_0x4e5c74[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x59aa7d[_0x44de('0x4a')][_0x44de('0x4d')]));_0x2f66b2['attributes']=_0x2f66b2[_0x44de('0x4e')][_0x44de('0x5c')]?_0x2f66b2[_0x44de('0x4e')]:_0x4e5c74[_0x44de('0x47')];_0x2f66b2['order']=qs[_0x44de('0x52')](_0x59aa7d['query'][_0x44de('0x52')]);_0x2f66b2['where']=qs['filters'](_['pick'](_0x59aa7d[_0x44de('0x4a')],_0x4e5c74[_0x44de('0x4b')]));if(_0x59aa7d[_0x44de('0x4a')][_0x44de('0x56')]){_0x2f66b2['where']=_[_0x44de('0x54')](_0x2f66b2[_0x44de('0x53')],{'$or':_['map'](_0x2f66b2[_0x44de('0x4e')],function(_0x1f5687){var _0x31f769={};_0x31f769[_0x1f5687]={'$like':'%'+_0x59aa7d[_0x44de('0x4a')][_0x44de('0x56')]+'%'};return _0x31f769;})});}_0x2f66b2=_[_0x44de('0x54')]({},_0x2f66b2,_0x59aa7d[_0x44de('0x5d')]);return _0x16c60f['getApplications'](_0x2f66b2);}})[_0x44de('0x3a')](function(_0x4752cb){if(_0x4752cb){_0x269586=_0x4752cb[_0x44de('0x5c')];if(!_0x59aa7d['query'][_0x44de('0x4f')](_0x44de('0x50'))){_0x2f66b2['limit']=qs[_0x44de('0x31')](_0x59aa7d[_0x44de('0x4a')][_0x44de('0x31')]);_0x2f66b2['offset']=qs[_0x44de('0x30')](_0x59aa7d[_0x44de('0x4a')][_0x44de('0x30')]);}return _0x16c60f[_0x44de('0x89')](_0x2f66b2);}})[_0x44de('0x3a')](function(_0x1b7e4a){if(_0x1b7e4a){return _0x1b7e4a?{'count':_0x269586,'rows':_0x1b7e4a}:null;}})[_0x44de('0x3a')](respondWithResult(_0x3ac3cf,null))[_0x44de('0x2d')](handleError(_0x3ac3cf,null));};function Extension(_0x55909b,_0x5cc80c,_0x363469,_0x3de13c){this[_0x44de('0x8a')]=_0x44de('0x8b');this[_0x44de('0x8c')]=_0x55909b[_0x44de('0x8d')];this[_0x44de('0x8e')]=_0x3de13c;this['type']=_0x44de('0x8f');this[_0x44de('0x90')]=_0x44de('0x91');this['FaxAccountId']=_0x55909b['id'];this[_0x44de('0x92')]=_0x5cc80c;this[_0x44de('0x93')]=_0x363469;}function createExtensionsReciveFax(_0x4a7f95){var _0x1409db=0x1;var _0xcda330=[];_0xcda330[_0x44de('0x94')](new Extension(_0x4a7f95,_0x1409db,'','Answer'));_0x1409db+=0x1;_0xcda330['push'](new Extension(_0x4a7f95,_0x1409db,'CDR(type)=inbound-fax',_0x44de('0x95')));_0x1409db+=0x1;for(var _0x59ef45 in _0x4a7f95){if(_0x4a7f95[_0x44de('0x4f')](_0x59ef45)&&(_0x59ef45===_0x44de('0x96')||_0x59ef45==='localstationid'||_0x59ef45==='gateway'||_0x59ef45==='faxdetect'||_0x59ef45===_0x44de('0x97')||_0x59ef45===_0x44de('0x98')||_0x59ef45==='minrate'||_0x59ef45==='modem'||_0x59ef45===_0x44de('0x99'))){_0xcda330[_0x44de('0x94')](new Extension(_0x4a7f95,_0x1409db,_0x44de('0x9a')+_0x59ef45+')='+_0x4a7f95[_0x59ef45],_0x44de('0x95')));_0x1409db+=0x1;}}_0xcda330[_0x44de('0x94')](new Extension(_0x4a7f95,_0x1409db,'6','Wait'));_0x1409db+=0x1;_0xcda330[_0x44de('0x94')](new Extension(_0x4a7f95,_0x1409db,_0x44de('0x9b'),_0x44de('0x9c')));_0x1409db=0x0;return _0xcda330;}exports[_0x44de('0x9d')]=function(_0x2b8229,_0x4a9cfe,_0x1c98ff){var _0x49df0e;return db['sequelize']['transaction'](function(_0x37f78b){return db[_0x44de('0x57')][_0x44de('0x5f')](_0x2b8229[_0x44de('0x60')],{'transaction':_0x37f78b})[_0x44de('0x3a')](function(_0x226404){_0x49df0e=_0x226404[_0x44de('0x3b')]({'plain':!![]});return db[_0x44de('0x9e')][_0x44de('0x9f')](createExtensionsReciveFax(_0x49df0e),{'transaction':_0x37f78b});});})[_0x44de('0x3a')](function(){return _0x49df0e;})[_0x44de('0x3a')](respondWithResult(_0x4a9cfe,null))[_0x44de('0x2d')](handleError(_0x4a9cfe,null));};exports[_0x44de('0xa0')]=function(_0xa7262b,_0x565cf4,_0x36df8c){var _0x448ff5;return db[_0x44de('0x80')][_0x44de('0x81')](function(_0x5c24c6){return db['FaxAccount'][_0x44de('0x39')](_0xa7262b[_0x44de('0x60')],{'where':{'id':_0xa7262b['body']['id']},'transaction':_0x5c24c6})['then'](function(_0x1a8b00){return db[_0x44de('0x9e')][_0x44de('0x3e')]({'where':{'FaxAccountId':_0xa7262b[_0x44de('0x60')]['id']},'transaction':_0x5c24c6})[_0x44de('0x3a')](function(_0x3d8bd7){return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_[_0x44de('0x78')](_0xa7262b['body'],[_0x44de('0xa1'),'key',_0x44de('0xa2'),_0x44de('0xa3'),_0x44de('0xa4'),_0x44de('0xa5')])),{'transaction':_0x5c24c6});});});})[_0x44de('0x3a')](function(){return db[_0x44de('0x57')][_0x44de('0xa6')](_0xa7262b[_0x44de('0x60')]['id']);})[_0x44de('0x3a')](respondWithResult(_0x565cf4,null))[_0x44de('0x2d')](handleError(_0x565cf4,null));};exports[_0x44de('0xa7')]=function(_0x26046e,_0xb77e,_0x2b42c7){var _0x183ede={'raw':!![],'where':{}};var _0x2a2230={};var _0x4e5a2d={'count':0x0,'rows':[]};return db[_0x44de('0x57')][_0x44de('0x6d')]({'where':{'id':_0x26046e[_0x44de('0x67')]['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0xb77e,null))[_0x44de('0x3a')](function(_0x56f84a){if(_0x56f84a){_0x2a2230[_0x44de('0x47')]=_['keys'](db['FaxMessage'][_0x44de('0x43')]);_0x2a2230[_0x44de('0x4a')]=_[_0x44de('0x49')](_0x26046e[_0x44de('0x4a')]);_0x2a2230[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x2a2230[_0x44de('0x47')],_0x2a2230['query']);_0x183ede[_0x44de('0x4e')]=_[_0x44de('0x4c')](_0x2a2230[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x26046e[_0x44de('0x4a')]['fields']));_0x183ede[_0x44de('0x4e')]=_0x183ede[_0x44de('0x4e')][_0x44de('0x5c')]?_0x183ede['attributes']:_0x2a2230[_0x44de('0x47')];if(!_0x26046e['query'][_0x44de('0x4f')](_0x44de('0x50'))){_0x183ede[_0x44de('0x31')]=qs[_0x44de('0x31')](_0x26046e['query'][_0x44de('0x31')]);_0x183ede[_0x44de('0x30')]=qs[_0x44de('0x30')](_0x26046e[_0x44de('0x4a')]['offset']);}_0x183ede[_0x44de('0x51')]=qs[_0x44de('0x52')](_0x26046e['query'][_0x44de('0x52')]);_0x183ede[_0x44de('0x53')]=qs['filters'](_[_0x44de('0x6e')](_0x26046e[_0x44de('0x4a')],_0x2a2230[_0x44de('0x4b')]));_0x183ede[_0x44de('0x53')][_0x44de('0x6a')]=_0x56f84a['id'];if(_0x26046e[_0x44de('0x4a')][_0x44de('0x56')]){_0x183ede[_0x44de('0x53')]=_[_0x44de('0x54')](_0x183ede[_0x44de('0x53')],{'$or':_[_0x44de('0x48')](_0x183ede['attributes'],function(_0x1d3359){var _0x2f4178={};_0x2f4178[_0x1d3359]={'$like':'%'+_0x26046e[_0x44de('0x4a')][_0x44de('0x56')]+'%'};return _0x2f4178;})});}if(_0x26046e[_0x44de('0x4a')][_0x44de('0xa8')]){var _0x5c6bf5=_0x26046e[_0x44de('0x4a')]['$gte'][_0x44de('0xa9')](',');var _0x588724={};_0x588724[_0x5c6bf5[0x0]]={'$gte':moment(_0x5c6bf5[0x1])[_0x44de('0xaa')](_0x44de('0xab'))};_0x183ede[_0x44de('0x53')]=_[_0x44de('0x54')](_0x183ede[_0x44de('0x53')],_0x588724);}_0x183ede=_[_0x44de('0x54')]({},_0x183ede,_0x26046e[_0x44de('0x5d')]);return db['FaxMessage'][_0x44de('0x33')]({'where':_0x183ede[_0x44de('0x53')]})[_0x44de('0x3a')](function(_0x43efd5){_0x4e5a2d[_0x44de('0x33')]=_0x43efd5;if(_0x26046e[_0x44de('0x4a')][_0x44de('0x58')]){_0x183ede[_0x44de('0x59')]=[{'all':!![]}];}return db[_0x44de('0xac')][_0x44de('0x5a')](_0x183ede);})[_0x44de('0x3a')](function(_0x10bd4b){_0x4e5a2d[_0x44de('0x6f')]=_0x10bd4b;return _0x4e5a2d;});}})[_0x44de('0x3a')](respondWithFilteredResult(_0xb77e,_0x183ede))[_0x44de('0x2d')](handleError(_0xb77e,null));};exports[_0x44de('0x88')]=function(_0x521bd3,_0x402de9,_0x482971){var _0x294b1d,_0x3d2f43={},_0x459fd6;if(_0x521bd3['body']['to']){_0x459fd6=_0x521bd3[_0x44de('0x60')]['to'][0x0];}return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x521bd3['params']['id']},'include':[{'model':db[_0x44de('0xad')],'as':_0x44de('0xae'),'include':[{'model':db[_0x44de('0xaf')],'as':_0x44de('0xb0'),'where':{'fax':_0x459fd6},'limit':0x1,'order':[[_0x44de('0xa3'),_0x44de('0xb1')]]}]}]})[_0x44de('0x3a')](handleEntityNotFound(_0x402de9,null))[_0x44de('0x3a')](function(_0x5a2195){_0x294b1d=_0x5a2195;if(_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')]&&_0x521bd3['body']['attachments'][_0x44de('0x5c')]){for(var _0x2aad7d=0x0;_0x2aad7d<_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][_0x44de('0x5c')];_0x2aad7d+=0x1){_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][_0x2aad7d]={'filename':_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][_0x2aad7d][_0x44de('0x40')],'id':_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][_0x2aad7d]['id'],'path':path[_0x44de('0xb3')](config[_0x44de('0xb4')],'server/files/attachments',_0x521bd3[_0x44de('0x60')]['attachments'][_0x2aad7d][_0x44de('0xb5')])};}}return respondWithRpcPromise(_0x44de('0xb6'),_0x44de('0xb6'),{'FaxAccountId':_['isNil'](_0x521bd3[_0x44de('0x67')]['id'])?undefined:_0x521bd3[_0x44de('0x67')]['id'],'path':_[_0x44de('0xb7')](_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0][_0x44de('0x7')])?undefined:_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0][_0x44de('0x7')],'fax':_[_0x44de('0xb7')](_0x521bd3['body']['to'][0x0])?undefined:_0x521bd3[_0x44de('0x60')]['to'][0x0]},client9002);})[_0x44de('0x3a')](function(){if(_0x294b1d){if(_[_0x44de('0xb7')](_0x521bd3['body'][_0x44de('0xb8')])){_0x521bd3[_0x44de('0x60')][_0x44de('0xb8')]=util[_0x44de('0xaa')]('\x22%s\x22\x20<%s>',_0x294b1d[_0x44de('0x40')],_0x294b1d[_0x44de('0xb9')]);}if(_0x294b1d['List']){if(_0x294b1d[_0x44de('0xae')][_0x44de('0xb0')][_0x44de('0x5c')]){return _0x294b1d[_0x44de('0xae')][_0x44de('0xb0')][0x0];}else{return db['CmContact'][_0x44de('0x5f')](_['defaults'](_0x521bd3[_0x44de('0x60')],{'firstName':_0x521bd3[_0x44de('0x60')]['to'][0x0],'phone':_0x521bd3['body']['to'][0x0],'fax':_0x521bd3[_0x44de('0x60')]['to'][0x0],'ListId':_0x294b1d['ListId']}));}}else{throw new Error(_0x44de('0xba'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x348a95){if(_0x348a95){return db[_0x44de('0x77')][_0x44de('0x5e')]({'where':{'ContactId':_0x348a95['id'],'closed':![],'FaxAccountId':_0x294b1d['id']}})[_0x44de('0x3a')](function(_0x54e265){if(_0x54e265){return[_0x54e265,![]];}return db['FaxInteraction'][_0x44de('0x5f')]({'UserId':_0x521bd3[_0x44de('0x62')]['id'],'ContactId':_0x348a95['id'],'FaxAccountId':_0x294b1d['id'],'fax':_0x521bd3[_0x44de('0x60')]['to'][0x0],'firstMsgDirection':_0x44de('0xbb'),'Messages':[_[_0x44de('0x54')](_0x521bd3[_0x44de('0x60')],{'read':![],'body':_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0][_0x44de('0xbc')],'FaxAccountId':_0x294b1d['id'],'UserId':_0x521bd3[_0x44de('0x62')]['id'],'ContactId':_0x348a95['id'],'AttachmentId':_0x521bd3[_0x44de('0x60')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x44de('0xac')],'as':_0x44de('0xbd')}]})[_0x44de('0x3a')](function(_0x43308e){return[_0x43308e,!![]];});});}else{throw new Error(_0x44de('0xbe'));}})[_0x44de('0xbf')](function(_0x567ab7,_0x245844){if(_0x245844){return _0x567ab7;}return db[_0x44de('0xac')][_0x44de('0x5f')]({'direction':'out','read':![],'body':_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0][_0x44de('0xbc')],'FaxAccountId':_0x294b1d['id'],'FaxInteractionId':_0x567ab7['id'],'UserId':_0x521bd3[_0x44de('0x62')]['id'],'ContactId':_0x567ab7[_0x44de('0xc0')],'AttachmentId':_0x521bd3['body'][_0x44de('0xb2')][0x0]['id']})[_0x44de('0x3a')](function(_0x10af17){_0x567ab7['dataValues']['Messages']=[];_0x567ab7[_0x44de('0xc1')][_0x44de('0xbd')]['push'](_0x10af17[_0x44de('0xc1')]);return _0x567ab7;});})[_0x44de('0x3a')](function(_0x51e791){respondWithRpcPromise(_0x44de('0xc2'),_0x44de('0xc2'),{'FaxAccountId':_[_0x44de('0xb7')](_0x521bd3['params']['id'])?undefined:_0x521bd3[_0x44de('0x67')]['id'],'path':_[_0x44de('0xb7')](_0x521bd3[_0x44de('0x60')]['attachments'][0x0][_0x44de('0x7')])?undefined:_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0][_0x44de('0x7')],'fax':_[_0x44de('0xb7')](_0x521bd3[_0x44de('0x60')]['to'][0x0])?undefined:_0x521bd3[_0x44de('0x60')]['to'][0x0],'AttachmentId':_0x521bd3[_0x44de('0x60')][_0x44de('0xb2')][0x0]['id']},client9002)[_0x44de('0x3a')](function(_0xd6bce1){logger[_0x44de('0x24')](_0x44de('0xc3'),_0xd6bce1);})[_0x44de('0x2d')](function(_0x394cb4){logger[_0x44de('0x24')](_0x44de('0xc3'),_0x394cb4);});return _0x51e791;})[_0x44de('0x3a')](respondWithResult(_0x402de9,null))[_0x44de('0x2d')](handleError(_0x402de9,null));};exports[_0x44de('0xc4')]=function(_0x2cfcf3,_0x4fd5b7,_0x4e9104){return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0x2cfcf3[_0x44de('0x67')]['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x4fd5b7,null))[_0x44de('0x3a')](function(_0x128954){if(_0x128954){return _0x128954[_0x44de('0xc4')](_0x2cfcf3[_0x44de('0x60')][_0x44de('0x71')],_[_0x44de('0x78')](_0x2cfcf3[_0x44de('0x60')],[_0x44de('0x71'),'id'])||{})[_0x44de('0xbf')](function(_0x1a442e){for(var _0xf4e5e3=0x0;_0xf4e5e3<_0x2cfcf3[_0x44de('0x60')]['ids'][_0x44de('0x5c')];_0xf4e5e3+=0x1){socket[_0x44de('0xc5')](_0x44de('0xc6'),{'UserId':Number(_0x2cfcf3['body'][_0x44de('0x71')][_0xf4e5e3]),'FaxAccountId':Number(_0x2cfcf3[_0x44de('0x67')]['id'])});}return _0x1a442e;});}})[_0x44de('0x3a')](respondWithResult(_0x4fd5b7,null))['catch'](handleError(_0x4fd5b7,null));};exports['removeAgents']=function(_0xe98f88,_0x7a59f7,_0x271445){return db[_0x44de('0x57')][_0x44de('0x5e')]({'where':{'id':_0xe98f88['params']['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x7a59f7,null))['then'](function(_0x3335c0){if(_0x3335c0){return _0x3335c0[_0x44de('0xc7')](_0xe98f88['query'][_0x44de('0x71')])[_0x44de('0x3a')](function(){if(_[_0x44de('0xc8')](_0xe98f88['query'][_0x44de('0x71')])){for(var _0x2bf3d0=0x0;_0x2bf3d0<_0xe98f88[_0x44de('0x4a')][_0x44de('0x71')][_0x44de('0x5c')];_0x2bf3d0+=0x1){socket[_0x44de('0xc5')](_0x44de('0xc9'),{'UserId':Number(_0xe98f88[_0x44de('0x4a')]['ids'][_0x2bf3d0]),'FaxAccountId':Number(_0xe98f88[_0x44de('0x67')]['id'])});}}else{socket[_0x44de('0xc5')](_0x44de('0xc9'),{'UserId':Number(_0xe98f88[_0x44de('0x4a')]['ids']),'FaxAccountId':Number(_0xe98f88['params']['id'])});}});}})[_0x44de('0x3a')](respondWithStatusCode(_0x7a59f7,null))[_0x44de('0x2d')](handleError(_0x7a59f7,null));};exports[_0x44de('0xca')]=function(_0x452c29,_0x2aec6d,_0x2e4e88){var _0x5b3449={};var _0x562952={};var _0x46d477;var _0x52aaf8;return db[_0x44de('0x57')]['findOne']({'where':{'id':_0x452c29['params']['id']}})[_0x44de('0x3a')](handleEntityNotFound(_0x2aec6d,null))['then'](function(_0x2f7255){if(_0x2f7255){_0x46d477=_0x2f7255;_0x562952[_0x44de('0x47')]=_['keys'](db[_0x44de('0xcb')][_0x44de('0x43')]);_0x562952[_0x44de('0x4a')]=_['keys'](_0x452c29[_0x44de('0x4a')]);_0x562952[_0x44de('0x4b')]=_[_0x44de('0x4c')](_0x562952[_0x44de('0x47')],_0x562952['query']);_0x5b3449['attributes']=_['intersection'](_0x562952[_0x44de('0x47')],qs[_0x44de('0x4d')](_0x452c29[_0x44de('0x4a')][_0x44de('0x4d')]));_0x5b3449['attributes']=_0x5b3449['attributes'][_0x44de('0x5c')]?_0x5b3449[_0x44de('0x4e')]:_0x562952[_0x44de('0x47')];_0x5b3449[_0x44de('0x51')]=qs[_0x44de('0x52')](_0x452c29[_0x44de('0x4a')][_0x44de('0x52')]);_0x5b3449[_0x44de('0x53')]=qs[_0x44de('0x4b')](_[_0x44de('0x6e')](_0x452c29[_0x44de('0x4a')],_0x562952[_0x44de('0x4b')]));if(_0x452c29[_0x44de('0x4a')][_0x44de('0x56')]){_0x5b3449['where']=_[_0x44de('0x54')](_0x5b3449['where'],{'$or':_[_0x44de('0x48')](_0x5b3449[_0x44de('0x4e')],function(_0x2cd2ee){var _0x1f8c99={};_0x1f8c99[_0x2cd2ee]={'$like':'%'+_0x452c29['query']['filter']+'%'};return _0x1f8c99;})});}_0x5b3449=_['merge']({},_0x5b3449,_0x452c29[_0x44de('0x5d')]);return _0x46d477[_0x44de('0xca')](_0x5b3449);}})[_0x44de('0x3a')](function(_0x19d2a8){if(_0x19d2a8){_0x52aaf8=_0x19d2a8[_0x44de('0x5c')];if(!_0x452c29[_0x44de('0x4a')][_0x44de('0x4f')]('nolimit')){_0x5b3449[_0x44de('0x31')]=qs[_0x44de('0x31')](_0x452c29[_0x44de('0x4a')][_0x44de('0x31')]);_0x5b3449[_0x44de('0x30')]=qs[_0x44de('0x30')](_0x452c29[_0x44de('0x4a')][_0x44de('0x30')]);}return _0x46d477[_0x44de('0xca')](_0x5b3449);}})[_0x44de('0x3a')](function(_0x53917d){if(_0x53917d){return _0x53917d?{'count':_0x52aaf8,'rows':_0x53917d}:null;}})[_0x44de('0x3a')](respondWithResult(_0x2aec6d,null))[_0x44de('0x2d')](handleError(_0x2aec6d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1cd5a9e..a5be6d2 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 _0x4c18=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','save','update'];(function(_0x25033a,_0x15d628){var _0x1c4665=function(_0x103e9e){while(--_0x103e9e){_0x25033a['push'](_0x25033a['shift']());}};_0x1c4665(++_0x15d628);}(_0x4c18,0xaf));var _0x84c1=function(_0x2eb225,_0x3fda7d){_0x2eb225=_0x2eb225-0x0;var _0x586e11=_0x4c18[_0x2eb225];return _0x586e11;};'use strict';var EventEmitter=require(_0x84c1('0x0'));var FaxAccount=require(_0x84c1('0x1'))['db'][_0x84c1('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x84c1('0x3'),'afterUpdate':_0x84c1('0x4'),'afterDestroy':_0x84c1('0x5')};function emitEvent(_0x21a93a){return function(_0x48ee33,_0x45d8ce,_0x254a05){FaxAccountEvents['emit'](_0x21a93a+':'+_0x48ee33['id'],_0x48ee33);FaxAccountEvents[_0x84c1('0x6')](_0x21a93a,_0x48ee33);_0x254a05(null);};}for(var e in events){if(events[_0x84c1('0x7')](e)){var event=events[e];FaxAccount[_0x84c1('0x8')](e,emitEvent(event));}}module[_0x84c1('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0x6da9=['emit','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x2585cc,_0x4b50b5){var _0x2409a4=function(_0x3f3322){while(--_0x3f3322){_0x2585cc['push'](_0x2585cc['shift']());}};_0x2409a4(++_0x4b50b5);}(_0x6da9,0x161));var _0x96da=function(_0x426ff6,_0x95bea9){_0x426ff6=_0x426ff6-0x0;var _0x4f658a=_0x6da9[_0x426ff6];return _0x4f658a;};'use strict';var EventEmitter=require(_0x96da('0x0'));var FaxAccount=require(_0x96da('0x1'))['db'][_0x96da('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x96da('0x3')](0x0);var events={'afterCreate':_0x96da('0x4'),'afterUpdate':_0x96da('0x5'),'afterDestroy':_0x96da('0x6')};function emitEvent(_0x5198e8){return function(_0x5d07cd,_0x4fd3b8,_0x191a57){FaxAccountEvents[_0x96da('0x7')](_0x5198e8+':'+_0x5d07cd['id'],_0x5d07cd);FaxAccountEvents[_0x96da('0x7')](_0x5198e8,_0x5d07cd);_0x191a57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x96da('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 67c3f04..c24adcd 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 _0x46cc=['api','moment','bluebird','request-promise','path','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','util'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x46cc,0x13e));var _0xc46c=function(_0x50c2c8,_0x17421e){_0x50c2c8=_0x50c2c8-0x0;var _0x55f8a3=_0x46cc[_0x50c2c8];return _0x55f8a3;};'use strict';var _=require('lodash');var util=require(_0xc46c('0x0'));var logger=require('../../config/logger')(_0xc46c('0x1'));var moment=require(_0xc46c('0x2'));var BPromise=require(_0xc46c('0x3'));var rp=require(_0xc46c('0x4'));var fs=require('fs');var path=require(_0xc46c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc46c('0x6'));module[_0xc46c('0x7')]=function(_0x28c295,_0x5624d2){return _0x28c295[_0xc46c('0x8')](_0xc46c('0x9'),attributes,{'tableName':_0xc46c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab21=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxAccount.attributes','exports','define','fax_accounts'];(function(_0x5bb783,_0xeff3de){var _0x43674b=function(_0x1973da){while(--_0x1973da){_0x5bb783['push'](_0x5bb783['shift']());}};_0x43674b(++_0xeff3de);}(_0xab21,0x11e));var _0x1ab2=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xab21[_0x1969a7];return _0x3d665f;};'use strict';var _=require(_0x1ab2('0x0'));var util=require(_0x1ab2('0x1'));var logger=require(_0x1ab2('0x2'))(_0x1ab2('0x3'));var moment=require(_0x1ab2('0x4'));var BPromise=require(_0x1ab2('0x5'));var rp=require(_0x1ab2('0x6'));var fs=require('fs');var path=require(_0x1ab2('0x7'));var rimraf=require(_0x1ab2('0x8'));var config=require('../../config/environment');var attributes=require(_0x1ab2('0x9'));module[_0x1ab2('0xa')]=function(_0x35de1f,_0x3c18a2){return _0x35de1f[_0x1ab2('0xb')]('FaxAccount',attributes,{'tableName':_0x1ab2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.rpc.js b/server/api/faxAccount/faxAccount.rpc.js index ff34925..f530479 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 _0x088b=['orderBy','asc','length','defaults','create','contact','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','queueId','FaxQueue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','options','attributes','limit','include','map','model','GetFaxAccount','catch','NotifyFaxAccount','fax','Sequelize','ValidationError','difference','keys','createdAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','CmList','List','CmContact','Contacts','updatedAt','FaxApplication','Applications','get','applications','list'];(function(_0x3e1415,_0x2ad5ee){var _0x2e1ec7=function(_0x4beb31){while(--_0x4beb31){_0x3e1415['push'](_0x3e1415['shift']());}};_0x2e1ec7(++_0x2ad5ee);}(_0x088b,0xc8));var _0xb088=function(_0x4279e1,_0x39cda4){_0x4279e1=_0x4279e1-0x0;var _0x1e33ea=_0x088b[_0x4279e1];return _0x1e33ea;};'use strict';var _=require(_0xb088('0x0'));var util=require('util');var moment=require(_0xb088('0x1'));var BPromise=require(_0xb088('0x2'));var rs=require(_0xb088('0x3'));var fs=require('fs');var Redis=require(_0xb088('0x4'));var db=require(_0xb088('0x5'))['db'];var utils=require(_0xb088('0x6'));var logger=require(_0xb088('0x7'))(_0xb088('0x8'));var config=require(_0xb088('0x9'));var jayson=require(_0xb088('0xa'));var client=jayson['client'][_0xb088('0xb')]({'port':0x232c});config[_0xb088('0xc')]=_['defaults'](config[_0xb088('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xb088('0xd'))(new Redis(config[_0xb088('0xc')]));require(_0xb088('0xe'))['register'](socket);function respondWithRpcPromise(_0x1e5d57,_0x482c14,_0x2fefc7){return new BPromise(function(_0x4fa1e4,_0x555a97){return client[_0xb088('0xf')](_0x1e5d57,_0x2fefc7)[_0xb088('0x10')](function(_0x51ea01){logger[_0xb088('0x11')](_0xb088('0x12'),_0x482c14,_0xb088('0x13'));logger[_0xb088('0x14')](_0xb088('0x15'),_0x482c14,_0xb088('0x13'),JSON[_0xb088('0x16')](_0x51ea01));if(_0x51ea01[_0xb088('0x17')]){if(_0x51ea01[_0xb088('0x17')]['code']===0x1f4){logger[_0xb088('0x17')](_0xb088('0x12'),_0x482c14,_0x51ea01[_0xb088('0x17')][_0xb088('0x18')]);return _0x555a97(_0x51ea01[_0xb088('0x17')][_0xb088('0x18')]);}logger[_0xb088('0x17')]('FaxAccount,\x20%s,\x20%s',_0x482c14,_0x51ea01['error'][_0xb088('0x18')]);return _0x4fa1e4(_0x51ea01['error'][_0xb088('0x18')]);}else{logger[_0xb088('0x11')](_0xb088('0x12'),_0x482c14,'request\x20sent');_0x4fa1e4(_0x51ea01[_0xb088('0x19')][_0xb088('0x18')]);}})['catch'](function(_0xcebe48){logger[_0xb088('0x17')](_0xb088('0x12'),_0x482c14,_0xcebe48);_0x555a97(_0xcebe48);});});}exports['GetFaxAccount']=function(_0x82157b){var _0x13a619=this;return new Promise(function(_0x27c881,_0x37b6be){return db['FaxAccount']['findAll']({'raw':_0x82157b[_0xb088('0x1a')]?_0x82157b[_0xb088('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x82157b[_0xb088('0x1a')]?_0x82157b['options']['where']||null:null,'attributes':_0x82157b[_0xb088('0x1a')]?_0x82157b[_0xb088('0x1a')][_0xb088('0x1b')]||null:null,'limit':_0x82157b[_0xb088('0x1a')]?_0x82157b[_0xb088('0x1a')][_0xb088('0x1c')]||null:null,'include':_0x82157b['options']?_0x82157b[_0xb088('0x1a')][_0xb088('0x1d')]?_[_0xb088('0x1e')](_0x82157b[_0xb088('0x1a')][_0xb088('0x1d')],function(_0x4c0028){return{'model':db[_0x4c0028['model']],'as':_0x4c0028['as'],'attributes':_0x4c0028[_0xb088('0x1b')],'include':_0x4c0028[_0xb088('0x1d')]?_[_0xb088('0x1e')](_0x4c0028['include'],function(_0x49618e){return{'model':db[_0x49618e[_0xb088('0x1f')]],'as':_0x49618e['as'],'attributes':_0x49618e[_0xb088('0x1b')],'include':_0x49618e[_0xb088('0x1d')]?_[_0xb088('0x1e')](_0x49618e[_0xb088('0x1d')],function(_0x4cd8ef){return{'model':db[_0x4cd8ef['model']],'as':_0x4cd8ef['as'],'attributes':_0x4cd8ef['attributes']};}):[]};}):[]};}):[]:[]})[_0xb088('0x10')](function(_0x1680d4){logger[_0xb088('0x11')](_0xb088('0x20'),_0x82157b);logger[_0xb088('0x14')]('GetFaxAccount',_0x82157b,JSON[_0xb088('0x16')](_0x1680d4));_0x27c881(_0x1680d4);})[_0xb088('0x21')](function(_0x170040){logger[_0xb088('0x17')](_0xb088('0x20'),_0x170040[_0xb088('0x18')],_0x82157b);_0x37b6be(_0x13a619['error'](0x1f4,_0x170040[_0xb088('0x18')]));});});};exports[_0xb088('0x22')]=function(_0x4c6171,_0x9ea8ef,_0x2a597b){var _0x4447f2=this;return new Promise(function(_0x2e344d,_0x3e76c7){var _0x2c8fc6={'body':_0x4c6171['body'],'channel':_0xb088('0x23')};var _0x221211=[];var _0x50cbe0=[];var _0x117125={};return db['CmContact']['describe']()['then'](function(_0x53940f){if(!_0x53940f){throw new db[(_0xb088('0x24'))][(_0xb088('0x25'))]('no\x20available\x20attributes');}_0x221211=_[_0xb088('0x26')](_[_0xb088('0x27')](_0x53940f),[_0xb088('0x28'),'updatedAt']);_0x50cbe0=_[_0xb088('0x26')](_['keys'](_0x53940f),[_0xb088('0x28'),'updatedAt',_0xb088('0x29'),_0xb088('0x2a')]);if(_0x4c6171['body']['id']){delete _0x4c6171[_0xb088('0x2b')]['id'];}if(_[_0xb088('0x2c')](_0x4c6171[_0xb088('0x2b')][_0xb088('0x2d')])){throw new db[(_0xb088('0x24'))][(_0xb088('0x25'))](_0xb088('0x2e'));}if(_[_0xb088('0x2c')](_0x4c6171[_0xb088('0x2b')][_0xb088('0x2b')])||_0x4c6171[_0xb088('0x2b')][_0xb088('0x2b')]===''){throw new db[(_0xb088('0x24'))][(_0xb088('0x25'))](_0xb088('0x2f'));}if(_[_0xb088('0x2c')](_0x4c6171[_0xb088('0x2b')][_0xb088('0x30')])){throw new db['Sequelize'][(_0xb088('0x25'))](_0xb088('0x31')+_0x50cbe0);}if(!_['includes'](_0x50cbe0,_0x4c6171[_0xb088('0x2b')][_0xb088('0x30')])){throw new db[(_0xb088('0x24'))][(_0xb088('0x25'))](_0xb088('0x32')+_0x50cbe0);}_0x117125[_0x4c6171[_0xb088('0x2b')]['mapKey']]=_0x4c6171[_0xb088('0x2b')][_0xb088('0x2d')];})['then'](function(){return db[_0xb088('0x33')][_0xb088('0x34')]({'where':{'id':_0x4c6171[_0xb088('0x35')]['id']},'include':[{'model':db[_0xb088('0x36')],'as':_0xb088('0x37'),'include':[{'model':db[_0xb088('0x38')],'as':_0xb088('0x39'),'where':_0x117125,'limit':0x1,'order':[[_0xb088('0x3a'),'DESC']]}]},{'model':db[_0xb088('0x3b')],'as':_0xb088('0x3c')}]});})[_0xb088('0x10')](function(_0xc5909f){if(_0xc5909f&&_0xc5909f['List']){var _0x5644f6=_0xc5909f[_0xb088('0x3d')]({'plain':!![]});_0x2c8fc6['account']=_0x5644f6;_0x2c8fc6[_0xb088('0x3e')]=_0x5644f6[_0xb088('0x3c')];_0x2c8fc6[_0xb088('0x3f')]=_0x5644f6[_0xb088('0x37')];_0x2c8fc6['applications']=_[_0xb088('0x40')](_0x2c8fc6[_0xb088('0x3e')],['priority'],[_0xb088('0x41')]);if(_0x2c8fc6[_0xb088('0x35')][_0xb088('0x3c')]){delete _0x2c8fc6[_0xb088('0x35')][_0xb088('0x3c')];}if(_0x2c8fc6[_0xb088('0x35')]['List']&&_0x2c8fc6['account'][_0xb088('0x37')]['Contacts'][_0xb088('0x42')]){return _0x2c8fc6['account']['List'][_0xb088('0x39')][0x0];}var _0x454148=_[_0xb088('0x43')](_0x4c6171[_0xb088('0x2b')],{'firstName':_0x4c6171[_0xb088('0x2b')][_0xb088('0x2d')],'ListId':_0x5644f6[_0xb088('0x2a')]});_0x454148[_0x4c6171[_0xb088('0x2b')][_0xb088('0x30')]]=_0x4c6171['body'][_0xb088('0x2d')];return db['CmContact'][_0xb088('0x44')](_0x454148,{'fields':_0x221211,'raw':!![]});}})[_0xb088('0x10')](function(_0x95bb31){_0x2c8fc6[_0xb088('0x45')]=_0x95bb31;if(_0x95bb31){var _0x1f98e5={'ContactId':_0x95bb31['id'],'FaxAccountId':_0x4c6171[_0xb088('0x35')]['id'],'fax':_0x95bb31['fax']};return db['FaxInteraction'][_0xb088('0x34')]({'where':{'ContactId':_0x95bb31['id'],'closed':![],'FaxAccountId':_0x4c6171['account']['id']}})[_0xb088('0x10')](function(_0x104e08){if(_0x104e08){return[_0x104e08,![]];}return db['FaxInteraction'][_0xb088('0x44')](_0x1f98e5)[_0xb088('0x10')](function(_0x41594c){return[_0x41594c,!![]];});});}else{throw new Error(_0xb088('0x46'));}})[_0xb088('0x47')](function(_0x39d0dc,_0x4f8b71){var _0x38fa5c=_0x39d0dc[_0xb088('0x3d')]({'plain':!![]});if(_0x4f8b71){if(_0x2c8fc6[_0xb088('0x35')][_0xb088('0x48')]){_0x2c8fc6[_0xb088('0x3e')][_0xb088('0x49')]({'id':0x0,'priority':_0x2c8fc6[_0xb088('0x3e')][_0xb088('0x42')]+0x1,'app':_0xb088('0x4a'),'appdata':'unmanaged','interval':_0xb088('0x4b')});}_0x38fa5c[_0xb088('0x4c')]=!![];}else{_0x38fa5c['created']=![];}_0x2c8fc6[_0xb088('0x4d')]=_0x38fa5c;return db['FaxMessage'][_0xb088('0x44')]({'body':_0x4c6171[_0xb088('0x2b')]['body'],'FaxAccountId':_0x4c6171[_0xb088('0x35')]['id'],'FaxInteractionId':_0x39d0dc['id'],'direction':'in','ContactId':_0x39d0dc[_0xb088('0x4e')],'AttachmentId':_0x4c6171[_0xb088('0x2b')][_0xb088('0x4f')]});})['then'](function(_0x119c82){_0x2c8fc6[_0xb088('0x18')]=_0x119c82;if(!_0x2c8fc6[_0xb088('0x4d')][_0xb088('0x50')])return;return db[_0xb088('0x51')][_0xb088('0x34')]({'attributes':['id',_0xb088('0x52')],'where':{'id':_0x2c8fc6[_0xb088('0x4d')][_0xb088('0x50')]}});})[_0xb088('0x10')](function(_0x5594a7){if(_0x5594a7){_0x2c8fc6[_0xb088('0x3e')][_0xb088('0x53')]({'id':0x0,'priority':0x0,'app':_0xb088('0x54'),'appdata':_0x5594a7[_0xb088('0x52')]+','+(_0x2c8fc6['account']['waitForTheAssignedAgent']||0xa),'interval':_0xb088('0x4b')});}if(!_0x2c8fc6[_0xb088('0x4d')][_0xb088('0x55')])return;return db[_0xb088('0x56')][_0xb088('0x34')]({'attributes':['id','name'],'where':{'id':_0x2c8fc6[_0xb088('0x4d')][_0xb088('0x55')]}});})['then'](function(_0x2f7458){if(_0x2f7458){_0x2c8fc6[_0xb088('0x3e')][_0xb088('0x53')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f7458[_0xb088('0x52')]+','+(_0x2c8fc6['account']['waitForTheAssignedQueue']||0x12c),'interval':_0xb088('0x4b')});}return respondWithRpcPromise('Start',_0xb088('0x57'),_0x2c8fc6);})[_0xb088('0x10')](function(_0x184b08){_0x2e344d(_0x184b08);})[_0xb088('0x21')](function(_0x4351b2){_0x3e76c7(_0x4447f2[_0xb088('0x17')](0x1f4,_0x4351b2[_0xb088('0x18')]));});});}; \ No newline at end of file +var _0x93ef=['autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','User','find','name','interaction','UserId','unshift','agent','waitForTheAssignedAgent','FaxQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','GetFaxAccount','debug','stringify','body','fax','describe','ValidationError','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','CmContact','Contacts','DESC','FaxApplication','Applications','get','applications','list','asc','length','defaults','create','contact','FaxInteraction','Contact\x20not\x20found'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x93ef,0xd8));var _0xf93e=function(_0x38f3a9,_0x67f305){_0x38f3a9=_0x38f3a9-0x0;var _0x1623e6=_0x93ef[_0x38f3a9];return _0x1623e6;};'use strict';var _=require(_0xf93e('0x0'));var util=require(_0xf93e('0x1'));var moment=require(_0xf93e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf93e('0x3'));var fs=require('fs');var Redis=require(_0xf93e('0x4'));var db=require(_0xf93e('0x5'))['db'];var utils=require(_0xf93e('0x6'));var logger=require(_0xf93e('0x7'))('rpc');var config=require(_0xf93e('0x8'));var jayson=require(_0xf93e('0x9'));var client=jayson[_0xf93e('0xa')][_0xf93e('0xb')]({'port':0x232c});config[_0xf93e('0xc')]=_['defaults'](config[_0xf93e('0xc')],{'host':_0xf93e('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf93e('0xc')]));require('./faxAccount.socket')[_0xf93e('0xe')](socket);function respondWithRpcPromise(_0x11e242,_0x333b4e,_0x459820){return new BPromise(function(_0x1b0a1f,_0x9e3b2){return client[_0xf93e('0xf')](_0x11e242,_0x459820)[_0xf93e('0x10')](function(_0xa0804a){logger[_0xf93e('0x11')](_0xf93e('0x12'),_0x333b4e,_0xf93e('0x13'));logger['debug'](_0xf93e('0x14'),_0x333b4e,'request\x20sent',JSON['stringify'](_0xa0804a));if(_0xa0804a['error']){if(_0xa0804a[_0xf93e('0x15')][_0xf93e('0x16')]===0x1f4){logger[_0xf93e('0x15')](_0xf93e('0x12'),_0x333b4e,_0xa0804a['error'][_0xf93e('0x17')]);return _0x9e3b2(_0xa0804a[_0xf93e('0x15')][_0xf93e('0x17')]);}logger[_0xf93e('0x15')]('FaxAccount,\x20%s,\x20%s',_0x333b4e,_0xa0804a['error'][_0xf93e('0x17')]);return _0x1b0a1f(_0xa0804a[_0xf93e('0x15')][_0xf93e('0x17')]);}else{logger['info'](_0xf93e('0x12'),_0x333b4e,'request\x20sent');_0x1b0a1f(_0xa0804a[_0xf93e('0x18')][_0xf93e('0x17')]);}})[_0xf93e('0x19')](function(_0x15ed6b){logger[_0xf93e('0x15')](_0xf93e('0x12'),_0x333b4e,_0x15ed6b);_0x9e3b2(_0x15ed6b);});});}exports['GetFaxAccount']=function(_0x35a93b){var _0x1a559b=this;return new Promise(function(_0x187836,_0x2acdd3){return db[_0xf93e('0x1a')][_0xf93e('0x1b')]({'raw':_0x35a93b['options']?_0x35a93b[_0xf93e('0x1c')][_0xf93e('0x1d')]===undefined?!![]:![]:!![],'where':_0x35a93b[_0xf93e('0x1c')]?_0x35a93b['options'][_0xf93e('0x1e')]||null:null,'attributes':_0x35a93b[_0xf93e('0x1c')]?_0x35a93b['options']['attributes']||null:null,'limit':_0x35a93b[_0xf93e('0x1c')]?_0x35a93b[_0xf93e('0x1c')][_0xf93e('0x1f')]||null:null,'include':_0x35a93b[_0xf93e('0x1c')]?_0x35a93b[_0xf93e('0x1c')][_0xf93e('0x20')]?_[_0xf93e('0x21')](_0x35a93b[_0xf93e('0x1c')][_0xf93e('0x20')],function(_0x56abf4){return{'model':db[_0x56abf4[_0xf93e('0x22')]],'as':_0x56abf4['as'],'attributes':_0x56abf4[_0xf93e('0x23')],'include':_0x56abf4[_0xf93e('0x20')]?_[_0xf93e('0x21')](_0x56abf4['include'],function(_0x5b75bb){return{'model':db[_0x5b75bb['model']],'as':_0x5b75bb['as'],'attributes':_0x5b75bb['attributes'],'include':_0x5b75bb[_0xf93e('0x20')]?_[_0xf93e('0x21')](_0x5b75bb['include'],function(_0x183b37){return{'model':db[_0x183b37['model']],'as':_0x183b37['as'],'attributes':_0x183b37[_0xf93e('0x23')]};}):[]};}):[]};}):[]:[]})[_0xf93e('0x10')](function(_0x32b90f){logger[_0xf93e('0x11')](_0xf93e('0x24'),_0x35a93b);logger[_0xf93e('0x25')](_0xf93e('0x24'),_0x35a93b,JSON[_0xf93e('0x26')](_0x32b90f));_0x187836(_0x32b90f);})[_0xf93e('0x19')](function(_0x2f7856){logger[_0xf93e('0x15')](_0xf93e('0x24'),_0x2f7856[_0xf93e('0x17')],_0x35a93b);_0x2acdd3(_0x1a559b[_0xf93e('0x15')](0x1f4,_0x2f7856[_0xf93e('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x5d2696,_0x2d4438,_0x136d08){var _0xe1e315=this;return new Promise(function(_0x119407,_0x5756c1){var _0x520b8f={'body':_0x5d2696[_0xf93e('0x27')],'channel':_0xf93e('0x28')};var _0x295ed0=[];var _0x3ca58b=[];var _0x4d59f8={};return db['CmContact'][_0xf93e('0x29')]()[_0xf93e('0x10')](function(_0x1e6790){if(!_0x1e6790){throw new db['Sequelize'][(_0xf93e('0x2a'))]('no\x20available\x20attributes');}_0x295ed0=_[_0xf93e('0x2b')](_[_0xf93e('0x2c')](_0x1e6790),[_0xf93e('0x2d'),_0xf93e('0x2e')]);_0x3ca58b=_[_0xf93e('0x2b')](_[_0xf93e('0x2c')](_0x1e6790),[_0xf93e('0x2d'),'updatedAt',_0xf93e('0x2f'),_0xf93e('0x30')]);if(_0x5d2696['body']['id']){delete _0x5d2696['body']['id'];}if(_['isNil'](_0x5d2696[_0xf93e('0x27')][_0xf93e('0x31')])){throw new db['Sequelize'][(_0xf93e('0x2a'))](_0xf93e('0x32'));}if(_['isNil'](_0x5d2696[_0xf93e('0x27')]['body'])||_0x5d2696[_0xf93e('0x27')][_0xf93e('0x27')]===''){throw new db[(_0xf93e('0x33'))]['ValidationError'](_0xf93e('0x34'));}if(_[_0xf93e('0x35')](_0x5d2696['body'][_0xf93e('0x36')])){throw new db[(_0xf93e('0x33'))][(_0xf93e('0x2a'))](_0xf93e('0x37')+_0x3ca58b);}if(!_[_0xf93e('0x38')](_0x3ca58b,_0x5d2696[_0xf93e('0x27')][_0xf93e('0x36')])){throw new db[(_0xf93e('0x33'))][(_0xf93e('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3ca58b);}_0x4d59f8[_0x5d2696['body'][_0xf93e('0x36')]]=_0x5d2696[_0xf93e('0x27')][_0xf93e('0x31')];})['then'](function(){return db['FaxAccount']['find']({'where':{'id':_0x5d2696[_0xf93e('0x39')]['id']},'include':[{'model':db[_0xf93e('0x3a')],'as':_0xf93e('0x3b'),'include':[{'model':db[_0xf93e('0x3c')],'as':_0xf93e('0x3d'),'where':_0x4d59f8,'limit':0x1,'order':[[_0xf93e('0x2e'),_0xf93e('0x3e')]]}]},{'model':db[_0xf93e('0x3f')],'as':_0xf93e('0x40')}]});})['then'](function(_0x3f9957){if(_0x3f9957&&_0x3f9957['List']){var _0x1e9171=_0x3f9957[_0xf93e('0x41')]({'plain':!![]});_0x520b8f['account']=_0x1e9171;_0x520b8f[_0xf93e('0x42')]=_0x1e9171[_0xf93e('0x40')];_0x520b8f[_0xf93e('0x43')]=_0x1e9171[_0xf93e('0x3b')];_0x520b8f[_0xf93e('0x42')]=_['orderBy'](_0x520b8f[_0xf93e('0x42')],['priority'],[_0xf93e('0x44')]);if(_0x520b8f[_0xf93e('0x39')][_0xf93e('0x40')]){delete _0x520b8f[_0xf93e('0x39')][_0xf93e('0x40')];}if(_0x520b8f['account']['List']&&_0x520b8f['account'][_0xf93e('0x3b')][_0xf93e('0x3d')][_0xf93e('0x45')]){return _0x520b8f[_0xf93e('0x39')][_0xf93e('0x3b')][_0xf93e('0x3d')][0x0];}var _0x5a3c01=_[_0xf93e('0x46')](_0x5d2696[_0xf93e('0x27')],{'firstName':_0x5d2696['body']['from'],'ListId':_0x1e9171[_0xf93e('0x30')]});_0x5a3c01[_0x5d2696[_0xf93e('0x27')][_0xf93e('0x36')]]=_0x5d2696[_0xf93e('0x27')][_0xf93e('0x31')];return db[_0xf93e('0x3c')][_0xf93e('0x47')](_0x5a3c01,{'fields':_0x295ed0,'raw':!![]});}})[_0xf93e('0x10')](function(_0x3def7d){_0x520b8f[_0xf93e('0x48')]=_0x3def7d;if(_0x3def7d){var _0x363aa9={'ContactId':_0x3def7d['id'],'FaxAccountId':_0x5d2696[_0xf93e('0x39')]['id'],'fax':_0x3def7d[_0xf93e('0x28')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x3def7d['id'],'closed':![],'FaxAccountId':_0x5d2696[_0xf93e('0x39')]['id']}})[_0xf93e('0x10')](function(_0x2dc18b){if(_0x2dc18b){return[_0x2dc18b,![]];}return db[_0xf93e('0x49')][_0xf93e('0x47')](_0x363aa9)['then'](function(_0x2aa4ef){return[_0x2aa4ef,!![]];});});}else{throw new Error(_0xf93e('0x4a'));}})['spread'](function(_0x171952,_0x5caf5a){var _0x49b17c=_0x171952[_0xf93e('0x41')]({'plain':!![]});if(_0x5caf5a){if(_0x520b8f[_0xf93e('0x39')][_0xf93e('0x4b')]){_0x520b8f['applications'][_0xf93e('0x4c')]({'id':0x0,'priority':_0x520b8f['applications']['length']+0x1,'app':_0xf93e('0x4d'),'appdata':_0xf93e('0x4e'),'interval':_0xf93e('0x4f')});}_0x49b17c[_0xf93e('0x50')]=!![];}else{_0x49b17c[_0xf93e('0x50')]=![];}_0x520b8f['interaction']=_0x49b17c;return db[_0xf93e('0x51')][_0xf93e('0x47')]({'body':_0x5d2696[_0xf93e('0x27')][_0xf93e('0x27')],'FaxAccountId':_0x5d2696[_0xf93e('0x39')]['id'],'FaxInteractionId':_0x171952['id'],'direction':'in','ContactId':_0x171952['ContactId'],'AttachmentId':_0x5d2696[_0xf93e('0x27')][_0xf93e('0x52')]});})[_0xf93e('0x10')](function(_0x193090){_0x520b8f['message']=_0x193090;if(!_0x520b8f['interaction']['UserId'])return;return db[_0xf93e('0x53')][_0xf93e('0x54')]({'attributes':['id',_0xf93e('0x55')],'where':{'id':_0x520b8f[_0xf93e('0x56')][_0xf93e('0x57')]}});})[_0xf93e('0x10')](function(_0x4afd19){if(_0x4afd19){_0x520b8f[_0xf93e('0x42')][_0xf93e('0x58')]({'id':0x0,'priority':0x0,'app':_0xf93e('0x59'),'appdata':_0x4afd19[_0xf93e('0x55')]+','+(_0x520b8f[_0xf93e('0x39')][_0xf93e('0x5a')]||0xa),'interval':_0xf93e('0x4f')});}if(!_0x520b8f[_0xf93e('0x56')]['queueId'])return;return db[_0xf93e('0x5b')]['find']({'attributes':['id',_0xf93e('0x55')],'where':{'id':_0x520b8f['interaction'][_0xf93e('0x5c')]}});})[_0xf93e('0x10')](function(_0xdd07c9){if(_0xdd07c9){_0x520b8f[_0xf93e('0x42')][_0xf93e('0x58')]({'id':0x0,'priority':0x1,'app':_0xf93e('0x5d'),'appdata':_0xdd07c9[_0xf93e('0x55')]+','+(_0x520b8f['account'][_0xf93e('0x5e')]||0x12c),'interval':_0xf93e('0x4f')});}return respondWithRpcPromise(_0xf93e('0x5f'),_0xf93e('0x60'),_0x520b8f);})[_0xf93e('0x10')](function(_0x5bc44f){_0x119407(_0x5bc44f);})[_0xf93e('0x19')](function(_0x1ddaf6){_0x5756c1(_0xe1e315['error'](0x1f4,_0x1ddaf6[_0xf93e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 81b4039..8b08fbc 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 _0x7d2e=['update','emit','register','length','remove'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7d2e,0x18f));var _0xe7d2=function(_0x5b4daa,_0xc385e4){_0x5b4daa=_0x5b4daa-0x0;var _0x9b569c=_0x7d2e[_0x5b4daa];return _0x9b569c;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save',_0xe7d2('0x0'),_0xe7d2('0x1')];function createListener(_0x583936,_0x59af04){return function(_0x55a7bc){_0x59af04[_0xe7d2('0x2')](_0x583936,_0x55a7bc);};}function removeListener(_0x270e87,_0x595d8e){return function(){FaxAccountEvents['removeListener'](_0x270e87,_0x595d8e);};}exports[_0xe7d2('0x3')]=function(_0x988562){for(var _0x1712be=0x0,_0x316b2f=events[_0xe7d2('0x4')];_0x1712be<_0x316b2f;_0x1712be++){var _0x581124=events[_0x1712be];var _0x247dd6=createListener('faxAccount:'+_0x581124,_0x988562);FaxAccountEvents['on'](_0x581124,_0x247dd6);}}; \ No newline at end of file +var _0x5dbc=['./faxAccount.events','save','remove','update','emit','removeListener','register','faxAccount:'];(function(_0x1cafb9,_0x170372){var _0x17b5c5=function(_0xfef7bd){while(--_0xfef7bd){_0x1cafb9['push'](_0x1cafb9['shift']());}};_0x17b5c5(++_0x170372);}(_0x5dbc,0x1a8));var _0xc5db=function(_0x171abd,_0x296d45){_0x171abd=_0x171abd-0x0;var _0x5d0468=_0x5dbc[_0x171abd];return _0x5d0468;};'use strict';var FaxAccountEvents=require(_0xc5db('0x0'));var events=[_0xc5db('0x1'),_0xc5db('0x2'),_0xc5db('0x3')];function createListener(_0x380f3d,_0x46063b){return function(_0x2f27a8){_0x46063b[_0xc5db('0x4')](_0x380f3d,_0x2f27a8);};}function removeListener(_0xe854d5,_0x228790){return function(){FaxAccountEvents[_0xc5db('0x5')](_0xe854d5,_0x228790);};}exports[_0xc5db('0x6')]=function(_0x4e10da){for(var _0x299f5a=0x0,_0x44745e=events['length'];_0x299f5a<_0x44745e;_0x299f5a++){var _0x1fa908=events[_0x299f5a];var _0x8760f4=createListener(_0xc5db('0x7')+_0x1fa908,_0x4e10da);FaxAccountEvents['on'](_0x1fa908,_0x8760f4);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 08ddb3a..f57a81b 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 _0x13a1=['/describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','create','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x2e09d1,_0x1acacb){var _0x44f898=function(_0x3db032){while(--_0x3db032){_0x2e09d1['push'](_0x2e09d1['shift']());}};_0x44f898(++_0x1acacb);}(_0x13a1,0x147));var _0x113a=function(_0x36ab2d,_0x41c81b){_0x36ab2d=_0x36ab2d-0x0;var _0x340b6f=_0x13a1[_0x36ab2d];return _0x340b6f;};'use strict';var multer=require(_0x113a('0x0'));var util=require(_0x113a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x113a('0x2'));var router=express['Router']();var fs_extra=require(_0x113a('0x3'));var auth=require(_0x113a('0x4'));var interaction=require(_0x113a('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x113a('0x6')]('/',auth[_0x113a('0x7')](),controller[_0x113a('0x8')]);router['get'](_0x113a('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x113a('0x6')](_0x113a('0xa'),auth[_0x113a('0x7')](),controller[_0x113a('0xb')]);router[_0x113a('0x6')](_0x113a('0xc'),auth['isAuthenticated'](),controller[_0x113a('0xd')]);router[_0x113a('0x6')](_0x113a('0xe'),auth['isAuthenticated'](),controller[_0x113a('0xf')]);router['get'](_0x113a('0x10'),auth[_0x113a('0x7')](),controller[_0x113a('0x11')]);router[_0x113a('0x6')](_0x113a('0x12'),auth[_0x113a('0x7')](),controller[_0x113a('0x13')]);router['get'](_0x113a('0x14'),auth[_0x113a('0x7')](),controller[_0x113a('0x15')]);router['get']('/:id/users',auth[_0x113a('0x7')](),controller[_0x113a('0x16')]);router[_0x113a('0x17')]('/',auth[_0x113a('0x7')](),controller[_0x113a('0x18')]);router['post'](_0x113a('0xc'),auth[_0x113a('0x7')](),controller['addDisposition']);router[_0x113a('0x17')](_0x113a('0xe'),auth[_0x113a('0x7')](),controller[_0x113a('0x19')]);router[_0x113a('0x17')](_0x113a('0x10'),auth[_0x113a('0x7')](),controller[_0x113a('0x1a')]);router[_0x113a('0x17')]('/:id/applications',auth['isAuthenticated'](),controller[_0x113a('0x1b')]);router[_0x113a('0x17')](_0x113a('0x1c'),auth[_0x113a('0x7')](),controller[_0x113a('0x1d')]);router[_0x113a('0x17')](_0x113a('0x1e'),auth['isAuthenticated'](),controller[_0x113a('0x1f')]);router[_0x113a('0x17')](_0x113a('0x20'),auth[_0x113a('0x7')](),controller[_0x113a('0x21')]);router['post'](_0x113a('0x22'),auth['isAuthenticated'](),controller[_0x113a('0x23')]);router['put'](_0x113a('0xa'),auth[_0x113a('0x7')](),controller[_0x113a('0x24')]);router[_0x113a('0x25')](_0x113a('0xa'),auth[_0x113a('0x7')](),controller[_0x113a('0x26')]);router[_0x113a('0x25')](_0x113a('0xc'),auth[_0x113a('0x7')](),controller[_0x113a('0x27')]);router['delete'](_0x113a('0xe'),auth[_0x113a('0x7')](),controller['removeAnswers']);router[_0x113a('0x25')](_0x113a('0x22'),auth['isAuthenticated'](),controller[_0x113a('0x28')]);module[_0x113a('0x29')]=router; \ No newline at end of file +var _0x1877=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','addDisposition','post','addInteraction','addApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x1877,0x15a));var _0x7187=function(_0x1aac60,_0x2e5ce5){_0x1aac60=_0x1aac60-0x0;var _0x186adf=_0x1877[_0x1aac60];return _0x186adf;};'use strict';var multer=require(_0x7187('0x0'));var util=require(_0x7187('0x1'));var path=require(_0x7187('0x2'));var timeout=require(_0x7187('0x3'));var express=require(_0x7187('0x4'));var router=express[_0x7187('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7187('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7187('0x7'));var controller=require('./faxAccount.controller');router[_0x7187('0x8')]('/',auth[_0x7187('0x9')](),controller[_0x7187('0xa')]);router['get'](_0x7187('0xb'),auth[_0x7187('0x9')](),controller[_0x7187('0xc')]);router[_0x7187('0x8')](_0x7187('0xd'),auth[_0x7187('0x9')](),controller['show']);router[_0x7187('0x8')](_0x7187('0xe'),auth['isAuthenticated'](),controller[_0x7187('0xf')]);router[_0x7187('0x8')](_0x7187('0x10'),auth[_0x7187('0x9')](),controller[_0x7187('0x11')]);router[_0x7187('0x8')](_0x7187('0x12'),auth[_0x7187('0x9')](),controller[_0x7187('0x13')]);router[_0x7187('0x8')](_0x7187('0x14'),auth[_0x7187('0x9')](),controller[_0x7187('0x15')]);router[_0x7187('0x8')](_0x7187('0x16'),auth[_0x7187('0x9')](),controller[_0x7187('0x17')]);router[_0x7187('0x8')](_0x7187('0x18'),auth[_0x7187('0x9')](),controller['getAgents']);router['post']('/',auth[_0x7187('0x9')](),controller['create']);router['post'](_0x7187('0xe'),auth['isAuthenticated'](),controller[_0x7187('0x19')]);router[_0x7187('0x1a')](_0x7187('0x10'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x7187('0x1a')]('/:id/interactions',auth[_0x7187('0x9')](),controller[_0x7187('0x1b')]);router[_0x7187('0x1a')](_0x7187('0x14'),auth[_0x7187('0x9')](),controller[_0x7187('0x1c')]);router[_0x7187('0x1a')]('/addaccountapplications',auth[_0x7187('0x9')](),controller['addAccountApplications']);router[_0x7187('0x1a')](_0x7187('0x1d'),auth[_0x7187('0x9')](),controller[_0x7187('0x1e')]);router[_0x7187('0x1a')](_0x7187('0x1f'),auth[_0x7187('0x9')](),controller[_0x7187('0x20')]);router[_0x7187('0x1a')](_0x7187('0x18'),auth[_0x7187('0x9')](),controller['addAgents']);router[_0x7187('0x21')](_0x7187('0xd'),auth['isAuthenticated'](),controller[_0x7187('0x22')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7187('0x23')]);router[_0x7187('0x24')]('/:id/dispositions',auth[_0x7187('0x9')](),controller[_0x7187('0x25')]);router[_0x7187('0x24')]('/:id/canned_answers',auth[_0x7187('0x9')](),controller[_0x7187('0x26')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 4f18685..5f64a9e 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 _0x10b3=['*,*,*,*','exports','TEXT','STRING'];(function(_0x3ad682,_0x3838b3){var _0x2ee709=function(_0x5ae10e){while(--_0x5ae10e){_0x3ad682['push'](_0x3ad682['shift']());}};_0x2ee709(++_0x3838b3);}(_0x10b3,0xa9));var _0x310b=function(_0x2297a8,_0x4e89bc){_0x2297a8=_0x2297a8-0x0;var _0x29e0ea=_0x10b3[_0x2297a8];return _0x29e0ea;};'use strict';var Sequelize=require('sequelize');module[_0x310b('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x310b('0x1')]()},'description':{'type':Sequelize[_0x310b('0x2')]},'interval':{'type':Sequelize[_0x310b('0x2')],'defaultValue':_0x310b('0x3')}}; \ No newline at end of file +var _0x79e1=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x195e55,_0x3af499){var _0x1af821=function(_0x337b12){while(--_0x337b12){_0x195e55['push'](_0x195e55['shift']());}};_0x1af821(++_0x3af499);}(_0x79e1,0x8e));var _0x179e=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x79e1[_0x3de8a4];return _0x4635cf;};'use strict';var Sequelize=require(_0x179e('0x0'));module[_0x179e('0x1')]={'priority':{'type':Sequelize[_0x179e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x179e('0x3')],'allowNull':![],'defaultValue':_0x179e('0x4')},'appdata':{'type':Sequelize[_0x179e('0x5')]()},'description':{'type':Sequelize[_0x179e('0x3')]},'interval':{'type':Sequelize[_0x179e('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d68cfe0..a7addb0 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 _0x4005=['set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','FaxApplication','count','includeAll','include','findAll','params','rawAttributes','length','options','catch','create','body','find','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x5628d5,_0x390bbe){var _0x5c8a2e=function(_0x84386){while(--_0x84386){_0x5628d5['push'](_0x5628d5['shift']());}};_0x5c8a2e(++_0x390bbe);}(_0x4005,0xb6));var _0x5400=function(_0x538401,_0x82d2ac){_0x538401=_0x538401-0x0;var _0x5c796c=_0x4005[_0x538401];return _0x5c796c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5400('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5400('0x1'));var rp=require(_0x5400('0x2'));var moment=require(_0x5400('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5400('0x4'));var path=require(_0x5400('0x5'));var sox=require('sox');var csv=require(_0x5400('0x6'));var ejs=require(_0x5400('0x7'));var fs=require('fs');var fs_extra=require(_0x5400('0x8'));var _=require('lodash');var squel=require(_0x5400('0x9'));var crypto=require(_0x5400('0xa'));var jsforce=require(_0x5400('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5400('0xc'));var Papa=require(_0x5400('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5400('0xe'));var as=require(_0x5400('0xf'));var hardwareService=require(_0x5400('0x10'));var logger=require(_0x5400('0x11'))(_0x5400('0x12'));var utils=require(_0x5400('0x13'));var config=require(_0x5400('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52670e,_0x3450ce){_0x3450ce=_0x3450ce||0xcc;return function(_0x51d179){if(_0x51d179){return _0x52670e[_0x5400('0x15')](_0x3450ce);}return _0x52670e[_0x5400('0x16')](_0x3450ce)[_0x5400('0x17')]();};}function respondWithResult(_0x10df6c,_0x5b8396){_0x5b8396=_0x5b8396||0xc8;return function(_0x262b2d){if(_0x262b2d){return _0x10df6c[_0x5400('0x16')](_0x5b8396)[_0x5400('0x18')](_0x262b2d);}};}function respondWithFilteredResult(_0x15581a,_0x12ee64){return function(_0x6df825){if(_0x6df825){var _0x20fdc1=typeof _0x12ee64[_0x5400('0x19')]===_0x5400('0x1a')&&typeof _0x12ee64[_0x5400('0x1b')]===_0x5400('0x1a');var _0x216084=_0x6df825['count'];var _0x55b34e=_0x20fdc1?0x0:_0x12ee64[_0x5400('0x19')];var _0x38d764=_0x20fdc1?_0x6df825['count']:_0x12ee64[_0x5400('0x19')]+_0x12ee64[_0x5400('0x1b')];var _0x3a3d59;if(_0x38d764>=_0x216084){_0x38d764=_0x216084;_0x3a3d59=0xc8;}else{_0x3a3d59=0xce;}_0x15581a[_0x5400('0x16')](_0x3a3d59);return _0x15581a[_0x5400('0x1c')](_0x5400('0x1d'),_0x55b34e+'-'+_0x38d764+'/'+_0x216084)[_0x5400('0x18')](_0x6df825);}return null;};}function patchUpdates(_0x4f190b){return function(_0x319c45){try{jsonpatch[_0x5400('0x1e')](_0x319c45,_0x4f190b,!![]);}catch(_0x13f485){return BPromise[_0x5400('0x1f')](_0x13f485);}return _0x319c45['save']();};}function saveUpdates(_0x4c997a,_0x4c8c69){return function(_0x4e1e24){if(_0x4e1e24){return _0x4e1e24[_0x5400('0x20')](_0x4c997a)[_0x5400('0x21')](function(_0x2adf97){return _0x2adf97;});}return null;};}function removeEntity(_0x557640,_0x48adcb){return function(_0x3dde63){if(_0x3dde63){return _0x3dde63[_0x5400('0x22')]()[_0x5400('0x21')](function(){_0x557640[_0x5400('0x16')](0xcc)[_0x5400('0x17')]();});}};}function handleEntityNotFound(_0x235bc7,_0x3689e5){return function(_0x25122e){if(!_0x25122e){_0x235bc7[_0x5400('0x15')](0x194);}return _0x25122e;};}function handleError(_0x825c63,_0x29076b){_0x29076b=_0x29076b||0x1f4;return function(_0x472826){logger[_0x5400('0x23')](_0x472826[_0x5400('0x24')]);if(_0x472826[_0x5400('0x25')]){delete _0x472826['name'];}_0x825c63[_0x5400('0x16')](_0x29076b)[_0x5400('0x26')](_0x472826);};}exports[_0x5400('0x27')]=function(_0x451f97,_0x1d97c9){var _0x449732={},_0x3fbeaa={},_0x37d35a={'count':0x0,'rows':[]};var _0x37e757=_[_0x5400('0x28')](db['FaxApplication']['rawAttributes'],function(_0x622072){return{'name':_0x622072[_0x5400('0x29')],'type':_0x622072[_0x5400('0x2a')]['key']};});_0x3fbeaa[_0x5400('0x2b')]=_[_0x5400('0x28')](_0x37e757,'name');_0x3fbeaa[_0x5400('0x2c')]=_['keys'](_0x451f97[_0x5400('0x2c')]);_0x3fbeaa[_0x5400('0x2d')]=_['intersection'](_0x3fbeaa[_0x5400('0x2b')],_0x3fbeaa['query']);_0x449732['attributes']=_[_0x5400('0x2e')](_0x3fbeaa[_0x5400('0x2b')],qs[_0x5400('0x2f')](_0x451f97['query']['fields']));_0x449732[_0x5400('0x30')]=_0x449732[_0x5400('0x30')]['length']?_0x449732['attributes']:_0x3fbeaa['model'];if(!_0x451f97[_0x5400('0x2c')][_0x5400('0x31')](_0x5400('0x32'))){_0x449732['limit']=qs[_0x5400('0x1b')](_0x451f97[_0x5400('0x2c')][_0x5400('0x1b')]);_0x449732[_0x5400('0x19')]=qs[_0x5400('0x19')](_0x451f97[_0x5400('0x2c')]['offset']);}_0x449732['order']=qs['sort'](_0x451f97['query'][_0x5400('0x33')]);_0x449732[_0x5400('0x34')]=qs['filters'](_[_0x5400('0x35')](_0x451f97[_0x5400('0x2c')],_0x3fbeaa[_0x5400('0x2d')]),_0x37e757);if(_0x451f97[_0x5400('0x2c')][_0x5400('0x36')]){_0x449732[_0x5400('0x34')]=_[_0x5400('0x37')](_0x449732[_0x5400('0x34')],{'$or':_[_0x5400('0x28')](_0x37e757,function(_0x47eb40){if(_0x47eb40['type']!==_0x5400('0x38')){var _0x562fb3={};_0x562fb3[_0x47eb40[_0x5400('0x25')]]={'$like':'%'+_0x451f97[_0x5400('0x2c')]['filter']+'%'};return _0x562fb3;}})});}_0x449732=_['merge']({},_0x449732,_0x451f97['options']);var _0x20c2fe={'where':_0x449732[_0x5400('0x34')]};return db[_0x5400('0x39')][_0x5400('0x3a')](_0x20c2fe)['then'](function(_0x3c5f5f){_0x37d35a[_0x5400('0x3a')]=_0x3c5f5f;if(_0x451f97[_0x5400('0x2c')][_0x5400('0x3b')]){_0x449732[_0x5400('0x3c')]=[{'all':!![]}];}return db['FaxApplication'][_0x5400('0x3d')](_0x449732);})[_0x5400('0x21')](function(_0x2ab639){_0x37d35a['rows']=_0x2ab639;return _0x37d35a;})[_0x5400('0x21')](respondWithFilteredResult(_0x1d97c9,_0x449732))['catch'](handleError(_0x1d97c9,null));};exports['show']=function(_0x227a12,_0x322068){var _0x2995ab={'raw':!![],'where':{'id':_0x227a12[_0x5400('0x3e')]['id']}},_0x54bd4b={};_0x54bd4b[_0x5400('0x2b')]=_['keys'](db[_0x5400('0x39')][_0x5400('0x3f')]);_0x54bd4b['query']=_['keys'](_0x227a12[_0x5400('0x2c')]);_0x54bd4b[_0x5400('0x2d')]=_[_0x5400('0x2e')](_0x54bd4b[_0x5400('0x2b')],_0x54bd4b[_0x5400('0x2c')]);_0x2995ab[_0x5400('0x30')]=_[_0x5400('0x2e')](_0x54bd4b[_0x5400('0x2b')],qs['fields'](_0x227a12['query'][_0x5400('0x2f')]));_0x2995ab[_0x5400('0x30')]=_0x2995ab['attributes'][_0x5400('0x40')]?_0x2995ab['attributes']:_0x54bd4b[_0x5400('0x2b')];if(_0x227a12['query'][_0x5400('0x3b')]){_0x2995ab['include']=[{'all':!![]}];}_0x2995ab=_['merge']({},_0x2995ab,_0x227a12[_0x5400('0x41')]);return db[_0x5400('0x39')]['find'](_0x2995ab)[_0x5400('0x21')](handleEntityNotFound(_0x322068,null))[_0x5400('0x21')](respondWithResult(_0x322068,null))[_0x5400('0x42')](handleError(_0x322068,null));};exports['create']=function(_0x4687c2,_0x84e2ca){return db[_0x5400('0x39')][_0x5400('0x43')](_0x4687c2[_0x5400('0x44')],{})[_0x5400('0x21')](respondWithResult(_0x84e2ca,0xc9))[_0x5400('0x42')](handleError(_0x84e2ca,null));};exports['update']=function(_0x19d0e7,_0x3ee3cd){if(_0x19d0e7[_0x5400('0x44')]['id']){delete _0x19d0e7[_0x5400('0x44')]['id'];}return db[_0x5400('0x39')]['find']({'where':{'id':_0x19d0e7[_0x5400('0x3e')]['id']}})['then'](handleEntityNotFound(_0x3ee3cd,null))[_0x5400('0x21')](saveUpdates(_0x19d0e7[_0x5400('0x44')],null))[_0x5400('0x21')](respondWithResult(_0x3ee3cd,null))['catch'](handleError(_0x3ee3cd,null));};exports['destroy']=function(_0x2b2455,_0x4da3be){return db['FaxApplication'][_0x5400('0x45')]({'where':{'id':_0x2b2455['params']['id']}})[_0x5400('0x21')](handleEntityNotFound(_0x4da3be,null))['then'](removeEntity(_0x4da3be,null))[_0x5400('0x42')](handleError(_0x4da3be,null));}; \ No newline at end of file +var _0x26e1=['FaxApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','map'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0x26e1,0x6c));var _0x126e=function(_0x248f0f,_0x4e066b){_0x248f0f=_0x248f0f-0x0;var _0x2a233c=_0x26e1[_0x248f0f];return _0x2a233c;};'use strict';var emlformat=require(_0x126e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x126e('0x1'));var jsonpatch=require(_0x126e('0x2'));var rp=require(_0x126e('0x3'));var moment=require(_0x126e('0x4'));var BPromise=require(_0x126e('0x5'));var Mustache=require(_0x126e('0x6'));var util=require(_0x126e('0x7'));var path=require(_0x126e('0x8'));var sox=require('sox');var csv=require(_0x126e('0x9'));var ejs=require(_0x126e('0xa'));var fs=require('fs');var fs_extra=require(_0x126e('0xb'));var _=require(_0x126e('0xc'));var squel=require('squel');var crypto=require(_0x126e('0xd'));var jsforce=require(_0x126e('0xe'));var deskjs=require(_0x126e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x126e('0x10'));var Papa=require(_0x126e('0x11'));var Redis=require(_0x126e('0x12'));var authService=require(_0x126e('0x13'));var qs=require(_0x126e('0x14'));var as=require(_0x126e('0x15'));var hardwareService=require(_0x126e('0x16'));var logger=require('../../config/logger')(_0x126e('0x17'));var utils=require(_0x126e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x126e('0x19'));var db=require(_0x126e('0x1a'))['db'];function respondWithStatusCode(_0xc5923f,_0x4852fa){_0x4852fa=_0x4852fa||0xcc;return function(_0x1d4f01){if(_0x1d4f01){return _0xc5923f[_0x126e('0x1b')](_0x4852fa);}return _0xc5923f[_0x126e('0x1c')](_0x4852fa)[_0x126e('0x1d')]();};}function respondWithResult(_0x2a237d,_0x2a795d){_0x2a795d=_0x2a795d||0xc8;return function(_0x8522b4){if(_0x8522b4){return _0x2a237d[_0x126e('0x1c')](_0x2a795d)[_0x126e('0x1e')](_0x8522b4);}};}function respondWithFilteredResult(_0x5bbf9b,_0x35ff62){return function(_0x1da8a7){if(_0x1da8a7){var _0x2115fe=typeof _0x35ff62['offset']===_0x126e('0x1f')&&typeof _0x35ff62['limit']===_0x126e('0x1f');var _0x1f9424=_0x1da8a7[_0x126e('0x20')];var _0x17c9b3=_0x2115fe?0x0:_0x35ff62[_0x126e('0x21')];var _0x2b72f9=_0x2115fe?_0x1da8a7[_0x126e('0x20')]:_0x35ff62[_0x126e('0x21')]+_0x35ff62[_0x126e('0x22')];var _0x44a3fa;if(_0x2b72f9>=_0x1f9424){_0x2b72f9=_0x1f9424;_0x44a3fa=0xc8;}else{_0x44a3fa=0xce;}_0x5bbf9b['status'](_0x44a3fa);return _0x5bbf9b[_0x126e('0x23')]('Content-Range',_0x17c9b3+'-'+_0x2b72f9+'/'+_0x1f9424)[_0x126e('0x1e')](_0x1da8a7);}return null;};}function patchUpdates(_0x536c63){return function(_0x410b18){try{jsonpatch[_0x126e('0x24')](_0x410b18,_0x536c63,!![]);}catch(_0x594587){return BPromise[_0x126e('0x25')](_0x594587);}return _0x410b18[_0x126e('0x26')]();};}function saveUpdates(_0x1e99ee,_0x247656){return function(_0x5ba4c1){if(_0x5ba4c1){return _0x5ba4c1[_0x126e('0x27')](_0x1e99ee)[_0x126e('0x28')](function(_0x15e946){return _0x15e946;});}return null;};}function removeEntity(_0x51c87b,_0x1519c8){return function(_0x706391){if(_0x706391){return _0x706391[_0x126e('0x29')]()[_0x126e('0x28')](function(){_0x51c87b[_0x126e('0x1c')](0xcc)[_0x126e('0x1d')]();});}};}function handleEntityNotFound(_0x3bb524,_0x497309){return function(_0x1afb1a){if(!_0x1afb1a){_0x3bb524[_0x126e('0x1b')](0x194);}return _0x1afb1a;};}function handleError(_0x4c0457,_0x458a7c){_0x458a7c=_0x458a7c||0x1f4;return function(_0x555969){logger[_0x126e('0x2a')](_0x555969['stack']);if(_0x555969[_0x126e('0x2b')]){delete _0x555969[_0x126e('0x2b')];}_0x4c0457[_0x126e('0x1c')](_0x458a7c)[_0x126e('0x2c')](_0x555969);};}exports['index']=function(_0x2e2429,_0x15175e){var _0x185e93={},_0x298506={},_0x4bb790={'count':0x0,'rows':[]};var _0x293188=_[_0x126e('0x2d')](db[_0x126e('0x2e')]['rawAttributes'],function(_0x3667e1){return{'name':_0x3667e1[_0x126e('0x2f')],'type':_0x3667e1[_0x126e('0x30')][_0x126e('0x31')]};});_0x298506[_0x126e('0x32')]=_[_0x126e('0x2d')](_0x293188,_0x126e('0x2b'));_0x298506[_0x126e('0x33')]=_[_0x126e('0x34')](_0x2e2429['query']);_0x298506[_0x126e('0x35')]=_[_0x126e('0x36')](_0x298506[_0x126e('0x32')],_0x298506[_0x126e('0x33')]);_0x185e93[_0x126e('0x37')]=_[_0x126e('0x36')](_0x298506['model'],qs[_0x126e('0x38')](_0x2e2429['query'][_0x126e('0x38')]));_0x185e93[_0x126e('0x37')]=_0x185e93[_0x126e('0x37')][_0x126e('0x39')]?_0x185e93[_0x126e('0x37')]:_0x298506[_0x126e('0x32')];if(!_0x2e2429['query'][_0x126e('0x3a')](_0x126e('0x3b'))){_0x185e93['limit']=qs[_0x126e('0x22')](_0x2e2429[_0x126e('0x33')][_0x126e('0x22')]);_0x185e93[_0x126e('0x21')]=qs['offset'](_0x2e2429[_0x126e('0x33')][_0x126e('0x21')]);}_0x185e93[_0x126e('0x3c')]=qs[_0x126e('0x3d')](_0x2e2429['query'][_0x126e('0x3d')]);_0x185e93['where']=qs[_0x126e('0x35')](_[_0x126e('0x3e')](_0x2e2429['query'],_0x298506[_0x126e('0x35')]),_0x293188);if(_0x2e2429[_0x126e('0x33')][_0x126e('0x3f')]){_0x185e93[_0x126e('0x40')]=_[_0x126e('0x41')](_0x185e93['where'],{'$or':_['map'](_0x293188,function(_0x119aa0){if(_0x119aa0[_0x126e('0x30')]!==_0x126e('0x42')){var _0x4f26ac={};_0x4f26ac[_0x119aa0[_0x126e('0x2b')]]={'$like':'%'+_0x2e2429[_0x126e('0x33')][_0x126e('0x3f')]+'%'};return _0x4f26ac;}})});}_0x185e93=_[_0x126e('0x41')]({},_0x185e93,_0x2e2429[_0x126e('0x43')]);var _0x26846f={'where':_0x185e93[_0x126e('0x40')]};return db[_0x126e('0x2e')][_0x126e('0x20')](_0x26846f)[_0x126e('0x28')](function(_0x59e652){_0x4bb790[_0x126e('0x20')]=_0x59e652;if(_0x2e2429[_0x126e('0x33')][_0x126e('0x44')]){_0x185e93[_0x126e('0x45')]=[{'all':!![]}];}return db[_0x126e('0x2e')][_0x126e('0x46')](_0x185e93);})['then'](function(_0x1eb677){_0x4bb790[_0x126e('0x47')]=_0x1eb677;return _0x4bb790;})[_0x126e('0x28')](respondWithFilteredResult(_0x15175e,_0x185e93))[_0x126e('0x48')](handleError(_0x15175e,null));};exports[_0x126e('0x49')]=function(_0x411024,_0x412adf){var _0x235e63={'raw':!![],'where':{'id':_0x411024['params']['id']}},_0x4bdd59={};_0x4bdd59['model']=_['keys'](db[_0x126e('0x2e')]['rawAttributes']);_0x4bdd59['query']=_[_0x126e('0x34')](_0x411024['query']);_0x4bdd59['filters']=_[_0x126e('0x36')](_0x4bdd59[_0x126e('0x32')],_0x4bdd59[_0x126e('0x33')]);_0x235e63['attributes']=_['intersection'](_0x4bdd59[_0x126e('0x32')],qs[_0x126e('0x38')](_0x411024['query'][_0x126e('0x38')]));_0x235e63['attributes']=_0x235e63['attributes'][_0x126e('0x39')]?_0x235e63['attributes']:_0x4bdd59[_0x126e('0x32')];if(_0x411024[_0x126e('0x33')]['includeAll']){_0x235e63['include']=[{'all':!![]}];}_0x235e63=_['merge']({},_0x235e63,_0x411024[_0x126e('0x43')]);return db[_0x126e('0x2e')][_0x126e('0x4a')](_0x235e63)[_0x126e('0x28')](handleEntityNotFound(_0x412adf,null))[_0x126e('0x28')](respondWithResult(_0x412adf,null))[_0x126e('0x48')](handleError(_0x412adf,null));};exports['create']=function(_0x416ac7,_0x4871e6){return db[_0x126e('0x2e')]['create'](_0x416ac7[_0x126e('0x4b')],{})[_0x126e('0x28')](respondWithResult(_0x4871e6,0xc9))[_0x126e('0x48')](handleError(_0x4871e6,null));};exports[_0x126e('0x27')]=function(_0x530bca,_0x5be207){if(_0x530bca[_0x126e('0x4b')]['id']){delete _0x530bca[_0x126e('0x4b')]['id'];}return db[_0x126e('0x2e')][_0x126e('0x4a')]({'where':{'id':_0x530bca['params']['id']}})['then'](handleEntityNotFound(_0x5be207,null))[_0x126e('0x28')](saveUpdates(_0x530bca[_0x126e('0x4b')],null))['then'](respondWithResult(_0x5be207,null))['catch'](handleError(_0x5be207,null));};exports[_0x126e('0x29')]=function(_0x5a10b5,_0x427283){return db[_0x126e('0x2e')][_0x126e('0x4a')]({'where':{'id':_0x5a10b5[_0x126e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x427283,null))[_0x126e('0x28')](removeEntity(_0x427283,null))['catch'](handleError(_0x427283,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f063e00..7efc9ba 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 _0x87e2=['rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise'];(function(_0x5e5f5a,_0x5cb19a){var _0x4141ae=function(_0x4bb2ea){while(--_0x4bb2ea){_0x5e5f5a['push'](_0x5e5f5a['shift']());}};_0x4141ae(++_0x5cb19a);}(_0x87e2,0x10c));var _0x287e=function(_0x57097c,_0x1d6e52){_0x57097c=_0x57097c-0x0;var _0x1d3061=_0x87e2[_0x57097c];return _0x1d3061;};'use strict';var _=require(_0x287e('0x0'));var util=require(_0x287e('0x1'));var logger=require('../../config/logger')(_0x287e('0x2'));var moment=require(_0x287e('0x3'));var BPromise=require('bluebird');var rp=require(_0x287e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x287e('0x5'));var config=require(_0x287e('0x6'));var attributes=require(_0x287e('0x7'));module[_0x287e('0x8')]=function(_0x44d0c8,_0x4eddef){return _0x44d0c8[_0x287e('0x9')]('FaxApplication',attributes,{'tableName':_0x287e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x287e('0xb'),'collate':_0x287e('0xc')});}; \ No newline at end of file +var _0x1ef3=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment'];(function(_0x107179,_0x46e138){var _0x31f40e=function(_0x5973c1){while(--_0x5973c1){_0x107179['push'](_0x107179['shift']());}};_0x31f40e(++_0x46e138);}(_0x1ef3,0x1dc));var _0x31ef=function(_0x61a8ce,_0x5933b7){_0x61a8ce=_0x61a8ce-0x0;var _0xde60d1=_0x1ef3[_0x61a8ce];return _0xde60d1;};'use strict';var _=require(_0x31ef('0x0'));var util=require(_0x31ef('0x1'));var logger=require(_0x31ef('0x2'))('api');var moment=require(_0x31ef('0x3'));var BPromise=require(_0x31ef('0x4'));var rp=require(_0x31ef('0x5'));var fs=require('fs');var path=require(_0x31ef('0x6'));var rimraf=require(_0x31ef('0x7'));var config=require(_0x31ef('0x8'));var attributes=require(_0x31ef('0x9'));module[_0x31ef('0xa')]=function(_0x427710,_0x2e46fa){return _0x427710[_0x31ef('0xb')]('FaxApplication',attributes,{'tableName':_0x31ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x31ef('0xd'),'collate':_0x31ef('0xe')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index a33a8d6..eace88f 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 _0xc60e=['FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','then','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info'];(function(_0x2f8dbc,_0x3bac71){var _0x4b1126=function(_0x1ebe3b){while(--_0x1ebe3b){_0x2f8dbc['push'](_0x2f8dbc['shift']());}};_0x4b1126(++_0x3bac71);}(_0xc60e,0x153));var _0xec60=function(_0xc67a77,_0x5c66d6){_0xc67a77=_0xc67a77-0x0;var _0x3d5849=_0xc60e[_0xc67a77];return _0x3d5849;};'use strict';var _=require(_0xec60('0x0'));var util=require(_0xec60('0x1'));var moment=require('moment');var BPromise=require(_0xec60('0x2'));var rs=require(_0xec60('0x3'));var fs=require('fs');var Redis=require(_0xec60('0x4'));var db=require(_0xec60('0x5'))['db'];var utils=require(_0xec60('0x6'));var logger=require(_0xec60('0x7'))(_0xec60('0x8'));var config=require('../../config/environment');var jayson=require(_0xec60('0x9'));var client=jayson['client'][_0xec60('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4043e5,_0xd2a309,_0x4e57ff){return new BPromise(function(_0x58ef09,_0x839997){return client[_0xec60('0xb')](_0x4043e5,_0x4e57ff)['then'](function(_0x540fd2){logger[_0xec60('0xc')](_0xec60('0xd'),_0xd2a309,_0xec60('0xe'));logger[_0xec60('0xf')](_0xec60('0x10'),_0xd2a309,'request\x20sent',JSON['stringify'](_0x540fd2));if(_0x540fd2['error']){if(_0x540fd2[_0xec60('0x11')][_0xec60('0x12')]===0x1f4){logger[_0xec60('0x11')](_0xec60('0xd'),_0xd2a309,_0x540fd2[_0xec60('0x11')][_0xec60('0x13')]);return _0x839997(_0x540fd2[_0xec60('0x11')][_0xec60('0x13')]);}logger[_0xec60('0x11')](_0xec60('0xd'),_0xd2a309,_0x540fd2[_0xec60('0x11')][_0xec60('0x13')]);return _0x58ef09(_0x540fd2['error'][_0xec60('0x13')]);}else{logger[_0xec60('0xc')](_0xec60('0xd'),_0xd2a309,'request\x20sent');_0x58ef09(_0x540fd2[_0xec60('0x14')][_0xec60('0x13')]);}})[_0xec60('0x15')](function(_0x145579){logger[_0xec60('0x11')](_0xec60('0xd'),_0xd2a309,_0x145579);_0x839997(_0x145579);});});}exports[_0xec60('0x16')]=function(_0x17c052){var _0x231840=this;return new Promise(function(_0x347ebb,_0x31c70a){return db[_0xec60('0x17')]['update'](_0x17c052[_0xec60('0x18')],{'raw':_0x17c052[_0xec60('0x19')]?_0x17c052[_0xec60('0x19')][_0xec60('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x17c052[_0xec60('0x19')]?_0x17c052[_0xec60('0x19')][_0xec60('0x1b')]||null:null,'attributes':_0x17c052[_0xec60('0x19')]?_0x17c052[_0xec60('0x19')][_0xec60('0x1c')]||null:null,'limit':_0x17c052['options']?_0x17c052['options'][_0xec60('0x1d')]||null:null})[_0xec60('0x1e')](function(_0x5298af){logger[_0xec60('0xc')]('UpdateFaxApplication',_0x17c052);logger[_0xec60('0xf')]('UpdateFaxApplication',_0x17c052,JSON[_0xec60('0x1f')](_0x5298af));_0x347ebb(_0x5298af);})[_0xec60('0x15')](function(_0x32492c){logger[_0xec60('0x11')](_0xec60('0x16'),_0x32492c[_0xec60('0x13')],_0x17c052);_0x31c70a(_0x231840[_0xec60('0x11')](0x1f4,_0x32492c[_0xec60('0x13')]));});});}; \ No newline at end of file +var _0x75d2=['where','attributes','limit','then','UpdateFaxApplication','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FaxApplication','update','body','options'];(function(_0x52d20d,_0x254120){var _0x51f71e=function(_0x23b887){while(--_0x23b887){_0x52d20d['push'](_0x52d20d['shift']());}};_0x51f71e(++_0x254120);}(_0x75d2,0xd8));var _0x275d=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x75d2[_0x55ff79];return _0x579067;};'use strict';var _=require(_0x275d('0x0'));var util=require(_0x275d('0x1'));var moment=require(_0x275d('0x2'));var BPromise=require(_0x275d('0x3'));var rs=require(_0x275d('0x4'));var fs=require('fs');var Redis=require(_0x275d('0x5'));var db=require(_0x275d('0x6'))['db'];var utils=require(_0x275d('0x7'));var logger=require(_0x275d('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x275d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d550,_0x195121,_0x2b813b){return new BPromise(function(_0x21fb88,_0x46417e){return client['request'](_0x13d550,_0x2b813b)['then'](function(_0xb8a843){logger[_0x275d('0xa')](_0x275d('0xb'),_0x195121,_0x275d('0xc'));logger[_0x275d('0xd')](_0x275d('0xe'),_0x195121,_0x275d('0xc'),JSON['stringify'](_0xb8a843));if(_0xb8a843['error']){if(_0xb8a843[_0x275d('0xf')][_0x275d('0x10')]===0x1f4){logger[_0x275d('0xf')](_0x275d('0xb'),_0x195121,_0xb8a843[_0x275d('0xf')][_0x275d('0x11')]);return _0x46417e(_0xb8a843[_0x275d('0xf')][_0x275d('0x11')]);}logger[_0x275d('0xf')](_0x275d('0xb'),_0x195121,_0xb8a843[_0x275d('0xf')][_0x275d('0x11')]);return _0x21fb88(_0xb8a843[_0x275d('0xf')][_0x275d('0x11')]);}else{logger[_0x275d('0xa')]('FaxApplication,\x20%s,\x20%s',_0x195121,_0x275d('0xc'));_0x21fb88(_0xb8a843[_0x275d('0x12')][_0x275d('0x11')]);}})[_0x275d('0x13')](function(_0x2a1679){logger[_0x275d('0xf')]('FaxApplication,\x20%s,\x20%s',_0x195121,_0x2a1679);_0x46417e(_0x2a1679);});});}exports['UpdateFaxApplication']=function(_0x50cda0){var _0x15e012=this;return new Promise(function(_0x133d2f,_0x56d9b8){return db[_0x275d('0x14')][_0x275d('0x15')](_0x50cda0[_0x275d('0x16')],{'raw':_0x50cda0[_0x275d('0x17')]?_0x50cda0['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50cda0[_0x275d('0x17')]?_0x50cda0['options'][_0x275d('0x18')]||null:null,'attributes':_0x50cda0[_0x275d('0x17')]?_0x50cda0['options'][_0x275d('0x19')]||null:null,'limit':_0x50cda0[_0x275d('0x17')]?_0x50cda0['options'][_0x275d('0x1a')]||null:null})[_0x275d('0x1b')](function(_0x270450){logger[_0x275d('0xa')](_0x275d('0x1c'),_0x50cda0);logger[_0x275d('0xd')]('UpdateFaxApplication',_0x50cda0,JSON[_0x275d('0x1d')](_0x270450));_0x133d2f(_0x270450);})['catch'](function(_0x529c56){logger[_0x275d('0xf')]('UpdateFaxApplication',_0x529c56[_0x275d('0x11')],_0x50cda0);_0x56d9b8(_0x15e012[_0x275d('0xf')](0x1f4,_0x529c56[_0x275d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index bea60d0..a8e6145 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 _0xe605=['../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x29e767,_0x4945e7){var _0x1543ec=function(_0xf84907){while(--_0xf84907){_0x29e767['push'](_0x29e767['shift']());}};_0x1543ec(++_0x4945e7);}(_0xe605,0x92));var _0x5e60=function(_0x2a7fbc,_0x14c1b4){_0x2a7fbc=_0x2a7fbc-0x0;var _0x3dfe57=_0xe605[_0x2a7fbc];return _0x3dfe57;};'use strict';var multer=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var path=require('path');var timeout=require(_0x5e60('0x2'));var express=require(_0x5e60('0x3'));var router=express[_0x5e60('0x4')]();var fs_extra=require(_0x5e60('0x5'));var auth=require(_0x5e60('0x6'));var interaction=require(_0x5e60('0x7'));var config=require(_0x5e60('0x8'));var controller=require(_0x5e60('0x9'));router[_0x5e60('0xa')]('/',auth[_0x5e60('0xb')](),controller[_0x5e60('0xc')]);router[_0x5e60('0xa')]('/:id',auth[_0x5e60('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x5e60('0xd')]);router[_0x5e60('0xe')](_0x5e60('0xf'),auth[_0x5e60('0xb')](),controller[_0x5e60('0x10')]);router[_0x5e60('0x11')]('/:id',auth[_0x5e60('0xb')](),controller['destroy']);module[_0x5e60('0x12')]=router; \ No newline at end of file +var _0xe511=['/:id','isAuthenticated','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','index','show','post','put'];(function(_0x3cacdf,_0x53422a){var _0x16f60d=function(_0x5dddcf){while(--_0x5dddcf){_0x3cacdf['push'](_0x3cacdf['shift']());}};_0x16f60d(++_0x53422a);}(_0xe511,0x16f));var _0x1e51=function(_0x345de7,_0x1de531){_0x345de7=_0x345de7-0x0;var _0x26ffc7=_0xe511[_0x345de7];return _0x26ffc7;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1e51('0xc')](_0x1e51('0xd'),auth[_0x1e51('0xe')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')](_0x1e51('0xd'),auth['isAuthenticated'](),controller[_0x1e51('0x11')]);module[_0x1e51('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 2303680..8934977 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 _0xcf2f=['exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x26defd,_0x1f54bd){var _0x42d085=function(_0x4e5ae3){while(--_0x4e5ae3){_0x26defd['push'](_0x26defd['shift']());}};_0x42d085(++_0x1f54bd);}(_0xcf2f,0xa7));var _0xfcf2=function(_0x133a7f,_0x3c85fb){_0x133a7f=_0x133a7f-0x0;var _0x2338a9=_0xcf2f[_0x133a7f];return _0x2338a9;};'use strict';var Sequelize=require(_0xfcf2('0x0'));module[_0xfcf2('0x1')]={'closed':{'type':Sequelize[_0xfcf2('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfcf2('0x3')]},'disposition':{'type':Sequelize[_0xfcf2('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xfcf2('0x4')]},'note':{'type':Sequelize[_0xfcf2('0x4')]},'read1stAt':{'type':Sequelize[_0xfcf2('0x3')]},'fax':{'type':Sequelize[_0xfcf2('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xfcf2('0x5')]('in',_0xfcf2('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfcf2('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xfcf2('0x5')]('in',_0xfcf2('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xfcf2('0x7')]}}; \ No newline at end of file +var _0xd117=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0x13843f,_0x50422d){var _0x1063ae=function(_0x12fd6b){while(--_0x12fd6b){_0x13843f['push'](_0x13843f['shift']());}};_0x1063ae(++_0x50422d);}(_0xd117,0x182));var _0x7d11=function(_0x5cc8b9,_0x20e3c3){_0x5cc8b9=_0x5cc8b9-0x0;var _0x58892e=_0xd117[_0x5cc8b9];return _0x58892e;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'closed':{'type':Sequelize[_0x7d11('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7d11('0x3')]},'disposition':{'type':Sequelize[_0x7d11('0x4')]},'secondDisposition':{'type':Sequelize[_0x7d11('0x4')]},'thirdDisposition':{'type':Sequelize[_0x7d11('0x4')]},'note':{'type':Sequelize[_0x7d11('0x4')]},'read1stAt':{'type':Sequelize[_0x7d11('0x3')]},'fax':{'type':Sequelize[_0x7d11('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7d11('0x5')]('in',_0x7d11('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x7d11('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x7d11('0x5')]('in',_0x7d11('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x7d11('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 2290bb8..cc758d5 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 _0xeeeb=['catch','show','params','model','keys','rawAttributes','filters','attributes','fields','length','include','options','find','body','FaxMessage','ids','omit','findOne','intersection','hasOwnProperty','nolimit','limit','order','sort','pick','where','FaxInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','addTags','setTags','spread','Tag','color','emit','removeTags','unix','toString','root','server','files','tmp','attachments','join','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','download','err','unlinkSync','sendStatus','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','FaxInteraction','type','getOptions','findAll','fax','query'];(function(_0x4961d8,_0x3070dd){var _0x45a793=function(_0xb320df){while(--_0xb320df){_0x4961d8['push'](_0x4961d8['shift']());}};_0x45a793(++_0x3070dd);}(_0xeeeb,0xa9));var _0xbeee=function(_0x34effd,_0x1906f9){_0x34effd=_0x34effd-0x0;var _0x4571b0=_0xeeeb[_0x34effd];return _0x4571b0;};'use strict';var rimraf=require(_0xbeee('0x0'));var zipdir=require(_0xbeee('0x1'));var moment=require('moment');var BPromise=require(_0xbeee('0x2'));var util=require('util');var path=require(_0xbeee('0x3'));var fs=require('fs');var _=require(_0xbeee('0x4'));var Redis=require(_0xbeee('0x5'));var interaction=require(_0xbeee('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0xbeee('0x7'))(_0xbeee('0x8'));var config=require(_0xbeee('0x9'));var db=require(_0xbeee('0xa'))['db'];config[_0xbeee('0xb')]=_[_0xbeee('0xc')](config[_0xbeee('0xb')],{'host':_0xbeee('0xd'),'port':0x18eb});var socket=require(_0xbeee('0xe'))(new Redis(config[_0xbeee('0xb')]));require(_0xbeee('0xf'))[_0xbeee('0x10')](socket);function respondWithStatusCode(_0x2849ca,_0x12de48){_0x12de48=_0x12de48||0xcc;return function(_0x4b41ee){if(_0x4b41ee){return _0x2849ca['sendStatus'](_0x12de48);}return _0x2849ca[_0xbeee('0x11')](_0x12de48)[_0xbeee('0x12')]();};}function respondWithResult(_0x983a0f,_0x4aac33){_0x4aac33=_0x4aac33||0xc8;return function(_0x4a7555){if(_0x4a7555){return _0x983a0f[_0xbeee('0x11')](_0x4aac33)[_0xbeee('0x13')](_0x4a7555);}};}function respondWithFilteredResult(_0x3a655f,_0x570215){return function(_0x198ff4){if(_0x198ff4){var _0x4b886e=typeof _0x570215[_0xbeee('0x14')]==='undefined'&&typeof _0x570215['limit']===_0xbeee('0x15');var _0x3ed846=_0x198ff4[_0xbeee('0x16')];var _0x47bbcd=_0x4b886e?0x0:_0x570215['offset'];var _0x51177a=_0x4b886e?_0x198ff4[_0xbeee('0x16')]:_0x570215[_0xbeee('0x14')]+_0x570215['limit'];var _0x2f04bb;if(_0x51177a>=_0x3ed846){_0x51177a=_0x3ed846;_0x2f04bb=0xc8;}else{_0x2f04bb=0xce;}_0x3a655f[_0xbeee('0x11')](_0x2f04bb);return _0x3a655f[_0xbeee('0x17')](_0xbeee('0x18'),_0x47bbcd+'-'+_0x51177a+'/'+_0x3ed846)[_0xbeee('0x13')](_0x198ff4);}return null;};}function saveUpdates(_0x1c7efd){return function(_0xb45e20){if(_0xb45e20){return _0xb45e20[_0xbeee('0x19')](_0x1c7efd)[_0xbeee('0x1a')](function(_0x4c8309){return _0x4c8309;});}return null;};}function removeEntity(_0x187d94){return function(_0x5df827){if(_0x5df827){return _0x5df827[_0xbeee('0x1b')]()['then'](function(){_0x187d94[_0xbeee('0x11')](0xcc)[_0xbeee('0x12')]();});}};}function handleEntityNotFound(_0x3c1ba3){return function(_0x1a0428){if(!_0x1a0428){_0x3c1ba3['sendStatus'](0x194);}return _0x1a0428;};}function handleError(_0x210d0b,_0x4827b5){_0x4827b5=_0x4827b5||0x1f4;return function(_0x4fc47b){logger[_0xbeee('0x1c')](_0x4fc47b[_0xbeee('0x1d')]);if(_0x4fc47b[_0xbeee('0x1e')]){delete _0x4fc47b[_0xbeee('0x1e')];}_0x210d0b[_0xbeee('0x11')](_0x4827b5)[_0xbeee('0x1f')](_0x4fc47b);};}exports[_0xbeee('0x20')]=function(_0x125f39,_0x449b80){var _0x2b7824={};var _0x3e7d95=_['map'](db[_0xbeee('0x21')]['rawAttributes'],function(_0x2755f4){return{'name':_0x2755f4['fieldName'],'type':_0x2755f4[_0xbeee('0x22')]['key']};});_0x2b7824=qs[_0xbeee('0x23')](_0x3e7d95,_0x125f39);return interaction[_0xbeee('0x24')](_0xbeee('0x25'),_0x125f39[_0xbeee('0x26')],_0x125f39['user'],_0x2b7824,_0x3e7d95)['then'](respondWithFilteredResult(_0x449b80,_0x2b7824))[_0xbeee('0x27')](handleError(_0x449b80,null));};exports[_0xbeee('0x28')]=function(_0x441a4b,_0xef4d9a){var _0x5cd9eb={'raw':![],'where':{'id':_0x441a4b[_0xbeee('0x29')]['id']}},_0x4bdcf3={};_0x4bdcf3[_0xbeee('0x2a')]=_[_0xbeee('0x2b')](db[_0xbeee('0x21')][_0xbeee('0x2c')]);_0x4bdcf3[_0xbeee('0x26')]=_[_0xbeee('0x2b')](_0x441a4b[_0xbeee('0x26')]);_0x4bdcf3[_0xbeee('0x2d')]=_['intersection'](_0x4bdcf3[_0xbeee('0x2a')],_0x4bdcf3['query']);_0x5cd9eb[_0xbeee('0x2e')]=_['intersection'](_0x4bdcf3[_0xbeee('0x2a')],qs['fields'](_0x441a4b['query'][_0xbeee('0x2f')]));_0x5cd9eb[_0xbeee('0x2e')]=_0x5cd9eb[_0xbeee('0x2e')][_0xbeee('0x30')]?_0x5cd9eb['attributes']:_0x4bdcf3[_0xbeee('0x2a')];if(_0x441a4b[_0xbeee('0x26')]['includeAll']){_0x5cd9eb[_0xbeee('0x31')]=[{'all':!![]}];}_0x5cd9eb=_['merge']({},_0x5cd9eb,_0x441a4b[_0xbeee('0x32')]);return db['FaxInteraction'][_0xbeee('0x33')](_0x5cd9eb)[_0xbeee('0x1a')](handleEntityNotFound(_0xef4d9a,null))[_0xbeee('0x1a')](respondWithResult(_0xef4d9a,null))[_0xbeee('0x27')](handleError(_0xef4d9a,null));};exports['create']=function(_0x3fd59d,_0x53cbb4){return db[_0xbeee('0x21')]['create'](_0x3fd59d[_0xbeee('0x34')],{})[_0xbeee('0x1a')](respondWithResult(_0x53cbb4,0xc9))[_0xbeee('0x27')](handleError(_0x53cbb4,null));};exports[_0xbeee('0x19')]=function(_0x346bcc,_0x32b7c6){if(_0x346bcc[_0xbeee('0x34')]['id']){delete _0x346bcc[_0xbeee('0x34')]['id'];}return db[_0xbeee('0x21')]['find']({'where':{'id':_0x346bcc[_0xbeee('0x29')]['id']}})['then'](handleEntityNotFound(_0x32b7c6,null))[_0xbeee('0x1a')](saveUpdates(_0x346bcc[_0xbeee('0x34')],null))[_0xbeee('0x1a')](respondWithResult(_0x32b7c6,null))[_0xbeee('0x27')](handleError(_0x32b7c6,null));};exports[_0xbeee('0x1b')]=function(_0x1a8d54,_0xa30885){return db[_0xbeee('0x21')][_0xbeee('0x33')]({'where':{'id':_0x1a8d54['params']['id']}})[_0xbeee('0x1a')](handleEntityNotFound(_0xa30885,null))[_0xbeee('0x1a')](removeEntity(_0xa30885,null))[_0xbeee('0x27')](handleError(_0xa30885,null));};exports['describe']=function(_0x2d21fe,_0x36a721){return db[_0xbeee('0x21')]['describe']()[_0xbeee('0x1a')](respondWithResult(_0x36a721,null))[_0xbeee('0x27')](handleError(_0x36a721,null));};exports['addMessage']=function(_0x22fac1,_0x3b8369){return db[_0xbeee('0x35')]['find']({'where':{'id':_0x22fac1[_0xbeee('0x29')]['id']}})[_0xbeee('0x1a')](handleEntityNotFound(_0x3b8369,null))[_0xbeee('0x1a')](function(_0x5d1978){if(_0x5d1978){return _0x5d1978['addMessage'](_0x22fac1['body'][_0xbeee('0x36')],_[_0xbeee('0x37')](_0x22fac1[_0xbeee('0x34')],['ids','id'])||{});}})[_0xbeee('0x1a')](respondWithResult(_0x3b8369,null))['catch'](handleError(_0x3b8369,null));};exports['getMessages']=function(_0x1a6acf,_0x2040da){var _0xac579={'raw':![],'where':{}};var _0x5e9f6c={};var _0x2b9e7e={'count':0x0,'rows':[]};return db[_0xbeee('0x21')][_0xbeee('0x38')]({'where':{'id':_0x1a6acf[_0xbeee('0x29')]['id']}})[_0xbeee('0x1a')](handleEntityNotFound(_0x2040da,null))['then'](function(_0xd4bbf1){if(_0xd4bbf1){_0x5e9f6c[_0xbeee('0x2a')]=_[_0xbeee('0x2b')](db['FaxMessage'][_0xbeee('0x2c')]);_0x5e9f6c[_0xbeee('0x26')]=_[_0xbeee('0x2b')](_0x1a6acf[_0xbeee('0x26')]);_0x5e9f6c[_0xbeee('0x2d')]=_[_0xbeee('0x39')](_0x5e9f6c[_0xbeee('0x2a')],_0x5e9f6c[_0xbeee('0x26')]);_0xac579[_0xbeee('0x2e')]=_['intersection'](_0x5e9f6c[_0xbeee('0x2a')],qs['fields'](_0x1a6acf['query'][_0xbeee('0x2f')]));_0xac579[_0xbeee('0x2e')]=_0xac579[_0xbeee('0x2e')][_0xbeee('0x30')]?_0xac579[_0xbeee('0x2e')]:_0x5e9f6c[_0xbeee('0x2a')];if(!_0x1a6acf['query'][_0xbeee('0x3a')](_0xbeee('0x3b'))){_0xac579[_0xbeee('0x3c')]=qs['limit'](_0x1a6acf[_0xbeee('0x26')][_0xbeee('0x3c')]);_0xac579[_0xbeee('0x14')]=qs[_0xbeee('0x14')](_0x1a6acf[_0xbeee('0x26')][_0xbeee('0x14')]);}_0xac579[_0xbeee('0x3d')]=qs[_0xbeee('0x3e')](_0x1a6acf['query'][_0xbeee('0x3e')]);_0xac579['where']=qs['filters'](_[_0xbeee('0x3f')](_0x1a6acf['query'],_0x5e9f6c[_0xbeee('0x2d')]));_0xac579[_0xbeee('0x40')][_0xbeee('0x41')]=_0xd4bbf1['id'];if(_0x1a6acf['query'][_0xbeee('0x42')]){_0xac579[_0xbeee('0x40')]=_[_0xbeee('0x43')](_0xac579[_0xbeee('0x40')],{'$or':_[_0xbeee('0x44')](_0xac579['attributes'],function(_0x17ea15){var _0x6fd63e={};_0x6fd63e[_0x17ea15]={'$like':'%'+_0x1a6acf[_0xbeee('0x26')][_0xbeee('0x42')]+'%'};return _0x6fd63e;})});}if(_0x1a6acf[_0xbeee('0x26')][_0xbeee('0x45')]){var _0x532289=_0x1a6acf[_0xbeee('0x26')][_0xbeee('0x45')]['split'](',');var _0x182cc9={};_0x182cc9[_0x532289[0x0]]={'$gte':moment(_0x532289[0x1])[_0xbeee('0x46')](_0xbeee('0x47'))};_0xac579['where']=_[_0xbeee('0x43')](_0xac579[_0xbeee('0x40')],_0x182cc9);}_0xac579=_['merge']({},_0xac579,_0x1a6acf[_0xbeee('0x32')]);return db[_0xbeee('0x35')][_0xbeee('0x16')]({'where':_0xac579[_0xbeee('0x40')]})[_0xbeee('0x1a')](function(_0x1f92dd){_0x2b9e7e['count']=_0x1f92dd;if(_0x1a6acf['query'][_0xbeee('0x48')]){_0xac579[_0xbeee('0x31')]=[{'all':!![]}];}return db['FaxMessage'][_0xbeee('0x24')](_0xac579);})[_0xbeee('0x1a')](function(_0x5546e6){_0x2b9e7e[_0xbeee('0x49')]=_0x5546e6;return _0x2b9e7e;});}})[_0xbeee('0x1a')](respondWithFilteredResult(_0x2040da,_0xac579))[_0xbeee('0x27')](handleError(_0x2040da,null));};exports[_0xbeee('0x4a')]=function(_0x4dc04d,_0x2f9c75){return db['FaxInteraction'][_0xbeee('0x33')]({'where':{'id':_0x4dc04d[_0xbeee('0x29')]['id']}})['then'](handleEntityNotFound(_0x2f9c75,null))['then'](function(_0x121360){if(_0x121360){return _0x121360[_0xbeee('0x4b')](_0x4dc04d[_0xbeee('0x34')]['ids'],_[_0xbeee('0x37')](_0x4dc04d['body'],[_0xbeee('0x36'),'id'])||{})[_0xbeee('0x4c')](function(){return db[_0xbeee('0x4d')][_0xbeee('0x24')]({'attributes':['id',_0xbeee('0x1e'),_0xbeee('0x4e')],'where':{'id':_0x4dc04d['body'][_0xbeee('0x36')]}});})[_0xbeee('0x1a')](function(_0x10cf14){socket[_0xbeee('0x4f')]('faxInteractionTags:save',{'id':Number(_0x4dc04d[_0xbeee('0x29')]['id']),'tags':_0x10cf14||[]});return{'id':Number(_0x4dc04d[_0xbeee('0x29')]['id']),'tags':_0x10cf14||[]};});}})[_0xbeee('0x1a')](respondWithResult(_0x2f9c75,null))['catch'](handleError(_0x2f9c75,null));};exports[_0xbeee('0x50')]=function(_0x11ff41,_0x5e41f3){return db['FaxInteraction'][_0xbeee('0x33')]({'where':{'id':_0x11ff41[_0xbeee('0x29')]['id']}})['then'](handleEntityNotFound(_0x5e41f3,null))[_0xbeee('0x1a')](function(_0x4b1d09){if(_0x4b1d09){return _0x4b1d09[_0xbeee('0x50')](_0x11ff41[_0xbeee('0x26')][_0xbeee('0x36')]);}})['then'](respondWithStatusCode(_0x5e41f3,null))[_0xbeee('0x27')](handleError(_0x5e41f3,null));};exports['download']=function(_0x896635,_0x4bea41){var _0xb991d6=moment()[_0xbeee('0x51')]()[_0xbeee('0x52')]();var _0x322f87=path['join'](config[_0xbeee('0x53')],_0xbeee('0x54'),_0xbeee('0x55'),_0xbeee('0x56'));var _0x51989c=path['join'](config['root'],_0xbeee('0x54'),_0xbeee('0x55'),_0xbeee('0x57'));var _0x3fe37a=path[_0xbeee('0x58')](_0x322f87,_0xb991d6);var _0x55544a=util[_0xbeee('0x46')](_0xbeee('0x59'),_0x896635[_0xbeee('0x29')]['id'],_0xb991d6);var _0x49593e=path['join'](_0x322f87,_0x55544a);var _0x5bb818=[];_0x5bb818['push']({'model':db['Attachment'],'as':_0xbeee('0x5a'),'raw':!![]});var _0x3dbdd6=[{'model':db[_0xbeee('0x35')],'as':_0xbeee('0x5b'),'attributes':['id',_0xbeee('0x34'),_0xbeee('0x5c')],'include':_0x5bb818}];return db['FaxInteraction'][_0xbeee('0x33')]({'where':{'id':_0x896635[_0xbeee('0x29')]['id']},'include':_0x3dbdd6})[_0xbeee('0x1a')](handleEntityNotFound(_0x4bea41,null))[_0xbeee('0x1a')](function(_0x523c3c){if(_0x523c3c&&_0x523c3c[_0xbeee('0x5b')]){var _0x49113e=_0x523c3c[_0xbeee('0x5d')]({'plain':!![]});fs[_0xbeee('0x5e')](_0x3fe37a);for(var _0x1eec8a=0x0;_0x1eec8a<_0x49113e[_0xbeee('0x5b')][_0xbeee('0x30')];_0x1eec8a++){var _0x52f9f6=_0x49113e[_0xbeee('0x5b')][_0x1eec8a][_0xbeee('0x5a')];if(_0x52f9f6){var _0x488634=path['join'](_0x51989c,_0x52f9f6[_0xbeee('0x5f')]);if(fs[_0xbeee('0x60')](_0x488634)){fs[_0xbeee('0x61')](_0x488634)['pipe'](fs[_0xbeee('0x62')](path[_0xbeee('0x58')](_0x3fe37a,_0x52f9f6[_0xbeee('0x5f')])));}}}return BPromise[_0xbeee('0x63')]()[_0xbeee('0x1a')](function(){return new BPromise(function(_0xf61e27,_0x268393){zipdir(_0x3fe37a,{'saveTo':_0x49593e},function(_0x39a054,_0x495d22){if(_0x39a054)return _0x268393(_0x39a054);return _0xf61e27(_0x495d22);});})[_0xbeee('0x1a')](function(){return new BPromise(function(_0x166521,_0x28776d){rimraf(_0x3fe37a,function(_0x1455a1){if(_0x1455a1)_0x28776d(_0x1455a1);return _0x166521();});});})['then'](function(){return _0x4bea41[_0xbeee('0x64')](_0x49593e,_0x55544a,function(_0x1c87ac){if(_0x1c87ac){console['log'](_0xbeee('0x65'),_0x1c87ac);}else{fs[_0xbeee('0x66')](_0x49593e);}});});});}else{return _0x4bea41[_0xbeee('0x67')](0xc8);}})[_0xbeee('0x27')](handleError(_0x4bea41,null));}; \ No newline at end of file +var _0xbe91=['Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/environment','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','update','then','end','error','name','index','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','intersection','model','fields','attributes','length','include','options','find','create','body','destroy','describe','addMessage','omit','getMessages','findOne','FaxMessage','hasOwnProperty','nolimit','sort','pick','where','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','ids','spread','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','transcript-%d-%s.zip','push'];(function(_0x303c30,_0x16edcb){var _0x43161b=function(_0x3330ff){while(--_0x3330ff){_0x303c30['push'](_0x303c30['shift']());}};_0x43161b(++_0x16edcb);}(_0xbe91,0x1a4));var _0x1be9=function(_0x3f761d,_0x5d907d){_0x3f761d=_0x3f761d-0x0;var _0x49d6e3=_0xbe91[_0x3f761d];return _0x49d6e3;};'use strict';var rimraf=require(_0x1be9('0x0'));var zipdir=require(_0x1be9('0x1'));var moment=require(_0x1be9('0x2'));var BPromise=require(_0x1be9('0x3'));var util=require(_0x1be9('0x4'));var path=require(_0x1be9('0x5'));var fs=require('fs');var _=require(_0x1be9('0x6'));var Redis=require(_0x1be9('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x1be9('0x8'));var logger=require('../../config/logger')('api');var config=require(_0x1be9('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1be9('0xa')],{'host':_0x1be9('0xb'),'port':0x18eb});var socket=require(_0x1be9('0xc'))(new Redis(config[_0x1be9('0xa')]));require(_0x1be9('0xd'))[_0x1be9('0xe')](socket);function respondWithStatusCode(_0x300146,_0x5679e0){_0x5679e0=_0x5679e0||0xcc;return function(_0x51ea57){if(_0x51ea57){return _0x300146[_0x1be9('0xf')](_0x5679e0);}return _0x300146[_0x1be9('0x10')](_0x5679e0)['end']();};}function respondWithResult(_0x4d64a9,_0x27cc3c){_0x27cc3c=_0x27cc3c||0xc8;return function(_0x5a0528){if(_0x5a0528){return _0x4d64a9['status'](_0x27cc3c)[_0x1be9('0x11')](_0x5a0528);}};}function respondWithFilteredResult(_0x34339b,_0x40cbb5){return function(_0x415e03){if(_0x415e03){var _0x1021d9=typeof _0x40cbb5['offset']==='undefined'&&typeof _0x40cbb5[_0x1be9('0x12')]===_0x1be9('0x13');var _0x7223b0=_0x415e03[_0x1be9('0x14')];var _0xbc1902=_0x1021d9?0x0:_0x40cbb5[_0x1be9('0x15')];var _0x5a4dd4=_0x1021d9?_0x415e03['count']:_0x40cbb5[_0x1be9('0x15')]+_0x40cbb5[_0x1be9('0x12')];var _0x563ff2;if(_0x5a4dd4>=_0x7223b0){_0x5a4dd4=_0x7223b0;_0x563ff2=0xc8;}else{_0x563ff2=0xce;}_0x34339b[_0x1be9('0x10')](_0x563ff2);return _0x34339b[_0x1be9('0x16')](_0x1be9('0x17'),_0xbc1902+'-'+_0x5a4dd4+'/'+_0x7223b0)[_0x1be9('0x11')](_0x415e03);}return null;};}function saveUpdates(_0x5af92c){return function(_0xfe1b03){if(_0xfe1b03){return _0xfe1b03[_0x1be9('0x18')](_0x5af92c)[_0x1be9('0x19')](function(_0x1fde2b){return _0x1fde2b;});}return null;};}function removeEntity(_0x1af8b8){return function(_0xa56a1){if(_0xa56a1){return _0xa56a1['destroy']()[_0x1be9('0x19')](function(){_0x1af8b8['status'](0xcc)[_0x1be9('0x1a')]();});}};}function handleEntityNotFound(_0xbd2190){return function(_0x35c17b){if(!_0x35c17b){_0xbd2190[_0x1be9('0xf')](0x194);}return _0x35c17b;};}function handleError(_0x69d670,_0x36d404){_0x36d404=_0x36d404||0x1f4;return function(_0x4c0c6b){logger[_0x1be9('0x1b')](_0x4c0c6b['stack']);if(_0x4c0c6b[_0x1be9('0x1c')]){delete _0x4c0c6b[_0x1be9('0x1c')];}_0x69d670['status'](_0x36d404)['send'](_0x4c0c6b);};}exports[_0x1be9('0x1d')]=function(_0x13a5b0,_0x4a852e){var _0x289a94={};var _0x3fa30d=_[_0x1be9('0x1e')](db[_0x1be9('0x1f')][_0x1be9('0x20')],function(_0x1a0e86){return{'name':_0x1a0e86[_0x1be9('0x21')],'type':_0x1a0e86[_0x1be9('0x22')][_0x1be9('0x23')]};});_0x289a94=qs[_0x1be9('0x24')](_0x3fa30d,_0x13a5b0);return interaction[_0x1be9('0x25')](_0x1be9('0x26'),_0x13a5b0[_0x1be9('0x27')],_0x13a5b0[_0x1be9('0x28')],_0x289a94,_0x3fa30d)[_0x1be9('0x19')](respondWithFilteredResult(_0x4a852e,_0x289a94))[_0x1be9('0x29')](handleError(_0x4a852e,null));};exports[_0x1be9('0x2a')]=function(_0x27279e,_0x30740b){var _0x59564a={'raw':![],'where':{'id':_0x27279e[_0x1be9('0x2b')]['id']}},_0x14589d={};_0x14589d['model']=_[_0x1be9('0x2c')](db['FaxInteraction']['rawAttributes']);_0x14589d[_0x1be9('0x27')]=_[_0x1be9('0x2c')](_0x27279e[_0x1be9('0x27')]);_0x14589d[_0x1be9('0x2d')]=_[_0x1be9('0x2e')](_0x14589d[_0x1be9('0x2f')],_0x14589d[_0x1be9('0x27')]);_0x59564a['attributes']=_['intersection'](_0x14589d['model'],qs[_0x1be9('0x30')](_0x27279e[_0x1be9('0x27')][_0x1be9('0x30')]));_0x59564a[_0x1be9('0x31')]=_0x59564a[_0x1be9('0x31')][_0x1be9('0x32')]?_0x59564a[_0x1be9('0x31')]:_0x14589d['model'];if(_0x27279e[_0x1be9('0x27')]['includeAll']){_0x59564a[_0x1be9('0x33')]=[{'all':!![]}];}_0x59564a=_['merge']({},_0x59564a,_0x27279e[_0x1be9('0x34')]);return db[_0x1be9('0x1f')][_0x1be9('0x35')](_0x59564a)[_0x1be9('0x19')](handleEntityNotFound(_0x30740b,null))['then'](respondWithResult(_0x30740b,null))[_0x1be9('0x29')](handleError(_0x30740b,null));};exports[_0x1be9('0x36')]=function(_0xc7a459,_0x220fe5){return db[_0x1be9('0x1f')][_0x1be9('0x36')](_0xc7a459[_0x1be9('0x37')],{})[_0x1be9('0x19')](respondWithResult(_0x220fe5,0xc9))['catch'](handleError(_0x220fe5,null));};exports['update']=function(_0x123827,_0x3d735a){if(_0x123827[_0x1be9('0x37')]['id']){delete _0x123827[_0x1be9('0x37')]['id'];}return db[_0x1be9('0x1f')][_0x1be9('0x35')]({'where':{'id':_0x123827[_0x1be9('0x2b')]['id']}})[_0x1be9('0x19')](handleEntityNotFound(_0x3d735a,null))[_0x1be9('0x19')](saveUpdates(_0x123827[_0x1be9('0x37')],null))[_0x1be9('0x19')](respondWithResult(_0x3d735a,null))[_0x1be9('0x29')](handleError(_0x3d735a,null));};exports[_0x1be9('0x38')]=function(_0x417d5a,_0x46e65f){return db[_0x1be9('0x1f')][_0x1be9('0x35')]({'where':{'id':_0x417d5a[_0x1be9('0x2b')]['id']}})[_0x1be9('0x19')](handleEntityNotFound(_0x46e65f,null))[_0x1be9('0x19')](removeEntity(_0x46e65f,null))[_0x1be9('0x29')](handleError(_0x46e65f,null));};exports[_0x1be9('0x39')]=function(_0x6d5775,_0x164087){return db[_0x1be9('0x1f')][_0x1be9('0x39')]()[_0x1be9('0x19')](respondWithResult(_0x164087,null))[_0x1be9('0x29')](handleError(_0x164087,null));};exports[_0x1be9('0x3a')]=function(_0x3ada6f,_0x5787aa){return db['FaxMessage'][_0x1be9('0x35')]({'where':{'id':_0x3ada6f[_0x1be9('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5787aa,null))[_0x1be9('0x19')](function(_0x134026){if(_0x134026){return _0x134026[_0x1be9('0x3a')](_0x3ada6f[_0x1be9('0x37')]['ids'],_[_0x1be9('0x3b')](_0x3ada6f[_0x1be9('0x37')],['ids','id'])||{});}})['then'](respondWithResult(_0x5787aa,null))[_0x1be9('0x29')](handleError(_0x5787aa,null));};exports[_0x1be9('0x3c')]=function(_0x282170,_0x15c145){var _0x46dbed={'raw':![],'where':{}};var _0x45471f={};var _0x10001e={'count':0x0,'rows':[]};return db[_0x1be9('0x1f')][_0x1be9('0x3d')]({'where':{'id':_0x282170[_0x1be9('0x2b')]['id']}})[_0x1be9('0x19')](handleEntityNotFound(_0x15c145,null))['then'](function(_0x27ede5){if(_0x27ede5){_0x45471f[_0x1be9('0x2f')]=_[_0x1be9('0x2c')](db[_0x1be9('0x3e')][_0x1be9('0x20')]);_0x45471f[_0x1be9('0x27')]=_[_0x1be9('0x2c')](_0x282170[_0x1be9('0x27')]);_0x45471f['filters']=_[_0x1be9('0x2e')](_0x45471f['model'],_0x45471f[_0x1be9('0x27')]);_0x46dbed[_0x1be9('0x31')]=_[_0x1be9('0x2e')](_0x45471f['model'],qs[_0x1be9('0x30')](_0x282170['query']['fields']));_0x46dbed[_0x1be9('0x31')]=_0x46dbed['attributes'][_0x1be9('0x32')]?_0x46dbed['attributes']:_0x45471f['model'];if(!_0x282170[_0x1be9('0x27')][_0x1be9('0x3f')](_0x1be9('0x40'))){_0x46dbed[_0x1be9('0x12')]=qs['limit'](_0x282170[_0x1be9('0x27')][_0x1be9('0x12')]);_0x46dbed['offset']=qs[_0x1be9('0x15')](_0x282170['query'][_0x1be9('0x15')]);}_0x46dbed['order']=qs['sort'](_0x282170[_0x1be9('0x27')][_0x1be9('0x41')]);_0x46dbed['where']=qs[_0x1be9('0x2d')](_[_0x1be9('0x42')](_0x282170['query'],_0x45471f[_0x1be9('0x2d')]));_0x46dbed[_0x1be9('0x43')]['FaxInteractionId']=_0x27ede5['id'];if(_0x282170[_0x1be9('0x27')][_0x1be9('0x44')]){_0x46dbed[_0x1be9('0x43')]=_[_0x1be9('0x45')](_0x46dbed[_0x1be9('0x43')],{'$or':_['map'](_0x46dbed[_0x1be9('0x31')],function(_0xb0cf4f){var _0x121907={};_0x121907[_0xb0cf4f]={'$like':'%'+_0x282170['query'][_0x1be9('0x44')]+'%'};return _0x121907;})});}if(_0x282170[_0x1be9('0x27')][_0x1be9('0x46')]){var _0x348742=_0x282170[_0x1be9('0x27')][_0x1be9('0x46')][_0x1be9('0x47')](',');var _0x4b0bf1={};_0x4b0bf1[_0x348742[0x0]]={'$gte':moment(_0x348742[0x1])[_0x1be9('0x48')](_0x1be9('0x49'))};_0x46dbed['where']=_[_0x1be9('0x45')](_0x46dbed['where'],_0x4b0bf1);}_0x46dbed=_['merge']({},_0x46dbed,_0x282170[_0x1be9('0x34')]);return db[_0x1be9('0x3e')][_0x1be9('0x14')]({'where':_0x46dbed[_0x1be9('0x43')]})['then'](function(_0x9d2c3d){_0x10001e[_0x1be9('0x14')]=_0x9d2c3d;if(_0x282170[_0x1be9('0x27')]['includeAll']){_0x46dbed[_0x1be9('0x33')]=[{'all':!![]}];}return db[_0x1be9('0x3e')]['findAll'](_0x46dbed);})[_0x1be9('0x19')](function(_0x30fe68){_0x10001e[_0x1be9('0x4a')]=_0x30fe68;return _0x10001e;});}})[_0x1be9('0x19')](respondWithFilteredResult(_0x15c145,_0x46dbed))[_0x1be9('0x29')](handleError(_0x15c145,null));};exports['addTags']=function(_0x1b3037,_0x54f060){return db[_0x1be9('0x1f')][_0x1be9('0x35')]({'where':{'id':_0x1b3037[_0x1be9('0x2b')]['id']}})[_0x1be9('0x19')](handleEntityNotFound(_0x54f060,null))[_0x1be9('0x19')](function(_0x5b457a){if(_0x5b457a){return _0x5b457a[_0x1be9('0x4b')](_0x1b3037[_0x1be9('0x37')][_0x1be9('0x4c')],_[_0x1be9('0x3b')](_0x1b3037[_0x1be9('0x37')],[_0x1be9('0x4c'),'id'])||{})[_0x1be9('0x4d')](function(){return db['Tag']['findAll']({'attributes':['id',_0x1be9('0x1c'),'color'],'where':{'id':_0x1b3037[_0x1be9('0x37')]['ids']}});})[_0x1be9('0x19')](function(_0x2ceafe){socket[_0x1be9('0x4e')](_0x1be9('0x4f'),{'id':Number(_0x1b3037['params']['id']),'tags':_0x2ceafe||[]});return{'id':Number(_0x1b3037[_0x1be9('0x2b')]['id']),'tags':_0x2ceafe||[]};});}})[_0x1be9('0x19')](respondWithResult(_0x54f060,null))['catch'](handleError(_0x54f060,null));};exports[_0x1be9('0x50')]=function(_0x56fd83,_0x4e61c5){return db[_0x1be9('0x1f')][_0x1be9('0x35')]({'where':{'id':_0x56fd83['params']['id']}})[_0x1be9('0x19')](handleEntityNotFound(_0x4e61c5,null))[_0x1be9('0x19')](function(_0x27d0b9){if(_0x27d0b9){return _0x27d0b9[_0x1be9('0x50')](_0x56fd83[_0x1be9('0x27')][_0x1be9('0x4c')]);}})['then'](respondWithStatusCode(_0x4e61c5,null))[_0x1be9('0x29')](handleError(_0x4e61c5,null));};exports[_0x1be9('0x51')]=function(_0x356158,_0xe31a11){var _0x391be1=moment()[_0x1be9('0x52')]()['toString']();var _0x524e61=path[_0x1be9('0x53')](config[_0x1be9('0x54')],_0x1be9('0x55'),_0x1be9('0x56'),_0x1be9('0x57'));var _0x2b814a=path[_0x1be9('0x53')](config[_0x1be9('0x54')],_0x1be9('0x55'),'files','attachments');var _0x5a5b4c=path[_0x1be9('0x53')](_0x524e61,_0x391be1);var _0x2391de=util['format'](_0x1be9('0x58'),_0x356158[_0x1be9('0x2b')]['id'],_0x391be1);var _0x4a570d=path['join'](_0x524e61,_0x2391de);var _0x19dbc1=[];_0x19dbc1[_0x1be9('0x59')]({'model':db['Attachment'],'as':_0x1be9('0x5a'),'raw':!![]});var _0x5641b1=[{'model':db['FaxMessage'],'as':_0x1be9('0x5b'),'attributes':['id',_0x1be9('0x37'),_0x1be9('0x5c')],'include':_0x19dbc1}];return db[_0x1be9('0x1f')][_0x1be9('0x35')]({'where':{'id':_0x356158[_0x1be9('0x2b')]['id']},'include':_0x5641b1})[_0x1be9('0x19')](handleEntityNotFound(_0xe31a11,null))[_0x1be9('0x19')](function(_0x2098d6){if(_0x2098d6&&_0x2098d6[_0x1be9('0x5b')]){var _0x37c42d=_0x2098d6[_0x1be9('0x5d')]({'plain':!![]});fs[_0x1be9('0x5e')](_0x5a5b4c);for(var _0x5d711e=0x0;_0x5d711e<_0x37c42d['Messages'][_0x1be9('0x32')];_0x5d711e++){var _0x39a91a=_0x37c42d[_0x1be9('0x5b')][_0x5d711e][_0x1be9('0x5a')];if(_0x39a91a){var _0x5aa20d=path['join'](_0x2b814a,_0x39a91a[_0x1be9('0x5f')]);if(fs[_0x1be9('0x60')](_0x5aa20d)){fs[_0x1be9('0x61')](_0x5aa20d)['pipe'](fs[_0x1be9('0x62')](path[_0x1be9('0x53')](_0x5a5b4c,_0x39a91a[_0x1be9('0x5f')])));}}}return BPromise[_0x1be9('0x63')]()[_0x1be9('0x19')](function(){return new BPromise(function(_0x53fa60,_0x4bf329){zipdir(_0x5a5b4c,{'saveTo':_0x4a570d},function(_0x4265b7,_0x134014){if(_0x4265b7)return _0x4bf329(_0x4265b7);return _0x53fa60(_0x134014);});})['then'](function(){return new BPromise(function(_0x3cb8dc,_0x3603dc){rimraf(_0x5a5b4c,function(_0x2bcd3a){if(_0x2bcd3a)_0x3603dc(_0x2bcd3a);return _0x3cb8dc();});});})['then'](function(){return _0xe31a11[_0x1be9('0x51')](_0x4a570d,_0x2391de,function(_0xbd3d2c){if(_0xbd3d2c){console['log'](_0x1be9('0x64'),_0xbd3d2c);}else{fs[_0x1be9('0x65')](_0x4a570d);}});});});}else{return _0xe31a11[_0x1be9('0xf')](0xc8);}})['catch'](handleError(_0xe31a11,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index d1d0217..f885e14 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 _0xa486=['length','emit','catch','exports','events','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove','getUsers','setDataValue','map','then','unreadMessages'];(function(_0x5982d8,_0x5688bd){var _0x41ded4=function(_0x6c79cc){while(--_0x6c79cc){_0x5982d8['push'](_0x5982d8['shift']());}};_0x41ded4(++_0x5688bd);}(_0xa486,0xc4));var _0x6a48=function(_0x28210a,_0x35774a){_0x28210a=_0x28210a-0x0;var _0xdd05a8=_0xa486[_0x28210a];return _0xdd05a8;};'use strict';var EventEmitter=require(_0x6a48('0x0'));var FaxInteraction=require(_0x6a48('0x1'))['db'][_0x6a48('0x2')];var FaxMessage=require(_0x6a48('0x1'))['db'][_0x6a48('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6a48('0x4'),'afterUpdate':_0x6a48('0x5'),'afterDestroy':_0x6a48('0x6')};function emitEvent(_0xf3678d){return function(_0x49841c,_0x3f9e4a,_0x1e2d58){_0x49841c[_0x6a48('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9edc29){_0x49841c[_0x6a48('0x8')]('Users',_0x9edc29[_0x6a48('0x9')](function(_0x48824a){return{'id':_0x48824a['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x49841c['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6a48('0xa')](function(_0x381d45){_0x49841c[_0x6a48('0x8')](_0x6a48('0xb'),_0x381d45[_0x6a48('0xc')]);FaxInteractionEvents['emit'](_0xf3678d+':'+_0x49841c['id'],_0x49841c);FaxInteractionEvents[_0x6a48('0xd')](_0xf3678d,_0x49841c);_0x1e2d58(null);})[_0x6a48('0xe')](_0x1e2d58(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x6a48('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x23e2=['save','remove','setDataValue','Users','findAll','then','unreadMessages','length','emit','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x23e2,0xcd));var _0x223e=function(_0x1b6c0c,_0x51ef20){_0x1b6c0c=_0x1b6c0c-0x0;var _0x178991=_0x23e2[_0x1b6c0c];return _0x178991;};'use strict';var EventEmitter=require(_0x223e('0x0'));var FaxInteraction=require(_0x223e('0x1'))['db'][_0x223e('0x2')];var FaxMessage=require(_0x223e('0x1'))['db'][_0x223e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x223e('0x4')](0x0);var events={'afterCreate':_0x223e('0x5'),'afterUpdate':'update','afterDestroy':_0x223e('0x6')};function emitEvent(_0xb31347){return function(_0x2ed1e2,_0x115c67,_0x2a285a){_0x2ed1e2['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4ef318){_0x2ed1e2[_0x223e('0x7')](_0x223e('0x8'),_0x4ef318['map'](function(_0x6ad24d){return{'id':_0x6ad24d['id']};}));return FaxMessage[_0x223e('0x9')]({'where':{'FaxInteractionId':_0x2ed1e2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x223e('0xa')](function(_0x3ff153){_0x2ed1e2[_0x223e('0x7')](_0x223e('0xb'),_0x3ff153[_0x223e('0xc')]);FaxInteractionEvents[_0x223e('0xd')](_0xb31347+':'+_0x2ed1e2['id'],_0x2ed1e2);FaxInteractionEvents[_0x223e('0xd')](_0xb31347,_0x2ed1e2);_0x2a285a(null);})['catch'](_0x2a285a(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x223e('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index a399dd6..d647cd3 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 _0x4d1d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4d1d,0x1cb));var _0xd4d1=function(_0xdda4dc,_0x3d2807){_0xdda4dc=_0xdda4dc-0x0;var _0x91a2a6=_0x4d1d[_0xdda4dc];return _0x91a2a6;};'use strict';var _=require(_0xd4d1('0x0'));var util=require(_0xd4d1('0x1'));var logger=require(_0xd4d1('0x2'))(_0xd4d1('0x3'));var moment=require(_0xd4d1('0x4'));var BPromise=require(_0xd4d1('0x5'));var rp=require(_0xd4d1('0x6'));var fs=require('fs');var path=require(_0xd4d1('0x7'));var rimraf=require(_0xd4d1('0x8'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0xd4d1('0x9')]=function(_0x2df6bd,_0x24d7de){return _0x2df6bd[_0xd4d1('0xa')](_0xd4d1('0xb'),attributes,{'tableName':_0xd4d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x24ee62,_0x281000,_0x138efd){if(_0x24ee62[_0xd4d1('0xd')](_0xd4d1('0xe'))){_0x24ee62[_0xd4d1('0xf')]=moment()[_0xd4d1('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x138efd(null,_0x24ee62);}}});}; \ No newline at end of file +var _0xacf6=['changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','define','FaxInteraction'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0xacf6,0x6d));var _0x6acf=function(_0x448a2d,_0x11e298){_0x448a2d=_0x448a2d-0x0;var _0x481b6a=_0xacf6[_0x448a2d];return _0x481b6a;};'use strict';var _=require(_0x6acf('0x0'));var util=require(_0x6acf('0x1'));var logger=require(_0x6acf('0x2'))(_0x6acf('0x3'));var moment=require(_0x6acf('0x4'));var BPromise=require(_0x6acf('0x5'));var rp=require(_0x6acf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6acf('0x7'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x6acf('0x8')]=function(_0x3f24be,_0x444376){return _0x3f24be[_0x6acf('0x9')](_0x6acf('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b1422,_0x415074,_0x3fc6ba){if(_0x4b1422[_0x6acf('0xb')](_0x6acf('0xc'))){_0x4b1422[_0x6acf('0xd')]=moment()['format'](_0x6acf('0xe'));}_0x3fc6ba(null,_0x4b1422);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7daa70d..57d14f8 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 _0x0fa4=['where','attributes','limit','then','info','catch','AddTagsToFaxInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UpdateFaxInteraction','FaxInteraction','update','options','raw'];(function(_0x61a47a,_0x2d0ffe){var _0x424199=function(_0x165fce){while(--_0x165fce){_0x61a47a['push'](_0x61a47a['shift']());}};_0x424199(++_0x2d0ffe);}(_0x0fa4,0x13b));var _0x40fa=function(_0x17df95,_0x46db83){_0x17df95=_0x17df95-0x0;var _0x5ce26b=_0x0fa4[_0x17df95];return _0x5ce26b;};'use strict';var _=require(_0x40fa('0x0'));var util=require(_0x40fa('0x1'));var moment=require('moment');var BPromise=require(_0x40fa('0x2'));var rs=require(_0x40fa('0x3'));var fs=require('fs');var Redis=require(_0x40fa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x40fa('0x5'));var logger=require(_0x40fa('0x6'))('rpc');var config=require(_0x40fa('0x7'));var jayson=require(_0x40fa('0x8'));var client=jayson[_0x40fa('0x9')]['http']({'port':0x232a});config['redis']=_[_0x40fa('0xa')](config[_0x40fa('0xb')],{'host':_0x40fa('0xc'),'port':0x18eb});var socket=require(_0x40fa('0xd'))(new Redis(config[_0x40fa('0xb')]));require('./faxInteraction.socket')[_0x40fa('0xe')](socket);function respondWithRpcPromise(_0x5967c5,_0xc73f7f,_0x5a0fa2){return new BPromise(function(_0x2190c9,_0x20a356){return client[_0x40fa('0xf')](_0x5967c5,_0x5a0fa2)['then'](function(_0x1efc32){logger['info'](_0x40fa('0x10'),_0xc73f7f,_0x40fa('0x11'));logger[_0x40fa('0x12')](_0x40fa('0x13'),_0xc73f7f,_0x40fa('0x11'),JSON[_0x40fa('0x14')](_0x1efc32));if(_0x1efc32['error']){if(_0x1efc32[_0x40fa('0x15')][_0x40fa('0x16')]===0x1f4){logger[_0x40fa('0x15')]('FaxInteraction,\x20%s,\x20%s',_0xc73f7f,_0x1efc32[_0x40fa('0x15')][_0x40fa('0x17')]);return _0x20a356(_0x1efc32[_0x40fa('0x15')][_0x40fa('0x17')]);}logger[_0x40fa('0x15')](_0x40fa('0x10'),_0xc73f7f,_0x1efc32[_0x40fa('0x15')]['message']);return _0x2190c9(_0x1efc32[_0x40fa('0x15')][_0x40fa('0x17')]);}else{logger['info'](_0x40fa('0x10'),_0xc73f7f,_0x40fa('0x11'));_0x2190c9(_0x1efc32['result'][_0x40fa('0x17')]);}})['catch'](function(_0x2eb55b){logger[_0x40fa('0x15')](_0x40fa('0x10'),_0xc73f7f,_0x2eb55b);_0x20a356(_0x2eb55b);});});}exports[_0x40fa('0x18')]=function(_0x36f752){var _0x46d64d=this;return new Promise(function(_0x582398,_0x479a3c){return db[_0x40fa('0x19')][_0x40fa('0x1a')](_0x36f752['body'],{'raw':_0x36f752[_0x40fa('0x1b')]?_0x36f752[_0x40fa('0x1b')][_0x40fa('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36f752[_0x40fa('0x1b')]?_0x36f752[_0x40fa('0x1b')][_0x40fa('0x1d')]||null:null,'attributes':_0x36f752[_0x40fa('0x1b')]?_0x36f752[_0x40fa('0x1b')][_0x40fa('0x1e')]||null:null,'limit':_0x36f752[_0x40fa('0x1b')]?_0x36f752[_0x40fa('0x1b')][_0x40fa('0x1f')]||null:null})[_0x40fa('0x20')](function(_0x566193){logger[_0x40fa('0x21')]('UpdateFaxInteraction',_0x36f752);logger[_0x40fa('0x12')](_0x40fa('0x18'),_0x36f752,JSON[_0x40fa('0x14')](_0x566193));_0x582398(_0x566193);})[_0x40fa('0x22')](function(_0x2b5a9c){logger[_0x40fa('0x15')](_0x40fa('0x18'),_0x2b5a9c[_0x40fa('0x17')],_0x36f752);_0x479a3c(_0x46d64d['error'](0x1f4,_0x2b5a9c[_0x40fa('0x17')]));});});};exports[_0x40fa('0x23')]=function(_0x5a3e75){return new Promise(function(_0x3e4c4f,_0x3a4571){return db[_0x40fa('0x19')][_0x40fa('0x24')]({'where':_0x5a3e75[_0x40fa('0x1b')]?_0x5a3e75[_0x40fa('0x1b')][_0x40fa('0x1d')]||null:null})['then'](function(_0x4bdec8){if(_0x4bdec8){return _0x4bdec8[_0x40fa('0x25')](_0x5a3e75[_0x40fa('0x26')][_0x40fa('0x27')],_[_0x40fa('0x28')](_0x5a3e75['body'],['ids','id'])||{});}})[_0x40fa('0x29')](function(_0x47f7f1){logger[_0x40fa('0x21')](_0x40fa('0x2a'),_0x5a3e75);logger['debug']('AddTags',_0x5a3e75,JSON['stringify'](_0x47f7f1));_0x3e4c4f(_0x47f7f1);})[_0x40fa('0x22')](function(_0x40698f){logger[_0x40fa('0x15')](_0x40fa('0x2a'),_0x40698f['message'],_0x5a3e75);_0x3a4571(_this[_0x40fa('0x15')](0x1f4,_0x40698f[_0x40fa('0x17')]));});});}; \ No newline at end of file +var _0x1b10=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','./faxInteraction.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','message','FaxInteraction,\x20%s,\x20%s','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','limit','AddTagsToFaxInteraction','find','where','addTags','body','ids','spread','AddTags','lodash','util','bluebird','ioredis'];(function(_0x47924f,_0x116749){var _0x2b6274=function(_0x39ab68){while(--_0x39ab68){_0x47924f['push'](_0x47924f['shift']());}};_0x2b6274(++_0x116749);}(_0x1b10,0xe0));var _0x01b1=function(_0x83fc12,_0x474345){_0x83fc12=_0x83fc12-0x0;var _0x1e50d3=_0x1b10[_0x83fc12];return _0x1e50d3;};'use strict';var _=require(_0x01b1('0x0'));var util=require(_0x01b1('0x1'));var moment=require('moment');var BPromise=require(_0x01b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b1('0x3'));var db=require(_0x01b1('0x4'))['db'];var utils=require(_0x01b1('0x5'));var logger=require(_0x01b1('0x6'))(_0x01b1('0x7'));var config=require('../../config/environment');var jayson=require(_0x01b1('0x8'));var client=jayson[_0x01b1('0x9')]['http']({'port':0x232a});config[_0x01b1('0xa')]=_['defaults'](config[_0x01b1('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x01b1('0xa')]));require(_0x01b1('0xb'))[_0x01b1('0xc')](socket);function respondWithRpcPromise(_0x5a0247,_0x5c944a,_0x1347be){return new BPromise(function(_0x22b5ce,_0x3c41eb){return client[_0x01b1('0xd')](_0x5a0247,_0x1347be)[_0x01b1('0xe')](function(_0x4d8373){logger[_0x01b1('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5c944a,_0x01b1('0x10'));logger[_0x01b1('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x5c944a,_0x01b1('0x10'),JSON[_0x01b1('0x12')](_0x4d8373));if(_0x4d8373[_0x01b1('0x13')]){if(_0x4d8373[_0x01b1('0x13')][_0x01b1('0x14')]===0x1f4){logger[_0x01b1('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x5c944a,_0x4d8373[_0x01b1('0x13')][_0x01b1('0x15')]);return _0x3c41eb(_0x4d8373[_0x01b1('0x13')][_0x01b1('0x15')]);}logger[_0x01b1('0x13')](_0x01b1('0x16'),_0x5c944a,_0x4d8373[_0x01b1('0x13')]['message']);return _0x22b5ce(_0x4d8373['error']['message']);}else{logger[_0x01b1('0xf')]('FaxInteraction,\x20%s,\x20%s',_0x5c944a,_0x01b1('0x10'));_0x22b5ce(_0x4d8373['result'][_0x01b1('0x15')]);}})[_0x01b1('0x17')](function(_0x214cd5){logger[_0x01b1('0x13')](_0x01b1('0x16'),_0x5c944a,_0x214cd5);_0x3c41eb(_0x214cd5);});});}exports[_0x01b1('0x18')]=function(_0x4332d9){var _0x5d4e8d=this;return new Promise(function(_0x791130,_0x1417b0){return db[_0x01b1('0x19')][_0x01b1('0x1a')](_0x4332d9['body'],{'raw':_0x4332d9[_0x01b1('0x1b')]?_0x4332d9[_0x01b1('0x1b')][_0x01b1('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4332d9[_0x01b1('0x1b')]?_0x4332d9[_0x01b1('0x1b')]['where']||null:null,'attributes':_0x4332d9['options']?_0x4332d9[_0x01b1('0x1b')]['attributes']||null:null,'limit':_0x4332d9[_0x01b1('0x1b')]?_0x4332d9[_0x01b1('0x1b')][_0x01b1('0x1d')]||null:null})[_0x01b1('0xe')](function(_0x1d3719){logger['info']('UpdateFaxInteraction',_0x4332d9);logger['debug'](_0x01b1('0x18'),_0x4332d9,JSON[_0x01b1('0x12')](_0x1d3719));_0x791130(_0x1d3719);})[_0x01b1('0x17')](function(_0x44ef10){logger['error'](_0x01b1('0x18'),_0x44ef10['message'],_0x4332d9);_0x1417b0(_0x5d4e8d[_0x01b1('0x13')](0x1f4,_0x44ef10['message']));});});};exports[_0x01b1('0x1e')]=function(_0x48a282){return new Promise(function(_0x2c01f9,_0xdf773){return db[_0x01b1('0x19')][_0x01b1('0x1f')]({'where':_0x48a282[_0x01b1('0x1b')]?_0x48a282[_0x01b1('0x1b')][_0x01b1('0x20')]||null:null})[_0x01b1('0xe')](function(_0x480aa9){if(_0x480aa9){return _0x480aa9[_0x01b1('0x21')](_0x48a282[_0x01b1('0x22')][_0x01b1('0x23')],_['omit'](_0x48a282[_0x01b1('0x22')],[_0x01b1('0x23'),'id'])||{});}})[_0x01b1('0x24')](function(_0x32f6ec){logger[_0x01b1('0xf')](_0x01b1('0x25'),_0x48a282);logger[_0x01b1('0x11')](_0x01b1('0x25'),_0x48a282,JSON['stringify'](_0x32f6ec));_0x2c01f9(_0x32f6ec);})[_0x01b1('0x17')](function(_0x1ce190){logger['error']('AddTags',_0x1ce190['message'],_0x48a282);_0xdf773(_this['error'](0x1f4,_0x1ce190[_0x01b1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 06cff7d..136f965 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 _0x9067=['emit','length','faxInteraction:','save','remove','update'];(function(_0x371f33,_0x278a69){var _0x246c96=function(_0x4f8bad){while(--_0x4f8bad){_0x371f33['push'](_0x371f33['shift']());}};_0x246c96(++_0x278a69);}(_0x9067,0x111));var _0x7906=function(_0x519efc,_0xad2ce3){_0x519efc=_0x519efc-0x0;var _0x422344=_0x9067[_0x519efc];return _0x422344;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x7906('0x0'),_0x7906('0x1'),_0x7906('0x2')];function createListener(_0x246c48,_0x3e0d2f){return function(_0x483c1c){_0x3e0d2f[_0x7906('0x3')](_0x246c48,_0x483c1c);};}function removeListener(_0x29852f,_0xffc2e2){return function(){FaxInteractionEvents['removeListener'](_0x29852f,_0xffc2e2);};}exports['register']=function(_0x1bd5be){for(var _0x2c65c4=0x0,_0x5ee289=events[_0x7906('0x4')];_0x2c65c4<_0x5ee289;_0x2c65c4++){var _0x5666d1=events[_0x2c65c4];var _0x55f7a8=createListener(_0x7906('0x5')+_0x5666d1,_0x1bd5be);FaxInteractionEvents['on'](_0x5666d1,_0x55f7a8);}}; \ No newline at end of file +var _0xc481=['save','remove','emit','faxInteraction:','./faxInteraction.events'];(function(_0x13b330,_0x297092){var _0x1f666c=function(_0x5ebc84){while(--_0x5ebc84){_0x13b330['push'](_0x13b330['shift']());}};_0x1f666c(++_0x297092);}(_0xc481,0x1bc));var _0x1c48=function(_0x11f5ff,_0xa0ef18){_0x11f5ff=_0x11f5ff-0x0;var _0x46eefb=_0xc481[_0x11f5ff];return _0x46eefb;};'use strict';var FaxInteractionEvents=require(_0x1c48('0x0'));var events=[_0x1c48('0x1'),_0x1c48('0x2'),'update'];function createListener(_0xea951,_0x3a13c6){return function(_0x52a9ef){_0x3a13c6[_0x1c48('0x3')](_0xea951,_0x52a9ef);};}function removeListener(_0x500093,_0x53b2dc){return function(){FaxInteractionEvents['removeListener'](_0x500093,_0x53b2dc);};}exports['register']=function(_0x1f3c32){for(var _0x21387c=0x0,_0x4ccc57=events['length'];_0x21387c<_0x4ccc57;_0x21387c++){var _0xab5dc9=events[_0x21387c];var _0x435533=createListener(_0x1c48('0x4')+_0xab5dc9,_0x1f3c32);FaxInteractionEvents['on'](_0xab5dc9,_0x435533);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 30fe830..21b1b49 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 _0xf2a0=['download','post','create','addMessage','tracked','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','/:id','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','show','/:id/messages','/:id/download'];(function(_0x2e198c,_0x1147e4){var _0x57f3e0=function(_0x5c4cbd){while(--_0x5c4cbd){_0x2e198c['push'](_0x2e198c['shift']());}};_0x57f3e0(++_0x1147e4);}(_0xf2a0,0xc4));var _0x0f2a=function(_0x5d92c2,_0x26d815){_0x5d92c2=_0x5d92c2-0x0;var _0x415601=_0xf2a0[_0x5d92c2];return _0x415601;};'use strict';var multer=require(_0x0f2a('0x0'));var util=require(_0x0f2a('0x1'));var path=require(_0x0f2a('0x2'));var timeout=require(_0x0f2a('0x3'));var express=require('express');var router=express[_0x0f2a('0x4')]();var fs_extra=require(_0x0f2a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0f2a('0x6'));var config=require('../../config/environment');var controller=require('./faxInteraction.controller');router[_0x0f2a('0x7')]('/',auth[_0x0f2a('0x8')](),controller[_0x0f2a('0x9')]);router[_0x0f2a('0x7')](_0x0f2a('0xa'),auth[_0x0f2a('0x8')](),controller['describe']);router[_0x0f2a('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x0f2a('0xb')]);router[_0x0f2a('0x7')](_0x0f2a('0xc'),auth[_0x0f2a('0x8')](),controller['getMessages']);router[_0x0f2a('0x7')](_0x0f2a('0xd'),auth['isAuthenticated'](),controller[_0x0f2a('0xe')]);router[_0x0f2a('0xf')]('/',auth[_0x0f2a('0x8')](),controller[_0x0f2a('0x10')]);router[_0x0f2a('0xf')](_0x0f2a('0xc'),auth[_0x0f2a('0x8')](),controller[_0x0f2a('0x11')]);router[_0x0f2a('0xf')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0f2a('0x12')]('fax',_0x0f2a('0x13')),controller[_0x0f2a('0x14')]);router[_0x0f2a('0x15')]('/:id',auth[_0x0f2a('0x8')](),interaction[_0x0f2a('0x12')]('fax',_0x0f2a('0x16')),controller[_0x0f2a('0x17')]);router[_0x0f2a('0x18')](_0x0f2a('0x19'),auth[_0x0f2a('0x8')](),interaction['tracked']('fax',_0x0f2a('0x1a')),controller['destroy']);router[_0x0f2a('0x18')](_0x0f2a('0x1b'),auth[_0x0f2a('0x8')](),controller[_0x0f2a('0x1c')]);module[_0x0f2a('0x1d')]=router; \ No newline at end of file +var _0x049e=['faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','describe','/:id/download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','/:id'];(function(_0x249800,_0x3e4ce2){var _0x45b7c1=function(_0x154c2c){while(--_0x154c2c){_0x249800['push'](_0x249800['shift']());}};_0x45b7c1(++_0x3e4ce2);}(_0x049e,0x72));var _0xe049=function(_0xc14df7,_0x163f90){_0xc14df7=_0xc14df7-0x0;var _0x34a445=_0x049e[_0xc14df7];return _0x34a445;};'use strict';var multer=require(_0xe049('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe049('0x1'));var express=require(_0xe049('0x2'));var router=express['Router']();var fs_extra=require(_0xe049('0x3'));var auth=require(_0xe049('0x4'));var interaction=require(_0xe049('0x5'));var config=require(_0xe049('0x6'));var controller=require(_0xe049('0x7'));router[_0xe049('0x8')]('/',auth[_0xe049('0x9')](),controller[_0xe049('0xa')]);router[_0xe049('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xe049('0xb')]);router[_0xe049('0x8')]('/:id',auth[_0xe049('0x9')](),controller['show']);router[_0xe049('0x8')]('/:id/messages',auth[_0xe049('0x9')](),controller['getMessages']);router[_0xe049('0x8')](_0xe049('0xc'),auth[_0xe049('0x9')](),controller['download']);router[_0xe049('0xd')]('/',auth[_0xe049('0x9')](),controller[_0xe049('0xe')]);router[_0xe049('0xd')]('/:id/messages',auth[_0xe049('0x9')](),controller['addMessage']);router['post'](_0xe049('0xf'),auth[_0xe049('0x9')](),interaction[_0xe049('0x10')](_0xe049('0x11'),_0xe049('0x12')),controller[_0xe049('0x13')]);router['put'](_0xe049('0x14'),auth[_0xe049('0x9')](),interaction[_0xe049('0x10')](_0xe049('0x11'),_0xe049('0x15')),controller[_0xe049('0x16')]);router[_0xe049('0x17')]('/:id',auth['isAuthenticated'](),interaction[_0xe049('0x10')](_0xe049('0x11'),_0xe049('0x18')),controller['destroy']);router[_0xe049('0x17')](_0xe049('0xf'),auth['isAuthenticated'](),controller[_0xe049('0x19')]);module[_0xe049('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 34251b0..a1f3ee9 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 _0x5c12=['out','DATE','exports','TEXT','BOOLEAN','ENUM'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x5c12,0x188));var _0x25c1=function(_0x11d95f,_0x34f442){_0x11d95f=_0x11d95f-0x0;var _0x2b1a14=_0x5c12[_0x11d95f];return _0x2b1a14;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'body':{'type':Sequelize[_0x25c1('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x25c1('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x25c1('0x3')]('in',_0x25c1('0x4')),'defaultValue':_0x25c1('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x25c1('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x25c1('0x5')]}}; \ No newline at end of file +var _0x5fc7=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x55c8e3,_0x4addd4){var _0x7e6c2c=function(_0x8a08f2){while(--_0x8a08f2){_0x55c8e3['push'](_0x55c8e3['shift']());}};_0x7e6c2c(++_0x4addd4);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0x5fc7[_0x2b9b7f];return _0x4ed19a;};'use strict';var Sequelize=require(_0x75fc('0x0'));module[_0x75fc('0x1')]={'body':{'type':Sequelize[_0x75fc('0x2')](_0x75fc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x75fc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x75fc('0x5')]('in',_0x75fc('0x6')),'defaultValue':_0x75fc('0x6'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x75fc('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x75fc('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index c876f99..ba8e151 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 _0xae3f=['motionChannel','event','acceptmessage','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','fullname','internal','EventManager','rejectmessage','create','CmContact','findOne','isNil','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','destroy','sendStatus','stack','name','send','FaxMessage','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','params','keys','includeAll','body','find','describe','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','read1stAt','format','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','AcceptMessage','acceptMessage','ContactId','Sequelize','QueryTypes','SELECT','contact','User','email','interface','SIP/%s','channel'];(function(_0x5823df,_0x37068a){var _0x21d1aa=function(_0x1300da){while(--_0x1300da){_0x5823df['push'](_0x5823df['shift']());}};_0x21d1aa(++_0x37068a);}(_0xae3f,0xac));var _0xfae3=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0xae3f[_0x45f951];return _0x24756c;};'use strict';var emlformat=require(_0xfae3('0x0'));var rimraf=require(_0xfae3('0x1'));var zipdir=require(_0xfae3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfae3('0x3'));var moment=require(_0xfae3('0x4'));var BPromise=require(_0xfae3('0x5'));var Mustache=require(_0xfae3('0x6'));var util=require(_0xfae3('0x7'));var path=require(_0xfae3('0x8'));var sox=require(_0xfae3('0x9'));var csv=require('to-csv');var ejs=require(_0xfae3('0xa'));var fs=require('fs');var fs_extra=require(_0xfae3('0xb'));var _=require(_0xfae3('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xfae3('0xd'));var deskjs=require(_0xfae3('0xe'));var toCsv=require(_0xfae3('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfae3('0x10'));var authService=require(_0xfae3('0x11'));var qs=require(_0xfae3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfae3('0x13'))(_0xfae3('0x14'));var utils=require(_0xfae3('0x15'));var config=require(_0xfae3('0x16'));var licenseUtil=require(_0xfae3('0x17'));var db=require(_0xfae3('0x18'))['db'];config[_0xfae3('0x19')]=_[_0xfae3('0x1a')](config[_0xfae3('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xfae3('0x1b'))(new Redis(config[_0xfae3('0x19')]));require(_0xfae3('0x1c'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfae3('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0xfae3('0x1d')][_0xfae3('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x5c3f55,_0x321fcd,_0x183bc4,_0x29b69a){return new BPromise(function(_0x408392,_0x20d5b5){var _0x165101=_0x29b69a||client;return _0x165101[_0xfae3('0x1f')](_0x5c3f55,_0x183bc4)[_0xfae3('0x20')](function(_0x45dc83){logger[_0xfae3('0x21')](_0xfae3('0x22'),_0x321fcd,_0xfae3('0x23'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x321fcd,_0xfae3('0x23'),JSON['stringify'](_0x45dc83));if(_0x45dc83[_0xfae3('0x24')]){if(_0x45dc83[_0xfae3('0x24')][_0xfae3('0x25')]===0x1f4){logger['error'](_0xfae3('0x22'),_0x321fcd,_0x45dc83['error'][_0xfae3('0x26')]);return _0x20d5b5(_0x45dc83[_0xfae3('0x24')][_0xfae3('0x26')]);}logger[_0xfae3('0x24')]('FaxMessage,\x20%s,\x20%s',_0x321fcd,_0x45dc83[_0xfae3('0x24')][_0xfae3('0x26')]);return _0x408392(_0x45dc83[_0xfae3('0x24')][_0xfae3('0x26')]);}else{logger[_0xfae3('0x21')]('FaxMessage,\x20%s,\x20%s',_0x321fcd,_0xfae3('0x23'));_0x408392(_0x45dc83[_0xfae3('0x27')]['message']);}})[_0xfae3('0x28')](function(_0x47d1cd){logger[_0xfae3('0x24')](_0xfae3('0x22'),_0x321fcd,_0x47d1cd);_0x20d5b5(_0x47d1cd);});});}function respondWithStatusCode(_0x292e72,_0x5a312a){_0x5a312a=_0x5a312a||0xcc;return function(_0x5e12da){if(_0x5e12da){return _0x292e72['sendStatus'](_0x5a312a);}return _0x292e72[_0xfae3('0x29')](_0x5a312a)[_0xfae3('0x2a')]();};}function respondWithResult(_0x5bb371,_0xd389ff){_0xd389ff=_0xd389ff||0xc8;return function(_0x31f11f){if(_0x31f11f){return _0x5bb371[_0xfae3('0x29')](_0xd389ff)[_0xfae3('0x2b')](_0x31f11f);}};}function respondWithFilteredResult(_0x881cc3,_0x4792f8){return function(_0x3e516e){if(_0x3e516e){var _0x5ee309=typeof _0x4792f8['offset']===_0xfae3('0x2c')&&typeof _0x4792f8['limit']===_0xfae3('0x2c');var _0x2caa36=_0x3e516e[_0xfae3('0x2d')];var _0x4f810f=_0x5ee309?0x0:_0x4792f8[_0xfae3('0x2e')];var _0x34bef4=_0x5ee309?_0x3e516e[_0xfae3('0x2d')]:_0x4792f8[_0xfae3('0x2e')]+_0x4792f8[_0xfae3('0x2f')];var _0x241e59;if(_0x34bef4>=_0x2caa36){_0x34bef4=_0x2caa36;_0x241e59=0xc8;}else{_0x241e59=0xce;}_0x881cc3[_0xfae3('0x29')](_0x241e59);return _0x881cc3[_0xfae3('0x30')]('Content-Range',_0x4f810f+'-'+_0x34bef4+'/'+_0x2caa36)[_0xfae3('0x2b')](_0x3e516e);}return null;};}function patchUpdates(_0x302f82){return function(_0x557b31){try{jsonpatch[_0xfae3('0x31')](_0x557b31,_0x302f82,!![]);}catch(_0x483ab5){return BPromise[_0xfae3('0x32')](_0x483ab5);}return _0x557b31[_0xfae3('0x33')]();};}function saveUpdates(_0x2d7468,_0xc6326){return function(_0x287c7c){if(_0x287c7c){return _0x287c7c[_0xfae3('0x34')](_0x2d7468)[_0xfae3('0x20')](function(_0x6019b8){return _0x6019b8;});}return null;};}function removeEntity(_0x5a1b2d,_0x534df9){return function(_0x365408){if(_0x365408){return _0x365408[_0xfae3('0x35')]()[_0xfae3('0x20')](function(){_0x5a1b2d['status'](0xcc)[_0xfae3('0x2a')]();});}};}function handleEntityNotFound(_0x319dd2,_0x1e6a40){return function(_0x297456){if(!_0x297456){_0x319dd2[_0xfae3('0x36')](0x194);}return _0x297456;};}function handleError(_0x163778,_0x1575c9){_0x1575c9=_0x1575c9||0x1f4;return function(_0x52cdb4){logger[_0xfae3('0x24')](_0x52cdb4[_0xfae3('0x37')]);if(_0x52cdb4[_0xfae3('0x38')]){delete _0x52cdb4[_0xfae3('0x38')];}_0x163778[_0xfae3('0x29')](_0x1575c9)[_0xfae3('0x39')](_0x52cdb4);};}exports['index']=function(_0x5192d7,_0x5395f0){var _0x2fed99={},_0x11f73e={},_0x3cf685={'count':0x0,'rows':[]};var _0x1f4cc9=_['map'](db[_0xfae3('0x3a')]['rawAttributes'],function(_0x1d7f3c){return{'name':_0x1d7f3c[_0xfae3('0x3b')],'type':_0x1d7f3c[_0xfae3('0x3c')][_0xfae3('0x3d')]};});_0x11f73e[_0xfae3('0x3e')]=_[_0xfae3('0x3f')](_0x1f4cc9,_0xfae3('0x38'));_0x11f73e[_0xfae3('0x40')]=_['keys'](_0x5192d7['query']);_0x11f73e[_0xfae3('0x41')]=_[_0xfae3('0x42')](_0x11f73e[_0xfae3('0x3e')],_0x11f73e['query']);_0x2fed99['attributes']=_[_0xfae3('0x42')](_0x11f73e[_0xfae3('0x3e')],qs[_0xfae3('0x43')](_0x5192d7[_0xfae3('0x40')][_0xfae3('0x43')]));_0x2fed99[_0xfae3('0x44')]=_0x2fed99[_0xfae3('0x44')][_0xfae3('0x45')]?_0x2fed99[_0xfae3('0x44')]:_0x11f73e['model'];if(!_0x5192d7[_0xfae3('0x40')][_0xfae3('0x46')](_0xfae3('0x47'))){_0x2fed99[_0xfae3('0x2f')]=qs[_0xfae3('0x2f')](_0x5192d7[_0xfae3('0x40')]['limit']);_0x2fed99['offset']=qs[_0xfae3('0x2e')](_0x5192d7['query'][_0xfae3('0x2e')]);}_0x2fed99[_0xfae3('0x48')]=qs[_0xfae3('0x49')](_0x5192d7[_0xfae3('0x40')][_0xfae3('0x49')]);_0x2fed99[_0xfae3('0x4a')]=qs['filters'](_[_0xfae3('0x4b')](_0x5192d7[_0xfae3('0x40')],_0x11f73e[_0xfae3('0x41')]),_0x1f4cc9);if(_0x5192d7[_0xfae3('0x40')]['filter']){_0x2fed99['where']=_[_0xfae3('0x4c')](_0x2fed99[_0xfae3('0x4a')],{'$or':_[_0xfae3('0x3f')](_0x1f4cc9,function(_0x243c43){if(_0x243c43[_0xfae3('0x3c')]!==_0xfae3('0x4d')){var _0x28a614={};_0x28a614[_0x243c43[_0xfae3('0x38')]]={'$like':'%'+_0x5192d7['query']['filter']+'%'};return _0x28a614;}})});}_0x2fed99=_[_0xfae3('0x4c')]({},_0x2fed99,_0x5192d7[_0xfae3('0x4e')]);var _0x37d1cf={'where':_0x2fed99[_0xfae3('0x4a')]};return db[_0xfae3('0x3a')][_0xfae3('0x2d')](_0x37d1cf)[_0xfae3('0x20')](function(_0x18ab0d){_0x3cf685[_0xfae3('0x2d')]=_0x18ab0d;if(_0x5192d7[_0xfae3('0x40')]['includeAll']){_0x2fed99[_0xfae3('0x4f')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2fed99);})[_0xfae3('0x20')](function(_0x58828f){_0x3cf685['rows']=_0x58828f;return _0x3cf685;})[_0xfae3('0x20')](respondWithFilteredResult(_0x5395f0,_0x2fed99))[_0xfae3('0x28')](handleError(_0x5395f0,null));};exports['show']=function(_0x54f9b4,_0x50eb89){var _0x1862c7={'raw':!![],'where':{'id':_0x54f9b4[_0xfae3('0x50')]['id']}},_0x27f590={};_0x27f590[_0xfae3('0x3e')]=_[_0xfae3('0x51')](db['FaxMessage']['rawAttributes']);_0x27f590[_0xfae3('0x40')]=_[_0xfae3('0x51')](_0x54f9b4[_0xfae3('0x40')]);_0x27f590[_0xfae3('0x41')]=_[_0xfae3('0x42')](_0x27f590[_0xfae3('0x3e')],_0x27f590[_0xfae3('0x40')]);_0x1862c7[_0xfae3('0x44')]=_[_0xfae3('0x42')](_0x27f590['model'],qs[_0xfae3('0x43')](_0x54f9b4['query']['fields']));_0x1862c7['attributes']=_0x1862c7[_0xfae3('0x44')][_0xfae3('0x45')]?_0x1862c7[_0xfae3('0x44')]:_0x27f590[_0xfae3('0x3e')];if(_0x54f9b4[_0xfae3('0x40')][_0xfae3('0x52')]){_0x1862c7[_0xfae3('0x4f')]=[{'all':!![]}];}_0x1862c7=_['merge']({},_0x1862c7,_0x54f9b4['options']);return db['FaxMessage']['find'](_0x1862c7)[_0xfae3('0x20')](handleEntityNotFound(_0x50eb89,null))[_0xfae3('0x20')](respondWithResult(_0x50eb89,null))[_0xfae3('0x28')](handleError(_0x50eb89,null));};exports['update']=function(_0x2ea3fe,_0x56142f){if(_0x2ea3fe['body']['id']){delete _0x2ea3fe[_0xfae3('0x53')]['id'];}return db['FaxMessage']['find']({'where':{'id':_0x2ea3fe[_0xfae3('0x50')]['id']}})['then'](handleEntityNotFound(_0x56142f,null))['then'](saveUpdates(_0x2ea3fe[_0xfae3('0x53')],null))[_0xfae3('0x20')](respondWithResult(_0x56142f,null))[_0xfae3('0x28')](handleError(_0x56142f,null));};exports[_0xfae3('0x35')]=function(_0x51e38e,_0x341c5f){return db[_0xfae3('0x3a')][_0xfae3('0x54')]({'where':{'id':_0x51e38e[_0xfae3('0x50')]['id']}})[_0xfae3('0x20')](handleEntityNotFound(_0x341c5f,null))[_0xfae3('0x20')](removeEntity(_0x341c5f,null))[_0xfae3('0x28')](handleError(_0x341c5f,null));};exports[_0xfae3('0x55')]=function(_0x4bc04a,_0x51aa79){return db[_0xfae3('0x3a')][_0xfae3('0x55')]()[_0xfae3('0x20')](respondWithResult(_0x51aa79,null))[_0xfae3('0x28')](handleError(_0x51aa79,null));};var interaction_log=require(_0xfae3('0x13'))(_0xfae3('0x56'));exports[_0xfae3('0x57')]=function(_0x23f17d,_0xe0ce6b,_0x56b0de){var _0x48f693={'agent':{},'channel':_0xfae3('0x58')};if(_0x23f17d[_0xfae3('0x53')]['id']){delete _0x23f17d['body']['id'];}_0x23f17d[_0xfae3('0x53')]['read']=!![];_0x23f17d[_0xfae3('0x53')][_0xfae3('0x59')]=moment()['format'](_0xfae3('0x5a'));_0x23f17d['body'][_0xfae3('0x5b')]=_0x23f17d['body'][_0xfae3('0x5b')]||_0x23f17d[_0xfae3('0x5c')]['id'];_0x48f693[_0xfae3('0x5d')]['id']=_0x23f17d[_0xfae3('0x53')][_0xfae3('0x5b')];return db[_0xfae3('0x3a')][_0xfae3('0x54')]({'where':{'id':_0x23f17d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0xe0ce6b,null))[_0xfae3('0x20')](saveUpdates(_0x23f17d[_0xfae3('0x53')],null))[_0xfae3('0x20')](function(_0x12d1e8){if(_0x12d1e8){_0x48f693[_0xfae3('0x26')]=_0x12d1e8[_0xfae3('0x5e')]({'plain':!![]});return db[_0xfae3('0x5f')][_0xfae3('0x54')]({'where':{'id':_0x12d1e8['FaxInteractionId']}});}return null;})[_0xfae3('0x20')](handleEntityNotFound(_0xe0ce6b,null))['then'](function(_0x2e86c0){if(_0x2e86c0){return _0x2e86c0['update']({'UserId':_0x23f17d['body'][_0xfae3('0x5b')],'read1stAt':_['isNil'](_0x2e86c0[_0xfae3('0x60')])?moment()[_0xfae3('0x61')](_0xfae3('0x5a')):undefined});}return null;})['then'](function(_0x3f7825){if(_0x3f7825){_0x48f693[_0xfae3('0x62')]=_0x3f7825['get']({'plain':!![]});interaction_log[_0xfae3('0x21')](_0xfae3('0x63'),_0x23f17d[_0xfae3('0x5c')]['id'],_0x23f17d[_0xfae3('0x5c')][_0xfae3('0x38')],_0x23f17d['user'][_0xfae3('0x64')],_0x48f693['interaction']['id'],_0x23f17d['body']?JSON[_0xfae3('0x65')](_0x23f17d[_0xfae3('0x53')]):'null');return respondWithRpcPromise(_0xfae3('0x66'),_0xfae3('0x67'),_0x48f693);}return null;})[_0xfae3('0x20')](function(_0x25e414){var _0x344a16='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x25e414['message'][_0xfae3('0x68')];return db['sequelize'][_0xfae3('0x40')](_0x344a16,{'type':db[_0xfae3('0x69')][_0xfae3('0x6a')][_0xfae3('0x6b')],'raw':!![]})['then'](function(_0x2c798b){return _0x2c798b;});})[_0xfae3('0x20')](function(_0x122351){if(_0x122351){_0x48f693['message'][_0xfae3('0x6c')]=_0x122351[0x0];if(!_0x23f17d['body'][_0xfae3('0x5b')])return;return db[_0xfae3('0x6d')][_0xfae3('0x54')]({'where':{'id':_0x23f17d[_0xfae3('0x53')][_0xfae3('0x5b')],'role':_0xfae3('0x5d')},'attributes':['id',_0xfae3('0x38'),'fullname',_0xfae3('0x6e'),'internal'],'raw':!![]});}return null;})[_0xfae3('0x20')](function(_0x40a287){if(!_0x40a287)return null;_0x48f693[_0xfae3('0x26')][_0xfae3('0x5d')]=_0x40a287;return _0x48f693;})['then'](function(_0x544f8a){if(_0x544f8a){if(_0x23f17d[_0xfae3('0x53')]['manual']){_0x48f693['message'][_0xfae3('0x6f')]=util['format'](_0xfae3('0x70'),_0x23f17d[_0xfae3('0x5c')][_0xfae3('0x38')]);_0x48f693[_0xfae3('0x26')][_0xfae3('0x71')]=_0x48f693['channel'];_0x48f693[_0xfae3('0x26')][_0xfae3('0x72')]=_0x48f693[_0xfae3('0x71')];_0x48f693[_0xfae3('0x26')][_0xfae3('0x73')]=_0xfae3('0x57');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xfae3('0x74'),'message':_0x48f693['message']},client9002)[_0xfae3('0x20')](function(){return _0x48f693;});}return _0x48f693;}return null;})[_0xfae3('0x20')](respondWithResult(_0xe0ce6b,null))[_0xfae3('0x28')](handleError(_0xe0ce6b,null));};var interaction_log=require(_0xfae3('0x13'))(_0xfae3('0x56'));exports[_0xfae3('0x32')]=function(_0x4f9e8a,_0x3b4015,_0x4fcd39){var _0x277434={'agent':{},'channel':_0xfae3('0x58')};if(_0x4f9e8a[_0xfae3('0x53')]['id']){delete _0x4f9e8a[_0xfae3('0x53')]['id'];}_0x4f9e8a[_0xfae3('0x53')][_0xfae3('0x5b')]=_0x4f9e8a['body']['UserId']||_0x4f9e8a[_0xfae3('0x5c')]['id'];_0x277434[_0xfae3('0x5d')]['id']=_0x4f9e8a[_0xfae3('0x53')][_0xfae3('0x5b')];return db[_0xfae3('0x3a')]['find']({'where':{'id':_0x4f9e8a['params']['id'],'UserId':null}})[_0xfae3('0x20')](handleEntityNotFound(_0x3b4015,null))[_0xfae3('0x20')](function(_0x3e3655){if(_0x3e3655){_0x277434[_0xfae3('0x26')]=_0x3e3655[_0xfae3('0x5e')]({'plain':!![]});return db['FaxInteraction'][_0xfae3('0x54')]({'where':{'id':_0x3e3655[_0xfae3('0x75')]}});}return null;})[_0xfae3('0x20')](handleEntityNotFound(_0x3b4015,null))[_0xfae3('0x20')](function(_0x5da12d){if(_0x5da12d){_0x277434['interaction']=_0x5da12d[_0xfae3('0x5e')]({'plain':!![]});interaction_log['info'](_0xfae3('0x76'),_0x4f9e8a['user']['id'],_0x4f9e8a['user']['name'],_0x4f9e8a['user'][_0xfae3('0x64')],_0x277434['interaction']['id'],_0x4f9e8a[_0xfae3('0x53')]?JSON[_0xfae3('0x65')](_0x4f9e8a[_0xfae3('0x53')]):_0xfae3('0x77'));return respondWithRpcPromise(_0xfae3('0x78'),_0xfae3('0x79'),_0x277434);}return null;})[_0xfae3('0x20')](function(_0x368ccb){var _0x291fd7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x368ccb[_0xfae3('0x26')][_0xfae3('0x68')];return db[_0xfae3('0x7a')][_0xfae3('0x40')](_0x291fd7,{'type':db[_0xfae3('0x69')]['QueryTypes'][_0xfae3('0x6b')],'raw':!![]})[_0xfae3('0x20')](function(_0x2281db){return _0x2281db;});})[_0xfae3('0x20')](function(_0x42a871){if(_0x42a871){_0x277434[_0xfae3('0x26')][_0xfae3('0x6c')]=_0x42a871[0x0];if(!_0x4f9e8a[_0xfae3('0x53')][_0xfae3('0x5b')])return;return db[_0xfae3('0x6d')][_0xfae3('0x54')]({'where':{'id':_0x4f9e8a['body'][_0xfae3('0x5b')],'role':_0xfae3('0x5d')},'attributes':['id',_0xfae3('0x38'),_0xfae3('0x7b'),_0xfae3('0x6e'),_0xfae3('0x7c')],'raw':!![]});}return null;})['then'](function(_0x40b8cd){if(!_0x40b8cd)return null;_0x277434[_0xfae3('0x26')]['agent']=_0x40b8cd;return _0x277434;})[_0xfae3('0x20')](function(_0x18a160){if(_0x18a160){_0x18a160[_0xfae3('0x26')][_0xfae3('0x6f')]=util[_0xfae3('0x61')](_0xfae3('0x70'),_0x4f9e8a['user']['name']);_0x18a160['message'][_0xfae3('0x71')]=_0x277434[_0xfae3('0x71')];_0x18a160[_0xfae3('0x26')][_0xfae3('0x72')]=_0x277434[_0xfae3('0x71')];_0x18a160['message']['event']=_0xfae3('0x32');respondWithRpcPromise(_0xfae3('0x7d'),_0xfae3('0x7d'),{'event':_0xfae3('0x7e'),'message':_0x18a160[_0xfae3('0x26')]},client9002);return _0x277434;}return null;})['then'](respondWithResult(_0x3b4015,null))[_0xfae3('0x28')](handleError(_0x3b4015,null));};exports[_0xfae3('0x7f')]=function(_0x58a9d3,_0x2e62fc){var _0xd4ec69;return db[_0xfae3('0x3a')][_0xfae3('0x7f')](_0x58a9d3['body'],{})['then'](function(_0x54ea2a){_0xd4ec69=_0x54ea2a;return db[_0xfae3('0x80')][_0xfae3('0x81')]({'where':{'id':_0xd4ec69[_0xfae3('0x68')]}});})['then'](function(_0x34be4b){if(_[_0xfae3('0x82')](_0x34be4b)){return;}else{_0xd4ec69[_0xfae3('0x58')]=_0x34be4b['fax'];return db['Attachment'][_0xfae3('0x81')]({'where':{'id':_0xd4ec69[_0xfae3('0x83')]}});}})[_0xfae3('0x20')](function(_0x48ee04){return respondWithRpcPromise(_0xfae3('0x84'),_0xfae3('0x84'),{'FaxAccountId':_[_0xfae3('0x82')](_0x58a9d3[_0xfae3('0x53')])?undefined:_0x58a9d3[_0xfae3('0x53')][_0xfae3('0x85')],'path':_['isNil'](_0x48ee04)?undefined:util[_0xfae3('0x61')](_0xfae3('0x86'),_0x48ee04[_0xfae3('0x87')]),'fax':_['isNil'](_0xd4ec69[_0xfae3('0x58')])?undefined:_0xd4ec69[_0xfae3('0x58')],'AttachmentId':_0xd4ec69[_0xfae3('0x83')]},client9002);})[_0xfae3('0x20')](respondWithResult(_0x2e62fc,0xc9))['catch'](handleError(_0x2e62fc,null));};exports[_0xfae3('0x88')]=function(_0x452f2a,_0xb5a78e){var _0x449de3=path[_0xfae3('0x89')](config[_0xfae3('0x8a')],_0xfae3('0x8b'),_0xfae3('0x8c'),_0xfae3('0x8d'));return db['FaxMessage'][_0xfae3('0x54')]({'where':{'id':_0x452f2a[_0xfae3('0x50')]['id']},'include':[{'model':db[_0xfae3('0x8e')],'as':_0xfae3('0x8e')}]})[_0xfae3('0x20')](handleEntityNotFound(_0xb5a78e,null))[_0xfae3('0x20')](function(_0x22ab4f){if(_0x22ab4f){return _0xb5a78e[_0xfae3('0x88')](path[_0xfae3('0x89')](_0x449de3,_0x22ab4f['Attachment'][_0xfae3('0x87')]));}})['catch'](handleError(_0xb5a78e,null));}; \ No newline at end of file +var _0xcec8=['agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','rejectmessage','create','CmContact','findOne','Attachment','AttachmentId','SendFax','FaxAccountId','basename','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','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','redis','defaults','socket.io-emitter','./faxMessage.socket','register','client','http','request','then','info','request\x20sent','debug','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','stack','name','send','index','map','FaxMessage','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','body','find','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','get','FaxInteraction','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','ContactId','sequelize','Sequelize','SELECT','contact','User'];(function(_0x34068f,_0x5758e4){var _0x351894=function(_0x3cd4b4){while(--_0x3cd4b4){_0x34068f['push'](_0x34068f['shift']());}};_0x351894(++_0x5758e4);}(_0xcec8,0x148));var _0x8cec=function(_0x112fe3,_0x16b642){_0x112fe3=_0x112fe3-0x0;var _0x1ec903=_0xcec8[_0x112fe3];return _0x1ec903;};'use strict';var emlformat=require(_0x8cec('0x0'));var rimraf=require(_0x8cec('0x1'));var zipdir=require(_0x8cec('0x2'));var jsonpatch=require(_0x8cec('0x3'));var rp=require(_0x8cec('0x4'));var moment=require(_0x8cec('0x5'));var BPromise=require(_0x8cec('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8cec('0x7'));var sox=require(_0x8cec('0x8'));var csv=require(_0x8cec('0x9'));var ejs=require(_0x8cec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cec('0xb'));var squel=require(_0x8cec('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8cec('0xd'));var toCsv=require(_0x8cec('0x9'));var querystring=require(_0x8cec('0xe'));var Papa=require(_0x8cec('0xf'));var Redis=require(_0x8cec('0x10'));var authService=require(_0x8cec('0x11'));var qs=require(_0x8cec('0x12'));var as=require(_0x8cec('0x13'));var hardwareService=require(_0x8cec('0x14'));var logger=require(_0x8cec('0x15'))(_0x8cec('0x16'));var utils=require(_0x8cec('0x17'));var config=require(_0x8cec('0x18'));var licenseUtil=require(_0x8cec('0x19'));var db=require(_0x8cec('0x1a'))['db'];config[_0x8cec('0x1b')]=_[_0x8cec('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8cec('0x1d'))(new Redis(config[_0x8cec('0x1b')]));require(_0x8cec('0x1e'))[_0x8cec('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8cec('0x20')][_0x8cec('0x21')]({'port':0x232c});var client9002=jayson[_0x8cec('0x20')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27aa44,_0x54062b,_0x50595f,_0x4e5cd1){return new BPromise(function(_0x31cfdc,_0x2e889d){var _0x18fff5=_0x4e5cd1||client;return _0x18fff5[_0x8cec('0x22')](_0x27aa44,_0x50595f)[_0x8cec('0x23')](function(_0x84c7a7){logger[_0x8cec('0x24')]('FaxMessage,\x20%s,\x20%s',_0x54062b,_0x8cec('0x25'));logger[_0x8cec('0x26')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x54062b,_0x8cec('0x25'),JSON[_0x8cec('0x27')](_0x84c7a7));if(_0x84c7a7['error']){if(_0x84c7a7[_0x8cec('0x28')]['code']===0x1f4){logger[_0x8cec('0x28')](_0x8cec('0x29'),_0x54062b,_0x84c7a7['error']['message']);return _0x2e889d(_0x84c7a7[_0x8cec('0x28')][_0x8cec('0x2a')]);}logger['error'](_0x8cec('0x29'),_0x54062b,_0x84c7a7['error'][_0x8cec('0x2a')]);return _0x31cfdc(_0x84c7a7['error'][_0x8cec('0x2a')]);}else{logger[_0x8cec('0x24')](_0x8cec('0x29'),_0x54062b,_0x8cec('0x25'));_0x31cfdc(_0x84c7a7[_0x8cec('0x2b')][_0x8cec('0x2a')]);}})[_0x8cec('0x2c')](function(_0x35ec7e){logger[_0x8cec('0x28')]('FaxMessage,\x20%s,\x20%s',_0x54062b,_0x35ec7e);_0x2e889d(_0x35ec7e);});});}function respondWithStatusCode(_0x5349cc,_0x5e186c){_0x5e186c=_0x5e186c||0xcc;return function(_0x533484){if(_0x533484){return _0x5349cc[_0x8cec('0x2d')](_0x5e186c);}return _0x5349cc['status'](_0x5e186c)['end']();};}function respondWithResult(_0x30ea24,_0x2e2b27){_0x2e2b27=_0x2e2b27||0xc8;return function(_0x5128f5){if(_0x5128f5){return _0x30ea24[_0x8cec('0x2e')](_0x2e2b27)[_0x8cec('0x2f')](_0x5128f5);}};}function respondWithFilteredResult(_0x4526b5,_0x1aabee){return function(_0x3a67d9){if(_0x3a67d9){var _0x385a4e=typeof _0x1aabee['offset']===_0x8cec('0x30')&&typeof _0x1aabee['limit']===_0x8cec('0x30');var _0x443528=_0x3a67d9[_0x8cec('0x31')];var _0x47d5b5=_0x385a4e?0x0:_0x1aabee['offset'];var _0x2917be=_0x385a4e?_0x3a67d9[_0x8cec('0x31')]:_0x1aabee['offset']+_0x1aabee['limit'];var _0x5b1518;if(_0x2917be>=_0x443528){_0x2917be=_0x443528;_0x5b1518=0xc8;}else{_0x5b1518=0xce;}_0x4526b5[_0x8cec('0x2e')](_0x5b1518);return _0x4526b5[_0x8cec('0x32')](_0x8cec('0x33'),_0x47d5b5+'-'+_0x2917be+'/'+_0x443528)[_0x8cec('0x2f')](_0x3a67d9);}return null;};}function patchUpdates(_0x2a0852){return function(_0x340333){try{jsonpatch[_0x8cec('0x34')](_0x340333,_0x2a0852,!![]);}catch(_0x2e9d77){return BPromise[_0x8cec('0x35')](_0x2e9d77);}return _0x340333[_0x8cec('0x36')]();};}function saveUpdates(_0x597ce9,_0x53c47c){return function(_0x12855a){if(_0x12855a){return _0x12855a[_0x8cec('0x37')](_0x597ce9)[_0x8cec('0x23')](function(_0x3f31f2){return _0x3f31f2;});}return null;};}function removeEntity(_0x37dccc,_0x202894){return function(_0x5ece51){if(_0x5ece51){return _0x5ece51[_0x8cec('0x38')]()['then'](function(){_0x37dccc[_0x8cec('0x2e')](0xcc)[_0x8cec('0x39')]();});}};}function handleEntityNotFound(_0x3c70c4,_0x246069){return function(_0x5ace75){if(!_0x5ace75){_0x3c70c4[_0x8cec('0x2d')](0x194);}return _0x5ace75;};}function handleError(_0x48fa41,_0x467b97){_0x467b97=_0x467b97||0x1f4;return function(_0x5c845c){logger[_0x8cec('0x28')](_0x5c845c[_0x8cec('0x3a')]);if(_0x5c845c[_0x8cec('0x3b')]){delete _0x5c845c[_0x8cec('0x3b')];}_0x48fa41[_0x8cec('0x2e')](_0x467b97)[_0x8cec('0x3c')](_0x5c845c);};}exports[_0x8cec('0x3d')]=function(_0x40b630,_0x35c1ff){var _0x2d63d5={},_0x4bf728={},_0x52b314={'count':0x0,'rows':[]};var _0x3e0548=_[_0x8cec('0x3e')](db[_0x8cec('0x3f')][_0x8cec('0x40')],function(_0x2b72b1){return{'name':_0x2b72b1['fieldName'],'type':_0x2b72b1[_0x8cec('0x41')][_0x8cec('0x42')]};});_0x4bf728[_0x8cec('0x43')]=_[_0x8cec('0x3e')](_0x3e0548,_0x8cec('0x3b'));_0x4bf728['query']=_[_0x8cec('0x44')](_0x40b630[_0x8cec('0x45')]);_0x4bf728[_0x8cec('0x46')]=_['intersection'](_0x4bf728[_0x8cec('0x43')],_0x4bf728[_0x8cec('0x45')]);_0x2d63d5['attributes']=_[_0x8cec('0x47')](_0x4bf728['model'],qs[_0x8cec('0x48')](_0x40b630[_0x8cec('0x45')][_0x8cec('0x48')]));_0x2d63d5[_0x8cec('0x49')]=_0x2d63d5['attributes']['length']?_0x2d63d5[_0x8cec('0x49')]:_0x4bf728[_0x8cec('0x43')];if(!_0x40b630[_0x8cec('0x45')][_0x8cec('0x4a')](_0x8cec('0x4b'))){_0x2d63d5[_0x8cec('0x4c')]=qs[_0x8cec('0x4c')](_0x40b630[_0x8cec('0x45')][_0x8cec('0x4c')]);_0x2d63d5[_0x8cec('0x4d')]=qs[_0x8cec('0x4d')](_0x40b630['query']['offset']);}_0x2d63d5[_0x8cec('0x4e')]=qs[_0x8cec('0x4f')](_0x40b630['query']['sort']);_0x2d63d5['where']=qs[_0x8cec('0x46')](_[_0x8cec('0x50')](_0x40b630[_0x8cec('0x45')],_0x4bf728[_0x8cec('0x46')]),_0x3e0548);if(_0x40b630['query'][_0x8cec('0x51')]){_0x2d63d5[_0x8cec('0x52')]=_[_0x8cec('0x53')](_0x2d63d5['where'],{'$or':_[_0x8cec('0x3e')](_0x3e0548,function(_0x427a6f){if(_0x427a6f[_0x8cec('0x41')]!==_0x8cec('0x54')){var _0x22e59f={};_0x22e59f[_0x427a6f[_0x8cec('0x3b')]]={'$like':'%'+_0x40b630[_0x8cec('0x45')][_0x8cec('0x51')]+'%'};return _0x22e59f;}})});}_0x2d63d5=_[_0x8cec('0x53')]({},_0x2d63d5,_0x40b630[_0x8cec('0x55')]);var _0x5760c9={'where':_0x2d63d5[_0x8cec('0x52')]};return db[_0x8cec('0x3f')][_0x8cec('0x31')](_0x5760c9)[_0x8cec('0x23')](function(_0x15ba1f){_0x52b314[_0x8cec('0x31')]=_0x15ba1f;if(_0x40b630[_0x8cec('0x45')][_0x8cec('0x56')]){_0x2d63d5['include']=[{'all':!![]}];}return db[_0x8cec('0x3f')][_0x8cec('0x57')](_0x2d63d5);})[_0x8cec('0x23')](function(_0x2ec705){_0x52b314[_0x8cec('0x58')]=_0x2ec705;return _0x52b314;})[_0x8cec('0x23')](respondWithFilteredResult(_0x35c1ff,_0x2d63d5))[_0x8cec('0x2c')](handleError(_0x35c1ff,null));};exports[_0x8cec('0x59')]=function(_0x1bb111,_0x43c8da){var _0x570c86={'raw':!![],'where':{'id':_0x1bb111[_0x8cec('0x5a')]['id']}},_0x38c194={};_0x38c194[_0x8cec('0x43')]=_[_0x8cec('0x44')](db[_0x8cec('0x3f')]['rawAttributes']);_0x38c194[_0x8cec('0x45')]=_[_0x8cec('0x44')](_0x1bb111[_0x8cec('0x45')]);_0x38c194[_0x8cec('0x46')]=_[_0x8cec('0x47')](_0x38c194[_0x8cec('0x43')],_0x38c194[_0x8cec('0x45')]);_0x570c86[_0x8cec('0x49')]=_[_0x8cec('0x47')](_0x38c194[_0x8cec('0x43')],qs[_0x8cec('0x48')](_0x1bb111[_0x8cec('0x45')]['fields']));_0x570c86[_0x8cec('0x49')]=_0x570c86[_0x8cec('0x49')][_0x8cec('0x5b')]?_0x570c86['attributes']:_0x38c194['model'];if(_0x1bb111[_0x8cec('0x45')][_0x8cec('0x56')]){_0x570c86['include']=[{'all':!![]}];}_0x570c86=_[_0x8cec('0x53')]({},_0x570c86,_0x1bb111[_0x8cec('0x55')]);return db[_0x8cec('0x3f')]['find'](_0x570c86)[_0x8cec('0x23')](handleEntityNotFound(_0x43c8da,null))[_0x8cec('0x23')](respondWithResult(_0x43c8da,null))[_0x8cec('0x2c')](handleError(_0x43c8da,null));};exports[_0x8cec('0x37')]=function(_0x2a03e6,_0x2c6e41){if(_0x2a03e6[_0x8cec('0x5c')]['id']){delete _0x2a03e6[_0x8cec('0x5c')]['id'];}return db['FaxMessage'][_0x8cec('0x5d')]({'where':{'id':_0x2a03e6[_0x8cec('0x5a')]['id']}})[_0x8cec('0x23')](handleEntityNotFound(_0x2c6e41,null))[_0x8cec('0x23')](saveUpdates(_0x2a03e6[_0x8cec('0x5c')],null))['then'](respondWithResult(_0x2c6e41,null))[_0x8cec('0x2c')](handleError(_0x2c6e41,null));};exports['destroy']=function(_0x4ca680,_0x419304){return db[_0x8cec('0x3f')][_0x8cec('0x5d')]({'where':{'id':_0x4ca680[_0x8cec('0x5a')]['id']}})[_0x8cec('0x23')](handleEntityNotFound(_0x419304,null))[_0x8cec('0x23')](removeEntity(_0x419304,null))[_0x8cec('0x2c')](handleError(_0x419304,null));};exports[_0x8cec('0x5e')]=function(_0x49ce0c,_0x48f4e4){return db[_0x8cec('0x3f')]['describe']()[_0x8cec('0x23')](respondWithResult(_0x48f4e4,null))['catch'](handleError(_0x48f4e4,null));};var interaction_log=require(_0x8cec('0x15'))(_0x8cec('0x5f'));exports[_0x8cec('0x60')]=function(_0x447371,_0x106272,_0x200298){var _0x5cbe3b={'agent':{},'channel':_0x8cec('0x61')};if(_0x447371[_0x8cec('0x5c')]['id']){delete _0x447371['body']['id'];}_0x447371[_0x8cec('0x5c')][_0x8cec('0x62')]=!![];_0x447371[_0x8cec('0x5c')][_0x8cec('0x63')]=moment()[_0x8cec('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')]=_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')]||_0x447371[_0x8cec('0x66')]['id'];_0x5cbe3b['agent']['id']=_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')];return db[_0x8cec('0x3f')][_0x8cec('0x5d')]({'where':{'id':_0x447371['params']['id'],'UserId':null}})[_0x8cec('0x23')](handleEntityNotFound(_0x106272,null))[_0x8cec('0x23')](saveUpdates(_0x447371[_0x8cec('0x5c')],null))[_0x8cec('0x23')](function(_0x47714f){if(_0x47714f){_0x5cbe3b[_0x8cec('0x2a')]=_0x47714f[_0x8cec('0x67')]({'plain':!![]});return db[_0x8cec('0x68')]['find']({'where':{'id':_0x47714f['FaxInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x106272,null))['then'](function(_0x3ef00a){if(_0x3ef00a){return _0x3ef00a[_0x8cec('0x37')]({'UserId':_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')],'read1stAt':_[_0x8cec('0x69')](_0x3ef00a[_0x8cec('0x6a')])?moment()[_0x8cec('0x64')](_0x8cec('0x6b')):undefined});}return null;})[_0x8cec('0x23')](function(_0x54bc55){if(_0x54bc55){_0x5cbe3b['interaction']=_0x54bc55['get']({'plain':!![]});interaction_log[_0x8cec('0x24')](_0x8cec('0x6c'),_0x447371[_0x8cec('0x66')]['id'],_0x447371['user'][_0x8cec('0x3b')],_0x447371[_0x8cec('0x66')][_0x8cec('0x6d')],_0x5cbe3b[_0x8cec('0x6e')]['id'],_0x447371[_0x8cec('0x5c')]?JSON['stringify'](_0x447371['body']):_0x8cec('0x6f'));return respondWithRpcPromise('AcceptMessage',_0x8cec('0x70'),_0x5cbe3b);}return null;})[_0x8cec('0x23')](function(_0x4eba33){var _0x4b8c98='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4eba33[_0x8cec('0x2a')][_0x8cec('0x71')];return db[_0x8cec('0x72')][_0x8cec('0x45')](_0x4b8c98,{'type':db[_0x8cec('0x73')]['QueryTypes'][_0x8cec('0x74')],'raw':!![]})[_0x8cec('0x23')](function(_0x3d4333){return _0x3d4333;});})[_0x8cec('0x23')](function(_0xbdc08f){if(_0xbdc08f){_0x5cbe3b['message'][_0x8cec('0x75')]=_0xbdc08f[0x0];if(!_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')])return;return db[_0x8cec('0x76')][_0x8cec('0x5d')]({'where':{'id':_0x447371[_0x8cec('0x5c')][_0x8cec('0x65')],'role':_0x8cec('0x77')},'attributes':['id',_0x8cec('0x3b'),_0x8cec('0x78'),_0x8cec('0x79'),_0x8cec('0x7a')],'raw':!![]});}return null;})['then'](function(_0x1a0e01){if(!_0x1a0e01)return null;_0x5cbe3b[_0x8cec('0x2a')][_0x8cec('0x77')]=_0x1a0e01;return _0x5cbe3b;})['then'](function(_0x5ca6be){if(_0x5ca6be){if(_0x447371[_0x8cec('0x5c')][_0x8cec('0x7b')]){_0x5cbe3b['message'][_0x8cec('0x7c')]=util[_0x8cec('0x64')]('SIP/%s',_0x447371[_0x8cec('0x66')]['name']);_0x5cbe3b['message'][_0x8cec('0x7d')]=_0x5cbe3b[_0x8cec('0x7d')];_0x5cbe3b[_0x8cec('0x2a')][_0x8cec('0x7e')]=_0x5cbe3b[_0x8cec('0x7d')];_0x5cbe3b['message'][_0x8cec('0x7f')]=_0x8cec('0x60');return respondWithRpcPromise(_0x8cec('0x80'),_0x8cec('0x80'),{'event':_0x8cec('0x81'),'message':_0x5cbe3b[_0x8cec('0x2a')]},client9002)[_0x8cec('0x23')](function(){return _0x5cbe3b;});}return _0x5cbe3b;}return null;})[_0x8cec('0x23')](respondWithResult(_0x106272,null))['catch'](handleError(_0x106272,null));};var interaction_log=require(_0x8cec('0x15'))(_0x8cec('0x5f'));exports[_0x8cec('0x35')]=function(_0x2c8434,_0x4288f9,_0x359bfb){var _0x4bb81f={'agent':{},'channel':_0x8cec('0x61')};if(_0x2c8434['body']['id']){delete _0x2c8434['body']['id'];}_0x2c8434[_0x8cec('0x5c')]['UserId']=_0x2c8434['body'][_0x8cec('0x65')]||_0x2c8434[_0x8cec('0x66')]['id'];_0x4bb81f[_0x8cec('0x77')]['id']=_0x2c8434['body'][_0x8cec('0x65')];return db[_0x8cec('0x3f')][_0x8cec('0x5d')]({'where':{'id':_0x2c8434['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4288f9,null))['then'](function(_0x53b6e2){if(_0x53b6e2){_0x4bb81f['message']=_0x53b6e2[_0x8cec('0x67')]({'plain':!![]});return db[_0x8cec('0x68')][_0x8cec('0x5d')]({'where':{'id':_0x53b6e2['FaxInteractionId']}});}return null;})[_0x8cec('0x23')](handleEntityNotFound(_0x4288f9,null))[_0x8cec('0x23')](function(_0x1e33ab){if(_0x1e33ab){_0x4bb81f[_0x8cec('0x6e')]=_0x1e33ab['get']({'plain':!![]});interaction_log['info'](_0x8cec('0x82'),_0x2c8434[_0x8cec('0x66')]['id'],_0x2c8434['user'][_0x8cec('0x3b')],_0x2c8434[_0x8cec('0x66')][_0x8cec('0x6d')],_0x4bb81f[_0x8cec('0x6e')]['id'],_0x2c8434[_0x8cec('0x5c')]?JSON['stringify'](_0x2c8434['body']):_0x8cec('0x6f'));return respondWithRpcPromise(_0x8cec('0x83'),_0x8cec('0x84'),_0x4bb81f);}return null;})[_0x8cec('0x23')](function(_0x5538f3){var _0x246456=_0x8cec('0x85')+_0x5538f3[_0x8cec('0x2a')][_0x8cec('0x71')];return db['sequelize'][_0x8cec('0x45')](_0x246456,{'type':db[_0x8cec('0x73')][_0x8cec('0x86')]['SELECT'],'raw':!![]})[_0x8cec('0x23')](function(_0x5dcd41){return _0x5dcd41;});})[_0x8cec('0x23')](function(_0x333dfb){if(_0x333dfb){_0x4bb81f[_0x8cec('0x2a')]['contact']=_0x333dfb[0x0];if(!_0x2c8434[_0x8cec('0x5c')][_0x8cec('0x65')])return;return db[_0x8cec('0x76')]['find']({'where':{'id':_0x2c8434[_0x8cec('0x5c')][_0x8cec('0x65')],'role':_0x8cec('0x77')},'attributes':['id','name',_0x8cec('0x78'),_0x8cec('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4d87da){if(!_0x4d87da)return null;_0x4bb81f[_0x8cec('0x2a')][_0x8cec('0x77')]=_0x4d87da;return _0x4bb81f;})['then'](function(_0x12c3d6){if(_0x12c3d6){_0x12c3d6['message']['interface']=util[_0x8cec('0x64')]('SIP/%s',_0x2c8434['user'][_0x8cec('0x3b')]);_0x12c3d6[_0x8cec('0x2a')][_0x8cec('0x7d')]=_0x4bb81f[_0x8cec('0x7d')];_0x12c3d6[_0x8cec('0x2a')][_0x8cec('0x7e')]=_0x4bb81f[_0x8cec('0x7d')];_0x12c3d6[_0x8cec('0x2a')]['event']='reject';respondWithRpcPromise('EventManager',_0x8cec('0x80'),{'event':_0x8cec('0x87'),'message':_0x12c3d6[_0x8cec('0x2a')]},client9002);return _0x4bb81f;}return null;})[_0x8cec('0x23')](respondWithResult(_0x4288f9,null))[_0x8cec('0x2c')](handleError(_0x4288f9,null));};exports[_0x8cec('0x88')]=function(_0x54a1a0,_0x31e8c1){var _0x41810e;return db[_0x8cec('0x3f')][_0x8cec('0x88')](_0x54a1a0[_0x8cec('0x5c')],{})[_0x8cec('0x23')](function(_0x470367){_0x41810e=_0x470367;return db[_0x8cec('0x89')][_0x8cec('0x8a')]({'where':{'id':_0x41810e[_0x8cec('0x71')]}});})[_0x8cec('0x23')](function(_0x4bc192){if(_[_0x8cec('0x69')](_0x4bc192)){return;}else{_0x41810e[_0x8cec('0x61')]=_0x4bc192[_0x8cec('0x61')];return db[_0x8cec('0x8b')]['findOne']({'where':{'id':_0x41810e[_0x8cec('0x8c')]}});}})[_0x8cec('0x23')](function(_0x528bba){return respondWithRpcPromise('SendFax',_0x8cec('0x8d'),{'FaxAccountId':_[_0x8cec('0x69')](_0x54a1a0[_0x8cec('0x5c')])?undefined:_0x54a1a0[_0x8cec('0x5c')][_0x8cec('0x8e')],'path':_[_0x8cec('0x69')](_0x528bba)?undefined:util[_0x8cec('0x64')]('/var/opt/motion2/server/files/attachments/%s',_0x528bba[_0x8cec('0x8f')]),'fax':_[_0x8cec('0x69')](_0x41810e[_0x8cec('0x61')])?undefined:_0x41810e['fax'],'AttachmentId':_0x41810e['AttachmentId']},client9002);})[_0x8cec('0x23')](respondWithResult(_0x31e8c1,0xc9))[_0x8cec('0x2c')](handleError(_0x31e8c1,null));};exports['download']=function(_0x53832f,_0x10a8b2){var _0x416d03=path[_0x8cec('0x90')](config[_0x8cec('0x91')],_0x8cec('0x92'),_0x8cec('0x93'),_0x8cec('0x94'));return db[_0x8cec('0x3f')][_0x8cec('0x5d')]({'where':{'id':_0x53832f[_0x8cec('0x5a')]['id']},'include':[{'model':db[_0x8cec('0x8b')],'as':_0x8cec('0x8b')}]})[_0x8cec('0x23')](handleEntityNotFound(_0x10a8b2,null))[_0x8cec('0x23')](function(_0x4010ce){if(_0x4010ce){return _0x10a8b2['download'](path['join'](_0x416d03,_0x4010ce[_0x8cec('0x8b')]['basename']));}})['catch'](handleError(_0x10a8b2,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e33e242..f01c76a 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 _0x49e5=['exports','events','../../mysqldb','FaxMessage','setMaxListeners','save','remove','emit'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x49e5,0x71));var _0x549e=function(_0x11dd48,_0x4531a4){_0x11dd48=_0x11dd48-0x0;var _0x11222c=_0x49e5[_0x11dd48];return _0x11222c;};'use strict';var EventEmitter=require(_0x549e('0x0'));var FaxMessage=require(_0x549e('0x1'))['db'][_0x549e('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x549e('0x3')](0x0);var events={'afterCreate':_0x549e('0x4'),'afterUpdate':'update','afterDestroy':_0x549e('0x5')};function emitEvent(_0x1d067b){return function(_0x27468e,_0x3fb4a3,_0x26f864){FaxMessageEvents['emit'](_0x1d067b+':'+_0x27468e['id'],_0x27468e);FaxMessageEvents[_0x549e('0x6')](_0x1d067b,_0x27468e);_0x26f864(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x549e('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0xb1ad=['FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x51057a,_0x2c8c27){var _0x3cbdaa=function(_0x168adf){while(--_0x168adf){_0x51057a['push'](_0x51057a['shift']());}};_0x3cbdaa(++_0x2c8c27);}(_0xb1ad,0x184));var _0xdb1a=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xb1ad[_0x5d80de];return _0x1c7556;};'use strict';var EventEmitter=require(_0xdb1a('0x0'));var FaxMessage=require(_0xdb1a('0x1'))['db'][_0xdb1a('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xdb1a('0x3')](0x0);var events={'afterCreate':_0xdb1a('0x4'),'afterUpdate':_0xdb1a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1a0d04){return function(_0x15cb4f,_0x24b01f,_0x10b9c1){FaxMessageEvents[_0xdb1a('0x6')](_0x1a0d04+':'+_0x15cb4f['id'],_0x15cb4f);FaxMessageEvents[_0xdb1a('0x6')](_0x1a0d04,_0x15cb4f);_0x10b9c1(null);};}for(var e in events){if(events[_0xdb1a('0x7')](e)){var event=events[e];FaxMessage[_0xdb1a('0x8')](e,emitEvent(event));}}module[_0xdb1a('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 19e02e8..80fdccb 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 _0x9601=['FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x437d34,_0x9e6117){var _0x4c11a8=function(_0x18053e){while(--_0x18053e){_0x437d34['push'](_0x437d34['shift']());}};_0x4c11a8(++_0x9e6117);}(_0x9601,0x1ea));var _0x1960=function(_0x215c26,_0x1eee99){_0x215c26=_0x215c26-0x0;var _0x577770=_0x9601[_0x215c26];return _0x577770;};'use strict';var _=require(_0x1960('0x0'));var util=require(_0x1960('0x1'));var logger=require(_0x1960('0x2'))(_0x1960('0x3'));var moment=require(_0x1960('0x4'));var BPromise=require(_0x1960('0x5'));var rp=require(_0x1960('0x6'));var fs=require('fs');var path=require(_0x1960('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1960('0x8'));module[_0x1960('0x9')]=function(_0x2ad9e5,_0x4676f7){return _0x2ad9e5[_0x1960('0xa')](_0x1960('0xb'),attributes,{'tableName':_0x1960('0xc'),'paranoid':![],'indexes':[{'name':_0x1960('0xd'),'fields':['body'],'type':_0x1960('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41b5f8,_0x14abb1,_0x5df51a){var _0x58f8c5=_0x2ad9e5[_0x1960('0xf')];var _0x36c1e7=_0x41b5f8[_0x1960('0x10')]({'plain':!![]});if(_0x36c1e7[_0x1960('0x11')][_0x1960('0x12')]()==='in'||_0x36c1e7[_0x1960('0x11')][_0x1960('0x12')]()===_0x1960('0x13')&&!_0x36c1e7[_0x1960('0x14')]&&!_[_0x1960('0x15')](_0x36c1e7['UserId'])){_0x58f8c5[_0x1960('0x16')][_0x1960('0x17')]({'where':{'id':_0x36c1e7[_0x1960('0x18')]}})[_0x1960('0x19')](function(_0x1e15e7){if(_0x1e15e7){_0x1e15e7[_0x1960('0x1a')]({'lastMsgAt':_0x36c1e7[_0x1960('0x1b')],'lastMsgDirection':_0x36c1e7[_0x1960('0x11')][_0x1960('0x12')]()});}})[_0x1960('0x1c')](function(_0x5c91e1){console[_0x1960('0x1d')](_0x5c91e1);});}_0x5df51a();}},'charset':_0x1960('0x1e'),'collate':_0x1960('0x1f')});}; \ No newline at end of file +var _0xbb0e=['get','direction','toLowerCase','UserId','FaxInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fti_fax_messages','models'];(function(_0x26d1f7,_0x961352){var _0x27e813=function(_0x576387){while(--_0x576387){_0x26d1f7['push'](_0x26d1f7['shift']());}};_0x27e813(++_0x961352);}(_0xbb0e,0x15e));var _0xebb0=function(_0x462351,_0x337118){_0x462351=_0x462351-0x0;var _0x21e182=_0xbb0e[_0x462351];return _0x21e182;};'use strict';var _=require(_0xebb0('0x0'));var util=require('util');var logger=require(_0xebb0('0x1'))(_0xebb0('0x2'));var moment=require(_0xebb0('0x3'));var BPromise=require(_0xebb0('0x4'));var rp=require(_0xebb0('0x5'));var fs=require('fs');var path=require(_0xebb0('0x6'));var rimraf=require(_0xebb0('0x7'));var config=require(_0xebb0('0x8'));var attributes=require(_0xebb0('0x9'));module[_0xebb0('0xa')]=function(_0xde6eed,_0x3e4bfe){return _0xde6eed['define'](_0xebb0('0xb'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0xebb0('0xc'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x37e872,_0x3cf9ba,_0x1993d8){var _0x1c6373=_0xde6eed[_0xebb0('0xd')];var _0x7fb08c=_0x37e872[_0xebb0('0xe')]({'plain':!![]});if(_0x7fb08c[_0xebb0('0xf')][_0xebb0('0x10')]()==='in'||_0x7fb08c[_0xebb0('0xf')]['toLowerCase']()==='out'&&!_0x7fb08c['secret']&&!_['isNil'](_0x7fb08c[_0xebb0('0x11')])){_0x1c6373[_0xebb0('0x12')][_0xebb0('0x13')]({'where':{'id':_0x7fb08c['FaxInteractionId']}})['then'](function(_0x5d46d3){if(_0x5d46d3){_0x5d46d3[_0xebb0('0x14')]({'lastMsgAt':_0x7fb08c[_0xebb0('0x15')],'lastMsgDirection':_0x7fb08c['direction'][_0xebb0('0x10')]()});}})[_0xebb0('0x16')](function(_0x492f2f){console[_0xebb0('0x17')](_0x492f2f);});}_0x1993d8();}},'charset':_0xebb0('0x18'),'collate':_0xebb0('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index e88652f..b74ed0d 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 _0x008c=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','catch','options','raw','then','CreateFaxMessage','attributes','limit','UpdateFaxMessage','stringify','lodash','util','moment','bluebird'];(function(_0x39de58,_0x158a4c){var _0x5ce2d1=function(_0x39fc9e){while(--_0x39fc9e){_0x39de58['push'](_0x39de58['shift']());}};_0x5ce2d1(++_0x158a4c);}(_0x008c,0x188));var _0xc008=function(_0x2fa393,_0x57e26d){_0x2fa393=_0x2fa393-0x0;var _0x15a4fb=_0x008c[_0x2fa393];return _0x15a4fb;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});config[_0xc008('0xd')]=_['defaults'](config[_0xc008('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xc008('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xc008('0xf')](socket);function respondWithRpcPromise(_0x7231b4,_0x57c46d,_0x51ba7d){return new BPromise(function(_0x543eb8,_0x1eacfa){return client[_0xc008('0x10')](_0x7231b4,_0x51ba7d)['then'](function(_0xae2dab){logger[_0xc008('0x11')](_0xc008('0x12'),_0x57c46d,_0xc008('0x13'));logger[_0xc008('0x14')](_0xc008('0x15'),_0x57c46d,_0xc008('0x13'),JSON['stringify'](_0xae2dab));if(_0xae2dab['error']){if(_0xae2dab[_0xc008('0x16')]['code']===0x1f4){logger[_0xc008('0x16')](_0xc008('0x12'),_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x1eacfa(_0xae2dab[_0xc008('0x16')]['message']);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);return _0x543eb8(_0xae2dab[_0xc008('0x16')][_0xc008('0x17')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x57c46d,'request\x20sent');_0x543eb8(_0xae2dab['result'][_0xc008('0x17')]);}})[_0xc008('0x18')](function(_0x501137){logger[_0xc008('0x16')]('FaxMessage,\x20%s,\x20%s',_0x57c46d,_0x501137);_0x1eacfa(_0x501137);});});}exports['CreateFaxMessage']=function(_0x543e5d){var _0x50261c=this;return new Promise(function(_0x5754a0,_0x4b9726){return db['FaxMessage']['create'](_0x543e5d['body'],{'raw':_0x543e5d['options']?_0x543e5d[_0xc008('0x19')][_0xc008('0x1a')]===undefined?!![]:![]:!![]})[_0xc008('0x1b')](function(_0x415af3){logger[_0xc008('0x11')](_0xc008('0x1c'),_0x543e5d);logger['debug'](_0xc008('0x1c'),_0x543e5d,JSON['stringify'](_0x415af3));_0x5754a0(_0x415af3);})['catch'](function(_0x218599){logger[_0xc008('0x16')](_0xc008('0x1c'),_0x218599[_0xc008('0x17')],_0x543e5d);_0x4b9726(_0x50261c['error'](0x1f4,_0x218599['message']));});});};exports['UpdateFaxMessage']=function(_0x3f7b07){var _0x15dade=this;return new Promise(function(_0x92c582,_0x2e31c2){return db['FaxMessage']['update'](_0x3f7b07['body'],{'raw':_0x3f7b07['options']?_0x3f7b07['options'][_0xc008('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')]['where']||null:null,'attributes':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07[_0xc008('0x19')][_0xc008('0x1d')]||null:null,'limit':_0x3f7b07[_0xc008('0x19')]?_0x3f7b07['options'][_0xc008('0x1e')]||null:null})[_0xc008('0x1b')](function(_0x53ed35){logger['info']('UpdateFaxMessage',_0x3f7b07);logger[_0xc008('0x14')](_0xc008('0x1f'),_0x3f7b07,JSON[_0xc008('0x20')](_0x53ed35));_0x92c582(_0x53ed35);})[_0xc008('0x18')](function(_0x1de04b){logger[_0xc008('0x16')](_0xc008('0x1f'),_0x1de04b[_0xc008('0x17')],_0x3f7b07);_0x2e31c2(_0x15dade[_0xc008('0x16')](0x1f4,_0x1de04b[_0xc008('0x17')]));});});}; \ No newline at end of file +var _0xd2ea=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','register','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','message','result','FaxMessage','create','body','options','raw','CreateFaxMessage','stringify','catch','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1e141b,_0x2f99bd){var _0x45be52=function(_0x4ffcd5){while(--_0x4ffcd5){_0x1e141b['push'](_0x1e141b['shift']());}};_0x45be52(++_0x2f99bd);}(_0xd2ea,0x15f));var _0xad2e=function(_0x19dc78,_0x1e4ecb){_0x19dc78=_0x19dc78-0x0;var _0xb3f1cf=_0xd2ea[_0x19dc78];return _0xb3f1cf;};'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});config[_0xad2e('0xc')]=_[_0xad2e('0xd')](config[_0xad2e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xad2e('0xe'))(new Redis(config[_0xad2e('0xc')]));require('./faxMessage.socket')[_0xad2e('0xf')](socket);function respondWithRpcPromise(_0x51f575,_0x430443,_0x415a41){return new BPromise(function(_0x9879f2,_0x24c5da){return client['request'](_0x51f575,_0x415a41)[_0xad2e('0x10')](function(_0x5707a5){logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));logger[_0xad2e('0x14')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x430443,_0xad2e('0x13'),JSON['stringify'](_0x5707a5));if(_0x5707a5[_0xad2e('0x15')]){if(_0x5707a5['error']['code']===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x24c5da(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}logger[_0xad2e('0x15')](_0xad2e('0x12'),_0x430443,_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);return _0x9879f2(_0x5707a5[_0xad2e('0x15')][_0xad2e('0x16')]);}else{logger[_0xad2e('0x11')](_0xad2e('0x12'),_0x430443,_0xad2e('0x13'));_0x9879f2(_0x5707a5[_0xad2e('0x17')][_0xad2e('0x16')]);}})['catch'](function(_0x245617){logger[_0xad2e('0x15')]('FaxMessage,\x20%s,\x20%s',_0x430443,_0x245617);_0x24c5da(_0x245617);});});}exports['CreateFaxMessage']=function(_0x48d8b5){var _0x4a4b2d=this;return new Promise(function(_0x18c38d,_0x293adc){return db[_0xad2e('0x18')][_0xad2e('0x19')](_0x48d8b5[_0xad2e('0x1a')],{'raw':_0x48d8b5[_0xad2e('0x1b')]?_0x48d8b5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![]})[_0xad2e('0x10')](function(_0x154d54){logger[_0xad2e('0x11')](_0xad2e('0x1d'),_0x48d8b5);logger[_0xad2e('0x14')](_0xad2e('0x1d'),_0x48d8b5,JSON[_0xad2e('0x1e')](_0x154d54));_0x18c38d(_0x154d54);})[_0xad2e('0x1f')](function(_0x59630b){logger[_0xad2e('0x15')](_0xad2e('0x1d'),_0x59630b[_0xad2e('0x16')],_0x48d8b5);_0x293adc(_0x4a4b2d[_0xad2e('0x15')](0x1f4,_0x59630b[_0xad2e('0x16')]));});});};exports[_0xad2e('0x20')]=function(_0x1161d5){var _0x175055=this;return new Promise(function(_0xfd90a4,_0x50d446){return db[_0xad2e('0x18')]['update'](_0x1161d5[_0xad2e('0x1a')],{'raw':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x21')]||null:null,'attributes':_0x1161d5[_0xad2e('0x1b')]?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x22')]||null:null,'limit':_0x1161d5['options']?_0x1161d5[_0xad2e('0x1b')][_0xad2e('0x23')]||null:null})[_0xad2e('0x10')](function(_0x4379f4){logger[_0xad2e('0x11')](_0xad2e('0x20'),_0x1161d5);logger[_0xad2e('0x14')](_0xad2e('0x20'),_0x1161d5,JSON[_0xad2e('0x1e')](_0x4379f4));_0xfd90a4(_0x4379f4);})[_0xad2e('0x1f')](function(_0xcc4c66){logger['error'](_0xad2e('0x20'),_0xcc4c66['message'],_0x1161d5);_0x50d446(_0x175055[_0xad2e('0x15')](0x1f4,_0xcc4c66[_0xad2e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index bfe4979..77d7a45 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 _0xf6ef=['emit','removeListener','length','faxMessage:','./faxMessage.events','save','remove'];(function(_0x246115,_0x398123){var _0x385878=function(_0x534a9c){while(--_0x534a9c){_0x246115['push'](_0x246115['shift']());}};_0x385878(++_0x398123);}(_0xf6ef,0xd6));var _0xff6e=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xf6ef[_0x1269c6];return _0x4868c7;};'use strict';var FaxMessageEvents=require(_0xff6e('0x0'));var events=[_0xff6e('0x1'),_0xff6e('0x2'),'update'];function createListener(_0x2ab3df,_0x3ac364){return function(_0x1e4aa9){_0x3ac364[_0xff6e('0x3')](_0x2ab3df,_0x1e4aa9);};}function removeListener(_0x238f04,_0xcb6353){return function(){FaxMessageEvents[_0xff6e('0x4')](_0x238f04,_0xcb6353);};}exports['register']=function(_0x36c011){for(var _0x56f3a1=0x0,_0xa3ea14=events[_0xff6e('0x5')];_0x56f3a1<_0xa3ea14;_0x56f3a1++){var _0xdb3039=events[_0x56f3a1];var _0x2f2976=createListener(_0xff6e('0x6')+_0xdb3039,_0x36c011);FaxMessageEvents['on'](_0xdb3039,_0x2f2976);}}; \ No newline at end of file +var _0x7c55=['faxMessage:','./faxMessage.events','save','remove','update','emit','register'];(function(_0x3453b4,_0x2e4e0b){var _0x274dd6=function(_0x2f848d){while(--_0x2f848d){_0x3453b4['push'](_0x3453b4['shift']());}};_0x274dd6(++_0x2e4e0b);}(_0x7c55,0x1b3));var _0x57c5=function(_0x25c274,_0x552813){_0x25c274=_0x25c274-0x0;var _0x500fe3=_0x7c55[_0x25c274];return _0x500fe3;};'use strict';var FaxMessageEvents=require(_0x57c5('0x0'));var events=[_0x57c5('0x1'),_0x57c5('0x2'),_0x57c5('0x3')];function createListener(_0x5394a9,_0x362b27){return function(_0x3d6432){_0x362b27[_0x57c5('0x4')](_0x5394a9,_0x3d6432);};}function removeListener(_0x5a162a,_0x39998a){return function(){FaxMessageEvents['removeListener'](_0x5a162a,_0x39998a);};}exports[_0x57c5('0x5')]=function(_0x8edbde){for(var _0x5ad43f=0x0,_0x7866e8=events['length'];_0x5ad43f<_0x7866e8;_0x5ad43f++){var _0x1e97b2=events[_0x5ad43f];var _0x3f0c69=createListener(_0x57c5('0x6')+_0x1e97b2,_0x8edbde);FaxMessageEvents['on'](_0x1e97b2,_0x3f0c69);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index fe0580f..aa5b443 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 _0xe5b5=['fax','update','put','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked'];(function(_0x2f64d8,_0x293825){var _0x14afaa=function(_0x1d08f8){while(--_0x1d08f8){_0x2f64d8['push'](_0x2f64d8['shift']());}};_0x14afaa(++_0x293825);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x121b1a,_0x42fdb7){_0x121b1a=_0x121b1a-0x0;var _0x2d89a6=_0xe5b5[_0x121b1a];return _0x2d89a6;};'use strict';var multer=require(_0x5e5b('0x0'));var util=require(_0x5e5b('0x1'));var path=require(_0x5e5b('0x2'));var timeout=require(_0x5e5b('0x3'));var express=require(_0x5e5b('0x4'));var router=express[_0x5e5b('0x5')]();var fs_extra=require(_0x5e5b('0x6'));var auth=require(_0x5e5b('0x7'));var interaction=require(_0x5e5b('0x8'));var config=require(_0x5e5b('0x9'));var controller=require(_0x5e5b('0xa'));router[_0x5e5b('0xb')]('/',auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xd')]);router[_0x5e5b('0xb')](_0x5e5b('0xe'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0xf')]);router[_0x5e5b('0xb')](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x11')]);router[_0x5e5b('0xb')]('/:id/download',auth[_0x5e5b('0xc')](),controller['download']);router[_0x5e5b('0x12')]('/',auth[_0x5e5b('0xc')](),interaction[_0x5e5b('0x13')](_0x5e5b('0x14'),'faxmessage:create'),controller['create']);router['put'](_0x5e5b('0x10'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x15')]);router[_0x5e5b('0x16')](_0x5e5b('0x17'),auth[_0x5e5b('0xc')](),controller[_0x5e5b('0x18')]);router['put'](_0x5e5b('0x19'),auth[_0x5e5b('0xc')](),controller['reject']);router[_0x5e5b('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x5e5b('0x1b')]);module[_0x5e5b('0x1c')]=router; \ No newline at end of file +var _0x41bb=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','show','/:id/download','download','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','delete','destroy','multer','util','connect-timeout'];(function(_0x1892fe,_0x20b1ff){var _0x4573cb=function(_0x56f625){while(--_0x56f625){_0x1892fe['push'](_0x1892fe['shift']());}};_0x4573cb(++_0x20b1ff);}(_0x41bb,0xc5));var _0xb41b=function(_0x12a1f5,_0x252768){_0x12a1f5=_0x12a1f5-0x0;var _0x2f8009=_0x41bb[_0x12a1f5];return _0x2f8009;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0x8')](_0xb41b('0xd'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router['post']('/',auth[_0xb41b('0x9')](),interaction['tracked'](_0xb41b('0xf'),_0xb41b('0x10')),controller[_0xb41b('0x11')]);router[_0xb41b('0x12')](_0xb41b('0xb'),auth['isAuthenticated'](),controller[_0xb41b('0x13')]);router[_0xb41b('0x12')](_0xb41b('0x14'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x15')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xb41b('0x16')]);router[_0xb41b('0x17')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 60d9b87..e6d4648 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 _0x7e82=['name','INTEGER','ENUM','beepall','roundrobin','sequelize','exports','STRING'];(function(_0xdba13b,_0x38876b){var _0x130c56=function(_0x53f0ec){while(--_0x53f0ec){_0xdba13b['push'](_0xdba13b['shift']());}};_0x130c56(++_0x38876b);}(_0x7e82,0x105));var _0x27e8=function(_0xd66bbb,_0x559697){_0xd66bbb=_0xd66bbb-0x0;var _0x385be0=_0x7e82[_0xd66bbb];return _0x385be0;};'use strict';var Sequelize=require(_0x27e8('0x0'));module[_0x27e8('0x1')]={'name':{'type':Sequelize[_0x27e8('0x2')],'unique':_0x27e8('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x27e8('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x27e8('0x5')]('rrmemory',_0x27e8('0x6'),_0x27e8('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x27e8('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x614e=['name','INTEGER','ENUM','rrmemory','beepall','sequelize','exports','STRING'];(function(_0xf5cb96,_0x114236){var _0x68c8c1=function(_0x17ffed){while(--_0x17ffed){_0xf5cb96['push'](_0xf5cb96['shift']());}};_0x68c8c1(++_0x114236);}(_0x614e,0x19d));var _0xe614=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x614e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xe614('0x0'));module[_0xe614('0x1')]={'name':{'type':Sequelize[_0xe614('0x2')],'unique':_0xe614('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe614('0x2')]},'timeout':{'type':Sequelize[_0xe614('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe614('0x5')](_0xe614('0x6'),_0xe614('0x7'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index ea215af..9a0661e 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 _0x0618=['map','FaxQueue','rawAttributes','type','key','getOptions','where','include','query','findAll','rows','params','keys','intersection','model','attributes','fields','length','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','name','error','getMembers','filters','hasOwnProperty','nolimit','order','sort','pick','filter','merge','options','UserFaxQueue','User','agent','faxPause','updatedAt','format','createdAt','findOne','Team','getTeams','ids','online','voicePause','interface','flatMap','Agents','addTeams','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','transaction','removeTeams','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','squel','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','FaxQueues','UserProfileResource','stack','send'];(function(_0x227ea5,_0x379817){var _0x4d65b1=function(_0x37b310){while(--_0x37b310){_0x227ea5['push'](_0x227ea5['shift']());}};_0x4d65b1(++_0x379817);}(_0x0618,0x1c6));var _0x8061=function(_0x1cf1c7,_0x1e0f72){_0x1cf1c7=_0x1cf1c7-0x0;var _0x362b0a=_0x0618[_0x1cf1c7];return _0x362b0a;};'use strict';var BPromise=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var _=require('lodash');var squel=require(_0x8061('0x2'));var Redis=require(_0x8061('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8061('0x4'));var config=require(_0x8061('0x5'));var db=require(_0x8061('0x6'))['db'];config[_0x8061('0x7')]=_[_0x8061('0x8')](config[_0x8061('0x7')],{'host':_0x8061('0x9'),'port':0x18eb});var socket=require(_0x8061('0xa'))(new Redis(config[_0x8061('0x7')]));require(_0x8061('0xb'))[_0x8061('0xc')](socket);function respondWithStatusCode(_0x483d55,_0x1a0cd0){_0x1a0cd0=_0x1a0cd0||0xcc;return function(_0x48fc13){if(_0x48fc13){return _0x483d55[_0x8061('0xd')](_0x1a0cd0);}return _0x483d55[_0x8061('0xe')](_0x1a0cd0)[_0x8061('0xf')]();};}function respondWithResult(_0x3a5261,_0x366a4e){_0x366a4e=_0x366a4e||0xc8;return function(_0x588bb3){if(_0x588bb3){return _0x3a5261['status'](_0x366a4e)[_0x8061('0x10')](_0x588bb3);}};}function respondWithFilteredResult(_0x3707bd,_0x593022){return function(_0x50913f){if(_0x50913f){var _0x3c5722=typeof _0x593022[_0x8061('0x11')]===_0x8061('0x12')&&typeof _0x593022[_0x8061('0x13')]===_0x8061('0x12');var _0x9b1ff1=_0x50913f['count'];var _0x4df59c=_0x3c5722?0x0:_0x593022[_0x8061('0x11')];var _0x4da339=_0x3c5722?_0x50913f[_0x8061('0x14')]:_0x593022[_0x8061('0x11')]+_0x593022['limit'];var _0x483af8;if(_0x4da339>=_0x9b1ff1){_0x4da339=_0x9b1ff1;_0x483af8=0xc8;}else{_0x483af8=0xce;}_0x3707bd[_0x8061('0xe')](_0x483af8);return _0x3707bd[_0x8061('0x15')](_0x8061('0x16'),_0x4df59c+'-'+_0x4da339+'/'+_0x9b1ff1)[_0x8061('0x10')](_0x50913f);}return null;};}function saveUpdates(_0x127435){return function(_0x3667a8){if(_0x3667a8){return _0x3667a8[_0x8061('0x17')](_0x127435)[_0x8061('0x18')](function(_0x2b0eab){return _0x2b0eab;});}return null;};}function removeEntity(_0x4096ba){return function(_0x14230e){if(_0x14230e){return _0x14230e[_0x8061('0x19')]()[_0x8061('0x18')](function(){var _0x58683d=_0x14230e['get']({'plain':!![]});var _0x32c9d3=_0x8061('0x1a');return db[_0x8061('0x1b')]['destroy']({'where':{'type':_0x32c9d3,'resourceId':_0x58683d['id']}})['then'](function(){return _0x14230e;});})[_0x8061('0x18')](function(){_0x4096ba[_0x8061('0xe')](0xcc)[_0x8061('0xf')]();});}};}function handleEntityNotFound(_0x60db09){return function(_0x490531){if(!_0x490531){_0x60db09['sendStatus'](0x194);}return _0x490531;};}function handleError(_0x1cd5ed,_0x12e73d){_0x12e73d=_0x12e73d||0x1f4;return function(_0x4a2bed){logger['error'](_0x4a2bed[_0x8061('0x1c')]);if(_0x4a2bed['name']){delete _0x4a2bed['name'];}_0x1cd5ed[_0x8061('0xe')](_0x12e73d)[_0x8061('0x1d')](_0x4a2bed);};}exports['index']=function(_0x55459f,_0x17dbff){var _0x3f2765={};var _0x4e0860={'count':0x0,'rows':[]};var _0x1b0ec7=_[_0x8061('0x1e')](db[_0x8061('0x1f')][_0x8061('0x20')],function(_0x5f0822){return{'name':_0x5f0822['fieldName'],'type':_0x5f0822[_0x8061('0x21')][_0x8061('0x22')]};});_0x3f2765=qs[_0x8061('0x23')](_0x1b0ec7,_0x55459f);var _0x240fab={'where':_0x3f2765[_0x8061('0x24')]};return db['FaxQueue']['count'](_0x240fab)['then'](function(_0x59a65d){_0x4e0860[_0x8061('0x14')]=_0x59a65d;_0x3f2765[_0x8061('0x25')]=qs[_0x8061('0x25')](_0x55459f[_0x8061('0x26')]);return db[_0x8061('0x1f')][_0x8061('0x27')](_0x3f2765);})[_0x8061('0x18')](function(_0x15ed1d){_0x4e0860[_0x8061('0x28')]=_0x15ed1d;return _0x4e0860;})[_0x8061('0x18')](respondWithFilteredResult(_0x17dbff,_0x3f2765))['catch'](handleError(_0x17dbff,null));};exports['show']=function(_0x1d1630,_0xecc4c5){var _0xd99c0d={'raw':!![],'where':{'id':_0x1d1630[_0x8061('0x29')]['id']}},_0x182373={};_0x182373['model']=_[_0x8061('0x2a')](db[_0x8061('0x1f')]['rawAttributes']);_0x182373['query']=_[_0x8061('0x2a')](_0x1d1630[_0x8061('0x26')]);_0x182373['filters']=_[_0x8061('0x2b')](_0x182373[_0x8061('0x2c')],_0x182373[_0x8061('0x26')]);_0xd99c0d[_0x8061('0x2d')]=_[_0x8061('0x2b')](_0x182373[_0x8061('0x2c')],qs[_0x8061('0x2e')](_0x1d1630[_0x8061('0x26')][_0x8061('0x2e')]));_0xd99c0d['attributes']=_0xd99c0d[_0x8061('0x2d')][_0x8061('0x2f')]?_0xd99c0d[_0x8061('0x2d')]:_0x182373[_0x8061('0x2c')];if(_0x1d1630['query']['includeAll']){_0xd99c0d['include']=[{'all':!![]}];}_0xd99c0d=_['merge']({},_0xd99c0d,_0x1d1630['options']);return db[_0x8061('0x1f')]['find'](_0xd99c0d)[_0x8061('0x18')](handleEntityNotFound(_0xecc4c5,null))[_0x8061('0x18')](respondWithResult(_0xecc4c5,null))[_0x8061('0x30')](handleError(_0xecc4c5,null));};exports[_0x8061('0x31')]=function(_0xce3ea8,_0x5a8e8a){return db[_0x8061('0x1f')][_0x8061('0x31')](_0xce3ea8[_0x8061('0x32')],{})[_0x8061('0x18')](function(_0xc85ded){var _0x31ed9d=_0xce3ea8[_0x8061('0x33')][_0x8061('0x34')]({'plain':!![]});if(!_0x31ed9d)throw new Error(_0x8061('0x35'));if(_0x31ed9d[_0x8061('0x36')]===_0x8061('0x33')){var _0x3be274=_0xc85ded['get']({'plain':!![]});var _0x5d8df2=_0x8061('0x1a');return db['UserProfileSection'][_0x8061('0x37')]({'where':{'name':_0x5d8df2,'userProfileId':_0x31ed9d['userProfileId']},'raw':!![]})['then'](function(_0x105747){if(_0x105747&&_0x105747[_0x8061('0x38')]===0x0){return db[_0x8061('0x1b')][_0x8061('0x31')]({'name':_0x3be274[_0x8061('0x39')],'resourceId':_0x3be274['id'],'type':_0x105747[_0x8061('0x39')],'sectionId':_0x105747['id']},{})[_0x8061('0x18')](function(){return _0xc85ded;});}else{return _0xc85ded;}})[_0x8061('0x30')](function(_0x1475b1){logger[_0x8061('0x3a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1475b1);throw _0x1475b1;});}return _0xc85ded;})[_0x8061('0x18')](respondWithResult(_0x5a8e8a,0xc9))[_0x8061('0x30')](handleError(_0x5a8e8a,null));};exports[_0x8061('0x17')]=function(_0x2675e3,_0x4435b8){if(_0x2675e3['body']['id']){delete _0x2675e3['body']['id'];}return db[_0x8061('0x1f')][_0x8061('0x37')]({'where':{'id':_0x2675e3[_0x8061('0x29')]['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x4435b8,null))[_0x8061('0x18')](saveUpdates(_0x2675e3[_0x8061('0x32')],null))[_0x8061('0x18')](respondWithResult(_0x4435b8,null))['catch'](handleError(_0x4435b8,null));};exports[_0x8061('0x19')]=function(_0x2f3c68,_0x261721){return db[_0x8061('0x1f')][_0x8061('0x37')]({'where':{'id':_0x2f3c68[_0x8061('0x29')]['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x261721,null))['then'](removeEntity(_0x261721,null))[_0x8061('0x30')](handleError(_0x261721,null));};exports['describe']=function(_0x521181,_0xef7273){return db[_0x8061('0x1f')]['describe']()['then'](respondWithResult(_0xef7273,null))[_0x8061('0x30')](handleError(_0xef7273,null));};exports[_0x8061('0x3b')]=function(_0x297f29,_0x3b9a75){var _0x3a43d7={'raw':!![],'where':{}},_0x590b3b={},_0x54687a;return db[_0x8061('0x1f')]['findOne']({'where':{'id':_0x297f29[_0x8061('0x29')]['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x3b9a75,null))['then'](function(_0x4562a9){if(_0x4562a9){_0x54687a=_0x4562a9[_0x8061('0x34')]({'plain':!![]});_0x590b3b[_0x8061('0x2c')]=_[_0x8061('0x2a')](db['UserFaxQueue'][_0x8061('0x20')]);_0x590b3b[_0x8061('0x26')]=_[_0x8061('0x2a')](_0x297f29[_0x8061('0x26')]);_0x590b3b[_0x8061('0x3c')]=_[_0x8061('0x2b')](_0x590b3b[_0x8061('0x2c')],_0x590b3b[_0x8061('0x26')]);_0x3a43d7[_0x8061('0x2d')]=_[_0x8061('0x2b')](_0x590b3b[_0x8061('0x2c')],qs[_0x8061('0x2e')](_0x297f29[_0x8061('0x26')][_0x8061('0x2e')]));_0x3a43d7[_0x8061('0x2d')]=_0x3a43d7[_0x8061('0x2d')][_0x8061('0x2f')]?_0x3a43d7['attributes']:_0x590b3b[_0x8061('0x2c')];if(!_0x297f29[_0x8061('0x26')][_0x8061('0x3d')](_0x8061('0x3e'))){_0x3a43d7['limit']=qs[_0x8061('0x13')](_0x297f29[_0x8061('0x26')][_0x8061('0x13')]);_0x3a43d7[_0x8061('0x11')]=qs[_0x8061('0x11')](_0x297f29[_0x8061('0x26')][_0x8061('0x11')]);}_0x3a43d7[_0x8061('0x3f')]=qs[_0x8061('0x40')](_0x297f29[_0x8061('0x26')][_0x8061('0x40')]);_0x3a43d7[_0x8061('0x24')]=qs['filters'](_[_0x8061('0x41')](_0x297f29[_0x8061('0x26')],_0x590b3b['filters']));_0x3a43d7[_0x8061('0x24')]['FaxQueueId']=_0x4562a9['id'];if(_0x297f29[_0x8061('0x26')][_0x8061('0x42')]){_0x3a43d7[_0x8061('0x24')]=_[_0x8061('0x43')](_0x3a43d7[_0x8061('0x24')],{'$or':_['map'](_0x3a43d7['attributes'],function(_0x38cdd7){var _0x127124={};_0x127124[_0x38cdd7]={'$like':'%'+_0x297f29[_0x8061('0x26')]['filter']+'%'};return _0x127124;})});}_0x3a43d7=_['merge']({},_0x3a43d7,_0x297f29[_0x8061('0x44')]);return db[_0x8061('0x45')][_0x8061('0x27')](_0x3a43d7);}})['then'](function(_0x30fcdd){if(_0x30fcdd){return db[_0x8061('0x46')]['findAndCountAll']({'where':{'id':_[_0x8061('0x1e')](_0x30fcdd,'UserId'),'role':_0x8061('0x47')},'attributes':['id',_0x8061('0x39'),_0x8061('0x48'),_0x8061('0x49'),'createdAt']});}})[_0x8061('0x18')](function(_0x32928f){if(_0x32928f){return{'count':_0x32928f[_0x8061('0x14')],'rows':_[_0x8061('0x1e')](_0x32928f[_0x8061('0x28')],function(_0xecfd1){return{'membername':_0xecfd1['name'],'UserId':_0xecfd1['id'],'queue_name':_0x54687a[_0x8061('0x39')],'FaxQueueId':_0x54687a['id'],'interface':util[_0x8061('0x4a')]('%s/%s','SIP',_0xecfd1[_0x8061('0x39')]),'penalty':0x0,'paused':_0xecfd1[_0x8061('0x48')],'createdAt':_0xecfd1[_0x8061('0x4b')],'updatedAt':_0xecfd1[_0x8061('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3b9a75,_0x3a43d7))['catch'](handleError(_0x3b9a75,null));};exports['getTeams']=function(_0x5c18ab,_0x354dd8){var _0x3823ab={};var _0x3b5af2={};var _0x1bba77;var _0x3a4e2b;return db[_0x8061('0x1f')][_0x8061('0x4c')]({'where':{'id':_0x5c18ab[_0x8061('0x29')]['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x354dd8,null))[_0x8061('0x18')](function(_0x2fc594){if(_0x2fc594){_0x1bba77=_0x2fc594;_0x3b5af2['model']=_[_0x8061('0x2a')](db[_0x8061('0x4d')]['rawAttributes']);_0x3b5af2[_0x8061('0x26')]=_['keys'](_0x5c18ab[_0x8061('0x26')]);_0x3b5af2[_0x8061('0x3c')]=_[_0x8061('0x2b')](_0x3b5af2[_0x8061('0x2c')],_0x3b5af2['query']);_0x3823ab[_0x8061('0x2d')]=_['intersection'](_0x3b5af2[_0x8061('0x2c')],qs['fields'](_0x5c18ab[_0x8061('0x26')][_0x8061('0x2e')]));_0x3823ab['attributes']=_0x3823ab[_0x8061('0x2d')][_0x8061('0x2f')]?_0x3823ab['attributes']:_0x3b5af2['model'];_0x3823ab[_0x8061('0x3f')]=qs[_0x8061('0x40')](_0x5c18ab[_0x8061('0x26')]['sort']);_0x3823ab[_0x8061('0x24')]=qs[_0x8061('0x3c')](_[_0x8061('0x41')](_0x5c18ab[_0x8061('0x26')],_0x3b5af2['filters']));if(_0x5c18ab[_0x8061('0x26')]['filter']){_0x3823ab[_0x8061('0x24')]=_['merge'](_0x3823ab[_0x8061('0x24')],{'$or':_[_0x8061('0x1e')](_0x3823ab[_0x8061('0x2d')],function(_0x2d328a){var _0x14453c={};_0x14453c[_0x2d328a]={'$like':'%'+_0x5c18ab['query'][_0x8061('0x42')]+'%'};return _0x14453c;})});}_0x3823ab=_[_0x8061('0x43')]({},_0x3823ab,_0x5c18ab['options']);return _0x1bba77['getTeams'](_0x3823ab);}})[_0x8061('0x18')](function(_0x54a8af){if(_0x54a8af){_0x3a4e2b=_0x54a8af['length'];if(!_0x5c18ab['query'][_0x8061('0x3d')](_0x8061('0x3e'))){_0x3823ab[_0x8061('0x13')]=qs['limit'](_0x5c18ab[_0x8061('0x26')]['limit']);_0x3823ab[_0x8061('0x11')]=qs[_0x8061('0x11')](_0x5c18ab[_0x8061('0x26')]['offset']);}return _0x1bba77[_0x8061('0x4e')](_0x3823ab);}})[_0x8061('0x18')](function(_0x20cb0e){if(_0x20cb0e){return _0x20cb0e?{'count':_0x3a4e2b,'rows':_0x20cb0e}:null;}})[_0x8061('0x18')](respondWithResult(_0x354dd8,null))[_0x8061('0x30')](handleError(_0x354dd8,null));};exports['addTeams']=function(_0x41c085,_0x575122){var _0x22f726=_0x41c085[_0x8061('0x32')][_0x8061('0x4f')];return db['Team'][_0x8061('0x27')]({'where':{'id':_0x22f726},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0x8061('0x50'),_0x8061('0x51'),_0x8061('0x52')],'raw':!![]}]})[_0x8061('0x18')](function(_0x5b0e38){if(_0x5b0e38){var _0x5ec019=_[_0x8061('0x53')](_0x5b0e38,function(_0x4a3ca1){var _0x5a32ff=_0x4a3ca1[_0x8061('0x34')]({'plain':!![]});return _0x5a32ff[_0x8061('0x54')];});return db['FaxQueue'][_0x8061('0x37')]({'where':{'id':_0x41c085['params']['id']}})[_0x8061('0x18')](function(_0x38b50b){return db['sequelize']['transaction'](function(_0x5271d4){return _0x38b50b[_0x8061('0x55')](_0x22f726,{'transaction':_0x5271d4})['then'](function(){return BPromise[_0x8061('0x56')](_0x5ec019,function(_0x5dfcd8){return db[_0x8061('0x45')][_0x8061('0x57')]({'where':{'UserId':_0x5dfcd8['id'],'FaxQueueId':_0x41c085[_0x8061('0x29')]['id']},'transaction':_0x5271d4});});})['then'](function(){_0x5ec019[_0x8061('0x58')](function(_0x72c89a){socket[_0x8061('0x59')]('userFaxQueue:save',{'UserId':_0x72c89a['id'],'FaxQueueId':_0x38b50b['id']});});});});});}})[_0x8061('0x18')](respondWithStatusCode(_0x575122,null))[_0x8061('0x30')](handleError(_0x575122,null));};exports['removeTeams']=function(_0x130abc,_0x3d7294){return db[_0x8061('0x4d')][_0x8061('0x27')]({'where':{'id':_0x130abc[_0x8061('0x26')][_0x8061('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x8061('0x46')],'as':_0x8061('0x54'),'attributes':['id'],'raw':!![]}]})[_0x8061('0x18')](handleEntityNotFound(_0x3d7294,null))[_0x8061('0x18')](function(_0x26dadb){var _0x532fbf=_['map'](_0x26dadb,'id');var _0x5df0fc=[];var _0x2dfbac=[];var _0x22dd5b=squel[_0x8061('0x5a')]();_0x22dd5b[_0x8061('0x5b')](_0x8061('0x5c'))[_0x8061('0x5d')](_0x8061('0x5e'),'tq')[_0x8061('0x5f')]('user_has_teams','ut',_0x8061('0x60'))[_0x8061('0x24')](_0x8061('0x61'),_0x130abc['params']['id']);for(var _0x430706=0x0;_0x430706<_0x26dadb[_0x8061('0x2f')];_0x430706+=0x1){let _0x1ae2d3=_0x26dadb[_0x430706];for(var _0x423ed0=0x0;_0x423ed0<_0x1ae2d3[_0x8061('0x54')][_0x8061('0x2f')];_0x423ed0+=0x1){let _0x646ce4=_0x1ae2d3[_0x8061('0x54')][_0x423ed0];var _0x4cde0b=_0x22dd5b[_0x8061('0x62')]();_0x4cde0b[_0x8061('0x24')](_0x8061('0x63'),_0x646ce4['id']);_0x2dfbac[_0x8061('0x64')](db['sequelize']['query'](_0x4cde0b[_0x8061('0x65')](),{'type':db[_0x8061('0x66')][_0x8061('0x67')][_0x8061('0x68')]})[_0x8061('0x18')](function(_0x4f6b31){if(_0x4f6b31[_0x8061('0x2f')]===0x1){return _0x646ce4['id'];}else{var _0x3471fa=_[_0x8061('0x69')](_[_0x8061('0x1e')](_0x4f6b31,_0x8061('0x6a')),function(_0x1a041f){return _[_0x8061('0x6b')](_0x532fbf,_0x1a041f);});if(_0x3471fa){return _0x646ce4['id'];}}}));}}return BPromise[_0x8061('0x6c')](_0x2dfbac)[_0x8061('0x18')](function(_0x3b82f6){_0x5df0fc=_(_0x5df0fc)[_0x8061('0x6d')](_0x3b82f6)[_0x8061('0x6e')]()['value']();return db[_0x8061('0x1f')][_0x8061('0x37')]({'where':{'id':_0x130abc[_0x8061('0x29')]['id']}})[_0x8061('0x18')](function(_0x21436e){return db[_0x8061('0x66')][_0x8061('0x6f')](function(_0x1f9ce2){return _0x21436e[_0x8061('0x70')](_0x130abc[_0x8061('0x26')]['ids'],{'transaction':_0x1f9ce2})[_0x8061('0x18')](function(){if(!_[_0x8061('0x71')](_0x5df0fc)){return _0x21436e[_0x8061('0x72')](_0x5df0fc,{'transaction':_0x1f9ce2});}})[_0x8061('0x18')](function(){_0x5df0fc[_0x8061('0x58')](function(_0x17a5bf){socket[_0x8061('0x59')](_0x8061('0x73'),{'UserId':_0x17a5bf,'FaxQueueId':_0x21436e['id']});});});});});});})[_0x8061('0x18')](respondWithStatusCode(_0x3d7294,null))[_0x8061('0x30')](handleError(_0x3d7294,null));};exports[_0x8061('0x74')]=function(_0x277aaa,_0x2728c5){return db[_0x8061('0x1f')][_0x8061('0x37')]({'where':{'id':_0x277aaa[_0x8061('0x29')]['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x2728c5,null))[_0x8061('0x18')](function(_0x21863b){if(_0x21863b){return _0x21863b[_0x8061('0x74')](_0x277aaa[_0x8061('0x32')]['ids'],_[_0x8061('0x75')](_0x277aaa[_0x8061('0x32')],[_0x8061('0x4f'),'id'])||{})[_0x8061('0x76')](function(_0x3bdbf7){for(var _0x170e46=0x0;_0x170e46<_0x277aaa[_0x8061('0x32')][_0x8061('0x4f')][_0x8061('0x2f')];_0x170e46+=0x1){socket[_0x8061('0x59')]('userFaxQueue:save',{'UserId':Number(_0x277aaa[_0x8061('0x32')][_0x8061('0x4f')][_0x170e46]),'FaxQueueId':Number(_0x277aaa['params']['id'])});}return _0x3bdbf7;});}})[_0x8061('0x18')](respondWithResult(_0x2728c5,null))[_0x8061('0x30')](handleError(_0x2728c5,null));};exports[_0x8061('0x72')]=function(_0x1f1b5c,_0x10f447){return db[_0x8061('0x1f')][_0x8061('0x37')]({'where':{'id':_0x1f1b5c['params']['id']}})['then'](handleEntityNotFound(_0x10f447,null))[_0x8061('0x18')](function(_0x4406c4){if(_0x4406c4){return _0x4406c4[_0x8061('0x72')](_0x1f1b5c[_0x8061('0x26')]['ids'])[_0x8061('0x18')](function(){if(_[_0x8061('0x77')](_0x1f1b5c['query'][_0x8061('0x4f')])){for(var _0x4427fb=0x0;_0x4427fb<_0x1f1b5c[_0x8061('0x26')]['ids'][_0x8061('0x2f')];_0x4427fb+=0x1){socket[_0x8061('0x59')](_0x8061('0x73'),{'UserId':Number(_0x1f1b5c[_0x8061('0x26')][_0x8061('0x4f')][_0x4427fb]),'FaxQueueId':Number(_0x1f1b5c[_0x8061('0x29')]['id'])});}}else{socket[_0x8061('0x59')](_0x8061('0x73'),{'UserId':Number(_0x1f1b5c[_0x8061('0x26')]['ids']),'FaxQueueId':Number(_0x1f1b5c[_0x8061('0x29')]['id'])});}});}})[_0x8061('0x18')](respondWithStatusCode(_0x10f447,null))[_0x8061('0x30')](handleError(_0x10f447,null));};exports[_0x8061('0x78')]=function(_0xd9beb0,_0x3636fa){var _0x465387={};var _0x3535a5={};var _0x4322cd;var _0x583d86;return db[_0x8061('0x1f')][_0x8061('0x4c')]({'where':{'id':_0xd9beb0['params']['id']}})[_0x8061('0x18')](handleEntityNotFound(_0x3636fa,null))[_0x8061('0x18')](function(_0x1946a1){if(_0x1946a1){_0x4322cd=_0x1946a1;_0x3535a5['model']=_[_0x8061('0x2a')](db[_0x8061('0x46')][_0x8061('0x20')]);_0x3535a5['query']=_[_0x8061('0x2a')](_0xd9beb0[_0x8061('0x26')]);_0x3535a5[_0x8061('0x3c')]=_[_0x8061('0x2b')](_0x3535a5['model'],_0x3535a5[_0x8061('0x26')]);_0x465387[_0x8061('0x2d')]=_[_0x8061('0x2b')](_0x3535a5[_0x8061('0x2c')],qs[_0x8061('0x2e')](_0xd9beb0[_0x8061('0x26')][_0x8061('0x2e')]));_0x465387[_0x8061('0x2d')]=_0x465387[_0x8061('0x2d')][_0x8061('0x2f')]?_0x465387[_0x8061('0x2d')]:_0x3535a5[_0x8061('0x2c')];_0x465387['order']=qs['sort'](_0xd9beb0[_0x8061('0x26')][_0x8061('0x40')]);_0x465387[_0x8061('0x24')]=qs[_0x8061('0x3c')](_[_0x8061('0x41')](_0xd9beb0[_0x8061('0x26')],_0x3535a5['filters']));if(_0xd9beb0[_0x8061('0x26')]['filter']){_0x465387[_0x8061('0x24')]=_[_0x8061('0x43')](_0x465387['where'],{'$or':_[_0x8061('0x1e')](_0x465387[_0x8061('0x2d')],function(_0x3c1bf0){var _0x47d9b0={};_0x47d9b0[_0x3c1bf0]={'$like':'%'+_0xd9beb0[_0x8061('0x26')][_0x8061('0x42')]+'%'};return _0x47d9b0;})});}_0x465387=_[_0x8061('0x43')]({},_0x465387,_0xd9beb0[_0x8061('0x44')]);return _0x4322cd[_0x8061('0x78')](_0x465387);}})[_0x8061('0x18')](function(_0x22d4cc){if(_0x22d4cc){_0x583d86=_0x22d4cc['length'];if(!_0xd9beb0[_0x8061('0x26')][_0x8061('0x3d')]('nolimit')){_0x465387[_0x8061('0x13')]=qs[_0x8061('0x13')](_0xd9beb0[_0x8061('0x26')][_0x8061('0x13')]);_0x465387[_0x8061('0x11')]=qs[_0x8061('0x11')](_0xd9beb0['query'][_0x8061('0x11')]);}return _0x4322cd[_0x8061('0x78')](_0x465387);}})[_0x8061('0x18')](function(_0x1a98ef){if(_0x1a98ef){return _0x1a98ef?{'count':_0x583d86,'rows':_0x1a98ef}:null;}})[_0x8061('0x18')](respondWithResult(_0x3636fa,null))['catch'](handleError(_0x3636fa,null));}; \ No newline at end of file +var _0x57ca=['userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','includes','compact','value','userFaxQueue:remove','addAgents','removeAgents','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','get','FaxQueues','end','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','type','key','getOptions','include','query','rows','catch','params','model','keys','filters','intersection','attributes','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','fields','length','nolimit','sort','pick','where','FaxQueueId','filter','UserFaxQueue','findAll','User','UserId','agent','faxPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','order','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','transaction','each','findOrCreate','forEach','emit'];(function(_0x2ef548,_0x3f534f){var _0x3b1cb9=function(_0x319457){while(--_0x319457){_0x2ef548['push'](_0x2ef548['shift']());}};_0x3b1cb9(++_0x3f534f);}(_0x57ca,0x108));var _0xa57c=function(_0x3534b4,_0x123b5f){_0x3534b4=_0x3534b4-0x0;var _0x55852e=_0x57ca[_0x3534b4];return _0x55852e;};'use strict';var BPromise=require('bluebird');var util=require(_0xa57c('0x0'));var _=require(_0xa57c('0x1'));var squel=require('squel');var Redis=require(_0xa57c('0x2'));var qs=require(_0xa57c('0x3'));var logger=require(_0xa57c('0x4'))(_0xa57c('0x5'));var config=require(_0xa57c('0x6'));var db=require('../../mysqldb')['db'];config[_0xa57c('0x7')]=_[_0xa57c('0x8')](config[_0xa57c('0x7')],{'host':_0xa57c('0x9'),'port':0x18eb});var socket=require(_0xa57c('0xa'))(new Redis(config[_0xa57c('0x7')]));require(_0xa57c('0xb'))[_0xa57c('0xc')](socket);function respondWithStatusCode(_0x5e3962,_0x13dad8){_0x13dad8=_0x13dad8||0xcc;return function(_0x4b51d8){if(_0x4b51d8){return _0x5e3962[_0xa57c('0xd')](_0x13dad8);}return _0x5e3962[_0xa57c('0xe')](_0x13dad8)['end']();};}function respondWithResult(_0x156bca,_0x51f287){_0x51f287=_0x51f287||0xc8;return function(_0x554101){if(_0x554101){return _0x156bca[_0xa57c('0xe')](_0x51f287)['json'](_0x554101);}};}function respondWithFilteredResult(_0x2ed4c6,_0x5a8952){return function(_0x4200c1){if(_0x4200c1){var _0x4ca5b2=typeof _0x5a8952[_0xa57c('0xf')]===_0xa57c('0x10')&&typeof _0x5a8952[_0xa57c('0x11')]==='undefined';var _0x2644a1=_0x4200c1['count'];var _0x30d23d=_0x4ca5b2?0x0:_0x5a8952[_0xa57c('0xf')];var _0x30940d=_0x4ca5b2?_0x4200c1[_0xa57c('0x12')]:_0x5a8952[_0xa57c('0xf')]+_0x5a8952[_0xa57c('0x11')];var _0x3f900a;if(_0x30940d>=_0x2644a1){_0x30940d=_0x2644a1;_0x3f900a=0xc8;}else{_0x3f900a=0xce;}_0x2ed4c6['status'](_0x3f900a);return _0x2ed4c6[_0xa57c('0x13')](_0xa57c('0x14'),_0x30d23d+'-'+_0x30940d+'/'+_0x2644a1)[_0xa57c('0x15')](_0x4200c1);}return null;};}function saveUpdates(_0x5a6024){return function(_0x2746a0){if(_0x2746a0){return _0x2746a0['update'](_0x5a6024)[_0xa57c('0x16')](function(_0x3d781d){return _0x3d781d;});}return null;};}function removeEntity(_0x93462c){return function(_0xe3d505){if(_0xe3d505){return _0xe3d505[_0xa57c('0x17')]()[_0xa57c('0x16')](function(){var _0x6f3f89=_0xe3d505[_0xa57c('0x18')]({'plain':!![]});var _0x4e4399=_0xa57c('0x19');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e4399,'resourceId':_0x6f3f89['id']}})[_0xa57c('0x16')](function(){return _0xe3d505;});})[_0xa57c('0x16')](function(){_0x93462c[_0xa57c('0xe')](0xcc)[_0xa57c('0x1a')]();});}};}function handleEntityNotFound(_0x49242c){return function(_0x348211){if(!_0x348211){_0x49242c[_0xa57c('0xd')](0x194);}return _0x348211;};}function handleError(_0x34d1bc,_0x2213b2){_0x2213b2=_0x2213b2||0x1f4;return function(_0x3bb969){logger[_0xa57c('0x1b')](_0x3bb969[_0xa57c('0x1c')]);if(_0x3bb969[_0xa57c('0x1d')]){delete _0x3bb969[_0xa57c('0x1d')];}_0x34d1bc[_0xa57c('0xe')](_0x2213b2)[_0xa57c('0x1e')](_0x3bb969);};}exports[_0xa57c('0x1f')]=function(_0x241dcc,_0x10a33d){var _0x431bec={};var _0x511a26={'count':0x0,'rows':[]};var _0x2db443=_[_0xa57c('0x20')](db[_0xa57c('0x21')][_0xa57c('0x22')],function(_0x315ad7){return{'name':_0x315ad7[_0xa57c('0x23')],'type':_0x315ad7[_0xa57c('0x24')][_0xa57c('0x25')]};});_0x431bec=qs[_0xa57c('0x26')](_0x2db443,_0x241dcc);var _0x1d59c2={'where':_0x431bec['where']};return db[_0xa57c('0x21')]['count'](_0x1d59c2)['then'](function(_0x257661){_0x511a26[_0xa57c('0x12')]=_0x257661;_0x431bec['include']=qs[_0xa57c('0x27')](_0x241dcc[_0xa57c('0x28')]);return db[_0xa57c('0x21')]['findAll'](_0x431bec);})[_0xa57c('0x16')](function(_0x58d46f){_0x511a26[_0xa57c('0x29')]=_0x58d46f;return _0x511a26;})['then'](respondWithFilteredResult(_0x10a33d,_0x431bec))[_0xa57c('0x2a')](handleError(_0x10a33d,null));};exports['show']=function(_0xd4c5d4,_0x532164){var _0x9e02bb={'raw':!![],'where':{'id':_0xd4c5d4[_0xa57c('0x2b')]['id']}},_0x1d82d9={};_0x1d82d9[_0xa57c('0x2c')]=_[_0xa57c('0x2d')](db[_0xa57c('0x21')][_0xa57c('0x22')]);_0x1d82d9['query']=_[_0xa57c('0x2d')](_0xd4c5d4['query']);_0x1d82d9[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x1d82d9[_0xa57c('0x2c')],_0x1d82d9['query']);_0x9e02bb[_0xa57c('0x30')]=_['intersection'](_0x1d82d9[_0xa57c('0x2c')],qs['fields'](_0xd4c5d4[_0xa57c('0x28')]['fields']));_0x9e02bb[_0xa57c('0x30')]=_0x9e02bb[_0xa57c('0x30')]['length']?_0x9e02bb[_0xa57c('0x30')]:_0x1d82d9['model'];if(_0xd4c5d4[_0xa57c('0x28')]['includeAll']){_0x9e02bb[_0xa57c('0x27')]=[{'all':!![]}];}_0x9e02bb=_[_0xa57c('0x31')]({},_0x9e02bb,_0xd4c5d4[_0xa57c('0x32')]);return db[_0xa57c('0x21')][_0xa57c('0x33')](_0x9e02bb)[_0xa57c('0x16')](handleEntityNotFound(_0x532164,null))['then'](respondWithResult(_0x532164,null))['catch'](handleError(_0x532164,null));};exports[_0xa57c('0x34')]=function(_0x13e390,_0x2c70d6){return db['FaxQueue'][_0xa57c('0x34')](_0x13e390['body'],{})[_0xa57c('0x16')](function(_0x4184f3){var _0x5c8256=_0x13e390['user']['get']({'plain':!![]});if(!_0x5c8256)throw new Error(_0xa57c('0x35'));if(_0x5c8256[_0xa57c('0x36')]===_0xa57c('0x37')){var _0x21e4df=_0x4184f3[_0xa57c('0x18')]({'plain':!![]});var _0x1b98a0='FaxQueues';return db[_0xa57c('0x38')][_0xa57c('0x33')]({'where':{'name':_0x1b98a0,'userProfileId':_0x5c8256['userProfileId']},'raw':!![]})['then'](function(_0x5e10b){if(_0x5e10b&&_0x5e10b[_0xa57c('0x39')]===0x0){return db['UserProfileResource'][_0xa57c('0x34')]({'name':_0x21e4df[_0xa57c('0x1d')],'resourceId':_0x21e4df['id'],'type':_0x5e10b[_0xa57c('0x1d')],'sectionId':_0x5e10b['id']},{})[_0xa57c('0x16')](function(){return _0x4184f3;});}else{return _0x4184f3;}})[_0xa57c('0x2a')](function(_0x43c1d7){logger['error'](_0xa57c('0x3a'),_0x43c1d7);throw _0x43c1d7;});}return _0x4184f3;})['then'](respondWithResult(_0x2c70d6,0xc9))['catch'](handleError(_0x2c70d6,null));};exports['update']=function(_0x520383,_0x588199){if(_0x520383[_0xa57c('0x3b')]['id']){delete _0x520383[_0xa57c('0x3b')]['id'];}return db[_0xa57c('0x21')]['find']({'where':{'id':_0x520383['params']['id']}})['then'](handleEntityNotFound(_0x588199,null))[_0xa57c('0x16')](saveUpdates(_0x520383[_0xa57c('0x3b')],null))[_0xa57c('0x16')](respondWithResult(_0x588199,null))[_0xa57c('0x2a')](handleError(_0x588199,null));};exports[_0xa57c('0x17')]=function(_0x17c5dd,_0x48d2a7){return db[_0xa57c('0x21')][_0xa57c('0x33')]({'where':{'id':_0x17c5dd[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x48d2a7,null))[_0xa57c('0x16')](removeEntity(_0x48d2a7,null))[_0xa57c('0x2a')](handleError(_0x48d2a7,null));};exports['describe']=function(_0x246f84,_0xcf1c29){return db[_0xa57c('0x21')][_0xa57c('0x3c')]()[_0xa57c('0x16')](respondWithResult(_0xcf1c29,null))['catch'](handleError(_0xcf1c29,null));};exports[_0xa57c('0x3d')]=function(_0x13ede7,_0xa18f64){var _0x17aae4={'raw':!![],'where':{}},_0x7ba8ab={},_0x11fccc;return db['FaxQueue'][_0xa57c('0x3e')]({'where':{'id':_0x13ede7[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0xa18f64,null))[_0xa57c('0x16')](function(_0x2ea6af){if(_0x2ea6af){_0x11fccc=_0x2ea6af[_0xa57c('0x18')]({'plain':!![]});_0x7ba8ab['model']=_['keys'](db['UserFaxQueue']['rawAttributes']);_0x7ba8ab[_0xa57c('0x28')]=_['keys'](_0x13ede7[_0xa57c('0x28')]);_0x7ba8ab[_0xa57c('0x2e')]=_['intersection'](_0x7ba8ab[_0xa57c('0x2c')],_0x7ba8ab[_0xa57c('0x28')]);_0x17aae4[_0xa57c('0x30')]=_[_0xa57c('0x2f')](_0x7ba8ab[_0xa57c('0x2c')],qs['fields'](_0x13ede7[_0xa57c('0x28')][_0xa57c('0x3f')]));_0x17aae4[_0xa57c('0x30')]=_0x17aae4[_0xa57c('0x30')][_0xa57c('0x40')]?_0x17aae4['attributes']:_0x7ba8ab[_0xa57c('0x2c')];if(!_0x13ede7['query']['hasOwnProperty'](_0xa57c('0x41'))){_0x17aae4[_0xa57c('0x11')]=qs[_0xa57c('0x11')](_0x13ede7['query']['limit']);_0x17aae4[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x13ede7[_0xa57c('0x28')][_0xa57c('0xf')]);}_0x17aae4['order']=qs[_0xa57c('0x42')](_0x13ede7[_0xa57c('0x28')][_0xa57c('0x42')]);_0x17aae4['where']=qs['filters'](_[_0xa57c('0x43')](_0x13ede7[_0xa57c('0x28')],_0x7ba8ab['filters']));_0x17aae4[_0xa57c('0x44')][_0xa57c('0x45')]=_0x2ea6af['id'];if(_0x13ede7[_0xa57c('0x28')][_0xa57c('0x46')]){_0x17aae4[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x17aae4[_0xa57c('0x44')],{'$or':_['map'](_0x17aae4['attributes'],function(_0x2f93fd){var _0x14f3d6={};_0x14f3d6[_0x2f93fd]={'$like':'%'+_0x13ede7[_0xa57c('0x28')][_0xa57c('0x46')]+'%'};return _0x14f3d6;})});}_0x17aae4=_[_0xa57c('0x31')]({},_0x17aae4,_0x13ede7[_0xa57c('0x32')]);return db[_0xa57c('0x47')][_0xa57c('0x48')](_0x17aae4);}})['then'](function(_0x4da028){if(_0x4da028){return db[_0xa57c('0x49')]['findAndCountAll']({'where':{'id':_[_0xa57c('0x20')](_0x4da028,_0xa57c('0x4a')),'role':_0xa57c('0x4b')},'attributes':['id','name',_0xa57c('0x4c'),'updatedAt',_0xa57c('0x4d')]});}})['then'](function(_0x39484d){if(_0x39484d){return{'count':_0x39484d[_0xa57c('0x12')],'rows':_[_0xa57c('0x20')](_0x39484d[_0xa57c('0x29')],function(_0x4c192d){return{'membername':_0x4c192d[_0xa57c('0x1d')],'UserId':_0x4c192d['id'],'queue_name':_0x11fccc[_0xa57c('0x1d')],'FaxQueueId':_0x11fccc['id'],'interface':util[_0xa57c('0x4e')](_0xa57c('0x4f'),_0xa57c('0x50'),_0x4c192d['name']),'penalty':0x0,'paused':_0x4c192d[_0xa57c('0x4c')],'createdAt':_0x4c192d[_0xa57c('0x4d')],'updatedAt':_0x4c192d[_0xa57c('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa57c('0x16')](respondWithFilteredResult(_0xa18f64,_0x17aae4))[_0xa57c('0x2a')](handleError(_0xa18f64,null));};exports[_0xa57c('0x52')]=function(_0x143ec3,_0x419527){var _0x3424a7={};var _0x41041f={};var _0x5a046e;var _0x261c99;return db[_0xa57c('0x21')][_0xa57c('0x3e')]({'where':{'id':_0x143ec3[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x419527,null))[_0xa57c('0x16')](function(_0x5440c2){if(_0x5440c2){_0x5a046e=_0x5440c2;_0x41041f[_0xa57c('0x2c')]=_[_0xa57c('0x2d')](db['Team'][_0xa57c('0x22')]);_0x41041f[_0xa57c('0x28')]=_[_0xa57c('0x2d')](_0x143ec3[_0xa57c('0x28')]);_0x41041f[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x41041f[_0xa57c('0x2c')],_0x41041f['query']);_0x3424a7[_0xa57c('0x30')]=_['intersection'](_0x41041f[_0xa57c('0x2c')],qs['fields'](_0x143ec3[_0xa57c('0x28')]['fields']));_0x3424a7[_0xa57c('0x30')]=_0x3424a7[_0xa57c('0x30')]['length']?_0x3424a7[_0xa57c('0x30')]:_0x41041f[_0xa57c('0x2c')];_0x3424a7[_0xa57c('0x53')]=qs[_0xa57c('0x42')](_0x143ec3['query'][_0xa57c('0x42')]);_0x3424a7[_0xa57c('0x44')]=qs[_0xa57c('0x2e')](_[_0xa57c('0x43')](_0x143ec3[_0xa57c('0x28')],_0x41041f[_0xa57c('0x2e')]));if(_0x143ec3[_0xa57c('0x28')][_0xa57c('0x46')]){_0x3424a7[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x3424a7[_0xa57c('0x44')],{'$or':_[_0xa57c('0x20')](_0x3424a7[_0xa57c('0x30')],function(_0x83e9c7){var _0x23552a={};_0x23552a[_0x83e9c7]={'$like':'%'+_0x143ec3[_0xa57c('0x28')]['filter']+'%'};return _0x23552a;})});}_0x3424a7=_[_0xa57c('0x31')]({},_0x3424a7,_0x143ec3['options']);return _0x5a046e[_0xa57c('0x52')](_0x3424a7);}})[_0xa57c('0x16')](function(_0x245238){if(_0x245238){_0x261c99=_0x245238['length'];if(!_0x143ec3[_0xa57c('0x28')][_0xa57c('0x54')](_0xa57c('0x41'))){_0x3424a7['limit']=qs['limit'](_0x143ec3[_0xa57c('0x28')][_0xa57c('0x11')]);_0x3424a7[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x143ec3[_0xa57c('0x28')][_0xa57c('0xf')]);}return _0x5a046e[_0xa57c('0x52')](_0x3424a7);}})[_0xa57c('0x16')](function(_0x37cbaf){if(_0x37cbaf){return _0x37cbaf?{'count':_0x261c99,'rows':_0x37cbaf}:null;}})['then'](respondWithResult(_0x419527,null))[_0xa57c('0x2a')](handleError(_0x419527,null));};exports[_0xa57c('0x55')]=function(_0x55f526,_0x2e37d7){var _0x1df5f6=_0x55f526[_0xa57c('0x3b')][_0xa57c('0x56')];return db[_0xa57c('0x57')][_0xa57c('0x48')]({'where':{'id':_0x1df5f6},'attributes':['id'],'include':[{'model':db[_0xa57c('0x49')],'as':_0xa57c('0x58'),'attributes':['id','name',_0xa57c('0x59'),_0xa57c('0x5a'),'interface'],'raw':!![]}]})[_0xa57c('0x16')](function(_0x4a74d7){if(_0x4a74d7){var _0x5454cb=_['flatMap'](_0x4a74d7,function(_0x30dac7){var _0x3a5e2d=_0x30dac7[_0xa57c('0x18')]({'plain':!![]});return _0x3a5e2d[_0xa57c('0x58')];});return db[_0xa57c('0x21')]['find']({'where':{'id':_0x55f526[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](function(_0x2fd797){return db['sequelize'][_0xa57c('0x5b')](function(_0x5a3611){return _0x2fd797[_0xa57c('0x55')](_0x1df5f6,{'transaction':_0x5a3611})[_0xa57c('0x16')](function(){return BPromise[_0xa57c('0x5c')](_0x5454cb,function(_0x2bd081){return db['UserFaxQueue'][_0xa57c('0x5d')]({'where':{'UserId':_0x2bd081['id'],'FaxQueueId':_0x55f526[_0xa57c('0x2b')]['id']},'transaction':_0x5a3611});});})[_0xa57c('0x16')](function(){_0x5454cb[_0xa57c('0x5e')](function(_0x5b0ce6){socket[_0xa57c('0x5f')](_0xa57c('0x60'),{'UserId':_0x5b0ce6['id'],'FaxQueueId':_0x2fd797['id']});});});});});}})[_0xa57c('0x16')](respondWithStatusCode(_0x2e37d7,null))['catch'](handleError(_0x2e37d7,null));};exports[_0xa57c('0x61')]=function(_0x448afd,_0x2ed4f4){return db['Team'][_0xa57c('0x48')]({'where':{'id':_0x448afd[_0xa57c('0x28')][_0xa57c('0x56')]},'attributes':['id'],'include':[{'model':db[_0xa57c('0x49')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa57c('0x16')](handleEntityNotFound(_0x2ed4f4,null))[_0xa57c('0x16')](function(_0x5c92ec){var _0x2dac12=_[_0xa57c('0x20')](_0x5c92ec,'id');var _0x59d2a2=[];var _0x29a4e0=[];var _0x4d4524=squel[_0xa57c('0x62')]();_0x4d4524[_0xa57c('0x63')](_0xa57c('0x64'))[_0xa57c('0x65')]('team_has_fax_queues','tq')[_0xa57c('0x66')](_0xa57c('0x67'),'ut',_0xa57c('0x68'))[_0xa57c('0x44')](_0xa57c('0x69'),_0x448afd[_0xa57c('0x2b')]['id']);for(var _0x18b36e=0x0;_0x18b36e<_0x5c92ec[_0xa57c('0x40')];_0x18b36e+=0x1){let _0x1129f=_0x5c92ec[_0x18b36e];for(var _0x2c4e6c=0x0;_0x2c4e6c<_0x1129f[_0xa57c('0x58')]['length'];_0x2c4e6c+=0x1){let _0x488c35=_0x1129f['Agents'][_0x2c4e6c];var _0x29b491=_0x4d4524['clone']();_0x29b491[_0xa57c('0x44')](_0xa57c('0x6a'),_0x488c35['id']);_0x29a4e0[_0xa57c('0x6b')](db['sequelize'][_0xa57c('0x28')](_0x29b491[_0xa57c('0x6c')](),{'type':db[_0xa57c('0x6d')][_0xa57c('0x6e')][_0xa57c('0x6f')]})[_0xa57c('0x16')](function(_0x1cde94){if(_0x1cde94['length']===0x1){return _0x488c35['id'];}else{var _0xcebd5e=_[_0xa57c('0x70')](_['map'](_0x1cde94,'TeamId'),function(_0x1d0d13){return _[_0xa57c('0x71')](_0x2dac12,_0x1d0d13);});if(_0xcebd5e){return _0x488c35['id'];}}}));}}return BPromise['all'](_0x29a4e0)['then'](function(_0xc5f17e){_0x59d2a2=_(_0x59d2a2)['union'](_0xc5f17e)[_0xa57c('0x72')]()[_0xa57c('0x73')]();return db['FaxQueue'][_0xa57c('0x33')]({'where':{'id':_0x448afd[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](function(_0x3df8f5){return db[_0xa57c('0x6d')]['transaction'](function(_0x17fc78){return _0x3df8f5['removeTeams'](_0x448afd[_0xa57c('0x28')][_0xa57c('0x56')],{'transaction':_0x17fc78})['then'](function(){if(!_['isEmpty'](_0x59d2a2)){return _0x3df8f5['removeAgents'](_0x59d2a2,{'transaction':_0x17fc78});}})[_0xa57c('0x16')](function(){_0x59d2a2['forEach'](function(_0x502309){socket[_0xa57c('0x5f')](_0xa57c('0x74'),{'UserId':_0x502309,'FaxQueueId':_0x3df8f5['id']});});});});});});})[_0xa57c('0x16')](respondWithStatusCode(_0x2ed4f4,null))['catch'](handleError(_0x2ed4f4,null));};exports[_0xa57c('0x75')]=function(_0x1f28e9,_0x11e592){return db['FaxQueue']['find']({'where':{'id':_0x1f28e9[_0xa57c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x11e592,null))[_0xa57c('0x16')](function(_0x41d535){if(_0x41d535){return _0x41d535['addAgents'](_0x1f28e9[_0xa57c('0x3b')]['ids'],_['omit'](_0x1f28e9['body'],[_0xa57c('0x56'),'id'])||{})['spread'](function(_0x5143c0){for(var _0x542194=0x0;_0x542194<_0x1f28e9[_0xa57c('0x3b')][_0xa57c('0x56')]['length'];_0x542194+=0x1){socket[_0xa57c('0x5f')](_0xa57c('0x60'),{'UserId':Number(_0x1f28e9[_0xa57c('0x3b')]['ids'][_0x542194]),'FaxQueueId':Number(_0x1f28e9[_0xa57c('0x2b')]['id'])});}return _0x5143c0;});}})[_0xa57c('0x16')](respondWithResult(_0x11e592,null))[_0xa57c('0x2a')](handleError(_0x11e592,null));};exports[_0xa57c('0x76')]=function(_0x54bf3d,_0x5e0db8){return db[_0xa57c('0x21')]['find']({'where':{'id':_0x54bf3d[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x5e0db8,null))[_0xa57c('0x16')](function(_0x4dc6ac){if(_0x4dc6ac){return _0x4dc6ac[_0xa57c('0x76')](_0x54bf3d['query']['ids'])[_0xa57c('0x16')](function(){if(_['isArray'](_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')])){for(var _0x536e87=0x0;_0x536e87<_0x54bf3d['query'][_0xa57c('0x56')][_0xa57c('0x40')];_0x536e87+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')][_0x536e87]),'FaxQueueId':Number(_0x54bf3d[_0xa57c('0x2b')]['id'])});}}else{socket['emit'](_0xa57c('0x74'),{'UserId':Number(_0x54bf3d[_0xa57c('0x28')][_0xa57c('0x56')]),'FaxQueueId':Number(_0x54bf3d[_0xa57c('0x2b')]['id'])});}});}})[_0xa57c('0x16')](respondWithStatusCode(_0x5e0db8,null))[_0xa57c('0x2a')](handleError(_0x5e0db8,null));};exports[_0xa57c('0x77')]=function(_0x4133f7,_0x39e5d6){var _0x75888e={};var _0x46b223={};var _0x2fa5fe;var _0x3c82d7;return db['FaxQueue'][_0xa57c('0x3e')]({'where':{'id':_0x4133f7[_0xa57c('0x2b')]['id']}})[_0xa57c('0x16')](handleEntityNotFound(_0x39e5d6,null))[_0xa57c('0x16')](function(_0x159b00){if(_0x159b00){_0x2fa5fe=_0x159b00;_0x46b223[_0xa57c('0x2c')]=_['keys'](db['User'][_0xa57c('0x22')]);_0x46b223['query']=_['keys'](_0x4133f7[_0xa57c('0x28')]);_0x46b223[_0xa57c('0x2e')]=_[_0xa57c('0x2f')](_0x46b223['model'],_0x46b223[_0xa57c('0x28')]);_0x75888e[_0xa57c('0x30')]=_[_0xa57c('0x2f')](_0x46b223[_0xa57c('0x2c')],qs[_0xa57c('0x3f')](_0x4133f7['query']['fields']));_0x75888e[_0xa57c('0x30')]=_0x75888e[_0xa57c('0x30')][_0xa57c('0x40')]?_0x75888e['attributes']:_0x46b223[_0xa57c('0x2c')];_0x75888e['order']=qs[_0xa57c('0x42')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0x42')]);_0x75888e[_0xa57c('0x44')]=qs[_0xa57c('0x2e')](_[_0xa57c('0x43')](_0x4133f7[_0xa57c('0x28')],_0x46b223['filters']));if(_0x4133f7['query'][_0xa57c('0x46')]){_0x75888e[_0xa57c('0x44')]=_[_0xa57c('0x31')](_0x75888e['where'],{'$or':_['map'](_0x75888e[_0xa57c('0x30')],function(_0xfff76a){var _0x169e6a={};_0x169e6a[_0xfff76a]={'$like':'%'+_0x4133f7[_0xa57c('0x28')][_0xa57c('0x46')]+'%'};return _0x169e6a;})});}_0x75888e=_['merge']({},_0x75888e,_0x4133f7[_0xa57c('0x32')]);return _0x2fa5fe[_0xa57c('0x77')](_0x75888e);}})[_0xa57c('0x16')](function(_0x5dd496){if(_0x5dd496){_0x3c82d7=_0x5dd496[_0xa57c('0x40')];if(!_0x4133f7[_0xa57c('0x28')]['hasOwnProperty'](_0xa57c('0x41'))){_0x75888e[_0xa57c('0x11')]=qs[_0xa57c('0x11')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0x11')]);_0x75888e[_0xa57c('0xf')]=qs[_0xa57c('0xf')](_0x4133f7[_0xa57c('0x28')][_0xa57c('0xf')]);}return _0x2fa5fe['getAgents'](_0x75888e);}})[_0xa57c('0x16')](function(_0x56121){if(_0x56121){return _0x56121?{'count':_0x3c82d7,'rows':_0x56121}:null;}})[_0xa57c('0x16')](respondWithResult(_0x39e5d6,null))[_0xa57c('0x2a')](handleError(_0x39e5d6,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 8ee8e46..96fe436 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 _0x2d87=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x3be6a0,_0x2079da){var _0x20ba69=function(_0x2fa682){while(--_0x2fa682){_0x3be6a0['push'](_0x3be6a0['shift']());}};_0x20ba69(++_0x2079da);}(_0x2d87,0x1d5));var _0x72d8=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2d87[_0x47e7cb];return _0x2a8874;};'use strict';var EventEmitter=require(_0x72d8('0x0'));var FaxQueue=require(_0x72d8('0x1'))['db'][_0x72d8('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x72d8('0x3')](0x0);var events={'afterCreate':_0x72d8('0x4'),'afterUpdate':_0x72d8('0x5'),'afterDestroy':_0x72d8('0x6')};function emitEvent(_0x4e6b54){return function(_0xff6584,_0x5d6ff9,_0x1cd3ad){FaxQueueEvents[_0x72d8('0x7')](_0x4e6b54+':'+_0xff6584['id'],_0xff6584);FaxQueueEvents[_0x72d8('0x7')](_0x4e6b54,_0xff6584);_0x1cd3ad(null);};}for(var e in events){if(events[_0x72d8('0x8')](e)){var event=events[e];FaxQueue[_0x72d8('0x9')](e,emitEvent(event));}}module[_0x72d8('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x8d91=['exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x8d91,0x10f));var _0x18d9=function(_0x4c669d,_0x12cb18){_0x4c669d=_0x4c669d-0x0;var _0x4e26a2=_0x8d91[_0x4c669d];return _0x4e26a2;};'use strict';var EventEmitter=require(_0x18d9('0x0'));var FaxQueue=require(_0x18d9('0x1'))['db'][_0x18d9('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x18d9('0x3')](0x0);var events={'afterCreate':_0x18d9('0x4'),'afterUpdate':'update','afterDestroy':_0x18d9('0x5')};function emitEvent(_0x51744e){return function(_0x2fbeb3,_0x3d91c7,_0x44c146){FaxQueueEvents['emit'](_0x51744e+':'+_0x2fbeb3['id'],_0x2fbeb3);FaxQueueEvents[_0x18d9('0x6')](_0x51744e,_0x2fbeb3);_0x44c146(null);};}for(var e in events){if(events[_0x18d9('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x18d9('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 2640110..2fea0d4 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 _0x831b=['define','fax_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf','./faxQueue.attributes','exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x831b,0x7b));var _0xb831=function(_0x4f94bf,_0x5162b3){_0x4f94bf=_0x4f94bf-0x0;var _0x440d82=_0x831b[_0x4f94bf];return _0x440d82;};'use strict';var _=require(_0xb831('0x0'));var util=require(_0xb831('0x1'));var logger=require(_0xb831('0x2'))(_0xb831('0x3'));var moment=require('moment');var BPromise=require(_0xb831('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb831('0x5'));var rimraf=require(_0xb831('0x6'));var config=require('../../config/environment');var attributes=require(_0xb831('0x7'));module[_0xb831('0x8')]=function(_0x49ada9,_0x51f434){return _0x49ada9[_0xb831('0x9')]('FaxQueue',attributes,{'tableName':_0xb831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x19f6=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x5db657,_0x2f40b3){var _0x2d6e70=function(_0x358ed2){while(--_0x358ed2){_0x5db657['push'](_0x5db657['shift']());}};_0x2d6e70(++_0x2f40b3);}(_0x19f6,0x144));var _0x619f=function(_0x1fcbb7,_0x21ff69){_0x1fcbb7=_0x1fcbb7-0x0;var _0x1a5046=_0x19f6[_0x1fcbb7];return _0x1a5046;};'use strict';var _=require(_0x619f('0x0'));var util=require(_0x619f('0x1'));var logger=require(_0x619f('0x2'))('api');var moment=require(_0x619f('0x3'));var BPromise=require(_0x619f('0x4'));var rp=require(_0x619f('0x5'));var fs=require('fs');var path=require(_0x619f('0x6'));var rimraf=require(_0x619f('0x7'));var config=require('../../config/environment');var attributes=require(_0x619f('0x8'));module[_0x619f('0x9')]=function(_0x37a8f0,_0x4b5866){return _0x37a8f0[_0x619f('0xa')](_0x619f('0xb'),attributes,{'tableName':_0x619f('0xc'),'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 38db3a7..ad6ab49 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 _0xf4f2=['GetFaxQueue','ShowFaxQueue','find','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxQueue','options','raw','where','limit','map','include','model','attributes'];(function(_0x21064b,_0x17ab80){var _0x4404ef=function(_0x472937){while(--_0x472937){_0x21064b['push'](_0x21064b['shift']());}};_0x4404ef(++_0x17ab80);}(_0xf4f2,0x14c));var _0x2f4f=function(_0x977f2f,_0x1c0fc2){_0x977f2f=_0x977f2f-0x0;var _0x34afd4=_0xf4f2[_0x977f2f];return _0x34afd4;};'use strict';var _=require(_0x2f4f('0x0'));var util=require('util');var moment=require(_0x2f4f('0x1'));var BPromise=require('bluebird');var rs=require(_0x2f4f('0x2'));var fs=require('fs');var Redis=require(_0x2f4f('0x3'));var db=require(_0x2f4f('0x4'))['db'];var utils=require(_0x2f4f('0x5'));var logger=require('../../config/logger')(_0x2f4f('0x6'));var config=require(_0x2f4f('0x7'));var jayson=require(_0x2f4f('0x8'));var client=jayson[_0x2f4f('0x9')][_0x2f4f('0xa')]({'port':0x232a});config[_0x2f4f('0xb')]=_[_0x2f4f('0xc')](config[_0x2f4f('0xb')],{'host':_0x2f4f('0xd'),'port':0x18eb});var socket=require(_0x2f4f('0xe'))(new Redis(config['redis']));require(_0x2f4f('0xf'))[_0x2f4f('0x10')](socket);function respondWithRpcPromise(_0x754f88,_0x2aecdd,_0x1571a1){return new BPromise(function(_0x5c81c0,_0x1c6cb8){return client[_0x2f4f('0x11')](_0x754f88,_0x1571a1)[_0x2f4f('0x12')](function(_0x14e3bc){logger[_0x2f4f('0x13')](_0x2f4f('0x14'),_0x2aecdd,_0x2f4f('0x15'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2aecdd,_0x2f4f('0x15'),JSON[_0x2f4f('0x16')](_0x14e3bc));if(_0x14e3bc[_0x2f4f('0x17')]){if(_0x14e3bc['error'][_0x2f4f('0x18')]===0x1f4){logger[_0x2f4f('0x17')](_0x2f4f('0x14'),_0x2aecdd,_0x14e3bc[_0x2f4f('0x17')][_0x2f4f('0x19')]);return _0x1c6cb8(_0x14e3bc[_0x2f4f('0x17')][_0x2f4f('0x19')]);}logger['error'](_0x2f4f('0x14'),_0x2aecdd,_0x14e3bc[_0x2f4f('0x17')]['message']);return _0x5c81c0(_0x14e3bc[_0x2f4f('0x17')][_0x2f4f('0x19')]);}else{logger[_0x2f4f('0x13')](_0x2f4f('0x14'),_0x2aecdd,_0x2f4f('0x15'));_0x5c81c0(_0x14e3bc[_0x2f4f('0x1a')]['message']);}})[_0x2f4f('0x1b')](function(_0x7f7cf9){logger[_0x2f4f('0x17')](_0x2f4f('0x14'),_0x2aecdd,_0x7f7cf9);_0x1c6cb8(_0x7f7cf9);});});}exports['GetFaxQueue']=function(_0x41ddae){var _0x4930eb=this;return new Promise(function(_0x428d77,_0x1e5d6a){return db[_0x2f4f('0x1c')]['findAll']({'raw':_0x41ddae[_0x2f4f('0x1d')]?_0x41ddae[_0x2f4f('0x1d')][_0x2f4f('0x1e')]===undefined?!![]:![]:!![],'where':_0x41ddae[_0x2f4f('0x1d')]?_0x41ddae[_0x2f4f('0x1d')][_0x2f4f('0x1f')]||null:null,'attributes':_0x41ddae[_0x2f4f('0x1d')]?_0x41ddae[_0x2f4f('0x1d')]['attributes']||null:null,'limit':_0x41ddae[_0x2f4f('0x1d')]?_0x41ddae[_0x2f4f('0x1d')][_0x2f4f('0x20')]||null:null,'include':_0x41ddae[_0x2f4f('0x1d')]?_0x41ddae[_0x2f4f('0x1d')]['include']?_[_0x2f4f('0x21')](_0x41ddae['options'][_0x2f4f('0x22')],function(_0x1e97a7){return{'model':db[_0x1e97a7['model']],'as':_0x1e97a7['as'],'attributes':_0x1e97a7['attributes'],'include':_0x1e97a7[_0x2f4f('0x22')]?_[_0x2f4f('0x21')](_0x1e97a7['include'],function(_0x18539d){return{'model':db[_0x18539d[_0x2f4f('0x23')]],'as':_0x18539d['as'],'attributes':_0x18539d[_0x2f4f('0x24')],'include':_0x18539d['include']?_[_0x2f4f('0x21')](_0x18539d[_0x2f4f('0x22')],function(_0x54f547){return{'model':db[_0x54f547[_0x2f4f('0x23')]],'as':_0x54f547['as'],'attributes':_0x54f547[_0x2f4f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2f4f('0x12')](function(_0x19bd2e){logger[_0x2f4f('0x13')](_0x2f4f('0x25'),_0x41ddae);logger['debug']('GetFaxQueue',_0x41ddae,JSON[_0x2f4f('0x16')](_0x19bd2e));_0x428d77(_0x19bd2e);})['catch'](function(_0x592df0){logger[_0x2f4f('0x17')](_0x2f4f('0x25'),_0x592df0[_0x2f4f('0x19')],_0x41ddae);_0x1e5d6a(_0x4930eb[_0x2f4f('0x17')](0x1f4,_0x592df0[_0x2f4f('0x19')]));});});};exports[_0x2f4f('0x26')]=function(_0xeb72ff){var _0x1b855f=this;return new Promise(function(_0x52d498,_0x3539d1){return db[_0x2f4f('0x1c')][_0x2f4f('0x27')]({'raw':_0xeb72ff['options']?_0xeb72ff[_0x2f4f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xeb72ff[_0x2f4f('0x1d')]?_0xeb72ff[_0x2f4f('0x1d')][_0x2f4f('0x1f')]||null:null,'attributes':_0xeb72ff[_0x2f4f('0x1d')]?_0xeb72ff[_0x2f4f('0x1d')][_0x2f4f('0x24')]||null:null,'include':_0xeb72ff['options']?_0xeb72ff[_0x2f4f('0x1d')][_0x2f4f('0x22')]?_[_0x2f4f('0x21')](_0xeb72ff[_0x2f4f('0x1d')]['include'],function(_0x2ca49b){return{'model':db[_0x2ca49b[_0x2f4f('0x23')]],'as':_0x2ca49b['as'],'attributes':_0x2ca49b[_0x2f4f('0x24')],'include':_0x2ca49b[_0x2f4f('0x22')]?_[_0x2f4f('0x21')](_0x2ca49b[_0x2f4f('0x22')],function(_0x4d44d4){return{'model':db[_0x4d44d4[_0x2f4f('0x23')]],'as':_0x4d44d4['as'],'attributes':_0x4d44d4[_0x2f4f('0x24')],'include':_0x4d44d4['include']?_['map'](_0x4d44d4['include'],function(_0x5da867){return{'model':db[_0x5da867['model']],'as':_0x5da867['as'],'attributes':_0x5da867[_0x2f4f('0x24')]};}):[]};}):[]};}):[]:[]})[_0x2f4f('0x12')](function(_0x696673){logger[_0x2f4f('0x13')](_0x2f4f('0x26'),_0xeb72ff);logger[_0x2f4f('0x28')]('ShowFaxQueue',_0xeb72ff,JSON[_0x2f4f('0x16')](_0x696673));_0x52d498(_0x696673);})[_0x2f4f('0x1b')](function(_0x134d31){logger[_0x2f4f('0x17')](_0x2f4f('0x26'),_0x134d31[_0x2f4f('0x19')],_0xeb72ff);_0x3539d1(_0x1b855f['error'](0x1f4,_0x134d31['message']));});});}; \ No newline at end of file +var _0x2faa=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','stringify','ShowFaxQueue','find','lodash'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0x2faa,0x13f));var _0xa2fa=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2faa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xa2fa('0x0'));var util=require(_0xa2fa('0x1'));var moment=require(_0xa2fa('0x2'));var BPromise=require(_0xa2fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa2fa('0x4'));var db=require(_0xa2fa('0x5'))['db'];var utils=require(_0xa2fa('0x6'));var logger=require(_0xa2fa('0x7'))('rpc');var config=require(_0xa2fa('0x8'));var jayson=require(_0xa2fa('0x9'));var client=jayson[_0xa2fa('0xa')][_0xa2fa('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0xa2fa('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2fa('0xd'))(new Redis(config['redis']));require(_0xa2fa('0xe'))[_0xa2fa('0xf')](socket);function respondWithRpcPromise(_0x3c0672,_0x1ff149,_0xa438fb){return new BPromise(function(_0x21b196,_0xae07bc){return client['request'](_0x3c0672,_0xa438fb)[_0xa2fa('0x10')](function(_0x5c8355){logger[_0xa2fa('0x11')](_0xa2fa('0x12'),_0x1ff149,_0xa2fa('0x13'));logger[_0xa2fa('0x14')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1ff149,_0xa2fa('0x13'),JSON['stringify'](_0x5c8355));if(_0x5c8355[_0xa2fa('0x15')]){if(_0x5c8355[_0xa2fa('0x15')][_0xa2fa('0x16')]===0x1f4){logger[_0xa2fa('0x15')](_0xa2fa('0x12'),_0x1ff149,_0x5c8355[_0xa2fa('0x15')][_0xa2fa('0x17')]);return _0xae07bc(_0x5c8355[_0xa2fa('0x15')][_0xa2fa('0x17')]);}logger[_0xa2fa('0x15')](_0xa2fa('0x12'),_0x1ff149,_0x5c8355[_0xa2fa('0x15')][_0xa2fa('0x17')]);return _0x21b196(_0x5c8355[_0xa2fa('0x15')]['message']);}else{logger['info'](_0xa2fa('0x12'),_0x1ff149,'request\x20sent');_0x21b196(_0x5c8355[_0xa2fa('0x18')][_0xa2fa('0x17')]);}})[_0xa2fa('0x19')](function(_0x36ec79){logger['error'](_0xa2fa('0x12'),_0x1ff149,_0x36ec79);_0xae07bc(_0x36ec79);});});}exports['GetFaxQueue']=function(_0x589241){var _0x3af74d=this;return new Promise(function(_0x136d43,_0x3564ab){return db[_0xa2fa('0x1a')][_0xa2fa('0x1b')]({'raw':_0x589241[_0xa2fa('0x1c')]?_0x589241[_0xa2fa('0x1c')][_0xa2fa('0x1d')]===undefined?!![]:![]:!![],'where':_0x589241[_0xa2fa('0x1c')]?_0x589241[_0xa2fa('0x1c')][_0xa2fa('0x1e')]||null:null,'attributes':_0x589241['options']?_0x589241['options'][_0xa2fa('0x1f')]||null:null,'limit':_0x589241[_0xa2fa('0x1c')]?_0x589241['options'][_0xa2fa('0x20')]||null:null,'include':_0x589241['options']?_0x589241['options'][_0xa2fa('0x21')]?_[_0xa2fa('0x22')](_0x589241['options'][_0xa2fa('0x21')],function(_0x125e7a){return{'model':db[_0x125e7a['model']],'as':_0x125e7a['as'],'attributes':_0x125e7a[_0xa2fa('0x1f')],'include':_0x125e7a[_0xa2fa('0x21')]?_['map'](_0x125e7a[_0xa2fa('0x21')],function(_0x48c040){return{'model':db[_0x48c040[_0xa2fa('0x23')]],'as':_0x48c040['as'],'attributes':_0x48c040['attributes'],'include':_0x48c040['include']?_[_0xa2fa('0x22')](_0x48c040['include'],function(_0x3c6406){return{'model':db[_0x3c6406[_0xa2fa('0x23')]],'as':_0x3c6406['as'],'attributes':_0x3c6406[_0xa2fa('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2fa('0x10')](function(_0x446cab){logger[_0xa2fa('0x11')](_0xa2fa('0x24'),_0x589241);logger[_0xa2fa('0x14')]('GetFaxQueue',_0x589241,JSON[_0xa2fa('0x25')](_0x446cab));_0x136d43(_0x446cab);})[_0xa2fa('0x19')](function(_0x17c82e){logger['error'](_0xa2fa('0x24'),_0x17c82e[_0xa2fa('0x17')],_0x589241);_0x3564ab(_0x3af74d[_0xa2fa('0x15')](0x1f4,_0x17c82e[_0xa2fa('0x17')]));});});};exports[_0xa2fa('0x26')]=function(_0x3cad6b){var _0x39b526=this;return new Promise(function(_0x150c3f,_0x41e821){return db['FaxQueue'][_0xa2fa('0x27')]({'raw':_0x3cad6b['options']?_0x3cad6b[_0xa2fa('0x1c')][_0xa2fa('0x1d')]===undefined?!![]:![]:!![],'where':_0x3cad6b[_0xa2fa('0x1c')]?_0x3cad6b[_0xa2fa('0x1c')][_0xa2fa('0x1e')]||null:null,'attributes':_0x3cad6b[_0xa2fa('0x1c')]?_0x3cad6b[_0xa2fa('0x1c')][_0xa2fa('0x1f')]||null:null,'include':_0x3cad6b[_0xa2fa('0x1c')]?_0x3cad6b[_0xa2fa('0x1c')][_0xa2fa('0x21')]?_['map'](_0x3cad6b[_0xa2fa('0x1c')]['include'],function(_0x44b14a){return{'model':db[_0x44b14a[_0xa2fa('0x23')]],'as':_0x44b14a['as'],'attributes':_0x44b14a[_0xa2fa('0x1f')],'include':_0x44b14a['include']?_['map'](_0x44b14a[_0xa2fa('0x21')],function(_0x1a3a64){return{'model':db[_0x1a3a64[_0xa2fa('0x23')]],'as':_0x1a3a64['as'],'attributes':_0x1a3a64[_0xa2fa('0x1f')],'include':_0x1a3a64[_0xa2fa('0x21')]?_[_0xa2fa('0x22')](_0x1a3a64[_0xa2fa('0x21')],function(_0xf78f77){return{'model':db[_0xf78f77[_0xa2fa('0x23')]],'as':_0xf78f77['as'],'attributes':_0xf78f77['attributes']};}):[]};}):[]};}):[]:[]})[_0xa2fa('0x10')](function(_0x54ed37){logger[_0xa2fa('0x11')]('ShowFaxQueue',_0x3cad6b);logger['debug'](_0xa2fa('0x26'),_0x3cad6b,JSON[_0xa2fa('0x25')](_0x54ed37));_0x150c3f(_0x54ed37);})[_0xa2fa('0x19')](function(_0x1dad20){logger['error'](_0xa2fa('0x26'),_0x1dad20[_0xa2fa('0x17')],_0x3cad6b);_0x41e821(_0x39b526['error'](0x1f4,_0x1dad20['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 69d82fd..65f8fb4 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 _0xf66d=['length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x31377e,_0x4c41e7){var _0x3c2ae2=function(_0x52b3d0){while(--_0x52b3d0){_0x31377e['push'](_0x31377e['shift']());}};_0x3c2ae2(++_0x4c41e7);}(_0xf66d,0x152));var _0xdf66=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xf66d[_0x4dbaad];return _0x226c72;};'use strict';var FaxQueueEvents=require(_0xdf66('0x0'));var events=[_0xdf66('0x1'),_0xdf66('0x2'),_0xdf66('0x3')];function createListener(_0x3cf97b,_0x3b89db){return function(_0x3da7ef){_0x3b89db[_0xdf66('0x4')](_0x3cf97b,_0x3da7ef);};}function removeListener(_0x3b6543,_0xf6623){return function(){FaxQueueEvents[_0xdf66('0x5')](_0x3b6543,_0xf6623);};}exports['register']=function(_0x15a79f){for(var _0x3e186f=0x0,_0x310cc2=events[_0xdf66('0x6')];_0x3e186f<_0x310cc2;_0x3e186f++){var _0xa2db19=events[_0x3e186f];var _0x46b345=createListener(_0xdf66('0x7')+_0xa2db19,_0x15a79f);FaxQueueEvents['on'](_0xa2db19,_0x46b345);}}; \ No newline at end of file +var _0x50c3=['register','length','faxQueue:','./faxQueue.events','save','remove','update','emit','removeListener'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x50c3,0x1aa));var _0x350c=function(_0x6494dc,_0x1ca181){_0x6494dc=_0x6494dc-0x0;var _0x42a167=_0x50c3[_0x6494dc];return _0x42a167;};'use strict';var FaxQueueEvents=require(_0x350c('0x0'));var events=[_0x350c('0x1'),_0x350c('0x2'),_0x350c('0x3')];function createListener(_0x239ed9,_0x19a7f0){return function(_0x557940){_0x19a7f0[_0x350c('0x4')](_0x239ed9,_0x557940);};}function removeListener(_0x5719c2,_0x4b03a7){return function(){FaxQueueEvents[_0x350c('0x5')](_0x5719c2,_0x4b03a7);};}exports[_0x350c('0x6')]=function(_0x4d3fa7){for(var _0x31317b=0x0,_0x52ea29=events[_0x350c('0x7')];_0x31317b<_0x52ea29;_0x31317b++){var _0x4d072f=events[_0x31317b];var _0x423a0f=createListener(_0x350c('0x8')+_0x4d072f,_0x4d3fa7);FaxQueueEvents['on'](_0x4d072f,_0x423a0f);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index e3fc684..12feaf5 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 _0xdfa0=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','show','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xdfa0,0x69));var _0x0dfa=function(_0x1e4708,_0x46f127){_0x1e4708=_0x1e4708-0x0;var _0x3be814=_0xdfa0[_0x1e4708];return _0x3be814;};'use strict';var multer=require(_0x0dfa('0x0'));var util=require('util');var path=require(_0x0dfa('0x1'));var timeout=require(_0x0dfa('0x2'));var express=require('express');var router=express[_0x0dfa('0x3')]();var fs_extra=require(_0x0dfa('0x4'));var auth=require(_0x0dfa('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0dfa('0x6'));var controller=require('./faxQueue.controller');router[_0x0dfa('0x7')]('/',auth[_0x0dfa('0x8')](),controller['index']);router[_0x0dfa('0x7')](_0x0dfa('0x9'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xa')]);router[_0x0dfa('0x7')]('/:id',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0xb')]);router[_0x0dfa('0x7')]('/:id/members',auth[_0x0dfa('0x8')](),controller['getMembers']);router[_0x0dfa('0x7')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller['getTeams']);router[_0x0dfa('0x7')](_0x0dfa('0xd'),auth['isAuthenticated'](),controller[_0x0dfa('0xe')]);router[_0x0dfa('0xf')]('/',auth['isAuthenticated'](),controller[_0x0dfa('0x10')]);router[_0x0dfa('0xf')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x11')]);router[_0x0dfa('0xf')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x12')]);router[_0x0dfa('0x13')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x15')]);router[_0x0dfa('0x16')](_0x0dfa('0x14'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x17')]);router[_0x0dfa('0x16')](_0x0dfa('0xc'),auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x18')]);router[_0x0dfa('0x16')]('/:id/users',auth[_0x0dfa('0x8')](),controller[_0x0dfa('0x19')]);module[_0x0dfa('0x1a')]=router; \ No newline at end of file +var _0x323f=['getTeams','getAgents','post','create','addTeams','addAgents','put','update','destroy','delete','removeTeams','/:id/users','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x323f,0x1ee));var _0xf323=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x323f[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0x9')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0x9')](_0xf323('0xf'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x9')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);router[_0xf323('0x9')]('/:id/users',auth[_0xf323('0xa')](),controller[_0xf323('0x13')]);router[_0xf323('0x14')]('/',auth['isAuthenticated'](),controller[_0xf323('0x15')]);router[_0xf323('0x14')](_0xf323('0x11'),auth[_0xf323('0xa')](),controller[_0xf323('0x16')]);router[_0xf323('0x14')]('/:id/users',auth['isAuthenticated'](),controller[_0xf323('0x17')]);router[_0xf323('0x18')](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x19')]);router['delete'](_0xf323('0xd'),auth[_0xf323('0xa')](),controller[_0xf323('0x1a')]);router[_0xf323('0x1b')]('/:id/teams',auth[_0xf323('0xa')](),controller[_0xf323('0x1c')]);router[_0xf323('0x1b')](_0xf323('0x1d'),auth['isAuthenticated'](),controller[_0xf323('0x1e')]);module[_0xf323('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 98494f7..9b6d35b 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 _0x6626=['STRING','DATE','moment','sequelize','exports'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x6626,0x183));var _0x6662=function(_0xdeccba,_0x3d427d){_0xdeccba=_0xdeccba-0x0;var _0xa4d6ab=_0x6626[_0xdeccba];return _0xa4d6ab;};'use strict';var moment=require(_0x6662('0x0'));var Sequelize=require(_0x6662('0x1'));module[_0x6662('0x2')]={'uniqueid':{'type':Sequelize[_0x6662('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6662('0x3')]},'joinAt':{'type':Sequelize[_0x6662('0x4')]},'leaveAt':{'type':Sequelize[_0x6662('0x4')]},'acceptAt':{'type':Sequelize[_0x6662('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x6662('0x3')]}}; \ No newline at end of file +var _0x9865=['STRING','DATE','moment','sequelize','exports'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9865,0x1dd));var _0x5986=function(_0x1ddc9f,_0x592ea3){_0x1ddc9f=_0x1ddc9f-0x0;var _0x34d125=_0x9865[_0x1ddc9f];return _0x34d125;};'use strict';var moment=require(_0x5986('0x0'));var Sequelize=require(_0x5986('0x1'));module[_0x5986('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x5986('0x3')]},'joinAt':{'type':Sequelize[_0x5986('0x4')]},'leaveAt':{'type':Sequelize[_0x5986('0x4')]},'acceptAt':{'type':Sequelize[_0x5986('0x4')]},'exitAt':{'type':Sequelize[_0x5986('0x4')]},'reason':{'type':Sequelize[_0x5986('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index db1ea73..d87c42c 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 _0xc298=['sort','where','filters','pick','filter','merge','options','FaxQueueReport','includeAll','include','findAll','catch','show','params','length','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','then','error','name','send','index','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0xd1b4d7,_0x28b2c1){var _0x3002ec=function(_0x3d95ce){while(--_0x3d95ce){_0xd1b4d7['push'](_0xd1b4d7['shift']());}};_0x3002ec(++_0x28b2c1);}(_0xc298,0x143));var _0x8c29=function(_0x17b572,_0x544508){_0x17b572=_0x17b572-0x0;var _0x1d2f7a=_0xc298[_0x17b572];return _0x1d2f7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c29('0x0'));var zipdir=require(_0x8c29('0x1'));var jsonpatch=require(_0x8c29('0x2'));var rp=require(_0x8c29('0x3'));var moment=require(_0x8c29('0x4'));var BPromise=require(_0x8c29('0x5'));var Mustache=require('mustache');var util=require(_0x8c29('0x6'));var path=require(_0x8c29('0x7'));var sox=require(_0x8c29('0x8'));var csv=require(_0x8c29('0x9'));var ejs=require(_0x8c29('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8c29('0xb'));var squel=require(_0x8c29('0xc'));var crypto=require(_0x8c29('0xd'));var jsforce=require(_0x8c29('0xe'));var deskjs=require(_0x8c29('0xf'));var toCsv=require(_0x8c29('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8c29('0x10'));var qs=require(_0x8c29('0x11'));var as=require(_0x8c29('0x12'));var hardwareService=require(_0x8c29('0x13'));var logger=require(_0x8c29('0x14'))(_0x8c29('0x15'));var utils=require(_0x8c29('0x16'));var config=require(_0x8c29('0x17'));var licenseUtil=require(_0x8c29('0x18'));var db=require(_0x8c29('0x19'))['db'];function respondWithStatusCode(_0xd82e60,_0x1dc424){_0x1dc424=_0x1dc424||0xcc;return function(_0x3023d2){if(_0x3023d2){return _0xd82e60[_0x8c29('0x1a')](_0x1dc424);}return _0xd82e60[_0x8c29('0x1b')](_0x1dc424)[_0x8c29('0x1c')]();};}function respondWithResult(_0x5a9eb8,_0x3dc480){_0x3dc480=_0x3dc480||0xc8;return function(_0xcdae4d){if(_0xcdae4d){return _0x5a9eb8['status'](_0x3dc480)['json'](_0xcdae4d);}};}function respondWithFilteredResult(_0x17d84b,_0xe87c50){return function(_0x4929b9){if(_0x4929b9){var _0x24add4=typeof _0xe87c50[_0x8c29('0x1d')]===_0x8c29('0x1e')&&typeof _0xe87c50['limit']===_0x8c29('0x1e');var _0x37fc8e=_0x4929b9[_0x8c29('0x1f')];var _0x6324b8=_0x24add4?0x0:_0xe87c50[_0x8c29('0x1d')];var _0x21ada9=_0x24add4?_0x4929b9['count']:_0xe87c50[_0x8c29('0x1d')]+_0xe87c50[_0x8c29('0x20')];var _0x41e389;if(_0x21ada9>=_0x37fc8e){_0x21ada9=_0x37fc8e;_0x41e389=0xc8;}else{_0x41e389=0xce;}_0x17d84b[_0x8c29('0x1b')](_0x41e389);return _0x17d84b[_0x8c29('0x21')](_0x8c29('0x22'),_0x6324b8+'-'+_0x21ada9+'/'+_0x37fc8e)[_0x8c29('0x23')](_0x4929b9);}return null;};}function patchUpdates(_0x10810c){return function(_0x5c62a0){try{jsonpatch['apply'](_0x5c62a0,_0x10810c,!![]);}catch(_0x2702a1){return BPromise[_0x8c29('0x24')](_0x2702a1);}return _0x5c62a0[_0x8c29('0x25')]();};}function saveUpdates(_0x513efd,_0x5a61f3){return function(_0x3fb320){if(_0x3fb320){return _0x3fb320[_0x8c29('0x26')](_0x513efd)[_0x8c29('0x27')](function(_0x157e61){return _0x157e61;});}return null;};}function removeEntity(_0x34cf21,_0x507124){return function(_0x40431d){if(_0x40431d){return _0x40431d['destroy']()[_0x8c29('0x27')](function(){_0x34cf21['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c7979,_0x376297){return function(_0x3a967d){if(!_0x3a967d){_0x2c7979['sendStatus'](0x194);}return _0x3a967d;};}function handleError(_0x38a45c,_0x4e0066){_0x4e0066=_0x4e0066||0x1f4;return function(_0x5cd1e7){logger[_0x8c29('0x28')](_0x5cd1e7['stack']);if(_0x5cd1e7[_0x8c29('0x29')]){delete _0x5cd1e7[_0x8c29('0x29')];}_0x38a45c['status'](_0x4e0066)[_0x8c29('0x2a')](_0x5cd1e7);};}exports[_0x8c29('0x2b')]=function(_0x4eee54,_0x2c6ae1){var _0x5dd93a={},_0x48996c={},_0x25f26a={'count':0x0,'rows':[]};var _0x20e42f=_[_0x8c29('0x2c')](db['FaxQueueReport'][_0x8c29('0x2d')],function(_0xde770a){return{'name':_0xde770a['fieldName'],'type':_0xde770a[_0x8c29('0x2e')][_0x8c29('0x2f')]};});_0x48996c['model']=_[_0x8c29('0x2c')](_0x20e42f,_0x8c29('0x29'));_0x48996c[_0x8c29('0x30')]=_[_0x8c29('0x31')](_0x4eee54[_0x8c29('0x30')]);_0x48996c['filters']=_[_0x8c29('0x32')](_0x48996c[_0x8c29('0x33')],_0x48996c[_0x8c29('0x30')]);_0x5dd93a[_0x8c29('0x34')]=_[_0x8c29('0x32')](_0x48996c[_0x8c29('0x33')],qs[_0x8c29('0x35')](_0x4eee54['query'][_0x8c29('0x35')]));_0x5dd93a[_0x8c29('0x34')]=_0x5dd93a[_0x8c29('0x34')]['length']?_0x5dd93a[_0x8c29('0x34')]:_0x48996c[_0x8c29('0x33')];if(!_0x4eee54['query'][_0x8c29('0x36')](_0x8c29('0x37'))){_0x5dd93a['limit']=qs[_0x8c29('0x20')](_0x4eee54[_0x8c29('0x30')][_0x8c29('0x20')]);_0x5dd93a[_0x8c29('0x1d')]=qs['offset'](_0x4eee54[_0x8c29('0x30')][_0x8c29('0x1d')]);}_0x5dd93a[_0x8c29('0x38')]=qs[_0x8c29('0x39')](_0x4eee54[_0x8c29('0x30')]['sort']);_0x5dd93a[_0x8c29('0x3a')]=qs[_0x8c29('0x3b')](_[_0x8c29('0x3c')](_0x4eee54[_0x8c29('0x30')],_0x48996c[_0x8c29('0x3b')]),_0x20e42f);if(_0x4eee54[_0x8c29('0x30')][_0x8c29('0x3d')]){_0x5dd93a[_0x8c29('0x3a')]=_[_0x8c29('0x3e')](_0x5dd93a[_0x8c29('0x3a')],{'$or':_['map'](_0x20e42f,function(_0x351628){if(_0x351628[_0x8c29('0x2e')]!=='VIRTUAL'){var _0x426335={};_0x426335[_0x351628[_0x8c29('0x29')]]={'$like':'%'+_0x4eee54[_0x8c29('0x30')]['filter']+'%'};return _0x426335;}})});}_0x5dd93a=_[_0x8c29('0x3e')]({},_0x5dd93a,_0x4eee54[_0x8c29('0x3f')]);var _0x507aea={'where':_0x5dd93a[_0x8c29('0x3a')]};return db[_0x8c29('0x40')][_0x8c29('0x1f')](_0x507aea)[_0x8c29('0x27')](function(_0x313111){_0x25f26a['count']=_0x313111;if(_0x4eee54[_0x8c29('0x30')][_0x8c29('0x41')]){_0x5dd93a[_0x8c29('0x42')]=[{'all':!![]}];}return db[_0x8c29('0x40')][_0x8c29('0x43')](_0x5dd93a);})[_0x8c29('0x27')](function(_0x187da3){_0x25f26a['rows']=_0x187da3;return _0x25f26a;})[_0x8c29('0x27')](respondWithFilteredResult(_0x2c6ae1,_0x5dd93a))[_0x8c29('0x44')](handleError(_0x2c6ae1,null));};exports[_0x8c29('0x45')]=function(_0x258d4e,_0x5910ff){var _0x59faaf={'raw':!![],'where':{'id':_0x258d4e[_0x8c29('0x46')]['id']}},_0x127ad1={};_0x127ad1['model']=_[_0x8c29('0x31')](db[_0x8c29('0x40')][_0x8c29('0x2d')]);_0x127ad1[_0x8c29('0x30')]=_[_0x8c29('0x31')](_0x258d4e['query']);_0x127ad1[_0x8c29('0x3b')]=_['intersection'](_0x127ad1['model'],_0x127ad1['query']);_0x59faaf[_0x8c29('0x34')]=_[_0x8c29('0x32')](_0x127ad1[_0x8c29('0x33')],qs['fields'](_0x258d4e[_0x8c29('0x30')][_0x8c29('0x35')]));_0x59faaf['attributes']=_0x59faaf[_0x8c29('0x34')][_0x8c29('0x47')]?_0x59faaf[_0x8c29('0x34')]:_0x127ad1[_0x8c29('0x33')];if(_0x258d4e['query']['includeAll']){_0x59faaf['include']=[{'all':!![]}];}_0x59faaf=_[_0x8c29('0x3e')]({},_0x59faaf,_0x258d4e[_0x8c29('0x3f')]);return db['FaxQueueReport']['find'](_0x59faaf)[_0x8c29('0x27')](handleEntityNotFound(_0x5910ff,null))[_0x8c29('0x27')](respondWithResult(_0x5910ff,null))[_0x8c29('0x44')](handleError(_0x5910ff,null));};exports[_0x8c29('0x48')]=function(_0x3d3467,_0x2bb16f){return db[_0x8c29('0x40')]['create'](_0x3d3467[_0x8c29('0x49')],{})[_0x8c29('0x27')](respondWithResult(_0x2bb16f,0xc9))[_0x8c29('0x44')](handleError(_0x2bb16f,null));};exports[_0x8c29('0x26')]=function(_0x1ba6e2,_0x577459){if(_0x1ba6e2[_0x8c29('0x49')]['id']){delete _0x1ba6e2[_0x8c29('0x49')]['id'];}return db[_0x8c29('0x40')]['find']({'where':{'id':_0x1ba6e2[_0x8c29('0x46')]['id']}})[_0x8c29('0x27')](handleEntityNotFound(_0x577459,null))[_0x8c29('0x27')](saveUpdates(_0x1ba6e2[_0x8c29('0x49')],null))[_0x8c29('0x27')](respondWithResult(_0x577459,null))['catch'](handleError(_0x577459,null));};exports[_0x8c29('0x4a')]=function(_0x11b351,_0x4762c1){return db['FaxQueueReport']['find']({'where':{'id':_0x11b351[_0x8c29('0x46')]['id']}})[_0x8c29('0x27')](handleEntityNotFound(_0x4762c1,null))[_0x8c29('0x27')](removeEntity(_0x4762c1,null))[_0x8c29('0x44')](handleError(_0x4762c1,null));};exports['describe']=function(_0x39ffcb,_0x1a6a65){return db[_0x8c29('0x40')][_0x8c29('0x4b')]()[_0x8c29('0x27')](respondWithResult(_0x1a6a65,null))[_0x8c29('0x44')](handleError(_0x1a6a65,null));}; \ No newline at end of file +var _0xdb13=['query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FaxQueueReport','includeAll','findAll','rows','catch','show','params','rawAttributes','fields','include','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fieldName','type','key','model','keys'];(function(_0x452ac2,_0x45f034){var _0x5a589a=function(_0x3c3fe8){while(--_0x3c3fe8){_0x452ac2['push'](_0x452ac2['shift']());}};_0x5a589a(++_0x45f034);}(_0xdb13,0x10c));var _0x3db1=function(_0x3b2807,_0x4a4160){_0x3b2807=_0x3b2807-0x0;var _0x4c26f5=_0xdb13[_0x3b2807];return _0x4c26f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3db1('0x0'));var zipdir=require(_0x3db1('0x1'));var jsonpatch=require(_0x3db1('0x2'));var rp=require(_0x3db1('0x3'));var moment=require(_0x3db1('0x4'));var BPromise=require(_0x3db1('0x5'));var Mustache=require('mustache');var util=require(_0x3db1('0x6'));var path=require(_0x3db1('0x7'));var sox=require(_0x3db1('0x8'));var csv=require(_0x3db1('0x9'));var ejs=require(_0x3db1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3db1('0xb'));var squel=require(_0x3db1('0xc'));var crypto=require(_0x3db1('0xd'));var jsforce=require(_0x3db1('0xe'));var deskjs=require(_0x3db1('0xf'));var toCsv=require(_0x3db1('0x9'));var querystring=require(_0x3db1('0x10'));var Papa=require(_0x3db1('0x11'));var Redis=require(_0x3db1('0x12'));var authService=require(_0x3db1('0x13'));var qs=require(_0x3db1('0x14'));var as=require(_0x3db1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3db1('0x16'))(_0x3db1('0x17'));var utils=require(_0x3db1('0x18'));var config=require(_0x3db1('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13d3cd,_0x12a973){_0x12a973=_0x12a973||0xcc;return function(_0x35954c){if(_0x35954c){return _0x13d3cd[_0x3db1('0x1a')](_0x12a973);}return _0x13d3cd[_0x3db1('0x1b')](_0x12a973)['end']();};}function respondWithResult(_0x59667f,_0x528650){_0x528650=_0x528650||0xc8;return function(_0x5f1633){if(_0x5f1633){return _0x59667f[_0x3db1('0x1b')](_0x528650)[_0x3db1('0x1c')](_0x5f1633);}};}function respondWithFilteredResult(_0x10be63,_0x2b4038){return function(_0xe390b3){if(_0xe390b3){var _0x24d8d6=typeof _0x2b4038['offset']===_0x3db1('0x1d')&&typeof _0x2b4038[_0x3db1('0x1e')]==='undefined';var _0x2d76e9=_0xe390b3[_0x3db1('0x1f')];var _0x549a0e=_0x24d8d6?0x0:_0x2b4038[_0x3db1('0x20')];var _0x5f3203=_0x24d8d6?_0xe390b3[_0x3db1('0x1f')]:_0x2b4038[_0x3db1('0x20')]+_0x2b4038[_0x3db1('0x1e')];var _0x435a76;if(_0x5f3203>=_0x2d76e9){_0x5f3203=_0x2d76e9;_0x435a76=0xc8;}else{_0x435a76=0xce;}_0x10be63['status'](_0x435a76);return _0x10be63[_0x3db1('0x21')](_0x3db1('0x22'),_0x549a0e+'-'+_0x5f3203+'/'+_0x2d76e9)[_0x3db1('0x1c')](_0xe390b3);}return null;};}function patchUpdates(_0x5ae404){return function(_0x365d65){try{jsonpatch[_0x3db1('0x23')](_0x365d65,_0x5ae404,!![]);}catch(_0x3eeca8){return BPromise[_0x3db1('0x24')](_0x3eeca8);}return _0x365d65[_0x3db1('0x25')]();};}function saveUpdates(_0x347555,_0x12f970){return function(_0x3a84aa){if(_0x3a84aa){return _0x3a84aa[_0x3db1('0x26')](_0x347555)[_0x3db1('0x27')](function(_0x3ad8f6){return _0x3ad8f6;});}return null;};}function removeEntity(_0x1ae9af,_0x1ee0c6){return function(_0x47c187){if(_0x47c187){return _0x47c187[_0x3db1('0x28')]()['then'](function(){_0x1ae9af[_0x3db1('0x1b')](0xcc)[_0x3db1('0x29')]();});}};}function handleEntityNotFound(_0x2263c6,_0x58b990){return function(_0x218f71){if(!_0x218f71){_0x2263c6[_0x3db1('0x1a')](0x194);}return _0x218f71;};}function handleError(_0x9792ff,_0x8ba38c){_0x8ba38c=_0x8ba38c||0x1f4;return function(_0x5bd826){logger[_0x3db1('0x2a')](_0x5bd826[_0x3db1('0x2b')]);if(_0x5bd826['name']){delete _0x5bd826[_0x3db1('0x2c')];}_0x9792ff[_0x3db1('0x1b')](_0x8ba38c)[_0x3db1('0x2d')](_0x5bd826);};}exports['index']=function(_0x2d139d,_0x226846){var _0x4164eb={},_0x51ec2f={},_0x4d0572={'count':0x0,'rows':[]};var _0xa731b3=_[_0x3db1('0x2e')](db['FaxQueueReport']['rawAttributes'],function(_0x2d8930){return{'name':_0x2d8930[_0x3db1('0x2f')],'type':_0x2d8930[_0x3db1('0x30')][_0x3db1('0x31')]};});_0x51ec2f[_0x3db1('0x32')]=_[_0x3db1('0x2e')](_0xa731b3,_0x3db1('0x2c'));_0x51ec2f['query']=_[_0x3db1('0x33')](_0x2d139d[_0x3db1('0x34')]);_0x51ec2f[_0x3db1('0x35')]=_[_0x3db1('0x36')](_0x51ec2f[_0x3db1('0x32')],_0x51ec2f[_0x3db1('0x34')]);_0x4164eb[_0x3db1('0x37')]=_[_0x3db1('0x36')](_0x51ec2f[_0x3db1('0x32')],qs['fields'](_0x2d139d[_0x3db1('0x34')]['fields']));_0x4164eb['attributes']=_0x4164eb[_0x3db1('0x37')]['length']?_0x4164eb[_0x3db1('0x37')]:_0x51ec2f['model'];if(!_0x2d139d[_0x3db1('0x34')][_0x3db1('0x38')](_0x3db1('0x39'))){_0x4164eb['limit']=qs['limit'](_0x2d139d['query'][_0x3db1('0x1e')]);_0x4164eb[_0x3db1('0x20')]=qs[_0x3db1('0x20')](_0x2d139d[_0x3db1('0x34')]['offset']);}_0x4164eb[_0x3db1('0x3a')]=qs[_0x3db1('0x3b')](_0x2d139d[_0x3db1('0x34')][_0x3db1('0x3b')]);_0x4164eb[_0x3db1('0x3c')]=qs[_0x3db1('0x35')](_[_0x3db1('0x3d')](_0x2d139d['query'],_0x51ec2f['filters']),_0xa731b3);if(_0x2d139d[_0x3db1('0x34')][_0x3db1('0x3e')]){_0x4164eb[_0x3db1('0x3c')]=_[_0x3db1('0x3f')](_0x4164eb[_0x3db1('0x3c')],{'$or':_['map'](_0xa731b3,function(_0x48fb83){if(_0x48fb83[_0x3db1('0x30')]!==_0x3db1('0x40')){var _0x3d0f20={};_0x3d0f20[_0x48fb83[_0x3db1('0x2c')]]={'$like':'%'+_0x2d139d['query'][_0x3db1('0x3e')]+'%'};return _0x3d0f20;}})});}_0x4164eb=_[_0x3db1('0x3f')]({},_0x4164eb,_0x2d139d[_0x3db1('0x41')]);var _0x594910={'where':_0x4164eb['where']};return db[_0x3db1('0x42')][_0x3db1('0x1f')](_0x594910)[_0x3db1('0x27')](function(_0x4da38d){_0x4d0572['count']=_0x4da38d;if(_0x2d139d[_0x3db1('0x34')][_0x3db1('0x43')]){_0x4164eb['include']=[{'all':!![]}];}return db[_0x3db1('0x42')][_0x3db1('0x44')](_0x4164eb);})[_0x3db1('0x27')](function(_0x511527){_0x4d0572[_0x3db1('0x45')]=_0x511527;return _0x4d0572;})['then'](respondWithFilteredResult(_0x226846,_0x4164eb))[_0x3db1('0x46')](handleError(_0x226846,null));};exports[_0x3db1('0x47')]=function(_0x405eba,_0x414269){var _0x1bd8c1={'raw':!![],'where':{'id':_0x405eba[_0x3db1('0x48')]['id']}},_0x432804={};_0x432804[_0x3db1('0x32')]=_[_0x3db1('0x33')](db[_0x3db1('0x42')][_0x3db1('0x49')]);_0x432804[_0x3db1('0x34')]=_[_0x3db1('0x33')](_0x405eba[_0x3db1('0x34')]);_0x432804[_0x3db1('0x35')]=_['intersection'](_0x432804[_0x3db1('0x32')],_0x432804[_0x3db1('0x34')]);_0x1bd8c1[_0x3db1('0x37')]=_[_0x3db1('0x36')](_0x432804['model'],qs['fields'](_0x405eba[_0x3db1('0x34')][_0x3db1('0x4a')]));_0x1bd8c1[_0x3db1('0x37')]=_0x1bd8c1[_0x3db1('0x37')]['length']?_0x1bd8c1[_0x3db1('0x37')]:_0x432804['model'];if(_0x405eba[_0x3db1('0x34')]['includeAll']){_0x1bd8c1[_0x3db1('0x4b')]=[{'all':!![]}];}_0x1bd8c1=_[_0x3db1('0x3f')]({},_0x1bd8c1,_0x405eba['options']);return db[_0x3db1('0x42')][_0x3db1('0x4c')](_0x1bd8c1)[_0x3db1('0x27')](handleEntityNotFound(_0x414269,null))[_0x3db1('0x27')](respondWithResult(_0x414269,null))[_0x3db1('0x46')](handleError(_0x414269,null));};exports[_0x3db1('0x4d')]=function(_0x45682a,_0x2c0946){return db[_0x3db1('0x42')]['create'](_0x45682a[_0x3db1('0x4e')],{})['then'](respondWithResult(_0x2c0946,0xc9))[_0x3db1('0x46')](handleError(_0x2c0946,null));};exports[_0x3db1('0x26')]=function(_0xb34b3e,_0x5c7c6a){if(_0xb34b3e[_0x3db1('0x4e')]['id']){delete _0xb34b3e['body']['id'];}return db[_0x3db1('0x42')][_0x3db1('0x4c')]({'where':{'id':_0xb34b3e[_0x3db1('0x48')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x5c7c6a,null))[_0x3db1('0x27')](saveUpdates(_0xb34b3e[_0x3db1('0x4e')],null))[_0x3db1('0x27')](respondWithResult(_0x5c7c6a,null))['catch'](handleError(_0x5c7c6a,null));};exports[_0x3db1('0x28')]=function(_0x2e60a0,_0x2c7e97){return db[_0x3db1('0x42')]['find']({'where':{'id':_0x2e60a0[_0x3db1('0x48')]['id']}})[_0x3db1('0x27')](handleEntityNotFound(_0x2c7e97,null))['then'](removeEntity(_0x2c7e97,null))[_0x3db1('0x46')](handleError(_0x2c7e97,null));};exports[_0x3db1('0x4f')]=function(_0x3675fa,_0x27cf50){return db[_0x3db1('0x42')][_0x3db1('0x4f')]()[_0x3db1('0x27')](respondWithResult(_0x27cf50,null))[_0x3db1('0x46')](handleError(_0x27cf50,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 7410451..181f02c 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 _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x297b81,_0x284f46){var _0x199d01=function(_0x49a6a3){while(--_0x49a6a3){_0x297b81['push'](_0x297b81['shift']());}};_0x199d01(++_0x284f46);}(_0x5fc3,0xa8));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'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')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0x814b,0x1a2));var _0xb814=function(_0xfd5f37,_0x24a79c){_0xfd5f37=_0xfd5f37-0x0;var _0x11bd01=_0x814b[_0xfd5f37];return _0x11bd01;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 4f284bf..f1c1a26 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 _0x993f=['where','attributes','limit','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','info','stringify','UpdateFaxQueueReport','update'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x993f,0x87));var _0xf993=function(_0x558c05,_0x77d252){_0x558c05=_0x558c05-0x0;var _0x4bbdab=_0x993f[_0x558c05];return _0x4bbdab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf993('0x0'));var BPromise=require(_0xf993('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf993('0x2'));var db=require(_0xf993('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf993('0x4'))(_0xf993('0x5'));var config=require(_0xf993('0x6'));var jayson=require(_0xf993('0x7'));var client=jayson[_0xf993('0x8')][_0xf993('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1e897b,_0x48b16c,_0x554643){return new BPromise(function(_0x8636c5,_0x49c649){return client[_0xf993('0xa')](_0x1e897b,_0x554643)[_0xf993('0xb')](function(_0x452380){logger['info'](_0xf993('0xc'),_0x48b16c,_0xf993('0xd'));logger[_0xf993('0xe')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x48b16c,_0xf993('0xd'),JSON['stringify'](_0x452380));if(_0x452380[_0xf993('0xf')]){if(_0x452380['error'][_0xf993('0x10')]===0x1f4){logger[_0xf993('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x48b16c,_0x452380[_0xf993('0xf')][_0xf993('0x11')]);return _0x49c649(_0x452380['error'][_0xf993('0x11')]);}logger[_0xf993('0xf')]('FaxQueueReport,\x20%s,\x20%s',_0x48b16c,_0x452380[_0xf993('0xf')][_0xf993('0x11')]);return _0x8636c5(_0x452380[_0xf993('0xf')]['message']);}else{logger['info'](_0xf993('0xc'),_0x48b16c,_0xf993('0xd'));_0x8636c5(_0x452380[_0xf993('0x12')]['message']);}})[_0xf993('0x13')](function(_0x1b5c79){logger[_0xf993('0xf')](_0xf993('0xc'),_0x48b16c,_0x1b5c79);_0x49c649(_0x1b5c79);});});}exports[_0xf993('0x14')]=function(_0xcbaf10){var _0x390f8d=this;return new Promise(function(_0x2166ac,_0x25dbb5){return db[_0xf993('0x15')][_0xf993('0x16')](_0xcbaf10[_0xf993('0x17')],{'raw':_0xcbaf10[_0xf993('0x18')]?_0xcbaf10[_0xf993('0x18')][_0xf993('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x483a44){logger[_0xf993('0x1a')]('CreateFaxQueueReport',_0xcbaf10);logger[_0xf993('0xe')](_0xf993('0x14'),_0xcbaf10,JSON[_0xf993('0x1b')](_0x483a44));_0x2166ac(_0x483a44);})[_0xf993('0x13')](function(_0x1a3d49){logger[_0xf993('0xf')](_0xf993('0x14'),_0x1a3d49['message'],_0xcbaf10);_0x25dbb5(_0x390f8d[_0xf993('0xf')](0x1f4,_0x1a3d49[_0xf993('0x11')]));});});};exports[_0xf993('0x1c')]=function(_0x11738a){var _0x3f5063=this;return new Promise(function(_0x120745,_0x26baa5){return db[_0xf993('0x15')][_0xf993('0x1d')](_0x11738a['body'],{'raw':_0x11738a['options']?_0x11738a[_0xf993('0x18')][_0xf993('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11738a[_0xf993('0x18')]?_0x11738a[_0xf993('0x18')][_0xf993('0x1e')]||null:null,'attributes':_0x11738a['options']?_0x11738a['options'][_0xf993('0x1f')]||null:null,'limit':_0x11738a['options']?_0x11738a[_0xf993('0x18')][_0xf993('0x20')]||null:null})['then'](function(_0x83c9da){logger[_0xf993('0x1a')](_0xf993('0x1c'),_0x11738a);logger[_0xf993('0xe')](_0xf993('0x1c'),_0x11738a,JSON['stringify'](_0x83c9da));_0x120745(_0x83c9da);})[_0xf993('0x13')](function(_0x1a3b93){logger['error']('UpdateFaxQueueReport',_0x1a3b93[_0xf993('0x11')],_0x11738a);_0x26baa5(_0x3f5063[_0xf993('0xf')](0x1f4,_0x1a3b93['message']));});});}; \ No newline at end of file +var _0x8778=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateFaxQueueReport','FaxQueueReport','body','options','raw','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment','bluebird'];(function(_0x234192,_0x2b6a4e){var _0x96e845=function(_0x5ded84){while(--_0x5ded84){_0x234192['push'](_0x234192['shift']());}};_0x96e845(++_0x2b6a4e);}(_0x8778,0xeb));var _0x8877=function(_0x90ea4,_0x10847b){_0x90ea4=_0x90ea4-0x0;var _0x38cc9c=_0x8778[_0x90ea4];return _0x38cc9c;};'use strict';var _=require(_0x8877('0x0'));var util=require('util');var moment=require(_0x8877('0x1'));var BPromise=require(_0x8877('0x2'));var rs=require(_0x8877('0x3'));var fs=require('fs');var Redis=require(_0x8877('0x4'));var db=require(_0x8877('0x5'))['db'];var utils=require(_0x8877('0x6'));var logger=require(_0x8877('0x7'))(_0x8877('0x8'));var config=require('../../config/environment');var jayson=require(_0x8877('0x9'));var client=jayson[_0x8877('0xa')][_0x8877('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26da80,_0x20b31e,_0x4f654d){return new BPromise(function(_0x1baa98,_0xf75de){return client[_0x8877('0xc')](_0x26da80,_0x4f654d)[_0x8877('0xd')](function(_0xd9b295){logger[_0x8877('0xe')](_0x8877('0xf'),_0x20b31e,'request\x20sent');logger[_0x8877('0x10')](_0x8877('0x11'),_0x20b31e,_0x8877('0x12'),JSON[_0x8877('0x13')](_0xd9b295));if(_0xd9b295[_0x8877('0x14')]){if(_0xd9b295[_0x8877('0x14')][_0x8877('0x15')]===0x1f4){logger['error'](_0x8877('0xf'),_0x20b31e,_0xd9b295[_0x8877('0x14')][_0x8877('0x16')]);return _0xf75de(_0xd9b295[_0x8877('0x14')]['message']);}logger[_0x8877('0x14')](_0x8877('0xf'),_0x20b31e,_0xd9b295['error']['message']);return _0x1baa98(_0xd9b295[_0x8877('0x14')][_0x8877('0x16')]);}else{logger[_0x8877('0xe')](_0x8877('0xf'),_0x20b31e,_0x8877('0x12'));_0x1baa98(_0xd9b295['result'][_0x8877('0x16')]);}})[_0x8877('0x17')](function(_0x12acfb){logger['error'](_0x8877('0xf'),_0x20b31e,_0x12acfb);_0xf75de(_0x12acfb);});});}exports[_0x8877('0x18')]=function(_0x5587c3){var _0x2f8de5=this;return new Promise(function(_0x262a6c,_0x29f04c){return db[_0x8877('0x19')]['create'](_0x5587c3[_0x8877('0x1a')],{'raw':_0x5587c3[_0x8877('0x1b')]?_0x5587c3[_0x8877('0x1b')][_0x8877('0x1c')]===undefined?!![]:![]:!![]})[_0x8877('0xd')](function(_0x52f714){logger[_0x8877('0xe')](_0x8877('0x18'),_0x5587c3);logger[_0x8877('0x10')](_0x8877('0x18'),_0x5587c3,JSON[_0x8877('0x13')](_0x52f714));_0x262a6c(_0x52f714);})[_0x8877('0x17')](function(_0x452c85){logger['error'](_0x8877('0x18'),_0x452c85[_0x8877('0x16')],_0x5587c3);_0x29f04c(_0x2f8de5['error'](0x1f4,_0x452c85[_0x8877('0x16')]));});});};exports['UpdateFaxQueueReport']=function(_0xb6177d){var _0x596882=this;return new Promise(function(_0x71bd4c,_0x70639d){return db['FaxQueueReport'][_0x8877('0x1d')](_0xb6177d[_0x8877('0x1a')],{'raw':_0xb6177d[_0x8877('0x1b')]?_0xb6177d['options'][_0x8877('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xb6177d[_0x8877('0x1b')]?_0xb6177d[_0x8877('0x1b')][_0x8877('0x1e')]||null:null,'attributes':_0xb6177d[_0x8877('0x1b')]?_0xb6177d[_0x8877('0x1b')][_0x8877('0x1f')]||null:null,'limit':_0xb6177d[_0x8877('0x1b')]?_0xb6177d[_0x8877('0x1b')][_0x8877('0x20')]||null:null})[_0x8877('0xd')](function(_0x140b28){logger[_0x8877('0xe')]('UpdateFaxQueueReport',_0xb6177d);logger['debug'](_0x8877('0x21'),_0xb6177d,JSON[_0x8877('0x13')](_0x140b28));_0x71bd4c(_0x140b28);})[_0x8877('0x17')](function(_0x2c7af0){logger[_0x8877('0x14')](_0x8877('0x21'),_0x2c7af0['message'],_0xb6177d);_0x70639d(_0x596882[_0x8877('0x14')](0x1f4,_0x2c7af0[_0x8877('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bfaf8fe..db72e69 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 _0xd3c1=['isAuthenticated','/:id','show','post','create','destroy','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xd3c1,0x66));var _0x1d3c=function(_0x21d3ed,_0x2b7490){_0x21d3ed=_0x21d3ed-0x0;var _0x4048b6=_0xd3c1[_0x21d3ed];return _0x4048b6;};'use strict';var multer=require(_0x1d3c('0x0'));var util=require(_0x1d3c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1d3c('0x2'));var router=express[_0x1d3c('0x3')]();var fs_extra=require(_0x1d3c('0x4'));var auth=require(_0x1d3c('0x5'));var interaction=require(_0x1d3c('0x6'));var config=require(_0x1d3c('0x7'));var controller=require(_0x1d3c('0x8'));router[_0x1d3c('0x9')]('/',auth[_0x1d3c('0xa')](),controller['index']);router[_0x1d3c('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x1d3c('0xb'),auth[_0x1d3c('0xa')](),controller[_0x1d3c('0xc')]);router[_0x1d3c('0xd')]('/',auth[_0x1d3c('0xa')](),controller[_0x1d3c('0xe')]);router['put'](_0x1d3c('0xb'),auth[_0x1d3c('0xa')](),controller['update']);router['delete'](_0x1d3c('0xb'),auth['isAuthenticated'](),controller[_0x1d3c('0xf')]);module['exports']=router; \ No newline at end of file +var _0x1250=['get','isAuthenticated','index','describe','post','create','put','update','delete','/:id','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller'];(function(_0x203d0b,_0x1bfca7){var _0x21e3ed=function(_0x2e4cff){while(--_0x2e4cff){_0x203d0b['push'](_0x203d0b['shift']());}};_0x21e3ed(++_0x1bfca7);}(_0x1250,0xfc));var _0x0125=function(_0x2e655a,_0x6d5799){_0x2e655a=_0x2e655a-0x0;var _0x26f13b=_0x1250[_0x2e655a];return _0x26f13b;};'use strict';var multer=require(_0x0125('0x0'));var util=require('util');var path=require(_0x0125('0x1'));var timeout=require('connect-timeout');var express=require(_0x0125('0x2'));var router=express['Router']();var fs_extra=require(_0x0125('0x3'));var auth=require(_0x0125('0x4'));var interaction=require(_0x0125('0x5'));var config=require(_0x0125('0x6'));var controller=require(_0x0125('0x7'));router[_0x0125('0x8')]('/',auth[_0x0125('0x9')](),controller[_0x0125('0xa')]);router[_0x0125('0x8')]('/describe',auth[_0x0125('0x9')](),controller[_0x0125('0xb')]);router['get']('/:id',auth[_0x0125('0x9')](),controller['show']);router[_0x0125('0xc')]('/',auth['isAuthenticated'](),controller[_0x0125('0xd')]);router[_0x0125('0xe')]('/:id',auth[_0x0125('0x9')](),controller[_0x0125('0xf')]);router[_0x0125('0x10')](_0x0125('0x11'),auth[_0x0125('0x9')](),controller[_0x0125('0x12')]);module[_0x0125('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 db0d9a1..b096dd2 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4051b0,_0x199e8f){var _0x97e8d4=function(_0x246d81){while(--_0x246d81){_0x4051b0['push'](_0x4051b0['shift']());}};_0x97e8d4(++_0x199e8f);}(_0x00bb,0x1d8));var _0xb00b=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x00bb[_0x2b10c6];return _0x3789d2;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x2e0401,_0x4fbed1){var _0x2cd578=function(_0x27d467){while(--_0x27d467){_0x2e0401['push'](_0x2e0401['shift']());}};_0x2cd578(++_0x4fbed1);}(_0xaa88,0x137));var _0x8aa8=function(_0x2637ac,_0x377857){_0x2637ac=_0x2637ac-0x0;var _0x4a5758=_0xaa88[_0x2637ac];return _0x4a5758;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 7578d6d..ac04455 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 _0xee3a=['rimraf','zip-dir','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','end','sendStatus','error','stack','name','index','map','FaxTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','update','params','describe','eml-format'];(function(_0x2bf67f,_0x18212c){var _0x3e1104=function(_0x2dca05){while(--_0x2dca05){_0x2bf67f['push'](_0x2bf67f['shift']());}};_0x3e1104(++_0x18212c);}(_0xee3a,0x1c7));var _0xaee3=function(_0x165040,_0x2ded95){_0x165040=_0x165040-0x0;var _0x3d1656=_0xee3a[_0x165040];return _0x3d1656;};'use strict';var emlformat=require(_0xaee3('0x0'));var rimraf=require(_0xaee3('0x1'));var zipdir=require(_0xaee3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaee3('0x3'));var moment=require(_0xaee3('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xaee3('0x5'));var util=require(_0xaee3('0x6'));var path=require(_0xaee3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xaee3('0x8'));var fs=require('fs');var fs_extra=require(_0xaee3('0x9'));var _=require(_0xaee3('0xa'));var squel=require('squel');var crypto=require(_0xaee3('0xb'));var jsforce=require(_0xaee3('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xaee3('0xd'));var querystring=require('querystring');var Papa=require(_0xaee3('0xe'));var Redis=require(_0xaee3('0xf'));var authService=require(_0xaee3('0x10'));var qs=require(_0xaee3('0x11'));var as=require(_0xaee3('0x12'));var hardwareService=require(_0xaee3('0x13'));var logger=require(_0xaee3('0x14'))('api');var utils=require(_0xaee3('0x15'));var config=require(_0xaee3('0x16'));var licenseUtil=require(_0xaee3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4fe3,_0x19e9e4){_0x19e9e4=_0x19e9e4||0xcc;return function(_0x430404){if(_0x430404){return _0x1b4fe3['sendStatus'](_0x19e9e4);}return _0x1b4fe3[_0xaee3('0x18')](_0x19e9e4)['end']();};}function respondWithResult(_0x3536b2,_0x263b27){_0x263b27=_0x263b27||0xc8;return function(_0x2facf5){if(_0x2facf5){return _0x3536b2[_0xaee3('0x18')](_0x263b27)[_0xaee3('0x19')](_0x2facf5);}};}function respondWithFilteredResult(_0x17e2cd,_0x253da8){return function(_0x5116c0){if(_0x5116c0){var _0x3b26c1=typeof _0x253da8[_0xaee3('0x1a')]==='undefined'&&typeof _0x253da8[_0xaee3('0x1b')]===_0xaee3('0x1c');var _0x496592=_0x5116c0[_0xaee3('0x1d')];var _0x13d082=_0x3b26c1?0x0:_0x253da8[_0xaee3('0x1a')];var _0x4fe397=_0x3b26c1?_0x5116c0[_0xaee3('0x1d')]:_0x253da8[_0xaee3('0x1a')]+_0x253da8[_0xaee3('0x1b')];var _0x326dad;if(_0x4fe397>=_0x496592){_0x4fe397=_0x496592;_0x326dad=0xc8;}else{_0x326dad=0xce;}_0x17e2cd['status'](_0x326dad);return _0x17e2cd[_0xaee3('0x1e')](_0xaee3('0x1f'),_0x13d082+'-'+_0x4fe397+'/'+_0x496592)[_0xaee3('0x19')](_0x5116c0);}return null;};}function patchUpdates(_0x210080){return function(_0x29f242){try{jsonpatch[_0xaee3('0x20')](_0x29f242,_0x210080,!![]);}catch(_0x2c1d4c){return BPromise[_0xaee3('0x21')](_0x2c1d4c);}return _0x29f242['save']();};}function saveUpdates(_0x595a1c,_0x216d89){return function(_0x559865){if(_0x559865){return _0x559865['update'](_0x595a1c)[_0xaee3('0x22')](function(_0x16a93d){return _0x16a93d;});}return null;};}function removeEntity(_0xe41a2b,_0x2a51c9){return function(_0x569681){if(_0x569681){return _0x569681['destroy']()[_0xaee3('0x22')](function(){_0xe41a2b['status'](0xcc)[_0xaee3('0x23')]();});}};}function handleEntityNotFound(_0x19abd2,_0x199b4e){return function(_0x48fcb8){if(!_0x48fcb8){_0x19abd2[_0xaee3('0x24')](0x194);}return _0x48fcb8;};}function handleError(_0x9db8e6,_0x21deaa){_0x21deaa=_0x21deaa||0x1f4;return function(_0x12f17a){logger[_0xaee3('0x25')](_0x12f17a[_0xaee3('0x26')]);if(_0x12f17a['name']){delete _0x12f17a[_0xaee3('0x27')];}_0x9db8e6['status'](_0x21deaa)['send'](_0x12f17a);};}exports[_0xaee3('0x28')]=function(_0x14e64f,_0x2292c1){var _0x5e3b55={},_0x33d7f0={},_0x307209={'count':0x0,'rows':[]};var _0x2669e8=_[_0xaee3('0x29')](db[_0xaee3('0x2a')][_0xaee3('0x2b')],function(_0x24aac7){return{'name':_0x24aac7[_0xaee3('0x2c')],'type':_0x24aac7['type'][_0xaee3('0x2d')]};});_0x33d7f0[_0xaee3('0x2e')]=_[_0xaee3('0x29')](_0x2669e8,_0xaee3('0x27'));_0x33d7f0[_0xaee3('0x2f')]=_[_0xaee3('0x30')](_0x14e64f['query']);_0x33d7f0['filters']=_[_0xaee3('0x31')](_0x33d7f0[_0xaee3('0x2e')],_0x33d7f0[_0xaee3('0x2f')]);_0x5e3b55[_0xaee3('0x32')]=_['intersection'](_0x33d7f0[_0xaee3('0x2e')],qs[_0xaee3('0x33')](_0x14e64f[_0xaee3('0x2f')][_0xaee3('0x33')]));_0x5e3b55[_0xaee3('0x32')]=_0x5e3b55[_0xaee3('0x32')][_0xaee3('0x34')]?_0x5e3b55[_0xaee3('0x32')]:_0x33d7f0['model'];if(!_0x14e64f[_0xaee3('0x2f')][_0xaee3('0x35')](_0xaee3('0x36'))){_0x5e3b55[_0xaee3('0x1b')]=qs['limit'](_0x14e64f['query'][_0xaee3('0x1b')]);_0x5e3b55[_0xaee3('0x1a')]=qs['offset'](_0x14e64f['query']['offset']);}_0x5e3b55[_0xaee3('0x37')]=qs[_0xaee3('0x38')](_0x14e64f['query'][_0xaee3('0x38')]);_0x5e3b55[_0xaee3('0x39')]=qs[_0xaee3('0x3a')](_[_0xaee3('0x3b')](_0x14e64f['query'],_0x33d7f0[_0xaee3('0x3a')]),_0x2669e8);if(_0x14e64f[_0xaee3('0x2f')][_0xaee3('0x3c')]){_0x5e3b55[_0xaee3('0x39')]=_[_0xaee3('0x3d')](_0x5e3b55[_0xaee3('0x39')],{'$or':_[_0xaee3('0x29')](_0x2669e8,function(_0x415b8a){if(_0x415b8a[_0xaee3('0x3e')]!==_0xaee3('0x3f')){var _0x5068f1={};_0x5068f1[_0x415b8a['name']]={'$like':'%'+_0x14e64f[_0xaee3('0x2f')]['filter']+'%'};return _0x5068f1;}})});}_0x5e3b55=_['merge']({},_0x5e3b55,_0x14e64f[_0xaee3('0x40')]);var _0x5ced21={'where':_0x5e3b55[_0xaee3('0x39')]};return db[_0xaee3('0x2a')][_0xaee3('0x1d')](_0x5ced21)[_0xaee3('0x22')](function(_0xbd7cda){_0x307209[_0xaee3('0x1d')]=_0xbd7cda;if(_0x14e64f[_0xaee3('0x2f')][_0xaee3('0x41')]){_0x5e3b55[_0xaee3('0x42')]=[{'all':!![]}];}return db[_0xaee3('0x2a')]['findAll'](_0x5e3b55);})[_0xaee3('0x22')](function(_0x5758c8){_0x307209[_0xaee3('0x43')]=_0x5758c8;return _0x307209;})[_0xaee3('0x22')](respondWithFilteredResult(_0x2292c1,_0x5e3b55))[_0xaee3('0x44')](handleError(_0x2292c1,null));};exports[_0xaee3('0x45')]=function(_0x270dd4,_0x5ddbab){var _0x1d38ea={'raw':!![],'where':{'id':_0x270dd4['params']['id']}},_0x1c7048={};_0x1c7048[_0xaee3('0x2e')]=_[_0xaee3('0x30')](db[_0xaee3('0x2a')][_0xaee3('0x2b')]);_0x1c7048[_0xaee3('0x2f')]=_['keys'](_0x270dd4[_0xaee3('0x2f')]);_0x1c7048[_0xaee3('0x3a')]=_[_0xaee3('0x31')](_0x1c7048['model'],_0x1c7048[_0xaee3('0x2f')]);_0x1d38ea[_0xaee3('0x32')]=_[_0xaee3('0x31')](_0x1c7048['model'],qs[_0xaee3('0x33')](_0x270dd4[_0xaee3('0x2f')][_0xaee3('0x33')]));_0x1d38ea[_0xaee3('0x32')]=_0x1d38ea[_0xaee3('0x32')][_0xaee3('0x34')]?_0x1d38ea[_0xaee3('0x32')]:_0x1c7048[_0xaee3('0x2e')];if(_0x270dd4['query']['includeAll']){_0x1d38ea[_0xaee3('0x42')]=[{'all':!![]}];}_0x1d38ea=_[_0xaee3('0x3d')]({},_0x1d38ea,_0x270dd4[_0xaee3('0x40')]);return db[_0xaee3('0x2a')][_0xaee3('0x46')](_0x1d38ea)[_0xaee3('0x22')](handleEntityNotFound(_0x5ddbab,null))[_0xaee3('0x22')](respondWithResult(_0x5ddbab,null))['catch'](handleError(_0x5ddbab,null));};exports['create']=function(_0x21e4b5,_0xe4ef4b){return db['FaxTransferReport'][_0xaee3('0x47')](_0x21e4b5[_0xaee3('0x48')],{})[_0xaee3('0x22')](respondWithResult(_0xe4ef4b,0xc9))[_0xaee3('0x44')](handleError(_0xe4ef4b,null));};exports[_0xaee3('0x49')]=function(_0x87bd74,_0x577682){if(_0x87bd74[_0xaee3('0x48')]['id']){delete _0x87bd74[_0xaee3('0x48')]['id'];}return db[_0xaee3('0x2a')][_0xaee3('0x46')]({'where':{'id':_0x87bd74[_0xaee3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x577682,null))[_0xaee3('0x22')](saveUpdates(_0x87bd74[_0xaee3('0x48')],null))[_0xaee3('0x22')](respondWithResult(_0x577682,null))['catch'](handleError(_0x577682,null));};exports['destroy']=function(_0x570843,_0x405fbb){return db[_0xaee3('0x2a')]['find']({'where':{'id':_0x570843[_0xaee3('0x4a')]['id']}})[_0xaee3('0x22')](handleEntityNotFound(_0x405fbb,null))['then'](removeEntity(_0x405fbb,null))[_0xaee3('0x44')](handleError(_0x405fbb,null));};exports[_0xaee3('0x4b')]=function(_0x53ede3,_0x5642e3){return db['FaxTransferReport'][_0xaee3('0x4b')]()[_0xaee3('0x22')](respondWithResult(_0x5642e3,null))[_0xaee3('0x44')](handleError(_0x5642e3,null));}; \ No newline at end of file +var _0xbfff=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','json','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','model','attributes','query','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','rows','show','params','keys','intersection','length','include','options','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x422bb1,_0x41eb73){var _0xfe5f30=function(_0x1314ca){while(--_0x1314ca){_0x422bb1['push'](_0x422bb1['shift']());}};_0xfe5f30(++_0x41eb73);}(_0xbfff,0x130));var _0xfbff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbfff[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfbff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfbff('0x1'));var jsonpatch=require(_0xfbff('0x2'));var rp=require(_0xfbff('0x3'));var moment=require('moment');var BPromise=require(_0xfbff('0x4'));var Mustache=require(_0xfbff('0x5'));var util=require(_0xfbff('0x6'));var path=require(_0xfbff('0x7'));var sox=require(_0xfbff('0x8'));var csv=require(_0xfbff('0x9'));var ejs=require(_0xfbff('0xa'));var fs=require('fs');var fs_extra=require(_0xfbff('0xb'));var _=require(_0xfbff('0xc'));var squel=require(_0xfbff('0xd'));var crypto=require(_0xfbff('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xfbff('0xf'));var toCsv=require(_0xfbff('0x9'));var querystring=require(_0xfbff('0x10'));var Papa=require(_0xfbff('0x11'));var Redis=require(_0xfbff('0x12'));var authService=require(_0xfbff('0x13'));var qs=require(_0xfbff('0x14'));var as=require(_0xfbff('0x15'));var hardwareService=require(_0xfbff('0x16'));var logger=require(_0xfbff('0x17'))(_0xfbff('0x18'));var utils=require(_0xfbff('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xfbff('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e3579,_0x511d39){_0x511d39=_0x511d39||0xcc;return function(_0x230130){if(_0x230130){return _0x2e3579['sendStatus'](_0x511d39);}return _0x2e3579[_0xfbff('0x1b')](_0x511d39)['end']();};}function respondWithResult(_0xcd01f,_0x3e5de7){_0x3e5de7=_0x3e5de7||0xc8;return function(_0x4c5cc6){if(_0x4c5cc6){return _0xcd01f[_0xfbff('0x1b')](_0x3e5de7)[_0xfbff('0x1c')](_0x4c5cc6);}};}function respondWithFilteredResult(_0x365a8f,_0x9d929a){return function(_0x7e7491){if(_0x7e7491){var _0x13aae2=typeof _0x9d929a[_0xfbff('0x1d')]==='undefined'&&typeof _0x9d929a[_0xfbff('0x1e')]==='undefined';var _0x1150c2=_0x7e7491[_0xfbff('0x1f')];var _0x166db2=_0x13aae2?0x0:_0x9d929a['offset'];var _0xafedc3=_0x13aae2?_0x7e7491[_0xfbff('0x1f')]:_0x9d929a[_0xfbff('0x1d')]+_0x9d929a[_0xfbff('0x1e')];var _0x570a4e;if(_0xafedc3>=_0x1150c2){_0xafedc3=_0x1150c2;_0x570a4e=0xc8;}else{_0x570a4e=0xce;}_0x365a8f[_0xfbff('0x1b')](_0x570a4e);return _0x365a8f[_0xfbff('0x20')](_0xfbff('0x21'),_0x166db2+'-'+_0xafedc3+'/'+_0x1150c2)[_0xfbff('0x1c')](_0x7e7491);}return null;};}function patchUpdates(_0x2368a0){return function(_0x2b7fcc){try{jsonpatch['apply'](_0x2b7fcc,_0x2368a0,!![]);}catch(_0x451d08){return BPromise[_0xfbff('0x22')](_0x451d08);}return _0x2b7fcc[_0xfbff('0x23')]();};}function saveUpdates(_0x2b63c7,_0x552594){return function(_0xfc1023){if(_0xfc1023){return _0xfc1023[_0xfbff('0x24')](_0x2b63c7)[_0xfbff('0x25')](function(_0x1d6447){return _0x1d6447;});}return null;};}function removeEntity(_0x5ac978,_0x33ab74){return function(_0x5b0e3a){if(_0x5b0e3a){return _0x5b0e3a[_0xfbff('0x26')]()[_0xfbff('0x25')](function(){_0x5ac978[_0xfbff('0x1b')](0xcc)[_0xfbff('0x27')]();});}};}function handleEntityNotFound(_0x306266,_0x5db933){return function(_0x5684e1){if(!_0x5684e1){_0x306266[_0xfbff('0x28')](0x194);}return _0x5684e1;};}function handleError(_0xa6ac1b,_0x64f1bd){_0x64f1bd=_0x64f1bd||0x1f4;return function(_0xa890e6){logger[_0xfbff('0x29')](_0xa890e6[_0xfbff('0x2a')]);if(_0xa890e6[_0xfbff('0x2b')]){delete _0xa890e6[_0xfbff('0x2b')];}_0xa6ac1b[_0xfbff('0x1b')](_0x64f1bd)[_0xfbff('0x2c')](_0xa890e6);};}exports[_0xfbff('0x2d')]=function(_0x3d44fb,_0x10a865){var _0x4095b3={},_0x1e589f={},_0x14b995={'count':0x0,'rows':[]};var _0x5f1203=_[_0xfbff('0x2e')](db[_0xfbff('0x2f')][_0xfbff('0x30')],function(_0x53ebf9){return{'name':_0x53ebf9[_0xfbff('0x31')],'type':_0x53ebf9[_0xfbff('0x32')]['key']};});_0x1e589f[_0xfbff('0x33')]=_['map'](_0x5f1203,_0xfbff('0x2b'));_0x1e589f['query']=_['keys'](_0x3d44fb['query']);_0x1e589f['filters']=_['intersection'](_0x1e589f[_0xfbff('0x33')],_0x1e589f['query']);_0x4095b3[_0xfbff('0x34')]=_['intersection'](_0x1e589f[_0xfbff('0x33')],qs['fields'](_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x36')]));_0x4095b3[_0xfbff('0x34')]=_0x4095b3[_0xfbff('0x34')]['length']?_0x4095b3['attributes']:_0x1e589f[_0xfbff('0x33')];if(!_0x3d44fb['query'][_0xfbff('0x37')](_0xfbff('0x38'))){_0x4095b3[_0xfbff('0x1e')]=qs['limit'](_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x1e')]);_0x4095b3[_0xfbff('0x1d')]=qs[_0xfbff('0x1d')](_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x1d')]);}_0x4095b3[_0xfbff('0x39')]=qs[_0xfbff('0x3a')](_0x3d44fb[_0xfbff('0x35')]['sort']);_0x4095b3[_0xfbff('0x3b')]=qs[_0xfbff('0x3c')](_['pick'](_0x3d44fb[_0xfbff('0x35')],_0x1e589f[_0xfbff('0x3c')]),_0x5f1203);if(_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x3d')]){_0x4095b3[_0xfbff('0x3b')]=_[_0xfbff('0x3e')](_0x4095b3[_0xfbff('0x3b')],{'$or':_[_0xfbff('0x2e')](_0x5f1203,function(_0x5c9681){if(_0x5c9681[_0xfbff('0x32')]!==_0xfbff('0x3f')){var _0x883aee={};_0x883aee[_0x5c9681[_0xfbff('0x2b')]]={'$like':'%'+_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x3d')]+'%'};return _0x883aee;}})});}_0x4095b3=_[_0xfbff('0x3e')]({},_0x4095b3,_0x3d44fb['options']);var _0x26cb9b={'where':_0x4095b3['where']};return db[_0xfbff('0x2f')][_0xfbff('0x1f')](_0x26cb9b)[_0xfbff('0x25')](function(_0x58bae6){_0x14b995['count']=_0x58bae6;if(_0x3d44fb[_0xfbff('0x35')][_0xfbff('0x40')]){_0x4095b3['include']=[{'all':!![]}];}return db[_0xfbff('0x2f')]['findAll'](_0x4095b3);})[_0xfbff('0x25')](function(_0x38e901){_0x14b995[_0xfbff('0x41')]=_0x38e901;return _0x14b995;})[_0xfbff('0x25')](respondWithFilteredResult(_0x10a865,_0x4095b3))['catch'](handleError(_0x10a865,null));};exports[_0xfbff('0x42')]=function(_0x4ad03e,_0x17d118){var _0x1a50f2={'raw':!![],'where':{'id':_0x4ad03e[_0xfbff('0x43')]['id']}},_0x4baff5={};_0x4baff5[_0xfbff('0x33')]=_[_0xfbff('0x44')](db[_0xfbff('0x2f')][_0xfbff('0x30')]);_0x4baff5['query']=_[_0xfbff('0x44')](_0x4ad03e['query']);_0x4baff5[_0xfbff('0x3c')]=_[_0xfbff('0x45')](_0x4baff5[_0xfbff('0x33')],_0x4baff5[_0xfbff('0x35')]);_0x1a50f2['attributes']=_[_0xfbff('0x45')](_0x4baff5['model'],qs[_0xfbff('0x36')](_0x4ad03e['query'][_0xfbff('0x36')]));_0x1a50f2[_0xfbff('0x34')]=_0x1a50f2['attributes'][_0xfbff('0x46')]?_0x1a50f2['attributes']:_0x4baff5[_0xfbff('0x33')];if(_0x4ad03e[_0xfbff('0x35')][_0xfbff('0x40')]){_0x1a50f2[_0xfbff('0x47')]=[{'all':!![]}];}_0x1a50f2=_[_0xfbff('0x3e')]({},_0x1a50f2,_0x4ad03e[_0xfbff('0x48')]);return db[_0xfbff('0x2f')][_0xfbff('0x49')](_0x1a50f2)[_0xfbff('0x25')](handleEntityNotFound(_0x17d118,null))[_0xfbff('0x25')](respondWithResult(_0x17d118,null))[_0xfbff('0x4a')](handleError(_0x17d118,null));};exports['create']=function(_0x5558ef,_0x19194b){return db[_0xfbff('0x2f')]['create'](_0x5558ef[_0xfbff('0x4b')],{})[_0xfbff('0x25')](respondWithResult(_0x19194b,0xc9))[_0xfbff('0x4a')](handleError(_0x19194b,null));};exports[_0xfbff('0x24')]=function(_0x254e64,_0x2fd061){if(_0x254e64['body']['id']){delete _0x254e64[_0xfbff('0x4b')]['id'];}return db[_0xfbff('0x2f')][_0xfbff('0x49')]({'where':{'id':_0x254e64[_0xfbff('0x43')]['id']}})[_0xfbff('0x25')](handleEntityNotFound(_0x2fd061,null))['then'](saveUpdates(_0x254e64[_0xfbff('0x4b')],null))[_0xfbff('0x25')](respondWithResult(_0x2fd061,null))['catch'](handleError(_0x2fd061,null));};exports[_0xfbff('0x26')]=function(_0x5c6930,_0x45abef){return db['FaxTransferReport'][_0xfbff('0x49')]({'where':{'id':_0x5c6930[_0xfbff('0x43')]['id']}})[_0xfbff('0x25')](handleEntityNotFound(_0x45abef,null))[_0xfbff('0x25')](removeEntity(_0x45abef,null))[_0xfbff('0x4a')](handleError(_0x45abef,null));};exports['describe']=function(_0x3bfbf7,_0x1e4729){return db[_0xfbff('0x2f')][_0xfbff('0x4c')]()['then'](respondWithResult(_0x1e4729,null))[_0xfbff('0x4a')](handleError(_0x1e4729,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 794c386..ab60c02 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 _0x59c5=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util'];(function(_0x3e5147,_0x33eef9){var _0x18c779=function(_0x2a143c){while(--_0x2a143c){_0x3e5147['push'](_0x3e5147['shift']());}};_0x18c779(++_0x33eef9);}(_0x59c5,0x132));var _0x559c=function(_0x32b550,_0xd7ad0b){_0x32b550=_0x32b550-0x0;var _0x227f70=_0x59c5[_0x32b550];return _0x227f70;};'use strict';var _=require(_0x559c('0x0'));var util=require(_0x559c('0x1'));var logger=require(_0x559c('0x2'))('api');var moment=require(_0x559c('0x3'));var BPromise=require(_0x559c('0x4'));var rp=require(_0x559c('0x5'));var fs=require('fs');var path=require(_0x559c('0x6'));var rimraf=require(_0x559c('0x7'));var config=require('../../config/environment');var attributes=require(_0x559c('0x8'));module[_0x559c('0x9')]=function(_0x30afc4,_0x3a6013){return _0x30afc4[_0x559c('0xa')](_0x559c('0xb'),attributes,{'tableName':_0x559c('0xc'),'paranoid':![],'indexes':[{'name':_0x559c('0xd'),'fields':[_0x559c('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd6cb=['exports','FaxTransferReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x405485,_0x4b6172){var _0x39ee24=function(_0x51f4e3){while(--_0x51f4e3){_0x405485['push'](_0x405485['shift']());}};_0x39ee24(++_0x4b6172);}(_0xd6cb,0x9d));var _0xbd6c=function(_0x161e04,_0x15ea3d){_0x161e04=_0x161e04-0x0;var _0x26ab63=_0xd6cb[_0x161e04];return _0x26ab63;};'use strict';var _=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var logger=require(_0xbd6c('0x2'))(_0xbd6c('0x3'));var moment=require(_0xbd6c('0x4'));var BPromise=require(_0xbd6c('0x5'));var rp=require(_0xbd6c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd6c('0x7'));var config=require('../../config/environment');var attributes=require('./faxTransferReport.attributes');module[_0xbd6c('0x8')]=function(_0x309ac5,_0x9bdefb){return _0x309ac5['define'](_0xbd6c('0x9'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xbd6c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 7b0d809..2672ab1 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 _0x41f5=['FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x37bdae,_0x1a4a35){var _0x3f0c1e=function(_0x341d43){while(--_0x341d43){_0x37bdae['push'](_0x37bdae['shift']());}};_0x3f0c1e(++_0x1a4a35);}(_0x41f5,0x104));var _0x541f=function(_0x30bb30,_0x564af1){_0x30bb30=_0x30bb30-0x0;var _0xce44e7=_0x41f5[_0x30bb30];return _0xce44e7;};'use strict';var _=require('lodash');var util=require(_0x541f('0x0'));var moment=require(_0x541f('0x1'));var BPromise=require('bluebird');var rs=require(_0x541f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x541f('0x3'))['db'];var utils=require(_0x541f('0x4'));var logger=require(_0x541f('0x5'))(_0x541f('0x6'));var config=require(_0x541f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x541f('0x8')][_0x541f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x546b76,_0x32a714,_0x50266b){return new BPromise(function(_0x2eaed9,_0x4d1da5){return client[_0x541f('0xa')](_0x546b76,_0x50266b)[_0x541f('0xb')](function(_0x17ccb4){logger[_0x541f('0xc')](_0x541f('0xd'),_0x32a714,_0x541f('0xe'));logger[_0x541f('0xf')](_0x541f('0x10'),_0x32a714,_0x541f('0xe'),JSON['stringify'](_0x17ccb4));if(_0x17ccb4[_0x541f('0x11')]){if(_0x17ccb4[_0x541f('0x11')]['code']===0x1f4){logger[_0x541f('0x11')](_0x541f('0xd'),_0x32a714,_0x17ccb4['error']['message']);return _0x4d1da5(_0x17ccb4[_0x541f('0x11')][_0x541f('0x12')]);}logger['error'](_0x541f('0xd'),_0x32a714,_0x17ccb4[_0x541f('0x11')][_0x541f('0x12')]);return _0x2eaed9(_0x17ccb4[_0x541f('0x11')][_0x541f('0x12')]);}else{logger[_0x541f('0xc')](_0x541f('0xd'),_0x32a714,_0x541f('0xe'));_0x2eaed9(_0x17ccb4[_0x541f('0x13')][_0x541f('0x12')]);}})[_0x541f('0x14')](function(_0x1f9216){logger[_0x541f('0x11')](_0x541f('0xd'),_0x32a714,_0x1f9216);_0x4d1da5(_0x1f9216);});});} \ No newline at end of file +var _0xc0ca=['FaxTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x388640,_0x30213f){var _0x1c53b4=function(_0x3ded99){while(--_0x3ded99){_0x388640['push'](_0x388640['shift']());}};_0x1c53b4(++_0x30213f);}(_0xc0ca,0x69));var _0xac0c=function(_0x1cf600,_0x5445d0){_0x1cf600=_0x1cf600-0x0;var _0x2a474c=_0xc0ca[_0x1cf600];return _0x2a474c;};'use strict';var _=require(_0xac0c('0x0'));var util=require(_0xac0c('0x1'));var moment=require('moment');var BPromise=require(_0xac0c('0x2'));var rs=require(_0xac0c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac0c('0x4'))['db'];var utils=require(_0xac0c('0x5'));var logger=require(_0xac0c('0x6'))(_0xac0c('0x7'));var config=require(_0xac0c('0x8'));var jayson=require(_0xac0c('0x9'));var client=jayson[_0xac0c('0xa')][_0xac0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3769b4,_0x3278c0,_0x4869fd){return new BPromise(function(_0x58cc80,_0x23661f){return client[_0xac0c('0xc')](_0x3769b4,_0x4869fd)[_0xac0c('0xd')](function(_0x1058c1){logger[_0xac0c('0xe')](_0xac0c('0xf'),_0x3278c0,'request\x20sent');logger[_0xac0c('0x10')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x3278c0,_0xac0c('0x11'),JSON[_0xac0c('0x12')](_0x1058c1));if(_0x1058c1[_0xac0c('0x13')]){if(_0x1058c1[_0xac0c('0x13')][_0xac0c('0x14')]===0x1f4){logger[_0xac0c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x3278c0,_0x1058c1[_0xac0c('0x13')][_0xac0c('0x15')]);return _0x23661f(_0x1058c1[_0xac0c('0x13')][_0xac0c('0x15')]);}logger[_0xac0c('0x13')](_0xac0c('0xf'),_0x3278c0,_0x1058c1['error'][_0xac0c('0x15')]);return _0x58cc80(_0x1058c1[_0xac0c('0x13')]['message']);}else{logger[_0xac0c('0xe')](_0xac0c('0xf'),_0x3278c0,_0xac0c('0x11'));_0x58cc80(_0x1058c1[_0xac0c('0x16')][_0xac0c('0x15')]);}})[_0xac0c('0x17')](function(_0x4340cb){logger[_0xac0c('0x13')]('FaxTransferReport,\x20%s,\x20%s',_0x3278c0,_0x4340cb);_0x23661f(_0x4340cb);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 07fe1d2..b125b02 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 _0x16b3=['util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','index','describe','/:id','show','create','put','isAuthenticated','update','delete','destroy','multer'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x16b3,0xdb));var _0x316b=function(_0x37bbc1,_0x4cddb1){_0x37bbc1=_0x37bbc1-0x0;var _0x59542a=_0x16b3[_0x37bbc1];return _0x59542a;};'use strict';var multer=require(_0x316b('0x0'));var util=require(_0x316b('0x1'));var path=require(_0x316b('0x2'));var timeout=require(_0x316b('0x3'));var express=require(_0x316b('0x4'));var router=express[_0x316b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x316b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x316b('0x7'));var controller=require(_0x316b('0x8'));router[_0x316b('0x9')]('/',auth['isAuthenticated'](),controller[_0x316b('0xa')]);router[_0x316b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x316b('0xb')]);router[_0x316b('0x9')](_0x316b('0xc'),auth['isAuthenticated'](),controller[_0x316b('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x316b('0xe')]);router[_0x316b('0xf')](_0x316b('0xc'),auth[_0x316b('0x10')](),controller[_0x316b('0x11')]);router[_0x316b('0x12')](_0x316b('0xc'),auth['isAuthenticated'](),controller[_0x316b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xbb26=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','delete','destroy'];(function(_0xe54fc4,_0x10fe78){var _0x1a5293=function(_0x599a71){while(--_0x599a71){_0xe54fc4['push'](_0xe54fc4['shift']());}};_0x1a5293(++_0x10fe78);}(_0xbb26,0x151));var _0x6bb2=function(_0x4b1567,_0x59e65a){_0x4b1567=_0x4b1567-0x0;var _0x5b4daf=_0xbb26[_0x4b1567];return _0x5b4daf;};'use strict';var multer=require('multer');var util=require(_0x6bb2('0x0'));var path=require(_0x6bb2('0x1'));var timeout=require(_0x6bb2('0x2'));var express=require('express');var router=express[_0x6bb2('0x3')]();var fs_extra=require(_0x6bb2('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6bb2('0x5'));var config=require(_0x6bb2('0x6'));var controller=require(_0x6bb2('0x7'));router[_0x6bb2('0x8')]('/',auth['isAuthenticated'](),controller[_0x6bb2('0x9')]);router[_0x6bb2('0x8')](_0x6bb2('0xa'),auth['isAuthenticated'](),controller[_0x6bb2('0xb')]);router[_0x6bb2('0x8')](_0x6bb2('0xc'),auth[_0x6bb2('0xd')](),controller[_0x6bb2('0xe')]);router[_0x6bb2('0xf')]('/',auth[_0x6bb2('0xd')](),controller[_0x6bb2('0x10')]);router[_0x6bb2('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6bb2('0x12')](_0x6bb2('0xc'),auth[_0x6bb2('0xd')](),controller[_0x6bb2('0x13')]);module[_0x6bb2('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 0d36c95..d609187 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 _0xad8c=['getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xad8c,0x110));var _0xcad8=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0xad8c[_0x259d17];return _0x407535;};'use strict';var multer=require('multer');var util=require(_0xcad8('0x0'));var path=require(_0xcad8('0x1'));var timeout=require(_0xcad8('0x2'));var express=require(_0xcad8('0x3'));var router=express['Router']();var fs_extra=require(_0xcad8('0x4'));var auth=require(_0xcad8('0x5'));var interaction=require(_0xcad8('0x6'));var config=require(_0xcad8('0x7'));var controller=require(_0xcad8('0x8'));router[_0xcad8('0x9')]('/',auth[_0xcad8('0xa')](),controller[_0xcad8('0xb')]);router['get'](_0xcad8('0xc'),auth[_0xcad8('0xa')](),controller[_0xcad8('0xd')]);router[_0xcad8('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xcad8('0xe')]);router[_0xcad8('0x9')](_0xcad8('0xf'),auth[_0xcad8('0xa')](),controller[_0xcad8('0x10')]);router[_0xcad8('0x11')]('/',auth[_0xcad8('0xa')](),controller[_0xcad8('0x12')]);router['post'](_0xcad8('0x13'),auth[_0xcad8('0xa')](),controller[_0xcad8('0x14')]);router[_0xcad8('0x15')](_0xcad8('0xc'),auth[_0xcad8('0xa')](),controller[_0xcad8('0x16')]);router[_0xcad8('0x17')](_0xcad8('0xc'),auth[_0xcad8('0xa')](),controller[_0xcad8('0x18')]);module[_0xcad8('0x19')]=router; \ No newline at end of file +var _0xae68=['/:id','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','index','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put'];(function(_0x4ad37c,_0x2e7490){var _0x288919=function(_0x3988a2){while(--_0x3988a2){_0x4ad37c['push'](_0x4ad37c['shift']());}};_0x288919(++_0x2e7490);}(_0xae68,0x7c));var _0x8ae6=function(_0x466503,_0x251570){_0x466503=_0x466503-0x0;var _0x2ee6cf=_0xae68[_0x466503];return _0x2ee6cf;};'use strict';var multer=require(_0x8ae6('0x0'));var util=require(_0x8ae6('0x1'));var path=require('path');var timeout=require(_0x8ae6('0x2'));var express=require(_0x8ae6('0x3'));var router=express[_0x8ae6('0x4')]();var fs_extra=require(_0x8ae6('0x5'));var auth=require(_0x8ae6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8ae6('0x7'));var controller=require(_0x8ae6('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x8ae6('0x9')]);router['get']('/:id',auth[_0x8ae6('0xa')](),controller[_0x8ae6('0xb')]);router[_0x8ae6('0xc')](_0x8ae6('0xd'),auth[_0x8ae6('0xa')](),controller[_0x8ae6('0xe')]);router[_0x8ae6('0xc')](_0x8ae6('0xf'),auth[_0x8ae6('0xa')](),controller['getFields']);router[_0x8ae6('0x10')]('/',auth[_0x8ae6('0xa')](),controller[_0x8ae6('0x11')]);router['post'](_0x8ae6('0xd'),auth['isAuthenticated'](),controller[_0x8ae6('0x12')]);router[_0x8ae6('0x13')](_0x8ae6('0x14'),auth[_0x8ae6('0xa')](),controller['update']);router[_0x8ae6('0x15')](_0x8ae6('0x14'),auth[_0x8ae6('0xa')](),controller[_0x8ae6('0x16')]);module[_0x8ae6('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 209fee8..e4aa26c 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 _0x3860=['STRING','ENUM','basic','integrationTab','exports'];(function(_0x32bc9f,_0x110665){var _0x3cbc9d=function(_0x52ff7c){while(--_0x52ff7c){_0x32bc9f['push'](_0x32bc9f['shift']());}};_0x3cbc9d(++_0x110665);}(_0x3860,0x162));var _0x0386=function(_0x5ad62d,_0x52c5e9){_0x5ad62d=_0x5ad62d-0x0;var _0x44491b=_0x3860[_0x5ad62d];return _0x44491b;};'use strict';var Sequelize=require('sequelize');module[_0x0386('0x0')]={'name':{'type':Sequelize[_0x0386('0x1')]},'description':{'type':Sequelize[_0x0386('0x1')]},'username':{'type':Sequelize[_0x0386('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x0386('0x2')](_0x0386('0x3')),'defaultValue':_0x0386('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x0386('0x1')]},'consumerSecret':{'type':Sequelize[_0x0386('0x1')]},'token':{'type':Sequelize[_0x0386('0x1')]},'tokenSecret':{'type':Sequelize[_0x0386('0x1')]},'serverUrl':{'type':Sequelize[_0x0386('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0386('0x2')](_0x0386('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd8aa=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0xd8aa,0x1c8));var _0xad8a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd8aa[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xad8a('0x0'));module[_0xad8a('0x1')]={'name':{'type':Sequelize[_0xad8a('0x2')]},'description':{'type':Sequelize[_0xad8a('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xad8a('0x2')]},'authType':{'type':Sequelize[_0xad8a('0x3')]('basic'),'defaultValue':_0xad8a('0x4')},'password':{'type':Sequelize[_0xad8a('0x2')]},'consumerKey':{'type':Sequelize[_0xad8a('0x2')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0xad8a('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xad8a('0x3')](_0xad8a('0x5'),_0xad8a('0x6')),'defaultValue':_0xad8a('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index f7e335e..5e57ca9 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 _0x9749=['fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','map','type','VIRTUAL','filter','options','DeskAccount','include','findAll','rows','rawAttributes','includeAll','find','body','params','getConfigurations','findOne','DeskConfiguration','pick','catch','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','format','%s/custom_fields','application/json','headers','Authorization','Basic\x20%s','%s:%s','base64','_embedded','entries','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','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','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','send','index','fieldName','key','model','query','keys','attributes','intersection'];(function(_0xeddf5,_0x428c05){var _0x54f012=function(_0x1170d2){while(--_0x1170d2){_0xeddf5['push'](_0xeddf5['shift']());}};_0x54f012(++_0x428c05);}(_0x9749,0x137));var _0x9974=function(_0x4fee26,_0x1119dc){_0x4fee26=_0x4fee26-0x0;var _0x4f72d5=_0x9749[_0x4fee26];return _0x4f72d5;};'use strict';var emlformat=require(_0x9974('0x0'));var rimraf=require(_0x9974('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9974('0x2'));var rp=require(_0x9974('0x3'));var moment=require(_0x9974('0x4'));var BPromise=require(_0x9974('0x5'));var Mustache=require(_0x9974('0x6'));var util=require(_0x9974('0x7'));var path=require(_0x9974('0x8'));var sox=require(_0x9974('0x9'));var csv=require(_0x9974('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9974('0xb'));var _=require(_0x9974('0xc'));var squel=require(_0x9974('0xd'));var crypto=require(_0x9974('0xe'));var jsforce=require(_0x9974('0xf'));var deskjs=require(_0x9974('0x10'));var toCsv=require(_0x9974('0xa'));var querystring=require(_0x9974('0x11'));var Papa=require(_0x9974('0x12'));var Redis=require(_0x9974('0x13'));var authService=require(_0x9974('0x14'));var qs=require(_0x9974('0x15'));var as=require(_0x9974('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9974('0x17'))(_0x9974('0x18'));var utils=require(_0x9974('0x19'));var config=require(_0x9974('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x9974('0x1b'))['db'];var integrations=require(_0x9974('0x1c'));function respondWithStatusCode(_0x37c96c,_0x382df9){_0x382df9=_0x382df9||0xcc;return function(_0x245d83){if(_0x245d83){return _0x37c96c[_0x9974('0x1d')](_0x382df9);}return _0x37c96c[_0x9974('0x1e')](_0x382df9)[_0x9974('0x1f')]();};}function respondWithResult(_0x49670f,_0x3a1cea){_0x3a1cea=_0x3a1cea||0xc8;return function(_0x3b964f){if(_0x3b964f){return _0x49670f[_0x9974('0x1e')](_0x3a1cea)[_0x9974('0x20')](_0x3b964f);}};}function respondWithFilteredResult(_0x3da125,_0xa3a291){return function(_0x5a9523){if(_0x5a9523){var _0x13d579=typeof _0xa3a291[_0x9974('0x21')]===_0x9974('0x22')&&typeof _0xa3a291['limit']===_0x9974('0x22');var _0x1c0943=_0x5a9523[_0x9974('0x23')];var _0x1e68e1=_0x13d579?0x0:_0xa3a291[_0x9974('0x21')];var _0x165db6=_0x13d579?_0x5a9523[_0x9974('0x23')]:_0xa3a291['offset']+_0xa3a291[_0x9974('0x24')];var _0x1a67e3;if(_0x165db6>=_0x1c0943){_0x165db6=_0x1c0943;_0x1a67e3=0xc8;}else{_0x1a67e3=0xce;}_0x3da125[_0x9974('0x1e')](_0x1a67e3);return _0x3da125[_0x9974('0x25')](_0x9974('0x26'),_0x1e68e1+'-'+_0x165db6+'/'+_0x1c0943)[_0x9974('0x20')](_0x5a9523);}return null;};}function patchUpdates(_0x2ff7a5){return function(_0x27998e){try{jsonpatch[_0x9974('0x27')](_0x27998e,_0x2ff7a5,!![]);}catch(_0x31adb9){return BPromise[_0x9974('0x28')](_0x31adb9);}return _0x27998e['save']();};}function saveUpdates(_0x119cae,_0x598303){return function(_0x2182c5){if(_0x2182c5){return _0x2182c5[_0x9974('0x29')](_0x119cae)['then'](function(_0x734b9b){return _0x734b9b;});}return null;};}function removeEntity(_0x26b4af,_0x6c84cd){return function(_0x1c4599){if(_0x1c4599){return _0x1c4599[_0x9974('0x2a')]()[_0x9974('0x2b')](function(){_0x26b4af['status'](0xcc)[_0x9974('0x1f')]();});}};}function handleEntityNotFound(_0x504225,_0x1f5c44){return function(_0x11624b){if(!_0x11624b){_0x504225[_0x9974('0x1d')](0x194);}return _0x11624b;};}function handleError(_0x463363,_0x1acf20){_0x1acf20=_0x1acf20||0x1f4;return function(_0x8495c6){logger[_0x9974('0x2c')](_0x8495c6['stack']);if(_0x8495c6[_0x9974('0x2d')]){delete _0x8495c6[_0x9974('0x2d')];}_0x463363[_0x9974('0x1e')](_0x1acf20)[_0x9974('0x2e')](_0x8495c6);};}exports[_0x9974('0x2f')]=function(_0x4cb4a4,_0x27ce10){var _0x132823={},_0x298f6c={},_0x1fbb16={'count':0x0,'rows':[]};var _0x38fb56=_['map'](db['DeskAccount']['rawAttributes'],function(_0x7622d7){return{'name':_0x7622d7[_0x9974('0x30')],'type':_0x7622d7['type'][_0x9974('0x31')]};});_0x298f6c[_0x9974('0x32')]=_['map'](_0x38fb56,'name');_0x298f6c[_0x9974('0x33')]=_[_0x9974('0x34')](_0x4cb4a4['query']);_0x298f6c['filters']=_['intersection'](_0x298f6c[_0x9974('0x32')],_0x298f6c[_0x9974('0x33')]);_0x132823[_0x9974('0x35')]=_[_0x9974('0x36')](_0x298f6c[_0x9974('0x32')],qs[_0x9974('0x37')](_0x4cb4a4['query'][_0x9974('0x37')]));_0x132823[_0x9974('0x35')]=_0x132823[_0x9974('0x35')][_0x9974('0x38')]?_0x132823['attributes']:_0x298f6c['model'];if(!_0x4cb4a4['query'][_0x9974('0x39')](_0x9974('0x3a'))){_0x132823[_0x9974('0x24')]=qs[_0x9974('0x24')](_0x4cb4a4[_0x9974('0x33')]['limit']);_0x132823['offset']=qs[_0x9974('0x21')](_0x4cb4a4[_0x9974('0x33')][_0x9974('0x21')]);}_0x132823[_0x9974('0x3b')]=qs[_0x9974('0x3c')](_0x4cb4a4[_0x9974('0x33')]['sort']);_0x132823[_0x9974('0x3d')]=qs[_0x9974('0x3e')](_['pick'](_0x4cb4a4[_0x9974('0x33')],_0x298f6c['filters']),_0x38fb56);if(_0x4cb4a4[_0x9974('0x33')]['filter']){_0x132823['where']=_[_0x9974('0x3f')](_0x132823[_0x9974('0x3d')],{'$or':_[_0x9974('0x40')](_0x38fb56,function(_0x3b3554){if(_0x3b3554[_0x9974('0x41')]!==_0x9974('0x42')){var _0x31d117={};_0x31d117[_0x3b3554[_0x9974('0x2d')]]={'$like':'%'+_0x4cb4a4['query'][_0x9974('0x43')]+'%'};return _0x31d117;}})});}_0x132823=_[_0x9974('0x3f')]({},_0x132823,_0x4cb4a4[_0x9974('0x44')]);var _0xc19c9f={'where':_0x132823['where']};return db[_0x9974('0x45')][_0x9974('0x23')](_0xc19c9f)['then'](function(_0x1ad9b6){_0x1fbb16[_0x9974('0x23')]=_0x1ad9b6;if(_0x4cb4a4[_0x9974('0x33')]['includeAll']){_0x132823[_0x9974('0x46')]=[{'all':!![]}];}return db[_0x9974('0x45')][_0x9974('0x47')](_0x132823);})[_0x9974('0x2b')](function(_0xf06689){_0x1fbb16[_0x9974('0x48')]=_0xf06689;return _0x1fbb16;})[_0x9974('0x2b')](respondWithFilteredResult(_0x27ce10,_0x132823))['catch'](handleError(_0x27ce10,null));};exports['show']=function(_0x554dc0,_0x5b95df){var _0x117a9e={'raw':![],'where':{'id':_0x554dc0['params']['id']}},_0x2c8613={};_0x2c8613[_0x9974('0x32')]=_['keys'](db[_0x9974('0x45')][_0x9974('0x49')]);_0x2c8613[_0x9974('0x33')]=_[_0x9974('0x34')](_0x554dc0[_0x9974('0x33')]);_0x2c8613[_0x9974('0x3e')]=_[_0x9974('0x36')](_0x2c8613[_0x9974('0x32')],_0x2c8613[_0x9974('0x33')]);_0x117a9e[_0x9974('0x35')]=_['intersection'](_0x2c8613[_0x9974('0x32')],qs['fields'](_0x554dc0[_0x9974('0x33')][_0x9974('0x37')]));_0x117a9e[_0x9974('0x35')]=_0x117a9e[_0x9974('0x35')]['length']?_0x117a9e[_0x9974('0x35')]:_0x2c8613[_0x9974('0x32')];if(_0x554dc0[_0x9974('0x33')][_0x9974('0x4a')]){_0x117a9e[_0x9974('0x46')]=[{'all':!![]}];}_0x117a9e=_[_0x9974('0x3f')]({},_0x117a9e,_0x554dc0['options']);return db[_0x9974('0x45')][_0x9974('0x4b')](_0x117a9e)['then'](handleEntityNotFound(_0x5b95df,null))['then'](respondWithResult(_0x5b95df,null))['catch'](handleError(_0x5b95df,null));};exports['create']=function(_0x3cab27,_0x239906){return db[_0x9974('0x45')]['create'](_0x3cab27[_0x9974('0x4c')],{})[_0x9974('0x2b')](respondWithResult(_0x239906,0xc9))['catch'](handleError(_0x239906,null));};exports['update']=function(_0x3420bb,_0x2cec14){if(_0x3420bb[_0x9974('0x4c')]['id']){delete _0x3420bb[_0x9974('0x4c')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x3420bb[_0x9974('0x4d')]['id']}})[_0x9974('0x2b')](handleEntityNotFound(_0x2cec14,null))[_0x9974('0x2b')](saveUpdates(_0x3420bb[_0x9974('0x4c')],null))['then'](respondWithResult(_0x2cec14,null))['catch'](handleError(_0x2cec14,null));};exports[_0x9974('0x2a')]=function(_0x3edf72,_0xb20ed8){return db['DeskAccount'][_0x9974('0x4b')]({'where':{'id':_0x3edf72[_0x9974('0x4d')]['id']}})[_0x9974('0x2b')](handleEntityNotFound(_0xb20ed8,null))[_0x9974('0x2b')](removeEntity(_0xb20ed8,null))['catch'](handleError(_0xb20ed8,null));};exports[_0x9974('0x4e')]=function(_0x54ee9e,_0x2efdef,_0xaf8515){var _0x4afbd8={};var _0x4672fb={};var _0x3fd70f;var _0x1a47c9;return db['DeskAccount'][_0x9974('0x4f')]({'where':{'id':_0x54ee9e['params']['id']}})['then'](handleEntityNotFound(_0x2efdef,null))[_0x9974('0x2b')](function(_0x24a442){if(_0x24a442){_0x3fd70f=_0x24a442;_0x4672fb[_0x9974('0x32')]=_[_0x9974('0x34')](db[_0x9974('0x50')][_0x9974('0x49')]);_0x4672fb['query']=_[_0x9974('0x34')](_0x54ee9e[_0x9974('0x33')]);_0x4672fb[_0x9974('0x3e')]=_[_0x9974('0x36')](_0x4672fb[_0x9974('0x32')],_0x4672fb[_0x9974('0x33')]);_0x4afbd8[_0x9974('0x35')]=_[_0x9974('0x36')](_0x4672fb[_0x9974('0x32')],qs[_0x9974('0x37')](_0x54ee9e[_0x9974('0x33')]['fields']));_0x4afbd8[_0x9974('0x35')]=_0x4afbd8['attributes'][_0x9974('0x38')]?_0x4afbd8[_0x9974('0x35')]:_0x4672fb['model'];_0x4afbd8['order']=qs[_0x9974('0x3c')](_0x54ee9e[_0x9974('0x33')][_0x9974('0x3c')]);_0x4afbd8[_0x9974('0x3d')]=qs['filters'](_[_0x9974('0x51')](_0x54ee9e[_0x9974('0x33')],_0x4672fb[_0x9974('0x3e')]));if(_0x54ee9e[_0x9974('0x33')][_0x9974('0x43')]){_0x4afbd8[_0x9974('0x3d')]=_[_0x9974('0x3f')](_0x4afbd8[_0x9974('0x3d')],{'$or':_[_0x9974('0x40')](_0x4afbd8[_0x9974('0x35')],function(_0x4cb8e2){var _0x183d29={};_0x183d29[_0x4cb8e2]={'$like':'%'+_0x54ee9e[_0x9974('0x33')][_0x9974('0x43')]+'%'};return _0x183d29;})});}_0x4afbd8=_[_0x9974('0x3f')]({},_0x4afbd8,_0x54ee9e[_0x9974('0x44')]);return _0x3fd70f[_0x9974('0x4e')](_0x4afbd8);}})[_0x9974('0x2b')](function(_0x9f3a4){if(_0x9f3a4){_0x1a47c9=_0x9f3a4[_0x9974('0x38')];if(!_0x54ee9e[_0x9974('0x33')][_0x9974('0x39')]('nolimit')){_0x4afbd8[_0x9974('0x24')]=qs[_0x9974('0x24')](_0x54ee9e[_0x9974('0x33')][_0x9974('0x24')]);_0x4afbd8['offset']=qs['offset'](_0x54ee9e[_0x9974('0x33')][_0x9974('0x21')]);}return _0x3fd70f[_0x9974('0x4e')](_0x4afbd8);}})[_0x9974('0x2b')](function(_0x28f95a){if(_0x28f95a){return _0x28f95a?{'count':_0x1a47c9,'rows':_0x28f95a}:null;}})['then'](respondWithResult(_0x2efdef,null))[_0x9974('0x52')](handleError(_0x2efdef,null));};exports[_0x9974('0x53')]=function(_0x200280,_0x469860,_0xa78008){if(_0x200280[_0x9974('0x4c')]['id']){delete _0x200280['body']['id'];}return db[_0x9974('0x45')][_0x9974('0x4f')]({'where':{'id':_0x200280[_0x9974('0x4d')]['id']}})[_0x9974('0x2b')](handleEntityNotFound(_0x469860,null))[_0x9974('0x2b')](function(_0x2be4c2){if(_0x2be4c2){_0x200280[_0x9974('0x4c')][_0x9974('0x54')]=_0x2be4c2['id'];_0x200280[_0x9974('0x4c')][_0x9974('0x55')]=integrations[_0x9974('0x56')](_0x200280['body'][_0x9974('0x57')],_0x200280[_0x9974('0x4c')][_0x9974('0x41')]);_0x200280['body'][_0x9974('0x58')]=integrations[_0x9974('0x59')](_0x200280['body'][_0x9974('0x57')],_0x200280['body'][_0x9974('0x41')]);return db['DeskConfiguration'][_0x9974('0x5a')](_0x200280[_0x9974('0x4c')],{'include':[{'model':db['DeskField'],'as':_0x9974('0x55')},{'model':db[_0x9974('0x5b')],'as':_0x9974('0x58')}]});}return null;})[_0x9974('0x2b')](respondWithResult(_0x469860,null))[_0x9974('0x52')](handleError(_0x469860,null));};exports[_0x9974('0x5c')]=function(_0xdbf8b0,_0x27a6a9,_0x5364f0){var _0x697da3=[{'name':_0x9974('0x5d'),'label':'priority','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 _0x1138e9='';return db[_0x9974('0x45')][_0x9974('0x4f')]({'where':{'id':_0xdbf8b0[_0x9974('0x4d')]['id']},'attributes':['id',_0x9974('0x5e'),_0x9974('0x5f'),_0x9974('0x60'),_0x9974('0x61'),_0x9974('0x62'),_0x9974('0x63'),_0x9974('0x64'),_0x9974('0x65')]})[_0x9974('0x2b')](handleEntityNotFound(_0x27a6a9,null))[_0x9974('0x2b')](function(_0x2a1c39){if(_0x2a1c39){_0x1138e9=_0x2a1c39[_0x9974('0x5e')];var _0x14235e=_0x1138e9[_0x9974('0x66')](-0x1);if(_0x14235e==='/'){_0x1138e9=_0x1138e9[_0x9974('0x67')](0x0,_0x1138e9[_0x9974('0x68')](_0x14235e));}var _0x5030ee={'method':'GET','uri':util[_0x9974('0x69')](_0x9974('0x6a'),_0x1138e9),'headers':{'Content-Type':_0x9974('0x6b'),'Accept':_0x9974('0x6b')},'json':!![]};if(_0x2a1c39[_0x9974('0x5f')]==='basic'){_0x5030ee[_0x9974('0x6c')][_0x9974('0x6d')]=util['format'](_0x9974('0x6e'),new Buffer(util[_0x9974('0x69')](_0x9974('0x6f'),_0x2a1c39[_0x9974('0x60')],_0x2a1c39[_0x9974('0x61')]))['toString'](_0x9974('0x70')));}return rp(_0x5030ee)[_0x9974('0x2b')](function(_0x3356b0){return _0x697da3['concat'](_[_0x9974('0x40')](_0x3356b0[_0x9974('0x71')][_0x9974('0x72')],function(_0xb9defd){return{'id':_0xb9defd[_0x9974('0x2d')],'name':_0xb9defd[_0x9974('0x2d')],'type':_0xb9defd['type'],'active':_0xb9defd[_0x9974('0x73')],'label':_0xb9defd[_0x9974('0x74')],'custom':!![]};}));});}})[_0x9974('0x2b')](function(_0x5dd16a){return{'count':_0x5dd16a[_0x9974('0x38')],'rows':_0x5dd16a};})[_0x9974('0x2b')](respondWithResult(_0x27a6a9,null))[_0x9974('0x52')](function(_0x6237af){var _0x2c5d07=_0xdbf8b0[_0x9974('0x33')][_0x9974('0x75')]?0x1f4:_0x6237af[_0x9974('0x76')]||0x1f4;logger[_0x9974('0x2c')](_0x9974('0x77'),_0x9974('0x5c'),_0x2c5d07,JSON[_0x9974('0x78')](_0x6237af));delete _0x6237af[_0x9974('0x2d')];if(_0x2c5d07===0x191){_0x2c5d07=0x190;}_0x27a6a9['status'](_0x2c5d07)[_0x9974('0x2e')](_0xdbf8b0['query']['test']?{'message':_0x9974('0x79'),'statusCode':_0x6237af[_0x9974('0x76')]}:_0x6237af);});}; \ No newline at end of file +var _0xfa79=['apply','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','sort','addConfiguration','AccountId','channel','getDescriptions','DeskConfiguration','Descriptions','getFields','priority','remoteUri','password','consumerKey','consumerSecret','token','slice','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x5465e6,_0x2a8809){var _0x10044e=function(_0x1d5dcd){while(--_0x1d5dcd){_0x5465e6['push'](_0x5465e6['shift']());}};_0x10044e(++_0x2a8809);}(_0xfa79,0x1b2));var _0x9fa7=function(_0x450a7e,_0x39ca8b){_0x450a7e=_0x450a7e-0x0;var _0x42c4c4=_0xfa79[_0x450a7e];return _0x42c4c4;};'use strict';var emlformat=require(_0x9fa7('0x0'));var rimraf=require(_0x9fa7('0x1'));var zipdir=require(_0x9fa7('0x2'));var jsonpatch=require(_0x9fa7('0x3'));var rp=require(_0x9fa7('0x4'));var moment=require('moment');var BPromise=require(_0x9fa7('0x5'));var Mustache=require(_0x9fa7('0x6'));var util=require('util');var path=require(_0x9fa7('0x7'));var sox=require(_0x9fa7('0x8'));var csv=require(_0x9fa7('0x9'));var ejs=require(_0x9fa7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9fa7('0xb'));var squel=require(_0x9fa7('0xc'));var crypto=require(_0x9fa7('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9fa7('0xe'));var toCsv=require(_0x9fa7('0x9'));var querystring=require('querystring');var Papa=require(_0x9fa7('0xf'));var Redis=require(_0x9fa7('0x10'));var authService=require(_0x9fa7('0x11'));var qs=require(_0x9fa7('0x12'));var as=require(_0x9fa7('0x13'));var hardwareService=require(_0x9fa7('0x14'));var logger=require(_0x9fa7('0x15'))(_0x9fa7('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9fa7('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x161926,_0xec8176){_0xec8176=_0xec8176||0xcc;return function(_0x5bd783){if(_0x5bd783){return _0x161926[_0x9fa7('0x18')](_0xec8176);}return _0x161926[_0x9fa7('0x19')](_0xec8176)[_0x9fa7('0x1a')]();};}function respondWithResult(_0x4ef89f,_0x536cca){_0x536cca=_0x536cca||0xc8;return function(_0x53746f){if(_0x53746f){return _0x4ef89f[_0x9fa7('0x19')](_0x536cca)[_0x9fa7('0x1b')](_0x53746f);}};}function respondWithFilteredResult(_0x5a57d9,_0x11e85b){return function(_0x436901){if(_0x436901){var _0x54eb09=typeof _0x11e85b[_0x9fa7('0x1c')]==='undefined'&&typeof _0x11e85b[_0x9fa7('0x1d')]===_0x9fa7('0x1e');var _0x4f8d5c=_0x436901[_0x9fa7('0x1f')];var _0x2fee26=_0x54eb09?0x0:_0x11e85b[_0x9fa7('0x1c')];var _0x2e1a24=_0x54eb09?_0x436901[_0x9fa7('0x1f')]:_0x11e85b[_0x9fa7('0x1c')]+_0x11e85b[_0x9fa7('0x1d')];var _0x505b16;if(_0x2e1a24>=_0x4f8d5c){_0x2e1a24=_0x4f8d5c;_0x505b16=0xc8;}else{_0x505b16=0xce;}_0x5a57d9[_0x9fa7('0x19')](_0x505b16);return _0x5a57d9[_0x9fa7('0x20')](_0x9fa7('0x21'),_0x2fee26+'-'+_0x2e1a24+'/'+_0x4f8d5c)['json'](_0x436901);}return null;};}function patchUpdates(_0x1d82c6){return function(_0x2c028a){try{jsonpatch[_0x9fa7('0x22')](_0x2c028a,_0x1d82c6,!![]);}catch(_0xad7005){return BPromise[_0x9fa7('0x23')](_0xad7005);}return _0x2c028a[_0x9fa7('0x24')]();};}function saveUpdates(_0x396552,_0x4eb861){return function(_0x98fa19){if(_0x98fa19){return _0x98fa19[_0x9fa7('0x25')](_0x396552)['then'](function(_0x56e705){return _0x56e705;});}return null;};}function removeEntity(_0x41cfd0,_0x239f2d){return function(_0x5d0a4b){if(_0x5d0a4b){return _0x5d0a4b[_0x9fa7('0x26')]()[_0x9fa7('0x27')](function(){_0x41cfd0['status'](0xcc)[_0x9fa7('0x1a')]();});}};}function handleEntityNotFound(_0x4c1378,_0x1dc989){return function(_0x2cedfc){if(!_0x2cedfc){_0x4c1378['sendStatus'](0x194);}return _0x2cedfc;};}function handleError(_0x55f792,_0x5f548f){_0x5f548f=_0x5f548f||0x1f4;return function(_0x252879){logger[_0x9fa7('0x28')](_0x252879[_0x9fa7('0x29')]);if(_0x252879[_0x9fa7('0x2a')]){delete _0x252879[_0x9fa7('0x2a')];}_0x55f792[_0x9fa7('0x19')](_0x5f548f)[_0x9fa7('0x2b')](_0x252879);};}exports[_0x9fa7('0x2c')]=function(_0x5f013a,_0x430824){var _0x1600e6={},_0x5d03cc={},_0x147b21={'count':0x0,'rows':[]};var _0xa69820=_[_0x9fa7('0x2d')](db[_0x9fa7('0x2e')][_0x9fa7('0x2f')],function(_0x2a801b){return{'name':_0x2a801b[_0x9fa7('0x30')],'type':_0x2a801b[_0x9fa7('0x31')]['key']};});_0x5d03cc[_0x9fa7('0x32')]=_[_0x9fa7('0x2d')](_0xa69820,'name');_0x5d03cc[_0x9fa7('0x33')]=_[_0x9fa7('0x34')](_0x5f013a[_0x9fa7('0x33')]);_0x5d03cc[_0x9fa7('0x35')]=_[_0x9fa7('0x36')](_0x5d03cc[_0x9fa7('0x32')],_0x5d03cc[_0x9fa7('0x33')]);_0x1600e6['attributes']=_['intersection'](_0x5d03cc[_0x9fa7('0x32')],qs[_0x9fa7('0x37')](_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x37')]));_0x1600e6[_0x9fa7('0x38')]=_0x1600e6[_0x9fa7('0x38')][_0x9fa7('0x39')]?_0x1600e6[_0x9fa7('0x38')]:_0x5d03cc[_0x9fa7('0x32')];if(!_0x5f013a['query'][_0x9fa7('0x3a')](_0x9fa7('0x3b'))){_0x1600e6[_0x9fa7('0x1d')]=qs['limit'](_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x1d')]);_0x1600e6[_0x9fa7('0x1c')]=qs['offset'](_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x1c')]);}_0x1600e6[_0x9fa7('0x3c')]=qs['sort'](_0x5f013a['query']['sort']);_0x1600e6[_0x9fa7('0x3d')]=qs['filters'](_[_0x9fa7('0x3e')](_0x5f013a['query'],_0x5d03cc[_0x9fa7('0x35')]),_0xa69820);if(_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x3f')]){_0x1600e6[_0x9fa7('0x3d')]=_[_0x9fa7('0x40')](_0x1600e6[_0x9fa7('0x3d')],{'$or':_[_0x9fa7('0x2d')](_0xa69820,function(_0x2158ff){if(_0x2158ff['type']!==_0x9fa7('0x41')){var _0x4dfe65={};_0x4dfe65[_0x2158ff[_0x9fa7('0x2a')]]={'$like':'%'+_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x3f')]+'%'};return _0x4dfe65;}})});}_0x1600e6=_[_0x9fa7('0x40')]({},_0x1600e6,_0x5f013a[_0x9fa7('0x42')]);var _0x53378b={'where':_0x1600e6['where']};return db[_0x9fa7('0x2e')]['count'](_0x53378b)[_0x9fa7('0x27')](function(_0x17a76c){_0x147b21[_0x9fa7('0x1f')]=_0x17a76c;if(_0x5f013a[_0x9fa7('0x33')][_0x9fa7('0x43')]){_0x1600e6[_0x9fa7('0x44')]=[{'all':!![]}];}return db[_0x9fa7('0x2e')][_0x9fa7('0x45')](_0x1600e6);})[_0x9fa7('0x27')](function(_0x3e3a2a){_0x147b21['rows']=_0x3e3a2a;return _0x147b21;})[_0x9fa7('0x27')](respondWithFilteredResult(_0x430824,_0x1600e6))[_0x9fa7('0x46')](handleError(_0x430824,null));};exports[_0x9fa7('0x47')]=function(_0x10003a,_0x817c77){var _0x47116b={'raw':![],'where':{'id':_0x10003a[_0x9fa7('0x48')]['id']}},_0x186c89={};_0x186c89[_0x9fa7('0x32')]=_['keys'](db[_0x9fa7('0x2e')][_0x9fa7('0x2f')]);_0x186c89[_0x9fa7('0x33')]=_['keys'](_0x10003a[_0x9fa7('0x33')]);_0x186c89[_0x9fa7('0x35')]=_[_0x9fa7('0x36')](_0x186c89[_0x9fa7('0x32')],_0x186c89['query']);_0x47116b[_0x9fa7('0x38')]=_[_0x9fa7('0x36')](_0x186c89[_0x9fa7('0x32')],qs[_0x9fa7('0x37')](_0x10003a[_0x9fa7('0x33')][_0x9fa7('0x37')]));_0x47116b['attributes']=_0x47116b[_0x9fa7('0x38')][_0x9fa7('0x39')]?_0x47116b[_0x9fa7('0x38')]:_0x186c89[_0x9fa7('0x32')];if(_0x10003a[_0x9fa7('0x33')][_0x9fa7('0x43')]){_0x47116b['include']=[{'all':!![]}];}_0x47116b=_[_0x9fa7('0x40')]({},_0x47116b,_0x10003a['options']);return db[_0x9fa7('0x2e')][_0x9fa7('0x49')](_0x47116b)[_0x9fa7('0x27')](handleEntityNotFound(_0x817c77,null))[_0x9fa7('0x27')](respondWithResult(_0x817c77,null))[_0x9fa7('0x46')](handleError(_0x817c77,null));};exports[_0x9fa7('0x4a')]=function(_0x334f15,_0x345da6){return db[_0x9fa7('0x2e')][_0x9fa7('0x4a')](_0x334f15[_0x9fa7('0x4b')],{})[_0x9fa7('0x27')](respondWithResult(_0x345da6,0xc9))[_0x9fa7('0x46')](handleError(_0x345da6,null));};exports['update']=function(_0x450897,_0x406c86){if(_0x450897[_0x9fa7('0x4b')]['id']){delete _0x450897['body']['id'];}return db[_0x9fa7('0x2e')][_0x9fa7('0x49')]({'where':{'id':_0x450897[_0x9fa7('0x48')]['id']}})[_0x9fa7('0x27')](handleEntityNotFound(_0x406c86,null))[_0x9fa7('0x27')](saveUpdates(_0x450897['body'],null))['then'](respondWithResult(_0x406c86,null))[_0x9fa7('0x46')](handleError(_0x406c86,null));};exports[_0x9fa7('0x26')]=function(_0x21f67c,_0x360712){return db[_0x9fa7('0x2e')]['find']({'where':{'id':_0x21f67c[_0x9fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x360712,null))[_0x9fa7('0x27')](removeEntity(_0x360712,null))[_0x9fa7('0x46')](handleError(_0x360712,null));};exports[_0x9fa7('0x4c')]=function(_0xbd15d8,_0x39bcc8,_0x78ef82){var _0x1dc4e8={};var _0x3f5ef1={};var _0x1b562a;var _0x37e86a;return db['DeskAccount'][_0x9fa7('0x4d')]({'where':{'id':_0xbd15d8[_0x9fa7('0x48')]['id']}})['then'](handleEntityNotFound(_0x39bcc8,null))[_0x9fa7('0x27')](function(_0x453a91){if(_0x453a91){_0x1b562a=_0x453a91;_0x3f5ef1[_0x9fa7('0x32')]=_[_0x9fa7('0x34')](db['DeskConfiguration'][_0x9fa7('0x2f')]);_0x3f5ef1[_0x9fa7('0x33')]=_['keys'](_0xbd15d8[_0x9fa7('0x33')]);_0x3f5ef1[_0x9fa7('0x35')]=_['intersection'](_0x3f5ef1['model'],_0x3f5ef1[_0x9fa7('0x33')]);_0x1dc4e8[_0x9fa7('0x38')]=_[_0x9fa7('0x36')](_0x3f5ef1[_0x9fa7('0x32')],qs[_0x9fa7('0x37')](_0xbd15d8[_0x9fa7('0x33')]['fields']));_0x1dc4e8[_0x9fa7('0x38')]=_0x1dc4e8[_0x9fa7('0x38')]['length']?_0x1dc4e8['attributes']:_0x3f5ef1[_0x9fa7('0x32')];_0x1dc4e8[_0x9fa7('0x3c')]=qs['sort'](_0xbd15d8[_0x9fa7('0x33')][_0x9fa7('0x4e')]);_0x1dc4e8['where']=qs['filters'](_['pick'](_0xbd15d8[_0x9fa7('0x33')],_0x3f5ef1[_0x9fa7('0x35')]));if(_0xbd15d8['query']['filter']){_0x1dc4e8[_0x9fa7('0x3d')]=_['merge'](_0x1dc4e8[_0x9fa7('0x3d')],{'$or':_[_0x9fa7('0x2d')](_0x1dc4e8['attributes'],function(_0x5bdaf9){var _0x5ea4f1={};_0x5ea4f1[_0x5bdaf9]={'$like':'%'+_0xbd15d8['query'][_0x9fa7('0x3f')]+'%'};return _0x5ea4f1;})});}_0x1dc4e8=_['merge']({},_0x1dc4e8,_0xbd15d8[_0x9fa7('0x42')]);return _0x1b562a[_0x9fa7('0x4c')](_0x1dc4e8);}})[_0x9fa7('0x27')](function(_0x356c5e){if(_0x356c5e){_0x37e86a=_0x356c5e[_0x9fa7('0x39')];if(!_0xbd15d8[_0x9fa7('0x33')][_0x9fa7('0x3a')](_0x9fa7('0x3b'))){_0x1dc4e8[_0x9fa7('0x1d')]=qs[_0x9fa7('0x1d')](_0xbd15d8['query']['limit']);_0x1dc4e8[_0x9fa7('0x1c')]=qs[_0x9fa7('0x1c')](_0xbd15d8[_0x9fa7('0x33')][_0x9fa7('0x1c')]);}return _0x1b562a[_0x9fa7('0x4c')](_0x1dc4e8);}})['then'](function(_0x419b4f){if(_0x419b4f){return _0x419b4f?{'count':_0x37e86a,'rows':_0x419b4f}:null;}})['then'](respondWithResult(_0x39bcc8,null))['catch'](handleError(_0x39bcc8,null));};exports[_0x9fa7('0x4f')]=function(_0x5d5102,_0x23671f,_0x12d87f){if(_0x5d5102[_0x9fa7('0x4b')]['id']){delete _0x5d5102[_0x9fa7('0x4b')]['id'];}return db[_0x9fa7('0x2e')][_0x9fa7('0x4d')]({'where':{'id':_0x5d5102['params']['id']}})[_0x9fa7('0x27')](handleEntityNotFound(_0x23671f,null))[_0x9fa7('0x27')](function(_0x2b0fc9){if(_0x2b0fc9){_0x5d5102[_0x9fa7('0x4b')][_0x9fa7('0x50')]=_0x2b0fc9['id'];_0x5d5102[_0x9fa7('0x4b')]['Subjects']=integrations['getSubjects'](_0x5d5102[_0x9fa7('0x4b')][_0x9fa7('0x51')],_0x5d5102[_0x9fa7('0x4b')][_0x9fa7('0x31')]);_0x5d5102['body']['Descriptions']=integrations[_0x9fa7('0x52')](_0x5d5102[_0x9fa7('0x4b')][_0x9fa7('0x51')],_0x5d5102[_0x9fa7('0x4b')][_0x9fa7('0x31')]);return db[_0x9fa7('0x53')]['create'](_0x5d5102[_0x9fa7('0x4b')],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x9fa7('0x54')}]});}return null;})[_0x9fa7('0x27')](respondWithResult(_0x23671f,null))[_0x9fa7('0x46')](handleError(_0x23671f,null));};exports[_0x9fa7('0x55')]=function(_0x58b835,_0x2dd867,_0x5e5dcb){var _0x550e1f=[{'name':'priority','label':_0x9fa7('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 _0x25ebb4='';return db[_0x9fa7('0x2e')][_0x9fa7('0x4d')]({'where':{'id':_0x58b835[_0x9fa7('0x48')]['id']},'attributes':['id',_0x9fa7('0x57'),'authType','username',_0x9fa7('0x58'),_0x9fa7('0x59'),_0x9fa7('0x5a'),_0x9fa7('0x5b'),'tokenSecret']})[_0x9fa7('0x27')](handleEntityNotFound(_0x2dd867,null))[_0x9fa7('0x27')](function(_0x468022){if(_0x468022){_0x25ebb4=_0x468022[_0x9fa7('0x57')];var _0x4ed604=_0x25ebb4[_0x9fa7('0x5c')](-0x1);if(_0x4ed604==='/'){_0x25ebb4=_0x25ebb4['substring'](0x0,_0x25ebb4[_0x9fa7('0x5d')](_0x4ed604));}var _0x8954f9={'method':_0x9fa7('0x5e'),'uri':util[_0x9fa7('0x5f')](_0x9fa7('0x60'),_0x25ebb4),'headers':{'Content-Type':_0x9fa7('0x61'),'Accept':_0x9fa7('0x61')},'json':!![]};if(_0x468022[_0x9fa7('0x62')]===_0x9fa7('0x63')){_0x8954f9[_0x9fa7('0x64')][_0x9fa7('0x65')]=util['format'](_0x9fa7('0x66'),new Buffer(util[_0x9fa7('0x5f')](_0x9fa7('0x67'),_0x468022[_0x9fa7('0x68')],_0x468022[_0x9fa7('0x58')]))[_0x9fa7('0x69')](_0x9fa7('0x6a')));}return rp(_0x8954f9)[_0x9fa7('0x27')](function(_0x16a71a){return _0x550e1f[_0x9fa7('0x6b')](_[_0x9fa7('0x2d')](_0x16a71a[_0x9fa7('0x6c')][_0x9fa7('0x6d')],function(_0x6324e4){return{'id':_0x6324e4[_0x9fa7('0x2a')],'name':_0x6324e4[_0x9fa7('0x2a')],'type':_0x6324e4['type'],'active':_0x6324e4[_0x9fa7('0x6e')],'label':_0x6324e4[_0x9fa7('0x6f')],'custom':!![]};}));});}})[_0x9fa7('0x27')](function(_0x45e7f5){return{'count':_0x45e7f5['length'],'rows':_0x45e7f5};})[_0x9fa7('0x27')](respondWithResult(_0x2dd867,null))['catch'](function(_0x4fc08a){var _0x4c6d14=_0x58b835[_0x9fa7('0x33')]['test']?0x1f4:_0x4fc08a[_0x9fa7('0x70')]||0x1f4;logger[_0x9fa7('0x28')](_0x9fa7('0x71'),'getFields',_0x4c6d14,JSON[_0x9fa7('0x72')](_0x4fc08a));delete _0x4fc08a[_0x9fa7('0x2a')];if(_0x4c6d14===0x191){_0x4c6d14=0x190;}_0x2dd867[_0x9fa7('0x19')](_0x4c6d14)['send'](_0x58b835[_0x9fa7('0x33')][_0x9fa7('0x73')]?{'message':_0x9fa7('0x74'),'statusCode':_0x4fc08a['statusCode']}:_0x4fc08a);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 0b4073d..4433928 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 _0xdb6c=['int_desk_accounts','lodash','util','api','moment','request-promise','path','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xdb6c,0x119));var _0xcdb6=function(_0x4f5ff9,_0x2d3a56){_0x4f5ff9=_0x4f5ff9-0x0;var _0x551481=_0xdb6c[_0x4f5ff9];return _0x551481;};'use strict';var _=require(_0xcdb6('0x0'));var util=require(_0xcdb6('0x1'));var logger=require('../../config/logger')(_0xcdb6('0x2'));var moment=require(_0xcdb6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcdb6('0x4'));var fs=require('fs');var path=require(_0xcdb6('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcdb6('0x6'));var integrations=require(_0xcdb6('0x7'));module['exports']=function(_0x2af765,_0x475c55){return _0x2af765['define'](_0xcdb6('0x8'),attributes,{'tableName':_0xcdb6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21f2=['lodash','util','api','moment','request-promise','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','int_desk_accounts'];(function(_0x389ecc,_0x21e2d6){var _0x43ae1b=function(_0x44bed1){while(--_0x44bed1){_0x389ecc['push'](_0x389ecc['shift']());}};_0x43ae1b(++_0x21e2d6);}(_0x21f2,0xb0));var _0x221f=function(_0xdfbb22,_0x3ec1b4){_0xdfbb22=_0xdfbb22-0x0;var _0x2031c8=_0x21f2[_0xdfbb22];return _0x2031c8;};'use strict';var _=require(_0x221f('0x0'));var util=require(_0x221f('0x1'));var logger=require('../../config/logger')(_0x221f('0x2'));var moment=require(_0x221f('0x3'));var BPromise=require('bluebird');var rp=require(_0x221f('0x4'));var fs=require('fs');var path=require(_0x221f('0x5'));var rimraf=require('rimraf');var config=require(_0x221f('0x6'));var attributes=require(_0x221f('0x7'));var integrations=require(_0x221f('0x8'));module[_0x221f('0x9')]=function(_0x30422c,_0x11c223){return _0x30422c['define']('DeskAccount',attributes,{'tableName':_0x221f('0xa'),'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 bdc1295..6971e26 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 _0x3277=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','where','limit','include','map','model','attributes','find','raw','ShowDeskAccount'];(function(_0x161c5d,_0x2fd4e5){var _0x44d263=function(_0x2611a1){while(--_0x2611a1){_0x161c5d['push'](_0x161c5d['shift']());}};_0x44d263(++_0x2fd4e5);}(_0x3277,0xde));var _0x7327=function(_0x54a0d9,_0x135086){_0x54a0d9=_0x54a0d9-0x0;var _0x58e448=_0x3277[_0x54a0d9];return _0x58e448;};'use strict';var _=require(_0x7327('0x0'));var util=require(_0x7327('0x1'));var moment=require(_0x7327('0x2'));var BPromise=require(_0x7327('0x3'));var rs=require(_0x7327('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7327('0x5'))['db'];var utils=require(_0x7327('0x6'));var logger=require(_0x7327('0x7'))(_0x7327('0x8'));var config=require(_0x7327('0x9'));var jayson=require(_0x7327('0xa'));var client=jayson[_0x7327('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e1256,_0x21d046,_0x12be58){return new BPromise(function(_0xd886c0,_0x11d15c){return client[_0x7327('0xc')](_0x5e1256,_0x12be58)[_0x7327('0xd')](function(_0x53e8e0){logger[_0x7327('0xe')](_0x7327('0xf'),_0x21d046,_0x7327('0x10'));logger[_0x7327('0x11')](_0x7327('0x12'),_0x21d046,_0x7327('0x10'),JSON[_0x7327('0x13')](_0x53e8e0));if(_0x53e8e0[_0x7327('0x14')]){if(_0x53e8e0[_0x7327('0x14')]['code']===0x1f4){logger[_0x7327('0x14')](_0x7327('0xf'),_0x21d046,_0x53e8e0[_0x7327('0x14')][_0x7327('0x15')]);return _0x11d15c(_0x53e8e0['error'][_0x7327('0x15')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x21d046,_0x53e8e0[_0x7327('0x14')][_0x7327('0x15')]);return _0xd886c0(_0x53e8e0[_0x7327('0x14')][_0x7327('0x15')]);}else{logger[_0x7327('0xe')](_0x7327('0xf'),_0x21d046,_0x7327('0x10'));_0xd886c0(_0x53e8e0[_0x7327('0x16')][_0x7327('0x15')]);}})[_0x7327('0x17')](function(_0x23b448){logger[_0x7327('0x14')](_0x7327('0xf'),_0x21d046,_0x23b448);_0x11d15c(_0x23b448);});});}exports[_0x7327('0x18')]=function(_0x4df8a6){var _0x23ba5c=this;return new Promise(function(_0x1a88ed,_0x2e14a1){return db[_0x7327('0x19')][_0x7327('0x1a')]({'raw':_0x4df8a6['options']?_0x4df8a6[_0x7327('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4df8a6['options']?_0x4df8a6[_0x7327('0x1b')][_0x7327('0x1c')]||null:null,'attributes':_0x4df8a6['options']?_0x4df8a6[_0x7327('0x1b')]['attributes']||null:null,'limit':_0x4df8a6[_0x7327('0x1b')]?_0x4df8a6[_0x7327('0x1b')][_0x7327('0x1d')]||null:null,'include':_0x4df8a6[_0x7327('0x1b')]?_0x4df8a6[_0x7327('0x1b')][_0x7327('0x1e')]?_[_0x7327('0x1f')](_0x4df8a6['options']['include'],function(_0x36624b){return{'model':db[_0x36624b[_0x7327('0x20')]],'as':_0x36624b['as'],'attributes':_0x36624b[_0x7327('0x21')],'include':_0x36624b[_0x7327('0x1e')]?_[_0x7327('0x1f')](_0x36624b[_0x7327('0x1e')],function(_0x284196){return{'model':db[_0x284196['model']],'as':_0x284196['as'],'attributes':_0x284196[_0x7327('0x21')],'include':_0x284196[_0x7327('0x1e')]?_[_0x7327('0x1f')](_0x284196[_0x7327('0x1e')],function(_0x45d073){return{'model':db[_0x45d073[_0x7327('0x20')]],'as':_0x45d073['as'],'attributes':_0x45d073[_0x7327('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7327('0xd')](function(_0x56d336){logger[_0x7327('0xe')]('GetDeskAccount',_0x4df8a6);logger['debug'](_0x7327('0x18'),_0x4df8a6,JSON[_0x7327('0x13')](_0x56d336));_0x1a88ed(_0x56d336);})[_0x7327('0x17')](function(_0x56abc0){logger['error'](_0x7327('0x18'),_0x56abc0[_0x7327('0x15')],_0x4df8a6);_0x2e14a1(_0x23ba5c['error'](0x1f4,_0x56abc0[_0x7327('0x15')]));});});};exports['ShowDeskAccount']=function(_0x464b43){var _0x31a40e=this;return new Promise(function(_0x4ab261,_0x2235f3){return db[_0x7327('0x19')][_0x7327('0x22')]({'raw':_0x464b43[_0x7327('0x1b')]?_0x464b43[_0x7327('0x1b')][_0x7327('0x23')]===undefined?!![]:![]:!![],'where':_0x464b43[_0x7327('0x1b')]?_0x464b43[_0x7327('0x1b')][_0x7327('0x1c')]||null:null,'attributes':_0x464b43[_0x7327('0x1b')]?_0x464b43['options'][_0x7327('0x21')]||null:null,'include':_0x464b43[_0x7327('0x1b')]?_0x464b43[_0x7327('0x1b')][_0x7327('0x1e')]?_[_0x7327('0x1f')](_0x464b43['options'][_0x7327('0x1e')],function(_0x4fb7a0){return{'model':db[_0x4fb7a0[_0x7327('0x20')]],'as':_0x4fb7a0['as'],'attributes':_0x4fb7a0[_0x7327('0x21')],'include':_0x4fb7a0[_0x7327('0x1e')]?_['map'](_0x4fb7a0[_0x7327('0x1e')],function(_0x51bea4){return{'model':db[_0x51bea4['model']],'as':_0x51bea4['as'],'attributes':_0x51bea4[_0x7327('0x21')],'include':_0x51bea4[_0x7327('0x1e')]?_[_0x7327('0x1f')](_0x51bea4[_0x7327('0x1e')],function(_0x525b16){return{'model':db[_0x525b16[_0x7327('0x20')]],'as':_0x525b16['as'],'attributes':_0x525b16[_0x7327('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a71e2){logger[_0x7327('0xe')]('ShowDeskAccount',_0x464b43);logger[_0x7327('0x11')](_0x7327('0x24'),_0x464b43,JSON[_0x7327('0x13')](_0x3a71e2));_0x4ab261(_0x3a71e2);})[_0x7327('0x17')](function(_0x2a33db){logger[_0x7327('0x14')](_0x7327('0x24'),_0x2a33db[_0x7327('0x15')],_0x464b43);_0x2235f3(_0x31a40e[_0x7327('0x14')](0x1f4,_0x2a33db['message']));});});}; \ No newline at end of file +var _0xa7ad=['stringify','error','message','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','include','map','model','then','ShowDeskAccount','find','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x20f3df,_0x2be8a8){var _0x5b01aa=function(_0x1af70c){while(--_0x1af70c){_0x20f3df['push'](_0x20f3df['shift']());}};_0x5b01aa(++_0x2be8a8);}(_0xa7ad,0x1d8));var _0xda7a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa7ad[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xda7a('0x0'));var util=require(_0xda7a('0x1'));var moment=require(_0xda7a('0x2'));var BPromise=require(_0xda7a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda7a('0x4'))['db'];var utils=require(_0xda7a('0x5'));var logger=require(_0xda7a('0x6'))(_0xda7a('0x7'));var config=require(_0xda7a('0x8'));var jayson=require(_0xda7a('0x9'));var client=jayson[_0xda7a('0xa')][_0xda7a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x155883,_0xcc7589,_0x56b016){return new BPromise(function(_0x780ad6,_0x2279e0){return client[_0xda7a('0xc')](_0x155883,_0x56b016)['then'](function(_0x127f3a){logger[_0xda7a('0xd')](_0xda7a('0xe'),_0xcc7589,'request\x20sent');logger[_0xda7a('0xf')](_0xda7a('0x10'),_0xcc7589,_0xda7a('0x11'),JSON[_0xda7a('0x12')](_0x127f3a));if(_0x127f3a[_0xda7a('0x13')]){if(_0x127f3a[_0xda7a('0x13')]['code']===0x1f4){logger['error'](_0xda7a('0xe'),_0xcc7589,_0x127f3a[_0xda7a('0x13')][_0xda7a('0x14')]);return _0x2279e0(_0x127f3a['error'][_0xda7a('0x14')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0xcc7589,_0x127f3a[_0xda7a('0x13')][_0xda7a('0x14')]);return _0x780ad6(_0x127f3a[_0xda7a('0x13')][_0xda7a('0x14')]);}else{logger[_0xda7a('0xd')]('DeskAccount,\x20%s,\x20%s',_0xcc7589,_0xda7a('0x11'));_0x780ad6(_0x127f3a['result'][_0xda7a('0x14')]);}})[_0xda7a('0x15')](function(_0xc85513){logger[_0xda7a('0x13')](_0xda7a('0xe'),_0xcc7589,_0xc85513);_0x2279e0(_0xc85513);});});}exports[_0xda7a('0x16')]=function(_0x511fe0){var _0x126883=this;return new Promise(function(_0x5a6d1c,_0x4f68af){return db[_0xda7a('0x17')][_0xda7a('0x18')]({'raw':_0x511fe0[_0xda7a('0x19')]?_0x511fe0[_0xda7a('0x19')][_0xda7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x511fe0['options']?_0x511fe0[_0xda7a('0x19')][_0xda7a('0x1b')]||null:null,'attributes':_0x511fe0[_0xda7a('0x19')]?_0x511fe0[_0xda7a('0x19')][_0xda7a('0x1c')]||null:null,'limit':_0x511fe0[_0xda7a('0x19')]?_0x511fe0[_0xda7a('0x19')]['limit']||null:null,'include':_0x511fe0[_0xda7a('0x19')]?_0x511fe0[_0xda7a('0x19')][_0xda7a('0x1d')]?_[_0xda7a('0x1e')](_0x511fe0[_0xda7a('0x19')][_0xda7a('0x1d')],function(_0x191e1f){return{'model':db[_0x191e1f[_0xda7a('0x1f')]],'as':_0x191e1f['as'],'attributes':_0x191e1f[_0xda7a('0x1c')],'include':_0x191e1f[_0xda7a('0x1d')]?_[_0xda7a('0x1e')](_0x191e1f[_0xda7a('0x1d')],function(_0x55d501){return{'model':db[_0x55d501['model']],'as':_0x55d501['as'],'attributes':_0x55d501[_0xda7a('0x1c')],'include':_0x55d501[_0xda7a('0x1d')]?_[_0xda7a('0x1e')](_0x55d501['include'],function(_0x1caa49){return{'model':db[_0x1caa49[_0xda7a('0x1f')]],'as':_0x1caa49['as'],'attributes':_0x1caa49[_0xda7a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xda7a('0x20')](function(_0x493ad8){logger[_0xda7a('0xd')]('GetDeskAccount',_0x511fe0);logger['debug'](_0xda7a('0x16'),_0x511fe0,JSON[_0xda7a('0x12')](_0x493ad8));_0x5a6d1c(_0x493ad8);})[_0xda7a('0x15')](function(_0x2bd45b){logger[_0xda7a('0x13')](_0xda7a('0x16'),_0x2bd45b[_0xda7a('0x14')],_0x511fe0);_0x4f68af(_0x126883[_0xda7a('0x13')](0x1f4,_0x2bd45b[_0xda7a('0x14')]));});});};exports[_0xda7a('0x21')]=function(_0x26a2b3){var _0x5c5496=this;return new Promise(function(_0x574d58,_0x9b58a7){return db[_0xda7a('0x17')][_0xda7a('0x22')]({'raw':_0x26a2b3[_0xda7a('0x19')]?_0x26a2b3[_0xda7a('0x19')][_0xda7a('0x1a')]===undefined?!![]:![]:!![],'where':_0x26a2b3[_0xda7a('0x19')]?_0x26a2b3[_0xda7a('0x19')][_0xda7a('0x1b')]||null:null,'attributes':_0x26a2b3[_0xda7a('0x19')]?_0x26a2b3[_0xda7a('0x19')][_0xda7a('0x1c')]||null:null,'include':_0x26a2b3['options']?_0x26a2b3[_0xda7a('0x19')][_0xda7a('0x1d')]?_[_0xda7a('0x1e')](_0x26a2b3[_0xda7a('0x19')][_0xda7a('0x1d')],function(_0x1a531c){return{'model':db[_0x1a531c['model']],'as':_0x1a531c['as'],'attributes':_0x1a531c[_0xda7a('0x1c')],'include':_0x1a531c[_0xda7a('0x1d')]?_['map'](_0x1a531c[_0xda7a('0x1d')],function(_0xb761d0){return{'model':db[_0xb761d0['model']],'as':_0xb761d0['as'],'attributes':_0xb761d0[_0xda7a('0x1c')],'include':_0xb761d0['include']?_[_0xda7a('0x1e')](_0xb761d0[_0xda7a('0x1d')],function(_0x598c2c){return{'model':db[_0x598c2c[_0xda7a('0x1f')]],'as':_0x598c2c['as'],'attributes':_0x598c2c[_0xda7a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xda7a('0x20')](function(_0x37ea28){logger[_0xda7a('0xd')](_0xda7a('0x21'),_0x26a2b3);logger[_0xda7a('0xf')](_0xda7a('0x21'),_0x26a2b3,JSON['stringify'](_0x37ea28));_0x574d58(_0x37ea28);})['catch'](function(_0x14c2da){logger[_0xda7a('0x13')](_0xda7a('0x21'),_0x14c2da['message'],_0x26a2b3);_0x9b58a7(_0x5c5496['error'](0x1f4,_0x14c2da[_0xda7a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 16e5064..4de5a5e 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x139f9e,_0x1aa88d){var _0x4ced44=function(_0x4eecbf){while(--_0x4eecbf){_0x139f9e['push'](_0x139f9e['shift']());}};_0x4ced44(++_0x1aa88d);}(_0x008c,0x188));var _0xc008=function(_0xb2320d,_0xe69d49){_0xb2320d=_0xb2320d-0x0;var _0x9db91a=_0x008c[_0xb2320d];return _0x9db91a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x3e7bb5,_0x534483){var _0x38f46f=function(_0xf47a81){while(--_0xf47a81){_0x3e7bb5['push'](_0x3e7bb5['shift']());}};_0x38f46f(++_0x534483);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index aaaf9ee..059aab3 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 _0xbdee=['sequelize','exports','STRING'];(function(_0x27ab58,_0x48c638){var _0x3daff0=function(_0x7e2522){while(--_0x7e2522){_0x27ab58['push'](_0x27ab58['shift']());}};_0x3daff0(++_0x48c638);}(_0xbdee,0x1b0));var _0xebde=function(_0x15fdcc,_0x245a0a){_0x15fdcc=_0x15fdcc-0x0;var _0x5803d6=_0xbdee[_0x15fdcc];return _0x5803d6;};'use strict';var Sequelize=require(_0xebde('0x0'));module[_0xebde('0x1')]={'name':{'type':Sequelize[_0xebde('0x2')]},'description':{'type':Sequelize[_0xebde('0x2')]}}; \ No newline at end of file +var _0x6de9=['STRING'];(function(_0x553579,_0x269bd9){var _0x156ea3=function(_0x3bd6bb){while(--_0x3bd6bb){_0x553579['push'](_0x553579['shift']());}};_0x156ea3(++_0x269bd9);}(_0x6de9,0x18a));var _0x96de=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6de9[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x96de('0x0')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 2f7ad33..b448936 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 _0x1697=['end','json','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','DeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x1697,0x1ca));var _0x7169=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x1697[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x7169('0x0'));var rimraf=require(_0x7169('0x1'));var zipdir=require(_0x7169('0x2'));var jsonpatch=require(_0x7169('0x3'));var rp=require(_0x7169('0x4'));var moment=require(_0x7169('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7169('0x6'));var util=require(_0x7169('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7169('0x8'));var fs=require('fs');var fs_extra=require(_0x7169('0x9'));var _=require(_0x7169('0xa'));var squel=require('squel');var crypto=require(_0x7169('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7169('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7169('0xd'));var Redis=require('ioredis');var authService=require(_0x7169('0xe'));var qs=require(_0x7169('0xf'));var as=require(_0x7169('0x10'));var hardwareService=require(_0x7169('0x11'));var logger=require('../../config/logger')(_0x7169('0x12'));var utils=require(_0x7169('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52778e,_0x44fc03){_0x44fc03=_0x44fc03||0xcc;return function(_0x526004){if(_0x526004){return _0x52778e[_0x7169('0x14')](_0x44fc03);}return _0x52778e[_0x7169('0x15')](_0x44fc03)[_0x7169('0x16')]();};}function respondWithResult(_0x33d8d9,_0x2d7b47){_0x2d7b47=_0x2d7b47||0xc8;return function(_0x4eaa94){if(_0x4eaa94){return _0x33d8d9[_0x7169('0x15')](_0x2d7b47)[_0x7169('0x17')](_0x4eaa94);}};}function respondWithFilteredResult(_0x4d088a,_0x1d2f54){return function(_0x5c23cd){if(_0x5c23cd){var _0x406045=typeof _0x1d2f54['offset']===_0x7169('0x18')&&typeof _0x1d2f54['limit']===_0x7169('0x18');var _0x173d0f=_0x5c23cd[_0x7169('0x19')];var _0x2f6b7d=_0x406045?0x0:_0x1d2f54[_0x7169('0x1a')];var _0x575971=_0x406045?_0x5c23cd[_0x7169('0x19')]:_0x1d2f54[_0x7169('0x1a')]+_0x1d2f54['limit'];var _0x302aa3;if(_0x575971>=_0x173d0f){_0x575971=_0x173d0f;_0x302aa3=0xc8;}else{_0x302aa3=0xce;}_0x4d088a['status'](_0x302aa3);return _0x4d088a[_0x7169('0x1b')](_0x7169('0x1c'),_0x2f6b7d+'-'+_0x575971+'/'+_0x173d0f)[_0x7169('0x17')](_0x5c23cd);}return null;};}function patchUpdates(_0x50463f){return function(_0x55df9b){try{jsonpatch['apply'](_0x55df9b,_0x50463f,!![]);}catch(_0x3d0c4f){return BPromise[_0x7169('0x1d')](_0x3d0c4f);}return _0x55df9b[_0x7169('0x1e')]();};}function saveUpdates(_0x5a27c1,_0xc39b45){return function(_0x30de9e){if(_0x30de9e){return _0x30de9e[_0x7169('0x1f')](_0x5a27c1)[_0x7169('0x20')](function(_0x115bec){return _0x115bec;});}return null;};}function removeEntity(_0x1b543d,_0x2dced4){return function(_0x5cda05){if(_0x5cda05){return _0x5cda05[_0x7169('0x21')]()[_0x7169('0x20')](function(){_0x1b543d[_0x7169('0x15')](0xcc)[_0x7169('0x16')]();});}};}function handleEntityNotFound(_0x59d7a6,_0x4cf3a6){return function(_0x5bbef4){if(!_0x5bbef4){_0x59d7a6['sendStatus'](0x194);}return _0x5bbef4;};}function handleError(_0x500b7b,_0x8af228){_0x8af228=_0x8af228||0x1f4;return function(_0x350066){logger[_0x7169('0x22')](_0x350066[_0x7169('0x23')]);if(_0x350066[_0x7169('0x24')]){delete _0x350066[_0x7169('0x24')];}_0x500b7b[_0x7169('0x15')](_0x8af228)['send'](_0x350066);};}exports[_0x7169('0x25')]=function(_0x4dccdb,_0x491db5){var _0x2d032={},_0x4ff411={},_0x20e59c={'count':0x0,'rows':[]};var _0x55311c=_[_0x7169('0x26')](db['DeskConfiguration']['rawAttributes'],function(_0x20c546){return{'name':_0x20c546[_0x7169('0x27')],'type':_0x20c546['type'][_0x7169('0x28')]};});_0x4ff411[_0x7169('0x29')]=_[_0x7169('0x26')](_0x55311c,_0x7169('0x24'));_0x4ff411[_0x7169('0x2a')]=_[_0x7169('0x2b')](_0x4dccdb[_0x7169('0x2a')]);_0x4ff411[_0x7169('0x2c')]=_[_0x7169('0x2d')](_0x4ff411[_0x7169('0x29')],_0x4ff411[_0x7169('0x2a')]);_0x2d032[_0x7169('0x2e')]=_[_0x7169('0x2d')](_0x4ff411['model'],qs[_0x7169('0x2f')](_0x4dccdb[_0x7169('0x2a')][_0x7169('0x2f')]));_0x2d032[_0x7169('0x2e')]=_0x2d032[_0x7169('0x2e')][_0x7169('0x30')]?_0x2d032[_0x7169('0x2e')]:_0x4ff411[_0x7169('0x29')];if(!_0x4dccdb[_0x7169('0x2a')]['hasOwnProperty'](_0x7169('0x31'))){_0x2d032[_0x7169('0x32')]=qs['limit'](_0x4dccdb[_0x7169('0x2a')][_0x7169('0x32')]);_0x2d032['offset']=qs['offset'](_0x4dccdb[_0x7169('0x2a')][_0x7169('0x1a')]);}_0x2d032[_0x7169('0x33')]=qs['sort'](_0x4dccdb[_0x7169('0x2a')][_0x7169('0x34')]);_0x2d032['where']=qs[_0x7169('0x2c')](_[_0x7169('0x35')](_0x4dccdb[_0x7169('0x2a')],_0x4ff411['filters']),_0x55311c);if(_0x4dccdb[_0x7169('0x2a')][_0x7169('0x36')]){_0x2d032[_0x7169('0x37')]=_[_0x7169('0x38')](_0x2d032[_0x7169('0x37')],{'$or':_[_0x7169('0x26')](_0x55311c,function(_0x2fa958){if(_0x2fa958['type']!==_0x7169('0x39')){var _0x1c08cb={};_0x1c08cb[_0x2fa958[_0x7169('0x24')]]={'$like':'%'+_0x4dccdb[_0x7169('0x2a')]['filter']+'%'};return _0x1c08cb;}})});}_0x2d032=_[_0x7169('0x38')]({},_0x2d032,_0x4dccdb[_0x7169('0x3a')]);var _0xcffa33={'where':_0x2d032[_0x7169('0x37')]};return db[_0x7169('0x3b')][_0x7169('0x19')](_0xcffa33)['then'](function(_0x3e1a1c){_0x20e59c[_0x7169('0x19')]=_0x3e1a1c;if(_0x4dccdb['query'][_0x7169('0x3c')]){_0x2d032[_0x7169('0x3d')]=[{'all':!![]}];}return db[_0x7169('0x3b')][_0x7169('0x3e')](_0x2d032);})[_0x7169('0x20')](function(_0x39ec21){_0x20e59c[_0x7169('0x3f')]=_0x39ec21;return _0x20e59c;})['then'](respondWithFilteredResult(_0x491db5,_0x2d032))[_0x7169('0x40')](handleError(_0x491db5,null));};exports[_0x7169('0x41')]=function(_0x385e5f,_0x295c50){var _0x5c120f={'raw':![],'where':{'id':_0x385e5f[_0x7169('0x42')]['id']}},_0x3f4e1c={};_0x3f4e1c[_0x7169('0x29')]=_[_0x7169('0x2b')](db[_0x7169('0x3b')][_0x7169('0x43')]);_0x3f4e1c['query']=_['keys'](_0x385e5f[_0x7169('0x2a')]);_0x3f4e1c[_0x7169('0x2c')]=_[_0x7169('0x2d')](_0x3f4e1c[_0x7169('0x29')],_0x3f4e1c[_0x7169('0x2a')]);_0x5c120f[_0x7169('0x2e')]=_[_0x7169('0x2d')](_0x3f4e1c[_0x7169('0x29')],qs[_0x7169('0x2f')](_0x385e5f[_0x7169('0x2a')][_0x7169('0x2f')]));_0x5c120f[_0x7169('0x2e')]=_0x5c120f['attributes'][_0x7169('0x30')]?_0x5c120f[_0x7169('0x2e')]:_0x3f4e1c[_0x7169('0x29')];if(_0x385e5f[_0x7169('0x2a')][_0x7169('0x3c')]){_0x5c120f[_0x7169('0x3d')]=[{'all':!![]}];}_0x5c120f=_[_0x7169('0x38')]({},_0x5c120f,_0x385e5f[_0x7169('0x3a')]);return db['DeskConfiguration'][_0x7169('0x44')](_0x5c120f)[_0x7169('0x20')](handleEntityNotFound(_0x295c50,null))['then'](respondWithResult(_0x295c50,null))[_0x7169('0x40')](handleError(_0x295c50,null));};exports[_0x7169('0x45')]=function(_0x497683,_0x2912d4){return db[_0x7169('0x3b')][_0x7169('0x45')](_0x497683[_0x7169('0x46')],{})[_0x7169('0x20')](respondWithResult(_0x2912d4,0xc9))[_0x7169('0x40')](handleError(_0x2912d4,null));};exports[_0x7169('0x1f')]=function(_0x18a154,_0x563c46){if(_0x18a154[_0x7169('0x46')]['id']){delete _0x18a154[_0x7169('0x46')]['id'];}return db['DeskConfiguration'][_0x7169('0x44')]({'where':{'id':_0x18a154['params']['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x563c46,null))[_0x7169('0x20')](saveUpdates(_0x18a154[_0x7169('0x46')],null))[_0x7169('0x20')](respondWithResult(_0x563c46,null))['catch'](handleError(_0x563c46,null));};exports['destroy']=function(_0x2abf66,_0x2acfc3){return db[_0x7169('0x3b')][_0x7169('0x44')]({'where':{'id':_0x2abf66[_0x7169('0x42')]['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x2acfc3,null))[_0x7169('0x20')](removeEntity(_0x2acfc3,null))[_0x7169('0x40')](handleError(_0x2acfc3,null));};exports[_0x7169('0x47')]=function(_0x38e193,_0x25f64d,_0x207f7b){var _0x3ee80c={};var _0x141f5e={};var _0x580cd7;var _0x154b75;return db[_0x7169('0x3b')][_0x7169('0x48')]({'where':{'id':_0x38e193[_0x7169('0x42')]['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x25f64d,null))[_0x7169('0x20')](function(_0x2a70ab){if(_0x2a70ab){_0x580cd7=_0x2a70ab;_0x141f5e[_0x7169('0x29')]=_[_0x7169('0x2b')](db[_0x7169('0x49')][_0x7169('0x43')]);_0x141f5e['query']=_[_0x7169('0x2b')](_0x38e193[_0x7169('0x2a')]);_0x141f5e[_0x7169('0x2c')]=_[_0x7169('0x2d')](_0x141f5e[_0x7169('0x29')],_0x141f5e[_0x7169('0x2a')]);_0x3ee80c[_0x7169('0x2e')]=_[_0x7169('0x2d')](_0x141f5e['model'],qs[_0x7169('0x2f')](_0x38e193[_0x7169('0x2a')][_0x7169('0x2f')]));_0x3ee80c['attributes']=_0x3ee80c[_0x7169('0x2e')][_0x7169('0x30')]?_0x3ee80c[_0x7169('0x2e')]:_0x141f5e[_0x7169('0x29')];_0x3ee80c[_0x7169('0x33')]=qs[_0x7169('0x34')](_0x38e193[_0x7169('0x2a')][_0x7169('0x34')]);_0x3ee80c[_0x7169('0x37')]=qs[_0x7169('0x2c')](_[_0x7169('0x35')](_0x38e193['query'],_0x141f5e[_0x7169('0x2c')]));if(_0x38e193[_0x7169('0x2a')][_0x7169('0x36')]){_0x3ee80c['where']=_['merge'](_0x3ee80c[_0x7169('0x37')],{'$or':_[_0x7169('0x26')](_0x3ee80c[_0x7169('0x2e')],function(_0x4c38bc){var _0x26f828={};_0x26f828[_0x4c38bc]={'$like':'%'+_0x38e193[_0x7169('0x2a')][_0x7169('0x36')]+'%'};return _0x26f828;})});}_0x3ee80c=_[_0x7169('0x38')]({},_0x3ee80c,_0x38e193[_0x7169('0x3a')]);return _0x580cd7['getFields'](_0x3ee80c);}})[_0x7169('0x20')](function(_0x1f872d){if(_0x1f872d){_0x154b75=_0x1f872d[_0x7169('0x30')];if(!_0x38e193[_0x7169('0x2a')][_0x7169('0x4a')](_0x7169('0x31'))){_0x3ee80c[_0x7169('0x32')]=qs[_0x7169('0x32')](_0x38e193['query']['limit']);_0x3ee80c[_0x7169('0x1a')]=qs[_0x7169('0x1a')](_0x38e193[_0x7169('0x2a')][_0x7169('0x1a')]);}return _0x580cd7['getFields'](_0x3ee80c);}})[_0x7169('0x20')](function(_0x4de4e8){if(_0x4de4e8){return _0x4de4e8?{'count':_0x154b75,'rows':_0x4de4e8}:null;}})['then'](respondWithResult(_0x25f64d,null))['catch'](handleError(_0x25f64d,null));};exports[_0x7169('0x4b')]=function(_0x27d644,_0x3e47ec,_0x42161c){var _0x3b7d6f={};var _0x4d9dd7={};var _0xf4ff05;var _0x122362;return db[_0x7169('0x3b')][_0x7169('0x48')]({'where':{'id':_0x27d644[_0x7169('0x42')]['id']}})['then'](handleEntityNotFound(_0x3e47ec,null))[_0x7169('0x20')](function(_0x44b759){if(_0x44b759){_0xf4ff05=_0x44b759;_0x4d9dd7[_0x7169('0x29')]=_[_0x7169('0x2b')](db[_0x7169('0x49')][_0x7169('0x43')]);_0x4d9dd7['query']=_[_0x7169('0x2b')](_0x27d644[_0x7169('0x2a')]);_0x4d9dd7[_0x7169('0x2c')]=_[_0x7169('0x2d')](_0x4d9dd7[_0x7169('0x29')],_0x4d9dd7[_0x7169('0x2a')]);_0x3b7d6f[_0x7169('0x2e')]=_[_0x7169('0x2d')](_0x4d9dd7[_0x7169('0x29')],qs['fields'](_0x27d644[_0x7169('0x2a')][_0x7169('0x2f')]));_0x3b7d6f[_0x7169('0x2e')]=_0x3b7d6f[_0x7169('0x2e')][_0x7169('0x30')]?_0x3b7d6f[_0x7169('0x2e')]:_0x4d9dd7[_0x7169('0x29')];_0x3b7d6f[_0x7169('0x33')]=qs[_0x7169('0x34')](_0x27d644[_0x7169('0x2a')][_0x7169('0x34')]);_0x3b7d6f[_0x7169('0x37')]=qs[_0x7169('0x2c')](_[_0x7169('0x35')](_0x27d644[_0x7169('0x2a')],_0x4d9dd7[_0x7169('0x2c')]));if(_0x27d644[_0x7169('0x2a')][_0x7169('0x36')]){_0x3b7d6f[_0x7169('0x37')]=_[_0x7169('0x38')](_0x3b7d6f[_0x7169('0x37')],{'$or':_[_0x7169('0x26')](_0x3b7d6f[_0x7169('0x2e')],function(_0x3793f5){var _0x542ec6={};_0x542ec6[_0x3793f5]={'$like':'%'+_0x27d644[_0x7169('0x2a')]['filter']+'%'};return _0x542ec6;})});}_0x3b7d6f=_[_0x7169('0x38')]({},_0x3b7d6f,_0x27d644[_0x7169('0x3a')]);return _0xf4ff05['getSubjects'](_0x3b7d6f);}})[_0x7169('0x20')](function(_0x3369f3){if(_0x3369f3){_0x122362=_0x3369f3[_0x7169('0x30')];if(!_0x27d644[_0x7169('0x2a')]['hasOwnProperty'](_0x7169('0x31'))){_0x3b7d6f['limit']=qs[_0x7169('0x32')](_0x27d644[_0x7169('0x2a')][_0x7169('0x32')]);_0x3b7d6f['offset']=qs[_0x7169('0x1a')](_0x27d644['query'][_0x7169('0x1a')]);}return _0xf4ff05[_0x7169('0x4b')](_0x3b7d6f);}})[_0x7169('0x20')](function(_0x29da68){if(_0x29da68){return _0x29da68?{'count':_0x122362,'rows':_0x29da68}:null;}})[_0x7169('0x20')](respondWithResult(_0x3e47ec,null))[_0x7169('0x40')](handleError(_0x3e47ec,null));};exports[_0x7169('0x4c')]=function(_0x3a844b,_0x137736,_0x39a101){var _0x48fb5d={};var _0xffedf4={};var _0x52eab9;var _0x5a83eb;return db['DeskConfiguration'][_0x7169('0x48')]({'where':{'id':_0x3a844b[_0x7169('0x42')]['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x137736,null))[_0x7169('0x20')](function(_0x4341c7){if(_0x4341c7){_0x52eab9=_0x4341c7;_0xffedf4['model']=_[_0x7169('0x2b')](db[_0x7169('0x49')][_0x7169('0x43')]);_0xffedf4[_0x7169('0x2a')]=_['keys'](_0x3a844b[_0x7169('0x2a')]);_0xffedf4[_0x7169('0x2c')]=_[_0x7169('0x2d')](_0xffedf4[_0x7169('0x29')],_0xffedf4[_0x7169('0x2a')]);_0x48fb5d[_0x7169('0x2e')]=_['intersection'](_0xffedf4[_0x7169('0x29')],qs[_0x7169('0x2f')](_0x3a844b[_0x7169('0x2a')][_0x7169('0x2f')]));_0x48fb5d[_0x7169('0x2e')]=_0x48fb5d['attributes'][_0x7169('0x30')]?_0x48fb5d[_0x7169('0x2e')]:_0xffedf4[_0x7169('0x29')];_0x48fb5d[_0x7169('0x33')]=qs[_0x7169('0x34')](_0x3a844b['query']['sort']);_0x48fb5d[_0x7169('0x37')]=qs['filters'](_[_0x7169('0x35')](_0x3a844b['query'],_0xffedf4[_0x7169('0x2c')]));if(_0x3a844b[_0x7169('0x2a')][_0x7169('0x36')]){_0x48fb5d['where']=_[_0x7169('0x38')](_0x48fb5d['where'],{'$or':_['map'](_0x48fb5d[_0x7169('0x2e')],function(_0x2bb5a1){var _0x527c50={};_0x527c50[_0x2bb5a1]={'$like':'%'+_0x3a844b['query']['filter']+'%'};return _0x527c50;})});}_0x48fb5d=_[_0x7169('0x38')]({},_0x48fb5d,_0x3a844b[_0x7169('0x3a')]);return _0x52eab9[_0x7169('0x4c')](_0x48fb5d);}})[_0x7169('0x20')](function(_0x50f308){if(_0x50f308){_0x5a83eb=_0x50f308[_0x7169('0x30')];if(!_0x3a844b[_0x7169('0x2a')][_0x7169('0x4a')](_0x7169('0x31'))){_0x48fb5d[_0x7169('0x32')]=qs['limit'](_0x3a844b[_0x7169('0x2a')][_0x7169('0x32')]);_0x48fb5d[_0x7169('0x1a')]=qs[_0x7169('0x1a')](_0x3a844b['query'][_0x7169('0x1a')]);}return _0x52eab9[_0x7169('0x4c')](_0x48fb5d);}})['then'](function(_0x23de05){if(_0x23de05){return _0x23de05?{'count':_0x5a83eb,'rows':_0x23de05}:null;}})[_0x7169('0x20')](respondWithResult(_0x137736,null))[_0x7169('0x40')](handleError(_0x137736,null));};exports[_0x7169('0x4d')]=function(_0x320f58,_0x2454cd,_0x540c5d){var _0x1e6b08={};var _0xe19c27={};var _0x327c8e;var _0x47e48f;return db[_0x7169('0x3b')]['findOne']({'where':{'id':_0x320f58[_0x7169('0x42')]['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x2454cd,null))[_0x7169('0x20')](function(_0x239a82){if(_0x239a82){_0x327c8e=_0x239a82;_0xe19c27[_0x7169('0x29')]=_[_0x7169('0x2b')](db[_0x7169('0x4e')][_0x7169('0x43')]);_0xe19c27[_0x7169('0x2a')]=_['keys'](_0x320f58[_0x7169('0x2a')]);_0xe19c27[_0x7169('0x2c')]=_['intersection'](_0xe19c27['model'],_0xe19c27[_0x7169('0x2a')]);_0x1e6b08[_0x7169('0x2e')]=_['intersection'](_0xe19c27['model'],qs['fields'](_0x320f58['query'][_0x7169('0x2f')]));_0x1e6b08['attributes']=_0x1e6b08[_0x7169('0x2e')]['length']?_0x1e6b08['attributes']:_0xe19c27[_0x7169('0x29')];_0x1e6b08[_0x7169('0x33')]=qs['sort'](_0x320f58[_0x7169('0x2a')][_0x7169('0x34')]);_0x1e6b08[_0x7169('0x37')]=qs[_0x7169('0x2c')](_['pick'](_0x320f58[_0x7169('0x2a')],_0xe19c27[_0x7169('0x2c')]));if(_0x320f58[_0x7169('0x2a')][_0x7169('0x36')]){_0x1e6b08[_0x7169('0x37')]=_[_0x7169('0x38')](_0x1e6b08[_0x7169('0x37')],{'$or':_[_0x7169('0x26')](_0x1e6b08[_0x7169('0x2e')],function(_0x480345){var _0x4967da={};_0x4967da[_0x480345]={'$like':'%'+_0x320f58[_0x7169('0x2a')][_0x7169('0x36')]+'%'};return _0x4967da;})});}_0x1e6b08=_[_0x7169('0x38')]({},_0x1e6b08,_0x320f58[_0x7169('0x3a')]);return _0x327c8e[_0x7169('0x4d')](_0x1e6b08);}})[_0x7169('0x20')](function(_0xbd05ec){if(_0xbd05ec){_0x47e48f=_0xbd05ec['length'];if(!_0x320f58[_0x7169('0x2a')][_0x7169('0x4a')](_0x7169('0x31'))){_0x1e6b08[_0x7169('0x32')]=qs[_0x7169('0x32')](_0x320f58['query'][_0x7169('0x32')]);_0x1e6b08[_0x7169('0x1a')]=qs[_0x7169('0x1a')](_0x320f58[_0x7169('0x2a')]['offset']);}return _0x327c8e['getTags'](_0x1e6b08);}})[_0x7169('0x20')](function(_0x5587fb){if(_0x5587fb){return _0x5587fb?{'count':_0x47e48f,'rows':_0x5587fb}:null;}})['then'](respondWithResult(_0x2454cd,null))['catch'](handleError(_0x2454cd,null));};exports[_0x7169('0x4f')]=function(_0xe412be,_0x1f6029,_0x8fbef){if(_0xe412be[_0x7169('0x46')]['id']){delete _0xe412be[_0x7169('0x46')]['id'];}return db[_0x7169('0x3b')][_0x7169('0x48')]({'where':{'id':_0xe412be[_0x7169('0x42')]['id']}})[_0x7169('0x20')](handleEntityNotFound(_0x1f6029,null))[_0x7169('0x20')](function(_0x4dc607){if(_0x4dc607){return _0x4dc607[_0x7169('0x4f')](_0xe412be['body']['ids']||[]);}return null;})[_0x7169('0x20')](respondWithResult(_0x1f6029,null))[_0x7169('0x40')](handleError(_0x1f6029,null));}; \ No newline at end of file +var _0x21ef=['getSubjects','getDescriptions','getTags','setTags','ids','eml-format','request-promise','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject','save','then','destroy','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','rows','catch','params','include','create','body','find','getFields','findOne','DeskField'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x21ef,0x195));var _0xf21e=function(_0x5c8bb0,_0x213640){_0x5c8bb0=_0x5c8bb0-0x0;var _0x42e711=_0x21ef[_0x5c8bb0];return _0x42e711;};'use strict';var emlformat=require(_0xf21e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf21e('0x1'));var moment=require('moment');var BPromise=require(_0xf21e('0x2'));var Mustache=require(_0xf21e('0x3'));var util=require(_0xf21e('0x4'));var path=require(_0xf21e('0x5'));var sox=require(_0xf21e('0x6'));var csv=require(_0xf21e('0x7'));var ejs=require(_0xf21e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf21e('0x9'));var squel=require(_0xf21e('0xa'));var crypto=require(_0xf21e('0xb'));var jsforce=require(_0xf21e('0xc'));var deskjs=require(_0xf21e('0xd'));var toCsv=require(_0xf21e('0x7'));var querystring=require(_0xf21e('0xe'));var Papa=require('papaparse');var Redis=require(_0xf21e('0xf'));var authService=require(_0xf21e('0x10'));var qs=require(_0xf21e('0x11'));var as=require(_0xf21e('0x12'));var hardwareService=require(_0xf21e('0x13'));var logger=require(_0xf21e('0x14'))(_0xf21e('0x15'));var utils=require('../../config/utils');var config=require(_0xf21e('0x16'));var licenseUtil=require(_0xf21e('0x17'));var db=require(_0xf21e('0x18'))['db'];function respondWithStatusCode(_0x4f2e9a,_0x561261){_0x561261=_0x561261||0xcc;return function(_0x1baf35){if(_0x1baf35){return _0x4f2e9a[_0xf21e('0x19')](_0x561261);}return _0x4f2e9a[_0xf21e('0x1a')](_0x561261)[_0xf21e('0x1b')]();};}function respondWithResult(_0x3547e9,_0xb79c5){_0xb79c5=_0xb79c5||0xc8;return function(_0x1a71a0){if(_0x1a71a0){return _0x3547e9[_0xf21e('0x1a')](_0xb79c5)[_0xf21e('0x1c')](_0x1a71a0);}};}function respondWithFilteredResult(_0x48144f,_0x28070d){return function(_0x5dbd6c){if(_0x5dbd6c){var _0x158f81=typeof _0x28070d['offset']==='undefined'&&typeof _0x28070d['limit']===_0xf21e('0x1d');var _0x55abb2=_0x5dbd6c[_0xf21e('0x1e')];var _0x4e72f3=_0x158f81?0x0:_0x28070d[_0xf21e('0x1f')];var _0x167dbf=_0x158f81?_0x5dbd6c[_0xf21e('0x1e')]:_0x28070d[_0xf21e('0x1f')]+_0x28070d[_0xf21e('0x20')];var _0x549bbb;if(_0x167dbf>=_0x55abb2){_0x167dbf=_0x55abb2;_0x549bbb=0xc8;}else{_0x549bbb=0xce;}_0x48144f[_0xf21e('0x1a')](_0x549bbb);return _0x48144f['set']('Content-Range',_0x4e72f3+'-'+_0x167dbf+'/'+_0x55abb2)[_0xf21e('0x1c')](_0x5dbd6c);}return null;};}function patchUpdates(_0x418ab3){return function(_0x3ec521){try{jsonpatch[_0xf21e('0x21')](_0x3ec521,_0x418ab3,!![]);}catch(_0x588624){return BPromise[_0xf21e('0x22')](_0x588624);}return _0x3ec521[_0xf21e('0x23')]();};}function saveUpdates(_0x3747e8,_0x4fd903){return function(_0x2bcc09){if(_0x2bcc09){return _0x2bcc09['update'](_0x3747e8)[_0xf21e('0x24')](function(_0x1f4728){return _0x1f4728;});}return null;};}function removeEntity(_0x57971f,_0x1a1865){return function(_0x1cf88d){if(_0x1cf88d){return _0x1cf88d[_0xf21e('0x25')]()['then'](function(){_0x57971f[_0xf21e('0x1a')](0xcc)[_0xf21e('0x1b')]();});}};}function handleEntityNotFound(_0xdaee7f,_0x264062){return function(_0x3e9d37){if(!_0x3e9d37){_0xdaee7f[_0xf21e('0x19')](0x194);}return _0x3e9d37;};}function handleError(_0x54e4f6,_0x34fbdb){_0x34fbdb=_0x34fbdb||0x1f4;return function(_0x559801){logger['error'](_0x559801[_0xf21e('0x26')]);if(_0x559801['name']){delete _0x559801[_0xf21e('0x27')];}_0x54e4f6[_0xf21e('0x1a')](_0x34fbdb)['send'](_0x559801);};}exports[_0xf21e('0x28')]=function(_0x4e5c80,_0x555871){var _0x25738f={},_0x70a2c1={},_0x184233={'count':0x0,'rows':[]};var _0x876908=_[_0xf21e('0x29')](db[_0xf21e('0x2a')][_0xf21e('0x2b')],function(_0x15b4cb){return{'name':_0x15b4cb[_0xf21e('0x2c')],'type':_0x15b4cb[_0xf21e('0x2d')][_0xf21e('0x2e')]};});_0x70a2c1['model']=_[_0xf21e('0x29')](_0x876908,_0xf21e('0x27'));_0x70a2c1[_0xf21e('0x2f')]=_[_0xf21e('0x30')](_0x4e5c80['query']);_0x70a2c1[_0xf21e('0x31')]=_['intersection'](_0x70a2c1[_0xf21e('0x32')],_0x70a2c1[_0xf21e('0x2f')]);_0x25738f['attributes']=_[_0xf21e('0x33')](_0x70a2c1[_0xf21e('0x32')],qs[_0xf21e('0x34')](_0x4e5c80[_0xf21e('0x2f')]['fields']));_0x25738f[_0xf21e('0x35')]=_0x25738f[_0xf21e('0x35')][_0xf21e('0x36')]?_0x25738f[_0xf21e('0x35')]:_0x70a2c1[_0xf21e('0x32')];if(!_0x4e5c80['query'][_0xf21e('0x37')](_0xf21e('0x38'))){_0x25738f[_0xf21e('0x20')]=qs[_0xf21e('0x20')](_0x4e5c80[_0xf21e('0x2f')]['limit']);_0x25738f[_0xf21e('0x1f')]=qs['offset'](_0x4e5c80['query'][_0xf21e('0x1f')]);}_0x25738f[_0xf21e('0x39')]=qs[_0xf21e('0x3a')](_0x4e5c80[_0xf21e('0x2f')][_0xf21e('0x3a')]);_0x25738f[_0xf21e('0x3b')]=qs[_0xf21e('0x31')](_[_0xf21e('0x3c')](_0x4e5c80[_0xf21e('0x2f')],_0x70a2c1[_0xf21e('0x31')]),_0x876908);if(_0x4e5c80[_0xf21e('0x2f')][_0xf21e('0x3d')]){_0x25738f[_0xf21e('0x3b')]=_[_0xf21e('0x3e')](_0x25738f[_0xf21e('0x3b')],{'$or':_[_0xf21e('0x29')](_0x876908,function(_0x569b68){if(_0x569b68[_0xf21e('0x2d')]!=='VIRTUAL'){var _0x93c3e0={};_0x93c3e0[_0x569b68[_0xf21e('0x27')]]={'$like':'%'+_0x4e5c80[_0xf21e('0x2f')][_0xf21e('0x3d')]+'%'};return _0x93c3e0;}})});}_0x25738f=_[_0xf21e('0x3e')]({},_0x25738f,_0x4e5c80[_0xf21e('0x3f')]);var _0x317ccc={'where':_0x25738f[_0xf21e('0x3b')]};return db[_0xf21e('0x2a')][_0xf21e('0x1e')](_0x317ccc)[_0xf21e('0x24')](function(_0x5c9038){_0x184233[_0xf21e('0x1e')]=_0x5c9038;if(_0x4e5c80[_0xf21e('0x2f')][_0xf21e('0x40')]){_0x25738f['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x25738f);})[_0xf21e('0x24')](function(_0x38118d){_0x184233[_0xf21e('0x41')]=_0x38118d;return _0x184233;})[_0xf21e('0x24')](respondWithFilteredResult(_0x555871,_0x25738f))[_0xf21e('0x42')](handleError(_0x555871,null));};exports['show']=function(_0x1fdb0d,_0x94ab5c){var _0x149a53={'raw':![],'where':{'id':_0x1fdb0d[_0xf21e('0x43')]['id']}},_0x4b90c0={};_0x4b90c0[_0xf21e('0x32')]=_['keys'](db[_0xf21e('0x2a')][_0xf21e('0x2b')]);_0x4b90c0[_0xf21e('0x2f')]=_[_0xf21e('0x30')](_0x1fdb0d[_0xf21e('0x2f')]);_0x4b90c0[_0xf21e('0x31')]=_[_0xf21e('0x33')](_0x4b90c0[_0xf21e('0x32')],_0x4b90c0[_0xf21e('0x2f')]);_0x149a53[_0xf21e('0x35')]=_[_0xf21e('0x33')](_0x4b90c0[_0xf21e('0x32')],qs[_0xf21e('0x34')](_0x1fdb0d[_0xf21e('0x2f')][_0xf21e('0x34')]));_0x149a53[_0xf21e('0x35')]=_0x149a53[_0xf21e('0x35')]['length']?_0x149a53[_0xf21e('0x35')]:_0x4b90c0['model'];if(_0x1fdb0d[_0xf21e('0x2f')][_0xf21e('0x40')]){_0x149a53[_0xf21e('0x44')]=[{'all':!![]}];}_0x149a53=_['merge']({},_0x149a53,_0x1fdb0d[_0xf21e('0x3f')]);return db[_0xf21e('0x2a')]['find'](_0x149a53)[_0xf21e('0x24')](handleEntityNotFound(_0x94ab5c,null))['then'](respondWithResult(_0x94ab5c,null))[_0xf21e('0x42')](handleError(_0x94ab5c,null));};exports[_0xf21e('0x45')]=function(_0x5dea71,_0x29b1d3){return db[_0xf21e('0x2a')][_0xf21e('0x45')](_0x5dea71[_0xf21e('0x46')],{})[_0xf21e('0x24')](respondWithResult(_0x29b1d3,0xc9))[_0xf21e('0x42')](handleError(_0x29b1d3,null));};exports['update']=function(_0x94a05,_0x36df27){if(_0x94a05['body']['id']){delete _0x94a05[_0xf21e('0x46')]['id'];}return db[_0xf21e('0x2a')][_0xf21e('0x47')]({'where':{'id':_0x94a05[_0xf21e('0x43')]['id']}})['then'](handleEntityNotFound(_0x36df27,null))[_0xf21e('0x24')](saveUpdates(_0x94a05['body'],null))[_0xf21e('0x24')](respondWithResult(_0x36df27,null))['catch'](handleError(_0x36df27,null));};exports[_0xf21e('0x25')]=function(_0x264ed8,_0x27ac9b){return db[_0xf21e('0x2a')][_0xf21e('0x47')]({'where':{'id':_0x264ed8[_0xf21e('0x43')]['id']}})['then'](handleEntityNotFound(_0x27ac9b,null))[_0xf21e('0x24')](removeEntity(_0x27ac9b,null))[_0xf21e('0x42')](handleError(_0x27ac9b,null));};exports[_0xf21e('0x48')]=function(_0x523c30,_0x819d85,_0x1c7d3f){var _0x30a2ec={};var _0x1489aa={};var _0x10193a;var _0x2c03a3;return db[_0xf21e('0x2a')][_0xf21e('0x49')]({'where':{'id':_0x523c30[_0xf21e('0x43')]['id']}})[_0xf21e('0x24')](handleEntityNotFound(_0x819d85,null))[_0xf21e('0x24')](function(_0xccff6d){if(_0xccff6d){_0x10193a=_0xccff6d;_0x1489aa[_0xf21e('0x32')]=_['keys'](db[_0xf21e('0x4a')]['rawAttributes']);_0x1489aa[_0xf21e('0x2f')]=_['keys'](_0x523c30['query']);_0x1489aa[_0xf21e('0x31')]=_[_0xf21e('0x33')](_0x1489aa[_0xf21e('0x32')],_0x1489aa['query']);_0x30a2ec[_0xf21e('0x35')]=_[_0xf21e('0x33')](_0x1489aa['model'],qs[_0xf21e('0x34')](_0x523c30[_0xf21e('0x2f')][_0xf21e('0x34')]));_0x30a2ec[_0xf21e('0x35')]=_0x30a2ec[_0xf21e('0x35')]['length']?_0x30a2ec['attributes']:_0x1489aa[_0xf21e('0x32')];_0x30a2ec[_0xf21e('0x39')]=qs['sort'](_0x523c30[_0xf21e('0x2f')][_0xf21e('0x3a')]);_0x30a2ec['where']=qs[_0xf21e('0x31')](_[_0xf21e('0x3c')](_0x523c30[_0xf21e('0x2f')],_0x1489aa[_0xf21e('0x31')]));if(_0x523c30[_0xf21e('0x2f')][_0xf21e('0x3d')]){_0x30a2ec[_0xf21e('0x3b')]=_[_0xf21e('0x3e')](_0x30a2ec[_0xf21e('0x3b')],{'$or':_[_0xf21e('0x29')](_0x30a2ec[_0xf21e('0x35')],function(_0x332253){var _0x395ea7={};_0x395ea7[_0x332253]={'$like':'%'+_0x523c30[_0xf21e('0x2f')][_0xf21e('0x3d')]+'%'};return _0x395ea7;})});}_0x30a2ec=_[_0xf21e('0x3e')]({},_0x30a2ec,_0x523c30[_0xf21e('0x3f')]);return _0x10193a['getFields'](_0x30a2ec);}})[_0xf21e('0x24')](function(_0x4ab62b){if(_0x4ab62b){_0x2c03a3=_0x4ab62b['length'];if(!_0x523c30[_0xf21e('0x2f')][_0xf21e('0x37')](_0xf21e('0x38'))){_0x30a2ec['limit']=qs[_0xf21e('0x20')](_0x523c30['query'][_0xf21e('0x20')]);_0x30a2ec[_0xf21e('0x1f')]=qs['offset'](_0x523c30[_0xf21e('0x2f')][_0xf21e('0x1f')]);}return _0x10193a[_0xf21e('0x48')](_0x30a2ec);}})[_0xf21e('0x24')](function(_0x16e0eb){if(_0x16e0eb){return _0x16e0eb?{'count':_0x2c03a3,'rows':_0x16e0eb}:null;}})[_0xf21e('0x24')](respondWithResult(_0x819d85,null))['catch'](handleError(_0x819d85,null));};exports[_0xf21e('0x4b')]=function(_0xb3e4c2,_0x39257a,_0x563b4f){var _0xc86cbd={};var _0x190d93={};var _0x2fa591;var _0x36ffa4;return db[_0xf21e('0x2a')]['findOne']({'where':{'id':_0xb3e4c2[_0xf21e('0x43')]['id']}})['then'](handleEntityNotFound(_0x39257a,null))['then'](function(_0x3d8352){if(_0x3d8352){_0x2fa591=_0x3d8352;_0x190d93[_0xf21e('0x32')]=_[_0xf21e('0x30')](db['DeskField']['rawAttributes']);_0x190d93[_0xf21e('0x2f')]=_[_0xf21e('0x30')](_0xb3e4c2['query']);_0x190d93[_0xf21e('0x31')]=_[_0xf21e('0x33')](_0x190d93[_0xf21e('0x32')],_0x190d93[_0xf21e('0x2f')]);_0xc86cbd[_0xf21e('0x35')]=_[_0xf21e('0x33')](_0x190d93[_0xf21e('0x32')],qs[_0xf21e('0x34')](_0xb3e4c2[_0xf21e('0x2f')]['fields']));_0xc86cbd[_0xf21e('0x35')]=_0xc86cbd['attributes'][_0xf21e('0x36')]?_0xc86cbd[_0xf21e('0x35')]:_0x190d93[_0xf21e('0x32')];_0xc86cbd[_0xf21e('0x39')]=qs['sort'](_0xb3e4c2['query'][_0xf21e('0x3a')]);_0xc86cbd['where']=qs[_0xf21e('0x31')](_[_0xf21e('0x3c')](_0xb3e4c2[_0xf21e('0x2f')],_0x190d93[_0xf21e('0x31')]));if(_0xb3e4c2[_0xf21e('0x2f')][_0xf21e('0x3d')]){_0xc86cbd[_0xf21e('0x3b')]=_[_0xf21e('0x3e')](_0xc86cbd[_0xf21e('0x3b')],{'$or':_[_0xf21e('0x29')](_0xc86cbd['attributes'],function(_0xe4f82d){var _0x1941f1={};_0x1941f1[_0xe4f82d]={'$like':'%'+_0xb3e4c2[_0xf21e('0x2f')][_0xf21e('0x3d')]+'%'};return _0x1941f1;})});}_0xc86cbd=_[_0xf21e('0x3e')]({},_0xc86cbd,_0xb3e4c2[_0xf21e('0x3f')]);return _0x2fa591[_0xf21e('0x4b')](_0xc86cbd);}})[_0xf21e('0x24')](function(_0xb66321){if(_0xb66321){_0x36ffa4=_0xb66321[_0xf21e('0x36')];if(!_0xb3e4c2[_0xf21e('0x2f')][_0xf21e('0x37')](_0xf21e('0x38'))){_0xc86cbd[_0xf21e('0x20')]=qs[_0xf21e('0x20')](_0xb3e4c2['query'][_0xf21e('0x20')]);_0xc86cbd[_0xf21e('0x1f')]=qs[_0xf21e('0x1f')](_0xb3e4c2[_0xf21e('0x2f')]['offset']);}return _0x2fa591[_0xf21e('0x4b')](_0xc86cbd);}})[_0xf21e('0x24')](function(_0x118c92){if(_0x118c92){return _0x118c92?{'count':_0x36ffa4,'rows':_0x118c92}:null;}})[_0xf21e('0x24')](respondWithResult(_0x39257a,null))[_0xf21e('0x42')](handleError(_0x39257a,null));};exports[_0xf21e('0x4c')]=function(_0x214912,_0x4e0a5c,_0x23dcfe){var _0x619ec1={};var _0x371cd3={};var _0xbdedb6;var _0xbf85bd;return db[_0xf21e('0x2a')][_0xf21e('0x49')]({'where':{'id':_0x214912[_0xf21e('0x43')]['id']}})[_0xf21e('0x24')](handleEntityNotFound(_0x4e0a5c,null))[_0xf21e('0x24')](function(_0x4bd479){if(_0x4bd479){_0xbdedb6=_0x4bd479;_0x371cd3[_0xf21e('0x32')]=_[_0xf21e('0x30')](db[_0xf21e('0x4a')][_0xf21e('0x2b')]);_0x371cd3[_0xf21e('0x2f')]=_[_0xf21e('0x30')](_0x214912[_0xf21e('0x2f')]);_0x371cd3[_0xf21e('0x31')]=_['intersection'](_0x371cd3[_0xf21e('0x32')],_0x371cd3[_0xf21e('0x2f')]);_0x619ec1[_0xf21e('0x35')]=_[_0xf21e('0x33')](_0x371cd3[_0xf21e('0x32')],qs[_0xf21e('0x34')](_0x214912['query']['fields']));_0x619ec1[_0xf21e('0x35')]=_0x619ec1[_0xf21e('0x35')][_0xf21e('0x36')]?_0x619ec1['attributes']:_0x371cd3[_0xf21e('0x32')];_0x619ec1[_0xf21e('0x39')]=qs[_0xf21e('0x3a')](_0x214912[_0xf21e('0x2f')][_0xf21e('0x3a')]);_0x619ec1[_0xf21e('0x3b')]=qs[_0xf21e('0x31')](_['pick'](_0x214912['query'],_0x371cd3[_0xf21e('0x31')]));if(_0x214912[_0xf21e('0x2f')][_0xf21e('0x3d')]){_0x619ec1[_0xf21e('0x3b')]=_[_0xf21e('0x3e')](_0x619ec1[_0xf21e('0x3b')],{'$or':_[_0xf21e('0x29')](_0x619ec1[_0xf21e('0x35')],function(_0x3ede7d){var _0x17df06={};_0x17df06[_0x3ede7d]={'$like':'%'+_0x214912['query'][_0xf21e('0x3d')]+'%'};return _0x17df06;})});}_0x619ec1=_['merge']({},_0x619ec1,_0x214912['options']);return _0xbdedb6[_0xf21e('0x4c')](_0x619ec1);}})[_0xf21e('0x24')](function(_0x126969){if(_0x126969){_0xbf85bd=_0x126969[_0xf21e('0x36')];if(!_0x214912['query'][_0xf21e('0x37')](_0xf21e('0x38'))){_0x619ec1[_0xf21e('0x20')]=qs['limit'](_0x214912[_0xf21e('0x2f')]['limit']);_0x619ec1[_0xf21e('0x1f')]=qs['offset'](_0x214912[_0xf21e('0x2f')]['offset']);}return _0xbdedb6[_0xf21e('0x4c')](_0x619ec1);}})[_0xf21e('0x24')](function(_0x3d064f){if(_0x3d064f){return _0x3d064f?{'count':_0xbf85bd,'rows':_0x3d064f}:null;}})['then'](respondWithResult(_0x4e0a5c,null))[_0xf21e('0x42')](handleError(_0x4e0a5c,null));};exports[_0xf21e('0x4d')]=function(_0x1c8939,_0x274ff7,_0x33d214){var _0x41fce0={};var _0x520236={};var _0x105068;var _0xae4594;return db[_0xf21e('0x2a')][_0xf21e('0x49')]({'where':{'id':_0x1c8939[_0xf21e('0x43')]['id']}})[_0xf21e('0x24')](handleEntityNotFound(_0x274ff7,null))[_0xf21e('0x24')](function(_0x4f0fdc){if(_0x4f0fdc){_0x105068=_0x4f0fdc;_0x520236['model']=_['keys'](db['Tag'][_0xf21e('0x2b')]);_0x520236[_0xf21e('0x2f')]=_[_0xf21e('0x30')](_0x1c8939[_0xf21e('0x2f')]);_0x520236[_0xf21e('0x31')]=_['intersection'](_0x520236[_0xf21e('0x32')],_0x520236[_0xf21e('0x2f')]);_0x41fce0['attributes']=_[_0xf21e('0x33')](_0x520236[_0xf21e('0x32')],qs[_0xf21e('0x34')](_0x1c8939['query'][_0xf21e('0x34')]));_0x41fce0['attributes']=_0x41fce0[_0xf21e('0x35')][_0xf21e('0x36')]?_0x41fce0[_0xf21e('0x35')]:_0x520236['model'];_0x41fce0[_0xf21e('0x39')]=qs[_0xf21e('0x3a')](_0x1c8939[_0xf21e('0x2f')]['sort']);_0x41fce0[_0xf21e('0x3b')]=qs[_0xf21e('0x31')](_[_0xf21e('0x3c')](_0x1c8939[_0xf21e('0x2f')],_0x520236[_0xf21e('0x31')]));if(_0x1c8939[_0xf21e('0x2f')][_0xf21e('0x3d')]){_0x41fce0[_0xf21e('0x3b')]=_[_0xf21e('0x3e')](_0x41fce0['where'],{'$or':_[_0xf21e('0x29')](_0x41fce0[_0xf21e('0x35')],function(_0x680dc){var _0x5ed733={};_0x5ed733[_0x680dc]={'$like':'%'+_0x1c8939[_0xf21e('0x2f')][_0xf21e('0x3d')]+'%'};return _0x5ed733;})});}_0x41fce0=_[_0xf21e('0x3e')]({},_0x41fce0,_0x1c8939['options']);return _0x105068[_0xf21e('0x4d')](_0x41fce0);}})[_0xf21e('0x24')](function(_0x3db31c){if(_0x3db31c){_0xae4594=_0x3db31c[_0xf21e('0x36')];if(!_0x1c8939['query']['hasOwnProperty']('nolimit')){_0x41fce0['limit']=qs[_0xf21e('0x20')](_0x1c8939[_0xf21e('0x2f')][_0xf21e('0x20')]);_0x41fce0[_0xf21e('0x1f')]=qs[_0xf21e('0x1f')](_0x1c8939[_0xf21e('0x2f')]['offset']);}return _0x105068[_0xf21e('0x4d')](_0x41fce0);}})[_0xf21e('0x24')](function(_0xd5e8d8){if(_0xd5e8d8){return _0xd5e8d8?{'count':_0xae4594,'rows':_0xd5e8d8}:null;}})[_0xf21e('0x24')](respondWithResult(_0x274ff7,null))[_0xf21e('0x42')](handleError(_0x274ff7,null));};exports[_0xf21e('0x4e')]=function(_0x49d65f,_0x27046d,_0x4864b3){if(_0x49d65f[_0xf21e('0x46')]['id']){delete _0x49d65f[_0xf21e('0x46')]['id'];}return db[_0xf21e('0x2a')]['findOne']({'where':{'id':_0x49d65f[_0xf21e('0x43')]['id']}})[_0xf21e('0x24')](handleEntityNotFound(_0x27046d,null))['then'](function(_0x293fa4){if(_0x293fa4){return _0x293fa4[_0xf21e('0x4e')](_0x49d65f[_0xf21e('0x46')][_0xf21e('0x4f')]||[]);}return null;})[_0xf21e('0x24')](respondWithResult(_0x27046d,null))['catch'](handleError(_0x27046d,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index cd70386..b66727c 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 _0x579c=['define','int_desk_configurations','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intDeskConfiguration.attributes','exports'];(function(_0x75f869,_0x3690d6){var _0x10af8b=function(_0x22d3ff){while(--_0x22d3ff){_0x75f869['push'](_0x75f869['shift']());}};_0x10af8b(++_0x3690d6);}(_0x579c,0xda));var _0xc579=function(_0x1cf05e,_0x32aab9){_0x1cf05e=_0x1cf05e-0x0;var _0xfba324=_0x579c[_0x1cf05e];return _0xfba324;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var logger=require(_0xc579('0x2'))(_0xc579('0x3'));var moment=require(_0xc579('0x4'));var BPromise=require('bluebird');var rp=require(_0xc579('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc579('0x6'));var config=require(_0xc579('0x7'));var attributes=require(_0xc579('0x8'));module[_0xc579('0x9')]=function(_0x124ee5,_0x1bd276){return _0x124ee5[_0xc579('0xa')]('DeskConfiguration',attributes,{'tableName':_0xc579('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc097=['../../config/logger','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x387968,_0x28942d){var _0x3ef832=function(_0x22785d){while(--_0x22785d){_0x387968['push'](_0x387968['shift']());}};_0x3ef832(++_0x28942d);}(_0xc097,0x16a));var _0x7c09=function(_0x4bc836,_0x2cd632){_0x4bc836=_0x4bc836-0x0;var _0x2acd81=_0xc097[_0x4bc836];return _0x2acd81;};'use strict';var _=require(_0x7c09('0x0'));var util=require('util');var logger=require(_0x7c09('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7c09('0x2'));var rp=require(_0x7c09('0x3'));var fs=require('fs');var path=require(_0x7c09('0x4'));var rimraf=require('rimraf');var config=require(_0x7c09('0x5'));var attributes=require(_0x7c09('0x6'));module[_0x7c09('0x7')]=function(_0x470d4e,_0x15bd95){return _0x470d4e[_0x7c09('0x8')](_0x7c09('0x9'),attributes,{'tableName':_0x7c09('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 3563741..cc2ec0a 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 _0xf5b6=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x13899d,_0x3cce86){var _0x1f6e5e=function(_0x3be47f){while(--_0x3be47f){_0x13899d['push'](_0x13899d['shift']());}};_0x1f6e5e(++_0x3cce86);}(_0xf5b6,0x1b4));var _0x6f5b=function(_0x41ed20,_0xc08353){_0x41ed20=_0x41ed20-0x0;var _0x5234d9=_0xf5b6[_0x41ed20];return _0x5234d9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6f5b('0x0'));var BPromise=require(_0x6f5b('0x1'));var rs=require(_0x6f5b('0x2'));var fs=require('fs');var Redis=require(_0x6f5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f5b('0x4'));var logger=require(_0x6f5b('0x5'))(_0x6f5b('0x6'));var config=require(_0x6f5b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5cf395,_0x58899e,_0x4a8fe8){return new BPromise(function(_0x437f27,_0x5b97a4){return client[_0x6f5b('0x9')](_0x5cf395,_0x4a8fe8)[_0x6f5b('0xa')](function(_0x17692b){logger['info'](_0x6f5b('0xb'),_0x58899e,'request\x20sent');logger[_0x6f5b('0xc')](_0x6f5b('0xd'),_0x58899e,_0x6f5b('0xe'),JSON[_0x6f5b('0xf')](_0x17692b));if(_0x17692b[_0x6f5b('0x10')]){if(_0x17692b['error'][_0x6f5b('0x11')]===0x1f4){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b['error']['message']);return _0x5b97a4(_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);}logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x17692b[_0x6f5b('0x10')][_0x6f5b('0x12')]);return _0x437f27(_0x17692b[_0x6f5b('0x10')]['message']);}else{logger[_0x6f5b('0x13')](_0x6f5b('0xb'),_0x58899e,'request\x20sent');_0x437f27(_0x17692b[_0x6f5b('0x14')][_0x6f5b('0x12')]);}})[_0x6f5b('0x15')](function(_0x344cf6){logger[_0x6f5b('0x10')](_0x6f5b('0xb'),_0x58899e,_0x344cf6);_0x5b97a4(_0x344cf6);});});} \ No newline at end of file +var _0xad9f=['http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client'];(function(_0x132986,_0xc679dd){var _0x49dbf9=function(_0x29368e){while(--_0x29368e){_0x132986['push'](_0x132986['shift']());}};_0x49dbf9(++_0xc679dd);}(_0xad9f,0x1be));var _0xfad9=function(_0x41814e,_0x281f70){_0x41814e=_0x41814e-0x0;var _0x5732c1=_0xad9f[_0x41814e];return _0x5732c1;};'use strict';var _=require(_0xfad9('0x0'));var util=require(_0xfad9('0x1'));var moment=require(_0xfad9('0x2'));var BPromise=require('bluebird');var rs=require(_0xfad9('0x3'));var fs=require('fs');var Redis=require(_0xfad9('0x4'));var db=require(_0xfad9('0x5'))['db'];var utils=require(_0xfad9('0x6'));var logger=require('../../config/logger')(_0xfad9('0x7'));var config=require('../../config/environment');var jayson=require(_0xfad9('0x8'));var client=jayson[_0xfad9('0x9')][_0xfad9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xaea9ba,_0xbbc4a6,_0x19b6cc){return new BPromise(function(_0x4d46a7,_0x5580be){return client[_0xfad9('0xb')](_0xaea9ba,_0x19b6cc)[_0xfad9('0xc')](function(_0x362047){logger[_0xfad9('0xd')](_0xfad9('0xe'),_0xbbc4a6,_0xfad9('0xf'));logger[_0xfad9('0x10')](_0xfad9('0x11'),_0xbbc4a6,'request\x20sent',JSON[_0xfad9('0x12')](_0x362047));if(_0x362047[_0xfad9('0x13')]){if(_0x362047[_0xfad9('0x13')][_0xfad9('0x14')]===0x1f4){logger[_0xfad9('0x13')](_0xfad9('0xe'),_0xbbc4a6,_0x362047[_0xfad9('0x13')][_0xfad9('0x15')]);return _0x5580be(_0x362047[_0xfad9('0x13')][_0xfad9('0x15')]);}logger[_0xfad9('0x13')]('DeskConfiguration,\x20%s,\x20%s',_0xbbc4a6,_0x362047[_0xfad9('0x13')][_0xfad9('0x15')]);return _0x4d46a7(_0x362047[_0xfad9('0x13')][_0xfad9('0x15')]);}else{logger[_0xfad9('0xd')](_0xfad9('0xe'),_0xbbc4a6,'request\x20sent');_0x4d46a7(_0x362047[_0xfad9('0x16')]['message']);}})[_0xfad9('0x17')](function(_0x43d2ef){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0xbbc4a6,_0x43d2ef);_0x5580be(_0x43d2ef);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 150dd1f..d7f246b 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 _0xc13c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intDeskField.controller','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x4aa5c2,_0x35cf13){var _0xb8c19a=function(_0x35689a){while(--_0x35689a){_0x4aa5c2['push'](_0x4aa5c2['shift']());}};_0xb8c19a(++_0x35cf13);}(_0xc13c,0x155));var _0xcc13=function(_0x173ad1,_0x56c4ac){_0x173ad1=_0x173ad1-0x0;var _0x26e30b=_0xc13c[_0x173ad1];return _0x26e30b;};'use strict';var multer=require(_0xcc13('0x0'));var util=require(_0xcc13('0x1'));var path=require(_0xcc13('0x2'));var timeout=require(_0xcc13('0x3'));var express=require(_0xcc13('0x4'));var router=express['Router']();var fs_extra=require(_0xcc13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcc13('0x6'));var config=require(_0xcc13('0x7'));var controller=require(_0xcc13('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xcc13('0x9')]);router['get'](_0xcc13('0xa'),auth[_0xcc13('0xb')](),controller[_0xcc13('0xc')]);router[_0xcc13('0xd')]('/',auth[_0xcc13('0xb')](),controller[_0xcc13('0xe')]);router[_0xcc13('0xf')](_0xcc13('0xa'),auth[_0xcc13('0xb')](),controller[_0xcc13('0x10')]);router[_0xcc13('0x11')](_0xcc13('0xa'),auth['isAuthenticated'](),controller[_0xcc13('0x12')]);module[_0xcc13('0x13')]=router; \ No newline at end of file +var _0xd719=['get','index','post','isAuthenticated','create','put','update','delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intDeskField.controller'];(function(_0x84144f,_0x427a7a){var _0x221cff=function(_0x22766c){while(--_0x22766c){_0x84144f['push'](_0x84144f['shift']());}};_0x221cff(++_0x427a7a);}(_0xd719,0xb8));var _0x9d71=function(_0xf8da14,_0x49b2f2){_0xf8da14=_0xf8da14-0x0;var _0x61d88c=_0xd719[_0xf8da14];return _0x61d88c;};'use strict';var multer=require(_0x9d71('0x0'));var util=require(_0x9d71('0x1'));var path=require('path');var timeout=require(_0x9d71('0x2'));var express=require('express');var router=express[_0x9d71('0x3')]();var fs_extra=require(_0x9d71('0x4'));var auth=require(_0x9d71('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9d71('0x6'));var controller=require(_0x9d71('0x7'));router[_0x9d71('0x8')]('/',auth['isAuthenticated'](),controller[_0x9d71('0x9')]);router[_0x9d71('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9d71('0xa')]('/',auth[_0x9d71('0xb')](),controller[_0x9d71('0xc')]);router[_0x9d71('0xd')]('/:id',auth[_0x9d71('0xb')](),controller[_0x9d71('0xe')]);router[_0x9d71('0xf')]('/:id',auth[_0x9d71('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 192bc6f..207e684 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 _0x4487=['string','variable','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0xb7c6e1,_0x452e83){var _0x287d41=function(_0x1ed9b){while(--_0x1ed9b){_0xb7c6e1['push'](_0xb7c6e1['shift']());}};_0x287d41(++_0x452e83);}(_0x4487,0xde));var _0x7448=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x4487[_0x1f36bb];return _0xaf97fa;};'use strict';var Sequelize=require(_0x7448('0x0'));module[_0x7448('0x1')]={'type':{'type':Sequelize['ENUM'](_0x7448('0x2'),_0x7448('0x3'),_0x7448('0x4'),'keyValue','picklist'),'defaultValue':_0x7448('0x2')},'content':{'type':Sequelize[_0x7448('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7448('0x2'),'variable',_0x7448('0x4'))},'keyContent':{'type':Sequelize[_0x7448('0x5')]},'idField':{'type':Sequelize[_0x7448('0x5')]},'nameField':{'type':Sequelize[_0x7448('0x5')]},'customField':{'type':Sequelize[_0x7448('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7448('0x5')]}}; \ No newline at end of file +var _0xfd88=['BOOLEAN','sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x19a8a3,_0x12371e){var _0x111ed7=function(_0xfd158e){while(--_0xfd158e){_0x19a8a3['push'](_0x19a8a3['shift']());}};_0x111ed7(++_0x12371e);}(_0xfd88,0xd9));var _0x8fd8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xfd88[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x8fd8('0x0'));module['exports']={'type':{'type':Sequelize[_0x8fd8('0x1')](_0x8fd8('0x2'),_0x8fd8('0x3'),_0x8fd8('0x4'),_0x8fd8('0x5'),_0x8fd8('0x6')),'defaultValue':_0x8fd8('0x2')},'content':{'type':Sequelize[_0x8fd8('0x7')]},'key':{'type':Sequelize[_0x8fd8('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x8fd8('0x2'),_0x8fd8('0x3'),_0x8fd8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x8fd8('0x7')]},'nameField':{'type':Sequelize[_0x8fd8('0x7')]},'customField':{'type':Sequelize[_0x8fd8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8fd8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index e5c6711..f9883fe 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 _0x2a9a=['fieldName','type','map','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','destroy','params','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','name','DeskField','rawAttributes'];(function(_0x56f420,_0xa84fb0){var _0x4470a3=function(_0x42d132){while(--_0x42d132){_0x56f420['push'](_0x56f420['shift']());}};_0x4470a3(++_0xa84fb0);}(_0x2a9a,0x64));var _0xa2a9=function(_0x4b06aa,_0x4166a4){_0x4b06aa=_0x4b06aa-0x0;var _0x1cc149=_0x2a9a[_0x4b06aa];return _0x1cc149;};'use strict';var emlformat=require(_0xa2a9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa2a9('0x2'));var BPromise=require(_0xa2a9('0x3'));var Mustache=require(_0xa2a9('0x4'));var util=require(_0xa2a9('0x5'));var path=require(_0xa2a9('0x6'));var sox=require('sox');var csv=require(_0xa2a9('0x7'));var ejs=require(_0xa2a9('0x8'));var fs=require('fs');var fs_extra=require(_0xa2a9('0x9'));var _=require(_0xa2a9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa2a9('0x7'));var querystring=require(_0xa2a9('0xb'));var Papa=require(_0xa2a9('0xc'));var Redis=require(_0xa2a9('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa2a9('0xe'));var as=require(_0xa2a9('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2a9('0x10'))(_0xa2a9('0x11'));var utils=require(_0xa2a9('0x12'));var config=require(_0xa2a9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2a9('0x14'))['db'];function respondWithStatusCode(_0x252808,_0x31b217){_0x31b217=_0x31b217||0xcc;return function(_0x26936b){if(_0x26936b){return _0x252808[_0xa2a9('0x15')](_0x31b217);}return _0x252808[_0xa2a9('0x16')](_0x31b217)['end']();};}function respondWithResult(_0x1e99ed,_0x2c69f2){_0x2c69f2=_0x2c69f2||0xc8;return function(_0x4e4078){if(_0x4e4078){return _0x1e99ed['status'](_0x2c69f2)['json'](_0x4e4078);}};}function respondWithFilteredResult(_0x2826e6,_0x53a6a1){return function(_0x3f667a){if(_0x3f667a){var _0x487e53=typeof _0x53a6a1[_0xa2a9('0x17')]===_0xa2a9('0x18')&&typeof _0x53a6a1[_0xa2a9('0x19')]===_0xa2a9('0x18');var _0x4d8707=_0x3f667a[_0xa2a9('0x1a')];var _0x574964=_0x487e53?0x0:_0x53a6a1[_0xa2a9('0x17')];var _0x49ae63=_0x487e53?_0x3f667a[_0xa2a9('0x1a')]:_0x53a6a1['offset']+_0x53a6a1[_0xa2a9('0x19')];var _0xe86c00;if(_0x49ae63>=_0x4d8707){_0x49ae63=_0x4d8707;_0xe86c00=0xc8;}else{_0xe86c00=0xce;}_0x2826e6[_0xa2a9('0x16')](_0xe86c00);return _0x2826e6[_0xa2a9('0x1b')](_0xa2a9('0x1c'),_0x574964+'-'+_0x49ae63+'/'+_0x4d8707)[_0xa2a9('0x1d')](_0x3f667a);}return null;};}function patchUpdates(_0x17ccc3){return function(_0x447338){try{jsonpatch[_0xa2a9('0x1e')](_0x447338,_0x17ccc3,!![]);}catch(_0x3cdac1){return BPromise['reject'](_0x3cdac1);}return _0x447338[_0xa2a9('0x1f')]();};}function saveUpdates(_0x34abbf,_0x1204e9){return function(_0xe00463){if(_0xe00463){return _0xe00463[_0xa2a9('0x20')](_0x34abbf)[_0xa2a9('0x21')](function(_0x48aa77){return _0x48aa77;});}return null;};}function removeEntity(_0x1ec94d,_0x565c8c){return function(_0x4de5fd){if(_0x4de5fd){return _0x4de5fd['destroy']()[_0xa2a9('0x21')](function(){_0x1ec94d[_0xa2a9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc4cc3d,_0x202323){return function(_0x1c81e8){if(!_0x1c81e8){_0xc4cc3d[_0xa2a9('0x15')](0x194);}return _0x1c81e8;};}function handleError(_0x4ae2f7,_0x3be9c0){_0x3be9c0=_0x3be9c0||0x1f4;return function(_0x44e435){logger[_0xa2a9('0x22')](_0x44e435['stack']);if(_0x44e435[_0xa2a9('0x23')]){delete _0x44e435[_0xa2a9('0x23')];}_0x4ae2f7[_0xa2a9('0x16')](_0x3be9c0)['send'](_0x44e435);};}exports['index']=function(_0x4cfd47,_0x10b84f){var _0x12d222={},_0x40ff63={},_0xca45e8={'count':0x0,'rows':[]};var _0x447564=_['map'](db[_0xa2a9('0x24')][_0xa2a9('0x25')],function(_0x124f47){return{'name':_0x124f47[_0xa2a9('0x26')],'type':_0x124f47[_0xa2a9('0x27')]['key']};});_0x40ff63['model']=_[_0xa2a9('0x28')](_0x447564,'name');_0x40ff63['query']=_[_0xa2a9('0x29')](_0x4cfd47[_0xa2a9('0x2a')]);_0x40ff63[_0xa2a9('0x2b')]=_['intersection'](_0x40ff63[_0xa2a9('0x2c')],_0x40ff63[_0xa2a9('0x2a')]);_0x12d222[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x40ff63['model'],qs[_0xa2a9('0x2f')](_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x12d222[_0xa2a9('0x2d')]=_0x12d222['attributes'][_0xa2a9('0x30')]?_0x12d222['attributes']:_0x40ff63[_0xa2a9('0x2c')];if(!_0x4cfd47['query'][_0xa2a9('0x31')](_0xa2a9('0x32'))){_0x12d222[_0xa2a9('0x19')]=qs['limit'](_0x4cfd47['query'][_0xa2a9('0x19')]);_0x12d222['offset']=qs[_0xa2a9('0x17')](_0x4cfd47['query'][_0xa2a9('0x17')]);}_0x12d222['order']=qs[_0xa2a9('0x33')](_0x4cfd47['query']['sort']);_0x12d222['where']=qs['filters'](_[_0xa2a9('0x34')](_0x4cfd47[_0xa2a9('0x2a')],_0x40ff63[_0xa2a9('0x2b')]),_0x447564);if(_0x4cfd47['query'][_0xa2a9('0x35')]){_0x12d222[_0xa2a9('0x36')]=_['merge'](_0x12d222['where'],{'$or':_[_0xa2a9('0x28')](_0x447564,function(_0x254f42){if(_0x254f42['type']!==_0xa2a9('0x37')){var _0x3a8911={};_0x3a8911[_0x254f42['name']]={'$like':'%'+_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x35')]+'%'};return _0x3a8911;}})});}_0x12d222=_[_0xa2a9('0x38')]({},_0x12d222,_0x4cfd47[_0xa2a9('0x39')]);var _0x6aaad9={'where':_0x12d222[_0xa2a9('0x36')]};return db[_0xa2a9('0x24')][_0xa2a9('0x1a')](_0x6aaad9)[_0xa2a9('0x21')](function(_0x43118d){_0xca45e8[_0xa2a9('0x1a')]=_0x43118d;if(_0x4cfd47[_0xa2a9('0x2a')][_0xa2a9('0x3a')]){_0x12d222[_0xa2a9('0x3b')]=[{'all':!![]}];}return db['DeskField'][_0xa2a9('0x3c')](_0x12d222);})['then'](function(_0x34de68){_0xca45e8[_0xa2a9('0x3d')]=_0x34de68;return _0xca45e8;})[_0xa2a9('0x21')](respondWithFilteredResult(_0x10b84f,_0x12d222))[_0xa2a9('0x3e')](handleError(_0x10b84f,null));};exports[_0xa2a9('0x3f')]=function(_0x20fd9b,_0x4ea462){var _0x1828cb={'raw':!![],'where':{'id':_0x20fd9b['params']['id']}},_0x818b7e={};_0x818b7e['model']=_[_0xa2a9('0x29')](db['DeskField']['rawAttributes']);_0x818b7e['query']=_[_0xa2a9('0x29')](_0x20fd9b['query']);_0x818b7e[_0xa2a9('0x2b')]=_[_0xa2a9('0x2e')](_0x818b7e[_0xa2a9('0x2c')],_0x818b7e['query']);_0x1828cb[_0xa2a9('0x2d')]=_[_0xa2a9('0x2e')](_0x818b7e[_0xa2a9('0x2c')],qs['fields'](_0x20fd9b[_0xa2a9('0x2a')][_0xa2a9('0x2f')]));_0x1828cb[_0xa2a9('0x2d')]=_0x1828cb[_0xa2a9('0x2d')][_0xa2a9('0x30')]?_0x1828cb[_0xa2a9('0x2d')]:_0x818b7e[_0xa2a9('0x2c')];if(_0x20fd9b[_0xa2a9('0x2a')][_0xa2a9('0x3a')]){_0x1828cb[_0xa2a9('0x3b')]=[{'all':!![]}];}_0x1828cb=_[_0xa2a9('0x38')]({},_0x1828cb,_0x20fd9b[_0xa2a9('0x39')]);return db[_0xa2a9('0x24')]['find'](_0x1828cb)[_0xa2a9('0x21')](handleEntityNotFound(_0x4ea462,null))[_0xa2a9('0x21')](respondWithResult(_0x4ea462,null))[_0xa2a9('0x3e')](handleError(_0x4ea462,null));};exports[_0xa2a9('0x40')]=function(_0x10490f,_0x23a5e8){return db[_0xa2a9('0x24')][_0xa2a9('0x40')](_0x10490f['body'],{})[_0xa2a9('0x21')](respondWithResult(_0x23a5e8,0xc9))[_0xa2a9('0x3e')](handleError(_0x23a5e8,null));};exports['update']=function(_0x323406,_0x569e6a){if(_0x323406[_0xa2a9('0x41')]['id']){delete _0x323406[_0xa2a9('0x41')]['id'];}return db[_0xa2a9('0x24')][_0xa2a9('0x42')]({'where':{'id':_0x323406['params']['id']}})[_0xa2a9('0x21')](handleEntityNotFound(_0x569e6a,null))['then'](saveUpdates(_0x323406['body'],null))[_0xa2a9('0x21')](respondWithResult(_0x569e6a,null))[_0xa2a9('0x3e')](handleError(_0x569e6a,null));};exports[_0xa2a9('0x43')]=function(_0x42ba23,_0x53f60f){return db['DeskField']['find']({'where':{'id':_0x42ba23[_0xa2a9('0x44')]['id']}})[_0xa2a9('0x21')](handleEntityNotFound(_0x53f60f,null))[_0xa2a9('0x21')](removeEntity(_0x53f60f,null))['catch'](handleError(_0x53f60f,null));}; \ No newline at end of file +var _0x3c34=['keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','type','key','model','map'];(function(_0x3b29f3,_0x90d3dd){var _0x540fe1=function(_0xdfbee){while(--_0xdfbee){_0x3b29f3['push'](_0x3b29f3['shift']());}};_0x540fe1(++_0x90d3dd);}(_0x3c34,0x14c));var _0x43c3=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x3c34[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require(_0x43c3('0x0'));var rimraf=require(_0x43c3('0x1'));var zipdir=require(_0x43c3('0x2'));var jsonpatch=require(_0x43c3('0x3'));var rp=require(_0x43c3('0x4'));var moment=require(_0x43c3('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x43c3('0x6'));var path=require(_0x43c3('0x7'));var sox=require(_0x43c3('0x8'));var csv=require(_0x43c3('0x9'));var ejs=require(_0x43c3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x43c3('0xb'));var crypto=require(_0x43c3('0xc'));var jsforce=require(_0x43c3('0xd'));var deskjs=require(_0x43c3('0xe'));var toCsv=require(_0x43c3('0x9'));var querystring=require(_0x43c3('0xf'));var Papa=require('papaparse');var Redis=require(_0x43c3('0x10'));var authService=require(_0x43c3('0x11'));var qs=require(_0x43c3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x43c3('0x13'));var logger=require(_0x43c3('0x14'))(_0x43c3('0x15'));var utils=require(_0x43c3('0x16'));var config=require(_0x43c3('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x43c3('0x18'))['db'];function respondWithStatusCode(_0x584749,_0x1f350e){_0x1f350e=_0x1f350e||0xcc;return function(_0x318057){if(_0x318057){return _0x584749[_0x43c3('0x19')](_0x1f350e);}return _0x584749[_0x43c3('0x1a')](_0x1f350e)[_0x43c3('0x1b')]();};}function respondWithResult(_0x556c8b,_0x278e07){_0x278e07=_0x278e07||0xc8;return function(_0x4cc546){if(_0x4cc546){return _0x556c8b[_0x43c3('0x1a')](_0x278e07)[_0x43c3('0x1c')](_0x4cc546);}};}function respondWithFilteredResult(_0x40ae7c,_0x1b6bef){return function(_0x3af5c6){if(_0x3af5c6){var _0x203627=typeof _0x1b6bef[_0x43c3('0x1d')]===_0x43c3('0x1e')&&typeof _0x1b6bef[_0x43c3('0x1f')]===_0x43c3('0x1e');var _0x4a2541=_0x3af5c6[_0x43c3('0x20')];var _0x2811b1=_0x203627?0x0:_0x1b6bef[_0x43c3('0x1d')];var _0x532c2d=_0x203627?_0x3af5c6[_0x43c3('0x20')]:_0x1b6bef[_0x43c3('0x1d')]+_0x1b6bef[_0x43c3('0x1f')];var _0x36e424;if(_0x532c2d>=_0x4a2541){_0x532c2d=_0x4a2541;_0x36e424=0xc8;}else{_0x36e424=0xce;}_0x40ae7c[_0x43c3('0x1a')](_0x36e424);return _0x40ae7c[_0x43c3('0x21')](_0x43c3('0x22'),_0x2811b1+'-'+_0x532c2d+'/'+_0x4a2541)[_0x43c3('0x1c')](_0x3af5c6);}return null;};}function patchUpdates(_0xe5f582){return function(_0x582251){try{jsonpatch[_0x43c3('0x23')](_0x582251,_0xe5f582,!![]);}catch(_0x9aae0e){return BPromise[_0x43c3('0x24')](_0x9aae0e);}return _0x582251[_0x43c3('0x25')]();};}function saveUpdates(_0x4e639a,_0x59ec7e){return function(_0x30edf6){if(_0x30edf6){return _0x30edf6[_0x43c3('0x26')](_0x4e639a)[_0x43c3('0x27')](function(_0x3b9f6c){return _0x3b9f6c;});}return null;};}function removeEntity(_0x25cff6,_0x1586cd){return function(_0x3cb8b9){if(_0x3cb8b9){return _0x3cb8b9[_0x43c3('0x28')]()[_0x43c3('0x27')](function(){_0x25cff6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x125f67,_0x2f3164){return function(_0x9a5465){if(!_0x9a5465){_0x125f67['sendStatus'](0x194);}return _0x9a5465;};}function handleError(_0x24f5fe,_0x226778){_0x226778=_0x226778||0x1f4;return function(_0x397279){logger[_0x43c3('0x29')](_0x397279[_0x43c3('0x2a')]);if(_0x397279[_0x43c3('0x2b')]){delete _0x397279[_0x43c3('0x2b')];}_0x24f5fe[_0x43c3('0x1a')](_0x226778)[_0x43c3('0x2c')](_0x397279);};}exports[_0x43c3('0x2d')]=function(_0xe2a63f,_0x2fe69f){var _0x3b8ecc={},_0x1a40a2={},_0x16af8d={'count':0x0,'rows':[]};var _0x22121e=_['map'](db[_0x43c3('0x2e')][_0x43c3('0x2f')],function(_0x18a224){return{'name':_0x18a224[_0x43c3('0x30')],'type':_0x18a224[_0x43c3('0x31')][_0x43c3('0x32')]};});_0x1a40a2[_0x43c3('0x33')]=_[_0x43c3('0x34')](_0x22121e,_0x43c3('0x2b'));_0x1a40a2['query']=_[_0x43c3('0x35')](_0xe2a63f['query']);_0x1a40a2['filters']=_[_0x43c3('0x36')](_0x1a40a2[_0x43c3('0x33')],_0x1a40a2[_0x43c3('0x37')]);_0x3b8ecc[_0x43c3('0x38')]=_[_0x43c3('0x36')](_0x1a40a2[_0x43c3('0x33')],qs[_0x43c3('0x39')](_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x39')]));_0x3b8ecc['attributes']=_0x3b8ecc['attributes'][_0x43c3('0x3a')]?_0x3b8ecc['attributes']:_0x1a40a2['model'];if(!_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x3b')](_0x43c3('0x3c'))){_0x3b8ecc['limit']=qs[_0x43c3('0x1f')](_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x1f')]);_0x3b8ecc[_0x43c3('0x1d')]=qs[_0x43c3('0x1d')](_0xe2a63f[_0x43c3('0x37')]['offset']);}_0x3b8ecc[_0x43c3('0x3d')]=qs[_0x43c3('0x3e')](_0xe2a63f[_0x43c3('0x37')]['sort']);_0x3b8ecc[_0x43c3('0x3f')]=qs[_0x43c3('0x40')](_['pick'](_0xe2a63f[_0x43c3('0x37')],_0x1a40a2[_0x43c3('0x40')]),_0x22121e);if(_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x41')]){_0x3b8ecc[_0x43c3('0x3f')]=_[_0x43c3('0x42')](_0x3b8ecc[_0x43c3('0x3f')],{'$or':_['map'](_0x22121e,function(_0x1ebe66){if(_0x1ebe66['type']!==_0x43c3('0x43')){var _0x4c0441={};_0x4c0441[_0x1ebe66[_0x43c3('0x2b')]]={'$like':'%'+_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x41')]+'%'};return _0x4c0441;}})});}_0x3b8ecc=_[_0x43c3('0x42')]({},_0x3b8ecc,_0xe2a63f['options']);var _0x35e636={'where':_0x3b8ecc[_0x43c3('0x3f')]};return db['DeskField'][_0x43c3('0x20')](_0x35e636)['then'](function(_0x22f5dd){_0x16af8d[_0x43c3('0x20')]=_0x22f5dd;if(_0xe2a63f[_0x43c3('0x37')][_0x43c3('0x44')]){_0x3b8ecc['include']=[{'all':!![]}];}return db['DeskField'][_0x43c3('0x45')](_0x3b8ecc);})[_0x43c3('0x27')](function(_0x3e28b3){_0x16af8d['rows']=_0x3e28b3;return _0x16af8d;})[_0x43c3('0x27')](respondWithFilteredResult(_0x2fe69f,_0x3b8ecc))[_0x43c3('0x46')](handleError(_0x2fe69f,null));};exports[_0x43c3('0x47')]=function(_0x2e40b3,_0xc9458a){var _0x51bf9a={'raw':!![],'where':{'id':_0x2e40b3[_0x43c3('0x48')]['id']}},_0x1f2e4f={};_0x1f2e4f['model']=_[_0x43c3('0x35')](db[_0x43c3('0x2e')][_0x43c3('0x2f')]);_0x1f2e4f[_0x43c3('0x37')]=_['keys'](_0x2e40b3[_0x43c3('0x37')]);_0x1f2e4f[_0x43c3('0x40')]=_[_0x43c3('0x36')](_0x1f2e4f[_0x43c3('0x33')],_0x1f2e4f[_0x43c3('0x37')]);_0x51bf9a['attributes']=_['intersection'](_0x1f2e4f[_0x43c3('0x33')],qs['fields'](_0x2e40b3[_0x43c3('0x37')][_0x43c3('0x39')]));_0x51bf9a[_0x43c3('0x38')]=_0x51bf9a[_0x43c3('0x38')][_0x43c3('0x3a')]?_0x51bf9a[_0x43c3('0x38')]:_0x1f2e4f[_0x43c3('0x33')];if(_0x2e40b3[_0x43c3('0x37')][_0x43c3('0x44')]){_0x51bf9a[_0x43c3('0x49')]=[{'all':!![]}];}_0x51bf9a=_[_0x43c3('0x42')]({},_0x51bf9a,_0x2e40b3['options']);return db['DeskField'][_0x43c3('0x4a')](_0x51bf9a)[_0x43c3('0x27')](handleEntityNotFound(_0xc9458a,null))[_0x43c3('0x27')](respondWithResult(_0xc9458a,null))[_0x43c3('0x46')](handleError(_0xc9458a,null));};exports[_0x43c3('0x4b')]=function(_0x413185,_0x2a141e){return db[_0x43c3('0x2e')][_0x43c3('0x4b')](_0x413185[_0x43c3('0x4c')],{})[_0x43c3('0x27')](respondWithResult(_0x2a141e,0xc9))[_0x43c3('0x46')](handleError(_0x2a141e,null));};exports[_0x43c3('0x26')]=function(_0x573093,_0x328df3){if(_0x573093['body']['id']){delete _0x573093[_0x43c3('0x4c')]['id'];}return db['DeskField']['find']({'where':{'id':_0x573093['params']['id']}})[_0x43c3('0x27')](handleEntityNotFound(_0x328df3,null))[_0x43c3('0x27')](saveUpdates(_0x573093[_0x43c3('0x4c')],null))[_0x43c3('0x27')](respondWithResult(_0x328df3,null))[_0x43c3('0x46')](handleError(_0x328df3,null));};exports[_0x43c3('0x28')]=function(_0x460f3d,_0x47c722){return db['DeskField']['find']({'where':{'id':_0x460f3d[_0x43c3('0x48')]['id']}})[_0x43c3('0x27')](handleEntityNotFound(_0x47c722,null))['then'](removeEntity(_0x47c722,null))[_0x43c3('0x46')](handleError(_0x47c722,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index d8e18d1..41fd5d8 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 _0x3798=['../../config/logger','api','moment','bluebird','../../config/environment','./intDeskField.attributes','define','int_desk_fields','desk_unique_index','idField','lodash','util'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0x3798,0x8e));var _0x8379=function(_0x3902b8,_0x4b013a){_0x3902b8=_0x3902b8-0x0;var _0x345127=_0x3798[_0x3902b8];return _0x345127;};'use strict';var _=require(_0x8379('0x0'));var util=require(_0x8379('0x1'));var logger=require(_0x8379('0x2'))(_0x8379('0x3'));var moment=require(_0x8379('0x4'));var BPromise=require(_0x8379('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8379('0x6'));var attributes=require(_0x8379('0x7'));module['exports']=function(_0x24dbbe,_0x2ebc2f){return _0x24dbbe[_0x8379('0x8')]('DeskField',attributes,{'tableName':_0x8379('0x9'),'paranoid':![],'indexes':[{'name':_0x8379('0xa'),'fields':[_0x8379('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c1=['rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','bluebird'];(function(_0x9f493f,_0x30c4d8){var _0x827c92=function(_0x35ff1f){while(--_0x35ff1f){_0x9f493f['push'](_0x9f493f['shift']());}};_0x827c92(++_0x30c4d8);}(_0xc0c1,0x109));var _0x1c0c=function(_0x47e780,_0x5dec2e){_0x47e780=_0x47e780-0x0;var _0x51d02c=_0xc0c1[_0x47e780];return _0x51d02c;};'use strict';var _=require(_0x1c0c('0x0'));var util=require(_0x1c0c('0x1'));var logger=require(_0x1c0c('0x2'))('api');var moment=require(_0x1c0c('0x3'));var BPromise=require(_0x1c0c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c0c('0x5'));var config=require(_0x1c0c('0x6'));var attributes=require(_0x1c0c('0x7'));module[_0x1c0c('0x8')]=function(_0x2fad54,_0x3af1c2){return _0x2fad54[_0x1c0c('0x9')](_0x1c0c('0xa'),attributes,{'tableName':_0x1c0c('0xb'),'paranoid':![],'indexes':[{'name':_0x1c0c('0xc'),'fields':[_0x1c0c('0xd'),_0x1c0c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index f9c2d7e..5058cb1 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 _0xbc21=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','DeskField,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x5c92fd,_0x23beb7){var _0x48c9a7=function(_0x4d7d99){while(--_0x4d7d99){_0x5c92fd['push'](_0x5c92fd['shift']());}};_0x48c9a7(++_0x23beb7);}(_0xbc21,0x1f1));var _0x1bc2=function(_0x4b0997,_0x25ab7e){_0x4b0997=_0x4b0997-0x0;var _0x1b88b2=_0xbc21[_0x4b0997];return _0x1b88b2;};'use strict';var _=require(_0x1bc2('0x0'));var util=require(_0x1bc2('0x1'));var moment=require(_0x1bc2('0x2'));var BPromise=require('bluebird');var rs=require(_0x1bc2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1bc2('0x4'))['db'];var utils=require(_0x1bc2('0x5'));var logger=require(_0x1bc2('0x6'))(_0x1bc2('0x7'));var config=require(_0x1bc2('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1bc2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39201e,_0x16ae40,_0x50c2ec){return new BPromise(function(_0xddf857,_0xfac52e){return client[_0x1bc2('0xa')](_0x39201e,_0x50c2ec)[_0x1bc2('0xb')](function(_0x57ff47){logger[_0x1bc2('0xc')]('DeskField,\x20%s,\x20%s',_0x16ae40,_0x1bc2('0xd'));logger[_0x1bc2('0xe')](_0x1bc2('0xf'),_0x16ae40,_0x1bc2('0xd'),JSON['stringify'](_0x57ff47));if(_0x57ff47[_0x1bc2('0x10')]){if(_0x57ff47['error']['code']===0x1f4){logger['error'](_0x1bc2('0x11'),_0x16ae40,_0x57ff47['error']['message']);return _0xfac52e(_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);}logger['error']('DeskField,\x20%s,\x20%s',_0x16ae40,_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);return _0xddf857(_0x57ff47[_0x1bc2('0x10')][_0x1bc2('0x12')]);}else{logger[_0x1bc2('0xc')](_0x1bc2('0x11'),_0x16ae40,_0x1bc2('0xd'));_0xddf857(_0x57ff47['result']['message']);}})[_0x1bc2('0x13')](function(_0x57eab6){logger['error'](_0x1bc2('0x11'),_0x16ae40,_0x57eab6);_0xfac52e(_0x57eab6);});});} \ No newline at end of file +var _0xdf1a=['error','code','DeskField,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','info','request\x20sent','debug'];(function(_0x507bda,_0x555fb9){var _0x12edbf=function(_0x1c1182){while(--_0x1c1182){_0x507bda['push'](_0x507bda['shift']());}};_0x12edbf(++_0x555fb9);}(_0xdf1a,0xc3));var _0xadf1=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xdf1a[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xadf1('0x0'));var util=require(_0xadf1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xadf1('0x2'));var fs=require('fs');var Redis=require(_0xadf1('0x3'));var db=require(_0xadf1('0x4'))['db'];var utils=require(_0xadf1('0x5'));var logger=require('../../config/logger')(_0xadf1('0x6'));var config=require(_0xadf1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xadf1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c19fa,_0x28966a,_0x281ea1){return new BPromise(function(_0x51e990,_0x28e0c4){return client[_0xadf1('0x9')](_0x1c19fa,_0x281ea1)[_0xadf1('0xa')](function(_0x444187){logger[_0xadf1('0xb')]('DeskField,\x20%s,\x20%s',_0x28966a,_0xadf1('0xc'));logger[_0xadf1('0xd')]('DeskField,\x20%s,\x20%s,\x20%s',_0x28966a,_0xadf1('0xc'),JSON['stringify'](_0x444187));if(_0x444187['error']){if(_0x444187[_0xadf1('0xe')][_0xadf1('0xf')]===0x1f4){logger['error'](_0xadf1('0x10'),_0x28966a,_0x444187[_0xadf1('0xe')][_0xadf1('0x11')]);return _0x28e0c4(_0x444187['error'][_0xadf1('0x11')]);}logger[_0xadf1('0xe')]('DeskField,\x20%s,\x20%s',_0x28966a,_0x444187[_0xadf1('0xe')][_0xadf1('0x11')]);return _0x51e990(_0x444187[_0xadf1('0xe')][_0xadf1('0x11')]);}else{logger[_0xadf1('0xb')](_0xadf1('0x10'),_0x28966a,_0xadf1('0xc'));_0x51e990(_0x444187['result']['message']);}})[_0xadf1('0x12')](function(_0x3ad6dc){logger['error'](_0xadf1('0x10'),_0x28966a,_0x3ad6dc);_0x28e0c4(_0x3ad6dc);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e0e27dd..f9959fe 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 _0x303b=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','addConfiguration','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0xb171df,_0x1a7188){var _0x54802f=function(_0x4e47c2){while(--_0x4e47c2){_0xb171df['push'](_0xb171df['shift']());}};_0x54802f(++_0x1a7188);}(_0x303b,0x1c6));var _0xb303=function(_0x22f02b,_0x481bda){_0x22f02b=_0x22f02b-0x0;var _0x495ad7=_0x303b[_0x22f02b];return _0x495ad7;};'use strict';var multer=require(_0xb303('0x0'));var util=require(_0xb303('0x1'));var path=require(_0xb303('0x2'));var timeout=require(_0xb303('0x3'));var express=require(_0xb303('0x4'));var router=express[_0xb303('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb303('0x6'));var config=require(_0xb303('0x7'));var controller=require(_0xb303('0x8'));router[_0xb303('0x9')]('/',auth[_0xb303('0xa')](),controller[_0xb303('0xb')]);router['get'](_0xb303('0xc'),auth[_0xb303('0xa')](),controller[_0xb303('0xd')]);router[_0xb303('0x9')](_0xb303('0xe'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xb303('0x9')]('/:id/fields',auth[_0xb303('0xa')](),controller[_0xb303('0xf')]);router[_0xb303('0x10')]('/',auth[_0xb303('0xa')](),controller['create']);router[_0xb303('0x10')](_0xb303('0xe'),auth[_0xb303('0xa')](),controller[_0xb303('0x11')]);router['put'](_0xb303('0xc'),auth[_0xb303('0xa')](),controller[_0xb303('0x12')]);router['delete'](_0xb303('0xc'),auth[_0xb303('0xa')](),controller[_0xb303('0x13')]);module['exports']=router; \ No newline at end of file +var _0xe3cd=['getConfigurations','/:id/fields','getFields','create','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x4ed32d,_0x327695){var _0xf624df=function(_0x29518c){while(--_0x29518c){_0x4ed32d['push'](_0x4ed32d['shift']());}};_0xf624df(++_0x327695);}(_0xe3cd,0xd8));var _0xde3c=function(_0xbd9c46,_0x262ce1){_0xbd9c46=_0xbd9c46-0x0;var _0x3b2fee=_0xe3cd[_0xbd9c46];return _0x3b2fee;};'use strict';var multer=require(_0xde3c('0x0'));var util=require('util');var path=require(_0xde3c('0x1'));var timeout=require(_0xde3c('0x2'));var express=require('express');var router=express[_0xde3c('0x3')]();var fs_extra=require(_0xde3c('0x4'));var auth=require(_0xde3c('0x5'));var interaction=require(_0xde3c('0x6'));var config=require(_0xde3c('0x7'));var controller=require(_0xde3c('0x8'));router[_0xde3c('0x9')]('/',auth[_0xde3c('0xa')](),controller[_0xde3c('0xb')]);router[_0xde3c('0x9')](_0xde3c('0xc'),auth[_0xde3c('0xa')](),controller[_0xde3c('0xd')]);router[_0xde3c('0x9')](_0xde3c('0xe'),auth[_0xde3c('0xa')](),controller[_0xde3c('0xf')]);router[_0xde3c('0x9')](_0xde3c('0x10'),auth[_0xde3c('0xa')](),controller[_0xde3c('0x11')]);router['post']('/',auth[_0xde3c('0xa')](),controller[_0xde3c('0x12')]);router['post'](_0xde3c('0xe'),auth[_0xde3c('0xa')](),controller['addConfiguration']);router['put'](_0xde3c('0xc'),auth[_0xde3c('0xa')](),controller['update']);router['delete'](_0xde3c('0xc'),auth[_0xde3c('0xa')](),controller[_0xde3c('0x13')]);module[_0xde3c('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 0e20e63..8c6b766 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 _0x1928=['sequelize','exports','STRING','BOOLEAN'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1928,0x138));var _0x8192=function(_0x2bfd0d,_0x5e70b8){_0x2bfd0d=_0x2bfd0d-0x0;var _0x11b4fa=_0x1928[_0x2bfd0d];return _0x11b4fa;};'use strict';var Sequelize=require(_0x8192('0x0'));module[_0x8192('0x1')]={'name':{'type':Sequelize[_0x8192('0x2')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x8192('0x2')]},'remoteUri':{'type':Sequelize[_0x8192('0x2')]},'tenantId':{'type':Sequelize[_0x8192('0x2')]},'clientId':{'type':Sequelize[_0x8192('0x2')]},'clientSecret':{'type':Sequelize[_0x8192('0x2')]},'serverUrl':{'type':Sequelize[_0x8192('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x8192('0x2')]},'modernAuthentication':{'type':Sequelize[_0x8192('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0x06f4=['STRING','BOOLEAN','sequelize','exports'];(function(_0x3c34bf,_0x5c74b7){var _0x4c1fa9=function(_0x3a24b4){while(--_0x3a24b4){_0x3c34bf['push'](_0x3c34bf['shift']());}};_0x4c1fa9(++_0x5c74b7);}(_0x06f4,0x136));var _0x406f=function(_0xce4e32,_0x335bee){_0xce4e32=_0xce4e32-0x0;var _0x5ca1f3=_0x06f4[_0xce4e32];return _0x5ca1f3;};'use strict';var Sequelize=require(_0x406f('0x0'));module[_0x406f('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x406f('0x2')]},'password':{'type':Sequelize[_0x406f('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x406f('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x406f('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x406f('0x2')]},'modernAuthentication':{'type':Sequelize[_0x406f('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 93d43f3..3dda416 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 _0x3b46=['PicklistAttributeMetadata','push','all','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','send','Wrong\x20credentials',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','Bearer\x20','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','LogicalName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../components/parsers/qs','api','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','update','then','destroy','end','error','name','index','map','fieldName','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Dynamics365Account','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','concat','username','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','forEach','@odata.type','lastIndexOf'];(function(_0x3f8b62,_0x4312c9){var _0x20cf20=function(_0x109569){while(--_0x109569){_0x3f8b62['push'](_0x3f8b62['shift']());}};_0x20cf20(++_0x4312c9);}(_0x3b46,0x1a2));var _0x63b4=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x3b46[_0x590b61];return _0x1a14dc;};'use strict';var rp=require(_0x63b4('0x0'));var util=require(_0x63b4('0x1'));var _=require(_0x63b4('0x2'));var qs=require(_0x63b4('0x3'));var logger=require('../../config/logger')(_0x63b4('0x4'));var db=require(_0x63b4('0x5'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x39ee90,_0x1ff28e){_0x1ff28e=_0x1ff28e||0xc8;return function(_0x2d76b7){if(_0x2d76b7){return _0x39ee90[_0x63b4('0x6')](_0x1ff28e)[_0x63b4('0x7')](_0x2d76b7);}};}function respondWithFilteredResult(_0x3a7607,_0x514b5d){return function(_0x5ce3df){if(_0x5ce3df){var _0x352379=typeof _0x514b5d['offset']===_0x63b4('0x8')&&typeof _0x514b5d[_0x63b4('0x9')]===_0x63b4('0x8');var _0x438ec8=_0x5ce3df['count'];var _0x49d852=_0x352379?0x0:_0x514b5d[_0x63b4('0xa')];var _0x38aed4=_0x352379?_0x5ce3df[_0x63b4('0xb')]:_0x514b5d[_0x63b4('0xa')]+_0x514b5d[_0x63b4('0x9')];var _0x9c3fd2;if(_0x38aed4>=_0x438ec8){_0x38aed4=_0x438ec8;_0x9c3fd2=0xc8;}else{_0x9c3fd2=0xce;}_0x3a7607['status'](_0x9c3fd2);return _0x3a7607[_0x63b4('0xc')](_0x63b4('0xd'),_0x49d852+'-'+_0x38aed4+'/'+_0x438ec8)[_0x63b4('0x7')](_0x5ce3df);}return null;};}function saveUpdates(_0xd64039){return function(_0x5cada5){if(_0x5cada5){return _0x5cada5[_0x63b4('0xe')](_0xd64039)[_0x63b4('0xf')](function(_0x19ff81){return _0x19ff81;});}return null;};}function removeEntity(_0x30ef05){return function(_0x400e6d){if(_0x400e6d){return _0x400e6d[_0x63b4('0x10')]()[_0x63b4('0xf')](function(){_0x30ef05['status'](0xcc)[_0x63b4('0x11')]();});}};}function handleEntityNotFound(_0xf9a262){return function(_0x2ec72a){if(!_0x2ec72a){_0xf9a262['sendStatus'](0x194);}return _0x2ec72a;};}function handleError(_0x4666df,_0x3b33e6){_0x3b33e6=_0x3b33e6||0x1f4;return function(_0x39b0dc){logger[_0x63b4('0x12')](_0x39b0dc['stack']);if(_0x39b0dc[_0x63b4('0x13')]){delete _0x39b0dc[_0x63b4('0x13')];}_0x4666df[_0x63b4('0x6')](_0x3b33e6)['send'](_0x39b0dc);};}exports[_0x63b4('0x14')]=function(_0x56e05b,_0x531066){var _0x1d3a77={},_0x56358d={},_0x3ddafe={'count':0x0,'rows':[]};var _0x43410a=_[_0x63b4('0x15')](db['Dynamics365Account']['rawAttributes'],function(_0x37f615){return{'name':_0x37f615[_0x63b4('0x16')],'type':_0x37f615[_0x63b4('0x17')][_0x63b4('0x18')]};});_0x56358d['model']=_[_0x63b4('0x15')](_0x43410a,_0x63b4('0x13'));_0x56358d[_0x63b4('0x19')]=_[_0x63b4('0x1a')](_0x56e05b['query']);_0x56358d[_0x63b4('0x1b')]=_[_0x63b4('0x1c')](_0x56358d['model'],_0x56358d[_0x63b4('0x19')]);_0x1d3a77['attributes']=_[_0x63b4('0x1c')](_0x56358d['model'],qs['fields'](_0x56e05b[_0x63b4('0x19')][_0x63b4('0x1d')]));_0x1d3a77[_0x63b4('0x1e')]=_0x1d3a77[_0x63b4('0x1e')][_0x63b4('0x1f')]?_0x1d3a77[_0x63b4('0x1e')]:_0x56358d[_0x63b4('0x20')];if(!_0x56e05b[_0x63b4('0x19')][_0x63b4('0x21')](_0x63b4('0x22'))){_0x1d3a77[_0x63b4('0x9')]=qs[_0x63b4('0x9')](_0x56e05b[_0x63b4('0x19')]['limit']);_0x1d3a77[_0x63b4('0xa')]=qs[_0x63b4('0xa')](_0x56e05b[_0x63b4('0x19')][_0x63b4('0xa')]);}_0x1d3a77[_0x63b4('0x23')]=qs[_0x63b4('0x24')](_0x56e05b[_0x63b4('0x19')]['sort']);_0x1d3a77['where']=qs[_0x63b4('0x1b')](_[_0x63b4('0x25')](_0x56e05b[_0x63b4('0x19')],_0x56358d[_0x63b4('0x1b')]),_0x43410a);if(_0x56e05b[_0x63b4('0x19')]['filter']){_0x1d3a77['where']=_[_0x63b4('0x26')](_0x1d3a77[_0x63b4('0x27')],{'$or':_[_0x63b4('0x15')](_0x43410a,function(_0xc2f619){if(_0xc2f619[_0x63b4('0x17')]!==_0x63b4('0x28')){var _0x2735ee={};_0x2735ee[_0xc2f619[_0x63b4('0x13')]]={'$like':'%'+_0x56e05b['query'][_0x63b4('0x29')]+'%'};return _0x2735ee;}})});}_0x1d3a77=_[_0x63b4('0x26')]({},_0x1d3a77,_0x56e05b[_0x63b4('0x2a')]);var _0x1882ad={'where':_0x1d3a77[_0x63b4('0x27')]};return db[_0x63b4('0x2b')][_0x63b4('0xb')](_0x1882ad)[_0x63b4('0xf')](function(_0x184e18){_0x3ddafe[_0x63b4('0xb')]=_0x184e18;if(_0x56e05b[_0x63b4('0x19')][_0x63b4('0x2c')]){_0x1d3a77[_0x63b4('0x2d')]=[{'all':!![]}];}return db[_0x63b4('0x2b')][_0x63b4('0x2e')](_0x1d3a77);})[_0x63b4('0xf')](function(_0xfef8ca){_0x3ddafe['rows']=_0xfef8ca;return _0x3ddafe;})[_0x63b4('0xf')](respondWithFilteredResult(_0x531066,_0x1d3a77))[_0x63b4('0x2f')](handleError(_0x531066,null));};exports[_0x63b4('0x30')]=function(_0x549fcc,_0x408ebb){var _0x1a54e4={'raw':![],'where':{'id':_0x549fcc[_0x63b4('0x31')]['id']}},_0x3708c6={};_0x3708c6[_0x63b4('0x20')]=_[_0x63b4('0x1a')](db['Dynamics365Account']['rawAttributes']);_0x3708c6[_0x63b4('0x19')]=_[_0x63b4('0x1a')](_0x549fcc[_0x63b4('0x19')]);_0x3708c6[_0x63b4('0x1b')]=_[_0x63b4('0x1c')](_0x3708c6[_0x63b4('0x20')],_0x3708c6['query']);_0x1a54e4[_0x63b4('0x1e')]=_[_0x63b4('0x1c')](_0x3708c6[_0x63b4('0x20')],qs['fields'](_0x549fcc[_0x63b4('0x19')][_0x63b4('0x1d')]));_0x1a54e4[_0x63b4('0x1e')]=_0x1a54e4[_0x63b4('0x1e')][_0x63b4('0x1f')]?_0x1a54e4[_0x63b4('0x1e')]:_0x3708c6[_0x63b4('0x20')];if(_0x549fcc[_0x63b4('0x19')][_0x63b4('0x2c')]){_0x1a54e4[_0x63b4('0x2d')]=[{'all':!![]}];}_0x1a54e4=_[_0x63b4('0x26')]({},_0x1a54e4,_0x549fcc[_0x63b4('0x2a')]);return db['Dynamics365Account'][_0x63b4('0x32')](_0x1a54e4)[_0x63b4('0xf')](handleEntityNotFound(_0x408ebb,null))[_0x63b4('0xf')](respondWithResult(_0x408ebb,null))['catch'](handleError(_0x408ebb,null));};exports['create']=function(_0x1e29bf,_0x2f1cab){return db[_0x63b4('0x2b')][_0x63b4('0x33')](_0x1e29bf['body'],{})[_0x63b4('0xf')](respondWithResult(_0x2f1cab,0xc9))[_0x63b4('0x2f')](handleError(_0x2f1cab,null));};exports[_0x63b4('0xe')]=function(_0x485a54,_0x24e537){if(_0x485a54[_0x63b4('0x34')]['id']){delete _0x485a54[_0x63b4('0x34')]['id'];}return db[_0x63b4('0x2b')]['find']({'where':{'id':_0x485a54[_0x63b4('0x31')]['id']}})[_0x63b4('0xf')](handleEntityNotFound(_0x24e537,null))[_0x63b4('0xf')](saveUpdates(_0x485a54['body'],null))[_0x63b4('0xf')](respondWithResult(_0x24e537,null))[_0x63b4('0x2f')](handleError(_0x24e537,null));};exports['destroy']=function(_0x353bb9,_0x3c51be){return db['Dynamics365Account'][_0x63b4('0x32')]({'where':{'id':_0x353bb9[_0x63b4('0x31')]['id']}})[_0x63b4('0xf')](handleEntityNotFound(_0x3c51be,null))[_0x63b4('0xf')](removeEntity(_0x3c51be,null))['catch'](handleError(_0x3c51be,null));};exports[_0x63b4('0x35')]=function(_0x71e329,_0xb72694){var _0x10c7ed={};var _0x2c775c={};var _0x58c633;var _0x58cefc;return db['Dynamics365Account'][_0x63b4('0x36')]({'where':{'id':_0x71e329['params']['id']}})[_0x63b4('0xf')](handleEntityNotFound(_0xb72694,null))[_0x63b4('0xf')](function(_0x2edee8){if(_0x2edee8){_0x58c633=_0x2edee8;_0x2c775c['model']=_[_0x63b4('0x1a')](db[_0x63b4('0x37')][_0x63b4('0x38')]);_0x2c775c[_0x63b4('0x19')]=_[_0x63b4('0x1a')](_0x71e329[_0x63b4('0x19')]);_0x2c775c[_0x63b4('0x1b')]=_[_0x63b4('0x1c')](_0x2c775c[_0x63b4('0x20')],_0x2c775c['query']);_0x10c7ed[_0x63b4('0x1e')]=_[_0x63b4('0x1c')](_0x2c775c[_0x63b4('0x20')],qs[_0x63b4('0x1d')](_0x71e329['query'][_0x63b4('0x1d')]));_0x10c7ed[_0x63b4('0x1e')]=_0x10c7ed[_0x63b4('0x1e')][_0x63b4('0x1f')]?_0x10c7ed[_0x63b4('0x1e')]:_0x2c775c[_0x63b4('0x20')];_0x10c7ed[_0x63b4('0x23')]=qs[_0x63b4('0x24')](_0x71e329[_0x63b4('0x19')]['sort']);_0x10c7ed[_0x63b4('0x27')]=qs[_0x63b4('0x1b')](_[_0x63b4('0x25')](_0x71e329[_0x63b4('0x19')],_0x2c775c[_0x63b4('0x1b')]));if(_0x71e329[_0x63b4('0x19')][_0x63b4('0x29')]){_0x10c7ed[_0x63b4('0x27')]=_['merge'](_0x10c7ed['where'],{'$or':_[_0x63b4('0x15')](_0x10c7ed['attributes'],function(_0x3eefca){var _0x19440c={};_0x19440c[_0x3eefca]={'$like':'%'+_0x71e329[_0x63b4('0x19')][_0x63b4('0x29')]+'%'};return _0x19440c;})});}_0x10c7ed=_[_0x63b4('0x26')]({},_0x10c7ed,_0x71e329[_0x63b4('0x2a')]);return _0x58c633['getConfigurations'](_0x10c7ed);}})[_0x63b4('0xf')](function(_0x1792d3){if(_0x1792d3){_0x58cefc=_0x1792d3[_0x63b4('0x1f')];if(!_0x71e329['query'][_0x63b4('0x21')](_0x63b4('0x22'))){_0x10c7ed['limit']=qs['limit'](_0x71e329[_0x63b4('0x19')][_0x63b4('0x9')]);_0x10c7ed[_0x63b4('0xa')]=qs[_0x63b4('0xa')](_0x71e329[_0x63b4('0x19')][_0x63b4('0xa')]);}return _0x58c633['getConfigurations'](_0x10c7ed);}})['then'](function(_0x21fc48){if(_0x21fc48){return _0x21fc48?{'count':_0x58cefc,'rows':_0x21fc48}:null;}})[_0x63b4('0xf')](respondWithResult(_0xb72694,null))['catch'](handleError(_0xb72694,null));};exports[_0x63b4('0x39')]=function(_0x1e1934,_0x48d2fc){if(_0x1e1934[_0x63b4('0x34')]['id']){delete _0x1e1934['body']['id'];}return db[_0x63b4('0x2b')]['findOne']({'where':{'id':_0x1e1934['params']['id']}})[_0x63b4('0xf')](handleEntityNotFound(_0x48d2fc,null))['then'](function(_0x4f1989){if(_0x4f1989){_0x1e1934['body'][_0x63b4('0x3a')]=_0x4f1989['id'];_0x1e1934[_0x63b4('0x34')][_0x63b4('0x3b')]=integrations['getSubjects'](_0x1e1934['body'][_0x63b4('0x3c')],_0x1e1934[_0x63b4('0x34')]['type']);_0x1e1934[_0x63b4('0x34')][_0x63b4('0x3d')]=integrations[_0x63b4('0x3e')](_0x1e1934[_0x63b4('0x34')][_0x63b4('0x3c')],_0x1e1934[_0x63b4('0x34')][_0x63b4('0x17')]);return db[_0x63b4('0x37')][_0x63b4('0x33')](_0x1e1934['body'],{'include':[{'model':db[_0x63b4('0x3f')],'as':_0x63b4('0x3b')},{'model':db[_0x63b4('0x3f')],'as':_0x63b4('0x3d')}]});}return null;})[_0x63b4('0xf')](respondWithResult(_0x48d2fc,null))[_0x63b4('0x2f')](handleError(_0x48d2fc,null));};function sanitizeRemoteUri(_0x135c6b){var _0x375ff0=_0x135c6b[_0x63b4('0x40')](-0x1);if(_0x375ff0==='/')return _0x135c6b[_0x63b4('0x41')](0x0,_0x135c6b['lastIndexOf'](_0x375ff0));return _0x135c6b;}function getWebApiUrl(_0x290d50){return util[_0x63b4('0x42')](_0x63b4('0x43'),_0x290d50);}exports[_0x63b4('0x44')]=function(_0xab7bee,_0x7a8b78){var _0x473389=_0xab7bee[_0x63b4('0x19')][_0x63b4('0x45')];var _0x312226=_0x473389===_0x63b4('0x46')?_0x63b4('0x47'):_0x63b4('0x48');var _0x3e2a55='';var _0x177d26='';var _0x2c1cda='';var _0xa4830e='';var _0x1db465='';var _0x387498='';var _0x4efc39='';var _0x7aa962='';var _0x4ae19e=['title',_0x63b4('0x49'),_0x63b4('0x4a'),_0x63b4('0x4b'),'caseorigincode',_0x63b4('0x4c'),_0x63b4('0x4d'),_0x63b4('0x4e'),_0x63b4('0x4f'),_0x63b4('0x50')];var _0x2f73e8=[_0x63b4('0x51'),'accountidyominame',_0x63b4('0x52'),_0x63b4('0x53'),_0x63b4('0x54'),'contactidyominame',_0x63b4('0x55'),'contractidname',_0x63b4('0x56'),_0x63b4('0x57'),'createdbyname','createdbyyominame',_0x63b4('0x58'),_0x63b4('0x59'),_0x63b4('0x5a'),'customeridname',_0x63b4('0x5b'),_0x63b4('0x5c'),'emailaddress',_0x63b4('0x5d'),'entityimage_timestamp',_0x63b4('0x5e'),'escalatedon',_0x63b4('0x5f'),_0x63b4('0x60'),_0x63b4('0x61'),_0x63b4('0x62'),_0x63b4('0x63'),'kbarticleidname',_0x63b4('0x64'),_0x63b4('0x65'),_0x63b4('0x66'),_0x63b4('0x67'),_0x63b4('0x68'),_0x63b4('0x69'),_0x63b4('0x6a'),_0x63b4('0x6b'),_0x63b4('0x6c'),'msdyn_incidenttypename',_0x63b4('0x6d'),_0x63b4('0x6e'),'onholdtime','overriddencreatedon',_0x63b4('0x6f'),_0x63b4('0x70'),_0x63b4('0x71'),_0x63b4('0x72'),_0x63b4('0x73'),_0x63b4('0x74'),_0x63b4('0x75'),_0x63b4('0x76'),_0x63b4('0x77'),_0x63b4('0x78'),_0x63b4('0x79'),_0x63b4('0x7a'),_0x63b4('0x7b'),'responsiblecontactidyominame',_0x63b4('0x7c'),_0x63b4('0x7d'),_0x63b4('0x7e'),_0x63b4('0x7f'),_0x63b4('0x80'),'statuscode','subjectidname','ticketnumber',_0x63b4('0x81'),_0x63b4('0x82'),_0x63b4('0x83'),_0x63b4('0x84'),'versionnumber'];var _0x1303a7=_0x4ae19e[_0x63b4('0x85')](_0x2f73e8);return db[_0x63b4('0x2b')]['findOne']({'where':{'id':_0xab7bee[_0x63b4('0x31')]['id']},'attributes':['id',_0x63b4('0x86'),'password',_0x63b4('0x87'),_0x63b4('0x88'),'clientId',_0x63b4('0x89'),_0x63b4('0x8a')],'include':[{'model':db['CloudProvider'],'as':_0x63b4('0x8b'),'attributes':['id',_0x63b4('0x8c'),_0x63b4('0x8d')]}]})[_0x63b4('0xf')](handleEntityNotFound(_0x7a8b78,null))[_0x63b4('0xf')](function(_0x591a6f){if(_0x591a6f){if(_0x591a6f[_0x63b4('0x8a')]){_0x591a6f['access_token']=_0x591a6f['CloudProvider'][_0x63b4('0x8c')];_0x7aa962=sanitizeRemoteUri(_0x591a6f[_0x63b4('0x8b')]['data7']);_0x4efc39=getWebApiUrl(_0x7aa962);return _0x591a6f;}_0x7aa962=sanitizeRemoteUri(_0x591a6f[_0x63b4('0x87')]);_0x4efc39=getWebApiUrl(_0x7aa962);var _0x4d91e9={'method':_0x63b4('0x8e'),'uri':_0x63b4('0x8f')+_0x591a6f['tenantId']+_0x63b4('0x90'),'form':{'client_id':_0x591a6f[_0x63b4('0x91')],'resource':_0x7aa962,'username':_0x591a6f[_0x63b4('0x86')],'password':_0x591a6f[_0x63b4('0x92')],'grant_type':_0x63b4('0x92'),'client_secret':_0x591a6f[_0x63b4('0x89')]},'json':!![]};return rp(_0x4d91e9);}})['then'](function(_0x53b686){_0x387498=_0x53b686[_0x63b4('0x93')];var _0x15a8af={'method':'GET','uri':encodeURI(_0x4efc39+_0x63b4('0x94')+_0x312226+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x387498,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15a8af);})['then'](function(_0x4f9324){var _0x557f0e=_0x4f9324[_0x63b4('0x95')][0x0];var _0x381a2f=_0x557f0e[_0x63b4('0x96')];var _0x3f8e4d={'method':_0x63b4('0x97'),'uri':_0x4efc39+_0x63b4('0x98')+_0x381a2f+_0x63b4('0x99'),'headers':{'Authorization':'Bearer\x20'+_0x387498,'If-None-Match':null,'OData-Version':_0x63b4('0x9a')},'json':!![]};return rp(_0x3f8e4d);})['then'](function(_0x48bb88){_0x3e2a55=_0x48bb88;_0x177d26=_0x3e2a55[_0x63b4('0x9b')];_0x177d26=_[_0x63b4('0x9c')](_0x177d26,function(_0x2085bb){return!_0x1303a7[_0x63b4('0x9d')](_0x2085bb['LogicalName']);});var _0x39b4ee=[];var _0x54f760=[];_0x177d26[_0x63b4('0x9e')](function(_0x4896be){if(_0x4896be[_0x63b4('0x9f')]){var _0x19f1e9=_0x4896be['@odata.type']['substring'](_0x4896be[_0x63b4('0x9f')][_0x63b4('0xa0')]('.')+0x1);if(_0x19f1e9===_0x63b4('0xa1')){_0x39b4ee[_0x63b4('0xa2')](getSelectList(_0x4efc39,_0x473389,_0x54f760,_0x3e2a55[_0x63b4('0x96')],_0x4896be['MetadataId'],_0x387498));}}});return Promise['all'](_0x39b4ee);})[_0x63b4('0xf')](function(_0xf78461){_0x2c1cda=_0xf78461[0x0];var _0xf4771b=[];var _0x18f378=[];_0x177d26[_0x63b4('0x9e')](function(_0x162556){if(!_['isNil'](_0x162556['@odata.type'])){var _0xa0cc00=_0x162556[_0x63b4('0x9f')][_0x63b4('0x41')](_0x162556['@odata.type'][_0x63b4('0xa0')]('.')+0x1);if(_0xa0cc00==='BooleanAttributeMetadata'){_0xf4771b[_0x63b4('0xa2')](getBooleanList(_0x4efc39,_0x473389,_0x18f378,_0x3e2a55[_0x63b4('0x96')],_0x162556['MetadataId'],_0x387498));}}});return Promise[_0x63b4('0xa3')](_0xf4771b);})[_0x63b4('0xf')](function(_0x3ba417){_0xa4830e=_0x3ba417[0x0];var _0x4f66c7=[];var _0x5a3757=[];_0x177d26[_0x63b4('0x9e')](function(_0x478257){if(_0x478257[_0x63b4('0x9f')]){var _0x2c2bfe=_0x478257['@odata.type']['substring'](_0x478257['@odata.type'][_0x63b4('0xa0')]('.')+0x1);if(_0x2c2bfe==='StringAttributeMetadata'||_0x2c2bfe===_0x63b4('0xa4')||_0x2c2bfe===_0x63b4('0xa5')||_0x2c2bfe===_0x63b4('0xa6')||_0x2c2bfe===_0x63b4('0xa7')||_0x2c2bfe===_0x63b4('0xa8')||_0x2c2bfe===_0x63b4('0xa9')||_0x2c2bfe===_0x63b4('0xaa')||_0x2c2bfe===_0x63b4('0xab')||_0x2c2bfe===_0x63b4('0xac')){_0x4f66c7['push'](getInputList(_0x4efc39,_0x473389,_0x2c2bfe,_0x5a3757,_0x3e2a55[_0x63b4('0x96')],_0x478257['MetadataId'],_0x387498));}}});return Promise[_0x63b4('0xa3')](_0x4f66c7);})[_0x63b4('0xf')](function(_0x3ba5ca){_0x1db465=_0x3ba5ca[0x0];var _0x2dbdb1=_0x2c1cda[_0x63b4('0x85')](_0xa4830e)[_0x63b4('0x85')](_0x1db465);var _0x20ac70={'count':_0x2dbdb1[_0x63b4('0x1f')],'rows':_0x2dbdb1};return _0x20ac70;})['then'](respondWithResult(_0x7a8b78,null))['catch'](function(_0xcc0c97){var _0x49590f=_0xab7bee[_0x63b4('0x19')][_0x63b4('0xad')]?0x1f4:_0xcc0c97[_0x63b4('0xae')]||0x1f4;logger[_0x63b4('0x12')](_0xcc0c97['stack']);delete _0xcc0c97['name'];if(_0x49590f===0x191){_0x49590f=0x190;}_0x7a8b78[_0x63b4('0x6')](_0x49590f)[_0x63b4('0xaf')](_0xab7bee[_0x63b4('0x19')][_0x63b4('0xad')]?{'message':_0x63b4('0xb0'),'statusCode':_0xcc0c97[_0x63b4('0xae')]}:_0xcc0c97);});};function getSelectList(_0x279416,_0x118dc3,_0x4e94b2,_0x3742d9,_0x30fde6,_0xcae62e){var _0x383298={'method':_0x63b4('0x97'),'uri':_0x279416+_0x63b4('0x98')+_0x3742d9+_0x63b4('0xb1')+_0x30fde6+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0x63b4('0xb2'),'headers':{'Authorization':_0x63b4('0xb3')+_0xcae62e,'If-None-Match':null,'OData-Version':_0x63b4('0x9a')},'json':!![]};return rp(_0x383298)[_0x63b4('0xf')](function(_0x4ddeb8){var _0x4ab4f9=[];var _0x55fddc=_0x4ddeb8['OptionSet'][_0x63b4('0xb4')];_0x55fddc['forEach'](function(_0x500ea9){_0x4ab4f9['push']({'name':_0x500ea9[_0x63b4('0xb5')][_0x63b4('0xb6')][_0x63b4('0xb5')],'value':String(_0x500ea9[_0x63b4('0xb7')])});});var _0x2764f4={'id':_0x118dc3+'_'+_0x4ddeb8['LogicalName'],'name':_0x4ddeb8[_0x63b4('0xb8')][_0x63b4('0xb6')][_0x63b4('0xb5')],'custom':![],'options':_0x4ab4f9};_0x4e94b2[_0x63b4('0xa2')](_0x2764f4);return _0x4e94b2;});}function getBooleanList(_0x5c7b0b,_0x230af1,_0x5996d0,_0x3455bf,_0x1f8a76,_0x9b6af2){var _0x152d94={'method':_0x63b4('0x97'),'uri':_0x5c7b0b+_0x63b4('0x98')+_0x3455bf+_0x63b4('0xb1')+_0x1f8a76+_0x63b4('0xb9'),'headers':{'Authorization':_0x63b4('0xb3')+_0x9b6af2,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x152d94)[_0x63b4('0xf')](function(_0x5cf81e){var _0x50f319=[];_0x50f319[_0x63b4('0xa2')]({'name':_0x5cf81e['OptionSet'][_0x63b4('0xba')]['Label'][_0x63b4('0xb6')][_0x63b4('0xb5')],'value':_0x63b4('0xbb')},{'name':_0x5cf81e['OptionSet'][_0x63b4('0xbc')][_0x63b4('0xb5')][_0x63b4('0xb6')][_0x63b4('0xb5')],'value':_0x63b4('0xbd')});var _0xd4041f={'id':_0x230af1+'_'+_0x5cf81e[_0x63b4('0xbe')],'name':_0x5cf81e[_0x63b4('0xb8')][_0x63b4('0xb6')][_0x63b4('0xb5')],'custom':![],'options':_0x50f319};_0x5996d0[_0x63b4('0xa2')](_0xd4041f);return _0x5996d0;});}function getInputList(_0x248c7a,_0x4b7b18,_0x2d1564,_0x4577dc,_0x44d920,_0x395cc2,_0x5e34eb){var _0x2f1ef5={'method':'GET','uri':_0x248c7a+'EntityDefinitions('+_0x44d920+_0x63b4('0xb1')+_0x395cc2+_0x63b4('0xbf')+_0x2d1564+_0x63b4('0xc0'),'headers':{'Authorization':_0x63b4('0xb3')+_0x5e34eb,'If-None-Match':null,'OData-Version':_0x63b4('0x9a')},'json':!![]};return rp(_0x2f1ef5)[_0x63b4('0xf')](function(_0x49a8d2){var _0x1a8521={'id':_0x4b7b18+'_'+_0x49a8d2[_0x63b4('0xbe')],'name':_0x49a8d2[_0x63b4('0xb8')]['UserLocalizedLabel']?_0x49a8d2[_0x63b4('0xb8')][_0x63b4('0xb6')]['Label']:_0x49a8d2['LogicalName'],'custom':![],'options':[]};_0x4577dc['push'](_0x1a8521);return _0x4577dc;});} \ No newline at end of file +var _0xf67d=['statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','DisplayName',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','name','send','map','Dynamics365Account','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','find','getConfigurations','findOne','Dynamics365Configuration','length','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','title','description','ownerid','caseorigincode','phonenumber','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','resolveby','resolvebykpiidname','responsiblecontactidname','slainvokedidname','slaname','socialprofileidname','statecode','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data7','data5','POST','https://login.microsoftonline.com/','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','stack','Wrong\x20credentials'];(function(_0x531b74,_0x3a473b){var _0x513d17=function(_0x2ea644){while(--_0x2ea644){_0x531b74['push'](_0x531b74['shift']());}};_0x513d17(++_0x3a473b);}(_0xf67d,0x182));var _0xdf67=function(_0x3849dd,_0x100ba7){_0x3849dd=_0x3849dd-0x0;var _0x47abef=_0xf67d[_0x3849dd];return _0x47abef;};'use strict';var rp=require('request-promise');var util=require('util');var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xdf67('0x0'));var db=require(_0xdf67('0x1'))['db'];var integrations=require(_0xdf67('0x2'));function respondWithResult(_0x9f5fd8,_0x348050){_0x348050=_0x348050||0xc8;return function(_0x4244b9){if(_0x4244b9){return _0x9f5fd8[_0xdf67('0x3')](_0x348050)[_0xdf67('0x4')](_0x4244b9);}};}function respondWithFilteredResult(_0x55c0bc,_0x5596b2){return function(_0x1b5c42){if(_0x1b5c42){var _0x3ec5bb=typeof _0x5596b2[_0xdf67('0x5')]===_0xdf67('0x6')&&typeof _0x5596b2[_0xdf67('0x7')]==='undefined';var _0x5bc0c3=_0x1b5c42[_0xdf67('0x8')];var _0x16705e=_0x3ec5bb?0x0:_0x5596b2[_0xdf67('0x5')];var _0x194ca4=_0x3ec5bb?_0x1b5c42[_0xdf67('0x8')]:_0x5596b2[_0xdf67('0x5')]+_0x5596b2[_0xdf67('0x7')];var _0x632169;if(_0x194ca4>=_0x5bc0c3){_0x194ca4=_0x5bc0c3;_0x632169=0xc8;}else{_0x632169=0xce;}_0x55c0bc[_0xdf67('0x3')](_0x632169);return _0x55c0bc['set'](_0xdf67('0x9'),_0x16705e+'-'+_0x194ca4+'/'+_0x5bc0c3)['json'](_0x1b5c42);}return null;};}function saveUpdates(_0x304ba3){return function(_0x134ebe){if(_0x134ebe){return _0x134ebe[_0xdf67('0xa')](_0x304ba3)['then'](function(_0x426f8e){return _0x426f8e;});}return null;};}function removeEntity(_0x135142){return function(_0x5ea3e8){if(_0x5ea3e8){return _0x5ea3e8[_0xdf67('0xb')]()[_0xdf67('0xc')](function(){_0x135142[_0xdf67('0x3')](0xcc)[_0xdf67('0xd')]();});}};}function handleEntityNotFound(_0x479000){return function(_0x57497f){if(!_0x57497f){_0x479000[_0xdf67('0xe')](0x194);}return _0x57497f;};}function handleError(_0x3d5436,_0x39cb3d){_0x39cb3d=_0x39cb3d||0x1f4;return function(_0x2efd53){logger[_0xdf67('0xf')](_0x2efd53['stack']);if(_0x2efd53[_0xdf67('0x10')]){delete _0x2efd53[_0xdf67('0x10')];}_0x3d5436[_0xdf67('0x3')](_0x39cb3d)[_0xdf67('0x11')](_0x2efd53);};}exports['index']=function(_0x14e51d,_0x374ffa){var _0x2cdea7={},_0xe7df25={},_0x24b444={'count':0x0,'rows':[]};var _0x1524c9=_[_0xdf67('0x12')](db[_0xdf67('0x13')]['rawAttributes'],function(_0x5cd524){return{'name':_0x5cd524[_0xdf67('0x14')],'type':_0x5cd524[_0xdf67('0x15')][_0xdf67('0x16')]};});_0xe7df25[_0xdf67('0x17')]=_['map'](_0x1524c9,_0xdf67('0x10'));_0xe7df25[_0xdf67('0x18')]=_[_0xdf67('0x19')](_0x14e51d[_0xdf67('0x18')]);_0xe7df25['filters']=_['intersection'](_0xe7df25['model'],_0xe7df25[_0xdf67('0x18')]);_0x2cdea7[_0xdf67('0x1a')]=_[_0xdf67('0x1b')](_0xe7df25['model'],qs[_0xdf67('0x1c')](_0x14e51d[_0xdf67('0x18')][_0xdf67('0x1c')]));_0x2cdea7['attributes']=_0x2cdea7['attributes']['length']?_0x2cdea7['attributes']:_0xe7df25[_0xdf67('0x17')];if(!_0x14e51d[_0xdf67('0x18')][_0xdf67('0x1d')](_0xdf67('0x1e'))){_0x2cdea7[_0xdf67('0x7')]=qs['limit'](_0x14e51d[_0xdf67('0x18')][_0xdf67('0x7')]);_0x2cdea7[_0xdf67('0x5')]=qs['offset'](_0x14e51d['query'][_0xdf67('0x5')]);}_0x2cdea7[_0xdf67('0x1f')]=qs[_0xdf67('0x20')](_0x14e51d[_0xdf67('0x18')][_0xdf67('0x20')]);_0x2cdea7[_0xdf67('0x21')]=qs[_0xdf67('0x22')](_['pick'](_0x14e51d['query'],_0xe7df25[_0xdf67('0x22')]),_0x1524c9);if(_0x14e51d[_0xdf67('0x18')][_0xdf67('0x23')]){_0x2cdea7[_0xdf67('0x21')]=_[_0xdf67('0x24')](_0x2cdea7['where'],{'$or':_[_0xdf67('0x12')](_0x1524c9,function(_0x3a91c9){if(_0x3a91c9[_0xdf67('0x15')]!==_0xdf67('0x25')){var _0x4eb379={};_0x4eb379[_0x3a91c9[_0xdf67('0x10')]]={'$like':'%'+_0x14e51d[_0xdf67('0x18')][_0xdf67('0x23')]+'%'};return _0x4eb379;}})});}_0x2cdea7=_['merge']({},_0x2cdea7,_0x14e51d[_0xdf67('0x26')]);var _0xa6f254={'where':_0x2cdea7[_0xdf67('0x21')]};return db[_0xdf67('0x13')][_0xdf67('0x8')](_0xa6f254)[_0xdf67('0xc')](function(_0x1eca9b){_0x24b444[_0xdf67('0x8')]=_0x1eca9b;if(_0x14e51d[_0xdf67('0x18')][_0xdf67('0x27')]){_0x2cdea7[_0xdf67('0x28')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x2cdea7);})['then'](function(_0x1759ab){_0x24b444[_0xdf67('0x29')]=_0x1759ab;return _0x24b444;})[_0xdf67('0xc')](respondWithFilteredResult(_0x374ffa,_0x2cdea7))[_0xdf67('0x2a')](handleError(_0x374ffa,null));};exports[_0xdf67('0x2b')]=function(_0x596027,_0x2e3ead){var _0x2f7fb3={'raw':![],'where':{'id':_0x596027[_0xdf67('0x2c')]['id']}},_0x219ca9={};_0x219ca9[_0xdf67('0x17')]=_['keys'](db[_0xdf67('0x13')][_0xdf67('0x2d')]);_0x219ca9[_0xdf67('0x18')]=_[_0xdf67('0x19')](_0x596027['query']);_0x219ca9['filters']=_[_0xdf67('0x1b')](_0x219ca9['model'],_0x219ca9['query']);_0x2f7fb3['attributes']=_[_0xdf67('0x1b')](_0x219ca9[_0xdf67('0x17')],qs[_0xdf67('0x1c')](_0x596027[_0xdf67('0x18')][_0xdf67('0x1c')]));_0x2f7fb3[_0xdf67('0x1a')]=_0x2f7fb3[_0xdf67('0x1a')]['length']?_0x2f7fb3[_0xdf67('0x1a')]:_0x219ca9[_0xdf67('0x17')];if(_0x596027[_0xdf67('0x18')][_0xdf67('0x27')]){_0x2f7fb3['include']=[{'all':!![]}];}_0x2f7fb3=_[_0xdf67('0x24')]({},_0x2f7fb3,_0x596027[_0xdf67('0x26')]);return db[_0xdf67('0x13')]['find'](_0x2f7fb3)[_0xdf67('0xc')](handleEntityNotFound(_0x2e3ead,null))['then'](respondWithResult(_0x2e3ead,null))[_0xdf67('0x2a')](handleError(_0x2e3ead,null));};exports['create']=function(_0x3eeb9c,_0x16cc5a){return db['Dynamics365Account'][_0xdf67('0x2e')](_0x3eeb9c[_0xdf67('0x2f')],{})['then'](respondWithResult(_0x16cc5a,0xc9))[_0xdf67('0x2a')](handleError(_0x16cc5a,null));};exports[_0xdf67('0xa')]=function(_0x4a34ef,_0x3d4cbc){if(_0x4a34ef[_0xdf67('0x2f')]['id']){delete _0x4a34ef['body']['id'];}return db['Dynamics365Account'][_0xdf67('0x30')]({'where':{'id':_0x4a34ef['params']['id']}})[_0xdf67('0xc')](handleEntityNotFound(_0x3d4cbc,null))[_0xdf67('0xc')](saveUpdates(_0x4a34ef[_0xdf67('0x2f')],null))[_0xdf67('0xc')](respondWithResult(_0x3d4cbc,null))[_0xdf67('0x2a')](handleError(_0x3d4cbc,null));};exports['destroy']=function(_0x2d2292,_0x2546d0){return db[_0xdf67('0x13')][_0xdf67('0x30')]({'where':{'id':_0x2d2292[_0xdf67('0x2c')]['id']}})[_0xdf67('0xc')](handleEntityNotFound(_0x2546d0,null))[_0xdf67('0xc')](removeEntity(_0x2546d0,null))[_0xdf67('0x2a')](handleError(_0x2546d0,null));};exports[_0xdf67('0x31')]=function(_0x55f19a,_0x19c709){var _0x287ddf={};var _0x8970de={};var _0x5d13b1;var _0x1afb55;return db[_0xdf67('0x13')][_0xdf67('0x32')]({'where':{'id':_0x55f19a[_0xdf67('0x2c')]['id']}})['then'](handleEntityNotFound(_0x19c709,null))[_0xdf67('0xc')](function(_0x34b3d3){if(_0x34b3d3){_0x5d13b1=_0x34b3d3;_0x8970de['model']=_[_0xdf67('0x19')](db[_0xdf67('0x33')][_0xdf67('0x2d')]);_0x8970de[_0xdf67('0x18')]=_[_0xdf67('0x19')](_0x55f19a[_0xdf67('0x18')]);_0x8970de['filters']=_[_0xdf67('0x1b')](_0x8970de[_0xdf67('0x17')],_0x8970de[_0xdf67('0x18')]);_0x287ddf[_0xdf67('0x1a')]=_[_0xdf67('0x1b')](_0x8970de[_0xdf67('0x17')],qs[_0xdf67('0x1c')](_0x55f19a['query'][_0xdf67('0x1c')]));_0x287ddf[_0xdf67('0x1a')]=_0x287ddf[_0xdf67('0x1a')][_0xdf67('0x34')]?_0x287ddf[_0xdf67('0x1a')]:_0x8970de[_0xdf67('0x17')];_0x287ddf[_0xdf67('0x1f')]=qs[_0xdf67('0x20')](_0x55f19a[_0xdf67('0x18')][_0xdf67('0x20')]);_0x287ddf['where']=qs[_0xdf67('0x22')](_[_0xdf67('0x35')](_0x55f19a[_0xdf67('0x18')],_0x8970de['filters']));if(_0x55f19a['query'][_0xdf67('0x23')]){_0x287ddf['where']=_[_0xdf67('0x24')](_0x287ddf[_0xdf67('0x21')],{'$or':_[_0xdf67('0x12')](_0x287ddf['attributes'],function(_0x1a0c97){var _0x1c875b={};_0x1c875b[_0x1a0c97]={'$like':'%'+_0x55f19a[_0xdf67('0x18')]['filter']+'%'};return _0x1c875b;})});}_0x287ddf=_[_0xdf67('0x24')]({},_0x287ddf,_0x55f19a[_0xdf67('0x26')]);return _0x5d13b1[_0xdf67('0x31')](_0x287ddf);}})[_0xdf67('0xc')](function(_0x75e05d){if(_0x75e05d){_0x1afb55=_0x75e05d[_0xdf67('0x34')];if(!_0x55f19a[_0xdf67('0x18')][_0xdf67('0x1d')](_0xdf67('0x1e'))){_0x287ddf[_0xdf67('0x7')]=qs[_0xdf67('0x7')](_0x55f19a[_0xdf67('0x18')][_0xdf67('0x7')]);_0x287ddf[_0xdf67('0x5')]=qs[_0xdf67('0x5')](_0x55f19a[_0xdf67('0x18')][_0xdf67('0x5')]);}return _0x5d13b1[_0xdf67('0x31')](_0x287ddf);}})['then'](function(_0x415c59){if(_0x415c59){return _0x415c59?{'count':_0x1afb55,'rows':_0x415c59}:null;}})[_0xdf67('0xc')](respondWithResult(_0x19c709,null))[_0xdf67('0x2a')](handleError(_0x19c709,null));};exports[_0xdf67('0x36')]=function(_0x3c5a2f,_0x13f00f){if(_0x3c5a2f[_0xdf67('0x2f')]['id']){delete _0x3c5a2f['body']['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x3c5a2f[_0xdf67('0x2c')]['id']}})[_0xdf67('0xc')](handleEntityNotFound(_0x13f00f,null))[_0xdf67('0xc')](function(_0x3c64ff){if(_0x3c64ff){_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x37')]=_0x3c64ff['id'];_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x38')]=integrations['getSubjects'](_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x39')],_0x3c5a2f['body'][_0xdf67('0x15')]);_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x3a')]=integrations['getDescriptions'](_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x39')],_0x3c5a2f[_0xdf67('0x2f')][_0xdf67('0x15')]);return db[_0xdf67('0x33')][_0xdf67('0x2e')](_0x3c5a2f[_0xdf67('0x2f')],{'include':[{'model':db[_0xdf67('0x3b')],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x13f00f,null))[_0xdf67('0x2a')](handleError(_0x13f00f,null));};function sanitizeRemoteUri(_0x6366a8){var _0x188a9b=_0x6366a8[_0xdf67('0x3c')](-0x1);if(_0x188a9b==='/')return _0x6366a8[_0xdf67('0x3d')](0x0,_0x6366a8[_0xdf67('0x3e')](_0x188a9b));return _0x6366a8;}function getWebApiUrl(_0x27107c){return util['format'](_0xdf67('0x3f'),_0x27107c);}exports[_0xdf67('0x40')]=function(_0x2b0bc4,_0x204944){var _0x41feed=_0x2b0bc4[_0xdf67('0x18')][_0xdf67('0x41')];var _0x4e4fb9=_0x41feed===_0xdf67('0x42')?_0xdf67('0x43'):'PhoneCall';var _0x577994='';var _0x4eac53='';var _0x47d8ce='';var _0x252426='';var _0x375300='';var _0x1d7f3c='';var _0x24adc7='';var _0x319bec='';var _0x409311=[_0xdf67('0x44'),_0xdf67('0x45'),'customerid',_0xdf67('0x46'),_0xdf67('0x47'),'subject',_0xdf67('0x48'),'regardingobjectid',_0xdf67('0x49'),_0xdf67('0x4a')];var _0x4f714f=[_0xdf67('0x4b'),_0xdf67('0x4c'),_0xdf67('0x4d'),_0xdf67('0x4e'),_0xdf67('0x4f'),_0xdf67('0x50'),'contractdetailidname','contractidname',_0xdf67('0x51'),_0xdf67('0x52'),_0xdf67('0x53'),'createdbyyominame',_0xdf67('0x54'),_0xdf67('0x55'),_0xdf67('0x56'),_0xdf67('0x57'),_0xdf67('0x58'),'customeridyominame',_0xdf67('0x59'),_0xdf67('0x5a'),_0xdf67('0x5b'),_0xdf67('0x5c'),_0xdf67('0x5d'),_0xdf67('0x5e'),'firstresponsebykpiidname',_0xdf67('0x5f'),_0xdf67('0x60'),_0xdf67('0x61'),_0xdf67('0x62'),_0xdf67('0x63'),'masteridname','modifiedbyexternalpartyname',_0xdf67('0x64'),'modifiedbyname',_0xdf67('0x65'),_0xdf67('0x66'),_0xdf67('0x67'),_0xdf67('0x68'),'msdyn_incidenttypename',_0xdf67('0x69'),_0xdf67('0x6a'),_0xdf67('0x6b'),'overriddencreatedon',_0xdf67('0x6c'),_0xdf67('0x6d'),_0xdf67('0x6e'),_0xdf67('0x6f'),_0xdf67('0x70'),_0xdf67('0x71'),_0xdf67('0x72'),_0xdf67('0x73'),'productserialnumber',_0xdf67('0x74'),_0xdf67('0x75'),'responseby',_0xdf67('0x76'),'responsiblecontactidyominame','sentimentvalue',_0xdf67('0x77'),_0xdf67('0x78'),_0xdf67('0x79'),_0xdf67('0x7a'),'statuscode','subjectidname','ticketnumber',_0xdf67('0x7b'),_0xdf67('0x7c'),_0xdf67('0x7d'),_0xdf67('0x7e'),_0xdf67('0x7f')];var _0x521112=_0x409311[_0xdf67('0x80')](_0x4f714f);return db['Dynamics365Account'][_0xdf67('0x32')]({'where':{'id':_0x2b0bc4[_0xdf67('0x2c')]['id']},'attributes':['id',_0xdf67('0x81'),_0xdf67('0x82'),_0xdf67('0x83'),_0xdf67('0x84'),_0xdf67('0x85'),_0xdf67('0x86'),_0xdf67('0x87')],'include':[{'model':db[_0xdf67('0x88')],'as':_0xdf67('0x88'),'attributes':['id','data5',_0xdf67('0x89')]}]})['then'](handleEntityNotFound(_0x204944,null))['then'](function(_0x4409b9){if(_0x4409b9){if(_0x4409b9['modernAuthentication']){_0x4409b9['access_token']=_0x4409b9[_0xdf67('0x88')][_0xdf67('0x8a')];_0x319bec=sanitizeRemoteUri(_0x4409b9['CloudProvider'][_0xdf67('0x89')]);_0x24adc7=getWebApiUrl(_0x319bec);return _0x4409b9;}_0x319bec=sanitizeRemoteUri(_0x4409b9[_0xdf67('0x83')]);_0x24adc7=getWebApiUrl(_0x319bec);var _0x314855={'method':_0xdf67('0x8b'),'uri':_0xdf67('0x8c')+_0x4409b9[_0xdf67('0x84')]+'/oauth2/token','form':{'client_id':_0x4409b9[_0xdf67('0x85')],'resource':_0x319bec,'username':_0x4409b9[_0xdf67('0x81')],'password':_0x4409b9[_0xdf67('0x82')],'grant_type':_0xdf67('0x82'),'client_secret':_0x4409b9[_0xdf67('0x86')]},'json':!![]};return rp(_0x314855);}})[_0xdf67('0xc')](function(_0x2d2580){_0x1d7f3c=_0x2d2580[_0xdf67('0x8d')];var _0x2e0c90={'method':_0xdf67('0x8e'),'uri':encodeURI(_0x24adc7+_0xdf67('0x8f')+_0x4e4fb9+'\x27'),'headers':{'Authorization':_0xdf67('0x90')+_0x1d7f3c,'If-None-Match':null,'OData-Version':_0xdf67('0x91')},'json':!![]};return rp(_0x2e0c90);})[_0xdf67('0xc')](function(_0x499e76){var _0x38b273=_0x499e76['value'][0x0];var _0x3d4617=_0x38b273[_0xdf67('0x92')];var _0x31e54c={'method':_0xdf67('0x8e'),'uri':_0x24adc7+_0xdf67('0x93')+_0x3d4617+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xdf67('0x90')+_0x1d7f3c,'If-None-Match':null,'OData-Version':_0xdf67('0x91')},'json':!![]};return rp(_0x31e54c);})[_0xdf67('0xc')](function(_0x52872b){_0x577994=_0x52872b;_0x4eac53=_0x577994[_0xdf67('0x94')];_0x4eac53=_[_0xdf67('0x95')](_0x4eac53,function(_0x227f45){return!_0x521112[_0xdf67('0x96')](_0x227f45['LogicalName']);});var _0x1715dd=[];var _0x26d0ca=[];_0x4eac53[_0xdf67('0x97')](function(_0x5ddb78){if(_0x5ddb78[_0xdf67('0x98')]){var _0x3309fd=_0x5ddb78['@odata.type']['substring'](_0x5ddb78[_0xdf67('0x98')]['lastIndexOf']('.')+0x1);if(_0x3309fd===_0xdf67('0x99')){_0x1715dd[_0xdf67('0x9a')](getSelectList(_0x24adc7,_0x41feed,_0x26d0ca,_0x577994[_0xdf67('0x92')],_0x5ddb78[_0xdf67('0x92')],_0x1d7f3c));}}});return Promise['all'](_0x1715dd);})['then'](function(_0x2ecb3c){_0x47d8ce=_0x2ecb3c[0x0];var _0x1ad253=[];var _0x53180f=[];_0x4eac53['forEach'](function(_0x46137d){if(!_[_0xdf67('0x9b')](_0x46137d['@odata.type'])){var _0x1e7ec6=_0x46137d[_0xdf67('0x98')]['substring'](_0x46137d['@odata.type']['lastIndexOf']('.')+0x1);if(_0x1e7ec6===_0xdf67('0x9c')){_0x1ad253['push'](getBooleanList(_0x24adc7,_0x41feed,_0x53180f,_0x577994['MetadataId'],_0x46137d['MetadataId'],_0x1d7f3c));}}});return Promise[_0xdf67('0x9d')](_0x1ad253);})[_0xdf67('0xc')](function(_0x2c28ca){_0x252426=_0x2c28ca[0x0];var _0x3bef81=[];var _0x15f64a=[];_0x4eac53['forEach'](function(_0x34e408){if(_0x34e408[_0xdf67('0x98')]){var _0x34679a=_0x34e408[_0xdf67('0x98')]['substring'](_0x34e408[_0xdf67('0x98')][_0xdf67('0x3e')]('.')+0x1);if(_0x34679a===_0xdf67('0x9e')||_0x34679a===_0xdf67('0x9f')||_0x34679a===_0xdf67('0xa0')||_0x34679a===_0xdf67('0xa1')||_0x34679a==='MemoAttributeMetadata'||_0x34679a===_0xdf67('0xa2')||_0x34679a===_0xdf67('0xa3')||_0x34679a===_0xdf67('0xa4')||_0x34679a===_0xdf67('0xa5')||_0x34679a==='DecimalAttributeMetadata'){_0x3bef81[_0xdf67('0x9a')](getInputList(_0x24adc7,_0x41feed,_0x34679a,_0x15f64a,_0x577994[_0xdf67('0x92')],_0x34e408[_0xdf67('0x92')],_0x1d7f3c));}}});return Promise[_0xdf67('0x9d')](_0x3bef81);})[_0xdf67('0xc')](function(_0x4452f5){_0x375300=_0x4452f5[0x0];var _0xd94b2a=_0x47d8ce[_0xdf67('0x80')](_0x252426)[_0xdf67('0x80')](_0x375300);var _0x533cad={'count':_0xd94b2a[_0xdf67('0x34')],'rows':_0xd94b2a};return _0x533cad;})[_0xdf67('0xc')](respondWithResult(_0x204944,null))['catch'](function(_0x103827){var _0x432257=_0x2b0bc4[_0xdf67('0x18')][_0xdf67('0xa6')]?0x1f4:_0x103827['statusCode']||0x1f4;logger[_0xdf67('0xf')](_0x103827[_0xdf67('0xa7')]);delete _0x103827[_0xdf67('0x10')];if(_0x432257===0x191){_0x432257=0x190;}_0x204944[_0xdf67('0x3')](_0x432257)['send'](_0x2b0bc4[_0xdf67('0x18')][_0xdf67('0xa6')]?{'message':_0xdf67('0xa8'),'statusCode':_0x103827[_0xdf67('0xa9')]}:_0x103827);});};function getSelectList(_0x4b3b80,_0xc63cb4,_0x105c40,_0x43c91a,_0x11c154,_0x5452eb){var _0x116e42={'method':'GET','uri':_0x4b3b80+'EntityDefinitions('+_0x43c91a+_0xdf67('0xaa')+_0x11c154+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xdf67('0xab'),'headers':{'Authorization':_0xdf67('0x90')+_0x5452eb,'If-None-Match':null,'OData-Version':_0xdf67('0x91')},'json':!![]};return rp(_0x116e42)[_0xdf67('0xc')](function(_0x1f656d){var _0x42c930=[];var _0x2a7e55=_0x1f656d[_0xdf67('0xac')][_0xdf67('0xad')];_0x2a7e55[_0xdf67('0x97')](function(_0x3b9c4c){_0x42c930['push']({'name':_0x3b9c4c[_0xdf67('0xae')][_0xdf67('0xaf')]['Label'],'value':String(_0x3b9c4c[_0xdf67('0xb0')])});});var _0x53eea4={'id':_0xc63cb4+'_'+_0x1f656d[_0xdf67('0xb1')],'name':_0x1f656d['DisplayName'][_0xdf67('0xaf')]['Label'],'custom':![],'options':_0x42c930};_0x105c40[_0xdf67('0x9a')](_0x53eea4);return _0x105c40;});}function getBooleanList(_0x2cfda8,_0x2866a8,_0x5e345d,_0x468f80,_0x4f8902,_0x4b23a6){var _0x53922a={'method':'GET','uri':_0x2cfda8+_0xdf67('0x93')+_0x468f80+')/Attributes('+_0x4f8902+_0xdf67('0xb2'),'headers':{'Authorization':_0xdf67('0x90')+_0x4b23a6,'If-None-Match':null,'OData-Version':_0xdf67('0x91')},'json':!![]};return rp(_0x53922a)[_0xdf67('0xc')](function(_0x2b7bbc){var _0x2a9d8a=[];_0x2a9d8a['push']({'name':_0x2b7bbc[_0xdf67('0xac')][_0xdf67('0xb3')]['Label']['UserLocalizedLabel']['Label'],'value':_0xdf67('0xb4')},{'name':_0x2b7bbc[_0xdf67('0xac')][_0xdf67('0xb5')][_0xdf67('0xae')][_0xdf67('0xaf')][_0xdf67('0xae')],'value':'false'});var _0x4e5b54={'id':_0x2866a8+'_'+_0x2b7bbc[_0xdf67('0xb1')],'name':_0x2b7bbc[_0xdf67('0xb6')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x2a9d8a};_0x5e345d[_0xdf67('0x9a')](_0x4e5b54);return _0x5e345d;});}function getInputList(_0x479982,_0xc17991,_0xc4359f,_0x4ac6cb,_0x46c52c,_0x548a81,_0x521b1e){var _0x536cc9={'method':'GET','uri':_0x479982+_0xdf67('0x93')+_0x46c52c+_0xdf67('0xaa')+_0x548a81+_0xdf67('0xb7')+_0xc4359f+_0xdf67('0xb8'),'headers':{'Authorization':'Bearer\x20'+_0x521b1e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x536cc9)[_0xdf67('0xc')](function(_0x13a216){var _0x13f91a={'id':_0xc17991+'_'+_0x13a216[_0xdf67('0xb1')],'name':_0x13a216['DisplayName']['UserLocalizedLabel']?_0x13a216[_0xdf67('0xb6')][_0xdf67('0xaf')][_0xdf67('0xae')]:_0x13a216['LogicalName'],'custom':![],'options':[]};_0x4ac6cb[_0xdf67('0x9a')](_0x13f91a);return _0x4ac6cb;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 5194e53..0b8069a 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 _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x41057b,_0x5800b3){var _0x12d772=function(_0x19a2b6){while(--_0x19a2b6){_0x41057b['push'](_0x41057b['shift']());}};_0x12d772(++_0x5800b3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x13a2da,_0x2fba32){var _0x2dddbf=function(_0x478b6c){while(--_0x478b6c){_0x13a2da['push'](_0x13a2da['shift']());}};_0x2dddbf(++_0x2fba32);}(_0xe706,0xa3));var _0x6e70=function(_0x41fed8,_0x168adf){_0x41fed8=_0x41fed8-0x0;var _0x5d6c66=_0xe706[_0x41fed8];return _0x5d6c66;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 47014ca..8424e70 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 _0xd6c6=['client','http','request','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','where','limit','include','map','model','attributes','GetDynamics365Account','debug','stringify','ShowDynamics365Account','find','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x3925ff,_0x3fe6e5){var _0x1f16d5=function(_0xc538a2){while(--_0xc538a2){_0x3925ff['push'](_0x3925ff['shift']());}};_0x1f16d5(++_0x3fe6e5);}(_0xd6c6,0x1b3));var _0x6d6c=function(_0x6b01ac,_0x193ed2){_0x6b01ac=_0x6b01ac-0x0;var _0x597664=_0xd6c6[_0x6b01ac];return _0x597664;};'use strict';var _=require(_0x6d6c('0x0'));var util=require(_0x6d6c('0x1'));var moment=require(_0x6d6c('0x2'));var BPromise=require(_0x6d6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d6c('0x5'));var logger=require('../../config/logger')(_0x6d6c('0x6'));var config=require(_0x6d6c('0x7'));var jayson=require(_0x6d6c('0x8'));var client=jayson[_0x6d6c('0x9')][_0x6d6c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x372b6c,_0x7a2cdc,_0x2e501a){return new BPromise(function(_0x2dcaca,_0x142adb){return client[_0x6d6c('0xb')](_0x372b6c,_0x2e501a)[_0x6d6c('0xc')](function(_0x25c7de){logger[_0x6d6c('0xd')](_0x6d6c('0xe'),_0x7a2cdc,_0x6d6c('0xf'));logger['debug'](_0x6d6c('0x10'),_0x7a2cdc,_0x6d6c('0xf'),JSON['stringify'](_0x25c7de));if(_0x25c7de[_0x6d6c('0x11')]){if(_0x25c7de[_0x6d6c('0x11')][_0x6d6c('0x12')]===0x1f4){logger[_0x6d6c('0x11')](_0x6d6c('0xe'),_0x7a2cdc,_0x25c7de[_0x6d6c('0x11')][_0x6d6c('0x13')]);return _0x142adb(_0x25c7de[_0x6d6c('0x11')]['message']);}logger[_0x6d6c('0x11')](_0x6d6c('0xe'),_0x7a2cdc,_0x25c7de[_0x6d6c('0x11')][_0x6d6c('0x13')]);return _0x2dcaca(_0x25c7de['error'][_0x6d6c('0x13')]);}else{logger[_0x6d6c('0xd')](_0x6d6c('0xe'),_0x7a2cdc,_0x6d6c('0xf'));_0x2dcaca(_0x25c7de[_0x6d6c('0x14')][_0x6d6c('0x13')]);}})[_0x6d6c('0x15')](function(_0x2bbb6f){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x7a2cdc,_0x2bbb6f);_0x142adb(_0x2bbb6f);});});}exports['GetDynamics365Account']=function(_0x2c753d){var _0x16096b=this;return new Promise(function(_0x213ead,_0x21075e){return db[_0x6d6c('0x16')][_0x6d6c('0x17')]({'raw':_0x2c753d[_0x6d6c('0x18')]?_0x2c753d[_0x6d6c('0x18')][_0x6d6c('0x19')]===undefined?!![]:![]:!![],'where':_0x2c753d[_0x6d6c('0x18')]?_0x2c753d[_0x6d6c('0x18')][_0x6d6c('0x1a')]||null:null,'attributes':_0x2c753d[_0x6d6c('0x18')]?_0x2c753d[_0x6d6c('0x18')]['attributes']||null:null,'limit':_0x2c753d[_0x6d6c('0x18')]?_0x2c753d[_0x6d6c('0x18')][_0x6d6c('0x1b')]||null:null,'include':_0x2c753d[_0x6d6c('0x18')]?_0x2c753d['options'][_0x6d6c('0x1c')]?_[_0x6d6c('0x1d')](_0x2c753d[_0x6d6c('0x18')]['include'],function(_0x56c4b0){return{'model':db[_0x56c4b0[_0x6d6c('0x1e')]],'as':_0x56c4b0['as'],'attributes':_0x56c4b0['attributes'],'include':_0x56c4b0[_0x6d6c('0x1c')]?_[_0x6d6c('0x1d')](_0x56c4b0['include'],function(_0x1e0075){return{'model':db[_0x1e0075['model']],'as':_0x1e0075['as'],'attributes':_0x1e0075[_0x6d6c('0x1f')],'include':_0x1e0075['include']?_[_0x6d6c('0x1d')](_0x1e0075[_0x6d6c('0x1c')],function(_0xc1fc55){return{'model':db[_0xc1fc55[_0x6d6c('0x1e')]],'as':_0xc1fc55['as'],'attributes':_0xc1fc55['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d6c('0xc')](function(_0x3f5b8c){logger[_0x6d6c('0xd')](_0x6d6c('0x20'),_0x2c753d);logger[_0x6d6c('0x21')](_0x6d6c('0x20'),_0x2c753d,JSON[_0x6d6c('0x22')](_0x3f5b8c));_0x213ead(_0x3f5b8c);})[_0x6d6c('0x15')](function(_0x1cbbfb){logger[_0x6d6c('0x11')](_0x6d6c('0x20'),_0x1cbbfb[_0x6d6c('0x13')],_0x2c753d);_0x21075e(_0x16096b[_0x6d6c('0x11')](0x1f4,_0x1cbbfb[_0x6d6c('0x13')]));});});};exports[_0x6d6c('0x23')]=function(_0x1eca8a){var _0x5b2698=this;return new Promise(function(_0x5e767,_0x1b908a){return db[_0x6d6c('0x16')][_0x6d6c('0x24')]({'raw':_0x1eca8a[_0x6d6c('0x18')]?_0x1eca8a['options'][_0x6d6c('0x19')]===undefined?!![]:![]:!![],'where':_0x1eca8a[_0x6d6c('0x18')]?_0x1eca8a['options'][_0x6d6c('0x1a')]||null:null,'attributes':_0x1eca8a['options']?_0x1eca8a['options'][_0x6d6c('0x1f')]||null:null,'include':_0x1eca8a[_0x6d6c('0x18')]?_0x1eca8a[_0x6d6c('0x18')][_0x6d6c('0x1c')]?_[_0x6d6c('0x1d')](_0x1eca8a[_0x6d6c('0x18')][_0x6d6c('0x1c')],function(_0xb644d8){return{'model':db[_0xb644d8[_0x6d6c('0x1e')]],'as':_0xb644d8['as'],'attributes':_0xb644d8[_0x6d6c('0x1f')],'include':_0xb644d8[_0x6d6c('0x1c')]?_['map'](_0xb644d8['include'],function(_0x2bd86b){return{'model':db[_0x2bd86b[_0x6d6c('0x1e')]],'as':_0x2bd86b['as'],'attributes':_0x2bd86b[_0x6d6c('0x1f')],'include':_0x2bd86b['include']?_[_0x6d6c('0x1d')](_0x2bd86b[_0x6d6c('0x1c')],function(_0xb7be05){return{'model':db[_0xb7be05[_0x6d6c('0x1e')]],'as':_0xb7be05['as'],'attributes':_0xb7be05[_0x6d6c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d6c('0xc')](function(_0x261aff){logger['info'](_0x6d6c('0x23'),_0x1eca8a);logger[_0x6d6c('0x21')](_0x6d6c('0x23'),_0x1eca8a,JSON['stringify'](_0x261aff));_0x5e767(_0x261aff);})[_0x6d6c('0x15')](function(_0x32b7c9){logger['error'](_0x6d6c('0x23'),_0x32b7c9[_0x6d6c('0x13')],_0x1eca8a);_0x1b908a(_0x5b2698['error'](0x1f4,_0x32b7c9[_0x6d6c('0x13')]));});});}; \ No newline at end of file +var _0x9d11=['randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','Dynamics365Account','findAll','options','where','attributes','limit','map','include','model','GetDynamics365Account','ShowDynamics365Account','find','lodash','bluebird'];(function(_0x4db301,_0x11fbcc){var _0xd3b20f=function(_0xa07afa){while(--_0xa07afa){_0x4db301['push'](_0x4db301['shift']());}};_0xd3b20f(++_0x11fbcc);}(_0x9d11,0x196));var _0x19d1=function(_0x5b5eb4,_0x117c87){_0x5b5eb4=_0x5b5eb4-0x0;var _0x42af53=_0x9d11[_0x5b5eb4];return _0x42af53;};'use strict';var _=require(_0x19d1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x19d1('0x1'));var rs=require(_0x19d1('0x2'));var fs=require('fs');var Redis=require(_0x19d1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x19d1('0x4'));var logger=require('../../config/logger')(_0x19d1('0x5'));var config=require(_0x19d1('0x6'));var jayson=require(_0x19d1('0x7'));var client=jayson[_0x19d1('0x8')][_0x19d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d8fae,_0x19acb7,_0xb7b5f2){return new BPromise(function(_0x1b58f2,_0x498b29){return client['request'](_0x2d8fae,_0xb7b5f2)[_0x19d1('0xa')](function(_0x3c6186){logger[_0x19d1('0xb')](_0x19d1('0xc'),_0x19acb7,'request\x20sent');logger[_0x19d1('0xd')](_0x19d1('0xe'),_0x19acb7,'request\x20sent',JSON[_0x19d1('0xf')](_0x3c6186));if(_0x3c6186['error']){if(_0x3c6186[_0x19d1('0x10')][_0x19d1('0x11')]===0x1f4){logger[_0x19d1('0x10')](_0x19d1('0xc'),_0x19acb7,_0x3c6186[_0x19d1('0x10')][_0x19d1('0x12')]);return _0x498b29(_0x3c6186[_0x19d1('0x10')][_0x19d1('0x12')]);}logger[_0x19d1('0x10')](_0x19d1('0xc'),_0x19acb7,_0x3c6186[_0x19d1('0x10')][_0x19d1('0x12')]);return _0x1b58f2(_0x3c6186[_0x19d1('0x10')][_0x19d1('0x12')]);}else{logger[_0x19d1('0xb')](_0x19d1('0xc'),_0x19acb7,_0x19d1('0x13'));_0x1b58f2(_0x3c6186[_0x19d1('0x14')]['message']);}})[_0x19d1('0x15')](function(_0x50da78){logger[_0x19d1('0x10')](_0x19d1('0xc'),_0x19acb7,_0x50da78);_0x498b29(_0x50da78);});});}exports['GetDynamics365Account']=function(_0x3a3004){var _0x1cc847=this;return new Promise(function(_0xa5707a,_0x54a0b7){return db[_0x19d1('0x16')][_0x19d1('0x17')]({'raw':_0x3a3004['options']?_0x3a3004[_0x19d1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3a3004[_0x19d1('0x18')]?_0x3a3004[_0x19d1('0x18')][_0x19d1('0x19')]||null:null,'attributes':_0x3a3004[_0x19d1('0x18')]?_0x3a3004[_0x19d1('0x18')][_0x19d1('0x1a')]||null:null,'limit':_0x3a3004[_0x19d1('0x18')]?_0x3a3004['options'][_0x19d1('0x1b')]||null:null,'include':_0x3a3004[_0x19d1('0x18')]?_0x3a3004[_0x19d1('0x18')]['include']?_[_0x19d1('0x1c')](_0x3a3004[_0x19d1('0x18')][_0x19d1('0x1d')],function(_0x101924){return{'model':db[_0x101924[_0x19d1('0x1e')]],'as':_0x101924['as'],'attributes':_0x101924[_0x19d1('0x1a')],'include':_0x101924[_0x19d1('0x1d')]?_[_0x19d1('0x1c')](_0x101924[_0x19d1('0x1d')],function(_0x236773){return{'model':db[_0x236773[_0x19d1('0x1e')]],'as':_0x236773['as'],'attributes':_0x236773[_0x19d1('0x1a')],'include':_0x236773[_0x19d1('0x1d')]?_['map'](_0x236773[_0x19d1('0x1d')],function(_0x3c75a9){return{'model':db[_0x3c75a9['model']],'as':_0x3c75a9['as'],'attributes':_0x3c75a9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413c37){logger[_0x19d1('0xb')](_0x19d1('0x1f'),_0x3a3004);logger[_0x19d1('0xd')](_0x19d1('0x1f'),_0x3a3004,JSON[_0x19d1('0xf')](_0x413c37));_0xa5707a(_0x413c37);})[_0x19d1('0x15')](function(_0xd1186a){logger[_0x19d1('0x10')](_0x19d1('0x1f'),_0xd1186a[_0x19d1('0x12')],_0x3a3004);_0x54a0b7(_0x1cc847[_0x19d1('0x10')](0x1f4,_0xd1186a['message']));});});};exports[_0x19d1('0x20')]=function(_0x2865a3){var _0x5db82a=this;return new Promise(function(_0x4ac29f,_0x281f09){return db['Dynamics365Account'][_0x19d1('0x21')]({'raw':_0x2865a3[_0x19d1('0x18')]?_0x2865a3[_0x19d1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2865a3[_0x19d1('0x18')]?_0x2865a3['options'][_0x19d1('0x19')]||null:null,'attributes':_0x2865a3[_0x19d1('0x18')]?_0x2865a3['options']['attributes']||null:null,'include':_0x2865a3['options']?_0x2865a3['options']['include']?_[_0x19d1('0x1c')](_0x2865a3[_0x19d1('0x18')]['include'],function(_0x527e4f){return{'model':db[_0x527e4f[_0x19d1('0x1e')]],'as':_0x527e4f['as'],'attributes':_0x527e4f[_0x19d1('0x1a')],'include':_0x527e4f[_0x19d1('0x1d')]?_['map'](_0x527e4f[_0x19d1('0x1d')],function(_0x1def8f){return{'model':db[_0x1def8f[_0x19d1('0x1e')]],'as':_0x1def8f['as'],'attributes':_0x1def8f['attributes'],'include':_0x1def8f[_0x19d1('0x1d')]?_['map'](_0x1def8f[_0x19d1('0x1d')],function(_0x326807){return{'model':db[_0x326807[_0x19d1('0x1e')]],'as':_0x326807['as'],'attributes':_0x326807['attributes']};}):[]};}):[]};}):[]:[]})[_0x19d1('0xa')](function(_0x87c718){logger[_0x19d1('0xb')]('ShowDynamics365Account',_0x2865a3);logger['debug']('ShowDynamics365Account',_0x2865a3,JSON[_0x19d1('0xf')](_0x87c718));_0x4ac29f(_0x87c718);})[_0x19d1('0x15')](function(_0x166261){logger[_0x19d1('0x10')](_0x19d1('0x20'),_0x166261[_0x19d1('0x12')],_0x2865a3);_0x281f09(_0x5db82a['error'](0x1f4,_0x166261[_0x19d1('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 40ffd72..7adef04 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 _0xa57e=['/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects'];(function(_0x5be7aa,_0x5de661){var _0x215408=function(_0x353715){while(--_0x353715){_0x5be7aa['push'](_0x5be7aa['shift']());}};_0x215408(++_0x5de661);}(_0xa57e,0x67));var _0xea57=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa57e[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xea57('0x0'));var util=require(_0xea57('0x1'));var path=require(_0xea57('0x2'));var timeout=require(_0xea57('0x3'));var express=require(_0xea57('0x4'));var router=express[_0xea57('0x5')]();var fs_extra=require(_0xea57('0x6'));var auth=require(_0xea57('0x7'));var interaction=require(_0xea57('0x8'));var config=require(_0xea57('0x9'));var controller=require(_0xea57('0xa'));router[_0xea57('0xb')]('/',auth[_0xea57('0xc')](),controller['index']);router[_0xea57('0xb')](_0xea57('0xd'),auth[_0xea57('0xc')](),controller['show']);router[_0xea57('0xb')](_0xea57('0xe'),auth[_0xea57('0xc')](),controller['getFields']);router[_0xea57('0xb')](_0xea57('0xf'),auth[_0xea57('0xc')](),controller[_0xea57('0x10')]);router[_0xea57('0xb')](_0xea57('0x11'),auth[_0xea57('0xc')](),controller[_0xea57('0x12')]);router[_0xea57('0x13')]('/',auth[_0xea57('0xc')](),controller['create']);router[_0xea57('0x14')](_0xea57('0xd'),auth[_0xea57('0xc')](),controller[_0xea57('0x15')]);router[_0xea57('0x16')](_0xea57('0xd'),auth[_0xea57('0xc')](),controller['destroy']);module[_0xea57('0x17')]=router; \ No newline at end of file +var _0x3423=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getDescriptions','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x44b405,_0x164105){var _0x5632be=function(_0x5500c6){while(--_0x5500c6){_0x44b405['push'](_0x44b405['shift']());}};_0x5632be(++_0x164105);}(_0x3423,0x188));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3342('0x0'));var timeout=require(_0x3342('0x1'));var express=require(_0x3342('0x2'));var router=express[_0x3342('0x3')]();var fs_extra=require(_0x3342('0x4'));var auth=require(_0x3342('0x5'));var interaction=require(_0x3342('0x6'));var config=require(_0x3342('0x7'));var controller=require(_0x3342('0x8'));router[_0x3342('0x9')]('/',auth[_0x3342('0xa')](),controller[_0x3342('0xb')]);router[_0x3342('0x9')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0xd')]);router[_0x3342('0x9')](_0x3342('0xe'),auth[_0x3342('0xa')](),controller['getFields']);router['get'](_0x3342('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x3342('0xa')](),controller[_0x3342('0x10')]);router['post']('/',auth[_0x3342('0xa')](),controller['create']);router[_0x3342('0x11')](_0x3342('0xc'),auth['isAuthenticated'](),controller[_0x3342('0x12')]);router[_0x3342('0x13')](_0x3342('0xc'),auth[_0x3342('0xa')](),controller[_0x3342('0x14')]);module[_0x3342('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index e6e2886..b044737 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 _0x7be3=['sequelize','exports','STRING','ENUM','phonecall','incident','contact','nothing','BOOLEAN'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0x7be3,0xab));var _0x37be=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0x7be3[_0x363ef8];return _0x148822;};'use strict';var Sequelize=require(_0x37be('0x0'));module[_0x37be('0x1')]={'name':{'type':Sequelize[_0x37be('0x2')]},'description':{'type':Sequelize[_0x37be('0x2')]},'ticketType':{'type':Sequelize[_0x37be('0x3')]('incident',_0x37be('0x4')),'defaultValue':_0x37be('0x5')},'moduleCreate':{'type':Sequelize[_0x37be('0x3')](_0x37be('0x6'),_0x37be('0x7')),'defaultValue':_0x37be('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x37be('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x37be('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x7cd0=['BOOLEAN','STRING','ENUM','phonecall','incident','contact','nothing'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x7cd0,0x86));var _0x07cd=function(_0x7f3667,_0x30c3f1){_0x7f3667=_0x7f3667-0x0;var _0x2c4c24=_0x7cd0[_0x7f3667];return _0x2c4c24;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x07cd('0x0')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x07cd('0x1')]('incident',_0x07cd('0x2')),'defaultValue':_0x07cd('0x3')},'moduleCreate':{'type':Sequelize[_0x07cd('0x1')](_0x07cd('0x4'),_0x07cd('0x5')),'defaultValue':_0x07cd('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x07cd('0x0')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x07cd('0x6')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index b3f36ab..6484a73 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 _0x732e=['map','Dynamics365Configuration','type','key','query','attributes','intersection','model','fields','length','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','catch','show','params','keys','rawAttributes','create','body','find','findOne','pick','options','getFields','hasOwnProperty','getSubjects','Dynamics365Field','nolimit','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index'];(function(_0x3f288d,_0x3c7a97){var _0x5e8468=function(_0xb0189c){while(--_0xb0189c){_0x3f288d['push'](_0x3f288d['shift']());}};_0x5e8468(++_0x3c7a97);}(_0x732e,0x15b));var _0xe732=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0x732e[_0x24875d];return _0x181471;};'use strict';var emlformat=require(_0xe732('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe732('0x1'));var jsonpatch=require(_0xe732('0x2'));var rp=require(_0xe732('0x3'));var moment=require(_0xe732('0x4'));var BPromise=require(_0xe732('0x5'));var Mustache=require(_0xe732('0x6'));var util=require(_0xe732('0x7'));var path=require('path');var sox=require(_0xe732('0x8'));var csv=require(_0xe732('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe732('0xa'));var _=require(_0xe732('0xb'));var squel=require(_0xe732('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe732('0xd'));var toCsv=require(_0xe732('0x9'));var querystring=require(_0xe732('0xe'));var Papa=require(_0xe732('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe732('0x10'));var as=require(_0xe732('0x11'));var hardwareService=require(_0xe732('0x12'));var logger=require('../../config/logger')(_0xe732('0x13'));var utils=require(_0xe732('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xe732('0x15'));var db=require(_0xe732('0x16'))['db'];function respondWithStatusCode(_0x2f3c73,_0x39c748){_0x39c748=_0x39c748||0xcc;return function(_0x4f423e){if(_0x4f423e){return _0x2f3c73[_0xe732('0x17')](_0x39c748);}return _0x2f3c73['status'](_0x39c748)['end']();};}function respondWithResult(_0x2134a2,_0x1e89b7){_0x1e89b7=_0x1e89b7||0xc8;return function(_0x2ea0c5){if(_0x2ea0c5){return _0x2134a2[_0xe732('0x18')](_0x1e89b7)[_0xe732('0x19')](_0x2ea0c5);}};}function respondWithFilteredResult(_0x401908,_0x100ea6){return function(_0x2dd056){if(_0x2dd056){var _0x4fb647=typeof _0x100ea6[_0xe732('0x1a')]===_0xe732('0x1b')&&typeof _0x100ea6['limit']===_0xe732('0x1b');var _0x7a3774=_0x2dd056['count'];var _0x4c56f1=_0x4fb647?0x0:_0x100ea6[_0xe732('0x1a')];var _0x4d6d9f=_0x4fb647?_0x2dd056[_0xe732('0x1c')]:_0x100ea6[_0xe732('0x1a')]+_0x100ea6[_0xe732('0x1d')];var _0x36886f;if(_0x4d6d9f>=_0x7a3774){_0x4d6d9f=_0x7a3774;_0x36886f=0xc8;}else{_0x36886f=0xce;}_0x401908[_0xe732('0x18')](_0x36886f);return _0x401908[_0xe732('0x1e')](_0xe732('0x1f'),_0x4c56f1+'-'+_0x4d6d9f+'/'+_0x7a3774)[_0xe732('0x19')](_0x2dd056);}return null;};}function patchUpdates(_0x6dbf92){return function(_0x22d4d4){try{jsonpatch[_0xe732('0x20')](_0x22d4d4,_0x6dbf92,!![]);}catch(_0x241f5d){return BPromise[_0xe732('0x21')](_0x241f5d);}return _0x22d4d4['save']();};}function saveUpdates(_0x4d0b17,_0x3c8fe0){return function(_0x253606){if(_0x253606){return _0x253606[_0xe732('0x22')](_0x4d0b17)[_0xe732('0x23')](function(_0x5deca4){return _0x5deca4;});}return null;};}function removeEntity(_0x2d1dee,_0xd7de59){return function(_0x137680){if(_0x137680){return _0x137680[_0xe732('0x24')]()['then'](function(){_0x2d1dee['status'](0xcc)[_0xe732('0x25')]();});}};}function handleEntityNotFound(_0x1e84ff,_0xb6eb66){return function(_0x3394ad){if(!_0x3394ad){_0x1e84ff[_0xe732('0x17')](0x194);}return _0x3394ad;};}function handleError(_0x38a82e,_0x2a3acb){_0x2a3acb=_0x2a3acb||0x1f4;return function(_0x3749ef){logger[_0xe732('0x26')](_0x3749ef[_0xe732('0x27')]);if(_0x3749ef[_0xe732('0x28')]){delete _0x3749ef['name'];}_0x38a82e[_0xe732('0x18')](_0x2a3acb)[_0xe732('0x29')](_0x3749ef);};}exports[_0xe732('0x2a')]=function(_0x257fa5,_0x37d1fc){var _0x410703={},_0x468078={},_0x222a81={'count':0x0,'rows':[]};var _0x2d0717=_[_0xe732('0x2b')](db[_0xe732('0x2c')]['rawAttributes'],function(_0x2a935b){return{'name':_0x2a935b['fieldName'],'type':_0x2a935b[_0xe732('0x2d')][_0xe732('0x2e')]};});_0x468078['model']=_['map'](_0x2d0717,_0xe732('0x28'));_0x468078[_0xe732('0x2f')]=_['keys'](_0x257fa5[_0xe732('0x2f')]);_0x468078['filters']=_['intersection'](_0x468078['model'],_0x468078[_0xe732('0x2f')]);_0x410703[_0xe732('0x30')]=_[_0xe732('0x31')](_0x468078[_0xe732('0x32')],qs[_0xe732('0x33')](_0x257fa5[_0xe732('0x2f')][_0xe732('0x33')]));_0x410703[_0xe732('0x30')]=_0x410703[_0xe732('0x30')][_0xe732('0x34')]?_0x410703[_0xe732('0x30')]:_0x468078[_0xe732('0x32')];if(!_0x257fa5[_0xe732('0x2f')]['hasOwnProperty']('nolimit')){_0x410703['limit']=qs[_0xe732('0x1d')](_0x257fa5[_0xe732('0x2f')][_0xe732('0x1d')]);_0x410703[_0xe732('0x1a')]=qs[_0xe732('0x1a')](_0x257fa5[_0xe732('0x2f')][_0xe732('0x1a')]);}_0x410703[_0xe732('0x35')]=qs[_0xe732('0x36')](_0x257fa5[_0xe732('0x2f')]['sort']);_0x410703[_0xe732('0x37')]=qs[_0xe732('0x38')](_['pick'](_0x257fa5['query'],_0x468078['filters']),_0x2d0717);if(_0x257fa5[_0xe732('0x2f')][_0xe732('0x39')]){_0x410703[_0xe732('0x37')]=_[_0xe732('0x3a')](_0x410703['where'],{'$or':_[_0xe732('0x2b')](_0x2d0717,function(_0x377ead){if(_0x377ead['type']!==_0xe732('0x3b')){var _0x41178d={};_0x41178d[_0x377ead[_0xe732('0x28')]]={'$like':'%'+_0x257fa5[_0xe732('0x2f')][_0xe732('0x39')]+'%'};return _0x41178d;}})});}_0x410703=_[_0xe732('0x3a')]({},_0x410703,_0x257fa5['options']);var _0x4e7a74={'where':_0x410703[_0xe732('0x37')]};return db[_0xe732('0x2c')]['count'](_0x4e7a74)[_0xe732('0x23')](function(_0x461f48){_0x222a81[_0xe732('0x1c')]=_0x461f48;if(_0x257fa5['query'][_0xe732('0x3c')]){_0x410703['include']=[{'all':!![]}];}return db[_0xe732('0x2c')]['findAll'](_0x410703);})[_0xe732('0x23')](function(_0xb80bf5){_0x222a81['rows']=_0xb80bf5;return _0x222a81;})[_0xe732('0x23')](respondWithFilteredResult(_0x37d1fc,_0x410703))[_0xe732('0x3d')](handleError(_0x37d1fc,null));};exports[_0xe732('0x3e')]=function(_0x82b915,_0x348a37){var _0x3d8bcd={'raw':![],'where':{'id':_0x82b915[_0xe732('0x3f')]['id']}},_0x299cf7={};_0x299cf7[_0xe732('0x32')]=_[_0xe732('0x40')](db['Dynamics365Configuration'][_0xe732('0x41')]);_0x299cf7[_0xe732('0x2f')]=_[_0xe732('0x40')](_0x82b915[_0xe732('0x2f')]);_0x299cf7[_0xe732('0x38')]=_[_0xe732('0x31')](_0x299cf7[_0xe732('0x32')],_0x299cf7[_0xe732('0x2f')]);_0x3d8bcd[_0xe732('0x30')]=_[_0xe732('0x31')](_0x299cf7[_0xe732('0x32')],qs[_0xe732('0x33')](_0x82b915[_0xe732('0x2f')][_0xe732('0x33')]));_0x3d8bcd[_0xe732('0x30')]=_0x3d8bcd[_0xe732('0x30')][_0xe732('0x34')]?_0x3d8bcd[_0xe732('0x30')]:_0x299cf7[_0xe732('0x32')];if(_0x82b915[_0xe732('0x2f')][_0xe732('0x3c')]){_0x3d8bcd['include']=[{'all':!![]}];}_0x3d8bcd=_['merge']({},_0x3d8bcd,_0x82b915['options']);return db[_0xe732('0x2c')]['find'](_0x3d8bcd)[_0xe732('0x23')](handleEntityNotFound(_0x348a37,null))[_0xe732('0x23')](respondWithResult(_0x348a37,null))[_0xe732('0x3d')](handleError(_0x348a37,null));};exports[_0xe732('0x42')]=function(_0x44cc34,_0xf06dc4){return db['Dynamics365Configuration']['create'](_0x44cc34[_0xe732('0x43')],{})[_0xe732('0x23')](respondWithResult(_0xf06dc4,0xc9))[_0xe732('0x3d')](handleError(_0xf06dc4,null));};exports[_0xe732('0x22')]=function(_0x1af1e4,_0x5b19f2){if(_0x1af1e4['body']['id']){delete _0x1af1e4[_0xe732('0x43')]['id'];}return db[_0xe732('0x2c')][_0xe732('0x44')]({'where':{'id':_0x1af1e4[_0xe732('0x3f')]['id']}})[_0xe732('0x23')](handleEntityNotFound(_0x5b19f2,null))[_0xe732('0x23')](saveUpdates(_0x1af1e4[_0xe732('0x43')],null))[_0xe732('0x23')](respondWithResult(_0x5b19f2,null))[_0xe732('0x3d')](handleError(_0x5b19f2,null));};exports[_0xe732('0x24')]=function(_0x33f16c,_0x485e33){return db[_0xe732('0x2c')][_0xe732('0x44')]({'where':{'id':_0x33f16c['params']['id']}})[_0xe732('0x23')](handleEntityNotFound(_0x485e33,null))['then'](removeEntity(_0x485e33,null))[_0xe732('0x3d')](handleError(_0x485e33,null));};exports['getFields']=function(_0x1727d5,_0x2c350a,_0x4729e0){var _0x5aa567={};var _0x18a8e9={};var _0x223789;var _0x400281;return db[_0xe732('0x2c')][_0xe732('0x45')]({'where':{'id':_0x1727d5['params']['id']}})['then'](handleEntityNotFound(_0x2c350a,null))[_0xe732('0x23')](function(_0x46b36a){if(_0x46b36a){_0x223789=_0x46b36a;_0x18a8e9['model']=_[_0xe732('0x40')](db['Dynamics365Field'][_0xe732('0x41')]);_0x18a8e9[_0xe732('0x2f')]=_[_0xe732('0x40')](_0x1727d5[_0xe732('0x2f')]);_0x18a8e9[_0xe732('0x38')]=_[_0xe732('0x31')](_0x18a8e9[_0xe732('0x32')],_0x18a8e9[_0xe732('0x2f')]);_0x5aa567[_0xe732('0x30')]=_[_0xe732('0x31')](_0x18a8e9['model'],qs[_0xe732('0x33')](_0x1727d5[_0xe732('0x2f')][_0xe732('0x33')]));_0x5aa567['attributes']=_0x5aa567['attributes']['length']?_0x5aa567[_0xe732('0x30')]:_0x18a8e9[_0xe732('0x32')];_0x5aa567['order']=qs['sort'](_0x1727d5[_0xe732('0x2f')][_0xe732('0x36')]);_0x5aa567[_0xe732('0x37')]=qs[_0xe732('0x38')](_[_0xe732('0x46')](_0x1727d5[_0xe732('0x2f')],_0x18a8e9[_0xe732('0x38')]));if(_0x1727d5[_0xe732('0x2f')][_0xe732('0x39')]){_0x5aa567['where']=_['merge'](_0x5aa567[_0xe732('0x37')],{'$or':_[_0xe732('0x2b')](_0x5aa567[_0xe732('0x30')],function(_0x2f17bf){var _0x531d2d={};_0x531d2d[_0x2f17bf]={'$like':'%'+_0x1727d5['query'][_0xe732('0x39')]+'%'};return _0x531d2d;})});}_0x5aa567=_[_0xe732('0x3a')]({},_0x5aa567,_0x1727d5[_0xe732('0x47')]);return _0x223789[_0xe732('0x48')](_0x5aa567);}})[_0xe732('0x23')](function(_0x342594){if(_0x342594){_0x400281=_0x342594[_0xe732('0x34')];if(!_0x1727d5[_0xe732('0x2f')][_0xe732('0x49')]('nolimit')){_0x5aa567[_0xe732('0x1d')]=qs['limit'](_0x1727d5[_0xe732('0x2f')]['limit']);_0x5aa567[_0xe732('0x1a')]=qs[_0xe732('0x1a')](_0x1727d5[_0xe732('0x2f')][_0xe732('0x1a')]);}return _0x223789['getFields'](_0x5aa567);}})[_0xe732('0x23')](function(_0x419067){if(_0x419067){return _0x419067?{'count':_0x400281,'rows':_0x419067}:null;}})[_0xe732('0x23')](respondWithResult(_0x2c350a,null))[_0xe732('0x3d')](handleError(_0x2c350a,null));};exports[_0xe732('0x4a')]=function(_0x1c45bf,_0x17f063,_0x8911b7){var _0xb3a3fa={};var _0x33f0d4={};var _0xa64b0a;var _0x366227;return db[_0xe732('0x2c')][_0xe732('0x45')]({'where':{'id':_0x1c45bf[_0xe732('0x3f')]['id']}})[_0xe732('0x23')](handleEntityNotFound(_0x17f063,null))[_0xe732('0x23')](function(_0x6b1bc5){if(_0x6b1bc5){_0xa64b0a=_0x6b1bc5;_0x33f0d4[_0xe732('0x32')]=_[_0xe732('0x40')](db[_0xe732('0x4b')][_0xe732('0x41')]);_0x33f0d4[_0xe732('0x2f')]=_['keys'](_0x1c45bf[_0xe732('0x2f')]);_0x33f0d4[_0xe732('0x38')]=_[_0xe732('0x31')](_0x33f0d4['model'],_0x33f0d4[_0xe732('0x2f')]);_0xb3a3fa[_0xe732('0x30')]=_[_0xe732('0x31')](_0x33f0d4[_0xe732('0x32')],qs[_0xe732('0x33')](_0x1c45bf[_0xe732('0x2f')][_0xe732('0x33')]));_0xb3a3fa[_0xe732('0x30')]=_0xb3a3fa[_0xe732('0x30')]['length']?_0xb3a3fa[_0xe732('0x30')]:_0x33f0d4[_0xe732('0x32')];_0xb3a3fa[_0xe732('0x35')]=qs[_0xe732('0x36')](_0x1c45bf['query'][_0xe732('0x36')]);_0xb3a3fa[_0xe732('0x37')]=qs[_0xe732('0x38')](_['pick'](_0x1c45bf['query'],_0x33f0d4[_0xe732('0x38')]));if(_0x1c45bf[_0xe732('0x2f')][_0xe732('0x39')]){_0xb3a3fa[_0xe732('0x37')]=_[_0xe732('0x3a')](_0xb3a3fa[_0xe732('0x37')],{'$or':_[_0xe732('0x2b')](_0xb3a3fa[_0xe732('0x30')],function(_0x43e6a7){var _0x339ed4={};_0x339ed4[_0x43e6a7]={'$like':'%'+_0x1c45bf[_0xe732('0x2f')][_0xe732('0x39')]+'%'};return _0x339ed4;})});}_0xb3a3fa=_['merge']({},_0xb3a3fa,_0x1c45bf[_0xe732('0x47')]);return _0xa64b0a['getSubjects'](_0xb3a3fa);}})[_0xe732('0x23')](function(_0x7f3c8){if(_0x7f3c8){_0x366227=_0x7f3c8['length'];if(!_0x1c45bf[_0xe732('0x2f')][_0xe732('0x49')](_0xe732('0x4c'))){_0xb3a3fa['limit']=qs[_0xe732('0x1d')](_0x1c45bf['query'][_0xe732('0x1d')]);_0xb3a3fa[_0xe732('0x1a')]=qs[_0xe732('0x1a')](_0x1c45bf[_0xe732('0x2f')][_0xe732('0x1a')]);}return _0xa64b0a[_0xe732('0x4a')](_0xb3a3fa);}})[_0xe732('0x23')](function(_0x45a66e){if(_0x45a66e){return _0x45a66e?{'count':_0x366227,'rows':_0x45a66e}:null;}})[_0xe732('0x23')](respondWithResult(_0x17f063,null))[_0xe732('0x3d')](handleError(_0x17f063,null));};exports[_0xe732('0x4d')]=function(_0x23ee7f,_0x493590,_0x3a12a4){var _0x1f1496={};var _0x4d5141={};var _0x1e5f42;var _0x457da2;return db[_0xe732('0x2c')]['findOne']({'where':{'id':_0x23ee7f[_0xe732('0x3f')]['id']}})['then'](handleEntityNotFound(_0x493590,null))[_0xe732('0x23')](function(_0x430b00){if(_0x430b00){_0x1e5f42=_0x430b00;_0x4d5141[_0xe732('0x32')]=_[_0xe732('0x40')](db[_0xe732('0x4b')][_0xe732('0x41')]);_0x4d5141[_0xe732('0x2f')]=_['keys'](_0x23ee7f[_0xe732('0x2f')]);_0x4d5141[_0xe732('0x38')]=_[_0xe732('0x31')](_0x4d5141[_0xe732('0x32')],_0x4d5141[_0xe732('0x2f')]);_0x1f1496['attributes']=_[_0xe732('0x31')](_0x4d5141[_0xe732('0x32')],qs[_0xe732('0x33')](_0x23ee7f[_0xe732('0x2f')][_0xe732('0x33')]));_0x1f1496[_0xe732('0x30')]=_0x1f1496[_0xe732('0x30')][_0xe732('0x34')]?_0x1f1496['attributes']:_0x4d5141[_0xe732('0x32')];_0x1f1496[_0xe732('0x35')]=qs[_0xe732('0x36')](_0x23ee7f[_0xe732('0x2f')][_0xe732('0x36')]);_0x1f1496['where']=qs[_0xe732('0x38')](_[_0xe732('0x46')](_0x23ee7f[_0xe732('0x2f')],_0x4d5141[_0xe732('0x38')]));if(_0x23ee7f['query'][_0xe732('0x39')]){_0x1f1496[_0xe732('0x37')]=_[_0xe732('0x3a')](_0x1f1496[_0xe732('0x37')],{'$or':_[_0xe732('0x2b')](_0x1f1496['attributes'],function(_0x5e4eb5){var _0x166679={};_0x166679[_0x5e4eb5]={'$like':'%'+_0x23ee7f['query'][_0xe732('0x39')]+'%'};return _0x166679;})});}_0x1f1496=_['merge']({},_0x1f1496,_0x23ee7f[_0xe732('0x47')]);return _0x1e5f42[_0xe732('0x4d')](_0x1f1496);}})[_0xe732('0x23')](function(_0xfd7348){if(_0xfd7348){_0x457da2=_0xfd7348[_0xe732('0x34')];if(!_0x23ee7f[_0xe732('0x2f')][_0xe732('0x49')](_0xe732('0x4c'))){_0x1f1496['limit']=qs[_0xe732('0x1d')](_0x23ee7f[_0xe732('0x2f')]['limit']);_0x1f1496[_0xe732('0x1a')]=qs[_0xe732('0x1a')](_0x23ee7f['query']['offset']);}return _0x1e5f42['getDescriptions'](_0x1f1496);}})[_0xe732('0x23')](function(_0x4c3c93){if(_0x4c3c93){return _0x4c3c93?{'count':_0x457da2,'rows':_0x4c3c93}:null;}})[_0xe732('0x23')](respondWithResult(_0x493590,null))[_0xe732('0x3d')](handleError(_0x493590,null));}; \ No newline at end of file +var _0x0733=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','body','find','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','update','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x31619a,_0x421647){var _0x525439=function(_0x17cd03){while(--_0x17cd03){_0x31619a['push'](_0x31619a['shift']());}};_0x525439(++_0x421647);}(_0x0733,0x10c));var _0x3073=function(_0x3aa7c4,_0x16b1bb){_0x3aa7c4=_0x3aa7c4-0x0;var _0x775c7=_0x0733[_0x3aa7c4];return _0x775c7;};'use strict';var emlformat=require(_0x3073('0x0'));var rimraf=require(_0x3073('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3073('0x2'));var rp=require(_0x3073('0x3'));var moment=require(_0x3073('0x4'));var BPromise=require(_0x3073('0x5'));var Mustache=require(_0x3073('0x6'));var util=require(_0x3073('0x7'));var path=require(_0x3073('0x8'));var sox=require(_0x3073('0x9'));var csv=require(_0x3073('0xa'));var ejs=require(_0x3073('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3073('0xc'));var squel=require(_0x3073('0xd'));var crypto=require('crypto');var jsforce=require(_0x3073('0xe'));var deskjs=require(_0x3073('0xf'));var toCsv=require(_0x3073('0xa'));var querystring=require(_0x3073('0x10'));var Papa=require(_0x3073('0x11'));var Redis=require(_0x3073('0x12'));var authService=require(_0x3073('0x13'));var qs=require(_0x3073('0x14'));var as=require(_0x3073('0x15'));var hardwareService=require(_0x3073('0x16'));var logger=require(_0x3073('0x17'))(_0x3073('0x18'));var utils=require(_0x3073('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3073('0x1a'));var db=require(_0x3073('0x1b'))['db'];function respondWithStatusCode(_0x505740,_0x1aa76f){_0x1aa76f=_0x1aa76f||0xcc;return function(_0x19ef48){if(_0x19ef48){return _0x505740[_0x3073('0x1c')](_0x1aa76f);}return _0x505740[_0x3073('0x1d')](_0x1aa76f)['end']();};}function respondWithResult(_0x2dbea3,_0x307f9c){_0x307f9c=_0x307f9c||0xc8;return function(_0x4e3816){if(_0x4e3816){return _0x2dbea3[_0x3073('0x1d')](_0x307f9c)[_0x3073('0x1e')](_0x4e3816);}};}function respondWithFilteredResult(_0x111633,_0x293759){return function(_0x24ed51){if(_0x24ed51){var _0x1d66a7=typeof _0x293759[_0x3073('0x1f')]===_0x3073('0x20')&&typeof _0x293759[_0x3073('0x21')]===_0x3073('0x20');var _0x58f15e=_0x24ed51[_0x3073('0x22')];var _0x40d506=_0x1d66a7?0x0:_0x293759['offset'];var _0x50738a=_0x1d66a7?_0x24ed51['count']:_0x293759[_0x3073('0x1f')]+_0x293759['limit'];var _0x3f4dab;if(_0x50738a>=_0x58f15e){_0x50738a=_0x58f15e;_0x3f4dab=0xc8;}else{_0x3f4dab=0xce;}_0x111633[_0x3073('0x1d')](_0x3f4dab);return _0x111633[_0x3073('0x23')]('Content-Range',_0x40d506+'-'+_0x50738a+'/'+_0x58f15e)['json'](_0x24ed51);}return null;};}function patchUpdates(_0x4b6664){return function(_0x268b33){try{jsonpatch['apply'](_0x268b33,_0x4b6664,!![]);}catch(_0x175774){return BPromise['reject'](_0x175774);}return _0x268b33[_0x3073('0x24')]();};}function saveUpdates(_0x32c5fd,_0x6aaf20){return function(_0x1c25f1){if(_0x1c25f1){return _0x1c25f1[_0x3073('0x25')](_0x32c5fd)[_0x3073('0x26')](function(_0x16e0b0){return _0x16e0b0;});}return null;};}function removeEntity(_0x202809,_0x593c26){return function(_0x278cbd){if(_0x278cbd){return _0x278cbd[_0x3073('0x27')]()[_0x3073('0x26')](function(){_0x202809[_0x3073('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x522386,_0x5d4809){return function(_0x52cbd2){if(!_0x52cbd2){_0x522386['sendStatus'](0x194);}return _0x52cbd2;};}function handleError(_0x36e608,_0x56cbb6){_0x56cbb6=_0x56cbb6||0x1f4;return function(_0x1a51ad){logger[_0x3073('0x28')](_0x1a51ad[_0x3073('0x29')]);if(_0x1a51ad[_0x3073('0x2a')]){delete _0x1a51ad['name'];}_0x36e608[_0x3073('0x1d')](_0x56cbb6)[_0x3073('0x2b')](_0x1a51ad);};}exports[_0x3073('0x2c')]=function(_0x5cc8d0,_0x42a619){var _0x14da45={},_0x53e522={},_0x173235={'count':0x0,'rows':[]};var _0x41bf0f=_[_0x3073('0x2d')](db[_0x3073('0x2e')]['rawAttributes'],function(_0x13d485){return{'name':_0x13d485['fieldName'],'type':_0x13d485[_0x3073('0x2f')]['key']};});_0x53e522[_0x3073('0x30')]=_[_0x3073('0x2d')](_0x41bf0f,_0x3073('0x2a'));_0x53e522[_0x3073('0x31')]=_['keys'](_0x5cc8d0[_0x3073('0x31')]);_0x53e522[_0x3073('0x32')]=_['intersection'](_0x53e522['model'],_0x53e522[_0x3073('0x31')]);_0x14da45[_0x3073('0x33')]=_[_0x3073('0x34')](_0x53e522[_0x3073('0x30')],qs[_0x3073('0x35')](_0x5cc8d0[_0x3073('0x31')][_0x3073('0x35')]));_0x14da45[_0x3073('0x33')]=_0x14da45[_0x3073('0x33')][_0x3073('0x36')]?_0x14da45[_0x3073('0x33')]:_0x53e522['model'];if(!_0x5cc8d0['query'][_0x3073('0x37')](_0x3073('0x38'))){_0x14da45['limit']=qs[_0x3073('0x21')](_0x5cc8d0[_0x3073('0x31')][_0x3073('0x21')]);_0x14da45[_0x3073('0x1f')]=qs[_0x3073('0x1f')](_0x5cc8d0[_0x3073('0x31')][_0x3073('0x1f')]);}_0x14da45[_0x3073('0x39')]=qs['sort'](_0x5cc8d0[_0x3073('0x31')][_0x3073('0x3a')]);_0x14da45[_0x3073('0x3b')]=qs[_0x3073('0x32')](_[_0x3073('0x3c')](_0x5cc8d0[_0x3073('0x31')],_0x53e522[_0x3073('0x32')]),_0x41bf0f);if(_0x5cc8d0[_0x3073('0x31')][_0x3073('0x3d')]){_0x14da45[_0x3073('0x3b')]=_[_0x3073('0x3e')](_0x14da45[_0x3073('0x3b')],{'$or':_[_0x3073('0x2d')](_0x41bf0f,function(_0x200665){if(_0x200665[_0x3073('0x2f')]!==_0x3073('0x3f')){var _0x1a0000={};_0x1a0000[_0x200665[_0x3073('0x2a')]]={'$like':'%'+_0x5cc8d0['query'][_0x3073('0x3d')]+'%'};return _0x1a0000;}})});}_0x14da45=_[_0x3073('0x3e')]({},_0x14da45,_0x5cc8d0[_0x3073('0x40')]);var _0x1106f7={'where':_0x14da45[_0x3073('0x3b')]};return db[_0x3073('0x2e')]['count'](_0x1106f7)[_0x3073('0x26')](function(_0x351b10){_0x173235[_0x3073('0x22')]=_0x351b10;if(_0x5cc8d0[_0x3073('0x31')][_0x3073('0x41')]){_0x14da45[_0x3073('0x42')]=[{'all':!![]}];}return db[_0x3073('0x2e')][_0x3073('0x43')](_0x14da45);})[_0x3073('0x26')](function(_0x44dad0){_0x173235[_0x3073('0x44')]=_0x44dad0;return _0x173235;})['then'](respondWithFilteredResult(_0x42a619,_0x14da45))[_0x3073('0x45')](handleError(_0x42a619,null));};exports[_0x3073('0x46')]=function(_0x2f6c59,_0x106669){var _0x464d7c={'raw':![],'where':{'id':_0x2f6c59[_0x3073('0x47')]['id']}},_0x1cd202={};_0x1cd202[_0x3073('0x30')]=_[_0x3073('0x48')](db[_0x3073('0x2e')][_0x3073('0x49')]);_0x1cd202['query']=_[_0x3073('0x48')](_0x2f6c59[_0x3073('0x31')]);_0x1cd202[_0x3073('0x32')]=_[_0x3073('0x34')](_0x1cd202['model'],_0x1cd202['query']);_0x464d7c[_0x3073('0x33')]=_[_0x3073('0x34')](_0x1cd202[_0x3073('0x30')],qs[_0x3073('0x35')](_0x2f6c59[_0x3073('0x31')][_0x3073('0x35')]));_0x464d7c[_0x3073('0x33')]=_0x464d7c[_0x3073('0x33')][_0x3073('0x36')]?_0x464d7c[_0x3073('0x33')]:_0x1cd202[_0x3073('0x30')];if(_0x2f6c59[_0x3073('0x31')][_0x3073('0x41')]){_0x464d7c[_0x3073('0x42')]=[{'all':!![]}];}_0x464d7c=_[_0x3073('0x3e')]({},_0x464d7c,_0x2f6c59[_0x3073('0x40')]);return db[_0x3073('0x2e')]['find'](_0x464d7c)[_0x3073('0x26')](handleEntityNotFound(_0x106669,null))[_0x3073('0x26')](respondWithResult(_0x106669,null))[_0x3073('0x45')](handleError(_0x106669,null));};exports[_0x3073('0x4a')]=function(_0x55f519,_0x232728){return db['Dynamics365Configuration'][_0x3073('0x4a')](_0x55f519[_0x3073('0x4b')],{})[_0x3073('0x26')](respondWithResult(_0x232728,0xc9))[_0x3073('0x45')](handleError(_0x232728,null));};exports[_0x3073('0x25')]=function(_0x404513,_0x3a90ae){if(_0x404513[_0x3073('0x4b')]['id']){delete _0x404513[_0x3073('0x4b')]['id'];}return db[_0x3073('0x2e')][_0x3073('0x4c')]({'where':{'id':_0x404513[_0x3073('0x47')]['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x3a90ae,null))['then'](saveUpdates(_0x404513[_0x3073('0x4b')],null))[_0x3073('0x26')](respondWithResult(_0x3a90ae,null))['catch'](handleError(_0x3a90ae,null));};exports[_0x3073('0x27')]=function(_0x145ed2,_0x5a382f){return db[_0x3073('0x2e')][_0x3073('0x4c')]({'where':{'id':_0x145ed2[_0x3073('0x47')]['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x5a382f,null))[_0x3073('0x26')](removeEntity(_0x5a382f,null))[_0x3073('0x45')](handleError(_0x5a382f,null));};exports[_0x3073('0x4d')]=function(_0xdd5f33,_0x521a2a,_0x161545){var _0xe18a97={};var _0x9b1b44={};var _0x4492d3;var _0x534f8a;return db[_0x3073('0x2e')][_0x3073('0x4e')]({'where':{'id':_0xdd5f33[_0x3073('0x47')]['id']}})['then'](handleEntityNotFound(_0x521a2a,null))[_0x3073('0x26')](function(_0x2317bf){if(_0x2317bf){_0x4492d3=_0x2317bf;_0x9b1b44[_0x3073('0x30')]=_[_0x3073('0x48')](db[_0x3073('0x4f')][_0x3073('0x49')]);_0x9b1b44[_0x3073('0x31')]=_[_0x3073('0x48')](_0xdd5f33[_0x3073('0x31')]);_0x9b1b44['filters']=_[_0x3073('0x34')](_0x9b1b44[_0x3073('0x30')],_0x9b1b44['query']);_0xe18a97[_0x3073('0x33')]=_[_0x3073('0x34')](_0x9b1b44['model'],qs[_0x3073('0x35')](_0xdd5f33[_0x3073('0x31')][_0x3073('0x35')]));_0xe18a97[_0x3073('0x33')]=_0xe18a97[_0x3073('0x33')][_0x3073('0x36')]?_0xe18a97[_0x3073('0x33')]:_0x9b1b44[_0x3073('0x30')];_0xe18a97[_0x3073('0x39')]=qs[_0x3073('0x3a')](_0xdd5f33['query'][_0x3073('0x3a')]);_0xe18a97[_0x3073('0x3b')]=qs[_0x3073('0x32')](_[_0x3073('0x3c')](_0xdd5f33['query'],_0x9b1b44[_0x3073('0x32')]));if(_0xdd5f33[_0x3073('0x31')]['filter']){_0xe18a97[_0x3073('0x3b')]=_[_0x3073('0x3e')](_0xe18a97[_0x3073('0x3b')],{'$or':_['map'](_0xe18a97[_0x3073('0x33')],function(_0x5558ca){var _0x35d3bd={};_0x35d3bd[_0x5558ca]={'$like':'%'+_0xdd5f33['query'][_0x3073('0x3d')]+'%'};return _0x35d3bd;})});}_0xe18a97=_[_0x3073('0x3e')]({},_0xe18a97,_0xdd5f33['options']);return _0x4492d3[_0x3073('0x4d')](_0xe18a97);}})[_0x3073('0x26')](function(_0x4bef9d){if(_0x4bef9d){_0x534f8a=_0x4bef9d[_0x3073('0x36')];if(!_0xdd5f33[_0x3073('0x31')][_0x3073('0x37')](_0x3073('0x38'))){_0xe18a97[_0x3073('0x21')]=qs[_0x3073('0x21')](_0xdd5f33[_0x3073('0x31')][_0x3073('0x21')]);_0xe18a97[_0x3073('0x1f')]=qs[_0x3073('0x1f')](_0xdd5f33[_0x3073('0x31')][_0x3073('0x1f')]);}return _0x4492d3['getFields'](_0xe18a97);}})[_0x3073('0x26')](function(_0x49d8f5){if(_0x49d8f5){return _0x49d8f5?{'count':_0x534f8a,'rows':_0x49d8f5}:null;}})[_0x3073('0x26')](respondWithResult(_0x521a2a,null))[_0x3073('0x45')](handleError(_0x521a2a,null));};exports[_0x3073('0x50')]=function(_0x1c2b53,_0x42112e,_0x489506){var _0x1af499={};var _0x1fc1ad={};var _0x1d6807;var _0xc399eb;return db[_0x3073('0x2e')][_0x3073('0x4e')]({'where':{'id':_0x1c2b53[_0x3073('0x47')]['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x42112e,null))[_0x3073('0x26')](function(_0xdf85b9){if(_0xdf85b9){_0x1d6807=_0xdf85b9;_0x1fc1ad[_0x3073('0x30')]=_['keys'](db[_0x3073('0x4f')][_0x3073('0x49')]);_0x1fc1ad[_0x3073('0x31')]=_['keys'](_0x1c2b53[_0x3073('0x31')]);_0x1fc1ad['filters']=_[_0x3073('0x34')](_0x1fc1ad['model'],_0x1fc1ad[_0x3073('0x31')]);_0x1af499[_0x3073('0x33')]=_[_0x3073('0x34')](_0x1fc1ad[_0x3073('0x30')],qs[_0x3073('0x35')](_0x1c2b53[_0x3073('0x31')]['fields']));_0x1af499[_0x3073('0x33')]=_0x1af499[_0x3073('0x33')][_0x3073('0x36')]?_0x1af499[_0x3073('0x33')]:_0x1fc1ad[_0x3073('0x30')];_0x1af499[_0x3073('0x39')]=qs[_0x3073('0x3a')](_0x1c2b53[_0x3073('0x31')]['sort']);_0x1af499['where']=qs[_0x3073('0x32')](_['pick'](_0x1c2b53[_0x3073('0x31')],_0x1fc1ad[_0x3073('0x32')]));if(_0x1c2b53['query']['filter']){_0x1af499[_0x3073('0x3b')]=_['merge'](_0x1af499[_0x3073('0x3b')],{'$or':_[_0x3073('0x2d')](_0x1af499[_0x3073('0x33')],function(_0x12e597){var _0x622fe6={};_0x622fe6[_0x12e597]={'$like':'%'+_0x1c2b53[_0x3073('0x31')][_0x3073('0x3d')]+'%'};return _0x622fe6;})});}_0x1af499=_['merge']({},_0x1af499,_0x1c2b53['options']);return _0x1d6807[_0x3073('0x50')](_0x1af499);}})['then'](function(_0x37b2f1){if(_0x37b2f1){_0xc399eb=_0x37b2f1[_0x3073('0x36')];if(!_0x1c2b53[_0x3073('0x31')][_0x3073('0x37')](_0x3073('0x38'))){_0x1af499[_0x3073('0x21')]=qs[_0x3073('0x21')](_0x1c2b53['query'][_0x3073('0x21')]);_0x1af499[_0x3073('0x1f')]=qs['offset'](_0x1c2b53[_0x3073('0x31')][_0x3073('0x1f')]);}return _0x1d6807['getSubjects'](_0x1af499);}})['then'](function(_0x2e55f1){if(_0x2e55f1){return _0x2e55f1?{'count':_0xc399eb,'rows':_0x2e55f1}:null;}})[_0x3073('0x26')](respondWithResult(_0x42112e,null))[_0x3073('0x45')](handleError(_0x42112e,null));};exports['getDescriptions']=function(_0x3627d0,_0x7d5bca,_0x4c8662){var _0x366d29={};var _0x2c7ccb={};var _0x410d41;var _0xc1fdb;return db[_0x3073('0x2e')]['findOne']({'where':{'id':_0x3627d0[_0x3073('0x47')]['id']}})[_0x3073('0x26')](handleEntityNotFound(_0x7d5bca,null))[_0x3073('0x26')](function(_0x4bab52){if(_0x4bab52){_0x410d41=_0x4bab52;_0x2c7ccb['model']=_['keys'](db[_0x3073('0x4f')][_0x3073('0x49')]);_0x2c7ccb[_0x3073('0x31')]=_['keys'](_0x3627d0[_0x3073('0x31')]);_0x2c7ccb['filters']=_[_0x3073('0x34')](_0x2c7ccb[_0x3073('0x30')],_0x2c7ccb[_0x3073('0x31')]);_0x366d29[_0x3073('0x33')]=_[_0x3073('0x34')](_0x2c7ccb[_0x3073('0x30')],qs[_0x3073('0x35')](_0x3627d0[_0x3073('0x31')][_0x3073('0x35')]));_0x366d29[_0x3073('0x33')]=_0x366d29[_0x3073('0x33')][_0x3073('0x36')]?_0x366d29['attributes']:_0x2c7ccb['model'];_0x366d29['order']=qs['sort'](_0x3627d0['query'][_0x3073('0x3a')]);_0x366d29[_0x3073('0x3b')]=qs[_0x3073('0x32')](_[_0x3073('0x3c')](_0x3627d0['query'],_0x2c7ccb[_0x3073('0x32')]));if(_0x3627d0[_0x3073('0x31')][_0x3073('0x3d')]){_0x366d29[_0x3073('0x3b')]=_['merge'](_0x366d29[_0x3073('0x3b')],{'$or':_[_0x3073('0x2d')](_0x366d29[_0x3073('0x33')],function(_0x3a69f4){var _0x1b83b2={};_0x1b83b2[_0x3a69f4]={'$like':'%'+_0x3627d0[_0x3073('0x31')][_0x3073('0x3d')]+'%'};return _0x1b83b2;})});}_0x366d29=_[_0x3073('0x3e')]({},_0x366d29,_0x3627d0[_0x3073('0x40')]);return _0x410d41['getDescriptions'](_0x366d29);}})[_0x3073('0x26')](function(_0x588748){if(_0x588748){_0xc1fdb=_0x588748['length'];if(!_0x3627d0['query'][_0x3073('0x37')]('nolimit')){_0x366d29[_0x3073('0x21')]=qs[_0x3073('0x21')](_0x3627d0[_0x3073('0x31')][_0x3073('0x21')]);_0x366d29[_0x3073('0x1f')]=qs[_0x3073('0x1f')](_0x3627d0[_0x3073('0x31')][_0x3073('0x1f')]);}return _0x410d41[_0x3073('0x51')](_0x366d29);}})[_0x3073('0x26')](function(_0x2fd7a1){if(_0x2fd7a1){return _0x2fd7a1?{'count':_0xc1fdb,'rows':_0x2fd7a1}:null;}})['then'](respondWithResult(_0x7d5bca,null))[_0x3073('0x45')](handleError(_0x7d5bca,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index ba5ab51..4da5975 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 _0xb4e6=['path','rimraf','./intDynamics365Configuration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x10b919,_0x3e0a7d){var _0x34f395=function(_0x25f065){while(--_0x25f065){_0x10b919['push'](_0x10b919['shift']());}};_0x34f395(++_0x3e0a7d);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x2459fd,_0x575d9b){_0x2459fd=_0x2459fd-0x0;var _0x364cd2=_0xb4e6[_0x2459fd];return _0x364cd2;};'use strict';var _=require(_0x6b4e('0x0'));var util=require('util');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));var moment=require(_0x6b4e('0x3'));var BPromise=require(_0x6b4e('0x4'));var rp=require(_0x6b4e('0x5'));var fs=require('fs');var path=require(_0x6b4e('0x6'));var rimraf=require(_0x6b4e('0x7'));var config=require('../../config/environment');var attributes=require(_0x6b4e('0x8'));module[_0x6b4e('0x9')]=function(_0x1f67a2,_0x49de51){return _0x1f67a2[_0x6b4e('0xa')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf109=['Dynamics365Configuration','int_dynamics365_configurations','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define'];(function(_0x530d36,_0x4df559){var _0x1658f9=function(_0x4edf52){while(--_0x4edf52){_0x530d36['push'](_0x530d36['shift']());}};_0x1658f9(++_0x4df559);}(_0xf109,0xce));var _0x9f10=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xf109[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'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 eb7fcc0..4f09ef8 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 _0x6616=['then','info','Dynamics365Configuration,\x20%s,\x20%s','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x21825f,_0x598d8b){var _0x2e4d2a=function(_0x354659){while(--_0x354659){_0x21825f['push'](_0x21825f['shift']());}};_0x2e4d2a(++_0x598d8b);}(_0x6616,0x108));var _0x6661=function(_0x2b2802,_0x584b1f){_0x2b2802=_0x2b2802-0x0;var _0x521428=_0x6616[_0x2b2802];return _0x521428;};'use strict';var _=require(_0x6661('0x0'));var util=require(_0x6661('0x1'));var moment=require(_0x6661('0x2'));var BPromise=require('bluebird');var rs=require(_0x6661('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6661('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6661('0x5'))(_0x6661('0x6'));var config=require(_0x6661('0x7'));var jayson=require(_0x6661('0x8'));var client=jayson[_0x6661('0x9')][_0x6661('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a0bf9,_0x2fc26e,_0x4165ea){return new BPromise(function(_0x3d3c5f,_0x3ee03b){return client[_0x6661('0xb')](_0x4a0bf9,_0x4165ea)[_0x6661('0xc')](function(_0xbdb7ed){logger[_0x6661('0xd')](_0x6661('0xe'),_0x2fc26e,'request\x20sent');logger[_0x6661('0xf')](_0x6661('0x10'),_0x2fc26e,_0x6661('0x11'),JSON[_0x6661('0x12')](_0xbdb7ed));if(_0xbdb7ed[_0x6661('0x13')]){if(_0xbdb7ed['error'][_0x6661('0x14')]===0x1f4){logger[_0x6661('0x13')](_0x6661('0xe'),_0x2fc26e,_0xbdb7ed['error'][_0x6661('0x15')]);return _0x3ee03b(_0xbdb7ed[_0x6661('0x13')][_0x6661('0x15')]);}logger['error'](_0x6661('0xe'),_0x2fc26e,_0xbdb7ed[_0x6661('0x13')][_0x6661('0x15')]);return _0x3d3c5f(_0xbdb7ed[_0x6661('0x13')][_0x6661('0x15')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x2fc26e,'request\x20sent');_0x3d3c5f(_0xbdb7ed[_0x6661('0x16')][_0x6661('0x15')]);}})['catch'](function(_0x1c7fd2){logger[_0x6661('0x13')](_0x6661('0xe'),_0x2fc26e,_0x1c7fd2);_0x3ee03b(_0x1c7fd2);});});} \ No newline at end of file +var _0x89a1=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x44543b,_0x5db79a){var _0x2a893f=function(_0x180700){while(--_0x180700){_0x44543b['push'](_0x44543b['shift']());}};_0x2a893f(++_0x5db79a);}(_0x89a1,0x184));var _0x189a=function(_0x1aa91e,_0x4c49b6){_0x1aa91e=_0x1aa91e-0x0;var _0x450c6d=_0x89a1[_0x1aa91e];return _0x450c6d;};'use strict';var _=require(_0x189a('0x0'));var util=require('util');var moment=require(_0x189a('0x1'));var BPromise=require(_0x189a('0x2'));var rs=require(_0x189a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x189a('0x4'));var logger=require(_0x189a('0x5'))(_0x189a('0x6'));var config=require(_0x189a('0x7'));var jayson=require(_0x189a('0x8'));var client=jayson['client'][_0x189a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2c42,_0x3fd7b6,_0x444f8e){return new BPromise(function(_0x2bb6cc,_0x1c25b5){return client[_0x189a('0xa')](_0x4b2c42,_0x444f8e)['then'](function(_0x3427db){logger[_0x189a('0xb')](_0x189a('0xc'),_0x3fd7b6,_0x189a('0xd'));logger[_0x189a('0xe')](_0x189a('0xf'),_0x3fd7b6,'request\x20sent',JSON[_0x189a('0x10')](_0x3427db));if(_0x3427db[_0x189a('0x11')]){if(_0x3427db['error'][_0x189a('0x12')]===0x1f4){logger[_0x189a('0x11')](_0x189a('0xc'),_0x3fd7b6,_0x3427db[_0x189a('0x11')][_0x189a('0x13')]);return _0x1c25b5(_0x3427db[_0x189a('0x11')][_0x189a('0x13')]);}logger[_0x189a('0x11')](_0x189a('0xc'),_0x3fd7b6,_0x3427db['error'][_0x189a('0x13')]);return _0x2bb6cc(_0x3427db[_0x189a('0x11')][_0x189a('0x13')]);}else{logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x3fd7b6,_0x189a('0xd'));_0x2bb6cc(_0x3427db[_0x189a('0x14')][_0x189a('0x13')]);}})['catch'](function(_0xb85ef8){logger['error'](_0x189a('0xc'),_0x3fd7b6,_0xb85ef8);_0x1c25b5(_0xb85ef8);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 0f4af1b..e068d28 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 _0x2ccb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','connect-timeout','express','Router'];(function(_0x541f17,_0x8adfd1){var _0x4765f6=function(_0x5ac588){while(--_0x5ac588){_0x541f17['push'](_0x541f17['shift']());}};_0x4765f6(++_0x8adfd1);}(_0x2ccb,0x1c4));var _0xb2cc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x2ccb[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xb2cc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb2cc('0x1'));var express=require(_0xb2cc('0x2'));var router=express[_0xb2cc('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb2cc('0x4'));var interaction=require(_0xb2cc('0x5'));var config=require(_0xb2cc('0x6'));var controller=require(_0xb2cc('0x7'));router[_0xb2cc('0x8')]('/',auth[_0xb2cc('0x9')](),controller[_0xb2cc('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xb2cc('0xb')]);router[_0xb2cc('0xc')]('/',auth['isAuthenticated'](),controller[_0xb2cc('0xd')]);router[_0xb2cc('0xe')](_0xb2cc('0xf'),auth[_0xb2cc('0x9')](),controller['update']);router[_0xb2cc('0x10')](_0xb2cc('0xf'),auth[_0xb2cc('0x9')](),controller[_0xb2cc('0x11')]);module[_0xb2cc('0x12')]=router; \ No newline at end of file +var _0x6e0e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x209f48,_0x4e8092){var _0x2aa8d2=function(_0x4daa81){while(--_0x4daa81){_0x209f48['push'](_0x209f48['shift']());}};_0x2aa8d2(++_0x4e8092);}(_0x6e0e,0xe4));var _0xe6e0=function(_0x4894ad,_0x389187){_0x4894ad=_0x4894ad-0x0;var _0x5d72a6=_0x6e0e[_0x4894ad];return _0x5d72a6;};'use strict';var multer=require('multer');var util=require(_0xe6e0('0x0'));var path=require(_0xe6e0('0x1'));var timeout=require(_0xe6e0('0x2'));var express=require(_0xe6e0('0x3'));var router=express[_0xe6e0('0x4')]();var fs_extra=require(_0xe6e0('0x5'));var auth=require(_0xe6e0('0x6'));var interaction=require(_0xe6e0('0x7'));var config=require(_0xe6e0('0x8'));var controller=require('./intDynamics365Field.controller');router[_0xe6e0('0x9')]('/',auth[_0xe6e0('0xa')](),controller[_0xe6e0('0xb')]);router['get'](_0xe6e0('0xc'),auth[_0xe6e0('0xa')](),controller[_0xe6e0('0xd')]);router[_0xe6e0('0xe')]('/',auth[_0xe6e0('0xa')](),controller[_0xe6e0('0xf')]);router[_0xe6e0('0x10')]('/:id',auth[_0xe6e0('0xa')](),controller[_0xe6e0('0x11')]);router[_0xe6e0('0x12')]('/:id',auth[_0xe6e0('0xa')](),controller[_0xe6e0('0x13')]);module[_0xe6e0('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index ff1576e..f17cefe 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 _0xec37=['exports','variable','customVariable','keyValue','string','STRING','sequelize'];(function(_0x9cbf57,_0x8aefe8){var _0x4bf654=function(_0x417e43){while(--_0x417e43){_0x9cbf57['push'](_0x9cbf57['shift']());}};_0x4bf654(++_0x8aefe8);}(_0xec37,0x102));var _0x7ec3=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xec37[_0x9b2bb0];return _0x2cdb3b;};'use strict';var Sequelize=require(_0x7ec3('0x0'));module[_0x7ec3('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x7ec3('0x2'),_0x7ec3('0x3'),_0x7ec3('0x4'),'picklist'),'defaultValue':_0x7ec3('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7ec3('0x5'),_0x7ec3('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x7ec3('0x6')]},'idField':{'type':Sequelize[_0x7ec3('0x6')]},'nameField':{'type':Sequelize[_0x7ec3('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7ec3('0x6')]}}; \ No newline at end of file +var _0xa709=['string','STRING','BOOLEAN','exports','ENUM','variable','customVariable'];(function(_0x30dc40,_0x409fbc){var _0x136765=function(_0x335129){while(--_0x335129){_0x30dc40['push'](_0x30dc40['shift']());}};_0x136765(++_0x409fbc);}(_0xa709,0x145));var _0x9a70=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0xa709[_0x155c64];return _0x1f154a;};'use strict';var Sequelize=require('sequelize');module[_0x9a70('0x0')]={'type':{'type':Sequelize[_0x9a70('0x1')]('string',_0x9a70('0x2'),_0x9a70('0x3'),'keyValue','picklist'),'defaultValue':_0x9a70('0x4')},'content':{'type':Sequelize[_0x9a70('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9a70('0x4'),_0x9a70('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x9a70('0x5')]},'idField':{'type':Sequelize[_0x9a70('0x5')]},'nameField':{'type':Sequelize[_0x9a70('0x5')]},'customField':{'type':Sequelize[_0x9a70('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9a70('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5b4c1ca..ad26a80 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 _0x0903=['../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','send','index','map','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','Dynamics365Field','then','includeAll','include','findAll','rows','catch','show','fields','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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'];(function(_0x16c0c6,_0x307157){var _0x537bc2=function(_0x4982ab){while(--_0x4982ab){_0x16c0c6['push'](_0x16c0c6['shift']());}};_0x537bc2(++_0x307157);}(_0x0903,0x1c3));var _0x3090=function(_0x5ad07c,_0x324dcd){_0x5ad07c=_0x5ad07c-0x0;var _0x204bae=_0x0903[_0x5ad07c];return _0x204bae;};'use strict';var emlformat=require(_0x3090('0x0'));var rimraf=require(_0x3090('0x1'));var zipdir=require(_0x3090('0x2'));var jsonpatch=require(_0x3090('0x3'));var rp=require(_0x3090('0x4'));var moment=require('moment');var BPromise=require(_0x3090('0x5'));var Mustache=require(_0x3090('0x6'));var util=require(_0x3090('0x7'));var path=require('path');var sox=require(_0x3090('0x8'));var csv=require(_0x3090('0x9'));var ejs=require(_0x3090('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3090('0xb'));var squel=require(_0x3090('0xc'));var crypto=require(_0x3090('0xd'));var jsforce=require(_0x3090('0xe'));var deskjs=require(_0x3090('0xf'));var toCsv=require(_0x3090('0x9'));var querystring=require(_0x3090('0x10'));var Papa=require('papaparse');var Redis=require(_0x3090('0x11'));var authService=require(_0x3090('0x12'));var qs=require(_0x3090('0x13'));var as=require(_0x3090('0x14'));var hardwareService=require(_0x3090('0x15'));var logger=require(_0x3090('0x16'))('api');var utils=require(_0x3090('0x17'));var config=require(_0x3090('0x18'));var licenseUtil=require(_0x3090('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38ce2f,_0x7bdb9e){_0x7bdb9e=_0x7bdb9e||0xcc;return function(_0x494194){if(_0x494194){return _0x38ce2f['sendStatus'](_0x7bdb9e);}return _0x38ce2f[_0x3090('0x1a')](_0x7bdb9e)[_0x3090('0x1b')]();};}function respondWithResult(_0x116236,_0x284e9){_0x284e9=_0x284e9||0xc8;return function(_0x2b50db){if(_0x2b50db){return _0x116236[_0x3090('0x1a')](_0x284e9)[_0x3090('0x1c')](_0x2b50db);}};}function respondWithFilteredResult(_0x599a45,_0x2ae968){return function(_0x380240){if(_0x380240){var _0x2ec0fe=typeof _0x2ae968[_0x3090('0x1d')]===_0x3090('0x1e')&&typeof _0x2ae968[_0x3090('0x1f')]===_0x3090('0x1e');var _0x20b840=_0x380240['count'];var _0x564d7a=_0x2ec0fe?0x0:_0x2ae968[_0x3090('0x1d')];var _0x32ede9=_0x2ec0fe?_0x380240[_0x3090('0x20')]:_0x2ae968['offset']+_0x2ae968['limit'];var _0x5864b0;if(_0x32ede9>=_0x20b840){_0x32ede9=_0x20b840;_0x5864b0=0xc8;}else{_0x5864b0=0xce;}_0x599a45[_0x3090('0x1a')](_0x5864b0);return _0x599a45[_0x3090('0x21')](_0x3090('0x22'),_0x564d7a+'-'+_0x32ede9+'/'+_0x20b840)['json'](_0x380240);}return null;};}function patchUpdates(_0x25b86c){return function(_0x20181f){try{jsonpatch[_0x3090('0x23')](_0x20181f,_0x25b86c,!![]);}catch(_0x11387e){return BPromise[_0x3090('0x24')](_0x11387e);}return _0x20181f[_0x3090('0x25')]();};}function saveUpdates(_0x59c67f,_0x316a6a){return function(_0x59f504){if(_0x59f504){return _0x59f504[_0x3090('0x26')](_0x59c67f)['then'](function(_0x114f2c){return _0x114f2c;});}return null;};}function removeEntity(_0x26ad63,_0x18be1b){return function(_0x285bcb){if(_0x285bcb){return _0x285bcb[_0x3090('0x27')]()['then'](function(){_0x26ad63[_0x3090('0x1a')](0xcc)[_0x3090('0x1b')]();});}};}function handleEntityNotFound(_0x116ef7,_0x739f43){return function(_0x10b221){if(!_0x10b221){_0x116ef7[_0x3090('0x28')](0x194);}return _0x10b221;};}function handleError(_0x7a3abc,_0x2994e7){_0x2994e7=_0x2994e7||0x1f4;return function(_0x4512f8){logger[_0x3090('0x29')](_0x4512f8[_0x3090('0x2a')]);if(_0x4512f8['name']){delete _0x4512f8['name'];}_0x7a3abc[_0x3090('0x1a')](_0x2994e7)[_0x3090('0x2b')](_0x4512f8);};}exports[_0x3090('0x2c')]=function(_0x326502,_0x2ed27d){var _0x583341={},_0x2f5fea={},_0x4bcf67={'count':0x0,'rows':[]};var _0x3a49f5=_[_0x3090('0x2d')](db['Dynamics365Field']['rawAttributes'],function(_0x34f7b8){return{'name':_0x34f7b8['fieldName'],'type':_0x34f7b8[_0x3090('0x2e')][_0x3090('0x2f')]};});_0x2f5fea[_0x3090('0x30')]=_[_0x3090('0x2d')](_0x3a49f5,_0x3090('0x31'));_0x2f5fea[_0x3090('0x32')]=_[_0x3090('0x33')](_0x326502['query']);_0x2f5fea[_0x3090('0x34')]=_[_0x3090('0x35')](_0x2f5fea['model'],_0x2f5fea[_0x3090('0x32')]);_0x583341[_0x3090('0x36')]=_[_0x3090('0x35')](_0x2f5fea[_0x3090('0x30')],qs['fields'](_0x326502[_0x3090('0x32')]['fields']));_0x583341[_0x3090('0x36')]=_0x583341[_0x3090('0x36')][_0x3090('0x37')]?_0x583341[_0x3090('0x36')]:_0x2f5fea[_0x3090('0x30')];if(!_0x326502[_0x3090('0x32')][_0x3090('0x38')](_0x3090('0x39'))){_0x583341[_0x3090('0x1f')]=qs[_0x3090('0x1f')](_0x326502[_0x3090('0x32')][_0x3090('0x1f')]);_0x583341['offset']=qs['offset'](_0x326502['query'][_0x3090('0x1d')]);}_0x583341[_0x3090('0x3a')]=qs['sort'](_0x326502['query'][_0x3090('0x3b')]);_0x583341[_0x3090('0x3c')]=qs['filters'](_[_0x3090('0x3d')](_0x326502[_0x3090('0x32')],_0x2f5fea['filters']),_0x3a49f5);if(_0x326502[_0x3090('0x32')][_0x3090('0x3e')]){_0x583341[_0x3090('0x3c')]=_[_0x3090('0x3f')](_0x583341['where'],{'$or':_[_0x3090('0x2d')](_0x3a49f5,function(_0x4360af){if(_0x4360af[_0x3090('0x2e')]!==_0x3090('0x40')){var _0x4a23a0={};_0x4a23a0[_0x4360af[_0x3090('0x31')]]={'$like':'%'+_0x326502['query'][_0x3090('0x3e')]+'%'};return _0x4a23a0;}})});}_0x583341=_[_0x3090('0x3f')]({},_0x583341,_0x326502['options']);var _0x1139a4={'where':_0x583341['where']};return db[_0x3090('0x41')][_0x3090('0x20')](_0x1139a4)[_0x3090('0x42')](function(_0x240b89){_0x4bcf67[_0x3090('0x20')]=_0x240b89;if(_0x326502[_0x3090('0x32')][_0x3090('0x43')]){_0x583341[_0x3090('0x44')]=[{'all':!![]}];}return db['Dynamics365Field'][_0x3090('0x45')](_0x583341);})[_0x3090('0x42')](function(_0x1fdc5c){_0x4bcf67[_0x3090('0x46')]=_0x1fdc5c;return _0x4bcf67;})[_0x3090('0x42')](respondWithFilteredResult(_0x2ed27d,_0x583341))[_0x3090('0x47')](handleError(_0x2ed27d,null));};exports[_0x3090('0x48')]=function(_0x1733b4,_0x38eee1){var _0x47beca={'raw':!![],'where':{'id':_0x1733b4['params']['id']}},_0x4567bd={};_0x4567bd[_0x3090('0x30')]=_['keys'](db[_0x3090('0x41')]['rawAttributes']);_0x4567bd[_0x3090('0x32')]=_[_0x3090('0x33')](_0x1733b4[_0x3090('0x32')]);_0x4567bd[_0x3090('0x34')]=_[_0x3090('0x35')](_0x4567bd[_0x3090('0x30')],_0x4567bd[_0x3090('0x32')]);_0x47beca[_0x3090('0x36')]=_[_0x3090('0x35')](_0x4567bd['model'],qs[_0x3090('0x49')](_0x1733b4[_0x3090('0x32')][_0x3090('0x49')]));_0x47beca['attributes']=_0x47beca[_0x3090('0x36')][_0x3090('0x37')]?_0x47beca['attributes']:_0x4567bd['model'];if(_0x1733b4['query'][_0x3090('0x43')]){_0x47beca[_0x3090('0x44')]=[{'all':!![]}];}_0x47beca=_[_0x3090('0x3f')]({},_0x47beca,_0x1733b4[_0x3090('0x4a')]);return db[_0x3090('0x41')][_0x3090('0x4b')](_0x47beca)[_0x3090('0x42')](handleEntityNotFound(_0x38eee1,null))[_0x3090('0x42')](respondWithResult(_0x38eee1,null))[_0x3090('0x47')](handleError(_0x38eee1,null));};exports[_0x3090('0x4c')]=function(_0x977012,_0x38cf02){return db['Dynamics365Field'][_0x3090('0x4c')](_0x977012[_0x3090('0x4d')],{})[_0x3090('0x42')](respondWithResult(_0x38cf02,0xc9))[_0x3090('0x47')](handleError(_0x38cf02,null));};exports[_0x3090('0x26')]=function(_0xd2fca5,_0x2bb036){if(_0xd2fca5[_0x3090('0x4d')]['id']){delete _0xd2fca5[_0x3090('0x4d')]['id'];}return db['Dynamics365Field'][_0x3090('0x4b')]({'where':{'id':_0xd2fca5[_0x3090('0x4e')]['id']}})[_0x3090('0x42')](handleEntityNotFound(_0x2bb036,null))['then'](saveUpdates(_0xd2fca5[_0x3090('0x4d')],null))[_0x3090('0x42')](respondWithResult(_0x2bb036,null))['catch'](handleError(_0x2bb036,null));};exports[_0x3090('0x27')]=function(_0xe9f899,_0x503daf){return db[_0x3090('0x41')][_0x3090('0x4b')]({'where':{'id':_0xe9f899['params']['id']}})['then'](handleEntityNotFound(_0x503daf,null))['then'](removeEntity(_0x503daf,null))['catch'](handleError(_0x503daf,null));}; \ No newline at end of file +var _0x493c=['find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','keys','filters','model','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','intersection','length'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x493c,0x161));var _0xc493=function(_0x231160,_0x4608b9){_0x231160=_0x231160-0x0;var _0xa373ce=_0x493c[_0x231160];return _0xa373ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc493('0x0'));var zipdir=require(_0xc493('0x1'));var jsonpatch=require(_0xc493('0x2'));var rp=require('request-promise');var moment=require(_0xc493('0x3'));var BPromise=require(_0xc493('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc493('0x5'));var sox=require('sox');var csv=require(_0xc493('0x6'));var ejs=require(_0xc493('0x7'));var fs=require('fs');var fs_extra=require(_0xc493('0x8'));var _=require(_0xc493('0x9'));var squel=require(_0xc493('0xa'));var crypto=require(_0xc493('0xb'));var jsforce=require(_0xc493('0xc'));var deskjs=require(_0xc493('0xd'));var toCsv=require(_0xc493('0x6'));var querystring=require(_0xc493('0xe'));var Papa=require('papaparse');var Redis=require(_0xc493('0xf'));var authService=require(_0xc493('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc493('0x11'));var logger=require(_0xc493('0x12'))(_0xc493('0x13'));var utils=require(_0xc493('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x35dfcb,_0x7808e1){_0x7808e1=_0x7808e1||0xcc;return function(_0x2e4eaa){if(_0x2e4eaa){return _0x35dfcb[_0xc493('0x15')](_0x7808e1);}return _0x35dfcb[_0xc493('0x16')](_0x7808e1)[_0xc493('0x17')]();};}function respondWithResult(_0x3b3b6f,_0x10de41){_0x10de41=_0x10de41||0xc8;return function(_0x4b1b89){if(_0x4b1b89){return _0x3b3b6f[_0xc493('0x16')](_0x10de41)[_0xc493('0x18')](_0x4b1b89);}};}function respondWithFilteredResult(_0x1672eb,_0xee1c23){return function(_0x2293e2){if(_0x2293e2){var _0x10fba1=typeof _0xee1c23[_0xc493('0x19')]==='undefined'&&typeof _0xee1c23[_0xc493('0x1a')]===_0xc493('0x1b');var _0x185ef0=_0x2293e2[_0xc493('0x1c')];var _0x26783a=_0x10fba1?0x0:_0xee1c23[_0xc493('0x19')];var _0x65b13e=_0x10fba1?_0x2293e2[_0xc493('0x1c')]:_0xee1c23[_0xc493('0x19')]+_0xee1c23[_0xc493('0x1a')];var _0x10ab90;if(_0x65b13e>=_0x185ef0){_0x65b13e=_0x185ef0;_0x10ab90=0xc8;}else{_0x10ab90=0xce;}_0x1672eb[_0xc493('0x16')](_0x10ab90);return _0x1672eb[_0xc493('0x1d')]('Content-Range',_0x26783a+'-'+_0x65b13e+'/'+_0x185ef0)[_0xc493('0x18')](_0x2293e2);}return null;};}function patchUpdates(_0x1bfe43){return function(_0x5cb75b){try{jsonpatch[_0xc493('0x1e')](_0x5cb75b,_0x1bfe43,!![]);}catch(_0x50b416){return BPromise['reject'](_0x50b416);}return _0x5cb75b[_0xc493('0x1f')]();};}function saveUpdates(_0x5ddb9e,_0x4881ed){return function(_0x230f49){if(_0x230f49){return _0x230f49['update'](_0x5ddb9e)['then'](function(_0x531650){return _0x531650;});}return null;};}function removeEntity(_0x5d0147,_0x31a8ca){return function(_0x30230e){if(_0x30230e){return _0x30230e[_0xc493('0x20')]()[_0xc493('0x21')](function(){_0x5d0147[_0xc493('0x16')](0xcc)[_0xc493('0x17')]();});}};}function handleEntityNotFound(_0x4429ba,_0x39101b){return function(_0x161965){if(!_0x161965){_0x4429ba[_0xc493('0x15')](0x194);}return _0x161965;};}function handleError(_0x11dc88,_0xad98ff){_0xad98ff=_0xad98ff||0x1f4;return function(_0x1769de){logger[_0xc493('0x22')](_0x1769de[_0xc493('0x23')]);if(_0x1769de[_0xc493('0x24')]){delete _0x1769de[_0xc493('0x24')];}_0x11dc88[_0xc493('0x16')](_0xad98ff)[_0xc493('0x25')](_0x1769de);};}exports[_0xc493('0x26')]=function(_0x1c3dc2,_0x4fbe45){var _0x400445={},_0x99df85={},_0x7623c5={'count':0x0,'rows':[]};var _0x4618f2=_[_0xc493('0x27')](db[_0xc493('0x28')][_0xc493('0x29')],function(_0x1d099c){return{'name':_0x1d099c[_0xc493('0x2a')],'type':_0x1d099c[_0xc493('0x2b')][_0xc493('0x2c')]};});_0x99df85['model']=_['map'](_0x4618f2,'name');_0x99df85['query']=_[_0xc493('0x2d')](_0x1c3dc2['query']);_0x99df85[_0xc493('0x2e')]=_['intersection'](_0x99df85[_0xc493('0x2f')],_0x99df85[_0xc493('0x30')]);_0x400445[_0xc493('0x31')]=_['intersection'](_0x99df85[_0xc493('0x2f')],qs[_0xc493('0x32')](_0x1c3dc2[_0xc493('0x30')][_0xc493('0x32')]));_0x400445[_0xc493('0x31')]=_0x400445[_0xc493('0x31')]['length']?_0x400445[_0xc493('0x31')]:_0x99df85[_0xc493('0x2f')];if(!_0x1c3dc2[_0xc493('0x30')][_0xc493('0x33')](_0xc493('0x34'))){_0x400445[_0xc493('0x1a')]=qs[_0xc493('0x1a')](_0x1c3dc2[_0xc493('0x30')][_0xc493('0x1a')]);_0x400445[_0xc493('0x19')]=qs[_0xc493('0x19')](_0x1c3dc2['query'][_0xc493('0x19')]);}_0x400445['order']=qs[_0xc493('0x35')](_0x1c3dc2[_0xc493('0x30')][_0xc493('0x35')]);_0x400445[_0xc493('0x36')]=qs[_0xc493('0x2e')](_[_0xc493('0x37')](_0x1c3dc2[_0xc493('0x30')],_0x99df85[_0xc493('0x2e')]),_0x4618f2);if(_0x1c3dc2[_0xc493('0x30')][_0xc493('0x38')]){_0x400445[_0xc493('0x36')]=_[_0xc493('0x39')](_0x400445[_0xc493('0x36')],{'$or':_['map'](_0x4618f2,function(_0x516b3b){if(_0x516b3b['type']!=='VIRTUAL'){var _0x1b81d2={};_0x1b81d2[_0x516b3b[_0xc493('0x24')]]={'$like':'%'+_0x1c3dc2[_0xc493('0x30')]['filter']+'%'};return _0x1b81d2;}})});}_0x400445=_[_0xc493('0x39')]({},_0x400445,_0x1c3dc2[_0xc493('0x3a')]);var _0x27ce4c={'where':_0x400445['where']};return db[_0xc493('0x28')][_0xc493('0x1c')](_0x27ce4c)[_0xc493('0x21')](function(_0x4ac7b0){_0x7623c5[_0xc493('0x1c')]=_0x4ac7b0;if(_0x1c3dc2['query'][_0xc493('0x3b')]){_0x400445[_0xc493('0x3c')]=[{'all':!![]}];}return db[_0xc493('0x28')][_0xc493('0x3d')](_0x400445);})['then'](function(_0x2258f0){_0x7623c5['rows']=_0x2258f0;return _0x7623c5;})['then'](respondWithFilteredResult(_0x4fbe45,_0x400445))[_0xc493('0x3e')](handleError(_0x4fbe45,null));};exports[_0xc493('0x3f')]=function(_0x5530e2,_0xa48251){var _0x582312={'raw':!![],'where':{'id':_0x5530e2[_0xc493('0x40')]['id']}},_0x45f2d9={};_0x45f2d9[_0xc493('0x2f')]=_[_0xc493('0x2d')](db[_0xc493('0x28')][_0xc493('0x29')]);_0x45f2d9[_0xc493('0x30')]=_[_0xc493('0x2d')](_0x5530e2[_0xc493('0x30')]);_0x45f2d9[_0xc493('0x2e')]=_[_0xc493('0x41')](_0x45f2d9[_0xc493('0x2f')],_0x45f2d9[_0xc493('0x30')]);_0x582312[_0xc493('0x31')]=_['intersection'](_0x45f2d9[_0xc493('0x2f')],qs[_0xc493('0x32')](_0x5530e2[_0xc493('0x30')]['fields']));_0x582312[_0xc493('0x31')]=_0x582312[_0xc493('0x31')][_0xc493('0x42')]?_0x582312[_0xc493('0x31')]:_0x45f2d9[_0xc493('0x2f')];if(_0x5530e2[_0xc493('0x30')]['includeAll']){_0x582312['include']=[{'all':!![]}];}_0x582312=_[_0xc493('0x39')]({},_0x582312,_0x5530e2[_0xc493('0x3a')]);return db['Dynamics365Field'][_0xc493('0x43')](_0x582312)['then'](handleEntityNotFound(_0xa48251,null))[_0xc493('0x21')](respondWithResult(_0xa48251,null))[_0xc493('0x3e')](handleError(_0xa48251,null));};exports[_0xc493('0x44')]=function(_0x470d1c,_0x389227){return db[_0xc493('0x28')][_0xc493('0x44')](_0x470d1c[_0xc493('0x45')],{})['then'](respondWithResult(_0x389227,0xc9))[_0xc493('0x3e')](handleError(_0x389227,null));};exports['update']=function(_0x58b639,_0x2cfc16){if(_0x58b639[_0xc493('0x45')]['id']){delete _0x58b639['body']['id'];}return db[_0xc493('0x28')]['find']({'where':{'id':_0x58b639['params']['id']}})[_0xc493('0x21')](handleEntityNotFound(_0x2cfc16,null))[_0xc493('0x21')](saveUpdates(_0x58b639[_0xc493('0x45')],null))[_0xc493('0x21')](respondWithResult(_0x2cfc16,null))['catch'](handleError(_0x2cfc16,null));};exports[_0xc493('0x20')]=function(_0x7f809a,_0x367d01){return db[_0xc493('0x28')][_0xc493('0x43')]({'where':{'id':_0x7f809a[_0xc493('0x40')]['id']}})[_0xc493('0x21')](handleEntityNotFound(_0x367d01,null))['then'](removeEntity(_0x367d01,null))[_0xc493('0x3e')](handleError(_0x367d01,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 3f768e0..8dab5d1 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 _0xffde=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','Dynamics365Field','dynamics365_unique_index','idField','FieldId'];(function(_0x2d95fe,_0x371ee9){var _0x282c89=function(_0x3e4af1){while(--_0x3e4af1){_0x2d95fe['push'](_0x2d95fe['shift']());}};_0x282c89(++_0x371ee9);}(_0xffde,0x130));var _0xeffd=function(_0x2fc3fa,_0x117c80){_0x2fc3fa=_0x2fc3fa-0x0;var _0x36de6d=_0xffde[_0x2fc3fa];return _0x36de6d;};'use strict';var _=require(_0xeffd('0x0'));var util=require(_0xeffd('0x1'));var logger=require(_0xeffd('0x2'))(_0xeffd('0x3'));var moment=require(_0xeffd('0x4'));var BPromise=require(_0xeffd('0x5'));var rp=require(_0xeffd('0x6'));var fs=require('fs');var path=require(_0xeffd('0x7'));var rimraf=require(_0xeffd('0x8'));var config=require(_0xeffd('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0xeffd('0xa')]=function(_0x2ffb32,_0x1b1dc5){return _0x2ffb32[_0xeffd('0xb')](_0xeffd('0xc'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xeffd('0xd'),'fields':[_0xeffd('0xe'),_0xeffd('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4a8a=['idField','FieldId','lodash','util','api','moment','bluebird','request-promise','rimraf','./intDynamics365Field.attributes','exports','dynamics365_unique_index'];(function(_0x31ee6c,_0x3c4217){var _0x8fae3a=function(_0x569129){while(--_0x569129){_0x31ee6c['push'](_0x31ee6c['shift']());}};_0x8fae3a(++_0x3c4217);}(_0x4a8a,0x15e));var _0xa4a8=function(_0x1f530d,_0x18a19e){_0x1f530d=_0x1f530d-0x0;var _0x22103f=_0x4a8a[_0x1f530d];return _0x22103f;};'use strict';var _=require(_0xa4a8('0x0'));var util=require(_0xa4a8('0x1'));var logger=require('../../config/logger')(_0xa4a8('0x2'));var moment=require(_0xa4a8('0x3'));var BPromise=require(_0xa4a8('0x4'));var rp=require(_0xa4a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4a8('0x6'));var config=require('../../config/environment');var attributes=require(_0xa4a8('0x7'));module[_0xa4a8('0x8')]=function(_0x2a628d,_0x3d25a2){return _0x2a628d['define']('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xa4a8('0x9'),'fields':[_0xa4a8('0xa'),_0xa4a8('0xb')],'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 7b57d42..5220f2e 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 _0x1eec=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x167b75,_0x3277a5){var _0x4c0cd8=function(_0xfcdf77){while(--_0xfcdf77){_0x167b75['push'](_0x167b75['shift']());}};_0x4c0cd8(++_0x3277a5);}(_0x1eec,0x1c2));var _0xc1ee=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x1eec[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0xc1ee('0x0'));var moment=require(_0xc1ee('0x1'));var BPromise=require(_0xc1ee('0x2'));var rs=require(_0xc1ee('0x3'));var fs=require('fs');var Redis=require(_0xc1ee('0x4'));var db=require(_0xc1ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc1ee('0x6'))(_0xc1ee('0x7'));var config=require(_0xc1ee('0x8'));var jayson=require(_0xc1ee('0x9'));var client=jayson[_0xc1ee('0xa')][_0xc1ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8e82f9,_0x7533b2,_0x1e45de){return new BPromise(function(_0x163836,_0x139375){return client[_0xc1ee('0xc')](_0x8e82f9,_0x1e45de)[_0xc1ee('0xd')](function(_0x54d11e){logger[_0xc1ee('0xe')](_0xc1ee('0xf'),_0x7533b2,_0xc1ee('0x10'));logger[_0xc1ee('0x11')](_0xc1ee('0x12'),_0x7533b2,_0xc1ee('0x10'),JSON[_0xc1ee('0x13')](_0x54d11e));if(_0x54d11e[_0xc1ee('0x14')]){if(_0x54d11e[_0xc1ee('0x14')][_0xc1ee('0x15')]===0x1f4){logger[_0xc1ee('0x14')](_0xc1ee('0xf'),_0x7533b2,_0x54d11e['error']['message']);return _0x139375(_0x54d11e[_0xc1ee('0x14')][_0xc1ee('0x16')]);}logger[_0xc1ee('0x14')](_0xc1ee('0xf'),_0x7533b2,_0x54d11e[_0xc1ee('0x14')]['message']);return _0x163836(_0x54d11e[_0xc1ee('0x14')]['message']);}else{logger['info'](_0xc1ee('0xf'),_0x7533b2,_0xc1ee('0x10'));_0x163836(_0x54d11e[_0xc1ee('0x17')][_0xc1ee('0x16')]);}})['catch'](function(_0xa01b02){logger[_0xc1ee('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x7533b2,_0xa01b02);_0x139375(_0xa01b02);});});} \ No newline at end of file +var _0x1042=['util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch'];(function(_0x110394,_0x4502e0){var _0x325610=function(_0x22c179){while(--_0x22c179){_0x110394['push'](_0x110394['shift']());}};_0x325610(++_0x4502e0);}(_0x1042,0xb4));var _0x2104=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1042[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2104('0x0'));var moment=require(_0x2104('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2104('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x2104('0x3'));var logger=require(_0x2104('0x4'))('rpc');var config=require(_0x2104('0x5'));var jayson=require(_0x2104('0x6'));var client=jayson[_0x2104('0x7')][_0x2104('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x436b47,_0x3354ad,_0x10e9c6){return new BPromise(function(_0x36aaf2,_0x2f0603){return client[_0x2104('0x9')](_0x436b47,_0x10e9c6)[_0x2104('0xa')](function(_0xf72bc2){logger[_0x2104('0xb')]('Dynamics365Field,\x20%s,\x20%s',_0x3354ad,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x3354ad,_0x2104('0xc'),JSON[_0x2104('0xd')](_0xf72bc2));if(_0xf72bc2['error']){if(_0xf72bc2[_0x2104('0xe')][_0x2104('0xf')]===0x1f4){logger[_0x2104('0xe')](_0x2104('0x10'),_0x3354ad,_0xf72bc2['error']['message']);return _0x2f0603(_0xf72bc2['error'][_0x2104('0x11')]);}logger[_0x2104('0xe')](_0x2104('0x10'),_0x3354ad,_0xf72bc2[_0x2104('0xe')][_0x2104('0x11')]);return _0x36aaf2(_0xf72bc2['error'][_0x2104('0x11')]);}else{logger[_0x2104('0xb')](_0x2104('0x10'),_0x3354ad,_0x2104('0xc'));_0x36aaf2(_0xf72bc2[_0x2104('0x12')]['message']);}})[_0x2104('0x13')](function(_0x4c965f){logger[_0x2104('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x3354ad,_0x4c965f);_0x2f0603(_0x4c965f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 4bfc443..1d31570 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 _0x92f6=['./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56aae2,_0x4cce4f){var _0x425590=function(_0x23c5f3){while(--_0x23c5f3){_0x56aae2['push'](_0x56aae2['shift']());}};_0x425590(++_0x4cce4f);}(_0x92f6,0x124));var _0x692f=function(_0x31c929,_0x322a96){_0x31c929=_0x31c929-0x0;var _0x2dee6f=_0x92f6[_0x31c929];return _0x2dee6f;};'use strict';var multer=require('multer');var util=require(_0x692f('0x0'));var path=require(_0x692f('0x1'));var timeout=require(_0x692f('0x2'));var express=require('express');var router=express[_0x692f('0x3')]();var fs_extra=require(_0x692f('0x4'));var auth=require(_0x692f('0x5'));var interaction=require(_0x692f('0x6'));var config=require(_0x692f('0x7'));var controller=require(_0x692f('0x8'));router[_0x692f('0x9')]('/',auth[_0x692f('0xa')](),controller[_0x692f('0xb')]);router[_0x692f('0x9')](_0x692f('0xc'),auth[_0x692f('0xa')](),controller[_0x692f('0xd')]);router['get'](_0x692f('0xe'),auth[_0x692f('0xa')](),controller[_0x692f('0xf')]);router[_0x692f('0x9')](_0x692f('0x10'),auth[_0x692f('0xa')](),controller[_0x692f('0x11')]);router[_0x692f('0x12')]('/',auth[_0x692f('0xa')](),controller[_0x692f('0x13')]);router[_0x692f('0x12')](_0x692f('0xe'),auth[_0x692f('0xa')](),controller['addConfiguration']);router[_0x692f('0x14')]('/:id',auth[_0x692f('0xa')](),controller[_0x692f('0x15')]);router[_0x692f('0x16')](_0x692f('0xc'),auth[_0x692f('0xa')](),controller[_0x692f('0x17')]);module[_0x692f('0x18')]=router; \ No newline at end of file +var _0x854e=['show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','get','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x854e,0xe7));var _0xe854=function(_0x30126c,_0x43a5a3){_0x30126c=_0x30126c-0x0;var _0x184d7f=_0x854e[_0x30126c];return _0x184d7f;};'use strict';var multer=require(_0xe854('0x0'));var util=require(_0xe854('0x1'));var path=require(_0xe854('0x2'));var timeout=require(_0xe854('0x3'));var express=require(_0xe854('0x4'));var router=express[_0xe854('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe854('0x6'));var controller=require(_0xe854('0x7'));router['get']('/',auth[_0xe854('0x8')](),controller['index']);router[_0xe854('0x9')](_0xe854('0xa'),auth[_0xe854('0x8')](),controller[_0xe854('0xb')]);router['get'](_0xe854('0xc'),auth['isAuthenticated'](),controller[_0xe854('0xd')]);router[_0xe854('0x9')]('/:id/fields',auth[_0xe854('0x8')](),controller[_0xe854('0xe')]);router[_0xe854('0xf')]('/',auth[_0xe854('0x8')](),controller[_0xe854('0x10')]);router[_0xe854('0xf')](_0xe854('0xc'),auth[_0xe854('0x8')](),controller[_0xe854('0x11')]);router[_0xe854('0x12')](_0xe854('0xa'),auth[_0xe854('0x8')](),controller[_0xe854('0x13')]);router[_0xe854('0x14')](_0xe854('0xa'),auth[_0xe854('0x8')](),controller[_0xe854('0x15')]);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 c260754..6b44031 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 _0xdb28=['username','remoteUri','sequelize','exports','STRING'];(function(_0x4455bc,_0x25c254){var _0x721c22=function(_0x29e62e){while(--_0x29e62e){_0x4455bc['push'](_0x4455bc['shift']());}};_0x721c22(++_0x25c254);}(_0xdb28,0x106));var _0x8db2=function(_0x131121,_0x1d430a){_0x131121=_0x131121-0x0;var _0x14684d=_0xdb28[_0x131121];return _0x14684d;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'name':{'type':Sequelize[_0x8db2('0x2')]},'description':{'type':Sequelize[_0x8db2('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x8db2('0x3')},'apiKey':{'type':Sequelize[_0x8db2('0x2')]},'remoteUri':{'type':Sequelize[_0x8db2('0x2')],'unique':_0x8db2('0x4')},'serverUrl':{'type':Sequelize[_0x8db2('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0120=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4fbb49,_0x16e453){var _0x279e2e=function(_0xfbc666){while(--_0xfbc666){_0x4fbb49['push'](_0x4fbb49['shift']());}};_0x279e2e(++_0x16e453);}(_0x0120,0x6f));var _0x0012=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x0120[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'name':{'type':Sequelize[_0x0012('0x2')]},'description':{'type':Sequelize[_0x0012('0x2')]},'username':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x3')},'apiKey':{'type':Sequelize[_0x0012('0x2')]},'remoteUri':{'type':Sequelize[_0x0012('0x2')],'unique':_0x0012('0x4')},'serverUrl':{'type':Sequelize[_0x0012('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index f7bd6b2..8a8bd5b 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 _0xda3f=['choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','rimraf','zip-dir','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskAccount','includeAll','include','params','length','find','catch','create','body','getConfigurations','findOne','FreshdeskConfiguration','options','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','remoteUri','apiKey','slice','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','base64','requester','subject','description','priority','group','source','ticket_type','company','remove','includes','custom_text','custom_dropdown','label','default'];(function(_0x36a1a0,_0x31c0f7){var _0x34192c=function(_0x3772dc){while(--_0x3772dc){_0x36a1a0['push'](_0x36a1a0['shift']());}};_0x34192c(++_0x31c0f7);}(_0xda3f,0xec));var _0xfda3=function(_0x530867,_0x2663af){_0x530867=_0x530867-0x0;var _0x4c78f3=_0xda3f[_0x530867];return _0x4c78f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x583125,_0x5d7d5b){_0x5d7d5b=_0x5d7d5b||0xcc;return function(_0x3fd031){if(_0x3fd031){return _0x583125[_0xfda3('0x17')](_0x5d7d5b);}return _0x583125['status'](_0x5d7d5b)['end']();};}function respondWithResult(_0x587e9b,_0x227d72){_0x227d72=_0x227d72||0xc8;return function(_0x477fc0){if(_0x477fc0){return _0x587e9b['status'](_0x227d72)['json'](_0x477fc0);}};}function respondWithFilteredResult(_0x533365,_0x80ea80){return function(_0x474707){if(_0x474707){var _0x249dc6=typeof _0x80ea80[_0xfda3('0x18')]===_0xfda3('0x19')&&typeof _0x80ea80[_0xfda3('0x1a')]===_0xfda3('0x19');var _0x93c8ef=_0x474707[_0xfda3('0x1b')];var _0xc62ae6=_0x249dc6?0x0:_0x80ea80['offset'];var _0x15ddb9=_0x249dc6?_0x474707[_0xfda3('0x1b')]:_0x80ea80[_0xfda3('0x18')]+_0x80ea80[_0xfda3('0x1a')];var _0x59a887;if(_0x15ddb9>=_0x93c8ef){_0x15ddb9=_0x93c8ef;_0x59a887=0xc8;}else{_0x59a887=0xce;}_0x533365[_0xfda3('0x1c')](_0x59a887);return _0x533365[_0xfda3('0x1d')](_0xfda3('0x1e'),_0xc62ae6+'-'+_0x15ddb9+'/'+_0x93c8ef)['json'](_0x474707);}return null;};}function patchUpdates(_0x5ad52a){return function(_0xa0449d){try{jsonpatch[_0xfda3('0x1f')](_0xa0449d,_0x5ad52a,!![]);}catch(_0x4ea9f5){return BPromise['reject'](_0x4ea9f5);}return _0xa0449d[_0xfda3('0x20')]();};}function saveUpdates(_0xef2535,_0x1e15a8){return function(_0x2c0ae9){if(_0x2c0ae9){return _0x2c0ae9[_0xfda3('0x21')](_0xef2535)[_0xfda3('0x22')](function(_0x2677f6){return _0x2677f6;});}return null;};}function removeEntity(_0xc6fb9a,_0x16eaa6){return function(_0x5499f5){if(_0x5499f5){return _0x5499f5[_0xfda3('0x23')]()[_0xfda3('0x22')](function(){_0xc6fb9a[_0xfda3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45a977,_0x39e246){return function(_0x172cfb){if(!_0x172cfb){_0x45a977[_0xfda3('0x17')](0x194);}return _0x172cfb;};}function handleError(_0x1cb831,_0xad9f7b){_0xad9f7b=_0xad9f7b||0x1f4;return function(_0x514d2a){logger[_0xfda3('0x24')](_0x514d2a[_0xfda3('0x25')]);if(_0x514d2a[_0xfda3('0x26')]){delete _0x514d2a[_0xfda3('0x26')];}_0x1cb831[_0xfda3('0x1c')](_0xad9f7b)['send'](_0x514d2a);};}exports[_0xfda3('0x27')]=function(_0x4101b1,_0x301509){var _0x474992={},_0xe21ec6={},_0x3cfeb2={'count':0x0,'rows':[]};var _0x26e544=_['map'](db['FreshdeskAccount'][_0xfda3('0x28')],function(_0x4fd277){return{'name':_0x4fd277['fieldName'],'type':_0x4fd277[_0xfda3('0x29')][_0xfda3('0x2a')]};});_0xe21ec6[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x26e544,_0xfda3('0x26'));_0xe21ec6[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x4101b1[_0xfda3('0x2d')]);_0xe21ec6[_0xfda3('0x2f')]=_['intersection'](_0xe21ec6[_0xfda3('0x2b')],_0xe21ec6[_0xfda3('0x2d')]);_0x474992[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0xe21ec6[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x474992[_0xfda3('0x30')]=_0x474992['attributes']['length']?_0x474992[_0xfda3('0x30')]:_0xe21ec6[_0xfda3('0x2b')];if(!_0x4101b1['query'][_0xfda3('0x33')](_0xfda3('0x34'))){_0x474992[_0xfda3('0x1a')]=qs['limit'](_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x1a')]);_0x474992[_0xfda3('0x18')]=qs[_0xfda3('0x18')](_0x4101b1[_0xfda3('0x2d')]['offset']);}_0x474992[_0xfda3('0x35')]=qs[_0xfda3('0x36')](_0x4101b1[_0xfda3('0x2d')]['sort']);_0x474992[_0xfda3('0x37')]=qs['filters'](_[_0xfda3('0x38')](_0x4101b1[_0xfda3('0x2d')],_0xe21ec6[_0xfda3('0x2f')]),_0x26e544);if(_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x39')]){_0x474992[_0xfda3('0x37')]=_[_0xfda3('0x3a')](_0x474992[_0xfda3('0x37')],{'$or':_['map'](_0x26e544,function(_0x24c7ad){if(_0x24c7ad[_0xfda3('0x29')]!==_0xfda3('0x3b')){var _0x8ed2ba={};_0x8ed2ba[_0x24c7ad['name']]={'$like':'%'+_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x39')]+'%'};return _0x8ed2ba;}})});}_0x474992=_[_0xfda3('0x3a')]({},_0x474992,_0x4101b1['options']);var _0x5ac61e={'where':_0x474992[_0xfda3('0x37')]};return db[_0xfda3('0x3c')][_0xfda3('0x1b')](_0x5ac61e)[_0xfda3('0x22')](function(_0x2b415d){_0x3cfeb2[_0xfda3('0x1b')]=_0x2b415d;if(_0x4101b1[_0xfda3('0x2d')][_0xfda3('0x3d')]){_0x474992[_0xfda3('0x3e')]=[{'all':!![]}];}return db[_0xfda3('0x3c')]['findAll'](_0x474992);})[_0xfda3('0x22')](function(_0x22b848){_0x3cfeb2['rows']=_0x22b848;return _0x3cfeb2;})[_0xfda3('0x22')](respondWithFilteredResult(_0x301509,_0x474992))['catch'](handleError(_0x301509,null));};exports['show']=function(_0x4e6886,_0x2208bc){var _0x107fb1={'raw':![],'where':{'id':_0x4e6886[_0xfda3('0x3f')]['id']}},_0x260977={};_0x260977['model']=_[_0xfda3('0x2e')](db[_0xfda3('0x3c')][_0xfda3('0x28')]);_0x260977[_0xfda3('0x2d')]=_['keys'](_0x4e6886[_0xfda3('0x2d')]);_0x260977[_0xfda3('0x2f')]=_[_0xfda3('0x31')](_0x260977['model'],_0x260977['query']);_0x107fb1[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x260977[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x4e6886[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x107fb1[_0xfda3('0x30')]=_0x107fb1[_0xfda3('0x30')][_0xfda3('0x40')]?_0x107fb1[_0xfda3('0x30')]:_0x260977[_0xfda3('0x2b')];if(_0x4e6886[_0xfda3('0x2d')][_0xfda3('0x3d')]){_0x107fb1[_0xfda3('0x3e')]=[{'all':!![]}];}_0x107fb1=_['merge']({},_0x107fb1,_0x4e6886['options']);return db[_0xfda3('0x3c')][_0xfda3('0x41')](_0x107fb1)[_0xfda3('0x22')](handleEntityNotFound(_0x2208bc,null))[_0xfda3('0x22')](respondWithResult(_0x2208bc,null))[_0xfda3('0x42')](handleError(_0x2208bc,null));};exports[_0xfda3('0x43')]=function(_0x192133,_0x125f5a){return db[_0xfda3('0x3c')][_0xfda3('0x43')](_0x192133['body'],{})[_0xfda3('0x22')](respondWithResult(_0x125f5a,0xc9))[_0xfda3('0x42')](handleError(_0x125f5a,null));};exports[_0xfda3('0x21')]=function(_0x36aa3a,_0x26496a){if(_0x36aa3a['body']['id']){delete _0x36aa3a[_0xfda3('0x44')]['id'];}return db[_0xfda3('0x3c')][_0xfda3('0x41')]({'where':{'id':_0x36aa3a['params']['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x26496a,null))[_0xfda3('0x22')](saveUpdates(_0x36aa3a[_0xfda3('0x44')],null))['then'](respondWithResult(_0x26496a,null))[_0xfda3('0x42')](handleError(_0x26496a,null));};exports[_0xfda3('0x23')]=function(_0x2f54eb,_0x2f6e62){return db[_0xfda3('0x3c')]['find']({'where':{'id':_0x2f54eb[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2f6e62,null))[_0xfda3('0x22')](removeEntity(_0x2f6e62,null))['catch'](handleError(_0x2f6e62,null));};exports[_0xfda3('0x45')]=function(_0x6447,_0x322b66,_0x26ffee){var _0x574f02={};var _0x244c24={};var _0x3b430d;var _0x2f2c32;return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0x6447[_0xfda3('0x3f')]['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x322b66,null))['then'](function(_0x4b1410){if(_0x4b1410){_0x3b430d=_0x4b1410;_0x244c24[_0xfda3('0x2b')]=_[_0xfda3('0x2e')](db[_0xfda3('0x47')]['rawAttributes']);_0x244c24['query']=_[_0xfda3('0x2e')](_0x6447[_0xfda3('0x2d')]);_0x244c24[_0xfda3('0x2f')]=_[_0xfda3('0x31')](_0x244c24[_0xfda3('0x2b')],_0x244c24['query']);_0x574f02[_0xfda3('0x30')]=_[_0xfda3('0x31')](_0x244c24[_0xfda3('0x2b')],qs[_0xfda3('0x32')](_0x6447[_0xfda3('0x2d')][_0xfda3('0x32')]));_0x574f02[_0xfda3('0x30')]=_0x574f02[_0xfda3('0x30')][_0xfda3('0x40')]?_0x574f02[_0xfda3('0x30')]:_0x244c24[_0xfda3('0x2b')];_0x574f02[_0xfda3('0x35')]=qs['sort'](_0x6447[_0xfda3('0x2d')][_0xfda3('0x36')]);_0x574f02[_0xfda3('0x37')]=qs[_0xfda3('0x2f')](_[_0xfda3('0x38')](_0x6447[_0xfda3('0x2d')],_0x244c24[_0xfda3('0x2f')]));if(_0x6447['query']['filter']){_0x574f02[_0xfda3('0x37')]=_[_0xfda3('0x3a')](_0x574f02['where'],{'$or':_[_0xfda3('0x2c')](_0x574f02[_0xfda3('0x30')],function(_0x2a5efe){var _0x38dbc7={};_0x38dbc7[_0x2a5efe]={'$like':'%'+_0x6447['query']['filter']+'%'};return _0x38dbc7;})});}_0x574f02=_[_0xfda3('0x3a')]({},_0x574f02,_0x6447[_0xfda3('0x48')]);return _0x3b430d[_0xfda3('0x45')](_0x574f02);}})['then'](function(_0x23fd20){if(_0x23fd20){_0x2f2c32=_0x23fd20['length'];if(!_0x6447[_0xfda3('0x2d')][_0xfda3('0x33')](_0xfda3('0x34'))){_0x574f02[_0xfda3('0x1a')]=qs[_0xfda3('0x1a')](_0x6447[_0xfda3('0x2d')]['limit']);_0x574f02[_0xfda3('0x18')]=qs[_0xfda3('0x18')](_0x6447[_0xfda3('0x2d')][_0xfda3('0x18')]);}return _0x3b430d[_0xfda3('0x45')](_0x574f02);}})['then'](function(_0x5e9309){if(_0x5e9309){return _0x5e9309?{'count':_0x2f2c32,'rows':_0x5e9309}:null;}})[_0xfda3('0x22')](respondWithResult(_0x322b66,null))[_0xfda3('0x42')](handleError(_0x322b66,null));};exports['addConfiguration']=function(_0x550822,_0x512d7b,_0x248174){if(_0x550822[_0xfda3('0x44')]['id']){delete _0x550822['body']['id'];}return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0x550822[_0xfda3('0x3f')]['id']}})[_0xfda3('0x22')](handleEntityNotFound(_0x512d7b,null))['then'](function(_0x1cd818){if(_0x1cd818){_0x550822[_0xfda3('0x44')][_0xfda3('0x49')]=_0x1cd818['id'];_0x550822[_0xfda3('0x44')][_0xfda3('0x4a')]=integrations[_0xfda3('0x4b')](_0x550822['body']['channel'],_0x550822[_0xfda3('0x44')]['type']);_0x550822[_0xfda3('0x44')][_0xfda3('0x4c')]=integrations[_0xfda3('0x4d')](_0x550822[_0xfda3('0x44')][_0xfda3('0x4e')],_0x550822[_0xfda3('0x44')][_0xfda3('0x29')]);return db[_0xfda3('0x47')][_0xfda3('0x43')](_0x550822[_0xfda3('0x44')],{'include':[{'model':db['FreshdeskField'],'as':_0xfda3('0x4a')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})[_0xfda3('0x22')](respondWithResult(_0x512d7b,null))[_0xfda3('0x42')](handleError(_0x512d7b,null));};exports['getFields']=function(_0xa3b2e0,_0x26e1f5,_0x42e387){var _0x589c7a='';return db[_0xfda3('0x3c')][_0xfda3('0x46')]({'where':{'id':_0xa3b2e0[_0xfda3('0x3f')]['id']},'attributes':['id',_0xfda3('0x4f'),_0xfda3('0x50')]})['then'](handleEntityNotFound(_0x26e1f5,null))['then'](function(_0x53c2e9){if(_0x53c2e9){_0x589c7a=_0x53c2e9[_0xfda3('0x4f')];var _0xa032b5=_0x589c7a[_0xfda3('0x51')](-0x1);if(_0xa032b5==='/'){_0x589c7a=_0x589c7a[_0xfda3('0x52')](0x0,_0x589c7a[_0xfda3('0x53')](_0xa032b5));}return rp({'method':_0xfda3('0x54'),'uri':util['format'](_0xfda3('0x55'),_0x589c7a,_0xfda3('0x56')),'headers':{'Authorization':util[_0xfda3('0x57')](_0xfda3('0x58'),new Buffer(util['format'](_0xfda3('0x59'),_0x53c2e9['apiKey']))[_0xfda3('0x5a')](_0xfda3('0x5b')))},'json':!![]});}})[_0xfda3('0x22')](function(_0x16e8f0){if(_0x16e8f0){var _0x328806=[_0xfda3('0x5c'),_0xfda3('0x5d'),'agent',_0xfda3('0x5e'),_0xfda3('0x1c'),_0xfda3('0x5f'),_0xfda3('0x60'),_0xfda3('0x61'),_0xfda3('0x62'),'group',_0xfda3('0x63')];_[_0xfda3('0x64')](_0x16e8f0,function(_0x17161f){return _0x328806[_0xfda3('0x65')](_0x17161f[_0xfda3('0x26')])||!_0x17161f['default']&&_0x17161f[_0xfda3('0x29')]!==_0xfda3('0x66')&&_0x17161f[_0xfda3('0x29')]!==_0xfda3('0x67');});return{'count':_0x16e8f0[_0xfda3('0x40')],'rows':_[_0xfda3('0x2c')](_0x16e8f0,function(_0x1aacc1){return{'id':_0x1aacc1[_0xfda3('0x26')],'name':_0x1aacc1[_0xfda3('0x68')],'custom':!_0x1aacc1[_0xfda3('0x69')],'options':_0x1aacc1['choices']?_[_0xfda3('0x2c')](_0x1aacc1[_0xfda3('0x6a')],function(_0x46210d){return{'name':_[_0xfda3('0x6b')](_0x46210d),'value':_0x46210d};}):[]};})};}})[_0xfda3('0x22')](respondWithResult(_0x26e1f5,null))['catch'](function(_0x5e54e5){var _0x232cd2=_0xa3b2e0[_0xfda3('0x2d')][_0xfda3('0x6c')]?0x1f4:_0x5e54e5[_0xfda3('0x6d')]||0x1f4;logger[_0xfda3('0x24')](_0xfda3('0x6e'),_0xfda3('0x6f'),_0x232cd2,JSON[_0xfda3('0x70')](_0x5e54e5));delete _0x5e54e5[_0xfda3('0x26')];if(_0x232cd2===0x191){_0x232cd2=0x190;}_0x26e1f5[_0xfda3('0x1c')](_0x232cd2)[_0xfda3('0x71')](_0xa3b2e0['query'][_0xfda3('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x5e54e5['statusCode']}:_0x5e54e5);});}; \ No newline at end of file +var _0x1339=['priority','group','source','company','includes','default','custom_text','label','choices','capitalize','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','map','FreshdeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','filter','includeAll','include','show','params','options','find','catch','create','update','body','findOne','FreshdeskConfiguration','getConfigurations','hasOwnProperty','addConfiguration','channel','getDescriptions','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','agent','description'];(function(_0x270427,_0x5d40d8){var _0x5d2357=function(_0x4c5131){while(--_0x4c5131){_0x270427['push'](_0x270427['shift']());}};_0x5d2357(++_0x5d40d8);}(_0x1339,0x1bf));var _0x9133=function(_0x35acda,_0x1bbecc){_0x35acda=_0x35acda-0x0;var _0x50084e=_0x1339[_0x35acda];return _0x50084e;};'use strict';var emlformat=require(_0x9133('0x0'));var rimraf=require(_0x9133('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9133('0x2'));var rp=require(_0x9133('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9133('0x4'));var util=require(_0x9133('0x5'));var path=require('path');var sox=require(_0x9133('0x6'));var csv=require(_0x9133('0x7'));var ejs=require(_0x9133('0x8'));var fs=require('fs');var fs_extra=require(_0x9133('0x9'));var _=require(_0x9133('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9133('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9133('0x7'));var querystring=require('querystring');var Papa=require(_0x9133('0xc'));var Redis=require('ioredis');var authService=require(_0x9133('0xd'));var qs=require(_0x9133('0xe'));var as=require(_0x9133('0xf'));var hardwareService=require(_0x9133('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9133('0x11'));var licenseUtil=require(_0x9133('0x12'));var db=require(_0x9133('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3048a5,_0x177239){_0x177239=_0x177239||0xcc;return function(_0x2d3333){if(_0x2d3333){return _0x3048a5[_0x9133('0x14')](_0x177239);}return _0x3048a5[_0x9133('0x15')](_0x177239)[_0x9133('0x16')]();};}function respondWithResult(_0x8e9362,_0xb05b1c){_0xb05b1c=_0xb05b1c||0xc8;return function(_0x39122a){if(_0x39122a){return _0x8e9362['status'](_0xb05b1c)[_0x9133('0x17')](_0x39122a);}};}function respondWithFilteredResult(_0x57f4d9,_0x555651){return function(_0x8e3461){if(_0x8e3461){var _0x1aabd0=typeof _0x555651[_0x9133('0x18')]===_0x9133('0x19')&&typeof _0x555651[_0x9133('0x1a')]===_0x9133('0x19');var _0x38f2fd=_0x8e3461['count'];var _0x4d60b7=_0x1aabd0?0x0:_0x555651[_0x9133('0x18')];var _0x969520=_0x1aabd0?_0x8e3461[_0x9133('0x1b')]:_0x555651['offset']+_0x555651['limit'];var _0xfe140d;if(_0x969520>=_0x38f2fd){_0x969520=_0x38f2fd;_0xfe140d=0xc8;}else{_0xfe140d=0xce;}_0x57f4d9[_0x9133('0x15')](_0xfe140d);return _0x57f4d9[_0x9133('0x1c')](_0x9133('0x1d'),_0x4d60b7+'-'+_0x969520+'/'+_0x38f2fd)[_0x9133('0x17')](_0x8e3461);}return null;};}function patchUpdates(_0x21720){return function(_0x445244){try{jsonpatch[_0x9133('0x1e')](_0x445244,_0x21720,!![]);}catch(_0x1fa17d){return BPromise[_0x9133('0x1f')](_0x1fa17d);}return _0x445244[_0x9133('0x20')]();};}function saveUpdates(_0x2219d7,_0xeb79c1){return function(_0x2a311a){if(_0x2a311a){return _0x2a311a['update'](_0x2219d7)[_0x9133('0x21')](function(_0xdc20d9){return _0xdc20d9;});}return null;};}function removeEntity(_0x4bf1ed,_0x4f6c6a){return function(_0x2f54cb){if(_0x2f54cb){return _0x2f54cb[_0x9133('0x22')]()[_0x9133('0x21')](function(){_0x4bf1ed['status'](0xcc)[_0x9133('0x16')]();});}};}function handleEntityNotFound(_0x3a7c70,_0x50d1da){return function(_0x16366e){if(!_0x16366e){_0x3a7c70['sendStatus'](0x194);}return _0x16366e;};}function handleError(_0x552011,_0x5a83e0){_0x5a83e0=_0x5a83e0||0x1f4;return function(_0x44fb6a){logger[_0x9133('0x23')](_0x44fb6a['stack']);if(_0x44fb6a[_0x9133('0x24')]){delete _0x44fb6a[_0x9133('0x24')];}_0x552011[_0x9133('0x15')](_0x5a83e0)[_0x9133('0x25')](_0x44fb6a);};}exports['index']=function(_0x276583,_0x3f8b9b){var _0x3c8081={},_0x5f43ec={},_0x7e8423={'count':0x0,'rows':[]};var _0x108852=_[_0x9133('0x26')](db[_0x9133('0x27')][_0x9133('0x28')],function(_0x52eb56){return{'name':_0x52eb56[_0x9133('0x29')],'type':_0x52eb56['type'][_0x9133('0x2a')]};});_0x5f43ec[_0x9133('0x2b')]=_[_0x9133('0x26')](_0x108852,_0x9133('0x24'));_0x5f43ec['query']=_[_0x9133('0x2c')](_0x276583[_0x9133('0x2d')]);_0x5f43ec[_0x9133('0x2e')]=_[_0x9133('0x2f')](_0x5f43ec['model'],_0x5f43ec[_0x9133('0x2d')]);_0x3c8081[_0x9133('0x30')]=_[_0x9133('0x2f')](_0x5f43ec[_0x9133('0x2b')],qs[_0x9133('0x31')](_0x276583['query'][_0x9133('0x31')]));_0x3c8081[_0x9133('0x30')]=_0x3c8081['attributes'][_0x9133('0x32')]?_0x3c8081[_0x9133('0x30')]:_0x5f43ec[_0x9133('0x2b')];if(!_0x276583[_0x9133('0x2d')]['hasOwnProperty'](_0x9133('0x33'))){_0x3c8081['limit']=qs[_0x9133('0x1a')](_0x276583[_0x9133('0x2d')]['limit']);_0x3c8081[_0x9133('0x18')]=qs[_0x9133('0x18')](_0x276583['query'][_0x9133('0x18')]);}_0x3c8081[_0x9133('0x34')]=qs['sort'](_0x276583['query'][_0x9133('0x35')]);_0x3c8081['where']=qs[_0x9133('0x2e')](_[_0x9133('0x36')](_0x276583['query'],_0x5f43ec[_0x9133('0x2e')]),_0x108852);if(_0x276583[_0x9133('0x2d')]['filter']){_0x3c8081[_0x9133('0x37')]=_[_0x9133('0x38')](_0x3c8081[_0x9133('0x37')],{'$or':_[_0x9133('0x26')](_0x108852,function(_0x1126bc){if(_0x1126bc[_0x9133('0x39')]!=='VIRTUAL'){var _0x374f3b={};_0x374f3b[_0x1126bc[_0x9133('0x24')]]={'$like':'%'+_0x276583[_0x9133('0x2d')][_0x9133('0x3a')]+'%'};return _0x374f3b;}})});}_0x3c8081=_['merge']({},_0x3c8081,_0x276583['options']);var _0x577340={'where':_0x3c8081[_0x9133('0x37')]};return db['FreshdeskAccount'][_0x9133('0x1b')](_0x577340)[_0x9133('0x21')](function(_0x3d3a8b){_0x7e8423['count']=_0x3d3a8b;if(_0x276583[_0x9133('0x2d')][_0x9133('0x3b')]){_0x3c8081[_0x9133('0x3c')]=[{'all':!![]}];}return db[_0x9133('0x27')]['findAll'](_0x3c8081);})[_0x9133('0x21')](function(_0x382d28){_0x7e8423['rows']=_0x382d28;return _0x7e8423;})['then'](respondWithFilteredResult(_0x3f8b9b,_0x3c8081))['catch'](handleError(_0x3f8b9b,null));};exports[_0x9133('0x3d')]=function(_0x4f362e,_0x1a629c){var _0x32bd9b={'raw':![],'where':{'id':_0x4f362e[_0x9133('0x3e')]['id']}},_0x41a330={};_0x41a330[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x27')][_0x9133('0x28')]);_0x41a330[_0x9133('0x2d')]=_[_0x9133('0x2c')](_0x4f362e['query']);_0x41a330[_0x9133('0x2e')]=_['intersection'](_0x41a330['model'],_0x41a330['query']);_0x32bd9b[_0x9133('0x30')]=_[_0x9133('0x2f')](_0x41a330['model'],qs[_0x9133('0x31')](_0x4f362e[_0x9133('0x2d')][_0x9133('0x31')]));_0x32bd9b[_0x9133('0x30')]=_0x32bd9b['attributes'][_0x9133('0x32')]?_0x32bd9b['attributes']:_0x41a330[_0x9133('0x2b')];if(_0x4f362e[_0x9133('0x2d')][_0x9133('0x3b')]){_0x32bd9b[_0x9133('0x3c')]=[{'all':!![]}];}_0x32bd9b=_[_0x9133('0x38')]({},_0x32bd9b,_0x4f362e[_0x9133('0x3f')]);return db[_0x9133('0x27')][_0x9133('0x40')](_0x32bd9b)[_0x9133('0x21')](handleEntityNotFound(_0x1a629c,null))['then'](respondWithResult(_0x1a629c,null))[_0x9133('0x41')](handleError(_0x1a629c,null));};exports[_0x9133('0x42')]=function(_0xe0cf1d,_0xd1e581){return db[_0x9133('0x27')][_0x9133('0x42')](_0xe0cf1d['body'],{})[_0x9133('0x21')](respondWithResult(_0xd1e581,0xc9))[_0x9133('0x41')](handleError(_0xd1e581,null));};exports[_0x9133('0x43')]=function(_0x1f8a27,_0x2275b5){if(_0x1f8a27[_0x9133('0x44')]['id']){delete _0x1f8a27['body']['id'];}return db[_0x9133('0x27')][_0x9133('0x40')]({'where':{'id':_0x1f8a27[_0x9133('0x3e')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x2275b5,null))[_0x9133('0x21')](saveUpdates(_0x1f8a27[_0x9133('0x44')],null))[_0x9133('0x21')](respondWithResult(_0x2275b5,null))[_0x9133('0x41')](handleError(_0x2275b5,null));};exports['destroy']=function(_0x1c6840,_0x597854){return db[_0x9133('0x27')][_0x9133('0x40')]({'where':{'id':_0x1c6840[_0x9133('0x3e')]['id']}})['then'](handleEntityNotFound(_0x597854,null))[_0x9133('0x21')](removeEntity(_0x597854,null))['catch'](handleError(_0x597854,null));};exports['getConfigurations']=function(_0xc34745,_0x1f1593,_0x103ab8){var _0xe1b188={};var _0x2898ae={};var _0x3d3e67;var _0x3df357;return db[_0x9133('0x27')][_0x9133('0x45')]({'where':{'id':_0xc34745[_0x9133('0x3e')]['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x1f1593,null))[_0x9133('0x21')](function(_0x48ef9b){if(_0x48ef9b){_0x3d3e67=_0x48ef9b;_0x2898ae[_0x9133('0x2b')]=_[_0x9133('0x2c')](db[_0x9133('0x46')]['rawAttributes']);_0x2898ae['query']=_[_0x9133('0x2c')](_0xc34745[_0x9133('0x2d')]);_0x2898ae[_0x9133('0x2e')]=_[_0x9133('0x2f')](_0x2898ae['model'],_0x2898ae[_0x9133('0x2d')]);_0xe1b188[_0x9133('0x30')]=_[_0x9133('0x2f')](_0x2898ae[_0x9133('0x2b')],qs['fields'](_0xc34745[_0x9133('0x2d')]['fields']));_0xe1b188['attributes']=_0xe1b188[_0x9133('0x30')][_0x9133('0x32')]?_0xe1b188['attributes']:_0x2898ae[_0x9133('0x2b')];_0xe1b188[_0x9133('0x34')]=qs[_0x9133('0x35')](_0xc34745[_0x9133('0x2d')][_0x9133('0x35')]);_0xe1b188[_0x9133('0x37')]=qs[_0x9133('0x2e')](_[_0x9133('0x36')](_0xc34745[_0x9133('0x2d')],_0x2898ae[_0x9133('0x2e')]));if(_0xc34745[_0x9133('0x2d')][_0x9133('0x3a')]){_0xe1b188[_0x9133('0x37')]=_['merge'](_0xe1b188[_0x9133('0x37')],{'$or':_[_0x9133('0x26')](_0xe1b188[_0x9133('0x30')],function(_0x5d5267){var _0x43e6d8={};_0x43e6d8[_0x5d5267]={'$like':'%'+_0xc34745['query'][_0x9133('0x3a')]+'%'};return _0x43e6d8;})});}_0xe1b188=_[_0x9133('0x38')]({},_0xe1b188,_0xc34745[_0x9133('0x3f')]);return _0x3d3e67[_0x9133('0x47')](_0xe1b188);}})[_0x9133('0x21')](function(_0x1ee863){if(_0x1ee863){_0x3df357=_0x1ee863[_0x9133('0x32')];if(!_0xc34745[_0x9133('0x2d')][_0x9133('0x48')](_0x9133('0x33'))){_0xe1b188[_0x9133('0x1a')]=qs[_0x9133('0x1a')](_0xc34745[_0x9133('0x2d')][_0x9133('0x1a')]);_0xe1b188[_0x9133('0x18')]=qs[_0x9133('0x18')](_0xc34745[_0x9133('0x2d')]['offset']);}return _0x3d3e67[_0x9133('0x47')](_0xe1b188);}})[_0x9133('0x21')](function(_0x30f9b7){if(_0x30f9b7){return _0x30f9b7?{'count':_0x3df357,'rows':_0x30f9b7}:null;}})[_0x9133('0x21')](respondWithResult(_0x1f1593,null))[_0x9133('0x41')](handleError(_0x1f1593,null));};exports[_0x9133('0x49')]=function(_0x341a93,_0x594e25,_0x3a1467){if(_0x341a93[_0x9133('0x44')]['id']){delete _0x341a93['body']['id'];}return db[_0x9133('0x27')]['findOne']({'where':{'id':_0x341a93['params']['id']}})[_0x9133('0x21')](handleEntityNotFound(_0x594e25,null))[_0x9133('0x21')](function(_0x57171e){if(_0x57171e){_0x341a93[_0x9133('0x44')]['AccountId']=_0x57171e['id'];_0x341a93['body']['Subjects']=integrations['getSubjects'](_0x341a93[_0x9133('0x44')][_0x9133('0x4a')],_0x341a93[_0x9133('0x44')][_0x9133('0x39')]);_0x341a93[_0x9133('0x44')]['Descriptions']=integrations[_0x9133('0x4b')](_0x341a93[_0x9133('0x44')]['channel'],_0x341a93[_0x9133('0x44')][_0x9133('0x39')]);return db[_0x9133('0x46')][_0x9133('0x42')](_0x341a93[_0x9133('0x44')],{'include':[{'model':db[_0x9133('0x4c')],'as':'Subjects'},{'model':db[_0x9133('0x4c')],'as':'Descriptions'}]});}return null;})[_0x9133('0x21')](respondWithResult(_0x594e25,null))[_0x9133('0x41')](handleError(_0x594e25,null));};exports[_0x9133('0x4d')]=function(_0xcd5d09,_0x32f39e,_0x3f9623){var _0x5835fb='';return db[_0x9133('0x27')]['findOne']({'where':{'id':_0xcd5d09[_0x9133('0x3e')]['id']},'attributes':['id',_0x9133('0x4e'),_0x9133('0x4f')]})[_0x9133('0x21')](handleEntityNotFound(_0x32f39e,null))['then'](function(_0x22252e){if(_0x22252e){_0x5835fb=_0x22252e[_0x9133('0x4e')];var _0x3755ec=_0x5835fb[_0x9133('0x50')](-0x1);if(_0x3755ec==='/'){_0x5835fb=_0x5835fb[_0x9133('0x51')](0x0,_0x5835fb[_0x9133('0x52')](_0x3755ec));}return rp({'method':_0x9133('0x53'),'uri':util[_0x9133('0x54')](_0x9133('0x55'),_0x5835fb,_0x9133('0x56')),'headers':{'Authorization':util[_0x9133('0x54')](_0x9133('0x57'),new Buffer(util[_0x9133('0x54')](_0x9133('0x58'),_0x22252e[_0x9133('0x4f')]))[_0x9133('0x59')](_0x9133('0x5a')))},'json':!![]});}})[_0x9133('0x21')](function(_0x3b54da){if(_0x3b54da){var _0x2fcd37=['requester','subject',_0x9133('0x5b'),_0x9133('0x5c'),_0x9133('0x15'),_0x9133('0x5d'),_0x9133('0x5e'),_0x9133('0x5f'),'ticket_type',_0x9133('0x5e'),_0x9133('0x60')];_['remove'](_0x3b54da,function(_0x4777d8){return _0x2fcd37[_0x9133('0x61')](_0x4777d8['name'])||!_0x4777d8[_0x9133('0x62')]&&_0x4777d8[_0x9133('0x39')]!==_0x9133('0x63')&&_0x4777d8[_0x9133('0x39')]!=='custom_dropdown';});return{'count':_0x3b54da[_0x9133('0x32')],'rows':_[_0x9133('0x26')](_0x3b54da,function(_0x4f1816){return{'id':_0x4f1816['name'],'name':_0x4f1816[_0x9133('0x64')],'custom':!_0x4f1816['default'],'options':_0x4f1816['choices']?_[_0x9133('0x26')](_0x4f1816[_0x9133('0x65')],function(_0x25356c){return{'name':_[_0x9133('0x66')](_0x25356c),'value':_0x25356c};}):[]};})};}})[_0x9133('0x21')](respondWithResult(_0x32f39e,null))[_0x9133('0x41')](function(_0x907dc0){var _0x53b50f=_0xcd5d09['query'][_0x9133('0x67')]?0x1f4:_0x907dc0['statusCode']||0x1f4;logger[_0x9133('0x23')](_0x9133('0x68'),_0x9133('0x4d'),_0x53b50f,JSON[_0x9133('0x69')](_0x907dc0));delete _0x907dc0[_0x9133('0x24')];if(_0x53b50f===0x191){_0x53b50f=0x190;}_0x32f39e[_0x9133('0x15')](_0x53b50f)['send'](_0xcd5d09[_0x9133('0x2d')][_0x9133('0x67')]?{'message':_0x9133('0x6a'),'statusCode':_0x907dc0[_0x9133('0x6b')]}:_0x907dc0);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7f3b209..d32747e 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 _0xe591=['path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x526876,_0x2473ec){var _0x379ab5=function(_0x55d1fb){while(--_0x55d1fb){_0x526876['push'](_0x526876['shift']());}};_0x379ab5(++_0x2473ec);}(_0xe591,0x153));var _0x1e59=function(_0x5930bf,_0x4504fb){_0x5930bf=_0x5930bf-0x0;var _0x399da1=_0xe591[_0x5930bf];return _0x399da1;};'use strict';var _=require(_0x1e59('0x0'));var util=require(_0x1e59('0x1'));var logger=require(_0x1e59('0x2'))(_0x1e59('0x3'));var moment=require(_0x1e59('0x4'));var BPromise=require(_0x1e59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1e59('0x6'));var rimraf=require(_0x1e59('0x7'));var config=require(_0x1e59('0x8'));var attributes=require(_0x1e59('0x9'));var integrations=require(_0x1e59('0xa'));module[_0x1e59('0xb')]=function(_0x56441d,_0x42a1d8){return _0x56441d[_0x1e59('0xc')](_0x1e59('0xd'),attributes,{'tableName':_0x1e59('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3926=['bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','moment'];(function(_0xabcfca,_0x3b29c9){var _0x4102b5=function(_0x4e304e){while(--_0x4e304e){_0xabcfca['push'](_0xabcfca['shift']());}};_0x4102b5(++_0x3b29c9);}(_0x3926,0x128));var _0x6392=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x3926[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x6392('0x0'));var util=require(_0x6392('0x1'));var logger=require(_0x6392('0x2'))('api');var moment=require(_0x6392('0x3'));var BPromise=require(_0x6392('0x4'));var rp=require(_0x6392('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6392('0x6'));var attributes=require(_0x6392('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x6392('0x8')]=function(_0x151e94,_0xc91959){return _0x151e94[_0x6392('0x9')](_0x6392('0xa'),attributes,{'tableName':_0x6392('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index b4fa7a8..c0f49db 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 _0x26ac=['client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','map','include','model','find','ShowFreshdeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26ac,0x139));var _0xc26a=function(_0x78db5e,_0x3b9804){_0x78db5e=_0x78db5e-0x0;var _0x250b88=_0x26ac[_0x78db5e];return _0x250b88;};'use strict';var _=require(_0xc26a('0x0'));var util=require(_0xc26a('0x1'));var moment=require(_0xc26a('0x2'));var BPromise=require(_0xc26a('0x3'));var rs=require(_0xc26a('0x4'));var fs=require('fs');var Redis=require(_0xc26a('0x5'));var db=require(_0xc26a('0x6'))['db'];var utils=require(_0xc26a('0x7'));var logger=require(_0xc26a('0x8'))(_0xc26a('0x9'));var config=require('../../config/environment');var jayson=require(_0xc26a('0xa'));var client=jayson[_0xc26a('0xb')][_0xc26a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12f1db,_0x3e6d13,_0x52f5ba){return new BPromise(function(_0x2208e3,_0x536854){return client['request'](_0x12f1db,_0x52f5ba)[_0xc26a('0xd')](function(_0x5f2190){logger[_0xc26a('0xe')](_0xc26a('0xf'),_0x3e6d13,_0xc26a('0x10'));logger[_0xc26a('0x11')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x3e6d13,_0xc26a('0x10'),JSON[_0xc26a('0x12')](_0x5f2190));if(_0x5f2190[_0xc26a('0x13')]){if(_0x5f2190[_0xc26a('0x13')][_0xc26a('0x14')]===0x1f4){logger[_0xc26a('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x3e6d13,_0x5f2190['error'][_0xc26a('0x15')]);return _0x536854(_0x5f2190[_0xc26a('0x13')]['message']);}logger['error'](_0xc26a('0xf'),_0x3e6d13,_0x5f2190[_0xc26a('0x13')][_0xc26a('0x15')]);return _0x2208e3(_0x5f2190[_0xc26a('0x13')][_0xc26a('0x15')]);}else{logger['info'](_0xc26a('0xf'),_0x3e6d13,_0xc26a('0x10'));_0x2208e3(_0x5f2190[_0xc26a('0x16')][_0xc26a('0x15')]);}})[_0xc26a('0x17')](function(_0x3fc968){logger[_0xc26a('0x13')](_0xc26a('0xf'),_0x3e6d13,_0x3fc968);_0x536854(_0x3fc968);});});}exports[_0xc26a('0x18')]=function(_0x56a0bb){var _0x5b6e1a=this;return new Promise(function(_0x2b3bf5,_0x40f433){return db['FreshdeskAccount'][_0xc26a('0x19')]({'raw':_0x56a0bb[_0xc26a('0x1a')]?_0x56a0bb[_0xc26a('0x1a')][_0xc26a('0x1b')]===undefined?!![]:![]:!![],'where':_0x56a0bb[_0xc26a('0x1a')]?_0x56a0bb[_0xc26a('0x1a')][_0xc26a('0x1c')]||null:null,'attributes':_0x56a0bb[_0xc26a('0x1a')]?_0x56a0bb[_0xc26a('0x1a')][_0xc26a('0x1d')]||null:null,'limit':_0x56a0bb[_0xc26a('0x1a')]?_0x56a0bb[_0xc26a('0x1a')][_0xc26a('0x1e')]||null:null,'include':_0x56a0bb['options']?_0x56a0bb[_0xc26a('0x1a')]['include']?_[_0xc26a('0x1f')](_0x56a0bb[_0xc26a('0x1a')][_0xc26a('0x20')],function(_0x354d9f){return{'model':db[_0x354d9f[_0xc26a('0x21')]],'as':_0x354d9f['as'],'attributes':_0x354d9f['attributes'],'include':_0x354d9f[_0xc26a('0x20')]?_[_0xc26a('0x1f')](_0x354d9f[_0xc26a('0x20')],function(_0x48094b){return{'model':db[_0x48094b[_0xc26a('0x21')]],'as':_0x48094b['as'],'attributes':_0x48094b['attributes'],'include':_0x48094b[_0xc26a('0x20')]?_[_0xc26a('0x1f')](_0x48094b[_0xc26a('0x20')],function(_0x2da85c){return{'model':db[_0x2da85c[_0xc26a('0x21')]],'as':_0x2da85c['as'],'attributes':_0x2da85c[_0xc26a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc26a('0xd')](function(_0x4c4dd2){logger[_0xc26a('0xe')](_0xc26a('0x18'),_0x56a0bb);logger[_0xc26a('0x11')]('GetFreshdeskAccount',_0x56a0bb,JSON[_0xc26a('0x12')](_0x4c4dd2));_0x2b3bf5(_0x4c4dd2);})[_0xc26a('0x17')](function(_0x1de3aa){logger[_0xc26a('0x13')](_0xc26a('0x18'),_0x1de3aa[_0xc26a('0x15')],_0x56a0bb);_0x40f433(_0x5b6e1a['error'](0x1f4,_0x1de3aa[_0xc26a('0x15')]));});});};exports['ShowFreshdeskAccount']=function(_0x5a884e){var _0xd53c1c=this;return new Promise(function(_0x2ff2d7,_0x367ae2){return db['FreshdeskAccount'][_0xc26a('0x22')]({'raw':_0x5a884e[_0xc26a('0x1a')]?_0x5a884e[_0xc26a('0x1a')][_0xc26a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a884e[_0xc26a('0x1a')]?_0x5a884e['options'][_0xc26a('0x1c')]||null:null,'attributes':_0x5a884e[_0xc26a('0x1a')]?_0x5a884e[_0xc26a('0x1a')][_0xc26a('0x1d')]||null:null,'include':_0x5a884e['options']?_0x5a884e[_0xc26a('0x1a')][_0xc26a('0x20')]?_[_0xc26a('0x1f')](_0x5a884e[_0xc26a('0x1a')]['include'],function(_0x329003){return{'model':db[_0x329003['model']],'as':_0x329003['as'],'attributes':_0x329003[_0xc26a('0x1d')],'include':_0x329003[_0xc26a('0x20')]?_[_0xc26a('0x1f')](_0x329003['include'],function(_0x2c52fc){return{'model':db[_0x2c52fc['model']],'as':_0x2c52fc['as'],'attributes':_0x2c52fc[_0xc26a('0x1d')],'include':_0x2c52fc[_0xc26a('0x20')]?_[_0xc26a('0x1f')](_0x2c52fc['include'],function(_0x2ab7cf){return{'model':db[_0x2ab7cf[_0xc26a('0x21')]],'as':_0x2ab7cf['as'],'attributes':_0x2ab7cf[_0xc26a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc26a('0xd')](function(_0x336b6e){logger[_0xc26a('0xe')](_0xc26a('0x23'),_0x5a884e);logger[_0xc26a('0x11')](_0xc26a('0x23'),_0x5a884e,JSON['stringify'](_0x336b6e));_0x2ff2d7(_0x336b6e);})[_0xc26a('0x17')](function(_0x111407){logger[_0xc26a('0x13')](_0xc26a('0x23'),_0x111407['message'],_0x5a884e);_0x367ae2(_0xd53c1c[_0xc26a('0x13')](0x1f4,_0x111407[_0xc26a('0x15')]));});});}; \ No newline at end of file +var _0x4f5d=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','result','FreshdeskAccount','findAll','options','limit','include','map','model','attributes','then','GetFreshdeskAccount','catch','find','raw','where','ShowFreshdeskAccount','lodash','util','moment'];(function(_0x19f8ee,_0x3e08c2){var _0x3b68f2=function(_0x1f0f13){while(--_0x1f0f13){_0x19f8ee['push'](_0x19f8ee['shift']());}};_0x3b68f2(++_0x3e08c2);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4f5d[_0x422905];return _0x33dc6c;};'use strict';var _=require(_0xd4f5('0x0'));var util=require(_0xd4f5('0x1'));var moment=require(_0xd4f5('0x2'));var BPromise=require(_0xd4f5('0x3'));var rs=require(_0xd4f5('0x4'));var fs=require('fs');var Redis=require(_0xd4f5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4f5('0x6'));var logger=require(_0xd4f5('0x7'))(_0xd4f5('0x8'));var config=require(_0xd4f5('0x9'));var jayson=require(_0xd4f5('0xa'));var client=jayson[_0xd4f5('0xb')][_0xd4f5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3ab294,_0x150de6,_0x1d2d72){return new BPromise(function(_0xee2bc,_0x2690e8){return client[_0xd4f5('0xd')](_0x3ab294,_0x1d2d72)['then'](function(_0x4424cb){logger[_0xd4f5('0xe')]('FreshdeskAccount,\x20%s,\x20%s',_0x150de6,_0xd4f5('0xf'));logger[_0xd4f5('0x10')](_0xd4f5('0x11'),_0x150de6,_0xd4f5('0xf'),JSON[_0xd4f5('0x12')](_0x4424cb));if(_0x4424cb[_0xd4f5('0x13')]){if(_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x14')]===0x1f4){logger[_0xd4f5('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x150de6,_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x15')]);return _0x2690e8(_0x4424cb['error'][_0xd4f5('0x15')]);}logger[_0xd4f5('0x13')](_0xd4f5('0x16'),_0x150de6,_0x4424cb['error'][_0xd4f5('0x15')]);return _0xee2bc(_0x4424cb[_0xd4f5('0x13')][_0xd4f5('0x15')]);}else{logger[_0xd4f5('0xe')](_0xd4f5('0x16'),_0x150de6,_0xd4f5('0xf'));_0xee2bc(_0x4424cb[_0xd4f5('0x17')][_0xd4f5('0x15')]);}})['catch'](function(_0x452e46){logger['error'](_0xd4f5('0x16'),_0x150de6,_0x452e46);_0x2690e8(_0x452e46);});});}exports['GetFreshdeskAccount']=function(_0x220707){var _0x4672a7=this;return new Promise(function(_0x271f53,_0x396d94){return db[_0xd4f5('0x18')][_0xd4f5('0x19')]({'raw':_0x220707[_0xd4f5('0x1a')]?_0x220707[_0xd4f5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x220707[_0xd4f5('0x1a')]?_0x220707[_0xd4f5('0x1a')]['where']||null:null,'attributes':_0x220707[_0xd4f5('0x1a')]?_0x220707[_0xd4f5('0x1a')]['attributes']||null:null,'limit':_0x220707['options']?_0x220707[_0xd4f5('0x1a')][_0xd4f5('0x1b')]||null:null,'include':_0x220707[_0xd4f5('0x1a')]?_0x220707[_0xd4f5('0x1a')][_0xd4f5('0x1c')]?_[_0xd4f5('0x1d')](_0x220707[_0xd4f5('0x1a')]['include'],function(_0x578071){return{'model':db[_0x578071[_0xd4f5('0x1e')]],'as':_0x578071['as'],'attributes':_0x578071[_0xd4f5('0x1f')],'include':_0x578071[_0xd4f5('0x1c')]?_[_0xd4f5('0x1d')](_0x578071[_0xd4f5('0x1c')],function(_0x5f3a5d){return{'model':db[_0x5f3a5d[_0xd4f5('0x1e')]],'as':_0x5f3a5d['as'],'attributes':_0x5f3a5d['attributes'],'include':_0x5f3a5d[_0xd4f5('0x1c')]?_[_0xd4f5('0x1d')](_0x5f3a5d['include'],function(_0x5ba979){return{'model':db[_0x5ba979['model']],'as':_0x5ba979['as'],'attributes':_0x5ba979[_0xd4f5('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd4f5('0x20')](function(_0x5635c7){logger[_0xd4f5('0xe')]('GetFreshdeskAccount',_0x220707);logger[_0xd4f5('0x10')](_0xd4f5('0x21'),_0x220707,JSON[_0xd4f5('0x12')](_0x5635c7));_0x271f53(_0x5635c7);})[_0xd4f5('0x22')](function(_0x32d067){logger[_0xd4f5('0x13')](_0xd4f5('0x21'),_0x32d067[_0xd4f5('0x15')],_0x220707);_0x396d94(_0x4672a7[_0xd4f5('0x13')](0x1f4,_0x32d067['message']));});});};exports['ShowFreshdeskAccount']=function(_0x5564ac){var _0x526f29=this;return new Promise(function(_0x28d27d,_0x1bac6d){return db[_0xd4f5('0x18')][_0xd4f5('0x23')]({'raw':_0x5564ac['options']?_0x5564ac[_0xd4f5('0x1a')][_0xd4f5('0x24')]===undefined?!![]:![]:!![],'where':_0x5564ac[_0xd4f5('0x1a')]?_0x5564ac[_0xd4f5('0x1a')][_0xd4f5('0x25')]||null:null,'attributes':_0x5564ac[_0xd4f5('0x1a')]?_0x5564ac[_0xd4f5('0x1a')][_0xd4f5('0x1f')]||null:null,'include':_0x5564ac[_0xd4f5('0x1a')]?_0x5564ac['options']['include']?_[_0xd4f5('0x1d')](_0x5564ac[_0xd4f5('0x1a')][_0xd4f5('0x1c')],function(_0x177903){return{'model':db[_0x177903[_0xd4f5('0x1e')]],'as':_0x177903['as'],'attributes':_0x177903['attributes'],'include':_0x177903[_0xd4f5('0x1c')]?_[_0xd4f5('0x1d')](_0x177903[_0xd4f5('0x1c')],function(_0x554993){return{'model':db[_0x554993[_0xd4f5('0x1e')]],'as':_0x554993['as'],'attributes':_0x554993[_0xd4f5('0x1f')],'include':_0x554993[_0xd4f5('0x1c')]?_[_0xd4f5('0x1d')](_0x554993[_0xd4f5('0x1c')],function(_0x47274d){return{'model':db[_0x47274d['model']],'as':_0x47274d['as'],'attributes':_0x47274d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x29f348){logger[_0xd4f5('0xe')]('ShowFreshdeskAccount',_0x5564ac);logger[_0xd4f5('0x10')](_0xd4f5('0x26'),_0x5564ac,JSON['stringify'](_0x29f348));_0x28d27d(_0x29f348);})[_0xd4f5('0x22')](function(_0x5c9f10){logger['error']('ShowFreshdeskAccount',_0x5c9f10[_0xd4f5('0x15')],_0x5564ac);_0x1bac6d(_0x526f29['error'](0x1f4,_0x5c9f10[_0xd4f5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index a00e863..f091797 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 _0xd6cb=['setTags','put','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','index','get','/:id','isAuthenticated','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xd6cb,0x1cd));var _0xbd6c=function(_0x38bdd1,_0x513da3){_0x38bdd1=_0x38bdd1-0x0;var _0x263b9c=_0xd6cb[_0x38bdd1];return _0x263b9c;};'use strict';var multer=require(_0xbd6c('0x0'));var util=require(_0xbd6c('0x1'));var path=require('path');var timeout=require(_0xbd6c('0x2'));var express=require(_0xbd6c('0x3'));var router=express['Router']();var fs_extra=require(_0xbd6c('0x4'));var auth=require(_0xbd6c('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskConfiguration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xbd6c('0x6')]);router[_0xbd6c('0x7')](_0xbd6c('0x8'),auth[_0xbd6c('0x9')](),controller['show']);router[_0xbd6c('0x7')](_0xbd6c('0xa'),auth['isAuthenticated'](),controller[_0xbd6c('0xb')]);router['get'](_0xbd6c('0xc'),auth[_0xbd6c('0x9')](),controller[_0xbd6c('0xd')]);router[_0xbd6c('0x7')](_0xbd6c('0xe'),auth[_0xbd6c('0x9')](),controller['getDescriptions']);router[_0xbd6c('0x7')](_0xbd6c('0xf'),auth[_0xbd6c('0x9')](),controller[_0xbd6c('0x10')]);router[_0xbd6c('0x11')]('/',auth[_0xbd6c('0x9')](),controller[_0xbd6c('0x12')]);router[_0xbd6c('0x11')]('/:id/tags',auth[_0xbd6c('0x9')](),controller[_0xbd6c('0x13')]);router[_0xbd6c('0x14')](_0xbd6c('0x8'),auth[_0xbd6c('0x9')](),controller['update']);router[_0xbd6c('0x15')]('/:id',auth[_0xbd6c('0x9')](),controller[_0xbd6c('0x16')]);module[_0xbd6c('0x17')]=router; \ No newline at end of file +var _0x46f1=['/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x319a90,_0x357033){var _0x31af60=function(_0x2bcc7c){while(--_0x2bcc7c){_0x319a90['push'](_0x319a90['shift']());}};_0x31af60(++_0x357033);}(_0x46f1,0x15f));var _0x146f=function(_0x2ea2bf,_0x19be51){_0x2ea2bf=_0x2ea2bf-0x0;var _0x2974df=_0x46f1[_0x2ea2bf];return _0x2974df;};'use strict';var multer=require(_0x146f('0x0'));var util=require(_0x146f('0x1'));var path=require(_0x146f('0x2'));var timeout=require(_0x146f('0x3'));var express=require('express');var router=express[_0x146f('0x4')]();var fs_extra=require(_0x146f('0x5'));var auth=require(_0x146f('0x6'));var interaction=require(_0x146f('0x7'));var config=require('../../config/environment');var controller=require(_0x146f('0x8'));router[_0x146f('0x9')]('/',auth[_0x146f('0xa')](),controller[_0x146f('0xb')]);router[_0x146f('0x9')](_0x146f('0xc'),auth[_0x146f('0xa')](),controller['show']);router['get'](_0x146f('0xd'),auth[_0x146f('0xa')](),controller['getFields']);router['get'](_0x146f('0xe'),auth['isAuthenticated'](),controller[_0x146f('0xf')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0x146f('0x10')]);router[_0x146f('0x9')](_0x146f('0x11'),auth[_0x146f('0xa')](),controller['getTags']);router[_0x146f('0x12')]('/',auth[_0x146f('0xa')](),controller[_0x146f('0x13')]);router['post'](_0x146f('0x11'),auth[_0x146f('0xa')](),controller[_0x146f('0x14')]);router[_0x146f('0x15')](_0x146f('0xc'),auth[_0x146f('0xa')](),controller[_0x146f('0x16')]);router[_0x146f('0x17')]('/:id',auth[_0x146f('0xa')](),controller[_0x146f('0x18')]);module[_0x146f('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 3af5bcb..567d535 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 _0xb436=['exports','STRING'];(function(_0x23de95,_0x4ad33a){var _0x99a05a=function(_0x1d0d4f){while(--_0x1d0d4f){_0x23de95['push'](_0x23de95['shift']());}};_0x99a05a(++_0x4ad33a);}(_0xb436,0x1ce));var _0x6b43=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0xb436[_0x34c027];return _0x47bff0;};'use strict';var Sequelize=require('sequelize');module[_0x6b43('0x0')]={'name':{'type':Sequelize[_0x6b43('0x1')]},'description':{'type':Sequelize[_0x6b43('0x1')]}}; \ No newline at end of file +var _0xaeb5=['sequelize','exports','STRING'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xaeb5,0xcf));var _0x5aeb=function(_0x39eb68,_0x3cb8ba){_0x39eb68=_0x39eb68-0x0;var _0x3bccc1=_0xaeb5[_0x39eb68];return _0x3bccc1;};'use strict';var Sequelize=require(_0x5aeb('0x0'));module[_0x5aeb('0x1')]={'name':{'type':Sequelize[_0x5aeb('0x2')]},'description':{'type':Sequelize[_0x5aeb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index e2cc460..4b99ffc 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 _0x9efa=['zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','end','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','FreshdeskField','order','pick','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format'];(function(_0x4c4d07,_0x48512b){var _0x278851=function(_0x507727){while(--_0x507727){_0x4c4d07['push'](_0x4c4d07['shift']());}};_0x278851(++_0x48512b);}(_0x9efa,0xa7));var _0xa9ef=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9efa[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa9ef('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9ef('0x1'));var jsonpatch=require(_0xa9ef('0x2'));var rp=require('request-promise');var moment=require(_0xa9ef('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa9ef('0x4'));var util=require('util');var path=require(_0xa9ef('0x5'));var sox=require('sox');var csv=require(_0xa9ef('0x6'));var ejs=require(_0xa9ef('0x7'));var fs=require('fs');var fs_extra=require(_0xa9ef('0x8'));var _=require(_0xa9ef('0x9'));var squel=require(_0xa9ef('0xa'));var crypto=require(_0xa9ef('0xb'));var jsforce=require(_0xa9ef('0xc'));var deskjs=require(_0xa9ef('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa9ef('0xe'));var Redis=require(_0xa9ef('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa9ef('0x10'));var as=require(_0xa9ef('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9ef('0x12'))(_0xa9ef('0x13'));var utils=require(_0xa9ef('0x14'));var config=require(_0xa9ef('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf1b880,_0x51ef14){_0x51ef14=_0x51ef14||0xcc;return function(_0x35e5ae){if(_0x35e5ae){return _0xf1b880[_0xa9ef('0x16')](_0x51ef14);}return _0xf1b880[_0xa9ef('0x17')](_0x51ef14)['end']();};}function respondWithResult(_0x2945d5,_0x4dd77c){_0x4dd77c=_0x4dd77c||0xc8;return function(_0x1c528b){if(_0x1c528b){return _0x2945d5['status'](_0x4dd77c)['json'](_0x1c528b);}};}function respondWithFilteredResult(_0x5908a8,_0x310ba0){return function(_0x5d6737){if(_0x5d6737){var _0x2fb89a=typeof _0x310ba0[_0xa9ef('0x18')]===_0xa9ef('0x19')&&typeof _0x310ba0[_0xa9ef('0x1a')]===_0xa9ef('0x19');var _0x1b52e4=_0x5d6737[_0xa9ef('0x1b')];var _0x31cd26=_0x2fb89a?0x0:_0x310ba0[_0xa9ef('0x18')];var _0x245912=_0x2fb89a?_0x5d6737[_0xa9ef('0x1b')]:_0x310ba0[_0xa9ef('0x18')]+_0x310ba0[_0xa9ef('0x1a')];var _0x31f07d;if(_0x245912>=_0x1b52e4){_0x245912=_0x1b52e4;_0x31f07d=0xc8;}else{_0x31f07d=0xce;}_0x5908a8[_0xa9ef('0x17')](_0x31f07d);return _0x5908a8[_0xa9ef('0x1c')](_0xa9ef('0x1d'),_0x31cd26+'-'+_0x245912+'/'+_0x1b52e4)[_0xa9ef('0x1e')](_0x5d6737);}return null;};}function patchUpdates(_0x53abde){return function(_0x682947){try{jsonpatch[_0xa9ef('0x1f')](_0x682947,_0x53abde,!![]);}catch(_0x1ab717){return BPromise['reject'](_0x1ab717);}return _0x682947[_0xa9ef('0x20')]();};}function saveUpdates(_0x2fa23d,_0x23bd2c){return function(_0x25215b){if(_0x25215b){return _0x25215b[_0xa9ef('0x21')](_0x2fa23d)['then'](function(_0x359969){return _0x359969;});}return null;};}function removeEntity(_0x3c6d65,_0x5b2322){return function(_0x3225e7){if(_0x3225e7){return _0x3225e7[_0xa9ef('0x22')]()[_0xa9ef('0x23')](function(){_0x3c6d65[_0xa9ef('0x17')](0xcc)[_0xa9ef('0x24')]();});}};}function handleEntityNotFound(_0x3e5aac,_0x186fd3){return function(_0x4250d2){if(!_0x4250d2){_0x3e5aac[_0xa9ef('0x16')](0x194);}return _0x4250d2;};}function handleError(_0x5308fe,_0x2a3275){_0x2a3275=_0x2a3275||0x1f4;return function(_0x4a3200){logger[_0xa9ef('0x25')](_0x4a3200['stack']);if(_0x4a3200[_0xa9ef('0x26')]){delete _0x4a3200[_0xa9ef('0x26')];}_0x5308fe[_0xa9ef('0x17')](_0x2a3275)[_0xa9ef('0x27')](_0x4a3200);};}exports[_0xa9ef('0x28')]=function(_0x5a0c7f,_0x3a7d65){var _0x364189={},_0x3675bd={},_0x40d0e4={'count':0x0,'rows':[]};var _0x3358f3=_[_0xa9ef('0x29')](db[_0xa9ef('0x2a')][_0xa9ef('0x2b')],function(_0xcac25){return{'name':_0xcac25[_0xa9ef('0x2c')],'type':_0xcac25[_0xa9ef('0x2d')][_0xa9ef('0x2e')]};});_0x3675bd[_0xa9ef('0x2f')]=_[_0xa9ef('0x29')](_0x3358f3,_0xa9ef('0x26'));_0x3675bd[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0x5a0c7f[_0xa9ef('0x30')]);_0x3675bd['filters']=_[_0xa9ef('0x32')](_0x3675bd['model'],_0x3675bd[_0xa9ef('0x30')]);_0x364189[_0xa9ef('0x33')]=_[_0xa9ef('0x32')](_0x3675bd[_0xa9ef('0x2f')],qs[_0xa9ef('0x34')](_0x5a0c7f[_0xa9ef('0x30')][_0xa9ef('0x34')]));_0x364189['attributes']=_0x364189[_0xa9ef('0x33')][_0xa9ef('0x35')]?_0x364189[_0xa9ef('0x33')]:_0x3675bd[_0xa9ef('0x2f')];if(!_0x5a0c7f[_0xa9ef('0x30')]['hasOwnProperty'](_0xa9ef('0x36'))){_0x364189[_0xa9ef('0x1a')]=qs[_0xa9ef('0x1a')](_0x5a0c7f[_0xa9ef('0x30')][_0xa9ef('0x1a')]);_0x364189[_0xa9ef('0x18')]=qs[_0xa9ef('0x18')](_0x5a0c7f['query'][_0xa9ef('0x18')]);}_0x364189['order']=qs[_0xa9ef('0x37')](_0x5a0c7f[_0xa9ef('0x30')]['sort']);_0x364189[_0xa9ef('0x38')]=qs['filters'](_['pick'](_0x5a0c7f[_0xa9ef('0x30')],_0x3675bd[_0xa9ef('0x39')]),_0x3358f3);if(_0x5a0c7f[_0xa9ef('0x30')][_0xa9ef('0x3a')]){_0x364189[_0xa9ef('0x38')]=_['merge'](_0x364189[_0xa9ef('0x38')],{'$or':_['map'](_0x3358f3,function(_0x1c4d5f){if(_0x1c4d5f[_0xa9ef('0x2d')]!==_0xa9ef('0x3b')){var _0x436eb1={};_0x436eb1[_0x1c4d5f[_0xa9ef('0x26')]]={'$like':'%'+_0x5a0c7f['query'][_0xa9ef('0x3a')]+'%'};return _0x436eb1;}})});}_0x364189=_[_0xa9ef('0x3c')]({},_0x364189,_0x5a0c7f[_0xa9ef('0x3d')]);var _0x3e8353={'where':_0x364189[_0xa9ef('0x38')]};return db[_0xa9ef('0x2a')][_0xa9ef('0x1b')](_0x3e8353)[_0xa9ef('0x23')](function(_0x3ccf47){_0x40d0e4[_0xa9ef('0x1b')]=_0x3ccf47;if(_0x5a0c7f[_0xa9ef('0x30')]['includeAll']){_0x364189[_0xa9ef('0x3e')]=[{'all':!![]}];}return db[_0xa9ef('0x2a')][_0xa9ef('0x3f')](_0x364189);})['then'](function(_0x1dfd81){_0x40d0e4[_0xa9ef('0x40')]=_0x1dfd81;return _0x40d0e4;})[_0xa9ef('0x23')](respondWithFilteredResult(_0x3a7d65,_0x364189))[_0xa9ef('0x41')](handleError(_0x3a7d65,null));};exports[_0xa9ef('0x42')]=function(_0xf23ba5,_0x349946){var _0x2f209={'raw':![],'where':{'id':_0xf23ba5[_0xa9ef('0x43')]['id']}},_0x4e852b={};_0x4e852b[_0xa9ef('0x2f')]=_[_0xa9ef('0x31')](db[_0xa9ef('0x2a')]['rawAttributes']);_0x4e852b[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0xf23ba5[_0xa9ef('0x30')]);_0x4e852b[_0xa9ef('0x39')]=_['intersection'](_0x4e852b[_0xa9ef('0x2f')],_0x4e852b['query']);_0x2f209[_0xa9ef('0x33')]=_[_0xa9ef('0x32')](_0x4e852b[_0xa9ef('0x2f')],qs[_0xa9ef('0x34')](_0xf23ba5[_0xa9ef('0x30')][_0xa9ef('0x34')]));_0x2f209[_0xa9ef('0x33')]=_0x2f209['attributes'][_0xa9ef('0x35')]?_0x2f209[_0xa9ef('0x33')]:_0x4e852b[_0xa9ef('0x2f')];if(_0xf23ba5[_0xa9ef('0x30')][_0xa9ef('0x44')]){_0x2f209[_0xa9ef('0x3e')]=[{'all':!![]}];}_0x2f209=_['merge']({},_0x2f209,_0xf23ba5[_0xa9ef('0x3d')]);return db[_0xa9ef('0x2a')][_0xa9ef('0x45')](_0x2f209)['then'](handleEntityNotFound(_0x349946,null))[_0xa9ef('0x23')](respondWithResult(_0x349946,null))[_0xa9ef('0x41')](handleError(_0x349946,null));};exports[_0xa9ef('0x46')]=function(_0x5369ce,_0x277216){return db[_0xa9ef('0x2a')][_0xa9ef('0x46')](_0x5369ce[_0xa9ef('0x47')],{})[_0xa9ef('0x23')](respondWithResult(_0x277216,0xc9))[_0xa9ef('0x41')](handleError(_0x277216,null));};exports[_0xa9ef('0x21')]=function(_0x2a6151,_0x566a3f){if(_0x2a6151[_0xa9ef('0x47')]['id']){delete _0x2a6151[_0xa9ef('0x47')]['id'];}return db[_0xa9ef('0x2a')][_0xa9ef('0x45')]({'where':{'id':_0x2a6151[_0xa9ef('0x43')]['id']}})['then'](handleEntityNotFound(_0x566a3f,null))[_0xa9ef('0x23')](saveUpdates(_0x2a6151['body'],null))['then'](respondWithResult(_0x566a3f,null))[_0xa9ef('0x41')](handleError(_0x566a3f,null));};exports[_0xa9ef('0x22')]=function(_0x572b18,_0x3de9f7){return db['FreshdeskConfiguration']['find']({'where':{'id':_0x572b18['params']['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x3de9f7,null))[_0xa9ef('0x23')](removeEntity(_0x3de9f7,null))[_0xa9ef('0x41')](handleError(_0x3de9f7,null));};exports[_0xa9ef('0x48')]=function(_0x2587a2,_0x25daf4,_0x17486e){var _0xec5568={};var _0x1ad8b0={};var _0x5b763e;var _0x1ce460;return db[_0xa9ef('0x2a')][_0xa9ef('0x49')]({'where':{'id':_0x2587a2[_0xa9ef('0x43')]['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x25daf4,null))['then'](function(_0x44ec25){if(_0x44ec25){_0x5b763e=_0x44ec25;_0x1ad8b0[_0xa9ef('0x2f')]=_['keys'](db[_0xa9ef('0x4a')][_0xa9ef('0x2b')]);_0x1ad8b0['query']=_[_0xa9ef('0x31')](_0x2587a2['query']);_0x1ad8b0[_0xa9ef('0x39')]=_['intersection'](_0x1ad8b0[_0xa9ef('0x2f')],_0x1ad8b0[_0xa9ef('0x30')]);_0xec5568[_0xa9ef('0x33')]=_[_0xa9ef('0x32')](_0x1ad8b0[_0xa9ef('0x2f')],qs['fields'](_0x2587a2[_0xa9ef('0x30')][_0xa9ef('0x34')]));_0xec5568[_0xa9ef('0x33')]=_0xec5568[_0xa9ef('0x33')]['length']?_0xec5568[_0xa9ef('0x33')]:_0x1ad8b0[_0xa9ef('0x2f')];_0xec5568[_0xa9ef('0x4b')]=qs[_0xa9ef('0x37')](_0x2587a2[_0xa9ef('0x30')][_0xa9ef('0x37')]);_0xec5568['where']=qs[_0xa9ef('0x39')](_[_0xa9ef('0x4c')](_0x2587a2['query'],_0x1ad8b0[_0xa9ef('0x39')]));if(_0x2587a2['query']['filter']){_0xec5568['where']=_[_0xa9ef('0x3c')](_0xec5568[_0xa9ef('0x38')],{'$or':_[_0xa9ef('0x29')](_0xec5568['attributes'],function(_0x4bfcfd){var _0xaec61a={};_0xaec61a[_0x4bfcfd]={'$like':'%'+_0x2587a2[_0xa9ef('0x30')][_0xa9ef('0x3a')]+'%'};return _0xaec61a;})});}_0xec5568=_[_0xa9ef('0x3c')]({},_0xec5568,_0x2587a2[_0xa9ef('0x3d')]);return _0x5b763e[_0xa9ef('0x48')](_0xec5568);}})[_0xa9ef('0x23')](function(_0x4a6214){if(_0x4a6214){_0x1ce460=_0x4a6214[_0xa9ef('0x35')];if(!_0x2587a2[_0xa9ef('0x30')][_0xa9ef('0x4d')](_0xa9ef('0x36'))){_0xec5568[_0xa9ef('0x1a')]=qs[_0xa9ef('0x1a')](_0x2587a2[_0xa9ef('0x30')]['limit']);_0xec5568[_0xa9ef('0x18')]=qs['offset'](_0x2587a2[_0xa9ef('0x30')][_0xa9ef('0x18')]);}return _0x5b763e['getFields'](_0xec5568);}})['then'](function(_0x2a6ed4){if(_0x2a6ed4){return _0x2a6ed4?{'count':_0x1ce460,'rows':_0x2a6ed4}:null;}})[_0xa9ef('0x23')](respondWithResult(_0x25daf4,null))['catch'](handleError(_0x25daf4,null));};exports[_0xa9ef('0x4e')]=function(_0x4484a1,_0x421f93,_0x3f1f62){var _0x447eed={};var _0x95b907={};var _0x740dc4;var _0x342afa;return db[_0xa9ef('0x2a')]['findOne']({'where':{'id':_0x4484a1[_0xa9ef('0x43')]['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x421f93,null))[_0xa9ef('0x23')](function(_0x1d80a1){if(_0x1d80a1){_0x740dc4=_0x1d80a1;_0x95b907[_0xa9ef('0x2f')]=_['keys'](db[_0xa9ef('0x4a')][_0xa9ef('0x2b')]);_0x95b907[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0x4484a1[_0xa9ef('0x30')]);_0x95b907['filters']=_[_0xa9ef('0x32')](_0x95b907[_0xa9ef('0x2f')],_0x95b907['query']);_0x447eed['attributes']=_[_0xa9ef('0x32')](_0x95b907['model'],qs['fields'](_0x4484a1[_0xa9ef('0x30')]['fields']));_0x447eed[_0xa9ef('0x33')]=_0x447eed[_0xa9ef('0x33')][_0xa9ef('0x35')]?_0x447eed[_0xa9ef('0x33')]:_0x95b907[_0xa9ef('0x2f')];_0x447eed[_0xa9ef('0x4b')]=qs[_0xa9ef('0x37')](_0x4484a1[_0xa9ef('0x30')][_0xa9ef('0x37')]);_0x447eed['where']=qs[_0xa9ef('0x39')](_['pick'](_0x4484a1[_0xa9ef('0x30')],_0x95b907['filters']));if(_0x4484a1[_0xa9ef('0x30')][_0xa9ef('0x3a')]){_0x447eed[_0xa9ef('0x38')]=_[_0xa9ef('0x3c')](_0x447eed[_0xa9ef('0x38')],{'$or':_[_0xa9ef('0x29')](_0x447eed[_0xa9ef('0x33')],function(_0x22d71b){var _0x4ccec7={};_0x4ccec7[_0x22d71b]={'$like':'%'+_0x4484a1[_0xa9ef('0x30')][_0xa9ef('0x3a')]+'%'};return _0x4ccec7;})});}_0x447eed=_[_0xa9ef('0x3c')]({},_0x447eed,_0x4484a1[_0xa9ef('0x3d')]);return _0x740dc4[_0xa9ef('0x4e')](_0x447eed);}})[_0xa9ef('0x23')](function(_0x17a4ab){if(_0x17a4ab){_0x342afa=_0x17a4ab[_0xa9ef('0x35')];if(!_0x4484a1[_0xa9ef('0x30')][_0xa9ef('0x4d')](_0xa9ef('0x36'))){_0x447eed['limit']=qs['limit'](_0x4484a1['query'][_0xa9ef('0x1a')]);_0x447eed[_0xa9ef('0x18')]=qs[_0xa9ef('0x18')](_0x4484a1[_0xa9ef('0x30')][_0xa9ef('0x18')]);}return _0x740dc4[_0xa9ef('0x4e')](_0x447eed);}})[_0xa9ef('0x23')](function(_0x2f364e){if(_0x2f364e){return _0x2f364e?{'count':_0x342afa,'rows':_0x2f364e}:null;}})[_0xa9ef('0x23')](respondWithResult(_0x421f93,null))[_0xa9ef('0x41')](handleError(_0x421f93,null));};exports[_0xa9ef('0x4f')]=function(_0x6f31e1,_0xc2962c,_0x3e6e18){var _0x36cb23={};var _0x57fd51={};var _0x261c5a;var _0x3ac0e6;return db['FreshdeskConfiguration'][_0xa9ef('0x49')]({'where':{'id':_0x6f31e1[_0xa9ef('0x43')]['id']}})['then'](handleEntityNotFound(_0xc2962c,null))[_0xa9ef('0x23')](function(_0x4740af){if(_0x4740af){_0x261c5a=_0x4740af;_0x57fd51['model']=_['keys'](db[_0xa9ef('0x4a')][_0xa9ef('0x2b')]);_0x57fd51[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0x6f31e1[_0xa9ef('0x30')]);_0x57fd51[_0xa9ef('0x39')]=_['intersection'](_0x57fd51[_0xa9ef('0x2f')],_0x57fd51[_0xa9ef('0x30')]);_0x36cb23['attributes']=_[_0xa9ef('0x32')](_0x57fd51[_0xa9ef('0x2f')],qs['fields'](_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x34')]));_0x36cb23[_0xa9ef('0x33')]=_0x36cb23[_0xa9ef('0x33')][_0xa9ef('0x35')]?_0x36cb23['attributes']:_0x57fd51[_0xa9ef('0x2f')];_0x36cb23['order']=qs[_0xa9ef('0x37')](_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x37')]);_0x36cb23[_0xa9ef('0x38')]=qs[_0xa9ef('0x39')](_[_0xa9ef('0x4c')](_0x6f31e1[_0xa9ef('0x30')],_0x57fd51[_0xa9ef('0x39')]));if(_0x6f31e1['query'][_0xa9ef('0x3a')]){_0x36cb23[_0xa9ef('0x38')]=_[_0xa9ef('0x3c')](_0x36cb23[_0xa9ef('0x38')],{'$or':_[_0xa9ef('0x29')](_0x36cb23[_0xa9ef('0x33')],function(_0x56941e){var _0x8ff27b={};_0x8ff27b[_0x56941e]={'$like':'%'+_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x3a')]+'%'};return _0x8ff27b;})});}_0x36cb23=_['merge']({},_0x36cb23,_0x6f31e1[_0xa9ef('0x3d')]);return _0x261c5a['getDescriptions'](_0x36cb23);}})[_0xa9ef('0x23')](function(_0xec3611){if(_0xec3611){_0x3ac0e6=_0xec3611[_0xa9ef('0x35')];if(!_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x4d')]('nolimit')){_0x36cb23[_0xa9ef('0x1a')]=qs[_0xa9ef('0x1a')](_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x1a')]);_0x36cb23[_0xa9ef('0x18')]=qs[_0xa9ef('0x18')](_0x6f31e1[_0xa9ef('0x30')][_0xa9ef('0x18')]);}return _0x261c5a[_0xa9ef('0x4f')](_0x36cb23);}})[_0xa9ef('0x23')](function(_0x51179d){if(_0x51179d){return _0x51179d?{'count':_0x3ac0e6,'rows':_0x51179d}:null;}})[_0xa9ef('0x23')](respondWithResult(_0xc2962c,null))[_0xa9ef('0x41')](handleError(_0xc2962c,null));};exports[_0xa9ef('0x50')]=function(_0x5186f3,_0x13fe0c,_0xb9bae){var _0x303e26={};var _0x45331b={};var _0x1da887;var _0x514892;return db[_0xa9ef('0x2a')]['findOne']({'where':{'id':_0x5186f3[_0xa9ef('0x43')]['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x13fe0c,null))['then'](function(_0x5144fb){if(_0x5144fb){_0x1da887=_0x5144fb;_0x45331b[_0xa9ef('0x2f')]=_[_0xa9ef('0x31')](db[_0xa9ef('0x51')][_0xa9ef('0x2b')]);_0x45331b[_0xa9ef('0x30')]=_[_0xa9ef('0x31')](_0x5186f3[_0xa9ef('0x30')]);_0x45331b[_0xa9ef('0x39')]=_[_0xa9ef('0x32')](_0x45331b[_0xa9ef('0x2f')],_0x45331b[_0xa9ef('0x30')]);_0x303e26[_0xa9ef('0x33')]=_[_0xa9ef('0x32')](_0x45331b[_0xa9ef('0x2f')],qs['fields'](_0x5186f3[_0xa9ef('0x30')]['fields']));_0x303e26['attributes']=_0x303e26[_0xa9ef('0x33')][_0xa9ef('0x35')]?_0x303e26[_0xa9ef('0x33')]:_0x45331b['model'];_0x303e26[_0xa9ef('0x4b')]=qs[_0xa9ef('0x37')](_0x5186f3['query'][_0xa9ef('0x37')]);_0x303e26['where']=qs[_0xa9ef('0x39')](_['pick'](_0x5186f3[_0xa9ef('0x30')],_0x45331b[_0xa9ef('0x39')]));if(_0x5186f3[_0xa9ef('0x30')][_0xa9ef('0x3a')]){_0x303e26['where']=_[_0xa9ef('0x3c')](_0x303e26[_0xa9ef('0x38')],{'$or':_['map'](_0x303e26[_0xa9ef('0x33')],function(_0x4ce9b2){var _0x26779c={};_0x26779c[_0x4ce9b2]={'$like':'%'+_0x5186f3[_0xa9ef('0x30')][_0xa9ef('0x3a')]+'%'};return _0x26779c;})});}_0x303e26=_[_0xa9ef('0x3c')]({},_0x303e26,_0x5186f3[_0xa9ef('0x3d')]);return _0x1da887[_0xa9ef('0x50')](_0x303e26);}})[_0xa9ef('0x23')](function(_0x1bccb9){if(_0x1bccb9){_0x514892=_0x1bccb9[_0xa9ef('0x35')];if(!_0x5186f3[_0xa9ef('0x30')]['hasOwnProperty'](_0xa9ef('0x36'))){_0x303e26['limit']=qs['limit'](_0x5186f3[_0xa9ef('0x30')][_0xa9ef('0x1a')]);_0x303e26['offset']=qs[_0xa9ef('0x18')](_0x5186f3[_0xa9ef('0x30')][_0xa9ef('0x18')]);}return _0x1da887[_0xa9ef('0x50')](_0x303e26);}})[_0xa9ef('0x23')](function(_0x351ecb){if(_0x351ecb){return _0x351ecb?{'count':_0x514892,'rows':_0x351ecb}:null;}})[_0xa9ef('0x23')](respondWithResult(_0x13fe0c,null))['catch'](handleError(_0x13fe0c,null));};exports[_0xa9ef('0x52')]=function(_0x6635e8,_0x229ee1,_0x48cbd2){if(_0x6635e8['body']['id']){delete _0x6635e8[_0xa9ef('0x47')]['id'];}return db['FreshdeskConfiguration'][_0xa9ef('0x49')]({'where':{'id':_0x6635e8[_0xa9ef('0x43')]['id']}})[_0xa9ef('0x23')](handleEntityNotFound(_0x229ee1,null))[_0xa9ef('0x23')](function(_0xc3d59f){if(_0xc3d59f){return _0xc3d59f[_0xa9ef('0x52')](_0x6635e8[_0xa9ef('0x47')][_0xa9ef('0x53')]||[]);}return null;})[_0xa9ef('0x23')](respondWithResult(_0x229ee1,null))[_0xa9ef('0x41')](handleError(_0x229ee1,null));}; \ No newline at end of file +var _0x3b66=['count','set','Content-Range','apply','reject','update','then','end','error','name','send','index','fieldName','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','FreshdeskConfiguration','show','params','rawAttributes','include','find','create','body','catch','destroy','getFields','FreshdeskField','pick','findOne','nolimit','getSubjects','getDescriptions','getTags','Tag','ids','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x3b66,0x8b));var _0x63b6=function(_0x3ba956,_0x4b8564){_0x3ba956=_0x3ba956-0x0;var _0x34414d=_0x3b66[_0x3ba956];return _0x34414d;};'use strict';var emlformat=require(_0x63b6('0x0'));var rimraf=require(_0x63b6('0x1'));var zipdir=require(_0x63b6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x63b6('0x3'));var moment=require(_0x63b6('0x4'));var BPromise=require(_0x63b6('0x5'));var Mustache=require(_0x63b6('0x6'));var util=require(_0x63b6('0x7'));var path=require('path');var sox=require(_0x63b6('0x8'));var csv=require(_0x63b6('0x9'));var ejs=require(_0x63b6('0xa'));var fs=require('fs');var fs_extra=require(_0x63b6('0xb'));var _=require(_0x63b6('0xc'));var squel=require(_0x63b6('0xd'));var crypto=require(_0x63b6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x63b6('0xf'));var toCsv=require(_0x63b6('0x9'));var querystring=require(_0x63b6('0x10'));var Papa=require(_0x63b6('0x11'));var Redis=require(_0x63b6('0x12'));var authService=require(_0x63b6('0x13'));var qs=require(_0x63b6('0x14'));var as=require(_0x63b6('0x15'));var hardwareService=require(_0x63b6('0x16'));var logger=require('../../config/logger')(_0x63b6('0x17'));var utils=require(_0x63b6('0x18'));var config=require(_0x63b6('0x19'));var licenseUtil=require(_0x63b6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9cdaf9,_0x4a9c45){_0x4a9c45=_0x4a9c45||0xcc;return function(_0x1eddf9){if(_0x1eddf9){return _0x9cdaf9[_0x63b6('0x1b')](_0x4a9c45);}return _0x9cdaf9[_0x63b6('0x1c')](_0x4a9c45)['end']();};}function respondWithResult(_0xd0f2ae,_0x309e23){_0x309e23=_0x309e23||0xc8;return function(_0x270fc8){if(_0x270fc8){return _0xd0f2ae[_0x63b6('0x1c')](_0x309e23)[_0x63b6('0x1d')](_0x270fc8);}};}function respondWithFilteredResult(_0x3f4032,_0x405145){return function(_0x2077ac){if(_0x2077ac){var _0x368372=typeof _0x405145[_0x63b6('0x1e')]===_0x63b6('0x1f')&&typeof _0x405145[_0x63b6('0x20')]==='undefined';var _0x50e278=_0x2077ac[_0x63b6('0x21')];var _0x38be19=_0x368372?0x0:_0x405145[_0x63b6('0x1e')];var _0x50a522=_0x368372?_0x2077ac[_0x63b6('0x21')]:_0x405145['offset']+_0x405145[_0x63b6('0x20')];var _0x72eda1;if(_0x50a522>=_0x50e278){_0x50a522=_0x50e278;_0x72eda1=0xc8;}else{_0x72eda1=0xce;}_0x3f4032[_0x63b6('0x1c')](_0x72eda1);return _0x3f4032[_0x63b6('0x22')](_0x63b6('0x23'),_0x38be19+'-'+_0x50a522+'/'+_0x50e278)[_0x63b6('0x1d')](_0x2077ac);}return null;};}function patchUpdates(_0x105f89){return function(_0x5dee6b){try{jsonpatch[_0x63b6('0x24')](_0x5dee6b,_0x105f89,!![]);}catch(_0x2be477){return BPromise[_0x63b6('0x25')](_0x2be477);}return _0x5dee6b['save']();};}function saveUpdates(_0x4171ae,_0x1504b4){return function(_0x1f7ff1){if(_0x1f7ff1){return _0x1f7ff1[_0x63b6('0x26')](_0x4171ae)['then'](function(_0x4c5e99){return _0x4c5e99;});}return null;};}function removeEntity(_0x5a5eba,_0x406d58){return function(_0x28eceb){if(_0x28eceb){return _0x28eceb['destroy']()[_0x63b6('0x27')](function(){_0x5a5eba[_0x63b6('0x1c')](0xcc)[_0x63b6('0x28')]();});}};}function handleEntityNotFound(_0x460db6,_0x2fa2df){return function(_0x3a9498){if(!_0x3a9498){_0x460db6[_0x63b6('0x1b')](0x194);}return _0x3a9498;};}function handleError(_0x3b68f9,_0x37a5a0){_0x37a5a0=_0x37a5a0||0x1f4;return function(_0x40df66){logger[_0x63b6('0x29')](_0x40df66['stack']);if(_0x40df66[_0x63b6('0x2a')]){delete _0x40df66['name'];}_0x3b68f9['status'](_0x37a5a0)[_0x63b6('0x2b')](_0x40df66);};}exports[_0x63b6('0x2c')]=function(_0x3a0a32,_0x43ac1b){var _0x4535aa={},_0x44eba5={},_0x1b8e05={'count':0x0,'rows':[]};var _0x218924=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x5ea29c){return{'name':_0x5ea29c[_0x63b6('0x2d')],'type':_0x5ea29c['type'][_0x63b6('0x2e')]};});_0x44eba5[_0x63b6('0x2f')]=_[_0x63b6('0x30')](_0x218924,_0x63b6('0x2a'));_0x44eba5[_0x63b6('0x31')]=_[_0x63b6('0x32')](_0x3a0a32[_0x63b6('0x31')]);_0x44eba5[_0x63b6('0x33')]=_[_0x63b6('0x34')](_0x44eba5['model'],_0x44eba5[_0x63b6('0x31')]);_0x4535aa['attributes']=_[_0x63b6('0x34')](_0x44eba5[_0x63b6('0x2f')],qs[_0x63b6('0x35')](_0x3a0a32[_0x63b6('0x31')][_0x63b6('0x35')]));_0x4535aa['attributes']=_0x4535aa['attributes'][_0x63b6('0x36')]?_0x4535aa[_0x63b6('0x37')]:_0x44eba5[_0x63b6('0x2f')];if(!_0x3a0a32[_0x63b6('0x31')][_0x63b6('0x38')]('nolimit')){_0x4535aa[_0x63b6('0x20')]=qs['limit'](_0x3a0a32[_0x63b6('0x31')][_0x63b6('0x20')]);_0x4535aa[_0x63b6('0x1e')]=qs[_0x63b6('0x1e')](_0x3a0a32[_0x63b6('0x31')]['offset']);}_0x4535aa[_0x63b6('0x39')]=qs[_0x63b6('0x3a')](_0x3a0a32[_0x63b6('0x31')]['sort']);_0x4535aa['where']=qs[_0x63b6('0x33')](_['pick'](_0x3a0a32['query'],_0x44eba5['filters']),_0x218924);if(_0x3a0a32['query'][_0x63b6('0x3b')]){_0x4535aa[_0x63b6('0x3c')]=_[_0x63b6('0x3d')](_0x4535aa[_0x63b6('0x3c')],{'$or':_['map'](_0x218924,function(_0x4d9b94){if(_0x4d9b94[_0x63b6('0x3e')]!==_0x63b6('0x3f')){var _0x76f9fb={};_0x76f9fb[_0x4d9b94['name']]={'$like':'%'+_0x3a0a32[_0x63b6('0x31')][_0x63b6('0x3b')]+'%'};return _0x76f9fb;}})});}_0x4535aa=_[_0x63b6('0x3d')]({},_0x4535aa,_0x3a0a32[_0x63b6('0x40')]);var _0x11a983={'where':_0x4535aa[_0x63b6('0x3c')]};return db['FreshdeskConfiguration'][_0x63b6('0x21')](_0x11a983)['then'](function(_0x50d423){_0x1b8e05[_0x63b6('0x21')]=_0x50d423;if(_0x3a0a32['query'][_0x63b6('0x41')]){_0x4535aa['include']=[{'all':!![]}];}return db[_0x63b6('0x42')]['findAll'](_0x4535aa);})[_0x63b6('0x27')](function(_0x412894){_0x1b8e05['rows']=_0x412894;return _0x1b8e05;})[_0x63b6('0x27')](respondWithFilteredResult(_0x43ac1b,_0x4535aa))['catch'](handleError(_0x43ac1b,null));};exports[_0x63b6('0x43')]=function(_0x178eb3,_0x526ad1){var _0x57d8ae={'raw':![],'where':{'id':_0x178eb3[_0x63b6('0x44')]['id']}},_0x4fd124={};_0x4fd124[_0x63b6('0x2f')]=_[_0x63b6('0x32')](db[_0x63b6('0x42')][_0x63b6('0x45')]);_0x4fd124[_0x63b6('0x31')]=_[_0x63b6('0x32')](_0x178eb3[_0x63b6('0x31')]);_0x4fd124[_0x63b6('0x33')]=_[_0x63b6('0x34')](_0x4fd124[_0x63b6('0x2f')],_0x4fd124[_0x63b6('0x31')]);_0x57d8ae[_0x63b6('0x37')]=_['intersection'](_0x4fd124[_0x63b6('0x2f')],qs['fields'](_0x178eb3['query'][_0x63b6('0x35')]));_0x57d8ae['attributes']=_0x57d8ae[_0x63b6('0x37')]['length']?_0x57d8ae[_0x63b6('0x37')]:_0x4fd124[_0x63b6('0x2f')];if(_0x178eb3[_0x63b6('0x31')]['includeAll']){_0x57d8ae[_0x63b6('0x46')]=[{'all':!![]}];}_0x57d8ae=_[_0x63b6('0x3d')]({},_0x57d8ae,_0x178eb3[_0x63b6('0x40')]);return db[_0x63b6('0x42')][_0x63b6('0x47')](_0x57d8ae)[_0x63b6('0x27')](handleEntityNotFound(_0x526ad1,null))[_0x63b6('0x27')](respondWithResult(_0x526ad1,null))['catch'](handleError(_0x526ad1,null));};exports[_0x63b6('0x48')]=function(_0x551b60,_0x103410){return db[_0x63b6('0x42')]['create'](_0x551b60[_0x63b6('0x49')],{})[_0x63b6('0x27')](respondWithResult(_0x103410,0xc9))[_0x63b6('0x4a')](handleError(_0x103410,null));};exports[_0x63b6('0x26')]=function(_0x5b8e28,_0x1428b6){if(_0x5b8e28[_0x63b6('0x49')]['id']){delete _0x5b8e28[_0x63b6('0x49')]['id'];}return db[_0x63b6('0x42')][_0x63b6('0x47')]({'where':{'id':_0x5b8e28[_0x63b6('0x44')]['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x1428b6,null))['then'](saveUpdates(_0x5b8e28[_0x63b6('0x49')],null))[_0x63b6('0x27')](respondWithResult(_0x1428b6,null))['catch'](handleError(_0x1428b6,null));};exports[_0x63b6('0x4b')]=function(_0x14b7f2,_0x4bbbac){return db[_0x63b6('0x42')][_0x63b6('0x47')]({'where':{'id':_0x14b7f2[_0x63b6('0x44')]['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x4bbbac,null))['then'](removeEntity(_0x4bbbac,null))['catch'](handleError(_0x4bbbac,null));};exports[_0x63b6('0x4c')]=function(_0x370969,_0x4a5f69,_0x6a533b){var _0x5ca295={};var _0x448e7a={};var _0x159830;var _0x23df7b;return db[_0x63b6('0x42')]['findOne']({'where':{'id':_0x370969['params']['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x4a5f69,null))[_0x63b6('0x27')](function(_0xac8632){if(_0xac8632){_0x159830=_0xac8632;_0x448e7a[_0x63b6('0x2f')]=_[_0x63b6('0x32')](db[_0x63b6('0x4d')][_0x63b6('0x45')]);_0x448e7a[_0x63b6('0x31')]=_[_0x63b6('0x32')](_0x370969['query']);_0x448e7a[_0x63b6('0x33')]=_['intersection'](_0x448e7a[_0x63b6('0x2f')],_0x448e7a['query']);_0x5ca295['attributes']=_[_0x63b6('0x34')](_0x448e7a[_0x63b6('0x2f')],qs[_0x63b6('0x35')](_0x370969[_0x63b6('0x31')][_0x63b6('0x35')]));_0x5ca295[_0x63b6('0x37')]=_0x5ca295[_0x63b6('0x37')]['length']?_0x5ca295[_0x63b6('0x37')]:_0x448e7a['model'];_0x5ca295[_0x63b6('0x39')]=qs[_0x63b6('0x3a')](_0x370969[_0x63b6('0x31')][_0x63b6('0x3a')]);_0x5ca295[_0x63b6('0x3c')]=qs[_0x63b6('0x33')](_[_0x63b6('0x4e')](_0x370969[_0x63b6('0x31')],_0x448e7a[_0x63b6('0x33')]));if(_0x370969[_0x63b6('0x31')][_0x63b6('0x3b')]){_0x5ca295[_0x63b6('0x3c')]=_[_0x63b6('0x3d')](_0x5ca295[_0x63b6('0x3c')],{'$or':_[_0x63b6('0x30')](_0x5ca295[_0x63b6('0x37')],function(_0x1c68d1){var _0x463394={};_0x463394[_0x1c68d1]={'$like':'%'+_0x370969['query'][_0x63b6('0x3b')]+'%'};return _0x463394;})});}_0x5ca295=_[_0x63b6('0x3d')]({},_0x5ca295,_0x370969['options']);return _0x159830[_0x63b6('0x4c')](_0x5ca295);}})[_0x63b6('0x27')](function(_0x4e2313){if(_0x4e2313){_0x23df7b=_0x4e2313[_0x63b6('0x36')];if(!_0x370969['query']['hasOwnProperty']('nolimit')){_0x5ca295['limit']=qs[_0x63b6('0x20')](_0x370969[_0x63b6('0x31')][_0x63b6('0x20')]);_0x5ca295[_0x63b6('0x1e')]=qs[_0x63b6('0x1e')](_0x370969['query']['offset']);}return _0x159830[_0x63b6('0x4c')](_0x5ca295);}})[_0x63b6('0x27')](function(_0x7a931f){if(_0x7a931f){return _0x7a931f?{'count':_0x23df7b,'rows':_0x7a931f}:null;}})['then'](respondWithResult(_0x4a5f69,null))[_0x63b6('0x4a')](handleError(_0x4a5f69,null));};exports['getSubjects']=function(_0x307ad9,_0x18bdc8,_0x34c548){var _0x5e2bd3={};var _0x18d990={};var _0x434122;var _0x561b4a;return db['FreshdeskConfiguration'][_0x63b6('0x4f')]({'where':{'id':_0x307ad9[_0x63b6('0x44')]['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x18bdc8,null))['then'](function(_0x1de3f4){if(_0x1de3f4){_0x434122=_0x1de3f4;_0x18d990[_0x63b6('0x2f')]=_[_0x63b6('0x32')](db[_0x63b6('0x4d')][_0x63b6('0x45')]);_0x18d990[_0x63b6('0x31')]=_[_0x63b6('0x32')](_0x307ad9[_0x63b6('0x31')]);_0x18d990[_0x63b6('0x33')]=_[_0x63b6('0x34')](_0x18d990[_0x63b6('0x2f')],_0x18d990[_0x63b6('0x31')]);_0x5e2bd3[_0x63b6('0x37')]=_['intersection'](_0x18d990[_0x63b6('0x2f')],qs['fields'](_0x307ad9[_0x63b6('0x31')][_0x63b6('0x35')]));_0x5e2bd3['attributes']=_0x5e2bd3[_0x63b6('0x37')][_0x63b6('0x36')]?_0x5e2bd3[_0x63b6('0x37')]:_0x18d990[_0x63b6('0x2f')];_0x5e2bd3[_0x63b6('0x39')]=qs[_0x63b6('0x3a')](_0x307ad9[_0x63b6('0x31')][_0x63b6('0x3a')]);_0x5e2bd3[_0x63b6('0x3c')]=qs[_0x63b6('0x33')](_['pick'](_0x307ad9[_0x63b6('0x31')],_0x18d990[_0x63b6('0x33')]));if(_0x307ad9[_0x63b6('0x31')][_0x63b6('0x3b')]){_0x5e2bd3[_0x63b6('0x3c')]=_[_0x63b6('0x3d')](_0x5e2bd3[_0x63b6('0x3c')],{'$or':_[_0x63b6('0x30')](_0x5e2bd3['attributes'],function(_0x1413ab){var _0x4e88ed={};_0x4e88ed[_0x1413ab]={'$like':'%'+_0x307ad9[_0x63b6('0x31')][_0x63b6('0x3b')]+'%'};return _0x4e88ed;})});}_0x5e2bd3=_[_0x63b6('0x3d')]({},_0x5e2bd3,_0x307ad9[_0x63b6('0x40')]);return _0x434122['getSubjects'](_0x5e2bd3);}})[_0x63b6('0x27')](function(_0x438524){if(_0x438524){_0x561b4a=_0x438524[_0x63b6('0x36')];if(!_0x307ad9[_0x63b6('0x31')][_0x63b6('0x38')](_0x63b6('0x50'))){_0x5e2bd3[_0x63b6('0x20')]=qs[_0x63b6('0x20')](_0x307ad9[_0x63b6('0x31')][_0x63b6('0x20')]);_0x5e2bd3[_0x63b6('0x1e')]=qs[_0x63b6('0x1e')](_0x307ad9['query'][_0x63b6('0x1e')]);}return _0x434122[_0x63b6('0x51')](_0x5e2bd3);}})[_0x63b6('0x27')](function(_0x505d74){if(_0x505d74){return _0x505d74?{'count':_0x561b4a,'rows':_0x505d74}:null;}})[_0x63b6('0x27')](respondWithResult(_0x18bdc8,null))['catch'](handleError(_0x18bdc8,null));};exports[_0x63b6('0x52')]=function(_0x197033,_0x578788,_0x313ac5){var _0x1a6413={};var _0x46170e={};var _0x870514;var _0x3a6aaf;return db[_0x63b6('0x42')]['findOne']({'where':{'id':_0x197033[_0x63b6('0x44')]['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x578788,null))[_0x63b6('0x27')](function(_0x3eb27b){if(_0x3eb27b){_0x870514=_0x3eb27b;_0x46170e[_0x63b6('0x2f')]=_['keys'](db[_0x63b6('0x4d')][_0x63b6('0x45')]);_0x46170e[_0x63b6('0x31')]=_[_0x63b6('0x32')](_0x197033[_0x63b6('0x31')]);_0x46170e[_0x63b6('0x33')]=_[_0x63b6('0x34')](_0x46170e[_0x63b6('0x2f')],_0x46170e['query']);_0x1a6413[_0x63b6('0x37')]=_[_0x63b6('0x34')](_0x46170e[_0x63b6('0x2f')],qs[_0x63b6('0x35')](_0x197033['query']['fields']));_0x1a6413[_0x63b6('0x37')]=_0x1a6413[_0x63b6('0x37')]['length']?_0x1a6413[_0x63b6('0x37')]:_0x46170e[_0x63b6('0x2f')];_0x1a6413[_0x63b6('0x39')]=qs[_0x63b6('0x3a')](_0x197033['query'][_0x63b6('0x3a')]);_0x1a6413['where']=qs['filters'](_[_0x63b6('0x4e')](_0x197033[_0x63b6('0x31')],_0x46170e['filters']));if(_0x197033[_0x63b6('0x31')][_0x63b6('0x3b')]){_0x1a6413['where']=_[_0x63b6('0x3d')](_0x1a6413[_0x63b6('0x3c')],{'$or':_[_0x63b6('0x30')](_0x1a6413[_0x63b6('0x37')],function(_0x59969a){var _0x53fea1={};_0x53fea1[_0x59969a]={'$like':'%'+_0x197033[_0x63b6('0x31')]['filter']+'%'};return _0x53fea1;})});}_0x1a6413=_[_0x63b6('0x3d')]({},_0x1a6413,_0x197033['options']);return _0x870514[_0x63b6('0x52')](_0x1a6413);}})[_0x63b6('0x27')](function(_0x642efd){if(_0x642efd){_0x3a6aaf=_0x642efd[_0x63b6('0x36')];if(!_0x197033[_0x63b6('0x31')][_0x63b6('0x38')](_0x63b6('0x50'))){_0x1a6413[_0x63b6('0x20')]=qs['limit'](_0x197033['query'][_0x63b6('0x20')]);_0x1a6413['offset']=qs[_0x63b6('0x1e')](_0x197033[_0x63b6('0x31')]['offset']);}return _0x870514[_0x63b6('0x52')](_0x1a6413);}})[_0x63b6('0x27')](function(_0x1f4b47){if(_0x1f4b47){return _0x1f4b47?{'count':_0x3a6aaf,'rows':_0x1f4b47}:null;}})[_0x63b6('0x27')](respondWithResult(_0x578788,null))[_0x63b6('0x4a')](handleError(_0x578788,null));};exports[_0x63b6('0x53')]=function(_0x17b019,_0x360b3d,_0x284d8a){var _0x51ab92={};var _0x56960c={};var _0x4a1ae9;var _0x390a3e;return db[_0x63b6('0x42')][_0x63b6('0x4f')]({'where':{'id':_0x17b019[_0x63b6('0x44')]['id']}})['then'](handleEntityNotFound(_0x360b3d,null))[_0x63b6('0x27')](function(_0x40bc61){if(_0x40bc61){_0x4a1ae9=_0x40bc61;_0x56960c[_0x63b6('0x2f')]=_[_0x63b6('0x32')](db[_0x63b6('0x54')][_0x63b6('0x45')]);_0x56960c['query']=_[_0x63b6('0x32')](_0x17b019[_0x63b6('0x31')]);_0x56960c[_0x63b6('0x33')]=_[_0x63b6('0x34')](_0x56960c[_0x63b6('0x2f')],_0x56960c[_0x63b6('0x31')]);_0x51ab92[_0x63b6('0x37')]=_[_0x63b6('0x34')](_0x56960c['model'],qs['fields'](_0x17b019[_0x63b6('0x31')][_0x63b6('0x35')]));_0x51ab92[_0x63b6('0x37')]=_0x51ab92[_0x63b6('0x37')]['length']?_0x51ab92[_0x63b6('0x37')]:_0x56960c[_0x63b6('0x2f')];_0x51ab92[_0x63b6('0x39')]=qs[_0x63b6('0x3a')](_0x17b019[_0x63b6('0x31')][_0x63b6('0x3a')]);_0x51ab92[_0x63b6('0x3c')]=qs[_0x63b6('0x33')](_[_0x63b6('0x4e')](_0x17b019[_0x63b6('0x31')],_0x56960c[_0x63b6('0x33')]));if(_0x17b019['query'][_0x63b6('0x3b')]){_0x51ab92[_0x63b6('0x3c')]=_[_0x63b6('0x3d')](_0x51ab92[_0x63b6('0x3c')],{'$or':_[_0x63b6('0x30')](_0x51ab92[_0x63b6('0x37')],function(_0xe2a538){var _0x5abc6f={};_0x5abc6f[_0xe2a538]={'$like':'%'+_0x17b019['query'][_0x63b6('0x3b')]+'%'};return _0x5abc6f;})});}_0x51ab92=_[_0x63b6('0x3d')]({},_0x51ab92,_0x17b019[_0x63b6('0x40')]);return _0x4a1ae9['getTags'](_0x51ab92);}})['then'](function(_0x4dd44c){if(_0x4dd44c){_0x390a3e=_0x4dd44c[_0x63b6('0x36')];if(!_0x17b019[_0x63b6('0x31')][_0x63b6('0x38')](_0x63b6('0x50'))){_0x51ab92['limit']=qs[_0x63b6('0x20')](_0x17b019[_0x63b6('0x31')]['limit']);_0x51ab92[_0x63b6('0x1e')]=qs[_0x63b6('0x1e')](_0x17b019[_0x63b6('0x31')]['offset']);}return _0x4a1ae9[_0x63b6('0x53')](_0x51ab92);}})['then'](function(_0x25ef45){if(_0x25ef45){return _0x25ef45?{'count':_0x390a3e,'rows':_0x25ef45}:null;}})[_0x63b6('0x27')](respondWithResult(_0x360b3d,null))[_0x63b6('0x4a')](handleError(_0x360b3d,null));};exports['setTags']=function(_0xd74d05,_0x16b6b3,_0x1792fe){if(_0xd74d05[_0x63b6('0x49')]['id']){delete _0xd74d05['body']['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xd74d05[_0x63b6('0x44')]['id']}})[_0x63b6('0x27')](handleEntityNotFound(_0x16b6b3,null))[_0x63b6('0x27')](function(_0x5ce388){if(_0x5ce388){return _0x5ce388['setTags'](_0xd74d05[_0x63b6('0x49')][_0x63b6('0x55')]||[]);}return null;})[_0x63b6('0x27')](respondWithResult(_0x16b6b3,null))[_0x63b6('0x4a')](handleError(_0x16b6b3,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index c179701..a6827a8 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 _0x2071=['./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x116de4,_0x3375a7){var _0x2e8035=function(_0x46dd71){while(--_0x46dd71){_0x116de4['push'](_0x116de4['shift']());}};_0x2e8035(++_0x3375a7);}(_0x2071,0xad));var _0x1207=function(_0x1e393b,_0x355f6b){_0x1e393b=_0x1e393b-0x0;var _0x3d0bfe=_0x2071[_0x1e393b];return _0x3d0bfe;};'use strict';var _=require(_0x1207('0x0'));var util=require(_0x1207('0x1'));var logger=require(_0x1207('0x2'))(_0x1207('0x3'));var moment=require(_0x1207('0x4'));var BPromise=require(_0x1207('0x5'));var rp=require(_0x1207('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1207('0x7'));var config=require(_0x1207('0x8'));var attributes=require(_0x1207('0x9'));module[_0x1207('0xa')]=function(_0x545e98,_0x179ae3){return _0x545e98[_0x1207('0xb')](_0x1207('0xc'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a2d=['exports','define','int_freshdesk_configurations','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0xb5e222,_0x431ee4){var _0xb8501a=function(_0x60a936){while(--_0x60a936){_0xb5e222['push'](_0xb5e222['shift']());}};_0xb8501a(++_0x431ee4);}(_0x3a2d,0x117));var _0xd3a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3a2d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd3a2('0x0'));var util=require('util');var logger=require(_0xd3a2('0x1'))(_0xd3a2('0x2'));var moment=require(_0xd3a2('0x3'));var BPromise=require(_0xd3a2('0x4'));var rp=require(_0xd3a2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd3a2('0x6'));var config=require(_0xd3a2('0x7'));var attributes=require(_0xd3a2('0x8'));module[_0xd3a2('0x9')]=function(_0x28a4cb,_0x31d290){return _0x28a4cb[_0xd3a2('0xa')]('FreshdeskConfiguration',attributes,{'tableName':_0xd3a2('0xb'),'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 3830cde..1c50ec5 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 _0x631e=['lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x631e,0xdc));var _0xe631=function(_0xa6fe85,_0x2206f4){_0xa6fe85=_0xa6fe85-0x0;var _0x2ef938=_0x631e[_0xa6fe85];return _0x2ef938;};'use strict';var _=require(_0xe631('0x0'));var util=require(_0xe631('0x1'));var moment=require(_0xe631('0x2'));var BPromise=require(_0xe631('0x3'));var rs=require(_0xe631('0x4'));var fs=require('fs');var Redis=require(_0xe631('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe631('0x6'))(_0xe631('0x7'));var config=require(_0xe631('0x8'));var jayson=require(_0xe631('0x9'));var client=jayson[_0xe631('0xa')][_0xe631('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x269832,_0x23c206,_0x5790d2){return new BPromise(function(_0x9aeb4e,_0x51191f){return client['request'](_0x269832,_0x5790d2)[_0xe631('0xc')](function(_0x868a8d){logger[_0xe631('0xd')](_0xe631('0xe'),_0x23c206,_0xe631('0xf'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x23c206,_0xe631('0xf'),JSON[_0xe631('0x10')](_0x868a8d));if(_0x868a8d['error']){if(_0x868a8d[_0xe631('0x11')][_0xe631('0x12')]===0x1f4){logger[_0xe631('0x11')](_0xe631('0xe'),_0x23c206,_0x868a8d[_0xe631('0x11')][_0xe631('0x13')]);return _0x51191f(_0x868a8d[_0xe631('0x11')][_0xe631('0x13')]);}logger['error'](_0xe631('0xe'),_0x23c206,_0x868a8d[_0xe631('0x11')][_0xe631('0x13')]);return _0x9aeb4e(_0x868a8d['error']['message']);}else{logger[_0xe631('0xd')](_0xe631('0xe'),_0x23c206,'request\x20sent');_0x9aeb4e(_0x868a8d[_0xe631('0x14')][_0xe631('0x13')]);}})[_0xe631('0x15')](function(_0xb32084){logger[_0xe631('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x23c206,_0xb32084);_0x51191f(_0xb32084);});});} \ No newline at end of file +var _0x5d6b=['../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0x5d6b,0x1ac));var _0xb5d6=function(_0x5243fa,_0x4deaaa){_0x5243fa=_0x5243fa-0x0;var _0x37d6ea=_0x5d6b[_0x5243fa];return _0x37d6ea;};'use strict';var _=require(_0xb5d6('0x0'));var util=require('util');var moment=require(_0xb5d6('0x1'));var BPromise=require(_0xb5d6('0x2'));var rs=require(_0xb5d6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb5d6('0x4'));var logger=require(_0xb5d6('0x5'))(_0xb5d6('0x6'));var config=require('../../config/environment');var jayson=require(_0xb5d6('0x7'));var client=jayson['client'][_0xb5d6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4d6f11,_0x5c25e9,_0x2f7bf0){return new BPromise(function(_0x4709ec,_0x861d5a){return client[_0xb5d6('0x9')](_0x4d6f11,_0x2f7bf0)['then'](function(_0x14e2b8){logger[_0xb5d6('0xa')](_0xb5d6('0xb'),_0x5c25e9,_0xb5d6('0xc'));logger['debug']('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5c25e9,_0xb5d6('0xc'),JSON['stringify'](_0x14e2b8));if(_0x14e2b8[_0xb5d6('0xd')]){if(_0x14e2b8[_0xb5d6('0xd')][_0xb5d6('0xe')]===0x1f4){logger[_0xb5d6('0xd')](_0xb5d6('0xb'),_0x5c25e9,_0x14e2b8['error'][_0xb5d6('0xf')]);return _0x861d5a(_0x14e2b8[_0xb5d6('0xd')][_0xb5d6('0xf')]);}logger[_0xb5d6('0xd')](_0xb5d6('0xb'),_0x5c25e9,_0x14e2b8['error']['message']);return _0x4709ec(_0x14e2b8[_0xb5d6('0xd')]['message']);}else{logger[_0xb5d6('0xa')](_0xb5d6('0xb'),_0x5c25e9,_0xb5d6('0xc'));_0x4709ec(_0x14e2b8[_0xb5d6('0x10')]['message']);}})[_0xb5d6('0x11')](function(_0x24755a){logger[_0xb5d6('0xd')](_0xb5d6('0xb'),_0x5c25e9,_0x24755a);_0x861d5a(_0x24755a);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 945603c..7edf293 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 _0xc413=['delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x5ab23d,_0x2bd832){var _0x4e1bef=function(_0x4182a0){while(--_0x4182a0){_0x5ab23d['push'](_0x5ab23d['shift']());}};_0x4e1bef(++_0x2bd832);}(_0xc413,0xc7));var _0x3c41=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xc413[_0x56482c];return _0x5aae7a;};'use strict';var multer=require(_0x3c41('0x0'));var util=require(_0x3c41('0x1'));var path=require(_0x3c41('0x2'));var timeout=require(_0x3c41('0x3'));var express=require(_0x3c41('0x4'));var router=express[_0x3c41('0x5')]();var fs_extra=require(_0x3c41('0x6'));var auth=require(_0x3c41('0x7'));var interaction=require(_0x3c41('0x8'));var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x3c41('0x9')]('/',auth[_0x3c41('0xa')](),controller[_0x3c41('0xb')]);router[_0x3c41('0x9')](_0x3c41('0xc'),auth['isAuthenticated'](),controller[_0x3c41('0xd')]);router[_0x3c41('0xe')]('/',auth[_0x3c41('0xa')](),controller[_0x3c41('0xf')]);router['put'](_0x3c41('0xc'),auth[_0x3c41('0xa')](),controller[_0x3c41('0x10')]);router[_0x3c41('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x376a=['fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','index','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x3504a0,_0x3f770f){var _0x3dfca3=function(_0x5adf34){while(--_0x5adf34){_0x3504a0['push'](_0x3504a0['shift']());}};_0x3dfca3(++_0x3f770f);}(_0x376a,0x106));var _0xa376=function(_0x118835,_0x5002cf){_0x118835=_0x118835-0x0;var _0x4f1c6a=_0x376a[_0x118835];return _0x4f1c6a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa376('0x0'));var timeout=require(_0xa376('0x1'));var express=require(_0xa376('0x2'));var router=express[_0xa376('0x3')]();var fs_extra=require(_0xa376('0x4'));var auth=require(_0xa376('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa376('0x6'));var controller=require(_0xa376('0x7'));router[_0xa376('0x8')]('/',auth['isAuthenticated'](),controller[_0xa376('0x9')]);router[_0xa376('0x8')](_0xa376('0xa'),auth[_0xa376('0xb')](),controller[_0xa376('0xc')]);router['post']('/',auth[_0xa376('0xb')](),controller[_0xa376('0xd')]);router[_0xa376('0xe')]('/:id',auth[_0xa376('0xb')](),controller[_0xa376('0xf')]);router[_0xa376('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xa376('0x11')]);module[_0xa376('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index cfee26a..aa7acd4 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 _0x8ea9=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable'];(function(_0x3b7f37,_0x538a2f){var _0xb646ee=function(_0x143d25){while(--_0x143d25){_0x3b7f37['push'](_0x3b7f37['shift']());}};_0xb646ee(++_0x538a2f);}(_0x8ea9,0x11b));var _0x98ea=function(_0x54faa5,_0x28347f){_0x54faa5=_0x54faa5-0x0;var _0x22f59d=_0x8ea9[_0x54faa5];return _0x22f59d;};'use strict';var Sequelize=require(_0x98ea('0x0'));module[_0x98ea('0x1')]={'type':{'type':Sequelize[_0x98ea('0x2')]('string',_0x98ea('0x3'),_0x98ea('0x4'),'keyValue',_0x98ea('0x5')),'defaultValue':_0x98ea('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x98ea('0x7')]},'keyType':{'type':Sequelize[_0x98ea('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x98ea('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x98ea('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9fd5=['sequelize','exports','string','STRING','ENUM','variable','customVariable'];(function(_0x154983,_0xc29edf){var _0x3d1243=function(_0x5cb7a4){while(--_0x5cb7a4){_0x154983['push'](_0x154983['shift']());}};_0x3d1243(++_0xc29edf);}(_0x9fd5,0x70));var _0x59fd=function(_0x12bfac,_0x55d79f){_0x12bfac=_0x12bfac-0x0;var _0x3491d1=_0x9fd5[_0x12bfac];return _0x3491d1;};'use strict';var Sequelize=require(_0x59fd('0x0'));module[_0x59fd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x59fd('0x2'),'variable','customVariable','keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x59fd('0x3')]},'key':{'type':Sequelize[_0x59fd('0x3')]},'keyType':{'type':Sequelize[_0x59fd('0x4')](_0x59fd('0x2'),_0x59fd('0x5'),_0x59fd('0x6'))},'keyContent':{'type':Sequelize[_0x59fd('0x3')]},'idField':{'type':Sequelize[_0x59fd('0x3')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x59fd('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 0c41d70..83f32d4 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 _0x4522=['querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','filter','where','type','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','destroy','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x34a07d,_0x2ecff2){var _0x546e7e=function(_0x5313bd){while(--_0x5313bd){_0x34a07d['push'](_0x34a07d['shift']());}};_0x546e7e(++_0x2ecff2);}(_0x4522,0x1a0));var _0x2452=function(_0x455490,_0x2c2808){_0x455490=_0x455490-0x0;var _0x38fd67=_0x4522[_0x455490];return _0x38fd67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2452('0x0'));var jsonpatch=require(_0x2452('0x1'));var rp=require(_0x2452('0x2'));var moment=require('moment');var BPromise=require(_0x2452('0x3'));var Mustache=require(_0x2452('0x4'));var util=require(_0x2452('0x5'));var path=require(_0x2452('0x6'));var sox=require(_0x2452('0x7'));var csv=require(_0x2452('0x8'));var ejs=require(_0x2452('0x9'));var fs=require('fs');var fs_extra=require(_0x2452('0xa'));var _=require(_0x2452('0xb'));var squel=require(_0x2452('0xc'));var crypto=require(_0x2452('0xd'));var jsforce=require(_0x2452('0xe'));var deskjs=require(_0x2452('0xf'));var toCsv=require(_0x2452('0x8'));var querystring=require(_0x2452('0x10'));var Papa=require(_0x2452('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2452('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2452('0x13'))(_0x2452('0x14'));var utils=require(_0x2452('0x15'));var config=require(_0x2452('0x16'));var licenseUtil=require(_0x2452('0x17'));var db=require(_0x2452('0x18'))['db'];function respondWithStatusCode(_0x2c1e0f,_0x2377b9){_0x2377b9=_0x2377b9||0xcc;return function(_0x4968e8){if(_0x4968e8){return _0x2c1e0f['sendStatus'](_0x2377b9);}return _0x2c1e0f['status'](_0x2377b9)[_0x2452('0x19')]();};}function respondWithResult(_0x4fafa0,_0x33e592){_0x33e592=_0x33e592||0xc8;return function(_0x506cd4){if(_0x506cd4){return _0x4fafa0[_0x2452('0x1a')](_0x33e592)[_0x2452('0x1b')](_0x506cd4);}};}function respondWithFilteredResult(_0x5d0438,_0x1dbadf){return function(_0x47930c){if(_0x47930c){var _0x3dd8cc=typeof _0x1dbadf[_0x2452('0x1c')]===_0x2452('0x1d')&&typeof _0x1dbadf[_0x2452('0x1e')]==='undefined';var _0x2108e4=_0x47930c[_0x2452('0x1f')];var _0x59d89a=_0x3dd8cc?0x0:_0x1dbadf['offset'];var _0x1bfb44=_0x3dd8cc?_0x47930c[_0x2452('0x1f')]:_0x1dbadf[_0x2452('0x1c')]+_0x1dbadf['limit'];var _0x914d2b;if(_0x1bfb44>=_0x2108e4){_0x1bfb44=_0x2108e4;_0x914d2b=0xc8;}else{_0x914d2b=0xce;}_0x5d0438[_0x2452('0x1a')](_0x914d2b);return _0x5d0438[_0x2452('0x20')](_0x2452('0x21'),_0x59d89a+'-'+_0x1bfb44+'/'+_0x2108e4)[_0x2452('0x1b')](_0x47930c);}return null;};}function patchUpdates(_0x1c70cb){return function(_0x3f48c2){try{jsonpatch[_0x2452('0x22')](_0x3f48c2,_0x1c70cb,!![]);}catch(_0x5e921d){return BPromise['reject'](_0x5e921d);}return _0x3f48c2[_0x2452('0x23')]();};}function saveUpdates(_0x32dfe7,_0x4bb3ff){return function(_0x17d0a0){if(_0x17d0a0){return _0x17d0a0[_0x2452('0x24')](_0x32dfe7)[_0x2452('0x25')](function(_0x617ba7){return _0x617ba7;});}return null;};}function removeEntity(_0x285281,_0x397f21){return function(_0x155caa){if(_0x155caa){return _0x155caa['destroy']()[_0x2452('0x25')](function(){_0x285281[_0x2452('0x1a')](0xcc)[_0x2452('0x19')]();});}};}function handleEntityNotFound(_0x231410,_0x3a4326){return function(_0x516fcf){if(!_0x516fcf){_0x231410['sendStatus'](0x194);}return _0x516fcf;};}function handleError(_0x295be0,_0x159ba1){_0x159ba1=_0x159ba1||0x1f4;return function(_0x46fcbb){logger[_0x2452('0x26')](_0x46fcbb[_0x2452('0x27')]);if(_0x46fcbb['name']){delete _0x46fcbb[_0x2452('0x28')];}_0x295be0[_0x2452('0x1a')](_0x159ba1)['send'](_0x46fcbb);};}exports['index']=function(_0x332878,_0xe8d39b){var _0x36cb6c={},_0x28e6ea={},_0x43fde0={'count':0x0,'rows':[]};var _0x258fa6=_['map'](db['FreshdeskField'][_0x2452('0x29')],function(_0x454e0a){return{'name':_0x454e0a[_0x2452('0x2a')],'type':_0x454e0a['type'][_0x2452('0x2b')]};});_0x28e6ea[_0x2452('0x2c')]=_['map'](_0x258fa6,_0x2452('0x28'));_0x28e6ea[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x332878[_0x2452('0x2d')]);_0x28e6ea[_0x2452('0x2f')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],_0x28e6ea[_0x2452('0x2d')]);_0x36cb6c[_0x2452('0x31')]=_[_0x2452('0x30')](_0x28e6ea[_0x2452('0x2c')],qs[_0x2452('0x32')](_0x332878[_0x2452('0x2d')]['fields']));_0x36cb6c[_0x2452('0x31')]=_0x36cb6c[_0x2452('0x31')]['length']?_0x36cb6c[_0x2452('0x31')]:_0x28e6ea['model'];if(!_0x332878[_0x2452('0x2d')][_0x2452('0x33')]('nolimit')){_0x36cb6c[_0x2452('0x1e')]=qs[_0x2452('0x1e')](_0x332878[_0x2452('0x2d')]['limit']);_0x36cb6c[_0x2452('0x1c')]=qs[_0x2452('0x1c')](_0x332878['query'][_0x2452('0x1c')]);}_0x36cb6c[_0x2452('0x34')]=qs[_0x2452('0x35')](_0x332878[_0x2452('0x2d')][_0x2452('0x35')]);_0x36cb6c['where']=qs['filters'](_['pick'](_0x332878[_0x2452('0x2d')],_0x28e6ea[_0x2452('0x2f')]),_0x258fa6);if(_0x332878[_0x2452('0x2d')][_0x2452('0x36')]){_0x36cb6c[_0x2452('0x37')]=_['merge'](_0x36cb6c[_0x2452('0x37')],{'$or':_['map'](_0x258fa6,function(_0x5be9b4){if(_0x5be9b4[_0x2452('0x38')]!=='VIRTUAL'){var _0x44ef50={};_0x44ef50[_0x5be9b4[_0x2452('0x28')]]={'$like':'%'+_0x332878['query'][_0x2452('0x36')]+'%'};return _0x44ef50;}})});}_0x36cb6c=_[_0x2452('0x39')]({},_0x36cb6c,_0x332878[_0x2452('0x3a')]);var _0x34d7f9={'where':_0x36cb6c[_0x2452('0x37')]};return db[_0x2452('0x3b')][_0x2452('0x1f')](_0x34d7f9)[_0x2452('0x25')](function(_0x5b864e){_0x43fde0[_0x2452('0x1f')]=_0x5b864e;if(_0x332878['query'][_0x2452('0x3c')]){_0x36cb6c[_0x2452('0x3d')]=[{'all':!![]}];}return db['FreshdeskField'][_0x2452('0x3e')](_0x36cb6c);})[_0x2452('0x25')](function(_0xb4e3f5){_0x43fde0[_0x2452('0x3f')]=_0xb4e3f5;return _0x43fde0;})[_0x2452('0x25')](respondWithFilteredResult(_0xe8d39b,_0x36cb6c))['catch'](handleError(_0xe8d39b,null));};exports[_0x2452('0x40')]=function(_0x29910e,_0x5379a9){var _0xfabbd8={'raw':!![],'where':{'id':_0x29910e[_0x2452('0x41')]['id']}},_0x449b89={};_0x449b89[_0x2452('0x2c')]=_['keys'](db[_0x2452('0x3b')][_0x2452('0x29')]);_0x449b89[_0x2452('0x2d')]=_[_0x2452('0x2e')](_0x29910e[_0x2452('0x2d')]);_0x449b89[_0x2452('0x2f')]=_['intersection'](_0x449b89[_0x2452('0x2c')],_0x449b89['query']);_0xfabbd8[_0x2452('0x31')]=_[_0x2452('0x30')](_0x449b89['model'],qs['fields'](_0x29910e['query']['fields']));_0xfabbd8[_0x2452('0x31')]=_0xfabbd8['attributes'][_0x2452('0x42')]?_0xfabbd8['attributes']:_0x449b89[_0x2452('0x2c')];if(_0x29910e[_0x2452('0x2d')]['includeAll']){_0xfabbd8['include']=[{'all':!![]}];}_0xfabbd8=_[_0x2452('0x39')]({},_0xfabbd8,_0x29910e['options']);return db[_0x2452('0x3b')][_0x2452('0x43')](_0xfabbd8)[_0x2452('0x25')](handleEntityNotFound(_0x5379a9,null))[_0x2452('0x25')](respondWithResult(_0x5379a9,null))['catch'](handleError(_0x5379a9,null));};exports['create']=function(_0x3e4a8b,_0x38615e){return db[_0x2452('0x3b')][_0x2452('0x44')](_0x3e4a8b[_0x2452('0x45')],{})['then'](respondWithResult(_0x38615e,0xc9))[_0x2452('0x46')](handleError(_0x38615e,null));};exports['update']=function(_0x3634f7,_0x53fd05){if(_0x3634f7[_0x2452('0x45')]['id']){delete _0x3634f7[_0x2452('0x45')]['id'];}return db['FreshdeskField'][_0x2452('0x43')]({'where':{'id':_0x3634f7['params']['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x53fd05,null))['then'](saveUpdates(_0x3634f7['body'],null))['then'](respondWithResult(_0x53fd05,null))[_0x2452('0x46')](handleError(_0x53fd05,null));};exports[_0x2452('0x47')]=function(_0x36ebcb,_0x4b705f){return db[_0x2452('0x3b')][_0x2452('0x43')]({'where':{'id':_0x36ebcb[_0x2452('0x41')]['id']}})[_0x2452('0x25')](handleEntityNotFound(_0x4b705f,null))[_0x2452('0x25')](removeEntity(_0x4b705f,null))['catch'](handleError(_0x4b705f,null));}; \ No newline at end of file +var _0xc368=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','error','name','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','FreshdeskField','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x48131a,_0x820c84){var _0xdcf85d=function(_0x3259bd){while(--_0x3259bd){_0x48131a['push'](_0x48131a['shift']());}};_0xdcf85d(++_0x820c84);}(_0xc368,0x7b));var _0x8c36=function(_0x3d50e6,_0x2226cb){_0x3d50e6=_0x3d50e6-0x0;var _0x165ffa=_0xc368[_0x3d50e6];return _0x165ffa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c36('0x1'));var rp=require(_0x8c36('0x2'));var moment=require(_0x8c36('0x3'));var BPromise=require(_0x8c36('0x4'));var Mustache=require(_0x8c36('0x5'));var util=require('util');var path=require(_0x8c36('0x6'));var sox=require(_0x8c36('0x7'));var csv=require(_0x8c36('0x8'));var ejs=require(_0x8c36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x8'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var licenseUtil=require(_0x8c36('0x15'));var db=require(_0x8c36('0x16'))['db'];function respondWithStatusCode(_0xa09884,_0x23eb71){_0x23eb71=_0x23eb71||0xcc;return function(_0x205d5c){if(_0x205d5c){return _0xa09884[_0x8c36('0x17')](_0x23eb71);}return _0xa09884[_0x8c36('0x18')](_0x23eb71)[_0x8c36('0x19')]();};}function respondWithResult(_0x3c824b,_0x220f18){_0x220f18=_0x220f18||0xc8;return function(_0x5dfcd5){if(_0x5dfcd5){return _0x3c824b[_0x8c36('0x18')](_0x220f18)['json'](_0x5dfcd5);}};}function respondWithFilteredResult(_0xea7509,_0x3f83aa){return function(_0x29e791){if(_0x29e791){var _0x1fc68e=typeof _0x3f83aa[_0x8c36('0x1a')]===_0x8c36('0x1b')&&typeof _0x3f83aa[_0x8c36('0x1c')]===_0x8c36('0x1b');var _0x30229e=_0x29e791['count'];var _0x2be9b0=_0x1fc68e?0x0:_0x3f83aa[_0x8c36('0x1a')];var _0x47832a=_0x1fc68e?_0x29e791[_0x8c36('0x1d')]:_0x3f83aa[_0x8c36('0x1a')]+_0x3f83aa['limit'];var _0x15100f;if(_0x47832a>=_0x30229e){_0x47832a=_0x30229e;_0x15100f=0xc8;}else{_0x15100f=0xce;}_0xea7509[_0x8c36('0x18')](_0x15100f);return _0xea7509[_0x8c36('0x1e')](_0x8c36('0x1f'),_0x2be9b0+'-'+_0x47832a+'/'+_0x30229e)[_0x8c36('0x20')](_0x29e791);}return null;};}function patchUpdates(_0x2b07ad){return function(_0xfb9763){try{jsonpatch[_0x8c36('0x21')](_0xfb9763,_0x2b07ad,!![]);}catch(_0x153735){return BPromise[_0x8c36('0x22')](_0x153735);}return _0xfb9763[_0x8c36('0x23')]();};}function saveUpdates(_0x14ee6b,_0x46645d){return function(_0x51fd6c){if(_0x51fd6c){return _0x51fd6c['update'](_0x14ee6b)['then'](function(_0x55b844){return _0x55b844;});}return null;};}function removeEntity(_0x2269f5,_0x7effb8){return function(_0x2088aa){if(_0x2088aa){return _0x2088aa[_0x8c36('0x24')]()[_0x8c36('0x25')](function(){_0x2269f5[_0x8c36('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d39ca,_0x49f6f9){return function(_0x40b66f){if(!_0x40b66f){_0x1d39ca['sendStatus'](0x194);}return _0x40b66f;};}function handleError(_0x10613e,_0x1afee4){_0x1afee4=_0x1afee4||0x1f4;return function(_0x271ec4){logger[_0x8c36('0x26')](_0x271ec4['stack']);if(_0x271ec4['name']){delete _0x271ec4[_0x8c36('0x27')];}_0x10613e[_0x8c36('0x18')](_0x1afee4)['send'](_0x271ec4);};}exports['index']=function(_0x418663,_0x2b5a8c){var _0x502fa3={},_0x1280a1={},_0xb29f20={'count':0x0,'rows':[]};var _0x3ca98e=_['map'](db['FreshdeskField'][_0x8c36('0x28')],function(_0x1531fc){return{'name':_0x1531fc[_0x8c36('0x29')],'type':_0x1531fc[_0x8c36('0x2a')][_0x8c36('0x2b')]};});_0x1280a1[_0x8c36('0x2c')]=_[_0x8c36('0x2d')](_0x3ca98e,_0x8c36('0x27'));_0x1280a1[_0x8c36('0x2e')]=_[_0x8c36('0x2f')](_0x418663[_0x8c36('0x2e')]);_0x1280a1[_0x8c36('0x30')]=_[_0x8c36('0x31')](_0x1280a1[_0x8c36('0x2c')],_0x1280a1[_0x8c36('0x2e')]);_0x502fa3[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x1280a1['model'],qs['fields'](_0x418663['query'][_0x8c36('0x33')]));_0x502fa3[_0x8c36('0x32')]=_0x502fa3[_0x8c36('0x32')][_0x8c36('0x34')]?_0x502fa3[_0x8c36('0x32')]:_0x1280a1[_0x8c36('0x2c')];if(!_0x418663[_0x8c36('0x2e')]['hasOwnProperty'](_0x8c36('0x35'))){_0x502fa3['limit']=qs[_0x8c36('0x1c')](_0x418663['query'][_0x8c36('0x1c')]);_0x502fa3[_0x8c36('0x1a')]=qs[_0x8c36('0x1a')](_0x418663['query'][_0x8c36('0x1a')]);}_0x502fa3[_0x8c36('0x36')]=qs[_0x8c36('0x37')](_0x418663[_0x8c36('0x2e')][_0x8c36('0x37')]);_0x502fa3[_0x8c36('0x38')]=qs[_0x8c36('0x30')](_[_0x8c36('0x39')](_0x418663[_0x8c36('0x2e')],_0x1280a1[_0x8c36('0x30')]),_0x3ca98e);if(_0x418663[_0x8c36('0x2e')][_0x8c36('0x3a')]){_0x502fa3[_0x8c36('0x38')]=_[_0x8c36('0x3b')](_0x502fa3[_0x8c36('0x38')],{'$or':_[_0x8c36('0x2d')](_0x3ca98e,function(_0x292b5f){if(_0x292b5f['type']!==_0x8c36('0x3c')){var _0x5ee15b={};_0x5ee15b[_0x292b5f[_0x8c36('0x27')]]={'$like':'%'+_0x418663[_0x8c36('0x2e')][_0x8c36('0x3a')]+'%'};return _0x5ee15b;}})});}_0x502fa3=_[_0x8c36('0x3b')]({},_0x502fa3,_0x418663['options']);var _0x5a50d6={'where':_0x502fa3[_0x8c36('0x38')]};return db[_0x8c36('0x3d')][_0x8c36('0x1d')](_0x5a50d6)['then'](function(_0x4f6f06){_0xb29f20[_0x8c36('0x1d')]=_0x4f6f06;if(_0x418663['query']['includeAll']){_0x502fa3[_0x8c36('0x3e')]=[{'all':!![]}];}return db[_0x8c36('0x3d')][_0x8c36('0x3f')](_0x502fa3);})[_0x8c36('0x25')](function(_0x2a0272){_0xb29f20[_0x8c36('0x40')]=_0x2a0272;return _0xb29f20;})[_0x8c36('0x25')](respondWithFilteredResult(_0x2b5a8c,_0x502fa3))[_0x8c36('0x41')](handleError(_0x2b5a8c,null));};exports[_0x8c36('0x42')]=function(_0xb65040,_0x508ed9){var _0x3543b0={'raw':!![],'where':{'id':_0xb65040[_0x8c36('0x43')]['id']}},_0x24505c={};_0x24505c[_0x8c36('0x2c')]=_[_0x8c36('0x2f')](db['FreshdeskField'][_0x8c36('0x28')]);_0x24505c[_0x8c36('0x2e')]=_[_0x8c36('0x2f')](_0xb65040[_0x8c36('0x2e')]);_0x24505c[_0x8c36('0x30')]=_[_0x8c36('0x31')](_0x24505c['model'],_0x24505c[_0x8c36('0x2e')]);_0x3543b0[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x24505c[_0x8c36('0x2c')],qs[_0x8c36('0x33')](_0xb65040[_0x8c36('0x2e')][_0x8c36('0x33')]));_0x3543b0['attributes']=_0x3543b0[_0x8c36('0x32')][_0x8c36('0x34')]?_0x3543b0[_0x8c36('0x32')]:_0x24505c[_0x8c36('0x2c')];if(_0xb65040[_0x8c36('0x2e')][_0x8c36('0x44')]){_0x3543b0[_0x8c36('0x3e')]=[{'all':!![]}];}_0x3543b0=_[_0x8c36('0x3b')]({},_0x3543b0,_0xb65040[_0x8c36('0x45')]);return db[_0x8c36('0x3d')][_0x8c36('0x46')](_0x3543b0)[_0x8c36('0x25')](handleEntityNotFound(_0x508ed9,null))['then'](respondWithResult(_0x508ed9,null))['catch'](handleError(_0x508ed9,null));};exports[_0x8c36('0x47')]=function(_0x476b51,_0xd46608){return db[_0x8c36('0x3d')]['create'](_0x476b51[_0x8c36('0x48')],{})[_0x8c36('0x25')](respondWithResult(_0xd46608,0xc9))['catch'](handleError(_0xd46608,null));};exports['update']=function(_0x4edf8e,_0xb4ebae){if(_0x4edf8e[_0x8c36('0x48')]['id']){delete _0x4edf8e[_0x8c36('0x48')]['id'];}return db[_0x8c36('0x3d')][_0x8c36('0x46')]({'where':{'id':_0x4edf8e[_0x8c36('0x43')]['id']}})['then'](handleEntityNotFound(_0xb4ebae,null))[_0x8c36('0x25')](saveUpdates(_0x4edf8e[_0x8c36('0x48')],null))[_0x8c36('0x25')](respondWithResult(_0xb4ebae,null))[_0x8c36('0x41')](handleError(_0xb4ebae,null));};exports['destroy']=function(_0x5e668d,_0x599116){return db[_0x8c36('0x3d')][_0x8c36('0x46')]({'where':{'id':_0x5e668d[_0x8c36('0x43')]['id']}})[_0x8c36('0x25')](handleEntityNotFound(_0x599116,null))[_0x8c36('0x25')](removeEntity(_0x599116,null))[_0x8c36('0x41')](handleError(_0x599116,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index f752473..6bfbac0 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 _0x6819=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','idField','FieldId','util','../../config/logger','api'];(function(_0xe1f858,_0xb86c44){var _0x367af6=function(_0x40ee87){while(--_0x40ee87){_0xe1f858['push'](_0xe1f858['shift']());}};_0x367af6(++_0xb86c44);}(_0x6819,0x93));var _0x9681=function(_0x2a08ae,_0x416412){_0x2a08ae=_0x2a08ae-0x0;var _0x37a1c7=_0x6819[_0x2a08ae];return _0x37a1c7;};'use strict';var _=require('lodash');var util=require(_0x9681('0x0'));var logger=require(_0x9681('0x1'))(_0x9681('0x2'));var moment=require(_0x9681('0x3'));var BPromise=require(_0x9681('0x4'));var rp=require(_0x9681('0x5'));var fs=require('fs');var path=require(_0x9681('0x6'));var rimraf=require(_0x9681('0x7'));var config=require(_0x9681('0x8'));var attributes=require(_0x9681('0x9'));module[_0x9681('0xa')]=function(_0x24d21f,_0x1a5e1b){return _0x24d21f[_0x9681('0xb')](_0x9681('0xc'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x9681('0xd'),_0x9681('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9147=['request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x9147,0x1ca));var _0x7914=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x9147[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x7914('0x0'));var util=require(_0x7914('0x1'));var logger=require(_0x7914('0x2'))(_0x7914('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7914('0x4'));var fs=require('fs');var path=require(_0x7914('0x5'));var rimraf=require(_0x7914('0x6'));var config=require(_0x7914('0x7'));var attributes=require(_0x7914('0x8'));module['exports']=function(_0xb662b,_0x3fdbe0){return _0xb662b['define'](_0x7914('0x9'),attributes,{'tableName':_0x7914('0xa'),'paranoid':![],'indexes':[{'name':_0x7914('0xb'),'fields':[_0x7914('0xc'),_0x7914('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 6d23888..0ee53ff 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 _0x6121=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3c0c96,_0x449674){var _0x1780ec=function(_0x395465){while(--_0x395465){_0x3c0c96['push'](_0x3c0c96['shift']());}};_0x1780ec(++_0x449674);}(_0x6121,0x14c));var _0x1612=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6121[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x1612('0x0'));var util=require(_0x1612('0x1'));var moment=require(_0x1612('0x2'));var BPromise=require(_0x1612('0x3'));var rs=require(_0x1612('0x4'));var fs=require('fs');var Redis=require(_0x1612('0x5'));var db=require(_0x1612('0x6'))['db'];var utils=require(_0x1612('0x7'));var logger=require(_0x1612('0x8'))(_0x1612('0x9'));var config=require('../../config/environment');var jayson=require(_0x1612('0xa'));var client=jayson[_0x1612('0xb')][_0x1612('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4cf2b7,_0x3a4333,_0x552820){return new BPromise(function(_0x198b46,_0x117351){return client['request'](_0x4cf2b7,_0x552820)[_0x1612('0xd')](function(_0x3e9fe3){logger[_0x1612('0xe')](_0x1612('0xf'),_0x3a4333,_0x1612('0x10'));logger['debug'](_0x1612('0x11'),_0x3a4333,_0x1612('0x10'),JSON[_0x1612('0x12')](_0x3e9fe3));if(_0x3e9fe3[_0x1612('0x13')]){if(_0x3e9fe3[_0x1612('0x13')]['code']===0x1f4){logger[_0x1612('0x13')](_0x1612('0xf'),_0x3a4333,_0x3e9fe3[_0x1612('0x13')][_0x1612('0x14')]);return _0x117351(_0x3e9fe3[_0x1612('0x13')][_0x1612('0x14')]);}logger['error'](_0x1612('0xf'),_0x3a4333,_0x3e9fe3[_0x1612('0x13')][_0x1612('0x14')]);return _0x198b46(_0x3e9fe3[_0x1612('0x13')][_0x1612('0x14')]);}else{logger[_0x1612('0xe')]('FreshdeskField,\x20%s,\x20%s',_0x3a4333,_0x1612('0x10'));_0x198b46(_0x3e9fe3[_0x1612('0x15')][_0x1612('0x14')]);}})[_0x1612('0x16')](function(_0x413fb5){logger[_0x1612('0x13')]('FreshdeskField,\x20%s,\x20%s',_0x3a4333,_0x413fb5);_0x117351(_0x413fb5);});});} \ No newline at end of file +var _0xa5c4=['client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x133643,_0x4d7f52){var _0x535ec8=function(_0x369a9e){while(--_0x369a9e){_0x133643['push'](_0x133643['shift']());}};_0x535ec8(++_0x4d7f52);}(_0xa5c4,0x69));var _0x4a5c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xa5c4[_0x198446];return _0x38d7b7;};'use strict';var _=require(_0x4a5c('0x0'));var util=require(_0x4a5c('0x1'));var moment=require('moment');var BPromise=require(_0x4a5c('0x2'));var rs=require(_0x4a5c('0x3'));var fs=require('fs');var Redis=require(_0x4a5c('0x4'));var db=require(_0x4a5c('0x5'))['db'];var utils=require(_0x4a5c('0x6'));var logger=require('../../config/logger')(_0x4a5c('0x7'));var config=require(_0x4a5c('0x8'));var jayson=require(_0x4a5c('0x9'));var client=jayson[_0x4a5c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee24d,_0x273336,_0x246c6e){return new BPromise(function(_0x332dc5,_0x1a2e8d){return client[_0x4a5c('0xb')](_0x1ee24d,_0x246c6e)[_0x4a5c('0xc')](function(_0x3e0317){logger[_0x4a5c('0xd')](_0x4a5c('0xe'),_0x273336,_0x4a5c('0xf'));logger[_0x4a5c('0x10')](_0x4a5c('0x11'),_0x273336,'request\x20sent',JSON[_0x4a5c('0x12')](_0x3e0317));if(_0x3e0317[_0x4a5c('0x13')]){if(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x14')]===0x1f4){logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);return _0x1a2e8d(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);}logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);return _0x332dc5(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);}else{logger[_0x4a5c('0xd')](_0x4a5c('0xe'),_0x273336,_0x4a5c('0xf'));_0x332dc5(_0x3e0317['result']['message']);}})[_0x4a5c('0x16')](function(_0x163f56){logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x163f56);_0x1a2e8d(_0x163f56);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 6133678..2773076 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 _0x6e6c=['../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x28afd9,_0x32df7e){var _0x119eb6=function(_0x2cb23f){while(--_0x2cb23f){_0x28afd9['push'](_0x28afd9['shift']());}};_0x119eb6(++_0x32df7e);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6e6c[_0x19e35c];return _0x3e1fe8;};'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('./intFreshsalesAccount.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id/configurations',auth[_0xc6e6('0x7')](),controller['getConfigurations']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0xc')]('/',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xc')](_0xc6e6('0xe'),auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0x11')]('/:id',auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x12')]);module[_0xc6e6('0x13')]=router; \ No newline at end of file +var _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x373d,0x1e2));var _0xd373=function(_0x2cdc34,_0x15e0c1){_0x2cdc34=_0x2cdc34-0x0;var _0x2be714=_0x373d[_0x2cdc34];return _0x2be714;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index e1a30e6..1e80fa2 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 _0x065e=['sequelize','STRING','username'];(function(_0x3a0863,_0x4cd5ef){var _0x85c557=function(_0x3011cb){while(--_0x3011cb){_0x3a0863['push'](_0x3a0863['shift']());}};_0x85c557(++_0x4cd5ef);}(_0x065e,0x1a7));var _0xe065=function(_0x2889a7,_0xc99e77){_0x2889a7=_0x2889a7-0x0;var _0x543ea0=_0x065e[_0x2889a7];return _0x543ea0;};'use strict';var Sequelize=require(_0xe065('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xe065('0x1')],'unique':_0xe065('0x2')},'apiKey':{'type':Sequelize[_0xe065('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xe065('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xf4f4=['exports','STRING','username','sequelize'];(function(_0x1182bd,_0x52ebf2){var _0x5c868b=function(_0x2c905f){while(--_0x2c905f){_0x1182bd['push'](_0x1182bd['shift']());}};_0x5c868b(++_0x52ebf2);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x301200,_0x149e5e){_0x301200=_0x301200-0x0;var _0x26e3f2=_0xf4f4[_0x301200];return _0x26e3f2;};'use strict';var Sequelize=require(_0x4f4f('0x0'));module[_0x4f4f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4f4f('0x2')]},'username':{'type':Sequelize[_0x4f4f('0x2')],'unique':_0x4f4f('0x3')},'apiKey':{'type':Sequelize[_0x4f4f('0x2')]},'remoteUri':{'type':Sequelize[_0x4f4f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4f4f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 6246787..4430947 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 _0x8dc3=['then','error','stack','name','send','index','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','order','sort','filter','where','VIRTUAL','merge','options','FreshsalesAccount','includeAll','findAll','rows','catch','show','rawAttributes','include','find','body','params','getConfigurations','findOne','FreshsalesConfiguration','length','AccountId','Subjects','channel','getDescriptions','FreshsalesField','Descriptions','getFields','username','remoteUri','apiKey','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','destroy'];(function(_0x3ce111,_0x4ec1d1){var _0x25754a=function(_0x2bf398){while(--_0x2bf398){_0x3ce111['push'](_0x3ce111['shift']());}};_0x25754a(++_0x4ec1d1);}(_0x8dc3,0xfe));var _0x38dc=function(_0xdd5183,_0x296fb6){_0xdd5183=_0xdd5183-0x0;var _0x1fe56f=_0x8dc3[_0xdd5183];return _0x1fe56f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x38dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x38dc('0x1'));var moment=require(_0x38dc('0x2'));var BPromise=require(_0x38dc('0x3'));var Mustache=require(_0x38dc('0x4'));var util=require('util');var path=require(_0x38dc('0x5'));var sox=require('sox');var csv=require(_0x38dc('0x6'));var ejs=require(_0x38dc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x38dc('0x8'));var squel=require(_0x38dc('0x9'));var crypto=require(_0x38dc('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x38dc('0xb'));var toCsv=require(_0x38dc('0x6'));var querystring=require('querystring');var Papa=require(_0x38dc('0xc'));var Redis=require(_0x38dc('0xd'));var authService=require(_0x38dc('0xe'));var qs=require(_0x38dc('0xf'));var as=require(_0x38dc('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x38dc('0x11'));var utils=require(_0x38dc('0x12'));var config=require(_0x38dc('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x38dc('0x14'))['db'];var integrations=require(_0x38dc('0x15'));function respondWithStatusCode(_0x368996,_0x546a7d){_0x546a7d=_0x546a7d||0xcc;return function(_0x1ba452){if(_0x1ba452){return _0x368996[_0x38dc('0x16')](_0x546a7d);}return _0x368996[_0x38dc('0x17')](_0x546a7d)[_0x38dc('0x18')]();};}function respondWithResult(_0xdc4d89,_0x522e9d){_0x522e9d=_0x522e9d||0xc8;return function(_0x5944ce){if(_0x5944ce){return _0xdc4d89[_0x38dc('0x17')](_0x522e9d)[_0x38dc('0x19')](_0x5944ce);}};}function respondWithFilteredResult(_0x6cef0f,_0x31f54b){return function(_0x12fadc){if(_0x12fadc){var _0xdc3b18=typeof _0x31f54b['offset']===_0x38dc('0x1a')&&typeof _0x31f54b[_0x38dc('0x1b')]===_0x38dc('0x1a');var _0x15b21f=_0x12fadc[_0x38dc('0x1c')];var _0x3d1008=_0xdc3b18?0x0:_0x31f54b['offset'];var _0x242a02=_0xdc3b18?_0x12fadc[_0x38dc('0x1c')]:_0x31f54b[_0x38dc('0x1d')]+_0x31f54b[_0x38dc('0x1b')];var _0x35e47b;if(_0x242a02>=_0x15b21f){_0x242a02=_0x15b21f;_0x35e47b=0xc8;}else{_0x35e47b=0xce;}_0x6cef0f[_0x38dc('0x17')](_0x35e47b);return _0x6cef0f[_0x38dc('0x1e')]('Content-Range',_0x3d1008+'-'+_0x242a02+'/'+_0x15b21f)['json'](_0x12fadc);}return null;};}function patchUpdates(_0x239683){return function(_0x4279ca){try{jsonpatch[_0x38dc('0x1f')](_0x4279ca,_0x239683,!![]);}catch(_0x39221f){return BPromise['reject'](_0x39221f);}return _0x4279ca['save']();};}function saveUpdates(_0x51f43c,_0x216253){return function(_0x4544f9){if(_0x4544f9){return _0x4544f9[_0x38dc('0x20')](_0x51f43c)['then'](function(_0x3f5721){return _0x3f5721;});}return null;};}function removeEntity(_0x294726,_0x686e8f){return function(_0x25c4f0){if(_0x25c4f0){return _0x25c4f0[_0x38dc('0x21')]()[_0x38dc('0x22')](function(){_0x294726['status'](0xcc)[_0x38dc('0x18')]();});}};}function handleEntityNotFound(_0xcf7b95,_0x20b11d){return function(_0x5f1566){if(!_0x5f1566){_0xcf7b95[_0x38dc('0x16')](0x194);}return _0x5f1566;};}function handleError(_0x290613,_0x299d8e){_0x299d8e=_0x299d8e||0x1f4;return function(_0x16192f){logger[_0x38dc('0x23')](_0x16192f[_0x38dc('0x24')]);if(_0x16192f[_0x38dc('0x25')]){delete _0x16192f[_0x38dc('0x25')];}_0x290613[_0x38dc('0x17')](_0x299d8e)[_0x38dc('0x26')](_0x16192f);};}exports[_0x38dc('0x27')]=function(_0x42d902,_0x2a03fe){var _0x3560ab={},_0x4712af={},_0x17a5f0={'count':0x0,'rows':[]};var _0x31ef19=_['map'](db['FreshsalesAccount']['rawAttributes'],function(_0x32f50c){return{'name':_0x32f50c[_0x38dc('0x28')],'type':_0x32f50c[_0x38dc('0x29')][_0x38dc('0x2a')]};});_0x4712af[_0x38dc('0x2b')]=_[_0x38dc('0x2c')](_0x31ef19,_0x38dc('0x25'));_0x4712af[_0x38dc('0x2d')]=_[_0x38dc('0x2e')](_0x42d902[_0x38dc('0x2d')]);_0x4712af[_0x38dc('0x2f')]=_['intersection'](_0x4712af[_0x38dc('0x2b')],_0x4712af[_0x38dc('0x2d')]);_0x3560ab[_0x38dc('0x30')]=_[_0x38dc('0x31')](_0x4712af[_0x38dc('0x2b')],qs[_0x38dc('0x32')](_0x42d902[_0x38dc('0x2d')][_0x38dc('0x32')]));_0x3560ab[_0x38dc('0x30')]=_0x3560ab[_0x38dc('0x30')]['length']?_0x3560ab[_0x38dc('0x30')]:_0x4712af[_0x38dc('0x2b')];if(!_0x42d902[_0x38dc('0x2d')]['hasOwnProperty']('nolimit')){_0x3560ab[_0x38dc('0x1b')]=qs[_0x38dc('0x1b')](_0x42d902[_0x38dc('0x2d')][_0x38dc('0x1b')]);_0x3560ab[_0x38dc('0x1d')]=qs[_0x38dc('0x1d')](_0x42d902[_0x38dc('0x2d')][_0x38dc('0x1d')]);}_0x3560ab[_0x38dc('0x33')]=qs[_0x38dc('0x34')](_0x42d902[_0x38dc('0x2d')]['sort']);_0x3560ab['where']=qs[_0x38dc('0x2f')](_['pick'](_0x42d902['query'],_0x4712af['filters']),_0x31ef19);if(_0x42d902[_0x38dc('0x2d')][_0x38dc('0x35')]){_0x3560ab[_0x38dc('0x36')]=_['merge'](_0x3560ab[_0x38dc('0x36')],{'$or':_[_0x38dc('0x2c')](_0x31ef19,function(_0x28ff67){if(_0x28ff67['type']!==_0x38dc('0x37')){var _0x2c18dc={};_0x2c18dc[_0x28ff67[_0x38dc('0x25')]]={'$like':'%'+_0x42d902[_0x38dc('0x2d')][_0x38dc('0x35')]+'%'};return _0x2c18dc;}})});}_0x3560ab=_[_0x38dc('0x38')]({},_0x3560ab,_0x42d902[_0x38dc('0x39')]);var _0x3a975b={'where':_0x3560ab[_0x38dc('0x36')]};return db[_0x38dc('0x3a')]['count'](_0x3a975b)[_0x38dc('0x22')](function(_0x3244de){_0x17a5f0[_0x38dc('0x1c')]=_0x3244de;if(_0x42d902[_0x38dc('0x2d')][_0x38dc('0x3b')]){_0x3560ab['include']=[{'all':!![]}];}return db[_0x38dc('0x3a')][_0x38dc('0x3c')](_0x3560ab);})[_0x38dc('0x22')](function(_0x62eeb1){_0x17a5f0[_0x38dc('0x3d')]=_0x62eeb1;return _0x17a5f0;})['then'](respondWithFilteredResult(_0x2a03fe,_0x3560ab))[_0x38dc('0x3e')](handleError(_0x2a03fe,null));};exports[_0x38dc('0x3f')]=function(_0x42ade5,_0x2837ce){var _0x3fdd1e={'raw':![],'where':{'id':_0x42ade5['params']['id']}},_0xa82162={};_0xa82162['model']=_[_0x38dc('0x2e')](db[_0x38dc('0x3a')][_0x38dc('0x40')]);_0xa82162[_0x38dc('0x2d')]=_[_0x38dc('0x2e')](_0x42ade5[_0x38dc('0x2d')]);_0xa82162[_0x38dc('0x2f')]=_[_0x38dc('0x31')](_0xa82162[_0x38dc('0x2b')],_0xa82162[_0x38dc('0x2d')]);_0x3fdd1e['attributes']=_[_0x38dc('0x31')](_0xa82162[_0x38dc('0x2b')],qs[_0x38dc('0x32')](_0x42ade5[_0x38dc('0x2d')][_0x38dc('0x32')]));_0x3fdd1e[_0x38dc('0x30')]=_0x3fdd1e[_0x38dc('0x30')]['length']?_0x3fdd1e[_0x38dc('0x30')]:_0xa82162[_0x38dc('0x2b')];if(_0x42ade5[_0x38dc('0x2d')][_0x38dc('0x3b')]){_0x3fdd1e[_0x38dc('0x41')]=[{'all':!![]}];}_0x3fdd1e=_[_0x38dc('0x38')]({},_0x3fdd1e,_0x42ade5['options']);return db[_0x38dc('0x3a')][_0x38dc('0x42')](_0x3fdd1e)[_0x38dc('0x22')](handleEntityNotFound(_0x2837ce,null))['then'](respondWithResult(_0x2837ce,null))[_0x38dc('0x3e')](handleError(_0x2837ce,null));};exports['create']=function(_0x43e0a1,_0xeda797){return db[_0x38dc('0x3a')]['create'](_0x43e0a1[_0x38dc('0x43')],{})['then'](respondWithResult(_0xeda797,0xc9))[_0x38dc('0x3e')](handleError(_0xeda797,null));};exports[_0x38dc('0x20')]=function(_0x1d9077,_0x28866c){if(_0x1d9077[_0x38dc('0x43')]['id']){delete _0x1d9077[_0x38dc('0x43')]['id'];}return db[_0x38dc('0x3a')][_0x38dc('0x42')]({'where':{'id':_0x1d9077[_0x38dc('0x44')]['id']}})[_0x38dc('0x22')](handleEntityNotFound(_0x28866c,null))[_0x38dc('0x22')](saveUpdates(_0x1d9077['body'],null))[_0x38dc('0x22')](respondWithResult(_0x28866c,null))['catch'](handleError(_0x28866c,null));};exports['destroy']=function(_0x2aa7a1,_0x50bb1c){return db[_0x38dc('0x3a')][_0x38dc('0x42')]({'where':{'id':_0x2aa7a1[_0x38dc('0x44')]['id']}})[_0x38dc('0x22')](handleEntityNotFound(_0x50bb1c,null))[_0x38dc('0x22')](removeEntity(_0x50bb1c,null))['catch'](handleError(_0x50bb1c,null));};exports[_0x38dc('0x45')]=function(_0x2a4f3f,_0x304f79,_0x1183cd){var _0x41f3d0={};var _0x7945f9={};var _0x1b2159;var _0x4c96e1;return db[_0x38dc('0x3a')][_0x38dc('0x46')]({'where':{'id':_0x2a4f3f[_0x38dc('0x44')]['id']}})[_0x38dc('0x22')](handleEntityNotFound(_0x304f79,null))[_0x38dc('0x22')](function(_0x26e066){if(_0x26e066){_0x1b2159=_0x26e066;_0x7945f9[_0x38dc('0x2b')]=_[_0x38dc('0x2e')](db[_0x38dc('0x47')][_0x38dc('0x40')]);_0x7945f9[_0x38dc('0x2d')]=_[_0x38dc('0x2e')](_0x2a4f3f['query']);_0x7945f9[_0x38dc('0x2f')]=_[_0x38dc('0x31')](_0x7945f9[_0x38dc('0x2b')],_0x7945f9[_0x38dc('0x2d')]);_0x41f3d0['attributes']=_[_0x38dc('0x31')](_0x7945f9[_0x38dc('0x2b')],qs[_0x38dc('0x32')](_0x2a4f3f[_0x38dc('0x2d')][_0x38dc('0x32')]));_0x41f3d0[_0x38dc('0x30')]=_0x41f3d0[_0x38dc('0x30')][_0x38dc('0x48')]?_0x41f3d0[_0x38dc('0x30')]:_0x7945f9[_0x38dc('0x2b')];_0x41f3d0[_0x38dc('0x33')]=qs[_0x38dc('0x34')](_0x2a4f3f[_0x38dc('0x2d')]['sort']);_0x41f3d0[_0x38dc('0x36')]=qs['filters'](_['pick'](_0x2a4f3f[_0x38dc('0x2d')],_0x7945f9[_0x38dc('0x2f')]));if(_0x2a4f3f[_0x38dc('0x2d')]['filter']){_0x41f3d0[_0x38dc('0x36')]=_[_0x38dc('0x38')](_0x41f3d0['where'],{'$or':_[_0x38dc('0x2c')](_0x41f3d0[_0x38dc('0x30')],function(_0x422905){var _0x54518c={};_0x54518c[_0x422905]={'$like':'%'+_0x2a4f3f[_0x38dc('0x2d')][_0x38dc('0x35')]+'%'};return _0x54518c;})});}_0x41f3d0=_[_0x38dc('0x38')]({},_0x41f3d0,_0x2a4f3f[_0x38dc('0x39')]);return _0x1b2159[_0x38dc('0x45')](_0x41f3d0);}})['then'](function(_0x5422d0){if(_0x5422d0){_0x4c96e1=_0x5422d0[_0x38dc('0x48')];if(!_0x2a4f3f[_0x38dc('0x2d')]['hasOwnProperty']('nolimit')){_0x41f3d0[_0x38dc('0x1b')]=qs[_0x38dc('0x1b')](_0x2a4f3f['query'][_0x38dc('0x1b')]);_0x41f3d0[_0x38dc('0x1d')]=qs[_0x38dc('0x1d')](_0x2a4f3f[_0x38dc('0x2d')][_0x38dc('0x1d')]);}return _0x1b2159[_0x38dc('0x45')](_0x41f3d0);}})[_0x38dc('0x22')](function(_0x35cade){if(_0x35cade){return _0x35cade?{'count':_0x4c96e1,'rows':_0x35cade}:null;}})[_0x38dc('0x22')](respondWithResult(_0x304f79,null))[_0x38dc('0x3e')](handleError(_0x304f79,null));};exports['addConfiguration']=function(_0x5c2c9d,_0x5f3e33,_0x54abe9){if(_0x5c2c9d[_0x38dc('0x43')]['id']){delete _0x5c2c9d['body']['id'];}return db[_0x38dc('0x3a')][_0x38dc('0x46')]({'where':{'id':_0x5c2c9d[_0x38dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x5f3e33,null))[_0x38dc('0x22')](function(_0x3a365a){if(_0x3a365a){_0x5c2c9d['body'][_0x38dc('0x49')]=_0x3a365a['id'];_0x5c2c9d[_0x38dc('0x43')][_0x38dc('0x4a')]=integrations['getSubjects'](_0x5c2c9d[_0x38dc('0x43')][_0x38dc('0x4b')],_0x5c2c9d[_0x38dc('0x43')]['type']);_0x5c2c9d[_0x38dc('0x43')]['Descriptions']=integrations[_0x38dc('0x4c')](_0x5c2c9d[_0x38dc('0x43')][_0x38dc('0x4b')],_0x5c2c9d['body']['type']);return db[_0x38dc('0x47')]['create'](_0x5c2c9d[_0x38dc('0x43')],{'include':[{'model':db[_0x38dc('0x4d')],'as':'Subjects'},{'model':db[_0x38dc('0x4d')],'as':_0x38dc('0x4e')}]});}return null;})[_0x38dc('0x22')](respondWithResult(_0x5f3e33,null))[_0x38dc('0x3e')](handleError(_0x5f3e33,null));};exports[_0x38dc('0x4f')]=function(_0xc437e,_0x1f4d03,_0x204b98){var _0x3dc63c='';var _0x1dd605='';return db[_0x38dc('0x3a')][_0x38dc('0x46')]({'where':{'id':_0xc437e['params']['id']},'attributes':['id',_0x38dc('0x50'),_0x38dc('0x51'),_0x38dc('0x52')]})[_0x38dc('0x22')](handleEntityNotFound(_0x1f4d03,null))['then'](function(_0x4b6a42){if(_0x4b6a42){_0x1dd605=_0x4b6a42[_0x38dc('0x50')];_0x3dc63c=_0x4b6a42['remoteUri'];var _0x470c8f=_0x4b6a42[_0x38dc('0x51')]['slice'](-0x1);if(_0x470c8f==='/'){_0x3dc63c=_0x3dc63c[_0x38dc('0x53')](0x0,_0x3dc63c['lastIndexOf'](_0x470c8f));}return rp({'method':_0x38dc('0x54'),'uri':util[_0x38dc('0x55')](_0x38dc('0x56'),_0x3dc63c,_0x38dc('0x57')),'headers':{'Authorization':_0x38dc('0x58')+_0x4b6a42[_0x38dc('0x52')]},'json':!![]});}})[_0x38dc('0x22')](function(_0x43d636){if(_0x43d636){var _0x30f06e=_0x43d636[_0x38dc('0x59')];var _0x454339=![];var _0x4bd08c=null;for(_0x4bd08c=0x0;_0x4bd08c<_0x30f06e['length'];_0x4bd08c++){if(_0x30f06e[_0x4bd08c][_0x38dc('0x5a')]===_0x1dd605){_0x454339=!![];}}if(_0x454339){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x38dc('0x5b')});}}})[_0x38dc('0x22')](respondWithResult(_0x1f4d03,null))[_0x38dc('0x3e')](function(_0x4b8d13){var _0x551bff=_0xc437e[_0x38dc('0x2d')][_0x38dc('0x5c')]?0x1f4:_0x4b8d13[_0x38dc('0x5d')]||0x1f4;logger[_0x38dc('0x23')](_0x38dc('0x5e'),'getFields',_0x551bff,JSON[_0x38dc('0x5f')](_0x4b8d13));delete _0x4b8d13[_0x38dc('0x25')];if(_0x551bff===0x191){_0x551bff=0x190;}_0x1f4d03[_0x38dc('0x17')](_0x551bff)['send'](_0xc437e['query'][_0x38dc('0x5c')]?{'message':'Wrong\x20credentials','statusCode':_0x4b8d13['statusCode']}:_0x4b8d13);});}; \ No newline at end of file +var _0xd04e=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','create','body','find','getConfigurations','FreshsalesConfiguration','findOne','Subjects','getSubjects','channel','FreshsalesField','getFields','username','remoteUri','apiKey','slice','lastIndexOf','GET','format','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd04e,0xff));var _0xed04=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xd04e[_0x2261ce];return _0x524640;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed04('0x0'));var zipdir=require(_0xed04('0x1'));var jsonpatch=require(_0xed04('0x2'));var rp=require('request-promise');var moment=require(_0xed04('0x3'));var BPromise=require(_0xed04('0x4'));var Mustache=require(_0xed04('0x5'));var util=require(_0xed04('0x6'));var path=require(_0xed04('0x7'));var sox=require('sox');var csv=require(_0xed04('0x8'));var ejs=require(_0xed04('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed04('0xa'));var squel=require(_0xed04('0xb'));var crypto=require(_0xed04('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xed04('0xd'));var toCsv=require(_0xed04('0x8'));var querystring=require(_0xed04('0xe'));var Papa=require(_0xed04('0xf'));var Redis=require(_0xed04('0x10'));var authService=require(_0xed04('0x11'));var qs=require(_0xed04('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xed04('0x13'));var logger=require(_0xed04('0x14'))(_0xed04('0x15'));var utils=require(_0xed04('0x16'));var config=require(_0xed04('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xed04('0x18'))['db'];var integrations=require(_0xed04('0x19'));function respondWithStatusCode(_0x1b036e,_0x4e8333){_0x4e8333=_0x4e8333||0xcc;return function(_0x4a1abb){if(_0x4a1abb){return _0x1b036e['sendStatus'](_0x4e8333);}return _0x1b036e[_0xed04('0x1a')](_0x4e8333)['end']();};}function respondWithResult(_0x2471a7,_0x53c977){_0x53c977=_0x53c977||0xc8;return function(_0x37df3a){if(_0x37df3a){return _0x2471a7[_0xed04('0x1a')](_0x53c977)[_0xed04('0x1b')](_0x37df3a);}};}function respondWithFilteredResult(_0x14af8f,_0x5e9fbd){return function(_0x585ac0){if(_0x585ac0){var _0x196964=typeof _0x5e9fbd[_0xed04('0x1c')]===_0xed04('0x1d')&&typeof _0x5e9fbd[_0xed04('0x1e')]===_0xed04('0x1d');var _0x1575f7=_0x585ac0[_0xed04('0x1f')];var _0x529473=_0x196964?0x0:_0x5e9fbd['offset'];var _0x70a42c=_0x196964?_0x585ac0['count']:_0x5e9fbd['offset']+_0x5e9fbd[_0xed04('0x1e')];var _0x2bb087;if(_0x70a42c>=_0x1575f7){_0x70a42c=_0x1575f7;_0x2bb087=0xc8;}else{_0x2bb087=0xce;}_0x14af8f[_0xed04('0x1a')](_0x2bb087);return _0x14af8f['set'](_0xed04('0x20'),_0x529473+'-'+_0x70a42c+'/'+_0x1575f7)[_0xed04('0x1b')](_0x585ac0);}return null;};}function patchUpdates(_0x231c43){return function(_0x14e8e8){try{jsonpatch[_0xed04('0x21')](_0x14e8e8,_0x231c43,!![]);}catch(_0x5789c8){return BPromise[_0xed04('0x22')](_0x5789c8);}return _0x14e8e8[_0xed04('0x23')]();};}function saveUpdates(_0x32ed5a,_0x1206e3){return function(_0x1225ea){if(_0x1225ea){return _0x1225ea[_0xed04('0x24')](_0x32ed5a)['then'](function(_0x2ee239){return _0x2ee239;});}return null;};}function removeEntity(_0x33bbc5,_0x2a38ed){return function(_0x26a7ca){if(_0x26a7ca){return _0x26a7ca[_0xed04('0x25')]()[_0xed04('0x26')](function(){_0x33bbc5[_0xed04('0x1a')](0xcc)[_0xed04('0x27')]();});}};}function handleEntityNotFound(_0x178206,_0x3e28db){return function(_0x1550c0){if(!_0x1550c0){_0x178206[_0xed04('0x28')](0x194);}return _0x1550c0;};}function handleError(_0x488a8a,_0x449132){_0x449132=_0x449132||0x1f4;return function(_0x266ce2){logger[_0xed04('0x29')](_0x266ce2[_0xed04('0x2a')]);if(_0x266ce2[_0xed04('0x2b')]){delete _0x266ce2[_0xed04('0x2b')];}_0x488a8a[_0xed04('0x1a')](_0x449132)[_0xed04('0x2c')](_0x266ce2);};}exports[_0xed04('0x2d')]=function(_0x2467a1,_0x1c7622){var _0xd7a217={},_0x104e0={},_0x2392f5={'count':0x0,'rows':[]};var _0x564d64=_[_0xed04('0x2e')](db[_0xed04('0x2f')][_0xed04('0x30')],function(_0x6134c6){return{'name':_0x6134c6[_0xed04('0x31')],'type':_0x6134c6[_0xed04('0x32')][_0xed04('0x33')]};});_0x104e0[_0xed04('0x34')]=_['map'](_0x564d64,_0xed04('0x2b'));_0x104e0[_0xed04('0x35')]=_[_0xed04('0x36')](_0x2467a1[_0xed04('0x35')]);_0x104e0[_0xed04('0x37')]=_[_0xed04('0x38')](_0x104e0[_0xed04('0x34')],_0x104e0[_0xed04('0x35')]);_0xd7a217['attributes']=_[_0xed04('0x38')](_0x104e0[_0xed04('0x34')],qs[_0xed04('0x39')](_0x2467a1[_0xed04('0x35')][_0xed04('0x39')]));_0xd7a217[_0xed04('0x3a')]=_0xd7a217[_0xed04('0x3a')][_0xed04('0x3b')]?_0xd7a217[_0xed04('0x3a')]:_0x104e0[_0xed04('0x34')];if(!_0x2467a1[_0xed04('0x35')][_0xed04('0x3c')](_0xed04('0x3d'))){_0xd7a217[_0xed04('0x1e')]=qs[_0xed04('0x1e')](_0x2467a1[_0xed04('0x35')]['limit']);_0xd7a217[_0xed04('0x1c')]=qs['offset'](_0x2467a1[_0xed04('0x35')]['offset']);}_0xd7a217[_0xed04('0x3e')]=qs[_0xed04('0x3f')](_0x2467a1[_0xed04('0x35')][_0xed04('0x3f')]);_0xd7a217[_0xed04('0x40')]=qs[_0xed04('0x37')](_[_0xed04('0x41')](_0x2467a1[_0xed04('0x35')],_0x104e0[_0xed04('0x37')]),_0x564d64);if(_0x2467a1['query'][_0xed04('0x42')]){_0xd7a217[_0xed04('0x40')]=_[_0xed04('0x43')](_0xd7a217[_0xed04('0x40')],{'$or':_[_0xed04('0x2e')](_0x564d64,function(_0x649766){if(_0x649766[_0xed04('0x32')]!==_0xed04('0x44')){var _0x219f9f={};_0x219f9f[_0x649766[_0xed04('0x2b')]]={'$like':'%'+_0x2467a1[_0xed04('0x35')][_0xed04('0x42')]+'%'};return _0x219f9f;}})});}_0xd7a217=_[_0xed04('0x43')]({},_0xd7a217,_0x2467a1['options']);var _0x31dab6={'where':_0xd7a217[_0xed04('0x40')]};return db[_0xed04('0x2f')]['count'](_0x31dab6)['then'](function(_0x577f98){_0x2392f5['count']=_0x577f98;if(_0x2467a1[_0xed04('0x35')][_0xed04('0x45')]){_0xd7a217[_0xed04('0x46')]=[{'all':!![]}];}return db[_0xed04('0x2f')][_0xed04('0x47')](_0xd7a217);})['then'](function(_0x502935){_0x2392f5[_0xed04('0x48')]=_0x502935;return _0x2392f5;})[_0xed04('0x26')](respondWithFilteredResult(_0x1c7622,_0xd7a217))[_0xed04('0x49')](handleError(_0x1c7622,null));};exports['show']=function(_0x4c46d3,_0x2cf7e2){var _0x1314d6={'raw':![],'where':{'id':_0x4c46d3[_0xed04('0x4a')]['id']}},_0x14025f={};_0x14025f[_0xed04('0x34')]=_[_0xed04('0x36')](db['FreshsalesAccount'][_0xed04('0x30')]);_0x14025f[_0xed04('0x35')]=_[_0xed04('0x36')](_0x4c46d3[_0xed04('0x35')]);_0x14025f[_0xed04('0x37')]=_['intersection'](_0x14025f[_0xed04('0x34')],_0x14025f[_0xed04('0x35')]);_0x1314d6[_0xed04('0x3a')]=_[_0xed04('0x38')](_0x14025f[_0xed04('0x34')],qs[_0xed04('0x39')](_0x4c46d3[_0xed04('0x35')]['fields']));_0x1314d6[_0xed04('0x3a')]=_0x1314d6['attributes'][_0xed04('0x3b')]?_0x1314d6[_0xed04('0x3a')]:_0x14025f[_0xed04('0x34')];if(_0x4c46d3['query'][_0xed04('0x45')]){_0x1314d6['include']=[{'all':!![]}];}_0x1314d6=_['merge']({},_0x1314d6,_0x4c46d3[_0xed04('0x4b')]);return db[_0xed04('0x2f')]['find'](_0x1314d6)[_0xed04('0x26')](handleEntityNotFound(_0x2cf7e2,null))[_0xed04('0x26')](respondWithResult(_0x2cf7e2,null))['catch'](handleError(_0x2cf7e2,null));};exports['create']=function(_0x69602f,_0x81500f){return db[_0xed04('0x2f')][_0xed04('0x4c')](_0x69602f[_0xed04('0x4d')],{})[_0xed04('0x26')](respondWithResult(_0x81500f,0xc9))['catch'](handleError(_0x81500f,null));};exports[_0xed04('0x24')]=function(_0x4fe28b,_0x48a5ba){if(_0x4fe28b[_0xed04('0x4d')]['id']){delete _0x4fe28b['body']['id'];}return db[_0xed04('0x2f')][_0xed04('0x4e')]({'where':{'id':_0x4fe28b['params']['id']}})['then'](handleEntityNotFound(_0x48a5ba,null))['then'](saveUpdates(_0x4fe28b[_0xed04('0x4d')],null))[_0xed04('0x26')](respondWithResult(_0x48a5ba,null))[_0xed04('0x49')](handleError(_0x48a5ba,null));};exports[_0xed04('0x25')]=function(_0x1e43a3,_0x4997c9){return db['FreshsalesAccount'][_0xed04('0x4e')]({'where':{'id':_0x1e43a3['params']['id']}})[_0xed04('0x26')](handleEntityNotFound(_0x4997c9,null))[_0xed04('0x26')](removeEntity(_0x4997c9,null))[_0xed04('0x49')](handleError(_0x4997c9,null));};exports[_0xed04('0x4f')]=function(_0x29daad,_0x346f,_0x403faa){var _0x229d2f={};var _0x15d55={};var _0x786842;var _0x12c775;return db['FreshsalesAccount']['findOne']({'where':{'id':_0x29daad['params']['id']}})[_0xed04('0x26')](handleEntityNotFound(_0x346f,null))[_0xed04('0x26')](function(_0x34f03f){if(_0x34f03f){_0x786842=_0x34f03f;_0x15d55[_0xed04('0x34')]=_[_0xed04('0x36')](db[_0xed04('0x50')][_0xed04('0x30')]);_0x15d55['query']=_[_0xed04('0x36')](_0x29daad[_0xed04('0x35')]);_0x15d55[_0xed04('0x37')]=_[_0xed04('0x38')](_0x15d55['model'],_0x15d55['query']);_0x229d2f[_0xed04('0x3a')]=_[_0xed04('0x38')](_0x15d55[_0xed04('0x34')],qs[_0xed04('0x39')](_0x29daad[_0xed04('0x35')]['fields']));_0x229d2f[_0xed04('0x3a')]=_0x229d2f[_0xed04('0x3a')][_0xed04('0x3b')]?_0x229d2f[_0xed04('0x3a')]:_0x15d55[_0xed04('0x34')];_0x229d2f[_0xed04('0x3e')]=qs[_0xed04('0x3f')](_0x29daad['query'][_0xed04('0x3f')]);_0x229d2f[_0xed04('0x40')]=qs[_0xed04('0x37')](_[_0xed04('0x41')](_0x29daad[_0xed04('0x35')],_0x15d55[_0xed04('0x37')]));if(_0x29daad[_0xed04('0x35')][_0xed04('0x42')]){_0x229d2f[_0xed04('0x40')]=_['merge'](_0x229d2f[_0xed04('0x40')],{'$or':_['map'](_0x229d2f[_0xed04('0x3a')],function(_0x5d75e0){var _0x2fa210={};_0x2fa210[_0x5d75e0]={'$like':'%'+_0x29daad[_0xed04('0x35')][_0xed04('0x42')]+'%'};return _0x2fa210;})});}_0x229d2f=_['merge']({},_0x229d2f,_0x29daad[_0xed04('0x4b')]);return _0x786842['getConfigurations'](_0x229d2f);}})[_0xed04('0x26')](function(_0x1e468d){if(_0x1e468d){_0x12c775=_0x1e468d[_0xed04('0x3b')];if(!_0x29daad[_0xed04('0x35')]['hasOwnProperty'](_0xed04('0x3d'))){_0x229d2f[_0xed04('0x1e')]=qs[_0xed04('0x1e')](_0x29daad[_0xed04('0x35')][_0xed04('0x1e')]);_0x229d2f[_0xed04('0x1c')]=qs[_0xed04('0x1c')](_0x29daad[_0xed04('0x35')][_0xed04('0x1c')]);}return _0x786842[_0xed04('0x4f')](_0x229d2f);}})['then'](function(_0x3d29bc){if(_0x3d29bc){return _0x3d29bc?{'count':_0x12c775,'rows':_0x3d29bc}:null;}})[_0xed04('0x26')](respondWithResult(_0x346f,null))[_0xed04('0x49')](handleError(_0x346f,null));};exports['addConfiguration']=function(_0x442cfc,_0xb1ca8f,_0x4db3c4){if(_0x442cfc[_0xed04('0x4d')]['id']){delete _0x442cfc[_0xed04('0x4d')]['id'];}return db[_0xed04('0x2f')][_0xed04('0x51')]({'where':{'id':_0x442cfc['params']['id']}})['then'](handleEntityNotFound(_0xb1ca8f,null))[_0xed04('0x26')](function(_0x57d840){if(_0x57d840){_0x442cfc[_0xed04('0x4d')]['AccountId']=_0x57d840['id'];_0x442cfc[_0xed04('0x4d')][_0xed04('0x52')]=integrations[_0xed04('0x53')](_0x442cfc[_0xed04('0x4d')][_0xed04('0x54')],_0x442cfc[_0xed04('0x4d')]['type']);_0x442cfc[_0xed04('0x4d')]['Descriptions']=integrations['getDescriptions'](_0x442cfc['body']['channel'],_0x442cfc['body'][_0xed04('0x32')]);return db['FreshsalesConfiguration'][_0xed04('0x4c')](_0x442cfc['body'],{'include':[{'model':db[_0xed04('0x55')],'as':_0xed04('0x52')},{'model':db[_0xed04('0x55')],'as':'Descriptions'}]});}return null;})[_0xed04('0x26')](respondWithResult(_0xb1ca8f,null))[_0xed04('0x49')](handleError(_0xb1ca8f,null));};exports[_0xed04('0x56')]=function(_0x14ea6d,_0x420b85,_0xa05cc7){var _0x3aa732='';var _0x4ae96b='';return db[_0xed04('0x2f')][_0xed04('0x51')]({'where':{'id':_0x14ea6d[_0xed04('0x4a')]['id']},'attributes':['id',_0xed04('0x57'),_0xed04('0x58'),_0xed04('0x59')]})[_0xed04('0x26')](handleEntityNotFound(_0x420b85,null))[_0xed04('0x26')](function(_0x4e2db0){if(_0x4e2db0){_0x4ae96b=_0x4e2db0['username'];_0x3aa732=_0x4e2db0[_0xed04('0x58')];var _0x4e0164=_0x4e2db0[_0xed04('0x58')][_0xed04('0x5a')](-0x1);if(_0x4e0164==='/'){_0x3aa732=_0x3aa732['substring'](0x0,_0x3aa732[_0xed04('0x5b')](_0x4e0164));}return rp({'method':_0xed04('0x5c'),'uri':util[_0xed04('0x5d')]('%s%s',_0x3aa732,_0xed04('0x5e')),'headers':{'Authorization':_0xed04('0x5f')+_0x4e2db0[_0xed04('0x59')]},'json':!![]});}})[_0xed04('0x26')](function(_0x500bc0){if(_0x500bc0){var _0x409f80=_0x500bc0[_0xed04('0x60')];var _0x277b2a=![];var _0x5ce07a=null;for(_0x5ce07a=0x0;_0x5ce07a<_0x409f80['length'];_0x5ce07a++){if(_0x409f80[_0x5ce07a]['email']===_0x4ae96b){_0x277b2a=!![];}}if(_0x277b2a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xed04('0x61')});}}})[_0xed04('0x26')](respondWithResult(_0x420b85,null))[_0xed04('0x49')](function(_0x4ddf6c){var _0xc915cf=_0x14ea6d[_0xed04('0x35')][_0xed04('0x62')]?0x1f4:_0x4ddf6c['statusCode']||0x1f4;logger[_0xed04('0x29')](_0xed04('0x63'),_0xed04('0x56'),_0xc915cf,JSON[_0xed04('0x64')](_0x4ddf6c));delete _0x4ddf6c[_0xed04('0x2b')];if(_0xc915cf===0x191){_0xc915cf=0x190;}_0x420b85[_0xed04('0x1a')](_0xc915cf)[_0xed04('0x2c')](_0x14ea6d[_0xed04('0x35')][_0xed04('0x62')]?{'message':_0xed04('0x65'),'statusCode':_0x4ddf6c[_0xed04('0x66')]}:_0x4ddf6c);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ef6dfbe..5361433 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 _0xc1c6=['rimraf','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0xae8cfc,_0xff162a){var _0x535f0e=function(_0x15fce3){while(--_0x15fce3){_0xae8cfc['push'](_0xae8cfc['shift']());}};_0x535f0e(++_0xff162a);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x21da14,_0x524ea6){_0x21da14=_0x21da14-0x0;var _0x4acff1=_0xc1c6[_0x21da14];return _0x4acff1;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x6c1c('0x7'));module['exports']=function(_0x50c1bb,_0x582bec){return _0x50c1bb[_0x6c1c('0x8')](_0x6c1c('0x9'),attributes,{'tableName':_0x6c1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3da=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x602dda,_0x96f3c){var _0x3a14ac=function(_0x269fd5){while(--_0x269fd5){_0x602dda['push'](_0x602dda['shift']());}};_0x3a14ac(++_0x96f3c);}(_0xe3da,0x1cd));var _0xae3d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe3da[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var logger=require(_0xae3d('0x2'))(_0xae3d('0x3'));var moment=require(_0xae3d('0x4'));var BPromise=require(_0xae3d('0x5'));var rp=require(_0xae3d('0x6'));var fs=require('fs');var path=require(_0xae3d('0x7'));var rimraf=require(_0xae3d('0x8'));var config=require(_0xae3d('0x9'));var attributes=require(_0xae3d('0xa'));var integrations=require(_0xae3d('0xb'));module[_0xae3d('0xc')]=function(_0xa54808,_0x476579){return _0xa54808[_0xae3d('0xd')]('FreshsalesAccount',attributes,{'tableName':_0xae3d('0xe'),'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 dc22f94..8d78039 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 _0x77d4=['util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowFreshsalesAccount','find'];(function(_0x35e882,_0x2aef74){var _0x1e8696=function(_0x4e58ab){while(--_0x4e58ab){_0x35e882['push'](_0x35e882['shift']());}};_0x1e8696(++_0x2aef74);}(_0x77d4,0x108));var _0x477d=function(_0x5e8eac,_0x1ea982){_0x5e8eac=_0x5e8eac-0x0;var _0xf686e1=_0x77d4[_0x5e8eac];return _0xf686e1;};'use strict';var _=require('lodash');var util=require(_0x477d('0x0'));var moment=require('moment');var BPromise=require(_0x477d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x477d('0x2'));var db=require(_0x477d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x477d('0x4'));var config=require(_0x477d('0x5'));var jayson=require(_0x477d('0x6'));var client=jayson[_0x477d('0x7')][_0x477d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x45ca2d,_0x5153df,_0x4f4fb4){return new BPromise(function(_0x2dd5d2,_0x579859){return client['request'](_0x45ca2d,_0x4f4fb4)[_0x477d('0x9')](function(_0x29f11b){logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));logger['debug'](_0x477d('0xd'),_0x5153df,'request\x20sent',JSON[_0x477d('0xe')](_0x29f11b));if(_0x29f11b[_0x477d('0xf')]){if(_0x29f11b['error'][_0x477d('0x10')]===0x1f4){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29f11b['error'][_0x477d('0x11')]);return _0x579859(_0x29f11b[_0x477d('0xf')]['message']);}logger[_0x477d('0xf')](_0x477d('0xb'),_0x5153df,_0x29f11b['error']['message']);return _0x2dd5d2(_0x29f11b[_0x477d('0xf')]['message']);}else{logger[_0x477d('0xa')](_0x477d('0xb'),_0x5153df,_0x477d('0xc'));_0x2dd5d2(_0x29f11b['result'][_0x477d('0x11')]);}})[_0x477d('0x12')](function(_0x29c6f8){logger[_0x477d('0xf')]('FreshsalesAccount,\x20%s,\x20%s',_0x5153df,_0x29c6f8);_0x579859(_0x29c6f8);});});}exports[_0x477d('0x13')]=function(_0x5d5553){var _0x367965=this;return new Promise(function(_0x1399d7,_0x159beb){return db[_0x477d('0x14')][_0x477d('0x15')]({'raw':_0x5d5553[_0x477d('0x16')]?_0x5d5553['options'][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x5d5553['options']?_0x5d5553[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x19')]||null:null,'limit':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1a')]||null:null,'include':_0x5d5553[_0x477d('0x16')]?_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x5d5553[_0x477d('0x16')][_0x477d('0x1b')],function(_0x4e6a44){return{'model':db[_0x4e6a44[_0x477d('0x1d')]],'as':_0x4e6a44['as'],'attributes':_0x4e6a44['attributes'],'include':_0x4e6a44[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x4e6a44[_0x477d('0x1b')],function(_0x2287b4){return{'model':db[_0x2287b4['model']],'as':_0x2287b4['as'],'attributes':_0x2287b4[_0x477d('0x19')],'include':_0x2287b4[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x2287b4['include'],function(_0x585648){return{'model':db[_0x585648[_0x477d('0x1d')]],'as':_0x585648['as'],'attributes':_0x585648[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x5c8ef1){logger[_0x477d('0xa')](_0x477d('0x13'),_0x5d5553);logger[_0x477d('0x1e')](_0x477d('0x13'),_0x5d5553,JSON[_0x477d('0xe')](_0x5c8ef1));_0x1399d7(_0x5c8ef1);})['catch'](function(_0x2fc959){logger[_0x477d('0xf')](_0x477d('0x13'),_0x2fc959[_0x477d('0x11')],_0x5d5553);_0x159beb(_0x367965[_0x477d('0xf')](0x1f4,_0x2fc959[_0x477d('0x11')]));});});};exports[_0x477d('0x1f')]=function(_0x98b5d9){var _0x204541=this;return new Promise(function(_0x8fe6c4,_0x41b790){return db[_0x477d('0x14')][_0x477d('0x20')]({'raw':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x17')]===undefined?!![]:![]:!![],'where':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9[_0x477d('0x16')][_0x477d('0x18')]||null:null,'attributes':_0x98b5d9[_0x477d('0x16')]?_0x98b5d9['options'][_0x477d('0x19')]||null:null,'include':_0x98b5d9['options']?_0x98b5d9[_0x477d('0x16')][_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x98b5d9['options'][_0x477d('0x1b')],function(_0x1201a9){return{'model':db[_0x1201a9[_0x477d('0x1d')]],'as':_0x1201a9['as'],'attributes':_0x1201a9[_0x477d('0x19')],'include':_0x1201a9[_0x477d('0x1b')]?_[_0x477d('0x1c')](_0x1201a9[_0x477d('0x1b')],function(_0xf84c4c){return{'model':db[_0xf84c4c[_0x477d('0x1d')]],'as':_0xf84c4c['as'],'attributes':_0xf84c4c[_0x477d('0x19')],'include':_0xf84c4c['include']?_[_0x477d('0x1c')](_0xf84c4c[_0x477d('0x1b')],function(_0xb41cd8){return{'model':db[_0xb41cd8['model']],'as':_0xb41cd8['as'],'attributes':_0xb41cd8[_0x477d('0x19')]};}):[]};}):[]};}):[]:[]})[_0x477d('0x9')](function(_0x1b0410){logger['info']('ShowFreshsalesAccount',_0x98b5d9);logger[_0x477d('0x1e')](_0x477d('0x1f'),_0x98b5d9,JSON[_0x477d('0xe')](_0x1b0410));_0x8fe6c4(_0x1b0410);})[_0x477d('0x12')](function(_0x1c0d86){logger['error'](_0x477d('0x1f'),_0x1c0d86['message'],_0x98b5d9);_0x41b790(_0x204541[_0x477d('0xf')](0x1f4,_0x1c0d86[_0x477d('0x11')]));});});}; \ No newline at end of file +var _0xa456=['message','result','GetFreshsalesAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x4b81ad,_0x5b2f7a){var _0x3d2bea=function(_0x20c4d3){while(--_0x20c4d3){_0x4b81ad['push'](_0x4b81ad['shift']());}};_0x3d2bea(++_0x5b2f7a);}(_0xa456,0x142));var _0x6a45=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xa456[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x6a45('0x0'));var util=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));var BPromise=require(_0x6a45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a45('0x4'));var db=require(_0x6a45('0x5'))['db'];var utils=require(_0x6a45('0x6'));var logger=require('../../config/logger')(_0x6a45('0x7'));var config=require(_0x6a45('0x8'));var jayson=require(_0x6a45('0x9'));var client=jayson[_0x6a45('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cf8d,_0x26bfc0,_0x214514){return new BPromise(function(_0x19e67c,_0x3deb09){return client['request'](_0x25cf8d,_0x214514)[_0x6a45('0xb')](function(_0x517040){logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));logger[_0x6a45('0xf')](_0x6a45('0x10'),_0x26bfc0,'request\x20sent',JSON['stringify'](_0x517040));if(_0x517040[_0x6a45('0x11')]){if(_0x517040[_0x6a45('0x11')]['code']===0x1f4){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);return _0x3deb09(_0x517040[_0x6a45('0x11')][_0x6a45('0x12')]);}logger[_0x6a45('0x11')]('FreshsalesAccount,\x20%s,\x20%s',_0x26bfc0,_0x517040['error'][_0x6a45('0x12')]);return _0x19e67c(_0x517040[_0x6a45('0x11')]['message']);}else{logger[_0x6a45('0xc')](_0x6a45('0xd'),_0x26bfc0,_0x6a45('0xe'));_0x19e67c(_0x517040[_0x6a45('0x13')]['message']);}})['catch'](function(_0x49023f){logger[_0x6a45('0x11')](_0x6a45('0xd'),_0x26bfc0,_0x49023f);_0x3deb09(_0x49023f);});});}exports[_0x6a45('0x14')]=function(_0x52a055){var _0x379c22=this;return new Promise(function(_0x102981,_0x3439c8){return db['FreshsalesAccount']['findAll']({'raw':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x17')]||null:null,'attributes':_0x52a055['options']?_0x52a055[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'limit':_0x52a055[_0x6a45('0x15')]?_0x52a055[_0x6a45('0x15')][_0x6a45('0x19')]||null:null,'include':_0x52a055['options']?_0x52a055['options'][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x52a055[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x25a380){return{'model':db[_0x25a380[_0x6a45('0x1c')]],'as':_0x25a380['as'],'attributes':_0x25a380[_0x6a45('0x18')],'include':_0x25a380[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x25a380[_0x6a45('0x1a')],function(_0x1310d7){return{'model':db[_0x1310d7[_0x6a45('0x1c')]],'as':_0x1310d7['as'],'attributes':_0x1310d7['attributes'],'include':_0x1310d7[_0x6a45('0x1a')]?_['map'](_0x1310d7[_0x6a45('0x1a')],function(_0x25467d){return{'model':db[_0x25467d[_0x6a45('0x1c')]],'as':_0x25467d['as'],'attributes':_0x25467d[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x526062){logger[_0x6a45('0xc')](_0x6a45('0x14'),_0x52a055);logger[_0x6a45('0xf')](_0x6a45('0x14'),_0x52a055,JSON[_0x6a45('0x1d')](_0x526062));_0x102981(_0x526062);})[_0x6a45('0x1e')](function(_0x3fac9b){logger[_0x6a45('0x11')]('GetFreshsalesAccount',_0x3fac9b[_0x6a45('0x12')],_0x52a055);_0x3439c8(_0x379c22[_0x6a45('0x11')](0x1f4,_0x3fac9b[_0x6a45('0x12')]));});});};exports[_0x6a45('0x1f')]=function(_0x3b07a1){var _0x5dc288=this;return new Promise(function(_0x1f95d4,_0x1f96bf){return db[_0x6a45('0x20')][_0x6a45('0x21')]({'raw':_0x3b07a1['options']?_0x3b07a1['options'][_0x6a45('0x16')]===undefined?!![]:![]:!![],'where':_0x3b07a1['options']?_0x3b07a1[_0x6a45('0x15')]['where']||null:null,'attributes':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x18')]||null:null,'include':_0x3b07a1[_0x6a45('0x15')]?_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x3b07a1[_0x6a45('0x15')][_0x6a45('0x1a')],function(_0x36f4a4){return{'model':db[_0x36f4a4[_0x6a45('0x1c')]],'as':_0x36f4a4['as'],'attributes':_0x36f4a4[_0x6a45('0x18')],'include':_0x36f4a4[_0x6a45('0x1a')]?_['map'](_0x36f4a4[_0x6a45('0x1a')],function(_0x4ae2ac){return{'model':db[_0x4ae2ac[_0x6a45('0x1c')]],'as':_0x4ae2ac['as'],'attributes':_0x4ae2ac[_0x6a45('0x18')],'include':_0x4ae2ac[_0x6a45('0x1a')]?_[_0x6a45('0x1b')](_0x4ae2ac[_0x6a45('0x1a')],function(_0x2199c1){return{'model':db[_0x2199c1['model']],'as':_0x2199c1['as'],'attributes':_0x2199c1[_0x6a45('0x18')]};}):[]};}):[]};}):[]:[]})[_0x6a45('0xb')](function(_0x2b75f6){logger[_0x6a45('0xc')](_0x6a45('0x1f'),_0x3b07a1);logger[_0x6a45('0xf')]('ShowFreshsalesAccount',_0x3b07a1,JSON[_0x6a45('0x1d')](_0x2b75f6));_0x1f95d4(_0x2b75f6);})[_0x6a45('0x1e')](function(_0x5c76bd){logger[_0x6a45('0x11')](_0x6a45('0x1f'),_0x5c76bd[_0x6a45('0x12')],_0x3b07a1);_0x1f96bf(_0x5dc288[_0x6a45('0x11')](0x1f4,_0x5c76bd[_0x6a45('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 4d0bae5..eab424b 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 _0xe57c=['./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','post','create','put','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x4a1ec0,_0x26287b){var _0x49ab91=function(_0x206584){while(--_0x206584){_0x4a1ec0['push'](_0x4a1ec0['shift']());}};_0x49ab91(++_0x26287b);}(_0xe57c,0x1c7));var _0xce57=function(_0x3a0e08,_0x20a614){_0x3a0e08=_0x3a0e08-0x0;var _0xee94d3=_0xe57c[_0x3a0e08];return _0xee94d3;};'use strict';var multer=require('multer');var util=require(_0xce57('0x0'));var path=require(_0xce57('0x1'));var timeout=require(_0xce57('0x2'));var express=require(_0xce57('0x3'));var router=express[_0xce57('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xce57('0x5'));var config=require(_0xce57('0x6'));var controller=require(_0xce57('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xce57('0x8')]);router[_0xce57('0x9')](_0xce57('0xa'),auth[_0xce57('0xb')](),controller['show']);router[_0xce57('0x9')](_0xce57('0xc'),auth[_0xce57('0xb')](),controller[_0xce57('0xd')]);router['get'](_0xce57('0xe'),auth[_0xce57('0xb')](),controller[_0xce57('0xf')]);router['get'](_0xce57('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0xce57('0x11')]('/',auth[_0xce57('0xb')](),controller[_0xce57('0x12')]);router[_0xce57('0x13')](_0xce57('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xce57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xce57('0x14')]=router; \ No newline at end of file +var _0xfeaa=['update','delete','exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','getSubjects','getDescriptions','getFields','post','put','/:id'];(function(_0x43f084,_0xb48804){var _0x2a6dde=function(_0x1fab7f){while(--_0x1fab7f){_0x43f084['push'](_0x43f084['shift']());}};_0x2a6dde(++_0xb48804);}(_0xfeaa,0x1a1));var _0xafea=function(_0x27e330,_0x4b45ca){_0x27e330=_0x27e330-0x0;var _0x3da301=_0xfeaa[_0x27e330];return _0x3da301;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xafea('0x0'));var express=require('express');var router=express[_0xafea('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xafea('0x2'));var interaction=require(_0xafea('0x3'));var config=require(_0xafea('0x4'));var controller=require(_0xafea('0x5'));router[_0xafea('0x6')]('/',auth[_0xafea('0x7')](),controller[_0xafea('0x8')]);router[_0xafea('0x6')]('/:id',auth[_0xafea('0x7')](),controller['show']);router[_0xafea('0x6')]('/:id/subjects',auth[_0xafea('0x7')](),controller[_0xafea('0x9')]);router['get']('/:id/descriptions',auth['isAuthenticated'](),controller[_0xafea('0xa')]);router[_0xafea('0x6')]('/:id/fields',auth[_0xafea('0x7')](),controller[_0xafea('0xb')]);router[_0xafea('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xafea('0xd')](_0xafea('0xe'),auth[_0xafea('0x7')](),controller[_0xafea('0xf')]);router[_0xafea('0x10')](_0xafea('0xe'),auth[_0xafea('0x7')](),controller['destroy']);module[_0xafea('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 4a9b5e0..23a3c9b 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 _0x4f00=['sequelize','exports'];(function(_0x27e789,_0x228245){var _0x27532f=function(_0x2f1edc){while(--_0x2f1edc){_0x27e789['push'](_0x27e789['shift']());}};_0x27532f(++_0x228245);}(_0x4f00,0x70));var _0x04f0=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x4f00[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require(_0x04f0('0x0'));module[_0x04f0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x18fe=['exports','sequelize'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x18fe,0x181));var _0xe18f=function(_0x5d728f,_0xfbad5f){_0x5d728f=_0x5d728f-0x0;var _0x440b1a=_0x18fe[_0x5d728f];return _0x440b1a;};'use strict';var Sequelize=require(_0xe18f('0x0'));module[_0xe18f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index ce0b4d7..4e43ee0 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 _0x6252=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','FreshsalesConfiguration','includeAll','include','findAll','catch','show','keys','options','find','create','update','body','getSubjects','findOne','params','FreshsalesField','pick','nolimit','getDescriptions','hasOwnProperty','getFields','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x3c5ad6,_0x47b7bf){var _0x3154f2=function(_0x3a24de){while(--_0x3a24de){_0x3c5ad6['push'](_0x3c5ad6['shift']());}};_0x3154f2(++_0x47b7bf);}(_0x6252,0x15a));var _0x2625=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x6252[_0x2080a3];return _0x8d7d17;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2625('0x0'));var zipdir=require(_0x2625('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x2625('0x2'));var BPromise=require(_0x2625('0x3'));var Mustache=require(_0x2625('0x4'));var util=require(_0x2625('0x5'));var path=require('path');var sox=require(_0x2625('0x6'));var csv=require(_0x2625('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2625('0x8'));var _=require('lodash');var squel=require(_0x2625('0x9'));var crypto=require(_0x2625('0xa'));var jsforce=require(_0x2625('0xb'));var deskjs=require(_0x2625('0xc'));var toCsv=require('to-csv');var querystring=require(_0x2625('0xd'));var Papa=require('papaparse');var Redis=require(_0x2625('0xe'));var authService=require(_0x2625('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2625('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2625('0x11'))('api');var utils=require(_0x2625('0x12'));var config=require(_0x2625('0x13'));var licenseUtil=require(_0x2625('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xac6755,_0x101cfc){_0x101cfc=_0x101cfc||0xcc;return function(_0x5b1d47){if(_0x5b1d47){return _0xac6755[_0x2625('0x15')](_0x101cfc);}return _0xac6755[_0x2625('0x16')](_0x101cfc)[_0x2625('0x17')]();};}function respondWithResult(_0x59bbdd,_0xf71a11){_0xf71a11=_0xf71a11||0xc8;return function(_0x5e6ad3){if(_0x5e6ad3){return _0x59bbdd[_0x2625('0x16')](_0xf71a11)[_0x2625('0x18')](_0x5e6ad3);}};}function respondWithFilteredResult(_0x2d79e8,_0x4d7e87){return function(_0x444777){if(_0x444777){var _0x561bde=typeof _0x4d7e87[_0x2625('0x19')]==='undefined'&&typeof _0x4d7e87[_0x2625('0x1a')]===_0x2625('0x1b');var _0x5607a5=_0x444777[_0x2625('0x1c')];var _0x28f810=_0x561bde?0x0:_0x4d7e87[_0x2625('0x19')];var _0x1e008b=_0x561bde?_0x444777[_0x2625('0x1c')]:_0x4d7e87[_0x2625('0x19')]+_0x4d7e87['limit'];var _0x6aabff;if(_0x1e008b>=_0x5607a5){_0x1e008b=_0x5607a5;_0x6aabff=0xc8;}else{_0x6aabff=0xce;}_0x2d79e8[_0x2625('0x16')](_0x6aabff);return _0x2d79e8['set'](_0x2625('0x1d'),_0x28f810+'-'+_0x1e008b+'/'+_0x5607a5)[_0x2625('0x18')](_0x444777);}return null;};}function patchUpdates(_0x1b5c22){return function(_0x3153a){try{jsonpatch[_0x2625('0x1e')](_0x3153a,_0x1b5c22,!![]);}catch(_0x22f63a){return BPromise['reject'](_0x22f63a);}return _0x3153a[_0x2625('0x1f')]();};}function saveUpdates(_0x19bdc2,_0x2a334b){return function(_0x566bf5){if(_0x566bf5){return _0x566bf5['update'](_0x19bdc2)[_0x2625('0x20')](function(_0x2f6f7f){return _0x2f6f7f;});}return null;};}function removeEntity(_0x23f35c,_0x456bc0){return function(_0x5ba611){if(_0x5ba611){return _0x5ba611[_0x2625('0x21')]()[_0x2625('0x20')](function(){_0x23f35c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de082,_0x11edd3){return function(_0x51c5c5){if(!_0x51c5c5){_0x5de082[_0x2625('0x15')](0x194);}return _0x51c5c5;};}function handleError(_0x684190,_0x30026b){_0x30026b=_0x30026b||0x1f4;return function(_0x349973){logger['error'](_0x349973['stack']);if(_0x349973[_0x2625('0x22')]){delete _0x349973[_0x2625('0x22')];}_0x684190['status'](_0x30026b)['send'](_0x349973);};}exports[_0x2625('0x23')]=function(_0x31a3c6,_0x2aaa5a){var _0x41d152={},_0x4767a8={},_0x57750d={'count':0x0,'rows':[]};var _0x39637e=_[_0x2625('0x24')](db['FreshsalesConfiguration'][_0x2625('0x25')],function(_0x5bb08a){return{'name':_0x5bb08a['fieldName'],'type':_0x5bb08a[_0x2625('0x26')][_0x2625('0x27')]};});_0x4767a8[_0x2625('0x28')]=_[_0x2625('0x24')](_0x39637e,_0x2625('0x22'));_0x4767a8[_0x2625('0x29')]=_['keys'](_0x31a3c6['query']);_0x4767a8[_0x2625('0x2a')]=_[_0x2625('0x2b')](_0x4767a8['model'],_0x4767a8[_0x2625('0x29')]);_0x41d152[_0x2625('0x2c')]=_[_0x2625('0x2b')](_0x4767a8['model'],qs[_0x2625('0x2d')](_0x31a3c6[_0x2625('0x29')][_0x2625('0x2d')]));_0x41d152[_0x2625('0x2c')]=_0x41d152[_0x2625('0x2c')][_0x2625('0x2e')]?_0x41d152[_0x2625('0x2c')]:_0x4767a8[_0x2625('0x28')];if(!_0x31a3c6[_0x2625('0x29')]['hasOwnProperty']('nolimit')){_0x41d152[_0x2625('0x1a')]=qs[_0x2625('0x1a')](_0x31a3c6['query'][_0x2625('0x1a')]);_0x41d152[_0x2625('0x19')]=qs[_0x2625('0x19')](_0x31a3c6[_0x2625('0x29')][_0x2625('0x19')]);}_0x41d152[_0x2625('0x2f')]=qs[_0x2625('0x30')](_0x31a3c6['query'][_0x2625('0x30')]);_0x41d152[_0x2625('0x31')]=qs[_0x2625('0x2a')](_['pick'](_0x31a3c6[_0x2625('0x29')],_0x4767a8[_0x2625('0x2a')]),_0x39637e);if(_0x31a3c6[_0x2625('0x29')][_0x2625('0x32')]){_0x41d152['where']=_['merge'](_0x41d152['where'],{'$or':_['map'](_0x39637e,function(_0x28dbac){if(_0x28dbac[_0x2625('0x26')]!=='VIRTUAL'){var _0x262784={};_0x262784[_0x28dbac[_0x2625('0x22')]]={'$like':'%'+_0x31a3c6['query']['filter']+'%'};return _0x262784;}})});}_0x41d152=_[_0x2625('0x33')]({},_0x41d152,_0x31a3c6['options']);var _0x186cd1={'where':_0x41d152['where']};return db[_0x2625('0x34')][_0x2625('0x1c')](_0x186cd1)['then'](function(_0x41d3ef){_0x57750d[_0x2625('0x1c')]=_0x41d3ef;if(_0x31a3c6[_0x2625('0x29')][_0x2625('0x35')]){_0x41d152[_0x2625('0x36')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x2625('0x37')](_0x41d152);})[_0x2625('0x20')](function(_0x45a573){_0x57750d['rows']=_0x45a573;return _0x57750d;})['then'](respondWithFilteredResult(_0x2aaa5a,_0x41d152))[_0x2625('0x38')](handleError(_0x2aaa5a,null));};exports[_0x2625('0x39')]=function(_0x38cca0,_0x421024){var _0xeb1ebe={'raw':![],'where':{'id':_0x38cca0['params']['id']}},_0x306101={};_0x306101['model']=_[_0x2625('0x3a')](db[_0x2625('0x34')][_0x2625('0x25')]);_0x306101[_0x2625('0x29')]=_[_0x2625('0x3a')](_0x38cca0[_0x2625('0x29')]);_0x306101[_0x2625('0x2a')]=_['intersection'](_0x306101[_0x2625('0x28')],_0x306101['query']);_0xeb1ebe['attributes']=_['intersection'](_0x306101[_0x2625('0x28')],qs[_0x2625('0x2d')](_0x38cca0[_0x2625('0x29')][_0x2625('0x2d')]));_0xeb1ebe[_0x2625('0x2c')]=_0xeb1ebe[_0x2625('0x2c')][_0x2625('0x2e')]?_0xeb1ebe['attributes']:_0x306101[_0x2625('0x28')];if(_0x38cca0['query'][_0x2625('0x35')]){_0xeb1ebe[_0x2625('0x36')]=[{'all':!![]}];}_0xeb1ebe=_[_0x2625('0x33')]({},_0xeb1ebe,_0x38cca0[_0x2625('0x3b')]);return db[_0x2625('0x34')][_0x2625('0x3c')](_0xeb1ebe)[_0x2625('0x20')](handleEntityNotFound(_0x421024,null))['then'](respondWithResult(_0x421024,null))[_0x2625('0x38')](handleError(_0x421024,null));};exports[_0x2625('0x3d')]=function(_0x5392b0,_0x43d5b9){return db[_0x2625('0x34')][_0x2625('0x3d')](_0x5392b0['body'],{})[_0x2625('0x20')](respondWithResult(_0x43d5b9,0xc9))[_0x2625('0x38')](handleError(_0x43d5b9,null));};exports[_0x2625('0x3e')]=function(_0x4819de,_0x4905b0){if(_0x4819de[_0x2625('0x3f')]['id']){delete _0x4819de[_0x2625('0x3f')]['id'];}return db['FreshsalesConfiguration'][_0x2625('0x3c')]({'where':{'id':_0x4819de['params']['id']}})[_0x2625('0x20')](handleEntityNotFound(_0x4905b0,null))[_0x2625('0x20')](saveUpdates(_0x4819de[_0x2625('0x3f')],null))['then'](respondWithResult(_0x4905b0,null))[_0x2625('0x38')](handleError(_0x4905b0,null));};exports['destroy']=function(_0x523f54,_0x5088c1){return db[_0x2625('0x34')][_0x2625('0x3c')]({'where':{'id':_0x523f54['params']['id']}})[_0x2625('0x20')](handleEntityNotFound(_0x5088c1,null))[_0x2625('0x20')](removeEntity(_0x5088c1,null))[_0x2625('0x38')](handleError(_0x5088c1,null));};exports[_0x2625('0x40')]=function(_0x54e0d0,_0x62e02f,_0x17a34c){var _0x8c1743={};var _0x116b83={};var _0x2b9159;var _0x3132e4;return db[_0x2625('0x34')][_0x2625('0x41')]({'where':{'id':_0x54e0d0[_0x2625('0x42')]['id']}})[_0x2625('0x20')](handleEntityNotFound(_0x62e02f,null))[_0x2625('0x20')](function(_0x56b8df){if(_0x56b8df){_0x2b9159=_0x56b8df;_0x116b83[_0x2625('0x28')]=_[_0x2625('0x3a')](db[_0x2625('0x43')][_0x2625('0x25')]);_0x116b83['query']=_['keys'](_0x54e0d0[_0x2625('0x29')]);_0x116b83[_0x2625('0x2a')]=_['intersection'](_0x116b83[_0x2625('0x28')],_0x116b83['query']);_0x8c1743[_0x2625('0x2c')]=_[_0x2625('0x2b')](_0x116b83[_0x2625('0x28')],qs[_0x2625('0x2d')](_0x54e0d0[_0x2625('0x29')][_0x2625('0x2d')]));_0x8c1743[_0x2625('0x2c')]=_0x8c1743['attributes'][_0x2625('0x2e')]?_0x8c1743[_0x2625('0x2c')]:_0x116b83['model'];_0x8c1743['order']=qs[_0x2625('0x30')](_0x54e0d0[_0x2625('0x29')][_0x2625('0x30')]);_0x8c1743['where']=qs['filters'](_[_0x2625('0x44')](_0x54e0d0[_0x2625('0x29')],_0x116b83['filters']));if(_0x54e0d0['query'][_0x2625('0x32')]){_0x8c1743[_0x2625('0x31')]=_[_0x2625('0x33')](_0x8c1743[_0x2625('0x31')],{'$or':_[_0x2625('0x24')](_0x8c1743['attributes'],function(_0x5bb703){var _0x5d589b={};_0x5d589b[_0x5bb703]={'$like':'%'+_0x54e0d0[_0x2625('0x29')]['filter']+'%'};return _0x5d589b;})});}_0x8c1743=_['merge']({},_0x8c1743,_0x54e0d0[_0x2625('0x3b')]);return _0x2b9159[_0x2625('0x40')](_0x8c1743);}})[_0x2625('0x20')](function(_0x49a2d8){if(_0x49a2d8){_0x3132e4=_0x49a2d8[_0x2625('0x2e')];if(!_0x54e0d0['query']['hasOwnProperty'](_0x2625('0x45'))){_0x8c1743[_0x2625('0x1a')]=qs[_0x2625('0x1a')](_0x54e0d0[_0x2625('0x29')]['limit']);_0x8c1743[_0x2625('0x19')]=qs[_0x2625('0x19')](_0x54e0d0[_0x2625('0x29')][_0x2625('0x19')]);}return _0x2b9159[_0x2625('0x40')](_0x8c1743);}})[_0x2625('0x20')](function(_0x22b78c){if(_0x22b78c){return _0x22b78c?{'count':_0x3132e4,'rows':_0x22b78c}:null;}})[_0x2625('0x20')](respondWithResult(_0x62e02f,null))['catch'](handleError(_0x62e02f,null));};exports[_0x2625('0x46')]=function(_0x394650,_0x750e7f,_0x34f018){var _0x1332b7={};var _0xc3c27b={};var _0x34a0ee;var _0x2e1bc4;return db[_0x2625('0x34')]['findOne']({'where':{'id':_0x394650[_0x2625('0x42')]['id']}})['then'](handleEntityNotFound(_0x750e7f,null))[_0x2625('0x20')](function(_0x29d28c){if(_0x29d28c){_0x34a0ee=_0x29d28c;_0xc3c27b['model']=_['keys'](db[_0x2625('0x43')][_0x2625('0x25')]);_0xc3c27b['query']=_['keys'](_0x394650[_0x2625('0x29')]);_0xc3c27b[_0x2625('0x2a')]=_[_0x2625('0x2b')](_0xc3c27b[_0x2625('0x28')],_0xc3c27b['query']);_0x1332b7[_0x2625('0x2c')]=_[_0x2625('0x2b')](_0xc3c27b[_0x2625('0x28')],qs[_0x2625('0x2d')](_0x394650[_0x2625('0x29')][_0x2625('0x2d')]));_0x1332b7['attributes']=_0x1332b7[_0x2625('0x2c')][_0x2625('0x2e')]?_0x1332b7[_0x2625('0x2c')]:_0xc3c27b[_0x2625('0x28')];_0x1332b7[_0x2625('0x2f')]=qs[_0x2625('0x30')](_0x394650[_0x2625('0x29')]['sort']);_0x1332b7[_0x2625('0x31')]=qs[_0x2625('0x2a')](_[_0x2625('0x44')](_0x394650[_0x2625('0x29')],_0xc3c27b[_0x2625('0x2a')]));if(_0x394650[_0x2625('0x29')][_0x2625('0x32')]){_0x1332b7[_0x2625('0x31')]=_[_0x2625('0x33')](_0x1332b7[_0x2625('0x31')],{'$or':_[_0x2625('0x24')](_0x1332b7[_0x2625('0x2c')],function(_0x5a1c85){var _0x2d9d77={};_0x2d9d77[_0x5a1c85]={'$like':'%'+_0x394650[_0x2625('0x29')][_0x2625('0x32')]+'%'};return _0x2d9d77;})});}_0x1332b7=_['merge']({},_0x1332b7,_0x394650[_0x2625('0x3b')]);return _0x34a0ee[_0x2625('0x46')](_0x1332b7);}})['then'](function(_0x5c72ca){if(_0x5c72ca){_0x2e1bc4=_0x5c72ca[_0x2625('0x2e')];if(!_0x394650['query'][_0x2625('0x47')](_0x2625('0x45'))){_0x1332b7['limit']=qs['limit'](_0x394650[_0x2625('0x29')]['limit']);_0x1332b7['offset']=qs[_0x2625('0x19')](_0x394650[_0x2625('0x29')][_0x2625('0x19')]);}return _0x34a0ee[_0x2625('0x46')](_0x1332b7);}})[_0x2625('0x20')](function(_0x414283){if(_0x414283){return _0x414283?{'count':_0x2e1bc4,'rows':_0x414283}:null;}})[_0x2625('0x20')](respondWithResult(_0x750e7f,null))[_0x2625('0x38')](handleError(_0x750e7f,null));};exports['getFields']=function(_0x236484,_0x405a9e,_0x32eff4){var _0x4778c8={};var _0x5b4064={};var _0x12a557;var _0xe845eb;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x236484[_0x2625('0x42')]['id']}})[_0x2625('0x20')](handleEntityNotFound(_0x405a9e,null))[_0x2625('0x20')](function(_0x28214c){if(_0x28214c){_0x12a557=_0x28214c;_0x5b4064[_0x2625('0x28')]=_['keys'](db['FreshsalesField'][_0x2625('0x25')]);_0x5b4064[_0x2625('0x29')]=_[_0x2625('0x3a')](_0x236484['query']);_0x5b4064[_0x2625('0x2a')]=_['intersection'](_0x5b4064[_0x2625('0x28')],_0x5b4064[_0x2625('0x29')]);_0x4778c8[_0x2625('0x2c')]=_['intersection'](_0x5b4064['model'],qs[_0x2625('0x2d')](_0x236484[_0x2625('0x29')][_0x2625('0x2d')]));_0x4778c8[_0x2625('0x2c')]=_0x4778c8[_0x2625('0x2c')]['length']?_0x4778c8['attributes']:_0x5b4064[_0x2625('0x28')];_0x4778c8[_0x2625('0x2f')]=qs[_0x2625('0x30')](_0x236484[_0x2625('0x29')][_0x2625('0x30')]);_0x4778c8[_0x2625('0x31')]=qs[_0x2625('0x2a')](_[_0x2625('0x44')](_0x236484[_0x2625('0x29')],_0x5b4064[_0x2625('0x2a')]));if(_0x236484['query'][_0x2625('0x32')]){_0x4778c8[_0x2625('0x31')]=_[_0x2625('0x33')](_0x4778c8[_0x2625('0x31')],{'$or':_['map'](_0x4778c8['attributes'],function(_0x20311c){var _0x252b3b={};_0x252b3b[_0x20311c]={'$like':'%'+_0x236484[_0x2625('0x29')][_0x2625('0x32')]+'%'};return _0x252b3b;})});}_0x4778c8=_[_0x2625('0x33')]({},_0x4778c8,_0x236484[_0x2625('0x3b')]);return _0x12a557[_0x2625('0x48')](_0x4778c8);}})[_0x2625('0x20')](function(_0x1fd951){if(_0x1fd951){_0xe845eb=_0x1fd951['length'];if(!_0x236484[_0x2625('0x29')]['hasOwnProperty'](_0x2625('0x45'))){_0x4778c8[_0x2625('0x1a')]=qs[_0x2625('0x1a')](_0x236484[_0x2625('0x29')][_0x2625('0x1a')]);_0x4778c8[_0x2625('0x19')]=qs[_0x2625('0x19')](_0x236484[_0x2625('0x29')][_0x2625('0x19')]);}return _0x12a557['getFields'](_0x4778c8);}})['then'](function(_0x20c469){if(_0x20c469){return _0x20c469?{'count':_0xe845eb,'rows':_0x20c469}:null;}})[_0x2625('0x20')](respondWithResult(_0x405a9e,null))['catch'](handleError(_0x405a9e,null));}; \ No newline at end of file +var _0xd4ed=['pick','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','filter','options','include','findAll','show','intersection','includeAll','find','create','body','catch','params','getSubjects','findOne','FreshsalesField','sort'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xd4ed,0x1d1));var _0xdd4e=function(_0xb77948,_0x48ec78){_0xb77948=_0xb77948-0x0;var _0x4f3924=_0xd4ed[_0xb77948];return _0x4f3924;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdd4e('0x0'));var zipdir=require(_0xdd4e('0x1'));var jsonpatch=require(_0xdd4e('0x2'));var rp=require(_0xdd4e('0x3'));var moment=require('moment');var BPromise=require(_0xdd4e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xdd4e('0x5'));var sox=require('sox');var csv=require(_0xdd4e('0x6'));var ejs=require(_0xdd4e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd4e('0x8'));var squel=require(_0xdd4e('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdd4e('0xa'));var toCsv=require(_0xdd4e('0x6'));var querystring=require(_0xdd4e('0xb'));var Papa=require('papaparse');var Redis=require(_0xdd4e('0xc'));var authService=require(_0xdd4e('0xd'));var qs=require(_0xdd4e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdd4e('0xf'));var logger=require(_0xdd4e('0x10'))(_0xdd4e('0x11'));var utils=require(_0xdd4e('0x12'));var config=require(_0xdd4e('0x13'));var licenseUtil=require(_0xdd4e('0x14'));var db=require(_0xdd4e('0x15'))['db'];function respondWithStatusCode(_0x62e83b,_0x29da61){_0x29da61=_0x29da61||0xcc;return function(_0x48fdf9){if(_0x48fdf9){return _0x62e83b['sendStatus'](_0x29da61);}return _0x62e83b[_0xdd4e('0x16')](_0x29da61)[_0xdd4e('0x17')]();};}function respondWithResult(_0x401b1b,_0x36dc3){_0x36dc3=_0x36dc3||0xc8;return function(_0x56e1f7){if(_0x56e1f7){return _0x401b1b[_0xdd4e('0x16')](_0x36dc3)[_0xdd4e('0x18')](_0x56e1f7);}};}function respondWithFilteredResult(_0x3a344b,_0xb1392e){return function(_0x539713){if(_0x539713){var _0x35c8e9=typeof _0xb1392e['offset']===_0xdd4e('0x19')&&typeof _0xb1392e[_0xdd4e('0x1a')]===_0xdd4e('0x19');var _0x135295=_0x539713[_0xdd4e('0x1b')];var _0x322b4a=_0x35c8e9?0x0:_0xb1392e[_0xdd4e('0x1c')];var _0x500f0e=_0x35c8e9?_0x539713[_0xdd4e('0x1b')]:_0xb1392e['offset']+_0xb1392e[_0xdd4e('0x1a')];var _0xec1da2;if(_0x500f0e>=_0x135295){_0x500f0e=_0x135295;_0xec1da2=0xc8;}else{_0xec1da2=0xce;}_0x3a344b['status'](_0xec1da2);return _0x3a344b[_0xdd4e('0x1d')](_0xdd4e('0x1e'),_0x322b4a+'-'+_0x500f0e+'/'+_0x135295)[_0xdd4e('0x18')](_0x539713);}return null;};}function patchUpdates(_0x4d6f50){return function(_0xa618d4){try{jsonpatch[_0xdd4e('0x1f')](_0xa618d4,_0x4d6f50,!![]);}catch(_0x4b697f){return BPromise[_0xdd4e('0x20')](_0x4b697f);}return _0xa618d4['save']();};}function saveUpdates(_0x214751,_0x2fb6d3){return function(_0x84ffaa){if(_0x84ffaa){return _0x84ffaa[_0xdd4e('0x21')](_0x214751)[_0xdd4e('0x22')](function(_0xa50d3f){return _0xa50d3f;});}return null;};}function removeEntity(_0x31b0a3,_0x127c3c){return function(_0x36bfb0){if(_0x36bfb0){return _0x36bfb0[_0xdd4e('0x23')]()[_0xdd4e('0x22')](function(){_0x31b0a3['status'](0xcc)[_0xdd4e('0x17')]();});}};}function handleEntityNotFound(_0x3ac4a4,_0x4ebd8a){return function(_0x4bea65){if(!_0x4bea65){_0x3ac4a4['sendStatus'](0x194);}return _0x4bea65;};}function handleError(_0x349bc3,_0x11de53){_0x11de53=_0x11de53||0x1f4;return function(_0x1d2fd9){logger[_0xdd4e('0x24')](_0x1d2fd9[_0xdd4e('0x25')]);if(_0x1d2fd9[_0xdd4e('0x26')]){delete _0x1d2fd9[_0xdd4e('0x26')];}_0x349bc3[_0xdd4e('0x16')](_0x11de53)[_0xdd4e('0x27')](_0x1d2fd9);};}exports[_0xdd4e('0x28')]=function(_0x19a198,_0x12d668){var _0x3b818c={},_0x3172ea={},_0x4969ac={'count':0x0,'rows':[]};var _0x169ba8=_[_0xdd4e('0x29')](db[_0xdd4e('0x2a')][_0xdd4e('0x2b')],function(_0x465861){return{'name':_0x465861['fieldName'],'type':_0x465861[_0xdd4e('0x2c')][_0xdd4e('0x2d')]};});_0x3172ea[_0xdd4e('0x2e')]=_[_0xdd4e('0x29')](_0x169ba8,_0xdd4e('0x26'));_0x3172ea[_0xdd4e('0x2f')]=_[_0xdd4e('0x30')](_0x19a198[_0xdd4e('0x2f')]);_0x3172ea[_0xdd4e('0x31')]=_['intersection'](_0x3172ea[_0xdd4e('0x2e')],_0x3172ea[_0xdd4e('0x2f')]);_0x3b818c[_0xdd4e('0x32')]=_['intersection'](_0x3172ea[_0xdd4e('0x2e')],qs[_0xdd4e('0x33')](_0x19a198[_0xdd4e('0x2f')][_0xdd4e('0x33')]));_0x3b818c[_0xdd4e('0x32')]=_0x3b818c[_0xdd4e('0x32')][_0xdd4e('0x34')]?_0x3b818c[_0xdd4e('0x32')]:_0x3172ea[_0xdd4e('0x2e')];if(!_0x19a198[_0xdd4e('0x2f')][_0xdd4e('0x35')](_0xdd4e('0x36'))){_0x3b818c[_0xdd4e('0x1a')]=qs[_0xdd4e('0x1a')](_0x19a198[_0xdd4e('0x2f')][_0xdd4e('0x1a')]);_0x3b818c[_0xdd4e('0x1c')]=qs[_0xdd4e('0x1c')](_0x19a198['query']['offset']);}_0x3b818c[_0xdd4e('0x37')]=qs['sort'](_0x19a198[_0xdd4e('0x2f')]['sort']);_0x3b818c[_0xdd4e('0x38')]=qs['filters'](_['pick'](_0x19a198[_0xdd4e('0x2f')],_0x3172ea[_0xdd4e('0x31')]),_0x169ba8);if(_0x19a198['query']['filter']){_0x3b818c[_0xdd4e('0x38')]=_[_0xdd4e('0x39')](_0x3b818c[_0xdd4e('0x38')],{'$or':_['map'](_0x169ba8,function(_0x28335a){if(_0x28335a[_0xdd4e('0x2c')]!=='VIRTUAL'){var _0x108aa8={};_0x108aa8[_0x28335a[_0xdd4e('0x26')]]={'$like':'%'+_0x19a198[_0xdd4e('0x2f')][_0xdd4e('0x3a')]+'%'};return _0x108aa8;}})});}_0x3b818c=_[_0xdd4e('0x39')]({},_0x3b818c,_0x19a198[_0xdd4e('0x3b')]);var _0xef5037={'where':_0x3b818c[_0xdd4e('0x38')]};return db[_0xdd4e('0x2a')][_0xdd4e('0x1b')](_0xef5037)[_0xdd4e('0x22')](function(_0x2a48db){_0x4969ac[_0xdd4e('0x1b')]=_0x2a48db;if(_0x19a198[_0xdd4e('0x2f')]['includeAll']){_0x3b818c[_0xdd4e('0x3c')]=[{'all':!![]}];}return db[_0xdd4e('0x2a')][_0xdd4e('0x3d')](_0x3b818c);})['then'](function(_0x4085b6){_0x4969ac['rows']=_0x4085b6;return _0x4969ac;})['then'](respondWithFilteredResult(_0x12d668,_0x3b818c))['catch'](handleError(_0x12d668,null));};exports[_0xdd4e('0x3e')]=function(_0x1149e6,_0x321a66){var _0x1482aa={'raw':![],'where':{'id':_0x1149e6['params']['id']}},_0x6db904={};_0x6db904[_0xdd4e('0x2e')]=_[_0xdd4e('0x30')](db['FreshsalesConfiguration']['rawAttributes']);_0x6db904[_0xdd4e('0x2f')]=_[_0xdd4e('0x30')](_0x1149e6[_0xdd4e('0x2f')]);_0x6db904[_0xdd4e('0x31')]=_[_0xdd4e('0x3f')](_0x6db904[_0xdd4e('0x2e')],_0x6db904[_0xdd4e('0x2f')]);_0x1482aa[_0xdd4e('0x32')]=_[_0xdd4e('0x3f')](_0x6db904[_0xdd4e('0x2e')],qs[_0xdd4e('0x33')](_0x1149e6['query'][_0xdd4e('0x33')]));_0x1482aa['attributes']=_0x1482aa[_0xdd4e('0x32')][_0xdd4e('0x34')]?_0x1482aa['attributes']:_0x6db904[_0xdd4e('0x2e')];if(_0x1149e6[_0xdd4e('0x2f')][_0xdd4e('0x40')]){_0x1482aa[_0xdd4e('0x3c')]=[{'all':!![]}];}_0x1482aa=_[_0xdd4e('0x39')]({},_0x1482aa,_0x1149e6[_0xdd4e('0x3b')]);return db[_0xdd4e('0x2a')][_0xdd4e('0x41')](_0x1482aa)['then'](handleEntityNotFound(_0x321a66,null))[_0xdd4e('0x22')](respondWithResult(_0x321a66,null))['catch'](handleError(_0x321a66,null));};exports[_0xdd4e('0x42')]=function(_0x1b9f90,_0x369251){return db['FreshsalesConfiguration']['create'](_0x1b9f90[_0xdd4e('0x43')],{})['then'](respondWithResult(_0x369251,0xc9))[_0xdd4e('0x44')](handleError(_0x369251,null));};exports[_0xdd4e('0x21')]=function(_0x5d88e7,_0x5df3da){if(_0x5d88e7[_0xdd4e('0x43')]['id']){delete _0x5d88e7[_0xdd4e('0x43')]['id'];}return db['FreshsalesConfiguration'][_0xdd4e('0x41')]({'where':{'id':_0x5d88e7['params']['id']}})['then'](handleEntityNotFound(_0x5df3da,null))['then'](saveUpdates(_0x5d88e7[_0xdd4e('0x43')],null))['then'](respondWithResult(_0x5df3da,null))[_0xdd4e('0x44')](handleError(_0x5df3da,null));};exports['destroy']=function(_0x52b36d,_0x3966d3){return db[_0xdd4e('0x2a')][_0xdd4e('0x41')]({'where':{'id':_0x52b36d[_0xdd4e('0x45')]['id']}})[_0xdd4e('0x22')](handleEntityNotFound(_0x3966d3,null))['then'](removeEntity(_0x3966d3,null))[_0xdd4e('0x44')](handleError(_0x3966d3,null));};exports[_0xdd4e('0x46')]=function(_0x1eb9cc,_0x21f60a,_0x577ec8){var _0x272668={};var _0x5dc355={};var _0x4c21ba;var _0x20fed5;return db[_0xdd4e('0x2a')][_0xdd4e('0x47')]({'where':{'id':_0x1eb9cc[_0xdd4e('0x45')]['id']}})[_0xdd4e('0x22')](handleEntityNotFound(_0x21f60a,null))[_0xdd4e('0x22')](function(_0x1a7340){if(_0x1a7340){_0x4c21ba=_0x1a7340;_0x5dc355[_0xdd4e('0x2e')]=_[_0xdd4e('0x30')](db[_0xdd4e('0x48')][_0xdd4e('0x2b')]);_0x5dc355[_0xdd4e('0x2f')]=_[_0xdd4e('0x30')](_0x1eb9cc['query']);_0x5dc355[_0xdd4e('0x31')]=_[_0xdd4e('0x3f')](_0x5dc355[_0xdd4e('0x2e')],_0x5dc355[_0xdd4e('0x2f')]);_0x272668[_0xdd4e('0x32')]=_[_0xdd4e('0x3f')](_0x5dc355[_0xdd4e('0x2e')],qs['fields'](_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x33')]));_0x272668['attributes']=_0x272668[_0xdd4e('0x32')][_0xdd4e('0x34')]?_0x272668[_0xdd4e('0x32')]:_0x5dc355[_0xdd4e('0x2e')];_0x272668[_0xdd4e('0x37')]=qs[_0xdd4e('0x49')](_0x1eb9cc['query'][_0xdd4e('0x49')]);_0x272668[_0xdd4e('0x38')]=qs[_0xdd4e('0x31')](_[_0xdd4e('0x4a')](_0x1eb9cc[_0xdd4e('0x2f')],_0x5dc355[_0xdd4e('0x31')]));if(_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x3a')]){_0x272668['where']=_[_0xdd4e('0x39')](_0x272668[_0xdd4e('0x38')],{'$or':_[_0xdd4e('0x29')](_0x272668[_0xdd4e('0x32')],function(_0xa931ac){var _0x409d2b={};_0x409d2b[_0xa931ac]={'$like':'%'+_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x3a')]+'%'};return _0x409d2b;})});}_0x272668=_[_0xdd4e('0x39')]({},_0x272668,_0x1eb9cc['options']);return _0x4c21ba['getSubjects'](_0x272668);}})[_0xdd4e('0x22')](function(_0x367c57){if(_0x367c57){_0x20fed5=_0x367c57['length'];if(!_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x35')](_0xdd4e('0x36'))){_0x272668['limit']=qs[_0xdd4e('0x1a')](_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x1a')]);_0x272668[_0xdd4e('0x1c')]=qs['offset'](_0x1eb9cc[_0xdd4e('0x2f')][_0xdd4e('0x1c')]);}return _0x4c21ba['getSubjects'](_0x272668);}})['then'](function(_0x73f9b7){if(_0x73f9b7){return _0x73f9b7?{'count':_0x20fed5,'rows':_0x73f9b7}:null;}})['then'](respondWithResult(_0x21f60a,null))[_0xdd4e('0x44')](handleError(_0x21f60a,null));};exports['getDescriptions']=function(_0x2dc6ce,_0xe74caa,_0x32b6fe){var _0x291b84={};var _0x23b6c7={};var _0x9c78ae;var _0x12e750;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x2dc6ce[_0xdd4e('0x45')]['id']}})['then'](handleEntityNotFound(_0xe74caa,null))[_0xdd4e('0x22')](function(_0x50f778){if(_0x50f778){_0x9c78ae=_0x50f778;_0x23b6c7[_0xdd4e('0x2e')]=_[_0xdd4e('0x30')](db['FreshsalesField']['rawAttributes']);_0x23b6c7[_0xdd4e('0x2f')]=_[_0xdd4e('0x30')](_0x2dc6ce['query']);_0x23b6c7[_0xdd4e('0x31')]=_[_0xdd4e('0x3f')](_0x23b6c7[_0xdd4e('0x2e')],_0x23b6c7['query']);_0x291b84['attributes']=_[_0xdd4e('0x3f')](_0x23b6c7[_0xdd4e('0x2e')],qs[_0xdd4e('0x33')](_0x2dc6ce[_0xdd4e('0x2f')][_0xdd4e('0x33')]));_0x291b84[_0xdd4e('0x32')]=_0x291b84[_0xdd4e('0x32')][_0xdd4e('0x34')]?_0x291b84[_0xdd4e('0x32')]:_0x23b6c7[_0xdd4e('0x2e')];_0x291b84['order']=qs['sort'](_0x2dc6ce['query']['sort']);_0x291b84[_0xdd4e('0x38')]=qs[_0xdd4e('0x31')](_[_0xdd4e('0x4a')](_0x2dc6ce[_0xdd4e('0x2f')],_0x23b6c7[_0xdd4e('0x31')]));if(_0x2dc6ce[_0xdd4e('0x2f')][_0xdd4e('0x3a')]){_0x291b84['where']=_[_0xdd4e('0x39')](_0x291b84[_0xdd4e('0x38')],{'$or':_[_0xdd4e('0x29')](_0x291b84[_0xdd4e('0x32')],function(_0x141311){var _0x26e0e6={};_0x26e0e6[_0x141311]={'$like':'%'+_0x2dc6ce[_0xdd4e('0x2f')]['filter']+'%'};return _0x26e0e6;})});}_0x291b84=_[_0xdd4e('0x39')]({},_0x291b84,_0x2dc6ce[_0xdd4e('0x3b')]);return _0x9c78ae[_0xdd4e('0x4b')](_0x291b84);}})[_0xdd4e('0x22')](function(_0x934c58){if(_0x934c58){_0x12e750=_0x934c58['length'];if(!_0x2dc6ce[_0xdd4e('0x2f')][_0xdd4e('0x35')](_0xdd4e('0x36'))){_0x291b84['limit']=qs['limit'](_0x2dc6ce['query'][_0xdd4e('0x1a')]);_0x291b84[_0xdd4e('0x1c')]=qs[_0xdd4e('0x1c')](_0x2dc6ce[_0xdd4e('0x2f')]['offset']);}return _0x9c78ae['getDescriptions'](_0x291b84);}})[_0xdd4e('0x22')](function(_0x7081c2){if(_0x7081c2){return _0x7081c2?{'count':_0x12e750,'rows':_0x7081c2}:null;}})[_0xdd4e('0x22')](respondWithResult(_0xe74caa,null))[_0xdd4e('0x44')](handleError(_0xe74caa,null));};exports['getFields']=function(_0x12617e,_0x3e7570,_0x16b658){var _0x13097d={};var _0x4647f3={};var _0x177cdc;var _0x3a5edd;return db[_0xdd4e('0x2a')][_0xdd4e('0x47')]({'where':{'id':_0x12617e[_0xdd4e('0x45')]['id']}})[_0xdd4e('0x22')](handleEntityNotFound(_0x3e7570,null))[_0xdd4e('0x22')](function(_0x5f403b){if(_0x5f403b){_0x177cdc=_0x5f403b;_0x4647f3['model']=_[_0xdd4e('0x30')](db[_0xdd4e('0x48')][_0xdd4e('0x2b')]);_0x4647f3[_0xdd4e('0x2f')]=_['keys'](_0x12617e[_0xdd4e('0x2f')]);_0x4647f3[_0xdd4e('0x31')]=_[_0xdd4e('0x3f')](_0x4647f3[_0xdd4e('0x2e')],_0x4647f3[_0xdd4e('0x2f')]);_0x13097d[_0xdd4e('0x32')]=_[_0xdd4e('0x3f')](_0x4647f3[_0xdd4e('0x2e')],qs[_0xdd4e('0x33')](_0x12617e['query'][_0xdd4e('0x33')]));_0x13097d[_0xdd4e('0x32')]=_0x13097d[_0xdd4e('0x32')][_0xdd4e('0x34')]?_0x13097d[_0xdd4e('0x32')]:_0x4647f3[_0xdd4e('0x2e')];_0x13097d[_0xdd4e('0x37')]=qs[_0xdd4e('0x49')](_0x12617e[_0xdd4e('0x2f')][_0xdd4e('0x49')]);_0x13097d['where']=qs['filters'](_[_0xdd4e('0x4a')](_0x12617e['query'],_0x4647f3[_0xdd4e('0x31')]));if(_0x12617e[_0xdd4e('0x2f')]['filter']){_0x13097d[_0xdd4e('0x38')]=_[_0xdd4e('0x39')](_0x13097d[_0xdd4e('0x38')],{'$or':_[_0xdd4e('0x29')](_0x13097d[_0xdd4e('0x32')],function(_0x5e8ef1){var _0x44b501={};_0x44b501[_0x5e8ef1]={'$like':'%'+_0x12617e[_0xdd4e('0x2f')][_0xdd4e('0x3a')]+'%'};return _0x44b501;})});}_0x13097d=_[_0xdd4e('0x39')]({},_0x13097d,_0x12617e[_0xdd4e('0x3b')]);return _0x177cdc[_0xdd4e('0x4c')](_0x13097d);}})[_0xdd4e('0x22')](function(_0x530a3c){if(_0x530a3c){_0x3a5edd=_0x530a3c[_0xdd4e('0x34')];if(!_0x12617e[_0xdd4e('0x2f')]['hasOwnProperty'](_0xdd4e('0x36'))){_0x13097d[_0xdd4e('0x1a')]=qs[_0xdd4e('0x1a')](_0x12617e[_0xdd4e('0x2f')][_0xdd4e('0x1a')]);_0x13097d[_0xdd4e('0x1c')]=qs['offset'](_0x12617e[_0xdd4e('0x2f')]['offset']);}return _0x177cdc[_0xdd4e('0x4c')](_0x13097d);}})[_0xdd4e('0x22')](function(_0x5c56cc){if(_0x5c56cc){return _0x5c56cc?{'count':_0x3a5edd,'rows':_0x5c56cc}:null;}})[_0xdd4e('0x22')](respondWithResult(_0x3e7570,null))['catch'](handleError(_0x3e7570,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index e9d6ff4..091e85d 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 _0x601b=['FreshsalesConfiguration','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x46e202,_0x66bd8b){var _0x1a89ba=function(_0x593265){while(--_0x593265){_0x46e202['push'](_0x46e202['shift']());}};_0x1a89ba(++_0x66bd8b);}(_0x601b,0x109));var _0xb601=function(_0x189a77,_0x4f088c){_0x189a77=_0x189a77-0x0;var _0x160874=_0x601b[_0x189a77];return _0x160874;};'use strict';var _=require('lodash');var util=require(_0xb601('0x0'));var logger=require(_0xb601('0x1'))('api');var moment=require(_0xb601('0x2'));var BPromise=require(_0xb601('0x3'));var rp=require(_0xb601('0x4'));var fs=require('fs');var path=require(_0xb601('0x5'));var rimraf=require(_0xb601('0x6'));var config=require(_0xb601('0x7'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xb601('0x8')]=function(_0x49a925,_0x230d4f){return _0x49a925[_0xb601('0x9')](_0xb601('0xa'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0b2b=['int_freshsales_configurations','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','FreshsalesConfiguration'];(function(_0x45541c,_0x39f27d){var _0x1fb88f=function(_0x1796b5){while(--_0x1796b5){_0x45541c['push'](_0x45541c['shift']());}};_0x1fb88f(++_0x39f27d);}(_0x0b2b,0x1ed));var _0xb0b2=function(_0x30cdf3,_0x17b024){_0x30cdf3=_0x30cdf3-0x0;var _0x287f84=_0x0b2b[_0x30cdf3];return _0x287f84;};'use strict';var _=require(_0xb0b2('0x0'));var util=require(_0xb0b2('0x1'));var logger=require('../../config/logger')(_0xb0b2('0x2'));var moment=require('moment');var BPromise=require(_0xb0b2('0x3'));var rp=require(_0xb0b2('0x4'));var fs=require('fs');var path=require(_0xb0b2('0x5'));var rimraf=require(_0xb0b2('0x6'));var config=require(_0xb0b2('0x7'));var attributes=require(_0xb0b2('0x8'));module[_0xb0b2('0x9')]=function(_0x28a8e8,_0x3be842){return _0x28a8e8['define'](_0xb0b2('0xa'),attributes,{'tableName':_0xb0b2('0xb'),'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 e3f4ab9..b4d65cc 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 _0x2b7d=['../../config/utils','../../config/logger','rpc','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','util','bluebird','randomstring','../../mysqldb'];(function(_0x3ec122,_0x55150a){var _0x4ecf41=function(_0x1709cd){while(--_0x1709cd){_0x3ec122['push'](_0x3ec122['shift']());}};_0x4ecf41(++_0x55150a);}(_0x2b7d,0x140));var _0xd2b7=function(_0x510ccc,_0x3b997d){_0x510ccc=_0x510ccc-0x0;var _0x32c374=_0x2b7d[_0x510ccc];return _0x32c374;};'use strict';var _=require('lodash');var util=require(_0xd2b7('0x0'));var moment=require('moment');var BPromise=require(_0xd2b7('0x1'));var rs=require(_0xd2b7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd2b7('0x3'))['db'];var utils=require(_0xd2b7('0x4'));var logger=require(_0xd2b7('0x5'))(_0xd2b7('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd2b7('0x7')][_0xd2b7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c3901,_0x3bc17e,_0x451c9b){return new BPromise(function(_0x325078,_0x540c3e){return client[_0xd2b7('0x9')](_0x3c3901,_0x451c9b)[_0xd2b7('0xa')](function(_0x45a3c9){logger[_0xd2b7('0xb')](_0xd2b7('0xc'),_0x3bc17e,_0xd2b7('0xd'));logger['debug'](_0xd2b7('0xe'),_0x3bc17e,_0xd2b7('0xd'),JSON[_0xd2b7('0xf')](_0x45a3c9));if(_0x45a3c9[_0xd2b7('0x10')]){if(_0x45a3c9['error']['code']===0x1f4){logger[_0xd2b7('0x10')](_0xd2b7('0xc'),_0x3bc17e,_0x45a3c9['error'][_0xd2b7('0x11')]);return _0x540c3e(_0x45a3c9['error'][_0xd2b7('0x11')]);}logger[_0xd2b7('0x10')](_0xd2b7('0xc'),_0x3bc17e,_0x45a3c9[_0xd2b7('0x10')][_0xd2b7('0x11')]);return _0x325078(_0x45a3c9['error'][_0xd2b7('0x11')]);}else{logger[_0xd2b7('0xb')](_0xd2b7('0xc'),_0x3bc17e,_0xd2b7('0xd'));_0x325078(_0x45a3c9['result'][_0xd2b7('0x11')]);}})['catch'](function(_0x492253){logger[_0xd2b7('0x10')](_0xd2b7('0xc'),_0x3bc17e,_0x492253);_0x540c3e(_0x492253);});});} \ No newline at end of file +var _0x36b4=['result','catch','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x23394e,_0x30e9d2){var _0x2ba163=function(_0x2dc955){while(--_0x2dc955){_0x23394e['push'](_0x23394e['shift']());}};_0x2ba163(++_0x30e9d2);}(_0x36b4,0x18e));var _0x436b=function(_0x1f7191,_0x37bc37){_0x1f7191=_0x1f7191-0x0;var _0x29fd0d=_0x36b4[_0x1f7191];return _0x29fd0d;};'use strict';var _=require(_0x436b('0x0'));var util=require(_0x436b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x436b('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x436b('0x3'));var logger=require('../../config/logger')(_0x436b('0x4'));var config=require(_0x436b('0x5'));var jayson=require(_0x436b('0x6'));var client=jayson[_0x436b('0x7')][_0x436b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1769c4,_0x521781,_0x79482e){return new BPromise(function(_0xa31529,_0x59ff3c){return client[_0x436b('0x9')](_0x1769c4,_0x79482e)[_0x436b('0xa')](function(_0x328d26){logger[_0x436b('0xb')](_0x436b('0xc'),_0x521781,'request\x20sent');logger[_0x436b('0xd')](_0x436b('0xe'),_0x521781,_0x436b('0xf'),JSON[_0x436b('0x10')](_0x328d26));if(_0x328d26[_0x436b('0x11')]){if(_0x328d26[_0x436b('0x11')][_0x436b('0x12')]===0x1f4){logger[_0x436b('0x11')](_0x436b('0xc'),_0x521781,_0x328d26['error'][_0x436b('0x13')]);return _0x59ff3c(_0x328d26['error']['message']);}logger['error'](_0x436b('0xc'),_0x521781,_0x328d26[_0x436b('0x11')][_0x436b('0x13')]);return _0xa31529(_0x328d26[_0x436b('0x11')][_0x436b('0x13')]);}else{logger[_0x436b('0xb')](_0x436b('0xc'),_0x521781,'request\x20sent');_0xa31529(_0x328d26[_0x436b('0x14')][_0x436b('0x13')]);}})[_0x436b('0x15')](function(_0x44ba2c){logger[_0x436b('0x11')](_0x436b('0xc'),_0x521781,_0x44ba2c);_0x59ff3c(_0x44ba2c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 9a65625..9163c38 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 _0x5bbd=['util','path','connect-timeout','express','Router','fs-extra','./intFreshsalesField.controller','get','isAuthenticated','show','post','put','/:id','delete','multer'];(function(_0x552645,_0xfb6f1){var _0x4bdf04=function(_0x5bd97c){while(--_0x5bd97c){_0x552645['push'](_0x552645['shift']());}};_0x4bdf04(++_0xfb6f1);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd5bb('0x0'));var util=require(_0xd5bb('0x1'));var path=require(_0xd5bb('0x2'));var timeout=require(_0xd5bb('0x3'));var express=require(_0xd5bb('0x4'));var router=express[_0xd5bb('0x5')]();var fs_extra=require(_0xd5bb('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd5bb('0x7'));router[_0xd5bb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd5bb('0x8')]('/:id',auth[_0xd5bb('0x9')](),controller[_0xd5bb('0xa')]);router[_0xd5bb('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xd5bb('0xc')](_0xd5bb('0xd'),auth[_0xd5bb('0x9')](),controller['update']);router[_0xd5bb('0xe')](_0xd5bb('0xd'),auth[_0xd5bb('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5b02=['util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b02,0xe9));var _0x25b0=function(_0x47b6a3,_0x4534f2){_0x47b6a3=_0x47b6a3-0x0;var _0x415128=_0x5b02[_0x47b6a3];return _0x415128;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0xa'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x10')]);module[_0x25b0('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index b5c19b2..0e1c44c 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 _0x1f85=['keyValue','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1f85,0x1d8));var _0x51f8=function(_0x2dc765,_0x47e25f){_0x2dc765=_0x2dc765-0x0;var _0x19372b=_0x1f85[_0x2dc765];return _0x19372b;};'use strict';var Sequelize=require(_0x51f8('0x0'));module[_0x51f8('0x1')]={'type':{'type':Sequelize[_0x51f8('0x2')](_0x51f8('0x3'),'variable',_0x51f8('0x4'),_0x51f8('0x5'),'picklist'),'defaultValue':_0x51f8('0x3')},'content':{'type':Sequelize[_0x51f8('0x6')]},'key':{'type':Sequelize[_0x51f8('0x6')]},'keyType':{'type':Sequelize[_0x51f8('0x2')](_0x51f8('0x3'),_0x51f8('0x7'),_0x51f8('0x4'))},'keyContent':{'type':Sequelize[_0x51f8('0x6')]},'idField':{'type':Sequelize[_0x51f8('0x6')]},'nameField':{'type':Sequelize[_0x51f8('0x6')]},'customField':{'type':Sequelize[_0x51f8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x51f8('0x6')]}}; \ No newline at end of file +var _0x5420=['customVariable','BOOLEAN','sequelize','exports','ENUM','variable','keyValue','string','STRING'];(function(_0x477c0c,_0x48b400){var _0x37d540=function(_0x2d95e2){while(--_0x2d95e2){_0x477c0c['push'](_0x477c0c['shift']());}};_0x37d540(++_0x48b400);}(_0x5420,0x1f1));var _0x0542=function(_0x3f8094,_0xe19ba1){_0x3f8094=_0x3f8094-0x0;var _0x1c450c=_0x5420[_0x3f8094];return _0x1c450c;};'use strict';var Sequelize=require(_0x0542('0x0'));module[_0x0542('0x1')]={'type':{'type':Sequelize[_0x0542('0x2')]('string',_0x0542('0x3'),'customVariable',_0x0542('0x4'),'picklist'),'defaultValue':_0x0542('0x5')},'content':{'type':Sequelize[_0x0542('0x6')]},'key':{'type':Sequelize[_0x0542('0x6')]},'keyType':{'type':Sequelize[_0x0542('0x2')](_0x0542('0x5'),_0x0542('0x3'),_0x0542('0x7'))},'keyContent':{'type':Sequelize[_0x0542('0x6')]},'idField':{'type':Sequelize[_0x0542('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0542('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0542('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index d73947e..cb975f2 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 _0x0261=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create'];(function(_0x32c9b9,_0x21a0cf){var _0x239eab=function(_0x25fceb){while(--_0x25fceb){_0x32c9b9['push'](_0x32c9b9['shift']());}};_0x239eab(++_0x21a0cf);}(_0x0261,0x95));var _0x1026=function(_0x597c16,_0x2292fe){_0x597c16=_0x597c16-0x0;var _0x30cc2c=_0x0261[_0x597c16];return _0x30cc2c;};'use strict';var emlformat=require(_0x1026('0x0'));var rimraf=require(_0x1026('0x1'));var zipdir=require(_0x1026('0x2'));var jsonpatch=require(_0x1026('0x3'));var rp=require(_0x1026('0x4'));var moment=require(_0x1026('0x5'));var BPromise=require(_0x1026('0x6'));var Mustache=require(_0x1026('0x7'));var util=require('util');var path=require(_0x1026('0x8'));var sox=require(_0x1026('0x9'));var csv=require(_0x1026('0xa'));var ejs=require(_0x1026('0xb'));var fs=require('fs');var fs_extra=require(_0x1026('0xc'));var _=require(_0x1026('0xd'));var squel=require(_0x1026('0xe'));var crypto=require(_0x1026('0xf'));var jsforce=require(_0x1026('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1026('0xa'));var querystring=require('querystring');var Papa=require(_0x1026('0x11'));var Redis=require(_0x1026('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1026('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1026('0x14'))(_0x1026('0x15'));var utils=require(_0x1026('0x16'));var config=require(_0x1026('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1026('0x18'))['db'];function respondWithStatusCode(_0x1642e1,_0x4ec28c){_0x4ec28c=_0x4ec28c||0xcc;return function(_0x40575a){if(_0x40575a){return _0x1642e1['sendStatus'](_0x4ec28c);}return _0x1642e1[_0x1026('0x19')](_0x4ec28c)['end']();};}function respondWithResult(_0x57afd8,_0x176566){_0x176566=_0x176566||0xc8;return function(_0x4f7a6b){if(_0x4f7a6b){return _0x57afd8['status'](_0x176566)[_0x1026('0x1a')](_0x4f7a6b);}};}function respondWithFilteredResult(_0x4b314a,_0x48b16b){return function(_0x14a8cf){if(_0x14a8cf){var _0x507cbe=typeof _0x48b16b['offset']===_0x1026('0x1b')&&typeof _0x48b16b['limit']===_0x1026('0x1b');var _0x527a7f=_0x14a8cf[_0x1026('0x1c')];var _0x564a7b=_0x507cbe?0x0:_0x48b16b['offset'];var _0x131c7c=_0x507cbe?_0x14a8cf[_0x1026('0x1c')]:_0x48b16b[_0x1026('0x1d')]+_0x48b16b['limit'];var _0x2b39fe;if(_0x131c7c>=_0x527a7f){_0x131c7c=_0x527a7f;_0x2b39fe=0xc8;}else{_0x2b39fe=0xce;}_0x4b314a[_0x1026('0x19')](_0x2b39fe);return _0x4b314a[_0x1026('0x1e')](_0x1026('0x1f'),_0x564a7b+'-'+_0x131c7c+'/'+_0x527a7f)['json'](_0x14a8cf);}return null;};}function patchUpdates(_0xe6fedb){return function(_0x5a7dd9){try{jsonpatch[_0x1026('0x20')](_0x5a7dd9,_0xe6fedb,!![]);}catch(_0x5f1540){return BPromise[_0x1026('0x21')](_0x5f1540);}return _0x5a7dd9[_0x1026('0x22')]();};}function saveUpdates(_0x34a3b0,_0x4b2752){return function(_0x795f40){if(_0x795f40){return _0x795f40[_0x1026('0x23')](_0x34a3b0)[_0x1026('0x24')](function(_0x4b8806){return _0x4b8806;});}return null;};}function removeEntity(_0x225f07,_0x44316d){return function(_0x28daed){if(_0x28daed){return _0x28daed[_0x1026('0x25')]()['then'](function(){_0x225f07['status'](0xcc)[_0x1026('0x26')]();});}};}function handleEntityNotFound(_0x402208,_0x21cdb3){return function(_0x4c5559){if(!_0x4c5559){_0x402208['sendStatus'](0x194);}return _0x4c5559;};}function handleError(_0x1c882b,_0x27dd35){_0x27dd35=_0x27dd35||0x1f4;return function(_0x3ce6f0){logger[_0x1026('0x27')](_0x3ce6f0[_0x1026('0x28')]);if(_0x3ce6f0[_0x1026('0x29')]){delete _0x3ce6f0['name'];}_0x1c882b[_0x1026('0x19')](_0x27dd35)['send'](_0x3ce6f0);};}exports[_0x1026('0x2a')]=function(_0x18138e,_0x26a664){var _0x42a567={},_0x3122a0={},_0x48787a={'count':0x0,'rows':[]};var _0x26f5e7=_['map'](db[_0x1026('0x2b')][_0x1026('0x2c')],function(_0x5e7a92){return{'name':_0x5e7a92[_0x1026('0x2d')],'type':_0x5e7a92[_0x1026('0x2e')][_0x1026('0x2f')]};});_0x3122a0[_0x1026('0x30')]=_['map'](_0x26f5e7,'name');_0x3122a0[_0x1026('0x31')]=_[_0x1026('0x32')](_0x18138e[_0x1026('0x31')]);_0x3122a0[_0x1026('0x33')]=_[_0x1026('0x34')](_0x3122a0[_0x1026('0x30')],_0x3122a0[_0x1026('0x31')]);_0x42a567[_0x1026('0x35')]=_['intersection'](_0x3122a0[_0x1026('0x30')],qs['fields'](_0x18138e[_0x1026('0x31')][_0x1026('0x36')]));_0x42a567[_0x1026('0x35')]=_0x42a567[_0x1026('0x35')][_0x1026('0x37')]?_0x42a567['attributes']:_0x3122a0[_0x1026('0x30')];if(!_0x18138e['query'][_0x1026('0x38')](_0x1026('0x39'))){_0x42a567[_0x1026('0x3a')]=qs[_0x1026('0x3a')](_0x18138e[_0x1026('0x31')][_0x1026('0x3a')]);_0x42a567[_0x1026('0x1d')]=qs['offset'](_0x18138e['query']['offset']);}_0x42a567['order']=qs['sort'](_0x18138e[_0x1026('0x31')]['sort']);_0x42a567[_0x1026('0x3b')]=qs[_0x1026('0x33')](_['pick'](_0x18138e[_0x1026('0x31')],_0x3122a0['filters']),_0x26f5e7);if(_0x18138e['query'][_0x1026('0x3c')]){_0x42a567[_0x1026('0x3b')]=_[_0x1026('0x3d')](_0x42a567[_0x1026('0x3b')],{'$or':_[_0x1026('0x3e')](_0x26f5e7,function(_0xcf6c9c){if(_0xcf6c9c[_0x1026('0x2e')]!==_0x1026('0x3f')){var _0x1b076b={};_0x1b076b[_0xcf6c9c[_0x1026('0x29')]]={'$like':'%'+_0x18138e[_0x1026('0x31')][_0x1026('0x3c')]+'%'};return _0x1b076b;}})});}_0x42a567=_[_0x1026('0x3d')]({},_0x42a567,_0x18138e[_0x1026('0x40')]);var _0x4a5ea7={'where':_0x42a567[_0x1026('0x3b')]};return db[_0x1026('0x2b')][_0x1026('0x1c')](_0x4a5ea7)['then'](function(_0x1fe6f3){_0x48787a['count']=_0x1fe6f3;if(_0x18138e['query'][_0x1026('0x41')]){_0x42a567[_0x1026('0x42')]=[{'all':!![]}];}return db[_0x1026('0x2b')][_0x1026('0x43')](_0x42a567);})[_0x1026('0x24')](function(_0x3b0191){_0x48787a['rows']=_0x3b0191;return _0x48787a;})[_0x1026('0x24')](respondWithFilteredResult(_0x26a664,_0x42a567))[_0x1026('0x44')](handleError(_0x26a664,null));};exports[_0x1026('0x45')]=function(_0x317528,_0x2ae6db){var _0x4ac299={'raw':!![],'where':{'id':_0x317528[_0x1026('0x46')]['id']}},_0x4c106d={};_0x4c106d['model']=_[_0x1026('0x32')](db[_0x1026('0x2b')][_0x1026('0x2c')]);_0x4c106d[_0x1026('0x31')]=_['keys'](_0x317528['query']);_0x4c106d[_0x1026('0x33')]=_[_0x1026('0x34')](_0x4c106d[_0x1026('0x30')],_0x4c106d[_0x1026('0x31')]);_0x4ac299[_0x1026('0x35')]=_[_0x1026('0x34')](_0x4c106d[_0x1026('0x30')],qs[_0x1026('0x36')](_0x317528[_0x1026('0x31')][_0x1026('0x36')]));_0x4ac299[_0x1026('0x35')]=_0x4ac299['attributes'][_0x1026('0x37')]?_0x4ac299[_0x1026('0x35')]:_0x4c106d[_0x1026('0x30')];if(_0x317528[_0x1026('0x31')]['includeAll']){_0x4ac299[_0x1026('0x42')]=[{'all':!![]}];}_0x4ac299=_[_0x1026('0x3d')]({},_0x4ac299,_0x317528['options']);return db[_0x1026('0x2b')][_0x1026('0x47')](_0x4ac299)[_0x1026('0x24')](handleEntityNotFound(_0x2ae6db,null))[_0x1026('0x24')](respondWithResult(_0x2ae6db,null))[_0x1026('0x44')](handleError(_0x2ae6db,null));};exports[_0x1026('0x48')]=function(_0x49a54a,_0x2855ed){return db['FreshsalesField']['create'](_0x49a54a[_0x1026('0x49')],{})[_0x1026('0x24')](respondWithResult(_0x2855ed,0xc9))[_0x1026('0x44')](handleError(_0x2855ed,null));};exports[_0x1026('0x23')]=function(_0x30ceb2,_0x454cb1){if(_0x30ceb2['body']['id']){delete _0x30ceb2['body']['id'];}return db[_0x1026('0x2b')][_0x1026('0x47')]({'where':{'id':_0x30ceb2['params']['id']}})[_0x1026('0x24')](handleEntityNotFound(_0x454cb1,null))[_0x1026('0x24')](saveUpdates(_0x30ceb2[_0x1026('0x49')],null))[_0x1026('0x24')](respondWithResult(_0x454cb1,null))[_0x1026('0x44')](handleError(_0x454cb1,null));};exports[_0x1026('0x25')]=function(_0x31531c,_0x38becd){return db[_0x1026('0x2b')][_0x1026('0x47')]({'where':{'id':_0x31531c[_0x1026('0x46')]['id']}})[_0x1026('0x24')](handleEntityNotFound(_0x38becd,null))[_0x1026('0x24')](removeEntity(_0x38becd,null))[_0x1026('0x44')](handleError(_0x38becd,null));}; \ No newline at end of file +var _0xa89e=['../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','update','then','sendStatus','stack','name','index','map','FreshsalesField','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','find','create','body','params','catch','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x54945a,_0x3e000b){var _0x508756=function(_0x2758f2){while(--_0x2758f2){_0x54945a['push'](_0x54945a['shift']());}};_0x508756(++_0x3e000b);}(_0xa89e,0x1ef));var _0xea89=function(_0x228b40,_0x40b51f){_0x228b40=_0x228b40-0x0;var _0x1407bb=_0xa89e[_0x228b40];return _0x1407bb;};'use strict';var emlformat=require(_0xea89('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xea89('0x1'));var rp=require(_0xea89('0x2'));var moment=require(_0xea89('0x3'));var BPromise=require(_0xea89('0x4'));var Mustache=require(_0xea89('0x5'));var util=require(_0xea89('0x6'));var path=require(_0xea89('0x7'));var sox=require(_0xea89('0x8'));var csv=require(_0xea89('0x9'));var ejs=require(_0xea89('0xa'));var fs=require('fs');var fs_extra=require(_0xea89('0xb'));var _=require(_0xea89('0xc'));var squel=require(_0xea89('0xd'));var crypto=require(_0xea89('0xe'));var jsforce=require(_0xea89('0xf'));var deskjs=require(_0xea89('0x10'));var toCsv=require('to-csv');var querystring=require(_0xea89('0x11'));var Papa=require(_0xea89('0x12'));var Redis=require(_0xea89('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xea89('0x14'));var as=require(_0xea89('0x15'));var hardwareService=require(_0xea89('0x16'));var logger=require(_0xea89('0x17'))('api');var utils=require(_0xea89('0x18'));var config=require(_0xea89('0x19'));var licenseUtil=require(_0xea89('0x1a'));var db=require(_0xea89('0x1b'))['db'];function respondWithStatusCode(_0x144235,_0x3ec83c){_0x3ec83c=_0x3ec83c||0xcc;return function(_0x160f63){if(_0x160f63){return _0x144235['sendStatus'](_0x3ec83c);}return _0x144235[_0xea89('0x1c')](_0x3ec83c)[_0xea89('0x1d')]();};}function respondWithResult(_0xca5e49,_0x95bb83){_0x95bb83=_0x95bb83||0xc8;return function(_0x17d66a){if(_0x17d66a){return _0xca5e49['status'](_0x95bb83)['json'](_0x17d66a);}};}function respondWithFilteredResult(_0x1ff54d,_0x4c0c79){return function(_0x111e9c){if(_0x111e9c){var _0x2b69e7=typeof _0x4c0c79[_0xea89('0x1e')]===_0xea89('0x1f')&&typeof _0x4c0c79['limit']===_0xea89('0x1f');var _0x5e2d40=_0x111e9c[_0xea89('0x20')];var _0x29aeee=_0x2b69e7?0x0:_0x4c0c79[_0xea89('0x1e')];var _0x533f01=_0x2b69e7?_0x111e9c[_0xea89('0x20')]:_0x4c0c79[_0xea89('0x1e')]+_0x4c0c79[_0xea89('0x21')];var _0x143958;if(_0x533f01>=_0x5e2d40){_0x533f01=_0x5e2d40;_0x143958=0xc8;}else{_0x143958=0xce;}_0x1ff54d[_0xea89('0x1c')](_0x143958);return _0x1ff54d[_0xea89('0x22')](_0xea89('0x23'),_0x29aeee+'-'+_0x533f01+'/'+_0x5e2d40)['json'](_0x111e9c);}return null;};}function patchUpdates(_0x108c0d){return function(_0x4dea27){try{jsonpatch['apply'](_0x4dea27,_0x108c0d,!![]);}catch(_0x390bf9){return BPromise['reject'](_0x390bf9);}return _0x4dea27['save']();};}function saveUpdates(_0x49e6ed,_0x7755cf){return function(_0x29914d){if(_0x29914d){return _0x29914d[_0xea89('0x24')](_0x49e6ed)[_0xea89('0x25')](function(_0x336c3e){return _0x336c3e;});}return null;};}function removeEntity(_0x26056d,_0x23bb0a){return function(_0x220fb8){if(_0x220fb8){return _0x220fb8['destroy']()['then'](function(){_0x26056d['status'](0xcc)[_0xea89('0x1d')]();});}};}function handleEntityNotFound(_0x41a861,_0x3c2ffb){return function(_0x4c34a1){if(!_0x4c34a1){_0x41a861[_0xea89('0x26')](0x194);}return _0x4c34a1;};}function handleError(_0x44c5ca,_0x6d9a7d){_0x6d9a7d=_0x6d9a7d||0x1f4;return function(_0x5c6dc1){logger['error'](_0x5c6dc1[_0xea89('0x27')]);if(_0x5c6dc1[_0xea89('0x28')]){delete _0x5c6dc1[_0xea89('0x28')];}_0x44c5ca['status'](_0x6d9a7d)['send'](_0x5c6dc1);};}exports[_0xea89('0x29')]=function(_0x54109a,_0x39a6f4){var _0x4c8e5d={},_0x28c629={},_0x5d3674={'count':0x0,'rows':[]};var _0x3eaa50=_[_0xea89('0x2a')](db[_0xea89('0x2b')][_0xea89('0x2c')],function(_0x58a5fc){return{'name':_0x58a5fc['fieldName'],'type':_0x58a5fc['type']['key']};});_0x28c629[_0xea89('0x2d')]=_[_0xea89('0x2a')](_0x3eaa50,_0xea89('0x28'));_0x28c629[_0xea89('0x2e')]=_[_0xea89('0x2f')](_0x54109a[_0xea89('0x2e')]);_0x28c629['filters']=_[_0xea89('0x30')](_0x28c629['model'],_0x28c629[_0xea89('0x2e')]);_0x4c8e5d[_0xea89('0x31')]=_[_0xea89('0x30')](_0x28c629[_0xea89('0x2d')],qs['fields'](_0x54109a[_0xea89('0x2e')][_0xea89('0x32')]));_0x4c8e5d[_0xea89('0x31')]=_0x4c8e5d[_0xea89('0x31')][_0xea89('0x33')]?_0x4c8e5d[_0xea89('0x31')]:_0x28c629[_0xea89('0x2d')];if(!_0x54109a[_0xea89('0x2e')][_0xea89('0x34')](_0xea89('0x35'))){_0x4c8e5d[_0xea89('0x21')]=qs[_0xea89('0x21')](_0x54109a['query'][_0xea89('0x21')]);_0x4c8e5d[_0xea89('0x1e')]=qs[_0xea89('0x1e')](_0x54109a[_0xea89('0x2e')][_0xea89('0x1e')]);}_0x4c8e5d[_0xea89('0x36')]=qs[_0xea89('0x37')](_0x54109a[_0xea89('0x2e')][_0xea89('0x37')]);_0x4c8e5d[_0xea89('0x38')]=qs['filters'](_[_0xea89('0x39')](_0x54109a[_0xea89('0x2e')],_0x28c629[_0xea89('0x3a')]),_0x3eaa50);if(_0x54109a['query']['filter']){_0x4c8e5d[_0xea89('0x38')]=_[_0xea89('0x3b')](_0x4c8e5d['where'],{'$or':_['map'](_0x3eaa50,function(_0x55bdb1){if(_0x55bdb1[_0xea89('0x3c')]!==_0xea89('0x3d')){var _0x129875={};_0x129875[_0x55bdb1['name']]={'$like':'%'+_0x54109a[_0xea89('0x2e')][_0xea89('0x3e')]+'%'};return _0x129875;}})});}_0x4c8e5d=_[_0xea89('0x3b')]({},_0x4c8e5d,_0x54109a[_0xea89('0x3f')]);var _0x115640={'where':_0x4c8e5d['where']};return db[_0xea89('0x2b')][_0xea89('0x20')](_0x115640)[_0xea89('0x25')](function(_0x4aa947){_0x5d3674[_0xea89('0x20')]=_0x4aa947;if(_0x54109a['query'][_0xea89('0x40')]){_0x4c8e5d['include']=[{'all':!![]}];}return db[_0xea89('0x2b')][_0xea89('0x41')](_0x4c8e5d);})[_0xea89('0x25')](function(_0x38ff0e){_0x5d3674[_0xea89('0x42')]=_0x38ff0e;return _0x5d3674;})[_0xea89('0x25')](respondWithFilteredResult(_0x39a6f4,_0x4c8e5d))['catch'](handleError(_0x39a6f4,null));};exports[_0xea89('0x43')]=function(_0xebb58b,_0x4b208d){var _0x505a89={'raw':!![],'where':{'id':_0xebb58b['params']['id']}},_0x5dbf90={};_0x5dbf90[_0xea89('0x2d')]=_[_0xea89('0x2f')](db[_0xea89('0x2b')][_0xea89('0x2c')]);_0x5dbf90['query']=_[_0xea89('0x2f')](_0xebb58b['query']);_0x5dbf90[_0xea89('0x3a')]=_[_0xea89('0x30')](_0x5dbf90[_0xea89('0x2d')],_0x5dbf90[_0xea89('0x2e')]);_0x505a89[_0xea89('0x31')]=_[_0xea89('0x30')](_0x5dbf90[_0xea89('0x2d')],qs['fields'](_0xebb58b[_0xea89('0x2e')][_0xea89('0x32')]));_0x505a89['attributes']=_0x505a89[_0xea89('0x31')]['length']?_0x505a89[_0xea89('0x31')]:_0x5dbf90[_0xea89('0x2d')];if(_0xebb58b[_0xea89('0x2e')][_0xea89('0x40')]){_0x505a89['include']=[{'all':!![]}];}_0x505a89=_[_0xea89('0x3b')]({},_0x505a89,_0xebb58b['options']);return db['FreshsalesField'][_0xea89('0x44')](_0x505a89)[_0xea89('0x25')](handleEntityNotFound(_0x4b208d,null))[_0xea89('0x25')](respondWithResult(_0x4b208d,null))['catch'](handleError(_0x4b208d,null));};exports[_0xea89('0x45')]=function(_0x3f2bab,_0x13534b){return db['FreshsalesField'][_0xea89('0x45')](_0x3f2bab[_0xea89('0x46')],{})[_0xea89('0x25')](respondWithResult(_0x13534b,0xc9))['catch'](handleError(_0x13534b,null));};exports[_0xea89('0x24')]=function(_0x4e5d5e,_0x1d1d0f){if(_0x4e5d5e[_0xea89('0x46')]['id']){delete _0x4e5d5e[_0xea89('0x46')]['id'];}return db[_0xea89('0x2b')][_0xea89('0x44')]({'where':{'id':_0x4e5d5e[_0xea89('0x47')]['id']}})[_0xea89('0x25')](handleEntityNotFound(_0x1d1d0f,null))[_0xea89('0x25')](saveUpdates(_0x4e5d5e[_0xea89('0x46')],null))[_0xea89('0x25')](respondWithResult(_0x1d1d0f,null))[_0xea89('0x48')](handleError(_0x1d1d0f,null));};exports[_0xea89('0x49')]=function(_0x587fb7,_0x2bf644){return db[_0xea89('0x2b')]['find']({'where':{'id':_0x587fb7['params']['id']}})['then'](handleEntityNotFound(_0x2bf644,null))[_0xea89('0x25')](removeEntity(_0x2bf644,null))[_0xea89('0x48')](handleError(_0x2bf644,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 574c85a..29afbf8 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 _0xce62=['exports','define','FreshsalesField','freshsales_unique_index','idField','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesField.attributes'];(function(_0x55d911,_0x2b768c){var _0x3104c2=function(_0x1b4386){while(--_0x1b4386){_0x55d911['push'](_0x55d911['shift']());}};_0x3104c2(++_0x2b768c);}(_0xce62,0x83));var _0x2ce6=function(_0x4d97da,_0x1e17bb){_0x4d97da=_0x4d97da-0x0;var _0x4e0e8b=_0xce62[_0x4d97da];return _0x4e0e8b;};'use strict';var _=require(_0x2ce6('0x0'));var util=require(_0x2ce6('0x1'));var logger=require('../../config/logger')(_0x2ce6('0x2'));var moment=require(_0x2ce6('0x3'));var BPromise=require(_0x2ce6('0x4'));var rp=require(_0x2ce6('0x5'));var fs=require('fs');var path=require(_0x2ce6('0x6'));var rimraf=require(_0x2ce6('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ce6('0x8'));module[_0x2ce6('0x9')]=function(_0x422f72,_0x9bbac8){return _0x422f72[_0x2ce6('0xa')](_0x2ce6('0xb'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2ce6('0xc'),'fields':[_0x2ce6('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc06d=['../../config/logger','api','bluebird','request-promise','../../config/environment','exports','FreshsalesField','int_freshsales_fields','idField','FieldId','lodash','util'];(function(_0xf2de91,_0x1e8793){var _0x378bcb=function(_0x2ba264){while(--_0x2ba264){_0xf2de91['push'](_0xf2de91['shift']());}};_0x378bcb(++_0x1e8793);}(_0xc06d,0x15a));var _0xdc06=function(_0x30a650,_0x27ef58){_0x30a650=_0x30a650-0x0;var _0x2ce8f4=_0xc06d[_0x30a650];return _0x2ce8f4;};'use strict';var _=require(_0xdc06('0x0'));var util=require(_0xdc06('0x1'));var logger=require(_0xdc06('0x2'))(_0xdc06('0x3'));var moment=require('moment');var BPromise=require(_0xdc06('0x4'));var rp=require(_0xdc06('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdc06('0x6'));var attributes=require('./intFreshsalesField.attributes');module[_0xdc06('0x7')]=function(_0x2f7692,_0x5ce60c){return _0x2f7692['define'](_0xdc06('0x8'),attributes,{'tableName':_0xdc06('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xdc06('0xa'),_0xdc06('0xb')],'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 c609782..79fe1aa 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 _0x5d17=['request','info','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x37dd7b,_0x29619d){var _0x548856=function(_0x5f62ff){while(--_0x5f62ff){_0x37dd7b['push'](_0x37dd7b['shift']());}};_0x548856(++_0x29619d);}(_0x5d17,0x114));var _0x75d1=function(_0x40ea21,_0xe55b66){_0x40ea21=_0x40ea21-0x0;var _0x555e46=_0x5d17[_0x40ea21];return _0x555e46;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x75d1('0x2'));var fs=require('fs');var Redis=require(_0x75d1('0x3'));var db=require(_0x75d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x75d1('0x5'))(_0x75d1('0x6'));var config=require(_0x75d1('0x7'));var jayson=require(_0x75d1('0x8'));var client=jayson['client'][_0x75d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x116a51,_0x5c957a,_0x1ee61b){return new BPromise(function(_0x3a9d5e,_0x105607){return client[_0x75d1('0xa')](_0x116a51,_0x1ee61b)['then'](function(_0x4cf632){logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,'request\x20sent');logger[_0x75d1('0xc')](_0x75d1('0xd'),_0x5c957a,'request\x20sent',JSON[_0x75d1('0xe')](_0x4cf632));if(_0x4cf632[_0x75d1('0xf')]){if(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x10')]===0x1f4){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x4cf632['error'][_0x75d1('0x12')]);return _0x105607(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}logger[_0x75d1('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x4cf632['error']['message']);return _0x3a9d5e(_0x4cf632[_0x75d1('0xf')][_0x75d1('0x12')]);}else{logger[_0x75d1('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x5c957a,_0x75d1('0x13'));_0x3a9d5e(_0x4cf632[_0x75d1('0x14')][_0x75d1('0x12')]);}})[_0x75d1('0x15')](function(_0x1160ca){logger[_0x75d1('0xf')](_0x75d1('0x11'),_0x5c957a,_0x1160ca);_0x105607(_0x1160ca);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','FreshsalesField,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x576eb7,_0x15c9df){var _0x223313=function(_0x499881){while(--_0x499881){_0x576eb7['push'](_0x576eb7['shift']());}};_0x223313(++_0x15c9df);}(_0x71ab,0x64));var _0xb71a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x71ab[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 84a5ce9..61ec049 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(_0x2ae817,_0x180ee6){var _0x546f7a=function(_0xf7e60d){while(--_0xf7e60d){_0x2ae817['push'](_0x2ae817['shift']());}};_0x546f7a(++_0x180ee6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0xa96d98,_0x561b4a){var _0x146571=function(_0x38ef14){while(--_0x38ef14){_0xa96d98['push'](_0xa96d98['shift']());}};_0x146571(++_0x561b4a);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 7f96732..940e617 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 _0xba79=['exports','STRING','newTab','integrationTab','sequelize'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xba79,0x153));var _0x9ba7=function(_0x56fc4f,_0xd1f6a){_0x56fc4f=_0x56fc4f-0x0;var _0x5d0c0b=_0xba79[_0x56fc4f];return _0x5d0c0b;};'use strict';var Sequelize=require(_0x9ba7('0x0'));module[_0x9ba7('0x1')]={'name':{'type':Sequelize[_0x9ba7('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9ba7('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9ba7('0x2')]},'clientId':{'type':Sequelize[_0x9ba7('0x2')]},'clientSecret':{'type':Sequelize[_0x9ba7('0x2')]},'securityToken':{'type':Sequelize[_0x9ba7('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x9ba7('0x3')),'defaultValue':_0x9ba7('0x4')}}; \ No newline at end of file +var _0xb4b6=['newTab','exports','STRING','username','integrationTab'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xb4b6,0x7e));var _0x6b4b=function(_0x582dda,_0x178899){_0x582dda=_0x582dda-0x0;var _0xc41517=_0xb4b6[_0x582dda];return _0xc41517;};'use strict';var Sequelize=require('sequelize');module[_0x6b4b('0x0')]={'name':{'type':Sequelize[_0x6b4b('0x1')]},'description':{'type':Sequelize[_0x6b4b('0x1')]},'username':{'type':Sequelize[_0x6b4b('0x1')],'unique':_0x6b4b('0x2')},'remoteUri':{'type':Sequelize[_0x6b4b('0x1')]},'password':{'type':Sequelize[_0x6b4b('0x1')]},'clientId':{'type':Sequelize[_0x6b4b('0x1')]},'clientSecret':{'type':Sequelize[_0x6b4b('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6b4b('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6b4b('0x3'),_0x6b4b('0x4')),'defaultValue':_0x6b4b('0x3')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 2130e02..111dcba 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 _0xd53f=['../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','order','filter','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','slice','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','Subject','string','int','picklist','boolean','email','phone','remove','includes','custom','picklistValues','label','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x12cf7f,_0xfda4f5){var _0x316ca0=function(_0x243e0c){while(--_0x243e0c){_0x12cf7f['push'](_0x12cf7f['shift']());}};_0x316ca0(++_0xfda4f5);}(_0xd53f,0x162));var _0xfd53=function(_0x8efaf0,_0x46c3f2){_0x8efaf0=_0x8efaf0-0x0;var _0x4b46de=_0xd53f[_0x8efaf0];return _0x4b46de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd53('0x0'));var zipdir=require(_0xfd53('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd53('0x2'));var moment=require('moment');var BPromise=require(_0xfd53('0x3'));var Mustache=require(_0xfd53('0x4'));var util=require('util');var path=require(_0xfd53('0x5'));var sox=require(_0xfd53('0x6'));var csv=require(_0xfd53('0x7'));var ejs=require(_0xfd53('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfd53('0x9'));var crypto=require(_0xfd53('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xfd53('0xb'));var toCsv=require(_0xfd53('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd53('0xc'));var authService=require(_0xfd53('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfd53('0xe'));var hardwareService=require(_0xfd53('0xf'));var logger=require(_0xfd53('0x10'))(_0xfd53('0x11'));var utils=require(_0xfd53('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xfd53('0x13'));var db=require(_0xfd53('0x14'))['db'];var integrations=require(_0xfd53('0x15'));function respondWithStatusCode(_0x1e6d81,_0x57be3b){_0x57be3b=_0x57be3b||0xcc;return function(_0x1e2d30){if(_0x1e2d30){return _0x1e6d81[_0xfd53('0x16')](_0x57be3b);}return _0x1e6d81[_0xfd53('0x17')](_0x57be3b)[_0xfd53('0x18')]();};}function respondWithResult(_0x41617b,_0x823cbb){_0x823cbb=_0x823cbb||0xc8;return function(_0x59c868){if(_0x59c868){return _0x41617b['status'](_0x823cbb)[_0xfd53('0x19')](_0x59c868);}};}function respondWithFilteredResult(_0x5641c1,_0x54d63b){return function(_0xe221c9){if(_0xe221c9){var _0x4d9cc9=typeof _0x54d63b['offset']===_0xfd53('0x1a')&&typeof _0x54d63b[_0xfd53('0x1b')]===_0xfd53('0x1a');var _0x427ffd=_0xe221c9['count'];var _0x472ba9=_0x4d9cc9?0x0:_0x54d63b['offset'];var _0x346022=_0x4d9cc9?_0xe221c9['count']:_0x54d63b[_0xfd53('0x1c')]+_0x54d63b['limit'];var _0x1f0015;if(_0x346022>=_0x427ffd){_0x346022=_0x427ffd;_0x1f0015=0xc8;}else{_0x1f0015=0xce;}_0x5641c1[_0xfd53('0x17')](_0x1f0015);return _0x5641c1['set'](_0xfd53('0x1d'),_0x472ba9+'-'+_0x346022+'/'+_0x427ffd)[_0xfd53('0x19')](_0xe221c9);}return null;};}function patchUpdates(_0x10a8be){return function(_0x532a69){try{jsonpatch[_0xfd53('0x1e')](_0x532a69,_0x10a8be,!![]);}catch(_0x1a34e9){return BPromise[_0xfd53('0x1f')](_0x1a34e9);}return _0x532a69[_0xfd53('0x20')]();};}function saveUpdates(_0x433a13,_0x151375){return function(_0x2396e2){if(_0x2396e2){return _0x2396e2[_0xfd53('0x21')](_0x433a13)[_0xfd53('0x22')](function(_0x1a6742){return _0x1a6742;});}return null;};}function removeEntity(_0x3d1ca6,_0x481e21){return function(_0x41ee8e){if(_0x41ee8e){return _0x41ee8e[_0xfd53('0x23')]()[_0xfd53('0x22')](function(){_0x3d1ca6[_0xfd53('0x17')](0xcc)[_0xfd53('0x18')]();});}};}function handleEntityNotFound(_0x10e3a,_0x5a1789){return function(_0x5d78a3){if(!_0x5d78a3){_0x10e3a['sendStatus'](0x194);}return _0x5d78a3;};}function handleError(_0x11ec35,_0x4a198b){_0x4a198b=_0x4a198b||0x1f4;return function(_0xab07){logger[_0xfd53('0x24')](_0xab07[_0xfd53('0x25')]);if(_0xab07[_0xfd53('0x26')]){delete _0xab07[_0xfd53('0x26')];}_0x11ec35['status'](_0x4a198b)[_0xfd53('0x27')](_0xab07);};}exports[_0xfd53('0x28')]=function(_0xeda3fc,_0x3f4652){var _0x1233b5={},_0x5506b4={},_0x5558ac={'count':0x0,'rows':[]};var _0x1bd885=_[_0xfd53('0x29')](db[_0xfd53('0x2a')][_0xfd53('0x2b')],function(_0x11cd28){return{'name':_0x11cd28[_0xfd53('0x2c')],'type':_0x11cd28[_0xfd53('0x2d')][_0xfd53('0x2e')]};});_0x5506b4[_0xfd53('0x2f')]=_[_0xfd53('0x29')](_0x1bd885,_0xfd53('0x26'));_0x5506b4[_0xfd53('0x30')]=_[_0xfd53('0x31')](_0xeda3fc[_0xfd53('0x30')]);_0x5506b4[_0xfd53('0x32')]=_[_0xfd53('0x33')](_0x5506b4[_0xfd53('0x2f')],_0x5506b4[_0xfd53('0x30')]);_0x1233b5[_0xfd53('0x34')]=_[_0xfd53('0x33')](_0x5506b4['model'],qs['fields'](_0xeda3fc[_0xfd53('0x30')][_0xfd53('0x35')]));_0x1233b5[_0xfd53('0x34')]=_0x1233b5[_0xfd53('0x34')][_0xfd53('0x36')]?_0x1233b5['attributes']:_0x5506b4[_0xfd53('0x2f')];if(!_0xeda3fc[_0xfd53('0x30')]['hasOwnProperty'](_0xfd53('0x37'))){_0x1233b5['limit']=qs[_0xfd53('0x1b')](_0xeda3fc[_0xfd53('0x30')][_0xfd53('0x1b')]);_0x1233b5[_0xfd53('0x1c')]=qs[_0xfd53('0x1c')](_0xeda3fc[_0xfd53('0x30')][_0xfd53('0x1c')]);}_0x1233b5['order']=qs[_0xfd53('0x38')](_0xeda3fc[_0xfd53('0x30')]['sort']);_0x1233b5[_0xfd53('0x39')]=qs[_0xfd53('0x32')](_[_0xfd53('0x3a')](_0xeda3fc[_0xfd53('0x30')],_0x5506b4[_0xfd53('0x32')]),_0x1bd885);if(_0xeda3fc[_0xfd53('0x30')]['filter']){_0x1233b5['where']=_['merge'](_0x1233b5[_0xfd53('0x39')],{'$or':_[_0xfd53('0x29')](_0x1bd885,function(_0x584b49){if(_0x584b49[_0xfd53('0x2d')]!==_0xfd53('0x3b')){var _0x49f042={};_0x49f042[_0x584b49[_0xfd53('0x26')]]={'$like':'%'+_0xeda3fc[_0xfd53('0x30')]['filter']+'%'};return _0x49f042;}})});}_0x1233b5=_[_0xfd53('0x3c')]({},_0x1233b5,_0xeda3fc[_0xfd53('0x3d')]);var _0x117484={'where':_0x1233b5[_0xfd53('0x39')]};return db[_0xfd53('0x2a')][_0xfd53('0x3e')](_0x117484)['then'](function(_0x22b47b){_0x5558ac[_0xfd53('0x3e')]=_0x22b47b;if(_0xeda3fc[_0xfd53('0x30')][_0xfd53('0x3f')]){_0x1233b5[_0xfd53('0x40')]=[{'all':!![]}];}return db['SalesforceAccount'][_0xfd53('0x41')](_0x1233b5);})['then'](function(_0x1d77fa){_0x5558ac['rows']=_0x1d77fa;return _0x5558ac;})[_0xfd53('0x22')](respondWithFilteredResult(_0x3f4652,_0x1233b5))[_0xfd53('0x42')](handleError(_0x3f4652,null));};exports[_0xfd53('0x43')]=function(_0x3f015e,_0x3be12b){var _0x2f1531={'raw':![],'where':{'id':_0x3f015e[_0xfd53('0x44')]['id']}},_0x3b44fc={};_0x3b44fc['model']=_[_0xfd53('0x31')](db[_0xfd53('0x2a')][_0xfd53('0x2b')]);_0x3b44fc[_0xfd53('0x30')]=_[_0xfd53('0x31')](_0x3f015e['query']);_0x3b44fc['filters']=_['intersection'](_0x3b44fc[_0xfd53('0x2f')],_0x3b44fc[_0xfd53('0x30')]);_0x2f1531[_0xfd53('0x34')]=_[_0xfd53('0x33')](_0x3b44fc[_0xfd53('0x2f')],qs[_0xfd53('0x35')](_0x3f015e[_0xfd53('0x30')]['fields']));_0x2f1531['attributes']=_0x2f1531[_0xfd53('0x34')]['length']?_0x2f1531[_0xfd53('0x34')]:_0x3b44fc['model'];if(_0x3f015e[_0xfd53('0x30')][_0xfd53('0x3f')]){_0x2f1531[_0xfd53('0x40')]=[{'all':!![]}];}_0x2f1531=_[_0xfd53('0x3c')]({},_0x2f1531,_0x3f015e['options']);return db[_0xfd53('0x2a')][_0xfd53('0x45')](_0x2f1531)[_0xfd53('0x22')](handleEntityNotFound(_0x3be12b,null))['then'](respondWithResult(_0x3be12b,null))[_0xfd53('0x42')](handleError(_0x3be12b,null));};exports[_0xfd53('0x46')]=function(_0x5e704f,_0x1d8288){return db['SalesforceAccount']['create'](_0x5e704f[_0xfd53('0x47')],{})[_0xfd53('0x22')](respondWithResult(_0x1d8288,0xc9))[_0xfd53('0x42')](handleError(_0x1d8288,null));};exports[_0xfd53('0x21')]=function(_0x533d4f,_0x4f755f){if(_0x533d4f['body']['id']){delete _0x533d4f[_0xfd53('0x47')]['id'];}return db[_0xfd53('0x2a')][_0xfd53('0x45')]({'where':{'id':_0x533d4f[_0xfd53('0x44')]['id']}})[_0xfd53('0x22')](handleEntityNotFound(_0x4f755f,null))[_0xfd53('0x22')](saveUpdates(_0x533d4f[_0xfd53('0x47')],null))[_0xfd53('0x22')](respondWithResult(_0x4f755f,null))[_0xfd53('0x42')](handleError(_0x4f755f,null));};exports[_0xfd53('0x23')]=function(_0x57bbde,_0x5e051e){return db[_0xfd53('0x2a')][_0xfd53('0x45')]({'where':{'id':_0x57bbde['params']['id']}})[_0xfd53('0x22')](handleEntityNotFound(_0x5e051e,null))[_0xfd53('0x22')](removeEntity(_0x5e051e,null))[_0xfd53('0x42')](handleError(_0x5e051e,null));};exports[_0xfd53('0x48')]=function(_0x28d5e1,_0x1b2ddd,_0x206351){var _0xf4bc07={};var _0x274632={};var _0x313398;var _0x57f665;return db[_0xfd53('0x2a')][_0xfd53('0x49')]({'where':{'id':_0x28d5e1[_0xfd53('0x44')]['id']}})[_0xfd53('0x22')](handleEntityNotFound(_0x1b2ddd,null))['then'](function(_0x5b911a){if(_0x5b911a){_0x313398=_0x5b911a;_0x274632['model']=_[_0xfd53('0x31')](db[_0xfd53('0x4a')][_0xfd53('0x2b')]);_0x274632['query']=_['keys'](_0x28d5e1['query']);_0x274632[_0xfd53('0x32')]=_[_0xfd53('0x33')](_0x274632[_0xfd53('0x2f')],_0x274632[_0xfd53('0x30')]);_0xf4bc07[_0xfd53('0x34')]=_['intersection'](_0x274632[_0xfd53('0x2f')],qs['fields'](_0x28d5e1[_0xfd53('0x30')][_0xfd53('0x35')]));_0xf4bc07[_0xfd53('0x34')]=_0xf4bc07[_0xfd53('0x34')][_0xfd53('0x36')]?_0xf4bc07[_0xfd53('0x34')]:_0x274632['model'];_0xf4bc07[_0xfd53('0x4b')]=qs[_0xfd53('0x38')](_0x28d5e1[_0xfd53('0x30')][_0xfd53('0x38')]);_0xf4bc07['where']=qs[_0xfd53('0x32')](_[_0xfd53('0x3a')](_0x28d5e1[_0xfd53('0x30')],_0x274632[_0xfd53('0x32')]));if(_0x28d5e1[_0xfd53('0x30')][_0xfd53('0x4c')]){_0xf4bc07[_0xfd53('0x39')]=_[_0xfd53('0x3c')](_0xf4bc07[_0xfd53('0x39')],{'$or':_[_0xfd53('0x29')](_0xf4bc07['attributes'],function(_0x2c1d75){var _0x39954c={};_0x39954c[_0x2c1d75]={'$like':'%'+_0x28d5e1['query'][_0xfd53('0x4c')]+'%'};return _0x39954c;})});}_0xf4bc07=_[_0xfd53('0x3c')]({},_0xf4bc07,_0x28d5e1[_0xfd53('0x3d')]);return _0x313398[_0xfd53('0x48')](_0xf4bc07);}})['then'](function(_0xbe622a){if(_0xbe622a){_0x57f665=_0xbe622a[_0xfd53('0x36')];if(!_0x28d5e1[_0xfd53('0x30')][_0xfd53('0x4d')](_0xfd53('0x37'))){_0xf4bc07[_0xfd53('0x1b')]=qs['limit'](_0x28d5e1[_0xfd53('0x30')]['limit']);_0xf4bc07[_0xfd53('0x1c')]=qs[_0xfd53('0x1c')](_0x28d5e1[_0xfd53('0x30')]['offset']);}return _0x313398[_0xfd53('0x48')](_0xf4bc07);}})[_0xfd53('0x22')](function(_0x2f6c0f){if(_0x2f6c0f){return _0x2f6c0f?{'count':_0x57f665,'rows':_0x2f6c0f}:null;}})[_0xfd53('0x22')](respondWithResult(_0x1b2ddd,null))[_0xfd53('0x42')](handleError(_0x1b2ddd,null));};exports[_0xfd53('0x4e')]=function(_0x2d5d76,_0x19644e,_0x14fa5c){if(_0x2d5d76[_0xfd53('0x47')]['id']){delete _0x2d5d76['body']['id'];}return db[_0xfd53('0x2a')]['findOne']({'where':{'id':_0x2d5d76[_0xfd53('0x44')]['id']}})[_0xfd53('0x22')](handleEntityNotFound(_0x19644e,null))[_0xfd53('0x22')](function(_0x49bbe7){if(_0x49bbe7){_0x2d5d76['body'][_0xfd53('0x4f')]=_0x49bbe7['id'];_0x2d5d76[_0xfd53('0x47')][_0xfd53('0x50')]=integrations[_0xfd53('0x51')](_0x2d5d76['body'][_0xfd53('0x52')],_0x2d5d76[_0xfd53('0x47')]['type']);_0x2d5d76['body'][_0xfd53('0x53')]=integrations['getDescriptions'](_0x2d5d76[_0xfd53('0x47')][_0xfd53('0x52')],_0x2d5d76[_0xfd53('0x47')]['type']);return db[_0xfd53('0x4a')][_0xfd53('0x46')](_0x2d5d76[_0xfd53('0x47')],{'include':[{'model':db[_0xfd53('0x54')],'as':_0xfd53('0x50')},{'model':db[_0xfd53('0x54')],'as':_0xfd53('0x53')}]});}return null;})['then'](respondWithResult(_0x19644e,null))['catch'](handleError(_0x19644e,null));};exports[_0xfd53('0x55')]=function(_0x6b6ae7,_0x1b83b4,_0xa5e325){var _0x344769;var _0xfac9fc='';var _0x38195f=_0xfd53('0x56');return db['SalesforceAccount'][_0xfd53('0x49')]({'where':{'id':_0x6b6ae7['params']['id']},'attributes':['id','remoteUri',_0xfd53('0x57'),_0xfd53('0x58'),_0xfd53('0x59'),_0xfd53('0x5a'),_0xfd53('0x5b')]})[_0xfd53('0x22')](handleEntityNotFound(_0x1b83b4,null))[_0xfd53('0x22')](function(_0x3827a7){if(_0x3827a7){_0xfac9fc=_0x3827a7[_0xfd53('0x5c')];var _0x247943=_0xfac9fc[_0xfd53('0x5d')](-0x1);if(_0x247943==='/'){_0xfac9fc=_0xfac9fc['substring'](0x0,_0xfac9fc[_0xfd53('0x5e')](_0x247943));}_0x344769=new jsforce[(_0xfd53('0x5f'))]({'oauth2':{'loginUrl':_0xfac9fc,'clientId':_0x3827a7['clientId'],'clientSecret':_0x3827a7[_0xfd53('0x58')]}});return _0x344769[_0xfd53('0x60')](_0x3827a7['username'],_0x3827a7['password'][_0xfd53('0x61')](_0x3827a7[_0xfd53('0x5b')]));}})[_0xfd53('0x22')](function(_0x58e090){if(_0x58e090){if(!_[_0xfd53('0x62')](_0x6b6ae7['query'][_0xfd53('0x63')])){_0x38195f=_0x6b6ae7[_0xfd53('0x30')][_0xfd53('0x63')];}return _0x344769['sobject'](_0x38195f)[_0xfd53('0x64')]();}})[_0xfd53('0x22')](function(_0x2fe601){var _0x2224eb=[_0xfd53('0x65'),_0xfd53('0x66'),_0xfd53('0x67'),'IsRecurrence',_0xfd53('0x68'),'Description'];var _0x164544=[_0xfd53('0x69'),_0xfd53('0x6a'),_0xfd53('0x6b'),_0xfd53('0x6c'),_0xfd53('0x6d'),'textarea',_0xfd53('0x6e')];if(_0x2fe601){_[_0xfd53('0x6f')](_0x2fe601[_0xfd53('0x35')],function(_0x3bbdc7){return _0x2224eb[_0xfd53('0x70')](_0x3bbdc7['name'])||!_0x164544['includes'](_0x3bbdc7['type']);});return{'count':_0x2fe601[_0xfd53('0x35')][_0xfd53('0x36')],'rows':_[_0xfd53('0x29')](_0x2fe601[_0xfd53('0x35')],function(_0x577060){return{'id':_0x577060['name'],'name':_0x577060['label'],'custom':_0x577060[_0xfd53('0x71')],'options':_0x577060[_0xfd53('0x72')][_0xfd53('0x36')]>0x0?_[_0xfd53('0x29')](_0x577060['picklistValues'],function(_0x130539){return{'name':_0x130539[_0xfd53('0x73')],'value':_0x130539[_0xfd53('0x74')]};}):_0x577060[_0xfd53('0x2d')]==_0xfd53('0x6c')?[{'name':'True','value':_0xfd53('0x75')},{'name':_0xfd53('0x76'),'value':_0xfd53('0x77')}]:[]};})};}})[_0xfd53('0x22')](respondWithResult(_0x1b83b4,null))[_0xfd53('0x42')](function(_0x31ea74){var _0x3115d2=_0x6b6ae7[_0xfd53('0x30')][_0xfd53('0x78')]?0x1f4:_0x31ea74[_0xfd53('0x79')]||0x1f4;logger[_0xfd53('0x24')](_0xfd53('0x7a'),'getFields',_0x3115d2,JSON[_0xfd53('0x7b')](_0x31ea74));delete _0x31ea74['name'];if(_0x3115d2===0x191){_0x3115d2=0x190;}_0x1b83b4[_0xfd53('0x17')](_0x3115d2)[_0xfd53('0x27')](_0x6b6ae7[_0xfd53('0x30')][_0xfd53('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x31ea74[_0xfd53('0x79')]}:_0x31ea74);});}; \ No newline at end of file +var _0x35d6=['true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','catch','show','params','length','create','body','find','findOne','getConfigurations','AccountId','Subjects','channel','SalesforceConfiguration','SalesforceField','Descriptions','Task','clientId','username','password','securityToken','remoteUri','slice','substring','login','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','value'];(function(_0x436849,_0x430b00){var _0x5c5f73=function(_0x5bdf78){while(--_0x5bdf78){_0x436849['push'](_0x436849['shift']());}};_0x5c5f73(++_0x430b00);}(_0x35d6,0x1f4));var _0x635d=function(_0x15fd3f,_0x57159e){_0x15fd3f=_0x15fd3f-0x0;var _0x464ede=_0x35d6[_0x15fd3f];return _0x464ede;};'use strict';var emlformat=require(_0x635d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x635d('0x1'));var jsonpatch=require(_0x635d('0x2'));var rp=require(_0x635d('0x3'));var moment=require(_0x635d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x635d('0x5'));var util=require(_0x635d('0x6'));var path=require(_0x635d('0x7'));var sox=require(_0x635d('0x8'));var csv=require(_0x635d('0x9'));var ejs=require(_0x635d('0xa'));var fs=require('fs');var fs_extra=require(_0x635d('0xb'));var _=require(_0x635d('0xc'));var squel=require(_0x635d('0xd'));var crypto=require(_0x635d('0xe'));var jsforce=require(_0x635d('0xf'));var deskjs=require(_0x635d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x635d('0x11'));var Papa=require(_0x635d('0x12'));var Redis=require(_0x635d('0x13'));var authService=require(_0x635d('0x14'));var qs=require(_0x635d('0x15'));var as=require(_0x635d('0x16'));var hardwareService=require(_0x635d('0x17'));var logger=require('../../config/logger')(_0x635d('0x18'));var utils=require('../../config/utils');var config=require(_0x635d('0x19'));var licenseUtil=require(_0x635d('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0x635d('0x1b'));function respondWithStatusCode(_0x32d3c5,_0x152e85){_0x152e85=_0x152e85||0xcc;return function(_0x389afb){if(_0x389afb){return _0x32d3c5[_0x635d('0x1c')](_0x152e85);}return _0x32d3c5['status'](_0x152e85)[_0x635d('0x1d')]();};}function respondWithResult(_0x3b2fd5,_0x20c225){_0x20c225=_0x20c225||0xc8;return function(_0x15b95d){if(_0x15b95d){return _0x3b2fd5[_0x635d('0x1e')](_0x20c225)['json'](_0x15b95d);}};}function respondWithFilteredResult(_0x4d4cf4,_0x436b63){return function(_0x439685){if(_0x439685){var _0x891b56=typeof _0x436b63[_0x635d('0x1f')]===_0x635d('0x20')&&typeof _0x436b63[_0x635d('0x21')]===_0x635d('0x20');var _0x2937b0=_0x439685[_0x635d('0x22')];var _0x388515=_0x891b56?0x0:_0x436b63[_0x635d('0x1f')];var _0x41140b=_0x891b56?_0x439685[_0x635d('0x22')]:_0x436b63[_0x635d('0x1f')]+_0x436b63[_0x635d('0x21')];var _0x957e5f;if(_0x41140b>=_0x2937b0){_0x41140b=_0x2937b0;_0x957e5f=0xc8;}else{_0x957e5f=0xce;}_0x4d4cf4[_0x635d('0x1e')](_0x957e5f);return _0x4d4cf4[_0x635d('0x23')](_0x635d('0x24'),_0x388515+'-'+_0x41140b+'/'+_0x2937b0)[_0x635d('0x25')](_0x439685);}return null;};}function patchUpdates(_0x34659d){return function(_0x501e45){try{jsonpatch['apply'](_0x501e45,_0x34659d,!![]);}catch(_0x112350){return BPromise[_0x635d('0x26')](_0x112350);}return _0x501e45[_0x635d('0x27')]();};}function saveUpdates(_0x25c8c9,_0x3cfaac){return function(_0x2195a1){if(_0x2195a1){return _0x2195a1['update'](_0x25c8c9)[_0x635d('0x28')](function(_0x31406c){return _0x31406c;});}return null;};}function removeEntity(_0x18629f,_0x3087a4){return function(_0x571c22){if(_0x571c22){return _0x571c22[_0x635d('0x29')]()['then'](function(){_0x18629f['status'](0xcc)[_0x635d('0x1d')]();});}};}function handleEntityNotFound(_0x26481a,_0x3d69d5){return function(_0x909cac){if(!_0x909cac){_0x26481a['sendStatus'](0x194);}return _0x909cac;};}function handleError(_0x5a5429,_0x4f545f){_0x4f545f=_0x4f545f||0x1f4;return function(_0x5023dd){logger[_0x635d('0x2a')](_0x5023dd[_0x635d('0x2b')]);if(_0x5023dd[_0x635d('0x2c')]){delete _0x5023dd[_0x635d('0x2c')];}_0x5a5429[_0x635d('0x1e')](_0x4f545f)[_0x635d('0x2d')](_0x5023dd);};}exports[_0x635d('0x2e')]=function(_0x831f37,_0x380d6a){var _0x34bb06={},_0x153bc7={},_0x273f19={'count':0x0,'rows':[]};var _0x26a740=_[_0x635d('0x2f')](db[_0x635d('0x30')][_0x635d('0x31')],function(_0xa3fd0e){return{'name':_0xa3fd0e[_0x635d('0x32')],'type':_0xa3fd0e[_0x635d('0x33')][_0x635d('0x34')]};});_0x153bc7['model']=_[_0x635d('0x2f')](_0x26a740,_0x635d('0x2c'));_0x153bc7[_0x635d('0x35')]=_[_0x635d('0x36')](_0x831f37['query']);_0x153bc7[_0x635d('0x37')]=_[_0x635d('0x38')](_0x153bc7[_0x635d('0x39')],_0x153bc7[_0x635d('0x35')]);_0x34bb06[_0x635d('0x3a')]=_['intersection'](_0x153bc7['model'],qs[_0x635d('0x3b')](_0x831f37[_0x635d('0x35')][_0x635d('0x3b')]));_0x34bb06['attributes']=_0x34bb06[_0x635d('0x3a')]['length']?_0x34bb06['attributes']:_0x153bc7[_0x635d('0x39')];if(!_0x831f37[_0x635d('0x35')][_0x635d('0x3c')](_0x635d('0x3d'))){_0x34bb06['limit']=qs['limit'](_0x831f37[_0x635d('0x35')]['limit']);_0x34bb06[_0x635d('0x1f')]=qs['offset'](_0x831f37[_0x635d('0x35')][_0x635d('0x1f')]);}_0x34bb06[_0x635d('0x3e')]=qs[_0x635d('0x3f')](_0x831f37[_0x635d('0x35')][_0x635d('0x3f')]);_0x34bb06['where']=qs[_0x635d('0x37')](_[_0x635d('0x40')](_0x831f37[_0x635d('0x35')],_0x153bc7['filters']),_0x26a740);if(_0x831f37[_0x635d('0x35')]['filter']){_0x34bb06[_0x635d('0x41')]=_['merge'](_0x34bb06[_0x635d('0x41')],{'$or':_['map'](_0x26a740,function(_0x39d7cc){if(_0x39d7cc[_0x635d('0x33')]!=='VIRTUAL'){var _0x3f8160={};_0x3f8160[_0x39d7cc[_0x635d('0x2c')]]={'$like':'%'+_0x831f37[_0x635d('0x35')][_0x635d('0x42')]+'%'};return _0x3f8160;}})});}_0x34bb06=_[_0x635d('0x43')]({},_0x34bb06,_0x831f37['options']);var _0x566bec={'where':_0x34bb06[_0x635d('0x41')]};return db['SalesforceAccount'][_0x635d('0x22')](_0x566bec)['then'](function(_0x30e21f){_0x273f19[_0x635d('0x22')]=_0x30e21f;if(_0x831f37['query'][_0x635d('0x44')]){_0x34bb06[_0x635d('0x45')]=[{'all':!![]}];}return db[_0x635d('0x30')]['findAll'](_0x34bb06);})[_0x635d('0x28')](function(_0x23530c){_0x273f19['rows']=_0x23530c;return _0x273f19;})[_0x635d('0x28')](respondWithFilteredResult(_0x380d6a,_0x34bb06))[_0x635d('0x46')](handleError(_0x380d6a,null));};exports[_0x635d('0x47')]=function(_0x10514f,_0x331d48){var _0x370767={'raw':![],'where':{'id':_0x10514f[_0x635d('0x48')]['id']}},_0x4500e8={};_0x4500e8[_0x635d('0x39')]=_[_0x635d('0x36')](db[_0x635d('0x30')][_0x635d('0x31')]);_0x4500e8[_0x635d('0x35')]=_[_0x635d('0x36')](_0x10514f['query']);_0x4500e8[_0x635d('0x37')]=_[_0x635d('0x38')](_0x4500e8[_0x635d('0x39')],_0x4500e8[_0x635d('0x35')]);_0x370767[_0x635d('0x3a')]=_[_0x635d('0x38')](_0x4500e8[_0x635d('0x39')],qs[_0x635d('0x3b')](_0x10514f[_0x635d('0x35')]['fields']));_0x370767[_0x635d('0x3a')]=_0x370767[_0x635d('0x3a')][_0x635d('0x49')]?_0x370767[_0x635d('0x3a')]:_0x4500e8[_0x635d('0x39')];if(_0x10514f[_0x635d('0x35')][_0x635d('0x44')]){_0x370767[_0x635d('0x45')]=[{'all':!![]}];}_0x370767=_['merge']({},_0x370767,_0x10514f['options']);return db[_0x635d('0x30')]['find'](_0x370767)[_0x635d('0x28')](handleEntityNotFound(_0x331d48,null))['then'](respondWithResult(_0x331d48,null))[_0x635d('0x46')](handleError(_0x331d48,null));};exports[_0x635d('0x4a')]=function(_0x47d3d3,_0x3cb44b){return db['SalesforceAccount'][_0x635d('0x4a')](_0x47d3d3[_0x635d('0x4b')],{})[_0x635d('0x28')](respondWithResult(_0x3cb44b,0xc9))['catch'](handleError(_0x3cb44b,null));};exports['update']=function(_0x1ab92e,_0x38d00d){if(_0x1ab92e[_0x635d('0x4b')]['id']){delete _0x1ab92e['body']['id'];}return db[_0x635d('0x30')][_0x635d('0x4c')]({'where':{'id':_0x1ab92e[_0x635d('0x48')]['id']}})[_0x635d('0x28')](handleEntityNotFound(_0x38d00d,null))[_0x635d('0x28')](saveUpdates(_0x1ab92e[_0x635d('0x4b')],null))[_0x635d('0x28')](respondWithResult(_0x38d00d,null))['catch'](handleError(_0x38d00d,null));};exports[_0x635d('0x29')]=function(_0x93eced,_0x219110){return db[_0x635d('0x30')][_0x635d('0x4c')]({'where':{'id':_0x93eced[_0x635d('0x48')]['id']}})['then'](handleEntityNotFound(_0x219110,null))[_0x635d('0x28')](removeEntity(_0x219110,null))[_0x635d('0x46')](handleError(_0x219110,null));};exports['getConfigurations']=function(_0x70e7ea,_0x263b3f,_0xf9faf2){var _0x38ee9d={};var _0x170ea4={};var _0x4e4b0f;var _0x25a327;return db['SalesforceAccount'][_0x635d('0x4d')]({'where':{'id':_0x70e7ea[_0x635d('0x48')]['id']}})['then'](handleEntityNotFound(_0x263b3f,null))[_0x635d('0x28')](function(_0x3f14d0){if(_0x3f14d0){_0x4e4b0f=_0x3f14d0;_0x170ea4[_0x635d('0x39')]=_[_0x635d('0x36')](db['SalesforceConfiguration'][_0x635d('0x31')]);_0x170ea4[_0x635d('0x35')]=_['keys'](_0x70e7ea[_0x635d('0x35')]);_0x170ea4[_0x635d('0x37')]=_[_0x635d('0x38')](_0x170ea4['model'],_0x170ea4[_0x635d('0x35')]);_0x38ee9d[_0x635d('0x3a')]=_[_0x635d('0x38')](_0x170ea4[_0x635d('0x39')],qs[_0x635d('0x3b')](_0x70e7ea['query'][_0x635d('0x3b')]));_0x38ee9d[_0x635d('0x3a')]=_0x38ee9d[_0x635d('0x3a')][_0x635d('0x49')]?_0x38ee9d['attributes']:_0x170ea4[_0x635d('0x39')];_0x38ee9d[_0x635d('0x3e')]=qs[_0x635d('0x3f')](_0x70e7ea[_0x635d('0x35')][_0x635d('0x3f')]);_0x38ee9d['where']=qs[_0x635d('0x37')](_[_0x635d('0x40')](_0x70e7ea['query'],_0x170ea4[_0x635d('0x37')]));if(_0x70e7ea[_0x635d('0x35')][_0x635d('0x42')]){_0x38ee9d[_0x635d('0x41')]=_[_0x635d('0x43')](_0x38ee9d['where'],{'$or':_[_0x635d('0x2f')](_0x38ee9d[_0x635d('0x3a')],function(_0x505c5d){var _0x1c8391={};_0x1c8391[_0x505c5d]={'$like':'%'+_0x70e7ea['query'][_0x635d('0x42')]+'%'};return _0x1c8391;})});}_0x38ee9d=_['merge']({},_0x38ee9d,_0x70e7ea['options']);return _0x4e4b0f[_0x635d('0x4e')](_0x38ee9d);}})[_0x635d('0x28')](function(_0x3e76b1){if(_0x3e76b1){_0x25a327=_0x3e76b1[_0x635d('0x49')];if(!_0x70e7ea[_0x635d('0x35')]['hasOwnProperty']('nolimit')){_0x38ee9d[_0x635d('0x21')]=qs['limit'](_0x70e7ea[_0x635d('0x35')][_0x635d('0x21')]);_0x38ee9d['offset']=qs['offset'](_0x70e7ea[_0x635d('0x35')][_0x635d('0x1f')]);}return _0x4e4b0f[_0x635d('0x4e')](_0x38ee9d);}})[_0x635d('0x28')](function(_0x58a4b5){if(_0x58a4b5){return _0x58a4b5?{'count':_0x25a327,'rows':_0x58a4b5}:null;}})[_0x635d('0x28')](respondWithResult(_0x263b3f,null))[_0x635d('0x46')](handleError(_0x263b3f,null));};exports['addConfiguration']=function(_0x239f90,_0x5e0ef5,_0x575851){if(_0x239f90[_0x635d('0x4b')]['id']){delete _0x239f90[_0x635d('0x4b')]['id'];}return db[_0x635d('0x30')][_0x635d('0x4d')]({'where':{'id':_0x239f90[_0x635d('0x48')]['id']}})[_0x635d('0x28')](handleEntityNotFound(_0x5e0ef5,null))[_0x635d('0x28')](function(_0x21137f){if(_0x21137f){_0x239f90[_0x635d('0x4b')][_0x635d('0x4f')]=_0x21137f['id'];_0x239f90[_0x635d('0x4b')][_0x635d('0x50')]=integrations['getSubjects'](_0x239f90[_0x635d('0x4b')]['channel'],_0x239f90[_0x635d('0x4b')]['type']);_0x239f90[_0x635d('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x239f90[_0x635d('0x4b')][_0x635d('0x51')],_0x239f90[_0x635d('0x4b')][_0x635d('0x33')]);return db[_0x635d('0x52')][_0x635d('0x4a')](_0x239f90[_0x635d('0x4b')],{'include':[{'model':db['SalesforceField'],'as':_0x635d('0x50')},{'model':db[_0x635d('0x53')],'as':_0x635d('0x54')}]});}return null;})[_0x635d('0x28')](respondWithResult(_0x5e0ef5,null))[_0x635d('0x46')](handleError(_0x5e0ef5,null));};exports['getFields']=function(_0x55a1b6,_0x231c16,_0x2bbe11){var _0x1fe8e3;var _0x38c5f9='';var _0x348e36=_0x635d('0x55');return db[_0x635d('0x30')][_0x635d('0x4d')]({'where':{'id':_0x55a1b6['params']['id']},'attributes':['id','remoteUri',_0x635d('0x56'),'clientSecret',_0x635d('0x57'),_0x635d('0x58'),_0x635d('0x59')]})[_0x635d('0x28')](handleEntityNotFound(_0x231c16,null))['then'](function(_0x30c6b3){if(_0x30c6b3){_0x38c5f9=_0x30c6b3[_0x635d('0x5a')];var _0x1dd002=_0x38c5f9[_0x635d('0x5b')](-0x1);if(_0x1dd002==='/'){_0x38c5f9=_0x38c5f9[_0x635d('0x5c')](0x0,_0x38c5f9['lastIndexOf'](_0x1dd002));}_0x1fe8e3=new jsforce['Connection']({'oauth2':{'loginUrl':_0x38c5f9,'clientId':_0x30c6b3[_0x635d('0x56')],'clientSecret':_0x30c6b3['clientSecret']}});return _0x1fe8e3[_0x635d('0x5d')](_0x30c6b3[_0x635d('0x57')],_0x30c6b3[_0x635d('0x58')]['concat'](_0x30c6b3[_0x635d('0x59')]));}})[_0x635d('0x28')](function(_0x5ae9b3){if(_0x5ae9b3){if(!_[_0x635d('0x5e')](_0x55a1b6[_0x635d('0x35')]['ticketType'])){_0x348e36=_0x55a1b6[_0x635d('0x35')][_0x635d('0x5f')];}return _0x1fe8e3[_0x635d('0x60')](_0x348e36)[_0x635d('0x61')]();}})[_0x635d('0x28')](function(_0x315980){var _0x1288de=[_0x635d('0x62'),_0x635d('0x63'),_0x635d('0x64'),_0x635d('0x65'),_0x635d('0x66'),_0x635d('0x67')];var _0x298d8f=[_0x635d('0x68'),_0x635d('0x69'),_0x635d('0x6a'),_0x635d('0x6b'),_0x635d('0x6c'),_0x635d('0x6d'),_0x635d('0x6e')];if(_0x315980){_[_0x635d('0x6f')](_0x315980[_0x635d('0x3b')],function(_0x45d74f){return _0x1288de[_0x635d('0x70')](_0x45d74f['name'])||!_0x298d8f[_0x635d('0x70')](_0x45d74f[_0x635d('0x33')]);});return{'count':_0x315980[_0x635d('0x3b')][_0x635d('0x49')],'rows':_[_0x635d('0x2f')](_0x315980['fields'],function(_0x1be61a){return{'id':_0x1be61a[_0x635d('0x2c')],'name':_0x1be61a['label'],'custom':_0x1be61a['custom'],'options':_0x1be61a['picklistValues'][_0x635d('0x49')]>0x0?_['map'](_0x1be61a['picklistValues'],function(_0x209bd3){return{'name':_0x209bd3[_0x635d('0x71')],'value':_0x209bd3[_0x635d('0x72')]};}):_0x1be61a[_0x635d('0x33')]==_0x635d('0x6b')?[{'name':'True','value':_0x635d('0x73')},{'name':_0x635d('0x74'),'value':_0x635d('0x75')}]:[]};})};}})[_0x635d('0x28')](respondWithResult(_0x231c16,null))['catch'](function(_0xa6cd50){var _0x1e1c5d=_0x55a1b6['query'][_0x635d('0x76')]?0x1f4:_0xa6cd50[_0x635d('0x77')]||0x1f4;logger[_0x635d('0x2a')](_0x635d('0x78'),_0x635d('0x79'),_0x1e1c5d,JSON[_0x635d('0x7a')](_0xa6cd50));delete _0xa6cd50[_0x635d('0x2c')];if(_0x1e1c5d===0x191){_0x1e1c5d=0x190;}_0x231c16[_0x635d('0x1e')](_0x1e1c5d)[_0x635d('0x2d')](_0x55a1b6[_0x635d('0x35')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xa6cd50[_0x635d('0x77')]}:_0xa6cd50);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index ff324b5..3638863 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 _0xdeee=['bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','util','../../config/logger','api','moment'];(function(_0x14f1c5,_0x4caa61){var _0x44e960=function(_0x596214){while(--_0x596214){_0x14f1c5['push'](_0x14f1c5['shift']());}};_0x44e960(++_0x4caa61);}(_0xdeee,0x10a));var _0xedee=function(_0x1d0b83,_0x2c6c5c){_0x1d0b83=_0x1d0b83-0x0;var _0x102838=_0xdeee[_0x1d0b83];return _0x102838;};'use strict';var _=require('lodash');var util=require(_0xedee('0x0'));var logger=require(_0xedee('0x1'))(_0xedee('0x2'));var moment=require(_0xedee('0x3'));var BPromise=require(_0xedee('0x4'));var rp=require(_0xedee('0x5'));var fs=require('fs');var path=require(_0xedee('0x6'));var rimraf=require(_0xedee('0x7'));var config=require(_0xedee('0x8'));var attributes=require(_0xedee('0x9'));var integrations=require(_0xedee('0xa'));module[_0xedee('0xb')]=function(_0x86834a,_0x6c020f){return _0x86834a[_0xedee('0xc')](_0xedee('0xd'),attributes,{'tableName':_0xedee('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c5=['path','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x406fbb,_0x1093e5){var _0x8e921d=function(_0x410517){while(--_0x410517){_0x406fbb['push'](_0x406fbb['shift']());}};_0x8e921d(++_0x1093e5);}(_0x95c5,0x153));var _0x595c=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x95c5[_0x5b64a1];return _0x4b6f55;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var logger=require('../../config/logger')(_0x595c('0x2'));var moment=require(_0x595c('0x3'));var BPromise=require(_0x595c('0x4'));var rp=require(_0x595c('0x5'));var fs=require('fs');var path=require(_0x595c('0x6'));var rimraf=require(_0x595c('0x7'));var config=require(_0x595c('0x8'));var attributes=require(_0x595c('0x9'));var integrations=require(_0x595c('0xa'));module[_0x595c('0xb')]=function(_0x4ff80b,_0x49a115){return _0x4ff80b[_0x595c('0xc')](_0x595c('0xd'),attributes,{'tableName':_0x595c('0xe'),'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 4441397..9a4a55f 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 _0x8583=['SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowSalesforceAccount','SalesforceAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x307060,_0x26dc3d){var _0x3a2587=function(_0x283dde){while(--_0x283dde){_0x307060['push'](_0x307060['shift']());}};_0x3a2587(++_0x26dc3d);}(_0x8583,0x163));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x3858('0x0'));var util=require(_0x3858('0x1'));var moment=require(_0x3858('0x2'));var BPromise=require('bluebird');var rs=require(_0x3858('0x3'));var fs=require('fs');var Redis=require(_0x3858('0x4'));var db=require(_0x3858('0x5'))['db'];var utils=require(_0x3858('0x6'));var logger=require(_0x3858('0x7'))(_0x3858('0x8'));var config=require(_0x3858('0x9'));var jayson=require(_0x3858('0xa'));var client=jayson[_0x3858('0xb')][_0x3858('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d6e62,_0x290173,_0x112cf3){return new BPromise(function(_0x2fe52d,_0x52df39){return client[_0x3858('0xd')](_0x2d6e62,_0x112cf3)['then'](function(_0x4dba4a){logger[_0x3858('0xe')](_0x3858('0xf'),_0x290173,_0x3858('0x10'));logger[_0x3858('0x11')](_0x3858('0x12'),_0x290173,'request\x20sent',JSON[_0x3858('0x13')](_0x4dba4a));if(_0x4dba4a[_0x3858('0x14')]){if(_0x4dba4a[_0x3858('0x14')]['code']===0x1f4){logger['error'](_0x3858('0xf'),_0x290173,_0x4dba4a['error']['message']);return _0x52df39(_0x4dba4a[_0x3858('0x14')]['message']);}logger[_0x3858('0x14')](_0x3858('0xf'),_0x290173,_0x4dba4a[_0x3858('0x14')][_0x3858('0x15')]);return _0x2fe52d(_0x4dba4a['error'][_0x3858('0x15')]);}else{logger[_0x3858('0xe')](_0x3858('0xf'),_0x290173,_0x3858('0x10'));_0x2fe52d(_0x4dba4a['result'][_0x3858('0x15')]);}})[_0x3858('0x16')](function(_0x4e57cc){logger[_0x3858('0x14')](_0x3858('0xf'),_0x290173,_0x4e57cc);_0x52df39(_0x4e57cc);});});}exports[_0x3858('0x17')]=function(_0x7662fb){var _0x2ebe7d=this;return new Promise(function(_0x9e1402,_0x232504){return db['SalesforceAccount'][_0x3858('0x18')]({'raw':_0x7662fb[_0x3858('0x19')]?_0x7662fb[_0x3858('0x19')][_0x3858('0x1a')]===undefined?!![]:![]:!![],'where':_0x7662fb['options']?_0x7662fb[_0x3858('0x19')][_0x3858('0x1b')]||null:null,'attributes':_0x7662fb[_0x3858('0x19')]?_0x7662fb[_0x3858('0x19')][_0x3858('0x1c')]||null:null,'limit':_0x7662fb[_0x3858('0x19')]?_0x7662fb[_0x3858('0x19')][_0x3858('0x1d')]||null:null,'include':_0x7662fb[_0x3858('0x19')]?_0x7662fb[_0x3858('0x19')]['include']?_[_0x3858('0x1e')](_0x7662fb[_0x3858('0x19')][_0x3858('0x1f')],function(_0x42b185){return{'model':db[_0x42b185[_0x3858('0x20')]],'as':_0x42b185['as'],'attributes':_0x42b185[_0x3858('0x1c')],'include':_0x42b185['include']?_[_0x3858('0x1e')](_0x42b185[_0x3858('0x1f')],function(_0x394383){return{'model':db[_0x394383[_0x3858('0x20')]],'as':_0x394383['as'],'attributes':_0x394383[_0x3858('0x1c')],'include':_0x394383[_0x3858('0x1f')]?_[_0x3858('0x1e')](_0x394383[_0x3858('0x1f')],function(_0x956a3f){return{'model':db[_0x956a3f['model']],'as':_0x956a3f['as'],'attributes':_0x956a3f[_0x3858('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3858('0x21')](function(_0xe036cc){logger[_0x3858('0xe')](_0x3858('0x17'),_0x7662fb);logger[_0x3858('0x11')]('GetSalesforceAccount',_0x7662fb,JSON[_0x3858('0x13')](_0xe036cc));_0x9e1402(_0xe036cc);})[_0x3858('0x16')](function(_0x2317de){logger[_0x3858('0x14')](_0x3858('0x17'),_0x2317de[_0x3858('0x15')],_0x7662fb);_0x232504(_0x2ebe7d[_0x3858('0x14')](0x1f4,_0x2317de[_0x3858('0x15')]));});});};exports[_0x3858('0x22')]=function(_0x4d317e){var _0x5ebd55=this;return new Promise(function(_0xa7fdcd,_0x3cd53e){return db[_0x3858('0x23')][_0x3858('0x24')]({'raw':_0x4d317e[_0x3858('0x19')]?_0x4d317e['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d317e[_0x3858('0x19')]?_0x4d317e[_0x3858('0x19')][_0x3858('0x1b')]||null:null,'attributes':_0x4d317e['options']?_0x4d317e['options'][_0x3858('0x1c')]||null:null,'include':_0x4d317e[_0x3858('0x19')]?_0x4d317e['options']['include']?_['map'](_0x4d317e[_0x3858('0x19')][_0x3858('0x1f')],function(_0x57a8c7){return{'model':db[_0x57a8c7[_0x3858('0x20')]],'as':_0x57a8c7['as'],'attributes':_0x57a8c7['attributes'],'include':_0x57a8c7[_0x3858('0x1f')]?_[_0x3858('0x1e')](_0x57a8c7[_0x3858('0x1f')],function(_0xda9397){return{'model':db[_0xda9397[_0x3858('0x20')]],'as':_0xda9397['as'],'attributes':_0xda9397[_0x3858('0x1c')],'include':_0xda9397[_0x3858('0x1f')]?_['map'](_0xda9397['include'],function(_0x3d6a4e){return{'model':db[_0x3d6a4e['model']],'as':_0x3d6a4e['as'],'attributes':_0x3d6a4e[_0x3858('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3858('0x21')](function(_0x2a1398){logger['info'](_0x3858('0x22'),_0x4d317e);logger[_0x3858('0x11')](_0x3858('0x22'),_0x4d317e,JSON[_0x3858('0x13')](_0x2a1398));_0xa7fdcd(_0x2a1398);})[_0x3858('0x16')](function(_0x4d077b){logger[_0x3858('0x14')](_0x3858('0x22'),_0x4d077b[_0x3858('0x15')],_0x4d317e);_0x3cd53e(_0x5ebd55[_0x3858('0x14')](0x1f4,_0x4d077b[_0x3858('0x15')]));});});}; \ No newline at end of file +var _0x038a=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','map','include','attributes','model','catch','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring'];(function(_0x21efd5,_0x567234){var _0x3b2e00=function(_0x288ee5){while(--_0x288ee5){_0x21efd5['push'](_0x21efd5['shift']());}};_0x3b2e00(++_0x567234);}(_0x038a,0x93));var _0xa038=function(_0x3b0c9d,_0x3ddeb5){_0x3b0c9d=_0x3b0c9d-0x0;var _0xcfc8d7=_0x038a[_0x3b0c9d];return _0xcfc8d7;};'use strict';var _=require(_0xa038('0x0'));var util=require(_0xa038('0x1'));var moment=require(_0xa038('0x2'));var BPromise=require(_0xa038('0x3'));var rs=require(_0xa038('0x4'));var fs=require('fs');var Redis=require(_0xa038('0x5'));var db=require(_0xa038('0x6'))['db'];var utils=require(_0xa038('0x7'));var logger=require(_0xa038('0x8'))(_0xa038('0x9'));var config=require(_0xa038('0xa'));var jayson=require(_0xa038('0xb'));var client=jayson[_0xa038('0xc')][_0xa038('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d82df,_0x49fd72,_0xd8f793){return new BPromise(function(_0x2b1fc5,_0x4c5e8f){return client[_0xa038('0xe')](_0x5d82df,_0xd8f793)[_0xa038('0xf')](function(_0x3bfbb7){logger['info']('SalesforceAccount,\x20%s,\x20%s',_0x49fd72,_0xa038('0x10'));logger[_0xa038('0x11')](_0xa038('0x12'),_0x49fd72,_0xa038('0x10'),JSON[_0xa038('0x13')](_0x3bfbb7));if(_0x3bfbb7[_0xa038('0x14')]){if(_0x3bfbb7[_0xa038('0x14')][_0xa038('0x15')]===0x1f4){logger[_0xa038('0x14')](_0xa038('0x16'),_0x49fd72,_0x3bfbb7['error'][_0xa038('0x17')]);return _0x4c5e8f(_0x3bfbb7[_0xa038('0x14')][_0xa038('0x17')]);}logger[_0xa038('0x14')](_0xa038('0x16'),_0x49fd72,_0x3bfbb7[_0xa038('0x14')]['message']);return _0x2b1fc5(_0x3bfbb7['error'][_0xa038('0x17')]);}else{logger[_0xa038('0x18')](_0xa038('0x16'),_0x49fd72,_0xa038('0x10'));_0x2b1fc5(_0x3bfbb7[_0xa038('0x19')][_0xa038('0x17')]);}})['catch'](function(_0xedc674){logger[_0xa038('0x14')](_0xa038('0x16'),_0x49fd72,_0xedc674);_0x4c5e8f(_0xedc674);});});}exports[_0xa038('0x1a')]=function(_0x3b6f47){var _0x1a10c2=this;return new Promise(function(_0x40f4e6,_0x39f41b){return db[_0xa038('0x1b')][_0xa038('0x1c')]({'raw':_0x3b6f47['options']?_0x3b6f47['options'][_0xa038('0x1d')]===undefined?!![]:![]:!![],'where':_0x3b6f47[_0xa038('0x1e')]?_0x3b6f47[_0xa038('0x1e')][_0xa038('0x1f')]||null:null,'attributes':_0x3b6f47[_0xa038('0x1e')]?_0x3b6f47['options']['attributes']||null:null,'limit':_0x3b6f47[_0xa038('0x1e')]?_0x3b6f47[_0xa038('0x1e')]['limit']||null:null,'include':_0x3b6f47[_0xa038('0x1e')]?_0x3b6f47[_0xa038('0x1e')]['include']?_[_0xa038('0x20')](_0x3b6f47[_0xa038('0x1e')][_0xa038('0x21')],function(_0x2f18c7){return{'model':db[_0x2f18c7['model']],'as':_0x2f18c7['as'],'attributes':_0x2f18c7[_0xa038('0x22')],'include':_0x2f18c7[_0xa038('0x21')]?_[_0xa038('0x20')](_0x2f18c7[_0xa038('0x21')],function(_0x259125){return{'model':db[_0x259125['model']],'as':_0x259125['as'],'attributes':_0x259125['attributes'],'include':_0x259125[_0xa038('0x21')]?_[_0xa038('0x20')](_0x259125['include'],function(_0x22b921){return{'model':db[_0x22b921[_0xa038('0x23')]],'as':_0x22b921['as'],'attributes':_0x22b921[_0xa038('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa038('0xf')](function(_0x80f1af){logger[_0xa038('0x18')](_0xa038('0x1a'),_0x3b6f47);logger[_0xa038('0x11')](_0xa038('0x1a'),_0x3b6f47,JSON[_0xa038('0x13')](_0x80f1af));_0x40f4e6(_0x80f1af);})[_0xa038('0x24')](function(_0x1329a3){logger[_0xa038('0x14')](_0xa038('0x1a'),_0x1329a3[_0xa038('0x17')],_0x3b6f47);_0x39f41b(_0x1a10c2[_0xa038('0x14')](0x1f4,_0x1329a3[_0xa038('0x17')]));});});};exports[_0xa038('0x25')]=function(_0x4313a8){var _0x34ed20=this;return new Promise(function(_0x388814,_0x1d706c){return db[_0xa038('0x1b')]['find']({'raw':_0x4313a8[_0xa038('0x1e')]?_0x4313a8[_0xa038('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x4313a8['options']?_0x4313a8[_0xa038('0x1e')][_0xa038('0x1f')]||null:null,'attributes':_0x4313a8[_0xa038('0x1e')]?_0x4313a8[_0xa038('0x1e')][_0xa038('0x22')]||null:null,'include':_0x4313a8[_0xa038('0x1e')]?_0x4313a8[_0xa038('0x1e')][_0xa038('0x21')]?_[_0xa038('0x20')](_0x4313a8['options'][_0xa038('0x21')],function(_0x335999){return{'model':db[_0x335999[_0xa038('0x23')]],'as':_0x335999['as'],'attributes':_0x335999['attributes'],'include':_0x335999[_0xa038('0x21')]?_[_0xa038('0x20')](_0x335999[_0xa038('0x21')],function(_0xdd24ca){return{'model':db[_0xdd24ca['model']],'as':_0xdd24ca['as'],'attributes':_0xdd24ca[_0xa038('0x22')],'include':_0xdd24ca['include']?_[_0xa038('0x20')](_0xdd24ca[_0xa038('0x21')],function(_0x1079c3){return{'model':db[_0x1079c3[_0xa038('0x23')]],'as':_0x1079c3['as'],'attributes':_0x1079c3[_0xa038('0x22')]};}):[]};}):[]};}):[]:[]})[_0xa038('0xf')](function(_0x1800b0){logger[_0xa038('0x18')]('ShowSalesforceAccount',_0x4313a8);logger['debug'](_0xa038('0x25'),_0x4313a8,JSON['stringify'](_0x1800b0));_0x388814(_0x1800b0);})['catch'](function(_0x374f45){logger[_0xa038('0x14')]('ShowSalesforceAccount',_0x374f45[_0xa038('0x17')],_0x4313a8);_0x1d706c(_0x34ed20[_0xa038('0x14')](0x1f4,_0x374f45[_0xa038('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 6d41a2f..7dd63a1 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xdb28,0x106));var _0x8db2=function(_0xd5f909,_0x8e8949){_0xd5f909=_0xd5f909-0x0;var _0x423bc3=_0xdb28[_0xd5f909];return _0x423bc3;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x5f4154,_0x369590){var _0x5a9f9e=function(_0x3e4e1c){while(--_0x3e4e1c){_0x5f4154['push'](_0x5f4154['shift']());}};_0x5a9f9e(++_0x369590);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 1b123a8..d656b07 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 _0x20b9=['ENUM','contact_lead','contact','lead','account','nothing','sequelize','STRING'];(function(_0x2d8980,_0x53f0db){var _0x4c47e5=function(_0x44b3fa){while(--_0x44b3fa){_0x2d8980['push'](_0x2d8980['shift']());}};_0x4c47e5(++_0x53f0db);}(_0x20b9,0xfe));var _0x920b=function(_0x47394c,_0x2a2f67){_0x47394c=_0x47394c-0x0;var _0x4d7a34=_0x20b9[_0x47394c];return _0x4d7a34;};'use strict';var Sequelize=require(_0x920b('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x920b('0x1')]},'ticketType':{'type':Sequelize[_0x920b('0x2')]('Task','Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x920b('0x2')](_0x920b('0x3'),_0x920b('0x4'),_0x920b('0x5'),'account_contact_lead',_0x920b('0x6')),'defaultValue':_0x920b('0x3')},'moduleCreate':{'type':Sequelize[_0x920b('0x2')](_0x920b('0x7'),_0x920b('0x4'),_0x920b('0x5'),'account'),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x920b('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x920b('0x1')]},'additionalSearchContact':{'type':Sequelize[_0x920b('0x1')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7593=['sequelize','exports','STRING','ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account'];(function(_0x51f812,_0x36212c){var _0x1ad290=function(_0x1f03b7){while(--_0x1f03b7){_0x51f812['push'](_0x51f812['shift']());}};_0x1ad290(++_0x36212c);}(_0x7593,0x129));var _0x3759=function(_0x15a346,_0x46d825){_0x15a346=_0x15a346-0x0;var _0x275a0f=_0x7593[_0x15a346];return _0x275a0f;};'use strict';var Sequelize=require(_0x3759('0x0'));module[_0x3759('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3759('0x2')]},'ticketType':{'type':Sequelize[_0x3759('0x3')](_0x3759('0x4'),_0x3759('0x5')),'defaultValue':_0x3759('0x4')},'moduleSearch':{'type':Sequelize[_0x3759('0x3')](_0x3759('0x6'),_0x3759('0x7'),_0x3759('0x8'),_0x3759('0x9'),'account'),'defaultValue':'contact_lead'},'moduleCreate':{'type':Sequelize[_0x3759('0x3')]('nothing',_0x3759('0x7'),_0x3759('0x8'),_0x3759('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x3759('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x3759('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x3759('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x3759('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 2e2ff97..8e4e8ab 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 _0xfa27=['options','SalesforceConfiguration','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','getFields','keys','SalesforceField','getSubjects','findOne','getDescriptions','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../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','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x20c24e,_0x53a986){var _0x6f0d2f=function(_0x40a8d6){while(--_0x40a8d6){_0x20c24e['push'](_0x20c24e['shift']());}};_0x6f0d2f(++_0x53a986);}(_0xfa27,0x1b2));var _0x7fa2=function(_0x1892a3,_0x5e5d83){_0x1892a3=_0x1892a3-0x0;var _0x551b4e=_0xfa27[_0x1892a3];return _0x551b4e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7fa2('0x0'));var jsonpatch=require(_0x7fa2('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fa2('0x2'));var Mustache=require('mustache');var util=require(_0x7fa2('0x3'));var path=require(_0x7fa2('0x4'));var sox=require(_0x7fa2('0x5'));var csv=require(_0x7fa2('0x6'));var ejs=require(_0x7fa2('0x7'));var fs=require('fs');var fs_extra=require(_0x7fa2('0x8'));var _=require(_0x7fa2('0x9'));var squel=require(_0x7fa2('0xa'));var crypto=require(_0x7fa2('0xb'));var jsforce=require(_0x7fa2('0xc'));var deskjs=require(_0x7fa2('0xd'));var toCsv=require(_0x7fa2('0x6'));var querystring=require(_0x7fa2('0xe'));var Papa=require('papaparse');var Redis=require(_0x7fa2('0xf'));var authService=require(_0x7fa2('0x10'));var qs=require(_0x7fa2('0x11'));var as=require(_0x7fa2('0x12'));var hardwareService=require(_0x7fa2('0x13'));var logger=require(_0x7fa2('0x14'))(_0x7fa2('0x15'));var utils=require(_0x7fa2('0x16'));var config=require(_0x7fa2('0x17'));var licenseUtil=require(_0x7fa2('0x18'));var db=require(_0x7fa2('0x19'))['db'];function respondWithStatusCode(_0x5162a0,_0x15a557){_0x15a557=_0x15a557||0xcc;return function(_0xe8abe6){if(_0xe8abe6){return _0x5162a0[_0x7fa2('0x1a')](_0x15a557);}return _0x5162a0[_0x7fa2('0x1b')](_0x15a557)[_0x7fa2('0x1c')]();};}function respondWithResult(_0x59c5ce,_0x961dcf){_0x961dcf=_0x961dcf||0xc8;return function(_0x33c61a){if(_0x33c61a){return _0x59c5ce[_0x7fa2('0x1b')](_0x961dcf)[_0x7fa2('0x1d')](_0x33c61a);}};}function respondWithFilteredResult(_0x6afb84,_0xc1a7ad){return function(_0x4b9614){if(_0x4b9614){var _0x535bc0=typeof _0xc1a7ad[_0x7fa2('0x1e')]==='undefined'&&typeof _0xc1a7ad['limit']===_0x7fa2('0x1f');var _0x5b5f64=_0x4b9614[_0x7fa2('0x20')];var _0x40e329=_0x535bc0?0x0:_0xc1a7ad[_0x7fa2('0x1e')];var _0x5116df=_0x535bc0?_0x4b9614[_0x7fa2('0x20')]:_0xc1a7ad[_0x7fa2('0x1e')]+_0xc1a7ad[_0x7fa2('0x21')];var _0x2301b9;if(_0x5116df>=_0x5b5f64){_0x5116df=_0x5b5f64;_0x2301b9=0xc8;}else{_0x2301b9=0xce;}_0x6afb84[_0x7fa2('0x1b')](_0x2301b9);return _0x6afb84[_0x7fa2('0x22')](_0x7fa2('0x23'),_0x40e329+'-'+_0x5116df+'/'+_0x5b5f64)[_0x7fa2('0x1d')](_0x4b9614);}return null;};}function patchUpdates(_0x37c325){return function(_0x431aa4){try{jsonpatch[_0x7fa2('0x24')](_0x431aa4,_0x37c325,!![]);}catch(_0x1c420d){return BPromise['reject'](_0x1c420d);}return _0x431aa4[_0x7fa2('0x25')]();};}function saveUpdates(_0x4d1498,_0x526995){return function(_0x54ff15){if(_0x54ff15){return _0x54ff15[_0x7fa2('0x26')](_0x4d1498)[_0x7fa2('0x27')](function(_0x2473ec){return _0x2473ec;});}return null;};}function removeEntity(_0x28b7df,_0x39e589){return function(_0x2f64b0){if(_0x2f64b0){return _0x2f64b0[_0x7fa2('0x28')]()[_0x7fa2('0x27')](function(){_0x28b7df[_0x7fa2('0x1b')](0xcc)[_0x7fa2('0x1c')]();});}};}function handleEntityNotFound(_0x15d4bc,_0x443553){return function(_0xc66c00){if(!_0xc66c00){_0x15d4bc[_0x7fa2('0x1a')](0x194);}return _0xc66c00;};}function handleError(_0xbd062,_0x3cac69){_0x3cac69=_0x3cac69||0x1f4;return function(_0x3e00b3){logger['error'](_0x3e00b3[_0x7fa2('0x29')]);if(_0x3e00b3[_0x7fa2('0x2a')]){delete _0x3e00b3['name'];}_0xbd062[_0x7fa2('0x1b')](_0x3cac69)[_0x7fa2('0x2b')](_0x3e00b3);};}exports[_0x7fa2('0x2c')]=function(_0x3abc2f,_0x402abf){var _0x2c9dc3={},_0x472ed6={},_0x561d48={'count':0x0,'rows':[]};var _0x216563=_[_0x7fa2('0x2d')](db['SalesforceConfiguration'][_0x7fa2('0x2e')],function(_0xd552d){return{'name':_0xd552d[_0x7fa2('0x2f')],'type':_0xd552d[_0x7fa2('0x30')][_0x7fa2('0x31')]};});_0x472ed6['model']=_['map'](_0x216563,_0x7fa2('0x2a'));_0x472ed6[_0x7fa2('0x32')]=_['keys'](_0x3abc2f['query']);_0x472ed6[_0x7fa2('0x33')]=_[_0x7fa2('0x34')](_0x472ed6[_0x7fa2('0x35')],_0x472ed6['query']);_0x2c9dc3[_0x7fa2('0x36')]=_[_0x7fa2('0x34')](_0x472ed6['model'],qs[_0x7fa2('0x37')](_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x37')]));_0x2c9dc3[_0x7fa2('0x36')]=_0x2c9dc3[_0x7fa2('0x36')]['length']?_0x2c9dc3[_0x7fa2('0x36')]:_0x472ed6[_0x7fa2('0x35')];if(!_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x38')](_0x7fa2('0x39'))){_0x2c9dc3['limit']=qs['limit'](_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x21')]);_0x2c9dc3[_0x7fa2('0x1e')]=qs[_0x7fa2('0x1e')](_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x1e')]);}_0x2c9dc3[_0x7fa2('0x3a')]=qs['sort'](_0x3abc2f['query'][_0x7fa2('0x3b')]);_0x2c9dc3[_0x7fa2('0x3c')]=qs['filters'](_[_0x7fa2('0x3d')](_0x3abc2f[_0x7fa2('0x32')],_0x472ed6[_0x7fa2('0x33')]),_0x216563);if(_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x3e')]){_0x2c9dc3[_0x7fa2('0x3c')]=_[_0x7fa2('0x3f')](_0x2c9dc3[_0x7fa2('0x3c')],{'$or':_[_0x7fa2('0x2d')](_0x216563,function(_0x4661a7){if(_0x4661a7['type']!=='VIRTUAL'){var _0xb3aaed={};_0xb3aaed[_0x4661a7[_0x7fa2('0x2a')]]={'$like':'%'+_0x3abc2f[_0x7fa2('0x32')][_0x7fa2('0x3e')]+'%'};return _0xb3aaed;}})});}_0x2c9dc3=_[_0x7fa2('0x3f')]({},_0x2c9dc3,_0x3abc2f[_0x7fa2('0x40')]);var _0x23df01={'where':_0x2c9dc3[_0x7fa2('0x3c')]};return db[_0x7fa2('0x41')][_0x7fa2('0x20')](_0x23df01)['then'](function(_0x3f93dd){_0x561d48[_0x7fa2('0x20')]=_0x3f93dd;if(_0x3abc2f['query']['includeAll']){_0x2c9dc3[_0x7fa2('0x42')]=[{'all':!![]}];}return db[_0x7fa2('0x41')][_0x7fa2('0x43')](_0x2c9dc3);})['then'](function(_0x5c2077){_0x561d48[_0x7fa2('0x44')]=_0x5c2077;return _0x561d48;})['then'](respondWithFilteredResult(_0x402abf,_0x2c9dc3))[_0x7fa2('0x45')](handleError(_0x402abf,null));};exports[_0x7fa2('0x46')]=function(_0x4c1adb,_0x42e7aa){var _0x1da654={'raw':![],'where':{'id':_0x4c1adb[_0x7fa2('0x47')]['id']}},_0x34d440={};_0x34d440[_0x7fa2('0x35')]=_['keys'](db['SalesforceConfiguration'][_0x7fa2('0x2e')]);_0x34d440[_0x7fa2('0x32')]=_['keys'](_0x4c1adb[_0x7fa2('0x32')]);_0x34d440[_0x7fa2('0x33')]=_['intersection'](_0x34d440[_0x7fa2('0x35')],_0x34d440[_0x7fa2('0x32')]);_0x1da654[_0x7fa2('0x36')]=_[_0x7fa2('0x34')](_0x34d440[_0x7fa2('0x35')],qs[_0x7fa2('0x37')](_0x4c1adb[_0x7fa2('0x32')][_0x7fa2('0x37')]));_0x1da654['attributes']=_0x1da654[_0x7fa2('0x36')][_0x7fa2('0x48')]?_0x1da654[_0x7fa2('0x36')]:_0x34d440[_0x7fa2('0x35')];if(_0x4c1adb[_0x7fa2('0x32')][_0x7fa2('0x49')]){_0x1da654['include']=[{'all':!![]}];}_0x1da654=_[_0x7fa2('0x3f')]({},_0x1da654,_0x4c1adb[_0x7fa2('0x40')]);return db[_0x7fa2('0x41')][_0x7fa2('0x4a')](_0x1da654)[_0x7fa2('0x27')](handleEntityNotFound(_0x42e7aa,null))[_0x7fa2('0x27')](respondWithResult(_0x42e7aa,null))[_0x7fa2('0x45')](handleError(_0x42e7aa,null));};exports[_0x7fa2('0x4b')]=function(_0x1ec0e1,_0xc78ac3){return db['SalesforceConfiguration']['create'](_0x1ec0e1['body'],{})[_0x7fa2('0x27')](respondWithResult(_0xc78ac3,0xc9))['catch'](handleError(_0xc78ac3,null));};exports[_0x7fa2('0x26')]=function(_0x22e93b,_0x68f6d9){if(_0x22e93b['body']['id']){delete _0x22e93b[_0x7fa2('0x4c')]['id'];}return db[_0x7fa2('0x41')][_0x7fa2('0x4a')]({'where':{'id':_0x22e93b['params']['id']}})['then'](handleEntityNotFound(_0x68f6d9,null))[_0x7fa2('0x27')](saveUpdates(_0x22e93b['body'],null))[_0x7fa2('0x27')](respondWithResult(_0x68f6d9,null))['catch'](handleError(_0x68f6d9,null));};exports[_0x7fa2('0x28')]=function(_0x26571c,_0x3853ec){return db[_0x7fa2('0x41')][_0x7fa2('0x4a')]({'where':{'id':_0x26571c[_0x7fa2('0x47')]['id']}})[_0x7fa2('0x27')](handleEntityNotFound(_0x3853ec,null))[_0x7fa2('0x27')](removeEntity(_0x3853ec,null))[_0x7fa2('0x45')](handleError(_0x3853ec,null));};exports[_0x7fa2('0x4d')]=function(_0x3d3b03,_0x560f2d,_0x168bef){var _0x294c6e={};var _0x22dbda={};var _0xe53214;var _0x32c435;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x3d3b03[_0x7fa2('0x47')]['id']}})[_0x7fa2('0x27')](handleEntityNotFound(_0x560f2d,null))[_0x7fa2('0x27')](function(_0x61b291){if(_0x61b291){_0xe53214=_0x61b291;_0x22dbda[_0x7fa2('0x35')]=_[_0x7fa2('0x4e')](db[_0x7fa2('0x4f')][_0x7fa2('0x2e')]);_0x22dbda[_0x7fa2('0x32')]=_[_0x7fa2('0x4e')](_0x3d3b03[_0x7fa2('0x32')]);_0x22dbda[_0x7fa2('0x33')]=_[_0x7fa2('0x34')](_0x22dbda[_0x7fa2('0x35')],_0x22dbda['query']);_0x294c6e[_0x7fa2('0x36')]=_['intersection'](_0x22dbda[_0x7fa2('0x35')],qs[_0x7fa2('0x37')](_0x3d3b03[_0x7fa2('0x32')]['fields']));_0x294c6e[_0x7fa2('0x36')]=_0x294c6e[_0x7fa2('0x36')][_0x7fa2('0x48')]?_0x294c6e[_0x7fa2('0x36')]:_0x22dbda['model'];_0x294c6e[_0x7fa2('0x3a')]=qs[_0x7fa2('0x3b')](_0x3d3b03['query'][_0x7fa2('0x3b')]);_0x294c6e['where']=qs[_0x7fa2('0x33')](_[_0x7fa2('0x3d')](_0x3d3b03['query'],_0x22dbda[_0x7fa2('0x33')]));if(_0x3d3b03[_0x7fa2('0x32')]['filter']){_0x294c6e[_0x7fa2('0x3c')]=_['merge'](_0x294c6e[_0x7fa2('0x3c')],{'$or':_['map'](_0x294c6e[_0x7fa2('0x36')],function(_0x150216){var _0x49482c={};_0x49482c[_0x150216]={'$like':'%'+_0x3d3b03[_0x7fa2('0x32')][_0x7fa2('0x3e')]+'%'};return _0x49482c;})});}_0x294c6e=_[_0x7fa2('0x3f')]({},_0x294c6e,_0x3d3b03[_0x7fa2('0x40')]);return _0xe53214[_0x7fa2('0x4d')](_0x294c6e);}})[_0x7fa2('0x27')](function(_0x14e3cc){if(_0x14e3cc){_0x32c435=_0x14e3cc[_0x7fa2('0x48')];if(!_0x3d3b03[_0x7fa2('0x32')][_0x7fa2('0x38')]('nolimit')){_0x294c6e['limit']=qs[_0x7fa2('0x21')](_0x3d3b03[_0x7fa2('0x32')]['limit']);_0x294c6e[_0x7fa2('0x1e')]=qs[_0x7fa2('0x1e')](_0x3d3b03['query'][_0x7fa2('0x1e')]);}return _0xe53214[_0x7fa2('0x4d')](_0x294c6e);}})[_0x7fa2('0x27')](function(_0x12a709){if(_0x12a709){return _0x12a709?{'count':_0x32c435,'rows':_0x12a709}:null;}})[_0x7fa2('0x27')](respondWithResult(_0x560f2d,null))[_0x7fa2('0x45')](handleError(_0x560f2d,null));};exports[_0x7fa2('0x50')]=function(_0x1e86c1,_0x75055e,_0x497a25){var _0x3f980f={};var _0x2f072b={};var _0x2c0dfb;var _0x3e98ff;return db['SalesforceConfiguration'][_0x7fa2('0x51')]({'where':{'id':_0x1e86c1[_0x7fa2('0x47')]['id']}})['then'](handleEntityNotFound(_0x75055e,null))[_0x7fa2('0x27')](function(_0x20de7a){if(_0x20de7a){_0x2c0dfb=_0x20de7a;_0x2f072b['model']=_['keys'](db['SalesforceField'][_0x7fa2('0x2e')]);_0x2f072b[_0x7fa2('0x32')]=_[_0x7fa2('0x4e')](_0x1e86c1[_0x7fa2('0x32')]);_0x2f072b[_0x7fa2('0x33')]=_[_0x7fa2('0x34')](_0x2f072b[_0x7fa2('0x35')],_0x2f072b[_0x7fa2('0x32')]);_0x3f980f[_0x7fa2('0x36')]=_[_0x7fa2('0x34')](_0x2f072b[_0x7fa2('0x35')],qs['fields'](_0x1e86c1[_0x7fa2('0x32')][_0x7fa2('0x37')]));_0x3f980f['attributes']=_0x3f980f[_0x7fa2('0x36')][_0x7fa2('0x48')]?_0x3f980f[_0x7fa2('0x36')]:_0x2f072b[_0x7fa2('0x35')];_0x3f980f[_0x7fa2('0x3a')]=qs[_0x7fa2('0x3b')](_0x1e86c1['query'][_0x7fa2('0x3b')]);_0x3f980f['where']=qs['filters'](_[_0x7fa2('0x3d')](_0x1e86c1[_0x7fa2('0x32')],_0x2f072b['filters']));if(_0x1e86c1[_0x7fa2('0x32')]['filter']){_0x3f980f['where']=_[_0x7fa2('0x3f')](_0x3f980f[_0x7fa2('0x3c')],{'$or':_[_0x7fa2('0x2d')](_0x3f980f[_0x7fa2('0x36')],function(_0x133726){var _0x2352d9={};_0x2352d9[_0x133726]={'$like':'%'+_0x1e86c1[_0x7fa2('0x32')][_0x7fa2('0x3e')]+'%'};return _0x2352d9;})});}_0x3f980f=_[_0x7fa2('0x3f')]({},_0x3f980f,_0x1e86c1[_0x7fa2('0x40')]);return _0x2c0dfb['getSubjects'](_0x3f980f);}})['then'](function(_0x1dbd50){if(_0x1dbd50){_0x3e98ff=_0x1dbd50[_0x7fa2('0x48')];if(!_0x1e86c1['query']['hasOwnProperty'](_0x7fa2('0x39'))){_0x3f980f[_0x7fa2('0x21')]=qs[_0x7fa2('0x21')](_0x1e86c1[_0x7fa2('0x32')][_0x7fa2('0x21')]);_0x3f980f['offset']=qs['offset'](_0x1e86c1['query'][_0x7fa2('0x1e')]);}return _0x2c0dfb[_0x7fa2('0x50')](_0x3f980f);}})[_0x7fa2('0x27')](function(_0x30dc79){if(_0x30dc79){return _0x30dc79?{'count':_0x3e98ff,'rows':_0x30dc79}:null;}})[_0x7fa2('0x27')](respondWithResult(_0x75055e,null))[_0x7fa2('0x45')](handleError(_0x75055e,null));};exports[_0x7fa2('0x52')]=function(_0x25d468,_0x53d909,_0x43c503){var _0x1665ea={};var _0x4c2420={};var _0x2389ae;var _0x216fb5;return db[_0x7fa2('0x41')]['findOne']({'where':{'id':_0x25d468['params']['id']}})[_0x7fa2('0x27')](handleEntityNotFound(_0x53d909,null))[_0x7fa2('0x27')](function(_0x335c40){if(_0x335c40){_0x2389ae=_0x335c40;_0x4c2420['model']=_['keys'](db[_0x7fa2('0x4f')][_0x7fa2('0x2e')]);_0x4c2420[_0x7fa2('0x32')]=_['keys'](_0x25d468[_0x7fa2('0x32')]);_0x4c2420[_0x7fa2('0x33')]=_['intersection'](_0x4c2420[_0x7fa2('0x35')],_0x4c2420[_0x7fa2('0x32')]);_0x1665ea['attributes']=_[_0x7fa2('0x34')](_0x4c2420[_0x7fa2('0x35')],qs[_0x7fa2('0x37')](_0x25d468[_0x7fa2('0x32')][_0x7fa2('0x37')]));_0x1665ea['attributes']=_0x1665ea[_0x7fa2('0x36')][_0x7fa2('0x48')]?_0x1665ea['attributes']:_0x4c2420['model'];_0x1665ea[_0x7fa2('0x3a')]=qs[_0x7fa2('0x3b')](_0x25d468[_0x7fa2('0x32')][_0x7fa2('0x3b')]);_0x1665ea[_0x7fa2('0x3c')]=qs[_0x7fa2('0x33')](_[_0x7fa2('0x3d')](_0x25d468[_0x7fa2('0x32')],_0x4c2420[_0x7fa2('0x33')]));if(_0x25d468[_0x7fa2('0x32')][_0x7fa2('0x3e')]){_0x1665ea[_0x7fa2('0x3c')]=_[_0x7fa2('0x3f')](_0x1665ea['where'],{'$or':_[_0x7fa2('0x2d')](_0x1665ea[_0x7fa2('0x36')],function(_0x3626b3){var _0x12e9cc={};_0x12e9cc[_0x3626b3]={'$like':'%'+_0x25d468['query'][_0x7fa2('0x3e')]+'%'};return _0x12e9cc;})});}_0x1665ea=_[_0x7fa2('0x3f')]({},_0x1665ea,_0x25d468['options']);return _0x2389ae[_0x7fa2('0x52')](_0x1665ea);}})['then'](function(_0x76c4a1){if(_0x76c4a1){_0x216fb5=_0x76c4a1[_0x7fa2('0x48')];if(!_0x25d468[_0x7fa2('0x32')]['hasOwnProperty']('nolimit')){_0x1665ea[_0x7fa2('0x21')]=qs[_0x7fa2('0x21')](_0x25d468[_0x7fa2('0x32')][_0x7fa2('0x21')]);_0x1665ea[_0x7fa2('0x1e')]=qs[_0x7fa2('0x1e')](_0x25d468[_0x7fa2('0x32')][_0x7fa2('0x1e')]);}return _0x2389ae[_0x7fa2('0x52')](_0x1665ea);}})[_0x7fa2('0x27')](function(_0x1fe75b){if(_0x1fe75b){return _0x1fe75b?{'count':_0x216fb5,'rows':_0x1fe75b}:null;}})[_0x7fa2('0x27')](respondWithResult(_0x53d909,null))[_0x7fa2('0x45')](handleError(_0x53d909,null));}; \ No newline at end of file +var _0x0ef2=['sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','length','includeAll','create','body','update','find','destroy','params','getFields','findOne','SalesforceField','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','count','offset','status','set','Content-Range','apply','save','then','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order'];(function(_0x8f82df,_0x4ad0e9){var _0x19212a=function(_0xa30958){while(--_0xa30958){_0x8f82df['push'](_0x8f82df['shift']());}};_0x19212a(++_0x4ad0e9);}(_0x0ef2,0x169));var _0x20ef=function(_0x12a2a6,_0x374ff1){_0x12a2a6=_0x12a2a6-0x0;var _0x1754ae=_0x0ef2[_0x12a2a6];return _0x1754ae;};'use strict';var emlformat=require(_0x20ef('0x0'));var rimraf=require(_0x20ef('0x1'));var zipdir=require(_0x20ef('0x2'));var jsonpatch=require(_0x20ef('0x3'));var rp=require('request-promise');var moment=require(_0x20ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x20ef('0x5'));var util=require(_0x20ef('0x6'));var path=require(_0x20ef('0x7'));var sox=require(_0x20ef('0x8'));var csv=require(_0x20ef('0x9'));var ejs=require(_0x20ef('0xa'));var fs=require('fs');var fs_extra=require(_0x20ef('0xb'));var _=require(_0x20ef('0xc'));var squel=require(_0x20ef('0xd'));var crypto=require(_0x20ef('0xe'));var jsforce=require(_0x20ef('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x20ef('0x9'));var querystring=require(_0x20ef('0x10'));var Papa=require(_0x20ef('0x11'));var Redis=require(_0x20ef('0x12'));var authService=require(_0x20ef('0x13'));var qs=require(_0x20ef('0x14'));var as=require(_0x20ef('0x15'));var hardwareService=require(_0x20ef('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x20ef('0x17'));var config=require(_0x20ef('0x18'));var licenseUtil=require(_0x20ef('0x19'));var db=require(_0x20ef('0x1a'))['db'];function respondWithStatusCode(_0x24cbe1,_0x3609ad){_0x3609ad=_0x3609ad||0xcc;return function(_0x486908){if(_0x486908){return _0x24cbe1[_0x20ef('0x1b')](_0x3609ad);}return _0x24cbe1['status'](_0x3609ad)[_0x20ef('0x1c')]();};}function respondWithResult(_0xaa5448,_0x471367){_0x471367=_0x471367||0xc8;return function(_0x118ddb){if(_0x118ddb){return _0xaa5448['status'](_0x471367)[_0x20ef('0x1d')](_0x118ddb);}};}function respondWithFilteredResult(_0x1c5f29,_0x58da53){return function(_0x2b3ec0){if(_0x2b3ec0){var _0x2ea9ba=typeof _0x58da53['offset']==='undefined'&&typeof _0x58da53[_0x20ef('0x1e')]==='undefined';var _0x1bba2c=_0x2b3ec0[_0x20ef('0x1f')];var _0x45167c=_0x2ea9ba?0x0:_0x58da53['offset'];var _0x23088b=_0x2ea9ba?_0x2b3ec0[_0x20ef('0x1f')]:_0x58da53[_0x20ef('0x20')]+_0x58da53[_0x20ef('0x1e')];var _0xd180ed;if(_0x23088b>=_0x1bba2c){_0x23088b=_0x1bba2c;_0xd180ed=0xc8;}else{_0xd180ed=0xce;}_0x1c5f29[_0x20ef('0x21')](_0xd180ed);return _0x1c5f29[_0x20ef('0x22')](_0x20ef('0x23'),_0x45167c+'-'+_0x23088b+'/'+_0x1bba2c)[_0x20ef('0x1d')](_0x2b3ec0);}return null;};}function patchUpdates(_0x8d716b){return function(_0x2a3a4b){try{jsonpatch[_0x20ef('0x24')](_0x2a3a4b,_0x8d716b,!![]);}catch(_0x23e62c){return BPromise['reject'](_0x23e62c);}return _0x2a3a4b[_0x20ef('0x25')]();};}function saveUpdates(_0xcd37fc,_0x5b6b){return function(_0x51ecaf){if(_0x51ecaf){return _0x51ecaf['update'](_0xcd37fc)[_0x20ef('0x26')](function(_0x173a87){return _0x173a87;});}return null;};}function removeEntity(_0x40d79b,_0x51cace){return function(_0x42af24){if(_0x42af24){return _0x42af24['destroy']()[_0x20ef('0x26')](function(){_0x40d79b['status'](0xcc)[_0x20ef('0x1c')]();});}};}function handleEntityNotFound(_0x4077f4,_0x4d592b){return function(_0x5118e6){if(!_0x5118e6){_0x4077f4[_0x20ef('0x1b')](0x194);}return _0x5118e6;};}function handleError(_0x1238e1,_0x592ecf){_0x592ecf=_0x592ecf||0x1f4;return function(_0x289d3b){logger[_0x20ef('0x27')](_0x289d3b[_0x20ef('0x28')]);if(_0x289d3b[_0x20ef('0x29')]){delete _0x289d3b[_0x20ef('0x29')];}_0x1238e1[_0x20ef('0x21')](_0x592ecf)[_0x20ef('0x2a')](_0x289d3b);};}exports[_0x20ef('0x2b')]=function(_0x2ada48,_0x32da7e){var _0x4d5601={},_0x5aed77={},_0x46f95b={'count':0x0,'rows':[]};var _0x36676a=_[_0x20ef('0x2c')](db[_0x20ef('0x2d')][_0x20ef('0x2e')],function(_0x4d460d){return{'name':_0x4d460d[_0x20ef('0x2f')],'type':_0x4d460d[_0x20ef('0x30')][_0x20ef('0x31')]};});_0x5aed77[_0x20ef('0x32')]=_['map'](_0x36676a,_0x20ef('0x29'));_0x5aed77[_0x20ef('0x33')]=_[_0x20ef('0x34')](_0x2ada48[_0x20ef('0x33')]);_0x5aed77[_0x20ef('0x35')]=_['intersection'](_0x5aed77[_0x20ef('0x32')],_0x5aed77[_0x20ef('0x33')]);_0x4d5601[_0x20ef('0x36')]=_[_0x20ef('0x37')](_0x5aed77['model'],qs[_0x20ef('0x38')](_0x2ada48[_0x20ef('0x33')]['fields']));_0x4d5601['attributes']=_0x4d5601['attributes']['length']?_0x4d5601['attributes']:_0x5aed77[_0x20ef('0x32')];if(!_0x2ada48[_0x20ef('0x33')][_0x20ef('0x39')]('nolimit')){_0x4d5601[_0x20ef('0x1e')]=qs[_0x20ef('0x1e')](_0x2ada48[_0x20ef('0x33')][_0x20ef('0x1e')]);_0x4d5601[_0x20ef('0x20')]=qs[_0x20ef('0x20')](_0x2ada48[_0x20ef('0x33')][_0x20ef('0x20')]);}_0x4d5601[_0x20ef('0x3a')]=qs['sort'](_0x2ada48[_0x20ef('0x33')][_0x20ef('0x3b')]);_0x4d5601[_0x20ef('0x3c')]=qs['filters'](_[_0x20ef('0x3d')](_0x2ada48[_0x20ef('0x33')],_0x5aed77[_0x20ef('0x35')]),_0x36676a);if(_0x2ada48[_0x20ef('0x33')][_0x20ef('0x3e')]){_0x4d5601[_0x20ef('0x3c')]=_['merge'](_0x4d5601[_0x20ef('0x3c')],{'$or':_[_0x20ef('0x2c')](_0x36676a,function(_0x53a761){if(_0x53a761[_0x20ef('0x30')]!==_0x20ef('0x3f')){var _0x459d7c={};_0x459d7c[_0x53a761['name']]={'$like':'%'+_0x2ada48[_0x20ef('0x33')][_0x20ef('0x3e')]+'%'};return _0x459d7c;}})});}_0x4d5601=_[_0x20ef('0x40')]({},_0x4d5601,_0x2ada48[_0x20ef('0x41')]);var _0x9614da={'where':_0x4d5601[_0x20ef('0x3c')]};return db[_0x20ef('0x2d')][_0x20ef('0x1f')](_0x9614da)[_0x20ef('0x26')](function(_0xd37e83){_0x46f95b[_0x20ef('0x1f')]=_0xd37e83;if(_0x2ada48[_0x20ef('0x33')]['includeAll']){_0x4d5601[_0x20ef('0x42')]=[{'all':!![]}];}return db[_0x20ef('0x2d')]['findAll'](_0x4d5601);})[_0x20ef('0x26')](function(_0x87d11){_0x46f95b[_0x20ef('0x43')]=_0x87d11;return _0x46f95b;})['then'](respondWithFilteredResult(_0x32da7e,_0x4d5601))[_0x20ef('0x44')](handleError(_0x32da7e,null));};exports[_0x20ef('0x45')]=function(_0x4d0ca7,_0x43838d){var _0x41b077={'raw':![],'where':{'id':_0x4d0ca7['params']['id']}},_0x20ae96={};_0x20ae96[_0x20ef('0x32')]=_['keys'](db[_0x20ef('0x2d')][_0x20ef('0x2e')]);_0x20ae96[_0x20ef('0x33')]=_[_0x20ef('0x34')](_0x4d0ca7['query']);_0x20ae96[_0x20ef('0x35')]=_[_0x20ef('0x37')](_0x20ae96['model'],_0x20ae96[_0x20ef('0x33')]);_0x41b077[_0x20ef('0x36')]=_[_0x20ef('0x37')](_0x20ae96['model'],qs[_0x20ef('0x38')](_0x4d0ca7[_0x20ef('0x33')]['fields']));_0x41b077[_0x20ef('0x36')]=_0x41b077[_0x20ef('0x36')][_0x20ef('0x46')]?_0x41b077['attributes']:_0x20ae96[_0x20ef('0x32')];if(_0x4d0ca7[_0x20ef('0x33')][_0x20ef('0x47')]){_0x41b077['include']=[{'all':!![]}];}_0x41b077=_[_0x20ef('0x40')]({},_0x41b077,_0x4d0ca7[_0x20ef('0x41')]);return db[_0x20ef('0x2d')]['find'](_0x41b077)['then'](handleEntityNotFound(_0x43838d,null))[_0x20ef('0x26')](respondWithResult(_0x43838d,null))[_0x20ef('0x44')](handleError(_0x43838d,null));};exports[_0x20ef('0x48')]=function(_0x47d4f3,_0x55801d){return db['SalesforceConfiguration']['create'](_0x47d4f3[_0x20ef('0x49')],{})[_0x20ef('0x26')](respondWithResult(_0x55801d,0xc9))[_0x20ef('0x44')](handleError(_0x55801d,null));};exports[_0x20ef('0x4a')]=function(_0x51bc93,_0x5ed24d){if(_0x51bc93[_0x20ef('0x49')]['id']){delete _0x51bc93[_0x20ef('0x49')]['id'];}return db[_0x20ef('0x2d')][_0x20ef('0x4b')]({'where':{'id':_0x51bc93['params']['id']}})[_0x20ef('0x26')](handleEntityNotFound(_0x5ed24d,null))[_0x20ef('0x26')](saveUpdates(_0x51bc93[_0x20ef('0x49')],null))[_0x20ef('0x26')](respondWithResult(_0x5ed24d,null))[_0x20ef('0x44')](handleError(_0x5ed24d,null));};exports[_0x20ef('0x4c')]=function(_0x37c01d,_0x39d44c){return db[_0x20ef('0x2d')]['find']({'where':{'id':_0x37c01d[_0x20ef('0x4d')]['id']}})[_0x20ef('0x26')](handleEntityNotFound(_0x39d44c,null))[_0x20ef('0x26')](removeEntity(_0x39d44c,null))[_0x20ef('0x44')](handleError(_0x39d44c,null));};exports[_0x20ef('0x4e')]=function(_0x1e2b85,_0x1c26ea,_0x149707){var _0x59fa88={};var _0x10f5da={};var _0x1d0460;var _0x23bc75;return db[_0x20ef('0x2d')][_0x20ef('0x4f')]({'where':{'id':_0x1e2b85[_0x20ef('0x4d')]['id']}})[_0x20ef('0x26')](handleEntityNotFound(_0x1c26ea,null))['then'](function(_0x21911b){if(_0x21911b){_0x1d0460=_0x21911b;_0x10f5da['model']=_['keys'](db[_0x20ef('0x50')][_0x20ef('0x2e')]);_0x10f5da['query']=_['keys'](_0x1e2b85['query']);_0x10f5da[_0x20ef('0x35')]=_[_0x20ef('0x37')](_0x10f5da[_0x20ef('0x32')],_0x10f5da[_0x20ef('0x33')]);_0x59fa88[_0x20ef('0x36')]=_[_0x20ef('0x37')](_0x10f5da[_0x20ef('0x32')],qs[_0x20ef('0x38')](_0x1e2b85['query'][_0x20ef('0x38')]));_0x59fa88[_0x20ef('0x36')]=_0x59fa88[_0x20ef('0x36')][_0x20ef('0x46')]?_0x59fa88[_0x20ef('0x36')]:_0x10f5da[_0x20ef('0x32')];_0x59fa88[_0x20ef('0x3a')]=qs[_0x20ef('0x3b')](_0x1e2b85[_0x20ef('0x33')][_0x20ef('0x3b')]);_0x59fa88[_0x20ef('0x3c')]=qs[_0x20ef('0x35')](_[_0x20ef('0x3d')](_0x1e2b85[_0x20ef('0x33')],_0x10f5da[_0x20ef('0x35')]));if(_0x1e2b85[_0x20ef('0x33')][_0x20ef('0x3e')]){_0x59fa88['where']=_[_0x20ef('0x40')](_0x59fa88[_0x20ef('0x3c')],{'$or':_[_0x20ef('0x2c')](_0x59fa88['attributes'],function(_0x173368){var _0x19bbae={};_0x19bbae[_0x173368]={'$like':'%'+_0x1e2b85['query'][_0x20ef('0x3e')]+'%'};return _0x19bbae;})});}_0x59fa88=_['merge']({},_0x59fa88,_0x1e2b85['options']);return _0x1d0460[_0x20ef('0x4e')](_0x59fa88);}})[_0x20ef('0x26')](function(_0x315b80){if(_0x315b80){_0x23bc75=_0x315b80['length'];if(!_0x1e2b85['query'][_0x20ef('0x39')](_0x20ef('0x51'))){_0x59fa88[_0x20ef('0x1e')]=qs[_0x20ef('0x1e')](_0x1e2b85[_0x20ef('0x33')][_0x20ef('0x1e')]);_0x59fa88[_0x20ef('0x20')]=qs[_0x20ef('0x20')](_0x1e2b85[_0x20ef('0x33')][_0x20ef('0x20')]);}return _0x1d0460[_0x20ef('0x4e')](_0x59fa88);}})[_0x20ef('0x26')](function(_0x1b57e9){if(_0x1b57e9){return _0x1b57e9?{'count':_0x23bc75,'rows':_0x1b57e9}:null;}})[_0x20ef('0x26')](respondWithResult(_0x1c26ea,null))[_0x20ef('0x44')](handleError(_0x1c26ea,null));};exports['getSubjects']=function(_0x5a32db,_0x1dc6bd,_0x39a7ac){var _0x21ad94={};var _0x30b4d7={};var _0xc3cf51;var _0x8f3d49;return db[_0x20ef('0x2d')][_0x20ef('0x4f')]({'where':{'id':_0x5a32db[_0x20ef('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1dc6bd,null))['then'](function(_0x3605ff){if(_0x3605ff){_0xc3cf51=_0x3605ff;_0x30b4d7['model']=_['keys'](db['SalesforceField'][_0x20ef('0x2e')]);_0x30b4d7[_0x20ef('0x33')]=_[_0x20ef('0x34')](_0x5a32db['query']);_0x30b4d7[_0x20ef('0x35')]=_[_0x20ef('0x37')](_0x30b4d7[_0x20ef('0x32')],_0x30b4d7[_0x20ef('0x33')]);_0x21ad94[_0x20ef('0x36')]=_['intersection'](_0x30b4d7[_0x20ef('0x32')],qs['fields'](_0x5a32db[_0x20ef('0x33')]['fields']));_0x21ad94[_0x20ef('0x36')]=_0x21ad94[_0x20ef('0x36')][_0x20ef('0x46')]?_0x21ad94['attributes']:_0x30b4d7[_0x20ef('0x32')];_0x21ad94[_0x20ef('0x3a')]=qs[_0x20ef('0x3b')](_0x5a32db[_0x20ef('0x33')][_0x20ef('0x3b')]);_0x21ad94[_0x20ef('0x3c')]=qs[_0x20ef('0x35')](_[_0x20ef('0x3d')](_0x5a32db[_0x20ef('0x33')],_0x30b4d7[_0x20ef('0x35')]));if(_0x5a32db[_0x20ef('0x33')][_0x20ef('0x3e')]){_0x21ad94['where']=_['merge'](_0x21ad94[_0x20ef('0x3c')],{'$or':_[_0x20ef('0x2c')](_0x21ad94[_0x20ef('0x36')],function(_0x18b88e){var _0xc0640d={};_0xc0640d[_0x18b88e]={'$like':'%'+_0x5a32db['query']['filter']+'%'};return _0xc0640d;})});}_0x21ad94=_['merge']({},_0x21ad94,_0x5a32db['options']);return _0xc3cf51[_0x20ef('0x52')](_0x21ad94);}})[_0x20ef('0x26')](function(_0x4799b4){if(_0x4799b4){_0x8f3d49=_0x4799b4['length'];if(!_0x5a32db[_0x20ef('0x33')]['hasOwnProperty'](_0x20ef('0x51'))){_0x21ad94[_0x20ef('0x1e')]=qs[_0x20ef('0x1e')](_0x5a32db[_0x20ef('0x33')][_0x20ef('0x1e')]);_0x21ad94[_0x20ef('0x20')]=qs[_0x20ef('0x20')](_0x5a32db[_0x20ef('0x33')]['offset']);}return _0xc3cf51[_0x20ef('0x52')](_0x21ad94);}})[_0x20ef('0x26')](function(_0x3d1266){if(_0x3d1266){return _0x3d1266?{'count':_0x8f3d49,'rows':_0x3d1266}:null;}})[_0x20ef('0x26')](respondWithResult(_0x1dc6bd,null))[_0x20ef('0x44')](handleError(_0x1dc6bd,null));};exports[_0x20ef('0x53')]=function(_0x249e70,_0x239221,_0x51794e){var _0x40521a={};var _0x1f285b={};var _0x1dfdc3;var _0xa3872d;return db[_0x20ef('0x2d')][_0x20ef('0x4f')]({'where':{'id':_0x249e70['params']['id']}})['then'](handleEntityNotFound(_0x239221,null))[_0x20ef('0x26')](function(_0x65540f){if(_0x65540f){_0x1dfdc3=_0x65540f;_0x1f285b[_0x20ef('0x32')]=_[_0x20ef('0x34')](db[_0x20ef('0x50')]['rawAttributes']);_0x1f285b[_0x20ef('0x33')]=_[_0x20ef('0x34')](_0x249e70[_0x20ef('0x33')]);_0x1f285b[_0x20ef('0x35')]=_[_0x20ef('0x37')](_0x1f285b[_0x20ef('0x32')],_0x1f285b['query']);_0x40521a[_0x20ef('0x36')]=_[_0x20ef('0x37')](_0x1f285b[_0x20ef('0x32')],qs[_0x20ef('0x38')](_0x249e70['query'][_0x20ef('0x38')]));_0x40521a[_0x20ef('0x36')]=_0x40521a[_0x20ef('0x36')][_0x20ef('0x46')]?_0x40521a['attributes']:_0x1f285b[_0x20ef('0x32')];_0x40521a[_0x20ef('0x3a')]=qs[_0x20ef('0x3b')](_0x249e70[_0x20ef('0x33')][_0x20ef('0x3b')]);_0x40521a[_0x20ef('0x3c')]=qs[_0x20ef('0x35')](_[_0x20ef('0x3d')](_0x249e70[_0x20ef('0x33')],_0x1f285b[_0x20ef('0x35')]));if(_0x249e70[_0x20ef('0x33')][_0x20ef('0x3e')]){_0x40521a[_0x20ef('0x3c')]=_[_0x20ef('0x40')](_0x40521a['where'],{'$or':_['map'](_0x40521a[_0x20ef('0x36')],function(_0x18da8c){var _0x3ca9a7={};_0x3ca9a7[_0x18da8c]={'$like':'%'+_0x249e70[_0x20ef('0x33')][_0x20ef('0x3e')]+'%'};return _0x3ca9a7;})});}_0x40521a=_[_0x20ef('0x40')]({},_0x40521a,_0x249e70[_0x20ef('0x41')]);return _0x1dfdc3[_0x20ef('0x53')](_0x40521a);}})['then'](function(_0x4b923c){if(_0x4b923c){_0xa3872d=_0x4b923c[_0x20ef('0x46')];if(!_0x249e70[_0x20ef('0x33')]['hasOwnProperty'](_0x20ef('0x51'))){_0x40521a[_0x20ef('0x1e')]=qs[_0x20ef('0x1e')](_0x249e70[_0x20ef('0x33')][_0x20ef('0x1e')]);_0x40521a[_0x20ef('0x20')]=qs[_0x20ef('0x20')](_0x249e70[_0x20ef('0x33')][_0x20ef('0x20')]);}return _0x1dfdc3['getDescriptions'](_0x40521a);}})[_0x20ef('0x26')](function(_0x31f7a8){if(_0x31f7a8){return _0x31f7a8?{'count':_0xa3872d,'rows':_0x31f7a8}:null;}})[_0x20ef('0x26')](respondWithResult(_0x239221,null))['catch'](handleError(_0x239221,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 1fb737c..c2b9564 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 _0x17cd=['util','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations'];(function(_0xea9d6a,_0x5ba67d){var _0x4d633c=function(_0x330e80){while(--_0x330e80){_0xea9d6a['push'](_0xea9d6a['shift']());}};_0x4d633c(++_0x5ba67d);}(_0x17cd,0x190));var _0xd17c=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x17cd[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0xd17c('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd17c('0x1'));var BPromise=require(_0xd17c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd17c('0x3'));var rimraf=require(_0xd17c('0x4'));var config=require(_0xd17c('0x5'));var attributes=require(_0xd17c('0x6'));module['exports']=function(_0x39b8b4,_0x1bc640){return _0x39b8b4[_0xd17c('0x7')](_0xd17c('0x8'),attributes,{'tableName':_0xd17c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11f2=['./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','util','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x3fe042,_0x1106f7){var _0x7d4a1f=function(_0x2df987){while(--_0x2df987){_0x3fe042['push'](_0x3fe042['shift']());}};_0x7d4a1f(++_0x1106f7);}(_0x11f2,0x99));var _0x211f=function(_0x160254,_0x93dc76){_0x160254=_0x160254-0x0;var _0x184fd1=_0x11f2[_0x160254];return _0x184fd1;};'use strict';var _=require('lodash');var util=require(_0x211f('0x0'));var logger=require('../../config/logger')(_0x211f('0x1'));var moment=require(_0x211f('0x2'));var BPromise=require(_0x211f('0x3'));var rp=require(_0x211f('0x4'));var fs=require('fs');var path=require(_0x211f('0x5'));var rimraf=require('rimraf');var config=require(_0x211f('0x6'));var attributes=require(_0x211f('0x7'));module[_0x211f('0x8')]=function(_0x1b224d,_0x1ba4cc){return _0x1b224d['define'](_0x211f('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 2465760..a9ab5f6 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 _0x468c=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x468c,0x117));var _0xc468=function(_0x150558,_0x1b4166){_0x150558=_0x150558-0x0;var _0x2f0e19=_0x468c[_0x150558];return _0x2f0e19;};'use strict';var _=require(_0xc468('0x0'));var util=require(_0xc468('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc468('0x2'));var fs=require('fs');var Redis=require(_0xc468('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc468('0x4'));var logger=require(_0xc468('0x5'))(_0xc468('0x6'));var config=require(_0xc468('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc468('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52d3e9,_0x1bb751,_0x4c7558){return new BPromise(function(_0x29b656,_0x5b68ec){return client[_0xc468('0x9')](_0x52d3e9,_0x4c7558)[_0xc468('0xa')](function(_0x25a5a1){logger[_0xc468('0xb')](_0xc468('0xc'),_0x1bb751,_0xc468('0xd'));logger[_0xc468('0xe')](_0xc468('0xf'),_0x1bb751,_0xc468('0xd'),JSON['stringify'](_0x25a5a1));if(_0x25a5a1[_0xc468('0x10')]){if(_0x25a5a1[_0xc468('0x10')][_0xc468('0x11')]===0x1f4){logger[_0xc468('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x1bb751,_0x25a5a1['error'][_0xc468('0x12')]);return _0x5b68ec(_0x25a5a1[_0xc468('0x10')][_0xc468('0x12')]);}logger[_0xc468('0x10')](_0xc468('0xc'),_0x1bb751,_0x25a5a1[_0xc468('0x10')][_0xc468('0x12')]);return _0x29b656(_0x25a5a1['error'][_0xc468('0x12')]);}else{logger[_0xc468('0xb')](_0xc468('0xc'),_0x1bb751,_0xc468('0xd'));_0x29b656(_0x25a5a1[_0xc468('0x13')][_0xc468('0x12')]);}})[_0xc468('0x14')](function(_0x5ad046){logger[_0xc468('0x10')](_0xc468('0xc'),_0x1bb751,_0x5ad046);_0x5b68ec(_0x5ad046);});});} \ No newline at end of file +var _0x5607=['code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x5607,0x1bd));var _0x7560=function(_0x149d11,_0x36e244){_0x149d11=_0x149d11-0x0;var _0x5ebb5c=_0x5607[_0x149d11];return _0x5ebb5c;};'use strict';var _=require('lodash');var util=require(_0x7560('0x0'));var moment=require('moment');var BPromise=require(_0x7560('0x1'));var rs=require(_0x7560('0x2'));var fs=require('fs');var Redis=require(_0x7560('0x3'));var db=require(_0x7560('0x4'))['db'];var utils=require(_0x7560('0x5'));var logger=require(_0x7560('0x6'))('rpc');var config=require(_0x7560('0x7'));var jayson=require(_0x7560('0x8'));var client=jayson[_0x7560('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217d86,_0x359173,_0x2161f2){return new BPromise(function(_0x742420,_0x104fb2){return client[_0x7560('0xa')](_0x217d86,_0x2161f2)[_0x7560('0xb')](function(_0x146830){logger[_0x7560('0xc')]('SalesforceConfiguration,\x20%s,\x20%s',_0x359173,'request\x20sent');logger[_0x7560('0xd')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x359173,_0x7560('0xe'),JSON[_0x7560('0xf')](_0x146830));if(_0x146830['error']){if(_0x146830[_0x7560('0x10')][_0x7560('0x11')]===0x1f4){logger[_0x7560('0x10')](_0x7560('0x12'),_0x359173,_0x146830[_0x7560('0x10')][_0x7560('0x13')]);return _0x104fb2(_0x146830[_0x7560('0x10')][_0x7560('0x13')]);}logger['error'](_0x7560('0x12'),_0x359173,_0x146830[_0x7560('0x10')]['message']);return _0x742420(_0x146830[_0x7560('0x10')]['message']);}else{logger[_0x7560('0xc')](_0x7560('0x12'),_0x359173,_0x7560('0xe'));_0x742420(_0x146830[_0x7560('0x14')][_0x7560('0x13')]);}})[_0x7560('0x15')](function(_0x2d6af8){logger['error'](_0x7560('0x12'),_0x359173,_0x2d6af8);_0x104fb2(_0x2d6af8);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 270b3eb..536b356 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 _0xb8c6=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get','isAuthenticated','index','/:id','post','create','update','destroy','exports','util','path'];(function(_0x328dcc,_0x3bc466){var _0x4f0c94=function(_0x233e7f){while(--_0x233e7f){_0x328dcc['push'](_0x328dcc['shift']());}};_0x4f0c94(++_0x3bc466);}(_0xb8c6,0xdb));var _0x6b8c=function(_0x84f3d,_0x1cfcc9){_0x84f3d=_0x84f3d-0x0;var _0x3902d4=_0xb8c6[_0x84f3d];return _0x3902d4;};'use strict';var multer=require('multer');var util=require(_0x6b8c('0x0'));var path=require(_0x6b8c('0x1'));var timeout=require(_0x6b8c('0x2'));var express=require(_0x6b8c('0x3'));var router=express[_0x6b8c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b8c('0x5'));var interaction=require(_0x6b8c('0x6'));var config=require('../../config/environment');var controller=require(_0x6b8c('0x7'));router[_0x6b8c('0x8')]('/',auth[_0x6b8c('0x9')](),controller[_0x6b8c('0xa')]);router[_0x6b8c('0x8')](_0x6b8c('0xb'),auth[_0x6b8c('0x9')](),controller['show']);router[_0x6b8c('0xc')]('/',auth[_0x6b8c('0x9')](),controller[_0x6b8c('0xd')]);router['put'](_0x6b8c('0xb'),auth['isAuthenticated'](),controller[_0x6b8c('0xe')]);router['delete'](_0x6b8c('0xb'),auth[_0x6b8c('0x9')](),controller[_0x6b8c('0xf')]);module[_0x6b8c('0x10')]=router; \ No newline at end of file +var _0xee52=['exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','/:id','post','put','update','destroy'];(function(_0x5c016,_0x847e42){var _0x111a9b=function(_0xc8bf50){while(--_0xc8bf50){_0x5c016['push'](_0x5c016['shift']());}};_0x111a9b(++_0x847e42);}(_0xee52,0x100));var _0x2ee5=function(_0x45f340,_0x393990){_0x45f340=_0x45f340-0x0;var _0x115bfb=_0xee52[_0x45f340];return _0x115bfb;};'use strict';var multer=require(_0x2ee5('0x0'));var util=require(_0x2ee5('0x1'));var path=require(_0x2ee5('0x2'));var timeout=require(_0x2ee5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ee5('0x4'));var auth=require(_0x2ee5('0x5'));var interaction=require(_0x2ee5('0x6'));var config=require(_0x2ee5('0x7'));var controller=require(_0x2ee5('0x8'));router[_0x2ee5('0x9')]('/',auth[_0x2ee5('0xa')](),controller['index']);router[_0x2ee5('0x9')](_0x2ee5('0xb'),auth[_0x2ee5('0xa')](),controller['show']);router[_0x2ee5('0xc')]('/',auth[_0x2ee5('0xa')](),controller['create']);router[_0x2ee5('0xd')](_0x2ee5('0xb'),auth[_0x2ee5('0xa')](),controller[_0x2ee5('0xe')]);router['delete'](_0x2ee5('0xb'),auth[_0x2ee5('0xa')](),controller[_0x2ee5('0xf')]);module[_0x2ee5('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 3997041..cc2352a 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 _0xe1eb=['STRING','variable','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x58b794,_0x1a73e2){var _0x3a615e=function(_0x1c4867){while(--_0x1c4867){_0x58b794['push'](_0x58b794['shift']());}};_0x3a615e(++_0x1a73e2);}(_0xe1eb,0x1da));var _0xbe1e=function(_0x172eb7,_0x4589bd){_0x172eb7=_0x172eb7-0x0;var _0x5dc528=_0xe1eb[_0x172eb7];return _0x5dc528;};'use strict';var Sequelize=require(_0xbe1e('0x0'));module[_0xbe1e('0x1')]={'type':{'type':Sequelize[_0xbe1e('0x2')](_0xbe1e('0x3'),'variable',_0xbe1e('0x4'),_0xbe1e('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xbe1e('0x6')]},'key':{'type':Sequelize[_0xbe1e('0x6')]},'keyType':{'type':Sequelize[_0xbe1e('0x2')]('string',_0xbe1e('0x7'),_0xbe1e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xbe1e('0x6')]},'variableName':{'type':Sequelize[_0xbe1e('0x6')]}}; \ No newline at end of file +var _0x429e=['customVariable','sequelize','ENUM','string','variable','keyValue','STRING'];(function(_0x175e89,_0x20835f){var _0x2ed996=function(_0x56239f){while(--_0x56239f){_0x175e89['push'](_0x175e89['shift']());}};_0x2ed996(++_0x20835f);}(_0x429e,0x1b3));var _0xe429=function(_0x15f724,_0x2794ef){_0x15f724=_0x15f724-0x0;var _0x49b152=_0x429e[_0x15f724];return _0x49b152;};'use strict';var Sequelize=require(_0xe429('0x0'));module['exports']={'type':{'type':Sequelize[_0xe429('0x1')](_0xe429('0x2'),_0xe429('0x3'),'customVariable',_0xe429('0x4'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xe429('0x5')]},'key':{'type':Sequelize[_0xe429('0x5')]},'keyType':{'type':Sequelize[_0xe429('0x1')](_0xe429('0x2'),_0xe429('0x3'),_0xe429('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe429('0x5')]},'variableName':{'type':Sequelize[_0xe429('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 6e2a9c6..9eaff72 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 _0xaf7d=['crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','options','SalesforceField','findAll','rows','catch','params','includeAll','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x3e2781,_0x4166d7){var _0x5e3b5a=function(_0x11d686){while(--_0x11d686){_0x3e2781['push'](_0x3e2781['shift']());}};_0x5e3b5a(++_0x4166d7);}(_0xaf7d,0xd9));var _0xdaf7=function(_0x39ec85,_0x36106b){_0x39ec85=_0x39ec85-0x0;var _0x4f5841=_0xaf7d[_0x39ec85];return _0x4f5841;};'use strict';var emlformat=require(_0xdaf7('0x0'));var rimraf=require(_0xdaf7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdaf7('0x2'));var rp=require(_0xdaf7('0x3'));var moment=require(_0xdaf7('0x4'));var BPromise=require(_0xdaf7('0x5'));var Mustache=require(_0xdaf7('0x6'));var util=require(_0xdaf7('0x7'));var path=require(_0xdaf7('0x8'));var sox=require(_0xdaf7('0x9'));var csv=require(_0xdaf7('0xa'));var ejs=require(_0xdaf7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaf7('0xc'));var squel=require(_0xdaf7('0xd'));var crypto=require(_0xdaf7('0xe'));var jsforce=require(_0xdaf7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdaf7('0xa'));var querystring=require('querystring');var Papa=require(_0xdaf7('0x10'));var Redis=require(_0xdaf7('0x11'));var authService=require(_0xdaf7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdaf7('0x13'));var hardwareService=require(_0xdaf7('0x14'));var logger=require('../../config/logger')(_0xdaf7('0x15'));var utils=require(_0xdaf7('0x16'));var config=require(_0xdaf7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xdaf7('0x18'))['db'];function respondWithStatusCode(_0x303b4c,_0x31ca6f){_0x31ca6f=_0x31ca6f||0xcc;return function(_0x19c2a0){if(_0x19c2a0){return _0x303b4c[_0xdaf7('0x19')](_0x31ca6f);}return _0x303b4c[_0xdaf7('0x1a')](_0x31ca6f)[_0xdaf7('0x1b')]();};}function respondWithResult(_0x48357f,_0x12be25){_0x12be25=_0x12be25||0xc8;return function(_0x50decd){if(_0x50decd){return _0x48357f[_0xdaf7('0x1a')](_0x12be25)[_0xdaf7('0x1c')](_0x50decd);}};}function respondWithFilteredResult(_0x53ed85,_0x6eb34e){return function(_0x17f080){if(_0x17f080){var _0x5a24d0=typeof _0x6eb34e['offset']===_0xdaf7('0x1d')&&typeof _0x6eb34e[_0xdaf7('0x1e')]===_0xdaf7('0x1d');var _0x77afac=_0x17f080[_0xdaf7('0x1f')];var _0x378eea=_0x5a24d0?0x0:_0x6eb34e[_0xdaf7('0x20')];var _0x344424=_0x5a24d0?_0x17f080[_0xdaf7('0x1f')]:_0x6eb34e[_0xdaf7('0x20')]+_0x6eb34e[_0xdaf7('0x1e')];var _0x1b9386;if(_0x344424>=_0x77afac){_0x344424=_0x77afac;_0x1b9386=0xc8;}else{_0x1b9386=0xce;}_0x53ed85[_0xdaf7('0x1a')](_0x1b9386);return _0x53ed85[_0xdaf7('0x21')](_0xdaf7('0x22'),_0x378eea+'-'+_0x344424+'/'+_0x77afac)['json'](_0x17f080);}return null;};}function patchUpdates(_0x186a2a){return function(_0x7ffd51){try{jsonpatch[_0xdaf7('0x23')](_0x7ffd51,_0x186a2a,!![]);}catch(_0x2c1f9c){return BPromise['reject'](_0x2c1f9c);}return _0x7ffd51[_0xdaf7('0x24')]();};}function saveUpdates(_0xf3f5d9,_0x1a6213){return function(_0x4861fe){if(_0x4861fe){return _0x4861fe[_0xdaf7('0x25')](_0xf3f5d9)[_0xdaf7('0x26')](function(_0x25e6d1){return _0x25e6d1;});}return null;};}function removeEntity(_0x23c187,_0x20eec9){return function(_0x40531a){if(_0x40531a){return _0x40531a[_0xdaf7('0x27')]()[_0xdaf7('0x26')](function(){_0x23c187[_0xdaf7('0x1a')](0xcc)[_0xdaf7('0x1b')]();});}};}function handleEntityNotFound(_0x48cb96,_0x5a6816){return function(_0x4f708b){if(!_0x4f708b){_0x48cb96[_0xdaf7('0x19')](0x194);}return _0x4f708b;};}function handleError(_0x2114b3,_0x50fdf6){_0x50fdf6=_0x50fdf6||0x1f4;return function(_0x4d01e1){logger[_0xdaf7('0x28')](_0x4d01e1[_0xdaf7('0x29')]);if(_0x4d01e1[_0xdaf7('0x2a')]){delete _0x4d01e1[_0xdaf7('0x2a')];}_0x2114b3[_0xdaf7('0x1a')](_0x50fdf6)[_0xdaf7('0x2b')](_0x4d01e1);};}exports[_0xdaf7('0x2c')]=function(_0x11e3de,_0xd8cfd1){var _0x32dd63={},_0x51c622={},_0xfb0ea9={'count':0x0,'rows':[]};var _0x34a46e=_[_0xdaf7('0x2d')](db['SalesforceField'][_0xdaf7('0x2e')],function(_0x2b6a93){return{'name':_0x2b6a93[_0xdaf7('0x2f')],'type':_0x2b6a93['type'][_0xdaf7('0x30')]};});_0x51c622['model']=_[_0xdaf7('0x2d')](_0x34a46e,_0xdaf7('0x2a'));_0x51c622[_0xdaf7('0x31')]=_[_0xdaf7('0x32')](_0x11e3de['query']);_0x51c622['filters']=_[_0xdaf7('0x33')](_0x51c622['model'],_0x51c622[_0xdaf7('0x31')]);_0x32dd63[_0xdaf7('0x34')]=_[_0xdaf7('0x33')](_0x51c622[_0xdaf7('0x35')],qs[_0xdaf7('0x36')](_0x11e3de[_0xdaf7('0x31')][_0xdaf7('0x36')]));_0x32dd63[_0xdaf7('0x34')]=_0x32dd63[_0xdaf7('0x34')][_0xdaf7('0x37')]?_0x32dd63[_0xdaf7('0x34')]:_0x51c622[_0xdaf7('0x35')];if(!_0x11e3de[_0xdaf7('0x31')][_0xdaf7('0x38')](_0xdaf7('0x39'))){_0x32dd63[_0xdaf7('0x1e')]=qs['limit'](_0x11e3de[_0xdaf7('0x31')][_0xdaf7('0x1e')]);_0x32dd63[_0xdaf7('0x20')]=qs['offset'](_0x11e3de['query'][_0xdaf7('0x20')]);}_0x32dd63[_0xdaf7('0x3a')]=qs[_0xdaf7('0x3b')](_0x11e3de['query'][_0xdaf7('0x3b')]);_0x32dd63[_0xdaf7('0x3c')]=qs[_0xdaf7('0x3d')](_[_0xdaf7('0x3e')](_0x11e3de['query'],_0x51c622[_0xdaf7('0x3d')]),_0x34a46e);if(_0x11e3de['query'][_0xdaf7('0x3f')]){_0x32dd63[_0xdaf7('0x3c')]=_[_0xdaf7('0x40')](_0x32dd63[_0xdaf7('0x3c')],{'$or':_[_0xdaf7('0x2d')](_0x34a46e,function(_0x38abce){if(_0x38abce[_0xdaf7('0x41')]!=='VIRTUAL'){var _0xabc923={};_0xabc923[_0x38abce[_0xdaf7('0x2a')]]={'$like':'%'+_0x11e3de[_0xdaf7('0x31')]['filter']+'%'};return _0xabc923;}})});}_0x32dd63=_[_0xdaf7('0x40')]({},_0x32dd63,_0x11e3de[_0xdaf7('0x42')]);var _0x41dfee={'where':_0x32dd63[_0xdaf7('0x3c')]};return db['SalesforceField']['count'](_0x41dfee)['then'](function(_0x5ab910){_0xfb0ea9[_0xdaf7('0x1f')]=_0x5ab910;if(_0x11e3de[_0xdaf7('0x31')]['includeAll']){_0x32dd63['include']=[{'all':!![]}];}return db[_0xdaf7('0x43')][_0xdaf7('0x44')](_0x32dd63);})[_0xdaf7('0x26')](function(_0x4cefdf){_0xfb0ea9[_0xdaf7('0x45')]=_0x4cefdf;return _0xfb0ea9;})[_0xdaf7('0x26')](respondWithFilteredResult(_0xd8cfd1,_0x32dd63))[_0xdaf7('0x46')](handleError(_0xd8cfd1,null));};exports['show']=function(_0x423f3b,_0x49213e){var _0x4969f4={'raw':!![],'where':{'id':_0x423f3b[_0xdaf7('0x47')]['id']}},_0x2d801d={};_0x2d801d[_0xdaf7('0x35')]=_[_0xdaf7('0x32')](db['SalesforceField'][_0xdaf7('0x2e')]);_0x2d801d[_0xdaf7('0x31')]=_[_0xdaf7('0x32')](_0x423f3b[_0xdaf7('0x31')]);_0x2d801d[_0xdaf7('0x3d')]=_[_0xdaf7('0x33')](_0x2d801d[_0xdaf7('0x35')],_0x2d801d[_0xdaf7('0x31')]);_0x4969f4['attributes']=_['intersection'](_0x2d801d[_0xdaf7('0x35')],qs[_0xdaf7('0x36')](_0x423f3b['query'][_0xdaf7('0x36')]));_0x4969f4[_0xdaf7('0x34')]=_0x4969f4['attributes'][_0xdaf7('0x37')]?_0x4969f4[_0xdaf7('0x34')]:_0x2d801d['model'];if(_0x423f3b['query'][_0xdaf7('0x48')]){_0x4969f4[_0xdaf7('0x49')]=[{'all':!![]}];}_0x4969f4=_['merge']({},_0x4969f4,_0x423f3b['options']);return db['SalesforceField']['find'](_0x4969f4)[_0xdaf7('0x26')](handleEntityNotFound(_0x49213e,null))[_0xdaf7('0x26')](respondWithResult(_0x49213e,null))[_0xdaf7('0x46')](handleError(_0x49213e,null));};exports[_0xdaf7('0x4a')]=function(_0x1311b3,_0x4a575c){return db['SalesforceField']['create'](_0x1311b3[_0xdaf7('0x4b')],{})[_0xdaf7('0x26')](respondWithResult(_0x4a575c,0xc9))[_0xdaf7('0x46')](handleError(_0x4a575c,null));};exports[_0xdaf7('0x25')]=function(_0x3c04a8,_0x460fc4){if(_0x3c04a8[_0xdaf7('0x4b')]['id']){delete _0x3c04a8[_0xdaf7('0x4b')]['id'];}return db[_0xdaf7('0x43')][_0xdaf7('0x4c')]({'where':{'id':_0x3c04a8[_0xdaf7('0x47')]['id']}})[_0xdaf7('0x26')](handleEntityNotFound(_0x460fc4,null))['then'](saveUpdates(_0x3c04a8[_0xdaf7('0x4b')],null))[_0xdaf7('0x26')](respondWithResult(_0x460fc4,null))[_0xdaf7('0x46')](handleError(_0x460fc4,null));};exports[_0xdaf7('0x27')]=function(_0x214801,_0x323318){return db[_0xdaf7('0x43')]['find']({'where':{'id':_0x214801[_0xdaf7('0x47')]['id']}})[_0xdaf7('0x26')](handleEntityNotFound(_0x323318,null))[_0xdaf7('0x26')](removeEntity(_0x323318,null))[_0xdaf7('0x46')](handleError(_0x323318,null));}; \ No newline at end of file +var _0x5418=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x50a13f,_0x5a2a04){var _0x3e7e6f=function(_0x55a5be){while(--_0x55a5be){_0x50a13f['push'](_0x50a13f['shift']());}};_0x3e7e6f(++_0x5a2a04);}(_0x5418,0x7e));var _0x8541=function(_0x2f0daa,_0x34c4ec){_0x2f0daa=_0x2f0daa-0x0;var _0x109070=_0x5418[_0x2f0daa];return _0x109070;};'use strict';var emlformat=require(_0x8541('0x0'));var rimraf=require(_0x8541('0x1'));var zipdir=require(_0x8541('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8541('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8541('0x4'));var util=require(_0x8541('0x5'));var path=require('path');var sox=require(_0x8541('0x6'));var csv=require('to-csv');var ejs=require(_0x8541('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8541('0x8'));var squel=require(_0x8541('0x9'));var crypto=require('crypto');var jsforce=require(_0x8541('0xa'));var deskjs=require(_0x8541('0xb'));var toCsv=require(_0x8541('0xc'));var querystring=require(_0x8541('0xd'));var Papa=require(_0x8541('0xe'));var Redis=require('ioredis');var authService=require(_0x8541('0xf'));var qs=require(_0x8541('0x10'));var as=require(_0x8541('0x11'));var hardwareService=require(_0x8541('0x12'));var logger=require(_0x8541('0x13'))(_0x8541('0x14'));var utils=require(_0x8541('0x15'));var config=require(_0x8541('0x16'));var licenseUtil=require(_0x8541('0x17'));var db=require(_0x8541('0x18'))['db'];function respondWithStatusCode(_0x2cad6c,_0x4c5909){_0x4c5909=_0x4c5909||0xcc;return function(_0xd2ef5b){if(_0xd2ef5b){return _0x2cad6c['sendStatus'](_0x4c5909);}return _0x2cad6c[_0x8541('0x19')](_0x4c5909)[_0x8541('0x1a')]();};}function respondWithResult(_0x20ee40,_0x20c2aa){_0x20c2aa=_0x20c2aa||0xc8;return function(_0x476db8){if(_0x476db8){return _0x20ee40[_0x8541('0x19')](_0x20c2aa)[_0x8541('0x1b')](_0x476db8);}};}function respondWithFilteredResult(_0x43630e,_0x2a0744){return function(_0x2fc893){if(_0x2fc893){var _0x36a27d=typeof _0x2a0744[_0x8541('0x1c')]==='undefined'&&typeof _0x2a0744[_0x8541('0x1d')]==='undefined';var _0x4f8161=_0x2fc893[_0x8541('0x1e')];var _0x4fcede=_0x36a27d?0x0:_0x2a0744[_0x8541('0x1c')];var _0x51d616=_0x36a27d?_0x2fc893[_0x8541('0x1e')]:_0x2a0744['offset']+_0x2a0744['limit'];var _0x454d19;if(_0x51d616>=_0x4f8161){_0x51d616=_0x4f8161;_0x454d19=0xc8;}else{_0x454d19=0xce;}_0x43630e[_0x8541('0x19')](_0x454d19);return _0x43630e['set'](_0x8541('0x1f'),_0x4fcede+'-'+_0x51d616+'/'+_0x4f8161)[_0x8541('0x1b')](_0x2fc893);}return null;};}function patchUpdates(_0x3d2b2d){return function(_0x594d08){try{jsonpatch['apply'](_0x594d08,_0x3d2b2d,!![]);}catch(_0x4b7ca5){return BPromise[_0x8541('0x20')](_0x4b7ca5);}return _0x594d08[_0x8541('0x21')]();};}function saveUpdates(_0xea4530,_0x5356f2){return function(_0x43ca7f){if(_0x43ca7f){return _0x43ca7f[_0x8541('0x22')](_0xea4530)[_0x8541('0x23')](function(_0x1991da){return _0x1991da;});}return null;};}function removeEntity(_0x2f1727,_0x972f99){return function(_0x2644fb){if(_0x2644fb){return _0x2644fb[_0x8541('0x24')]()[_0x8541('0x23')](function(){_0x2f1727[_0x8541('0x19')](0xcc)[_0x8541('0x1a')]();});}};}function handleEntityNotFound(_0x132013,_0x48ec14){return function(_0x1ff4fc){if(!_0x1ff4fc){_0x132013['sendStatus'](0x194);}return _0x1ff4fc;};}function handleError(_0x412950,_0x36f6d9){_0x36f6d9=_0x36f6d9||0x1f4;return function(_0x5cca4c){logger['error'](_0x5cca4c[_0x8541('0x25')]);if(_0x5cca4c['name']){delete _0x5cca4c[_0x8541('0x26')];}_0x412950[_0x8541('0x19')](_0x36f6d9)[_0x8541('0x27')](_0x5cca4c);};}exports[_0x8541('0x28')]=function(_0x2fbfd3,_0x33365c){var _0x40d6eb={},_0x37222b={},_0x18a450={'count':0x0,'rows':[]};var _0x189704=_[_0x8541('0x29')](db[_0x8541('0x2a')][_0x8541('0x2b')],function(_0x2d5428){return{'name':_0x2d5428['fieldName'],'type':_0x2d5428[_0x8541('0x2c')][_0x8541('0x2d')]};});_0x37222b[_0x8541('0x2e')]=_[_0x8541('0x29')](_0x189704,'name');_0x37222b[_0x8541('0x2f')]=_[_0x8541('0x30')](_0x2fbfd3[_0x8541('0x2f')]);_0x37222b[_0x8541('0x31')]=_[_0x8541('0x32')](_0x37222b[_0x8541('0x2e')],_0x37222b[_0x8541('0x2f')]);_0x40d6eb[_0x8541('0x33')]=_[_0x8541('0x32')](_0x37222b[_0x8541('0x2e')],qs[_0x8541('0x34')](_0x2fbfd3['query'][_0x8541('0x34')]));_0x40d6eb[_0x8541('0x33')]=_0x40d6eb[_0x8541('0x33')][_0x8541('0x35')]?_0x40d6eb[_0x8541('0x33')]:_0x37222b[_0x8541('0x2e')];if(!_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x36')](_0x8541('0x37'))){_0x40d6eb[_0x8541('0x1d')]=qs[_0x8541('0x1d')](_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x1d')]);_0x40d6eb[_0x8541('0x1c')]=qs[_0x8541('0x1c')](_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x1c')]);}_0x40d6eb[_0x8541('0x38')]=qs[_0x8541('0x39')](_0x2fbfd3[_0x8541('0x2f')]['sort']);_0x40d6eb[_0x8541('0x3a')]=qs[_0x8541('0x31')](_[_0x8541('0x3b')](_0x2fbfd3[_0x8541('0x2f')],_0x37222b[_0x8541('0x31')]),_0x189704);if(_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x3c')]){_0x40d6eb[_0x8541('0x3a')]=_[_0x8541('0x3d')](_0x40d6eb[_0x8541('0x3a')],{'$or':_[_0x8541('0x29')](_0x189704,function(_0x2fcd34){if(_0x2fcd34[_0x8541('0x2c')]!==_0x8541('0x3e')){var _0x578510={};_0x578510[_0x2fcd34['name']]={'$like':'%'+_0x2fbfd3[_0x8541('0x2f')][_0x8541('0x3c')]+'%'};return _0x578510;}})});}_0x40d6eb=_[_0x8541('0x3d')]({},_0x40d6eb,_0x2fbfd3['options']);var _0x1ab978={'where':_0x40d6eb[_0x8541('0x3a')]};return db[_0x8541('0x2a')][_0x8541('0x1e')](_0x1ab978)[_0x8541('0x23')](function(_0x3dc7d4){_0x18a450[_0x8541('0x1e')]=_0x3dc7d4;if(_0x2fbfd3['query'][_0x8541('0x3f')]){_0x40d6eb[_0x8541('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x8541('0x41')](_0x40d6eb);})[_0x8541('0x23')](function(_0x1d21e3){_0x18a450[_0x8541('0x42')]=_0x1d21e3;return _0x18a450;})['then'](respondWithFilteredResult(_0x33365c,_0x40d6eb))['catch'](handleError(_0x33365c,null));};exports[_0x8541('0x43')]=function(_0x23d03e,_0xf2d43){var _0x41f782={'raw':!![],'where':{'id':_0x23d03e[_0x8541('0x44')]['id']}},_0x8214d4={};_0x8214d4[_0x8541('0x2e')]=_[_0x8541('0x30')](db[_0x8541('0x2a')][_0x8541('0x2b')]);_0x8214d4['query']=_[_0x8541('0x30')](_0x23d03e[_0x8541('0x2f')]);_0x8214d4[_0x8541('0x31')]=_[_0x8541('0x32')](_0x8214d4[_0x8541('0x2e')],_0x8214d4[_0x8541('0x2f')]);_0x41f782[_0x8541('0x33')]=_['intersection'](_0x8214d4['model'],qs[_0x8541('0x34')](_0x23d03e[_0x8541('0x2f')][_0x8541('0x34')]));_0x41f782['attributes']=_0x41f782[_0x8541('0x33')][_0x8541('0x35')]?_0x41f782[_0x8541('0x33')]:_0x8214d4[_0x8541('0x2e')];if(_0x23d03e['query'][_0x8541('0x3f')]){_0x41f782[_0x8541('0x40')]=[{'all':!![]}];}_0x41f782=_[_0x8541('0x3d')]({},_0x41f782,_0x23d03e['options']);return db['SalesforceField']['find'](_0x41f782)[_0x8541('0x23')](handleEntityNotFound(_0xf2d43,null))['then'](respondWithResult(_0xf2d43,null))[_0x8541('0x45')](handleError(_0xf2d43,null));};exports['create']=function(_0x3df339,_0x5be5e8){return db[_0x8541('0x2a')][_0x8541('0x46')](_0x3df339[_0x8541('0x47')],{})[_0x8541('0x23')](respondWithResult(_0x5be5e8,0xc9))['catch'](handleError(_0x5be5e8,null));};exports[_0x8541('0x22')]=function(_0x401edd,_0x1cdeff){if(_0x401edd[_0x8541('0x47')]['id']){delete _0x401edd[_0x8541('0x47')]['id'];}return db[_0x8541('0x2a')][_0x8541('0x48')]({'where':{'id':_0x401edd[_0x8541('0x44')]['id']}})[_0x8541('0x23')](handleEntityNotFound(_0x1cdeff,null))['then'](saveUpdates(_0x401edd[_0x8541('0x47')],null))['then'](respondWithResult(_0x1cdeff,null))[_0x8541('0x45')](handleError(_0x1cdeff,null));};exports[_0x8541('0x24')]=function(_0x3bf774,_0x35eed3){return db[_0x8541('0x2a')][_0x8541('0x48')]({'where':{'id':_0x3bf774[_0x8541('0x44')]['id']}})[_0x8541('0x23')](handleEntityNotFound(_0x35eed3,null))[_0x8541('0x23')](removeEntity(_0x35eed3,null))['catch'](handleError(_0x35eed3,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 974b70e..ac42db8 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 _0x7550=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','lodash'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0x7550,0x158));var _0x0755=function(_0x46e371,_0x1883dd){_0x46e371=_0x46e371-0x0;var _0x14a75a=_0x7550[_0x46e371];return _0x14a75a;};'use strict';var _=require(_0x0755('0x0'));var util=require(_0x0755('0x1'));var logger=require(_0x0755('0x2'))(_0x0755('0x3'));var moment=require(_0x0755('0x4'));var BPromise=require(_0x0755('0x5'));var rp=require(_0x0755('0x6'));var fs=require('fs');var path=require(_0x0755('0x7'));var rimraf=require('rimraf');var config=require(_0x0755('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0x0755('0x9')]=function(_0x404def,_0x373103){return _0x404def[_0x0755('0xa')](_0x0755('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x0755('0xc'),'fields':[_0x0755('0xd'),_0x0755('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91c1=['SalesforceField','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','path','../../config/environment','define'];(function(_0x5eda86,_0x5b0a7c){var _0x13e061=function(_0x428366){while(--_0x428366){_0x5eda86['push'](_0x5eda86['shift']());}};_0x13e061(++_0x5b0a7c);}(_0x91c1,0xae));var _0x191c=function(_0x2f87cd,_0xcaf299){_0x2f87cd=_0x2f87cd-0x0;var _0x5d7eda=_0x91c1[_0x2f87cd];return _0x5d7eda;};'use strict';var _=require('lodash');var util=require(_0x191c('0x0'));var logger=require(_0x191c('0x1'))(_0x191c('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x191c('0x3'));var rimraf=require('rimraf');var config=require(_0x191c('0x4'));var attributes=require('./intSalesforceField.attributes');module['exports']=function(_0x1c106e,_0x55e4e1){return _0x1c106e[_0x191c('0x5')](_0x191c('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x191c('0x7'),'fields':[_0x191c('0x8'),_0x191c('0x9')],'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 85c8d8f..62b066b 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 _0x7c2d=['SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SalesforceField,\x20%s,\x20%s','debug'];(function(_0x15d24a,_0x53a9f2){var _0x57d686=function(_0x46627a){while(--_0x46627a){_0x15d24a['push'](_0x15d24a['shift']());}};_0x57d686(++_0x53a9f2);}(_0x7c2d,0xaa));var _0xd7c2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7c2d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd7c2('0x0'));var util=require(_0xd7c2('0x1'));var moment=require('moment');var BPromise=require(_0xd7c2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd7c2('0x3'));var db=require(_0xd7c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd7c2('0x5'))(_0xd7c2('0x6'));var config=require(_0xd7c2('0x7'));var jayson=require(_0xd7c2('0x8'));var client=jayson[_0xd7c2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e93ab,_0x42aabf,_0x298bb7){return new BPromise(function(_0x5b1f4d,_0x5a17e0){return client[_0xd7c2('0xa')](_0x5e93ab,_0x298bb7)[_0xd7c2('0xb')](function(_0x4cd6f6){logger['info'](_0xd7c2('0xc'),_0x42aabf,'request\x20sent');logger[_0xd7c2('0xd')](_0xd7c2('0xe'),_0x42aabf,_0xd7c2('0xf'),JSON[_0xd7c2('0x10')](_0x4cd6f6));if(_0x4cd6f6[_0xd7c2('0x11')]){if(_0x4cd6f6['error'][_0xd7c2('0x12')]===0x1f4){logger[_0xd7c2('0x11')](_0xd7c2('0xc'),_0x42aabf,_0x4cd6f6[_0xd7c2('0x11')][_0xd7c2('0x13')]);return _0x5a17e0(_0x4cd6f6['error'][_0xd7c2('0x13')]);}logger[_0xd7c2('0x11')](_0xd7c2('0xc'),_0x42aabf,_0x4cd6f6[_0xd7c2('0x11')][_0xd7c2('0x13')]);return _0x5b1f4d(_0x4cd6f6[_0xd7c2('0x11')][_0xd7c2('0x13')]);}else{logger[_0xd7c2('0x14')](_0xd7c2('0xc'),_0x42aabf,'request\x20sent');_0x5b1f4d(_0x4cd6f6[_0xd7c2('0x15')]['message']);}})[_0xd7c2('0x16')](function(_0x22603e){logger[_0xd7c2('0x11')](_0xd7c2('0xc'),_0x42aabf,_0x22603e);_0x5a17e0(_0x22603e);});});} \ No newline at end of file +var _0x56d6=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x6c0123,_0x4c8d3b){var _0x5a87d2=function(_0x1ff614){while(--_0x1ff614){_0x6c0123['push'](_0x6c0123['shift']());}};_0x5a87d2(++_0x4c8d3b);}(_0x56d6,0x77));var _0x656d=function(_0x396af9,_0x269289){_0x396af9=_0x396af9-0x0;var _0xc181e6=_0x56d6[_0x396af9];return _0xc181e6;};'use strict';var _=require(_0x656d('0x0'));var util=require(_0x656d('0x1'));var moment=require(_0x656d('0x2'));var BPromise=require(_0x656d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x656d('0x4'));var db=require(_0x656d('0x5'))['db'];var utils=require(_0x656d('0x6'));var logger=require(_0x656d('0x7'))(_0x656d('0x8'));var config=require(_0x656d('0x9'));var jayson=require(_0x656d('0xa'));var client=jayson[_0x656d('0xb')][_0x656d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b5555,_0x12155e,_0x30a75d){return new BPromise(function(_0x393d90,_0x351a2b){return client[_0x656d('0xd')](_0x4b5555,_0x30a75d)[_0x656d('0xe')](function(_0x2d5033){logger[_0x656d('0xf')](_0x656d('0x10'),_0x12155e,_0x656d('0x11'));logger[_0x656d('0x12')](_0x656d('0x13'),_0x12155e,_0x656d('0x11'),JSON['stringify'](_0x2d5033));if(_0x2d5033[_0x656d('0x14')]){if(_0x2d5033[_0x656d('0x14')][_0x656d('0x15')]===0x1f4){logger[_0x656d('0x14')](_0x656d('0x10'),_0x12155e,_0x2d5033[_0x656d('0x14')][_0x656d('0x16')]);return _0x351a2b(_0x2d5033[_0x656d('0x14')][_0x656d('0x16')]);}logger[_0x656d('0x14')](_0x656d('0x10'),_0x12155e,_0x2d5033[_0x656d('0x14')]['message']);return _0x393d90(_0x2d5033[_0x656d('0x14')][_0x656d('0x16')]);}else{logger[_0x656d('0xf')](_0x656d('0x10'),_0x12155e,'request\x20sent');_0x393d90(_0x2d5033[_0x656d('0x17')][_0x656d('0x16')]);}})[_0x656d('0x18')](function(_0xd8a6c3){logger[_0x656d('0x14')]('SalesforceField,\x20%s,\x20%s',_0x12155e,_0xd8a6c3);_0x351a2b(_0xd8a6c3);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bfb820d..b9e0c36 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 _0x3512=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','/:id','show','get','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x3512,0x13b));var _0x2351=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3512[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require('multer');var util=require(_0x2351('0x0'));var path=require(_0x2351('0x1'));var timeout=require(_0x2351('0x2'));var express=require(_0x2351('0x3'));var router=express[_0x2351('0x4')]();var fs_extra=require(_0x2351('0x5'));var auth=require(_0x2351('0x6'));var interaction=require(_0x2351('0x7'));var config=require(_0x2351('0x8'));var controller=require(_0x2351('0x9'));router['get']('/',auth[_0x2351('0xa')](),controller[_0x2351('0xb')]);router['get'](_0x2351('0xc'),auth[_0x2351('0xa')](),controller[_0x2351('0xd')]);router[_0x2351('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x2351('0xf')]);router[_0x2351('0xe')](_0x2351('0x10'),auth[_0x2351('0xa')](),controller[_0x2351('0x11')]);router[_0x2351('0x12')]('/',auth[_0x2351('0xa')](),controller['create']);router[_0x2351('0x12')](_0x2351('0x13'),auth['isAuthenticated'](),controller[_0x2351('0x14')]);router[_0x2351('0x15')](_0x2351('0xc'),auth[_0x2351('0xa')](),controller[_0x2351('0x16')]);router[_0x2351('0x17')](_0x2351('0xc'),auth[_0x2351('0xa')](),controller[_0x2351('0x18')]);module[_0x2351('0x19')]=router; \ No newline at end of file +var _0xfad0=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post','addConfiguration','put','update','destroy'];(function(_0x57171b,_0x402dd9){var _0x2b9225=function(_0x4fed69){while(--_0x4fed69){_0x57171b['push'](_0x57171b['shift']());}};_0x2b9225(++_0x402dd9);}(_0xfad0,0xb0));var _0x0fad=function(_0x1c49cd,_0x5c63cd){_0x1c49cd=_0x1c49cd-0x0;var _0x2e1f05=_0xfad0[_0x1c49cd];return _0x2e1f05;};'use strict';var multer=require('multer');var util=require(_0x0fad('0x0'));var path=require('path');var timeout=require(_0x0fad('0x1'));var express=require(_0x0fad('0x2'));var router=express['Router']();var fs_extra=require(_0x0fad('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0fad('0x4'));var config=require(_0x0fad('0x5'));var controller=require(_0x0fad('0x6'));router[_0x0fad('0x7')]('/',auth[_0x0fad('0x8')](),controller[_0x0fad('0x9')]);router[_0x0fad('0x7')](_0x0fad('0xa'),auth[_0x0fad('0x8')](),controller[_0x0fad('0xb')]);router[_0x0fad('0x7')](_0x0fad('0xc'),auth[_0x0fad('0x8')](),controller[_0x0fad('0xd')]);router[_0x0fad('0x7')](_0x0fad('0xe'),auth['isAuthenticated'](),controller[_0x0fad('0xf')]);router['post']('/',auth[_0x0fad('0x8')](),controller[_0x0fad('0x10')]);router[_0x0fad('0x11')](_0x0fad('0xc'),auth[_0x0fad('0x8')](),controller[_0x0fad('0x12')]);router[_0x0fad('0x13')]('/:id',auth[_0x0fad('0x8')](),controller[_0x0fad('0x14')]);router['delete'](_0x0fad('0xa'),auth[_0x0fad('0x8')](),controller[_0x0fad('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 8b8dcf0..edbbc1f 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 _0xea7c=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5c8dd1,_0x197735){var _0x478890=function(_0x5161e7){while(--_0x5161e7){_0x5c8dd1['push'](_0x5c8dd1['shift']());}};_0x478890(++_0x197735);}(_0xea7c,0x12d));var _0xcea7=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xea7c[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0xcea7('0x0'));module[_0xcea7('0x1')]={'name':{'type':Sequelize[_0xcea7('0x2')]},'description':{'type':Sequelize[_0xcea7('0x2')]},'username':{'type':Sequelize[_0xcea7('0x2')],'unique':_0xcea7('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcea7('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0xcea7('0x4')},'serverUrl':{'type':Sequelize[_0xcea7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x1d6d=['STRING','username','remoteUri','sequelize'];(function(_0x1251d1,_0x426abf){var _0x397bdc=function(_0x2e734d){while(--_0x2e734d){_0x1251d1['push'](_0x1251d1['shift']());}};_0x397bdc(++_0x426abf);}(_0x1d6d,0x183));var _0xd1d6=function(_0x4b4330,_0x2ad596){_0x4b4330=_0x4b4330-0x0;var _0x24e70e=_0x1d6d[_0x4b4330];return _0x24e70e;};'use strict';var Sequelize=require(_0xd1d6('0x0'));module['exports']={'name':{'type':Sequelize[_0xd1d6('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd1d6('0x1')],'unique':_0xd1d6('0x2')},'password':{'type':Sequelize[_0xd1d6('0x1')]},'email':{'type':Sequelize[_0xd1d6('0x1')]},'remoteUri':{'type':Sequelize[_0xd1d6('0x1')],'unique':_0xd1d6('0x3')},'serverUrl':{'type':Sequelize[_0xd1d6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index 9fdf445..7d79c78 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 _0x2bd9=['apply','reject','save','then','destroy','stack','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','name','keys','query','filters','attributes','model','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','rows','show','params','intersection','find','catch','create','body','update','getConfigurations','findOne','ServicenowConfiguration','fields','hasOwnProperty','addConfiguration','AccountId','Subjects','channel','getDescriptions','ServicenowField','Descriptions','getFields','made_sla','hold_reason','subcategory','close_code','notify','incident_state','severity','parent','caused_by','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','user_input','state','knowledge','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','work_notes_list','business_service','priority','sys_domain_path','rfc','business_duration','work_end','reopened_time','approval_set','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','description','sys_class_name','close_notes','follow_up','parent_incident','sys_id','contact_type','reopened_by','company','activity_due','assigned_to','comments','sla_due','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','push','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','concat','statusCode','error','test','Wrong\x20credentials','boolean','True','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range'];(function(_0x5d26d0,_0x257267){var _0x1ab0e3=function(_0x38d24b){while(--_0x38d24b){_0x5d26d0['push'](_0x5d26d0['shift']());}};_0x1ab0e3(++_0x257267);}(_0x2bd9,0x150));var _0x92bd=function(_0x773ceb,_0x371147){_0x773ceb=_0x773ceb-0x0;var _0x5505f5=_0x2bd9[_0x773ceb];return _0x5505f5;};'use strict';var emlformat=require(_0x92bd('0x0'));var rimraf=require(_0x92bd('0x1'));var zipdir=require(_0x92bd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x92bd('0x3'));var moment=require('moment');var BPromise=require(_0x92bd('0x4'));var Mustache=require(_0x92bd('0x5'));var util=require(_0x92bd('0x6'));var path=require('path');var sox=require(_0x92bd('0x7'));var csv=require(_0x92bd('0x8'));var ejs=require(_0x92bd('0x9'));var fs=require('fs');var fs_extra=require(_0x92bd('0xa'));var _=require(_0x92bd('0xb'));var squel=require(_0x92bd('0xc'));var crypto=require(_0x92bd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x92bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x92bd('0xf'));var Papa=require(_0x92bd('0x10'));var Redis=require('ioredis');var authService=require(_0x92bd('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x92bd('0x12'));var logger=require(_0x92bd('0x13'))(_0x92bd('0x14'));var utils=require(_0x92bd('0x15'));var config=require(_0x92bd('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x92bd('0x17'))['db'];var integrations=require(_0x92bd('0x18'));function respondWithStatusCode(_0xfaa157,_0x57960a){_0x57960a=_0x57960a||0xcc;return function(_0x18844c){if(_0x18844c){return _0xfaa157[_0x92bd('0x19')](_0x57960a);}return _0xfaa157[_0x92bd('0x1a')](_0x57960a)[_0x92bd('0x1b')]();};}function respondWithResult(_0x2fbe04,_0x251856){_0x251856=_0x251856||0xc8;return function(_0x9ac570){if(_0x9ac570){return _0x2fbe04['status'](_0x251856)[_0x92bd('0x1c')](_0x9ac570);}};}function respondWithFilteredResult(_0xe8e969,_0x244378){return function(_0x1e0913){if(_0x1e0913){var _0x4f97fd=typeof _0x244378[_0x92bd('0x1d')]===_0x92bd('0x1e')&&typeof _0x244378[_0x92bd('0x1f')]===_0x92bd('0x1e');var _0x26c4db=_0x1e0913['count'];var _0x2b9a0f=_0x4f97fd?0x0:_0x244378[_0x92bd('0x1d')];var _0x2348ea=_0x4f97fd?_0x1e0913['count']:_0x244378['offset']+_0x244378[_0x92bd('0x1f')];var _0x3a0447;if(_0x2348ea>=_0x26c4db){_0x2348ea=_0x26c4db;_0x3a0447=0xc8;}else{_0x3a0447=0xce;}_0xe8e969[_0x92bd('0x1a')](_0x3a0447);return _0xe8e969[_0x92bd('0x20')](_0x92bd('0x21'),_0x2b9a0f+'-'+_0x2348ea+'/'+_0x26c4db)[_0x92bd('0x1c')](_0x1e0913);}return null;};}function patchUpdates(_0x4ff694){return function(_0x2620ae){try{jsonpatch[_0x92bd('0x22')](_0x2620ae,_0x4ff694,!![]);}catch(_0x2cd518){return BPromise[_0x92bd('0x23')](_0x2cd518);}return _0x2620ae[_0x92bd('0x24')]();};}function saveUpdates(_0x4b4b8c,_0x12083f){return function(_0x43c992){if(_0x43c992){return _0x43c992['update'](_0x4b4b8c)[_0x92bd('0x25')](function(_0xdb9970){return _0xdb9970;});}return null;};}function removeEntity(_0x80f15a,_0x40a1a1){return function(_0x17edfa){if(_0x17edfa){return _0x17edfa[_0x92bd('0x26')]()[_0x92bd('0x25')](function(){_0x80f15a['status'](0xcc)[_0x92bd('0x1b')]();});}};}function handleEntityNotFound(_0x4b1d15,_0x5d249){return function(_0x3ca4b4){if(!_0x3ca4b4){_0x4b1d15['sendStatus'](0x194);}return _0x3ca4b4;};}function handleError(_0x257f6e,_0x56566f){_0x56566f=_0x56566f||0x1f4;return function(_0x2c6a21){logger['error'](_0x2c6a21[_0x92bd('0x27')]);if(_0x2c6a21['name']){delete _0x2c6a21['name'];}_0x257f6e[_0x92bd('0x1a')](_0x56566f)[_0x92bd('0x28')](_0x2c6a21);};}exports[_0x92bd('0x29')]=function(_0x34ea78,_0x1b3de8){var _0x5d85f7={},_0x51286a={},_0x3a579c={'count':0x0,'rows':[]};var _0x55c515=_[_0x92bd('0x2a')](db[_0x92bd('0x2b')][_0x92bd('0x2c')],function(_0x44beb0){return{'name':_0x44beb0[_0x92bd('0x2d')],'type':_0x44beb0[_0x92bd('0x2e')]['key']};});_0x51286a['model']=_[_0x92bd('0x2a')](_0x55c515,_0x92bd('0x2f'));_0x51286a['query']=_[_0x92bd('0x30')](_0x34ea78[_0x92bd('0x31')]);_0x51286a[_0x92bd('0x32')]=_['intersection'](_0x51286a['model'],_0x51286a['query']);_0x5d85f7[_0x92bd('0x33')]=_['intersection'](_0x51286a[_0x92bd('0x34')],qs['fields'](_0x34ea78['query']['fields']));_0x5d85f7['attributes']=_0x5d85f7['attributes'][_0x92bd('0x35')]?_0x5d85f7[_0x92bd('0x33')]:_0x51286a['model'];if(!_0x34ea78['query']['hasOwnProperty'](_0x92bd('0x36'))){_0x5d85f7[_0x92bd('0x1f')]=qs['limit'](_0x34ea78[_0x92bd('0x31')][_0x92bd('0x1f')]);_0x5d85f7[_0x92bd('0x1d')]=qs[_0x92bd('0x1d')](_0x34ea78[_0x92bd('0x31')][_0x92bd('0x1d')]);}_0x5d85f7[_0x92bd('0x37')]=qs[_0x92bd('0x38')](_0x34ea78[_0x92bd('0x31')][_0x92bd('0x38')]);_0x5d85f7[_0x92bd('0x39')]=qs['filters'](_[_0x92bd('0x3a')](_0x34ea78[_0x92bd('0x31')],_0x51286a[_0x92bd('0x32')]),_0x55c515);if(_0x34ea78[_0x92bd('0x31')][_0x92bd('0x3b')]){_0x5d85f7['where']=_[_0x92bd('0x3c')](_0x5d85f7[_0x92bd('0x39')],{'$or':_['map'](_0x55c515,function(_0x26dc36){if(_0x26dc36[_0x92bd('0x2e')]!==_0x92bd('0x3d')){var _0x4ea02f={};_0x4ea02f[_0x26dc36[_0x92bd('0x2f')]]={'$like':'%'+_0x34ea78[_0x92bd('0x31')][_0x92bd('0x3b')]+'%'};return _0x4ea02f;}})});}_0x5d85f7=_[_0x92bd('0x3c')]({},_0x5d85f7,_0x34ea78[_0x92bd('0x3e')]);var _0x301477={'where':_0x5d85f7['where']};return db[_0x92bd('0x2b')]['count'](_0x301477)[_0x92bd('0x25')](function(_0x1b07a0){_0x3a579c[_0x92bd('0x3f')]=_0x1b07a0;if(_0x34ea78[_0x92bd('0x31')][_0x92bd('0x40')]){_0x5d85f7[_0x92bd('0x41')]=[{'all':!![]}];}return db[_0x92bd('0x2b')]['findAll'](_0x5d85f7);})[_0x92bd('0x25')](function(_0x31560a){_0x3a579c[_0x92bd('0x42')]=_0x31560a;return _0x3a579c;})[_0x92bd('0x25')](respondWithFilteredResult(_0x1b3de8,_0x5d85f7))['catch'](handleError(_0x1b3de8,null));};exports[_0x92bd('0x43')]=function(_0x4c8295,_0x4b078e){var _0x4f735c={'raw':![],'where':{'id':_0x4c8295[_0x92bd('0x44')]['id']}},_0x16b765={};_0x16b765[_0x92bd('0x34')]=_['keys'](db[_0x92bd('0x2b')][_0x92bd('0x2c')]);_0x16b765[_0x92bd('0x31')]=_[_0x92bd('0x30')](_0x4c8295[_0x92bd('0x31')]);_0x16b765[_0x92bd('0x32')]=_['intersection'](_0x16b765[_0x92bd('0x34')],_0x16b765[_0x92bd('0x31')]);_0x4f735c[_0x92bd('0x33')]=_[_0x92bd('0x45')](_0x16b765[_0x92bd('0x34')],qs['fields'](_0x4c8295[_0x92bd('0x31')]['fields']));_0x4f735c[_0x92bd('0x33')]=_0x4f735c[_0x92bd('0x33')]['length']?_0x4f735c[_0x92bd('0x33')]:_0x16b765[_0x92bd('0x34')];if(_0x4c8295[_0x92bd('0x31')]['includeAll']){_0x4f735c[_0x92bd('0x41')]=[{'all':!![]}];}_0x4f735c=_[_0x92bd('0x3c')]({},_0x4f735c,_0x4c8295[_0x92bd('0x3e')]);return db[_0x92bd('0x2b')][_0x92bd('0x46')](_0x4f735c)[_0x92bd('0x25')](handleEntityNotFound(_0x4b078e,null))['then'](respondWithResult(_0x4b078e,null))[_0x92bd('0x47')](handleError(_0x4b078e,null));};exports['create']=function(_0x209be2,_0x459005){return db[_0x92bd('0x2b')][_0x92bd('0x48')](_0x209be2[_0x92bd('0x49')],{})[_0x92bd('0x25')](respondWithResult(_0x459005,0xc9))[_0x92bd('0x47')](handleError(_0x459005,null));};exports[_0x92bd('0x4a')]=function(_0x1a711a,_0x11570a){if(_0x1a711a['body']['id']){delete _0x1a711a[_0x92bd('0x49')]['id'];}return db['ServicenowAccount'][_0x92bd('0x46')]({'where':{'id':_0x1a711a['params']['id']}})['then'](handleEntityNotFound(_0x11570a,null))['then'](saveUpdates(_0x1a711a[_0x92bd('0x49')],null))['then'](respondWithResult(_0x11570a,null))[_0x92bd('0x47')](handleError(_0x11570a,null));};exports[_0x92bd('0x26')]=function(_0x5d82c1,_0x320117){return db[_0x92bd('0x2b')][_0x92bd('0x46')]({'where':{'id':_0x5d82c1[_0x92bd('0x44')]['id']}})[_0x92bd('0x25')](handleEntityNotFound(_0x320117,null))['then'](removeEntity(_0x320117,null))[_0x92bd('0x47')](handleError(_0x320117,null));};exports[_0x92bd('0x4b')]=function(_0x52d2a3,_0xcf66f7,_0x3b968a){var _0x39cab9={};var _0xdce632={};var _0x491009;var _0x44df08;return db[_0x92bd('0x2b')][_0x92bd('0x4c')]({'where':{'id':_0x52d2a3[_0x92bd('0x44')]['id']}})[_0x92bd('0x25')](handleEntityNotFound(_0xcf66f7,null))[_0x92bd('0x25')](function(_0x1a14c8){if(_0x1a14c8){_0x491009=_0x1a14c8;_0xdce632[_0x92bd('0x34')]=_['keys'](db[_0x92bd('0x4d')][_0x92bd('0x2c')]);_0xdce632[_0x92bd('0x31')]=_[_0x92bd('0x30')](_0x52d2a3[_0x92bd('0x31')]);_0xdce632[_0x92bd('0x32')]=_[_0x92bd('0x45')](_0xdce632[_0x92bd('0x34')],_0xdce632[_0x92bd('0x31')]);_0x39cab9[_0x92bd('0x33')]=_[_0x92bd('0x45')](_0xdce632['model'],qs['fields'](_0x52d2a3[_0x92bd('0x31')][_0x92bd('0x4e')]));_0x39cab9['attributes']=_0x39cab9[_0x92bd('0x33')][_0x92bd('0x35')]?_0x39cab9[_0x92bd('0x33')]:_0xdce632['model'];_0x39cab9[_0x92bd('0x37')]=qs[_0x92bd('0x38')](_0x52d2a3[_0x92bd('0x31')][_0x92bd('0x38')]);_0x39cab9[_0x92bd('0x39')]=qs[_0x92bd('0x32')](_[_0x92bd('0x3a')](_0x52d2a3[_0x92bd('0x31')],_0xdce632['filters']));if(_0x52d2a3['query'][_0x92bd('0x3b')]){_0x39cab9[_0x92bd('0x39')]=_[_0x92bd('0x3c')](_0x39cab9['where'],{'$or':_[_0x92bd('0x2a')](_0x39cab9[_0x92bd('0x33')],function(_0x9ce8db){var _0x32ac86={};_0x32ac86[_0x9ce8db]={'$like':'%'+_0x52d2a3[_0x92bd('0x31')][_0x92bd('0x3b')]+'%'};return _0x32ac86;})});}_0x39cab9=_[_0x92bd('0x3c')]({},_0x39cab9,_0x52d2a3['options']);return _0x491009['getConfigurations'](_0x39cab9);}})['then'](function(_0x30eebd){if(_0x30eebd){_0x44df08=_0x30eebd[_0x92bd('0x35')];if(!_0x52d2a3['query'][_0x92bd('0x4f')](_0x92bd('0x36'))){_0x39cab9[_0x92bd('0x1f')]=qs[_0x92bd('0x1f')](_0x52d2a3[_0x92bd('0x31')][_0x92bd('0x1f')]);_0x39cab9['offset']=qs[_0x92bd('0x1d')](_0x52d2a3[_0x92bd('0x31')][_0x92bd('0x1d')]);}return _0x491009[_0x92bd('0x4b')](_0x39cab9);}})[_0x92bd('0x25')](function(_0x3880b0){if(_0x3880b0){return _0x3880b0?{'count':_0x44df08,'rows':_0x3880b0}:null;}})[_0x92bd('0x25')](respondWithResult(_0xcf66f7,null))['catch'](handleError(_0xcf66f7,null));};exports[_0x92bd('0x50')]=function(_0x13bd72,_0x20f209,_0x1e969a){if(_0x13bd72[_0x92bd('0x49')]['id']){delete _0x13bd72['body']['id'];}return db['ServicenowAccount'][_0x92bd('0x4c')]({'where':{'id':_0x13bd72[_0x92bd('0x44')]['id']}})[_0x92bd('0x25')](handleEntityNotFound(_0x20f209,null))[_0x92bd('0x25')](function(_0x29ee76){if(_0x29ee76){_0x13bd72[_0x92bd('0x49')][_0x92bd('0x51')]=_0x29ee76['id'];_0x13bd72[_0x92bd('0x49')][_0x92bd('0x52')]=integrations['getSubjects'](_0x13bd72['body'][_0x92bd('0x53')],_0x13bd72[_0x92bd('0x49')]['type']);_0x13bd72[_0x92bd('0x49')]['Descriptions']=integrations[_0x92bd('0x54')](_0x13bd72[_0x92bd('0x49')]['channel'],_0x13bd72['body'][_0x92bd('0x2e')]);return db[_0x92bd('0x4d')][_0x92bd('0x48')](_0x13bd72['body'],{'include':[{'model':db[_0x92bd('0x55')],'as':_0x92bd('0x52')},{'model':db[_0x92bd('0x55')],'as':_0x92bd('0x56')}]});}return null;})[_0x92bd('0x25')](respondWithResult(_0x20f209,null))['catch'](handleError(_0x20f209,null));};exports[_0x92bd('0x57')]=function(_0x46356b,_0x185d97,_0x343388){var _0x39dd5f=[_0x92bd('0x58'),_0x92bd('0x59'),'knowledge',_0x92bd('0x5a'),_0x92bd('0x5b'),_0x92bd('0x5c'),_0x92bd('0x5d'),_0x92bd('0x5e'),'category'];var _0x1c9059=[_0x92bd('0x5f'),'made_sla',_0x92bd('0x60'),'watch_list',_0x92bd('0x61'),_0x92bd('0x62'),_0x92bd('0x63'),_0x92bd('0x59'),_0x92bd('0x64'),_0x92bd('0x65'),'resolved_by',_0x92bd('0x66'),_0x92bd('0x67'),_0x92bd('0x68'),'sys_created_on','sys_domain',_0x92bd('0x69'),'sys_created_by',_0x92bd('0x6a'),_0x92bd('0x37'),_0x92bd('0x6b'),_0x92bd('0x6c'),_0x92bd('0x6d'),_0x92bd('0x6e'),_0x92bd('0x6f'),'active',_0x92bd('0x70'),_0x92bd('0x71'),_0x92bd('0x72'),_0x92bd('0x73'),_0x92bd('0x74'),'time_worked','expected_start','opened_at',_0x92bd('0x75'),'group_list',_0x92bd('0x76'),_0x92bd('0x77'),'resolved_at','caller_id',_0x92bd('0x78'),'subcategory','work_notes',_0x92bd('0x79'),_0x92bd('0x5b'),_0x92bd('0x7a'),_0x92bd('0x7b'),_0x92bd('0x7c'),_0x92bd('0x7d'),_0x92bd('0x7e'),'additional_assignee_list',_0x92bd('0x7f'),'calendar_duration',_0x92bd('0x5c'),_0x92bd('0x80'),_0x92bd('0x81'),'closed_by',_0x92bd('0x82'),_0x92bd('0x83'),_0x92bd('0x84'),_0x92bd('0x85'),_0x92bd('0x86'),_0x92bd('0x5d'),'urgency','problem_id',_0x92bd('0x87'),'reassignment_count',_0x92bd('0x88'),_0x92bd('0x89'),_0x92bd('0x5e'),_0x92bd('0x8a'),_0x92bd('0x8b'),'approval',_0x92bd('0x8c'),_0x92bd('0x8d'),_0x92bd('0x8e'),_0x92bd('0x8f'),_0x92bd('0x90'),_0x92bd('0x91'),_0x92bd('0x92'),_0x92bd('0x93'),_0x92bd('0x94'),'category'];var _0x5cf339='';var _0x323260='';var _0x948a61=[];var _0x4e30ed='';var _0x4dc5bb='';var _0x3e4b4b=[];var _0x4b9b92='';var _0x478c4b='';var _0x12db0e={};var _0x37bc92='';return db['ServicenowAccount']['findOne']({'where':{'id':_0x46356b[_0x92bd('0x44')]['id']},'attributes':['id',_0x92bd('0x95'),_0x92bd('0x96'),_0x92bd('0x97'),'remoteUri',_0x92bd('0x98')]})['then'](handleEntityNotFound(_0x185d97,null))['then'](function(_0x44c1ae){if(_0x44c1ae){_0x37bc92=_0x44c1ae[_0x92bd('0x99')];var _0x2d3e51=_0x37bc92[_0x92bd('0x9a')](-0x1);if(_0x2d3e51==='/'){_0x37bc92=_0x37bc92[_0x92bd('0x9b')](0x0,_0x37bc92[_0x92bd('0x9c')](_0x2d3e51));}_0x478c4b=util[_0x92bd('0x9d')](_0x92bd('0x9e'),_0x37bc92);_0x4b9b92=util[_0x92bd('0x9d')](_0x92bd('0x9f'),_0x37bc92);_0x12db0e={'user':_0x44c1ae['username'],'pass':_0x44c1ae[_0x92bd('0x96')]};var _0x1c1513={'method':_0x92bd('0xa0'),'uri':_0x478c4b+_0x92bd('0xa1'),'auth':_0x12db0e,'json':!![]};return rp(_0x1c1513);}})[_0x92bd('0x25')](function(_0x346ddc){if(_0x346ddc[_0x92bd('0xa2')][_0x92bd('0x35')]>0x0){_0x5cf339=_0x346ddc[_0x92bd('0xa2')];}console[_0x92bd('0xa3')](_0x92bd('0xa4'),_0x5cf339);_0x3e4b4b=[];_0x323260=Object[_0x92bd('0xa5')]([],_0x5cf339);_[_0x92bd('0xa6')](_0x323260,function(_0x4396bf){return!_0x39dd5f[_0x92bd('0xa7')](_0x4396bf[_0x92bd('0x2f')]);});_0x323260[_0x92bd('0xa8')](function(_0x39a1e2){var _0xcda360=createFieldObject(_0x4b9b92,_0x12db0e,_0x39a1e2[_0x92bd('0xa9')],_0x39a1e2[_0x92bd('0x2f')],_0x39a1e2['label'],![]);_0x3e4b4b[_0x92bd('0xaa')](_0xcda360);});return Promise['all'](_0x3e4b4b);})[_0x92bd('0x25')](function(_0x34f75b){_0x948a61=_0x34f75b;_0x4e30ed=Object['assign']([],_0x5cf339);console[_0x92bd('0xa3')]('TCL:\x20_object',_0x5cf339);_[_0x92bd('0xa6')](_0x4e30ed,function(_0x347536){return _0x1c9059[_0x92bd('0xa7')](_0x347536[_0x92bd('0x2f')]);});console[_0x92bd('0xa3')](_0x92bd('0xab'),_0x4e30ed);_0x3e4b4b=[];_0x4e30ed['forEach'](function(_0x1d456c){var _0x2479ce=createFieldObject(_0x4b9b92,_0x12db0e,_0x1d456c[_0x92bd('0xa9')],_0x1d456c[_0x92bd('0x2f')],_0x1d456c[_0x92bd('0xac')],!![]);_0x3e4b4b['push'](_0x2479ce);});return Promise['all'](_0x3e4b4b);})[_0x92bd('0x25')](function(_0x2069fc){_0x4dc5bb=_0x2069fc;var _0x31c220=_0x948a61[_0x92bd('0xad')](_0x4dc5bb);return{'count':_0x31c220['length'],'rows':_0x31c220};})[_0x92bd('0x25')](respondWithResult(_0x185d97,null))[_0x92bd('0x47')](function(_0x15a796){console['log']('ServiceNow\x20error:\x20'+_0x15a796);var _0x28dd64=_0x46356b[_0x92bd('0x31')]['test']?0x1f4:_0x15a796[_0x92bd('0xae')]||0x1f4;logger[_0x92bd('0xaf')](_0x15a796['stack']);delete _0x15a796[_0x92bd('0x2f')];if(_0x28dd64===0x191){_0x28dd64=0x190;}_0x185d97[_0x92bd('0x1a')](_0x28dd64)['send'](_0x46356b[_0x92bd('0x31')][_0x92bd('0xb0')]?{'message':_0x92bd('0xb1'),'statusCode':_0x15a796[_0x92bd('0xae')]}:_0x15a796);});};function createFieldObject(_0x20309a,_0x28e5f4,_0x1974b3,_0x3d0399,_0xd3d9b3,_0x4b6063){return new Promise(function(_0xe34605,_0x4eab0f){var _0x54a168={'id':_0x3d0399,'name':_0xd3d9b3,'custom':_0x4b6063};if(_0x1974b3===_0x92bd('0xb2')){_0x54a168[_0x92bd('0x3e')]=[{'name':_0x92bd('0xb3'),'value':'true'},{'name':_0x92bd('0xb4'),'value':_0x92bd('0xb5')}];_0xe34605(_0x54a168);}else{var _0x1f85d3={'method':_0x92bd('0xa0'),'uri':_0x20309a+_0x92bd('0xb6')+_0x3d0399,'auth':_0x28e5f4,'json':!![]};return rp(_0x1f85d3)[_0x92bd('0x25')](function(_0x4d6b11){var _0x2a1083=[];if(_0x4d6b11[_0x92bd('0xa2')]['length']>0x0){_0x4d6b11['result'][_0x92bd('0xa8')](function(_0x4a61d8){if(_0x4a61d8[_0x92bd('0xb7')]===_0x92bd('0xb5')){var _0x60f123={'name':_0x4a61d8['label'],'value':_0x4a61d8[_0x92bd('0xb8')]};_0x2a1083[_0x92bd('0xaa')](_0x60f123);}});}_0x54a168[_0x92bd('0x3e')]=_0x2a1083;if(_0x54a168[_0x92bd('0x3e')][_0x92bd('0x35')]>0x0){_0xe34605(_0x54a168);}else{if(_0x4b6063==![]){_0xe34605();}else{_0xe34605(_0x54a168);}}});}});} \ No newline at end of file +var _0xd599=['reopened_by','problem_id','reassignment_count','assigned_to','comments','sla_due','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','location','findOne','password','email','remoteUri','slice','substring','lastIndexOf','format','username','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','log','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','sys_choice?sysparm_query=name=incident^element=','inactive','false','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowAccount','includeAll','findAll','rows','catch','params','length','include','find','create','body','update','ServicenowConfiguration','getConfigurations','Subjects','channel','Descriptions','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','user_input','sys_domain','state','sys_created_by','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','reopened_time','resolved_at','caller_id','short_description','correlation_display','delivery_task','work_start','assignment_group','additional_assignee_list','description','sys_class_name','closed_by','follow_up','parent_incident','contact_type'];(function(_0x5b8495,_0x612384){var _0x4a280c=function(_0x273019){while(--_0x273019){_0x5b8495['push'](_0x5b8495['shift']());}};_0x4a280c(++_0x612384);}(_0xd599,0x1a0));var _0x9d59=function(_0x9345b,_0x12b754){_0x9345b=_0x9345b-0x0;var _0x1649cc=_0xd599[_0x9345b];return _0x1649cc;};'use strict';var emlformat=require(_0x9d59('0x0'));var rimraf=require(_0x9d59('0x1'));var zipdir=require(_0x9d59('0x2'));var jsonpatch=require(_0x9d59('0x3'));var rp=require(_0x9d59('0x4'));var moment=require(_0x9d59('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9d59('0x6'));var util=require(_0x9d59('0x7'));var path=require(_0x9d59('0x8'));var sox=require(_0x9d59('0x9'));var csv=require(_0x9d59('0xa'));var ejs=require(_0x9d59('0xb'));var fs=require('fs');var fs_extra=require(_0x9d59('0xc'));var _=require('lodash');var squel=require(_0x9d59('0xd'));var crypto=require(_0x9d59('0xe'));var jsforce=require(_0x9d59('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9d59('0xa'));var querystring=require(_0x9d59('0x10'));var Papa=require('papaparse');var Redis=require(_0x9d59('0x11'));var authService=require(_0x9d59('0x12'));var qs=require(_0x9d59('0x13'));var as=require(_0x9d59('0x14'));var hardwareService=require(_0x9d59('0x15'));var logger=require(_0x9d59('0x16'))(_0x9d59('0x17'));var utils=require('../../config/utils');var config=require(_0x9d59('0x18'));var licenseUtil=require(_0x9d59('0x19'));var db=require(_0x9d59('0x1a'))['db'];var integrations=require(_0x9d59('0x1b'));function respondWithStatusCode(_0x2382e3,_0x559066){_0x559066=_0x559066||0xcc;return function(_0x167cdf){if(_0x167cdf){return _0x2382e3['sendStatus'](_0x559066);}return _0x2382e3[_0x9d59('0x1c')](_0x559066)[_0x9d59('0x1d')]();};}function respondWithResult(_0x53a5ef,_0x1319fd){_0x1319fd=_0x1319fd||0xc8;return function(_0x3def39){if(_0x3def39){return _0x53a5ef['status'](_0x1319fd)[_0x9d59('0x1e')](_0x3def39);}};}function respondWithFilteredResult(_0x4544b7,_0x13aa57){return function(_0x44c0b3){if(_0x44c0b3){var _0x594eed=typeof _0x13aa57['offset']===_0x9d59('0x1f')&&typeof _0x13aa57[_0x9d59('0x20')]===_0x9d59('0x1f');var _0x53ce8e=_0x44c0b3[_0x9d59('0x21')];var _0x3915a1=_0x594eed?0x0:_0x13aa57['offset'];var _0x231bc3=_0x594eed?_0x44c0b3[_0x9d59('0x21')]:_0x13aa57[_0x9d59('0x22')]+_0x13aa57[_0x9d59('0x20')];var _0x153f8f;if(_0x231bc3>=_0x53ce8e){_0x231bc3=_0x53ce8e;_0x153f8f=0xc8;}else{_0x153f8f=0xce;}_0x4544b7[_0x9d59('0x1c')](_0x153f8f);return _0x4544b7[_0x9d59('0x23')](_0x9d59('0x24'),_0x3915a1+'-'+_0x231bc3+'/'+_0x53ce8e)[_0x9d59('0x1e')](_0x44c0b3);}return null;};}function patchUpdates(_0x31990c){return function(_0x59fc34){try{jsonpatch[_0x9d59('0x25')](_0x59fc34,_0x31990c,!![]);}catch(_0x3488a7){return BPromise[_0x9d59('0x26')](_0x3488a7);}return _0x59fc34[_0x9d59('0x27')]();};}function saveUpdates(_0x29ede9,_0x329d6d){return function(_0xd515d){if(_0xd515d){return _0xd515d['update'](_0x29ede9)['then'](function(_0x1b8b8c){return _0x1b8b8c;});}return null;};}function removeEntity(_0x54ea03,_0x4b0659){return function(_0x180dd4){if(_0x180dd4){return _0x180dd4[_0x9d59('0x28')]()[_0x9d59('0x29')](function(){_0x54ea03['status'](0xcc)[_0x9d59('0x1d')]();});}};}function handleEntityNotFound(_0x108b96,_0x908f5c){return function(_0x101c57){if(!_0x101c57){_0x108b96[_0x9d59('0x2a')](0x194);}return _0x101c57;};}function handleError(_0x24cfbc,_0x57ab0b){_0x57ab0b=_0x57ab0b||0x1f4;return function(_0x4b3d82){logger[_0x9d59('0x2b')](_0x4b3d82[_0x9d59('0x2c')]);if(_0x4b3d82[_0x9d59('0x2d')]){delete _0x4b3d82[_0x9d59('0x2d')];}_0x24cfbc[_0x9d59('0x1c')](_0x57ab0b)[_0x9d59('0x2e')](_0x4b3d82);};}exports[_0x9d59('0x2f')]=function(_0x423fe1,_0x4a2eb9){var _0x2f5c8b={},_0x4cf2bf={},_0x5f42f3={'count':0x0,'rows':[]};var _0x1fe374=_[_0x9d59('0x30')](db['ServicenowAccount'][_0x9d59('0x31')],function(_0x3912b0){return{'name':_0x3912b0[_0x9d59('0x32')],'type':_0x3912b0[_0x9d59('0x33')][_0x9d59('0x34')]};});_0x4cf2bf[_0x9d59('0x35')]=_[_0x9d59('0x30')](_0x1fe374,'name');_0x4cf2bf[_0x9d59('0x36')]=_[_0x9d59('0x37')](_0x423fe1[_0x9d59('0x36')]);_0x4cf2bf[_0x9d59('0x38')]=_[_0x9d59('0x39')](_0x4cf2bf[_0x9d59('0x35')],_0x4cf2bf[_0x9d59('0x36')]);_0x2f5c8b[_0x9d59('0x3a')]=_[_0x9d59('0x39')](_0x4cf2bf['model'],qs[_0x9d59('0x3b')](_0x423fe1['query'][_0x9d59('0x3b')]));_0x2f5c8b[_0x9d59('0x3a')]=_0x2f5c8b[_0x9d59('0x3a')]['length']?_0x2f5c8b[_0x9d59('0x3a')]:_0x4cf2bf[_0x9d59('0x35')];if(!_0x423fe1[_0x9d59('0x36')][_0x9d59('0x3c')](_0x9d59('0x3d'))){_0x2f5c8b[_0x9d59('0x20')]=qs[_0x9d59('0x20')](_0x423fe1['query'][_0x9d59('0x20')]);_0x2f5c8b['offset']=qs[_0x9d59('0x22')](_0x423fe1[_0x9d59('0x36')]['offset']);}_0x2f5c8b[_0x9d59('0x3e')]=qs[_0x9d59('0x3f')](_0x423fe1[_0x9d59('0x36')][_0x9d59('0x3f')]);_0x2f5c8b[_0x9d59('0x40')]=qs['filters'](_[_0x9d59('0x41')](_0x423fe1['query'],_0x4cf2bf[_0x9d59('0x38')]),_0x1fe374);if(_0x423fe1[_0x9d59('0x36')][_0x9d59('0x42')]){_0x2f5c8b[_0x9d59('0x40')]=_[_0x9d59('0x43')](_0x2f5c8b[_0x9d59('0x40')],{'$or':_[_0x9d59('0x30')](_0x1fe374,function(_0x553c9b){if(_0x553c9b[_0x9d59('0x33')]!==_0x9d59('0x44')){var _0xb0cca3={};_0xb0cca3[_0x553c9b[_0x9d59('0x2d')]]={'$like':'%'+_0x423fe1[_0x9d59('0x36')][_0x9d59('0x42')]+'%'};return _0xb0cca3;}})});}_0x2f5c8b=_['merge']({},_0x2f5c8b,_0x423fe1[_0x9d59('0x45')]);var _0x537a6d={'where':_0x2f5c8b['where']};return db[_0x9d59('0x46')][_0x9d59('0x21')](_0x537a6d)[_0x9d59('0x29')](function(_0x211030){_0x5f42f3[_0x9d59('0x21')]=_0x211030;if(_0x423fe1[_0x9d59('0x36')][_0x9d59('0x47')]){_0x2f5c8b['include']=[{'all':!![]}];}return db[_0x9d59('0x46')][_0x9d59('0x48')](_0x2f5c8b);})[_0x9d59('0x29')](function(_0x47b710){_0x5f42f3[_0x9d59('0x49')]=_0x47b710;return _0x5f42f3;})[_0x9d59('0x29')](respondWithFilteredResult(_0x4a2eb9,_0x2f5c8b))[_0x9d59('0x4a')](handleError(_0x4a2eb9,null));};exports['show']=function(_0x3c765c,_0x16017d){var _0x376761={'raw':![],'where':{'id':_0x3c765c[_0x9d59('0x4b')]['id']}},_0x3ebc79={};_0x3ebc79['model']=_['keys'](db[_0x9d59('0x46')][_0x9d59('0x31')]);_0x3ebc79['query']=_[_0x9d59('0x37')](_0x3c765c['query']);_0x3ebc79['filters']=_[_0x9d59('0x39')](_0x3ebc79[_0x9d59('0x35')],_0x3ebc79[_0x9d59('0x36')]);_0x376761[_0x9d59('0x3a')]=_[_0x9d59('0x39')](_0x3ebc79[_0x9d59('0x35')],qs[_0x9d59('0x3b')](_0x3c765c[_0x9d59('0x36')][_0x9d59('0x3b')]));_0x376761['attributes']=_0x376761[_0x9d59('0x3a')][_0x9d59('0x4c')]?_0x376761[_0x9d59('0x3a')]:_0x3ebc79['model'];if(_0x3c765c[_0x9d59('0x36')][_0x9d59('0x47')]){_0x376761[_0x9d59('0x4d')]=[{'all':!![]}];}_0x376761=_['merge']({},_0x376761,_0x3c765c[_0x9d59('0x45')]);return db[_0x9d59('0x46')][_0x9d59('0x4e')](_0x376761)[_0x9d59('0x29')](handleEntityNotFound(_0x16017d,null))['then'](respondWithResult(_0x16017d,null))[_0x9d59('0x4a')](handleError(_0x16017d,null));};exports[_0x9d59('0x4f')]=function(_0x8598b5,_0x3835db){return db[_0x9d59('0x46')][_0x9d59('0x4f')](_0x8598b5[_0x9d59('0x50')],{})[_0x9d59('0x29')](respondWithResult(_0x3835db,0xc9))[_0x9d59('0x4a')](handleError(_0x3835db,null));};exports[_0x9d59('0x51')]=function(_0xbb6427,_0x2fc25d){if(_0xbb6427[_0x9d59('0x50')]['id']){delete _0xbb6427[_0x9d59('0x50')]['id'];}return db[_0x9d59('0x46')][_0x9d59('0x4e')]({'where':{'id':_0xbb6427[_0x9d59('0x4b')]['id']}})[_0x9d59('0x29')](handleEntityNotFound(_0x2fc25d,null))[_0x9d59('0x29')](saveUpdates(_0xbb6427[_0x9d59('0x50')],null))[_0x9d59('0x29')](respondWithResult(_0x2fc25d,null))[_0x9d59('0x4a')](handleError(_0x2fc25d,null));};exports[_0x9d59('0x28')]=function(_0x1cf25f,_0x2a6ba6){return db[_0x9d59('0x46')][_0x9d59('0x4e')]({'where':{'id':_0x1cf25f[_0x9d59('0x4b')]['id']}})[_0x9d59('0x29')](handleEntityNotFound(_0x2a6ba6,null))['then'](removeEntity(_0x2a6ba6,null))[_0x9d59('0x4a')](handleError(_0x2a6ba6,null));};exports['getConfigurations']=function(_0x1af40c,_0x3787b3,_0x214a68){var _0x35960d={};var _0x484ba6={};var _0x3d9e31;var _0x101d03;return db[_0x9d59('0x46')]['findOne']({'where':{'id':_0x1af40c[_0x9d59('0x4b')]['id']}})[_0x9d59('0x29')](handleEntityNotFound(_0x3787b3,null))[_0x9d59('0x29')](function(_0x1ae689){if(_0x1ae689){_0x3d9e31=_0x1ae689;_0x484ba6['model']=_[_0x9d59('0x37')](db[_0x9d59('0x52')][_0x9d59('0x31')]);_0x484ba6['query']=_[_0x9d59('0x37')](_0x1af40c[_0x9d59('0x36')]);_0x484ba6[_0x9d59('0x38')]=_[_0x9d59('0x39')](_0x484ba6[_0x9d59('0x35')],_0x484ba6[_0x9d59('0x36')]);_0x35960d['attributes']=_['intersection'](_0x484ba6[_0x9d59('0x35')],qs['fields'](_0x1af40c[_0x9d59('0x36')][_0x9d59('0x3b')]));_0x35960d[_0x9d59('0x3a')]=_0x35960d['attributes']['length']?_0x35960d[_0x9d59('0x3a')]:_0x484ba6[_0x9d59('0x35')];_0x35960d[_0x9d59('0x3e')]=qs['sort'](_0x1af40c[_0x9d59('0x36')][_0x9d59('0x3f')]);_0x35960d[_0x9d59('0x40')]=qs['filters'](_['pick'](_0x1af40c[_0x9d59('0x36')],_0x484ba6[_0x9d59('0x38')]));if(_0x1af40c[_0x9d59('0x36')]['filter']){_0x35960d[_0x9d59('0x40')]=_[_0x9d59('0x43')](_0x35960d[_0x9d59('0x40')],{'$or':_[_0x9d59('0x30')](_0x35960d['attributes'],function(_0x34ae22){var _0x27f452={};_0x27f452[_0x34ae22]={'$like':'%'+_0x1af40c[_0x9d59('0x36')][_0x9d59('0x42')]+'%'};return _0x27f452;})});}_0x35960d=_[_0x9d59('0x43')]({},_0x35960d,_0x1af40c[_0x9d59('0x45')]);return _0x3d9e31['getConfigurations'](_0x35960d);}})['then'](function(_0x16a4fb){if(_0x16a4fb){_0x101d03=_0x16a4fb['length'];if(!_0x1af40c[_0x9d59('0x36')][_0x9d59('0x3c')]('nolimit')){_0x35960d['limit']=qs[_0x9d59('0x20')](_0x1af40c[_0x9d59('0x36')]['limit']);_0x35960d[_0x9d59('0x22')]=qs[_0x9d59('0x22')](_0x1af40c[_0x9d59('0x36')][_0x9d59('0x22')]);}return _0x3d9e31[_0x9d59('0x53')](_0x35960d);}})[_0x9d59('0x29')](function(_0x12f68a){if(_0x12f68a){return _0x12f68a?{'count':_0x101d03,'rows':_0x12f68a}:null;}})[_0x9d59('0x29')](respondWithResult(_0x3787b3,null))['catch'](handleError(_0x3787b3,null));};exports['addConfiguration']=function(_0x2f61a8,_0x5c855d,_0x3c1fba){if(_0x2f61a8[_0x9d59('0x50')]['id']){delete _0x2f61a8[_0x9d59('0x50')]['id'];}return db[_0x9d59('0x46')]['findOne']({'where':{'id':_0x2f61a8[_0x9d59('0x4b')]['id']}})[_0x9d59('0x29')](handleEntityNotFound(_0x5c855d,null))[_0x9d59('0x29')](function(_0x5b46ee){if(_0x5b46ee){_0x2f61a8['body']['AccountId']=_0x5b46ee['id'];_0x2f61a8[_0x9d59('0x50')][_0x9d59('0x54')]=integrations['getSubjects'](_0x2f61a8[_0x9d59('0x50')][_0x9d59('0x55')],_0x2f61a8[_0x9d59('0x50')][_0x9d59('0x33')]);_0x2f61a8[_0x9d59('0x50')][_0x9d59('0x56')]=integrations['getDescriptions'](_0x2f61a8['body'][_0x9d59('0x55')],_0x2f61a8[_0x9d59('0x50')][_0x9d59('0x33')]);return db[_0x9d59('0x52')][_0x9d59('0x4f')](_0x2f61a8[_0x9d59('0x50')],{'include':[{'model':db['ServicenowField'],'as':_0x9d59('0x54')},{'model':db[_0x9d59('0x57')],'as':_0x9d59('0x56')}]});}return null;})[_0x9d59('0x29')](respondWithResult(_0x5c855d,null))[_0x9d59('0x4a')](handleError(_0x5c855d,null));};exports['getFields']=function(_0x405707,_0x11670b,_0x2e029d){var _0x388188=[_0x9d59('0x58'),_0x9d59('0x59'),_0x9d59('0x5a'),_0x9d59('0x5b'),_0x9d59('0x5c'),_0x9d59('0x5d'),_0x9d59('0x5e'),_0x9d59('0x5f'),_0x9d59('0x60')];var _0x2421ce=[_0x9d59('0x61'),_0x9d59('0x58'),'caused_by',_0x9d59('0x62'),_0x9d59('0x63'),_0x9d59('0x64'),_0x9d59('0x65'),_0x9d59('0x59'),_0x9d59('0x66'),_0x9d59('0x67'),_0x9d59('0x68'),_0x9d59('0x69'),'opened_by',_0x9d59('0x6a'),'sys_created_on',_0x9d59('0x6b'),_0x9d59('0x6c'),_0x9d59('0x6d'),_0x9d59('0x5a'),_0x9d59('0x3e'),'calendar_stc','closed_at',_0x9d59('0x6e'),_0x9d59('0x6f'),_0x9d59('0x70'),_0x9d59('0x71'),_0x9d59('0x72'),_0x9d59('0x73'),_0x9d59('0x74'),_0x9d59('0x75'),_0x9d59('0x76'),_0x9d59('0x77'),_0x9d59('0x78'),_0x9d59('0x79'),'business_duration',_0x9d59('0x7a'),_0x9d59('0x7b'),_0x9d59('0x7c'),_0x9d59('0x7d'),_0x9d59('0x7e'),'approval_set',_0x9d59('0x5b'),'work_notes',_0x9d59('0x7f'),_0x9d59('0x5c'),_0x9d59('0x80'),_0x9d59('0x81'),_0x9d59('0x82'),_0x9d59('0x83'),'business_stc',_0x9d59('0x84'),_0x9d59('0x85'),'calendar_duration','notify',_0x9d59('0x86'),'close_notes',_0x9d59('0x87'),_0x9d59('0x88'),_0x9d59('0x89'),'sys_id',_0x9d59('0x8a'),_0x9d59('0x8b'),_0x9d59('0x5e'),'urgency',_0x9d59('0x8c'),'company',_0x9d59('0x8d'),'activity_due',_0x9d59('0x8e'),'severity',_0x9d59('0x8f'),_0x9d59('0x90'),'approval','comments_and_work_notes','due_date',_0x9d59('0x91'),_0x9d59('0x92'),_0x9d59('0x93'),_0x9d59('0x94'),_0x9d59('0x95'),'correlation_id',_0x9d59('0x96'),_0x9d59('0x60')];var _0x5afe4f='';var _0x8bc1af='';var _0x792c09=[];var _0x3b0993='';var _0x43b776='';var _0x5a0ca6=[];var _0x39abdb='';var _0x99631a='';var _0x5d3166={};var _0x4a7189='';return db['ServicenowAccount'][_0x9d59('0x97')]({'where':{'id':_0x405707[_0x9d59('0x4b')]['id']},'attributes':['id','username',_0x9d59('0x98'),_0x9d59('0x99'),_0x9d59('0x9a'),'serverUrl']})[_0x9d59('0x29')](handleEntityNotFound(_0x11670b,null))[_0x9d59('0x29')](function(_0x24b63d){if(_0x24b63d){_0x4a7189=_0x24b63d[_0x9d59('0x9a')];var _0x330d8f=_0x4a7189[_0x9d59('0x9b')](-0x1);if(_0x330d8f==='/'){_0x4a7189=_0x4a7189[_0x9d59('0x9c')](0x0,_0x4a7189[_0x9d59('0x9d')](_0x330d8f));}_0x99631a=util[_0x9d59('0x9e')]('%s/api/now/doc/table/schema/',_0x4a7189);_0x39abdb=util[_0x9d59('0x9e')]('%s/api/now/table/',_0x4a7189);_0x5d3166={'user':_0x24b63d[_0x9d59('0x9f')],'pass':_0x24b63d[_0x9d59('0x98')]};var _0x2386ba={'method':_0x9d59('0xa0'),'uri':_0x99631a+_0x9d59('0xa1'),'auth':_0x5d3166,'json':!![]};return rp(_0x2386ba);}})[_0x9d59('0x29')](function(_0x291764){if(_0x291764[_0x9d59('0xa2')][_0x9d59('0x4c')]>0x0){_0x5afe4f=_0x291764[_0x9d59('0xa2')];}console['log'](_0x9d59('0xa3'),_0x5afe4f);_0x5a0ca6=[];_0x8bc1af=Object[_0x9d59('0xa4')]([],_0x5afe4f);_[_0x9d59('0xa5')](_0x8bc1af,function(_0x2e2e17){return!_0x388188[_0x9d59('0xa6')](_0x2e2e17[_0x9d59('0x2d')]);});_0x8bc1af[_0x9d59('0xa7')](function(_0x5218be){var _0x18ff98=createFieldObject(_0x39abdb,_0x5d3166,_0x5218be[_0x9d59('0xa8')],_0x5218be[_0x9d59('0x2d')],_0x5218be[_0x9d59('0xa9')],![]);_0x5a0ca6[_0x9d59('0xaa')](_0x18ff98);});return Promise[_0x9d59('0xab')](_0x5a0ca6);})[_0x9d59('0x29')](function(_0x3c387f){_0x792c09=_0x3c387f;_0x3b0993=Object['assign']([],_0x5afe4f);console[_0x9d59('0xac')]('TCL:\x20_object',_0x5afe4f);_[_0x9d59('0xa5')](_0x3b0993,function(_0x5a6f9f){return _0x2421ce['includes'](_0x5a6f9f[_0x9d59('0x2d')]);});console[_0x9d59('0xac')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3b0993);_0x5a0ca6=[];_0x3b0993[_0x9d59('0xa7')](function(_0x186104){var _0x23caf9=createFieldObject(_0x39abdb,_0x5d3166,_0x186104[_0x9d59('0xa8')],_0x186104[_0x9d59('0x2d')],_0x186104[_0x9d59('0xa9')],!![]);_0x5a0ca6[_0x9d59('0xaa')](_0x23caf9);});return Promise[_0x9d59('0xab')](_0x5a0ca6);})[_0x9d59('0x29')](function(_0x5d80b7){_0x43b776=_0x5d80b7;var _0x5d80ee=_0x792c09['concat'](_0x43b776);return{'count':_0x5d80ee[_0x9d59('0x4c')],'rows':_0x5d80ee};})[_0x9d59('0x29')](respondWithResult(_0x11670b,null))[_0x9d59('0x4a')](function(_0x5c7e21){console['log'](_0x9d59('0xad')+_0x5c7e21);var _0x4d9853=_0x405707[_0x9d59('0x36')][_0x9d59('0xae')]?0x1f4:_0x5c7e21[_0x9d59('0xaf')]||0x1f4;logger[_0x9d59('0x2b')](_0x5c7e21[_0x9d59('0x2c')]);delete _0x5c7e21[_0x9d59('0x2d')];if(_0x4d9853===0x191){_0x4d9853=0x190;}_0x11670b[_0x9d59('0x1c')](_0x4d9853)[_0x9d59('0x2e')](_0x405707[_0x9d59('0x36')][_0x9d59('0xae')]?{'message':_0x9d59('0xb0'),'statusCode':_0x5c7e21[_0x9d59('0xaf')]}:_0x5c7e21);});};function createFieldObject(_0x2a840e,_0x44f07b,_0x47270f,_0x415750,_0x4fcefc,_0x5acdbb){return new Promise(function(_0x2c2cfc,_0x526b1e){var _0x5ce90c={'id':_0x415750,'name':_0x4fcefc,'custom':_0x5acdbb};if(_0x47270f===_0x9d59('0xb1')){_0x5ce90c[_0x9d59('0x45')]=[{'name':_0x9d59('0xb2'),'value':_0x9d59('0xb3')},{'name':_0x9d59('0xb4'),'value':'false'}];_0x2c2cfc(_0x5ce90c);}else{var _0x5010c0={'method':_0x9d59('0xa0'),'uri':_0x2a840e+_0x9d59('0xb5')+_0x415750,'auth':_0x44f07b,'json':!![]};return rp(_0x5010c0)['then'](function(_0x53f350){var _0x2e9d67=[];if(_0x53f350[_0x9d59('0xa2')][_0x9d59('0x4c')]>0x0){_0x53f350['result'][_0x9d59('0xa7')](function(_0x42c02a){if(_0x42c02a[_0x9d59('0xb6')]===_0x9d59('0xb7')){var _0x51089a={'name':_0x42c02a['label'],'value':_0x42c02a[_0x9d59('0xb8')]};_0x2e9d67[_0x9d59('0xaa')](_0x51089a);}});}_0x5ce90c[_0x9d59('0x45')]=_0x2e9d67;if(_0x5ce90c[_0x9d59('0x45')][_0x9d59('0x4c')]>0x0){_0x2c2cfc(_0x5ce90c);}else{if(_0x5acdbb==![]){_0x2c2cfc();}else{_0x2c2cfc(_0x5ce90c);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index f2239a0..1805f9d 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 _0xba34=['./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x45cccd,_0xa00205){var _0x2103a6=function(_0x326d77){while(--_0x326d77){_0x45cccd['push'](_0x45cccd['shift']());}};_0x2103a6(++_0xa00205);}(_0xba34,0x119));var _0x4ba3=function(_0x3d88fc,_0x23de74){_0x3d88fc=_0x3d88fc-0x0;var _0x505f79=_0xba34[_0x3d88fc];return _0x505f79;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));var integrations=require(_0x4ba3('0x8'));module[_0x4ba3('0x9')]=function(_0xb88621,_0xe5f99a){return _0xb88621['define'](_0x4ba3('0xa'),attributes,{'tableName':_0x4ba3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa630=['moment','request-promise','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util'];(function(_0x56b5e9,_0x269aa9){var _0x238e9f=function(_0x20d05a){while(--_0x20d05a){_0x56b5e9['push'](_0x56b5e9['shift']());}};_0x238e9f(++_0x269aa9);}(_0xa630,0xbe));var _0x0a63=function(_0x2ab490,_0x1df453){_0x2ab490=_0x2ab490-0x0;var _0x3d5290=_0xa630[_0x2ab490];return _0x3d5290;};'use strict';var _=require(_0x0a63('0x0'));var util=require(_0x0a63('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0a63('0x2'));var BPromise=require('bluebird');var rp=require(_0x0a63('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0a63('0x4'));var config=require(_0x0a63('0x5'));var attributes=require(_0x0a63('0x6'));var integrations=require(_0x0a63('0x7'));module[_0x0a63('0x8')]=function(_0x4b7474,_0x2760b0){return _0x4b7474[_0x0a63('0x9')](_0x0a63('0xa'),attributes,{'tableName':_0x0a63('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index e8c1464..9bca6d7 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 _0xcd3b=['error','message','ServicenowAccount,\x20%s,\x20%s','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','where','attributes','include','map','model','ShowServicenowAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x2b96e8,_0x1ecb5a){var _0x4a037=function(_0x5d9847){while(--_0x5d9847){_0x2b96e8['push'](_0x2b96e8['shift']());}};_0x4a037(++_0x1ecb5a);}(_0xcd3b,0x86));var _0xbcd3=function(_0x3851a0,_0x547dfe){_0x3851a0=_0x3851a0-0x0;var _0x525651=_0xcd3b[_0x3851a0];return _0x525651;};'use strict';var _=require(_0xbcd3('0x0'));var util=require(_0xbcd3('0x1'));var moment=require(_0xbcd3('0x2'));var BPromise=require(_0xbcd3('0x3'));var rs=require(_0xbcd3('0x4'));var fs=require('fs');var Redis=require(_0xbcd3('0x5'));var db=require(_0xbcd3('0x6'))['db'];var utils=require(_0xbcd3('0x7'));var logger=require(_0xbcd3('0x8'))(_0xbcd3('0x9'));var config=require(_0xbcd3('0xa'));var jayson=require(_0xbcd3('0xb'));var client=jayson[_0xbcd3('0xc')][_0xbcd3('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d6596,_0x2016d7,_0x395267){return new BPromise(function(_0xd2e890,_0x4619b0){return client[_0xbcd3('0xe')](_0x1d6596,_0x395267)[_0xbcd3('0xf')](function(_0x34559f){logger[_0xbcd3('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2016d7,_0xbcd3('0x11'));logger[_0xbcd3('0x12')](_0xbcd3('0x13'),_0x2016d7,_0xbcd3('0x11'),JSON[_0xbcd3('0x14')](_0x34559f));if(_0x34559f['error']){if(_0x34559f['error'][_0xbcd3('0x15')]===0x1f4){logger[_0xbcd3('0x16')]('ServicenowAccount,\x20%s,\x20%s',_0x2016d7,_0x34559f[_0xbcd3('0x16')]['message']);return _0x4619b0(_0x34559f[_0xbcd3('0x16')][_0xbcd3('0x17')]);}logger['error'](_0xbcd3('0x18'),_0x2016d7,_0x34559f[_0xbcd3('0x16')][_0xbcd3('0x17')]);return _0xd2e890(_0x34559f[_0xbcd3('0x16')][_0xbcd3('0x17')]);}else{logger[_0xbcd3('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2016d7,_0xbcd3('0x11'));_0xd2e890(_0x34559f[_0xbcd3('0x19')][_0xbcd3('0x17')]);}})[_0xbcd3('0x1a')](function(_0x1fa785){logger[_0xbcd3('0x16')](_0xbcd3('0x18'),_0x2016d7,_0x1fa785);_0x4619b0(_0x1fa785);});});}exports[_0xbcd3('0x1b')]=function(_0x5f6a28){var _0x226b00=this;return new Promise(function(_0x3764ec,_0x628210){return db[_0xbcd3('0x1c')][_0xbcd3('0x1d')]({'raw':_0x5f6a28[_0xbcd3('0x1e')]?_0x5f6a28[_0xbcd3('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x5f6a28['options']?_0x5f6a28[_0xbcd3('0x1e')][_0xbcd3('0x1f')]||null:null,'attributes':_0x5f6a28[_0xbcd3('0x1e')]?_0x5f6a28[_0xbcd3('0x1e')][_0xbcd3('0x20')]||null:null,'limit':_0x5f6a28['options']?_0x5f6a28['options']['limit']||null:null,'include':_0x5f6a28[_0xbcd3('0x1e')]?_0x5f6a28['options'][_0xbcd3('0x21')]?_[_0xbcd3('0x22')](_0x5f6a28[_0xbcd3('0x1e')][_0xbcd3('0x21')],function(_0xd4b2f5){return{'model':db[_0xd4b2f5[_0xbcd3('0x23')]],'as':_0xd4b2f5['as'],'attributes':_0xd4b2f5[_0xbcd3('0x20')],'include':_0xd4b2f5[_0xbcd3('0x21')]?_[_0xbcd3('0x22')](_0xd4b2f5[_0xbcd3('0x21')],function(_0x4dca2c){return{'model':db[_0x4dca2c[_0xbcd3('0x23')]],'as':_0x4dca2c['as'],'attributes':_0x4dca2c['attributes'],'include':_0x4dca2c[_0xbcd3('0x21')]?_[_0xbcd3('0x22')](_0x4dca2c[_0xbcd3('0x21')],function(_0x209f39){return{'model':db[_0x209f39[_0xbcd3('0x23')]],'as':_0x209f39['as'],'attributes':_0x209f39[_0xbcd3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x479da9){logger[_0xbcd3('0x10')](_0xbcd3('0x1b'),_0x5f6a28);logger[_0xbcd3('0x12')]('GetServicenowAccount',_0x5f6a28,JSON[_0xbcd3('0x14')](_0x479da9));_0x3764ec(_0x479da9);})[_0xbcd3('0x1a')](function(_0x457811){logger[_0xbcd3('0x16')](_0xbcd3('0x1b'),_0x457811[_0xbcd3('0x17')],_0x5f6a28);_0x628210(_0x226b00[_0xbcd3('0x16')](0x1f4,_0x457811[_0xbcd3('0x17')]));});});};exports[_0xbcd3('0x24')]=function(_0x239dc3){var _0xf806d6=this;return new Promise(function(_0x3fd132,_0x5b7ad7){return db[_0xbcd3('0x1c')][_0xbcd3('0x25')]({'raw':_0x239dc3['options']?_0x239dc3[_0xbcd3('0x1e')][_0xbcd3('0x26')]===undefined?!![]:![]:!![],'where':_0x239dc3['options']?_0x239dc3[_0xbcd3('0x1e')]['where']||null:null,'attributes':_0x239dc3[_0xbcd3('0x1e')]?_0x239dc3[_0xbcd3('0x1e')][_0xbcd3('0x20')]||null:null,'include':_0x239dc3[_0xbcd3('0x1e')]?_0x239dc3[_0xbcd3('0x1e')]['include']?_[_0xbcd3('0x22')](_0x239dc3[_0xbcd3('0x1e')][_0xbcd3('0x21')],function(_0x460830){return{'model':db[_0x460830[_0xbcd3('0x23')]],'as':_0x460830['as'],'attributes':_0x460830[_0xbcd3('0x20')],'include':_0x460830[_0xbcd3('0x21')]?_[_0xbcd3('0x22')](_0x460830[_0xbcd3('0x21')],function(_0x1afbc2){return{'model':db[_0x1afbc2[_0xbcd3('0x23')]],'as':_0x1afbc2['as'],'attributes':_0x1afbc2['attributes'],'include':_0x1afbc2[_0xbcd3('0x21')]?_[_0xbcd3('0x22')](_0x1afbc2[_0xbcd3('0x21')],function(_0x440a35){return{'model':db[_0x440a35['model']],'as':_0x440a35['as'],'attributes':_0x440a35['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47333e){logger['info']('ShowServicenowAccount',_0x239dc3);logger['debug'](_0xbcd3('0x24'),_0x239dc3,JSON[_0xbcd3('0x14')](_0x47333e));_0x3fd132(_0x47333e);})[_0xbcd3('0x1a')](function(_0x42b5c3){logger[_0xbcd3('0x16')](_0xbcd3('0x24'),_0x42b5c3['message'],_0x239dc3);_0x5b7ad7(_0xf806d6[_0xbcd3('0x16')](0x1f4,_0x42b5c3[_0xbcd3('0x17')]));});});}; \ No newline at end of file +var _0xae38=['where','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','GetServicenowAccount','findAll','options','raw','limit','include','map','attributes','model','info','ServicenowAccount','find'];(function(_0x47de9a,_0x40cf23){var _0x4b9d6c=function(_0x507054){while(--_0x507054){_0x47de9a['push'](_0x47de9a['shift']());}};_0x4b9d6c(++_0x40cf23);}(_0xae38,0x1a6));var _0x8ae3=function(_0x122620,_0xec1124){_0x122620=_0x122620-0x0;var _0x27e823=_0xae38[_0x122620];return _0x27e823;};'use strict';var _=require(_0x8ae3('0x0'));var util=require(_0x8ae3('0x1'));var moment=require(_0x8ae3('0x2'));var BPromise=require('bluebird');var rs=require(_0x8ae3('0x3'));var fs=require('fs');var Redis=require(_0x8ae3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ae3('0x5'));var logger=require('../../config/logger')(_0x8ae3('0x6'));var config=require(_0x8ae3('0x7'));var jayson=require(_0x8ae3('0x8'));var client=jayson[_0x8ae3('0x9')][_0x8ae3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22fe09,_0x25e12c,_0x405bfc){return new BPromise(function(_0x47439f,_0xf96f76){return client[_0x8ae3('0xb')](_0x22fe09,_0x405bfc)[_0x8ae3('0xc')](function(_0x5e5732){logger['info'](_0x8ae3('0xd'),_0x25e12c,'request\x20sent');logger[_0x8ae3('0xe')](_0x8ae3('0xf'),_0x25e12c,'request\x20sent',JSON[_0x8ae3('0x10')](_0x5e5732));if(_0x5e5732[_0x8ae3('0x11')]){if(_0x5e5732[_0x8ae3('0x11')]['code']===0x1f4){logger[_0x8ae3('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x25e12c,_0x5e5732[_0x8ae3('0x11')][_0x8ae3('0x12')]);return _0xf96f76(_0x5e5732['error'][_0x8ae3('0x12')]);}logger[_0x8ae3('0x11')](_0x8ae3('0xd'),_0x25e12c,_0x5e5732[_0x8ae3('0x11')][_0x8ae3('0x12')]);return _0x47439f(_0x5e5732[_0x8ae3('0x11')][_0x8ae3('0x12')]);}else{logger['info'](_0x8ae3('0xd'),_0x25e12c,_0x8ae3('0x13'));_0x47439f(_0x5e5732['result'][_0x8ae3('0x12')]);}})[_0x8ae3('0x14')](function(_0x381006){logger[_0x8ae3('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x25e12c,_0x381006);_0xf96f76(_0x381006);});});}exports[_0x8ae3('0x15')]=function(_0x20c7db){var _0x30d0ad=this;return new Promise(function(_0x20cc42,_0x2f6c2b){return db['ServicenowAccount'][_0x8ae3('0x16')]({'raw':_0x20c7db[_0x8ae3('0x17')]?_0x20c7db[_0x8ae3('0x17')][_0x8ae3('0x18')]===undefined?!![]:![]:!![],'where':_0x20c7db['options']?_0x20c7db['options']['where']||null:null,'attributes':_0x20c7db[_0x8ae3('0x17')]?_0x20c7db[_0x8ae3('0x17')]['attributes']||null:null,'limit':_0x20c7db['options']?_0x20c7db['options'][_0x8ae3('0x19')]||null:null,'include':_0x20c7db[_0x8ae3('0x17')]?_0x20c7db[_0x8ae3('0x17')][_0x8ae3('0x1a')]?_[_0x8ae3('0x1b')](_0x20c7db[_0x8ae3('0x17')][_0x8ae3('0x1a')],function(_0x27ec04){return{'model':db[_0x27ec04['model']],'as':_0x27ec04['as'],'attributes':_0x27ec04[_0x8ae3('0x1c')],'include':_0x27ec04['include']?_[_0x8ae3('0x1b')](_0x27ec04[_0x8ae3('0x1a')],function(_0x18e424){return{'model':db[_0x18e424[_0x8ae3('0x1d')]],'as':_0x18e424['as'],'attributes':_0x18e424[_0x8ae3('0x1c')],'include':_0x18e424[_0x8ae3('0x1a')]?_[_0x8ae3('0x1b')](_0x18e424['include'],function(_0x3bf7d1){return{'model':db[_0x3bf7d1[_0x8ae3('0x1d')]],'as':_0x3bf7d1['as'],'attributes':_0x3bf7d1[_0x8ae3('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x8ae3('0xc')](function(_0x1211ee){logger[_0x8ae3('0x1e')](_0x8ae3('0x15'),_0x20c7db);logger[_0x8ae3('0xe')](_0x8ae3('0x15'),_0x20c7db,JSON['stringify'](_0x1211ee));_0x20cc42(_0x1211ee);})[_0x8ae3('0x14')](function(_0x4daaef){logger['error'](_0x8ae3('0x15'),_0x4daaef[_0x8ae3('0x12')],_0x20c7db);_0x2f6c2b(_0x30d0ad[_0x8ae3('0x11')](0x1f4,_0x4daaef[_0x8ae3('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x3da664){var _0x29f31d=this;return new Promise(function(_0x5a4b08,_0x3f3d18){return db[_0x8ae3('0x1f')][_0x8ae3('0x20')]({'raw':_0x3da664[_0x8ae3('0x17')]?_0x3da664[_0x8ae3('0x17')][_0x8ae3('0x18')]===undefined?!![]:![]:!![],'where':_0x3da664[_0x8ae3('0x17')]?_0x3da664[_0x8ae3('0x17')][_0x8ae3('0x21')]||null:null,'attributes':_0x3da664[_0x8ae3('0x17')]?_0x3da664[_0x8ae3('0x17')]['attributes']||null:null,'include':_0x3da664[_0x8ae3('0x17')]?_0x3da664[_0x8ae3('0x17')][_0x8ae3('0x1a')]?_[_0x8ae3('0x1b')](_0x3da664[_0x8ae3('0x17')][_0x8ae3('0x1a')],function(_0x15fc75){return{'model':db[_0x15fc75[_0x8ae3('0x1d')]],'as':_0x15fc75['as'],'attributes':_0x15fc75[_0x8ae3('0x1c')],'include':_0x15fc75[_0x8ae3('0x1a')]?_[_0x8ae3('0x1b')](_0x15fc75['include'],function(_0x44bce6){return{'model':db[_0x44bce6[_0x8ae3('0x1d')]],'as':_0x44bce6['as'],'attributes':_0x44bce6[_0x8ae3('0x1c')],'include':_0x44bce6[_0x8ae3('0x1a')]?_[_0x8ae3('0x1b')](_0x44bce6[_0x8ae3('0x1a')],function(_0x317de0){return{'model':db[_0x317de0[_0x8ae3('0x1d')]],'as':_0x317de0['as'],'attributes':_0x317de0[_0x8ae3('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e5ddd){logger[_0x8ae3('0x1e')]('ShowServicenowAccount',_0x3da664);logger[_0x8ae3('0xe')](_0x8ae3('0x22'),_0x3da664,JSON[_0x8ae3('0x10')](_0x5e5ddd));_0x5a4b08(_0x5e5ddd);})[_0x8ae3('0x14')](function(_0x225759){logger[_0x8ae3('0x11')](_0x8ae3('0x22'),_0x225759[_0x8ae3('0x12')],_0x3da664);_0x3f3d18(_0x29f31d[_0x8ae3('0x11')](0x1f4,_0x225759[_0x8ae3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 137c170..59c325a 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 _0x2227=['show','/:id/subjects','getDescriptions','put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x32358b,_0x5c7c35){var _0x58c21d=function(_0x238a63){while(--_0x238a63){_0x32358b['push'](_0x32358b['shift']());}};_0x58c21d(++_0x5c7c35);}(_0x2227,0x170));var _0x7222=function(_0x58d5ac,_0x11c4bc){_0x58d5ac=_0x58d5ac-0x0;var _0x37985c=_0x2227[_0x58d5ac];return _0x37985c;};'use strict';var multer=require(_0x7222('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7222('0x1'));var express=require(_0x7222('0x2'));var router=express[_0x7222('0x3')]();var fs_extra=require(_0x7222('0x4'));var auth=require(_0x7222('0x5'));var interaction=require(_0x7222('0x6'));var config=require(_0x7222('0x7'));var controller=require('./intServicenowConfiguration.controller');router[_0x7222('0x8')]('/',auth[_0x7222('0x9')](),controller[_0x7222('0xa')]);router[_0x7222('0x8')](_0x7222('0xb'),auth[_0x7222('0x9')](),controller[_0x7222('0xc')]);router[_0x7222('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x7222('0x8')](_0x7222('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x7222('0x8')]('/:id/descriptions',auth[_0x7222('0x9')](),controller[_0x7222('0xe')]);router['post']('/',auth[_0x7222('0x9')](),controller['create']);router[_0x7222('0xf')](_0x7222('0xb'),auth['isAuthenticated'](),controller[_0x7222('0x10')]);router[_0x7222('0x11')](_0x7222('0xb'),auth[_0x7222('0x9')](),controller[_0x7222('0x12')]);module['exports']=router; \ No newline at end of file +var _0x440b=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','destroy','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x440b,0x120));var _0xb440=function(_0xafe7,_0x14bc7b){_0xafe7=_0xafe7-0x0;var _0x392838=_0x440b[_0xafe7];return _0x392838;};'use strict';var multer=require(_0xb440('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb440('0x1'));var express=require(_0xb440('0x2'));var router=express['Router']();var fs_extra=require(_0xb440('0x3'));var auth=require(_0xb440('0x4'));var interaction=require(_0xb440('0x5'));var config=require('../../config/environment');var controller=require(_0xb440('0x6'));router[_0xb440('0x7')]('/',auth[_0xb440('0x8')](),controller[_0xb440('0x9')]);router[_0xb440('0x7')](_0xb440('0xa'),auth[_0xb440('0x8')](),controller[_0xb440('0xb')]);router[_0xb440('0x7')](_0xb440('0xc'),auth[_0xb440('0x8')](),controller[_0xb440('0xd')]);router[_0xb440('0x7')](_0xb440('0xe'),auth[_0xb440('0x8')](),controller['getSubjects']);router[_0xb440('0x7')](_0xb440('0xf'),auth[_0xb440('0x8')](),controller[_0xb440('0x10')]);router['post']('/',auth[_0xb440('0x8')](),controller['create']);router[_0xb440('0x11')](_0xb440('0xa'),auth[_0xb440('0x8')](),controller['update']);router['delete'](_0xb440('0xa'),auth['isAuthenticated'](),controller[_0xb440('0x12')]);module[_0xb440('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index fef8073..828ea5d 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 _0xddc5=['sequelize','STRING'];(function(_0x3ac282,_0x2afe1c){var _0x5df475=function(_0x521ad5){while(--_0x521ad5){_0x3ac282['push'](_0x3ac282['shift']());}};_0x5df475(++_0x2afe1c);}(_0xddc5,0xb6));var _0x5ddc=function(_0x50a7d6,_0x109734){_0x50a7d6=_0x50a7d6-0x0;var _0x37feb7=_0xddc5[_0x50a7d6];return _0x37feb7;};'use strict';var Sequelize=require(_0x5ddc('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ddc('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x323c=['STRING','sequelize','exports'];(function(_0x31a266,_0x4bde2f){var _0x402ae9=function(_0x586e2d){while(--_0x586e2d){_0x31a266['push'](_0x31a266['shift']());}};_0x402ae9(++_0x4bde2f);}(_0x323c,0x178));var _0xc323=function(_0x1d5097,_0x2c890d){_0x1d5097=_0x1d5097-0x0;var _0x18f1a4=_0x323c[_0x1d5097];return _0x18f1a4;};'use strict';var Sequelize=require(_0xc323('0x0'));module[_0xc323('0x1')]={'name':{'type':Sequelize[_0xc323('0x2')]},'description':{'type':Sequelize[_0xc323('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 026fb65..52d586a 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 _0x8e5e=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','destroy','getFields','findOne','ServicenowField','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x57f7ea,_0x54da6b){var _0x54a7e4=function(_0x2c9d4f){while(--_0x2c9d4f){_0x57f7ea['push'](_0x57f7ea['shift']());}};_0x54a7e4(++_0x54da6b);}(_0x8e5e,0x135));var _0xe8e5=function(_0x2af3e1,_0xb5207f){_0x2af3e1=_0x2af3e1-0x0;var _0xfa27d=_0x8e5e[_0x2af3e1];return _0xfa27d;};'use strict';var emlformat=require(_0xe8e5('0x0'));var rimraf=require(_0xe8e5('0x1'));var zipdir=require(_0xe8e5('0x2'));var jsonpatch=require(_0xe8e5('0x3'));var rp=require(_0xe8e5('0x4'));var moment=require(_0xe8e5('0x5'));var BPromise=require(_0xe8e5('0x6'));var Mustache=require(_0xe8e5('0x7'));var util=require(_0xe8e5('0x8'));var path=require(_0xe8e5('0x9'));var sox=require(_0xe8e5('0xa'));var csv=require(_0xe8e5('0xb'));var ejs=require(_0xe8e5('0xc'));var fs=require('fs');var fs_extra=require(_0xe8e5('0xd'));var _=require(_0xe8e5('0xe'));var squel=require(_0xe8e5('0xf'));var crypto=require('crypto');var jsforce=require(_0xe8e5('0x10'));var deskjs=require(_0xe8e5('0x11'));var toCsv=require(_0xe8e5('0xb'));var querystring=require(_0xe8e5('0x12'));var Papa=require(_0xe8e5('0x13'));var Redis=require('ioredis');var authService=require(_0xe8e5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xe8e5('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe8e5('0x16'))(_0xe8e5('0x17'));var utils=require('../../config/utils');var config=require(_0xe8e5('0x18'));var licenseUtil=require(_0xe8e5('0x19'));var db=require(_0xe8e5('0x1a'))['db'];function respondWithStatusCode(_0x39760a,_0x31db7){_0x31db7=_0x31db7||0xcc;return function(_0x43dc1c){if(_0x43dc1c){return _0x39760a[_0xe8e5('0x1b')](_0x31db7);}return _0x39760a[_0xe8e5('0x1c')](_0x31db7)[_0xe8e5('0x1d')]();};}function respondWithResult(_0x3e7f12,_0x5535e7){_0x5535e7=_0x5535e7||0xc8;return function(_0x37c08b){if(_0x37c08b){return _0x3e7f12[_0xe8e5('0x1c')](_0x5535e7)['json'](_0x37c08b);}};}function respondWithFilteredResult(_0x197b26,_0x4db897){return function(_0x55b46f){if(_0x55b46f){var _0x54ce9a=typeof _0x4db897[_0xe8e5('0x1e')]===_0xe8e5('0x1f')&&typeof _0x4db897[_0xe8e5('0x20')]==='undefined';var _0x1307ca=_0x55b46f[_0xe8e5('0x21')];var _0x5315b4=_0x54ce9a?0x0:_0x4db897[_0xe8e5('0x1e')];var _0x41cb29=_0x54ce9a?_0x55b46f[_0xe8e5('0x21')]:_0x4db897[_0xe8e5('0x1e')]+_0x4db897[_0xe8e5('0x20')];var _0x314615;if(_0x41cb29>=_0x1307ca){_0x41cb29=_0x1307ca;_0x314615=0xc8;}else{_0x314615=0xce;}_0x197b26[_0xe8e5('0x1c')](_0x314615);return _0x197b26[_0xe8e5('0x22')](_0xe8e5('0x23'),_0x5315b4+'-'+_0x41cb29+'/'+_0x1307ca)[_0xe8e5('0x24')](_0x55b46f);}return null;};}function patchUpdates(_0x1e9c1c){return function(_0x4a07ac){try{jsonpatch[_0xe8e5('0x25')](_0x4a07ac,_0x1e9c1c,!![]);}catch(_0x5b7c22){return BPromise[_0xe8e5('0x26')](_0x5b7c22);}return _0x4a07ac[_0xe8e5('0x27')]();};}function saveUpdates(_0x56031e,_0x525bd4){return function(_0x1b8a75){if(_0x1b8a75){return _0x1b8a75[_0xe8e5('0x28')](_0x56031e)[_0xe8e5('0x29')](function(_0x2a3886){return _0x2a3886;});}return null;};}function removeEntity(_0x284db1,_0x5633ae){return function(_0x11b3e0){if(_0x11b3e0){return _0x11b3e0['destroy']()[_0xe8e5('0x29')](function(){_0x284db1[_0xe8e5('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x333fe0,_0xdbb957){return function(_0x128332){if(!_0x128332){_0x333fe0['sendStatus'](0x194);}return _0x128332;};}function handleError(_0x60da7c,_0x27de75){_0x27de75=_0x27de75||0x1f4;return function(_0x2bc5cf){logger['error'](_0x2bc5cf[_0xe8e5('0x2a')]);if(_0x2bc5cf[_0xe8e5('0x2b')]){delete _0x2bc5cf[_0xe8e5('0x2b')];}_0x60da7c['status'](_0x27de75)['send'](_0x2bc5cf);};}exports[_0xe8e5('0x2c')]=function(_0x29b9b6,_0x29b98c){var _0x4c0bc8={},_0x2f9b42={},_0x4bdcf6={'count':0x0,'rows':[]};var _0x195e92=_[_0xe8e5('0x2d')](db[_0xe8e5('0x2e')][_0xe8e5('0x2f')],function(_0x14a8f2){return{'name':_0x14a8f2[_0xe8e5('0x30')],'type':_0x14a8f2[_0xe8e5('0x31')]['key']};});_0x2f9b42[_0xe8e5('0x32')]=_['map'](_0x195e92,'name');_0x2f9b42['query']=_[_0xe8e5('0x33')](_0x29b9b6[_0xe8e5('0x34')]);_0x2f9b42['filters']=_[_0xe8e5('0x35')](_0x2f9b42[_0xe8e5('0x32')],_0x2f9b42[_0xe8e5('0x34')]);_0x4c0bc8['attributes']=_[_0xe8e5('0x35')](_0x2f9b42['model'],qs[_0xe8e5('0x36')](_0x29b9b6['query']['fields']));_0x4c0bc8[_0xe8e5('0x37')]=_0x4c0bc8[_0xe8e5('0x37')][_0xe8e5('0x38')]?_0x4c0bc8['attributes']:_0x2f9b42[_0xe8e5('0x32')];if(!_0x29b9b6[_0xe8e5('0x34')][_0xe8e5('0x39')](_0xe8e5('0x3a'))){_0x4c0bc8['limit']=qs[_0xe8e5('0x20')](_0x29b9b6[_0xe8e5('0x34')][_0xe8e5('0x20')]);_0x4c0bc8[_0xe8e5('0x1e')]=qs[_0xe8e5('0x1e')](_0x29b9b6[_0xe8e5('0x34')]['offset']);}_0x4c0bc8['order']=qs[_0xe8e5('0x3b')](_0x29b9b6[_0xe8e5('0x34')]['sort']);_0x4c0bc8[_0xe8e5('0x3c')]=qs[_0xe8e5('0x3d')](_[_0xe8e5('0x3e')](_0x29b9b6['query'],_0x2f9b42[_0xe8e5('0x3d')]),_0x195e92);if(_0x29b9b6[_0xe8e5('0x34')][_0xe8e5('0x3f')]){_0x4c0bc8[_0xe8e5('0x3c')]=_[_0xe8e5('0x40')](_0x4c0bc8['where'],{'$or':_['map'](_0x195e92,function(_0x27f848){if(_0x27f848[_0xe8e5('0x31')]!==_0xe8e5('0x41')){var _0xde2fe8={};_0xde2fe8[_0x27f848[_0xe8e5('0x2b')]]={'$like':'%'+_0x29b9b6['query']['filter']+'%'};return _0xde2fe8;}})});}_0x4c0bc8=_[_0xe8e5('0x40')]({},_0x4c0bc8,_0x29b9b6[_0xe8e5('0x42')]);var _0x2271bc={'where':_0x4c0bc8[_0xe8e5('0x3c')]};return db[_0xe8e5('0x2e')]['count'](_0x2271bc)[_0xe8e5('0x29')](function(_0x379245){_0x4bdcf6[_0xe8e5('0x21')]=_0x379245;if(_0x29b9b6[_0xe8e5('0x34')][_0xe8e5('0x43')]){_0x4c0bc8['include']=[{'all':!![]}];}return db[_0xe8e5('0x2e')][_0xe8e5('0x44')](_0x4c0bc8);})[_0xe8e5('0x29')](function(_0x55b67a){_0x4bdcf6[_0xe8e5('0x45')]=_0x55b67a;return _0x4bdcf6;})[_0xe8e5('0x29')](respondWithFilteredResult(_0x29b98c,_0x4c0bc8))[_0xe8e5('0x46')](handleError(_0x29b98c,null));};exports[_0xe8e5('0x47')]=function(_0x5a5763,_0x2f8067){var _0x47c689={'raw':![],'where':{'id':_0x5a5763[_0xe8e5('0x48')]['id']}},_0x232094={};_0x232094[_0xe8e5('0x32')]=_[_0xe8e5('0x33')](db[_0xe8e5('0x2e')][_0xe8e5('0x2f')]);_0x232094['query']=_['keys'](_0x5a5763[_0xe8e5('0x34')]);_0x232094[_0xe8e5('0x3d')]=_[_0xe8e5('0x35')](_0x232094['model'],_0x232094[_0xe8e5('0x34')]);_0x47c689[_0xe8e5('0x37')]=_[_0xe8e5('0x35')](_0x232094['model'],qs['fields'](_0x5a5763[_0xe8e5('0x34')]['fields']));_0x47c689[_0xe8e5('0x37')]=_0x47c689[_0xe8e5('0x37')][_0xe8e5('0x38')]?_0x47c689[_0xe8e5('0x37')]:_0x232094[_0xe8e5('0x32')];if(_0x5a5763[_0xe8e5('0x34')][_0xe8e5('0x43')]){_0x47c689[_0xe8e5('0x49')]=[{'all':!![]}];}_0x47c689=_[_0xe8e5('0x40')]({},_0x47c689,_0x5a5763[_0xe8e5('0x42')]);return db[_0xe8e5('0x2e')]['find'](_0x47c689)['then'](handleEntityNotFound(_0x2f8067,null))['then'](respondWithResult(_0x2f8067,null))[_0xe8e5('0x46')](handleError(_0x2f8067,null));};exports[_0xe8e5('0x4a')]=function(_0x505ae2,_0x5aa520){return db[_0xe8e5('0x2e')][_0xe8e5('0x4a')](_0x505ae2[_0xe8e5('0x4b')],{})[_0xe8e5('0x29')](respondWithResult(_0x5aa520,0xc9))[_0xe8e5('0x46')](handleError(_0x5aa520,null));};exports['update']=function(_0x3f1d53,_0x79e899){if(_0x3f1d53['body']['id']){delete _0x3f1d53[_0xe8e5('0x4b')]['id'];}return db['ServicenowConfiguration'][_0xe8e5('0x4c')]({'where':{'id':_0x3f1d53['params']['id']}})[_0xe8e5('0x29')](handleEntityNotFound(_0x79e899,null))[_0xe8e5('0x29')](saveUpdates(_0x3f1d53[_0xe8e5('0x4b')],null))[_0xe8e5('0x29')](respondWithResult(_0x79e899,null))[_0xe8e5('0x46')](handleError(_0x79e899,null));};exports[_0xe8e5('0x4d')]=function(_0x1ea72d,_0x3cc8fd){return db[_0xe8e5('0x2e')][_0xe8e5('0x4c')]({'where':{'id':_0x1ea72d['params']['id']}})['then'](handleEntityNotFound(_0x3cc8fd,null))[_0xe8e5('0x29')](removeEntity(_0x3cc8fd,null))['catch'](handleError(_0x3cc8fd,null));};exports[_0xe8e5('0x4e')]=function(_0x44226a,_0x39a74f,_0xee3106){var _0x2bfcfe={};var _0xc7ce1={};var _0x147cf1;var _0x4e9b94;return db[_0xe8e5('0x2e')][_0xe8e5('0x4f')]({'where':{'id':_0x44226a[_0xe8e5('0x48')]['id']}})['then'](handleEntityNotFound(_0x39a74f,null))[_0xe8e5('0x29')](function(_0x46ff71){if(_0x46ff71){_0x147cf1=_0x46ff71;_0xc7ce1[_0xe8e5('0x32')]=_[_0xe8e5('0x33')](db[_0xe8e5('0x50')]['rawAttributes']);_0xc7ce1['query']=_[_0xe8e5('0x33')](_0x44226a['query']);_0xc7ce1[_0xe8e5('0x3d')]=_[_0xe8e5('0x35')](_0xc7ce1[_0xe8e5('0x32')],_0xc7ce1['query']);_0x2bfcfe[_0xe8e5('0x37')]=_[_0xe8e5('0x35')](_0xc7ce1['model'],qs['fields'](_0x44226a[_0xe8e5('0x34')][_0xe8e5('0x36')]));_0x2bfcfe[_0xe8e5('0x37')]=_0x2bfcfe[_0xe8e5('0x37')][_0xe8e5('0x38')]?_0x2bfcfe[_0xe8e5('0x37')]:_0xc7ce1[_0xe8e5('0x32')];_0x2bfcfe['order']=qs['sort'](_0x44226a[_0xe8e5('0x34')]['sort']);_0x2bfcfe[_0xe8e5('0x3c')]=qs['filters'](_['pick'](_0x44226a[_0xe8e5('0x34')],_0xc7ce1[_0xe8e5('0x3d')]));if(_0x44226a[_0xe8e5('0x34')][_0xe8e5('0x3f')]){_0x2bfcfe[_0xe8e5('0x3c')]=_[_0xe8e5('0x40')](_0x2bfcfe[_0xe8e5('0x3c')],{'$or':_[_0xe8e5('0x2d')](_0x2bfcfe['attributes'],function(_0x570d33){var _0xfb614d={};_0xfb614d[_0x570d33]={'$like':'%'+_0x44226a[_0xe8e5('0x34')][_0xe8e5('0x3f')]+'%'};return _0xfb614d;})});}_0x2bfcfe=_[_0xe8e5('0x40')]({},_0x2bfcfe,_0x44226a['options']);return _0x147cf1['getFields'](_0x2bfcfe);}})[_0xe8e5('0x29')](function(_0x2f5b65){if(_0x2f5b65){_0x4e9b94=_0x2f5b65['length'];if(!_0x44226a[_0xe8e5('0x34')]['hasOwnProperty'](_0xe8e5('0x3a'))){_0x2bfcfe[_0xe8e5('0x20')]=qs[_0xe8e5('0x20')](_0x44226a[_0xe8e5('0x34')][_0xe8e5('0x20')]);_0x2bfcfe[_0xe8e5('0x1e')]=qs[_0xe8e5('0x1e')](_0x44226a[_0xe8e5('0x34')][_0xe8e5('0x1e')]);}return _0x147cf1[_0xe8e5('0x4e')](_0x2bfcfe);}})[_0xe8e5('0x29')](function(_0x1f35de){if(_0x1f35de){return _0x1f35de?{'count':_0x4e9b94,'rows':_0x1f35de}:null;}})[_0xe8e5('0x29')](respondWithResult(_0x39a74f,null))[_0xe8e5('0x46')](handleError(_0x39a74f,null));};exports['getSubjects']=function(_0x25ee77,_0x3b1310,_0x5315dd){var _0x2420d3={};var _0xad2e58={};var _0x1193f3;var _0x1c3cd8;return db[_0xe8e5('0x2e')]['findOne']({'where':{'id':_0x25ee77[_0xe8e5('0x48')]['id']}})['then'](handleEntityNotFound(_0x3b1310,null))[_0xe8e5('0x29')](function(_0x53857f){if(_0x53857f){_0x1193f3=_0x53857f;_0xad2e58[_0xe8e5('0x32')]=_[_0xe8e5('0x33')](db[_0xe8e5('0x50')][_0xe8e5('0x2f')]);_0xad2e58[_0xe8e5('0x34')]=_['keys'](_0x25ee77['query']);_0xad2e58[_0xe8e5('0x3d')]=_[_0xe8e5('0x35')](_0xad2e58[_0xe8e5('0x32')],_0xad2e58[_0xe8e5('0x34')]);_0x2420d3[_0xe8e5('0x37')]=_[_0xe8e5('0x35')](_0xad2e58[_0xe8e5('0x32')],qs[_0xe8e5('0x36')](_0x25ee77[_0xe8e5('0x34')]['fields']));_0x2420d3[_0xe8e5('0x37')]=_0x2420d3[_0xe8e5('0x37')][_0xe8e5('0x38')]?_0x2420d3['attributes']:_0xad2e58['model'];_0x2420d3[_0xe8e5('0x51')]=qs[_0xe8e5('0x3b')](_0x25ee77['query'][_0xe8e5('0x3b')]);_0x2420d3[_0xe8e5('0x3c')]=qs[_0xe8e5('0x3d')](_['pick'](_0x25ee77['query'],_0xad2e58['filters']));if(_0x25ee77['query'][_0xe8e5('0x3f')]){_0x2420d3['where']=_[_0xe8e5('0x40')](_0x2420d3[_0xe8e5('0x3c')],{'$or':_[_0xe8e5('0x2d')](_0x2420d3[_0xe8e5('0x37')],function(_0x577683){var _0x4ecb77={};_0x4ecb77[_0x577683]={'$like':'%'+_0x25ee77['query']['filter']+'%'};return _0x4ecb77;})});}_0x2420d3=_['merge']({},_0x2420d3,_0x25ee77[_0xe8e5('0x42')]);return _0x1193f3[_0xe8e5('0x52')](_0x2420d3);}})[_0xe8e5('0x29')](function(_0x4165e3){if(_0x4165e3){_0x1c3cd8=_0x4165e3[_0xe8e5('0x38')];if(!_0x25ee77[_0xe8e5('0x34')]['hasOwnProperty'](_0xe8e5('0x3a'))){_0x2420d3[_0xe8e5('0x20')]=qs['limit'](_0x25ee77['query']['limit']);_0x2420d3[_0xe8e5('0x1e')]=qs['offset'](_0x25ee77[_0xe8e5('0x34')][_0xe8e5('0x1e')]);}return _0x1193f3[_0xe8e5('0x52')](_0x2420d3);}})[_0xe8e5('0x29')](function(_0x27d2c0){if(_0x27d2c0){return _0x27d2c0?{'count':_0x1c3cd8,'rows':_0x27d2c0}:null;}})[_0xe8e5('0x29')](respondWithResult(_0x3b1310,null))['catch'](handleError(_0x3b1310,null));};exports[_0xe8e5('0x53')]=function(_0x40b71f,_0x54fa8f,_0x470d4f){var _0x3136cd={};var _0x4a5aca={};var _0x449fb7;var _0x193bfc;return db[_0xe8e5('0x2e')][_0xe8e5('0x4f')]({'where':{'id':_0x40b71f['params']['id']}})[_0xe8e5('0x29')](handleEntityNotFound(_0x54fa8f,null))[_0xe8e5('0x29')](function(_0x47ff2f){if(_0x47ff2f){_0x449fb7=_0x47ff2f;_0x4a5aca[_0xe8e5('0x32')]=_['keys'](db[_0xe8e5('0x50')]['rawAttributes']);_0x4a5aca['query']=_[_0xe8e5('0x33')](_0x40b71f[_0xe8e5('0x34')]);_0x4a5aca[_0xe8e5('0x3d')]=_[_0xe8e5('0x35')](_0x4a5aca[_0xe8e5('0x32')],_0x4a5aca['query']);_0x3136cd[_0xe8e5('0x37')]=_['intersection'](_0x4a5aca['model'],qs[_0xe8e5('0x36')](_0x40b71f['query'][_0xe8e5('0x36')]));_0x3136cd[_0xe8e5('0x37')]=_0x3136cd[_0xe8e5('0x37')][_0xe8e5('0x38')]?_0x3136cd[_0xe8e5('0x37')]:_0x4a5aca[_0xe8e5('0x32')];_0x3136cd[_0xe8e5('0x51')]=qs['sort'](_0x40b71f['query'][_0xe8e5('0x3b')]);_0x3136cd[_0xe8e5('0x3c')]=qs[_0xe8e5('0x3d')](_[_0xe8e5('0x3e')](_0x40b71f[_0xe8e5('0x34')],_0x4a5aca[_0xe8e5('0x3d')]));if(_0x40b71f[_0xe8e5('0x34')][_0xe8e5('0x3f')]){_0x3136cd[_0xe8e5('0x3c')]=_[_0xe8e5('0x40')](_0x3136cd[_0xe8e5('0x3c')],{'$or':_[_0xe8e5('0x2d')](_0x3136cd[_0xe8e5('0x37')],function(_0x435ec7){var _0x58f438={};_0x58f438[_0x435ec7]={'$like':'%'+_0x40b71f['query'][_0xe8e5('0x3f')]+'%'};return _0x58f438;})});}_0x3136cd=_[_0xe8e5('0x40')]({},_0x3136cd,_0x40b71f[_0xe8e5('0x42')]);return _0x449fb7[_0xe8e5('0x53')](_0x3136cd);}})[_0xe8e5('0x29')](function(_0x41e055){if(_0x41e055){_0x193bfc=_0x41e055[_0xe8e5('0x38')];if(!_0x40b71f[_0xe8e5('0x34')][_0xe8e5('0x39')]('nolimit')){_0x3136cd[_0xe8e5('0x20')]=qs[_0xe8e5('0x20')](_0x40b71f[_0xe8e5('0x34')]['limit']);_0x3136cd['offset']=qs[_0xe8e5('0x1e')](_0x40b71f[_0xe8e5('0x34')]['offset']);}return _0x449fb7[_0xe8e5('0x53')](_0x3136cd);}})['then'](function(_0x1d423e){if(_0x1d423e){return _0x1d423e?{'count':_0x193bfc,'rows':_0x1d423e}:null;}})[_0xe8e5('0x29')](respondWithResult(_0x54fa8f,null))['catch'](handleError(_0x54fa8f,null));}; \ No newline at end of file +var _0x7a88=['length','hasOwnProperty','nolimit','limit','order','sort','where','pick','type','VIRTUAL','name','merge','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','ServicenowField','filter','getSubjects','getDescriptions','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','offset','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','send','index','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields'];(function(_0x41601d,_0x36ad17){var _0x1d5fb2=function(_0x27e1b6){while(--_0x27e1b6){_0x41601d['push'](_0x41601d['shift']());}};_0x1d5fb2(++_0x36ad17);}(_0x7a88,0xc4));var _0x87a8=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x7a88[_0x57fda8];return _0x11c895;};'use strict';var emlformat=require(_0x87a8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x87a8('0x1'));var rp=require(_0x87a8('0x2'));var moment=require(_0x87a8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x87a8('0x4'));var util=require(_0x87a8('0x5'));var path=require(_0x87a8('0x6'));var sox=require(_0x87a8('0x7'));var csv=require(_0x87a8('0x8'));var ejs=require(_0x87a8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x87a8('0xa'));var crypto=require('crypto');var jsforce=require(_0x87a8('0xb'));var deskjs=require(_0x87a8('0xc'));var toCsv=require(_0x87a8('0x8'));var querystring=require('querystring');var Papa=require(_0x87a8('0xd'));var Redis=require(_0x87a8('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x87a8('0xf'));var as=require(_0x87a8('0x10'));var hardwareService=require(_0x87a8('0x11'));var logger=require(_0x87a8('0x12'))(_0x87a8('0x13'));var utils=require(_0x87a8('0x14'));var config=require(_0x87a8('0x15'));var licenseUtil=require(_0x87a8('0x16'));var db=require(_0x87a8('0x17'))['db'];function respondWithStatusCode(_0xb75ef0,_0x1f6c97){_0x1f6c97=_0x1f6c97||0xcc;return function(_0xf2b6b1){if(_0xf2b6b1){return _0xb75ef0['sendStatus'](_0x1f6c97);}return _0xb75ef0['status'](_0x1f6c97)[_0x87a8('0x18')]();};}function respondWithResult(_0x59c81a,_0x33cc62){_0x33cc62=_0x33cc62||0xc8;return function(_0x132566){if(_0x132566){return _0x59c81a[_0x87a8('0x19')](_0x33cc62)[_0x87a8('0x1a')](_0x132566);}};}function respondWithFilteredResult(_0x4f71d2,_0x497746){return function(_0xa852bc){if(_0xa852bc){var _0x1285f2=typeof _0x497746['offset']===_0x87a8('0x1b')&&typeof _0x497746['limit']===_0x87a8('0x1b');var _0x4bcfdc=_0xa852bc['count'];var _0x27e25a=_0x1285f2?0x0:_0x497746[_0x87a8('0x1c')];var _0x8f29c3=_0x1285f2?_0xa852bc['count']:_0x497746[_0x87a8('0x1c')]+_0x497746['limit'];var _0x4a77b2;if(_0x8f29c3>=_0x4bcfdc){_0x8f29c3=_0x4bcfdc;_0x4a77b2=0xc8;}else{_0x4a77b2=0xce;}_0x4f71d2[_0x87a8('0x19')](_0x4a77b2);return _0x4f71d2[_0x87a8('0x1d')](_0x87a8('0x1e'),_0x27e25a+'-'+_0x8f29c3+'/'+_0x4bcfdc)[_0x87a8('0x1a')](_0xa852bc);}return null;};}function patchUpdates(_0x2580ac){return function(_0x1e95d6){try{jsonpatch['apply'](_0x1e95d6,_0x2580ac,!![]);}catch(_0x3a39c7){return BPromise[_0x87a8('0x1f')](_0x3a39c7);}return _0x1e95d6[_0x87a8('0x20')]();};}function saveUpdates(_0x28bab9,_0x5291d7){return function(_0x142a93){if(_0x142a93){return _0x142a93[_0x87a8('0x21')](_0x28bab9)[_0x87a8('0x22')](function(_0x5e04fa){return _0x5e04fa;});}return null;};}function removeEntity(_0x52d955,_0x1a6403){return function(_0x2b630e){if(_0x2b630e){return _0x2b630e[_0x87a8('0x23')]()['then'](function(){_0x52d955[_0x87a8('0x19')](0xcc)[_0x87a8('0x18')]();});}};}function handleEntityNotFound(_0x2ff512,_0x82b8cb){return function(_0x562ae6){if(!_0x562ae6){_0x2ff512[_0x87a8('0x24')](0x194);}return _0x562ae6;};}function handleError(_0x41d51a,_0x5e9e64){_0x5e9e64=_0x5e9e64||0x1f4;return function(_0x3948b3){logger[_0x87a8('0x25')](_0x3948b3[_0x87a8('0x26')]);if(_0x3948b3['name']){delete _0x3948b3['name'];}_0x41d51a[_0x87a8('0x19')](_0x5e9e64)[_0x87a8('0x27')](_0x3948b3);};}exports[_0x87a8('0x28')]=function(_0x16fc04,_0x4b0cec){var _0x361312={},_0x8418f1={},_0x561355={'count':0x0,'rows':[]};var _0x238986=_['map'](db[_0x87a8('0x29')][_0x87a8('0x2a')],function(_0x3daef1){return{'name':_0x3daef1[_0x87a8('0x2b')],'type':_0x3daef1['type'][_0x87a8('0x2c')]};});_0x8418f1[_0x87a8('0x2d')]=_[_0x87a8('0x2e')](_0x238986,'name');_0x8418f1[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x16fc04[_0x87a8('0x2f')]);_0x8418f1[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x8418f1[_0x87a8('0x2d')],_0x8418f1['query']);_0x361312[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x8418f1[_0x87a8('0x2d')],qs[_0x87a8('0x34')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x361312[_0x87a8('0x33')]=_0x361312[_0x87a8('0x33')][_0x87a8('0x35')]?_0x361312[_0x87a8('0x33')]:_0x8418f1[_0x87a8('0x2d')];if(!_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x361312[_0x87a8('0x38')]=qs[_0x87a8('0x38')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x361312[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x1c')]);}_0x361312[_0x87a8('0x39')]=qs[_0x87a8('0x3a')](_0x16fc04[_0x87a8('0x2f')]['sort']);_0x361312[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x16fc04[_0x87a8('0x2f')],_0x8418f1['filters']),_0x238986);if(_0x16fc04[_0x87a8('0x2f')]['filter']){_0x361312[_0x87a8('0x3b')]=_['merge'](_0x361312[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x238986,function(_0x398b5a){if(_0x398b5a[_0x87a8('0x3d')]!==_0x87a8('0x3e')){var _0x14cf97={};_0x14cf97[_0x398b5a[_0x87a8('0x3f')]]={'$like':'%'+_0x16fc04['query']['filter']+'%'};return _0x14cf97;}})});}_0x361312=_[_0x87a8('0x40')]({},_0x361312,_0x16fc04[_0x87a8('0x41')]);var _0x1d2ed5={'where':_0x361312[_0x87a8('0x3b')]};return db[_0x87a8('0x29')][_0x87a8('0x42')](_0x1d2ed5)[_0x87a8('0x22')](function(_0x39cdae){_0x561355[_0x87a8('0x42')]=_0x39cdae;if(_0x16fc04[_0x87a8('0x2f')][_0x87a8('0x43')]){_0x361312[_0x87a8('0x44')]=[{'all':!![]}];}return db[_0x87a8('0x29')][_0x87a8('0x45')](_0x361312);})[_0x87a8('0x22')](function(_0x3f41bf){_0x561355[_0x87a8('0x46')]=_0x3f41bf;return _0x561355;})[_0x87a8('0x22')](respondWithFilteredResult(_0x4b0cec,_0x361312))[_0x87a8('0x47')](handleError(_0x4b0cec,null));};exports[_0x87a8('0x48')]=function(_0x3e5a6a,_0x1291c4){var _0x54b302={'raw':![],'where':{'id':_0x3e5a6a[_0x87a8('0x49')]['id']}},_0x26405f={};_0x26405f['model']=_[_0x87a8('0x30')](db[_0x87a8('0x29')][_0x87a8('0x2a')]);_0x26405f[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x3e5a6a['query']);_0x26405f['filters']=_[_0x87a8('0x32')](_0x26405f[_0x87a8('0x2d')],_0x26405f['query']);_0x54b302['attributes']=_[_0x87a8('0x32')](_0x26405f['model'],qs['fields'](_0x3e5a6a[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x54b302[_0x87a8('0x33')]=_0x54b302[_0x87a8('0x33')][_0x87a8('0x35')]?_0x54b302[_0x87a8('0x33')]:_0x26405f[_0x87a8('0x2d')];if(_0x3e5a6a[_0x87a8('0x2f')][_0x87a8('0x43')]){_0x54b302[_0x87a8('0x44')]=[{'all':!![]}];}_0x54b302=_[_0x87a8('0x40')]({},_0x54b302,_0x3e5a6a[_0x87a8('0x41')]);return db[_0x87a8('0x29')][_0x87a8('0x4a')](_0x54b302)[_0x87a8('0x22')](handleEntityNotFound(_0x1291c4,null))[_0x87a8('0x22')](respondWithResult(_0x1291c4,null))[_0x87a8('0x47')](handleError(_0x1291c4,null));};exports['create']=function(_0x597798,_0xcaa360){return db[_0x87a8('0x29')][_0x87a8('0x4b')](_0x597798[_0x87a8('0x4c')],{})[_0x87a8('0x22')](respondWithResult(_0xcaa360,0xc9))[_0x87a8('0x47')](handleError(_0xcaa360,null));};exports[_0x87a8('0x21')]=function(_0x22aa5b,_0x50b6a5){if(_0x22aa5b[_0x87a8('0x4c')]['id']){delete _0x22aa5b[_0x87a8('0x4c')]['id'];}return db[_0x87a8('0x29')][_0x87a8('0x4a')]({'where':{'id':_0x22aa5b['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x50b6a5,null))['then'](saveUpdates(_0x22aa5b[_0x87a8('0x4c')],null))[_0x87a8('0x22')](respondWithResult(_0x50b6a5,null))[_0x87a8('0x47')](handleError(_0x50b6a5,null));};exports[_0x87a8('0x23')]=function(_0x2837fd,_0x38b67b){return db['ServicenowConfiguration']['find']({'where':{'id':_0x2837fd[_0x87a8('0x49')]['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x38b67b,null))[_0x87a8('0x22')](removeEntity(_0x38b67b,null))[_0x87a8('0x47')](handleError(_0x38b67b,null));};exports[_0x87a8('0x4d')]=function(_0x274d73,_0x2930f3,_0x3a22b0){var _0x533af3={};var _0x2c0c9c={};var _0x3fa996;var _0x15c2c1;return db[_0x87a8('0x29')][_0x87a8('0x4e')]({'where':{'id':_0x274d73['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x2930f3,null))[_0x87a8('0x22')](function(_0xac4582){if(_0xac4582){_0x3fa996=_0xac4582;_0x2c0c9c[_0x87a8('0x2d')]=_['keys'](db[_0x87a8('0x4f')]['rawAttributes']);_0x2c0c9c[_0x87a8('0x2f')]=_[_0x87a8('0x30')](_0x274d73['query']);_0x2c0c9c[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x2c0c9c['model'],_0x2c0c9c[_0x87a8('0x2f')]);_0x533af3[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x2c0c9c['model'],qs[_0x87a8('0x34')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x34')]));_0x533af3['attributes']=_0x533af3[_0x87a8('0x33')][_0x87a8('0x35')]?_0x533af3[_0x87a8('0x33')]:_0x2c0c9c[_0x87a8('0x2d')];_0x533af3['order']=qs[_0x87a8('0x3a')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x3a')]);_0x533af3[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x274d73[_0x87a8('0x2f')],_0x2c0c9c[_0x87a8('0x31')]));if(_0x274d73[_0x87a8('0x2f')][_0x87a8('0x50')]){_0x533af3[_0x87a8('0x3b')]=_[_0x87a8('0x40')](_0x533af3['where'],{'$or':_['map'](_0x533af3['attributes'],function(_0x378701){var _0xbc4fa5={};_0xbc4fa5[_0x378701]={'$like':'%'+_0x274d73[_0x87a8('0x2f')]['filter']+'%'};return _0xbc4fa5;})});}_0x533af3=_[_0x87a8('0x40')]({},_0x533af3,_0x274d73[_0x87a8('0x41')]);return _0x3fa996[_0x87a8('0x4d')](_0x533af3);}})[_0x87a8('0x22')](function(_0x242a7d){if(_0x242a7d){_0x15c2c1=_0x242a7d[_0x87a8('0x35')];if(!_0x274d73[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x533af3['limit']=qs[_0x87a8('0x38')](_0x274d73[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x533af3[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x274d73[_0x87a8('0x2f')]['offset']);}return _0x3fa996[_0x87a8('0x4d')](_0x533af3);}})[_0x87a8('0x22')](function(_0x28bb90){if(_0x28bb90){return _0x28bb90?{'count':_0x15c2c1,'rows':_0x28bb90}:null;}})[_0x87a8('0x22')](respondWithResult(_0x2930f3,null))[_0x87a8('0x47')](handleError(_0x2930f3,null));};exports[_0x87a8('0x51')]=function(_0x46a8aa,_0x1d14e0,_0x19120a){var _0x5db455={};var _0x1c9e24={};var _0x2f1092;var _0x1e132f;return db[_0x87a8('0x29')][_0x87a8('0x4e')]({'where':{'id':_0x46a8aa[_0x87a8('0x49')]['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x1d14e0,null))['then'](function(_0x5cd673){if(_0x5cd673){_0x2f1092=_0x5cd673;_0x1c9e24['model']=_[_0x87a8('0x30')](db[_0x87a8('0x4f')]['rawAttributes']);_0x1c9e24['query']=_['keys'](_0x46a8aa[_0x87a8('0x2f')]);_0x1c9e24[_0x87a8('0x31')]=_[_0x87a8('0x32')](_0x1c9e24[_0x87a8('0x2d')],_0x1c9e24['query']);_0x5db455[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x1c9e24['model'],qs[_0x87a8('0x34')](_0x46a8aa[_0x87a8('0x2f')]['fields']));_0x5db455[_0x87a8('0x33')]=_0x5db455[_0x87a8('0x33')]['length']?_0x5db455[_0x87a8('0x33')]:_0x1c9e24[_0x87a8('0x2d')];_0x5db455['order']=qs[_0x87a8('0x3a')](_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x3a')]);_0x5db455[_0x87a8('0x3b')]=qs[_0x87a8('0x31')](_[_0x87a8('0x3c')](_0x46a8aa[_0x87a8('0x2f')],_0x1c9e24[_0x87a8('0x31')]));if(_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x50')]){_0x5db455[_0x87a8('0x3b')]=_[_0x87a8('0x40')](_0x5db455[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x5db455['attributes'],function(_0x395552){var _0x297873={};_0x297873[_0x395552]={'$like':'%'+_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x50')]+'%'};return _0x297873;})});}_0x5db455=_[_0x87a8('0x40')]({},_0x5db455,_0x46a8aa[_0x87a8('0x41')]);return _0x2f1092[_0x87a8('0x51')](_0x5db455);}})[_0x87a8('0x22')](function(_0x1d32a){if(_0x1d32a){_0x1e132f=_0x1d32a[_0x87a8('0x35')];if(!_0x46a8aa[_0x87a8('0x2f')]['hasOwnProperty'](_0x87a8('0x37'))){_0x5db455[_0x87a8('0x38')]=qs['limit'](_0x46a8aa['query'][_0x87a8('0x38')]);_0x5db455[_0x87a8('0x1c')]=qs['offset'](_0x46a8aa[_0x87a8('0x2f')][_0x87a8('0x1c')]);}return _0x2f1092[_0x87a8('0x51')](_0x5db455);}})[_0x87a8('0x22')](function(_0x1eebb9){if(_0x1eebb9){return _0x1eebb9?{'count':_0x1e132f,'rows':_0x1eebb9}:null;}})[_0x87a8('0x22')](respondWithResult(_0x1d14e0,null))['catch'](handleError(_0x1d14e0,null));};exports[_0x87a8('0x52')]=function(_0x1b2bcb,_0x54c95b,_0x13c51){var _0x2c5c77={};var _0x535571={};var _0x271ad1;var _0x26efa8;return db['ServicenowConfiguration'][_0x87a8('0x4e')]({'where':{'id':_0x1b2bcb['params']['id']}})[_0x87a8('0x22')](handleEntityNotFound(_0x54c95b,null))['then'](function(_0x2a3262){if(_0x2a3262){_0x271ad1=_0x2a3262;_0x535571[_0x87a8('0x2d')]=_['keys'](db[_0x87a8('0x4f')][_0x87a8('0x2a')]);_0x535571[_0x87a8('0x2f')]=_['keys'](_0x1b2bcb[_0x87a8('0x2f')]);_0x535571['filters']=_[_0x87a8('0x32')](_0x535571[_0x87a8('0x2d')],_0x535571[_0x87a8('0x2f')]);_0x2c5c77[_0x87a8('0x33')]=_[_0x87a8('0x32')](_0x535571[_0x87a8('0x2d')],qs['fields'](_0x1b2bcb[_0x87a8('0x2f')]['fields']));_0x2c5c77[_0x87a8('0x33')]=_0x2c5c77['attributes'][_0x87a8('0x35')]?_0x2c5c77['attributes']:_0x535571['model'];_0x2c5c77[_0x87a8('0x39')]=qs[_0x87a8('0x3a')](_0x1b2bcb['query'][_0x87a8('0x3a')]);_0x2c5c77[_0x87a8('0x3b')]=qs['filters'](_['pick'](_0x1b2bcb[_0x87a8('0x2f')],_0x535571[_0x87a8('0x31')]));if(_0x1b2bcb[_0x87a8('0x2f')]['filter']){_0x2c5c77[_0x87a8('0x3b')]=_['merge'](_0x2c5c77[_0x87a8('0x3b')],{'$or':_[_0x87a8('0x2e')](_0x2c5c77[_0x87a8('0x33')],function(_0x5d1ea6){var _0x196a47={};_0x196a47[_0x5d1ea6]={'$like':'%'+_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x50')]+'%'};return _0x196a47;})});}_0x2c5c77=_[_0x87a8('0x40')]({},_0x2c5c77,_0x1b2bcb['options']);return _0x271ad1[_0x87a8('0x52')](_0x2c5c77);}})[_0x87a8('0x22')](function(_0x11976e){if(_0x11976e){_0x26efa8=_0x11976e['length'];if(!_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x36')](_0x87a8('0x37'))){_0x2c5c77[_0x87a8('0x38')]=qs['limit'](_0x1b2bcb[_0x87a8('0x2f')][_0x87a8('0x38')]);_0x2c5c77[_0x87a8('0x1c')]=qs[_0x87a8('0x1c')](_0x1b2bcb[_0x87a8('0x2f')]['offset']);}return _0x271ad1[_0x87a8('0x52')](_0x2c5c77);}})[_0x87a8('0x22')](function(_0x292bef){if(_0x292bef){return _0x292bef?{'count':_0x26efa8,'rows':_0x292bef}:null;}})[_0x87a8('0x22')](respondWithResult(_0x54c95b,null))['catch'](handleError(_0x54c95b,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index a3f1f67..54dd4bf 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x5166bc,_0x28e06e){_0x5166bc=_0x5166bc-0x0;var _0x20abf2=_0xf4f4[_0x5166bc];return _0x20abf2;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5454=['define','ServicenowConfiguration','int_servicenow_configurations','api','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0x443456,_0xc9d5d4){var _0x27872d=function(_0x2f0acb){while(--_0x2f0acb){_0x443456['push'](_0x443456['shift']());}};_0x27872d(++_0xc9d5d4);}(_0x5454,0x15b));var _0x4545=function(_0x55d061,_0x218533){_0x55d061=_0x55d061-0x0;var _0x30fdde=_0x5454[_0x55d061];return _0x30fdde;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x4545('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4545('0x1'));var rimraf=require(_0x4545('0x2'));var config=require(_0x4545('0x3'));var attributes=require(_0x4545('0x4'));module['exports']=function(_0x41ffd0,_0xececc1){return _0x41ffd0[_0x4545('0x5')](_0x4545('0x6'),attributes,{'tableName':_0x4545('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js index 61bd8a9..6fd59e0 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 _0x61c7=['rpc','jayson/promise','http','request','then','info','debug','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57474e,_0x4178b8){var _0xfaae8c=function(_0x2e34d1){while(--_0x2e34d1){_0x57474e['push'](_0x57474e['shift']());}};_0xfaae8c(++_0x4178b8);}(_0x61c7,0x76));var _0x761c=function(_0x17fcef,_0x5e3486){_0x17fcef=_0x17fcef-0x0;var _0x17919b=_0x61c7[_0x17fcef];return _0x17919b;};'use strict';var _=require('lodash');var util=require(_0x761c('0x0'));var moment=require(_0x761c('0x1'));var BPromise=require(_0x761c('0x2'));var rs=require(_0x761c('0x3'));var fs=require('fs');var Redis=require(_0x761c('0x4'));var db=require(_0x761c('0x5'))['db'];var utils=require(_0x761c('0x6'));var logger=require(_0x761c('0x7'))(_0x761c('0x8'));var config=require('../../config/environment');var jayson=require(_0x761c('0x9'));var client=jayson['client'][_0x761c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4cd253,_0x3f63cf,_0x34d784){return new BPromise(function(_0x4d35b5,_0xa5a124){return client[_0x761c('0xb')](_0x4cd253,_0x34d784)[_0x761c('0xc')](function(_0x2a91eb){logger[_0x761c('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f63cf,'request\x20sent');logger[_0x761c('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x3f63cf,_0x761c('0xf'),JSON['stringify'](_0x2a91eb));if(_0x2a91eb[_0x761c('0x10')]){if(_0x2a91eb[_0x761c('0x10')][_0x761c('0x11')]===0x1f4){logger['error'](_0x761c('0x12'),_0x3f63cf,_0x2a91eb[_0x761c('0x10')][_0x761c('0x13')]);return _0xa5a124(_0x2a91eb['error'][_0x761c('0x13')]);}logger[_0x761c('0x10')](_0x761c('0x12'),_0x3f63cf,_0x2a91eb[_0x761c('0x10')][_0x761c('0x13')]);return _0x4d35b5(_0x2a91eb['error'][_0x761c('0x13')]);}else{logger[_0x761c('0xd')]('ServicenowConfiguration,\x20%s,\x20%s',_0x3f63cf,_0x761c('0xf'));_0x4d35b5(_0x2a91eb[_0x761c('0x14')][_0x761c('0x13')]);}})['catch'](function(_0x2692ab){logger['error'](_0x761c('0x12'),_0x3f63cf,_0x2692ab);_0xa5a124(_0x2692ab);});});} \ No newline at end of file +var _0x2081=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3dfede,_0x35ee98){var _0x380d54=function(_0x2845f6){while(--_0x2845f6){_0x3dfede['push'](_0x3dfede['shift']());}};_0x380d54(++_0x35ee98);}(_0x2081,0xaf));var _0x1208=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0x2081[_0x46c1d5];return _0x40fe7b;};'use strict';var _=require(_0x1208('0x0'));var util=require(_0x1208('0x1'));var moment=require(_0x1208('0x2'));var BPromise=require(_0x1208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1208('0x4'));var db=require(_0x1208('0x5'))['db'];var utils=require(_0x1208('0x6'));var logger=require(_0x1208('0x7'))(_0x1208('0x8'));var config=require(_0x1208('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1208('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355e72,_0x5292e9,_0x1cfd71){return new BPromise(function(_0x10ebfc,_0x155adb){return client[_0x1208('0xb')](_0x355e72,_0x1cfd71)['then'](function(_0x446eb7){logger[_0x1208('0xc')](_0x1208('0xd'),_0x5292e9,_0x1208('0xe'));logger[_0x1208('0xf')](_0x1208('0x10'),_0x5292e9,'request\x20sent',JSON['stringify'](_0x446eb7));if(_0x446eb7[_0x1208('0x11')]){if(_0x446eb7['error']['code']===0x1f4){logger[_0x1208('0x11')]('ServicenowConfiguration,\x20%s,\x20%s',_0x5292e9,_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);return _0x155adb(_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);}logger[_0x1208('0x11')](_0x1208('0xd'),_0x5292e9,_0x446eb7[_0x1208('0x11')]['message']);return _0x10ebfc(_0x446eb7[_0x1208('0x11')][_0x1208('0x12')]);}else{logger['info'](_0x1208('0xd'),_0x5292e9,_0x1208('0xe'));_0x10ebfc(_0x446eb7['result'][_0x1208('0x12')]);}})[_0x1208('0x13')](function(_0x2bd95a){logger[_0x1208('0x11')](_0x1208('0xd'),_0x5292e9,_0x2bd95a);_0x155adb(_0x2bd95a);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index bc6b99f..a5cb507 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 _0xa5d2=['index','get','show','post','create','put','/:id','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated'];(function(_0x1d1567,_0x4b866f){var _0x1042ca=function(_0xb74306){while(--_0xb74306){_0x1d1567['push'](_0x1d1567['shift']());}};_0x1042ca(++_0x4b866f);}(_0xa5d2,0x128));var _0x2a5d=function(_0x220bf1,_0x1f4548){_0x220bf1=_0x220bf1-0x0;var _0x18e20c=_0xa5d2[_0x220bf1];return _0x18e20c;};'use strict';var multer=require(_0x2a5d('0x0'));var util=require(_0x2a5d('0x1'));var path=require(_0x2a5d('0x2'));var timeout=require('connect-timeout');var express=require(_0x2a5d('0x3'));var router=express[_0x2a5d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2a5d('0x5'));var interaction=require(_0x2a5d('0x6'));var config=require(_0x2a5d('0x7'));var controller=require(_0x2a5d('0x8'));router['get']('/',auth[_0x2a5d('0x9')](),controller[_0x2a5d('0xa')]);router[_0x2a5d('0xb')]('/:id',auth[_0x2a5d('0x9')](),controller[_0x2a5d('0xc')]);router[_0x2a5d('0xd')]('/',auth[_0x2a5d('0x9')](),controller[_0x2a5d('0xe')]);router[_0x2a5d('0xf')](_0x2a5d('0x10'),auth[_0x2a5d('0x9')](),controller['update']);router['delete'](_0x2a5d('0x10'),auth[_0x2a5d('0x9')](),controller[_0x2a5d('0x11')]);module['exports']=router; \ No newline at end of file +var _0xea32=['post','isAuthenticated','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','index','show'];(function(_0x4b7b4c,_0x1d4460){var _0x547340=function(_0x2e6a84){while(--_0x2e6a84){_0x4b7b4c['push'](_0x4b7b4c['shift']());}};_0x547340(++_0x1d4460);}(_0xea32,0x87));var _0x2ea3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xea32[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x2ea3('0x0'));var util=require(_0x2ea3('0x1'));var path=require(_0x2ea3('0x2'));var timeout=require(_0x2ea3('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ea3('0x4'));var auth=require(_0x2ea3('0x5'));var interaction=require(_0x2ea3('0x6'));var config=require(_0x2ea3('0x7'));var controller=require(_0x2ea3('0x8'));router[_0x2ea3('0x9')]('/',auth['isAuthenticated'](),controller[_0x2ea3('0xa')]);router[_0x2ea3('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2ea3('0xb')]);router[_0x2ea3('0xc')]('/',auth[_0x2ea3('0xd')](),controller[_0x2ea3('0xe')]);router[_0x2ea3('0xf')](_0x2ea3('0x10'),auth[_0x2ea3('0xd')](),controller[_0x2ea3('0x11')]);router[_0x2ea3('0x12')](_0x2ea3('0x10'),auth[_0x2ea3('0xd')](),controller[_0x2ea3('0x13')]);module[_0x2ea3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index e391ecf..c92ecdd 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 _0xa177=['sequelize','exports','ENUM','string','keyValue','STRING','variable','customVariable','BOOLEAN'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xa177,0x120));var _0x7a17=function(_0x14d619,_0x387f8f){_0x14d619=_0x14d619-0x0;var _0x43c6b4=_0xa177[_0x14d619];return _0x43c6b4;};'use strict';var Sequelize=require(_0x7a17('0x0'));module[_0x7a17('0x1')]={'type':{'type':Sequelize[_0x7a17('0x2')](_0x7a17('0x3'),'variable','customVariable',_0x7a17('0x4'),'picklist'),'defaultValue':_0x7a17('0x3')},'content':{'type':Sequelize[_0x7a17('0x5')]},'key':{'type':Sequelize[_0x7a17('0x5')]},'keyType':{'type':Sequelize[_0x7a17('0x2')](_0x7a17('0x3'),_0x7a17('0x6'),_0x7a17('0x7'))},'keyContent':{'type':Sequelize[_0x7a17('0x5')]},'idField':{'type':Sequelize[_0x7a17('0x5')]},'nameField':{'type':Sequelize[_0x7a17('0x5')]},'customField':{'type':Sequelize[_0x7a17('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7a17('0x5')]}}; \ No newline at end of file +var _0x07ef=['variable','keyValue','picklist','STRING','customVariable','BOOLEAN','ENUM'];(function(_0x5a7c04,_0x2f0a7f){var _0x95cb0a=function(_0x8f4063){while(--_0x8f4063){_0x5a7c04['push'](_0x5a7c04['shift']());}};_0x95cb0a(++_0x2f0a7f);}(_0x07ef,0x11e));var _0xf07e=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x07ef[_0x576266];return _0x18234f;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xf07e('0x0')]('string',_0xf07e('0x1'),'customVariable',_0xf07e('0x2'),_0xf07e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xf07e('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf07e('0x0')]('string',_0xf07e('0x1'),_0xf07e('0x5'))},'keyContent':{'type':Sequelize[_0xf07e('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf07e('0x4')]},'customField':{'type':Sequelize[_0xf07e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf07e('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 07d558b..1434f02 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 _0x0dc8=['attributes','fields','hasOwnProperty','order','sort','where','pick','filter','map','VIRTUAL','options','includeAll','findAll','catch','show','params','length','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','index','ServicenowField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection'];(function(_0x4f1afc,_0x50fd41){var _0x526c0a=function(_0x6f8c95){while(--_0x6f8c95){_0x4f1afc['push'](_0x4f1afc['shift']());}};_0x526c0a(++_0x50fd41);}(_0x0dc8,0x1dd));var _0x80dc=function(_0x24dfd2,_0x504fac){_0x24dfd2=_0x24dfd2-0x0;var _0x3abda1=_0x0dc8[_0x24dfd2];return _0x3abda1;};'use strict';var emlformat=require(_0x80dc('0x0'));var rimraf=require(_0x80dc('0x1'));var zipdir=require(_0x80dc('0x2'));var jsonpatch=require(_0x80dc('0x3'));var rp=require(_0x80dc('0x4'));var moment=require(_0x80dc('0x5'));var BPromise=require(_0x80dc('0x6'));var Mustache=require(_0x80dc('0x7'));var util=require('util');var path=require(_0x80dc('0x8'));var sox=require(_0x80dc('0x9'));var csv=require(_0x80dc('0xa'));var ejs=require(_0x80dc('0xb'));var fs=require('fs');var fs_extra=require(_0x80dc('0xc'));var _=require(_0x80dc('0xd'));var squel=require(_0x80dc('0xe'));var crypto=require(_0x80dc('0xf'));var jsforce=require(_0x80dc('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x80dc('0x11'));var Redis=require(_0x80dc('0x12'));var authService=require(_0x80dc('0x13'));var qs=require(_0x80dc('0x14'));var as=require(_0x80dc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x80dc('0x16'));var utils=require(_0x80dc('0x17'));var config=require(_0x80dc('0x18'));var licenseUtil=require(_0x80dc('0x19'));var db=require(_0x80dc('0x1a'))['db'];function respondWithStatusCode(_0x1af4b4,_0x32b1ba){_0x32b1ba=_0x32b1ba||0xcc;return function(_0x3bce9b){if(_0x3bce9b){return _0x1af4b4[_0x80dc('0x1b')](_0x32b1ba);}return _0x1af4b4[_0x80dc('0x1c')](_0x32b1ba)[_0x80dc('0x1d')]();};}function respondWithResult(_0xe47b53,_0x2d433a){_0x2d433a=_0x2d433a||0xc8;return function(_0x536ebc){if(_0x536ebc){return _0xe47b53[_0x80dc('0x1c')](_0x2d433a)[_0x80dc('0x1e')](_0x536ebc);}};}function respondWithFilteredResult(_0x536b68,_0x3c5947){return function(_0x43fa84){if(_0x43fa84){var _0x3fbe31=typeof _0x3c5947[_0x80dc('0x1f')]===_0x80dc('0x20')&&typeof _0x3c5947[_0x80dc('0x21')]==='undefined';var _0x114384=_0x43fa84[_0x80dc('0x22')];var _0xc54963=_0x3fbe31?0x0:_0x3c5947[_0x80dc('0x1f')];var _0x2a552e=_0x3fbe31?_0x43fa84['count']:_0x3c5947[_0x80dc('0x1f')]+_0x3c5947[_0x80dc('0x21')];var _0x1c0f37;if(_0x2a552e>=_0x114384){_0x2a552e=_0x114384;_0x1c0f37=0xc8;}else{_0x1c0f37=0xce;}_0x536b68[_0x80dc('0x1c')](_0x1c0f37);return _0x536b68[_0x80dc('0x23')](_0x80dc('0x24'),_0xc54963+'-'+_0x2a552e+'/'+_0x114384)[_0x80dc('0x1e')](_0x43fa84);}return null;};}function patchUpdates(_0x45fd68){return function(_0x549f61){try{jsonpatch['apply'](_0x549f61,_0x45fd68,!![]);}catch(_0x843dfe){return BPromise['reject'](_0x843dfe);}return _0x549f61[_0x80dc('0x25')]();};}function saveUpdates(_0x333c09,_0x5ea1fe){return function(_0x2a4e08){if(_0x2a4e08){return _0x2a4e08[_0x80dc('0x26')](_0x333c09)[_0x80dc('0x27')](function(_0x2a1d1b){return _0x2a1d1b;});}return null;};}function removeEntity(_0x35a959,_0x276bbc){return function(_0xa03d4b){if(_0xa03d4b){return _0xa03d4b[_0x80dc('0x28')]()[_0x80dc('0x27')](function(){_0x35a959['status'](0xcc)[_0x80dc('0x1d')]();});}};}function handleEntityNotFound(_0x2d2dc9,_0x3b9b85){return function(_0x54b537){if(!_0x54b537){_0x2d2dc9[_0x80dc('0x1b')](0x194);}return _0x54b537;};}function handleError(_0x57f5e8,_0x4f8d17){_0x4f8d17=_0x4f8d17||0x1f4;return function(_0x4494f2){logger[_0x80dc('0x29')](_0x4494f2[_0x80dc('0x2a')]);if(_0x4494f2[_0x80dc('0x2b')]){delete _0x4494f2['name'];}_0x57f5e8['status'](_0x4f8d17)['send'](_0x4494f2);};}exports[_0x80dc('0x2c')]=function(_0x3b8558,_0x338758){var _0x564a9e={},_0x3835c0={},_0x38b66b={'count':0x0,'rows':[]};var _0x11b1da=_['map'](db[_0x80dc('0x2d')][_0x80dc('0x2e')],function(_0x44d406){return{'name':_0x44d406[_0x80dc('0x2f')],'type':_0x44d406[_0x80dc('0x30')][_0x80dc('0x31')]};});_0x3835c0[_0x80dc('0x32')]=_['map'](_0x11b1da,_0x80dc('0x2b'));_0x3835c0[_0x80dc('0x33')]=_[_0x80dc('0x34')](_0x3b8558['query']);_0x3835c0[_0x80dc('0x35')]=_[_0x80dc('0x36')](_0x3835c0[_0x80dc('0x32')],_0x3835c0['query']);_0x564a9e[_0x80dc('0x37')]=_[_0x80dc('0x36')](_0x3835c0[_0x80dc('0x32')],qs['fields'](_0x3b8558[_0x80dc('0x33')][_0x80dc('0x38')]));_0x564a9e[_0x80dc('0x37')]=_0x564a9e[_0x80dc('0x37')]['length']?_0x564a9e[_0x80dc('0x37')]:_0x3835c0['model'];if(!_0x3b8558[_0x80dc('0x33')][_0x80dc('0x39')]('nolimit')){_0x564a9e[_0x80dc('0x21')]=qs[_0x80dc('0x21')](_0x3b8558[_0x80dc('0x33')][_0x80dc('0x21')]);_0x564a9e['offset']=qs['offset'](_0x3b8558[_0x80dc('0x33')][_0x80dc('0x1f')]);}_0x564a9e[_0x80dc('0x3a')]=qs['sort'](_0x3b8558[_0x80dc('0x33')][_0x80dc('0x3b')]);_0x564a9e[_0x80dc('0x3c')]=qs[_0x80dc('0x35')](_[_0x80dc('0x3d')](_0x3b8558[_0x80dc('0x33')],_0x3835c0['filters']),_0x11b1da);if(_0x3b8558[_0x80dc('0x33')][_0x80dc('0x3e')]){_0x564a9e[_0x80dc('0x3c')]=_['merge'](_0x564a9e[_0x80dc('0x3c')],{'$or':_[_0x80dc('0x3f')](_0x11b1da,function(_0x214361){if(_0x214361[_0x80dc('0x30')]!==_0x80dc('0x40')){var _0x30ce52={};_0x30ce52[_0x214361['name']]={'$like':'%'+_0x3b8558[_0x80dc('0x33')]['filter']+'%'};return _0x30ce52;}})});}_0x564a9e=_['merge']({},_0x564a9e,_0x3b8558[_0x80dc('0x41')]);var _0x139050={'where':_0x564a9e[_0x80dc('0x3c')]};return db[_0x80dc('0x2d')][_0x80dc('0x22')](_0x139050)[_0x80dc('0x27')](function(_0x2d3264){_0x38b66b[_0x80dc('0x22')]=_0x2d3264;if(_0x3b8558[_0x80dc('0x33')][_0x80dc('0x42')]){_0x564a9e['include']=[{'all':!![]}];}return db[_0x80dc('0x2d')][_0x80dc('0x43')](_0x564a9e);})[_0x80dc('0x27')](function(_0x23e841){_0x38b66b['rows']=_0x23e841;return _0x38b66b;})[_0x80dc('0x27')](respondWithFilteredResult(_0x338758,_0x564a9e))[_0x80dc('0x44')](handleError(_0x338758,null));};exports[_0x80dc('0x45')]=function(_0x4c084e,_0x46f560){var _0x2a3362={'raw':!![],'where':{'id':_0x4c084e[_0x80dc('0x46')]['id']}},_0x1ae0f8={};_0x1ae0f8['model']=_[_0x80dc('0x34')](db[_0x80dc('0x2d')][_0x80dc('0x2e')]);_0x1ae0f8['query']=_[_0x80dc('0x34')](_0x4c084e[_0x80dc('0x33')]);_0x1ae0f8[_0x80dc('0x35')]=_[_0x80dc('0x36')](_0x1ae0f8[_0x80dc('0x32')],_0x1ae0f8[_0x80dc('0x33')]);_0x2a3362[_0x80dc('0x37')]=_[_0x80dc('0x36')](_0x1ae0f8['model'],qs[_0x80dc('0x38')](_0x4c084e[_0x80dc('0x33')][_0x80dc('0x38')]));_0x2a3362[_0x80dc('0x37')]=_0x2a3362[_0x80dc('0x37')][_0x80dc('0x47')]?_0x2a3362[_0x80dc('0x37')]:_0x1ae0f8[_0x80dc('0x32')];if(_0x4c084e[_0x80dc('0x33')]['includeAll']){_0x2a3362['include']=[{'all':!![]}];}_0x2a3362=_[_0x80dc('0x48')]({},_0x2a3362,_0x4c084e[_0x80dc('0x41')]);return db[_0x80dc('0x2d')][_0x80dc('0x49')](_0x2a3362)['then'](handleEntityNotFound(_0x46f560,null))[_0x80dc('0x27')](respondWithResult(_0x46f560,null))[_0x80dc('0x44')](handleError(_0x46f560,null));};exports['create']=function(_0x91bf24,_0x48bed8){return db[_0x80dc('0x2d')][_0x80dc('0x4a')](_0x91bf24[_0x80dc('0x4b')],{})[_0x80dc('0x27')](respondWithResult(_0x48bed8,0xc9))[_0x80dc('0x44')](handleError(_0x48bed8,null));};exports[_0x80dc('0x26')]=function(_0x3203c0,_0x392844){if(_0x3203c0[_0x80dc('0x4b')]['id']){delete _0x3203c0[_0x80dc('0x4b')]['id'];}return db[_0x80dc('0x2d')][_0x80dc('0x49')]({'where':{'id':_0x3203c0['params']['id']}})['then'](handleEntityNotFound(_0x392844,null))[_0x80dc('0x27')](saveUpdates(_0x3203c0[_0x80dc('0x4b')],null))[_0x80dc('0x27')](respondWithResult(_0x392844,null))['catch'](handleError(_0x392844,null));};exports[_0x80dc('0x28')]=function(_0x1d6c98,_0x5d19ca){return db[_0x80dc('0x2d')][_0x80dc('0x49')]({'where':{'id':_0x1d6c98['params']['id']}})['then'](handleEntityNotFound(_0x5d19ca,null))[_0x80dc('0x27')](removeEntity(_0x5d19ca,null))[_0x80dc('0x44')](handleError(_0x5d19ca,null));}; \ No newline at end of file +var _0xee7e=['../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','map','ServicenowField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','includeAll','rows','show','params','length','include','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5b45da,_0x52bb87){var _0x2327f7=function(_0x35c430){while(--_0x35c430){_0x5b45da['push'](_0x5b45da['shift']());}};_0x2327f7(++_0x52bb87);}(_0xee7e,0x165));var _0xeee7=function(_0x46180d,_0x37a501){_0x46180d=_0x46180d-0x0;var _0x4ba9a3=_0xee7e[_0x46180d];return _0x4ba9a3;};'use strict';var emlformat=require(_0xeee7('0x0'));var rimraf=require(_0xeee7('0x1'));var zipdir=require(_0xeee7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeee7('0x3'));var moment=require(_0xeee7('0x4'));var BPromise=require(_0xeee7('0x5'));var Mustache=require(_0xeee7('0x6'));var util=require(_0xeee7('0x7'));var path=require(_0xeee7('0x8'));var sox=require(_0xeee7('0x9'));var csv=require('to-csv');var ejs=require(_0xeee7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xeee7('0xb'));var crypto=require('crypto');var jsforce=require(_0xeee7('0xc'));var deskjs=require(_0xeee7('0xd'));var toCsv=require(_0xeee7('0xe'));var querystring=require(_0xeee7('0xf'));var Papa=require(_0xeee7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xeee7('0x11'));var as=require(_0xeee7('0x12'));var hardwareService=require(_0xeee7('0x13'));var logger=require(_0xeee7('0x14'))(_0xeee7('0x15'));var utils=require(_0xeee7('0x16'));var config=require(_0xeee7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xeee7('0x18'))['db'];function respondWithStatusCode(_0x41eca5,_0x5d2d99){_0x5d2d99=_0x5d2d99||0xcc;return function(_0x502fb7){if(_0x502fb7){return _0x41eca5[_0xeee7('0x19')](_0x5d2d99);}return _0x41eca5[_0xeee7('0x1a')](_0x5d2d99)['end']();};}function respondWithResult(_0x5396c8,_0x5c5476){_0x5c5476=_0x5c5476||0xc8;return function(_0x27d5f0){if(_0x27d5f0){return _0x5396c8[_0xeee7('0x1a')](_0x5c5476)[_0xeee7('0x1b')](_0x27d5f0);}};}function respondWithFilteredResult(_0xd85f48,_0x4bd015){return function(_0x365a3a){if(_0x365a3a){var _0x1e1326=typeof _0x4bd015[_0xeee7('0x1c')]===_0xeee7('0x1d')&&typeof _0x4bd015[_0xeee7('0x1e')]===_0xeee7('0x1d');var _0x219f1e=_0x365a3a['count'];var _0x18b276=_0x1e1326?0x0:_0x4bd015['offset'];var _0x5b39fa=_0x1e1326?_0x365a3a[_0xeee7('0x1f')]:_0x4bd015[_0xeee7('0x1c')]+_0x4bd015['limit'];var _0x8f0dc1;if(_0x5b39fa>=_0x219f1e){_0x5b39fa=_0x219f1e;_0x8f0dc1=0xc8;}else{_0x8f0dc1=0xce;}_0xd85f48[_0xeee7('0x1a')](_0x8f0dc1);return _0xd85f48[_0xeee7('0x20')](_0xeee7('0x21'),_0x18b276+'-'+_0x5b39fa+'/'+_0x219f1e)[_0xeee7('0x1b')](_0x365a3a);}return null;};}function patchUpdates(_0x119726){return function(_0xd22af5){try{jsonpatch[_0xeee7('0x22')](_0xd22af5,_0x119726,!![]);}catch(_0x11be24){return BPromise[_0xeee7('0x23')](_0x11be24);}return _0xd22af5[_0xeee7('0x24')]();};}function saveUpdates(_0xf7ba64,_0x125a36){return function(_0xb22b7d){if(_0xb22b7d){return _0xb22b7d[_0xeee7('0x25')](_0xf7ba64)[_0xeee7('0x26')](function(_0x1b20bd){return _0x1b20bd;});}return null;};}function removeEntity(_0x2e6b1c,_0x2b3a29){return function(_0x390bc3){if(_0x390bc3){return _0x390bc3['destroy']()[_0xeee7('0x26')](function(){_0x2e6b1c[_0xeee7('0x1a')](0xcc)[_0xeee7('0x27')]();});}};}function handleEntityNotFound(_0x10d01b,_0x482387){return function(_0x110a94){if(!_0x110a94){_0x10d01b[_0xeee7('0x19')](0x194);}return _0x110a94;};}function handleError(_0xfcb2b1,_0x39970f){_0x39970f=_0x39970f||0x1f4;return function(_0x34877d){logger[_0xeee7('0x28')](_0x34877d[_0xeee7('0x29')]);if(_0x34877d[_0xeee7('0x2a')]){delete _0x34877d[_0xeee7('0x2a')];}_0xfcb2b1[_0xeee7('0x1a')](_0x39970f)['send'](_0x34877d);};}exports[_0xeee7('0x2b')]=function(_0x3b3874,_0x511557){var _0x3d00ee={},_0x374e18={},_0x453dc6={'count':0x0,'rows':[]};var _0x4549ed=_[_0xeee7('0x2c')](db[_0xeee7('0x2d')][_0xeee7('0x2e')],function(_0x227d69){return{'name':_0x227d69[_0xeee7('0x2f')],'type':_0x227d69['type'][_0xeee7('0x30')]};});_0x374e18[_0xeee7('0x31')]=_[_0xeee7('0x2c')](_0x4549ed,_0xeee7('0x2a'));_0x374e18['query']=_[_0xeee7('0x32')](_0x3b3874[_0xeee7('0x33')]);_0x374e18[_0xeee7('0x34')]=_[_0xeee7('0x35')](_0x374e18[_0xeee7('0x31')],_0x374e18[_0xeee7('0x33')]);_0x3d00ee[_0xeee7('0x36')]=_['intersection'](_0x374e18[_0xeee7('0x31')],qs['fields'](_0x3b3874[_0xeee7('0x33')][_0xeee7('0x37')]));_0x3d00ee['attributes']=_0x3d00ee[_0xeee7('0x36')]['length']?_0x3d00ee[_0xeee7('0x36')]:_0x374e18['model'];if(!_0x3b3874['query'][_0xeee7('0x38')](_0xeee7('0x39'))){_0x3d00ee[_0xeee7('0x1e')]=qs['limit'](_0x3b3874['query'][_0xeee7('0x1e')]);_0x3d00ee['offset']=qs['offset'](_0x3b3874['query']['offset']);}_0x3d00ee[_0xeee7('0x3a')]=qs[_0xeee7('0x3b')](_0x3b3874[_0xeee7('0x33')][_0xeee7('0x3b')]);_0x3d00ee[_0xeee7('0x3c')]=qs['filters'](_['pick'](_0x3b3874[_0xeee7('0x33')],_0x374e18[_0xeee7('0x34')]),_0x4549ed);if(_0x3b3874[_0xeee7('0x33')][_0xeee7('0x3d')]){_0x3d00ee[_0xeee7('0x3c')]=_[_0xeee7('0x3e')](_0x3d00ee[_0xeee7('0x3c')],{'$or':_['map'](_0x4549ed,function(_0x14cf2c){if(_0x14cf2c[_0xeee7('0x3f')]!=='VIRTUAL'){var _0x34798e={};_0x34798e[_0x14cf2c[_0xeee7('0x2a')]]={'$like':'%'+_0x3b3874['query']['filter']+'%'};return _0x34798e;}})});}_0x3d00ee=_[_0xeee7('0x3e')]({},_0x3d00ee,_0x3b3874['options']);var _0x18c05b={'where':_0x3d00ee[_0xeee7('0x3c')]};return db[_0xeee7('0x2d')][_0xeee7('0x1f')](_0x18c05b)[_0xeee7('0x26')](function(_0x4bca54){_0x453dc6[_0xeee7('0x1f')]=_0x4bca54;if(_0x3b3874[_0xeee7('0x33')][_0xeee7('0x40')]){_0x3d00ee['include']=[{'all':!![]}];}return db[_0xeee7('0x2d')]['findAll'](_0x3d00ee);})[_0xeee7('0x26')](function(_0x5e35ae){_0x453dc6[_0xeee7('0x41')]=_0x5e35ae;return _0x453dc6;})[_0xeee7('0x26')](respondWithFilteredResult(_0x511557,_0x3d00ee))['catch'](handleError(_0x511557,null));};exports[_0xeee7('0x42')]=function(_0x47e6a6,_0x4b29bf){var _0x450210={'raw':!![],'where':{'id':_0x47e6a6[_0xeee7('0x43')]['id']}},_0x44063d={};_0x44063d[_0xeee7('0x31')]=_[_0xeee7('0x32')](db[_0xeee7('0x2d')][_0xeee7('0x2e')]);_0x44063d[_0xeee7('0x33')]=_['keys'](_0x47e6a6[_0xeee7('0x33')]);_0x44063d[_0xeee7('0x34')]=_[_0xeee7('0x35')](_0x44063d['model'],_0x44063d[_0xeee7('0x33')]);_0x450210[_0xeee7('0x36')]=_[_0xeee7('0x35')](_0x44063d['model'],qs[_0xeee7('0x37')](_0x47e6a6[_0xeee7('0x33')][_0xeee7('0x37')]));_0x450210['attributes']=_0x450210['attributes'][_0xeee7('0x44')]?_0x450210['attributes']:_0x44063d['model'];if(_0x47e6a6[_0xeee7('0x33')][_0xeee7('0x40')]){_0x450210[_0xeee7('0x45')]=[{'all':!![]}];}_0x450210=_[_0xeee7('0x3e')]({},_0x450210,_0x47e6a6[_0xeee7('0x46')]);return db['ServicenowField'][_0xeee7('0x47')](_0x450210)[_0xeee7('0x26')](handleEntityNotFound(_0x4b29bf,null))[_0xeee7('0x26')](respondWithResult(_0x4b29bf,null))[_0xeee7('0x48')](handleError(_0x4b29bf,null));};exports[_0xeee7('0x49')]=function(_0x3b25a9,_0x577a4a){return db[_0xeee7('0x2d')][_0xeee7('0x49')](_0x3b25a9[_0xeee7('0x4a')],{})['then'](respondWithResult(_0x577a4a,0xc9))[_0xeee7('0x48')](handleError(_0x577a4a,null));};exports[_0xeee7('0x25')]=function(_0x5adad3,_0x3ff6c0){if(_0x5adad3[_0xeee7('0x4a')]['id']){delete _0x5adad3[_0xeee7('0x4a')]['id'];}return db[_0xeee7('0x2d')][_0xeee7('0x47')]({'where':{'id':_0x5adad3[_0xeee7('0x43')]['id']}})[_0xeee7('0x26')](handleEntityNotFound(_0x3ff6c0,null))[_0xeee7('0x26')](saveUpdates(_0x5adad3[_0xeee7('0x4a')],null))[_0xeee7('0x26')](respondWithResult(_0x3ff6c0,null))['catch'](handleError(_0x3ff6c0,null));};exports[_0xeee7('0x4b')]=function(_0x4efebc,_0x1adb4f){return db[_0xeee7('0x2d')][_0xeee7('0x47')]({'where':{'id':_0x4efebc[_0xeee7('0x43')]['id']}})[_0xeee7('0x26')](handleEntityNotFound(_0x1adb4f,null))[_0xeee7('0x26')](removeEntity(_0x1adb4f,null))['catch'](handleError(_0x1adb4f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 55eb483..6e25892 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 _0xfed3=['moment','request-promise','path','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId','util','api'];(function(_0x26b3e4,_0x230936){var _0x24b741=function(_0x4190ae){while(--_0x4190ae){_0x26b3e4['push'](_0x26b3e4['shift']());}};_0x24b741(++_0x230936);}(_0xfed3,0x1df));var _0x3fed=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0xfed3[_0x286bfb];return _0x52b683;};'use strict';var _=require('lodash');var util=require(_0x3fed('0x0'));var logger=require('../../config/logger')(_0x3fed('0x1'));var moment=require(_0x3fed('0x2'));var BPromise=require('bluebird');var rp=require(_0x3fed('0x3'));var fs=require('fs');var path=require(_0x3fed('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3fed('0x5'));module[_0x3fed('0x6')]=function(_0xcba565,_0xd9b698){return _0xcba565[_0x3fed('0x7')](_0x3fed('0x8'),attributes,{'tableName':_0x3fed('0x9'),'paranoid':![],'indexes':[{'name':_0x3fed('0xa'),'fields':[_0x3fed('0xb'),_0x3fed('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xee16=['./intServicenowField.attributes','exports','ServicenowField','servicenow_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x43b3e5,_0x29bd76){var _0x9cbaa5=function(_0x497350){while(--_0x497350){_0x43b3e5['push'](_0x43b3e5['shift']());}};_0x9cbaa5(++_0x29bd76);}(_0xee16,0x164));var _0x6ee1=function(_0x14a0a0,_0x45d0cf){_0x14a0a0=_0x14a0a0-0x0;var _0x56b651=_0xee16[_0x14a0a0];return _0x56b651;};'use strict';var _=require(_0x6ee1('0x0'));var util=require('util');var logger=require(_0x6ee1('0x1'))(_0x6ee1('0x2'));var moment=require(_0x6ee1('0x3'));var BPromise=require(_0x6ee1('0x4'));var rp=require(_0x6ee1('0x5'));var fs=require('fs');var path=require(_0x6ee1('0x6'));var rimraf=require('rimraf');var config=require(_0x6ee1('0x7'));var attributes=require(_0x6ee1('0x8'));module[_0x6ee1('0x9')]=function(_0x4b2d27,_0x248c44){return _0x4b2d27['define'](_0x6ee1('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x6ee1('0xb'),'fields':[_0x6ee1('0xc'),_0x6ee1('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index ce5c0d5..17e93d9 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 _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','error','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x5bbae4,_0x2a4a4e){var _0x338a50=function(_0x478845){while(--_0x478845){_0x5bbae4['push'](_0x5bbae4['shift']());}};_0x338a50(++_0x2a4a4e);}(_0xaa88,0x137));var _0x8aa8=function(_0xffa198,_0x5a8940){_0xffa198=_0xffa198-0x0;var _0x1e4b50=_0xaa88[_0xffa198];return _0x1e4b50;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var moment=require(_0x8aa8('0x2'));var BPromise=require(_0x8aa8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8aa8('0x4'));var db=require(_0x8aa8('0x5'))['db'];var utils=require(_0x8aa8('0x6'));var logger=require(_0x8aa8('0x7'))(_0x8aa8('0x8'));var config=require(_0x8aa8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8aa8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5264ff,_0x449d2d,_0x1ed84d){return new BPromise(function(_0x27c08d,_0x40826f){return client['request'](_0x5264ff,_0x1ed84d)[_0x8aa8('0xb')](function(_0x2d974c){logger[_0x8aa8('0xc')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x8aa8('0xd'));logger[_0x8aa8('0xe')](_0x8aa8('0xf'),_0x449d2d,_0x8aa8('0xd'),JSON['stringify'](_0x2d974c));if(_0x2d974c[_0x8aa8('0x10')]){if(_0x2d974c[_0x8aa8('0x10')]['code']===0x1f4){logger[_0x8aa8('0x10')](_0x8aa8('0x11'),_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x40826f(_0x2d974c[_0x8aa8('0x10')][_0x8aa8('0x12')]);}logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0x2d974c[_0x8aa8('0x10')]['message']);return _0x27c08d(_0x2d974c['error'][_0x8aa8('0x12')]);}else{logger[_0x8aa8('0xc')](_0x8aa8('0x11'),_0x449d2d,_0x8aa8('0xd'));_0x27c08d(_0x2d974c[_0x8aa8('0x13')][_0x8aa8('0x12')]);}})[_0x8aa8('0x14')](function(_0xd59fb8){logger[_0x8aa8('0x10')]('ServicenowField,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file +var _0xa9e0=['http','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4740cb,_0x4d850a){var _0x305e38=function(_0x37b22a){while(--_0x37b22a){_0x4740cb['push'](_0x4740cb['shift']());}};_0x305e38(++_0x4d850a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 63a8c1a..b0d12f1 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x4bd83d,_0x13069f){var _0x18c9b2=function(_0x3dfe13){while(--_0x3dfe13){_0x4bd83d['push'](_0x4bd83d['shift']());}};_0x18c9b2(++_0x13069f);}(_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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5162d7,_0x57b07c){var _0x1c0f8d=function(_0x40c870){while(--_0x40c870){_0x5162d7['push'](_0x5162d7['shift']());}};_0x1c0f8d(++_0x57b07c);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 8e0108a..de5dbed 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(_0x2b5210,_0x244035){var _0x4f5d98=function(_0x5e9638){while(--_0x5e9638){_0x2b5210['push'](_0x2b5210['shift']());}};_0x4f5d98(++_0x244035);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x148233,_0x532603){var _0x186cd5=function(_0xe60e9e){while(--_0xe60e9e){_0x148233['push'](_0x148233['shift']());}};_0x186cd5(++_0x532603);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'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 8008278..a343a69 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 _0x2ac1=['parent_id','parent_name','direction','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','Calls','module_fields','includes','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','count','limit','set','save','update','then','sendStatus','error','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','findAll','rows','catch','includeAll','include','body','find','params','destroy','getConfigurations','findOne','SugarcrmConfiguration','pick','AccountId','Subjects','getSubjects','channel','getDescriptions','create','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','date_start','duration_minutes'];(function(_0x260771,_0x5148f){var _0x145d4d=function(_0x407707){while(--_0x407707){_0x260771['push'](_0x260771['shift']());}};_0x145d4d(++_0x5148f);}(_0x2ac1,0x93));var _0x12ac=function(_0x164b6e,_0x724efa){_0x164b6e=_0x164b6e-0x0;var _0xe24c78=_0x2ac1[_0x164b6e];return _0xe24c78;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x12ac('0x0'));var jsonpatch=require(_0x12ac('0x1'));var rp=require(_0x12ac('0x2'));var moment=require(_0x12ac('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x12ac('0x4'));var util=require('util');var path=require('path');var sox=require(_0x12ac('0x5'));var csv=require(_0x12ac('0x6'));var ejs=require(_0x12ac('0x7'));var fs=require('fs');var fs_extra=require(_0x12ac('0x8'));var _=require(_0x12ac('0x9'));var squel=require('squel');var crypto=require(_0x12ac('0xa'));var jsforce=require(_0x12ac('0xb'));var deskjs=require(_0x12ac('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x12ac('0xd'));var Redis=require(_0x12ac('0xe'));var authService=require(_0x12ac('0xf'));var qs=require(_0x12ac('0x10'));var as=require(_0x12ac('0x11'));var hardwareService=require(_0x12ac('0x12'));var logger=require('../../config/logger')(_0x12ac('0x13'));var utils=require('../../config/utils');var config=require(_0x12ac('0x14'));var licenseUtil=require(_0x12ac('0x15'));var db=require(_0x12ac('0x16'))['db'];var integrations=require(_0x12ac('0x17'));function respondWithStatusCode(_0x38ea10,_0x5c6ef3){_0x5c6ef3=_0x5c6ef3||0xcc;return function(_0x2c0538){if(_0x2c0538){return _0x38ea10['sendStatus'](_0x5c6ef3);}return _0x38ea10[_0x12ac('0x18')](_0x5c6ef3)[_0x12ac('0x19')]();};}function respondWithResult(_0x4f3267,_0x12801d){_0x12801d=_0x12801d||0xc8;return function(_0x7d639e){if(_0x7d639e){return _0x4f3267[_0x12ac('0x18')](_0x12801d)[_0x12ac('0x1a')](_0x7d639e);}};}function respondWithFilteredResult(_0x47001c,_0x51d18e){return function(_0x39daff){if(_0x39daff){var _0x21da46=typeof _0x51d18e[_0x12ac('0x1b')]===_0x12ac('0x1c')&&typeof _0x51d18e['limit']===_0x12ac('0x1c');var _0x1ae385=_0x39daff[_0x12ac('0x1d')];var _0x2f05c7=_0x21da46?0x0:_0x51d18e['offset'];var _0x4efcd9=_0x21da46?_0x39daff[_0x12ac('0x1d')]:_0x51d18e['offset']+_0x51d18e[_0x12ac('0x1e')];var _0x3e4eeb;if(_0x4efcd9>=_0x1ae385){_0x4efcd9=_0x1ae385;_0x3e4eeb=0xc8;}else{_0x3e4eeb=0xce;}_0x47001c[_0x12ac('0x18')](_0x3e4eeb);return _0x47001c[_0x12ac('0x1f')]('Content-Range',_0x2f05c7+'-'+_0x4efcd9+'/'+_0x1ae385)[_0x12ac('0x1a')](_0x39daff);}return null;};}function patchUpdates(_0x4eb445){return function(_0x3b0ce9){try{jsonpatch['apply'](_0x3b0ce9,_0x4eb445,!![]);}catch(_0x2961fc){return BPromise['reject'](_0x2961fc);}return _0x3b0ce9[_0x12ac('0x20')]();};}function saveUpdates(_0x7c3221,_0x2ac854){return function(_0x29c767){if(_0x29c767){return _0x29c767[_0x12ac('0x21')](_0x7c3221)[_0x12ac('0x22')](function(_0x1ca8fe){return _0x1ca8fe;});}return null;};}function removeEntity(_0x1f2ce3,_0x3846c0){return function(_0x38d287){if(_0x38d287){return _0x38d287['destroy']()[_0x12ac('0x22')](function(){_0x1f2ce3[_0x12ac('0x18')](0xcc)[_0x12ac('0x19')]();});}};}function handleEntityNotFound(_0x48e1a6,_0x17f4a0){return function(_0x167f9f){if(!_0x167f9f){_0x48e1a6[_0x12ac('0x23')](0x194);}return _0x167f9f;};}function handleError(_0x1defde,_0x6b4698){_0x6b4698=_0x6b4698||0x1f4;return function(_0x440b91){logger[_0x12ac('0x24')](_0x440b91[_0x12ac('0x25')]);if(_0x440b91[_0x12ac('0x26')]){delete _0x440b91[_0x12ac('0x26')];}_0x1defde[_0x12ac('0x18')](_0x6b4698)[_0x12ac('0x27')](_0x440b91);};}exports['index']=function(_0x361729,_0x1207ea){var _0x5b4cf1={},_0x52357f={},_0x3672b7={'count':0x0,'rows':[]};var _0x4720e3=_[_0x12ac('0x28')](db[_0x12ac('0x29')][_0x12ac('0x2a')],function(_0x4a9aca){return{'name':_0x4a9aca[_0x12ac('0x2b')],'type':_0x4a9aca[_0x12ac('0x2c')][_0x12ac('0x2d')]};});_0x52357f['model']=_[_0x12ac('0x28')](_0x4720e3,_0x12ac('0x26'));_0x52357f[_0x12ac('0x2e')]=_[_0x12ac('0x2f')](_0x361729['query']);_0x52357f['filters']=_[_0x12ac('0x30')](_0x52357f[_0x12ac('0x31')],_0x52357f[_0x12ac('0x2e')]);_0x5b4cf1[_0x12ac('0x32')]=_[_0x12ac('0x30')](_0x52357f[_0x12ac('0x31')],qs[_0x12ac('0x33')](_0x361729['query'][_0x12ac('0x33')]));_0x5b4cf1[_0x12ac('0x32')]=_0x5b4cf1[_0x12ac('0x32')][_0x12ac('0x34')]?_0x5b4cf1[_0x12ac('0x32')]:_0x52357f[_0x12ac('0x31')];if(!_0x361729[_0x12ac('0x2e')][_0x12ac('0x35')](_0x12ac('0x36'))){_0x5b4cf1['limit']=qs[_0x12ac('0x1e')](_0x361729[_0x12ac('0x2e')][_0x12ac('0x1e')]);_0x5b4cf1[_0x12ac('0x1b')]=qs['offset'](_0x361729[_0x12ac('0x2e')][_0x12ac('0x1b')]);}_0x5b4cf1[_0x12ac('0x37')]=qs['sort'](_0x361729[_0x12ac('0x2e')][_0x12ac('0x38')]);_0x5b4cf1[_0x12ac('0x39')]=qs[_0x12ac('0x3a')](_['pick'](_0x361729[_0x12ac('0x2e')],_0x52357f['filters']),_0x4720e3);if(_0x361729[_0x12ac('0x2e')][_0x12ac('0x3b')]){_0x5b4cf1[_0x12ac('0x39')]=_['merge'](_0x5b4cf1[_0x12ac('0x39')],{'$or':_[_0x12ac('0x28')](_0x4720e3,function(_0x50057d){if(_0x50057d[_0x12ac('0x2c')]!==_0x12ac('0x3c')){var _0x5dc376={};_0x5dc376[_0x50057d[_0x12ac('0x26')]]={'$like':'%'+_0x361729[_0x12ac('0x2e')][_0x12ac('0x3b')]+'%'};return _0x5dc376;}})});}_0x5b4cf1=_[_0x12ac('0x3d')]({},_0x5b4cf1,_0x361729[_0x12ac('0x3e')]);var _0x40a77f={'where':_0x5b4cf1['where']};return db[_0x12ac('0x29')][_0x12ac('0x1d')](_0x40a77f)[_0x12ac('0x22')](function(_0x21745d){_0x3672b7['count']=_0x21745d;if(_0x361729[_0x12ac('0x2e')]['includeAll']){_0x5b4cf1['include']=[{'all':!![]}];}return db[_0x12ac('0x29')][_0x12ac('0x3f')](_0x5b4cf1);})[_0x12ac('0x22')](function(_0x4c634b){_0x3672b7[_0x12ac('0x40')]=_0x4c634b;return _0x3672b7;})[_0x12ac('0x22')](respondWithFilteredResult(_0x1207ea,_0x5b4cf1))[_0x12ac('0x41')](handleError(_0x1207ea,null));};exports['show']=function(_0x4405b6,_0x4c9ef8){var _0xa8b257={'raw':![],'where':{'id':_0x4405b6['params']['id']}},_0x212bdc={};_0x212bdc[_0x12ac('0x31')]=_[_0x12ac('0x2f')](db[_0x12ac('0x29')][_0x12ac('0x2a')]);_0x212bdc[_0x12ac('0x2e')]=_[_0x12ac('0x2f')](_0x4405b6[_0x12ac('0x2e')]);_0x212bdc[_0x12ac('0x3a')]=_[_0x12ac('0x30')](_0x212bdc['model'],_0x212bdc[_0x12ac('0x2e')]);_0xa8b257[_0x12ac('0x32')]=_['intersection'](_0x212bdc[_0x12ac('0x31')],qs[_0x12ac('0x33')](_0x4405b6[_0x12ac('0x2e')][_0x12ac('0x33')]));_0xa8b257[_0x12ac('0x32')]=_0xa8b257[_0x12ac('0x32')][_0x12ac('0x34')]?_0xa8b257[_0x12ac('0x32')]:_0x212bdc[_0x12ac('0x31')];if(_0x4405b6[_0x12ac('0x2e')][_0x12ac('0x42')]){_0xa8b257[_0x12ac('0x43')]=[{'all':!![]}];}_0xa8b257=_[_0x12ac('0x3d')]({},_0xa8b257,_0x4405b6[_0x12ac('0x3e')]);return db[_0x12ac('0x29')]['find'](_0xa8b257)[_0x12ac('0x22')](handleEntityNotFound(_0x4c9ef8,null))[_0x12ac('0x22')](respondWithResult(_0x4c9ef8,null))[_0x12ac('0x41')](handleError(_0x4c9ef8,null));};exports['create']=function(_0xe99cfe,_0x18832a){return db[_0x12ac('0x29')]['create'](_0xe99cfe[_0x12ac('0x44')],{})[_0x12ac('0x22')](respondWithResult(_0x18832a,0xc9))[_0x12ac('0x41')](handleError(_0x18832a,null));};exports[_0x12ac('0x21')]=function(_0x4f7924,_0x3d53ef){if(_0x4f7924[_0x12ac('0x44')]['id']){delete _0x4f7924[_0x12ac('0x44')]['id'];}return db[_0x12ac('0x29')][_0x12ac('0x45')]({'where':{'id':_0x4f7924[_0x12ac('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d53ef,null))['then'](saveUpdates(_0x4f7924['body'],null))[_0x12ac('0x22')](respondWithResult(_0x3d53ef,null))[_0x12ac('0x41')](handleError(_0x3d53ef,null));};exports[_0x12ac('0x47')]=function(_0x27d34d,_0x4f058f){return db[_0x12ac('0x29')]['find']({'where':{'id':_0x27d34d['params']['id']}})[_0x12ac('0x22')](handleEntityNotFound(_0x4f058f,null))['then'](removeEntity(_0x4f058f,null))[_0x12ac('0x41')](handleError(_0x4f058f,null));};exports[_0x12ac('0x48')]=function(_0x52c804,_0x5bfac8,_0x1a849e){var _0x3e9545={};var _0x1d6562={};var _0x349017;var _0x5b4f1e;return db[_0x12ac('0x29')][_0x12ac('0x49')]({'where':{'id':_0x52c804['params']['id']}})[_0x12ac('0x22')](handleEntityNotFound(_0x5bfac8,null))[_0x12ac('0x22')](function(_0x56c383){if(_0x56c383){_0x349017=_0x56c383;_0x1d6562[_0x12ac('0x31')]=_['keys'](db[_0x12ac('0x4a')][_0x12ac('0x2a')]);_0x1d6562[_0x12ac('0x2e')]=_['keys'](_0x52c804[_0x12ac('0x2e')]);_0x1d6562[_0x12ac('0x3a')]=_[_0x12ac('0x30')](_0x1d6562[_0x12ac('0x31')],_0x1d6562[_0x12ac('0x2e')]);_0x3e9545[_0x12ac('0x32')]=_['intersection'](_0x1d6562['model'],qs['fields'](_0x52c804[_0x12ac('0x2e')][_0x12ac('0x33')]));_0x3e9545[_0x12ac('0x32')]=_0x3e9545[_0x12ac('0x32')][_0x12ac('0x34')]?_0x3e9545['attributes']:_0x1d6562['model'];_0x3e9545[_0x12ac('0x37')]=qs['sort'](_0x52c804[_0x12ac('0x2e')][_0x12ac('0x38')]);_0x3e9545[_0x12ac('0x39')]=qs[_0x12ac('0x3a')](_[_0x12ac('0x4b')](_0x52c804[_0x12ac('0x2e')],_0x1d6562[_0x12ac('0x3a')]));if(_0x52c804[_0x12ac('0x2e')]['filter']){_0x3e9545[_0x12ac('0x39')]=_[_0x12ac('0x3d')](_0x3e9545[_0x12ac('0x39')],{'$or':_[_0x12ac('0x28')](_0x3e9545[_0x12ac('0x32')],function(_0x5bf193){var _0x1ef8ab={};_0x1ef8ab[_0x5bf193]={'$like':'%'+_0x52c804[_0x12ac('0x2e')][_0x12ac('0x3b')]+'%'};return _0x1ef8ab;})});}_0x3e9545=_[_0x12ac('0x3d')]({},_0x3e9545,_0x52c804[_0x12ac('0x3e')]);return _0x349017[_0x12ac('0x48')](_0x3e9545);}})[_0x12ac('0x22')](function(_0x59975b){if(_0x59975b){_0x5b4f1e=_0x59975b[_0x12ac('0x34')];if(!_0x52c804[_0x12ac('0x2e')]['hasOwnProperty'](_0x12ac('0x36'))){_0x3e9545[_0x12ac('0x1e')]=qs['limit'](_0x52c804[_0x12ac('0x2e')][_0x12ac('0x1e')]);_0x3e9545[_0x12ac('0x1b')]=qs[_0x12ac('0x1b')](_0x52c804[_0x12ac('0x2e')][_0x12ac('0x1b')]);}return _0x349017[_0x12ac('0x48')](_0x3e9545);}})['then'](function(_0x5ccec6){if(_0x5ccec6){return _0x5ccec6?{'count':_0x5b4f1e,'rows':_0x5ccec6}:null;}})[_0x12ac('0x22')](respondWithResult(_0x5bfac8,null))['catch'](handleError(_0x5bfac8,null));};exports['addConfiguration']=function(_0x5ceff8,_0xc4f45c,_0x5ea099){if(_0x5ceff8[_0x12ac('0x44')]['id']){delete _0x5ceff8['body']['id'];}return db[_0x12ac('0x29')][_0x12ac('0x49')]({'where':{'id':_0x5ceff8[_0x12ac('0x46')]['id']}})[_0x12ac('0x22')](handleEntityNotFound(_0xc4f45c,null))[_0x12ac('0x22')](function(_0x1e4b97){if(_0x1e4b97){_0x5ceff8[_0x12ac('0x44')][_0x12ac('0x4c')]=_0x1e4b97['id'];_0x5ceff8[_0x12ac('0x44')][_0x12ac('0x4d')]=integrations[_0x12ac('0x4e')](_0x5ceff8[_0x12ac('0x44')][_0x12ac('0x4f')],_0x5ceff8[_0x12ac('0x44')]['type']);_0x5ceff8[_0x12ac('0x44')]['Descriptions']=integrations[_0x12ac('0x50')](_0x5ceff8[_0x12ac('0x44')][_0x12ac('0x4f')],_0x5ceff8[_0x12ac('0x44')][_0x12ac('0x2c')]);return db[_0x12ac('0x4a')][_0x12ac('0x51')](_0x5ceff8[_0x12ac('0x44')],{'include':[{'model':db[_0x12ac('0x52')],'as':_0x12ac('0x4d')},{'model':db[_0x12ac('0x52')],'as':_0x12ac('0x53')}]});}return null;})['then'](respondWithResult(_0xc4f45c,null))[_0x12ac('0x41')](handleError(_0xc4f45c,null));};exports[_0x12ac('0x54')]=function(_0xf59cc1,_0x312aa9,_0x10cdb0){var _0x22c3f6='';var _0x118651=['id',_0x12ac('0x26'),_0x12ac('0x55'),_0x12ac('0x56'),'description',_0x12ac('0x57'),'duration_hours',_0x12ac('0x58'),_0x12ac('0x59'),'parent_type',_0x12ac('0x5a'),_0x12ac('0x5b')];return db[_0x12ac('0x29')][_0x12ac('0x49')]({'where':{'id':_0xf59cc1[_0x12ac('0x46')]['id']},'attributes':['id','username','password',_0x12ac('0x5c')]})['then'](handleEntityNotFound(_0x312aa9,null))[_0x12ac('0x22')](function(_0x56262c){if(_0x56262c){_0x22c3f6=_0x56262c[_0x12ac('0x5c')];var _0x4493c1=_0x22c3f6[_0x12ac('0x5d')](-0x1);if(_0x4493c1==='/'){_0x22c3f6=_0x22c3f6[_0x12ac('0x5e')](0x0,_0x22c3f6[_0x12ac('0x5f')](_0x4493c1));}return rp({'method':_0x12ac('0x60'),'uri':util[_0x12ac('0x61')](_0x12ac('0x62'),_0x22c3f6,_0x12ac('0x63')),'json':!![],'form':{'method':_0x12ac('0x64'),'input_type':_0x12ac('0x65'),'response_type':_0x12ac('0x65'),'rest_data':JSON[_0x12ac('0x66')]({'user_auth':{'user_name':_0x56262c[_0x12ac('0x67')],'password':_0x56262c[_0x12ac('0x68')],'encryption':'PLAIN'},'application':_0x12ac('0x69')})}});}})['then'](function(_0x5b7390){if(_0x5b7390&&_0x5b7390[_0x12ac('0x26')]!==_0x12ac('0x6a')&&_0x5b7390[_0x12ac('0x26')]!==_0x12ac('0x6b')){return rp({'method':_0x12ac('0x60'),'uri':util[_0x12ac('0x61')](_0x12ac('0x62'),_0x22c3f6,_0x12ac('0x63')),'json':!![],'form':{'method':_0x12ac('0x6c'),'input_type':_0x12ac('0x65'),'response_type':'JSON','rest_data':JSON[_0x12ac('0x66')]({'session':_0x5b7390['id'],'module_name':_0x12ac('0x6d')})}})[_0x12ac('0x22')](function(_0x1dc2b0){if(_0x1dc2b0){var _0x1da9e0=_['values'](_0x1dc2b0[_0x12ac('0x6e')]);_['remove'](_0x1da9e0,function(_0x5ec733){return _0x118651[_0x12ac('0x6f')](_0x5ec733[_0x12ac('0x26')]);});return{'count':_0x1da9e0[_0x12ac('0x34')],'rows':_['map'](_0x1da9e0,function(_0x3e264e){return{'id':_0x3e264e[_0x12ac('0x26')],'name':_0x3e264e['label'],'custom':_['endsWith'](_0x3e264e['name'],'_c')?!![]:![],'options':_0x3e264e[_0x12ac('0x3e')]?_['map'](_[_0x12ac('0x70')](_0x3e264e['options']),function(_0x50fce2){return{'name':_0x50fce2[_0x12ac('0x71')],'value':_0x50fce2['name']};}):[]};})};}})['then'](respondWithResult(_0x312aa9,null))[_0x12ac('0x41')](function(_0xb19a37){var _0x1f0e41=_0xf59cc1[_0x12ac('0x2e')]['test']?0x1f4:_0xb19a37[_0x12ac('0x72')]||0x1f4;logger['error'](_0x12ac('0x73'),'getFields',_0x1f0e41,JSON['stringify'](_0xb19a37));delete _0xb19a37['name'];if(_0x1f0e41===0x191){_0x1f0e41=0x190;}_0x312aa9['status'](_0x1f0e41)[_0x12ac('0x27')](_0xf59cc1[_0x12ac('0x2e')][_0x12ac('0x74')]?{'message':_0x12ac('0x75'),'statusCode':_0xb19a37['statusCode']}:_0xb19a37);});}else{var _0x5886c4=0x1f4;_0x312aa9['status'](_0x5886c4)['send']({'message':_0x12ac('0x75'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xbae0=['includes','label','values','test','getFields,\x20%s,\x20%s,\x20%s','statusCode','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','findOne','SugarcrmConfiguration','order','getConfigurations','AccountId','Subjects','channel','Descriptions','getDescriptions','SugarcrmField','getFields','created_by','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','module_fields','remove'];(function(_0x251969,_0x4a4547){var _0x59268a=function(_0x186f3a){while(--_0x186f3a){_0x251969['push'](_0x251969['shift']());}};_0x59268a(++_0x4a4547);}(_0xbae0,0x16f));var _0x0bae=function(_0x1e175d,_0x41ff45){_0x1e175d=_0x1e175d-0x0;var _0x3a3ce5=_0xbae0[_0x1e175d];return _0x3a3ce5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bae('0x0'));var zipdir=require(_0x0bae('0x1'));var jsonpatch=require(_0x0bae('0x2'));var rp=require(_0x0bae('0x3'));var moment=require(_0x0bae('0x4'));var BPromise=require(_0x0bae('0x5'));var Mustache=require(_0x0bae('0x6'));var util=require(_0x0bae('0x7'));var path=require('path');var sox=require(_0x0bae('0x8'));var csv=require(_0x0bae('0x9'));var ejs=require(_0x0bae('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bae('0xb'));var squel=require(_0x0bae('0xc'));var crypto=require(_0x0bae('0xd'));var jsforce=require(_0x0bae('0xe'));var deskjs=require(_0x0bae('0xf'));var toCsv=require(_0x0bae('0x9'));var querystring=require(_0x0bae('0x10'));var Papa=require('papaparse');var Redis=require(_0x0bae('0x11'));var authService=require(_0x0bae('0x12'));var qs=require(_0x0bae('0x13'));var as=require(_0x0bae('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0bae('0x15'))(_0x0bae('0x16'));var utils=require('../../config/utils');var config=require(_0x0bae('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0bae('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x49c2a6,_0x3bf46f){_0x3bf46f=_0x3bf46f||0xcc;return function(_0x5b124d){if(_0x5b124d){return _0x49c2a6['sendStatus'](_0x3bf46f);}return _0x49c2a6[_0x0bae('0x19')](_0x3bf46f)[_0x0bae('0x1a')]();};}function respondWithResult(_0x5597f3,_0x247f95){_0x247f95=_0x247f95||0xc8;return function(_0x3bd8fc){if(_0x3bd8fc){return _0x5597f3[_0x0bae('0x19')](_0x247f95)[_0x0bae('0x1b')](_0x3bd8fc);}};}function respondWithFilteredResult(_0x40e7a9,_0xd2715a){return function(_0x22039e){if(_0x22039e){var _0x4695b2=typeof _0xd2715a[_0x0bae('0x1c')]===_0x0bae('0x1d')&&typeof _0xd2715a[_0x0bae('0x1e')]===_0x0bae('0x1d');var _0x5806b2=_0x22039e[_0x0bae('0x1f')];var _0x2001d0=_0x4695b2?0x0:_0xd2715a['offset'];var _0x33e5d0=_0x4695b2?_0x22039e[_0x0bae('0x1f')]:_0xd2715a[_0x0bae('0x1c')]+_0xd2715a[_0x0bae('0x1e')];var _0x13bade;if(_0x33e5d0>=_0x5806b2){_0x33e5d0=_0x5806b2;_0x13bade=0xc8;}else{_0x13bade=0xce;}_0x40e7a9['status'](_0x13bade);return _0x40e7a9[_0x0bae('0x20')](_0x0bae('0x21'),_0x2001d0+'-'+_0x33e5d0+'/'+_0x5806b2)[_0x0bae('0x1b')](_0x22039e);}return null;};}function patchUpdates(_0x5976ff){return function(_0x32caa5){try{jsonpatch[_0x0bae('0x22')](_0x32caa5,_0x5976ff,!![]);}catch(_0x2df36d){return BPromise[_0x0bae('0x23')](_0x2df36d);}return _0x32caa5[_0x0bae('0x24')]();};}function saveUpdates(_0x189077,_0x573af6){return function(_0x96b72a){if(_0x96b72a){return _0x96b72a['update'](_0x189077)[_0x0bae('0x25')](function(_0x4ed2b6){return _0x4ed2b6;});}return null;};}function removeEntity(_0x4b15a5,_0x10ee0d){return function(_0x4111f7){if(_0x4111f7){return _0x4111f7[_0x0bae('0x26')]()[_0x0bae('0x25')](function(){_0x4b15a5[_0x0bae('0x19')](0xcc)[_0x0bae('0x1a')]();});}};}function handleEntityNotFound(_0x27ef77,_0x4ccb86){return function(_0x3b4954){if(!_0x3b4954){_0x27ef77[_0x0bae('0x27')](0x194);}return _0x3b4954;};}function handleError(_0x527969,_0x279c24){_0x279c24=_0x279c24||0x1f4;return function(_0x18509a){logger['error'](_0x18509a[_0x0bae('0x28')]);if(_0x18509a[_0x0bae('0x29')]){delete _0x18509a[_0x0bae('0x29')];}_0x527969[_0x0bae('0x19')](_0x279c24)[_0x0bae('0x2a')](_0x18509a);};}exports[_0x0bae('0x2b')]=function(_0x3a14f1,_0xa8e50b){var _0x1c936f={},_0x303dec={},_0x40cb9c={'count':0x0,'rows':[]};var _0x49547d=_[_0x0bae('0x2c')](db[_0x0bae('0x2d')][_0x0bae('0x2e')],function(_0x8b9ffb){return{'name':_0x8b9ffb[_0x0bae('0x2f')],'type':_0x8b9ffb[_0x0bae('0x30')]['key']};});_0x303dec[_0x0bae('0x31')]=_['map'](_0x49547d,_0x0bae('0x29'));_0x303dec['query']=_[_0x0bae('0x32')](_0x3a14f1[_0x0bae('0x33')]);_0x303dec[_0x0bae('0x34')]=_[_0x0bae('0x35')](_0x303dec['model'],_0x303dec[_0x0bae('0x33')]);_0x1c936f[_0x0bae('0x36')]=_[_0x0bae('0x35')](_0x303dec['model'],qs[_0x0bae('0x37')](_0x3a14f1['query'][_0x0bae('0x37')]));_0x1c936f[_0x0bae('0x36')]=_0x1c936f[_0x0bae('0x36')][_0x0bae('0x38')]?_0x1c936f[_0x0bae('0x36')]:_0x303dec['model'];if(!_0x3a14f1['query'][_0x0bae('0x39')]('nolimit')){_0x1c936f[_0x0bae('0x1e')]=qs[_0x0bae('0x1e')](_0x3a14f1['query'][_0x0bae('0x1e')]);_0x1c936f[_0x0bae('0x1c')]=qs['offset'](_0x3a14f1[_0x0bae('0x33')][_0x0bae('0x1c')]);}_0x1c936f['order']=qs[_0x0bae('0x3a')](_0x3a14f1[_0x0bae('0x33')][_0x0bae('0x3a')]);_0x1c936f['where']=qs[_0x0bae('0x34')](_[_0x0bae('0x3b')](_0x3a14f1['query'],_0x303dec[_0x0bae('0x34')]),_0x49547d);if(_0x3a14f1[_0x0bae('0x33')][_0x0bae('0x3c')]){_0x1c936f[_0x0bae('0x3d')]=_['merge'](_0x1c936f[_0x0bae('0x3d')],{'$or':_[_0x0bae('0x2c')](_0x49547d,function(_0x55441c){if(_0x55441c[_0x0bae('0x30')]!==_0x0bae('0x3e')){var _0x191f87={};_0x191f87[_0x55441c[_0x0bae('0x29')]]={'$like':'%'+_0x3a14f1['query']['filter']+'%'};return _0x191f87;}})});}_0x1c936f=_[_0x0bae('0x3f')]({},_0x1c936f,_0x3a14f1[_0x0bae('0x40')]);var _0xc702e2={'where':_0x1c936f[_0x0bae('0x3d')]};return db[_0x0bae('0x2d')][_0x0bae('0x1f')](_0xc702e2)[_0x0bae('0x25')](function(_0x505ae1){_0x40cb9c[_0x0bae('0x1f')]=_0x505ae1;if(_0x3a14f1[_0x0bae('0x33')][_0x0bae('0x41')]){_0x1c936f[_0x0bae('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x0bae('0x43')](_0x1c936f);})['then'](function(_0x45ec93){_0x40cb9c[_0x0bae('0x44')]=_0x45ec93;return _0x40cb9c;})[_0x0bae('0x25')](respondWithFilteredResult(_0xa8e50b,_0x1c936f))['catch'](handleError(_0xa8e50b,null));};exports[_0x0bae('0x45')]=function(_0x180bdd,_0xf4b70f){var _0x1d52f9={'raw':![],'where':{'id':_0x180bdd[_0x0bae('0x46')]['id']}},_0x1a9920={};_0x1a9920[_0x0bae('0x31')]=_[_0x0bae('0x32')](db[_0x0bae('0x2d')][_0x0bae('0x2e')]);_0x1a9920[_0x0bae('0x33')]=_[_0x0bae('0x32')](_0x180bdd['query']);_0x1a9920['filters']=_[_0x0bae('0x35')](_0x1a9920[_0x0bae('0x31')],_0x1a9920[_0x0bae('0x33')]);_0x1d52f9['attributes']=_[_0x0bae('0x35')](_0x1a9920['model'],qs[_0x0bae('0x37')](_0x180bdd[_0x0bae('0x33')][_0x0bae('0x37')]));_0x1d52f9[_0x0bae('0x36')]=_0x1d52f9['attributes'][_0x0bae('0x38')]?_0x1d52f9['attributes']:_0x1a9920[_0x0bae('0x31')];if(_0x180bdd[_0x0bae('0x33')]['includeAll']){_0x1d52f9['include']=[{'all':!![]}];}_0x1d52f9=_['merge']({},_0x1d52f9,_0x180bdd[_0x0bae('0x40')]);return db[_0x0bae('0x2d')][_0x0bae('0x47')](_0x1d52f9)[_0x0bae('0x25')](handleEntityNotFound(_0xf4b70f,null))['then'](respondWithResult(_0xf4b70f,null))[_0x0bae('0x48')](handleError(_0xf4b70f,null));};exports[_0x0bae('0x49')]=function(_0x50c1c8,_0x17eb11){return db[_0x0bae('0x2d')]['create'](_0x50c1c8[_0x0bae('0x4a')],{})[_0x0bae('0x25')](respondWithResult(_0x17eb11,0xc9))[_0x0bae('0x48')](handleError(_0x17eb11,null));};exports[_0x0bae('0x4b')]=function(_0x1fca66,_0x38ac44){if(_0x1fca66[_0x0bae('0x4a')]['id']){delete _0x1fca66[_0x0bae('0x4a')]['id'];}return db[_0x0bae('0x2d')][_0x0bae('0x47')]({'where':{'id':_0x1fca66[_0x0bae('0x46')]['id']}})[_0x0bae('0x25')](handleEntityNotFound(_0x38ac44,null))['then'](saveUpdates(_0x1fca66[_0x0bae('0x4a')],null))['then'](respondWithResult(_0x38ac44,null))[_0x0bae('0x48')](handleError(_0x38ac44,null));};exports[_0x0bae('0x26')]=function(_0xd490ae,_0x2eaa82){return db[_0x0bae('0x2d')][_0x0bae('0x47')]({'where':{'id':_0xd490ae[_0x0bae('0x46')]['id']}})['then'](handleEntityNotFound(_0x2eaa82,null))['then'](removeEntity(_0x2eaa82,null))[_0x0bae('0x48')](handleError(_0x2eaa82,null));};exports['getConfigurations']=function(_0x940e46,_0x4e342d,_0x30afb1){var _0x5a63e9={};var _0x1c4b8d={};var _0x22ba19;var _0x492130;return db[_0x0bae('0x2d')][_0x0bae('0x4c')]({'where':{'id':_0x940e46['params']['id']}})['then'](handleEntityNotFound(_0x4e342d,null))[_0x0bae('0x25')](function(_0x3e2bd2){if(_0x3e2bd2){_0x22ba19=_0x3e2bd2;_0x1c4b8d['model']=_[_0x0bae('0x32')](db[_0x0bae('0x4d')][_0x0bae('0x2e')]);_0x1c4b8d['query']=_['keys'](_0x940e46[_0x0bae('0x33')]);_0x1c4b8d[_0x0bae('0x34')]=_[_0x0bae('0x35')](_0x1c4b8d['model'],_0x1c4b8d[_0x0bae('0x33')]);_0x5a63e9[_0x0bae('0x36')]=_[_0x0bae('0x35')](_0x1c4b8d[_0x0bae('0x31')],qs[_0x0bae('0x37')](_0x940e46['query']['fields']));_0x5a63e9[_0x0bae('0x36')]=_0x5a63e9[_0x0bae('0x36')][_0x0bae('0x38')]?_0x5a63e9['attributes']:_0x1c4b8d['model'];_0x5a63e9[_0x0bae('0x4e')]=qs[_0x0bae('0x3a')](_0x940e46['query'][_0x0bae('0x3a')]);_0x5a63e9[_0x0bae('0x3d')]=qs[_0x0bae('0x34')](_['pick'](_0x940e46[_0x0bae('0x33')],_0x1c4b8d['filters']));if(_0x940e46[_0x0bae('0x33')][_0x0bae('0x3c')]){_0x5a63e9[_0x0bae('0x3d')]=_[_0x0bae('0x3f')](_0x5a63e9[_0x0bae('0x3d')],{'$or':_[_0x0bae('0x2c')](_0x5a63e9[_0x0bae('0x36')],function(_0x278666){var _0xcbe45f={};_0xcbe45f[_0x278666]={'$like':'%'+_0x940e46[_0x0bae('0x33')][_0x0bae('0x3c')]+'%'};return _0xcbe45f;})});}_0x5a63e9=_[_0x0bae('0x3f')]({},_0x5a63e9,_0x940e46[_0x0bae('0x40')]);return _0x22ba19[_0x0bae('0x4f')](_0x5a63e9);}})[_0x0bae('0x25')](function(_0x41bf6a){if(_0x41bf6a){_0x492130=_0x41bf6a['length'];if(!_0x940e46[_0x0bae('0x33')][_0x0bae('0x39')]('nolimit')){_0x5a63e9[_0x0bae('0x1e')]=qs[_0x0bae('0x1e')](_0x940e46[_0x0bae('0x33')][_0x0bae('0x1e')]);_0x5a63e9[_0x0bae('0x1c')]=qs[_0x0bae('0x1c')](_0x940e46[_0x0bae('0x33')][_0x0bae('0x1c')]);}return _0x22ba19[_0x0bae('0x4f')](_0x5a63e9);}})[_0x0bae('0x25')](function(_0x5b54b8){if(_0x5b54b8){return _0x5b54b8?{'count':_0x492130,'rows':_0x5b54b8}:null;}})['then'](respondWithResult(_0x4e342d,null))[_0x0bae('0x48')](handleError(_0x4e342d,null));};exports['addConfiguration']=function(_0x306046,_0x16c7bf,_0x4c2feb){if(_0x306046[_0x0bae('0x4a')]['id']){delete _0x306046['body']['id'];}return db['SugarcrmAccount'][_0x0bae('0x4c')]({'where':{'id':_0x306046['params']['id']}})[_0x0bae('0x25')](handleEntityNotFound(_0x16c7bf,null))[_0x0bae('0x25')](function(_0x3809e7){if(_0x3809e7){_0x306046[_0x0bae('0x4a')][_0x0bae('0x50')]=_0x3809e7['id'];_0x306046[_0x0bae('0x4a')][_0x0bae('0x51')]=integrations['getSubjects'](_0x306046[_0x0bae('0x4a')][_0x0bae('0x52')],_0x306046[_0x0bae('0x4a')][_0x0bae('0x30')]);_0x306046['body'][_0x0bae('0x53')]=integrations[_0x0bae('0x54')](_0x306046['body'][_0x0bae('0x52')],_0x306046[_0x0bae('0x4a')][_0x0bae('0x30')]);return db[_0x0bae('0x4d')][_0x0bae('0x49')](_0x306046['body'],{'include':[{'model':db[_0x0bae('0x55')],'as':_0x0bae('0x51')},{'model':db[_0x0bae('0x55')],'as':_0x0bae('0x53')}]});}return null;})[_0x0bae('0x25')](respondWithResult(_0x16c7bf,null))[_0x0bae('0x48')](handleError(_0x16c7bf,null));};exports[_0x0bae('0x56')]=function(_0x5dce6d,_0x12c035,_0x4611f2){var _0x34a9d2='';var _0x5c103b=['id','name','assigned_user_id',_0x0bae('0x57'),'description','date_start',_0x0bae('0x58'),_0x0bae('0x59'),_0x0bae('0x5a'),_0x0bae('0x5b'),'parent_name',_0x0bae('0x5c')];return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5dce6d['params']['id']},'attributes':['id',_0x0bae('0x5d'),'password',_0x0bae('0x5e')]})[_0x0bae('0x25')](handleEntityNotFound(_0x12c035,null))[_0x0bae('0x25')](function(_0x262bc5){if(_0x262bc5){_0x34a9d2=_0x262bc5[_0x0bae('0x5e')];var _0x2da70b=_0x34a9d2[_0x0bae('0x5f')](-0x1);if(_0x2da70b==='/'){_0x34a9d2=_0x34a9d2[_0x0bae('0x60')](0x0,_0x34a9d2[_0x0bae('0x61')](_0x2da70b));}return rp({'method':_0x0bae('0x62'),'uri':util[_0x0bae('0x63')](_0x0bae('0x64'),_0x34a9d2,_0x0bae('0x65')),'json':!![],'form':{'method':_0x0bae('0x66'),'input_type':_0x0bae('0x67'),'response_type':'JSON','rest_data':JSON[_0x0bae('0x68')]({'user_auth':{'user_name':_0x262bc5[_0x0bae('0x5d')],'password':_0x262bc5[_0x0bae('0x69')],'encryption':_0x0bae('0x6a')},'application':_0x0bae('0x6b')})}});}})[_0x0bae('0x25')](function(_0x50c5c0){if(_0x50c5c0&&_0x50c5c0[_0x0bae('0x29')]!==_0x0bae('0x6c')&&_0x50c5c0['name']!==_0x0bae('0x6d')){return rp({'method':_0x0bae('0x62'),'uri':util[_0x0bae('0x63')](_0x0bae('0x64'),_0x34a9d2,_0x0bae('0x65')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0bae('0x67'),'response_type':_0x0bae('0x67'),'rest_data':JSON['stringify']({'session':_0x50c5c0['id'],'module_name':_0x0bae('0x6e')})}})['then'](function(_0x65f3d5){if(_0x65f3d5){var _0x505e97=_['values'](_0x65f3d5[_0x0bae('0x6f')]);_[_0x0bae('0x70')](_0x505e97,function(_0x11f8a5){return _0x5c103b[_0x0bae('0x71')](_0x11f8a5['name']);});return{'count':_0x505e97[_0x0bae('0x38')],'rows':_[_0x0bae('0x2c')](_0x505e97,function(_0x2a93c3){return{'id':_0x2a93c3[_0x0bae('0x29')],'name':_0x2a93c3[_0x0bae('0x72')],'custom':_['endsWith'](_0x2a93c3[_0x0bae('0x29')],'_c')?!![]:![],'options':_0x2a93c3[_0x0bae('0x40')]?_[_0x0bae('0x2c')](_[_0x0bae('0x73')](_0x2a93c3[_0x0bae('0x40')]),function(_0x33f06b){return{'name':_0x33f06b['value'],'value':_0x33f06b['name']};}):[]};})};}})[_0x0bae('0x25')](respondWithResult(_0x12c035,null))['catch'](function(_0x2a1773){var _0x104705=_0x5dce6d[_0x0bae('0x33')][_0x0bae('0x74')]?0x1f4:_0x2a1773['statusCode']||0x1f4;logger['error'](_0x0bae('0x75'),_0x0bae('0x56'),_0x104705,JSON[_0x0bae('0x68')](_0x2a1773));delete _0x2a1773[_0x0bae('0x29')];if(_0x104705===0x191){_0x104705=0x190;}_0x12c035[_0x0bae('0x19')](_0x104705)[_0x0bae('0x2a')](_0x5dce6d[_0x0bae('0x33')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2a1773[_0x0bae('0x76')]}:_0x2a1773);});}else{var _0x438bdb=0x1f4;_0x12c035['status'](_0x438bdb)[_0x0bae('0x2a')]({'message':_0x0bae('0x77'),'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 8149465..b4ae753 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 _0x28a6=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','SugarcrmAccount'];(function(_0x33418d,_0x2aaedc){var _0x363ce2=function(_0x1b7ecd){while(--_0x1b7ecd){_0x33418d['push'](_0x33418d['shift']());}};_0x363ce2(++_0x2aaedc);}(_0x28a6,0x8f));var _0x628a=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0x28a6[_0x1d70db];return _0x3060c6;};'use strict';var _=require(_0x628a('0x0'));var util=require(_0x628a('0x1'));var logger=require(_0x628a('0x2'))(_0x628a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x628a('0x4'));var fs=require('fs');var path=require(_0x628a('0x5'));var rimraf=require(_0x628a('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x628a('0x7'));module[_0x628a('0x8')]=function(_0x31b69f,_0x1f4e2d){return _0x31b69f[_0x628a('0x9')](_0x628a('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3b7=['request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','api','moment','bluebird'];(function(_0x4a41b3,_0x218e8e){var _0xa2acde=function(_0x5ec669){while(--_0x5ec669){_0x4a41b3['push'](_0x4a41b3['shift']());}};_0xa2acde(++_0x218e8e);}(_0xf3b7,0x119));var _0x7f3b=function(_0x28c672,_0x10ecdb){_0x28c672=_0x28c672-0x0;var _0xe2b59c=_0xf3b7[_0x28c672];return _0xe2b59c;};'use strict';var _=require(_0x7f3b('0x0'));var util=require(_0x7f3b('0x1'));var logger=require('../../config/logger')(_0x7f3b('0x2'));var moment=require(_0x7f3b('0x3'));var BPromise=require(_0x7f3b('0x4'));var rp=require(_0x7f3b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f3b('0x6'));var config=require(_0x7f3b('0x7'));var attributes=require(_0x7f3b('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x7f3b('0x9')]=function(_0x2f4fc5,_0x382627){return _0x2f4fc5[_0x7f3b('0xa')](_0x7f3b('0xb'),attributes,{'tableName':_0x7f3b('0xc'),'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 ec2a639..409e5af 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 _0x2632=['../../config/environment','jayson/promise','client','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','options','raw','where','attributes','limit','include','map','model','then','find','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x2ae15f,_0x3e1860){var _0x42a3d3=function(_0xcd0e60){while(--_0xcd0e60){_0x2ae15f['push'](_0x2ae15f['shift']());}};_0x42a3d3(++_0x3e1860);}(_0x2632,0x1a8));var _0x2263=function(_0x5b0893,_0x39fb8b){_0x5b0893=_0x5b0893-0x0;var _0xc6cd32=_0x2632[_0x5b0893];return _0xc6cd32;};'use strict';var _=require('lodash');var util=require(_0x2263('0x0'));var moment=require(_0x2263('0x1'));var BPromise=require(_0x2263('0x2'));var rs=require(_0x2263('0x3'));var fs=require('fs');var Redis=require(_0x2263('0x4'));var db=require(_0x2263('0x5'))['db'];var utils=require(_0x2263('0x6'));var logger=require('../../config/logger')(_0x2263('0x7'));var config=require(_0x2263('0x8'));var jayson=require(_0x2263('0x9'));var client=jayson[_0x2263('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4064cb,_0xbdc2d,_0x328d26){return new BPromise(function(_0x5b0c45,_0x53ca10){return client['request'](_0x4064cb,_0x328d26)['then'](function(_0x330c33){logger[_0x2263('0xb')](_0x2263('0xc'),_0xbdc2d,_0x2263('0xd'));logger[_0x2263('0xe')](_0x2263('0xf'),_0xbdc2d,_0x2263('0xd'),JSON[_0x2263('0x10')](_0x330c33));if(_0x330c33[_0x2263('0x11')]){if(_0x330c33[_0x2263('0x11')][_0x2263('0x12')]===0x1f4){logger[_0x2263('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0xbdc2d,_0x330c33['error'][_0x2263('0x13')]);return _0x53ca10(_0x330c33[_0x2263('0x11')][_0x2263('0x13')]);}logger[_0x2263('0x11')](_0x2263('0xc'),_0xbdc2d,_0x330c33[_0x2263('0x11')][_0x2263('0x13')]);return _0x5b0c45(_0x330c33[_0x2263('0x11')][_0x2263('0x13')]);}else{logger[_0x2263('0xb')](_0x2263('0xc'),_0xbdc2d,_0x2263('0xd'));_0x5b0c45(_0x330c33[_0x2263('0x14')][_0x2263('0x13')]);}})[_0x2263('0x15')](function(_0xe7b414){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xbdc2d,_0xe7b414);_0x53ca10(_0xe7b414);});});}exports[_0x2263('0x16')]=function(_0x12b5aa){var _0x1c1b6e=this;return new Promise(function(_0x4751c5,_0x4d3449){return db[_0x2263('0x17')][_0x2263('0x18')]({'raw':_0x12b5aa[_0x2263('0x19')]?_0x12b5aa[_0x2263('0x19')][_0x2263('0x1a')]===undefined?!![]:![]:!![],'where':_0x12b5aa[_0x2263('0x19')]?_0x12b5aa[_0x2263('0x19')][_0x2263('0x1b')]||null:null,'attributes':_0x12b5aa['options']?_0x12b5aa[_0x2263('0x19')][_0x2263('0x1c')]||null:null,'limit':_0x12b5aa[_0x2263('0x19')]?_0x12b5aa[_0x2263('0x19')][_0x2263('0x1d')]||null:null,'include':_0x12b5aa[_0x2263('0x19')]?_0x12b5aa[_0x2263('0x19')][_0x2263('0x1e')]?_['map'](_0x12b5aa[_0x2263('0x19')][_0x2263('0x1e')],function(_0x3d6d1d){return{'model':db[_0x3d6d1d['model']],'as':_0x3d6d1d['as'],'attributes':_0x3d6d1d['attributes'],'include':_0x3d6d1d[_0x2263('0x1e')]?_[_0x2263('0x1f')](_0x3d6d1d[_0x2263('0x1e')],function(_0x5b9300){return{'model':db[_0x5b9300[_0x2263('0x20')]],'as':_0x5b9300['as'],'attributes':_0x5b9300[_0x2263('0x1c')],'include':_0x5b9300[_0x2263('0x1e')]?_[_0x2263('0x1f')](_0x5b9300[_0x2263('0x1e')],function(_0x4f4e1b){return{'model':db[_0x4f4e1b[_0x2263('0x20')]],'as':_0x4f4e1b['as'],'attributes':_0x4f4e1b[_0x2263('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2263('0x21')](function(_0x520815){logger[_0x2263('0xb')](_0x2263('0x16'),_0x12b5aa);logger[_0x2263('0xe')]('GetSugarcrmAccount',_0x12b5aa,JSON[_0x2263('0x10')](_0x520815));_0x4751c5(_0x520815);})[_0x2263('0x15')](function(_0xbca9bc){logger[_0x2263('0x11')](_0x2263('0x16'),_0xbca9bc[_0x2263('0x13')],_0x12b5aa);_0x4d3449(_0x1c1b6e[_0x2263('0x11')](0x1f4,_0xbca9bc['message']));});});};exports['ShowSugarcrmAccount']=function(_0x4efa17){var _0x2beff4=this;return new Promise(function(_0x154edc,_0x7db60c){return db[_0x2263('0x17')][_0x2263('0x22')]({'raw':_0x4efa17['options']?_0x4efa17[_0x2263('0x19')][_0x2263('0x1a')]===undefined?!![]:![]:!![],'where':_0x4efa17['options']?_0x4efa17[_0x2263('0x19')][_0x2263('0x1b')]||null:null,'attributes':_0x4efa17[_0x2263('0x19')]?_0x4efa17[_0x2263('0x19')][_0x2263('0x1c')]||null:null,'include':_0x4efa17[_0x2263('0x19')]?_0x4efa17[_0x2263('0x19')][_0x2263('0x1e')]?_[_0x2263('0x1f')](_0x4efa17['options']['include'],function(_0x4d2732){return{'model':db[_0x4d2732['model']],'as':_0x4d2732['as'],'attributes':_0x4d2732[_0x2263('0x1c')],'include':_0x4d2732[_0x2263('0x1e')]?_['map'](_0x4d2732[_0x2263('0x1e')],function(_0x57b4c8){return{'model':db[_0x57b4c8[_0x2263('0x20')]],'as':_0x57b4c8['as'],'attributes':_0x57b4c8['attributes'],'include':_0x57b4c8['include']?_[_0x2263('0x1f')](_0x57b4c8[_0x2263('0x1e')],function(_0x52065c){return{'model':db[_0x52065c[_0x2263('0x20')]],'as':_0x52065c['as'],'attributes':_0x52065c[_0x2263('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2263('0x21')](function(_0x1ca75f){logger['info'](_0x2263('0x23'),_0x4efa17);logger[_0x2263('0xe')](_0x2263('0x23'),_0x4efa17,JSON[_0x2263('0x10')](_0x1ca75f));_0x154edc(_0x1ca75f);})[_0x2263('0x15')](function(_0x1c6bd9){logger[_0x2263('0x11')]('ShowSugarcrmAccount',_0x1c6bd9[_0x2263('0x13')],_0x4efa17);_0x7db60c(_0x2beff4['error'](0x1f4,_0x1c6bd9['message']));});});}; \ No newline at end of file +var _0xc627=['where','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmAccount,\x20%s,\x20%s','info','catch','GetSugarcrmAccount','SugarcrmAccount','options','raw','attributes','include','map','model','ShowSugarcrmAccount','find'];(function(_0x1227b8,_0x30767f){var _0x257e17=function(_0x26c59d){while(--_0x26c59d){_0x1227b8['push'](_0x1227b8['shift']());}};_0x257e17(++_0x30767f);}(_0xc627,0xa1));var _0x7c62=function(_0x48dc45,_0x8930da){_0x48dc45=_0x48dc45-0x0;var _0xcf044f=_0xc627[_0x48dc45];return _0xcf044f;};'use strict';var _=require(_0x7c62('0x0'));var util=require('util');var moment=require(_0x7c62('0x1'));var BPromise=require(_0x7c62('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7c62('0x3'));var db=require(_0x7c62('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c62('0x5'))(_0x7c62('0x6'));var config=require(_0x7c62('0x7'));var jayson=require(_0x7c62('0x8'));var client=jayson['client'][_0x7c62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c9486,_0x1eae01,_0x2f6133){return new BPromise(function(_0x566234,_0x2e50c9){return client[_0x7c62('0xa')](_0x1c9486,_0x2f6133)[_0x7c62('0xb')](function(_0xabb24c){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x1eae01,_0x7c62('0xc'));logger[_0x7c62('0xd')](_0x7c62('0xe'),_0x1eae01,'request\x20sent',JSON[_0x7c62('0xf')](_0xabb24c));if(_0xabb24c[_0x7c62('0x10')]){if(_0xabb24c[_0x7c62('0x10')]['code']===0x1f4){logger[_0x7c62('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x1eae01,_0xabb24c[_0x7c62('0x10')][_0x7c62('0x11')]);return _0x2e50c9(_0xabb24c['error'][_0x7c62('0x11')]);}logger['error'](_0x7c62('0x12'),_0x1eae01,_0xabb24c[_0x7c62('0x10')][_0x7c62('0x11')]);return _0x566234(_0xabb24c['error']['message']);}else{logger[_0x7c62('0x13')](_0x7c62('0x12'),_0x1eae01,_0x7c62('0xc'));_0x566234(_0xabb24c['result'][_0x7c62('0x11')]);}})[_0x7c62('0x14')](function(_0x51fb30){logger[_0x7c62('0x10')](_0x7c62('0x12'),_0x1eae01,_0x51fb30);_0x2e50c9(_0x51fb30);});});}exports[_0x7c62('0x15')]=function(_0x3d2898){var _0x39b34d=this;return new Promise(function(_0x46a173,_0x19046d){return db[_0x7c62('0x16')]['findAll']({'raw':_0x3d2898[_0x7c62('0x17')]?_0x3d2898['options'][_0x7c62('0x18')]===undefined?!![]:![]:!![],'where':_0x3d2898[_0x7c62('0x17')]?_0x3d2898['options']['where']||null:null,'attributes':_0x3d2898[_0x7c62('0x17')]?_0x3d2898[_0x7c62('0x17')][_0x7c62('0x19')]||null:null,'limit':_0x3d2898[_0x7c62('0x17')]?_0x3d2898[_0x7c62('0x17')]['limit']||null:null,'include':_0x3d2898[_0x7c62('0x17')]?_0x3d2898[_0x7c62('0x17')][_0x7c62('0x1a')]?_[_0x7c62('0x1b')](_0x3d2898[_0x7c62('0x17')][_0x7c62('0x1a')],function(_0x5521b2){return{'model':db[_0x5521b2[_0x7c62('0x1c')]],'as':_0x5521b2['as'],'attributes':_0x5521b2['attributes'],'include':_0x5521b2[_0x7c62('0x1a')]?_[_0x7c62('0x1b')](_0x5521b2[_0x7c62('0x1a')],function(_0x47ae0a){return{'model':db[_0x47ae0a[_0x7c62('0x1c')]],'as':_0x47ae0a['as'],'attributes':_0x47ae0a[_0x7c62('0x19')],'include':_0x47ae0a[_0x7c62('0x1a')]?_[_0x7c62('0x1b')](_0x47ae0a[_0x7c62('0x1a')],function(_0x21d35d){return{'model':db[_0x21d35d[_0x7c62('0x1c')]],'as':_0x21d35d['as'],'attributes':_0x21d35d[_0x7c62('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7c62('0xb')](function(_0x3fa200){logger[_0x7c62('0x13')](_0x7c62('0x15'),_0x3d2898);logger[_0x7c62('0xd')]('GetSugarcrmAccount',_0x3d2898,JSON['stringify'](_0x3fa200));_0x46a173(_0x3fa200);})[_0x7c62('0x14')](function(_0x440d63){logger[_0x7c62('0x10')](_0x7c62('0x15'),_0x440d63[_0x7c62('0x11')],_0x3d2898);_0x19046d(_0x39b34d[_0x7c62('0x10')](0x1f4,_0x440d63[_0x7c62('0x11')]));});});};exports[_0x7c62('0x1d')]=function(_0x57b61b){var _0x29994a=this;return new Promise(function(_0x18f0a4,_0x3e7ec){return db['SugarcrmAccount'][_0x7c62('0x1e')]({'raw':_0x57b61b['options']?_0x57b61b[_0x7c62('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x57b61b['options']?_0x57b61b[_0x7c62('0x17')][_0x7c62('0x1f')]||null:null,'attributes':_0x57b61b[_0x7c62('0x17')]?_0x57b61b[_0x7c62('0x17')][_0x7c62('0x19')]||null:null,'include':_0x57b61b[_0x7c62('0x17')]?_0x57b61b['options'][_0x7c62('0x1a')]?_[_0x7c62('0x1b')](_0x57b61b[_0x7c62('0x17')]['include'],function(_0x3db69a){return{'model':db[_0x3db69a[_0x7c62('0x1c')]],'as':_0x3db69a['as'],'attributes':_0x3db69a['attributes'],'include':_0x3db69a[_0x7c62('0x1a')]?_['map'](_0x3db69a[_0x7c62('0x1a')],function(_0x5957d1){return{'model':db[_0x5957d1['model']],'as':_0x5957d1['as'],'attributes':_0x5957d1['attributes'],'include':_0x5957d1[_0x7c62('0x1a')]?_['map'](_0x5957d1[_0x7c62('0x1a')],function(_0x167172){return{'model':db[_0x167172[_0x7c62('0x1c')]],'as':_0x167172['as'],'attributes':_0x167172[_0x7c62('0x19')]};}):[]};}):[]};}):[]:[]})[_0x7c62('0xb')](function(_0xb67b58){logger[_0x7c62('0x13')]('ShowSugarcrmAccount',_0x57b61b);logger['debug'](_0x7c62('0x1d'),_0x57b61b,JSON[_0x7c62('0xf')](_0xb67b58));_0x18f0a4(_0xb67b58);})[_0x7c62('0x14')](function(_0x24bf02){logger['error']('ShowSugarcrmAccount',_0x24bf02[_0x7c62('0x11')],_0x57b61b);_0x3e7ec(_0x29994a[_0x7c62('0x10')](0x1f4,_0x24bf02[_0x7c62('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 35e3743..e42cdb6 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 _0xe08f=['getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','getFields','/:id/subjects'];(function(_0x33ab79,_0x4f7c50){var _0x10ac00=function(_0x1caa4c){while(--_0x1caa4c){_0x33ab79['push'](_0x33ab79['shift']());}};_0x10ac00(++_0x4f7c50);}(_0xe08f,0xb1));var _0xfe08=function(_0x33b906,_0xc2e081){_0x33b906=_0x33b906-0x0;var _0x544b56=_0xe08f[_0x33b906];return _0x544b56;};'use strict';var multer=require(_0xfe08('0x0'));var util=require(_0xfe08('0x1'));var path=require(_0xfe08('0x2'));var timeout=require(_0xfe08('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xfe08('0x4'));var auth=require(_0xfe08('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfe08('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0xfe08('0x7')]('/',auth[_0xfe08('0x8')](),controller['index']);router[_0xfe08('0x7')](_0xfe08('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/fields',auth['isAuthenticated'](),controller[_0xfe08('0xa')]);router[_0xfe08('0x7')](_0xfe08('0xb'),auth[_0xfe08('0x8')](),controller[_0xfe08('0xc')]);router[_0xfe08('0x7')](_0xfe08('0xd'),auth[_0xfe08('0x8')](),controller[_0xfe08('0xe')]);router[_0xfe08('0xf')]('/',auth[_0xfe08('0x8')](),controller[_0xfe08('0x10')]);router['put'](_0xfe08('0x9'),auth[_0xfe08('0x8')](),controller[_0xfe08('0x11')]);router[_0xfe08('0x12')](_0xfe08('0x9'),auth[_0xfe08('0x8')](),controller[_0xfe08('0x13')]);module[_0xfe08('0x14')]=router; \ No newline at end of file +var _0x86c6=['index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','isAuthenticated','create','put','update','destroy','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x86c6,0x1dc));var _0x686c=function(_0x1eef95,_0x729eab){_0x1eef95=_0x1eef95-0x0;var _0x1f437f=_0x86c6[_0x1eef95];return _0x1f437f;};'use strict';var multer=require(_0x686c('0x0'));var util=require(_0x686c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x686c('0x2'));var interaction=require(_0x686c('0x3'));var config=require(_0x686c('0x4'));var controller=require(_0x686c('0x5'));router[_0x686c('0x6')]('/',auth['isAuthenticated'](),controller[_0x686c('0x7')]);router[_0x686c('0x6')](_0x686c('0x8'),auth['isAuthenticated'](),controller[_0x686c('0x9')]);router[_0x686c('0x6')](_0x686c('0xa'),auth['isAuthenticated'](),controller[_0x686c('0xb')]);router[_0x686c('0x6')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x686c('0xc')]);router[_0x686c('0x6')](_0x686c('0xd'),auth['isAuthenticated'](),controller[_0x686c('0xe')]);router[_0x686c('0xf')]('/',auth[_0x686c('0x10')](),controller[_0x686c('0x11')]);router[_0x686c('0x12')](_0x686c('0x8'),auth['isAuthenticated'](),controller[_0x686c('0x13')]);router['delete'](_0x686c('0x8'),auth['isAuthenticated'](),controller[_0x686c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index e35ef81..bc62e60 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 _0xb53b=['STRING','sequelize'];(function(_0x22aa95,_0x22fec9){var _0x2e1dc1=function(_0x392f58){while(--_0x392f58){_0x22aa95['push'](_0x22aa95['shift']());}};_0x2e1dc1(++_0x22fec9);}(_0xb53b,0x19f));var _0xbb53=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0xb53b[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require(_0xbb53('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb53('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x699f=['STRING','sequelize','exports'];(function(_0x43cd9f,_0x57d758){var _0x5cf244=function(_0xb0bd94){while(--_0xb0bd94){_0x43cd9f['push'](_0x43cd9f['shift']());}};_0x5cf244(++_0x57d758);}(_0x699f,0x169));var _0xf699=function(_0x4de877,_0x340170){_0x4de877=_0x4de877-0x0;var _0xb2cfeb=_0x699f[_0x4de877];return _0xb2cfeb;};'use strict';var Sequelize=require(_0xf699('0x0'));module[_0xf699('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf699('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 965e6b4..b70b6da 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 _0x169a=['name','index','map','rawAttributes','type','key','keys','query','filters','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmConfiguration','includeAll','include','catch','show','params','intersection','length','find','create','body','destroy','getFields','SugarcrmField','order','getSubjects','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','end','error','stack'];(function(_0xcfbb97,_0x3ba3c8){var _0x5bc0b7=function(_0x110729){while(--_0x110729){_0xcfbb97['push'](_0xcfbb97['shift']());}};_0x5bc0b7(++_0x3ba3c8);}(_0x169a,0x1b1));var _0xa169=function(_0xdf35bb,_0x147e43){_0xdf35bb=_0xdf35bb-0x0;var _0x478821=_0x169a[_0xdf35bb];return _0x478821;};'use strict';var emlformat=require(_0xa169('0x0'));var rimraf=require(_0xa169('0x1'));var zipdir=require(_0xa169('0x2'));var jsonpatch=require(_0xa169('0x3'));var rp=require(_0xa169('0x4'));var moment=require('moment');var BPromise=require(_0xa169('0x5'));var Mustache=require(_0xa169('0x6'));var util=require(_0xa169('0x7'));var path=require(_0xa169('0x8'));var sox=require(_0xa169('0x9'));var csv=require('to-csv');var ejs=require(_0xa169('0xa'));var fs=require('fs');var fs_extra=require(_0xa169('0xb'));var _=require(_0xa169('0xc'));var squel=require(_0xa169('0xd'));var crypto=require('crypto');var jsforce=require(_0xa169('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa169('0xf'));var querystring=require(_0xa169('0x10'));var Papa=require(_0xa169('0x11'));var Redis=require('ioredis');var authService=require(_0xa169('0x12'));var qs=require(_0xa169('0x13'));var as=require(_0xa169('0x14'));var hardwareService=require(_0xa169('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa169('0x16'));var config=require(_0xa169('0x17'));var licenseUtil=require(_0xa169('0x18'));var db=require(_0xa169('0x19'))['db'];function respondWithStatusCode(_0x40ec0c,_0x4e7ec4){_0x4e7ec4=_0x4e7ec4||0xcc;return function(_0x55bb19){if(_0x55bb19){return _0x40ec0c[_0xa169('0x1a')](_0x4e7ec4);}return _0x40ec0c[_0xa169('0x1b')](_0x4e7ec4)['end']();};}function respondWithResult(_0x3d3a22,_0x5d5470){_0x5d5470=_0x5d5470||0xc8;return function(_0x4586ed){if(_0x4586ed){return _0x3d3a22[_0xa169('0x1b')](_0x5d5470)[_0xa169('0x1c')](_0x4586ed);}};}function respondWithFilteredResult(_0x158fcb,_0x577926){return function(_0x467a54){if(_0x467a54){var _0x54f9fc=typeof _0x577926[_0xa169('0x1d')]==='undefined'&&typeof _0x577926['limit']===_0xa169('0x1e');var _0x4189db=_0x467a54[_0xa169('0x1f')];var _0x24d3d5=_0x54f9fc?0x0:_0x577926[_0xa169('0x1d')];var _0x27b875=_0x54f9fc?_0x467a54['count']:_0x577926[_0xa169('0x1d')]+_0x577926[_0xa169('0x20')];var _0x3f1837;if(_0x27b875>=_0x4189db){_0x27b875=_0x4189db;_0x3f1837=0xc8;}else{_0x3f1837=0xce;}_0x158fcb[_0xa169('0x1b')](_0x3f1837);return _0x158fcb['set'](_0xa169('0x21'),_0x24d3d5+'-'+_0x27b875+'/'+_0x4189db)[_0xa169('0x1c')](_0x467a54);}return null;};}function patchUpdates(_0x5b3a6c){return function(_0x1e9fa8){try{jsonpatch[_0xa169('0x22')](_0x1e9fa8,_0x5b3a6c,!![]);}catch(_0x573519){return BPromise['reject'](_0x573519);}return _0x1e9fa8[_0xa169('0x23')]();};}function saveUpdates(_0x47f256,_0x4b729d){return function(_0x2f0d77){if(_0x2f0d77){return _0x2f0d77[_0xa169('0x24')](_0x47f256)[_0xa169('0x25')](function(_0x3de435){return _0x3de435;});}return null;};}function removeEntity(_0x2a8e77,_0x63e6fe){return function(_0x4a7b3c){if(_0x4a7b3c){return _0x4a7b3c['destroy']()[_0xa169('0x25')](function(){_0x2a8e77[_0xa169('0x1b')](0xcc)[_0xa169('0x26')]();});}};}function handleEntityNotFound(_0x118466,_0x4e2a61){return function(_0x3d28ae){if(!_0x3d28ae){_0x118466['sendStatus'](0x194);}return _0x3d28ae;};}function handleError(_0x1e31c5,_0x302049){_0x302049=_0x302049||0x1f4;return function(_0x4c344b){logger[_0xa169('0x27')](_0x4c344b[_0xa169('0x28')]);if(_0x4c344b[_0xa169('0x29')]){delete _0x4c344b[_0xa169('0x29')];}_0x1e31c5[_0xa169('0x1b')](_0x302049)['send'](_0x4c344b);};}exports[_0xa169('0x2a')]=function(_0x3cc670,_0x51fa54){var _0x7b3604={},_0x461d49={},_0x5daebd={'count':0x0,'rows':[]};var _0x8cd45=_[_0xa169('0x2b')](db['SugarcrmConfiguration'][_0xa169('0x2c')],function(_0x21dec3){return{'name':_0x21dec3['fieldName'],'type':_0x21dec3[_0xa169('0x2d')][_0xa169('0x2e')]};});_0x461d49['model']=_[_0xa169('0x2b')](_0x8cd45,'name');_0x461d49['query']=_[_0xa169('0x2f')](_0x3cc670[_0xa169('0x30')]);_0x461d49[_0xa169('0x31')]=_['intersection'](_0x461d49[_0xa169('0x32')],_0x461d49[_0xa169('0x30')]);_0x7b3604[_0xa169('0x33')]=_['intersection'](_0x461d49[_0xa169('0x32')],qs['fields'](_0x3cc670[_0xa169('0x30')][_0xa169('0x34')]));_0x7b3604[_0xa169('0x33')]=_0x7b3604['attributes']['length']?_0x7b3604['attributes']:_0x461d49['model'];if(!_0x3cc670[_0xa169('0x30')][_0xa169('0x35')](_0xa169('0x36'))){_0x7b3604[_0xa169('0x20')]=qs['limit'](_0x3cc670[_0xa169('0x30')]['limit']);_0x7b3604['offset']=qs[_0xa169('0x1d')](_0x3cc670[_0xa169('0x30')][_0xa169('0x1d')]);}_0x7b3604['order']=qs['sort'](_0x3cc670[_0xa169('0x30')][_0xa169('0x37')]);_0x7b3604['where']=qs['filters'](_[_0xa169('0x38')](_0x3cc670[_0xa169('0x30')],_0x461d49['filters']),_0x8cd45);if(_0x3cc670[_0xa169('0x30')][_0xa169('0x39')]){_0x7b3604[_0xa169('0x3a')]=_[_0xa169('0x3b')](_0x7b3604[_0xa169('0x3a')],{'$or':_[_0xa169('0x2b')](_0x8cd45,function(_0x1c23f6){if(_0x1c23f6[_0xa169('0x2d')]!==_0xa169('0x3c')){var _0x5e37d2={};_0x5e37d2[_0x1c23f6[_0xa169('0x29')]]={'$like':'%'+_0x3cc670[_0xa169('0x30')]['filter']+'%'};return _0x5e37d2;}})});}_0x7b3604=_[_0xa169('0x3b')]({},_0x7b3604,_0x3cc670[_0xa169('0x3d')]);var _0x423719={'where':_0x7b3604[_0xa169('0x3a')]};return db[_0xa169('0x3e')][_0xa169('0x1f')](_0x423719)[_0xa169('0x25')](function(_0x396946){_0x5daebd['count']=_0x396946;if(_0x3cc670[_0xa169('0x30')][_0xa169('0x3f')]){_0x7b3604[_0xa169('0x40')]=[{'all':!![]}];}return db[_0xa169('0x3e')]['findAll'](_0x7b3604);})[_0xa169('0x25')](function(_0x5996fa){_0x5daebd['rows']=_0x5996fa;return _0x5daebd;})[_0xa169('0x25')](respondWithFilteredResult(_0x51fa54,_0x7b3604))[_0xa169('0x41')](handleError(_0x51fa54,null));};exports[_0xa169('0x42')]=function(_0x8229ef,_0x4b812d){var _0x47d044={'raw':![],'where':{'id':_0x8229ef[_0xa169('0x43')]['id']}},_0x33bb28={};_0x33bb28[_0xa169('0x32')]=_[_0xa169('0x2f')](db[_0xa169('0x3e')][_0xa169('0x2c')]);_0x33bb28[_0xa169('0x30')]=_[_0xa169('0x2f')](_0x8229ef[_0xa169('0x30')]);_0x33bb28[_0xa169('0x31')]=_[_0xa169('0x44')](_0x33bb28[_0xa169('0x32')],_0x33bb28[_0xa169('0x30')]);_0x47d044[_0xa169('0x33')]=_[_0xa169('0x44')](_0x33bb28['model'],qs[_0xa169('0x34')](_0x8229ef[_0xa169('0x30')][_0xa169('0x34')]));_0x47d044[_0xa169('0x33')]=_0x47d044[_0xa169('0x33')][_0xa169('0x45')]?_0x47d044[_0xa169('0x33')]:_0x33bb28[_0xa169('0x32')];if(_0x8229ef['query'][_0xa169('0x3f')]){_0x47d044[_0xa169('0x40')]=[{'all':!![]}];}_0x47d044=_[_0xa169('0x3b')]({},_0x47d044,_0x8229ef[_0xa169('0x3d')]);return db['SugarcrmConfiguration'][_0xa169('0x46')](_0x47d044)[_0xa169('0x25')](handleEntityNotFound(_0x4b812d,null))[_0xa169('0x25')](respondWithResult(_0x4b812d,null))[_0xa169('0x41')](handleError(_0x4b812d,null));};exports['create']=function(_0xa6e872,_0x1a0f7a){return db['SugarcrmConfiguration'][_0xa169('0x47')](_0xa6e872[_0xa169('0x48')],{})[_0xa169('0x25')](respondWithResult(_0x1a0f7a,0xc9))[_0xa169('0x41')](handleError(_0x1a0f7a,null));};exports[_0xa169('0x24')]=function(_0x4c1e34,_0x364736){if(_0x4c1e34[_0xa169('0x48')]['id']){delete _0x4c1e34['body']['id'];}return db[_0xa169('0x3e')][_0xa169('0x46')]({'where':{'id':_0x4c1e34[_0xa169('0x43')]['id']}})[_0xa169('0x25')](handleEntityNotFound(_0x364736,null))[_0xa169('0x25')](saveUpdates(_0x4c1e34[_0xa169('0x48')],null))['then'](respondWithResult(_0x364736,null))[_0xa169('0x41')](handleError(_0x364736,null));};exports[_0xa169('0x49')]=function(_0x4a18df,_0x56455e){return db[_0xa169('0x3e')][_0xa169('0x46')]({'where':{'id':_0x4a18df[_0xa169('0x43')]['id']}})['then'](handleEntityNotFound(_0x56455e,null))[_0xa169('0x25')](removeEntity(_0x56455e,null))['catch'](handleError(_0x56455e,null));};exports[_0xa169('0x4a')]=function(_0x1d3e1d,_0x491ccf,_0x2a13d2){var _0x5664a2={};var _0x572cfb={};var _0x3fbfce;var _0x1f3dbe;return db[_0xa169('0x3e')]['findOne']({'where':{'id':_0x1d3e1d[_0xa169('0x43')]['id']}})[_0xa169('0x25')](handleEntityNotFound(_0x491ccf,null))[_0xa169('0x25')](function(_0x27fc6b){if(_0x27fc6b){_0x3fbfce=_0x27fc6b;_0x572cfb[_0xa169('0x32')]=_[_0xa169('0x2f')](db[_0xa169('0x4b')][_0xa169('0x2c')]);_0x572cfb[_0xa169('0x30')]=_[_0xa169('0x2f')](_0x1d3e1d[_0xa169('0x30')]);_0x572cfb[_0xa169('0x31')]=_[_0xa169('0x44')](_0x572cfb[_0xa169('0x32')],_0x572cfb[_0xa169('0x30')]);_0x5664a2[_0xa169('0x33')]=_[_0xa169('0x44')](_0x572cfb['model'],qs[_0xa169('0x34')](_0x1d3e1d[_0xa169('0x30')][_0xa169('0x34')]));_0x5664a2[_0xa169('0x33')]=_0x5664a2[_0xa169('0x33')][_0xa169('0x45')]?_0x5664a2[_0xa169('0x33')]:_0x572cfb[_0xa169('0x32')];_0x5664a2[_0xa169('0x4c')]=qs[_0xa169('0x37')](_0x1d3e1d[_0xa169('0x30')]['sort']);_0x5664a2[_0xa169('0x3a')]=qs[_0xa169('0x31')](_['pick'](_0x1d3e1d[_0xa169('0x30')],_0x572cfb[_0xa169('0x31')]));if(_0x1d3e1d['query']['filter']){_0x5664a2[_0xa169('0x3a')]=_[_0xa169('0x3b')](_0x5664a2['where'],{'$or':_[_0xa169('0x2b')](_0x5664a2[_0xa169('0x33')],function(_0x15bcb3){var _0x253012={};_0x253012[_0x15bcb3]={'$like':'%'+_0x1d3e1d[_0xa169('0x30')]['filter']+'%'};return _0x253012;})});}_0x5664a2=_[_0xa169('0x3b')]({},_0x5664a2,_0x1d3e1d['options']);return _0x3fbfce[_0xa169('0x4a')](_0x5664a2);}})[_0xa169('0x25')](function(_0x28c667){if(_0x28c667){_0x1f3dbe=_0x28c667[_0xa169('0x45')];if(!_0x1d3e1d['query']['hasOwnProperty'](_0xa169('0x36'))){_0x5664a2[_0xa169('0x20')]=qs[_0xa169('0x20')](_0x1d3e1d[_0xa169('0x30')][_0xa169('0x20')]);_0x5664a2[_0xa169('0x1d')]=qs[_0xa169('0x1d')](_0x1d3e1d[_0xa169('0x30')][_0xa169('0x1d')]);}return _0x3fbfce[_0xa169('0x4a')](_0x5664a2);}})[_0xa169('0x25')](function(_0x95d8b8){if(_0x95d8b8){return _0x95d8b8?{'count':_0x1f3dbe,'rows':_0x95d8b8}:null;}})[_0xa169('0x25')](respondWithResult(_0x491ccf,null))[_0xa169('0x41')](handleError(_0x491ccf,null));};exports[_0xa169('0x4d')]=function(_0x40f3d3,_0x2cf0b7,_0x3d0dcb){var _0x3c14e1={};var _0x457e27={};var _0x47c5d5;var _0x31119a;return db[_0xa169('0x3e')][_0xa169('0x4e')]({'where':{'id':_0x40f3d3[_0xa169('0x43')]['id']}})['then'](handleEntityNotFound(_0x2cf0b7,null))[_0xa169('0x25')](function(_0x3f38e4){if(_0x3f38e4){_0x47c5d5=_0x3f38e4;_0x457e27['model']=_[_0xa169('0x2f')](db['SugarcrmField'][_0xa169('0x2c')]);_0x457e27['query']=_['keys'](_0x40f3d3['query']);_0x457e27['filters']=_['intersection'](_0x457e27[_0xa169('0x32')],_0x457e27[_0xa169('0x30')]);_0x3c14e1[_0xa169('0x33')]=_[_0xa169('0x44')](_0x457e27['model'],qs['fields'](_0x40f3d3[_0xa169('0x30')][_0xa169('0x34')]));_0x3c14e1[_0xa169('0x33')]=_0x3c14e1[_0xa169('0x33')]['length']?_0x3c14e1[_0xa169('0x33')]:_0x457e27['model'];_0x3c14e1['order']=qs[_0xa169('0x37')](_0x40f3d3[_0xa169('0x30')][_0xa169('0x37')]);_0x3c14e1[_0xa169('0x3a')]=qs[_0xa169('0x31')](_[_0xa169('0x38')](_0x40f3d3[_0xa169('0x30')],_0x457e27['filters']));if(_0x40f3d3[_0xa169('0x30')][_0xa169('0x39')]){_0x3c14e1[_0xa169('0x3a')]=_[_0xa169('0x3b')](_0x3c14e1[_0xa169('0x3a')],{'$or':_[_0xa169('0x2b')](_0x3c14e1[_0xa169('0x33')],function(_0x3205c9){var _0x726695={};_0x726695[_0x3205c9]={'$like':'%'+_0x40f3d3['query'][_0xa169('0x39')]+'%'};return _0x726695;})});}_0x3c14e1=_[_0xa169('0x3b')]({},_0x3c14e1,_0x40f3d3['options']);return _0x47c5d5[_0xa169('0x4d')](_0x3c14e1);}})['then'](function(_0x497d52){if(_0x497d52){_0x31119a=_0x497d52[_0xa169('0x45')];if(!_0x40f3d3[_0xa169('0x30')][_0xa169('0x35')](_0xa169('0x36'))){_0x3c14e1[_0xa169('0x20')]=qs[_0xa169('0x20')](_0x40f3d3[_0xa169('0x30')][_0xa169('0x20')]);_0x3c14e1['offset']=qs[_0xa169('0x1d')](_0x40f3d3[_0xa169('0x30')][_0xa169('0x1d')]);}return _0x47c5d5[_0xa169('0x4d')](_0x3c14e1);}})[_0xa169('0x25')](function(_0x25bf02){if(_0x25bf02){return _0x25bf02?{'count':_0x31119a,'rows':_0x25bf02}:null;}})[_0xa169('0x25')](respondWithResult(_0x2cf0b7,null))[_0xa169('0x41')](handleError(_0x2cf0b7,null));};exports['getDescriptions']=function(_0x4c0326,_0x55c56c,_0x56d827){var _0x27ed95={};var _0xf821c9={};var _0x1731e9;var _0x4ae783;return db[_0xa169('0x3e')]['findOne']({'where':{'id':_0x4c0326['params']['id']}})[_0xa169('0x25')](handleEntityNotFound(_0x55c56c,null))[_0xa169('0x25')](function(_0x590ea3){if(_0x590ea3){_0x1731e9=_0x590ea3;_0xf821c9[_0xa169('0x32')]=_[_0xa169('0x2f')](db['SugarcrmField'][_0xa169('0x2c')]);_0xf821c9[_0xa169('0x30')]=_[_0xa169('0x2f')](_0x4c0326[_0xa169('0x30')]);_0xf821c9['filters']=_[_0xa169('0x44')](_0xf821c9[_0xa169('0x32')],_0xf821c9[_0xa169('0x30')]);_0x27ed95['attributes']=_[_0xa169('0x44')](_0xf821c9[_0xa169('0x32')],qs[_0xa169('0x34')](_0x4c0326['query'][_0xa169('0x34')]));_0x27ed95['attributes']=_0x27ed95[_0xa169('0x33')][_0xa169('0x45')]?_0x27ed95[_0xa169('0x33')]:_0xf821c9[_0xa169('0x32')];_0x27ed95[_0xa169('0x4c')]=qs[_0xa169('0x37')](_0x4c0326[_0xa169('0x30')][_0xa169('0x37')]);_0x27ed95[_0xa169('0x3a')]=qs['filters'](_[_0xa169('0x38')](_0x4c0326[_0xa169('0x30')],_0xf821c9[_0xa169('0x31')]));if(_0x4c0326['query'][_0xa169('0x39')]){_0x27ed95[_0xa169('0x3a')]=_['merge'](_0x27ed95[_0xa169('0x3a')],{'$or':_['map'](_0x27ed95[_0xa169('0x33')],function(_0x347365){var _0x2c25cf={};_0x2c25cf[_0x347365]={'$like':'%'+_0x4c0326[_0xa169('0x30')]['filter']+'%'};return _0x2c25cf;})});}_0x27ed95=_['merge']({},_0x27ed95,_0x4c0326[_0xa169('0x3d')]);return _0x1731e9['getDescriptions'](_0x27ed95);}})[_0xa169('0x25')](function(_0x3c8846){if(_0x3c8846){_0x4ae783=_0x3c8846[_0xa169('0x45')];if(!_0x4c0326[_0xa169('0x30')][_0xa169('0x35')](_0xa169('0x36'))){_0x27ed95[_0xa169('0x20')]=qs['limit'](_0x4c0326[_0xa169('0x30')][_0xa169('0x20')]);_0x27ed95['offset']=qs[_0xa169('0x1d')](_0x4c0326['query'][_0xa169('0x1d')]);}return _0x1731e9['getDescriptions'](_0x27ed95);}})[_0xa169('0x25')](function(_0x35803a){if(_0x35803a){return _0x35803a?{'count':_0x4ae783,'rows':_0x35803a}:null;}})[_0xa169('0x25')](respondWithResult(_0x55c56c,null))['catch'](handleError(_0x55c56c,null));}; \ No newline at end of file +var _0xe45b=['attributes','fields','length','hasOwnProperty','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','catch','params','find','create','body','getFields','SugarcrmField','order','pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','key','model','keys','query','intersection'];(function(_0x5bff13,_0x4554a9){var _0x45508c=function(_0x54e014){while(--_0x54e014){_0x5bff13['push'](_0x5bff13['shift']());}};_0x45508c(++_0x4554a9);}(_0xe45b,0x111));var _0xbe45=function(_0x5868fa,_0x4009c7){_0x5868fa=_0x5868fa-0x0;var _0x24f45a=_0xe45b[_0x5868fa];return _0x24f45a;};'use strict';var emlformat=require(_0xbe45('0x0'));var rimraf=require(_0xbe45('0x1'));var zipdir=require(_0xbe45('0x2'));var jsonpatch=require(_0xbe45('0x3'));var rp=require(_0xbe45('0x4'));var moment=require(_0xbe45('0x5'));var BPromise=require(_0xbe45('0x6'));var Mustache=require('mustache');var util=require(_0xbe45('0x7'));var path=require(_0xbe45('0x8'));var sox=require(_0xbe45('0x9'));var csv=require(_0xbe45('0xa'));var ejs=require(_0xbe45('0xb'));var fs=require('fs');var fs_extra=require(_0xbe45('0xc'));var _=require(_0xbe45('0xd'));var squel=require(_0xbe45('0xe'));var crypto=require('crypto');var jsforce=require(_0xbe45('0xf'));var deskjs=require(_0xbe45('0x10'));var toCsv=require(_0xbe45('0xa'));var querystring=require('querystring');var Papa=require(_0xbe45('0x11'));var Redis=require(_0xbe45('0x12'));var authService=require(_0xbe45('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbe45('0x14'));var hardwareService=require(_0xbe45('0x15'));var logger=require('../../config/logger')(_0xbe45('0x16'));var utils=require(_0xbe45('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbe45('0x18'));var db=require(_0xbe45('0x19'))['db'];function respondWithStatusCode(_0x40784b,_0x25ff1b){_0x25ff1b=_0x25ff1b||0xcc;return function(_0x224251){if(_0x224251){return _0x40784b['sendStatus'](_0x25ff1b);}return _0x40784b[_0xbe45('0x1a')](_0x25ff1b)[_0xbe45('0x1b')]();};}function respondWithResult(_0x3dfb11,_0x384589){_0x384589=_0x384589||0xc8;return function(_0x2a0778){if(_0x2a0778){return _0x3dfb11[_0xbe45('0x1a')](_0x384589)[_0xbe45('0x1c')](_0x2a0778);}};}function respondWithFilteredResult(_0x5bee64,_0x10c0dc){return function(_0x6cce32){if(_0x6cce32){var _0x442407=typeof _0x10c0dc[_0xbe45('0x1d')]==='undefined'&&typeof _0x10c0dc['limit']===_0xbe45('0x1e');var _0x4f7f24=_0x6cce32[_0xbe45('0x1f')];var _0x5181d6=_0x442407?0x0:_0x10c0dc[_0xbe45('0x1d')];var _0x5a0c1f=_0x442407?_0x6cce32[_0xbe45('0x1f')]:_0x10c0dc[_0xbe45('0x1d')]+_0x10c0dc[_0xbe45('0x20')];var _0x4b4f95;if(_0x5a0c1f>=_0x4f7f24){_0x5a0c1f=_0x4f7f24;_0x4b4f95=0xc8;}else{_0x4b4f95=0xce;}_0x5bee64['status'](_0x4b4f95);return _0x5bee64[_0xbe45('0x21')](_0xbe45('0x22'),_0x5181d6+'-'+_0x5a0c1f+'/'+_0x4f7f24)[_0xbe45('0x1c')](_0x6cce32);}return null;};}function patchUpdates(_0x1f2c71){return function(_0x50e75d){try{jsonpatch[_0xbe45('0x23')](_0x50e75d,_0x1f2c71,!![]);}catch(_0xd654a9){return BPromise['reject'](_0xd654a9);}return _0x50e75d[_0xbe45('0x24')]();};}function saveUpdates(_0x33d30,_0x16ba10){return function(_0x1bf4b1){if(_0x1bf4b1){return _0x1bf4b1[_0xbe45('0x25')](_0x33d30)[_0xbe45('0x26')](function(_0x2e8e50){return _0x2e8e50;});}return null;};}function removeEntity(_0x4bc3f8,_0x327fce){return function(_0x483c83){if(_0x483c83){return _0x483c83[_0xbe45('0x27')]()['then'](function(){_0x4bc3f8[_0xbe45('0x1a')](0xcc)[_0xbe45('0x1b')]();});}};}function handleEntityNotFound(_0x4156ae,_0xbe8838){return function(_0x4dd6f1){if(!_0x4dd6f1){_0x4156ae[_0xbe45('0x28')](0x194);}return _0x4dd6f1;};}function handleError(_0x5c92c0,_0xefc82a){_0xefc82a=_0xefc82a||0x1f4;return function(_0x4c1ab4){logger[_0xbe45('0x29')](_0x4c1ab4[_0xbe45('0x2a')]);if(_0x4c1ab4[_0xbe45('0x2b')]){delete _0x4c1ab4[_0xbe45('0x2b')];}_0x5c92c0[_0xbe45('0x1a')](_0xefc82a)[_0xbe45('0x2c')](_0x4c1ab4);};}exports[_0xbe45('0x2d')]=function(_0x5584e9,_0x4eeb14){var _0x49db7d={},_0x3065d4={},_0x3324ea={'count':0x0,'rows':[]};var _0x5a24b5=_[_0xbe45('0x2e')](db[_0xbe45('0x2f')][_0xbe45('0x30')],function(_0x1ff62f){return{'name':_0x1ff62f[_0xbe45('0x31')],'type':_0x1ff62f['type'][_0xbe45('0x32')]};});_0x3065d4[_0xbe45('0x33')]=_[_0xbe45('0x2e')](_0x5a24b5,'name');_0x3065d4['query']=_[_0xbe45('0x34')](_0x5584e9[_0xbe45('0x35')]);_0x3065d4['filters']=_[_0xbe45('0x36')](_0x3065d4[_0xbe45('0x33')],_0x3065d4['query']);_0x49db7d[_0xbe45('0x37')]=_[_0xbe45('0x36')](_0x3065d4['model'],qs[_0xbe45('0x38')](_0x5584e9['query'][_0xbe45('0x38')]));_0x49db7d[_0xbe45('0x37')]=_0x49db7d[_0xbe45('0x37')][_0xbe45('0x39')]?_0x49db7d[_0xbe45('0x37')]:_0x3065d4[_0xbe45('0x33')];if(!_0x5584e9[_0xbe45('0x35')][_0xbe45('0x3a')]('nolimit')){_0x49db7d['limit']=qs[_0xbe45('0x20')](_0x5584e9[_0xbe45('0x35')][_0xbe45('0x20')]);_0x49db7d[_0xbe45('0x1d')]=qs['offset'](_0x5584e9[_0xbe45('0x35')][_0xbe45('0x1d')]);}_0x49db7d['order']=qs[_0xbe45('0x3b')](_0x5584e9[_0xbe45('0x35')]['sort']);_0x49db7d[_0xbe45('0x3c')]=qs[_0xbe45('0x3d')](_['pick'](_0x5584e9[_0xbe45('0x35')],_0x3065d4[_0xbe45('0x3d')]),_0x5a24b5);if(_0x5584e9['query'][_0xbe45('0x3e')]){_0x49db7d[_0xbe45('0x3c')]=_[_0xbe45('0x3f')](_0x49db7d[_0xbe45('0x3c')],{'$or':_[_0xbe45('0x2e')](_0x5a24b5,function(_0x1665de){if(_0x1665de[_0xbe45('0x40')]!=='VIRTUAL'){var _0x2d1e66={};_0x2d1e66[_0x1665de[_0xbe45('0x2b')]]={'$like':'%'+_0x5584e9[_0xbe45('0x35')]['filter']+'%'};return _0x2d1e66;}})});}_0x49db7d=_[_0xbe45('0x3f')]({},_0x49db7d,_0x5584e9[_0xbe45('0x41')]);var _0x10782f={'where':_0x49db7d['where']};return db[_0xbe45('0x2f')]['count'](_0x10782f)[_0xbe45('0x26')](function(_0x5955f4){_0x3324ea['count']=_0x5955f4;if(_0x5584e9[_0xbe45('0x35')][_0xbe45('0x42')]){_0x49db7d[_0xbe45('0x43')]=[{'all':!![]}];}return db[_0xbe45('0x2f')][_0xbe45('0x44')](_0x49db7d);})[_0xbe45('0x26')](function(_0x529758){_0x3324ea['rows']=_0x529758;return _0x3324ea;})[_0xbe45('0x26')](respondWithFilteredResult(_0x4eeb14,_0x49db7d))[_0xbe45('0x45')](handleError(_0x4eeb14,null));};exports['show']=function(_0x1dc784,_0x2eb4a4){var _0x3d8dac={'raw':![],'where':{'id':_0x1dc784[_0xbe45('0x46')]['id']}},_0x10798a={};_0x10798a[_0xbe45('0x33')]=_[_0xbe45('0x34')](db[_0xbe45('0x2f')][_0xbe45('0x30')]);_0x10798a['query']=_[_0xbe45('0x34')](_0x1dc784[_0xbe45('0x35')]);_0x10798a['filters']=_[_0xbe45('0x36')](_0x10798a['model'],_0x10798a[_0xbe45('0x35')]);_0x3d8dac['attributes']=_['intersection'](_0x10798a[_0xbe45('0x33')],qs[_0xbe45('0x38')](_0x1dc784['query'][_0xbe45('0x38')]));_0x3d8dac[_0xbe45('0x37')]=_0x3d8dac[_0xbe45('0x37')]['length']?_0x3d8dac['attributes']:_0x10798a['model'];if(_0x1dc784['query'][_0xbe45('0x42')]){_0x3d8dac[_0xbe45('0x43')]=[{'all':!![]}];}_0x3d8dac=_[_0xbe45('0x3f')]({},_0x3d8dac,_0x1dc784[_0xbe45('0x41')]);return db[_0xbe45('0x2f')][_0xbe45('0x47')](_0x3d8dac)[_0xbe45('0x26')](handleEntityNotFound(_0x2eb4a4,null))[_0xbe45('0x26')](respondWithResult(_0x2eb4a4,null))[_0xbe45('0x45')](handleError(_0x2eb4a4,null));};exports['create']=function(_0x40791c,_0xea2e06){return db[_0xbe45('0x2f')][_0xbe45('0x48')](_0x40791c[_0xbe45('0x49')],{})[_0xbe45('0x26')](respondWithResult(_0xea2e06,0xc9))[_0xbe45('0x45')](handleError(_0xea2e06,null));};exports[_0xbe45('0x25')]=function(_0xa42026,_0x50c09f){if(_0xa42026[_0xbe45('0x49')]['id']){delete _0xa42026[_0xbe45('0x49')]['id'];}return db[_0xbe45('0x2f')]['find']({'where':{'id':_0xa42026['params']['id']}})['then'](handleEntityNotFound(_0x50c09f,null))[_0xbe45('0x26')](saveUpdates(_0xa42026[_0xbe45('0x49')],null))[_0xbe45('0x26')](respondWithResult(_0x50c09f,null))[_0xbe45('0x45')](handleError(_0x50c09f,null));};exports[_0xbe45('0x27')]=function(_0x12fb3f,_0x44ea06){return db[_0xbe45('0x2f')][_0xbe45('0x47')]({'where':{'id':_0x12fb3f['params']['id']}})[_0xbe45('0x26')](handleEntityNotFound(_0x44ea06,null))['then'](removeEntity(_0x44ea06,null))[_0xbe45('0x45')](handleError(_0x44ea06,null));};exports[_0xbe45('0x4a')]=function(_0x4e6561,_0x5b7165,_0x14216f){var _0x66ee52={};var _0x512398={};var _0x50b663;var _0x5305a4;return db[_0xbe45('0x2f')]['findOne']({'where':{'id':_0x4e6561['params']['id']}})['then'](handleEntityNotFound(_0x5b7165,null))[_0xbe45('0x26')](function(_0x3d306b){if(_0x3d306b){_0x50b663=_0x3d306b;_0x512398[_0xbe45('0x33')]=_[_0xbe45('0x34')](db[_0xbe45('0x4b')][_0xbe45('0x30')]);_0x512398['query']=_['keys'](_0x4e6561[_0xbe45('0x35')]);_0x512398[_0xbe45('0x3d')]=_['intersection'](_0x512398[_0xbe45('0x33')],_0x512398[_0xbe45('0x35')]);_0x66ee52[_0xbe45('0x37')]=_[_0xbe45('0x36')](_0x512398[_0xbe45('0x33')],qs[_0xbe45('0x38')](_0x4e6561[_0xbe45('0x35')][_0xbe45('0x38')]));_0x66ee52[_0xbe45('0x37')]=_0x66ee52['attributes']['length']?_0x66ee52[_0xbe45('0x37')]:_0x512398[_0xbe45('0x33')];_0x66ee52[_0xbe45('0x4c')]=qs[_0xbe45('0x3b')](_0x4e6561[_0xbe45('0x35')][_0xbe45('0x3b')]);_0x66ee52[_0xbe45('0x3c')]=qs[_0xbe45('0x3d')](_[_0xbe45('0x4d')](_0x4e6561['query'],_0x512398[_0xbe45('0x3d')]));if(_0x4e6561[_0xbe45('0x35')][_0xbe45('0x3e')]){_0x66ee52['where']=_['merge'](_0x66ee52['where'],{'$or':_['map'](_0x66ee52[_0xbe45('0x37')],function(_0x494c6a){var _0x7e8aa7={};_0x7e8aa7[_0x494c6a]={'$like':'%'+_0x4e6561[_0xbe45('0x35')][_0xbe45('0x3e')]+'%'};return _0x7e8aa7;})});}_0x66ee52=_['merge']({},_0x66ee52,_0x4e6561[_0xbe45('0x41')]);return _0x50b663[_0xbe45('0x4a')](_0x66ee52);}})[_0xbe45('0x26')](function(_0x1408cd){if(_0x1408cd){_0x5305a4=_0x1408cd[_0xbe45('0x39')];if(!_0x4e6561[_0xbe45('0x35')][_0xbe45('0x3a')](_0xbe45('0x4e'))){_0x66ee52[_0xbe45('0x20')]=qs['limit'](_0x4e6561[_0xbe45('0x35')][_0xbe45('0x20')]);_0x66ee52[_0xbe45('0x1d')]=qs[_0xbe45('0x1d')](_0x4e6561[_0xbe45('0x35')][_0xbe45('0x1d')]);}return _0x50b663[_0xbe45('0x4a')](_0x66ee52);}})[_0xbe45('0x26')](function(_0x4d3b94){if(_0x4d3b94){return _0x4d3b94?{'count':_0x5305a4,'rows':_0x4d3b94}:null;}})[_0xbe45('0x26')](respondWithResult(_0x5b7165,null))[_0xbe45('0x45')](handleError(_0x5b7165,null));};exports[_0xbe45('0x4f')]=function(_0x581462,_0x2c2e9c,_0xc0dda3){var _0x44d9f8={};var _0x1badcf={};var _0x230612;var _0x4aaa71;return db[_0xbe45('0x2f')][_0xbe45('0x50')]({'where':{'id':_0x581462[_0xbe45('0x46')]['id']}})[_0xbe45('0x26')](handleEntityNotFound(_0x2c2e9c,null))['then'](function(_0x576341){if(_0x576341){_0x230612=_0x576341;_0x1badcf['model']=_[_0xbe45('0x34')](db[_0xbe45('0x4b')][_0xbe45('0x30')]);_0x1badcf[_0xbe45('0x35')]=_[_0xbe45('0x34')](_0x581462['query']);_0x1badcf['filters']=_[_0xbe45('0x36')](_0x1badcf[_0xbe45('0x33')],_0x1badcf[_0xbe45('0x35')]);_0x44d9f8[_0xbe45('0x37')]=_[_0xbe45('0x36')](_0x1badcf[_0xbe45('0x33')],qs[_0xbe45('0x38')](_0x581462[_0xbe45('0x35')]['fields']));_0x44d9f8['attributes']=_0x44d9f8[_0xbe45('0x37')][_0xbe45('0x39')]?_0x44d9f8[_0xbe45('0x37')]:_0x1badcf['model'];_0x44d9f8[_0xbe45('0x4c')]=qs[_0xbe45('0x3b')](_0x581462['query'][_0xbe45('0x3b')]);_0x44d9f8['where']=qs[_0xbe45('0x3d')](_[_0xbe45('0x4d')](_0x581462[_0xbe45('0x35')],_0x1badcf['filters']));if(_0x581462['query'][_0xbe45('0x3e')]){_0x44d9f8[_0xbe45('0x3c')]=_['merge'](_0x44d9f8[_0xbe45('0x3c')],{'$or':_[_0xbe45('0x2e')](_0x44d9f8[_0xbe45('0x37')],function(_0x24de90){var _0x563e89={};_0x563e89[_0x24de90]={'$like':'%'+_0x581462[_0xbe45('0x35')][_0xbe45('0x3e')]+'%'};return _0x563e89;})});}_0x44d9f8=_[_0xbe45('0x3f')]({},_0x44d9f8,_0x581462[_0xbe45('0x41')]);return _0x230612[_0xbe45('0x4f')](_0x44d9f8);}})[_0xbe45('0x26')](function(_0x429040){if(_0x429040){_0x4aaa71=_0x429040[_0xbe45('0x39')];if(!_0x581462['query'][_0xbe45('0x3a')](_0xbe45('0x4e'))){_0x44d9f8[_0xbe45('0x20')]=qs[_0xbe45('0x20')](_0x581462[_0xbe45('0x35')]['limit']);_0x44d9f8[_0xbe45('0x1d')]=qs['offset'](_0x581462['query'][_0xbe45('0x1d')]);}return _0x230612['getSubjects'](_0x44d9f8);}})['then'](function(_0x3b8110){if(_0x3b8110){return _0x3b8110?{'count':_0x4aaa71,'rows':_0x3b8110}:null;}})[_0xbe45('0x26')](respondWithResult(_0x2c2e9c,null))[_0xbe45('0x45')](handleError(_0x2c2e9c,null));};exports[_0xbe45('0x51')]=function(_0x1a0f8d,_0x2b8162,_0x2260e3){var _0x1d95dd={};var _0x24f0fa={};var _0x2601a3;var _0x131101;return db[_0xbe45('0x2f')][_0xbe45('0x50')]({'where':{'id':_0x1a0f8d['params']['id']}})['then'](handleEntityNotFound(_0x2b8162,null))['then'](function(_0x2d8424){if(_0x2d8424){_0x2601a3=_0x2d8424;_0x24f0fa[_0xbe45('0x33')]=_[_0xbe45('0x34')](db[_0xbe45('0x4b')][_0xbe45('0x30')]);_0x24f0fa[_0xbe45('0x35')]=_[_0xbe45('0x34')](_0x1a0f8d['query']);_0x24f0fa[_0xbe45('0x3d')]=_['intersection'](_0x24f0fa[_0xbe45('0x33')],_0x24f0fa[_0xbe45('0x35')]);_0x1d95dd[_0xbe45('0x37')]=_['intersection'](_0x24f0fa[_0xbe45('0x33')],qs['fields'](_0x1a0f8d[_0xbe45('0x35')][_0xbe45('0x38')]));_0x1d95dd[_0xbe45('0x37')]=_0x1d95dd[_0xbe45('0x37')][_0xbe45('0x39')]?_0x1d95dd[_0xbe45('0x37')]:_0x24f0fa[_0xbe45('0x33')];_0x1d95dd['order']=qs[_0xbe45('0x3b')](_0x1a0f8d['query'][_0xbe45('0x3b')]);_0x1d95dd['where']=qs[_0xbe45('0x3d')](_[_0xbe45('0x4d')](_0x1a0f8d['query'],_0x24f0fa[_0xbe45('0x3d')]));if(_0x1a0f8d[_0xbe45('0x35')][_0xbe45('0x3e')]){_0x1d95dd[_0xbe45('0x3c')]=_[_0xbe45('0x3f')](_0x1d95dd['where'],{'$or':_[_0xbe45('0x2e')](_0x1d95dd['attributes'],function(_0x46a248){var _0x39cdc8={};_0x39cdc8[_0x46a248]={'$like':'%'+_0x1a0f8d[_0xbe45('0x35')][_0xbe45('0x3e')]+'%'};return _0x39cdc8;})});}_0x1d95dd=_[_0xbe45('0x3f')]({},_0x1d95dd,_0x1a0f8d[_0xbe45('0x41')]);return _0x2601a3['getDescriptions'](_0x1d95dd);}})[_0xbe45('0x26')](function(_0x30893d){if(_0x30893d){_0x131101=_0x30893d['length'];if(!_0x1a0f8d['query']['hasOwnProperty'](_0xbe45('0x4e'))){_0x1d95dd[_0xbe45('0x20')]=qs[_0xbe45('0x20')](_0x1a0f8d[_0xbe45('0x35')][_0xbe45('0x20')]);_0x1d95dd[_0xbe45('0x1d')]=qs[_0xbe45('0x1d')](_0x1a0f8d[_0xbe45('0x35')]['offset']);}return _0x2601a3[_0xbe45('0x51')](_0x1d95dd);}})[_0xbe45('0x26')](function(_0x717ce3){if(_0x717ce3){return _0x717ce3?{'count':_0x131101,'rows':_0x717ce3}:null;}})[_0xbe45('0x26')](respondWithResult(_0x2b8162,null))['catch'](handleError(_0x2b8162,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 5a9d371..0f415b6 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 _0x408f=['api','moment','bluebird','path','rimraf','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util'];(function(_0x4b416c,_0x53ef9e){var _0x2037fa=function(_0x5d9816){while(--_0x5d9816){_0x4b416c['push'](_0x4b416c['shift']());}};_0x2037fa(++_0x53ef9e);}(_0x408f,0x1c1));var _0xf408=function(_0x3761cc,_0x51d479){_0x3761cc=_0x3761cc-0x0;var _0x4235eb=_0x408f[_0x3761cc];return _0x4235eb;};'use strict';var _=require(_0xf408('0x0'));var util=require(_0xf408('0x1'));var logger=require('../../config/logger')(_0xf408('0x2'));var moment=require(_0xf408('0x3'));var BPromise=require(_0xf408('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf408('0x5'));var rimraf=require(_0xf408('0x6'));var config=require('../../config/environment');var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xf408('0x7')]=function(_0x443722,_0xfa47f9){return _0x443722[_0xf408('0x8')](_0xf408('0x9'),attributes,{'tableName':_0xf408('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc2a7=['../../config/environment','./intSugarcrmConfiguration.attributes','SugarcrmConfiguration','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3b1084,_0x3e0063){var _0x2d1097=function(_0x2b2663){while(--_0x2b2663){_0x3b1084['push'](_0x3b1084['shift']());}};_0x2d1097(++_0x3e0063);}(_0xc2a7,0x116));var _0x7c2a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xc2a7[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x7c2a('0x0'));var logger=require(_0x7c2a('0x1'))(_0x7c2a('0x2'));var moment=require(_0x7c2a('0x3'));var BPromise=require(_0x7c2a('0x4'));var rp=require(_0x7c2a('0x5'));var fs=require('fs');var path=require(_0x7c2a('0x6'));var rimraf=require(_0x7c2a('0x7'));var config=require(_0x7c2a('0x8'));var attributes=require(_0x7c2a('0x9'));module['exports']=function(_0x1bd777,_0x484565){return _0x1bd777['define'](_0x7c2a('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','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 920cdc2..0026322 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 _0xa369=['request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xa369,0x95));var _0x9a36=function(_0x15732d,_0x2dc086){_0x15732d=_0x15732d-0x0;var _0x59939a=_0xa369[_0x15732d];return _0x59939a;};'use strict';var _=require(_0x9a36('0x0'));var util=require(_0x9a36('0x1'));var moment=require('moment');var BPromise=require(_0x9a36('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9a36('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9a36('0x4'))(_0x9a36('0x5'));var config=require(_0x9a36('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9a36('0x7')][_0x9a36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ca86a,_0x5831ab,_0x53b872){return new BPromise(function(_0x1c3d45,_0x3a7d8b){return client['request'](_0x2ca86a,_0x53b872)['then'](function(_0x49f20f){logger[_0x9a36('0x9')](_0x9a36('0xa'),_0x5831ab,_0x9a36('0xb'));logger[_0x9a36('0xc')](_0x9a36('0xd'),_0x5831ab,'request\x20sent',JSON[_0x9a36('0xe')](_0x49f20f));if(_0x49f20f[_0x9a36('0xf')]){if(_0x49f20f[_0x9a36('0xf')][_0x9a36('0x10')]===0x1f4){logger['error'](_0x9a36('0xa'),_0x5831ab,_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);return _0x3a7d8b(_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);}logger[_0x9a36('0xf')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5831ab,_0x49f20f[_0x9a36('0xf')][_0x9a36('0x11')]);return _0x1c3d45(_0x49f20f['error'][_0x9a36('0x11')]);}else{logger[_0x9a36('0x9')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5831ab,_0x9a36('0xb'));_0x1c3d45(_0x49f20f[_0x9a36('0x12')]['message']);}})[_0x9a36('0x13')](function(_0x456c5c){logger['error'](_0x9a36('0xa'),_0x5831ab,_0x456c5c);_0x3a7d8b(_0x456c5c);});});} \ No newline at end of file +var _0x06e7=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06e7,0x1eb));var _0x706e=function(_0x3f98d7,_0x51e3aa){_0x3f98d7=_0x3f98d7-0x0;var _0x2a5713=_0x06e7[_0x3f98d7];return _0x2a5713;};'use strict';var _=require(_0x706e('0x0'));var util=require(_0x706e('0x1'));var moment=require(_0x706e('0x2'));var BPromise=require(_0x706e('0x3'));var rs=require(_0x706e('0x4'));var fs=require('fs');var Redis=require(_0x706e('0x5'));var db=require(_0x706e('0x6'))['db'];var utils=require(_0x706e('0x7'));var logger=require('../../config/logger')(_0x706e('0x8'));var config=require(_0x706e('0x9'));var jayson=require(_0x706e('0xa'));var client=jayson[_0x706e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21975e,_0xca8a3a,_0x100173){return new BPromise(function(_0x5751c2,_0x27480d){return client['request'](_0x21975e,_0x100173)[_0x706e('0xc')](function(_0x4f6164){logger[_0x706e('0xd')](_0x706e('0xe'),_0xca8a3a,_0x706e('0xf'));logger[_0x706e('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0xca8a3a,'request\x20sent',JSON[_0x706e('0x11')](_0x4f6164));if(_0x4f6164['error']){if(_0x4f6164[_0x706e('0x12')][_0x706e('0x13')]===0x1f4){logger[_0x706e('0x12')](_0x706e('0xe'),_0xca8a3a,_0x4f6164['error']['message']);return _0x27480d(_0x4f6164['error'][_0x706e('0x14')]);}logger[_0x706e('0x12')](_0x706e('0xe'),_0xca8a3a,_0x4f6164[_0x706e('0x12')][_0x706e('0x14')]);return _0x5751c2(_0x4f6164[_0x706e('0x12')][_0x706e('0x14')]);}else{logger[_0x706e('0xd')](_0x706e('0xe'),_0xca8a3a,_0x706e('0xf'));_0x5751c2(_0x4f6164[_0x706e('0x15')][_0x706e('0x14')]);}})[_0x706e('0x16')](function(_0x47bf41){logger[_0x706e('0x12')](_0x706e('0xe'),_0xca8a3a,_0x47bf41);_0x27480d(_0x47bf41);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 5ad6e84..b6d53e4 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 _0xe628=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xe628,0x1dd));var _0x8e62=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0xe628[_0x3cbe1c];return _0x5ee08b;};'use strict';var multer=require(_0x8e62('0x0'));var util=require('util');var path=require(_0x8e62('0x1'));var timeout=require(_0x8e62('0x2'));var express=require(_0x8e62('0x3'));var router=express[_0x8e62('0x4')]();var fs_extra=require(_0x8e62('0x5'));var auth=require(_0x8e62('0x6'));var interaction=require(_0x8e62('0x7'));var config=require(_0x8e62('0x8'));var controller=require(_0x8e62('0x9'));router[_0x8e62('0xa')]('/',auth[_0x8e62('0xb')](),controller[_0x8e62('0xc')]);router[_0x8e62('0xa')](_0x8e62('0xd'),auth[_0x8e62('0xb')](),controller['show']);router[_0x8e62('0xe')]('/',auth['isAuthenticated'](),controller[_0x8e62('0xf')]);router[_0x8e62('0x10')](_0x8e62('0xd'),auth['isAuthenticated'](),controller[_0x8e62('0x11')]);router[_0x8e62('0x12')]('/:id',auth[_0x8e62('0xb')](),controller[_0x8e62('0x13')]);module[_0x8e62('0x14')]=router; \ No newline at end of file +var _0xa4f6=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy','exports','multer'];(function(_0xe38f5c,_0x5dc27d){var _0x18d71b=function(_0x12ac0f){while(--_0x12ac0f){_0xe38f5c['push'](_0xe38f5c['shift']());}};_0x18d71b(++_0x5dc27d);}(_0xa4f6,0x17b));var _0x6a4f=function(_0x659e68,_0x576f76){_0x659e68=_0x659e68-0x0;var _0x251ac9=_0xa4f6[_0x659e68];return _0x251ac9;};'use strict';var multer=require(_0x6a4f('0x0'));var util=require(_0x6a4f('0x1'));var path=require('path');var timeout=require(_0x6a4f('0x2'));var express=require(_0x6a4f('0x3'));var router=express[_0x6a4f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6a4f('0x5'));var interaction=require(_0x6a4f('0x6'));var config=require(_0x6a4f('0x7'));var controller=require(_0x6a4f('0x8'));router[_0x6a4f('0x9')]('/',auth[_0x6a4f('0xa')](),controller[_0x6a4f('0xb')]);router['get'](_0x6a4f('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6a4f('0xd')]('/',auth[_0x6a4f('0xa')](),controller[_0x6a4f('0xe')]);router[_0x6a4f('0xf')](_0x6a4f('0xc'),auth[_0x6a4f('0xa')](),controller[_0x6a4f('0x10')]);router['delete'](_0x6a4f('0xc'),auth[_0x6a4f('0xa')](),controller[_0x6a4f('0x11')]);module[_0x6a4f('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 0ca5d79..fb26d6d 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 _0x8215=['picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0xac3328,_0x23745a){var _0x33aec4=function(_0x476d1a){while(--_0x476d1a){_0xac3328['push'](_0xac3328['shift']());}};_0x33aec4(++_0x23745a);}(_0x8215,0x1e0));var _0x5821=function(_0x48362d,_0x98fe0f){_0x48362d=_0x48362d-0x0;var _0x424d87=_0x8215[_0x48362d];return _0x424d87;};'use strict';var Sequelize=require('sequelize');module[_0x5821('0x0')]={'type':{'type':Sequelize[_0x5821('0x1')](_0x5821('0x2'),_0x5821('0x3'),_0x5821('0x4'),_0x5821('0x5'),_0x5821('0x6')),'defaultValue':_0x5821('0x2')},'content':{'type':Sequelize[_0x5821('0x7')]},'key':{'type':Sequelize[_0x5821('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0x5821('0x3'),_0x5821('0x4'))},'keyContent':{'type':Sequelize[_0x5821('0x7')]},'idField':{'type':Sequelize[_0x5821('0x7')]},'nameField':{'type':Sequelize[_0x5821('0x7')]},'customField':{'type':Sequelize[_0x5821('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5821('0x7')]}}; \ No newline at end of file +var _0xd93a=['STRING','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x668a95,_0x35e63e){var _0x392de2=function(_0x1c22b6){while(--_0x1c22b6){_0x668a95['push'](_0x668a95['shift']());}};_0x392de2(++_0x35e63e);}(_0xd93a,0x1ba));var _0xad93=function(_0xd03316,_0x1f067a){_0xd03316=_0xd03316-0x0;var _0x3abb16=_0xd93a[_0xd03316];return _0x3abb16;};'use strict';var Sequelize=require(_0xad93('0x0'));module[_0xad93('0x1')]={'type':{'type':Sequelize[_0xad93('0x2')](_0xad93('0x3'),'variable',_0xad93('0x4'),_0xad93('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xad93('0x6')]},'key':{'type':Sequelize[_0xad93('0x6')]},'keyType':{'type':Sequelize[_0xad93('0x2')]('string','variable',_0xad93('0x4'))},'keyContent':{'type':Sequelize[_0xad93('0x6')]},'idField':{'type':Sequelize[_0xad93('0x6')]},'nameField':{'type':Sequelize[_0xad93('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xad93('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 543f227..6bf3de8 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 _0xb496=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','Content-Range','save','then','name','send','index','map','SugarcrmField','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','update','destroy','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x1fe8cd,_0x21ebd4){var _0x13ed2d=function(_0x4df507){while(--_0x4df507){_0x1fe8cd['push'](_0x1fe8cd['shift']());}};_0x13ed2d(++_0x21ebd4);}(_0xb496,0x1a5));var _0x6b49=function(_0x3adc3b,_0x595e7a){_0x3adc3b=_0x3adc3b-0x0;var _0x397532=_0xb496[_0x3adc3b];return _0x397532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b49('0x0'));var zipdir=require(_0x6b49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b49('0x2'));var moment=require('moment');var BPromise=require(_0x6b49('0x3'));var Mustache=require(_0x6b49('0x4'));var util=require(_0x6b49('0x5'));var path=require(_0x6b49('0x6'));var sox=require(_0x6b49('0x7'));var csv=require('to-csv');var ejs=require(_0x6b49('0x8'));var fs=require('fs');var fs_extra=require(_0x6b49('0x9'));var _=require(_0x6b49('0xa'));var squel=require(_0x6b49('0xb'));var crypto=require(_0x6b49('0xc'));var jsforce=require(_0x6b49('0xd'));var deskjs=require(_0x6b49('0xe'));var toCsv=require(_0x6b49('0xf'));var querystring=require(_0x6b49('0x10'));var Papa=require(_0x6b49('0x11'));var Redis=require(_0x6b49('0x12'));var authService=require(_0x6b49('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b49('0x14'));var logger=require(_0x6b49('0x15'))(_0x6b49('0x16'));var utils=require(_0x6b49('0x17'));var config=require(_0x6b49('0x18'));var licenseUtil=require(_0x6b49('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x41b7c0,_0x1f18d9){_0x1f18d9=_0x1f18d9||0xcc;return function(_0x5c91db){if(_0x5c91db){return _0x41b7c0[_0x6b49('0x1a')](_0x1f18d9);}return _0x41b7c0[_0x6b49('0x1b')](_0x1f18d9)[_0x6b49('0x1c')]();};}function respondWithResult(_0x90fd1a,_0x389983){_0x389983=_0x389983||0xc8;return function(_0x1375af){if(_0x1375af){return _0x90fd1a[_0x6b49('0x1b')](_0x389983)['json'](_0x1375af);}};}function respondWithFilteredResult(_0x31db34,_0x6d42f4){return function(_0x47fa99){if(_0x47fa99){var _0x37a4f3=typeof _0x6d42f4['offset']===_0x6b49('0x1d')&&typeof _0x6d42f4[_0x6b49('0x1e')]===_0x6b49('0x1d');var _0x3143f8=_0x47fa99[_0x6b49('0x1f')];var _0x5e58d9=_0x37a4f3?0x0:_0x6d42f4[_0x6b49('0x20')];var _0x27dff9=_0x37a4f3?_0x47fa99[_0x6b49('0x1f')]:_0x6d42f4['offset']+_0x6d42f4[_0x6b49('0x1e')];var _0x5d45a5;if(_0x27dff9>=_0x3143f8){_0x27dff9=_0x3143f8;_0x5d45a5=0xc8;}else{_0x5d45a5=0xce;}_0x31db34[_0x6b49('0x1b')](_0x5d45a5);return _0x31db34['set'](_0x6b49('0x21'),_0x5e58d9+'-'+_0x27dff9+'/'+_0x3143f8)['json'](_0x47fa99);}return null;};}function patchUpdates(_0xa483c5){return function(_0x227260){try{jsonpatch['apply'](_0x227260,_0xa483c5,!![]);}catch(_0x2770c6){return BPromise['reject'](_0x2770c6);}return _0x227260[_0x6b49('0x22')]();};}function saveUpdates(_0x5d9685,_0x15a842){return function(_0x36bb73){if(_0x36bb73){return _0x36bb73['update'](_0x5d9685)[_0x6b49('0x23')](function(_0x40c0b9){return _0x40c0b9;});}return null;};}function removeEntity(_0x3a62c3,_0x46a940){return function(_0x51c98c){if(_0x51c98c){return _0x51c98c['destroy']()[_0x6b49('0x23')](function(){_0x3a62c3[_0x6b49('0x1b')](0xcc)[_0x6b49('0x1c')]();});}};}function handleEntityNotFound(_0x2791c0,_0x50162e){return function(_0x4e5061){if(!_0x4e5061){_0x2791c0[_0x6b49('0x1a')](0x194);}return _0x4e5061;};}function handleError(_0x5b2c05,_0x139266){_0x139266=_0x139266||0x1f4;return function(_0x2996bb){logger['error'](_0x2996bb['stack']);if(_0x2996bb[_0x6b49('0x24')]){delete _0x2996bb['name'];}_0x5b2c05[_0x6b49('0x1b')](_0x139266)[_0x6b49('0x25')](_0x2996bb);};}exports[_0x6b49('0x26')]=function(_0x185354,_0x224474){var _0x226ff7={},_0x10cfcf={},_0x198e31={'count':0x0,'rows':[]};var _0x15771d=_[_0x6b49('0x27')](db[_0x6b49('0x28')]['rawAttributes'],function(_0x25c3e7){return{'name':_0x25c3e7[_0x6b49('0x29')],'type':_0x25c3e7[_0x6b49('0x2a')][_0x6b49('0x2b')]};});_0x10cfcf[_0x6b49('0x2c')]=_[_0x6b49('0x27')](_0x15771d,'name');_0x10cfcf[_0x6b49('0x2d')]=_[_0x6b49('0x2e')](_0x185354[_0x6b49('0x2d')]);_0x10cfcf['filters']=_[_0x6b49('0x2f')](_0x10cfcf[_0x6b49('0x2c')],_0x10cfcf[_0x6b49('0x2d')]);_0x226ff7[_0x6b49('0x30')]=_['intersection'](_0x10cfcf[_0x6b49('0x2c')],qs[_0x6b49('0x31')](_0x185354[_0x6b49('0x2d')]['fields']));_0x226ff7[_0x6b49('0x30')]=_0x226ff7[_0x6b49('0x30')][_0x6b49('0x32')]?_0x226ff7['attributes']:_0x10cfcf[_0x6b49('0x2c')];if(!_0x185354[_0x6b49('0x2d')][_0x6b49('0x33')](_0x6b49('0x34'))){_0x226ff7['limit']=qs['limit'](_0x185354[_0x6b49('0x2d')][_0x6b49('0x1e')]);_0x226ff7['offset']=qs['offset'](_0x185354[_0x6b49('0x2d')][_0x6b49('0x20')]);}_0x226ff7['order']=qs[_0x6b49('0x35')](_0x185354[_0x6b49('0x2d')][_0x6b49('0x35')]);_0x226ff7[_0x6b49('0x36')]=qs[_0x6b49('0x37')](_[_0x6b49('0x38')](_0x185354[_0x6b49('0x2d')],_0x10cfcf[_0x6b49('0x37')]),_0x15771d);if(_0x185354[_0x6b49('0x2d')][_0x6b49('0x39')]){_0x226ff7[_0x6b49('0x36')]=_[_0x6b49('0x3a')](_0x226ff7[_0x6b49('0x36')],{'$or':_[_0x6b49('0x27')](_0x15771d,function(_0x415b06){if(_0x415b06[_0x6b49('0x2a')]!==_0x6b49('0x3b')){var _0x28b6a5={};_0x28b6a5[_0x415b06[_0x6b49('0x24')]]={'$like':'%'+_0x185354[_0x6b49('0x2d')][_0x6b49('0x39')]+'%'};return _0x28b6a5;}})});}_0x226ff7=_[_0x6b49('0x3a')]({},_0x226ff7,_0x185354[_0x6b49('0x3c')]);var _0x5c392e={'where':_0x226ff7[_0x6b49('0x36')]};return db[_0x6b49('0x28')][_0x6b49('0x1f')](_0x5c392e)[_0x6b49('0x23')](function(_0x4bdfc7){_0x198e31[_0x6b49('0x1f')]=_0x4bdfc7;if(_0x185354[_0x6b49('0x2d')][_0x6b49('0x3d')]){_0x226ff7['include']=[{'all':!![]}];}return db[_0x6b49('0x28')][_0x6b49('0x3e')](_0x226ff7);})[_0x6b49('0x23')](function(_0x43023c){_0x198e31[_0x6b49('0x3f')]=_0x43023c;return _0x198e31;})[_0x6b49('0x23')](respondWithFilteredResult(_0x224474,_0x226ff7))[_0x6b49('0x40')](handleError(_0x224474,null));};exports[_0x6b49('0x41')]=function(_0x24656e,_0x4b3651){var _0x4ead8b={'raw':!![],'where':{'id':_0x24656e[_0x6b49('0x42')]['id']}},_0x12fbb1={};_0x12fbb1[_0x6b49('0x2c')]=_[_0x6b49('0x2e')](db[_0x6b49('0x28')][_0x6b49('0x43')]);_0x12fbb1[_0x6b49('0x2d')]=_[_0x6b49('0x2e')](_0x24656e[_0x6b49('0x2d')]);_0x12fbb1[_0x6b49('0x37')]=_[_0x6b49('0x2f')](_0x12fbb1['model'],_0x12fbb1[_0x6b49('0x2d')]);_0x4ead8b[_0x6b49('0x30')]=_[_0x6b49('0x2f')](_0x12fbb1[_0x6b49('0x2c')],qs[_0x6b49('0x31')](_0x24656e[_0x6b49('0x2d')]['fields']));_0x4ead8b['attributes']=_0x4ead8b['attributes'][_0x6b49('0x32')]?_0x4ead8b['attributes']:_0x12fbb1[_0x6b49('0x2c')];if(_0x24656e[_0x6b49('0x2d')][_0x6b49('0x3d')]){_0x4ead8b[_0x6b49('0x44')]=[{'all':!![]}];}_0x4ead8b=_[_0x6b49('0x3a')]({},_0x4ead8b,_0x24656e[_0x6b49('0x3c')]);return db['SugarcrmField'][_0x6b49('0x45')](_0x4ead8b)[_0x6b49('0x23')](handleEntityNotFound(_0x4b3651,null))[_0x6b49('0x23')](respondWithResult(_0x4b3651,null))[_0x6b49('0x40')](handleError(_0x4b3651,null));};exports[_0x6b49('0x46')]=function(_0x294196,_0x337077){return db[_0x6b49('0x28')][_0x6b49('0x46')](_0x294196[_0x6b49('0x47')],{})[_0x6b49('0x23')](respondWithResult(_0x337077,0xc9))[_0x6b49('0x40')](handleError(_0x337077,null));};exports[_0x6b49('0x48')]=function(_0xdb769f,_0x3b9662){if(_0xdb769f['body']['id']){delete _0xdb769f[_0x6b49('0x47')]['id'];}return db[_0x6b49('0x28')][_0x6b49('0x45')]({'where':{'id':_0xdb769f[_0x6b49('0x42')]['id']}})['then'](handleEntityNotFound(_0x3b9662,null))['then'](saveUpdates(_0xdb769f['body'],null))[_0x6b49('0x23')](respondWithResult(_0x3b9662,null))['catch'](handleError(_0x3b9662,null));};exports[_0x6b49('0x49')]=function(_0x5c94b1,_0xed6790){return db[_0x6b49('0x28')][_0x6b49('0x45')]({'where':{'id':_0x5c94b1[_0x6b49('0x42')]['id']}})[_0x6b49('0x23')](handleEntityNotFound(_0xed6790,null))[_0x6b49('0x23')](removeEntity(_0xed6790,null))[_0x6b49('0x40')](handleError(_0xed6790,null));}; \ No newline at end of file +var _0x1ec6=['path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','index','map','SugarcrmField','fieldName','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','find','create','catch','update','body','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1ec6,0x125));var _0x61ec=function(_0x4a7145,_0x14c18b){_0x4a7145=_0x4a7145-0x0;var _0x9e46d5=_0x1ec6[_0x4a7145];return _0x9e46d5;};'use strict';var emlformat=require(_0x61ec('0x0'));var rimraf=require(_0x61ec('0x1'));var zipdir=require(_0x61ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x61ec('0x3'));var BPromise=require(_0x61ec('0x4'));var Mustache=require(_0x61ec('0x5'));var util=require(_0x61ec('0x6'));var path=require(_0x61ec('0x7'));var sox=require(_0x61ec('0x8'));var csv=require(_0x61ec('0x9'));var ejs=require(_0x61ec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x61ec('0xb'));var squel=require(_0x61ec('0xc'));var crypto=require(_0x61ec('0xd'));var jsforce=require(_0x61ec('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x61ec('0xf'));var Papa=require(_0x61ec('0x10'));var Redis=require('ioredis');var authService=require(_0x61ec('0x11'));var qs=require(_0x61ec('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x61ec('0x13'))(_0x61ec('0x14'));var utils=require(_0x61ec('0x15'));var config=require(_0x61ec('0x16'));var licenseUtil=require(_0x61ec('0x17'));var db=require(_0x61ec('0x18'))['db'];function respondWithStatusCode(_0x56406f,_0x2ac83a){_0x2ac83a=_0x2ac83a||0xcc;return function(_0x5cb9bc){if(_0x5cb9bc){return _0x56406f['sendStatus'](_0x2ac83a);}return _0x56406f['status'](_0x2ac83a)[_0x61ec('0x19')]();};}function respondWithResult(_0x4f75b8,_0x3de1f8){_0x3de1f8=_0x3de1f8||0xc8;return function(_0x2c0d02){if(_0x2c0d02){return _0x4f75b8[_0x61ec('0x1a')](_0x3de1f8)[_0x61ec('0x1b')](_0x2c0d02);}};}function respondWithFilteredResult(_0x39131e,_0x195fec){return function(_0x21ae4c){if(_0x21ae4c){var _0x5480d8=typeof _0x195fec[_0x61ec('0x1c')]==='undefined'&&typeof _0x195fec[_0x61ec('0x1d')]===_0x61ec('0x1e');var _0x134bbb=_0x21ae4c[_0x61ec('0x1f')];var _0x17a587=_0x5480d8?0x0:_0x195fec['offset'];var _0x9a4ccc=_0x5480d8?_0x21ae4c[_0x61ec('0x1f')]:_0x195fec[_0x61ec('0x1c')]+_0x195fec[_0x61ec('0x1d')];var _0x27774f;if(_0x9a4ccc>=_0x134bbb){_0x9a4ccc=_0x134bbb;_0x27774f=0xc8;}else{_0x27774f=0xce;}_0x39131e[_0x61ec('0x1a')](_0x27774f);return _0x39131e[_0x61ec('0x20')](_0x61ec('0x21'),_0x17a587+'-'+_0x9a4ccc+'/'+_0x134bbb)[_0x61ec('0x1b')](_0x21ae4c);}return null;};}function patchUpdates(_0x5eb05d){return function(_0x111e2c){try{jsonpatch[_0x61ec('0x22')](_0x111e2c,_0x5eb05d,!![]);}catch(_0x3e257a){return BPromise[_0x61ec('0x23')](_0x3e257a);}return _0x111e2c[_0x61ec('0x24')]();};}function saveUpdates(_0xfc08b9,_0x267675){return function(_0xc7c59){if(_0xc7c59){return _0xc7c59['update'](_0xfc08b9)[_0x61ec('0x25')](function(_0x4c8e24){return _0x4c8e24;});}return null;};}function removeEntity(_0x499056,_0x4be430){return function(_0xd06259){if(_0xd06259){return _0xd06259[_0x61ec('0x26')]()['then'](function(){_0x499056[_0x61ec('0x1a')](0xcc)[_0x61ec('0x19')]();});}};}function handleEntityNotFound(_0x5ca8f8,_0x71a072){return function(_0x257c43){if(!_0x257c43){_0x5ca8f8['sendStatus'](0x194);}return _0x257c43;};}function handleError(_0x4a3607,_0x378527){_0x378527=_0x378527||0x1f4;return function(_0x354d09){logger[_0x61ec('0x27')](_0x354d09[_0x61ec('0x28')]);if(_0x354d09[_0x61ec('0x29')]){delete _0x354d09[_0x61ec('0x29')];}_0x4a3607[_0x61ec('0x1a')](_0x378527)['send'](_0x354d09);};}exports[_0x61ec('0x2a')]=function(_0x49b59a,_0x53e5b0){var _0x374f1b={},_0x2721a4={},_0x2dec68={'count':0x0,'rows':[]};var _0xcc42=_[_0x61ec('0x2b')](db[_0x61ec('0x2c')]['rawAttributes'],function(_0x42a87f){return{'name':_0x42a87f[_0x61ec('0x2d')],'type':_0x42a87f['type']['key']};});_0x2721a4[_0x61ec('0x2e')]=_[_0x61ec('0x2b')](_0xcc42,_0x61ec('0x29'));_0x2721a4[_0x61ec('0x2f')]=_['keys'](_0x49b59a[_0x61ec('0x2f')]);_0x2721a4[_0x61ec('0x30')]=_['intersection'](_0x2721a4[_0x61ec('0x2e')],_0x2721a4[_0x61ec('0x2f')]);_0x374f1b[_0x61ec('0x31')]=_[_0x61ec('0x32')](_0x2721a4['model'],qs[_0x61ec('0x33')](_0x49b59a[_0x61ec('0x2f')][_0x61ec('0x33')]));_0x374f1b['attributes']=_0x374f1b['attributes'][_0x61ec('0x34')]?_0x374f1b[_0x61ec('0x31')]:_0x2721a4[_0x61ec('0x2e')];if(!_0x49b59a[_0x61ec('0x2f')][_0x61ec('0x35')](_0x61ec('0x36'))){_0x374f1b[_0x61ec('0x1d')]=qs[_0x61ec('0x1d')](_0x49b59a[_0x61ec('0x2f')][_0x61ec('0x1d')]);_0x374f1b[_0x61ec('0x1c')]=qs[_0x61ec('0x1c')](_0x49b59a['query'][_0x61ec('0x1c')]);}_0x374f1b[_0x61ec('0x37')]=qs['sort'](_0x49b59a[_0x61ec('0x2f')]['sort']);_0x374f1b['where']=qs[_0x61ec('0x30')](_[_0x61ec('0x38')](_0x49b59a[_0x61ec('0x2f')],_0x2721a4['filters']),_0xcc42);if(_0x49b59a['query']['filter']){_0x374f1b[_0x61ec('0x39')]=_[_0x61ec('0x3a')](_0x374f1b['where'],{'$or':_[_0x61ec('0x2b')](_0xcc42,function(_0x3d8a29){if(_0x3d8a29[_0x61ec('0x3b')]!==_0x61ec('0x3c')){var _0x148c1c={};_0x148c1c[_0x3d8a29[_0x61ec('0x29')]]={'$like':'%'+_0x49b59a[_0x61ec('0x2f')][_0x61ec('0x3d')]+'%'};return _0x148c1c;}})});}_0x374f1b=_[_0x61ec('0x3a')]({},_0x374f1b,_0x49b59a[_0x61ec('0x3e')]);var _0x43cc9b={'where':_0x374f1b['where']};return db[_0x61ec('0x2c')][_0x61ec('0x1f')](_0x43cc9b)[_0x61ec('0x25')](function(_0x19c6f1){_0x2dec68[_0x61ec('0x1f')]=_0x19c6f1;if(_0x49b59a[_0x61ec('0x2f')][_0x61ec('0x3f')]){_0x374f1b[_0x61ec('0x40')]=[{'all':!![]}];}return db[_0x61ec('0x2c')][_0x61ec('0x41')](_0x374f1b);})[_0x61ec('0x25')](function(_0x5b31af){_0x2dec68[_0x61ec('0x42')]=_0x5b31af;return _0x2dec68;})[_0x61ec('0x25')](respondWithFilteredResult(_0x53e5b0,_0x374f1b))['catch'](handleError(_0x53e5b0,null));};exports[_0x61ec('0x43')]=function(_0x555517,_0x37ca54){var _0x2fc2df={'raw':!![],'where':{'id':_0x555517[_0x61ec('0x44')]['id']}},_0x511d61={};_0x511d61[_0x61ec('0x2e')]=_['keys'](db[_0x61ec('0x2c')]['rawAttributes']);_0x511d61[_0x61ec('0x2f')]=_[_0x61ec('0x45')](_0x555517[_0x61ec('0x2f')]);_0x511d61['filters']=_[_0x61ec('0x32')](_0x511d61[_0x61ec('0x2e')],_0x511d61[_0x61ec('0x2f')]);_0x2fc2df[_0x61ec('0x31')]=_[_0x61ec('0x32')](_0x511d61[_0x61ec('0x2e')],qs[_0x61ec('0x33')](_0x555517['query'][_0x61ec('0x33')]));_0x2fc2df[_0x61ec('0x31')]=_0x2fc2df[_0x61ec('0x31')][_0x61ec('0x34')]?_0x2fc2df[_0x61ec('0x31')]:_0x511d61[_0x61ec('0x2e')];if(_0x555517[_0x61ec('0x2f')][_0x61ec('0x3f')]){_0x2fc2df['include']=[{'all':!![]}];}_0x2fc2df=_[_0x61ec('0x3a')]({},_0x2fc2df,_0x555517[_0x61ec('0x3e')]);return db[_0x61ec('0x2c')][_0x61ec('0x46')](_0x2fc2df)[_0x61ec('0x25')](handleEntityNotFound(_0x37ca54,null))[_0x61ec('0x25')](respondWithResult(_0x37ca54,null))['catch'](handleError(_0x37ca54,null));};exports[_0x61ec('0x47')]=function(_0x4342bc,_0x2e7b2d){return db[_0x61ec('0x2c')][_0x61ec('0x47')](_0x4342bc['body'],{})[_0x61ec('0x25')](respondWithResult(_0x2e7b2d,0xc9))[_0x61ec('0x48')](handleError(_0x2e7b2d,null));};exports[_0x61ec('0x49')]=function(_0x5919a6,_0x370ad7){if(_0x5919a6[_0x61ec('0x4a')]['id']){delete _0x5919a6['body']['id'];}return db[_0x61ec('0x2c')][_0x61ec('0x46')]({'where':{'id':_0x5919a6['params']['id']}})['then'](handleEntityNotFound(_0x370ad7,null))[_0x61ec('0x25')](saveUpdates(_0x5919a6[_0x61ec('0x4a')],null))[_0x61ec('0x25')](respondWithResult(_0x370ad7,null))[_0x61ec('0x48')](handleError(_0x370ad7,null));};exports[_0x61ec('0x26')]=function(_0x1faf89,_0x5d2fa7){return db[_0x61ec('0x2c')]['find']({'where':{'id':_0x1faf89[_0x61ec('0x44')]['id']}})[_0x61ec('0x25')](handleEntityNotFound(_0x5d2fa7,null))[_0x61ec('0x25')](removeEntity(_0x5d2fa7,null))[_0x61ec('0x48')](handleError(_0x5d2fa7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 02c76d8..0a20f9b 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 _0xdfe1=['FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField'];(function(_0x487f9e,_0x1826b5){var _0x2a1476=function(_0xf9207){while(--_0xf9207){_0x487f9e['push'](_0x487f9e['shift']());}};_0x2a1476(++_0x1826b5);}(_0xdfe1,0x1a5));var _0x1dfe=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdfe1[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1dfe('0x0'));var util=require(_0x1dfe('0x1'));var logger=require('../../config/logger')(_0x1dfe('0x2'));var moment=require('moment');var BPromise=require(_0x1dfe('0x3'));var rp=require(_0x1dfe('0x4'));var fs=require('fs');var path=require(_0x1dfe('0x5'));var rimraf=require(_0x1dfe('0x6'));var config=require('../../config/environment');var attributes=require(_0x1dfe('0x7'));module[_0x1dfe('0x8')]=function(_0x507fb9,_0x5056a9){return _0x507fb9[_0x1dfe('0x9')](_0x1dfe('0xa'),attributes,{'tableName':_0x1dfe('0xb'),'paranoid':![],'indexes':[{'name':_0x1dfe('0xc'),'fields':[_0x1dfe('0xd'),_0x1dfe('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x680e=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','FieldId','lodash','util','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports'];(function(_0x900f09,_0x3e2e3e){var _0xdbd47=function(_0x55fd10){while(--_0x55fd10){_0x900f09['push'](_0x900f09['shift']());}};_0xdbd47(++_0x3e2e3e);}(_0x680e,0x1d8));var _0xe680=function(_0x5555b8,_0x38c118){_0x5555b8=_0x5555b8-0x0;var _0x215c59=_0x680e[_0x5555b8];return _0x215c59;};'use strict';var _=require(_0xe680('0x0'));var util=require(_0xe680('0x1'));var logger=require('../../config/logger')(_0xe680('0x2'));var moment=require(_0xe680('0x3'));var BPromise=require(_0xe680('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe680('0x5'));var rimraf=require(_0xe680('0x6'));var config=require('../../config/environment');var attributes=require(_0xe680('0x7'));module[_0xe680('0x8')]=function(_0x474d1b,_0x3e987f){return _0x474d1b['define'](_0xe680('0x9'),attributes,{'tableName':_0xe680('0xa'),'paranoid':![],'indexes':[{'name':_0xe680('0xb'),'fields':['idField',_0xe680('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 8584286..da0fd07 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 _0x5226=['request\x20sent','error','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s'];(function(_0x8c81c0,_0x57b150){var _0x160a3e=function(_0x10abca){while(--_0x10abca){_0x8c81c0['push'](_0x8c81c0['shift']());}};_0x160a3e(++_0x57b150);}(_0x5226,0x91));var _0x6522=function(_0x5ab975,_0x2a4e4d){_0x5ab975=_0x5ab975-0x0;var _0x3b1df6=_0x5226[_0x5ab975];return _0x3b1df6;};'use strict';var _=require(_0x6522('0x0'));var util=require(_0x6522('0x1'));var moment=require(_0x6522('0x2'));var BPromise=require('bluebird');var rs=require(_0x6522('0x3'));var fs=require('fs');var Redis=require(_0x6522('0x4'));var db=require(_0x6522('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6522('0x6'))(_0x6522('0x7'));var config=require(_0x6522('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6522('0x9')][_0x6522('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6ef3,_0x58ba64,_0x3081f3){return new BPromise(function(_0x5eae0a,_0x5120b6){return client[_0x6522('0xb')](_0x1b6ef3,_0x3081f3)[_0x6522('0xc')](function(_0x4bb287){logger['info'](_0x6522('0xd'),_0x58ba64,'request\x20sent');logger['debug'](_0x6522('0xe'),_0x58ba64,_0x6522('0xf'),JSON['stringify'](_0x4bb287));if(_0x4bb287['error']){if(_0x4bb287['error']['code']===0x1f4){logger[_0x6522('0x10')](_0x6522('0xd'),_0x58ba64,_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);return _0x5120b6(_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);}logger[_0x6522('0x10')](_0x6522('0xd'),_0x58ba64,_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);return _0x5eae0a(_0x4bb287[_0x6522('0x10')][_0x6522('0x11')]);}else{logger[_0x6522('0x12')](_0x6522('0xd'),_0x58ba64,_0x6522('0xf'));_0x5eae0a(_0x4bb287['result']['message']);}})[_0x6522('0x13')](function(_0x2d2ba8){logger['error'](_0x6522('0xd'),_0x58ba64,_0x2d2ba8);_0x5120b6(_0x2d2ba8);});});} \ No newline at end of file +var _0xfe2a=['../../config/environment','jayson/promise','client','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfe2a,0x10c));var _0xafe2=function(_0x53b53e,_0x498437){_0x53b53e=_0x53b53e-0x0;var _0xbb6179=_0xfe2a[_0x53b53e];return _0xbb6179;};'use strict';var _=require('lodash');var util=require(_0xafe2('0x0'));var moment=require(_0xafe2('0x1'));var BPromise=require('bluebird');var rs=require(_0xafe2('0x2'));var fs=require('fs');var Redis=require(_0xafe2('0x3'));var db=require(_0xafe2('0x4'))['db'];var utils=require(_0xafe2('0x5'));var logger=require(_0xafe2('0x6'))(_0xafe2('0x7'));var config=require(_0xafe2('0x8'));var jayson=require(_0xafe2('0x9'));var client=jayson[_0xafe2('0xa')][_0xafe2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc52c15,_0x4bd352,_0x260e05){return new BPromise(function(_0x50f570,_0x2b9d26){return client[_0xafe2('0xc')](_0xc52c15,_0x260e05)[_0xafe2('0xd')](function(_0x29076d){logger['info'](_0xafe2('0xe'),_0x4bd352,_0xafe2('0xf'));logger[_0xafe2('0x10')](_0xafe2('0x11'),_0x4bd352,_0xafe2('0xf'),JSON['stringify'](_0x29076d));if(_0x29076d[_0xafe2('0x12')]){if(_0x29076d['error']['code']===0x1f4){logger[_0xafe2('0x12')](_0xafe2('0xe'),_0x4bd352,_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);return _0x2b9d26(_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);}logger['error'](_0xafe2('0xe'),_0x4bd352,_0x29076d['error'][_0xafe2('0x13')]);return _0x50f570(_0x29076d[_0xafe2('0x12')][_0xafe2('0x13')]);}else{logger[_0xafe2('0x14')](_0xafe2('0xe'),_0x4bd352,_0xafe2('0xf'));_0x50f570(_0x29076d[_0xafe2('0x15')][_0xafe2('0x13')]);}})[_0xafe2('0x16')](function(_0x344f35){logger['error'](_0xafe2('0xe'),_0x4bd352,_0x344f35);_0x2b9d26(_0x344f35);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ae385a4..c6300ae 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 _0x46b3=['isAuthenticated','index','/:id','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0xdf9b9a,_0x31f402){var _0x201815=function(_0x1f111d){while(--_0x1f111d){_0xdf9b9a['push'](_0xdf9b9a['shift']());}};_0x201815(++_0x31f402);}(_0x46b3,0x194));var _0x346b=function(_0x5b718d,_0x84cf8b){_0x5b718d=_0x5b718d-0x0;var _0x654fd4=_0x46b3[_0x5b718d];return _0x654fd4;};'use strict';var multer=require(_0x346b('0x0'));var util=require(_0x346b('0x1'));var path=require(_0x346b('0x2'));var timeout=require(_0x346b('0x3'));var express=require(_0x346b('0x4'));var router=express['Router']();var fs_extra=require(_0x346b('0x5'));var auth=require(_0x346b('0x6'));var interaction=require(_0x346b('0x7'));var config=require(_0x346b('0x8'));var controller=require(_0x346b('0x9'));router['get']('/',auth[_0x346b('0xa')](),controller[_0x346b('0xb')]);router['get'](_0x346b('0xc'),auth[_0x346b('0xa')](),controller['show']);router[_0x346b('0xd')](_0x346b('0xe'),auth[_0x346b('0xa')](),controller[_0x346b('0xf')]);router[_0x346b('0xd')](_0x346b('0x10'),auth[_0x346b('0xa')](),controller[_0x346b('0x11')]);router[_0x346b('0x12')]('/',auth['isAuthenticated'](),controller[_0x346b('0x13')]);router[_0x346b('0x12')]('/:id/configurations',auth[_0x346b('0xa')](),controller[_0x346b('0x14')]);router['put'](_0x346b('0xc'),auth[_0x346b('0xa')](),controller['update']);router['delete'](_0x346b('0xc'),auth[_0x346b('0xa')](),controller[_0x346b('0x15')]);module[_0x346b('0x16')]=router; \ No newline at end of file +var _0xc997=['/:id/fields','getFields','create','post','/:id/configurations','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','show','getConfigurations'];(function(_0x2a8b21,_0x5cd96b){var _0x114314=function(_0xd17a7){while(--_0xd17a7){_0x2a8b21['push'](_0x2a8b21['shift']());}};_0x114314(++_0x5cd96b);}(_0xc997,0x1ac));var _0x7c99=function(_0x396e83,_0x2d51e2){_0x396e83=_0x396e83-0x0;var _0x4a42cc=_0xc997[_0x396e83];return _0x4a42cc;};'use strict';var multer=require('multer');var util=require(_0x7c99('0x0'));var path=require(_0x7c99('0x1'));var timeout=require(_0x7c99('0x2'));var express=require(_0x7c99('0x3'));var router=express[_0x7c99('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7c99('0x5'));var interaction=require(_0x7c99('0x6'));var config=require(_0x7c99('0x7'));var controller=require(_0x7c99('0x8'));router[_0x7c99('0x9')]('/',auth[_0x7c99('0xa')](),controller[_0x7c99('0xb')]);router[_0x7c99('0x9')]('/:id',auth[_0x7c99('0xa')](),controller[_0x7c99('0xc')]);router[_0x7c99('0x9')]('/:id/configurations',auth[_0x7c99('0xa')](),controller[_0x7c99('0xd')]);router['get'](_0x7c99('0xe'),auth['isAuthenticated'](),controller[_0x7c99('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7c99('0x10')]);router[_0x7c99('0x11')](_0x7c99('0x12'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x13')]);router[_0x7c99('0x14')](_0x7c99('0x15'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x16')]);router[_0x7c99('0x17')](_0x7c99('0x15'),auth[_0x7c99('0xa')](),controller[_0x7c99('0x18')]);module[_0x7c99('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index ceffccb..f0185ca 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 _0x3e71=['HelpDesk','sequelize','exports','STRING'];(function(_0x46aab9,_0xb15587){var _0x200987=function(_0x1559da){while(--_0x1559da){_0x46aab9['push'](_0x46aab9['shift']());}};_0x200987(++_0xb15587);}(_0x3e71,0x81));var _0x13e7=function(_0xab82b0,_0x34d3ea){_0xab82b0=_0xab82b0-0x0;var _0x34763a=_0x3e71[_0xab82b0];return _0x34763a;};'use strict';var Sequelize=require(_0x13e7('0x0'));module[_0x13e7('0x1')]={'name':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x13e7('0x2')]},'username':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![],'defaultValue':_0x13e7('0x3')},'remoteUri':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x13e7('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x26a2=['exports','STRING','HelpDesk','sequelize'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x26a2,0x15b));var _0x226a=function(_0x4b4c29,_0x4cfcf3){_0x4b4c29=_0x4b4c29-0x0;var _0x2b1e78=_0x26a2[_0x4b4c29];return _0x2b1e78;};'use strict';var Sequelize=require(_0x226a('0x0'));module[_0x226a('0x1')]={'name':{'type':Sequelize[_0x226a('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x226a('0x2')],'allowNull':![],'defaultValue':_0x226a('0x3')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x226a('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index f18290b..0024bfb 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 _0x0170=['offset','undefined','count','limit','set','apply','reject','update','then','destroy','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerConfiguration','VtigerField','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','format','GET','success','POST','result','token','describe','sessionName','autogenerated','reference','remove','includes','editable','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x128bef,_0xc7a0af){var _0x1ba862=function(_0x4858e8){while(--_0x4858e8){_0x128bef['push'](_0x128bef['shift']());}};_0x1ba862(++_0xc7a0af);}(_0x0170,0x156));var _0x0017=function(_0x1e44e1,_0x3c5b37){_0x1e44e1=_0x1e44e1-0x0;var _0x14cd1f=_0x0170[_0x1e44e1];return _0x14cd1f;};'use strict';var emlformat=require(_0x0017('0x0'));var rimraf=require(_0x0017('0x1'));var zipdir=require(_0x0017('0x2'));var jsonpatch=require(_0x0017('0x3'));var rp=require(_0x0017('0x4'));var moment=require(_0x0017('0x5'));var BPromise=require(_0x0017('0x6'));var Mustache=require(_0x0017('0x7'));var util=require(_0x0017('0x8'));var path=require(_0x0017('0x9'));var sox=require(_0x0017('0xa'));var csv=require(_0x0017('0xb'));var ejs=require(_0x0017('0xc'));var fs=require('fs');var fs_extra=require(_0x0017('0xd'));var _=require('lodash');var squel=require(_0x0017('0xe'));var crypto=require(_0x0017('0xf'));var jsforce=require(_0x0017('0x10'));var deskjs=require(_0x0017('0x11'));var toCsv=require(_0x0017('0xb'));var querystring=require(_0x0017('0x12'));var Papa=require(_0x0017('0x13'));var Redis=require(_0x0017('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0017('0x15'));var logger=require(_0x0017('0x16'))(_0x0017('0x17'));var utils=require('../../config/utils');var config=require(_0x0017('0x18'));var licenseUtil=require(_0x0017('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0017('0x1a'));function respondWithStatusCode(_0x172031,_0x350260){_0x350260=_0x350260||0xcc;return function(_0xc2cd9f){if(_0xc2cd9f){return _0x172031[_0x0017('0x1b')](_0x350260);}return _0x172031[_0x0017('0x1c')](_0x350260)[_0x0017('0x1d')]();};}function respondWithResult(_0x13bd9a,_0x57ce77){_0x57ce77=_0x57ce77||0xc8;return function(_0x5d76a2){if(_0x5d76a2){return _0x13bd9a[_0x0017('0x1c')](_0x57ce77)['json'](_0x5d76a2);}};}function respondWithFilteredResult(_0x5bbde0,_0x2bdebc){return function(_0x40f312){if(_0x40f312){var _0x547181=typeof _0x2bdebc[_0x0017('0x1e')]===_0x0017('0x1f')&&typeof _0x2bdebc['limit']===_0x0017('0x1f');var _0x5e5039=_0x40f312[_0x0017('0x20')];var _0x23a39f=_0x547181?0x0:_0x2bdebc['offset'];var _0x106430=_0x547181?_0x40f312['count']:_0x2bdebc[_0x0017('0x1e')]+_0x2bdebc[_0x0017('0x21')];var _0x3da9c8;if(_0x106430>=_0x5e5039){_0x106430=_0x5e5039;_0x3da9c8=0xc8;}else{_0x3da9c8=0xce;}_0x5bbde0[_0x0017('0x1c')](_0x3da9c8);return _0x5bbde0[_0x0017('0x22')]('Content-Range',_0x23a39f+'-'+_0x106430+'/'+_0x5e5039)['json'](_0x40f312);}return null;};}function patchUpdates(_0x52bd26){return function(_0x331493){try{jsonpatch[_0x0017('0x23')](_0x331493,_0x52bd26,!![]);}catch(_0x3864f3){return BPromise[_0x0017('0x24')](_0x3864f3);}return _0x331493['save']();};}function saveUpdates(_0x3f080a,_0x19a664){return function(_0x2766e0){if(_0x2766e0){return _0x2766e0[_0x0017('0x25')](_0x3f080a)[_0x0017('0x26')](function(_0x12df1d){return _0x12df1d;});}return null;};}function removeEntity(_0x56f124,_0x292848){return function(_0x4b0532){if(_0x4b0532){return _0x4b0532[_0x0017('0x27')]()[_0x0017('0x26')](function(){_0x56f124[_0x0017('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13daca,_0x2e8583){return function(_0x26a422){if(!_0x26a422){_0x13daca['sendStatus'](0x194);}return _0x26a422;};}function handleError(_0x5cea5a,_0x415bd9){_0x415bd9=_0x415bd9||0x1f4;return function(_0x463940){logger[_0x0017('0x28')](_0x463940[_0x0017('0x29')]);if(_0x463940[_0x0017('0x2a')]){delete _0x463940['name'];}_0x5cea5a[_0x0017('0x1c')](_0x415bd9)['send'](_0x463940);};}exports[_0x0017('0x2b')]=function(_0x1547e6,_0x4dce0b){var _0x51687e={},_0x29ec6d={},_0x240e4d={'count':0x0,'rows':[]};var _0x289a5f=_[_0x0017('0x2c')](db[_0x0017('0x2d')][_0x0017('0x2e')],function(_0x579a9d){return{'name':_0x579a9d[_0x0017('0x2f')],'type':_0x579a9d[_0x0017('0x30')][_0x0017('0x31')]};});_0x29ec6d['model']=_['map'](_0x289a5f,'name');_0x29ec6d[_0x0017('0x32')]=_['keys'](_0x1547e6[_0x0017('0x32')]);_0x29ec6d['filters']=_['intersection'](_0x29ec6d[_0x0017('0x33')],_0x29ec6d[_0x0017('0x32')]);_0x51687e[_0x0017('0x34')]=_[_0x0017('0x35')](_0x29ec6d[_0x0017('0x33')],qs[_0x0017('0x36')](_0x1547e6[_0x0017('0x32')]['fields']));_0x51687e[_0x0017('0x34')]=_0x51687e['attributes'][_0x0017('0x37')]?_0x51687e[_0x0017('0x34')]:_0x29ec6d[_0x0017('0x33')];if(!_0x1547e6[_0x0017('0x32')][_0x0017('0x38')](_0x0017('0x39'))){_0x51687e[_0x0017('0x21')]=qs['limit'](_0x1547e6[_0x0017('0x32')][_0x0017('0x21')]);_0x51687e[_0x0017('0x1e')]=qs[_0x0017('0x1e')](_0x1547e6[_0x0017('0x32')]['offset']);}_0x51687e[_0x0017('0x3a')]=qs['sort'](_0x1547e6[_0x0017('0x32')][_0x0017('0x3b')]);_0x51687e[_0x0017('0x3c')]=qs[_0x0017('0x3d')](_[_0x0017('0x3e')](_0x1547e6[_0x0017('0x32')],_0x29ec6d[_0x0017('0x3d')]),_0x289a5f);if(_0x1547e6[_0x0017('0x32')][_0x0017('0x3f')]){_0x51687e[_0x0017('0x3c')]=_[_0x0017('0x40')](_0x51687e[_0x0017('0x3c')],{'$or':_['map'](_0x289a5f,function(_0x2f8a2f){if(_0x2f8a2f['type']!==_0x0017('0x41')){var _0x2b372f={};_0x2b372f[_0x2f8a2f[_0x0017('0x2a')]]={'$like':'%'+_0x1547e6[_0x0017('0x32')][_0x0017('0x3f')]+'%'};return _0x2b372f;}})});}_0x51687e=_[_0x0017('0x40')]({},_0x51687e,_0x1547e6[_0x0017('0x42')]);var _0x3e699b={'where':_0x51687e[_0x0017('0x3c')]};return db[_0x0017('0x2d')][_0x0017('0x20')](_0x3e699b)[_0x0017('0x26')](function(_0x56effe){_0x240e4d['count']=_0x56effe;if(_0x1547e6[_0x0017('0x32')][_0x0017('0x43')]){_0x51687e[_0x0017('0x44')]=[{'all':!![]}];}return db[_0x0017('0x2d')][_0x0017('0x45')](_0x51687e);})[_0x0017('0x26')](function(_0x145ef5){_0x240e4d[_0x0017('0x46')]=_0x145ef5;return _0x240e4d;})['then'](respondWithFilteredResult(_0x4dce0b,_0x51687e))[_0x0017('0x47')](handleError(_0x4dce0b,null));};exports[_0x0017('0x48')]=function(_0x185fee,_0x6f52bb){var _0xa8b28d={'raw':![],'where':{'id':_0x185fee[_0x0017('0x49')]['id']}},_0x5dc6a6={};_0x5dc6a6['model']=_[_0x0017('0x4a')](db[_0x0017('0x2d')][_0x0017('0x2e')]);_0x5dc6a6['query']=_[_0x0017('0x4a')](_0x185fee[_0x0017('0x32')]);_0x5dc6a6[_0x0017('0x3d')]=_[_0x0017('0x35')](_0x5dc6a6['model'],_0x5dc6a6[_0x0017('0x32')]);_0xa8b28d[_0x0017('0x34')]=_[_0x0017('0x35')](_0x5dc6a6[_0x0017('0x33')],qs[_0x0017('0x36')](_0x185fee['query'][_0x0017('0x36')]));_0xa8b28d[_0x0017('0x34')]=_0xa8b28d[_0x0017('0x34')][_0x0017('0x37')]?_0xa8b28d[_0x0017('0x34')]:_0x5dc6a6['model'];if(_0x185fee[_0x0017('0x32')][_0x0017('0x43')]){_0xa8b28d[_0x0017('0x44')]=[{'all':!![]}];}_0xa8b28d=_[_0x0017('0x40')]({},_0xa8b28d,_0x185fee[_0x0017('0x42')]);return db[_0x0017('0x2d')][_0x0017('0x4b')](_0xa8b28d)[_0x0017('0x26')](handleEntityNotFound(_0x6f52bb,null))[_0x0017('0x26')](respondWithResult(_0x6f52bb,null))[_0x0017('0x47')](handleError(_0x6f52bb,null));};exports['create']=function(_0xbf4363,_0x38636a){return db[_0x0017('0x2d')][_0x0017('0x4c')](_0xbf4363[_0x0017('0x4d')],{})[_0x0017('0x26')](respondWithResult(_0x38636a,0xc9))[_0x0017('0x47')](handleError(_0x38636a,null));};exports[_0x0017('0x25')]=function(_0x4b2f84,_0x1a7dee){if(_0x4b2f84[_0x0017('0x4d')]['id']){delete _0x4b2f84['body']['id'];}return db[_0x0017('0x2d')][_0x0017('0x4b')]({'where':{'id':_0x4b2f84[_0x0017('0x49')]['id']}})[_0x0017('0x26')](handleEntityNotFound(_0x1a7dee,null))[_0x0017('0x26')](saveUpdates(_0x4b2f84['body'],null))[_0x0017('0x26')](respondWithResult(_0x1a7dee,null))['catch'](handleError(_0x1a7dee,null));};exports[_0x0017('0x27')]=function(_0x233011,_0x72d887){return db[_0x0017('0x2d')]['find']({'where':{'id':_0x233011[_0x0017('0x49')]['id']}})[_0x0017('0x26')](handleEntityNotFound(_0x72d887,null))['then'](removeEntity(_0x72d887,null))[_0x0017('0x47')](handleError(_0x72d887,null));};exports[_0x0017('0x4e')]=function(_0x39735e,_0x4839a6,_0x4985a9){var _0x2e828d={};var _0x117d20={};var _0x5e11de;var _0x290213;return db[_0x0017('0x2d')][_0x0017('0x4f')]({'where':{'id':_0x39735e[_0x0017('0x49')]['id']}})[_0x0017('0x26')](handleEntityNotFound(_0x4839a6,null))[_0x0017('0x26')](function(_0x5f49c8){if(_0x5f49c8){_0x5e11de=_0x5f49c8;_0x117d20[_0x0017('0x33')]=_[_0x0017('0x4a')](db['VtigerConfiguration']['rawAttributes']);_0x117d20['query']=_[_0x0017('0x4a')](_0x39735e['query']);_0x117d20[_0x0017('0x3d')]=_[_0x0017('0x35')](_0x117d20[_0x0017('0x33')],_0x117d20[_0x0017('0x32')]);_0x2e828d['attributes']=_[_0x0017('0x35')](_0x117d20[_0x0017('0x33')],qs[_0x0017('0x36')](_0x39735e[_0x0017('0x32')][_0x0017('0x36')]));_0x2e828d['attributes']=_0x2e828d['attributes'][_0x0017('0x37')]?_0x2e828d[_0x0017('0x34')]:_0x117d20[_0x0017('0x33')];_0x2e828d[_0x0017('0x3a')]=qs[_0x0017('0x3b')](_0x39735e[_0x0017('0x32')]['sort']);_0x2e828d[_0x0017('0x3c')]=qs[_0x0017('0x3d')](_['pick'](_0x39735e[_0x0017('0x32')],_0x117d20[_0x0017('0x3d')]));if(_0x39735e[_0x0017('0x32')][_0x0017('0x3f')]){_0x2e828d[_0x0017('0x3c')]=_[_0x0017('0x40')](_0x2e828d[_0x0017('0x3c')],{'$or':_[_0x0017('0x2c')](_0x2e828d[_0x0017('0x34')],function(_0x14ffe4){var _0xa21de7={};_0xa21de7[_0x14ffe4]={'$like':'%'+_0x39735e[_0x0017('0x32')][_0x0017('0x3f')]+'%'};return _0xa21de7;})});}_0x2e828d=_[_0x0017('0x40')]({},_0x2e828d,_0x39735e[_0x0017('0x42')]);return _0x5e11de[_0x0017('0x4e')](_0x2e828d);}})[_0x0017('0x26')](function(_0x290d3b){if(_0x290d3b){_0x290213=_0x290d3b[_0x0017('0x37')];if(!_0x39735e['query'][_0x0017('0x38')](_0x0017('0x39'))){_0x2e828d[_0x0017('0x21')]=qs[_0x0017('0x21')](_0x39735e['query'][_0x0017('0x21')]);_0x2e828d['offset']=qs[_0x0017('0x1e')](_0x39735e[_0x0017('0x32')]['offset']);}return _0x5e11de[_0x0017('0x4e')](_0x2e828d);}})[_0x0017('0x26')](function(_0x5ceb2c){if(_0x5ceb2c){return _0x5ceb2c?{'count':_0x290213,'rows':_0x5ceb2c}:null;}})['then'](respondWithResult(_0x4839a6,null))[_0x0017('0x47')](handleError(_0x4839a6,null));};exports[_0x0017('0x50')]=function(_0x147936,_0x442c08,_0x499aa1){if(_0x147936[_0x0017('0x4d')]['id']){delete _0x147936[_0x0017('0x4d')]['id'];}return db[_0x0017('0x2d')][_0x0017('0x4f')]({'where':{'id':_0x147936[_0x0017('0x49')]['id']}})[_0x0017('0x26')](handleEntityNotFound(_0x442c08,null))[_0x0017('0x26')](function(_0x27e711){if(_0x27e711){_0x147936['body'][_0x0017('0x51')]=_0x27e711['id'];_0x147936['body'][_0x0017('0x52')]=integrations[_0x0017('0x53')](_0x147936[_0x0017('0x4d')][_0x0017('0x54')],_0x147936[_0x0017('0x4d')]['type']);_0x147936[_0x0017('0x4d')][_0x0017('0x55')]=integrations[_0x0017('0x56')](_0x147936[_0x0017('0x4d')]['channel'],_0x147936[_0x0017('0x4d')]['type']);return db[_0x0017('0x57')]['create'](_0x147936['body'],{'include':[{'model':db[_0x0017('0x58')],'as':_0x0017('0x52')},{'model':db[_0x0017('0x58')],'as':_0x0017('0x55')}]});}return null;})[_0x0017('0x26')](respondWithResult(_0x442c08,null))['catch'](handleError(_0x442c08,null));};var md5=require(_0x0017('0x59'));exports[_0x0017('0x5a')]=function(_0x543056,_0x21963d,_0x17cd0a){var _0x58f020=null;var _0x59d351=null;var _0x1ff220=null;var _0x537e0c=null;var _0x274ad7='';return db[_0x0017('0x2d')]['findOne']({'where':{'id':_0x543056[_0x0017('0x49')]['id']},'attributes':['id',_0x0017('0x2a'),_0x0017('0x5b'),_0x0017('0x5c'),_0x0017('0x5d'),_0x0017('0x5e'),_0x0017('0x5f'),_0x0017('0x60')]})['then'](handleEntityNotFound(_0x21963d,null))[_0x0017('0x26')](function(_0x26cdfb){if(_0x26cdfb){_0x58f020=_0x26cdfb['username'];_0x59d351=_0x26cdfb[_0x0017('0x60')];_0x1ff220=_0x26cdfb['moduleName'];_0x274ad7=_0x26cdfb[_0x0017('0x5e')];var _0x20e401=_0x274ad7['slice'](-0x1);if(_0x20e401==='/'){_0x274ad7=_0x274ad7[_0x0017('0x61')](0x0,_0x274ad7[_0x0017('0x62')](_0x20e401));}_0x537e0c=util[_0x0017('0x63')]('%s/webservice.php',_0x274ad7);var _0x1ca11d={'method':_0x0017('0x64'),'uri':_0x537e0c,'qs':{'operation':'getchallenge','username':_0x26cdfb['username']},'json':!![]};return rp(_0x1ca11d);}})[_0x0017('0x26')](function(_0x16dd57){if(_0x16dd57[_0x0017('0x65')]){var _0x2d47e1={'method':_0x0017('0x66'),'uri':_0x537e0c,'form':{'operation':'login','username':_0x58f020,'accessKey':md5(_0x16dd57[_0x0017('0x67')][_0x0017('0x68')]+_0x59d351)},'json':!![]};return rp(_0x2d47e1);}})[_0x0017('0x26')](function(_0x57e4e9){if(_0x57e4e9[_0x0017('0x65')]){var _0x31928e={'method':_0x0017('0x64'),'uri':_0x537e0c,'qs':{'operation':_0x0017('0x69'),'username':_0x58f020,'sessionName':_0x57e4e9[_0x0017('0x67')][_0x0017('0x6a')],'elementType':_0x1ff220},'json':!![]};return rp(_0x31928e);}})[_0x0017('0x26')](function(_0x3e73fe){if(_0x3e73fe['success']){var _0x63edae=[_0x0017('0x6b'),_0x0017('0x6c'),'owner'];_[_0x0017('0x6d')](_0x3e73fe['result'][_0x0017('0x36')],function(_0x3b5f0d){return _0x63edae[_0x0017('0x6e')](_0x3b5f0d['type'][_0x0017('0x2a')]);});_[_0x0017('0x6d')](_0x3e73fe[_0x0017('0x67')][_0x0017('0x36')],function(_0x1b32dd){return _0x1b32dd[_0x0017('0x6f')]==='false';});return{'count':_0x3e73fe['result'][_0x0017('0x36')][_0x0017('0x37')],'rows':_['map'](_0x3e73fe[_0x0017('0x67')]['fields'],function(_0x5edf93){return{'id':_0x5edf93[_0x0017('0x2a')],'name':_0x5edf93[_0x0017('0x70')],'custom':_[_0x0017('0x71')](_0x5edf93[_0x0017('0x2a')],_0x0017('0x72'))?!![]:![],'options':_0x5edf93[_0x0017('0x30')][_0x0017('0x2a')]===_0x0017('0x73')&&_0x5edf93['type'][_0x0017('0x74')]['length']>0x0?_[_0x0017('0x2c')](_0x5edf93[_0x0017('0x30')][_0x0017('0x74')],function(_0x1baaba){return{'name':_0x1baaba[_0x0017('0x70')],'value':_0x1baaba['value']};}):[]};})};}})[_0x0017('0x26')](respondWithResult(_0x21963d,null))[_0x0017('0x47')](function(_0x28d96e){console[_0x0017('0x75')](_0x0017('0x76')+_0x28d96e);var _0x4ff263=_0x543056[_0x0017('0x32')]['test']?0x1f4:_0x28d96e[_0x0017('0x77')]||0x1f4;logger[_0x0017('0x28')](_0x0017('0x78'),_0x0017('0x5a'),_0x4ff263,JSON['stringify'](_0x28d96e));delete _0x28d96e[_0x0017('0x2a')];if(_0x4ff263===0x191){_0x4ff263=0x190;}_0x21963d[_0x0017('0x1c')](_0x4ff263)[_0x0017('0x79')](_0x543056[_0x0017('0x32')][_0x0017('0x7a')]?{'message':_0x0017('0x7b'),'statusCode':_0x28d96e[_0x0017('0x77')]}:_0x28d96e);});}; \ No newline at end of file +var _0x5261=['fieldName','type','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','options','includeAll','include','catch','show','length','find','create','body','params','VtigerConfiguration','order','map','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','getFields','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','index','VtigerAccount','rawAttributes'];(function(_0x591b2f,_0x521338){var _0x2db93f=function(_0x4905b4){while(--_0x4905b4){_0x591b2f['push'](_0x591b2f['shift']());}};_0x2db93f(++_0x521338);}(_0x5261,0x13d));var _0x1526=function(_0x3efafb,_0x321a57){_0x3efafb=_0x3efafb-0x0;var _0x2c6131=_0x5261[_0x3efafb];return _0x2c6131;};'use strict';var emlformat=require(_0x1526('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1526('0x1'));var jsonpatch=require(_0x1526('0x2'));var rp=require('request-promise');var moment=require(_0x1526('0x3'));var BPromise=require(_0x1526('0x4'));var Mustache=require(_0x1526('0x5'));var util=require(_0x1526('0x6'));var path=require(_0x1526('0x7'));var sox=require(_0x1526('0x8'));var csv=require(_0x1526('0x9'));var ejs=require(_0x1526('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1526('0xb'));var squel=require(_0x1526('0xc'));var crypto=require('crypto');var jsforce=require(_0x1526('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1526('0xe'));var Papa=require(_0x1526('0xf'));var Redis=require(_0x1526('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1526('0x11'));var as=require(_0x1526('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1526('0x13'))(_0x1526('0x14'));var utils=require(_0x1526('0x15'));var config=require(_0x1526('0x16'));var licenseUtil=require(_0x1526('0x17'));var db=require(_0x1526('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5efa4b,_0x371a9e){_0x371a9e=_0x371a9e||0xcc;return function(_0x1e737a){if(_0x1e737a){return _0x5efa4b[_0x1526('0x19')](_0x371a9e);}return _0x5efa4b[_0x1526('0x1a')](_0x371a9e)[_0x1526('0x1b')]();};}function respondWithResult(_0x12ce86,_0x21b87b){_0x21b87b=_0x21b87b||0xc8;return function(_0x2694f5){if(_0x2694f5){return _0x12ce86[_0x1526('0x1a')](_0x21b87b)[_0x1526('0x1c')](_0x2694f5);}};}function respondWithFilteredResult(_0x2a5fa4,_0xe362b6){return function(_0x13231a){if(_0x13231a){var _0x2ca19e=typeof _0xe362b6[_0x1526('0x1d')]===_0x1526('0x1e')&&typeof _0xe362b6[_0x1526('0x1f')]===_0x1526('0x1e');var _0x183f5e=_0x13231a['count'];var _0x12f48f=_0x2ca19e?0x0:_0xe362b6['offset'];var _0x52490f=_0x2ca19e?_0x13231a[_0x1526('0x20')]:_0xe362b6[_0x1526('0x1d')]+_0xe362b6[_0x1526('0x1f')];var _0x3f0746;if(_0x52490f>=_0x183f5e){_0x52490f=_0x183f5e;_0x3f0746=0xc8;}else{_0x3f0746=0xce;}_0x2a5fa4[_0x1526('0x1a')](_0x3f0746);return _0x2a5fa4[_0x1526('0x21')]('Content-Range',_0x12f48f+'-'+_0x52490f+'/'+_0x183f5e)['json'](_0x13231a);}return null;};}function patchUpdates(_0x392472){return function(_0x17c4fe){try{jsonpatch[_0x1526('0x22')](_0x17c4fe,_0x392472,!![]);}catch(_0x182d09){return BPromise[_0x1526('0x23')](_0x182d09);}return _0x17c4fe[_0x1526('0x24')]();};}function saveUpdates(_0x327b43,_0x458f2c){return function(_0x58b489){if(_0x58b489){return _0x58b489[_0x1526('0x25')](_0x327b43)[_0x1526('0x26')](function(_0x325480){return _0x325480;});}return null;};}function removeEntity(_0xa72e91,_0x1ff89e){return function(_0x1c68aa){if(_0x1c68aa){return _0x1c68aa[_0x1526('0x27')]()[_0x1526('0x26')](function(){_0xa72e91['status'](0xcc)[_0x1526('0x1b')]();});}};}function handleEntityNotFound(_0x43527d,_0x4c36dc){return function(_0x5109e6){if(!_0x5109e6){_0x43527d[_0x1526('0x19')](0x194);}return _0x5109e6;};}function handleError(_0x39faee,_0x350ec7){_0x350ec7=_0x350ec7||0x1f4;return function(_0xb84d1f){logger[_0x1526('0x28')](_0xb84d1f['stack']);if(_0xb84d1f[_0x1526('0x29')]){delete _0xb84d1f[_0x1526('0x29')];}_0x39faee[_0x1526('0x1a')](_0x350ec7)[_0x1526('0x2a')](_0xb84d1f);};}exports[_0x1526('0x2b')]=function(_0x11062d,_0x1d3439){var _0x36582a={},_0x360efb={},_0x375d7a={'count':0x0,'rows':[]};var _0x28bd3b=_['map'](db[_0x1526('0x2c')][_0x1526('0x2d')],function(_0x35f78d){return{'name':_0x35f78d[_0x1526('0x2e')],'type':_0x35f78d[_0x1526('0x2f')]['key']};});_0x360efb[_0x1526('0x30')]=_['map'](_0x28bd3b,_0x1526('0x29'));_0x360efb[_0x1526('0x31')]=_[_0x1526('0x32')](_0x11062d[_0x1526('0x31')]);_0x360efb[_0x1526('0x33')]=_[_0x1526('0x34')](_0x360efb['model'],_0x360efb[_0x1526('0x31')]);_0x36582a['attributes']=_['intersection'](_0x360efb[_0x1526('0x30')],qs['fields'](_0x11062d[_0x1526('0x31')][_0x1526('0x35')]));_0x36582a[_0x1526('0x36')]=_0x36582a[_0x1526('0x36')]['length']?_0x36582a[_0x1526('0x36')]:_0x360efb['model'];if(!_0x11062d[_0x1526('0x31')]['hasOwnProperty'](_0x1526('0x37'))){_0x36582a[_0x1526('0x1f')]=qs[_0x1526('0x1f')](_0x11062d['query'][_0x1526('0x1f')]);_0x36582a[_0x1526('0x1d')]=qs[_0x1526('0x1d')](_0x11062d['query'][_0x1526('0x1d')]);}_0x36582a['order']=qs[_0x1526('0x38')](_0x11062d['query'][_0x1526('0x38')]);_0x36582a[_0x1526('0x39')]=qs[_0x1526('0x33')](_[_0x1526('0x3a')](_0x11062d[_0x1526('0x31')],_0x360efb[_0x1526('0x33')]),_0x28bd3b);if(_0x11062d[_0x1526('0x31')][_0x1526('0x3b')]){_0x36582a['where']=_[_0x1526('0x3c')](_0x36582a[_0x1526('0x39')],{'$or':_['map'](_0x28bd3b,function(_0x416585){if(_0x416585[_0x1526('0x2f')]!=='VIRTUAL'){var _0x2762f5={};_0x2762f5[_0x416585[_0x1526('0x29')]]={'$like':'%'+_0x11062d[_0x1526('0x31')][_0x1526('0x3b')]+'%'};return _0x2762f5;}})});}_0x36582a=_['merge']({},_0x36582a,_0x11062d[_0x1526('0x3d')]);var _0x2a36b1={'where':_0x36582a[_0x1526('0x39')]};return db['VtigerAccount'][_0x1526('0x20')](_0x2a36b1)[_0x1526('0x26')](function(_0x392960){_0x375d7a[_0x1526('0x20')]=_0x392960;if(_0x11062d['query'][_0x1526('0x3e')]){_0x36582a[_0x1526('0x3f')]=[{'all':!![]}];}return db[_0x1526('0x2c')]['findAll'](_0x36582a);})[_0x1526('0x26')](function(_0x5c336f){_0x375d7a['rows']=_0x5c336f;return _0x375d7a;})['then'](respondWithFilteredResult(_0x1d3439,_0x36582a))[_0x1526('0x40')](handleError(_0x1d3439,null));};exports[_0x1526('0x41')]=function(_0x66fae,_0x6a3f1d){var _0x228ab5={'raw':![],'where':{'id':_0x66fae['params']['id']}},_0x4d3bcd={};_0x4d3bcd['model']=_[_0x1526('0x32')](db['VtigerAccount'][_0x1526('0x2d')]);_0x4d3bcd['query']=_['keys'](_0x66fae[_0x1526('0x31')]);_0x4d3bcd['filters']=_[_0x1526('0x34')](_0x4d3bcd[_0x1526('0x30')],_0x4d3bcd[_0x1526('0x31')]);_0x228ab5[_0x1526('0x36')]=_['intersection'](_0x4d3bcd[_0x1526('0x30')],qs[_0x1526('0x35')](_0x66fae[_0x1526('0x31')][_0x1526('0x35')]));_0x228ab5[_0x1526('0x36')]=_0x228ab5[_0x1526('0x36')][_0x1526('0x42')]?_0x228ab5[_0x1526('0x36')]:_0x4d3bcd[_0x1526('0x30')];if(_0x66fae[_0x1526('0x31')]['includeAll']){_0x228ab5['include']=[{'all':!![]}];}_0x228ab5=_[_0x1526('0x3c')]({},_0x228ab5,_0x66fae[_0x1526('0x3d')]);return db[_0x1526('0x2c')][_0x1526('0x43')](_0x228ab5)[_0x1526('0x26')](handleEntityNotFound(_0x6a3f1d,null))[_0x1526('0x26')](respondWithResult(_0x6a3f1d,null))[_0x1526('0x40')](handleError(_0x6a3f1d,null));};exports[_0x1526('0x44')]=function(_0x1a16f4,_0x2b8044){return db['VtigerAccount'][_0x1526('0x44')](_0x1a16f4[_0x1526('0x45')],{})[_0x1526('0x26')](respondWithResult(_0x2b8044,0xc9))[_0x1526('0x40')](handleError(_0x2b8044,null));};exports['update']=function(_0x470c99,_0x324aa1){if(_0x470c99[_0x1526('0x45')]['id']){delete _0x470c99[_0x1526('0x45')]['id'];}return db[_0x1526('0x2c')]['find']({'where':{'id':_0x470c99[_0x1526('0x46')]['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x324aa1,null))[_0x1526('0x26')](saveUpdates(_0x470c99[_0x1526('0x45')],null))['then'](respondWithResult(_0x324aa1,null))[_0x1526('0x40')](handleError(_0x324aa1,null));};exports[_0x1526('0x27')]=function(_0x103598,_0x48ccce){return db[_0x1526('0x2c')][_0x1526('0x43')]({'where':{'id':_0x103598[_0x1526('0x46')]['id']}})[_0x1526('0x26')](handleEntityNotFound(_0x48ccce,null))['then'](removeEntity(_0x48ccce,null))[_0x1526('0x40')](handleError(_0x48ccce,null));};exports['getConfigurations']=function(_0x262d88,_0x56aa00,_0xae14f3){var _0x2cd251={};var _0x13bd59={};var _0x5203e7;var _0x2461fc;return db[_0x1526('0x2c')]['findOne']({'where':{'id':_0x262d88[_0x1526('0x46')]['id']}})['then'](handleEntityNotFound(_0x56aa00,null))[_0x1526('0x26')](function(_0x23ced8){if(_0x23ced8){_0x5203e7=_0x23ced8;_0x13bd59[_0x1526('0x30')]=_[_0x1526('0x32')](db[_0x1526('0x47')][_0x1526('0x2d')]);_0x13bd59[_0x1526('0x31')]=_[_0x1526('0x32')](_0x262d88[_0x1526('0x31')]);_0x13bd59['filters']=_['intersection'](_0x13bd59[_0x1526('0x30')],_0x13bd59[_0x1526('0x31')]);_0x2cd251[_0x1526('0x36')]=_['intersection'](_0x13bd59[_0x1526('0x30')],qs[_0x1526('0x35')](_0x262d88[_0x1526('0x31')][_0x1526('0x35')]));_0x2cd251[_0x1526('0x36')]=_0x2cd251['attributes'][_0x1526('0x42')]?_0x2cd251[_0x1526('0x36')]:_0x13bd59[_0x1526('0x30')];_0x2cd251[_0x1526('0x48')]=qs[_0x1526('0x38')](_0x262d88[_0x1526('0x31')][_0x1526('0x38')]);_0x2cd251[_0x1526('0x39')]=qs[_0x1526('0x33')](_[_0x1526('0x3a')](_0x262d88[_0x1526('0x31')],_0x13bd59[_0x1526('0x33')]));if(_0x262d88[_0x1526('0x31')][_0x1526('0x3b')]){_0x2cd251[_0x1526('0x39')]=_[_0x1526('0x3c')](_0x2cd251[_0x1526('0x39')],{'$or':_[_0x1526('0x49')](_0x2cd251[_0x1526('0x36')],function(_0x1e218f){var _0x186351={};_0x186351[_0x1e218f]={'$like':'%'+_0x262d88[_0x1526('0x31')]['filter']+'%'};return _0x186351;})});}_0x2cd251=_[_0x1526('0x3c')]({},_0x2cd251,_0x262d88['options']);return _0x5203e7[_0x1526('0x4a')](_0x2cd251);}})[_0x1526('0x26')](function(_0x2127e5){if(_0x2127e5){_0x2461fc=_0x2127e5[_0x1526('0x42')];if(!_0x262d88[_0x1526('0x31')][_0x1526('0x4b')](_0x1526('0x37'))){_0x2cd251['limit']=qs[_0x1526('0x1f')](_0x262d88['query'][_0x1526('0x1f')]);_0x2cd251['offset']=qs[_0x1526('0x1d')](_0x262d88[_0x1526('0x31')][_0x1526('0x1d')]);}return _0x5203e7[_0x1526('0x4a')](_0x2cd251);}})[_0x1526('0x26')](function(_0x7353a5){if(_0x7353a5){return _0x7353a5?{'count':_0x2461fc,'rows':_0x7353a5}:null;}})[_0x1526('0x26')](respondWithResult(_0x56aa00,null))['catch'](handleError(_0x56aa00,null));};exports['addConfiguration']=function(_0x5e6048,_0xcad3d9,_0x30cb91){if(_0x5e6048[_0x1526('0x45')]['id']){delete _0x5e6048[_0x1526('0x45')]['id'];}return db[_0x1526('0x2c')]['findOne']({'where':{'id':_0x5e6048[_0x1526('0x46')]['id']}})['then'](handleEntityNotFound(_0xcad3d9,null))[_0x1526('0x26')](function(_0x1dee88){if(_0x1dee88){_0x5e6048[_0x1526('0x45')][_0x1526('0x4c')]=_0x1dee88['id'];_0x5e6048[_0x1526('0x45')][_0x1526('0x4d')]=integrations[_0x1526('0x4e')](_0x5e6048['body'][_0x1526('0x4f')],_0x5e6048['body'][_0x1526('0x2f')]);_0x5e6048[_0x1526('0x45')][_0x1526('0x50')]=integrations[_0x1526('0x51')](_0x5e6048['body']['channel'],_0x5e6048[_0x1526('0x45')]['type']);return db['VtigerConfiguration']['create'](_0x5e6048['body'],{'include':[{'model':db[_0x1526('0x52')],'as':_0x1526('0x4d')},{'model':db[_0x1526('0x52')],'as':'Descriptions'}]});}return null;})[_0x1526('0x26')](respondWithResult(_0xcad3d9,null))[_0x1526('0x40')](handleError(_0xcad3d9,null));};var md5=require('md5');exports[_0x1526('0x53')]=function(_0x5c717d,_0x573e06,_0x414a7e){var _0xfd6537=null;var _0x48adbe=null;var _0x5a3237=null;var _0x3b7890=null;var _0x5dcb18='';return db[_0x1526('0x2c')][_0x1526('0x54')]({'where':{'id':_0x5c717d[_0x1526('0x46')]['id']},'attributes':['id',_0x1526('0x29'),_0x1526('0x55'),_0x1526('0x56'),_0x1526('0x57'),_0x1526('0x58'),_0x1526('0x59'),_0x1526('0x5a')]})['then'](handleEntityNotFound(_0x573e06,null))[_0x1526('0x26')](function(_0xbfffe4){if(_0xbfffe4){_0xfd6537=_0xbfffe4[_0x1526('0x55')];_0x48adbe=_0xbfffe4[_0x1526('0x5a')];_0x5a3237=_0xbfffe4[_0x1526('0x57')];_0x5dcb18=_0xbfffe4[_0x1526('0x58')];var _0x172074=_0x5dcb18[_0x1526('0x5b')](-0x1);if(_0x172074==='/'){_0x5dcb18=_0x5dcb18[_0x1526('0x5c')](0x0,_0x5dcb18[_0x1526('0x5d')](_0x172074));}_0x3b7890=util[_0x1526('0x5e')](_0x1526('0x5f'),_0x5dcb18);var _0x5196ef={'method':'GET','uri':_0x3b7890,'qs':{'operation':_0x1526('0x60'),'username':_0xbfffe4[_0x1526('0x55')]},'json':!![]};return rp(_0x5196ef);}})[_0x1526('0x26')](function(_0x14bffd){if(_0x14bffd[_0x1526('0x61')]){var _0x495cec={'method':_0x1526('0x62'),'uri':_0x3b7890,'form':{'operation':'login','username':_0xfd6537,'accessKey':md5(_0x14bffd[_0x1526('0x63')][_0x1526('0x64')]+_0x48adbe)},'json':!![]};return rp(_0x495cec);}})['then'](function(_0x44546d){if(_0x44546d[_0x1526('0x61')]){var _0x58e271={'method':'GET','uri':_0x3b7890,'qs':{'operation':_0x1526('0x65'),'username':_0xfd6537,'sessionName':_0x44546d[_0x1526('0x63')][_0x1526('0x66')],'elementType':_0x5a3237},'json':!![]};return rp(_0x58e271);}})[_0x1526('0x26')](function(_0x23a7f7){if(_0x23a7f7[_0x1526('0x61')]){var _0x33ae08=[_0x1526('0x67'),'reference',_0x1526('0x68')];_['remove'](_0x23a7f7[_0x1526('0x63')]['fields'],function(_0x55eaf6){return _0x33ae08['includes'](_0x55eaf6[_0x1526('0x2f')][_0x1526('0x29')]);});_[_0x1526('0x69')](_0x23a7f7[_0x1526('0x63')][_0x1526('0x35')],function(_0x3513be){return _0x3513be[_0x1526('0x6a')]===_0x1526('0x6b');});return{'count':_0x23a7f7['result'][_0x1526('0x35')]['length'],'rows':_['map'](_0x23a7f7['result'][_0x1526('0x35')],function(_0x282d6c){return{'id':_0x282d6c[_0x1526('0x29')],'name':_0x282d6c[_0x1526('0x6c')],'custom':_[_0x1526('0x6d')](_0x282d6c[_0x1526('0x29')],_0x1526('0x6e'))?!![]:![],'options':_0x282d6c[_0x1526('0x2f')][_0x1526('0x29')]===_0x1526('0x6f')&&_0x282d6c[_0x1526('0x2f')][_0x1526('0x70')][_0x1526('0x42')]>0x0?_[_0x1526('0x49')](_0x282d6c[_0x1526('0x2f')][_0x1526('0x70')],function(_0x2c0734){return{'name':_0x2c0734[_0x1526('0x6c')],'value':_0x2c0734[_0x1526('0x71')]};}):[]};})};}})['then'](respondWithResult(_0x573e06,null))[_0x1526('0x40')](function(_0x423576){console[_0x1526('0x72')](_0x1526('0x73')+_0x423576);var _0xd74af4=_0x5c717d[_0x1526('0x31')]['test']?0x1f4:_0x423576[_0x1526('0x74')]||0x1f4;logger[_0x1526('0x28')](_0x1526('0x75'),_0x1526('0x53'),_0xd74af4,JSON[_0x1526('0x76')](_0x423576));delete _0x423576[_0x1526('0x29')];if(_0xd74af4===0x191){_0xd74af4=0x190;}_0x573e06[_0x1526('0x1a')](_0xd74af4)[_0x1526('0x2a')](_0x5c717d[_0x1526('0x31')][_0x1526('0x77')]?{'message':_0x1526('0x78'),'statusCode':_0x423576[_0x1526('0x74')]}:_0x423576);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 39db4d2..5593427 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 _0xdba3=['lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xdba3,0x1ee));var _0x3dba=function(_0x5d0d91,_0x235f9b){_0x5d0d91=_0x5d0d91-0x0;var _0x406667=_0xdba3[_0x5d0d91];return _0x406667;};'use strict';var _=require(_0x3dba('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3dba('0x1'));var moment=require(_0x3dba('0x2'));var BPromise=require(_0x3dba('0x3'));var rp=require(_0x3dba('0x4'));var fs=require('fs');var path=require(_0x3dba('0x5'));var rimraf=require(_0x3dba('0x6'));var config=require(_0x3dba('0x7'));var attributes=require(_0x3dba('0x8'));var integrations=require(_0x3dba('0x9'));module[_0x3dba('0xa')]=function(_0x56bd66,_0x1d62ab){return _0x56bd66[_0x3dba('0xb')](_0x3dba('0xc'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22ab=['lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x5c7a6f,_0x2e0f25){var _0x51b56a=function(_0x1d0d82){while(--_0x1d0d82){_0x5c7a6f['push'](_0x5c7a6f['shift']());}};_0x51b56a(++_0x2e0f25);}(_0x22ab,0xa9));var _0xb22a=function(_0x371d15,_0xd98587){_0x371d15=_0x371d15-0x0;var _0x32afdf=_0x22ab[_0x371d15];return _0x32afdf;};'use strict';var _=require(_0xb22a('0x0'));var util=require(_0xb22a('0x1'));var logger=require(_0xb22a('0x2'))(_0xb22a('0x3'));var moment=require('moment');var BPromise=require(_0xb22a('0x4'));var rp=require(_0xb22a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb22a('0x6'));var config=require(_0xb22a('0x7'));var attributes=require(_0xb22a('0x8'));var integrations=require(_0xb22a('0x9'));module[_0xb22a('0xa')]=function(_0x40b93d,_0x5bbf50){return _0x40b93d[_0xb22a('0xb')](_0xb22a('0xc'),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 e18ebd1..df9a9de 100644 --- a/server/api/intVtigerAccount/intVtigerAccount.rpc.js +++ b/server/api/intVtigerAccount/intVtigerAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x236c=['jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','include','map','model','VtigerAccount','find','ShowVtigerAccount','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x584081,_0x52aff2){var _0x377461=function(_0x147ccf){while(--_0x147ccf){_0x584081['push'](_0x584081['shift']());}};_0x377461(++_0x52aff2);}(_0x236c,0x155));var _0xc236=function(_0x596540,_0x4af64c){_0x596540=_0x596540-0x0;var _0x16e645=_0x236c[_0x596540];return _0x16e645;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('VtigerAccount,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});}exports[_0xc236('0x18')]=function(_0x76f45){var _0x11ec65=this;return new Promise(function(_0x541a20,_0x13b432){return db['VtigerAccount']['findAll']({'raw':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'limit':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')]['limit']||null:null,'include':_0x76f45[_0xc236('0x19')]?_0x76f45[_0xc236('0x19')][_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x76f45[_0xc236('0x19')][_0xc236('0x1d')],function(_0x3a315b){return{'model':db[_0x3a315b[_0xc236('0x1f')]],'as':_0x3a315b['as'],'attributes':_0x3a315b[_0xc236('0x1c')],'include':_0x3a315b[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0x3a315b['include'],function(_0x308cd6){return{'model':db[_0x308cd6[_0xc236('0x1f')]],'as':_0x308cd6['as'],'attributes':_0x308cd6[_0xc236('0x1c')],'include':_0x308cd6[_0xc236('0x1d')]?_['map'](_0x308cd6[_0xc236('0x1d')],function(_0x5da4b2){return{'model':db[_0x5da4b2['model']],'as':_0x5da4b2['as'],'attributes':_0x5da4b2[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36e578){logger['info'](_0xc236('0x18'),_0x76f45);logger['debug'](_0xc236('0x18'),_0x76f45,JSON[_0xc236('0x12')](_0x36e578));_0x541a20(_0x36e578);})['catch'](function(_0x5a61b5){logger[_0xc236('0x13')](_0xc236('0x18'),_0x5a61b5[_0xc236('0x15')],_0x76f45);_0x13b432(_0x11ec65[_0xc236('0x13')](0x1f4,_0x5a61b5['message']));});});};exports['ShowVtigerAccount']=function(_0x28ffa5){var _0x53b767=this;return new Promise(function(_0x2c756f,_0x4ddc87){return db[_0xc236('0x20')][_0xc236('0x21')]({'raw':_0x28ffa5['options']?_0x28ffa5['options'][_0xc236('0x1a')]===undefined?!![]:![]:!![],'where':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1b')]||null:null,'attributes':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')][_0xc236('0x1c')]||null:null,'include':_0x28ffa5[_0xc236('0x19')]?_0x28ffa5[_0xc236('0x19')]['include']?_['map'](_0x28ffa5['options'][_0xc236('0x1d')],function(_0xfda1f9){return{'model':db[_0xfda1f9[_0xc236('0x1f')]],'as':_0xfda1f9['as'],'attributes':_0xfda1f9[_0xc236('0x1c')],'include':_0xfda1f9[_0xc236('0x1d')]?_[_0xc236('0x1e')](_0xfda1f9[_0xc236('0x1d')],function(_0x5761de){return{'model':db[_0x5761de[_0xc236('0x1f')]],'as':_0x5761de['as'],'attributes':_0x5761de[_0xc236('0x1c')],'include':_0x5761de[_0xc236('0x1d')]?_['map'](_0x5761de[_0xc236('0x1d')],function(_0x2a8f33){return{'model':db[_0x2a8f33[_0xc236('0x1f')]],'as':_0x2a8f33['as'],'attributes':_0x2a8f33[_0xc236('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12348b){logger[_0xc236('0xd')](_0xc236('0x22'),_0x28ffa5);logger[_0xc236('0x10')](_0xc236('0x22'),_0x28ffa5,JSON[_0xc236('0x12')](_0x12348b));_0x2c756f(_0x12348b);})[_0xc236('0x17')](function(_0x11ca1c){logger[_0xc236('0x13')](_0xc236('0x22'),_0x11ca1c[_0xc236('0x15')],_0x28ffa5);_0x4ddc87(_0x53b767[_0xc236('0x13')](0x1f4,_0x11ca1c[_0xc236('0x15')]));});});}; \ No newline at end of file +var _0x0972=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetVtigerAccount','VtigerAccount','findAll','options','raw','attributes','limit','include','map','model','catch','find','where','ShowVtigerAccount','util','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x343154,_0x3b6538){var _0xb6fe03=function(_0x3ebf43){while(--_0x3ebf43){_0x343154['push'](_0x343154['shift']());}};_0xb6fe03(++_0x3b6538);}(_0x0972,0x64));var _0x2097=function(_0xacc13b,_0x29f8ca){_0xacc13b=_0xacc13b-0x0;var _0x21a4b1=_0x0972[_0xacc13b];return _0x21a4b1;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var moment=require('moment');var BPromise=require(_0x2097('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2097('0x2'));var db=require(_0x2097('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2097('0x4'))(_0x2097('0x5'));var config=require(_0x2097('0x6'));var jayson=require(_0x2097('0x7'));var client=jayson[_0x2097('0x8')][_0x2097('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4f21,_0x59739f,_0x332aac){return new BPromise(function(_0x1e661a,_0x11d263){return client[_0x2097('0xa')](_0x2b4f21,_0x332aac)[_0x2097('0xb')](function(_0x59d947){logger[_0x2097('0xc')](_0x2097('0xd'),_0x59739f,_0x2097('0xe'));logger[_0x2097('0xf')](_0x2097('0x10'),_0x59739f,_0x2097('0xe'),JSON[_0x2097('0x11')](_0x59d947));if(_0x59d947[_0x2097('0x12')]){if(_0x59d947[_0x2097('0x12')][_0x2097('0x13')]===0x1f4){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x11d263(_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);}logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x59d947[_0x2097('0x12')][_0x2097('0x14')]);return _0x1e661a(_0x59d947['error'][_0x2097('0x14')]);}else{logger[_0x2097('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x59739f,'request\x20sent');_0x1e661a(_0x59d947['result'][_0x2097('0x14')]);}})['catch'](function(_0x28c35c){logger[_0x2097('0x12')](_0x2097('0xd'),_0x59739f,_0x28c35c);_0x11d263(_0x28c35c);});});}exports[_0x2097('0x15')]=function(_0x44c584){var _0x53e2b4=this;return new Promise(function(_0x324652,_0x140094){return db[_0x2097('0x16')][_0x2097('0x17')]({'raw':_0x44c584[_0x2097('0x18')]?_0x44c584[_0x2097('0x18')][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x44c584[_0x2097('0x18')]?_0x44c584['options']['where']||null:null,'attributes':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1a')]||null:null,'limit':_0x44c584[_0x2097('0x18')]?_0x44c584['options'][_0x2097('0x1b')]||null:null,'include':_0x44c584['options']?_0x44c584[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x44c584[_0x2097('0x18')][_0x2097('0x1c')],function(_0x35047b){return{'model':db[_0x35047b['model']],'as':_0x35047b['as'],'attributes':_0x35047b[_0x2097('0x1a')],'include':_0x35047b['include']?_[_0x2097('0x1d')](_0x35047b[_0x2097('0x1c')],function(_0x345875){return{'model':db[_0x345875[_0x2097('0x1e')]],'as':_0x345875['as'],'attributes':_0x345875['attributes'],'include':_0x345875[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x345875['include'],function(_0x1229fc){return{'model':db[_0x1229fc['model']],'as':_0x1229fc['as'],'attributes':_0x1229fc[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xbc0339){logger[_0x2097('0xc')](_0x2097('0x15'),_0x44c584);logger[_0x2097('0xf')](_0x2097('0x15'),_0x44c584,JSON[_0x2097('0x11')](_0xbc0339));_0x324652(_0xbc0339);})[_0x2097('0x1f')](function(_0x4b443d){logger[_0x2097('0x12')](_0x2097('0x15'),_0x4b443d['message'],_0x44c584);_0x140094(_0x53e2b4[_0x2097('0x12')](0x1f4,_0x4b443d[_0x2097('0x14')]));});});};exports['ShowVtigerAccount']=function(_0x4d0916){var _0x312c77=this;return new Promise(function(_0x11b051,_0x1649c8){return db[_0x2097('0x16')][_0x2097('0x20')]({'raw':_0x4d0916[_0x2097('0x18')]?_0x4d0916['options'][_0x2097('0x19')]===undefined?!![]:![]:!![],'where':_0x4d0916['options']?_0x4d0916[_0x2097('0x18')][_0x2097('0x21')]||null:null,'attributes':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1a')]||null:null,'include':_0x4d0916[_0x2097('0x18')]?_0x4d0916[_0x2097('0x18')][_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x4d0916['options'][_0x2097('0x1c')],function(_0x40baed){return{'model':db[_0x40baed[_0x2097('0x1e')]],'as':_0x40baed['as'],'attributes':_0x40baed['attributes'],'include':_0x40baed[_0x2097('0x1c')]?_[_0x2097('0x1d')](_0x40baed[_0x2097('0x1c')],function(_0x396162){return{'model':db[_0x396162['model']],'as':_0x396162['as'],'attributes':_0x396162['attributes'],'include':_0x396162['include']?_[_0x2097('0x1d')](_0x396162[_0x2097('0x1c')],function(_0x4123b7){return{'model':db[_0x4123b7[_0x2097('0x1e')]],'as':_0x4123b7['as'],'attributes':_0x4123b7[_0x2097('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2097('0xb')](function(_0x49b724){logger[_0x2097('0xc')](_0x2097('0x22'),_0x4d0916);logger[_0x2097('0xf')](_0x2097('0x22'),_0x4d0916,JSON[_0x2097('0x11')](_0x49b724));_0x11b051(_0x49b724);})[_0x2097('0x1f')](function(_0x52b937){logger[_0x2097('0x12')](_0x2097('0x22'),_0x52b937[_0x2097('0x14')],_0x4d0916);_0x1649c8(_0x312c77['error'](0x1f4,_0x52b937['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 30aa9de..a401566 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 _0x3a83=['./intVtigerConfiguration.controller','get','/:id','isAuthenticated','show','getDescriptions','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x5e2639,_0x3529f){var _0x25022a=function(_0x437a57){while(--_0x437a57){_0x5e2639['push'](_0x5e2639['shift']());}};_0x25022a(++_0x3529f);}(_0x3a83,0xa3));var _0x33a8=function(_0x2f4cf5,_0x509e5a){_0x2f4cf5=_0x2f4cf5-0x0;var _0xdeadfd=_0x3a83[_0x2f4cf5];return _0xdeadfd;};'use strict';var multer=require('multer');var util=require(_0x33a8('0x0'));var path=require(_0x33a8('0x1'));var timeout=require(_0x33a8('0x2'));var express=require(_0x33a8('0x3'));var router=express[_0x33a8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x33a8('0x5'));var interaction=require(_0x33a8('0x6'));var config=require('../../config/environment');var controller=require(_0x33a8('0x7'));router[_0x33a8('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x33a8('0x8')](_0x33a8('0x9'),auth[_0x33a8('0xa')](),controller[_0x33a8('0xb')]);router[_0x33a8('0x8')]('/:id/fields',auth[_0x33a8('0xa')](),controller['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x33a8('0xa')](),controller[_0x33a8('0xc')]);router['post']('/',auth[_0x33a8('0xa')](),controller[_0x33a8('0xd')]);router[_0x33a8('0xe')](_0x33a8('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x33a8('0xf')]('/:id',auth[_0x33a8('0xa')](),controller[_0x33a8('0x10')]);module['exports']=router; \ No newline at end of file +var _0x17af=['post','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x27c334,_0x119981){var _0x2312a0=function(_0x621457){while(--_0x621457){_0x27c334['push'](_0x27c334['shift']());}};_0x2312a0(++_0x119981);}(_0x17af,0x1b0));var _0xf17a=function(_0x334763,_0x575eff){_0x334763=_0x334763-0x0;var _0x566db0=_0x17af[_0x334763];return _0x566db0;};'use strict';var multer=require(_0xf17a('0x0'));var util=require(_0xf17a('0x1'));var path=require(_0xf17a('0x2'));var timeout=require(_0xf17a('0x3'));var express=require('express');var router=express[_0xf17a('0x4')]();var fs_extra=require(_0xf17a('0x5'));var auth=require(_0xf17a('0x6'));var interaction=require(_0xf17a('0x7'));var config=require(_0xf17a('0x8'));var controller=require(_0xf17a('0x9'));router[_0xf17a('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf17a('0xa')]('/:id',auth[_0xf17a('0xb')](),controller[_0xf17a('0xc')]);router[_0xf17a('0xa')](_0xf17a('0xd'),auth['isAuthenticated'](),controller[_0xf17a('0xe')]);router['get']('/:id/subjects',auth[_0xf17a('0xb')](),controller[_0xf17a('0xf')]);router[_0xf17a('0xa')](_0xf17a('0x10'),auth[_0xf17a('0xb')](),controller[_0xf17a('0x11')]);router[_0xf17a('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf17a('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf17a('0x14')]);router[_0xf17a('0x15')](_0xf17a('0x16'),auth['isAuthenticated'](),controller[_0xf17a('0x17')]);module[_0xf17a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 2b31e1d..9877891 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 _0x3b3b=['STRING','sequelize','exports'];(function(_0x2cc43d,_0x516e0a){var _0x7005a4=function(_0xc01c2a){while(--_0xc01c2a){_0x2cc43d['push'](_0x2cc43d['shift']());}};_0x7005a4(++_0x516e0a);}(_0x3b3b,0x187));var _0xb3b3=function(_0x1689dd,_0x290348){_0x1689dd=_0x1689dd-0x0;var _0x423b00=_0x3b3b[_0x1689dd];return _0x423b00;};'use strict';var Sequelize=require(_0xb3b3('0x0'));module[_0xb3b3('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3b3('0x2')]}}; \ No newline at end of file +var _0x8ff4=['sequelize','exports','STRING'];(function(_0x5b3906,_0x3dea63){var _0x18366f=function(_0x3777b5){while(--_0x3777b5){_0x5b3906['push'](_0x5b3906['shift']());}};_0x18366f(++_0x3dea63);}(_0x8ff4,0x81));var _0x48ff=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x8ff4[_0x3826ad];return _0x17b900;};'use strict';var Sequelize=require(_0x48ff('0x0'));module[_0x48ff('0x1')]={'name':{'type':Sequelize[_0x48ff('0x2')]},'description':{'type':Sequelize[_0x48ff('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0b7f2e4..732170b 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 _0xfa1e=['rows','show','params','keys','include','create','body','catch','update','getFields','VtigerField','hasOwnProperty','findOne','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','VtigerConfiguration','includeAll','findAll'];(function(_0x187399,_0x40c56d){var _0x40fa92=function(_0x36058c){while(--_0x36058c){_0x187399['push'](_0x187399['shift']());}};_0x40fa92(++_0x40c56d);}(_0xfa1e,0x102));var _0xefa1=function(_0x53c4f8,_0x44ccaf){_0x53c4f8=_0x53c4f8-0x0;var _0x416458=_0xfa1e[_0x53c4f8];return _0x416458;};'use strict';var emlformat=require(_0xefa1('0x0'));var rimraf=require(_0xefa1('0x1'));var zipdir=require(_0xefa1('0x2'));var jsonpatch=require(_0xefa1('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xefa1('0x4'));var Mustache=require('mustache');var util=require(_0xefa1('0x5'));var path=require(_0xefa1('0x6'));var sox=require(_0xefa1('0x7'));var csv=require(_0xefa1('0x8'));var ejs=require(_0xefa1('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xefa1('0xa'));var crypto=require(_0xefa1('0xb'));var jsforce=require(_0xefa1('0xc'));var deskjs=require(_0xefa1('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xefa1('0xe'));var Redis=require(_0xefa1('0xf'));var authService=require(_0xefa1('0x10'));var qs=require(_0xefa1('0x11'));var as=require(_0xefa1('0x12'));var hardwareService=require(_0xefa1('0x13'));var logger=require(_0xefa1('0x14'))(_0xefa1('0x15'));var utils=require(_0xefa1('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xefa1('0x17'))['db'];function respondWithStatusCode(_0x2fa691,_0x25fc05){_0x25fc05=_0x25fc05||0xcc;return function(_0x3b1212){if(_0x3b1212){return _0x2fa691['sendStatus'](_0x25fc05);}return _0x2fa691[_0xefa1('0x18')](_0x25fc05)[_0xefa1('0x19')]();};}function respondWithResult(_0x906eb5,_0x68f189){_0x68f189=_0x68f189||0xc8;return function(_0x477b4a){if(_0x477b4a){return _0x906eb5[_0xefa1('0x18')](_0x68f189)['json'](_0x477b4a);}};}function respondWithFilteredResult(_0x109735,_0x15eb71){return function(_0x40867a){if(_0x40867a){var _0x53b033=typeof _0x15eb71[_0xefa1('0x1a')]===_0xefa1('0x1b')&&typeof _0x15eb71[_0xefa1('0x1c')]===_0xefa1('0x1b');var _0x299943=_0x40867a[_0xefa1('0x1d')];var _0x3d11fd=_0x53b033?0x0:_0x15eb71[_0xefa1('0x1a')];var _0x68c032=_0x53b033?_0x40867a[_0xefa1('0x1d')]:_0x15eb71[_0xefa1('0x1a')]+_0x15eb71[_0xefa1('0x1c')];var _0xa43af1;if(_0x68c032>=_0x299943){_0x68c032=_0x299943;_0xa43af1=0xc8;}else{_0xa43af1=0xce;}_0x109735[_0xefa1('0x18')](_0xa43af1);return _0x109735[_0xefa1('0x1e')](_0xefa1('0x1f'),_0x3d11fd+'-'+_0x68c032+'/'+_0x299943)[_0xefa1('0x20')](_0x40867a);}return null;};}function patchUpdates(_0x507e98){return function(_0x4b13ce){try{jsonpatch[_0xefa1('0x21')](_0x4b13ce,_0x507e98,!![]);}catch(_0x2be731){return BPromise[_0xefa1('0x22')](_0x2be731);}return _0x4b13ce[_0xefa1('0x23')]();};}function saveUpdates(_0x29ff37,_0x3bad0b){return function(_0x2182d5){if(_0x2182d5){return _0x2182d5['update'](_0x29ff37)[_0xefa1('0x24')](function(_0x584cb4){return _0x584cb4;});}return null;};}function removeEntity(_0x29d00f,_0x57b5fb){return function(_0x187c13){if(_0x187c13){return _0x187c13[_0xefa1('0x25')]()[_0xefa1('0x24')](function(){_0x29d00f[_0xefa1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb95fbe,_0x4e4472){return function(_0x557c70){if(!_0x557c70){_0xb95fbe[_0xefa1('0x26')](0x194);}return _0x557c70;};}function handleError(_0x4ebaa4,_0x2a8045){_0x2a8045=_0x2a8045||0x1f4;return function(_0x1e642a){logger[_0xefa1('0x27')](_0x1e642a[_0xefa1('0x28')]);if(_0x1e642a[_0xefa1('0x29')]){delete _0x1e642a[_0xefa1('0x29')];}_0x4ebaa4[_0xefa1('0x18')](_0x2a8045)['send'](_0x1e642a);};}exports['index']=function(_0x1e400a,_0x18b2b2){var _0x512f9d={},_0x533c68={},_0x3d7052={'count':0x0,'rows':[]};var _0x484243=_[_0xefa1('0x2a')](db['VtigerConfiguration'][_0xefa1('0x2b')],function(_0x42fe98){return{'name':_0x42fe98[_0xefa1('0x2c')],'type':_0x42fe98[_0xefa1('0x2d')][_0xefa1('0x2e')]};});_0x533c68[_0xefa1('0x2f')]=_[_0xefa1('0x2a')](_0x484243,'name');_0x533c68[_0xefa1('0x30')]=_['keys'](_0x1e400a[_0xefa1('0x30')]);_0x533c68[_0xefa1('0x31')]=_[_0xefa1('0x32')](_0x533c68['model'],_0x533c68[_0xefa1('0x30')]);_0x512f9d['attributes']=_[_0xefa1('0x32')](_0x533c68[_0xefa1('0x2f')],qs[_0xefa1('0x33')](_0x1e400a[_0xefa1('0x30')][_0xefa1('0x33')]));_0x512f9d['attributes']=_0x512f9d[_0xefa1('0x34')][_0xefa1('0x35')]?_0x512f9d['attributes']:_0x533c68['model'];if(!_0x1e400a['query']['hasOwnProperty'](_0xefa1('0x36'))){_0x512f9d[_0xefa1('0x1c')]=qs[_0xefa1('0x1c')](_0x1e400a[_0xefa1('0x30')]['limit']);_0x512f9d[_0xefa1('0x1a')]=qs['offset'](_0x1e400a[_0xefa1('0x30')][_0xefa1('0x1a')]);}_0x512f9d[_0xefa1('0x37')]=qs[_0xefa1('0x38')](_0x1e400a[_0xefa1('0x30')]['sort']);_0x512f9d['where']=qs['filters'](_[_0xefa1('0x39')](_0x1e400a[_0xefa1('0x30')],_0x533c68[_0xefa1('0x31')]),_0x484243);if(_0x1e400a['query'][_0xefa1('0x3a')]){_0x512f9d[_0xefa1('0x3b')]=_['merge'](_0x512f9d[_0xefa1('0x3b')],{'$or':_[_0xefa1('0x2a')](_0x484243,function(_0xcd995){if(_0xcd995[_0xefa1('0x2d')]!==_0xefa1('0x3c')){var _0x5beb72={};_0x5beb72[_0xcd995[_0xefa1('0x29')]]={'$like':'%'+_0x1e400a[_0xefa1('0x30')][_0xefa1('0x3a')]+'%'};return _0x5beb72;}})});}_0x512f9d=_[_0xefa1('0x3d')]({},_0x512f9d,_0x1e400a[_0xefa1('0x3e')]);var _0x1db0c1={'where':_0x512f9d['where']};return db[_0xefa1('0x3f')][_0xefa1('0x1d')](_0x1db0c1)[_0xefa1('0x24')](function(_0x120094){_0x3d7052[_0xefa1('0x1d')]=_0x120094;if(_0x1e400a['query'][_0xefa1('0x40')]){_0x512f9d['include']=[{'all':!![]}];}return db[_0xefa1('0x3f')][_0xefa1('0x41')](_0x512f9d);})['then'](function(_0x208b83){_0x3d7052[_0xefa1('0x42')]=_0x208b83;return _0x3d7052;})[_0xefa1('0x24')](respondWithFilteredResult(_0x18b2b2,_0x512f9d))['catch'](handleError(_0x18b2b2,null));};exports[_0xefa1('0x43')]=function(_0x4bd962,_0x1eb4dc){var _0x4d59ac={'raw':![],'where':{'id':_0x4bd962[_0xefa1('0x44')]['id']}},_0x51a68c={};_0x51a68c['model']=_[_0xefa1('0x45')](db[_0xefa1('0x3f')][_0xefa1('0x2b')]);_0x51a68c[_0xefa1('0x30')]=_[_0xefa1('0x45')](_0x4bd962[_0xefa1('0x30')]);_0x51a68c[_0xefa1('0x31')]=_['intersection'](_0x51a68c['model'],_0x51a68c[_0xefa1('0x30')]);_0x4d59ac[_0xefa1('0x34')]=_[_0xefa1('0x32')](_0x51a68c[_0xefa1('0x2f')],qs[_0xefa1('0x33')](_0x4bd962[_0xefa1('0x30')][_0xefa1('0x33')]));_0x4d59ac[_0xefa1('0x34')]=_0x4d59ac[_0xefa1('0x34')][_0xefa1('0x35')]?_0x4d59ac[_0xefa1('0x34')]:_0x51a68c[_0xefa1('0x2f')];if(_0x4bd962['query']['includeAll']){_0x4d59ac[_0xefa1('0x46')]=[{'all':!![]}];}_0x4d59ac=_[_0xefa1('0x3d')]({},_0x4d59ac,_0x4bd962[_0xefa1('0x3e')]);return db[_0xefa1('0x3f')]['find'](_0x4d59ac)[_0xefa1('0x24')](handleEntityNotFound(_0x1eb4dc,null))[_0xefa1('0x24')](respondWithResult(_0x1eb4dc,null))['catch'](handleError(_0x1eb4dc,null));};exports[_0xefa1('0x47')]=function(_0x5bb5b5,_0x48fc36){return db[_0xefa1('0x3f')][_0xefa1('0x47')](_0x5bb5b5[_0xefa1('0x48')],{})[_0xefa1('0x24')](respondWithResult(_0x48fc36,0xc9))[_0xefa1('0x49')](handleError(_0x48fc36,null));};exports[_0xefa1('0x4a')]=function(_0x33aa4f,_0x13d34d){if(_0x33aa4f[_0xefa1('0x48')]['id']){delete _0x33aa4f['body']['id'];}return db[_0xefa1('0x3f')]['find']({'where':{'id':_0x33aa4f['params']['id']}})[_0xefa1('0x24')](handleEntityNotFound(_0x13d34d,null))[_0xefa1('0x24')](saveUpdates(_0x33aa4f[_0xefa1('0x48')],null))['then'](respondWithResult(_0x13d34d,null))[_0xefa1('0x49')](handleError(_0x13d34d,null));};exports['destroy']=function(_0x45c784,_0x2be606){return db[_0xefa1('0x3f')]['find']({'where':{'id':_0x45c784[_0xefa1('0x44')]['id']}})['then'](handleEntityNotFound(_0x2be606,null))[_0xefa1('0x24')](removeEntity(_0x2be606,null))['catch'](handleError(_0x2be606,null));};exports[_0xefa1('0x4b')]=function(_0x3d0324,_0xad4fc2,_0x187223){var _0x288965={};var _0x29fed4={};var _0x1c6584;var _0x19c9ec;return db[_0xefa1('0x3f')]['findOne']({'where':{'id':_0x3d0324[_0xefa1('0x44')]['id']}})[_0xefa1('0x24')](handleEntityNotFound(_0xad4fc2,null))[_0xefa1('0x24')](function(_0x5d7e6c){if(_0x5d7e6c){_0x1c6584=_0x5d7e6c;_0x29fed4[_0xefa1('0x2f')]=_[_0xefa1('0x45')](db[_0xefa1('0x4c')][_0xefa1('0x2b')]);_0x29fed4[_0xefa1('0x30')]=_['keys'](_0x3d0324['query']);_0x29fed4[_0xefa1('0x31')]=_[_0xefa1('0x32')](_0x29fed4[_0xefa1('0x2f')],_0x29fed4[_0xefa1('0x30')]);_0x288965[_0xefa1('0x34')]=_[_0xefa1('0x32')](_0x29fed4['model'],qs['fields'](_0x3d0324[_0xefa1('0x30')]['fields']));_0x288965[_0xefa1('0x34')]=_0x288965[_0xefa1('0x34')][_0xefa1('0x35')]?_0x288965['attributes']:_0x29fed4[_0xefa1('0x2f')];_0x288965[_0xefa1('0x37')]=qs[_0xefa1('0x38')](_0x3d0324[_0xefa1('0x30')][_0xefa1('0x38')]);_0x288965['where']=qs['filters'](_[_0xefa1('0x39')](_0x3d0324[_0xefa1('0x30')],_0x29fed4[_0xefa1('0x31')]));if(_0x3d0324['query']['filter']){_0x288965['where']=_[_0xefa1('0x3d')](_0x288965[_0xefa1('0x3b')],{'$or':_[_0xefa1('0x2a')](_0x288965[_0xefa1('0x34')],function(_0x572d7d){var _0x502127={};_0x502127[_0x572d7d]={'$like':'%'+_0x3d0324[_0xefa1('0x30')]['filter']+'%'};return _0x502127;})});}_0x288965=_['merge']({},_0x288965,_0x3d0324[_0xefa1('0x3e')]);return _0x1c6584['getFields'](_0x288965);}})['then'](function(_0x3e3277){if(_0x3e3277){_0x19c9ec=_0x3e3277[_0xefa1('0x35')];if(!_0x3d0324[_0xefa1('0x30')][_0xefa1('0x4d')]('nolimit')){_0x288965['limit']=qs[_0xefa1('0x1c')](_0x3d0324[_0xefa1('0x30')][_0xefa1('0x1c')]);_0x288965[_0xefa1('0x1a')]=qs['offset'](_0x3d0324[_0xefa1('0x30')]['offset']);}return _0x1c6584[_0xefa1('0x4b')](_0x288965);}})['then'](function(_0x5bf047){if(_0x5bf047){return _0x5bf047?{'count':_0x19c9ec,'rows':_0x5bf047}:null;}})['then'](respondWithResult(_0xad4fc2,null))[_0xefa1('0x49')](handleError(_0xad4fc2,null));};exports['getSubjects']=function(_0x248a3d,_0x1a78bd,_0x25e5e0){var _0x4617b2={};var _0x170d32={};var _0x10d753;var _0x1fc608;return db['VtigerConfiguration'][_0xefa1('0x4e')]({'where':{'id':_0x248a3d[_0xefa1('0x44')]['id']}})[_0xefa1('0x24')](handleEntityNotFound(_0x1a78bd,null))[_0xefa1('0x24')](function(_0x4677ef){if(_0x4677ef){_0x10d753=_0x4677ef;_0x170d32['model']=_[_0xefa1('0x45')](db[_0xefa1('0x4c')][_0xefa1('0x2b')]);_0x170d32['query']=_[_0xefa1('0x45')](_0x248a3d['query']);_0x170d32[_0xefa1('0x31')]=_['intersection'](_0x170d32[_0xefa1('0x2f')],_0x170d32[_0xefa1('0x30')]);_0x4617b2[_0xefa1('0x34')]=_['intersection'](_0x170d32[_0xefa1('0x2f')],qs[_0xefa1('0x33')](_0x248a3d[_0xefa1('0x30')][_0xefa1('0x33')]));_0x4617b2[_0xefa1('0x34')]=_0x4617b2['attributes'][_0xefa1('0x35')]?_0x4617b2['attributes']:_0x170d32[_0xefa1('0x2f')];_0x4617b2[_0xefa1('0x37')]=qs[_0xefa1('0x38')](_0x248a3d[_0xefa1('0x30')][_0xefa1('0x38')]);_0x4617b2['where']=qs[_0xefa1('0x31')](_['pick'](_0x248a3d[_0xefa1('0x30')],_0x170d32[_0xefa1('0x31')]));if(_0x248a3d['query'][_0xefa1('0x3a')]){_0x4617b2['where']=_[_0xefa1('0x3d')](_0x4617b2[_0xefa1('0x3b')],{'$or':_[_0xefa1('0x2a')](_0x4617b2[_0xefa1('0x34')],function(_0x162979){var _0xeb8194={};_0xeb8194[_0x162979]={'$like':'%'+_0x248a3d[_0xefa1('0x30')]['filter']+'%'};return _0xeb8194;})});}_0x4617b2=_[_0xefa1('0x3d')]({},_0x4617b2,_0x248a3d[_0xefa1('0x3e')]);return _0x10d753[_0xefa1('0x4f')](_0x4617b2);}})['then'](function(_0x5de3e3){if(_0x5de3e3){_0x1fc608=_0x5de3e3[_0xefa1('0x35')];if(!_0x248a3d[_0xefa1('0x30')][_0xefa1('0x4d')](_0xefa1('0x36'))){_0x4617b2['limit']=qs[_0xefa1('0x1c')](_0x248a3d[_0xefa1('0x30')][_0xefa1('0x1c')]);_0x4617b2[_0xefa1('0x1a')]=qs[_0xefa1('0x1a')](_0x248a3d[_0xefa1('0x30')][_0xefa1('0x1a')]);}return _0x10d753[_0xefa1('0x4f')](_0x4617b2);}})[_0xefa1('0x24')](function(_0x193be8){if(_0x193be8){return _0x193be8?{'count':_0x1fc608,'rows':_0x193be8}:null;}})['then'](respondWithResult(_0x1a78bd,null))['catch'](handleError(_0x1a78bd,null));};exports[_0xefa1('0x50')]=function(_0x7fddfd,_0x31141b,_0x3abd59){var _0x498dc4={};var _0x5732d0={};var _0x39da19;var _0xdb3e94;return db[_0xefa1('0x3f')][_0xefa1('0x4e')]({'where':{'id':_0x7fddfd[_0xefa1('0x44')]['id']}})['then'](handleEntityNotFound(_0x31141b,null))[_0xefa1('0x24')](function(_0xe45e9b){if(_0xe45e9b){_0x39da19=_0xe45e9b;_0x5732d0[_0xefa1('0x2f')]=_[_0xefa1('0x45')](db[_0xefa1('0x4c')][_0xefa1('0x2b')]);_0x5732d0[_0xefa1('0x30')]=_[_0xefa1('0x45')](_0x7fddfd[_0xefa1('0x30')]);_0x5732d0[_0xefa1('0x31')]=_[_0xefa1('0x32')](_0x5732d0['model'],_0x5732d0[_0xefa1('0x30')]);_0x498dc4[_0xefa1('0x34')]=_[_0xefa1('0x32')](_0x5732d0['model'],qs['fields'](_0x7fddfd[_0xefa1('0x30')][_0xefa1('0x33')]));_0x498dc4[_0xefa1('0x34')]=_0x498dc4['attributes'][_0xefa1('0x35')]?_0x498dc4[_0xefa1('0x34')]:_0x5732d0[_0xefa1('0x2f')];_0x498dc4[_0xefa1('0x37')]=qs[_0xefa1('0x38')](_0x7fddfd['query']['sort']);_0x498dc4[_0xefa1('0x3b')]=qs[_0xefa1('0x31')](_[_0xefa1('0x39')](_0x7fddfd[_0xefa1('0x30')],_0x5732d0[_0xefa1('0x31')]));if(_0x7fddfd[_0xefa1('0x30')][_0xefa1('0x3a')]){_0x498dc4[_0xefa1('0x3b')]=_['merge'](_0x498dc4[_0xefa1('0x3b')],{'$or':_['map'](_0x498dc4[_0xefa1('0x34')],function(_0x2a2a00){var _0x53fd0b={};_0x53fd0b[_0x2a2a00]={'$like':'%'+_0x7fddfd[_0xefa1('0x30')]['filter']+'%'};return _0x53fd0b;})});}_0x498dc4=_[_0xefa1('0x3d')]({},_0x498dc4,_0x7fddfd[_0xefa1('0x3e')]);return _0x39da19[_0xefa1('0x50')](_0x498dc4);}})['then'](function(_0x45808){if(_0x45808){_0xdb3e94=_0x45808['length'];if(!_0x7fddfd['query']['hasOwnProperty'](_0xefa1('0x36'))){_0x498dc4[_0xefa1('0x1c')]=qs['limit'](_0x7fddfd[_0xefa1('0x30')][_0xefa1('0x1c')]);_0x498dc4[_0xefa1('0x1a')]=qs['offset'](_0x7fddfd['query'][_0xefa1('0x1a')]);}return _0x39da19[_0xefa1('0x50')](_0x498dc4);}})[_0xefa1('0x24')](function(_0x14add8){if(_0x14add8){return _0x14add8?{'count':_0xdb3e94,'rows':_0x14add8}:null;}})[_0xefa1('0x24')](respondWithResult(_0x31141b,null))['catch'](handleError(_0x31141b,null));}; \ No newline at end of file +var _0x4134=['map','VtigerConfiguration','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','params','keys','length','options','create','body','find','destroy','findOne','VtigerField','sort','getFields','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','update','then','error','name','index'];(function(_0x43f6d2,_0x11b4e9){var _0xaef57=function(_0x14f35f){while(--_0x14f35f){_0x43f6d2['push'](_0x43f6d2['shift']());}};_0xaef57(++_0x11b4e9);}(_0x4134,0x1ac));var _0x4413=function(_0x2828bd,_0x3f793b){_0x2828bd=_0x2828bd-0x0;var _0x4cd7c2=_0x4134[_0x2828bd];return _0x4cd7c2;};'use strict';var emlformat=require(_0x4413('0x0'));var rimraf=require(_0x4413('0x1'));var zipdir=require(_0x4413('0x2'));var jsonpatch=require(_0x4413('0x3'));var rp=require('request-promise');var moment=require(_0x4413('0x4'));var BPromise=require(_0x4413('0x5'));var Mustache=require(_0x4413('0x6'));var util=require('util');var path=require(_0x4413('0x7'));var sox=require(_0x4413('0x8'));var csv=require(_0x4413('0x9'));var ejs=require(_0x4413('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4413('0xb'));var squel=require(_0x4413('0xc'));var crypto=require(_0x4413('0xd'));var jsforce=require(_0x4413('0xe'));var deskjs=require(_0x4413('0xf'));var toCsv=require(_0x4413('0x9'));var querystring=require(_0x4413('0x10'));var Papa=require(_0x4413('0x11'));var Redis=require('ioredis');var authService=require(_0x4413('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4413('0x13'));var hardwareService=require(_0x4413('0x14'));var logger=require(_0x4413('0x15'))(_0x4413('0x16'));var utils=require(_0x4413('0x17'));var config=require(_0x4413('0x18'));var licenseUtil=require(_0x4413('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39fa2e,_0x3b9a1b){_0x3b9a1b=_0x3b9a1b||0xcc;return function(_0x17aefd){if(_0x17aefd){return _0x39fa2e[_0x4413('0x1a')](_0x3b9a1b);}return _0x39fa2e[_0x4413('0x1b')](_0x3b9a1b)['end']();};}function respondWithResult(_0x278e65,_0x1364cb){_0x1364cb=_0x1364cb||0xc8;return function(_0x4d6ae2){if(_0x4d6ae2){return _0x278e65['status'](_0x1364cb)[_0x4413('0x1c')](_0x4d6ae2);}};}function respondWithFilteredResult(_0x3e3ace,_0x579025){return function(_0x2f6e90){if(_0x2f6e90){var _0x49a697=typeof _0x579025['offset']===_0x4413('0x1d')&&typeof _0x579025[_0x4413('0x1e')]===_0x4413('0x1d');var _0x28f869=_0x2f6e90[_0x4413('0x1f')];var _0x537334=_0x49a697?0x0:_0x579025[_0x4413('0x20')];var _0x31b0b0=_0x49a697?_0x2f6e90[_0x4413('0x1f')]:_0x579025[_0x4413('0x20')]+_0x579025['limit'];var _0x1c13b1;if(_0x31b0b0>=_0x28f869){_0x31b0b0=_0x28f869;_0x1c13b1=0xc8;}else{_0x1c13b1=0xce;}_0x3e3ace['status'](_0x1c13b1);return _0x3e3ace['set'](_0x4413('0x21'),_0x537334+'-'+_0x31b0b0+'/'+_0x28f869)[_0x4413('0x1c')](_0x2f6e90);}return null;};}function patchUpdates(_0x17fad3){return function(_0x2c40b0){try{jsonpatch[_0x4413('0x22')](_0x2c40b0,_0x17fad3,!![]);}catch(_0x596aae){return BPromise['reject'](_0x596aae);}return _0x2c40b0['save']();};}function saveUpdates(_0x23d4cd,_0x448d1d){return function(_0xa3a122){if(_0xa3a122){return _0xa3a122[_0x4413('0x23')](_0x23d4cd)[_0x4413('0x24')](function(_0x48a008){return _0x48a008;});}return null;};}function removeEntity(_0x4ca63b,_0x31b221){return function(_0x39e9a4){if(_0x39e9a4){return _0x39e9a4['destroy']()[_0x4413('0x24')](function(){_0x4ca63b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d304f,_0xc95a5e){return function(_0x547157){if(!_0x547157){_0x3d304f[_0x4413('0x1a')](0x194);}return _0x547157;};}function handleError(_0x54aa5e,_0xd487b0){_0xd487b0=_0xd487b0||0x1f4;return function(_0x3f4799){logger[_0x4413('0x25')](_0x3f4799['stack']);if(_0x3f4799[_0x4413('0x26')]){delete _0x3f4799[_0x4413('0x26')];}_0x54aa5e[_0x4413('0x1b')](_0xd487b0)['send'](_0x3f4799);};}exports[_0x4413('0x27')]=function(_0x3be7b1,_0x5eb34e){var _0x1092ea={},_0x4a314e={},_0x3a456d={'count':0x0,'rows':[]};var _0x1de24a=_[_0x4413('0x28')](db[_0x4413('0x29')][_0x4413('0x2a')],function(_0x5affd4){return{'name':_0x5affd4[_0x4413('0x2b')],'type':_0x5affd4['type']['key']};});_0x4a314e[_0x4413('0x2c')]=_['map'](_0x1de24a,'name');_0x4a314e[_0x4413('0x2d')]=_['keys'](_0x3be7b1[_0x4413('0x2d')]);_0x4a314e[_0x4413('0x2e')]=_[_0x4413('0x2f')](_0x4a314e[_0x4413('0x2c')],_0x4a314e[_0x4413('0x2d')]);_0x1092ea[_0x4413('0x30')]=_[_0x4413('0x2f')](_0x4a314e['model'],qs[_0x4413('0x31')](_0x3be7b1[_0x4413('0x2d')][_0x4413('0x31')]));_0x1092ea[_0x4413('0x30')]=_0x1092ea[_0x4413('0x30')]['length']?_0x1092ea['attributes']:_0x4a314e[_0x4413('0x2c')];if(!_0x3be7b1['query'][_0x4413('0x32')](_0x4413('0x33'))){_0x1092ea['limit']=qs[_0x4413('0x1e')](_0x3be7b1[_0x4413('0x2d')][_0x4413('0x1e')]);_0x1092ea['offset']=qs[_0x4413('0x20')](_0x3be7b1[_0x4413('0x2d')]['offset']);}_0x1092ea['order']=qs['sort'](_0x3be7b1[_0x4413('0x2d')]['sort']);_0x1092ea[_0x4413('0x34')]=qs[_0x4413('0x2e')](_[_0x4413('0x35')](_0x3be7b1['query'],_0x4a314e[_0x4413('0x2e')]),_0x1de24a);if(_0x3be7b1[_0x4413('0x2d')][_0x4413('0x36')]){_0x1092ea[_0x4413('0x34')]=_[_0x4413('0x37')](_0x1092ea[_0x4413('0x34')],{'$or':_[_0x4413('0x28')](_0x1de24a,function(_0x26cc9b){if(_0x26cc9b[_0x4413('0x38')]!==_0x4413('0x39')){var _0x9e791a={};_0x9e791a[_0x26cc9b[_0x4413('0x26')]]={'$like':'%'+_0x3be7b1['query'][_0x4413('0x36')]+'%'};return _0x9e791a;}})});}_0x1092ea=_['merge']({},_0x1092ea,_0x3be7b1['options']);var _0x4242e1={'where':_0x1092ea[_0x4413('0x34')]};return db['VtigerConfiguration'][_0x4413('0x1f')](_0x4242e1)[_0x4413('0x24')](function(_0x4e267f){_0x3a456d[_0x4413('0x1f')]=_0x4e267f;if(_0x3be7b1['query'][_0x4413('0x3a')]){_0x1092ea['include']=[{'all':!![]}];}return db[_0x4413('0x29')][_0x4413('0x3b')](_0x1092ea);})[_0x4413('0x24')](function(_0x271052){_0x3a456d[_0x4413('0x3c')]=_0x271052;return _0x3a456d;})[_0x4413('0x24')](respondWithFilteredResult(_0x5eb34e,_0x1092ea))[_0x4413('0x3d')](handleError(_0x5eb34e,null));};exports[_0x4413('0x3e')]=function(_0x41917a,_0x3b029b){var _0x53781c={'raw':![],'where':{'id':_0x41917a[_0x4413('0x3f')]['id']}},_0x4943f5={};_0x4943f5[_0x4413('0x2c')]=_['keys'](db[_0x4413('0x29')][_0x4413('0x2a')]);_0x4943f5[_0x4413('0x2d')]=_[_0x4413('0x40')](_0x41917a[_0x4413('0x2d')]);_0x4943f5[_0x4413('0x2e')]=_[_0x4413('0x2f')](_0x4943f5[_0x4413('0x2c')],_0x4943f5[_0x4413('0x2d')]);_0x53781c[_0x4413('0x30')]=_[_0x4413('0x2f')](_0x4943f5['model'],qs[_0x4413('0x31')](_0x41917a['query']['fields']));_0x53781c[_0x4413('0x30')]=_0x53781c['attributes'][_0x4413('0x41')]?_0x53781c[_0x4413('0x30')]:_0x4943f5[_0x4413('0x2c')];if(_0x41917a[_0x4413('0x2d')][_0x4413('0x3a')]){_0x53781c['include']=[{'all':!![]}];}_0x53781c=_[_0x4413('0x37')]({},_0x53781c,_0x41917a[_0x4413('0x42')]);return db['VtigerConfiguration']['find'](_0x53781c)['then'](handleEntityNotFound(_0x3b029b,null))[_0x4413('0x24')](respondWithResult(_0x3b029b,null))[_0x4413('0x3d')](handleError(_0x3b029b,null));};exports[_0x4413('0x43')]=function(_0x2ceffc,_0x5211ee){return db['VtigerConfiguration'][_0x4413('0x43')](_0x2ceffc['body'],{})[_0x4413('0x24')](respondWithResult(_0x5211ee,0xc9))[_0x4413('0x3d')](handleError(_0x5211ee,null));};exports[_0x4413('0x23')]=function(_0x21bdd1,_0x4c6059){if(_0x21bdd1['body']['id']){delete _0x21bdd1[_0x4413('0x44')]['id'];}return db[_0x4413('0x29')][_0x4413('0x45')]({'where':{'id':_0x21bdd1[_0x4413('0x3f')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x4c6059,null))[_0x4413('0x24')](saveUpdates(_0x21bdd1['body'],null))[_0x4413('0x24')](respondWithResult(_0x4c6059,null))[_0x4413('0x3d')](handleError(_0x4c6059,null));};exports[_0x4413('0x46')]=function(_0x541b7c,_0x1e474e){return db['VtigerConfiguration']['find']({'where':{'id':_0x541b7c['params']['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x1e474e,null))[_0x4413('0x24')](removeEntity(_0x1e474e,null))[_0x4413('0x3d')](handleError(_0x1e474e,null));};exports['getFields']=function(_0x43aa9e,_0x421465,_0x19aea1){var _0x404516={};var _0x38a58a={};var _0x34624a;var _0x273c08;return db[_0x4413('0x29')][_0x4413('0x47')]({'where':{'id':_0x43aa9e[_0x4413('0x3f')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x421465,null))['then'](function(_0x2e7385){if(_0x2e7385){_0x34624a=_0x2e7385;_0x38a58a[_0x4413('0x2c')]=_[_0x4413('0x40')](db[_0x4413('0x48')][_0x4413('0x2a')]);_0x38a58a[_0x4413('0x2d')]=_[_0x4413('0x40')](_0x43aa9e[_0x4413('0x2d')]);_0x38a58a['filters']=_['intersection'](_0x38a58a[_0x4413('0x2c')],_0x38a58a[_0x4413('0x2d')]);_0x404516['attributes']=_['intersection'](_0x38a58a[_0x4413('0x2c')],qs['fields'](_0x43aa9e[_0x4413('0x2d')][_0x4413('0x31')]));_0x404516['attributes']=_0x404516[_0x4413('0x30')][_0x4413('0x41')]?_0x404516[_0x4413('0x30')]:_0x38a58a[_0x4413('0x2c')];_0x404516['order']=qs['sort'](_0x43aa9e[_0x4413('0x2d')][_0x4413('0x49')]);_0x404516[_0x4413('0x34')]=qs[_0x4413('0x2e')](_[_0x4413('0x35')](_0x43aa9e[_0x4413('0x2d')],_0x38a58a['filters']));if(_0x43aa9e[_0x4413('0x2d')][_0x4413('0x36')]){_0x404516[_0x4413('0x34')]=_[_0x4413('0x37')](_0x404516[_0x4413('0x34')],{'$or':_[_0x4413('0x28')](_0x404516['attributes'],function(_0x3b3ab9){var _0x3d4df6={};_0x3d4df6[_0x3b3ab9]={'$like':'%'+_0x43aa9e['query'][_0x4413('0x36')]+'%'};return _0x3d4df6;})});}_0x404516=_[_0x4413('0x37')]({},_0x404516,_0x43aa9e[_0x4413('0x42')]);return _0x34624a[_0x4413('0x4a')](_0x404516);}})[_0x4413('0x24')](function(_0x36372a){if(_0x36372a){_0x273c08=_0x36372a[_0x4413('0x41')];if(!_0x43aa9e['query'][_0x4413('0x32')](_0x4413('0x33'))){_0x404516[_0x4413('0x1e')]=qs[_0x4413('0x1e')](_0x43aa9e['query'][_0x4413('0x1e')]);_0x404516[_0x4413('0x20')]=qs['offset'](_0x43aa9e[_0x4413('0x2d')][_0x4413('0x20')]);}return _0x34624a[_0x4413('0x4a')](_0x404516);}})['then'](function(_0x4df3f2){if(_0x4df3f2){return _0x4df3f2?{'count':_0x273c08,'rows':_0x4df3f2}:null;}})['then'](respondWithResult(_0x421465,null))[_0x4413('0x3d')](handleError(_0x421465,null));};exports[_0x4413('0x4b')]=function(_0x13dd4b,_0x487375,_0x407be3){var _0x14e8ff={};var _0x1d9887={};var _0x3b833a;var _0x3fb719;return db[_0x4413('0x29')]['findOne']({'where':{'id':_0x13dd4b[_0x4413('0x3f')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x487375,null))[_0x4413('0x24')](function(_0x24e642){if(_0x24e642){_0x3b833a=_0x24e642;_0x1d9887[_0x4413('0x2c')]=_[_0x4413('0x40')](db[_0x4413('0x48')]['rawAttributes']);_0x1d9887[_0x4413('0x2d')]=_[_0x4413('0x40')](_0x13dd4b[_0x4413('0x2d')]);_0x1d9887['filters']=_[_0x4413('0x2f')](_0x1d9887[_0x4413('0x2c')],_0x1d9887[_0x4413('0x2d')]);_0x14e8ff[_0x4413('0x30')]=_[_0x4413('0x2f')](_0x1d9887[_0x4413('0x2c')],qs[_0x4413('0x31')](_0x13dd4b[_0x4413('0x2d')]['fields']));_0x14e8ff['attributes']=_0x14e8ff['attributes']['length']?_0x14e8ff['attributes']:_0x1d9887[_0x4413('0x2c')];_0x14e8ff[_0x4413('0x4c')]=qs['sort'](_0x13dd4b[_0x4413('0x2d')]['sort']);_0x14e8ff[_0x4413('0x34')]=qs['filters'](_['pick'](_0x13dd4b[_0x4413('0x2d')],_0x1d9887[_0x4413('0x2e')]));if(_0x13dd4b['query'][_0x4413('0x36')]){_0x14e8ff[_0x4413('0x34')]=_[_0x4413('0x37')](_0x14e8ff[_0x4413('0x34')],{'$or':_[_0x4413('0x28')](_0x14e8ff['attributes'],function(_0x5124e2){var _0x2c6753={};_0x2c6753[_0x5124e2]={'$like':'%'+_0x13dd4b[_0x4413('0x2d')][_0x4413('0x36')]+'%'};return _0x2c6753;})});}_0x14e8ff=_[_0x4413('0x37')]({},_0x14e8ff,_0x13dd4b[_0x4413('0x42')]);return _0x3b833a['getSubjects'](_0x14e8ff);}})[_0x4413('0x24')](function(_0x29f111){if(_0x29f111){_0x3fb719=_0x29f111[_0x4413('0x41')];if(!_0x13dd4b['query']['hasOwnProperty'](_0x4413('0x33'))){_0x14e8ff[_0x4413('0x1e')]=qs[_0x4413('0x1e')](_0x13dd4b[_0x4413('0x2d')][_0x4413('0x1e')]);_0x14e8ff[_0x4413('0x20')]=qs[_0x4413('0x20')](_0x13dd4b[_0x4413('0x2d')][_0x4413('0x20')]);}return _0x3b833a['getSubjects'](_0x14e8ff);}})['then'](function(_0x397979){if(_0x397979){return _0x397979?{'count':_0x3fb719,'rows':_0x397979}:null;}})['then'](respondWithResult(_0x487375,null))[_0x4413('0x3d')](handleError(_0x487375,null));};exports[_0x4413('0x4d')]=function(_0x4fed3a,_0x2472fa,_0x47328d){var _0x1b8c03={};var _0x163805={};var _0x928bc8;var _0x37ed08;return db['VtigerConfiguration'][_0x4413('0x47')]({'where':{'id':_0x4fed3a[_0x4413('0x3f')]['id']}})[_0x4413('0x24')](handleEntityNotFound(_0x2472fa,null))[_0x4413('0x24')](function(_0x4742d4){if(_0x4742d4){_0x928bc8=_0x4742d4;_0x163805['model']=_[_0x4413('0x40')](db['VtigerField'][_0x4413('0x2a')]);_0x163805[_0x4413('0x2d')]=_[_0x4413('0x40')](_0x4fed3a['query']);_0x163805[_0x4413('0x2e')]=_[_0x4413('0x2f')](_0x163805[_0x4413('0x2c')],_0x163805[_0x4413('0x2d')]);_0x1b8c03[_0x4413('0x30')]=_[_0x4413('0x2f')](_0x163805[_0x4413('0x2c')],qs[_0x4413('0x31')](_0x4fed3a[_0x4413('0x2d')]['fields']));_0x1b8c03[_0x4413('0x30')]=_0x1b8c03[_0x4413('0x30')][_0x4413('0x41')]?_0x1b8c03[_0x4413('0x30')]:_0x163805[_0x4413('0x2c')];_0x1b8c03[_0x4413('0x4c')]=qs[_0x4413('0x49')](_0x4fed3a[_0x4413('0x2d')][_0x4413('0x49')]);_0x1b8c03[_0x4413('0x34')]=qs[_0x4413('0x2e')](_['pick'](_0x4fed3a[_0x4413('0x2d')],_0x163805['filters']));if(_0x4fed3a[_0x4413('0x2d')][_0x4413('0x36')]){_0x1b8c03[_0x4413('0x34')]=_[_0x4413('0x37')](_0x1b8c03[_0x4413('0x34')],{'$or':_['map'](_0x1b8c03['attributes'],function(_0x443b2c){var _0x46349b={};_0x46349b[_0x443b2c]={'$like':'%'+_0x4fed3a[_0x4413('0x2d')][_0x4413('0x36')]+'%'};return _0x46349b;})});}_0x1b8c03=_[_0x4413('0x37')]({},_0x1b8c03,_0x4fed3a[_0x4413('0x42')]);return _0x928bc8['getDescriptions'](_0x1b8c03);}})[_0x4413('0x24')](function(_0x55bbfb){if(_0x55bbfb){_0x37ed08=_0x55bbfb['length'];if(!_0x4fed3a[_0x4413('0x2d')][_0x4413('0x32')](_0x4413('0x33'))){_0x1b8c03[_0x4413('0x1e')]=qs[_0x4413('0x1e')](_0x4fed3a[_0x4413('0x2d')][_0x4413('0x1e')]);_0x1b8c03[_0x4413('0x20')]=qs[_0x4413('0x20')](_0x4fed3a['query']['offset']);}return _0x928bc8[_0x4413('0x4d')](_0x1b8c03);}})[_0x4413('0x24')](function(_0x1b726b){if(_0x1b726b){return _0x1b726b?{'count':_0x37ed08,'rows':_0x1b726b}:null;}})['then'](respondWithResult(_0x2472fa,null))['catch'](handleError(_0x2472fa,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 96fa1f3..dd9464a 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 _0x9da7=['bluebird','request-promise','path','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x5de214,_0x107e9d){var _0x4df627=function(_0x4199e1){while(--_0x4199e1){_0x5de214['push'](_0x5de214['shift']());}};_0x4df627(++_0x107e9d);}(_0x9da7,0xcc));var _0x79da=function(_0x422b48,_0xf131fb){_0x422b48=_0x422b48-0x0;var _0x4a6f67=_0x9da7[_0x422b48];return _0x4a6f67;};'use strict';var _=require(_0x79da('0x0'));var util=require(_0x79da('0x1'));var logger=require(_0x79da('0x2'))(_0x79da('0x3'));var moment=require(_0x79da('0x4'));var BPromise=require(_0x79da('0x5'));var rp=require(_0x79da('0x6'));var fs=require('fs');var path=require(_0x79da('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intVtigerConfiguration.attributes');module[_0x79da('0x8')]=function(_0x2cf3d8,_0x2955e7){return _0x2cf3d8['define'](_0x79da('0x9'),attributes,{'tableName':_0x79da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x179f=['moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','int_vtiger_configurations','lodash','util','api'];(function(_0x1e3e1e,_0x1fe697){var _0xc9d950=function(_0x28b8cb){while(--_0x28b8cb){_0x1e3e1e['push'](_0x1e3e1e['shift']());}};_0xc9d950(++_0x1fe697);}(_0x179f,0x173));var _0xf179=function(_0x72e04a,_0x398f0b){_0x72e04a=_0x72e04a-0x0;var _0x4e8acf=_0x179f[_0x72e04a];return _0x4e8acf;};'use strict';var _=require(_0xf179('0x0'));var util=require(_0xf179('0x1'));var logger=require('../../config/logger')(_0xf179('0x2'));var moment=require(_0xf179('0x3'));var BPromise=require(_0xf179('0x4'));var rp=require(_0xf179('0x5'));var fs=require('fs');var path=require(_0xf179('0x6'));var rimraf=require('rimraf');var config=require(_0xf179('0x7'));var attributes=require(_0xf179('0x8'));module[_0xf179('0x9')]=function(_0x4b5b71,_0x49284a){return _0x4b5b71['define']('VtigerConfiguration',attributes,{'tableName':_0xf179('0xa'),'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 2be1f6c..da50fb4 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 _0x03d0=['then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x17a814,_0x5aaf50){var _0x41bceb=function(_0x2b2145){while(--_0x2b2145){_0x17a814['push'](_0x17a814['shift']());}};_0x41bceb(++_0x5aaf50);}(_0x03d0,0x7f));var _0x003d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x03d0[_0x2763f2];return _0x3ef471;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x003d('0x0'));var BPromise=require('bluebird');var rs=require(_0x003d('0x1'));var fs=require('fs');var Redis=require(_0x003d('0x2'));var db=require(_0x003d('0x3'))['db'];var utils=require(_0x003d('0x4'));var logger=require('../../config/logger')(_0x003d('0x5'));var config=require(_0x003d('0x6'));var jayson=require(_0x003d('0x7'));var client=jayson[_0x003d('0x8')][_0x003d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1edc4c,_0x12a0af,_0x7647bc){return new BPromise(function(_0x37ce39,_0x485ef1){return client[_0x003d('0xa')](_0x1edc4c,_0x7647bc)[_0x003d('0xb')](function(_0xfae15c){logger[_0x003d('0xc')](_0x003d('0xd'),_0x12a0af,_0x003d('0xe'));logger[_0x003d('0xf')](_0x003d('0x10'),_0x12a0af,_0x003d('0xe'),JSON[_0x003d('0x11')](_0xfae15c));if(_0xfae15c['error']){if(_0xfae15c[_0x003d('0x12')][_0x003d('0x13')]===0x1f4){logger[_0x003d('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x12a0af,_0xfae15c[_0x003d('0x12')][_0x003d('0x14')]);return _0x485ef1(_0xfae15c[_0x003d('0x12')]['message']);}logger[_0x003d('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x12a0af,_0xfae15c[_0x003d('0x12')]['message']);return _0x37ce39(_0xfae15c[_0x003d('0x12')][_0x003d('0x14')]);}else{logger['info'](_0x003d('0xd'),_0x12a0af,'request\x20sent');_0x37ce39(_0xfae15c[_0x003d('0x15')][_0x003d('0x14')]);}})[_0x003d('0x16')](function(_0x473df6){logger[_0x003d('0x12')](_0x003d('0xd'),_0x12a0af,_0x473df6);_0x485ef1(_0x473df6);});});} \ No newline at end of file +var _0x88fb=['error','code','message','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x1d40d5,_0x1ee7a0){var _0x28bdcb=function(_0x355f48){while(--_0x355f48){_0x1d40d5['push'](_0x1d40d5['shift']());}};_0x28bdcb(++_0x1ee7a0);}(_0x88fb,0x1e4));var _0xb88f=function(_0x3f8f44,_0x4bedc7){_0x3f8f44=_0x3f8f44-0x0;var _0x3bea7c=_0x88fb[_0x3f8f44];return _0x3bea7c;};'use strict';var _=require(_0xb88f('0x0'));var util=require(_0xb88f('0x1'));var moment=require('moment');var BPromise=require(_0xb88f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb88f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb88f('0x4'));var logger=require(_0xb88f('0x5'))('rpc');var config=require(_0xb88f('0x6'));var jayson=require(_0xb88f('0x7'));var client=jayson['client'][_0xb88f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4b2e15,_0x1a1176,_0x57023e){return new BPromise(function(_0x279815,_0x51545b){return client[_0xb88f('0x9')](_0x4b2e15,_0x57023e)[_0xb88f('0xa')](function(_0x5dadd1){logger[_0xb88f('0xb')](_0xb88f('0xc'),_0x1a1176,_0xb88f('0xd'));logger[_0xb88f('0xe')](_0xb88f('0xf'),_0x1a1176,'request\x20sent',JSON['stringify'](_0x5dadd1));if(_0x5dadd1[_0xb88f('0x10')]){if(_0x5dadd1[_0xb88f('0x10')][_0xb88f('0x11')]===0x1f4){logger['error'](_0xb88f('0xc'),_0x1a1176,_0x5dadd1[_0xb88f('0x10')][_0xb88f('0x12')]);return _0x51545b(_0x5dadd1[_0xb88f('0x10')][_0xb88f('0x12')]);}logger['error'](_0xb88f('0xc'),_0x1a1176,_0x5dadd1['error'][_0xb88f('0x12')]);return _0x279815(_0x5dadd1[_0xb88f('0x10')][_0xb88f('0x12')]);}else{logger[_0xb88f('0xb')](_0xb88f('0xc'),_0x1a1176,_0xb88f('0xd'));_0x279815(_0x5dadd1['result']['message']);}})[_0xb88f('0x13')](function(_0xc73112){logger[_0xb88f('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x1a1176,_0xc73112);_0x51545b(_0xc73112);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 9124d16..483ead0 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 _0x3176=['post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5cd7fd,_0x4de617){var _0x5213ae=function(_0x49b2aa){while(--_0x49b2aa){_0x5cd7fd['push'](_0x5cd7fd['shift']());}};_0x5213ae(++_0x4de617);}(_0x3176,0x123));var _0x6317=function(_0x1e66e6,_0x2e97ce){_0x1e66e6=_0x1e66e6-0x0;var _0x301755=_0x3176[_0x1e66e6];return _0x301755;};'use strict';var multer=require(_0x6317('0x0'));var util=require(_0x6317('0x1'));var path=require('path');var timeout=require(_0x6317('0x2'));var express=require('express');var router=express[_0x6317('0x3')]();var fs_extra=require(_0x6317('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6317('0x5'));var config=require(_0x6317('0x6'));var controller=require(_0x6317('0x7'));router[_0x6317('0x8')]('/',auth[_0x6317('0x9')](),controller[_0x6317('0xa')]);router['get'](_0x6317('0xb'),auth['isAuthenticated'](),controller[_0x6317('0xc')]);router[_0x6317('0xd')]('/',auth['isAuthenticated'](),controller[_0x6317('0xe')]);router['put'](_0x6317('0xb'),auth[_0x6317('0x9')](),controller[_0x6317('0xf')]);router[_0x6317('0x10')]('/:id',auth[_0x6317('0x9')](),controller[_0x6317('0x11')]);module[_0x6317('0x12')]=router; \ No newline at end of file +var _0x3add=['isAuthenticated','show','post','create','put','/:id','update','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get'];(function(_0x118b1c,_0x467921){var _0x33ca71=function(_0x297391){while(--_0x297391){_0x118b1c['push'](_0x118b1c['shift']());}};_0x33ca71(++_0x467921);}(_0x3add,0x128));var _0xd3ad=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x3add[_0x3725ee];return _0x399c71;};'use strict';var multer=require(_0xd3ad('0x0'));var util=require(_0xd3ad('0x1'));var path=require(_0xd3ad('0x2'));var timeout=require(_0xd3ad('0x3'));var express=require(_0xd3ad('0x4'));var router=express['Router']();var fs_extra=require(_0xd3ad('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd3ad('0x6'));var config=require(_0xd3ad('0x7'));var controller=require(_0xd3ad('0x8'));router[_0xd3ad('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0xd3ad('0xa')](),controller[_0xd3ad('0xb')]);router[_0xd3ad('0xc')]('/',auth[_0xd3ad('0xa')](),controller[_0xd3ad('0xd')]);router[_0xd3ad('0xe')](_0xd3ad('0xf'),auth[_0xd3ad('0xa')](),controller[_0xd3ad('0x10')]);router['delete'](_0xd3ad('0xf'),auth[_0xd3ad('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index 4c35835..e2688cc 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 _0xcaa1=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string'];(function(_0x43bbd7,_0x23d4fc){var _0x5c4715=function(_0x321d36){while(--_0x321d36){_0x43bbd7['push'](_0x43bbd7['shift']());}};_0x5c4715(++_0x23d4fc);}(_0xcaa1,0xfd));var _0x1caa=function(_0x55931c,_0x387762){_0x55931c=_0x55931c-0x0;var _0x5c7fcc=_0xcaa1[_0x55931c];return _0x5c7fcc;};'use strict';var Sequelize=require('sequelize');module[_0x1caa('0x0')]={'type':{'type':Sequelize[_0x1caa('0x1')](_0x1caa('0x2'),'variable',_0x1caa('0x3'),_0x1caa('0x4'),_0x1caa('0x5')),'defaultValue':_0x1caa('0x2')},'content':{'type':Sequelize[_0x1caa('0x6')]},'key':{'type':Sequelize[_0x1caa('0x6')]},'keyType':{'type':Sequelize[_0x1caa('0x1')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x1caa('0x6')]},'idField':{'type':Sequelize[_0x1caa('0x6')]},'nameField':{'type':Sequelize[_0x1caa('0x6')]},'customField':{'type':Sequelize[_0x1caa('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1caa('0x6')]}}; \ No newline at end of file +var _0xaf8d=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x5acdfc,_0x1870cc){var _0x16b04e=function(_0xe8d9d2){while(--_0xe8d9d2){_0x5acdfc['push'](_0x5acdfc['shift']());}};_0x16b04e(++_0x1870cc);}(_0xaf8d,0x155));var _0xdaf8=function(_0x2f1417,_0x2e7b4e){_0x2f1417=_0x2f1417-0x0;var _0x43e23a=_0xaf8d[_0x2f1417];return _0x43e23a;};'use strict';var Sequelize=require(_0xdaf8('0x0'));module[_0xdaf8('0x1')]={'type':{'type':Sequelize[_0xdaf8('0x2')]('string',_0xdaf8('0x3'),_0xdaf8('0x4'),_0xdaf8('0x5'),'picklist'),'defaultValue':_0xdaf8('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdaf8('0x7')]},'keyType':{'type':Sequelize[_0xdaf8('0x2')](_0xdaf8('0x6'),'variable',_0xdaf8('0x4'))},'keyContent':{'type':Sequelize[_0xdaf8('0x7')]},'idField':{'type':Sequelize[_0xdaf8('0x7')]},'nameField':{'type':Sequelize[_0xdaf8('0x7')]},'customField':{'type':Sequelize[_0xdaf8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdaf8('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index cdd9460..88cf9ac 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 _0x9a61=['create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','name','send','index','VtigerField','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','find'];(function(_0x4af39e,_0x9bec56){var _0x53fed2=function(_0x225423){while(--_0x225423){_0x4af39e['push'](_0x4af39e['shift']());}};_0x53fed2(++_0x9bec56);}(_0x9a61,0x1b2));var _0x19a6=function(_0xc5aa60,_0x18ad00){_0xc5aa60=_0xc5aa60-0x0;var _0x143e37=_0x9a61[_0xc5aa60];return _0x143e37;};'use strict';var emlformat=require(_0x19a6('0x0'));var rimraf=require(_0x19a6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x19a6('0x2'));var moment=require(_0x19a6('0x3'));var BPromise=require(_0x19a6('0x4'));var Mustache=require(_0x19a6('0x5'));var util=require(_0x19a6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x19a6('0x7'));var ejs=require(_0x19a6('0x8'));var fs=require('fs');var fs_extra=require(_0x19a6('0x9'));var _=require(_0x19a6('0xa'));var squel=require(_0x19a6('0xb'));var crypto=require(_0x19a6('0xc'));var jsforce=require(_0x19a6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x19a6('0x7'));var querystring=require(_0x19a6('0xe'));var Papa=require(_0x19a6('0xf'));var Redis=require(_0x19a6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x19a6('0x11'));var as=require(_0x19a6('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x19a6('0x13'))('api');var utils=require(_0x19a6('0x14'));var config=require(_0x19a6('0x15'));var licenseUtil=require(_0x19a6('0x16'));var db=require(_0x19a6('0x17'))['db'];function respondWithStatusCode(_0x4f5595,_0x284d70){_0x284d70=_0x284d70||0xcc;return function(_0x518220){if(_0x518220){return _0x4f5595[_0x19a6('0x18')](_0x284d70);}return _0x4f5595[_0x19a6('0x19')](_0x284d70)[_0x19a6('0x1a')]();};}function respondWithResult(_0x5c59fb,_0x7dd621){_0x7dd621=_0x7dd621||0xc8;return function(_0x2f8fa8){if(_0x2f8fa8){return _0x5c59fb['status'](_0x7dd621)['json'](_0x2f8fa8);}};}function respondWithFilteredResult(_0x4f6671,_0x507673){return function(_0x3362d3){if(_0x3362d3){var _0x168d89=typeof _0x507673[_0x19a6('0x1b')]===_0x19a6('0x1c')&&typeof _0x507673[_0x19a6('0x1d')]===_0x19a6('0x1c');var _0x42dc48=_0x3362d3[_0x19a6('0x1e')];var _0x50c1f6=_0x168d89?0x0:_0x507673[_0x19a6('0x1b')];var _0x495e07=_0x168d89?_0x3362d3[_0x19a6('0x1e')]:_0x507673['offset']+_0x507673[_0x19a6('0x1d')];var _0x16569f;if(_0x495e07>=_0x42dc48){_0x495e07=_0x42dc48;_0x16569f=0xc8;}else{_0x16569f=0xce;}_0x4f6671[_0x19a6('0x19')](_0x16569f);return _0x4f6671['set'](_0x19a6('0x1f'),_0x50c1f6+'-'+_0x495e07+'/'+_0x42dc48)[_0x19a6('0x20')](_0x3362d3);}return null;};}function patchUpdates(_0x37bd13){return function(_0x459692){try{jsonpatch[_0x19a6('0x21')](_0x459692,_0x37bd13,!![]);}catch(_0x121cf3){return BPromise['reject'](_0x121cf3);}return _0x459692['save']();};}function saveUpdates(_0x4bf7f2,_0xc1d915){return function(_0x294091){if(_0x294091){return _0x294091[_0x19a6('0x22')](_0x4bf7f2)[_0x19a6('0x23')](function(_0x4de2f9){return _0x4de2f9;});}return null;};}function removeEntity(_0x29cd61,_0x2fec10){return function(_0x309f1c){if(_0x309f1c){return _0x309f1c[_0x19a6('0x24')]()[_0x19a6('0x23')](function(){_0x29cd61[_0x19a6('0x19')](0xcc)[_0x19a6('0x1a')]();});}};}function handleEntityNotFound(_0x38b742,_0x5c4f56){return function(_0x26139c){if(!_0x26139c){_0x38b742[_0x19a6('0x18')](0x194);}return _0x26139c;};}function handleError(_0x4dc4db,_0x48ca1d){_0x48ca1d=_0x48ca1d||0x1f4;return function(_0x382371){logger[_0x19a6('0x25')](_0x382371['stack']);if(_0x382371[_0x19a6('0x26')]){delete _0x382371['name'];}_0x4dc4db[_0x19a6('0x19')](_0x48ca1d)[_0x19a6('0x27')](_0x382371);};}exports[_0x19a6('0x28')]=function(_0x4ea797,_0x123f5d){var _0x1bb26d={},_0xb2a676={},_0x544f16={'count':0x0,'rows':[]};var _0x34fea3=_['map'](db[_0x19a6('0x29')][_0x19a6('0x2a')],function(_0x581e4b){return{'name':_0x581e4b['fieldName'],'type':_0x581e4b[_0x19a6('0x2b')][_0x19a6('0x2c')]};});_0xb2a676[_0x19a6('0x2d')]=_[_0x19a6('0x2e')](_0x34fea3,'name');_0xb2a676[_0x19a6('0x2f')]=_[_0x19a6('0x30')](_0x4ea797[_0x19a6('0x2f')]);_0xb2a676[_0x19a6('0x31')]=_[_0x19a6('0x32')](_0xb2a676[_0x19a6('0x2d')],_0xb2a676[_0x19a6('0x2f')]);_0x1bb26d[_0x19a6('0x33')]=_[_0x19a6('0x32')](_0xb2a676[_0x19a6('0x2d')],qs[_0x19a6('0x34')](_0x4ea797[_0x19a6('0x2f')][_0x19a6('0x34')]));_0x1bb26d[_0x19a6('0x33')]=_0x1bb26d[_0x19a6('0x33')][_0x19a6('0x35')]?_0x1bb26d[_0x19a6('0x33')]:_0xb2a676['model'];if(!_0x4ea797[_0x19a6('0x2f')][_0x19a6('0x36')](_0x19a6('0x37'))){_0x1bb26d[_0x19a6('0x1d')]=qs['limit'](_0x4ea797['query']['limit']);_0x1bb26d[_0x19a6('0x1b')]=qs[_0x19a6('0x1b')](_0x4ea797[_0x19a6('0x2f')]['offset']);}_0x1bb26d[_0x19a6('0x38')]=qs[_0x19a6('0x39')](_0x4ea797[_0x19a6('0x2f')]['sort']);_0x1bb26d[_0x19a6('0x3a')]=qs[_0x19a6('0x31')](_[_0x19a6('0x3b')](_0x4ea797[_0x19a6('0x2f')],_0xb2a676[_0x19a6('0x31')]),_0x34fea3);if(_0x4ea797[_0x19a6('0x2f')][_0x19a6('0x3c')]){_0x1bb26d['where']=_[_0x19a6('0x3d')](_0x1bb26d[_0x19a6('0x3a')],{'$or':_[_0x19a6('0x2e')](_0x34fea3,function(_0x481266){if(_0x481266[_0x19a6('0x2b')]!=='VIRTUAL'){var _0x295289={};_0x295289[_0x481266[_0x19a6('0x26')]]={'$like':'%'+_0x4ea797[_0x19a6('0x2f')][_0x19a6('0x3c')]+'%'};return _0x295289;}})});}_0x1bb26d=_[_0x19a6('0x3d')]({},_0x1bb26d,_0x4ea797[_0x19a6('0x3e')]);var _0x3fec4d={'where':_0x1bb26d[_0x19a6('0x3a')]};return db[_0x19a6('0x29')]['count'](_0x3fec4d)[_0x19a6('0x23')](function(_0x1e4934){_0x544f16[_0x19a6('0x1e')]=_0x1e4934;if(_0x4ea797[_0x19a6('0x2f')][_0x19a6('0x3f')]){_0x1bb26d[_0x19a6('0x40')]=[{'all':!![]}];}return db[_0x19a6('0x29')]['findAll'](_0x1bb26d);})['then'](function(_0x57e4c5){_0x544f16[_0x19a6('0x41')]=_0x57e4c5;return _0x544f16;})[_0x19a6('0x23')](respondWithFilteredResult(_0x123f5d,_0x1bb26d))[_0x19a6('0x42')](handleError(_0x123f5d,null));};exports[_0x19a6('0x43')]=function(_0x31a896,_0xc70980){var _0x4fd1a5={'raw':!![],'where':{'id':_0x31a896[_0x19a6('0x44')]['id']}},_0x16e7c6={};_0x16e7c6[_0x19a6('0x2d')]=_[_0x19a6('0x30')](db[_0x19a6('0x29')][_0x19a6('0x2a')]);_0x16e7c6['query']=_[_0x19a6('0x30')](_0x31a896[_0x19a6('0x2f')]);_0x16e7c6[_0x19a6('0x31')]=_[_0x19a6('0x32')](_0x16e7c6[_0x19a6('0x2d')],_0x16e7c6[_0x19a6('0x2f')]);_0x4fd1a5['attributes']=_[_0x19a6('0x32')](_0x16e7c6[_0x19a6('0x2d')],qs[_0x19a6('0x34')](_0x31a896[_0x19a6('0x2f')][_0x19a6('0x34')]));_0x4fd1a5[_0x19a6('0x33')]=_0x4fd1a5['attributes']['length']?_0x4fd1a5[_0x19a6('0x33')]:_0x16e7c6['model'];if(_0x31a896[_0x19a6('0x2f')][_0x19a6('0x3f')]){_0x4fd1a5[_0x19a6('0x40')]=[{'all':!![]}];}_0x4fd1a5=_[_0x19a6('0x3d')]({},_0x4fd1a5,_0x31a896[_0x19a6('0x3e')]);return db[_0x19a6('0x29')][_0x19a6('0x45')](_0x4fd1a5)[_0x19a6('0x23')](handleEntityNotFound(_0xc70980,null))[_0x19a6('0x23')](respondWithResult(_0xc70980,null))[_0x19a6('0x42')](handleError(_0xc70980,null));};exports['create']=function(_0x3b5a3d,_0x4ca732){return db[_0x19a6('0x29')][_0x19a6('0x46')](_0x3b5a3d[_0x19a6('0x47')],{})['then'](respondWithResult(_0x4ca732,0xc9))[_0x19a6('0x42')](handleError(_0x4ca732,null));};exports[_0x19a6('0x22')]=function(_0x3d90ce,_0x2f9b9f){if(_0x3d90ce[_0x19a6('0x47')]['id']){delete _0x3d90ce['body']['id'];}return db[_0x19a6('0x29')][_0x19a6('0x45')]({'where':{'id':_0x3d90ce['params']['id']}})[_0x19a6('0x23')](handleEntityNotFound(_0x2f9b9f,null))['then'](saveUpdates(_0x3d90ce[_0x19a6('0x47')],null))[_0x19a6('0x23')](respondWithResult(_0x2f9b9f,null))['catch'](handleError(_0x2f9b9f,null));};exports[_0x19a6('0x24')]=function(_0x35d7e3,_0x185a61){return db[_0x19a6('0x29')]['find']({'where':{'id':_0x35d7e3[_0x19a6('0x44')]['id']}})['then'](handleEntityNotFound(_0x185a61,null))[_0x19a6('0x23')](removeEntity(_0x185a61,null))[_0x19a6('0x42')](handleError(_0x185a61,null));}; \ No newline at end of file +var _0x1258=['map','VtigerField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','destroy','error','stack','name','send','index'];(function(_0x3cfb42,_0x466f88){var _0x4ee87e=function(_0x57cd82){while(--_0x57cd82){_0x3cfb42['push'](_0x3cfb42['shift']());}};_0x4ee87e(++_0x466f88);}(_0x1258,0x1c4));var _0x8125=function(_0x1ba36e,_0x20f86d){_0x1ba36e=_0x1ba36e-0x0;var _0x408b99=_0x1258[_0x1ba36e];return _0x408b99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8125('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8125('0x1'));var rp=require('request-promise');var moment=require(_0x8125('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8125('0x3'));var util=require(_0x8125('0x4'));var path=require('path');var sox=require(_0x8125('0x5'));var csv=require('to-csv');var ejs=require(_0x8125('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8125('0x7'));var crypto=require(_0x8125('0x8'));var jsforce=require(_0x8125('0x9'));var deskjs=require(_0x8125('0xa'));var toCsv=require(_0x8125('0xb'));var querystring=require(_0x8125('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8125('0xd'));var as=require(_0x8125('0xe'));var hardwareService=require(_0x8125('0xf'));var logger=require(_0x8125('0x10'))(_0x8125('0x11'));var utils=require(_0x8125('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8125('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5d3d01,_0x50f425){_0x50f425=_0x50f425||0xcc;return function(_0x1ffb22){if(_0x1ffb22){return _0x5d3d01[_0x8125('0x14')](_0x50f425);}return _0x5d3d01[_0x8125('0x15')](_0x50f425)[_0x8125('0x16')]();};}function respondWithResult(_0x28d807,_0x17ebef){_0x17ebef=_0x17ebef||0xc8;return function(_0x28a7d1){if(_0x28a7d1){return _0x28d807[_0x8125('0x15')](_0x17ebef)[_0x8125('0x17')](_0x28a7d1);}};}function respondWithFilteredResult(_0x226d40,_0x138dd4){return function(_0x1cd32c){if(_0x1cd32c){var _0x555890=typeof _0x138dd4[_0x8125('0x18')]===_0x8125('0x19')&&typeof _0x138dd4['limit']==='undefined';var _0x53eb33=_0x1cd32c[_0x8125('0x1a')];var _0x1356c5=_0x555890?0x0:_0x138dd4['offset'];var _0x6596fc=_0x555890?_0x1cd32c[_0x8125('0x1a')]:_0x138dd4[_0x8125('0x18')]+_0x138dd4[_0x8125('0x1b')];var _0x2d763f;if(_0x6596fc>=_0x53eb33){_0x6596fc=_0x53eb33;_0x2d763f=0xc8;}else{_0x2d763f=0xce;}_0x226d40[_0x8125('0x15')](_0x2d763f);return _0x226d40['set'](_0x8125('0x1c'),_0x1356c5+'-'+_0x6596fc+'/'+_0x53eb33)[_0x8125('0x17')](_0x1cd32c);}return null;};}function patchUpdates(_0x58365f){return function(_0x3d01a0){try{jsonpatch[_0x8125('0x1d')](_0x3d01a0,_0x58365f,!![]);}catch(_0x4db344){return BPromise['reject'](_0x4db344);}return _0x3d01a0['save']();};}function saveUpdates(_0x153200,_0x53183d){return function(_0x25e238){if(_0x25e238){return _0x25e238[_0x8125('0x1e')](_0x153200)[_0x8125('0x1f')](function(_0x3b5da3){return _0x3b5da3;});}return null;};}function removeEntity(_0x4aa55b,_0x1e8e97){return function(_0x5eff99){if(_0x5eff99){return _0x5eff99[_0x8125('0x20')]()['then'](function(){_0x4aa55b[_0x8125('0x15')](0xcc)[_0x8125('0x16')]();});}};}function handleEntityNotFound(_0x3726f8,_0x4b3dc5){return function(_0x123987){if(!_0x123987){_0x3726f8['sendStatus'](0x194);}return _0x123987;};}function handleError(_0x4a0c7b,_0xe63824){_0xe63824=_0xe63824||0x1f4;return function(_0x5a8807){logger[_0x8125('0x21')](_0x5a8807[_0x8125('0x22')]);if(_0x5a8807['name']){delete _0x5a8807[_0x8125('0x23')];}_0x4a0c7b[_0x8125('0x15')](_0xe63824)[_0x8125('0x24')](_0x5a8807);};}exports[_0x8125('0x25')]=function(_0x40e825,_0x1f158c){var _0x13939e={},_0x57ff32={},_0x46973d={'count':0x0,'rows':[]};var _0x58a01a=_[_0x8125('0x26')](db[_0x8125('0x27')][_0x8125('0x28')],function(_0x55fdf5){return{'name':_0x55fdf5[_0x8125('0x29')],'type':_0x55fdf5[_0x8125('0x2a')][_0x8125('0x2b')]};});_0x57ff32[_0x8125('0x2c')]=_[_0x8125('0x26')](_0x58a01a,_0x8125('0x23'));_0x57ff32['query']=_['keys'](_0x40e825[_0x8125('0x2d')]);_0x57ff32[_0x8125('0x2e')]=_[_0x8125('0x2f')](_0x57ff32['model'],_0x57ff32[_0x8125('0x2d')]);_0x13939e[_0x8125('0x30')]=_[_0x8125('0x2f')](_0x57ff32[_0x8125('0x2c')],qs['fields'](_0x40e825[_0x8125('0x2d')][_0x8125('0x31')]));_0x13939e[_0x8125('0x30')]=_0x13939e[_0x8125('0x30')][_0x8125('0x32')]?_0x13939e[_0x8125('0x30')]:_0x57ff32['model'];if(!_0x40e825[_0x8125('0x2d')][_0x8125('0x33')](_0x8125('0x34'))){_0x13939e[_0x8125('0x1b')]=qs[_0x8125('0x1b')](_0x40e825['query'][_0x8125('0x1b')]);_0x13939e[_0x8125('0x18')]=qs['offset'](_0x40e825[_0x8125('0x2d')][_0x8125('0x18')]);}_0x13939e[_0x8125('0x35')]=qs['sort'](_0x40e825[_0x8125('0x2d')][_0x8125('0x36')]);_0x13939e[_0x8125('0x37')]=qs[_0x8125('0x2e')](_['pick'](_0x40e825[_0x8125('0x2d')],_0x57ff32[_0x8125('0x2e')]),_0x58a01a);if(_0x40e825['query'][_0x8125('0x38')]){_0x13939e[_0x8125('0x37')]=_[_0x8125('0x39')](_0x13939e[_0x8125('0x37')],{'$or':_[_0x8125('0x26')](_0x58a01a,function(_0x302259){if(_0x302259[_0x8125('0x2a')]!==_0x8125('0x3a')){var _0x1f4f3b={};_0x1f4f3b[_0x302259[_0x8125('0x23')]]={'$like':'%'+_0x40e825[_0x8125('0x2d')][_0x8125('0x38')]+'%'};return _0x1f4f3b;}})});}_0x13939e=_[_0x8125('0x39')]({},_0x13939e,_0x40e825[_0x8125('0x3b')]);var _0x365956={'where':_0x13939e[_0x8125('0x37')]};return db['VtigerField'][_0x8125('0x1a')](_0x365956)[_0x8125('0x1f')](function(_0x376f9b){_0x46973d[_0x8125('0x1a')]=_0x376f9b;if(_0x40e825[_0x8125('0x2d')]['includeAll']){_0x13939e['include']=[{'all':!![]}];}return db[_0x8125('0x27')][_0x8125('0x3c')](_0x13939e);})[_0x8125('0x1f')](function(_0x3ba1c9){_0x46973d[_0x8125('0x3d')]=_0x3ba1c9;return _0x46973d;})[_0x8125('0x1f')](respondWithFilteredResult(_0x1f158c,_0x13939e))['catch'](handleError(_0x1f158c,null));};exports[_0x8125('0x3e')]=function(_0x7313e3,_0x1be525){var _0x3bbb20={'raw':!![],'where':{'id':_0x7313e3[_0x8125('0x3f')]['id']}},_0x7d70b8={};_0x7d70b8[_0x8125('0x2c')]=_['keys'](db[_0x8125('0x27')]['rawAttributes']);_0x7d70b8[_0x8125('0x2d')]=_[_0x8125('0x40')](_0x7313e3['query']);_0x7d70b8[_0x8125('0x2e')]=_[_0x8125('0x2f')](_0x7d70b8[_0x8125('0x2c')],_0x7d70b8[_0x8125('0x2d')]);_0x3bbb20['attributes']=_['intersection'](_0x7d70b8[_0x8125('0x2c')],qs[_0x8125('0x31')](_0x7313e3[_0x8125('0x2d')][_0x8125('0x31')]));_0x3bbb20[_0x8125('0x30')]=_0x3bbb20[_0x8125('0x30')][_0x8125('0x32')]?_0x3bbb20['attributes']:_0x7d70b8[_0x8125('0x2c')];if(_0x7313e3[_0x8125('0x2d')][_0x8125('0x41')]){_0x3bbb20[_0x8125('0x42')]=[{'all':!![]}];}_0x3bbb20=_['merge']({},_0x3bbb20,_0x7313e3['options']);return db[_0x8125('0x27')]['find'](_0x3bbb20)[_0x8125('0x1f')](handleEntityNotFound(_0x1be525,null))[_0x8125('0x1f')](respondWithResult(_0x1be525,null))[_0x8125('0x43')](handleError(_0x1be525,null));};exports['create']=function(_0x164b16,_0x4dd2f1){return db[_0x8125('0x27')][_0x8125('0x44')](_0x164b16[_0x8125('0x45')],{})[_0x8125('0x1f')](respondWithResult(_0x4dd2f1,0xc9))[_0x8125('0x43')](handleError(_0x4dd2f1,null));};exports[_0x8125('0x1e')]=function(_0x2234b6,_0x50ef42){if(_0x2234b6[_0x8125('0x45')]['id']){delete _0x2234b6['body']['id'];}return db['VtigerField']['find']({'where':{'id':_0x2234b6['params']['id']}})[_0x8125('0x1f')](handleEntityNotFound(_0x50ef42,null))[_0x8125('0x1f')](saveUpdates(_0x2234b6[_0x8125('0x45')],null))[_0x8125('0x1f')](respondWithResult(_0x50ef42,null))[_0x8125('0x43')](handleError(_0x50ef42,null));};exports[_0x8125('0x20')]=function(_0x10a45e,_0x2954a4){return db['VtigerField']['find']({'where':{'id':_0x10a45e[_0x8125('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2954a4,null))[_0x8125('0x1f')](removeEntity(_0x2954a4,null))[_0x8125('0x43')](handleError(_0x2954a4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index a036f15..47503ed 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 _0xbf7e=['../../config/environment','./intVtigerField.attributes','exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0xd98ca3,_0x38fbd9){var _0x35960d=function(_0x52e8ee){while(--_0x52e8ee){_0xd98ca3['push'](_0xd98ca3['shift']());}};_0x35960d(++_0x38fbd9);}(_0xbf7e,0xbd));var _0xebf7=function(_0x483bb5,_0x5b3540){_0x483bb5=_0x483bb5-0x0;var _0x533945=_0xbf7e[_0x483bb5];return _0x533945;};'use strict';var _=require(_0xebf7('0x0'));var util=require(_0xebf7('0x1'));var logger=require(_0xebf7('0x2'))(_0xebf7('0x3'));var moment=require('moment');var BPromise=require(_0xebf7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xebf7('0x5'));var rimraf=require(_0xebf7('0x6'));var config=require(_0xebf7('0x7'));var attributes=require(_0xebf7('0x8'));module[_0xebf7('0x9')]=function(_0x9aeb22,_0xbcfa04){return _0x9aeb22['define'](_0xebf7('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0xebf7('0xb'),'fields':[_0xebf7('0xc'),_0xebf7('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9a63=['../../config/logger','api','moment','request-promise','path','rimraf','./intVtigerField.attributes','exports','define','int_vtiger_fields','FieldId','lodash','util'];(function(_0x1df226,_0x2b4c5c){var _0x97a064=function(_0x4ea9b1){while(--_0x4ea9b1){_0x1df226['push'](_0x1df226['shift']());}};_0x97a064(++_0x2b4c5c);}(_0x9a63,0x1ec));var _0x39a6=function(_0x1082ab,_0x133d5b){_0x1082ab=_0x1082ab-0x0;var _0x2de4cf=_0x9a63[_0x1082ab];return _0x2de4cf;};'use strict';var _=require(_0x39a6('0x0'));var util=require(_0x39a6('0x1'));var logger=require(_0x39a6('0x2'))(_0x39a6('0x3'));var moment=require(_0x39a6('0x4'));var BPromise=require('bluebird');var rp=require(_0x39a6('0x5'));var fs=require('fs');var path=require(_0x39a6('0x6'));var rimraf=require(_0x39a6('0x7'));var config=require('../../config/environment');var attributes=require(_0x39a6('0x8'));module[_0x39a6('0x9')]=function(_0x310abe,_0x35f24c){return _0x310abe[_0x39a6('0xa')]('VtigerField',attributes,{'tableName':_0x39a6('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x39a6('0xc')],'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 9a2f9ce..18218b0 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 _0x9a3f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9a3f,0x88));var _0xf9a3=function(_0x16d834,_0x36b0fc){_0x16d834=_0x16d834-0x0;var _0x3b691d=_0x9a3f[_0x16d834];return _0x3b691d;};'use strict';var _=require(_0xf9a3('0x0'));var util=require('util');var moment=require(_0xf9a3('0x1'));var BPromise=require(_0xf9a3('0x2'));var rs=require(_0xf9a3('0x3'));var fs=require('fs');var Redis=require(_0xf9a3('0x4'));var db=require(_0xf9a3('0x5'))['db'];var utils=require(_0xf9a3('0x6'));var logger=require(_0xf9a3('0x7'))(_0xf9a3('0x8'));var config=require(_0xf9a3('0x9'));var jayson=require(_0xf9a3('0xa'));var client=jayson[_0xf9a3('0xb')][_0xf9a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x62faa6,_0x59c5c4,_0x542352){return new BPromise(function(_0x3c2fc9,_0x4da49e){return client[_0xf9a3('0xd')](_0x62faa6,_0x542352)[_0xf9a3('0xe')](function(_0x38dc54){logger[_0xf9a3('0xf')](_0xf9a3('0x10'),_0x59c5c4,_0xf9a3('0x11'));logger[_0xf9a3('0x12')](_0xf9a3('0x13'),_0x59c5c4,_0xf9a3('0x11'),JSON['stringify'](_0x38dc54));if(_0x38dc54[_0xf9a3('0x14')]){if(_0x38dc54[_0xf9a3('0x14')][_0xf9a3('0x15')]===0x1f4){logger[_0xf9a3('0x14')](_0xf9a3('0x10'),_0x59c5c4,_0x38dc54['error']['message']);return _0x4da49e(_0x38dc54[_0xf9a3('0x14')][_0xf9a3('0x16')]);}logger[_0xf9a3('0x14')](_0xf9a3('0x10'),_0x59c5c4,_0x38dc54[_0xf9a3('0x14')][_0xf9a3('0x16')]);return _0x3c2fc9(_0x38dc54[_0xf9a3('0x14')][_0xf9a3('0x16')]);}else{logger[_0xf9a3('0xf')]('VtigerField,\x20%s,\x20%s',_0x59c5c4,_0xf9a3('0x11'));_0x3c2fc9(_0x38dc54[_0xf9a3('0x17')]['message']);}})['catch'](function(_0x4cebf4){logger[_0xf9a3('0x14')](_0xf9a3('0x10'),_0x59c5c4,_0x4cebf4);_0x4da49e(_0x4cebf4);});});} \ No newline at end of file +var _0xe144=['util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x433a01,_0x5e3fe2){var _0x4f1a4c=function(_0xe3d00e){while(--_0xe3d00e){_0x433a01['push'](_0x433a01['shift']());}};_0x4f1a4c(++_0x5e3fe2);}(_0xe144,0x15f));var _0x4e14=function(_0x565c4e,_0x1e77f9){_0x565c4e=_0x565c4e-0x0;var _0x4a167f=_0xe144[_0x565c4e];return _0x4a167f;};'use strict';var _=require(_0x4e14('0x0'));var util=require(_0x4e14('0x1'));var moment=require('moment');var BPromise=require(_0x4e14('0x2'));var rs=require(_0x4e14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e14('0x4'))['db'];var utils=require(_0x4e14('0x5'));var logger=require('../../config/logger')(_0x4e14('0x6'));var config=require(_0x4e14('0x7'));var jayson=require(_0x4e14('0x8'));var client=jayson[_0x4e14('0x9')][_0x4e14('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b3bca,_0x51155d,_0x24b0dc){return new BPromise(function(_0x23d842,_0x159016){return client[_0x4e14('0xb')](_0x1b3bca,_0x24b0dc)['then'](function(_0x45dbc9){logger[_0x4e14('0xc')](_0x4e14('0xd'),_0x51155d,_0x4e14('0xe'));logger[_0x4e14('0xf')](_0x4e14('0x10'),_0x51155d,_0x4e14('0xe'),JSON[_0x4e14('0x11')](_0x45dbc9));if(_0x45dbc9[_0x4e14('0x12')]){if(_0x45dbc9['error']['code']===0x1f4){logger[_0x4e14('0x12')](_0x4e14('0xd'),_0x51155d,_0x45dbc9[_0x4e14('0x12')]['message']);return _0x159016(_0x45dbc9[_0x4e14('0x12')][_0x4e14('0x13')]);}logger[_0x4e14('0x12')](_0x4e14('0xd'),_0x51155d,_0x45dbc9[_0x4e14('0x12')][_0x4e14('0x13')]);return _0x23d842(_0x45dbc9[_0x4e14('0x12')][_0x4e14('0x13')]);}else{logger['info'](_0x4e14('0xd'),_0x51155d,_0x4e14('0xe'));_0x23d842(_0x45dbc9[_0x4e14('0x14')][_0x4e14('0x13')]);}})[_0x4e14('0x15')](function(_0x2b34c3){logger[_0x4e14('0x12')](_0x4e14('0xd'),_0x51155d,_0x2b34c3);_0x159016(_0x2b34c3);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 73a91d6..bf57916 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 _0x7360=['getFields','create','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x3c9422,_0x48201f){var _0x4c51aa=function(_0xb9066a){while(--_0xb9066a){_0x3c9422['push'](_0x3c9422['shift']());}};_0x4c51aa(++_0x48201f);}(_0x7360,0x14c));var _0x0736=function(_0x2b087c,_0x47693b){_0x2b087c=_0x2b087c-0x0;var _0x13743d=_0x7360[_0x2b087c];return _0x13743d;};'use strict';var multer=require(_0x0736('0x0'));var util=require(_0x0736('0x1'));var path=require(_0x0736('0x2'));var timeout=require(_0x0736('0x3'));var express=require(_0x0736('0x4'));var router=express[_0x0736('0x5')]();var fs_extra=require(_0x0736('0x6'));var auth=require(_0x0736('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x0736('0x8'));var controller=require(_0x0736('0x9'));router[_0x0736('0xa')]('/',auth[_0x0736('0xb')](),controller[_0x0736('0xc')]);router[_0x0736('0xa')](_0x0736('0xd'),auth[_0x0736('0xb')](),controller[_0x0736('0xe')]);router[_0x0736('0xa')](_0x0736('0xf'),auth[_0x0736('0xb')](),controller[_0x0736('0x10')]);router[_0x0736('0xa')](_0x0736('0x11'),auth['isAuthenticated'](),controller[_0x0736('0x12')]);router['post']('/',auth[_0x0736('0xb')](),controller[_0x0736('0x13')]);router[_0x0736('0x14')](_0x0736('0xf'),auth[_0x0736('0xb')](),controller['addConfiguration']);router[_0x0736('0x15')](_0x0736('0xd'),auth[_0x0736('0xb')](),controller['update']);router[_0x0736('0x16')](_0x0736('0xd'),auth[_0x0736('0xb')](),controller[_0x0736('0x17')]);module[_0x0736('0x18')]=router; \ No newline at end of file +var _0x060b=['path','../../components/auth/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','exports','multer','util'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x060b,0x1b3));var _0xb060=function(_0x31f57d,_0x2babdd){_0x31f57d=_0x31f57d-0x0;var _0x483b04=_0x060b[_0x31f57d];return _0x483b04;};'use strict';var multer=require(_0xb060('0x0'));var util=require(_0xb060('0x1'));var path=require(_0xb060('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb060('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb060('0x4'));router[_0xb060('0x5')]('/',auth[_0xb060('0x6')](),controller[_0xb060('0x7')]);router[_0xb060('0x5')](_0xb060('0x8'),auth[_0xb060('0x6')](),controller[_0xb060('0x9')]);router[_0xb060('0x5')](_0xb060('0xa'),auth[_0xb060('0x6')](),controller['getConfigurations']);router['get'](_0xb060('0xb'),auth['isAuthenticated'](),controller[_0xb060('0xc')]);router[_0xb060('0xd')]('/',auth[_0xb060('0x6')](),controller['create']);router[_0xb060('0xd')](_0xb060('0xa'),auth[_0xb060('0x6')](),controller[_0xb060('0xe')]);router[_0xb060('0xf')](_0xb060('0x8'),auth[_0xb060('0x6')](),controller[_0xb060('0x10')]);router[_0xb060('0x11')](_0xb060('0x8'),auth[_0xb060('0x6')](),controller['destroy']);module[_0xb060('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index e3ed7c4..27e3fef 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 _0xaf11=['exports','STRING','username','remoteUri','ENUM','password','integrationTab','sequelize'];(function(_0x477491,_0x5ca700){var _0xac6aec=function(_0x180568){while(--_0x180568){_0x477491['push'](_0x477491['shift']());}};_0xac6aec(++_0x5ca700);}(_0xaf11,0x12f));var _0x1af1=function(_0x2e632a,_0x581c02){_0x2e632a=_0x2e632a-0x0;var _0x431953=_0xaf11[_0x2e632a];return _0x431953;};'use strict';var Sequelize=require(_0x1af1('0x0'));module[_0x1af1('0x1')]={'name':{'type':Sequelize[_0x1af1('0x2')]},'description':{'type':Sequelize[_0x1af1('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x1af1('0x3')},'password':{'type':Sequelize[_0x1af1('0x2')]},'token':{'type':Sequelize[_0x1af1('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x1af1('0x4')},'authType':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x6'),'token'),'defaultValue':_0x1af1('0x6')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1af1('0x5')](_0x1af1('0x7'),'newTab'),'defaultValue':_0x1af1('0x7')}}; \ No newline at end of file +var _0xf072=['exports','STRING','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x5f3cc0,_0x374117){var _0xa4eca6=function(_0x1cf15d){while(--_0x1cf15d){_0x5f3cc0['push'](_0x5f3cc0['shift']());}};_0xa4eca6(++_0x374117);}(_0xf072,0x1cf));var _0x2f07=function(_0x28171a,_0x5f33a4){_0x28171a=_0x28171a-0x0;var _0x2518d3=_0xf072[_0x28171a];return _0x2518d3;};'use strict';var Sequelize=require(_0x2f07('0x0'));module[_0x2f07('0x1')]={'name':{'type':Sequelize[_0x2f07('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x2f07('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x2f07('0x2')]},'token':{'type':Sequelize[_0x2f07('0x2')]},'remoteUri':{'type':Sequelize[_0x2f07('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x2f07('0x3')](_0x2f07('0x4'),_0x2f07('0x5')),'defaultValue':_0x2f07('0x4')},'serverUrl':{'type':Sequelize[_0x2f07('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2f07('0x3')](_0x2f07('0x6'),_0x2f07('0x7')),'defaultValue':_0x2f07('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index a54dabc..e6bd8cf 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 _0xac4a=['count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','ZendeskAccount','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','order','pick','AccountId','Subjects','getSubjects','channel','Descriptions','ZendeskField','getFields','password','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','Basic\x20%s','base64','headers','%s/token:%s','username','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit'];(function(_0x42ca15,_0x193ccb){var _0x1c6ded=function(_0x40989a){while(--_0x40989a){_0x42ca15['push'](_0x42ca15['shift']());}};_0x1c6ded(++_0x193ccb);}(_0xac4a,0x13f));var _0xaac4=function(_0x45a959,_0x41ded6){_0x45a959=_0x45a959-0x0;var _0x1fa354=_0xac4a[_0x45a959];return _0x1fa354;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];var integrations=require(_0xaac4('0x15'));function respondWithStatusCode(_0x45e512,_0x5a4801){_0x5a4801=_0x5a4801||0xcc;return function(_0x6a808d){if(_0x6a808d){return _0x45e512[_0xaac4('0x16')](_0x5a4801);}return _0x45e512['status'](_0x5a4801)[_0xaac4('0x17')]();};}function respondWithResult(_0x2b20d0,_0x46698d){_0x46698d=_0x46698d||0xc8;return function(_0x150fdd){if(_0x150fdd){return _0x2b20d0[_0xaac4('0x18')](_0x46698d)[_0xaac4('0x19')](_0x150fdd);}};}function respondWithFilteredResult(_0x31b7e5,_0x1df9ae){return function(_0x233278){if(_0x233278){var _0xb8466e=typeof _0x1df9ae[_0xaac4('0x1a')]===_0xaac4('0x1b')&&typeof _0x1df9ae[_0xaac4('0x1c')]==='undefined';var _0x33bc73=_0x233278['count'];var _0x220630=_0xb8466e?0x0:_0x1df9ae['offset'];var _0x3ce35a=_0xb8466e?_0x233278[_0xaac4('0x1d')]:_0x1df9ae[_0xaac4('0x1a')]+_0x1df9ae[_0xaac4('0x1c')];var _0x3cbcb1;if(_0x3ce35a>=_0x33bc73){_0x3ce35a=_0x33bc73;_0x3cbcb1=0xc8;}else{_0x3cbcb1=0xce;}_0x31b7e5[_0xaac4('0x18')](_0x3cbcb1);return _0x31b7e5[_0xaac4('0x1e')](_0xaac4('0x1f'),_0x220630+'-'+_0x3ce35a+'/'+_0x33bc73)[_0xaac4('0x19')](_0x233278);}return null;};}function patchUpdates(_0x480fb0){return function(_0x1d9c42){try{jsonpatch['apply'](_0x1d9c42,_0x480fb0,!![]);}catch(_0x3303f1){return BPromise[_0xaac4('0x20')](_0x3303f1);}return _0x1d9c42[_0xaac4('0x21')]();};}function saveUpdates(_0x477b77,_0x17140f){return function(_0x383a8c){if(_0x383a8c){return _0x383a8c['update'](_0x477b77)[_0xaac4('0x22')](function(_0x27a84d){return _0x27a84d;});}return null;};}function removeEntity(_0x174860,_0x4f10ec){return function(_0x3dd059){if(_0x3dd059){return _0x3dd059[_0xaac4('0x23')]()[_0xaac4('0x22')](function(){_0x174860['status'](0xcc)[_0xaac4('0x17')]();});}};}function handleEntityNotFound(_0x4f1b65,_0x54203b){return function(_0x4fac85){if(!_0x4fac85){_0x4f1b65['sendStatus'](0x194);}return _0x4fac85;};}function handleError(_0x22d5a6,_0x17d25f){_0x17d25f=_0x17d25f||0x1f4;return function(_0x22cda2){logger[_0xaac4('0x24')](_0x22cda2[_0xaac4('0x25')]);if(_0x22cda2[_0xaac4('0x26')]){delete _0x22cda2[_0xaac4('0x26')];}_0x22d5a6[_0xaac4('0x18')](_0x17d25f)[_0xaac4('0x27')](_0x22cda2);};}exports[_0xaac4('0x28')]=function(_0x4d0f5f,_0x316445){var _0x16b33c={},_0xda10b6={},_0xb76ccc={'count':0x0,'rows':[]};var _0x669b34=_[_0xaac4('0x29')](db['ZendeskAccount'][_0xaac4('0x2a')],function(_0x5d2c9a){return{'name':_0x5d2c9a[_0xaac4('0x2b')],'type':_0x5d2c9a[_0xaac4('0x2c')][_0xaac4('0x2d')]};});_0xda10b6[_0xaac4('0x2e')]=_['map'](_0x669b34,'name');_0xda10b6['query']=_[_0xaac4('0x2f')](_0x4d0f5f[_0xaac4('0x30')]);_0xda10b6[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],_0xda10b6[_0xaac4('0x30')]);_0x16b33c[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xda10b6[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x34')]));_0x16b33c[_0xaac4('0x33')]=_0x16b33c[_0xaac4('0x33')][_0xaac4('0x35')]?_0x16b33c['attributes']:_0xda10b6['model'];if(!_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x16b33c['limit']=qs[_0xaac4('0x1c')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1c')]);_0x16b33c[_0xaac4('0x1a')]=qs[_0xaac4('0x1a')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x1a')]);}_0x16b33c['order']=qs[_0xaac4('0x38')](_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x38')]);_0x16b33c['where']=qs[_0xaac4('0x31')](_['pick'](_0x4d0f5f['query'],_0xda10b6[_0xaac4('0x31')]),_0x669b34);if(_0x4d0f5f[_0xaac4('0x30')][_0xaac4('0x39')]){_0x16b33c['where']=_['merge'](_0x16b33c[_0xaac4('0x3a')],{'$or':_[_0xaac4('0x29')](_0x669b34,function(_0x2f7300){if(_0x2f7300[_0xaac4('0x2c')]!==_0xaac4('0x3b')){var _0x36f4d4={};_0x36f4d4[_0x2f7300['name']]={'$like':'%'+_0x4d0f5f['query'][_0xaac4('0x39')]+'%'};return _0x36f4d4;}})});}_0x16b33c=_[_0xaac4('0x3c')]({},_0x16b33c,_0x4d0f5f['options']);var _0x416a5b={'where':_0x16b33c[_0xaac4('0x3a')]};return db[_0xaac4('0x3d')]['count'](_0x416a5b)[_0xaac4('0x22')](function(_0x4a4773){_0xb76ccc[_0xaac4('0x1d')]=_0x4a4773;if(_0x4d0f5f['query'][_0xaac4('0x3e')]){_0x16b33c[_0xaac4('0x3f')]=[{'all':!![]}];}return db[_0xaac4('0x3d')][_0xaac4('0x40')](_0x16b33c);})['then'](function(_0x247fea){_0xb76ccc['rows']=_0x247fea;return _0xb76ccc;})['then'](respondWithFilteredResult(_0x316445,_0x16b33c))[_0xaac4('0x41')](handleError(_0x316445,null));};exports[_0xaac4('0x42')]=function(_0x27df36,_0x40c007){var _0x43bc12={'raw':![],'where':{'id':_0x27df36[_0xaac4('0x43')]['id']}},_0xb78221={};_0xb78221[_0xaac4('0x2e')]=_['keys'](db[_0xaac4('0x3d')][_0xaac4('0x2a')]);_0xb78221[_0xaac4('0x30')]=_[_0xaac4('0x2f')](_0x27df36['query']);_0xb78221[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],_0xb78221['query']);_0x43bc12[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0xb78221[_0xaac4('0x2e')],qs[_0xaac4('0x34')](_0x27df36['query'][_0xaac4('0x34')]));_0x43bc12[_0xaac4('0x33')]=_0x43bc12[_0xaac4('0x33')]['length']?_0x43bc12[_0xaac4('0x33')]:_0xb78221[_0xaac4('0x2e')];if(_0x27df36[_0xaac4('0x30')][_0xaac4('0x3e')]){_0x43bc12[_0xaac4('0x3f')]=[{'all':!![]}];}_0x43bc12=_[_0xaac4('0x3c')]({},_0x43bc12,_0x27df36[_0xaac4('0x44')]);return db[_0xaac4('0x3d')][_0xaac4('0x45')](_0x43bc12)['then'](handleEntityNotFound(_0x40c007,null))[_0xaac4('0x22')](respondWithResult(_0x40c007,null))[_0xaac4('0x41')](handleError(_0x40c007,null));};exports[_0xaac4('0x46')]=function(_0x360420,_0x130bb5){return db['ZendeskAccount']['create'](_0x360420[_0xaac4('0x47')],{})[_0xaac4('0x22')](respondWithResult(_0x130bb5,0xc9))[_0xaac4('0x41')](handleError(_0x130bb5,null));};exports[_0xaac4('0x48')]=function(_0x5f33ea,_0x283d51){if(_0x5f33ea['body']['id']){delete _0x5f33ea[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')]['find']({'where':{'id':_0x5f33ea[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x283d51,null))[_0xaac4('0x22')](saveUpdates(_0x5f33ea['body'],null))['then'](respondWithResult(_0x283d51,null))[_0xaac4('0x41')](handleError(_0x283d51,null));};exports[_0xaac4('0x23')]=function(_0x22dda7,_0xb32d1d){return db[_0xaac4('0x3d')][_0xaac4('0x45')]({'where':{'id':_0x22dda7['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0xb32d1d,null))[_0xaac4('0x22')](removeEntity(_0xb32d1d,null))[_0xaac4('0x41')](handleError(_0xb32d1d,null));};exports[_0xaac4('0x49')]=function(_0x56201b,_0x3ca377,_0x571418){var _0x33e32f={};var _0x3a703c={};var _0x460252;var _0x3922a0;return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x56201b[_0xaac4('0x43')]['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x3ca377,null))[_0xaac4('0x22')](function(_0x1b9219){if(_0x1b9219){_0x460252=_0x1b9219;_0x3a703c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](db[_0xaac4('0x4b')][_0xaac4('0x2a')]);_0x3a703c['query']=_[_0xaac4('0x2f')](_0x56201b[_0xaac4('0x30')]);_0x3a703c[_0xaac4('0x31')]=_[_0xaac4('0x32')](_0x3a703c[_0xaac4('0x2e')],_0x3a703c[_0xaac4('0x30')]);_0x33e32f[_0xaac4('0x33')]=_[_0xaac4('0x32')](_0x3a703c['model'],qs[_0xaac4('0x34')](_0x56201b['query'][_0xaac4('0x34')]));_0x33e32f['attributes']=_0x33e32f[_0xaac4('0x33')]['length']?_0x33e32f['attributes']:_0x3a703c[_0xaac4('0x2e')];_0x33e32f[_0xaac4('0x4c')]=qs['sort'](_0x56201b[_0xaac4('0x30')][_0xaac4('0x38')]);_0x33e32f[_0xaac4('0x3a')]=qs[_0xaac4('0x31')](_[_0xaac4('0x4d')](_0x56201b[_0xaac4('0x30')],_0x3a703c['filters']));if(_0x56201b[_0xaac4('0x30')]['filter']){_0x33e32f[_0xaac4('0x3a')]=_['merge'](_0x33e32f['where'],{'$or':_['map'](_0x33e32f[_0xaac4('0x33')],function(_0x380e9d){var _0x467a61={};_0x467a61[_0x380e9d]={'$like':'%'+_0x56201b[_0xaac4('0x30')]['filter']+'%'};return _0x467a61;})});}_0x33e32f=_[_0xaac4('0x3c')]({},_0x33e32f,_0x56201b[_0xaac4('0x44')]);return _0x460252[_0xaac4('0x49')](_0x33e32f);}})['then'](function(_0x8891d){if(_0x8891d){_0x3922a0=_0x8891d[_0xaac4('0x35')];if(!_0x56201b[_0xaac4('0x30')][_0xaac4('0x36')](_0xaac4('0x37'))){_0x33e32f[_0xaac4('0x1c')]=qs[_0xaac4('0x1c')](_0x56201b['query']['limit']);_0x33e32f[_0xaac4('0x1a')]=qs['offset'](_0x56201b['query'][_0xaac4('0x1a')]);}return _0x460252['getConfigurations'](_0x33e32f);}})[_0xaac4('0x22')](function(_0x4b6881){if(_0x4b6881){return _0x4b6881?{'count':_0x3922a0,'rows':_0x4b6881}:null;}})[_0xaac4('0x22')](respondWithResult(_0x3ca377,null))[_0xaac4('0x41')](handleError(_0x3ca377,null));};exports['addConfiguration']=function(_0x5112d3,_0x4e6de9,_0x4d0ee7){if(_0x5112d3[_0xaac4('0x47')]['id']){delete _0x5112d3[_0xaac4('0x47')]['id'];}return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5112d3['params']['id']}})[_0xaac4('0x22')](handleEntityNotFound(_0x4e6de9,null))[_0xaac4('0x22')](function(_0x3b0470){if(_0x3b0470){_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4e')]=_0x3b0470['id'];_0x5112d3[_0xaac4('0x47')][_0xaac4('0x4f')]=integrations[_0xaac4('0x50')](_0x5112d3[_0xaac4('0x47')][_0xaac4('0x51')],_0x5112d3[_0xaac4('0x47')]['type']);_0x5112d3['body'][_0xaac4('0x52')]=integrations['getDescriptions'](_0x5112d3['body'][_0xaac4('0x51')],_0x5112d3['body'][_0xaac4('0x2c')]);return db[_0xaac4('0x4b')][_0xaac4('0x46')](_0x5112d3[_0xaac4('0x47')],{'include':[{'model':db['ZendeskField'],'as':_0xaac4('0x4f')},{'model':db[_0xaac4('0x53')],'as':_0xaac4('0x52')}]});}return null;})[_0xaac4('0x22')](respondWithResult(_0x4e6de9,null))[_0xaac4('0x41')](handleError(_0x4e6de9,null));};exports[_0xaac4('0x54')]=function(_0x5b20c6,_0x1db7c7,_0x429661){var _0x5b5e57='';return db[_0xaac4('0x3d')][_0xaac4('0x4a')]({'where':{'id':_0x5b20c6['params']['id']},'attributes':['id','username',_0xaac4('0x55'),_0xaac4('0x56'),_0xaac4('0x57'),_0xaac4('0x58')]})[_0xaac4('0x22')](handleEntityNotFound(_0x1db7c7,null))[_0xaac4('0x22')](function(_0x13d691){if(_0x13d691){_0x5b5e57=_0x13d691[_0xaac4('0x58')];var _0x59085e=_0x5b5e57[_0xaac4('0x59')](-0x1);if(_0x59085e==='/'){_0x5b5e57=_0x5b5e57[_0xaac4('0x5a')](0x0,_0x5b5e57[_0xaac4('0x5b')](_0x59085e));}var _0x254fb3={'method':_0xaac4('0x5c'),'uri':util[_0xaac4('0x5d')]('%s/%s',_0x5b5e57,_0xaac4('0x5e')),'json':!![]};switch(_0x13d691[_0xaac4('0x57')]){case'password':_0x254fb3['headers']={'Authorization':util['format'](_0xaac4('0x5f'),new Buffer(util['format']('%s:%s',_0x13d691['username'],_0x13d691['password']))['toString'](_0xaac4('0x60')))};break;case _0xaac4('0x56'):_0x254fb3[_0xaac4('0x61')]={'Authorization':util[_0xaac4('0x5d')]('Basic\x20%s',new Buffer(util[_0xaac4('0x5d')](_0xaac4('0x62'),_0x13d691[_0xaac4('0x63')],_0x13d691[_0xaac4('0x56')]))[_0xaac4('0x64')](_0xaac4('0x60')))};break;default:throw new db[(_0xaac4('0x65'))]['ValidationError'](_0xaac4('0x66'));}return rp(_0x254fb3);}})['then'](function(_0x551e53){if(_0x551e53){var _0x20dff9=[_0xaac4('0x67'),_0xaac4('0x68'),_0xaac4('0x69'),_0xaac4('0x6a')];_[_0xaac4('0x6b')](_0x551e53[_0xaac4('0x5e')],function(_0x18d567){return _0x20dff9[_0xaac4('0x6c')](_0x18d567[_0xaac4('0x2c')]);});return{'count':_0x551e53[_0xaac4('0x5e')][_0xaac4('0x35')],'rows':_[_0xaac4('0x29')](_0x551e53[_0xaac4('0x5e')],function(_0xdf6b04){return{'id':_0xdf6b04['id'],'name':_0xdf6b04[_0xaac4('0x6d')]>0x7?_0xdf6b04[_0xaac4('0x6e')]:_0xdf6b04[_0xaac4('0x2c')],'custom':_0xdf6b04[_0xaac4('0x6d')]>0x7?!![]:![],'options':_0xdf6b04[_0xaac4('0x6f')]?_0xdf6b04[_0xaac4('0x6f')]:_0xdf6b04[_0xaac4('0x70')]?_0xdf6b04[_0xaac4('0x70')]:[]};})};}})[_0xaac4('0x22')](respondWithResult(_0x1db7c7,null))[_0xaac4('0x41')](function(_0x59f6dc){var _0xb12069=_0x5b20c6[_0xaac4('0x30')][_0xaac4('0x71')]?0x1f4:_0x59f6dc[_0xaac4('0x72')]||0x1f4;logger[_0xaac4('0x24')]('getFields,\x20%s,\x20%s,\x20%s',_0xaac4('0x54'),_0xb12069,JSON[_0xaac4('0x73')](_0x59f6dc));delete _0x59f6dc[_0xaac4('0x26')];if(_0xb12069===0x191){_0xb12069=0x190;}_0x1db7c7[_0xaac4('0x18')](_0xb12069)[_0xaac4('0x27')](_0x5b20c6['query'][_0xaac4('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0x59f6dc[_0xaac4('0x72')]}:_0x59f6dc);});}; \ No newline at end of file +var _0x5eb8=['sort','where','filter','merge','type','options','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','substring','lastIndexOf','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','remove','includes','title','position','system_field_options','custom_field_options','send','Wrong\x20credentials','statusCode','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','sendStatus','error','stack','name','map','ZendeskAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0x5eb8,0xb0));var _0x85eb=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0x5eb8[_0x533e4e];return _0x1f14bb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85eb('0x0'));var jsonpatch=require(_0x85eb('0x1'));var rp=require(_0x85eb('0x2'));var moment=require(_0x85eb('0x3'));var BPromise=require(_0x85eb('0x4'));var Mustache=require(_0x85eb('0x5'));var util=require(_0x85eb('0x6'));var path=require(_0x85eb('0x7'));var sox=require(_0x85eb('0x8'));var csv=require(_0x85eb('0x9'));var ejs=require(_0x85eb('0xa'));var fs=require('fs');var fs_extra=require(_0x85eb('0xb'));var _=require('lodash');var squel=require(_0x85eb('0xc'));var crypto=require(_0x85eb('0xd'));var jsforce=require(_0x85eb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x85eb('0x9'));var querystring=require('querystring');var Papa=require(_0x85eb('0xf'));var Redis=require(_0x85eb('0x10'));var authService=require(_0x85eb('0x11'));var qs=require(_0x85eb('0x12'));var as=require(_0x85eb('0x13'));var hardwareService=require(_0x85eb('0x14'));var logger=require(_0x85eb('0x15'))('api');var utils=require(_0x85eb('0x16'));var config=require(_0x85eb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x85eb('0x18'))['db'];var integrations=require(_0x85eb('0x19'));function respondWithStatusCode(_0x2f42ba,_0x259f72){_0x259f72=_0x259f72||0xcc;return function(_0x4db167){if(_0x4db167){return _0x2f42ba['sendStatus'](_0x259f72);}return _0x2f42ba[_0x85eb('0x1a')](_0x259f72)['end']();};}function respondWithResult(_0x18ca53,_0x23a82a){_0x23a82a=_0x23a82a||0xc8;return function(_0x600a7f){if(_0x600a7f){return _0x18ca53[_0x85eb('0x1a')](_0x23a82a)[_0x85eb('0x1b')](_0x600a7f);}};}function respondWithFilteredResult(_0x49efdf,_0x2e5c0a){return function(_0x59237b){if(_0x59237b){var _0x17140b=typeof _0x2e5c0a[_0x85eb('0x1c')]===_0x85eb('0x1d')&&typeof _0x2e5c0a[_0x85eb('0x1e')]==='undefined';var _0x5c5cbb=_0x59237b['count'];var _0xe198ca=_0x17140b?0x0:_0x2e5c0a[_0x85eb('0x1c')];var _0x10cf2f=_0x17140b?_0x59237b[_0x85eb('0x1f')]:_0x2e5c0a[_0x85eb('0x1c')]+_0x2e5c0a[_0x85eb('0x1e')];var _0x5acd3d;if(_0x10cf2f>=_0x5c5cbb){_0x10cf2f=_0x5c5cbb;_0x5acd3d=0xc8;}else{_0x5acd3d=0xce;}_0x49efdf[_0x85eb('0x1a')](_0x5acd3d);return _0x49efdf[_0x85eb('0x20')](_0x85eb('0x21'),_0xe198ca+'-'+_0x10cf2f+'/'+_0x5c5cbb)['json'](_0x59237b);}return null;};}function patchUpdates(_0x4b4b38){return function(_0x48bd86){try{jsonpatch['apply'](_0x48bd86,_0x4b4b38,!![]);}catch(_0x244667){return BPromise[_0x85eb('0x22')](_0x244667);}return _0x48bd86[_0x85eb('0x23')]();};}function saveUpdates(_0x255ca7,_0x465c74){return function(_0x3fc6da){if(_0x3fc6da){return _0x3fc6da['update'](_0x255ca7)['then'](function(_0x5b48d9){return _0x5b48d9;});}return null;};}function removeEntity(_0x298e84,_0x1426c8){return function(_0x3f7a4d){if(_0x3f7a4d){return _0x3f7a4d[_0x85eb('0x24')]()[_0x85eb('0x25')](function(){_0x298e84[_0x85eb('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39d3fe,_0x3453cd){return function(_0x4709ad){if(!_0x4709ad){_0x39d3fe[_0x85eb('0x26')](0x194);}return _0x4709ad;};}function handleError(_0x3e2326,_0x57a03c){_0x57a03c=_0x57a03c||0x1f4;return function(_0x2e5aa3){logger[_0x85eb('0x27')](_0x2e5aa3[_0x85eb('0x28')]);if(_0x2e5aa3[_0x85eb('0x29')]){delete _0x2e5aa3[_0x85eb('0x29')];}_0x3e2326[_0x85eb('0x1a')](_0x57a03c)['send'](_0x2e5aa3);};}exports['index']=function(_0x37515c,_0x585f2a){var _0xa9b14f={},_0x5255eb={},_0x4229e9={'count':0x0,'rows':[]};var _0x3570f7=_[_0x85eb('0x2a')](db[_0x85eb('0x2b')][_0x85eb('0x2c')],function(_0xf4ac13){return{'name':_0xf4ac13[_0x85eb('0x2d')],'type':_0xf4ac13['type'][_0x85eb('0x2e')]};});_0x5255eb[_0x85eb('0x2f')]=_['map'](_0x3570f7,_0x85eb('0x29'));_0x5255eb['query']=_['keys'](_0x37515c[_0x85eb('0x30')]);_0x5255eb[_0x85eb('0x31')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],_0x5255eb[_0x85eb('0x30')]);_0xa9b14f[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5255eb[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x37515c[_0x85eb('0x30')]['fields']));_0xa9b14f[_0x85eb('0x33')]=_0xa9b14f[_0x85eb('0x33')]['length']?_0xa9b14f['attributes']:_0x5255eb[_0x85eb('0x2f')];if(!_0x37515c[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0xa9b14f[_0x85eb('0x1e')]=qs[_0x85eb('0x1e')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1e')]);_0xa9b14f[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x37515c[_0x85eb('0x30')][_0x85eb('0x1c')]);}_0xa9b14f[_0x85eb('0x37')]=qs[_0x85eb('0x38')](_0x37515c['query'][_0x85eb('0x38')]);_0xa9b14f[_0x85eb('0x39')]=qs['filters'](_['pick'](_0x37515c[_0x85eb('0x30')],_0x5255eb[_0x85eb('0x31')]),_0x3570f7);if(_0x37515c['query'][_0x85eb('0x3a')]){_0xa9b14f['where']=_[_0x85eb('0x3b')](_0xa9b14f['where'],{'$or':_[_0x85eb('0x2a')](_0x3570f7,function(_0x5ce7e4){if(_0x5ce7e4[_0x85eb('0x3c')]!=='VIRTUAL'){var _0x38ab0f={};_0x38ab0f[_0x5ce7e4[_0x85eb('0x29')]]={'$like':'%'+_0x37515c['query'][_0x85eb('0x3a')]+'%'};return _0x38ab0f;}})});}_0xa9b14f=_['merge']({},_0xa9b14f,_0x37515c[_0x85eb('0x3d')]);var _0x331260={'where':_0xa9b14f['where']};return db[_0x85eb('0x2b')]['count'](_0x331260)['then'](function(_0x1b8a71){_0x4229e9['count']=_0x1b8a71;if(_0x37515c[_0x85eb('0x30')][_0x85eb('0x3e')]){_0xa9b14f['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0x85eb('0x3f')](_0xa9b14f);})[_0x85eb('0x25')](function(_0x48160e){_0x4229e9['rows']=_0x48160e;return _0x4229e9;})[_0x85eb('0x25')](respondWithFilteredResult(_0x585f2a,_0xa9b14f))[_0x85eb('0x40')](handleError(_0x585f2a,null));};exports[_0x85eb('0x41')]=function(_0x202681,_0x3be961){var _0x5b7411={'raw':![],'where':{'id':_0x202681[_0x85eb('0x42')]['id']}},_0x5ccf8a={};_0x5ccf8a[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x2b')][_0x85eb('0x2c')]);_0x5ccf8a[_0x85eb('0x30')]=_[_0x85eb('0x43')](_0x202681[_0x85eb('0x30')]);_0x5ccf8a['filters']=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],_0x5ccf8a['query']);_0x5b7411[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x5ccf8a[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x202681[_0x85eb('0x30')][_0x85eb('0x34')]));_0x5b7411['attributes']=_0x5b7411[_0x85eb('0x33')][_0x85eb('0x44')]?_0x5b7411[_0x85eb('0x33')]:_0x5ccf8a[_0x85eb('0x2f')];if(_0x202681[_0x85eb('0x30')][_0x85eb('0x3e')]){_0x5b7411[_0x85eb('0x45')]=[{'all':!![]}];}_0x5b7411=_[_0x85eb('0x3b')]({},_0x5b7411,_0x202681['options']);return db[_0x85eb('0x2b')][_0x85eb('0x46')](_0x5b7411)[_0x85eb('0x25')](handleEntityNotFound(_0x3be961,null))[_0x85eb('0x25')](respondWithResult(_0x3be961,null))[_0x85eb('0x40')](handleError(_0x3be961,null));};exports[_0x85eb('0x47')]=function(_0x3c387a,_0x77fdc4){return db[_0x85eb('0x2b')][_0x85eb('0x47')](_0x3c387a[_0x85eb('0x48')],{})[_0x85eb('0x25')](respondWithResult(_0x77fdc4,0xc9))['catch'](handleError(_0x77fdc4,null));};exports[_0x85eb('0x49')]=function(_0x2c951b,_0x22d9d6){if(_0x2c951b['body']['id']){delete _0x2c951b[_0x85eb('0x48')]['id'];}return db[_0x85eb('0x2b')][_0x85eb('0x46')]({'where':{'id':_0x2c951b[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x22d9d6,null))['then'](saveUpdates(_0x2c951b[_0x85eb('0x48')],null))[_0x85eb('0x25')](respondWithResult(_0x22d9d6,null))[_0x85eb('0x40')](handleError(_0x22d9d6,null));};exports['destroy']=function(_0xc5cb43,_0x4550fd){return db[_0x85eb('0x2b')]['find']({'where':{'id':_0xc5cb43['params']['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x4550fd,null))['then'](removeEntity(_0x4550fd,null))['catch'](handleError(_0x4550fd,null));};exports[_0x85eb('0x4a')]=function(_0x593723,_0x39316d,_0xfb0ac){var _0x4e3d96={};var _0x4abe5e={};var _0x27ce2a;var _0x249511;return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x593723[_0x85eb('0x42')]['id']}})['then'](handleEntityNotFound(_0x39316d,null))[_0x85eb('0x25')](function(_0x30062e){if(_0x30062e){_0x27ce2a=_0x30062e;_0x4abe5e[_0x85eb('0x2f')]=_[_0x85eb('0x43')](db[_0x85eb('0x4c')]['rawAttributes']);_0x4abe5e[_0x85eb('0x30')]=_['keys'](_0x593723[_0x85eb('0x30')]);_0x4abe5e[_0x85eb('0x31')]=_['intersection'](_0x4abe5e[_0x85eb('0x2f')],_0x4abe5e[_0x85eb('0x30')]);_0x4e3d96[_0x85eb('0x33')]=_[_0x85eb('0x32')](_0x4abe5e[_0x85eb('0x2f')],qs[_0x85eb('0x34')](_0x593723['query'][_0x85eb('0x34')]));_0x4e3d96['attributes']=_0x4e3d96[_0x85eb('0x33')][_0x85eb('0x44')]?_0x4e3d96['attributes']:_0x4abe5e[_0x85eb('0x2f')];_0x4e3d96[_0x85eb('0x37')]=qs['sort'](_0x593723[_0x85eb('0x30')]['sort']);_0x4e3d96[_0x85eb('0x39')]=qs[_0x85eb('0x31')](_[_0x85eb('0x4d')](_0x593723[_0x85eb('0x30')],_0x4abe5e[_0x85eb('0x31')]));if(_0x593723[_0x85eb('0x30')]['filter']){_0x4e3d96[_0x85eb('0x39')]=_[_0x85eb('0x3b')](_0x4e3d96[_0x85eb('0x39')],{'$or':_[_0x85eb('0x2a')](_0x4e3d96[_0x85eb('0x33')],function(_0x1529dd){var _0x2024df={};_0x2024df[_0x1529dd]={'$like':'%'+_0x593723[_0x85eb('0x30')][_0x85eb('0x3a')]+'%'};return _0x2024df;})});}_0x4e3d96=_[_0x85eb('0x3b')]({},_0x4e3d96,_0x593723[_0x85eb('0x3d')]);return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x21b873){if(_0x21b873){_0x249511=_0x21b873[_0x85eb('0x44')];if(!_0x593723[_0x85eb('0x30')][_0x85eb('0x35')](_0x85eb('0x36'))){_0x4e3d96['limit']=qs[_0x85eb('0x1e')](_0x593723['query'][_0x85eb('0x1e')]);_0x4e3d96[_0x85eb('0x1c')]=qs[_0x85eb('0x1c')](_0x593723[_0x85eb('0x30')][_0x85eb('0x1c')]);}return _0x27ce2a['getConfigurations'](_0x4e3d96);}})[_0x85eb('0x25')](function(_0x143d65){if(_0x143d65){return _0x143d65?{'count':_0x249511,'rows':_0x143d65}:null;}})[_0x85eb('0x25')](respondWithResult(_0x39316d,null))[_0x85eb('0x40')](handleError(_0x39316d,null));};exports[_0x85eb('0x4e')]=function(_0x14cab8,_0x23fcf9,_0x5de716){if(_0x14cab8['body']['id']){delete _0x14cab8[_0x85eb('0x48')]['id'];}return db['ZendeskAccount'][_0x85eb('0x4b')]({'where':{'id':_0x14cab8[_0x85eb('0x42')]['id']}})[_0x85eb('0x25')](handleEntityNotFound(_0x23fcf9,null))[_0x85eb('0x25')](function(_0x259ee3){if(_0x259ee3){_0x14cab8['body'][_0x85eb('0x4f')]=_0x259ee3['id'];_0x14cab8[_0x85eb('0x48')][_0x85eb('0x50')]=integrations[_0x85eb('0x51')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8['body']['type']);_0x14cab8[_0x85eb('0x48')]['Descriptions']=integrations[_0x85eb('0x53')](_0x14cab8[_0x85eb('0x48')][_0x85eb('0x52')],_0x14cab8[_0x85eb('0x48')][_0x85eb('0x3c')]);return db[_0x85eb('0x4c')]['create'](_0x14cab8[_0x85eb('0x48')],{'include':[{'model':db[_0x85eb('0x54')],'as':_0x85eb('0x50')},{'model':db[_0x85eb('0x54')],'as':'Descriptions'}]});}return null;})[_0x85eb('0x25')](respondWithResult(_0x23fcf9,null))[_0x85eb('0x40')](handleError(_0x23fcf9,null));};exports[_0x85eb('0x55')]=function(_0x14bf0e,_0x5037c7,_0x459317){var _0x2e6734='';return db[_0x85eb('0x2b')][_0x85eb('0x4b')]({'where':{'id':_0x14bf0e[_0x85eb('0x42')]['id']},'attributes':['id',_0x85eb('0x56'),_0x85eb('0x57'),_0x85eb('0x58'),_0x85eb('0x59'),_0x85eb('0x5a')]})[_0x85eb('0x25')](handleEntityNotFound(_0x5037c7,null))[_0x85eb('0x25')](function(_0x1d9d3a){if(_0x1d9d3a){_0x2e6734=_0x1d9d3a[_0x85eb('0x5a')];var _0x2f2464=_0x2e6734[_0x85eb('0x5b')](-0x1);if(_0x2f2464==='/'){_0x2e6734=_0x2e6734[_0x85eb('0x5c')](0x0,_0x2e6734[_0x85eb('0x5d')](_0x2f2464));}var _0x106caa={'method':'GET','uri':util[_0x85eb('0x5e')]('%s/%s',_0x2e6734,_0x85eb('0x5f')),'json':!![]};switch(_0x1d9d3a[_0x85eb('0x59')]){case _0x85eb('0x57'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')](_0x85eb('0x61'),new Buffer(util[_0x85eb('0x5e')](_0x85eb('0x62'),_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a['password']))[_0x85eb('0x63')](_0x85eb('0x64')))};break;case _0x85eb('0x58'):_0x106caa[_0x85eb('0x60')]={'Authorization':util[_0x85eb('0x5e')]('Basic\x20%s',new Buffer(util[_0x85eb('0x5e')]('%s/token:%s',_0x1d9d3a[_0x85eb('0x56')],_0x1d9d3a[_0x85eb('0x58')]))[_0x85eb('0x63')]('base64'))};break;default:throw new db[(_0x85eb('0x65'))][(_0x85eb('0x66'))](_0x85eb('0x67'));}return rp(_0x106caa);}})['then'](function(_0x588c72){if(_0x588c72){var _0x45a1ef=[_0x85eb('0x68'),_0x85eb('0x69'),_0x85eb('0x6a'),'assignee'];_[_0x85eb('0x6b')](_0x588c72['ticket_fields'],function(_0x11a3bd){return _0x45a1ef[_0x85eb('0x6c')](_0x11a3bd[_0x85eb('0x3c')]);});return{'count':_0x588c72[_0x85eb('0x5f')][_0x85eb('0x44')],'rows':_[_0x85eb('0x2a')](_0x588c72['ticket_fields'],function(_0x9a80a1){return{'id':_0x9a80a1['id'],'name':_0x9a80a1['position']>0x7?_0x9a80a1[_0x85eb('0x6d')]:_0x9a80a1[_0x85eb('0x3c')],'custom':_0x9a80a1[_0x85eb('0x6e')]>0x7?!![]:![],'options':_0x9a80a1[_0x85eb('0x6f')]?_0x9a80a1[_0x85eb('0x6f')]:_0x9a80a1[_0x85eb('0x70')]?_0x9a80a1[_0x85eb('0x70')]:[]};})};}})[_0x85eb('0x25')](respondWithResult(_0x5037c7,null))[_0x85eb('0x40')](function(_0x543146){var _0x3358c8=_0x14bf0e[_0x85eb('0x30')]['test']?0x1f4:_0x543146['statusCode']||0x1f4;logger[_0x85eb('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x85eb('0x55'),_0x3358c8,JSON['stringify'](_0x543146));delete _0x543146[_0x85eb('0x29')];if(_0x3358c8===0x191){_0x3358c8=0x190;}_0x5037c7['status'](_0x3358c8)[_0x85eb('0x71')](_0x14bf0e[_0x85eb('0x30')]['test']?{'message':_0x85eb('0x72'),'statusCode':_0x543146[_0x85eb('0x73')]}:_0x543146);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index e700e14..db0f99e 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 _0x4e01=['lodash','api','moment','bluebird','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5f2075,_0x54cb5b){var _0xc612fb=function(_0x6ac44f){while(--_0x6ac44f){_0x5f2075['push'](_0x5f2075['shift']());}};_0xc612fb(++_0x54cb5b);}(_0x4e01,0x122));var _0x14e0=function(_0x191297,_0x46c85f){_0x191297=_0x191297-0x0;var _0x5cbe42=_0x4e01[_0x191297];return _0x5cbe42;};'use strict';var _=require(_0x14e0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x14e0('0x1'));var moment=require(_0x14e0('0x2'));var BPromise=require(_0x14e0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x14e0('0x4'));var config=require(_0x14e0('0x5'));var attributes=require(_0x14e0('0x6'));var integrations=require(_0x14e0('0x7'));module[_0x14e0('0x8')]=function(_0x31e2f9,_0x433d8c){return _0x31e2f9[_0x14e0('0x9')]('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8087=['../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4bcfa6,_0x1c7e43){var _0x1c0165=function(_0x30c963){while(--_0x30c963){_0x4bcfa6['push'](_0x4bcfa6['shift']());}};_0x1c0165(++_0x1c7e43);}(_0x8087,0x159));var _0x7808=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8087[_0x1992f1];return _0x413dfe;};'use strict';var _=require(_0x7808('0x0'));var util=require(_0x7808('0x1'));var logger=require(_0x7808('0x2'))(_0x7808('0x3'));var moment=require(_0x7808('0x4'));var BPromise=require(_0x7808('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7808('0x6'));var attributes=require(_0x7808('0x7'));var integrations=require(_0x7808('0x8'));module[_0x7808('0x9')]=function(_0x5adc89,_0x378400){return _0x5adc89[_0x7808('0xa')](_0x7808('0xb'),attributes,{'tableName':_0x7808('0xc'),'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 ac060a2..97e8f5c 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 _0xcda9=['stringify','error','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowZendeskAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0xa3e1ad,_0x2a49f6){var _0x45f2ca=function(_0x388914){while(--_0x388914){_0xa3e1ad['push'](_0xa3e1ad['shift']());}};_0x45f2ca(++_0x2a49f6);}(_0xcda9,0xb2));var _0x9cda=function(_0x543d49,_0xc31591){_0x543d49=_0x543d49-0x0;var _0x177b78=_0xcda9[_0x543d49];return _0x177b78;};'use strict';var _=require('lodash');var util=require(_0x9cda('0x0'));var moment=require('moment');var BPromise=require(_0x9cda('0x1'));var rs=require(_0x9cda('0x2'));var fs=require('fs');var Redis=require(_0x9cda('0x3'));var db=require(_0x9cda('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x9cda('0x5'));var jayson=require(_0x9cda('0x6'));var client=jayson[_0x9cda('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed842,_0x39d5df,_0x49be89){return new BPromise(function(_0x494045,_0x36345c){return client[_0x9cda('0x8')](_0x4ed842,_0x49be89)['then'](function(_0x58105d){logger[_0x9cda('0x9')](_0x9cda('0xa'),_0x39d5df,'request\x20sent');logger[_0x9cda('0xb')](_0x9cda('0xc'),_0x39d5df,_0x9cda('0xd'),JSON[_0x9cda('0xe')](_0x58105d));if(_0x58105d['error']){if(_0x58105d[_0x9cda('0xf')]['code']===0x1f4){logger[_0x9cda('0xf')](_0x9cda('0xa'),_0x39d5df,_0x58105d[_0x9cda('0xf')][_0x9cda('0x10')]);return _0x36345c(_0x58105d['error'][_0x9cda('0x10')]);}logger['error'](_0x9cda('0xa'),_0x39d5df,_0x58105d['error']['message']);return _0x494045(_0x58105d[_0x9cda('0xf')][_0x9cda('0x10')]);}else{logger[_0x9cda('0x9')]('ZendeskAccount,\x20%s,\x20%s',_0x39d5df,'request\x20sent');_0x494045(_0x58105d['result'][_0x9cda('0x10')]);}})[_0x9cda('0x11')](function(_0x58b05c){logger[_0x9cda('0xf')](_0x9cda('0xa'),_0x39d5df,_0x58b05c);_0x36345c(_0x58b05c);});});}exports[_0x9cda('0x12')]=function(_0x163fda){var _0x47fd3d=this;return new Promise(function(_0x5b36f3,_0x32ce6c){return db[_0x9cda('0x13')][_0x9cda('0x14')]({'raw':_0x163fda['options']?_0x163fda[_0x9cda('0x15')][_0x9cda('0x16')]===undefined?!![]:![]:!![],'where':_0x163fda[_0x9cda('0x15')]?_0x163fda[_0x9cda('0x15')][_0x9cda('0x17')]||null:null,'attributes':_0x163fda[_0x9cda('0x15')]?_0x163fda[_0x9cda('0x15')][_0x9cda('0x18')]||null:null,'limit':_0x163fda[_0x9cda('0x15')]?_0x163fda['options'][_0x9cda('0x19')]||null:null,'include':_0x163fda[_0x9cda('0x15')]?_0x163fda[_0x9cda('0x15')][_0x9cda('0x1a')]?_[_0x9cda('0x1b')](_0x163fda['options'][_0x9cda('0x1a')],function(_0x1a263b){return{'model':db[_0x1a263b[_0x9cda('0x1c')]],'as':_0x1a263b['as'],'attributes':_0x1a263b[_0x9cda('0x18')],'include':_0x1a263b['include']?_[_0x9cda('0x1b')](_0x1a263b[_0x9cda('0x1a')],function(_0x45557c){return{'model':db[_0x45557c['model']],'as':_0x45557c['as'],'attributes':_0x45557c[_0x9cda('0x18')],'include':_0x45557c[_0x9cda('0x1a')]?_[_0x9cda('0x1b')](_0x45557c[_0x9cda('0x1a')],function(_0x462d6e){return{'model':db[_0x462d6e[_0x9cda('0x1c')]],'as':_0x462d6e['as'],'attributes':_0x462d6e[_0x9cda('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9cda('0x1d')](function(_0x34160e){logger[_0x9cda('0x9')](_0x9cda('0x12'),_0x163fda);logger[_0x9cda('0xb')]('GetZendeskAccount',_0x163fda,JSON[_0x9cda('0xe')](_0x34160e));_0x5b36f3(_0x34160e);})[_0x9cda('0x11')](function(_0x526b58){logger['error'](_0x9cda('0x12'),_0x526b58[_0x9cda('0x10')],_0x163fda);_0x32ce6c(_0x47fd3d[_0x9cda('0xf')](0x1f4,_0x526b58[_0x9cda('0x10')]));});});};exports['ShowZendeskAccount']=function(_0x281746){var _0x58edd5=this;return new Promise(function(_0x15dccb,_0xbaf349){return db[_0x9cda('0x13')][_0x9cda('0x1e')]({'raw':_0x281746['options']?_0x281746[_0x9cda('0x15')][_0x9cda('0x16')]===undefined?!![]:![]:!![],'where':_0x281746['options']?_0x281746[_0x9cda('0x15')][_0x9cda('0x17')]||null:null,'attributes':_0x281746['options']?_0x281746[_0x9cda('0x15')][_0x9cda('0x18')]||null:null,'include':_0x281746['options']?_0x281746[_0x9cda('0x15')][_0x9cda('0x1a')]?_[_0x9cda('0x1b')](_0x281746[_0x9cda('0x15')]['include'],function(_0x2ec5ba){return{'model':db[_0x2ec5ba[_0x9cda('0x1c')]],'as':_0x2ec5ba['as'],'attributes':_0x2ec5ba[_0x9cda('0x18')],'include':_0x2ec5ba[_0x9cda('0x1a')]?_[_0x9cda('0x1b')](_0x2ec5ba[_0x9cda('0x1a')],function(_0x232200){return{'model':db[_0x232200[_0x9cda('0x1c')]],'as':_0x232200['as'],'attributes':_0x232200['attributes'],'include':_0x232200[_0x9cda('0x1a')]?_['map'](_0x232200[_0x9cda('0x1a')],function(_0x1f10f1){return{'model':db[_0x1f10f1['model']],'as':_0x1f10f1['as'],'attributes':_0x1f10f1[_0x9cda('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x10407f){logger[_0x9cda('0x9')](_0x9cda('0x1f'),_0x281746);logger['debug']('ShowZendeskAccount',_0x281746,JSON[_0x9cda('0xe')](_0x10407f));_0x15dccb(_0x10407f);})[_0x9cda('0x11')](function(_0x28d80d){logger[_0x9cda('0xf')](_0x9cda('0x1f'),_0x28d80d['message'],_0x281746);_0xbaf349(_0x58edd5[_0x9cda('0xf')](0x1f4,_0x28d80d['message']));});});}; \ No newline at end of file +var _0xe899=['find','raw','debug','ShowZendeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','catch'];(function(_0x381fc4,_0x3a4c58){var _0x5cc9d7=function(_0x260100){while(--_0x260100){_0x381fc4['push'](_0x381fc4['shift']());}};_0x5cc9d7(++_0x3a4c58);}(_0xe899,0x1cc));var _0x9e89=function(_0x489c95,_0x53159c){_0x489c95=_0x489c95-0x0;var _0x10e7a7=_0xe899[_0x489c95];return _0x10e7a7;};'use strict';var _=require(_0x9e89('0x0'));var util=require(_0x9e89('0x1'));var moment=require(_0x9e89('0x2'));var BPromise=require(_0x9e89('0x3'));var rs=require(_0x9e89('0x4'));var fs=require('fs');var Redis=require(_0x9e89('0x5'));var db=require(_0x9e89('0x6'))['db'];var utils=require(_0x9e89('0x7'));var logger=require('../../config/logger')(_0x9e89('0x8'));var config=require(_0x9e89('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9e89('0xa')][_0x9e89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5854b0,_0x5326f1,_0x38f924){return new BPromise(function(_0x927037,_0x15acff){return client[_0x9e89('0xc')](_0x5854b0,_0x38f924)['then'](function(_0xc1327){logger[_0x9e89('0xd')](_0x9e89('0xe'),_0x5326f1,_0x9e89('0xf'));logger['debug'](_0x9e89('0x10'),_0x5326f1,_0x9e89('0xf'),JSON['stringify'](_0xc1327));if(_0xc1327[_0x9e89('0x11')]){if(_0xc1327[_0x9e89('0x11')][_0x9e89('0x12')]===0x1f4){logger[_0x9e89('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x5326f1,_0xc1327[_0x9e89('0x11')][_0x9e89('0x13')]);return _0x15acff(_0xc1327[_0x9e89('0x11')][_0x9e89('0x13')]);}logger['error'](_0x9e89('0xe'),_0x5326f1,_0xc1327['error'][_0x9e89('0x13')]);return _0x927037(_0xc1327[_0x9e89('0x11')][_0x9e89('0x13')]);}else{logger[_0x9e89('0xd')](_0x9e89('0xe'),_0x5326f1,_0x9e89('0xf'));_0x927037(_0xc1327[_0x9e89('0x14')]['message']);}})['catch'](function(_0x3ad226){logger[_0x9e89('0x11')](_0x9e89('0xe'),_0x5326f1,_0x3ad226);_0x15acff(_0x3ad226);});});}exports[_0x9e89('0x15')]=function(_0x59acdc){var _0x285207=this;return new Promise(function(_0x4ca5ce,_0x214d50){return db[_0x9e89('0x16')][_0x9e89('0x17')]({'raw':_0x59acdc[_0x9e89('0x18')]?_0x59acdc[_0x9e89('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x59acdc['options']?_0x59acdc[_0x9e89('0x18')][_0x9e89('0x19')]||null:null,'attributes':_0x59acdc[_0x9e89('0x18')]?_0x59acdc[_0x9e89('0x18')][_0x9e89('0x1a')]||null:null,'limit':_0x59acdc[_0x9e89('0x18')]?_0x59acdc['options'][_0x9e89('0x1b')]||null:null,'include':_0x59acdc[_0x9e89('0x18')]?_0x59acdc[_0x9e89('0x18')][_0x9e89('0x1c')]?_[_0x9e89('0x1d')](_0x59acdc[_0x9e89('0x18')]['include'],function(_0x235fec){return{'model':db[_0x235fec[_0x9e89('0x1e')]],'as':_0x235fec['as'],'attributes':_0x235fec[_0x9e89('0x1a')],'include':_0x235fec[_0x9e89('0x1c')]?_[_0x9e89('0x1d')](_0x235fec[_0x9e89('0x1c')],function(_0x1ef8c2){return{'model':db[_0x1ef8c2['model']],'as':_0x1ef8c2['as'],'attributes':_0x1ef8c2['attributes'],'include':_0x1ef8c2[_0x9e89('0x1c')]?_[_0x9e89('0x1d')](_0x1ef8c2[_0x9e89('0x1c')],function(_0x57ac0f){return{'model':db[_0x57ac0f[_0x9e89('0x1e')]],'as':_0x57ac0f['as'],'attributes':_0x57ac0f[_0x9e89('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9e89('0x1f')](function(_0x215d3a){logger[_0x9e89('0xd')](_0x9e89('0x15'),_0x59acdc);logger['debug'](_0x9e89('0x15'),_0x59acdc,JSON[_0x9e89('0x20')](_0x215d3a));_0x4ca5ce(_0x215d3a);})[_0x9e89('0x21')](function(_0x533a86){logger[_0x9e89('0x11')](_0x9e89('0x15'),_0x533a86[_0x9e89('0x13')],_0x59acdc);_0x214d50(_0x285207['error'](0x1f4,_0x533a86[_0x9e89('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x33513b){var _0x2556cf=this;return new Promise(function(_0xafcdf8,_0x1ce46c){return db[_0x9e89('0x16')][_0x9e89('0x22')]({'raw':_0x33513b[_0x9e89('0x18')]?_0x33513b[_0x9e89('0x18')][_0x9e89('0x23')]===undefined?!![]:![]:!![],'where':_0x33513b['options']?_0x33513b[_0x9e89('0x18')][_0x9e89('0x19')]||null:null,'attributes':_0x33513b['options']?_0x33513b[_0x9e89('0x18')][_0x9e89('0x1a')]||null:null,'include':_0x33513b[_0x9e89('0x18')]?_0x33513b[_0x9e89('0x18')]['include']?_[_0x9e89('0x1d')](_0x33513b['options'][_0x9e89('0x1c')],function(_0x52004f){return{'model':db[_0x52004f[_0x9e89('0x1e')]],'as':_0x52004f['as'],'attributes':_0x52004f['attributes'],'include':_0x52004f['include']?_[_0x9e89('0x1d')](_0x52004f[_0x9e89('0x1c')],function(_0x953fe5){return{'model':db[_0x953fe5[_0x9e89('0x1e')]],'as':_0x953fe5['as'],'attributes':_0x953fe5['attributes'],'include':_0x953fe5[_0x9e89('0x1c')]?_[_0x9e89('0x1d')](_0x953fe5[_0x9e89('0x1c')],function(_0x16017b){return{'model':db[_0x16017b[_0x9e89('0x1e')]],'as':_0x16017b['as'],'attributes':_0x16017b[_0x9e89('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x9e89('0x1f')](function(_0xa3deb0){logger['info']('ShowZendeskAccount',_0x33513b);logger[_0x9e89('0x24')](_0x9e89('0x25'),_0x33513b,JSON[_0x9e89('0x20')](_0xa3deb0));_0xafcdf8(_0xa3deb0);})[_0x9e89('0x21')](function(_0x1c6f9d){logger[_0x9e89('0x11')](_0x9e89('0x25'),_0x1c6f9d[_0x9e89('0x13')],_0x33513b);_0x1ce46c(_0x2556cf['error'](0x1f4,_0x1c6f9d[_0x9e89('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 2a66086..beffe8d 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 _0x4483=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x4483,0x1a3));var _0x3448=function(_0x20c00b,_0x219097){_0x20c00b=_0x20c00b-0x0;var _0x4d1a0c=_0x4483[_0x20c00b];return _0x4d1a0c;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id/fields',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0x9')](_0x3448('0xf'),auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x9')](_0x3448('0x11'),auth[_0x3448('0xa')](),controller[_0x3448('0x12')]);router[_0x3448('0x9')]('/:id/tags',auth['isAuthenticated'](),controller[_0x3448('0x13')]);router[_0x3448('0x14')]('/',auth['isAuthenticated'](),controller[_0x3448('0x15')]);router[_0x3448('0x14')](_0x3448('0x16'),auth['isAuthenticated'](),controller[_0x3448('0x17')]);router[_0x3448('0x18')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x19')]);router[_0x3448('0x1a')]('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0x1b')]);module[_0x3448('0x1c')]=router; \ No newline at end of file +var _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x2ce450,_0x5f471c){var _0x3a8f3b=function(_0x1c4288){while(--_0x1c4288){_0x2ce450['push'](_0x2ce450['shift']());}};_0x3a8f3b(++_0x5f471c);}(_0x087b,0x11a));var _0xb087=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x087b[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 84e016e..e2da630 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 _0xbcc1=['sequelize','exports','STRING'];(function(_0x27e6f2,_0x413871){var _0x2ac6ed=function(_0x237f79){while(--_0x237f79){_0x27e6f2['push'](_0x27e6f2['shift']());}};_0x2ac6ed(++_0x413871);}(_0xbcc1,0x123));var _0x1bcc=function(_0x32eb1b,_0x270aa0){_0x32eb1b=_0x32eb1b-0x0;var _0x416d44=_0xbcc1[_0x32eb1b];return _0x416d44;};'use strict';var Sequelize=require(_0x1bcc('0x0'));module[_0x1bcc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1bcc('0x2')]}}; \ No newline at end of file +var _0xec40=['STRING','sequelize'];(function(_0x2d12e2,_0x19a56d){var _0x297ef9=function(_0x329c13){while(--_0x329c13){_0x2d12e2['push'](_0x2d12e2['shift']());}};_0x297ef9(++_0x19a56d);}(_0xec40,0x121));var _0x0ec4=function(_0x13f3af,_0x2ac326){_0x13f3af=_0x13f3af-0x0;var _0xda3c9f=_0xec40[_0x13f3af];return _0xda3c9f;};'use strict';var Sequelize=require(_0x0ec4('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ec4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index e99dcbd..acee530 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 _0xe6cc=['sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','map','ZendeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','ZendeskField','getFields','getSubjects','findOne','order','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','moment','bluebird','mustache','util','path'];(function(_0x10a301,_0x2f55ab){var _0x5689a5=function(_0x548e11){while(--_0x548e11){_0x10a301['push'](_0x10a301['shift']());}};_0x5689a5(++_0x2f55ab);}(_0xe6cc,0xf2));var _0xce6c=function(_0x2cde17,_0x4d4a1b){_0x2cde17=_0x2cde17-0x0;var _0x8bf043=_0xe6cc[_0x2cde17];return _0x8bf043;};'use strict';var emlformat=require(_0xce6c('0x0'));var rimraf=require(_0xce6c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xce6c('0x2'));var BPromise=require(_0xce6c('0x3'));var Mustache=require(_0xce6c('0x4'));var util=require(_0xce6c('0x5'));var path=require(_0xce6c('0x6'));var sox=require(_0xce6c('0x7'));var csv=require(_0xce6c('0x8'));var ejs=require(_0xce6c('0x9'));var fs=require('fs');var fs_extra=require(_0xce6c('0xa'));var _=require(_0xce6c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xce6c('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xce6c('0xd'));var Papa=require('papaparse');var Redis=require(_0xce6c('0xe'));var authService=require(_0xce6c('0xf'));var qs=require(_0xce6c('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce6c('0x11'));var logger=require(_0xce6c('0x12'))(_0xce6c('0x13'));var utils=require(_0xce6c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xce6c('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e2583,_0x2e15ec){_0x2e15ec=_0x2e15ec||0xcc;return function(_0x4a60b8){if(_0x4a60b8){return _0x2e2583[_0xce6c('0x16')](_0x2e15ec);}return _0x2e2583[_0xce6c('0x17')](_0x2e15ec)[_0xce6c('0x18')]();};}function respondWithResult(_0x531d6d,_0x55d782){_0x55d782=_0x55d782||0xc8;return function(_0x86b6a8){if(_0x86b6a8){return _0x531d6d['status'](_0x55d782)[_0xce6c('0x19')](_0x86b6a8);}};}function respondWithFilteredResult(_0x5623ff,_0x1681a0){return function(_0x50e6e0){if(_0x50e6e0){var _0x25d5c7=typeof _0x1681a0[_0xce6c('0x1a')]===_0xce6c('0x1b')&&typeof _0x1681a0['limit']===_0xce6c('0x1b');var _0x11414e=_0x50e6e0[_0xce6c('0x1c')];var _0x219186=_0x25d5c7?0x0:_0x1681a0['offset'];var _0x375611=_0x25d5c7?_0x50e6e0[_0xce6c('0x1c')]:_0x1681a0[_0xce6c('0x1a')]+_0x1681a0['limit'];var _0x4c760c;if(_0x375611>=_0x11414e){_0x375611=_0x11414e;_0x4c760c=0xc8;}else{_0x4c760c=0xce;}_0x5623ff['status'](_0x4c760c);return _0x5623ff[_0xce6c('0x1d')](_0xce6c('0x1e'),_0x219186+'-'+_0x375611+'/'+_0x11414e)[_0xce6c('0x19')](_0x50e6e0);}return null;};}function patchUpdates(_0x22ba0a){return function(_0x25dbda){try{jsonpatch[_0xce6c('0x1f')](_0x25dbda,_0x22ba0a,!![]);}catch(_0xde46ce){return BPromise[_0xce6c('0x20')](_0xde46ce);}return _0x25dbda[_0xce6c('0x21')]();};}function saveUpdates(_0x43ed90,_0x3f13cb){return function(_0x427cef){if(_0x427cef){return _0x427cef['update'](_0x43ed90)[_0xce6c('0x22')](function(_0x4be74a){return _0x4be74a;});}return null;};}function removeEntity(_0x52efab,_0x1d370e){return function(_0x250a77){if(_0x250a77){return _0x250a77[_0xce6c('0x23')]()[_0xce6c('0x22')](function(){_0x52efab[_0xce6c('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24d1de,_0x17f19c){return function(_0x5f3403){if(!_0x5f3403){_0x24d1de[_0xce6c('0x16')](0x194);}return _0x5f3403;};}function handleError(_0xbdd79f,_0x39c071){_0x39c071=_0x39c071||0x1f4;return function(_0x5e6d8f){logger[_0xce6c('0x24')](_0x5e6d8f[_0xce6c('0x25')]);if(_0x5e6d8f['name']){delete _0x5e6d8f[_0xce6c('0x26')];}_0xbdd79f['status'](_0x39c071)['send'](_0x5e6d8f);};}exports['index']=function(_0x412759,_0x223106){var _0x174cc5={},_0x47ce78={},_0x1d2b1e={'count':0x0,'rows':[]};var _0x1e3172=_[_0xce6c('0x27')](db[_0xce6c('0x28')][_0xce6c('0x29')],function(_0x4ae27c){return{'name':_0x4ae27c[_0xce6c('0x2a')],'type':_0x4ae27c['type'][_0xce6c('0x2b')]};});_0x47ce78[_0xce6c('0x2c')]=_[_0xce6c('0x27')](_0x1e3172,_0xce6c('0x26'));_0x47ce78[_0xce6c('0x2d')]=_[_0xce6c('0x2e')](_0x412759['query']);_0x47ce78[_0xce6c('0x2f')]=_[_0xce6c('0x30')](_0x47ce78[_0xce6c('0x2c')],_0x47ce78[_0xce6c('0x2d')]);_0x174cc5[_0xce6c('0x31')]=_['intersection'](_0x47ce78[_0xce6c('0x2c')],qs[_0xce6c('0x32')](_0x412759[_0xce6c('0x2d')][_0xce6c('0x32')]));_0x174cc5[_0xce6c('0x31')]=_0x174cc5[_0xce6c('0x31')][_0xce6c('0x33')]?_0x174cc5['attributes']:_0x47ce78[_0xce6c('0x2c')];if(!_0x412759[_0xce6c('0x2d')][_0xce6c('0x34')]('nolimit')){_0x174cc5[_0xce6c('0x35')]=qs[_0xce6c('0x35')](_0x412759['query']['limit']);_0x174cc5[_0xce6c('0x1a')]=qs[_0xce6c('0x1a')](_0x412759[_0xce6c('0x2d')]['offset']);}_0x174cc5['order']=qs[_0xce6c('0x36')](_0x412759[_0xce6c('0x2d')]['sort']);_0x174cc5[_0xce6c('0x37')]=qs[_0xce6c('0x2f')](_[_0xce6c('0x38')](_0x412759[_0xce6c('0x2d')],_0x47ce78['filters']),_0x1e3172);if(_0x412759[_0xce6c('0x2d')]['filter']){_0x174cc5[_0xce6c('0x37')]=_[_0xce6c('0x39')](_0x174cc5[_0xce6c('0x37')],{'$or':_['map'](_0x1e3172,function(_0x504fe4){if(_0x504fe4[_0xce6c('0x3a')]!==_0xce6c('0x3b')){var _0x128dec={};_0x128dec[_0x504fe4[_0xce6c('0x26')]]={'$like':'%'+_0x412759['query'][_0xce6c('0x3c')]+'%'};return _0x128dec;}})});}_0x174cc5=_['merge']({},_0x174cc5,_0x412759[_0xce6c('0x3d')]);var _0x4f1f98={'where':_0x174cc5[_0xce6c('0x37')]};return db['ZendeskConfiguration'][_0xce6c('0x1c')](_0x4f1f98)[_0xce6c('0x22')](function(_0x235819){_0x1d2b1e[_0xce6c('0x1c')]=_0x235819;if(_0x412759[_0xce6c('0x2d')][_0xce6c('0x3e')]){_0x174cc5[_0xce6c('0x3f')]=[{'all':!![]}];}return db[_0xce6c('0x28')][_0xce6c('0x40')](_0x174cc5);})[_0xce6c('0x22')](function(_0x2ed03e){_0x1d2b1e[_0xce6c('0x41')]=_0x2ed03e;return _0x1d2b1e;})[_0xce6c('0x22')](respondWithFilteredResult(_0x223106,_0x174cc5))[_0xce6c('0x42')](handleError(_0x223106,null));};exports[_0xce6c('0x43')]=function(_0x1d36d4,_0x2fc1f5){var _0x150b74={'raw':![],'where':{'id':_0x1d36d4[_0xce6c('0x44')]['id']}},_0x37accd={};_0x37accd[_0xce6c('0x2c')]=_[_0xce6c('0x2e')](db[_0xce6c('0x28')]['rawAttributes']);_0x37accd['query']=_[_0xce6c('0x2e')](_0x1d36d4[_0xce6c('0x2d')]);_0x37accd['filters']=_['intersection'](_0x37accd[_0xce6c('0x2c')],_0x37accd['query']);_0x150b74[_0xce6c('0x31')]=_[_0xce6c('0x30')](_0x37accd[_0xce6c('0x2c')],qs['fields'](_0x1d36d4[_0xce6c('0x2d')][_0xce6c('0x32')]));_0x150b74['attributes']=_0x150b74[_0xce6c('0x31')][_0xce6c('0x33')]?_0x150b74[_0xce6c('0x31')]:_0x37accd[_0xce6c('0x2c')];if(_0x1d36d4[_0xce6c('0x2d')]['includeAll']){_0x150b74[_0xce6c('0x3f')]=[{'all':!![]}];}_0x150b74=_[_0xce6c('0x39')]({},_0x150b74,_0x1d36d4[_0xce6c('0x3d')]);return db['ZendeskConfiguration']['find'](_0x150b74)[_0xce6c('0x22')](handleEntityNotFound(_0x2fc1f5,null))[_0xce6c('0x22')](respondWithResult(_0x2fc1f5,null))[_0xce6c('0x42')](handleError(_0x2fc1f5,null));};exports[_0xce6c('0x45')]=function(_0x1686de,_0x4ac40c){return db[_0xce6c('0x28')][_0xce6c('0x45')](_0x1686de[_0xce6c('0x46')],{})[_0xce6c('0x22')](respondWithResult(_0x4ac40c,0xc9))[_0xce6c('0x42')](handleError(_0x4ac40c,null));};exports[_0xce6c('0x47')]=function(_0x57ac18,_0x31432e){if(_0x57ac18[_0xce6c('0x46')]['id']){delete _0x57ac18[_0xce6c('0x46')]['id'];}return db[_0xce6c('0x28')]['find']({'where':{'id':_0x57ac18['params']['id']}})[_0xce6c('0x22')](handleEntityNotFound(_0x31432e,null))[_0xce6c('0x22')](saveUpdates(_0x57ac18[_0xce6c('0x46')],null))[_0xce6c('0x22')](respondWithResult(_0x31432e,null))[_0xce6c('0x42')](handleError(_0x31432e,null));};exports[_0xce6c('0x23')]=function(_0x36b2b8,_0x21625a){return db[_0xce6c('0x28')][_0xce6c('0x48')]({'where':{'id':_0x36b2b8[_0xce6c('0x44')]['id']}})[_0xce6c('0x22')](handleEntityNotFound(_0x21625a,null))[_0xce6c('0x22')](removeEntity(_0x21625a,null))[_0xce6c('0x42')](handleError(_0x21625a,null));};exports['getFields']=function(_0xa36343,_0x25cdbb,_0x2ceaf4){var _0x30b161={};var _0x4fb18c={};var _0x3dda35;var _0x2f7362;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0xa36343[_0xce6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x25cdbb,null))['then'](function(_0x3f8d8e){if(_0x3f8d8e){_0x3dda35=_0x3f8d8e;_0x4fb18c[_0xce6c('0x2c')]=_[_0xce6c('0x2e')](db[_0xce6c('0x49')]['rawAttributes']);_0x4fb18c['query']=_[_0xce6c('0x2e')](_0xa36343['query']);_0x4fb18c[_0xce6c('0x2f')]=_['intersection'](_0x4fb18c[_0xce6c('0x2c')],_0x4fb18c[_0xce6c('0x2d')]);_0x30b161[_0xce6c('0x31')]=_[_0xce6c('0x30')](_0x4fb18c['model'],qs[_0xce6c('0x32')](_0xa36343[_0xce6c('0x2d')][_0xce6c('0x32')]));_0x30b161[_0xce6c('0x31')]=_0x30b161[_0xce6c('0x31')][_0xce6c('0x33')]?_0x30b161[_0xce6c('0x31')]:_0x4fb18c['model'];_0x30b161['order']=qs[_0xce6c('0x36')](_0xa36343['query'][_0xce6c('0x36')]);_0x30b161[_0xce6c('0x37')]=qs[_0xce6c('0x2f')](_[_0xce6c('0x38')](_0xa36343['query'],_0x4fb18c['filters']));if(_0xa36343[_0xce6c('0x2d')][_0xce6c('0x3c')]){_0x30b161[_0xce6c('0x37')]=_['merge'](_0x30b161[_0xce6c('0x37')],{'$or':_[_0xce6c('0x27')](_0x30b161['attributes'],function(_0x31adcd){var _0x43aa08={};_0x43aa08[_0x31adcd]={'$like':'%'+_0xa36343[_0xce6c('0x2d')][_0xce6c('0x3c')]+'%'};return _0x43aa08;})});}_0x30b161=_['merge']({},_0x30b161,_0xa36343['options']);return _0x3dda35[_0xce6c('0x4a')](_0x30b161);}})[_0xce6c('0x22')](function(_0x230ac5){if(_0x230ac5){_0x2f7362=_0x230ac5[_0xce6c('0x33')];if(!_0xa36343[_0xce6c('0x2d')][_0xce6c('0x34')]('nolimit')){_0x30b161[_0xce6c('0x35')]=qs[_0xce6c('0x35')](_0xa36343['query'][_0xce6c('0x35')]);_0x30b161['offset']=qs[_0xce6c('0x1a')](_0xa36343['query'][_0xce6c('0x1a')]);}return _0x3dda35[_0xce6c('0x4a')](_0x30b161);}})[_0xce6c('0x22')](function(_0x47946c){if(_0x47946c){return _0x47946c?{'count':_0x2f7362,'rows':_0x47946c}:null;}})[_0xce6c('0x22')](respondWithResult(_0x25cdbb,null))[_0xce6c('0x42')](handleError(_0x25cdbb,null));};exports[_0xce6c('0x4b')]=function(_0x1cadde,_0xe44b07,_0x1e6966){var _0x575087={};var _0x43a275={};var _0x457c09;var _0x2137b7;return db[_0xce6c('0x28')][_0xce6c('0x4c')]({'where':{'id':_0x1cadde[_0xce6c('0x44')]['id']}})[_0xce6c('0x22')](handleEntityNotFound(_0xe44b07,null))[_0xce6c('0x22')](function(_0x4b6eb4){if(_0x4b6eb4){_0x457c09=_0x4b6eb4;_0x43a275[_0xce6c('0x2c')]=_[_0xce6c('0x2e')](db[_0xce6c('0x49')][_0xce6c('0x29')]);_0x43a275[_0xce6c('0x2d')]=_[_0xce6c('0x2e')](_0x1cadde['query']);_0x43a275[_0xce6c('0x2f')]=_[_0xce6c('0x30')](_0x43a275[_0xce6c('0x2c')],_0x43a275[_0xce6c('0x2d')]);_0x575087[_0xce6c('0x31')]=_['intersection'](_0x43a275['model'],qs['fields'](_0x1cadde[_0xce6c('0x2d')]['fields']));_0x575087['attributes']=_0x575087[_0xce6c('0x31')][_0xce6c('0x33')]?_0x575087[_0xce6c('0x31')]:_0x43a275['model'];_0x575087[_0xce6c('0x4d')]=qs[_0xce6c('0x36')](_0x1cadde['query'][_0xce6c('0x36')]);_0x575087['where']=qs[_0xce6c('0x2f')](_[_0xce6c('0x38')](_0x1cadde['query'],_0x43a275[_0xce6c('0x2f')]));if(_0x1cadde[_0xce6c('0x2d')][_0xce6c('0x3c')]){_0x575087['where']=_[_0xce6c('0x39')](_0x575087[_0xce6c('0x37')],{'$or':_['map'](_0x575087[_0xce6c('0x31')],function(_0x582ab7){var _0x1c82eb={};_0x1c82eb[_0x582ab7]={'$like':'%'+_0x1cadde[_0xce6c('0x2d')][_0xce6c('0x3c')]+'%'};return _0x1c82eb;})});}_0x575087=_[_0xce6c('0x39')]({},_0x575087,_0x1cadde[_0xce6c('0x3d')]);return _0x457c09[_0xce6c('0x4b')](_0x575087);}})['then'](function(_0x68b6ce){if(_0x68b6ce){_0x2137b7=_0x68b6ce['length'];if(!_0x1cadde['query'][_0xce6c('0x34')](_0xce6c('0x4e'))){_0x575087['limit']=qs['limit'](_0x1cadde[_0xce6c('0x2d')][_0xce6c('0x35')]);_0x575087['offset']=qs[_0xce6c('0x1a')](_0x1cadde[_0xce6c('0x2d')][_0xce6c('0x1a')]);}return _0x457c09['getSubjects'](_0x575087);}})[_0xce6c('0x22')](function(_0x24683c){if(_0x24683c){return _0x24683c?{'count':_0x2137b7,'rows':_0x24683c}:null;}})[_0xce6c('0x22')](respondWithResult(_0xe44b07,null))[_0xce6c('0x42')](handleError(_0xe44b07,null));};exports[_0xce6c('0x4f')]=function(_0x56d126,_0x18329d,_0x5dadbd){var _0x20b3a3={};var _0x2fba7e={};var _0x582ed8;var _0x219dad;return db[_0xce6c('0x28')][_0xce6c('0x4c')]({'where':{'id':_0x56d126[_0xce6c('0x44')]['id']}})[_0xce6c('0x22')](handleEntityNotFound(_0x18329d,null))[_0xce6c('0x22')](function(_0x2528cb){if(_0x2528cb){_0x582ed8=_0x2528cb;_0x2fba7e[_0xce6c('0x2c')]=_['keys'](db[_0xce6c('0x49')]['rawAttributes']);_0x2fba7e[_0xce6c('0x2d')]=_[_0xce6c('0x2e')](_0x56d126[_0xce6c('0x2d')]);_0x2fba7e[_0xce6c('0x2f')]=_[_0xce6c('0x30')](_0x2fba7e['model'],_0x2fba7e[_0xce6c('0x2d')]);_0x20b3a3['attributes']=_[_0xce6c('0x30')](_0x2fba7e['model'],qs[_0xce6c('0x32')](_0x56d126['query'][_0xce6c('0x32')]));_0x20b3a3[_0xce6c('0x31')]=_0x20b3a3[_0xce6c('0x31')][_0xce6c('0x33')]?_0x20b3a3[_0xce6c('0x31')]:_0x2fba7e['model'];_0x20b3a3['order']=qs[_0xce6c('0x36')](_0x56d126[_0xce6c('0x2d')][_0xce6c('0x36')]);_0x20b3a3[_0xce6c('0x37')]=qs[_0xce6c('0x2f')](_[_0xce6c('0x38')](_0x56d126[_0xce6c('0x2d')],_0x2fba7e[_0xce6c('0x2f')]));if(_0x56d126['query'][_0xce6c('0x3c')]){_0x20b3a3[_0xce6c('0x37')]=_['merge'](_0x20b3a3[_0xce6c('0x37')],{'$or':_[_0xce6c('0x27')](_0x20b3a3['attributes'],function(_0x5447e7){var _0x374367={};_0x374367[_0x5447e7]={'$like':'%'+_0x56d126[_0xce6c('0x2d')]['filter']+'%'};return _0x374367;})});}_0x20b3a3=_['merge']({},_0x20b3a3,_0x56d126['options']);return _0x582ed8[_0xce6c('0x4f')](_0x20b3a3);}})[_0xce6c('0x22')](function(_0x37c58d){if(_0x37c58d){_0x219dad=_0x37c58d[_0xce6c('0x33')];if(!_0x56d126[_0xce6c('0x2d')][_0xce6c('0x34')]('nolimit')){_0x20b3a3[_0xce6c('0x35')]=qs[_0xce6c('0x35')](_0x56d126['query'][_0xce6c('0x35')]);_0x20b3a3['offset']=qs[_0xce6c('0x1a')](_0x56d126[_0xce6c('0x2d')][_0xce6c('0x1a')]);}return _0x582ed8['getDescriptions'](_0x20b3a3);}})[_0xce6c('0x22')](function(_0x359edd){if(_0x359edd){return _0x359edd?{'count':_0x219dad,'rows':_0x359edd}:null;}})[_0xce6c('0x22')](respondWithResult(_0x18329d,null))[_0xce6c('0x42')](handleError(_0x18329d,null));};exports[_0xce6c('0x50')]=function(_0x3228b9,_0x467f1a,_0x59aab2){var _0x2a49b1={};var _0x3da1a8={};var _0x22fcd7;var _0x225fec;return db[_0xce6c('0x28')][_0xce6c('0x4c')]({'where':{'id':_0x3228b9['params']['id']}})['then'](handleEntityNotFound(_0x467f1a,null))[_0xce6c('0x22')](function(_0x4394b0){if(_0x4394b0){_0x22fcd7=_0x4394b0;_0x3da1a8[_0xce6c('0x2c')]=_[_0xce6c('0x2e')](db['Tag'][_0xce6c('0x29')]);_0x3da1a8[_0xce6c('0x2d')]=_[_0xce6c('0x2e')](_0x3228b9['query']);_0x3da1a8[_0xce6c('0x2f')]=_['intersection'](_0x3da1a8[_0xce6c('0x2c')],_0x3da1a8[_0xce6c('0x2d')]);_0x2a49b1['attributes']=_[_0xce6c('0x30')](_0x3da1a8[_0xce6c('0x2c')],qs[_0xce6c('0x32')](_0x3228b9[_0xce6c('0x2d')][_0xce6c('0x32')]));_0x2a49b1[_0xce6c('0x31')]=_0x2a49b1[_0xce6c('0x31')][_0xce6c('0x33')]?_0x2a49b1['attributes']:_0x3da1a8[_0xce6c('0x2c')];_0x2a49b1[_0xce6c('0x4d')]=qs[_0xce6c('0x36')](_0x3228b9['query'][_0xce6c('0x36')]);_0x2a49b1[_0xce6c('0x37')]=qs[_0xce6c('0x2f')](_[_0xce6c('0x38')](_0x3228b9[_0xce6c('0x2d')],_0x3da1a8[_0xce6c('0x2f')]));if(_0x3228b9[_0xce6c('0x2d')][_0xce6c('0x3c')]){_0x2a49b1[_0xce6c('0x37')]=_[_0xce6c('0x39')](_0x2a49b1[_0xce6c('0x37')],{'$or':_[_0xce6c('0x27')](_0x2a49b1['attributes'],function(_0x5d110b){var _0x13fcb9={};_0x13fcb9[_0x5d110b]={'$like':'%'+_0x3228b9[_0xce6c('0x2d')]['filter']+'%'};return _0x13fcb9;})});}_0x2a49b1=_[_0xce6c('0x39')]({},_0x2a49b1,_0x3228b9['options']);return _0x22fcd7[_0xce6c('0x50')](_0x2a49b1);}})[_0xce6c('0x22')](function(_0x387829){if(_0x387829){_0x225fec=_0x387829[_0xce6c('0x33')];if(!_0x3228b9[_0xce6c('0x2d')][_0xce6c('0x34')](_0xce6c('0x4e'))){_0x2a49b1[_0xce6c('0x35')]=qs['limit'](_0x3228b9[_0xce6c('0x2d')][_0xce6c('0x35')]);_0x2a49b1[_0xce6c('0x1a')]=qs[_0xce6c('0x1a')](_0x3228b9[_0xce6c('0x2d')][_0xce6c('0x1a')]);}return _0x22fcd7[_0xce6c('0x50')](_0x2a49b1);}})[_0xce6c('0x22')](function(_0x1c33c7){if(_0x1c33c7){return _0x1c33c7?{'count':_0x225fec,'rows':_0x1c33c7}:null;}})[_0xce6c('0x22')](respondWithResult(_0x467f1a,null))['catch'](handleError(_0x467f1a,null));};exports[_0xce6c('0x51')]=function(_0x1dc399,_0x5a5904,_0x2b2888){if(_0x1dc399[_0xce6c('0x46')]['id']){delete _0x1dc399[_0xce6c('0x46')]['id'];}return db[_0xce6c('0x28')][_0xce6c('0x4c')]({'where':{'id':_0x1dc399['params']['id']}})['then'](handleEntityNotFound(_0x5a5904,null))[_0xce6c('0x22')](function(_0x56d8b3){if(_0x56d8b3){return _0x56d8b3[_0xce6c('0x51')](_0x1dc399[_0xce6c('0x46')][_0xce6c('0x52')]||[]);}return null;})['then'](respondWithResult(_0x5a5904,null))[_0xce6c('0x42')](handleError(_0x5a5904,null));}; \ No newline at end of file +var _0xa75d=['apply','reject','update','then','end','sendStatus','error','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','destroy','findOne','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa75d,0x17e));var _0xda75=function(_0x3433a2,_0xdb47ea){_0x3433a2=_0x3433a2-0x0;var _0x3c6969=_0xa75d[_0x3433a2];return _0x3c6969;};'use strict';var emlformat=require(_0xda75('0x0'));var rimraf=require(_0xda75('0x1'));var zipdir=require(_0xda75('0x2'));var jsonpatch=require(_0xda75('0x3'));var rp=require('request-promise');var moment=require(_0xda75('0x4'));var BPromise=require(_0xda75('0x5'));var Mustache=require(_0xda75('0x6'));var util=require('util');var path=require(_0xda75('0x7'));var sox=require(_0xda75('0x8'));var csv=require(_0xda75('0x9'));var ejs=require(_0xda75('0xa'));var fs=require('fs');var fs_extra=require(_0xda75('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xda75('0xc'));var deskjs=require(_0xda75('0xd'));var toCsv=require(_0xda75('0x9'));var querystring=require(_0xda75('0xe'));var Papa=require('papaparse');var Redis=require(_0xda75('0xf'));var authService=require(_0xda75('0x10'));var qs=require(_0xda75('0x11'));var as=require(_0xda75('0x12'));var hardwareService=require(_0xda75('0x13'));var logger=require(_0xda75('0x14'))(_0xda75('0x15'));var utils=require(_0xda75('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xda75('0x17'));var db=require(_0xda75('0x18'))['db'];function respondWithStatusCode(_0x3ef94d,_0x15249a){_0x15249a=_0x15249a||0xcc;return function(_0x35f490){if(_0x35f490){return _0x3ef94d['sendStatus'](_0x15249a);}return _0x3ef94d[_0xda75('0x19')](_0x15249a)['end']();};}function respondWithResult(_0x8bdc88,_0x5e44c6){_0x5e44c6=_0x5e44c6||0xc8;return function(_0xada197){if(_0xada197){return _0x8bdc88['status'](_0x5e44c6)[_0xda75('0x1a')](_0xada197);}};}function respondWithFilteredResult(_0x47fec2,_0x3abfc1){return function(_0xe2be20){if(_0xe2be20){var _0xdb276a=typeof _0x3abfc1[_0xda75('0x1b')]===_0xda75('0x1c')&&typeof _0x3abfc1[_0xda75('0x1d')]===_0xda75('0x1c');var _0x13a7ed=_0xe2be20[_0xda75('0x1e')];var _0x52ba14=_0xdb276a?0x0:_0x3abfc1[_0xda75('0x1b')];var _0x3f07c7=_0xdb276a?_0xe2be20['count']:_0x3abfc1[_0xda75('0x1b')]+_0x3abfc1['limit'];var _0x46b1a2;if(_0x3f07c7>=_0x13a7ed){_0x3f07c7=_0x13a7ed;_0x46b1a2=0xc8;}else{_0x46b1a2=0xce;}_0x47fec2[_0xda75('0x19')](_0x46b1a2);return _0x47fec2[_0xda75('0x1f')](_0xda75('0x20'),_0x52ba14+'-'+_0x3f07c7+'/'+_0x13a7ed)[_0xda75('0x1a')](_0xe2be20);}return null;};}function patchUpdates(_0x186c31){return function(_0x42e95f){try{jsonpatch[_0xda75('0x21')](_0x42e95f,_0x186c31,!![]);}catch(_0x154183){return BPromise[_0xda75('0x22')](_0x154183);}return _0x42e95f['save']();};}function saveUpdates(_0x531cb1,_0x56202f){return function(_0x20b3bc){if(_0x20b3bc){return _0x20b3bc[_0xda75('0x23')](_0x531cb1)[_0xda75('0x24')](function(_0x1a9327){return _0x1a9327;});}return null;};}function removeEntity(_0x5885c6,_0x3d48c7){return function(_0x19c0b0){if(_0x19c0b0){return _0x19c0b0['destroy']()[_0xda75('0x24')](function(){_0x5885c6[_0xda75('0x19')](0xcc)[_0xda75('0x25')]();});}};}function handleEntityNotFound(_0x399d1a,_0x2a2026){return function(_0xfb8b56){if(!_0xfb8b56){_0x399d1a[_0xda75('0x26')](0x194);}return _0xfb8b56;};}function handleError(_0x3f1e52,_0xf7e59f){_0xf7e59f=_0xf7e59f||0x1f4;return function(_0x532752){logger[_0xda75('0x27')](_0x532752['stack']);if(_0x532752[_0xda75('0x28')]){delete _0x532752['name'];}_0x3f1e52[_0xda75('0x19')](_0xf7e59f)[_0xda75('0x29')](_0x532752);};}exports[_0xda75('0x2a')]=function(_0x399a45,_0x5d40a9){var _0x5e9db4={},_0x18dace={},_0x42370a={'count':0x0,'rows':[]};var _0x3346a0=_[_0xda75('0x2b')](db[_0xda75('0x2c')][_0xda75('0x2d')],function(_0x70039f){return{'name':_0x70039f[_0xda75('0x2e')],'type':_0x70039f[_0xda75('0x2f')][_0xda75('0x30')]};});_0x18dace[_0xda75('0x31')]=_[_0xda75('0x2b')](_0x3346a0,_0xda75('0x28'));_0x18dace[_0xda75('0x32')]=_[_0xda75('0x33')](_0x399a45['query']);_0x18dace[_0xda75('0x34')]=_[_0xda75('0x35')](_0x18dace[_0xda75('0x31')],_0x18dace[_0xda75('0x32')]);_0x5e9db4['attributes']=_['intersection'](_0x18dace['model'],qs[_0xda75('0x36')](_0x399a45[_0xda75('0x32')][_0xda75('0x36')]));_0x5e9db4[_0xda75('0x37')]=_0x5e9db4['attributes'][_0xda75('0x38')]?_0x5e9db4[_0xda75('0x37')]:_0x18dace[_0xda75('0x31')];if(!_0x399a45[_0xda75('0x32')][_0xda75('0x39')](_0xda75('0x3a'))){_0x5e9db4[_0xda75('0x1d')]=qs['limit'](_0x399a45[_0xda75('0x32')][_0xda75('0x1d')]);_0x5e9db4['offset']=qs['offset'](_0x399a45[_0xda75('0x32')]['offset']);}_0x5e9db4[_0xda75('0x3b')]=qs[_0xda75('0x3c')](_0x399a45[_0xda75('0x32')][_0xda75('0x3c')]);_0x5e9db4['where']=qs[_0xda75('0x34')](_[_0xda75('0x3d')](_0x399a45[_0xda75('0x32')],_0x18dace[_0xda75('0x34')]),_0x3346a0);if(_0x399a45[_0xda75('0x32')][_0xda75('0x3e')]){_0x5e9db4[_0xda75('0x3f')]=_[_0xda75('0x40')](_0x5e9db4[_0xda75('0x3f')],{'$or':_[_0xda75('0x2b')](_0x3346a0,function(_0x251cb7){if(_0x251cb7[_0xda75('0x2f')]!=='VIRTUAL'){var _0x5802a7={};_0x5802a7[_0x251cb7[_0xda75('0x28')]]={'$like':'%'+_0x399a45[_0xda75('0x32')][_0xda75('0x3e')]+'%'};return _0x5802a7;}})});}_0x5e9db4=_['merge']({},_0x5e9db4,_0x399a45[_0xda75('0x41')]);var _0x5c7a63={'where':_0x5e9db4[_0xda75('0x3f')]};return db[_0xda75('0x2c')][_0xda75('0x1e')](_0x5c7a63)[_0xda75('0x24')](function(_0x1bdb9f){_0x42370a[_0xda75('0x1e')]=_0x1bdb9f;if(_0x399a45[_0xda75('0x32')][_0xda75('0x42')]){_0x5e9db4[_0xda75('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xda75('0x44')](_0x5e9db4);})[_0xda75('0x24')](function(_0x5b99a7){_0x42370a['rows']=_0x5b99a7;return _0x42370a;})[_0xda75('0x24')](respondWithFilteredResult(_0x5d40a9,_0x5e9db4))[_0xda75('0x45')](handleError(_0x5d40a9,null));};exports[_0xda75('0x46')]=function(_0x104a8f,_0x495664){var _0x13a308={'raw':![],'where':{'id':_0x104a8f[_0xda75('0x47')]['id']}},_0x44a005={};_0x44a005[_0xda75('0x31')]=_['keys'](db['ZendeskConfiguration'][_0xda75('0x2d')]);_0x44a005[_0xda75('0x32')]=_[_0xda75('0x33')](_0x104a8f['query']);_0x44a005['filters']=_[_0xda75('0x35')](_0x44a005['model'],_0x44a005[_0xda75('0x32')]);_0x13a308['attributes']=_[_0xda75('0x35')](_0x44a005[_0xda75('0x31')],qs[_0xda75('0x36')](_0x104a8f[_0xda75('0x32')]['fields']));_0x13a308['attributes']=_0x13a308[_0xda75('0x37')][_0xda75('0x38')]?_0x13a308[_0xda75('0x37')]:_0x44a005['model'];if(_0x104a8f[_0xda75('0x32')][_0xda75('0x42')]){_0x13a308[_0xda75('0x43')]=[{'all':!![]}];}_0x13a308=_[_0xda75('0x40')]({},_0x13a308,_0x104a8f['options']);return db[_0xda75('0x2c')]['find'](_0x13a308)[_0xda75('0x24')](handleEntityNotFound(_0x495664,null))[_0xda75('0x24')](respondWithResult(_0x495664,null))['catch'](handleError(_0x495664,null));};exports[_0xda75('0x48')]=function(_0x288936,_0x33c34b){return db['ZendeskConfiguration'][_0xda75('0x48')](_0x288936[_0xda75('0x49')],{})[_0xda75('0x24')](respondWithResult(_0x33c34b,0xc9))[_0xda75('0x45')](handleError(_0x33c34b,null));};exports['update']=function(_0x458a9e,_0x32fc1a){if(_0x458a9e[_0xda75('0x49')]['id']){delete _0x458a9e['body']['id'];}return db[_0xda75('0x2c')][_0xda75('0x4a')]({'where':{'id':_0x458a9e[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0x32fc1a,null))['then'](saveUpdates(_0x458a9e['body'],null))['then'](respondWithResult(_0x32fc1a,null))[_0xda75('0x45')](handleError(_0x32fc1a,null));};exports[_0xda75('0x4b')]=function(_0x5dc2d8,_0x559097){return db[_0xda75('0x2c')][_0xda75('0x4a')]({'where':{'id':_0x5dc2d8[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0x559097,null))[_0xda75('0x24')](removeEntity(_0x559097,null))[_0xda75('0x45')](handleError(_0x559097,null));};exports['getFields']=function(_0x3fdcd8,_0x236b98,_0x531ec2){var _0x43a9b3={};var _0x11920e={};var _0x1e21ca;var _0x43cc3d;return db[_0xda75('0x2c')][_0xda75('0x4c')]({'where':{'id':_0x3fdcd8[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0x236b98,null))[_0xda75('0x24')](function(_0x3d4ae6){if(_0x3d4ae6){_0x1e21ca=_0x3d4ae6;_0x11920e['model']=_['keys'](db['ZendeskField'][_0xda75('0x2d')]);_0x11920e['query']=_[_0xda75('0x33')](_0x3fdcd8['query']);_0x11920e[_0xda75('0x34')]=_[_0xda75('0x35')](_0x11920e[_0xda75('0x31')],_0x11920e['query']);_0x43a9b3['attributes']=_[_0xda75('0x35')](_0x11920e['model'],qs['fields'](_0x3fdcd8[_0xda75('0x32')][_0xda75('0x36')]));_0x43a9b3[_0xda75('0x37')]=_0x43a9b3['attributes']['length']?_0x43a9b3['attributes']:_0x11920e[_0xda75('0x31')];_0x43a9b3[_0xda75('0x3b')]=qs['sort'](_0x3fdcd8[_0xda75('0x32')][_0xda75('0x3c')]);_0x43a9b3[_0xda75('0x3f')]=qs[_0xda75('0x34')](_['pick'](_0x3fdcd8[_0xda75('0x32')],_0x11920e['filters']));if(_0x3fdcd8['query'][_0xda75('0x3e')]){_0x43a9b3[_0xda75('0x3f')]=_[_0xda75('0x40')](_0x43a9b3[_0xda75('0x3f')],{'$or':_[_0xda75('0x2b')](_0x43a9b3['attributes'],function(_0x4d2ed0){var _0xbfab54={};_0xbfab54[_0x4d2ed0]={'$like':'%'+_0x3fdcd8['query']['filter']+'%'};return _0xbfab54;})});}_0x43a9b3=_[_0xda75('0x40')]({},_0x43a9b3,_0x3fdcd8['options']);return _0x1e21ca[_0xda75('0x4d')](_0x43a9b3);}})[_0xda75('0x24')](function(_0x1e7e12){if(_0x1e7e12){_0x43cc3d=_0x1e7e12[_0xda75('0x38')];if(!_0x3fdcd8[_0xda75('0x32')][_0xda75('0x39')]('nolimit')){_0x43a9b3[_0xda75('0x1d')]=qs['limit'](_0x3fdcd8[_0xda75('0x32')][_0xda75('0x1d')]);_0x43a9b3[_0xda75('0x1b')]=qs[_0xda75('0x1b')](_0x3fdcd8[_0xda75('0x32')][_0xda75('0x1b')]);}return _0x1e21ca[_0xda75('0x4d')](_0x43a9b3);}})[_0xda75('0x24')](function(_0x25bd87){if(_0x25bd87){return _0x25bd87?{'count':_0x43cc3d,'rows':_0x25bd87}:null;}})[_0xda75('0x24')](respondWithResult(_0x236b98,null))['catch'](handleError(_0x236b98,null));};exports[_0xda75('0x4e')]=function(_0x3db5f6,_0x5bb4d0,_0x627359){var _0x57ca7d={};var _0x169c3b={};var _0x2efc19;var _0x3d7ea4;return db[_0xda75('0x2c')]['findOne']({'where':{'id':_0x3db5f6[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0x5bb4d0,null))[_0xda75('0x24')](function(_0x259c28){if(_0x259c28){_0x2efc19=_0x259c28;_0x169c3b[_0xda75('0x31')]=_[_0xda75('0x33')](db['ZendeskField'][_0xda75('0x2d')]);_0x169c3b[_0xda75('0x32')]=_[_0xda75('0x33')](_0x3db5f6[_0xda75('0x32')]);_0x169c3b[_0xda75('0x34')]=_[_0xda75('0x35')](_0x169c3b[_0xda75('0x31')],_0x169c3b['query']);_0x57ca7d[_0xda75('0x37')]=_['intersection'](_0x169c3b[_0xda75('0x31')],qs[_0xda75('0x36')](_0x3db5f6[_0xda75('0x32')][_0xda75('0x36')]));_0x57ca7d['attributes']=_0x57ca7d[_0xda75('0x37')][_0xda75('0x38')]?_0x57ca7d[_0xda75('0x37')]:_0x169c3b[_0xda75('0x31')];_0x57ca7d['order']=qs[_0xda75('0x3c')](_0x3db5f6[_0xda75('0x32')][_0xda75('0x3c')]);_0x57ca7d[_0xda75('0x3f')]=qs[_0xda75('0x34')](_[_0xda75('0x3d')](_0x3db5f6[_0xda75('0x32')],_0x169c3b[_0xda75('0x34')]));if(_0x3db5f6[_0xda75('0x32')][_0xda75('0x3e')]){_0x57ca7d[_0xda75('0x3f')]=_[_0xda75('0x40')](_0x57ca7d['where'],{'$or':_[_0xda75('0x2b')](_0x57ca7d[_0xda75('0x37')],function(_0x162b79){var _0xf37240={};_0xf37240[_0x162b79]={'$like':'%'+_0x3db5f6[_0xda75('0x32')]['filter']+'%'};return _0xf37240;})});}_0x57ca7d=_['merge']({},_0x57ca7d,_0x3db5f6[_0xda75('0x41')]);return _0x2efc19[_0xda75('0x4e')](_0x57ca7d);}})[_0xda75('0x24')](function(_0xb8455b){if(_0xb8455b){_0x3d7ea4=_0xb8455b[_0xda75('0x38')];if(!_0x3db5f6[_0xda75('0x32')][_0xda75('0x39')](_0xda75('0x3a'))){_0x57ca7d[_0xda75('0x1d')]=qs[_0xda75('0x1d')](_0x3db5f6[_0xda75('0x32')][_0xda75('0x1d')]);_0x57ca7d[_0xda75('0x1b')]=qs['offset'](_0x3db5f6['query'][_0xda75('0x1b')]);}return _0x2efc19['getSubjects'](_0x57ca7d);}})[_0xda75('0x24')](function(_0x31fff1){if(_0x31fff1){return _0x31fff1?{'count':_0x3d7ea4,'rows':_0x31fff1}:null;}})['then'](respondWithResult(_0x5bb4d0,null))[_0xda75('0x45')](handleError(_0x5bb4d0,null));};exports[_0xda75('0x4f')]=function(_0x50af91,_0x2b26a3,_0xfd9814){var _0x274e04={};var _0x8e3de2={};var _0x5299e6;var _0x3be079;return db[_0xda75('0x2c')][_0xda75('0x4c')]({'where':{'id':_0x50af91[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0x2b26a3,null))[_0xda75('0x24')](function(_0x300e1a){if(_0x300e1a){_0x5299e6=_0x300e1a;_0x8e3de2[_0xda75('0x31')]=_[_0xda75('0x33')](db['ZendeskField'][_0xda75('0x2d')]);_0x8e3de2[_0xda75('0x32')]=_['keys'](_0x50af91[_0xda75('0x32')]);_0x8e3de2[_0xda75('0x34')]=_['intersection'](_0x8e3de2[_0xda75('0x31')],_0x8e3de2[_0xda75('0x32')]);_0x274e04[_0xda75('0x37')]=_[_0xda75('0x35')](_0x8e3de2[_0xda75('0x31')],qs[_0xda75('0x36')](_0x50af91[_0xda75('0x32')]['fields']));_0x274e04['attributes']=_0x274e04[_0xda75('0x37')][_0xda75('0x38')]?_0x274e04[_0xda75('0x37')]:_0x8e3de2['model'];_0x274e04['order']=qs[_0xda75('0x3c')](_0x50af91['query']['sort']);_0x274e04['where']=qs[_0xda75('0x34')](_[_0xda75('0x3d')](_0x50af91[_0xda75('0x32')],_0x8e3de2[_0xda75('0x34')]));if(_0x50af91[_0xda75('0x32')][_0xda75('0x3e')]){_0x274e04['where']=_[_0xda75('0x40')](_0x274e04[_0xda75('0x3f')],{'$or':_['map'](_0x274e04[_0xda75('0x37')],function(_0x4bd6c5){var _0x4bbd5e={};_0x4bbd5e[_0x4bd6c5]={'$like':'%'+_0x50af91[_0xda75('0x32')][_0xda75('0x3e')]+'%'};return _0x4bbd5e;})});}_0x274e04=_['merge']({},_0x274e04,_0x50af91['options']);return _0x5299e6[_0xda75('0x4f')](_0x274e04);}})['then'](function(_0x13de41){if(_0x13de41){_0x3be079=_0x13de41['length'];if(!_0x50af91[_0xda75('0x32')]['hasOwnProperty'](_0xda75('0x3a'))){_0x274e04[_0xda75('0x1d')]=qs[_0xda75('0x1d')](_0x50af91[_0xda75('0x32')]['limit']);_0x274e04[_0xda75('0x1b')]=qs[_0xda75('0x1b')](_0x50af91[_0xda75('0x32')]['offset']);}return _0x5299e6['getDescriptions'](_0x274e04);}})['then'](function(_0x49b62e){if(_0x49b62e){return _0x49b62e?{'count':_0x3be079,'rows':_0x49b62e}:null;}})[_0xda75('0x24')](respondWithResult(_0x2b26a3,null))[_0xda75('0x45')](handleError(_0x2b26a3,null));};exports[_0xda75('0x50')]=function(_0x40e057,_0xd1b1ca,_0x27b244){var _0x566377={};var _0x57f348={};var _0x278b1d;var _0x1fa05c;return db[_0xda75('0x2c')][_0xda75('0x4c')]({'where':{'id':_0x40e057[_0xda75('0x47')]['id']}})[_0xda75('0x24')](handleEntityNotFound(_0xd1b1ca,null))[_0xda75('0x24')](function(_0x3497b2){if(_0x3497b2){_0x278b1d=_0x3497b2;_0x57f348[_0xda75('0x31')]=_[_0xda75('0x33')](db[_0xda75('0x51')]['rawAttributes']);_0x57f348[_0xda75('0x32')]=_['keys'](_0x40e057[_0xda75('0x32')]);_0x57f348[_0xda75('0x34')]=_[_0xda75('0x35')](_0x57f348[_0xda75('0x31')],_0x57f348[_0xda75('0x32')]);_0x566377['attributes']=_[_0xda75('0x35')](_0x57f348[_0xda75('0x31')],qs[_0xda75('0x36')](_0x40e057[_0xda75('0x32')][_0xda75('0x36')]));_0x566377[_0xda75('0x37')]=_0x566377['attributes'][_0xda75('0x38')]?_0x566377['attributes']:_0x57f348[_0xda75('0x31')];_0x566377[_0xda75('0x3b')]=qs[_0xda75('0x3c')](_0x40e057[_0xda75('0x32')]['sort']);_0x566377[_0xda75('0x3f')]=qs['filters'](_[_0xda75('0x3d')](_0x40e057[_0xda75('0x32')],_0x57f348[_0xda75('0x34')]));if(_0x40e057[_0xda75('0x32')]['filter']){_0x566377[_0xda75('0x3f')]=_[_0xda75('0x40')](_0x566377[_0xda75('0x3f')],{'$or':_[_0xda75('0x2b')](_0x566377[_0xda75('0x37')],function(_0x2cd32a){var _0x3c028c={};_0x3c028c[_0x2cd32a]={'$like':'%'+_0x40e057[_0xda75('0x32')]['filter']+'%'};return _0x3c028c;})});}_0x566377=_[_0xda75('0x40')]({},_0x566377,_0x40e057[_0xda75('0x41')]);return _0x278b1d['getTags'](_0x566377);}})[_0xda75('0x24')](function(_0x283dcc){if(_0x283dcc){_0x1fa05c=_0x283dcc[_0xda75('0x38')];if(!_0x40e057[_0xda75('0x32')][_0xda75('0x39')]('nolimit')){_0x566377[_0xda75('0x1d')]=qs[_0xda75('0x1d')](_0x40e057[_0xda75('0x32')]['limit']);_0x566377[_0xda75('0x1b')]=qs[_0xda75('0x1b')](_0x40e057['query']['offset']);}return _0x278b1d['getTags'](_0x566377);}})[_0xda75('0x24')](function(_0x269b4c){if(_0x269b4c){return _0x269b4c?{'count':_0x1fa05c,'rows':_0x269b4c}:null;}})['then'](respondWithResult(_0xd1b1ca,null))[_0xda75('0x45')](handleError(_0xd1b1ca,null));};exports[_0xda75('0x52')]=function(_0x5b1e16,_0x3a26fa,_0x380674){if(_0x5b1e16[_0xda75('0x49')]['id']){delete _0x5b1e16[_0xda75('0x49')]['id'];}return db['ZendeskConfiguration'][_0xda75('0x4c')]({'where':{'id':_0x5b1e16[_0xda75('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a26fa,null))[_0xda75('0x24')](function(_0x275701){if(_0x275701){return _0x275701[_0xda75('0x52')](_0x5b1e16[_0xda75('0x49')]['ids']||[]);}return null;})[_0xda75('0x24')](respondWithResult(_0x3a26fa,null))[_0xda75('0x45')](handleError(_0x3a26fa,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 827cf79..55b990c 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 _0x7334=['exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x7334,0x184));var _0x4733=function(_0x233874,_0x40a133){_0x233874=_0x233874-0x0;var _0x71fa34=_0x7334[_0x233874];return _0x71fa34;};'use strict';var _=require(_0x4733('0x0'));var util=require(_0x4733('0x1'));var logger=require(_0x4733('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4733('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4733('0x4'));var rimraf=require(_0x4733('0x5'));var config=require(_0x4733('0x6'));var attributes=require(_0x4733('0x7'));module[_0x4733('0x8')]=function(_0x449ead,_0x16d7cc){return _0x449ead[_0x4733('0x9')](_0x4733('0xa'),attributes,{'tableName':_0x4733('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4b17=['int_zendesk_configurations','lodash','../../config/logger','moment','bluebird','path','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration'];(function(_0x22087c,_0x5d9212){var _0xe86b06=function(_0x36d9f6){while(--_0x36d9f6){_0x22087c['push'](_0x22087c['shift']());}};_0xe86b06(++_0x5d9212);}(_0x4b17,0x10f));var _0x74b1=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x4b17[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var logger=require(_0x74b1('0x1'))('api');var moment=require(_0x74b1('0x2'));var BPromise=require(_0x74b1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74b1('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x74b1('0x5'));module[_0x74b1('0x6')]=function(_0x379dcc,_0x3873a6){return _0x379dcc[_0x74b1('0x7')](_0x74b1('0x8'),attributes,{'tableName':_0x74b1('0x9'),'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 a9f24da..fe56d0c 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 _0x11f9=['request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x4bfc99,_0x30a9df){var _0x3c51bc=function(_0x23721a){while(--_0x23721a){_0x4bfc99['push'](_0x4bfc99['shift']());}};_0x3c51bc(++_0x30a9df);}(_0x11f9,0x165));var _0x911f=function(_0x9f65c,_0x2d2617){_0x9f65c=_0x9f65c-0x0;var _0xe11b1e=_0x11f9[_0x9f65c];return _0xe11b1e;};'use strict';var _=require(_0x911f('0x0'));var util=require('util');var moment=require(_0x911f('0x1'));var BPromise=require(_0x911f('0x2'));var rs=require(_0x911f('0x3'));var fs=require('fs');var Redis=require(_0x911f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x911f('0x5'));var logger=require(_0x911f('0x6'))(_0x911f('0x7'));var config=require(_0x911f('0x8'));var jayson=require(_0x911f('0x9'));var client=jayson['client'][_0x911f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29bd3d,_0x11d589,_0x344c90){return new BPromise(function(_0x10c7a4,_0x10669e){return client[_0x911f('0xb')](_0x29bd3d,_0x344c90)[_0x911f('0xc')](function(_0x30f031){logger[_0x911f('0xd')](_0x911f('0xe'),_0x11d589,_0x911f('0xf'));logger[_0x911f('0x10')](_0x911f('0x11'),_0x11d589,'request\x20sent',JSON['stringify'](_0x30f031));if(_0x30f031['error']){if(_0x30f031[_0x911f('0x12')][_0x911f('0x13')]===0x1f4){logger['error'](_0x911f('0xe'),_0x11d589,_0x30f031[_0x911f('0x12')]['message']);return _0x10669e(_0x30f031[_0x911f('0x12')]['message']);}logger[_0x911f('0x12')](_0x911f('0xe'),_0x11d589,_0x30f031[_0x911f('0x12')][_0x911f('0x14')]);return _0x10c7a4(_0x30f031['error']['message']);}else{logger['info'](_0x911f('0xe'),_0x11d589,_0x911f('0xf'));_0x10c7a4(_0x30f031[_0x911f('0x15')][_0x911f('0x14')]);}})[_0x911f('0x16')](function(_0xb319ad){logger[_0x911f('0x12')](_0x911f('0xe'),_0x11d589,_0xb319ad);_0x10669e(_0xb319ad);});});} \ No newline at end of file +var _0xe5af=['info','ZendeskConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1831b6,_0x340c03){var _0xa7f8fe=function(_0x5f4ca4){while(--_0x5f4ca4){_0x1831b6['push'](_0x1831b6['shift']());}};_0xa7f8fe(++_0x340c03);}(_0xe5af,0x14b));var _0xfe5a=function(_0x382ec9,_0x420df6){_0x382ec9=_0x382ec9-0x0;var _0x784c0=_0xe5af[_0x382ec9];return _0x784c0;};'use strict';var _=require(_0xfe5a('0x0'));var util=require(_0xfe5a('0x1'));var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe5a('0x4'));var db=require(_0xfe5a('0x5'))['db'];var utils=require(_0xfe5a('0x6'));var logger=require('../../config/logger')(_0xfe5a('0x7'));var config=require(_0xfe5a('0x8'));var jayson=require(_0xfe5a('0x9'));var client=jayson[_0xfe5a('0xa')][_0xfe5a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3060ee,_0x33f1a6,_0x3afad0){return new BPromise(function(_0x23851e,_0x3064f5){return client[_0xfe5a('0xc')](_0x3060ee,_0x3afad0)[_0xfe5a('0xd')](function(_0x3c1d75){logger[_0xfe5a('0xe')](_0xfe5a('0xf'),_0x33f1a6,'request\x20sent');logger[_0xfe5a('0x10')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x33f1a6,_0xfe5a('0x11'),JSON['stringify'](_0x3c1d75));if(_0x3c1d75[_0xfe5a('0x12')]){if(_0x3c1d75[_0xfe5a('0x12')][_0xfe5a('0x13')]===0x1f4){logger['error'](_0xfe5a('0xf'),_0x33f1a6,_0x3c1d75[_0xfe5a('0x12')][_0xfe5a('0x14')]);return _0x3064f5(_0x3c1d75[_0xfe5a('0x12')][_0xfe5a('0x14')]);}logger[_0xfe5a('0x12')](_0xfe5a('0xf'),_0x33f1a6,_0x3c1d75[_0xfe5a('0x12')][_0xfe5a('0x14')]);return _0x23851e(_0x3c1d75[_0xfe5a('0x12')][_0xfe5a('0x14')]);}else{logger[_0xfe5a('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x33f1a6,'request\x20sent');_0x23851e(_0x3c1d75[_0xfe5a('0x15')]['message']);}})[_0xfe5a('0x16')](function(_0x54dd74){logger[_0xfe5a('0x12')](_0xfe5a('0xf'),_0x33f1a6,_0x54dd74);_0x3064f5(_0x54dd74);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 9a4beee..7292f0c 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 _0x9ecb=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','delete','multer'];(function(_0x6ea8a2,_0x561d6c){var _0x4fe938=function(_0x1efa6c){while(--_0x1efa6c){_0x6ea8a2['push'](_0x6ea8a2['shift']());}};_0x4fe938(++_0x561d6c);}(_0x9ecb,0x1ec));var _0xb9ec=function(_0x46caf0,_0x490f59){_0x46caf0=_0x46caf0-0x0;var _0x32b130=_0x9ecb[_0x46caf0];return _0x32b130;};'use strict';var multer=require(_0xb9ec('0x0'));var util=require(_0xb9ec('0x1'));var path=require(_0xb9ec('0x2'));var timeout=require('connect-timeout');var express=require(_0xb9ec('0x3'));var router=express[_0xb9ec('0x4')]();var fs_extra=require(_0xb9ec('0x5'));var auth=require(_0xb9ec('0x6'));var interaction=require(_0xb9ec('0x7'));var config=require('../../config/environment');var controller=require(_0xb9ec('0x8'));router[_0xb9ec('0x9')]('/',auth[_0xb9ec('0xa')](),controller[_0xb9ec('0xb')]);router[_0xb9ec('0x9')](_0xb9ec('0xc'),auth[_0xb9ec('0xa')](),controller[_0xb9ec('0xd')]);router[_0xb9ec('0xe')]('/',auth[_0xb9ec('0xa')](),controller[_0xb9ec('0xf')]);router['put'](_0xb9ec('0xc'),auth[_0xb9ec('0xa')](),controller['update']);router[_0xb9ec('0x10')]('/:id',auth[_0xb9ec('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf2d3=['create','put','delete','/:id','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post'];(function(_0x515208,_0x5a12fd){var _0x4c3f8c=function(_0x1873c5){while(--_0x1873c5){_0x515208['push'](_0x515208['shift']());}};_0x4c3f8c(++_0x5a12fd);}(_0xf2d3,0x138));var _0x3f2d=function(_0x42cc47,_0x1e03a6){_0x42cc47=_0x42cc47-0x0;var _0x34318b=_0xf2d3[_0x42cc47];return _0x34318b;};'use strict';var multer=require(_0x3f2d('0x0'));var util=require(_0x3f2d('0x1'));var path=require(_0x3f2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3f2d('0x3')]();var fs_extra=require(_0x3f2d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3f2d('0x5'));var config=require(_0x3f2d('0x6'));var controller=require('./intZendeskField.controller');router[_0x3f2d('0x7')]('/',auth[_0x3f2d('0x8')](),controller[_0x3f2d('0x9')]);router[_0x3f2d('0x7')]('/:id',auth[_0x3f2d('0x8')](),controller[_0x3f2d('0xa')]);router[_0x3f2d('0xb')]('/',auth[_0x3f2d('0x8')](),controller[_0x3f2d('0xc')]);router[_0x3f2d('0xd')]('/:id',auth[_0x3f2d('0x8')](),controller['update']);router[_0x3f2d('0xe')](_0x3f2d('0xf'),auth[_0x3f2d('0x8')](),controller[_0x3f2d('0x10')]);module[_0x3f2d('0x11')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index a1f763a..d62fcda 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 _0x36db=['variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x1a2f9c,_0x2050b0){var _0x516b82=function(_0x48b0fa){while(--_0x48b0fa){_0x1a2f9c['push'](_0x1a2f9c['shift']());}};_0x516b82(++_0x2050b0);}(_0x36db,0x80));var _0xb36d=function(_0x511598,_0x50cf30){_0x511598=_0x511598-0x0;var _0x505848=_0x36db[_0x511598];return _0x505848;};'use strict';var Sequelize=require('sequelize');module[_0xb36d('0x0')]={'type':{'type':Sequelize[_0xb36d('0x1')](_0xb36d('0x2'),'variable',_0xb36d('0x3'),_0xb36d('0x4'),_0xb36d('0x5')),'defaultValue':_0xb36d('0x2')},'content':{'type':Sequelize[_0xb36d('0x6')]},'key':{'type':Sequelize[_0xb36d('0x6')]},'keyType':{'type':Sequelize[_0xb36d('0x1')](_0xb36d('0x2'),_0xb36d('0x7'),_0xb36d('0x3'))},'keyContent':{'type':Sequelize[_0xb36d('0x6')]},'idField':{'type':Sequelize[_0xb36d('0x6')]},'nameField':{'type':Sequelize[_0xb36d('0x6')]},'customField':{'type':Sequelize[_0xb36d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb36d('0x6')]}}; \ No newline at end of file +var _0xbb6a=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x1c7137,_0x4c7c26){var _0xeb4432=function(_0x26d850){while(--_0x26d850){_0x1c7137['push'](_0x1c7137['shift']());}};_0xeb4432(++_0x4c7c26);}(_0xbb6a,0xad));var _0xabb6=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0xbb6a[_0x274638];return _0x5755df;};'use strict';var Sequelize=require(_0xabb6('0x0'));module[_0xabb6('0x1')]={'type':{'type':Sequelize[_0xabb6('0x2')](_0xabb6('0x3'),_0xabb6('0x4'),_0xabb6('0x5'),'keyValue',_0xabb6('0x6')),'defaultValue':_0xabb6('0x3')},'content':{'type':Sequelize[_0xabb6('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xabb6('0x2')](_0xabb6('0x3'),_0xabb6('0x4'),_0xabb6('0x5'))},'keyContent':{'type':Sequelize[_0xabb6('0x7')]},'idField':{'type':Sequelize[_0xabb6('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 23d9606..2f238b8 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 _0x87b1=['VIRTUAL','options','ZendeskField','includeAll','include','rows','catch','show','params','find','create','body','eml-format','zip-dir','fast-json-patch','mustache','util','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','error','name','send','index','fieldName','key','model','map','keys','query','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type'];(function(_0x14c152,_0x1e2e14){var _0x165139=function(_0x26f509){while(--_0x26f509){_0x14c152['push'](_0x14c152['shift']());}};_0x165139(++_0x1e2e14);}(_0x87b1,0x160));var _0x187b=function(_0x4dbad7,_0x961864){_0x4dbad7=_0x4dbad7-0x0;var _0x1a08d8=_0x87b1[_0x4dbad7];return _0x1a08d8;};'use strict';var emlformat=require(_0x187b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x187b('0x1'));var jsonpatch=require(_0x187b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x187b('0x3'));var util=require(_0x187b('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x187b('0x5'));var ejs=require(_0x187b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x187b('0x7'));var squel=require(_0x187b('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x187b('0x9'));var toCsv=require(_0x187b('0x5'));var querystring=require('querystring');var Papa=require(_0x187b('0xa'));var Redis=require(_0x187b('0xb'));var authService=require(_0x187b('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x187b('0xd'));var hardwareService=require(_0x187b('0xe'));var logger=require(_0x187b('0xf'))('api');var utils=require(_0x187b('0x10'));var config=require(_0x187b('0x11'));var licenseUtil=require(_0x187b('0x12'));var db=require(_0x187b('0x13'))['db'];function respondWithStatusCode(_0x3b3bc9,_0x1193f9){_0x1193f9=_0x1193f9||0xcc;return function(_0x9f5b3){if(_0x9f5b3){return _0x3b3bc9['sendStatus'](_0x1193f9);}return _0x3b3bc9[_0x187b('0x14')](_0x1193f9)[_0x187b('0x15')]();};}function respondWithResult(_0x50ebfd,_0x4a9b64){_0x4a9b64=_0x4a9b64||0xc8;return function(_0x87f792){if(_0x87f792){return _0x50ebfd[_0x187b('0x14')](_0x4a9b64)[_0x187b('0x16')](_0x87f792);}};}function respondWithFilteredResult(_0x536502,_0xe706a2){return function(_0x56c1c3){if(_0x56c1c3){var _0x3c0195=typeof _0xe706a2[_0x187b('0x17')]===_0x187b('0x18')&&typeof _0xe706a2[_0x187b('0x19')]===_0x187b('0x18');var _0x3ba6b3=_0x56c1c3[_0x187b('0x1a')];var _0x5d9aa8=_0x3c0195?0x0:_0xe706a2[_0x187b('0x17')];var _0x3a3c8c=_0x3c0195?_0x56c1c3['count']:_0xe706a2['offset']+_0xe706a2[_0x187b('0x19')];var _0x20af18;if(_0x3a3c8c>=_0x3ba6b3){_0x3a3c8c=_0x3ba6b3;_0x20af18=0xc8;}else{_0x20af18=0xce;}_0x536502[_0x187b('0x14')](_0x20af18);return _0x536502[_0x187b('0x1b')]('Content-Range',_0x5d9aa8+'-'+_0x3a3c8c+'/'+_0x3ba6b3)[_0x187b('0x16')](_0x56c1c3);}return null;};}function patchUpdates(_0x221f13){return function(_0x5eb1d4){try{jsonpatch[_0x187b('0x1c')](_0x5eb1d4,_0x221f13,!![]);}catch(_0x29de92){return BPromise['reject'](_0x29de92);}return _0x5eb1d4[_0x187b('0x1d')]();};}function saveUpdates(_0xf7b199,_0x332512){return function(_0x3b1f2d){if(_0x3b1f2d){return _0x3b1f2d[_0x187b('0x1e')](_0xf7b199)['then'](function(_0x4e757e){return _0x4e757e;});}return null;};}function removeEntity(_0x50f2bc,_0x43beff){return function(_0x3420ae){if(_0x3420ae){return _0x3420ae[_0x187b('0x1f')]()[_0x187b('0x20')](function(){_0x50f2bc[_0x187b('0x14')](0xcc)[_0x187b('0x15')]();});}};}function handleEntityNotFound(_0x3d4f02,_0x1bf33c){return function(_0x5cf4f0){if(!_0x5cf4f0){_0x3d4f02[_0x187b('0x21')](0x194);}return _0x5cf4f0;};}function handleError(_0x134014,_0x689efa){_0x689efa=_0x689efa||0x1f4;return function(_0x18e934){logger[_0x187b('0x22')](_0x18e934['stack']);if(_0x18e934[_0x187b('0x23')]){delete _0x18e934[_0x187b('0x23')];}_0x134014[_0x187b('0x14')](_0x689efa)[_0x187b('0x24')](_0x18e934);};}exports[_0x187b('0x25')]=function(_0x44a3df,_0x6747fd){var _0x337b5d={},_0x188020={},_0x43f942={'count':0x0,'rows':[]};var _0x19462b=_['map'](db['ZendeskField']['rawAttributes'],function(_0x3fec49){return{'name':_0x3fec49[_0x187b('0x26')],'type':_0x3fec49['type'][_0x187b('0x27')]};});_0x188020[_0x187b('0x28')]=_[_0x187b('0x29')](_0x19462b,_0x187b('0x23'));_0x188020['query']=_[_0x187b('0x2a')](_0x44a3df[_0x187b('0x2b')]);_0x188020['filters']=_[_0x187b('0x2c')](_0x188020[_0x187b('0x28')],_0x188020['query']);_0x337b5d[_0x187b('0x2d')]=_['intersection'](_0x188020['model'],qs[_0x187b('0x2e')](_0x44a3df[_0x187b('0x2b')][_0x187b('0x2e')]));_0x337b5d[_0x187b('0x2d')]=_0x337b5d[_0x187b('0x2d')][_0x187b('0x2f')]?_0x337b5d[_0x187b('0x2d')]:_0x188020[_0x187b('0x28')];if(!_0x44a3df[_0x187b('0x2b')]['hasOwnProperty']('nolimit')){_0x337b5d['limit']=qs[_0x187b('0x19')](_0x44a3df[_0x187b('0x2b')]['limit']);_0x337b5d[_0x187b('0x17')]=qs['offset'](_0x44a3df[_0x187b('0x2b')][_0x187b('0x17')]);}_0x337b5d[_0x187b('0x30')]=qs[_0x187b('0x31')](_0x44a3df[_0x187b('0x2b')][_0x187b('0x31')]);_0x337b5d['where']=qs[_0x187b('0x32')](_[_0x187b('0x33')](_0x44a3df[_0x187b('0x2b')],_0x188020[_0x187b('0x32')]),_0x19462b);if(_0x44a3df['query'][_0x187b('0x34')]){_0x337b5d[_0x187b('0x35')]=_[_0x187b('0x36')](_0x337b5d[_0x187b('0x35')],{'$or':_[_0x187b('0x29')](_0x19462b,function(_0x5d05e7){if(_0x5d05e7[_0x187b('0x37')]!==_0x187b('0x38')){var _0x7dae61={};_0x7dae61[_0x5d05e7['name']]={'$like':'%'+_0x44a3df[_0x187b('0x2b')]['filter']+'%'};return _0x7dae61;}})});}_0x337b5d=_[_0x187b('0x36')]({},_0x337b5d,_0x44a3df[_0x187b('0x39')]);var _0x4279d2={'where':_0x337b5d['where']};return db[_0x187b('0x3a')]['count'](_0x4279d2)[_0x187b('0x20')](function(_0x409b00){_0x43f942[_0x187b('0x1a')]=_0x409b00;if(_0x44a3df['query'][_0x187b('0x3b')]){_0x337b5d[_0x187b('0x3c')]=[{'all':!![]}];}return db['ZendeskField']['findAll'](_0x337b5d);})[_0x187b('0x20')](function(_0x5b58e6){_0x43f942[_0x187b('0x3d')]=_0x5b58e6;return _0x43f942;})[_0x187b('0x20')](respondWithFilteredResult(_0x6747fd,_0x337b5d))[_0x187b('0x3e')](handleError(_0x6747fd,null));};exports[_0x187b('0x3f')]=function(_0x4516c3,_0x4d8c1f){var _0x2cd51e={'raw':!![],'where':{'id':_0x4516c3[_0x187b('0x40')]['id']}},_0x9c313e={};_0x9c313e[_0x187b('0x28')]=_[_0x187b('0x2a')](db[_0x187b('0x3a')]['rawAttributes']);_0x9c313e[_0x187b('0x2b')]=_['keys'](_0x4516c3[_0x187b('0x2b')]);_0x9c313e[_0x187b('0x32')]=_['intersection'](_0x9c313e['model'],_0x9c313e[_0x187b('0x2b')]);_0x2cd51e[_0x187b('0x2d')]=_[_0x187b('0x2c')](_0x9c313e['model'],qs[_0x187b('0x2e')](_0x4516c3['query'][_0x187b('0x2e')]));_0x2cd51e[_0x187b('0x2d')]=_0x2cd51e['attributes'][_0x187b('0x2f')]?_0x2cd51e[_0x187b('0x2d')]:_0x9c313e[_0x187b('0x28')];if(_0x4516c3['query'][_0x187b('0x3b')]){_0x2cd51e['include']=[{'all':!![]}];}_0x2cd51e=_[_0x187b('0x36')]({},_0x2cd51e,_0x4516c3['options']);return db['ZendeskField'][_0x187b('0x41')](_0x2cd51e)[_0x187b('0x20')](handleEntityNotFound(_0x4d8c1f,null))[_0x187b('0x20')](respondWithResult(_0x4d8c1f,null))['catch'](handleError(_0x4d8c1f,null));};exports['create']=function(_0x17e3e1,_0x12fddc){return db[_0x187b('0x3a')][_0x187b('0x42')](_0x17e3e1[_0x187b('0x43')],{})['then'](respondWithResult(_0x12fddc,0xc9))[_0x187b('0x3e')](handleError(_0x12fddc,null));};exports[_0x187b('0x1e')]=function(_0x486194,_0x4f7e6e){if(_0x486194[_0x187b('0x43')]['id']){delete _0x486194['body']['id'];}return db[_0x187b('0x3a')]['find']({'where':{'id':_0x486194[_0x187b('0x40')]['id']}})[_0x187b('0x20')](handleEntityNotFound(_0x4f7e6e,null))['then'](saveUpdates(_0x486194[_0x187b('0x43')],null))[_0x187b('0x20')](respondWithResult(_0x4f7e6e,null))[_0x187b('0x3e')](handleError(_0x4f7e6e,null));};exports['destroy']=function(_0xaef75,_0x2f84c0){return db['ZendeskField'][_0x187b('0x41')]({'where':{'id':_0xaef75['params']['id']}})[_0x187b('0x20')](handleEntityNotFound(_0x2f84c0,null))[_0x187b('0x20')](removeEntity(_0x2f84c0,null))[_0x187b('0x3e')](handleError(_0x2f84c0,null));}; \ No newline at end of file +var _0xbd3a=['mustache','util','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','update','then','destroy','stack','name','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','hasOwnProperty','order','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','show','length','includeAll','options','find','create','body','params','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x5d843c,_0x5cd191){var _0x16244c=function(_0x764908){while(--_0x764908){_0x5d843c['push'](_0x5d843c['shift']());}};_0x16244c(++_0x5cd191);}(_0xbd3a,0x1e5));var _0xabd3=function(_0x252c0a,_0x52dc81){_0x252c0a=_0x252c0a-0x0;var _0x94c307=_0xbd3a[_0x252c0a];return _0x94c307;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xabd3('0x0'));var zipdir=require(_0xabd3('0x1'));var jsonpatch=require(_0xabd3('0x2'));var rp=require('request-promise');var moment=require(_0xabd3('0x3'));var BPromise=require(_0xabd3('0x4'));var Mustache=require(_0xabd3('0x5'));var util=require(_0xabd3('0x6'));var path=require(_0xabd3('0x7'));var sox=require(_0xabd3('0x8'));var csv=require(_0xabd3('0x9'));var ejs=require(_0xabd3('0xa'));var fs=require('fs');var fs_extra=require(_0xabd3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xabd3('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabd3('0xd'));var Papa=require('papaparse');var Redis=require(_0xabd3('0xe'));var authService=require(_0xabd3('0xf'));var qs=require(_0xabd3('0x10'));var as=require(_0xabd3('0x11'));var hardwareService=require(_0xabd3('0x12'));var logger=require('../../config/logger')(_0xabd3('0x13'));var utils=require(_0xabd3('0x14'));var config=require(_0xabd3('0x15'));var licenseUtil=require(_0xabd3('0x16'));var db=require(_0xabd3('0x17'))['db'];function respondWithStatusCode(_0x2d3a5b,_0xae12cb){_0xae12cb=_0xae12cb||0xcc;return function(_0x3f3498){if(_0x3f3498){return _0x2d3a5b[_0xabd3('0x18')](_0xae12cb);}return _0x2d3a5b[_0xabd3('0x19')](_0xae12cb)[_0xabd3('0x1a')]();};}function respondWithResult(_0x4c5630,_0x5abcab){_0x5abcab=_0x5abcab||0xc8;return function(_0x5494b2){if(_0x5494b2){return _0x4c5630[_0xabd3('0x19')](_0x5abcab)[_0xabd3('0x1b')](_0x5494b2);}};}function respondWithFilteredResult(_0x830433,_0x1deb4d){return function(_0x1ad1fb){if(_0x1ad1fb){var _0x46b3f8=typeof _0x1deb4d[_0xabd3('0x1c')]===_0xabd3('0x1d')&&typeof _0x1deb4d[_0xabd3('0x1e')]===_0xabd3('0x1d');var _0x45ace5=_0x1ad1fb['count'];var _0x37ce53=_0x46b3f8?0x0:_0x1deb4d[_0xabd3('0x1c')];var _0x156543=_0x46b3f8?_0x1ad1fb['count']:_0x1deb4d[_0xabd3('0x1c')]+_0x1deb4d[_0xabd3('0x1e')];var _0x5ed0ce;if(_0x156543>=_0x45ace5){_0x156543=_0x45ace5;_0x5ed0ce=0xc8;}else{_0x5ed0ce=0xce;}_0x830433[_0xabd3('0x19')](_0x5ed0ce);return _0x830433['set'](_0xabd3('0x1f'),_0x37ce53+'-'+_0x156543+'/'+_0x45ace5)[_0xabd3('0x1b')](_0x1ad1fb);}return null;};}function patchUpdates(_0x55fb89){return function(_0x4efc20){try{jsonpatch[_0xabd3('0x20')](_0x4efc20,_0x55fb89,!![]);}catch(_0xd2665e){return BPromise[_0xabd3('0x21')](_0xd2665e);}return _0x4efc20['save']();};}function saveUpdates(_0x536a48,_0xaac3f8){return function(_0x53d55e){if(_0x53d55e){return _0x53d55e[_0xabd3('0x22')](_0x536a48)[_0xabd3('0x23')](function(_0xcbcd32){return _0xcbcd32;});}return null;};}function removeEntity(_0x2ea7eb,_0x23b795){return function(_0xd6268f){if(_0xd6268f){return _0xd6268f[_0xabd3('0x24')]()[_0xabd3('0x23')](function(){_0x2ea7eb[_0xabd3('0x19')](0xcc)[_0xabd3('0x1a')]();});}};}function handleEntityNotFound(_0xbfb70e,_0x36c27e){return function(_0x294a05){if(!_0x294a05){_0xbfb70e[_0xabd3('0x18')](0x194);}return _0x294a05;};}function handleError(_0x56bcd6,_0x2e3d0a){_0x2e3d0a=_0x2e3d0a||0x1f4;return function(_0x37bf57){logger['error'](_0x37bf57[_0xabd3('0x25')]);if(_0x37bf57[_0xabd3('0x26')]){delete _0x37bf57[_0xabd3('0x26')];}_0x56bcd6[_0xabd3('0x19')](_0x2e3d0a)['send'](_0x37bf57);};}exports['index']=function(_0x4ca3db,_0x4cfeb5){var _0x5b260a={},_0x1e79bb={},_0x228d57={'count':0x0,'rows':[]};var _0x22a7ad=_[_0xabd3('0x27')](db[_0xabd3('0x28')][_0xabd3('0x29')],function(_0xa55777){return{'name':_0xa55777[_0xabd3('0x2a')],'type':_0xa55777['type'][_0xabd3('0x2b')]};});_0x1e79bb['model']=_[_0xabd3('0x27')](_0x22a7ad,_0xabd3('0x26'));_0x1e79bb[_0xabd3('0x2c')]=_[_0xabd3('0x2d')](_0x4ca3db[_0xabd3('0x2c')]);_0x1e79bb[_0xabd3('0x2e')]=_['intersection'](_0x1e79bb['model'],_0x1e79bb['query']);_0x5b260a[_0xabd3('0x2f')]=_[_0xabd3('0x30')](_0x1e79bb[_0xabd3('0x31')],qs[_0xabd3('0x32')](_0x4ca3db[_0xabd3('0x2c')][_0xabd3('0x32')]));_0x5b260a['attributes']=_0x5b260a['attributes']['length']?_0x5b260a[_0xabd3('0x2f')]:_0x1e79bb[_0xabd3('0x31')];if(!_0x4ca3db[_0xabd3('0x2c')][_0xabd3('0x33')]('nolimit')){_0x5b260a[_0xabd3('0x1e')]=qs['limit'](_0x4ca3db['query'][_0xabd3('0x1e')]);_0x5b260a['offset']=qs['offset'](_0x4ca3db[_0xabd3('0x2c')][_0xabd3('0x1c')]);}_0x5b260a[_0xabd3('0x34')]=qs['sort'](_0x4ca3db[_0xabd3('0x2c')]['sort']);_0x5b260a[_0xabd3('0x35')]=qs['filters'](_['pick'](_0x4ca3db['query'],_0x1e79bb[_0xabd3('0x2e')]),_0x22a7ad);if(_0x4ca3db[_0xabd3('0x2c')][_0xabd3('0x36')]){_0x5b260a[_0xabd3('0x35')]=_[_0xabd3('0x37')](_0x5b260a['where'],{'$or':_[_0xabd3('0x27')](_0x22a7ad,function(_0x114fb2){if(_0x114fb2[_0xabd3('0x38')]!==_0xabd3('0x39')){var _0x53cdc5={};_0x53cdc5[_0x114fb2[_0xabd3('0x26')]]={'$like':'%'+_0x4ca3db[_0xabd3('0x2c')][_0xabd3('0x36')]+'%'};return _0x53cdc5;}})});}_0x5b260a=_[_0xabd3('0x37')]({},_0x5b260a,_0x4ca3db['options']);var _0x514c13={'where':_0x5b260a[_0xabd3('0x35')]};return db['ZendeskField']['count'](_0x514c13)[_0xabd3('0x23')](function(_0x4aeda1){_0x228d57['count']=_0x4aeda1;if(_0x4ca3db[_0xabd3('0x2c')]['includeAll']){_0x5b260a[_0xabd3('0x3a')]=[{'all':!![]}];}return db[_0xabd3('0x28')][_0xabd3('0x3b')](_0x5b260a);})[_0xabd3('0x23')](function(_0x42c6b6){_0x228d57[_0xabd3('0x3c')]=_0x42c6b6;return _0x228d57;})[_0xabd3('0x23')](respondWithFilteredResult(_0x4cfeb5,_0x5b260a))[_0xabd3('0x3d')](handleError(_0x4cfeb5,null));};exports[_0xabd3('0x3e')]=function(_0x96bf9d,_0x321a6f){var _0x24faa9={'raw':!![],'where':{'id':_0x96bf9d['params']['id']}},_0x188eb4={};_0x188eb4[_0xabd3('0x31')]=_[_0xabd3('0x2d')](db['ZendeskField'][_0xabd3('0x29')]);_0x188eb4['query']=_[_0xabd3('0x2d')](_0x96bf9d[_0xabd3('0x2c')]);_0x188eb4[_0xabd3('0x2e')]=_[_0xabd3('0x30')](_0x188eb4['model'],_0x188eb4['query']);_0x24faa9[_0xabd3('0x2f')]=_[_0xabd3('0x30')](_0x188eb4[_0xabd3('0x31')],qs['fields'](_0x96bf9d['query'][_0xabd3('0x32')]));_0x24faa9['attributes']=_0x24faa9[_0xabd3('0x2f')][_0xabd3('0x3f')]?_0x24faa9[_0xabd3('0x2f')]:_0x188eb4['model'];if(_0x96bf9d[_0xabd3('0x2c')][_0xabd3('0x40')]){_0x24faa9[_0xabd3('0x3a')]=[{'all':!![]}];}_0x24faa9=_[_0xabd3('0x37')]({},_0x24faa9,_0x96bf9d[_0xabd3('0x41')]);return db[_0xabd3('0x28')][_0xabd3('0x42')](_0x24faa9)[_0xabd3('0x23')](handleEntityNotFound(_0x321a6f,null))[_0xabd3('0x23')](respondWithResult(_0x321a6f,null))['catch'](handleError(_0x321a6f,null));};exports[_0xabd3('0x43')]=function(_0x4f6e21,_0x3d873c){return db[_0xabd3('0x28')][_0xabd3('0x43')](_0x4f6e21[_0xabd3('0x44')],{})[_0xabd3('0x23')](respondWithResult(_0x3d873c,0xc9))['catch'](handleError(_0x3d873c,null));};exports[_0xabd3('0x22')]=function(_0x5bf62d,_0x3661a6){if(_0x5bf62d['body']['id']){delete _0x5bf62d[_0xabd3('0x44')]['id'];}return db['ZendeskField'][_0xabd3('0x42')]({'where':{'id':_0x5bf62d[_0xabd3('0x45')]['id']}})['then'](handleEntityNotFound(_0x3661a6,null))['then'](saveUpdates(_0x5bf62d[_0xabd3('0x44')],null))[_0xabd3('0x23')](respondWithResult(_0x3661a6,null))[_0xabd3('0x3d')](handleError(_0x3661a6,null));};exports[_0xabd3('0x24')]=function(_0x43276e,_0x1ed073){return db[_0xabd3('0x28')][_0xabd3('0x42')]({'where':{'id':_0x43276e['params']['id']}})[_0xabd3('0x23')](handleEntityNotFound(_0x1ed073,null))[_0xabd3('0x23')](removeEntity(_0x1ed073,null))[_0xabd3('0x3d')](handleError(_0x1ed073,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 5c2196a..f706d62 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 _0x893b=['./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2acc54,_0x4e1290){var _0x2beeb8=function(_0x31f84a){while(--_0x31f84a){_0x2acc54['push'](_0x2acc54['shift']());}};_0x2beeb8(++_0x4e1290);}(_0x893b,0x18e));var _0xb893=function(_0x2c77e5,_0x2beedc){_0x2c77e5=_0x2c77e5-0x0;var _0x3cceb8=_0x893b[_0x2c77e5];return _0x3cceb8;};'use strict';var _=require(_0xb893('0x0'));var util=require(_0xb893('0x1'));var logger=require(_0xb893('0x2'))('api');var moment=require(_0xb893('0x3'));var BPromise=require(_0xb893('0x4'));var rp=require(_0xb893('0x5'));var fs=require('fs');var path=require(_0xb893('0x6'));var rimraf=require('rimraf');var config=require(_0xb893('0x7'));var attributes=require(_0xb893('0x8'));module[_0xb893('0x9')]=function(_0x42b54c,_0x41743c){return _0x42b54c['define'](_0xb893('0xa'),attributes,{'tableName':_0xb893('0xb'),'paranoid':![],'indexes':[{'name':_0xb893('0xc'),'fields':['idField',_0xb893('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6d92=['int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZendeskField.attributes','define','ZendeskField'];(function(_0x5305e4,_0x4c9244){var _0x55c74e=function(_0x308dd0){while(--_0x308dd0){_0x5305e4['push'](_0x5305e4['shift']());}};_0x55c74e(++_0x4c9244);}(_0x6d92,0x199));var _0x26d9=function(_0x503870,_0x21feb4){_0x503870=_0x503870-0x0;var _0x3cff2d=_0x6d92[_0x503870];return _0x3cff2d;};'use strict';var _=require(_0x26d9('0x0'));var util=require(_0x26d9('0x1'));var logger=require(_0x26d9('0x2'))(_0x26d9('0x3'));var moment=require(_0x26d9('0x4'));var BPromise=require(_0x26d9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26d9('0x6'));var rimraf=require('rimraf');var config=require(_0x26d9('0x7'));var attributes=require(_0x26d9('0x8'));module['exports']=function(_0xd7721,_0x1f764f){return _0xd7721[_0x26d9('0x9')](_0x26d9('0xa'),attributes,{'tableName':_0x26d9('0xb'),'paranoid':![],'indexes':[{'name':_0x26d9('0xc'),'fields':['idField',_0x26d9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.rpc.js b/server/api/intZendeskField/intZendeskField.rpc.js index 8e97cdb..cde3801 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 _0x846f=['client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x221623,_0x14ace5){var _0x5e362c=function(_0x2aa81c){while(--_0x2aa81c){_0x221623['push'](_0x221623['shift']());}};_0x5e362c(++_0x14ace5);}(_0x846f,0x19c));var _0xf846=function(_0x6d8936,_0x39d770){_0x6d8936=_0x6d8936-0x0;var _0x41a0ed=_0x846f[_0x6d8936];return _0x41a0ed;};'use strict';var _=require(_0xf846('0x0'));var util=require('util');var moment=require(_0xf846('0x1'));var BPromise=require(_0xf846('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf846('0x3'))['db'];var utils=require(_0xf846('0x4'));var logger=require('../../config/logger')(_0xf846('0x5'));var config=require(_0xf846('0x6'));var jayson=require(_0xf846('0x7'));var client=jayson[_0xf846('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114f36,_0x67409f,_0x51300e){return new BPromise(function(_0x2112d9,_0x4d264d){return client['request'](_0x114f36,_0x51300e)[_0xf846('0x9')](function(_0x56d9fc){logger[_0xf846('0xa')](_0xf846('0xb'),_0x67409f,_0xf846('0xc'));logger[_0xf846('0xd')](_0xf846('0xe'),_0x67409f,'request\x20sent',JSON[_0xf846('0xf')](_0x56d9fc));if(_0x56d9fc[_0xf846('0x10')]){if(_0x56d9fc['error'][_0xf846('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x67409f,_0x56d9fc['error'][_0xf846('0x12')]);return _0x4d264d(_0x56d9fc['error']['message']);}logger['error'](_0xf846('0xb'),_0x67409f,_0x56d9fc['error'][_0xf846('0x12')]);return _0x2112d9(_0x56d9fc[_0xf846('0x10')][_0xf846('0x12')]);}else{logger[_0xf846('0xa')](_0xf846('0xb'),_0x67409f,_0xf846('0xc'));_0x2112d9(_0x56d9fc['result'][_0xf846('0x12')]);}})[_0xf846('0x13')](function(_0x19a466){logger['error'](_0xf846('0xb'),_0x67409f,_0x19a466);_0x4d264d(_0x19a466);});});} \ No newline at end of file +var _0x054b=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb'];(function(_0x47e769,_0x427fa5){var _0x2a7bb0=function(_0x217706){while(--_0x217706){_0x47e769['push'](_0x47e769['shift']());}};_0x2a7bb0(++_0x427fa5);}(_0x054b,0x193));var _0xb054=function(_0x4af76e,_0x51f164){_0x4af76e=_0x4af76e-0x0;var _0xe89082=_0x054b[_0x4af76e];return _0xe89082;};'use strict';var _=require(_0xb054('0x0'));var util=require(_0xb054('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb054('0x2'));var fs=require('fs');var Redis=require(_0xb054('0x3'));var db=require(_0xb054('0x4'))['db'];var utils=require(_0xb054('0x5'));var logger=require(_0xb054('0x6'))(_0xb054('0x7'));var config=require('../../config/environment');var jayson=require(_0xb054('0x8'));var client=jayson[_0xb054('0x9')][_0xb054('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5f1f39,_0x32c9fa,_0x232302){return new BPromise(function(_0x5857e7,_0x2a9607){return client[_0xb054('0xb')](_0x5f1f39,_0x232302)[_0xb054('0xc')](function(_0x1c3b58){logger[_0xb054('0xd')](_0xb054('0xe'),_0x32c9fa,_0xb054('0xf'));logger[_0xb054('0x10')](_0xb054('0x11'),_0x32c9fa,_0xb054('0xf'),JSON[_0xb054('0x12')](_0x1c3b58));if(_0x1c3b58['error']){if(_0x1c3b58[_0xb054('0x13')][_0xb054('0x14')]===0x1f4){logger[_0xb054('0x13')](_0xb054('0xe'),_0x32c9fa,_0x1c3b58[_0xb054('0x13')]['message']);return _0x2a9607(_0x1c3b58[_0xb054('0x13')][_0xb054('0x15')]);}logger[_0xb054('0x13')](_0xb054('0xe'),_0x32c9fa,_0x1c3b58['error'][_0xb054('0x15')]);return _0x5857e7(_0x1c3b58['error'][_0xb054('0x15')]);}else{logger[_0xb054('0xd')](_0xb054('0xe'),_0x32c9fa,_0xb054('0xf'));_0x5857e7(_0x1c3b58[_0xb054('0x16')][_0xb054('0x15')]);}})[_0xb054('0x17')](function(_0x26ee5a){logger[_0xb054('0x13')](_0xb054('0xe'),_0x32c9fa,_0x26ee5a);_0x2a9607(_0x26ee5a);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 6e27cc5..7395a0c 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 _0x420f=['delete','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','isAuthenticated','show','get','/:id/configurations','getConfigurations','getFields','create','post','addConfiguration','put','/:id','update'];(function(_0x5f49a2,_0x54b7ed){var _0x2e49ac=function(_0x5d3c59){while(--_0x5d3c59){_0x5f49a2['push'](_0x5f49a2['shift']());}};_0x2e49ac(++_0x54b7ed);}(_0x420f,0x1ce));var _0xf420=function(_0x467861,_0x3bdb59){_0x467861=_0x467861-0x0;var _0x302991=_0x420f[_0x467861];return _0x302991;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf420('0x0'));var timeout=require(_0xf420('0x1'));var express=require(_0xf420('0x2'));var router=express[_0xf420('0x3')]();var fs_extra=require(_0xf420('0x4'));var auth=require(_0xf420('0x5'));var interaction=require(_0xf420('0x6'));var config=require(_0xf420('0x7'));var controller=require(_0xf420('0x8'));router['get']('/',auth[_0xf420('0x9')](),controller['index']);router['get']('/:id',auth[_0xf420('0x9')](),controller[_0xf420('0xa')]);router[_0xf420('0xb')](_0xf420('0xc'),auth[_0xf420('0x9')](),controller[_0xf420('0xd')]);router['get']('/:id/fields',auth[_0xf420('0x9')](),controller[_0xf420('0xe')]);router['post']('/',auth[_0xf420('0x9')](),controller[_0xf420('0xf')]);router[_0xf420('0x10')](_0xf420('0xc'),auth[_0xf420('0x9')](),controller[_0xf420('0x11')]);router[_0xf420('0x12')](_0xf420('0x13'),auth[_0xf420('0x9')](),controller[_0xf420('0x14')]);router[_0xf420('0x15')](_0xf420('0x13'),auth[_0xf420('0x9')](),controller['destroy']);module[_0xf420('0x16')]=router; \ No newline at end of file +var _0xaa5a=['getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations'];(function(_0x4eee8a,_0x2c5b23){var _0x26137b=function(_0x4c4e9a){while(--_0x4c4e9a){_0x4eee8a['push'](_0x4eee8a['shift']());}};_0x26137b(++_0x2c5b23);}(_0xaa5a,0xb9));var _0xaaa5=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xaa5a[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var path=require(_0xaaa5('0x2'));var timeout=require(_0xaaa5('0x3'));var express=require('express');var router=express[_0xaaa5('0x4')]();var fs_extra=require(_0xaaa5('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaaa5('0x6'));var config=require(_0xaaa5('0x7'));var controller=require(_0xaaa5('0x8'));router[_0xaaa5('0x9')]('/',auth[_0xaaa5('0xa')](),controller[_0xaaa5('0xb')]);router['get'](_0xaaa5('0xc'),auth[_0xaaa5('0xa')](),controller[_0xaaa5('0xd')]);router[_0xaaa5('0x9')](_0xaaa5('0xe'),auth[_0xaaa5('0xa')](),controller[_0xaaa5('0xf')]);router['get'](_0xaaa5('0x10'),auth['isAuthenticated'](),controller[_0xaaa5('0x11')]);router[_0xaaa5('0x12')]('/',auth['isAuthenticated'](),controller[_0xaaa5('0x13')]);router['post'](_0xaaa5('0xe'),auth[_0xaaa5('0xa')](),controller['addConfiguration']);router[_0xaaa5('0x14')](_0xaaa5('0xc'),auth[_0xaaa5('0xa')](),controller[_0xaaa5('0x15')]);router[_0xaaa5('0x16')](_0xaaa5('0xc'),auth[_0xaaa5('0xa')](),controller[_0xaaa5('0x17')]);module[_0xaaa5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index f46e9d2..5c607ff 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 _0x9f62=['exports','STRING'];(function(_0x29279d,_0x406156){var _0x42f8e8=function(_0xac85ec){while(--_0xac85ec){_0x29279d['push'](_0x29279d['shift']());}};_0x42f8e8(++_0x406156);}(_0x9f62,0x154));var _0x29f6=function(_0x121049,_0x1ea9d2){_0x121049=_0x121049-0x0;var _0x1f24fb=_0x9f62[_0x121049];return _0x1f24fb;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file +var _0x22fb=['STRING'];(function(_0x5dbc3a,_0x474969){var _0x5acec9=function(_0x3f301e){while(--_0x3f301e){_0x5dbc3a['push'](_0x5dbc3a['shift']());}};_0x5acec9(++_0x474969);}(_0x22fb,0x192));var _0xb22f=function(_0x433489,_0x53e26c){_0x433489=_0x433489-0x0;var _0xbb5100=_0x22fb[_0x433489];return _0xbb5100;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb22f('0x0')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb22f('0x0')]},'zone':{'type':Sequelize[_0xb22f('0x0')]},'clientId':{'type':Sequelize[_0xb22f('0x0')]},'clientSecret':{'type':Sequelize[_0xb22f('0x0')]},'serverUrl':{'type':Sequelize[_0xb22f('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0xb22f('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 1d7a00f..e1536e0 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 _0xa82b=['statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','ZohoAccount','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','nolimit','sort','where','merge','type','VIRTUAL','options','includeAll','catch','params','length','include','find','create','body','getConfigurations','ZohoConfiguration','pick','filter','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','Subjects','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','getFields','findOne','host','clientId','code','zoho.eu','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','includes','api_name','system_mandatory','display_label','custom_field','data_type','picklist'];(function(_0x38fbc2,_0x641aa1){var _0x43c7d4=function(_0x45d3b9){while(--_0x45d3b9){_0x38fbc2['push'](_0x38fbc2['shift']());}};_0x43c7d4(++_0x641aa1);}(_0xa82b,0x86));var _0xba82=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0xa82b[_0xc1263e];return _0x471f07;};'use strict';var emlformat=require(_0xba82('0x0'));var rimraf=require(_0xba82('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xba82('0x2'));var rp=require(_0xba82('0x3'));var moment=require(_0xba82('0x4'));var BPromise=require(_0xba82('0x5'));var Mustache=require(_0xba82('0x6'));var util=require(_0xba82('0x7'));var path=require(_0xba82('0x8'));var sox=require(_0xba82('0x9'));var csv=require('to-csv');var ejs=require(_0xba82('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xba82('0xb'));var jsforce=require(_0xba82('0xc'));var deskjs=require(_0xba82('0xd'));var toCsv=require(_0xba82('0xe'));var querystring=require(_0xba82('0xf'));var Papa=require(_0xba82('0x10'));var Redis=require(_0xba82('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xba82('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba82('0x13'));var logger=require(_0xba82('0x14'))(_0xba82('0x15'));var utils=require(_0xba82('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xba82('0x17'));var db=require(_0xba82('0x18'))['db'];var integrations=require(_0xba82('0x19'));function respondWithStatusCode(_0x2f5637,_0x4b7965){_0x4b7965=_0x4b7965||0xcc;return function(_0xb43288){if(_0xb43288){return _0x2f5637[_0xba82('0x1a')](_0x4b7965);}return _0x2f5637[_0xba82('0x1b')](_0x4b7965)[_0xba82('0x1c')]();};}function respondWithResult(_0x317c42,_0x194a20){_0x194a20=_0x194a20||0xc8;return function(_0x24cb49){if(_0x24cb49){return _0x317c42[_0xba82('0x1b')](_0x194a20)[_0xba82('0x1d')](_0x24cb49);}};}function respondWithFilteredResult(_0x549717,_0x19b83b){return function(_0x12ada8){if(_0x12ada8){var _0x5437f9=typeof _0x19b83b[_0xba82('0x1e')]===_0xba82('0x1f')&&typeof _0x19b83b['limit']==='undefined';var _0x347c8e=_0x12ada8['count'];var _0x1a458d=_0x5437f9?0x0:_0x19b83b['offset'];var _0x757ff7=_0x5437f9?_0x12ada8[_0xba82('0x20')]:_0x19b83b[_0xba82('0x1e')]+_0x19b83b[_0xba82('0x21')];var _0x31ea0c;if(_0x757ff7>=_0x347c8e){_0x757ff7=_0x347c8e;_0x31ea0c=0xc8;}else{_0x31ea0c=0xce;}_0x549717[_0xba82('0x1b')](_0x31ea0c);return _0x549717[_0xba82('0x22')](_0xba82('0x23'),_0x1a458d+'-'+_0x757ff7+'/'+_0x347c8e)[_0xba82('0x1d')](_0x12ada8);}return null;};}function patchUpdates(_0x54189c){return function(_0x81ac07){try{jsonpatch[_0xba82('0x24')](_0x81ac07,_0x54189c,!![]);}catch(_0x1d9520){return BPromise[_0xba82('0x25')](_0x1d9520);}return _0x81ac07[_0xba82('0x26')]();};}function saveUpdates(_0x49254b,_0x18583f){return function(_0x5f2de6){if(_0x5f2de6){return _0x5f2de6[_0xba82('0x27')](_0x49254b)['then'](function(_0x176c9a){return _0x176c9a;});}return null;};}function removeEntity(_0xa1fedb,_0x11f902){return function(_0x3c276e){if(_0x3c276e){return _0x3c276e[_0xba82('0x28')]()[_0xba82('0x29')](function(){_0xa1fedb['status'](0xcc)[_0xba82('0x1c')]();});}};}function handleEntityNotFound(_0xd7c424,_0x41aab5){return function(_0x53951f){if(!_0x53951f){_0xd7c424[_0xba82('0x1a')](0x194);}return _0x53951f;};}function handleError(_0x25c6bc,_0x132956){_0x132956=_0x132956||0x1f4;return function(_0x35969c){logger[_0xba82('0x2a')](_0x35969c[_0xba82('0x2b')]);if(_0x35969c[_0xba82('0x2c')]){delete _0x35969c[_0xba82('0x2c')];}_0x25c6bc['status'](_0x132956)['send'](_0x35969c);};}exports[_0xba82('0x2d')]=function(_0x32fefb,_0x51a909){var _0x2624f5={},_0x2d43dd={},_0x573eda={'count':0x0,'rows':[]};var _0x36f9ad=_['map'](db[_0xba82('0x2e')][_0xba82('0x2f')],function(_0x2e2d48){return{'name':_0x2e2d48[_0xba82('0x30')],'type':_0x2e2d48['type'][_0xba82('0x31')]};});_0x2d43dd['model']=_[_0xba82('0x32')](_0x36f9ad,'name');_0x2d43dd[_0xba82('0x33')]=_[_0xba82('0x34')](_0x32fefb[_0xba82('0x33')]);_0x2d43dd[_0xba82('0x35')]=_[_0xba82('0x36')](_0x2d43dd[_0xba82('0x37')],_0x2d43dd[_0xba82('0x33')]);_0x2624f5[_0xba82('0x38')]=_[_0xba82('0x36')](_0x2d43dd[_0xba82('0x37')],qs[_0xba82('0x39')](_0x32fefb['query'][_0xba82('0x39')]));_0x2624f5[_0xba82('0x38')]=_0x2624f5[_0xba82('0x38')]['length']?_0x2624f5[_0xba82('0x38')]:_0x2d43dd['model'];if(!_0x32fefb[_0xba82('0x33')]['hasOwnProperty'](_0xba82('0x3a'))){_0x2624f5[_0xba82('0x21')]=qs[_0xba82('0x21')](_0x32fefb[_0xba82('0x33')][_0xba82('0x21')]);_0x2624f5['offset']=qs[_0xba82('0x1e')](_0x32fefb[_0xba82('0x33')][_0xba82('0x1e')]);}_0x2624f5['order']=qs[_0xba82('0x3b')](_0x32fefb[_0xba82('0x33')][_0xba82('0x3b')]);_0x2624f5[_0xba82('0x3c')]=qs[_0xba82('0x35')](_['pick'](_0x32fefb['query'],_0x2d43dd[_0xba82('0x35')]),_0x36f9ad);if(_0x32fefb[_0xba82('0x33')]['filter']){_0x2624f5['where']=_[_0xba82('0x3d')](_0x2624f5[_0xba82('0x3c')],{'$or':_[_0xba82('0x32')](_0x36f9ad,function(_0x2ac776){if(_0x2ac776[_0xba82('0x3e')]!==_0xba82('0x3f')){var _0x3a1f50={};_0x3a1f50[_0x2ac776[_0xba82('0x2c')]]={'$like':'%'+_0x32fefb[_0xba82('0x33')]['filter']+'%'};return _0x3a1f50;}})});}_0x2624f5=_[_0xba82('0x3d')]({},_0x2624f5,_0x32fefb[_0xba82('0x40')]);var _0x297934={'where':_0x2624f5[_0xba82('0x3c')]};return db['ZohoAccount'][_0xba82('0x20')](_0x297934)[_0xba82('0x29')](function(_0x54ccaf){_0x573eda[_0xba82('0x20')]=_0x54ccaf;if(_0x32fefb[_0xba82('0x33')][_0xba82('0x41')]){_0x2624f5['include']=[{'all':!![]}];}return db[_0xba82('0x2e')]['findAll'](_0x2624f5);})[_0xba82('0x29')](function(_0x352dba){_0x573eda['rows']=_0x352dba;return _0x573eda;})['then'](respondWithFilteredResult(_0x51a909,_0x2624f5))[_0xba82('0x42')](handleError(_0x51a909,null));};exports['show']=function(_0x3b55e0,_0x37bb9b){var _0x1a1626={'raw':![],'where':{'id':_0x3b55e0[_0xba82('0x43')]['id']}},_0x38eba6={};_0x38eba6[_0xba82('0x37')]=_[_0xba82('0x34')](db['ZohoAccount'][_0xba82('0x2f')]);_0x38eba6['query']=_[_0xba82('0x34')](_0x3b55e0['query']);_0x38eba6[_0xba82('0x35')]=_[_0xba82('0x36')](_0x38eba6['model'],_0x38eba6[_0xba82('0x33')]);_0x1a1626[_0xba82('0x38')]=_[_0xba82('0x36')](_0x38eba6[_0xba82('0x37')],qs[_0xba82('0x39')](_0x3b55e0['query'][_0xba82('0x39')]));_0x1a1626[_0xba82('0x38')]=_0x1a1626[_0xba82('0x38')][_0xba82('0x44')]?_0x1a1626['attributes']:_0x38eba6[_0xba82('0x37')];if(_0x3b55e0[_0xba82('0x33')][_0xba82('0x41')]){_0x1a1626[_0xba82('0x45')]=[{'all':!![]}];}_0x1a1626=_[_0xba82('0x3d')]({},_0x1a1626,_0x3b55e0[_0xba82('0x40')]);return db[_0xba82('0x2e')][_0xba82('0x46')](_0x1a1626)[_0xba82('0x29')](handleEntityNotFound(_0x37bb9b,null))[_0xba82('0x29')](respondWithResult(_0x37bb9b,null))['catch'](handleError(_0x37bb9b,null));};exports[_0xba82('0x47')]=function(_0x3fb8f5,_0x4b5f8c){return db[_0xba82('0x2e')][_0xba82('0x47')](_0x3fb8f5[_0xba82('0x48')],{})[_0xba82('0x29')](respondWithResult(_0x4b5f8c,0xc9))[_0xba82('0x42')](handleError(_0x4b5f8c,null));};exports[_0xba82('0x27')]=function(_0x1ba9f3,_0x4e415c){if(_0x1ba9f3['body']['id']){delete _0x1ba9f3[_0xba82('0x48')]['id'];}return db['ZohoAccount'][_0xba82('0x46')]({'where':{'id':_0x1ba9f3[_0xba82('0x43')]['id']}})[_0xba82('0x29')](handleEntityNotFound(_0x4e415c,null))[_0xba82('0x29')](saveUpdates(_0x1ba9f3[_0xba82('0x48')],null))['then'](respondWithResult(_0x4e415c,null))[_0xba82('0x42')](handleError(_0x4e415c,null));};exports[_0xba82('0x28')]=function(_0x87d22b,_0x22c6f7){return db[_0xba82('0x2e')][_0xba82('0x46')]({'where':{'id':_0x87d22b[_0xba82('0x43')]['id']}})[_0xba82('0x29')](handleEntityNotFound(_0x22c6f7,null))[_0xba82('0x29')](removeEntity(_0x22c6f7,null))['catch'](handleError(_0x22c6f7,null));};exports[_0xba82('0x49')]=function(_0x11aded,_0x4d69ec,_0x174236){var _0x159038={};var _0x53a678={};var _0x262cbd;var _0x338541;return db[_0xba82('0x2e')]['findOne']({'where':{'id':_0x11aded[_0xba82('0x43')]['id']}})[_0xba82('0x29')](handleEntityNotFound(_0x4d69ec,null))[_0xba82('0x29')](function(_0x3d870a){if(_0x3d870a){_0x262cbd=_0x3d870a;_0x53a678[_0xba82('0x37')]=_['keys'](db[_0xba82('0x4a')]['rawAttributes']);_0x53a678[_0xba82('0x33')]=_['keys'](_0x11aded[_0xba82('0x33')]);_0x53a678[_0xba82('0x35')]=_[_0xba82('0x36')](_0x53a678['model'],_0x53a678['query']);_0x159038[_0xba82('0x38')]=_[_0xba82('0x36')](_0x53a678[_0xba82('0x37')],qs['fields'](_0x11aded['query'][_0xba82('0x39')]));_0x159038[_0xba82('0x38')]=_0x159038['attributes'][_0xba82('0x44')]?_0x159038['attributes']:_0x53a678[_0xba82('0x37')];_0x159038['order']=qs[_0xba82('0x3b')](_0x11aded['query']['sort']);_0x159038[_0xba82('0x3c')]=qs[_0xba82('0x35')](_[_0xba82('0x4b')](_0x11aded['query'],_0x53a678['filters']));if(_0x11aded[_0xba82('0x33')][_0xba82('0x4c')]){_0x159038[_0xba82('0x3c')]=_[_0xba82('0x3d')](_0x159038['where'],{'$or':_[_0xba82('0x32')](_0x159038[_0xba82('0x38')],function(_0x57af91){var _0x47adbc={};_0x47adbc[_0x57af91]={'$like':'%'+_0x11aded[_0xba82('0x33')][_0xba82('0x4c')]+'%'};return _0x47adbc;})});}_0x159038=_[_0xba82('0x3d')]({},_0x159038,_0x11aded[_0xba82('0x40')]);return _0x262cbd['getConfigurations'](_0x159038);}})[_0xba82('0x29')](function(_0x10ee1f){if(_0x10ee1f){_0x338541=_0x10ee1f[_0xba82('0x44')];if(!_0x11aded[_0xba82('0x33')][_0xba82('0x4d')]('nolimit')){_0x159038[_0xba82('0x21')]=qs[_0xba82('0x21')](_0x11aded[_0xba82('0x33')]['limit']);_0x159038[_0xba82('0x1e')]=qs[_0xba82('0x1e')](_0x11aded[_0xba82('0x33')]['offset']);}return _0x262cbd[_0xba82('0x49')](_0x159038);}})['then'](function(_0x23037d){if(_0x23037d){return _0x23037d?{'count':_0x338541,'rows':_0x23037d}:null;}})[_0xba82('0x29')](respondWithResult(_0x4d69ec,null))[_0xba82('0x42')](handleError(_0x4d69ec,null));};exports[_0xba82('0x4e')]=function(_0x5b7f4c,_0x377cf4,_0x55e306){if(_0x5b7f4c[_0xba82('0x48')]['id']){delete _0x5b7f4c['body']['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x5b7f4c[_0xba82('0x43')]['id']}})['then'](handleEntityNotFound(_0x377cf4,null))[_0xba82('0x29')](function(_0x434074){if(_0x434074){_0x5b7f4c[_0xba82('0x48')][_0xba82('0x4f')]=_0x434074['id'];_0x5b7f4c[_0xba82('0x48')]['Subjects']=integrations['getSubjects'](_0x5b7f4c['body'][_0xba82('0x50')],_0x5b7f4c['body']['type']);_0x5b7f4c[_0xba82('0x48')][_0xba82('0x51')]=integrations['getDescriptions'](_0x5b7f4c[_0xba82('0x48')][_0xba82('0x50')],_0x5b7f4c['body'][_0xba82('0x3e')]);return db[_0xba82('0x4a')][_0xba82('0x47')](_0x5b7f4c[_0xba82('0x48')],{'include':[{'model':db['ZohoField'],'as':_0xba82('0x52')},{'model':db[_0xba82('0x53')],'as':_0xba82('0x51')}]});}return null;})[_0xba82('0x29')](respondWithResult(_0x377cf4,null))[_0xba82('0x42')](handleError(_0x377cf4,null));};function getAccessToken(_0x37cc70){return new Promise(function(_0x17923e,_0x18e1aa){var _0xffbb59;switch(_0x37cc70[_0xba82('0x54')]){case'US':_0xffbb59=_0xba82('0x55');break;case'AU':_0xffbb59='https://accounts.zoho.com.au';break;case'EU':_0xffbb59=_0xba82('0x56');break;case'IN':_0xffbb59=_0xba82('0x57');break;case'CN':_0xffbb59='https://accounts.zoho.com.cn';break;default:_0xffbb59=_0xba82('0x56');break;}var _0x596f25={'method':_0xba82('0x58'),'uri':_0xffbb59+_0xba82('0x59'),'qs':{'refresh_token':_0x37cc70[_0xba82('0x5a')],'client_id':_0x37cc70['clientId'],'client_secret':_0x37cc70[_0xba82('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x596f25)['then'](function(_0xacdcc2){if(_0xacdcc2[_0xba82('0x5c')]){_0x17923e(_0xacdcc2['access_token']);}else{_0x18e1aa('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xba82('0x42')](function(_0x37e31c){_0x18e1aa(_0x37e31c);});});}exports[_0xba82('0x5d')]=function(_0xf691f,_0x106d2f,_0x5780b3){var _0x392d7f,_0x8d87f,_0x5a9c30,_0xc48799,_0x74008a;return db[_0xba82('0x2e')][_0xba82('0x5e')]({'where':{'id':_0xf691f[_0xba82('0x43')]['id']},'attributes':['id',_0xba82('0x5f'),_0xba82('0x54'),_0xba82('0x60'),'clientSecret','serverUrl',_0xba82('0x61'),'refreshToken']})[_0xba82('0x29')](handleEntityNotFound(_0x106d2f,null))[_0xba82('0x29')](function(_0x13f3a7){_0x74008a=_0x13f3a7;_0x392d7f=_0x74008a[_0xba82('0x5f')];_0x8d87f=_0x392d7f===_0xba82('0x62')?'eu':_0xba82('0x63');_0x5a9c30=_0x74008a[_0xba82('0x64')];var _0x26b01a=_0x5a9c30[_0xba82('0x65')](-0x1);if(_0x26b01a==='/'||_0x26b01a==='\x5c'||_0x26b01a===':'){_0x5a9c30=_0x5a9c30['substring'](0x0,_0x5a9c30[_0xba82('0x66')](_0x26b01a));}if(!_0x74008a['refreshToken']){throw new Error(_0xba82('0x67'));}return getAccessToken(_0x74008a);})[_0xba82('0x29')](function(_0x200978){if(_0x200978){return rp({'method':_0xba82('0x68'),'uri':util[_0xba82('0x69')](_0xba82('0x6a'),_0x8d87f),'qs':{'module':'Calls'},'headers':{'Authorization':_0xba82('0x6b')+_0x200978},'json':!![]});}})['then'](function(_0x3876dd){if(_0x3876dd){if(_0x3876dd[_0xba82('0x6c')]&&_0x3876dd[_0xba82('0x6c')][_0xba82('0x2a')]){throw new Error(_0x3876dd[_0xba82('0x6c')][_0xba82('0x2a')][_0xba82('0x6d')]);}var _0xc16c16=[];var _0x34c8ef=[];var _0x2046eb=['Owner','Subject',_0xba82('0x6e'),_0xba82('0x6f'),_0xba82('0x70'),_0xba82('0x71'),_0xba82('0x72'),'Call_Type'];_0x34c8ef=_['remove'](_0x3876dd[_0xba82('0x39')],function(_0x1ac87b){return _0x2046eb[_0xba82('0x73')](_0x1ac87b[_0xba82('0x74')]);});for(var _0x5ddba5=0x0;_0x5ddba5<_0x34c8ef[_0xba82('0x44')];_0x5ddba5++){if(_0x34c8ef[_0x5ddba5][_0xba82('0x75')]===![]){_0xc16c16['push']({'id':_0x34c8ef[_0x5ddba5]['id'],'name':_0x34c8ef[_0x5ddba5][_0xba82('0x76')],'custom':_0x34c8ef[_0x5ddba5][_0xba82('0x77')],'options':_0x34c8ef[_0x5ddba5][_0xba82('0x78')]===_0xba82('0x79')&&_0x34c8ef[_0x5ddba5]['pick_list_values'][_0xba82('0x44')]>-0x1?_['map'](_0x34c8ef[_0x5ddba5]['pick_list_values'],function(_0x5a0c7b){return{'name':_0x5a0c7b,'value':_0x5a0c7b};}):[]});}}return{'count':_0xc16c16[_0xba82('0x44')],'rows':_0xc16c16};}else{return{'count':0x0,'rows':[]};}})[_0xba82('0x29')](respondWithResult(_0x106d2f,null))[_0xba82('0x42')](function(_0x3779c0){var _0x3cff81=_0xf691f[_0xba82('0x33')]['test']?0x1f4:_0x3779c0[_0xba82('0x7a')]||0x1f4;logger[_0xba82('0x2a')](_0xba82('0x7b'),_0xba82('0x5d'),_0x3cff81,JSON[_0xba82('0x7c')](_0x3779c0));delete _0x3779c0[_0xba82('0x2c')];if(_0x3cff81===0x191){_0x3cff81=0x190;}_0x106d2f[_0xba82('0x1b')](_0x3cff81)[_0xba82('0x7d')](_0xf691f[_0xba82('0x33')][_0xba82('0x7e')]?{'message':_0xba82('0x7f'),'statusCode':_0x3779c0['statusCode']}:_0x3779c0);});}; \ No newline at end of file +var _0xffd2=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientId','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','serverUrl','code','host','zoho.eu','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','Subject','Description','WhoId','Call_Result','Call_Start_Time','Call_Type','remove','push','data_type','picklist','pick_list_values','test','statusCode','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','send','index','ZohoAccount','rawAttributes','fieldName','type','key','model','map','name','query','filters','intersection'];(function(_0x4ec520,_0x15fee2){var _0xed49d7=function(_0x3031f2){while(--_0x3031f2){_0x4ec520['push'](_0x4ec520['shift']());}};_0xed49d7(++_0x15fee2);}(_0xffd2,0x146));var _0x2ffd=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0xffd2[_0x29d94e];return _0x106237;};'use strict';var emlformat=require(_0x2ffd('0x0'));var rimraf=require(_0x2ffd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ffd('0x2'));var rp=require(_0x2ffd('0x3'));var moment=require('moment');var BPromise=require(_0x2ffd('0x4'));var Mustache=require('mustache');var util=require(_0x2ffd('0x5'));var path=require('path');var sox=require(_0x2ffd('0x6'));var csv=require('to-csv');var ejs=require(_0x2ffd('0x7'));var fs=require('fs');var fs_extra=require(_0x2ffd('0x8'));var _=require(_0x2ffd('0x9'));var squel=require(_0x2ffd('0xa'));var crypto=require(_0x2ffd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x2ffd('0xc'));var toCsv=require(_0x2ffd('0xd'));var querystring=require(_0x2ffd('0xe'));var Papa=require(_0x2ffd('0xf'));var Redis=require('ioredis');var authService=require(_0x2ffd('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2ffd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2ffd('0x12'))(_0x2ffd('0x13'));var utils=require(_0x2ffd('0x14'));var config=require(_0x2ffd('0x15'));var licenseUtil=require(_0x2ffd('0x16'));var db=require(_0x2ffd('0x17'))['db'];var integrations=require(_0x2ffd('0x18'));function respondWithStatusCode(_0x8589e,_0x1d0b99){_0x1d0b99=_0x1d0b99||0xcc;return function(_0x447d14){if(_0x447d14){return _0x8589e[_0x2ffd('0x19')](_0x1d0b99);}return _0x8589e[_0x2ffd('0x1a')](_0x1d0b99)[_0x2ffd('0x1b')]();};}function respondWithResult(_0x30120f,_0x899735){_0x899735=_0x899735||0xc8;return function(_0x31266e){if(_0x31266e){return _0x30120f[_0x2ffd('0x1a')](_0x899735)[_0x2ffd('0x1c')](_0x31266e);}};}function respondWithFilteredResult(_0x44b8c5,_0x54b08c){return function(_0x58e2a1){if(_0x58e2a1){var _0x175aba=typeof _0x54b08c[_0x2ffd('0x1d')]==='undefined'&&typeof _0x54b08c['limit']===_0x2ffd('0x1e');var _0x1cae5a=_0x58e2a1[_0x2ffd('0x1f')];var _0x89119a=_0x175aba?0x0:_0x54b08c[_0x2ffd('0x1d')];var _0x39c443=_0x175aba?_0x58e2a1[_0x2ffd('0x1f')]:_0x54b08c[_0x2ffd('0x1d')]+_0x54b08c[_0x2ffd('0x20')];var _0xc1f50;if(_0x39c443>=_0x1cae5a){_0x39c443=_0x1cae5a;_0xc1f50=0xc8;}else{_0xc1f50=0xce;}_0x44b8c5[_0x2ffd('0x1a')](_0xc1f50);return _0x44b8c5[_0x2ffd('0x21')](_0x2ffd('0x22'),_0x89119a+'-'+_0x39c443+'/'+_0x1cae5a)[_0x2ffd('0x1c')](_0x58e2a1);}return null;};}function patchUpdates(_0x4885d7){return function(_0x4c0844){try{jsonpatch[_0x2ffd('0x23')](_0x4c0844,_0x4885d7,!![]);}catch(_0x1acf17){return BPromise[_0x2ffd('0x24')](_0x1acf17);}return _0x4c0844[_0x2ffd('0x25')]();};}function saveUpdates(_0x47272a,_0x255d1b){return function(_0x215f55){if(_0x215f55){return _0x215f55['update'](_0x47272a)['then'](function(_0x50f770){return _0x50f770;});}return null;};}function removeEntity(_0x4b66aa,_0x172c70){return function(_0x51a276){if(_0x51a276){return _0x51a276[_0x2ffd('0x26')]()[_0x2ffd('0x27')](function(){_0x4b66aa[_0x2ffd('0x1a')](0xcc)[_0x2ffd('0x1b')]();});}};}function handleEntityNotFound(_0x2d2fe0,_0x4dbc86){return function(_0x33fb8f){if(!_0x33fb8f){_0x2d2fe0[_0x2ffd('0x19')](0x194);}return _0x33fb8f;};}function handleError(_0x115e70,_0x1cc73c){_0x1cc73c=_0x1cc73c||0x1f4;return function(_0x2485a7){logger[_0x2ffd('0x28')](_0x2485a7[_0x2ffd('0x29')]);if(_0x2485a7['name']){delete _0x2485a7['name'];}_0x115e70['status'](_0x1cc73c)[_0x2ffd('0x2a')](_0x2485a7);};}exports[_0x2ffd('0x2b')]=function(_0x153736,_0x2787c7){var _0x4ba775={},_0xa5d90c={},_0x47ed55={'count':0x0,'rows':[]};var _0x23073e=_['map'](db[_0x2ffd('0x2c')][_0x2ffd('0x2d')],function(_0x43958e){return{'name':_0x43958e[_0x2ffd('0x2e')],'type':_0x43958e[_0x2ffd('0x2f')][_0x2ffd('0x30')]};});_0xa5d90c[_0x2ffd('0x31')]=_[_0x2ffd('0x32')](_0x23073e,_0x2ffd('0x33'));_0xa5d90c[_0x2ffd('0x34')]=_['keys'](_0x153736[_0x2ffd('0x34')]);_0xa5d90c[_0x2ffd('0x35')]=_[_0x2ffd('0x36')](_0xa5d90c[_0x2ffd('0x31')],_0xa5d90c[_0x2ffd('0x34')]);_0x4ba775[_0x2ffd('0x37')]=_[_0x2ffd('0x36')](_0xa5d90c['model'],qs[_0x2ffd('0x38')](_0x153736[_0x2ffd('0x34')][_0x2ffd('0x38')]));_0x4ba775[_0x2ffd('0x37')]=_0x4ba775[_0x2ffd('0x37')][_0x2ffd('0x39')]?_0x4ba775['attributes']:_0xa5d90c[_0x2ffd('0x31')];if(!_0x153736[_0x2ffd('0x34')][_0x2ffd('0x3a')](_0x2ffd('0x3b'))){_0x4ba775[_0x2ffd('0x20')]=qs['limit'](_0x153736[_0x2ffd('0x34')][_0x2ffd('0x20')]);_0x4ba775[_0x2ffd('0x1d')]=qs['offset'](_0x153736[_0x2ffd('0x34')][_0x2ffd('0x1d')]);}_0x4ba775[_0x2ffd('0x3c')]=qs[_0x2ffd('0x3d')](_0x153736[_0x2ffd('0x34')]['sort']);_0x4ba775[_0x2ffd('0x3e')]=qs[_0x2ffd('0x35')](_[_0x2ffd('0x3f')](_0x153736['query'],_0xa5d90c[_0x2ffd('0x35')]),_0x23073e);if(_0x153736[_0x2ffd('0x34')][_0x2ffd('0x40')]){_0x4ba775[_0x2ffd('0x3e')]=_[_0x2ffd('0x41')](_0x4ba775[_0x2ffd('0x3e')],{'$or':_[_0x2ffd('0x32')](_0x23073e,function(_0x230c8b){if(_0x230c8b['type']!==_0x2ffd('0x42')){var _0x415c8b={};_0x415c8b[_0x230c8b[_0x2ffd('0x33')]]={'$like':'%'+_0x153736[_0x2ffd('0x34')][_0x2ffd('0x40')]+'%'};return _0x415c8b;}})});}_0x4ba775=_[_0x2ffd('0x41')]({},_0x4ba775,_0x153736[_0x2ffd('0x43')]);var _0x4e5e84={'where':_0x4ba775[_0x2ffd('0x3e')]};return db[_0x2ffd('0x2c')][_0x2ffd('0x1f')](_0x4e5e84)[_0x2ffd('0x27')](function(_0x574dba){_0x47ed55[_0x2ffd('0x1f')]=_0x574dba;if(_0x153736[_0x2ffd('0x34')][_0x2ffd('0x44')]){_0x4ba775[_0x2ffd('0x45')]=[{'all':!![]}];}return db[_0x2ffd('0x2c')][_0x2ffd('0x46')](_0x4ba775);})['then'](function(_0x4f23a9){_0x47ed55[_0x2ffd('0x47')]=_0x4f23a9;return _0x47ed55;})[_0x2ffd('0x27')](respondWithFilteredResult(_0x2787c7,_0x4ba775))[_0x2ffd('0x48')](handleError(_0x2787c7,null));};exports[_0x2ffd('0x49')]=function(_0x541613,_0x449f6a){var _0x3083f3={'raw':![],'where':{'id':_0x541613[_0x2ffd('0x4a')]['id']}},_0x1a1a02={};_0x1a1a02['model']=_[_0x2ffd('0x4b')](db['ZohoAccount']['rawAttributes']);_0x1a1a02[_0x2ffd('0x34')]=_[_0x2ffd('0x4b')](_0x541613[_0x2ffd('0x34')]);_0x1a1a02['filters']=_[_0x2ffd('0x36')](_0x1a1a02[_0x2ffd('0x31')],_0x1a1a02[_0x2ffd('0x34')]);_0x3083f3[_0x2ffd('0x37')]=_['intersection'](_0x1a1a02[_0x2ffd('0x31')],qs[_0x2ffd('0x38')](_0x541613[_0x2ffd('0x34')]['fields']));_0x3083f3[_0x2ffd('0x37')]=_0x3083f3[_0x2ffd('0x37')][_0x2ffd('0x39')]?_0x3083f3[_0x2ffd('0x37')]:_0x1a1a02[_0x2ffd('0x31')];if(_0x541613[_0x2ffd('0x34')]['includeAll']){_0x3083f3[_0x2ffd('0x45')]=[{'all':!![]}];}_0x3083f3=_['merge']({},_0x3083f3,_0x541613[_0x2ffd('0x43')]);return db[_0x2ffd('0x2c')][_0x2ffd('0x4c')](_0x3083f3)['then'](handleEntityNotFound(_0x449f6a,null))[_0x2ffd('0x27')](respondWithResult(_0x449f6a,null))['catch'](handleError(_0x449f6a,null));};exports[_0x2ffd('0x4d')]=function(_0x6abb9f,_0x538e6f){return db[_0x2ffd('0x2c')][_0x2ffd('0x4d')](_0x6abb9f[_0x2ffd('0x4e')],{})['then'](respondWithResult(_0x538e6f,0xc9))['catch'](handleError(_0x538e6f,null));};exports['update']=function(_0x30f252,_0x103292){if(_0x30f252[_0x2ffd('0x4e')]['id']){delete _0x30f252['body']['id'];}return db[_0x2ffd('0x2c')][_0x2ffd('0x4c')]({'where':{'id':_0x30f252[_0x2ffd('0x4a')]['id']}})[_0x2ffd('0x27')](handleEntityNotFound(_0x103292,null))[_0x2ffd('0x27')](saveUpdates(_0x30f252[_0x2ffd('0x4e')],null))[_0x2ffd('0x27')](respondWithResult(_0x103292,null))[_0x2ffd('0x48')](handleError(_0x103292,null));};exports[_0x2ffd('0x26')]=function(_0x2469f9,_0x57b54f){return db[_0x2ffd('0x2c')]['find']({'where':{'id':_0x2469f9[_0x2ffd('0x4a')]['id']}})[_0x2ffd('0x27')](handleEntityNotFound(_0x57b54f,null))[_0x2ffd('0x27')](removeEntity(_0x57b54f,null))[_0x2ffd('0x48')](handleError(_0x57b54f,null));};exports[_0x2ffd('0x4f')]=function(_0x3211ae,_0x2d602b,_0x19ea19){var _0x54a354={};var _0x3860a0={};var _0x252cfb;var _0x5e6ba4;return db[_0x2ffd('0x2c')][_0x2ffd('0x50')]({'where':{'id':_0x3211ae[_0x2ffd('0x4a')]['id']}})[_0x2ffd('0x27')](handleEntityNotFound(_0x2d602b,null))['then'](function(_0x93b956){if(_0x93b956){_0x252cfb=_0x93b956;_0x3860a0[_0x2ffd('0x31')]=_[_0x2ffd('0x4b')](db[_0x2ffd('0x51')][_0x2ffd('0x2d')]);_0x3860a0[_0x2ffd('0x34')]=_[_0x2ffd('0x4b')](_0x3211ae[_0x2ffd('0x34')]);_0x3860a0[_0x2ffd('0x35')]=_[_0x2ffd('0x36')](_0x3860a0[_0x2ffd('0x31')],_0x3860a0[_0x2ffd('0x34')]);_0x54a354[_0x2ffd('0x37')]=_[_0x2ffd('0x36')](_0x3860a0[_0x2ffd('0x31')],qs['fields'](_0x3211ae[_0x2ffd('0x34')][_0x2ffd('0x38')]));_0x54a354[_0x2ffd('0x37')]=_0x54a354[_0x2ffd('0x37')][_0x2ffd('0x39')]?_0x54a354[_0x2ffd('0x37')]:_0x3860a0[_0x2ffd('0x31')];_0x54a354[_0x2ffd('0x3c')]=qs[_0x2ffd('0x3d')](_0x3211ae[_0x2ffd('0x34')]['sort']);_0x54a354['where']=qs[_0x2ffd('0x35')](_[_0x2ffd('0x3f')](_0x3211ae['query'],_0x3860a0[_0x2ffd('0x35')]));if(_0x3211ae[_0x2ffd('0x34')][_0x2ffd('0x40')]){_0x54a354[_0x2ffd('0x3e')]=_[_0x2ffd('0x41')](_0x54a354['where'],{'$or':_['map'](_0x54a354[_0x2ffd('0x37')],function(_0x2a0c3b){var _0x187e84={};_0x187e84[_0x2a0c3b]={'$like':'%'+_0x3211ae[_0x2ffd('0x34')][_0x2ffd('0x40')]+'%'};return _0x187e84;})});}_0x54a354=_[_0x2ffd('0x41')]({},_0x54a354,_0x3211ae[_0x2ffd('0x43')]);return _0x252cfb[_0x2ffd('0x4f')](_0x54a354);}})[_0x2ffd('0x27')](function(_0x18db5a){if(_0x18db5a){_0x5e6ba4=_0x18db5a[_0x2ffd('0x39')];if(!_0x3211ae[_0x2ffd('0x34')]['hasOwnProperty'](_0x2ffd('0x3b'))){_0x54a354['limit']=qs[_0x2ffd('0x20')](_0x3211ae[_0x2ffd('0x34')][_0x2ffd('0x20')]);_0x54a354[_0x2ffd('0x1d')]=qs['offset'](_0x3211ae[_0x2ffd('0x34')]['offset']);}return _0x252cfb[_0x2ffd('0x4f')](_0x54a354);}})[_0x2ffd('0x27')](function(_0x5403be){if(_0x5403be){return _0x5403be?{'count':_0x5e6ba4,'rows':_0x5403be}:null;}})[_0x2ffd('0x27')](respondWithResult(_0x2d602b,null))[_0x2ffd('0x48')](handleError(_0x2d602b,null));};exports[_0x2ffd('0x52')]=function(_0x43cd12,_0x4c3ca3,_0x5d22a4){if(_0x43cd12['body']['id']){delete _0x43cd12['body']['id'];}return db[_0x2ffd('0x2c')][_0x2ffd('0x50')]({'where':{'id':_0x43cd12['params']['id']}})[_0x2ffd('0x27')](handleEntityNotFound(_0x4c3ca3,null))[_0x2ffd('0x27')](function(_0x14e8bc){if(_0x14e8bc){_0x43cd12[_0x2ffd('0x4e')][_0x2ffd('0x53')]=_0x14e8bc['id'];_0x43cd12[_0x2ffd('0x4e')][_0x2ffd('0x54')]=integrations[_0x2ffd('0x55')](_0x43cd12[_0x2ffd('0x4e')][_0x2ffd('0x56')],_0x43cd12[_0x2ffd('0x4e')][_0x2ffd('0x2f')]);_0x43cd12[_0x2ffd('0x4e')][_0x2ffd('0x57')]=integrations[_0x2ffd('0x58')](_0x43cd12[_0x2ffd('0x4e')]['channel'],_0x43cd12['body'][_0x2ffd('0x2f')]);return db[_0x2ffd('0x51')]['create'](_0x43cd12['body'],{'include':[{'model':db['ZohoField'],'as':_0x2ffd('0x54')},{'model':db[_0x2ffd('0x59')],'as':_0x2ffd('0x57')}]});}return null;})[_0x2ffd('0x27')](respondWithResult(_0x4c3ca3,null))[_0x2ffd('0x48')](handleError(_0x4c3ca3,null));};function getAccessToken(_0x4922ce){return new Promise(function(_0x4cce12,_0x2f3b9a){var _0x5a4b36;switch(_0x4922ce[_0x2ffd('0x5a')]){case'US':_0x5a4b36=_0x2ffd('0x5b');break;case'AU':_0x5a4b36=_0x2ffd('0x5c');break;case'EU':_0x5a4b36=_0x2ffd('0x5d');break;case'IN':_0x5a4b36=_0x2ffd('0x5e');break;case'CN':_0x5a4b36=_0x2ffd('0x5f');break;default:_0x5a4b36=_0x2ffd('0x5d');break;}var _0x4fa171={'method':_0x2ffd('0x60'),'uri':_0x5a4b36+_0x2ffd('0x61'),'qs':{'refresh_token':_0x4922ce['refreshToken'],'client_id':_0x4922ce[_0x2ffd('0x62')],'client_secret':_0x4922ce[_0x2ffd('0x63')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4fa171)[_0x2ffd('0x27')](function(_0x5138ea){if(_0x5138ea['access_token']){_0x4cce12(_0x5138ea[_0x2ffd('0x64')]);}else{_0x2f3b9a(_0x2ffd('0x65'));}})[_0x2ffd('0x48')](function(_0x2595c7){_0x2f3b9a(_0x2595c7);});});}exports[_0x2ffd('0x66')]=function(_0x76422f,_0x39fd2b,_0x2c39d2){var _0x6b9ccf,_0x1fd6ba,_0x35264a,_0x5a3446,_0x5d9ad0;return db['ZohoAccount'][_0x2ffd('0x50')]({'where':{'id':_0x76422f['params']['id']},'attributes':['id','host',_0x2ffd('0x5a'),'clientId',_0x2ffd('0x63'),_0x2ffd('0x67'),_0x2ffd('0x68'),'refreshToken']})[_0x2ffd('0x27')](handleEntityNotFound(_0x39fd2b,null))[_0x2ffd('0x27')](function(_0xd74f66){_0x5d9ad0=_0xd74f66;_0x6b9ccf=_0x5d9ad0[_0x2ffd('0x69')];_0x1fd6ba=_0x6b9ccf===_0x2ffd('0x6a')?'eu':'com';_0x35264a=_0x5d9ad0[_0x2ffd('0x67')];var _0x55b0bd=_0x35264a['slice'](-0x1);if(_0x55b0bd==='/'||_0x55b0bd==='\x5c'||_0x55b0bd===':'){_0x35264a=_0x35264a[_0x2ffd('0x6b')](0x0,_0x35264a[_0x2ffd('0x6c')](_0x55b0bd));}if(!_0x5d9ad0['refreshToken']){throw new Error(_0x2ffd('0x6d'));}return getAccessToken(_0x5d9ad0);})[_0x2ffd('0x27')](function(_0x30aa91){if(_0x30aa91){return rp({'method':_0x2ffd('0x6e'),'uri':util['format'](_0x2ffd('0x6f'),_0x1fd6ba),'qs':{'module':_0x2ffd('0x70')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x30aa91},'json':!![]});}})[_0x2ffd('0x27')](function(_0x1c82de){if(_0x1c82de){if(_0x1c82de['response']&&_0x1c82de[_0x2ffd('0x71')][_0x2ffd('0x28')]){throw new Error(_0x1c82de[_0x2ffd('0x71')][_0x2ffd('0x28')]['message']);}var _0xd40f1b=[];var _0x404b22=[];var _0x1e26c4=['Owner',_0x2ffd('0x72'),_0x2ffd('0x73'),_0x2ffd('0x74'),'Call_Duration',_0x2ffd('0x75'),_0x2ffd('0x76'),_0x2ffd('0x77')];_0x404b22=_[_0x2ffd('0x78')](_0x1c82de[_0x2ffd('0x38')],function(_0x177d57){return _0x1e26c4['includes'](_0x177d57['api_name']);});for(var _0x43bd07=0x0;_0x43bd07<_0x404b22[_0x2ffd('0x39')];_0x43bd07++){if(_0x404b22[_0x43bd07]['system_mandatory']===![]){_0xd40f1b[_0x2ffd('0x79')]({'id':_0x404b22[_0x43bd07]['id'],'name':_0x404b22[_0x43bd07]['display_label'],'custom':_0x404b22[_0x43bd07]['custom_field'],'options':_0x404b22[_0x43bd07][_0x2ffd('0x7a')]===_0x2ffd('0x7b')&&_0x404b22[_0x43bd07][_0x2ffd('0x7c')]['length']>-0x1?_[_0x2ffd('0x32')](_0x404b22[_0x43bd07]['pick_list_values'],function(_0xcbb983){return{'name':_0xcbb983,'value':_0xcbb983};}):[]});}}return{'count':_0xd40f1b['length'],'rows':_0xd40f1b};}else{return{'count':0x0,'rows':[]};}})[_0x2ffd('0x27')](respondWithResult(_0x39fd2b,null))[_0x2ffd('0x48')](function(_0x14f1c4){var _0x32cd57=_0x76422f[_0x2ffd('0x34')]['test']?0x1f4:_0x14f1c4['statusCode']||0x1f4;logger[_0x2ffd('0x28')]('getFields,\x20%s,\x20%s,\x20%s',_0x2ffd('0x66'),_0x32cd57,JSON['stringify'](_0x14f1c4));delete _0x14f1c4['name'];if(_0x32cd57===0x191){_0x32cd57=0x190;}_0x39fd2b[_0x2ffd('0x1a')](_0x32cd57)[_0x2ffd('0x2a')](_0x76422f[_0x2ffd('0x34')][_0x2ffd('0x7d')]?{'message':'Wrong\x20credentials','statusCode':_0x14f1c4[_0x2ffd('0x7e')]}:_0x14f1c4);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index c74ab8f..64f3ba1 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 _0x2e6a=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.eu','POST','/oauth/v2/token','code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','substring','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','catch','util','../../config/logger','bluebird','request-promise','path','../../components/integrations/configuration','exports','define'];(function(_0x2db3eb,_0x415d67){var _0x16ec81=function(_0x355dd2){while(--_0x355dd2){_0x2db3eb['push'](_0x2db3eb['shift']());}};_0x16ec81(++_0x415d67);}(_0x2e6a,0xee));var _0xa2e6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x2e6a[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var util=require(_0xa2e6('0x0'));var logger=require(_0xa2e6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa2e6('0x2'));var rp=require(_0xa2e6('0x3'));var fs=require('fs');var path=require(_0xa2e6('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require(_0xa2e6('0x5'));module[_0xa2e6('0x6')]=function(_0x2d0df8,_0x1ee828){return _0x2d0df8[_0xa2e6('0x7')](_0xa2e6('0x8'),attributes,{'tableName':_0xa2e6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x9935bf,_0x4479fd,_0x3925ec){if(_0x9935bf[_0xa2e6('0xa')](_0xa2e6('0xb'))||_0x9935bf[_0xa2e6('0xa')](_0xa2e6('0xc'))||_0x9935bf[_0xa2e6('0xa')](_0xa2e6('0xd'))||_0x9935bf['changed'](_0xa2e6('0xe'))||_0x9935bf[_0xa2e6('0xa')]('code')||_0x9935bf[_0xa2e6('0xa')](_0xa2e6('0xf'))){var _0x521ac7,_0xf5d6d;_0x521ac7=_0x9935bf[_0xa2e6('0xc')];var _0x154438=_0x521ac7[_0xa2e6('0x10')](-0x1);if(_0x154438==='/'||_0x154438==='\x5c'||_0x154438===':'){_0x521ac7=_0x521ac7['substring'](0x0,_0x521ac7[_0xa2e6('0x11')](_0x154438));}switch(_0x9935bf[_0xa2e6('0xb')]){case'US':_0xf5d6d=_0xa2e6('0x12');break;case'AU':_0xf5d6d='https://accounts.zoho.com.au';break;case'IN':_0xf5d6d='https://accounts.zoho.in';break;case'CN':_0xf5d6d='https://accounts.zoho.com.cn';break;default:_0xf5d6d=_0xa2e6('0x13');break;}var _0x37a7c9={'method':_0xa2e6('0x14'),'uri':_0xf5d6d+_0xa2e6('0x15'),'form':{'grant_type':'authorization_code','client_id':_0x9935bf[_0xa2e6('0xd')],'client_secret':_0x9935bf['clientSecret'],'redirect_uri':_0x9935bf['serverUrl'],'code':_0x9935bf[_0xa2e6('0x16')]},'headers':{'Content-Type':_0xa2e6('0x17')}};return rp(_0x37a7c9)[_0xa2e6('0x18')](function(_0x3e37e5){var _0x3f7310=JSON[_0xa2e6('0x19')](_0x3e37e5);if(_0x3f7310[_0xa2e6('0x1a')]){_0x9935bf[_0xa2e6('0x1b')]=_0x3f7310[_0xa2e6('0x1a')];logger[_0xa2e6('0x1c')](util[_0xa2e6('0x1d')](_0xa2e6('0x1e'),_0x9935bf[_0xa2e6('0x1f')],_0x9935bf['id']));}else{logger['error'](util[_0xa2e6('0x1d')](_0xa2e6('0x20'),_0x9935bf[_0xa2e6('0x1f')],_0x9935bf['id']),util[_0xa2e6('0x21')](_0x3f7310,{'showHidden':![],'depth':null}));}return _0x3925ec(null,_0x4479fd);})['catch'](function(_0x5cbd90){logger[_0xa2e6('0x22')](util[_0xa2e6('0x1d')](_0xa2e6('0x20'),_0x9935bf[_0xa2e6('0x1f')],_0x9935bf['id']),util[_0xa2e6('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x3925ec(_0x5cbd90);});}else{return _0x3925ec(null,_0x4479fd);}},'beforeUpdate':function(_0x56e46c,_0x415ac0,_0x2682c0){if(_0x56e46c[_0xa2e6('0xa')](_0xa2e6('0xb'))||_0x56e46c['changed'](_0xa2e6('0xc'))||_0x56e46c[_0xa2e6('0xa')](_0xa2e6('0xd'))||_0x56e46c[_0xa2e6('0xa')]('clientSecret')||_0x56e46c['changed'](_0xa2e6('0x16'))||_0x56e46c[_0xa2e6('0xa')](_0xa2e6('0xf'))){var _0x12d0f1,_0x37445a;_0x12d0f1=_0x56e46c[_0xa2e6('0xc')];var _0x21fc3a=_0x12d0f1[_0xa2e6('0x10')](-0x1);if(_0x21fc3a==='/'||_0x21fc3a==='\x5c'||_0x21fc3a===':'){_0x12d0f1=_0x12d0f1[_0xa2e6('0x23')](0x0,_0x12d0f1[_0xa2e6('0x11')](_0x21fc3a));}switch(_0x56e46c[_0xa2e6('0xb')]){case'US':_0x37445a=_0xa2e6('0x12');break;case'AU':_0x37445a=_0xa2e6('0x24');break;case'IN':_0x37445a=_0xa2e6('0x25');break;case'CN':_0x37445a=_0xa2e6('0x26');break;default:_0x37445a='https://accounts.zoho.eu';break;}var _0x272027={'method':_0xa2e6('0x14'),'uri':_0x37445a+_0xa2e6('0x15'),'form':{'grant_type':_0xa2e6('0x27'),'client_id':_0x56e46c[_0xa2e6('0xd')],'client_secret':_0x56e46c[_0xa2e6('0xe')],'redirect_uri':_0x56e46c[_0xa2e6('0xc')],'code':_0x56e46c[_0xa2e6('0x16')]},'headers':{'Content-Type':_0xa2e6('0x17')}};return rp(_0x272027)[_0xa2e6('0x18')](function(_0x2e8074){var _0x2fb2b3=JSON[_0xa2e6('0x19')](_0x2e8074);if(_0x2fb2b3['refresh_token']){_0x56e46c[_0xa2e6('0x1b')]=_0x2fb2b3[_0xa2e6('0x1a')];logger[_0xa2e6('0x1c')](util[_0xa2e6('0x1d')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x56e46c[_0xa2e6('0x1f')],_0x56e46c['id']));}else{logger['error'](util['format'](_0xa2e6('0x20'),_0x56e46c[_0xa2e6('0x1f')],_0x56e46c['id']),util[_0xa2e6('0x21')](_0x2fb2b3,{'showHidden':![],'depth':null}));}return _0x2682c0(null,_0x415ac0);})[_0xa2e6('0x28')](function(_0x857513){logger[_0xa2e6('0x22')](util['format'](_0xa2e6('0x20'),_0x56e46c[_0xa2e6('0x1f')],_0x56e46c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x2682c0(_0x857513);});}else{return _0x2682c0(null,_0x415ac0);}}}});}; \ No newline at end of file +var _0x225c=['code','https://accounts.zoho.in','POST','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientSecret','host','slice','substring','lastIndexOf','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch'];(function(_0x5b6bab,_0x3aecd4){var _0x26cbee=function(_0x390c68){while(--_0x390c68){_0x5b6bab['push'](_0x5b6bab['shift']());}};_0x26cbee(++_0x3aecd4);}(_0x225c,0x8e));var _0xc225=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x225c[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xc225('0x0'));var util=require(_0xc225('0x1'));var logger=require(_0xc225('0x2'))(_0xc225('0x3'));var moment=require(_0xc225('0x4'));var BPromise=require(_0xc225('0x5'));var rp=require(_0xc225('0x6'));var fs=require('fs');var path=require(_0xc225('0x7'));var rimraf=require('rimraf');var config=require(_0xc225('0x8'));var attributes=require(_0xc225('0x9'));var integrations=require(_0xc225('0xa'));module[_0xc225('0xb')]=function(_0xe92868,_0x30c919){return _0xe92868[_0xc225('0xc')](_0xc225('0xd'),attributes,{'tableName':_0xc225('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x331aa3,_0xcb8a1f,_0x460188){if(_0x331aa3[_0xc225('0xf')]('zone')||_0x331aa3[_0xc225('0xf')](_0xc225('0x10'))||_0x331aa3[_0xc225('0xf')]('clientId')||_0x331aa3[_0xc225('0xf')](_0xc225('0x11'))||_0x331aa3['changed']('code')||_0x331aa3[_0xc225('0xf')](_0xc225('0x12'))){var _0x2b93b7,_0x1938f8;_0x2b93b7=_0x331aa3['serverUrl'];var _0x3b77ee=_0x2b93b7[_0xc225('0x13')](-0x1);if(_0x3b77ee==='/'||_0x3b77ee==='\x5c'||_0x3b77ee===':'){_0x2b93b7=_0x2b93b7[_0xc225('0x14')](0x0,_0x2b93b7[_0xc225('0x15')](_0x3b77ee));}switch(_0x331aa3[_0xc225('0x16')]){case'US':_0x1938f8=_0xc225('0x17');break;case'AU':_0x1938f8=_0xc225('0x18');break;case'IN':_0x1938f8='https://accounts.zoho.in';break;case'CN':_0x1938f8=_0xc225('0x19');break;default:_0x1938f8=_0xc225('0x1a');break;}var _0x43223c={'method':'POST','uri':_0x1938f8+_0xc225('0x1b'),'form':{'grant_type':_0xc225('0x1c'),'client_id':_0x331aa3[_0xc225('0x1d')],'client_secret':_0x331aa3[_0xc225('0x11')],'redirect_uri':_0x331aa3['serverUrl'],'code':_0x331aa3['code']},'headers':{'Content-Type':_0xc225('0x1e')}};return rp(_0x43223c)[_0xc225('0x1f')](function(_0x5c6d8d){var _0x3459cf=JSON[_0xc225('0x20')](_0x5c6d8d);if(_0x3459cf[_0xc225('0x21')]){_0x331aa3[_0xc225('0x22')]=_0x3459cf[_0xc225('0x21')];logger[_0xc225('0x23')](util[_0xc225('0x24')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x331aa3[_0xc225('0x25')],_0x331aa3['id']));}else{logger[_0xc225('0x26')](util['format'](_0xc225('0x27'),_0x331aa3[_0xc225('0x25')],_0x331aa3['id']),util[_0xc225('0x28')](_0x3459cf,{'showHidden':![],'depth':null}));}return _0x460188(null,_0xcb8a1f);})[_0xc225('0x29')](function(_0xd02f4f){logger[_0xc225('0x26')](util[_0xc225('0x24')](_0xc225('0x27'),_0x331aa3[_0xc225('0x25')],_0x331aa3['id']),util[_0xc225('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x460188(_0xd02f4f);});}else{return _0x460188(null,_0xcb8a1f);}},'beforeUpdate':function(_0xc236c,_0x231fbc,_0x96d10a){if(_0xc236c[_0xc225('0xf')](_0xc225('0x16'))||_0xc236c[_0xc225('0xf')]('serverUrl')||_0xc236c[_0xc225('0xf')]('clientId')||_0xc236c[_0xc225('0xf')](_0xc225('0x11'))||_0xc236c['changed'](_0xc225('0x2a'))||_0xc236c[_0xc225('0xf')]('host')){var _0x2e71fb,_0x3b72df;_0x2e71fb=_0xc236c[_0xc225('0x10')];var _0xc72adc=_0x2e71fb[_0xc225('0x13')](-0x1);if(_0xc72adc==='/'||_0xc72adc==='\x5c'||_0xc72adc===':'){_0x2e71fb=_0x2e71fb[_0xc225('0x14')](0x0,_0x2e71fb[_0xc225('0x15')](_0xc72adc));}switch(_0xc236c[_0xc225('0x16')]){case'US':_0x3b72df=_0xc225('0x17');break;case'AU':_0x3b72df='https://accounts.zoho.com.au';break;case'IN':_0x3b72df=_0xc225('0x2b');break;case'CN':_0x3b72df='https://accounts.zoho.com.cn';break;default:_0x3b72df='https://accounts.zoho.eu';break;}var _0x2af3b9={'method':_0xc225('0x2c'),'uri':_0x3b72df+_0xc225('0x1b'),'form':{'grant_type':_0xc225('0x1c'),'client_id':_0xc236c[_0xc225('0x1d')],'client_secret':_0xc236c[_0xc225('0x11')],'redirect_uri':_0xc236c[_0xc225('0x10')],'code':_0xc236c[_0xc225('0x2a')]},'headers':{'Content-Type':_0xc225('0x1e')}};return rp(_0x2af3b9)['then'](function(_0x53e295){var _0x2b65b7=JSON[_0xc225('0x20')](_0x53e295);if(_0x2b65b7[_0xc225('0x21')]){_0xc236c['refreshToken']=_0x2b65b7[_0xc225('0x21')];logger[_0xc225('0x23')](util[_0xc225('0x24')](_0xc225('0x2d'),_0xc236c[_0xc225('0x25')],_0xc236c['id']));}else{logger['error'](util[_0xc225('0x24')](_0xc225('0x27'),_0xc236c[_0xc225('0x25')],_0xc236c['id']),util[_0xc225('0x28')](_0x2b65b7,{'showHidden':![],'depth':null}));}return _0x96d10a(null,_0x231fbc);})[_0xc225('0x29')](function(_0x53697c){logger[_0xc225('0x26')](util['format'](_0xc225('0x27'),_0xc236c['name'],_0xc236c['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x96d10a(_0x53697c);});}else{return _0x96d10a(null,_0x231fbc);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index daa4492..a0b4a34 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 _0x7753=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetZohoAccount','findAll','options','raw','where','limit','map','include','attributes','model','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x3d8872,_0x1d77a9){var _0x44afe4=function(_0x3a988c){while(--_0x3a988c){_0x3d8872['push'](_0x3d8872['shift']());}};_0x44afe4(++_0x1d77a9);}(_0x7753,0xfd));var _0x3775=function(_0x5465e6,_0x2a8809){_0x5465e6=_0x5465e6-0x0;var _0x10044e=_0x7753[_0x5465e6];return _0x10044e;};'use strict';var _=require(_0x3775('0x0'));var util=require(_0x3775('0x1'));var moment=require(_0x3775('0x2'));var BPromise=require(_0x3775('0x3'));var rs=require(_0x3775('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3775('0x5'))['db'];var utils=require(_0x3775('0x6'));var logger=require(_0x3775('0x7'))('rpc');var config=require(_0x3775('0x8'));var jayson=require(_0x3775('0x9'));var client=jayson['client'][_0x3775('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1daf10,_0x515eec,_0x55077d){return new BPromise(function(_0x3b6f9a,_0x1a90fe){return client[_0x3775('0xb')](_0x1daf10,_0x55077d)[_0x3775('0xc')](function(_0x33223e){logger['info'](_0x3775('0xd'),_0x515eec,_0x3775('0xe'));logger[_0x3775('0xf')](_0x3775('0x10'),_0x515eec,_0x3775('0xe'),JSON[_0x3775('0x11')](_0x33223e));if(_0x33223e['error']){if(_0x33223e[_0x3775('0x12')][_0x3775('0x13')]===0x1f4){logger[_0x3775('0x12')](_0x3775('0xd'),_0x515eec,_0x33223e['error'][_0x3775('0x14')]);return _0x1a90fe(_0x33223e['error'][_0x3775('0x14')]);}logger[_0x3775('0x12')](_0x3775('0xd'),_0x515eec,_0x33223e['error'][_0x3775('0x14')]);return _0x3b6f9a(_0x33223e['error']['message']);}else{logger[_0x3775('0x15')](_0x3775('0xd'),_0x515eec,_0x3775('0xe'));_0x3b6f9a(_0x33223e[_0x3775('0x16')][_0x3775('0x14')]);}})[_0x3775('0x17')](function(_0x40f44b){logger[_0x3775('0x12')]('ZohoAccount,\x20%s,\x20%s',_0x515eec,_0x40f44b);_0x1a90fe(_0x40f44b);});});}exports[_0x3775('0x18')]=function(_0x4a149d){var _0x352cfd=this;return new Promise(function(_0x307a80,_0x3d94b3){return db['ZohoAccount'][_0x3775('0x19')]({'raw':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1b')]===undefined?!![]:![]:!![],'where':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1c')]||null:null,'attributes':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')]['attributes']||null:null,'limit':_0x4a149d[_0x3775('0x1a')]?_0x4a149d[_0x3775('0x1a')][_0x3775('0x1d')]||null:null,'include':_0x4a149d[_0x3775('0x1a')]?_0x4a149d['options']['include']?_[_0x3775('0x1e')](_0x4a149d[_0x3775('0x1a')][_0x3775('0x1f')],function(_0x57dbb1){return{'model':db[_0x57dbb1['model']],'as':_0x57dbb1['as'],'attributes':_0x57dbb1[_0x3775('0x20')],'include':_0x57dbb1[_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x57dbb1['include'],function(_0xd6e1e3){return{'model':db[_0xd6e1e3[_0x3775('0x21')]],'as':_0xd6e1e3['as'],'attributes':_0xd6e1e3[_0x3775('0x20')],'include':_0xd6e1e3['include']?_[_0x3775('0x1e')](_0xd6e1e3['include'],function(_0x3bb405){return{'model':db[_0x3bb405['model']],'as':_0x3bb405['as'],'attributes':_0x3bb405[_0x3775('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x431629){logger[_0x3775('0x15')](_0x3775('0x18'),_0x4a149d);logger[_0x3775('0xf')]('GetZohoAccount',_0x4a149d,JSON[_0x3775('0x11')](_0x431629));_0x307a80(_0x431629);})[_0x3775('0x17')](function(_0x1361b0){logger[_0x3775('0x12')](_0x3775('0x18'),_0x1361b0[_0x3775('0x14')],_0x4a149d);_0x3d94b3(_0x352cfd[_0x3775('0x12')](0x1f4,_0x1361b0[_0x3775('0x14')]));});});};exports[_0x3775('0x22')]=function(_0x53b002){var _0x4904b6=this;return new Promise(function(_0x3f39d2,_0x331b81){return db[_0x3775('0x23')][_0x3775('0x24')]({'raw':_0x53b002[_0x3775('0x1a')]?_0x53b002[_0x3775('0x1a')][_0x3775('0x1b')]===undefined?!![]:![]:!![],'where':_0x53b002['options']?_0x53b002[_0x3775('0x1a')]['where']||null:null,'attributes':_0x53b002[_0x3775('0x1a')]?_0x53b002[_0x3775('0x1a')][_0x3775('0x20')]||null:null,'include':_0x53b002[_0x3775('0x1a')]?_0x53b002['options'][_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x53b002[_0x3775('0x1a')][_0x3775('0x1f')],function(_0x53b88b){return{'model':db[_0x53b88b[_0x3775('0x21')]],'as':_0x53b88b['as'],'attributes':_0x53b88b[_0x3775('0x20')],'include':_0x53b88b[_0x3775('0x1f')]?_[_0x3775('0x1e')](_0x53b88b['include'],function(_0x411c13){return{'model':db[_0x411c13[_0x3775('0x21')]],'as':_0x411c13['as'],'attributes':_0x411c13[_0x3775('0x20')],'include':_0x411c13['include']?_[_0x3775('0x1e')](_0x411c13[_0x3775('0x1f')],function(_0x5a7f81){return{'model':db[_0x5a7f81[_0x3775('0x21')]],'as':_0x5a7f81['as'],'attributes':_0x5a7f81[_0x3775('0x20')]};}):[]};}):[]};}):[]:[]})[_0x3775('0xc')](function(_0x259ff1){logger[_0x3775('0x15')](_0x3775('0x22'),_0x53b002);logger[_0x3775('0xf')](_0x3775('0x22'),_0x53b002,JSON[_0x3775('0x11')](_0x259ff1));_0x3f39d2(_0x259ff1);})[_0x3775('0x17')](function(_0x4bf1c7){logger[_0x3775('0x12')](_0x3775('0x22'),_0x4bf1c7[_0x3775('0x14')],_0x53b002);_0x331b81(_0x4904b6['error'](0x1f4,_0x4bf1c7[_0x3775('0x14')]));});});}; \ No newline at end of file +var _0xca6e=['catch','ZohoAccount','find','raw','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','findAll','options','where','attributes','limit','include','map','model','GetZohoAccount','stringify'];(function(_0x1ff0cd,_0x75a49c){var _0x3389fd=function(_0xe9d931){while(--_0xe9d931){_0x1ff0cd['push'](_0x1ff0cd['shift']());}};_0x3389fd(++_0x75a49c);}(_0xca6e,0x1c1));var _0xeca6=function(_0x56ad8d,_0x4d6fb8){_0x56ad8d=_0x56ad8d-0x0;var _0x5544b3=_0xca6e[_0x56ad8d];return _0x5544b3;};'use strict';var _=require(_0xeca6('0x0'));var util=require(_0xeca6('0x1'));var moment=require(_0xeca6('0x2'));var BPromise=require(_0xeca6('0x3'));var rs=require(_0xeca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeca6('0x5'))['db'];var utils=require(_0xeca6('0x6'));var logger=require('../../config/logger')(_0xeca6('0x7'));var config=require('../../config/environment');var jayson=require(_0xeca6('0x8'));var client=jayson[_0xeca6('0x9')][_0xeca6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bec20,_0x2ea018,_0x4a648d){return new BPromise(function(_0x26a250,_0x7f860a){return client[_0xeca6('0xb')](_0x5bec20,_0x4a648d)[_0xeca6('0xc')](function(_0xb5853c){logger['info'](_0xeca6('0xd'),_0x2ea018,_0xeca6('0xe'));logger[_0xeca6('0xf')](_0xeca6('0x10'),_0x2ea018,_0xeca6('0xe'),JSON['stringify'](_0xb5853c));if(_0xb5853c[_0xeca6('0x11')]){if(_0xb5853c[_0xeca6('0x11')][_0xeca6('0x12')]===0x1f4){logger[_0xeca6('0x11')](_0xeca6('0xd'),_0x2ea018,_0xb5853c[_0xeca6('0x11')]['message']);return _0x7f860a(_0xb5853c['error'][_0xeca6('0x13')]);}logger[_0xeca6('0x11')](_0xeca6('0xd'),_0x2ea018,_0xb5853c[_0xeca6('0x11')]['message']);return _0x26a250(_0xb5853c[_0xeca6('0x11')]['message']);}else{logger[_0xeca6('0x14')](_0xeca6('0xd'),_0x2ea018,_0xeca6('0xe'));_0x26a250(_0xb5853c[_0xeca6('0x15')][_0xeca6('0x13')]);}})['catch'](function(_0x204a34){logger['error'](_0xeca6('0xd'),_0x2ea018,_0x204a34);_0x7f860a(_0x204a34);});});}exports['GetZohoAccount']=function(_0x848ac4){var _0x1ea9e2=this;return new Promise(function(_0x1076c9,_0x4b2b5e){return db['ZohoAccount'][_0xeca6('0x16')]({'raw':_0x848ac4[_0xeca6('0x17')]?_0x848ac4[_0xeca6('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x848ac4[_0xeca6('0x17')]?_0x848ac4[_0xeca6('0x17')][_0xeca6('0x18')]||null:null,'attributes':_0x848ac4[_0xeca6('0x17')]?_0x848ac4[_0xeca6('0x17')][_0xeca6('0x19')]||null:null,'limit':_0x848ac4[_0xeca6('0x17')]?_0x848ac4[_0xeca6('0x17')][_0xeca6('0x1a')]||null:null,'include':_0x848ac4[_0xeca6('0x17')]?_0x848ac4[_0xeca6('0x17')][_0xeca6('0x1b')]?_[_0xeca6('0x1c')](_0x848ac4[_0xeca6('0x17')][_0xeca6('0x1b')],function(_0x2960c5){return{'model':db[_0x2960c5[_0xeca6('0x1d')]],'as':_0x2960c5['as'],'attributes':_0x2960c5[_0xeca6('0x19')],'include':_0x2960c5[_0xeca6('0x1b')]?_[_0xeca6('0x1c')](_0x2960c5[_0xeca6('0x1b')],function(_0x5df739){return{'model':db[_0x5df739['model']],'as':_0x5df739['as'],'attributes':_0x5df739['attributes'],'include':_0x5df739['include']?_[_0xeca6('0x1c')](_0x5df739[_0xeca6('0x1b')],function(_0x2a561e){return{'model':db[_0x2a561e['model']],'as':_0x2a561e['as'],'attributes':_0x2a561e[_0xeca6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeca6('0xc')](function(_0x2292fe){logger[_0xeca6('0x14')](_0xeca6('0x1e'),_0x848ac4);logger[_0xeca6('0xf')]('GetZohoAccount',_0x848ac4,JSON[_0xeca6('0x1f')](_0x2292fe));_0x1076c9(_0x2292fe);})[_0xeca6('0x20')](function(_0x4cd7f1){logger[_0xeca6('0x11')](_0xeca6('0x1e'),_0x4cd7f1[_0xeca6('0x13')],_0x848ac4);_0x4b2b5e(_0x1ea9e2[_0xeca6('0x11')](0x1f4,_0x4cd7f1[_0xeca6('0x13')]));});});};exports['ShowZohoAccount']=function(_0x43b04a){var _0xd0a5ad=this;return new Promise(function(_0x4914d8,_0x38d605){return db[_0xeca6('0x21')][_0xeca6('0x22')]({'raw':_0x43b04a['options']?_0x43b04a[_0xeca6('0x17')][_0xeca6('0x23')]===undefined?!![]:![]:!![],'where':_0x43b04a[_0xeca6('0x17')]?_0x43b04a[_0xeca6('0x17')][_0xeca6('0x18')]||null:null,'attributes':_0x43b04a[_0xeca6('0x17')]?_0x43b04a['options'][_0xeca6('0x19')]||null:null,'include':_0x43b04a[_0xeca6('0x17')]?_0x43b04a[_0xeca6('0x17')][_0xeca6('0x1b')]?_[_0xeca6('0x1c')](_0x43b04a[_0xeca6('0x17')][_0xeca6('0x1b')],function(_0x1003f7){return{'model':db[_0x1003f7[_0xeca6('0x1d')]],'as':_0x1003f7['as'],'attributes':_0x1003f7[_0xeca6('0x19')],'include':_0x1003f7[_0xeca6('0x1b')]?_[_0xeca6('0x1c')](_0x1003f7[_0xeca6('0x1b')],function(_0x4c78b3){return{'model':db[_0x4c78b3[_0xeca6('0x1d')]],'as':_0x4c78b3['as'],'attributes':_0x4c78b3[_0xeca6('0x19')],'include':_0x4c78b3[_0xeca6('0x1b')]?_['map'](_0x4c78b3[_0xeca6('0x1b')],function(_0x452679){return{'model':db[_0x452679[_0xeca6('0x1d')]],'as':_0x452679['as'],'attributes':_0x452679[_0xeca6('0x19')]};}):[]};}):[]};}):[]:[]})[_0xeca6('0xc')](function(_0x27a29a){logger[_0xeca6('0x14')]('ShowZohoAccount',_0x43b04a);logger[_0xeca6('0xf')](_0xeca6('0x24'),_0x43b04a,JSON[_0xeca6('0x1f')](_0x27a29a));_0x4914d8(_0x27a29a);})[_0xeca6('0x20')](function(_0x4c8b12){logger['error']('ShowZohoAccount',_0x4c8b12[_0xeca6('0x13')],_0x43b04a);_0x38d605(_0xd0a5ad[_0xeca6('0x11')](0x1f4,_0x4c8b12[_0xeca6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9f3104b..c4adcac 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 _0xa3b4=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','exports','multer'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xa3b4,0x1e3));var _0x4a3b=function(_0x57a860,_0x1a79f6){_0x57a860=_0x57a860-0x0;var _0x180861=_0xa3b4[_0x57a860];return _0x180861;};'use strict';var multer=require(_0x4a3b('0x0'));var util=require(_0x4a3b('0x1'));var path=require(_0x4a3b('0x2'));var timeout=require(_0x4a3b('0x3'));var express=require(_0x4a3b('0x4'));var router=express[_0x4a3b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4a3b('0x6'));var interaction=require(_0x4a3b('0x7'));var config=require(_0x4a3b('0x8'));var controller=require(_0x4a3b('0x9'));router[_0x4a3b('0xa')]('/',auth[_0x4a3b('0xb')](),controller[_0x4a3b('0xc')]);router['get'](_0x4a3b('0xd'),auth['isAuthenticated'](),controller['show']);router['get'](_0x4a3b('0xe'),auth['isAuthenticated'](),controller[_0x4a3b('0xf')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0x4a3b('0x10')]);router[_0x4a3b('0xa')](_0x4a3b('0x11'),auth['isAuthenticated'](),controller[_0x4a3b('0x12')]);router[_0x4a3b('0x13')]('/',auth['isAuthenticated'](),controller[_0x4a3b('0x14')]);router['put'](_0x4a3b('0xd'),auth[_0x4a3b('0xb')](),controller['update']);router['delete'](_0x4a3b('0xd'),auth[_0x4a3b('0xb')](),controller['destroy']);module[_0x4a3b('0x15')]=router; \ No newline at end of file +var _0x34ca=['/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x4b1470,_0x34beaf){var _0x201f80=function(_0x1d99bc){while(--_0x1d99bc){_0x4b1470['push'](_0x4b1470['shift']());}};_0x201f80(++_0x34beaf);}(_0x34ca,0xf0));var _0xa34c=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x34ca[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0xa34c('0x0'));var util=require(_0xa34c('0x1'));var path=require(_0xa34c('0x2'));var timeout=require(_0xa34c('0x3'));var express=require(_0xa34c('0x4'));var router=express[_0xa34c('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa34c('0x6'));var config=require(_0xa34c('0x7'));var controller=require(_0xa34c('0x8'));router[_0xa34c('0x9')]('/',auth[_0xa34c('0xa')](),controller[_0xa34c('0xb')]);router[_0xa34c('0x9')]('/:id',auth[_0xa34c('0xa')](),controller[_0xa34c('0xc')]);router[_0xa34c('0x9')](_0xa34c('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xa34c('0xe'),auth[_0xa34c('0xa')](),controller['getSubjects']);router[_0xa34c('0x9')](_0xa34c('0xf'),auth[_0xa34c('0xa')](),controller[_0xa34c('0x10')]);router['post']('/',auth[_0xa34c('0xa')](),controller[_0xa34c('0x11')]);router[_0xa34c('0x12')](_0xa34c('0x13'),auth[_0xa34c('0xa')](),controller[_0xa34c('0x14')]);router[_0xa34c('0x15')](_0xa34c('0x13'),auth[_0xa34c('0xa')](),controller['destroy']);module[_0xa34c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 158c457..d9c5164 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 _0x6787=['STRING','nothing','ENUM','contact_lead','contact','sequelize','exports'];(function(_0x43a96d,_0x216a3f){var _0x59872f=function(_0x5eab9c){while(--_0x5eab9c){_0x43a96d['push'](_0x43a96d['shift']());}};_0x59872f(++_0x216a3f);}(_0x6787,0xb4));var _0x7678=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x6787[_0x56482c];return _0x5aae7a;};'use strict';var Sequelize=require(_0x7678('0x0'));module[_0x7678('0x1')]={'name':{'type':Sequelize[_0x7678('0x2')]},'moduleCreate':{'type':Sequelize['ENUM']('lead','contact',_0x7678('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x7678('0x4')](_0x7678('0x5'),_0x7678('0x6'),'lead'),'defaultValue':_0x7678('0x5')},'description':{'type':Sequelize[_0x7678('0x2')]}}; \ No newline at end of file +var _0x5ba0=['exports','STRING','ENUM','lead','nothing','contact_lead','sequelize'];(function(_0x9b61ac,_0x39d60c){var _0x47c307=function(_0x4372c5){while(--_0x4372c5){_0x9b61ac['push'](_0x9b61ac['shift']());}};_0x47c307(++_0x39d60c);}(_0x5ba0,0x180));var _0x05ba=function(_0x5b749c,_0x13a44e){_0x5b749c=_0x5b749c-0x0;var _0x2604dc=_0x5ba0[_0x5b749c];return _0x2604dc;};'use strict';var Sequelize=require(_0x05ba('0x0'));module[_0x05ba('0x1')]={'name':{'type':Sequelize[_0x05ba('0x2')]},'moduleCreate':{'type':Sequelize[_0x05ba('0x3')](_0x05ba('0x4'),'contact',_0x05ba('0x5')),'defaultValue':_0x05ba('0x4')},'moduleSearch':{'type':Sequelize[_0x05ba('0x3')](_0x05ba('0x6'),'contact','lead'),'defaultValue':_0x05ba('0x6')},'description':{'type':Sequelize[_0x05ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 413b32b..f5e8b31 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 _0xc8c4=['create','body','getFields','findOne','ZohoField','hasOwnProperty','getSubjects','getDescriptions','zip-dir','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','../../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','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find'];(function(_0x30e222,_0x35c56c){var _0x211242=function(_0x2d5b01){while(--_0x2d5b01){_0x30e222['push'](_0x30e222['shift']());}};_0x211242(++_0x35c56c);}(_0xc8c4,0x164));var _0x4c8c=function(_0x87827a,_0x14a142){_0x87827a=_0x87827a-0x0;var _0x467882=_0xc8c4[_0x87827a];return _0x467882;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4c8c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4c8c('0x1'));var moment=require(_0x4c8c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4c8c('0x3'));var util=require(_0x4c8c('0x4'));var path=require(_0x4c8c('0x5'));var sox=require(_0x4c8c('0x6'));var csv=require(_0x4c8c('0x7'));var ejs=require(_0x4c8c('0x8'));var fs=require('fs');var fs_extra=require(_0x4c8c('0x9'));var _=require(_0x4c8c('0xa'));var squel=require(_0x4c8c('0xb'));var crypto=require(_0x4c8c('0xc'));var jsforce=require(_0x4c8c('0xd'));var deskjs=require(_0x4c8c('0xe'));var toCsv=require(_0x4c8c('0x7'));var querystring=require(_0x4c8c('0xf'));var Papa=require(_0x4c8c('0x10'));var Redis=require(_0x4c8c('0x11'));var authService=require(_0x4c8c('0x12'));var qs=require(_0x4c8c('0x13'));var as=require(_0x4c8c('0x14'));var hardwareService=require(_0x4c8c('0x15'));var logger=require(_0x4c8c('0x16'))(_0x4c8c('0x17'));var utils=require(_0x4c8c('0x18'));var config=require(_0x4c8c('0x19'));var licenseUtil=require(_0x4c8c('0x1a'));var db=require(_0x4c8c('0x1b'))['db'];function respondWithStatusCode(_0x1eeff9,_0x496efd){_0x496efd=_0x496efd||0xcc;return function(_0x4723ab){if(_0x4723ab){return _0x1eeff9[_0x4c8c('0x1c')](_0x496efd);}return _0x1eeff9['status'](_0x496efd)[_0x4c8c('0x1d')]();};}function respondWithResult(_0x30b85e,_0x14db80){_0x14db80=_0x14db80||0xc8;return function(_0x9ac223){if(_0x9ac223){return _0x30b85e[_0x4c8c('0x1e')](_0x14db80)[_0x4c8c('0x1f')](_0x9ac223);}};}function respondWithFilteredResult(_0x5860fe,_0x26e2c5){return function(_0x40c0cc){if(_0x40c0cc){var _0x5a628c=typeof _0x26e2c5[_0x4c8c('0x20')]===_0x4c8c('0x21')&&typeof _0x26e2c5['limit']==='undefined';var _0x5e0608=_0x40c0cc[_0x4c8c('0x22')];var _0x14cb84=_0x5a628c?0x0:_0x26e2c5[_0x4c8c('0x20')];var _0x5857e7=_0x5a628c?_0x40c0cc[_0x4c8c('0x22')]:_0x26e2c5[_0x4c8c('0x20')]+_0x26e2c5[_0x4c8c('0x23')];var _0x20e04f;if(_0x5857e7>=_0x5e0608){_0x5857e7=_0x5e0608;_0x20e04f=0xc8;}else{_0x20e04f=0xce;}_0x5860fe[_0x4c8c('0x1e')](_0x20e04f);return _0x5860fe[_0x4c8c('0x24')](_0x4c8c('0x25'),_0x14cb84+'-'+_0x5857e7+'/'+_0x5e0608)[_0x4c8c('0x1f')](_0x40c0cc);}return null;};}function patchUpdates(_0x26732f){return function(_0xa00ef6){try{jsonpatch[_0x4c8c('0x26')](_0xa00ef6,_0x26732f,!![]);}catch(_0x5b563a){return BPromise[_0x4c8c('0x27')](_0x5b563a);}return _0xa00ef6[_0x4c8c('0x28')]();};}function saveUpdates(_0x52e159,_0x4987bc){return function(_0xa36d73){if(_0xa36d73){return _0xa36d73[_0x4c8c('0x29')](_0x52e159)[_0x4c8c('0x2a')](function(_0x2349c9){return _0x2349c9;});}return null;};}function removeEntity(_0x44aaf0,_0x3423b1){return function(_0x2f9c60){if(_0x2f9c60){return _0x2f9c60['destroy']()[_0x4c8c('0x2a')](function(){_0x44aaf0[_0x4c8c('0x1e')](0xcc)[_0x4c8c('0x1d')]();});}};}function handleEntityNotFound(_0x352af6,_0x43f0cb){return function(_0x3d1f92){if(!_0x3d1f92){_0x352af6[_0x4c8c('0x1c')](0x194);}return _0x3d1f92;};}function handleError(_0x524206,_0x169347){_0x169347=_0x169347||0x1f4;return function(_0x3abf28){logger[_0x4c8c('0x2b')](_0x3abf28[_0x4c8c('0x2c')]);if(_0x3abf28[_0x4c8c('0x2d')]){delete _0x3abf28[_0x4c8c('0x2d')];}_0x524206[_0x4c8c('0x1e')](_0x169347)[_0x4c8c('0x2e')](_0x3abf28);};}exports[_0x4c8c('0x2f')]=function(_0x4131c6,_0xa27be1){var _0x332bda={},_0x51d445={},_0x2c8cd1={'count':0x0,'rows':[]};var _0x2b51b8=_[_0x4c8c('0x30')](db[_0x4c8c('0x31')][_0x4c8c('0x32')],function(_0x572f06){return{'name':_0x572f06[_0x4c8c('0x33')],'type':_0x572f06['type'][_0x4c8c('0x34')]};});_0x51d445[_0x4c8c('0x35')]=_[_0x4c8c('0x30')](_0x2b51b8,_0x4c8c('0x2d'));_0x51d445[_0x4c8c('0x36')]=_[_0x4c8c('0x37')](_0x4131c6[_0x4c8c('0x36')]);_0x51d445['filters']=_['intersection'](_0x51d445[_0x4c8c('0x35')],_0x51d445[_0x4c8c('0x36')]);_0x332bda[_0x4c8c('0x38')]=_[_0x4c8c('0x39')](_0x51d445[_0x4c8c('0x35')],qs[_0x4c8c('0x3a')](_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x3a')]));_0x332bda[_0x4c8c('0x38')]=_0x332bda[_0x4c8c('0x38')][_0x4c8c('0x3b')]?_0x332bda[_0x4c8c('0x38')]:_0x51d445[_0x4c8c('0x35')];if(!_0x4131c6[_0x4c8c('0x36')]['hasOwnProperty'](_0x4c8c('0x3c'))){_0x332bda[_0x4c8c('0x23')]=qs['limit'](_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x23')]);_0x332bda['offset']=qs[_0x4c8c('0x20')](_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x20')]);}_0x332bda[_0x4c8c('0x3d')]=qs[_0x4c8c('0x3e')](_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x3e')]);_0x332bda[_0x4c8c('0x3f')]=qs[_0x4c8c('0x40')](_[_0x4c8c('0x41')](_0x4131c6['query'],_0x51d445[_0x4c8c('0x40')]),_0x2b51b8);if(_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x42')]){_0x332bda['where']=_[_0x4c8c('0x43')](_0x332bda[_0x4c8c('0x3f')],{'$or':_[_0x4c8c('0x30')](_0x2b51b8,function(_0x544d34){if(_0x544d34[_0x4c8c('0x44')]!==_0x4c8c('0x45')){var _0x243101={};_0x243101[_0x544d34[_0x4c8c('0x2d')]]={'$like':'%'+_0x4131c6[_0x4c8c('0x36')]['filter']+'%'};return _0x243101;}})});}_0x332bda=_['merge']({},_0x332bda,_0x4131c6[_0x4c8c('0x46')]);var _0x139e11={'where':_0x332bda['where']};return db[_0x4c8c('0x31')][_0x4c8c('0x22')](_0x139e11)[_0x4c8c('0x2a')](function(_0x2fe2ba){_0x2c8cd1[_0x4c8c('0x22')]=_0x2fe2ba;if(_0x4131c6[_0x4c8c('0x36')][_0x4c8c('0x47')]){_0x332bda[_0x4c8c('0x48')]=[{'all':!![]}];}return db[_0x4c8c('0x31')][_0x4c8c('0x49')](_0x332bda);})[_0x4c8c('0x2a')](function(_0x43cba8){_0x2c8cd1[_0x4c8c('0x4a')]=_0x43cba8;return _0x2c8cd1;})[_0x4c8c('0x2a')](respondWithFilteredResult(_0xa27be1,_0x332bda))[_0x4c8c('0x4b')](handleError(_0xa27be1,null));};exports[_0x4c8c('0x4c')]=function(_0xaddcd5,_0x11ae36){var _0x194a5e={'raw':![],'where':{'id':_0xaddcd5[_0x4c8c('0x4d')]['id']}},_0x45207c={};_0x45207c[_0x4c8c('0x35')]=_[_0x4c8c('0x37')](db[_0x4c8c('0x31')][_0x4c8c('0x32')]);_0x45207c[_0x4c8c('0x36')]=_[_0x4c8c('0x37')](_0xaddcd5[_0x4c8c('0x36')]);_0x45207c['filters']=_['intersection'](_0x45207c[_0x4c8c('0x35')],_0x45207c[_0x4c8c('0x36')]);_0x194a5e[_0x4c8c('0x38')]=_[_0x4c8c('0x39')](_0x45207c['model'],qs[_0x4c8c('0x3a')](_0xaddcd5[_0x4c8c('0x36')][_0x4c8c('0x3a')]));_0x194a5e['attributes']=_0x194a5e['attributes'][_0x4c8c('0x3b')]?_0x194a5e[_0x4c8c('0x38')]:_0x45207c[_0x4c8c('0x35')];if(_0xaddcd5[_0x4c8c('0x36')][_0x4c8c('0x47')]){_0x194a5e[_0x4c8c('0x48')]=[{'all':!![]}];}_0x194a5e=_[_0x4c8c('0x43')]({},_0x194a5e,_0xaddcd5[_0x4c8c('0x46')]);return db[_0x4c8c('0x31')][_0x4c8c('0x4e')](_0x194a5e)[_0x4c8c('0x2a')](handleEntityNotFound(_0x11ae36,null))['then'](respondWithResult(_0x11ae36,null))['catch'](handleError(_0x11ae36,null));};exports[_0x4c8c('0x4f')]=function(_0x25f4dc,_0x37e7c6){return db[_0x4c8c('0x31')]['create'](_0x25f4dc[_0x4c8c('0x50')],{})['then'](respondWithResult(_0x37e7c6,0xc9))[_0x4c8c('0x4b')](handleError(_0x37e7c6,null));};exports[_0x4c8c('0x29')]=function(_0x45fc92,_0x4c2e42){if(_0x45fc92[_0x4c8c('0x50')]['id']){delete _0x45fc92[_0x4c8c('0x50')]['id'];}return db[_0x4c8c('0x31')]['find']({'where':{'id':_0x45fc92[_0x4c8c('0x4d')]['id']}})[_0x4c8c('0x2a')](handleEntityNotFound(_0x4c2e42,null))[_0x4c8c('0x2a')](saveUpdates(_0x45fc92[_0x4c8c('0x50')],null))['then'](respondWithResult(_0x4c2e42,null))[_0x4c8c('0x4b')](handleError(_0x4c2e42,null));};exports['destroy']=function(_0xed77da,_0x4cbd1f){return db[_0x4c8c('0x31')][_0x4c8c('0x4e')]({'where':{'id':_0xed77da[_0x4c8c('0x4d')]['id']}})[_0x4c8c('0x2a')](handleEntityNotFound(_0x4cbd1f,null))[_0x4c8c('0x2a')](removeEntity(_0x4cbd1f,null))[_0x4c8c('0x4b')](handleError(_0x4cbd1f,null));};exports[_0x4c8c('0x51')]=function(_0x52ec55,_0x2ea290,_0x25853b){var _0x476535={};var _0x5ddb5a={};var _0x403765;var _0x23c067;return db['ZohoConfiguration'][_0x4c8c('0x52')]({'where':{'id':_0x52ec55[_0x4c8c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2ea290,null))[_0x4c8c('0x2a')](function(_0x392538){if(_0x392538){_0x403765=_0x392538;_0x5ddb5a[_0x4c8c('0x35')]=_[_0x4c8c('0x37')](db[_0x4c8c('0x53')][_0x4c8c('0x32')]);_0x5ddb5a[_0x4c8c('0x36')]=_[_0x4c8c('0x37')](_0x52ec55[_0x4c8c('0x36')]);_0x5ddb5a[_0x4c8c('0x40')]=_[_0x4c8c('0x39')](_0x5ddb5a['model'],_0x5ddb5a[_0x4c8c('0x36')]);_0x476535['attributes']=_[_0x4c8c('0x39')](_0x5ddb5a[_0x4c8c('0x35')],qs[_0x4c8c('0x3a')](_0x52ec55[_0x4c8c('0x36')][_0x4c8c('0x3a')]));_0x476535[_0x4c8c('0x38')]=_0x476535['attributes'][_0x4c8c('0x3b')]?_0x476535[_0x4c8c('0x38')]:_0x5ddb5a[_0x4c8c('0x35')];_0x476535[_0x4c8c('0x3d')]=qs[_0x4c8c('0x3e')](_0x52ec55['query']['sort']);_0x476535['where']=qs[_0x4c8c('0x40')](_[_0x4c8c('0x41')](_0x52ec55[_0x4c8c('0x36')],_0x5ddb5a[_0x4c8c('0x40')]));if(_0x52ec55[_0x4c8c('0x36')][_0x4c8c('0x42')]){_0x476535['where']=_[_0x4c8c('0x43')](_0x476535[_0x4c8c('0x3f')],{'$or':_['map'](_0x476535[_0x4c8c('0x38')],function(_0x1c77e1){var _0x31d391={};_0x31d391[_0x1c77e1]={'$like':'%'+_0x52ec55[_0x4c8c('0x36')][_0x4c8c('0x42')]+'%'};return _0x31d391;})});}_0x476535=_[_0x4c8c('0x43')]({},_0x476535,_0x52ec55[_0x4c8c('0x46')]);return _0x403765['getFields'](_0x476535);}})[_0x4c8c('0x2a')](function(_0x5ba9d9){if(_0x5ba9d9){_0x23c067=_0x5ba9d9[_0x4c8c('0x3b')];if(!_0x52ec55['query'][_0x4c8c('0x54')](_0x4c8c('0x3c'))){_0x476535['limit']=qs['limit'](_0x52ec55[_0x4c8c('0x36')]['limit']);_0x476535[_0x4c8c('0x20')]=qs[_0x4c8c('0x20')](_0x52ec55[_0x4c8c('0x36')][_0x4c8c('0x20')]);}return _0x403765[_0x4c8c('0x51')](_0x476535);}})[_0x4c8c('0x2a')](function(_0x3bf127){if(_0x3bf127){return _0x3bf127?{'count':_0x23c067,'rows':_0x3bf127}:null;}})[_0x4c8c('0x2a')](respondWithResult(_0x2ea290,null))[_0x4c8c('0x4b')](handleError(_0x2ea290,null));};exports[_0x4c8c('0x55')]=function(_0x434a98,_0x3537f3,_0x53949f){var _0xd7ffa2={};var _0x59cd9d={};var _0x3c07ab;var _0x32d652;return db[_0x4c8c('0x31')]['findOne']({'where':{'id':_0x434a98[_0x4c8c('0x4d')]['id']}})[_0x4c8c('0x2a')](handleEntityNotFound(_0x3537f3,null))[_0x4c8c('0x2a')](function(_0x3d9e64){if(_0x3d9e64){_0x3c07ab=_0x3d9e64;_0x59cd9d['model']=_['keys'](db[_0x4c8c('0x53')][_0x4c8c('0x32')]);_0x59cd9d['query']=_[_0x4c8c('0x37')](_0x434a98[_0x4c8c('0x36')]);_0x59cd9d[_0x4c8c('0x40')]=_[_0x4c8c('0x39')](_0x59cd9d[_0x4c8c('0x35')],_0x59cd9d[_0x4c8c('0x36')]);_0xd7ffa2[_0x4c8c('0x38')]=_[_0x4c8c('0x39')](_0x59cd9d[_0x4c8c('0x35')],qs[_0x4c8c('0x3a')](_0x434a98[_0x4c8c('0x36')]['fields']));_0xd7ffa2[_0x4c8c('0x38')]=_0xd7ffa2[_0x4c8c('0x38')][_0x4c8c('0x3b')]?_0xd7ffa2[_0x4c8c('0x38')]:_0x59cd9d[_0x4c8c('0x35')];_0xd7ffa2[_0x4c8c('0x3d')]=qs['sort'](_0x434a98[_0x4c8c('0x36')]['sort']);_0xd7ffa2[_0x4c8c('0x3f')]=qs['filters'](_['pick'](_0x434a98['query'],_0x59cd9d[_0x4c8c('0x40')]));if(_0x434a98[_0x4c8c('0x36')][_0x4c8c('0x42')]){_0xd7ffa2['where']=_['merge'](_0xd7ffa2[_0x4c8c('0x3f')],{'$or':_[_0x4c8c('0x30')](_0xd7ffa2[_0x4c8c('0x38')],function(_0x160980){var _0xfcd338={};_0xfcd338[_0x160980]={'$like':'%'+_0x434a98[_0x4c8c('0x36')][_0x4c8c('0x42')]+'%'};return _0xfcd338;})});}_0xd7ffa2=_[_0x4c8c('0x43')]({},_0xd7ffa2,_0x434a98[_0x4c8c('0x46')]);return _0x3c07ab[_0x4c8c('0x55')](_0xd7ffa2);}})[_0x4c8c('0x2a')](function(_0x1cbec3){if(_0x1cbec3){_0x32d652=_0x1cbec3[_0x4c8c('0x3b')];if(!_0x434a98[_0x4c8c('0x36')][_0x4c8c('0x54')](_0x4c8c('0x3c'))){_0xd7ffa2[_0x4c8c('0x23')]=qs[_0x4c8c('0x23')](_0x434a98[_0x4c8c('0x36')][_0x4c8c('0x23')]);_0xd7ffa2['offset']=qs[_0x4c8c('0x20')](_0x434a98[_0x4c8c('0x36')][_0x4c8c('0x20')]);}return _0x3c07ab[_0x4c8c('0x55')](_0xd7ffa2);}})[_0x4c8c('0x2a')](function(_0x414e3f){if(_0x414e3f){return _0x414e3f?{'count':_0x32d652,'rows':_0x414e3f}:null;}})['then'](respondWithResult(_0x3537f3,null))[_0x4c8c('0x4b')](handleError(_0x3537f3,null));};exports[_0x4c8c('0x56')]=function(_0x3de679,_0x128fbd,_0x5e58a3){var _0x4c9a88={};var _0x34c4f3={};var _0x32a01c;var _0x5be6cd;return db[_0x4c8c('0x31')][_0x4c8c('0x52')]({'where':{'id':_0x3de679[_0x4c8c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x128fbd,null))['then'](function(_0x17a032){if(_0x17a032){_0x32a01c=_0x17a032;_0x34c4f3[_0x4c8c('0x35')]=_[_0x4c8c('0x37')](db[_0x4c8c('0x53')][_0x4c8c('0x32')]);_0x34c4f3[_0x4c8c('0x36')]=_[_0x4c8c('0x37')](_0x3de679[_0x4c8c('0x36')]);_0x34c4f3[_0x4c8c('0x40')]=_[_0x4c8c('0x39')](_0x34c4f3[_0x4c8c('0x35')],_0x34c4f3[_0x4c8c('0x36')]);_0x4c9a88[_0x4c8c('0x38')]=_[_0x4c8c('0x39')](_0x34c4f3['model'],qs['fields'](_0x3de679[_0x4c8c('0x36')][_0x4c8c('0x3a')]));_0x4c9a88[_0x4c8c('0x38')]=_0x4c9a88[_0x4c8c('0x38')][_0x4c8c('0x3b')]?_0x4c9a88[_0x4c8c('0x38')]:_0x34c4f3['model'];_0x4c9a88[_0x4c8c('0x3d')]=qs[_0x4c8c('0x3e')](_0x3de679[_0x4c8c('0x36')][_0x4c8c('0x3e')]);_0x4c9a88[_0x4c8c('0x3f')]=qs[_0x4c8c('0x40')](_[_0x4c8c('0x41')](_0x3de679[_0x4c8c('0x36')],_0x34c4f3['filters']));if(_0x3de679[_0x4c8c('0x36')][_0x4c8c('0x42')]){_0x4c9a88[_0x4c8c('0x3f')]=_[_0x4c8c('0x43')](_0x4c9a88[_0x4c8c('0x3f')],{'$or':_[_0x4c8c('0x30')](_0x4c9a88['attributes'],function(_0x3a2981){var _0x4c00ac={};_0x4c00ac[_0x3a2981]={'$like':'%'+_0x3de679[_0x4c8c('0x36')][_0x4c8c('0x42')]+'%'};return _0x4c00ac;})});}_0x4c9a88=_['merge']({},_0x4c9a88,_0x3de679[_0x4c8c('0x46')]);return _0x32a01c[_0x4c8c('0x56')](_0x4c9a88);}})['then'](function(_0x3f597c){if(_0x3f597c){_0x5be6cd=_0x3f597c[_0x4c8c('0x3b')];if(!_0x3de679['query'][_0x4c8c('0x54')]('nolimit')){_0x4c9a88['limit']=qs['limit'](_0x3de679[_0x4c8c('0x36')]['limit']);_0x4c9a88[_0x4c8c('0x20')]=qs[_0x4c8c('0x20')](_0x3de679[_0x4c8c('0x36')][_0x4c8c('0x20')]);}return _0x32a01c[_0x4c8c('0x56')](_0x4c9a88);}})[_0x4c8c('0x2a')](function(_0xc8ae46){if(_0xc8ae46){return _0xc8ae46?{'count':_0x5be6cd,'rows':_0xc8ae46}:null;}})[_0x4c8c('0x2a')](respondWithResult(_0x128fbd,null))[_0x4c8c('0x4b')](handleError(_0x128fbd,null));}; \ No newline at end of file +var _0x5913=['getFields','findOne','ZohoField','pick','nolimit','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','fs-extra','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','stack','index','ZohoConfiguration','rawAttributes','model','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','update','body','params'];(function(_0x2453e0,_0x543bed){var _0x5c659a=function(_0x429422){while(--_0x429422){_0x2453e0['push'](_0x2453e0['shift']());}};_0x5c659a(++_0x543bed);}(_0x5913,0xa5));var _0x3591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5913[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x3591('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3591('0x1'));var jsonpatch=require(_0x3591('0x2'));var rp=require('request-promise');var moment=require(_0x3591('0x3'));var BPromise=require(_0x3591('0x4'));var Mustache=require(_0x3591('0x5'));var util=require('util');var path=require(_0x3591('0x6'));var sox=require(_0x3591('0x7'));var csv=require(_0x3591('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3591('0x9'));var _=require('lodash');var squel=require(_0x3591('0xa'));var crypto=require(_0x3591('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3591('0x8'));var querystring=require(_0x3591('0xc'));var Papa=require('papaparse');var Redis=require(_0x3591('0xd'));var authService=require(_0x3591('0xe'));var qs=require(_0x3591('0xf'));var as=require(_0x3591('0x10'));var hardwareService=require(_0x3591('0x11'));var logger=require(_0x3591('0x12'))(_0x3591('0x13'));var utils=require(_0x3591('0x14'));var config=require(_0x3591('0x15'));var licenseUtil=require(_0x3591('0x16'));var db=require(_0x3591('0x17'))['db'];function respondWithStatusCode(_0x256fe6,_0x2a1685){_0x2a1685=_0x2a1685||0xcc;return function(_0x296a56){if(_0x296a56){return _0x256fe6[_0x3591('0x18')](_0x2a1685);}return _0x256fe6[_0x3591('0x19')](_0x2a1685)[_0x3591('0x1a')]();};}function respondWithResult(_0x205cae,_0x38d593){_0x38d593=_0x38d593||0xc8;return function(_0x12f876){if(_0x12f876){return _0x205cae[_0x3591('0x19')](_0x38d593)[_0x3591('0x1b')](_0x12f876);}};}function respondWithFilteredResult(_0x5f12d4,_0x20a194){return function(_0x9d433b){if(_0x9d433b){var _0x132697=typeof _0x20a194[_0x3591('0x1c')]===_0x3591('0x1d')&&typeof _0x20a194['limit']==='undefined';var _0xb9969=_0x9d433b[_0x3591('0x1e')];var _0x7571f4=_0x132697?0x0:_0x20a194[_0x3591('0x1c')];var _0x2d6094=_0x132697?_0x9d433b[_0x3591('0x1e')]:_0x20a194[_0x3591('0x1c')]+_0x20a194[_0x3591('0x1f')];var _0x1c42bd;if(_0x2d6094>=_0xb9969){_0x2d6094=_0xb9969;_0x1c42bd=0xc8;}else{_0x1c42bd=0xce;}_0x5f12d4[_0x3591('0x19')](_0x1c42bd);return _0x5f12d4[_0x3591('0x20')](_0x3591('0x21'),_0x7571f4+'-'+_0x2d6094+'/'+_0xb9969)['json'](_0x9d433b);}return null;};}function patchUpdates(_0x885c17){return function(_0x38a3c5){try{jsonpatch[_0x3591('0x22')](_0x38a3c5,_0x885c17,!![]);}catch(_0x2e1e60){return BPromise[_0x3591('0x23')](_0x2e1e60);}return _0x38a3c5[_0x3591('0x24')]();};}function saveUpdates(_0x25ea46,_0x33ecae){return function(_0x49d318){if(_0x49d318){return _0x49d318['update'](_0x25ea46)['then'](function(_0x264f2e){return _0x264f2e;});}return null;};}function removeEntity(_0x49c7dc,_0x46e96a){return function(_0x5cd739){if(_0x5cd739){return _0x5cd739[_0x3591('0x25')]()[_0x3591('0x26')](function(){_0x49c7dc[_0x3591('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a3c1d,_0x20b387){return function(_0x216d73){if(!_0x216d73){_0x5a3c1d['sendStatus'](0x194);}return _0x216d73;};}function handleError(_0x47934c,_0x40f918){_0x40f918=_0x40f918||0x1f4;return function(_0xfd1a02){logger['error'](_0xfd1a02[_0x3591('0x27')]);if(_0xfd1a02['name']){delete _0xfd1a02['name'];}_0x47934c[_0x3591('0x19')](_0x40f918)['send'](_0xfd1a02);};}exports[_0x3591('0x28')]=function(_0x28b6e5,_0x2980d9){var _0x452277={},_0x387f32={},_0x5461d6={'count':0x0,'rows':[]};var _0x6c7ef7=_['map'](db[_0x3591('0x29')][_0x3591('0x2a')],function(_0x7cc4f1){return{'name':_0x7cc4f1['fieldName'],'type':_0x7cc4f1['type']['key']};});_0x387f32[_0x3591('0x2b')]=_['map'](_0x6c7ef7,_0x3591('0x2c'));_0x387f32[_0x3591('0x2d')]=_[_0x3591('0x2e')](_0x28b6e5[_0x3591('0x2d')]);_0x387f32['filters']=_[_0x3591('0x2f')](_0x387f32[_0x3591('0x2b')],_0x387f32[_0x3591('0x2d')]);_0x452277[_0x3591('0x30')]=_[_0x3591('0x2f')](_0x387f32[_0x3591('0x2b')],qs['fields'](_0x28b6e5[_0x3591('0x2d')][_0x3591('0x31')]));_0x452277[_0x3591('0x30')]=_0x452277[_0x3591('0x30')][_0x3591('0x32')]?_0x452277[_0x3591('0x30')]:_0x387f32[_0x3591('0x2b')];if(!_0x28b6e5[_0x3591('0x2d')][_0x3591('0x33')]('nolimit')){_0x452277[_0x3591('0x1f')]=qs[_0x3591('0x1f')](_0x28b6e5[_0x3591('0x2d')]['limit']);_0x452277[_0x3591('0x1c')]=qs['offset'](_0x28b6e5[_0x3591('0x2d')][_0x3591('0x1c')]);}_0x452277[_0x3591('0x34')]=qs[_0x3591('0x35')](_0x28b6e5[_0x3591('0x2d')][_0x3591('0x35')]);_0x452277[_0x3591('0x36')]=qs[_0x3591('0x37')](_['pick'](_0x28b6e5[_0x3591('0x2d')],_0x387f32['filters']),_0x6c7ef7);if(_0x28b6e5[_0x3591('0x2d')][_0x3591('0x38')]){_0x452277['where']=_[_0x3591('0x39')](_0x452277[_0x3591('0x36')],{'$or':_[_0x3591('0x3a')](_0x6c7ef7,function(_0x58ec28){if(_0x58ec28['type']!==_0x3591('0x3b')){var _0x2e5477={};_0x2e5477[_0x58ec28[_0x3591('0x2c')]]={'$like':'%'+_0x28b6e5[_0x3591('0x2d')][_0x3591('0x38')]+'%'};return _0x2e5477;}})});}_0x452277=_[_0x3591('0x39')]({},_0x452277,_0x28b6e5[_0x3591('0x3c')]);var _0x44f90c={'where':_0x452277['where']};return db[_0x3591('0x29')][_0x3591('0x1e')](_0x44f90c)[_0x3591('0x26')](function(_0x3039b4){_0x5461d6[_0x3591('0x1e')]=_0x3039b4;if(_0x28b6e5['query'][_0x3591('0x3d')]){_0x452277[_0x3591('0x3e')]=[{'all':!![]}];}return db[_0x3591('0x29')][_0x3591('0x3f')](_0x452277);})[_0x3591('0x26')](function(_0x403dc3){_0x5461d6[_0x3591('0x40')]=_0x403dc3;return _0x5461d6;})['then'](respondWithFilteredResult(_0x2980d9,_0x452277))[_0x3591('0x41')](handleError(_0x2980d9,null));};exports[_0x3591('0x42')]=function(_0x5b7a9c,_0x4f676a){var _0x5f3cb2={'raw':![],'where':{'id':_0x5b7a9c['params']['id']}},_0xb17b63={};_0xb17b63['model']=_[_0x3591('0x2e')](db[_0x3591('0x29')][_0x3591('0x2a')]);_0xb17b63[_0x3591('0x2d')]=_[_0x3591('0x2e')](_0x5b7a9c[_0x3591('0x2d')]);_0xb17b63[_0x3591('0x37')]=_['intersection'](_0xb17b63['model'],_0xb17b63[_0x3591('0x2d')]);_0x5f3cb2[_0x3591('0x30')]=_[_0x3591('0x2f')](_0xb17b63[_0x3591('0x2b')],qs[_0x3591('0x31')](_0x5b7a9c[_0x3591('0x2d')]['fields']));_0x5f3cb2['attributes']=_0x5f3cb2[_0x3591('0x30')]['length']?_0x5f3cb2[_0x3591('0x30')]:_0xb17b63['model'];if(_0x5b7a9c[_0x3591('0x2d')][_0x3591('0x3d')]){_0x5f3cb2[_0x3591('0x3e')]=[{'all':!![]}];}_0x5f3cb2=_[_0x3591('0x39')]({},_0x5f3cb2,_0x5b7a9c[_0x3591('0x3c')]);return db[_0x3591('0x29')][_0x3591('0x43')](_0x5f3cb2)[_0x3591('0x26')](handleEntityNotFound(_0x4f676a,null))['then'](respondWithResult(_0x4f676a,null))[_0x3591('0x41')](handleError(_0x4f676a,null));};exports[_0x3591('0x44')]=function(_0x3d4027,_0x190a29){return db[_0x3591('0x29')]['create'](_0x3d4027['body'],{})[_0x3591('0x26')](respondWithResult(_0x190a29,0xc9))['catch'](handleError(_0x190a29,null));};exports[_0x3591('0x45')]=function(_0x5cee97,_0x4a951e){if(_0x5cee97['body']['id']){delete _0x5cee97[_0x3591('0x46')]['id'];}return db[_0x3591('0x29')]['find']({'where':{'id':_0x5cee97[_0x3591('0x47')]['id']}})[_0x3591('0x26')](handleEntityNotFound(_0x4a951e,null))[_0x3591('0x26')](saveUpdates(_0x5cee97['body'],null))[_0x3591('0x26')](respondWithResult(_0x4a951e,null))[_0x3591('0x41')](handleError(_0x4a951e,null));};exports[_0x3591('0x25')]=function(_0x400522,_0x57a5db){return db[_0x3591('0x29')][_0x3591('0x43')]({'where':{'id':_0x400522[_0x3591('0x47')]['id']}})[_0x3591('0x26')](handleEntityNotFound(_0x57a5db,null))[_0x3591('0x26')](removeEntity(_0x57a5db,null))[_0x3591('0x41')](handleError(_0x57a5db,null));};exports[_0x3591('0x48')]=function(_0x4d681d,_0x47d24b,_0x1f8b09){var _0x5d4d59={};var _0x21894f={};var _0x27b6eb;var _0x39247b;return db['ZohoConfiguration'][_0x3591('0x49')]({'where':{'id':_0x4d681d[_0x3591('0x47')]['id']}})['then'](handleEntityNotFound(_0x47d24b,null))[_0x3591('0x26')](function(_0x4ca48b){if(_0x4ca48b){_0x27b6eb=_0x4ca48b;_0x21894f['model']=_[_0x3591('0x2e')](db[_0x3591('0x4a')][_0x3591('0x2a')]);_0x21894f[_0x3591('0x2d')]=_[_0x3591('0x2e')](_0x4d681d[_0x3591('0x2d')]);_0x21894f[_0x3591('0x37')]=_[_0x3591('0x2f')](_0x21894f[_0x3591('0x2b')],_0x21894f[_0x3591('0x2d')]);_0x5d4d59[_0x3591('0x30')]=_[_0x3591('0x2f')](_0x21894f[_0x3591('0x2b')],qs[_0x3591('0x31')](_0x4d681d[_0x3591('0x2d')][_0x3591('0x31')]));_0x5d4d59['attributes']=_0x5d4d59['attributes'][_0x3591('0x32')]?_0x5d4d59[_0x3591('0x30')]:_0x21894f[_0x3591('0x2b')];_0x5d4d59[_0x3591('0x34')]=qs[_0x3591('0x35')](_0x4d681d[_0x3591('0x2d')][_0x3591('0x35')]);_0x5d4d59[_0x3591('0x36')]=qs[_0x3591('0x37')](_[_0x3591('0x4b')](_0x4d681d['query'],_0x21894f[_0x3591('0x37')]));if(_0x4d681d['query'][_0x3591('0x38')]){_0x5d4d59[_0x3591('0x36')]=_['merge'](_0x5d4d59[_0x3591('0x36')],{'$or':_['map'](_0x5d4d59[_0x3591('0x30')],function(_0x3f8b06){var _0x3a2ac3={};_0x3a2ac3[_0x3f8b06]={'$like':'%'+_0x4d681d[_0x3591('0x2d')]['filter']+'%'};return _0x3a2ac3;})});}_0x5d4d59=_[_0x3591('0x39')]({},_0x5d4d59,_0x4d681d[_0x3591('0x3c')]);return _0x27b6eb[_0x3591('0x48')](_0x5d4d59);}})[_0x3591('0x26')](function(_0x3bd479){if(_0x3bd479){_0x39247b=_0x3bd479[_0x3591('0x32')];if(!_0x4d681d['query']['hasOwnProperty'](_0x3591('0x4c'))){_0x5d4d59[_0x3591('0x1f')]=qs[_0x3591('0x1f')](_0x4d681d[_0x3591('0x2d')][_0x3591('0x1f')]);_0x5d4d59[_0x3591('0x1c')]=qs[_0x3591('0x1c')](_0x4d681d[_0x3591('0x2d')][_0x3591('0x1c')]);}return _0x27b6eb[_0x3591('0x48')](_0x5d4d59);}})['then'](function(_0x550932){if(_0x550932){return _0x550932?{'count':_0x39247b,'rows':_0x550932}:null;}})[_0x3591('0x26')](respondWithResult(_0x47d24b,null))[_0x3591('0x41')](handleError(_0x47d24b,null));};exports[_0x3591('0x4d')]=function(_0x38fa7a,_0x49327f,_0x288cec){var _0x17c6ef={};var _0x2eee11={};var _0x2abf3c;var _0x47df23;return db[_0x3591('0x29')][_0x3591('0x49')]({'where':{'id':_0x38fa7a[_0x3591('0x47')]['id']}})['then'](handleEntityNotFound(_0x49327f,null))[_0x3591('0x26')](function(_0x53a6b5){if(_0x53a6b5){_0x2abf3c=_0x53a6b5;_0x2eee11[_0x3591('0x2b')]=_[_0x3591('0x2e')](db['ZohoField'][_0x3591('0x2a')]);_0x2eee11[_0x3591('0x2d')]=_[_0x3591('0x2e')](_0x38fa7a[_0x3591('0x2d')]);_0x2eee11[_0x3591('0x37')]=_['intersection'](_0x2eee11['model'],_0x2eee11['query']);_0x17c6ef[_0x3591('0x30')]=_['intersection'](_0x2eee11[_0x3591('0x2b')],qs[_0x3591('0x31')](_0x38fa7a[_0x3591('0x2d')]['fields']));_0x17c6ef[_0x3591('0x30')]=_0x17c6ef[_0x3591('0x30')][_0x3591('0x32')]?_0x17c6ef[_0x3591('0x30')]:_0x2eee11[_0x3591('0x2b')];_0x17c6ef[_0x3591('0x34')]=qs[_0x3591('0x35')](_0x38fa7a[_0x3591('0x2d')][_0x3591('0x35')]);_0x17c6ef[_0x3591('0x36')]=qs['filters'](_[_0x3591('0x4b')](_0x38fa7a[_0x3591('0x2d')],_0x2eee11[_0x3591('0x37')]));if(_0x38fa7a[_0x3591('0x2d')][_0x3591('0x38')]){_0x17c6ef[_0x3591('0x36')]=_[_0x3591('0x39')](_0x17c6ef[_0x3591('0x36')],{'$or':_[_0x3591('0x3a')](_0x17c6ef[_0x3591('0x30')],function(_0x50e74e){var _0x576947={};_0x576947[_0x50e74e]={'$like':'%'+_0x38fa7a[_0x3591('0x2d')][_0x3591('0x38')]+'%'};return _0x576947;})});}_0x17c6ef=_['merge']({},_0x17c6ef,_0x38fa7a['options']);return _0x2abf3c['getSubjects'](_0x17c6ef);}})[_0x3591('0x26')](function(_0x69259e){if(_0x69259e){_0x47df23=_0x69259e[_0x3591('0x32')];if(!_0x38fa7a['query'][_0x3591('0x33')](_0x3591('0x4c'))){_0x17c6ef[_0x3591('0x1f')]=qs[_0x3591('0x1f')](_0x38fa7a['query'][_0x3591('0x1f')]);_0x17c6ef['offset']=qs[_0x3591('0x1c')](_0x38fa7a['query'][_0x3591('0x1c')]);}return _0x2abf3c[_0x3591('0x4d')](_0x17c6ef);}})[_0x3591('0x26')](function(_0x418a7a){if(_0x418a7a){return _0x418a7a?{'count':_0x47df23,'rows':_0x418a7a}:null;}})['then'](respondWithResult(_0x49327f,null))[_0x3591('0x41')](handleError(_0x49327f,null));};exports[_0x3591('0x4e')]=function(_0x2885ed,_0x47d05a,_0x138842){var _0x202d98={};var _0x44c8a7={};var _0xff790;var _0x3af08f;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x2885ed[_0x3591('0x47')]['id']}})['then'](handleEntityNotFound(_0x47d05a,null))['then'](function(_0x1e2e32){if(_0x1e2e32){_0xff790=_0x1e2e32;_0x44c8a7['model']=_[_0x3591('0x2e')](db['ZohoField'][_0x3591('0x2a')]);_0x44c8a7[_0x3591('0x2d')]=_['keys'](_0x2885ed[_0x3591('0x2d')]);_0x44c8a7[_0x3591('0x37')]=_[_0x3591('0x2f')](_0x44c8a7[_0x3591('0x2b')],_0x44c8a7['query']);_0x202d98[_0x3591('0x30')]=_[_0x3591('0x2f')](_0x44c8a7[_0x3591('0x2b')],qs[_0x3591('0x31')](_0x2885ed[_0x3591('0x2d')][_0x3591('0x31')]));_0x202d98[_0x3591('0x30')]=_0x202d98[_0x3591('0x30')][_0x3591('0x32')]?_0x202d98[_0x3591('0x30')]:_0x44c8a7[_0x3591('0x2b')];_0x202d98[_0x3591('0x34')]=qs[_0x3591('0x35')](_0x2885ed[_0x3591('0x2d')][_0x3591('0x35')]);_0x202d98[_0x3591('0x36')]=qs[_0x3591('0x37')](_[_0x3591('0x4b')](_0x2885ed[_0x3591('0x2d')],_0x44c8a7[_0x3591('0x37')]));if(_0x2885ed[_0x3591('0x2d')][_0x3591('0x38')]){_0x202d98[_0x3591('0x36')]=_[_0x3591('0x39')](_0x202d98[_0x3591('0x36')],{'$or':_[_0x3591('0x3a')](_0x202d98[_0x3591('0x30')],function(_0x309fe4){var _0x17a051={};_0x17a051[_0x309fe4]={'$like':'%'+_0x2885ed[_0x3591('0x2d')][_0x3591('0x38')]+'%'};return _0x17a051;})});}_0x202d98=_[_0x3591('0x39')]({},_0x202d98,_0x2885ed[_0x3591('0x3c')]);return _0xff790['getDescriptions'](_0x202d98);}})[_0x3591('0x26')](function(_0x5202c2){if(_0x5202c2){_0x3af08f=_0x5202c2[_0x3591('0x32')];if(!_0x2885ed['query'][_0x3591('0x33')](_0x3591('0x4c'))){_0x202d98[_0x3591('0x1f')]=qs[_0x3591('0x1f')](_0x2885ed[_0x3591('0x2d')][_0x3591('0x1f')]);_0x202d98[_0x3591('0x1c')]=qs['offset'](_0x2885ed[_0x3591('0x2d')][_0x3591('0x1c')]);}return _0xff790[_0x3591('0x4e')](_0x202d98);}})[_0x3591('0x26')](function(_0x4883a1){if(_0x4883a1){return _0x4883a1?{'count':_0x3af08f,'rows':_0x4883a1}:null;}})['then'](respondWithResult(_0x47d05a,null))[_0x3591('0x41')](handleError(_0x47d05a,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 62e121a..eb1d25c 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 _0x88f5=['exports','define','ZohoConfiguration','int_zoho_configurations','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xb41dd1,_0x3eec0b){var _0x2fecec=function(_0x1b8939){while(--_0x1b8939){_0xb41dd1['push'](_0xb41dd1['shift']());}};_0x2fecec(++_0x3eec0b);}(_0x88f5,0xac));var _0x588f=function(_0x2fb89a,_0x162740){_0x2fb89a=_0x2fb89a-0x0;var _0x9033dd=_0x88f5[_0x2fb89a];return _0x9033dd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x588f('0x0'))(_0x588f('0x1'));var moment=require(_0x588f('0x2'));var BPromise=require(_0x588f('0x3'));var rp=require(_0x588f('0x4'));var fs=require('fs');var path=require(_0x588f('0x5'));var rimraf=require(_0x588f('0x6'));var config=require(_0x588f('0x7'));var attributes=require('./intZohoConfiguration.attributes');module[_0x588f('0x8')]=function(_0x54895f,_0x191a55){return _0x54895f[_0x588f('0x9')](_0x588f('0xa'),attributes,{'tableName':_0x588f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9359=['ZohoConfiguration','int_zoho_configurations','api','request-promise','path','rimraf','./intZohoConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9359,0x13d));var _0x9935=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9359[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x9935('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9935('0x1'));var fs=require('fs');var path=require(_0x9935('0x2'));var rimraf=require(_0x9935('0x3'));var config=require('../../config/environment');var attributes=require(_0x9935('0x4'));module['exports']=function(_0x22ef67,_0x32818c){return _0x22ef67['define'](_0x9935('0x5'),attributes,{'tableName':_0x9935('0x6'),'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 1907dba..dcb3145 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 _0x2bd9=['rpc','../../config/environment','jayson/promise','http','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x2bd9,0x64));var _0x92bd=function(_0x542047,_0x1f423f){_0x542047=_0x542047-0x0;var _0x3294dd=_0x2bd9[_0x542047];return _0x3294dd;};'use strict';var _=require(_0x92bd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92bd('0x1'));var rs=require(_0x92bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x92bd('0x4'))(_0x92bd('0x5'));var config=require(_0x92bd('0x6'));var jayson=require(_0x92bd('0x7'));var client=jayson['client'][_0x92bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cae6f,_0x5d10a1,_0x4ff8f4){return new BPromise(function(_0x23e989,_0x3172a3){return client[_0x92bd('0x9')](_0x4cae6f,_0x4ff8f4)['then'](function(_0x4b32b1){logger[_0x92bd('0xa')](_0x92bd('0xb'),_0x5d10a1,_0x92bd('0xc'));logger[_0x92bd('0xd')](_0x92bd('0xe'),_0x5d10a1,_0x92bd('0xc'),JSON[_0x92bd('0xf')](_0x4b32b1));if(_0x4b32b1[_0x92bd('0x10')]){if(_0x4b32b1[_0x92bd('0x10')][_0x92bd('0x11')]===0x1f4){logger[_0x92bd('0x10')](_0x92bd('0xb'),_0x5d10a1,_0x4b32b1[_0x92bd('0x10')][_0x92bd('0x12')]);return _0x3172a3(_0x4b32b1[_0x92bd('0x10')][_0x92bd('0x12')]);}logger['error'](_0x92bd('0xb'),_0x5d10a1,_0x4b32b1['error'][_0x92bd('0x12')]);return _0x23e989(_0x4b32b1['error'][_0x92bd('0x12')]);}else{logger[_0x92bd('0xa')](_0x92bd('0xb'),_0x5d10a1,_0x92bd('0xc'));_0x23e989(_0x4b32b1[_0x92bd('0x13')][_0x92bd('0x12')]);}})[_0x92bd('0x14')](function(_0x2f29e6){logger[_0x92bd('0x10')](_0x92bd('0xb'),_0x5d10a1,_0x2f29e6);_0x3172a3(_0x2f29e6);});});} \ No newline at end of file +var _0xd703=['jayson/promise','client','request','then','info','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment'];(function(_0x414a88,_0x321a6d){var _0x2ea54b=function(_0x121a8c){while(--_0x121a8c){_0x414a88['push'](_0x414a88['shift']());}};_0x2ea54b(++_0x321a6d);}(_0xd703,0xca));var _0x3d70=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xd703[_0x1203f];return _0x365f0a;};'use strict';var _=require(_0x3d70('0x0'));var util=require(_0x3d70('0x1'));var moment=require(_0x3d70('0x2'));var BPromise=require(_0x3d70('0x3'));var rs=require(_0x3d70('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3d70('0x5'));var logger=require('../../config/logger')(_0x3d70('0x6'));var config=require(_0x3d70('0x7'));var jayson=require(_0x3d70('0x8'));var client=jayson[_0x3d70('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3624c9,_0x2c3771,_0x556673){return new BPromise(function(_0x167088,_0x445a15){return client[_0x3d70('0xa')](_0x3624c9,_0x556673)[_0x3d70('0xb')](function(_0x5def68){logger[_0x3d70('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c3771,'request\x20sent');logger[_0x3d70('0xd')](_0x3d70('0xe'),_0x2c3771,_0x3d70('0xf'),JSON['stringify'](_0x5def68));if(_0x5def68[_0x3d70('0x10')]){if(_0x5def68[_0x3d70('0x10')][_0x3d70('0x11')]===0x1f4){logger[_0x3d70('0x10')](_0x3d70('0x12'),_0x2c3771,_0x5def68[_0x3d70('0x10')][_0x3d70('0x13')]);return _0x445a15(_0x5def68[_0x3d70('0x10')][_0x3d70('0x13')]);}logger['error'](_0x3d70('0x12'),_0x2c3771,_0x5def68[_0x3d70('0x10')][_0x3d70('0x13')]);return _0x167088(_0x5def68[_0x3d70('0x10')][_0x3d70('0x13')]);}else{logger[_0x3d70('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x2c3771,_0x3d70('0xf'));_0x167088(_0x5def68[_0x3d70('0x14')][_0x3d70('0x13')]);}})['catch'](function(_0x269fe7){logger[_0x3d70('0x10')](_0x3d70('0x12'),_0x2c3771,_0x269fe7);_0x445a15(_0x269fe7);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 8661f90..e5dfa53 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 _0x2ffa=['create','put','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0xb42da0,_0x5e98b4){var _0x4036c7=function(_0x1ca1dc){while(--_0x1ca1dc){_0xb42da0['push'](_0xb42da0['shift']());}};_0x4036c7(++_0x5e98b4);}(_0x2ffa,0x16e));var _0xa2ff=function(_0x150dc8,_0x40952f){_0x150dc8=_0x150dc8-0x0;var _0x5006b8=_0x2ffa[_0x150dc8];return _0x5006b8;};'use strict';var multer=require(_0xa2ff('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa2ff('0x1'));var router=express[_0xa2ff('0x2')]();var fs_extra=require(_0xa2ff('0x3'));var auth=require(_0xa2ff('0x4'));var interaction=require(_0xa2ff('0x5'));var config=require(_0xa2ff('0x6'));var controller=require(_0xa2ff('0x7'));router[_0xa2ff('0x8')]('/',auth['isAuthenticated'](),controller[_0xa2ff('0x9')]);router[_0xa2ff('0x8')](_0xa2ff('0xa'),auth[_0xa2ff('0xb')](),controller[_0xa2ff('0xc')]);router[_0xa2ff('0xd')]('/',auth[_0xa2ff('0xb')](),controller[_0xa2ff('0xe')]);router[_0xa2ff('0xf')](_0xa2ff('0xa'),auth[_0xa2ff('0xb')](),controller[_0xa2ff('0x10')]);router[_0xa2ff('0x11')](_0xa2ff('0xa'),auth[_0xa2ff('0xb')](),controller[_0xa2ff('0x12')]);module[_0xa2ff('0x13')]=router; \ No newline at end of file +var _0xcb14=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','isAuthenticated','show','/:id','update','delete','destroy','exports'];(function(_0x47d7af,_0x10695d){var _0x54b170=function(_0x4c50cc){while(--_0x4c50cc){_0x47d7af['push'](_0x47d7af['shift']());}};_0x54b170(++_0x10695d);}(_0xcb14,0x9a));var _0x4cb1=function(_0x4ae8c2,_0x409a64){_0x4ae8c2=_0x4ae8c2-0x0;var _0x252e29=_0xcb14[_0x4ae8c2];return _0x252e29;};'use strict';var multer=require(_0x4cb1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x4cb1('0x1'));var express=require(_0x4cb1('0x2'));var router=express['Router']();var fs_extra=require(_0x4cb1('0x3'));var auth=require(_0x4cb1('0x4'));var interaction=require(_0x4cb1('0x5'));var config=require('../../config/environment');var controller=require(_0x4cb1('0x6'));router['get']('/',auth[_0x4cb1('0x7')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x4cb1('0x8')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4cb1('0x9'),auth['isAuthenticated'](),controller[_0x4cb1('0xa')]);router[_0x4cb1('0xb')](_0x4cb1('0x9'),auth['isAuthenticated'](),controller[_0x4cb1('0xc')]);module[_0x4cb1('0xd')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 95accf4..c7d548f 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 _0x1b75=['ENUM','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1b75,0xef));var _0x51b7=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0x1b75[_0x80d733];return _0x435868;};'use strict';var Sequelize=require(_0x51b7('0x0'));module['exports']={'type':{'type':Sequelize[_0x51b7('0x1')]('string','variable',_0x51b7('0x2'),_0x51b7('0x3'),_0x51b7('0x4')),'defaultValue':_0x51b7('0x5')},'content':{'type':Sequelize[_0x51b7('0x6')]},'key':{'type':Sequelize[_0x51b7('0x6')]},'keyType':{'type':Sequelize[_0x51b7('0x1')](_0x51b7('0x5'),'variable',_0x51b7('0x2'))},'keyContent':{'type':Sequelize[_0x51b7('0x6')]},'idField':{'type':Sequelize[_0x51b7('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x51b7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x55d4=['STRING','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x3aabc5,_0x1a8016){var _0x5f8f4d=function(_0x28a5cd){while(--_0x28a5cd){_0x3aabc5['push'](_0x3aabc5['shift']());}};_0x5f8f4d(++_0x1a8016);}(_0x55d4,0x190));var _0x455d=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x55d4[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x455d('0x0')](_0x455d('0x1'),_0x455d('0x2'),_0x455d('0x3'),_0x455d('0x4'),_0x455d('0x5')),'defaultValue':_0x455d('0x1')},'content':{'type':Sequelize[_0x455d('0x6')]},'key':{'type':Sequelize[_0x455d('0x6')]},'keyType':{'type':Sequelize[_0x455d('0x0')]('string',_0x455d('0x2'),_0x455d('0x3'))},'keyContent':{'type':Sequelize[_0x455d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x455d('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 9fa4a38..a511eb9 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 _0x5a1a=['hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','ZohoField','count','includeAll','include','findAll','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','error','name','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length'];(function(_0x1ddef9,_0x44fd67){var _0x2f5949=function(_0x4118e7){while(--_0x4118e7){_0x1ddef9['push'](_0x1ddef9['shift']());}};_0x2f5949(++_0x44fd67);}(_0x5a1a,0xa4));var _0xa5a1=function(_0x4271f1,_0xdbdc80){_0x4271f1=_0x4271f1-0x0;var _0x1bc9c9=_0x5a1a[_0x4271f1];return _0x1bc9c9;};'use strict';var emlformat=require(_0xa5a1('0x0'));var rimraf=require(_0xa5a1('0x1'));var zipdir=require(_0xa5a1('0x2'));var jsonpatch=require(_0xa5a1('0x3'));var rp=require(_0xa5a1('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa5a1('0x5'));var util=require(_0xa5a1('0x6'));var path=require(_0xa5a1('0x7'));var sox=require('sox');var csv=require(_0xa5a1('0x8'));var ejs=require(_0xa5a1('0x9'));var fs=require('fs');var fs_extra=require(_0xa5a1('0xa'));var _=require('lodash');var squel=require(_0xa5a1('0xb'));var crypto=require(_0xa5a1('0xc'));var jsforce=require(_0xa5a1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa5a1('0xe'));var Papa=require(_0xa5a1('0xf'));var Redis=require(_0xa5a1('0x10'));var authService=require(_0xa5a1('0x11'));var qs=require(_0xa5a1('0x12'));var as=require(_0xa5a1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5a1('0x14'))(_0xa5a1('0x15'));var utils=require(_0xa5a1('0x16'));var config=require(_0xa5a1('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f25b3,_0x16ec8b){_0x16ec8b=_0x16ec8b||0xcc;return function(_0x48e8d0){if(_0x48e8d0){return _0x2f25b3[_0xa5a1('0x18')](_0x16ec8b);}return _0x2f25b3['status'](_0x16ec8b)[_0xa5a1('0x19')]();};}function respondWithResult(_0x16fb31,_0x59e0dd){_0x59e0dd=_0x59e0dd||0xc8;return function(_0x442b54){if(_0x442b54){return _0x16fb31[_0xa5a1('0x1a')](_0x59e0dd)['json'](_0x442b54);}};}function respondWithFilteredResult(_0x23567d,_0x3dfbce){return function(_0x530add){if(_0x530add){var _0x2af430=typeof _0x3dfbce[_0xa5a1('0x1b')]==='undefined'&&typeof _0x3dfbce[_0xa5a1('0x1c')]===_0xa5a1('0x1d');var _0x3f5b73=_0x530add['count'];var _0x366679=_0x2af430?0x0:_0x3dfbce[_0xa5a1('0x1b')];var _0x4ca834=_0x2af430?_0x530add['count']:_0x3dfbce[_0xa5a1('0x1b')]+_0x3dfbce[_0xa5a1('0x1c')];var _0x7eda93;if(_0x4ca834>=_0x3f5b73){_0x4ca834=_0x3f5b73;_0x7eda93=0xc8;}else{_0x7eda93=0xce;}_0x23567d[_0xa5a1('0x1a')](_0x7eda93);return _0x23567d[_0xa5a1('0x1e')](_0xa5a1('0x1f'),_0x366679+'-'+_0x4ca834+'/'+_0x3f5b73)[_0xa5a1('0x20')](_0x530add);}return null;};}function patchUpdates(_0x19413e){return function(_0x536ac5){try{jsonpatch[_0xa5a1('0x21')](_0x536ac5,_0x19413e,!![]);}catch(_0x20c7ca){return BPromise[_0xa5a1('0x22')](_0x20c7ca);}return _0x536ac5[_0xa5a1('0x23')]();};}function saveUpdates(_0x144324,_0x383660){return function(_0x423411){if(_0x423411){return _0x423411[_0xa5a1('0x24')](_0x144324)[_0xa5a1('0x25')](function(_0x4dc401){return _0x4dc401;});}return null;};}function removeEntity(_0x1c370c,_0xf318f9){return function(_0x21a3f2){if(_0x21a3f2){return _0x21a3f2['destroy']()[_0xa5a1('0x25')](function(){_0x1c370c[_0xa5a1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17dfc5,_0x396b43){return function(_0x30072f){if(!_0x30072f){_0x17dfc5['sendStatus'](0x194);}return _0x30072f;};}function handleError(_0x482342,_0x5b3931){_0x5b3931=_0x5b3931||0x1f4;return function(_0x3e0e84){logger[_0xa5a1('0x26')](_0x3e0e84['stack']);if(_0x3e0e84[_0xa5a1('0x27')]){delete _0x3e0e84[_0xa5a1('0x27')];}_0x482342[_0xa5a1('0x1a')](_0x5b3931)['send'](_0x3e0e84);};}exports['index']=function(_0x12ee8e,_0x1b4bdc){var _0x52e1b1={},_0x187045={},_0x1bf108={'count':0x0,'rows':[]};var _0x2287a0=_[_0xa5a1('0x28')](db['ZohoField'][_0xa5a1('0x29')],function(_0x431ea1){return{'name':_0x431ea1[_0xa5a1('0x2a')],'type':_0x431ea1[_0xa5a1('0x2b')]['key']};});_0x187045['model']=_[_0xa5a1('0x28')](_0x2287a0,'name');_0x187045[_0xa5a1('0x2c')]=_[_0xa5a1('0x2d')](_0x12ee8e[_0xa5a1('0x2c')]);_0x187045[_0xa5a1('0x2e')]=_[_0xa5a1('0x2f')](_0x187045[_0xa5a1('0x30')],_0x187045[_0xa5a1('0x2c')]);_0x52e1b1[_0xa5a1('0x31')]=_['intersection'](_0x187045['model'],qs[_0xa5a1('0x32')](_0x12ee8e[_0xa5a1('0x2c')][_0xa5a1('0x32')]));_0x52e1b1['attributes']=_0x52e1b1[_0xa5a1('0x31')][_0xa5a1('0x33')]?_0x52e1b1[_0xa5a1('0x31')]:_0x187045[_0xa5a1('0x30')];if(!_0x12ee8e[_0xa5a1('0x2c')][_0xa5a1('0x34')]('nolimit')){_0x52e1b1['limit']=qs[_0xa5a1('0x1c')](_0x12ee8e[_0xa5a1('0x2c')][_0xa5a1('0x1c')]);_0x52e1b1[_0xa5a1('0x1b')]=qs[_0xa5a1('0x1b')](_0x12ee8e[_0xa5a1('0x2c')]['offset']);}_0x52e1b1[_0xa5a1('0x35')]=qs['sort'](_0x12ee8e[_0xa5a1('0x2c')][_0xa5a1('0x36')]);_0x52e1b1[_0xa5a1('0x37')]=qs[_0xa5a1('0x2e')](_[_0xa5a1('0x38')](_0x12ee8e[_0xa5a1('0x2c')],_0x187045['filters']),_0x2287a0);if(_0x12ee8e['query']['filter']){_0x52e1b1[_0xa5a1('0x37')]=_['merge'](_0x52e1b1[_0xa5a1('0x37')],{'$or':_[_0xa5a1('0x28')](_0x2287a0,function(_0x4002ef){if(_0x4002ef[_0xa5a1('0x2b')]!==_0xa5a1('0x39')){var _0x37e522={};_0x37e522[_0x4002ef[_0xa5a1('0x27')]]={'$like':'%'+_0x12ee8e[_0xa5a1('0x2c')][_0xa5a1('0x3a')]+'%'};return _0x37e522;}})});}_0x52e1b1=_[_0xa5a1('0x3b')]({},_0x52e1b1,_0x12ee8e['options']);var _0x479738={'where':_0x52e1b1[_0xa5a1('0x37')]};return db[_0xa5a1('0x3c')]['count'](_0x479738)[_0xa5a1('0x25')](function(_0x13fad8){_0x1bf108[_0xa5a1('0x3d')]=_0x13fad8;if(_0x12ee8e['query'][_0xa5a1('0x3e')]){_0x52e1b1[_0xa5a1('0x3f')]=[{'all':!![]}];}return db[_0xa5a1('0x3c')][_0xa5a1('0x40')](_0x52e1b1);})[_0xa5a1('0x25')](function(_0x1f7d9f){_0x1bf108['rows']=_0x1f7d9f;return _0x1bf108;})[_0xa5a1('0x25')](respondWithFilteredResult(_0x1b4bdc,_0x52e1b1))[_0xa5a1('0x41')](handleError(_0x1b4bdc,null));};exports[_0xa5a1('0x42')]=function(_0xa41595,_0x3484b8){var _0x56f74e={'raw':!![],'where':{'id':_0xa41595[_0xa5a1('0x43')]['id']}},_0x5920ba={};_0x5920ba[_0xa5a1('0x30')]=_['keys'](db[_0xa5a1('0x3c')][_0xa5a1('0x29')]);_0x5920ba[_0xa5a1('0x2c')]=_[_0xa5a1('0x2d')](_0xa41595[_0xa5a1('0x2c')]);_0x5920ba[_0xa5a1('0x2e')]=_['intersection'](_0x5920ba[_0xa5a1('0x30')],_0x5920ba['query']);_0x56f74e[_0xa5a1('0x31')]=_['intersection'](_0x5920ba[_0xa5a1('0x30')],qs[_0xa5a1('0x32')](_0xa41595[_0xa5a1('0x2c')][_0xa5a1('0x32')]));_0x56f74e['attributes']=_0x56f74e['attributes'][_0xa5a1('0x33')]?_0x56f74e['attributes']:_0x5920ba[_0xa5a1('0x30')];if(_0xa41595[_0xa5a1('0x2c')][_0xa5a1('0x3e')]){_0x56f74e['include']=[{'all':!![]}];}_0x56f74e=_[_0xa5a1('0x3b')]({},_0x56f74e,_0xa41595[_0xa5a1('0x44')]);return db['ZohoField']['find'](_0x56f74e)['then'](handleEntityNotFound(_0x3484b8,null))[_0xa5a1('0x25')](respondWithResult(_0x3484b8,null))['catch'](handleError(_0x3484b8,null));};exports[_0xa5a1('0x45')]=function(_0x9ae016,_0x5b7687){return db['ZohoField'][_0xa5a1('0x45')](_0x9ae016[_0xa5a1('0x46')],{})[_0xa5a1('0x25')](respondWithResult(_0x5b7687,0xc9))[_0xa5a1('0x41')](handleError(_0x5b7687,null));};exports['update']=function(_0x3c4945,_0x3184f7){if(_0x3c4945[_0xa5a1('0x46')]['id']){delete _0x3c4945[_0xa5a1('0x46')]['id'];}return db[_0xa5a1('0x3c')][_0xa5a1('0x47')]({'where':{'id':_0x3c4945[_0xa5a1('0x43')]['id']}})[_0xa5a1('0x25')](handleEntityNotFound(_0x3184f7,null))[_0xa5a1('0x25')](saveUpdates(_0x3c4945['body'],null))[_0xa5a1('0x25')](respondWithResult(_0x3184f7,null))[_0xa5a1('0x41')](handleError(_0x3184f7,null));};exports['destroy']=function(_0x5698c7,_0x3f4f77){return db[_0xa5a1('0x3c')][_0xa5a1('0x47')]({'where':{'id':_0x5698c7[_0xa5a1('0x43')]['id']}})[_0xa5a1('0x25')](handleEntityNotFound(_0x3f4f77,null))[_0xa5a1('0x25')](removeEntity(_0x3f4f77,null))[_0xa5a1('0x41')](handleError(_0x3f4f77,null));}; \ No newline at end of file +var _0x366c=['where','filters','merge','VIRTUAL','filter','options','count','includeAll','include','rows','show','params','find','catch','create','body','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1c190e,_0x31a5fa){var _0x3664d5=function(_0x4942d8){while(--_0x4942d8){_0x1c190e['push'](_0x1c190e['shift']());}};_0x3664d5(++_0x31a5fa);}(_0x366c,0x1c6));var _0xc366=function(_0x16cbae,_0x10d32a){_0x16cbae=_0x16cbae-0x0;var _0x34279c=_0x366c[_0x16cbae];return _0x34279c;};'use strict';var emlformat=require(_0xc366('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc366('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc366('0x2'));var moment=require('moment');var BPromise=require(_0xc366('0x3'));var Mustache=require(_0xc366('0x4'));var util=require('util');var path=require(_0xc366('0x5'));var sox=require(_0xc366('0x6'));var csv=require(_0xc366('0x7'));var ejs=require(_0xc366('0x8'));var fs=require('fs');var fs_extra=require(_0xc366('0x9'));var _=require('lodash');var squel=require(_0xc366('0xa'));var crypto=require(_0xc366('0xb'));var jsforce=require(_0xc366('0xc'));var deskjs=require(_0xc366('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc366('0xe'));var Papa=require(_0xc366('0xf'));var Redis=require(_0xc366('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc366('0x11'));var as=require(_0xc366('0x12'));var hardwareService=require(_0xc366('0x13'));var logger=require(_0xc366('0x14'))(_0xc366('0x15'));var utils=require('../../config/utils');var config=require(_0xc366('0x16'));var licenseUtil=require(_0xc366('0x17'));var db=require(_0xc366('0x18'))['db'];function respondWithStatusCode(_0x178599,_0x225fb4){_0x225fb4=_0x225fb4||0xcc;return function(_0x483d1c){if(_0x483d1c){return _0x178599[_0xc366('0x19')](_0x225fb4);}return _0x178599['status'](_0x225fb4)[_0xc366('0x1a')]();};}function respondWithResult(_0x5a918b,_0x44742e){_0x44742e=_0x44742e||0xc8;return function(_0x562e6f){if(_0x562e6f){return _0x5a918b[_0xc366('0x1b')](_0x44742e)['json'](_0x562e6f);}};}function respondWithFilteredResult(_0x439738,_0xfc0c80){return function(_0x547323){if(_0x547323){var _0x23bc61=typeof _0xfc0c80[_0xc366('0x1c')]===_0xc366('0x1d')&&typeof _0xfc0c80[_0xc366('0x1e')]===_0xc366('0x1d');var _0x258220=_0x547323['count'];var _0x491404=_0x23bc61?0x0:_0xfc0c80[_0xc366('0x1c')];var _0x2b680f=_0x23bc61?_0x547323['count']:_0xfc0c80[_0xc366('0x1c')]+_0xfc0c80['limit'];var _0x38877e;if(_0x2b680f>=_0x258220){_0x2b680f=_0x258220;_0x38877e=0xc8;}else{_0x38877e=0xce;}_0x439738[_0xc366('0x1b')](_0x38877e);return _0x439738[_0xc366('0x1f')](_0xc366('0x20'),_0x491404+'-'+_0x2b680f+'/'+_0x258220)['json'](_0x547323);}return null;};}function patchUpdates(_0x39897c){return function(_0x1b1271){try{jsonpatch['apply'](_0x1b1271,_0x39897c,!![]);}catch(_0x134aa3){return BPromise[_0xc366('0x21')](_0x134aa3);}return _0x1b1271[_0xc366('0x22')]();};}function saveUpdates(_0x2b102f,_0x220245){return function(_0x34ad7c){if(_0x34ad7c){return _0x34ad7c[_0xc366('0x23')](_0x2b102f)[_0xc366('0x24')](function(_0x40a4b2){return _0x40a4b2;});}return null;};}function removeEntity(_0x1788cb,_0x3f42e5){return function(_0x207243){if(_0x207243){return _0x207243[_0xc366('0x25')]()[_0xc366('0x24')](function(){_0x1788cb[_0xc366('0x1b')](0xcc)[_0xc366('0x1a')]();});}};}function handleEntityNotFound(_0x178819,_0x1fcb5e){return function(_0x379129){if(!_0x379129){_0x178819[_0xc366('0x19')](0x194);}return _0x379129;};}function handleError(_0x5c060c,_0x535064){_0x535064=_0x535064||0x1f4;return function(_0x20af13){logger[_0xc366('0x26')](_0x20af13[_0xc366('0x27')]);if(_0x20af13[_0xc366('0x28')]){delete _0x20af13[_0xc366('0x28')];}_0x5c060c[_0xc366('0x1b')](_0x535064)['send'](_0x20af13);};}exports['index']=function(_0x3851aa,_0x2e44e4){var _0x131907={},_0x49820f={},_0x4e4084={'count':0x0,'rows':[]};var _0x3c41ed=_[_0xc366('0x29')](db[_0xc366('0x2a')][_0xc366('0x2b')],function(_0x585904){return{'name':_0x585904['fieldName'],'type':_0x585904[_0xc366('0x2c')][_0xc366('0x2d')]};});_0x49820f[_0xc366('0x2e')]=_[_0xc366('0x29')](_0x3c41ed,_0xc366('0x28'));_0x49820f[_0xc366('0x2f')]=_[_0xc366('0x30')](_0x3851aa[_0xc366('0x2f')]);_0x49820f['filters']=_[_0xc366('0x31')](_0x49820f['model'],_0x49820f[_0xc366('0x2f')]);_0x131907[_0xc366('0x32')]=_[_0xc366('0x31')](_0x49820f[_0xc366('0x2e')],qs[_0xc366('0x33')](_0x3851aa[_0xc366('0x2f')]['fields']));_0x131907[_0xc366('0x32')]=_0x131907[_0xc366('0x32')][_0xc366('0x34')]?_0x131907[_0xc366('0x32')]:_0x49820f[_0xc366('0x2e')];if(!_0x3851aa['query'][_0xc366('0x35')](_0xc366('0x36'))){_0x131907[_0xc366('0x1e')]=qs[_0xc366('0x1e')](_0x3851aa['query'][_0xc366('0x1e')]);_0x131907['offset']=qs[_0xc366('0x1c')](_0x3851aa[_0xc366('0x2f')][_0xc366('0x1c')]);}_0x131907[_0xc366('0x37')]=qs[_0xc366('0x38')](_0x3851aa[_0xc366('0x2f')]['sort']);_0x131907[_0xc366('0x39')]=qs[_0xc366('0x3a')](_['pick'](_0x3851aa['query'],_0x49820f[_0xc366('0x3a')]),_0x3c41ed);if(_0x3851aa[_0xc366('0x2f')]['filter']){_0x131907[_0xc366('0x39')]=_[_0xc366('0x3b')](_0x131907[_0xc366('0x39')],{'$or':_[_0xc366('0x29')](_0x3c41ed,function(_0x191abd){if(_0x191abd[_0xc366('0x2c')]!==_0xc366('0x3c')){var _0x22d3d7={};_0x22d3d7[_0x191abd[_0xc366('0x28')]]={'$like':'%'+_0x3851aa['query'][_0xc366('0x3d')]+'%'};return _0x22d3d7;}})});}_0x131907=_[_0xc366('0x3b')]({},_0x131907,_0x3851aa[_0xc366('0x3e')]);var _0x4e51df={'where':_0x131907[_0xc366('0x39')]};return db[_0xc366('0x2a')][_0xc366('0x3f')](_0x4e51df)[_0xc366('0x24')](function(_0x1d44fa){_0x4e4084[_0xc366('0x3f')]=_0x1d44fa;if(_0x3851aa[_0xc366('0x2f')][_0xc366('0x40')]){_0x131907[_0xc366('0x41')]=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x131907);})['then'](function(_0x70c7ca){_0x4e4084[_0xc366('0x42')]=_0x70c7ca;return _0x4e4084;})['then'](respondWithFilteredResult(_0x2e44e4,_0x131907))['catch'](handleError(_0x2e44e4,null));};exports[_0xc366('0x43')]=function(_0x31eece,_0x407599){var _0x336878={'raw':!![],'where':{'id':_0x31eece[_0xc366('0x44')]['id']}},_0x27d349={};_0x27d349[_0xc366('0x2e')]=_[_0xc366('0x30')](db['ZohoField'][_0xc366('0x2b')]);_0x27d349[_0xc366('0x2f')]=_['keys'](_0x31eece['query']);_0x27d349['filters']=_[_0xc366('0x31')](_0x27d349[_0xc366('0x2e')],_0x27d349[_0xc366('0x2f')]);_0x336878[_0xc366('0x32')]=_['intersection'](_0x27d349[_0xc366('0x2e')],qs[_0xc366('0x33')](_0x31eece['query']['fields']));_0x336878[_0xc366('0x32')]=_0x336878['attributes'][_0xc366('0x34')]?_0x336878[_0xc366('0x32')]:_0x27d349['model'];if(_0x31eece[_0xc366('0x2f')][_0xc366('0x40')]){_0x336878[_0xc366('0x41')]=[{'all':!![]}];}_0x336878=_['merge']({},_0x336878,_0x31eece[_0xc366('0x3e')]);return db[_0xc366('0x2a')][_0xc366('0x45')](_0x336878)['then'](handleEntityNotFound(_0x407599,null))[_0xc366('0x24')](respondWithResult(_0x407599,null))[_0xc366('0x46')](handleError(_0x407599,null));};exports[_0xc366('0x47')]=function(_0x3557ea,_0x283507){return db[_0xc366('0x2a')][_0xc366('0x47')](_0x3557ea[_0xc366('0x48')],{})['then'](respondWithResult(_0x283507,0xc9))['catch'](handleError(_0x283507,null));};exports[_0xc366('0x23')]=function(_0x523f7e,_0x5ddf9e){if(_0x523f7e[_0xc366('0x48')]['id']){delete _0x523f7e['body']['id'];}return db[_0xc366('0x2a')]['find']({'where':{'id':_0x523f7e[_0xc366('0x44')]['id']}})[_0xc366('0x24')](handleEntityNotFound(_0x5ddf9e,null))[_0xc366('0x24')](saveUpdates(_0x523f7e[_0xc366('0x48')],null))[_0xc366('0x24')](respondWithResult(_0x5ddf9e,null))['catch'](handleError(_0x5ddf9e,null));};exports['destroy']=function(_0x34fd79,_0x37cbe3){return db['ZohoField'][_0xc366('0x45')]({'where':{'id':_0x34fd79[_0xc366('0x44')]['id']}})[_0xc366('0x24')](handleEntityNotFound(_0x37cbe3,null))['then'](removeEntity(_0x37cbe3,null))['catch'](handleError(_0x37cbe3,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 2381d85..3920995 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 _0x896e=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash','util','../../config/logger','api'];(function(_0x2514a0,_0x45e3aa){var _0xfb63cf=function(_0x2be31e){while(--_0x2be31e){_0x2514a0['push'](_0x2514a0['shift']());}};_0xfb63cf(++_0x45e3aa);}(_0x896e,0x1e9));var _0xe896=function(_0x5e3175,_0x27a206){_0x5e3175=_0x5e3175-0x0;var _0x354a87=_0x896e[_0x5e3175];return _0x354a87;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[{'name':_0xe896('0xf'),'fields':['idField',_0xe896('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc1c6=['path','rimraf','exports','ZohoField','int_zoho_fields','zoho_unique_index','idField','lodash','util','../../config/logger','moment','request-promise'];(function(_0x123278,_0x3c4305){var _0x586de2=function(_0xf51db2){while(--_0xf51db2){_0x123278['push'](_0x123278['shift']());}};_0x586de2(++_0x3c4305);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x27d9df,_0x4ce45c){_0x27d9df=_0x27d9df-0x0;var _0x1edb1a=_0xc1c6[_0x27d9df];return _0x1edb1a;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index df80205..32805ea 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 _0x3425=['rpc','client','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x3425,0x1d7));var _0x5342=function(_0x2773fe,_0x6b1f85){_0x2773fe=_0x2773fe-0x0;var _0x31ab79=_0x3425[_0x2773fe];return _0x31ab79;};'use strict';var _=require(_0x5342('0x0'));var util=require('util');var moment=require(_0x5342('0x1'));var BPromise=require(_0x5342('0x2'));var rs=require(_0x5342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5342('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5342('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x833185,_0xda0919,_0x4c0e95){return new BPromise(function(_0x12106a,_0x1b1e17){return client[_0x5342('0x6')](_0x833185,_0x4c0e95)[_0x5342('0x7')](function(_0x1ef887){logger[_0x5342('0x8')](_0x5342('0x9'),_0xda0919,'request\x20sent');logger[_0x5342('0xa')](_0x5342('0xb'),_0xda0919,_0x5342('0xc'),JSON[_0x5342('0xd')](_0x1ef887));if(_0x1ef887['error']){if(_0x1ef887[_0x5342('0xe')][_0x5342('0xf')]===0x1f4){logger[_0x5342('0xe')]('ZohoField,\x20%s,\x20%s',_0xda0919,_0x1ef887[_0x5342('0xe')][_0x5342('0x10')]);return _0x1b1e17(_0x1ef887['error'][_0x5342('0x10')]);}logger[_0x5342('0xe')](_0x5342('0x9'),_0xda0919,_0x1ef887[_0x5342('0xe')][_0x5342('0x10')]);return _0x12106a(_0x1ef887[_0x5342('0xe')][_0x5342('0x10')]);}else{logger[_0x5342('0x8')]('ZohoField,\x20%s,\x20%s',_0xda0919,_0x5342('0xc'));_0x12106a(_0x1ef887[_0x5342('0x11')][_0x5342('0x10')]);}})[_0x5342('0x12')](function(_0x3be5c5){logger[_0x5342('0xe')](_0x5342('0x9'),_0xda0919,_0x3be5c5);_0x1b1e17(_0x3be5c5);});});} \ No newline at end of file +var _0x3973=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1a484d,_0x3eda72){var _0x730117=function(_0x5927f5){while(--_0x5927f5){_0x1a484d['push'](_0x1a484d['shift']());}};_0x730117(++_0x3eda72);}(_0x3973,0x127));var _0x3397=function(_0x1e1407,_0x36ff1d){_0x1e1407=_0x1e1407-0x0;var _0x3399f0=_0x3973[_0x1e1407];return _0x3399f0;};'use strict';var _=require(_0x3397('0x0'));var util=require(_0x3397('0x1'));var moment=require(_0x3397('0x2'));var BPromise=require(_0x3397('0x3'));var rs=require(_0x3397('0x4'));var fs=require('fs');var Redis=require(_0x3397('0x5'));var db=require(_0x3397('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3397('0x7'))(_0x3397('0x8'));var config=require(_0x3397('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1927b6,_0x58364f,_0x325a3d){return new BPromise(function(_0x48678d,_0x526f9c){return client[_0x3397('0xa')](_0x1927b6,_0x325a3d)[_0x3397('0xb')](function(_0x3a2bc2){logger[_0x3397('0xc')](_0x3397('0xd'),_0x58364f,'request\x20sent');logger[_0x3397('0xe')](_0x3397('0xf'),_0x58364f,_0x3397('0x10'),JSON[_0x3397('0x11')](_0x3a2bc2));if(_0x3a2bc2[_0x3397('0x12')]){if(_0x3a2bc2[_0x3397('0x12')][_0x3397('0x13')]===0x1f4){logger[_0x3397('0x12')](_0x3397('0xd'),_0x58364f,_0x3a2bc2['error'][_0x3397('0x14')]);return _0x526f9c(_0x3a2bc2[_0x3397('0x12')][_0x3397('0x14')]);}logger[_0x3397('0x12')](_0x3397('0xd'),_0x58364f,_0x3a2bc2[_0x3397('0x12')][_0x3397('0x14')]);return _0x48678d(_0x3a2bc2[_0x3397('0x12')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x58364f,_0x3397('0x10'));_0x48678d(_0x3a2bc2[_0x3397('0x15')][_0x3397('0x14')]);}})[_0x3397('0x16')](function(_0x544e41){logger[_0x3397('0x12')]('ZohoField,\x20%s,\x20%s',_0x58364f,_0x544e41);_0x526f9c(_0x544e41);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index a6ee64c..c924c1e 100644 --- a/server/api/integration/index.js +++ b/server/api/integration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2447d7,_0x3466fe){var _0x262442=function(_0x4fd8d5){while(--_0x4fd8d5){_0x2447d7['push'](_0x2447d7['shift']());}};_0x262442(++_0x3466fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x87e0dc,_0x577dce){var _0x2cd2d1=function(_0x2d8173){while(--_0x2d8173){_0x87e0dc['push'](_0x87e0dc['shift']());}};_0x2cd2d1(++_0x577dce);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3d5da3f..cb31aef 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 _0xbb50=['STRING','unique_name_and_version','state','sequelize','exports'];(function(_0x49d41c,_0x2bdc35){var _0xb64c5f=function(_0x28f535){while(--_0x28f535){_0x49d41c['push'](_0x49d41c['shift']());}};_0xb64c5f(++_0x2bdc35);}(_0xbb50,0x11b));var _0x0bb5=function(_0x516118,_0x26acb7){_0x516118=_0x516118-0x0;var _0x4922a8=_0xbb50[_0x516118];return _0x4922a8;};'use strict';var Sequelize=require(_0x0bb5('0x0'));module[_0x0bb5('0x1')]={'name':{'type':Sequelize[_0x0bb5('0x2')],'allowNull':![],'unique':_0x0bb5('0x3')},'version':{'type':Sequelize[_0x0bb5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x0bb5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x0bb5('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x0bb5('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x0bb5('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0x0bb5('0x4')},'description':{'type':Sequelize[_0x0bb5('0x2')]},'title':{'type':Sequelize[_0x0bb5('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x0bb5('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xa8bd=['BOOLEAN','state','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x270284,_0x4f1783){var _0x34589d=function(_0x5ecd6b){while(--_0x5ecd6b){_0x270284['push'](_0x270284['shift']());}};_0x34589d(++_0x4f1783);}(_0xa8bd,0x113));var _0xda8b=function(_0xf80d82,_0x52d4c1){_0xf80d82=_0xf80d82-0x0;var _0x219138=_0xa8bd[_0xf80d82];return _0x219138;};'use strict';var Sequelize=require('sequelize');module[_0xda8b('0x0')]={'name':{'type':Sequelize[_0xda8b('0x1')],'allowNull':![],'unique':_0xda8b('0x2')},'version':{'type':Sequelize[_0xda8b('0x1')],'allowNull':![],'unique':_0xda8b('0x2')},'main':{'type':Sequelize[_0xda8b('0x1')],'defaultValue':_0xda8b('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xda8b('0x1')]},'type':{'type':Sequelize[_0xda8b('0x1')]},'size':{'type':Sequelize[_0xda8b('0x4')]},'active':{'type':Sequelize[_0xda8b('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xda8b('0x1')],'unique':_0xda8b('0x6')},'description':{'type':Sequelize[_0xda8b('0x1')]},'title':{'type':Sequelize[_0xda8b('0x1')]},'remoteUri':{'type':Sequelize[_0xda8b('0x1')]},'link':{'type':Sequelize[_0xda8b('0x1')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index aa2988a..528ac89 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 _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x591053,_0x523072){var _0x31ab80=function(_0x4a543f){while(--_0x4a543f){_0x591053['push'](_0x591053['shift']());}};_0x31ab80(++_0x523072);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x1ec8b6,_0x10eb41){_0x1ec8b6=_0x1ec8b6-0x0;var _0xa71a48=_0xc6ac[_0x1ec8b6];return _0xa71a48;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','Integration','model','map','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x1261,0x144));var _0x1126=function(_0x540dcb,_0x4eacb6){_0x540dcb=_0x540dcb-0x0;var _0x49353c=_0x1261[_0x540dcb];return _0x49353c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1126('0x0'));var zipdir=require(_0x1126('0x1'));var jsonpatch=require(_0x1126('0x2'));var rp=require(_0x1126('0x3'));var moment=require(_0x1126('0x4'));var BPromise=require(_0x1126('0x5'));var Mustache=require(_0x1126('0x6'));var util=require(_0x1126('0x7'));var path=require(_0x1126('0x8'));var sox=require(_0x1126('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1126('0xa'));var _=require(_0x1126('0xb'));var squel=require('squel');var crypto=require(_0x1126('0xc'));var jsforce=require(_0x1126('0xd'));var deskjs=require(_0x1126('0xe'));var toCsv=require(_0x1126('0xf'));var querystring=require(_0x1126('0x10'));var Papa=require('papaparse');var Redis=require(_0x1126('0x11'));var authService=require(_0x1126('0x12'));var qs=require(_0x1126('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1126('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1126('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1126('0x16'));var db=require(_0x1126('0x17'))['db'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['Integration'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['Integration']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')](_0x512f60['body'],{})[_0x1126('0x25')](respondWithResult(_0x5111d3,0xc9))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports['update']=function(_0x3e4eeb,_0xbdde58){if(_0x3e4eeb[_0x1126('0x44')]['id']){delete _0x3e4eeb['body']['id'];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x3e4eeb[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0xbdde58,null))[_0x1126('0x25')](saveUpdates(_0x3e4eeb[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0xbdde58,null))[_0x1126('0x43')](handleError(_0xbdde58,null));};exports['destroy']=function(_0x1b8b83,_0x5a2287){return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'id':_0x1b8b83['params']['id']}})['then'](handleEntityNotFound(_0x5a2287,null))[_0x1126('0x25')](removeEntity(_0x5a2287,null))[_0x1126('0x43')](handleError(_0x5a2287,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 2eae9a5..7cc18b7 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 _0x16ad=['./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x154d81,_0xc1608){var _0x346100=function(_0x2d6cec){while(--_0x2d6cec){_0x154d81['push'](_0x154d81['shift']());}};_0x346100(++_0xc1608);}(_0x16ad,0x171));var _0xd16a=function(_0xf7dfda,_0x3c22cb){_0xf7dfda=_0xf7dfda-0x0;var _0x4ac4dd=_0x16ad[_0xf7dfda];return _0x4ac4dd;};'use strict';var _=require(_0xd16a('0x0'));var util=require(_0xd16a('0x1'));var logger=require(_0xd16a('0x2'))(_0xd16a('0x3'));var moment=require(_0xd16a('0x4'));var BPromise=require(_0xd16a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd16a('0x6'));var rimraf=require(_0xd16a('0x7'));var config=require(_0xd16a('0x8'));var attributes=require(_0xd16a('0x9'));module[_0xd16a('0xa')]=function(_0x5d7d25,_0x2a7110){return _0x5d7d25[_0xd16a('0xb')](_0xd16a('0xc'),attributes,{'tableName':_0xd16a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfda5=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./integration.attributes','exports','define','Integration','integrations','util'];(function(_0x5b494c,_0x182312){var _0x5d8bac=function(_0x36899d){while(--_0x36899d){_0x5b494c['push'](_0x5b494c['shift']());}};_0x5d8bac(++_0x182312);}(_0xfda5,0x12b));var _0x5fda=function(_0x2b522f,_0x4e4e8e){_0x2b522f=_0x2b522f-0x0;var _0x277bb6=_0xfda5[_0x2b522f];return _0x277bb6;};'use strict';var _=require('lodash');var util=require(_0x5fda('0x0'));var logger=require(_0x5fda('0x1'))('api');var moment=require(_0x5fda('0x2'));var BPromise=require(_0x5fda('0x3'));var rp=require(_0x5fda('0x4'));var fs=require('fs');var path=require(_0x5fda('0x5'));var rimraf=require(_0x5fda('0x6'));var config=require('../../config/environment');var attributes=require(_0x5fda('0x7'));module[_0x5fda('0x8')]=function(_0x1d6570,_0x460231){return _0x1d6570[_0x5fda('0x9')](_0x5fda('0xa'),attributes,{'tableName':_0x5fda('0xb'),'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 af3ea5f..6f4e22d 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 _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x21ab42,_0x8ab09a){var _0x4f6351=function(_0x50a316){while(--_0x50a316){_0x21ab42['push'](_0x21ab42['shift']());}};_0x4f6351(++_0x8ab09a);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x4391bd,_0x77860c){_0x4391bd=_0x4391bd-0x0;var _0x280bc4=_0xd7d1[_0x4391bd];return _0x280bc4;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});} \ No newline at end of file +var _0xd943=['info','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x1fd493,_0x5455d6){var _0x16df8e=function(_0x5eda3f){while(--_0x5eda3f){_0x1fd493['push'](_0x1fd493['shift']());}};_0x16df8e(++_0x5455d6);}(_0xd943,0x15d));var _0x3d94=function(_0x384fb0,_0x1867b0){_0x384fb0=_0x384fb0-0x0;var _0x344d5c=_0xd943[_0x384fb0];return _0x344d5c;};'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')]('Integration,\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/integrationReport/index.js b/server/api/integrationReport/index.js index 30ad106..e4361b7 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 _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x31d865,_0x26e989){var _0x35bcb4=function(_0xad2629){while(--_0xad2629){_0x31d865['push'](_0x31d865['shift']());}};_0x35bcb4(++_0x26e989);}(_0x7a54,0x106));var _0x47a5=function(_0x2bfd93,_0x2bef69){_0x2bfd93=_0x2bfd93-0x0;var _0xae37bd=_0x7a54[_0x2bfd93];return _0xae37bd;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router; \ No newline at end of file +var _0xe2fe=['describe','/:id','post','update','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xee2f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xee2f('0x1'));var express=require('express');var router=express[_0xee2f('0x2')]();var fs_extra=require(_0xee2f('0x3'));var auth=require(_0xee2f('0x4'));var interaction=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var controller=require('./integrationReport.controller');router[_0xee2f('0x7')]('/',auth[_0xee2f('0x8')](),controller['index']);router[_0xee2f('0x7')](_0xee2f('0x9'),auth['isAuthenticated'](),controller[_0xee2f('0xa')]);router['get'](_0xee2f('0xb'),auth[_0xee2f('0x8')](),controller['show']);router[_0xee2f('0xc')]('/',auth[_0xee2f('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xee2f('0xe')]);module[_0xee2f('0xf')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 5936d48..19c5790 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 _0xa106=['DATE','BOOLEAN','TEXT','ENUM','SENDING','FAILED','sequelize','exports','STRING','INTEGER'];(function(_0x3417b1,_0x4b8177){var _0x543331=function(_0x5904e8){while(--_0x5904e8){_0x3417b1['push'](_0x3417b1['shift']());}};_0x543331(++_0x4b8177);}(_0xa106,0xf6));var _0x6a10=function(_0xb0b922,_0x183826){_0xb0b922=_0xb0b922-0x0;var _0x5dc41e=_0xa106[_0xb0b922];return _0x5dc41e;};'use strict';var Sequelize=require(_0x6a10('0x0'));module[_0x6a10('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0x6a10('0x2')]},'integrationId':{'type':Sequelize[_0x6a10('0x3')]},'contacts':{'type':Sequelize[_0x6a10('0x2')]},'uniqueid':{'type':Sequelize[_0x6a10('0x2')]},'calleridnum':{'type':Sequelize[_0x6a10('0x2')]},'calleridname':{'type':Sequelize[_0x6a10('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x6a10('0x4')]},'agentconnectAt':{'type':Sequelize[_0x6a10('0x4')]},'holdtime':{'type':Sequelize[_0x6a10('0x3')]},'agentcomplete':{'type':Sequelize[_0x6a10('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x6a10('0x3')]},'agentacw':{'type':Sequelize[_0x6a10('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x6a10('0x3')]},'reason':{'type':Sequelize[_0x6a10('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x6a10('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x6a10('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x6a10('0x2')]},'channel':{'type':Sequelize[_0x6a10('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x6a10('0x2')]},'connectedlinenum':{'type':Sequelize[_0x6a10('0x2')]},'connectedlinename':{'type':Sequelize[_0x6a10('0x2')]},'language':{'type':Sequelize[_0x6a10('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6a10('0x2')]},'priority':{'type':Sequelize[_0x6a10('0x2')]},'destchannel':{'type':Sequelize[_0x6a10('0x2')]},'destchannelstate':{'type':Sequelize[_0x6a10('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x6a10('0x2')]},'destcalleridnum':{'type':Sequelize[_0x6a10('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x6a10('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x6a10('0x2')]},'destlanguage':{'type':Sequelize[_0x6a10('0x2')]},'destaccountcode':{'type':Sequelize[_0x6a10('0x2')]},'destcontext':{'type':Sequelize[_0x6a10('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x6a10('0x2')]},'destuniqueid':{'type':Sequelize[_0x6a10('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x6a10('0x2')]},'subject':{'type':Sequelize[_0x6a10('0x2')]},'from':{'type':Sequelize[_0x6a10('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x6a10('0x6')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0x6a10('0x6')]},'status':{'type':Sequelize[_0x6a10('0x7')]('SENT',_0x6a10('0x8'),'RECEIVED',_0x6a10('0x9'))},'url':{'type':Sequelize[_0x6a10('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x6a10('0x2')]},'projectId':{'type':Sequelize[_0x6a10('0x3')]}}; \ No newline at end of file +var _0x88cb=['INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x88cb,0x1a1));var _0xb88c=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x88cb[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xb88c('0x0'));module[_0xb88c('0x1')]={'integration':{'type':Sequelize[_0xb88c('0x2')]},'eventChannel':{'type':Sequelize[_0xb88c('0x2')]},'exitStatus':{'type':Sequelize[_0xb88c('0x2')]},'ticketId':{'type':Sequelize[_0xb88c('0x2')]},'integrationId':{'type':Sequelize[_0xb88c('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb88c('0x2')]},'calleridname':{'type':Sequelize[_0xb88c('0x2')]},'queue':{'type':Sequelize[_0xb88c('0x2')]},'interface':{'type':Sequelize[_0xb88c('0x2')]},'membername':{'type':Sequelize[_0xb88c('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xb88c('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xb88c('0x3')]},'agentacw':{'type':Sequelize[_0xb88c('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb88c('0x3')]},'reason':{'type':Sequelize[_0xb88c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xb88c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xb88c('0x4')]},'agentdump':{'type':Sequelize[_0xb88c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb88c('0x4')]},'lastevent':{'type':Sequelize[_0xb88c('0x2')]},'channel':{'type':Sequelize[_0xb88c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xb88c('0x2')]},'connectedlinename':{'type':Sequelize[_0xb88c('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xb88c('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb88c('0x2')]},'destchannel':{'type':Sequelize[_0xb88c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb88c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb88c('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb88c('0x2')]},'destlanguage':{'type':Sequelize[_0xb88c('0x2')]},'destaccountcode':{'type':Sequelize[_0xb88c('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xb88c('0x2')]},'destpriority':{'type':Sequelize[_0xb88c('0x2')]},'destuniqueid':{'type':Sequelize[_0xb88c('0x2')]},'messageId':{'type':Sequelize[_0xb88c('0x2')]},'inReplyTo':{'type':Sequelize[_0xb88c('0x2')]},'subject':{'type':Sequelize[_0xb88c('0x2')]},'from':{'type':Sequelize[_0xb88c('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb88c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xb88c('0x6')]},'text':{'type':Sequelize[_0xb88c('0x6')]},'status':{'type':Sequelize[_0xb88c('0x7')](_0xb88c('0x8'),_0xb88c('0x9'),_0xb88c('0xa'),_0xb88c('0xb'))},'url':{'type':Sequelize[_0xb88c('0x2')]},'app':{'type':Sequelize[_0xb88c('0x2')]},'appdata':{'type':Sequelize[_0xb88c('0x2')]},'projectId':{'type':Sequelize[_0xb88c('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index e5104bc..4dba0ac 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 _0x16ff=['request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch'];(function(_0xaa64c6,_0xae0b7f){var _0xaf268d=function(_0x334809){while(--_0x334809){_0xaa64c6['push'](_0xaa64c6['shift']());}};_0xaf268d(++_0xae0b7f);}(_0x16ff,0x179));var _0xf16f=function(_0x2b6d83,_0x38eb14){_0x2b6d83=_0x2b6d83-0x0;var _0x5edc68=_0x16ff[_0x2b6d83];return _0x5edc68;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf16f('0x0'));var zipdir=require(_0xf16f('0x1'));var jsonpatch=require(_0xf16f('0x2'));var rp=require(_0xf16f('0x3'));var moment=require(_0xf16f('0x4'));var BPromise=require(_0xf16f('0x5'));var Mustache=require(_0xf16f('0x6'));var util=require(_0xf16f('0x7'));var path=require(_0xf16f('0x8'));var sox=require(_0xf16f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf16f('0xa'));var _=require(_0xf16f('0xb'));var squel=require('squel');var crypto=require(_0xf16f('0xc'));var jsforce=require(_0xf16f('0xd'));var deskjs=require(_0xf16f('0xe'));var toCsv=require(_0xf16f('0xf'));var querystring=require(_0xf16f('0x10'));var Papa=require(_0xf16f('0x11'));var Redis=require(_0xf16f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf16f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf16f('0x14'));var logger=require(_0xf16f('0x15'))(_0xf16f('0x16'));var utils=require(_0xf16f('0x17'));var config=require(_0xf16f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf16f('0x19'))['db'];function respondWithStatusCode(_0x2f8c41,_0x14592a){_0x14592a=_0x14592a||0xcc;return function(_0x43dd5c){if(_0x43dd5c){return _0x2f8c41[_0xf16f('0x1a')](_0x14592a);}return _0x2f8c41[_0xf16f('0x1b')](_0x14592a)[_0xf16f('0x1c')]();};}function respondWithResult(_0xdd1578,_0x503e3e){_0x503e3e=_0x503e3e||0xc8;return function(_0x200e3d){if(_0x200e3d){return _0xdd1578[_0xf16f('0x1b')](_0x503e3e)[_0xf16f('0x1d')](_0x200e3d);}};}function respondWithFilteredResult(_0x13ea3a,_0x5e88e7){return function(_0x3dc93f){if(_0x3dc93f){var _0x7a232d=typeof _0x5e88e7['offset']==='undefined'&&typeof _0x5e88e7[_0xf16f('0x1e')]===_0xf16f('0x1f');var _0x46cebe=_0x3dc93f[_0xf16f('0x20')];var _0x12d4ce=_0x7a232d?0x0:_0x5e88e7[_0xf16f('0x21')];var _0x4a2f36=_0x7a232d?_0x3dc93f[_0xf16f('0x20')]:_0x5e88e7['offset']+_0x5e88e7[_0xf16f('0x1e')];var _0x85cb06;if(_0x4a2f36>=_0x46cebe){_0x4a2f36=_0x46cebe;_0x85cb06=0xc8;}else{_0x85cb06=0xce;}_0x13ea3a[_0xf16f('0x1b')](_0x85cb06);return _0x13ea3a[_0xf16f('0x22')](_0xf16f('0x23'),_0x12d4ce+'-'+_0x4a2f36+'/'+_0x46cebe)[_0xf16f('0x1d')](_0x3dc93f);}return null;};}function patchUpdates(_0x4efa8e){return function(_0x4fa050){try{jsonpatch[_0xf16f('0x24')](_0x4fa050,_0x4efa8e,!![]);}catch(_0x328d8c){return BPromise['reject'](_0x328d8c);}return _0x4fa050['save']();};}function saveUpdates(_0x593519,_0xb20f13){return function(_0x380a03){if(_0x380a03){return _0x380a03[_0xf16f('0x25')](_0x593519)[_0xf16f('0x26')](function(_0x278509){return _0x278509;});}return null;};}function removeEntity(_0x341927,_0x23a8c3){return function(_0x35394c){if(_0x35394c){return _0x35394c['destroy']()[_0xf16f('0x26')](function(){_0x341927[_0xf16f('0x1b')](0xcc)[_0xf16f('0x1c')]();});}};}function handleEntityNotFound(_0x163b5d,_0x3cc798){return function(_0x1b424a){if(!_0x1b424a){_0x163b5d['sendStatus'](0x194);}return _0x1b424a;};}function handleError(_0x1a4a93,_0x494628){_0x494628=_0x494628||0x1f4;return function(_0x1164ee){logger['error'](_0x1164ee[_0xf16f('0x27')]);if(_0x1164ee[_0xf16f('0x28')]){delete _0x1164ee[_0xf16f('0x28')];}_0x1a4a93[_0xf16f('0x1b')](_0x494628)[_0xf16f('0x29')](_0x1164ee);};}exports[_0xf16f('0x2a')]=function(_0x5233d7,_0x194ad9){var _0x52d15d={},_0x205d3d={},_0x34218f={'count':0x0,'rows':[]};var _0x33a51e=_[_0xf16f('0x2b')](db[_0xf16f('0x2c')][_0xf16f('0x2d')],function(_0x17d691){return{'name':_0x17d691[_0xf16f('0x2e')],'type':_0x17d691[_0xf16f('0x2f')][_0xf16f('0x30')]};});_0x205d3d[_0xf16f('0x31')]=_['map'](_0x33a51e,_0xf16f('0x28'));_0x205d3d['query']=_[_0xf16f('0x32')](_0x5233d7[_0xf16f('0x33')]);_0x205d3d[_0xf16f('0x34')]=_[_0xf16f('0x35')](_0x205d3d[_0xf16f('0x31')],_0x205d3d[_0xf16f('0x33')]);_0x52d15d['attributes']=_[_0xf16f('0x35')](_0x205d3d[_0xf16f('0x31')],qs[_0xf16f('0x36')](_0x5233d7[_0xf16f('0x33')]['fields']));_0x52d15d[_0xf16f('0x37')]=_0x52d15d[_0xf16f('0x37')][_0xf16f('0x38')]?_0x52d15d[_0xf16f('0x37')]:_0x205d3d['model'];if(!_0x5233d7[_0xf16f('0x33')][_0xf16f('0x39')]('nolimit')){_0x52d15d[_0xf16f('0x1e')]=qs[_0xf16f('0x1e')](_0x5233d7[_0xf16f('0x33')][_0xf16f('0x1e')]);_0x52d15d['offset']=qs[_0xf16f('0x21')](_0x5233d7[_0xf16f('0x33')][_0xf16f('0x21')]);}_0x52d15d[_0xf16f('0x3a')]=qs[_0xf16f('0x3b')](_0x5233d7[_0xf16f('0x33')][_0xf16f('0x3b')]);_0x52d15d[_0xf16f('0x3c')]=qs[_0xf16f('0x34')](_[_0xf16f('0x3d')](_0x5233d7['query'],_0x205d3d[_0xf16f('0x34')]),_0x33a51e);if(_0x5233d7[_0xf16f('0x33')][_0xf16f('0x3e')]){_0x52d15d[_0xf16f('0x3c')]=_[_0xf16f('0x3f')](_0x52d15d[_0xf16f('0x3c')],{'$or':_[_0xf16f('0x2b')](_0x33a51e,function(_0x12c704){if(_0x12c704[_0xf16f('0x2f')]!==_0xf16f('0x40')){var _0x54c868={};_0x54c868[_0x12c704[_0xf16f('0x28')]]={'$like':'%'+_0x5233d7['query'][_0xf16f('0x3e')]+'%'};return _0x54c868;}})});}_0x52d15d=_['merge']({},_0x52d15d,_0x5233d7[_0xf16f('0x41')]);var _0x3e8aab={'where':_0x52d15d[_0xf16f('0x3c')]};return db[_0xf16f('0x2c')]['count'](_0x3e8aab)[_0xf16f('0x26')](function(_0x5a6a47){_0x34218f[_0xf16f('0x20')]=_0x5a6a47;if(_0x5233d7['query'][_0xf16f('0x42')]){_0x52d15d[_0xf16f('0x43')]=[{'all':!![]}];}return db[_0xf16f('0x2c')][_0xf16f('0x44')](_0x52d15d);})[_0xf16f('0x26')](function(_0x1d6a67){_0x34218f['rows']=_0x1d6a67;return _0x34218f;})[_0xf16f('0x26')](respondWithFilteredResult(_0x194ad9,_0x52d15d))[_0xf16f('0x45')](handleError(_0x194ad9,null));};exports[_0xf16f('0x46')]=function(_0x10bf43,_0x12c15f){var _0x1162ad={'raw':![],'where':{'id':_0x10bf43['params']['id']}},_0x48e983={};_0x48e983[_0xf16f('0x31')]=_[_0xf16f('0x32')](db[_0xf16f('0x2c')]['rawAttributes']);_0x48e983[_0xf16f('0x33')]=_[_0xf16f('0x32')](_0x10bf43[_0xf16f('0x33')]);_0x48e983[_0xf16f('0x34')]=_[_0xf16f('0x35')](_0x48e983[_0xf16f('0x31')],_0x48e983[_0xf16f('0x33')]);_0x1162ad['attributes']=_['intersection'](_0x48e983[_0xf16f('0x31')],qs[_0xf16f('0x36')](_0x10bf43['query']['fields']));_0x1162ad[_0xf16f('0x37')]=_0x1162ad['attributes']['length']?_0x1162ad['attributes']:_0x48e983[_0xf16f('0x31')];if(_0x10bf43[_0xf16f('0x33')][_0xf16f('0x42')]){_0x1162ad[_0xf16f('0x43')]=[{'all':!![]}];}_0x1162ad=_[_0xf16f('0x3f')]({},_0x1162ad,_0x10bf43[_0xf16f('0x41')]);return db['IntegrationReport'][_0xf16f('0x47')](_0x1162ad)[_0xf16f('0x26')](handleEntityNotFound(_0x12c15f,null))[_0xf16f('0x26')](respondWithResult(_0x12c15f,null))[_0xf16f('0x45')](handleError(_0x12c15f,null));};exports[_0xf16f('0x48')]=function(_0x49da24,_0x4ee061){return db[_0xf16f('0x2c')][_0xf16f('0x48')](_0x49da24[_0xf16f('0x49')],{})[_0xf16f('0x26')](respondWithResult(_0x4ee061,0xc9))['catch'](handleError(_0x4ee061,null));};exports[_0xf16f('0x25')]=function(_0x79b78,_0x485914){if(_0x79b78[_0xf16f('0x49')]['id']){delete _0x79b78[_0xf16f('0x49')]['id'];}return db[_0xf16f('0x2c')][_0xf16f('0x47')]({'where':{'id':_0x79b78[_0xf16f('0x4a')]['id']}})[_0xf16f('0x26')](handleEntityNotFound(_0x485914,null))[_0xf16f('0x26')](saveUpdates(_0x79b78[_0xf16f('0x49')],null))['then'](respondWithResult(_0x485914,null))['catch'](handleError(_0x485914,null));};exports['destroy']=function(_0x349fc8,_0x1ea528){return db[_0xf16f('0x2c')][_0xf16f('0x47')]({'where':{'id':_0x349fc8['params']['id']}})[_0xf16f('0x26')](handleEntityNotFound(_0x1ea528,null))[_0xf16f('0x26')](removeEntity(_0x1ea528,null))[_0xf16f('0x45')](handleError(_0x1ea528,null));};exports[_0xf16f('0x4b')]=function(_0x2500ab,_0x4704a7){return db[_0xf16f('0x2c')]['describe']()[_0xf16f('0x26')](respondWithResult(_0x4704a7,null))[_0xf16f('0x45')](handleError(_0x4704a7,null));}; \ No newline at end of file +var _0xe22c=['stack','name','send','index','map','IntegrationReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','findAll','rows','catch','show','rawAttributes','includeAll','include','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','save','update','destroy','error'];(function(_0x2a66b2,_0x1fb91e){var _0x16d0be=function(_0x498211){while(--_0x498211){_0x2a66b2['push'](_0x2a66b2['shift']());}};_0x16d0be(++_0x1fb91e);}(_0xe22c,0xc0));var _0xce22=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe22c[_0x502c7d];return _0x30b7ed;};'use strict';var emlformat=require(_0xce22('0x0'));var rimraf=require(_0xce22('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xce22('0x2'));var rp=require(_0xce22('0x3'));var moment=require(_0xce22('0x4'));var BPromise=require(_0xce22('0x5'));var Mustache=require(_0xce22('0x6'));var util=require('util');var path=require(_0xce22('0x7'));var sox=require(_0xce22('0x8'));var csv=require('to-csv');var ejs=require(_0xce22('0x9'));var fs=require('fs');var fs_extra=require(_0xce22('0xa'));var _=require('lodash');var squel=require(_0xce22('0xb'));var crypto=require('crypto');var jsforce=require(_0xce22('0xc'));var deskjs=require(_0xce22('0xd'));var toCsv=require(_0xce22('0xe'));var querystring=require('querystring');var Papa=require(_0xce22('0xf'));var Redis=require(_0xce22('0x10'));var authService=require(_0xce22('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce22('0x12'));var hardwareService=require(_0xce22('0x13'));var logger=require('../../config/logger')(_0xce22('0x14'));var utils=require(_0xce22('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xce22('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54155a,_0x38e63b){_0x38e63b=_0x38e63b||0xcc;return function(_0xd0c140){if(_0xd0c140){return _0x54155a[_0xce22('0x17')](_0x38e63b);}return _0x54155a[_0xce22('0x18')](_0x38e63b)[_0xce22('0x19')]();};}function respondWithResult(_0x2ab3e3,_0x5b7a23){_0x5b7a23=_0x5b7a23||0xc8;return function(_0x51e434){if(_0x51e434){return _0x2ab3e3[_0xce22('0x18')](_0x5b7a23)[_0xce22('0x1a')](_0x51e434);}};}function respondWithFilteredResult(_0x509449,_0x2f5c4f){return function(_0x98edb2){if(_0x98edb2){var _0x3a580c=typeof _0x2f5c4f['offset']==='undefined'&&typeof _0x2f5c4f[_0xce22('0x1b')]===_0xce22('0x1c');var _0x1d162d=_0x98edb2[_0xce22('0x1d')];var _0x5a5f06=_0x3a580c?0x0:_0x2f5c4f[_0xce22('0x1e')];var _0x1f41f9=_0x3a580c?_0x98edb2[_0xce22('0x1d')]:_0x2f5c4f[_0xce22('0x1e')]+_0x2f5c4f['limit'];var _0x2ee65e;if(_0x1f41f9>=_0x1d162d){_0x1f41f9=_0x1d162d;_0x2ee65e=0xc8;}else{_0x2ee65e=0xce;}_0x509449[_0xce22('0x18')](_0x2ee65e);return _0x509449['set'](_0xce22('0x1f'),_0x5a5f06+'-'+_0x1f41f9+'/'+_0x1d162d)[_0xce22('0x1a')](_0x98edb2);}return null;};}function patchUpdates(_0x1bbeff){return function(_0x5e67bc){try{jsonpatch['apply'](_0x5e67bc,_0x1bbeff,!![]);}catch(_0x50af53){return BPromise['reject'](_0x50af53);}return _0x5e67bc[_0xce22('0x20')]();};}function saveUpdates(_0x4c9e85,_0x2bcd81){return function(_0x552d63){if(_0x552d63){return _0x552d63[_0xce22('0x21')](_0x4c9e85)['then'](function(_0x30d531){return _0x30d531;});}return null;};}function removeEntity(_0x20aa84,_0x37dfea){return function(_0x14d4dc){if(_0x14d4dc){return _0x14d4dc[_0xce22('0x22')]()['then'](function(){_0x20aa84[_0xce22('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dc7ee,_0x1c94ca){return function(_0x5c2182){if(!_0x5c2182){_0x3dc7ee[_0xce22('0x17')](0x194);}return _0x5c2182;};}function handleError(_0x4fedf4,_0x196d79){_0x196d79=_0x196d79||0x1f4;return function(_0x435d66){logger[_0xce22('0x23')](_0x435d66[_0xce22('0x24')]);if(_0x435d66[_0xce22('0x25')]){delete _0x435d66[_0xce22('0x25')];}_0x4fedf4['status'](_0x196d79)[_0xce22('0x26')](_0x435d66);};}exports[_0xce22('0x27')]=function(_0x2640ab,_0x595533){var _0x505cfa={},_0x2d3cfd={},_0x3a6e6e={'count':0x0,'rows':[]};var _0x1f8912=_[_0xce22('0x28')](db[_0xce22('0x29')]['rawAttributes'],function(_0x1e2727){return{'name':_0x1e2727[_0xce22('0x2a')],'type':_0x1e2727[_0xce22('0x2b')][_0xce22('0x2c')]};});_0x2d3cfd['model']=_[_0xce22('0x28')](_0x1f8912,'name');_0x2d3cfd[_0xce22('0x2d')]=_[_0xce22('0x2e')](_0x2640ab[_0xce22('0x2d')]);_0x2d3cfd[_0xce22('0x2f')]=_[_0xce22('0x30')](_0x2d3cfd['model'],_0x2d3cfd[_0xce22('0x2d')]);_0x505cfa[_0xce22('0x31')]=_['intersection'](_0x2d3cfd[_0xce22('0x32')],qs['fields'](_0x2640ab[_0xce22('0x2d')][_0xce22('0x33')]));_0x505cfa[_0xce22('0x31')]=_0x505cfa[_0xce22('0x31')][_0xce22('0x34')]?_0x505cfa[_0xce22('0x31')]:_0x2d3cfd[_0xce22('0x32')];if(!_0x2640ab['query'][_0xce22('0x35')](_0xce22('0x36'))){_0x505cfa[_0xce22('0x1b')]=qs[_0xce22('0x1b')](_0x2640ab[_0xce22('0x2d')]['limit']);_0x505cfa['offset']=qs[_0xce22('0x1e')](_0x2640ab['query'][_0xce22('0x1e')]);}_0x505cfa[_0xce22('0x37')]=qs[_0xce22('0x38')](_0x2640ab[_0xce22('0x2d')][_0xce22('0x38')]);_0x505cfa[_0xce22('0x39')]=qs['filters'](_[_0xce22('0x3a')](_0x2640ab[_0xce22('0x2d')],_0x2d3cfd[_0xce22('0x2f')]),_0x1f8912);if(_0x2640ab[_0xce22('0x2d')][_0xce22('0x3b')]){_0x505cfa[_0xce22('0x39')]=_[_0xce22('0x3c')](_0x505cfa[_0xce22('0x39')],{'$or':_[_0xce22('0x28')](_0x1f8912,function(_0x3efa12){if(_0x3efa12[_0xce22('0x2b')]!==_0xce22('0x3d')){var _0x263848={};_0x263848[_0x3efa12['name']]={'$like':'%'+_0x2640ab[_0xce22('0x2d')][_0xce22('0x3b')]+'%'};return _0x263848;}})});}_0x505cfa=_[_0xce22('0x3c')]({},_0x505cfa,_0x2640ab[_0xce22('0x3e')]);var _0x317ef7={'where':_0x505cfa[_0xce22('0x39')]};return db[_0xce22('0x29')][_0xce22('0x1d')](_0x317ef7)[_0xce22('0x3f')](function(_0x4fd40e){_0x3a6e6e[_0xce22('0x1d')]=_0x4fd40e;if(_0x2640ab[_0xce22('0x2d')]['includeAll']){_0x505cfa['include']=[{'all':!![]}];}return db[_0xce22('0x29')][_0xce22('0x40')](_0x505cfa);})[_0xce22('0x3f')](function(_0x1f2bef){_0x3a6e6e[_0xce22('0x41')]=_0x1f2bef;return _0x3a6e6e;})[_0xce22('0x3f')](respondWithFilteredResult(_0x595533,_0x505cfa))[_0xce22('0x42')](handleError(_0x595533,null));};exports[_0xce22('0x43')]=function(_0x32d5b7,_0xc48369){var _0x276b42={'raw':![],'where':{'id':_0x32d5b7['params']['id']}},_0x2ce728={};_0x2ce728[_0xce22('0x32')]=_['keys'](db[_0xce22('0x29')][_0xce22('0x44')]);_0x2ce728[_0xce22('0x2d')]=_['keys'](_0x32d5b7['query']);_0x2ce728['filters']=_[_0xce22('0x30')](_0x2ce728[_0xce22('0x32')],_0x2ce728[_0xce22('0x2d')]);_0x276b42[_0xce22('0x31')]=_['intersection'](_0x2ce728['model'],qs[_0xce22('0x33')](_0x32d5b7['query']['fields']));_0x276b42[_0xce22('0x31')]=_0x276b42['attributes'][_0xce22('0x34')]?_0x276b42[_0xce22('0x31')]:_0x2ce728[_0xce22('0x32')];if(_0x32d5b7[_0xce22('0x2d')][_0xce22('0x45')]){_0x276b42[_0xce22('0x46')]=[{'all':!![]}];}_0x276b42=_[_0xce22('0x3c')]({},_0x276b42,_0x32d5b7['options']);return db[_0xce22('0x29')][_0xce22('0x47')](_0x276b42)[_0xce22('0x3f')](handleEntityNotFound(_0xc48369,null))[_0xce22('0x3f')](respondWithResult(_0xc48369,null))[_0xce22('0x42')](handleError(_0xc48369,null));};exports['create']=function(_0x379d09,_0x515ef1){return db['IntegrationReport'][_0xce22('0x48')](_0x379d09[_0xce22('0x49')],{})[_0xce22('0x3f')](respondWithResult(_0x515ef1,0xc9))[_0xce22('0x42')](handleError(_0x515ef1,null));};exports[_0xce22('0x21')]=function(_0x23054b,_0x7debd4){if(_0x23054b['body']['id']){delete _0x23054b[_0xce22('0x49')]['id'];}return db[_0xce22('0x29')]['find']({'where':{'id':_0x23054b[_0xce22('0x4a')]['id']}})[_0xce22('0x3f')](handleEntityNotFound(_0x7debd4,null))[_0xce22('0x3f')](saveUpdates(_0x23054b[_0xce22('0x49')],null))[_0xce22('0x3f')](respondWithResult(_0x7debd4,null))[_0xce22('0x42')](handleError(_0x7debd4,null));};exports[_0xce22('0x22')]=function(_0x54027f,_0x2506b1){return db['IntegrationReport']['find']({'where':{'id':_0x54027f[_0xce22('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2506b1,null))['then'](removeEntity(_0x2506b1,null))[_0xce22('0x42')](handleError(_0x2506b1,null));};exports[_0xce22('0x4b')]=function(_0xe0c6a3,_0x5753fe){return db[_0xce22('0x29')]['describe']()[_0xce22('0x3f')](respondWithResult(_0x5753fe,null))[_0xce22('0x42')](handleError(_0x5753fe,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 190cc8d..78b1abc 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 _0x2c8d=['path','../../config/environment','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2726d0,_0x5b2554){var _0x37ef2c=function(_0x160a1f){while(--_0x160a1f){_0x2726d0['push'](_0x2726d0['shift']());}};_0x37ef2c(++_0x5b2554);}(_0x2c8d,0x162));var _0xd2c8=function(_0x5d37c8,_0x366d21){_0x5d37c8=_0x5d37c8-0x0;var _0x1afc14=_0x2c8d[_0x5d37c8];return _0x1afc14;};'use strict';var _=require(_0xd2c8('0x0'));var util=require(_0xd2c8('0x1'));var logger=require(_0xd2c8('0x2'))(_0xd2c8('0x3'));var moment=require('moment');var BPromise=require(_0xd2c8('0x4'));var rp=require(_0xd2c8('0x5'));var fs=require('fs');var path=require(_0xd2c8('0x6'));var rimraf=require('rimraf');var config=require(_0xd2c8('0x7'));var attributes=require('./integrationReport.attributes');module[_0xd2c8('0x8')]=function(_0x20ce8f,_0x51ba06){return _0x20ce8f[_0xd2c8('0x9')](_0xd2c8('0xa'),attributes,{'tableName':_0xd2c8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7c34=['IntegrationReport','report_integration','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes','define'];(function(_0x3aadf2,_0x1f1b0d){var _0x58083f=function(_0xc56293){while(--_0xc56293){_0x3aadf2['push'](_0x3aadf2['shift']());}};_0x58083f(++_0x1f1b0d);}(_0x7c34,0x92));var _0x47c3=function(_0x525563,_0x3e09c7){_0x525563=_0x525563-0x0;var _0xf41491=_0x7c34[_0x525563];return _0xf41491;};'use strict';var _=require(_0x47c3('0x0'));var util=require(_0x47c3('0x1'));var logger=require('../../config/logger')(_0x47c3('0x2'));var moment=require(_0x47c3('0x3'));var BPromise=require('bluebird');var rp=require(_0x47c3('0x4'));var fs=require('fs');var path=require(_0x47c3('0x5'));var rimraf=require(_0x47c3('0x6'));var config=require(_0x47c3('0x7'));var attributes=require(_0x47c3('0x8'));module['exports']=function(_0x7e8ec0,_0x29b841){return _0x7e8ec0[_0x47c3('0x9')](_0x47c3('0xa'),attributes,{'tableName':_0x47c3('0xb'),'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 80ef238..3d63054 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4f4c35,_0x10d43f){var _0xf13003=function(_0x2acbdd){while(--_0x2acbdd){_0x4f4c35['push'](_0x4f4c35['shift']());}};_0xf13003(++_0x10d43f);}(_0x2542,0x169));var _0x2254=function(_0xe8be,_0x2e00f2){_0xe8be=_0xe8be-0x0;var _0x16d471=_0x2542[_0xe8be];return _0x16d471;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','IntegrationReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0x4137,0xf8));var _0x7413=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x4137[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('IntegrationReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 19a2973..a602ea7 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 _0x16a7=['put','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals'];(function(_0x422853,_0xe95ba4){var _0xc62fc=function(_0x3aca39){while(--_0x3aca39){_0x422853['push'](_0x422853['shift']());}};_0xc62fc(++_0xe95ba4);}(_0x16a7,0xa5));var _0x716a=function(_0x2cb471,_0x114d4b){_0x2cb471=_0x2cb471-0x0;var _0x4c6a3d=_0x16a7[_0x2cb471];return _0x4c6a3d;};'use strict';var multer=require(_0x716a('0x0'));var util=require(_0x716a('0x1'));var path=require(_0x716a('0x2'));var timeout=require(_0x716a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x716a('0x4'));var auth=require(_0x716a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x716a('0x6'));var controller=require(_0x716a('0x7'));router[_0x716a('0x8')]('/',auth[_0x716a('0x9')](),controller[_0x716a('0xa')]);router['get'](_0x716a('0xb'),auth[_0x716a('0x9')](),controller[_0x716a('0xc')]);router[_0x716a('0x8')]('/:id/sub_intervals',auth[_0x716a('0x9')](),controller[_0x716a('0xd')]);router[_0x716a('0xe')]('/',auth[_0x716a('0x9')](),controller[_0x716a('0xf')]);router[_0x716a('0xe')]('/:id/sub_intervals',auth[_0x716a('0x9')](),controller[_0x716a('0x10')]);router[_0x716a('0xe')](_0x716a('0x11'),auth[_0x716a('0x9')](),controller[_0x716a('0x12')]);router[_0x716a('0x13')]('/:id',auth[_0x716a('0x9')](),controller[_0x716a('0x14')]);router['delete'](_0x716a('0xb'),auth['isAuthenticated'](),controller[_0x716a('0x15')]);module[_0x716a('0x16')]=router; \ No newline at end of file +var _0x5a99=['get','isAuthenticated','/:id','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./interval.controller'];(function(_0x2ad034,_0x50099a){var _0x1b4252=function(_0x495952){while(--_0x495952){_0x2ad034['push'](_0x2ad034['shift']());}};_0x1b4252(++_0x50099a);}(_0x5a99,0xc9));var _0x95a9=function(_0x6cc656,_0x17b577){_0x6cc656=_0x6cc656-0x0;var _0x170c68=_0x5a99[_0x6cc656];return _0x170c68;};'use strict';var multer=require(_0x95a9('0x0'));var util=require(_0x95a9('0x1'));var path=require(_0x95a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x95a9('0x3'));var router=express[_0x95a9('0x4')]();var fs_extra=require(_0x95a9('0x5'));var auth=require(_0x95a9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x95a9('0x7'));var controller=require(_0x95a9('0x8'));router[_0x95a9('0x9')]('/',auth[_0x95a9('0xa')](),controller['index']);router[_0x95a9('0x9')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller['show']);router[_0x95a9('0x9')]('/:id/sub_intervals',auth[_0x95a9('0xa')](),controller[_0x95a9('0xc')]);router[_0x95a9('0xd')]('/',auth[_0x95a9('0xa')](),controller[_0x95a9('0xe')]);router['post']('/:id/sub_intervals',auth[_0x95a9('0xa')](),controller[_0x95a9('0xf')]);router['post'](_0x95a9('0x10'),auth['isAuthenticated'](),controller[_0x95a9('0x11')]);router[_0x95a9('0x12')](_0x95a9('0xb'),auth[_0x95a9('0xa')](),controller[_0x95a9('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x95a9('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 219461b..8773288 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 _0x4902=['STRING','sequelize','exports'];(function(_0x127b0e,_0x475a02){var _0x3f167a=function(_0x149ab2){while(--_0x149ab2){_0x127b0e['push'](_0x127b0e['shift']());}};_0x3f167a(++_0x475a02);}(_0x4902,0x13f));var _0x2490=function(_0x574edb,_0x59efb8){_0x574edb=_0x574edb-0x0;var _0x3fc535=_0x4902[_0x574edb];return _0x3fc535;};'use strict';var Sequelize=require(_0x2490('0x0'));module[_0x2490('0x1')]={'name':{'type':Sequelize[_0x2490('0x2')]},'description':{'type':Sequelize[_0x2490('0x2')]},'interval':{'type':Sequelize[_0x2490('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x26c2=['exports','STRING'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x26c2,0x18c));var _0x226c=function(_0x345b3d,_0x59e550){_0x345b3d=_0x345b3d-0x0;var _0x5a610d=_0x26c2[_0x345b3d];return _0x5a610d;};'use strict';var Sequelize=require('sequelize');module[_0x226c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x226c('0x1')]},'interval':{'type':Sequelize[_0x226c('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 5363c19..8c2744c 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 _0xeab7=['api','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','limit','count','set','reject','save','update','then','get','destroy','error','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','getIntervals','findOne','nolimit','addIntervals','sequelize','transaction','bulkCreate','eml-format','request-promise','moment','mustache','sox','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x2f3947,_0x2ee083){var _0x3e6ab7=function(_0x4057c0){while(--_0x4057c0){_0x2f3947['push'](_0x2f3947['shift']());}};_0x3e6ab7(++_0x2ee083);}(_0xeab7,0x99));var _0x7eab=function(_0x3cb2bb,_0x13c4bb){_0x3cb2bb=_0x3cb2bb-0x0;var _0x4165bc=_0xeab7[_0x3cb2bb];return _0x4165bc;};'use strict';var emlformat=require(_0x7eab('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7eab('0x1'));var moment=require(_0x7eab('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x7eab('0x3'));var util=require('util');var path=require('path');var sox=require(_0x7eab('0x4'));var csv=require(_0x7eab('0x5'));var ejs=require(_0x7eab('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x7eab('0x7'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7eab('0x8'));var toCsv=require(_0x7eab('0x5'));var querystring=require(_0x7eab('0x9'));var Papa=require(_0x7eab('0xa'));var Redis=require(_0x7eab('0xb'));var authService=require(_0x7eab('0xc'));var qs=require(_0x7eab('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7eab('0xe'))(_0x7eab('0xf'));var utils=require('../../config/utils');var config=require(_0x7eab('0x10'));var licenseUtil=require(_0x7eab('0x11'));var db=require(_0x7eab('0x12'))['db'];var extensions=require(_0x7eab('0x13'));function respondWithStatusCode(_0x56940f,_0x46c19a){_0x46c19a=_0x46c19a||0xcc;return function(_0x2dfd7d){if(_0x2dfd7d){return _0x56940f[_0x7eab('0x14')](_0x46c19a);}return _0x56940f[_0x7eab('0x15')](_0x46c19a)[_0x7eab('0x16')]();};}function respondWithResult(_0x2e724d,_0x2dc32a){_0x2dc32a=_0x2dc32a||0xc8;return function(_0x36640a){if(_0x36640a){return _0x2e724d[_0x7eab('0x15')](_0x2dc32a)[_0x7eab('0x17')](_0x36640a);}};}function respondWithFilteredResult(_0x43c621,_0x417ef8){return function(_0x5ed450){if(_0x5ed450){var _0xefdf34=typeof _0x417ef8[_0x7eab('0x18')]==='undefined'&&typeof _0x417ef8[_0x7eab('0x19')]==='undefined';var _0x6c1d63=_0x5ed450[_0x7eab('0x1a')];var _0x404f54=_0xefdf34?0x0:_0x417ef8[_0x7eab('0x18')];var _0x3429ae=_0xefdf34?_0x5ed450[_0x7eab('0x1a')]:_0x417ef8[_0x7eab('0x18')]+_0x417ef8[_0x7eab('0x19')];var _0x379d1b;if(_0x3429ae>=_0x6c1d63){_0x3429ae=_0x6c1d63;_0x379d1b=0xc8;}else{_0x379d1b=0xce;}_0x43c621['status'](_0x379d1b);return _0x43c621[_0x7eab('0x1b')]('Content-Range',_0x404f54+'-'+_0x3429ae+'/'+_0x6c1d63)[_0x7eab('0x17')](_0x5ed450);}return null;};}function patchUpdates(_0x3bc9b2){return function(_0x4628c4){try{jsonpatch['apply'](_0x4628c4,_0x3bc9b2,!![]);}catch(_0x5000e0){return BPromise[_0x7eab('0x1c')](_0x5000e0);}return _0x4628c4[_0x7eab('0x1d')]();};}function saveUpdates(_0x5e9726,_0x233af9){return function(_0x1ce4b6){if(_0x1ce4b6){return _0x1ce4b6[_0x7eab('0x1e')](_0x5e9726)['then'](function(_0x3c8cae){return _0x3c8cae;});}return null;};}function removeEntity(_0x478726,_0x8c47d2){return function(_0xfffc23){if(_0xfffc23){return _0xfffc23['destroy']()[_0x7eab('0x1f')](function(){var _0x558914=_0xfffc23[_0x7eab('0x20')]({'plain':!![]});var _0x502296='Intervals';return db['UserProfileResource'][_0x7eab('0x21')]({'where':{'type':_0x502296,'resourceId':_0x558914['id']}})[_0x7eab('0x1f')](function(){return _0xfffc23;});})[_0x7eab('0x1f')](function(){_0x478726[_0x7eab('0x15')](0xcc)[_0x7eab('0x16')]();});}};}function handleEntityNotFound(_0x33d010,_0x258c1f){return function(_0x482a88){if(!_0x482a88){_0x33d010[_0x7eab('0x14')](0x194);}return _0x482a88;};}function handleError(_0x22ce2d,_0x462f2){_0x462f2=_0x462f2||0x1f4;return function(_0x3e7d3c){logger[_0x7eab('0x22')](_0x3e7d3c['stack']);if(_0x3e7d3c['name']){delete _0x3e7d3c[_0x7eab('0x23')];}_0x22ce2d[_0x7eab('0x15')](_0x462f2)[_0x7eab('0x24')](_0x3e7d3c);};}exports[_0x7eab('0x25')]=function(_0x1bfc5e,_0x3caf62){var _0x411f48={},_0xf1de02={},_0x54f264={'count':0x0,'rows':[]};var _0x21741c=_[_0x7eab('0x26')](db[_0x7eab('0x27')][_0x7eab('0x28')],function(_0x433472){return{'name':_0x433472[_0x7eab('0x29')],'type':_0x433472[_0x7eab('0x2a')][_0x7eab('0x2b')]};});_0xf1de02[_0x7eab('0x2c')]=_[_0x7eab('0x26')](_0x21741c,_0x7eab('0x23'));_0xf1de02[_0x7eab('0x2d')]=_[_0x7eab('0x2e')](_0x1bfc5e[_0x7eab('0x2d')]);_0xf1de02[_0x7eab('0x2f')]=_['intersection'](_0xf1de02['model'],_0xf1de02[_0x7eab('0x2d')]);_0x411f48[_0x7eab('0x30')]=_[_0x7eab('0x31')](_0xf1de02['model'],qs[_0x7eab('0x32')](_0x1bfc5e[_0x7eab('0x2d')][_0x7eab('0x32')]));_0x411f48[_0x7eab('0x30')]=_0x411f48['attributes'][_0x7eab('0x33')]?_0x411f48[_0x7eab('0x30')]:_0xf1de02[_0x7eab('0x2c')];if(!_0x1bfc5e['query'][_0x7eab('0x34')]('nolimit')){_0x411f48[_0x7eab('0x19')]=qs[_0x7eab('0x19')](_0x1bfc5e[_0x7eab('0x2d')][_0x7eab('0x19')]);_0x411f48[_0x7eab('0x18')]=qs[_0x7eab('0x18')](_0x1bfc5e[_0x7eab('0x2d')][_0x7eab('0x18')]);}_0x411f48[_0x7eab('0x35')]=qs['sort'](_0x1bfc5e[_0x7eab('0x2d')][_0x7eab('0x36')]);_0x411f48[_0x7eab('0x37')]=qs[_0x7eab('0x2f')](_[_0x7eab('0x38')](_0x1bfc5e[_0x7eab('0x2d')],_0xf1de02[_0x7eab('0x2f')]),_0x21741c);if(_0x1bfc5e['query']['filter']){_0x411f48[_0x7eab('0x37')]=_[_0x7eab('0x39')](_0x411f48[_0x7eab('0x37')],{'$or':_[_0x7eab('0x26')](_0x21741c,function(_0x5841e9){if(_0x5841e9[_0x7eab('0x2a')]!=='VIRTUAL'){var _0x4fbdd4={};_0x4fbdd4[_0x5841e9['name']]={'$like':'%'+_0x1bfc5e[_0x7eab('0x2d')][_0x7eab('0x3a')]+'%'};return _0x4fbdd4;}})});}_0x411f48=_[_0x7eab('0x39')]({},_0x411f48,_0x1bfc5e[_0x7eab('0x3b')]);var _0x5105cd={'where':_0x411f48[_0x7eab('0x37')]};return db[_0x7eab('0x27')][_0x7eab('0x1a')](_0x5105cd)[_0x7eab('0x1f')](function(_0x599363){_0x54f264[_0x7eab('0x1a')]=_0x599363;if(_0x1bfc5e['query'][_0x7eab('0x3c')]){_0x411f48['include']=[{'all':!![]}];}return db[_0x7eab('0x27')][_0x7eab('0x3d')](_0x411f48);})['then'](function(_0x57cce2){_0x54f264[_0x7eab('0x3e')]=_0x57cce2;return _0x54f264;})[_0x7eab('0x1f')](respondWithFilteredResult(_0x3caf62,_0x411f48))[_0x7eab('0x3f')](handleError(_0x3caf62,null));};exports[_0x7eab('0x40')]=function(_0x16e585,_0x3a4627){var _0x1d01db={'raw':!![],'where':{'id':_0x16e585[_0x7eab('0x41')]['id']}},_0x4cef7e={};_0x4cef7e['model']=_[_0x7eab('0x2e')](db['Interval'][_0x7eab('0x28')]);_0x4cef7e['query']=_[_0x7eab('0x2e')](_0x16e585[_0x7eab('0x2d')]);_0x4cef7e[_0x7eab('0x2f')]=_[_0x7eab('0x31')](_0x4cef7e[_0x7eab('0x2c')],_0x4cef7e[_0x7eab('0x2d')]);_0x1d01db[_0x7eab('0x30')]=_[_0x7eab('0x31')](_0x4cef7e[_0x7eab('0x2c')],qs[_0x7eab('0x32')](_0x16e585[_0x7eab('0x2d')]['fields']));_0x1d01db[_0x7eab('0x30')]=_0x1d01db[_0x7eab('0x30')][_0x7eab('0x33')]?_0x1d01db[_0x7eab('0x30')]:_0x4cef7e['model'];if(_0x16e585[_0x7eab('0x2d')][_0x7eab('0x3c')]){_0x1d01db[_0x7eab('0x42')]=[{'all':!![]}];}_0x1d01db=_[_0x7eab('0x39')]({},_0x1d01db,_0x16e585[_0x7eab('0x3b')]);return db[_0x7eab('0x27')][_0x7eab('0x43')](_0x1d01db)[_0x7eab('0x1f')](handleEntityNotFound(_0x3a4627,null))[_0x7eab('0x1f')](respondWithResult(_0x3a4627,null))[_0x7eab('0x3f')](handleError(_0x3a4627,null));};exports['create']=function(_0x3437cb,_0x25d37e){return db[_0x7eab('0x27')][_0x7eab('0x44')](_0x3437cb[_0x7eab('0x45')],{})[_0x7eab('0x1f')](function(_0xf9c3af){var _0x1a1759=_0x3437cb[_0x7eab('0x46')][_0x7eab('0x20')]({'plain':!![]});if(!_0x1a1759)throw new Error(_0x7eab('0x47'));if(_0x1a1759[_0x7eab('0x48')]===_0x7eab('0x46')){var _0x32bfe0=_0xf9c3af[_0x7eab('0x20')]({'plain':!![]});var _0x2cd97e='Intervals';return db[_0x7eab('0x49')]['find']({'where':{'name':_0x2cd97e,'userProfileId':_0x1a1759['userProfileId']},'raw':!![]})['then'](function(_0xb8ed15){if(_0xb8ed15&&_0xb8ed15['autoAssociation']===0x0){return db[_0x7eab('0x4a')][_0x7eab('0x44')]({'name':_0x32bfe0['name'],'resourceId':_0x32bfe0['id'],'type':_0xb8ed15[_0x7eab('0x23')],'sectionId':_0xb8ed15['id']},{})[_0x7eab('0x1f')](function(){return _0xf9c3af;});}else{return _0xf9c3af;}})[_0x7eab('0x3f')](function(_0x5b31f1){logger[_0x7eab('0x22')](_0x7eab('0x4b'),_0x5b31f1);throw _0x5b31f1;});}return _0xf9c3af;})['then'](respondWithResult(_0x25d37e,0xc9))['catch'](handleError(_0x25d37e,null));};exports[_0x7eab('0x1e')]=function(_0x53c096,_0x479a36){if(_0x53c096[_0x7eab('0x45')]['id']){delete _0x53c096[_0x7eab('0x45')]['id'];}return db['Interval'][_0x7eab('0x43')]({'where':{'id':_0x53c096[_0x7eab('0x41')]['id']}})[_0x7eab('0x1f')](handleEntityNotFound(_0x479a36,null))[_0x7eab('0x1f')](saveUpdates(_0x53c096[_0x7eab('0x45')],null))[_0x7eab('0x1f')](respondWithResult(_0x479a36,null))[_0x7eab('0x3f')](handleError(_0x479a36,null));};exports['destroy']=function(_0x388406,_0x5c1113){return db[_0x7eab('0x27')][_0x7eab('0x43')]({'where':{'id':_0x388406['params']['id']}})[_0x7eab('0x1f')](handleEntityNotFound(_0x5c1113,null))[_0x7eab('0x1f')](removeEntity(_0x5c1113,null))['catch'](handleError(_0x5c1113,null));};exports['addInterval']=function(_0x5d30e2,_0x2137c0,_0x98e03b){if(_0x5d30e2[_0x7eab('0x45')]['id']){delete _0x5d30e2['body']['id'];}return db[_0x7eab('0x27')]['find']({'where':{'id':_0x5d30e2['params']['id']}})['then'](handleEntityNotFound(_0x2137c0,null))[_0x7eab('0x1f')](function(_0x97c5a6){if(_0x97c5a6){_0x5d30e2[_0x7eab('0x45')][_0x7eab('0x4c')]=_0x97c5a6['id'];return db['Interval'][_0x7eab('0x44')](_0x5d30e2[_0x7eab('0x45')]);}})[_0x7eab('0x1f')](respondWithResult(_0x2137c0,null))[_0x7eab('0x3f')](handleError(_0x2137c0,null));};exports[_0x7eab('0x4d')]=function(_0x5928fa,_0x2924de,_0x5d7864){var _0x4c4dfb={};var _0x471684={};var _0x426252;var _0x193744;return db[_0x7eab('0x27')][_0x7eab('0x4e')]({'where':{'id':_0x5928fa['params']['id']}})[_0x7eab('0x1f')](handleEntityNotFound(_0x2924de,null))[_0x7eab('0x1f')](function(_0x36f6a7){if(_0x36f6a7){_0x426252=_0x36f6a7;_0x471684[_0x7eab('0x2c')]=_['keys'](db[_0x7eab('0x27')][_0x7eab('0x28')]);_0x471684[_0x7eab('0x2d')]=_[_0x7eab('0x2e')](_0x5928fa['query']);_0x471684[_0x7eab('0x2f')]=_[_0x7eab('0x31')](_0x471684[_0x7eab('0x2c')],_0x471684[_0x7eab('0x2d')]);_0x4c4dfb[_0x7eab('0x30')]=_[_0x7eab('0x31')](_0x471684[_0x7eab('0x2c')],qs['fields'](_0x5928fa['query'][_0x7eab('0x32')]));_0x4c4dfb[_0x7eab('0x30')]=_0x4c4dfb['attributes']['length']?_0x4c4dfb[_0x7eab('0x30')]:_0x471684[_0x7eab('0x2c')];_0x4c4dfb[_0x7eab('0x35')]=qs[_0x7eab('0x36')](_0x5928fa[_0x7eab('0x2d')][_0x7eab('0x36')]);_0x4c4dfb[_0x7eab('0x37')]=qs['filters'](_[_0x7eab('0x38')](_0x5928fa[_0x7eab('0x2d')],_0x471684['filters']));if(_0x5928fa['query'][_0x7eab('0x3a')]){_0x4c4dfb[_0x7eab('0x37')]=_['merge'](_0x4c4dfb[_0x7eab('0x37')],{'$or':_[_0x7eab('0x26')](_0x4c4dfb['attributes'],function(_0x3fa99b){var _0x4f3ac9={};_0x4f3ac9[_0x3fa99b]={'$like':'%'+_0x5928fa[_0x7eab('0x2d')][_0x7eab('0x3a')]+'%'};return _0x4f3ac9;})});}_0x4c4dfb=_[_0x7eab('0x39')]({},_0x4c4dfb,_0x5928fa[_0x7eab('0x3b')]);return _0x426252['getIntervals'](_0x4c4dfb);}})[_0x7eab('0x1f')](function(_0x435173){if(_0x435173){_0x193744=_0x435173[_0x7eab('0x33')];if(!_0x5928fa[_0x7eab('0x2d')]['hasOwnProperty'](_0x7eab('0x4f'))){_0x4c4dfb[_0x7eab('0x19')]=qs[_0x7eab('0x19')](_0x5928fa[_0x7eab('0x2d')][_0x7eab('0x19')]);_0x4c4dfb['offset']=qs[_0x7eab('0x18')](_0x5928fa['query'][_0x7eab('0x18')]);}return _0x426252[_0x7eab('0x4d')](_0x4c4dfb);}})[_0x7eab('0x1f')](function(_0x39b66f){if(_0x39b66f){return _0x39b66f?{'count':_0x193744,'rows':_0x39b66f}:null;}})[_0x7eab('0x1f')](respondWithResult(_0x2924de,null))[_0x7eab('0x3f')](handleError(_0x2924de,null));};exports[_0x7eab('0x50')]=function(_0x27384e,_0x519d3c,_0x2e9988){return db[_0x7eab('0x27')][_0x7eab('0x4e')]({'where':{'id':_0x27384e['params']['id']}})[_0x7eab('0x1f')](handleEntityNotFound(_0x519d3c,null))[_0x7eab('0x1f')](function(_0x226bd6){if(_0x226bd6){return db[_0x7eab('0x51')][_0x7eab('0x52')](function(_0x5916a1){return db['Interval']['destroy']({'where':{'IntervalId':_0x27384e[_0x7eab('0x41')]['id']},'transaction':_0x5916a1})[_0x7eab('0x1f')](function(_0x9de6b2){var _0x171d77=_['map'](_0x27384e[_0x7eab('0x45')],function(_0x445d7d){delete _0x445d7d['id'];_0x445d7d[_0x7eab('0x4c')]=_0x27384e[_0x7eab('0x41')]['id'];return _0x445d7d;});return db[_0x7eab('0x27')][_0x7eab('0x53')](_0x171d77,{'transaction':_0x5916a1});});})[_0x7eab('0x1f')](function(){return db[_0x7eab('0x27')][_0x7eab('0x3d')]({'where':{'IntervalId':_0x27384e['params']['id']}});});}})[_0x7eab('0x1f')](respondWithResult(_0x519d3c,null))['catch'](handleError(_0x519d3c,null));}; \ No newline at end of file +var _0x8f22=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','rows','catch','show','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','params','addInterval','IntervalId','getIntervals','length','addIntervals','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x47cf83,_0x1a543a){var _0xa72a8d=function(_0x2d67de){while(--_0x2d67de){_0x47cf83['push'](_0x47cf83['shift']());}};_0xa72a8d(++_0x1a543a);}(_0x8f22,0x7f));var _0x28f2=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8f22[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x28f2('0x0'));var rimraf=require(_0x28f2('0x1'));var zipdir=require(_0x28f2('0x2'));var jsonpatch=require(_0x28f2('0x3'));var rp=require(_0x28f2('0x4'));var moment=require(_0x28f2('0x5'));var BPromise=require(_0x28f2('0x6'));var Mustache=require(_0x28f2('0x7'));var util=require(_0x28f2('0x8'));var path=require(_0x28f2('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x28f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x28f2('0xb'));var squel=require(_0x28f2('0xc'));var crypto=require(_0x28f2('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x28f2('0xe'));var toCsv=require(_0x28f2('0xf'));var querystring=require(_0x28f2('0x10'));var Papa=require(_0x28f2('0x11'));var Redis=require(_0x28f2('0x12'));var authService=require(_0x28f2('0x13'));var qs=require(_0x28f2('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x28f2('0x15'));var logger=require(_0x28f2('0x16'))('api');var utils=require(_0x28f2('0x17'));var config=require(_0x28f2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x28f2('0x19'))['db'];var extensions=require(_0x28f2('0x1a'));function respondWithStatusCode(_0x2a4d14,_0x268740){_0x268740=_0x268740||0xcc;return function(_0x2e4c08){if(_0x2e4c08){return _0x2a4d14[_0x28f2('0x1b')](_0x268740);}return _0x2a4d14[_0x28f2('0x1c')](_0x268740)[_0x28f2('0x1d')]();};}function respondWithResult(_0x4c6f1f,_0xc6565f){_0xc6565f=_0xc6565f||0xc8;return function(_0x42aea7){if(_0x42aea7){return _0x4c6f1f[_0x28f2('0x1c')](_0xc6565f)[_0x28f2('0x1e')](_0x42aea7);}};}function respondWithFilteredResult(_0x5e4f05,_0x594fba){return function(_0x3ddc8c){if(_0x3ddc8c){var _0x85d59d=typeof _0x594fba['offset']===_0x28f2('0x1f')&&typeof _0x594fba['limit']===_0x28f2('0x1f');var _0x4dc07f=_0x3ddc8c[_0x28f2('0x20')];var _0x4c080e=_0x85d59d?0x0:_0x594fba[_0x28f2('0x21')];var _0x64fbb6=_0x85d59d?_0x3ddc8c[_0x28f2('0x20')]:_0x594fba[_0x28f2('0x21')]+_0x594fba[_0x28f2('0x22')];var _0x160a68;if(_0x64fbb6>=_0x4dc07f){_0x64fbb6=_0x4dc07f;_0x160a68=0xc8;}else{_0x160a68=0xce;}_0x5e4f05[_0x28f2('0x1c')](_0x160a68);return _0x5e4f05[_0x28f2('0x23')](_0x28f2('0x24'),_0x4c080e+'-'+_0x64fbb6+'/'+_0x4dc07f)['json'](_0x3ddc8c);}return null;};}function patchUpdates(_0x47846e){return function(_0x4e1d7e){try{jsonpatch['apply'](_0x4e1d7e,_0x47846e,!![]);}catch(_0x27dd54){return BPromise['reject'](_0x27dd54);}return _0x4e1d7e['save']();};}function saveUpdates(_0x5989ad,_0x929569){return function(_0x1242c9){if(_0x1242c9){return _0x1242c9[_0x28f2('0x25')](_0x5989ad)[_0x28f2('0x26')](function(_0xe5a5dd){return _0xe5a5dd;});}return null;};}function removeEntity(_0x2405aa,_0x431875){return function(_0x4a6f71){if(_0x4a6f71){return _0x4a6f71[_0x28f2('0x27')]()['then'](function(){var _0x39dc5d=_0x4a6f71[_0x28f2('0x28')]({'plain':!![]});var _0x3cff60=_0x28f2('0x29');return db[_0x28f2('0x2a')][_0x28f2('0x27')]({'where':{'type':_0x3cff60,'resourceId':_0x39dc5d['id']}})['then'](function(){return _0x4a6f71;});})[_0x28f2('0x26')](function(){_0x2405aa['status'](0xcc)[_0x28f2('0x1d')]();});}};}function handleEntityNotFound(_0x5886ca,_0x5313d1){return function(_0xe4ea88){if(!_0xe4ea88){_0x5886ca[_0x28f2('0x1b')](0x194);}return _0xe4ea88;};}function handleError(_0xf8b431,_0x18cecf){_0x18cecf=_0x18cecf||0x1f4;return function(_0x3ac616){logger['error'](_0x3ac616[_0x28f2('0x2b')]);if(_0x3ac616[_0x28f2('0x2c')]){delete _0x3ac616[_0x28f2('0x2c')];}_0xf8b431[_0x28f2('0x1c')](_0x18cecf)[_0x28f2('0x2d')](_0x3ac616);};}exports['index']=function(_0x5eed50,_0x4eb584){var _0x53b98f={},_0x47db44={},_0x4aca93={'count':0x0,'rows':[]};var _0x3fe261=_[_0x28f2('0x2e')](db[_0x28f2('0x2f')][_0x28f2('0x30')],function(_0x134d46){return{'name':_0x134d46[_0x28f2('0x31')],'type':_0x134d46[_0x28f2('0x32')][_0x28f2('0x33')]};});_0x47db44[_0x28f2('0x34')]=_[_0x28f2('0x2e')](_0x3fe261,_0x28f2('0x2c'));_0x47db44[_0x28f2('0x35')]=_['keys'](_0x5eed50[_0x28f2('0x35')]);_0x47db44[_0x28f2('0x36')]=_[_0x28f2('0x37')](_0x47db44[_0x28f2('0x34')],_0x47db44['query']);_0x53b98f[_0x28f2('0x38')]=_[_0x28f2('0x37')](_0x47db44[_0x28f2('0x34')],qs[_0x28f2('0x39')](_0x5eed50[_0x28f2('0x35')][_0x28f2('0x39')]));_0x53b98f[_0x28f2('0x38')]=_0x53b98f[_0x28f2('0x38')]['length']?_0x53b98f[_0x28f2('0x38')]:_0x47db44[_0x28f2('0x34')];if(!_0x5eed50['query'][_0x28f2('0x3a')](_0x28f2('0x3b'))){_0x53b98f[_0x28f2('0x22')]=qs[_0x28f2('0x22')](_0x5eed50[_0x28f2('0x35')]['limit']);_0x53b98f['offset']=qs[_0x28f2('0x21')](_0x5eed50['query'][_0x28f2('0x21')]);}_0x53b98f[_0x28f2('0x3c')]=qs['sort'](_0x5eed50[_0x28f2('0x35')][_0x28f2('0x3d')]);_0x53b98f['where']=qs[_0x28f2('0x36')](_['pick'](_0x5eed50['query'],_0x47db44[_0x28f2('0x36')]),_0x3fe261);if(_0x5eed50['query'][_0x28f2('0x3e')]){_0x53b98f[_0x28f2('0x3f')]=_[_0x28f2('0x40')](_0x53b98f[_0x28f2('0x3f')],{'$or':_['map'](_0x3fe261,function(_0x4b132d){if(_0x4b132d[_0x28f2('0x32')]!==_0x28f2('0x41')){var _0x1cac9c={};_0x1cac9c[_0x4b132d[_0x28f2('0x2c')]]={'$like':'%'+_0x5eed50[_0x28f2('0x35')][_0x28f2('0x3e')]+'%'};return _0x1cac9c;}})});}_0x53b98f=_['merge']({},_0x53b98f,_0x5eed50[_0x28f2('0x42')]);var _0x1828ac={'where':_0x53b98f[_0x28f2('0x3f')]};return db[_0x28f2('0x2f')]['count'](_0x1828ac)[_0x28f2('0x26')](function(_0x406686){_0x4aca93[_0x28f2('0x20')]=_0x406686;if(_0x5eed50[_0x28f2('0x35')]['includeAll']){_0x53b98f[_0x28f2('0x43')]=[{'all':!![]}];}return db[_0x28f2('0x2f')]['findAll'](_0x53b98f);})[_0x28f2('0x26')](function(_0x4f9d89){_0x4aca93[_0x28f2('0x44')]=_0x4f9d89;return _0x4aca93;})['then'](respondWithFilteredResult(_0x4eb584,_0x53b98f))[_0x28f2('0x45')](handleError(_0x4eb584,null));};exports[_0x28f2('0x46')]=function(_0x3e7420,_0x19be18){var _0x3a78ba={'raw':!![],'where':{'id':_0x3e7420['params']['id']}},_0x2ac45d={};_0x2ac45d[_0x28f2('0x34')]=_['keys'](db[_0x28f2('0x2f')][_0x28f2('0x30')]);_0x2ac45d[_0x28f2('0x35')]=_['keys'](_0x3e7420[_0x28f2('0x35')]);_0x2ac45d['filters']=_[_0x28f2('0x37')](_0x2ac45d[_0x28f2('0x34')],_0x2ac45d[_0x28f2('0x35')]);_0x3a78ba['attributes']=_[_0x28f2('0x37')](_0x2ac45d[_0x28f2('0x34')],qs[_0x28f2('0x39')](_0x3e7420[_0x28f2('0x35')]['fields']));_0x3a78ba[_0x28f2('0x38')]=_0x3a78ba['attributes']['length']?_0x3a78ba[_0x28f2('0x38')]:_0x2ac45d[_0x28f2('0x34')];if(_0x3e7420[_0x28f2('0x35')][_0x28f2('0x47')]){_0x3a78ba[_0x28f2('0x43')]=[{'all':!![]}];}_0x3a78ba=_[_0x28f2('0x40')]({},_0x3a78ba,_0x3e7420[_0x28f2('0x42')]);return db[_0x28f2('0x2f')][_0x28f2('0x48')](_0x3a78ba)[_0x28f2('0x26')](handleEntityNotFound(_0x19be18,null))['then'](respondWithResult(_0x19be18,null))[_0x28f2('0x45')](handleError(_0x19be18,null));};exports['create']=function(_0xa6b9e2,_0x106fb7){return db[_0x28f2('0x2f')][_0x28f2('0x49')](_0xa6b9e2[_0x28f2('0x4a')],{})[_0x28f2('0x26')](function(_0x3fe42c){var _0x3794a7=_0xa6b9e2[_0x28f2('0x4b')][_0x28f2('0x28')]({'plain':!![]});if(!_0x3794a7)throw new Error(_0x28f2('0x4c'));if(_0x3794a7[_0x28f2('0x4d')]===_0x28f2('0x4b')){var _0x73dae2=_0x3fe42c[_0x28f2('0x28')]({'plain':!![]});var _0x5a98de=_0x28f2('0x29');return db[_0x28f2('0x4e')]['find']({'where':{'name':_0x5a98de,'userProfileId':_0x3794a7[_0x28f2('0x4f')]},'raw':!![]})[_0x28f2('0x26')](function(_0x46650c){if(_0x46650c&&_0x46650c[_0x28f2('0x50')]===0x0){return db[_0x28f2('0x2a')][_0x28f2('0x49')]({'name':_0x73dae2[_0x28f2('0x2c')],'resourceId':_0x73dae2['id'],'type':_0x46650c[_0x28f2('0x2c')],'sectionId':_0x46650c['id']},{})[_0x28f2('0x26')](function(){return _0x3fe42c;});}else{return _0x3fe42c;}})[_0x28f2('0x45')](function(_0x114ced){logger[_0x28f2('0x51')](_0x28f2('0x52'),_0x114ced);throw _0x114ced;});}return _0x3fe42c;})[_0x28f2('0x26')](respondWithResult(_0x106fb7,0xc9))['catch'](handleError(_0x106fb7,null));};exports[_0x28f2('0x25')]=function(_0x996ee6,_0x4e099c){if(_0x996ee6[_0x28f2('0x4a')]['id']){delete _0x996ee6[_0x28f2('0x4a')]['id'];}return db[_0x28f2('0x2f')][_0x28f2('0x48')]({'where':{'id':_0x996ee6['params']['id']}})[_0x28f2('0x26')](handleEntityNotFound(_0x4e099c,null))[_0x28f2('0x26')](saveUpdates(_0x996ee6[_0x28f2('0x4a')],null))[_0x28f2('0x26')](respondWithResult(_0x4e099c,null))[_0x28f2('0x45')](handleError(_0x4e099c,null));};exports['destroy']=function(_0x55f2c8,_0x43a5a7){return db[_0x28f2('0x2f')][_0x28f2('0x48')]({'where':{'id':_0x55f2c8[_0x28f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x43a5a7,null))[_0x28f2('0x26')](removeEntity(_0x43a5a7,null))[_0x28f2('0x45')](handleError(_0x43a5a7,null));};exports[_0x28f2('0x54')]=function(_0x30162e,_0x153337,_0x2017db){if(_0x30162e[_0x28f2('0x4a')]['id']){delete _0x30162e[_0x28f2('0x4a')]['id'];}return db['Interval']['find']({'where':{'id':_0x30162e[_0x28f2('0x53')]['id']}})[_0x28f2('0x26')](handleEntityNotFound(_0x153337,null))[_0x28f2('0x26')](function(_0xd1de07){if(_0xd1de07){_0x30162e[_0x28f2('0x4a')][_0x28f2('0x55')]=_0xd1de07['id'];return db[_0x28f2('0x2f')][_0x28f2('0x49')](_0x30162e[_0x28f2('0x4a')]);}})['then'](respondWithResult(_0x153337,null))[_0x28f2('0x45')](handleError(_0x153337,null));};exports[_0x28f2('0x56')]=function(_0x5b6745,_0x1e0f07,_0x41c7fc){var _0x38bff4={};var _0x3c271f={};var _0x28c76c;var _0x13cbd9;return db[_0x28f2('0x2f')]['findOne']({'where':{'id':_0x5b6745[_0x28f2('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e0f07,null))[_0x28f2('0x26')](function(_0x10ebb6){if(_0x10ebb6){_0x28c76c=_0x10ebb6;_0x3c271f[_0x28f2('0x34')]=_['keys'](db[_0x28f2('0x2f')][_0x28f2('0x30')]);_0x3c271f['query']=_['keys'](_0x5b6745['query']);_0x3c271f[_0x28f2('0x36')]=_[_0x28f2('0x37')](_0x3c271f['model'],_0x3c271f[_0x28f2('0x35')]);_0x38bff4['attributes']=_[_0x28f2('0x37')](_0x3c271f['model'],qs[_0x28f2('0x39')](_0x5b6745[_0x28f2('0x35')][_0x28f2('0x39')]));_0x38bff4[_0x28f2('0x38')]=_0x38bff4[_0x28f2('0x38')][_0x28f2('0x57')]?_0x38bff4[_0x28f2('0x38')]:_0x3c271f['model'];_0x38bff4[_0x28f2('0x3c')]=qs[_0x28f2('0x3d')](_0x5b6745[_0x28f2('0x35')]['sort']);_0x38bff4[_0x28f2('0x3f')]=qs['filters'](_['pick'](_0x5b6745[_0x28f2('0x35')],_0x3c271f['filters']));if(_0x5b6745['query'][_0x28f2('0x3e')]){_0x38bff4['where']=_[_0x28f2('0x40')](_0x38bff4[_0x28f2('0x3f')],{'$or':_['map'](_0x38bff4[_0x28f2('0x38')],function(_0x3b5391){var _0x3cff9f={};_0x3cff9f[_0x3b5391]={'$like':'%'+_0x5b6745['query'][_0x28f2('0x3e')]+'%'};return _0x3cff9f;})});}_0x38bff4=_[_0x28f2('0x40')]({},_0x38bff4,_0x5b6745[_0x28f2('0x42')]);return _0x28c76c['getIntervals'](_0x38bff4);}})[_0x28f2('0x26')](function(_0x28e985){if(_0x28e985){_0x13cbd9=_0x28e985[_0x28f2('0x57')];if(!_0x5b6745[_0x28f2('0x35')][_0x28f2('0x3a')](_0x28f2('0x3b'))){_0x38bff4[_0x28f2('0x22')]=qs[_0x28f2('0x22')](_0x5b6745[_0x28f2('0x35')]['limit']);_0x38bff4[_0x28f2('0x21')]=qs[_0x28f2('0x21')](_0x5b6745['query']['offset']);}return _0x28c76c['getIntervals'](_0x38bff4);}})[_0x28f2('0x26')](function(_0x53e85b){if(_0x53e85b){return _0x53e85b?{'count':_0x13cbd9,'rows':_0x53e85b}:null;}})[_0x28f2('0x26')](respondWithResult(_0x1e0f07,null))[_0x28f2('0x45')](handleError(_0x1e0f07,null));};exports[_0x28f2('0x58')]=function(_0x25cc97,_0x5bdceb,_0x18947f){return db[_0x28f2('0x2f')][_0x28f2('0x59')]({'where':{'id':_0x25cc97[_0x28f2('0x53')]['id']}})[_0x28f2('0x26')](handleEntityNotFound(_0x5bdceb,null))[_0x28f2('0x26')](function(_0x198d6f){if(_0x198d6f){return db[_0x28f2('0x5a')][_0x28f2('0x5b')](function(_0x590ec1){return db[_0x28f2('0x2f')][_0x28f2('0x27')]({'where':{'IntervalId':_0x25cc97['params']['id']},'transaction':_0x590ec1})['then'](function(_0x185382){var _0x104640=_[_0x28f2('0x2e')](_0x25cc97[_0x28f2('0x4a')],function(_0x3d53a9){delete _0x3d53a9['id'];_0x3d53a9[_0x28f2('0x55')]=_0x25cc97[_0x28f2('0x53')]['id'];return _0x3d53a9;});return db['Interval']['bulkCreate'](_0x104640,{'transaction':_0x590ec1});});})[_0x28f2('0x26')](function(){return db['Interval'][_0x28f2('0x5c')]({'where':{'IntervalId':_0x25cc97[_0x28f2('0x53')]['id']}});});}})[_0x28f2('0x26')](respondWithResult(_0x5bdceb,null))[_0x28f2('0x45')](handleError(_0x5bdceb,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d2520d4..12a297c 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 _0xe42d=['rewrite','interval','string','then','all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','tools_intervals'];(function(_0x3e751a,_0x4804ae){var _0x1d5aa1=function(_0x51ec5a){while(--_0x51ec5a){_0x3e751a['push'](_0x3e751a['shift']());}};_0x1d5aa1(++_0x4804ae);}(_0xe42d,0x13f));var _0xde42=function(_0x5a8423,_0x9d598){_0x5a8423=_0x5a8423-0x0;var _0x4bb583=_0xe42d[_0x5a8423];return _0x4bb583;};'use strict';var attributes=require(_0xde42('0x0'));var extensions=require(_0xde42('0x1'));var iftime=require('../../utils/iftime')['iftime'];module[_0xde42('0x2')]=function(_0x3860db){return _0x3860db[_0xde42('0x3')](_0xde42('0x4'),attributes,{'tableName':_0xde42('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x28a787){extensions[_0xde42('0x6')](_0x3860db,_0x28a787);},'afterBulkCreate':function(_0x57fdfb,_0xd56e1d,_0x23ea2b){_0x23ea2b();extensions['rewrite'](_0x3860db,_0x57fdfb[0x0]);},'afterUpdate':function(_0x5ba317){extensions[_0xde42('0x6')](_0x3860db,_0x5ba317);},'afterDestroy':function(_0x3c958d){extensions[_0xde42('0x6')](_0x3860db,_0x3c958d);}},'instanceMethods':{'ifTime':function(_0x64d7c5=undefined,_0xbf1bf8=new Date()){if(typeof this[_0xde42('0x7')]===_0xde42('0x8')){return iftime(this['interval'],_0x64d7c5,_0xbf1bf8);}else{return this['getIntervals']()[_0xde42('0x9')](function(_0x20627f){return Promise[_0xde42('0xa')](_0x20627f['map'](function(_0x2f7b3d){return _0x2f7b3d[_0xde42('0xb')](_0x64d7c5,_0xbf1bf8);}));})['then'](function(_0x5eff1b){return _0x5eff1b[_0xde42('0xc')](function(_0x453545,_0x4a4e01){return _0x453545||_0x4a4e01;},![]);});}}}});}; \ No newline at end of file +var _0xc479=['Interval','tools_intervals','rewrite','string','interval','getIntervals','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','iftime','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc479,0x1bb));var _0x9c47=function(_0x1df6c0,_0x132faa){_0x1df6c0=_0x1df6c0-0x0;var _0x3c0ccb=_0xc479[_0x1df6c0];return _0x3c0ccb;};'use strict';var attributes=require(_0x9c47('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x9c47('0x1'))[_0x9c47('0x2')];module[_0x9c47('0x3')]=function(_0x4c5629){return _0x4c5629[_0x9c47('0x4')](_0x9c47('0x5'),attributes,{'tableName':_0x9c47('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b3da9){extensions['rewrite'](_0x4c5629,_0x4b3da9);},'afterBulkCreate':function(_0x141c88,_0x3249fd,_0x4268ea){_0x4268ea();extensions[_0x9c47('0x7')](_0x4c5629,_0x141c88[0x0]);},'afterUpdate':function(_0x1b8925){extensions[_0x9c47('0x7')](_0x4c5629,_0x1b8925);},'afterDestroy':function(_0x3b06ca){extensions['rewrite'](_0x4c5629,_0x3b06ca);}},'instanceMethods':{'ifTime':function(_0xa13c74=undefined,_0xc9fcb6=new Date()){if(typeof this['interval']===_0x9c47('0x8')){return iftime(this[_0x9c47('0x9')],_0xa13c74,_0xc9fcb6);}else{return this[_0x9c47('0xa')]()[_0x9c47('0xb')](function(_0x30f222){return Promise[_0x9c47('0xc')](_0x30f222[_0x9c47('0xd')](function(_0x35938e){return _0x35938e[_0x9c47('0xe')](_0xa13c74,_0xc9fcb6);}));})[_0x9c47('0xb')](function(_0x370816){return _0x370816[_0x9c47('0xf')](function(_0x4eb7d5,_0x223479){return _0x4eb7d5||_0x223479;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c46bc48..46c0dc5 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 _0x123b=['include','model','then','debug','GetInterval','catch','error','message','ShowInterval','Interval','raw','info','stringify','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','length','format','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','util','../../mysqldb','iftime','../../config/logger','rpc','findAll','options','attributes','map'];(function(_0x28f5cb,_0x37fadc){var _0x27cd13=function(_0x248b27){while(--_0x248b27){_0x28f5cb['push'](_0x28f5cb['shift']());}};_0x27cd13(++_0x37fadc);}(_0x123b,0x1f2));var _0xb123=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x123b[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require(_0xb123('0x0'));var db=require(_0xb123('0x1'))['db'];var iftime=require('../../utils/iftime')[_0xb123('0x2')];var logger=require(_0xb123('0x3'))(_0xb123('0x4'));exports['GetInterval']=function(_0x29ff9f){var _0x3817d7=this;return new Promise(function(_0x1200bc,_0x2468e2){return db['Interval'][_0xb123('0x5')]({'raw':_0x29ff9f['options']?_0x29ff9f['options']['raw']===undefined?!![]:![]:!![],'where':_0x29ff9f[_0xb123('0x6')]?_0x29ff9f['options']['where']||null:null,'attributes':_0x29ff9f[_0xb123('0x6')]?_0x29ff9f['options'][_0xb123('0x7')]||null:null,'limit':_0x29ff9f[_0xb123('0x6')]?_0x29ff9f[_0xb123('0x6')]['limit']||null:null,'include':_0x29ff9f[_0xb123('0x6')]?_0x29ff9f[_0xb123('0x6')]['include']?_[_0xb123('0x8')](_0x29ff9f['options'][_0xb123('0x9')],function(_0x3d43b7){return{'model':db[_0x3d43b7['model']],'as':_0x3d43b7['as'],'attributes':_0x3d43b7[_0xb123('0x7')],'include':_0x3d43b7['include']?_[_0xb123('0x8')](_0x3d43b7['include'],function(_0x554a2b){return{'model':db[_0x554a2b['model']],'as':_0x554a2b['as'],'attributes':_0x554a2b[_0xb123('0x7')],'include':_0x554a2b[_0xb123('0x9')]?_[_0xb123('0x8')](_0x554a2b[_0xb123('0x9')],function(_0x2d977c){return{'model':db[_0x2d977c[_0xb123('0xa')]],'as':_0x2d977c['as'],'attributes':_0x2d977c[_0xb123('0x7')]};}):[]};}):[]};}):[]:[]})[_0xb123('0xb')](function(_0x1ae70d){logger['info']('GetInterval',_0x29ff9f);logger[_0xb123('0xc')](_0xb123('0xd'),_0x29ff9f,JSON['stringify'](_0x1ae70d));_0x1200bc(_0x1ae70d);})[_0xb123('0xe')](function(_0xb98cf0){logger[_0xb123('0xf')]('GetInterval',_0xb98cf0[_0xb123('0x10')],_0x29ff9f);_0x2468e2(_0x3817d7[_0xb123('0xf')](0x1f4,_0xb98cf0['message']));});});};exports[_0xb123('0x11')]=function(_0x119813){var _0x5b08f2=this;return new Promise(function(_0x4d9d1a,_0xcbd97e){return db[_0xb123('0x12')]['find']({'raw':_0x119813[_0xb123('0x6')]?_0x119813[_0xb123('0x6')][_0xb123('0x13')]===undefined?!![]:![]:!![],'where':_0x119813[_0xb123('0x6')]?_0x119813[_0xb123('0x6')]['where']||null:null,'attributes':_0x119813['options']?_0x119813[_0xb123('0x6')][_0xb123('0x7')]||null:null,'include':_0x119813[_0xb123('0x6')]?_0x119813['options']['include']?_[_0xb123('0x8')](_0x119813[_0xb123('0x6')]['include'],function(_0x5e7215){return{'model':db[_0x5e7215[_0xb123('0xa')]],'as':_0x5e7215['as'],'attributes':_0x5e7215['attributes'],'include':_0x5e7215[_0xb123('0x9')]?_['map'](_0x5e7215['include'],function(_0x49a9af){return{'model':db[_0x49a9af[_0xb123('0xa')]],'as':_0x49a9af['as'],'attributes':_0x49a9af[_0xb123('0x7')],'include':_0x49a9af[_0xb123('0x9')]?_[_0xb123('0x8')](_0x49a9af[_0xb123('0x9')],function(_0x4e6572){return{'model':db[_0x4e6572['model']],'as':_0x4e6572['as'],'attributes':_0x4e6572['attributes']};}):[]};}):[]};}):[]:[]})[_0xb123('0xb')](function(_0x17aedd){logger[_0xb123('0x14')](_0xb123('0x11'),_0x119813);logger['debug'](_0xb123('0x11'),_0x119813,JSON[_0xb123('0x15')](_0x17aedd));_0x4d9d1a(_0x17aedd);})[_0xb123('0xe')](function(_0x234d79){logger[_0xb123('0xf')]('ShowInterval',_0x234d79['message'],_0x119813);_0xcbd97e(_0x5b08f2[_0xb123('0xf')](0x1f4,_0x234d79['message']));});});};function checkArrayOfIntervals(_0x3ee6b3,_0x1d3507){var _0x201996=[];return db[_0xb123('0x12')][_0xb123('0x5')]({'where':{'id':_0x3ee6b3}})[_0xb123('0xb')](function(_0x522e3e){_0x201996=_0x522e3e;return Promise[_0xb123('0x16')](_0x201996[_0xb123('0x8')](function(_0x4a965e){return _0x4a965e[_0xb123('0x17')](_0x1d3507);}));})[_0xb123('0xb')](function(_0x423af3){var _0x127941=_0x423af3[_0xb123('0x18')](function(_0x3c1062,_0x467f87){return _0x3c1062||_0x467f87;},![]);logger['info'](util['format'](_0xb123('0x19'),_0x201996[_0xb123('0x8')](function(_0x5cdfac){return _0x5cdfac[_0xb123('0x1a')];})[_0xb123('0x1b')](',\x20'),_0x201996[_0xb123('0x8')](function(_0x216d81){return _0x216d81['id'];})[_0xb123('0x1b')](',\x20')));return _0x127941;});}function checkSingleInterval(_0x488609,_0x14f77a){return db[_0xb123('0x12')]['findById'](_0x488609)['then'](function(_0x1bc3a4){if(_0x1bc3a4){logger[_0xb123('0x14')](util['format'](_0xb123('0x1c'),_0x1bc3a4[_0xb123('0x1a')],_0x1bc3a4['id']));return _0x1bc3a4[_0xb123('0x17')](_0x14f77a);}});}exports[_0xb123('0x1d')]=function(_0x1052b7){var _0x383b57=_0x1052b7[_0xb123('0x1e')];var _0x3a42aa=Array[_0xb123('0x1f')](_0x1052b7['intervals'])?_0x1052b7[_0xb123('0x20')]:typeof _0x1052b7[_0xb123('0x20')]==='string'?[_0x1052b7[_0xb123('0x20')]]:[];var _0x4acc07=_0x1052b7['timezone']||undefined;var _0x5df1bd=![];if(_0x3a42aa[_0xb123('0x21')]){logger[_0xb123('0x14')](util[_0xb123('0x22')](_0xb123('0x23'),_0x3a42aa['join'](';\x20')));}if(_0x4acc07){logger[_0xb123('0x14')](util[_0xb123('0x22')](_0xb123('0x24'),_0x4acc07));}logger[_0xb123('0xc')](_0xb123('0x25'),_0x5df1bd);logger[_0xb123('0x26')](_0xb123('0x1d'),_0x1052b7);return Promise['resolve']()[_0xb123('0xb')](function(){if(Array[_0xb123('0x1f')](_0x383b57)){return checkArrayOfIntervals(_0x383b57,_0x4acc07);}else if(_0x383b57){return checkSingleInterval(_0x383b57,_0x4acc07);}})[_0xb123('0xb')](function(_0x21d311){var _0x1bb179=_0x3a42aa[_0xb123('0x18')](function(_0x3e0427,_0x303676){return _0x3e0427||iftime(_0x303676,_0x4acc07);},![]);_0x5df1bd=_0x21d311||_0x1bb179;return _0x5df1bd;})['catch'](function(_0x2295d9){logger['error']('IntervalIftime',_0x1052b7,_0x2295d9);throw this[_0xb123('0xf')](0x1f4,_0x2295d9['message']);});}; \ No newline at end of file +var _0xc697=['intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','Interval','findAll','options','raw','attributes','limit','include','map','model','then','GetInterval','debug','stringify','catch','error','message','ShowInterval','info','all','ifTime','reduce','format','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','isArray'];(function(_0x16d71f,_0x3d6fd6){var _0x26df33=function(_0x38a379){while(--_0x38a379){_0x16d71f['push'](_0x16d71f['shift']());}};_0x26df33(++_0x3d6fd6);}(_0xc697,0x158));var _0x7c69=function(_0x3d190e,_0x19f79e){_0x3d190e=_0x3d190e-0x0;var _0x32ede4=_0xc697[_0x3d190e];return _0x32ede4;};'use strict';var _=require(_0x7c69('0x0'));var util=require(_0x7c69('0x1'));var db=require(_0x7c69('0x2'))['db'];var iftime=require(_0x7c69('0x3'))['iftime'];var logger=require(_0x7c69('0x4'))(_0x7c69('0x5'));exports['GetInterval']=function(_0xd771e3){var _0x2e77d3=this;return new Promise(function(_0x591366,_0x2893bb){return db[_0x7c69('0x6')][_0x7c69('0x7')]({'raw':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0x9')]===undefined?!![]:![]:!![],'where':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')]['where']||null:null,'attributes':_0xd771e3[_0x7c69('0x8')]?_0xd771e3['options'][_0x7c69('0xa')]||null:null,'limit':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0xb')]||null:null,'include':_0xd771e3[_0x7c69('0x8')]?_0xd771e3[_0x7c69('0x8')][_0x7c69('0xc')]?_[_0x7c69('0xd')](_0xd771e3[_0x7c69('0x8')][_0x7c69('0xc')],function(_0x693a17){return{'model':db[_0x693a17[_0x7c69('0xe')]],'as':_0x693a17['as'],'attributes':_0x693a17[_0x7c69('0xa')],'include':_0x693a17[_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x693a17[_0x7c69('0xc')],function(_0x32c4a4){return{'model':db[_0x32c4a4[_0x7c69('0xe')]],'as':_0x32c4a4['as'],'attributes':_0x32c4a4[_0x7c69('0xa')],'include':_0x32c4a4[_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x32c4a4[_0x7c69('0xc')],function(_0x5a9e49){return{'model':db[_0x5a9e49[_0x7c69('0xe')]],'as':_0x5a9e49['as'],'attributes':_0x5a9e49[_0x7c69('0xa')]};}):[]};}):[]};}):[]:[]})[_0x7c69('0xf')](function(_0x4de153){logger['info'](_0x7c69('0x10'),_0xd771e3);logger[_0x7c69('0x11')](_0x7c69('0x10'),_0xd771e3,JSON[_0x7c69('0x12')](_0x4de153));_0x591366(_0x4de153);})[_0x7c69('0x13')](function(_0x745e2){logger[_0x7c69('0x14')]('GetInterval',_0x745e2[_0x7c69('0x15')],_0xd771e3);_0x2893bb(_0x2e77d3[_0x7c69('0x14')](0x1f4,_0x745e2[_0x7c69('0x15')]));});});};exports[_0x7c69('0x16')]=function(_0x2d03ea){var _0x5b20cb=this;return new Promise(function(_0xaa4add,_0xa990f5){return db['Interval']['find']({'raw':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0x9')]===undefined?!![]:![]:!![],'where':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')]['where']||null:null,'attributes':_0x2d03ea['options']?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0xa')]||null:null,'include':_0x2d03ea[_0x7c69('0x8')]?_0x2d03ea[_0x7c69('0x8')][_0x7c69('0xc')]?_[_0x7c69('0xd')](_0x2d03ea['options'][_0x7c69('0xc')],function(_0x4965c2){return{'model':db[_0x4965c2[_0x7c69('0xe')]],'as':_0x4965c2['as'],'attributes':_0x4965c2[_0x7c69('0xa')],'include':_0x4965c2['include']?_['map'](_0x4965c2[_0x7c69('0xc')],function(_0x51fb33){return{'model':db[_0x51fb33['model']],'as':_0x51fb33['as'],'attributes':_0x51fb33[_0x7c69('0xa')],'include':_0x51fb33[_0x7c69('0xc')]?_['map'](_0x51fb33[_0x7c69('0xc')],function(_0x4bf276){return{'model':db[_0x4bf276[_0x7c69('0xe')]],'as':_0x4bf276['as'],'attributes':_0x4bf276[_0x7c69('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x182e33){logger[_0x7c69('0x17')]('ShowInterval',_0x2d03ea);logger[_0x7c69('0x11')](_0x7c69('0x16'),_0x2d03ea,JSON[_0x7c69('0x12')](_0x182e33));_0xaa4add(_0x182e33);})[_0x7c69('0x13')](function(_0xa42558){logger['error']('ShowInterval',_0xa42558[_0x7c69('0x15')],_0x2d03ea);_0xa990f5(_0x5b20cb[_0x7c69('0x14')](0x1f4,_0xa42558[_0x7c69('0x15')]));});});};function checkArrayOfIntervals(_0x3ef939,_0x5db8de){var _0x2e081f=[];return db['Interval'][_0x7c69('0x7')]({'where':{'id':_0x3ef939}})[_0x7c69('0xf')](function(_0x42b6fb){_0x2e081f=_0x42b6fb;return Promise[_0x7c69('0x18')](_0x2e081f[_0x7c69('0xd')](function(_0xcba5c){return _0xcba5c[_0x7c69('0x19')](_0x5db8de);}));})[_0x7c69('0xf')](function(_0x3ebad5){var _0x209d28=_0x3ebad5[_0x7c69('0x1a')](function(_0x149508,_0x2700aa){return _0x149508||_0x2700aa;},![]);logger[_0x7c69('0x17')](util[_0x7c69('0x1b')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x2e081f[_0x7c69('0xd')](function(_0x155160){return _0x155160['name'];})['join'](',\x20'),_0x2e081f[_0x7c69('0xd')](function(_0x52ef52){return _0x52ef52['id'];})[_0x7c69('0x1c')](',\x20')));return _0x209d28;});}function checkSingleInterval(_0xe6b0f3,_0x4b346c){return db[_0x7c69('0x6')][_0x7c69('0x1d')](_0xe6b0f3)[_0x7c69('0xf')](function(_0x446e94){if(_0x446e94){logger[_0x7c69('0x17')](util[_0x7c69('0x1b')](_0x7c69('0x1e'),_0x446e94[_0x7c69('0x1f')],_0x446e94['id']));return _0x446e94[_0x7c69('0x19')](_0x4b346c);}});}exports[_0x7c69('0x20')]=function(_0x4d03d8){var _0x57898c=_0x4d03d8['intervalIds'];var _0x3ddb59=Array[_0x7c69('0x21')](_0x4d03d8[_0x7c69('0x22')])?_0x4d03d8['intervals']:typeof _0x4d03d8[_0x7c69('0x22')]===_0x7c69('0x23')?[_0x4d03d8[_0x7c69('0x22')]]:[];var _0x33b26e=_0x4d03d8[_0x7c69('0x24')]||undefined;var _0x1c24de=![];if(_0x3ddb59[_0x7c69('0x25')]){logger['info'](util[_0x7c69('0x1b')](_0x7c69('0x26'),_0x3ddb59[_0x7c69('0x1c')](';\x20')));}if(_0x33b26e){logger[_0x7c69('0x17')](util['format']('IntervalIftime:\x20timezone\x20=\x20%s',_0x33b26e));}logger[_0x7c69('0x11')](_0x7c69('0x27'),_0x1c24de);logger[_0x7c69('0x28')](_0x7c69('0x20'),_0x4d03d8);return Promise[_0x7c69('0x29')]()[_0x7c69('0xf')](function(){if(Array[_0x7c69('0x21')](_0x57898c)){return checkArrayOfIntervals(_0x57898c,_0x33b26e);}else if(_0x57898c){return checkSingleInterval(_0x57898c,_0x33b26e);}})[_0x7c69('0xf')](function(_0x44b60a){var _0x5b15dd=_0x3ddb59[_0x7c69('0x1a')](function(_0x36b594,_0x30ff14){return _0x36b594||iftime(_0x30ff14,_0x33b26e);},![]);_0x1c24de=_0x44b60a||_0x5b15dd;return _0x1c24de;})[_0x7c69('0x13')](function(_0xc785a4){logger[_0x7c69('0x14')](_0x7c69('0x20'),_0x4d03d8,_0xc785a4);throw this[_0x7c69('0x14')](0x1f4,_0xc785a4[_0x7c69('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 49b63df..b4459b8 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(_0x5ccdf4,_0x6cf81c){var _0x1a83a4=function(_0x5320e2){while(--_0x5320e2){_0x5ccdf4['push'](_0x5ccdf4['shift']());}};_0x1a83a4(++_0x6cf81c);}(_0xdb28,0x106));var _0x8db2=function(_0x42565d,_0x4b7c15){_0x42565d=_0x42565d-0x0;var _0xf8dccb=_0xdb28[_0x42565d];return _0xf8dccb;};'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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x358402,_0x358698){var _0x455e8a=function(_0x5ac1b5){while(--_0x5ac1b5){_0x358402['push'](_0x358402['shift']());}};_0x455e8a(++_0x358698);}(_0x2ef3,0xba));var _0x32ef=function(_0x405fad,_0xb6c2e7){_0x405fad=_0x405fad-0x0;var _0x51df72=_0x2ef3[_0x405fad];return _0x51df72;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index e8884eb..542ea4c 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 _0xc438=['setEncoding','utf8','data','statusCode','json','parse','status','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','remoteAddress','connection','socket','bluebird','https','../../config/logger','api','support','summary','Report','\x20from\x20','description','stringify','issuetype','fields','customfield_11500','email','customfield_11503','customfield_11504','reason','track.xcallymotion.com','Basic\x20','toString','base64','request'];(function(_0x26c323,_0x559fa7){var _0xaa4f94=function(_0x7b9080){while(--_0x7b9080){_0x26c323['push'](_0x26c323['shift']());}};_0xaa4f94(++_0x559fa7);}(_0xc438,0x1f2));var _0x8c43=function(_0x2bb1af,_0x40b8cd){_0x2bb1af=_0x2bb1af-0x0;var _0x271c7d=_0xc438[_0x2bb1af];return _0x271c7d;};'use strict';var BPromise=require(_0x8c43('0x0'));var https=require(_0x8c43('0x1'));var logger=require(_0x8c43('0x2'))(_0x8c43('0x3'));var USERNAME=_0x8c43('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x368ca4,_0x4f6bd2){var _0x181024={'fields':{'project':{'key':_0x368ca4['key']||'MOTGUI'},'summary':(_0x368ca4[_0x8c43('0x5')]||_0x8c43('0x6'))+_0x8c43('0x7')+_0x368ca4['ip'],'description':_0x368ca4[_0x8c43('0x8')]||JSON[_0x8c43('0x9')](_0x368ca4),'issuetype':{'name':_0x368ca4[_0x8c43('0xa')]||'Bug'}}};_0x181024[_0x8c43('0xb')][_0x8c43('0xc')]=_0x368ca4[_0x8c43('0xd')];_0x181024[_0x8c43('0xb')]['customfield_11501']=_0x368ca4['oldToken'];_0x181024[_0x8c43('0xb')]['customfield_11502']=_0x368ca4['newToken'];_0x181024[_0x8c43('0xb')][_0x8c43('0xe')]=_0x368ca4['name'];_0x181024[_0x8c43('0xb')][_0x8c43('0xf')]=_0x368ca4[_0x8c43('0x10')];_0x181024[_0x8c43('0xb')]['customfield_10102']=_0x368ca4['ip'];var _0x398759={'host':_0x8c43('0x11'),'port':0x1bb,'path':'/rest/api/2/issue','method':'POST','timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x8c43('0x12')+new Buffer(USERNAME+':'+PASSWORD)[_0x8c43('0x13')](_0x8c43('0x14'))}};var _0x24d8a5=JSON[_0x8c43('0x9')](_0x181024);var _0x46e4cc=https[_0x8c43('0x15')](_0x398759,function(_0x5b6da6){_0x5b6da6[_0x8c43('0x16')](_0x8c43('0x17'));var _0x59b44c='';_0x5b6da6['on'](_0x8c43('0x18'),function(_0x34ad99){_0x59b44c+=_0x34ad99;});_0x5b6da6['on']('end',function(){if(_0x4f6bd2){return _0x4f6bd2['status'](_0x5b6da6[_0x8c43('0x19')])[_0x8c43('0x1a')](JSON[_0x8c43('0x1b')](_0x59b44c));}});});_0x46e4cc['on']('error',function(_0x3d492c){if(_0x4f6bd2){return _0x4f6bd2[_0x8c43('0x1c')](0x1f4)[_0x8c43('0x1a')]({'errors':[{'message':_0x8c43('0x1d'),'type':_0x8c43('0x1e')}]});}});_0x46e4cc[_0x8c43('0x1f')](_0x24d8a5);_0x46e4cc['end']();}exports[_0x8c43('0x20')]=openIssue;exports[_0x8c43('0x21')]=function(_0x1c8a04,_0x479aae){_0x1c8a04[_0x8c43('0x22')]['ip']=_0x1c8a04[_0x8c43('0x23')][_0x8c43('0x24')]||_0x1c8a04['connection'][_0x8c43('0x25')]||_0x1c8a04['socket']['remoteAddress']||_0x1c8a04[_0x8c43('0x26')][_0x8c43('0x27')][_0x8c43('0x25')];return openIssue(_0x1c8a04[_0x8c43('0x22')],_0x479aae);}; \ No newline at end of file +var _0x34f5=['POST','Basic\x20','toString','request','setEncoding','utf8','data','end','status','statusCode','json','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','headers','x-forwarded-for','connection','remoteAddress','socket','body','bluebird','https','../../config/logger','api','3eAmWpBVP0','key','MOTGUI','summary','Report','\x20from\x20','stringify','fields','customfield_11500','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue'];(function(_0x5aedea,_0xf4a7f){var _0xe35173=function(_0x2e329e){while(--_0x2e329e){_0x5aedea['push'](_0x5aedea['shift']());}};_0xe35173(++_0xf4a7f);}(_0x34f5,0xcf));var _0x534f=function(_0x25406a,_0x104ad5){_0x25406a=_0x25406a-0x0;var _0x2a18ad=_0x34f5[_0x25406a];return _0x2a18ad;};'use strict';var BPromise=require(_0x534f('0x0'));var https=require(_0x534f('0x1'));var logger=require(_0x534f('0x2'))(_0x534f('0x3'));var USERNAME='support';var PASSWORD=_0x534f('0x4');function openIssue(_0x46f916,_0x40d7bf){var _0x241b4d={'fields':{'project':{'key':_0x46f916[_0x534f('0x5')]||_0x534f('0x6')},'summary':(_0x46f916[_0x534f('0x7')]||_0x534f('0x8'))+_0x534f('0x9')+_0x46f916['ip'],'description':_0x46f916['description']||JSON[_0x534f('0xa')](_0x46f916),'issuetype':{'name':_0x46f916['issuetype']||'Bug'}}};_0x241b4d[_0x534f('0xb')][_0x534f('0xc')]=_0x46f916['email'];_0x241b4d[_0x534f('0xb')][_0x534f('0xd')]=_0x46f916[_0x534f('0xe')];_0x241b4d[_0x534f('0xb')]['customfield_11502']=_0x46f916[_0x534f('0xf')];_0x241b4d[_0x534f('0xb')][_0x534f('0x10')]=_0x46f916[_0x534f('0x11')];_0x241b4d[_0x534f('0xb')][_0x534f('0x12')]=_0x46f916[_0x534f('0x13')];_0x241b4d[_0x534f('0xb')][_0x534f('0x14')]=_0x46f916['ip'];var _0x4db18c={'host':_0x534f('0x15'),'port':0x1bb,'path':_0x534f('0x16'),'method':_0x534f('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x534f('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x534f('0x19')]('base64')}};var _0x3a33c9=JSON[_0x534f('0xa')](_0x241b4d);var _0x5505f2=https[_0x534f('0x1a')](_0x4db18c,function(_0x1958ce){_0x1958ce[_0x534f('0x1b')](_0x534f('0x1c'));var _0x1991b6='';_0x1958ce['on'](_0x534f('0x1d'),function(_0x5c8997){_0x1991b6+=_0x5c8997;});_0x1958ce['on'](_0x534f('0x1e'),function(){if(_0x40d7bf){return _0x40d7bf[_0x534f('0x1f')](_0x1958ce[_0x534f('0x20')])[_0x534f('0x21')](JSON['parse'](_0x1991b6));}});});_0x5505f2['on'](_0x534f('0x22'),function(_0x4428f5){if(_0x40d7bf){return _0x40d7bf[_0x534f('0x1f')](0x1f4)[_0x534f('0x21')]({'errors':[{'message':_0x534f('0x23'),'type':_0x534f('0x24')}]});}});_0x5505f2[_0x534f('0x25')](_0x3a33c9);_0x5505f2[_0x534f('0x1e')]();}exports[_0x534f('0x26')]=openIssue;exports[_0x534f('0x27')]=function(_0x24189b,_0x50be74){_0x24189b['body']['ip']=_0x24189b[_0x534f('0x28')][_0x534f('0x29')]||_0x24189b[_0x534f('0x2a')][_0x534f('0x2b')]||_0x24189b[_0x534f('0x2c')][_0x534f('0x2b')]||_0x24189b[_0x534f('0x2a')][_0x534f('0x2c')][_0x534f('0x2b')];return openIssue(_0x24189b[_0x534f('0x2d')],_0x50be74);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index dc3fb77..0e767c3 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 _0x6f0d=['post','create','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','isAuthenticated','get','/describe','describe','show'];(function(_0x4f6708,_0x4f2f7f){var _0x4283c1=function(_0x125e57){while(--_0x125e57){_0x4f6708['push'](_0x4f6708['shift']());}};_0x4283c1(++_0x4f2f7f);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x46cea9,_0x476e05){_0x46cea9=_0x46cea9-0x0;var _0x210bda=_0x6f0d[_0x46cea9];return _0x210bda;};'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'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xc')]);router['get']('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xd')]);router[_0xd6f0('0xe')]('/',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0xf')]);router['put'](_0xd6f0('0x10'),auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x11')]);router[_0xd6f0('0x12')]('/:id',auth[_0xd6f0('0x9')](),controller[_0xd6f0('0x13')]);module[_0xd6f0('0x14')]=router; \ No newline at end of file +var _0x41bb=['show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','/:id'];(function(_0xd94bcb,_0x112a14){var _0x39b1c1=function(_0x5c8e34){while(--_0x5c8e34){_0xd94bcb['push'](_0xd94bcb['shift']());}};_0x39b1c1(++_0x112a14);}(_0x41bb,0xc5));var _0xb41b=function(_0x3bc6b4,_0x2ec8b4){_0x3bc6b4=_0x3bc6b4-0x0;var _0x4c263c=_0x41bb[_0x3bc6b4];return _0x4c263c;};'use strict';var multer=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var path=require('path');var timeout=require(_0xb41b('0x2'));var express=require('express');var router=express[_0xb41b('0x3')]();var fs_extra=require(_0xb41b('0x4'));var auth=require(_0xb41b('0x5'));var interaction=require(_0xb41b('0x6'));var config=require('../../config/environment');var controller=require(_0xb41b('0x7'));router[_0xb41b('0x8')]('/',auth[_0xb41b('0x9')](),controller['index']);router['get']('/describe',auth[_0xb41b('0x9')](),controller[_0xb41b('0xa')]);router['get'](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0xc')]);router[_0xb41b('0xd')]('/',auth[_0xb41b('0x9')](),controller[_0xb41b('0xe')]);router[_0xb41b('0xf')]('/:id',auth[_0xb41b('0x9')](),controller['update']);router[_0xb41b('0x10')](_0xb41b('0xb'),auth[_0xb41b('0x9')](),controller[_0xb41b('0x11')]);module[_0xb41b('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 2a31c69..768e992 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x319b72,_0x42cf5a){_0x319b72=_0x319b72-0x0;var _0x142269=_0x7a54[_0x319b72];return _0x142269;};'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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x7a54,0x106));var _0x47a5=function(_0x2ee1ea,_0x2b5b0c){_0x2ee1ea=_0x2ee1ea-0x0;var _0x295ffe=_0x7a54[_0x2ee1ea];return _0x295ffe;};'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 5a54b48..60f39de 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 _0x7278=['stack','name','send','JscriptyAnswerReport','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','rawAttributes','length','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0x7278,0x161));var _0x8727=function(_0x597a43,_0x346c5d){_0x597a43=_0x597a43-0x0;var _0x4820c2=_0x7278[_0x597a43];return _0x4820c2;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require('moment');var BPromise=require(_0x8727('0x5'));var Mustache=require(_0x8727('0x6'));var util=require(_0x8727('0x7'));var path=require(_0x8727('0x8'));var sox=require(_0x8727('0x9'));var csv=require(_0x8727('0xa'));var ejs=require(_0x8727('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xc'));var squel=require(_0x8727('0xd'));var crypto=require(_0x8727('0xe'));var jsforce=require(_0x8727('0xf'));var deskjs=require(_0x8727('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require(_0x8727('0x14'));var hardwareService=require(_0x8727('0x15'));var logger=require(_0x8727('0x16'))(_0x8727('0x17'));var utils=require(_0x8727('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8727('0x19'));var db=require(_0x8727('0x1a'))['db'];function respondWithStatusCode(_0x176389,_0x518e56){_0x518e56=_0x518e56||0xcc;return function(_0x22d03d){if(_0x22d03d){return _0x176389[_0x8727('0x1b')](_0x518e56);}return _0x176389['status'](_0x518e56)[_0x8727('0x1c')]();};}function respondWithResult(_0x3aa1b,_0x47c29d){_0x47c29d=_0x47c29d||0xc8;return function(_0x2185e5){if(_0x2185e5){return _0x3aa1b[_0x8727('0x1d')](_0x47c29d)[_0x8727('0x1e')](_0x2185e5);}};}function respondWithFilteredResult(_0x3865e9,_0x1916f7){return function(_0x11c828){if(_0x11c828){var _0x88857c=typeof _0x1916f7['offset']===_0x8727('0x1f')&&typeof _0x1916f7[_0x8727('0x20')]===_0x8727('0x1f');var _0x2f6e1d=_0x11c828[_0x8727('0x21')];var _0xba0af5=_0x88857c?0x0:_0x1916f7['offset'];var _0x575d29=_0x88857c?_0x11c828[_0x8727('0x21')]:_0x1916f7['offset']+_0x1916f7[_0x8727('0x20')];var _0xfd266f;if(_0x575d29>=_0x2f6e1d){_0x575d29=_0x2f6e1d;_0xfd266f=0xc8;}else{_0xfd266f=0xce;}_0x3865e9[_0x8727('0x1d')](_0xfd266f);return _0x3865e9[_0x8727('0x22')](_0x8727('0x23'),_0xba0af5+'-'+_0x575d29+'/'+_0x2f6e1d)['json'](_0x11c828);}return null;};}function patchUpdates(_0x6e552f){return function(_0x286856){try{jsonpatch[_0x8727('0x24')](_0x286856,_0x6e552f,!![]);}catch(_0x1d78df){return BPromise[_0x8727('0x25')](_0x1d78df);}return _0x286856[_0x8727('0x26')]();};}function saveUpdates(_0x46d43e,_0x441cc0){return function(_0x117f58){if(_0x117f58){return _0x117f58[_0x8727('0x27')](_0x46d43e)[_0x8727('0x28')](function(_0x1a69d5){return _0x1a69d5;});}return null;};}function removeEntity(_0x4c699b,_0x464a32){return function(_0x3d3592){if(_0x3d3592){return _0x3d3592['destroy']()['then'](function(){_0x4c699b[_0x8727('0x1d')](0xcc)[_0x8727('0x1c')]();});}};}function handleEntityNotFound(_0x15e8bf,_0x5de6fa){return function(_0x98261b){if(!_0x98261b){_0x15e8bf[_0x8727('0x1b')](0x194);}return _0x98261b;};}function handleError(_0x267008,_0x440ff5){_0x440ff5=_0x440ff5||0x1f4;return function(_0x2c8cd5){logger[_0x8727('0x29')](_0x2c8cd5[_0x8727('0x2a')]);if(_0x2c8cd5[_0x8727('0x2b')]){delete _0x2c8cd5['name'];}_0x267008[_0x8727('0x1d')](_0x440ff5)[_0x8727('0x2c')](_0x2c8cd5);};}exports['index']=function(_0x23325f,_0x163989){var _0x3ecd6a={},_0x228ca9={},_0x416da8={'count':0x0,'rows':[]};var _0x1e21b9=_['map'](db[_0x8727('0x2d')]['rawAttributes'],function(_0x34c58e){return{'name':_0x34c58e['fieldName'],'type':_0x34c58e[_0x8727('0x2e')][_0x8727('0x2f')]};});_0x228ca9[_0x8727('0x30')]=_[_0x8727('0x31')](_0x1e21b9,_0x8727('0x2b'));_0x228ca9[_0x8727('0x32')]=_[_0x8727('0x33')](_0x23325f['query']);_0x228ca9[_0x8727('0x34')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],_0x228ca9[_0x8727('0x32')]);_0x3ecd6a[_0x8727('0x36')]=_[_0x8727('0x35')](_0x228ca9[_0x8727('0x30')],qs[_0x8727('0x37')](_0x23325f[_0x8727('0x32')][_0x8727('0x37')]));_0x3ecd6a[_0x8727('0x36')]=_0x3ecd6a[_0x8727('0x36')]['length']?_0x3ecd6a['attributes']:_0x228ca9[_0x8727('0x30')];if(!_0x23325f[_0x8727('0x32')][_0x8727('0x38')](_0x8727('0x39'))){_0x3ecd6a['limit']=qs[_0x8727('0x20')](_0x23325f[_0x8727('0x32')][_0x8727('0x20')]);_0x3ecd6a[_0x8727('0x3a')]=qs[_0x8727('0x3a')](_0x23325f['query'][_0x8727('0x3a')]);}_0x3ecd6a[_0x8727('0x3b')]=qs[_0x8727('0x3c')](_0x23325f[_0x8727('0x32')][_0x8727('0x3c')]);_0x3ecd6a[_0x8727('0x3d')]=qs[_0x8727('0x34')](_[_0x8727('0x3e')](_0x23325f[_0x8727('0x32')],_0x228ca9[_0x8727('0x34')]),_0x1e21b9);if(_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]){_0x3ecd6a['where']=_[_0x8727('0x40')](_0x3ecd6a[_0x8727('0x3d')],{'$or':_[_0x8727('0x31')](_0x1e21b9,function(_0x403d90){if(_0x403d90[_0x8727('0x2e')]!==_0x8727('0x41')){var _0x308035={};_0x308035[_0x403d90[_0x8727('0x2b')]]={'$like':'%'+_0x23325f[_0x8727('0x32')][_0x8727('0x3f')]+'%'};return _0x308035;}})});}_0x3ecd6a=_[_0x8727('0x40')]({},_0x3ecd6a,_0x23325f[_0x8727('0x42')]);var _0x2a1063={'where':_0x3ecd6a[_0x8727('0x3d')]};return db['JscriptyAnswerReport'][_0x8727('0x21')](_0x2a1063)[_0x8727('0x28')](function(_0x19d08a){_0x416da8['count']=_0x19d08a;if(_0x23325f[_0x8727('0x32')][_0x8727('0x43')]){_0x3ecd6a[_0x8727('0x44')]=[{'all':!![]}];}return db[_0x8727('0x2d')]['findAll'](_0x3ecd6a);})[_0x8727('0x28')](function(_0x37e87c){_0x416da8[_0x8727('0x45')]=_0x37e87c;return _0x416da8;})[_0x8727('0x28')](respondWithFilteredResult(_0x163989,_0x3ecd6a))[_0x8727('0x46')](handleError(_0x163989,null));};exports[_0x8727('0x47')]=function(_0x2fe40d,_0x15b764){var _0x3aac97={'raw':!![],'where':{'id':_0x2fe40d['params']['id']}},_0x2b5ba7={};_0x2b5ba7[_0x8727('0x30')]=_[_0x8727('0x33')](db[_0x8727('0x2d')][_0x8727('0x48')]);_0x2b5ba7[_0x8727('0x32')]=_['keys'](_0x2fe40d[_0x8727('0x32')]);_0x2b5ba7[_0x8727('0x34')]=_[_0x8727('0x35')](_0x2b5ba7['model'],_0x2b5ba7[_0x8727('0x32')]);_0x3aac97[_0x8727('0x36')]=_[_0x8727('0x35')](_0x2b5ba7[_0x8727('0x30')],qs[_0x8727('0x37')](_0x2fe40d[_0x8727('0x32')]['fields']));_0x3aac97[_0x8727('0x36')]=_0x3aac97[_0x8727('0x36')][_0x8727('0x49')]?_0x3aac97['attributes']:_0x2b5ba7[_0x8727('0x30')];if(_0x2fe40d[_0x8727('0x32')][_0x8727('0x43')]){_0x3aac97[_0x8727('0x44')]=[{'all':!![]}];}_0x3aac97=_[_0x8727('0x40')]({},_0x3aac97,_0x2fe40d[_0x8727('0x42')]);return db[_0x8727('0x2d')]['find'](_0x3aac97)[_0x8727('0x28')](handleEntityNotFound(_0x15b764,null))[_0x8727('0x28')](respondWithResult(_0x15b764,null))[_0x8727('0x46')](handleError(_0x15b764,null));};exports[_0x8727('0x4a')]=function(_0x152de6,_0x426727){return db[_0x8727('0x2d')]['create'](_0x152de6[_0x8727('0x4b')],{})[_0x8727('0x28')](respondWithResult(_0x426727,0xc9))[_0x8727('0x46')](handleError(_0x426727,null));};exports['update']=function(_0x30e656,_0x22cd31){if(_0x30e656[_0x8727('0x4b')]['id']){delete _0x30e656[_0x8727('0x4b')]['id'];}return db[_0x8727('0x2d')][_0x8727('0x4c')]({'where':{'id':_0x30e656[_0x8727('0x4d')]['id']}})['then'](handleEntityNotFound(_0x22cd31,null))[_0x8727('0x28')](saveUpdates(_0x30e656['body'],null))[_0x8727('0x28')](respondWithResult(_0x22cd31,null))[_0x8727('0x46')](handleError(_0x22cd31,null));};exports['destroy']=function(_0x133973,_0x3bb732){return db[_0x8727('0x2d')]['find']({'where':{'id':_0x133973['params']['id']}})[_0x8727('0x28')](handleEntityNotFound(_0x3bb732,null))[_0x8727('0x28')](removeEntity(_0x3bb732,null))[_0x8727('0x46')](handleError(_0x3bb732,null));};exports['describe']=function(_0x102daf,_0x3945c4){return db[_0x8727('0x2d')][_0x8727('0x4e')]()[_0x8727('0x28')](respondWithResult(_0x3945c4,null))[_0x8727('0x46')](handleError(_0x3945c4,null));}; \ No newline at end of file +var _0xcd05=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','limit','undefined','count','status','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','offset','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','rawAttributes','find','create','body','params','describe','eml-format','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x4e27f0,_0x264369){var _0xc7c5a0=function(_0x12ecd2){while(--_0x12ecd2){_0x4e27f0['push'](_0x4e27f0['shift']());}};_0xc7c5a0(++_0x264369);}(_0xcd05,0x163));var _0x5cd0=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xcd05[_0x2a0183];return _0x158c3a;};'use strict';var emlformat=require(_0x5cd0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5cd0('0x1'));var moment=require(_0x5cd0('0x2'));var BPromise=require(_0x5cd0('0x3'));var Mustache=require(_0x5cd0('0x4'));var util=require('util');var path=require(_0x5cd0('0x5'));var sox=require(_0x5cd0('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5cd0('0x7'));var squel=require(_0x5cd0('0x8'));var crypto=require(_0x5cd0('0x9'));var jsforce=require(_0x5cd0('0xa'));var deskjs=require(_0x5cd0('0xb'));var toCsv=require(_0x5cd0('0xc'));var querystring=require(_0x5cd0('0xd'));var Papa=require('papaparse');var Redis=require(_0x5cd0('0xe'));var authService=require(_0x5cd0('0xf'));var qs=require(_0x5cd0('0x10'));var as=require(_0x5cd0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5cd0('0x12'))(_0x5cd0('0x13'));var utils=require(_0x5cd0('0x14'));var config=require(_0x5cd0('0x15'));var licenseUtil=require(_0x5cd0('0x16'));var db=require(_0x5cd0('0x17'))['db'];function respondWithStatusCode(_0x11577c,_0x3f6bb6){_0x3f6bb6=_0x3f6bb6||0xcc;return function(_0x435d4b){if(_0x435d4b){return _0x11577c[_0x5cd0('0x18')](_0x3f6bb6);}return _0x11577c['status'](_0x3f6bb6)['end']();};}function respondWithResult(_0x51ec30,_0xe9f736){_0xe9f736=_0xe9f736||0xc8;return function(_0x426a68){if(_0x426a68){return _0x51ec30['status'](_0xe9f736)[_0x5cd0('0x19')](_0x426a68);}};}function respondWithFilteredResult(_0x5b1d94,_0x2991d2){return function(_0xd1d12b){if(_0xd1d12b){var _0xf54ddb=typeof _0x2991d2['offset']==='undefined'&&typeof _0x2991d2[_0x5cd0('0x1a')]===_0x5cd0('0x1b');var _0x156947=_0xd1d12b['count'];var _0x57d81d=_0xf54ddb?0x0:_0x2991d2['offset'];var _0x1847dd=_0xf54ddb?_0xd1d12b[_0x5cd0('0x1c')]:_0x2991d2['offset']+_0x2991d2[_0x5cd0('0x1a')];var _0x19554c;if(_0x1847dd>=_0x156947){_0x1847dd=_0x156947;_0x19554c=0xc8;}else{_0x19554c=0xce;}_0x5b1d94[_0x5cd0('0x1d')](_0x19554c);return _0x5b1d94[_0x5cd0('0x1e')](_0x5cd0('0x1f'),_0x57d81d+'-'+_0x1847dd+'/'+_0x156947)[_0x5cd0('0x19')](_0xd1d12b);}return null;};}function patchUpdates(_0x18b907){return function(_0xc5c11c){try{jsonpatch[_0x5cd0('0x20')](_0xc5c11c,_0x18b907,!![]);}catch(_0xd270d8){return BPromise[_0x5cd0('0x21')](_0xd270d8);}return _0xc5c11c[_0x5cd0('0x22')]();};}function saveUpdates(_0x1828ac,_0x1fe052){return function(_0x5c2bd9){if(_0x5c2bd9){return _0x5c2bd9['update'](_0x1828ac)[_0x5cd0('0x23')](function(_0x5bd14d){return _0x5bd14d;});}return null;};}function removeEntity(_0x236fb3,_0x2e01b6){return function(_0x1e8960){if(_0x1e8960){return _0x1e8960[_0x5cd0('0x24')]()[_0x5cd0('0x23')](function(){_0x236fb3[_0x5cd0('0x1d')](0xcc)[_0x5cd0('0x25')]();});}};}function handleEntityNotFound(_0x5385db,_0x4a1fa4){return function(_0x2cd387){if(!_0x2cd387){_0x5385db[_0x5cd0('0x18')](0x194);}return _0x2cd387;};}function handleError(_0x28fcaa,_0x189fa8){_0x189fa8=_0x189fa8||0x1f4;return function(_0x5bff8a){logger[_0x5cd0('0x26')](_0x5bff8a[_0x5cd0('0x27')]);if(_0x5bff8a[_0x5cd0('0x28')]){delete _0x5bff8a['name'];}_0x28fcaa['status'](_0x189fa8)[_0x5cd0('0x29')](_0x5bff8a);};}exports[_0x5cd0('0x2a')]=function(_0x5a2123,_0x246525){var _0x4020d1={},_0x2dfb5d={},_0x1c73e1={'count':0x0,'rows':[]};var _0x3c80d1=_[_0x5cd0('0x2b')](db[_0x5cd0('0x2c')]['rawAttributes'],function(_0x412f1e){return{'name':_0x412f1e[_0x5cd0('0x2d')],'type':_0x412f1e[_0x5cd0('0x2e')][_0x5cd0('0x2f')]};});_0x2dfb5d[_0x5cd0('0x30')]=_[_0x5cd0('0x2b')](_0x3c80d1,_0x5cd0('0x28'));_0x2dfb5d[_0x5cd0('0x31')]=_[_0x5cd0('0x32')](_0x5a2123[_0x5cd0('0x31')]);_0x2dfb5d['filters']=_[_0x5cd0('0x33')](_0x2dfb5d[_0x5cd0('0x30')],_0x2dfb5d['query']);_0x4020d1[_0x5cd0('0x34')]=_['intersection'](_0x2dfb5d[_0x5cd0('0x30')],qs[_0x5cd0('0x35')](_0x5a2123['query'][_0x5cd0('0x35')]));_0x4020d1['attributes']=_0x4020d1[_0x5cd0('0x34')][_0x5cd0('0x36')]?_0x4020d1[_0x5cd0('0x34')]:_0x2dfb5d['model'];if(!_0x5a2123[_0x5cd0('0x31')]['hasOwnProperty'](_0x5cd0('0x37'))){_0x4020d1[_0x5cd0('0x1a')]=qs['limit'](_0x5a2123[_0x5cd0('0x31')][_0x5cd0('0x1a')]);_0x4020d1[_0x5cd0('0x38')]=qs[_0x5cd0('0x38')](_0x5a2123[_0x5cd0('0x31')]['offset']);}_0x4020d1['order']=qs[_0x5cd0('0x39')](_0x5a2123[_0x5cd0('0x31')]['sort']);_0x4020d1[_0x5cd0('0x3a')]=qs[_0x5cd0('0x3b')](_[_0x5cd0('0x3c')](_0x5a2123[_0x5cd0('0x31')],_0x2dfb5d[_0x5cd0('0x3b')]),_0x3c80d1);if(_0x5a2123['query'][_0x5cd0('0x3d')]){_0x4020d1[_0x5cd0('0x3a')]=_[_0x5cd0('0x3e')](_0x4020d1[_0x5cd0('0x3a')],{'$or':_[_0x5cd0('0x2b')](_0x3c80d1,function(_0x144101){if(_0x144101[_0x5cd0('0x2e')]!==_0x5cd0('0x3f')){var _0xd12dfa={};_0xd12dfa[_0x144101[_0x5cd0('0x28')]]={'$like':'%'+_0x5a2123[_0x5cd0('0x31')][_0x5cd0('0x3d')]+'%'};return _0xd12dfa;}})});}_0x4020d1=_[_0x5cd0('0x3e')]({},_0x4020d1,_0x5a2123[_0x5cd0('0x40')]);var _0x49f4b5={'where':_0x4020d1['where']};return db[_0x5cd0('0x2c')]['count'](_0x49f4b5)[_0x5cd0('0x23')](function(_0x55d99a){_0x1c73e1[_0x5cd0('0x1c')]=_0x55d99a;if(_0x5a2123[_0x5cd0('0x31')][_0x5cd0('0x41')]){_0x4020d1[_0x5cd0('0x42')]=[{'all':!![]}];}return db[_0x5cd0('0x2c')]['findAll'](_0x4020d1);})[_0x5cd0('0x23')](function(_0x5c7468){_0x1c73e1['rows']=_0x5c7468;return _0x1c73e1;})[_0x5cd0('0x23')](respondWithFilteredResult(_0x246525,_0x4020d1))[_0x5cd0('0x43')](handleError(_0x246525,null));};exports[_0x5cd0('0x44')]=function(_0x4bcb6d,_0x31ca10){var _0x5920c3={'raw':!![],'where':{'id':_0x4bcb6d['params']['id']}},_0xe5a6ee={};_0xe5a6ee['model']=_[_0x5cd0('0x32')](db[_0x5cd0('0x2c')][_0x5cd0('0x45')]);_0xe5a6ee[_0x5cd0('0x31')]=_[_0x5cd0('0x32')](_0x4bcb6d['query']);_0xe5a6ee[_0x5cd0('0x3b')]=_[_0x5cd0('0x33')](_0xe5a6ee[_0x5cd0('0x30')],_0xe5a6ee[_0x5cd0('0x31')]);_0x5920c3['attributes']=_[_0x5cd0('0x33')](_0xe5a6ee[_0x5cd0('0x30')],qs[_0x5cd0('0x35')](_0x4bcb6d[_0x5cd0('0x31')][_0x5cd0('0x35')]));_0x5920c3['attributes']=_0x5920c3[_0x5cd0('0x34')][_0x5cd0('0x36')]?_0x5920c3[_0x5cd0('0x34')]:_0xe5a6ee[_0x5cd0('0x30')];if(_0x4bcb6d[_0x5cd0('0x31')]['includeAll']){_0x5920c3[_0x5cd0('0x42')]=[{'all':!![]}];}_0x5920c3=_[_0x5cd0('0x3e')]({},_0x5920c3,_0x4bcb6d['options']);return db['JscriptyAnswerReport'][_0x5cd0('0x46')](_0x5920c3)[_0x5cd0('0x23')](handleEntityNotFound(_0x31ca10,null))[_0x5cd0('0x23')](respondWithResult(_0x31ca10,null))[_0x5cd0('0x43')](handleError(_0x31ca10,null));};exports[_0x5cd0('0x47')]=function(_0x48d5e8,_0x5ca7a3){return db[_0x5cd0('0x2c')][_0x5cd0('0x47')](_0x48d5e8[_0x5cd0('0x48')],{})['then'](respondWithResult(_0x5ca7a3,0xc9))[_0x5cd0('0x43')](handleError(_0x5ca7a3,null));};exports['update']=function(_0x589157,_0x37d394){if(_0x589157[_0x5cd0('0x48')]['id']){delete _0x589157['body']['id'];}return db[_0x5cd0('0x2c')]['find']({'where':{'id':_0x589157[_0x5cd0('0x49')]['id']}})[_0x5cd0('0x23')](handleEntityNotFound(_0x37d394,null))[_0x5cd0('0x23')](saveUpdates(_0x589157[_0x5cd0('0x48')],null))['then'](respondWithResult(_0x37d394,null))[_0x5cd0('0x43')](handleError(_0x37d394,null));};exports['destroy']=function(_0x3e2015,_0x25b86b){return db[_0x5cd0('0x2c')][_0x5cd0('0x46')]({'where':{'id':_0x3e2015['params']['id']}})[_0x5cd0('0x23')](handleEntityNotFound(_0x25b86b,null))[_0x5cd0('0x23')](removeEntity(_0x25b86b,null))['catch'](handleError(_0x25b86b,null));};exports['describe']=function(_0x4015b4,_0x2e363e){return db[_0x5cd0('0x2c')][_0x5cd0('0x4a')]()['then'](respondWithResult(_0x2e363e,null))[_0x5cd0('0x43')](handleError(_0x2e363e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 1ed62b1..144292d 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 _0xa1b0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','JscriptyAnswerReport','util','../../config/logger','api','moment'];(function(_0x4138a3,_0x5ce393){var _0x21ccb5=function(_0x21ba59){while(--_0x21ba59){_0x4138a3['push'](_0x4138a3['shift']());}};_0x21ccb5(++_0x5ce393);}(_0xa1b0,0x194));var _0x0a1b=function(_0x1705a1,_0x327cdf){_0x1705a1=_0x1705a1-0x0;var _0x2d37fa=_0xa1b0[_0x1705a1];return _0x2d37fa;};'use strict';var _=require('lodash');var util=require(_0x0a1b('0x0'));var logger=require(_0x0a1b('0x1'))(_0x0a1b('0x2'));var moment=require(_0x0a1b('0x3'));var BPromise=require(_0x0a1b('0x4'));var rp=require(_0x0a1b('0x5'));var fs=require('fs');var path=require(_0x0a1b('0x6'));var rimraf=require(_0x0a1b('0x7'));var config=require(_0x0a1b('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x0a1b('0x9')]=function(_0x223fd2,_0x5d4cb9){return _0x223fd2[_0x0a1b('0xa')](_0x0a1b('0xb'),attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfc3=['JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xcfc3,0x1f0));var _0x3cfc=function(_0x38356a,_0x5ca333){_0x38356a=_0x38356a-0x0;var _0x1655b1=_0xcfc3[_0x38356a];return _0x1655b1;};'use strict';var _=require(_0x3cfc('0x0'));var util=require(_0x3cfc('0x1'));var logger=require(_0x3cfc('0x2'))(_0x3cfc('0x3'));var moment=require(_0x3cfc('0x4'));var BPromise=require('bluebird');var rp=require(_0x3cfc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3cfc('0x6'));var config=require(_0x3cfc('0x7'));var attributes=require(_0x3cfc('0x8'));module[_0x3cfc('0x9')]=function(_0x3e0800,_0x4b55d4){return _0x3e0800[_0x3cfc('0xa')](_0x3cfc('0xb'),attributes,{'tableName':_0x3cfc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 714aee4..ec21914 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 _0x971f=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s'];(function(_0x4eefe6,_0x1202ce){var _0x22b387=function(_0xb34c64){while(--_0xb34c64){_0x4eefe6['push'](_0x4eefe6['shift']());}};_0x22b387(++_0x1202ce);}(_0x971f,0x196));var _0xf971=function(_0x4fd3e5,_0x1ad7cd){_0x4fd3e5=_0x4fd3e5-0x0;var _0x44264b=_0x971f[_0x4fd3e5];return _0x44264b;};'use strict';var _=require(_0xf971('0x0'));var util=require('util');var moment=require(_0xf971('0x1'));var BPromise=require(_0xf971('0x2'));var rs=require(_0xf971('0x3'));var fs=require('fs');var Redis=require(_0xf971('0x4'));var db=require(_0xf971('0x5'))['db'];var utils=require(_0xf971('0x6'));var logger=require(_0xf971('0x7'))(_0xf971('0x8'));var config=require(_0xf971('0x9'));var jayson=require(_0xf971('0xa'));var client=jayson[_0xf971('0xb')][_0xf971('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37e85f,_0x22ee1d,_0x247c42){return new BPromise(function(_0x3a9a20,_0x4f56d8){return client[_0xf971('0xd')](_0x37e85f,_0x247c42)['then'](function(_0x261733){logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));logger[_0xf971('0x11')](_0xf971('0x12'),_0x22ee1d,_0xf971('0x10'),JSON[_0xf971('0x13')](_0x261733));if(_0x261733[_0xf971('0x14')]){if(_0x261733['error'][_0xf971('0x15')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x22ee1d,_0x261733['error'][_0xf971('0x16')]);return _0x4f56d8(_0x261733[_0xf971('0x14')]['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x22ee1d,_0x261733[_0xf971('0x14')]['message']);return _0x3a9a20(_0x261733[_0xf971('0x14')]['message']);}else{logger[_0xf971('0xe')](_0xf971('0xf'),_0x22ee1d,_0xf971('0x10'));_0x3a9a20(_0x261733[_0xf971('0x17')]['message']);}})[_0xf971('0x18')](function(_0x5ec192){logger[_0xf971('0x14')](_0xf971('0xf'),_0x22ee1d,_0x5ec192);_0x4f56d8(_0x5ec192);});});} \ No newline at end of file +var _0xf9d8=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s'];(function(_0xfedc72,_0x292f02){var _0x2c7c78=function(_0x12fbf1){while(--_0x12fbf1){_0xfedc72['push'](_0xfedc72['shift']());}};_0x2c7c78(++_0x292f02);}(_0xf9d8,0xc4));var _0x8f9d=function(_0x4ed598,_0x4be0d7){_0x4ed598=_0x4ed598-0x0;var _0x23f702=_0xf9d8[_0x4ed598];return _0x23f702;};'use strict';var _=require(_0x8f9d('0x0'));var util=require(_0x8f9d('0x1'));var moment=require(_0x8f9d('0x2'));var BPromise=require(_0x8f9d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f9d('0x4'));var logger=require('../../config/logger')(_0x8f9d('0x5'));var config=require(_0x8f9d('0x6'));var jayson=require(_0x8f9d('0x7'));var client=jayson[_0x8f9d('0x8')][_0x8f9d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f736d,_0x38665f,_0xec8cab){return new BPromise(function(_0x382b34,_0x585484){return client[_0x8f9d('0xa')](_0x4f736d,_0xec8cab)['then'](function(_0x38c6d2){logger[_0x8f9d('0xb')](_0x8f9d('0xc'),_0x38665f,_0x8f9d('0xd'));logger[_0x8f9d('0xe')](_0x8f9d('0xf'),_0x38665f,_0x8f9d('0xd'),JSON['stringify'](_0x38c6d2));if(_0x38c6d2[_0x8f9d('0x10')]){if(_0x38c6d2[_0x8f9d('0x10')]['code']===0x1f4){logger[_0x8f9d('0x10')](_0x8f9d('0xc'),_0x38665f,_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);return _0x585484(_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);}logger[_0x8f9d('0x10')](_0x8f9d('0xc'),_0x38665f,_0x38c6d2[_0x8f9d('0x10')][_0x8f9d('0x11')]);return _0x382b34(_0x38c6d2[_0x8f9d('0x10')]['message']);}else{logger[_0x8f9d('0xb')](_0x8f9d('0xc'),_0x38665f,'request\x20sent');_0x382b34(_0x38c6d2['result']['message']);}})[_0x8f9d('0x12')](function(_0x54a909){logger['error'](_0x8f9d('0xc'),_0x38665f,_0x54a909);_0x585484(_0x54a909);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index db240e0..2cea285 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 _0xe186=['getSessions','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/sessions'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xe186,0x192));var _0x6e18=function(_0x1bc202,_0x488b89){_0x1bc202=_0x1bc202-0x0;var _0x58a164=_0xe186[_0x1bc202];return _0x58a164;};'use strict';var multer=require('multer');var util=require(_0x6e18('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6e18('0x1'));var router=express[_0x6e18('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x6e18('0x3'));var interaction=require(_0x6e18('0x4'));var config=require(_0x6e18('0x5'));var controller=require('./jscriptyProject.controller');router['get']('/',auth[_0x6e18('0x6')](),controller[_0x6e18('0x7')]);router[_0x6e18('0x8')](_0x6e18('0x9'),auth[_0x6e18('0x6')](),controller[_0x6e18('0xa')]);router[_0x6e18('0x8')](_0x6e18('0xb'),auth[_0x6e18('0x6')](),controller[_0x6e18('0xc')]);router['get']('/:id/answers',auth[_0x6e18('0x6')](),controller[_0x6e18('0xd')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0x6e18('0xe')),controller[_0x6e18('0xf')]);router[_0x6e18('0x10')]('/',auth[_0x6e18('0x6')](),controller[_0x6e18('0x11')]);router[_0x6e18('0x10')](_0x6e18('0x12'),auth[_0x6e18('0x6')](),controller[_0x6e18('0x13')]);router[_0x6e18('0x14')]('/:id',auth[_0x6e18('0x6')](),controller[_0x6e18('0x15')]);router['delete'](_0x6e18('0x9'),auth[_0x6e18('0x6')](),controller['destroy']);module[_0x6e18('0x16')]=router; \ No newline at end of file +var _0x84d6=['update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','getSessions','/:id/answers','getAnswers','30s','getSummary','/:id/clone','clone'];(function(_0x238eff,_0x24045e){var _0x5a45c9=function(_0xea5589){while(--_0xea5589){_0x238eff['push'](_0x238eff['shift']());}};_0x5a45c9(++_0x24045e);}(_0x84d6,0x1e6));var _0x684d=function(_0x319f9e,_0x52c643){_0x319f9e=_0x319f9e-0x0;var _0x8b4ada=_0x84d6[_0x319f9e];return _0x8b4ada;};'use strict';var multer=require(_0x684d('0x0'));var util=require(_0x684d('0x1'));var path=require('path');var timeout=require(_0x684d('0x2'));var express=require('express');var router=express[_0x684d('0x3')]();var fs_extra=require(_0x684d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x684d('0x5'));var config=require(_0x684d('0x6'));var controller=require(_0x684d('0x7'));router['get']('/',auth[_0x684d('0x8')](),controller[_0x684d('0x9')]);router[_0x684d('0xa')](_0x684d('0xb'),auth[_0x684d('0x8')](),controller[_0x684d('0xc')]);router[_0x684d('0xa')]('/:id/sessions',auth[_0x684d('0x8')](),controller[_0x684d('0xd')]);router[_0x684d('0xa')](_0x684d('0xe'),auth[_0x684d('0x8')](),controller[_0x684d('0xf')]);router[_0x684d('0xa')]('/:id/summary',auth['isAuthenticated'](),timeout(_0x684d('0x10')),controller[_0x684d('0x11')]);router['post']('/',auth[_0x684d('0x8')](),controller['create']);router['post'](_0x684d('0x12'),auth[_0x684d('0x8')](),controller[_0x684d('0x13')]);router['put']('/:id',auth[_0x684d('0x8')](),controller[_0x684d('0x14')]);router[_0x684d('0x15')]('/:id',auth[_0x684d('0x8')](),controller[_0x684d('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 6733bd9..5beff53 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 _0x86a0=['exports','name','STRING','TEXT','long','formData','isString','setDataValue','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','sequelize','lodash'];(function(_0x41bdf4,_0x31fa09){var _0x294a6a=function(_0x24cfe3){while(--_0x24cfe3){_0x41bdf4['push'](_0x41bdf4['shift']());}};_0x294a6a(++_0x31fa09);}(_0x86a0,0x143));var _0x086a=function(_0x320cf4,_0xbc914e){_0x320cf4=_0x320cf4-0x0;var _0x4a4f9b=_0x86a0[_0x320cf4];return _0x4a4f9b;};'use strict';var Sequelize=require(_0x086a('0x0'));var _=require(_0x086a('0x1'));var util=require('util');module[_0x086a('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x086a('0x3')},'description':{'type':Sequelize[_0x086a('0x4')]},'formData':{'type':Sequelize[_0x086a('0x5')](_0x086a('0x6')),'set':function(_0x144187){if(_['isObjectLike'](_0x144187)){this['setDataValue'](_0x086a('0x7'),JSON['stringify'](_0x144187));}else if(_[_0x086a('0x8')](_0x144187)){this[_0x086a('0x9')](_0x086a('0x7'),_0x144187);}else{this[_0x086a('0x9')](_0x086a('0x7'),util['format'](_0x086a('0xa'),this[_0x086a('0xb')](_0x086a('0x3'))||'',this[_0x086a('0xb')](_0x086a('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xfb2e=['stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','name','description','BOOLEAN','sequelize','lodash','exports','STRING','TEXT','long','setDataValue','formData'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xfb2e,0x19c));var _0xefb2=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xfb2e[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0xefb2('0x0'));var _=require(_0xefb2('0x1'));var util=require('util');module[_0xefb2('0x2')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xefb2('0x3')]},'formData':{'type':Sequelize[_0xefb2('0x4')](_0xefb2('0x5')),'set':function(_0x456366){if(_['isObjectLike'](_0x456366)){this[_0xefb2('0x6')](_0xefb2('0x7'),JSON[_0xefb2('0x8')](_0x456366));}else if(_[_0xefb2('0x9')](_0x456366)){this[_0xefb2('0x6')](_0xefb2('0x7'),_0x456366);}else{this[_0xefb2('0x6')](_0xefb2('0x7'),util['format'](_0xefb2('0xa'),this['getDataValue'](_0xefb2('0xb'))||'',this['getDataValue'](_0xefb2('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xefb2('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xefb2('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index fc784f2..1bb3b1c 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 _0x4f3c=['Content-type','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','then','destroy','get','Projects','UserProfileResource','error','name','index','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','omit','createdAt','updatedAt','body','UserProfileSection','autoAssociation','JscriptySessionReport','hasOwnProperty','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','JscriptyQuestionReport','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader'];(function(_0x21195f,_0x54675e){var _0x21b1fe=function(_0x39da99){while(--_0x39da99){_0x21195f['push'](_0x21195f['shift']());}};_0x21b1fe(++_0x54675e);}(_0x4f3c,0x15d));var _0xc4f3=function(_0x59fffa,_0x5a61db){_0x59fffa=_0x59fffa-0x0;var _0x281d4e=_0x4f3c[_0x59fffa];return _0x281d4e;};'use strict';var emlformat=require(_0xc4f3('0x0'));var rimraf=require(_0xc4f3('0x1'));var zipdir=require(_0xc4f3('0x2'));var jsonpatch=require(_0xc4f3('0x3'));var rp=require(_0xc4f3('0x4'));var moment=require(_0xc4f3('0x5'));var BPromise=require(_0xc4f3('0x6'));var Mustache=require(_0xc4f3('0x7'));var util=require(_0xc4f3('0x8'));var path=require(_0xc4f3('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xc4f3('0xa'));var fs=require('fs');var fs_extra=require(_0xc4f3('0xb'));var _=require(_0xc4f3('0xc'));var squel=require(_0xc4f3('0xd'));var crypto=require(_0xc4f3('0xe'));var jsforce=require(_0xc4f3('0xf'));var deskjs=require(_0xc4f3('0x10'));var toCsv=require(_0xc4f3('0x11'));var querystring=require(_0xc4f3('0x12'));var Papa=require(_0xc4f3('0x13'));var Redis=require('ioredis');var authService=require(_0xc4f3('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4f3('0x15'));var logger=require('../../config/logger')(_0xc4f3('0x16'));var utils=require(_0xc4f3('0x17'));var config=require(_0xc4f3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4f3('0x19'))['db'];function respondWithStatusCode(_0x4e869e,_0x498374){_0x498374=_0x498374||0xcc;return function(_0x4d1c74){if(_0x4d1c74){return _0x4e869e[_0xc4f3('0x1a')](_0x498374);}return _0x4e869e[_0xc4f3('0x1b')](_0x498374)[_0xc4f3('0x1c')]();};}function respondWithResult(_0x3ffd95,_0x53e5c4){_0x53e5c4=_0x53e5c4||0xc8;return function(_0x12981d){if(_0x12981d){return _0x3ffd95[_0xc4f3('0x1b')](_0x53e5c4)[_0xc4f3('0x1d')](_0x12981d);}};}function respondWithFilteredResult(_0x47814f,_0x5583fa){return function(_0x927b26){if(_0x927b26){var _0x3a4ff3=typeof _0x5583fa['offset']===_0xc4f3('0x1e')&&typeof _0x5583fa[_0xc4f3('0x1f')]===_0xc4f3('0x1e');var _0x53b0b6=_0x927b26['count'];var _0xbc5595=_0x3a4ff3?0x0:_0x5583fa[_0xc4f3('0x20')];var _0x1dc5a8=_0x3a4ff3?_0x927b26[_0xc4f3('0x21')]:_0x5583fa['offset']+_0x5583fa[_0xc4f3('0x1f')];var _0x41e2bd;if(_0x1dc5a8>=_0x53b0b6){_0x1dc5a8=_0x53b0b6;_0x41e2bd=0xc8;}else{_0x41e2bd=0xce;}_0x47814f[_0xc4f3('0x1b')](_0x41e2bd);return _0x47814f[_0xc4f3('0x22')](_0xc4f3('0x23'),_0xbc5595+'-'+_0x1dc5a8+'/'+_0x53b0b6)[_0xc4f3('0x1d')](_0x927b26);}return null;};}function patchUpdates(_0x35111f){return function(_0x2bacbc){try{jsonpatch[_0xc4f3('0x24')](_0x2bacbc,_0x35111f,!![]);}catch(_0x16e4e7){return BPromise[_0xc4f3('0x25')](_0x16e4e7);}return _0x2bacbc['save']();};}function saveUpdates(_0x27f7e1,_0xb9b864){return function(_0x4b19a3){if(_0x4b19a3){return _0x4b19a3['update'](_0x27f7e1)[_0xc4f3('0x26')](function(_0x154729){return _0x154729;});}return null;};}function removeEntity(_0x561ea3,_0x5b3ac3){return function(_0x1f04a7){if(_0x1f04a7){return _0x1f04a7[_0xc4f3('0x27')]()[_0xc4f3('0x26')](function(){var _0x5f1d69=_0x1f04a7[_0xc4f3('0x28')]({'plain':!![]});var _0x460ee7=_0xc4f3('0x29');return db[_0xc4f3('0x2a')]['destroy']({'where':{'type':_0x460ee7,'resourceId':_0x5f1d69['id']}})[_0xc4f3('0x26')](function(){return _0x1f04a7;});})[_0xc4f3('0x26')](function(){_0x561ea3[_0xc4f3('0x1b')](0xcc)[_0xc4f3('0x1c')]();});}};}function handleEntityNotFound(_0x67765a,_0x278d0a){return function(_0x2912e4){if(!_0x2912e4){_0x67765a['sendStatus'](0x194);}return _0x2912e4;};}function handleError(_0x45c294,_0x26b1ce){_0x26b1ce=_0x26b1ce||0x1f4;return function(_0x7e4227){logger[_0xc4f3('0x2b')](_0x7e4227['stack']);if(_0x7e4227[_0xc4f3('0x2c')]){delete _0x7e4227[_0xc4f3('0x2c')];}_0x45c294['status'](_0x26b1ce)['send'](_0x7e4227);};}exports[_0xc4f3('0x2d')]=function(_0x2c05c4,_0x5500f3){var _0x3c1722={},_0x1bcb2a={},_0x303b12={'count':0x0,'rows':[]};var _0x393953=_['map'](db[_0xc4f3('0x2e')][_0xc4f3('0x2f')],function(_0x256519){return{'name':_0x256519[_0xc4f3('0x30')],'type':_0x256519[_0xc4f3('0x31')][_0xc4f3('0x32')]};});_0x1bcb2a[_0xc4f3('0x33')]=_['map'](_0x393953,_0xc4f3('0x2c'));_0x1bcb2a[_0xc4f3('0x34')]=_['keys'](_0x2c05c4[_0xc4f3('0x34')]);_0x1bcb2a[_0xc4f3('0x35')]=_[_0xc4f3('0x36')](_0x1bcb2a['model'],_0x1bcb2a['query']);_0x3c1722[_0xc4f3('0x37')]=_[_0xc4f3('0x36')](_0x1bcb2a[_0xc4f3('0x33')],qs[_0xc4f3('0x38')](_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x38')]));_0x3c1722[_0xc4f3('0x37')]=_0x3c1722[_0xc4f3('0x37')][_0xc4f3('0x39')]?_0x3c1722[_0xc4f3('0x37')]:_0x1bcb2a[_0xc4f3('0x33')];if(!_0x2c05c4[_0xc4f3('0x34')]['hasOwnProperty']('nolimit')){_0x3c1722[_0xc4f3('0x1f')]=qs[_0xc4f3('0x1f')](_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x1f')]);_0x3c1722[_0xc4f3('0x20')]=qs[_0xc4f3('0x20')](_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x20')]);}_0x3c1722[_0xc4f3('0x3a')]=qs['sort'](_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x3b')]);_0x3c1722['where']=qs['filters'](_[_0xc4f3('0x3c')](_0x2c05c4[_0xc4f3('0x34')],_0x1bcb2a['filters']),_0x393953);if(_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x3d')]){_0x3c1722[_0xc4f3('0x3e')]=_[_0xc4f3('0x3f')](_0x3c1722[_0xc4f3('0x3e')],{'$or':_[_0xc4f3('0x40')](_0x393953,function(_0x59d916){if(_0x59d916[_0xc4f3('0x31')]!==_0xc4f3('0x41')){var _0x1e82c0={};_0x1e82c0[_0x59d916[_0xc4f3('0x2c')]]={'$like':'%'+_0x2c05c4[_0xc4f3('0x34')][_0xc4f3('0x3d')]+'%'};return _0x1e82c0;}})});}_0x3c1722=_['merge']({},_0x3c1722,_0x2c05c4[_0xc4f3('0x42')]);var _0x3e4519={'where':_0x3c1722[_0xc4f3('0x3e')]};return db[_0xc4f3('0x2e')][_0xc4f3('0x21')](_0x3e4519)['then'](function(_0x32daa6){_0x303b12[_0xc4f3('0x21')]=_0x32daa6;if(_0x2c05c4['query'][_0xc4f3('0x43')]){_0x3c1722['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xc4f3('0x44')](_0x3c1722);})['then'](function(_0x33ae3b){_0x303b12['rows']=_0x33ae3b;return _0x303b12;})[_0xc4f3('0x26')](respondWithFilteredResult(_0x5500f3,_0x3c1722))[_0xc4f3('0x45')](handleError(_0x5500f3,null));};exports[_0xc4f3('0x46')]=function(_0x30cebc,_0xb04087){var _0x26b04b={'raw':![],'where':{'id':_0x30cebc[_0xc4f3('0x47')]['id']}},_0x325425={};_0x325425[_0xc4f3('0x33')]=_[_0xc4f3('0x48')](db[_0xc4f3('0x2e')]['rawAttributes']);_0x325425[_0xc4f3('0x34')]=_['keys'](_0x30cebc[_0xc4f3('0x34')]);_0x325425[_0xc4f3('0x35')]=_[_0xc4f3('0x36')](_0x325425[_0xc4f3('0x33')],_0x325425[_0xc4f3('0x34')]);_0x26b04b[_0xc4f3('0x37')]=_['intersection'](_0x325425[_0xc4f3('0x33')],qs[_0xc4f3('0x38')](_0x30cebc[_0xc4f3('0x34')][_0xc4f3('0x38')]));_0x26b04b[_0xc4f3('0x37')]=_0x26b04b[_0xc4f3('0x37')][_0xc4f3('0x39')]?_0x26b04b[_0xc4f3('0x37')]:_0x325425[_0xc4f3('0x33')];if(_0x30cebc[_0xc4f3('0x34')][_0xc4f3('0x43')]){_0x26b04b['include']=[{'all':!![]}];}_0x26b04b=_[_0xc4f3('0x3f')]({},_0x26b04b,_0x30cebc[_0xc4f3('0x42')]);return db[_0xc4f3('0x2e')][_0xc4f3('0x49')](_0x26b04b)['then'](handleEntityNotFound(_0xb04087,null))['then'](respondWithResult(_0xb04087,null))[_0xc4f3('0x45')](handleError(_0xb04087,null));};exports[_0xc4f3('0x4a')]=function(_0x374815,_0x539b0a){return db[_0xc4f3('0x2e')][_0xc4f3('0x4a')](_0x374815['body'],{})['then'](function(_0x1fb8d9){var _0x174462=_0x374815[_0xc4f3('0x4b')][_0xc4f3('0x28')]({'plain':!![]});if(!_0x174462)throw new Error(_0xc4f3('0x4c'));if(_0x174462[_0xc4f3('0x4d')]===_0xc4f3('0x4b')){var _0x50eff3=_0x1fb8d9[_0xc4f3('0x28')]({'plain':!![]});var _0x21ab57=_0xc4f3('0x29');return db['UserProfileSection'][_0xc4f3('0x49')]({'where':{'name':_0x21ab57,'userProfileId':_0x174462[_0xc4f3('0x4e')]},'raw':!![]})[_0xc4f3('0x26')](function(_0xf2b8c5){if(_0xf2b8c5&&_0xf2b8c5['autoAssociation']===0x0){return db[_0xc4f3('0x2a')]['create']({'name':_0x50eff3[_0xc4f3('0x2c')],'resourceId':_0x50eff3['id'],'type':_0xf2b8c5['name'],'sectionId':_0xf2b8c5['id']},{})[_0xc4f3('0x26')](function(){return _0x1fb8d9;});}else{return _0x1fb8d9;}})[_0xc4f3('0x45')](function(_0x211333){logger['error'](_0xc4f3('0x4f'),_0x211333);throw _0x211333;});}return _0x1fb8d9;})[_0xc4f3('0x26')](respondWithResult(_0x539b0a,0xc9))['catch'](handleError(_0x539b0a,null));};exports[_0xc4f3('0x50')]=function(_0x117c72,_0x5e299c){var _0x440b26={'where':{'id':_0x117c72[_0xc4f3('0x47')]['id']}},_0x46e658={};_0x46e658[_0xc4f3('0x33')]=_[_0xc4f3('0x48')](db[_0xc4f3('0x2e')][_0xc4f3('0x2f')]);_0x440b26['attributes']=_[_0xc4f3('0x36')](_0x46e658['model'],qs[_0xc4f3('0x38')](_0x117c72['query'][_0xc4f3('0x38')]));_0x440b26['attributes']=_0x440b26[_0xc4f3('0x37')][_0xc4f3('0x39')]?_0x440b26[_0xc4f3('0x37')]:_0x46e658[_0xc4f3('0x33')];if(_0x117c72[_0xc4f3('0x34')][_0xc4f3('0x43')]){_0x440b26[_0xc4f3('0x51')]=[{'all':!![]}];}_0x440b26=_[_0xc4f3('0x3f')]({},_0x440b26,_0x117c72['options']);return db[_0xc4f3('0x2e')][_0xc4f3('0x49')](_0x440b26)['then'](handleEntityNotFound(_0x5e299c,null))[_0xc4f3('0x26')](function(_0x519127){if(_0x519127){var _0x5876d2=_0x519127[_0xc4f3('0x28')]({'plain':!![]});_0x5876d2=qs[_0xc4f3('0x52')](_0x5876d2,['id',_0xc4f3('0x53'),_0xc4f3('0x54')]);_0x117c72[_0xc4f3('0x55')]=_[_0xc4f3('0x52')](_0x117c72[_0xc4f3('0x55')],['id','createdAt',_0xc4f3('0x54')]);return db[_0xc4f3('0x2e')][_0xc4f3('0x4a')](_['merge'](_0x5876d2,_0x117c72[_0xc4f3('0x55')]),{'include':_0x117c72[_0xc4f3('0x34')]['includeAll']?[{'all':!![]}]:undefined})[_0xc4f3('0x26')](function(_0x5ce132){var _0x25ffe5=_0x117c72[_0xc4f3('0x4b')][_0xc4f3('0x28')]({'plain':!![]});if(!_0x25ffe5)throw new Error(_0xc4f3('0x4c'));if(_0x25ffe5[_0xc4f3('0x4d')]===_0xc4f3('0x4b')){var _0x3c5a68=_0x5ce132['get']({'plain':!![]});var _0x56dd7f=_0xc4f3('0x29');return db[_0xc4f3('0x56')][_0xc4f3('0x49')]({'where':{'name':_0x56dd7f,'userProfileId':_0x25ffe5[_0xc4f3('0x4e')]},'raw':!![]})['then'](function(_0x19ec0f){if(_0x19ec0f&&_0x19ec0f[_0xc4f3('0x57')]===0x0){return db[_0xc4f3('0x2a')]['create']({'name':_0x3c5a68[_0xc4f3('0x2c')],'resourceId':_0x3c5a68['id'],'type':_0x19ec0f[_0xc4f3('0x2c')],'sectionId':_0x19ec0f['id']},{})[_0xc4f3('0x26')](function(){return _0x5ce132;});}else{return _0x5ce132;}})['catch'](function(_0xaba55e){logger[_0xc4f3('0x2b')](_0xc4f3('0x4f'),_0xaba55e);throw _0xaba55e;});}return _0x5ce132;});}})[_0xc4f3('0x26')](respondWithResult(_0x5e299c,0xc9))['catch'](handleError(_0x5e299c,null));};exports['update']=function(_0x236359,_0x4b06a4){if(_0x236359['body']['id']){delete _0x236359[_0xc4f3('0x55')]['id'];}return db['JscriptyProject'][_0xc4f3('0x49')]({'where':{'id':_0x236359[_0xc4f3('0x47')]['id']}})[_0xc4f3('0x26')](handleEntityNotFound(_0x4b06a4,null))[_0xc4f3('0x26')](saveUpdates(_0x236359[_0xc4f3('0x55')],null))[_0xc4f3('0x26')](respondWithResult(_0x4b06a4,null))[_0xc4f3('0x45')](handleError(_0x4b06a4,null));};exports['destroy']=function(_0x31ad35,_0x5e88cc){return db['JscriptyProject'][_0xc4f3('0x49')]({'where':{'id':_0x31ad35[_0xc4f3('0x47')]['id']}})[_0xc4f3('0x26')](handleEntityNotFound(_0x5e88cc,null))['then'](removeEntity(_0x5e88cc,null))[_0xc4f3('0x45')](handleError(_0x5e88cc,null));};exports['getSessions']=function(_0x41de89,_0x21dd99,_0x492842){var _0x52679f={'raw':!![],'where':{}};var _0x515e86={};var _0x57e24c={'count':0x0,'rows':[]};return db[_0xc4f3('0x2e')]['findOne']({'where':{'id':_0x41de89['params']['id']}})['then'](handleEntityNotFound(_0x21dd99,null))[_0xc4f3('0x26')](function(_0x1e0832){if(_0x1e0832){_0x515e86['model']=_[_0xc4f3('0x48')](db[_0xc4f3('0x58')][_0xc4f3('0x2f')]);_0x515e86[_0xc4f3('0x34')]=_['keys'](_0x41de89[_0xc4f3('0x34')]);_0x515e86[_0xc4f3('0x35')]=_[_0xc4f3('0x36')](_0x515e86[_0xc4f3('0x33')],_0x515e86[_0xc4f3('0x34')]);_0x52679f[_0xc4f3('0x37')]=_[_0xc4f3('0x36')](_0x515e86[_0xc4f3('0x33')],qs[_0xc4f3('0x38')](_0x41de89[_0xc4f3('0x34')][_0xc4f3('0x38')]));_0x52679f[_0xc4f3('0x37')]=_0x52679f[_0xc4f3('0x37')]['length']?_0x52679f[_0xc4f3('0x37')]:_0x515e86[_0xc4f3('0x33')];if(!_0x41de89[_0xc4f3('0x34')][_0xc4f3('0x59')]('nolimit')){_0x52679f['limit']=qs[_0xc4f3('0x1f')](_0x41de89[_0xc4f3('0x34')]['limit']);_0x52679f['offset']=qs[_0xc4f3('0x20')](_0x41de89['query'][_0xc4f3('0x20')]);}_0x52679f['order']=qs['sort'](_0x41de89['query'][_0xc4f3('0x3b')]);_0x52679f[_0xc4f3('0x3e')]=qs['filters'](_['pick'](_0x41de89[_0xc4f3('0x34')],_0x515e86[_0xc4f3('0x35')]));_0x52679f['where'][_0xc4f3('0x5a')]=_0x1e0832['id'];if(_0x41de89[_0xc4f3('0x34')]['filter']){_0x52679f['where']=_[_0xc4f3('0x3f')](_0x52679f[_0xc4f3('0x3e')],{'$or':_[_0xc4f3('0x40')](_0x52679f[_0xc4f3('0x37')],function(_0x25521c){var _0x3ce7bd={};_0x3ce7bd[_0x25521c]={'$like':'%'+_0x41de89[_0xc4f3('0x34')]['filter']+'%'};return _0x3ce7bd;})});}_0x52679f=_[_0xc4f3('0x3f')]({},_0x52679f,_0x41de89['options']);return db[_0xc4f3('0x58')][_0xc4f3('0x21')]({'where':_0x52679f[_0xc4f3('0x3e')]})['then'](function(_0x18db4b){_0x57e24c[_0xc4f3('0x21')]=_0x18db4b;if(_0x41de89[_0xc4f3('0x34')][_0xc4f3('0x43')]){_0x52679f[_0xc4f3('0x51')]=[{'all':!![]}];}return db[_0xc4f3('0x58')][_0xc4f3('0x44')](_0x52679f);})['then'](function(_0x1cb298){_0x57e24c[_0xc4f3('0x5b')]=_0x1cb298;return _0x57e24c;});}})[_0xc4f3('0x26')](respondWithFilteredResult(_0x21dd99,_0x52679f))[_0xc4f3('0x45')](handleError(_0x21dd99,null));};exports['getAnswers']=function(_0x45b2a7,_0x41be6a,_0x2ab1be){var _0x5845e7={'raw':!![],'where':{}};var _0x45bd37={};var _0x5a54c5={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x45b2a7[_0xc4f3('0x47')]['id']}})[_0xc4f3('0x26')](handleEntityNotFound(_0x41be6a,null))[_0xc4f3('0x26')](function(_0x35dde8){if(_0x35dde8){_0x45bd37['model']=_[_0xc4f3('0x48')](db[_0xc4f3('0x5c')][_0xc4f3('0x2f')]);_0x45bd37[_0xc4f3('0x34')]=_[_0xc4f3('0x48')](_0x45b2a7[_0xc4f3('0x34')]);_0x45bd37[_0xc4f3('0x35')]=_['intersection'](_0x45bd37[_0xc4f3('0x33')],_0x45bd37[_0xc4f3('0x34')]);_0x5845e7['attributes']=_['intersection'](_0x45bd37['model'],qs['fields'](_0x45b2a7[_0xc4f3('0x34')][_0xc4f3('0x38')]));_0x5845e7[_0xc4f3('0x37')]=_0x5845e7[_0xc4f3('0x37')][_0xc4f3('0x39')]?_0x5845e7[_0xc4f3('0x37')]:_0x45bd37['model'];if(!_0x45b2a7[_0xc4f3('0x34')][_0xc4f3('0x59')]('nolimit')){_0x5845e7[_0xc4f3('0x1f')]=qs[_0xc4f3('0x1f')](_0x45b2a7[_0xc4f3('0x34')]['limit']);_0x5845e7[_0xc4f3('0x20')]=qs['offset'](_0x45b2a7['query'][_0xc4f3('0x20')]);}_0x5845e7[_0xc4f3('0x3a')]=qs['sort'](_0x45b2a7[_0xc4f3('0x34')][_0xc4f3('0x3b')]);_0x5845e7[_0xc4f3('0x3e')]=qs[_0xc4f3('0x35')](_[_0xc4f3('0x3c')](_0x45b2a7[_0xc4f3('0x34')],_0x45bd37[_0xc4f3('0x35')]));_0x5845e7['where'][_0xc4f3('0x5a')]=_0x35dde8['id'];if(_0x45b2a7[_0xc4f3('0x34')][_0xc4f3('0x3d')]){_0x5845e7[_0xc4f3('0x3e')]=_[_0xc4f3('0x3f')](_0x5845e7[_0xc4f3('0x3e')],{'$or':_[_0xc4f3('0x40')](_0x5845e7['attributes'],function(_0x10c7b8){var _0x53ac3f={};_0x53ac3f[_0x10c7b8]={'$like':'%'+_0x45b2a7[_0xc4f3('0x34')]['filter']+'%'};return _0x53ac3f;})});}_0x5845e7=_['merge']({},_0x5845e7,_0x45b2a7[_0xc4f3('0x42')]);return db[_0xc4f3('0x5c')][_0xc4f3('0x21')]({'where':_0x5845e7[_0xc4f3('0x3e')]})[_0xc4f3('0x26')](function(_0x59eb46){_0x5a54c5[_0xc4f3('0x21')]=_0x59eb46;if(_0x45b2a7['query']['includeAll']){_0x5845e7[_0xc4f3('0x51')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0xc4f3('0x44')](_0x5845e7);})[_0xc4f3('0x26')](function(_0x3529b5){_0x5a54c5[_0xc4f3('0x5b')]=_0x3529b5;return _0x5a54c5;});}})['then'](respondWithFilteredResult(_0x41be6a,_0x5845e7))[_0xc4f3('0x45')](handleError(_0x41be6a,null));};function char(_0x4e95e0){return _0xc4f3('0x5d')===typeof _0x4e95e0?String[_0xc4f3('0x5e')][_0xc4f3('0x24')](null,arguments):_0x4e95e0;}function needsEncapsulation(_0x2a3f4b){return!!_0x2a3f4b&&(_0x2a3f4b[_0xc4f3('0x5f')]()[_0xc4f3('0x60')](char(0xd))>=0x0||_0x2a3f4b[_0xc4f3('0x5f')]()[_0xc4f3('0x60')](char(0xa))>=0x0||_0x2a3f4b['toString']()['indexOf'](char(0x2c))>=0x0||_0x2a3f4b[_0xc4f3('0x5f')]()[_0xc4f3('0x60')](char(0x22))>=0x0);}function encapsulate(_0x2f2718){var _0x207384=char(0x22),_0x308bc7='\x5c'+char(0x22),_0x5aceb7=_0x2f2718[_0xc4f3('0x5f')]()[_0xc4f3('0x61')](new RegExp(_0x207384,'g'),_0x308bc7);return _0x207384+_0x5aceb7+_0x207384;}exports['getSummary']=function(_0x35a91f,_0x54b727,_0x86fe96){var _0x504cb6,_0x2320ae;var _0xb7c143={'where':{'ProjectId':_0x35a91f['params']['id']}};if(_0x35a91f['query'][_0xc4f3('0x62')]){_0xb7c143[_0xc4f3('0x3e')][_0xc4f3('0x63')]=JSON[_0xc4f3('0x64')](_0x35a91f['query'][_0xc4f3('0x62')]);}return db[_0xc4f3('0x58')][_0xc4f3('0x44')](_0xb7c143)[_0xc4f3('0x26')](handleEntityNotFound(_0x54b727,null))[_0xc4f3('0x26')](function(_0x17304e){if(_0x17304e){_0x504cb6=_0x17304e;return db[_0xc4f3('0x65')][_0xc4f3('0x44')]({'where':{'SessionId':{'$in':_[_0xc4f3('0x40')](_0x504cb6,'id')},'ProjectId':_0x35a91f[_0xc4f3('0x47')]['id']},'order':'-createdAt'});}})[_0xc4f3('0x26')](handleEntityNotFound(_0x54b727,null))[_0xc4f3('0x26')](function(_0x229956){if(_0x229956){_0x2320ae=_0x229956;var _0x9a5790={};for(var _0x45d1bf=0x0,_0x58ee59=_0x2320ae['length'];_0x45d1bf<_0x58ee59;_0x45d1bf++){if(!_0x9a5790[_0xc4f3('0x59')](_0x2320ae[_0x45d1bf][_0xc4f3('0x66')])){_0x9a5790[_0x2320ae[_0x45d1bf][_0xc4f3('0x66')]]=needsEncapsulation(_0x2320ae[_0x45d1bf]['question'])?encapsulate(_0x2320ae[_0x45d1bf][_0xc4f3('0x67')]):_0x2320ae[_0x45d1bf][_0xc4f3('0x67')];}}var _0x16b5d2=[],_0x46c85c={};for(var _0x15119e=0x0,_0x345cb8=_0x504cb6[_0xc4f3('0x39')];_0x15119e<_0x345cb8;_0x15119e++){_0x46c85c={'ProjectId':_0x35a91f[_0xc4f3('0x47')]['id'],'SessionId':_0x504cb6[_0x15119e]['id'],'StartTime':moment(_0x504cb6[_0x15119e][_0xc4f3('0x63')])[_0xc4f3('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x21e3a4=0x0,_0x3814b0=_0x2320ae['length'];_0x21e3a4<_0x3814b0;_0x21e3a4++){if(_0x2320ae[_0x21e3a4][_0xc4f3('0x69')]==_0x504cb6[_0x15119e]['id']&&_0x9a5790['hasOwnProperty'](_0x2320ae[_0x21e3a4][_0xc4f3('0x66')])){_0x46c85c[_0x9a5790[_0x2320ae[_0x21e3a4]['questionId']]]=_0x2320ae[_0x21e3a4][_0xc4f3('0x6a')];}}for(var _0x11d42c in _0x9a5790){if(!_0x46c85c[_0xc4f3('0x59')](_0x9a5790[_0x11d42c])){_0x46c85c[_0x9a5790[_0x11d42c]]=null;}}_0x16b5d2[_0xc4f3('0x6b')](_0x46c85c);}return _0x16b5d2;}})[_0xc4f3('0x26')](function(_0x40938a){if(!_[_0xc4f3('0x6c')](_0x40938a)){var _0x5be5c4=toCsv(_0x40938a);var _0xf99527=Date[_0xc4f3('0x6d')]();fs[_0xc4f3('0x6e')](util[_0xc4f3('0x68')](_0xc4f3('0x6f'),_0x35a91f[_0xc4f3('0x47')]['id'],_0xf99527),_0x5be5c4);_0x54b727['setHeader'](_0xc4f3('0x70'),'attachment;\x20filename='+util['format'](_0xc4f3('0x71'),_0x35a91f[_0xc4f3('0x47')]['id'],_0xf99527));_0x54b727[_0xc4f3('0x72')](_0xc4f3('0x73'),'text/csv');return _0x54b727['download'](util['format'](_0xc4f3('0x6f'),_0x35a91f[_0xc4f3('0x47')]['id'],_0xf99527));}else{return _0x54b727[_0xc4f3('0x1a')](0xcc);}})[_0xc4f3('0x45')](handleError(_0x54b727,null));}; \ No newline at end of file +var _0x9656=['startTime','starttime','parse','-createdAt','questionId','question','answer','push','isEmpty','now','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','path','to-csv','fs-extra','squel','crypto','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Projects','UserProfileResource','error','name','send','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','options','includeAll','include','JscriptyProject','findAll','rows','catch','show','params','rawAttributes','keys','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','update','findOne','JscriptySessionReport','ProjectId','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace'];(function(_0x3392fb,_0x5ee5cf){var _0x173e05=function(_0x5be61f){while(--_0x5be61f){_0x3392fb['push'](_0x3392fb['shift']());}};_0x173e05(++_0x5ee5cf);}(_0x9656,0x15e));var _0x6965=function(_0x48927d,_0x1289a4){_0x48927d=_0x48927d-0x0;var _0x19c12a=_0x9656[_0x48927d];return _0x19c12a;};'use strict';var emlformat=require(_0x6965('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6965('0x1'));var jsonpatch=require(_0x6965('0x2'));var rp=require('request-promise');var moment=require(_0x6965('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6965('0x4'));var sox=require('sox');var csv=require(_0x6965('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6965('0x6'));var _=require('lodash');var squel=require(_0x6965('0x7'));var crypto=require(_0x6965('0x8'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6965('0x5'));var querystring=require(_0x6965('0x9'));var Papa=require(_0x6965('0xa'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6965('0xb'));var hardwareService=require(_0x6965('0xc'));var logger=require(_0x6965('0xd'))('api');var utils=require(_0x6965('0xe'));var config=require(_0x6965('0xf'));var licenseUtil=require(_0x6965('0x10'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48a1d0,_0x396c0a){_0x396c0a=_0x396c0a||0xcc;return function(_0x585d14){if(_0x585d14){return _0x48a1d0[_0x6965('0x11')](_0x396c0a);}return _0x48a1d0[_0x6965('0x12')](_0x396c0a)[_0x6965('0x13')]();};}function respondWithResult(_0x509f01,_0x2d52d5){_0x2d52d5=_0x2d52d5||0xc8;return function(_0x209912){if(_0x209912){return _0x509f01[_0x6965('0x12')](_0x2d52d5)[_0x6965('0x14')](_0x209912);}};}function respondWithFilteredResult(_0x3777b1,_0xd759ba){return function(_0x35e280){if(_0x35e280){var _0x40e4f3=typeof _0xd759ba[_0x6965('0x15')]===_0x6965('0x16')&&typeof _0xd759ba[_0x6965('0x17')]==='undefined';var _0x17f50e=_0x35e280[_0x6965('0x18')];var _0xc31577=_0x40e4f3?0x0:_0xd759ba['offset'];var _0x31e3f5=_0x40e4f3?_0x35e280[_0x6965('0x18')]:_0xd759ba[_0x6965('0x15')]+_0xd759ba[_0x6965('0x17')];var _0x130eff;if(_0x31e3f5>=_0x17f50e){_0x31e3f5=_0x17f50e;_0x130eff=0xc8;}else{_0x130eff=0xce;}_0x3777b1['status'](_0x130eff);return _0x3777b1[_0x6965('0x19')](_0x6965('0x1a'),_0xc31577+'-'+_0x31e3f5+'/'+_0x17f50e)[_0x6965('0x14')](_0x35e280);}return null;};}function patchUpdates(_0x263adc){return function(_0x5b9561){try{jsonpatch[_0x6965('0x1b')](_0x5b9561,_0x263adc,!![]);}catch(_0x414498){return BPromise['reject'](_0x414498);}return _0x5b9561[_0x6965('0x1c')]();};}function saveUpdates(_0x213e2c,_0x19148a){return function(_0x4e5015){if(_0x4e5015){return _0x4e5015['update'](_0x213e2c)[_0x6965('0x1d')](function(_0x38fd5b){return _0x38fd5b;});}return null;};}function removeEntity(_0x416ae4,_0x47d18b){return function(_0x175585){if(_0x175585){return _0x175585[_0x6965('0x1e')]()[_0x6965('0x1d')](function(){var _0x16a64a=_0x175585[_0x6965('0x1f')]({'plain':!![]});var _0x1726bb=_0x6965('0x20');return db[_0x6965('0x21')][_0x6965('0x1e')]({'where':{'type':_0x1726bb,'resourceId':_0x16a64a['id']}})[_0x6965('0x1d')](function(){return _0x175585;});})[_0x6965('0x1d')](function(){_0x416ae4[_0x6965('0x12')](0xcc)[_0x6965('0x13')]();});}};}function handleEntityNotFound(_0x4cf5ce,_0xd2e675){return function(_0x5ab0df){if(!_0x5ab0df){_0x4cf5ce[_0x6965('0x11')](0x194);}return _0x5ab0df;};}function handleError(_0x4fa13c,_0x1ee288){_0x1ee288=_0x1ee288||0x1f4;return function(_0x1ae67e){logger[_0x6965('0x22')](_0x1ae67e['stack']);if(_0x1ae67e[_0x6965('0x23')]){delete _0x1ae67e[_0x6965('0x23')];}_0x4fa13c[_0x6965('0x12')](_0x1ee288)[_0x6965('0x24')](_0x1ae67e);};}exports['index']=function(_0x35f56b,_0x16b353){var _0x144df0={},_0x5c36e7={},_0x49c8e8={'count':0x0,'rows':[]};var _0xcbd951=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x4de646){return{'name':_0x4de646['fieldName'],'type':_0x4de646[_0x6965('0x25')]['key']};});_0x5c36e7[_0x6965('0x26')]=_[_0x6965('0x27')](_0xcbd951,'name');_0x5c36e7[_0x6965('0x28')]=_['keys'](_0x35f56b[_0x6965('0x28')]);_0x5c36e7[_0x6965('0x29')]=_[_0x6965('0x2a')](_0x5c36e7[_0x6965('0x26')],_0x5c36e7[_0x6965('0x28')]);_0x144df0[_0x6965('0x2b')]=_[_0x6965('0x2a')](_0x5c36e7[_0x6965('0x26')],qs['fields'](_0x35f56b[_0x6965('0x28')][_0x6965('0x2c')]));_0x144df0[_0x6965('0x2b')]=_0x144df0[_0x6965('0x2b')]['length']?_0x144df0[_0x6965('0x2b')]:_0x5c36e7['model'];if(!_0x35f56b['query'][_0x6965('0x2d')](_0x6965('0x2e'))){_0x144df0[_0x6965('0x17')]=qs[_0x6965('0x17')](_0x35f56b['query'][_0x6965('0x17')]);_0x144df0[_0x6965('0x15')]=qs['offset'](_0x35f56b[_0x6965('0x28')][_0x6965('0x15')]);}_0x144df0[_0x6965('0x2f')]=qs[_0x6965('0x30')](_0x35f56b[_0x6965('0x28')][_0x6965('0x30')]);_0x144df0['where']=qs['filters'](_[_0x6965('0x31')](_0x35f56b[_0x6965('0x28')],_0x5c36e7[_0x6965('0x29')]),_0xcbd951);if(_0x35f56b['query'][_0x6965('0x32')]){_0x144df0['where']=_[_0x6965('0x33')](_0x144df0[_0x6965('0x34')],{'$or':_['map'](_0xcbd951,function(_0x2cf09c){if(_0x2cf09c[_0x6965('0x25')]!=='VIRTUAL'){var _0x56ec71={};_0x56ec71[_0x2cf09c['name']]={'$like':'%'+_0x35f56b[_0x6965('0x28')][_0x6965('0x32')]+'%'};return _0x56ec71;}})});}_0x144df0=_[_0x6965('0x33')]({},_0x144df0,_0x35f56b[_0x6965('0x35')]);var _0x36d526={'where':_0x144df0[_0x6965('0x34')]};return db['JscriptyProject'][_0x6965('0x18')](_0x36d526)[_0x6965('0x1d')](function(_0x2fe229){_0x49c8e8[_0x6965('0x18')]=_0x2fe229;if(_0x35f56b['query'][_0x6965('0x36')]){_0x144df0[_0x6965('0x37')]=[{'all':!![]}];}return db[_0x6965('0x38')][_0x6965('0x39')](_0x144df0);})[_0x6965('0x1d')](function(_0x1d660b){_0x49c8e8[_0x6965('0x3a')]=_0x1d660b;return _0x49c8e8;})[_0x6965('0x1d')](respondWithFilteredResult(_0x16b353,_0x144df0))[_0x6965('0x3b')](handleError(_0x16b353,null));};exports[_0x6965('0x3c')]=function(_0x39ef02,_0xd394fe){var _0x5f3d42={'raw':![],'where':{'id':_0x39ef02[_0x6965('0x3d')]['id']}},_0x120ec5={};_0x120ec5[_0x6965('0x26')]=_['keys'](db[_0x6965('0x38')][_0x6965('0x3e')]);_0x120ec5[_0x6965('0x28')]=_[_0x6965('0x3f')](_0x39ef02[_0x6965('0x28')]);_0x120ec5['filters']=_['intersection'](_0x120ec5[_0x6965('0x26')],_0x120ec5[_0x6965('0x28')]);_0x5f3d42[_0x6965('0x2b')]=_['intersection'](_0x120ec5[_0x6965('0x26')],qs[_0x6965('0x2c')](_0x39ef02[_0x6965('0x28')][_0x6965('0x2c')]));_0x5f3d42[_0x6965('0x2b')]=_0x5f3d42[_0x6965('0x2b')][_0x6965('0x40')]?_0x5f3d42[_0x6965('0x2b')]:_0x120ec5[_0x6965('0x26')];if(_0x39ef02['query'][_0x6965('0x36')]){_0x5f3d42[_0x6965('0x37')]=[{'all':!![]}];}_0x5f3d42=_[_0x6965('0x33')]({},_0x5f3d42,_0x39ef02[_0x6965('0x35')]);return db[_0x6965('0x38')][_0x6965('0x41')](_0x5f3d42)[_0x6965('0x1d')](handleEntityNotFound(_0xd394fe,null))[_0x6965('0x1d')](respondWithResult(_0xd394fe,null))['catch'](handleError(_0xd394fe,null));};exports[_0x6965('0x42')]=function(_0x344587,_0x49f3e5){return db[_0x6965('0x38')][_0x6965('0x42')](_0x344587['body'],{})[_0x6965('0x1d')](function(_0x36aeae){var _0x30862a=_0x344587[_0x6965('0x43')][_0x6965('0x1f')]({'plain':!![]});if(!_0x30862a)throw new Error(_0x6965('0x44'));if(_0x30862a[_0x6965('0x45')]===_0x6965('0x43')){var _0xfa8f2=_0x36aeae[_0x6965('0x1f')]({'plain':!![]});var _0x33a6a4=_0x6965('0x20');return db[_0x6965('0x46')][_0x6965('0x41')]({'where':{'name':_0x33a6a4,'userProfileId':_0x30862a[_0x6965('0x47')]},'raw':!![]})['then'](function(_0x21d1b0){if(_0x21d1b0&&_0x21d1b0[_0x6965('0x48')]===0x0){return db[_0x6965('0x21')][_0x6965('0x42')]({'name':_0xfa8f2['name'],'resourceId':_0xfa8f2['id'],'type':_0x21d1b0[_0x6965('0x23')],'sectionId':_0x21d1b0['id']},{})[_0x6965('0x1d')](function(){return _0x36aeae;});}else{return _0x36aeae;}})[_0x6965('0x3b')](function(_0x27fac5){logger['error'](_0x6965('0x49'),_0x27fac5);throw _0x27fac5;});}return _0x36aeae;})[_0x6965('0x1d')](respondWithResult(_0x49f3e5,0xc9))['catch'](handleError(_0x49f3e5,null));};exports[_0x6965('0x4a')]=function(_0x1cd77b,_0x38288d){var _0x3bdd93={'where':{'id':_0x1cd77b[_0x6965('0x3d')]['id']}},_0x132154={};_0x132154[_0x6965('0x26')]=_[_0x6965('0x3f')](db[_0x6965('0x38')][_0x6965('0x3e')]);_0x3bdd93['attributes']=_[_0x6965('0x2a')](_0x132154[_0x6965('0x26')],qs[_0x6965('0x2c')](_0x1cd77b['query'][_0x6965('0x2c')]));_0x3bdd93[_0x6965('0x2b')]=_0x3bdd93['attributes'][_0x6965('0x40')]?_0x3bdd93[_0x6965('0x2b')]:_0x132154['model'];if(_0x1cd77b[_0x6965('0x28')][_0x6965('0x36')]){_0x3bdd93[_0x6965('0x37')]=[{'all':!![]}];}_0x3bdd93=_[_0x6965('0x33')]({},_0x3bdd93,_0x1cd77b[_0x6965('0x35')]);return db[_0x6965('0x38')][_0x6965('0x41')](_0x3bdd93)[_0x6965('0x1d')](handleEntityNotFound(_0x38288d,null))[_0x6965('0x1d')](function(_0x3e41b2){if(_0x3e41b2){var _0x40f055=_0x3e41b2[_0x6965('0x1f')]({'plain':!![]});_0x40f055=qs['omit'](_0x40f055,['id',_0x6965('0x4b'),_0x6965('0x4c')]);_0x1cd77b[_0x6965('0x4d')]=_[_0x6965('0x4e')](_0x1cd77b[_0x6965('0x4d')],['id',_0x6965('0x4b'),_0x6965('0x4c')]);return db['JscriptyProject']['create'](_[_0x6965('0x33')](_0x40f055,_0x1cd77b[_0x6965('0x4d')]),{'include':_0x1cd77b[_0x6965('0x28')]['includeAll']?[{'all':!![]}]:undefined})[_0x6965('0x1d')](function(_0x4ad85a){var _0x287eaf=_0x1cd77b[_0x6965('0x43')][_0x6965('0x1f')]({'plain':!![]});if(!_0x287eaf)throw new Error(_0x6965('0x44'));if(_0x287eaf[_0x6965('0x45')]==='user'){var _0x2a7985=_0x4ad85a[_0x6965('0x1f')]({'plain':!![]});var _0xbf3eea=_0x6965('0x20');return db[_0x6965('0x46')]['find']({'where':{'name':_0xbf3eea,'userProfileId':_0x287eaf[_0x6965('0x47')]},'raw':!![]})['then'](function(_0x379cd2){if(_0x379cd2&&_0x379cd2['autoAssociation']===0x0){return db['UserProfileResource'][_0x6965('0x42')]({'name':_0x2a7985[_0x6965('0x23')],'resourceId':_0x2a7985['id'],'type':_0x379cd2[_0x6965('0x23')],'sectionId':_0x379cd2['id']},{})[_0x6965('0x1d')](function(){return _0x4ad85a;});}else{return _0x4ad85a;}})[_0x6965('0x3b')](function(_0x236d5d){logger[_0x6965('0x22')](_0x6965('0x49'),_0x236d5d);throw _0x236d5d;});}return _0x4ad85a;});}})['then'](respondWithResult(_0x38288d,0xc9))[_0x6965('0x3b')](handleError(_0x38288d,null));};exports[_0x6965('0x4f')]=function(_0x4041dc,_0x50d3ec){if(_0x4041dc['body']['id']){delete _0x4041dc[_0x6965('0x4d')]['id'];}return db[_0x6965('0x38')][_0x6965('0x41')]({'where':{'id':_0x4041dc[_0x6965('0x3d')]['id']}})[_0x6965('0x1d')](handleEntityNotFound(_0x50d3ec,null))[_0x6965('0x1d')](saveUpdates(_0x4041dc['body'],null))[_0x6965('0x1d')](respondWithResult(_0x50d3ec,null))[_0x6965('0x3b')](handleError(_0x50d3ec,null));};exports[_0x6965('0x1e')]=function(_0x4732ed,_0x415d86){return db[_0x6965('0x38')][_0x6965('0x41')]({'where':{'id':_0x4732ed[_0x6965('0x3d')]['id']}})['then'](handleEntityNotFound(_0x415d86,null))[_0x6965('0x1d')](removeEntity(_0x415d86,null))[_0x6965('0x3b')](handleError(_0x415d86,null));};exports['getSessions']=function(_0x5a2e1c,_0x95470d,_0x14d347){var _0x154996={'raw':!![],'where':{}};var _0x5e7dcb={};var _0x119ee4={'count':0x0,'rows':[]};return db[_0x6965('0x38')][_0x6965('0x50')]({'where':{'id':_0x5a2e1c[_0x6965('0x3d')]['id']}})['then'](handleEntityNotFound(_0x95470d,null))[_0x6965('0x1d')](function(_0x4e0c03){if(_0x4e0c03){_0x5e7dcb[_0x6965('0x26')]=_[_0x6965('0x3f')](db[_0x6965('0x51')]['rawAttributes']);_0x5e7dcb[_0x6965('0x28')]=_[_0x6965('0x3f')](_0x5a2e1c[_0x6965('0x28')]);_0x5e7dcb[_0x6965('0x29')]=_[_0x6965('0x2a')](_0x5e7dcb[_0x6965('0x26')],_0x5e7dcb['query']);_0x154996[_0x6965('0x2b')]=_[_0x6965('0x2a')](_0x5e7dcb[_0x6965('0x26')],qs[_0x6965('0x2c')](_0x5a2e1c[_0x6965('0x28')][_0x6965('0x2c')]));_0x154996[_0x6965('0x2b')]=_0x154996[_0x6965('0x2b')][_0x6965('0x40')]?_0x154996[_0x6965('0x2b')]:_0x5e7dcb[_0x6965('0x26')];if(!_0x5a2e1c[_0x6965('0x28')][_0x6965('0x2d')]('nolimit')){_0x154996[_0x6965('0x17')]=qs[_0x6965('0x17')](_0x5a2e1c[_0x6965('0x28')][_0x6965('0x17')]);_0x154996[_0x6965('0x15')]=qs['offset'](_0x5a2e1c[_0x6965('0x28')][_0x6965('0x15')]);}_0x154996['order']=qs['sort'](_0x5a2e1c[_0x6965('0x28')]['sort']);_0x154996[_0x6965('0x34')]=qs[_0x6965('0x29')](_[_0x6965('0x31')](_0x5a2e1c[_0x6965('0x28')],_0x5e7dcb[_0x6965('0x29')]));_0x154996[_0x6965('0x34')][_0x6965('0x52')]=_0x4e0c03['id'];if(_0x5a2e1c[_0x6965('0x28')][_0x6965('0x32')]){_0x154996['where']=_[_0x6965('0x33')](_0x154996[_0x6965('0x34')],{'$or':_[_0x6965('0x27')](_0x154996['attributes'],function(_0x373c5f){var _0x3441a8={};_0x3441a8[_0x373c5f]={'$like':'%'+_0x5a2e1c[_0x6965('0x28')]['filter']+'%'};return _0x3441a8;})});}_0x154996=_['merge']({},_0x154996,_0x5a2e1c['options']);return db[_0x6965('0x51')][_0x6965('0x18')]({'where':_0x154996['where']})[_0x6965('0x1d')](function(_0x2715a5){_0x119ee4[_0x6965('0x18')]=_0x2715a5;if(_0x5a2e1c[_0x6965('0x28')]['includeAll']){_0x154996[_0x6965('0x37')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x6965('0x39')](_0x154996);})[_0x6965('0x1d')](function(_0x521d99){_0x119ee4[_0x6965('0x3a')]=_0x521d99;return _0x119ee4;});}})['then'](respondWithFilteredResult(_0x95470d,_0x154996))[_0x6965('0x3b')](handleError(_0x95470d,null));};exports[_0x6965('0x53')]=function(_0x30f797,_0x298e62,_0x39cc5b){var _0x2e12d3={'raw':!![],'where':{}};var _0x34fb79={};var _0x2bbb76={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x6965('0x50')]({'where':{'id':_0x30f797[_0x6965('0x3d')]['id']}})[_0x6965('0x1d')](handleEntityNotFound(_0x298e62,null))[_0x6965('0x1d')](function(_0x1381c4){if(_0x1381c4){_0x34fb79['model']=_[_0x6965('0x3f')](db[_0x6965('0x54')][_0x6965('0x3e')]);_0x34fb79[_0x6965('0x28')]=_[_0x6965('0x3f')](_0x30f797[_0x6965('0x28')]);_0x34fb79['filters']=_[_0x6965('0x2a')](_0x34fb79[_0x6965('0x26')],_0x34fb79[_0x6965('0x28')]);_0x2e12d3['attributes']=_['intersection'](_0x34fb79['model'],qs[_0x6965('0x2c')](_0x30f797[_0x6965('0x28')][_0x6965('0x2c')]));_0x2e12d3[_0x6965('0x2b')]=_0x2e12d3['attributes'][_0x6965('0x40')]?_0x2e12d3[_0x6965('0x2b')]:_0x34fb79['model'];if(!_0x30f797[_0x6965('0x28')]['hasOwnProperty'](_0x6965('0x2e'))){_0x2e12d3[_0x6965('0x17')]=qs[_0x6965('0x17')](_0x30f797[_0x6965('0x28')]['limit']);_0x2e12d3[_0x6965('0x15')]=qs[_0x6965('0x15')](_0x30f797[_0x6965('0x28')][_0x6965('0x15')]);}_0x2e12d3['order']=qs[_0x6965('0x30')](_0x30f797[_0x6965('0x28')]['sort']);_0x2e12d3[_0x6965('0x34')]=qs[_0x6965('0x29')](_[_0x6965('0x31')](_0x30f797[_0x6965('0x28')],_0x34fb79[_0x6965('0x29')]));_0x2e12d3['where'][_0x6965('0x52')]=_0x1381c4['id'];if(_0x30f797[_0x6965('0x28')][_0x6965('0x32')]){_0x2e12d3[_0x6965('0x34')]=_[_0x6965('0x33')](_0x2e12d3[_0x6965('0x34')],{'$or':_[_0x6965('0x27')](_0x2e12d3[_0x6965('0x2b')],function(_0x2d0b0c){var _0x326aed={};_0x326aed[_0x2d0b0c]={'$like':'%'+_0x30f797['query'][_0x6965('0x32')]+'%'};return _0x326aed;})});}_0x2e12d3=_[_0x6965('0x33')]({},_0x2e12d3,_0x30f797[_0x6965('0x35')]);return db[_0x6965('0x54')][_0x6965('0x18')]({'where':_0x2e12d3['where']})[_0x6965('0x1d')](function(_0x4548fe){_0x2bbb76['count']=_0x4548fe;if(_0x30f797[_0x6965('0x28')][_0x6965('0x36')]){_0x2e12d3['include']=[{'all':!![]}];}return db[_0x6965('0x54')][_0x6965('0x39')](_0x2e12d3);})[_0x6965('0x1d')](function(_0x1cf512){_0x2bbb76[_0x6965('0x3a')]=_0x1cf512;return _0x2bbb76;});}})['then'](respondWithFilteredResult(_0x298e62,_0x2e12d3))[_0x6965('0x3b')](handleError(_0x298e62,null));};function char(_0x3e6dc2){return _0x6965('0x55')===typeof _0x3e6dc2?String[_0x6965('0x56')]['apply'](null,arguments):_0x3e6dc2;}function needsEncapsulation(_0x5d76e1){return!!_0x5d76e1&&(_0x5d76e1[_0x6965('0x57')]()[_0x6965('0x58')](char(0xd))>=0x0||_0x5d76e1[_0x6965('0x57')]()[_0x6965('0x58')](char(0xa))>=0x0||_0x5d76e1['toString']()['indexOf'](char(0x2c))>=0x0||_0x5d76e1[_0x6965('0x57')]()[_0x6965('0x58')](char(0x22))>=0x0);}function encapsulate(_0x3c0259){var _0x4be66f=char(0x22),_0x899c3d='\x5c'+char(0x22),_0x235aee=_0x3c0259[_0x6965('0x57')]()[_0x6965('0x59')](new RegExp(_0x4be66f,'g'),_0x899c3d);return _0x4be66f+_0x235aee+_0x4be66f;}exports['getSummary']=function(_0x4715c7,_0x4f13cd,_0x246e2c){var _0x14e09b,_0x17f3a8;var _0x2573af={'where':{'ProjectId':_0x4715c7[_0x6965('0x3d')]['id']}};if(_0x4715c7[_0x6965('0x28')][_0x6965('0x5a')]){_0x2573af[_0x6965('0x34')][_0x6965('0x5b')]=JSON[_0x6965('0x5c')](_0x4715c7['query'][_0x6965('0x5a')]);}return db[_0x6965('0x51')]['findAll'](_0x2573af)[_0x6965('0x1d')](handleEntityNotFound(_0x4f13cd,null))[_0x6965('0x1d')](function(_0x2f980d){if(_0x2f980d){_0x14e09b=_0x2f980d;return db['JscriptyQuestionReport'][_0x6965('0x39')]({'where':{'SessionId':{'$in':_[_0x6965('0x27')](_0x14e09b,'id')},'ProjectId':_0x4715c7[_0x6965('0x3d')]['id']},'order':_0x6965('0x5d')});}})[_0x6965('0x1d')](handleEntityNotFound(_0x4f13cd,null))['then'](function(_0x382568){if(_0x382568){_0x17f3a8=_0x382568;var _0x3ea746={};for(var _0x2eca03=0x0,_0xccea0a=_0x17f3a8[_0x6965('0x40')];_0x2eca03<_0xccea0a;_0x2eca03++){if(!_0x3ea746[_0x6965('0x2d')](_0x17f3a8[_0x2eca03]['questionId'])){_0x3ea746[_0x17f3a8[_0x2eca03][_0x6965('0x5e')]]=needsEncapsulation(_0x17f3a8[_0x2eca03][_0x6965('0x5f')])?encapsulate(_0x17f3a8[_0x2eca03][_0x6965('0x5f')]):_0x17f3a8[_0x2eca03][_0x6965('0x5f')];}}var _0x20725f=[],_0x4e92c2={};for(var _0x42e3a3=0x0,_0xf38753=_0x14e09b[_0x6965('0x40')];_0x42e3a3<_0xf38753;_0x42e3a3++){_0x4e92c2={'ProjectId':_0x4715c7[_0x6965('0x3d')]['id'],'SessionId':_0x14e09b[_0x42e3a3]['id'],'StartTime':moment(_0x14e09b[_0x42e3a3][_0x6965('0x5b')])['format']('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x3bbab3=0x0,_0x203354=_0x17f3a8[_0x6965('0x40')];_0x3bbab3<_0x203354;_0x3bbab3++){if(_0x17f3a8[_0x3bbab3]['SessionId']==_0x14e09b[_0x42e3a3]['id']&&_0x3ea746['hasOwnProperty'](_0x17f3a8[_0x3bbab3]['questionId'])){_0x4e92c2[_0x3ea746[_0x17f3a8[_0x3bbab3][_0x6965('0x5e')]]]=_0x17f3a8[_0x3bbab3][_0x6965('0x60')];}}for(var _0xafee79 in _0x3ea746){if(!_0x4e92c2['hasOwnProperty'](_0x3ea746[_0xafee79])){_0x4e92c2[_0x3ea746[_0xafee79]]=null;}}_0x20725f[_0x6965('0x61')](_0x4e92c2);}return _0x20725f;}})['then'](function(_0x26806f){if(!_[_0x6965('0x62')](_0x26806f)){var _0x26dbda=toCsv(_0x26806f);var _0x3a8712=Date[_0x6965('0x63')]();fs[_0x6965('0x64')](util[_0x6965('0x65')](_0x6965('0x66'),_0x4715c7['params']['id'],_0x3a8712),_0x26dbda);_0x4f13cd[_0x6965('0x67')](_0x6965('0x68'),_0x6965('0x69')+util[_0x6965('0x65')](_0x6965('0x6a'),_0x4715c7['params']['id'],_0x3a8712));_0x4f13cd[_0x6965('0x67')](_0x6965('0x6b'),_0x6965('0x6c'));return _0x4f13cd[_0x6965('0x6d')](util[_0x6965('0x65')](_0x6965('0x66'),_0x4715c7[_0x6965('0x3d')]['id'],_0x3a8712));}else{return _0x4f13cd[_0x6965('0x11')](0xcc);}})[_0x6965('0x3b')](handleError(_0x4f13cd,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index aae16ea..45c5fc2 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 _0x2975=['JscriptyProject','jscripty_projects','util','../../config/logger','api','moment','bluebird','request-promise','./jscriptyProject.attributes','exports','define'];(function(_0x3740f5,_0xd5ee7b){var _0x50cb92=function(_0x4217ae){while(--_0x4217ae){_0x3740f5['push'](_0x3740f5['shift']());}};_0x50cb92(++_0xd5ee7b);}(_0x2975,0x1c5));var _0x5297=function(_0x527c98,_0xa38c15){_0x527c98=_0x527c98-0x0;var _0x9232c=_0x2975[_0x527c98];return _0x9232c;};'use strict';var _=require('lodash');var util=require(_0x5297('0x0'));var logger=require(_0x5297('0x1'))(_0x5297('0x2'));var moment=require(_0x5297('0x3'));var BPromise=require(_0x5297('0x4'));var rp=require(_0x5297('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5297('0x6'));module[_0x5297('0x7')]=function(_0x11a43d,_0x3da9c6){return _0x11a43d[_0x5297('0x8')](_0x5297('0x9'),attributes,{'tableName':_0x5297('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2f1=['path','./jscriptyProject.attributes','exports','jscripty_projects','lodash','util','api','moment','request-promise'];(function(_0x2e3bf5,_0x3c61ca){var _0x37500e=function(_0x1977fe){while(--_0x1977fe){_0x2e3bf5['push'](_0x2e3bf5['shift']());}};_0x37500e(++_0x3c61ca);}(_0xb2f1,0xee));var _0x1b2f=function(_0x424203,_0x451677){_0x424203=_0x424203-0x0;var _0x5041d6=_0xb2f1[_0x424203];return _0x5041d6;};'use strict';var _=require(_0x1b2f('0x0'));var util=require(_0x1b2f('0x1'));var logger=require('../../config/logger')(_0x1b2f('0x2'));var moment=require(_0x1b2f('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b2f('0x4'));var fs=require('fs');var path=require(_0x1b2f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1b2f('0x6'));module[_0x1b2f('0x7')]=function(_0xad728b,_0x4326ba){return _0xad728b['define']('JscriptyProject',attributes,{'tableName':_0x1b2f('0x8'),'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 a486b89..6d67007 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1d6096,_0x1f4c9e){var _0x2c887f=function(_0x3626fb){while(--_0x3626fb){_0x1d6096['push'](_0x1d6096['shift']());}};_0x2c887f(++_0x1f4c9e);}(_0xf4eb,0xec));var _0xbf4e=function(_0x4619e2,_0x1008bf){_0x4619e2=_0x4619e2-0x0;var _0x1e1907=_0xf4eb[_0x4619e2];return _0x1e1907;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x1bdc45,_0x3000d2){var _0x5b6fc4=function(_0x5dd2ac){while(--_0x5dd2ac){_0x1bdc45['push'](_0x1bdc45['shift']());}};_0x5b6fc4(++_0x3000d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index a66b5e0..89a2f86 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 _0x111c=['post','create','/:id','update','delete','destroy','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','/describe','isAuthenticated','describe','show'];(function(_0x57256d,_0x3d8688){var _0x2c25da=function(_0x103485){while(--_0x103485){_0x57256d['push'](_0x57256d['shift']());}};_0x2c25da(++_0x3d8688);}(_0x111c,0x11f));var _0xc111=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x111c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0xc111('0x0'));var util=require(_0xc111('0x1'));var path=require(_0xc111('0x2'));var timeout=require('connect-timeout');var express=require(_0xc111('0x3'));var router=express[_0xc111('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc111('0x5'));var config=require(_0xc111('0x6'));var controller=require(_0xc111('0x7'));router[_0xc111('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc111('0x8')](_0xc111('0x9'),auth[_0xc111('0xa')](),controller[_0xc111('0xb')]);router[_0xc111('0x8')]('/:id',auth[_0xc111('0xa')](),controller[_0xc111('0xc')]);router[_0xc111('0xd')]('/',auth['isAuthenticated'](),controller[_0xc111('0xe')]);router['put'](_0xc111('0xf'),auth[_0xc111('0xa')](),controller[_0xc111('0x10')]);router[_0xc111('0x11')](_0xc111('0xf'),auth['isAuthenticated'](),controller[_0xc111('0x12')]);module[_0xc111('0x13')]=router; \ No newline at end of file +var _0xcae9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','get','/describe','/:id','show','create','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4d45c1,_0x2beda1){var _0x244478=function(_0x11304c){while(--_0x11304c){_0x4d45c1['push'](_0x4d45c1['shift']());}};_0x244478(++_0x2beda1);}(_0xcae9,0xff));var _0x9cae=function(_0x5e848d,_0x1dbd20){_0x5e848d=_0x5e848d-0x0;var _0x3785e5=_0xcae9[_0x5e848d];return _0x3785e5;};'use strict';var multer=require(_0x9cae('0x0'));var util=require(_0x9cae('0x1'));var path=require(_0x9cae('0x2'));var timeout=require(_0x9cae('0x3'));var express=require(_0x9cae('0x4'));var router=express[_0x9cae('0x5')]();var fs_extra=require(_0x9cae('0x6'));var auth=require(_0x9cae('0x7'));var interaction=require(_0x9cae('0x8'));var config=require(_0x9cae('0x9'));var controller=require(_0x9cae('0xa'));router['get']('/',auth[_0x9cae('0xb')](),controller['index']);router[_0x9cae('0xc')](_0x9cae('0xd'),auth[_0x9cae('0xb')](),controller['describe']);router[_0x9cae('0xc')](_0x9cae('0xe'),auth[_0x9cae('0xb')](),controller[_0x9cae('0xf')]);router['post']('/',auth[_0x9cae('0xb')](),controller[_0x9cae('0x10')]);router['put'](_0x9cae('0xe'),auth['isAuthenticated'](),controller[_0x9cae('0x11')]);router[_0x9cae('0x12')](_0x9cae('0xe'),auth[_0x9cae('0xb')](),controller['destroy']);module[_0x9cae('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 cb29427..2acac64 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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x4550af,_0x28805c){_0x4550af=_0x4550af-0x0;var _0xf7a79d=_0x7a54[_0x4550af];return _0xf7a79d;};'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(_0x35885a,_0x42fed7){var _0xe86249=function(_0x98edb3){while(--_0x98edb3){_0x35885a['push'](_0x35885a['shift']());}};_0xe86249(++_0x42fed7);}(_0x7a54,0x106));var _0x47a5=function(_0x32fb85,_0x41a63b){_0x32fb85=_0x32fb85-0x0;var _0x579f52=_0x7a54[_0x32fb85];return _0x579f52;};'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 d1b0705..5f0e4ef 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 _0x7522=['describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','update','destroy','then','stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','find','catch','create','body'];(function(_0x282ccc,_0x5d66a1){var _0x27c2dd=function(_0x58431a){while(--_0x58431a){_0x282ccc['push'](_0x282ccc['shift']());}};_0x27c2dd(++_0x5d66a1);}(_0x7522,0x1cf));var _0x2752=function(_0x272d0e,_0x564bae){_0x272d0e=_0x272d0e-0x0;var _0x1414a6=_0x7522[_0x272d0e];return _0x1414a6;};'use strict';var emlformat=require(_0x2752('0x0'));var rimraf=require(_0x2752('0x1'));var zipdir=require(_0x2752('0x2'));var jsonpatch=require(_0x2752('0x3'));var rp=require('request-promise');var moment=require(_0x2752('0x4'));var BPromise=require(_0x2752('0x5'));var Mustache=require(_0x2752('0x6'));var util=require(_0x2752('0x7'));var path=require(_0x2752('0x8'));var sox=require(_0x2752('0x9'));var csv=require('to-csv');var ejs=require(_0x2752('0xa'));var fs=require('fs');var fs_extra=require(_0x2752('0xb'));var _=require(_0x2752('0xc'));var squel=require(_0x2752('0xd'));var crypto=require('crypto');var jsforce=require(_0x2752('0xe'));var deskjs=require(_0x2752('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2752('0x10'));var Papa=require(_0x2752('0x11'));var Redis=require(_0x2752('0x12'));var authService=require(_0x2752('0x13'));var qs=require(_0x2752('0x14'));var as=require(_0x2752('0x15'));var hardwareService=require(_0x2752('0x16'));var logger=require(_0x2752('0x17'))(_0x2752('0x18'));var utils=require(_0x2752('0x19'));var config=require(_0x2752('0x1a'));var licenseUtil=require(_0x2752('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44c0d1,_0x351995){_0x351995=_0x351995||0xcc;return function(_0x22ab93){if(_0x22ab93){return _0x44c0d1[_0x2752('0x1c')](_0x351995);}return _0x44c0d1[_0x2752('0x1d')](_0x351995)[_0x2752('0x1e')]();};}function respondWithResult(_0x3e2078,_0x1010ea){_0x1010ea=_0x1010ea||0xc8;return function(_0x2a00a6){if(_0x2a00a6){return _0x3e2078[_0x2752('0x1d')](_0x1010ea)[_0x2752('0x1f')](_0x2a00a6);}};}function respondWithFilteredResult(_0xa0a1fd,_0x47f372){return function(_0x558350){if(_0x558350){var _0x4d19cd=typeof _0x47f372['offset']===_0x2752('0x20')&&typeof _0x47f372[_0x2752('0x21')]===_0x2752('0x20');var _0x499ace=_0x558350[_0x2752('0x22')];var _0x2b3998=_0x4d19cd?0x0:_0x47f372[_0x2752('0x23')];var _0x8355c2=_0x4d19cd?_0x558350['count']:_0x47f372[_0x2752('0x23')]+_0x47f372[_0x2752('0x21')];var _0x59c56f;if(_0x8355c2>=_0x499ace){_0x8355c2=_0x499ace;_0x59c56f=0xc8;}else{_0x59c56f=0xce;}_0xa0a1fd[_0x2752('0x1d')](_0x59c56f);return _0xa0a1fd[_0x2752('0x24')]('Content-Range',_0x2b3998+'-'+_0x8355c2+'/'+_0x499ace)['json'](_0x558350);}return null;};}function patchUpdates(_0x57815b){return function(_0x24c397){try{jsonpatch[_0x2752('0x25')](_0x24c397,_0x57815b,!![]);}catch(_0x28af9c){return BPromise['reject'](_0x28af9c);}return _0x24c397['save']();};}function saveUpdates(_0x55f49b,_0x3d2bb7){return function(_0x16266c){if(_0x16266c){return _0x16266c[_0x2752('0x26')](_0x55f49b)['then'](function(_0x57782c){return _0x57782c;});}return null;};}function removeEntity(_0x46723e,_0x5281e7){return function(_0x390a65){if(_0x390a65){return _0x390a65[_0x2752('0x27')]()[_0x2752('0x28')](function(){_0x46723e[_0x2752('0x1d')](0xcc)[_0x2752('0x1e')]();});}};}function handleEntityNotFound(_0x58ae3f,_0x51d947){return function(_0x358e78){if(!_0x358e78){_0x58ae3f[_0x2752('0x1c')](0x194);}return _0x358e78;};}function handleError(_0x414363,_0x3f6c81){_0x3f6c81=_0x3f6c81||0x1f4;return function(_0x3b1e7b){logger['error'](_0x3b1e7b[_0x2752('0x29')]);if(_0x3b1e7b[_0x2752('0x2a')]){delete _0x3b1e7b[_0x2752('0x2a')];}_0x414363['status'](_0x3f6c81)['send'](_0x3b1e7b);};}exports[_0x2752('0x2b')]=function(_0x555683,_0x291d89){var _0x54534b={},_0x1c039f={},_0x1ee201={'count':0x0,'rows':[]};var _0x4de130=_[_0x2752('0x2c')](db[_0x2752('0x2d')]['rawAttributes'],function(_0xe08309){return{'name':_0xe08309[_0x2752('0x2e')],'type':_0xe08309[_0x2752('0x2f')][_0x2752('0x30')]};});_0x1c039f[_0x2752('0x31')]=_[_0x2752('0x2c')](_0x4de130,_0x2752('0x2a'));_0x1c039f[_0x2752('0x32')]=_[_0x2752('0x33')](_0x555683[_0x2752('0x32')]);_0x1c039f['filters']=_[_0x2752('0x34')](_0x1c039f[_0x2752('0x31')],_0x1c039f[_0x2752('0x32')]);_0x54534b[_0x2752('0x35')]=_[_0x2752('0x34')](_0x1c039f['model'],qs['fields'](_0x555683[_0x2752('0x32')][_0x2752('0x36')]));_0x54534b['attributes']=_0x54534b[_0x2752('0x35')][_0x2752('0x37')]?_0x54534b[_0x2752('0x35')]:_0x1c039f['model'];if(!_0x555683[_0x2752('0x32')][_0x2752('0x38')](_0x2752('0x39'))){_0x54534b['limit']=qs[_0x2752('0x21')](_0x555683[_0x2752('0x32')][_0x2752('0x21')]);_0x54534b[_0x2752('0x23')]=qs['offset'](_0x555683[_0x2752('0x32')][_0x2752('0x23')]);}_0x54534b[_0x2752('0x3a')]=qs['sort'](_0x555683['query'][_0x2752('0x3b')]);_0x54534b[_0x2752('0x3c')]=qs[_0x2752('0x3d')](_[_0x2752('0x3e')](_0x555683[_0x2752('0x32')],_0x1c039f['filters']),_0x4de130);if(_0x555683['query'][_0x2752('0x3f')]){_0x54534b['where']=_[_0x2752('0x40')](_0x54534b['where'],{'$or':_[_0x2752('0x2c')](_0x4de130,function(_0x3cb4f6){if(_0x3cb4f6['type']!==_0x2752('0x41')){var _0x33db06={};_0x33db06[_0x3cb4f6[_0x2752('0x2a')]]={'$like':'%'+_0x555683[_0x2752('0x32')]['filter']+'%'};return _0x33db06;}})});}_0x54534b=_[_0x2752('0x40')]({},_0x54534b,_0x555683[_0x2752('0x42')]);var _0x5aeb3e={'where':_0x54534b[_0x2752('0x3c')]};return db['JscriptyQuestionReport']['count'](_0x5aeb3e)['then'](function(_0x5cdd16){_0x1ee201[_0x2752('0x22')]=_0x5cdd16;if(_0x555683[_0x2752('0x32')][_0x2752('0x43')]){_0x54534b[_0x2752('0x44')]=[{'all':!![]}];}return db[_0x2752('0x2d')]['findAll'](_0x54534b);})[_0x2752('0x28')](function(_0x40efba){_0x1ee201[_0x2752('0x45')]=_0x40efba;return _0x1ee201;})[_0x2752('0x28')](respondWithFilteredResult(_0x291d89,_0x54534b))['catch'](handleError(_0x291d89,null));};exports['show']=function(_0x2552a8,_0x5ceb95){var _0x5c042d={'raw':!![],'where':{'id':_0x2552a8[_0x2752('0x46')]['id']}},_0x5d3306={};_0x5d3306[_0x2752('0x31')]=_[_0x2752('0x33')](db[_0x2752('0x2d')][_0x2752('0x47')]);_0x5d3306[_0x2752('0x32')]=_[_0x2752('0x33')](_0x2552a8[_0x2752('0x32')]);_0x5d3306[_0x2752('0x3d')]=_[_0x2752('0x34')](_0x5d3306[_0x2752('0x31')],_0x5d3306['query']);_0x5c042d['attributes']=_[_0x2752('0x34')](_0x5d3306[_0x2752('0x31')],qs[_0x2752('0x36')](_0x2552a8[_0x2752('0x32')][_0x2752('0x36')]));_0x5c042d[_0x2752('0x35')]=_0x5c042d[_0x2752('0x35')]['length']?_0x5c042d[_0x2752('0x35')]:_0x5d3306[_0x2752('0x31')];if(_0x2552a8[_0x2752('0x32')][_0x2752('0x43')]){_0x5c042d[_0x2752('0x44')]=[{'all':!![]}];}_0x5c042d=_[_0x2752('0x40')]({},_0x5c042d,_0x2552a8['options']);return db[_0x2752('0x2d')][_0x2752('0x48')](_0x5c042d)['then'](handleEntityNotFound(_0x5ceb95,null))[_0x2752('0x28')](respondWithResult(_0x5ceb95,null))[_0x2752('0x49')](handleError(_0x5ceb95,null));};exports[_0x2752('0x4a')]=function(_0x5aa0b7,_0x5e05d1){return db['JscriptyQuestionReport']['create'](_0x5aa0b7['body'],{})[_0x2752('0x28')](respondWithResult(_0x5e05d1,0xc9))[_0x2752('0x49')](handleError(_0x5e05d1,null));};exports[_0x2752('0x26')]=function(_0x42746a,_0x480317){if(_0x42746a[_0x2752('0x4b')]['id']){delete _0x42746a[_0x2752('0x4b')]['id'];}return db['JscriptyQuestionReport']['find']({'where':{'id':_0x42746a['params']['id']}})['then'](handleEntityNotFound(_0x480317,null))['then'](saveUpdates(_0x42746a[_0x2752('0x4b')],null))[_0x2752('0x28')](respondWithResult(_0x480317,null))[_0x2752('0x49')](handleError(_0x480317,null));};exports['destroy']=function(_0x3765b1,_0x434a40){return db[_0x2752('0x2d')][_0x2752('0x48')]({'where':{'id':_0x3765b1[_0x2752('0x46')]['id']}})[_0x2752('0x28')](handleEntityNotFound(_0x434a40,null))[_0x2752('0x28')](removeEntity(_0x434a40,null))[_0x2752('0x49')](handleError(_0x434a40,null));};exports[_0x2752('0x4c')]=function(_0x3cd935,_0x2395ee){return db[_0x2752('0x2d')][_0x2752('0x4c')]()[_0x2752('0x28')](respondWithResult(_0x2395ee,null))['catch'](handleError(_0x2395ee,null));}; \ No newline at end of file +var _0x40ac=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','JscriptyQuestionReport','includeAll','include','rows','fields','length','find','catch','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x2a060a,_0x5b2802){var _0x48f8ca=function(_0x19f91a){while(--_0x19f91a){_0x2a060a['push'](_0x2a060a['shift']());}};_0x48f8ca(++_0x5b2802);}(_0x40ac,0x8d));var _0xc40a=function(_0x444975,_0x44aaf0){_0x444975=_0x444975-0x0;var _0x45cc12=_0x40ac[_0x444975];return _0x45cc12;};'use strict';var emlformat=require(_0xc40a('0x0'));var rimraf=require(_0xc40a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc40a('0x2'));var rp=require(_0xc40a('0x3'));var moment=require(_0xc40a('0x4'));var BPromise=require(_0xc40a('0x5'));var Mustache=require(_0xc40a('0x6'));var util=require(_0xc40a('0x7'));var path=require(_0xc40a('0x8'));var sox=require('sox');var csv=require(_0xc40a('0x9'));var ejs=require(_0xc40a('0xa'));var fs=require('fs');var fs_extra=require(_0xc40a('0xb'));var _=require(_0xc40a('0xc'));var squel=require(_0xc40a('0xd'));var crypto=require('crypto');var jsforce=require(_0xc40a('0xe'));var deskjs=require(_0xc40a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc40a('0x10'));var Papa=require('papaparse');var Redis=require(_0xc40a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc40a('0x12'));var as=require(_0xc40a('0x13'));var hardwareService=require(_0xc40a('0x14'));var logger=require(_0xc40a('0x15'))(_0xc40a('0x16'));var utils=require(_0xc40a('0x17'));var config=require(_0xc40a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc40a('0x19'))['db'];function respondWithStatusCode(_0x1c03fd,_0x20612f){_0x20612f=_0x20612f||0xcc;return function(_0x24feb3){if(_0x24feb3){return _0x1c03fd['sendStatus'](_0x20612f);}return _0x1c03fd[_0xc40a('0x1a')](_0x20612f)['end']();};}function respondWithResult(_0x4030c1,_0x407c80){_0x407c80=_0x407c80||0xc8;return function(_0x25cc5f){if(_0x25cc5f){return _0x4030c1[_0xc40a('0x1a')](_0x407c80)[_0xc40a('0x1b')](_0x25cc5f);}};}function respondWithFilteredResult(_0xd3ca8d,_0x3741a3){return function(_0xded995){if(_0xded995){var _0x555ae1=typeof _0x3741a3[_0xc40a('0x1c')]===_0xc40a('0x1d')&&typeof _0x3741a3[_0xc40a('0x1e')]==='undefined';var _0x575a4c=_0xded995[_0xc40a('0x1f')];var _0x3dfff4=_0x555ae1?0x0:_0x3741a3[_0xc40a('0x1c')];var _0x3a6446=_0x555ae1?_0xded995[_0xc40a('0x1f')]:_0x3741a3['offset']+_0x3741a3[_0xc40a('0x1e')];var _0x305def;if(_0x3a6446>=_0x575a4c){_0x3a6446=_0x575a4c;_0x305def=0xc8;}else{_0x305def=0xce;}_0xd3ca8d[_0xc40a('0x1a')](_0x305def);return _0xd3ca8d[_0xc40a('0x20')]('Content-Range',_0x3dfff4+'-'+_0x3a6446+'/'+_0x575a4c)[_0xc40a('0x1b')](_0xded995);}return null;};}function patchUpdates(_0x1848cc){return function(_0x27eeb8){try{jsonpatch[_0xc40a('0x21')](_0x27eeb8,_0x1848cc,!![]);}catch(_0x4cc4f1){return BPromise[_0xc40a('0x22')](_0x4cc4f1);}return _0x27eeb8[_0xc40a('0x23')]();};}function saveUpdates(_0x562ade,_0x3e923a){return function(_0x2dfb83){if(_0x2dfb83){return _0x2dfb83[_0xc40a('0x24')](_0x562ade)[_0xc40a('0x25')](function(_0x1750eb){return _0x1750eb;});}return null;};}function removeEntity(_0x11a309,_0x286979){return function(_0x3b24d0){if(_0x3b24d0){return _0x3b24d0['destroy']()[_0xc40a('0x25')](function(){_0x11a309['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x33cc4c,_0x3f013e){return function(_0x1570c0){if(!_0x1570c0){_0x33cc4c['sendStatus'](0x194);}return _0x1570c0;};}function handleError(_0x41a441,_0x47113e){_0x47113e=_0x47113e||0x1f4;return function(_0x40379e){logger['error'](_0x40379e['stack']);if(_0x40379e[_0xc40a('0x26')]){delete _0x40379e['name'];}_0x41a441['status'](_0x47113e)[_0xc40a('0x27')](_0x40379e);};}exports[_0xc40a('0x28')]=function(_0x181ef3,_0x2599de){var _0x4c7c3a={},_0x2aa21e={},_0x1722d3={'count':0x0,'rows':[]};var _0x3019bb=_[_0xc40a('0x29')](db['JscriptyQuestionReport'][_0xc40a('0x2a')],function(_0x2ee747){return{'name':_0x2ee747[_0xc40a('0x2b')],'type':_0x2ee747[_0xc40a('0x2c')][_0xc40a('0x2d')]};});_0x2aa21e[_0xc40a('0x2e')]=_[_0xc40a('0x29')](_0x3019bb,'name');_0x2aa21e[_0xc40a('0x2f')]=_[_0xc40a('0x30')](_0x181ef3[_0xc40a('0x2f')]);_0x2aa21e[_0xc40a('0x31')]=_[_0xc40a('0x32')](_0x2aa21e[_0xc40a('0x2e')],_0x2aa21e[_0xc40a('0x2f')]);_0x4c7c3a[_0xc40a('0x33')]=_[_0xc40a('0x32')](_0x2aa21e[_0xc40a('0x2e')],qs['fields'](_0x181ef3[_0xc40a('0x2f')]['fields']));_0x4c7c3a[_0xc40a('0x33')]=_0x4c7c3a['attributes']['length']?_0x4c7c3a[_0xc40a('0x33')]:_0x2aa21e[_0xc40a('0x2e')];if(!_0x181ef3[_0xc40a('0x2f')][_0xc40a('0x34')](_0xc40a('0x35'))){_0x4c7c3a[_0xc40a('0x1e')]=qs['limit'](_0x181ef3[_0xc40a('0x2f')][_0xc40a('0x1e')]);_0x4c7c3a[_0xc40a('0x1c')]=qs[_0xc40a('0x1c')](_0x181ef3['query'][_0xc40a('0x1c')]);}_0x4c7c3a[_0xc40a('0x36')]=qs[_0xc40a('0x37')](_0x181ef3[_0xc40a('0x2f')][_0xc40a('0x37')]);_0x4c7c3a[_0xc40a('0x38')]=qs[_0xc40a('0x31')](_[_0xc40a('0x39')](_0x181ef3['query'],_0x2aa21e[_0xc40a('0x31')]),_0x3019bb);if(_0x181ef3[_0xc40a('0x2f')][_0xc40a('0x3a')]){_0x4c7c3a[_0xc40a('0x38')]=_[_0xc40a('0x3b')](_0x4c7c3a[_0xc40a('0x38')],{'$or':_['map'](_0x3019bb,function(_0x2c03ca){if(_0x2c03ca[_0xc40a('0x2c')]!==_0xc40a('0x3c')){var _0x544431={};_0x544431[_0x2c03ca['name']]={'$like':'%'+_0x181ef3['query'][_0xc40a('0x3a')]+'%'};return _0x544431;}})});}_0x4c7c3a=_['merge']({},_0x4c7c3a,_0x181ef3[_0xc40a('0x3d')]);var _0x2b7f4b={'where':_0x4c7c3a[_0xc40a('0x38')]};return db[_0xc40a('0x3e')][_0xc40a('0x1f')](_0x2b7f4b)[_0xc40a('0x25')](function(_0x4e148d){_0x1722d3[_0xc40a('0x1f')]=_0x4e148d;if(_0x181ef3[_0xc40a('0x2f')][_0xc40a('0x3f')]){_0x4c7c3a[_0xc40a('0x40')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x4c7c3a);})[_0xc40a('0x25')](function(_0x4dcad3){_0x1722d3[_0xc40a('0x41')]=_0x4dcad3;return _0x1722d3;})[_0xc40a('0x25')](respondWithFilteredResult(_0x2599de,_0x4c7c3a))['catch'](handleError(_0x2599de,null));};exports['show']=function(_0x2b447a,_0x13e223){var _0x344035={'raw':!![],'where':{'id':_0x2b447a['params']['id']}},_0x16ecdb={};_0x16ecdb[_0xc40a('0x2e')]=_[_0xc40a('0x30')](db[_0xc40a('0x3e')][_0xc40a('0x2a')]);_0x16ecdb[_0xc40a('0x2f')]=_[_0xc40a('0x30')](_0x2b447a[_0xc40a('0x2f')]);_0x16ecdb[_0xc40a('0x31')]=_['intersection'](_0x16ecdb[_0xc40a('0x2e')],_0x16ecdb[_0xc40a('0x2f')]);_0x344035[_0xc40a('0x33')]=_[_0xc40a('0x32')](_0x16ecdb[_0xc40a('0x2e')],qs[_0xc40a('0x42')](_0x2b447a[_0xc40a('0x2f')]['fields']));_0x344035[_0xc40a('0x33')]=_0x344035[_0xc40a('0x33')][_0xc40a('0x43')]?_0x344035[_0xc40a('0x33')]:_0x16ecdb[_0xc40a('0x2e')];if(_0x2b447a['query'][_0xc40a('0x3f')]){_0x344035[_0xc40a('0x40')]=[{'all':!![]}];}_0x344035=_['merge']({},_0x344035,_0x2b447a[_0xc40a('0x3d')]);return db[_0xc40a('0x3e')][_0xc40a('0x44')](_0x344035)[_0xc40a('0x25')](handleEntityNotFound(_0x13e223,null))[_0xc40a('0x25')](respondWithResult(_0x13e223,null))[_0xc40a('0x45')](handleError(_0x13e223,null));};exports['create']=function(_0x27cbf0,_0x174b6f){return db[_0xc40a('0x3e')][_0xc40a('0x46')](_0x27cbf0[_0xc40a('0x47')],{})[_0xc40a('0x25')](respondWithResult(_0x174b6f,0xc9))[_0xc40a('0x45')](handleError(_0x174b6f,null));};exports[_0xc40a('0x24')]=function(_0x186d45,_0x4c79ea){if(_0x186d45[_0xc40a('0x47')]['id']){delete _0x186d45[_0xc40a('0x47')]['id'];}return db[_0xc40a('0x3e')][_0xc40a('0x44')]({'where':{'id':_0x186d45[_0xc40a('0x48')]['id']}})[_0xc40a('0x25')](handleEntityNotFound(_0x4c79ea,null))[_0xc40a('0x25')](saveUpdates(_0x186d45[_0xc40a('0x47')],null))[_0xc40a('0x25')](respondWithResult(_0x4c79ea,null))[_0xc40a('0x45')](handleError(_0x4c79ea,null));};exports[_0xc40a('0x49')]=function(_0x1d4659,_0x367973){return db[_0xc40a('0x3e')][_0xc40a('0x44')]({'where':{'id':_0x1d4659[_0xc40a('0x48')]['id']}})['then'](handleEntityNotFound(_0x367973,null))[_0xc40a('0x25')](removeEntity(_0x367973,null))[_0xc40a('0x45')](handleError(_0x367973,null));};exports[_0xc40a('0x4a')]=function(_0xe3b405,_0x39617a){return db[_0xc40a('0x3e')][_0xc40a('0x4a')]()[_0xc40a('0x25')](respondWithResult(_0x39617a,null))[_0xc40a('0x45')](handleError(_0x39617a,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index b9dadc3..8aca55b 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 _0x571a=['request-promise','rimraf','../../config/environment','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf0bdc7,_0x26888e){var _0x3dcae1=function(_0x13db5d){while(--_0x13db5d){_0xf0bdc7['push'](_0xf0bdc7['shift']());}};_0x3dcae1(++_0x26888e);}(_0x571a,0x132));var _0xa571=function(_0x120777,_0x544b3a){_0x120777=_0x120777-0x0;var _0x15cebd=_0x571a[_0x120777];return _0x15cebd;};'use strict';var _=require(_0xa571('0x0'));var util=require(_0xa571('0x1'));var logger=require(_0xa571('0x2'))(_0xa571('0x3'));var moment=require(_0xa571('0x4'));var BPromise=require(_0xa571('0x5'));var rp=require(_0xa571('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa571('0x7'));var config=require(_0xa571('0x8'));var attributes=require('./jscriptyQuestionReport.attributes');module[_0xa571('0x9')]=function(_0x3d780c,_0x15f54c){return _0x3d780c[_0xa571('0xa')](_0xa571('0xb'),attributes,{'tableName':_0xa571('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17f8=['rimraf','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x17f8,0x14f));var _0x817f=function(_0x20099a,_0x2bf584){_0x20099a=_0x20099a-0x0;var _0x2c3649=_0x17f8[_0x20099a];return _0x2c3649;};'use strict';var _=require(_0x817f('0x0'));var util=require('util');var logger=require(_0x817f('0x1'))(_0x817f('0x2'));var moment=require(_0x817f('0x3'));var BPromise=require('bluebird');var rp=require(_0x817f('0x4'));var fs=require('fs');var path=require(_0x817f('0x5'));var rimraf=require(_0x817f('0x6'));var config=require('../../config/environment');var attributes=require('./jscriptyQuestionReport.attributes');module[_0x817f('0x7')]=function(_0x47d82a,_0x6e7d48){return _0x47d82a[_0x817f('0x8')](_0x817f('0x9'),attributes,{'tableName':_0x817f('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 6fba710..aa50ad7 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 _0x5419=['debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','JscriptyQuestionReport,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0x5419,0x18f));var _0x9541=function(_0x1cbba9,_0x477bf5){_0x1cbba9=_0x1cbba9-0x0;var _0x14c91d=_0x5419[_0x1cbba9];return _0x14c91d;};'use strict';var _=require(_0x9541('0x0'));var util=require(_0x9541('0x1'));var moment=require('moment');var BPromise=require(_0x9541('0x2'));var rs=require(_0x9541('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9541('0x4'))['db'];var utils=require(_0x9541('0x5'));var logger=require(_0x9541('0x6'))('rpc');var config=require(_0x9541('0x7'));var jayson=require(_0x9541('0x8'));var client=jayson[_0x9541('0x9')][_0x9541('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2d87ed,_0x423fe0,_0x227c2d){return new BPromise(function(_0xc36bc,_0x73b75e){return client[_0x9541('0xb')](_0x2d87ed,_0x227c2d)[_0x9541('0xc')](function(_0x35fc7f){logger[_0x9541('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x423fe0,_0x9541('0xe'));logger[_0x9541('0xf')](_0x9541('0x10'),_0x423fe0,_0x9541('0xe'),JSON[_0x9541('0x11')](_0x35fc7f));if(_0x35fc7f['error']){if(_0x35fc7f['error'][_0x9541('0x12')]===0x1f4){logger[_0x9541('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x423fe0,_0x35fc7f[_0x9541('0x13')]['message']);return _0x73b75e(_0x35fc7f[_0x9541('0x13')]['message']);}logger[_0x9541('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x423fe0,_0x35fc7f[_0x9541('0x13')]['message']);return _0xc36bc(_0x35fc7f[_0x9541('0x13')][_0x9541('0x14')]);}else{logger['info'](_0x9541('0x15'),_0x423fe0,_0x9541('0xe'));_0xc36bc(_0x35fc7f['result'][_0x9541('0x14')]);}})[_0x9541('0x16')](function(_0x585575){logger[_0x9541('0x13')](_0x9541('0x15'),_0x423fe0,_0x585575);_0x73b75e(_0x585575);});});} \ No newline at end of file +var _0x5f53=['error','code','message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','request\x20sent','stringify'];(function(_0x21ac05,_0x3d1795){var _0x15a91d=function(_0x23a23b){while(--_0x23a23b){_0x21ac05['push'](_0x21ac05['shift']());}};_0x15a91d(++_0x3d1795);}(_0x5f53,0x156));var _0x35f5=function(_0x54b56d,_0x43cee0){_0x54b56d=_0x54b56d-0x0;var _0x29e581=_0x5f53[_0x54b56d];return _0x29e581;};'use strict';var _=require(_0x35f5('0x0'));var util=require(_0x35f5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x35f5('0x2'));var fs=require('fs');var Redis=require(_0x35f5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x35f5('0x4'));var logger=require(_0x35f5('0x5'))(_0x35f5('0x6'));var config=require(_0x35f5('0x7'));var jayson=require(_0x35f5('0x8'));var client=jayson['client'][_0x35f5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f285e,_0x211728,_0x5ef8b9){return new BPromise(function(_0x4568d8,_0x367957){return client[_0x35f5('0xa')](_0x2f285e,_0x5ef8b9)['then'](function(_0x33002){logger[_0x35f5('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211728,'request\x20sent');logger[_0x35f5('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x211728,_0x35f5('0xd'),JSON[_0x35f5('0xe')](_0x33002));if(_0x33002[_0x35f5('0xf')]){if(_0x33002[_0x35f5('0xf')][_0x35f5('0x10')]===0x1f4){logger[_0x35f5('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x211728,_0x33002[_0x35f5('0xf')][_0x35f5('0x11')]);return _0x367957(_0x33002['error'][_0x35f5('0x11')]);}logger[_0x35f5('0xf')](_0x35f5('0x12'),_0x211728,_0x33002[_0x35f5('0xf')][_0x35f5('0x11')]);return _0x4568d8(_0x33002[_0x35f5('0xf')][_0x35f5('0x11')]);}else{logger[_0x35f5('0xb')](_0x35f5('0x12'),_0x211728,_0x35f5('0xd'));_0x4568d8(_0x33002[_0x35f5('0x13')][_0x35f5('0x11')]);}})[_0x35f5('0x14')](function(_0x191855){logger[_0x35f5('0xf')](_0x35f5('0x12'),_0x211728,_0x191855);_0x367957(_0x191855);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 9413ad1..77d1f23 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 _0x4f18=['/:id','update','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./jscriptySessionReport.controller','get','index','/describe','describe','isAuthenticated','show','/:id/questions','getQuestions','create','put'];(function(_0x566a02,_0x2d2d0e){var _0x268b19=function(_0x3952c8){while(--_0x3952c8){_0x566a02['push'](_0x566a02['shift']());}};_0x268b19(++_0x2d2d0e);}(_0x4f18,0x6c));var _0x84f1=function(_0x429fba,_0x5591cd){_0x429fba=_0x429fba-0x0;var _0x4a56ae=_0x4f18[_0x429fba];return _0x4a56ae;};'use strict';var multer=require(_0x84f1('0x0'));var util=require(_0x84f1('0x1'));var path=require('path');var timeout=require(_0x84f1('0x2'));var express=require(_0x84f1('0x3'));var router=express[_0x84f1('0x4')]();var fs_extra=require(_0x84f1('0x5'));var auth=require(_0x84f1('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x84f1('0x7'));router[_0x84f1('0x8')]('/',auth['isAuthenticated'](),controller[_0x84f1('0x9')]);router[_0x84f1('0x8')](_0x84f1('0xa'),auth['isAuthenticated'](),controller[_0x84f1('0xb')]);router[_0x84f1('0x8')]('/:id',auth[_0x84f1('0xc')](),controller[_0x84f1('0xd')]);router[_0x84f1('0x8')](_0x84f1('0xe'),auth[_0x84f1('0xc')](),controller[_0x84f1('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x84f1('0x10')]);router[_0x84f1('0x11')](_0x84f1('0x12'),auth[_0x84f1('0xc')](),controller[_0x84f1('0x13')]);router['delete'](_0x84f1('0x12'),auth[_0x84f1('0xc')](),controller[_0x84f1('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf2af=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f9ba2,_0x1dfc2e){var _0x3f2b41=function(_0x4f6539){while(--_0x4f6539){_0x2f9ba2['push'](_0x2f9ba2['shift']());}};_0x3f2b41(++_0x1dfc2e);}(_0xf2af,0xdf));var _0xff2a=function(_0x129e54,_0x37aa48){_0x129e54=_0x129e54-0x0;var _0x4abc12=_0xf2af[_0x129e54];return _0x4abc12;};'use strict';var multer=require(_0xff2a('0x0'));var util=require(_0xff2a('0x1'));var path=require(_0xff2a('0x2'));var timeout=require(_0xff2a('0x3'));var express=require(_0xff2a('0x4'));var router=express[_0xff2a('0x5')]();var fs_extra=require(_0xff2a('0x6'));var auth=require(_0xff2a('0x7'));var interaction=require(_0xff2a('0x8'));var config=require(_0xff2a('0x9'));var controller=require(_0xff2a('0xa'));router[_0xff2a('0xb')]('/',auth[_0xff2a('0xc')](),controller[_0xff2a('0xd')]);router[_0xff2a('0xb')]('/describe',auth[_0xff2a('0xc')](),controller['describe']);router[_0xff2a('0xb')](_0xff2a('0xe'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/questions',auth['isAuthenticated'](),controller['getQuestions']);router[_0xff2a('0xf')]('/',auth[_0xff2a('0xc')](),controller[_0xff2a('0x10')]);router[_0xff2a('0x11')](_0xff2a('0xe'),auth[_0xff2a('0xc')](),controller[_0xff2a('0x12')]);router[_0xff2a('0x13')](_0xff2a('0xe'),auth[_0xff2a('0xc')](),controller[_0xff2a('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 775df67..0b8fa28 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 _0x39f8=['exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x201baf,_0x5258dd){var _0x4b7bba=function(_0x30792f){while(--_0x30792f){_0x201baf['push'](_0x201baf['shift']());}};_0x4b7bba(++_0x5258dd);}(_0x39f8,0xb3));var _0x839f=function(_0x2abdc2,_0x507492){_0x2abdc2=_0x2abdc2-0x0;var _0x3802a2=_0x39f8[_0x2abdc2];return _0x3802a2;};'use strict';var moment=require(_0x839f('0x0'));var Sequelize=require('sequelize');module[_0x839f('0x1')]={'starttime':{'type':Sequelize[_0x839f('0x2')],'set':function(_0x36cebb){this[_0x839f('0x3')](_0x839f('0x4'),_0x36cebb);this[_0x839f('0x3')](_0x839f('0x5'),moment()['format'](_0x839f('0x6')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize[_0x839f('0x7')]},'projectname':{'type':Sequelize[_0x839f('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x839f('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x839f('0x7')]},'completed':{'type':Sequelize[_0x839f('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xa8ad=['STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4e1c2a,_0xa9aeff){var _0x5bb742=function(_0x5911b3){while(--_0x5911b3){_0x4e1c2a['push'](_0x4e1c2a['shift']());}};_0x5bb742(++_0xa9aeff);}(_0xa8ad,0x197));var _0xda8a=function(_0x4f8c66,_0x130dbe){_0x4f8c66=_0x4f8c66-0x0;var _0x16f8ea=_0xa8ad[_0x4f8c66];return _0x16f8ea;};'use strict';var moment=require(_0xda8a('0x0'));var Sequelize=require(_0xda8a('0x1'));module[_0xda8a('0x2')]={'starttime':{'type':Sequelize[_0xda8a('0x3')],'set':function(_0x1e92cc){this['setDataValue']('starttime',_0x1e92cc);this[_0xda8a('0x4')]('endtime',moment()[_0xda8a('0x5')](_0xda8a('0x6')));}},'endtime':{'type':Sequelize[_0xda8a('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xda8a('0x7')]},'queue':{'type':Sequelize[_0xda8a('0x7')]},'uniqueid':{'type':Sequelize[_0xda8a('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xda8a('0x7')]},'completed':{'type':Sequelize[_0xda8a('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6e30a82..33740ea 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 _0x1cdb=['params','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','nolimit','SessionId','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','fieldName','type','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','keys','fields','options','find','create','body'];(function(_0x3c1df5,_0x1bc574){var _0x15b848=function(_0xcdaf10){while(--_0xcdaf10){_0x3c1df5['push'](_0x3c1df5['shift']());}};_0x15b848(++_0x1bc574);}(_0x1cdb,0x198));var _0xb1cd=function(_0x4e48c4,_0x57aeb4){_0x4e48c4=_0x4e48c4-0x0;var _0x53e44b=_0x1cdb[_0x4e48c4];return _0x53e44b;};'use strict';var emlformat=require(_0xb1cd('0x0'));var rimraf=require(_0xb1cd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb1cd('0x2'));var rp=require(_0xb1cd('0x3'));var moment=require(_0xb1cd('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb1cd('0x5'));var util=require(_0xb1cd('0x6'));var path=require(_0xb1cd('0x7'));var sox=require(_0xb1cd('0x8'));var csv=require(_0xb1cd('0x9'));var ejs=require(_0xb1cd('0xa'));var fs=require('fs');var fs_extra=require(_0xb1cd('0xb'));var _=require('lodash');var squel=require(_0xb1cd('0xc'));var crypto=require(_0xb1cd('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb1cd('0xe'));var toCsv=require(_0xb1cd('0x9'));var querystring=require(_0xb1cd('0xf'));var Papa=require(_0xb1cd('0x10'));var Redis=require('ioredis');var authService=require(_0xb1cd('0x11'));var qs=require(_0xb1cd('0x12'));var as=require(_0xb1cd('0x13'));var hardwareService=require(_0xb1cd('0x14'));var logger=require('../../config/logger')(_0xb1cd('0x15'));var utils=require(_0xb1cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb1cd('0x17'));var db=require(_0xb1cd('0x18'))['db'];function respondWithStatusCode(_0x59f501,_0x101c7c){_0x101c7c=_0x101c7c||0xcc;return function(_0x3c0960){if(_0x3c0960){return _0x59f501[_0xb1cd('0x19')](_0x101c7c);}return _0x59f501[_0xb1cd('0x1a')](_0x101c7c)[_0xb1cd('0x1b')]();};}function respondWithResult(_0xb91eac,_0x1379d3){_0x1379d3=_0x1379d3||0xc8;return function(_0x3af7d2){if(_0x3af7d2){return _0xb91eac[_0xb1cd('0x1a')](_0x1379d3)[_0xb1cd('0x1c')](_0x3af7d2);}};}function respondWithFilteredResult(_0x4dd15e,_0x56092d){return function(_0x2736de){if(_0x2736de){var _0x2d2989=typeof _0x56092d[_0xb1cd('0x1d')]===_0xb1cd('0x1e')&&typeof _0x56092d[_0xb1cd('0x1f')]==='undefined';var _0xdd7b7e=_0x2736de['count'];var _0x1834df=_0x2d2989?0x0:_0x56092d[_0xb1cd('0x1d')];var _0x105d8b=_0x2d2989?_0x2736de[_0xb1cd('0x20')]:_0x56092d[_0xb1cd('0x1d')]+_0x56092d['limit'];var _0x828565;if(_0x105d8b>=_0xdd7b7e){_0x105d8b=_0xdd7b7e;_0x828565=0xc8;}else{_0x828565=0xce;}_0x4dd15e['status'](_0x828565);return _0x4dd15e['set'](_0xb1cd('0x21'),_0x1834df+'-'+_0x105d8b+'/'+_0xdd7b7e)[_0xb1cd('0x1c')](_0x2736de);}return null;};}function patchUpdates(_0x3ad7c5){return function(_0x3a8f28){try{jsonpatch[_0xb1cd('0x22')](_0x3a8f28,_0x3ad7c5,!![]);}catch(_0x4e859a){return BPromise[_0xb1cd('0x23')](_0x4e859a);}return _0x3a8f28['save']();};}function saveUpdates(_0x2543a4,_0xf4aa36){return function(_0x1b2102){if(_0x1b2102){return _0x1b2102[_0xb1cd('0x24')](_0x2543a4)[_0xb1cd('0x25')](function(_0x408d22){return _0x408d22;});}return null;};}function removeEntity(_0x29c399,_0x6f5208){return function(_0x5e554f){if(_0x5e554f){return _0x5e554f[_0xb1cd('0x26')]()['then'](function(){_0x29c399[_0xb1cd('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x146a9a,_0xfbcc15){return function(_0x286464){if(!_0x286464){_0x146a9a['sendStatus'](0x194);}return _0x286464;};}function handleError(_0xbdaa73,_0x5e383f){_0x5e383f=_0x5e383f||0x1f4;return function(_0x4e27bc){logger['error'](_0x4e27bc[_0xb1cd('0x27')]);if(_0x4e27bc[_0xb1cd('0x28')]){delete _0x4e27bc[_0xb1cd('0x28')];}_0xbdaa73[_0xb1cd('0x1a')](_0x5e383f)[_0xb1cd('0x29')](_0x4e27bc);};}exports[_0xb1cd('0x2a')]=function(_0xa5b7a,_0x6d5a26){var _0x2c80eb={},_0x176d38={},_0x37988c={'count':0x0,'rows':[]};var _0x1f6d38=_[_0xb1cd('0x2b')](db[_0xb1cd('0x2c')]['rawAttributes'],function(_0x5ac095){return{'name':_0x5ac095[_0xb1cd('0x2d')],'type':_0x5ac095[_0xb1cd('0x2e')][_0xb1cd('0x2f')]};});_0x176d38[_0xb1cd('0x30')]=_[_0xb1cd('0x2b')](_0x1f6d38,_0xb1cd('0x28'));_0x176d38[_0xb1cd('0x31')]=_['keys'](_0xa5b7a[_0xb1cd('0x31')]);_0x176d38[_0xb1cd('0x32')]=_[_0xb1cd('0x33')](_0x176d38[_0xb1cd('0x30')],_0x176d38[_0xb1cd('0x31')]);_0x2c80eb['attributes']=_[_0xb1cd('0x33')](_0x176d38[_0xb1cd('0x30')],qs['fields'](_0xa5b7a[_0xb1cd('0x31')]['fields']));_0x2c80eb[_0xb1cd('0x34')]=_0x2c80eb[_0xb1cd('0x34')][_0xb1cd('0x35')]?_0x2c80eb[_0xb1cd('0x34')]:_0x176d38[_0xb1cd('0x30')];if(!_0xa5b7a['query'][_0xb1cd('0x36')]('nolimit')){_0x2c80eb['limit']=qs[_0xb1cd('0x1f')](_0xa5b7a[_0xb1cd('0x31')][_0xb1cd('0x1f')]);_0x2c80eb[_0xb1cd('0x1d')]=qs[_0xb1cd('0x1d')](_0xa5b7a[_0xb1cd('0x31')]['offset']);}_0x2c80eb[_0xb1cd('0x37')]=qs[_0xb1cd('0x38')](_0xa5b7a[_0xb1cd('0x31')][_0xb1cd('0x38')]);_0x2c80eb[_0xb1cd('0x39')]=qs[_0xb1cd('0x32')](_[_0xb1cd('0x3a')](_0xa5b7a[_0xb1cd('0x31')],_0x176d38['filters']),_0x1f6d38);if(_0xa5b7a['query'][_0xb1cd('0x3b')]){_0x2c80eb[_0xb1cd('0x39')]=_[_0xb1cd('0x3c')](_0x2c80eb[_0xb1cd('0x39')],{'$or':_[_0xb1cd('0x2b')](_0x1f6d38,function(_0x5ed43c){if(_0x5ed43c[_0xb1cd('0x2e')]!=='VIRTUAL'){var _0x302d65={};_0x302d65[_0x5ed43c[_0xb1cd('0x28')]]={'$like':'%'+_0xa5b7a[_0xb1cd('0x31')][_0xb1cd('0x3b')]+'%'};return _0x302d65;}})});}_0x2c80eb=_[_0xb1cd('0x3c')]({},_0x2c80eb,_0xa5b7a['options']);var _0x332ffe={'where':_0x2c80eb[_0xb1cd('0x39')]};return db[_0xb1cd('0x2c')][_0xb1cd('0x20')](_0x332ffe)['then'](function(_0x35c2ba){_0x37988c[_0xb1cd('0x20')]=_0x35c2ba;if(_0xa5b7a['query'][_0xb1cd('0x3d')]){_0x2c80eb[_0xb1cd('0x3e')]=[{'all':!![]}];}return db[_0xb1cd('0x2c')][_0xb1cd('0x3f')](_0x2c80eb);})[_0xb1cd('0x25')](function(_0x5bcdbe){_0x37988c[_0xb1cd('0x40')]=_0x5bcdbe;return _0x37988c;})[_0xb1cd('0x25')](respondWithFilteredResult(_0x6d5a26,_0x2c80eb))[_0xb1cd('0x41')](handleError(_0x6d5a26,null));};exports['show']=function(_0x34e8cf,_0x3d2f0f){var _0x4aa07e={'raw':!![],'where':{'id':_0x34e8cf['params']['id']}},_0x324e97={};_0x324e97[_0xb1cd('0x30')]=_[_0xb1cd('0x42')](db['JscriptySessionReport']['rawAttributes']);_0x324e97[_0xb1cd('0x31')]=_[_0xb1cd('0x42')](_0x34e8cf[_0xb1cd('0x31')]);_0x324e97[_0xb1cd('0x32')]=_[_0xb1cd('0x33')](_0x324e97['model'],_0x324e97[_0xb1cd('0x31')]);_0x4aa07e[_0xb1cd('0x34')]=_[_0xb1cd('0x33')](_0x324e97[_0xb1cd('0x30')],qs[_0xb1cd('0x43')](_0x34e8cf[_0xb1cd('0x31')][_0xb1cd('0x43')]));_0x4aa07e['attributes']=_0x4aa07e['attributes'][_0xb1cd('0x35')]?_0x4aa07e[_0xb1cd('0x34')]:_0x324e97[_0xb1cd('0x30')];if(_0x34e8cf[_0xb1cd('0x31')][_0xb1cd('0x3d')]){_0x4aa07e[_0xb1cd('0x3e')]=[{'all':!![]}];}_0x4aa07e=_[_0xb1cd('0x3c')]({},_0x4aa07e,_0x34e8cf[_0xb1cd('0x44')]);return db[_0xb1cd('0x2c')][_0xb1cd('0x45')](_0x4aa07e)['then'](handleEntityNotFound(_0x3d2f0f,null))[_0xb1cd('0x25')](respondWithResult(_0x3d2f0f,null))[_0xb1cd('0x41')](handleError(_0x3d2f0f,null));};exports[_0xb1cd('0x46')]=function(_0x218a8c,_0x207738){return db['JscriptySessionReport']['create'](_0x218a8c[_0xb1cd('0x47')],{})[_0xb1cd('0x25')](respondWithResult(_0x207738,0xc9))[_0xb1cd('0x41')](handleError(_0x207738,null));};exports['update']=function(_0x10c73c,_0x52fe0a){if(_0x10c73c[_0xb1cd('0x47')]['id']){delete _0x10c73c['body']['id'];}return db[_0xb1cd('0x2c')]['find']({'where':{'id':_0x10c73c['params']['id']}})['then'](handleEntityNotFound(_0x52fe0a,null))['then'](saveUpdates(_0x10c73c[_0xb1cd('0x47')],null))['then'](respondWithResult(_0x52fe0a,null))[_0xb1cd('0x41')](handleError(_0x52fe0a,null));};exports[_0xb1cd('0x26')]=function(_0x53b401,_0x13550e){return db[_0xb1cd('0x2c')][_0xb1cd('0x45')]({'where':{'id':_0x53b401[_0xb1cd('0x48')]['id']}})[_0xb1cd('0x25')](handleEntityNotFound(_0x13550e,null))['then'](removeEntity(_0x13550e,null))['catch'](handleError(_0x13550e,null));};exports[_0xb1cd('0x49')]=function(_0x52adee,_0x1490f5){return db[_0xb1cd('0x2c')][_0xb1cd('0x49')]()['then'](respondWithResult(_0x1490f5,null))[_0xb1cd('0x41')](handleError(_0x1490f5,null));};exports[_0xb1cd('0x4a')]=function(_0x8589da,_0x1fe175,_0x118a87){var _0x1de93a={'raw':!![],'where':{}};var _0xb7df89={};var _0xdf6db9={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xb1cd('0x4b')]({'where':{'id':_0x8589da[_0xb1cd('0x48')]['id']}})[_0xb1cd('0x25')](handleEntityNotFound(_0x1fe175,null))['then'](function(_0x3bf545){if(_0x3bf545){_0xb7df89[_0xb1cd('0x30')]=_[_0xb1cd('0x42')](db[_0xb1cd('0x4c')][_0xb1cd('0x4d')]);_0xb7df89[_0xb1cd('0x31')]=_['keys'](_0x8589da[_0xb1cd('0x31')]);_0xb7df89['filters']=_[_0xb1cd('0x33')](_0xb7df89[_0xb1cd('0x30')],_0xb7df89[_0xb1cd('0x31')]);_0x1de93a['attributes']=_[_0xb1cd('0x33')](_0xb7df89[_0xb1cd('0x30')],qs['fields'](_0x8589da[_0xb1cd('0x31')][_0xb1cd('0x43')]));_0x1de93a['attributes']=_0x1de93a[_0xb1cd('0x34')][_0xb1cd('0x35')]?_0x1de93a[_0xb1cd('0x34')]:_0xb7df89[_0xb1cd('0x30')];if(!_0x8589da[_0xb1cd('0x31')][_0xb1cd('0x36')](_0xb1cd('0x4e'))){_0x1de93a[_0xb1cd('0x1f')]=qs[_0xb1cd('0x1f')](_0x8589da['query']['limit']);_0x1de93a[_0xb1cd('0x1d')]=qs[_0xb1cd('0x1d')](_0x8589da[_0xb1cd('0x31')][_0xb1cd('0x1d')]);}_0x1de93a[_0xb1cd('0x37')]=qs[_0xb1cd('0x38')](_0x8589da[_0xb1cd('0x31')]['sort']);_0x1de93a[_0xb1cd('0x39')]=qs[_0xb1cd('0x32')](_[_0xb1cd('0x3a')](_0x8589da[_0xb1cd('0x31')],_0xb7df89[_0xb1cd('0x32')]));_0x1de93a[_0xb1cd('0x39')][_0xb1cd('0x4f')]=_0x3bf545['id'];if(_0x8589da[_0xb1cd('0x31')][_0xb1cd('0x3b')]){_0x1de93a[_0xb1cd('0x39')]=_[_0xb1cd('0x3c')](_0x1de93a[_0xb1cd('0x39')],{'$or':_[_0xb1cd('0x2b')](_0x1de93a[_0xb1cd('0x34')],function(_0x58a900){var _0x36e47b={};_0x36e47b[_0x58a900]={'$like':'%'+_0x8589da[_0xb1cd('0x31')][_0xb1cd('0x3b')]+'%'};return _0x36e47b;})});}_0x1de93a=_['merge']({},_0x1de93a,_0x8589da['options']);return db[_0xb1cd('0x4c')][_0xb1cd('0x20')]({'where':_0x1de93a[_0xb1cd('0x39')]})[_0xb1cd('0x25')](function(_0x3a3f98){_0xdf6db9[_0xb1cd('0x20')]=_0x3a3f98;if(_0x8589da['query'][_0xb1cd('0x3d')]){_0x1de93a[_0xb1cd('0x3e')]=[{'all':!![]}];}return db[_0xb1cd('0x4c')]['findAll'](_0x1de93a);})[_0xb1cd('0x25')](function(_0x4915b1){_0xdf6db9[_0xb1cd('0x40')]=_0x4915b1;return _0xdf6db9;});}})[_0xb1cd('0x25')](respondWithFilteredResult(_0x1fe175,_0x1de93a))[_0xb1cd('0x41')](handleError(_0x1fe175,null));}; \ No newline at end of file +var _0x38e9=['destroy','error','name','send','index','map','JscriptySessionReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','find','create','update','body','params','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','order','SessionId','include','rows','eml-format','rimraf','zip-dir','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','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then'];(function(_0x4fd687,_0x25e0d7){var _0x56e1e1=function(_0x29d559){while(--_0x29d559){_0x4fd687['push'](_0x4fd687['shift']());}};_0x56e1e1(++_0x25e0d7);}(_0x38e9,0x7b));var _0x938e=function(_0x4d6f6f,_0xef3141){_0x4d6f6f=_0x4d6f6f-0x0;var _0x4b7e32=_0x38e9[_0x4d6f6f];return _0x4b7e32;};'use strict';var emlformat=require(_0x938e('0x0'));var rimraf=require(_0x938e('0x1'));var zipdir=require(_0x938e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x938e('0x3'));var moment=require(_0x938e('0x4'));var BPromise=require(_0x938e('0x5'));var Mustache=require(_0x938e('0x6'));var util=require(_0x938e('0x7'));var path=require(_0x938e('0x8'));var sox=require(_0x938e('0x9'));var csv=require('to-csv');var ejs=require(_0x938e('0xa'));var fs=require('fs');var fs_extra=require(_0x938e('0xb'));var _=require('lodash');var squel=require(_0x938e('0xc'));var crypto=require(_0x938e('0xd'));var jsforce=require(_0x938e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x938e('0xf'));var querystring=require('querystring');var Papa=require(_0x938e('0x10'));var Redis=require(_0x938e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x938e('0x12'));var as=require(_0x938e('0x13'));var hardwareService=require(_0x938e('0x14'));var logger=require(_0x938e('0x15'))(_0x938e('0x16'));var utils=require(_0x938e('0x17'));var config=require(_0x938e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x938e('0x19'))['db'];function respondWithStatusCode(_0x96932f,_0x34d464){_0x34d464=_0x34d464||0xcc;return function(_0x414de6){if(_0x414de6){return _0x96932f['sendStatus'](_0x34d464);}return _0x96932f[_0x938e('0x1a')](_0x34d464)[_0x938e('0x1b')]();};}function respondWithResult(_0xfaf942,_0xf436c8){_0xf436c8=_0xf436c8||0xc8;return function(_0x2d3f1b){if(_0x2d3f1b){return _0xfaf942[_0x938e('0x1a')](_0xf436c8)[_0x938e('0x1c')](_0x2d3f1b);}};}function respondWithFilteredResult(_0x2dfd12,_0x15643f){return function(_0x283406){if(_0x283406){var _0x5e79b6=typeof _0x15643f[_0x938e('0x1d')]===_0x938e('0x1e')&&typeof _0x15643f['limit']==='undefined';var _0x3098db=_0x283406[_0x938e('0x1f')];var _0x383930=_0x5e79b6?0x0:_0x15643f['offset'];var _0x104c6b=_0x5e79b6?_0x283406[_0x938e('0x1f')]:_0x15643f[_0x938e('0x1d')]+_0x15643f[_0x938e('0x20')];var _0x59d395;if(_0x104c6b>=_0x3098db){_0x104c6b=_0x3098db;_0x59d395=0xc8;}else{_0x59d395=0xce;}_0x2dfd12[_0x938e('0x1a')](_0x59d395);return _0x2dfd12['set'](_0x938e('0x21'),_0x383930+'-'+_0x104c6b+'/'+_0x3098db)[_0x938e('0x1c')](_0x283406);}return null;};}function patchUpdates(_0x2a5448){return function(_0x3680){try{jsonpatch['apply'](_0x3680,_0x2a5448,!![]);}catch(_0x34db14){return BPromise[_0x938e('0x22')](_0x34db14);}return _0x3680[_0x938e('0x23')]();};}function saveUpdates(_0x5c95bd,_0x1f863d){return function(_0xc1e9da){if(_0xc1e9da){return _0xc1e9da['update'](_0x5c95bd)[_0x938e('0x24')](function(_0x17a4a7){return _0x17a4a7;});}return null;};}function removeEntity(_0x50c86d,_0x4d6cbb){return function(_0x2cfb02){if(_0x2cfb02){return _0x2cfb02[_0x938e('0x25')]()[_0x938e('0x24')](function(){_0x50c86d[_0x938e('0x1a')](0xcc)[_0x938e('0x1b')]();});}};}function handleEntityNotFound(_0x34d88a,_0x942300){return function(_0x2e81ec){if(!_0x2e81ec){_0x34d88a['sendStatus'](0x194);}return _0x2e81ec;};}function handleError(_0xbef130,_0x54d81a){_0x54d81a=_0x54d81a||0x1f4;return function(_0x532396){logger[_0x938e('0x26')](_0x532396['stack']);if(_0x532396[_0x938e('0x27')]){delete _0x532396[_0x938e('0x27')];}_0xbef130[_0x938e('0x1a')](_0x54d81a)[_0x938e('0x28')](_0x532396);};}exports[_0x938e('0x29')]=function(_0x27893b,_0x3142b5){var _0x52516a={},_0x3e771d={},_0x41e238={'count':0x0,'rows':[]};var _0x54feaf=_[_0x938e('0x2a')](db[_0x938e('0x2b')][_0x938e('0x2c')],function(_0x31ec02){return{'name':_0x31ec02['fieldName'],'type':_0x31ec02[_0x938e('0x2d')][_0x938e('0x2e')]};});_0x3e771d[_0x938e('0x2f')]=_[_0x938e('0x2a')](_0x54feaf,_0x938e('0x27'));_0x3e771d[_0x938e('0x30')]=_[_0x938e('0x31')](_0x27893b[_0x938e('0x30')]);_0x3e771d[_0x938e('0x32')]=_[_0x938e('0x33')](_0x3e771d[_0x938e('0x2f')],_0x3e771d[_0x938e('0x30')]);_0x52516a[_0x938e('0x34')]=_[_0x938e('0x33')](_0x3e771d[_0x938e('0x2f')],qs[_0x938e('0x35')](_0x27893b['query'][_0x938e('0x35')]));_0x52516a[_0x938e('0x34')]=_0x52516a['attributes'][_0x938e('0x36')]?_0x52516a[_0x938e('0x34')]:_0x3e771d[_0x938e('0x2f')];if(!_0x27893b[_0x938e('0x30')]['hasOwnProperty'](_0x938e('0x37'))){_0x52516a[_0x938e('0x20')]=qs[_0x938e('0x20')](_0x27893b['query'][_0x938e('0x20')]);_0x52516a['offset']=qs['offset'](_0x27893b[_0x938e('0x30')][_0x938e('0x1d')]);}_0x52516a['order']=qs[_0x938e('0x38')](_0x27893b['query']['sort']);_0x52516a['where']=qs['filters'](_[_0x938e('0x39')](_0x27893b['query'],_0x3e771d[_0x938e('0x32')]),_0x54feaf);if(_0x27893b['query']['filter']){_0x52516a[_0x938e('0x3a')]=_[_0x938e('0x3b')](_0x52516a[_0x938e('0x3a')],{'$or':_[_0x938e('0x2a')](_0x54feaf,function(_0x5d0a6a){if(_0x5d0a6a['type']!==_0x938e('0x3c')){var _0xbffefe={};_0xbffefe[_0x5d0a6a['name']]={'$like':'%'+_0x27893b[_0x938e('0x30')][_0x938e('0x3d')]+'%'};return _0xbffefe;}})});}_0x52516a=_[_0x938e('0x3b')]({},_0x52516a,_0x27893b[_0x938e('0x3e')]);var _0x4be8a0={'where':_0x52516a['where']};return db[_0x938e('0x2b')][_0x938e('0x1f')](_0x4be8a0)['then'](function(_0x39ba3d){_0x41e238[_0x938e('0x1f')]=_0x39ba3d;if(_0x27893b[_0x938e('0x30')][_0x938e('0x3f')]){_0x52516a['include']=[{'all':!![]}];}return db[_0x938e('0x2b')][_0x938e('0x40')](_0x52516a);})[_0x938e('0x24')](function(_0x5c943b){_0x41e238['rows']=_0x5c943b;return _0x41e238;})[_0x938e('0x24')](respondWithFilteredResult(_0x3142b5,_0x52516a))[_0x938e('0x41')](handleError(_0x3142b5,null));};exports[_0x938e('0x42')]=function(_0x255aec,_0x11ec43){var _0x52b801={'raw':!![],'where':{'id':_0x255aec['params']['id']}},_0x120084={};_0x120084[_0x938e('0x2f')]=_['keys'](db[_0x938e('0x2b')][_0x938e('0x2c')]);_0x120084[_0x938e('0x30')]=_['keys'](_0x255aec['query']);_0x120084[_0x938e('0x32')]=_[_0x938e('0x33')](_0x120084[_0x938e('0x2f')],_0x120084['query']);_0x52b801[_0x938e('0x34')]=_['intersection'](_0x120084[_0x938e('0x2f')],qs[_0x938e('0x35')](_0x255aec[_0x938e('0x30')]['fields']));_0x52b801[_0x938e('0x34')]=_0x52b801['attributes'][_0x938e('0x36')]?_0x52b801[_0x938e('0x34')]:_0x120084[_0x938e('0x2f')];if(_0x255aec[_0x938e('0x30')][_0x938e('0x3f')]){_0x52b801['include']=[{'all':!![]}];}_0x52b801=_[_0x938e('0x3b')]({},_0x52b801,_0x255aec[_0x938e('0x3e')]);return db[_0x938e('0x2b')][_0x938e('0x43')](_0x52b801)[_0x938e('0x24')](handleEntityNotFound(_0x11ec43,null))[_0x938e('0x24')](respondWithResult(_0x11ec43,null))[_0x938e('0x41')](handleError(_0x11ec43,null));};exports[_0x938e('0x44')]=function(_0x1a2bf8,_0x38cc58){return db[_0x938e('0x2b')][_0x938e('0x44')](_0x1a2bf8['body'],{})[_0x938e('0x24')](respondWithResult(_0x38cc58,0xc9))[_0x938e('0x41')](handleError(_0x38cc58,null));};exports[_0x938e('0x45')]=function(_0x42e076,_0x6a41f8){if(_0x42e076[_0x938e('0x46')]['id']){delete _0x42e076[_0x938e('0x46')]['id'];}return db[_0x938e('0x2b')][_0x938e('0x43')]({'where':{'id':_0x42e076[_0x938e('0x47')]['id']}})[_0x938e('0x24')](handleEntityNotFound(_0x6a41f8,null))[_0x938e('0x24')](saveUpdates(_0x42e076[_0x938e('0x46')],null))[_0x938e('0x24')](respondWithResult(_0x6a41f8,null))['catch'](handleError(_0x6a41f8,null));};exports[_0x938e('0x25')]=function(_0x1bfb2a,_0x24d27b){return db[_0x938e('0x2b')][_0x938e('0x43')]({'where':{'id':_0x1bfb2a['params']['id']}})[_0x938e('0x24')](handleEntityNotFound(_0x24d27b,null))[_0x938e('0x24')](removeEntity(_0x24d27b,null))[_0x938e('0x41')](handleError(_0x24d27b,null));};exports['describe']=function(_0x37d977,_0x503eb7){return db[_0x938e('0x2b')]['describe']()['then'](respondWithResult(_0x503eb7,null))[_0x938e('0x41')](handleError(_0x503eb7,null));};exports[_0x938e('0x48')]=function(_0x818d28,_0x246633,_0x42233a){var _0x6ddfe0={'raw':!![],'where':{}};var _0x28fee8={};var _0x337078={'count':0x0,'rows':[]};return db[_0x938e('0x2b')][_0x938e('0x49')]({'where':{'id':_0x818d28[_0x938e('0x47')]['id']}})[_0x938e('0x24')](handleEntityNotFound(_0x246633,null))[_0x938e('0x24')](function(_0x20506d){if(_0x20506d){_0x28fee8[_0x938e('0x2f')]=_['keys'](db[_0x938e('0x4a')][_0x938e('0x2c')]);_0x28fee8['query']=_[_0x938e('0x31')](_0x818d28[_0x938e('0x30')]);_0x28fee8[_0x938e('0x32')]=_[_0x938e('0x33')](_0x28fee8[_0x938e('0x2f')],_0x28fee8[_0x938e('0x30')]);_0x6ddfe0[_0x938e('0x34')]=_[_0x938e('0x33')](_0x28fee8[_0x938e('0x2f')],qs[_0x938e('0x35')](_0x818d28[_0x938e('0x30')][_0x938e('0x35')]));_0x6ddfe0[_0x938e('0x34')]=_0x6ddfe0['attributes'][_0x938e('0x36')]?_0x6ddfe0['attributes']:_0x28fee8[_0x938e('0x2f')];if(!_0x818d28[_0x938e('0x30')][_0x938e('0x4b')]('nolimit')){_0x6ddfe0[_0x938e('0x20')]=qs[_0x938e('0x20')](_0x818d28['query'][_0x938e('0x20')]);_0x6ddfe0[_0x938e('0x1d')]=qs[_0x938e('0x1d')](_0x818d28[_0x938e('0x30')][_0x938e('0x1d')]);}_0x6ddfe0[_0x938e('0x4c')]=qs[_0x938e('0x38')](_0x818d28['query'][_0x938e('0x38')]);_0x6ddfe0[_0x938e('0x3a')]=qs['filters'](_[_0x938e('0x39')](_0x818d28['query'],_0x28fee8['filters']));_0x6ddfe0['where'][_0x938e('0x4d')]=_0x20506d['id'];if(_0x818d28[_0x938e('0x30')][_0x938e('0x3d')]){_0x6ddfe0[_0x938e('0x3a')]=_[_0x938e('0x3b')](_0x6ddfe0[_0x938e('0x3a')],{'$or':_['map'](_0x6ddfe0[_0x938e('0x34')],function(_0x44dfff){var _0x5f235c={};_0x5f235c[_0x44dfff]={'$like':'%'+_0x818d28[_0x938e('0x30')][_0x938e('0x3d')]+'%'};return _0x5f235c;})});}_0x6ddfe0=_[_0x938e('0x3b')]({},_0x6ddfe0,_0x818d28[_0x938e('0x3e')]);return db[_0x938e('0x4a')]['count']({'where':_0x6ddfe0['where']})[_0x938e('0x24')](function(_0x28ac6b){_0x337078[_0x938e('0x1f')]=_0x28ac6b;if(_0x818d28[_0x938e('0x30')][_0x938e('0x3f')]){_0x6ddfe0[_0x938e('0x4e')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x938e('0x40')](_0x6ddfe0);})[_0x938e('0x24')](function(_0x2e06b4){_0x337078[_0x938e('0x4f')]=_0x2e06b4;return _0x337078;});}})[_0x938e('0x24')](respondWithFilteredResult(_0x246633,_0x6ddfe0))[_0x938e('0x41')](handleError(_0x246633,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 857f6f0..cecf4e4 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 _0x7da7=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','report_jscripty_sessions','lodash'];(function(_0x17114a,_0x1811e7){var _0x3e11b8=function(_0x47933b){while(--_0x47933b){_0x17114a['push'](_0x17114a['shift']());}};_0x3e11b8(++_0x1811e7);}(_0x7da7,0x10d));var _0x77da=function(_0x1f62c3,_0x1ff95b){_0x1f62c3=_0x1f62c3-0x0;var _0x385c1c=_0x7da7[_0x1f62c3];return _0x385c1c;};'use strict';var _=require(_0x77da('0x0'));var util=require(_0x77da('0x1'));var logger=require(_0x77da('0x2'))('api');var moment=require('moment');var BPromise=require(_0x77da('0x3'));var rp=require(_0x77da('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x77da('0x5'));var config=require(_0x77da('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0x77da('0x7')]=function(_0xc54a12,_0x47da81){return _0xc54a12[_0x77da('0x8')]('JscriptySessionReport',attributes,{'tableName':_0x77da('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x323f=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x49c1ed,_0x29543f){var _0x343c9a=function(_0x727d1f){while(--_0x727d1f){_0x49c1ed['push'](_0x49c1ed['shift']());}};_0x343c9a(++_0x29543f);}(_0x323f,0x1ee));var _0xf323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x323f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var logger=require('../../config/logger')(_0xf323('0x1'));var moment=require(_0xf323('0x2'));var BPromise=require(_0xf323('0x3'));var rp=require(_0xf323('0x4'));var fs=require('fs');var path=require(_0xf323('0x5'));var rimraf=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var attributes=require(_0xf323('0x8'));module[_0xf323('0x9')]=function(_0x371707,_0x5d7d60){return _0x371707[_0xf323('0xa')](_0xf323('0xb'),attributes,{'tableName':_0xf323('0xc'),'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 bd5f441..b0b199c 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 _0x5464=['info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x1be922,_0x319b93){var _0x3a531c=function(_0xec19bf){while(--_0xec19bf){_0x1be922['push'](_0x1be922['shift']());}};_0x3a531c(++_0x319b93);}(_0x5464,0x15d));var _0x4546=function(_0x1f93e9,_0x42e5a4){_0x1f93e9=_0x1f93e9-0x0;var _0x51d50c=_0x5464[_0x1f93e9];return _0x51d50c;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var moment=require(_0x4546('0x2'));var BPromise=require('bluebird');var rs=require(_0x4546('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4546('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4546('0x5'))(_0x4546('0x6'));var config=require(_0x4546('0x7'));var jayson=require(_0x4546('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c5e09,_0x224c7c,_0x36c875){return new BPromise(function(_0x1a76c1,_0x2e860a){return client[_0x4546('0x9')](_0x5c5e09,_0x36c875)[_0x4546('0xa')](function(_0x11d63e){logger[_0x4546('0xb')](_0x4546('0xc'),_0x224c7c,'request\x20sent');logger[_0x4546('0xd')](_0x4546('0xe'),_0x224c7c,_0x4546('0xf'),JSON['stringify'](_0x11d63e));if(_0x11d63e[_0x4546('0x10')]){if(_0x11d63e[_0x4546('0x10')][_0x4546('0x11')]===0x1f4){logger[_0x4546('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error'][_0x4546('0x12')]);return _0x2e860a(_0x11d63e['error']['message']);}logger['error']('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x11d63e['error']['message']);return _0x1a76c1(_0x11d63e[_0x4546('0x10')]['message']);}else{logger[_0x4546('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x224c7c,_0x4546('0xf'));_0x1a76c1(_0x11d63e['result'][_0x4546('0x12')]);}})[_0x4546('0x13')](function(_0x24b32a){logger[_0x4546('0x10')](_0x4546('0xc'),_0x224c7c,_0x24b32a);_0x2e860a(_0x24b32a);});});} \ No newline at end of file +var _0x71ab=['http','request','then','info','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptySessionReport,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x342aaa,_0x488e9b){var _0x205cc3=function(_0x48fbe7){while(--_0x48fbe7){_0x342aaa['push'](_0x342aaa['shift']());}};_0x205cc3(++_0x488e9b);}(_0x71ab,0x64));var _0xb71a=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x71ab[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xb71a('0x0'));var moment=require('moment');var BPromise=require(_0xb71a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb71a('0x2'));var db=require(_0xb71a('0x3'))['db'];var utils=require(_0xb71a('0x4'));var logger=require(_0xb71a('0x5'))(_0xb71a('0x6'));var config=require(_0xb71a('0x7'));var jayson=require(_0xb71a('0x8'));var client=jayson[_0xb71a('0x9')][_0xb71a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a84e,_0x4358ce,_0x2a4c86){return new BPromise(function(_0x43ca14,_0x471ab6){return client[_0xb71a('0xb')](_0x35a84e,_0x2a4c86)[_0xb71a('0xc')](function(_0x378c96){logger[_0xb71a('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0xb71a('0xe'));logger['debug'](_0xb71a('0xf'),_0x4358ce,_0xb71a('0xe'),JSON[_0xb71a('0x10')](_0x378c96));if(_0x378c96['error']){if(_0x378c96[_0xb71a('0x11')]['code']===0x1f4){logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error'][_0xb71a('0x12')]);return _0x471ab6(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}logger[_0xb71a('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x4358ce,_0x378c96['error']['message']);return _0x43ca14(_0x378c96[_0xb71a('0x11')][_0xb71a('0x12')]);}else{logger[_0xb71a('0xd')](_0xb71a('0x13'),_0x4358ce,_0xb71a('0xe'));_0x43ca14(_0x378c96[_0xb71a('0x14')][_0xb71a('0x12')]);}})[_0xb71a('0x15')](function(_0x7710a8){logger['error'](_0xb71a('0x13'),_0x4358ce,_0x7710a8);_0x471ab6(_0x7710a8);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9f27608..04b1c1d 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 _0x3564=['../../components/auth/service','../../components/interaction/service','./license.controller','get','put','isAuthenticated','update','/download_log_file','downloadLogFile','multer','util','path','express','Router'];(function(_0x38f820,_0x1e8b88){var _0x46ead9=function(_0x5718ec){while(--_0x5718ec){_0x38f820['push'](_0x38f820['shift']());}};_0x46ead9(++_0x1e8b88);}(_0x3564,0x1d7));var _0x4356=function(_0x203d27,_0x50ab46){_0x203d27=_0x203d27-0x0;var _0x1f93e2=_0x3564[_0x203d27];return _0x1f93e2;};'use strict';var multer=require(_0x4356('0x0'));var util=require(_0x4356('0x1'));var path=require(_0x4356('0x2'));var timeout=require('connect-timeout');var express=require(_0x4356('0x3'));var router=express[_0x4356('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4356('0x5'));var interaction=require(_0x4356('0x6'));var config=require('../../config/environment');var controller=require(_0x4356('0x7'));router[_0x4356('0x8')]('/',controller['index']);router[_0x4356('0x9')]('/:id',auth[_0x4356('0xa')](),controller[_0x4356('0xb')]);router[_0x4356('0x8')](_0x4356('0xc'),auth['isAuthenticated'](),controller[_0x4356('0xd')]);module['exports']=router; \ No newline at end of file +var _0x4492=['put','/:id','isAuthenticated','update','downloadLogFile','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','get','index'];(function(_0x127331,_0x5f285b){var _0x259bff=function(_0x310e3f){while(--_0x310e3f){_0x127331['push'](_0x127331['shift']());}};_0x259bff(++_0x5f285b);}(_0x4492,0x76));var _0x2449=function(_0x4b3afb,_0x3647a8){_0x4b3afb=_0x4b3afb-0x0;var _0xbd2892=_0x4492[_0x4b3afb];return _0xbd2892;};'use strict';var multer=require(_0x2449('0x0'));var util=require(_0x2449('0x1'));var path=require('path');var timeout=require(_0x2449('0x2'));var express=require(_0x2449('0x3'));var router=express['Router']();var fs_extra=require(_0x2449('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2449('0x5'));var controller=require('./license.controller');router[_0x2449('0x6')]('/',controller[_0x2449('0x7')]);router[_0x2449('0x8')](_0x2449('0x9'),auth[_0x2449('0xa')](),controller[_0x2449('0xb')]);router['get']('/download_log_file',auth['isAuthenticated'](),controller[_0x2449('0xc')]);module[_0x2449('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 9446924..2e8d44a 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 _0x2078=['TEXT','STRING','INTEGER'];(function(_0x92713a,_0x68f8b0){var _0x1893e1=function(_0xe49768){while(--_0xe49768){_0x92713a['push'](_0x92713a['shift']());}};_0x1893e1(++_0x68f8b0);}(_0x2078,0xf6));var _0x8207=function(_0xd9174f,_0x352be0){_0xd9174f=_0xd9174f-0x0;var _0x1eee07=_0x2078[_0xd9174f];return _0x1eee07;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x8207('0x0')]},'data1':{'type':Sequelize[_0x8207('0x1')]},'data2':{'type':Sequelize[_0x8207('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x8207('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1752=['INTEGER','exports','TEXT','STRING'];(function(_0x35bca2,_0x4ce50d){var _0x295d7a=function(_0x226e4d){while(--_0x226e4d){_0x35bca2['push'](_0x35bca2['shift']());}};_0x295d7a(++_0x4ce50d);}(_0x1752,0x115));var _0x2175=function(_0x14847a,_0x2a544e){_0x14847a=_0x14847a-0x0;var _0x226934=_0x1752[_0x14847a];return _0x226934;};'use strict';var Sequelize=require('sequelize');module[_0x2175('0x0')]={'license':{'type':Sequelize[_0x2175('0x1')]},'data1':{'type':Sequelize[_0x2175('0x2')]},'data2':{'type':Sequelize[_0x2175('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x2175('0x3')],'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 80e2808..1423316 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 _0xcb1e=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','update','then','destroy','end','error','stack','name','send','model','keys','License','rawAttributes','query','filters','intersection','fields','attributes','length','getLicense','body','find','checkLicense','key','demo','catch','downloadLogFile','license-info.log','join','/var','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x1d7fab,_0x3dfa49){var _0x1d27f0=function(_0x1047ff){while(--_0x1047ff){_0x1d7fab['push'](_0x1d7fab['shift']());}};_0x1d27f0(++_0x3dfa49);}(_0xcb1e,0xbd));var _0xecb1=function(_0x239dba,_0x309e95){_0x239dba=_0x239dba-0x0;var _0x1ceb11=_0xcb1e[_0x239dba];return _0x1ceb11;};'use strict';var emlformat=require(_0xecb1('0x0'));var rimraf=require(_0xecb1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xecb1('0x2'));var moment=require(_0xecb1('0x3'));var BPromise=require(_0xecb1('0x4'));var Mustache=require(_0xecb1('0x5'));var util=require(_0xecb1('0x6'));var path=require(_0xecb1('0x7'));var sox=require('sox');var csv=require(_0xecb1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xecb1('0x9'));var _=require(_0xecb1('0xa'));var squel=require(_0xecb1('0xb'));var crypto=require('crypto');var jsforce=require(_0xecb1('0xc'));var deskjs=require(_0xecb1('0xd'));var toCsv=require(_0xecb1('0x8'));var querystring=require(_0xecb1('0xe'));var Papa=require(_0xecb1('0xf'));var Redis=require(_0xecb1('0x10'));var authService=require(_0xecb1('0x11'));var qs=require(_0xecb1('0x12'));var as=require(_0xecb1('0x13'));var hardwareService=require(_0xecb1('0x14'));var logger=require(_0xecb1('0x15'))(_0xecb1('0x16'));var utils=require(_0xecb1('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xecb1('0x18'));var db=require(_0xecb1('0x19'))['db'];function respondWithStatusCode(_0x463d31,_0x3ab780){_0x3ab780=_0x3ab780||0xcc;return function(_0x44e743){if(_0x44e743){return _0x463d31[_0xecb1('0x1a')](_0x3ab780);}return _0x463d31['status'](_0x3ab780)['end']();};}function respondWithResult(_0x266f55,_0x528c53){_0x528c53=_0x528c53||0xc8;return function(_0x3094b9){if(_0x3094b9){return _0x266f55['status'](_0x528c53)['json'](_0x3094b9);}};}function respondWithFilteredResult(_0x1f84e0,_0x13f5d7){return function(_0x52520f){if(_0x52520f){var _0x29ab2e=typeof _0x13f5d7[_0xecb1('0x1b')]===_0xecb1('0x1c')&&typeof _0x13f5d7[_0xecb1('0x1d')]==='undefined';var _0x4142a0=_0x52520f[_0xecb1('0x1e')];var _0x3c8bc8=_0x29ab2e?0x0:_0x13f5d7[_0xecb1('0x1b')];var _0x3c5482=_0x29ab2e?_0x52520f[_0xecb1('0x1e')]:_0x13f5d7[_0xecb1('0x1b')]+_0x13f5d7[_0xecb1('0x1d')];var _0x20beca;if(_0x3c5482>=_0x4142a0){_0x3c5482=_0x4142a0;_0x20beca=0xc8;}else{_0x20beca=0xce;}_0x1f84e0[_0xecb1('0x1f')](_0x20beca);return _0x1f84e0[_0xecb1('0x20')](_0xecb1('0x21'),_0x3c8bc8+'-'+_0x3c5482+'/'+_0x4142a0)['json'](_0x52520f);}return null;};}function patchUpdates(_0x3c40d6){return function(_0x4eeff6){try{jsonpatch[_0xecb1('0x22')](_0x4eeff6,_0x3c40d6,!![]);}catch(_0x5e1315){return BPromise['reject'](_0x5e1315);}return _0x4eeff6['save']();};}function saveUpdates(_0xab4097,_0x11c69f){return function(_0x3f8bff){if(_0x3f8bff){return _0x3f8bff[_0xecb1('0x23')](_0xab4097)[_0xecb1('0x24')](function(_0x230549){return _0x230549;});}return null;};}function removeEntity(_0x24e1fd,_0x2f1935){return function(_0x202dcb){if(_0x202dcb){return _0x202dcb[_0xecb1('0x25')]()['then'](function(){_0x24e1fd[_0xecb1('0x1f')](0xcc)[_0xecb1('0x26')]();});}};}function handleEntityNotFound(_0x211b66,_0x42fc84){return function(_0x44147c){if(!_0x44147c){_0x211b66[_0xecb1('0x1a')](0x194);}return _0x44147c;};}function handleError(_0x29476b,_0xcecd8e){_0xcecd8e=_0xcecd8e||0x1f4;return function(_0x23c9cc){logger[_0xecb1('0x27')](_0x23c9cc[_0xecb1('0x28')]);if(_0x23c9cc[_0xecb1('0x29')]){delete _0x23c9cc[_0xecb1('0x29')];}_0x29476b[_0xecb1('0x1f')](_0xcecd8e)[_0xecb1('0x2a')](_0x23c9cc);};}var utilLicense=require(_0xecb1('0x18'));exports['index']=function(_0x2aecef,_0x4d63b8){var _0x2e2634={'raw':!![],'where':{'id':0x1}},_0x168bc2={};_0x168bc2[_0xecb1('0x2b')]=_[_0xecb1('0x2c')](db[_0xecb1('0x2d')][_0xecb1('0x2e')]);_0x168bc2[_0xecb1('0x2f')]=_[_0xecb1('0x2c')](_0x2aecef[_0xecb1('0x2f')]);_0x168bc2[_0xecb1('0x30')]=_[_0xecb1('0x31')](_0x168bc2[_0xecb1('0x2b')],_0x168bc2['query']);_0x2e2634['attributes']=_[_0xecb1('0x31')](_0x168bc2[_0xecb1('0x2b')],qs[_0xecb1('0x32')](_0x2aecef[_0xecb1('0x2f')][_0xecb1('0x32')]));_0x2e2634[_0xecb1('0x33')]=_0x2e2634['attributes'][_0xecb1('0x34')]?_0x2e2634[_0xecb1('0x33')]:_0x168bc2[_0xecb1('0x2b')];_0x2e2634=_['merge']({},_0x2e2634,_0x2aecef['options']);return utilLicense[_0xecb1('0x35')](_0x2e2634)[_0xecb1('0x24')](respondWithResult(_0x4d63b8,null))['catch'](handleError(_0x4d63b8,null));};exports['update']=function(_0x434ca5,_0x5ee0fe){if(_0x434ca5[_0xecb1('0x36')]['id']){delete _0x434ca5['body']['id'];}return db[_0xecb1('0x2d')][_0xecb1('0x37')]({'where':{'id':_0x434ca5['params']['id']}})[_0xecb1('0x24')](handleEntityNotFound(_0x5ee0fe,null))[_0xecb1('0x24')](function(_0x76a5fd){var _0x22e44b=_0x76a5fd['get']({'plain':!![]});return utilLicense[_0xecb1('0x38')](_0x22e44b,_0x434ca5['body'][_0xecb1('0x39')]);})[_0xecb1('0x24')](function(_0x96188d){if(!_0x96188d[_0xecb1('0x3a')]){return saveUpdates(_0x434ca5['body'],null);}return _0x96188d;})['then'](respondWithResult(_0x5ee0fe,null))[_0xecb1('0x3b')](handleError(_0x5ee0fe,null));};exports[_0xecb1('0x3c')]=function(_0x3bc342,_0x16f8a3){var _0x2d08e9=_0xecb1('0x3d');var _0x5afde1=path[_0xecb1('0x3e')](_0xecb1('0x3f'),'log',_0xecb1('0x40'),_0x2d08e9);_0x16f8a3['setHeader'](_0xecb1('0x41'),_0xecb1('0x42')+_0x2d08e9);_0x16f8a3[_0xecb1('0x20')](_0xecb1('0x43'),_0xecb1('0x44'));_0x16f8a3[_0xecb1('0x45')](_0x5afde1);}; \ No newline at end of file +var _0x80d9=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','model','keys','License','rawAttributes','query','filters','attributes','intersection','fields','length','options','getLicense','catch','body','find','params','key','license-info.log','join','/var','log','xcally','Content-disposition','attachment;\x20filename=','text/plain','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','squel','crypto','to-csv','querystring','papaparse','ioredis'];(function(_0x35389a,_0x1816c2){var _0x16058d=function(_0x5ae171){while(--_0x5ae171){_0x35389a['push'](_0x35389a['shift']());}};_0x16058d(++_0x1816c2);}(_0x80d9,0x1cd));var _0x980d=function(_0x571964,_0x5c3ef2){_0x571964=_0x571964-0x0;var _0x114803=_0x80d9[_0x571964];return _0x114803;};'use strict';var emlformat=require(_0x980d('0x0'));var rimraf=require(_0x980d('0x1'));var zipdir=require(_0x980d('0x2'));var jsonpatch=require(_0x980d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x980d('0x4'));var Mustache=require(_0x980d('0x5'));var util=require(_0x980d('0x6'));var path=require(_0x980d('0x7'));var sox=require(_0x980d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x980d('0x9'));var crypto=require(_0x980d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x980d('0xb'));var querystring=require(_0x980d('0xc'));var Papa=require(_0x980d('0xd'));var Redis=require(_0x980d('0xe'));var authService=require(_0x980d('0xf'));var qs=require(_0x980d('0x10'));var as=require(_0x980d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x980d('0x12'))(_0x980d('0x13'));var utils=require(_0x980d('0x14'));var config=require(_0x980d('0x15'));var licenseUtil=require(_0x980d('0x16'));var db=require(_0x980d('0x17'))['db'];function respondWithStatusCode(_0x3deea0,_0xf38e4a){_0xf38e4a=_0xf38e4a||0xcc;return function(_0x59d0de){if(_0x59d0de){return _0x3deea0[_0x980d('0x18')](_0xf38e4a);}return _0x3deea0[_0x980d('0x19')](_0xf38e4a)[_0x980d('0x1a')]();};}function respondWithResult(_0x210765,_0x1f40c0){_0x1f40c0=_0x1f40c0||0xc8;return function(_0x419938){if(_0x419938){return _0x210765['status'](_0x1f40c0)[_0x980d('0x1b')](_0x419938);}};}function respondWithFilteredResult(_0x32887c,_0x2435bd){return function(_0x9a9e33){if(_0x9a9e33){var _0x56f0be=typeof _0x2435bd[_0x980d('0x1c')]===_0x980d('0x1d')&&typeof _0x2435bd[_0x980d('0x1e')]==='undefined';var _0x24354f=_0x9a9e33['count'];var _0x471951=_0x56f0be?0x0:_0x2435bd['offset'];var _0x48fbde=_0x56f0be?_0x9a9e33[_0x980d('0x1f')]:_0x2435bd[_0x980d('0x1c')]+_0x2435bd[_0x980d('0x1e')];var _0x191dcf;if(_0x48fbde>=_0x24354f){_0x48fbde=_0x24354f;_0x191dcf=0xc8;}else{_0x191dcf=0xce;}_0x32887c['status'](_0x191dcf);return _0x32887c[_0x980d('0x20')](_0x980d('0x21'),_0x471951+'-'+_0x48fbde+'/'+_0x24354f)['json'](_0x9a9e33);}return null;};}function patchUpdates(_0x49aa0e){return function(_0x496d0f){try{jsonpatch[_0x980d('0x22')](_0x496d0f,_0x49aa0e,!![]);}catch(_0xab7814){return BPromise['reject'](_0xab7814);}return _0x496d0f[_0x980d('0x23')]();};}function saveUpdates(_0x384eac,_0x31fc6d){return function(_0x6f3cdc){if(_0x6f3cdc){return _0x6f3cdc[_0x980d('0x24')](_0x384eac)[_0x980d('0x25')](function(_0x3957c7){return _0x3957c7;});}return null;};}function removeEntity(_0x2346c4,_0xf758c3){return function(_0x4698aa){if(_0x4698aa){return _0x4698aa['destroy']()[_0x980d('0x25')](function(){_0x2346c4[_0x980d('0x19')](0xcc)[_0x980d('0x1a')]();});}};}function handleEntityNotFound(_0x399813,_0x145663){return function(_0x1e3586){if(!_0x1e3586){_0x399813[_0x980d('0x18')](0x194);}return _0x1e3586;};}function handleError(_0x1d776e,_0x3f41a6){_0x3f41a6=_0x3f41a6||0x1f4;return function(_0x58ad0d){logger[_0x980d('0x26')](_0x58ad0d[_0x980d('0x27')]);if(_0x58ad0d['name']){delete _0x58ad0d[_0x980d('0x28')];}_0x1d776e[_0x980d('0x19')](_0x3f41a6)[_0x980d('0x29')](_0x58ad0d);};}var utilLicense=require(_0x980d('0x16'));exports[_0x980d('0x2a')]=function(_0x3d0033,_0x4693a5){var _0x4ede4f={'raw':!![],'where':{'id':0x1}},_0xfd8510={};_0xfd8510[_0x980d('0x2b')]=_[_0x980d('0x2c')](db[_0x980d('0x2d')][_0x980d('0x2e')]);_0xfd8510[_0x980d('0x2f')]=_[_0x980d('0x2c')](_0x3d0033['query']);_0xfd8510[_0x980d('0x30')]=_['intersection'](_0xfd8510[_0x980d('0x2b')],_0xfd8510[_0x980d('0x2f')]);_0x4ede4f[_0x980d('0x31')]=_[_0x980d('0x32')](_0xfd8510[_0x980d('0x2b')],qs[_0x980d('0x33')](_0x3d0033['query'][_0x980d('0x33')]));_0x4ede4f[_0x980d('0x31')]=_0x4ede4f[_0x980d('0x31')][_0x980d('0x34')]?_0x4ede4f[_0x980d('0x31')]:_0xfd8510[_0x980d('0x2b')];_0x4ede4f=_['merge']({},_0x4ede4f,_0x3d0033[_0x980d('0x35')]);return utilLicense[_0x980d('0x36')](_0x4ede4f)[_0x980d('0x25')](respondWithResult(_0x4693a5,null))[_0x980d('0x37')](handleError(_0x4693a5,null));};exports['update']=function(_0x57f945,_0x1e2071){if(_0x57f945[_0x980d('0x38')]['id']){delete _0x57f945['body']['id'];}return db[_0x980d('0x2d')][_0x980d('0x39')]({'where':{'id':_0x57f945[_0x980d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x1e2071,null))['then'](function(_0x5d85ed){var _0x23eaf5=_0x5d85ed['get']({'plain':!![]});return utilLicense['checkLicense'](_0x23eaf5,_0x57f945['body'][_0x980d('0x3b')]);})['then'](function(_0x3ed847){if(!_0x3ed847['demo']){return saveUpdates(_0x57f945[_0x980d('0x38')],null);}return _0x3ed847;})[_0x980d('0x25')](respondWithResult(_0x1e2071,null))[_0x980d('0x37')](handleError(_0x1e2071,null));};exports['downloadLogFile']=function(_0x50bde4,_0x431b6e){var _0x577820=_0x980d('0x3c');var _0x258ee6=path[_0x980d('0x3d')](_0x980d('0x3e'),_0x980d('0x3f'),_0x980d('0x40'),_0x577820);_0x431b6e['setHeader'](_0x980d('0x41'),_0x980d('0x42')+_0x577820);_0x431b6e[_0x980d('0x20')]('Content-Type',_0x980d('0x43'));_0x431b6e['download'](_0x258ee6);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index de2e356..1db009d 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 _0xd563=['util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./license.attributes','exports','License','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0xd563,0x135));var _0x3d56=function(_0x1c05b2,_0x15de64){_0x1c05b2=_0x1c05b2-0x0;var _0x468af6=_0xd563[_0x1c05b2];return _0x468af6;};'use strict';var _=require(_0x3d56('0x0'));var util=require(_0x3d56('0x1'));var logger=require(_0x3d56('0x2'))('api');var moment=require(_0x3d56('0x3'));var BPromise=require(_0x3d56('0x4'));var rp=require(_0x3d56('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3d56('0x6'));var attributes=require(_0x3d56('0x7'));module[_0x3d56('0x8')]=function(_0x210dbd,_0x5089bb){return _0x210dbd['define'](_0x3d56('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbdb8=['api','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash','util','../../config/logger'];(function(_0x167a99,_0x1bbb59){var _0x442d62=function(_0x12c3f8){while(--_0x12c3f8){_0x167a99['push'](_0x167a99['shift']());}};_0x442d62(++_0x1bbb59);}(_0xbdb8,0x190));var _0x8bdb=function(_0x527365,_0x36fb3a){_0x527365=_0x527365-0x0;var _0x5de073=_0xbdb8[_0x527365];return _0x5de073;};'use strict';var _=require(_0x8bdb('0x0'));var util=require(_0x8bdb('0x1'));var logger=require(_0x8bdb('0x2'))(_0x8bdb('0x3'));var moment=require('moment');var BPromise=require(_0x8bdb('0x4'));var rp=require(_0x8bdb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8bdb('0x6'));var config=require(_0x8bdb('0x7'));var attributes=require(_0x8bdb('0x8'));module[_0x8bdb('0x9')]=function(_0x2acec0,_0x91472c){return _0x2acec0[_0x8bdb('0xa')](_0x8bdb('0xb'),attributes,{'tableName':_0x8bdb('0xc'),'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 6b7d8f7..2fa9c96 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 _0xebd0=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','License,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch'];(function(_0x2b152a,_0x3dd988){var _0x2ad4c7=function(_0x2fa97c){while(--_0x2fa97c){_0x2b152a['push'](_0x2b152a['shift']());}};_0x2ad4c7(++_0x3dd988);}(_0xebd0,0x1cc));var _0x0ebd=function(_0x4cc3a4,_0x219374){_0x4cc3a4=_0x4cc3a4-0x0;var _0x3f64c2=_0xebd0[_0x4cc3a4];return _0x3f64c2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0ebd('0x0'));var BPromise=require(_0x0ebd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ebd('0x2'));var db=require(_0x0ebd('0x3'))['db'];var utils=require(_0x0ebd('0x4'));var logger=require(_0x0ebd('0x5'))(_0x0ebd('0x6'));var config=require(_0x0ebd('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0ebd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42ae2e,_0x4a25e9,_0x1c48b8){return new BPromise(function(_0x2d63ea,_0x3f1846){return client[_0x0ebd('0x9')](_0x42ae2e,_0x1c48b8)[_0x0ebd('0xa')](function(_0x4fadbf){logger[_0x0ebd('0xb')](_0x0ebd('0xc'),_0x4a25e9,'request\x20sent');logger[_0x0ebd('0xd')]('License,\x20%s,\x20%s,\x20%s',_0x4a25e9,_0x0ebd('0xe'),JSON[_0x0ebd('0xf')](_0x4fadbf));if(_0x4fadbf['error']){if(_0x4fadbf[_0x0ebd('0x10')]['code']===0x1f4){logger[_0x0ebd('0x10')](_0x0ebd('0xc'),_0x4a25e9,_0x4fadbf[_0x0ebd('0x10')][_0x0ebd('0x11')]);return _0x3f1846(_0x4fadbf[_0x0ebd('0x10')][_0x0ebd('0x11')]);}logger[_0x0ebd('0x10')](_0x0ebd('0xc'),_0x4a25e9,_0x4fadbf[_0x0ebd('0x10')]['message']);return _0x2d63ea(_0x4fadbf[_0x0ebd('0x10')][_0x0ebd('0x11')]);}else{logger[_0x0ebd('0xb')](_0x0ebd('0xc'),_0x4a25e9,_0x0ebd('0xe'));_0x2d63ea(_0x4fadbf[_0x0ebd('0x12')][_0x0ebd('0x11')]);}})[_0x0ebd('0x13')](function(_0x3a795f){logger[_0x0ebd('0x10')](_0x0ebd('0xc'),_0x4a25e9,_0x3a795f);_0x3f1846(_0x3a795f);});});} \ No newline at end of file +var _0x64f1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring'];(function(_0x3e81d0,_0x10c528){var _0x5401af=function(_0x1ece6c){while(--_0x1ece6c){_0x3e81d0['push'](_0x3e81d0['shift']());}};_0x5401af(++_0x10c528);}(_0x64f1,0x81));var _0x164f=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x64f1[_0xbb9dbf];return _0x30223c;};'use strict';var _=require(_0x164f('0x0'));var util=require(_0x164f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x164f('0x2'));var fs=require('fs');var Redis=require(_0x164f('0x3'));var db=require(_0x164f('0x4'))['db'];var utils=require(_0x164f('0x5'));var logger=require(_0x164f('0x6'))(_0x164f('0x7'));var config=require(_0x164f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x164f('0x9')][_0x164f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4167f8,_0x2139d2,_0x27bb44){return new BPromise(function(_0x1f11ed,_0x25d7c0){return client['request'](_0x4167f8,_0x27bb44)['then'](function(_0x4d6b82){logger[_0x164f('0xb')](_0x164f('0xc'),_0x2139d2,_0x164f('0xd'));logger[_0x164f('0xe')](_0x164f('0xf'),_0x2139d2,_0x164f('0xd'),JSON[_0x164f('0x10')](_0x4d6b82));if(_0x4d6b82[_0x164f('0x11')]){if(_0x4d6b82[_0x164f('0x11')][_0x164f('0x12')]===0x1f4){logger[_0x164f('0x11')]('License,\x20%s,\x20%s',_0x2139d2,_0x4d6b82[_0x164f('0x11')][_0x164f('0x13')]);return _0x25d7c0(_0x4d6b82[_0x164f('0x11')]['message']);}logger[_0x164f('0x11')](_0x164f('0xc'),_0x2139d2,_0x4d6b82[_0x164f('0x11')][_0x164f('0x13')]);return _0x1f11ed(_0x4d6b82['error'][_0x164f('0x13')]);}else{logger[_0x164f('0xb')](_0x164f('0xc'),_0x2139d2,_0x164f('0xd'));_0x1f11ed(_0x4d6b82[_0x164f('0x14')]['message']);}})[_0x164f('0x15')](function(_0x57f5a5){logger[_0x164f('0x11')]('License,\x20%s,\x20%s',_0x2139d2,_0x57f5a5);_0x25d7c0(_0x57f5a5);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 1e3f9c4..54cbe06 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 _0x388c=['getDispositions','getImap','getSmtp','getInteractions','getMessages','getAgents','post','addDisposition','/:id/canned_answers','/:id/in_servers','addImap','/:id/out_servers','/:id/interactions','addInteraction','/:id/applications','addApplications','/:id/send','/:id/users','addAgents','update','delete','removeAnswers','removeImap','removeSmtp','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x388c,0xc2));var _0xc388=function(_0x5d6208,_0x570ed1){_0x5d6208=_0x5d6208-0x0;var _0x53079e=_0x388c[_0x5d6208];return _0x53079e;};'use strict';var multer=require('multer');var util=require(_0xc388('0x0'));var path=require('path');var timeout=require(_0xc388('0x1'));var express=require(_0xc388('0x2'));var router=express[_0xc388('0x3')]();var fs_extra=require(_0xc388('0x4'));var auth=require(_0xc388('0x5'));var interaction=require(_0xc388('0x6'));var config=require(_0xc388('0x7'));var controller=require('./mailAccount.controller');router[_0xc388('0x8')]('/',auth[_0xc388('0x9')](),controller[_0xc388('0xa')]);router[_0xc388('0x8')](_0xc388('0xb'),auth[_0xc388('0x9')](),controller[_0xc388('0xc')]);router[_0xc388('0x8')](_0xc388('0xd'),auth[_0xc388('0x9')](),controller[_0xc388('0xe')]);router[_0xc388('0x8')](_0xc388('0xf'),auth[_0xc388('0x9')](),controller[_0xc388('0x10')]);router['get']('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router[_0xc388('0x8')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xc388('0x11')]);router['get']('/:id/out_servers',auth['isAuthenticated'](),controller[_0xc388('0x12')]);router[_0xc388('0x8')]('/:id/interactions',auth[_0xc388('0x9')](),controller[_0xc388('0x13')]);router[_0xc388('0x8')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xc388('0x8')]('/:id/messages',auth[_0xc388('0x9')](),controller[_0xc388('0x14')]);router[_0xc388('0x8')]('/:id/verify',auth['isAuthenticated'](),controller['verifySmtp']);router[_0xc388('0x8')]('/:id/users',auth[_0xc388('0x9')](),controller[_0xc388('0x15')]);router[_0xc388('0x16')]('/:id/dispositions',auth[_0xc388('0x9')](),controller[_0xc388('0x17')]);router[_0xc388('0x16')](_0xc388('0x18'),auth[_0xc388('0x9')](),controller['addAnswer']);router[_0xc388('0x16')]('/',auth[_0xc388('0x9')](),controller['create']);router['post'](_0xc388('0x19'),auth[_0xc388('0x9')](),controller[_0xc388('0x1a')]);router[_0xc388('0x16')](_0xc388('0x1b'),auth[_0xc388('0x9')](),controller['addSmtp']);router[_0xc388('0x16')](_0xc388('0x1c'),auth[_0xc388('0x9')](),controller[_0xc388('0x1d')]);router['post'](_0xc388('0x1e'),auth[_0xc388('0x9')](),controller[_0xc388('0x1f')]);router['post'](_0xc388('0x20'),auth[_0xc388('0x9')](),controller['send']);router[_0xc388('0x16')](_0xc388('0x21'),auth[_0xc388('0x9')](),controller[_0xc388('0x22')]);router['put'](_0xc388('0xd'),auth[_0xc388('0x9')](),controller[_0xc388('0x23')]);router['delete']('/:id/dispositions',auth[_0xc388('0x9')](),controller['removeDispositions']);router[_0xc388('0x24')](_0xc388('0x18'),auth[_0xc388('0x9')](),controller[_0xc388('0x25')]);router[_0xc388('0x24')](_0xc388('0x19'),auth['isAuthenticated'](),controller[_0xc388('0x26')]);router[_0xc388('0x24')](_0xc388('0x1b'),auth[_0xc388('0x9')](),controller[_0xc388('0x27')]);router[_0xc388('0x24')](_0xc388('0xd'),auth[_0xc388('0x9')](),controller['destroy']);router[_0xc388('0x24')](_0xc388('0x21'),auth[_0xc388('0x9')](),controller[_0xc388('0x28')]);module[_0xc388('0x29')]=router; \ No newline at end of file +var _0x00ab=['../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/verify','post','addDisposition','addAnswer','create','addImap','/:id/out_servers','addSmtp','/:id/send','send','/:id/users','addAgents','put','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2b68a0,_0x31dd39){var _0x3da45d=function(_0x3c180c){while(--_0x3c180c){_0x2b68a0['push'](_0x2b68a0['shift']());}};_0x3da45d(++_0x31dd39);}(_0x00ab,0xb4));var _0xb00a=function(_0x1c175c,_0x4b8402){_0x1c175c=_0x1c175c-0x0;var _0x1dc19f=_0x00ab[_0x1c175c];return _0x1dc19f;};'use strict';var multer=require(_0xb00a('0x0'));var util=require(_0xb00a('0x1'));var path=require(_0xb00a('0x2'));var timeout=require(_0xb00a('0x3'));var express=require(_0xb00a('0x4'));var router=express['Router']();var fs_extra=require(_0xb00a('0x5'));var auth=require(_0xb00a('0x6'));var interaction=require(_0xb00a('0x7'));var config=require(_0xb00a('0x8'));var controller=require(_0xb00a('0x9'));router[_0xb00a('0xa')]('/',auth[_0xb00a('0xb')](),controller[_0xb00a('0xc')]);router['get'](_0xb00a('0xd'),auth[_0xb00a('0xb')](),controller[_0xb00a('0xe')]);router[_0xb00a('0xa')](_0xb00a('0xf'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x10')]);router[_0xb00a('0xa')](_0xb00a('0x11'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x12')]);router[_0xb00a('0xa')](_0xb00a('0x13'),auth[_0xb00a('0xb')](),controller['getAnswers']);router['get'](_0xb00a('0x14'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x15')]);router['get']('/:id/out_servers',auth[_0xb00a('0xb')](),controller['getSmtp']);router[_0xb00a('0xa')](_0xb00a('0x16'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x17')]);router[_0xb00a('0xa')](_0xb00a('0x18'),auth['isAuthenticated'](),controller[_0xb00a('0x19')]);router[_0xb00a('0xa')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb00a('0x1a'),auth[_0xb00a('0xb')](),controller['verifySmtp']);router[_0xb00a('0xa')]('/:id/users',auth[_0xb00a('0xb')](),controller['getAgents']);router[_0xb00a('0x1b')](_0xb00a('0x11'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x1c')]);router[_0xb00a('0x1b')](_0xb00a('0x13'),auth['isAuthenticated'](),controller[_0xb00a('0x1d')]);router['post']('/',auth[_0xb00a('0xb')](),controller[_0xb00a('0x1e')]);router[_0xb00a('0x1b')](_0xb00a('0x14'),auth['isAuthenticated'](),controller[_0xb00a('0x1f')]);router[_0xb00a('0x1b')](_0xb00a('0x20'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x21')]);router[_0xb00a('0x1b')](_0xb00a('0x16'),auth[_0xb00a('0xb')](),controller['addInteraction']);router[_0xb00a('0x1b')](_0xb00a('0x18'),auth[_0xb00a('0xb')](),controller['addApplications']);router[_0xb00a('0x1b')](_0xb00a('0x22'),auth['isAuthenticated'](),controller[_0xb00a('0x23')]);router[_0xb00a('0x1b')](_0xb00a('0x24'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x25')]);router[_0xb00a('0x26')]('/:id',auth[_0xb00a('0xb')](),controller['update']);router[_0xb00a('0x27')](_0xb00a('0x11'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x28')]);router[_0xb00a('0x27')]('/:id/canned_answers',auth[_0xb00a('0xb')](),controller[_0xb00a('0x29')]);router[_0xb00a('0x27')](_0xb00a('0x14'),auth['isAuthenticated'](),controller[_0xb00a('0x2a')]);router['delete'](_0xb00a('0x20'),auth[_0xb00a('0xb')](),controller[_0xb00a('0x2b')]);router[_0xb00a('0x27')](_0xb00a('0xf'),auth['isAuthenticated'](),controller[_0xb00a('0x2c')]);router[_0xb00a('0x27')](_0xb00a('0x24'),auth['isAuthenticated'](),controller[_0xb00a('0x2d')]);module[_0xb00a('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index cfb7f00..73593ff 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 _0x1381=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT'];(function(_0x216f28,_0x4a6bb6){var _0x529289=function(_0x9758ff){while(--_0x9758ff){_0x216f28['push'](_0x216f28['shift']());}};_0x529289(++_0x4a6bb6);}(_0x1381,0x1e1));var _0x1138=function(_0x305288,_0x432dac){_0x305288=_0x305288-0x0;var _0x116691=_0x1381[_0x305288];return _0x116691;};'use strict';var Sequelize=require(_0x1138('0x0'));module[_0x1138('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x1138('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x1138('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x1138('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x1138('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x1138('0x4')]},'markAsUnread':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x1138('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1138('0x6');}},'notificationSound':{'type':Sequelize[_0x1138('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1138('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1138('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1138('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1138('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1138('0x7')},'mandatoryDisposition':{'type':Sequelize[_0x1138('0x3')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x2a2125){if(!_0x2a2125)this[_0x1138('0x8')](_0x1138('0x9'),null);this[_0x1138('0x8')]('mandatoryDisposition',_0x2a2125);}},'provider':{'type':Sequelize[_0x1138('0xa')](_0x1138('0xb'),_0x1138('0xc'),_0x1138('0xd'),_0x1138('0xe')),'defaultValue':null,'get':function(){if(!this[_0x1138('0xf')]('provider'))return _0x1138('0x10');return this[_0x1138('0xf')]('provider');},'set':function(_0x5ea667){if(_0x5ea667===_0x1138('0x10'))_0x5ea667=null;return this[_0x1138('0x8')](_0x1138('0x11'),_0x5ea667);}}}; \ No newline at end of file +var _0x76fb=['setDataValue','mandatoryDisposition','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x46cc9f,_0x3fc6da){var _0x1d7d3b=function(_0x5108e3){while(--_0x5108e3){_0x46cc9f['push'](_0x46cc9f['shift']());}};_0x1d7d3b(++_0x3fc6da);}(_0x76fb,0xf1));var _0xb76f=function(_0x3583b7,_0x51c8f7){_0x3583b7=_0x3583b7-0x0;var _0x335795=_0x76fb[_0x3583b7];return _0x335795;};'use strict';var Sequelize=require(_0xb76f('0x0'));module[_0xb76f('0x1')]={'description':{'type':Sequelize[_0xb76f('0x2')]},'name':{'type':Sequelize[_0xb76f('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xb76f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb76f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xb76f('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb76f('0x2')],'allowNull':![],'defaultValue':_0xb76f('0x5')},'fontSize':{'type':Sequelize[_0xb76f('0x6')](0x2)[_0xb76f('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb76f('0x4')],'defaultValue':function(){return _0xb76f('0x8');}},'notificationSound':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb76f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb76f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb76f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xb76f('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xb76f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb76f('0x3')],'defaultValue':![],'comment':_0xb76f('0xa'),'set':function(_0x16523e){if(!_0x16523e)this[_0xb76f('0xb')]('mandatoryDispositionPauseId',null);this[_0xb76f('0xb')](_0xb76f('0xc'),_0x16523e);}},'provider':{'type':Sequelize['ENUM']('gmail',_0xb76f('0xd'),'yahoo',_0xb76f('0xe')),'defaultValue':null,'get':function(){if(!this[_0xb76f('0xf')](_0xb76f('0x10')))return'custom';return this[_0xb76f('0xf')](_0xb76f('0x10'));},'set':function(_0x11bfea){if(_0x11bfea===_0xb76f('0x11'))_0x11bfea=null;return this['setDataValue']('provider',_0x11bfea);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 6ac6b1f..22f39f8 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 _0x0e5c=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','register','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','gmail','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','rows','params','length','options','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','addInteraction','omit','CmContact','Contact','User','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','List','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','defaults','messageId','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','removeAgents','isArray','userMailAccount:remove','bluebird','util','path','lodash','juice'];(function(_0xf03704,_0x405597){var _0x2e1e39=function(_0x744087){while(--_0x744087){_0xf03704['push'](_0xf03704['shift']());}};_0x2e1e39(++_0x405597);}(_0x0e5c,0xbb));var _0xc0e5=function(_0x54c10d,_0x2f2251){_0x54c10d=_0x54c10d-0x0;var _0x1fa703=_0x0e5c[_0x54c10d];return _0x1fa703;};'use strict';var moment=require('moment');var BPromise=require(_0xc0e5('0x0'));var util=require(_0xc0e5('0x1'));var path=require(_0xc0e5('0x2'));var _=require(_0xc0e5('0x3'));var juice=require(_0xc0e5('0x4'));var Redis=require('ioredis');var qs=require(_0xc0e5('0x5'));var logger=require(_0xc0e5('0x6'))(_0xc0e5('0x7'));var config=require(_0xc0e5('0x8'));var db=require(_0xc0e5('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc0e5('0xa'))(new Redis(config[_0xc0e5('0xb')]));require('./mailAccount.socket')[_0xc0e5('0xc')](socket);var jayson=require(_0xc0e5('0xd'));var client=jayson[_0xc0e5('0xe')]['http']({'port':0x232b});function respondWithRpcPromise(_0x68945d,_0x11d99d,_0x17ee98,_0x5121c6){return new BPromise(function(_0x2665d1,_0x4177a0){var _0x34bdf9=_0x5121c6||client;return _0x34bdf9[_0xc0e5('0xf')](_0x68945d,_0x17ee98)[_0xc0e5('0x10')](function(_0x150097){logger[_0xc0e5('0x11')](_0xc0e5('0x12'),_0x11d99d,'request\x20sent');logger['debug'](_0xc0e5('0x13'),_0x11d99d,_0xc0e5('0x14'),JSON[_0xc0e5('0x15')](_0x150097));if(_0x150097[_0xc0e5('0x16')]){if(_0x150097[_0xc0e5('0x16')][_0xc0e5('0x17')]===0x1f4){logger[_0xc0e5('0x16')](_0xc0e5('0x12'),_0x11d99d,_0x150097[_0xc0e5('0x16')]['message']);return _0x4177a0(_0x150097[_0xc0e5('0x16')][_0xc0e5('0x18')]);}logger[_0xc0e5('0x16')]('MailAccount,\x20%s,\x20%s',_0x11d99d,_0x150097[_0xc0e5('0x16')][_0xc0e5('0x18')]);return _0x2665d1(_0x150097[_0xc0e5('0x16')][_0xc0e5('0x18')]);}else{logger['info'](_0xc0e5('0x12'),_0x11d99d,_0xc0e5('0x14'));_0x2665d1(_0x150097['result'][_0xc0e5('0x18')]);}})[_0xc0e5('0x19')](function(_0x263ac4){logger[_0xc0e5('0x16')](_0xc0e5('0x12'),_0x11d99d,_0x263ac4);_0x4177a0(_0x263ac4);});});}function respondWithStatusCode(_0xec2e3b,_0x129bae){_0x129bae=_0x129bae||0xcc;return function(_0x1993fb){if(_0x1993fb){return _0xec2e3b[_0xc0e5('0x1a')](_0x129bae);}return _0xec2e3b['status'](_0x129bae)[_0xc0e5('0x1b')]();};}function respondWithResult(_0x1ce37d,_0x5643e9){_0x5643e9=_0x5643e9||0xc8;return function(_0x4d9c38){if(_0x4d9c38){return _0x1ce37d[_0xc0e5('0x1c')](_0x5643e9)[_0xc0e5('0x1d')](_0x4d9c38);}};}function respondWithFilteredResult(_0x4cdb17,_0x3aa3b){return function(_0x1a5b29){if(_0x1a5b29){var _0x35a94a=typeof _0x3aa3b[_0xc0e5('0x1e')]===_0xc0e5('0x1f')&&typeof _0x3aa3b[_0xc0e5('0x20')]===_0xc0e5('0x1f');var _0xfdb4a9=_0x1a5b29[_0xc0e5('0x21')];var _0x1979fc=_0x35a94a?0x0:_0x3aa3b[_0xc0e5('0x1e')];var _0x4d2e2b=_0x35a94a?_0x1a5b29[_0xc0e5('0x21')]:_0x3aa3b[_0xc0e5('0x1e')]+_0x3aa3b[_0xc0e5('0x20')];var _0x93deef;if(_0x4d2e2b>=_0xfdb4a9){_0x4d2e2b=_0xfdb4a9;_0x93deef=0xc8;}else{_0x93deef=0xce;}_0x4cdb17[_0xc0e5('0x1c')](_0x93deef);return _0x4cdb17['set'](_0xc0e5('0x22'),_0x1979fc+'-'+_0x4d2e2b+'/'+_0xfdb4a9)['json'](_0x1a5b29);}return null;};}function saveUpdates(_0x1ab74f){return function(_0xb2cee9){if(_0xb2cee9){return _0xb2cee9[_0xc0e5('0x23')](_0x1ab74f)[_0xc0e5('0x10')](function(_0x2cb54b){return _0x2cb54b;});}return null;};}function removeEntity(_0xdbaa9e){return function(_0x8fafee){if(_0x8fafee){return _0x8fafee[_0xc0e5('0x24')]()['then'](function(){var _0x12fbc9=_0x8fafee[_0xc0e5('0x25')]({'plain':!![]});var _0x30beae=_0xc0e5('0x26');return db[_0xc0e5('0x27')]['destroy']({'where':{'type':_0x30beae,'resourceId':_0x12fbc9['id']}})[_0xc0e5('0x10')](function(){return _0x8fafee;});})[_0xc0e5('0x10')](function(){_0xdbaa9e['status'](0xcc)[_0xc0e5('0x1b')]();});}};}function handleEntityNotFound(_0x34d12c){return function(_0x1532af){if(!_0x1532af){_0x34d12c[_0xc0e5('0x1a')](0x194);}return _0x1532af;};}function handleError(_0x15fac5,_0x4b3c14){_0x4b3c14=_0x4b3c14||0x1f4;return function(_0x5238ed){logger['error'](_0x5238ed[_0xc0e5('0x28')]);if(_0x5238ed[_0xc0e5('0x29')]){delete _0x5238ed[_0xc0e5('0x29')];}_0x15fac5[_0xc0e5('0x1c')](_0x4b3c14)[_0xc0e5('0x2a')](_0x5238ed);};}function getImapHost(_0x37eaa1){switch(_0x37eaa1){case _0xc0e5('0x2b'):return'imap.gmail.com';case'yahoo':return _0xc0e5('0x2c');case'hotmail':return _0xc0e5('0x2d');case _0xc0e5('0x2e'):return _0xc0e5('0x2f');}throw new Error(_0xc0e5('0x30'),_0x37eaa1);}function getSmtpHost(_0xfdeee2){switch(_0xfdeee2){case _0xc0e5('0x2b'):return _0xc0e5('0x31');case _0xc0e5('0x32'):return _0xc0e5('0x33');case _0xc0e5('0x34'):return _0xc0e5('0x35');case'outlook365':return _0xc0e5('0x36');}throw new Error(_0xc0e5('0x30'),_0xfdeee2);}function getAuthenticationOptions(_0x365d4e,_0x8c51f8){var _0x144491={};var _0x3c07fd={};if(_0x365d4e){_0x144491[_0xc0e5('0x37')]=_0x3c07fd[_0xc0e5('0x37')]=_0x8c51f8[_0xc0e5('0x38')];_0x144491[_0xc0e5('0x39')]=_0x3c07fd[_0xc0e5('0x3a')]=_0x8c51f8[_0xc0e5('0x39')];if(_0x8c51f8[_0xc0e5('0x3b')]){_0x144491[_0xc0e5('0x3b')]=_0x3c07fd['modernAuthentication']=!![];_0x144491[_0xc0e5('0x3c')]=_0x3c07fd[_0xc0e5('0x3c')]=_0x8c51f8[_0xc0e5('0x3c')];_0x144491[_0xc0e5('0x39')]=_0x3c07fd['pass']=null;}else{_0x144491[_0xc0e5('0x3c')]=_0x3c07fd[_0xc0e5('0x3c')]=null;}_0x144491[_0xc0e5('0x3d')]=getImapHost(_0x365d4e);_0x144491[_0xc0e5('0x3e')]=0x3e1;_0x3c07fd[_0xc0e5('0x3d')]=getSmtpHost(_0x365d4e);_0x3c07fd[_0xc0e5('0x3e')]=0x24b;_0x3c07fd['secure']=![];_0x144491[_0xc0e5('0x3f')]=_0x3c07fd[_0xc0e5('0x3f')]=null;}else{if(_0x8c51f8['authentication']){_0x144491['user']=_0x3c07fd[_0xc0e5('0x37')]=_0x8c51f8[_0xc0e5('0x38')];_0x144491[_0xc0e5('0x39')]=_0x3c07fd[_0xc0e5('0x3a')]=_0x8c51f8[_0xc0e5('0x39')];}else{_0x144491[_0xc0e5('0x40')]=_0x3c07fd['authentication']=![];_0x144491['user']=_0x3c07fd[_0xc0e5('0x37')]=null;_0x144491[_0xc0e5('0x39')]=_0x3c07fd['pass']=null;}_0x144491[_0xc0e5('0x3d')]=_0x8c51f8[_0xc0e5('0x41')][_0xc0e5('0x3d')];_0x144491[_0xc0e5('0x3e')]=_0x8c51f8[_0xc0e5('0x41')][_0xc0e5('0x3e')];_0x3c07fd['host']=_0x8c51f8['Smtp'][_0xc0e5('0x3d')];_0x3c07fd[_0xc0e5('0x3e')]=_0x8c51f8[_0xc0e5('0x42')]['port'];}return{'Imap':_0x144491,'Smtp':_0x3c07fd};}exports[_0xc0e5('0x43')]=function(_0x2550cd,_0xcd4fc2){var _0x21b69d={'include':[{'model':db[_0xc0e5('0x44')],'as':_0xc0e5('0x41')},{'model':db[_0xc0e5('0x45')],'as':'Smtp'},{'model':db[_0xc0e5('0x46')],'as':_0xc0e5('0x47')}]},_0x3d1913={},_0x1459a6={'count':0x0,'rows':[]};var _0x253d67=_['map'](db[_0xc0e5('0x48')][_0xc0e5('0x49')],function(_0x234706){return{'name':_0x234706['fieldName'],'type':_0x234706[_0xc0e5('0x4a')][_0xc0e5('0x4b')]};});_0x3d1913[_0xc0e5('0x4c')]=_[_0xc0e5('0x4d')](_0x253d67,'name');_0x3d1913[_0xc0e5('0x4e')]=_[_0xc0e5('0x4f')](_0x2550cd[_0xc0e5('0x4e')]);_0x3d1913['filters']=_[_0xc0e5('0x50')](_0x3d1913[_0xc0e5('0x4c')],_0x3d1913[_0xc0e5('0x4e')]);_0x21b69d[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x3d1913[_0xc0e5('0x4c')],qs[_0xc0e5('0x52')](_0x2550cd[_0xc0e5('0x4e')][_0xc0e5('0x52')]));_0x21b69d[_0xc0e5('0x51')]=_0x21b69d[_0xc0e5('0x51')]['length']?_0x21b69d[_0xc0e5('0x51')]:_0x3d1913[_0xc0e5('0x4c')];if(!_0x2550cd['query'][_0xc0e5('0x53')](_0xc0e5('0x54'))){_0x21b69d[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0x2550cd[_0xc0e5('0x4e')][_0xc0e5('0x20')]);_0x21b69d['offset']=qs[_0xc0e5('0x1e')](_0x2550cd[_0xc0e5('0x4e')][_0xc0e5('0x1e')]);}_0x21b69d[_0xc0e5('0x55')]=qs[_0xc0e5('0x56')](_0x2550cd[_0xc0e5('0x4e')]['sort']);_0x21b69d[_0xc0e5('0x57')]=qs[_0xc0e5('0x58')](_['pick'](_0x2550cd['query'],_0x3d1913[_0xc0e5('0x58')]),_0x253d67);if(_0x2550cd['query'][_0xc0e5('0x59')]){_0x21b69d['where']=_[_0xc0e5('0x5a')](_0x21b69d['where'],{'$or':_['map'](_0x253d67,function(_0x212470){if(_0x212470['type']!==_0xc0e5('0x5b')){var _0xc6c659={};_0xc6c659[_0x212470[_0xc0e5('0x29')]]={'$like':'%'+_0x2550cd[_0xc0e5('0x4e')]['filter']+'%'};return _0xc6c659;}})});}_0x21b69d=_[_0xc0e5('0x5a')]({},_0x21b69d,_0x2550cd['options']);var _0x277f42={'where':_0x21b69d['where']};return db[_0xc0e5('0x48')]['count'](_0x277f42)['then'](function(_0x520de9){_0x1459a6[_0xc0e5('0x21')]=_0x520de9;if(_0x2550cd['query'][_0xc0e5('0x5c')]){_0x21b69d[_0xc0e5('0x5d')]=[{'all':!![]}];}return db[_0xc0e5('0x48')]['findAll'](_0x21b69d);})[_0xc0e5('0x10')](function(_0xc65f6e){_0x1459a6[_0xc0e5('0x5e')]=_0xc65f6e;return _0x1459a6;})[_0xc0e5('0x10')](respondWithFilteredResult(_0xcd4fc2,_0x21b69d))[_0xc0e5('0x19')](handleError(_0xcd4fc2,null));};exports['show']=function(_0x4d0390,_0x4dbd0a){var _0x1facf9={'raw':![],'where':{'id':_0x4d0390[_0xc0e5('0x5f')]['id']},'include':[{'model':db[_0xc0e5('0x44')],'as':_0xc0e5('0x41')},{'model':db['MailServerOut'],'as':_0xc0e5('0x42')},{'model':db['Pause'],'as':_0xc0e5('0x47')}]},_0x345793={};_0x345793['model']=_['keys'](db['MailAccount'][_0xc0e5('0x49')]);_0x345793[_0xc0e5('0x4e')]=_['keys'](_0x4d0390[_0xc0e5('0x4e')]);_0x345793['filters']=_[_0xc0e5('0x50')](_0x345793['model'],_0x345793['query']);_0x1facf9[_0xc0e5('0x51')]=_['intersection'](_0x345793[_0xc0e5('0x4c')],qs['fields'](_0x4d0390[_0xc0e5('0x4e')]['fields']));_0x1facf9['attributes']=_0x1facf9[_0xc0e5('0x51')][_0xc0e5('0x60')]?_0x1facf9[_0xc0e5('0x51')]:_0x345793[_0xc0e5('0x4c')];if(_0x4d0390['query']['includeAll']){_0x1facf9['include']=[{'all':!![]}];}_0x1facf9=_[_0xc0e5('0x5a')]({},_0x1facf9,_0x4d0390[_0xc0e5('0x61')]);return db[_0xc0e5('0x48')][_0xc0e5('0x62')](_0x1facf9)[_0xc0e5('0x10')](handleEntityNotFound(_0x4dbd0a,null))[_0xc0e5('0x10')](respondWithResult(_0x4dbd0a,null))[_0xc0e5('0x19')](handleError(_0x4dbd0a,null));};exports[_0xc0e5('0x23')]=function(_0xbacd65,_0x3e5896){if(_0xbacd65[_0xc0e5('0x63')]['id']){delete _0xbacd65['body']['id'];}var _0x98479b=_0xbacd65['body'][_0xc0e5('0x64')]===_0xc0e5('0x65')?null:_0xbacd65[_0xc0e5('0x63')]['provider'];var _0xbc5cca=_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x41')]||{};var _0x473166=_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x42')]||{};if(_0x98479b){_0xbc5cca[_0xc0e5('0x3d')]=getImapHost(_0x98479b);_0xbc5cca['port']=0x3e1;_0x473166['host']=getSmtpHost(_0x98479b);_0x473166[_0xc0e5('0x3e')]=0x24b;_0x473166[_0xc0e5('0x66')]=![];}if(_0x473166[_0xc0e5('0x3b')]){_0x473166['secure']=![];}else{_0x473166[_0xc0e5('0x3c')]=null;}if(!_0xbc5cca[_0xc0e5('0x3b')])_0xbc5cca[_0xc0e5('0x3c')]=null;_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x41')]=_0xbc5cca;_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x42')]=_0x473166;return db[_0xc0e5('0x48')]['find']({'where':{'id':_0xbacd65['params']['id']},'include':[{'model':db[_0xc0e5('0x44')],'as':'Imap'},{'model':db[_0xc0e5('0x45')],'as':'Smtp'},{'model':db[_0xc0e5('0x46')],'as':'mandatoryDispositionPause'}]})[_0xc0e5('0x10')](handleEntityNotFound(_0x3e5896,null))[_0xc0e5('0x10')](function(_0x4fdae2){if(!_0x4fdae2)throw new Error(_0xc0e5('0x67'));if(_0x4fdae2[_0xc0e5('0x3f')])delete _0xbacd65[_0xc0e5('0x63')]['Imap'];return _0x4fdae2;})['then'](saveUpdates(_0xbacd65[_0xc0e5('0x63')],null))[_0xc0e5('0x10')](function(_0x108b04){if(!_0xbacd65[_0xc0e5('0x63')]['Imap'])return _0x108b04;return db['MailServerIn'][_0xc0e5('0x23')](_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x41')],{'where':{'MailAccountId':_0x108b04['id']}})[_0xc0e5('0x10')](function(){return _0x108b04;});})[_0xc0e5('0x10')](function(_0x55e4f1){if(!_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x42')])return _0x55e4f1;return db[_0xc0e5('0x45')][_0xc0e5('0x23')](_0xbacd65[_0xc0e5('0x63')][_0xc0e5('0x42')],{'where':{'MailAccountId':_0x55e4f1['id']}})[_0xc0e5('0x10')](function(){return _0x55e4f1;});})['then'](respondWithResult(_0x3e5896,null))[_0xc0e5('0x19')](handleError(_0x3e5896,null));};exports[_0xc0e5('0x68')]=function(_0x4bf741,_0x3932c0){return db[_0xc0e5('0x48')][_0xc0e5('0x68')]()[_0xc0e5('0x10')](respondWithResult(_0x3932c0,null))[_0xc0e5('0x19')](handleError(_0x3932c0,null));};exports[_0xc0e5('0x69')]=function(_0x29dfe5,_0x249b8f){if(_0x29dfe5[_0xc0e5('0x63')]['id']){delete _0x29dfe5[_0xc0e5('0x63')]['id'];}return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x29dfe5[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x249b8f,null))[_0xc0e5('0x10')](function(_0x249983){if(_0x249983){_0x29dfe5[_0xc0e5('0x63')][_0xc0e5('0x6a')]=_0x249983['id'];return db[_0xc0e5('0x6b')][_0xc0e5('0x6c')](_0x29dfe5['body']);}})[_0xc0e5('0x10')](respondWithResult(_0x249b8f,null))[_0xc0e5('0x19')](handleError(_0x249b8f,null));};exports[_0xc0e5('0x6d')]=function(_0x228b1c,_0x47a172){var _0x339b9f={'raw':![],'where':{}};var _0x2f8f93={};var _0x49dc23={'count':0x0,'rows':[]};return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x228b1c['params']['id']}})['then'](handleEntityNotFound(_0x47a172,null))['then'](function(_0x2cd4d2){if(_0x2cd4d2){_0x2f8f93[_0xc0e5('0x4c')]=_[_0xc0e5('0x4f')](db[_0xc0e5('0x6b')][_0xc0e5('0x49')]);_0x2f8f93['query']=_['keys'](_0x228b1c[_0xc0e5('0x4e')]);_0x2f8f93[_0xc0e5('0x58')]=_['intersection'](_0x2f8f93['model'],_0x2f8f93[_0xc0e5('0x4e')]);_0x339b9f[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x2f8f93[_0xc0e5('0x4c')],qs[_0xc0e5('0x52')](_0x228b1c[_0xc0e5('0x4e')]['fields']));_0x339b9f[_0xc0e5('0x51')]=_0x339b9f[_0xc0e5('0x51')][_0xc0e5('0x60')]?_0x339b9f[_0xc0e5('0x51')]:_0x2f8f93[_0xc0e5('0x4c')];if(!_0x228b1c[_0xc0e5('0x4e')][_0xc0e5('0x53')](_0xc0e5('0x54'))){_0x339b9f[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0x228b1c[_0xc0e5('0x4e')][_0xc0e5('0x20')]);_0x339b9f[_0xc0e5('0x1e')]=qs[_0xc0e5('0x1e')](_0x228b1c[_0xc0e5('0x4e')][_0xc0e5('0x1e')]);}_0x339b9f['order']=qs[_0xc0e5('0x56')](_0x228b1c[_0xc0e5('0x4e')][_0xc0e5('0x56')]);_0x339b9f[_0xc0e5('0x57')]=qs[_0xc0e5('0x58')](_[_0xc0e5('0x6f')](_0x228b1c[_0xc0e5('0x4e')],_0x2f8f93[_0xc0e5('0x58')]));_0x339b9f[_0xc0e5('0x57')][_0xc0e5('0x6a')]=_0x2cd4d2['id'];if(_0x228b1c[_0xc0e5('0x4e')]['filter']){_0x339b9f['where']=_[_0xc0e5('0x5a')](_0x339b9f[_0xc0e5('0x57')],{'$or':_['map'](_0x339b9f[_0xc0e5('0x51')],function(_0x3ebb8c){var _0x3636bb={};_0x3636bb[_0x3ebb8c]={'$like':'%'+_0x228b1c[_0xc0e5('0x4e')][_0xc0e5('0x59')]+'%'};return _0x3636bb;})});}_0x339b9f=_[_0xc0e5('0x5a')]({},_0x339b9f,_0x228b1c[_0xc0e5('0x61')]);return db[_0xc0e5('0x6b')][_0xc0e5('0x21')]({'where':_0x339b9f[_0xc0e5('0x57')]})[_0xc0e5('0x10')](function(_0x4dd5dd){_0x49dc23[_0xc0e5('0x21')]=_0x4dd5dd;if(_0x228b1c['query'][_0xc0e5('0x5c')]){_0x339b9f[_0xc0e5('0x5d')]=[{'all':!![]}];}return db['Disposition'][_0xc0e5('0x70')](_0x339b9f);})[_0xc0e5('0x10')](function(_0x4020ae){_0x49dc23[_0xc0e5('0x5e')]=_0x4020ae;return _0x49dc23;});}})[_0xc0e5('0x10')](respondWithFilteredResult(_0x47a172,_0x339b9f))[_0xc0e5('0x19')](handleError(_0x47a172,null));};exports[_0xc0e5('0x71')]=function(_0x419c71,_0x26917d){return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x419c71['params']['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x26917d,null))[_0xc0e5('0x10')](function(_0x4bcc81){if(_0x4bcc81){return _0x4bcc81[_0xc0e5('0x71')](_0x419c71[_0xc0e5('0x4e')][_0xc0e5('0x72')]);}})['then'](respondWithStatusCode(_0x26917d,null))['catch'](handleError(_0x26917d,null));};exports[_0xc0e5('0x73')]=function(_0x317a36,_0x96d308){if(_0x317a36[_0xc0e5('0x63')]['id']){delete _0x317a36[_0xc0e5('0x63')]['id'];}return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x317a36[_0xc0e5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x96d308,null))[_0xc0e5('0x10')](function(_0x3e8023){if(_0x3e8023){_0x317a36['body'][_0xc0e5('0x6a')]=_0x3e8023['id'];return db[_0xc0e5('0x74')]['create'](_0x317a36[_0xc0e5('0x63')]);}})['then'](respondWithResult(_0x96d308,null))[_0xc0e5('0x19')](handleError(_0x96d308,null));};exports['getAnswers']=function(_0xd0a4,_0x13a97e){var _0x1b3c89={'raw':![],'where':{}};var _0x27e832={};var _0x561a06={'count':0x0,'rows':[]};return db['MailAccount'][_0xc0e5('0x6e')]({'where':{'id':_0xd0a4[_0xc0e5('0x5f')]['id']}})['then'](handleEntityNotFound(_0x13a97e,null))['then'](function(_0x56e140){if(_0x56e140){_0x27e832[_0xc0e5('0x4c')]=_[_0xc0e5('0x4f')](db[_0xc0e5('0x74')]['rawAttributes']);_0x27e832[_0xc0e5('0x4e')]=_[_0xc0e5('0x4f')](_0xd0a4[_0xc0e5('0x4e')]);_0x27e832[_0xc0e5('0x58')]=_['intersection'](_0x27e832[_0xc0e5('0x4c')],_0x27e832['query']);_0x1b3c89['attributes']=_[_0xc0e5('0x50')](_0x27e832['model'],qs[_0xc0e5('0x52')](_0xd0a4[_0xc0e5('0x4e')]['fields']));_0x1b3c89[_0xc0e5('0x51')]=_0x1b3c89[_0xc0e5('0x51')][_0xc0e5('0x60')]?_0x1b3c89[_0xc0e5('0x51')]:_0x27e832[_0xc0e5('0x4c')];if(!_0xd0a4[_0xc0e5('0x4e')][_0xc0e5('0x53')](_0xc0e5('0x54'))){_0x1b3c89[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0xd0a4['query'][_0xc0e5('0x20')]);_0x1b3c89[_0xc0e5('0x1e')]=qs['offset'](_0xd0a4[_0xc0e5('0x4e')]['offset']);}_0x1b3c89[_0xc0e5('0x55')]=qs[_0xc0e5('0x56')](_0xd0a4[_0xc0e5('0x4e')]['sort']);_0x1b3c89[_0xc0e5('0x57')]=qs[_0xc0e5('0x58')](_[_0xc0e5('0x6f')](_0xd0a4[_0xc0e5('0x4e')],_0x27e832[_0xc0e5('0x58')]));_0x1b3c89[_0xc0e5('0x57')][_0xc0e5('0x6a')]=_0x56e140['id'];if(_0xd0a4[_0xc0e5('0x4e')]['filter']){_0x1b3c89['where']=_[_0xc0e5('0x5a')](_0x1b3c89['where'],{'$or':_[_0xc0e5('0x4d')](_0x1b3c89[_0xc0e5('0x51')],function(_0x52bc53){var _0x157ebd={};_0x157ebd[_0x52bc53]={'$like':'%'+_0xd0a4[_0xc0e5('0x4e')]['filter']+'%'};return _0x157ebd;})});}_0x1b3c89=_[_0xc0e5('0x5a')]({},_0x1b3c89,_0xd0a4[_0xc0e5('0x61')]);return db[_0xc0e5('0x74')][_0xc0e5('0x21')]({'where':_0x1b3c89['where']})[_0xc0e5('0x10')](function(_0x170fa6){_0x561a06[_0xc0e5('0x21')]=_0x170fa6;if(_0xd0a4[_0xc0e5('0x4e')]['includeAll']){_0x1b3c89[_0xc0e5('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc0e5('0x70')](_0x1b3c89);})['then'](function(_0x380a5c){_0x561a06['rows']=_0x380a5c;return _0x561a06;});}})[_0xc0e5('0x10')](respondWithFilteredResult(_0x13a97e,_0x1b3c89))[_0xc0e5('0x19')](handleError(_0x13a97e,null));};exports[_0xc0e5('0x75')]=function(_0x2b6234,_0x265e97){return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x2b6234['params']['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x265e97,null))['then'](function(_0x2d1916){if(_0x2d1916){return _0x2d1916[_0xc0e5('0x75')](_0x2b6234['query'][_0xc0e5('0x72')]);}})['then'](respondWithStatusCode(_0x265e97,null))['catch'](handleError(_0x265e97,null));};exports['create']=function(_0x47c5cf,_0x594fdc){var _0x4872c8={'name':_0x47c5cf[_0xc0e5('0x63')][_0xc0e5('0x29')],'key':_0x47c5cf[_0xc0e5('0x63')][_0xc0e5('0x4b')],'provider':_0x47c5cf[_0xc0e5('0x63')][_0xc0e5('0x64')]===_0xc0e5('0x65')?null:_0x47c5cf[_0xc0e5('0x63')][_0xc0e5('0x64')],'email':_0x47c5cf[_0xc0e5('0x63')]['email'],'ListId':_0x47c5cf[_0xc0e5('0x63')][_0xc0e5('0x76')],'active':!_[_0xc0e5('0x77')](_0x47c5cf['body'][_0xc0e5('0x78')])?_0x47c5cf[_0xc0e5('0x63')]['active']:!![],'description':_0x47c5cf['body']['description']||null};var _0x24b4d9=getAuthenticationOptions(_0x4872c8[_0xc0e5('0x64')],_0x47c5cf[_0xc0e5('0x63')]);_0x4872c8[_0xc0e5('0x41')]=_0x24b4d9[_0xc0e5('0x41')];_0x4872c8[_0xc0e5('0x42')]=_0x24b4d9[_0xc0e5('0x42')];return db['MailAccount'][_0xc0e5('0x6c')](_0x4872c8,{'include':[{'model':db[_0xc0e5('0x45')],'as':_0xc0e5('0x42')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xc0e5('0x10')](function(_0x469f2d){var _0x411a73=_0x47c5cf[_0xc0e5('0x37')][_0xc0e5('0x25')]({'plain':!![]});if(!_0x411a73)throw new Error(_0xc0e5('0x79'));if(_0x411a73['role']===_0xc0e5('0x37')){var _0x4b5845=_0x469f2d[_0xc0e5('0x25')]({'plain':!![]});return db[_0xc0e5('0x7a')][_0xc0e5('0x62')]({'where':{'name':_0xc0e5('0x26'),'userProfileId':_0x411a73[_0xc0e5('0x7b')]},'raw':!![]})[_0xc0e5('0x10')](function(_0x17675d){if(_0x17675d&&_0x17675d['autoAssociation']===0x0){return db[_0xc0e5('0x27')][_0xc0e5('0x6c')]({'name':_0x4b5845[_0xc0e5('0x29')],'resourceId':_0x4b5845['id'],'type':_0x17675d[_0xc0e5('0x29')],'sectionId':_0x17675d['id']},{})[_0xc0e5('0x10')](function(){return _0x469f2d;});}else{return _0x469f2d;}})[_0xc0e5('0x19')](function(_0x36e567){logger[_0xc0e5('0x16')](_0xc0e5('0x7c'),_0x36e567);throw _0x36e567;});}return _0x469f2d;})[_0xc0e5('0x10')](respondWithResult(_0x594fdc,0xc9))[_0xc0e5('0x19')](handleError(_0x594fdc,null));};exports[_0xc0e5('0x7d')]=function(_0x465dc3,_0x153471){return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x465dc3[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x153471,null))[_0xc0e5('0x10')](function(_0xa4e48e){if(_0xa4e48e){return _0xa4e48e[_0xc0e5('0x7d')]();}return null;})[_0xc0e5('0x10')](respondWithResult(_0x153471,null))[_0xc0e5('0x19')](handleError(_0x153471,null));};exports['addImap']=function(_0x2a15e0,_0x5f2d44){if(_0x2a15e0['body']['id']){delete _0x2a15e0[_0xc0e5('0x63')]['id'];}return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x2a15e0[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x5f2d44,null))['then'](function(_0x3efb14){if(_0x3efb14){_0x2a15e0[_0xc0e5('0x63')][_0xc0e5('0x6a')]=_0x3efb14['id'];return db[_0xc0e5('0x44')][_0xc0e5('0x6c')](_0x2a15e0[_0xc0e5('0x63')]);}})[_0xc0e5('0x10')](respondWithResult(_0x5f2d44,null))[_0xc0e5('0x19')](handleError(_0x5f2d44,null));};exports[_0xc0e5('0x7e')]=function(_0x1ae989,_0x68539e){return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x1ae989['params']['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x68539e,null))['then'](function(_0x38e6c2){if(_0x38e6c2){return _0x38e6c2[_0xc0e5('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x68539e,null))[_0xc0e5('0x19')](handleError(_0x68539e,null));};exports[_0xc0e5('0x80')]=function(_0x2d0ce7,_0x1a7167){return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x2d0ce7['params']['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x1a7167,null))[_0xc0e5('0x10')](function(_0x4a87f1){if(_0x4a87f1){return _0x4a87f1['getSmtp']();}return null;})[_0xc0e5('0x10')](respondWithResult(_0x1a7167,null))[_0xc0e5('0x19')](handleError(_0x1a7167,null));};exports[_0xc0e5('0x81')]=function(_0x112393,_0x38fef1){if(_0x112393[_0xc0e5('0x63')]['id']){delete _0x112393[_0xc0e5('0x63')]['id'];}return db[_0xc0e5('0x48')]['find']({'where':{'id':_0x112393[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x38fef1,null))[_0xc0e5('0x10')](function(_0x14b449){if(_0x14b449){_0x112393[_0xc0e5('0x63')][_0xc0e5('0x6a')]=_0x14b449['id'];return db[_0xc0e5('0x45')][_0xc0e5('0x6c')](_0x112393['body']);}})['then'](respondWithResult(_0x38fef1,null))[_0xc0e5('0x19')](handleError(_0x38fef1,null));};exports[_0xc0e5('0x82')]=function(_0x5c94a9,_0x1b88f2){return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x5c94a9[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x1b88f2,null))['then'](function(_0x2d4957){if(_0x2d4957){return _0x2d4957[_0xc0e5('0x83')](null);}return null;})['then'](respondWithStatusCode(_0x1b88f2,null))[_0xc0e5('0x19')](handleError(_0x1b88f2,null));};exports['addInteraction']=function(_0x30e7d3,_0x12ce4b){return db[_0xc0e5('0x84')][_0xc0e5('0x62')]({'where':{'id':_0x30e7d3[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x12ce4b,null))[_0xc0e5('0x10')](function(_0x417ae2){if(_0x417ae2){return _0x417ae2[_0xc0e5('0x85')](_0x30e7d3[_0xc0e5('0x63')][_0xc0e5('0x72')],_[_0xc0e5('0x86')](_0x30e7d3['body'],[_0xc0e5('0x72'),'id'])||{});}})[_0xc0e5('0x10')](respondWithResult(_0x12ce4b,null))[_0xc0e5('0x19')](handleError(_0x12ce4b,null));};exports['getInteractions']=function(_0x1e5bea,_0x50d195){var _0x5bc7ef={'raw':![],'where':{}};var _0x1766b3={};var _0x199c15={'count':0x0,'rows':[]};return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x1e5bea[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x50d195,null))[_0xc0e5('0x10')](function(_0x2dce39){if(_0x2dce39){_0x1766b3['model']=_[_0xc0e5('0x4f')](db[_0xc0e5('0x84')][_0xc0e5('0x49')]);_0x1766b3[_0xc0e5('0x4e')]=_['keys'](_0x1e5bea[_0xc0e5('0x4e')]);_0x1766b3[_0xc0e5('0x58')]=_[_0xc0e5('0x50')](_0x1766b3['model'],_0x1766b3[_0xc0e5('0x4e')]);_0x5bc7ef[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x1766b3['model'],qs[_0xc0e5('0x52')](_0x1e5bea['query'][_0xc0e5('0x52')]));_0x5bc7ef[_0xc0e5('0x51')]=_0x5bc7ef[_0xc0e5('0x51')]['length']?_0x5bc7ef[_0xc0e5('0x51')]:_0x1766b3[_0xc0e5('0x4c')];if(!_0x1e5bea[_0xc0e5('0x4e')][_0xc0e5('0x53')](_0xc0e5('0x54'))){_0x5bc7ef[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0x1e5bea[_0xc0e5('0x4e')][_0xc0e5('0x20')]);_0x5bc7ef['offset']=qs[_0xc0e5('0x1e')](_0x1e5bea[_0xc0e5('0x4e')]['offset']);}_0x5bc7ef['order']=qs['sort'](_0x1e5bea['query']['sort']);_0x5bc7ef[_0xc0e5('0x57')]=qs[_0xc0e5('0x58')](_[_0xc0e5('0x6f')](_0x1e5bea[_0xc0e5('0x4e')],_0x1766b3[_0xc0e5('0x58')]));_0x5bc7ef[_0xc0e5('0x57')][_0xc0e5('0x6a')]=_0x2dce39['id'];if(_0x1e5bea[_0xc0e5('0x4e')]['filter']){_0x5bc7ef[_0xc0e5('0x57')]=_['merge'](_0x5bc7ef['where'],{'$or':_[_0xc0e5('0x4d')](_0x5bc7ef['attributes'],function(_0x4e5636){var _0xf496d7={};_0xf496d7[_0x4e5636]={'$like':'%'+_0x1e5bea['query'][_0xc0e5('0x59')]+'%'};return _0xf496d7;})});}_0x5bc7ef=_['merge']({},_0x5bc7ef,_0x1e5bea[_0xc0e5('0x61')]);return db[_0xc0e5('0x84')][_0xc0e5('0x21')]({'where':_0x5bc7ef['where']})[_0xc0e5('0x10')](function(_0x37ac60){_0x199c15[_0xc0e5('0x21')]=_0x37ac60;if(_0x1e5bea[_0xc0e5('0x4e')]['includeAll']){_0x5bc7ef[_0xc0e5('0x5d')]=[{'model':db[_0xc0e5('0x87')],'as':_0xc0e5('0x88'),'required':![]},{'model':db[_0xc0e5('0x89')],'as':_0xc0e5('0x8a'),'attributes':[_0xc0e5('0x29'),_0xc0e5('0x8b'),_0xc0e5('0x8c')],'required':![]},{'model':db['Tag'],'as':_0xc0e5('0x8d'),'attributes':['id',_0xc0e5('0x29'),'color'],'where':_0x1e5bea['query'][_0xc0e5('0x8e')]?{'id':_0x1e5bea[_0xc0e5('0x4e')][_0xc0e5('0x8e')]}:undefined,'required':_0x1e5bea[_0xc0e5('0x4e')][_0xc0e5('0x8e')]?!![]:![]}];}return db[_0xc0e5('0x84')][_0xc0e5('0x70')](_0x5bc7ef);})[_0xc0e5('0x10')](function(_0x2f2a94){_0x199c15[_0xc0e5('0x5e')]=_0x2f2a94;return _0x199c15;});}})['then'](respondWithFilteredResult(_0x50d195,_0x5bc7ef))[_0xc0e5('0x19')](handleError(_0x50d195,null));};exports[_0xc0e5('0x8f')]=function addApplications(_0x3155f7,_0x2328f2){var _0x2cedf0=_0x3155f7[_0xc0e5('0x5f')]['id'];var _0x54c810=_0x3155f7[_0xc0e5('0x63')];var _0x48ff41=0xc8;var _0x5ccc10=null;return db[_0xc0e5('0x90')][_0xc0e5('0x91')]({'isolationLevel':db[_0xc0e5('0x90')]['Transaction']['ISOLATION_LEVELS'][_0xc0e5('0x92')]},function(_0x255fcb){return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x2cedf0},'transaction':_0x255fcb})['then'](function(_0x5e1ad3){if(_0x5e1ad3){return db['MailApplication'][_0xc0e5('0x24')]({'where':{'MailAccountId':_0x2cedf0},'transaction':_0x255fcb})[_0xc0e5('0x10')](function(){var _0x3b3ee3=_[_0xc0e5('0x4d')](_0x54c810,function(_0x58fafe){_0x58fafe[_0xc0e5('0x6a')]=_0x2cedf0;return _0x58fafe;});return db[_0xc0e5('0x93')][_0xc0e5('0x94')](_0x3b3ee3,{'transaction':_0x255fcb});});}else{_0x48ff41=0x194;_0x5ccc10=[];}});})[_0xc0e5('0x10')](function(){if(_0x48ff41!==0x194){return db[_0xc0e5('0x93')][_0xc0e5('0x95')]({'where':{'MailAccountId':_0x2cedf0},'order':'priority'})[_0xc0e5('0x10')](function(_0x50984f){_0x5ccc10=_0x50984f;});}})[_0xc0e5('0x19')](function(_0x1b052c){_0x48ff41=0x1f4;logger[_0xc0e5('0x16')](_0x1b052c['stack']);if(_0x1b052c['name']){delete _0x1b052c[_0xc0e5('0x29')];}_0x5ccc10=_0x1b052c;})[_0xc0e5('0x96')](function(){if(_0x5ccc10===null){_0x2328f2[_0xc0e5('0x1a')](_0x48ff41);}else{if(_0x48ff41===0x1f4){_0x2328f2['status'](_0x48ff41)[_0xc0e5('0x2a')](_0x5ccc10);}else{_0x2328f2[_0xc0e5('0x1c')](_0x48ff41)[_0xc0e5('0x1d')](_0x5ccc10);}}});};exports[_0xc0e5('0x97')]=function(_0x55edb2,_0x1b2960){var _0x1f4c5b={};var _0x23ddd7={};var _0x42d98c;var _0x3ea08b;return db['MailAccount'][_0xc0e5('0x6e')]({'where':{'id':_0x55edb2[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x1b2960,null))['then'](function(_0x3f5dc1){if(_0x3f5dc1){_0x42d98c=_0x3f5dc1;_0x23ddd7[_0xc0e5('0x4c')]=_['keys'](db[_0xc0e5('0x93')][_0xc0e5('0x49')]);_0x23ddd7[_0xc0e5('0x4e')]=_[_0xc0e5('0x4f')](_0x55edb2[_0xc0e5('0x4e')]);_0x23ddd7[_0xc0e5('0x58')]=_['intersection'](_0x23ddd7[_0xc0e5('0x4c')],_0x23ddd7[_0xc0e5('0x4e')]);_0x1f4c5b[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x23ddd7[_0xc0e5('0x4c')],qs['fields'](_0x55edb2['query']['fields']));_0x1f4c5b[_0xc0e5('0x51')]=_0x1f4c5b[_0xc0e5('0x51')]['length']?_0x1f4c5b[_0xc0e5('0x51')]:_0x23ddd7[_0xc0e5('0x4c')];_0x1f4c5b[_0xc0e5('0x55')]=qs[_0xc0e5('0x56')](_0x55edb2[_0xc0e5('0x4e')][_0xc0e5('0x56')]);_0x1f4c5b[_0xc0e5('0x57')]=qs['filters'](_[_0xc0e5('0x6f')](_0x55edb2[_0xc0e5('0x4e')],_0x23ddd7[_0xc0e5('0x58')]));if(_0x55edb2[_0xc0e5('0x4e')][_0xc0e5('0x59')]){_0x1f4c5b[_0xc0e5('0x57')]=_[_0xc0e5('0x5a')](_0x1f4c5b[_0xc0e5('0x57')],{'$or':_[_0xc0e5('0x4d')](_0x1f4c5b[_0xc0e5('0x51')],function(_0x39b2bd){var _0x12c1ca={};_0x12c1ca[_0x39b2bd]={'$like':'%'+_0x55edb2['query'][_0xc0e5('0x59')]+'%'};return _0x12c1ca;})});}_0x1f4c5b=_[_0xc0e5('0x5a')]({},_0x1f4c5b,_0x55edb2[_0xc0e5('0x61')]);return _0x42d98c[_0xc0e5('0x97')](_0x1f4c5b);}})[_0xc0e5('0x10')](function(_0x32eeb6){if(_0x32eeb6){_0x3ea08b=_0x32eeb6[_0xc0e5('0x60')];if(!_0x55edb2[_0xc0e5('0x4e')][_0xc0e5('0x53')]('nolimit')){_0x1f4c5b[_0xc0e5('0x20')]=qs['limit'](_0x55edb2[_0xc0e5('0x4e')][_0xc0e5('0x20')]);_0x1f4c5b['offset']=qs[_0xc0e5('0x1e')](_0x55edb2['query'][_0xc0e5('0x1e')]);}return _0x42d98c['getApplications'](_0x1f4c5b);}})[_0xc0e5('0x10')](function(_0x4629f0){if(_0x4629f0){return _0x4629f0?{'count':_0x3ea08b,'rows':_0x4629f0}:null;}})[_0xc0e5('0x10')](respondWithResult(_0x1b2960,null))['catch'](handleError(_0x1b2960,null));};exports[_0xc0e5('0x98')]=function(_0x29041c,_0x2d372b){var _0x4d3aa1={'raw':!![],'where':{}};var _0x343885={};var _0x52c01c={'count':0x0,'rows':[]};return db['MailAccount'][_0xc0e5('0x6e')]({'where':{'id':_0x29041c[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x2d372b,null))[_0xc0e5('0x10')](function(_0x57d844){if(_0x57d844){_0x343885['model']=_[_0xc0e5('0x4f')](db['MailMessage'][_0xc0e5('0x49')]);_0x343885[_0xc0e5('0x4e')]=_['keys'](_0x29041c[_0xc0e5('0x4e')]);_0x343885[_0xc0e5('0x58')]=_[_0xc0e5('0x50')](_0x343885[_0xc0e5('0x4c')],_0x343885[_0xc0e5('0x4e')]);_0x4d3aa1[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x343885[_0xc0e5('0x4c')],qs[_0xc0e5('0x52')](_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x52')]));_0x4d3aa1[_0xc0e5('0x51')]=_0x4d3aa1[_0xc0e5('0x51')][_0xc0e5('0x60')]?_0x4d3aa1[_0xc0e5('0x51')]:_0x343885[_0xc0e5('0x4c')];if(!_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x53')](_0xc0e5('0x54'))){_0x4d3aa1[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0x29041c['query']['limit']);_0x4d3aa1[_0xc0e5('0x1e')]=qs['offset'](_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x1e')]);}_0x4d3aa1[_0xc0e5('0x55')]=qs['sort'](_0x29041c['query']['sort']);_0x4d3aa1[_0xc0e5('0x57')]=qs['filters'](_['pick'](_0x29041c[_0xc0e5('0x4e')],_0x343885[_0xc0e5('0x58')]));_0x4d3aa1[_0xc0e5('0x57')]['MailAccountId']=_0x57d844['id'];if(_0x29041c['query']['filter']){_0x4d3aa1['where']=_[_0xc0e5('0x5a')](_0x4d3aa1[_0xc0e5('0x57')],{'$or':_[_0xc0e5('0x4d')](_0x4d3aa1[_0xc0e5('0x51')],function(_0x8dadf1){var _0x202fd4={};_0x202fd4[_0x8dadf1]={'$like':'%'+_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x59')]+'%'};return _0x202fd4;})});}if(_0x29041c['query'][_0xc0e5('0x99')]){var _0x15ad17=_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x99')][_0xc0e5('0x9a')](',');var _0x2a11c1={};_0x2a11c1[_0x15ad17[0x0]]={'$gte':moment(_0x15ad17[0x1])[_0xc0e5('0x9b')](_0xc0e5('0x9c'))};_0x4d3aa1[_0xc0e5('0x57')]=_[_0xc0e5('0x5a')](_0x4d3aa1[_0xc0e5('0x57')],_0x2a11c1);}_0x4d3aa1=_[_0xc0e5('0x5a')]({},_0x4d3aa1,_0x29041c[_0xc0e5('0x61')]);return db[_0xc0e5('0x9d')][_0xc0e5('0x21')]({'where':_0x4d3aa1[_0xc0e5('0x57')]})[_0xc0e5('0x10')](function(_0x36f8f7){_0x52c01c[_0xc0e5('0x21')]=_0x36f8f7;if(_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x5c')]){_0x4d3aa1[_0xc0e5('0x5d')]=[{'all':!![]}];}return db[_0xc0e5('0x9d')][_0xc0e5('0x70')](_0x4d3aa1);})[_0xc0e5('0x10')](function(_0x3e76da){if(_0x29041c[_0xc0e5('0x4e')][_0xc0e5('0x9e')]===_0xc0e5('0x9f')){for(var _0x4c5bd0=0x0;_0x4c5bd0<_0x3e76da['length'];_0x4c5bd0++){_0x3e76da[_0x4c5bd0]['body']=juice(_0x3e76da[_0x4c5bd0][_0xc0e5('0x63')]);}}_0x52c01c[_0xc0e5('0x5e')]=_0x3e76da;return _0x52c01c;});}})[_0xc0e5('0x10')](respondWithFilteredResult(_0x2d372b,_0x4d3aa1))[_0xc0e5('0x19')](handleError(_0x2d372b,null));};exports['send']=function(_0x53b10e,_0x394da0){var _0x12ee1e,_0x2fa473={},_0x1981cf;if(_0x53b10e[_0xc0e5('0x63')]['to']){_0x1981cf=_0x53b10e['body']['to'][_0xc0e5('0x9a')](',')[0x0];}return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x53b10e[_0xc0e5('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xc0e5('0xa0'),'include':[{'model':db[_0xc0e5('0x87')],'as':_0xc0e5('0xa1'),'where':{'email':_0x1981cf},'limit':0x1,'order':[[_0xc0e5('0xa2'),_0xc0e5('0xa3')]]}]},{'model':db[_0xc0e5('0x45')],'as':_0xc0e5('0x42'),'raw':!![],'include':[{'model':db[_0xc0e5('0xa4')],'as':_0xc0e5('0xa4'),'raw':!![]}]}]})[_0xc0e5('0x10')](handleEntityNotFound(_0x394da0,null))[_0xc0e5('0x10')](function(_0x27b24c){if(!_0x27b24c)return;_0x12ee1e=_0x27b24c;if(!_0x27b24c['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xc0e5('0x77')](_0x53b10e['body'][_0xc0e5('0xa5')])){_0x53b10e[_0xc0e5('0x63')]['from']=util[_0xc0e5('0x9b')](_0xc0e5('0xa6'),_0x27b24c[_0xc0e5('0x29')],_0x27b24c[_0xc0e5('0xa7')]||_0x27b24c[_0xc0e5('0x42')]['user']);}if(_0x53b10e['body'][_0xc0e5('0xa8')]&&_0x53b10e[_0xc0e5('0x63')][_0xc0e5('0xa8')]['length']){for(var _0x224729=0x0;_0x224729<_0x53b10e['body'][_0xc0e5('0xa8')][_0xc0e5('0x60')];_0x224729+=0x1){_0x53b10e[_0xc0e5('0x63')]['attachments'][_0x224729]={'filename':_0x53b10e[_0xc0e5('0x63')][_0xc0e5('0xa8')][_0x224729][_0xc0e5('0x29')],'path':path[_0xc0e5('0xa9')](config['root'],_0xc0e5('0xaa'),_0x53b10e['body'][_0xc0e5('0xa8')][_0x224729][_0xc0e5('0xab')])};}}var _0x25815c=_0x27b24c[_0xc0e5('0xac')]();return respondWithRpcPromise(_0xc0e5('0xad'),_0xc0e5('0xae'),{'account':_0x25815c,'message':_0x53b10e['body']});})[_0xc0e5('0x10')](function(_0x2fa529){if(!_0x2fa529)return;_0x2fa473=_0x2fa529;if(!_0x12ee1e[_0xc0e5('0xa0')])throw new Error(_0xc0e5('0xaf'));if(_0x12ee1e['List'][_0xc0e5('0xa1')][_0xc0e5('0x60')])return _0x12ee1e[_0xc0e5('0xa0')][_0xc0e5('0xa1')][0x0];return db[_0xc0e5('0x87')][_0xc0e5('0x6c')](_[_0xc0e5('0xb0')](_0x53b10e[_0xc0e5('0x63')],{'firstName':_0x53b10e[_0xc0e5('0x63')]['to'],'email':_0x53b10e[_0xc0e5('0x63')]['to'],'phone':_0x53b10e[_0xc0e5('0x63')]['to'],'ListId':_0x12ee1e[_0xc0e5('0x76')]}));})[_0xc0e5('0x10')](function(_0x527c13){if(!_0x527c13)return;var _0x3aa6a3={'UserId':_0x53b10e[_0xc0e5('0x37')]['id'],'ContactId':_0x527c13['id'],'MailAccountId':_0x12ee1e['id'],'inReplyTo':_0x2fa473[_0xc0e5('0xb1')],'to':_0x53b10e[_0xc0e5('0x63')][_0xc0e5('0xa5')],'cc':_0x53b10e[_0xc0e5('0x63')]['cc'],'subject':_0x53b10e[_0xc0e5('0x63')]['subject'],'attach':_0x53b10e['body'][_0xc0e5('0xb2')],'firstMsgDirection':_0xc0e5('0xb3'),'lastMsgAt':moment()[_0xc0e5('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':_0xc0e5('0xb3'),'Messages':[_[_0xc0e5('0x5a')](_0x53b10e[_0xc0e5('0x63')],{'messageId':_0x2fa473[_0xc0e5('0xb1')],'sentAt':moment()[_0xc0e5('0x9b')](_0xc0e5('0x9c')),'read':!![],'MailAccountId':_0x12ee1e['id'],'UserId':_0x53b10e[_0xc0e5('0x37')]['id'],'ContactId':_0x527c13['id']})]};if(_0x53b10e[_0xc0e5('0x63')][_0xc0e5('0xb4')]){_0x3aa6a3=_['merge'](_0x3aa6a3,_0x53b10e['body']['Interaction']);}return db[_0xc0e5('0x84')][_0xc0e5('0x6c')](_0x3aa6a3,{'include':[{'model':db[_0xc0e5('0x9d')],'as':_0xc0e5('0xb5')}]});})[_0xc0e5('0x10')](respondWithResult(_0x394da0,null))[_0xc0e5('0x19')](handleError(_0x394da0,null));};exports[_0xc0e5('0xb6')]=function(_0x1554b4,_0x41656f){return db['MailAccount']['find']({'where':{'id':_0x1554b4['params']['id']},'include':[{'model':db[_0xc0e5('0x45')],'as':_0xc0e5('0x42'),'raw':!![],'include':[{'model':db[_0xc0e5('0xa4')],'as':_0xc0e5('0xa4'),'raw':!![]}]}]})[_0xc0e5('0x10')](handleEntityNotFound(_0x41656f,null))[_0xc0e5('0x10')](function(_0x46055c){if(!_0x46055c[_0xc0e5('0x42')])return;var _0x5e68b9=_0x46055c['getSmtpOptions']();return respondWithRpcPromise(_0xc0e5('0xb7'),_0xc0e5('0xb6'),{'account':_0x5e68b9});})[_0xc0e5('0x10')](respondWithResult(_0x41656f,null))[_0xc0e5('0x19')](handleError(_0x41656f,null));};exports[_0xc0e5('0x24')]=function(_0x1e9cca,_0x239ea9){return db['MailAccount'][_0xc0e5('0x62')]({'where':{'id':_0x1e9cca[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x239ea9,null))['then'](function(_0x3e1ecc){if(_0x3e1ecc&&_0x3e1ecc[_0xc0e5('0x3f')]){throw new db[(_0xc0e5('0xb8'))]['ValidationError'](_0xc0e5('0xb9'));}return _0x3e1ecc;})['then'](removeEntity(_0x239ea9,null))['catch'](handleError(_0x239ea9,null));};exports[_0xc0e5('0xba')]=function(_0x19f40a,_0x57241e){return db[_0xc0e5('0x48')][_0xc0e5('0x62')]({'where':{'id':_0x19f40a[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x57241e,null))['then'](function(_0x21d979){if(_0x21d979){return _0x21d979[_0xc0e5('0xba')](_0x19f40a[_0xc0e5('0x63')][_0xc0e5('0x72')],_['omit'](_0x19f40a['body'],['ids','id'])||{})[_0xc0e5('0xbb')](function(_0x49b50a){for(var _0x5c93e5=0x0;_0x5c93e5<_0x19f40a[_0xc0e5('0x63')][_0xc0e5('0x72')]['length'];_0x5c93e5+=0x1){socket[_0xc0e5('0xbc')]('userMailAccount:save',{'UserId':Number(_0x19f40a['body']['ids'][_0x5c93e5]),'MailAccountId':Number(_0x19f40a['params']['id'])});}return _0x49b50a;});}})[_0xc0e5('0x10')](respondWithResult(_0x57241e,null))[_0xc0e5('0x19')](handleError(_0x57241e,null));};exports[_0xc0e5('0xbd')]=function(_0x549315,_0xcaea52){return db['MailAccount'][_0xc0e5('0x62')]({'where':{'id':_0x549315[_0xc0e5('0x5f')]['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0xcaea52,null))['then'](function(_0x455845){if(_0x455845){return _0x455845[_0xc0e5('0xbd')](_0x549315['query'][_0xc0e5('0x72')])[_0xc0e5('0x10')](function(){if(_[_0xc0e5('0xbe')](_0x549315['query'][_0xc0e5('0x72')])){for(var _0x573b5f=0x0;_0x573b5f<_0x549315[_0xc0e5('0x4e')][_0xc0e5('0x72')][_0xc0e5('0x60')];_0x573b5f+=0x1){socket[_0xc0e5('0xbc')](_0xc0e5('0xbf'),{'UserId':Number(_0x549315['query'][_0xc0e5('0x72')][_0x573b5f]),'MailAccountId':Number(_0x549315[_0xc0e5('0x5f')]['id'])});}}else{socket[_0xc0e5('0xbc')](_0xc0e5('0xbf'),{'UserId':Number(_0x549315[_0xc0e5('0x4e')][_0xc0e5('0x72')]),'MailAccountId':Number(_0x549315['params']['id'])});}});}})['then'](respondWithStatusCode(_0xcaea52,null))[_0xc0e5('0x19')](handleError(_0xcaea52,null));};exports['getAgents']=function(_0x2e2d6c,_0x50298c){var _0x2d8cd8={};var _0x33d406={};var _0x11825a;var _0x4b0752;return db[_0xc0e5('0x48')][_0xc0e5('0x6e')]({'where':{'id':_0x2e2d6c['params']['id']}})[_0xc0e5('0x10')](handleEntityNotFound(_0x50298c,null))['then'](function(_0x2c6025){if(_0x2c6025){_0x11825a=_0x2c6025;_0x33d406['model']=_[_0xc0e5('0x4f')](db[_0xc0e5('0x89')]['rawAttributes']);_0x33d406['query']=_[_0xc0e5('0x4f')](_0x2e2d6c['query']);_0x33d406['filters']=_['intersection'](_0x33d406[_0xc0e5('0x4c')],_0x33d406[_0xc0e5('0x4e')]);_0x2d8cd8[_0xc0e5('0x51')]=_[_0xc0e5('0x50')](_0x33d406[_0xc0e5('0x4c')],qs[_0xc0e5('0x52')](_0x2e2d6c[_0xc0e5('0x4e')][_0xc0e5('0x52')]));_0x2d8cd8[_0xc0e5('0x51')]=_0x2d8cd8[_0xc0e5('0x51')]['length']?_0x2d8cd8[_0xc0e5('0x51')]:_0x33d406[_0xc0e5('0x4c')];_0x2d8cd8[_0xc0e5('0x55')]=qs[_0xc0e5('0x56')](_0x2e2d6c[_0xc0e5('0x4e')][_0xc0e5('0x56')]);_0x2d8cd8[_0xc0e5('0x57')]=qs[_0xc0e5('0x58')](_[_0xc0e5('0x6f')](_0x2e2d6c['query'],_0x33d406[_0xc0e5('0x58')]));if(_0x2e2d6c[_0xc0e5('0x4e')]['filter']){_0x2d8cd8[_0xc0e5('0x57')]=_['merge'](_0x2d8cd8[_0xc0e5('0x57')],{'$or':_[_0xc0e5('0x4d')](_0x2d8cd8[_0xc0e5('0x51')],function(_0x533b23){var _0x2f08aa={};_0x2f08aa[_0x533b23]={'$like':'%'+_0x2e2d6c[_0xc0e5('0x4e')]['filter']+'%'};return _0x2f08aa;})});}_0x2d8cd8=_[_0xc0e5('0x5a')]({},_0x2d8cd8,_0x2e2d6c[_0xc0e5('0x61')]);return _0x11825a['getAgents'](_0x2d8cd8);}})['then'](function(_0x7a961d){if(_0x7a961d){_0x4b0752=_0x7a961d[_0xc0e5('0x60')];if(!_0x2e2d6c['query']['hasOwnProperty'](_0xc0e5('0x54'))){_0x2d8cd8[_0xc0e5('0x20')]=qs[_0xc0e5('0x20')](_0x2e2d6c['query']['limit']);_0x2d8cd8[_0xc0e5('0x1e')]=qs[_0xc0e5('0x1e')](_0x2e2d6c[_0xc0e5('0x4e')][_0xc0e5('0x1e')]);}return _0x11825a['getAgents'](_0x2d8cd8);}})[_0xc0e5('0x10')](function(_0x8d8d80){if(_0x8d8d80){return _0x8d8d80?{'count':_0x4b0752,'rows':_0x8d8d80}:null;}})[_0xc0e5('0x10')](respondWithResult(_0x50298c,null))[_0xc0e5('0x19')](handleError(_0x50298c,null));}; \ No newline at end of file +var _0x644f=['Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','User','moment','bluebird','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','request','info','request\x20sent','debug','stringify','error','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','UserProfileResource','end','stack','name','send','imap.gmail.com','hotmail','imap-mail.outlook.com','outlook365','gmail','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerIn','Pause','mandatoryDispositionPause','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','MailAccount','findAll','rows','catch','params','MailServerOut','rawAttributes','find','body','provider','custom','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','key','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','MailAccounts','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Owner','internal','color','tag','addApplications','transaction','sequelize','MailApplication','bulkCreate','finally','json','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','basename','getSmtpOptions','List','List\x20not\x20found','subject','attach','messageId','Interaction','Messages','verifySmtp','VerifySmtp'];(function(_0x18d52d,_0x5a720e){var _0x232aa4=function(_0x3e98a2){while(--_0x3e98a2){_0x18d52d['push'](_0x18d52d['shift']());}};_0x232aa4(++_0x5a720e);}(_0x644f,0xc2));var _0xf644=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x644f[_0x1bc0ae];return _0x501104;};'use strict';var moment=require(_0xf644('0x0'));var BPromise=require(_0xf644('0x1'));var util=require('util');var path=require('path');var _=require(_0xf644('0x2'));var juice=require(_0xf644('0x3'));var Redis=require(_0xf644('0x4'));var qs=require(_0xf644('0x5'));var logger=require(_0xf644('0x6'))(_0xf644('0x7'));var config=require(_0xf644('0x8'));var db=require(_0xf644('0x9'))['db'];config[_0xf644('0xa')]=_[_0xf644('0xb')](config[_0xf644('0xa')],{'host':_0xf644('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf644('0xa')]));require(_0xf644('0xd'))['register'](socket);var jayson=require(_0xf644('0xe'));var client=jayson['client']['http']({'port':0x232b});function respondWithRpcPromise(_0x390284,_0x4a490d,_0x2c7bd0,_0x865312){return new BPromise(function(_0x4d0b61,_0x466361){var _0x27c7c5=_0x865312||client;return _0x27c7c5[_0xf644('0xf')](_0x390284,_0x2c7bd0)['then'](function(_0x296647){logger[_0xf644('0x10')]('MailAccount,\x20%s,\x20%s',_0x4a490d,_0xf644('0x11'));logger[_0xf644('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x4a490d,_0xf644('0x11'),JSON[_0xf644('0x13')](_0x296647));if(_0x296647[_0xf644('0x14')]){if(_0x296647[_0xf644('0x14')]['code']===0x1f4){logger[_0xf644('0x14')](_0xf644('0x15'),_0x4a490d,_0x296647['error']['message']);return _0x466361(_0x296647['error']['message']);}logger[_0xf644('0x14')](_0xf644('0x15'),_0x4a490d,_0x296647[_0xf644('0x14')][_0xf644('0x16')]);return _0x4d0b61(_0x296647['error'][_0xf644('0x16')]);}else{logger[_0xf644('0x10')](_0xf644('0x15'),_0x4a490d,_0xf644('0x11'));_0x4d0b61(_0x296647[_0xf644('0x17')]['message']);}})['catch'](function(_0x37c32d){logger[_0xf644('0x14')](_0xf644('0x15'),_0x4a490d,_0x37c32d);_0x466361(_0x37c32d);});});}function respondWithStatusCode(_0x6a8936,_0x29f81a){_0x29f81a=_0x29f81a||0xcc;return function(_0x2bc954){if(_0x2bc954){return _0x6a8936[_0xf644('0x18')](_0x29f81a);}return _0x6a8936[_0xf644('0x19')](_0x29f81a)['end']();};}function respondWithResult(_0x14af1b,_0x1c36b4){_0x1c36b4=_0x1c36b4||0xc8;return function(_0x2180c6){if(_0x2180c6){return _0x14af1b[_0xf644('0x19')](_0x1c36b4)['json'](_0x2180c6);}};}function respondWithFilteredResult(_0x28a871,_0x3b863f){return function(_0x42b88b){if(_0x42b88b){var _0x17b2c6=typeof _0x3b863f[_0xf644('0x1a')]===_0xf644('0x1b')&&typeof _0x3b863f[_0xf644('0x1c')]==='undefined';var _0x4b6369=_0x42b88b[_0xf644('0x1d')];var _0x41b6a1=_0x17b2c6?0x0:_0x3b863f[_0xf644('0x1a')];var _0x383987=_0x17b2c6?_0x42b88b[_0xf644('0x1d')]:_0x3b863f[_0xf644('0x1a')]+_0x3b863f[_0xf644('0x1c')];var _0xa1b71f;if(_0x383987>=_0x4b6369){_0x383987=_0x4b6369;_0xa1b71f=0xc8;}else{_0xa1b71f=0xce;}_0x28a871['status'](_0xa1b71f);return _0x28a871[_0xf644('0x1e')](_0xf644('0x1f'),_0x41b6a1+'-'+_0x383987+'/'+_0x4b6369)['json'](_0x42b88b);}return null;};}function saveUpdates(_0x5acb2a){return function(_0x21fbc8){if(_0x21fbc8){return _0x21fbc8[_0xf644('0x20')](_0x5acb2a)[_0xf644('0x21')](function(_0x3881e3){return _0x3881e3;});}return null;};}function removeEntity(_0x2bcb20){return function(_0x1ef501){if(_0x1ef501){return _0x1ef501[_0xf644('0x22')]()['then'](function(){var _0x448c6e=_0x1ef501[_0xf644('0x23')]({'plain':!![]});var _0x4ad5ac='MailAccounts';return db[_0xf644('0x24')][_0xf644('0x22')]({'where':{'type':_0x4ad5ac,'resourceId':_0x448c6e['id']}})[_0xf644('0x21')](function(){return _0x1ef501;});})[_0xf644('0x21')](function(){_0x2bcb20[_0xf644('0x19')](0xcc)[_0xf644('0x25')]();});}};}function handleEntityNotFound(_0x1fd581){return function(_0x390b34){if(!_0x390b34){_0x1fd581[_0xf644('0x18')](0x194);}return _0x390b34;};}function handleError(_0x2206e8,_0x5914d8){_0x5914d8=_0x5914d8||0x1f4;return function(_0x52d05e){logger[_0xf644('0x14')](_0x52d05e[_0xf644('0x26')]);if(_0x52d05e[_0xf644('0x27')]){delete _0x52d05e[_0xf644('0x27')];}_0x2206e8[_0xf644('0x19')](_0x5914d8)[_0xf644('0x28')](_0x52d05e);};}function getImapHost(_0x17d6e2){switch(_0x17d6e2){case'gmail':return _0xf644('0x29');case'yahoo':return'imap.mail.yahoo.com';case _0xf644('0x2a'):return _0xf644('0x2b');case _0xf644('0x2c'):return'outlook.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x17d6e2);}function getSmtpHost(_0x3aa198){switch(_0x3aa198){case _0xf644('0x2d'):return _0xf644('0x2e');case'yahoo':return _0xf644('0x2f');case _0xf644('0x2a'):return'smtp-mail.outlook.com';case _0xf644('0x2c'):return _0xf644('0x30');}throw new Error(_0xf644('0x31'),_0x3aa198);}function getAuthenticationOptions(_0x4d2aeb,_0x2ab38a){var _0x42d6e8={};var _0x5e5e9b={};if(_0x4d2aeb){_0x42d6e8[_0xf644('0x32')]=_0x5e5e9b['user']=_0x2ab38a[_0xf644('0x33')];_0x42d6e8[_0xf644('0x34')]=_0x5e5e9b[_0xf644('0x35')]=_0x2ab38a[_0xf644('0x34')];if(_0x2ab38a[_0xf644('0x36')]){_0x42d6e8[_0xf644('0x36')]=_0x5e5e9b['modernAuthentication']=!![];_0x42d6e8[_0xf644('0x37')]=_0x5e5e9b[_0xf644('0x37')]=_0x2ab38a[_0xf644('0x37')];_0x42d6e8['password']=_0x5e5e9b['pass']=null;}else{_0x42d6e8[_0xf644('0x37')]=_0x5e5e9b[_0xf644('0x37')]=null;}_0x42d6e8[_0xf644('0x38')]=getImapHost(_0x4d2aeb);_0x42d6e8[_0xf644('0x39')]=0x3e1;_0x5e5e9b['host']=getSmtpHost(_0x4d2aeb);_0x5e5e9b[_0xf644('0x39')]=0x24b;_0x5e5e9b['secure']=![];_0x42d6e8[_0xf644('0x3a')]=_0x5e5e9b['service']=null;}else{if(_0x2ab38a[_0xf644('0x3b')]){_0x42d6e8[_0xf644('0x32')]=_0x5e5e9b[_0xf644('0x32')]=_0x2ab38a[_0xf644('0x33')];_0x42d6e8['password']=_0x5e5e9b[_0xf644('0x35')]=_0x2ab38a[_0xf644('0x34')];}else{_0x42d6e8['authentication']=_0x5e5e9b[_0xf644('0x3b')]=![];_0x42d6e8[_0xf644('0x32')]=_0x5e5e9b['user']=null;_0x42d6e8[_0xf644('0x34')]=_0x5e5e9b['pass']=null;}_0x42d6e8[_0xf644('0x38')]=_0x2ab38a[_0xf644('0x3c')][_0xf644('0x38')];_0x42d6e8[_0xf644('0x39')]=_0x2ab38a[_0xf644('0x3c')]['port'];_0x5e5e9b[_0xf644('0x38')]=_0x2ab38a[_0xf644('0x3d')][_0xf644('0x38')];_0x5e5e9b[_0xf644('0x39')]=_0x2ab38a[_0xf644('0x3d')]['port'];}return{'Imap':_0x42d6e8,'Smtp':_0x5e5e9b};}exports[_0xf644('0x3e')]=function(_0x42b590,_0x2db98c){var _0x4d6dc3={'include':[{'model':db[_0xf644('0x3f')],'as':_0xf644('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xf644('0x40')],'as':_0xf644('0x41')}]},_0x3c530={},_0x405b5d={'count':0x0,'rows':[]};var _0x139ab5=_[_0xf644('0x42')](db['MailAccount']['rawAttributes'],function(_0x3c0068){return{'name':_0x3c0068[_0xf644('0x43')],'type':_0x3c0068[_0xf644('0x44')]['key']};});_0x3c530[_0xf644('0x45')]=_[_0xf644('0x42')](_0x139ab5,_0xf644('0x27'));_0x3c530[_0xf644('0x46')]=_[_0xf644('0x47')](_0x42b590[_0xf644('0x46')]);_0x3c530[_0xf644('0x48')]=_[_0xf644('0x49')](_0x3c530[_0xf644('0x45')],_0x3c530['query']);_0x4d6dc3[_0xf644('0x4a')]=_[_0xf644('0x49')](_0x3c530[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x42b590[_0xf644('0x46')][_0xf644('0x4b')]));_0x4d6dc3[_0xf644('0x4a')]=_0x4d6dc3['attributes'][_0xf644('0x4c')]?_0x4d6dc3[_0xf644('0x4a')]:_0x3c530['model'];if(!_0x42b590['query']['hasOwnProperty'](_0xf644('0x4d'))){_0x4d6dc3['limit']=qs[_0xf644('0x1c')](_0x42b590[_0xf644('0x46')]['limit']);_0x4d6dc3[_0xf644('0x1a')]=qs[_0xf644('0x1a')](_0x42b590[_0xf644('0x46')][_0xf644('0x1a')]);}_0x4d6dc3[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x42b590[_0xf644('0x46')][_0xf644('0x4f')]);_0x4d6dc3['where']=qs[_0xf644('0x48')](_[_0xf644('0x50')](_0x42b590[_0xf644('0x46')],_0x3c530['filters']),_0x139ab5);if(_0x42b590[_0xf644('0x46')][_0xf644('0x51')]){_0x4d6dc3[_0xf644('0x52')]=_['merge'](_0x4d6dc3[_0xf644('0x52')],{'$or':_['map'](_0x139ab5,function(_0x3b3baf){if(_0x3b3baf['type']!==_0xf644('0x53')){var _0x163884={};_0x163884[_0x3b3baf['name']]={'$like':'%'+_0x42b590[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x163884;}})});}_0x4d6dc3=_[_0xf644('0x54')]({},_0x4d6dc3,_0x42b590[_0xf644('0x55')]);var _0x1d68fd={'where':_0x4d6dc3['where']};return db['MailAccount'][_0xf644('0x1d')](_0x1d68fd)[_0xf644('0x21')](function(_0xff707c){_0x405b5d[_0xf644('0x1d')]=_0xff707c;if(_0x42b590[_0xf644('0x46')][_0xf644('0x56')]){_0x4d6dc3[_0xf644('0x57')]=[{'all':!![]}];}return db[_0xf644('0x58')][_0xf644('0x59')](_0x4d6dc3);})[_0xf644('0x21')](function(_0x389c40){_0x405b5d[_0xf644('0x5a')]=_0x389c40;return _0x405b5d;})[_0xf644('0x21')](respondWithFilteredResult(_0x2db98c,_0x4d6dc3))[_0xf644('0x5b')](handleError(_0x2db98c,null));};exports['show']=function(_0x11ed35,_0x17b0f0){var _0x2ad9a3={'raw':![],'where':{'id':_0x11ed35[_0xf644('0x5c')]['id']},'include':[{'model':db[_0xf644('0x3f')],'as':_0xf644('0x3c')},{'model':db[_0xf644('0x5d')],'as':_0xf644('0x3d')},{'model':db['Pause'],'as':_0xf644('0x41')}]},_0x3b6a5a={};_0x3b6a5a[_0xf644('0x45')]=_[_0xf644('0x47')](db['MailAccount'][_0xf644('0x5e')]);_0x3b6a5a[_0xf644('0x46')]=_['keys'](_0x11ed35['query']);_0x3b6a5a[_0xf644('0x48')]=_['intersection'](_0x3b6a5a[_0xf644('0x45')],_0x3b6a5a[_0xf644('0x46')]);_0x2ad9a3[_0xf644('0x4a')]=_['intersection'](_0x3b6a5a[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x11ed35[_0xf644('0x46')]['fields']));_0x2ad9a3[_0xf644('0x4a')]=_0x2ad9a3[_0xf644('0x4a')]['length']?_0x2ad9a3[_0xf644('0x4a')]:_0x3b6a5a['model'];if(_0x11ed35[_0xf644('0x46')]['includeAll']){_0x2ad9a3[_0xf644('0x57')]=[{'all':!![]}];}_0x2ad9a3=_['merge']({},_0x2ad9a3,_0x11ed35[_0xf644('0x55')]);return db[_0xf644('0x58')][_0xf644('0x5f')](_0x2ad9a3)[_0xf644('0x21')](handleEntityNotFound(_0x17b0f0,null))[_0xf644('0x21')](respondWithResult(_0x17b0f0,null))[_0xf644('0x5b')](handleError(_0x17b0f0,null));};exports[_0xf644('0x20')]=function(_0xf258d8,_0x18283a){if(_0xf258d8['body']['id']){delete _0xf258d8[_0xf644('0x60')]['id'];}var _0x4d7751=_0xf258d8[_0xf644('0x60')][_0xf644('0x61')]===_0xf644('0x62')?null:_0xf258d8[_0xf644('0x60')]['provider'];var _0x46e57b=_0xf258d8[_0xf644('0x60')][_0xf644('0x3c')]||{};var _0x468a79=_0xf258d8[_0xf644('0x60')][_0xf644('0x3d')]||{};if(_0x4d7751){_0x46e57b[_0xf644('0x38')]=getImapHost(_0x4d7751);_0x46e57b[_0xf644('0x39')]=0x3e1;_0x468a79['host']=getSmtpHost(_0x4d7751);_0x468a79[_0xf644('0x39')]=0x24b;_0x468a79[_0xf644('0x63')]=![];}if(_0x468a79[_0xf644('0x36')]){_0x468a79[_0xf644('0x63')]=![];}else{_0x468a79[_0xf644('0x37')]=null;}if(!_0x46e57b[_0xf644('0x36')])_0x46e57b[_0xf644('0x37')]=null;_0xf258d8[_0xf644('0x60')]['Imap']=_0x46e57b;_0xf258d8[_0xf644('0x60')][_0xf644('0x3d')]=_0x468a79;return db['MailAccount'][_0xf644('0x5f')]({'where':{'id':_0xf258d8['params']['id']},'include':[{'model':db[_0xf644('0x3f')],'as':_0xf644('0x3c')},{'model':db[_0xf644('0x5d')],'as':'Smtp'},{'model':db['Pause'],'as':_0xf644('0x41')}]})[_0xf644('0x21')](handleEntityNotFound(_0x18283a,null))[_0xf644('0x21')](function(_0x45365b){if(!_0x45365b)throw new Error(_0xf644('0x64'));if(_0x45365b['service'])delete _0xf258d8[_0xf644('0x60')]['Imap'];return _0x45365b;})['then'](saveUpdates(_0xf258d8[_0xf644('0x60')],null))[_0xf644('0x21')](function(_0x174bfd){if(!_0xf258d8[_0xf644('0x60')][_0xf644('0x3c')])return _0x174bfd;return db[_0xf644('0x3f')][_0xf644('0x20')](_0xf258d8['body'][_0xf644('0x3c')],{'where':{'MailAccountId':_0x174bfd['id']}})[_0xf644('0x21')](function(){return _0x174bfd;});})[_0xf644('0x21')](function(_0x1e10e7){if(!_0xf258d8['body']['Smtp'])return _0x1e10e7;return db[_0xf644('0x5d')][_0xf644('0x20')](_0xf258d8[_0xf644('0x60')][_0xf644('0x3d')],{'where':{'MailAccountId':_0x1e10e7['id']}})[_0xf644('0x21')](function(){return _0x1e10e7;});})['then'](respondWithResult(_0x18283a,null))['catch'](handleError(_0x18283a,null));};exports['describe']=function(_0x3a3430,_0xfd5aad){return db[_0xf644('0x58')][_0xf644('0x65')]()[_0xf644('0x21')](respondWithResult(_0xfd5aad,null))['catch'](handleError(_0xfd5aad,null));};exports[_0xf644('0x66')]=function(_0xf82f3,_0x12ed98){if(_0xf82f3[_0xf644('0x60')]['id']){delete _0xf82f3[_0xf644('0x60')]['id'];}return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0xf82f3['params']['id']}})['then'](handleEntityNotFound(_0x12ed98,null))[_0xf644('0x21')](function(_0x59a65e){if(_0x59a65e){_0xf82f3[_0xf644('0x60')][_0xf644('0x67')]=_0x59a65e['id'];return db[_0xf644('0x68')][_0xf644('0x69')](_0xf82f3[_0xf644('0x60')]);}})[_0xf644('0x21')](respondWithResult(_0x12ed98,null))['catch'](handleError(_0x12ed98,null));};exports[_0xf644('0x6a')]=function(_0x5d2423,_0x119e6c){var _0x561c56={'raw':![],'where':{}};var _0x4de6ee={};var _0x39b902={'count':0x0,'rows':[]};return db['MailAccount'][_0xf644('0x6b')]({'where':{'id':_0x5d2423[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x119e6c,null))[_0xf644('0x21')](function(_0x1db890){if(_0x1db890){_0x4de6ee[_0xf644('0x45')]=_[_0xf644('0x47')](db[_0xf644('0x68')][_0xf644('0x5e')]);_0x4de6ee[_0xf644('0x46')]=_[_0xf644('0x47')](_0x5d2423[_0xf644('0x46')]);_0x4de6ee['filters']=_['intersection'](_0x4de6ee['model'],_0x4de6ee['query']);_0x561c56['attributes']=_[_0xf644('0x49')](_0x4de6ee['model'],qs[_0xf644('0x4b')](_0x5d2423[_0xf644('0x46')][_0xf644('0x4b')]));_0x561c56[_0xf644('0x4a')]=_0x561c56[_0xf644('0x4a')]['length']?_0x561c56[_0xf644('0x4a')]:_0x4de6ee['model'];if(!_0x5d2423['query'][_0xf644('0x6c')](_0xf644('0x4d'))){_0x561c56[_0xf644('0x1c')]=qs['limit'](_0x5d2423[_0xf644('0x46')][_0xf644('0x1c')]);_0x561c56['offset']=qs['offset'](_0x5d2423[_0xf644('0x46')]['offset']);}_0x561c56[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x5d2423['query'][_0xf644('0x4f')]);_0x561c56['where']=qs[_0xf644('0x48')](_[_0xf644('0x50')](_0x5d2423[_0xf644('0x46')],_0x4de6ee[_0xf644('0x48')]));_0x561c56[_0xf644('0x52')][_0xf644('0x67')]=_0x1db890['id'];if(_0x5d2423['query'][_0xf644('0x51')]){_0x561c56[_0xf644('0x52')]=_[_0xf644('0x54')](_0x561c56[_0xf644('0x52')],{'$or':_[_0xf644('0x42')](_0x561c56[_0xf644('0x4a')],function(_0x2b3f4b){var _0x5e82cc={};_0x5e82cc[_0x2b3f4b]={'$like':'%'+_0x5d2423[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x5e82cc;})});}_0x561c56=_['merge']({},_0x561c56,_0x5d2423[_0xf644('0x55')]);return db[_0xf644('0x68')][_0xf644('0x1d')]({'where':_0x561c56['where']})[_0xf644('0x21')](function(_0xfb5257){_0x39b902[_0xf644('0x1d')]=_0xfb5257;if(_0x5d2423[_0xf644('0x46')][_0xf644('0x56')]){_0x561c56[_0xf644('0x57')]=[{'all':!![]}];}return db[_0xf644('0x68')][_0xf644('0x59')](_0x561c56);})['then'](function(_0x385aa6){_0x39b902[_0xf644('0x5a')]=_0x385aa6;return _0x39b902;});}})[_0xf644('0x21')](respondWithFilteredResult(_0x119e6c,_0x561c56))['catch'](handleError(_0x119e6c,null));};exports['removeDispositions']=function(_0x3aa875,_0x31703f){return db['MailAccount'][_0xf644('0x5f')]({'where':{'id':_0x3aa875[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x31703f,null))['then'](function(_0x42cd58){if(_0x42cd58){return _0x42cd58[_0xf644('0x6d')](_0x3aa875[_0xf644('0x46')][_0xf644('0x6e')]);}})[_0xf644('0x21')](respondWithStatusCode(_0x31703f,null))[_0xf644('0x5b')](handleError(_0x31703f,null));};exports[_0xf644('0x6f')]=function(_0xb3786b,_0x572fb3){if(_0xb3786b[_0xf644('0x60')]['id']){delete _0xb3786b[_0xf644('0x60')]['id'];}return db[_0xf644('0x58')]['find']({'where':{'id':_0xb3786b[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x572fb3,null))['then'](function(_0x1adb2c){if(_0x1adb2c){_0xb3786b['body']['MailAccountId']=_0x1adb2c['id'];return db[_0xf644('0x70')]['create'](_0xb3786b[_0xf644('0x60')]);}})['then'](respondWithResult(_0x572fb3,null))['catch'](handleError(_0x572fb3,null));};exports['getAnswers']=function(_0x415bfd,_0x4cd02b){var _0x3389c0={'raw':![],'where':{}};var _0x2ebb94={};var _0x5130b6={'count':0x0,'rows':[]};return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x415bfd[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x4cd02b,null))[_0xf644('0x21')](function(_0x56e62e){if(_0x56e62e){_0x2ebb94[_0xf644('0x45')]=_['keys'](db[_0xf644('0x70')][_0xf644('0x5e')]);_0x2ebb94[_0xf644('0x46')]=_[_0xf644('0x47')](_0x415bfd[_0xf644('0x46')]);_0x2ebb94[_0xf644('0x48')]=_['intersection'](_0x2ebb94[_0xf644('0x45')],_0x2ebb94['query']);_0x3389c0[_0xf644('0x4a')]=_[_0xf644('0x49')](_0x2ebb94[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x415bfd[_0xf644('0x46')]['fields']));_0x3389c0[_0xf644('0x4a')]=_0x3389c0['attributes'][_0xf644('0x4c')]?_0x3389c0[_0xf644('0x4a')]:_0x2ebb94[_0xf644('0x45')];if(!_0x415bfd[_0xf644('0x46')][_0xf644('0x6c')](_0xf644('0x4d'))){_0x3389c0[_0xf644('0x1c')]=qs[_0xf644('0x1c')](_0x415bfd[_0xf644('0x46')]['limit']);_0x3389c0[_0xf644('0x1a')]=qs[_0xf644('0x1a')](_0x415bfd[_0xf644('0x46')][_0xf644('0x1a')]);}_0x3389c0[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x415bfd[_0xf644('0x46')]['sort']);_0x3389c0[_0xf644('0x52')]=qs[_0xf644('0x48')](_[_0xf644('0x50')](_0x415bfd[_0xf644('0x46')],_0x2ebb94['filters']));_0x3389c0['where'][_0xf644('0x67')]=_0x56e62e['id'];if(_0x415bfd[_0xf644('0x46')][_0xf644('0x51')]){_0x3389c0[_0xf644('0x52')]=_[_0xf644('0x54')](_0x3389c0[_0xf644('0x52')],{'$or':_[_0xf644('0x42')](_0x3389c0['attributes'],function(_0x7c8c60){var _0x5af9b1={};_0x5af9b1[_0x7c8c60]={'$like':'%'+_0x415bfd[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x5af9b1;})});}_0x3389c0=_[_0xf644('0x54')]({},_0x3389c0,_0x415bfd[_0xf644('0x55')]);return db[_0xf644('0x70')][_0xf644('0x1d')]({'where':_0x3389c0['where']})[_0xf644('0x21')](function(_0x4e1440){_0x5130b6[_0xf644('0x1d')]=_0x4e1440;if(_0x415bfd[_0xf644('0x46')][_0xf644('0x56')]){_0x3389c0['include']=[{'all':!![]}];}return db[_0xf644('0x70')][_0xf644('0x59')](_0x3389c0);})[_0xf644('0x21')](function(_0x472294){_0x5130b6[_0xf644('0x5a')]=_0x472294;return _0x5130b6;});}})['then'](respondWithFilteredResult(_0x4cd02b,_0x3389c0))[_0xf644('0x5b')](handleError(_0x4cd02b,null));};exports[_0xf644('0x71')]=function(_0x31db38,_0x228f16){return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0x31db38[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x228f16,null))[_0xf644('0x21')](function(_0x1e2eb4){if(_0x1e2eb4){return _0x1e2eb4[_0xf644('0x71')](_0x31db38[_0xf644('0x46')][_0xf644('0x6e')]);}})[_0xf644('0x21')](respondWithStatusCode(_0x228f16,null))['catch'](handleError(_0x228f16,null));};exports[_0xf644('0x69')]=function(_0x13511b,_0x5def96){var _0x76282b={'name':_0x13511b[_0xf644('0x60')][_0xf644('0x27')],'key':_0x13511b[_0xf644('0x60')][_0xf644('0x72')],'provider':_0x13511b[_0xf644('0x60')][_0xf644('0x61')]===_0xf644('0x62')?null:_0x13511b['body']['provider'],'email':_0x13511b['body'][_0xf644('0x73')],'ListId':_0x13511b[_0xf644('0x60')][_0xf644('0x74')],'active':!_[_0xf644('0x75')](_0x13511b['body']['active'])?_0x13511b['body'][_0xf644('0x76')]:!![],'description':_0x13511b[_0xf644('0x60')][_0xf644('0x77')]||null};var _0x21bb67=getAuthenticationOptions(_0x76282b[_0xf644('0x61')],_0x13511b[_0xf644('0x60')]);_0x76282b[_0xf644('0x3c')]=_0x21bb67[_0xf644('0x3c')];_0x76282b[_0xf644('0x3d')]=_0x21bb67[_0xf644('0x3d')];return db[_0xf644('0x58')][_0xf644('0x69')](_0x76282b,{'include':[{'model':db[_0xf644('0x5d')],'as':_0xf644('0x3d')},{'model':db[_0xf644('0x3f')],'as':_0xf644('0x3c')}]})['then'](function(_0x4fbe3c){var _0x1ac509=_0x13511b[_0xf644('0x32')]['get']({'plain':!![]});if(!_0x1ac509)throw new Error(_0xf644('0x78'));if(_0x1ac509['role']==='user'){var _0x15bcad=_0x4fbe3c[_0xf644('0x23')]({'plain':!![]});return db[_0xf644('0x79')][_0xf644('0x5f')]({'where':{'name':_0xf644('0x7a'),'userProfileId':_0x1ac509['userProfileId']},'raw':!![]})['then'](function(_0x16cc60){if(_0x16cc60&&_0x16cc60[_0xf644('0x7b')]===0x0){return db['UserProfileResource'][_0xf644('0x69')]({'name':_0x15bcad[_0xf644('0x27')],'resourceId':_0x15bcad['id'],'type':_0x16cc60['name'],'sectionId':_0x16cc60['id']},{})['then'](function(){return _0x4fbe3c;});}else{return _0x4fbe3c;}})[_0xf644('0x5b')](function(_0x3064e9){logger[_0xf644('0x14')](_0xf644('0x7c'),_0x3064e9);throw _0x3064e9;});}return _0x4fbe3c;})[_0xf644('0x21')](respondWithResult(_0x5def96,0xc9))['catch'](handleError(_0x5def96,null));};exports[_0xf644('0x7d')]=function(_0x2a0abb,_0x37b6d0){return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x2a0abb[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x37b6d0,null))[_0xf644('0x21')](function(_0x28eb90){if(_0x28eb90){return _0x28eb90[_0xf644('0x7d')]();}return null;})['then'](respondWithResult(_0x37b6d0,null))[_0xf644('0x5b')](handleError(_0x37b6d0,null));};exports[_0xf644('0x7e')]=function(_0x419b1b,_0x1dd36a){if(_0x419b1b['body']['id']){delete _0x419b1b[_0xf644('0x60')]['id'];}return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0x419b1b[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1dd36a,null))['then'](function(_0x37ff68){if(_0x37ff68){_0x419b1b[_0xf644('0x60')]['MailAccountId']=_0x37ff68['id'];return db[_0xf644('0x3f')][_0xf644('0x69')](_0x419b1b['body']);}})[_0xf644('0x21')](respondWithResult(_0x1dd36a,null))[_0xf644('0x5b')](handleError(_0x1dd36a,null));};exports[_0xf644('0x7f')]=function(_0x51bd15,_0xe3f94a){return db['MailAccount'][_0xf644('0x6b')]({'where':{'id':_0x51bd15[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0xe3f94a,null))[_0xf644('0x21')](function(_0x11342a){if(_0x11342a){return _0x11342a[_0xf644('0x80')](null);}return null;})[_0xf644('0x21')](respondWithStatusCode(_0xe3f94a,null))['catch'](handleError(_0xe3f94a,null));};exports[_0xf644('0x81')]=function(_0x487fcf,_0x4c4770){return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x487fcf[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4c4770,null))['then'](function(_0xa6c53f){if(_0xa6c53f){return _0xa6c53f[_0xf644('0x81')]();}return null;})[_0xf644('0x21')](respondWithResult(_0x4c4770,null))[_0xf644('0x5b')](handleError(_0x4c4770,null));};exports[_0xf644('0x82')]=function(_0x27659a,_0x2bf8e1){if(_0x27659a[_0xf644('0x60')]['id']){delete _0x27659a[_0xf644('0x60')]['id'];}return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0x27659a[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x2bf8e1,null))[_0xf644('0x21')](function(_0xacf857){if(_0xacf857){_0x27659a[_0xf644('0x60')]['MailAccountId']=_0xacf857['id'];return db[_0xf644('0x5d')][_0xf644('0x69')](_0x27659a[_0xf644('0x60')]);}})[_0xf644('0x21')](respondWithResult(_0x2bf8e1,null))['catch'](handleError(_0x2bf8e1,null));};exports[_0xf644('0x83')]=function(_0x474b53,_0x14e283){return db['MailAccount'][_0xf644('0x6b')]({'where':{'id':_0x474b53['params']['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x14e283,null))[_0xf644('0x21')](function(_0x419fc9){if(_0x419fc9){return _0x419fc9[_0xf644('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x14e283,null))[_0xf644('0x5b')](handleError(_0x14e283,null));};exports[_0xf644('0x85')]=function(_0xb00339,_0x5c5cc0){return db[_0xf644('0x86')]['find']({'where':{'id':_0xb00339[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x5c5cc0,null))[_0xf644('0x21')](function(_0xfd04fc){if(_0xfd04fc){return _0xfd04fc[_0xf644('0x85')](_0xb00339[_0xf644('0x60')][_0xf644('0x6e')],_[_0xf644('0x87')](_0xb00339[_0xf644('0x60')],[_0xf644('0x6e'),'id'])||{});}})[_0xf644('0x21')](respondWithResult(_0x5c5cc0,null))[_0xf644('0x5b')](handleError(_0x5c5cc0,null));};exports['getInteractions']=function(_0x4384ec,_0x92f1b2){var _0x325c9d={'raw':![],'where':{}};var _0x61f2c7={};var _0x5e06fe={'count':0x0,'rows':[]};return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x4384ec['params']['id']}})['then'](handleEntityNotFound(_0x92f1b2,null))[_0xf644('0x21')](function(_0x521ee8){if(_0x521ee8){_0x61f2c7[_0xf644('0x45')]=_[_0xf644('0x47')](db[_0xf644('0x86')]['rawAttributes']);_0x61f2c7[_0xf644('0x46')]=_[_0xf644('0x47')](_0x4384ec[_0xf644('0x46')]);_0x61f2c7[_0xf644('0x48')]=_[_0xf644('0x49')](_0x61f2c7[_0xf644('0x45')],_0x61f2c7[_0xf644('0x46')]);_0x325c9d['attributes']=_[_0xf644('0x49')](_0x61f2c7[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x4384ec['query']['fields']));_0x325c9d[_0xf644('0x4a')]=_0x325c9d[_0xf644('0x4a')][_0xf644('0x4c')]?_0x325c9d[_0xf644('0x4a')]:_0x61f2c7[_0xf644('0x45')];if(!_0x4384ec[_0xf644('0x46')]['hasOwnProperty']('nolimit')){_0x325c9d[_0xf644('0x1c')]=qs[_0xf644('0x1c')](_0x4384ec[_0xf644('0x46')][_0xf644('0x1c')]);_0x325c9d[_0xf644('0x1a')]=qs[_0xf644('0x1a')](_0x4384ec[_0xf644('0x46')][_0xf644('0x1a')]);}_0x325c9d[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x4384ec[_0xf644('0x46')][_0xf644('0x4f')]);_0x325c9d['where']=qs[_0xf644('0x48')](_[_0xf644('0x50')](_0x4384ec[_0xf644('0x46')],_0x61f2c7[_0xf644('0x48')]));_0x325c9d[_0xf644('0x52')]['MailAccountId']=_0x521ee8['id'];if(_0x4384ec[_0xf644('0x46')]['filter']){_0x325c9d[_0xf644('0x52')]=_['merge'](_0x325c9d[_0xf644('0x52')],{'$or':_['map'](_0x325c9d[_0xf644('0x4a')],function(_0x6ce78a){var _0xb0162a={};_0xb0162a[_0x6ce78a]={'$like':'%'+_0x4384ec[_0xf644('0x46')]['filter']+'%'};return _0xb0162a;})});}_0x325c9d=_[_0xf644('0x54')]({},_0x325c9d,_0x4384ec[_0xf644('0x55')]);return db[_0xf644('0x86')]['count']({'where':_0x325c9d['where']})['then'](function(_0x290b2b){_0x5e06fe[_0xf644('0x1d')]=_0x290b2b;if(_0x4384ec[_0xf644('0x46')][_0xf644('0x56')]){_0x325c9d[_0xf644('0x57')]=[{'model':db[_0xf644('0x88')],'as':'Contact','required':![]},{'model':db['User'],'as':_0xf644('0x89'),'attributes':[_0xf644('0x27'),'fullname',_0xf644('0x8a')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xf644('0x27'),_0xf644('0x8b')],'where':_0x4384ec[_0xf644('0x46')]['tag']?{'id':_0x4384ec[_0xf644('0x46')]['tag']}:undefined,'required':_0x4384ec['query'][_0xf644('0x8c')]?!![]:![]}];}return db[_0xf644('0x86')][_0xf644('0x59')](_0x325c9d);})['then'](function(_0x2093d8){_0x5e06fe[_0xf644('0x5a')]=_0x2093d8;return _0x5e06fe;});}})[_0xf644('0x21')](respondWithFilteredResult(_0x92f1b2,_0x325c9d))['catch'](handleError(_0x92f1b2,null));};exports[_0xf644('0x8d')]=function addApplications(_0x5469d1,_0x1ea483){var _0x28fb6f=_0x5469d1[_0xf644('0x5c')]['id'];var _0x1fabd0=_0x5469d1['body'];var _0x4bf801=0xc8;var _0x2d9b6e=null;return db['sequelize'][_0xf644('0x8e')]({'isolationLevel':db[_0xf644('0x8f')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4a9c83){return db[_0xf644('0x58')]['findOne']({'where':{'id':_0x28fb6f},'transaction':_0x4a9c83})['then'](function(_0x49d39d){if(_0x49d39d){return db[_0xf644('0x90')]['destroy']({'where':{'MailAccountId':_0x28fb6f},'transaction':_0x4a9c83})[_0xf644('0x21')](function(){var _0x26c2c5=_[_0xf644('0x42')](_0x1fabd0,function(_0x51ace8){_0x51ace8[_0xf644('0x67')]=_0x28fb6f;return _0x51ace8;});return db[_0xf644('0x90')][_0xf644('0x91')](_0x26c2c5,{'transaction':_0x4a9c83});});}else{_0x4bf801=0x194;_0x2d9b6e=[];}});})[_0xf644('0x21')](function(){if(_0x4bf801!==0x194){return db['MailApplication']['findAndCountAll']({'where':{'MailAccountId':_0x28fb6f},'order':'priority'})['then'](function(_0x328101){_0x2d9b6e=_0x328101;});}})['catch'](function(_0x4bc441){_0x4bf801=0x1f4;logger[_0xf644('0x14')](_0x4bc441[_0xf644('0x26')]);if(_0x4bc441[_0xf644('0x27')]){delete _0x4bc441[_0xf644('0x27')];}_0x2d9b6e=_0x4bc441;})[_0xf644('0x92')](function(){if(_0x2d9b6e===null){_0x1ea483[_0xf644('0x18')](_0x4bf801);}else{if(_0x4bf801===0x1f4){_0x1ea483['status'](_0x4bf801)[_0xf644('0x28')](_0x2d9b6e);}else{_0x1ea483[_0xf644('0x19')](_0x4bf801)[_0xf644('0x93')](_0x2d9b6e);}}});};exports[_0xf644('0x94')]=function(_0x333fc8,_0x34e629){var _0x2958e2={};var _0x181ee3={};var _0x42ae02;var _0xeb6d6f;return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x333fc8[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x34e629,null))[_0xf644('0x21')](function(_0x28312d){if(_0x28312d){_0x42ae02=_0x28312d;_0x181ee3[_0xf644('0x45')]=_[_0xf644('0x47')](db[_0xf644('0x90')]['rawAttributes']);_0x181ee3['query']=_[_0xf644('0x47')](_0x333fc8['query']);_0x181ee3[_0xf644('0x48')]=_[_0xf644('0x49')](_0x181ee3[_0xf644('0x45')],_0x181ee3[_0xf644('0x46')]);_0x2958e2[_0xf644('0x4a')]=_[_0xf644('0x49')](_0x181ee3[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x333fc8[_0xf644('0x46')][_0xf644('0x4b')]));_0x2958e2['attributes']=_0x2958e2['attributes']['length']?_0x2958e2['attributes']:_0x181ee3[_0xf644('0x45')];_0x2958e2[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x333fc8[_0xf644('0x46')]['sort']);_0x2958e2[_0xf644('0x52')]=qs[_0xf644('0x48')](_['pick'](_0x333fc8[_0xf644('0x46')],_0x181ee3[_0xf644('0x48')]));if(_0x333fc8['query']['filter']){_0x2958e2['where']=_[_0xf644('0x54')](_0x2958e2[_0xf644('0x52')],{'$or':_[_0xf644('0x42')](_0x2958e2['attributes'],function(_0x3748d2){var _0x3aff8b={};_0x3aff8b[_0x3748d2]={'$like':'%'+_0x333fc8[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x3aff8b;})});}_0x2958e2=_[_0xf644('0x54')]({},_0x2958e2,_0x333fc8[_0xf644('0x55')]);return _0x42ae02[_0xf644('0x94')](_0x2958e2);}})['then'](function(_0x431a36){if(_0x431a36){_0xeb6d6f=_0x431a36[_0xf644('0x4c')];if(!_0x333fc8[_0xf644('0x46')]['hasOwnProperty'](_0xf644('0x4d'))){_0x2958e2[_0xf644('0x1c')]=qs[_0xf644('0x1c')](_0x333fc8[_0xf644('0x46')][_0xf644('0x1c')]);_0x2958e2[_0xf644('0x1a')]=qs[_0xf644('0x1a')](_0x333fc8[_0xf644('0x46')][_0xf644('0x1a')]);}return _0x42ae02['getApplications'](_0x2958e2);}})[_0xf644('0x21')](function(_0x4f49be){if(_0x4f49be){return _0x4f49be?{'count':_0xeb6d6f,'rows':_0x4f49be}:null;}})[_0xf644('0x21')](respondWithResult(_0x34e629,null))[_0xf644('0x5b')](handleError(_0x34e629,null));};exports[_0xf644('0x95')]=function(_0x2de9ca,_0x3017f0){var _0x500d87={'raw':!![],'where':{}};var _0x38bb6a={};var _0x22375f={'count':0x0,'rows':[]};return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x2de9ca['params']['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x3017f0,null))['then'](function(_0x1179d4){if(_0x1179d4){_0x38bb6a[_0xf644('0x45')]=_[_0xf644('0x47')](db[_0xf644('0x96')]['rawAttributes']);_0x38bb6a[_0xf644('0x46')]=_[_0xf644('0x47')](_0x2de9ca[_0xf644('0x46')]);_0x38bb6a['filters']=_[_0xf644('0x49')](_0x38bb6a['model'],_0x38bb6a[_0xf644('0x46')]);_0x500d87['attributes']=_['intersection'](_0x38bb6a[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x2de9ca[_0xf644('0x46')]['fields']));_0x500d87[_0xf644('0x4a')]=_0x500d87[_0xf644('0x4a')][_0xf644('0x4c')]?_0x500d87['attributes']:_0x38bb6a[_0xf644('0x45')];if(!_0x2de9ca[_0xf644('0x46')][_0xf644('0x6c')](_0xf644('0x4d'))){_0x500d87[_0xf644('0x1c')]=qs['limit'](_0x2de9ca['query']['limit']);_0x500d87[_0xf644('0x1a')]=qs['offset'](_0x2de9ca[_0xf644('0x46')][_0xf644('0x1a')]);}_0x500d87[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x2de9ca[_0xf644('0x46')][_0xf644('0x4f')]);_0x500d87['where']=qs[_0xf644('0x48')](_['pick'](_0x2de9ca[_0xf644('0x46')],_0x38bb6a[_0xf644('0x48')]));_0x500d87['where'][_0xf644('0x67')]=_0x1179d4['id'];if(_0x2de9ca['query'][_0xf644('0x51')]){_0x500d87[_0xf644('0x52')]=_[_0xf644('0x54')](_0x500d87[_0xf644('0x52')],{'$or':_[_0xf644('0x42')](_0x500d87[_0xf644('0x4a')],function(_0x349870){var _0x3a4961={};_0x3a4961[_0x349870]={'$like':'%'+_0x2de9ca[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x3a4961;})});}if(_0x2de9ca[_0xf644('0x46')][_0xf644('0x97')]){var _0x5a6679=_0x2de9ca[_0xf644('0x46')]['$gte']['split'](',');var _0x4b3c9b={};_0x4b3c9b[_0x5a6679[0x0]]={'$gte':moment(_0x5a6679[0x1])[_0xf644('0x98')](_0xf644('0x99'))};_0x500d87[_0xf644('0x52')]=_[_0xf644('0x54')](_0x500d87[_0xf644('0x52')],_0x4b3c9b);}_0x500d87=_[_0xf644('0x54')]({},_0x500d87,_0x2de9ca[_0xf644('0x55')]);return db[_0xf644('0x96')][_0xf644('0x1d')]({'where':_0x500d87['where']})['then'](function(_0x5436a5){_0x22375f['count']=_0x5436a5;if(_0x2de9ca[_0xf644('0x46')]['includeAll']){_0x500d87[_0xf644('0x57')]=[{'all':!![]}];}return db[_0xf644('0x96')][_0xf644('0x59')](_0x500d87);})[_0xf644('0x21')](function(_0x5638a8){if(_0x2de9ca['query'][_0xf644('0x9a')]===_0xf644('0x9b')){for(var _0x28ea24=0x0;_0x28ea24<_0x5638a8[_0xf644('0x4c')];_0x28ea24++){_0x5638a8[_0x28ea24][_0xf644('0x60')]=juice(_0x5638a8[_0x28ea24][_0xf644('0x60')]);}}_0x22375f['rows']=_0x5638a8;return _0x22375f;});}})['then'](respondWithFilteredResult(_0x3017f0,_0x500d87))[_0xf644('0x5b')](handleError(_0x3017f0,null));};exports['send']=function(_0xfd6bd2,_0x3c92d6){var _0x835f83,_0x34f499={},_0x3f2516;if(_0xfd6bd2[_0xf644('0x60')]['to']){_0x3f2516=_0xfd6bd2['body']['to']['split'](',')[0x0];}return db[_0xf644('0x58')]['find']({'where':{'id':_0xfd6bd2[_0xf644('0x5c')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xf644('0x88')],'as':_0xf644('0x9c'),'where':{'email':_0x3f2516},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xf644('0x5d')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf644('0x9d')],'as':_0xf644('0x9d'),'raw':!![]}]}]})[_0xf644('0x21')](handleEntityNotFound(_0x3c92d6,null))[_0xf644('0x21')](function(_0x30ef60){if(!_0x30ef60)return;_0x835f83=_0x30ef60;if(!_0x30ef60[_0xf644('0x3d')])throw new Error(_0xf644('0x9e'));if(_[_0xf644('0x75')](_0xfd6bd2[_0xf644('0x60')][_0xf644('0x9f')])){_0xfd6bd2[_0xf644('0x60')][_0xf644('0x9f')]=util['format'](_0xf644('0xa0'),_0x30ef60[_0xf644('0x27')],_0x30ef60[_0xf644('0x73')]||_0x30ef60[_0xf644('0x3d')][_0xf644('0x32')]);}if(_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')]&&_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')][_0xf644('0x4c')]){for(var _0x5569e8=0x0;_0x5569e8<_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')][_0xf644('0x4c')];_0x5569e8+=0x1){_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')][_0x5569e8]={'filename':_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')][_0x5569e8]['name'],'path':path[_0xf644('0xa2')](config['root'],'server/files/attachments',_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa1')][_0x5569e8][_0xf644('0xa3')])};}}var _0x1f67c3=_0x30ef60[_0xf644('0xa4')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x1f67c3,'message':_0xfd6bd2[_0xf644('0x60')]});})[_0xf644('0x21')](function(_0x4d7cba){if(!_0x4d7cba)return;_0x34f499=_0x4d7cba;if(!_0x835f83[_0xf644('0xa5')])throw new Error(_0xf644('0xa6'));if(_0x835f83[_0xf644('0xa5')][_0xf644('0x9c')][_0xf644('0x4c')])return _0x835f83[_0xf644('0xa5')][_0xf644('0x9c')][0x0];return db[_0xf644('0x88')]['create'](_[_0xf644('0xb')](_0xfd6bd2[_0xf644('0x60')],{'firstName':_0xfd6bd2[_0xf644('0x60')]['to'],'email':_0xfd6bd2[_0xf644('0x60')]['to'],'phone':_0xfd6bd2[_0xf644('0x60')]['to'],'ListId':_0x835f83[_0xf644('0x74')]}));})['then'](function(_0x3bef0e){if(!_0x3bef0e)return;var _0x51ed58={'UserId':_0xfd6bd2[_0xf644('0x32')]['id'],'ContactId':_0x3bef0e['id'],'MailAccountId':_0x835f83['id'],'inReplyTo':_0x34f499['messageId'],'to':_0xfd6bd2[_0xf644('0x60')][_0xf644('0x9f')],'cc':_0xfd6bd2['body']['cc'],'subject':_0xfd6bd2[_0xf644('0x60')][_0xf644('0xa7')],'attach':_0xfd6bd2['body'][_0xf644('0xa8')],'firstMsgDirection':'out','lastMsgAt':moment()[_0xf644('0x98')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','Messages':[_[_0xf644('0x54')](_0xfd6bd2[_0xf644('0x60')],{'messageId':_0x34f499[_0xf644('0xa9')],'sentAt':moment()[_0xf644('0x98')](_0xf644('0x99')),'read':!![],'MailAccountId':_0x835f83['id'],'UserId':_0xfd6bd2[_0xf644('0x32')]['id'],'ContactId':_0x3bef0e['id']})]};if(_0xfd6bd2[_0xf644('0x60')][_0xf644('0xaa')]){_0x51ed58=_[_0xf644('0x54')](_0x51ed58,_0xfd6bd2[_0xf644('0x60')][_0xf644('0xaa')]);}return db[_0xf644('0x86')]['create'](_0x51ed58,{'include':[{'model':db[_0xf644('0x96')],'as':_0xf644('0xab')}]});})[_0xf644('0x21')](respondWithResult(_0x3c92d6,null))[_0xf644('0x5b')](handleError(_0x3c92d6,null));};exports[_0xf644('0xac')]=function(_0x2dfe66,_0x317fca){return db[_0xf644('0x58')]['find']({'where':{'id':_0x2dfe66[_0xf644('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0xf644('0x3d'),'raw':!![],'include':[{'model':db[_0xf644('0x9d')],'as':'CloudProvider','raw':!![]}]}]})[_0xf644('0x21')](handleEntityNotFound(_0x317fca,null))['then'](function(_0xd4b1b8){if(!_0xd4b1b8['Smtp'])return;var _0x5e3ac7=_0xd4b1b8[_0xf644('0xa4')]();return respondWithRpcPromise(_0xf644('0xad'),_0xf644('0xac'),{'account':_0x5e3ac7});})[_0xf644('0x21')](respondWithResult(_0x317fca,null))[_0xf644('0x5b')](handleError(_0x317fca,null));};exports[_0xf644('0x22')]=function(_0x310f8b,_0x28e7fe){return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0x310f8b[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x28e7fe,null))[_0xf644('0x21')](function(_0x8c9af0){if(_0x8c9af0&&_0x8c9af0[_0xf644('0x3a')]){throw new db[(_0xf644('0xae'))][(_0xf644('0xaf'))](_0xf644('0xb0'));}return _0x8c9af0;})['then'](removeEntity(_0x28e7fe,null))[_0xf644('0x5b')](handleError(_0x28e7fe,null));};exports[_0xf644('0xb1')]=function(_0x33fd72,_0x5a8b89){return db[_0xf644('0x58')][_0xf644('0x5f')]({'where':{'id':_0x33fd72[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x5a8b89,null))['then'](function(_0x1db297){if(_0x1db297){return _0x1db297[_0xf644('0xb1')](_0x33fd72[_0xf644('0x60')][_0xf644('0x6e')],_[_0xf644('0x87')](_0x33fd72['body'],[_0xf644('0x6e'),'id'])||{})['spread'](function(_0x2b4148){for(var _0x47a719=0x0;_0x47a719<_0x33fd72['body'][_0xf644('0x6e')][_0xf644('0x4c')];_0x47a719+=0x1){socket[_0xf644('0xb2')]('userMailAccount:save',{'UserId':Number(_0x33fd72[_0xf644('0x60')][_0xf644('0x6e')][_0x47a719]),'MailAccountId':Number(_0x33fd72[_0xf644('0x5c')]['id'])});}return _0x2b4148;});}})[_0xf644('0x21')](respondWithResult(_0x5a8b89,null))[_0xf644('0x5b')](handleError(_0x5a8b89,null));};exports[_0xf644('0xb3')]=function(_0x45ef36,_0x56c38e){return db[_0xf644('0x58')]['find']({'where':{'id':_0x45ef36[_0xf644('0x5c')]['id']}})[_0xf644('0x21')](handleEntityNotFound(_0x56c38e,null))[_0xf644('0x21')](function(_0xdcee98){if(_0xdcee98){return _0xdcee98[_0xf644('0xb3')](_0x45ef36[_0xf644('0x46')][_0xf644('0x6e')])['then'](function(){if(_[_0xf644('0xb4')](_0x45ef36[_0xf644('0x46')][_0xf644('0x6e')])){for(var _0x2f8877=0x0;_0x2f8877<_0x45ef36[_0xf644('0x46')]['ids'][_0xf644('0x4c')];_0x2f8877+=0x1){socket['emit'](_0xf644('0xb5'),{'UserId':Number(_0x45ef36[_0xf644('0x46')][_0xf644('0x6e')][_0x2f8877]),'MailAccountId':Number(_0x45ef36[_0xf644('0x5c')]['id'])});}}else{socket[_0xf644('0xb2')](_0xf644('0xb5'),{'UserId':Number(_0x45ef36[_0xf644('0x46')][_0xf644('0x6e')]),'MailAccountId':Number(_0x45ef36[_0xf644('0x5c')]['id'])});}});}})[_0xf644('0x21')](respondWithStatusCode(_0x56c38e,null))['catch'](handleError(_0x56c38e,null));};exports[_0xf644('0xb6')]=function(_0x468b3b,_0x53f1b6){var _0x5c0e6e={};var _0x2e20ac={};var _0x511a16;var _0x49a68e;return db[_0xf644('0x58')][_0xf644('0x6b')]({'where':{'id':_0x468b3b[_0xf644('0x5c')]['id']}})['then'](handleEntityNotFound(_0x53f1b6,null))[_0xf644('0x21')](function(_0x181212){if(_0x181212){_0x511a16=_0x181212;_0x2e20ac[_0xf644('0x45')]=_[_0xf644('0x47')](db[_0xf644('0xb7')][_0xf644('0x5e')]);_0x2e20ac['query']=_[_0xf644('0x47')](_0x468b3b[_0xf644('0x46')]);_0x2e20ac[_0xf644('0x48')]=_[_0xf644('0x49')](_0x2e20ac[_0xf644('0x45')],_0x2e20ac[_0xf644('0x46')]);_0x5c0e6e[_0xf644('0x4a')]=_[_0xf644('0x49')](_0x2e20ac[_0xf644('0x45')],qs[_0xf644('0x4b')](_0x468b3b[_0xf644('0x46')][_0xf644('0x4b')]));_0x5c0e6e[_0xf644('0x4a')]=_0x5c0e6e[_0xf644('0x4a')][_0xf644('0x4c')]?_0x5c0e6e[_0xf644('0x4a')]:_0x2e20ac[_0xf644('0x45')];_0x5c0e6e[_0xf644('0x4e')]=qs[_0xf644('0x4f')](_0x468b3b['query'][_0xf644('0x4f')]);_0x5c0e6e['where']=qs[_0xf644('0x48')](_[_0xf644('0x50')](_0x468b3b[_0xf644('0x46')],_0x2e20ac[_0xf644('0x48')]));if(_0x468b3b[_0xf644('0x46')][_0xf644('0x51')]){_0x5c0e6e['where']=_[_0xf644('0x54')](_0x5c0e6e[_0xf644('0x52')],{'$or':_[_0xf644('0x42')](_0x5c0e6e[_0xf644('0x4a')],function(_0xe5c4b1){var _0x347979={};_0x347979[_0xe5c4b1]={'$like':'%'+_0x468b3b[_0xf644('0x46')][_0xf644('0x51')]+'%'};return _0x347979;})});}_0x5c0e6e=_[_0xf644('0x54')]({},_0x5c0e6e,_0x468b3b[_0xf644('0x55')]);return _0x511a16[_0xf644('0xb6')](_0x5c0e6e);}})[_0xf644('0x21')](function(_0x308d60){if(_0x308d60){_0x49a68e=_0x308d60['length'];if(!_0x468b3b[_0xf644('0x46')][_0xf644('0x6c')](_0xf644('0x4d'))){_0x5c0e6e[_0xf644('0x1c')]=qs[_0xf644('0x1c')](_0x468b3b['query']['limit']);_0x5c0e6e[_0xf644('0x1a')]=qs[_0xf644('0x1a')](_0x468b3b[_0xf644('0x46')][_0xf644('0x1a')]);}return _0x511a16['getAgents'](_0x5c0e6e);}})[_0xf644('0x21')](function(_0xede800){if(_0xede800){return _0xede800?{'count':_0x49a68e,'rows':_0xede800}:null;}})['then'](respondWithResult(_0x53f1b6,null))['catch'](handleError(_0x53f1b6,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 9d82746..01e2a3d 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 _0x228b=['exports','../../mysqldb','setMaxListeners','save','update','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x228b,0x1f3));var _0xb228=function(_0x17ef33,_0x18bbc4){_0x17ef33=_0x17ef33-0x0;var _0x24fbf6=_0x228b[_0x17ef33];return _0x24fbf6;};'use strict';var EventEmitter=require('events');var MailAccount=require(_0xb228('0x0'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb228('0x1')](0x0);var events={'afterCreate':_0xb228('0x2'),'afterUpdate':_0xb228('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34993e){return function(_0x31d7a8,_0x25e55e,_0x5ae51d){MailAccountEvents['emit'](_0x34993e+':'+_0x31d7a8['id'],_0x31d7a8);MailAccountEvents['emit'](_0x34993e,_0x31d7a8);_0x5ae51d(null);};}for(var e in events){if(events[_0xb228('0x4')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0xb228('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x078a=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x078a,0x12d));var _0xa078=function(_0x54cdbc,_0x4ff331){_0x54cdbc=_0x54cdbc-0x0;var _0x35b71a=_0x078a[_0x54cdbc];return _0x35b71a;};'use strict';var EventEmitter=require(_0xa078('0x0'));var MailAccount=require(_0xa078('0x1'))['db'][_0xa078('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa078('0x3')](0x0);var events={'afterCreate':_0xa078('0x4'),'afterUpdate':_0xa078('0x5'),'afterDestroy':'remove'};function emitEvent(_0x267649){return function(_0x44af33,_0x2f4616,_0x51963f){MailAccountEvents[_0xa078('0x6')](_0x267649+':'+_0x44af33['id'],_0x44af33);MailAccountEvents['emit'](_0x267649,_0x44af33);_0x51963f(null);};}for(var e in events){if(events[_0xa078('0x7')](e)){var event=events[e];MailAccount[_0xa078('0x8')](e,emitEvent(event));}}module[_0xa078('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 1932456..215a52f 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 _0x779f=['define','mail_accounts','provider','service','host','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass'];(function(_0x334651,_0x6e99f6){var _0x29657c=function(_0x420a94){while(--_0x420a94){_0x334651['push'](_0x334651['shift']());}};_0x29657c(++_0x6e99f6);}(_0x779f,0x14a));var _0xf779=function(_0x2f81e6,_0x4f1c93){_0x2f81e6=_0x2f81e6-0x0;var _0x151638=_0x779f[_0x2f81e6];return _0x151638;};'use strict';var attributes=require('./mailAccount.attributes');module['exports']=function(_0x799354){return _0x799354[_0xf779('0x0')]('MailAccount',attributes,{'tableName':_0xf779('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x55db8c=this;var _0x2662ec={'id':_0x55db8c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x55db8c[_0xf779('0x2')]!=='custom'){_0x2662ec[_0xf779('0x3')]=_0x55db8c[_0xf779('0x2')];}else{_0x2662ec[_0xf779('0x4')]=_0x55db8c[_0xf779('0x5')][_0xf779('0x4')];_0x2662ec['port']=_0x55db8c[_0xf779('0x5')]['port'];_0x2662ec[_0xf779('0x6')]=_0x55db8c[_0xf779('0x5')][_0xf779('0x6')];}if(_0x55db8c[_0xf779('0x5')]['authentication']){if(_0x55db8c[_0xf779('0x5')][_0xf779('0x7')]){if(!_0x55db8c['Smtp'][_0xf779('0x8')])throw new Error(_0xf779('0x9'));_0x2662ec[_0xf779('0xa')]={'type':_0xf779('0xb'),'user':_0x55db8c[_0xf779('0x5')][_0xf779('0xc')],'accessToken':_0x55db8c[_0xf779('0x5')][_0xf779('0x8')][_0xf779('0xd')]};}else{_0x2662ec['auth']={'user':_0x55db8c[_0xf779('0x5')][_0xf779('0xc')],'pass':_0x55db8c[_0xf779('0x5')][_0xf779('0xe')]};}}return _0x2662ec;}}});}; \ No newline at end of file +var _0xc524=['user','./mailAccount.attributes','exports','define','MailAccount','provider','service','host','port','Smtp','secure','authentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2'];(function(_0x104a84,_0x285970){var _0x4973ff=function(_0x5064e7){while(--_0x5064e7){_0x104a84['push'](_0x104a84['shift']());}};_0x4973ff(++_0x285970);}(_0xc524,0xa1));var _0x4c52=function(_0x4e6de3,_0x206f46){_0x4e6de3=_0x4e6de3-0x0;var _0x1a79a0=_0xc524[_0x4e6de3];return _0x1a79a0;};'use strict';var attributes=require(_0x4c52('0x0'));module[_0x4c52('0x1')]=function(_0x9e9dac){return _0x9e9dac[_0x4c52('0x2')](_0x4c52('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x5c6ec0=this;var _0x294e52={'id':_0x5c6ec0['id'],'tls':{'rejectUnauthorized':![]}};if(_0x5c6ec0[_0x4c52('0x4')]!=='custom'){_0x294e52[_0x4c52('0x5')]=_0x5c6ec0[_0x4c52('0x4')];}else{_0x294e52[_0x4c52('0x6')]=_0x5c6ec0['Smtp']['host'];_0x294e52[_0x4c52('0x7')]=_0x5c6ec0[_0x4c52('0x8')]['port'];_0x294e52[_0x4c52('0x9')]=_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0x9')];}if(_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0xa')]){if(_0x5c6ec0[_0x4c52('0x8')]['modernAuthentication']){if(!_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0xb')])throw new Error(_0x4c52('0xc'));_0x294e52[_0x4c52('0xd')]={'type':_0x4c52('0xe'),'user':_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0xf')],'accessToken':_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0xb')]['data5']};}else{_0x294e52['auth']={'user':_0x5c6ec0[_0x4c52('0x8')][_0x4c52('0xf')],'pass':_0x5c6ec0[_0x4c52('0x8')]['pass']};}}return _0x294e52;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 3d92eeb..5c6fb0b 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 _0x0e4b=['unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','Start','startRouting','lodash','moment','bluebird','ioredis','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetMailAccount','MailAccount','findAll','options','attributes','include','map','model','stringify','catch','ShowMailAccount','raw','where','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','Contacts','MailApplication','Applications','CloudProvider','smtpOptions','applications','list','orderBy','priority','asc','push','length','autoclose','*,*,*,*','List\x20not\x20found','messageId','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','created','contact','originTo','originCc','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','Attachments','name','UserId'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x37cc43,_0x4d48be){_0x37cc43=_0x37cc43-0x0;var _0x42cea4=_0x0e4b[_0x37cc43];return _0x42cea4;};'use strict';var _=require(_0xb0e4('0x0'));var moment=require(_0xb0e4('0x1'));var BPromise=require(_0xb0e4('0x2'));var rs=require('randomstring');var Redis=require(_0xb0e4('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xb0e4('0x4'));var client=jayson[_0xb0e4('0x5')]['http']({'port':0x232c});config[_0xb0e4('0x6')]=_[_0xb0e4('0x7')](config[_0xb0e4('0x6')],{'host':_0xb0e4('0x8'),'port':0x18eb});var socket=require(_0xb0e4('0x9'))(new Redis(config['redis']));require('./mailAccount.socket')[_0xb0e4('0xa')](socket);function respondWithRpcPromise(_0x9d4a99,_0x1d6452,_0x23555b){return new BPromise(function(_0x12a36a,_0x140b7e){return client[_0xb0e4('0xb')](_0x9d4a99,_0x23555b)[_0xb0e4('0xc')](function(_0x38019d){logger[_0xb0e4('0xd')](_0xb0e4('0xe'),_0x1d6452,_0xb0e4('0xf'));logger[_0xb0e4('0x10')](_0xb0e4('0x11'),_0x1d6452,_0xb0e4('0xf'),JSON['stringify'](_0x38019d));if(_0x38019d[_0xb0e4('0x12')]){if(_0x38019d[_0xb0e4('0x12')]['code']===0x1f4){logger[_0xb0e4('0x12')](_0xb0e4('0xe'),_0x1d6452,_0x38019d[_0xb0e4('0x12')][_0xb0e4('0x13')]);return _0x140b7e(_0x38019d[_0xb0e4('0x12')]['message']);}logger['error'](_0xb0e4('0xe'),_0x1d6452,_0x38019d[_0xb0e4('0x12')]['message']);return _0x12a36a(_0x38019d[_0xb0e4('0x12')][_0xb0e4('0x13')]);}else{logger[_0xb0e4('0xd')](_0xb0e4('0xe'),_0x1d6452,_0xb0e4('0xf'));_0x12a36a(_0x38019d[_0xb0e4('0x14')]['message']);}})['catch'](function(_0x4ba49e){logger[_0xb0e4('0x12')](_0xb0e4('0xe'),_0x1d6452,_0x4ba49e);_0x140b7e(_0x4ba49e);});});}exports[_0xb0e4('0x15')]=function(_0x690682){var _0x2ce0c6=this;return new Promise(function(_0x2f3809,_0x54b7ff){return db[_0xb0e4('0x16')][_0xb0e4('0x17')]({'raw':_0x690682[_0xb0e4('0x18')]?_0x690682[_0xb0e4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x690682[_0xb0e4('0x18')]?_0x690682[_0xb0e4('0x18')]['where']||null:null,'attributes':_0x690682[_0xb0e4('0x18')]?_0x690682[_0xb0e4('0x18')][_0xb0e4('0x19')]||null:null,'limit':_0x690682['options']?_0x690682[_0xb0e4('0x18')]['limit']||null:null,'include':_0x690682['options']?_0x690682[_0xb0e4('0x18')][_0xb0e4('0x1a')]?_[_0xb0e4('0x1b')](_0x690682[_0xb0e4('0x18')][_0xb0e4('0x1a')],function(_0x248aa5){return{'model':db[_0x248aa5[_0xb0e4('0x1c')]],'as':_0x248aa5['as'],'attributes':_0x248aa5['attributes'],'include':_0x248aa5[_0xb0e4('0x1a')]?_['map'](_0x248aa5[_0xb0e4('0x1a')],function(_0x22033f){return{'model':db[_0x22033f[_0xb0e4('0x1c')]],'as':_0x22033f['as'],'attributes':_0x22033f[_0xb0e4('0x19')],'include':_0x22033f['include']?_[_0xb0e4('0x1b')](_0x22033f[_0xb0e4('0x1a')],function(_0x15d402){return{'model':db[_0x15d402[_0xb0e4('0x1c')]],'as':_0x15d402['as'],'attributes':_0x15d402[_0xb0e4('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb0e4('0xc')](function(_0x1dad0e){logger[_0xb0e4('0xd')]('GetMailAccount',_0x690682);logger[_0xb0e4('0x10')]('GetMailAccount',_0x690682,JSON[_0xb0e4('0x1d')](_0x1dad0e));_0x2f3809(_0x1dad0e);})[_0xb0e4('0x1e')](function(_0x50cef9){logger[_0xb0e4('0x12')](_0xb0e4('0x15'),_0x50cef9[_0xb0e4('0x13')],_0x690682);_0x54b7ff(_0x2ce0c6[_0xb0e4('0x12')](0x1f4,_0x50cef9[_0xb0e4('0x13')]));});});};exports[_0xb0e4('0x1f')]=function(_0x5e8667){var _0x30d324=this;return new Promise(function(_0x57339c,_0x5b3d93){return db[_0xb0e4('0x16')]['find']({'raw':_0x5e8667[_0xb0e4('0x18')]?_0x5e8667['options'][_0xb0e4('0x20')]===undefined?!![]:![]:!![],'where':_0x5e8667['options']?_0x5e8667[_0xb0e4('0x18')][_0xb0e4('0x21')]||null:null,'attributes':_0x5e8667[_0xb0e4('0x18')]?_0x5e8667['options'][_0xb0e4('0x19')]||null:null,'include':_0x5e8667['options']?_0x5e8667[_0xb0e4('0x18')][_0xb0e4('0x1a')]?_[_0xb0e4('0x1b')](_0x5e8667[_0xb0e4('0x18')][_0xb0e4('0x1a')],function(_0x59870f){return{'model':db[_0x59870f[_0xb0e4('0x1c')]],'as':_0x59870f['as'],'attributes':_0x59870f['attributes'],'include':_0x59870f[_0xb0e4('0x1a')]?_[_0xb0e4('0x1b')](_0x59870f[_0xb0e4('0x1a')],function(_0x5451f2){return{'model':db[_0x5451f2[_0xb0e4('0x1c')]],'as':_0x5451f2['as'],'attributes':_0x5451f2[_0xb0e4('0x19')],'include':_0x5451f2[_0xb0e4('0x1a')]?_[_0xb0e4('0x1b')](_0x5451f2['include'],function(_0x4b6f58){return{'model':db[_0x4b6f58['model']],'as':_0x4b6f58['as'],'attributes':_0x4b6f58['attributes']};}):[]};}):[]};}):[]:[]})[_0xb0e4('0xc')](function(_0x4b924d){if(_0x5e8667[_0xb0e4('0x18')]['smtp']===!![])_0x4b924d[_0xb0e4('0x22')]('smtpOptions',_0x4b924d[_0xb0e4('0x23')]());logger[_0xb0e4('0xd')](_0xb0e4('0x1f'),_0x5e8667);logger[_0xb0e4('0x10')]('ShowMailAccount',_0x5e8667,JSON[_0xb0e4('0x1d')](_0x4b924d));_0x57339c(_0x4b924d);})[_0xb0e4('0x1e')](function(_0x5dc154){logger[_0xb0e4('0x12')]('ShowMailAccount',_0x5dc154[_0xb0e4('0x13')],_0x5e8667);_0x5b3d93(_0x30d324[_0xb0e4('0x12')](0x1f4,_0x5dc154['message']));});});};exports[_0xb0e4('0x24')]=function(_0x4f7f39){var _0x52f41e=this;return new Promise(function(_0x4ec8c6,_0x114098){var _0x3fbde8={'body':_0x4f7f39['body'],'channel':_0xb0e4('0x25')};var _0x5eb2f4=_[_0xb0e4('0x26')](_[_0xb0e4('0x27')](db[_0xb0e4('0x28')][_0xb0e4('0x29')]),['createdAt',_0xb0e4('0x2a'),_0xb0e4('0x2b'),_0xb0e4('0x2c')]);var _0x3e839e=![];if(_0x4f7f39[_0xb0e4('0x2d')]['id']){delete _0x4f7f39[_0xb0e4('0x2d')]['id'];}if(_[_0xb0e4('0x2e')](_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x2f')])){return _0x114098(_0x52f41e[_0xb0e4('0x12')](0x1f4,_0xb0e4('0x30')));}if(_[_0xb0e4('0x2e')](_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x2d')])||_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x2d')]===''){return _0x114098(_0x52f41e['error'](0x1f4,_0xb0e4('0x31')));}if(_[_0xb0e4('0x2e')](_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x32')])){return _0x114098(_0x52f41e['error'](0x1f4,_0xb0e4('0x33')+_0x5eb2f4));}if(!_[_0xb0e4('0x34')](_0x5eb2f4,_0x4f7f39['body'][_0xb0e4('0x32')])){return _0x114098(_0x52f41e[_0xb0e4('0x12')](0x1f4,_0xb0e4('0x35')+_0x5eb2f4));}var _0x40a365={};_0x40a365[_0x4f7f39['body'][_0xb0e4('0x32')]]=_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x2f')];return db[_0xb0e4('0x16')][_0xb0e4('0x36')]({'where':{'id':_0x4f7f39[_0xb0e4('0x37')]['id']},'include':[{'model':db[_0xb0e4('0x38')],'as':_0xb0e4('0x39'),'include':[{'model':db[_0xb0e4('0x28')],'as':_0xb0e4('0x3a'),'where':_0x40a365,'limit':0x1,'order':[[_0xb0e4('0x2a'),'DESC']]}]},{'model':db[_0xb0e4('0x3b')],'as':_0xb0e4('0x3c')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xb0e4('0x3d')}]}]})[_0xb0e4('0xc')](function(_0x4c2036){if(_0x4c2036&&_0x4c2036['List']){var _0x5e8a9a=_0x4c2036['get']({'plain':!![]});_0x3fbde8['account']=_['omit'](_0x5e8a9a,[_0xb0e4('0x3c'),'List']);_0x3fbde8[_0xb0e4('0x37')][_0xb0e4('0x3e')]=_0x4c2036[_0xb0e4('0x23')]();_0x3fbde8[_0xb0e4('0x3f')]=_0x5e8a9a['Applications'];_0x3fbde8[_0xb0e4('0x40')]=_0x5e8a9a[_0xb0e4('0x39')];_0x3fbde8['applications']=_[_0xb0e4('0x41')](_0x3fbde8['applications'],[_0xb0e4('0x42')],[_0xb0e4('0x43')]);if(_0x3fbde8[_0xb0e4('0x37')]&&_0x3fbde8[_0xb0e4('0x37')]['autoclose']){_0x3fbde8[_0xb0e4('0x3f')][_0xb0e4('0x44')]({'id':0x0,'priority':_0x3fbde8[_0xb0e4('0x3f')][_0xb0e4('0x45')]+0x1,'app':'close','appdata':_0xb0e4('0x46'),'interval':_0xb0e4('0x47')});}if(_0x3fbde8[_0xb0e4('0x37')]['Applications']){delete _0x3fbde8['account']['Applications'];}if(_0x3fbde8['account']['List']){delete _0x3fbde8[_0xb0e4('0x37')]['List'];}if(_0x5e8a9a[_0xb0e4('0x39')][_0xb0e4('0x3a')][_0xb0e4('0x45')]){return _0x5e8a9a[_0xb0e4('0x39')]['Contacts'][0x0];}var _0x387319=_[_0xb0e4('0x7')](_0x4f7f39['body'],{'firstName':_0x4f7f39[_0xb0e4('0x2d')]['from'],'ListId':_0x5e8a9a[_0xb0e4('0x2c')]});_0x387319[_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x32')]]=_0x4f7f39['body'][_0xb0e4('0x2f')];return db[_0xb0e4('0x28')]['create'](_0x387319);}else{throw new Error(_0xb0e4('0x48'));}})[_0xb0e4('0xc')](function(_0x4cf438){_0x3fbde8['contact']=_0x4cf438;if(_0x4cf438){if(!_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x49')]){_0x4f7f39['body'][_0xb0e4('0x13')][_0xb0e4('0x49')]=rs['generate']()+'\x20'+_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')]['from'];}var _0x108395={'ContactId':_0x4cf438['id'],'MailAccountId':_0x4f7f39[_0xb0e4('0x37')]['id'],'inReplyTo':_0x4f7f39[_0xb0e4('0x2d')]['message'][_0xb0e4('0x49')],'to':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x2f')],'cc':_0x4f7f39['body'][_0xb0e4('0x13')]['cc'],'subject':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x4a')],'attach':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x4b')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xb0e4('0x4c')][_0xb0e4('0x36')]({'where':{'closed':![],'MailAccountId':_0x4f7f39[_0xb0e4('0x37')]['id']},'include':[{'model':db[_0xb0e4('0x4d')],'as':_0xb0e4('0x4e'),'attributes':[_0xb0e4('0x49')],'where':{'messageId':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x4f')]}}]})[_0xb0e4('0xc')](function(_0x115dc7){if(_0x115dc7){return[_0x115dc7,![]];}return db[_0xb0e4('0x4c')][_0xb0e4('0x50')](_0x108395)[_0xb0e4('0xc')](function(_0xd3115a){return[_0xd3115a,!![]];});});}else{throw new Error(_0xb0e4('0x51'));}})['spread'](function(_0x4b1c07,_0x55868c){if(_0x4b1c07){_0x3e839e=_0x55868c;if(!_0x55868c){return _0x4b1c07[_0xb0e4('0x52')]({'inReplyTo':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x49')],'to':_0x4f7f39['body']['message'][_0xb0e4('0x2f')],'cc':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')]['cc'],'subject':_0x4f7f39['body'][_0xb0e4('0x13')][_0xb0e4('0x4a')],'attach':_0x4b1c07['attach']?_0x4b1c07['attach']:_0x4f7f39[_0xb0e4('0x2d')]['message'][_0xb0e4('0x4b')],'substatus':null,'substatusAt':moment()[_0xb0e4('0x53')](_0xb0e4('0x54')),'lastMsgAt':moment()[_0xb0e4('0x53')](_0xb0e4('0x54')),'lastMsgDirection':'in'});}else{return _0x4b1c07;}}})[_0xb0e4('0xc')](function(_0x164c79){_0x3fbde8[_0xb0e4('0x55')]=_0x164c79[_0xb0e4('0x56')]({'plain':!![]});_0x3fbde8[_0xb0e4('0x55')][_0xb0e4('0x57')]=_0x3e839e;return db['MailMessage'][_0xb0e4('0x50')]({'body':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x2d')],'MailAccountId':_0x4f7f39[_0xb0e4('0x37')]['id'],'MailInteractionId':_0x164c79['id'],'direction':'in','ContactId':_0x3fbde8[_0xb0e4('0x58')]['id'],'messageId':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x49')],'from':_0x4f7f39['body'][_0xb0e4('0x13')][_0xb0e4('0x2f')],'to':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')]['to'],'cc':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')]['cc'],'subject':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x4a')],'attach':_0x4f7f39['body'][_0xb0e4('0x13')]['attach'],'Attachments':_0x4f7f39[_0xb0e4('0x2d')]['message']['attachments'],'originTo':_0x4f7f39['body'][_0xb0e4('0x13')][_0xb0e4('0x59')],'originCc':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')][_0xb0e4('0x5a')],'bcc':_0x4f7f39[_0xb0e4('0x2d')][_0xb0e4('0x13')]['bcc'],'ChatWebsiteId':_0x4f7f39[_0xb0e4('0x2d')]['message'][_0xb0e4('0x5b')]||null,'originChannel':_0x4f7f39['body']['message'][_0xb0e4('0x5c')]||'Email','ChatOfflineMessageId':_0x4f7f39['body'][_0xb0e4('0x13')][_0xb0e4('0x5d')]||null},{'include':[{'model':db[_0xb0e4('0x5e')],'as':_0xb0e4('0x5f')}]});})['then'](function(_0x193a35){_0x3fbde8[_0xb0e4('0x13')]=_0x193a35;if(!_0x3fbde8[_0xb0e4('0x55')]['UserId']){return;}return db['User'][_0xb0e4('0x36')]({'attributes':['id',_0xb0e4('0x60')],'where':{'id':_0x3fbde8[_0xb0e4('0x55')][_0xb0e4('0x61')]}});})['then'](function(_0x2ef0a4){if(_0x2ef0a4){_0x3fbde8['applications'][_0xb0e4('0x62')]({'id':0x0,'priority':0x0,'app':_0xb0e4('0x63'),'appdata':_0x2ef0a4[_0xb0e4('0x60')]+','+(_0x3fbde8[_0xb0e4('0x37')][_0xb0e4('0x64')]||0xa),'interval':_0xb0e4('0x47')});}if(!_0x3fbde8[_0xb0e4('0x55')]['queueId']){return;}return db[_0xb0e4('0x65')][_0xb0e4('0x36')]({'attributes':['id',_0xb0e4('0x60')],'where':{'id':_0x3fbde8[_0xb0e4('0x55')][_0xb0e4('0x66')]}});})[_0xb0e4('0xc')](function(_0x2f4b49){if(_0x2f4b49){_0x3fbde8[_0xb0e4('0x3f')][_0xb0e4('0x62')]({'id':0x0,'priority':0x1,'app':_0xb0e4('0x67'),'appdata':_0x2f4b49[_0xb0e4('0x60')]+','+(_0x3fbde8[_0xb0e4('0x37')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb0e4('0x47')});}return respondWithRpcPromise(_0xb0e4('0x68'),_0xb0e4('0x69'),_0x3fbde8);})['then'](function(_0x359148){_0x4ec8c6(_0x359148);})[_0xb0e4('0x1e')](function(_0x467277){_0x114098(_0x52f41e[_0xb0e4('0x12')](0x1f4,_0x467277[_0xb0e4('0x13')]));});});}; \ No newline at end of file +var _0x11e5=['format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','created','contact','subject','attachments','originTo','originCc','bcc','originChannel','Email','Attachments','UserId','name','agent','queueId','unshift','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','./mailAccount.socket','register','request','then','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','length','close','*,*,*,*','create','messageId'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x11e5,0x8b));var _0x511e=function(_0x5bf9fd,_0x3f1d89){_0x5bf9fd=_0x5bf9fd-0x0;var _0x3563ce=_0x11e5[_0x5bf9fd];return _0x3563ce;};'use strict';var _=require(_0x511e('0x0'));var moment=require('moment');var BPromise=require(_0x511e('0x1'));var rs=require(_0x511e('0x2'));var Redis=require('ioredis');var db=require(_0x511e('0x3'))['db'];var logger=require(_0x511e('0x4'))(_0x511e('0x5'));var config=require('../../config/environment');var jayson=require(_0x511e('0x6'));var client=jayson['client']['http']({'port':0x232c});config[_0x511e('0x7')]=_[_0x511e('0x8')](config[_0x511e('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x511e('0x7')]));require(_0x511e('0x9'))[_0x511e('0xa')](socket);function respondWithRpcPromise(_0x306694,_0x4449c4,_0x30269e){return new BPromise(function(_0x1596b3,_0x50564b){return client[_0x511e('0xb')](_0x306694,_0x30269e)[_0x511e('0xc')](function(_0x464085){logger['info'](_0x511e('0xd'),_0x4449c4,'request\x20sent');logger['debug'](_0x511e('0xe'),_0x4449c4,_0x511e('0xf'),JSON[_0x511e('0x10')](_0x464085));if(_0x464085[_0x511e('0x11')]){if(_0x464085[_0x511e('0x11')][_0x511e('0x12')]===0x1f4){logger['error'](_0x511e('0xd'),_0x4449c4,_0x464085[_0x511e('0x11')]['message']);return _0x50564b(_0x464085[_0x511e('0x11')][_0x511e('0x13')]);}logger['error'](_0x511e('0xd'),_0x4449c4,_0x464085[_0x511e('0x11')][_0x511e('0x13')]);return _0x1596b3(_0x464085[_0x511e('0x11')]['message']);}else{logger[_0x511e('0x14')](_0x511e('0xd'),_0x4449c4,_0x511e('0xf'));_0x1596b3(_0x464085['result'][_0x511e('0x13')]);}})['catch'](function(_0x34e6cd){logger['error']('MailAccount,\x20%s,\x20%s',_0x4449c4,_0x34e6cd);_0x50564b(_0x34e6cd);});});}exports[_0x511e('0x15')]=function(_0x5c4fb9){var _0x33bef5=this;return new Promise(function(_0x325278,_0x211855){return db[_0x511e('0x16')][_0x511e('0x17')]({'raw':_0x5c4fb9[_0x511e('0x18')]?_0x5c4fb9[_0x511e('0x18')][_0x511e('0x19')]===undefined?!![]:![]:!![],'where':_0x5c4fb9['options']?_0x5c4fb9[_0x511e('0x18')][_0x511e('0x1a')]||null:null,'attributes':_0x5c4fb9[_0x511e('0x18')]?_0x5c4fb9[_0x511e('0x18')][_0x511e('0x1b')]||null:null,'limit':_0x5c4fb9[_0x511e('0x18')]?_0x5c4fb9[_0x511e('0x18')][_0x511e('0x1c')]||null:null,'include':_0x5c4fb9[_0x511e('0x18')]?_0x5c4fb9[_0x511e('0x18')]['include']?_['map'](_0x5c4fb9[_0x511e('0x18')]['include'],function(_0x1ff5c4){return{'model':db[_0x1ff5c4['model']],'as':_0x1ff5c4['as'],'attributes':_0x1ff5c4[_0x511e('0x1b')],'include':_0x1ff5c4[_0x511e('0x1d')]?_[_0x511e('0x1e')](_0x1ff5c4[_0x511e('0x1d')],function(_0x1bb7f9){return{'model':db[_0x1bb7f9[_0x511e('0x1f')]],'as':_0x1bb7f9['as'],'attributes':_0x1bb7f9[_0x511e('0x1b')],'include':_0x1bb7f9[_0x511e('0x1d')]?_[_0x511e('0x1e')](_0x1bb7f9[_0x511e('0x1d')],function(_0x5b72fe){return{'model':db[_0x5b72fe[_0x511e('0x1f')]],'as':_0x5b72fe['as'],'attributes':_0x5b72fe[_0x511e('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x511e('0xc')](function(_0x1aaac1){logger[_0x511e('0x14')]('GetMailAccount',_0x5c4fb9);logger[_0x511e('0x20')]('GetMailAccount',_0x5c4fb9,JSON['stringify'](_0x1aaac1));_0x325278(_0x1aaac1);})[_0x511e('0x21')](function(_0xb1d444){logger[_0x511e('0x11')](_0x511e('0x15'),_0xb1d444[_0x511e('0x13')],_0x5c4fb9);_0x211855(_0x33bef5['error'](0x1f4,_0xb1d444[_0x511e('0x13')]));});});};exports[_0x511e('0x22')]=function(_0xf2a22){var _0x32be08=this;return new Promise(function(_0x43c95f,_0x4de0b7){return db[_0x511e('0x16')][_0x511e('0x23')]({'raw':_0xf2a22[_0x511e('0x18')]?_0xf2a22[_0x511e('0x18')][_0x511e('0x19')]===undefined?!![]:![]:!![],'where':_0xf2a22[_0x511e('0x18')]?_0xf2a22[_0x511e('0x18')][_0x511e('0x1a')]||null:null,'attributes':_0xf2a22['options']?_0xf2a22[_0x511e('0x18')][_0x511e('0x1b')]||null:null,'include':_0xf2a22[_0x511e('0x18')]?_0xf2a22[_0x511e('0x18')]['include']?_['map'](_0xf2a22[_0x511e('0x18')]['include'],function(_0x529d08){return{'model':db[_0x529d08[_0x511e('0x1f')]],'as':_0x529d08['as'],'attributes':_0x529d08[_0x511e('0x1b')],'include':_0x529d08[_0x511e('0x1d')]?_[_0x511e('0x1e')](_0x529d08[_0x511e('0x1d')],function(_0x574378){return{'model':db[_0x574378[_0x511e('0x1f')]],'as':_0x574378['as'],'attributes':_0x574378[_0x511e('0x1b')],'include':_0x574378[_0x511e('0x1d')]?_['map'](_0x574378[_0x511e('0x1d')],function(_0xbba7ce){return{'model':db[_0xbba7ce[_0x511e('0x1f')]],'as':_0xbba7ce['as'],'attributes':_0xbba7ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x511e('0xc')](function(_0x2fd83d){if(_0xf2a22['options'][_0x511e('0x24')]===!![])_0x2fd83d[_0x511e('0x25')](_0x511e('0x26'),_0x2fd83d[_0x511e('0x27')]());logger[_0x511e('0x14')](_0x511e('0x22'),_0xf2a22);logger[_0x511e('0x20')](_0x511e('0x22'),_0xf2a22,JSON[_0x511e('0x10')](_0x2fd83d));_0x43c95f(_0x2fd83d);})[_0x511e('0x21')](function(_0x22de4f){logger['error'](_0x511e('0x22'),_0x22de4f['message'],_0xf2a22);_0x4de0b7(_0x32be08['error'](0x1f4,_0x22de4f[_0x511e('0x13')]));});});};exports['NotifyMailAccount']=function(_0x479981){var _0x2ce210=this;return new Promise(function(_0x200207,_0x3c0ef4){var _0x3d1e9d={'body':_0x479981[_0x511e('0x28')],'channel':_0x511e('0x29')};var _0x236077=_[_0x511e('0x2a')](_[_0x511e('0x2b')](db[_0x511e('0x2c')][_0x511e('0x2d')]),[_0x511e('0x2e'),_0x511e('0x2f'),_0x511e('0x30'),'ListId']);var _0x5a7a12=![];if(_0x479981[_0x511e('0x28')]['id']){delete _0x479981[_0x511e('0x28')]['id'];}if(_[_0x511e('0x31')](_0x479981[_0x511e('0x28')][_0x511e('0x32')])){return _0x3c0ef4(_0x2ce210['error'](0x1f4,_0x511e('0x33')));}if(_[_0x511e('0x31')](_0x479981[_0x511e('0x28')]['body'])||_0x479981['body']['body']===''){return _0x3c0ef4(_0x2ce210[_0x511e('0x11')](0x1f4,_0x511e('0x34')));}if(_[_0x511e('0x31')](_0x479981['body']['mapKey'])){return _0x3c0ef4(_0x2ce210['error'](0x1f4,_0x511e('0x35')+_0x236077));}if(!_[_0x511e('0x36')](_0x236077,_0x479981[_0x511e('0x28')][_0x511e('0x37')])){return _0x3c0ef4(_0x2ce210[_0x511e('0x11')](0x1f4,_0x511e('0x38')+_0x236077));}var _0x1d494f={};_0x1d494f[_0x479981[_0x511e('0x28')][_0x511e('0x37')]]=_0x479981[_0x511e('0x28')][_0x511e('0x32')];return db[_0x511e('0x16')][_0x511e('0x23')]({'where':{'id':_0x479981[_0x511e('0x39')]['id']},'include':[{'model':db[_0x511e('0x3a')],'as':_0x511e('0x3b'),'include':[{'model':db[_0x511e('0x2c')],'as':_0x511e('0x3c'),'where':_0x1d494f,'limit':0x1,'order':[[_0x511e('0x2f'),_0x511e('0x3d')]]}]},{'model':db[_0x511e('0x3e')],'as':_0x511e('0x3f')},{'model':db[_0x511e('0x40')],'as':_0x511e('0x41'),'include':[{'model':db[_0x511e('0x42')],'as':_0x511e('0x42')}]}]})[_0x511e('0xc')](function(_0x31e949){if(_0x31e949&&_0x31e949[_0x511e('0x3b')]){var _0x1f11ad=_0x31e949[_0x511e('0x43')]({'plain':!![]});_0x3d1e9d['account']=_[_0x511e('0x44')](_0x1f11ad,['Applications',_0x511e('0x3b')]);_0x3d1e9d[_0x511e('0x39')][_0x511e('0x26')]=_0x31e949['getSmtpOptions']();_0x3d1e9d[_0x511e('0x45')]=_0x1f11ad[_0x511e('0x3f')];_0x3d1e9d[_0x511e('0x46')]=_0x1f11ad['List'];_0x3d1e9d[_0x511e('0x45')]=_[_0x511e('0x47')](_0x3d1e9d['applications'],[_0x511e('0x48')],[_0x511e('0x49')]);if(_0x3d1e9d[_0x511e('0x39')]&&_0x3d1e9d[_0x511e('0x39')]['autoclose']){_0x3d1e9d[_0x511e('0x45')]['push']({'id':0x0,'priority':_0x3d1e9d[_0x511e('0x45')][_0x511e('0x4a')]+0x1,'app':_0x511e('0x4b'),'appdata':'autoclose','interval':_0x511e('0x4c')});}if(_0x3d1e9d['account'][_0x511e('0x3f')]){delete _0x3d1e9d[_0x511e('0x39')][_0x511e('0x3f')];}if(_0x3d1e9d[_0x511e('0x39')][_0x511e('0x3b')]){delete _0x3d1e9d['account'][_0x511e('0x3b')];}if(_0x1f11ad[_0x511e('0x3b')][_0x511e('0x3c')][_0x511e('0x4a')]){return _0x1f11ad[_0x511e('0x3b')][_0x511e('0x3c')][0x0];}var _0x4420c8=_[_0x511e('0x8')](_0x479981['body'],{'firstName':_0x479981[_0x511e('0x28')][_0x511e('0x32')],'ListId':_0x1f11ad['ListId']});_0x4420c8[_0x479981[_0x511e('0x28')][_0x511e('0x37')]]=_0x479981[_0x511e('0x28')][_0x511e('0x32')];return db[_0x511e('0x2c')][_0x511e('0x4d')](_0x4420c8);}else{throw new Error('List\x20not\x20found');}})[_0x511e('0xc')](function(_0x1c96c9){_0x3d1e9d['contact']=_0x1c96c9;if(_0x1c96c9){if(!_0x479981[_0x511e('0x28')]['message'][_0x511e('0x4e')]){_0x479981[_0x511e('0x28')]['message']['messageId']=rs['generate']()+'\x20'+_0x479981['body'][_0x511e('0x13')]['from'];}var _0x5b29be={'ContactId':_0x1c96c9['id'],'MailAccountId':_0x479981[_0x511e('0x39')]['id'],'inReplyTo':_0x479981[_0x511e('0x28')]['message'][_0x511e('0x4e')],'to':_0x479981['body'][_0x511e('0x13')]['from'],'cc':_0x479981['body']['message']['cc'],'subject':_0x479981[_0x511e('0x28')][_0x511e('0x13')]['subject'],'attach':_0x479981['body']['message']['attach'],'lastMsgAt':moment()[_0x511e('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x511e('0x50')]['find']({'where':{'closed':![],'MailAccountId':_0x479981[_0x511e('0x39')]['id']},'include':[{'model':db[_0x511e('0x51')],'as':_0x511e('0x52'),'attributes':[_0x511e('0x4e')],'where':{'messageId':_0x479981['body'][_0x511e('0x13')][_0x511e('0x53')]}}]})[_0x511e('0xc')](function(_0x2b493f){if(_0x2b493f){return[_0x2b493f,![]];}return db[_0x511e('0x50')]['create'](_0x5b29be)['then'](function(_0x45a7b2){return[_0x45a7b2,!![]];});});}else{throw new Error(_0x511e('0x54'));}})[_0x511e('0x55')](function(_0x537df4,_0x3d0a10){if(_0x537df4){_0x5a7a12=_0x3d0a10;if(!_0x3d0a10){return _0x537df4[_0x511e('0x56')]({'inReplyTo':_0x479981[_0x511e('0x28')][_0x511e('0x13')][_0x511e('0x4e')],'to':_0x479981[_0x511e('0x28')]['message']['from'],'cc':_0x479981['body'][_0x511e('0x13')]['cc'],'subject':_0x479981['body'][_0x511e('0x13')]['subject'],'attach':_0x537df4[_0x511e('0x57')]?_0x537df4['attach']:_0x479981[_0x511e('0x28')][_0x511e('0x13')][_0x511e('0x57')],'substatus':null,'substatusAt':moment()[_0x511e('0x4f')](_0x511e('0x58')),'lastMsgAt':moment()['format'](_0x511e('0x58')),'lastMsgDirection':'in'});}else{return _0x537df4;}}})['then'](function(_0x435b2a){_0x3d1e9d[_0x511e('0x59')]=_0x435b2a[_0x511e('0x43')]({'plain':!![]});_0x3d1e9d['interaction'][_0x511e('0x5a')]=_0x5a7a12;return db[_0x511e('0x51')][_0x511e('0x4d')]({'body':_0x479981[_0x511e('0x28')]['body'],'MailAccountId':_0x479981['account']['id'],'MailInteractionId':_0x435b2a['id'],'direction':'in','ContactId':_0x3d1e9d[_0x511e('0x5b')]['id'],'messageId':_0x479981[_0x511e('0x28')]['message'][_0x511e('0x4e')],'from':_0x479981['body'][_0x511e('0x13')][_0x511e('0x32')],'to':_0x479981['body']['message']['to'],'cc':_0x479981[_0x511e('0x28')][_0x511e('0x13')]['cc'],'subject':_0x479981[_0x511e('0x28')]['message'][_0x511e('0x5c')],'attach':_0x479981[_0x511e('0x28')][_0x511e('0x13')][_0x511e('0x57')],'Attachments':_0x479981[_0x511e('0x28')][_0x511e('0x13')][_0x511e('0x5d')],'originTo':_0x479981['body'][_0x511e('0x13')][_0x511e('0x5e')],'originCc':_0x479981['body']['message'][_0x511e('0x5f')],'bcc':_0x479981[_0x511e('0x28')]['message'][_0x511e('0x60')],'ChatWebsiteId':_0x479981['body'][_0x511e('0x13')]['ChatWebsiteId']||null,'originChannel':_0x479981['body'][_0x511e('0x13')][_0x511e('0x61')]||_0x511e('0x62'),'ChatOfflineMessageId':_0x479981[_0x511e('0x28')][_0x511e('0x13')]['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x511e('0x63')}]});})[_0x511e('0xc')](function(_0x302e05){_0x3d1e9d['message']=_0x302e05;if(!_0x3d1e9d[_0x511e('0x59')][_0x511e('0x64')]){return;}return db['User']['find']({'attributes':['id',_0x511e('0x65')],'where':{'id':_0x3d1e9d[_0x511e('0x59')][_0x511e('0x64')]}});})[_0x511e('0xc')](function(_0x47359f){if(_0x47359f){_0x3d1e9d[_0x511e('0x45')]['unshift']({'id':0x0,'priority':0x0,'app':_0x511e('0x66'),'appdata':_0x47359f[_0x511e('0x65')]+','+(_0x3d1e9d['account']['waitForTheAssignedAgent']||0xa),'interval':_0x511e('0x4c')});}if(!_0x3d1e9d['interaction'][_0x511e('0x67')]){return;}return db['MailQueue']['find']({'attributes':['id',_0x511e('0x65')],'where':{'id':_0x3d1e9d[_0x511e('0x59')][_0x511e('0x67')]}});})[_0x511e('0xc')](function(_0x3b497b){if(_0x3b497b){_0x3d1e9d[_0x511e('0x45')][_0x511e('0x68')]({'id':0x0,'priority':0x1,'app':_0x511e('0x69'),'appdata':_0x3b497b[_0x511e('0x65')]+','+(_0x3d1e9d[_0x511e('0x39')][_0x511e('0x6a')]||0x12c),'interval':_0x511e('0x4c')});}return respondWithRpcPromise(_0x511e('0x6b'),_0x511e('0x6c'),_0x3d1e9d);})[_0x511e('0xc')](function(_0x327516){_0x200207(_0x327516);})['catch'](function(_0x38b1cc){_0x3c0ef4(_0x2ce210[_0x511e('0x11')](0x1f4,_0x38b1cc[_0x511e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index fc72bc4..d5cf6c7 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 _0xc0bf=['save','remove','update','emit','removeListener','register','length'];(function(_0x5850ee,_0x4a7317){var _0x1e97fd=function(_0x418de9){while(--_0x418de9){_0x5850ee['push'](_0x5850ee['shift']());}};_0x1e97fd(++_0x4a7317);}(_0xc0bf,0x8c));var _0xfc0b=function(_0x353f6e,_0x5e38a7){_0x353f6e=_0x353f6e-0x0;var _0x30aa1d=_0xc0bf[_0x353f6e];return _0x30aa1d;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xfc0b('0x0'),_0xfc0b('0x1'),_0xfc0b('0x2')];function createListener(_0x12e8c2,_0x47f0cb){return function(_0x5e24fb){_0x47f0cb[_0xfc0b('0x3')](_0x12e8c2,_0x5e24fb);};}function removeListener(_0x2e3005,_0x3d6b66){return function(){MailAccountEvents[_0xfc0b('0x4')](_0x2e3005,_0x3d6b66);};}exports[_0xfc0b('0x5')]=function(_0x408af9){for(var _0x2761aa=0x0,_0x3c8ee5=events[_0xfc0b('0x6')];_0x2761aa<_0x3c8ee5;_0x2761aa++){var _0x2c41c0=events[_0x2761aa];var _0x4f3506=createListener('mailAccount:'+_0x2c41c0,_0x408af9);MailAccountEvents['on'](_0x2c41c0,_0x4f3506);}}; \ No newline at end of file +var _0xd12a=['save','update','removeListener','register','length','mailAccount:'];(function(_0x1cfbe3,_0x3bef79){var _0xf90c3=function(_0x208ad5){while(--_0x208ad5){_0x1cfbe3['push'](_0x1cfbe3['shift']());}};_0xf90c3(++_0x3bef79);}(_0xd12a,0x1f2));var _0xad12=function(_0x11824f,_0x540b4e){_0x11824f=_0x11824f-0x0;var _0x3bb497=_0xd12a[_0x11824f];return _0x3bb497;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xad12('0x0'),'remove',_0xad12('0x1')];function createListener(_0x4f98a3,_0x4dccd8){return function(_0x2c9a30){_0x4dccd8['emit'](_0x4f98a3,_0x2c9a30);};}function removeListener(_0x4ef429,_0x1df5b4){return function(){MailAccountEvents[_0xad12('0x2')](_0x4ef429,_0x1df5b4);};}exports[_0xad12('0x3')]=function(_0x5b3733){for(var _0x35484=0x0,_0x2af5ac=events[_0xad12('0x4')];_0x35484<_0x2af5ac;_0x35484++){var _0x314777=events[_0x35484];var _0x5f4080=createListener(_0xad12('0x5')+_0x314777,_0x5b3733);MailAccountEvents['on'](_0x314777,_0x5f4080);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 75fcf90..972bbe4 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 _0x5f29=['get','isAuthenticated','update','delete','/:id','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x55efb6,_0x37d174){var _0x1c5521=function(_0x340b71){while(--_0x340b71){_0x55efb6['push'](_0x55efb6['shift']());}};_0x1c5521(++_0x37d174);}(_0x5f29,0xaf));var _0x95f2=function(_0x176c4d,_0x428fe7){_0x176c4d=_0x176c4d-0x0;var _0x3ef765=_0x5f29[_0x176c4d];return _0x3ef765;};'use strict';var multer=require('multer');var util=require(_0x95f2('0x0'));var path=require('path');var timeout=require(_0x95f2('0x1'));var express=require('express');var router=express[_0x95f2('0x2')]();var fs_extra=require(_0x95f2('0x3'));var auth=require(_0x95f2('0x4'));var interaction=require(_0x95f2('0x5'));var config=require(_0x95f2('0x6'));var controller=require('./mailApplication.controller');router[_0x95f2('0x7')]('/:id',auth[_0x95f2('0x8')](),controller['show']);router['put']('/:id',auth[_0x95f2('0x8')](),controller[_0x95f2('0x9')]);router[_0x95f2('0xa')](_0x95f2('0xb'),auth['isAuthenticated'](),controller[_0x95f2('0xc')]);module[_0x95f2('0xd')]=router; \ No newline at end of file +var _0x3b05=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','show','put','update','delete'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0x3b05,0x1d2));var _0x53b0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x3b05[_0x2b4411];return _0x8e41ef;};'use strict';var multer=require(_0x53b0('0x0'));var util=require(_0x53b0('0x1'));var path=require(_0x53b0('0x2'));var timeout=require(_0x53b0('0x3'));var express=require(_0x53b0('0x4'));var router=express[_0x53b0('0x5')]();var fs_extra=require(_0x53b0('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x53b0('0x7'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x53b0('0x8')](_0x53b0('0x9'),auth['isAuthenticated'](),controller[_0x53b0('0xa')]);router[_0x53b0('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x53b0('0xc')]);router[_0x53b0('0xd')](_0x53b0('0x9'),auth['isAuthenticated'](),controller[_0x53b0('0xe')]);module[_0x53b0('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 27bb052..62d449b 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 _0x2dfa=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x50aec5,_0x12464c){var _0x3b86c4=function(_0x4d457b){while(--_0x4d457b){_0x50aec5['push'](_0x50aec5['shift']());}};_0x3b86c4(++_0x12464c);}(_0x2dfa,0xd7));var _0xa2df=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2dfa[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0xa2df('0x0'));module[_0xa2df('0x1')]={'priority':{'type':Sequelize[_0xa2df('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xa2df('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xa2df('0x4')],'defaultValue':_0xa2df('0x5')}}; \ No newline at end of file +var _0x19dc=['noop','TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x4ffc05,_0x4b02a8){var _0x3dc53e=function(_0x36bd84){while(--_0x36bd84){_0x4ffc05['push'](_0x4ffc05['shift']());}};_0x3dc53e(++_0x4b02a8);}(_0x19dc,0x93));var _0xc19d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x19dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc19d('0x0'));module['exports']={'priority':{'type':Sequelize[_0xc19d('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xc19d('0x2')],'allowNull':![],'defaultValue':_0xc19d('0x3')},'appdata':{'type':Sequelize[_0xc19d('0x4')]()},'description':{'type':Sequelize[_0xc19d('0x2')]},'interval':{'type':Sequelize[_0xc19d('0x2')],'defaultValue':_0xc19d('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 55e82d0..0b14b71 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbdb7=['update','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','attributes','length','includeAll','merge','find','then','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x4ae8f3,_0x3a27cf){_0x4ae8f3=_0x4ae8f3-0x0;var _0x1bcedd=_0xbdb7[_0x4ae8f3];return _0x1bcedd;};'use strict';var emlformat=require(_0x7bdb('0x0'));var rimraf=require(_0x7bdb('0x1'));var zipdir=require(_0x7bdb('0x2'));var jsonpatch=require(_0x7bdb('0x3'));var rp=require(_0x7bdb('0x4'));var moment=require(_0x7bdb('0x5'));var BPromise=require(_0x7bdb('0x6'));var Mustache=require(_0x7bdb('0x7'));var util=require(_0x7bdb('0x8'));var path=require('path');var sox=require(_0x7bdb('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7bdb('0xa'));var _=require(_0x7bdb('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7bdb('0xc'));var deskjs=require(_0x7bdb('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7bdb('0xe'));var Redis=require(_0x7bdb('0xf'));var authService=require(_0x7bdb('0x10'));var qs=require(_0x7bdb('0x11'));var as=require(_0x7bdb('0x12'));var hardwareService=require(_0x7bdb('0x13'));var logger=require(_0x7bdb('0x14'))(_0x7bdb('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7bdb('0x16'))['db'];function respondWithStatusCode(_0x25e3cb,_0x496613){_0x496613=_0x496613||0xcc;return function(_0x8d74ff){if(_0x8d74ff){return _0x25e3cb['sendStatus'](_0x496613);}return _0x25e3cb['status'](_0x496613)[_0x7bdb('0x17')]();};}function respondWithResult(_0x46dd4a,_0x4fd91a){_0x4fd91a=_0x4fd91a||0xc8;return function(_0x50eeca){if(_0x50eeca){return _0x46dd4a['status'](_0x4fd91a)[_0x7bdb('0x18')](_0x50eeca);}};}function respondWithFilteredResult(_0x195b2e,_0xe9919f){return function(_0x25d417){if(_0x25d417){var _0x31c909=typeof _0xe9919f[_0x7bdb('0x19')]===_0x7bdb('0x1a')&&typeof _0xe9919f[_0x7bdb('0x1b')]==='undefined';var _0x1c5750=_0x25d417[_0x7bdb('0x1c')];var _0x5723f4=_0x31c909?0x0:_0xe9919f[_0x7bdb('0x19')];var _0x4ffd4b=_0x31c909?_0x25d417[_0x7bdb('0x1c')]:_0xe9919f[_0x7bdb('0x19')]+_0xe9919f['limit'];var _0x3e5f8e;if(_0x4ffd4b>=_0x1c5750){_0x4ffd4b=_0x1c5750;_0x3e5f8e=0xc8;}else{_0x3e5f8e=0xce;}_0x195b2e[_0x7bdb('0x1d')](_0x3e5f8e);return _0x195b2e[_0x7bdb('0x1e')](_0x7bdb('0x1f'),_0x5723f4+'-'+_0x4ffd4b+'/'+_0x1c5750)[_0x7bdb('0x18')](_0x25d417);}return null;};}function patchUpdates(_0x5bfc35){return function(_0x49f353){try{jsonpatch[_0x7bdb('0x20')](_0x49f353,_0x5bfc35,!![]);}catch(_0xcb25f2){return BPromise['reject'](_0xcb25f2);}return _0x49f353[_0x7bdb('0x21')]();};}function saveUpdates(_0x118ea1,_0x346c72){return function(_0x3f53e7){if(_0x3f53e7){return _0x3f53e7[_0x7bdb('0x22')](_0x118ea1)['then'](function(_0x1d37ac){return _0x1d37ac;});}return null;};}function removeEntity(_0xdad53d,_0x40c447){return function(_0x3a456f){if(_0x3a456f){return _0x3a456f['destroy']()['then'](function(){_0xdad53d[_0x7bdb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47abaf,_0x4a9e02){return function(_0x2abef6){if(!_0x2abef6){_0x47abaf['sendStatus'](0x194);}return _0x2abef6;};}function handleError(_0x2b14bc,_0x72ba69){_0x72ba69=_0x72ba69||0x1f4;return function(_0x3ec129){logger[_0x7bdb('0x23')](_0x3ec129[_0x7bdb('0x24')]);if(_0x3ec129['name']){delete _0x3ec129[_0x7bdb('0x25')];}_0x2b14bc[_0x7bdb('0x1d')](_0x72ba69)[_0x7bdb('0x26')](_0x3ec129);};}exports[_0x7bdb('0x27')]=function(_0x371e8a,_0x2e8e65){var _0x1e9996={'raw':!![],'where':{'id':_0x371e8a[_0x7bdb('0x28')]['id']}},_0xd2d7be={};_0xd2d7be[_0x7bdb('0x29')]=_[_0x7bdb('0x2a')](db[_0x7bdb('0x2b')]['rawAttributes']);_0xd2d7be[_0x7bdb('0x2c')]=_[_0x7bdb('0x2a')](_0x371e8a[_0x7bdb('0x2c')]);_0xd2d7be[_0x7bdb('0x2d')]=_[_0x7bdb('0x2e')](_0xd2d7be['model'],_0xd2d7be[_0x7bdb('0x2c')]);_0x1e9996[_0x7bdb('0x2f')]=_[_0x7bdb('0x2e')](_0xd2d7be[_0x7bdb('0x29')],qs['fields'](_0x371e8a['query']['fields']));_0x1e9996[_0x7bdb('0x2f')]=_0x1e9996['attributes'][_0x7bdb('0x30')]?_0x1e9996['attributes']:_0xd2d7be[_0x7bdb('0x29')];if(_0x371e8a[_0x7bdb('0x2c')][_0x7bdb('0x31')]){_0x1e9996['include']=[{'all':!![]}];}_0x1e9996=_[_0x7bdb('0x32')]({},_0x1e9996,_0x371e8a['options']);return db['MailApplication'][_0x7bdb('0x33')](_0x1e9996)['then'](handleEntityNotFound(_0x2e8e65,null))[_0x7bdb('0x34')](respondWithResult(_0x2e8e65,null))['catch'](handleError(_0x2e8e65,null));};exports['update']=function(_0x206c26,_0x353b26){if(_0x206c26[_0x7bdb('0x35')]['id']){delete _0x206c26[_0x7bdb('0x35')]['id'];}return db[_0x7bdb('0x2b')][_0x7bdb('0x33')]({'where':{'id':_0x206c26['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x353b26,null))[_0x7bdb('0x34')](saveUpdates(_0x206c26[_0x7bdb('0x35')],null))[_0x7bdb('0x34')](respondWithResult(_0x353b26,null))[_0x7bdb('0x36')](handleError(_0x353b26,null));};exports[_0x7bdb('0x37')]=function(_0x228340,_0x2587af){return db[_0x7bdb('0x2b')]['find']({'where':{'id':_0x228340['params']['id']}})[_0x7bdb('0x34')](handleEntityNotFound(_0x2587af,null))[_0x7bdb('0x34')](removeEntity(_0x2587af,null))[_0x7bdb('0x36')](handleError(_0x2587af,null));}; \ No newline at end of file +var _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x2f762f,_0x50f7e7){var _0x1b68d4=function(_0x29da4d){while(--_0x29da4d){_0x2f762f['push'](_0x2f762f['shift']());}};_0x1b68d4(++_0x50f7e7);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));var querystring=require(_0x0d8b('0xd'));var Papa=require(_0x0d8b('0xe'));var Redis=require(_0x0d8b('0xf'));var authService=require(_0x0d8b('0x10'));var qs=require(_0x0d8b('0x11'));var as=require(_0x0d8b('0x12'));var hardwareService=require(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index e441cc5..6f718d8 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 _0x03dc=['utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','mail_applications'];(function(_0x5444c7,_0x2d95b3){var _0x33233e=function(_0x594b70){while(--_0x594b70){_0x5444c7['push'](_0x5444c7['shift']());}};_0x33233e(++_0x2d95b3);}(_0x03dc,0xbc));var _0xc03d=function(_0x2949d8,_0x13073c){_0x2949d8=_0x2949d8-0x0;var _0x2842de=_0x03dc[_0x2949d8];return _0x2842de;};'use strict';var _=require('lodash');var util=require(_0xc03d('0x0'));var logger=require(_0xc03d('0x1'))(_0xc03d('0x2'));var moment=require(_0xc03d('0x3'));var BPromise=require(_0xc03d('0x4'));var rp=require(_0xc03d('0x5'));var fs=require('fs');var path=require(_0xc03d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0xc03d('0x7')]=function(_0x239816,_0x3fa22e){return _0x239816[_0xc03d('0x8')]('MailApplication',attributes,{'tableName':_0xc03d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc03d('0xa')});}; \ No newline at end of file +var _0x8354=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x59acf2,_0x536cba){var _0x28ef89=function(_0x34a9e1){while(--_0x34a9e1){_0x59acf2['push'](_0x59acf2['shift']());}};_0x28ef89(++_0x536cba);}(_0x8354,0x14d));var _0x4835=function(_0x15c3a0,_0x124e9a){_0x15c3a0=_0x15c3a0-0x0;var _0x4dae6c=_0x8354[_0x15c3a0];return _0x4dae6c;};'use strict';var _=require('lodash');var util=require(_0x4835('0x0'));var logger=require(_0x4835('0x1'))('api');var moment=require(_0x4835('0x2'));var BPromise=require(_0x4835('0x3'));var rp=require(_0x4835('0x4'));var fs=require('fs');var path=require(_0x4835('0x5'));var rimraf=require(_0x4835('0x6'));var config=require(_0x4835('0x7'));var attributes=require(_0x4835('0x8'));module[_0x4835('0x9')]=function(_0x1ac871,_0x443af1){return _0x1ac871[_0x4835('0xa')]('MailApplication',attributes,{'tableName':_0x4835('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4835('0xc'),'collate':_0x4835('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6a81b66..b272dfd 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 _0x18f4=['update','options','attributes','then','debug','catch','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x3a36ab,_0x209461){var _0x1f27c4=function(_0x4745c4){while(--_0x4745c4){_0x3a36ab['push'](_0x3a36ab['shift']());}};_0x1f27c4(++_0x209461);}(_0x18f4,0x1b7));var _0x418f=function(_0xcca3e4,_0xeb08c0){_0xcca3e4=_0xcca3e4-0x0;var _0x10da4c=_0x18f4[_0xcca3e4];return _0x10da4c;};'use strict';var _=require(_0x418f('0x0'));var util=require(_0x418f('0x1'));var moment=require(_0x418f('0x2'));var BPromise=require('bluebird');var rs=require(_0x418f('0x3'));var fs=require('fs');var Redis=require(_0x418f('0x4'));var db=require(_0x418f('0x5'))['db'];var utils=require(_0x418f('0x6'));var logger=require(_0x418f('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x418f('0x8'));var client=jayson[_0x418f('0x9')][_0x418f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1006ef,_0x38ce0e,_0x4e0f23){return new BPromise(function(_0x259735,_0x2e323f){return client[_0x418f('0xb')](_0x1006ef,_0x4e0f23)['then'](function(_0x4c39cf){logger[_0x418f('0xc')](_0x418f('0xd'),_0x38ce0e,'request\x20sent');logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x38ce0e,_0x418f('0xe'),JSON[_0x418f('0xf')](_0x4c39cf));if(_0x4c39cf[_0x418f('0x10')]){if(_0x4c39cf[_0x418f('0x10')][_0x418f('0x11')]===0x1f4){logger[_0x418f('0x10')](_0x418f('0xd'),_0x38ce0e,_0x4c39cf[_0x418f('0x10')][_0x418f('0x12')]);return _0x2e323f(_0x4c39cf[_0x418f('0x10')]['message']);}logger['error']('MailApplication,\x20%s,\x20%s',_0x38ce0e,_0x4c39cf[_0x418f('0x10')][_0x418f('0x12')]);return _0x259735(_0x4c39cf[_0x418f('0x10')][_0x418f('0x12')]);}else{logger[_0x418f('0xc')]('MailApplication,\x20%s,\x20%s',_0x38ce0e,'request\x20sent');_0x259735(_0x4c39cf[_0x418f('0x13')][_0x418f('0x12')]);}})['catch'](function(_0x5173b7){logger[_0x418f('0x10')](_0x418f('0xd'),_0x38ce0e,_0x5173b7);_0x2e323f(_0x5173b7);});});}exports['UpdateMailApplication']=function(_0x2183a3){var _0x262954=this;return new Promise(function(_0x11ac98,_0x174dd7){return db['MailApplication'][_0x418f('0x14')](_0x2183a3['body'],{'raw':_0x2183a3['options']?_0x2183a3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2183a3[_0x418f('0x15')]?_0x2183a3['options']['where']||null:null,'attributes':_0x2183a3[_0x418f('0x15')]?_0x2183a3[_0x418f('0x15')][_0x418f('0x16')]||null:null,'limit':_0x2183a3['options']?_0x2183a3[_0x418f('0x15')]['limit']||null:null})[_0x418f('0x17')](function(_0x369bed){logger['info']('UpdateMailApplication',_0x2183a3);logger[_0x418f('0x18')]('UpdateMailApplication',_0x2183a3,JSON[_0x418f('0xf')](_0x369bed));_0x11ac98(_0x369bed);})[_0x418f('0x19')](function(_0x4dd5df){logger[_0x418f('0x10')](_0x418f('0x1a'),_0x4dd5df[_0x418f('0x12')],_0x2183a3);_0x174dd7(_0x262954[_0x418f('0x10')](0x1f4,_0x4dd5df[_0x418f('0x12')]));});});}; \ No newline at end of file +var _0xbea5=['info','MailApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','MailApplication','update','body','options','raw','where','limit','UpdateMailApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x426829,_0x5ccd00){var _0x35e0f8=function(_0x555ecc){while(--_0x555ecc){_0x426829['push'](_0x426829['shift']());}};_0x35e0f8(++_0x5ccd00);}(_0xbea5,0x7d));var _0x5bea=function(_0x109371,_0x441c8e){_0x109371=_0x109371-0x0;var _0x4fd858=_0xbea5[_0x109371];return _0x4fd858;};'use strict';var _=require(_0x5bea('0x0'));var util=require('util');var moment=require(_0x5bea('0x1'));var BPromise=require(_0x5bea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5bea('0x3'));var db=require(_0x5bea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5bea('0x5'))(_0x5bea('0x6'));var config=require('../../config/environment');var jayson=require(_0x5bea('0x7'));var client=jayson['client'][_0x5bea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x170d30,_0x3411a0,_0x48b392){return new BPromise(function(_0x10d5c9,_0x10d7f0){return client['request'](_0x170d30,_0x48b392)[_0x5bea('0x9')](function(_0x21e7ea){logger[_0x5bea('0xa')](_0x5bea('0xb'),_0x3411a0,_0x5bea('0xc'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x3411a0,_0x5bea('0xc'),JSON[_0x5bea('0xd')](_0x21e7ea));if(_0x21e7ea['error']){if(_0x21e7ea[_0x5bea('0xe')][_0x5bea('0xf')]===0x1f4){logger[_0x5bea('0xe')](_0x5bea('0xb'),_0x3411a0,_0x21e7ea[_0x5bea('0xe')][_0x5bea('0x10')]);return _0x10d7f0(_0x21e7ea[_0x5bea('0xe')]['message']);}logger[_0x5bea('0xe')](_0x5bea('0xb'),_0x3411a0,_0x21e7ea[_0x5bea('0xe')]['message']);return _0x10d5c9(_0x21e7ea[_0x5bea('0xe')]['message']);}else{logger[_0x5bea('0xa')](_0x5bea('0xb'),_0x3411a0,_0x5bea('0xc'));_0x10d5c9(_0x21e7ea[_0x5bea('0x11')]['message']);}})[_0x5bea('0x12')](function(_0x532948){logger[_0x5bea('0xe')]('MailApplication,\x20%s,\x20%s',_0x3411a0,_0x532948);_0x10d7f0(_0x532948);});});}exports['UpdateMailApplication']=function(_0x48f038){var _0x15e213=this;return new Promise(function(_0x54476b,_0x118502){return db[_0x5bea('0x13')][_0x5bea('0x14')](_0x48f038[_0x5bea('0x15')],{'raw':_0x48f038[_0x5bea('0x16')]?_0x48f038[_0x5bea('0x16')][_0x5bea('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48f038[_0x5bea('0x16')]?_0x48f038[_0x5bea('0x16')][_0x5bea('0x18')]||null:null,'attributes':_0x48f038[_0x5bea('0x16')]?_0x48f038[_0x5bea('0x16')]['attributes']||null:null,'limit':_0x48f038['options']?_0x48f038[_0x5bea('0x16')][_0x5bea('0x19')]||null:null})[_0x5bea('0x9')](function(_0x5614cf){logger[_0x5bea('0xa')](_0x5bea('0x1a'),_0x48f038);logger['debug'](_0x5bea('0x1a'),_0x48f038,JSON[_0x5bea('0xd')](_0x5614cf));_0x54476b(_0x5614cf);})['catch'](function(_0x22b71d){logger[_0x5bea('0xe')](_0x5bea('0x1a'),_0x22b71d[_0x5bea('0x10')],_0x48f038);_0x118502(_0x15e213[_0x5bea('0xe')](0x1f4,_0x22b71d[_0x5bea('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f7a58fa..bc998d8 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 _0x80f5=['delete','mailinteraction:destroy','/:id/tags','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x80f5,0x1d0));var _0x580f=function(_0x20ae13,_0x2a0c8e){_0x20ae13=_0x20ae13-0x0;var _0x533fd5=_0x80f5[_0x20ae13];return _0x533fd5;};'use strict';var express=require(_0x580f('0x0'));var router=express[_0x580f('0x1')]();var auth=require(_0x580f('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x580f('0x3'));router[_0x580f('0x4')]('/',auth[_0x580f('0x5')](),controller['index']);router[_0x580f('0x4')]('/describe',auth[_0x580f('0x5')](),controller[_0x580f('0x6')]);router['get'](_0x580f('0x7'),auth[_0x580f('0x5')](),controller[_0x580f('0x8')]);router[_0x580f('0x4')](_0x580f('0x9'),auth[_0x580f('0x5')](),controller[_0x580f('0xa')]);router[_0x580f('0x4')](_0x580f('0xb'),auth[_0x580f('0x5')](),controller[_0x580f('0xc')]);router[_0x580f('0xd')]('/',auth[_0x580f('0x5')](),controller['create']);router['post'](_0x580f('0x9'),auth[_0x580f('0x5')](),controller[_0x580f('0xe')]);router[_0x580f('0xd')]('/:id/tags',auth[_0x580f('0x5')](),interaction[_0x580f('0xf')](_0x580f('0x10'),_0x580f('0x11')),controller[_0x580f('0x12')]);router[_0x580f('0x13')]('/:id',auth[_0x580f('0x5')](),interaction['tracked']('mail',_0x580f('0x14')),controller[_0x580f('0x15')]);router[_0x580f('0x16')](_0x580f('0x7'),auth[_0x580f('0x5')](),interaction[_0x580f('0xf')](_0x580f('0x10'),_0x580f('0x17')),controller['destroy']);router[_0x580f('0x16')](_0x580f('0x18'),auth[_0x580f('0x5')](),controller[_0x580f('0x19')]);module[_0x580f('0x1a')]=router; \ No newline at end of file +var _0x33a8=['../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','mail','addTags','tracked','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','exports','Router','../../components/auth/service'];(function(_0x599468,_0x57c823){var _0x5b557c=function(_0x1f449b){while(--_0x1f449b){_0x599468['push'](_0x599468['shift']());}};_0x5b557c(++_0x57c823);}(_0x33a8,0x1f2));var _0x833a=function(_0x4ccfba,_0x47ab53){_0x4ccfba=_0x4ccfba-0x0;var _0x2f1212=_0x33a8[_0x4ccfba];return _0x2f1212;};'use strict';var express=require('express');var router=express[_0x833a('0x0')]();var auth=require(_0x833a('0x1'));var interaction=require(_0x833a('0x2'));var controller=require(_0x833a('0x3'));router[_0x833a('0x4')]('/',auth[_0x833a('0x5')](),controller[_0x833a('0x6')]);router[_0x833a('0x4')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x833a('0x4')](_0x833a('0x7'),auth[_0x833a('0x5')](),controller[_0x833a('0x8')]);router[_0x833a('0x4')](_0x833a('0x9'),auth['isAuthenticated'](),controller[_0x833a('0xa')]);router[_0x833a('0x4')](_0x833a('0xb'),auth[_0x833a('0x5')](),controller['download']);router[_0x833a('0xc')]('/',auth[_0x833a('0x5')](),controller[_0x833a('0xd')]);router[_0x833a('0xc')](_0x833a('0x9'),auth[_0x833a('0x5')](),controller[_0x833a('0xe')]);router['post'](_0x833a('0xf'),auth['isAuthenticated'](),interaction['tracked'](_0x833a('0x10'),'mailinteraction:addtags'),controller[_0x833a('0x11')]);router['put'](_0x833a('0x7'),auth[_0x833a('0x5')](),interaction[_0x833a('0x12')]('mail',_0x833a('0x13')),controller[_0x833a('0x14')]);router[_0x833a('0x15')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x833a('0x10'),_0x833a('0x16')),controller[_0x833a('0x17')]);router['delete'](_0x833a('0xf'),auth['isAuthenticated'](),controller['removeTags']);module[_0x833a('0x18')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 3eab486..cb0566a 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 _0x1c1b=['long','DATE','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','STRING','TEXT'];(function(_0x5a9ac7,_0x133ffa){var _0x54d373=function(_0x569415){while(--_0x569415){_0x5a9ac7['push'](_0x5a9ac7['shift']());}};_0x54d373(++_0x133ffa);}(_0x1c1b,0x139));var _0xb1c1=function(_0x56f0a8,_0x1aa1ca){_0x56f0a8=_0x56f0a8-0x0;var _0x616b3d=_0x1c1b[_0x56f0a8];return _0x616b3d;};'use strict';var Sequelize=require(_0xb1c1('0x0'));var iconv=require(_0xb1c1('0x1'));module[_0xb1c1('0x2')]={'closed':{'type':Sequelize[_0xb1c1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xb1c1('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb1c1('0x4')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb1c1('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb1c1('0x4')]},'cc':{'type':Sequelize[_0xb1c1('0x5')](_0xb1c1('0x6'))},'subject':{'type':Sequelize[_0xb1c1('0x5')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb1c1('0x7')]},'substatus':{'type':Sequelize[_0xb1c1('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb1c1('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb1c1('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xb1c1('0x8')]('in',_0xb1c1('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb1c1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb1c1('0xa')]}}; \ No newline at end of file +var _0x4317=['exports','BOOLEAN','DATE','STRING','long','TEXT','ENUM','out','INTEGER','sequelize','iconv'];(function(_0x567e14,_0x6175e7){var _0x42eebe=function(_0x11eebf){while(--_0x11eebf){_0x567e14['push'](_0x567e14['shift']());}};_0x42eebe(++_0x6175e7);}(_0x4317,0x17f));var _0x7431=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4317[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7431('0x0'));var iconv=require(_0x7431('0x1'));module[_0x7431('0x2')]={'closed':{'type':Sequelize[_0x7431('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7431('0x4')]},'disposition':{'type':Sequelize[_0x7431('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7431('0x5')]},'note':{'type':Sequelize[_0x7431('0x5')]},'inReplyTo':{'type':Sequelize[_0x7431('0x5')](0x1fe)},'to':{'type':Sequelize[_0x7431('0x5')]},'cc':{'type':Sequelize['TEXT'](_0x7431('0x6'))},'subject':{'type':Sequelize[_0x7431('0x7')]()},'attach':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x7431('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x7431('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x7431('0x8')]('in',_0x7431('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x7431('0x8')]('in',_0x7431('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x7431('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7431('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 0cc4303..4c497e7 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 _0xeb92=['register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','findAll','mail','query','user','catch','params','model','keys','MailInteraction','intersection','attributes','fields','include','options','find','create','body','addMessage','MailMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','filters','pick','MailInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','inlineCss','length','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','push','Attachments','Messages','from','bcc','subject','get','mkdirSync','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','existsSync','readFileSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./mailInteraction.socket'];(function(_0xfcfc24,_0x48ca53){var _0x58f773=function(_0x263b5f){while(--_0x263b5f){_0xfcfc24['push'](_0xfcfc24['shift']());}};_0x58f773(++_0x48ca53);}(_0xeb92,0xd3));var _0x2eb9=function(_0x442000,_0x2e26c9){_0x442000=_0x442000-0x0;var _0x280b97=_0xeb92[_0x442000];return _0x280b97;};'use strict';var emlformat=require(_0x2eb9('0x0'));var rimraf=require(_0x2eb9('0x1'));var zipdir=require(_0x2eb9('0x2'));var moment=require(_0x2eb9('0x3'));var BPromise=require('bluebird');var util=require(_0x2eb9('0x4'));var path=require('path');var fs=require('fs');var _=require(_0x2eb9('0x5'));var juice=require(_0x2eb9('0x6'));var Redis=require(_0x2eb9('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x2eb9('0x8'));var logger=require(_0x2eb9('0x9'))(_0x2eb9('0xa'));var config=require(_0x2eb9('0xb'));var db=require(_0x2eb9('0xc'))['db'];var htmlEntities=require('html-entities');config['redis']=_[_0x2eb9('0xd')](config[_0x2eb9('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x2eb9('0xf'))(new Redis(config[_0x2eb9('0xe')]));require(_0x2eb9('0x10'))[_0x2eb9('0x11')](socket);function respondWithStatusCode(_0x4b6cc5,_0x382257){_0x382257=_0x382257||0xcc;return function(_0x2baf67){if(_0x2baf67){return _0x4b6cc5[_0x2eb9('0x12')](_0x382257);}return _0x4b6cc5['status'](_0x382257)[_0x2eb9('0x13')]();};}function respondWithResult(_0x2acce3,_0x19437d){_0x19437d=_0x19437d||0xc8;return function(_0x37cf39){if(_0x37cf39){return _0x2acce3[_0x2eb9('0x14')](_0x19437d)[_0x2eb9('0x15')](_0x37cf39);}};}function respondWithFilteredResult(_0x1c1719,_0x45427b){return function(_0x521c06){if(_0x521c06){var _0x4eedb8=typeof _0x45427b[_0x2eb9('0x16')]===_0x2eb9('0x17')&&typeof _0x45427b[_0x2eb9('0x18')]===_0x2eb9('0x17');var _0x1ec48b=_0x521c06[_0x2eb9('0x19')];var _0x182edc=_0x4eedb8?0x0:_0x45427b[_0x2eb9('0x16')];var _0x156e20=_0x4eedb8?_0x521c06['count']:_0x45427b['offset']+_0x45427b[_0x2eb9('0x18')];var _0x44bb96;if(_0x156e20>=_0x1ec48b){_0x156e20=_0x1ec48b;_0x44bb96=0xc8;}else{_0x44bb96=0xce;}_0x1c1719[_0x2eb9('0x14')](_0x44bb96);return _0x1c1719[_0x2eb9('0x1a')](_0x2eb9('0x1b'),_0x182edc+'-'+_0x156e20+'/'+_0x1ec48b)['json'](_0x521c06);}return null;};}function saveUpdates(_0x4860a0){return function(_0x53c774){if(_0x53c774){return _0x53c774[_0x2eb9('0x1c')](_0x4860a0)[_0x2eb9('0x1d')](function(_0x472492){return _0x472492;});}return null;};}function removeEntity(_0x48d8bc){return function(_0x11e7dd){if(_0x11e7dd){return _0x11e7dd[_0x2eb9('0x1e')]()[_0x2eb9('0x1d')](function(){_0x48d8bc[_0x2eb9('0x14')](0xcc)[_0x2eb9('0x13')]();});}};}function handleEntityNotFound(_0x2f51f6){return function(_0x32f88f){if(!_0x32f88f){_0x2f51f6[_0x2eb9('0x12')](0x194);}return _0x32f88f;};}function handleError(_0x1fef10,_0x4fad02){_0x4fad02=_0x4fad02||0x1f4;return function(_0x2d5468){logger[_0x2eb9('0x1f')](_0x2d5468[_0x2eb9('0x20')]);if(_0x2d5468['name']){delete _0x2d5468[_0x2eb9('0x21')];}_0x1fef10[_0x2eb9('0x14')](_0x4fad02)[_0x2eb9('0x22')](_0x2d5468);};}exports['index']=function(_0x44d435,_0x6c24ab){var _0x144b5c={};var _0x41b572=_[_0x2eb9('0x23')](db['MailInteraction'][_0x2eb9('0x24')],function(_0x373a27){return{'name':_0x373a27[_0x2eb9('0x25')],'type':_0x373a27[_0x2eb9('0x26')]['key']};});_0x144b5c=qs['getOptions'](_0x41b572,_0x44d435);return interaction[_0x2eb9('0x27')](_0x2eb9('0x28'),_0x44d435[_0x2eb9('0x29')],_0x44d435[_0x2eb9('0x2a')],_0x144b5c,_0x41b572)[_0x2eb9('0x1d')](respondWithFilteredResult(_0x6c24ab,_0x144b5c))[_0x2eb9('0x2b')](handleError(_0x6c24ab,null));};exports['show']=function(_0x165a36,_0x99ca3){var _0x4dc26d={'raw':![],'where':{'id':_0x165a36[_0x2eb9('0x2c')]['id']}},_0xb1e0cb={};_0xb1e0cb[_0x2eb9('0x2d')]=_[_0x2eb9('0x2e')](db[_0x2eb9('0x2f')][_0x2eb9('0x24')]);_0xb1e0cb[_0x2eb9('0x29')]=_['keys'](_0x165a36[_0x2eb9('0x29')]);_0xb1e0cb['filters']=_[_0x2eb9('0x30')](_0xb1e0cb[_0x2eb9('0x2d')],_0xb1e0cb[_0x2eb9('0x29')]);_0x4dc26d[_0x2eb9('0x31')]=_[_0x2eb9('0x30')](_0xb1e0cb['model'],qs[_0x2eb9('0x32')](_0x165a36[_0x2eb9('0x29')][_0x2eb9('0x32')]));_0x4dc26d[_0x2eb9('0x31')]=_0x4dc26d['attributes']['length']?_0x4dc26d[_0x2eb9('0x31')]:_0xb1e0cb[_0x2eb9('0x2d')];if(_0x165a36[_0x2eb9('0x29')]['includeAll']){_0x4dc26d[_0x2eb9('0x33')]=[{'all':!![]}];}_0x4dc26d=_['merge']({},_0x4dc26d,_0x165a36[_0x2eb9('0x34')]);return db['MailInteraction'][_0x2eb9('0x35')](_0x4dc26d)[_0x2eb9('0x1d')](handleEntityNotFound(_0x99ca3,null))['then'](respondWithResult(_0x99ca3,null))[_0x2eb9('0x2b')](handleError(_0x99ca3,null));};exports[_0x2eb9('0x36')]=function(_0x311d17,_0x1efea9){return db[_0x2eb9('0x2f')][_0x2eb9('0x36')](_0x311d17[_0x2eb9('0x37')],{})[_0x2eb9('0x1d')](respondWithResult(_0x1efea9,0xc9))['catch'](handleError(_0x1efea9,null));};exports[_0x2eb9('0x1c')]=function(_0x127210,_0x20df33){if(_0x127210[_0x2eb9('0x37')]['id']){delete _0x127210[_0x2eb9('0x37')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x127210[_0x2eb9('0x2c')]['id']}})[_0x2eb9('0x1d')](handleEntityNotFound(_0x20df33,null))[_0x2eb9('0x1d')](saveUpdates(_0x127210[_0x2eb9('0x37')],null))['then'](respondWithResult(_0x20df33,null))[_0x2eb9('0x2b')](handleError(_0x20df33,null));};exports[_0x2eb9('0x1e')]=function(_0x25751e,_0x2f49e7){return db[_0x2eb9('0x2f')]['find']({'where':{'id':_0x25751e['params']['id']}})['then'](handleEntityNotFound(_0x2f49e7,null))[_0x2eb9('0x1d')](removeEntity(_0x2f49e7,null))[_0x2eb9('0x2b')](handleError(_0x2f49e7,null));};exports['describe']=function(_0x3fb3b0,_0x1acaf8){return db[_0x2eb9('0x2f')]['describe']()[_0x2eb9('0x1d')](respondWithResult(_0x1acaf8,null))[_0x2eb9('0x2b')](handleError(_0x1acaf8,null));};exports[_0x2eb9('0x38')]=function(_0x3ec4bc,_0x392d1e){return db[_0x2eb9('0x39')][_0x2eb9('0x35')]({'where':{'id':_0x3ec4bc[_0x2eb9('0x2c')]['id']}})[_0x2eb9('0x1d')](handleEntityNotFound(_0x392d1e,null))[_0x2eb9('0x1d')](function(_0x3df5a7){if(_0x3df5a7){return _0x3df5a7[_0x2eb9('0x38')](_0x3ec4bc[_0x2eb9('0x37')][_0x2eb9('0x3a')],_['omit'](_0x3ec4bc[_0x2eb9('0x37')],[_0x2eb9('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x392d1e,null))[_0x2eb9('0x2b')](handleError(_0x392d1e,null));};exports[_0x2eb9('0x3b')]=function(_0x3edbf9,_0x538dd3){var _0x5c779e={'raw':![],'where':{}};var _0x21eb3b={};var _0x2d503a={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x3edbf9['params']['id']}})[_0x2eb9('0x1d')](handleEntityNotFound(_0x538dd3,null))[_0x2eb9('0x1d')](function(_0x547a84){if(_0x547a84){_0x21eb3b[_0x2eb9('0x2d')]=_[_0x2eb9('0x2e')](db[_0x2eb9('0x39')][_0x2eb9('0x24')]);_0x21eb3b[_0x2eb9('0x29')]=_[_0x2eb9('0x2e')](_0x3edbf9['query']);_0x21eb3b['filters']=_[_0x2eb9('0x30')](_0x21eb3b[_0x2eb9('0x2d')],_0x21eb3b[_0x2eb9('0x29')]);_0x5c779e[_0x2eb9('0x31')]=_[_0x2eb9('0x30')](_0x21eb3b[_0x2eb9('0x2d')],qs[_0x2eb9('0x32')](_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x32')]));_0x5c779e['attributes']=_0x5c779e['attributes']['length']?_0x5c779e[_0x2eb9('0x31')]:_0x21eb3b['model'];if(!_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x3c')](_0x2eb9('0x3d'))){_0x5c779e[_0x2eb9('0x18')]=qs[_0x2eb9('0x18')](_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x18')]);_0x5c779e['offset']=qs['offset'](_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x16')]);}_0x5c779e[_0x2eb9('0x3e')]=qs[_0x2eb9('0x3f')](_0x3edbf9['query'][_0x2eb9('0x3f')]);_0x5c779e[_0x2eb9('0x40')]=qs[_0x2eb9('0x41')](_[_0x2eb9('0x42')](_0x3edbf9[_0x2eb9('0x29')],_0x21eb3b[_0x2eb9('0x41')]));_0x5c779e[_0x2eb9('0x40')][_0x2eb9('0x43')]=_0x547a84['id'];if(_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x44')]){_0x5c779e[_0x2eb9('0x40')]=_[_0x2eb9('0x45')](_0x5c779e['where'],{'$or':_[_0x2eb9('0x23')](_0x5c779e[_0x2eb9('0x31')],function(_0x264c7d){var _0x4d7766={};_0x4d7766[_0x264c7d]={'$like':'%'+_0x3edbf9['query']['filter']+'%'};return _0x4d7766;})});}if(_0x3edbf9['query']['$gte']){var _0x345883=_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x46')][_0x2eb9('0x47')](',');var _0x1f7cb1={};_0x1f7cb1[_0x345883[0x0]]={'$gte':moment(_0x345883[0x1])[_0x2eb9('0x48')](_0x2eb9('0x49'))};_0x5c779e[_0x2eb9('0x40')]=_['merge'](_0x5c779e[_0x2eb9('0x40')],_0x1f7cb1);}_0x5c779e=_['merge']({},_0x5c779e,_0x3edbf9['options']);return db[_0x2eb9('0x39')][_0x2eb9('0x19')]({'where':_0x5c779e[_0x2eb9('0x40')]})[_0x2eb9('0x1d')](function(_0x200be1){_0x2d503a[_0x2eb9('0x19')]=_0x200be1;if(_0x3edbf9[_0x2eb9('0x29')][_0x2eb9('0x4a')]){_0x5c779e[_0x2eb9('0x33')]=[{'all':!![]}];}return db['MailMessage'][_0x2eb9('0x27')](_0x5c779e);})[_0x2eb9('0x1d')](function(_0x3d4895){if(_0x3edbf9['query'][_0x2eb9('0x4b')]==='true'){for(var _0xf064c=0x0;_0xf064c<_0x3d4895[_0x2eb9('0x4c')];_0xf064c++){_0x3d4895[_0xf064c]['body']=juice(_0x3d4895[_0xf064c][_0x2eb9('0x37')]);}}_0x2d503a[_0x2eb9('0x4d')]=_0x3d4895;return _0x2d503a;});}})[_0x2eb9('0x1d')](respondWithFilteredResult(_0x538dd3,_0x5c779e))[_0x2eb9('0x2b')](handleError(_0x538dd3,null));};exports[_0x2eb9('0x4e')]=function(_0x2b7552,_0xa13d74){return db[_0x2eb9('0x2f')][_0x2eb9('0x35')]({'where':{'id':_0x2b7552[_0x2eb9('0x2c')]['id']}})['then'](handleEntityNotFound(_0xa13d74,null))[_0x2eb9('0x1d')](function(_0x478ba7){if(_0x478ba7){return _0x478ba7[_0x2eb9('0x4f')](_0x2b7552[_0x2eb9('0x37')][_0x2eb9('0x3a')],_[_0x2eb9('0x50')](_0x2b7552[_0x2eb9('0x37')],[_0x2eb9('0x3a'),'id'])||{})[_0x2eb9('0x51')](function(){return db[_0x2eb9('0x52')][_0x2eb9('0x27')]({'attributes':['id','name',_0x2eb9('0x53')],'where':{'id':_0x2b7552[_0x2eb9('0x37')][_0x2eb9('0x3a')]}});})[_0x2eb9('0x1d')](function(_0x40826d){socket[_0x2eb9('0x54')](_0x2eb9('0x55'),{'id':Number(_0x2b7552[_0x2eb9('0x2c')]['id']),'tags':_0x40826d||[]});return{'id':Number(_0x2b7552[_0x2eb9('0x2c')]['id']),'tags':_0x40826d||[]};});}})[_0x2eb9('0x1d')](respondWithResult(_0xa13d74,null))[_0x2eb9('0x2b')](handleError(_0xa13d74,null));};exports[_0x2eb9('0x56')]=function(_0x1387e3,_0x10fcba){return db[_0x2eb9('0x2f')][_0x2eb9('0x35')]({'where':{'id':_0x1387e3[_0x2eb9('0x2c')]['id']}})[_0x2eb9('0x1d')](handleEntityNotFound(_0x10fcba,null))[_0x2eb9('0x1d')](function(_0x2b68b0){if(_0x2b68b0){return _0x2b68b0[_0x2eb9('0x56')](_0x1387e3[_0x2eb9('0x29')][_0x2eb9('0x3a')]);}})[_0x2eb9('0x1d')](respondWithStatusCode(_0x10fcba,null))[_0x2eb9('0x2b')](handleError(_0x10fcba,null));};exports[_0x2eb9('0x57')]=function(_0xe5095a,_0x55a5ff){var _0x596a9e=moment()[_0x2eb9('0x58')]()['toString']();var _0x331209=path[_0x2eb9('0x59')](config[_0x2eb9('0x5a')],_0x2eb9('0x5b'),'files',_0x2eb9('0x5c'));var _0x469420=path[_0x2eb9('0x59')](config[_0x2eb9('0x5a')],'server',_0x2eb9('0x5d'),_0x2eb9('0x5e'));var _0x1c8c1b=path[_0x2eb9('0x59')](_0x331209,_0x596a9e);var _0x13f2c4=util[_0x2eb9('0x48')](_0x2eb9('0x5f'),_0xe5095a[_0x2eb9('0x2c')]['id'],_0x596a9e);var _0x5614df=path[_0x2eb9('0x59')](_0x331209,_0x13f2c4);var _0xe1cfa7=[];if(_0xe5095a['query'][_0x2eb9('0x5e')]){_0xe1cfa7[_0x2eb9('0x60')]({'model':db['Attachment'],'as':_0x2eb9('0x61'),'raw':!![]});}var _0x13ca64=[{'model':db['MailMessage'],'as':_0x2eb9('0x62'),'attributes':['id',_0x2eb9('0x37'),_0x2eb9('0x63'),'to','cc',_0x2eb9('0x64'),_0x2eb9('0x65'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2eb9('0x3f')]('id'),'include':_0xe1cfa7}];return db[_0x2eb9('0x2f')]['find']({'where':{'id':_0xe5095a['params']['id']},'include':_0x13ca64})['then'](handleEntityNotFound(_0x55a5ff,null))[_0x2eb9('0x1d')](function(_0x196a3e){if(_0x196a3e&&_0x196a3e[_0x2eb9('0x62')]){var _0x36cfc7=_0x196a3e[_0x2eb9('0x66')]({'plain':!![]});fs[_0x2eb9('0x67')](_0x1c8c1b);return BPromise['each'](_0x36cfc7['Messages'],function(_0x26a968,_0x1d4b24){var _0x40cd11={'from':_0x26a968[_0x2eb9('0x63')],'to':_0x26a968['to']||'missing.recipient@your.company.com','subject':_0x26a968[_0x2eb9('0x65')],'html':htmlEntities[_0x2eb9('0x68')](_0x26a968['body']),'headers':{'Date':moment(_0x26a968['createdAt'])[_0x2eb9('0x48')](_0x2eb9('0x69'))},'attachments':[]};if(_0x26a968['cc']){_0x40cd11[_0x2eb9('0x6a')]['Cc']=_0x26a968['cc'];}if(_0x26a968[_0x2eb9('0x64')]){_0x40cd11[_0x2eb9('0x6a')][_0x2eb9('0x6b')]=_0x26a968[_0x2eb9('0x64')];}return new BPromise(function(_0x27973d,_0x2e44e7){if(_0x26a968[_0x2eb9('0x61')]){for(var _0x49ad2c=0x0;_0x49ad2c<_0x26a968[_0x2eb9('0x61')][_0x2eb9('0x4c')];_0x49ad2c++){var _0x4fde9a=_0x26a968[_0x2eb9('0x61')][_0x49ad2c];var _0x9671f8=path['join'](_0x469420,_0x4fde9a[_0x2eb9('0x6c')]);if(fs[_0x2eb9('0x6d')](_0x9671f8)){_0x40cd11[_0x2eb9('0x5e')]['push']({'name':_0x4fde9a['name'],'contentType':_0x4fde9a['type'],'data':fs[_0x2eb9('0x6e')](_0x9671f8)});}}}emlformat[_0x2eb9('0x6f')](_0x40cd11,function(_0x42f339,_0x2da053){if(_0x42f339)return _0x2e44e7(_0x42f339);fs['writeFileSync'](path[_0x2eb9('0x59')](_0x1c8c1b,util[_0x2eb9('0x48')](_0x2eb9('0x70'),_0x1d4b24)),_0x2da053);return _0x27973d(_0x2da053);});});})[_0x2eb9('0x1d')](function(){return new BPromise(function(_0x10b21e,_0x28e3cc){zipdir(_0x1c8c1b,{'saveTo':_0x5614df},function(_0x20026c,_0x5a390f){if(_0x20026c)return _0x28e3cc(_0x20026c);return _0x10b21e(_0x5a390f);});})[_0x2eb9('0x1d')](function(){return new BPromise(function(_0x370f76,_0x3aaaf7){rimraf(_0x1c8c1b,function(_0x31abfb){if(_0x31abfb)_0x3aaaf7(_0x31abfb);return _0x370f76();});});})[_0x2eb9('0x1d')](function(){return _0x55a5ff[_0x2eb9('0x57')](_0x5614df,_0x13f2c4,function(_0x34318a){if(!_0x34318a)fs[_0x2eb9('0x71')](_0x5614df);});});});}else{return _0x55a5ff[_0x2eb9('0x12')](0xc8);}})['catch'](handleError(_0x55a5ff,null));}; \ No newline at end of file +var _0x2acd=['inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','unix','join','root','server','files','transcript-%d-%s.zip','attachments','push','Attachments','bcc','subject','createdAt','sort','Messages','missing.recipient@your.company.com','decode','Bcc','readFileSync','build','message%d.eml','eml-format','rimraf','moment','bluebird','util','path','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','end','status','offset','limit','count','Content-Range','json','update','then','destroy','error','name','send','index','key','getOptions','findAll','mail','query','user','show','params','model','keys','MailInteraction','rawAttributes','filters','intersection','fields','attributes','length','include','merge','options','find','catch','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','where','pick','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll'];(function(_0x232715,_0x4bd63e){var _0x1e6090=function(_0x1baae7){while(--_0x1baae7){_0x232715['push'](_0x232715['shift']());}};_0x1e6090(++_0x4bd63e);}(_0x2acd,0x1be));var _0xd2ac=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x2acd[_0x5d6456];return _0x4d66c1;};'use strict';var emlformat=require(_0xd2ac('0x0'));var rimraf=require(_0xd2ac('0x1'));var zipdir=require('zip-dir');var moment=require(_0xd2ac('0x2'));var BPromise=require(_0xd2ac('0x3'));var util=require(_0xd2ac('0x4'));var path=require(_0xd2ac('0x5'));var fs=require('fs');var _=require('lodash');var juice=require(_0xd2ac('0x6'));var Redis=require(_0xd2ac('0x7'));var interaction=require(_0xd2ac('0x8'));var qs=require(_0xd2ac('0x9'));var logger=require(_0xd2ac('0xa'))('api');var config=require(_0xd2ac('0xb'));var db=require(_0xd2ac('0xc'))['db'];var htmlEntities=require(_0xd2ac('0xd'));config[_0xd2ac('0xe')]=_[_0xd2ac('0xf')](config[_0xd2ac('0xe')],{'host':_0xd2ac('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd2ac('0xe')]));require(_0xd2ac('0x11'))['register'](socket);function respondWithStatusCode(_0x237c46,_0x35f90b){_0x35f90b=_0x35f90b||0xcc;return function(_0x3da1b9){if(_0x3da1b9){return _0x237c46[_0xd2ac('0x12')](_0x35f90b);}return _0x237c46['status'](_0x35f90b)[_0xd2ac('0x13')]();};}function respondWithResult(_0x5cd61a,_0x4cdfc3){_0x4cdfc3=_0x4cdfc3||0xc8;return function(_0x54f905){if(_0x54f905){return _0x5cd61a[_0xd2ac('0x14')](_0x4cdfc3)['json'](_0x54f905);}};}function respondWithFilteredResult(_0x5dabfc,_0x376e22){return function(_0x1c2507){if(_0x1c2507){var _0x39b988=typeof _0x376e22[_0xd2ac('0x15')]==='undefined'&&typeof _0x376e22[_0xd2ac('0x16')]==='undefined';var _0x26ce1b=_0x1c2507['count'];var _0x4a0ffa=_0x39b988?0x0:_0x376e22[_0xd2ac('0x15')];var _0x9252f1=_0x39b988?_0x1c2507[_0xd2ac('0x17')]:_0x376e22[_0xd2ac('0x15')]+_0x376e22['limit'];var _0x150bd1;if(_0x9252f1>=_0x26ce1b){_0x9252f1=_0x26ce1b;_0x150bd1=0xc8;}else{_0x150bd1=0xce;}_0x5dabfc[_0xd2ac('0x14')](_0x150bd1);return _0x5dabfc['set'](_0xd2ac('0x18'),_0x4a0ffa+'-'+_0x9252f1+'/'+_0x26ce1b)[_0xd2ac('0x19')](_0x1c2507);}return null;};}function saveUpdates(_0x3b4b2b){return function(_0x38ab87){if(_0x38ab87){return _0x38ab87[_0xd2ac('0x1a')](_0x3b4b2b)[_0xd2ac('0x1b')](function(_0xb72c62){return _0xb72c62;});}return null;};}function removeEntity(_0x3670eb){return function(_0x31aead){if(_0x31aead){return _0x31aead[_0xd2ac('0x1c')]()[_0xd2ac('0x1b')](function(){_0x3670eb[_0xd2ac('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d99b7){return function(_0x51d7ac){if(!_0x51d7ac){_0x3d99b7[_0xd2ac('0x12')](0x194);}return _0x51d7ac;};}function handleError(_0x5a5fa9,_0x3da4a5){_0x3da4a5=_0x3da4a5||0x1f4;return function(_0x43331f){logger[_0xd2ac('0x1d')](_0x43331f['stack']);if(_0x43331f[_0xd2ac('0x1e')]){delete _0x43331f[_0xd2ac('0x1e')];}_0x5a5fa9['status'](_0x3da4a5)[_0xd2ac('0x1f')](_0x43331f);};}exports[_0xd2ac('0x20')]=function(_0xb61bfc,_0x524a64){var _0x218038={};var _0x2f4afb=_['map'](db['MailInteraction']['rawAttributes'],function(_0x400973){return{'name':_0x400973['fieldName'],'type':_0x400973['type'][_0xd2ac('0x21')]};});_0x218038=qs[_0xd2ac('0x22')](_0x2f4afb,_0xb61bfc);return interaction[_0xd2ac('0x23')](_0xd2ac('0x24'),_0xb61bfc[_0xd2ac('0x25')],_0xb61bfc[_0xd2ac('0x26')],_0x218038,_0x2f4afb)[_0xd2ac('0x1b')](respondWithFilteredResult(_0x524a64,_0x218038))['catch'](handleError(_0x524a64,null));};exports[_0xd2ac('0x27')]=function(_0x4010f4,_0x3a50c8){var _0x21077f={'raw':![],'where':{'id':_0x4010f4[_0xd2ac('0x28')]['id']}},_0x150fe9={};_0x150fe9[_0xd2ac('0x29')]=_[_0xd2ac('0x2a')](db[_0xd2ac('0x2b')][_0xd2ac('0x2c')]);_0x150fe9['query']=_[_0xd2ac('0x2a')](_0x4010f4[_0xd2ac('0x25')]);_0x150fe9[_0xd2ac('0x2d')]=_[_0xd2ac('0x2e')](_0x150fe9[_0xd2ac('0x29')],_0x150fe9[_0xd2ac('0x25')]);_0x21077f['attributes']=_[_0xd2ac('0x2e')](_0x150fe9['model'],qs[_0xd2ac('0x2f')](_0x4010f4[_0xd2ac('0x25')][_0xd2ac('0x2f')]));_0x21077f[_0xd2ac('0x30')]=_0x21077f[_0xd2ac('0x30')][_0xd2ac('0x31')]?_0x21077f[_0xd2ac('0x30')]:_0x150fe9[_0xd2ac('0x29')];if(_0x4010f4[_0xd2ac('0x25')]['includeAll']){_0x21077f[_0xd2ac('0x32')]=[{'all':!![]}];}_0x21077f=_[_0xd2ac('0x33')]({},_0x21077f,_0x4010f4[_0xd2ac('0x34')]);return db[_0xd2ac('0x2b')][_0xd2ac('0x35')](_0x21077f)[_0xd2ac('0x1b')](handleEntityNotFound(_0x3a50c8,null))[_0xd2ac('0x1b')](respondWithResult(_0x3a50c8,null))[_0xd2ac('0x36')](handleError(_0x3a50c8,null));};exports[_0xd2ac('0x37')]=function(_0x1bee85,_0x2dcba6){return db[_0xd2ac('0x2b')]['create'](_0x1bee85[_0xd2ac('0x38')],{})[_0xd2ac('0x1b')](respondWithResult(_0x2dcba6,0xc9))[_0xd2ac('0x36')](handleError(_0x2dcba6,null));};exports[_0xd2ac('0x1a')]=function(_0x468876,_0x10b93a){if(_0x468876[_0xd2ac('0x38')]['id']){delete _0x468876['body']['id'];}return db[_0xd2ac('0x2b')][_0xd2ac('0x35')]({'where':{'id':_0x468876[_0xd2ac('0x28')]['id']}})[_0xd2ac('0x1b')](handleEntityNotFound(_0x10b93a,null))[_0xd2ac('0x1b')](saveUpdates(_0x468876[_0xd2ac('0x38')],null))[_0xd2ac('0x1b')](respondWithResult(_0x10b93a,null))[_0xd2ac('0x36')](handleError(_0x10b93a,null));};exports[_0xd2ac('0x1c')]=function(_0x1bbe74,_0x2a8ffa){return db['MailInteraction']['find']({'where':{'id':_0x1bbe74[_0xd2ac('0x28')]['id']}})['then'](handleEntityNotFound(_0x2a8ffa,null))[_0xd2ac('0x1b')](removeEntity(_0x2a8ffa,null))['catch'](handleError(_0x2a8ffa,null));};exports[_0xd2ac('0x39')]=function(_0x595be5,_0x72bb2c){return db[_0xd2ac('0x2b')]['describe']()[_0xd2ac('0x1b')](respondWithResult(_0x72bb2c,null))[_0xd2ac('0x36')](handleError(_0x72bb2c,null));};exports[_0xd2ac('0x3a')]=function(_0x4d50e6,_0x59814e){return db[_0xd2ac('0x3b')][_0xd2ac('0x35')]({'where':{'id':_0x4d50e6[_0xd2ac('0x28')]['id']}})[_0xd2ac('0x1b')](handleEntityNotFound(_0x59814e,null))[_0xd2ac('0x1b')](function(_0x2f8ea8){if(_0x2f8ea8){return _0x2f8ea8['addMessage'](_0x4d50e6[_0xd2ac('0x38')][_0xd2ac('0x3c')],_[_0xd2ac('0x3d')](_0x4d50e6[_0xd2ac('0x38')],['ids','id'])||{});}})[_0xd2ac('0x1b')](respondWithResult(_0x59814e,null))[_0xd2ac('0x36')](handleError(_0x59814e,null));};exports[_0xd2ac('0x3e')]=function(_0x542b1d,_0x27d6e4){var _0x5a76ec={'raw':![],'where':{}};var _0xf82878={};var _0x4769ae={'count':0x0,'rows':[]};return db[_0xd2ac('0x2b')]['findOne']({'where':{'id':_0x542b1d[_0xd2ac('0x28')]['id']}})[_0xd2ac('0x1b')](handleEntityNotFound(_0x27d6e4,null))[_0xd2ac('0x1b')](function(_0xa7d80a){if(_0xa7d80a){_0xf82878[_0xd2ac('0x29')]=_[_0xd2ac('0x2a')](db[_0xd2ac('0x3b')][_0xd2ac('0x2c')]);_0xf82878['query']=_[_0xd2ac('0x2a')](_0x542b1d[_0xd2ac('0x25')]);_0xf82878['filters']=_['intersection'](_0xf82878['model'],_0xf82878['query']);_0x5a76ec['attributes']=_[_0xd2ac('0x2e')](_0xf82878[_0xd2ac('0x29')],qs[_0xd2ac('0x2f')](_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x2f')]));_0x5a76ec['attributes']=_0x5a76ec[_0xd2ac('0x30')][_0xd2ac('0x31')]?_0x5a76ec[_0xd2ac('0x30')]:_0xf82878[_0xd2ac('0x29')];if(!_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x3f')](_0xd2ac('0x40'))){_0x5a76ec[_0xd2ac('0x16')]=qs[_0xd2ac('0x16')](_0x542b1d[_0xd2ac('0x25')]['limit']);_0x5a76ec[_0xd2ac('0x15')]=qs[_0xd2ac('0x15')](_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x15')]);}_0x5a76ec[_0xd2ac('0x41')]=qs['sort'](_0x542b1d[_0xd2ac('0x25')]['sort']);_0x5a76ec[_0xd2ac('0x42')]=qs[_0xd2ac('0x2d')](_[_0xd2ac('0x43')](_0x542b1d[_0xd2ac('0x25')],_0xf82878['filters']));_0x5a76ec[_0xd2ac('0x42')]['MailInteractionId']=_0xa7d80a['id'];if(_0x542b1d[_0xd2ac('0x25')]['filter']){_0x5a76ec[_0xd2ac('0x42')]=_[_0xd2ac('0x33')](_0x5a76ec['where'],{'$or':_[_0xd2ac('0x44')](_0x5a76ec['attributes'],function(_0x36fc15){var _0x23e9e6={};_0x23e9e6[_0x36fc15]={'$like':'%'+_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x45')]+'%'};return _0x23e9e6;})});}if(_0x542b1d['query'][_0xd2ac('0x46')]){var _0x4ccaa9=_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x46')][_0xd2ac('0x47')](',');var _0x3276cb={};_0x3276cb[_0x4ccaa9[0x0]]={'$gte':moment(_0x4ccaa9[0x1])['format'](_0xd2ac('0x48'))};_0x5a76ec[_0xd2ac('0x42')]=_[_0xd2ac('0x33')](_0x5a76ec['where'],_0x3276cb);}_0x5a76ec=_['merge']({},_0x5a76ec,_0x542b1d[_0xd2ac('0x34')]);return db[_0xd2ac('0x3b')][_0xd2ac('0x17')]({'where':_0x5a76ec[_0xd2ac('0x42')]})[_0xd2ac('0x1b')](function(_0x10e743){_0x4769ae['count']=_0x10e743;if(_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x49')]){_0x5a76ec['include']=[{'all':!![]}];}return db[_0xd2ac('0x3b')]['findAll'](_0x5a76ec);})[_0xd2ac('0x1b')](function(_0x2e1b38){if(_0x542b1d[_0xd2ac('0x25')][_0xd2ac('0x4a')]===_0xd2ac('0x4b')){for(var _0x504e5a=0x0;_0x504e5a<_0x2e1b38[_0xd2ac('0x31')];_0x504e5a++){_0x2e1b38[_0x504e5a][_0xd2ac('0x38')]=juice(_0x2e1b38[_0x504e5a][_0xd2ac('0x38')]);}}_0x4769ae[_0xd2ac('0x4c')]=_0x2e1b38;return _0x4769ae;});}})[_0xd2ac('0x1b')](respondWithFilteredResult(_0x27d6e4,_0x5a76ec))['catch'](handleError(_0x27d6e4,null));};exports[_0xd2ac('0x4d')]=function(_0x564286,_0x14ea05){return db['MailInteraction'][_0xd2ac('0x35')]({'where':{'id':_0x564286['params']['id']}})[_0xd2ac('0x1b')](handleEntityNotFound(_0x14ea05,null))['then'](function(_0x138d7d){if(_0x138d7d){return _0x138d7d[_0xd2ac('0x4e')](_0x564286[_0xd2ac('0x38')][_0xd2ac('0x3c')],_[_0xd2ac('0x3d')](_0x564286['body'],[_0xd2ac('0x3c'),'id'])||{})[_0xd2ac('0x4f')](function(){return db[_0xd2ac('0x50')][_0xd2ac('0x23')]({'attributes':['id',_0xd2ac('0x1e'),_0xd2ac('0x51')],'where':{'id':_0x564286[_0xd2ac('0x38')][_0xd2ac('0x3c')]}});})[_0xd2ac('0x1b')](function(_0x503be5){socket['emit'](_0xd2ac('0x52'),{'id':Number(_0x564286['params']['id']),'tags':_0x503be5||[]});return{'id':Number(_0x564286[_0xd2ac('0x28')]['id']),'tags':_0x503be5||[]};});}})[_0xd2ac('0x1b')](respondWithResult(_0x14ea05,null))['catch'](handleError(_0x14ea05,null));};exports[_0xd2ac('0x53')]=function(_0x35b9d9,_0x5e2c8a){return db['MailInteraction']['find']({'where':{'id':_0x35b9d9['params']['id']}})['then'](handleEntityNotFound(_0x5e2c8a,null))[_0xd2ac('0x1b')](function(_0x12b455){if(_0x12b455){return _0x12b455['removeTags'](_0x35b9d9[_0xd2ac('0x25')][_0xd2ac('0x3c')]);}})[_0xd2ac('0x1b')](respondWithStatusCode(_0x5e2c8a,null))[_0xd2ac('0x36')](handleError(_0x5e2c8a,null));};exports['download']=function(_0xa7b9cc,_0xf0f5b){var _0x4802f6=moment()[_0xd2ac('0x54')]()['toString']();var _0xa75964=path[_0xd2ac('0x55')](config[_0xd2ac('0x56')],_0xd2ac('0x57'),_0xd2ac('0x58'),'tmp');var _0x23385c=path[_0xd2ac('0x55')](config[_0xd2ac('0x56')],_0xd2ac('0x57'),'files','attachments');var _0x2e8319=path['join'](_0xa75964,_0x4802f6);var _0x577950=util['format'](_0xd2ac('0x59'),_0xa7b9cc[_0xd2ac('0x28')]['id'],_0x4802f6);var _0x37e1cd=path[_0xd2ac('0x55')](_0xa75964,_0x577950);var _0x530a2e=[];if(_0xa7b9cc['query'][_0xd2ac('0x5a')]){_0x530a2e[_0xd2ac('0x5b')]({'model':db['Attachment'],'as':_0xd2ac('0x5c'),'raw':!![]});}var _0x4c1eae=[{'model':db[_0xd2ac('0x3b')],'as':'Messages','attributes':['id',_0xd2ac('0x38'),'from','to','cc',_0xd2ac('0x5d'),_0xd2ac('0x5e'),_0xd2ac('0x5f')],'where':{'secret':![]},'order':qs[_0xd2ac('0x60')]('id'),'include':_0x530a2e}];return db['MailInteraction']['find']({'where':{'id':_0xa7b9cc['params']['id']},'include':_0x4c1eae})['then'](handleEntityNotFound(_0xf0f5b,null))[_0xd2ac('0x1b')](function(_0x1f479b){if(_0x1f479b&&_0x1f479b[_0xd2ac('0x61')]){var _0x26bed0=_0x1f479b['get']({'plain':!![]});fs['mkdirSync'](_0x2e8319);return BPromise['each'](_0x26bed0['Messages'],function(_0x45e7a0,_0x83d274){var _0x43bd6b={'from':_0x45e7a0['from'],'to':_0x45e7a0['to']||_0xd2ac('0x62'),'subject':_0x45e7a0['subject'],'html':htmlEntities[_0xd2ac('0x63')](_0x45e7a0[_0xd2ac('0x38')]),'headers':{'Date':moment(_0x45e7a0['createdAt'])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x45e7a0['cc']){_0x43bd6b['headers']['Cc']=_0x45e7a0['cc'];}if(_0x45e7a0[_0xd2ac('0x5d')]){_0x43bd6b['headers'][_0xd2ac('0x64')]=_0x45e7a0[_0xd2ac('0x5d')];}return new BPromise(function(_0x28bc1b,_0x2b5bab){if(_0x45e7a0[_0xd2ac('0x5c')]){for(var _0x382f8f=0x0;_0x382f8f<_0x45e7a0['Attachments'][_0xd2ac('0x31')];_0x382f8f++){var _0x22446d=_0x45e7a0[_0xd2ac('0x5c')][_0x382f8f];var _0x1cc94a=path[_0xd2ac('0x55')](_0x23385c,_0x22446d['basename']);if(fs['existsSync'](_0x1cc94a)){_0x43bd6b['attachments'][_0xd2ac('0x5b')]({'name':_0x22446d[_0xd2ac('0x1e')],'contentType':_0x22446d['type'],'data':fs[_0xd2ac('0x65')](_0x1cc94a)});}}}emlformat[_0xd2ac('0x66')](_0x43bd6b,function(_0x28d5d1,_0x4c7ff9){if(_0x28d5d1)return _0x2b5bab(_0x28d5d1);fs['writeFileSync'](path[_0xd2ac('0x55')](_0x2e8319,util['format'](_0xd2ac('0x67'),_0x83d274)),_0x4c7ff9);return _0x28bc1b(_0x4c7ff9);});});})['then'](function(){return new BPromise(function(_0x307444,_0x3f197d){zipdir(_0x2e8319,{'saveTo':_0x37e1cd},function(_0x413a25,_0x11a29e){if(_0x413a25)return _0x3f197d(_0x413a25);return _0x307444(_0x11a29e);});})[_0xd2ac('0x1b')](function(){return new BPromise(function(_0xc71801,_0x3382aa){rimraf(_0x2e8319,function(_0x5c7723){if(_0x5c7723)_0x3382aa(_0x5c7723);return _0xc71801();});});})[_0xd2ac('0x1b')](function(){return _0xf0f5b['download'](_0x37e1cd,_0x577950,function(_0x16890c){if(!_0x16890c)fs['unlinkSync'](_0x37e1cd);});});});}else{return _0xf0f5b['sendStatus'](0xc8);}})[_0xd2ac('0x36')](handleError(_0xf0f5b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index bc40e28..4ca9051 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 _0x8bf1=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','Users','map','findAll','unreadMessages','length','emit','catch','hook','events'];(function(_0x334599,_0x4b1cfa){var _0x4cdff2=function(_0x297be7){while(--_0x297be7){_0x334599['push'](_0x334599['shift']());}};_0x4cdff2(++_0x4b1cfa);}(_0x8bf1,0x1e5));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x18bf('0x0'));var MailInteraction=require(_0x18bf('0x1'))['db'][_0x18bf('0x2')];var MailMessage=require(_0x18bf('0x1'))['db'][_0x18bf('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x18bf('0x4')](0x0);var events={'afterCreate':_0x18bf('0x5'),'afterUpdate':_0x18bf('0x6'),'afterDestroy':_0x18bf('0x7')};function emitEvent(_0x4b467e){return function(_0x91d506,_0x5a6a35,_0x59d432){_0x91d506[_0x18bf('0x8')]({'attributes':['id'],'raw':!![]})[_0x18bf('0x9')](function(_0x298f08){_0x91d506['setDataValue'](_0x18bf('0xa'),_0x298f08[_0x18bf('0xb')](function(_0x42d92e){return{'id':_0x42d92e['id']};}));return MailMessage[_0x18bf('0xc')]({'where':{'MailInteractionId':_0x91d506['id'],'direction':'in','read':![]},'raw':!![]});})[_0x18bf('0x9')](function(_0x565c00){_0x91d506['setDataValue'](_0x18bf('0xd'),_0x565c00[_0x18bf('0xe')]);MailInteractionEvents[_0x18bf('0xf')](_0x4b467e+':'+_0x91d506['id'],_0x91d506);MailInteractionEvents[_0x18bf('0xf')](_0x4b467e,_0x91d506);_0x59d432(null);})[_0x18bf('0x10')](_0x59d432(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x18bf('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x5839=['../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','getUsers','then','Users','map','findAll','setDataValue','unreadMessages','length','emit','hasOwnProperty','hook','events'];(function(_0x20b6e2,_0x1105f2){var _0x1e6dde=function(_0x47aa91){while(--_0x47aa91){_0x20b6e2['push'](_0x20b6e2['shift']());}};_0x1e6dde(++_0x1105f2);}(_0x5839,0x155));var _0x9583=function(_0x39df26,_0x30c4fa){_0x39df26=_0x39df26-0x0;var _0x2fcdfc=_0x5839[_0x39df26];return _0x2fcdfc;};'use strict';var EventEmitter=require(_0x9583('0x0'));var MailInteraction=require(_0x9583('0x1'))['db'][_0x9583('0x2')];var MailMessage=require(_0x9583('0x1'))['db'][_0x9583('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x9583('0x4')](0x0);var events={'afterCreate':_0x9583('0x5'),'afterUpdate':_0x9583('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5e87f8){return function(_0xcc90ec,_0x4803d2,_0x57ea7a){_0xcc90ec[_0x9583('0x7')]({'attributes':['id'],'raw':!![]})[_0x9583('0x8')](function(_0x233de9){_0xcc90ec['setDataValue'](_0x9583('0x9'),_0x233de9[_0x9583('0xa')](function(_0x2deb82){return{'id':_0x2deb82['id']};}));return MailMessage[_0x9583('0xb')]({'where':{'MailInteractionId':_0xcc90ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9583('0x8')](function(_0x32379f){_0xcc90ec[_0x9583('0xc')](_0x9583('0xd'),_0x32379f[_0x9583('0xe')]);MailInteractionEvents['emit'](_0x5e87f8+':'+_0xcc90ec['id'],_0xcc90ec);MailInteractionEvents[_0x9583('0xf')](_0x5e87f8,_0xcc90ec);_0x57ea7a(null);})['catch'](_0x57ea7a(null));};}for(var e in events){if(events[_0x9583('0x10')](e)){var event=events[e];MailInteraction[_0x9583('0x11')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 592c3b7..e42b399 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 _0x3775=['substatus','substatusAt','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','format','changed','get','then','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x3775,0x77));var _0x5377=function(_0x55b93b,_0x10b243){_0x55b93b=_0x55b93b-0x0;var _0x4fa7a5=_0x3775[_0x55b93b];return _0x4fa7a5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5377('0x0'));var moment=require(_0x5377('0x1'));var BPromise=require('bluebird');var rp=require(_0x5377('0x2'));var fs=require('fs');var path=require(_0x5377('0x3'));var rimraf=require(_0x5377('0x4'));var config=require(_0x5377('0x5'));var attributes=require(_0x5377('0x6'));module[_0x5377('0x7')]=function(_0xf9b5ab,_0x2928f7){return _0xf9b5ab[_0x5377('0x8')](_0x5377('0x9'),attributes,{'tableName':_0x5377('0xa'),'paranoid':![],'indexes':[{'name':_0x5377('0xb'),'fields':['subject','to'],'type':_0x5377('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x335af6,_0x241a26,_0xa5c588){if(_0x335af6[_0x5377('0xd')]){_0x335af6[_0x5377('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x335af6[_0x5377('0xf')]){_0x335af6[_0x5377('0x10')]=moment()['format'](_0x5377('0x11'));}_0xa5c588(null,_0x241a26);},'beforeUpdate':function(_0x41b032,_0x5cd4bd,_0x20da3c){if(_0x41b032['changed'](_0x5377('0xd'))){_0x41b032[_0x5377('0xe')]=_0x41b032[_0x5377('0xd')]?moment()[_0x5377('0x12')](_0x5377('0x11')):null;}if(_0x41b032[_0x5377('0x13')](_0x5377('0xf'))){_0x41b032['closedAt']=moment()[_0x5377('0x12')](_0x5377('0x11'));_0x41b032[_0x5377('0xd')]=null;_0x41b032[_0x5377('0xe')]=null;}_0x20da3c(null,_0x41b032);},'afterUpdate':function(_0x53154a,_0x4cc343,_0x6c5186){var _0x324cea=_0xf9b5ab['models'];var _0x31588a=_0x53154a[_0x5377('0x14')]({'plain':!![]});if(_0x31588a[_0x5377('0xf')]){return _0x324cea['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x31588a['id']}})[_0x5377('0x15')](function(){_0x6c5186();})['catch'](function(_0x2019ac){_0x6c5186(_0x2019ac);});}else{_0x6c5186();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x519e=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','MailMessage','update','then','catch','utf8mb4'];(function(_0x3b3cce,_0xdae6f){var _0xaa76b0=function(_0x5af0d9){while(--_0x5af0d9){_0x3b3cce['push'](_0x3b3cce['shift']());}};_0xaa76b0(++_0xdae6f);}(_0x519e,0x135));var _0xe519=function(_0x37631d,_0x2618eb){_0x37631d=_0x37631d-0x0;var _0x2f6d77=_0x519e[_0x37631d];return _0x2f6d77;};'use strict';var _=require(_0xe519('0x0'));var util=require(_0xe519('0x1'));var logger=require(_0xe519('0x2'))(_0xe519('0x3'));var moment=require('moment');var BPromise=require(_0xe519('0x4'));var rp=require(_0xe519('0x5'));var fs=require('fs');var path=require(_0xe519('0x6'));var rimraf=require(_0xe519('0x7'));var config=require('../../config/environment');var attributes=require(_0xe519('0x8'));module[_0xe519('0x9')]=function(_0x5b116f,_0x43a06f){return _0x5b116f[_0xe519('0xa')]('MailInteraction',attributes,{'tableName':_0xe519('0xb'),'paranoid':![],'indexes':[{'name':_0xe519('0xc'),'fields':[_0xe519('0xd'),'to'],'type':_0xe519('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0xeab435,_0x3c5d21,_0x5a5177){if(_0xeab435[_0xe519('0xf')]){_0xeab435[_0xe519('0x10')]=moment()[_0xe519('0x11')](_0xe519('0x12'));}if(_0xeab435[_0xe519('0x13')]){_0xeab435[_0xe519('0x14')]=moment()[_0xe519('0x11')](_0xe519('0x12'));}_0x5a5177(null,_0x3c5d21);},'beforeUpdate':function(_0x52d72c,_0x199ed3,_0x33bd93){if(_0x52d72c[_0xe519('0x15')](_0xe519('0xf'))){_0x52d72c[_0xe519('0x10')]=_0x52d72c[_0xe519('0xf')]?moment()[_0xe519('0x11')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x52d72c[_0xe519('0x15')](_0xe519('0x13'))){_0x52d72c['closedAt']=moment()['format'](_0xe519('0x12'));_0x52d72c[_0xe519('0xf')]=null;_0x52d72c[_0xe519('0x10')]=null;}_0x33bd93(null,_0x52d72c);},'afterUpdate':function(_0x398661,_0x243316,_0x564bb8){var _0x33215f=_0x5b116f['models'];var _0x59ae37=_0x398661['get']({'plain':!![]});if(_0x59ae37[_0xe519('0x13')]){return _0x33215f[_0xe519('0x16')][_0xe519('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x59ae37['id']}})[_0xe519('0x18')](function(){_0x564bb8();})[_0xe519('0x19')](function(_0x535c78){_0x564bb8(_0x535c78);});}else{_0x564bb8();}}},'charset':_0xe519('0x1a'),'collate':_0xe519('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index ca7431d..caf7001 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 _0x6929=['request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','attributes','AddTagsToMailInteraction','find','addTags','body','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x5a7ec2,_0x583473){var _0x53c4ff=function(_0x1c190d){while(--_0x1c190d){_0x5a7ec2['push'](_0x5a7ec2['shift']());}};_0x53c4ff(++_0x583473);}(_0x6929,0xc0));var _0x9692=function(_0x59527a,_0x340652){_0x59527a=_0x59527a-0x0;var _0x143c0f=_0x6929[_0x59527a];return _0x143c0f;};'use strict';var _=require(_0x9692('0x0'));var util=require(_0x9692('0x1'));var moment=require(_0x9692('0x2'));var BPromise=require('bluebird');var rs=require(_0x9692('0x3'));var fs=require('fs');var Redis=require(_0x9692('0x4'));var db=require(_0x9692('0x5'))['db'];var utils=require(_0x9692('0x6'));var logger=require(_0x9692('0x7'))(_0x9692('0x8'));var config=require(_0x9692('0x9'));var jayson=require(_0x9692('0xa'));var client=jayson[_0x9692('0xb')][_0x9692('0xc')]({'port':0x232a});config[_0x9692('0xd')]=_['defaults'](config[_0x9692('0xd')],{'host':_0x9692('0xe'),'port':0x18eb});var socket=require(_0x9692('0xf'))(new Redis(config['redis']));require(_0x9692('0x10'))[_0x9692('0x11')](socket);function respondWithRpcPromise(_0x46c668,_0x498752,_0x454eac){return new BPromise(function(_0x48e046,_0x4f03c8){return client[_0x9692('0x12')](_0x46c668,_0x454eac)[_0x9692('0x13')](function(_0x1510df){logger[_0x9692('0x14')](_0x9692('0x15'),_0x498752,_0x9692('0x16'));logger[_0x9692('0x17')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x498752,_0x9692('0x16'),JSON[_0x9692('0x18')](_0x1510df));if(_0x1510df[_0x9692('0x19')]){if(_0x1510df[_0x9692('0x19')][_0x9692('0x1a')]===0x1f4){logger['error'](_0x9692('0x15'),_0x498752,_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);return _0x4f03c8(_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);}logger[_0x9692('0x19')](_0x9692('0x15'),_0x498752,_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);return _0x48e046(_0x1510df[_0x9692('0x19')][_0x9692('0x1b')]);}else{logger[_0x9692('0x14')](_0x9692('0x15'),_0x498752,_0x9692('0x16'));_0x48e046(_0x1510df[_0x9692('0x1c')][_0x9692('0x1b')]);}})[_0x9692('0x1d')](function(_0x5b45d4){logger[_0x9692('0x19')](_0x9692('0x15'),_0x498752,_0x5b45d4);_0x4f03c8(_0x5b45d4);});});}exports[_0x9692('0x1e')]=function(_0x354a56){var _0x5f5aa9=this;return new Promise(function(_0xb01e0c,_0x4f0daa){return db[_0x9692('0x1f')][_0x9692('0x20')](_0x354a56['body'],{'raw':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['where']||null:null,'attributes':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')][_0x9692('0x22')]||null:null,'limit':_0x354a56[_0x9692('0x21')]?_0x354a56[_0x9692('0x21')]['limit']||null:null})['then'](function(_0x32ab85){logger['info'](_0x9692('0x1e'),_0x354a56);logger[_0x9692('0x17')](_0x9692('0x1e'),_0x354a56,JSON[_0x9692('0x18')](_0x32ab85));_0xb01e0c(_0x32ab85);})[_0x9692('0x1d')](function(_0x51e3bf){logger[_0x9692('0x19')](_0x9692('0x1e'),_0x51e3bf[_0x9692('0x1b')],_0x354a56);_0x4f0daa(_0x5f5aa9[_0x9692('0x19')](0x1f4,_0x51e3bf['message']));});});};exports[_0x9692('0x23')]=function(_0xd8761d){return new Promise(function(_0x2296dd,_0x52dff6){return db[_0x9692('0x1f')][_0x9692('0x24')]({'where':_0xd8761d[_0x9692('0x21')]?_0xd8761d[_0x9692('0x21')]['where']||null:null})['then'](function(_0x4c7b16){if(_0x4c7b16){return _0x4c7b16[_0x9692('0x25')](_0xd8761d[_0x9692('0x26')][_0x9692('0x27')],_['omit'](_0xd8761d[_0x9692('0x26')],[_0x9692('0x27'),'id'])||{});}})[_0x9692('0x28')](function(_0x5db140){logger['info'](_0x9692('0x29'),_0xd8761d);logger[_0x9692('0x17')]('AddTags',_0xd8761d,JSON['stringify'](_0x5db140));_0x2296dd(_0x5db140);})[_0x9692('0x1d')](function(_0x34d2d3){logger[_0x9692('0x19')](_0x9692('0x29'),_0x34d2d3[_0x9692('0x1b')],_0xd8761d);_0x52dff6(_this['error'](0x1f4,_0x34d2d3[_0x9692('0x1b')]));});});}; \ No newline at end of file +var _0xe861=['MailInteraction,\x20%s,\x20%s','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','stringify','addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','then'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe861,0xb3));var _0x1e86=function(_0x5c8d2d,_0x2755ae){_0x5c8d2d=_0x5c8d2d-0x0;var _0x18b198=_0xe861[_0x5c8d2d];return _0x18b198;};'use strict';var _=require(_0x1e86('0x0'));var util=require(_0x1e86('0x1'));var moment=require(_0x1e86('0x2'));var BPromise=require(_0x1e86('0x3'));var rs=require(_0x1e86('0x4'));var fs=require('fs');var Redis=require(_0x1e86('0x5'));var db=require(_0x1e86('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e86('0x7'))(_0x1e86('0x8'));var config=require(_0x1e86('0x9'));var jayson=require(_0x1e86('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x1e86('0xb')]=_[_0x1e86('0xc')](config[_0x1e86('0xb')],{'host':_0x1e86('0xd'),'port':0x18eb});var socket=require(_0x1e86('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x4974bd,_0x2994af,_0x3a990e){return new BPromise(function(_0x232f09,_0x886a24){return client['request'](_0x4974bd,_0x3a990e)[_0x1e86('0xf')](function(_0x2fec3b){logger['info'](_0x1e86('0x10'),_0x2994af,_0x1e86('0x11'));logger[_0x1e86('0x12')](_0x1e86('0x13'),_0x2994af,'request\x20sent',JSON['stringify'](_0x2fec3b));if(_0x2fec3b[_0x1e86('0x14')]){if(_0x2fec3b['error'][_0x1e86('0x15')]===0x1f4){logger[_0x1e86('0x14')](_0x1e86('0x10'),_0x2994af,_0x2fec3b['error']['message']);return _0x886a24(_0x2fec3b[_0x1e86('0x14')][_0x1e86('0x16')]);}logger[_0x1e86('0x14')](_0x1e86('0x10'),_0x2994af,_0x2fec3b[_0x1e86('0x14')][_0x1e86('0x16')]);return _0x232f09(_0x2fec3b[_0x1e86('0x14')][_0x1e86('0x16')]);}else{logger[_0x1e86('0x17')](_0x1e86('0x10'),_0x2994af,_0x1e86('0x11'));_0x232f09(_0x2fec3b['result'][_0x1e86('0x16')]);}})[_0x1e86('0x18')](function(_0x5d95bb){logger['error'](_0x1e86('0x10'),_0x2994af,_0x5d95bb);_0x886a24(_0x5d95bb);});});}exports[_0x1e86('0x19')]=function(_0x4d9990){var _0x284b1b=this;return new Promise(function(_0x4583c3,_0x280ec2){return db[_0x1e86('0x1a')][_0x1e86('0x1b')](_0x4d9990[_0x1e86('0x1c')],{'raw':_0x4d9990[_0x1e86('0x1d')]?_0x4d9990[_0x1e86('0x1d')][_0x1e86('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9990[_0x1e86('0x1d')]?_0x4d9990[_0x1e86('0x1d')][_0x1e86('0x1f')]||null:null,'attributes':_0x4d9990['options']?_0x4d9990[_0x1e86('0x1d')][_0x1e86('0x20')]||null:null,'limit':_0x4d9990['options']?_0x4d9990['options'][_0x1e86('0x21')]||null:null})[_0x1e86('0xf')](function(_0x3a1079){logger[_0x1e86('0x17')]('UpdateMailInteraction',_0x4d9990);logger[_0x1e86('0x12')](_0x1e86('0x19'),_0x4d9990,JSON[_0x1e86('0x22')](_0x3a1079));_0x4583c3(_0x3a1079);})[_0x1e86('0x18')](function(_0x5f3fec){logger[_0x1e86('0x14')](_0x1e86('0x19'),_0x5f3fec[_0x1e86('0x16')],_0x4d9990);_0x280ec2(_0x284b1b[_0x1e86('0x14')](0x1f4,_0x5f3fec[_0x1e86('0x16')]));});});};exports['AddTagsToMailInteraction']=function(_0x2439b9){return new Promise(function(_0x40aa85,_0x332b03){return db[_0x1e86('0x1a')]['find']({'where':_0x2439b9[_0x1e86('0x1d')]?_0x2439b9[_0x1e86('0x1d')]['where']||null:null})[_0x1e86('0xf')](function(_0x4a5330){if(_0x4a5330){return _0x4a5330[_0x1e86('0x23')](_0x2439b9[_0x1e86('0x1c')][_0x1e86('0x24')],_['omit'](_0x2439b9['body'],[_0x1e86('0x24'),'id'])||{});}})[_0x1e86('0x25')](function(_0x416b37){logger['info']('AddTags',_0x2439b9);logger[_0x1e86('0x12')](_0x1e86('0x26'),_0x2439b9,JSON[_0x1e86('0x22')](_0x416b37));_0x40aa85(_0x416b37);})[_0x1e86('0x18')](function(_0x5282e2){logger[_0x1e86('0x14')]('AddTags',_0x5282e2[_0x1e86('0x16')],_0x2439b9);_0x332b03(_this['error'](0x1f4,_0x5282e2[_0x1e86('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 97d2869..d5d1082 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 _0x214e=['removeListener','register','mailInteraction:','./mailInteraction.events','save','remove','update','emit'];(function(_0xa86f1a,_0x4612a7){var _0x355c16=function(_0x5b6c5d){while(--_0x5b6c5d){_0xa86f1a['push'](_0xa86f1a['shift']());}};_0x355c16(++_0x4612a7);}(_0x214e,0x1e3));var _0xe214=function(_0x4c8d0e,_0x4b6f61){_0x4c8d0e=_0x4c8d0e-0x0;var _0x45ec45=_0x214e[_0x4c8d0e];return _0x45ec45;};'use strict';var MailInteractionEvents=require(_0xe214('0x0'));var events=[_0xe214('0x1'),_0xe214('0x2'),_0xe214('0x3')];function createListener(_0x36c854,_0x3b139a){return function(_0x50b119){_0x3b139a[_0xe214('0x4')](_0x36c854,_0x50b119);};}function removeListener(_0x442f4c,_0x1e21c4){return function(){MailInteractionEvents[_0xe214('0x5')](_0x442f4c,_0x1e21c4);};}exports[_0xe214('0x6')]=function(_0x590656){for(var _0x3dd2bc=0x0,_0x57bbeb=events['length'];_0x3dd2bc<_0x57bbeb;_0x3dd2bc++){var _0x5c1e82=events[_0x3dd2bc];var _0x98bdd2=createListener(_0xe214('0x7')+_0x5c1e82,_0x590656);MailInteractionEvents['on'](_0x5c1e82,_0x98bdd2);}}; \ No newline at end of file +var _0x2231=['length','mailInteraction:','./mailInteraction.events','remove','removeListener','register'];(function(_0x2c2980,_0x34282a){var _0x2a20a9=function(_0x537b18){while(--_0x537b18){_0x2c2980['push'](_0x2c2980['shift']());}};_0x2a20a9(++_0x34282a);}(_0x2231,0x182));var _0x1223=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0x2231[_0x53be66];return _0x9e5520;};'use strict';var MailInteractionEvents=require(_0x1223('0x0'));var events=['save',_0x1223('0x1'),'update'];function createListener(_0x23d116,_0x2b2e05){return function(_0x29d482){_0x2b2e05['emit'](_0x23d116,_0x29d482);};}function removeListener(_0x474480,_0x1263b7){return function(){MailInteractionEvents[_0x1223('0x2')](_0x474480,_0x1263b7);};}exports[_0x1223('0x3')]=function(_0x1e6f96){for(var _0x2c9410=0x0,_0x51115e=events[_0x1223('0x4')];_0x2c9410<_0x51115e;_0x2c9410++){var _0x3148c1=events[_0x2c9410];var _0x2f5839=createListener(_0x1223('0x5')+_0x3148c1,_0x1e6f96);MailInteractionEvents['on'](_0x3148c1,_0x2f5839);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 1b134ef..f6b1aa4 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 _0x1339=['/describe','describe','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','/:id/accept','accept','put','/:id/reject','reject','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x553a94,_0x372a29){var _0x3e918a=function(_0x3c2277){while(--_0x3c2277){_0x553a94['push'](_0x553a94['shift']());}};_0x3e918a(++_0x372a29);}(_0x1339,0x1ed));var _0x9133=function(_0x42580e,_0x4739ed){_0x42580e=_0x42580e-0x0;var _0x316d43=_0x1339[_0x42580e];return _0x316d43;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9133('0x0'));var timeout=require(_0x9133('0x1'));var express=require(_0x9133('0x2'));var router=express[_0x9133('0x3')]();var fs_extra=require(_0x9133('0x4'));var auth=require(_0x9133('0x5'));var interaction=require(_0x9133('0x6'));var config=require(_0x9133('0x7'));var controller=require('./mailMessage.controller');router[_0x9133('0x8')]('/',auth[_0x9133('0x9')](),controller[_0x9133('0xa')]);router['get'](_0x9133('0xb'),auth[_0x9133('0x9')](),controller[_0x9133('0xc')]);router[_0x9133('0x8')](_0x9133('0xd'),auth[_0x9133('0x9')](),controller[_0x9133('0xe')]);router[_0x9133('0x8')](_0x9133('0xf'),auth[_0x9133('0x9')](),controller['download']);router[_0x9133('0x10')]('/',auth[_0x9133('0x9')](),interaction[_0x9133('0x11')](_0x9133('0x12'),_0x9133('0x13')),controller[_0x9133('0x14')]);router['put'](_0x9133('0xd'),auth[_0x9133('0x9')](),controller['update']);router['put'](_0x9133('0x15'),auth['isAuthenticated'](),controller[_0x9133('0x16')]);router[_0x9133('0x17')](_0x9133('0x18'),auth[_0x9133('0x9')](),controller[_0x9133('0x19')]);router[_0x9133('0x1a')]('/:id',auth[_0x9133('0x9')](),controller[_0x9133('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8c51=['/:id/download','download','post','tracked','mailmessage:create','create','update','put','accept','/:id/reject','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','isAuthenticated','/describe','get','/:id','show'];(function(_0x307ada,_0x207bce){var _0x524c1f=function(_0x5c62f5){while(--_0x5c62f5){_0x307ada['push'](_0x307ada['shift']());}};_0x524c1f(++_0x207bce);}(_0x8c51,0x100));var _0x18c5=function(_0x82d885,_0x4e6cf4){_0x82d885=_0x82d885-0x0;var _0x44d511=_0x8c51[_0x82d885];return _0x44d511;};'use strict';var multer=require('multer');var util=require(_0x18c5('0x0'));var path=require(_0x18c5('0x1'));var timeout=require(_0x18c5('0x2'));var express=require(_0x18c5('0x3'));var router=express[_0x18c5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18c5('0x5'));var interaction=require(_0x18c5('0x6'));var config=require(_0x18c5('0x7'));var controller=require(_0x18c5('0x8'));router['get']('/',auth[_0x18c5('0x9')](),controller['index']);router['get'](_0x18c5('0xa'),auth[_0x18c5('0x9')](),controller['describe']);router[_0x18c5('0xb')](_0x18c5('0xc'),auth['isAuthenticated'](),controller[_0x18c5('0xd')]);router['get'](_0x18c5('0xe'),auth[_0x18c5('0x9')](),controller[_0x18c5('0xf')]);router[_0x18c5('0x10')]('/',auth[_0x18c5('0x9')](),interaction[_0x18c5('0x11')]('mail',_0x18c5('0x12')),controller[_0x18c5('0x13')]);router['put'](_0x18c5('0xc'),auth['isAuthenticated'](),controller[_0x18c5('0x14')]);router[_0x18c5('0x15')]('/:id/accept',auth[_0x18c5('0x9')](),controller[_0x18c5('0x16')]);router[_0x18c5('0x15')](_0x18c5('0x17'),auth['isAuthenticated'](),controller['reject']);router[_0x18c5('0x18')](_0x18c5('0xc'),auth[_0x18c5('0x9')](),controller[_0x18c5('0x19')]);module[_0x18c5('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index a9d35fb..2805f84 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 _0x3b9f=['Chat','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email'];(function(_0x10d77c,_0x2f1d77){var _0x10f7cc=function(_0x1a593e){while(--_0x1a593e){_0x10d77c['push'](_0x10d77c['shift']());}};_0x10f7cc(++_0x2f1d77);}(_0x3b9f,0x83));var _0xf3b9=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3b9f[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf3b9('0x0'));var _=require('lodash');module[_0xf3b9('0x1')]={'body':{'type':Sequelize[_0xf3b9('0x2')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf3b9('0x2')](_0xf3b9('0x3'))},'read':{'type':Sequelize[_0xf3b9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf3b9('0x5')]('in',_0xf3b9('0x6')),'defaultValue':_0xf3b9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf3b9('0x7')](0x1fe)},'from':{'type':Sequelize[_0xf3b9('0x7')]},'to':{'type':Sequelize[_0xf3b9('0x2')](_0xf3b9('0x8'))},'cc':{'type':Sequelize[_0xf3b9('0x2')]('long')},'bcc':{'type':Sequelize[_0xf3b9('0x2')]('long')},'subject':{'type':Sequelize[_0xf3b9('0x2')]},'sentAt':{'type':Sequelize[_0xf3b9('0x9')]},'attach':{'type':Sequelize[_0xf3b9('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf3b9('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf3b9('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0xf3b9('0x8'))},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize['ENUM'](_0xf3b9('0xb'),_0xf3b9('0xc')),'defaultValue':_0xf3b9('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0xadfc=['out','STRING','INTEGER','DATE','Email','Chat','sequelize','lodash','exports','TEXT','long','medium','BOOLEAN','ENUM'];(function(_0x260860,_0x5e8661){var _0x1e01af=function(_0x2a7d40){while(--_0x2a7d40){_0x260860['push'](_0x260860['shift']());}};_0x1e01af(++_0x5e8661);}(_0xadfc,0x12c));var _0xcadf=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xadfc[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xcadf('0x0'));var _=require(_0xcadf('0x1'));module[_0xcadf('0x2')]={'body':{'type':Sequelize[_0xcadf('0x3')](_0xcadf('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xcadf('0x3')](_0xcadf('0x5'))},'read':{'type':Sequelize[_0xcadf('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcadf('0x7')]('in',_0xcadf('0x8')),'defaultValue':_0xcadf('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcadf('0x9')](0x1fe)},'from':{'type':Sequelize[_0xcadf('0x9')]},'to':{'type':Sequelize['TEXT'](_0xcadf('0x4'))},'cc':{'type':Sequelize[_0xcadf('0x3')](_0xcadf('0x4'))},'bcc':{'type':Sequelize[_0xcadf('0x3')](_0xcadf('0x4'))},'subject':{'type':Sequelize[_0xcadf('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xcadf('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xcadf('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xcadf('0xb')]},'originTo':{'type':Sequelize[_0xcadf('0x3')]('long')},'originCc':{'type':Sequelize[_0xcadf('0x3')](_0xcadf('0x4'))},'originChannel':{'type':Sequelize[_0xcadf('0x7')](_0xcadf('0xc'),_0xcadf('0xd')),'defaultValue':_0xcadf('0xc'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 2fc0a3a..a5586ef 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 _0x9644=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','params','options','find','body','describe','create','direction','out','secret','split','MailAccount','CmList','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','server/files/attachments','basename','List','Contacts','CmContact','defaults','ListId','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','motionChannel','event','rejectmessage','unix','join','server','files','tmp','root','message-%s.eml','from','bcc','subject','createdAt','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','type','readFileSync','build','unlinkSync','eml-format','moment','path','lodash','ioredis','html-to-text','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','stack','name','map','MailMessage','key','query','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9644,0x1ae));var _0x4964=function(_0x1de01d,_0xeb122c){_0x1de01d=_0x1de01d-0x0;var _0x2865ef=_0x9644[_0x1de01d];return _0x2865ef;};'use strict';var emlformat=require(_0x4964('0x0'));var moment=require(_0x4964('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x4964('0x2'));var fs=require('fs');var _=require(_0x4964('0x3'));var Redis=require(_0x4964('0x4'));var htmlToText=require(_0x4964('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x4964('0x6'))(_0x4964('0x7'));var interaction_log=require(_0x4964('0x6'))(_0x4964('0x8'));var config=require(_0x4964('0x9'));var db=require(_0x4964('0xa'))['db'];config['redis']=_['defaults'](config[_0x4964('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x4964('0xc'))(new Redis(config[_0x4964('0xb')]));var htmlEntities=require(_0x4964('0xd'));require(_0x4964('0xe'))[_0x4964('0xf')](socket);var jayson=require(_0x4964('0x10'));var client=jayson['client'][_0x4964('0x11')]({'port':0x232c});var client9003=jayson[_0x4964('0x12')][_0x4964('0x11')]({'port':0x232b});var client9002=jayson[_0x4964('0x12')][_0x4964('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x169977,_0x2c94af,_0x377a96,_0x4db8d1){return new BPromise(function(_0x1eb87a,_0x56e3ed){var _0x1ec04b=_0x4db8d1||client;return _0x1ec04b[_0x4964('0x13')](_0x169977,_0x377a96)[_0x4964('0x14')](function(_0x1cf8be){logger[_0x4964('0x15')]('MailMessage,\x20%s,\x20%s',_0x2c94af,_0x4964('0x16'));logger['debug'](_0x4964('0x17'),_0x2c94af,'request\x20sent',JSON[_0x4964('0x18')](_0x1cf8be));if(_0x1cf8be[_0x4964('0x19')]){if(_0x1cf8be[_0x4964('0x19')][_0x4964('0x1a')]===0x1f4){logger['error'](_0x4964('0x1b'),_0x2c94af,_0x1cf8be[_0x4964('0x19')][_0x4964('0x1c')]);return _0x56e3ed(_0x1cf8be[_0x4964('0x19')][_0x4964('0x1c')]);}logger[_0x4964('0x19')]('MailMessage,\x20%s,\x20%s',_0x2c94af,_0x1cf8be[_0x4964('0x19')][_0x4964('0x1c')]);return _0x1eb87a(_0x1cf8be[_0x4964('0x19')][_0x4964('0x1c')]);}else{logger[_0x4964('0x15')](_0x4964('0x1b'),_0x2c94af,'request\x20sent');_0x1eb87a(_0x1cf8be[_0x4964('0x1d')][_0x4964('0x1c')]);}})['catch'](function(_0x16282b){logger[_0x4964('0x19')](_0x4964('0x1b'),_0x2c94af,_0x16282b);_0x56e3ed(_0x16282b);});});}function respondWithResult(_0x598813,_0x568642){_0x568642=_0x568642||0xc8;return function(_0x353cc4){if(_0x353cc4){return _0x598813[_0x4964('0x1e')](_0x568642)[_0x4964('0x1f')](_0x353cc4);}};}function respondWithFilteredResult(_0x4eac79,_0x52e227){return function(_0x477d13){if(_0x477d13){var _0x553cf8=typeof _0x52e227[_0x4964('0x20')]==='undefined'&&typeof _0x52e227[_0x4964('0x21')]===_0x4964('0x22');var _0x42a6b6=_0x477d13[_0x4964('0x23')];var _0x39676e=_0x553cf8?0x0:_0x52e227[_0x4964('0x20')];var _0x500f4a=_0x553cf8?_0x477d13[_0x4964('0x23')]:_0x52e227[_0x4964('0x20')]+_0x52e227[_0x4964('0x21')];var _0x544abc;if(_0x500f4a>=_0x42a6b6){_0x500f4a=_0x42a6b6;_0x544abc=0xc8;}else{_0x544abc=0xce;}_0x4eac79[_0x4964('0x1e')](_0x544abc);return _0x4eac79[_0x4964('0x24')](_0x4964('0x25'),_0x39676e+'-'+_0x500f4a+'/'+_0x42a6b6)[_0x4964('0x1f')](_0x477d13);}return null;};}function saveUpdates(_0x5ceabd){return function(_0x53888a){if(_0x53888a){return _0x53888a[_0x4964('0x26')](_0x5ceabd)['then'](function(_0x50be64){return _0x50be64;});}return null;};}function removeEntity(_0x258a6b){return function(_0x341067){if(_0x341067){return _0x341067[_0x4964('0x27')]()[_0x4964('0x14')](function(){_0x258a6b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3af9f6){return function(_0x3c2722){if(!_0x3c2722){_0x3af9f6['sendStatus'](0x194);}return _0x3c2722;};}function handleError(_0x9712db,_0x2c8007){_0x2c8007=_0x2c8007||0x1f4;return function(_0x37d371){logger['error'](_0x37d371[_0x4964('0x28')]);if(_0x37d371[_0x4964('0x29')]){delete _0x37d371[_0x4964('0x29')];}_0x9712db[_0x4964('0x1e')](_0x2c8007)['send'](_0x37d371);};}exports['index']=function(_0x119184,_0x7f7f84){var _0x238c52={},_0x51839d={},_0x5f2f19={'count':0x0,'rows':[]};var _0x962c8d=_[_0x4964('0x2a')](db[_0x4964('0x2b')]['rawAttributes'],function(_0x591d8c){return{'name':_0x591d8c['fieldName'],'type':_0x591d8c['type'][_0x4964('0x2c')]};});_0x51839d['model']=_[_0x4964('0x2a')](_0x962c8d,_0x4964('0x29'));_0x51839d[_0x4964('0x2d')]=_[_0x4964('0x2e')](_0x119184[_0x4964('0x2d')]);_0x51839d[_0x4964('0x2f')]=_[_0x4964('0x30')](_0x51839d['model'],_0x51839d['query']);_0x238c52['attributes']=_[_0x4964('0x30')](_0x51839d[_0x4964('0x31')],qs[_0x4964('0x32')](_0x119184[_0x4964('0x2d')]['fields']));_0x238c52[_0x4964('0x33')]=_0x238c52[_0x4964('0x33')][_0x4964('0x34')]?_0x238c52[_0x4964('0x33')]:_0x51839d[_0x4964('0x31')];if(!_0x119184['query'][_0x4964('0x35')](_0x4964('0x36'))){_0x238c52['limit']=qs[_0x4964('0x21')](_0x119184['query'][_0x4964('0x21')]);_0x238c52['offset']=qs[_0x4964('0x20')](_0x119184[_0x4964('0x2d')][_0x4964('0x20')]);}_0x238c52[_0x4964('0x37')]=qs[_0x4964('0x38')](_0x119184['query'][_0x4964('0x38')]);_0x238c52['where']=qs['filters'](_[_0x4964('0x39')](_0x119184['query'],_0x51839d[_0x4964('0x2f')]),_0x962c8d);if(_0x119184[_0x4964('0x2d')][_0x4964('0x3a')]){_0x238c52['where']=_['merge'](_0x238c52[_0x4964('0x3b')],{'$or':_['map'](_0x962c8d,function(_0x1def27){if(_0x1def27['type']!=='VIRTUAL'){var _0x4c590a={};_0x4c590a[_0x1def27['name']]={'$like':'%'+_0x119184['query']['filter']+'%'};return _0x4c590a;}})});}_0x238c52=_[_0x4964('0x3c')]({},_0x238c52,_0x119184['options']);var _0x4b92d1={'where':_0x238c52[_0x4964('0x3b')]};return db['MailMessage'][_0x4964('0x23')](_0x4b92d1)[_0x4964('0x14')](function(_0x47b82f){_0x5f2f19[_0x4964('0x23')]=_0x47b82f;if(_0x119184[_0x4964('0x2d')][_0x4964('0x3d')]){_0x238c52[_0x4964('0x3e')]=[{'all':!![]}];}return db[_0x4964('0x2b')][_0x4964('0x3f')](_0x238c52);})['then'](function(_0x4a6ef4){_0x5f2f19[_0x4964('0x40')]=_0x4a6ef4;return _0x5f2f19;})['then'](respondWithFilteredResult(_0x7f7f84,_0x238c52))[_0x4964('0x41')](handleError(_0x7f7f84,null));};exports['show']=function(_0x28b946,_0x30c4cd){var _0x1a3627={'raw':!![],'where':{'id':_0x28b946[_0x4964('0x42')]['id']}},_0x2287e2={};_0x2287e2['model']=_[_0x4964('0x2e')](db['MailMessage']['rawAttributes']);_0x2287e2[_0x4964('0x2d')]=_[_0x4964('0x2e')](_0x28b946['query']);_0x2287e2[_0x4964('0x2f')]=_['intersection'](_0x2287e2['model'],_0x2287e2[_0x4964('0x2d')]);_0x1a3627[_0x4964('0x33')]=_[_0x4964('0x30')](_0x2287e2['model'],qs[_0x4964('0x32')](_0x28b946['query'][_0x4964('0x32')]));_0x1a3627[_0x4964('0x33')]=_0x1a3627[_0x4964('0x33')][_0x4964('0x34')]?_0x1a3627[_0x4964('0x33')]:_0x2287e2[_0x4964('0x31')];if(_0x28b946[_0x4964('0x2d')][_0x4964('0x3d')]){_0x1a3627[_0x4964('0x3e')]=[{'all':!![]}];}_0x1a3627=_[_0x4964('0x3c')]({},_0x1a3627,_0x28b946[_0x4964('0x43')]);return db[_0x4964('0x2b')][_0x4964('0x44')](_0x1a3627)['then'](handleEntityNotFound(_0x30c4cd,null))[_0x4964('0x14')](respondWithResult(_0x30c4cd,null))[_0x4964('0x41')](handleError(_0x30c4cd,null));};exports[_0x4964('0x26')]=function(_0x3f4238,_0x3524bf){if(_0x3f4238[_0x4964('0x45')]['id']){delete _0x3f4238[_0x4964('0x45')]['id'];}return db['MailMessage'][_0x4964('0x44')]({'where':{'id':_0x3f4238['params']['id']}})[_0x4964('0x14')](handleEntityNotFound(_0x3524bf,null))['then'](saveUpdates(_0x3f4238[_0x4964('0x45')],null))[_0x4964('0x14')](respondWithResult(_0x3524bf,null))[_0x4964('0x41')](handleError(_0x3524bf,null));};exports[_0x4964('0x27')]=function(_0x4c6800,_0x2a4a45){return db[_0x4964('0x2b')]['find']({'where':{'id':_0x4c6800[_0x4964('0x42')]['id']}})[_0x4964('0x14')](handleEntityNotFound(_0x2a4a45,null))[_0x4964('0x14')](removeEntity(_0x2a4a45,null))[_0x4964('0x41')](handleError(_0x2a4a45,null));};exports['describe']=function(_0x1efca3,_0x3ff539){return db[_0x4964('0x2b')][_0x4964('0x46')]()[_0x4964('0x14')](respondWithResult(_0x3ff539,null))[_0x4964('0x41')](handleError(_0x3ff539,null));};exports['create']=function(_0x26f742,_0x5c1025){return db[_0x4964('0x2b')][_0x4964('0x47')](_0x26f742['body'])['then'](function(_0x17287e){if(_0x17287e){if(_0x17287e[_0x4964('0x48')]===_0x4964('0x49')&&!_0x17287e[_0x4964('0x4a')]){var _0x61ca94,_0x96683a,_0x466de9;if(_0x26f742[_0x4964('0x45')]['to']){_0x96683a=_0x26f742[_0x4964('0x45')]['to'][_0x4964('0x4b')](',')[0x0];}return db[_0x4964('0x4c')]['findOne']({'where':{'id':_0x17287e['MailAccountId']},'include':[{'model':db[_0x4964('0x4d')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0x96683a},'limit':0x1,'order':[[_0x4964('0x4e'),_0x4964('0x4f')]]}]},{'model':db[_0x4964('0x50')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x4964('0x51')],'as':_0x4964('0x51'),'raw':!![]}]}]})[_0x4964('0x14')](function(_0xc66fe8){_0x61ca94=_0xc66fe8;if(!_0x61ca94||!_0x61ca94[_0x4964('0x52')])return;var _0xa175b8=_0x61ca94[_0x4964('0x53')]();if(_0x26f742[_0x4964('0x45')]['attachments']&&_0x26f742[_0x4964('0x45')]['attachments']['length']){for(var _0x245f48=0x0;_0x245f48<_0x26f742[_0x4964('0x45')]['attachments']['length'];_0x245f48+=0x1){_0x26f742[_0x4964('0x45')][_0x4964('0x54')][_0x245f48]={'filename':_0x26f742[_0x4964('0x45')][_0x4964('0x54')][_0x245f48][_0x4964('0x29')],'path':path['join'](config['root'],_0x4964('0x55'),_0x26f742[_0x4964('0x45')][_0x4964('0x54')][_0x245f48][_0x4964('0x56')])};}}_0x466de9={'account':_0xa175b8,'message':_0x26f742[_0x4964('0x45')]};return;})[_0x4964('0x14')](function(){if(_0x61ca94[_0x4964('0x57')]){if(_0x61ca94[_0x4964('0x57')][_0x4964('0x58')]['length']){return _0x61ca94['List']['Contacts'][0x0];}else{return db[_0x4964('0x59')]['create'](_[_0x4964('0x5a')](_0x26f742['body'],{'firstName':_0x26f742['body']['to'],'email':_0x26f742[_0x4964('0x45')]['to'],'phone':_0x26f742[_0x4964('0x45')]['to'],'ListId':_0x61ca94[_0x4964('0x5b')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x4964('0x14')](function(){if(_0x466de9){return respondWithRpcPromise('SendMail','sendMail',_0x466de9,client9003)[_0x4964('0x14')](function(_0x278bc4){return _0x17287e['update']({'read':!![],'messageId':_0x278bc4[_0x4964('0x5c')],'sentAt':moment()[_0x4964('0x5d')](_0x4964('0x5e'))});})[_0x4964('0x41')](function(_0x1af629){logger[_0x4964('0x19')]('%s',JSON[_0x4964('0x18')](_0x1af629));return _0x17287e;});}return _0x17287e;});}return _0x17287e;}})[_0x4964('0x14')](respondWithResult(_0x5c1025,0xc9))['catch'](handleError(_0x5c1025,null));};exports[_0x4964('0x5f')]=function(_0x8310e5,_0x25f091){var _0x139e27={'agent':{},'channel':_0x4964('0x60')};if(_0x8310e5[_0x4964('0x45')]['id']){delete _0x8310e5[_0x4964('0x45')]['id'];}_0x8310e5['body'][_0x4964('0x61')]=!![];_0x8310e5[_0x4964('0x45')][_0x4964('0x62')]=moment()[_0x4964('0x5d')](_0x4964('0x5e'));_0x8310e5['body']['UserId']=_0x8310e5[_0x4964('0x45')][_0x4964('0x63')]||_0x8310e5[_0x4964('0x64')]['id'];_0x139e27[_0x4964('0x65')]['id']=_0x8310e5[_0x4964('0x45')][_0x4964('0x63')];return db[_0x4964('0x2b')]['find']({'where':{'id':_0x8310e5['params']['id'],'UserId':null}})[_0x4964('0x14')](handleEntityNotFound(_0x25f091,null))['then'](saveUpdates(_0x8310e5[_0x4964('0x45')],null))[_0x4964('0x14')](function(_0x26d8de){if(_0x26d8de){_0x139e27[_0x4964('0x1c')]=_0x26d8de[_0x4964('0x66')]({'plain':!![]});return db['MailInteraction'][_0x4964('0x44')]({'where':{'id':_0x26d8de[_0x4964('0x67')]}});}return null;})[_0x4964('0x14')](handleEntityNotFound(_0x25f091,null))['then'](function(_0x1ddbbb){if(_0x1ddbbb){return _0x1ddbbb[_0x4964('0x26')]({'UserId':_0x8310e5[_0x4964('0x45')][_0x4964('0x63')],'read1stAt':_[_0x4964('0x68')](_0x1ddbbb[_0x4964('0x69')])?moment()[_0x4964('0x5d')](_0x4964('0x5e')):undefined});}return null;})[_0x4964('0x14')](function(_0xe95d61){if(_0xe95d61){_0x139e27[_0x4964('0x6a')]=_0xe95d61[_0x4964('0x66')]({'plain':!![]});interaction_log[_0x4964('0x15')](_0x4964('0x6b'),_0x8310e5[_0x4964('0x64')]['id'],_0x8310e5[_0x4964('0x64')][_0x4964('0x29')],_0x8310e5['user']['role'],_0x139e27[_0x4964('0x6a')]['id'],_0x8310e5['body']?JSON[_0x4964('0x18')](_0x8310e5['body']):_0x4964('0x6c'));return respondWithRpcPromise(_0x4964('0x6d'),_0x4964('0x6e'),_0x139e27);}return null;})['then'](function(_0x4e9aae){var _0x2a6cc3=_0x4964('0x6f')+_0x4e9aae['message'][_0x4964('0x70')];return db[_0x4964('0x71')]['query'](_0x2a6cc3,{'type':db[_0x4964('0x72')][_0x4964('0x73')][_0x4964('0x74')],'raw':!![]})['then'](function(_0x33df75){return _0x33df75;});})[_0x4964('0x14')](function(_0x37ea0a){if(_0x37ea0a){_0x139e27[_0x4964('0x1c')]['contact']=_0x37ea0a[0x0];if(!_0x8310e5[_0x4964('0x45')][_0x4964('0x63')])return;return db[_0x4964('0x75')]['find']({'where':{'id':_0x8310e5['body'][_0x4964('0x63')],'role':_0x4964('0x65')},'attributes':['id','name',_0x4964('0x76'),_0x4964('0x77'),_0x4964('0x78')],'raw':!![]});}return null;})[_0x4964('0x14')](function(_0x2e07ba){if(!_0x2e07ba)return null;_0x139e27[_0x4964('0x1c')][_0x4964('0x65')]=_0x2e07ba;return _0x139e27;})['then'](function(_0x449d35){if(_0x449d35){if(_0x8310e5[_0x4964('0x45')]['manual']){_0x139e27[_0x4964('0x1c')][_0x4964('0x79')]=util['format'](_0x4964('0x7a'),_0x8310e5[_0x4964('0x64')][_0x4964('0x29')]);_0x139e27[_0x4964('0x1c')][_0x4964('0x7b')]=_0x139e27[_0x4964('0x7b')];_0x139e27['message']['motionChannel']=_0x139e27[_0x4964('0x7b')];_0x139e27['message']['event']=_0x4964('0x5f');_0x139e27[_0x4964('0x1c')][_0x4964('0x45')]=htmlToText[_0x4964('0x7c')](_0x139e27[_0x4964('0x1c')][_0x4964('0x45')]);return respondWithRpcPromise(_0x4964('0x7d'),_0x4964('0x7d'),{'event':_0x4964('0x7e'),'message':_0x139e27[_0x4964('0x1c')]},client9002)[_0x4964('0x14')](function(){return _0x139e27;});}return _0x139e27;}return null;})[_0x4964('0x14')](respondWithResult(_0x25f091,null))[_0x4964('0x41')](handleError(_0x25f091,null));};exports[_0x4964('0x7f')]=function(_0x4a3b82,_0x567715){var _0x315df7={'agent':{},'channel':'mail'};if(_0x4a3b82['body']['id']){delete _0x4a3b82[_0x4964('0x45')]['id'];}_0x4a3b82['body']['UserId']=_0x4a3b82[_0x4964('0x45')][_0x4964('0x63')]||_0x4a3b82[_0x4964('0x64')]['id'];_0x315df7['agent']['id']=_0x4a3b82['body'][_0x4964('0x63')];return db['MailMessage']['find']({'where':{'id':_0x4a3b82['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x567715,null))[_0x4964('0x14')](function(_0x2a8ca8){if(_0x2a8ca8){_0x315df7['message']=_0x2a8ca8[_0x4964('0x66')]({'plain':!![]});return db[_0x4964('0x80')][_0x4964('0x44')]({'where':{'id':_0x2a8ca8['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x567715,null))[_0x4964('0x14')](function(_0x4c0066){if(_0x4c0066){_0x315df7[_0x4964('0x6a')]=_0x4c0066[_0x4964('0x66')]({'plain':!![]});interaction_log[_0x4964('0x15')](_0x4964('0x81'),_0x4a3b82[_0x4964('0x64')]['id'],_0x4a3b82[_0x4964('0x64')][_0x4964('0x29')],_0x4a3b82[_0x4964('0x64')]['role'],_0x315df7['interaction']['id'],_0x4a3b82['body']?JSON[_0x4964('0x18')](_0x4a3b82[_0x4964('0x45')]):'null');return respondWithRpcPromise(_0x4964('0x82'),_0x4964('0x83'),_0x315df7);}return null;})['then'](function(_0x594d59){var _0x7b128f=_0x4964('0x6f')+_0x594d59['message'][_0x4964('0x70')];return db[_0x4964('0x71')]['query'](_0x7b128f,{'type':db[_0x4964('0x72')]['QueryTypes'][_0x4964('0x74')],'raw':!![]})['then'](function(_0x561abd){return _0x561abd;});})[_0x4964('0x14')](function(_0x478139){if(_0x478139){_0x315df7[_0x4964('0x1c')][_0x4964('0x84')]=_0x478139[0x0];if(!_0x4a3b82[_0x4964('0x45')][_0x4964('0x63')])return;return db[_0x4964('0x75')][_0x4964('0x44')]({'where':{'id':_0x4a3b82[_0x4964('0x45')][_0x4964('0x63')],'role':'agent'},'attributes':['id',_0x4964('0x29'),'fullname',_0x4964('0x77'),_0x4964('0x78')],'raw':!![]});}return null;})['then'](function(_0x3e8c25){if(!_0x3e8c25)return null;_0x315df7['message'][_0x4964('0x65')]=_0x3e8c25;return _0x315df7;})['then'](function(_0x444eef){if(_0x444eef){_0x444eef[_0x4964('0x1c')]['interface']=util[_0x4964('0x5d')]('SIP/%s',_0x4a3b82[_0x4964('0x64')][_0x4964('0x29')]);_0x444eef[_0x4964('0x1c')][_0x4964('0x7b')]=_0x315df7[_0x4964('0x7b')];_0x444eef[_0x4964('0x1c')][_0x4964('0x85')]=_0x315df7[_0x4964('0x7b')];_0x444eef[_0x4964('0x1c')][_0x4964('0x86')]=_0x4964('0x7f');_0x444eef[_0x4964('0x1c')][_0x4964('0x45')]=htmlToText['fromString'](_0x315df7[_0x4964('0x1c')][_0x4964('0x45')]);respondWithRpcPromise(_0x4964('0x7d'),_0x4964('0x7d'),{'event':_0x4964('0x87'),'message':_0x444eef['message']},client9002);return _0x315df7;}return null;})[_0x4964('0x14')](respondWithResult(_0x567715,null))[_0x4964('0x41')](handleError(_0x567715,null));};exports['download']=function(_0x45101c,_0x3f6ef6){var _0x57db80=moment()[_0x4964('0x88')]()['toString']();var _0x5db56d=path[_0x4964('0x89')](config['root'],_0x4964('0x8a'),_0x4964('0x8b'),_0x4964('0x8c'));var _0x28e5bd=path[_0x4964('0x89')](config[_0x4964('0x8d')],_0x4964('0x8a'),_0x4964('0x8b'),'attachments');var _0x16a0af=util[_0x4964('0x5d')](_0x4964('0x8e'),_0x57db80);return db[_0x4964('0x2b')]['find']({'where':{'id':_0x45101c[_0x4964('0x42')]['id']},'attributes':['id',_0x4964('0x45'),_0x4964('0x8f'),'to','cc',_0x4964('0x90'),_0x4964('0x91'),_0x4964('0x92')],'include':_0x45101c[_0x4964('0x2d')][_0x4964('0x54')]?[{'model':db[_0x4964('0x93')],'as':'Attachments'}]:undefined})[_0x4964('0x14')](handleEntityNotFound(_0x3f6ef6,null))[_0x4964('0x14')](function(_0x23b449){if(_0x23b449){var _0x425be2=_0x23b449;var _0x8a56cb={'from':_0x425be2[_0x4964('0x8f')],'to':_0x425be2['to'],'subject':_0x425be2['subject'],'html':htmlEntities[_0x4964('0x94')](_0x425be2[_0x4964('0x45')]),'headers':{'Date':moment(_0x425be2[_0x4964('0x92')])[_0x4964('0x5d')](_0x4964('0x95'))},'attachments':[]};if(_0x23b449['cc']){_0x8a56cb['headers']['Cc']=_0x23b449['cc'];}if(_0x23b449[_0x4964('0x90')]){_0x8a56cb[_0x4964('0x96')][_0x4964('0x97')]=_0x23b449[_0x4964('0x90')];}return new BPromise(function(_0x15985f,_0x4f3fd7){if(_0x23b449['Attachments']){for(var _0x5b48da=0x0;_0x5b48da<_0x23b449[_0x4964('0x98')][_0x4964('0x34')];_0x5b48da++){var _0x321195=_0x23b449[_0x4964('0x98')][_0x5b48da];var _0x1b4ba2=path[_0x4964('0x89')](_0x28e5bd,_0x321195['basename']);if(fs[_0x4964('0x99')](_0x1b4ba2)){_0x8a56cb[_0x4964('0x54')][_0x4964('0x9a')]({'name':_0x321195['name'],'contentType':_0x321195[_0x4964('0x9b')],'data':fs[_0x4964('0x9c')](_0x1b4ba2)});}}}emlformat[_0x4964('0x9d')](_0x8a56cb,function(_0xc95951,_0xcfda99){if(_0xc95951)return _0x4f3fd7(_0xc95951);fs['writeFileSync'](path[_0x4964('0x89')](_0x5db56d,_0x16a0af),_0xcfda99);return _0x15985f(_0xcfda99);});});}})['then'](function(_0x44f0b4){if(_0x44f0b4){return _0x3f6ef6['download'](path[_0x4964('0x89')](_0x5db56d,_0x16a0af),_0x16a0af,function(_0x3fb44d){if(!_0x3fb44d)fs[_0x4964('0x9e')](path[_0x4964('0x89')](_0x5db56d,_0x16a0af));});}})[_0x4964('0x41')](handleError(_0x3f6ef6,null));}; \ No newline at end of file +var _0xc3ef=['rejectmessage','toString','server','files','tmp','message-%s.eml','from','bcc','subject','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','html-to-text','../../components/parsers/qs','api','mail-interactions','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','status','offset','limit','undefined','set','json','update','sendStatus','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','query','fields','length','order','sort','pick','filter','where','merge','options','MailMessage','count','rows','catch','params','includeAll','include','find','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','basename','List','ListId','List\x20not\x20found','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','format','UserId','user','agent','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','Sequelize','reject'];(function(_0x25eb43,_0x16f87a){var _0x3d6aaf=function(_0x4806b6){while(--_0x4806b6){_0x25eb43['push'](_0x25eb43['shift']());}};_0x3d6aaf(++_0x16f87a);}(_0xc3ef,0x146));var _0xfc3e=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xc3ef[_0x465a0c];return _0x1e202e;};'use strict';var emlformat=require(_0xfc3e('0x0'));var moment=require(_0xfc3e('0x1'));var BPromise=require(_0xfc3e('0x2'));var util=require('util');var path=require(_0xfc3e('0x3'));var fs=require('fs');var _=require(_0xfc3e('0x4'));var Redis=require(_0xfc3e('0x5'));var htmlToText=require(_0xfc3e('0x6'));var qs=require(_0xfc3e('0x7'));var logger=require('../../config/logger')(_0xfc3e('0x8'));var interaction_log=require('../../config/logger')(_0xfc3e('0x9'));var config=require('../../config/environment');var db=require(_0xfc3e('0xa'))['db'];config[_0xfc3e('0xb')]=_[_0xfc3e('0xc')](config[_0xfc3e('0xb')],{'host':_0xfc3e('0xd'),'port':0x18eb});var socket=require(_0xfc3e('0xe'))(new Redis(config['redis']));var htmlEntities=require('html-entities');require(_0xfc3e('0xf'))[_0xfc3e('0x10')](socket);var jayson=require(_0xfc3e('0x11'));var client=jayson[_0xfc3e('0x12')][_0xfc3e('0x13')]({'port':0x232c});var client9003=jayson['client'][_0xfc3e('0x13')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f93b0,_0x2a526a,_0x5ab07a,_0x157f46){return new BPromise(function(_0x2cce17,_0x404edf){var _0x21c4e0=_0x157f46||client;return _0x21c4e0[_0xfc3e('0x14')](_0x1f93b0,_0x5ab07a)[_0xfc3e('0x15')](function(_0xd8d9ef){logger[_0xfc3e('0x16')]('MailMessage,\x20%s,\x20%s',_0x2a526a,_0xfc3e('0x17'));logger['debug'](_0xfc3e('0x18'),_0x2a526a,'request\x20sent',JSON[_0xfc3e('0x19')](_0xd8d9ef));if(_0xd8d9ef[_0xfc3e('0x1a')]){if(_0xd8d9ef[_0xfc3e('0x1a')]['code']===0x1f4){logger['error'](_0xfc3e('0x1b'),_0x2a526a,_0xd8d9ef[_0xfc3e('0x1a')][_0xfc3e('0x1c')]);return _0x404edf(_0xd8d9ef[_0xfc3e('0x1a')][_0xfc3e('0x1c')]);}logger[_0xfc3e('0x1a')](_0xfc3e('0x1b'),_0x2a526a,_0xd8d9ef[_0xfc3e('0x1a')]['message']);return _0x2cce17(_0xd8d9ef['error']['message']);}else{logger[_0xfc3e('0x16')](_0xfc3e('0x1b'),_0x2a526a,_0xfc3e('0x17'));_0x2cce17(_0xd8d9ef['result'][_0xfc3e('0x1c')]);}})['catch'](function(_0x297b6f){logger[_0xfc3e('0x1a')](_0xfc3e('0x1b'),_0x2a526a,_0x297b6f);_0x404edf(_0x297b6f);});});}function respondWithResult(_0xb170e3,_0x3a9da6){_0x3a9da6=_0x3a9da6||0xc8;return function(_0x50063f){if(_0x50063f){return _0xb170e3[_0xfc3e('0x1d')](_0x3a9da6)['json'](_0x50063f);}};}function respondWithFilteredResult(_0x1977a0,_0x2d86ac){return function(_0x110f5b){if(_0x110f5b){var _0x515142=typeof _0x2d86ac[_0xfc3e('0x1e')]==='undefined'&&typeof _0x2d86ac[_0xfc3e('0x1f')]===_0xfc3e('0x20');var _0x18bc6f=_0x110f5b['count'];var _0x3dd91d=_0x515142?0x0:_0x2d86ac['offset'];var _0x30c600=_0x515142?_0x110f5b['count']:_0x2d86ac[_0xfc3e('0x1e')]+_0x2d86ac[_0xfc3e('0x1f')];var _0x3dd3b9;if(_0x30c600>=_0x18bc6f){_0x30c600=_0x18bc6f;_0x3dd3b9=0xc8;}else{_0x3dd3b9=0xce;}_0x1977a0[_0xfc3e('0x1d')](_0x3dd3b9);return _0x1977a0[_0xfc3e('0x21')]('Content-Range',_0x3dd91d+'-'+_0x30c600+'/'+_0x18bc6f)[_0xfc3e('0x22')](_0x110f5b);}return null;};}function saveUpdates(_0x5ea8db){return function(_0x30acec){if(_0x30acec){return _0x30acec[_0xfc3e('0x23')](_0x5ea8db)['then'](function(_0x14aece){return _0x14aece;});}return null;};}function removeEntity(_0x426f78){return function(_0x287ea6){if(_0x287ea6){return _0x287ea6['destroy']()[_0xfc3e('0x15')](function(){_0x426f78[_0xfc3e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28d52f){return function(_0x34dc71){if(!_0x34dc71){_0x28d52f[_0xfc3e('0x24')](0x194);}return _0x34dc71;};}function handleError(_0x161c7a,_0x28e007){_0x28e007=_0x28e007||0x1f4;return function(_0x129b3b){logger[_0xfc3e('0x1a')](_0x129b3b['stack']);if(_0x129b3b[_0xfc3e('0x25')]){delete _0x129b3b[_0xfc3e('0x25')];}_0x161c7a[_0xfc3e('0x1d')](_0x28e007)[_0xfc3e('0x26')](_0x129b3b);};}exports[_0xfc3e('0x27')]=function(_0x5cc397,_0x59418c){var _0x256f65={},_0x16da8a={},_0x428f65={'count':0x0,'rows':[]};var _0x207ace=_[_0xfc3e('0x28')](db['MailMessage'][_0xfc3e('0x29')],function(_0x513bd8){return{'name':_0x513bd8[_0xfc3e('0x2a')],'type':_0x513bd8[_0xfc3e('0x2b')][_0xfc3e('0x2c')]};});_0x16da8a[_0xfc3e('0x2d')]=_[_0xfc3e('0x28')](_0x207ace,_0xfc3e('0x25'));_0x16da8a['query']=_[_0xfc3e('0x2e')](_0x5cc397['query']);_0x16da8a[_0xfc3e('0x2f')]=_['intersection'](_0x16da8a[_0xfc3e('0x2d')],_0x16da8a['query']);_0x256f65[_0xfc3e('0x30')]=_[_0xfc3e('0x31')](_0x16da8a['model'],qs['fields'](_0x5cc397[_0xfc3e('0x32')][_0xfc3e('0x33')]));_0x256f65[_0xfc3e('0x30')]=_0x256f65['attributes'][_0xfc3e('0x34')]?_0x256f65[_0xfc3e('0x30')]:_0x16da8a['model'];if(!_0x5cc397[_0xfc3e('0x32')]['hasOwnProperty']('nolimit')){_0x256f65['limit']=qs[_0xfc3e('0x1f')](_0x5cc397[_0xfc3e('0x32')]['limit']);_0x256f65[_0xfc3e('0x1e')]=qs['offset'](_0x5cc397[_0xfc3e('0x32')][_0xfc3e('0x1e')]);}_0x256f65[_0xfc3e('0x35')]=qs[_0xfc3e('0x36')](_0x5cc397['query'][_0xfc3e('0x36')]);_0x256f65['where']=qs[_0xfc3e('0x2f')](_[_0xfc3e('0x37')](_0x5cc397[_0xfc3e('0x32')],_0x16da8a[_0xfc3e('0x2f')]),_0x207ace);if(_0x5cc397[_0xfc3e('0x32')][_0xfc3e('0x38')]){_0x256f65[_0xfc3e('0x39')]=_[_0xfc3e('0x3a')](_0x256f65[_0xfc3e('0x39')],{'$or':_[_0xfc3e('0x28')](_0x207ace,function(_0x5a6f5b){if(_0x5a6f5b[_0xfc3e('0x2b')]!=='VIRTUAL'){var _0x19c88c={};_0x19c88c[_0x5a6f5b[_0xfc3e('0x25')]]={'$like':'%'+_0x5cc397[_0xfc3e('0x32')]['filter']+'%'};return _0x19c88c;}})});}_0x256f65=_['merge']({},_0x256f65,_0x5cc397[_0xfc3e('0x3b')]);var _0x28a4c4={'where':_0x256f65[_0xfc3e('0x39')]};return db[_0xfc3e('0x3c')][_0xfc3e('0x3d')](_0x28a4c4)[_0xfc3e('0x15')](function(_0x54550d){_0x428f65[_0xfc3e('0x3d')]=_0x54550d;if(_0x5cc397[_0xfc3e('0x32')]['includeAll']){_0x256f65['include']=[{'all':!![]}];}return db[_0xfc3e('0x3c')]['findAll'](_0x256f65);})[_0xfc3e('0x15')](function(_0x2475e3){_0x428f65[_0xfc3e('0x3e')]=_0x2475e3;return _0x428f65;})['then'](respondWithFilteredResult(_0x59418c,_0x256f65))[_0xfc3e('0x3f')](handleError(_0x59418c,null));};exports['show']=function(_0x320170,_0x5132d3){var _0x3f1dcc={'raw':!![],'where':{'id':_0x320170[_0xfc3e('0x40')]['id']}},_0x3cb3fb={};_0x3cb3fb[_0xfc3e('0x2d')]=_[_0xfc3e('0x2e')](db['MailMessage']['rawAttributes']);_0x3cb3fb[_0xfc3e('0x32')]=_[_0xfc3e('0x2e')](_0x320170['query']);_0x3cb3fb['filters']=_['intersection'](_0x3cb3fb['model'],_0x3cb3fb['query']);_0x3f1dcc[_0xfc3e('0x30')]=_[_0xfc3e('0x31')](_0x3cb3fb['model'],qs[_0xfc3e('0x33')](_0x320170[_0xfc3e('0x32')][_0xfc3e('0x33')]));_0x3f1dcc[_0xfc3e('0x30')]=_0x3f1dcc[_0xfc3e('0x30')][_0xfc3e('0x34')]?_0x3f1dcc[_0xfc3e('0x30')]:_0x3cb3fb['model'];if(_0x320170['query'][_0xfc3e('0x41')]){_0x3f1dcc[_0xfc3e('0x42')]=[{'all':!![]}];}_0x3f1dcc=_['merge']({},_0x3f1dcc,_0x320170['options']);return db['MailMessage'][_0xfc3e('0x43')](_0x3f1dcc)[_0xfc3e('0x15')](handleEntityNotFound(_0x5132d3,null))[_0xfc3e('0x15')](respondWithResult(_0x5132d3,null))[_0xfc3e('0x3f')](handleError(_0x5132d3,null));};exports['update']=function(_0xd4562,_0x2cd07f){if(_0xd4562['body']['id']){delete _0xd4562[_0xfc3e('0x44')]['id'];}return db[_0xfc3e('0x3c')][_0xfc3e('0x43')]({'where':{'id':_0xd4562[_0xfc3e('0x40')]['id']}})[_0xfc3e('0x15')](handleEntityNotFound(_0x2cd07f,null))[_0xfc3e('0x15')](saveUpdates(_0xd4562[_0xfc3e('0x44')],null))[_0xfc3e('0x15')](respondWithResult(_0x2cd07f,null))[_0xfc3e('0x3f')](handleError(_0x2cd07f,null));};exports[_0xfc3e('0x45')]=function(_0x54f235,_0x415197){return db['MailMessage'][_0xfc3e('0x43')]({'where':{'id':_0x54f235[_0xfc3e('0x40')]['id']}})[_0xfc3e('0x15')](handleEntityNotFound(_0x415197,null))[_0xfc3e('0x15')](removeEntity(_0x415197,null))[_0xfc3e('0x3f')](handleError(_0x415197,null));};exports[_0xfc3e('0x46')]=function(_0x1ff263,_0x4fea03){return db['MailMessage'][_0xfc3e('0x46')]()[_0xfc3e('0x15')](respondWithResult(_0x4fea03,null))[_0xfc3e('0x3f')](handleError(_0x4fea03,null));};exports[_0xfc3e('0x47')]=function(_0x2c0411,_0x2b67f0){return db[_0xfc3e('0x3c')]['create'](_0x2c0411[_0xfc3e('0x44')])[_0xfc3e('0x15')](function(_0x3ed899){if(_0x3ed899){if(_0x3ed899[_0xfc3e('0x48')]==='out'&&!_0x3ed899[_0xfc3e('0x49')]){var _0x50dc3b,_0x2b9f0d,_0xbdbe21;if(_0x2c0411[_0xfc3e('0x44')]['to']){_0x2b9f0d=_0x2c0411[_0xfc3e('0x44')]['to'][_0xfc3e('0x4a')](',')[0x0];}return db[_0xfc3e('0x4b')][_0xfc3e('0x4c')]({'where':{'id':_0x3ed899[_0xfc3e('0x4d')]},'include':[{'model':db[_0xfc3e('0x4e')],'as':'List','include':[{'model':db[_0xfc3e('0x4f')],'as':_0xfc3e('0x50'),'where':{'email':_0x2b9f0d},'limit':0x1,'order':[[_0xfc3e('0x51'),_0xfc3e('0x52')]]}]},{'model':db[_0xfc3e('0x53')],'as':_0xfc3e('0x54'),'raw':!![],'include':[{'model':db[_0xfc3e('0x55')],'as':_0xfc3e('0x55'),'raw':!![]}]}]})[_0xfc3e('0x15')](function(_0x4d3327){_0x50dc3b=_0x4d3327;if(!_0x50dc3b||!_0x50dc3b[_0xfc3e('0x54')])return;var _0x27e061=_0x50dc3b['getSmtpOptions']();if(_0x2c0411[_0xfc3e('0x44')][_0xfc3e('0x56')]&&_0x2c0411[_0xfc3e('0x44')][_0xfc3e('0x56')][_0xfc3e('0x34')]){for(var _0x5481d7=0x0;_0x5481d7<_0x2c0411['body'][_0xfc3e('0x56')][_0xfc3e('0x34')];_0x5481d7+=0x1){_0x2c0411['body']['attachments'][_0x5481d7]={'filename':_0x2c0411[_0xfc3e('0x44')]['attachments'][_0x5481d7][_0xfc3e('0x25')],'path':path[_0xfc3e('0x57')](config[_0xfc3e('0x58')],'server/files/attachments',_0x2c0411['body']['attachments'][_0x5481d7][_0xfc3e('0x59')])};}}_0xbdbe21={'account':_0x27e061,'message':_0x2c0411[_0xfc3e('0x44')]};return;})[_0xfc3e('0x15')](function(){if(_0x50dc3b[_0xfc3e('0x5a')]){if(_0x50dc3b[_0xfc3e('0x5a')][_0xfc3e('0x50')][_0xfc3e('0x34')]){return _0x50dc3b['List'][_0xfc3e('0x50')][0x0];}else{return db[_0xfc3e('0x4f')][_0xfc3e('0x47')](_[_0xfc3e('0xc')](_0x2c0411[_0xfc3e('0x44')],{'firstName':_0x2c0411[_0xfc3e('0x44')]['to'],'email':_0x2c0411[_0xfc3e('0x44')]['to'],'phone':_0x2c0411[_0xfc3e('0x44')]['to'],'ListId':_0x50dc3b[_0xfc3e('0x5b')]}));}}else{throw new Error(_0xfc3e('0x5c'));}})[_0xfc3e('0x15')](function(){if(_0xbdbe21){return respondWithRpcPromise('SendMail',_0xfc3e('0x5d'),_0xbdbe21,client9003)[_0xfc3e('0x15')](function(_0x1e7e6e){return _0x3ed899[_0xfc3e('0x23')]({'read':!![],'messageId':_0x1e7e6e['messageId'],'sentAt':moment()['format'](_0xfc3e('0x5e'))});})['catch'](function(_0x41eb4a){logger[_0xfc3e('0x1a')]('%s',JSON[_0xfc3e('0x19')](_0x41eb4a));return _0x3ed899;});}return _0x3ed899;});}return _0x3ed899;}})[_0xfc3e('0x15')](respondWithResult(_0x2b67f0,0xc9))[_0xfc3e('0x3f')](handleError(_0x2b67f0,null));};exports[_0xfc3e('0x5f')]=function(_0x508177,_0x58b07b){var _0x299e6a={'agent':{},'channel':_0xfc3e('0x60')};if(_0x508177['body']['id']){delete _0x508177[_0xfc3e('0x44')]['id'];}_0x508177[_0xfc3e('0x44')][_0xfc3e('0x61')]=!![];_0x508177[_0xfc3e('0x44')]['readAt']=moment()[_0xfc3e('0x62')](_0xfc3e('0x5e'));_0x508177[_0xfc3e('0x44')]['UserId']=_0x508177[_0xfc3e('0x44')][_0xfc3e('0x63')]||_0x508177[_0xfc3e('0x64')]['id'];_0x299e6a[_0xfc3e('0x65')]['id']=_0x508177[_0xfc3e('0x44')][_0xfc3e('0x63')];return db[_0xfc3e('0x3c')][_0xfc3e('0x43')]({'where':{'id':_0x508177[_0xfc3e('0x40')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x58b07b,null))[_0xfc3e('0x15')](saveUpdates(_0x508177[_0xfc3e('0x44')],null))[_0xfc3e('0x15')](function(_0x353a5e){if(_0x353a5e){_0x299e6a[_0xfc3e('0x1c')]=_0x353a5e[_0xfc3e('0x66')]({'plain':!![]});return db[_0xfc3e('0x67')][_0xfc3e('0x43')]({'where':{'id':_0x353a5e[_0xfc3e('0x68')]}});}return null;})[_0xfc3e('0x15')](handleEntityNotFound(_0x58b07b,null))['then'](function(_0x4a3b8f){if(_0x4a3b8f){return _0x4a3b8f[_0xfc3e('0x23')]({'UserId':_0x508177[_0xfc3e('0x44')][_0xfc3e('0x63')],'read1stAt':_['isNil'](_0x4a3b8f[_0xfc3e('0x69')])?moment()[_0xfc3e('0x62')](_0xfc3e('0x5e')):undefined});}return null;})[_0xfc3e('0x15')](function(_0x5bc736){if(_0x5bc736){_0x299e6a[_0xfc3e('0x6a')]=_0x5bc736[_0xfc3e('0x66')]({'plain':!![]});interaction_log[_0xfc3e('0x16')](_0xfc3e('0x6b'),_0x508177['user']['id'],_0x508177['user']['name'],_0x508177[_0xfc3e('0x64')][_0xfc3e('0x6c')],_0x299e6a[_0xfc3e('0x6a')]['id'],_0x508177[_0xfc3e('0x44')]?JSON[_0xfc3e('0x19')](_0x508177[_0xfc3e('0x44')]):'null');return respondWithRpcPromise(_0xfc3e('0x6d'),_0xfc3e('0x6e'),_0x299e6a);}return null;})[_0xfc3e('0x15')](function(_0x2fc09c){var _0x23f067=_0xfc3e('0x6f')+_0x2fc09c[_0xfc3e('0x1c')][_0xfc3e('0x70')];return db['sequelize'][_0xfc3e('0x32')](_0x23f067,{'type':db['Sequelize'][_0xfc3e('0x71')][_0xfc3e('0x72')],'raw':!![]})[_0xfc3e('0x15')](function(_0x574220){return _0x574220;});})['then'](function(_0x29cb9c){if(_0x29cb9c){_0x299e6a[_0xfc3e('0x1c')]['contact']=_0x29cb9c[0x0];if(!_0x508177[_0xfc3e('0x44')][_0xfc3e('0x63')])return;return db[_0xfc3e('0x73')][_0xfc3e('0x43')]({'where':{'id':_0x508177[_0xfc3e('0x44')][_0xfc3e('0x63')],'role':_0xfc3e('0x65')},'attributes':['id',_0xfc3e('0x25'),_0xfc3e('0x74'),_0xfc3e('0x75'),_0xfc3e('0x76')],'raw':!![]});}return null;})[_0xfc3e('0x15')](function(_0x48c9cc){if(!_0x48c9cc)return null;_0x299e6a[_0xfc3e('0x1c')]['agent']=_0x48c9cc;return _0x299e6a;})['then'](function(_0x5284f9){if(_0x5284f9){if(_0x508177[_0xfc3e('0x44')][_0xfc3e('0x77')]){_0x299e6a['message'][_0xfc3e('0x78')]=util[_0xfc3e('0x62')](_0xfc3e('0x79'),_0x508177[_0xfc3e('0x64')]['name']);_0x299e6a['message'][_0xfc3e('0x7a')]=_0x299e6a[_0xfc3e('0x7a')];_0x299e6a[_0xfc3e('0x1c')][_0xfc3e('0x7b')]=_0x299e6a[_0xfc3e('0x7a')];_0x299e6a[_0xfc3e('0x1c')][_0xfc3e('0x7c')]=_0xfc3e('0x5f');_0x299e6a[_0xfc3e('0x1c')][_0xfc3e('0x44')]=htmlToText[_0xfc3e('0x7d')](_0x299e6a[_0xfc3e('0x1c')][_0xfc3e('0x44')]);return respondWithRpcPromise(_0xfc3e('0x7e'),'EventManager',{'event':_0xfc3e('0x7f'),'message':_0x299e6a['message']},client9002)[_0xfc3e('0x15')](function(){return _0x299e6a;});}return _0x299e6a;}return null;})[_0xfc3e('0x15')](respondWithResult(_0x58b07b,null))[_0xfc3e('0x3f')](handleError(_0x58b07b,null));};exports['reject']=function(_0x2ef682,_0x3359b2){var _0xdf1912={'agent':{},'channel':_0xfc3e('0x60')};if(_0x2ef682[_0xfc3e('0x44')]['id']){delete _0x2ef682[_0xfc3e('0x44')]['id'];}_0x2ef682['body']['UserId']=_0x2ef682[_0xfc3e('0x44')][_0xfc3e('0x63')]||_0x2ef682[_0xfc3e('0x64')]['id'];_0xdf1912[_0xfc3e('0x65')]['id']=_0x2ef682['body'][_0xfc3e('0x63')];return db[_0xfc3e('0x3c')][_0xfc3e('0x43')]({'where':{'id':_0x2ef682[_0xfc3e('0x40')]['id'],'UserId':null}})[_0xfc3e('0x15')](handleEntityNotFound(_0x3359b2,null))[_0xfc3e('0x15')](function(_0x3ed32b){if(_0x3ed32b){_0xdf1912[_0xfc3e('0x1c')]=_0x3ed32b['get']({'plain':!![]});return db[_0xfc3e('0x67')][_0xfc3e('0x43')]({'where':{'id':_0x3ed32b[_0xfc3e('0x68')]}});}return null;})[_0xfc3e('0x15')](handleEntityNotFound(_0x3359b2,null))[_0xfc3e('0x15')](function(_0x1dc136){if(_0x1dc136){_0xdf1912[_0xfc3e('0x6a')]=_0x1dc136[_0xfc3e('0x66')]({'plain':!![]});interaction_log[_0xfc3e('0x16')](_0xfc3e('0x80'),_0x2ef682['user']['id'],_0x2ef682[_0xfc3e('0x64')][_0xfc3e('0x25')],_0x2ef682[_0xfc3e('0x64')][_0xfc3e('0x6c')],_0xdf1912['interaction']['id'],_0x2ef682['body']?JSON[_0xfc3e('0x19')](_0x2ef682[_0xfc3e('0x44')]):'null');return respondWithRpcPromise('RejectMessage',_0xfc3e('0x81'),_0xdf1912);}return null;})[_0xfc3e('0x15')](function(_0x2526b0){var _0x413574=_0xfc3e('0x6f')+_0x2526b0[_0xfc3e('0x1c')][_0xfc3e('0x70')];return db[_0xfc3e('0x82')][_0xfc3e('0x32')](_0x413574,{'type':db[_0xfc3e('0x83')][_0xfc3e('0x71')]['SELECT'],'raw':!![]})[_0xfc3e('0x15')](function(_0x1f78c1){return _0x1f78c1;});})[_0xfc3e('0x15')](function(_0x50fb73){if(_0x50fb73){_0xdf1912['message']['contact']=_0x50fb73[0x0];if(!_0x2ef682[_0xfc3e('0x44')][_0xfc3e('0x63')])return;return db[_0xfc3e('0x73')][_0xfc3e('0x43')]({'where':{'id':_0x2ef682['body'][_0xfc3e('0x63')],'role':_0xfc3e('0x65')},'attributes':['id','name',_0xfc3e('0x74'),_0xfc3e('0x75'),_0xfc3e('0x76')],'raw':!![]});}return null;})[_0xfc3e('0x15')](function(_0x41914f){if(!_0x41914f)return null;_0xdf1912[_0xfc3e('0x1c')][_0xfc3e('0x65')]=_0x41914f;return _0xdf1912;})['then'](function(_0x21fe84){if(_0x21fe84){_0x21fe84[_0xfc3e('0x1c')]['interface']=util['format'](_0xfc3e('0x79'),_0x2ef682['user'][_0xfc3e('0x25')]);_0x21fe84['message'][_0xfc3e('0x7a')]=_0xdf1912[_0xfc3e('0x7a')];_0x21fe84['message']['motionChannel']=_0xdf1912['channel'];_0x21fe84[_0xfc3e('0x1c')][_0xfc3e('0x7c')]=_0xfc3e('0x84');_0x21fe84[_0xfc3e('0x1c')][_0xfc3e('0x44')]=htmlToText['fromString'](_0xdf1912[_0xfc3e('0x1c')]['body']);respondWithRpcPromise(_0xfc3e('0x7e'),_0xfc3e('0x7e'),{'event':_0xfc3e('0x85'),'message':_0x21fe84[_0xfc3e('0x1c')]},client9002);return _0xdf1912;}return null;})[_0xfc3e('0x15')](respondWithResult(_0x3359b2,null))[_0xfc3e('0x3f')](handleError(_0x3359b2,null));};exports['download']=function(_0x2fa4b0,_0x4001e8){var _0x3a9c14=moment()['unix']()[_0xfc3e('0x86')]();var _0x246a3a=path['join'](config[_0xfc3e('0x58')],_0xfc3e('0x87'),_0xfc3e('0x88'),_0xfc3e('0x89'));var _0xafd8d0=path[_0xfc3e('0x57')](config['root'],_0xfc3e('0x87'),'files','attachments');var _0x551d78=util[_0xfc3e('0x62')](_0xfc3e('0x8a'),_0x3a9c14);return db[_0xfc3e('0x3c')]['find']({'where':{'id':_0x2fa4b0[_0xfc3e('0x40')]['id']},'attributes':['id','body',_0xfc3e('0x8b'),'to','cc',_0xfc3e('0x8c'),_0xfc3e('0x8d'),'createdAt'],'include':_0x2fa4b0['query'][_0xfc3e('0x56')]?[{'model':db[_0xfc3e('0x8e')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x4001e8,null))[_0xfc3e('0x15')](function(_0x15559c){if(_0x15559c){var _0x5339f3=_0x15559c;var _0x2aeb16={'from':_0x5339f3[_0xfc3e('0x8b')],'to':_0x5339f3['to'],'subject':_0x5339f3[_0xfc3e('0x8d')],'html':htmlEntities[_0xfc3e('0x8f')](_0x5339f3[_0xfc3e('0x44')]),'headers':{'Date':moment(_0x5339f3['createdAt'])['format'](_0xfc3e('0x90'))},'attachments':[]};if(_0x15559c['cc']){_0x2aeb16[_0xfc3e('0x91')]['Cc']=_0x15559c['cc'];}if(_0x15559c[_0xfc3e('0x8c')]){_0x2aeb16[_0xfc3e('0x91')][_0xfc3e('0x92')]=_0x15559c[_0xfc3e('0x8c')];}return new BPromise(function(_0x14bb24,_0x2a6df7){if(_0x15559c[_0xfc3e('0x93')]){for(var _0x4fca9b=0x0;_0x4fca9b<_0x15559c[_0xfc3e('0x93')]['length'];_0x4fca9b++){var _0x496e76=_0x15559c[_0xfc3e('0x93')][_0x4fca9b];var _0x5b31d8=path[_0xfc3e('0x57')](_0xafd8d0,_0x496e76[_0xfc3e('0x59')]);if(fs['existsSync'](_0x5b31d8)){_0x2aeb16[_0xfc3e('0x56')]['push']({'name':_0x496e76[_0xfc3e('0x25')],'contentType':_0x496e76[_0xfc3e('0x2b')],'data':fs[_0xfc3e('0x94')](_0x5b31d8)});}}}emlformat[_0xfc3e('0x95')](_0x2aeb16,function(_0x23a5ca,_0x24d4dd){if(_0x23a5ca)return _0x2a6df7(_0x23a5ca);fs[_0xfc3e('0x96')](path['join'](_0x246a3a,_0x551d78),_0x24d4dd);return _0x14bb24(_0x24d4dd);});});}})[_0xfc3e('0x15')](function(_0x232210){if(_0x232210){return _0x4001e8[_0xfc3e('0x97')](path[_0xfc3e('0x57')](_0x246a3a,_0x551d78),_0x551d78,function(_0x28c6c6){if(!_0x28c6c6)fs[_0xfc3e('0x98')](path['join'](_0x246a3a,_0x551d78));});}})[_0xfc3e('0x3f')](handleError(_0x4001e8,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 1b424f9..0ebb3dc 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 _0xc4ce=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xc4ce,0x66));var _0xec4c=function(_0x4a8506,_0x35c900){_0x4a8506=_0x4a8506-0x0;var _0x4a521a=_0xc4ce[_0x4a8506];return _0x4a521a;};'use strict';var EventEmitter=require(_0xec4c('0x0'));var MailMessage=require(_0xec4c('0x1'))['db'][_0xec4c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xec4c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xec4c('0x4'),'afterDestroy':_0xec4c('0x5')};function emitEvent(_0x51ca8d){return function(_0x3b3ae8,_0x404118,_0x464406){MailMessageEvents[_0xec4c('0x6')](_0x51ca8d+':'+_0x3b3ae8['id'],_0x3b3ae8);MailMessageEvents[_0xec4c('0x6')](_0x51ca8d,_0x3b3ae8);_0x464406(null);};}for(var e in events){if(events[_0xec4c('0x7')](e)){var event=events[e];MailMessage[_0xec4c('0x8')](e,emitEvent(event));}}module[_0xec4c('0x9')]=MailMessageEvents; \ No newline at end of file +var _0x2b5c=['hook','exports','events','../../mysqldb','MailMessage','setMaxListeners','emit','hasOwnProperty'];(function(_0x412631,_0x542fe9){var _0x4c210c=function(_0xd5e5da){while(--_0xd5e5da){_0x412631['push'](_0x412631['shift']());}};_0x4c210c(++_0x542fe9);}(_0x2b5c,0x10a));var _0xc2b5=function(_0x4a22df,_0x2b7698){_0x4a22df=_0x4a22df-0x0;var _0x25b34f=_0x2b5c[_0x4a22df];return _0x25b34f;};'use strict';var EventEmitter=require(_0xc2b5('0x0'));var MailMessage=require(_0xc2b5('0x1'))['db'][_0xc2b5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xc2b5('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45074c){return function(_0x334538,_0x5eb282,_0x4527af){MailMessageEvents[_0xc2b5('0x4')](_0x45074c+':'+_0x334538['id'],_0x334538);MailMessageEvents[_0xc2b5('0x4')](_0x45074c,_0x334538);_0x4527af(null);};}for(var e in events){if(events[_0xc2b5('0x5')](e)){var event=events[e];MailMessage[_0xc2b5('0x6')](e,emitEvent(event));}}module[_0xc2b5('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b7b92f3..7434c69 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 _0x030e=['exports','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','direction','toLowerCase','out','isNil','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x538983,_0xecc53d){var _0x460615=function(_0x589292){while(--_0x589292){_0x538983['push'](_0x538983['shift']());}};_0x460615(++_0xecc53d);}(_0x030e,0xbe));var _0xe030=function(_0x123f7f,_0x277fe3){_0x123f7f=_0x123f7f-0x0;var _0x13310d=_0x030e[_0x123f7f];return _0x13310d;};'use strict';var _=require(_0xe030('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe030('0x1'));var moment=require(_0xe030('0x2'));var BPromise=require('bluebird');var rp=require(_0xe030('0x3'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0xe030('0x4'));var rimraf=require(_0xe030('0x5'));var config=require(_0xe030('0x6'));var attributes=require(_0xe030('0x7'));module[_0xe030('0x8')]=function(_0x2b4be0,_0xa979a8){return _0x2b4be0[_0xe030('0x9')](_0xe030('0xa'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0xe030('0xb'),'fields':['messageId']},{'name':_0xe030('0xc'),'fields':[_0xe030('0xd'),_0xe030('0xe')],'type':_0xe030('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x327327,_0x1809ee,_0x1095b5){if(_0x327327[_0xe030('0x10')]){_0x327327[_0xe030('0xd')]=htmlToText[_0xe030('0x11')](_0x327327[_0xe030('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1095b5(null,_0x1809ee);},'afterCreate':function(_0x64f445,_0x11016c,_0x4fcb6b){var _0x39be2d=_0x2b4be0[_0xe030('0x12')];var _0x492e71=_0x64f445[_0xe030('0x13')]({'plain':!![]});if(_0x492e71[_0xe030('0x14')][_0xe030('0x15')]()==='in'||_0x492e71[_0xe030('0x14')][_0xe030('0x15')]()===_0xe030('0x16')&&!_0x492e71['secret']&&!_[_0xe030('0x17')](_0x492e71['UserId'])){_0x39be2d[_0xe030('0x18')][_0xe030('0x19')]({'where':{'id':_0x492e71[_0xe030('0x1a')]}})[_0xe030('0x1b')](function(_0x2b4eee){if(_0x2b4eee){_0x2b4eee[_0xe030('0x1c')]({'lastMsgAt':_0x492e71[_0xe030('0x1d')],'lastMsgDirection':_0x492e71['direction'][_0xe030('0x15')]()});}})[_0xe030('0x1e')](function(_0x4d1dca){console[_0xe030('0x1f')](_0x4d1dca);});}_0x4fcb6b();}},'charset':_0xe030('0x20'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0d76=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailMessage.attributes','define','MailMessage','messageId','fti_mail_messages','plainBody','subject','body','get','direction','toLowerCase','out','isNil','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x0d76,0x78));var _0x60d7=function(_0x218c39,_0x31de32){_0x218c39=_0x218c39-0x0;var _0x100e20=_0x0d76[_0x218c39];return _0x100e20;};'use strict';var _=require(_0x60d7('0x0'));var util=require(_0x60d7('0x1'));var logger=require('../../config/logger')(_0x60d7('0x2'));var moment=require(_0x60d7('0x3'));var BPromise=require(_0x60d7('0x4'));var rp=require(_0x60d7('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require(_0x60d7('0x6'));var rimraf=require(_0x60d7('0x7'));var config=require(_0x60d7('0x8'));var attributes=require(_0x60d7('0x9'));module['exports']=function(_0x1b2fc6,_0x229c4e){return _0x1b2fc6[_0x60d7('0xa')](_0x60d7('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x60d7('0xc'),'fields':[_0x60d7('0xc')]},{'name':_0x60d7('0xd'),'fields':[_0x60d7('0xe'),_0x60d7('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36e9fc,_0x1c164a,_0x14df5c){if(_0x36e9fc[_0x60d7('0x10')]){_0x36e9fc[_0x60d7('0xe')]=htmlToText['fromString'](_0x36e9fc[_0x60d7('0x10')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x14df5c(null,_0x1c164a);},'afterCreate':function(_0x3f8ab0,_0x592521,_0x35655c){var _0x468aa7=_0x1b2fc6['models'];var _0x3a744b=_0x3f8ab0[_0x60d7('0x11')]({'plain':!![]});if(_0x3a744b[_0x60d7('0x12')]['toLowerCase']()==='in'||_0x3a744b[_0x60d7('0x12')][_0x60d7('0x13')]()===_0x60d7('0x14')&&!_0x3a744b['secret']&&!_[_0x60d7('0x15')](_0x3a744b['UserId'])){_0x468aa7[_0x60d7('0x16')][_0x60d7('0x17')]({'where':{'id':_0x3a744b['MailInteractionId']}})[_0x60d7('0x18')](function(_0x44cdbb){if(_0x44cdbb){_0x44cdbb[_0x60d7('0x19')]({'lastMsgAt':_0x3a744b[_0x60d7('0x1a')],'lastMsgDirection':_0x3a744b['direction'][_0x60d7('0x13')]()});}})[_0x60d7('0x1b')](function(_0x35db69){console[_0x60d7('0x1c')](_0x35db69);});}_0x35655c();}},'charset':_0x60d7('0x1d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 04ba7de..837e707 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 _0x7916=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','body','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','defaults','localhost','./mailMessage.socket','register'];(function(_0x2a58a9,_0x57e303){var _0x5f53f2=function(_0x209d33){while(--_0x209d33){_0x2a58a9['push'](_0x2a58a9['shift']());}};_0x5f53f2(++_0x57e303);}(_0x7916,0x128));var _0x6791=function(_0x10ca9b,_0x41cac1){_0x10ca9b=_0x10ca9b-0x0;var _0x35aec3=_0x7916[_0x10ca9b];return _0x35aec3;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var moment=require(_0x6791('0x1'));var BPromise=require(_0x6791('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6791('0x3'));var db=require(_0x6791('0x4'))['db'];var utils=require(_0x6791('0x5'));var logger=require(_0x6791('0x6'))('rpc');var config=require(_0x6791('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6791('0x8')][_0x6791('0x9')]({'port':0x232a});config['redis']=_[_0x6791('0xa')](config['redis'],{'host':_0x6791('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6791('0xc'))[_0x6791('0xd')](socket);function respondWithRpcPromise(_0x579950,_0xbc3bc6,_0x2769a4){return new BPromise(function(_0x2aeae9,_0x495d9c){return client[_0x6791('0xe')](_0x579950,_0x2769a4)[_0x6791('0xf')](function(_0x2025dd){logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,_0x6791('0x12'));logger[_0x6791('0x13')](_0x6791('0x14'),_0xbc3bc6,_0x6791('0x12'),JSON[_0x6791('0x15')](_0x2025dd));if(_0x2025dd[_0x6791('0x16')]){if(_0x2025dd['error']['code']===0x1f4){logger[_0x6791('0x16')]('MailMessage,\x20%s,\x20%s',_0xbc3bc6,_0x2025dd[_0x6791('0x16')]['message']);return _0x495d9c(_0x2025dd[_0x6791('0x16')][_0x6791('0x17')]);}logger['error'](_0x6791('0x11'),_0xbc3bc6,_0x2025dd['error'][_0x6791('0x17')]);return _0x2aeae9(_0x2025dd[_0x6791('0x16')]['message']);}else{logger[_0x6791('0x10')](_0x6791('0x11'),_0xbc3bc6,'request\x20sent');_0x2aeae9(_0x2025dd[_0x6791('0x18')]['message']);}})[_0x6791('0x19')](function(_0x126451){logger[_0x6791('0x16')](_0x6791('0x11'),_0xbc3bc6,_0x126451);_0x495d9c(_0x126451);});});}exports[_0x6791('0x1a')]=function(_0x2bc0ab){var _0x2ba11a=this;return new Promise(function(_0x581d51,_0x4a2922){return db[_0x6791('0x1b')]['create'](_0x2bc0ab[_0x6791('0x1c')],{'raw':_0x2bc0ab[_0x6791('0x1d')]?_0x2bc0ab['options'][_0x6791('0x1e')]===undefined?!![]:![]:!![]})[_0x6791('0xf')](function(_0x15b9ab){logger[_0x6791('0x10')]('CreateMailMessage',_0x2bc0ab);logger[_0x6791('0x13')](_0x6791('0x1a'),_0x2bc0ab,JSON['stringify'](_0x15b9ab));_0x581d51(_0x15b9ab);})['catch'](function(_0x4b23bc){logger[_0x6791('0x16')]('CreateMailMessage',_0x4b23bc[_0x6791('0x17')],_0x2bc0ab);_0x4a2922(_0x2ba11a['error'](0x1f4,_0x4b23bc['message']));});});}; \ No newline at end of file +var _0x84a0=['lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','info','result','catch','CreateMailMessage','MailMessage','create','body','options','raw'];(function(_0x42a995,_0x595bb7){var _0x8fff1d=function(_0x3a4f6c){while(--_0x3a4f6c){_0x42a995['push'](_0x42a995['shift']());}};_0x8fff1d(++_0x595bb7);}(_0x84a0,0x66));var _0x084a=function(_0x327dc3,_0x3e78d2){_0x327dc3=_0x327dc3-0x0;var _0x599437=_0x84a0[_0x327dc3];return _0x599437;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var moment=require(_0x084a('0x2'));var BPromise=require(_0x084a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x084a('0x4'));var db=require(_0x084a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x084a('0x6'));var config=require(_0x084a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x084a('0x8')][_0x084a('0x9')]({'port':0x232a});config[_0x084a('0xa')]=_[_0x084a('0xb')](config[_0x084a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x084a('0xc'))(new Redis(config[_0x084a('0xa')]));require(_0x084a('0xd'))[_0x084a('0xe')](socket);function respondWithRpcPromise(_0x142127,_0x4c1e29,_0x4dd423){return new BPromise(function(_0x3d9dc6,_0x853df){return client[_0x084a('0xf')](_0x142127,_0x4dd423)[_0x084a('0x10')](function(_0x2d7c90){logger['info']('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));logger[_0x084a('0x12')](_0x084a('0x13'),_0x4c1e29,_0x084a('0x11'),JSON[_0x084a('0x14')](_0x2d7c90));if(_0x2d7c90[_0x084a('0x15')]){if(_0x2d7c90[_0x084a('0x15')][_0x084a('0x16')]===0x1f4){logger['error'](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x853df(_0x2d7c90[_0x084a('0x15')][_0x084a('0x18')]);}logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x2d7c90['error'][_0x084a('0x18')]);return _0x3d9dc6(_0x2d7c90['error'][_0x084a('0x18')]);}else{logger[_0x084a('0x19')]('MailMessage,\x20%s,\x20%s',_0x4c1e29,_0x084a('0x11'));_0x3d9dc6(_0x2d7c90[_0x084a('0x1a')][_0x084a('0x18')]);}})[_0x084a('0x1b')](function(_0x33d3a6){logger[_0x084a('0x15')](_0x084a('0x17'),_0x4c1e29,_0x33d3a6);_0x853df(_0x33d3a6);});});}exports[_0x084a('0x1c')]=function(_0x3f60cf){var _0xcb5356=this;return new Promise(function(_0x3c7fd6,_0x279e25){return db[_0x084a('0x1d')][_0x084a('0x1e')](_0x3f60cf[_0x084a('0x1f')],{'raw':_0x3f60cf['options']?_0x3f60cf[_0x084a('0x20')][_0x084a('0x21')]===undefined?!![]:![]:!![]})[_0x084a('0x10')](function(_0x2d62bf){logger[_0x084a('0x19')]('CreateMailMessage',_0x3f60cf);logger[_0x084a('0x12')](_0x084a('0x1c'),_0x3f60cf,JSON[_0x084a('0x14')](_0x2d62bf));_0x3c7fd6(_0x2d62bf);})[_0x084a('0x1b')](function(_0x18b43d){logger[_0x084a('0x15')]('CreateMailMessage',_0x18b43d[_0x084a('0x18')],_0x3f60cf);_0x279e25(_0xcb5356[_0x084a('0x15')](0x1f4,_0x18b43d[_0x084a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 5c90637..8947c91 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 _0x5493=['register','length','mailMessage:','save','remove','update','emit','removeListener'];(function(_0x1952ae,_0x38b83b){var _0x11f9a3=function(_0x1e4706){while(--_0x1e4706){_0x1952ae['push'](_0x1952ae['shift']());}};_0x11f9a3(++_0x38b83b);}(_0x5493,0xe3));var _0x3549=function(_0x28cc63,_0x17a1ff){_0x28cc63=_0x28cc63-0x0;var _0x52967a=_0x5493[_0x28cc63];return _0x52967a;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x3549('0x0'),_0x3549('0x1'),_0x3549('0x2')];function createListener(_0xe2bb88,_0x1e0253){return function(_0x816ad3){_0x1e0253[_0x3549('0x3')](_0xe2bb88,_0x816ad3);};}function removeListener(_0x3a63de,_0x4a6f83){return function(){MailMessageEvents[_0x3549('0x4')](_0x3a63de,_0x4a6f83);};}exports[_0x3549('0x5')]=function(_0x27437a){for(var _0x451507=0x0,_0x2dd1de=events[_0x3549('0x6')];_0x451507<_0x2dd1de;_0x451507++){var _0x327aeb=events[_0x451507];var _0x33d060=createListener(_0x3549('0x7')+_0x327aeb,_0x27437a);MailMessageEvents['on'](_0x327aeb,_0x33d060);}}; \ No newline at end of file +var _0x26f5=['save','emit','removeListener','length','mailMessage:','./mailMessage.events'];(function(_0x186a24,_0x81072a){var _0x5b487f=function(_0x2f62c5){while(--_0x2f62c5){_0x186a24['push'](_0x186a24['shift']());}};_0x5b487f(++_0x81072a);}(_0x26f5,0x16d));var _0x526f=function(_0x1b9a0d,_0x2d1054){_0x1b9a0d=_0x1b9a0d-0x0;var _0x48515f=_0x26f5[_0x1b9a0d];return _0x48515f;};'use strict';var MailMessageEvents=require(_0x526f('0x0'));var events=[_0x526f('0x1'),'remove','update'];function createListener(_0x53fa2c,_0x30891e){return function(_0x56e978){_0x30891e[_0x526f('0x2')](_0x53fa2c,_0x56e978);};}function removeListener(_0x9ede6c,_0x51ad8e){return function(){MailMessageEvents[_0x526f('0x3')](_0x9ede6c,_0x51ad8e);};}exports['register']=function(_0x4046f4){for(var _0x488413=0x0,_0x2565b6=events[_0x526f('0x4')];_0x488413<_0x2565b6;_0x488413++){var _0x5cbd27=events[_0x488413];var _0x14b108=createListener(_0x526f('0x5')+_0x5cbd27,_0x4046f4);MailMessageEvents['on'](_0x5cbd27,_0x14b108);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 002d4f4..9698b78 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 _0x7517=['getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams'];(function(_0x30c333,_0x52d607){var _0x2b4f2c=function(_0x57eef3){while(--_0x57eef3){_0x30c333['push'](_0x30c333['shift']());}};_0x2b4f2c(++_0x52d607);}(_0x7517,0xfd));var _0x7751=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x7517[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x7751('0x0'));var util=require('util');var path=require(_0x7751('0x1'));var timeout=require(_0x7751('0x2'));var express=require('express');var router=express[_0x7751('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7751('0x4'));var interaction=require(_0x7751('0x5'));var config=require(_0x7751('0x6'));var controller=require(_0x7751('0x7'));router[_0x7751('0x8')]('/',auth[_0x7751('0x9')](),controller[_0x7751('0xa')]);router[_0x7751('0x8')](_0x7751('0xb'),auth['isAuthenticated'](),controller[_0x7751('0xc')]);router[_0x7751('0x8')](_0x7751('0xd'),auth[_0x7751('0x9')](),controller['show']);router[_0x7751('0x8')](_0x7751('0xe'),auth[_0x7751('0x9')](),controller[_0x7751('0xf')]);router[_0x7751('0x8')](_0x7751('0x10'),auth[_0x7751('0x9')](),controller[_0x7751('0x11')]);router['get'](_0x7751('0x12'),auth[_0x7751('0x9')](),controller[_0x7751('0x13')]);router[_0x7751('0x14')]('/',auth['isAuthenticated'](),controller[_0x7751('0x15')]);router[_0x7751('0x14')](_0x7751('0x10'),auth['isAuthenticated'](),controller[_0x7751('0x16')]);router['post'](_0x7751('0x12'),auth[_0x7751('0x9')](),controller['addAgents']);router[_0x7751('0x17')](_0x7751('0xd'),auth[_0x7751('0x9')](),controller[_0x7751('0x18')]);router['delete'](_0x7751('0xd'),auth[_0x7751('0x9')](),controller[_0x7751('0x19')]);router[_0x7751('0x1a')](_0x7751('0x10'),auth[_0x7751('0x9')](),controller[_0x7751('0x1b')]);router[_0x7751('0x1a')](_0x7751('0x12'),auth['isAuthenticated'](),controller[_0x7751('0x1c')]);module[_0x7751('0x1d')]=router; \ No newline at end of file +var _0x0342=['show','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x16b2cc,_0x2d4832){var _0x3b9381=function(_0x2b1f71){while(--_0x2b1f71){_0x16b2cc['push'](_0x16b2cc['shift']());}};_0x3b9381(++_0x2d4832);}(_0x0342,0x194));var _0x2034=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0x0342[_0x599c94];return _0x34e215;};'use strict';var multer=require(_0x2034('0x0'));var util=require('util');var path=require(_0x2034('0x1'));var timeout=require(_0x2034('0x2'));var express=require(_0x2034('0x3'));var router=express[_0x2034('0x4')]();var fs_extra=require(_0x2034('0x5'));var auth=require(_0x2034('0x6'));var interaction=require(_0x2034('0x7'));var config=require(_0x2034('0x8'));var controller=require(_0x2034('0x9'));router[_0x2034('0xa')]('/',auth['isAuthenticated'](),controller[_0x2034('0xb')]);router[_0x2034('0xa')](_0x2034('0xc'),auth[_0x2034('0xd')](),controller[_0x2034('0xe')]);router[_0x2034('0xa')](_0x2034('0xf'),auth['isAuthenticated'](),controller[_0x2034('0x10')]);router['get']('/:id/members',auth[_0x2034('0xd')](),controller[_0x2034('0x11')]);router[_0x2034('0xa')](_0x2034('0x12'),auth['isAuthenticated'](),controller[_0x2034('0x13')]);router[_0x2034('0xa')](_0x2034('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2034('0x15')]('/:id/teams',auth[_0x2034('0xd')](),controller[_0x2034('0x16')]);router[_0x2034('0x15')](_0x2034('0x14'),auth[_0x2034('0xd')](),controller[_0x2034('0x17')]);router[_0x2034('0x18')](_0x2034('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x2034('0x19')](_0x2034('0xf'),auth[_0x2034('0xd')](),controller['destroy']);router[_0x2034('0x19')](_0x2034('0x12'),auth[_0x2034('0xd')](),controller[_0x2034('0x1a')]);router[_0x2034('0x19')](_0x2034('0x14'),auth[_0x2034('0xd')](),controller['removeAgents']);module[_0x2034('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 853158b..43f1750 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 _0x2390=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports'];(function(_0x4c9c46,_0x55cfd8){var _0xb9b7c7=function(_0x310339){while(--_0x310339){_0x4c9c46['push'](_0x4c9c46['shift']());}};_0xb9b7c7(++_0x55cfd8);}(_0x2390,0x1ef));var _0x0239=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2390[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x0239('0x0'));module[_0x0239('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0239('0x2')]},'timeout':{'type':Sequelize[_0x0239('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0239('0x4')](_0x0239('0x5'),'beepall',_0x0239('0x6'))}}; \ No newline at end of file +var _0xe731=['rrmemory','beepall','exports','STRING','ENUM'];(function(_0x164a40,_0xb704f7){var _0x2a551a=function(_0x8c0588){while(--_0x8c0588){_0x164a40['push'](_0x164a40['shift']());}};_0x2a551a(++_0xb704f7);}(_0xe731,0x10b));var _0x1e73=function(_0x235585,_0x287831){_0x235585=_0x235585-0x0;var _0x6a0d87=_0xe731[_0x235585];return _0x6a0d87;};'use strict';var Sequelize=require('sequelize');module[_0x1e73('0x0')]={'name':{'type':Sequelize[_0x1e73('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1e73('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1e73('0x2')](_0x1e73('0x3'),_0x1e73('0x4'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 9bb47f3..7e2a53a 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 _0xa45a=['addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','MailQueues','UserProfileResource','then','error','name','send','index','map','MailQueue','rawAttributes','fieldName','getOptions','include','query','findAll','rows','show','params','keys','filters','intersection','model','attributes','fields','length','includeAll','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','MailQueueId','where','filter','options','UserMailQueue','User','findAndCountAll','UserId','agent','updatedAt','format','%s/%s','SIP','getTeams','Team','pick','Agents','online','voicePause','interface','sequelize','addTeams','each','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove'];(function(_0x19c5f5,_0x263f1b){var _0x51684c=function(_0x4d0c4b){while(--_0x4d0c4b){_0x19c5f5['push'](_0x19c5f5['shift']());}};_0x51684c(++_0x263f1b);}(_0xa45a,0xf9));var _0xaa45=function(_0x18b277,_0x32a29a){_0x18b277=_0x18b277-0x0;var _0x9b0005=_0xa45a[_0x18b277];return _0x9b0005;};'use strict';var BPromise=require(_0xaa45('0x0'));var util=require(_0xaa45('0x1'));var _=require(_0xaa45('0x2'));var squel=require('squel');var Redis=require(_0xaa45('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xaa45('0x4'));var config=require(_0xaa45('0x5'));var db=require(_0xaa45('0x6'))['db'];config['redis']=_[_0xaa45('0x7')](config['redis'],{'host':_0xaa45('0x8'),'port':0x18eb});var socket=require(_0xaa45('0x9'))(new Redis(config[_0xaa45('0xa')]));require('./mailQueue.socket')[_0xaa45('0xb')](socket);function respondWithStatusCode(_0x4bebdb,_0x23183c){_0x23183c=_0x23183c||0xcc;return function(_0x5af838){if(_0x5af838){return _0x4bebdb[_0xaa45('0xc')](_0x23183c);}return _0x4bebdb[_0xaa45('0xd')](_0x23183c)[_0xaa45('0xe')]();};}function respondWithResult(_0x47b8f6,_0x345e78){_0x345e78=_0x345e78||0xc8;return function(_0x27dcef){if(_0x27dcef){return _0x47b8f6[_0xaa45('0xd')](_0x345e78)[_0xaa45('0xf')](_0x27dcef);}};}function respondWithFilteredResult(_0x1af4fb,_0x15ffa4){return function(_0x6d9123){if(_0x6d9123){var _0x452f9d=typeof _0x15ffa4[_0xaa45('0x10')]===_0xaa45('0x11')&&typeof _0x15ffa4[_0xaa45('0x12')]===_0xaa45('0x11');var _0x366c01=_0x6d9123[_0xaa45('0x13')];var _0x2b6121=_0x452f9d?0x0:_0x15ffa4[_0xaa45('0x10')];var _0x5837ae=_0x452f9d?_0x6d9123[_0xaa45('0x13')]:_0x15ffa4['offset']+_0x15ffa4[_0xaa45('0x12')];var _0x375c7c;if(_0x5837ae>=_0x366c01){_0x5837ae=_0x366c01;_0x375c7c=0xc8;}else{_0x375c7c=0xce;}_0x1af4fb[_0xaa45('0xd')](_0x375c7c);return _0x1af4fb[_0xaa45('0x14')](_0xaa45('0x15'),_0x2b6121+'-'+_0x5837ae+'/'+_0x366c01)[_0xaa45('0xf')](_0x6d9123);}return null;};}function saveUpdates(_0x476dca){return function(_0x386afe){if(_0x386afe){return _0x386afe[_0xaa45('0x16')](_0x476dca)['then'](function(_0x367562){return _0x367562;});}return null;};}function removeEntity(_0x2f6018){return function(_0x36bafc){if(_0x36bafc){return _0x36bafc['destroy']()['then'](function(){var _0x2fe772=_0x36bafc['get']({'plain':!![]});var _0x5be6ee=_0xaa45('0x17');return db[_0xaa45('0x18')]['destroy']({'where':{'type':_0x5be6ee,'resourceId':_0x2fe772['id']}})[_0xaa45('0x19')](function(){return _0x36bafc;});})[_0xaa45('0x19')](function(){_0x2f6018[_0xaa45('0xd')](0xcc)[_0xaa45('0xe')]();});}};}function handleEntityNotFound(_0x4f2ab9){return function(_0x2a92be){if(!_0x2a92be){_0x4f2ab9['sendStatus'](0x194);}return _0x2a92be;};}function handleError(_0x4a41db,_0x5511ad){_0x5511ad=_0x5511ad||0x1f4;return function(_0x2decda){logger[_0xaa45('0x1a')](_0x2decda['stack']);if(_0x2decda[_0xaa45('0x1b')]){delete _0x2decda[_0xaa45('0x1b')];}_0x4a41db[_0xaa45('0xd')](_0x5511ad)[_0xaa45('0x1c')](_0x2decda);};}exports[_0xaa45('0x1d')]=function(_0x309a95,_0x2edd7f){var _0x5259dd={};var _0x50a83d={'count':0x0,'rows':[]};var _0x348c52=_[_0xaa45('0x1e')](db[_0xaa45('0x1f')][_0xaa45('0x20')],function(_0x14ea39){return{'name':_0x14ea39[_0xaa45('0x21')],'type':_0x14ea39['type']['key']};});_0x5259dd=qs[_0xaa45('0x22')](_0x348c52,_0x309a95);var _0x15a981={'where':_0x5259dd['where']};return db[_0xaa45('0x1f')][_0xaa45('0x13')](_0x15a981)['then'](function(_0x5d7e9c){_0x50a83d[_0xaa45('0x13')]=_0x5d7e9c;_0x5259dd[_0xaa45('0x23')]=qs[_0xaa45('0x23')](_0x309a95[_0xaa45('0x24')]);return db[_0xaa45('0x1f')][_0xaa45('0x25')](_0x5259dd);})[_0xaa45('0x19')](function(_0x3f1739){_0x50a83d[_0xaa45('0x26')]=_0x3f1739;return _0x50a83d;})[_0xaa45('0x19')](respondWithFilteredResult(_0x2edd7f,_0x5259dd))['catch'](handleError(_0x2edd7f,null));};exports[_0xaa45('0x27')]=function(_0x47e39c,_0x230d98){var _0x56fa3e={'raw':!![],'where':{'id':_0x47e39c[_0xaa45('0x28')]['id']}},_0x2dc86a={};_0x2dc86a['model']=_[_0xaa45('0x29')](db[_0xaa45('0x1f')]['rawAttributes']);_0x2dc86a[_0xaa45('0x24')]=_[_0xaa45('0x29')](_0x47e39c[_0xaa45('0x24')]);_0x2dc86a[_0xaa45('0x2a')]=_[_0xaa45('0x2b')](_0x2dc86a[_0xaa45('0x2c')],_0x2dc86a[_0xaa45('0x24')]);_0x56fa3e[_0xaa45('0x2d')]=_['intersection'](_0x2dc86a[_0xaa45('0x2c')],qs[_0xaa45('0x2e')](_0x47e39c[_0xaa45('0x24')][_0xaa45('0x2e')]));_0x56fa3e['attributes']=_0x56fa3e[_0xaa45('0x2d')][_0xaa45('0x2f')]?_0x56fa3e[_0xaa45('0x2d')]:_0x2dc86a['model'];if(_0x47e39c[_0xaa45('0x24')][_0xaa45('0x30')]){_0x56fa3e[_0xaa45('0x23')]=[{'all':!![]}];}_0x56fa3e=_[_0xaa45('0x31')]({},_0x56fa3e,_0x47e39c['options']);return db[_0xaa45('0x1f')][_0xaa45('0x32')](_0x56fa3e)[_0xaa45('0x19')](handleEntityNotFound(_0x230d98,null))[_0xaa45('0x19')](respondWithResult(_0x230d98,null))[_0xaa45('0x33')](handleError(_0x230d98,null));};exports['create']=function(_0x27d3f0,_0x199e1a){return db[_0xaa45('0x1f')][_0xaa45('0x34')](_0x27d3f0[_0xaa45('0x35')],{})[_0xaa45('0x19')](function(_0x8de75e){var _0x5e2372=_0x27d3f0[_0xaa45('0x36')][_0xaa45('0x37')]({'plain':!![]});if(!_0x5e2372)throw new Error(_0xaa45('0x38'));if(_0x5e2372[_0xaa45('0x39')]==='user'){var _0xd67c9c=_0x8de75e[_0xaa45('0x37')]({'plain':!![]});var _0x3f3ca0=_0xaa45('0x17');return db['UserProfileSection'][_0xaa45('0x32')]({'where':{'name':_0x3f3ca0,'userProfileId':_0x5e2372[_0xaa45('0x3a')]},'raw':!![]})[_0xaa45('0x19')](function(_0x4a68da){if(_0x4a68da&&_0x4a68da[_0xaa45('0x3b')]===0x0){return db[_0xaa45('0x18')][_0xaa45('0x34')]({'name':_0xd67c9c[_0xaa45('0x1b')],'resourceId':_0xd67c9c['id'],'type':_0x4a68da[_0xaa45('0x1b')],'sectionId':_0x4a68da['id']},{})[_0xaa45('0x19')](function(){return _0x8de75e;});}else{return _0x8de75e;}})[_0xaa45('0x33')](function(_0x116940){logger[_0xaa45('0x1a')](_0xaa45('0x3c'),_0x116940);throw _0x116940;});}return _0x8de75e;})['then'](respondWithResult(_0x199e1a,0xc9))['catch'](handleError(_0x199e1a,null));};exports[_0xaa45('0x16')]=function(_0x802ab7,_0x1d26f5){if(_0x802ab7[_0xaa45('0x35')]['id']){delete _0x802ab7[_0xaa45('0x35')]['id'];}return db[_0xaa45('0x1f')]['find']({'where':{'id':_0x802ab7['params']['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x1d26f5,null))['then'](saveUpdates(_0x802ab7[_0xaa45('0x35')],null))[_0xaa45('0x19')](respondWithResult(_0x1d26f5,null))['catch'](handleError(_0x1d26f5,null));};exports[_0xaa45('0x3d')]=function(_0x413efd,_0x313135){return db[_0xaa45('0x1f')][_0xaa45('0x32')]({'where':{'id':_0x413efd[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x313135,null))['then'](removeEntity(_0x313135,null))[_0xaa45('0x33')](handleError(_0x313135,null));};exports['describe']=function(_0x2bebf1,_0x59d6a3){return db['MailQueue'][_0xaa45('0x3e')]()[_0xaa45('0x19')](respondWithResult(_0x59d6a3,null))[_0xaa45('0x33')](handleError(_0x59d6a3,null));};exports[_0xaa45('0x3f')]=function(_0x54531d,_0x4eb179){var _0x516026={'raw':!![],'where':{}},_0x7ddc96={},_0x3e9277;return db['MailQueue'][_0xaa45('0x40')]({'where':{'id':_0x54531d[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x4eb179,null))[_0xaa45('0x19')](function(_0x152aec){if(_0x152aec){_0x3e9277=_0x152aec[_0xaa45('0x37')]({'plain':!![]});_0x7ddc96[_0xaa45('0x2c')]=_[_0xaa45('0x29')](db['UserMailQueue']['rawAttributes']);_0x7ddc96['query']=_[_0xaa45('0x29')](_0x54531d[_0xaa45('0x24')]);_0x7ddc96[_0xaa45('0x2a')]=_[_0xaa45('0x2b')](_0x7ddc96[_0xaa45('0x2c')],_0x7ddc96[_0xaa45('0x24')]);_0x516026['attributes']=_[_0xaa45('0x2b')](_0x7ddc96[_0xaa45('0x2c')],qs[_0xaa45('0x2e')](_0x54531d[_0xaa45('0x24')]['fields']));_0x516026[_0xaa45('0x2d')]=_0x516026[_0xaa45('0x2d')][_0xaa45('0x2f')]?_0x516026[_0xaa45('0x2d')]:_0x7ddc96[_0xaa45('0x2c')];if(!_0x54531d[_0xaa45('0x24')][_0xaa45('0x41')](_0xaa45('0x42'))){_0x516026[_0xaa45('0x12')]=qs[_0xaa45('0x12')](_0x54531d[_0xaa45('0x24')]['limit']);_0x516026['offset']=qs[_0xaa45('0x10')](_0x54531d[_0xaa45('0x24')][_0xaa45('0x10')]);}_0x516026[_0xaa45('0x43')]=qs[_0xaa45('0x44')](_0x54531d[_0xaa45('0x24')][_0xaa45('0x44')]);_0x516026['where']=qs[_0xaa45('0x2a')](_['pick'](_0x54531d[_0xaa45('0x24')],_0x7ddc96[_0xaa45('0x2a')]));_0x516026['where'][_0xaa45('0x45')]=_0x152aec['id'];if(_0x54531d[_0xaa45('0x24')]['filter']){_0x516026['where']=_[_0xaa45('0x31')](_0x516026[_0xaa45('0x46')],{'$or':_[_0xaa45('0x1e')](_0x516026[_0xaa45('0x2d')],function(_0x106791){var _0x2e5a01={};_0x2e5a01[_0x106791]={'$like':'%'+_0x54531d[_0xaa45('0x24')][_0xaa45('0x47')]+'%'};return _0x2e5a01;})});}_0x516026=_[_0xaa45('0x31')]({},_0x516026,_0x54531d[_0xaa45('0x48')]);return db[_0xaa45('0x49')][_0xaa45('0x25')](_0x516026);}})[_0xaa45('0x19')](function(_0x429887){if(_0x429887){return db[_0xaa45('0x4a')][_0xaa45('0x4b')]({'where':{'id':_[_0xaa45('0x1e')](_0x429887,_0xaa45('0x4c')),'role':_0xaa45('0x4d')},'attributes':['id',_0xaa45('0x1b'),'mailPause',_0xaa45('0x4e'),'createdAt']});}})[_0xaa45('0x19')](function(_0x1b7373){if(_0x1b7373){return{'count':_0x1b7373[_0xaa45('0x13')],'rows':_[_0xaa45('0x1e')](_0x1b7373[_0xaa45('0x26')],function(_0x30c0a2){return{'membername':_0x30c0a2[_0xaa45('0x1b')],'UserId':_0x30c0a2['id'],'queue_name':_0x3e9277[_0xaa45('0x1b')],'MailQueueId':_0x3e9277['id'],'interface':util[_0xaa45('0x4f')](_0xaa45('0x50'),_0xaa45('0x51'),_0x30c0a2[_0xaa45('0x1b')]),'penalty':0x0,'paused':_0x30c0a2['mailPause'],'createdAt':_0x30c0a2['createdAt'],'updatedAt':_0x30c0a2['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4eb179,_0x516026))[_0xaa45('0x33')](handleError(_0x4eb179,null));};exports[_0xaa45('0x52')]=function(_0x1cb8c3,_0xb2ef9b){var _0x4065ad={};var _0x19317={};var _0x1f875b;var _0x54451e;return db['MailQueue'][_0xaa45('0x40')]({'where':{'id':_0x1cb8c3[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0xb2ef9b,null))['then'](function(_0x4200d0){if(_0x4200d0){_0x1f875b=_0x4200d0;_0x19317[_0xaa45('0x2c')]=_[_0xaa45('0x29')](db[_0xaa45('0x53')][_0xaa45('0x20')]);_0x19317['query']=_[_0xaa45('0x29')](_0x1cb8c3[_0xaa45('0x24')]);_0x19317[_0xaa45('0x2a')]=_['intersection'](_0x19317[_0xaa45('0x2c')],_0x19317[_0xaa45('0x24')]);_0x4065ad[_0xaa45('0x2d')]=_[_0xaa45('0x2b')](_0x19317[_0xaa45('0x2c')],qs[_0xaa45('0x2e')](_0x1cb8c3['query'][_0xaa45('0x2e')]));_0x4065ad[_0xaa45('0x2d')]=_0x4065ad[_0xaa45('0x2d')][_0xaa45('0x2f')]?_0x4065ad['attributes']:_0x19317['model'];_0x4065ad[_0xaa45('0x43')]=qs[_0xaa45('0x44')](_0x1cb8c3[_0xaa45('0x24')][_0xaa45('0x44')]);_0x4065ad['where']=qs[_0xaa45('0x2a')](_[_0xaa45('0x54')](_0x1cb8c3['query'],_0x19317[_0xaa45('0x2a')]));if(_0x1cb8c3['query'][_0xaa45('0x47')]){_0x4065ad['where']=_[_0xaa45('0x31')](_0x4065ad[_0xaa45('0x46')],{'$or':_[_0xaa45('0x1e')](_0x4065ad[_0xaa45('0x2d')],function(_0xe94413){var _0x3fdf8f={};_0x3fdf8f[_0xe94413]={'$like':'%'+_0x1cb8c3['query']['filter']+'%'};return _0x3fdf8f;})});}_0x4065ad=_[_0xaa45('0x31')]({},_0x4065ad,_0x1cb8c3[_0xaa45('0x48')]);return _0x1f875b['getTeams'](_0x4065ad);}})['then'](function(_0x31e6d6){if(_0x31e6d6){_0x54451e=_0x31e6d6[_0xaa45('0x2f')];if(!_0x1cb8c3[_0xaa45('0x24')][_0xaa45('0x41')](_0xaa45('0x42'))){_0x4065ad[_0xaa45('0x12')]=qs[_0xaa45('0x12')](_0x1cb8c3['query'][_0xaa45('0x12')]);_0x4065ad[_0xaa45('0x10')]=qs[_0xaa45('0x10')](_0x1cb8c3[_0xaa45('0x24')][_0xaa45('0x10')]);}return _0x1f875b[_0xaa45('0x52')](_0x4065ad);}})[_0xaa45('0x19')](function(_0x24f036){if(_0x24f036){return _0x24f036?{'count':_0x54451e,'rows':_0x24f036}:null;}})[_0xaa45('0x19')](respondWithResult(_0xb2ef9b,null))[_0xaa45('0x33')](handleError(_0xb2ef9b,null));};exports['addTeams']=function(_0xe53a20,_0x9fdb4b){var _0x1818ee=_0xe53a20[_0xaa45('0x35')]['ids'];return db[_0xaa45('0x53')][_0xaa45('0x25')]({'where':{'id':_0x1818ee},'attributes':['id'],'include':[{'model':db[_0xaa45('0x4a')],'as':_0xaa45('0x55'),'attributes':['id',_0xaa45('0x1b'),_0xaa45('0x56'),_0xaa45('0x57'),_0xaa45('0x58')],'raw':!![]}]})['then'](function(_0x4dcfb4){if(_0x4dcfb4){var _0x3f8ff8=_['flatMap'](_0x4dcfb4,function(_0x259f07){var _0x2aca67=_0x259f07['get']({'plain':!![]});return _0x2aca67[_0xaa45('0x55')];});return db[_0xaa45('0x1f')][_0xaa45('0x32')]({'where':{'id':_0xe53a20[_0xaa45('0x28')]['id']}})['then'](function(_0x1fd784){return db[_0xaa45('0x59')]['transaction'](function(_0x5c4c2c){return _0x1fd784[_0xaa45('0x5a')](_0x1818ee,{'transaction':_0x5c4c2c})[_0xaa45('0x19')](function(){return BPromise[_0xaa45('0x5b')](_0x3f8ff8,function(_0x2f3e0){return db['UserMailQueue']['findOrCreate']({'where':{'UserId':_0x2f3e0['id'],'MailQueueId':_0xe53a20['params']['id']},'transaction':_0x5c4c2c});});})[_0xaa45('0x19')](function(){_0x3f8ff8['forEach'](function(_0x304bb4){socket[_0xaa45('0x5c')](_0xaa45('0x5d'),{'UserId':_0x304bb4['id'],'MailQueueId':_0x1fd784['id']});});});});});}})[_0xaa45('0x19')](respondWithStatusCode(_0x9fdb4b,null))[_0xaa45('0x33')](handleError(_0x9fdb4b,null));};exports[_0xaa45('0x5e')]=function(_0x4bdece,_0x1e3536){return db[_0xaa45('0x53')][_0xaa45('0x25')]({'where':{'id':_0x4bdece[_0xaa45('0x24')][_0xaa45('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xaa45('0x55'),'attributes':['id'],'raw':!![]}]})[_0xaa45('0x19')](handleEntityNotFound(_0x1e3536,null))[_0xaa45('0x19')](function(_0x2a273c){var _0x156d52=_[_0xaa45('0x1e')](_0x2a273c,'id');var _0x4fbc45=[];var _0x5c92ad=[];var _0x393d08=squel[_0xaa45('0x60')]();_0x393d08[_0xaa45('0x61')](_0xaa45('0x62'))['from'](_0xaa45('0x63'),'tq')[_0xaa45('0x64')](_0xaa45('0x65'),'ut',_0xaa45('0x66'))['where'](_0xaa45('0x67'),_0x4bdece[_0xaa45('0x28')]['id']);for(var _0x478608=0x0;_0x478608<_0x2a273c[_0xaa45('0x2f')];_0x478608+=0x1){let _0x5a8807=_0x2a273c[_0x478608];for(var _0x2fe0f5=0x0;_0x2fe0f5<_0x5a8807['Agents'][_0xaa45('0x2f')];_0x2fe0f5+=0x1){let _0x4bb3ce=_0x5a8807[_0xaa45('0x55')][_0x2fe0f5];var _0x539acc=_0x393d08['clone']();_0x539acc[_0xaa45('0x46')]('ut.UserId\x20=\x20?',_0x4bb3ce['id']);_0x5c92ad[_0xaa45('0x68')](db[_0xaa45('0x59')][_0xaa45('0x24')](_0x539acc[_0xaa45('0x69')](),{'type':db[_0xaa45('0x59')][_0xaa45('0x6a')][_0xaa45('0x6b')]})[_0xaa45('0x19')](function(_0x325adb){if(_0x325adb['length']===0x1){return _0x4bb3ce['id'];}else{var _0x4223a6=_[_0xaa45('0x6c')](_[_0xaa45('0x1e')](_0x325adb,_0xaa45('0x6d')),function(_0x503832){return _[_0xaa45('0x6e')](_0x156d52,_0x503832);});if(_0x4223a6){return _0x4bb3ce['id'];}}}));}}return BPromise['all'](_0x5c92ad)[_0xaa45('0x19')](function(_0x42482b){_0x4fbc45=_(_0x4fbc45)[_0xaa45('0x6f')](_0x42482b)[_0xaa45('0x70')]()[_0xaa45('0x71')]();return db[_0xaa45('0x1f')][_0xaa45('0x32')]({'where':{'id':_0x4bdece[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](function(_0xe03939){return db['sequelize']['transaction'](function(_0x32b458){return _0xe03939['removeTeams'](_0x4bdece[_0xaa45('0x24')]['ids'],{'transaction':_0x32b458})[_0xaa45('0x19')](function(){if(!_[_0xaa45('0x72')](_0x4fbc45)){return _0xe03939[_0xaa45('0x73')](_0x4fbc45,{'transaction':_0x32b458});}})[_0xaa45('0x19')](function(){_0x4fbc45['forEach'](function(_0x55c8db){socket['emit'](_0xaa45('0x74'),{'UserId':_0x55c8db,'MailQueueId':_0xe03939['id']});});});});});});})[_0xaa45('0x19')](respondWithStatusCode(_0x1e3536,null))['catch'](handleError(_0x1e3536,null));};exports[_0xaa45('0x75')]=function(_0x2dbe13,_0x59b460){return db['MailQueue']['find']({'where':{'id':_0x2dbe13[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x59b460,null))[_0xaa45('0x19')](function(_0x75d9d8){if(_0x75d9d8){return _0x75d9d8[_0xaa45('0x75')](_0x2dbe13[_0xaa45('0x35')][_0xaa45('0x5f')],_[_0xaa45('0x76')](_0x2dbe13[_0xaa45('0x35')],['ids','id'])||{})[_0xaa45('0x77')](function(_0x54cef7){for(var _0x3ed249=0x0;_0x3ed249<_0x2dbe13[_0xaa45('0x35')]['ids'][_0xaa45('0x2f')];_0x3ed249+=0x1){socket[_0xaa45('0x5c')](_0xaa45('0x5d'),{'UserId':Number(_0x2dbe13[_0xaa45('0x35')][_0xaa45('0x5f')][_0x3ed249]),'MailQueueId':Number(_0x2dbe13[_0xaa45('0x28')]['id'])});}return _0x54cef7;});}})[_0xaa45('0x19')](respondWithResult(_0x59b460,null))[_0xaa45('0x33')](handleError(_0x59b460,null));};exports[_0xaa45('0x73')]=function(_0x51c5f5,_0x1d4fcf){return db['MailQueue']['find']({'where':{'id':_0x51c5f5[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x1d4fcf,null))[_0xaa45('0x19')](function(_0x398b13){if(_0x398b13){return _0x398b13['removeAgents'](_0x51c5f5[_0xaa45('0x24')][_0xaa45('0x5f')])[_0xaa45('0x19')](function(){if(_[_0xaa45('0x78')](_0x51c5f5[_0xaa45('0x24')][_0xaa45('0x5f')])){for(var _0x103b31=0x0;_0x103b31<_0x51c5f5[_0xaa45('0x24')][_0xaa45('0x5f')][_0xaa45('0x2f')];_0x103b31+=0x1){socket[_0xaa45('0x5c')]('userMailQueue:remove',{'UserId':Number(_0x51c5f5[_0xaa45('0x24')][_0xaa45('0x5f')][_0x103b31]),'MailQueueId':Number(_0x51c5f5['params']['id'])});}}else{socket[_0xaa45('0x5c')]('userMailQueue:remove',{'UserId':Number(_0x51c5f5[_0xaa45('0x24')]['ids']),'MailQueueId':Number(_0x51c5f5[_0xaa45('0x28')]['id'])});}});}})[_0xaa45('0x19')](respondWithStatusCode(_0x1d4fcf,null))[_0xaa45('0x33')](handleError(_0x1d4fcf,null));};exports[_0xaa45('0x79')]=function(_0x46b1fd,_0x175368){var _0x301822={};var _0x5ae097={};var _0x3cda53;var _0x2eb1d6;return db[_0xaa45('0x1f')]['findOne']({'where':{'id':_0x46b1fd[_0xaa45('0x28')]['id']}})[_0xaa45('0x19')](handleEntityNotFound(_0x175368,null))['then'](function(_0x1ce04b){if(_0x1ce04b){_0x3cda53=_0x1ce04b;_0x5ae097[_0xaa45('0x2c')]=_[_0xaa45('0x29')](db[_0xaa45('0x4a')][_0xaa45('0x20')]);_0x5ae097[_0xaa45('0x24')]=_[_0xaa45('0x29')](_0x46b1fd[_0xaa45('0x24')]);_0x5ae097[_0xaa45('0x2a')]=_[_0xaa45('0x2b')](_0x5ae097['model'],_0x5ae097[_0xaa45('0x24')]);_0x301822[_0xaa45('0x2d')]=_['intersection'](_0x5ae097[_0xaa45('0x2c')],qs[_0xaa45('0x2e')](_0x46b1fd[_0xaa45('0x24')][_0xaa45('0x2e')]));_0x301822[_0xaa45('0x2d')]=_0x301822[_0xaa45('0x2d')][_0xaa45('0x2f')]?_0x301822[_0xaa45('0x2d')]:_0x5ae097['model'];_0x301822[_0xaa45('0x43')]=qs[_0xaa45('0x44')](_0x46b1fd[_0xaa45('0x24')][_0xaa45('0x44')]);_0x301822['where']=qs['filters'](_['pick'](_0x46b1fd[_0xaa45('0x24')],_0x5ae097['filters']));if(_0x46b1fd[_0xaa45('0x24')][_0xaa45('0x47')]){_0x301822[_0xaa45('0x46')]=_[_0xaa45('0x31')](_0x301822[_0xaa45('0x46')],{'$or':_[_0xaa45('0x1e')](_0x301822[_0xaa45('0x2d')],function(_0x268aff){var _0x1ae49c={};_0x1ae49c[_0x268aff]={'$like':'%'+_0x46b1fd[_0xaa45('0x24')]['filter']+'%'};return _0x1ae49c;})});}_0x301822=_[_0xaa45('0x31')]({},_0x301822,_0x46b1fd[_0xaa45('0x48')]);return _0x3cda53[_0xaa45('0x79')](_0x301822);}})['then'](function(_0x34faae){if(_0x34faae){_0x2eb1d6=_0x34faae['length'];if(!_0x46b1fd[_0xaa45('0x24')]['hasOwnProperty'](_0xaa45('0x42'))){_0x301822[_0xaa45('0x12')]=qs[_0xaa45('0x12')](_0x46b1fd['query'][_0xaa45('0x12')]);_0x301822[_0xaa45('0x10')]=qs['offset'](_0x46b1fd[_0xaa45('0x24')][_0xaa45('0x10')]);}return _0x3cda53[_0xaa45('0x79')](_0x301822);}})['then'](function(_0xe62d63){if(_0xe62d63){return _0xe62d63?{'count':_0x2eb1d6,'rows':_0xe62d63}:null;}})[_0xaa45('0x19')](respondWithResult(_0x175368,null))[_0xaa45('0x33')](handleError(_0x175368,null));}; \ No newline at end of file +var _0x5ee6=['flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','select','field','tq.TeamId','from','join','user_has_teams','MailQueueId\x20=\x20?','Agents','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','removeTeams','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','isArray','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','end','status','undefined','count','offset','limit','set','Content-Range','json','update','then','destroy','get','MailQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','model','keys','filters','intersection','fields','attributes','length','includeAll','merge','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','params','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort','MailQueueId','filter','UserMailQueue','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','Team','pick','addTeams','ids','voicePause'];(function(_0x1f65e2,_0x5b370a){var _0x553275=function(_0x422c2e){while(--_0x422c2e){_0x1f65e2['push'](_0x1f65e2['shift']());}};_0x553275(++_0x5b370a);}(_0x5ee6,0x18c));var _0x65ee=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5ee6[_0x1d1779];return _0x2377e9;};'use strict';var BPromise=require('bluebird');var util=require(_0x65ee('0x0'));var _=require(_0x65ee('0x1'));var squel=require(_0x65ee('0x2'));var Redis=require(_0x65ee('0x3'));var qs=require(_0x65ee('0x4'));var logger=require('../../config/logger')(_0x65ee('0x5'));var config=require(_0x65ee('0x6'));var db=require('../../mysqldb')['db'];config[_0x65ee('0x7')]=_[_0x65ee('0x8')](config[_0x65ee('0x7')],{'host':_0x65ee('0x9'),'port':0x18eb});var socket=require(_0x65ee('0xa'))(new Redis(config['redis']));require('./mailQueue.socket')[_0x65ee('0xb')](socket);function respondWithStatusCode(_0x1923aa,_0x1239ed){_0x1239ed=_0x1239ed||0xcc;return function(_0x3ad075){if(_0x3ad075){return _0x1923aa['sendStatus'](_0x1239ed);}return _0x1923aa['status'](_0x1239ed)[_0x65ee('0xc')]();};}function respondWithResult(_0x190632,_0x3f55ac){_0x3f55ac=_0x3f55ac||0xc8;return function(_0x589241){if(_0x589241){return _0x190632[_0x65ee('0xd')](_0x3f55ac)['json'](_0x589241);}};}function respondWithFilteredResult(_0xebd612,_0x2897cb){return function(_0x4b9f09){if(_0x4b9f09){var _0x3f3a6b=typeof _0x2897cb['offset']==='undefined'&&typeof _0x2897cb['limit']===_0x65ee('0xe');var _0x21ea96=_0x4b9f09[_0x65ee('0xf')];var _0x272b57=_0x3f3a6b?0x0:_0x2897cb['offset'];var _0x4aeb70=_0x3f3a6b?_0x4b9f09['count']:_0x2897cb[_0x65ee('0x10')]+_0x2897cb[_0x65ee('0x11')];var _0x23a3c6;if(_0x4aeb70>=_0x21ea96){_0x4aeb70=_0x21ea96;_0x23a3c6=0xc8;}else{_0x23a3c6=0xce;}_0xebd612[_0x65ee('0xd')](_0x23a3c6);return _0xebd612[_0x65ee('0x12')](_0x65ee('0x13'),_0x272b57+'-'+_0x4aeb70+'/'+_0x21ea96)[_0x65ee('0x14')](_0x4b9f09);}return null;};}function saveUpdates(_0x1f17dd){return function(_0x315082){if(_0x315082){return _0x315082[_0x65ee('0x15')](_0x1f17dd)[_0x65ee('0x16')](function(_0x33343d){return _0x33343d;});}return null;};}function removeEntity(_0x4f04d9){return function(_0x5aca89){if(_0x5aca89){return _0x5aca89[_0x65ee('0x17')]()[_0x65ee('0x16')](function(){var _0x41500c=_0x5aca89[_0x65ee('0x18')]({'plain':!![]});var _0x3a8c2a=_0x65ee('0x19');return db[_0x65ee('0x1a')]['destroy']({'where':{'type':_0x3a8c2a,'resourceId':_0x41500c['id']}})[_0x65ee('0x16')](function(){return _0x5aca89;});})[_0x65ee('0x16')](function(){_0x4f04d9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x214553){return function(_0x462bd3){if(!_0x462bd3){_0x214553[_0x65ee('0x1b')](0x194);}return _0x462bd3;};}function handleError(_0x5f19cd,_0x6dc3f7){_0x6dc3f7=_0x6dc3f7||0x1f4;return function(_0x5f1f6c){logger[_0x65ee('0x1c')](_0x5f1f6c[_0x65ee('0x1d')]);if(_0x5f1f6c[_0x65ee('0x1e')]){delete _0x5f1f6c[_0x65ee('0x1e')];}_0x5f19cd[_0x65ee('0xd')](_0x6dc3f7)[_0x65ee('0x1f')](_0x5f1f6c);};}exports[_0x65ee('0x20')]=function(_0x35c322,_0x1225bd){var _0x166385={};var _0x54aad2={'count':0x0,'rows':[]};var _0x50e91f=_[_0x65ee('0x21')](db[_0x65ee('0x22')][_0x65ee('0x23')],function(_0x465535){return{'name':_0x465535[_0x65ee('0x24')],'type':_0x465535[_0x65ee('0x25')]['key']};});_0x166385=qs[_0x65ee('0x26')](_0x50e91f,_0x35c322);var _0x55507d={'where':_0x166385[_0x65ee('0x27')]};return db[_0x65ee('0x22')][_0x65ee('0xf')](_0x55507d)['then'](function(_0x2d8cd6){_0x54aad2[_0x65ee('0xf')]=_0x2d8cd6;_0x166385[_0x65ee('0x28')]=qs[_0x65ee('0x28')](_0x35c322[_0x65ee('0x29')]);return db[_0x65ee('0x22')][_0x65ee('0x2a')](_0x166385);})['then'](function(_0x3224f5){_0x54aad2[_0x65ee('0x2b')]=_0x3224f5;return _0x54aad2;})['then'](respondWithFilteredResult(_0x1225bd,_0x166385))[_0x65ee('0x2c')](handleError(_0x1225bd,null));};exports['show']=function(_0x296c3e,_0x130cb5){var _0x32b2fe={'raw':!![],'where':{'id':_0x296c3e['params']['id']}},_0x46324a={};_0x46324a[_0x65ee('0x2d')]=_[_0x65ee('0x2e')](db[_0x65ee('0x22')]['rawAttributes']);_0x46324a[_0x65ee('0x29')]=_['keys'](_0x296c3e[_0x65ee('0x29')]);_0x46324a[_0x65ee('0x2f')]=_['intersection'](_0x46324a[_0x65ee('0x2d')],_0x46324a[_0x65ee('0x29')]);_0x32b2fe['attributes']=_[_0x65ee('0x30')](_0x46324a['model'],qs[_0x65ee('0x31')](_0x296c3e['query'][_0x65ee('0x31')]));_0x32b2fe[_0x65ee('0x32')]=_0x32b2fe[_0x65ee('0x32')][_0x65ee('0x33')]?_0x32b2fe[_0x65ee('0x32')]:_0x46324a[_0x65ee('0x2d')];if(_0x296c3e[_0x65ee('0x29')][_0x65ee('0x34')]){_0x32b2fe[_0x65ee('0x28')]=[{'all':!![]}];}_0x32b2fe=_[_0x65ee('0x35')]({},_0x32b2fe,_0x296c3e[_0x65ee('0x36')]);return db[_0x65ee('0x22')][_0x65ee('0x37')](_0x32b2fe)[_0x65ee('0x16')](handleEntityNotFound(_0x130cb5,null))['then'](respondWithResult(_0x130cb5,null))['catch'](handleError(_0x130cb5,null));};exports['create']=function(_0xd51d59,_0x125314){return db[_0x65ee('0x22')]['create'](_0xd51d59[_0x65ee('0x38')],{})[_0x65ee('0x16')](function(_0x4ffc9b){var _0x449837=_0xd51d59[_0x65ee('0x39')][_0x65ee('0x18')]({'plain':!![]});if(!_0x449837)throw new Error(_0x65ee('0x3a'));if(_0x449837[_0x65ee('0x3b')]===_0x65ee('0x39')){var _0x1276fd=_0x4ffc9b[_0x65ee('0x18')]({'plain':!![]});var _0x4d536f=_0x65ee('0x19');return db[_0x65ee('0x3c')][_0x65ee('0x37')]({'where':{'name':_0x4d536f,'userProfileId':_0x449837[_0x65ee('0x3d')]},'raw':!![]})[_0x65ee('0x16')](function(_0x1313fc){if(_0x1313fc&&_0x1313fc['autoAssociation']===0x0){return db[_0x65ee('0x1a')][_0x65ee('0x3e')]({'name':_0x1276fd[_0x65ee('0x1e')],'resourceId':_0x1276fd['id'],'type':_0x1313fc['name'],'sectionId':_0x1313fc['id']},{})[_0x65ee('0x16')](function(){return _0x4ffc9b;});}else{return _0x4ffc9b;}})['catch'](function(_0x84eb18){logger['error'](_0x65ee('0x3f'),_0x84eb18);throw _0x84eb18;});}return _0x4ffc9b;})[_0x65ee('0x16')](respondWithResult(_0x125314,0xc9))[_0x65ee('0x2c')](handleError(_0x125314,null));};exports[_0x65ee('0x15')]=function(_0x2e68a1,_0xe0924a){if(_0x2e68a1[_0x65ee('0x38')]['id']){delete _0x2e68a1[_0x65ee('0x38')]['id'];}return db['MailQueue'][_0x65ee('0x37')]({'where':{'id':_0x2e68a1[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0xe0924a,null))['then'](saveUpdates(_0x2e68a1[_0x65ee('0x38')],null))[_0x65ee('0x16')](respondWithResult(_0xe0924a,null))[_0x65ee('0x2c')](handleError(_0xe0924a,null));};exports[_0x65ee('0x17')]=function(_0x479339,_0xa078b6){return db[_0x65ee('0x22')][_0x65ee('0x37')]({'where':{'id':_0x479339['params']['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0xa078b6,null))[_0x65ee('0x16')](removeEntity(_0xa078b6,null))[_0x65ee('0x2c')](handleError(_0xa078b6,null));};exports['describe']=function(_0x1c82ed,_0x496a40){return db[_0x65ee('0x22')][_0x65ee('0x41')]()[_0x65ee('0x16')](respondWithResult(_0x496a40,null))[_0x65ee('0x2c')](handleError(_0x496a40,null));};exports[_0x65ee('0x42')]=function(_0x39adaa,_0x135171){var _0x1b8c40={'raw':!![],'where':{}},_0x4f7b88={},_0x5aa04b;return db[_0x65ee('0x22')][_0x65ee('0x43')]({'where':{'id':_0x39adaa[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0x135171,null))[_0x65ee('0x16')](function(_0x361bc2){if(_0x361bc2){_0x5aa04b=_0x361bc2['get']({'plain':!![]});_0x4f7b88[_0x65ee('0x2d')]=_['keys'](db['UserMailQueue'][_0x65ee('0x23')]);_0x4f7b88[_0x65ee('0x29')]=_[_0x65ee('0x2e')](_0x39adaa['query']);_0x4f7b88[_0x65ee('0x2f')]=_['intersection'](_0x4f7b88[_0x65ee('0x2d')],_0x4f7b88[_0x65ee('0x29')]);_0x1b8c40['attributes']=_[_0x65ee('0x30')](_0x4f7b88[_0x65ee('0x2d')],qs['fields'](_0x39adaa[_0x65ee('0x29')]['fields']));_0x1b8c40[_0x65ee('0x32')]=_0x1b8c40[_0x65ee('0x32')][_0x65ee('0x33')]?_0x1b8c40[_0x65ee('0x32')]:_0x4f7b88[_0x65ee('0x2d')];if(!_0x39adaa[_0x65ee('0x29')][_0x65ee('0x44')](_0x65ee('0x45'))){_0x1b8c40[_0x65ee('0x11')]=qs[_0x65ee('0x11')](_0x39adaa[_0x65ee('0x29')][_0x65ee('0x11')]);_0x1b8c40[_0x65ee('0x10')]=qs[_0x65ee('0x10')](_0x39adaa[_0x65ee('0x29')][_0x65ee('0x10')]);}_0x1b8c40[_0x65ee('0x46')]=qs[_0x65ee('0x47')](_0x39adaa[_0x65ee('0x29')]['sort']);_0x1b8c40[_0x65ee('0x27')]=qs[_0x65ee('0x2f')](_['pick'](_0x39adaa[_0x65ee('0x29')],_0x4f7b88[_0x65ee('0x2f')]));_0x1b8c40[_0x65ee('0x27')][_0x65ee('0x48')]=_0x361bc2['id'];if(_0x39adaa[_0x65ee('0x29')][_0x65ee('0x49')]){_0x1b8c40['where']=_[_0x65ee('0x35')](_0x1b8c40[_0x65ee('0x27')],{'$or':_[_0x65ee('0x21')](_0x1b8c40[_0x65ee('0x32')],function(_0x359d09){var _0x5ae3a6={};_0x5ae3a6[_0x359d09]={'$like':'%'+_0x39adaa['query'][_0x65ee('0x49')]+'%'};return _0x5ae3a6;})});}_0x1b8c40=_['merge']({},_0x1b8c40,_0x39adaa[_0x65ee('0x36')]);return db[_0x65ee('0x4a')][_0x65ee('0x2a')](_0x1b8c40);}})['then'](function(_0x4323e9){if(_0x4323e9){return db[_0x65ee('0x4b')][_0x65ee('0x4c')]({'where':{'id':_['map'](_0x4323e9,'UserId'),'role':_0x65ee('0x4d')},'attributes':['id','name',_0x65ee('0x4e'),_0x65ee('0x4f'),_0x65ee('0x50')]});}})['then'](function(_0x4712ca){if(_0x4712ca){return{'count':_0x4712ca['count'],'rows':_[_0x65ee('0x21')](_0x4712ca['rows'],function(_0x15120f){return{'membername':_0x15120f[_0x65ee('0x1e')],'UserId':_0x15120f['id'],'queue_name':_0x5aa04b[_0x65ee('0x1e')],'MailQueueId':_0x5aa04b['id'],'interface':util['format'](_0x65ee('0x51'),'SIP',_0x15120f[_0x65ee('0x1e')]),'penalty':0x0,'paused':_0x15120f['mailPause'],'createdAt':_0x15120f[_0x65ee('0x50')],'updatedAt':_0x15120f[_0x65ee('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65ee('0x16')](respondWithFilteredResult(_0x135171,_0x1b8c40))[_0x65ee('0x2c')](handleError(_0x135171,null));};exports[_0x65ee('0x52')]=function(_0x290d22,_0x35003f){var _0x43ab08={};var _0x1b0732={};var _0x311535;var _0x463197;return db[_0x65ee('0x22')][_0x65ee('0x43')]({'where':{'id':_0x290d22[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0x35003f,null))[_0x65ee('0x16')](function(_0x2cbebb){if(_0x2cbebb){_0x311535=_0x2cbebb;_0x1b0732['model']=_['keys'](db[_0x65ee('0x53')]['rawAttributes']);_0x1b0732[_0x65ee('0x29')]=_[_0x65ee('0x2e')](_0x290d22[_0x65ee('0x29')]);_0x1b0732[_0x65ee('0x2f')]=_['intersection'](_0x1b0732['model'],_0x1b0732[_0x65ee('0x29')]);_0x43ab08[_0x65ee('0x32')]=_[_0x65ee('0x30')](_0x1b0732['model'],qs[_0x65ee('0x31')](_0x290d22[_0x65ee('0x29')][_0x65ee('0x31')]));_0x43ab08[_0x65ee('0x32')]=_0x43ab08[_0x65ee('0x32')]['length']?_0x43ab08[_0x65ee('0x32')]:_0x1b0732[_0x65ee('0x2d')];_0x43ab08[_0x65ee('0x46')]=qs[_0x65ee('0x47')](_0x290d22[_0x65ee('0x29')][_0x65ee('0x47')]);_0x43ab08['where']=qs['filters'](_[_0x65ee('0x54')](_0x290d22[_0x65ee('0x29')],_0x1b0732['filters']));if(_0x290d22[_0x65ee('0x29')][_0x65ee('0x49')]){_0x43ab08[_0x65ee('0x27')]=_['merge'](_0x43ab08[_0x65ee('0x27')],{'$or':_[_0x65ee('0x21')](_0x43ab08[_0x65ee('0x32')],function(_0x37f466){var _0x51ca46={};_0x51ca46[_0x37f466]={'$like':'%'+_0x290d22[_0x65ee('0x29')][_0x65ee('0x49')]+'%'};return _0x51ca46;})});}_0x43ab08=_[_0x65ee('0x35')]({},_0x43ab08,_0x290d22[_0x65ee('0x36')]);return _0x311535[_0x65ee('0x52')](_0x43ab08);}})[_0x65ee('0x16')](function(_0x29637f){if(_0x29637f){_0x463197=_0x29637f[_0x65ee('0x33')];if(!_0x290d22[_0x65ee('0x29')][_0x65ee('0x44')](_0x65ee('0x45'))){_0x43ab08['limit']=qs[_0x65ee('0x11')](_0x290d22[_0x65ee('0x29')][_0x65ee('0x11')]);_0x43ab08['offset']=qs[_0x65ee('0x10')](_0x290d22[_0x65ee('0x29')]['offset']);}return _0x311535[_0x65ee('0x52')](_0x43ab08);}})[_0x65ee('0x16')](function(_0x2eb520){if(_0x2eb520){return _0x2eb520?{'count':_0x463197,'rows':_0x2eb520}:null;}})[_0x65ee('0x16')](respondWithResult(_0x35003f,null))[_0x65ee('0x2c')](handleError(_0x35003f,null));};exports[_0x65ee('0x55')]=function(_0x5da077,_0x33ed99){var _0xe7ce2=_0x5da077['body'][_0x65ee('0x56')];return db[_0x65ee('0x53')][_0x65ee('0x2a')]({'where':{'id':_0xe7ce2},'attributes':['id'],'include':[{'model':db[_0x65ee('0x4b')],'as':'Agents','attributes':['id','name','online',_0x65ee('0x57'),'interface'],'raw':!![]}]})[_0x65ee('0x16')](function(_0x2a4dea){if(_0x2a4dea){var _0x2d84c0=_[_0x65ee('0x58')](_0x2a4dea,function(_0x4cef9c){var _0xfe8e83=_0x4cef9c['get']({'plain':!![]});return _0xfe8e83['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x5da077[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](function(_0x4d96c3){return db[_0x65ee('0x59')][_0x65ee('0x5a')](function(_0x2c8281){return _0x4d96c3['addTeams'](_0xe7ce2,{'transaction':_0x2c8281})[_0x65ee('0x16')](function(){return BPromise['each'](_0x2d84c0,function(_0x20c513){return db[_0x65ee('0x4a')][_0x65ee('0x5b')]({'where':{'UserId':_0x20c513['id'],'MailQueueId':_0x5da077[_0x65ee('0x40')]['id']},'transaction':_0x2c8281});});})[_0x65ee('0x16')](function(){_0x2d84c0[_0x65ee('0x5c')](function(_0x5b72d8){socket[_0x65ee('0x5d')](_0x65ee('0x5e'),{'UserId':_0x5b72d8['id'],'MailQueueId':_0x4d96c3['id']});});});});});}})[_0x65ee('0x16')](respondWithStatusCode(_0x33ed99,null))[_0x65ee('0x2c')](handleError(_0x33ed99,null));};exports['removeTeams']=function(_0x1aec2b,_0x2c7d84){return db[_0x65ee('0x53')]['findAll']({'where':{'id':_0x1aec2b[_0x65ee('0x29')]['ids']},'attributes':['id'],'include':[{'model':db[_0x65ee('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2c7d84,null))[_0x65ee('0x16')](function(_0x1788f3){var _0x58c4a2=_[_0x65ee('0x21')](_0x1788f3,'id');var _0x106e2a=[];var _0x4c7155=[];var _0x28236e=squel[_0x65ee('0x5f')]();_0x28236e[_0x65ee('0x60')](_0x65ee('0x61'))[_0x65ee('0x62')]('team_has_mail_queues','tq')[_0x65ee('0x63')](_0x65ee('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x65ee('0x27')](_0x65ee('0x65'),_0x1aec2b[_0x65ee('0x40')]['id']);for(var _0x42175c=0x0;_0x42175c<_0x1788f3[_0x65ee('0x33')];_0x42175c+=0x1){let _0x5b2354=_0x1788f3[_0x42175c];for(var _0x32b5bb=0x0;_0x32b5bb<_0x5b2354[_0x65ee('0x66')][_0x65ee('0x33')];_0x32b5bb+=0x1){let _0x3f35c4=_0x5b2354['Agents'][_0x32b5bb];var _0x142815=_0x28236e[_0x65ee('0x67')]();_0x142815[_0x65ee('0x27')](_0x65ee('0x68'),_0x3f35c4['id']);_0x4c7155['push'](db[_0x65ee('0x59')][_0x65ee('0x29')](_0x142815[_0x65ee('0x69')](),{'type':db['sequelize'][_0x65ee('0x6a')][_0x65ee('0x6b')]})[_0x65ee('0x16')](function(_0x55bee8){if(_0x55bee8[_0x65ee('0x33')]===0x1){return _0x3f35c4['id'];}else{var _0x5aca4d=_[_0x65ee('0x6c')](_['map'](_0x55bee8,_0x65ee('0x6d')),function(_0x487444){return _['includes'](_0x58c4a2,_0x487444);});if(_0x5aca4d){return _0x3f35c4['id'];}}}));}}return BPromise['all'](_0x4c7155)['then'](function(_0x1fd0c0){_0x106e2a=_(_0x106e2a)[_0x65ee('0x6e')](_0x1fd0c0)[_0x65ee('0x6f')]()[_0x65ee('0x70')]();return db[_0x65ee('0x22')][_0x65ee('0x37')]({'where':{'id':_0x1aec2b[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](function(_0x58531d){return db[_0x65ee('0x59')][_0x65ee('0x5a')](function(_0x2e2a33){return _0x58531d[_0x65ee('0x71')](_0x1aec2b['query'][_0x65ee('0x56')],{'transaction':_0x2e2a33})[_0x65ee('0x16')](function(){if(!_[_0x65ee('0x72')](_0x106e2a)){return _0x58531d[_0x65ee('0x73')](_0x106e2a,{'transaction':_0x2e2a33});}})['then'](function(){_0x106e2a[_0x65ee('0x5c')](function(_0x277a7c){socket['emit'](_0x65ee('0x74'),{'UserId':_0x277a7c,'MailQueueId':_0x58531d['id']});});});});});});})['then'](respondWithStatusCode(_0x2c7d84,null))[_0x65ee('0x2c')](handleError(_0x2c7d84,null));};exports[_0x65ee('0x75')]=function(_0x42e377,_0x1db423){return db['MailQueue'][_0x65ee('0x37')]({'where':{'id':_0x42e377[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0x1db423,null))['then'](function(_0x18bc67){if(_0x18bc67){return _0x18bc67[_0x65ee('0x75')](_0x42e377['body'][_0x65ee('0x56')],_[_0x65ee('0x76')](_0x42e377[_0x65ee('0x38')],[_0x65ee('0x56'),'id'])||{})['spread'](function(_0x2e2815){for(var _0x3caf33=0x0;_0x3caf33<_0x42e377[_0x65ee('0x38')][_0x65ee('0x56')][_0x65ee('0x33')];_0x3caf33+=0x1){socket['emit'](_0x65ee('0x5e'),{'UserId':Number(_0x42e377[_0x65ee('0x38')][_0x65ee('0x56')][_0x3caf33]),'MailQueueId':Number(_0x42e377[_0x65ee('0x40')]['id'])});}return _0x2e2815;});}})['then'](respondWithResult(_0x1db423,null))[_0x65ee('0x2c')](handleError(_0x1db423,null));};exports[_0x65ee('0x73')]=function(_0x5e1d48,_0x2e2b56){return db[_0x65ee('0x22')][_0x65ee('0x37')]({'where':{'id':_0x5e1d48[_0x65ee('0x40')]['id']}})[_0x65ee('0x16')](handleEntityNotFound(_0x2e2b56,null))[_0x65ee('0x16')](function(_0x4f8c7f){if(_0x4f8c7f){return _0x4f8c7f[_0x65ee('0x73')](_0x5e1d48[_0x65ee('0x29')][_0x65ee('0x56')])[_0x65ee('0x16')](function(){if(_[_0x65ee('0x77')](_0x5e1d48['query'][_0x65ee('0x56')])){for(var _0x556816=0x0;_0x556816<_0x5e1d48[_0x65ee('0x29')][_0x65ee('0x56')][_0x65ee('0x33')];_0x556816+=0x1){socket['emit'](_0x65ee('0x74'),{'UserId':Number(_0x5e1d48[_0x65ee('0x29')][_0x65ee('0x56')][_0x556816]),'MailQueueId':Number(_0x5e1d48['params']['id'])});}}else{socket[_0x65ee('0x5d')](_0x65ee('0x74'),{'UserId':Number(_0x5e1d48['query'][_0x65ee('0x56')]),'MailQueueId':Number(_0x5e1d48['params']['id'])});}});}})[_0x65ee('0x16')](respondWithStatusCode(_0x2e2b56,null))[_0x65ee('0x2c')](handleError(_0x2e2b56,null));};exports[_0x65ee('0x78')]=function(_0x5b4703,_0x1fb263){var _0x51cdb7={};var _0x391e8a={};var _0x56c1c2;var _0x30a768;return db[_0x65ee('0x22')][_0x65ee('0x43')]({'where':{'id':_0x5b4703[_0x65ee('0x40')]['id']}})['then'](handleEntityNotFound(_0x1fb263,null))['then'](function(_0x43b31b){if(_0x43b31b){_0x56c1c2=_0x43b31b;_0x391e8a[_0x65ee('0x2d')]=_[_0x65ee('0x2e')](db['User'][_0x65ee('0x23')]);_0x391e8a[_0x65ee('0x29')]=_[_0x65ee('0x2e')](_0x5b4703[_0x65ee('0x29')]);_0x391e8a[_0x65ee('0x2f')]=_['intersection'](_0x391e8a[_0x65ee('0x2d')],_0x391e8a[_0x65ee('0x29')]);_0x51cdb7['attributes']=_[_0x65ee('0x30')](_0x391e8a[_0x65ee('0x2d')],qs['fields'](_0x5b4703[_0x65ee('0x29')]['fields']));_0x51cdb7['attributes']=_0x51cdb7[_0x65ee('0x32')][_0x65ee('0x33')]?_0x51cdb7[_0x65ee('0x32')]:_0x391e8a['model'];_0x51cdb7['order']=qs[_0x65ee('0x47')](_0x5b4703[_0x65ee('0x29')]['sort']);_0x51cdb7[_0x65ee('0x27')]=qs[_0x65ee('0x2f')](_['pick'](_0x5b4703[_0x65ee('0x29')],_0x391e8a[_0x65ee('0x2f')]));if(_0x5b4703[_0x65ee('0x29')][_0x65ee('0x49')]){_0x51cdb7['where']=_[_0x65ee('0x35')](_0x51cdb7['where'],{'$or':_[_0x65ee('0x21')](_0x51cdb7['attributes'],function(_0x2f6165){var _0x4ef72b={};_0x4ef72b[_0x2f6165]={'$like':'%'+_0x5b4703['query'][_0x65ee('0x49')]+'%'};return _0x4ef72b;})});}_0x51cdb7=_[_0x65ee('0x35')]({},_0x51cdb7,_0x5b4703[_0x65ee('0x36')]);return _0x56c1c2[_0x65ee('0x78')](_0x51cdb7);}})['then'](function(_0x2d7a97){if(_0x2d7a97){_0x30a768=_0x2d7a97[_0x65ee('0x33')];if(!_0x5b4703[_0x65ee('0x29')]['hasOwnProperty'](_0x65ee('0x45'))){_0x51cdb7[_0x65ee('0x11')]=qs[_0x65ee('0x11')](_0x5b4703['query']['limit']);_0x51cdb7['offset']=qs[_0x65ee('0x10')](_0x5b4703[_0x65ee('0x29')][_0x65ee('0x10')]);}return _0x56c1c2['getAgents'](_0x51cdb7);}})[_0x65ee('0x16')](function(_0x50d6d5){if(_0x50d6d5){return _0x50d6d5?{'count':_0x30a768,'rows':_0x50d6d5}:null;}})[_0x65ee('0x16')](respondWithResult(_0x1fb263,null))[_0x65ee('0x2c')](handleError(_0x1fb263,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index facf399..3ba10ba 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 _0xc525=['hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','setMaxListeners','save','remove','emit'];(function(_0x1eb3ec,_0x45fc12){var _0xaa4e0c=function(_0x4fe718){while(--_0x4fe718){_0x1eb3ec['push'](_0x1eb3ec['shift']());}};_0xaa4e0c(++_0x45fc12);}(_0xc525,0x19d));var _0x5c52=function(_0x176eff,_0x4c9595){_0x176eff=_0x176eff-0x0;var _0x20ed62=_0xc525[_0x176eff];return _0x20ed62;};'use strict';var EventEmitter=require(_0x5c52('0x0'));var MailQueue=require(_0x5c52('0x1'))['db'][_0x5c52('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x5c52('0x3')](0x0);var events={'afterCreate':_0x5c52('0x4'),'afterUpdate':'update','afterDestroy':_0x5c52('0x5')};function emitEvent(_0x54ccc4){return function(_0x369516,_0x6207dc,_0x2cef87){MailQueueEvents['emit'](_0x54ccc4+':'+_0x369516['id'],_0x369516);MailQueueEvents[_0x5c52('0x6')](_0x54ccc4,_0x369516);_0x2cef87(null);};}for(var e in events){if(events[_0x5c52('0x7')](e)){var event=events[e];MailQueue[_0x5c52('0x8')](e,emitEvent(event));}}module[_0x5c52('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x4d1a=['hook','exports','events','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x4d1a,0x124));var _0xa4d1=function(_0x171001,_0x5cb473){_0x171001=_0x171001-0x0;var _0x2c65a2=_0x4d1a[_0x171001];return _0x2c65a2;};'use strict';var EventEmitter=require(_0xa4d1('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xa4d1('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xa4d1('0x2')](0x0);var events={'afterCreate':_0xa4d1('0x3'),'afterUpdate':_0xa4d1('0x4'),'afterDestroy':_0xa4d1('0x5')};function emitEvent(_0x3d3979){return function(_0x96b0c6,_0x3c7256,_0x2282ec){MailQueueEvents[_0xa4d1('0x6')](_0x3d3979+':'+_0x96b0c6['id'],_0x96b0c6);MailQueueEvents[_0xa4d1('0x6')](_0x3d3979,_0x96b0c6);_0x2282ec(null);};}for(var e in events){if(events[_0xa4d1('0x7')](e)){var event=events[e];MailQueue[_0xa4d1('0x8')](e,emitEvent(event));}}module[_0xa4d1('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 7fcb311..fe7b633 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 _0xf511=['../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xf511,0x155));var _0x1f51=function(_0x4b0290,_0x188c34){_0x4b0290=_0x4b0290-0x0;var _0x4bd9f4=_0xf511[_0x4b0290];return _0x4bd9f4;};'use strict';var _=require(_0x1f51('0x0'));var util=require(_0x1f51('0x1'));var logger=require(_0x1f51('0x2'))('api');var moment=require(_0x1f51('0x3'));var BPromise=require('bluebird');var rp=require(_0x1f51('0x4'));var fs=require('fs');var path=require(_0x1f51('0x5'));var rimraf=require(_0x1f51('0x6'));var config=require(_0x1f51('0x7'));var attributes=require(_0x1f51('0x8'));module[_0x1f51('0x9')]=function(_0x35a9a3,_0x19b198){return _0x35a9a3['define'](_0x1f51('0xa'),attributes,{'tableName':_0x1f51('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x576c=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','exports','MailQueue','mail_queues'];(function(_0x2d58ed,_0x5980e5){var _0x39c806=function(_0x39a97b){while(--_0x39a97b){_0x2d58ed['push'](_0x2d58ed['shift']());}};_0x39c806(++_0x5980e5);}(_0x576c,0xb4));var _0xc576=function(_0x41b840,_0x1a3baf){_0x41b840=_0x41b840-0x0;var _0x2a0adf=_0x576c[_0x41b840];return _0x2a0adf;};'use strict';var _=require(_0xc576('0x0'));var util=require(_0xc576('0x1'));var logger=require(_0xc576('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc576('0x3'));var rp=require(_0xc576('0x4'));var fs=require('fs');var path=require(_0xc576('0x5'));var rimraf=require(_0xc576('0x6'));var config=require(_0xc576('0x7'));var attributes=require(_0xc576('0x8'));module[_0xc576('0x9')]=function(_0x1145e8,_0x3f56db){return _0x1145e8['define'](_0xc576('0xa'),attributes,{'tableName':_0xc576('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 61c0fd1..283f013 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 _0xc5f5=['MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','include','map','model','debug','ShowMailQueue','find','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./mailQueue.socket','register','request','then','request\x20sent','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x458b97,_0x24d421){var _0x3f42e3=function(_0x55df79){while(--_0x55df79){_0x458b97['push'](_0x458b97['shift']());}};_0x3f42e3(++_0x24d421);}(_0xc5f5,0x1ca));var _0x5c5f=function(_0x5b84ff,_0x47e637){_0x5b84ff=_0x5b84ff-0x0;var _0xf145d9=_0xc5f5[_0x5b84ff];return _0xf145d9;};'use strict';var _=require(_0x5c5f('0x0'));var util=require(_0x5c5f('0x1'));var moment=require(_0x5c5f('0x2'));var BPromise=require('bluebird');var rs=require(_0x5c5f('0x3'));var fs=require('fs');var Redis=require(_0x5c5f('0x4'));var db=require(_0x5c5f('0x5'))['db'];var utils=require(_0x5c5f('0x6'));var logger=require('../../config/logger')(_0x5c5f('0x7'));var config=require(_0x5c5f('0x8'));var jayson=require(_0x5c5f('0x9'));var client=jayson[_0x5c5f('0xa')][_0x5c5f('0xb')]({'port':0x232a});config[_0x5c5f('0xc')]=_[_0x5c5f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5c5f('0xe'))[_0x5c5f('0xf')](socket);function respondWithRpcPromise(_0x5e96b3,_0x4d07d8,_0x3a059e){return new BPromise(function(_0x36c4b4,_0x1574e6){return client[_0x5c5f('0x10')](_0x5e96b3,_0x3a059e)[_0x5c5f('0x11')](function(_0x20d01d){logger['info']('MailQueue,\x20%s,\x20%s',_0x4d07d8,_0x5c5f('0x12'));logger['debug'](_0x5c5f('0x13'),_0x4d07d8,'request\x20sent',JSON[_0x5c5f('0x14')](_0x20d01d));if(_0x20d01d[_0x5c5f('0x15')]){if(_0x20d01d[_0x5c5f('0x15')]['code']===0x1f4){logger[_0x5c5f('0x15')](_0x5c5f('0x16'),_0x4d07d8,_0x20d01d[_0x5c5f('0x15')]['message']);return _0x1574e6(_0x20d01d[_0x5c5f('0x15')][_0x5c5f('0x17')]);}logger['error'](_0x5c5f('0x16'),_0x4d07d8,_0x20d01d[_0x5c5f('0x15')][_0x5c5f('0x17')]);return _0x36c4b4(_0x20d01d['error'][_0x5c5f('0x17')]);}else{logger[_0x5c5f('0x18')]('MailQueue,\x20%s,\x20%s',_0x4d07d8,_0x5c5f('0x12'));_0x36c4b4(_0x20d01d[_0x5c5f('0x19')]['message']);}})[_0x5c5f('0x1a')](function(_0x52f03f){logger[_0x5c5f('0x15')](_0x5c5f('0x16'),_0x4d07d8,_0x52f03f);_0x1574e6(_0x52f03f);});});}exports[_0x5c5f('0x1b')]=function(_0x2a507d){var _0x3c6476=this;return new Promise(function(_0x526566,_0x5a491b){return db[_0x5c5f('0x1c')][_0x5c5f('0x1d')]({'raw':_0x2a507d[_0x5c5f('0x1e')]?_0x2a507d[_0x5c5f('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2a507d[_0x5c5f('0x1e')]?_0x2a507d[_0x5c5f('0x1e')][_0x5c5f('0x1f')]||null:null,'attributes':_0x2a507d[_0x5c5f('0x1e')]?_0x2a507d[_0x5c5f('0x1e')][_0x5c5f('0x20')]||null:null,'limit':_0x2a507d[_0x5c5f('0x1e')]?_0x2a507d['options']['limit']||null:null,'include':_0x2a507d[_0x5c5f('0x1e')]?_0x2a507d[_0x5c5f('0x1e')][_0x5c5f('0x21')]?_[_0x5c5f('0x22')](_0x2a507d[_0x5c5f('0x1e')]['include'],function(_0x44aa93){return{'model':db[_0x44aa93[_0x5c5f('0x23')]],'as':_0x44aa93['as'],'attributes':_0x44aa93[_0x5c5f('0x20')],'include':_0x44aa93[_0x5c5f('0x21')]?_[_0x5c5f('0x22')](_0x44aa93['include'],function(_0x300d52){return{'model':db[_0x300d52[_0x5c5f('0x23')]],'as':_0x300d52['as'],'attributes':_0x300d52['attributes'],'include':_0x300d52[_0x5c5f('0x21')]?_['map'](_0x300d52['include'],function(_0x5acf7a){return{'model':db[_0x5acf7a[_0x5c5f('0x23')]],'as':_0x5acf7a['as'],'attributes':_0x5acf7a[_0x5c5f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5c5f('0x11')](function(_0x4fd7dc){logger[_0x5c5f('0x18')]('GetMailQueue',_0x2a507d);logger[_0x5c5f('0x24')](_0x5c5f('0x1b'),_0x2a507d,JSON['stringify'](_0x4fd7dc));_0x526566(_0x4fd7dc);})[_0x5c5f('0x1a')](function(_0x4648fe){logger[_0x5c5f('0x15')]('GetMailQueue',_0x4648fe[_0x5c5f('0x17')],_0x2a507d);_0x5a491b(_0x3c6476[_0x5c5f('0x15')](0x1f4,_0x4648fe['message']));});});};exports[_0x5c5f('0x25')]=function(_0x5bf63b){var _0x37c26f=this;return new Promise(function(_0x4b51b4,_0x16ffd3){return db[_0x5c5f('0x1c')][_0x5c5f('0x26')]({'raw':_0x5bf63b[_0x5c5f('0x1e')]?_0x5bf63b[_0x5c5f('0x1e')][_0x5c5f('0x27')]===undefined?!![]:![]:!![],'where':_0x5bf63b['options']?_0x5bf63b[_0x5c5f('0x1e')][_0x5c5f('0x1f')]||null:null,'attributes':_0x5bf63b['options']?_0x5bf63b[_0x5c5f('0x1e')][_0x5c5f('0x20')]||null:null,'include':_0x5bf63b[_0x5c5f('0x1e')]?_0x5bf63b[_0x5c5f('0x1e')]['include']?_[_0x5c5f('0x22')](_0x5bf63b[_0x5c5f('0x1e')][_0x5c5f('0x21')],function(_0x564d30){return{'model':db[_0x564d30[_0x5c5f('0x23')]],'as':_0x564d30['as'],'attributes':_0x564d30[_0x5c5f('0x20')],'include':_0x564d30[_0x5c5f('0x21')]?_[_0x5c5f('0x22')](_0x564d30[_0x5c5f('0x21')],function(_0x2b9bca){return{'model':db[_0x2b9bca[_0x5c5f('0x23')]],'as':_0x2b9bca['as'],'attributes':_0x2b9bca[_0x5c5f('0x20')],'include':_0x2b9bca[_0x5c5f('0x21')]?_[_0x5c5f('0x22')](_0x2b9bca[_0x5c5f('0x21')],function(_0x56e49b){return{'model':db[_0x56e49b[_0x5c5f('0x23')]],'as':_0x56e49b['as'],'attributes':_0x56e49b['attributes']};}):[]};}):[]};}):[]:[]})[_0x5c5f('0x11')](function(_0x29de02){logger[_0x5c5f('0x18')](_0x5c5f('0x25'),_0x5bf63b);logger[_0x5c5f('0x24')](_0x5c5f('0x25'),_0x5bf63b,JSON[_0x5c5f('0x14')](_0x29de02));_0x4b51b4(_0x29de02);})['catch'](function(_0x3aabf5){logger[_0x5c5f('0x15')]('ShowMailQueue',_0x3aabf5[_0x5c5f('0x17')],_0x5bf63b);_0x16ffd3(_0x37c26f[_0x5c5f('0x15')](0x1f4,_0x3aabf5[_0x5c5f('0x17')]));});});}; \ No newline at end of file +var _0x122a=['randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','localhost','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','GetMailQueue','MailQueue','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','ShowMailQueue','find','lodash','util','moment','bluebird'];(function(_0xa94825,_0x2989c6){var _0x120af0=function(_0x1b26d2){while(--_0x1b26d2){_0xa94825['push'](_0xa94825['shift']());}};_0x120af0(++_0x2989c6);}(_0x122a,0xba));var _0xa122=function(_0x52e8f1,_0x4a1218){_0x52e8f1=_0x52e8f1-0x0;var _0x1126c8=_0x122a[_0x52e8f1];return _0x1126c8;};'use strict';var _=require(_0xa122('0x0'));var util=require(_0xa122('0x1'));var moment=require(_0xa122('0x2'));var BPromise=require(_0xa122('0x3'));var rs=require(_0xa122('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa122('0x5'));var logger=require('../../config/logger')(_0xa122('0x6'));var config=require(_0xa122('0x7'));var jayson=require(_0xa122('0x8'));var client=jayson[_0xa122('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xa122('0xa')],{'host':_0xa122('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa122('0xa')]));require(_0xa122('0xc'))[_0xa122('0xd')](socket);function respondWithRpcPromise(_0x32314d,_0x5b2393,_0x532830){return new BPromise(function(_0x5479b7,_0x3b7ef7){return client['request'](_0x32314d,_0x532830)[_0xa122('0xe')](function(_0xbb1763){logger['info'](_0xa122('0xf'),_0x5b2393,'request\x20sent');logger['debug'](_0xa122('0x10'),_0x5b2393,_0xa122('0x11'),JSON['stringify'](_0xbb1763));if(_0xbb1763[_0xa122('0x12')]){if(_0xbb1763[_0xa122('0x12')][_0xa122('0x13')]===0x1f4){logger['error'](_0xa122('0xf'),_0x5b2393,_0xbb1763[_0xa122('0x12')][_0xa122('0x14')]);return _0x3b7ef7(_0xbb1763[_0xa122('0x12')][_0xa122('0x14')]);}logger[_0xa122('0x12')]('MailQueue,\x20%s,\x20%s',_0x5b2393,_0xbb1763[_0xa122('0x12')][_0xa122('0x14')]);return _0x5479b7(_0xbb1763[_0xa122('0x12')][_0xa122('0x14')]);}else{logger[_0xa122('0x15')](_0xa122('0xf'),_0x5b2393,_0xa122('0x11'));_0x5479b7(_0xbb1763[_0xa122('0x16')][_0xa122('0x14')]);}})['catch'](function(_0x2280c9){logger[_0xa122('0x12')](_0xa122('0xf'),_0x5b2393,_0x2280c9);_0x3b7ef7(_0x2280c9);});});}exports[_0xa122('0x17')]=function(_0x2d6bbf){var _0x1d4741=this;return new Promise(function(_0x2fad75,_0x26ac5c){return db[_0xa122('0x18')]['findAll']({'raw':_0x2d6bbf[_0xa122('0x19')]?_0x2d6bbf[_0xa122('0x19')][_0xa122('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d6bbf[_0xa122('0x19')]?_0x2d6bbf[_0xa122('0x19')][_0xa122('0x1b')]||null:null,'attributes':_0x2d6bbf['options']?_0x2d6bbf[_0xa122('0x19')][_0xa122('0x1c')]||null:null,'limit':_0x2d6bbf[_0xa122('0x19')]?_0x2d6bbf[_0xa122('0x19')][_0xa122('0x1d')]||null:null,'include':_0x2d6bbf[_0xa122('0x19')]?_0x2d6bbf[_0xa122('0x19')][_0xa122('0x1e')]?_[_0xa122('0x1f')](_0x2d6bbf['options'][_0xa122('0x1e')],function(_0x163531){return{'model':db[_0x163531['model']],'as':_0x163531['as'],'attributes':_0x163531[_0xa122('0x1c')],'include':_0x163531['include']?_['map'](_0x163531[_0xa122('0x1e')],function(_0x52f808){return{'model':db[_0x52f808[_0xa122('0x20')]],'as':_0x52f808['as'],'attributes':_0x52f808[_0xa122('0x1c')],'include':_0x52f808[_0xa122('0x1e')]?_[_0xa122('0x1f')](_0x52f808[_0xa122('0x1e')],function(_0x31be08){return{'model':db[_0x31be08['model']],'as':_0x31be08['as'],'attributes':_0x31be08[_0xa122('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa122('0xe')](function(_0x400988){logger['info']('GetMailQueue',_0x2d6bbf);logger[_0xa122('0x21')](_0xa122('0x17'),_0x2d6bbf,JSON[_0xa122('0x22')](_0x400988));_0x2fad75(_0x400988);})[_0xa122('0x23')](function(_0x5ebe0c){logger['error'](_0xa122('0x17'),_0x5ebe0c[_0xa122('0x14')],_0x2d6bbf);_0x26ac5c(_0x1d4741['error'](0x1f4,_0x5ebe0c[_0xa122('0x14')]));});});};exports[_0xa122('0x24')]=function(_0x1662af){var _0x280039=this;return new Promise(function(_0x2782d1,_0x1d5521){return db['MailQueue'][_0xa122('0x25')]({'raw':_0x1662af['options']?_0x1662af[_0xa122('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1662af[_0xa122('0x19')]?_0x1662af[_0xa122('0x19')][_0xa122('0x1b')]||null:null,'attributes':_0x1662af[_0xa122('0x19')]?_0x1662af['options'][_0xa122('0x1c')]||null:null,'include':_0x1662af['options']?_0x1662af[_0xa122('0x19')][_0xa122('0x1e')]?_[_0xa122('0x1f')](_0x1662af['options']['include'],function(_0x2ab6aa){return{'model':db[_0x2ab6aa[_0xa122('0x20')]],'as':_0x2ab6aa['as'],'attributes':_0x2ab6aa[_0xa122('0x1c')],'include':_0x2ab6aa[_0xa122('0x1e')]?_[_0xa122('0x1f')](_0x2ab6aa[_0xa122('0x1e')],function(_0x4f3913){return{'model':db[_0x4f3913[_0xa122('0x20')]],'as':_0x4f3913['as'],'attributes':_0x4f3913[_0xa122('0x1c')],'include':_0x4f3913['include']?_[_0xa122('0x1f')](_0x4f3913[_0xa122('0x1e')],function(_0x1b96d6){return{'model':db[_0x1b96d6[_0xa122('0x20')]],'as':_0x1b96d6['as'],'attributes':_0x1b96d6[_0xa122('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ad42c){logger[_0xa122('0x15')]('ShowMailQueue',_0x1662af);logger[_0xa122('0x21')]('ShowMailQueue',_0x1662af,JSON[_0xa122('0x22')](_0x1ad42c));_0x2782d1(_0x1ad42c);})[_0xa122('0x23')](function(_0x1b29b4){logger[_0xa122('0x12')](_0xa122('0x24'),_0x1b29b4[_0xa122('0x14')],_0x1662af);_0x1d5521(_0x280039[_0xa122('0x12')](0x1f4,_0x1b29b4[_0xa122('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 26d1e78..0e497fc 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 _0xf609=['save','remove','emit','removeListener','length','mailQueue:'];(function(_0x1a72b8,_0x1e4f4b){var _0x39f72d=function(_0x35aef1){while(--_0x35aef1){_0x1a72b8['push'](_0x1a72b8['shift']());}};_0x39f72d(++_0x1e4f4b);}(_0xf609,0x1c2));var _0x9f60=function(_0x4f8b62,_0x5ae5b9){_0x4f8b62=_0x4f8b62-0x0;var _0x16818d=_0xf609[_0x4f8b62];return _0x16818d;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0x9f60('0x0'),_0x9f60('0x1'),'update'];function createListener(_0x5b5a6a,_0x290110){return function(_0x22f76e){_0x290110[_0x9f60('0x2')](_0x5b5a6a,_0x22f76e);};}function removeListener(_0x209b0c,_0x13afb5){return function(){MailQueueEvents[_0x9f60('0x3')](_0x209b0c,_0x13afb5);};}exports['register']=function(_0x5a3c6f){for(var _0x4ec770=0x0,_0x3e33ab=events[_0x9f60('0x4')];_0x4ec770<_0x3e33ab;_0x4ec770++){var _0x38fe1c=events[_0x4ec770];var _0x1d03d0=createListener(_0x9f60('0x5')+_0x38fe1c,_0x5a3c6f);MailQueueEvents['on'](_0x38fe1c,_0x1d03d0);}}; \ No newline at end of file +var _0x4743=['save','remove','update','register','mailQueue:','./mailQueue.events'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x4743,0x173));var _0x3474=function(_0x303064,_0x12f0c2){_0x303064=_0x303064-0x0;var _0x5a1d3d=_0x4743[_0x303064];return _0x5a1d3d;};'use strict';var MailQueueEvents=require(_0x3474('0x0'));var events=[_0x3474('0x1'),_0x3474('0x2'),_0x3474('0x3')];function createListener(_0xd0f726,_0x285db6){return function(_0x248761){_0x285db6['emit'](_0xd0f726,_0x248761);};}function removeListener(_0xa79cc0,_0x3068d5){return function(){MailQueueEvents['removeListener'](_0xa79cc0,_0x3068d5);};}exports[_0x3474('0x4')]=function(_0x4b1f3c){for(var _0x3e6d90=0x0,_0xff985e=events['length'];_0x3e6d90<_0xff985e;_0x3e6d90++){var _0x4da044=events[_0x3e6d90];var _0x16100e=createListener(_0x3474('0x5')+_0x4da044,_0x4b1f3c);MailQueueEvents['on'](_0x4da044,_0x16100e);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 7d46964..3118135 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 _0x697f=['isAuthenticated','describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x697f,0x15f));var _0xf697=function(_0x187850,_0x2e35d4){_0x187850=_0x187850-0x0;var _0x5b62ad=_0x697f[_0x187850];return _0x5b62ad;};'use strict';var multer=require(_0xf697('0x0'));var util=require(_0xf697('0x1'));var path=require(_0xf697('0x2'));var timeout=require(_0xf697('0x3'));var express=require('express');var router=express[_0xf697('0x4')]();var fs_extra=require(_0xf697('0x5'));var auth=require(_0xf697('0x6'));var interaction=require(_0xf697('0x7'));var config=require('../../config/environment');var controller=require(_0xf697('0x8'));router[_0xf697('0x9')]('/',auth[_0xf697('0xa')](),controller['index']);router[_0xf697('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf697('0xb')]);router[_0xf697('0x9')](_0xf697('0xc'),auth[_0xf697('0xa')](),controller[_0xf697('0xd')]);router[_0xf697('0xe')]('/',auth[_0xf697('0xa')](),controller['create']);router['put'](_0xf697('0xc'),auth[_0xf697('0xa')](),controller[_0xf697('0xf')]);router[_0xf697('0x10')](_0xf697('0xc'),auth['isAuthenticated'](),controller[_0xf697('0x11')]);module[_0xf697('0x12')]=router; \ No newline at end of file +var _0xb5df=['get','/:id','show','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','/describe','describe'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xb5df,0x86));var _0xfb5d=function(_0x57a83c,_0xe9385c){_0x57a83c=_0x57a83c-0x0;var _0x23b46d=_0xb5df[_0x57a83c];return _0x23b46d;};'use strict';var multer=require(_0xfb5d('0x0'));var util=require(_0xfb5d('0x1'));var path=require('path');var timeout=require(_0xfb5d('0x2'));var express=require(_0xfb5d('0x3'));var router=express[_0xfb5d('0x4')]();var fs_extra=require(_0xfb5d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfb5d('0x6'));var config=require(_0xfb5d('0x7'));var controller=require(_0xfb5d('0x8'));router['get']('/',auth[_0xfb5d('0x9')](),controller[_0xfb5d('0xa')]);router['get'](_0xfb5d('0xb'),auth['isAuthenticated'](),controller[_0xfb5d('0xc')]);router[_0xfb5d('0xd')](_0xfb5d('0xe'),auth[_0xfb5d('0x9')](),controller[_0xfb5d('0xf')]);router[_0xfb5d('0x10')]('/',auth[_0xfb5d('0x9')](),controller['create']);router[_0xfb5d('0x11')]('/:id',auth[_0xfb5d('0x9')](),controller['update']);router[_0xfb5d('0x12')](_0xfb5d('0xe'),auth['isAuthenticated'](),controller[_0xfb5d('0x13')]);module[_0xfb5d('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index e6cacff..1d00109 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 _0x75b8=['exports','STRING','DATE','moment','sequelize'];(function(_0x1505da,_0xfb0d44){var _0x3a08f9=function(_0x295cdc){while(--_0x295cdc){_0x1505da['push'](_0x1505da['shift']());}};_0x3a08f9(++_0xfb0d44);}(_0x75b8,0x9e));var _0x875b=function(_0x463697,_0xccfdc4){_0x463697=_0x463697-0x0;var _0x33cfe1=_0x75b8[_0x463697];return _0x33cfe1;};'use strict';var moment=require(_0x875b('0x0'));var Sequelize=require(_0x875b('0x1'));module[_0x875b('0x2')]={'uniqueid':{'type':Sequelize[_0x875b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x875b('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x875b('0x4')]},'exitAt':{'type':Sequelize[_0x875b('0x4')]},'reason':{'type':Sequelize[_0x875b('0x3')]}}; \ No newline at end of file +var _0x7680=['sequelize','exports','STRING','DATE'];(function(_0x342b0f,_0x168cc5){var _0x3830d1=function(_0x54f690){while(--_0x54f690){_0x342b0f['push'](_0x342b0f['shift']());}};_0x3830d1(++_0x168cc5);}(_0x7680,0x178));var _0x0768=function(_0x7625d9,_0x2fea5a){_0x7625d9=_0x7625d9-0x0;var _0x5c6d75=_0x7680[_0x7625d9];return _0x5c6d75;};'use strict';var moment=require('moment');var Sequelize=require(_0x0768('0x0'));module[_0x0768('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x0768('0x2')]},'joinAt':{'type':Sequelize[_0x0768('0x3')]},'leaveAt':{'type':Sequelize[_0x0768('0x3')]},'acceptAt':{'type':Sequelize[_0x0768('0x3')]},'exitAt':{'type':Sequelize[_0x0768('0x3')]},'reason':{'type':Sequelize[_0x0768('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index ee3e2f4..ae2c830 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 _0xfcf0=['nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','MailQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0xfcf0,0x138));var _0x0fcf=function(_0x39e84d,_0x11931d){_0x39e84d=_0x39e84d-0x0;var _0x1991bc=_0xfcf0[_0x39e84d];return _0x1991bc;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));};exports[_0x0fcf('0x49')]=function(_0x389d71,_0x3a473c){return db[_0x0fcf('0x2b')][_0x0fcf('0x49')]()[_0x0fcf('0x24')](respondWithResult(_0x3a473c,null))[_0x0fcf('0x42')](handleError(_0x3a473c,null));}; \ No newline at end of file +var _0x1967=['crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','then','status','error','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','MailQueueReport','includeAll','include','findAll','rows','show','params','fields','options','find','catch','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0x1967,0x173));var _0x7196=function(_0x48989f,_0xb11f00){_0x48989f=_0x48989f-0x0;var _0x3db02b=_0x1967[_0x48989f];return _0x3db02b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];function respondWithStatusCode(_0x325641,_0x24f1c3){_0x24f1c3=_0x24f1c3||0xcc;return function(_0xba707b){if(_0xba707b){return _0x325641[_0x7196('0x1c')](_0x24f1c3);}return _0x325641['status'](_0x24f1c3)[_0x7196('0x1d')]();};}function respondWithResult(_0x3feccd,_0x3545aa){_0x3545aa=_0x3545aa||0xc8;return function(_0xf098c1){if(_0xf098c1){return _0x3feccd['status'](_0x3545aa)[_0x7196('0x1e')](_0xf098c1);}};}function respondWithFilteredResult(_0x539414,_0xe32933){return function(_0x2590a6){if(_0x2590a6){var _0xf7e97=typeof _0xe32933[_0x7196('0x1f')]===_0x7196('0x20')&&typeof _0xe32933[_0x7196('0x21')]===_0x7196('0x20');var _0x1ed296=_0x2590a6[_0x7196('0x22')];var _0x32fe2b=_0xf7e97?0x0:_0xe32933[_0x7196('0x1f')];var _0x5b716a=_0xf7e97?_0x2590a6['count']:_0xe32933[_0x7196('0x1f')]+_0xe32933[_0x7196('0x21')];var _0x40418d;if(_0x5b716a>=_0x1ed296){_0x5b716a=_0x1ed296;_0x40418d=0xc8;}else{_0x40418d=0xce;}_0x539414['status'](_0x40418d);return _0x539414[_0x7196('0x23')]('Content-Range',_0x32fe2b+'-'+_0x5b716a+'/'+_0x1ed296)['json'](_0x2590a6);}return null;};}function patchUpdates(_0x296e07){return function(_0x627223){try{jsonpatch[_0x7196('0x24')](_0x627223,_0x296e07,!![]);}catch(_0x4ddf78){return BPromise['reject'](_0x4ddf78);}return _0x627223[_0x7196('0x25')]();};}function saveUpdates(_0x3cd8ff,_0x598a26){return function(_0x18649b){if(_0x18649b){return _0x18649b[_0x7196('0x26')](_0x3cd8ff)[_0x7196('0x27')](function(_0x18d389){return _0x18d389;});}return null;};}function removeEntity(_0x38b3d6,_0x549f34){return function(_0x3f8178){if(_0x3f8178){return _0x3f8178['destroy']()[_0x7196('0x27')](function(){_0x38b3d6[_0x7196('0x28')](0xcc)[_0x7196('0x1d')]();});}};}function handleEntityNotFound(_0xa69810,_0x70aa65){return function(_0x43f6a2){if(!_0x43f6a2){_0xa69810['sendStatus'](0x194);}return _0x43f6a2;};}function handleError(_0x57c404,_0x1482e5){_0x1482e5=_0x1482e5||0x1f4;return function(_0x2d284f){logger[_0x7196('0x29')](_0x2d284f['stack']);if(_0x2d284f['name']){delete _0x2d284f[_0x7196('0x2a')];}_0x57c404[_0x7196('0x28')](_0x1482e5)[_0x7196('0x2b')](_0x2d284f);};}exports['index']=function(_0x35eef9,_0x4ecea1){var _0x4fd339={},_0x59d79d={},_0x30151f={'count':0x0,'rows':[]};var _0x985727=_[_0x7196('0x2c')](db['MailQueueReport'][_0x7196('0x2d')],function(_0x45d567){return{'name':_0x45d567[_0x7196('0x2e')],'type':_0x45d567[_0x7196('0x2f')]['key']};});_0x59d79d[_0x7196('0x30')]=_[_0x7196('0x2c')](_0x985727,_0x7196('0x2a'));_0x59d79d[_0x7196('0x31')]=_[_0x7196('0x32')](_0x35eef9[_0x7196('0x31')]);_0x59d79d[_0x7196('0x33')]=_[_0x7196('0x34')](_0x59d79d[_0x7196('0x30')],_0x59d79d[_0x7196('0x31')]);_0x4fd339[_0x7196('0x35')]=_['intersection'](_0x59d79d[_0x7196('0x30')],qs['fields'](_0x35eef9[_0x7196('0x31')]['fields']));_0x4fd339[_0x7196('0x35')]=_0x4fd339[_0x7196('0x35')]['length']?_0x4fd339[_0x7196('0x35')]:_0x59d79d[_0x7196('0x30')];if(!_0x35eef9[_0x7196('0x31')][_0x7196('0x36')](_0x7196('0x37'))){_0x4fd339['limit']=qs[_0x7196('0x21')](_0x35eef9[_0x7196('0x31')][_0x7196('0x21')]);_0x4fd339[_0x7196('0x1f')]=qs[_0x7196('0x1f')](_0x35eef9[_0x7196('0x31')]['offset']);}_0x4fd339[_0x7196('0x38')]=qs[_0x7196('0x39')](_0x35eef9[_0x7196('0x31')]['sort']);_0x4fd339[_0x7196('0x3a')]=qs[_0x7196('0x33')](_[_0x7196('0x3b')](_0x35eef9[_0x7196('0x31')],_0x59d79d[_0x7196('0x33')]),_0x985727);if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3c')]){_0x4fd339[_0x7196('0x3a')]=_[_0x7196('0x3d')](_0x4fd339[_0x7196('0x3a')],{'$or':_['map'](_0x985727,function(_0x257754){if(_0x257754[_0x7196('0x2f')]!=='VIRTUAL'){var _0x186efe={};_0x186efe[_0x257754['name']]={'$like':'%'+_0x35eef9['query'][_0x7196('0x3c')]+'%'};return _0x186efe;}})});}_0x4fd339=_[_0x7196('0x3d')]({},_0x4fd339,_0x35eef9['options']);var _0x587f6f={'where':_0x4fd339[_0x7196('0x3a')]};return db[_0x7196('0x3e')][_0x7196('0x22')](_0x587f6f)['then'](function(_0x36a990){_0x30151f[_0x7196('0x22')]=_0x36a990;if(_0x35eef9[_0x7196('0x31')][_0x7196('0x3f')]){_0x4fd339[_0x7196('0x40')]=[{'all':!![]}];}return db[_0x7196('0x3e')][_0x7196('0x41')](_0x4fd339);})[_0x7196('0x27')](function(_0x5cd903){_0x30151f[_0x7196('0x42')]=_0x5cd903;return _0x30151f;})[_0x7196('0x27')](respondWithFilteredResult(_0x4ecea1,_0x4fd339))['catch'](handleError(_0x4ecea1,null));};exports[_0x7196('0x43')]=function(_0x43d4c0,_0x48178f){var _0x471915={'raw':!![],'where':{'id':_0x43d4c0[_0x7196('0x44')]['id']}},_0x471bb2={};_0x471bb2['model']=_[_0x7196('0x32')](db[_0x7196('0x3e')]['rawAttributes']);_0x471bb2[_0x7196('0x31')]=_[_0x7196('0x32')](_0x43d4c0['query']);_0x471bb2[_0x7196('0x33')]=_['intersection'](_0x471bb2['model'],_0x471bb2['query']);_0x471915['attributes']=_['intersection'](_0x471bb2[_0x7196('0x30')],qs['fields'](_0x43d4c0[_0x7196('0x31')][_0x7196('0x45')]));_0x471915[_0x7196('0x35')]=_0x471915[_0x7196('0x35')]['length']?_0x471915[_0x7196('0x35')]:_0x471bb2['model'];if(_0x43d4c0[_0x7196('0x31')][_0x7196('0x3f')]){_0x471915[_0x7196('0x40')]=[{'all':!![]}];}_0x471915=_['merge']({},_0x471915,_0x43d4c0[_0x7196('0x46')]);return db[_0x7196('0x3e')][_0x7196('0x47')](_0x471915)['then'](handleEntityNotFound(_0x48178f,null))['then'](respondWithResult(_0x48178f,null))[_0x7196('0x48')](handleError(_0x48178f,null));};exports['create']=function(_0x29c7e8,_0x582884){return db['MailQueueReport'][_0x7196('0x49')](_0x29c7e8['body'],{})['then'](respondWithResult(_0x582884,0xc9))['catch'](handleError(_0x582884,null));};exports[_0x7196('0x26')]=function(_0x5052ee,_0x48e3b5){if(_0x5052ee[_0x7196('0x4a')]['id']){delete _0x5052ee[_0x7196('0x4a')]['id'];}return db[_0x7196('0x3e')][_0x7196('0x47')]({'where':{'id':_0x5052ee['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x48e3b5,null))['then'](saveUpdates(_0x5052ee[_0x7196('0x4a')],null))[_0x7196('0x27')](respondWithResult(_0x48e3b5,null))['catch'](handleError(_0x48e3b5,null));};exports[_0x7196('0x4b')]=function(_0x2fd056,_0x3fe092){return db['MailQueueReport'][_0x7196('0x47')]({'where':{'id':_0x2fd056['params']['id']}})[_0x7196('0x27')](handleEntityNotFound(_0x3fe092,null))[_0x7196('0x27')](removeEntity(_0x3fe092,null))[_0x7196('0x48')](handleError(_0x3fe092,null));};exports[_0x7196('0x4c')]=function(_0x41a9aa,_0x19733a){return db[_0x7196('0x3e')][_0x7196('0x4c')]()['then'](respondWithResult(_0x19733a,null))['catch'](handleError(_0x19733a,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 058057a..af32e51 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 _0x653e=['define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x1d9c1c,_0x1c84b2){var _0x3f0156=function(_0x301b5b){while(--_0x301b5b){_0x1d9c1c['push'](_0x1d9c1c['shift']());}};_0x3f0156(++_0x1c84b2);}(_0x653e,0xba));var _0xe653=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x653e[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0xe653('0x0'));var util=require(_0xe653('0x1'));var logger=require(_0xe653('0x2'))(_0xe653('0x3'));var moment=require(_0xe653('0x4'));var BPromise=require(_0xe653('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe653('0x6'));var rimraf=require(_0xe653('0x7'));var config=require(_0xe653('0x8'));var attributes=require(_0xe653('0x9'));module['exports']=function(_0x3fca36,_0x2fba6d){return _0x3fca36[_0xe653('0xa')](_0xe653('0xb'),attributes,{'tableName':_0xe653('0xc'),'paranoid':![],'indexes':[{'name':_0xe653('0xd'),'fields':[_0xe653('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ad2=['rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1f334f,_0x109cdb){var _0x192af4=function(_0x5631ef){while(--_0x5631ef){_0x1f334f['push'](_0x1f334f['shift']());}};_0x192af4(++_0x109cdb);}(_0x6ad2,0x159));var _0x26ad=function(_0x303875,_0x29fc7f){_0x303875=_0x303875-0x0;var _0x507814=_0x6ad2[_0x303875];return _0x507814;};'use strict';var _=require(_0x26ad('0x0'));var util=require(_0x26ad('0x1'));var logger=require(_0x26ad('0x2'))(_0x26ad('0x3'));var moment=require(_0x26ad('0x4'));var BPromise=require(_0x26ad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x26ad('0x6'));var config=require('../../config/environment');var attributes=require(_0x26ad('0x7'));module[_0x26ad('0x8')]=function(_0x2b7467,_0x38ddbc){return _0x2b7467[_0x26ad('0x9')](_0x26ad('0xa'),attributes,{'tableName':_0x26ad('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x26ad('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index a5b8d86..76bb304 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(_0x2ccb1d,_0x3a8ff1){var _0x26a0fd=function(_0x4b3afa){while(--_0x4b3afa){_0x2ccb1d['push'](_0x2ccb1d['shift']());}};_0x26a0fd(++_0x3a8ff1);}(_0x326f,0xd1));var _0xf326=function(_0x11ecc8,_0x53e03b){_0x11ecc8=_0x11ecc8-0x0;var _0x3b1a0c=_0x326f[_0x11ecc8];return _0x3b1a0c;};'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 _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x32efc7,_0x59650a){var _0x5b188d=function(_0x26f63d){while(--_0x26f63d){_0x32efc7['push'](_0x32efc7['shift']());}};_0x5b188d(++_0x59650a);}(_0xdb28,0x106));var _0x8db2=function(_0x1a1728,_0x12cc0b){_0x1a1728=_0x1a1728-0x0;var _0x9000f9=_0xdb28[_0x1a1728];return _0x9000f9;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 655529f..07019ae 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4bd06c,_0xf767df){var _0x494e38=function(_0x4cfb39){while(--_0x4cfb39){_0x4bd06c['push'](_0x4bd06c['shift']());}};_0x494e38(++_0xf767df);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x513841,_0x56c68b){var _0x1f3333=function(_0x47eec0){while(--_0x47eec0){_0x513841['push'](_0x513841['shift']());}};_0x1f3333(++_0x56c68b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0xcb91[_0x2aa0e7];return _0x1472c0;};'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/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 8c522de..2d88a3f 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 _0x4e19=['BOOLEAN','INTEGER','sequelize','exports','STRING'];(function(_0x444e8b,_0x3524cc){var _0x35eb37=function(_0x17e1a3){while(--_0x17e1a3){_0x444e8b['push'](_0x444e8b['shift']());}};_0x35eb37(++_0x3524cc);}(_0x4e19,0x7a));var _0x94e1=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x4e19[_0xa990b7];return _0x52c99c;};'use strict';var Sequelize=require(_0x94e1('0x0'));module[_0x94e1('0x1')]={'description':{'type':Sequelize[_0x94e1('0x2')]},'host':{'type':Sequelize[_0x94e1('0x2')]},'authentication':{'type':Sequelize[_0x94e1('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x94e1('0x2')]},'password':{'type':Sequelize[_0x94e1('0x2')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x94e1('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x94e1('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x94e1('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x94e1('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0x94e1('0x2')]},'modernAuthentication':{'type':Sequelize[_0x94e1('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x655f=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x3440a6,_0x9e93e4){var _0x3ad44a=function(_0x5f0c7a){while(--_0x5f0c7a){_0x3440a6['push'](_0x3440a6['shift']());}};_0x3ad44a(++_0x9e93e4);}(_0x655f,0xc6));var _0xf655=function(_0x478266,_0x262b6c){_0x478266=_0x478266-0x0;var _0xba35eb=_0x655f[_0x478266];return _0xba35eb;};'use strict';var Sequelize=require(_0xf655('0x0'));module[_0xf655('0x1')]={'description':{'type':Sequelize[_0xf655('0x2')]},'host':{'type':Sequelize[_0xf655('0x2')]},'authentication':{'type':Sequelize[_0xf655('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xf655('0x2')]},'port':{'type':Sequelize[_0xf655('0x4')]},'tls':{'type':Sequelize[_0xf655('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xf655('0x5')},'connTimeout':{'type':Sequelize[_0xf655('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xf655('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xf655('0x2')]},'modernAuthentication':{'type':Sequelize[_0xf655('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 b1316a6..234804e 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 _0xc78f=['MailServerIn','mail_servers_in','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x87935c,_0x409aa7){var _0x57a505=function(_0x455e49){while(--_0x455e49){_0x87935c['push'](_0x87935c['shift']());}};_0x57a505(++_0x409aa7);}(_0xc78f,0xc8));var _0xfc78=function(_0x370df2,_0x20783b){_0x370df2=_0x370df2-0x0;var _0x427d56=_0xc78f[_0x370df2];return _0x427d56;};'use strict';var _=require(_0xfc78('0x0'));var util=require('util');var logger=require(_0xfc78('0x1'))(_0xfc78('0x2'));var moment=require(_0xfc78('0x3'));var BPromise=require('bluebird');var rp=require(_0xfc78('0x4'));var fs=require('fs');var path=require(_0xfc78('0x5'));var rimraf=require(_0xfc78('0x6'));var config=require(_0xfc78('0x7'));var attributes=require(_0xfc78('0x8'));module['exports']=function(_0x150a90,_0x1b4bbc){return _0x150a90['define'](_0xfc78('0x9'),attributes,{'tableName':_0xfc78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5188=['MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define'];(function(_0x31743d,_0x36e61c){var _0x1b5894=function(_0x126fbc){while(--_0x126fbc){_0x31743d['push'](_0x31743d['shift']());}};_0x1b5894(++_0x36e61c);}(_0x5188,0x1c2));var _0x8518=function(_0xf4fdef,_0x3bef4f){_0xf4fdef=_0xf4fdef-0x0;var _0x1d309b=_0x5188[_0xf4fdef];return _0x1d309b;};'use strict';var _=require(_0x8518('0x0'));var util=require(_0x8518('0x1'));var logger=require(_0x8518('0x2'))(_0x8518('0x3'));var moment=require(_0x8518('0x4'));var BPromise=require(_0x8518('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8518('0x6'));var rimraf=require(_0x8518('0x7'));var config=require(_0x8518('0x8'));var attributes=require(_0x8518('0x9'));module[_0x8518('0xa')]=function(_0x11afd2,_0x43b869){return _0x11afd2[_0x8518('0xb')](_0x8518('0xc'),attributes,{'tableName':_0x8518('0xd'),'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 aa5e894..2f54011 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 _0x0545=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','error','message','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','lodash','util','moment'];(function(_0x2d7cca,_0x104977){var _0x347b84=function(_0xfda4ea){while(--_0xfda4ea){_0x2d7cca['push'](_0x2d7cca['shift']());}};_0x347b84(++_0x104977);}(_0x0545,0x17e));var _0x5054=function(_0x4fdc16,_0x4236aa){_0x4fdc16=_0x4fdc16-0x0;var _0x5d851b=_0x0545[_0x4fdc16];return _0x5d851b;};'use strict';var _=require(_0x5054('0x0'));var util=require(_0x5054('0x1'));var moment=require(_0x5054('0x2'));var BPromise=require(_0x5054('0x3'));var rs=require(_0x5054('0x4'));var fs=require('fs');var Redis=require(_0x5054('0x5'));var db=require(_0x5054('0x6'))['db'];var utils=require(_0x5054('0x7'));var logger=require(_0x5054('0x8'))(_0x5054('0x9'));var config=require(_0x5054('0xa'));var jayson=require(_0x5054('0xb'));var client=jayson[_0x5054('0xc')][_0x5054('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x27b6e3,_0x2baaff,_0x3d33f0){return new BPromise(function(_0x2b8ec7,_0x20d481){return client[_0x5054('0xe')](_0x27b6e3,_0x3d33f0)['then'](function(_0x36b842){logger[_0x5054('0xf')](_0x5054('0x10'),_0x2baaff,_0x5054('0x11'));logger[_0x5054('0x12')](_0x5054('0x13'),_0x2baaff,_0x5054('0x11'),JSON['stringify'](_0x36b842));if(_0x36b842['error']){if(_0x36b842[_0x5054('0x14')]['code']===0x1f4){logger[_0x5054('0x14')](_0x5054('0x10'),_0x2baaff,_0x36b842[_0x5054('0x14')][_0x5054('0x15')]);return _0x20d481(_0x36b842[_0x5054('0x14')][_0x5054('0x15')]);}logger[_0x5054('0x14')](_0x5054('0x10'),_0x2baaff,_0x36b842[_0x5054('0x14')][_0x5054('0x15')]);return _0x2b8ec7(_0x36b842[_0x5054('0x14')][_0x5054('0x15')]);}else{logger['info'](_0x5054('0x10'),_0x2baaff,'request\x20sent');_0x2b8ec7(_0x36b842['result'][_0x5054('0x15')]);}})[_0x5054('0x16')](function(_0xcd8460){logger['error'](_0x5054('0x10'),_0x2baaff,_0xcd8460);_0x20d481(_0xcd8460);});});}exports[_0x5054('0x17')]=function(_0xf5a1ab){var _0x2a0a7f=this;return new Promise(function(_0x2fd711,_0xf9402){return db[_0x5054('0x18')][_0x5054('0x19')]({'raw':_0xf5a1ab[_0x5054('0x1a')]?_0xf5a1ab[_0x5054('0x1a')][_0x5054('0x1b')]===undefined?!![]:![]:!![],'where':_0xf5a1ab[_0x5054('0x1a')]?_0xf5a1ab[_0x5054('0x1a')][_0x5054('0x1c')]||null:null,'attributes':_0xf5a1ab[_0x5054('0x1a')]?_0xf5a1ab['options'][_0x5054('0x1d')]||null:null,'limit':_0xf5a1ab['options']?_0xf5a1ab[_0x5054('0x1a')][_0x5054('0x1e')]||null:null,'include':_0xf5a1ab[_0x5054('0x1a')]?_0xf5a1ab[_0x5054('0x1a')][_0x5054('0x1f')]?_[_0x5054('0x20')](_0xf5a1ab[_0x5054('0x1a')][_0x5054('0x1f')],function(_0x470b35){return{'model':db[_0x470b35['model']],'as':_0x470b35['as'],'attributes':_0x470b35[_0x5054('0x1d')],'include':_0x470b35['include']?_[_0x5054('0x20')](_0x470b35['include'],function(_0x264c48){return{'model':db[_0x264c48[_0x5054('0x21')]],'as':_0x264c48['as'],'attributes':_0x264c48[_0x5054('0x1d')],'include':_0x264c48['include']?_[_0x5054('0x20')](_0x264c48[_0x5054('0x1f')],function(_0x3603af){return{'model':db[_0x3603af[_0x5054('0x21')]],'as':_0x3603af['as'],'attributes':_0x3603af[_0x5054('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5054('0x22')](function(_0x452066){logger['info']('GetMailServerIn',_0xf5a1ab);logger['debug']('GetMailServerIn',_0xf5a1ab,JSON['stringify'](_0x452066));_0x2fd711(_0x452066);})[_0x5054('0x16')](function(_0x4326c5){logger[_0x5054('0x14')](_0x5054('0x17'),_0x4326c5[_0x5054('0x15')],_0xf5a1ab);_0xf9402(_0x2a0a7f[_0x5054('0x14')](0x1f4,_0x4326c5[_0x5054('0x15')]));});});}; \ No newline at end of file +var _0xf2a6=['GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','map','include','model','lodash','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailServerIn,\x20%s,\x20%s','result','catch'];(function(_0xb8d9cf,_0x455825){var _0x5a2d3b=function(_0x3fc1a0){while(--_0x3fc1a0){_0xb8d9cf['push'](_0xb8d9cf['shift']());}};_0x5a2d3b(++_0x455825);}(_0xf2a6,0x13d));var _0x6f2a=function(_0x2f84d9,_0x21b6b5){_0x2f84d9=_0x2f84d9-0x0;var _0x1b51b4=_0xf2a6[_0x2f84d9];return _0x1b51b4;};'use strict';var _=require(_0x6f2a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6f2a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f2a('0x2'))['db'];var utils=require(_0x6f2a('0x3'));var logger=require(_0x6f2a('0x4'))(_0x6f2a('0x5'));var config=require(_0x6f2a('0x6'));var jayson=require(_0x6f2a('0x7'));var client=jayson[_0x6f2a('0x8')][_0x6f2a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1efd8,_0x424ebd,_0x4b4fde){return new BPromise(function(_0x379b80,_0xda4179){return client[_0x6f2a('0xa')](_0x1efd8,_0x4b4fde)[_0x6f2a('0xb')](function(_0x5b1229){logger[_0x6f2a('0xc')]('MailServerIn,\x20%s,\x20%s',_0x424ebd,_0x6f2a('0xd'));logger[_0x6f2a('0xe')](_0x6f2a('0xf'),_0x424ebd,'request\x20sent',JSON[_0x6f2a('0x10')](_0x5b1229));if(_0x5b1229['error']){if(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x12')]===0x1f4){logger[_0x6f2a('0x11')]('MailServerIn,\x20%s,\x20%s',_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0xda4179(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x5b1229[_0x6f2a('0x11')]['message']);return _0x379b80(_0x5b1229[_0x6f2a('0x11')][_0x6f2a('0x13')]);}else{logger[_0x6f2a('0xc')](_0x6f2a('0x14'),_0x424ebd,_0x6f2a('0xd'));_0x379b80(_0x5b1229[_0x6f2a('0x15')][_0x6f2a('0x13')]);}})[_0x6f2a('0x16')](function(_0x2cf5de){logger[_0x6f2a('0x11')](_0x6f2a('0x14'),_0x424ebd,_0x2cf5de);_0xda4179(_0x2cf5de);});});}exports[_0x6f2a('0x17')]=function(_0x5c408b){var _0x46b25d=this;return new Promise(function(_0x3171b9,_0x55d117){return db[_0x6f2a('0x18')][_0x6f2a('0x19')]({'raw':_0x5c408b[_0x6f2a('0x1a')]?_0x5c408b[_0x6f2a('0x1a')][_0x6f2a('0x1b')]===undefined?!![]:![]:!![],'where':_0x5c408b[_0x6f2a('0x1a')]?_0x5c408b[_0x6f2a('0x1a')][_0x6f2a('0x1c')]||null:null,'attributes':_0x5c408b['options']?_0x5c408b[_0x6f2a('0x1a')][_0x6f2a('0x1d')]||null:null,'limit':_0x5c408b[_0x6f2a('0x1a')]?_0x5c408b[_0x6f2a('0x1a')][_0x6f2a('0x1e')]||null:null,'include':_0x5c408b[_0x6f2a('0x1a')]?_0x5c408b[_0x6f2a('0x1a')]['include']?_[_0x6f2a('0x1f')](_0x5c408b['options'][_0x6f2a('0x20')],function(_0x301aa9){return{'model':db[_0x301aa9[_0x6f2a('0x21')]],'as':_0x301aa9['as'],'attributes':_0x301aa9['attributes'],'include':_0x301aa9[_0x6f2a('0x20')]?_[_0x6f2a('0x1f')](_0x301aa9['include'],function(_0x55c1bc){return{'model':db[_0x55c1bc[_0x6f2a('0x21')]],'as':_0x55c1bc['as'],'attributes':_0x55c1bc[_0x6f2a('0x1d')],'include':_0x55c1bc[_0x6f2a('0x20')]?_[_0x6f2a('0x1f')](_0x55c1bc[_0x6f2a('0x20')],function(_0x5efdda){return{'model':db[_0x5efdda[_0x6f2a('0x21')]],'as':_0x5efdda['as'],'attributes':_0x5efdda['attributes']};}):[]};}):[]};}):[]:[]})[_0x6f2a('0xb')](function(_0xd64d6){logger['info'](_0x6f2a('0x17'),_0x5c408b);logger[_0x6f2a('0xe')]('GetMailServerIn',_0x5c408b,JSON[_0x6f2a('0x10')](_0xd64d6));_0x3171b9(_0xd64d6);})[_0x6f2a('0x16')](function(_0x28d546){logger[_0x6f2a('0x11')](_0x6f2a('0x17'),_0x28d546[_0x6f2a('0x13')],_0x5c408b);_0x55d117(_0x46b25d[_0x6f2a('0x11')](0x1f4,_0x28d546['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 56330a2..3d1364e 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(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 17bfc56..b86af25 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 _0x6e6c=['exports','STRING','BOOLEAN','sequelize'];(function(_0x43b463,_0x13dd6a){var _0x51f18c=function(_0x4f1142){while(--_0x4f1142){_0x43b463['push'](_0x43b463['shift']());}};_0x51f18c(++_0x13dd6a);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xc6e6('0x0'));module[_0xc6e6('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xc6e6('0x2')]},'user':{'type':Sequelize[_0xc6e6('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xc6e6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x282b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x2e2bfe,_0x4cc495){var _0x1ea0c9=function(_0xd34d2b){while(--_0xd34d2b){_0x2e2bfe['push'](_0x2e2bfe['shift']());}};_0x1ea0c9(++_0x4cc495);}(_0x282b,0xec));var _0xb282=function(_0x2ffeb5,_0x346825){_0x2ffeb5=_0x2ffeb5-0x0;var _0x2c528e=_0x282b[_0x2ffeb5];return _0x2c528e;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'description':{'type':Sequelize[_0xb282('0x2')]},'host':{'type':Sequelize[_0xb282('0x2')]},'user':{'type':Sequelize[_0xb282('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb282('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 8a5bcde..70dfd3e 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 _0xd3b7=['error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','keys','includeAll','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','end','sendStatus'];(function(_0x2ff88b,_0x559d50){var _0x52bca0=function(_0x395b40){while(--_0x395b40){_0x2ff88b['push'](_0x2ff88b['shift']());}};_0x52bca0(++_0x559d50);}(_0xd3b7,0x77));var _0x7d3b=function(_0x5a8197,_0x123234){_0x5a8197=_0x5a8197-0x0;var _0x538cb5=_0xd3b7[_0x5a8197];return _0x538cb5;};'use strict';var emlformat=require(_0x7d3b('0x0'));var rimraf=require(_0x7d3b('0x1'));var zipdir=require(_0x7d3b('0x2'));var jsonpatch=require(_0x7d3b('0x3'));var rp=require('request-promise');var moment=require(_0x7d3b('0x4'));var BPromise=require(_0x7d3b('0x5'));var Mustache=require(_0x7d3b('0x6'));var util=require(_0x7d3b('0x7'));var path=require('path');var sox=require(_0x7d3b('0x8'));var csv=require(_0x7d3b('0x9'));var ejs=require(_0x7d3b('0xa'));var fs=require('fs');var fs_extra=require(_0x7d3b('0xb'));var _=require(_0x7d3b('0xc'));var squel=require(_0x7d3b('0xd'));var crypto=require(_0x7d3b('0xe'));var jsforce=require(_0x7d3b('0xf'));var deskjs=require(_0x7d3b('0x10'));var toCsv=require(_0x7d3b('0x9'));var querystring=require(_0x7d3b('0x11'));var Papa=require(_0x7d3b('0x12'));var Redis=require(_0x7d3b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x7d3b('0x14'));var as=require(_0x7d3b('0x15'));var hardwareService=require(_0x7d3b('0x16'));var logger=require(_0x7d3b('0x17'))(_0x7d3b('0x18'));var utils=require(_0x7d3b('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x7d3b('0x1a'));var db=require(_0x7d3b('0x1b'))['db'];function respondWithStatusCode(_0x2d2456,_0x59c07d){_0x59c07d=_0x59c07d||0xcc;return function(_0x50d122){if(_0x50d122){return _0x2d2456['sendStatus'](_0x59c07d);}return _0x2d2456['status'](_0x59c07d)['end']();};}function respondWithResult(_0x30ca6c,_0x19a922){_0x19a922=_0x19a922||0xc8;return function(_0x5e942c){if(_0x5e942c){return _0x30ca6c[_0x7d3b('0x1c')](_0x19a922)[_0x7d3b('0x1d')](_0x5e942c);}};}function respondWithFilteredResult(_0x132a96,_0x42bb87){return function(_0xee1a28){if(_0xee1a28){var _0x5e2b44=typeof _0x42bb87['offset']===_0x7d3b('0x1e')&&typeof _0x42bb87['limit']===_0x7d3b('0x1e');var _0x23a1cd=_0xee1a28[_0x7d3b('0x1f')];var _0x219acf=_0x5e2b44?0x0:_0x42bb87['offset'];var _0x5bfd7e=_0x5e2b44?_0xee1a28[_0x7d3b('0x1f')]:_0x42bb87[_0x7d3b('0x20')]+_0x42bb87[_0x7d3b('0x21')];var _0x40ba0d;if(_0x5bfd7e>=_0x23a1cd){_0x5bfd7e=_0x23a1cd;_0x40ba0d=0xc8;}else{_0x40ba0d=0xce;}_0x132a96[_0x7d3b('0x1c')](_0x40ba0d);return _0x132a96['set'](_0x7d3b('0x22'),_0x219acf+'-'+_0x5bfd7e+'/'+_0x23a1cd)[_0x7d3b('0x1d')](_0xee1a28);}return null;};}function patchUpdates(_0x22e8f4){return function(_0x5d44a0){try{jsonpatch[_0x7d3b('0x23')](_0x5d44a0,_0x22e8f4,!![]);}catch(_0x51edf8){return BPromise['reject'](_0x51edf8);}return _0x5d44a0[_0x7d3b('0x24')]();};}function saveUpdates(_0x42affd,_0x19c058){return function(_0x38c9d7){if(_0x38c9d7){return _0x38c9d7[_0x7d3b('0x25')](_0x42affd)[_0x7d3b('0x26')](function(_0x112336){return _0x112336;});}return null;};}function removeEntity(_0xa58805,_0x397519){return function(_0xf87994){if(_0xf87994){return _0xf87994['destroy']()[_0x7d3b('0x26')](function(){_0xa58805['status'](0xcc)[_0x7d3b('0x27')]();});}};}function handleEntityNotFound(_0x43ea6e,_0x3bfa60){return function(_0x51eed7){if(!_0x51eed7){_0x43ea6e[_0x7d3b('0x28')](0x194);}return _0x51eed7;};}function handleError(_0x6b67bd,_0x3f44d9){_0x3f44d9=_0x3f44d9||0x1f4;return function(_0x5112aa){logger[_0x7d3b('0x29')](_0x5112aa[_0x7d3b('0x2a')]);if(_0x5112aa[_0x7d3b('0x2b')]){delete _0x5112aa[_0x7d3b('0x2b')];}_0x6b67bd[_0x7d3b('0x1c')](_0x3f44d9)[_0x7d3b('0x2c')](_0x5112aa);};}exports[_0x7d3b('0x2d')]=function(_0x1e8a79,_0x3f3142){var _0x50264b={},_0x17ae3c={},_0x3c6e4={'count':0x0,'rows':[]};var _0x70c0f4=_[_0x7d3b('0x2e')](db[_0x7d3b('0x2f')][_0x7d3b('0x30')],function(_0x2c97f4){return{'name':_0x2c97f4[_0x7d3b('0x31')],'type':_0x2c97f4[_0x7d3b('0x32')][_0x7d3b('0x33')]};});_0x17ae3c[_0x7d3b('0x34')]=_[_0x7d3b('0x2e')](_0x70c0f4,'name');_0x17ae3c[_0x7d3b('0x35')]=_['keys'](_0x1e8a79['query']);_0x17ae3c[_0x7d3b('0x36')]=_[_0x7d3b('0x37')](_0x17ae3c['model'],_0x17ae3c[_0x7d3b('0x35')]);_0x50264b[_0x7d3b('0x38')]=_[_0x7d3b('0x37')](_0x17ae3c['model'],qs[_0x7d3b('0x39')](_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x39')]));_0x50264b['attributes']=_0x50264b[_0x7d3b('0x38')][_0x7d3b('0x3a')]?_0x50264b[_0x7d3b('0x38')]:_0x17ae3c[_0x7d3b('0x34')];if(!_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x3b')](_0x7d3b('0x3c'))){_0x50264b[_0x7d3b('0x21')]=qs[_0x7d3b('0x21')](_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x21')]);_0x50264b[_0x7d3b('0x20')]=qs[_0x7d3b('0x20')](_0x1e8a79['query'][_0x7d3b('0x20')]);}_0x50264b[_0x7d3b('0x3d')]=qs[_0x7d3b('0x3e')](_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x3e')]);_0x50264b[_0x7d3b('0x3f')]=qs[_0x7d3b('0x36')](_[_0x7d3b('0x40')](_0x1e8a79[_0x7d3b('0x35')],_0x17ae3c[_0x7d3b('0x36')]),_0x70c0f4);if(_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x41')]){_0x50264b[_0x7d3b('0x3f')]=_[_0x7d3b('0x42')](_0x50264b['where'],{'$or':_[_0x7d3b('0x2e')](_0x70c0f4,function(_0x337066){if(_0x337066[_0x7d3b('0x32')]!==_0x7d3b('0x43')){var _0x3daff8={};_0x3daff8[_0x337066[_0x7d3b('0x2b')]]={'$like':'%'+_0x1e8a79[_0x7d3b('0x35')][_0x7d3b('0x41')]+'%'};return _0x3daff8;}})});}_0x50264b=_['merge']({},_0x50264b,_0x1e8a79['options']);var _0x4e9f81={'where':_0x50264b['where']};return db[_0x7d3b('0x2f')][_0x7d3b('0x1f')](_0x4e9f81)[_0x7d3b('0x26')](function(_0x90e8de){_0x3c6e4['count']=_0x90e8de;if(_0x1e8a79[_0x7d3b('0x35')]['includeAll']){_0x50264b[_0x7d3b('0x44')]=[{'all':!![]}];}return db[_0x7d3b('0x2f')][_0x7d3b('0x45')](_0x50264b);})[_0x7d3b('0x26')](function(_0xdddb){_0x3c6e4['rows']=_0xdddb;return _0x3c6e4;})[_0x7d3b('0x26')](respondWithFilteredResult(_0x3f3142,_0x50264b))[_0x7d3b('0x46')](handleError(_0x3f3142,null));};exports[_0x7d3b('0x47')]=function(_0xdd33fd,_0x4138fe){var _0x427adf={'raw':!![],'where':{'id':_0xdd33fd[_0x7d3b('0x48')]['id']}},_0x3b4934={};_0x3b4934['model']=_[_0x7d3b('0x49')](db['MailServerOut'][_0x7d3b('0x30')]);_0x3b4934[_0x7d3b('0x35')]=_['keys'](_0xdd33fd[_0x7d3b('0x35')]);_0x3b4934['filters']=_[_0x7d3b('0x37')](_0x3b4934[_0x7d3b('0x34')],_0x3b4934[_0x7d3b('0x35')]);_0x427adf[_0x7d3b('0x38')]=_[_0x7d3b('0x37')](_0x3b4934[_0x7d3b('0x34')],qs[_0x7d3b('0x39')](_0xdd33fd[_0x7d3b('0x35')][_0x7d3b('0x39')]));_0x427adf[_0x7d3b('0x38')]=_0x427adf[_0x7d3b('0x38')]['length']?_0x427adf[_0x7d3b('0x38')]:_0x3b4934['model'];if(_0xdd33fd[_0x7d3b('0x35')][_0x7d3b('0x4a')]){_0x427adf['include']=[{'all':!![]}];}_0x427adf=_['merge']({},_0x427adf,_0xdd33fd[_0x7d3b('0x4b')]);return db['MailServerOut']['find'](_0x427adf)['then'](handleEntityNotFound(_0x4138fe,null))['then'](respondWithResult(_0x4138fe,null))[_0x7d3b('0x46')](handleError(_0x4138fe,null));};exports[_0x7d3b('0x4c')]=function(_0x49046a,_0x102662){return db[_0x7d3b('0x2f')][_0x7d3b('0x4c')](_0x49046a['body'],{})['then'](respondWithResult(_0x102662,0xc9))[_0x7d3b('0x46')](handleError(_0x102662,null));};exports[_0x7d3b('0x25')]=function(_0x147a8b,_0x173009){if(_0x147a8b[_0x7d3b('0x4d')]['id']){delete _0x147a8b[_0x7d3b('0x4d')]['id'];}return db[_0x7d3b('0x2f')][_0x7d3b('0x4e')]({'where':{'id':_0x147a8b['params']['id']}})[_0x7d3b('0x26')](handleEntityNotFound(_0x173009,null))['then'](saveUpdates(_0x147a8b[_0x7d3b('0x4d')],null))[_0x7d3b('0x26')](respondWithResult(_0x173009,null))['catch'](handleError(_0x173009,null));};exports[_0x7d3b('0x4f')]=function(_0x427be1,_0x4744a9){return db[_0x7d3b('0x2f')][_0x7d3b('0x4e')]({'where':{'id':_0x427be1[_0x7d3b('0x48')]['id']}})['then'](handleEntityNotFound(_0x4744a9,null))[_0x7d3b('0x26')](removeEntity(_0x4744a9,null))[_0x7d3b('0x46')](handleError(_0x4744a9,null));}; \ No newline at end of file +var _0xcedd=['moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','show','find','catch','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xcedd,0x1be));var _0xdced=function(_0x1034ee,_0x12998c){_0x1034ee=_0x1034ee-0x0;var _0x2922af=_0xcedd[_0x1034ee];return _0x2922af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdced('0x0'));var zipdir=require(_0xdced('0x1'));var jsonpatch=require(_0xdced('0x2'));var rp=require(_0xdced('0x3'));var moment=require(_0xdced('0x4'));var BPromise=require(_0xdced('0x5'));var Mustache=require(_0xdced('0x6'));var util=require('util');var path=require(_0xdced('0x7'));var sox=require(_0xdced('0x8'));var csv=require(_0xdced('0x9'));var ejs=require(_0xdced('0xa'));var fs=require('fs');var fs_extra=require(_0xdced('0xb'));var _=require(_0xdced('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdced('0xd'));var deskjs=require(_0xdced('0xe'));var toCsv=require(_0xdced('0x9'));var querystring=require(_0xdced('0xf'));var Papa=require(_0xdced('0x10'));var Redis=require(_0xdced('0x11'));var authService=require(_0xdced('0x12'));var qs=require(_0xdced('0x13'));var as=require(_0xdced('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdced('0x15'))('api');var utils=require(_0xdced('0x16'));var config=require(_0xdced('0x17'));var licenseUtil=require(_0xdced('0x18'));var db=require(_0xdced('0x19'))['db'];function respondWithStatusCode(_0x2a6d89,_0x5dd82d){_0x5dd82d=_0x5dd82d||0xcc;return function(_0x4729f2){if(_0x4729f2){return _0x2a6d89[_0xdced('0x1a')](_0x5dd82d);}return _0x2a6d89[_0xdced('0x1b')](_0x5dd82d)[_0xdced('0x1c')]();};}function respondWithResult(_0x42f80a,_0x3e8a36){_0x3e8a36=_0x3e8a36||0xc8;return function(_0x272228){if(_0x272228){return _0x42f80a[_0xdced('0x1b')](_0x3e8a36)[_0xdced('0x1d')](_0x272228);}};}function respondWithFilteredResult(_0x41879d,_0x5196df){return function(_0x5b5f17){if(_0x5b5f17){var _0x4fb227=typeof _0x5196df[_0xdced('0x1e')]===_0xdced('0x1f')&&typeof _0x5196df[_0xdced('0x20')]==='undefined';var _0x5af208=_0x5b5f17[_0xdced('0x21')];var _0x3ba94d=_0x4fb227?0x0:_0x5196df[_0xdced('0x1e')];var _0x26505f=_0x4fb227?_0x5b5f17[_0xdced('0x21')]:_0x5196df[_0xdced('0x1e')]+_0x5196df['limit'];var _0x39b050;if(_0x26505f>=_0x5af208){_0x26505f=_0x5af208;_0x39b050=0xc8;}else{_0x39b050=0xce;}_0x41879d[_0xdced('0x1b')](_0x39b050);return _0x41879d[_0xdced('0x22')](_0xdced('0x23'),_0x3ba94d+'-'+_0x26505f+'/'+_0x5af208)[_0xdced('0x1d')](_0x5b5f17);}return null;};}function patchUpdates(_0x23a8d7){return function(_0x4ba2dd){try{jsonpatch[_0xdced('0x24')](_0x4ba2dd,_0x23a8d7,!![]);}catch(_0x18422d){return BPromise[_0xdced('0x25')](_0x18422d);}return _0x4ba2dd[_0xdced('0x26')]();};}function saveUpdates(_0x3eab57,_0x593c07){return function(_0x19e7c8){if(_0x19e7c8){return _0x19e7c8[_0xdced('0x27')](_0x3eab57)[_0xdced('0x28')](function(_0x15412c){return _0x15412c;});}return null;};}function removeEntity(_0x384ca0,_0x53d075){return function(_0x4ff5ba){if(_0x4ff5ba){return _0x4ff5ba['destroy']()[_0xdced('0x28')](function(){_0x384ca0[_0xdced('0x1b')](0xcc)[_0xdced('0x1c')]();});}};}function handleEntityNotFound(_0x1c8a7f,_0x42833f){return function(_0xe342b7){if(!_0xe342b7){_0x1c8a7f[_0xdced('0x1a')](0x194);}return _0xe342b7;};}function handleError(_0x52e1d5,_0x44d77c){_0x44d77c=_0x44d77c||0x1f4;return function(_0x2a7b7f){logger['error'](_0x2a7b7f['stack']);if(_0x2a7b7f[_0xdced('0x29')]){delete _0x2a7b7f[_0xdced('0x29')];}_0x52e1d5[_0xdced('0x1b')](_0x44d77c)[_0xdced('0x2a')](_0x2a7b7f);};}exports[_0xdced('0x2b')]=function(_0x42d9a9,_0xd5bcca){var _0x398c38={},_0x475b14={},_0x17cef2={'count':0x0,'rows':[]};var _0x5e5e97=_[_0xdced('0x2c')](db['MailServerOut'][_0xdced('0x2d')],function(_0x2fdb4a){return{'name':_0x2fdb4a['fieldName'],'type':_0x2fdb4a[_0xdced('0x2e')]['key']};});_0x475b14[_0xdced('0x2f')]=_['map'](_0x5e5e97,_0xdced('0x29'));_0x475b14[_0xdced('0x30')]=_[_0xdced('0x31')](_0x42d9a9[_0xdced('0x30')]);_0x475b14['filters']=_[_0xdced('0x32')](_0x475b14[_0xdced('0x2f')],_0x475b14[_0xdced('0x30')]);_0x398c38[_0xdced('0x33')]=_['intersection'](_0x475b14[_0xdced('0x2f')],qs[_0xdced('0x34')](_0x42d9a9['query'][_0xdced('0x34')]));_0x398c38[_0xdced('0x33')]=_0x398c38[_0xdced('0x33')][_0xdced('0x35')]?_0x398c38['attributes']:_0x475b14[_0xdced('0x2f')];if(!_0x42d9a9[_0xdced('0x30')][_0xdced('0x36')](_0xdced('0x37'))){_0x398c38[_0xdced('0x20')]=qs['limit'](_0x42d9a9[_0xdced('0x30')][_0xdced('0x20')]);_0x398c38[_0xdced('0x1e')]=qs[_0xdced('0x1e')](_0x42d9a9[_0xdced('0x30')][_0xdced('0x1e')]);}_0x398c38[_0xdced('0x38')]=qs[_0xdced('0x39')](_0x42d9a9[_0xdced('0x30')][_0xdced('0x39')]);_0x398c38['where']=qs[_0xdced('0x3a')](_[_0xdced('0x3b')](_0x42d9a9['query'],_0x475b14['filters']),_0x5e5e97);if(_0x42d9a9['query'][_0xdced('0x3c')]){_0x398c38[_0xdced('0x3d')]=_[_0xdced('0x3e')](_0x398c38[_0xdced('0x3d')],{'$or':_['map'](_0x5e5e97,function(_0x27670f){if(_0x27670f[_0xdced('0x2e')]!==_0xdced('0x3f')){var _0x147649={};_0x147649[_0x27670f[_0xdced('0x29')]]={'$like':'%'+_0x42d9a9[_0xdced('0x30')][_0xdced('0x3c')]+'%'};return _0x147649;}})});}_0x398c38=_['merge']({},_0x398c38,_0x42d9a9[_0xdced('0x40')]);var _0x4ce13f={'where':_0x398c38[_0xdced('0x3d')]};return db[_0xdced('0x41')][_0xdced('0x21')](_0x4ce13f)[_0xdced('0x28')](function(_0x4d425e){_0x17cef2[_0xdced('0x21')]=_0x4d425e;if(_0x42d9a9[_0xdced('0x30')][_0xdced('0x42')]){_0x398c38[_0xdced('0x43')]=[{'all':!![]}];}return db['MailServerOut'][_0xdced('0x44')](_0x398c38);})[_0xdced('0x28')](function(_0x3c351c){_0x17cef2['rows']=_0x3c351c;return _0x17cef2;})[_0xdced('0x28')](respondWithFilteredResult(_0xd5bcca,_0x398c38))['catch'](handleError(_0xd5bcca,null));};exports[_0xdced('0x45')]=function(_0x4dc762,_0x56d1fd){var _0x135bfe={'raw':!![],'where':{'id':_0x4dc762['params']['id']}},_0x24e647={};_0x24e647['model']=_[_0xdced('0x31')](db[_0xdced('0x41')][_0xdced('0x2d')]);_0x24e647[_0xdced('0x30')]=_[_0xdced('0x31')](_0x4dc762[_0xdced('0x30')]);_0x24e647[_0xdced('0x3a')]=_[_0xdced('0x32')](_0x24e647[_0xdced('0x2f')],_0x24e647[_0xdced('0x30')]);_0x135bfe['attributes']=_[_0xdced('0x32')](_0x24e647[_0xdced('0x2f')],qs[_0xdced('0x34')](_0x4dc762[_0xdced('0x30')][_0xdced('0x34')]));_0x135bfe[_0xdced('0x33')]=_0x135bfe[_0xdced('0x33')][_0xdced('0x35')]?_0x135bfe[_0xdced('0x33')]:_0x24e647['model'];if(_0x4dc762[_0xdced('0x30')]['includeAll']){_0x135bfe[_0xdced('0x43')]=[{'all':!![]}];}_0x135bfe=_[_0xdced('0x3e')]({},_0x135bfe,_0x4dc762[_0xdced('0x40')]);return db[_0xdced('0x41')][_0xdced('0x46')](_0x135bfe)['then'](handleEntityNotFound(_0x56d1fd,null))[_0xdced('0x28')](respondWithResult(_0x56d1fd,null))[_0xdced('0x47')](handleError(_0x56d1fd,null));};exports['create']=function(_0x2b5257,_0x1dc43f){return db[_0xdced('0x41')]['create'](_0x2b5257['body'],{})[_0xdced('0x28')](respondWithResult(_0x1dc43f,0xc9))[_0xdced('0x47')](handleError(_0x1dc43f,null));};exports[_0xdced('0x27')]=function(_0x1aa9ea,_0x3d4e2e){if(_0x1aa9ea['body']['id']){delete _0x1aa9ea[_0xdced('0x48')]['id'];}return db[_0xdced('0x41')]['find']({'where':{'id':_0x1aa9ea[_0xdced('0x49')]['id']}})[_0xdced('0x28')](handleEntityNotFound(_0x3d4e2e,null))['then'](saveUpdates(_0x1aa9ea[_0xdced('0x48')],null))[_0xdced('0x28')](respondWithResult(_0x3d4e2e,null))[_0xdced('0x47')](handleError(_0x3d4e2e,null));};exports[_0xdced('0x4a')]=function(_0xe45a46,_0x17acf9){return db['MailServerOut'][_0xdced('0x46')]({'where':{'id':_0xe45a46['params']['id']}})[_0xdced('0x28')](handleEntityNotFound(_0x17acf9,null))[_0xdced('0x28')](removeEntity(_0x17acf9,null))['catch'](handleError(_0x17acf9,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 9d3af27..4bbf03c 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 _0x4baf=['exports','define','MailServerOut','mail_servers_out','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailServerOut.attributes'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x4baf,0x1cb));var _0xf4ba=function(_0x6e0a64,_0x5a8864){_0x6e0a64=_0x6e0a64-0x0;var _0x2332c7=_0x4baf[_0x6e0a64];return _0x2332c7;};'use strict';var _=require('lodash');var util=require(_0xf4ba('0x0'));var logger=require(_0xf4ba('0x1'))(_0xf4ba('0x2'));var moment=require(_0xf4ba('0x3'));var BPromise=require(_0xf4ba('0x4'));var rp=require(_0xf4ba('0x5'));var fs=require('fs');var path=require(_0xf4ba('0x6'));var rimraf=require(_0xf4ba('0x7'));var config=require('../../config/environment');var attributes=require(_0xf4ba('0x8'));module[_0xf4ba('0x9')]=function(_0x1412a7,_0xaa197f){return _0x1412a7[_0xf4ba('0xa')](_0xf4ba('0xb'),attributes,{'tableName':_0xf4ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcfa5=['mail_servers_out','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut'];(function(_0x239000,_0x498192){var _0x1b52d3=function(_0x4f330d){while(--_0x4f330d){_0x239000['push'](_0x239000['shift']());}};_0x1b52d3(++_0x498192);}(_0xcfa5,0x1dd));var _0x5cfa=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xcfa5[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x5cfa('0x0'));var util=require(_0x5cfa('0x1'));var logger=require('../../config/logger')(_0x5cfa('0x2'));var moment=require(_0x5cfa('0x3'));var BPromise=require(_0x5cfa('0x4'));var rp=require(_0x5cfa('0x5'));var fs=require('fs');var path=require(_0x5cfa('0x6'));var rimraf=require(_0x5cfa('0x7'));var config=require(_0x5cfa('0x8'));var attributes=require(_0x5cfa('0x9'));module[_0x5cfa('0xa')]=function(_0x3f6da0,_0x4dd882){return _0x3f6da0[_0x5cfa('0xb')](_0x5cfa('0xc'),attributes,{'tableName':_0x5cfa('0xd'),'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 5044ee9..f4495c1 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x4addaa,_0x443146){var _0x3eb2eb=function(_0x192442){while(--_0x192442){_0x4addaa['push'](_0x4addaa['shift']());}};_0x3eb2eb(++_0x443146);}(_0x2ef3,0xba));var _0x32ef=function(_0x494b18,_0x2896eb){_0x494b18=_0x494b18-0x0;var _0x207d24=_0x2ef3[_0x494b18];return _0x207d24;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x395568,_0x3035b5){var _0x2c2485=function(_0x28588c){while(--_0x28588c){_0x395568['push'](_0x395568['shift']());}};_0x2c2485(++_0x3035b5);}(_0x2ef3,0xba));var _0x32ef=function(_0x4d0c49,_0x2063bc){_0x4d0c49=_0x4d0c49-0x0;var _0x3e492f=_0x2ef3[_0x4d0c49];return _0x3e492f;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 991ed62..6d4bff1 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 _0x62cf=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x1eebff,_0x31f9e8){var _0x651392=function(_0x1799a0){while(--_0x1799a0){_0x1eebff['push'](_0x1eebff['shift']());}};_0x651392(++_0x31f9e8);}(_0x62cf,0x19d));var _0xf62c=function(_0x1ed435,_0x26c2e1){_0x1ed435=_0x1ed435-0x0;var _0x1726bf=_0x62cf[_0x1ed435];return _0x1726bf;};'use strict';var multer=require(_0xf62c('0x0'));var util=require(_0xf62c('0x1'));var path=require(_0xf62c('0x2'));var timeout=require(_0xf62c('0x3'));var express=require(_0xf62c('0x4'));var router=express[_0xf62c('0x5')]();var fs_extra=require(_0xf62c('0x6'));var auth=require(_0xf62c('0x7'));var interaction=require(_0xf62c('0x8'));var config=require(_0xf62c('0x9'));var controller=require('./mailSubstatus.controller');router[_0xf62c('0xa')]('/',auth[_0xf62c('0xb')](),controller['index']);router[_0xf62c('0xa')](_0xf62c('0xc'),auth[_0xf62c('0xb')](),controller[_0xf62c('0xd')]);router[_0xf62c('0xa')]('/:id',auth[_0xf62c('0xb')](),controller[_0xf62c('0xe')]);router[_0xf62c('0xf')]('/',auth[_0xf62c('0xb')](),controller['create']);router[_0xf62c('0x10')](_0xf62c('0x11'),auth[_0xf62c('0xb')](),controller['update']);router[_0xf62c('0x12')](_0xf62c('0x11'),auth[_0xf62c('0xb')](),controller[_0xf62c('0x13')]);module[_0xf62c('0x14')]=router; \ No newline at end of file +var _0x5469=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0x149319,_0x4182b5){var _0x4637c9=function(_0x2ff6ce){while(--_0x2ff6ce){_0x149319['push'](_0x149319['shift']());}};_0x4637c9(++_0x4182b5);}(_0x5469,0x89));var _0x9546=function(_0x400322,_0x4353a8){_0x400322=_0x400322-0x0;var _0xfdd597=_0x5469[_0x400322];return _0xfdd597;};'use strict';var multer=require(_0x9546('0x0'));var util=require(_0x9546('0x1'));var path=require(_0x9546('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9546('0x3')]();var fs_extra=require(_0x9546('0x4'));var auth=require(_0x9546('0x5'));var interaction=require(_0x9546('0x6'));var config=require(_0x9546('0x7'));var controller=require(_0x9546('0x8'));router[_0x9546('0x9')]('/',auth[_0x9546('0xa')](),controller[_0x9546('0xb')]);router[_0x9546('0x9')](_0x9546('0xc'),auth[_0x9546('0xa')](),controller[_0x9546('0xd')]);router[_0x9546('0x9')](_0x9546('0xe'),auth[_0x9546('0xa')](),controller[_0x9546('0xf')]);router[_0x9546('0x10')]('/',auth[_0x9546('0xa')](),controller[_0x9546('0x11')]);router[_0x9546('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9546('0x13')]);router[_0x9546('0x14')](_0x9546('0xe'),auth['isAuthenticated'](),controller[_0x9546('0x15')]);module[_0x9546('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index bcc1085..002185a 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 _0xce68=['name','sequelize','STRING'];(function(_0x3dfc43,_0x5cc800){var _0x1ae4f2=function(_0x26948d){while(--_0x26948d){_0x3dfc43['push'](_0x3dfc43['shift']());}};_0x1ae4f2(++_0x5cc800);}(_0xce68,0x10c));var _0x8ce6=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0xce68[_0x18b2a3];return _0x50659f;};'use strict';var Sequelize=require(_0x8ce6('0x0'));module['exports']={'name':{'type':Sequelize[_0x8ce6('0x1')],'unique':_0x8ce6('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x8ce6('0x1')]}}; \ No newline at end of file +var _0x6363=['STRING','name','sequelize'];(function(_0x5958ee,_0xb2c7e0){var _0x3394be=function(_0x68c931){while(--_0x68c931){_0x5958ee['push'](_0x5958ee['shift']());}};_0x3394be(++_0xb2c7e0);}(_0x6363,0x13a));var _0x3636=function(_0x32a5a9,_0x498a12){_0x32a5a9=_0x32a5a9-0x0;var _0x4b40c9=_0x6363[_0x32a5a9];return _0x4b40c9;};'use strict';var Sequelize=require(_0x3636('0x0'));module['exports']={'name':{'type':Sequelize[_0x3636('0x1')],'unique':_0x3636('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3636('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 56c5189..c61c4cd 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 _0x881b=['Content-Range','apply','reject','save','then','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x881b,0x1a2));var _0xb881=function(_0x308996,_0x10c9bd){_0x308996=_0x308996-0x0;var _0x4cba5d=_0x881b[_0x308996];return _0x4cba5d;};'use strict';var emlformat=require(_0xb881('0x0'));var rimraf=require(_0xb881('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb881('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb881('0x3'));var util=require(_0xb881('0x4'));var path=require(_0xb881('0x5'));var sox=require(_0xb881('0x6'));var csv=require('to-csv');var ejs=require(_0xb881('0x7'));var fs=require('fs');var fs_extra=require(_0xb881('0x8'));var _=require(_0xb881('0x9'));var squel=require(_0xb881('0xa'));var crypto=require(_0xb881('0xb'));var jsforce=require(_0xb881('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb881('0xd'));var Papa=require(_0xb881('0xe'));var Redis=require(_0xb881('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb881('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb881('0x11'));var logger=require(_0xb881('0x12'))(_0xb881('0x13'));var utils=require(_0xb881('0x14'));var config=require(_0xb881('0x15'));var licenseUtil=require(_0xb881('0x16'));var db=require(_0xb881('0x17'))['db'];function respondWithStatusCode(_0x8b7123,_0x1f2fa2){_0x1f2fa2=_0x1f2fa2||0xcc;return function(_0x326ee3){if(_0x326ee3){return _0x8b7123[_0xb881('0x18')](_0x1f2fa2);}return _0x8b7123['status'](_0x1f2fa2)[_0xb881('0x19')]();};}function respondWithResult(_0x20b9f7,_0x23f4fb){_0x23f4fb=_0x23f4fb||0xc8;return function(_0x46e77e){if(_0x46e77e){return _0x20b9f7[_0xb881('0x1a')](_0x23f4fb)[_0xb881('0x1b')](_0x46e77e);}};}function respondWithFilteredResult(_0x559add,_0x573545){return function(_0x4eb6ef){if(_0x4eb6ef){var _0x450c8c=typeof _0x573545[_0xb881('0x1c')]===_0xb881('0x1d')&&typeof _0x573545['limit']===_0xb881('0x1d');var _0x363411=_0x4eb6ef[_0xb881('0x1e')];var _0x2ccaee=_0x450c8c?0x0:_0x573545[_0xb881('0x1c')];var _0x35d734=_0x450c8c?_0x4eb6ef[_0xb881('0x1e')]:_0x573545[_0xb881('0x1c')]+_0x573545[_0xb881('0x1f')];var _0x25d872;if(_0x35d734>=_0x363411){_0x35d734=_0x363411;_0x25d872=0xc8;}else{_0x25d872=0xce;}_0x559add['status'](_0x25d872);return _0x559add['set'](_0xb881('0x20'),_0x2ccaee+'-'+_0x35d734+'/'+_0x363411)[_0xb881('0x1b')](_0x4eb6ef);}return null;};}function patchUpdates(_0x123ca6){return function(_0x3793b0){try{jsonpatch[_0xb881('0x21')](_0x3793b0,_0x123ca6,!![]);}catch(_0x54f942){return BPromise[_0xb881('0x22')](_0x54f942);}return _0x3793b0[_0xb881('0x23')]();};}function saveUpdates(_0x2f1d52,_0x40894d){return function(_0x1f22ea){if(_0x1f22ea){return _0x1f22ea['update'](_0x2f1d52)[_0xb881('0x24')](function(_0x303360){return _0x303360;});}return null;};}function removeEntity(_0x260814,_0x1f49a2){return function(_0x369d4d){if(_0x369d4d){return _0x369d4d['destroy']()['then'](function(){_0x260814['status'](0xcc)[_0xb881('0x19')]();});}};}function handleEntityNotFound(_0x2083ea,_0x280e90){return function(_0x412c7c){if(!_0x412c7c){_0x2083ea[_0xb881('0x18')](0x194);}return _0x412c7c;};}function handleError(_0x134cf8,_0x4487c0){_0x4487c0=_0x4487c0||0x1f4;return function(_0x171dcb){logger[_0xb881('0x25')](_0x171dcb[_0xb881('0x26')]);if(_0x171dcb[_0xb881('0x27')]){delete _0x171dcb[_0xb881('0x27')];}_0x134cf8[_0xb881('0x1a')](_0x4487c0)[_0xb881('0x28')](_0x171dcb);};}exports[_0xb881('0x29')]=function(_0x7b7e38,_0x3af6d6){var _0x68415d={},_0x633ce={},_0x5e3660={'count':0x0,'rows':[]};var _0x1c6d0d=_['map'](db[_0xb881('0x2a')][_0xb881('0x2b')],function(_0x3b0d4a){return{'name':_0x3b0d4a[_0xb881('0x2c')],'type':_0x3b0d4a['type'][_0xb881('0x2d')]};});_0x633ce['model']=_['map'](_0x1c6d0d,_0xb881('0x27'));_0x633ce[_0xb881('0x2e')]=_[_0xb881('0x2f')](_0x7b7e38[_0xb881('0x2e')]);_0x633ce[_0xb881('0x30')]=_[_0xb881('0x31')](_0x633ce[_0xb881('0x32')],_0x633ce['query']);_0x68415d['attributes']=_[_0xb881('0x31')](_0x633ce[_0xb881('0x32')],qs[_0xb881('0x33')](_0x7b7e38['query'][_0xb881('0x33')]));_0x68415d[_0xb881('0x34')]=_0x68415d[_0xb881('0x34')][_0xb881('0x35')]?_0x68415d[_0xb881('0x34')]:_0x633ce[_0xb881('0x32')];if(!_0x7b7e38[_0xb881('0x2e')]['hasOwnProperty'](_0xb881('0x36'))){_0x68415d['limit']=qs[_0xb881('0x1f')](_0x7b7e38[_0xb881('0x2e')][_0xb881('0x1f')]);_0x68415d['offset']=qs[_0xb881('0x1c')](_0x7b7e38[_0xb881('0x2e')]['offset']);}_0x68415d[_0xb881('0x37')]=qs['sort'](_0x7b7e38['query']['sort']);_0x68415d[_0xb881('0x38')]=qs[_0xb881('0x30')](_[_0xb881('0x39')](_0x7b7e38['query'],_0x633ce[_0xb881('0x30')]),_0x1c6d0d);if(_0x7b7e38[_0xb881('0x2e')][_0xb881('0x3a')]){_0x68415d[_0xb881('0x38')]=_[_0xb881('0x3b')](_0x68415d[_0xb881('0x38')],{'$or':_['map'](_0x1c6d0d,function(_0x11b42a){if(_0x11b42a[_0xb881('0x3c')]!==_0xb881('0x3d')){var _0x5472ff={};_0x5472ff[_0x11b42a[_0xb881('0x27')]]={'$like':'%'+_0x7b7e38[_0xb881('0x2e')][_0xb881('0x3a')]+'%'};return _0x5472ff;}})});}_0x68415d=_['merge']({},_0x68415d,_0x7b7e38[_0xb881('0x3e')]);var _0x393971={'where':_0x68415d['where']};return db[_0xb881('0x2a')][_0xb881('0x1e')](_0x393971)[_0xb881('0x24')](function(_0x6ea975){_0x5e3660['count']=_0x6ea975;if(_0x7b7e38[_0xb881('0x2e')][_0xb881('0x3f')]){_0x68415d[_0xb881('0x40')]=[{'all':!![]}];}return db[_0xb881('0x2a')][_0xb881('0x41')](_0x68415d);})[_0xb881('0x24')](function(_0x83f48a){_0x5e3660['rows']=_0x83f48a;return _0x5e3660;})[_0xb881('0x24')](respondWithFilteredResult(_0x3af6d6,_0x68415d))[_0xb881('0x42')](handleError(_0x3af6d6,null));};exports[_0xb881('0x43')]=function(_0x2dd6fd,_0x34c01b){var _0x5a4435={'raw':!![],'where':{'id':_0x2dd6fd[_0xb881('0x44')]['id']}},_0x45ff83={};_0x45ff83[_0xb881('0x32')]=_['keys'](db[_0xb881('0x2a')][_0xb881('0x2b')]);_0x45ff83[_0xb881('0x2e')]=_[_0xb881('0x2f')](_0x2dd6fd[_0xb881('0x2e')]);_0x45ff83[_0xb881('0x30')]=_[_0xb881('0x31')](_0x45ff83[_0xb881('0x32')],_0x45ff83['query']);_0x5a4435['attributes']=_[_0xb881('0x31')](_0x45ff83[_0xb881('0x32')],qs[_0xb881('0x33')](_0x2dd6fd[_0xb881('0x2e')][_0xb881('0x33')]));_0x5a4435[_0xb881('0x34')]=_0x5a4435[_0xb881('0x34')]['length']?_0x5a4435[_0xb881('0x34')]:_0x45ff83[_0xb881('0x32')];if(_0x2dd6fd[_0xb881('0x2e')][_0xb881('0x3f')]){_0x5a4435['include']=[{'all':!![]}];}_0x5a4435=_[_0xb881('0x3b')]({},_0x5a4435,_0x2dd6fd[_0xb881('0x3e')]);return db[_0xb881('0x2a')][_0xb881('0x45')](_0x5a4435)[_0xb881('0x24')](handleEntityNotFound(_0x34c01b,null))[_0xb881('0x24')](respondWithResult(_0x34c01b,null))['catch'](handleError(_0x34c01b,null));};exports['create']=function(_0x1b69cb,_0x2df623){return db[_0xb881('0x2a')][_0xb881('0x46')](_0x1b69cb[_0xb881('0x47')],{})[_0xb881('0x24')](respondWithResult(_0x2df623,0xc9))['catch'](handleError(_0x2df623,null));};exports[_0xb881('0x48')]=function(_0x37d5c9,_0x106655){if(_0x37d5c9[_0xb881('0x47')]['id']){delete _0x37d5c9['body']['id'];}return db['MailSubstatus'][_0xb881('0x45')]({'where':{'id':_0x37d5c9[_0xb881('0x44')]['id']}})[_0xb881('0x24')](handleEntityNotFound(_0x106655,null))[_0xb881('0x24')](saveUpdates(_0x37d5c9[_0xb881('0x47')],null))[_0xb881('0x24')](respondWithResult(_0x106655,null))['catch'](handleError(_0x106655,null));};exports[_0xb881('0x49')]=function(_0x233a50,_0x1a578c){return db[_0xb881('0x2a')][_0xb881('0x45')]({'where':{'id':_0x233a50[_0xb881('0x44')]['id']}})[_0xb881('0x24')](handleEntityNotFound(_0x1a578c,null))[_0xb881('0x24')](removeEntity(_0x1a578c,null))['catch'](handleError(_0x1a578c,null));};exports[_0xb881('0x4a')]=function(_0x10148f,_0x65c517){return db[_0xb881('0x2a')][_0xb881('0x4a')]()[_0xb881('0x24')](respondWithResult(_0x65c517,null))[_0xb881('0x42')](handleError(_0x65c517,null));}; \ No newline at end of file +var _0x458b=['attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','rawAttributes','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','MailSubstatus','fieldName','type','key','model','keys','query','intersection','fields'];(function(_0x5916bd,_0x42c902){var _0x32fa62=function(_0x498051){while(--_0x498051){_0x5916bd['push'](_0x5916bd['shift']());}};_0x32fa62(++_0x42c902);}(_0x458b,0x142));var _0xb458=function(_0x5e8282,_0x1f2962){_0x5e8282=_0x5e8282-0x0;var _0x5cd37d=_0x458b[_0x5e8282];return _0x5cd37d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb458('0x0'));var zipdir=require(_0xb458('0x1'));var jsonpatch=require(_0xb458('0x2'));var rp=require(_0xb458('0x3'));var moment=require('moment');var BPromise=require(_0xb458('0x4'));var Mustache=require('mustache');var util=require(_0xb458('0x5'));var path=require(_0xb458('0x6'));var sox=require('sox');var csv=require(_0xb458('0x7'));var ejs=require(_0xb458('0x8'));var fs=require('fs');var fs_extra=require(_0xb458('0x9'));var _=require(_0xb458('0xa'));var squel=require('squel');var crypto=require(_0xb458('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb458('0xc'));var Papa=require(_0xb458('0xd'));var Redis=require(_0xb458('0xe'));var authService=require(_0xb458('0xf'));var qs=require(_0xb458('0x10'));var as=require(_0xb458('0x11'));var hardwareService=require(_0xb458('0x12'));var logger=require(_0xb458('0x13'))(_0xb458('0x14'));var utils=require(_0xb458('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb458('0x16'))['db'];function respondWithStatusCode(_0x1cd9d2,_0x15d6cc){_0x15d6cc=_0x15d6cc||0xcc;return function(_0x25fd9b){if(_0x25fd9b){return _0x1cd9d2[_0xb458('0x17')](_0x15d6cc);}return _0x1cd9d2[_0xb458('0x18')](_0x15d6cc)[_0xb458('0x19')]();};}function respondWithResult(_0x586326,_0x55f17b){_0x55f17b=_0x55f17b||0xc8;return function(_0x23de40){if(_0x23de40){return _0x586326[_0xb458('0x18')](_0x55f17b)[_0xb458('0x1a')](_0x23de40);}};}function respondWithFilteredResult(_0x33ef3a,_0x5364b4){return function(_0x581ca7){if(_0x581ca7){var _0x32af5f=typeof _0x5364b4['offset']===_0xb458('0x1b')&&typeof _0x5364b4[_0xb458('0x1c')]===_0xb458('0x1b');var _0x281eba=_0x581ca7['count'];var _0xaf1cae=_0x32af5f?0x0:_0x5364b4['offset'];var _0x22a6e8=_0x32af5f?_0x581ca7[_0xb458('0x1d')]:_0x5364b4['offset']+_0x5364b4[_0xb458('0x1c')];var _0x48becf;if(_0x22a6e8>=_0x281eba){_0x22a6e8=_0x281eba;_0x48becf=0xc8;}else{_0x48becf=0xce;}_0x33ef3a[_0xb458('0x18')](_0x48becf);return _0x33ef3a[_0xb458('0x1e')](_0xb458('0x1f'),_0xaf1cae+'-'+_0x22a6e8+'/'+_0x281eba)['json'](_0x581ca7);}return null;};}function patchUpdates(_0x159835){return function(_0x3ae068){try{jsonpatch[_0xb458('0x20')](_0x3ae068,_0x159835,!![]);}catch(_0x1b8eb7){return BPromise[_0xb458('0x21')](_0x1b8eb7);}return _0x3ae068[_0xb458('0x22')]();};}function saveUpdates(_0x4cce6f,_0x203470){return function(_0x3908ef){if(_0x3908ef){return _0x3908ef[_0xb458('0x23')](_0x4cce6f)['then'](function(_0x357535){return _0x357535;});}return null;};}function removeEntity(_0x36478f,_0x31b1ee){return function(_0x4c3fae){if(_0x4c3fae){return _0x4c3fae[_0xb458('0x24')]()[_0xb458('0x25')](function(){_0x36478f[_0xb458('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1417b7,_0x203836){return function(_0x4496c9){if(!_0x4496c9){_0x1417b7[_0xb458('0x17')](0x194);}return _0x4496c9;};}function handleError(_0x2a0829,_0xc83985){_0xc83985=_0xc83985||0x1f4;return function(_0x5af727){logger[_0xb458('0x26')](_0x5af727[_0xb458('0x27')]);if(_0x5af727[_0xb458('0x28')]){delete _0x5af727[_0xb458('0x28')];}_0x2a0829[_0xb458('0x18')](_0xc83985)[_0xb458('0x29')](_0x5af727);};}exports[_0xb458('0x2a')]=function(_0x5a0a5b,_0x312978){var _0x639558={},_0x141dd6={},_0x22e7a3={'count':0x0,'rows':[]};var _0x485242=_[_0xb458('0x2b')](db[_0xb458('0x2c')]['rawAttributes'],function(_0x15ef41){return{'name':_0x15ef41[_0xb458('0x2d')],'type':_0x15ef41[_0xb458('0x2e')][_0xb458('0x2f')]};});_0x141dd6[_0xb458('0x30')]=_[_0xb458('0x2b')](_0x485242,'name');_0x141dd6['query']=_[_0xb458('0x31')](_0x5a0a5b[_0xb458('0x32')]);_0x141dd6['filters']=_[_0xb458('0x33')](_0x141dd6[_0xb458('0x30')],_0x141dd6[_0xb458('0x32')]);_0x639558['attributes']=_[_0xb458('0x33')](_0x141dd6[_0xb458('0x30')],qs['fields'](_0x5a0a5b[_0xb458('0x32')][_0xb458('0x34')]));_0x639558[_0xb458('0x35')]=_0x639558[_0xb458('0x35')][_0xb458('0x36')]?_0x639558[_0xb458('0x35')]:_0x141dd6['model'];if(!_0x5a0a5b[_0xb458('0x32')][_0xb458('0x37')](_0xb458('0x38'))){_0x639558[_0xb458('0x1c')]=qs[_0xb458('0x1c')](_0x5a0a5b[_0xb458('0x32')]['limit']);_0x639558['offset']=qs['offset'](_0x5a0a5b[_0xb458('0x32')][_0xb458('0x39')]);}_0x639558[_0xb458('0x3a')]=qs[_0xb458('0x3b')](_0x5a0a5b[_0xb458('0x32')][_0xb458('0x3b')]);_0x639558[_0xb458('0x3c')]=qs[_0xb458('0x3d')](_[_0xb458('0x3e')](_0x5a0a5b[_0xb458('0x32')],_0x141dd6[_0xb458('0x3d')]),_0x485242);if(_0x5a0a5b[_0xb458('0x32')][_0xb458('0x3f')]){_0x639558[_0xb458('0x3c')]=_[_0xb458('0x40')](_0x639558[_0xb458('0x3c')],{'$or':_[_0xb458('0x2b')](_0x485242,function(_0x55a490){if(_0x55a490[_0xb458('0x2e')]!==_0xb458('0x41')){var _0xfa8148={};_0xfa8148[_0x55a490[_0xb458('0x28')]]={'$like':'%'+_0x5a0a5b[_0xb458('0x32')][_0xb458('0x3f')]+'%'};return _0xfa8148;}})});}_0x639558=_['merge']({},_0x639558,_0x5a0a5b[_0xb458('0x42')]);var _0x43130a={'where':_0x639558[_0xb458('0x3c')]};return db[_0xb458('0x2c')]['count'](_0x43130a)[_0xb458('0x25')](function(_0x13dbe9){_0x22e7a3[_0xb458('0x1d')]=_0x13dbe9;if(_0x5a0a5b['query']['includeAll']){_0x639558['include']=[{'all':!![]}];}return db[_0xb458('0x2c')][_0xb458('0x43')](_0x639558);})[_0xb458('0x25')](function(_0x25a524){_0x22e7a3['rows']=_0x25a524;return _0x22e7a3;})[_0xb458('0x25')](respondWithFilteredResult(_0x312978,_0x639558))[_0xb458('0x44')](handleError(_0x312978,null));};exports[_0xb458('0x45')]=function(_0x4ee87c,_0x307d5e){var _0x4ac0d1={'raw':!![],'where':{'id':_0x4ee87c[_0xb458('0x46')]['id']}},_0x61ff99={};_0x61ff99[_0xb458('0x30')]=_['keys'](db[_0xb458('0x2c')][_0xb458('0x47')]);_0x61ff99[_0xb458('0x32')]=_[_0xb458('0x31')](_0x4ee87c['query']);_0x61ff99[_0xb458('0x3d')]=_[_0xb458('0x33')](_0x61ff99[_0xb458('0x30')],_0x61ff99[_0xb458('0x32')]);_0x4ac0d1[_0xb458('0x35')]=_[_0xb458('0x33')](_0x61ff99[_0xb458('0x30')],qs[_0xb458('0x34')](_0x4ee87c[_0xb458('0x32')]['fields']));_0x4ac0d1[_0xb458('0x35')]=_0x4ac0d1[_0xb458('0x35')][_0xb458('0x36')]?_0x4ac0d1[_0xb458('0x35')]:_0x61ff99[_0xb458('0x30')];if(_0x4ee87c[_0xb458('0x32')]['includeAll']){_0x4ac0d1['include']=[{'all':!![]}];}_0x4ac0d1=_['merge']({},_0x4ac0d1,_0x4ee87c[_0xb458('0x42')]);return db[_0xb458('0x2c')]['find'](_0x4ac0d1)['then'](handleEntityNotFound(_0x307d5e,null))[_0xb458('0x25')](respondWithResult(_0x307d5e,null))[_0xb458('0x44')](handleError(_0x307d5e,null));};exports['create']=function(_0x446927,_0x410894){return db[_0xb458('0x2c')]['create'](_0x446927[_0xb458('0x48')],{})[_0xb458('0x25')](respondWithResult(_0x410894,0xc9))[_0xb458('0x44')](handleError(_0x410894,null));};exports[_0xb458('0x23')]=function(_0x1417e0,_0x2f3595){if(_0x1417e0[_0xb458('0x48')]['id']){delete _0x1417e0[_0xb458('0x48')]['id'];}return db['MailSubstatus'][_0xb458('0x49')]({'where':{'id':_0x1417e0[_0xb458('0x46')]['id']}})[_0xb458('0x25')](handleEntityNotFound(_0x2f3595,null))['then'](saveUpdates(_0x1417e0[_0xb458('0x48')],null))[_0xb458('0x25')](respondWithResult(_0x2f3595,null))[_0xb458('0x44')](handleError(_0x2f3595,null));};exports['destroy']=function(_0xf678aa,_0x37031e){return db[_0xb458('0x2c')][_0xb458('0x49')]({'where':{'id':_0xf678aa['params']['id']}})[_0xb458('0x25')](handleEntityNotFound(_0x37031e,null))[_0xb458('0x25')](removeEntity(_0x37031e,null))[_0xb458('0x44')](handleError(_0x37031e,null));};exports[_0xb458('0x4a')]=function(_0x5457b2,_0x4829ca){return db[_0xb458('0x2c')][_0xb458('0x4a')]()['then'](respondWithResult(_0x4829ca,null))[_0xb458('0x44')](handleError(_0x4829ca,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e8aa068..869e2e2 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 _0x87f4=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x87f4,0x1d1));var _0x487f=function(_0x4a055e,_0x59b80a){_0x4a055e=_0x4a055e-0x0;var _0x328a29=_0x87f4[_0x4a055e];return _0x328a29;};'use strict';var EventEmitter=require(_0x487f('0x0'));var MailSubstatus=require(_0x487f('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x487f('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0xa8718f){return function(_0xbccf75,_0x304361,_0xcb8f9a){MailSubstatusEvents[_0x487f('0x3')](_0xa8718f+':'+_0xbccf75['id'],_0xbccf75);MailSubstatusEvents[_0x487f('0x3')](_0xa8718f,_0xbccf75);_0xcb8f9a(null);};}for(var e in events){if(events[_0x487f('0x4')](e)){var event=events[e];MailSubstatus[_0x487f('0x5')](e,emitEvent(event));}}module[_0x487f('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x8d55=['update','emit','hook','exports','MailSubstatus'];(function(_0x18b628,_0x32c843){var _0x48b2b9=function(_0x4e0b18){while(--_0x4e0b18){_0x18b628['push'](_0x18b628['shift']());}};_0x48b2b9(++_0x32c843);}(_0x8d55,0x1a8));var _0x58d5=function(_0x592933,_0x2c05d5){_0x592933=_0x592933-0x0;var _0x4aef2c=_0x8d55[_0x592933];return _0x4aef2c;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x58d5('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x58d5('0x1')};function emitEvent(_0x356aec){return function(_0x8721ee,_0x5bb8b7,_0x299132){MailSubstatusEvents[_0x58d5('0x2')](_0x356aec+':'+_0x8721ee['id'],_0x8721ee);MailSubstatusEvents[_0x58d5('0x2')](_0x356aec,_0x8721ee);_0x299132(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0x58d5('0x3')](e,emitEvent(event));}}module[_0x58d5('0x4')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 42672f2..2842670 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 _0x80a4=['mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','define','mail_substatuses','Condition','update','name'];(function(_0x93eeaf,_0x24f92b){var _0x3d2a7a=function(_0x4727ad){while(--_0x4727ad){_0x93eeaf['push'](_0x93eeaf['shift']());}};_0x3d2a7a(++_0x24f92b);}(_0x80a4,0x1e4));var _0x480a=function(_0xe66b90,_0x234632){_0xe66b90=_0xe66b90-0x0;var _0x104441=_0x80a4[_0xe66b90];return _0x104441;};'use strict';var attributes=require(_0x480a('0x0'));module['exports']=function(_0x102f30){var _0x9e1c41=_0x102f30['models'];return _0x102f30[_0x480a('0x1')]('MailSubstatus',attributes,{'tableName':_0x480a('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x20d885,_0x3b4971,_0x514a00){return _0x9e1c41[_0x480a('0x3')][_0x480a('0x4')]({'value':_0x20d885[_0x480a('0x5')]},{'where':{'field':_0x480a('0x6'),'value':_0x20d885[_0x480a('0x7')][_0x480a('0x5')]}})[_0x480a('0x8')](function(){_0x514a00();})[_0x480a('0x9')](function(_0x45dedf){_0x514a00(_0x45dedf);});}}});}; \ No newline at end of file +var _0xd65a=['mailSubstatus','_previousDataValues','name','then','catch','./mailSubstatus.attributes','models','define','mail_substatuses','update'];(function(_0x457bf5,_0x4282b6){var _0x51eab9=function(_0x36a658){while(--_0x36a658){_0x457bf5['push'](_0x457bf5['shift']());}};_0x51eab9(++_0x4282b6);}(_0xd65a,0x16d));var _0xad65=function(_0x55250a,_0x4f52bb){_0x55250a=_0x55250a-0x0;var _0x27624c=_0xd65a[_0x55250a];return _0x27624c;};'use strict';var attributes=require(_0xad65('0x0'));module['exports']=function(_0x4e290b){var _0x10b311=_0x4e290b[_0xad65('0x1')];return _0x4e290b[_0xad65('0x2')]('MailSubstatus',attributes,{'tableName':_0xad65('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1aa2c0,_0x4228ba,_0x181bc3){return _0x10b311['Condition'][_0xad65('0x4')]({'value':_0x1aa2c0['name']},{'where':{'field':_0xad65('0x5'),'value':_0x1aa2c0[_0xad65('0x6')][_0xad65('0x7')]}})[_0xad65('0x8')](function(){_0x181bc3();})[_0xad65('0x9')](function(_0x101539){_0x181bc3(_0x101539);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 2994a76..b328382 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 _0xd484=['code','message','result','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','MailSubstatus,\x20%s,\x20%s','request\x20sent','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xd484,0xff));var _0x4d48=function(_0x2f1716,_0xe88d8a){_0x2f1716=_0x2f1716-0x0;var _0x25e542=_0xd484[_0x2f1716];return _0x25e542;};'use strict';var _=require(_0x4d48('0x0'));var util=require(_0x4d48('0x1'));var moment=require(_0x4d48('0x2'));var BPromise=require('bluebird');var rs=require(_0x4d48('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4d48('0x4'))['db'];var utils=require(_0x4d48('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4d48('0x6'));var jayson=require(_0x4d48('0x7'));var client=jayson[_0x4d48('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x287d75,_0x295129,_0x532a8d){return new BPromise(function(_0x142d4c,_0x438aea){return client[_0x4d48('0x9')](_0x287d75,_0x532a8d)['then'](function(_0x45a3cd){logger['info'](_0x4d48('0xa'),_0x295129,_0x4d48('0xb'));logger['debug'](_0x4d48('0xc'),_0x295129,'request\x20sent',JSON[_0x4d48('0xd')](_0x45a3cd));if(_0x45a3cd[_0x4d48('0xe')]){if(_0x45a3cd[_0x4d48('0xe')][_0x4d48('0xf')]===0x1f4){logger[_0x4d48('0xe')](_0x4d48('0xa'),_0x295129,_0x45a3cd[_0x4d48('0xe')][_0x4d48('0x10')]);return _0x438aea(_0x45a3cd[_0x4d48('0xe')][_0x4d48('0x10')]);}logger['error'](_0x4d48('0xa'),_0x295129,_0x45a3cd['error'][_0x4d48('0x10')]);return _0x142d4c(_0x45a3cd[_0x4d48('0xe')][_0x4d48('0x10')]);}else{logger['info'](_0x4d48('0xa'),_0x295129,_0x4d48('0xb'));_0x142d4c(_0x45a3cd[_0x4d48('0x11')][_0x4d48('0x10')]);}})['catch'](function(_0x473663){logger[_0x4d48('0xe')](_0x4d48('0xa'),_0x295129,_0x473663);_0x438aea(_0x473663);});});} \ No newline at end of file +var _0x46dc=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring'];(function(_0xcf98bc,_0x393fdf){var _0x35ca8b=function(_0x48d16c){while(--_0x48d16c){_0xcf98bc['push'](_0xcf98bc['shift']());}};_0x35ca8b(++_0x393fdf);}(_0x46dc,0x104));var _0xc46d=function(_0x3ef537,_0x4cf14b){_0x3ef537=_0x3ef537-0x0;var _0x533bda=_0x46dc[_0x3ef537];return _0x533bda;};'use strict';var _=require(_0xc46d('0x0'));var util=require(_0xc46d('0x1'));var moment=require(_0xc46d('0x2'));var BPromise=require('bluebird');var rs=require(_0xc46d('0x3'));var fs=require('fs');var Redis=require(_0xc46d('0x4'));var db=require(_0xc46d('0x5'))['db'];var utils=require(_0xc46d('0x6'));var logger=require(_0xc46d('0x7'))(_0xc46d('0x8'));var config=require('../../config/environment');var jayson=require(_0xc46d('0x9'));var client=jayson[_0xc46d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11d380,_0x14a334,_0x18d176){return new BPromise(function(_0x303a2c,_0x9cd6aa){return client[_0xc46d('0xb')](_0x11d380,_0x18d176)[_0xc46d('0xc')](function(_0x1d9849){logger[_0xc46d('0xd')](_0xc46d('0xe'),_0x14a334,_0xc46d('0xf'));logger[_0xc46d('0x10')](_0xc46d('0x11'),_0x14a334,'request\x20sent',JSON[_0xc46d('0x12')](_0x1d9849));if(_0x1d9849[_0xc46d('0x13')]){if(_0x1d9849[_0xc46d('0x13')][_0xc46d('0x14')]===0x1f4){logger[_0xc46d('0x13')](_0xc46d('0xe'),_0x14a334,_0x1d9849[_0xc46d('0x13')][_0xc46d('0x15')]);return _0x9cd6aa(_0x1d9849[_0xc46d('0x13')][_0xc46d('0x15')]);}logger['error'](_0xc46d('0xe'),_0x14a334,_0x1d9849[_0xc46d('0x13')]['message']);return _0x303a2c(_0x1d9849[_0xc46d('0x13')][_0xc46d('0x15')]);}else{logger[_0xc46d('0xd')](_0xc46d('0xe'),_0x14a334,'request\x20sent');_0x303a2c(_0x1d9849[_0xc46d('0x16')][_0xc46d('0x15')]);}})[_0xc46d('0x17')](function(_0x10a60b){logger[_0xc46d('0x13')]('MailSubstatus,\x20%s,\x20%s',_0x14a334,_0x10a60b);_0x9cd6aa(_0x10a60b);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 815854d..a00de0f 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 _0x2df6=['../../components/auth/service','./mailTransferReport.controller','get','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra'];(function(_0x56ddde,_0x53abe8){var _0x21ae70=function(_0x534b82){while(--_0x534b82){_0x56ddde['push'](_0x56ddde['shift']());}};_0x21ae70(++_0x53abe8);}(_0x2df6,0x1e2));var _0x62df=function(_0x20cb20,_0x256051){_0x20cb20=_0x20cb20-0x0;var _0x2fcf4b=_0x2df6[_0x20cb20];return _0x2fcf4b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x62df('0x0'));var express=require(_0x62df('0x1'));var router=express[_0x62df('0x2')]();var fs_extra=require(_0x62df('0x3'));var auth=require(_0x62df('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62df('0x5'));router[_0x62df('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x62df('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x62df('0x7')]);router[_0x62df('0x6')](_0x62df('0x8'),auth[_0x62df('0x9')](),controller[_0x62df('0xa')]);router[_0x62df('0xb')]('/',auth[_0x62df('0x9')](),controller[_0x62df('0xc')]);router[_0x62df('0xd')](_0x62df('0x8'),auth['isAuthenticated'](),controller[_0x62df('0xe')]);router[_0x62df('0xf')]('/:id',auth[_0x62df('0x9')](),controller[_0x62df('0x10')]);module[_0x62df('0x11')]=router; \ No newline at end of file +var _0x84ec=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','destroy','exports','path','express'];(function(_0x1f1a63,_0x3b5924){var _0x21492a=function(_0x56c789){while(--_0x56c789){_0x1f1a63['push'](_0x1f1a63['shift']());}};_0x21492a(++_0x3b5924);}(_0x84ec,0x17a));var _0xc84e=function(_0x3946d8,_0x1ec847){_0x3946d8=_0x3946d8-0x0;var _0x46f7a1=_0x84ec[_0x3946d8];return _0x46f7a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc84e('0x0'));var timeout=require('connect-timeout');var express=require(_0xc84e('0x1'));var router=express['Router']();var fs_extra=require(_0xc84e('0x2'));var auth=require(_0xc84e('0x3'));var interaction=require(_0xc84e('0x4'));var config=require(_0xc84e('0x5'));var controller=require(_0xc84e('0x6'));router['get']('/',auth[_0xc84e('0x7')](),controller[_0xc84e('0x8')]);router[_0xc84e('0x9')](_0xc84e('0xa'),auth[_0xc84e('0x7')](),controller[_0xc84e('0xb')]);router[_0xc84e('0x9')](_0xc84e('0xc'),auth['isAuthenticated'](),controller[_0xc84e('0xd')]);router[_0xc84e('0xe')]('/',auth[_0xc84e('0x7')](),controller['create']);router[_0xc84e('0xf')](_0xc84e('0xc'),auth[_0xc84e('0x7')](),controller[_0xc84e('0x10')]);router[_0xc84e('0x11')](_0xc84e('0xc'),auth['isAuthenticated'](),controller[_0xc84e('0x12')]);module[_0xc84e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index c84abdc..57eee57 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2d579f,_0x370e5d){var _0x1145da=function(_0x49376f){while(--_0x49376f){_0x2d579f['push'](_0x2d579f['shift']());}};_0x1145da(++_0x370e5d);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x51a023,_0x40ff38){var _0x1dfe91=function(_0x19c3ac){while(--_0x19c3ac){_0x51a023['push'](_0x51a023['shift']());}};_0x1dfe91(++_0x40ff38);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 5c28172..bb8f59a 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 _0x19a5=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra'];(function(_0x5deb0a,_0xc192bb){var _0x33d0ce=function(_0x3f1aa8){while(--_0x3f1aa8){_0x5deb0a['push'](_0x5deb0a['shift']());}};_0x33d0ce(++_0xc192bb);}(_0x19a5,0x163));var _0x519a=function(_0x252ba9,_0x5311c0){_0x252ba9=_0x252ba9-0x0;var _0x533081=_0x19a5[_0x252ba9];return _0x533081;};'use strict';var emlformat=require(_0x519a('0x0'));var rimraf=require(_0x519a('0x1'));var zipdir=require(_0x519a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x519a('0x3'));var moment=require(_0x519a('0x4'));var BPromise=require(_0x519a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x519a('0x6'));var sox=require('sox');var csv=require(_0x519a('0x7'));var ejs=require(_0x519a('0x8'));var fs=require('fs');var fs_extra=require(_0x519a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x519a('0xa'));var jsforce=require(_0x519a('0xb'));var deskjs=require(_0x519a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x519a('0xd'));var Papa=require(_0x519a('0xe'));var Redis=require(_0x519a('0xf'));var authService=require(_0x519a('0x10'));var qs=require(_0x519a('0x11'));var as=require(_0x519a('0x12'));var hardwareService=require(_0x519a('0x13'));var logger=require(_0x519a('0x14'))(_0x519a('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x519a('0x16'))['db'];function respondWithStatusCode(_0x254d9d,_0x2279a8){_0x2279a8=_0x2279a8||0xcc;return function(_0x2c05b5){if(_0x2c05b5){return _0x254d9d[_0x519a('0x17')](_0x2279a8);}return _0x254d9d['status'](_0x2279a8)[_0x519a('0x18')]();};}function respondWithResult(_0x4e60d9,_0x14ad35){_0x14ad35=_0x14ad35||0xc8;return function(_0x3a8801){if(_0x3a8801){return _0x4e60d9['status'](_0x14ad35)[_0x519a('0x19')](_0x3a8801);}};}function respondWithFilteredResult(_0x255990,_0x352800){return function(_0x1c4b03){if(_0x1c4b03){var _0x1f3604=typeof _0x352800[_0x519a('0x1a')]===_0x519a('0x1b')&&typeof _0x352800[_0x519a('0x1c')]==='undefined';var _0x42b8e7=_0x1c4b03[_0x519a('0x1d')];var _0x4137b4=_0x1f3604?0x0:_0x352800[_0x519a('0x1a')];var _0x52ee15=_0x1f3604?_0x1c4b03[_0x519a('0x1d')]:_0x352800[_0x519a('0x1a')]+_0x352800[_0x519a('0x1c')];var _0x59dc28;if(_0x52ee15>=_0x42b8e7){_0x52ee15=_0x42b8e7;_0x59dc28=0xc8;}else{_0x59dc28=0xce;}_0x255990[_0x519a('0x1e')](_0x59dc28);return _0x255990[_0x519a('0x1f')](_0x519a('0x20'),_0x4137b4+'-'+_0x52ee15+'/'+_0x42b8e7)['json'](_0x1c4b03);}return null;};}function patchUpdates(_0x548f6c){return function(_0x527e7e){try{jsonpatch[_0x519a('0x21')](_0x527e7e,_0x548f6c,!![]);}catch(_0x4c1839){return BPromise[_0x519a('0x22')](_0x4c1839);}return _0x527e7e['save']();};}function saveUpdates(_0x68cf0a,_0xe77da3){return function(_0x26097e){if(_0x26097e){return _0x26097e['update'](_0x68cf0a)[_0x519a('0x23')](function(_0x2a9f53){return _0x2a9f53;});}return null;};}function removeEntity(_0x134f61,_0x106bbe){return function(_0x294963){if(_0x294963){return _0x294963['destroy']()[_0x519a('0x23')](function(){_0x134f61['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x291e67,_0x2c65fa){return function(_0x29fbcf){if(!_0x29fbcf){_0x291e67[_0x519a('0x17')](0x194);}return _0x29fbcf;};}function handleError(_0x14336d,_0x5de2f0){_0x5de2f0=_0x5de2f0||0x1f4;return function(_0x3ba47d){logger[_0x519a('0x24')](_0x3ba47d['stack']);if(_0x3ba47d[_0x519a('0x25')]){delete _0x3ba47d[_0x519a('0x25')];}_0x14336d[_0x519a('0x1e')](_0x5de2f0)['send'](_0x3ba47d);};}exports[_0x519a('0x26')]=function(_0x8614d0,_0x1ddae3){var _0x331156={},_0x10d48e={},_0x2cc2a5={'count':0x0,'rows':[]};var _0xe670f9=_[_0x519a('0x27')](db['MailTransferReport'][_0x519a('0x28')],function(_0x3d1b77){return{'name':_0x3d1b77[_0x519a('0x29')],'type':_0x3d1b77[_0x519a('0x2a')][_0x519a('0x2b')]};});_0x10d48e[_0x519a('0x2c')]=_['map'](_0xe670f9,_0x519a('0x25'));_0x10d48e[_0x519a('0x2d')]=_[_0x519a('0x2e')](_0x8614d0[_0x519a('0x2d')]);_0x10d48e[_0x519a('0x2f')]=_[_0x519a('0x30')](_0x10d48e['model'],_0x10d48e['query']);_0x331156[_0x519a('0x31')]=_['intersection'](_0x10d48e[_0x519a('0x2c')],qs[_0x519a('0x32')](_0x8614d0[_0x519a('0x2d')][_0x519a('0x32')]));_0x331156['attributes']=_0x331156[_0x519a('0x31')][_0x519a('0x33')]?_0x331156[_0x519a('0x31')]:_0x10d48e[_0x519a('0x2c')];if(!_0x8614d0['query'][_0x519a('0x34')]('nolimit')){_0x331156[_0x519a('0x1c')]=qs[_0x519a('0x1c')](_0x8614d0['query'][_0x519a('0x1c')]);_0x331156['offset']=qs[_0x519a('0x1a')](_0x8614d0['query'][_0x519a('0x1a')]);}_0x331156['order']=qs[_0x519a('0x35')](_0x8614d0[_0x519a('0x2d')][_0x519a('0x35')]);_0x331156[_0x519a('0x36')]=qs[_0x519a('0x2f')](_[_0x519a('0x37')](_0x8614d0[_0x519a('0x2d')],_0x10d48e['filters']),_0xe670f9);if(_0x8614d0[_0x519a('0x2d')][_0x519a('0x38')]){_0x331156[_0x519a('0x36')]=_[_0x519a('0x39')](_0x331156[_0x519a('0x36')],{'$or':_[_0x519a('0x27')](_0xe670f9,function(_0xbb8d17){if(_0xbb8d17[_0x519a('0x2a')]!==_0x519a('0x3a')){var _0x3c3553={};_0x3c3553[_0xbb8d17[_0x519a('0x25')]]={'$like':'%'+_0x8614d0[_0x519a('0x2d')][_0x519a('0x38')]+'%'};return _0x3c3553;}})});}_0x331156=_[_0x519a('0x39')]({},_0x331156,_0x8614d0['options']);var _0x3f19c3={'where':_0x331156['where']};return db[_0x519a('0x3b')][_0x519a('0x1d')](_0x3f19c3)[_0x519a('0x23')](function(_0x475a62){_0x2cc2a5[_0x519a('0x1d')]=_0x475a62;if(_0x8614d0[_0x519a('0x2d')][_0x519a('0x3c')]){_0x331156[_0x519a('0x3d')]=[{'all':!![]}];}return db[_0x519a('0x3b')][_0x519a('0x3e')](_0x331156);})[_0x519a('0x23')](function(_0x3082ae){_0x2cc2a5[_0x519a('0x3f')]=_0x3082ae;return _0x2cc2a5;})[_0x519a('0x23')](respondWithFilteredResult(_0x1ddae3,_0x331156))[_0x519a('0x40')](handleError(_0x1ddae3,null));};exports[_0x519a('0x41')]=function(_0x56c279,_0x47ec40){var _0x4175b2={'raw':!![],'where':{'id':_0x56c279[_0x519a('0x42')]['id']}},_0x586292={};_0x586292[_0x519a('0x2c')]=_[_0x519a('0x2e')](db['MailTransferReport']['rawAttributes']);_0x586292[_0x519a('0x2d')]=_[_0x519a('0x2e')](_0x56c279[_0x519a('0x2d')]);_0x586292[_0x519a('0x2f')]=_[_0x519a('0x30')](_0x586292[_0x519a('0x2c')],_0x586292[_0x519a('0x2d')]);_0x4175b2[_0x519a('0x31')]=_['intersection'](_0x586292[_0x519a('0x2c')],qs[_0x519a('0x32')](_0x56c279[_0x519a('0x2d')][_0x519a('0x32')]));_0x4175b2['attributes']=_0x4175b2[_0x519a('0x31')][_0x519a('0x33')]?_0x4175b2['attributes']:_0x586292[_0x519a('0x2c')];if(_0x56c279[_0x519a('0x2d')]['includeAll']){_0x4175b2[_0x519a('0x3d')]=[{'all':!![]}];}_0x4175b2=_['merge']({},_0x4175b2,_0x56c279['options']);return db['MailTransferReport'][_0x519a('0x43')](_0x4175b2)[_0x519a('0x23')](handleEntityNotFound(_0x47ec40,null))[_0x519a('0x23')](respondWithResult(_0x47ec40,null))['catch'](handleError(_0x47ec40,null));};exports[_0x519a('0x44')]=function(_0x9d10e3,_0x4b3432){return db[_0x519a('0x3b')][_0x519a('0x44')](_0x9d10e3[_0x519a('0x45')],{})[_0x519a('0x23')](respondWithResult(_0x4b3432,0xc9))[_0x519a('0x40')](handleError(_0x4b3432,null));};exports[_0x519a('0x46')]=function(_0x46423a,_0x2e3a5b){if(_0x46423a[_0x519a('0x45')]['id']){delete _0x46423a['body']['id'];}return db[_0x519a('0x3b')][_0x519a('0x43')]({'where':{'id':_0x46423a[_0x519a('0x42')]['id']}})[_0x519a('0x23')](handleEntityNotFound(_0x2e3a5b,null))[_0x519a('0x23')](saveUpdates(_0x46423a[_0x519a('0x45')],null))['then'](respondWithResult(_0x2e3a5b,null))[_0x519a('0x40')](handleError(_0x2e3a5b,null));};exports[_0x519a('0x47')]=function(_0x6d8422,_0x16bc72){return db[_0x519a('0x3b')][_0x519a('0x43')]({'where':{'id':_0x6d8422[_0x519a('0x42')]['id']}})[_0x519a('0x23')](handleEntityNotFound(_0x16bc72,null))[_0x519a('0x23')](removeEntity(_0x16bc72,null))[_0x519a('0x40')](handleError(_0x16bc72,null));};exports[_0x519a('0x48')]=function(_0x78dad0,_0x198465){return db['MailTransferReport']['describe']()[_0x519a('0x23')](respondWithResult(_0x198465,null))[_0x519a('0x40')](handleError(_0x198465,null));}; \ No newline at end of file +var _0xd610=['options','includeAll','include','rows','catch','show','params','length','find','create','body','update','destroy','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','error','stack','name','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd610,0xa4));var _0x0d61=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xd610[_0xa6cc5c];return _0x44803d;};'use strict';var emlformat=require(_0x0d61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0d61('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0d61('0x2'));var moment=require(_0x0d61('0x3'));var BPromise=require(_0x0d61('0x4'));var Mustache=require(_0x0d61('0x5'));var util=require('util');var path=require(_0x0d61('0x6'));var sox=require(_0x0d61('0x7'));var csv=require('to-csv');var ejs=require(_0x0d61('0x8'));var fs=require('fs');var fs_extra=require(_0x0d61('0x9'));var _=require(_0x0d61('0xa'));var squel=require(_0x0d61('0xb'));var crypto=require(_0x0d61('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0d61('0xd'));var querystring=require(_0x0d61('0xe'));var Papa=require(_0x0d61('0xf'));var Redis=require(_0x0d61('0x10'));var authService=require(_0x0d61('0x11'));var qs=require(_0x0d61('0x12'));var as=require(_0x0d61('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d61('0x14'))('api');var utils=require(_0x0d61('0x15'));var config=require(_0x0d61('0x16'));var licenseUtil=require(_0x0d61('0x17'));var db=require(_0x0d61('0x18'))['db'];function respondWithStatusCode(_0xfb505d,_0x16d573){_0x16d573=_0x16d573||0xcc;return function(_0x32de26){if(_0x32de26){return _0xfb505d['sendStatus'](_0x16d573);}return _0xfb505d[_0x0d61('0x19')](_0x16d573)[_0x0d61('0x1a')]();};}function respondWithResult(_0x4028fd,_0x45dfd7){_0x45dfd7=_0x45dfd7||0xc8;return function(_0x5d6dbd){if(_0x5d6dbd){return _0x4028fd[_0x0d61('0x19')](_0x45dfd7)[_0x0d61('0x1b')](_0x5d6dbd);}};}function respondWithFilteredResult(_0x3898e8,_0x4ede33){return function(_0xf29386){if(_0xf29386){var _0x373a35=typeof _0x4ede33[_0x0d61('0x1c')]===_0x0d61('0x1d')&&typeof _0x4ede33[_0x0d61('0x1e')]===_0x0d61('0x1d');var _0x3af766=_0xf29386[_0x0d61('0x1f')];var _0x17364f=_0x373a35?0x0:_0x4ede33[_0x0d61('0x1c')];var _0x4a8b8f=_0x373a35?_0xf29386[_0x0d61('0x1f')]:_0x4ede33[_0x0d61('0x1c')]+_0x4ede33['limit'];var _0x1afd13;if(_0x4a8b8f>=_0x3af766){_0x4a8b8f=_0x3af766;_0x1afd13=0xc8;}else{_0x1afd13=0xce;}_0x3898e8['status'](_0x1afd13);return _0x3898e8[_0x0d61('0x20')](_0x0d61('0x21'),_0x17364f+'-'+_0x4a8b8f+'/'+_0x3af766)['json'](_0xf29386);}return null;};}function patchUpdates(_0x39c26e){return function(_0x1ee014){try{jsonpatch[_0x0d61('0x22')](_0x1ee014,_0x39c26e,!![]);}catch(_0x19d26a){return BPromise[_0x0d61('0x23')](_0x19d26a);}return _0x1ee014['save']();};}function saveUpdates(_0x171bad,_0x589ed3){return function(_0xeba5b6){if(_0xeba5b6){return _0xeba5b6['update'](_0x171bad)[_0x0d61('0x24')](function(_0x5f2136){return _0x5f2136;});}return null;};}function removeEntity(_0x42bbcd,_0x530983){return function(_0x3bf31a){if(_0x3bf31a){return _0x3bf31a['destroy']()['then'](function(){_0x42bbcd[_0x0d61('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x345f66,_0x4087ec){return function(_0x2ab733){if(!_0x2ab733){_0x345f66['sendStatus'](0x194);}return _0x2ab733;};}function handleError(_0x5e35f1,_0x7b6d60){_0x7b6d60=_0x7b6d60||0x1f4;return function(_0x799826){logger[_0x0d61('0x25')](_0x799826[_0x0d61('0x26')]);if(_0x799826[_0x0d61('0x27')]){delete _0x799826[_0x0d61('0x27')];}_0x5e35f1['status'](_0x7b6d60)['send'](_0x799826);};}exports[_0x0d61('0x28')]=function(_0x1eb958,_0x13e408){var _0xdd53b1={},_0x203c98={},_0x503c1a={'count':0x0,'rows':[]};var _0x20a7f7=_[_0x0d61('0x29')](db[_0x0d61('0x2a')][_0x0d61('0x2b')],function(_0x36f208){return{'name':_0x36f208[_0x0d61('0x2c')],'type':_0x36f208[_0x0d61('0x2d')][_0x0d61('0x2e')]};});_0x203c98[_0x0d61('0x2f')]=_['map'](_0x20a7f7,_0x0d61('0x27'));_0x203c98[_0x0d61('0x30')]=_[_0x0d61('0x31')](_0x1eb958[_0x0d61('0x30')]);_0x203c98[_0x0d61('0x32')]=_['intersection'](_0x203c98[_0x0d61('0x2f')],_0x203c98['query']);_0xdd53b1[_0x0d61('0x33')]=_[_0x0d61('0x34')](_0x203c98['model'],qs[_0x0d61('0x35')](_0x1eb958[_0x0d61('0x30')]['fields']));_0xdd53b1[_0x0d61('0x33')]=_0xdd53b1[_0x0d61('0x33')]['length']?_0xdd53b1[_0x0d61('0x33')]:_0x203c98['model'];if(!_0x1eb958[_0x0d61('0x30')]['hasOwnProperty'](_0x0d61('0x36'))){_0xdd53b1[_0x0d61('0x1e')]=qs['limit'](_0x1eb958[_0x0d61('0x30')][_0x0d61('0x1e')]);_0xdd53b1[_0x0d61('0x1c')]=qs['offset'](_0x1eb958['query'][_0x0d61('0x1c')]);}_0xdd53b1['order']=qs[_0x0d61('0x37')](_0x1eb958[_0x0d61('0x30')][_0x0d61('0x37')]);_0xdd53b1[_0x0d61('0x38')]=qs[_0x0d61('0x32')](_[_0x0d61('0x39')](_0x1eb958[_0x0d61('0x30')],_0x203c98[_0x0d61('0x32')]),_0x20a7f7);if(_0x1eb958[_0x0d61('0x30')][_0x0d61('0x3a')]){_0xdd53b1['where']=_[_0x0d61('0x3b')](_0xdd53b1[_0x0d61('0x38')],{'$or':_['map'](_0x20a7f7,function(_0x3dd935){if(_0x3dd935[_0x0d61('0x2d')]!==_0x0d61('0x3c')){var _0x4598da={};_0x4598da[_0x3dd935[_0x0d61('0x27')]]={'$like':'%'+_0x1eb958[_0x0d61('0x30')][_0x0d61('0x3a')]+'%'};return _0x4598da;}})});}_0xdd53b1=_[_0x0d61('0x3b')]({},_0xdd53b1,_0x1eb958[_0x0d61('0x3d')]);var _0x47f94c={'where':_0xdd53b1['where']};return db[_0x0d61('0x2a')][_0x0d61('0x1f')](_0x47f94c)['then'](function(_0x5a296f){_0x503c1a[_0x0d61('0x1f')]=_0x5a296f;if(_0x1eb958[_0x0d61('0x30')][_0x0d61('0x3e')]){_0xdd53b1[_0x0d61('0x3f')]=[{'all':!![]}];}return db[_0x0d61('0x2a')]['findAll'](_0xdd53b1);})[_0x0d61('0x24')](function(_0xea43d0){_0x503c1a[_0x0d61('0x40')]=_0xea43d0;return _0x503c1a;})[_0x0d61('0x24')](respondWithFilteredResult(_0x13e408,_0xdd53b1))[_0x0d61('0x41')](handleError(_0x13e408,null));};exports[_0x0d61('0x42')]=function(_0x19b7da,_0xfe283f){var _0x41f115={'raw':!![],'where':{'id':_0x19b7da[_0x0d61('0x43')]['id']}},_0x34ba36={};_0x34ba36[_0x0d61('0x2f')]=_[_0x0d61('0x31')](db[_0x0d61('0x2a')]['rawAttributes']);_0x34ba36['query']=_[_0x0d61('0x31')](_0x19b7da[_0x0d61('0x30')]);_0x34ba36['filters']=_[_0x0d61('0x34')](_0x34ba36[_0x0d61('0x2f')],_0x34ba36[_0x0d61('0x30')]);_0x41f115[_0x0d61('0x33')]=_[_0x0d61('0x34')](_0x34ba36[_0x0d61('0x2f')],qs[_0x0d61('0x35')](_0x19b7da[_0x0d61('0x30')][_0x0d61('0x35')]));_0x41f115[_0x0d61('0x33')]=_0x41f115[_0x0d61('0x33')][_0x0d61('0x44')]?_0x41f115[_0x0d61('0x33')]:_0x34ba36[_0x0d61('0x2f')];if(_0x19b7da[_0x0d61('0x30')][_0x0d61('0x3e')]){_0x41f115[_0x0d61('0x3f')]=[{'all':!![]}];}_0x41f115=_['merge']({},_0x41f115,_0x19b7da[_0x0d61('0x3d')]);return db['MailTransferReport'][_0x0d61('0x45')](_0x41f115)[_0x0d61('0x24')](handleEntityNotFound(_0xfe283f,null))[_0x0d61('0x24')](respondWithResult(_0xfe283f,null))[_0x0d61('0x41')](handleError(_0xfe283f,null));};exports[_0x0d61('0x46')]=function(_0x28441a,_0x2fb18b){return db[_0x0d61('0x2a')]['create'](_0x28441a[_0x0d61('0x47')],{})[_0x0d61('0x24')](respondWithResult(_0x2fb18b,0xc9))['catch'](handleError(_0x2fb18b,null));};exports[_0x0d61('0x48')]=function(_0x52c8dc,_0x2527b2){if(_0x52c8dc[_0x0d61('0x47')]['id']){delete _0x52c8dc[_0x0d61('0x47')]['id'];}return db[_0x0d61('0x2a')]['find']({'where':{'id':_0x52c8dc[_0x0d61('0x43')]['id']}})[_0x0d61('0x24')](handleEntityNotFound(_0x2527b2,null))[_0x0d61('0x24')](saveUpdates(_0x52c8dc[_0x0d61('0x47')],null))[_0x0d61('0x24')](respondWithResult(_0x2527b2,null))['catch'](handleError(_0x2527b2,null));};exports[_0x0d61('0x49')]=function(_0x36b918,_0x181676){return db[_0x0d61('0x2a')][_0x0d61('0x45')]({'where':{'id':_0x36b918[_0x0d61('0x43')]['id']}})['then'](handleEntityNotFound(_0x181676,null))[_0x0d61('0x24')](removeEntity(_0x181676,null))['catch'](handleError(_0x181676,null));};exports[_0x0d61('0x4a')]=function(_0xf9ffdd,_0xf6f2de){return db[_0x0d61('0x2a')][_0x0d61('0x4a')]()[_0x0d61('0x24')](respondWithResult(_0xf6f2de,null))[_0x0d61('0x41')](handleError(_0xf6f2de,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index ed02f31..c527db2 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 _0x776f=['./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x4db22b,_0x30003f){var _0x534552=function(_0x40a463){while(--_0x40a463){_0x4db22b['push'](_0x4db22b['shift']());}};_0x534552(++_0x30003f);}(_0x776f,0x68));var _0xf776=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0x776f[_0x556927];return _0x5f1235;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf776('0x0'))(_0xf776('0x1'));var moment=require(_0xf776('0x2'));var BPromise=require(_0xf776('0x3'));var rp=require(_0xf776('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf776('0x5'));var config=require('../../config/environment');var attributes=require(_0xf776('0x6'));module[_0xf776('0x7')]=function(_0x586c8b,_0x371d9c){return _0x586c8b[_0xf776('0x8')]('MailTransferReport',attributes,{'tableName':_0xf776('0x9'),'paranoid':![],'indexes':[{'name':_0xf776('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x192f=['./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','moment','path','rimraf','../../config/environment'];(function(_0x3364a2,_0x3dd4a3){var _0x4b0c9b=function(_0x4b6ca4){while(--_0x4b6ca4){_0x3364a2['push'](_0x3364a2['shift']());}};_0x4b0c9b(++_0x3dd4a3);}(_0x192f,0xd6));var _0xf192=function(_0x723554,_0x3c6782){_0x723554=_0x723554-0x0;var _0x5d6589=_0x192f[_0x723554];return _0x5d6589;};'use strict';var _=require(_0xf192('0x0'));var util=require('util');var logger=require(_0xf192('0x1'))('api');var moment=require(_0xf192('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf192('0x3'));var rimraf=require(_0xf192('0x4'));var config=require(_0xf192('0x5'));var attributes=require(_0xf192('0x6'));module[_0xf192('0x7')]=function(_0x221f55,_0x5a05b0){return _0x221f55[_0xf192('0x8')](_0xf192('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xf192('0xa'),'fields':[_0xf192('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9de3ea6..255a84b 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 _0x28b5=['request\x20sent','error','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','then','info','MailTransferReport,\x20%s,\x20%s'];(function(_0x444c17,_0x20048c){var _0x6bbac2=function(_0x19ebaa){while(--_0x19ebaa){_0x444c17['push'](_0x444c17['shift']());}};_0x6bbac2(++_0x20048c);}(_0x28b5,0x69));var _0x528b=function(_0x15be32,_0x216976){_0x15be32=_0x15be32-0x0;var _0x5e9af0=_0x28b5[_0x15be32];return _0x5e9af0;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var moment=require('moment');var BPromise=require(_0x528b('0x2'));var rs=require(_0x528b('0x3'));var fs=require('fs');var Redis=require(_0x528b('0x4'));var db=require(_0x528b('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x528b('0x6'));var config=require(_0x528b('0x7'));var jayson=require(_0x528b('0x8'));var client=jayson['client'][_0x528b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xdb0183,_0x4e654d,_0x407eac){return new BPromise(function(_0x11cc77,_0x481f21){return client[_0x528b('0xa')](_0xdb0183,_0x407eac)[_0x528b('0xb')](function(_0x4d1402){logger[_0x528b('0xc')](_0x528b('0xd'),_0x4e654d,_0x528b('0xe'));logger['debug']('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x4e654d,_0x528b('0xe'),JSON['stringify'](_0x4d1402));if(_0x4d1402[_0x528b('0xf')]){if(_0x4d1402[_0x528b('0xf')]['code']===0x1f4){logger[_0x528b('0xf')](_0x528b('0xd'),_0x4e654d,_0x4d1402[_0x528b('0xf')][_0x528b('0x10')]);return _0x481f21(_0x4d1402[_0x528b('0xf')][_0x528b('0x10')]);}logger['error'](_0x528b('0xd'),_0x4e654d,_0x4d1402[_0x528b('0xf')]['message']);return _0x11cc77(_0x4d1402['error'][_0x528b('0x10')]);}else{logger[_0x528b('0xc')](_0x528b('0xd'),_0x4e654d,_0x528b('0xe'));_0x11cc77(_0x4d1402['result'][_0x528b('0x10')]);}})['catch'](function(_0x385afe){logger[_0x528b('0xf')](_0x528b('0xd'),_0x4e654d,_0x385afe);_0x481f21(_0x385afe);});});} \ No newline at end of file +var _0x5591=['../../config/environment','jayson/promise','client','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x25c5eb,_0x165a76){var _0x5aa03f=function(_0x4161f7){while(--_0x4161f7){_0x25c5eb['push'](_0x25c5eb['shift']());}};_0x5aa03f(++_0x165a76);}(_0x5591,0x1dc));var _0x1559=function(_0x4f4319,_0x472bf7){_0x4f4319=_0x4f4319-0x0;var _0xacf3f6=_0x5591[_0x4f4319];return _0xacf3f6;};'use strict';var _=require('lodash');var util=require(_0x1559('0x0'));var moment=require(_0x1559('0x1'));var BPromise=require(_0x1559('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1559('0x3'));var db=require(_0x1559('0x4'))['db'];var utils=require(_0x1559('0x5'));var logger=require('../../config/logger')(_0x1559('0x6'));var config=require(_0x1559('0x7'));var jayson=require(_0x1559('0x8'));var client=jayson[_0x1559('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x273b7c,_0x1d7358,_0x3312cb){return new BPromise(function(_0x169ea6,_0x144b1d){return client[_0x1559('0xa')](_0x273b7c,_0x3312cb)[_0x1559('0xb')](function(_0x4d7892){logger[_0x1559('0xc')](_0x1559('0xd'),_0x1d7358,_0x1559('0xe'));logger[_0x1559('0xf')](_0x1559('0x10'),_0x1d7358,'request\x20sent',JSON[_0x1559('0x11')](_0x4d7892));if(_0x4d7892[_0x1559('0x12')]){if(_0x4d7892[_0x1559('0x12')][_0x1559('0x13')]===0x1f4){logger['error'](_0x1559('0xd'),_0x1d7358,_0x4d7892[_0x1559('0x12')]['message']);return _0x144b1d(_0x4d7892[_0x1559('0x12')]['message']);}logger[_0x1559('0x12')](_0x1559('0xd'),_0x1d7358,_0x4d7892[_0x1559('0x12')][_0x1559('0x14')]);return _0x169ea6(_0x4d7892[_0x1559('0x12')][_0x1559('0x14')]);}else{logger['info']('MailTransferReport,\x20%s,\x20%s',_0x1d7358,_0x1559('0xe'));_0x169ea6(_0x4d7892[_0x1559('0x15')]['message']);}})[_0x1559('0x16')](function(_0x405590){logger['error'](_0x1559('0xd'),_0x1d7358,_0x405590);_0x144b1d(_0x405590);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index b1c189c..8ebf39c 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 _0xe701=['create','put','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show'];(function(_0x67104e,_0x31dab9){var _0x38beb8=function(_0x1fb1df){while(--_0x1fb1df){_0x67104e['push'](_0x67104e['shift']());}};_0x38beb8(++_0x31dab9);}(_0xe701,0x12c));var _0x1e70=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe701[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x1e70('0x0'));var util=require(_0x1e70('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e70('0x2'));var router=express[_0x1e70('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1e70('0x4'));var interaction=require(_0x1e70('0x5'));var config=require(_0x1e70('0x6'));var controller=require(_0x1e70('0x7'));router[_0x1e70('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e70('0x9')]);router[_0x1e70('0x8')](_0x1e70('0xa'),auth[_0x1e70('0xb')](),controller[_0x1e70('0xc')]);router[_0x1e70('0x8')](_0x1e70('0xd'),auth[_0x1e70('0xb')](),controller[_0x1e70('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1e70('0xf')]);router[_0x1e70('0x10')]('/:id',auth[_0x1e70('0xb')](),controller[_0x1e70('0x11')]);router[_0x1e70('0x12')](_0x1e70('0xd'),auth[_0x1e70('0xb')](),controller[_0x1e70('0x13')]);module[_0x1e70('0x14')]=router; \ No newline at end of file +var _0x37ed=['exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','get','/:id','show','post','create','put','delete','destroy'];(function(_0x312b19,_0xe6aa09){var _0x3c7236=function(_0x3b6ebe){while(--_0x3b6ebe){_0x312b19['push'](_0x312b19['shift']());}};_0x3c7236(++_0xe6aa09);}(_0x37ed,0x121));var _0xd37e=function(_0x5103d4,_0x5a217b){_0x5103d4=_0x5103d4-0x0;var _0x3def1a=_0x37ed[_0x5103d4];return _0x3def1a;};'use strict';var multer=require(_0xd37e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd37e('0x1'));var express=require('express');var router=express[_0xd37e('0x2')]();var fs_extra=require(_0xd37e('0x3'));var auth=require(_0xd37e('0x4'));var interaction=require(_0xd37e('0x5'));var config=require(_0xd37e('0x6'));var controller=require(_0xd37e('0x7'));router['get']('/',auth[_0xd37e('0x8')](),controller['index']);router[_0xd37e('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd37e('0x9')](_0xd37e('0xa'),auth[_0xd37e('0x8')](),controller[_0xd37e('0xb')]);router[_0xd37e('0xc')]('/',auth[_0xd37e('0x8')](),controller[_0xd37e('0xd')]);router[_0xd37e('0xe')](_0xd37e('0xa'),auth[_0xd37e('0x8')](),controller['update']);router[_0xd37e('0xf')]('/:id',auth[_0xd37e('0x8')](),controller[_0xd37e('0x10')]);module[_0xd37e('0x11')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 5de3483..16ec389 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 _0xee83=['seconds','exitAt','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff'];(function(_0xf3d909,_0xb9e263){var _0x24bab6=function(_0x4aea4f){while(--_0x4aea4f){_0xf3d909['push'](_0xf3d909['shift']());}};_0x24bab6(++_0xb9e263);}(_0xee83,0xd4));var _0x3ee8=function(_0x5627a7,_0x5bd2d1){_0x5627a7=_0x5627a7-0x0;var _0x4ea342=_0xee83[_0x5627a7];return _0x4ea342;};'use strict';var Sequelize=require(_0x3ee8('0x0'));var moment=require(_0x3ee8('0x1'));module['exports']={'channel':{'type':Sequelize[_0x3ee8('0x2')]},'membername':{'type':Sequelize[_0x3ee8('0x2')]},'interface':{'type':Sequelize[_0x3ee8('0x2')]},'type':{'type':Sequelize[_0x3ee8('0x2')],'defaultValue':_0x3ee8('0x3'),'comment':_0x3ee8('0x4')},'duration':{'type':Sequelize[_0x3ee8('0x5')]},'enterAt':{'type':Sequelize[_0x3ee8('0x6')]},'exitAt':{'type':Sequelize[_0x3ee8('0x6')],'set':function(_0x255306){var _0xcc314b=moment(_0x255306);var _0x4398d7=moment(this['getDataValue'](_0x3ee8('0x7')));var _0x39eddf=_0xcc314b[_0x3ee8('0x8')](_0x4398d7,_0x3ee8('0x9'));this['setDataValue'](_0x3ee8('0xa'),_0x255306);this[_0x3ee8('0xb')](_0x3ee8('0xc'),_0x39eddf>=0x0?_0x39eddf:null);}},'data1':{'type':Sequelize[_0x3ee8('0x2')],'comment':_0x3ee8('0xd')},'data2':{'type':Sequelize[_0x3ee8('0x2')],'comment':_0x3ee8('0xe')},'data3':{'type':Sequelize[_0x3ee8('0x2')],'comment':_0x3ee8('0xf')},'data4':{'type':Sequelize[_0x3ee8('0x2')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize['STRING'],'comment':_0x3ee8('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3ee8('0x5')]},'uniqueid':{'type':Sequelize[_0x3ee8('0x2')]}}; \ No newline at end of file +var _0xa9ce=['getDataValue','diff','seconds','setDataValue','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xa9ce,0x1d5));var _0xea9c=function(_0x33bc05,_0x243cdc){_0x33bc05=_0x33bc05-0x0;var _0x830049=_0xa9ce[_0x33bc05];return _0x830049;};'use strict';var Sequelize=require(_0xea9c('0x0'));var moment=require(_0xea9c('0x1'));module['exports']={'channel':{'type':Sequelize[_0xea9c('0x2')]},'membername':{'type':Sequelize[_0xea9c('0x2')]},'interface':{'type':Sequelize[_0xea9c('0x2')]},'type':{'type':Sequelize[_0xea9c('0x2')],'defaultValue':_0xea9c('0x3'),'comment':_0xea9c('0x4')},'duration':{'type':Sequelize[_0xea9c('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xea9c('0x6')],'set':function(_0x1d1f82){var _0x321043=moment(_0x1d1f82);var _0x2b739b=moment(this[_0xea9c('0x7')]('enterAt'));var _0x218eab=_0x321043[_0xea9c('0x8')](_0x2b739b,_0xea9c('0x9'));this[_0xea9c('0xa')]('exitAt',_0x1d1f82);this[_0xea9c('0xa')](_0xea9c('0xb'),_0x218eab>=0x0?_0x218eab:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0xea9c('0xc')},'data2':{'type':Sequelize[_0xea9c('0x2')],'comment':_0xea9c('0xd')},'data3':{'type':Sequelize[_0xea9c('0x2')],'comment':_0xea9c('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0xea9c('0xf')},'data5':{'type':Sequelize[_0xea9c('0x2')],'comment':_0xea9c('0x10')},'role':{'type':Sequelize[_0xea9c('0x2')]},'internal':{'type':Sequelize[_0xea9c('0x5')]},'uniqueid':{'type':Sequelize[_0xea9c('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index eed7f9a..3dca4c6 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x55ca,0x126));var _0xa55c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x55ca[_0x1d24eb];return _0x1dc576;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x544b3f,_0x4d8b66){var _0x15787f=function(_0x12467e){while(--_0x12467e){_0x544b3f['push'](_0x544b3f['shift']());}};_0x15787f(++_0x4d8b66);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 129edc5..9b1d430 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 _0xf2e0=['MemberReport','membername_interface','membername','interface','lodash','util','api','moment','request-promise','path','rimraf','./memberReport.attributes','exports'];(function(_0x203703,_0x3c029d){var _0x459cce=function(_0x32dcc4){while(--_0x32dcc4){_0x203703['push'](_0x203703['shift']());}};_0x459cce(++_0x3c029d);}(_0xf2e0,0xc7));var _0x0f2e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xf2e0[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x0f2e('0x0'));var util=require(_0x0f2e('0x1'));var logger=require('../../config/logger')(_0x0f2e('0x2'));var moment=require(_0x0f2e('0x3'));var BPromise=require('bluebird');var rp=require(_0x0f2e('0x4'));var fs=require('fs');var path=require(_0x0f2e('0x5'));var rimraf=require(_0x0f2e('0x6'));var config=require('../../config/environment');var attributes=require(_0x0f2e('0x7'));module[_0x0f2e('0x8')]=function(_0x256aba,_0x47c448){return _0x256aba['define'](_0x0f2e('0x9'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x0f2e('0xa'),'fields':[_0x0f2e('0xb'),_0x0f2e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5957=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_member','membername_interface','membername','interface','lodash','../../config/logger','api'];(function(_0x14dfc1,_0x1685b7){var _0x42ef8b=function(_0x501cad){while(--_0x501cad){_0x14dfc1['push'](_0x14dfc1['shift']());}};_0x42ef8b(++_0x1685b7);}(_0x5957,0x193));var _0x7595=function(_0x218429,_0x2a11ca){_0x218429=_0x218429-0x0;var _0x1e6e71=_0x5957[_0x218429];return _0x1e6e71;};'use strict';var _=require(_0x7595('0x0'));var util=require('util');var logger=require(_0x7595('0x1'))(_0x7595('0x2'));var moment=require(_0x7595('0x3'));var BPromise=require(_0x7595('0x4'));var rp=require(_0x7595('0x5'));var fs=require('fs');var path=require(_0x7595('0x6'));var rimraf=require(_0x7595('0x7'));var config=require(_0x7595('0x8'));var attributes=require('./memberReport.attributes');module['exports']=function(_0xb781b8,_0x21c600){return _0xb781b8[_0x7595('0x9')]('MemberReport',attributes,{'tableName':_0x7595('0xa'),'paranoid':![],'indexes':[{'name':_0x7595('0xb'),'fields':[_0x7595('0xc'),_0x7595('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 18894af..519c387 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 _0x6bb4=['GetMemberReport','MemberReport','findAll','options','raw','attributes','include','map','model','CreateMemberReport','create','body','update','where','limit','UpdateMemberReport','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch'];(function(_0x3a51f0,_0x84e1c7){var _0x11c7c8=function(_0x20253b){while(--_0x20253b){_0x3a51f0['push'](_0x3a51f0['shift']());}};_0x11c7c8(++_0x84e1c7);}(_0x6bb4,0x1a7));var _0x46bb=function(_0x2183e4,_0x9caef9){_0x2183e4=_0x2183e4-0x0;var _0x5e5c0a=_0x6bb4[_0x2183e4];return _0x5e5c0a;};'use strict';var _=require(_0x46bb('0x0'));var util=require(_0x46bb('0x1'));var moment=require(_0x46bb('0x2'));var BPromise=require('bluebird');var rs=require(_0x46bb('0x3'));var fs=require('fs');var Redis=require(_0x46bb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x46bb('0x5'));var logger=require(_0x46bb('0x6'))(_0x46bb('0x7'));var config=require(_0x46bb('0x8'));var jayson=require(_0x46bb('0x9'));var client=jayson[_0x46bb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4fa5c4,_0x2f1e64,_0x4338c9){return new BPromise(function(_0x57fb08,_0x5809f5){return client['request'](_0x4fa5c4,_0x4338c9)[_0x46bb('0xb')](function(_0x2c7e4c){logger['info'](_0x46bb('0xc'),_0x2f1e64,_0x46bb('0xd'));logger[_0x46bb('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x2f1e64,_0x46bb('0xd'),JSON[_0x46bb('0xf')](_0x2c7e4c));if(_0x2c7e4c['error']){if(_0x2c7e4c[_0x46bb('0x10')][_0x46bb('0x11')]===0x1f4){logger[_0x46bb('0x10')]('MemberReport,\x20%s,\x20%s',_0x2f1e64,_0x2c7e4c[_0x46bb('0x10')]['message']);return _0x5809f5(_0x2c7e4c['error'][_0x46bb('0x12')]);}logger['error'](_0x46bb('0xc'),_0x2f1e64,_0x2c7e4c[_0x46bb('0x10')]['message']);return _0x57fb08(_0x2c7e4c[_0x46bb('0x10')]['message']);}else{logger[_0x46bb('0x13')]('MemberReport,\x20%s,\x20%s',_0x2f1e64,_0x46bb('0xd'));_0x57fb08(_0x2c7e4c['result']['message']);}})[_0x46bb('0x14')](function(_0x3965ed){logger['error'](_0x46bb('0xc'),_0x2f1e64,_0x3965ed);_0x5809f5(_0x3965ed);});});}exports[_0x46bb('0x15')]=function(_0x5eb0e1){var _0x53ee66=this;return new Promise(function(_0x3f0f4a,_0x3c5a7f){return db[_0x46bb('0x16')][_0x46bb('0x17')]({'raw':_0x5eb0e1[_0x46bb('0x18')]?_0x5eb0e1[_0x46bb('0x18')][_0x46bb('0x19')]===undefined?!![]:![]:!![],'where':_0x5eb0e1[_0x46bb('0x18')]?_0x5eb0e1['options']['where']||null:null,'attributes':_0x5eb0e1[_0x46bb('0x18')]?_0x5eb0e1[_0x46bb('0x18')][_0x46bb('0x1a')]||null:null,'limit':_0x5eb0e1['options']?_0x5eb0e1['options']['limit']||null:null,'include':_0x5eb0e1[_0x46bb('0x18')]?_0x5eb0e1[_0x46bb('0x18')][_0x46bb('0x1b')]?_[_0x46bb('0x1c')](_0x5eb0e1['options']['include'],function(_0x59c525){return{'model':db[_0x59c525['model']],'as':_0x59c525['as'],'attributes':_0x59c525['attributes'],'include':_0x59c525[_0x46bb('0x1b')]?_['map'](_0x59c525[_0x46bb('0x1b')],function(_0x3c0031){return{'model':db[_0x3c0031[_0x46bb('0x1d')]],'as':_0x3c0031['as'],'attributes':_0x3c0031[_0x46bb('0x1a')],'include':_0x3c0031[_0x46bb('0x1b')]?_[_0x46bb('0x1c')](_0x3c0031[_0x46bb('0x1b')],function(_0x2d1a2f){return{'model':db[_0x2d1a2f[_0x46bb('0x1d')]],'as':_0x2d1a2f['as'],'attributes':_0x2d1a2f[_0x46bb('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x104e9b){logger[_0x46bb('0x13')]('GetMemberReport',_0x5eb0e1);logger[_0x46bb('0xe')](_0x46bb('0x15'),_0x5eb0e1,JSON[_0x46bb('0xf')](_0x104e9b));_0x3f0f4a(_0x104e9b);})[_0x46bb('0x14')](function(_0x1977af){logger[_0x46bb('0x10')](_0x46bb('0x15'),_0x1977af[_0x46bb('0x12')],_0x5eb0e1);_0x3c5a7f(_0x53ee66[_0x46bb('0x10')](0x1f4,_0x1977af[_0x46bb('0x12')]));});});};exports[_0x46bb('0x1e')]=function(_0x1fb8ea){var _0x2d34d6=this;return new Promise(function(_0x226a13,_0x42addf){return db[_0x46bb('0x16')][_0x46bb('0x1f')](_0x1fb8ea[_0x46bb('0x20')],{'raw':_0x1fb8ea[_0x46bb('0x18')]?_0x1fb8ea[_0x46bb('0x18')][_0x46bb('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xd69dd8){logger['info'](_0x46bb('0x1e'),_0x1fb8ea);logger['debug'](_0x46bb('0x1e'),_0x1fb8ea,JSON[_0x46bb('0xf')](_0xd69dd8));_0x226a13(_0xd69dd8);})[_0x46bb('0x14')](function(_0x571b9b){logger[_0x46bb('0x10')](_0x46bb('0x1e'),_0x571b9b[_0x46bb('0x12')],_0x1fb8ea);_0x42addf(_0x2d34d6[_0x46bb('0x10')](0x1f4,_0x571b9b[_0x46bb('0x12')]));});});};exports['UpdateMemberReport']=function(_0x2adde0){var _0x2482dc=this;return new Promise(function(_0x3e46cd,_0x37db3c){return db[_0x46bb('0x16')][_0x46bb('0x21')](_0x2adde0[_0x46bb('0x20')],{'raw':_0x2adde0[_0x46bb('0x18')]?_0x2adde0[_0x46bb('0x18')][_0x46bb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2adde0[_0x46bb('0x18')]?_0x2adde0[_0x46bb('0x18')][_0x46bb('0x22')]||null:null,'attributes':_0x2adde0[_0x46bb('0x18')]?_0x2adde0[_0x46bb('0x18')][_0x46bb('0x1a')]||null:null,'limit':_0x2adde0[_0x46bb('0x18')]?_0x2adde0[_0x46bb('0x18')][_0x46bb('0x23')]||null:null})[_0x46bb('0xb')](function(_0x3b976d){logger[_0x46bb('0x13')](_0x46bb('0x24'),_0x2adde0);logger['debug'](_0x46bb('0x24'),_0x2adde0,JSON['stringify'](_0x3b976d));_0x3e46cd(_0x3b976d);})['catch'](function(_0x5cf534){logger[_0x46bb('0x10')]('UpdateMemberReport',_0x5cf534[_0x46bb('0x12')],_0x2adde0);_0x37db3c(_0x2482dc['error'](0x1f4,_0x5cf534['message']));});});}; \ No newline at end of file +var _0x1354=['http','request','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','findAll','options','where','limit','include','map','model','attributes','then','GetMemberReport','debug','stringify','catch','CreateMemberReport','MemberReport','create','body','raw','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x2bef19,_0x40b26b){var _0x1521e7=function(_0x4038d2){while(--_0x4038d2){_0x2bef19['push'](_0x2bef19['shift']());}};_0x1521e7(++_0x40b26b);}(_0x1354,0x95));var _0x4135=function(_0x38e8b0,_0x5b8cb5){_0x38e8b0=_0x38e8b0-0x0;var _0x139697=_0x1354[_0x38e8b0];return _0x139697;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var moment=require(_0x4135('0x2'));var BPromise=require(_0x4135('0x3'));var rs=require(_0x4135('0x4'));var fs=require('fs');var Redis=require(_0x4135('0x5'));var db=require(_0x4135('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4135('0x7'))(_0x4135('0x8'));var config=require(_0x4135('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4135('0xa')][_0x4135('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e355d,_0x419ad4,_0x1dcce0){return new BPromise(function(_0x3e7ae3,_0x50ef3f){return client[_0x4135('0xc')](_0x5e355d,_0x1dcce0)['then'](function(_0x365d9b){logger[_0x4135('0xd')](_0x4135('0xe'),_0x419ad4,_0x4135('0xf'));logger['debug'](_0x4135('0x10'),_0x419ad4,'request\x20sent',JSON['stringify'](_0x365d9b));if(_0x365d9b[_0x4135('0x11')]){if(_0x365d9b[_0x4135('0x11')][_0x4135('0x12')]===0x1f4){logger['error'](_0x4135('0xe'),_0x419ad4,_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);return _0x50ef3f(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}logger[_0x4135('0x11')]('MemberReport,\x20%s,\x20%s',_0x419ad4,_0x365d9b['error'][_0x4135('0x13')]);return _0x3e7ae3(_0x365d9b[_0x4135('0x11')][_0x4135('0x13')]);}else{logger[_0x4135('0xd')]('MemberReport,\x20%s,\x20%s',_0x419ad4,_0x4135('0xf'));_0x3e7ae3(_0x365d9b[_0x4135('0x14')]['message']);}})['catch'](function(_0x32b4db){logger['error'](_0x4135('0xe'),_0x419ad4,_0x32b4db);_0x50ef3f(_0x32b4db);});});}exports['GetMemberReport']=function(_0x53f54e){var _0x5b9586=this;return new Promise(function(_0x53f5a7,_0x2bb752){return db['MemberReport'][_0x4135('0x15')]({'raw':_0x53f54e[_0x4135('0x16')]?_0x53f54e[_0x4135('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x53f54e[_0x4135('0x16')]?_0x53f54e[_0x4135('0x16')][_0x4135('0x17')]||null:null,'attributes':_0x53f54e['options']?_0x53f54e[_0x4135('0x16')]['attributes']||null:null,'limit':_0x53f54e[_0x4135('0x16')]?_0x53f54e[_0x4135('0x16')][_0x4135('0x18')]||null:null,'include':_0x53f54e[_0x4135('0x16')]?_0x53f54e['options'][_0x4135('0x19')]?_[_0x4135('0x1a')](_0x53f54e[_0x4135('0x16')][_0x4135('0x19')],function(_0x83a794){return{'model':db[_0x83a794[_0x4135('0x1b')]],'as':_0x83a794['as'],'attributes':_0x83a794[_0x4135('0x1c')],'include':_0x83a794[_0x4135('0x19')]?_[_0x4135('0x1a')](_0x83a794[_0x4135('0x19')],function(_0x12a9fd){return{'model':db[_0x12a9fd[_0x4135('0x1b')]],'as':_0x12a9fd['as'],'attributes':_0x12a9fd[_0x4135('0x1c')],'include':_0x12a9fd[_0x4135('0x19')]?_['map'](_0x12a9fd[_0x4135('0x19')],function(_0x3e40bc){return{'model':db[_0x3e40bc[_0x4135('0x1b')]],'as':_0x3e40bc['as'],'attributes':_0x3e40bc[_0x4135('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x4135('0x1d')](function(_0x3d2dcf){logger['info'](_0x4135('0x1e'),_0x53f54e);logger[_0x4135('0x1f')](_0x4135('0x1e'),_0x53f54e,JSON[_0x4135('0x20')](_0x3d2dcf));_0x53f5a7(_0x3d2dcf);})[_0x4135('0x21')](function(_0x511fce){logger[_0x4135('0x11')](_0x4135('0x1e'),_0x511fce['message'],_0x53f54e);_0x2bb752(_0x5b9586[_0x4135('0x11')](0x1f4,_0x511fce['message']));});});};exports[_0x4135('0x22')]=function(_0x256f25){var _0x25a672=this;return new Promise(function(_0x29821d,_0x5d2a94){return db[_0x4135('0x23')][_0x4135('0x24')](_0x256f25[_0x4135('0x25')],{'raw':_0x256f25[_0x4135('0x16')]?_0x256f25[_0x4135('0x16')][_0x4135('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x44b3b6){logger[_0x4135('0xd')]('CreateMemberReport',_0x256f25);logger[_0x4135('0x1f')]('CreateMemberReport',_0x256f25,JSON[_0x4135('0x20')](_0x44b3b6));_0x29821d(_0x44b3b6);})[_0x4135('0x21')](function(_0x5f14cb){logger['error'](_0x4135('0x22'),_0x5f14cb[_0x4135('0x13')],_0x256f25);_0x5d2a94(_0x25a672[_0x4135('0x11')](0x1f4,_0x5f14cb['message']));});});};exports[_0x4135('0x27')]=function(_0x2f97ec){var _0x3226ad=this;return new Promise(function(_0x547718,_0x2cf591){return db[_0x4135('0x23')]['update'](_0x2f97ec[_0x4135('0x25')],{'raw':_0x2f97ec[_0x4135('0x16')]?_0x2f97ec['options'][_0x4135('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f97ec['options']?_0x2f97ec[_0x4135('0x16')][_0x4135('0x17')]||null:null,'attributes':_0x2f97ec[_0x4135('0x16')]?_0x2f97ec[_0x4135('0x16')][_0x4135('0x1c')]||null:null,'limit':_0x2f97ec[_0x4135('0x16')]?_0x2f97ec['options'][_0x4135('0x18')]||null:null})[_0x4135('0x1d')](function(_0x51a888){logger[_0x4135('0xd')]('UpdateMemberReport',_0x2f97ec);logger[_0x4135('0x1f')](_0x4135('0x27'),_0x2f97ec,JSON[_0x4135('0x20')](_0x51a888));_0x547718(_0x51a888);})[_0x4135('0x21')](function(_0x244b52){logger[_0x4135('0x11')](_0x4135('0x27'),_0x244b52[_0x4135('0x13')],_0x2f97ec);_0x2cf591(_0x3226ad[_0x4135('0x11')](0x1f4,_0x244b52[_0x4135('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1c8bd19..b2611be 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 _0xafdd=['fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3a35c3,_0x4d00f4){var _0x2ef6f3=function(_0x24f818){while(--_0x24f818){_0x3a35c3['push'](_0x3a35c3['shift']());}};_0x2ef6f3(++_0x4d00f4);}(_0xafdd,0x19a));var _0xdafd=function(_0x38ff3e,_0x59a11f){_0x38ff3e=_0x38ff3e-0x0;var _0x409280=_0xafdd[_0x38ff3e];return _0x409280;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',controller[_0xdafd('0xb')]);module[_0xdafd('0xc')]=router; \ No newline at end of file +var _0x2b24=['../../config/environment','./migration.controller','get','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29ffb1,_0x572b0a){var _0x2de08b=function(_0x98037b){while(--_0x98037b){_0x29ffb1['push'](_0x29ffb1['shift']());}};_0x2de08b(++_0x572b0a);}(_0x2b24,0x72));var _0x42b2=function(_0x24d16a,_0x3bbd43){_0x24d16a=_0x24d16a-0x0;var _0x33e1f8=_0x2b24[_0x24d16a];return _0x33e1f8;};'use strict';var multer=require('multer');var util=require(_0x42b2('0x0'));var path=require(_0x42b2('0x1'));var timeout=require('connect-timeout');var express=require(_0x42b2('0x2'));var router=express[_0x42b2('0x3')]();var fs_extra=require(_0x42b2('0x4'));var auth=require(_0x42b2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x42b2('0x6'));var controller=require(_0x42b2('0x7'));router[_0x42b2('0x8')]('/',controller['index']);module[_0x42b2('0x9')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index a429e23..9bbb0cd 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 _0x4717=['version','sequelize','exports','STRING'];(function(_0x5385a7,_0x460744){var _0x10b1bc=function(_0x2fac58){while(--_0x2fac58){_0x5385a7['push'](_0x5385a7['shift']());}};_0x10b1bc(++_0x460744);}(_0x4717,0xb9));var _0x7471=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x4717[_0x2df507];return _0x1f7167;};'use strict';var Sequelize=require(_0x7471('0x0'));module[_0x7471('0x1')]={'version':{'type':Sequelize[_0x7471('0x2')],'unique':_0x7471('0x3')}}; \ No newline at end of file +var _0x4bb7=['exports','STRING','sequelize'];(function(_0x3933e0,_0x1ffe49){var _0x7f44af=function(_0x40954c){while(--_0x40954c){_0x3933e0['push'](_0x3933e0['shift']());}};_0x7f44af(++_0x1ffe49);}(_0x4bb7,0x74));var _0x74bb=function(_0x377b01,_0x651f42){_0x377b01=_0x377b01-0x0;var _0x150a87=_0x4bb7[_0x377b01];return _0x150a87;};'use strict';var Sequelize=require(_0x74bb('0x0'));module[_0x74bb('0x1')]={'version':{'type':Sequelize[_0x74bb('0x2')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 9a3553d..a6e79b4 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 _0x724a=['rows','catch','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','reject','then','destroy','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','Migration','includeAll','include','findAll'];(function(_0x3aa72a,_0x385d72){var _0x352329=function(_0x9624da){while(--_0x9624da){_0x3aa72a['push'](_0x3aa72a['shift']());}};_0x352329(++_0x385d72);}(_0x724a,0x1b4));var _0xa724=function(_0x34022f,_0x21134c){_0x34022f=_0x34022f-0x0;var _0x1bebdf=_0x724a[_0x34022f];return _0x1bebdf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa724('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa724('0x1'));var rp=require(_0xa724('0x2'));var moment=require(_0xa724('0x3'));var BPromise=require(_0xa724('0x4'));var Mustache=require(_0xa724('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa724('0x6'));var csv=require('to-csv');var ejs=require(_0xa724('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa724('0x8'));var crypto=require(_0xa724('0x9'));var jsforce=require(_0xa724('0xa'));var deskjs=require(_0xa724('0xb'));var toCsv=require(_0xa724('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa724('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xa724('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa724('0xf'));var logger=require(_0xa724('0x10'))(_0xa724('0x11'));var utils=require(_0xa724('0x12'));var config=require(_0xa724('0x13'));var licenseUtil=require(_0xa724('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f6de1,_0xa86fef){_0xa86fef=_0xa86fef||0xcc;return function(_0x1f174b){if(_0x1f174b){return _0x4f6de1[_0xa724('0x15')](_0xa86fef);}return _0x4f6de1[_0xa724('0x16')](_0xa86fef)[_0xa724('0x17')]();};}function respondWithResult(_0x1621cd,_0x271345){_0x271345=_0x271345||0xc8;return function(_0x241e8f){if(_0x241e8f){return _0x1621cd['status'](_0x271345)[_0xa724('0x18')](_0x241e8f);}};}function respondWithFilteredResult(_0x4e3bfe,_0x56e9dc){return function(_0x312976){if(_0x312976){var _0x4722fe=typeof _0x56e9dc[_0xa724('0x19')]===_0xa724('0x1a')&&typeof _0x56e9dc[_0xa724('0x1b')]===_0xa724('0x1a');var _0xa6455d=_0x312976['count'];var _0x5c7186=_0x4722fe?0x0:_0x56e9dc['offset'];var _0x55dbcc=_0x4722fe?_0x312976[_0xa724('0x1c')]:_0x56e9dc[_0xa724('0x19')]+_0x56e9dc[_0xa724('0x1b')];var _0x214b7b;if(_0x55dbcc>=_0xa6455d){_0x55dbcc=_0xa6455d;_0x214b7b=0xc8;}else{_0x214b7b=0xce;}_0x4e3bfe[_0xa724('0x16')](_0x214b7b);return _0x4e3bfe['set']('Content-Range',_0x5c7186+'-'+_0x55dbcc+'/'+_0xa6455d)[_0xa724('0x18')](_0x312976);}return null;};}function patchUpdates(_0x2e1951){return function(_0x57496a){try{jsonpatch['apply'](_0x57496a,_0x2e1951,!![]);}catch(_0x229740){return BPromise[_0xa724('0x1d')](_0x229740);}return _0x57496a['save']();};}function saveUpdates(_0x2bf644,_0x1a7357){return function(_0x3334b0){if(_0x3334b0){return _0x3334b0['update'](_0x2bf644)[_0xa724('0x1e')](function(_0x270ea8){return _0x270ea8;});}return null;};}function removeEntity(_0x3f969f,_0x1b0499){return function(_0x49aa6e){if(_0x49aa6e){return _0x49aa6e[_0xa724('0x1f')]()[_0xa724('0x1e')](function(){_0x3f969f[_0xa724('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x334448,_0x114b62){return function(_0x4edd62){if(!_0x4edd62){_0x334448[_0xa724('0x15')](0x194);}return _0x4edd62;};}function handleError(_0x3b1b82,_0x24a3b1){_0x24a3b1=_0x24a3b1||0x1f4;return function(_0x37b312){logger['error'](_0x37b312[_0xa724('0x20')]);if(_0x37b312[_0xa724('0x21')]){delete _0x37b312['name'];}_0x3b1b82['status'](_0x24a3b1)[_0xa724('0x22')](_0x37b312);};}exports[_0xa724('0x23')]=function(_0x33ab3a,_0x327a2e){var _0x31ccfc={},_0x1884b8={},_0x58cfa4={'count':0x0,'rows':[]};var _0x5c89d7=_[_0xa724('0x24')](db['Migration']['rawAttributes'],function(_0x329147){return{'name':_0x329147[_0xa724('0x25')],'type':_0x329147[_0xa724('0x26')][_0xa724('0x27')]};});_0x1884b8[_0xa724('0x28')]=_['map'](_0x5c89d7,_0xa724('0x21'));_0x1884b8[_0xa724('0x29')]=_[_0xa724('0x2a')](_0x33ab3a[_0xa724('0x29')]);_0x1884b8['filters']=_[_0xa724('0x2b')](_0x1884b8[_0xa724('0x28')],_0x1884b8[_0xa724('0x29')]);_0x31ccfc[_0xa724('0x2c')]=_[_0xa724('0x2b')](_0x1884b8[_0xa724('0x28')],qs[_0xa724('0x2d')](_0x33ab3a['query'][_0xa724('0x2d')]));_0x31ccfc[_0xa724('0x2c')]=_0x31ccfc[_0xa724('0x2c')][_0xa724('0x2e')]?_0x31ccfc[_0xa724('0x2c')]:_0x1884b8[_0xa724('0x28')];if(!_0x33ab3a[_0xa724('0x29')][_0xa724('0x2f')](_0xa724('0x30'))){_0x31ccfc[_0xa724('0x1b')]=qs[_0xa724('0x1b')](_0x33ab3a[_0xa724('0x29')][_0xa724('0x1b')]);_0x31ccfc[_0xa724('0x19')]=qs[_0xa724('0x19')](_0x33ab3a['query'][_0xa724('0x19')]);}_0x31ccfc['order']=qs[_0xa724('0x31')](_0x33ab3a[_0xa724('0x29')][_0xa724('0x31')]);_0x31ccfc['where']=qs[_0xa724('0x32')](_[_0xa724('0x33')](_0x33ab3a[_0xa724('0x29')],_0x1884b8[_0xa724('0x32')]),_0x5c89d7);if(_0x33ab3a[_0xa724('0x29')][_0xa724('0x34')]){_0x31ccfc[_0xa724('0x35')]=_[_0xa724('0x36')](_0x31ccfc[_0xa724('0x35')],{'$or':_[_0xa724('0x24')](_0x5c89d7,function(_0x99149a){if(_0x99149a[_0xa724('0x26')]!==_0xa724('0x37')){var _0x38fd10={};_0x38fd10[_0x99149a[_0xa724('0x21')]]={'$like':'%'+_0x33ab3a[_0xa724('0x29')]['filter']+'%'};return _0x38fd10;}})});}_0x31ccfc=_[_0xa724('0x36')]({},_0x31ccfc,_0x33ab3a['options']);var _0x53e234={'where':_0x31ccfc['where']};return db[_0xa724('0x38')]['count'](_0x53e234)[_0xa724('0x1e')](function(_0x1dad1b){_0x58cfa4[_0xa724('0x1c')]=_0x1dad1b;if(_0x33ab3a[_0xa724('0x29')][_0xa724('0x39')]){_0x31ccfc[_0xa724('0x3a')]=[{'all':!![]}];}return db[_0xa724('0x38')][_0xa724('0x3b')](_0x31ccfc);})[_0xa724('0x1e')](function(_0x5b548c){_0x58cfa4[_0xa724('0x3c')]=_0x5b548c;return _0x58cfa4;})[_0xa724('0x1e')](respondWithFilteredResult(_0x327a2e,_0x31ccfc))[_0xa724('0x3d')](handleError(_0x327a2e,null));}; \ No newline at end of file +var _0x6bad=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','end','error','stack','name','send','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','Migration','then','include','rows','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','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'];(function(_0x213c63,_0x420de6){var _0x300bfb=function(_0x5d0b2e){while(--_0x5d0b2e){_0x213c63['push'](_0x213c63['shift']());}};_0x300bfb(++_0x420de6);}(_0x6bad,0x1e8));var _0xd6ba=function(_0x22e6e1,_0x27e586){_0x22e6e1=_0x22e6e1-0x0;var _0x592de9=_0x6bad[_0x22e6e1];return _0x592de9;};'use strict';var emlformat=require(_0xd6ba('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd6ba('0x1'));var jsonpatch=require(_0xd6ba('0x2'));var rp=require('request-promise');var moment=require(_0xd6ba('0x3'));var BPromise=require(_0xd6ba('0x4'));var Mustache=require(_0xd6ba('0x5'));var util=require(_0xd6ba('0x6'));var path=require(_0xd6ba('0x7'));var sox=require(_0xd6ba('0x8'));var csv=require(_0xd6ba('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd6ba('0xa'));var _=require('lodash');var squel=require(_0xd6ba('0xb'));var crypto=require(_0xd6ba('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd6ba('0xd'));var toCsv=require(_0xd6ba('0x9'));var querystring=require('querystring');var Papa=require(_0xd6ba('0xe'));var Redis=require(_0xd6ba('0xf'));var authService=require(_0xd6ba('0x10'));var qs=require(_0xd6ba('0x11'));var as=require(_0xd6ba('0x12'));var hardwareService=require(_0xd6ba('0x13'));var logger=require('../../config/logger')(_0xd6ba('0x14'));var utils=require(_0xd6ba('0x15'));var config=require(_0xd6ba('0x16'));var licenseUtil=require(_0xd6ba('0x17'));var db=require(_0xd6ba('0x18'))['db'];function respondWithStatusCode(_0x372627,_0xcc1fa9){_0xcc1fa9=_0xcc1fa9||0xcc;return function(_0x2ea75a){if(_0x2ea75a){return _0x372627[_0xd6ba('0x19')](_0xcc1fa9);}return _0x372627[_0xd6ba('0x1a')](_0xcc1fa9)['end']();};}function respondWithResult(_0xd75f1a,_0x59530d){_0x59530d=_0x59530d||0xc8;return function(_0x3fb8e3){if(_0x3fb8e3){return _0xd75f1a[_0xd6ba('0x1a')](_0x59530d)[_0xd6ba('0x1b')](_0x3fb8e3);}};}function respondWithFilteredResult(_0x8c6046,_0xa4be8f){return function(_0x4cc6b2){if(_0x4cc6b2){var _0x462a5e=typeof _0xa4be8f[_0xd6ba('0x1c')]===_0xd6ba('0x1d')&&typeof _0xa4be8f[_0xd6ba('0x1e')]===_0xd6ba('0x1d');var _0x12eac5=_0x4cc6b2[_0xd6ba('0x1f')];var _0x41147c=_0x462a5e?0x0:_0xa4be8f[_0xd6ba('0x1c')];var _0x5ba124=_0x462a5e?_0x4cc6b2[_0xd6ba('0x1f')]:_0xa4be8f['offset']+_0xa4be8f['limit'];var _0x1863b6;if(_0x5ba124>=_0x12eac5){_0x5ba124=_0x12eac5;_0x1863b6=0xc8;}else{_0x1863b6=0xce;}_0x8c6046[_0xd6ba('0x1a')](_0x1863b6);return _0x8c6046['set'](_0xd6ba('0x20'),_0x41147c+'-'+_0x5ba124+'/'+_0x12eac5)['json'](_0x4cc6b2);}return null;};}function patchUpdates(_0x2e86d6){return function(_0x4b6065){try{jsonpatch[_0xd6ba('0x21')](_0x4b6065,_0x2e86d6,!![]);}catch(_0x40d3f5){return BPromise[_0xd6ba('0x22')](_0x40d3f5);}return _0x4b6065['save']();};}function saveUpdates(_0x29afc6,_0x4d8f3c){return function(_0xb26abb){if(_0xb26abb){return _0xb26abb[_0xd6ba('0x23')](_0x29afc6)['then'](function(_0x222dff){return _0x222dff;});}return null;};}function removeEntity(_0x5c4ab7,_0x21270d){return function(_0x3622e2){if(_0x3622e2){return _0x3622e2['destroy']()['then'](function(){_0x5c4ab7[_0xd6ba('0x1a')](0xcc)[_0xd6ba('0x24')]();});}};}function handleEntityNotFound(_0xef2a32,_0x79ca40){return function(_0xf35b7e){if(!_0xf35b7e){_0xef2a32['sendStatus'](0x194);}return _0xf35b7e;};}function handleError(_0x1f17b1,_0x118c84){_0x118c84=_0x118c84||0x1f4;return function(_0x3508b9){logger[_0xd6ba('0x25')](_0x3508b9[_0xd6ba('0x26')]);if(_0x3508b9[_0xd6ba('0x27')]){delete _0x3508b9[_0xd6ba('0x27')];}_0x1f17b1['status'](_0x118c84)[_0xd6ba('0x28')](_0x3508b9);};}exports[_0xd6ba('0x29')]=function(_0x72cd8b,_0x462595){var _0x650299={},_0x3f0248={},_0x4ddfe3={'count':0x0,'rows':[]};var _0xad2730=_[_0xd6ba('0x2a')](db['Migration']['rawAttributes'],function(_0x4be4ba){return{'name':_0x4be4ba['fieldName'],'type':_0x4be4ba[_0xd6ba('0x2b')][_0xd6ba('0x2c')]};});_0x3f0248[_0xd6ba('0x2d')]=_[_0xd6ba('0x2a')](_0xad2730,_0xd6ba('0x27'));_0x3f0248['query']=_[_0xd6ba('0x2e')](_0x72cd8b[_0xd6ba('0x2f')]);_0x3f0248[_0xd6ba('0x30')]=_[_0xd6ba('0x31')](_0x3f0248[_0xd6ba('0x2d')],_0x3f0248[_0xd6ba('0x2f')]);_0x650299[_0xd6ba('0x32')]=_[_0xd6ba('0x31')](_0x3f0248['model'],qs[_0xd6ba('0x33')](_0x72cd8b['query'][_0xd6ba('0x33')]));_0x650299['attributes']=_0x650299[_0xd6ba('0x32')][_0xd6ba('0x34')]?_0x650299[_0xd6ba('0x32')]:_0x3f0248['model'];if(!_0x72cd8b[_0xd6ba('0x2f')][_0xd6ba('0x35')](_0xd6ba('0x36'))){_0x650299[_0xd6ba('0x1e')]=qs[_0xd6ba('0x1e')](_0x72cd8b['query'][_0xd6ba('0x1e')]);_0x650299[_0xd6ba('0x1c')]=qs['offset'](_0x72cd8b['query'][_0xd6ba('0x1c')]);}_0x650299[_0xd6ba('0x37')]=qs['sort'](_0x72cd8b['query']['sort']);_0x650299[_0xd6ba('0x38')]=qs['filters'](_[_0xd6ba('0x39')](_0x72cd8b[_0xd6ba('0x2f')],_0x3f0248['filters']),_0xad2730);if(_0x72cd8b[_0xd6ba('0x2f')]['filter']){_0x650299[_0xd6ba('0x38')]=_[_0xd6ba('0x3a')](_0x650299[_0xd6ba('0x38')],{'$or':_[_0xd6ba('0x2a')](_0xad2730,function(_0x460ac7){if(_0x460ac7['type']!=='VIRTUAL'){var _0x43f753={};_0x43f753[_0x460ac7[_0xd6ba('0x27')]]={'$like':'%'+_0x72cd8b[_0xd6ba('0x2f')]['filter']+'%'};return _0x43f753;}})});}_0x650299=_[_0xd6ba('0x3a')]({},_0x650299,_0x72cd8b['options']);var _0x323d22={'where':_0x650299[_0xd6ba('0x38')]};return db[_0xd6ba('0x3b')][_0xd6ba('0x1f')](_0x323d22)[_0xd6ba('0x3c')](function(_0xd3df4f){_0x4ddfe3[_0xd6ba('0x1f')]=_0xd3df4f;if(_0x72cd8b['query']['includeAll']){_0x650299[_0xd6ba('0x3d')]=[{'all':!![]}];}return db[_0xd6ba('0x3b')]['findAll'](_0x650299);})[_0xd6ba('0x3c')](function(_0x19875d){_0x4ddfe3[_0xd6ba('0x3e')]=_0x19875d;return _0x4ddfe3;})[_0xd6ba('0x3c')](respondWithFilteredResult(_0x462595,_0x650299))[_0xd6ba('0x3f')](handleError(_0x462595,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index df563b1..59aeaee 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 _0x7a27=['rimraf','../../config/environment','./migration.attributes','exports','define','migrations','lodash','moment','bluebird','request-promise','path'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0x7a27,0x1b3));var _0x77a2=function(_0x2a59fe,_0x2be050){_0x2a59fe=_0x2a59fe-0x0;var _0x30ce9f=_0x7a27[_0x2a59fe];return _0x30ce9f;};'use strict';var _=require(_0x77a2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x77a2('0x1'));var BPromise=require(_0x77a2('0x2'));var rp=require(_0x77a2('0x3'));var fs=require('fs');var path=require(_0x77a2('0x4'));var rimraf=require(_0x77a2('0x5'));var config=require(_0x77a2('0x6'));var attributes=require(_0x77a2('0x7'));module[_0x77a2('0x8')]=function(_0x3ff0ed,_0x3f804e){return _0x3ff0ed[_0x77a2('0x9')]('Migration',attributes,{'tableName':_0x77a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaa39=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','lodash'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0xaa39,0xd7));var _0x9aa3=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0xaa39[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0x9aa3('0x0'));var util=require('util');var logger=require(_0x9aa3('0x1'))(_0x9aa3('0x2'));var moment=require('moment');var BPromise=require(_0x9aa3('0x3'));var rp=require(_0x9aa3('0x4'));var fs=require('fs');var path=require(_0x9aa3('0x5'));var rimraf=require(_0x9aa3('0x6'));var config=require(_0x9aa3('0x7'));var attributes=require(_0x9aa3('0x8'));module[_0x9aa3('0x9')]=function(_0x28d4dd,_0x876e40){return _0x28d4dd[_0x9aa3('0xa')](_0x9aa3('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index b1f1099..dfb2906 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 _0x6f54=['request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','info','Migration,\x20%s,\x20%s'];(function(_0xec389d,_0x167bfb){var _0x206197=function(_0x5687e2){while(--_0x5687e2){_0xec389d['push'](_0xec389d['shift']());}};_0x206197(++_0x167bfb);}(_0x6f54,0xcf));var _0x46f5=function(_0x1c81be,_0x38517f){_0x1c81be=_0x1c81be-0x0;var _0x3be677=_0x6f54[_0x1c81be];return _0x3be677;};'use strict';var _=require(_0x46f5('0x0'));var util=require(_0x46f5('0x1'));var moment=require(_0x46f5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x46f5('0x3'));var db=require(_0x46f5('0x4'))['db'];var utils=require(_0x46f5('0x5'));var logger=require(_0x46f5('0x6'))('rpc');var config=require(_0x46f5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x46f5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x576e52,_0x30d52f,_0x2ef094){return new BPromise(function(_0x227a68,_0x3a2939){return client[_0x46f5('0x9')](_0x576e52,_0x2ef094)[_0x46f5('0xa')](function(_0x927efa){logger[_0x46f5('0xb')](_0x46f5('0xc'),_0x30d52f,_0x46f5('0xd'));logger[_0x46f5('0xe')](_0x46f5('0xf'),_0x30d52f,_0x46f5('0xd'),JSON[_0x46f5('0x10')](_0x927efa));if(_0x927efa['error']){if(_0x927efa[_0x46f5('0x11')][_0x46f5('0x12')]===0x1f4){logger[_0x46f5('0x11')]('Migration,\x20%s,\x20%s',_0x30d52f,_0x927efa[_0x46f5('0x11')][_0x46f5('0x13')]);return _0x3a2939(_0x927efa['error'][_0x46f5('0x13')]);}logger[_0x46f5('0x11')](_0x46f5('0xc'),_0x30d52f,_0x927efa[_0x46f5('0x11')]['message']);return _0x227a68(_0x927efa['error'][_0x46f5('0x13')]);}else{logger[_0x46f5('0xb')](_0x46f5('0xc'),_0x30d52f,_0x46f5('0xd'));_0x227a68(_0x927efa[_0x46f5('0x14')][_0x46f5('0x13')]);}})[_0x46f5('0x15')](function(_0x444756){logger[_0x46f5('0x11')](_0x46f5('0xc'),_0x30d52f,_0x444756);_0x3a2939(_0x444756);});});} \ No newline at end of file +var _0xf00e=['rpc','../../config/environment','jayson/promise','client','http','request','info','debug','request\x20sent','stringify','Migration,\x20%s,\x20%s','message','error','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae32d,_0x256489){var _0x550537=function(_0x534d63){while(--_0x534d63){_0x4ae32d['push'](_0x4ae32d['shift']());}};_0x550537(++_0x256489);}(_0xf00e,0x12f));var _0xef00=function(_0x3a72c1,_0x506799){_0x3a72c1=_0x3a72c1-0x0;var _0x5b3ed9=_0xf00e[_0x3a72c1];return _0x5b3ed9;};'use strict';var _=require(_0xef00('0x0'));var util=require(_0xef00('0x1'));var moment=require(_0xef00('0x2'));var BPromise=require(_0xef00('0x3'));var rs=require(_0xef00('0x4'));var fs=require('fs');var Redis=require(_0xef00('0x5'));var db=require(_0xef00('0x6'))['db'];var utils=require(_0xef00('0x7'));var logger=require(_0xef00('0x8'))(_0xef00('0x9'));var config=require(_0xef00('0xa'));var jayson=require(_0xef00('0xb'));var client=jayson[_0xef00('0xc')][_0xef00('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x254f2e,_0x17ec9e,_0x2245a3){return new BPromise(function(_0xdfd1bd,_0x543859){return client[_0xef00('0xe')](_0x254f2e,_0x2245a3)['then'](function(_0x50e9c9){logger[_0xef00('0xf')]('Migration,\x20%s,\x20%s',_0x17ec9e,'request\x20sent');logger[_0xef00('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x17ec9e,_0xef00('0x11'),JSON[_0xef00('0x12')](_0x50e9c9));if(_0x50e9c9['error']){if(_0x50e9c9['error']['code']===0x1f4){logger['error'](_0xef00('0x13'),_0x17ec9e,_0x50e9c9['error'][_0xef00('0x14')]);return _0x543859(_0x50e9c9['error'][_0xef00('0x14')]);}logger[_0xef00('0x15')](_0xef00('0x13'),_0x17ec9e,_0x50e9c9[_0xef00('0x15')][_0xef00('0x14')]);return _0xdfd1bd(_0x50e9c9['error'][_0xef00('0x14')]);}else{logger[_0xef00('0xf')]('Migration,\x20%s,\x20%s',_0x17ec9e,_0xef00('0x11'));_0xdfd1bd(_0x50e9c9[_0xef00('0x16')][_0xef00('0x14')]);}})[_0xef00('0x17')](function(_0x581008){logger[_0xef00('0x15')](_0xef00('0x13'),_0x17ec9e,_0x581008);_0x543859(_0x581008);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 0045cf3..f3dd327 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 _0xe2bc=['index','show','create','put','/:id','update','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated'];(function(_0x433b2f,_0x5b9b20){var _0x3cadb4=function(_0x38ed41){while(--_0x38ed41){_0x433b2f['push'](_0x433b2f['shift']());}};_0x3cadb4(++_0x5b9b20);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xe2bc[_0x368fb9];return _0x4892fb;};'use strict';var multer=require(_0xce2b('0x0'));var util=require('util');var path=require(_0xce2b('0x1'));var timeout=require('connect-timeout');var express=require(_0xce2b('0x2'));var router=express[_0xce2b('0x3')]();var fs_extra=require(_0xce2b('0x4'));var auth=require(_0xce2b('0x5'));var interaction=require(_0xce2b('0x6'));var config=require('../../config/environment');var controller=require(_0xce2b('0x7'));router[_0xce2b('0x8')]('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xa')]);router[_0xce2b('0x8')]('/:id',auth[_0xce2b('0x9')](),controller[_0xce2b('0xb')]);router['post']('/',auth[_0xce2b('0x9')](),controller[_0xce2b('0xc')]);router[_0xce2b('0xd')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0xf')]);router[_0xce2b('0x10')](_0xce2b('0xe'),auth[_0xce2b('0x9')](),controller[_0xce2b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7046=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./network.controller','get','isAuthenticated','index','/:id','post','put','update','delete','destroy'];(function(_0x5edfb4,_0x290fa8){var _0x3520f6=function(_0x263b6c){while(--_0x263b6c){_0x5edfb4['push'](_0x5edfb4['shift']());}};_0x3520f6(++_0x290fa8);}(_0x7046,0x144));var _0x6704=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7046[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6704('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6704('0xe')](_0x6704('0xc'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x10')](_0x6704('0xc'),auth[_0x6704('0xa')](),controller[_0x6704('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e85e84b..98bb550 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 _0x6e56=['externip','turn','STRING','sequelize','exports','localnet'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6e56,0xbd));var _0x66e5=function(_0x207061,_0xe38cda){_0x207061=_0x207061-0x0;var _0x4a2833=_0x6e56[_0x207061];return _0x4a2833;};'use strict';var Sequelize=require(_0x66e5('0x0'));module[_0x66e5('0x1')]={'type':{'type':Sequelize['ENUM'](_0x66e5('0x2'),_0x66e5('0x3'),'stun',_0x66e5('0x4'))},'value':{'type':Sequelize[_0x66e5('0x5')]},'username':{'type':Sequelize[_0x66e5('0x5')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x393c=['localnet','externip','turn','STRING'];(function(_0x417662,_0x48698c){var _0x287ce5=function(_0x1162df){while(--_0x1162df){_0x417662['push'](_0x417662['shift']());}};_0x287ce5(++_0x48698c);}(_0x393c,0x130));var _0xc393=function(_0x4f2a2a,_0x51d318){_0x4f2a2a=_0x4f2a2a-0x0;var _0x2c8ee4=_0x393c[_0x4f2a2a];return _0x2c8ee4;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0xc393('0x0'),_0xc393('0x1'),'stun',_0xc393('0x2'))},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc393('0x3')]},'password':{'type':Sequelize[_0xc393('0x3')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 7a0c88a..ab5b466 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 _0xbc9a=['options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','res_stun_monitor.so','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','destroy','server/files/templates/network.ejs','util','path','../../components/parsers/qs','../../config/logger','../../config/environment','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','json','undefined','count','offset','limit','set','Content-Range','update','status','sendStatus','name','send','index','map','Network','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x36053b,_0x4513b9){var _0x5b073c=function(_0x257116){while(--_0x257116){_0x36053b['push'](_0x36053b['shift']());}};_0x5b073c(++_0x4513b9);}(_0xbc9a,0x11d));var _0xabc9=function(_0x534c33,_0x120ebc){_0x534c33=_0x534c33-0x0;var _0x22b732=_0xbc9a[_0x534c33];return _0x22b732;};'use strict';var util=require(_0xabc9('0x0'));var path=require(_0xabc9('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var qs=require(_0xabc9('0x2'));var logger=require(_0xabc9('0x3'))('api');var config=require(_0xabc9('0x4'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xabc9('0x5')][_0xabc9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x36208e,_0x56bc36,_0x482bad,_0x8a6cb){return new Promise(function(_0x9bff75,_0x525a4b){var _0x5ebf79=_0x8a6cb||client;return _0x5ebf79[_0xabc9('0x7')](_0x36208e,_0x482bad)[_0xabc9('0x8')](function(_0x5bc0e8){logger[_0xabc9('0x9')](_0xabc9('0xa'),_0x56bc36,_0xabc9('0xb'));logger[_0xabc9('0xc')]('Network,\x20%s,\x20%s,\x20%s',_0x56bc36,_0xabc9('0xb'),JSON[_0xabc9('0xd')](_0x5bc0e8));if(_0x5bc0e8['error']){if(_0x5bc0e8[_0xabc9('0xe')][_0xabc9('0xf')]===0x1f4){logger[_0xabc9('0xe')](_0xabc9('0xa'),_0x56bc36,_0x5bc0e8[_0xabc9('0xe')][_0xabc9('0x10')]);return _0x525a4b(_0x5bc0e8[_0xabc9('0xe')][_0xabc9('0x10')]);}logger['error'](_0xabc9('0xa'),_0x56bc36,_0x5bc0e8[_0xabc9('0xe')][_0xabc9('0x10')]);return _0x9bff75(_0x5bc0e8[_0xabc9('0xe')][_0xabc9('0x10')]);}else{logger['info'](_0xabc9('0xa'),_0x56bc36,_0xabc9('0xb'));_0x9bff75(_0x5bc0e8[_0xabc9('0x11')][_0xabc9('0x10')]);}})['catch'](function(_0x3739dc){logger[_0xabc9('0xe')](_0xabc9('0xa'),_0x56bc36,_0x3739dc);_0x525a4b(_0x3739dc);});});}function respondWithResult(_0x224652,_0x297e5c){_0x297e5c=_0x297e5c||0xc8;return function(_0x16233e){if(_0x16233e){return _0x224652['status'](_0x297e5c)[_0xabc9('0x12')](_0x16233e);}};}function respondWithFilteredResult(_0x2a72e7,_0x163475){return function(_0x17de26){if(_0x17de26){var _0x3bffd6=typeof _0x163475['offset']===_0xabc9('0x13')&&typeof _0x163475['limit']===_0xabc9('0x13');var _0x38da25=_0x17de26[_0xabc9('0x14')];var _0x3e3a15=_0x3bffd6?0x0:_0x163475[_0xabc9('0x15')];var _0x52b8f8=_0x3bffd6?_0x17de26[_0xabc9('0x14')]:_0x163475[_0xabc9('0x15')]+_0x163475[_0xabc9('0x16')];var _0x45b560;if(_0x52b8f8>=_0x38da25){_0x52b8f8=_0x38da25;_0x45b560=0xc8;}else{_0x45b560=0xce;}_0x2a72e7['status'](_0x45b560);return _0x2a72e7[_0xabc9('0x17')](_0xabc9('0x18'),_0x3e3a15+'-'+_0x52b8f8+'/'+_0x38da25)[_0xabc9('0x12')](_0x17de26);}return null;};}function saveUpdates(_0x2e2225){return function(_0x419039){if(_0x419039){return _0x419039[_0xabc9('0x19')](_0x2e2225)[_0xabc9('0x8')](function(_0x17d38d){return _0x17d38d;});}return null;};}function removeEntity(_0x1182fa){return function(_0x432370){if(_0x432370){return _0x432370['destroy']()[_0xabc9('0x8')](function(){_0x1182fa[_0xabc9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba268){return function(_0x22a81c){if(!_0x22a81c){_0x4ba268[_0xabc9('0x1b')](0x194);}return _0x22a81c;};}function handleError(_0x43c52d,_0x5f5448){_0x5f5448=_0x5f5448||0x1f4;return function(_0xef0cf5){logger[_0xabc9('0xe')](_0xef0cf5['stack']);if(_0xef0cf5[_0xabc9('0x1c')]){delete _0xef0cf5[_0xabc9('0x1c')];}_0x43c52d[_0xabc9('0x1a')](_0x5f5448)[_0xabc9('0x1d')](_0xef0cf5);};}exports[_0xabc9('0x1e')]=function(_0x531df5,_0x3cfc4a){var _0x5a7d3e={},_0x3c3358={},_0x44cb09={'count':0x0,'rows':[]};var _0x2a61c9=_[_0xabc9('0x1f')](db[_0xabc9('0x20')]['rawAttributes'],function(_0x3ce8d6){return{'name':_0x3ce8d6[_0xabc9('0x21')],'type':_0x3ce8d6[_0xabc9('0x22')][_0xabc9('0x23')]};});_0x3c3358['model']=_[_0xabc9('0x1f')](_0x2a61c9,_0xabc9('0x1c'));_0x3c3358[_0xabc9('0x24')]=_[_0xabc9('0x25')](_0x531df5[_0xabc9('0x24')]);_0x3c3358[_0xabc9('0x26')]=_['intersection'](_0x3c3358[_0xabc9('0x27')],_0x3c3358[_0xabc9('0x24')]);_0x5a7d3e[_0xabc9('0x28')]=_[_0xabc9('0x29')](_0x3c3358[_0xabc9('0x27')],qs[_0xabc9('0x2a')](_0x531df5[_0xabc9('0x24')]['fields']));_0x5a7d3e[_0xabc9('0x28')]=_0x5a7d3e[_0xabc9('0x28')]['length']?_0x5a7d3e[_0xabc9('0x28')]:_0x3c3358['model'];if(!_0x531df5[_0xabc9('0x24')]['hasOwnProperty'](_0xabc9('0x2b'))){_0x5a7d3e[_0xabc9('0x16')]=qs[_0xabc9('0x16')](_0x531df5[_0xabc9('0x24')][_0xabc9('0x16')]);_0x5a7d3e[_0xabc9('0x15')]=qs['offset'](_0x531df5['query'][_0xabc9('0x15')]);}_0x5a7d3e[_0xabc9('0x2c')]=qs[_0xabc9('0x2d')](_0x531df5['query'][_0xabc9('0x2d')]);_0x5a7d3e[_0xabc9('0x2e')]=qs[_0xabc9('0x26')](_[_0xabc9('0x2f')](_0x531df5[_0xabc9('0x24')],_0x3c3358[_0xabc9('0x26')]),_0x2a61c9);if(_0x531df5[_0xabc9('0x24')][_0xabc9('0x30')]){_0x5a7d3e[_0xabc9('0x2e')]=_[_0xabc9('0x31')](_0x5a7d3e[_0xabc9('0x2e')],{'$or':_[_0xabc9('0x1f')](_0x2a61c9,function(_0x2bda94){if(_0x2bda94['type']!==_0xabc9('0x32')){var _0x574b88={};_0x574b88[_0x2bda94[_0xabc9('0x1c')]]={'$like':'%'+_0x531df5['query']['filter']+'%'};return _0x574b88;}})});}_0x5a7d3e=_[_0xabc9('0x31')]({},_0x5a7d3e,_0x531df5[_0xabc9('0x33')]);var _0xffc1bb={'where':_0x5a7d3e[_0xabc9('0x2e')]};return db[_0xabc9('0x20')][_0xabc9('0x14')](_0xffc1bb)[_0xabc9('0x8')](function(_0x36c0ba){_0x44cb09[_0xabc9('0x14')]=_0x36c0ba;if(_0x531df5[_0xabc9('0x24')][_0xabc9('0x34')]){_0x5a7d3e[_0xabc9('0x35')]=[{'all':!![]}];}return db[_0xabc9('0x20')][_0xabc9('0x36')](_0x5a7d3e);})['then'](function(_0x279abe){_0x44cb09[_0xabc9('0x37')]=_0x279abe;return _0x44cb09;})[_0xabc9('0x8')](respondWithFilteredResult(_0x3cfc4a,_0x5a7d3e))[_0xabc9('0x38')](handleError(_0x3cfc4a,null));};exports[_0xabc9('0x39')]=function(_0x2ad664,_0x2e0a8d){var _0x438510={'raw':!![],'where':{'id':_0x2ad664[_0xabc9('0x3a')]['id']}},_0xa33a29={};_0xa33a29[_0xabc9('0x27')]=_[_0xabc9('0x25')](db[_0xabc9('0x20')]['rawAttributes']);_0xa33a29['query']=_[_0xabc9('0x25')](_0x2ad664[_0xabc9('0x24')]);_0xa33a29[_0xabc9('0x26')]=_[_0xabc9('0x29')](_0xa33a29[_0xabc9('0x27')],_0xa33a29['query']);_0x438510[_0xabc9('0x28')]=_['intersection'](_0xa33a29['model'],qs[_0xabc9('0x2a')](_0x2ad664[_0xabc9('0x24')][_0xabc9('0x2a')]));_0x438510[_0xabc9('0x28')]=_0x438510[_0xabc9('0x28')][_0xabc9('0x3b')]?_0x438510['attributes']:_0xa33a29[_0xabc9('0x27')];if(_0x2ad664[_0xabc9('0x24')]['includeAll']){_0x438510[_0xabc9('0x35')]=[{'all':!![]}];}_0x438510=_[_0xabc9('0x31')]({},_0x438510,_0x2ad664['options']);return db[_0xabc9('0x20')][_0xabc9('0x3c')](_0x438510)[_0xabc9('0x8')](handleEntityNotFound(_0x2e0a8d,null))[_0xabc9('0x8')](respondWithResult(_0x2e0a8d,null))[_0xabc9('0x38')](handleError(_0x2e0a8d,null));};exports[_0xabc9('0x3d')]=function(_0x4761b9,_0x3c8618){var _0x376834;return db[_0xabc9('0x20')][_0xabc9('0x3d')](_0x4761b9[_0xabc9('0x3e')],{'raw':!![]})[_0xabc9('0x8')](function(_0x2f8711){_0x376834=_0x2f8711;return db[_0xabc9('0x20')]['findAll']({'where':{'type':_0x4761b9[_0xabc9('0x3e')]['type']},'raw':!![]});})[_0xabc9('0x8')](function(_0x33cdaa){if(_0x376834[_0xabc9('0x22')][_0xabc9('0x3f')]()==_0xabc9('0x40')){var _0x565044=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config[_0xabc9('0x43')],_0xabc9('0x44')),_0xabc9('0x45'));var _0xdffb15=ejs[_0xabc9('0x46')](_0x565044,{'networks':_0x33cdaa||[]});fs[_0xabc9('0x47')](_0xabc9('0x48'),_0xdffb15);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x3d'),{'module':'res_stun_monitor.so'});}else if(_0x376834[_0xabc9('0x22')]['toUpperCase']()==_0xabc9('0x4a')){var _0x4dd750=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config[_0xabc9('0x43')],_0xabc9('0x4b')),_0xabc9('0x45'));var _0x3f1cbc=ejs[_0xabc9('0x46')](_0x4dd750,{'networks':_0x33cdaa||[]});fs[_0xabc9('0x47')](_0xabc9('0x4c'),_0x3f1cbc);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x3d'),{'module':_0xabc9('0x4d')});}else{var _0x3f2d24=fs['readFileSync'](path[_0xabc9('0x42')](config['root'],'server/files/templates/network.ejs'),_0xabc9('0x45'));var _0x50b5c7=ejs[_0xabc9('0x46')](_0x3f2d24,{'networks':_0x33cdaa||[]});fs[_0xabc9('0x47')](util[_0xabc9('0x4e')](_0xabc9('0x4f'),_0x4761b9[_0xabc9('0x3e')][_0xabc9('0x22')][_0xabc9('0x50')]()),_0x50b5c7);return respondWithRpcPromise('Reload','create',{'module':_0xabc9('0x51')});}})[_0xabc9('0x8')](function(){return _0x376834;})['then'](respondWithResult(_0x3c8618,0xc9))[_0xabc9('0x38')](handleError(_0x3c8618,null));};exports[_0xabc9('0x19')]=function(_0x3a9c4d,_0x318338){var _0x2fa6ce;return db[_0xabc9('0x20')][_0xabc9('0x3c')]({'where':{'id':_0x3a9c4d[_0xabc9('0x3a')]['id']}})[_0xabc9('0x8')](handleEntityNotFound(_0x318338,null))['then'](saveUpdates(_0x3a9c4d['body'],null))[_0xabc9('0x8')](function(_0x288662){if(_0x288662){_0x2fa6ce=_0x288662;return db[_0xabc9('0x20')][_0xabc9('0x36')]({'where':{'type':_0x2fa6ce[_0xabc9('0x22')]},'raw':!![]});}return null;})[_0xabc9('0x8')](function(_0x2f3c0c){if(_0x2fa6ce['type'][_0xabc9('0x3f')]()==_0xabc9('0x40')){var _0x45dff5=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config[_0xabc9('0x43')],_0xabc9('0x44')),_0xabc9('0x45'));var _0x7c1b23=ejs[_0xabc9('0x46')](_0x45dff5,{'networks':_0x2f3c0c||[]});fs[_0xabc9('0x47')](_0xabc9('0x48'),_0x7c1b23);return respondWithRpcPromise(_0xabc9('0x49'),'update',{'module':'res_stun_monitor.so'});}else if(_0x2fa6ce[_0xabc9('0x22')][_0xabc9('0x3f')]()==_0xabc9('0x4a')){var _0x45b10e=fs['readFileSync'](path[_0xabc9('0x42')](config['root'],_0xabc9('0x4b')),_0xabc9('0x45'));var _0x33e18c=ejs[_0xabc9('0x46')](_0x45b10e,{'networks':_0x2f3c0c||[]});fs[_0xabc9('0x47')]('/etc/asterisk/turn_xcally.conf',_0x33e18c);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x19'),{'module':'res_stun_monitor.so'});}else{var _0x18959b=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config['root'],'server/files/templates/network.ejs'),_0xabc9('0x45'));var _0x8f5071=ejs[_0xabc9('0x46')](_0x18959b,{'networks':_0x2f3c0c||[]});fs['writeFileSync'](util[_0xabc9('0x4e')](_0xabc9('0x4f'),_0x3a9c4d[_0xabc9('0x3e')][_0xabc9('0x22')]['toLowerCase']()),_0x8f5071);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x19'),{'module':_0xabc9('0x51')});}})[_0xabc9('0x8')](function(_0x31372){if(_0x31372){return _0x2fa6ce;}return null;})[_0xabc9('0x8')](respondWithResult(_0x318338,null))['catch'](handleError(_0x318338,null));};exports[_0xabc9('0x52')]=function(_0x5b7039,_0x379e9a){var _0x5198ff;return db[_0xabc9('0x20')]['find']({'where':{'id':_0x5b7039['params']['id']}})[_0xabc9('0x8')](function(_0x242c2a){_0x5198ff=_0x242c2a;return _0x242c2a;})[_0xabc9('0x8')](handleEntityNotFound(_0x379e9a,null))['then'](removeEntity(_0x379e9a,null))[_0xabc9('0x8')](function(){if(_0x5198ff){return db[_0xabc9('0x20')]['findAll']({'where':{'type':_0x5198ff['type']},'raw':!![]});}})[_0xabc9('0x8')](function(_0x5f3e60){if(_0x5198ff[_0xabc9('0x22')][_0xabc9('0x3f')]()==_0xabc9('0x40')){var _0x1971d8=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config['root'],_0xabc9('0x44')),_0xabc9('0x45'));var _0x58fd38=ejs['render'](_0x1971d8,{'networks':_0x5f3e60||[]});fs[_0xabc9('0x47')](_0xabc9('0x48'),_0x58fd38);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x52'),{'module':_0xabc9('0x4d')});}else if(_0x5198ff[_0xabc9('0x22')][_0xabc9('0x3f')]()==_0xabc9('0x4a')){var _0x6d8ef2=fs['readFileSync'](path[_0xabc9('0x42')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xabc9('0x45'));var _0x547574=ejs[_0xabc9('0x46')](_0x6d8ef2,{'networks':_0x5f3e60||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x547574);return respondWithRpcPromise(_0xabc9('0x49'),_0xabc9('0x52'),{'module':_0xabc9('0x4d')});}else{var _0x4ede5a=fs[_0xabc9('0x41')](path[_0xabc9('0x42')](config[_0xabc9('0x43')],_0xabc9('0x53')),_0xabc9('0x45'));var _0x5e746e=ejs[_0xabc9('0x46')](_0x4ede5a,{'networks':_0x5f3e60||[]});fs[_0xabc9('0x47')](util[_0xabc9('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x5198ff['type'][_0xabc9('0x50')]()),_0x5e746e);return respondWithRpcPromise(_0xabc9('0x49'),'destroy',{'module':_0xabc9('0x51')});}})['catch'](handleError(_0x379e9a,null));}; \ No newline at end of file +var _0xa649=['filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','server/files/templates/stun_multiple.ejs','TURN','/etc/asterisk/turn_xcally.conf','chan_sip.so','destroy','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','client','request','then','info','request\x20sent','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','Network,\x20%s,\x20%s','message','result','catch','status','offset','limit','undefined','count','set','Content-Range','update','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0xa649,0x125));var _0x9a64=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xa649[_0x19950b];return _0x3c6b41;};'use strict';var util=require('util');var path=require(_0x9a64('0x0'));var ejs=require(_0x9a64('0x1'));var fs=require('fs');var _=require(_0x9a64('0x2'));var qs=require(_0x9a64('0x3'));var logger=require(_0x9a64('0x4'))(_0x9a64('0x5'));var config=require(_0x9a64('0x6'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x9a64('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23e647,_0x4319c1,_0x44b0dc,_0x557ba1){return new Promise(function(_0x4b583f,_0x4f37b5){var _0x5162f9=_0x557ba1||client;return _0x5162f9[_0x9a64('0x8')](_0x23e647,_0x44b0dc)[_0x9a64('0x9')](function(_0x14a54b){logger[_0x9a64('0xa')]('Network,\x20%s,\x20%s',_0x4319c1,_0x9a64('0xb'));logger['debug'](_0x9a64('0xc'),_0x4319c1,_0x9a64('0xb'),JSON[_0x9a64('0xd')](_0x14a54b));if(_0x14a54b[_0x9a64('0xe')]){if(_0x14a54b[_0x9a64('0xe')][_0x9a64('0xf')]===0x1f4){logger[_0x9a64('0xe')](_0x9a64('0x10'),_0x4319c1,_0x14a54b['error']['message']);return _0x4f37b5(_0x14a54b['error'][_0x9a64('0x11')]);}logger[_0x9a64('0xe')]('Network,\x20%s,\x20%s',_0x4319c1,_0x14a54b[_0x9a64('0xe')][_0x9a64('0x11')]);return _0x4b583f(_0x14a54b[_0x9a64('0xe')]['message']);}else{logger[_0x9a64('0xa')](_0x9a64('0x10'),_0x4319c1,_0x9a64('0xb'));_0x4b583f(_0x14a54b[_0x9a64('0x12')]['message']);}})[_0x9a64('0x13')](function(_0x3ebb0c){logger[_0x9a64('0xe')](_0x9a64('0x10'),_0x4319c1,_0x3ebb0c);_0x4f37b5(_0x3ebb0c);});});}function respondWithResult(_0x77595c,_0x3b52f1){_0x3b52f1=_0x3b52f1||0xc8;return function(_0x160f35){if(_0x160f35){return _0x77595c[_0x9a64('0x14')](_0x3b52f1)['json'](_0x160f35);}};}function respondWithFilteredResult(_0x3dfbb4,_0x1573cc){return function(_0x4bc16d){if(_0x4bc16d){var _0x1ebdc8=typeof _0x1573cc[_0x9a64('0x15')]==='undefined'&&typeof _0x1573cc[_0x9a64('0x16')]===_0x9a64('0x17');var _0x16cb38=_0x4bc16d[_0x9a64('0x18')];var _0x488402=_0x1ebdc8?0x0:_0x1573cc['offset'];var _0x4c0a10=_0x1ebdc8?_0x4bc16d[_0x9a64('0x18')]:_0x1573cc[_0x9a64('0x15')]+_0x1573cc['limit'];var _0x2b4ae3;if(_0x4c0a10>=_0x16cb38){_0x4c0a10=_0x16cb38;_0x2b4ae3=0xc8;}else{_0x2b4ae3=0xce;}_0x3dfbb4[_0x9a64('0x14')](_0x2b4ae3);return _0x3dfbb4[_0x9a64('0x19')](_0x9a64('0x1a'),_0x488402+'-'+_0x4c0a10+'/'+_0x16cb38)['json'](_0x4bc16d);}return null;};}function saveUpdates(_0x123ac5){return function(_0x312d77){if(_0x312d77){return _0x312d77[_0x9a64('0x1b')](_0x123ac5)[_0x9a64('0x9')](function(_0xdd60a0){return _0xdd60a0;});}return null;};}function removeEntity(_0x566494){return function(_0x5b3fc0){if(_0x5b3fc0){return _0x5b3fc0['destroy']()['then'](function(){_0x566494[_0x9a64('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7d64){return function(_0x5b8b39){if(!_0x5b8b39){_0x1c7d64[_0x9a64('0x1c')](0x194);}return _0x5b8b39;};}function handleError(_0x108935,_0x33d2a6){_0x33d2a6=_0x33d2a6||0x1f4;return function(_0x25fdae){logger[_0x9a64('0xe')](_0x25fdae[_0x9a64('0x1d')]);if(_0x25fdae[_0x9a64('0x1e')]){delete _0x25fdae[_0x9a64('0x1e')];}_0x108935[_0x9a64('0x14')](_0x33d2a6)[_0x9a64('0x1f')](_0x25fdae);};}exports[_0x9a64('0x20')]=function(_0x795f48,_0x13d9c5){var _0x2af1d1={},_0x251819={},_0x58e7cb={'count':0x0,'rows':[]};var _0x240a92=_[_0x9a64('0x21')](db[_0x9a64('0x22')][_0x9a64('0x23')],function(_0x194e08){return{'name':_0x194e08[_0x9a64('0x24')],'type':_0x194e08[_0x9a64('0x25')][_0x9a64('0x26')]};});_0x251819['model']=_[_0x9a64('0x21')](_0x240a92,_0x9a64('0x1e'));_0x251819[_0x9a64('0x27')]=_['keys'](_0x795f48[_0x9a64('0x27')]);_0x251819[_0x9a64('0x28')]=_[_0x9a64('0x29')](_0x251819['model'],_0x251819[_0x9a64('0x27')]);_0x2af1d1['attributes']=_['intersection'](_0x251819[_0x9a64('0x2a')],qs[_0x9a64('0x2b')](_0x795f48[_0x9a64('0x27')][_0x9a64('0x2b')]));_0x2af1d1[_0x9a64('0x2c')]=_0x2af1d1['attributes'][_0x9a64('0x2d')]?_0x2af1d1[_0x9a64('0x2c')]:_0x251819['model'];if(!_0x795f48[_0x9a64('0x27')][_0x9a64('0x2e')](_0x9a64('0x2f'))){_0x2af1d1['limit']=qs['limit'](_0x795f48[_0x9a64('0x27')][_0x9a64('0x16')]);_0x2af1d1['offset']=qs[_0x9a64('0x15')](_0x795f48[_0x9a64('0x27')]['offset']);}_0x2af1d1[_0x9a64('0x30')]=qs[_0x9a64('0x31')](_0x795f48['query'][_0x9a64('0x31')]);_0x2af1d1[_0x9a64('0x32')]=qs[_0x9a64('0x28')](_['pick'](_0x795f48['query'],_0x251819[_0x9a64('0x28')]),_0x240a92);if(_0x795f48[_0x9a64('0x27')][_0x9a64('0x33')]){_0x2af1d1[_0x9a64('0x32')]=_['merge'](_0x2af1d1[_0x9a64('0x32')],{'$or':_[_0x9a64('0x21')](_0x240a92,function(_0x4d8e6b){if(_0x4d8e6b['type']!==_0x9a64('0x34')){var _0x189d40={};_0x189d40[_0x4d8e6b[_0x9a64('0x1e')]]={'$like':'%'+_0x795f48['query'][_0x9a64('0x33')]+'%'};return _0x189d40;}})});}_0x2af1d1=_[_0x9a64('0x35')]({},_0x2af1d1,_0x795f48[_0x9a64('0x36')]);var _0x440b36={'where':_0x2af1d1[_0x9a64('0x32')]};return db[_0x9a64('0x22')][_0x9a64('0x18')](_0x440b36)[_0x9a64('0x9')](function(_0x175d35){_0x58e7cb[_0x9a64('0x18')]=_0x175d35;if(_0x795f48[_0x9a64('0x27')][_0x9a64('0x37')]){_0x2af1d1[_0x9a64('0x38')]=[{'all':!![]}];}return db[_0x9a64('0x22')][_0x9a64('0x39')](_0x2af1d1);})[_0x9a64('0x9')](function(_0x219d30){_0x58e7cb[_0x9a64('0x3a')]=_0x219d30;return _0x58e7cb;})[_0x9a64('0x9')](respondWithFilteredResult(_0x13d9c5,_0x2af1d1))[_0x9a64('0x13')](handleError(_0x13d9c5,null));};exports[_0x9a64('0x3b')]=function(_0xefe203,_0x29687c){var _0xa36cfe={'raw':!![],'where':{'id':_0xefe203[_0x9a64('0x3c')]['id']}},_0x416239={};_0x416239[_0x9a64('0x2a')]=_['keys'](db[_0x9a64('0x22')][_0x9a64('0x23')]);_0x416239['query']=_[_0x9a64('0x3d')](_0xefe203[_0x9a64('0x27')]);_0x416239['filters']=_[_0x9a64('0x29')](_0x416239['model'],_0x416239[_0x9a64('0x27')]);_0xa36cfe[_0x9a64('0x2c')]=_[_0x9a64('0x29')](_0x416239['model'],qs[_0x9a64('0x2b')](_0xefe203['query'][_0x9a64('0x2b')]));_0xa36cfe[_0x9a64('0x2c')]=_0xa36cfe[_0x9a64('0x2c')][_0x9a64('0x2d')]?_0xa36cfe[_0x9a64('0x2c')]:_0x416239[_0x9a64('0x2a')];if(_0xefe203[_0x9a64('0x27')]['includeAll']){_0xa36cfe[_0x9a64('0x38')]=[{'all':!![]}];}_0xa36cfe=_[_0x9a64('0x35')]({},_0xa36cfe,_0xefe203['options']);return db[_0x9a64('0x22')][_0x9a64('0x3e')](_0xa36cfe)[_0x9a64('0x9')](handleEntityNotFound(_0x29687c,null))[_0x9a64('0x9')](respondWithResult(_0x29687c,null))[_0x9a64('0x13')](handleError(_0x29687c,null));};exports[_0x9a64('0x3f')]=function(_0x5e78d2,_0x60ab55){var _0x543db8;return db[_0x9a64('0x22')]['create'](_0x5e78d2[_0x9a64('0x40')],{'raw':!![]})[_0x9a64('0x9')](function(_0x453c43){_0x543db8=_0x453c43;return db[_0x9a64('0x22')][_0x9a64('0x39')]({'where':{'type':_0x5e78d2['body'][_0x9a64('0x25')]},'raw':!![]});})[_0x9a64('0x9')](function(_0x1f19cf){if(_0x543db8[_0x9a64('0x25')][_0x9a64('0x41')]()==_0x9a64('0x42')){var _0x99539b=fs[_0x9a64('0x43')](path[_0x9a64('0x44')](config[_0x9a64('0x45')],'server/files/templates/stun_multiple.ejs'),_0x9a64('0x46'));var _0xf7306b=ejs[_0x9a64('0x47')](_0x99539b,{'networks':_0x1f19cf||[]});fs[_0x9a64('0x48')](_0x9a64('0x49'),_0xf7306b);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x3f'),{'module':_0x9a64('0x4b')});}else if(_0x543db8[_0x9a64('0x25')][_0x9a64('0x41')]()=='TURN'){var _0x1af1b6=fs['readFileSync'](path[_0x9a64('0x44')](config['root'],_0x9a64('0x4c')),_0x9a64('0x46'));var _0x4c7093=ejs['render'](_0x1af1b6,{'networks':_0x1f19cf||[]});fs[_0x9a64('0x48')]('/etc/asterisk/turn_xcally.conf',_0x4c7093);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x3f'),{'module':'res_stun_monitor.so'});}else{var _0x55bd90=fs[_0x9a64('0x43')](path[_0x9a64('0x44')](config['root'],_0x9a64('0x4d')),'utf8');var _0x257f3b=ejs[_0x9a64('0x47')](_0x55bd90,{'networks':_0x1f19cf||[]});fs['writeFileSync'](util[_0x9a64('0x4e')](_0x9a64('0x4f'),_0x5e78d2['body'][_0x9a64('0x25')][_0x9a64('0x50')]()),_0x257f3b);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x543db8;})[_0x9a64('0x9')](respondWithResult(_0x60ab55,0xc9))[_0x9a64('0x13')](handleError(_0x60ab55,null));};exports['update']=function(_0x559455,_0x3e12cb){var _0x37405f;return db[_0x9a64('0x22')][_0x9a64('0x3e')]({'where':{'id':_0x559455[_0x9a64('0x3c')]['id']}})[_0x9a64('0x9')](handleEntityNotFound(_0x3e12cb,null))[_0x9a64('0x9')](saveUpdates(_0x559455[_0x9a64('0x40')],null))[_0x9a64('0x9')](function(_0x303afa){if(_0x303afa){_0x37405f=_0x303afa;return db[_0x9a64('0x22')]['findAll']({'where':{'type':_0x37405f[_0x9a64('0x25')]},'raw':!![]});}return null;})[_0x9a64('0x9')](function(_0x32a117){if(_0x37405f[_0x9a64('0x25')]['toUpperCase']()==_0x9a64('0x42')){var _0x400666=fs[_0x9a64('0x43')](path['join'](config[_0x9a64('0x45')],_0x9a64('0x51')),_0x9a64('0x46'));var _0x17e9e4=ejs[_0x9a64('0x47')](_0x400666,{'networks':_0x32a117||[]});fs['writeFileSync'](_0x9a64('0x49'),_0x17e9e4);return respondWithRpcPromise(_0x9a64('0x4a'),'update',{'module':_0x9a64('0x4b')});}else if(_0x37405f[_0x9a64('0x25')]['toUpperCase']()==_0x9a64('0x52')){var _0x2e4638=fs[_0x9a64('0x43')](path['join'](config[_0x9a64('0x45')],_0x9a64('0x4c')),_0x9a64('0x46'));var _0x18245b=ejs[_0x9a64('0x47')](_0x2e4638,{'networks':_0x32a117||[]});fs[_0x9a64('0x48')](_0x9a64('0x53'),_0x18245b);return respondWithRpcPromise('Reload',_0x9a64('0x1b'),{'module':_0x9a64('0x4b')});}else{var _0x11567f=fs[_0x9a64('0x43')](path[_0x9a64('0x44')](config['root'],'server/files/templates/network.ejs'),_0x9a64('0x46'));var _0x9a6dfe=ejs['render'](_0x11567f,{'networks':_0x32a117||[]});fs[_0x9a64('0x48')](util[_0x9a64('0x4e')](_0x9a64('0x4f'),_0x559455[_0x9a64('0x40')]['type'][_0x9a64('0x50')]()),_0x9a6dfe);return respondWithRpcPromise('Reload',_0x9a64('0x1b'),{'module':_0x9a64('0x54')});}})[_0x9a64('0x9')](function(_0x28cb06){if(_0x28cb06){return _0x37405f;}return null;})[_0x9a64('0x9')](respondWithResult(_0x3e12cb,null))[_0x9a64('0x13')](handleError(_0x3e12cb,null));};exports[_0x9a64('0x55')]=function(_0x37deaf,_0xba3856){var _0x52a539;return db['Network'][_0x9a64('0x3e')]({'where':{'id':_0x37deaf[_0x9a64('0x3c')]['id']}})['then'](function(_0x1866f2){_0x52a539=_0x1866f2;return _0x1866f2;})['then'](handleEntityNotFound(_0xba3856,null))[_0x9a64('0x9')](removeEntity(_0xba3856,null))['then'](function(){if(_0x52a539){return db[_0x9a64('0x22')][_0x9a64('0x39')]({'where':{'type':_0x52a539[_0x9a64('0x25')]},'raw':!![]});}})['then'](function(_0x250851){if(_0x52a539['type'][_0x9a64('0x41')]()==_0x9a64('0x42')){var _0x5da542=fs['readFileSync'](path[_0x9a64('0x44')](config[_0x9a64('0x45')],_0x9a64('0x51')),'utf8');var _0x13fd3d=ejs[_0x9a64('0x47')](_0x5da542,{'networks':_0x250851||[]});fs[_0x9a64('0x48')]('/etc/asterisk/stun_xcally.conf',_0x13fd3d);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x55'),{'module':_0x9a64('0x4b')});}else if(_0x52a539['type']['toUpperCase']()==_0x9a64('0x52')){var _0x11a642=fs[_0x9a64('0x43')](path[_0x9a64('0x44')](config[_0x9a64('0x45')],_0x9a64('0x4c')),_0x9a64('0x46'));var _0x11fbba=ejs['render'](_0x11a642,{'networks':_0x250851||[]});fs[_0x9a64('0x48')](_0x9a64('0x53'),_0x11fbba);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x55'),{'module':_0x9a64('0x4b')});}else{var _0x4a5d77=fs[_0x9a64('0x43')](path[_0x9a64('0x44')](config[_0x9a64('0x45')],'server/files/templates/network.ejs'),_0x9a64('0x46'));var _0x5769b4=ejs[_0x9a64('0x47')](_0x4a5d77,{'networks':_0x250851||[]});fs[_0x9a64('0x48')](util[_0x9a64('0x4e')](_0x9a64('0x4f'),_0x52a539['type'][_0x9a64('0x50')]()),_0x5769b4);return respondWithRpcPromise(_0x9a64('0x4a'),_0x9a64('0x55'),{'module':'chan_sip.so'});}})[_0x9a64('0x13')](handleError(_0xba3856,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f2adcd6..4af6afb 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 _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','../../config/logger'];(function(_0x22889a,_0x4b75f7){var _0x763d34=function(_0x2040e5){while(--_0x2040e5){_0x22889a['push'](_0x22889a['shift']());}};_0x763d34(++_0x4b75f7);}(_0x0427,0x137));var _0x7042=function(_0x5551b0,_0x492305){_0x5551b0=_0x5551b0-0x0;var _0x3c0d86=_0x0427[_0x5551b0];return _0x3c0d86;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd691=['exports','network','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes'];(function(_0x5a20ee,_0x1172e4){var _0x407879=function(_0x2ab3b3){while(--_0x2ab3b3){_0x5a20ee['push'](_0x5a20ee['shift']());}};_0x407879(++_0x1172e4);}(_0xd691,0xe6));var _0x1d69=function(_0x5ca7b8,_0x1d8f03){_0x5ca7b8=_0x5ca7b8-0x0;var _0x58e84e=_0xd691[_0x5ca7b8];return _0x58e84e;};'use strict';var _=require(_0x1d69('0x0'));var util=require(_0x1d69('0x1'));var logger=require(_0x1d69('0x2'))('api');var moment=require(_0x1d69('0x3'));var BPromise=require(_0x1d69('0x4'));var rp=require(_0x1d69('0x5'));var fs=require('fs');var path=require(_0x1d69('0x6'));var rimraf=require(_0x1d69('0x7'));var config=require(_0x1d69('0x8'));var attributes=require(_0x1d69('0x9'));module[_0x1d69('0xa')]=function(_0xdbf1f2,_0x3b36f5){return _0xdbf1f2['define']('Network',attributes,{'tableName':_0x1d69('0xb'),'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 8df0246..286b551 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x21ddad,_0x2ec4a7){_0x21ddad=_0x21ddad-0x0;var _0x4ce14d=_0x7a54[_0x21ddad];return _0x4ce14d;};'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(_0x196547,_0x5c5b1d){var _0x437fe6=function(_0x5e69ed){while(--_0x5e69ed){_0x196547['push'](_0x196547['shift']());}};_0x437fe6(++_0x5c5b1d);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('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 022f4d6..3afe7b1 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 _0x4ecc=['getApplications','/:id/interactions','/:id/users','getAgents','create','post','/:id/dispositions','addDisposition','addAnswer','/:id/notify','addApplications','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications'];(function(_0x32f9ca,_0x2fa8bc){var _0x52e083=function(_0x4fd86a){while(--_0x4fd86a){_0x32f9ca['push'](_0x32f9ca['shift']());}};_0x52e083(++_0x2fa8bc);}(_0x4ecc,0x85));var _0xc4ec=function(_0x22d33b,_0x15491a){_0x22d33b=_0x22d33b-0x0;var _0x80b3ab=_0x4ecc[_0x22d33b];return _0x80b3ab;};'use strict';var multer=require(_0xc4ec('0x0'));var util=require(_0xc4ec('0x1'));var path=require('path');var timeout=require(_0xc4ec('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc4ec('0x3'));var auth=require(_0xc4ec('0x4'));var interaction=require(_0xc4ec('0x5'));var config=require(_0xc4ec('0x6'));var controller=require(_0xc4ec('0x7'));router[_0xc4ec('0x8')]('/',auth[_0xc4ec('0x9')](),controller[_0xc4ec('0xa')]);router[_0xc4ec('0x8')](_0xc4ec('0xb'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0xc')]);router['get'](_0xc4ec('0xd'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0xe')]);router[_0xc4ec('0x8')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc4ec('0xf')]);router[_0xc4ec('0x8')](_0xc4ec('0x10'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x11')]);router[_0xc4ec('0x8')](_0xc4ec('0x12'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x13')]);router[_0xc4ec('0x8')](_0xc4ec('0x14'),auth[_0xc4ec('0x9')](),controller['getInteractions']);router['get'](_0xc4ec('0x15'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x16')]);router['post']('/',auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x17')]);router[_0xc4ec('0x18')](_0xc4ec('0x19'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x1a')]);router['post']('/:id/canned_answers',auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x1b')]);router[_0xc4ec('0x18')](_0xc4ec('0x1c'),controller['notify']);router[_0xc4ec('0x18')](_0xc4ec('0x12'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x1d')]);router[_0xc4ec('0x18')](_0xc4ec('0x15'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x1e')]);router[_0xc4ec('0x18')]('/:id/send',auth[_0xc4ec('0x9')](),controller['send']);router['put'](_0xc4ec('0xd'),auth['isAuthenticated'](),controller[_0xc4ec('0x1f')]);router[_0xc4ec('0x20')](_0xc4ec('0xd'),auth['isAuthenticated'](),controller[_0xc4ec('0x21')]);router['delete'](_0xc4ec('0x19'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x22')]);router[_0xc4ec('0x20')](_0xc4ec('0x10'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x23')]);router[_0xc4ec('0x20')](_0xc4ec('0x15'),auth[_0xc4ec('0x9')](),controller[_0xc4ec('0x24')]);module[_0xc4ec('0x25')]=router; \ No newline at end of file +var _0xb3f8=['/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','notify','addApplications','addAgents','/:id/send','send','/:id','update','delete','removeAnswers','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','./openchannelAccount.controller','isAuthenticated','index','describe','get','show','/:id/dispositions','/:id/canned_answers','getAnswers'];(function(_0x8175,_0x45146b){var _0x5ea97a=function(_0x3a1b1d){while(--_0x3a1b1d){_0x8175['push'](_0x8175['shift']());}};_0x5ea97a(++_0x45146b);}(_0xb3f8,0x111));var _0x8b3f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xb3f8[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0x8b3f('0x0'));var util=require(_0x8b3f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8b3f('0x2'));var router=express[_0x8b3f('0x3')]();var fs_extra=require(_0x8b3f('0x4'));var auth=require(_0x8b3f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8b3f('0x6'));router['get']('/',auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x8b3f('0x9')]);router[_0x8b3f('0xa')]('/:id',auth[_0x8b3f('0x7')](),controller[_0x8b3f('0xb')]);router[_0x8b3f('0xa')](_0x8b3f('0xc'),auth['isAuthenticated'](),controller['getDispositions']);router[_0x8b3f('0xa')](_0x8b3f('0xd'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0xe')]);router[_0x8b3f('0xa')](_0x8b3f('0xf'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x10')]);router[_0x8b3f('0xa')](_0x8b3f('0x11'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x12')]);router[_0x8b3f('0xa')](_0x8b3f('0x13'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x14')]);router[_0x8b3f('0x15')]('/',auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x16')]);router[_0x8b3f('0x15')]('/:id/dispositions',auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x17')]);router['post'](_0x8b3f('0xd'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x18')]);router[_0x8b3f('0x15')]('/:id/notify',controller[_0x8b3f('0x19')]);router[_0x8b3f('0x15')](_0x8b3f('0xf'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x1a')]);router[_0x8b3f('0x15')]('/:id/users',auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x1b')]);router[_0x8b3f('0x15')](_0x8b3f('0x1c'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x1d')]);router['put'](_0x8b3f('0x1e'),auth['isAuthenticated'](),controller[_0x8b3f('0x1f')]);router[_0x8b3f('0x20')](_0x8b3f('0x1e'),auth['isAuthenticated'](),controller['destroy']);router[_0x8b3f('0x20')](_0x8b3f('0xc'),auth[_0x8b3f('0x7')](),controller['removeDispositions']);router['delete'](_0x8b3f('0xd'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x21')]);router[_0x8b3f('0x20')](_0x8b3f('0x13'),auth[_0x8b3f('0x7')](),controller[_0x8b3f('0x22')]);module[_0x8b3f('0x23')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index b726f21..8f8c905 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 _0xdd81=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0x5dd8a6,_0x271d66){var _0x2eb653=function(_0x13615d){while(--_0x13615d){_0x5dd8a6['push'](_0x5dd8a6['shift']());}};_0x2eb653(++_0x271d66);}(_0xdd81,0xe7));var _0x1dd8=function(_0x2e544d,_0xa12e6b){_0x2e544d=_0x2e544d-0x0;var _0x4544c5=_0xdd81[_0x2e544d];return _0x4544c5;};'use strict';var Sequelize=require(_0x1dd8('0x0'));var rs=require(_0x1dd8('0x1'));module['exports']={'name':{'type':Sequelize[_0x1dd8('0x2')],'unique':_0x1dd8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x1dd8('0x2')]},'token':{'type':Sequelize[_0x1dd8('0x2')],'defaultValue':function(){return rs[_0x1dd8('0x4')]();}},'replyUri':{'type':Sequelize[_0x1dd8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1dd8('0x5')],'defaultValue':function(){return _0x1dd8('0x6');}},'notificationSound':{'type':Sequelize[_0x1dd8('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1dd8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1dd8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x1dd8('0x2')]},'queueTransfer':{'type':Sequelize[_0x1dd8('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1dd8('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1dd8('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1dd8('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x212aad){if(!_0x212aad)this[_0x1dd8('0xa')](_0x1dd8('0xb'),null);this[_0x1dd8('0xa')]('mandatoryDisposition',_0x212aad);}}}; \ No newline at end of file +var _0x37f7=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','TEXT'];(function(_0x3bef00,_0x2f8c4e){var _0xbaca7d=function(_0x58358d){while(--_0x58358d){_0x3bef00['push'](_0x3bef00['shift']());}};_0xbaca7d(++_0x2f8c4e);}(_0x37f7,0x119));var _0x737f=function(_0x8c7ae2,_0x356788){_0x8c7ae2=_0x8c7ae2-0x0;var _0x4093fc=_0x37f7[_0x8c7ae2];return _0x4093fc;};'use strict';var Sequelize=require(_0x737f('0x0'));var rs=require('randomstring');module[_0x737f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x737f('0x2')]},'token':{'type':Sequelize[_0x737f('0x2')],'defaultValue':function(){return rs[_0x737f('0x3')]();}},'replyUri':{'type':Sequelize[_0x737f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x737f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x737f('0x4')],'defaultValue':function(){return _0x737f('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x737f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x737f('0x2')]},'queueTransfer':{'type':Sequelize[_0x737f('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x737f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x737f('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x737f('0x7')],'defaultValue':![],'comment':_0x737f('0x8'),'set':function(_0xf8b2d9){if(!_0xf8b2d9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x737f('0x9')](_0x737f('0xa'),_0xf8b2d9);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 7e0cc54..ed56fc3 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 _0x6cfa=['request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','get','UserProfileResource','end','stack','name','send','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','options','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','from','lastName','threadId','externalUrl','OpenchannelInteraction','spread','contact','firstName','messageId','update','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','EventManager','notify','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','pick','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','addAgents','emit','removeAgents','isArray','getAgents','DESC','out','Messages','OpenchannelMessage','dataValues','eml-format','fast-json-patch','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','client','http'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x6cfa,0xa1));var _0xa6cf=function(_0x245a93,_0x258504){_0x245a93=_0x245a93-0x0;var _0x38bf51=_0x6cfa[_0x245a93];return _0x38bf51;};'use strict';var emlformat=require(_0xa6cf('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa6cf('0x1'));var rp=require('request-promise');var moment=require(_0xa6cf('0x2'));var BPromise=require(_0xa6cf('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa6cf('0x4'));var csv=require(_0xa6cf('0x5'));var ejs=require(_0xa6cf('0x6'));var fs=require('fs');var fs_extra=require(_0xa6cf('0x7'));var _=require(_0xa6cf('0x8'));var squel=require(_0xa6cf('0x9'));var crypto=require(_0xa6cf('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xa6cf('0xb'));var toCsv=require('to-csv');var querystring=require(_0xa6cf('0xc'));var Papa=require('papaparse');var Redis=require(_0xa6cf('0xd'));var authService=require(_0xa6cf('0xe'));var qs=require(_0xa6cf('0xf'));var as=require(_0xa6cf('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa6cf('0x11'))(_0xa6cf('0x12'));var utils=require(_0xa6cf('0x13'));var config=require(_0xa6cf('0x14'));var licenseUtil=require(_0xa6cf('0x15'));var db=require('../../mysqldb')['db'];config[_0xa6cf('0x16')]=_[_0xa6cf('0x17')](config[_0xa6cf('0x16')],{'host':_0xa6cf('0x18'),'port':0x18eb});var socket=require(_0xa6cf('0x19'))(new Redis(config[_0xa6cf('0x16')]));require(_0xa6cf('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa6cf('0x1b')][_0xa6cf('0x1c')]({'port':0x232c});var client9002=jayson['client'][_0xa6cf('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x2c6d3b,_0x304885,_0x2dab02,_0x428b51){return new BPromise(function(_0x493036,_0xe035fa){var _0x47fe8d=_0x428b51||client;return _0x47fe8d[_0xa6cf('0x1d')](_0x2c6d3b,_0x2dab02)[_0xa6cf('0x1e')](function(_0x2005fb){logger[_0xa6cf('0x1f')](_0xa6cf('0x20'),_0x304885,_0xa6cf('0x21'));logger[_0xa6cf('0x22')](_0xa6cf('0x23'),_0x304885,_0xa6cf('0x21'),JSON[_0xa6cf('0x24')](_0x2005fb));if(_0x2005fb[_0xa6cf('0x25')]){if(_0x2005fb[_0xa6cf('0x25')][_0xa6cf('0x26')]===0x1f4){logger['error'](_0xa6cf('0x20'),_0x304885,_0x2005fb['error'][_0xa6cf('0x27')]);return _0xe035fa(_0x2005fb[_0xa6cf('0x25')][_0xa6cf('0x27')]);}logger['error'](_0xa6cf('0x20'),_0x304885,_0x2005fb[_0xa6cf('0x25')][_0xa6cf('0x27')]);return _0x493036(_0x2005fb[_0xa6cf('0x25')]['message']);}else{logger[_0xa6cf('0x1f')]('OpenchannelAccount,\x20%s,\x20%s',_0x304885,_0xa6cf('0x21'));_0x493036(_0x2005fb[_0xa6cf('0x28')][_0xa6cf('0x27')]);}})[_0xa6cf('0x29')](function(_0x5a5a7d){logger[_0xa6cf('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x304885,_0x5a5a7d);_0xe035fa(_0x5a5a7d);});});}function respondWithStatusCode(_0x18a12c,_0x1cd21d){_0x1cd21d=_0x1cd21d||0xcc;return function(_0x241d42){if(_0x241d42){return _0x18a12c[_0xa6cf('0x2a')](_0x1cd21d);}return _0x18a12c[_0xa6cf('0x2b')](_0x1cd21d)['end']();};}function respondWithResult(_0x204039,_0x335ac8){_0x335ac8=_0x335ac8||0xc8;return function(_0x20654b){if(_0x20654b){return _0x204039[_0xa6cf('0x2b')](_0x335ac8)[_0xa6cf('0x2c')](_0x20654b);}};}function respondWithFilteredResult(_0xf975f9,_0x557087){return function(_0xa03b07){if(_0xa03b07){var _0x388096=typeof _0x557087[_0xa6cf('0x2d')]===_0xa6cf('0x2e')&&typeof _0x557087[_0xa6cf('0x2f')]===_0xa6cf('0x2e');var _0x481146=_0xa03b07[_0xa6cf('0x30')];var _0x3f1c9d=_0x388096?0x0:_0x557087[_0xa6cf('0x2d')];var _0x14a059=_0x388096?_0xa03b07['count']:_0x557087['offset']+_0x557087['limit'];var _0x47112e;if(_0x14a059>=_0x481146){_0x14a059=_0x481146;_0x47112e=0xc8;}else{_0x47112e=0xce;}_0xf975f9['status'](_0x47112e);return _0xf975f9[_0xa6cf('0x31')](_0xa6cf('0x32'),_0x3f1c9d+'-'+_0x14a059+'/'+_0x481146)[_0xa6cf('0x2c')](_0xa03b07);}return null;};}function patchUpdates(_0x2c308e){return function(_0x4d7b22){try{jsonpatch[_0xa6cf('0x33')](_0x4d7b22,_0x2c308e,!![]);}catch(_0xb6b5ff){return BPromise[_0xa6cf('0x34')](_0xb6b5ff);}return _0x4d7b22['save']();};}function saveUpdates(_0x105a22,_0x445b75){return function(_0x398815){if(_0x398815){return _0x398815['update'](_0x105a22)['then'](function(_0x422c5b){return _0x422c5b;});}return null;};}function removeEntity(_0x247769,_0x44c60c){return function(_0x270e8b){if(_0x270e8b){return _0x270e8b[_0xa6cf('0x35')]()[_0xa6cf('0x1e')](function(){var _0x2c5ae3=_0x270e8b[_0xa6cf('0x36')]({'plain':!![]});var _0x13383d='OpenchannelAccounts';return db[_0xa6cf('0x37')][_0xa6cf('0x35')]({'where':{'type':_0x13383d,'resourceId':_0x2c5ae3['id']}})[_0xa6cf('0x1e')](function(){return _0x270e8b;});})[_0xa6cf('0x1e')](function(){_0x247769['status'](0xcc)[_0xa6cf('0x38')]();});}};}function handleEntityNotFound(_0x3152e3,_0xc082d7){return function(_0xedf519){if(!_0xedf519){_0x3152e3[_0xa6cf('0x2a')](0x194);}return _0xedf519;};}function handleError(_0x2fcb92,_0x1410fe){_0x1410fe=_0x1410fe||0x1f4;return function(_0x585d7a){logger[_0xa6cf('0x25')](_0x585d7a[_0xa6cf('0x39')]);if(_0x585d7a[_0xa6cf('0x3a')]){delete _0x585d7a['name'];}_0x2fcb92[_0xa6cf('0x2b')](_0x1410fe)[_0xa6cf('0x3b')](_0x585d7a);};}exports['index']=function(_0x168935,_0x1a7171){var _0x3c0ba5={'include':[{'model':db['Pause'],'as':_0xa6cf('0x3c')}]},_0x54d3b3={},_0x50809a={'count':0x0,'rows':[]};var _0x31b7df=_[_0xa6cf('0x3d')](db[_0xa6cf('0x3e')][_0xa6cf('0x3f')],function(_0x23f635){return{'name':_0x23f635[_0xa6cf('0x40')],'type':_0x23f635[_0xa6cf('0x41')][_0xa6cf('0x42')]};});_0x54d3b3[_0xa6cf('0x43')]=_[_0xa6cf('0x3d')](_0x31b7df,_0xa6cf('0x3a'));_0x54d3b3['query']=_[_0xa6cf('0x44')](_0x168935[_0xa6cf('0x45')]);_0x54d3b3[_0xa6cf('0x46')]=_[_0xa6cf('0x47')](_0x54d3b3[_0xa6cf('0x43')],_0x54d3b3[_0xa6cf('0x45')]);_0x3c0ba5[_0xa6cf('0x48')]=_['intersection'](_0x54d3b3[_0xa6cf('0x43')],qs[_0xa6cf('0x49')](_0x168935['query'][_0xa6cf('0x49')]));_0x3c0ba5[_0xa6cf('0x48')]=_0x3c0ba5[_0xa6cf('0x48')][_0xa6cf('0x4a')]?_0x3c0ba5[_0xa6cf('0x48')]:_0x54d3b3[_0xa6cf('0x43')];if(!_0x168935[_0xa6cf('0x45')]['hasOwnProperty'](_0xa6cf('0x4b'))){_0x3c0ba5[_0xa6cf('0x2f')]=qs[_0xa6cf('0x2f')](_0x168935[_0xa6cf('0x45')][_0xa6cf('0x2f')]);_0x3c0ba5[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0x168935[_0xa6cf('0x45')][_0xa6cf('0x2d')]);}_0x3c0ba5[_0xa6cf('0x4c')]=qs[_0xa6cf('0x4d')](_0x168935[_0xa6cf('0x45')]['sort']);_0x3c0ba5['where']=qs[_0xa6cf('0x46')](_['pick'](_0x168935[_0xa6cf('0x45')],_0x54d3b3[_0xa6cf('0x46')]),_0x31b7df);if(_0x168935[_0xa6cf('0x45')][_0xa6cf('0x4e')]){_0x3c0ba5[_0xa6cf('0x4f')]=_[_0xa6cf('0x50')](_0x3c0ba5[_0xa6cf('0x4f')],{'$or':_['map'](_0x31b7df,function(_0x6b01cd){if(_0x6b01cd[_0xa6cf('0x41')]!==_0xa6cf('0x51')){var _0x29dd07={};_0x29dd07[_0x6b01cd['name']]={'$like':'%'+_0x168935[_0xa6cf('0x45')][_0xa6cf('0x4e')]+'%'};return _0x29dd07;}})});}_0x3c0ba5=_[_0xa6cf('0x50')]({},_0x3c0ba5,_0x168935['options']);var _0xb3dcef={'where':_0x3c0ba5[_0xa6cf('0x4f')]};return db['OpenchannelAccount']['count'](_0xb3dcef)[_0xa6cf('0x1e')](function(_0x6349aa){_0x50809a['count']=_0x6349aa;if(_0x168935[_0xa6cf('0x45')][_0xa6cf('0x52')]){_0x3c0ba5[_0xa6cf('0x53')]=[{'all':!![]}];}return db[_0xa6cf('0x3e')][_0xa6cf('0x54')](_0x3c0ba5);})[_0xa6cf('0x1e')](function(_0x5ec28f){_0x50809a['rows']=_0x5ec28f;return _0x50809a;})[_0xa6cf('0x1e')](respondWithFilteredResult(_0x1a7171,_0x3c0ba5))[_0xa6cf('0x29')](handleError(_0x1a7171,null));};exports[_0xa6cf('0x55')]=function(_0x3320ac,_0x4a4307){var _0x4b9375={'raw':![],'where':{'id':_0x3320ac[_0xa6cf('0x56')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x52d9b7={};_0x52d9b7[_0xa6cf('0x43')]=_[_0xa6cf('0x44')](db[_0xa6cf('0x3e')][_0xa6cf('0x3f')]);_0x52d9b7[_0xa6cf('0x45')]=_['keys'](_0x3320ac['query']);_0x52d9b7['filters']=_[_0xa6cf('0x47')](_0x52d9b7[_0xa6cf('0x43')],_0x52d9b7[_0xa6cf('0x45')]);_0x4b9375['attributes']=_[_0xa6cf('0x47')](_0x52d9b7[_0xa6cf('0x43')],qs[_0xa6cf('0x49')](_0x3320ac['query']['fields']));_0x4b9375[_0xa6cf('0x48')]=_0x4b9375[_0xa6cf('0x48')][_0xa6cf('0x4a')]?_0x4b9375[_0xa6cf('0x48')]:_0x52d9b7['model'];if(_0x3320ac['query'][_0xa6cf('0x52')]){_0x4b9375['include']=[{'all':!![]}];}_0x4b9375=_['merge']({},_0x4b9375,_0x3320ac['options']);return db[_0xa6cf('0x3e')]['find'](_0x4b9375)[_0xa6cf('0x1e')](handleEntityNotFound(_0x4a4307,null))[_0xa6cf('0x1e')](respondWithResult(_0x4a4307,null))[_0xa6cf('0x29')](handleError(_0x4a4307,null));};exports[_0xa6cf('0x57')]=function(_0x36833a,_0x249a25){return db[_0xa6cf('0x3e')][_0xa6cf('0x57')](_0x36833a[_0xa6cf('0x58')],{})[_0xa6cf('0x1e')](function(_0x2512d7){var _0x3dc5f9=_0x36833a[_0xa6cf('0x59')][_0xa6cf('0x36')]({'plain':!![]});if(!_0x3dc5f9)throw new Error(_0xa6cf('0x5a'));if(_0x3dc5f9['role']==='user'){var _0x1e2dc9=_0x2512d7['get']({'plain':!![]});var _0x52b479=_0xa6cf('0x5b');return db[_0xa6cf('0x5c')][_0xa6cf('0x5d')]({'where':{'name':_0x52b479,'userProfileId':_0x3dc5f9['userProfileId']},'raw':!![]})[_0xa6cf('0x1e')](function(_0x1cf2df){if(_0x1cf2df&&_0x1cf2df[_0xa6cf('0x5e')]===0x0){return db[_0xa6cf('0x37')][_0xa6cf('0x57')]({'name':_0x1e2dc9['name'],'resourceId':_0x1e2dc9['id'],'type':_0x1cf2df[_0xa6cf('0x3a')],'sectionId':_0x1cf2df['id']},{})[_0xa6cf('0x1e')](function(){return _0x2512d7;});}else{return _0x2512d7;}})[_0xa6cf('0x29')](function(_0xa27cd0){logger[_0xa6cf('0x25')](_0xa6cf('0x5f'),_0xa27cd0);throw _0xa27cd0;});}return _0x2512d7;})[_0xa6cf('0x1e')](respondWithResult(_0x249a25,0xc9))[_0xa6cf('0x29')](handleError(_0x249a25,null));};exports['update']=function(_0x80983a,_0x1d5fa3){if(_0x80983a[_0xa6cf('0x58')]['id']){delete _0x80983a['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x80983a[_0xa6cf('0x56')]['id']},'include':[{'model':db[_0xa6cf('0x60')],'as':_0xa6cf('0x3c')}]})[_0xa6cf('0x1e')](handleEntityNotFound(_0x1d5fa3,null))[_0xa6cf('0x1e')](saveUpdates(_0x80983a[_0xa6cf('0x58')],null))['then'](respondWithResult(_0x1d5fa3,null))[_0xa6cf('0x29')](handleError(_0x1d5fa3,null));};exports[_0xa6cf('0x35')]=function(_0x38af8c,_0x451252){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x38af8c['params']['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x451252,null))[_0xa6cf('0x1e')](removeEntity(_0x451252,null))[_0xa6cf('0x29')](handleError(_0x451252,null));};exports[_0xa6cf('0x61')]=function(_0x297f5d,_0x51677b){return db['OpenchannelAccount']['describe']()[_0xa6cf('0x1e')](respondWithResult(_0x51677b,null))[_0xa6cf('0x29')](handleError(_0x51677b,null));};exports[_0xa6cf('0x62')]=function(_0x57f827,_0x5880c9,_0xfd3af5){if(_0x57f827[_0xa6cf('0x58')]['id']){delete _0x57f827[_0xa6cf('0x58')]['id'];}return db[_0xa6cf('0x3e')]['find']({'where':{'id':_0x57f827[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x5880c9,null))[_0xa6cf('0x1e')](function(_0x2d8fc2){if(_0x2d8fc2){_0x57f827[_0xa6cf('0x58')][_0xa6cf('0x63')]=_0x2d8fc2['id'];return db[_0xa6cf('0x64')][_0xa6cf('0x57')](_0x57f827[_0xa6cf('0x58')]);}})[_0xa6cf('0x1e')](respondWithResult(_0x5880c9,null))[_0xa6cf('0x29')](handleError(_0x5880c9,null));};exports[_0xa6cf('0x65')]=function(_0x4d8822,_0x249a46,_0x910087){var _0x4b4828={'raw':![],'where':{}};var _0xfe3b7b={};var _0x1c24bb={'count':0x0,'rows':[]};return db[_0xa6cf('0x3e')][_0xa6cf('0x66')]({'where':{'id':_0x4d8822[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x249a46,null))['then'](function(_0x43b689){if(_0x43b689){_0xfe3b7b[_0xa6cf('0x43')]=_[_0xa6cf('0x44')](db['Disposition'][_0xa6cf('0x3f')]);_0xfe3b7b[_0xa6cf('0x45')]=_[_0xa6cf('0x44')](_0x4d8822[_0xa6cf('0x45')]);_0xfe3b7b['filters']=_['intersection'](_0xfe3b7b[_0xa6cf('0x43')],_0xfe3b7b['query']);_0x4b4828[_0xa6cf('0x48')]=_[_0xa6cf('0x47')](_0xfe3b7b['model'],qs[_0xa6cf('0x49')](_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x49')]));_0x4b4828[_0xa6cf('0x48')]=_0x4b4828[_0xa6cf('0x48')][_0xa6cf('0x4a')]?_0x4b4828[_0xa6cf('0x48')]:_0xfe3b7b[_0xa6cf('0x43')];if(!_0x4d8822[_0xa6cf('0x45')]['hasOwnProperty']('nolimit')){_0x4b4828[_0xa6cf('0x2f')]=qs[_0xa6cf('0x2f')](_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x2f')]);_0x4b4828[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x2d')]);}_0x4b4828[_0xa6cf('0x4c')]=qs[_0xa6cf('0x4d')](_0x4d8822[_0xa6cf('0x45')]['sort']);_0x4b4828[_0xa6cf('0x4f')]=qs[_0xa6cf('0x46')](_['pick'](_0x4d8822[_0xa6cf('0x45')],_0xfe3b7b['filters']));_0x4b4828[_0xa6cf('0x4f')]['OpenchannelAccountId']=_0x43b689['id'];if(_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x4e')]){_0x4b4828[_0xa6cf('0x4f')]=_['merge'](_0x4b4828[_0xa6cf('0x4f')],{'$or':_[_0xa6cf('0x3d')](_0x4b4828[_0xa6cf('0x48')],function(_0x49def4){var _0x22a726={};_0x22a726[_0x49def4]={'$like':'%'+_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x4e')]+'%'};return _0x22a726;})});}_0x4b4828=_[_0xa6cf('0x50')]({},_0x4b4828,_0x4d8822[_0xa6cf('0x67')]);return db[_0xa6cf('0x64')][_0xa6cf('0x30')]({'where':_0x4b4828[_0xa6cf('0x4f')]})[_0xa6cf('0x1e')](function(_0x3ee76c){_0x1c24bb['count']=_0x3ee76c;if(_0x4d8822[_0xa6cf('0x45')][_0xa6cf('0x52')]){_0x4b4828[_0xa6cf('0x53')]=[{'all':!![]}];}return db[_0xa6cf('0x64')][_0xa6cf('0x54')](_0x4b4828);})[_0xa6cf('0x1e')](function(_0x157a85){_0x1c24bb[_0xa6cf('0x68')]=_0x157a85;return _0x1c24bb;});}})[_0xa6cf('0x1e')](respondWithFilteredResult(_0x249a46,_0x4b4828))['catch'](handleError(_0x249a46,null));};exports[_0xa6cf('0x69')]=function(_0x495834,_0x7fe51b,_0xff57a6){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x495834['params']['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x7fe51b,null))[_0xa6cf('0x1e')](function(_0x259cde){if(_0x259cde){return _0x259cde[_0xa6cf('0x69')](_0x495834[_0xa6cf('0x45')][_0xa6cf('0x6a')]);}})['then'](respondWithStatusCode(_0x7fe51b,null))['catch'](handleError(_0x7fe51b,null));};exports[_0xa6cf('0x6b')]=function(_0x595855,_0x152461,_0x3f2940){if(_0x595855[_0xa6cf('0x58')]['id']){delete _0x595855[_0xa6cf('0x58')]['id'];}return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x595855['params']['id']}})['then'](handleEntityNotFound(_0x152461,null))[_0xa6cf('0x1e')](function(_0x575b03){if(_0x575b03){_0x595855[_0xa6cf('0x58')]['OpenchannelAccountId']=_0x575b03['id'];return db[_0xa6cf('0x6c')]['create'](_0x595855[_0xa6cf('0x58')]);}})[_0xa6cf('0x1e')](respondWithResult(_0x152461,null))[_0xa6cf('0x29')](handleError(_0x152461,null));};exports[_0xa6cf('0x6d')]=function(_0xe72343,_0x2aa3d9,_0x241e53){var _0x800b1c={'raw':![],'where':{}};var _0x1a642e={};var _0x282150={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0xe72343[_0xa6cf('0x56')]['id']}})['then'](handleEntityNotFound(_0x2aa3d9,null))[_0xa6cf('0x1e')](function(_0x39ac37){if(_0x39ac37){_0x1a642e[_0xa6cf('0x43')]=_[_0xa6cf('0x44')](db[_0xa6cf('0x6c')]['rawAttributes']);_0x1a642e[_0xa6cf('0x45')]=_[_0xa6cf('0x44')](_0xe72343[_0xa6cf('0x45')]);_0x1a642e['filters']=_[_0xa6cf('0x47')](_0x1a642e['model'],_0x1a642e['query']);_0x800b1c[_0xa6cf('0x48')]=_['intersection'](_0x1a642e[_0xa6cf('0x43')],qs[_0xa6cf('0x49')](_0xe72343[_0xa6cf('0x45')]['fields']));_0x800b1c[_0xa6cf('0x48')]=_0x800b1c[_0xa6cf('0x48')][_0xa6cf('0x4a')]?_0x800b1c[_0xa6cf('0x48')]:_0x1a642e['model'];if(!_0xe72343[_0xa6cf('0x45')][_0xa6cf('0x6e')](_0xa6cf('0x4b'))){_0x800b1c['limit']=qs[_0xa6cf('0x2f')](_0xe72343[_0xa6cf('0x45')][_0xa6cf('0x2f')]);_0x800b1c[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0xe72343[_0xa6cf('0x45')][_0xa6cf('0x2d')]);}_0x800b1c[_0xa6cf('0x4c')]=qs[_0xa6cf('0x4d')](_0xe72343['query'][_0xa6cf('0x4d')]);_0x800b1c[_0xa6cf('0x4f')]=qs[_0xa6cf('0x46')](_['pick'](_0xe72343[_0xa6cf('0x45')],_0x1a642e[_0xa6cf('0x46')]));_0x800b1c['where'][_0xa6cf('0x63')]=_0x39ac37['id'];if(_0xe72343[_0xa6cf('0x45')][_0xa6cf('0x4e')]){_0x800b1c[_0xa6cf('0x4f')]=_[_0xa6cf('0x50')](_0x800b1c['where'],{'$or':_['map'](_0x800b1c[_0xa6cf('0x48')],function(_0x1d8796){var _0x4fa99b={};_0x4fa99b[_0x1d8796]={'$like':'%'+_0xe72343['query'][_0xa6cf('0x4e')]+'%'};return _0x4fa99b;})});}_0x800b1c=_[_0xa6cf('0x50')]({},_0x800b1c,_0xe72343['options']);return db['CannedAnswer']['count']({'where':_0x800b1c['where']})[_0xa6cf('0x1e')](function(_0x4ceaff){_0x282150[_0xa6cf('0x30')]=_0x4ceaff;if(_0xe72343[_0xa6cf('0x45')][_0xa6cf('0x52')]){_0x800b1c['include']=[{'all':!![]}];}return db[_0xa6cf('0x6c')]['findAll'](_0x800b1c);})[_0xa6cf('0x1e')](function(_0x75d64){_0x282150[_0xa6cf('0x68')]=_0x75d64;return _0x282150;});}})['then'](respondWithFilteredResult(_0x2aa3d9,_0x800b1c))[_0xa6cf('0x29')](handleError(_0x2aa3d9,null));};exports['removeAnswers']=function(_0x33144f,_0x5a4fb3,_0x15a810){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x33144f[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x5a4fb3,null))[_0xa6cf('0x1e')](function(_0xf85ec0){if(_0xf85ec0){return _0xf85ec0[_0xa6cf('0x6f')](_0x33144f[_0xa6cf('0x45')][_0xa6cf('0x6a')]);}})[_0xa6cf('0x1e')](respondWithStatusCode(_0x5a4fb3,null))[_0xa6cf('0x29')](handleError(_0x5a4fb3,null));};exports['notify']=function(_0x43c89c,_0x3210ff,_0x2d25e8){var _0x1faf18={'body':_0x43c89c[_0xa6cf('0x58')],'channel':'openchannel'};var _0x67f003=[];var _0x2d6ff8=[];var _0x1451ce={};var _0x4b6515=![];return db[_0xa6cf('0x70')][_0xa6cf('0x61')]()[_0xa6cf('0x1e')](function(_0x4564e3){if(!_0x4564e3){throw new db[(_0xa6cf('0x71'))][(_0xa6cf('0x72'))]('no\x20available\x20attributes');}_0x67f003=_[_0xa6cf('0x73')](_[_0xa6cf('0x44')](_0x4564e3),[_0xa6cf('0x74'),_0xa6cf('0x75')]);_0x2d6ff8=_[_0xa6cf('0x73')](_['keys'](_0x4564e3),[_0xa6cf('0x74'),_0xa6cf('0x75'),_0xa6cf('0x76'),_0xa6cf('0x77')]);if(_0x43c89c[_0xa6cf('0x58')]['id']){delete _0x43c89c[_0xa6cf('0x58')]['id'];}if(_[_0xa6cf('0x78')](_0x43c89c[_0xa6cf('0x58')]['from'])){throw new db[(_0xa6cf('0x71'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x43c89c['body']['body'])||_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x58')]===''){throw new db[(_0xa6cf('0x71'))][(_0xa6cf('0x72'))](_0xa6cf('0x79'));}if(_[_0xa6cf('0x78')](_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x7a')])){throw new db[(_0xa6cf('0x71'))][(_0xa6cf('0x72'))](_0xa6cf('0x7b')+_0x2d6ff8);}if(!_[_0xa6cf('0x7c')](_0x2d6ff8,_0x43c89c[_0xa6cf('0x58')]['mapKey'])){throw new db[(_0xa6cf('0x71'))][(_0xa6cf('0x72'))](_0xa6cf('0x7d')+_0x2d6ff8);}_0x1451ce[_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x7a')]]=_0x43c89c[_0xa6cf('0x58')]['from'];})['then'](function(){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x43c89c['params']['id']},'include':[{'model':db[_0xa6cf('0x7e')],'as':_0xa6cf('0x7f'),'include':[{'model':db[_0xa6cf('0x70')],'as':_0xa6cf('0x80'),'where':_0x1451ce,'limit':0x1,'order':[[_0xa6cf('0x75'),'DESC']]}]},{'model':db[_0xa6cf('0x81')],'as':_0xa6cf('0x82')}]});})[_0xa6cf('0x1e')](handleEntityNotFound(_0x3210ff,null))[_0xa6cf('0x1e')](function(_0x2ad12b){if(_0x2ad12b&&_0x2ad12b[_0xa6cf('0x7f')]){_0x1faf18[_0xa6cf('0x83')]=_0x2ad12b;_0x1faf18[_0xa6cf('0x84')]=_0x2ad12b[_0xa6cf('0x82')];_0x1faf18[_0xa6cf('0x85')]=_0x2ad12b[_0xa6cf('0x7f')];_0x1faf18[_0xa6cf('0x84')]=_[_0xa6cf('0x86')](_0x1faf18['applications'],[_0xa6cf('0x87')],[_0xa6cf('0x88')]);if(_0x1faf18[_0xa6cf('0x83')]['Applications']){delete _0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x82')];}if(_0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x7f')]&&_0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x7f')]['Contacts'][_0xa6cf('0x4a')]){return _0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x7f')][_0xa6cf('0x80')][0x0];}var _0x39cc8c=_[_0xa6cf('0x17')](_0x43c89c[_0xa6cf('0x58')],{'firstName':_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x89')],'ListId':_0x2ad12b[_0xa6cf('0x77')]});_0x39cc8c[_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x7a')]]=_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x89')];return db[_0xa6cf('0x70')][_0xa6cf('0x57')](_0x39cc8c,{'fields':_0x67f003,'raw':!![]});}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x3210ff,null))[_0xa6cf('0x1e')](function(_0xcaa4a1){_0x1faf18['contact']=_0xcaa4a1;if(_0xcaa4a1){var _0x4a7211={'ContactId':_0xcaa4a1['id'],'OpenchannelAccountId':_0x43c89c[_0xa6cf('0x56')]['id'],'from':(_0xcaa4a1['firstName']||'')+'\x20'+(_0xcaa4a1[_0xa6cf('0x8a')]||'')};var _0x321b6c={'OpenchannelAccountId':_0x43c89c[_0xa6cf('0x56')]['id'],'closed':![]};if(_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8b')]){_0x321b6c[_0xa6cf('0x8b')]=_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8b')];return db['OpenchannelInteraction']['find']({'where':_0x321b6c})['then'](function(_0x382600){if(_0x382600){return[_0x382600,![]];}_0x4a7211[_0xa6cf('0x8b')]=_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8b')];_0x4a7211[_0xa6cf('0x8c')]=_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8c')];return db[_0xa6cf('0x8d')][_0xa6cf('0x57')](_0x4a7211)[_0xa6cf('0x1e')](function(_0x1f37a1){return[_0x1f37a1,!![]];});});}else{_0x321b6c[_0xa6cf('0x8b')]=null;}_0x321b6c['ContactId']=_0xcaa4a1['id'];return db[_0xa6cf('0x8d')][_0xa6cf('0x5d')]({'where':_0x321b6c})[_0xa6cf('0x1e')](function(_0x592019){if(_0x592019){return[_0x592019,![]];}return db[_0xa6cf('0x8d')][_0xa6cf('0x57')](_0x4a7211)[_0xa6cf('0x1e')](function(_0x29a93c){return[_0x29a93c,!![]];});});}})[_0xa6cf('0x8e')](function(_0x9ae34d,_0x42c985){if(_0x9ae34d){_0x4b6515=_0x42c985;if(!_0x42c985){var _0x4b8f45={'from':(_0x1faf18[_0xa6cf('0x8f')][_0xa6cf('0x90')]||'')+'\x20'+(_0x1faf18[_0xa6cf('0x8f')][_0xa6cf('0x8a')]||'')};if(_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8b')]&&_0x43c89c['body'][_0xa6cf('0x91')]&&_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x8b')]!=_0x43c89c[_0xa6cf('0x58')]['messageId']){_0x4b8f45['threadId']=_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x91')];}return _0x9ae34d[_0xa6cf('0x92')](_0x4b8f45);}else{return _0x9ae34d;}}})[_0xa6cf('0x1e')](function(_0x2bb7fa){_0x1faf18['interaction']=_0x2bb7fa['get']({'plain':!![]});_0x1faf18[_0xa6cf('0x93')]['created']=_0x4b6515;if(_0x1faf18[_0xa6cf('0x93')][_0xa6cf('0x94')]){if(_0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x95')]){_0x1faf18[_0xa6cf('0x84')][_0xa6cf('0x96')]({'id':0x0,'priority':_0x1faf18[_0xa6cf('0x84')][_0xa6cf('0x4a')]+0x1,'app':_0xa6cf('0x97'),'appdata':_0xa6cf('0x98'),'interval':_0xa6cf('0x99')});}}return db['OpenchannelMessage'][_0xa6cf('0x57')]({'body':_0x43c89c[_0xa6cf('0x58')][_0xa6cf('0x58')],'OpenchannelAccountId':_0x43c89c[_0xa6cf('0x56')]['id'],'OpenchannelInteractionId':_0x2bb7fa['id'],'direction':'in','ContactId':_0x1faf18[_0xa6cf('0x8f')]['id'],'AttachmentId':_0x43c89c[_0xa6cf('0x58')]['AttachmentId']});})[_0xa6cf('0x1e')](function(_0x41eb29){_0x1faf18[_0xa6cf('0x27')]=_0x41eb29;if(!_0x1faf18[_0xa6cf('0x93')][_0xa6cf('0x9a')])return;return db[_0xa6cf('0x9b')][_0xa6cf('0x5d')]({'attributes':['id','name'],'where':{'id':_0x1faf18[_0xa6cf('0x93')][_0xa6cf('0x9a')]}});})[_0xa6cf('0x1e')](function(_0x2ffbfc){if(_0x2ffbfc){_0x1faf18[_0xa6cf('0x84')][_0xa6cf('0x9c')]({'id':0x0,'priority':0x0,'app':_0xa6cf('0x9d'),'appdata':_0x2ffbfc['name']+','+(_0x1faf18[_0xa6cf('0x83')][_0xa6cf('0x9e')]||0xa),'interval':'*,*,*,*'});}if(!_0x1faf18[_0xa6cf('0x93')][_0xa6cf('0x9f')])return;return db[_0xa6cf('0xa0')][_0xa6cf('0x5d')]({'attributes':['id',_0xa6cf('0x3a')],'where':{'id':_0x1faf18['interaction'][_0xa6cf('0x9f')]}});})[_0xa6cf('0x1e')](function(_0x27d643){if(_0x27d643){_0x1faf18[_0xa6cf('0x84')][_0xa6cf('0x9c')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x27d643[_0xa6cf('0x3a')]+','+(_0x1faf18[_0xa6cf('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x1faf18);})[_0xa6cf('0x1e')](function(_0x4be7f0){respondWithRpcPromise(_0xa6cf('0xa1'),_0xa6cf('0xa1'),{'event':_0xa6cf('0xa2'),'message':_0x4be7f0},client9002);return _0x4be7f0;})[_0xa6cf('0x1e')](respondWithResult(_0x3210ff,null))[_0xa6cf('0x29')](handleError(_0x3210ff,null));};exports[_0xa6cf('0xa3')]=function(_0x286079,_0xeb2e78){var _0x2bedfb=_0x286079['params']['id'];var _0x2fba3a=_0x286079[_0xa6cf('0x58')];var _0x570b1c=0xc8;var _0x30ccd0=null;return db[_0xa6cf('0xa4')][_0xa6cf('0xa5')]({'isolationLevel':db['sequelize'][_0xa6cf('0xa6')]['ISOLATION_LEVELS'][_0xa6cf('0xa7')]},function(_0x100a2d){return db['OpenchannelAccount'][_0xa6cf('0x66')]({'where':{'id':_0x2bedfb},'transaction':_0x100a2d})['then'](function(_0x35fb7f){if(_0x35fb7f){return db[_0xa6cf('0x81')][_0xa6cf('0x35')]({'where':{'OpenchannelAccountId':_0x2bedfb},'transaction':_0x100a2d})[_0xa6cf('0x1e')](function(){var _0x3f0853=_[_0xa6cf('0x3d')](_0x2fba3a,function(_0x2eba2a){_0x2eba2a['OpenchannelAccountId']=_0x2bedfb;return _0x2eba2a;});return db[_0xa6cf('0x81')]['bulkCreate'](_0x3f0853,{'transaction':_0x100a2d});});}else{_0x570b1c=0x194;_0x30ccd0=[];}});})[_0xa6cf('0x1e')](function(){if(_0x570b1c!==0x194){return db[_0xa6cf('0x81')][_0xa6cf('0xa8')]({'where':{'OpenchannelAccountId':_0x2bedfb},'order':_0xa6cf('0x87')})[_0xa6cf('0x1e')](function(_0x7640cb){_0x30ccd0=_0x7640cb;});}})[_0xa6cf('0x29')](function(_0x2b3b29){_0x570b1c=0x1f4;logger[_0xa6cf('0x25')](_0x2b3b29[_0xa6cf('0x39')]);if(_0x2b3b29[_0xa6cf('0x3a')]){delete _0x2b3b29[_0xa6cf('0x3a')];}_0x30ccd0=_0x2b3b29;})[_0xa6cf('0xa9')](function(){if(_0x30ccd0===null){_0xeb2e78['sendStatus'](_0x570b1c);}else{if(_0x570b1c===0x1f4){_0xeb2e78[_0xa6cf('0x2b')](_0x570b1c)[_0xa6cf('0x3b')](_0x30ccd0);}else{_0xeb2e78[_0xa6cf('0x2b')](_0x570b1c)[_0xa6cf('0x2c')](_0x30ccd0);}}});};exports[_0xa6cf('0xaa')]=function(_0x1a39aa,_0x518d28,_0x46786d){var _0x55f79b={};var _0x166b8a={};var _0x16b7b5;var _0xaa11a0;return db[_0xa6cf('0x3e')][_0xa6cf('0x66')]({'where':{'id':_0x1a39aa[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x518d28,null))[_0xa6cf('0x1e')](function(_0x2de917){if(_0x2de917){_0x16b7b5=_0x2de917;_0x166b8a['model']=_[_0xa6cf('0x44')](db[_0xa6cf('0x81')]['rawAttributes']);_0x166b8a['query']=_[_0xa6cf('0x44')](_0x1a39aa[_0xa6cf('0x45')]);_0x166b8a['filters']=_[_0xa6cf('0x47')](_0x166b8a['model'],_0x166b8a[_0xa6cf('0x45')]);_0x55f79b[_0xa6cf('0x48')]=_[_0xa6cf('0x47')](_0x166b8a[_0xa6cf('0x43')],qs[_0xa6cf('0x49')](_0x1a39aa['query']['fields']));_0x55f79b['attributes']=_0x55f79b[_0xa6cf('0x48')][_0xa6cf('0x4a')]?_0x55f79b[_0xa6cf('0x48')]:_0x166b8a[_0xa6cf('0x43')];_0x55f79b[_0xa6cf('0x4c')]=qs[_0xa6cf('0x4d')](_0x1a39aa['query'][_0xa6cf('0x4d')]);_0x55f79b[_0xa6cf('0x4f')]=qs[_0xa6cf('0x46')](_[_0xa6cf('0xab')](_0x1a39aa[_0xa6cf('0x45')],_0x166b8a[_0xa6cf('0x46')]));if(_0x1a39aa[_0xa6cf('0x45')]['filter']){_0x55f79b[_0xa6cf('0x4f')]=_[_0xa6cf('0x50')](_0x55f79b['where'],{'$or':_[_0xa6cf('0x3d')](_0x55f79b[_0xa6cf('0x48')],function(_0x1aa145){var _0x2f5cbb={};_0x2f5cbb[_0x1aa145]={'$like':'%'+_0x1a39aa['query']['filter']+'%'};return _0x2f5cbb;})});}_0x55f79b=_[_0xa6cf('0x50')]({},_0x55f79b,_0x1a39aa[_0xa6cf('0x67')]);return _0x16b7b5[_0xa6cf('0xaa')](_0x55f79b);}})[_0xa6cf('0x1e')](function(_0x54cdf3){if(_0x54cdf3){_0xaa11a0=_0x54cdf3[_0xa6cf('0x4a')];if(!_0x1a39aa[_0xa6cf('0x45')]['hasOwnProperty']('nolimit')){_0x55f79b['limit']=qs['limit'](_0x1a39aa['query'][_0xa6cf('0x2f')]);_0x55f79b[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0x1a39aa[_0xa6cf('0x45')]['offset']);}return _0x16b7b5[_0xa6cf('0xaa')](_0x55f79b);}})['then'](function(_0x5a3d17){if(_0x5a3d17){return _0x5a3d17?{'count':_0xaa11a0,'rows':_0x5a3d17}:null;}})[_0xa6cf('0x1e')](respondWithResult(_0x518d28,null))['catch'](handleError(_0x518d28,null));};exports[_0xa6cf('0xac')]=function(_0x30a8be,_0x157e1d,_0x245c55){var _0x45557e={'raw':![],'where':{}};var _0x4ac706={};var _0xc45b14={'count':0x0,'rows':[]};return db[_0xa6cf('0x3e')]['findOne']({'where':{'id':_0x30a8be['params']['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x157e1d,null))[_0xa6cf('0x1e')](function(_0x4d70f2){if(_0x4d70f2){_0x4ac706[_0xa6cf('0x43')]=_[_0xa6cf('0x44')](db[_0xa6cf('0x8d')][_0xa6cf('0x3f')]);_0x4ac706[_0xa6cf('0x45')]=_[_0xa6cf('0x44')](_0x30a8be[_0xa6cf('0x45')]);_0x4ac706[_0xa6cf('0x46')]=_[_0xa6cf('0x47')](_0x4ac706['model'],_0x4ac706[_0xa6cf('0x45')]);_0x45557e[_0xa6cf('0x48')]=_[_0xa6cf('0x47')](_0x4ac706[_0xa6cf('0x43')],qs[_0xa6cf('0x49')](_0x30a8be[_0xa6cf('0x45')]['fields']));_0x45557e[_0xa6cf('0x48')]=_0x45557e[_0xa6cf('0x48')]['length']?_0x45557e[_0xa6cf('0x48')]:_0x4ac706[_0xa6cf('0x43')];if(!_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0x6e')]('nolimit')){_0x45557e[_0xa6cf('0x2f')]=qs['limit'](_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0x2f')]);_0x45557e[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0x30a8be['query'][_0xa6cf('0x2d')]);}_0x45557e[_0xa6cf('0x4c')]=qs['sort'](_0x30a8be['query'][_0xa6cf('0x4d')]);_0x45557e[_0xa6cf('0x4f')]=qs[_0xa6cf('0x46')](_[_0xa6cf('0xab')](_0x30a8be['query'],_0x4ac706[_0xa6cf('0x46')]));_0x45557e[_0xa6cf('0x4f')][_0xa6cf('0x63')]=_0x4d70f2['id'];if(_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0x4e')]){_0x45557e[_0xa6cf('0x4f')]=_[_0xa6cf('0x50')](_0x45557e[_0xa6cf('0x4f')],{'$or':_['map'](_0x45557e[_0xa6cf('0x48')],function(_0x484bef){var _0x146550={};_0x146550[_0x484bef]={'$like':'%'+_0x30a8be[_0xa6cf('0x45')]['filter']+'%'};return _0x146550;})});}_0x45557e=_['merge']({},_0x45557e,_0x30a8be[_0xa6cf('0x67')]);return db[_0xa6cf('0x8d')][_0xa6cf('0x30')]({'where':_0x45557e[_0xa6cf('0x4f')]})[_0xa6cf('0x1e')](function(_0x52ab7d){_0xc45b14[_0xa6cf('0x30')]=_0x52ab7d;if(_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0x52')]){_0x45557e[_0xa6cf('0x53')]=[{'model':db[_0xa6cf('0x70')],'as':_0xa6cf('0xad'),'required':![]},{'model':db[_0xa6cf('0x9b')],'as':_0xa6cf('0xae'),'attributes':[_0xa6cf('0x3a'),_0xa6cf('0xaf'),'internal'],'required':![]},{'model':db[_0xa6cf('0xb0')],'as':_0xa6cf('0xb1'),'attributes':['id','name',_0xa6cf('0xb2')],'where':_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0xb3')]?{'id':_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0xb3')]}:undefined,'required':_0x30a8be[_0xa6cf('0x45')][_0xa6cf('0xb3')]?!![]:![]}];}return db[_0xa6cf('0x8d')][_0xa6cf('0x54')](_0x45557e);})[_0xa6cf('0x1e')](function(_0x16d4c3){_0xc45b14[_0xa6cf('0x68')]=_0x16d4c3;return _0xc45b14;});}})[_0xa6cf('0x1e')](respondWithFilteredResult(_0x157e1d,_0x45557e))['catch'](handleError(_0x157e1d,null));};exports[_0xa6cf('0xb4')]=function(_0x2222e8,_0x419889,_0x13aec2){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x2222e8[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x419889,null))['then'](function(_0x55d482){if(_0x55d482){return _0x55d482[_0xa6cf('0xb4')](_0x2222e8[_0xa6cf('0x58')][_0xa6cf('0x6a')],_['omit'](_0x2222e8['body'],['ids','id'])||{})[_0xa6cf('0x8e')](function(_0x51099f){for(var _0xa5ca8a=0x0;_0xa5ca8a<_0x2222e8[_0xa6cf('0x58')][_0xa6cf('0x6a')]['length'];_0xa5ca8a+=0x1){socket[_0xa6cf('0xb5')]('userOpenchannelAccount:save',{'UserId':Number(_0x2222e8[_0xa6cf('0x58')][_0xa6cf('0x6a')][_0xa5ca8a]),'OpenchannelAccountId':Number(_0x2222e8[_0xa6cf('0x56')]['id'])});}return _0x51099f;});}})[_0xa6cf('0x1e')](respondWithResult(_0x419889,null))[_0xa6cf('0x29')](handleError(_0x419889,null));};exports[_0xa6cf('0xb6')]=function(_0x566dc6,_0x4f5168,_0x15d95c){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x566dc6[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x4f5168,null))['then'](function(_0x2e5d7a){if(_0x2e5d7a){return _0x2e5d7a[_0xa6cf('0xb6')](_0x566dc6[_0xa6cf('0x45')][_0xa6cf('0x6a')])[_0xa6cf('0x1e')](function(){if(_[_0xa6cf('0xb7')](_0x566dc6[_0xa6cf('0x45')][_0xa6cf('0x6a')])){for(var _0x16d92d=0x0;_0x16d92d<_0x566dc6[_0xa6cf('0x45')][_0xa6cf('0x6a')][_0xa6cf('0x4a')];_0x16d92d+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x566dc6['query']['ids'][_0x16d92d]),'OpenchannelAccountId':Number(_0x566dc6[_0xa6cf('0x56')]['id'])});}}else{socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x566dc6['query'][_0xa6cf('0x6a')]),'OpenchannelAccountId':Number(_0x566dc6[_0xa6cf('0x56')]['id'])});}});}})[_0xa6cf('0x1e')](respondWithStatusCode(_0x4f5168,null))[_0xa6cf('0x29')](handleError(_0x4f5168,null));};exports['getAgents']=function(_0x53450e,_0x21064a,_0x5b2777){var _0x40adfb={};var _0x350bfb={};var _0x2057fc;var _0x4faea7;return db[_0xa6cf('0x3e')][_0xa6cf('0x66')]({'where':{'id':_0x53450e[_0xa6cf('0x56')]['id']}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x21064a,null))['then'](function(_0x301939){if(_0x301939){_0x2057fc=_0x301939;_0x350bfb[_0xa6cf('0x43')]=_[_0xa6cf('0x44')](db['User'][_0xa6cf('0x3f')]);_0x350bfb[_0xa6cf('0x45')]=_['keys'](_0x53450e[_0xa6cf('0x45')]);_0x350bfb['filters']=_['intersection'](_0x350bfb[_0xa6cf('0x43')],_0x350bfb[_0xa6cf('0x45')]);_0x40adfb[_0xa6cf('0x48')]=_['intersection'](_0x350bfb[_0xa6cf('0x43')],qs['fields'](_0x53450e[_0xa6cf('0x45')]['fields']));_0x40adfb[_0xa6cf('0x48')]=_0x40adfb[_0xa6cf('0x48')]['length']?_0x40adfb['attributes']:_0x350bfb[_0xa6cf('0x43')];_0x40adfb[_0xa6cf('0x4c')]=qs[_0xa6cf('0x4d')](_0x53450e[_0xa6cf('0x45')][_0xa6cf('0x4d')]);_0x40adfb['where']=qs[_0xa6cf('0x46')](_['pick'](_0x53450e[_0xa6cf('0x45')],_0x350bfb['filters']));if(_0x53450e[_0xa6cf('0x45')][_0xa6cf('0x4e')]){_0x40adfb[_0xa6cf('0x4f')]=_[_0xa6cf('0x50')](_0x40adfb[_0xa6cf('0x4f')],{'$or':_['map'](_0x40adfb[_0xa6cf('0x48')],function(_0x3d35fd){var _0x11b5d7={};_0x11b5d7[_0x3d35fd]={'$like':'%'+_0x53450e[_0xa6cf('0x45')][_0xa6cf('0x4e')]+'%'};return _0x11b5d7;})});}_0x40adfb=_['merge']({},_0x40adfb,_0x53450e[_0xa6cf('0x67')]);return _0x2057fc[_0xa6cf('0xb8')](_0x40adfb);}})[_0xa6cf('0x1e')](function(_0x2a3c1a){if(_0x2a3c1a){_0x4faea7=_0x2a3c1a[_0xa6cf('0x4a')];if(!_0x53450e[_0xa6cf('0x45')]['hasOwnProperty'](_0xa6cf('0x4b'))){_0x40adfb[_0xa6cf('0x2f')]=qs[_0xa6cf('0x2f')](_0x53450e[_0xa6cf('0x45')][_0xa6cf('0x2f')]);_0x40adfb[_0xa6cf('0x2d')]=qs[_0xa6cf('0x2d')](_0x53450e[_0xa6cf('0x45')]['offset']);}return _0x2057fc[_0xa6cf('0xb8')](_0x40adfb);}})['then'](function(_0x2c052e){if(_0x2c052e){return _0x2c052e?{'count':_0x4faea7,'rows':_0x2c052e}:null;}})[_0xa6cf('0x1e')](respondWithResult(_0x21064a,null))['catch'](handleError(_0x21064a,null));};exports['send']=function(_0x36a1a8,_0x120fd1,_0x1a62ec){var _0x583c61,_0x36eba5,_0x196ca9;if(_[_0xa6cf('0x78')](_0x36a1a8[_0xa6cf('0x58')]['body'])||_0x36a1a8[_0xa6cf('0x58')][_0xa6cf('0x58')]===''){throw new db['Sequelize'][(_0xa6cf('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xa6cf('0x78')](_0x36a1a8['body']['to'])){}_0x583c61=_0x36a1a8[_0xa6cf('0x58')]['to'];return db[_0xa6cf('0x3e')][_0xa6cf('0x66')]({'where':{'id':_0x36a1a8[_0xa6cf('0x56')]['id']}})['then'](handleEntityNotFound(_0x120fd1,null))[_0xa6cf('0x1e')](function(_0x5f1d1a){if(_0x5f1d1a){return db[_0xa6cf('0x3e')][_0xa6cf('0x5d')]({'where':{'id':_0x5f1d1a['id']},'include':[{'model':db[_0xa6cf('0x7e')],'as':'List','include':[{'model':db[_0xa6cf('0x70')],'as':_0xa6cf('0x80'),'where':{[_0x5f1d1a['mapKey']]:_0x583c61},'limit':0x1,'order':[[_0xa6cf('0x75'),_0xa6cf('0xb9')]]}]}]})[_0xa6cf('0x1e')](handleEntityNotFound(_0x120fd1,null))[_0xa6cf('0x1e')](function(_0x37bbab){if(_0x37bbab&&_0x37bbab[_0xa6cf('0x7f')]){_0x36eba5=_0x37bbab['get']({'plain':!![]});if(_0x36eba5[_0xa6cf('0x7f')]&&_0x36eba5[_0xa6cf('0x7f')]['Contacts'][_0xa6cf('0x4a')]){return _0x36eba5['List'][_0xa6cf('0x80')][0x0];}return db[_0xa6cf('0x70')][_0xa6cf('0x57')](_[_0xa6cf('0x17')](_0x36a1a8['body'],{'firstName':_0x583c61,[_0x37bbab[_0xa6cf('0x7a')]]:_0x583c61,'phone':_0x583c61,'ListId':_0x36eba5[_0xa6cf('0x77')]}));}})[_0xa6cf('0x1e')](handleEntityNotFound(_0x120fd1,null))[_0xa6cf('0x1e')](function(_0x31729c){if(_0x31729c){_0x196ca9=_0x31729c;return db[_0xa6cf('0x8d')][_0xa6cf('0x5d')]({'where':{'ContactId':_0x196ca9['id'],'closed':![],'OpenchannelAccountId':_0x36eba5['id']}})[_0xa6cf('0x1e')](function(_0x53b4df){if(_0x53b4df){return[_0x53b4df,![]];}return db[_0xa6cf('0x8d')][_0xa6cf('0x57')]({'UserId':_0x36a1a8[_0xa6cf('0x59')]['id'],'ContactId':_0x196ca9['id'],'OpenchannelAccountId':_0x36eba5['id'],'lastMsgDirection':_0xa6cf('0xba'),'firstMsgDirection':'out','Messages':[_[_0xa6cf('0x50')](_0x36a1a8[_0xa6cf('0x58')],{'read':![],'body':_0x36a1a8[_0xa6cf('0x58')][_0xa6cf('0x58')],'OpenchannelAccountId':_0x36eba5['id'],'UserId':_0x36a1a8['user']['id'],'ContactId':_0x196ca9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xa6cf('0xbb')}]})[_0xa6cf('0x1e')](function(_0x10bfbf){return[_0x10bfbf,!![]];});});}})[_0xa6cf('0x8e')](function(_0x3572e3,_0x34aba3){if(_0x34aba3){return _0x3572e3;}return db[_0xa6cf('0xbc')][_0xa6cf('0x57')](_['merge'](_0x36a1a8[_0xa6cf('0x58')],{'read':![],'body':_0x36a1a8['body'][_0xa6cf('0x58')],'OpenchannelAccountId':_0x36eba5['id'],'OpenchannelInteractionId':_0x3572e3['id'],'UserId':_0x36a1a8[_0xa6cf('0x59')]['id'],'ContactId':_0x196ca9['id']}))['then'](function(_0x4f506a){_0x3572e3[_0xa6cf('0xbd')][_0xa6cf('0xbb')]=[];_0x3572e3['dataValues'][_0xa6cf('0xbb')][_0xa6cf('0x96')](_0x4f506a[_0xa6cf('0xbd')]);return _0x3572e3;});});}})['then'](respondWithResult(_0x120fd1,null))['catch'](handleError(_0x120fd1,null));}; \ No newline at end of file +var _0x5e8d=['CannedAnswer','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','OpenchannelApplication','account','applications','Applications','list','orderBy','priority','asc','from','contact','firstName','threadId','ContactId','OpenchannelInteraction','spread','lastName','messageId','update','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','UserId','User','unshift','queueId','OpenchannelQueue','queue','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','findOne','findAndCountAll','stack','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','userOpenchannelAccount:remove','getAgents','updatedAt','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','OpenchannelAccounts','UserProfileResource','name','send','index','Pause','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','describe','addDisposition','Disposition','nolimit','OpenchannelAccountId','map','include','findAll','removeDispositions','ids'];(function(_0x27bd2d,_0xabd403){var _0x235880=function(_0x53fd70){while(--_0x53fd70){_0x27bd2d['push'](_0x27bd2d['shift']());}};_0x235880(++_0xabd403);}(_0x5e8d,0x11a));var _0xd5e8=function(_0x440c72,_0xcc8033){_0x440c72=_0x440c72-0x0;var _0x10c665=_0x5e8d[_0x440c72];return _0x10c665;};'use strict';var emlformat=require(_0xd5e8('0x0'));var rimraf=require(_0xd5e8('0x1'));var zipdir=require(_0xd5e8('0x2'));var jsonpatch=require(_0xd5e8('0x3'));var rp=require(_0xd5e8('0x4'));var moment=require(_0xd5e8('0x5'));var BPromise=require(_0xd5e8('0x6'));var Mustache=require('mustache');var util=require(_0xd5e8('0x7'));var path=require(_0xd5e8('0x8'));var sox=require('sox');var csv=require(_0xd5e8('0x9'));var ejs=require(_0xd5e8('0xa'));var fs=require('fs');var fs_extra=require(_0xd5e8('0xb'));var _=require('lodash');var squel=require(_0xd5e8('0xc'));var crypto=require(_0xd5e8('0xd'));var jsforce=require(_0xd5e8('0xe'));var deskjs=require(_0xd5e8('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5e8('0x10'));var Redis=require(_0xd5e8('0x11'));var authService=require(_0xd5e8('0x12'));var qs=require(_0xd5e8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd5e8('0x14'));var logger=require(_0xd5e8('0x15'))('api');var utils=require(_0xd5e8('0x16'));var config=require(_0xd5e8('0x17'));var licenseUtil=require(_0xd5e8('0x18'));var db=require(_0xd5e8('0x19'))['db'];config[_0xd5e8('0x1a')]=_[_0xd5e8('0x1b')](config[_0xd5e8('0x1a')],{'host':_0xd5e8('0x1c'),'port':0x18eb});var socket=require(_0xd5e8('0x1d'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xd5e8('0x1e')](socket);var jayson=require(_0xd5e8('0x1f'));var client=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232c});var client9002=jayson[_0xd5e8('0x20')][_0xd5e8('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x489a8e,_0x2ef357,_0x18c61f,_0x282ce2){return new BPromise(function(_0x2dfd4a,_0x5dc327){var _0x3daf6a=_0x282ce2||client;return _0x3daf6a[_0xd5e8('0x22')](_0x489a8e,_0x18c61f)['then'](function(_0x4b89e9){logger[_0xd5e8('0x23')](_0xd5e8('0x24'),_0x2ef357,_0xd5e8('0x25'));logger[_0xd5e8('0x26')](_0xd5e8('0x27'),_0x2ef357,_0xd5e8('0x25'),JSON[_0xd5e8('0x28')](_0x4b89e9));if(_0x4b89e9['error']){if(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2a')]===0x1f4){logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x5dc327(_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);}logger[_0xd5e8('0x29')](_0xd5e8('0x24'),_0x2ef357,_0x4b89e9[_0xd5e8('0x29')][_0xd5e8('0x2b')]);return _0x2dfd4a(_0x4b89e9[_0xd5e8('0x29')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2ef357,'request\x20sent');_0x2dfd4a(_0x4b89e9[_0xd5e8('0x2c')]['message']);}})[_0xd5e8('0x2d')](function(_0x3b1a69){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2ef357,_0x3b1a69);_0x5dc327(_0x3b1a69);});});}function respondWithStatusCode(_0x29d415,_0xfaad96){_0xfaad96=_0xfaad96||0xcc;return function(_0x2e220b){if(_0x2e220b){return _0x29d415[_0xd5e8('0x2e')](_0xfaad96);}return _0x29d415[_0xd5e8('0x2f')](_0xfaad96)[_0xd5e8('0x30')]();};}function respondWithResult(_0x3cb0ea,_0x2b7244){_0x2b7244=_0x2b7244||0xc8;return function(_0x45bf59){if(_0x45bf59){return _0x3cb0ea['status'](_0x2b7244)[_0xd5e8('0x31')](_0x45bf59);}};}function respondWithFilteredResult(_0x570e6a,_0x2aa786){return function(_0x24f7e1){if(_0x24f7e1){var _0x38414b=typeof _0x2aa786[_0xd5e8('0x32')]===_0xd5e8('0x33')&&typeof _0x2aa786['limit']===_0xd5e8('0x33');var _0x3d2e7b=_0x24f7e1['count'];var _0x315955=_0x38414b?0x0:_0x2aa786['offset'];var _0x3980a1=_0x38414b?_0x24f7e1[_0xd5e8('0x34')]:_0x2aa786[_0xd5e8('0x32')]+_0x2aa786[_0xd5e8('0x35')];var _0x14d8c6;if(_0x3980a1>=_0x3d2e7b){_0x3980a1=_0x3d2e7b;_0x14d8c6=0xc8;}else{_0x14d8c6=0xce;}_0x570e6a[_0xd5e8('0x2f')](_0x14d8c6);return _0x570e6a[_0xd5e8('0x36')](_0xd5e8('0x37'),_0x315955+'-'+_0x3980a1+'/'+_0x3d2e7b)['json'](_0x24f7e1);}return null;};}function patchUpdates(_0x40ab71){return function(_0x3ff7f5){try{jsonpatch[_0xd5e8('0x38')](_0x3ff7f5,_0x40ab71,!![]);}catch(_0x22a9c1){return BPromise[_0xd5e8('0x39')](_0x22a9c1);}return _0x3ff7f5[_0xd5e8('0x3a')]();};}function saveUpdates(_0x3ee3bb,_0xde1d49){return function(_0x5c086d){if(_0x5c086d){return _0x5c086d['update'](_0x3ee3bb)['then'](function(_0x306593){return _0x306593;});}return null;};}function removeEntity(_0x3c4e8c,_0x429921){return function(_0x1508ee){if(_0x1508ee){return _0x1508ee[_0xd5e8('0x3b')]()[_0xd5e8('0x3c')](function(){var _0x1d2b4a=_0x1508ee['get']({'plain':!![]});var _0x56fb62=_0xd5e8('0x3d');return db[_0xd5e8('0x3e')][_0xd5e8('0x3b')]({'where':{'type':_0x56fb62,'resourceId':_0x1d2b4a['id']}})[_0xd5e8('0x3c')](function(){return _0x1508ee;});})[_0xd5e8('0x3c')](function(){_0x3c4e8c[_0xd5e8('0x2f')](0xcc)[_0xd5e8('0x30')]();});}};}function handleEntityNotFound(_0x461fa8,_0x61b42f){return function(_0x1b16a9){if(!_0x1b16a9){_0x461fa8[_0xd5e8('0x2e')](0x194);}return _0x1b16a9;};}function handleError(_0x55effa,_0x3a3d9b){_0x3a3d9b=_0x3a3d9b||0x1f4;return function(_0x569f00){logger[_0xd5e8('0x29')](_0x569f00['stack']);if(_0x569f00[_0xd5e8('0x3f')]){delete _0x569f00['name'];}_0x55effa[_0xd5e8('0x2f')](_0x3a3d9b)[_0xd5e8('0x40')](_0x569f00);};}exports[_0xd5e8('0x41')]=function(_0x64226a,_0x39655c){var _0x25c5f2={'include':[{'model':db[_0xd5e8('0x42')],'as':_0xd5e8('0x43')}]},_0x5bce02={},_0x5dbdf6={'count':0x0,'rows':[]};var _0x4dc9d3=_['map'](db[_0xd5e8('0x44')][_0xd5e8('0x45')],function(_0x56d256){return{'name':_0x56d256[_0xd5e8('0x46')],'type':_0x56d256[_0xd5e8('0x47')][_0xd5e8('0x48')]};});_0x5bce02['model']=_['map'](_0x4dc9d3,_0xd5e8('0x3f'));_0x5bce02[_0xd5e8('0x49')]=_['keys'](_0x64226a[_0xd5e8('0x49')]);_0x5bce02[_0xd5e8('0x4a')]=_[_0xd5e8('0x4b')](_0x5bce02[_0xd5e8('0x4c')],_0x5bce02[_0xd5e8('0x49')]);_0x25c5f2[_0xd5e8('0x4d')]=_['intersection'](_0x5bce02[_0xd5e8('0x4c')],qs[_0xd5e8('0x4e')](_0x64226a['query']['fields']));_0x25c5f2[_0xd5e8('0x4d')]=_0x25c5f2[_0xd5e8('0x4d')][_0xd5e8('0x4f')]?_0x25c5f2['attributes']:_0x5bce02['model'];if(!_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x50')]('nolimit')){_0x25c5f2[_0xd5e8('0x35')]=qs[_0xd5e8('0x35')](_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x35')]);_0x25c5f2[_0xd5e8('0x32')]=qs[_0xd5e8('0x32')](_0x64226a[_0xd5e8('0x49')]['offset']);}_0x25c5f2[_0xd5e8('0x51')]=qs[_0xd5e8('0x52')](_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x52')]);_0x25c5f2[_0xd5e8('0x53')]=qs[_0xd5e8('0x4a')](_[_0xd5e8('0x54')](_0x64226a[_0xd5e8('0x49')],_0x5bce02['filters']),_0x4dc9d3);if(_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x55')]){_0x25c5f2[_0xd5e8('0x53')]=_[_0xd5e8('0x56')](_0x25c5f2[_0xd5e8('0x53')],{'$or':_['map'](_0x4dc9d3,function(_0x34bdc8){if(_0x34bdc8[_0xd5e8('0x47')]!==_0xd5e8('0x57')){var _0x3e77ba={};_0x3e77ba[_0x34bdc8['name']]={'$like':'%'+_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x55')]+'%'};return _0x3e77ba;}})});}_0x25c5f2=_[_0xd5e8('0x56')]({},_0x25c5f2,_0x64226a['options']);var _0x58a40b={'where':_0x25c5f2['where']};return db['OpenchannelAccount'][_0xd5e8('0x34')](_0x58a40b)[_0xd5e8('0x3c')](function(_0x14c82e){_0x5dbdf6['count']=_0x14c82e;if(_0x64226a[_0xd5e8('0x49')][_0xd5e8('0x58')]){_0x25c5f2['include']=[{'all':!![]}];}return db['OpenchannelAccount']['findAll'](_0x25c5f2);})[_0xd5e8('0x3c')](function(_0x1c9926){_0x5dbdf6[_0xd5e8('0x59')]=_0x1c9926;return _0x5dbdf6;})[_0xd5e8('0x3c')](respondWithFilteredResult(_0x39655c,_0x25c5f2))['catch'](handleError(_0x39655c,null));};exports[_0xd5e8('0x5a')]=function(_0x340f40,_0x40c385){var _0xb070c7={'raw':![],'where':{'id':_0x340f40[_0xd5e8('0x5b')]['id']},'include':[{'model':db[_0xd5e8('0x42')],'as':'mandatoryDispositionPause'}]},_0x43aaf0={};_0x43aaf0[_0xd5e8('0x4c')]=_[_0xd5e8('0x5c')](db['OpenchannelAccount'][_0xd5e8('0x45')]);_0x43aaf0[_0xd5e8('0x49')]=_['keys'](_0x340f40[_0xd5e8('0x49')]);_0x43aaf0['filters']=_[_0xd5e8('0x4b')](_0x43aaf0[_0xd5e8('0x4c')],_0x43aaf0['query']);_0xb070c7['attributes']=_[_0xd5e8('0x4b')](_0x43aaf0[_0xd5e8('0x4c')],qs['fields'](_0x340f40[_0xd5e8('0x49')][_0xd5e8('0x4e')]));_0xb070c7['attributes']=_0xb070c7[_0xd5e8('0x4d')][_0xd5e8('0x4f')]?_0xb070c7[_0xd5e8('0x4d')]:_0x43aaf0[_0xd5e8('0x4c')];if(_0x340f40[_0xd5e8('0x49')]['includeAll']){_0xb070c7['include']=[{'all':!![]}];}_0xb070c7=_[_0xd5e8('0x56')]({},_0xb070c7,_0x340f40[_0xd5e8('0x5d')]);return db[_0xd5e8('0x44')][_0xd5e8('0x5e')](_0xb070c7)[_0xd5e8('0x3c')](handleEntityNotFound(_0x40c385,null))['then'](respondWithResult(_0x40c385,null))['catch'](handleError(_0x40c385,null));};exports[_0xd5e8('0x5f')]=function(_0x5ccc5b,_0x2adcb1){return db[_0xd5e8('0x44')][_0xd5e8('0x5f')](_0x5ccc5b[_0xd5e8('0x60')],{})['then'](function(_0x26b619){var _0x62fdeb=_0x5ccc5b[_0xd5e8('0x61')][_0xd5e8('0x62')]({'plain':!![]});if(!_0x62fdeb)throw new Error(_0xd5e8('0x63'));if(_0x62fdeb[_0xd5e8('0x64')]===_0xd5e8('0x61')){var _0x177cd6=_0x26b619[_0xd5e8('0x62')]({'plain':!![]});var _0x3a550d=_0xd5e8('0x3d');return db['UserProfileSection'][_0xd5e8('0x5e')]({'where':{'name':_0x3a550d,'userProfileId':_0x62fdeb[_0xd5e8('0x65')]},'raw':!![]})[_0xd5e8('0x3c')](function(_0x1cefd9){if(_0x1cefd9&&_0x1cefd9['autoAssociation']===0x0){return db[_0xd5e8('0x3e')]['create']({'name':_0x177cd6[_0xd5e8('0x3f')],'resourceId':_0x177cd6['id'],'type':_0x1cefd9[_0xd5e8('0x3f')],'sectionId':_0x1cefd9['id']},{})['then'](function(){return _0x26b619;});}else{return _0x26b619;}})['catch'](function(_0x4d98ac){logger[_0xd5e8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d98ac);throw _0x4d98ac;});}return _0x26b619;})[_0xd5e8('0x3c')](respondWithResult(_0x2adcb1,0xc9))[_0xd5e8('0x2d')](handleError(_0x2adcb1,null));};exports['update']=function(_0x4d4ff3,_0x53cab8){if(_0x4d4ff3[_0xd5e8('0x60')]['id']){delete _0x4d4ff3[_0xd5e8('0x60')]['id'];}return db[_0xd5e8('0x44')][_0xd5e8('0x5e')]({'where':{'id':_0x4d4ff3[_0xd5e8('0x5b')]['id']},'include':[{'model':db[_0xd5e8('0x42')],'as':_0xd5e8('0x43')}]})['then'](handleEntityNotFound(_0x53cab8,null))[_0xd5e8('0x3c')](saveUpdates(_0x4d4ff3[_0xd5e8('0x60')],null))[_0xd5e8('0x3c')](respondWithResult(_0x53cab8,null))[_0xd5e8('0x2d')](handleError(_0x53cab8,null));};exports[_0xd5e8('0x3b')]=function(_0x1932ab,_0x2103d1){return db['OpenchannelAccount'][_0xd5e8('0x5e')]({'where':{'id':_0x1932ab[_0xd5e8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x2103d1,null))[_0xd5e8('0x3c')](removeEntity(_0x2103d1,null))[_0xd5e8('0x2d')](handleError(_0x2103d1,null));};exports[_0xd5e8('0x66')]=function(_0x2754b4,_0x3297eb){return db[_0xd5e8('0x44')][_0xd5e8('0x66')]()['then'](respondWithResult(_0x3297eb,null))[_0xd5e8('0x2d')](handleError(_0x3297eb,null));};exports[_0xd5e8('0x67')]=function(_0x4b84c7,_0x5eb6b9,_0x2df841){if(_0x4b84c7[_0xd5e8('0x60')]['id']){delete _0x4b84c7[_0xd5e8('0x60')]['id'];}return db['OpenchannelAccount'][_0xd5e8('0x5e')]({'where':{'id':_0x4b84c7[_0xd5e8('0x5b')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x5eb6b9,null))[_0xd5e8('0x3c')](function(_0x4f11b4){if(_0x4f11b4){_0x4b84c7[_0xd5e8('0x60')]['OpenchannelAccountId']=_0x4f11b4['id'];return db[_0xd5e8('0x68')][_0xd5e8('0x5f')](_0x4b84c7[_0xd5e8('0x60')]);}})[_0xd5e8('0x3c')](respondWithResult(_0x5eb6b9,null))['catch'](handleError(_0x5eb6b9,null));};exports['getDispositions']=function(_0x3984ac,_0x2a5879,_0x1931e1){var _0x4b6eb7={'raw':![],'where':{}};var _0x651069={};var _0xea8dba={'count':0x0,'rows':[]};return db[_0xd5e8('0x44')]['findOne']({'where':{'id':_0x3984ac['params']['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x2a5879,null))['then'](function(_0x2ae27b){if(_0x2ae27b){_0x651069[_0xd5e8('0x4c')]=_[_0xd5e8('0x5c')](db[_0xd5e8('0x68')][_0xd5e8('0x45')]);_0x651069[_0xd5e8('0x49')]=_['keys'](_0x3984ac[_0xd5e8('0x49')]);_0x651069[_0xd5e8('0x4a')]=_['intersection'](_0x651069[_0xd5e8('0x4c')],_0x651069[_0xd5e8('0x49')]);_0x4b6eb7[_0xd5e8('0x4d')]=_[_0xd5e8('0x4b')](_0x651069[_0xd5e8('0x4c')],qs[_0xd5e8('0x4e')](_0x3984ac['query'][_0xd5e8('0x4e')]));_0x4b6eb7[_0xd5e8('0x4d')]=_0x4b6eb7[_0xd5e8('0x4d')][_0xd5e8('0x4f')]?_0x4b6eb7[_0xd5e8('0x4d')]:_0x651069[_0xd5e8('0x4c')];if(!_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x50')](_0xd5e8('0x69'))){_0x4b6eb7[_0xd5e8('0x35')]=qs[_0xd5e8('0x35')](_0x3984ac[_0xd5e8('0x49')]['limit']);_0x4b6eb7[_0xd5e8('0x32')]=qs[_0xd5e8('0x32')](_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x32')]);}_0x4b6eb7[_0xd5e8('0x51')]=qs[_0xd5e8('0x52')](_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x52')]);_0x4b6eb7[_0xd5e8('0x53')]=qs[_0xd5e8('0x4a')](_['pick'](_0x3984ac[_0xd5e8('0x49')],_0x651069['filters']));_0x4b6eb7[_0xd5e8('0x53')][_0xd5e8('0x6a')]=_0x2ae27b['id'];if(_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x55')]){_0x4b6eb7[_0xd5e8('0x53')]=_['merge'](_0x4b6eb7[_0xd5e8('0x53')],{'$or':_[_0xd5e8('0x6b')](_0x4b6eb7[_0xd5e8('0x4d')],function(_0x375a0e){var _0x352a7a={};_0x352a7a[_0x375a0e]={'$like':'%'+_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x55')]+'%'};return _0x352a7a;})});}_0x4b6eb7=_[_0xd5e8('0x56')]({},_0x4b6eb7,_0x3984ac[_0xd5e8('0x5d')]);return db[_0xd5e8('0x68')][_0xd5e8('0x34')]({'where':_0x4b6eb7[_0xd5e8('0x53')]})['then'](function(_0x1fea11){_0xea8dba[_0xd5e8('0x34')]=_0x1fea11;if(_0x3984ac[_0xd5e8('0x49')][_0xd5e8('0x58')]){_0x4b6eb7[_0xd5e8('0x6c')]=[{'all':!![]}];}return db[_0xd5e8('0x68')][_0xd5e8('0x6d')](_0x4b6eb7);})[_0xd5e8('0x3c')](function(_0x1731f4){_0xea8dba['rows']=_0x1731f4;return _0xea8dba;});}})[_0xd5e8('0x3c')](respondWithFilteredResult(_0x2a5879,_0x4b6eb7))[_0xd5e8('0x2d')](handleError(_0x2a5879,null));};exports['removeDispositions']=function(_0x1c5a92,_0x4f1bce,_0xf85ea4){return db[_0xd5e8('0x44')][_0xd5e8('0x5e')]({'where':{'id':_0x1c5a92['params']['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x4f1bce,null))['then'](function(_0x20b004){if(_0x20b004){return _0x20b004[_0xd5e8('0x6e')](_0x1c5a92[_0xd5e8('0x49')][_0xd5e8('0x6f')]);}})[_0xd5e8('0x3c')](respondWithStatusCode(_0x4f1bce,null))[_0xd5e8('0x2d')](handleError(_0x4f1bce,null));};exports['addAnswer']=function(_0x2d8b38,_0x4455e1,_0x41b734){if(_0x2d8b38[_0xd5e8('0x60')]['id']){delete _0x2d8b38[_0xd5e8('0x60')]['id'];}return db[_0xd5e8('0x44')]['find']({'where':{'id':_0x2d8b38[_0xd5e8('0x5b')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x4455e1,null))[_0xd5e8('0x3c')](function(_0x13c7ea){if(_0x13c7ea){_0x2d8b38[_0xd5e8('0x60')][_0xd5e8('0x6a')]=_0x13c7ea['id'];return db['CannedAnswer'][_0xd5e8('0x5f')](_0x2d8b38[_0xd5e8('0x60')]);}})[_0xd5e8('0x3c')](respondWithResult(_0x4455e1,null))[_0xd5e8('0x2d')](handleError(_0x4455e1,null));};exports['getAnswers']=function(_0x57ecc7,_0x5e6765,_0x598df2){var _0x2d21e0={'raw':![],'where':{}};var _0x25449f={};var _0x13279d={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x57ecc7[_0xd5e8('0x5b')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x5e6765,null))[_0xd5e8('0x3c')](function(_0x42920a){if(_0x42920a){_0x25449f[_0xd5e8('0x4c')]=_['keys'](db['CannedAnswer'][_0xd5e8('0x45')]);_0x25449f[_0xd5e8('0x49')]=_[_0xd5e8('0x5c')](_0x57ecc7[_0xd5e8('0x49')]);_0x25449f[_0xd5e8('0x4a')]=_[_0xd5e8('0x4b')](_0x25449f[_0xd5e8('0x4c')],_0x25449f[_0xd5e8('0x49')]);_0x2d21e0[_0xd5e8('0x4d')]=_[_0xd5e8('0x4b')](_0x25449f[_0xd5e8('0x4c')],qs[_0xd5e8('0x4e')](_0x57ecc7['query']['fields']));_0x2d21e0['attributes']=_0x2d21e0['attributes']['length']?_0x2d21e0[_0xd5e8('0x4d')]:_0x25449f[_0xd5e8('0x4c')];if(!_0x57ecc7[_0xd5e8('0x49')][_0xd5e8('0x50')]('nolimit')){_0x2d21e0[_0xd5e8('0x35')]=qs[_0xd5e8('0x35')](_0x57ecc7['query'][_0xd5e8('0x35')]);_0x2d21e0[_0xd5e8('0x32')]=qs[_0xd5e8('0x32')](_0x57ecc7[_0xd5e8('0x49')][_0xd5e8('0x32')]);}_0x2d21e0[_0xd5e8('0x51')]=qs[_0xd5e8('0x52')](_0x57ecc7['query'][_0xd5e8('0x52')]);_0x2d21e0[_0xd5e8('0x53')]=qs[_0xd5e8('0x4a')](_[_0xd5e8('0x54')](_0x57ecc7[_0xd5e8('0x49')],_0x25449f[_0xd5e8('0x4a')]));_0x2d21e0[_0xd5e8('0x53')][_0xd5e8('0x6a')]=_0x42920a['id'];if(_0x57ecc7[_0xd5e8('0x49')][_0xd5e8('0x55')]){_0x2d21e0['where']=_['merge'](_0x2d21e0['where'],{'$or':_[_0xd5e8('0x6b')](_0x2d21e0[_0xd5e8('0x4d')],function(_0x3d39e6){var _0x17371e={};_0x17371e[_0x3d39e6]={'$like':'%'+_0x57ecc7[_0xd5e8('0x49')][_0xd5e8('0x55')]+'%'};return _0x17371e;})});}_0x2d21e0=_['merge']({},_0x2d21e0,_0x57ecc7[_0xd5e8('0x5d')]);return db[_0xd5e8('0x70')][_0xd5e8('0x34')]({'where':_0x2d21e0[_0xd5e8('0x53')]})[_0xd5e8('0x3c')](function(_0x1bd305){_0x13279d[_0xd5e8('0x34')]=_0x1bd305;if(_0x57ecc7['query'][_0xd5e8('0x58')]){_0x2d21e0[_0xd5e8('0x6c')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x2d21e0);})[_0xd5e8('0x3c')](function(_0x54b7ff){_0x13279d[_0xd5e8('0x59')]=_0x54b7ff;return _0x13279d;});}})[_0xd5e8('0x3c')](respondWithFilteredResult(_0x5e6765,_0x2d21e0))[_0xd5e8('0x2d')](handleError(_0x5e6765,null));};exports[_0xd5e8('0x71')]=function(_0x55e48e,_0x8410c,_0x296370){return db[_0xd5e8('0x44')]['find']({'where':{'id':_0x55e48e[_0xd5e8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x8410c,null))[_0xd5e8('0x3c')](function(_0x5deb21){if(_0x5deb21){return _0x5deb21[_0xd5e8('0x71')](_0x55e48e['query']['ids']);}})[_0xd5e8('0x3c')](respondWithStatusCode(_0x8410c,null))[_0xd5e8('0x2d')](handleError(_0x8410c,null));};exports[_0xd5e8('0x72')]=function(_0x4f50f2,_0x1b6145,_0x2a9078){var _0x1627bf={'body':_0x4f50f2[_0xd5e8('0x60')],'channel':_0xd5e8('0x73')};var _0x557e3e=[];var _0xb929dc=[];var _0x1f3b22={};var _0x124a15=![];return db[_0xd5e8('0x74')][_0xd5e8('0x66')]()[_0xd5e8('0x3c')](function(_0x1b68cd){if(!_0x1b68cd){throw new db[(_0xd5e8('0x75'))][(_0xd5e8('0x76'))](_0xd5e8('0x77'));}_0x557e3e=_['difference'](_[_0xd5e8('0x5c')](_0x1b68cd),[_0xd5e8('0x78'),'updatedAt']);_0xb929dc=_[_0xd5e8('0x79')](_['keys'](_0x1b68cd),[_0xd5e8('0x78'),'updatedAt',_0xd5e8('0x7a'),_0xd5e8('0x7b')]);if(_0x4f50f2[_0xd5e8('0x60')]['id']){delete _0x4f50f2[_0xd5e8('0x60')]['id'];}if(_[_0xd5e8('0x7c')](_0x4f50f2[_0xd5e8('0x60')]['from'])){throw new db['Sequelize'][(_0xd5e8('0x76'))](_0xd5e8('0x7d'));}if(_[_0xd5e8('0x7c')](_0x4f50f2[_0xd5e8('0x60')]['body'])||_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x60')]===''){throw new db[(_0xd5e8('0x75'))]['ValidationError'](_0xd5e8('0x7e'));}if(_[_0xd5e8('0x7c')](_0x4f50f2['body'][_0xd5e8('0x7f')])){throw new db[(_0xd5e8('0x75'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xb929dc);}if(!_[_0xd5e8('0x80')](_0xb929dc,_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xd5e8('0x81')+_0xb929dc);}_0x1f3b22[_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x7f')]]=_0x4f50f2[_0xd5e8('0x60')]['from'];})['then'](function(){return db[_0xd5e8('0x44')]['find']({'where':{'id':_0x4f50f2['params']['id']},'include':[{'model':db[_0xd5e8('0x82')],'as':_0xd5e8('0x83'),'include':[{'model':db[_0xd5e8('0x74')],'as':_0xd5e8('0x84'),'where':_0x1f3b22,'limit':0x1,'order':[['updatedAt',_0xd5e8('0x85')]]}]},{'model':db[_0xd5e8('0x86')],'as':'Applications'}]});})[_0xd5e8('0x3c')](handleEntityNotFound(_0x1b6145,null))[_0xd5e8('0x3c')](function(_0x7f9f4b){if(_0x7f9f4b&&_0x7f9f4b[_0xd5e8('0x83')]){_0x1627bf[_0xd5e8('0x87')]=_0x7f9f4b;_0x1627bf[_0xd5e8('0x88')]=_0x7f9f4b[_0xd5e8('0x89')];_0x1627bf[_0xd5e8('0x8a')]=_0x7f9f4b[_0xd5e8('0x83')];_0x1627bf[_0xd5e8('0x88')]=_[_0xd5e8('0x8b')](_0x1627bf[_0xd5e8('0x88')],[_0xd5e8('0x8c')],[_0xd5e8('0x8d')]);if(_0x1627bf[_0xd5e8('0x87')][_0xd5e8('0x89')]){delete _0x1627bf[_0xd5e8('0x87')][_0xd5e8('0x89')];}if(_0x1627bf[_0xd5e8('0x87')][_0xd5e8('0x83')]&&_0x1627bf[_0xd5e8('0x87')]['List']['Contacts'][_0xd5e8('0x4f')]){return _0x1627bf[_0xd5e8('0x87')]['List'][_0xd5e8('0x84')][0x0];}var _0x263b86=_[_0xd5e8('0x1b')](_0x4f50f2[_0xd5e8('0x60')],{'firstName':_0x4f50f2[_0xd5e8('0x60')]['from'],'ListId':_0x7f9f4b[_0xd5e8('0x7b')]});_0x263b86[_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x7f')]]=_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x8e')];return db[_0xd5e8('0x74')]['create'](_0x263b86,{'fields':_0x557e3e,'raw':!![]});}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x1b6145,null))[_0xd5e8('0x3c')](function(_0x30715f){_0x1627bf[_0xd5e8('0x8f')]=_0x30715f;if(_0x30715f){var _0xd3767e={'ContactId':_0x30715f['id'],'OpenchannelAccountId':_0x4f50f2[_0xd5e8('0x5b')]['id'],'from':(_0x30715f[_0xd5e8('0x90')]||'')+'\x20'+(_0x30715f['lastName']||'')};var _0x745d57={'OpenchannelAccountId':_0x4f50f2[_0xd5e8('0x5b')]['id'],'closed':![]};if(_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x91')]){_0x745d57[_0xd5e8('0x91')]=_0x4f50f2[_0xd5e8('0x60')]['threadId'];return db['OpenchannelInteraction'][_0xd5e8('0x5e')]({'where':_0x745d57})['then'](function(_0x5e7b59){if(_0x5e7b59){return[_0x5e7b59,![]];}_0xd3767e['threadId']=_0x4f50f2['body'][_0xd5e8('0x91')];_0xd3767e['externalUrl']=_0x4f50f2[_0xd5e8('0x60')]['externalUrl'];return db['OpenchannelInteraction']['create'](_0xd3767e)[_0xd5e8('0x3c')](function(_0x1ad992){return[_0x1ad992,!![]];});});}else{_0x745d57[_0xd5e8('0x91')]=null;}_0x745d57[_0xd5e8('0x92')]=_0x30715f['id'];return db[_0xd5e8('0x93')][_0xd5e8('0x5e')]({'where':_0x745d57})[_0xd5e8('0x3c')](function(_0x3482f5){if(_0x3482f5){return[_0x3482f5,![]];}return db[_0xd5e8('0x93')][_0xd5e8('0x5f')](_0xd3767e)[_0xd5e8('0x3c')](function(_0x5f1b9b){return[_0x5f1b9b,!![]];});});}})[_0xd5e8('0x94')](function(_0x448037,_0x529d00){if(_0x448037){_0x124a15=_0x529d00;if(!_0x529d00){var _0x19457b={'from':(_0x1627bf[_0xd5e8('0x8f')][_0xd5e8('0x90')]||'')+'\x20'+(_0x1627bf[_0xd5e8('0x8f')][_0xd5e8('0x95')]||'')};if(_0x4f50f2['body']['threadId']&&_0x4f50f2[_0xd5e8('0x60')]['messageId']&&_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x91')]!=_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x96')]){_0x19457b['threadId']=_0x4f50f2['body'][_0xd5e8('0x96')];}return _0x448037[_0xd5e8('0x97')](_0x19457b);}else{return _0x448037;}}})[_0xd5e8('0x3c')](function(_0x3453b7){_0x1627bf[_0xd5e8('0x98')]=_0x3453b7['get']({'plain':!![]});_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0x99')]=_0x124a15;if(_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0x99')]){if(_0x1627bf[_0xd5e8('0x87')][_0xd5e8('0x9a')]){_0x1627bf[_0xd5e8('0x88')][_0xd5e8('0x9b')]({'id':0x0,'priority':_0x1627bf['applications'][_0xd5e8('0x4f')]+0x1,'app':_0xd5e8('0x9c'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xd5e8('0x9d')][_0xd5e8('0x5f')]({'body':_0x4f50f2[_0xd5e8('0x60')][_0xd5e8('0x60')],'OpenchannelAccountId':_0x4f50f2[_0xd5e8('0x5b')]['id'],'OpenchannelInteractionId':_0x3453b7['id'],'direction':'in','ContactId':_0x1627bf['contact']['id'],'AttachmentId':_0x4f50f2['body'][_0xd5e8('0x9e')]});})[_0xd5e8('0x3c')](function(_0xe3719b){_0x1627bf[_0xd5e8('0x2b')]=_0xe3719b;if(!_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0x9f')])return;return db[_0xd5e8('0xa0')][_0xd5e8('0x5e')]({'attributes':['id',_0xd5e8('0x3f')],'where':{'id':_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0x9f')]}});})[_0xd5e8('0x3c')](function(_0xecc0ec){if(_0xecc0ec){_0x1627bf[_0xd5e8('0x88')][_0xd5e8('0xa1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xecc0ec[_0xd5e8('0x3f')]+','+(_0x1627bf['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0xa2')])return;return db[_0xd5e8('0xa3')][_0xd5e8('0x5e')]({'attributes':['id','name'],'where':{'id':_0x1627bf[_0xd5e8('0x98')][_0xd5e8('0xa2')]}});})[_0xd5e8('0x3c')](function(_0x1062da){if(_0x1062da){_0x1627bf['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xd5e8('0xa4'),'appdata':_0x1062da[_0xd5e8('0x3f')]+','+(_0x1627bf[_0xd5e8('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0xd5e8('0xa5')});}return respondWithRpcPromise(_0xd5e8('0xa6'),_0xd5e8('0xa7'),_0x1627bf);})['then'](function(_0x257949){respondWithRpcPromise(_0xd5e8('0xa8'),_0xd5e8('0xa8'),{'event':'notify','message':_0x257949},client9002);return _0x257949;})[_0xd5e8('0x3c')](respondWithResult(_0x1b6145,null))['catch'](handleError(_0x1b6145,null));};exports[_0xd5e8('0xa9')]=function(_0x1821af,_0x52fd76){var _0x3742ef=_0x1821af[_0xd5e8('0x5b')]['id'];var _0x2e2326=_0x1821af[_0xd5e8('0x60')];var _0x2ff783=0xc8;var _0x5872e9=null;return db[_0xd5e8('0xaa')][_0xd5e8('0xab')]({'isolationLevel':db[_0xd5e8('0xaa')][_0xd5e8('0xac')]['ISOLATION_LEVELS'][_0xd5e8('0xad')]},function(_0x1dcc16){return db[_0xd5e8('0x44')][_0xd5e8('0xae')]({'where':{'id':_0x3742ef},'transaction':_0x1dcc16})[_0xd5e8('0x3c')](function(_0x4e93a2){if(_0x4e93a2){return db['OpenchannelApplication'][_0xd5e8('0x3b')]({'where':{'OpenchannelAccountId':_0x3742ef},'transaction':_0x1dcc16})['then'](function(){var _0xfaa413=_['map'](_0x2e2326,function(_0xa616ac){_0xa616ac['OpenchannelAccountId']=_0x3742ef;return _0xa616ac;});return db[_0xd5e8('0x86')]['bulkCreate'](_0xfaa413,{'transaction':_0x1dcc16});});}else{_0x2ff783=0x194;_0x5872e9=[];}});})['then'](function(){if(_0x2ff783!==0x194){return db['OpenchannelApplication'][_0xd5e8('0xaf')]({'where':{'OpenchannelAccountId':_0x3742ef},'order':_0xd5e8('0x8c')})['then'](function(_0x527ac2){_0x5872e9=_0x527ac2;});}})[_0xd5e8('0x2d')](function(_0x4f9d91){_0x2ff783=0x1f4;logger['error'](_0x4f9d91[_0xd5e8('0xb0')]);if(_0x4f9d91[_0xd5e8('0x3f')]){delete _0x4f9d91[_0xd5e8('0x3f')];}_0x5872e9=_0x4f9d91;})['finally'](function(){if(_0x5872e9===null){_0x52fd76['sendStatus'](_0x2ff783);}else{if(_0x2ff783===0x1f4){_0x52fd76[_0xd5e8('0x2f')](_0x2ff783)[_0xd5e8('0x40')](_0x5872e9);}else{_0x52fd76['status'](_0x2ff783)[_0xd5e8('0x31')](_0x5872e9);}}});};exports[_0xd5e8('0xb1')]=function(_0x3166ba,_0x7f2d8d,_0x154ce8){var _0x43dcd6={};var _0x5beded={};var _0x4c96a2;var _0x43e086;return db['OpenchannelAccount'][_0xd5e8('0xae')]({'where':{'id':_0x3166ba[_0xd5e8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x7f2d8d,null))[_0xd5e8('0x3c')](function(_0x15c9c6){if(_0x15c9c6){_0x4c96a2=_0x15c9c6;_0x5beded[_0xd5e8('0x4c')]=_['keys'](db[_0xd5e8('0x86')][_0xd5e8('0x45')]);_0x5beded[_0xd5e8('0x49')]=_[_0xd5e8('0x5c')](_0x3166ba[_0xd5e8('0x49')]);_0x5beded[_0xd5e8('0x4a')]=_[_0xd5e8('0x4b')](_0x5beded[_0xd5e8('0x4c')],_0x5beded['query']);_0x43dcd6['attributes']=_[_0xd5e8('0x4b')](_0x5beded['model'],qs['fields'](_0x3166ba[_0xd5e8('0x49')][_0xd5e8('0x4e')]));_0x43dcd6[_0xd5e8('0x4d')]=_0x43dcd6['attributes'][_0xd5e8('0x4f')]?_0x43dcd6[_0xd5e8('0x4d')]:_0x5beded[_0xd5e8('0x4c')];_0x43dcd6[_0xd5e8('0x51')]=qs[_0xd5e8('0x52')](_0x3166ba['query'][_0xd5e8('0x52')]);_0x43dcd6[_0xd5e8('0x53')]=qs[_0xd5e8('0x4a')](_['pick'](_0x3166ba[_0xd5e8('0x49')],_0x5beded[_0xd5e8('0x4a')]));if(_0x3166ba['query'][_0xd5e8('0x55')]){_0x43dcd6[_0xd5e8('0x53')]=_['merge'](_0x43dcd6['where'],{'$or':_[_0xd5e8('0x6b')](_0x43dcd6[_0xd5e8('0x4d')],function(_0xa0bd9e){var _0x4f924d={};_0x4f924d[_0xa0bd9e]={'$like':'%'+_0x3166ba[_0xd5e8('0x49')][_0xd5e8('0x55')]+'%'};return _0x4f924d;})});}_0x43dcd6=_['merge']({},_0x43dcd6,_0x3166ba['options']);return _0x4c96a2[_0xd5e8('0xb1')](_0x43dcd6);}})[_0xd5e8('0x3c')](function(_0x4a2361){if(_0x4a2361){_0x43e086=_0x4a2361[_0xd5e8('0x4f')];if(!_0x3166ba[_0xd5e8('0x49')]['hasOwnProperty'](_0xd5e8('0x69'))){_0x43dcd6[_0xd5e8('0x35')]=qs[_0xd5e8('0x35')](_0x3166ba[_0xd5e8('0x49')][_0xd5e8('0x35')]);_0x43dcd6['offset']=qs[_0xd5e8('0x32')](_0x3166ba['query'][_0xd5e8('0x32')]);}return _0x4c96a2['getApplications'](_0x43dcd6);}})['then'](function(_0x3e7a09){if(_0x3e7a09){return _0x3e7a09?{'count':_0x43e086,'rows':_0x3e7a09}:null;}})['then'](respondWithResult(_0x7f2d8d,null))['catch'](handleError(_0x7f2d8d,null));};exports[_0xd5e8('0xb2')]=function(_0x453693,_0xa2af8c,_0x2549ae){var _0x1489c7={'raw':![],'where':{}};var _0x1631eb={};var _0x588717={'count':0x0,'rows':[]};return db[_0xd5e8('0x44')]['findOne']({'where':{'id':_0x453693[_0xd5e8('0x5b')]['id']}})['then'](handleEntityNotFound(_0xa2af8c,null))['then'](function(_0x496396){if(_0x496396){_0x1631eb['model']=_[_0xd5e8('0x5c')](db[_0xd5e8('0x93')][_0xd5e8('0x45')]);_0x1631eb['query']=_[_0xd5e8('0x5c')](_0x453693[_0xd5e8('0x49')]);_0x1631eb[_0xd5e8('0x4a')]=_[_0xd5e8('0x4b')](_0x1631eb[_0xd5e8('0x4c')],_0x1631eb['query']);_0x1489c7[_0xd5e8('0x4d')]=_[_0xd5e8('0x4b')](_0x1631eb[_0xd5e8('0x4c')],qs['fields'](_0x453693[_0xd5e8('0x49')]['fields']));_0x1489c7['attributes']=_0x1489c7[_0xd5e8('0x4d')][_0xd5e8('0x4f')]?_0x1489c7[_0xd5e8('0x4d')]:_0x1631eb[_0xd5e8('0x4c')];if(!_0x453693[_0xd5e8('0x49')][_0xd5e8('0x50')](_0xd5e8('0x69'))){_0x1489c7['limit']=qs[_0xd5e8('0x35')](_0x453693[_0xd5e8('0x49')][_0xd5e8('0x35')]);_0x1489c7['offset']=qs[_0xd5e8('0x32')](_0x453693[_0xd5e8('0x49')]['offset']);}_0x1489c7['order']=qs[_0xd5e8('0x52')](_0x453693[_0xd5e8('0x49')][_0xd5e8('0x52')]);_0x1489c7[_0xd5e8('0x53')]=qs[_0xd5e8('0x4a')](_[_0xd5e8('0x54')](_0x453693[_0xd5e8('0x49')],_0x1631eb['filters']));_0x1489c7[_0xd5e8('0x53')][_0xd5e8('0x6a')]=_0x496396['id'];if(_0x453693[_0xd5e8('0x49')]['filter']){_0x1489c7['where']=_[_0xd5e8('0x56')](_0x1489c7[_0xd5e8('0x53')],{'$or':_[_0xd5e8('0x6b')](_0x1489c7[_0xd5e8('0x4d')],function(_0x322656){var _0x4844ce={};_0x4844ce[_0x322656]={'$like':'%'+_0x453693[_0xd5e8('0x49')][_0xd5e8('0x55')]+'%'};return _0x4844ce;})});}_0x1489c7=_['merge']({},_0x1489c7,_0x453693[_0xd5e8('0x5d')]);return db[_0xd5e8('0x93')][_0xd5e8('0x34')]({'where':_0x1489c7[_0xd5e8('0x53')]})[_0xd5e8('0x3c')](function(_0x56b7f8){_0x588717[_0xd5e8('0x34')]=_0x56b7f8;if(_0x453693['query']['includeAll']){_0x1489c7[_0xd5e8('0x6c')]=[{'model':db['CmContact'],'as':_0xd5e8('0xb3'),'required':![]},{'model':db[_0xd5e8('0xa0')],'as':_0xd5e8('0xb4'),'attributes':[_0xd5e8('0x3f'),_0xd5e8('0xb5'),_0xd5e8('0xb6')],'required':![]},{'model':db[_0xd5e8('0xb7')],'as':_0xd5e8('0xb8'),'attributes':['id',_0xd5e8('0x3f'),_0xd5e8('0xb9')],'where':_0x453693[_0xd5e8('0x49')][_0xd5e8('0xba')]?{'id':_0x453693[_0xd5e8('0x49')][_0xd5e8('0xba')]}:undefined,'required':_0x453693['query']['tag']?!![]:![]}];}return db[_0xd5e8('0x93')][_0xd5e8('0x6d')](_0x1489c7);})[_0xd5e8('0x3c')](function(_0x262d2f){_0x588717[_0xd5e8('0x59')]=_0x262d2f;return _0x588717;});}})[_0xd5e8('0x3c')](respondWithFilteredResult(_0xa2af8c,_0x1489c7))[_0xd5e8('0x2d')](handleError(_0xa2af8c,null));};exports[_0xd5e8('0xbb')]=function(_0x2ef18d,_0x584fc6,_0x49d289){return db[_0xd5e8('0x44')][_0xd5e8('0x5e')]({'where':{'id':_0x2ef18d['params']['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x584fc6,null))[_0xd5e8('0x3c')](function(_0x22fad4){if(_0x22fad4){return _0x22fad4[_0xd5e8('0xbb')](_0x2ef18d[_0xd5e8('0x60')]['ids'],_[_0xd5e8('0xbc')](_0x2ef18d[_0xd5e8('0x60')],[_0xd5e8('0x6f'),'id'])||{})[_0xd5e8('0x94')](function(_0x190419){for(var _0x29e69d=0x0;_0x29e69d<_0x2ef18d[_0xd5e8('0x60')]['ids']['length'];_0x29e69d+=0x1){socket[_0xd5e8('0xbd')]('userOpenchannelAccount:save',{'UserId':Number(_0x2ef18d['body'][_0xd5e8('0x6f')][_0x29e69d]),'OpenchannelAccountId':Number(_0x2ef18d['params']['id'])});}return _0x190419;});}})[_0xd5e8('0x3c')](respondWithResult(_0x584fc6,null))[_0xd5e8('0x2d')](handleError(_0x584fc6,null));};exports[_0xd5e8('0xbe')]=function(_0x4ae203,_0x485ba8,_0x30ad5c){return db[_0xd5e8('0x44')]['find']({'where':{'id':_0x4ae203['params']['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x485ba8,null))[_0xd5e8('0x3c')](function(_0xc61d0f){if(_0xc61d0f){return _0xc61d0f['removeAgents'](_0x4ae203[_0xd5e8('0x49')][_0xd5e8('0x6f')])['then'](function(){if(_['isArray'](_0x4ae203[_0xd5e8('0x49')][_0xd5e8('0x6f')])){for(var _0x319654=0x0;_0x319654<_0x4ae203[_0xd5e8('0x49')][_0xd5e8('0x6f')][_0xd5e8('0x4f')];_0x319654+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x4ae203[_0xd5e8('0x49')][_0xd5e8('0x6f')][_0x319654]),'OpenchannelAccountId':Number(_0x4ae203[_0xd5e8('0x5b')]['id'])});}}else{socket['emit'](_0xd5e8('0xbf'),{'UserId':Number(_0x4ae203[_0xd5e8('0x49')][_0xd5e8('0x6f')]),'OpenchannelAccountId':Number(_0x4ae203['params']['id'])});}});}})['then'](respondWithStatusCode(_0x485ba8,null))[_0xd5e8('0x2d')](handleError(_0x485ba8,null));};exports['getAgents']=function(_0x4bd51f,_0x4dc5de,_0x41f664){var _0x244d7={};var _0x5a7d85={};var _0x34beeb;var _0x315747;return db[_0xd5e8('0x44')][_0xd5e8('0xae')]({'where':{'id':_0x4bd51f[_0xd5e8('0x5b')]['id']}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x4dc5de,null))['then'](function(_0x265f46){if(_0x265f46){_0x34beeb=_0x265f46;_0x5a7d85[_0xd5e8('0x4c')]=_[_0xd5e8('0x5c')](db[_0xd5e8('0xa0')][_0xd5e8('0x45')]);_0x5a7d85[_0xd5e8('0x49')]=_[_0xd5e8('0x5c')](_0x4bd51f[_0xd5e8('0x49')]);_0x5a7d85['filters']=_[_0xd5e8('0x4b')](_0x5a7d85[_0xd5e8('0x4c')],_0x5a7d85['query']);_0x244d7[_0xd5e8('0x4d')]=_['intersection'](_0x5a7d85[_0xd5e8('0x4c')],qs[_0xd5e8('0x4e')](_0x4bd51f[_0xd5e8('0x49')][_0xd5e8('0x4e')]));_0x244d7['attributes']=_0x244d7[_0xd5e8('0x4d')][_0xd5e8('0x4f')]?_0x244d7['attributes']:_0x5a7d85[_0xd5e8('0x4c')];_0x244d7[_0xd5e8('0x51')]=qs[_0xd5e8('0x52')](_0x4bd51f[_0xd5e8('0x49')][_0xd5e8('0x52')]);_0x244d7['where']=qs['filters'](_[_0xd5e8('0x54')](_0x4bd51f[_0xd5e8('0x49')],_0x5a7d85[_0xd5e8('0x4a')]));if(_0x4bd51f[_0xd5e8('0x49')][_0xd5e8('0x55')]){_0x244d7['where']=_[_0xd5e8('0x56')](_0x244d7[_0xd5e8('0x53')],{'$or':_[_0xd5e8('0x6b')](_0x244d7[_0xd5e8('0x4d')],function(_0x3239f4){var _0x26f1fe={};_0x26f1fe[_0x3239f4]={'$like':'%'+_0x4bd51f['query']['filter']+'%'};return _0x26f1fe;})});}_0x244d7=_[_0xd5e8('0x56')]({},_0x244d7,_0x4bd51f[_0xd5e8('0x5d')]);return _0x34beeb[_0xd5e8('0xc0')](_0x244d7);}})[_0xd5e8('0x3c')](function(_0x35d180){if(_0x35d180){_0x315747=_0x35d180[_0xd5e8('0x4f')];if(!_0x4bd51f[_0xd5e8('0x49')][_0xd5e8('0x50')](_0xd5e8('0x69'))){_0x244d7[_0xd5e8('0x35')]=qs[_0xd5e8('0x35')](_0x4bd51f['query'][_0xd5e8('0x35')]);_0x244d7[_0xd5e8('0x32')]=qs['offset'](_0x4bd51f[_0xd5e8('0x49')]['offset']);}return _0x34beeb[_0xd5e8('0xc0')](_0x244d7);}})['then'](function(_0x2d81ce){if(_0x2d81ce){return _0x2d81ce?{'count':_0x315747,'rows':_0x2d81ce}:null;}})[_0xd5e8('0x3c')](respondWithResult(_0x4dc5de,null))['catch'](handleError(_0x4dc5de,null));};exports['send']=function(_0x127224,_0x3faca5,_0x173491){var _0x1bb9c2,_0x47ba20,_0x49dc53;if(_[_0xd5e8('0x7c')](_0x127224[_0xd5e8('0x60')][_0xd5e8('0x60')])||_0x127224['body']['body']===''){throw new db[(_0xd5e8('0x75'))][(_0xd5e8('0x76'))](_0xd5e8('0x7e'));}if(_[_0xd5e8('0x7c')](_0x127224[_0xd5e8('0x60')]['to'])){}_0x1bb9c2=_0x127224[_0xd5e8('0x60')]['to'];return db[_0xd5e8('0x44')][_0xd5e8('0xae')]({'where':{'id':_0x127224[_0xd5e8('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3faca5,null))[_0xd5e8('0x3c')](function(_0x506c07){if(_0x506c07){return db['OpenchannelAccount'][_0xd5e8('0x5e')]({'where':{'id':_0x506c07['id']},'include':[{'model':db['CmList'],'as':_0xd5e8('0x83'),'include':[{'model':db[_0xd5e8('0x74')],'as':_0xd5e8('0x84'),'where':{[_0x506c07[_0xd5e8('0x7f')]]:_0x1bb9c2},'limit':0x1,'order':[[_0xd5e8('0xc1'),_0xd5e8('0x85')]]}]}]})[_0xd5e8('0x3c')](handleEntityNotFound(_0x3faca5,null))[_0xd5e8('0x3c')](function(_0x54bca6){if(_0x54bca6&&_0x54bca6[_0xd5e8('0x83')]){_0x47ba20=_0x54bca6['get']({'plain':!![]});if(_0x47ba20[_0xd5e8('0x83')]&&_0x47ba20['List'][_0xd5e8('0x84')][_0xd5e8('0x4f')]){return _0x47ba20[_0xd5e8('0x83')]['Contacts'][0x0];}return db[_0xd5e8('0x74')][_0xd5e8('0x5f')](_[_0xd5e8('0x1b')](_0x127224[_0xd5e8('0x60')],{'firstName':_0x1bb9c2,[_0x54bca6[_0xd5e8('0x7f')]]:_0x1bb9c2,'phone':_0x1bb9c2,'ListId':_0x47ba20['ListId']}));}})[_0xd5e8('0x3c')](handleEntityNotFound(_0x3faca5,null))[_0xd5e8('0x3c')](function(_0x3c2849){if(_0x3c2849){_0x49dc53=_0x3c2849;return db[_0xd5e8('0x93')][_0xd5e8('0x5e')]({'where':{'ContactId':_0x49dc53['id'],'closed':![],'OpenchannelAccountId':_0x47ba20['id']}})[_0xd5e8('0x3c')](function(_0x4b8934){if(_0x4b8934){return[_0x4b8934,![]];}return db[_0xd5e8('0x93')][_0xd5e8('0x5f')]({'UserId':_0x127224[_0xd5e8('0x61')]['id'],'ContactId':_0x49dc53['id'],'OpenchannelAccountId':_0x47ba20['id'],'lastMsgDirection':'out','firstMsgDirection':_0xd5e8('0xc2'),'Messages':[_[_0xd5e8('0x56')](_0x127224[_0xd5e8('0x60')],{'read':![],'body':_0x127224[_0xd5e8('0x60')][_0xd5e8('0x60')],'OpenchannelAccountId':_0x47ba20['id'],'UserId':_0x127224[_0xd5e8('0x61')]['id'],'ContactId':_0x49dc53['id']})]},{'include':[{'model':db[_0xd5e8('0x9d')],'as':_0xd5e8('0xc3')}]})[_0xd5e8('0x3c')](function(_0x401064){return[_0x401064,!![]];});});}})[_0xd5e8('0x94')](function(_0x4b34cc,_0x319b0c){if(_0x319b0c){return _0x4b34cc;}return db[_0xd5e8('0x9d')]['create'](_['merge'](_0x127224[_0xd5e8('0x60')],{'read':![],'body':_0x127224[_0xd5e8('0x60')][_0xd5e8('0x60')],'OpenchannelAccountId':_0x47ba20['id'],'OpenchannelInteractionId':_0x4b34cc['id'],'UserId':_0x127224[_0xd5e8('0x61')]['id'],'ContactId':_0x49dc53['id']}))[_0xd5e8('0x3c')](function(_0x160ba6){_0x4b34cc['dataValues'][_0xd5e8('0xc3')]=[];_0x4b34cc[_0xd5e8('0xc4')]['Messages']['push'](_0x160ba6[_0xd5e8('0xc4')]);return _0x4b34cc;});});}})['then'](respondWithResult(_0x3faca5,null))[_0xd5e8('0x2d')](handleError(_0x3faca5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e610822..244624d 100644 --- a/server/api/openchannelAccount/openchannelAccount.events.js +++ b/server/api/openchannelAccount/openchannelAccount.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['remove','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount','save','update'];(function(_0x3fb4ef,_0x154913){var _0x53109b=function(_0x4909ce){while(--_0x4909ce){_0x3fb4ef['push'](_0x3fb4ef['shift']());}};_0x53109b(++_0x154913);}(_0x54ef,0x112));var _0xf54e=function(_0x3b5d15,_0x30f6cf){_0x3b5d15=_0x3b5d15-0x0;var _0x1df9af=_0x54ef[_0x3b5d15];return _0x1df9af;};'use strict';var EventEmitter=require(_0xf54e('0x0'));var OpenchannelAccount=require(_0xf54e('0x1'))['db'][_0xf54e('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf54e('0x3'),'afterUpdate':_0xf54e('0x4'),'afterDestroy':_0xf54e('0x5')};function emitEvent(_0x42b9b2){return function(_0x8b6bb6,_0x431e36,_0x12d43f){OpenchannelAccountEvents['emit'](_0x42b9b2+':'+_0x8b6bb6['id'],_0x8b6bb6);OpenchannelAccountEvents['emit'](_0x42b9b2,_0x8b6bb6);_0x12d43f(null);};}for(var e in events){if(events[_0xf54e('0x6')](e)){var event=events[e];OpenchannelAccount[_0xf54e('0x7')](e,emitEvent(event));}}module[_0xf54e('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x8993e,_0x308400){var _0x492d64=function(_0x135c98){while(--_0x135c98){_0x8993e['push'](_0x8993e['shift']());}};_0x492d64(++_0x308400);}(_0x9348,0x10d));var _0x8934=function(_0x2bb51e,_0x2e6325){_0x2bb51e=_0x2bb51e-0x0;var _0x5b86fb=_0x9348[_0x2bb51e];return _0x5b86fb;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index b3bd8ad..09d82e4 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(_0x44d0e0,_0x495fb9){var _0x25bd73=function(_0x231e84){while(--_0x231e84){_0x44d0e0['push'](_0x44d0e0['shift']());}};_0x25bd73(++_0x495fb9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x4920b2,_0x22626e){var _0x219729=function(_0x32713d){while(--_0x32713d){_0x4920b2['push'](_0x4920b2['shift']());}};_0x219729(++_0x22626e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index e33cdeb..846127c 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 _0x2b65=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2b65,0x131));var _0x52b6=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0x2b65[_0x483ab9];return _0x35043b;};'use strict';var _=require(_0x52b6('0x0'));var util=require(_0x52b6('0x1'));var moment=require(_0x52b6('0x2'));var BPromise=require(_0x52b6('0x3'));var rs=require(_0x52b6('0x4'));var fs=require('fs');var Redis=require(_0x52b6('0x5'));var db=require(_0x52b6('0x6'))['db'];var utils=require(_0x52b6('0x7'));var logger=require('../../config/logger')(_0x52b6('0x8'));var config=require(_0x52b6('0x9'));var jayson=require(_0x52b6('0xa'));var client=jayson[_0x52b6('0xb')][_0x52b6('0xc')]({'port':0x232a});config[_0x52b6('0xd')]=_[_0x52b6('0xe')](config[_0x52b6('0xd')],{'host':_0x52b6('0xf'),'port':0x18eb});var socket=require(_0x52b6('0x10'))(new Redis(config['redis']));require(_0x52b6('0x11'))[_0x52b6('0x12')](socket);function respondWithRpcPromise(_0x18b34d,_0x4d6d94,_0x19d1d9){return new BPromise(function(_0x2bb857,_0x19f475){return client[_0x52b6('0x13')](_0x18b34d,_0x19d1d9)['then'](function(_0xf91209){logger[_0x52b6('0x14')](_0x52b6('0x15'),_0x4d6d94,'request\x20sent');logger[_0x52b6('0x16')](_0x52b6('0x17'),_0x4d6d94,'request\x20sent',JSON[_0x52b6('0x18')](_0xf91209));if(_0xf91209['error']){if(_0xf91209['error'][_0x52b6('0x19')]===0x1f4){logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x19f475(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}logger[_0x52b6('0x1a')](_0x52b6('0x15'),_0x4d6d94,_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);return _0x2bb857(_0xf91209[_0x52b6('0x1a')][_0x52b6('0x1b')]);}else{logger['info'](_0x52b6('0x15'),_0x4d6d94,_0x52b6('0x1c'));_0x2bb857(_0xf91209[_0x52b6('0x1d')]['message']);}})[_0x52b6('0x1e')](function(_0x184ee8){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x4d6d94,_0x184ee8);_0x19f475(_0x184ee8);});});} \ No newline at end of file +var _0x74f0=['message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x283fa6,_0x53c458){var _0x1f7f8e=function(_0xe0add6){while(--_0xe0add6){_0x283fa6['push'](_0x283fa6['shift']());}};_0x1f7f8e(++_0x53c458);}(_0x74f0,0xf3));var _0x074f=function(_0x450076,_0x10983b){_0x450076=_0x450076-0x0;var _0x2029cc=_0x74f0[_0x450076];return _0x2029cc;};'use strict';var _=require('lodash');var util=require(_0x074f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x074f('0x1'));var fs=require('fs');var Redis=require(_0x074f('0x2'));var db=require(_0x074f('0x3'))['db'];var utils=require(_0x074f('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x074f('0x5'));var jayson=require(_0x074f('0x6'));var client=jayson[_0x074f('0x7')][_0x074f('0x8')]({'port':0x232a});config[_0x074f('0x9')]=_[_0x074f('0xa')](config[_0x074f('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x074f('0xb'))(new Redis(config[_0x074f('0x9')]));require('./openchannelAccount.socket')[_0x074f('0xc')](socket);function respondWithRpcPromise(_0x1a778a,_0x4337f9,_0x33d8c4){return new BPromise(function(_0x40179d,_0x4f37e1){return client['request'](_0x1a778a,_0x33d8c4)[_0x074f('0xd')](function(_0x41646d){logger[_0x074f('0xe')](_0x074f('0xf'),_0x4337f9,_0x074f('0x10'));logger[_0x074f('0x11')](_0x074f('0x12'),_0x4337f9,_0x074f('0x10'),JSON[_0x074f('0x13')](_0x41646d));if(_0x41646d['error']){if(_0x41646d[_0x074f('0x14')]['code']===0x1f4){logger[_0x074f('0x14')](_0x074f('0xf'),_0x4337f9,_0x41646d[_0x074f('0x14')][_0x074f('0x15')]);return _0x4f37e1(_0x41646d[_0x074f('0x14')][_0x074f('0x15')]);}logger[_0x074f('0x14')](_0x074f('0xf'),_0x4337f9,_0x41646d[_0x074f('0x14')][_0x074f('0x15')]);return _0x40179d(_0x41646d[_0x074f('0x14')]['message']);}else{logger[_0x074f('0xe')](_0x074f('0xf'),_0x4337f9,_0x074f('0x10'));_0x40179d(_0x41646d[_0x074f('0x16')][_0x074f('0x15')]);}})[_0x074f('0x17')](function(_0x548aab){logger['error'](_0x074f('0xf'),_0x4337f9,_0x548aab);_0x4f37e1(_0x548aab);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index e12b297..6e35069 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 _0x151b=['removeListener','register','length','./openchannelAccount.events','update','emit'];(function(_0x3794ca,_0x1fe4d3){var _0x63179b=function(_0x14ba68){while(--_0x14ba68){_0x3794ca['push'](_0x3794ca['shift']());}};_0x63179b(++_0x1fe4d3);}(_0x151b,0x153));var _0xb151=function(_0x3d596f,_0x5cbc5e){_0x3d596f=_0x3d596f-0x0;var _0x50224b=_0x151b[_0x3d596f];return _0x50224b;};'use strict';var OpenchannelAccountEvents=require(_0xb151('0x0'));var events=['save','remove',_0xb151('0x1')];function createListener(_0x53e601,_0x463ad0){return function(_0x2098a4){_0x463ad0[_0xb151('0x2')](_0x53e601,_0x2098a4);};}function removeListener(_0x486d88,_0x4a9d3f){return function(){OpenchannelAccountEvents[_0xb151('0x3')](_0x486d88,_0x4a9d3f);};}exports[_0xb151('0x4')]=function(_0x56b93e){for(var _0x3ef028=0x0,_0x4ba994=events[_0xb151('0x5')];_0x3ef028<_0x4ba994;_0x3ef028++){var _0x352713=events[_0x3ef028];var _0x46fdb0=createListener('openchannelAccount:'+_0x352713,_0x56b93e);OpenchannelAccountEvents['on'](_0x352713,_0x46fdb0);}}; \ No newline at end of file +var _0xc788=['./openchannelAccount.events','save','remove','emit','register','length','openchannelAccount:'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0xc788,0xc4));var _0x8c78=function(_0xce06d0,_0xe944b9){_0xce06d0=_0xce06d0-0x0;var _0x360347=_0xc788[_0xce06d0];return _0x360347;};'use strict';var OpenchannelAccountEvents=require(_0x8c78('0x0'));var events=[_0x8c78('0x1'),_0x8c78('0x2'),'update'];function createListener(_0x4ce125,_0x1c7ff3){return function(_0x1af8e2){_0x1c7ff3[_0x8c78('0x3')](_0x4ce125,_0x1af8e2);};}function removeListener(_0x1d0670,_0x386f0a){return function(){OpenchannelAccountEvents['removeListener'](_0x1d0670,_0x386f0a);};}exports[_0x8c78('0x4')]=function(_0x4555da){for(var _0x329152=0x0,_0x1ac27f=events[_0x8c78('0x5')];_0x329152<_0x1ac27f;_0x329152++){var _0x4d54a5=events[_0x329152];var _0x247188=createListener(_0x8c78('0x6')+_0x4d54a5,_0x4555da);OpenchannelAccountEvents['on'](_0x4d54a5,_0x247188);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c3c53f7..6623563 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 _0xf6aa=['Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5a7f07,_0x5ec20f){var _0x1ff70e=function(_0x1a4b50){while(--_0x1a4b50){_0x5a7f07['push'](_0x5a7f07['shift']());}};_0x1ff70e(++_0x5ec20f);}(_0xf6aa,0xc4));var _0xaf6a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xf6aa[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xaf6a('0x0'));var util=require(_0xaf6a('0x1'));var path=require(_0xaf6a('0x2'));var timeout=require(_0xaf6a('0x3'));var express=require('express');var router=express[_0xaf6a('0x4')]();var fs_extra=require(_0xaf6a('0x5'));var auth=require(_0xaf6a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xaf6a('0x7'));var controller=require(_0xaf6a('0x8'));router['get']('/',auth[_0xaf6a('0x9')](),controller[_0xaf6a('0xa')]);router[_0xaf6a('0xb')](_0xaf6a('0xc'),auth['isAuthenticated'](),controller[_0xaf6a('0xd')]);router[_0xaf6a('0xe')]('/',auth[_0xaf6a('0x9')](),controller[_0xaf6a('0xf')]);router['put'](_0xaf6a('0xc'),auth[_0xaf6a('0x9')](),controller[_0xaf6a('0x10')]);router[_0xaf6a('0x11')](_0xaf6a('0xc'),auth[_0xaf6a('0x9')](),controller[_0xaf6a('0x12')]);module[_0xaf6a('0x13')]=router; \ No newline at end of file +var _0xdade=['index','show','post','create','put','/:id','update','delete','destroy','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated'];(function(_0x2ed678,_0x46ad57){var _0x110e43=function(_0x28cd55){while(--_0x28cd55){_0x2ed678['push'](_0x2ed678['shift']());}};_0x110e43(++_0x46ad57);}(_0xdade,0x99));var _0xedad=function(_0x593f03,_0x4af84a){_0x593f03=_0x593f03-0x0;var _0x178299=_0xdade[_0x593f03];return _0x178299;};'use strict';var multer=require('multer');var util=require(_0xedad('0x0'));var path=require(_0xedad('0x1'));var timeout=require(_0xedad('0x2'));var express=require('express');var router=express[_0xedad('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xedad('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xedad('0x5'));var controller=require(_0xedad('0x6'));router[_0xedad('0x7')]('/',auth[_0xedad('0x8')](),controller[_0xedad('0x9')]);router[_0xedad('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xedad('0xa')]);router[_0xedad('0xb')]('/',auth[_0xedad('0x8')](),controller[_0xedad('0xc')]);router[_0xedad('0xd')](_0xedad('0xe'),auth['isAuthenticated'](),controller[_0xedad('0xf')]);router[_0xedad('0x10')](_0xedad('0xe'),auth[_0xedad('0x8')](),controller[_0xedad('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 09a43bf..88abdd4 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 _0x38db=['TEXT','*,*,*,*','sequelize','exports','STRING'];(function(_0x199cd0,_0x42f22d){var _0xa2fe98=function(_0x3b3d61){while(--_0x3b3d61){_0x199cd0['push'](_0x199cd0['shift']());}};_0xa2fe98(++_0x42f22d);}(_0x38db,0x179));var _0xb38d=function(_0x4bfa4d,_0x1b0764){_0x4bfa4d=_0x4bfa4d-0x0;var _0x205a32=_0x38db[_0x4bfa4d];return _0x205a32;};'use strict';var Sequelize=require(_0xb38d('0x0'));module[_0xb38d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xb38d('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb38d('0x3')]()},'description':{'type':Sequelize[_0xb38d('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb38d('0x4')}}; \ No newline at end of file +var _0xfda4=['exports','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x4dd943,_0x5f379e){var _0x4e06ee=function(_0x2c1747){while(--_0x2c1747){_0x4dd943['push'](_0x4dd943['shift']());}};_0x4e06ee(++_0x5f379e);}(_0xfda4,0x18c));var _0x4fda=function(_0x56a226,_0x2fb531){_0x56a226=_0x56a226-0x0;var _0x15fcfe=_0xfda4[_0x56a226];return _0x15fcfe;};'use strict';var Sequelize=require('sequelize');module[_0x4fda('0x0')]={'priority':{'type':Sequelize[_0x4fda('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4fda('0x2')},'appdata':{'type':Sequelize[_0x4fda('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4fda('0x4')],'defaultValue':_0x4fda('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 9ea646d..2ae1e05 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 _0x316b=['pick','filter','merge','options','includeAll','include','rows','catch','show','params','length','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where'];(function(_0xc7d07d,_0x2f3434){var _0x5c6e56=function(_0x2b598e){while(--_0x2b598e){_0xc7d07d['push'](_0xc7d07d['shift']());}};_0x5c6e56(++_0x2f3434);}(_0x316b,0xa4));var _0xb316=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x316b[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require(_0xb316('0x0'));var rimraf=require(_0xb316('0x1'));var zipdir=require(_0xb316('0x2'));var jsonpatch=require(_0xb316('0x3'));var rp=require(_0xb316('0x4'));var moment=require(_0xb316('0x5'));var BPromise=require(_0xb316('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb316('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb316('0x8'));var fs=require('fs');var fs_extra=require(_0xb316('0x9'));var _=require(_0xb316('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb316('0xb'));var toCsv=require(_0xb316('0xc'));var querystring=require('querystring');var Papa=require(_0xb316('0xd'));var Redis=require(_0xb316('0xe'));var authService=require(_0xb316('0xf'));var qs=require(_0xb316('0x10'));var as=require(_0xb316('0x11'));var hardwareService=require(_0xb316('0x12'));var logger=require(_0xb316('0x13'))('api');var utils=require(_0xb316('0x14'));var config=require(_0xb316('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xb316('0x16'))['db'];function respondWithStatusCode(_0x36f29f,_0x373b23){_0x373b23=_0x373b23||0xcc;return function(_0x56b2b0){if(_0x56b2b0){return _0x36f29f['sendStatus'](_0x373b23);}return _0x36f29f[_0xb316('0x17')](_0x373b23)[_0xb316('0x18')]();};}function respondWithResult(_0x25cd0b,_0x49db41){_0x49db41=_0x49db41||0xc8;return function(_0x5e4bf3){if(_0x5e4bf3){return _0x25cd0b[_0xb316('0x17')](_0x49db41)[_0xb316('0x19')](_0x5e4bf3);}};}function respondWithFilteredResult(_0x5bad72,_0x3327ae){return function(_0xea07bb){if(_0xea07bb){var _0x416068=typeof _0x3327ae[_0xb316('0x1a')]==='undefined'&&typeof _0x3327ae[_0xb316('0x1b')]===_0xb316('0x1c');var _0x4f4bb1=_0xea07bb[_0xb316('0x1d')];var _0x45cc76=_0x416068?0x0:_0x3327ae[_0xb316('0x1a')];var _0x34930f=_0x416068?_0xea07bb[_0xb316('0x1d')]:_0x3327ae['offset']+_0x3327ae[_0xb316('0x1b')];var _0x445bc6;if(_0x34930f>=_0x4f4bb1){_0x34930f=_0x4f4bb1;_0x445bc6=0xc8;}else{_0x445bc6=0xce;}_0x5bad72[_0xb316('0x17')](_0x445bc6);return _0x5bad72[_0xb316('0x1e')](_0xb316('0x1f'),_0x45cc76+'-'+_0x34930f+'/'+_0x4f4bb1)[_0xb316('0x19')](_0xea07bb);}return null;};}function patchUpdates(_0x26367b){return function(_0x1ddc06){try{jsonpatch[_0xb316('0x20')](_0x1ddc06,_0x26367b,!![]);}catch(_0x4043ba){return BPromise[_0xb316('0x21')](_0x4043ba);}return _0x1ddc06[_0xb316('0x22')]();};}function saveUpdates(_0x934dce,_0x5e6716){return function(_0x3cc41a){if(_0x3cc41a){return _0x3cc41a[_0xb316('0x23')](_0x934dce)[_0xb316('0x24')](function(_0x55a6e5){return _0x55a6e5;});}return null;};}function removeEntity(_0x1e51aa,_0x3e787e){return function(_0x1ebd15){if(_0x1ebd15){return _0x1ebd15[_0xb316('0x25')]()[_0xb316('0x24')](function(){_0x1e51aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f2b9c,_0x52f68f){return function(_0x5c6e31){if(!_0x5c6e31){_0x3f2b9c[_0xb316('0x26')](0x194);}return _0x5c6e31;};}function handleError(_0x5061f9,_0x5bbe92){_0x5bbe92=_0x5bbe92||0x1f4;return function(_0x41c2ac){logger[_0xb316('0x27')](_0x41c2ac[_0xb316('0x28')]);if(_0x41c2ac[_0xb316('0x29')]){delete _0x41c2ac['name'];}_0x5061f9[_0xb316('0x17')](_0x5bbe92)[_0xb316('0x2a')](_0x41c2ac);};}exports[_0xb316('0x2b')]=function(_0x28aff1,_0x1dee2b){var _0x4843cd={},_0x5152aa={},_0x27c75b={'count':0x0,'rows':[]};var _0x42613e=_[_0xb316('0x2c')](db[_0xb316('0x2d')][_0xb316('0x2e')],function(_0x280d28){return{'name':_0x280d28[_0xb316('0x2f')],'type':_0x280d28[_0xb316('0x30')][_0xb316('0x31')]};});_0x5152aa[_0xb316('0x32')]=_[_0xb316('0x2c')](_0x42613e,_0xb316('0x29'));_0x5152aa[_0xb316('0x33')]=_[_0xb316('0x34')](_0x28aff1[_0xb316('0x33')]);_0x5152aa[_0xb316('0x35')]=_[_0xb316('0x36')](_0x5152aa[_0xb316('0x32')],_0x5152aa[_0xb316('0x33')]);_0x4843cd[_0xb316('0x37')]=_[_0xb316('0x36')](_0x5152aa[_0xb316('0x32')],qs['fields'](_0x28aff1['query'][_0xb316('0x38')]));_0x4843cd['attributes']=_0x4843cd[_0xb316('0x37')]['length']?_0x4843cd[_0xb316('0x37')]:_0x5152aa['model'];if(!_0x28aff1['query'][_0xb316('0x39')](_0xb316('0x3a'))){_0x4843cd[_0xb316('0x1b')]=qs[_0xb316('0x1b')](_0x28aff1[_0xb316('0x33')][_0xb316('0x1b')]);_0x4843cd['offset']=qs['offset'](_0x28aff1['query'][_0xb316('0x1a')]);}_0x4843cd['order']=qs[_0xb316('0x3b')](_0x28aff1[_0xb316('0x33')][_0xb316('0x3b')]);_0x4843cd[_0xb316('0x3c')]=qs[_0xb316('0x35')](_[_0xb316('0x3d')](_0x28aff1[_0xb316('0x33')],_0x5152aa[_0xb316('0x35')]),_0x42613e);if(_0x28aff1[_0xb316('0x33')][_0xb316('0x3e')]){_0x4843cd[_0xb316('0x3c')]=_[_0xb316('0x3f')](_0x4843cd[_0xb316('0x3c')],{'$or':_[_0xb316('0x2c')](_0x42613e,function(_0x8c49ab){if(_0x8c49ab['type']!=='VIRTUAL'){var _0x38cbac={};_0x38cbac[_0x8c49ab[_0xb316('0x29')]]={'$like':'%'+_0x28aff1['query']['filter']+'%'};return _0x38cbac;}})});}_0x4843cd=_['merge']({},_0x4843cd,_0x28aff1[_0xb316('0x40')]);var _0x3ea2dd={'where':_0x4843cd[_0xb316('0x3c')]};return db['OpenchannelApplication']['count'](_0x3ea2dd)[_0xb316('0x24')](function(_0x4807c){_0x27c75b[_0xb316('0x1d')]=_0x4807c;if(_0x28aff1[_0xb316('0x33')][_0xb316('0x41')]){_0x4843cd[_0xb316('0x42')]=[{'all':!![]}];}return db[_0xb316('0x2d')]['findAll'](_0x4843cd);})[_0xb316('0x24')](function(_0x3428a0){_0x27c75b[_0xb316('0x43')]=_0x3428a0;return _0x27c75b;})[_0xb316('0x24')](respondWithFilteredResult(_0x1dee2b,_0x4843cd))[_0xb316('0x44')](handleError(_0x1dee2b,null));};exports[_0xb316('0x45')]=function(_0x3d548d,_0x470dab){var _0x3e4b7e={'raw':!![],'where':{'id':_0x3d548d[_0xb316('0x46')]['id']}},_0x26ff11={};_0x26ff11[_0xb316('0x32')]=_['keys'](db[_0xb316('0x2d')][_0xb316('0x2e')]);_0x26ff11[_0xb316('0x33')]=_[_0xb316('0x34')](_0x3d548d[_0xb316('0x33')]);_0x26ff11[_0xb316('0x35')]=_[_0xb316('0x36')](_0x26ff11[_0xb316('0x32')],_0x26ff11[_0xb316('0x33')]);_0x3e4b7e[_0xb316('0x37')]=_[_0xb316('0x36')](_0x26ff11['model'],qs[_0xb316('0x38')](_0x3d548d[_0xb316('0x33')][_0xb316('0x38')]));_0x3e4b7e[_0xb316('0x37')]=_0x3e4b7e[_0xb316('0x37')][_0xb316('0x47')]?_0x3e4b7e[_0xb316('0x37')]:_0x26ff11[_0xb316('0x32')];if(_0x3d548d[_0xb316('0x33')][_0xb316('0x41')]){_0x3e4b7e['include']=[{'all':!![]}];}_0x3e4b7e=_['merge']({},_0x3e4b7e,_0x3d548d[_0xb316('0x40')]);return db['OpenchannelApplication']['find'](_0x3e4b7e)[_0xb316('0x24')](handleEntityNotFound(_0x470dab,null))['then'](respondWithResult(_0x470dab,null))[_0xb316('0x44')](handleError(_0x470dab,null));};exports[_0xb316('0x48')]=function(_0x405404,_0x1096d5){return db[_0xb316('0x2d')][_0xb316('0x48')](_0x405404[_0xb316('0x49')],{})[_0xb316('0x24')](respondWithResult(_0x1096d5,0xc9))[_0xb316('0x44')](handleError(_0x1096d5,null));};exports[_0xb316('0x23')]=function(_0x608973,_0x1dbe80){if(_0x608973[_0xb316('0x49')]['id']){delete _0x608973[_0xb316('0x49')]['id'];}return db[_0xb316('0x2d')][_0xb316('0x4a')]({'where':{'id':_0x608973['params']['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x1dbe80,null))['then'](saveUpdates(_0x608973[_0xb316('0x49')],null))[_0xb316('0x24')](respondWithResult(_0x1dbe80,null))[_0xb316('0x44')](handleError(_0x1dbe80,null));};exports[_0xb316('0x25')]=function(_0x3c13eb,_0x1305f1){return db['OpenchannelApplication'][_0xb316('0x4a')]({'where':{'id':_0x3c13eb[_0xb316('0x46')]['id']}})[_0xb316('0x24')](handleEntityNotFound(_0x1305f1,null))['then'](removeEntity(_0x1305f1,null))[_0xb316('0x44')](handleError(_0x1305f1,null));}; \ No newline at end of file +var _0xbce7=['rawAttributes','fieldName','type','map','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','stack','name','send','index','OpenchannelApplication'];(function(_0x8e4b3c,_0x3c6a9e){var _0x228af2=function(_0x45e576){while(--_0x45e576){_0x8e4b3c['push'](_0x8e4b3c['shift']());}};_0x228af2(++_0x3c6a9e);}(_0xbce7,0x1c8));var _0x7bce=function(_0x1bc2d8,_0x172f6c){_0x1bc2d8=_0x1bc2d8-0x0;var _0x3fc482=_0xbce7[_0x1bc2d8];return _0x3fc482;};'use strict';var emlformat=require(_0x7bce('0x0'));var rimraf=require(_0x7bce('0x1'));var zipdir=require(_0x7bce('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7bce('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7bce('0x4'));var util=require(_0x7bce('0x5'));var path=require(_0x7bce('0x6'));var sox=require('sox');var csv=require(_0x7bce('0x7'));var ejs=require(_0x7bce('0x8'));var fs=require('fs');var fs_extra=require(_0x7bce('0x9'));var _=require(_0x7bce('0xa'));var squel=require('squel');var crypto=require(_0x7bce('0xb'));var jsforce=require(_0x7bce('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x7bce('0x7'));var querystring=require(_0x7bce('0xd'));var Papa=require('papaparse');var Redis=require(_0x7bce('0xe'));var authService=require(_0x7bce('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x7bce('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7bce('0x11'))(_0x7bce('0x12'));var utils=require('../../config/utils');var config=require(_0x7bce('0x13'));var licenseUtil=require(_0x7bce('0x14'));var db=require(_0x7bce('0x15'))['db'];function respondWithStatusCode(_0x190984,_0x50b760){_0x50b760=_0x50b760||0xcc;return function(_0x57b241){if(_0x57b241){return _0x190984[_0x7bce('0x16')](_0x50b760);}return _0x190984[_0x7bce('0x17')](_0x50b760)[_0x7bce('0x18')]();};}function respondWithResult(_0x4a05c4,_0x4706ef){_0x4706ef=_0x4706ef||0xc8;return function(_0x2cfbc4){if(_0x2cfbc4){return _0x4a05c4[_0x7bce('0x17')](_0x4706ef)[_0x7bce('0x19')](_0x2cfbc4);}};}function respondWithFilteredResult(_0x15200e,_0x54f834){return function(_0x5d868b){if(_0x5d868b){var _0x2c488e=typeof _0x54f834[_0x7bce('0x1a')]===_0x7bce('0x1b')&&typeof _0x54f834[_0x7bce('0x1c')]===_0x7bce('0x1b');var _0x481078=_0x5d868b[_0x7bce('0x1d')];var _0xc98ad7=_0x2c488e?0x0:_0x54f834[_0x7bce('0x1a')];var _0x1650bc=_0x2c488e?_0x5d868b[_0x7bce('0x1d')]:_0x54f834[_0x7bce('0x1a')]+_0x54f834[_0x7bce('0x1c')];var _0xe773bd;if(_0x1650bc>=_0x481078){_0x1650bc=_0x481078;_0xe773bd=0xc8;}else{_0xe773bd=0xce;}_0x15200e[_0x7bce('0x17')](_0xe773bd);return _0x15200e[_0x7bce('0x1e')](_0x7bce('0x1f'),_0xc98ad7+'-'+_0x1650bc+'/'+_0x481078)['json'](_0x5d868b);}return null;};}function patchUpdates(_0x5d122f){return function(_0x57a76a){try{jsonpatch[_0x7bce('0x20')](_0x57a76a,_0x5d122f,!![]);}catch(_0x24fe29){return BPromise['reject'](_0x24fe29);}return _0x57a76a[_0x7bce('0x21')]();};}function saveUpdates(_0x4d1760,_0x1decac){return function(_0x2d82e1){if(_0x2d82e1){return _0x2d82e1['update'](_0x4d1760)[_0x7bce('0x22')](function(_0x49e5fe){return _0x49e5fe;});}return null;};}function removeEntity(_0x7b7a95,_0x33166e){return function(_0x4cdf99){if(_0x4cdf99){return _0x4cdf99[_0x7bce('0x23')]()[_0x7bce('0x22')](function(){_0x7b7a95[_0x7bce('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7b6de8,_0x59b0b0){return function(_0x46b5ab){if(!_0x46b5ab){_0x7b6de8[_0x7bce('0x16')](0x194);}return _0x46b5ab;};}function handleError(_0x4be588,_0x1fe11b){_0x1fe11b=_0x1fe11b||0x1f4;return function(_0x4edc05){logger['error'](_0x4edc05[_0x7bce('0x24')]);if(_0x4edc05[_0x7bce('0x25')]){delete _0x4edc05['name'];}_0x4be588['status'](_0x1fe11b)[_0x7bce('0x26')](_0x4edc05);};}exports[_0x7bce('0x27')]=function(_0x42cb43,_0x3b4e66){var _0x503937={},_0x5200dd={},_0x41a192={'count':0x0,'rows':[]};var _0x5d4585=_['map'](db[_0x7bce('0x28')][_0x7bce('0x29')],function(_0x51cd1d){return{'name':_0x51cd1d[_0x7bce('0x2a')],'type':_0x51cd1d[_0x7bce('0x2b')]['key']};});_0x5200dd['model']=_[_0x7bce('0x2c')](_0x5d4585,_0x7bce('0x25'));_0x5200dd[_0x7bce('0x2d')]=_[_0x7bce('0x2e')](_0x42cb43[_0x7bce('0x2d')]);_0x5200dd['filters']=_[_0x7bce('0x2f')](_0x5200dd[_0x7bce('0x30')],_0x5200dd[_0x7bce('0x2d')]);_0x503937[_0x7bce('0x31')]=_[_0x7bce('0x2f')](_0x5200dd[_0x7bce('0x30')],qs[_0x7bce('0x32')](_0x42cb43['query'][_0x7bce('0x32')]));_0x503937[_0x7bce('0x31')]=_0x503937[_0x7bce('0x31')][_0x7bce('0x33')]?_0x503937['attributes']:_0x5200dd[_0x7bce('0x30')];if(!_0x42cb43[_0x7bce('0x2d')]['hasOwnProperty'](_0x7bce('0x34'))){_0x503937[_0x7bce('0x1c')]=qs[_0x7bce('0x1c')](_0x42cb43[_0x7bce('0x2d')]['limit']);_0x503937[_0x7bce('0x1a')]=qs['offset'](_0x42cb43['query']['offset']);}_0x503937['order']=qs[_0x7bce('0x35')](_0x42cb43['query']['sort']);_0x503937[_0x7bce('0x36')]=qs[_0x7bce('0x37')](_['pick'](_0x42cb43[_0x7bce('0x2d')],_0x5200dd[_0x7bce('0x37')]),_0x5d4585);if(_0x42cb43[_0x7bce('0x2d')][_0x7bce('0x38')]){_0x503937[_0x7bce('0x36')]=_[_0x7bce('0x39')](_0x503937[_0x7bce('0x36')],{'$or':_[_0x7bce('0x2c')](_0x5d4585,function(_0x175ed1){if(_0x175ed1['type']!==_0x7bce('0x3a')){var _0x596f3c={};_0x596f3c[_0x175ed1[_0x7bce('0x25')]]={'$like':'%'+_0x42cb43[_0x7bce('0x2d')][_0x7bce('0x38')]+'%'};return _0x596f3c;}})});}_0x503937=_[_0x7bce('0x39')]({},_0x503937,_0x42cb43[_0x7bce('0x3b')]);var _0x524893={'where':_0x503937['where']};return db[_0x7bce('0x28')][_0x7bce('0x1d')](_0x524893)[_0x7bce('0x22')](function(_0x43f340){_0x41a192['count']=_0x43f340;if(_0x42cb43['query'][_0x7bce('0x3c')]){_0x503937[_0x7bce('0x3d')]=[{'all':!![]}];}return db[_0x7bce('0x28')][_0x7bce('0x3e')](_0x503937);})['then'](function(_0xc15fa9){_0x41a192[_0x7bce('0x3f')]=_0xc15fa9;return _0x41a192;})[_0x7bce('0x22')](respondWithFilteredResult(_0x3b4e66,_0x503937))[_0x7bce('0x40')](handleError(_0x3b4e66,null));};exports[_0x7bce('0x41')]=function(_0x2b0121,_0x507e2c){var _0x126590={'raw':!![],'where':{'id':_0x2b0121[_0x7bce('0x42')]['id']}},_0x48e88d={};_0x48e88d['model']=_['keys'](db[_0x7bce('0x28')][_0x7bce('0x29')]);_0x48e88d[_0x7bce('0x2d')]=_['keys'](_0x2b0121['query']);_0x48e88d[_0x7bce('0x37')]=_[_0x7bce('0x2f')](_0x48e88d[_0x7bce('0x30')],_0x48e88d[_0x7bce('0x2d')]);_0x126590['attributes']=_[_0x7bce('0x2f')](_0x48e88d[_0x7bce('0x30')],qs['fields'](_0x2b0121[_0x7bce('0x2d')][_0x7bce('0x32')]));_0x126590[_0x7bce('0x31')]=_0x126590[_0x7bce('0x31')][_0x7bce('0x33')]?_0x126590[_0x7bce('0x31')]:_0x48e88d['model'];if(_0x2b0121['query']['includeAll']){_0x126590[_0x7bce('0x3d')]=[{'all':!![]}];}_0x126590=_[_0x7bce('0x39')]({},_0x126590,_0x2b0121['options']);return db[_0x7bce('0x28')][_0x7bce('0x43')](_0x126590)['then'](handleEntityNotFound(_0x507e2c,null))[_0x7bce('0x22')](respondWithResult(_0x507e2c,null))['catch'](handleError(_0x507e2c,null));};exports[_0x7bce('0x44')]=function(_0x21b377,_0x505fde){return db[_0x7bce('0x28')][_0x7bce('0x44')](_0x21b377['body'],{})[_0x7bce('0x22')](respondWithResult(_0x505fde,0xc9))[_0x7bce('0x40')](handleError(_0x505fde,null));};exports[_0x7bce('0x45')]=function(_0x45aade,_0x467856){if(_0x45aade[_0x7bce('0x46')]['id']){delete _0x45aade[_0x7bce('0x46')]['id'];}return db[_0x7bce('0x28')]['find']({'where':{'id':_0x45aade[_0x7bce('0x42')]['id']}})[_0x7bce('0x22')](handleEntityNotFound(_0x467856,null))[_0x7bce('0x22')](saveUpdates(_0x45aade['body'],null))[_0x7bce('0x22')](respondWithResult(_0x467856,null))[_0x7bce('0x40')](handleError(_0x467856,null));};exports[_0x7bce('0x23')]=function(_0x2daa22,_0x4f853d){return db[_0x7bce('0x28')][_0x7bce('0x43')]({'where':{'id':_0x2daa22['params']['id']}})[_0x7bce('0x22')](handleEntityNotFound(_0x4f853d,null))[_0x7bce('0x22')](removeEntity(_0x4f853d,null))[_0x7bce('0x40')](handleError(_0x4f853d,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 287355b..a102813 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 _0x3746=['../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x3746,0x11d));var _0x6374=function(_0x34e832,_0x539e11){_0x34e832=_0x34e832-0x0;var _0x3b941b=_0x3746[_0x34e832];return _0x3b941b;};'use strict';var _=require('lodash');var util=require(_0x6374('0x0'));var logger=require(_0x6374('0x1'))(_0x6374('0x2'));var moment=require(_0x6374('0x3'));var BPromise=require('bluebird');var rp=require(_0x6374('0x4'));var fs=require('fs');var path=require(_0x6374('0x5'));var rimraf=require('rimraf');var config=require(_0x6374('0x6'));var attributes=require(_0x6374('0x7'));module[_0x6374('0x8')]=function(_0x44593b,_0x4c9f32){return _0x44593b[_0x6374('0x9')](_0x6374('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6374('0xb'),'collate':_0x6374('0xc')});}; \ No newline at end of file +var _0x4a3d=['../../config/environment','./openchannelApplication.attributes','exports','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x4a3d,0xa0));var _0xd4a3=function(_0x2e5553,_0x288a76){_0x2e5553=_0x2e5553-0x0;var _0x1fd714=_0x4a3d[_0x2e5553];return _0x1fd714;};'use strict';var _=require(_0xd4a3('0x0'));var util=require(_0xd4a3('0x1'));var logger=require('../../config/logger')(_0xd4a3('0x2'));var moment=require(_0xd4a3('0x3'));var BPromise=require(_0xd4a3('0x4'));var rp=require(_0xd4a3('0x5'));var fs=require('fs');var path=require(_0xd4a3('0x6'));var rimraf=require(_0xd4a3('0x7'));var config=require(_0xd4a3('0x8'));var attributes=require(_0xd4a3('0x9'));module[_0xd4a3('0xa')]=function(_0x24bdfe,_0x43b8ac){return _0x24bdfe['define']('OpenchannelApplication',attributes,{'tableName':_0xd4a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd4a3('0xc'),'collate':_0xd4a3('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 4d32337..daea6c1 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 _0x44f2=['catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result'];(function(_0xbf09ab,_0x251a19){var _0x2a9aef=function(_0x22d793){while(--_0x22d793){_0xbf09ab['push'](_0xbf09ab['shift']());}};_0x2a9aef(++_0x251a19);}(_0x44f2,0xc4));var _0x244f=function(_0x4bc314,_0x20a3dd){_0x4bc314=_0x4bc314-0x0;var _0xfc7d8c=_0x44f2[_0x4bc314];return _0xfc7d8c;};'use strict';var _=require(_0x244f('0x0'));var util=require(_0x244f('0x1'));var moment=require(_0x244f('0x2'));var BPromise=require('bluebird');var rs=require(_0x244f('0x3'));var fs=require('fs');var Redis=require(_0x244f('0x4'));var db=require(_0x244f('0x5'))['db'];var utils=require(_0x244f('0x6'));var logger=require('../../config/logger')(_0x244f('0x7'));var config=require(_0x244f('0x8'));var jayson=require(_0x244f('0x9'));var client=jayson[_0x244f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323c05,_0x1da22d,_0x5126b5){return new BPromise(function(_0x9ccb9d,_0x418ca9){return client['request'](_0x323c05,_0x5126b5)[_0x244f('0xb')](function(_0x5dd707){logger[_0x244f('0xc')]('OpenchannelApplication,\x20%s,\x20%s',_0x1da22d,'request\x20sent');logger[_0x244f('0xd')](_0x244f('0xe'),_0x1da22d,_0x244f('0xf'),JSON[_0x244f('0x10')](_0x5dd707));if(_0x5dd707[_0x244f('0x11')]){if(_0x5dd707[_0x244f('0x11')]['code']===0x1f4){logger[_0x244f('0x11')](_0x244f('0x12'),_0x1da22d,_0x5dd707['error']['message']);return _0x418ca9(_0x5dd707[_0x244f('0x11')][_0x244f('0x13')]);}logger[_0x244f('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x1da22d,_0x5dd707[_0x244f('0x11')]['message']);return _0x9ccb9d(_0x5dd707[_0x244f('0x11')]['message']);}else{logger['info'](_0x244f('0x12'),_0x1da22d,_0x244f('0xf'));_0x9ccb9d(_0x5dd707[_0x244f('0x14')]['message']);}})[_0x244f('0x15')](function(_0x6dcf82){logger['error'](_0x244f('0x12'),_0x1da22d,_0x6dcf82);_0x418ca9(_0x6dcf82);});});}exports[_0x244f('0x16')]=function(_0x536d34){var _0x508f90=this;return new Promise(function(_0x13cac4,_0x2a6916){return db[_0x244f('0x17')][_0x244f('0x18')](_0x536d34[_0x244f('0x19')],{'raw':_0x536d34[_0x244f('0x1a')]?_0x536d34['options'][_0x244f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x536d34[_0x244f('0x1a')]?_0x536d34[_0x244f('0x1a')][_0x244f('0x1c')]||null:null,'attributes':_0x536d34[_0x244f('0x1a')]?_0x536d34['options'][_0x244f('0x1d')]||null:null,'limit':_0x536d34[_0x244f('0x1a')]?_0x536d34['options'][_0x244f('0x1e')]||null:null})[_0x244f('0xb')](function(_0x17a11a){logger[_0x244f('0xc')](_0x244f('0x16'),_0x536d34);logger[_0x244f('0xd')](_0x244f('0x16'),_0x536d34,JSON[_0x244f('0x10')](_0x17a11a));_0x13cac4(_0x17a11a);})['catch'](function(_0x4f3e29){logger[_0x244f('0x11')](_0x244f('0x16'),_0x4f3e29['message'],_0x536d34);_0x2a6916(_0x508f90[_0x244f('0x11')](0x1f4,_0x4f3e29['message']));});});}; \ No newline at end of file +var _0xc93d=['lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','where','attributes'];(function(_0x36c55d,_0x1c8efa){var _0xa16625=function(_0x3071f7){while(--_0x3071f7){_0x36c55d['push'](_0x36c55d['shift']());}};_0xa16625(++_0x1c8efa);}(_0xc93d,0x1e6));var _0xdc93=function(_0x37f6d8,_0x444925){_0x37f6d8=_0x37f6d8-0x0;var _0x49f67b=_0xc93d[_0x37f6d8];return _0x49f67b;};'use strict';var _=require(_0xdc93('0x0'));var util=require(_0xdc93('0x1'));var moment=require('moment');var BPromise=require(_0xdc93('0x2'));var rs=require(_0xdc93('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xdc93('0x4'));var logger=require(_0xdc93('0x5'))('rpc');var config=require(_0xdc93('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdc93('0x7')][_0xdc93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x35456b,_0xd4eaea,_0x270842){return new BPromise(function(_0x299ed1,_0x415aca){return client[_0xdc93('0x9')](_0x35456b,_0x270842)['then'](function(_0x421d0d){logger[_0xdc93('0xa')](_0xdc93('0xb'),_0xd4eaea,_0xdc93('0xc'));logger[_0xdc93('0xd')](_0xdc93('0xe'),_0xd4eaea,'request\x20sent',JSON[_0xdc93('0xf')](_0x421d0d));if(_0x421d0d[_0xdc93('0x10')]){if(_0x421d0d[_0xdc93('0x10')][_0xdc93('0x11')]===0x1f4){logger['error'](_0xdc93('0xb'),_0xd4eaea,_0x421d0d[_0xdc93('0x10')][_0xdc93('0x12')]);return _0x415aca(_0x421d0d[_0xdc93('0x10')][_0xdc93('0x12')]);}logger[_0xdc93('0x10')](_0xdc93('0xb'),_0xd4eaea,_0x421d0d[_0xdc93('0x10')][_0xdc93('0x12')]);return _0x299ed1(_0x421d0d[_0xdc93('0x10')][_0xdc93('0x12')]);}else{logger[_0xdc93('0xa')](_0xdc93('0xb'),_0xd4eaea,_0xdc93('0xc'));_0x299ed1(_0x421d0d['result']['message']);}})[_0xdc93('0x13')](function(_0x1ce137){logger[_0xdc93('0x10')](_0xdc93('0xb'),_0xd4eaea,_0x1ce137);_0x415aca(_0x1ce137);});});}exports[_0xdc93('0x14')]=function(_0x1e6bf3){var _0x27388d=this;return new Promise(function(_0x23e751,_0x192a47){return db[_0xdc93('0x15')][_0xdc93('0x16')](_0x1e6bf3[_0xdc93('0x17')],{'raw':_0x1e6bf3[_0xdc93('0x18')]?_0x1e6bf3[_0xdc93('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e6bf3['options']?_0x1e6bf3['options'][_0xdc93('0x19')]||null:null,'attributes':_0x1e6bf3[_0xdc93('0x18')]?_0x1e6bf3[_0xdc93('0x18')][_0xdc93('0x1a')]||null:null,'limit':_0x1e6bf3[_0xdc93('0x18')]?_0x1e6bf3[_0xdc93('0x18')]['limit']||null:null})['then'](function(_0x58e6ed){logger[_0xdc93('0xa')]('UpdateOpenchannelApplication',_0x1e6bf3);logger[_0xdc93('0xd')](_0xdc93('0x14'),_0x1e6bf3,JSON[_0xdc93('0xf')](_0x58e6ed));_0x23e751(_0x58e6ed);})[_0xdc93('0x13')](function(_0xd4ea85){logger['error'](_0xdc93('0x14'),_0xd4ea85[_0xdc93('0x12')],_0x1e6bf3);_0x192a47(_0x27388d['error'](0x1f4,_0xd4ea85[_0xdc93('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 24c6492..0217967 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 _0xfbed=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','openchannelinteraction:addtags','tracked','openchannel','openchannelinteraction:update','openchannelinteraction:destroy','destroy','delete','/:id/tags','exports','path','express'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xfbed,0x10c));var _0xdfbe=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xfbed[_0x13e741];return _0x3f8bb3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdfbe('0x0'));var timeout=require('connect-timeout');var express=require(_0xdfbe('0x1'));var router=express['Router']();var fs_extra=require(_0xdfbe('0x2'));var auth=require(_0xdfbe('0x3'));var interaction=require(_0xdfbe('0x4'));var config=require(_0xdfbe('0x5'));var controller=require(_0xdfbe('0x6'));router[_0xdfbe('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xdfbe('0x8')](),controller[_0xdfbe('0x9')]);router[_0xdfbe('0x7')](_0xdfbe('0xa'),auth[_0xdfbe('0x8')](),controller[_0xdfbe('0xb')]);router[_0xdfbe('0x7')](_0xdfbe('0xc'),auth[_0xdfbe('0x8')](),controller[_0xdfbe('0xd')]);router[_0xdfbe('0x7')](_0xdfbe('0xe'),auth[_0xdfbe('0x8')](),controller[_0xdfbe('0xf')]);router[_0xdfbe('0x10')]('/',auth[_0xdfbe('0x8')](),controller[_0xdfbe('0x11')]);router[_0xdfbe('0x10')](_0xdfbe('0xc'),auth[_0xdfbe('0x8')](),controller['addMessage']);router[_0xdfbe('0x10')]('/:id/tags',auth[_0xdfbe('0x8')](),interaction['tracked']('openchannel',_0xdfbe('0x12')),controller['addTags']);router['put'](_0xdfbe('0xa'),auth[_0xdfbe('0x8')](),interaction[_0xdfbe('0x13')](_0xdfbe('0x14'),_0xdfbe('0x15')),controller['update']);router['delete']('/:id',auth[_0xdfbe('0x8')](),interaction[_0xdfbe('0x13')](_0xdfbe('0x14'),_0xdfbe('0x16')),controller[_0xdfbe('0x17')]);router[_0xdfbe('0x18')](_0xdfbe('0x19'),auth['isAuthenticated'](),controller['removeTags']);module[_0xdfbe('0x1a')]=router; \ No newline at end of file +var _0x013f=['/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','delete','destroy','removeTags','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/:id','getMessages','/:id/download','download','post','create','/:id/messages'];(function(_0x477bcb,_0x523271){var _0x4471bb=function(_0x2684db){while(--_0x2684db){_0x477bcb['push'](_0x477bcb['shift']());}};_0x4471bb(++_0x523271);}(_0x013f,0xcf));var _0xf013=function(_0x579900,_0x3349ad){_0x579900=_0x579900-0x0;var _0x430355=_0x013f[_0x579900];return _0x430355;};'use strict';var multer=require('multer');var util=require(_0xf013('0x0'));var path=require(_0xf013('0x1'));var timeout=require(_0xf013('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf013('0x3'));var interaction=require(_0xf013('0x4'));var config=require(_0xf013('0x5'));var controller=require(_0xf013('0x6'));router[_0xf013('0x7')]('/',auth[_0xf013('0x8')](),controller[_0xf013('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xf013('0x7')](_0xf013('0xa'),auth[_0xf013('0x8')](),controller['show']);router[_0xf013('0x7')]('/:id/messages',auth[_0xf013('0x8')](),controller[_0xf013('0xb')]);router[_0xf013('0x7')](_0xf013('0xc'),auth[_0xf013('0x8')](),controller[_0xf013('0xd')]);router[_0xf013('0xe')]('/',auth[_0xf013('0x8')](),controller[_0xf013('0xf')]);router['post'](_0xf013('0x10'),auth[_0xf013('0x8')](),controller['addMessage']);router[_0xf013('0xe')](_0xf013('0x11'),auth[_0xf013('0x8')](),interaction[_0xf013('0x12')](_0xf013('0x13'),_0xf013('0x14')),controller[_0xf013('0x15')]);router[_0xf013('0x16')](_0xf013('0xa'),auth[_0xf013('0x8')](),interaction[_0xf013('0x12')]('openchannel',_0xf013('0x17')),controller['update']);router[_0xf013('0x18')](_0xf013('0xa'),auth[_0xf013('0x8')](),interaction['tracked'](_0xf013('0x13'),'openchannelinteraction:destroy'),controller[_0xf013('0x19')]);router[_0xf013('0x18')](_0xf013('0x11'),auth[_0xf013('0x8')](),controller[_0xf013('0x1a')]);module[_0xf013('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index e41aee1..c10592e 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 _0x2e16=['ENUM','out','INTEGER','sequelize','STRING','DATE'];(function(_0x16ea38,_0x306470){var _0x1b6d7d=function(_0x248780){while(--_0x248780){_0x16ea38['push'](_0x16ea38['shift']());}};_0x1b6d7d(++_0x306470);}(_0x2e16,0x8d));var _0x62e1=function(_0x6147c,_0x5a749f){_0x6147c=_0x6147c-0x0;var _0x4c58dc=_0x2e16[_0x6147c];return _0x4c58dc;};'use strict';var Sequelize=require(_0x62e1('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x62e1('0x1')]},'secondDisposition':{'type':Sequelize[_0x62e1('0x1')]},'thirdDisposition':{'type':Sequelize[_0x62e1('0x1')]},'note':{'type':Sequelize[_0x62e1('0x1')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x62e1('0x1')]},'externalUrl':{'type':Sequelize[_0x62e1('0x1')]},'lastMsgAt':{'type':Sequelize[_0x62e1('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x62e1('0x3')]('in',_0x62e1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x62e1('0x3')]('in',_0x62e1('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x62e1('0x1')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x62e1('0x5')]}}; \ No newline at end of file +var _0x2697=['INTEGER','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x2697,0x120));var _0x7269=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x2697[_0x4b6507];return _0x2001ec;};'use strict';var Sequelize=require('sequelize');module[_0x7269('0x0')]={'closed':{'type':Sequelize[_0x7269('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x7269('0x2')]},'disposition':{'type':Sequelize[_0x7269('0x3')]},'secondDisposition':{'type':Sequelize[_0x7269('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7269('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x7269('0x3')]},'externalUrl':{'type':Sequelize[_0x7269('0x3')]},'lastMsgAt':{'type':Sequelize[_0x7269('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7269('0x4')]('in',_0x7269('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7269('0x4')]('in',_0x7269('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7269('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x7269('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7269('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index bae98e2..7716d24 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 _0xe3da=['sendStatus','error','stack','name','send','index','OpenchannelInteraction','fieldName','type','key','getOptions','openchannel','user','show','query','from','params','model','rawAttributes','filters','intersection','attributes','length','includeAll','include','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','keys','fields','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','color','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','tmp','attachments','push','User','fullname','lastName','Attachment','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','Openchannel','N.A.','closed','closedAt','threadId','Private','Messages','basename','createReadStream','pipe','createWriteStream','toString','out','System','firstName','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','status','limit','count','set','Content-Range','update','then','destroy'];(function(_0x354265,_0x504e00){var _0x3dbbc9=function(_0x3c2fdd){while(--_0x3c2fdd){_0x354265['push'](_0x354265['shift']());}};_0x3dbbc9(++_0x504e00);}(_0xe3da,0x1e8));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var rimraf=require(_0xae3d('0x0'));var zipdir=require(_0xae3d('0x1'));var moment=require('moment');var util=require(_0xae3d('0x2'));var path=require(_0xae3d('0x3'));var ejs=require(_0xae3d('0x4'));var fs=require('fs');var _=require(_0xae3d('0x5'));var Redis=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var qs=require(_0xae3d('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xae3d('0x9'))('api');var config=require(_0xae3d('0xa'));var db=require('../../mysqldb')['db'];config[_0xae3d('0xb')]=_[_0xae3d('0xc')](config[_0xae3d('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xae3d('0xd'))(new Redis(config['redis']));require(_0xae3d('0xe'))[_0xae3d('0xf')](socket);function respondWithStatusCode(_0x4bf467,_0x5891a2){_0x5891a2=_0x5891a2||0xcc;return function(_0x30d9c1){if(_0x30d9c1){return _0x4bf467['sendStatus'](_0x5891a2);}return _0x4bf467[_0xae3d('0x10')](_0x5891a2)['end']();};}function respondWithResult(_0xe967ab,_0x383526){_0x383526=_0x383526||0xc8;return function(_0x4f1c44){if(_0x4f1c44){return _0xe967ab['status'](_0x383526)['json'](_0x4f1c44);}};}function respondWithFilteredResult(_0x382973,_0x1a9bc0){return function(_0x5a3c70){if(_0x5a3c70){var _0x28eb1f=typeof _0x1a9bc0['offset']==='undefined'&&typeof _0x1a9bc0[_0xae3d('0x11')]==='undefined';var _0x438ccc=_0x5a3c70[_0xae3d('0x12')];var _0x49c7d7=_0x28eb1f?0x0:_0x1a9bc0['offset'];var _0x1644cb=_0x28eb1f?_0x5a3c70[_0xae3d('0x12')]:_0x1a9bc0['offset']+_0x1a9bc0[_0xae3d('0x11')];var _0x489eb0;if(_0x1644cb>=_0x438ccc){_0x1644cb=_0x438ccc;_0x489eb0=0xc8;}else{_0x489eb0=0xce;}_0x382973['status'](_0x489eb0);return _0x382973[_0xae3d('0x13')](_0xae3d('0x14'),_0x49c7d7+'-'+_0x1644cb+'/'+_0x438ccc)['json'](_0x5a3c70);}return null;};}function saveUpdates(_0x517017){return function(_0x561f74){if(_0x561f74){return _0x561f74[_0xae3d('0x15')](_0x517017)[_0xae3d('0x16')](function(_0x3ead6f){return _0x3ead6f;});}return null;};}function removeEntity(_0x43f66b){return function(_0x57a9a7){if(_0x57a9a7){return _0x57a9a7[_0xae3d('0x17')]()[_0xae3d('0x16')](function(){_0x43f66b[_0xae3d('0x10')](0xcc)['end']();});}};}function handleEntityNotFound(_0x576331){return function(_0x131687){if(!_0x131687){_0x576331[_0xae3d('0x18')](0x194);}return _0x131687;};}function handleError(_0x4c92f3,_0x54c8a7){_0x54c8a7=_0x54c8a7||0x1f4;return function(_0x247b21){logger[_0xae3d('0x19')](_0x247b21[_0xae3d('0x1a')]);if(_0x247b21[_0xae3d('0x1b')]){delete _0x247b21['name'];}_0x4c92f3['status'](_0x54c8a7)[_0xae3d('0x1c')](_0x247b21);};}exports[_0xae3d('0x1d')]=function(_0x3c9ed3,_0x2ca3e8){var _0x4d02f3={};var _0x26dbcd=_['map'](db[_0xae3d('0x1e')]['rawAttributes'],function(_0x406465){return{'name':_0x406465[_0xae3d('0x1f')],'type':_0x406465[_0xae3d('0x20')][_0xae3d('0x21')]};});_0x4d02f3=qs[_0xae3d('0x22')](_0x26dbcd,_0x3c9ed3);return interaction['findAll'](_0xae3d('0x23'),_0x3c9ed3['query'],_0x3c9ed3[_0xae3d('0x24')],_0x4d02f3,_0x26dbcd)[_0xae3d('0x16')](respondWithFilteredResult(_0x2ca3e8,_0x4d02f3))['catch'](handleError(_0x2ca3e8,null));};exports[_0xae3d('0x25')]=function(_0x1666ee,_0x2e96be){var _0x1bc6be={};if(_0x1666ee['query'][_0xae3d('0x20')]&&_0x1666ee[_0xae3d('0x26')][_0xae3d('0x20')]===_0xae3d('0x27')){_0x1bc6be[_0xae3d('0x27')]=_0x1666ee['params']['id'];}else{_0x1bc6be['id']=_0x1666ee[_0xae3d('0x28')]['id'];}var _0x311597={'raw':![],'where':_0x1bc6be},_0xae5d4c={};_0xae5d4c[_0xae3d('0x29')]=_['keys'](db[_0xae3d('0x1e')][_0xae3d('0x2a')]);_0xae5d4c[_0xae3d('0x26')]=_['keys'](_0x1666ee[_0xae3d('0x26')]);_0xae5d4c[_0xae3d('0x2b')]=_[_0xae3d('0x2c')](_0xae5d4c[_0xae3d('0x29')],_0xae5d4c[_0xae3d('0x26')]);_0x311597['attributes']=_[_0xae3d('0x2c')](_0xae5d4c['model'],qs['fields'](_0x1666ee['query']['fields']));_0x311597[_0xae3d('0x2d')]=_0x311597[_0xae3d('0x2d')][_0xae3d('0x2e')]?_0x311597[_0xae3d('0x2d')]:_0xae5d4c[_0xae3d('0x29')];if(_0x1666ee[_0xae3d('0x26')][_0xae3d('0x2f')]){_0x311597[_0xae3d('0x30')]=[{'all':!![]}];}_0x311597=_[_0xae3d('0x31')]({},_0x311597,_0x1666ee[_0xae3d('0x32')]);return db[_0xae3d('0x1e')][_0xae3d('0x33')](_0x311597)[_0xae3d('0x16')](handleEntityNotFound(_0x2e96be,null))['then'](respondWithResult(_0x2e96be,null))[_0xae3d('0x34')](handleError(_0x2e96be,null));};exports[_0xae3d('0x35')]=function(_0x342b86,_0x1961bc){return db[_0xae3d('0x1e')][_0xae3d('0x35')](_0x342b86[_0xae3d('0x36')],{})['then'](respondWithResult(_0x1961bc,0xc9))['catch'](handleError(_0x1961bc,null));};exports[_0xae3d('0x15')]=function(_0x51fcdf,_0x2a24fc){if(_0x51fcdf[_0xae3d('0x36')]['id']){delete _0x51fcdf[_0xae3d('0x36')]['id'];}return db[_0xae3d('0x1e')][_0xae3d('0x33')]({'where':{'id':_0x51fcdf[_0xae3d('0x28')]['id']}})[_0xae3d('0x16')](handleEntityNotFound(_0x2a24fc,null))[_0xae3d('0x16')](saveUpdates(_0x51fcdf[_0xae3d('0x36')],null))['then'](respondWithResult(_0x2a24fc,null))['catch'](handleError(_0x2a24fc,null));};exports['destroy']=function(_0x257d63,_0x1d2bb7){return db[_0xae3d('0x1e')][_0xae3d('0x33')]({'where':{'id':_0x257d63[_0xae3d('0x28')]['id']}})['then'](handleEntityNotFound(_0x1d2bb7,null))[_0xae3d('0x16')](removeEntity(_0x1d2bb7,null))[_0xae3d('0x34')](handleError(_0x1d2bb7,null));};exports[_0xae3d('0x37')]=function(_0x2e9090,_0x1ec345){return db[_0xae3d('0x1e')][_0xae3d('0x37')]()[_0xae3d('0x16')](respondWithResult(_0x1ec345,null))[_0xae3d('0x34')](handleError(_0x1ec345,null));};exports[_0xae3d('0x38')]=function(_0x33122b,_0x257ac9){return db[_0xae3d('0x39')][_0xae3d('0x33')]({'where':{'id':_0x33122b[_0xae3d('0x28')]['id']}})[_0xae3d('0x16')](handleEntityNotFound(_0x257ac9,null))[_0xae3d('0x16')](function(_0x2f2526){if(_0x2f2526){return _0x2f2526['addMessage'](_0x33122b['body'][_0xae3d('0x3a')],_[_0xae3d('0x3b')](_0x33122b['body'],[_0xae3d('0x3a'),'id'])||{});}})[_0xae3d('0x16')](respondWithResult(_0x257ac9,null))[_0xae3d('0x34')](handleError(_0x257ac9,null));};exports[_0xae3d('0x3c')]=function(_0x10c5fc,_0x15ac7e){var _0x25c075={'raw':![],'where':{}};var _0x5189da={};var _0x19a084={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xae3d('0x3d')]({'where':{'id':_0x10c5fc[_0xae3d('0x28')]['id']}})['then'](handleEntityNotFound(_0x15ac7e,null))[_0xae3d('0x16')](function(_0x4abd77){if(_0x4abd77){_0x5189da[_0xae3d('0x29')]=_[_0xae3d('0x3e')](db[_0xae3d('0x39')][_0xae3d('0x2a')]);_0x5189da[_0xae3d('0x26')]=_[_0xae3d('0x3e')](_0x10c5fc[_0xae3d('0x26')]);_0x5189da[_0xae3d('0x2b')]=_[_0xae3d('0x2c')](_0x5189da[_0xae3d('0x29')],_0x5189da[_0xae3d('0x26')]);_0x25c075[_0xae3d('0x2d')]=_[_0xae3d('0x2c')](_0x5189da[_0xae3d('0x29')],qs[_0xae3d('0x3f')](_0x10c5fc[_0xae3d('0x26')][_0xae3d('0x3f')]));_0x25c075[_0xae3d('0x2d')]=_0x25c075[_0xae3d('0x2d')]['length']?_0x25c075[_0xae3d('0x2d')]:_0x5189da[_0xae3d('0x29')];if(!_0x10c5fc[_0xae3d('0x26')][_0xae3d('0x40')](_0xae3d('0x41'))){_0x25c075['limit']=qs['limit'](_0x10c5fc['query']['limit']);_0x25c075[_0xae3d('0x42')]=qs[_0xae3d('0x42')](_0x10c5fc[_0xae3d('0x26')]['offset']);}_0x25c075[_0xae3d('0x43')]=qs[_0xae3d('0x44')](_0x10c5fc[_0xae3d('0x26')][_0xae3d('0x44')]);_0x25c075[_0xae3d('0x45')]=qs[_0xae3d('0x2b')](_[_0xae3d('0x46')](_0x10c5fc[_0xae3d('0x26')],_0x5189da[_0xae3d('0x2b')]));_0x25c075[_0xae3d('0x45')]['OpenchannelInteractionId']=_0x4abd77['id'];if(_0x10c5fc[_0xae3d('0x26')][_0xae3d('0x47')]){_0x25c075[_0xae3d('0x45')]=_[_0xae3d('0x31')](_0x25c075['where'],{'$or':_[_0xae3d('0x48')](_0x25c075[_0xae3d('0x2d')],function(_0x5844b4){var _0x231c29={};_0x231c29[_0x5844b4]={'$like':'%'+_0x10c5fc['query']['filter']+'%'};return _0x231c29;})});}if(_0x10c5fc[_0xae3d('0x26')][_0xae3d('0x49')]){var _0x155e45=_0x10c5fc[_0xae3d('0x26')]['$gte'][_0xae3d('0x4a')](',');var _0x4b9b7c={};_0x4b9b7c[_0x155e45[0x0]]={'$gte':moment(_0x155e45[0x1])[_0xae3d('0x4b')](_0xae3d('0x4c'))};_0x25c075[_0xae3d('0x45')]=_[_0xae3d('0x31')](_0x25c075['where'],_0x4b9b7c);}_0x25c075=_[_0xae3d('0x31')]({},_0x25c075,_0x10c5fc[_0xae3d('0x32')]);return db['OpenchannelMessage'][_0xae3d('0x12')]({'where':_0x25c075[_0xae3d('0x45')]})[_0xae3d('0x16')](function(_0x404f23){_0x19a084['count']=_0x404f23;if(_0x10c5fc[_0xae3d('0x26')]['includeAll']){_0x25c075[_0xae3d('0x30')]=[{'all':!![]}];}return db[_0xae3d('0x39')][_0xae3d('0x4d')](_0x25c075);})[_0xae3d('0x16')](function(_0x53140b){_0x19a084[_0xae3d('0x4e')]=_0x53140b;return _0x19a084;});}})[_0xae3d('0x16')](respondWithFilteredResult(_0x15ac7e,_0x25c075))[_0xae3d('0x34')](handleError(_0x15ac7e,null));};exports['addTags']=function(_0x20fd51,_0xbecd89){return db[_0xae3d('0x1e')][_0xae3d('0x33')]({'where':{'id':_0x20fd51[_0xae3d('0x28')]['id']}})[_0xae3d('0x16')](handleEntityNotFound(_0xbecd89,null))['then'](function(_0x513bae){if(_0x513bae){return _0x513bae[_0xae3d('0x4f')](_0x20fd51[_0xae3d('0x36')]['ids'],_[_0xae3d('0x3b')](_0x20fd51['body'],[_0xae3d('0x3a'),'id'])||{})['spread'](function(){return db['Tag'][_0xae3d('0x4d')]({'attributes':['id',_0xae3d('0x1b'),_0xae3d('0x50')],'where':{'id':_0x20fd51[_0xae3d('0x36')][_0xae3d('0x3a')]}});})[_0xae3d('0x16')](function(_0x43aafb){socket['emit'](_0xae3d('0x51'),{'id':Number(_0x20fd51['params']['id']),'tags':_0x43aafb||[]});return{'id':Number(_0x20fd51[_0xae3d('0x28')]['id']),'tags':_0x43aafb||[]};});}})[_0xae3d('0x16')](respondWithResult(_0xbecd89,null))['catch'](handleError(_0xbecd89,null));};exports[_0xae3d('0x52')]=function(_0x16cac6,_0x38c92a){return db[_0xae3d('0x1e')][_0xae3d('0x33')]({'where':{'id':_0x16cac6[_0xae3d('0x28')]['id']}})[_0xae3d('0x16')](handleEntityNotFound(_0x38c92a,null))[_0xae3d('0x16')](function(_0x919766){if(_0x919766){return _0x919766[_0xae3d('0x52')](_0x16cac6[_0xae3d('0x26')]['ids']);}})[_0xae3d('0x16')](respondWithStatusCode(_0x38c92a,null))[_0xae3d('0x34')](handleError(_0x38c92a,null));};exports[_0xae3d('0x53')]=function(_0x794817,_0x4c5779){var _0xa0dba4=moment()[_0xae3d('0x54')]()['toString']();var _0x327f75=path[_0xae3d('0x55')](config[_0xae3d('0x56')],_0xae3d('0x57'),'files',_0xae3d('0x58'));var _0x314a41=path[_0xae3d('0x55')](config['root'],_0xae3d('0x57'),'files',_0xae3d('0x59'));var _0x3ef7ac=path[_0xae3d('0x55')](_0x327f75,_0xa0dba4);var _0x2f9775=util['format']('transcript-%d-%s.zip',_0x794817[_0xae3d('0x28')]['id'],_0xa0dba4);var _0x53edc5=path[_0xae3d('0x55')](_0x327f75,_0x2f9775);var _0x1f0f4c=[];_0x1f0f4c[_0xae3d('0x5a')]({'model':db[_0xae3d('0x5b')],'as':_0xae3d('0x5b'),'attributes':['id',_0xae3d('0x5c')],'raw':!![]});_0x1f0f4c[_0xae3d('0x5a')]({'model':db['CmContact'],'as':'Contact','attributes':['id','firstName',_0xae3d('0x5d')],'raw':!![]});if(_0x794817[_0xae3d('0x26')][_0xae3d('0x59')]){_0x1f0f4c['push']({'model':db[_0xae3d('0x5e')],'as':_0xae3d('0x5e'),'raw':!![]});}var _0x37f70d=[{'model':db[_0xae3d('0x39')],'as':'Messages','attributes':['id',_0xae3d('0x36'),_0xae3d('0x5f'),_0xae3d('0x60'),_0xae3d('0x61'),_0xae3d('0x62')],'include':_0x1f0f4c}];_0x37f70d[_0xae3d('0x5a')]({'model':db[_0xae3d('0x63')],'as':_0xae3d('0x64'),'attributes':['id',_0xae3d('0x1b')]});_0x37f70d[_0xae3d('0x5a')]({'model':db[_0xae3d('0x5b')],'as':_0xae3d('0x65'),'attributes':['id',_0xae3d('0x5c')]});return db[_0xae3d('0x1e')][_0xae3d('0x33')]({'where':{'id':_0x794817[_0xae3d('0x28')]['id']},'include':_0x37f70d})['then'](handleEntityNotFound(_0x4c5779,null))[_0xae3d('0x16')](function(_0x3f0c29){if(_0x3f0c29){var _0x3a29c6=_0x3f0c29['get']({'plain':!![]});fs[_0xae3d('0x66')](_0x3ef7ac);var _0x4cd02c={'channel':_0xae3d('0x67'),'account':_0x3a29c6[_0xae3d('0x64')][_0xae3d('0x1b')],'agent':_0x3a29c6[_0xae3d('0x65')]?_0x3a29c6['Owner'][_0xae3d('0x5c')]:_0xae3d('0x68'),'createdAt':moment(_0x3a29c6[_0xae3d('0x5f')])[_0xae3d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x3a29c6[_0xae3d('0x69')]?moment(_0x3a29c6[_0xae3d('0x6a')])['format'](_0xae3d('0x4c'))['toString']():'','disposition':_0x3a29c6['disposition'],'visibility':_0x3a29c6[_0xae3d('0x6b')]?'Public':_0xae3d('0x6c'),'messages':_(_0x3a29c6[_0xae3d('0x6d')])[_0xae3d('0x47')]({'secret':![]})['map'](function(_0x1f1849){if(_0x1f1849['Attachment']){var _0x370627=path['join'](_0x314a41,_0x1f1849[_0xae3d('0x5e')][_0xae3d('0x6e')]);if(fs['existsSync'](_0x370627)){fs[_0xae3d('0x6f')](_0x370627)[_0xae3d('0x70')](fs[_0xae3d('0x71')](path[_0xae3d('0x55')](_0x3ef7ac,_0x1f1849[_0xae3d('0x5e')][_0xae3d('0x6e')])));}}return{'date':moment(_0x1f1849[_0xae3d('0x5f')])[_0xae3d('0x4b')](_0xae3d('0x4c'))[_0xae3d('0x72')](),'sender':_0x1f1849[_0xae3d('0x60')]===_0xae3d('0x73')?_0x1f1849['User']?_0x1f1849['User'][_0xae3d('0x5c')]:_0xae3d('0x74'):_0x1f1849['Contact'][_0xae3d('0x75')]+(_0x1f1849[_0xae3d('0x76')][_0xae3d('0x5d')]?'\x20'+_0x1f1849['Contact'][_0xae3d('0x5d')]:''),'body':_0x1f1849[_0xae3d('0x5e')]?_0x1f1849[_0xae3d('0x5e')][_0xae3d('0x6e')]:_0x1f1849[_0xae3d('0x36')],'direction':_0x1f1849[_0xae3d('0x60')]===_0xae3d('0x73')?'A':'C','secret':_0x1f1849[_0xae3d('0x61')],'read':_0x1f1849[_0xae3d('0x62')],'attachment':_0x1f1849[_0xae3d('0x5e')]};})[_0xae3d('0x77')]()};return ejs[_0xae3d('0x78')](path[_0xae3d('0x55')](config[_0xae3d('0x56')],_0xae3d('0x57'),_0xae3d('0x79'),_0xae3d('0x7a')),{'interaction':_0x4cd02c})[_0xae3d('0x16')](function(_0x8e9df){var _0x5fcaaf=path[_0xae3d('0x55')](_0x3ef7ac,_0xae3d('0x7b')+_0x3a29c6['id']+'-'+_0xa0dba4+_0xae3d('0x7c'));var _0x4c47c2={'path':_0x5fcaaf,'channel':_0xae3d('0x67'),'interactionId':_0x3a29c6['id']};return pdf[_0xae3d('0x7d')](_0x8e9df,_0x4c47c2);})['then'](function(){return new Promise(function(_0x3e68da,_0x41f1b7){zipdir(_0x3ef7ac,{'saveTo':_0x53edc5},function(_0x436f60,_0x120ceb){if(_0x436f60)return _0x41f1b7(_0x436f60);return _0x3e68da(_0x120ceb);});})[_0xae3d('0x16')](function(){return new Promise(function(_0x55357f,_0x445eb7){rimraf(_0x3ef7ac,function(_0x4ca2ef){if(_0x4ca2ef)_0x445eb7(_0x4ca2ef);return _0x55357f();});});})[_0xae3d('0x16')](function(){return _0x4c5779['download'](_0x53edc5,_0x2f9775,function(_0x34c680){if(_0x34c680){logger[_0xae3d('0x19')](_0xae3d('0x7e'),_0x34c680);}else{fs[_0xae3d('0x7f')](_0x53edc5);}});});});}else{return _0x4c5779[_0xae3d('0x18')](0xc8);}})[_0xae3d('0x34')](handleError(_0x4c5779,null));}; \ No newline at end of file +var _0x8f97=['$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','Tag','findAll','name','color','emit','removeTags','download','unix','toString','join','root','tmp','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','existsSync','createReadStream','pipe','basename','out','Contact','renderFile','server','views','downloadInteraction.ejs','transcript-','.pdf','error','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','stack','rawAttributes','openchannel','query','user','catch','show','type','from','model','keys','OpenchannelInteraction','filters','intersection','fields','attributes','length','includeAll','include','options','find','create','body','params','describe','addMessage','ids','OpenchannelMessage','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','merge','map'];(function(_0x6e29c6,_0x4fbf79){var _0xcae3b6=function(_0x2b6e00){while(--_0x2b6e00){_0x6e29c6['push'](_0x6e29c6['shift']());}};_0xcae3b6(++_0x4fbf79);}(_0x8f97,0x141));var _0x78f9=function(_0x43d701,_0x4bb2e9){_0x43d701=_0x43d701-0x0;var _0x2ec4c6=_0x8f97[_0x43d701];return _0x2ec4c6;};'use strict';var rimraf=require(_0x78f9('0x0'));var zipdir=require(_0x78f9('0x1'));var moment=require(_0x78f9('0x2'));var util=require(_0x78f9('0x3'));var path=require(_0x78f9('0x4'));var ejs=require(_0x78f9('0x5'));var fs=require('fs');var _=require(_0x78f9('0x6'));var Redis=require(_0x78f9('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x78f9('0x8'));var pdf=require(_0x78f9('0x9'));var logger=require(_0x78f9('0xa'))(_0x78f9('0xb'));var config=require('../../config/environment');var db=require(_0x78f9('0xc'))['db'];config[_0x78f9('0xd')]=_[_0x78f9('0xe')](config[_0x78f9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x78f9('0xf'))(new Redis(config[_0x78f9('0xd')]));require(_0x78f9('0x10'))[_0x78f9('0x11')](socket);function respondWithStatusCode(_0x27f4a3,_0x12e59c){_0x12e59c=_0x12e59c||0xcc;return function(_0x59874b){if(_0x59874b){return _0x27f4a3[_0x78f9('0x12')](_0x12e59c);}return _0x27f4a3['status'](_0x12e59c)[_0x78f9('0x13')]();};}function respondWithResult(_0x4f4eed,_0x9bafb8){_0x9bafb8=_0x9bafb8||0xc8;return function(_0x3e2e9b){if(_0x3e2e9b){return _0x4f4eed[_0x78f9('0x14')](_0x9bafb8)[_0x78f9('0x15')](_0x3e2e9b);}};}function respondWithFilteredResult(_0x8fb966,_0x3d2021){return function(_0x38d2ce){if(_0x38d2ce){var _0x2b94de=typeof _0x3d2021[_0x78f9('0x16')]===_0x78f9('0x17')&&typeof _0x3d2021['limit']===_0x78f9('0x17');var _0x20abab=_0x38d2ce[_0x78f9('0x18')];var _0x57d0c7=_0x2b94de?0x0:_0x3d2021['offset'];var _0x2aebb2=_0x2b94de?_0x38d2ce[_0x78f9('0x18')]:_0x3d2021[_0x78f9('0x16')]+_0x3d2021[_0x78f9('0x19')];var _0x460718;if(_0x2aebb2>=_0x20abab){_0x2aebb2=_0x20abab;_0x460718=0xc8;}else{_0x460718=0xce;}_0x8fb966[_0x78f9('0x14')](_0x460718);return _0x8fb966[_0x78f9('0x1a')](_0x78f9('0x1b'),_0x57d0c7+'-'+_0x2aebb2+'/'+_0x20abab)[_0x78f9('0x15')](_0x38d2ce);}return null;};}function saveUpdates(_0x2f72bf){return function(_0x373fc1){if(_0x373fc1){return _0x373fc1[_0x78f9('0x1c')](_0x2f72bf)[_0x78f9('0x1d')](function(_0x9c0abe){return _0x9c0abe;});}return null;};}function removeEntity(_0x20ebc5){return function(_0x57a531){if(_0x57a531){return _0x57a531[_0x78f9('0x1e')]()['then'](function(){_0x20ebc5[_0x78f9('0x14')](0xcc)[_0x78f9('0x13')]();});}};}function handleEntityNotFound(_0x1940b5){return function(_0x2fa897){if(!_0x2fa897){_0x1940b5[_0x78f9('0x12')](0x194);}return _0x2fa897;};}function handleError(_0x4b1daf,_0x95e347){_0x95e347=_0x95e347||0x1f4;return function(_0x1bbdd9){logger['error'](_0x1bbdd9[_0x78f9('0x1f')]);if(_0x1bbdd9['name']){delete _0x1bbdd9['name'];}_0x4b1daf[_0x78f9('0x14')](_0x95e347)['send'](_0x1bbdd9);};}exports['index']=function(_0x2091f7,_0x37088f){var _0x18f5c4={};var _0x5ea63e=_['map'](db['OpenchannelInteraction'][_0x78f9('0x20')],function(_0x309e08){return{'name':_0x309e08['fieldName'],'type':_0x309e08['type']['key']};});_0x18f5c4=qs['getOptions'](_0x5ea63e,_0x2091f7);return interaction['findAll'](_0x78f9('0x21'),_0x2091f7[_0x78f9('0x22')],_0x2091f7[_0x78f9('0x23')],_0x18f5c4,_0x5ea63e)[_0x78f9('0x1d')](respondWithFilteredResult(_0x37088f,_0x18f5c4))[_0x78f9('0x24')](handleError(_0x37088f,null));};exports[_0x78f9('0x25')]=function(_0x250831,_0x26021a){var _0x352a45={};if(_0x250831[_0x78f9('0x22')][_0x78f9('0x26')]&&_0x250831[_0x78f9('0x22')]['type']===_0x78f9('0x27')){_0x352a45[_0x78f9('0x27')]=_0x250831['params']['id'];}else{_0x352a45['id']=_0x250831['params']['id'];}var _0x458abd={'raw':![],'where':_0x352a45},_0x13ec90={};_0x13ec90[_0x78f9('0x28')]=_[_0x78f9('0x29')](db[_0x78f9('0x2a')][_0x78f9('0x20')]);_0x13ec90['query']=_[_0x78f9('0x29')](_0x250831[_0x78f9('0x22')]);_0x13ec90[_0x78f9('0x2b')]=_[_0x78f9('0x2c')](_0x13ec90[_0x78f9('0x28')],_0x13ec90[_0x78f9('0x22')]);_0x458abd['attributes']=_[_0x78f9('0x2c')](_0x13ec90[_0x78f9('0x28')],qs[_0x78f9('0x2d')](_0x250831['query'][_0x78f9('0x2d')]));_0x458abd['attributes']=_0x458abd[_0x78f9('0x2e')][_0x78f9('0x2f')]?_0x458abd[_0x78f9('0x2e')]:_0x13ec90[_0x78f9('0x28')];if(_0x250831[_0x78f9('0x22')][_0x78f9('0x30')]){_0x458abd[_0x78f9('0x31')]=[{'all':!![]}];}_0x458abd=_['merge']({},_0x458abd,_0x250831[_0x78f9('0x32')]);return db['OpenchannelInteraction'][_0x78f9('0x33')](_0x458abd)[_0x78f9('0x1d')](handleEntityNotFound(_0x26021a,null))['then'](respondWithResult(_0x26021a,null))['catch'](handleError(_0x26021a,null));};exports[_0x78f9('0x34')]=function(_0x1ce850,_0xc950d9){return db[_0x78f9('0x2a')][_0x78f9('0x34')](_0x1ce850['body'],{})[_0x78f9('0x1d')](respondWithResult(_0xc950d9,0xc9))[_0x78f9('0x24')](handleError(_0xc950d9,null));};exports['update']=function(_0x1698fe,_0x406e8f){if(_0x1698fe['body']['id']){delete _0x1698fe[_0x78f9('0x35')]['id'];}return db['OpenchannelInteraction'][_0x78f9('0x33')]({'where':{'id':_0x1698fe[_0x78f9('0x36')]['id']}})[_0x78f9('0x1d')](handleEntityNotFound(_0x406e8f,null))[_0x78f9('0x1d')](saveUpdates(_0x1698fe[_0x78f9('0x35')],null))['then'](respondWithResult(_0x406e8f,null))[_0x78f9('0x24')](handleError(_0x406e8f,null));};exports[_0x78f9('0x1e')]=function(_0x204461,_0x25925a){return db[_0x78f9('0x2a')][_0x78f9('0x33')]({'where':{'id':_0x204461[_0x78f9('0x36')]['id']}})[_0x78f9('0x1d')](handleEntityNotFound(_0x25925a,null))['then'](removeEntity(_0x25925a,null))['catch'](handleError(_0x25925a,null));};exports['describe']=function(_0x401a12,_0x3cab27){return db['OpenchannelInteraction'][_0x78f9('0x37')]()[_0x78f9('0x1d')](respondWithResult(_0x3cab27,null))[_0x78f9('0x24')](handleError(_0x3cab27,null));};exports[_0x78f9('0x38')]=function(_0x527ac5,_0x58dbe1){return db['OpenchannelMessage'][_0x78f9('0x33')]({'where':{'id':_0x527ac5['params']['id']}})[_0x78f9('0x1d')](handleEntityNotFound(_0x58dbe1,null))[_0x78f9('0x1d')](function(_0x198c5f){if(_0x198c5f){return _0x198c5f['addMessage'](_0x527ac5[_0x78f9('0x35')][_0x78f9('0x39')],_['omit'](_0x527ac5['body'],[_0x78f9('0x39'),'id'])||{});}})[_0x78f9('0x1d')](respondWithResult(_0x58dbe1,null))['catch'](handleError(_0x58dbe1,null));};exports['getMessages']=function(_0x5994c4,_0xbfb353){var _0x416992={'raw':![],'where':{}};var _0x5758d0={};var _0x48d32d={'count':0x0,'rows':[]};return db[_0x78f9('0x2a')]['findOne']({'where':{'id':_0x5994c4[_0x78f9('0x36')]['id']}})[_0x78f9('0x1d')](handleEntityNotFound(_0xbfb353,null))[_0x78f9('0x1d')](function(_0x233405){if(_0x233405){_0x5758d0['model']=_[_0x78f9('0x29')](db[_0x78f9('0x3a')]['rawAttributes']);_0x5758d0[_0x78f9('0x22')]=_[_0x78f9('0x29')](_0x5994c4[_0x78f9('0x22')]);_0x5758d0[_0x78f9('0x2b')]=_[_0x78f9('0x2c')](_0x5758d0['model'],_0x5758d0[_0x78f9('0x22')]);_0x416992[_0x78f9('0x2e')]=_[_0x78f9('0x2c')](_0x5758d0[_0x78f9('0x28')],qs[_0x78f9('0x2d')](_0x5994c4['query']['fields']));_0x416992[_0x78f9('0x2e')]=_0x416992[_0x78f9('0x2e')]['length']?_0x416992['attributes']:_0x5758d0[_0x78f9('0x28')];if(!_0x5994c4[_0x78f9('0x22')][_0x78f9('0x3b')](_0x78f9('0x3c'))){_0x416992['limit']=qs[_0x78f9('0x19')](_0x5994c4[_0x78f9('0x22')][_0x78f9('0x19')]);_0x416992[_0x78f9('0x16')]=qs['offset'](_0x5994c4[_0x78f9('0x22')][_0x78f9('0x16')]);}_0x416992[_0x78f9('0x3d')]=qs['sort'](_0x5994c4[_0x78f9('0x22')][_0x78f9('0x3e')]);_0x416992[_0x78f9('0x3f')]=qs['filters'](_[_0x78f9('0x40')](_0x5994c4['query'],_0x5758d0[_0x78f9('0x2b')]));_0x416992[_0x78f9('0x3f')][_0x78f9('0x41')]=_0x233405['id'];if(_0x5994c4[_0x78f9('0x22')][_0x78f9('0x42')]){_0x416992[_0x78f9('0x3f')]=_[_0x78f9('0x43')](_0x416992[_0x78f9('0x3f')],{'$or':_[_0x78f9('0x44')](_0x416992[_0x78f9('0x2e')],function(_0x6f7099){var _0x249e17={};_0x249e17[_0x6f7099]={'$like':'%'+_0x5994c4[_0x78f9('0x22')]['filter']+'%'};return _0x249e17;})});}if(_0x5994c4[_0x78f9('0x22')][_0x78f9('0x45')]){var _0x43997e=_0x5994c4['query'][_0x78f9('0x45')][_0x78f9('0x46')](',');var _0x3ba043={};_0x3ba043[_0x43997e[0x0]]={'$gte':moment(_0x43997e[0x1])[_0x78f9('0x47')](_0x78f9('0x48'))};_0x416992[_0x78f9('0x3f')]=_['merge'](_0x416992[_0x78f9('0x3f')],_0x3ba043);}_0x416992=_[_0x78f9('0x43')]({},_0x416992,_0x5994c4[_0x78f9('0x32')]);return db[_0x78f9('0x3a')][_0x78f9('0x18')]({'where':_0x416992[_0x78f9('0x3f')]})[_0x78f9('0x1d')](function(_0x197257){_0x48d32d[_0x78f9('0x18')]=_0x197257;if(_0x5994c4[_0x78f9('0x22')][_0x78f9('0x30')]){_0x416992[_0x78f9('0x31')]=[{'all':!![]}];}return db[_0x78f9('0x3a')]['findAll'](_0x416992);})['then'](function(_0x2d7647){_0x48d32d[_0x78f9('0x49')]=_0x2d7647;return _0x48d32d;});}})[_0x78f9('0x1d')](respondWithFilteredResult(_0xbfb353,_0x416992))['catch'](handleError(_0xbfb353,null));};exports[_0x78f9('0x4a')]=function(_0x131e88,_0x12ea73){return db[_0x78f9('0x2a')][_0x78f9('0x33')]({'where':{'id':_0x131e88[_0x78f9('0x36')]['id']}})['then'](handleEntityNotFound(_0x12ea73,null))[_0x78f9('0x1d')](function(_0x50505d){if(_0x50505d){return _0x50505d[_0x78f9('0x4b')](_0x131e88[_0x78f9('0x35')][_0x78f9('0x39')],_[_0x78f9('0x4c')](_0x131e88['body'],[_0x78f9('0x39'),'id'])||{})['spread'](function(){return db[_0x78f9('0x4d')][_0x78f9('0x4e')]({'attributes':['id',_0x78f9('0x4f'),_0x78f9('0x50')],'where':{'id':_0x131e88[_0x78f9('0x35')][_0x78f9('0x39')]}});})[_0x78f9('0x1d')](function(_0x42c551){socket[_0x78f9('0x51')]('openchannelInteractionTags:save',{'id':Number(_0x131e88[_0x78f9('0x36')]['id']),'tags':_0x42c551||[]});return{'id':Number(_0x131e88[_0x78f9('0x36')]['id']),'tags':_0x42c551||[]};});}})['then'](respondWithResult(_0x12ea73,null))[_0x78f9('0x24')](handleError(_0x12ea73,null));};exports[_0x78f9('0x52')]=function(_0x362388,_0x17587a){return db[_0x78f9('0x2a')]['find']({'where':{'id':_0x362388['params']['id']}})['then'](handleEntityNotFound(_0x17587a,null))[_0x78f9('0x1d')](function(_0x51bcac){if(_0x51bcac){return _0x51bcac[_0x78f9('0x52')](_0x362388['query'][_0x78f9('0x39')]);}})[_0x78f9('0x1d')](respondWithStatusCode(_0x17587a,null))[_0x78f9('0x24')](handleError(_0x17587a,null));};exports[_0x78f9('0x53')]=function(_0x51fe51,_0x35589e){var _0x3293c3=moment()[_0x78f9('0x54')]()[_0x78f9('0x55')]();var _0x16803b=path[_0x78f9('0x56')](config[_0x78f9('0x57')],'server','files',_0x78f9('0x58'));var _0x3ce049=path[_0x78f9('0x56')](config[_0x78f9('0x57')],'server',_0x78f9('0x59'),_0x78f9('0x5a'));var _0x14e90b=path[_0x78f9('0x56')](_0x16803b,_0x3293c3);var _0x587c16=util['format'](_0x78f9('0x5b'),_0x51fe51['params']['id'],_0x3293c3);var _0x1cd2d4=path[_0x78f9('0x56')](_0x16803b,_0x587c16);var _0x5c90fa=[];_0x5c90fa[_0x78f9('0x5c')]({'model':db[_0x78f9('0x5d')],'as':_0x78f9('0x5d'),'attributes':['id',_0x78f9('0x5e')],'raw':!![]});_0x5c90fa[_0x78f9('0x5c')]({'model':db[_0x78f9('0x5f')],'as':'Contact','attributes':['id',_0x78f9('0x60'),_0x78f9('0x61')],'raw':!![]});if(_0x51fe51[_0x78f9('0x22')]['attachments']){_0x5c90fa[_0x78f9('0x5c')]({'model':db['Attachment'],'as':_0x78f9('0x62'),'raw':!![]});}var _0x2370b2=[{'model':db[_0x78f9('0x3a')],'as':_0x78f9('0x63'),'attributes':['id','body',_0x78f9('0x64'),_0x78f9('0x65'),_0x78f9('0x66'),_0x78f9('0x67')],'include':_0x5c90fa}];_0x2370b2[_0x78f9('0x5c')]({'model':db[_0x78f9('0x68')],'as':_0x78f9('0x69'),'attributes':['id',_0x78f9('0x4f')]});_0x2370b2[_0x78f9('0x5c')]({'model':db[_0x78f9('0x5d')],'as':_0x78f9('0x6a'),'attributes':['id',_0x78f9('0x5e')]});return db['OpenchannelInteraction'][_0x78f9('0x33')]({'where':{'id':_0x51fe51['params']['id']},'include':_0x2370b2})[_0x78f9('0x1d')](handleEntityNotFound(_0x35589e,null))['then'](function(_0x313cf8){if(_0x313cf8){var _0xfb3de3=_0x313cf8[_0x78f9('0x6b')]({'plain':!![]});fs[_0x78f9('0x6c')](_0x14e90b);var _0x202310={'channel':_0x78f9('0x6d'),'account':_0xfb3de3[_0x78f9('0x69')]['name'],'agent':_0xfb3de3[_0x78f9('0x6a')]?_0xfb3de3['Owner'][_0x78f9('0x5e')]:_0x78f9('0x6e'),'createdAt':moment(_0xfb3de3['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x78f9('0x55')](),'closedAt':_0xfb3de3[_0x78f9('0x6f')]?moment(_0xfb3de3[_0x78f9('0x70')])['format'](_0x78f9('0x48'))[_0x78f9('0x55')]():'','disposition':_0xfb3de3[_0x78f9('0x71')],'visibility':_0xfb3de3[_0x78f9('0x72')]?'Public':_0x78f9('0x73'),'messages':_(_0xfb3de3[_0x78f9('0x63')])[_0x78f9('0x42')]({'secret':![]})['map'](function(_0x2acefd){if(_0x2acefd['Attachment']){var _0x5a55ac=path[_0x78f9('0x56')](_0x3ce049,_0x2acefd[_0x78f9('0x62')]['basename']);if(fs[_0x78f9('0x74')](_0x5a55ac)){fs[_0x78f9('0x75')](_0x5a55ac)[_0x78f9('0x76')](fs['createWriteStream'](path[_0x78f9('0x56')](_0x14e90b,_0x2acefd[_0x78f9('0x62')][_0x78f9('0x77')])));}}return{'date':moment(_0x2acefd['createdAt'])[_0x78f9('0x47')](_0x78f9('0x48'))[_0x78f9('0x55')](),'sender':_0x2acefd[_0x78f9('0x65')]===_0x78f9('0x78')?_0x2acefd[_0x78f9('0x5d')]?_0x2acefd[_0x78f9('0x5d')]['fullname']:'System':_0x2acefd['Contact'][_0x78f9('0x60')]+(_0x2acefd[_0x78f9('0x79')][_0x78f9('0x61')]?'\x20'+_0x2acefd[_0x78f9('0x79')][_0x78f9('0x61')]:''),'body':_0x2acefd[_0x78f9('0x62')]?_0x2acefd['Attachment'][_0x78f9('0x77')]:_0x2acefd['body'],'direction':_0x2acefd[_0x78f9('0x65')]===_0x78f9('0x78')?'A':'C','secret':_0x2acefd[_0x78f9('0x66')],'read':_0x2acefd[_0x78f9('0x67')],'attachment':_0x2acefd[_0x78f9('0x62')]};})['value']()};return ejs[_0x78f9('0x7a')](path[_0x78f9('0x56')](config[_0x78f9('0x57')],_0x78f9('0x7b'),_0x78f9('0x7c'),_0x78f9('0x7d')),{'interaction':_0x202310})[_0x78f9('0x1d')](function(_0x59efd6){var _0x5318cd=path[_0x78f9('0x56')](_0x14e90b,_0x78f9('0x7e')+_0xfb3de3['id']+'-'+_0x3293c3+_0x78f9('0x7f'));var _0x394937={'path':_0x5318cd,'channel':_0x78f9('0x6d'),'interactionId':_0xfb3de3['id']};return pdf['createPdfFromHTML'](_0x59efd6,_0x394937);})['then'](function(){return new Promise(function(_0x441441,_0x9b445f){zipdir(_0x14e90b,{'saveTo':_0x1cd2d4},function(_0x53f790,_0x322082){if(_0x53f790)return _0x9b445f(_0x53f790);return _0x441441(_0x322082);});})['then'](function(){return new Promise(function(_0x4db085,_0x1f4bb7){rimraf(_0x14e90b,function(_0x3f2aa9){if(_0x3f2aa9)_0x1f4bb7(_0x3f2aa9);return _0x4db085();});});})[_0x78f9('0x1d')](function(){return _0x35589e[_0x78f9('0x53')](_0x1cd2d4,_0x587c16,function(_0x39f909){if(_0x39f909){logger[_0x78f9('0x80')](_0x78f9('0x81'),_0x39f909);}else{fs['unlinkSync'](_0x1cd2d4);}});});});}else{return _0x35589e[_0x78f9('0x12')](0xc8);}})['catch'](handleError(_0x35589e,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index d4554b5..adb90af 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 _0x7cb5=['setDataValue','Users','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','remove','then'];(function(_0x478f5c,_0x3faee9){var _0xb4eabb=function(_0xc30d14){while(--_0xc30d14){_0x478f5c['push'](_0x478f5c['shift']());}};_0xb4eabb(++_0x3faee9);}(_0x7cb5,0x19a));var _0x57cb=function(_0x345e1c,_0x47a1c8){_0x345e1c=_0x345e1c-0x0;var _0x2b850f=_0x7cb5[_0x345e1c];return _0x2b850f;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x57cb('0x0'))['db'][_0x57cb('0x1')];var OpenchannelMessage=require(_0x57cb('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x57cb('0x2')](0x0);var events={'afterCreate':_0x57cb('0x3'),'afterUpdate':'update','afterDestroy':_0x57cb('0x4')};function emitEvent(_0xb3202d){return function(_0x191664,_0x3c42ae,_0x333c1c){_0x191664['getUsers']({'attributes':['id'],'raw':!![]})[_0x57cb('0x5')](function(_0x38f985){_0x191664[_0x57cb('0x6')](_0x57cb('0x7'),_0x38f985[_0x57cb('0x8')](function(_0x14b167){return{'id':_0x14b167['id']};}));return OpenchannelMessage[_0x57cb('0x9')]({'where':{'OpenchannelInteractionId':_0x191664['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57cb('0x5')](function(_0x7657e5){_0x191664['setDataValue'](_0x57cb('0xa'),_0x7657e5['length']);OpenchannelInteractionEvents['emit'](_0xb3202d+':'+_0x191664['id'],_0x191664);OpenchannelInteractionEvents[_0x57cb('0xb')](_0xb3202d,_0x191664);_0x333c1c(null);})[_0x57cb('0xc')](_0x333c1c(null));};}for(var e in events){if(events[_0x57cb('0xd')](e)){var event=events[e];OpenchannelInteraction[_0x57cb('0xe')](e,emitEvent(event));}}module[_0x57cb('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd2f2=['then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','remove'];(function(_0x23576d,_0x2432c7){var _0x144aff=function(_0xc42413){while(--_0xc42413){_0x23576d['push'](_0x23576d['shift']());}};_0x144aff(++_0x2432c7);}(_0xd2f2,0x73));var _0x2d2f=function(_0xf81f64,_0x136b25){_0xf81f64=_0xf81f64-0x0;var _0xf6d8f1=_0xd2f2[_0xf81f64];return _0xf6d8f1;};'use strict';var EventEmitter=require(_0x2d2f('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x2d2f('0x1')];var OpenchannelMessage=require(_0x2d2f('0x2'))['db'][_0x2d2f('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x2d2f('0x4')};function emitEvent(_0x40a519){return function(_0x2e7805,_0x2f0b69,_0xc67e0d){_0x2e7805['getUsers']({'attributes':['id'],'raw':!![]})[_0x2d2f('0x5')](function(_0x47190e){_0x2e7805[_0x2d2f('0x6')](_0x2d2f('0x7'),_0x47190e[_0x2d2f('0x8')](function(_0x3aa684){return{'id':_0x3aa684['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2e7805['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2d2f('0x5')](function(_0xc32a97){_0x2e7805['setDataValue'](_0x2d2f('0x9'),_0xc32a97[_0x2d2f('0xa')]);OpenchannelInteractionEvents['emit'](_0x40a519+':'+_0x2e7805['id'],_0x2e7805);OpenchannelInteractionEvents[_0x2d2f('0xb')](_0x40a519,_0x2e7805);_0xc67e0d(null);})['catch'](_0xc67e0d(null));};}for(var e in events){if(events[_0x2d2f('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x2d2f('0xd')](e,emitEvent(event));}}module[_0x2d2f('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 0491a07..325a6d0 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 _0x42f0=['request-promise','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x540e12,_0x4a993f){var _0x5e4e6b=function(_0xbc100d){while(--_0xbc100d){_0x540e12['push'](_0x540e12['shift']());}};_0x5e4e6b(++_0x4a993f);}(_0x42f0,0x1b4));var _0x042f=function(_0x54cdb6,_0x5ddf3e){_0x54cdb6=_0x54cdb6-0x0;var _0xeace0e=_0x42f0[_0x54cdb6];return _0xeace0e;};'use strict';var _=require(_0x042f('0x0'));var util=require(_0x042f('0x1'));var logger=require(_0x042f('0x2'))(_0x042f('0x3'));var moment=require(_0x042f('0x4'));var BPromise=require(_0x042f('0x5'));var rp=require(_0x042f('0x6'));var fs=require('fs');var path=require(_0x042f('0x7'));var rimraf=require('rimraf');var config=require(_0x042f('0x8'));var attributes=require(_0x042f('0x9'));module[_0x042f('0xa')]=function(_0x225e13,_0x38a588){return _0x225e13[_0x042f('0xb')](_0x042f('0xc'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x042f('0xd'),'collate':_0x042f('0xe'),'hooks':{'beforeUpdate':function(_0x5b2485,_0x5e9e66,_0x3939de){if(_0x5b2485['changed'](_0x042f('0xf'))){_0x5b2485['closedAt']=moment()['format'](_0x042f('0x10'));}_0x3939de(null,_0x5b2485);}}});}; \ No newline at end of file +var _0x5079=['rimraf','../../config/environment','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xff42a2,_0x43f60d){var _0xf8ab52=function(_0x2009ca){while(--_0x2009ca){_0xff42a2['push'](_0xff42a2['shift']());}};_0xf8ab52(++_0x43f60d);}(_0x5079,0x13c));var _0x9507=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x5079[_0x2ffc46];return _0x1eda8f;};'use strict';var _=require(_0x9507('0x0'));var util=require(_0x9507('0x1'));var logger=require(_0x9507('0x2'))(_0x9507('0x3'));var moment=require(_0x9507('0x4'));var BPromise=require(_0x9507('0x5'));var rp=require(_0x9507('0x6'));var fs=require('fs');var path=require(_0x9507('0x7'));var rimraf=require(_0x9507('0x8'));var config=require(_0x9507('0x9'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0x29e17a,_0x5c74ea){return _0x29e17a[_0x9507('0xa')](_0x9507('0xb'),attributes,{'tableName':_0x9507('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9507('0xd'),'hooks':{'beforeUpdate':function(_0x937133,_0x23358c,_0x34d43c){if(_0x937133[_0x9507('0xe')]('closed')){_0x937133[_0x9507('0xf')]=moment()[_0x9507('0x10')](_0x9507('0x11'));}_0x34d43c(null,_0x937133);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 622eae2..b2c57e9 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 _0x2465=['ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find'];(function(_0x5ec6a3,_0x563c0e){var _0x503920=function(_0x12888c){while(--_0x12888c){_0x5ec6a3['push'](_0x5ec6a3['shift']());}};_0x503920(++_0x563c0e);}(_0x2465,0x115));var _0x5246=function(_0x277450,_0x3bcb66){_0x277450=_0x277450-0x0;var _0x5097f1=_0x2465[_0x277450];return _0x5097f1;};'use strict';var _=require(_0x5246('0x0'));var util=require(_0x5246('0x1'));var moment=require(_0x5246('0x2'));var BPromise=require(_0x5246('0x3'));var rs=require(_0x5246('0x4'));var fs=require('fs');var Redis=require(_0x5246('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5246('0x6'));var logger=require(_0x5246('0x7'))(_0x5246('0x8'));var config=require('../../config/environment');var jayson=require(_0x5246('0x9'));var client=jayson[_0x5246('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x5246('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x5246('0xc'))(new Redis(config[_0x5246('0xb')]));require('./openchannelInteraction.socket')[_0x5246('0xd')](socket);function respondWithRpcPromise(_0x18f882,_0x1bf3a8,_0xfde8e6){return new BPromise(function(_0x38db5a,_0x183224){return client[_0x5246('0xe')](_0x18f882,_0xfde8e6)[_0x5246('0xf')](function(_0x504730){logger[_0x5246('0x10')](_0x5246('0x11'),_0x1bf3a8,_0x5246('0x12'));logger[_0x5246('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x1bf3a8,'request\x20sent',JSON[_0x5246('0x14')](_0x504730));if(_0x504730[_0x5246('0x15')]){if(_0x504730[_0x5246('0x15')]['code']===0x1f4){logger['error'](_0x5246('0x11'),_0x1bf3a8,_0x504730['error'][_0x5246('0x16')]);return _0x183224(_0x504730[_0x5246('0x15')][_0x5246('0x16')]);}logger[_0x5246('0x15')](_0x5246('0x11'),_0x1bf3a8,_0x504730[_0x5246('0x15')][_0x5246('0x16')]);return _0x38db5a(_0x504730[_0x5246('0x15')][_0x5246('0x16')]);}else{logger[_0x5246('0x10')](_0x5246('0x11'),_0x1bf3a8,_0x5246('0x12'));_0x38db5a(_0x504730[_0x5246('0x17')][_0x5246('0x16')]);}})[_0x5246('0x18')](function(_0x4e87ae){logger[_0x5246('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x1bf3a8,_0x4e87ae);_0x183224(_0x4e87ae);});});}exports[_0x5246('0x19')]=function(_0x47c2a4){var _0x32fbfb=this;return new Promise(function(_0x24f470,_0x1a3ee7){return db['OpenchannelInteraction'][_0x5246('0x1a')](_0x47c2a4[_0x5246('0x1b')],{'raw':_0x47c2a4[_0x5246('0x1c')]?_0x47c2a4[_0x5246('0x1c')][_0x5246('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47c2a4[_0x5246('0x1c')]?_0x47c2a4[_0x5246('0x1c')]['where']||null:null,'attributes':_0x47c2a4['options']?_0x47c2a4[_0x5246('0x1c')][_0x5246('0x1e')]||null:null,'limit':_0x47c2a4[_0x5246('0x1c')]?_0x47c2a4[_0x5246('0x1c')][_0x5246('0x1f')]||null:null})[_0x5246('0xf')](function(_0x5475ee){logger[_0x5246('0x10')](_0x5246('0x19'),_0x47c2a4);logger[_0x5246('0x13')](_0x5246('0x19'),_0x47c2a4,JSON[_0x5246('0x14')](_0x5475ee));_0x24f470(_0x5475ee);})[_0x5246('0x18')](function(_0x3065d3){logger[_0x5246('0x15')](_0x5246('0x19'),_0x3065d3[_0x5246('0x16')],_0x47c2a4);_0x1a3ee7(_0x32fbfb['error'](0x1f4,_0x3065d3['message']));});});};exports[_0x5246('0x20')]=function(_0x31f855){return new Promise(function(_0x19aa70,_0x57b2c4){return db[_0x5246('0x21')][_0x5246('0x22')]({'where':_0x31f855['options']?_0x31f855[_0x5246('0x1c')]['where']||null:null})[_0x5246('0xf')](function(_0x3fec1b){if(_0x3fec1b){return _0x3fec1b['addTags'](_0x31f855[_0x5246('0x1b')][_0x5246('0x23')],_[_0x5246('0x24')](_0x31f855['body'],['ids','id'])||{});}})[_0x5246('0x25')](function(_0x252142){logger[_0x5246('0x10')](_0x5246('0x26'),_0x31f855);logger[_0x5246('0x13')]('AddTags',_0x31f855,JSON[_0x5246('0x14')](_0x252142));_0x19aa70(_0x252142);})[_0x5246('0x18')](function(_0x2fbed6){logger['error'](_0x5246('0x26'),_0x2fbed6[_0x5246('0x16')],_0x31f855);_0x57b2c4(_this[_0x5246('0x15')](0x1f4,_0x2fbed6[_0x5246('0x16')]));});});}; \ No newline at end of file +var _0x087f=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','UpdateOpenchannelInteraction','body','options','raw','where','limit','OpenchannelInteraction','find','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','OpenchannelInteraction,\x20%s,\x20%s'];(function(_0xfbe574,_0x5a11da){var _0x34be2a=function(_0xcdc2e3){while(--_0xcdc2e3){_0xfbe574['push'](_0xfbe574['shift']());}};_0x34be2a(++_0x5a11da);}(_0x087f,0x17d));var _0xf087=function(_0x5569d7,_0x38712d){_0x5569d7=_0x5569d7-0x0;var _0x19a6e4=_0x087f[_0x5569d7];return _0x19a6e4;};'use strict';var _=require(_0xf087('0x0'));var util=require('util');var moment=require(_0xf087('0x1'));var BPromise=require(_0xf087('0x2'));var rs=require(_0xf087('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf087('0x4'))['db'];var utils=require(_0xf087('0x5'));var logger=require(_0xf087('0x6'))('rpc');var config=require(_0xf087('0x7'));var jayson=require(_0xf087('0x8'));var client=jayson[_0xf087('0x9')][_0xf087('0xa')]({'port':0x232a});config[_0xf087('0xb')]=_[_0xf087('0xc')](config[_0xf087('0xb')],{'host':_0xf087('0xd'),'port':0x18eb});var socket=require(_0xf087('0xe'))(new Redis(config[_0xf087('0xb')]));require(_0xf087('0xf'))[_0xf087('0x10')](socket);function respondWithRpcPromise(_0x26a0d9,_0x165959,_0x3d6a21){return new BPromise(function(_0x45db47,_0x738a40){return client['request'](_0x26a0d9,_0x3d6a21)[_0xf087('0x11')](function(_0x351321){logger['info'](_0xf087('0x12'),_0x165959,'request\x20sent');logger[_0xf087('0x13')](_0xf087('0x14'),_0x165959,_0xf087('0x15'),JSON[_0xf087('0x16')](_0x351321));if(_0x351321[_0xf087('0x17')]){if(_0x351321[_0xf087('0x17')][_0xf087('0x18')]===0x1f4){logger[_0xf087('0x17')](_0xf087('0x12'),_0x165959,_0x351321[_0xf087('0x17')][_0xf087('0x19')]);return _0x738a40(_0x351321['error'][_0xf087('0x19')]);}logger[_0xf087('0x17')](_0xf087('0x12'),_0x165959,_0x351321[_0xf087('0x17')][_0xf087('0x19')]);return _0x45db47(_0x351321[_0xf087('0x17')]['message']);}else{logger[_0xf087('0x1a')](_0xf087('0x12'),_0x165959,'request\x20sent');_0x45db47(_0x351321['result']['message']);}})[_0xf087('0x1b')](function(_0x4999e9){logger[_0xf087('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x165959,_0x4999e9);_0x738a40(_0x4999e9);});});}exports[_0xf087('0x1c')]=function(_0x47ec8e){var _0xe09c3d=this;return new Promise(function(_0x38f3c4,_0x529984){return db['OpenchannelInteraction']['update'](_0x47ec8e[_0xf087('0x1d')],{'raw':_0x47ec8e[_0xf087('0x1e')]?_0x47ec8e['options'][_0xf087('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47ec8e[_0xf087('0x1e')]?_0x47ec8e[_0xf087('0x1e')][_0xf087('0x20')]||null:null,'attributes':_0x47ec8e[_0xf087('0x1e')]?_0x47ec8e[_0xf087('0x1e')]['attributes']||null:null,'limit':_0x47ec8e[_0xf087('0x1e')]?_0x47ec8e['options'][_0xf087('0x21')]||null:null})[_0xf087('0x11')](function(_0x1cd821){logger[_0xf087('0x1a')](_0xf087('0x1c'),_0x47ec8e);logger['debug'](_0xf087('0x1c'),_0x47ec8e,JSON[_0xf087('0x16')](_0x1cd821));_0x38f3c4(_0x1cd821);})['catch'](function(_0x4181cd){logger[_0xf087('0x17')]('UpdateOpenchannelInteraction',_0x4181cd[_0xf087('0x19')],_0x47ec8e);_0x529984(_0xe09c3d[_0xf087('0x17')](0x1f4,_0x4181cd[_0xf087('0x19')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x297ff7){return new Promise(function(_0xcba40b,_0xb226f3){return db[_0xf087('0x22')][_0xf087('0x23')]({'where':_0x297ff7['options']?_0x297ff7[_0xf087('0x1e')][_0xf087('0x20')]||null:null})[_0xf087('0x11')](function(_0x504eb7){if(_0x504eb7){return _0x504eb7['addTags'](_0x297ff7[_0xf087('0x1d')][_0xf087('0x24')],_[_0xf087('0x25')](_0x297ff7[_0xf087('0x1d')],[_0xf087('0x24'),'id'])||{});}})[_0xf087('0x26')](function(_0x3b4c5a){logger[_0xf087('0x1a')]('AddTags',_0x297ff7);logger[_0xf087('0x13')](_0xf087('0x27'),_0x297ff7,JSON[_0xf087('0x16')](_0x3b4c5a));_0xcba40b(_0x3b4c5a);})[_0xf087('0x1b')](function(_0x3ab93b){logger[_0xf087('0x17')]('AddTags',_0x3ab93b[_0xf087('0x19')],_0x297ff7);_0xb226f3(_this[_0xf087('0x17')](0x1f4,_0x3ab93b['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index f0e48e9..85261d9 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 _0x3454=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener'];(function(_0x9afaeb,_0x3edcc3){var _0x590bcc=function(_0x36aa55){while(--_0x36aa55){_0x9afaeb['push'](_0x9afaeb['shift']());}};_0x590bcc(++_0x3edcc3);}(_0x3454,0x15a));var _0x4345=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3454[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelInteractionEvents=require(_0x4345('0x0'));var events=[_0x4345('0x1'),_0x4345('0x2'),_0x4345('0x3')];function createListener(_0xe9770c,_0x3c303c){return function(_0x4fb21e){_0x3c303c[_0x4345('0x4')](_0xe9770c,_0x4fb21e);};}function removeListener(_0x16a938,_0x18bbb8){return function(){OpenchannelInteractionEvents[_0x4345('0x5')](_0x16a938,_0x18bbb8);};}exports['register']=function(_0x140ad8){for(var _0x594bd4=0x0,_0x159512=events[_0x4345('0x6')];_0x594bd4<_0x159512;_0x594bd4++){var _0x851274=events[_0x594bd4];var _0x47d299=createListener(_0x4345('0x7')+_0x851274,_0x140ad8);OpenchannelInteractionEvents['on'](_0x851274,_0x47d299);}}; \ No newline at end of file +var _0xbbd8=['length','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x168bd5,_0x386e4){var _0x5b7744=function(_0x1948d5){while(--_0x1948d5){_0x168bd5['push'](_0x168bd5['shift']());}};_0x5b7744(++_0x386e4);}(_0xbbd8,0xb5));var _0x8bbd=function(_0x59803f,_0x24b913){_0x59803f=_0x59803f-0x0;var _0x2248fc=_0xbbd8[_0x59803f];return _0x2248fc;};'use strict';var OpenchannelInteractionEvents=require(_0x8bbd('0x0'));var events=[_0x8bbd('0x1'),_0x8bbd('0x2'),_0x8bbd('0x3')];function createListener(_0x4a5144,_0x58cd91){return function(_0x26cb89){_0x58cd91[_0x8bbd('0x4')](_0x4a5144,_0x26cb89);};}function removeListener(_0x22628b,_0x221089){return function(){OpenchannelInteractionEvents['removeListener'](_0x22628b,_0x221089);};}exports['register']=function(_0x4bdb56){for(var _0x45b152=0x0,_0x64c9cc=events[_0x8bbd('0x5')];_0x45b152<_0x64c9cc;_0x45b152++){var _0x966553=events[_0x45b152];var _0x27dbb1=createListener('openchannelInteraction:'+_0x966553,_0x4bdb56);OpenchannelInteractionEvents['on'](_0x966553,_0x27dbb1);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 83899de..4122598 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(_0x46d041,_0x4b80db){var _0x294f8a=function(_0x3ba9f4){while(--_0x3ba9f4){_0x46d041['push'](_0x46d041['shift']());}};_0x294f8a(++_0x4b80db);}(_0xcb91,0x1a9));var _0x1cb9=function(_0xf44d98,_0x12a472){_0xf44d98=_0xf44d98-0x0;var _0x5ebb04=_0xcb91[_0xf44d98];return _0x5ebb04;};'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 _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x575aa7,_0x1ef0d7){_0x575aa7=_0x575aa7-0x0;var _0x3cadd9=_0x70e0[_0x575aa7];return _0x3cadd9;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0a303dc..4cbc617 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 _0xa866=['out','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xa866,0x6a));var _0x6a86=function(_0x2c9c30,_0x34046c){_0x2c9c30=_0x2c9c30-0x0;var _0x15eb6b=_0xa866[_0x2c9c30];return _0x15eb6b;};'use strict';var Sequelize=require(_0x6a86('0x0'));module[_0x6a86('0x1')]={'body':{'type':Sequelize[_0x6a86('0x2')](_0x6a86('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6a86('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6a86('0x5')]('in',_0x6a86('0x6')),'defaultValue':_0x6a86('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x6a86('0x7')]},'providerResponse':{'type':Sequelize[_0x6a86('0x2')]}}; \ No newline at end of file +var _0x0490=['DATE','STRING','TEXT','exports','ENUM','out'];(function(_0x57d925,_0x5a951b){var _0xfcd3b4=function(_0x601ae6){while(--_0x601ae6){_0x57d925['push'](_0x57d925['shift']());}};_0xfcd3b4(++_0x5a951b);}(_0x0490,0x147));var _0x0049=function(_0x9e9414,_0x182692){_0x9e9414=_0x9e9414-0x0;var _0x4d2ede=_0x0490[_0x9e9414];return _0x4d2ede;};'use strict';var Sequelize=require('sequelize');module[_0x0049('0x0')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0049('0x1')]('in',_0x0049('0x2')),'defaultValue':_0x0049('0x2'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0049('0x3')]},'providerName':{'type':Sequelize[_0x0049('0x4')]},'providerResponse':{'type':Sequelize[_0x0049('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 181263a..71defd6 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 _0x5dc4=['name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','OpenchannelMessage','includeAll','include','rows','show','params','create','body','find','describe','openchannel-interactions','accept','openchannel','format','UserId','agent','get','OpenchannelInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack'];(function(_0x4b73ff,_0x3ac4e7){var _0x5c1d04=function(_0x42fa0c){while(--_0x42fa0c){_0x4b73ff['push'](_0x4b73ff['shift']());}};_0x5c1d04(++_0x3ac4e7);}(_0x5dc4,0x154));var _0x45dc=function(_0x385949,_0x2bdd09){_0x385949=_0x385949-0x0;var _0x2990b5=_0x5dc4[_0x385949];return _0x2990b5;};'use strict';var emlformat=require(_0x45dc('0x0'));var rimraf=require(_0x45dc('0x1'));var zipdir=require(_0x45dc('0x2'));var jsonpatch=require(_0x45dc('0x3'));var rp=require(_0x45dc('0x4'));var moment=require(_0x45dc('0x5'));var BPromise=require(_0x45dc('0x6'));var Mustache=require(_0x45dc('0x7'));var util=require(_0x45dc('0x8'));var path=require('path');var sox=require(_0x45dc('0x9'));var csv=require(_0x45dc('0xa'));var ejs=require(_0x45dc('0xb'));var fs=require('fs');var fs_extra=require(_0x45dc('0xc'));var _=require('lodash');var squel=require(_0x45dc('0xd'));var crypto=require(_0x45dc('0xe'));var jsforce=require(_0x45dc('0xf'));var deskjs=require(_0x45dc('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x45dc('0x11'));var authService=require(_0x45dc('0x12'));var qs=require(_0x45dc('0x13'));var as=require(_0x45dc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45dc('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x45dc('0x16'));var licenseUtil=require(_0x45dc('0x17'));var db=require('../../mysqldb')['db'];config[_0x45dc('0x18')]=_[_0x45dc('0x19')](config[_0x45dc('0x18')],{'host':_0x45dc('0x1a'),'port':0x18eb});var socket=require(_0x45dc('0x1b'))(new Redis(config[_0x45dc('0x18')]));require(_0x45dc('0x1c'))[_0x45dc('0x1d')](socket);var jayson=require(_0x45dc('0x1e'));var client=jayson[_0x45dc('0x1f')][_0x45dc('0x20')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x50a52b,_0x3aac55,_0x25de4a,_0x18f7fe){return new BPromise(function(_0x59ee4b,_0x40f99b){var _0x259c95=_0x18f7fe||client;return _0x259c95[_0x45dc('0x21')](_0x50a52b,_0x25de4a)['then'](function(_0x53592f){logger[_0x45dc('0x22')](_0x45dc('0x23'),_0x3aac55,_0x45dc('0x24'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3aac55,_0x45dc('0x24'),JSON[_0x45dc('0x25')](_0x53592f));if(_0x53592f[_0x45dc('0x26')]){if(_0x53592f[_0x45dc('0x26')][_0x45dc('0x27')]===0x1f4){logger['error'](_0x45dc('0x23'),_0x3aac55,_0x53592f[_0x45dc('0x26')]['message']);return _0x40f99b(_0x53592f[_0x45dc('0x26')]['message']);}logger[_0x45dc('0x26')](_0x45dc('0x23'),_0x3aac55,_0x53592f['error'][_0x45dc('0x28')]);return _0x59ee4b(_0x53592f[_0x45dc('0x26')]['message']);}else{logger['info'](_0x45dc('0x23'),_0x3aac55,_0x45dc('0x24'));_0x59ee4b(_0x53592f[_0x45dc('0x29')]['message']);}})[_0x45dc('0x2a')](function(_0x22cb0b){logger[_0x45dc('0x26')](_0x45dc('0x23'),_0x3aac55,_0x22cb0b);_0x40f99b(_0x22cb0b);});});}function respondWithStatusCode(_0x52ffc2,_0x16b96b){_0x16b96b=_0x16b96b||0xcc;return function(_0x1338c4){if(_0x1338c4){return _0x52ffc2[_0x45dc('0x2b')](_0x16b96b);}return _0x52ffc2[_0x45dc('0x2c')](_0x16b96b)['end']();};}function respondWithResult(_0x394d1b,_0x16ff98){_0x16ff98=_0x16ff98||0xc8;return function(_0x545b13){if(_0x545b13){return _0x394d1b[_0x45dc('0x2c')](_0x16ff98)[_0x45dc('0x2d')](_0x545b13);}};}function respondWithFilteredResult(_0x32a65a,_0x1414b5){return function(_0x3ae457){if(_0x3ae457){var _0x2f7d57=typeof _0x1414b5[_0x45dc('0x2e')]===_0x45dc('0x2f')&&typeof _0x1414b5[_0x45dc('0x30')]===_0x45dc('0x2f');var _0x1f6b4a=_0x3ae457['count'];var _0x3178a1=_0x2f7d57?0x0:_0x1414b5[_0x45dc('0x2e')];var _0x5e8952=_0x2f7d57?_0x3ae457[_0x45dc('0x31')]:_0x1414b5[_0x45dc('0x2e')]+_0x1414b5[_0x45dc('0x30')];var _0x42846d;if(_0x5e8952>=_0x1f6b4a){_0x5e8952=_0x1f6b4a;_0x42846d=0xc8;}else{_0x42846d=0xce;}_0x32a65a[_0x45dc('0x2c')](_0x42846d);return _0x32a65a[_0x45dc('0x32')](_0x45dc('0x33'),_0x3178a1+'-'+_0x5e8952+'/'+_0x1f6b4a)[_0x45dc('0x2d')](_0x3ae457);}return null;};}function patchUpdates(_0x22c966){return function(_0x2f440a){try{jsonpatch[_0x45dc('0x34')](_0x2f440a,_0x22c966,!![]);}catch(_0x52b8a4){return BPromise[_0x45dc('0x35')](_0x52b8a4);}return _0x2f440a[_0x45dc('0x36')]();};}function saveUpdates(_0x48b798,_0x5693fd){return function(_0x4c516f){if(_0x4c516f){return _0x4c516f[_0x45dc('0x37')](_0x48b798)[_0x45dc('0x38')](function(_0x453cf0){return _0x453cf0;});}return null;};}function removeEntity(_0x40df55,_0x544624){return function(_0x220d9b){if(_0x220d9b){return _0x220d9b[_0x45dc('0x39')]()[_0x45dc('0x38')](function(){_0x40df55[_0x45dc('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fba68,_0x3133c8){return function(_0xa24def){if(!_0xa24def){_0x1fba68[_0x45dc('0x2b')](0x194);}return _0xa24def;};}function handleError(_0x265a61,_0x20e5e5){_0x20e5e5=_0x20e5e5||0x1f4;return function(_0x101185){logger['error'](_0x101185[_0x45dc('0x3a')]);if(_0x101185['name']){delete _0x101185[_0x45dc('0x3b')];}_0x265a61[_0x45dc('0x2c')](_0x20e5e5)[_0x45dc('0x3c')](_0x101185);};}exports[_0x45dc('0x3d')]=function(_0x5ca319,_0x25d733){var _0x44ae0f={},_0x58dd23={},_0x1d782b={'count':0x0,'rows':[]};var _0x307743=_[_0x45dc('0x3e')](db['OpenchannelMessage'][_0x45dc('0x3f')],function(_0x3bdd1a){return{'name':_0x3bdd1a[_0x45dc('0x40')],'type':_0x3bdd1a[_0x45dc('0x41')][_0x45dc('0x42')]};});_0x58dd23[_0x45dc('0x43')]=_[_0x45dc('0x3e')](_0x307743,_0x45dc('0x3b'));_0x58dd23[_0x45dc('0x44')]=_[_0x45dc('0x45')](_0x5ca319[_0x45dc('0x44')]);_0x58dd23[_0x45dc('0x46')]=_[_0x45dc('0x47')](_0x58dd23['model'],_0x58dd23[_0x45dc('0x44')]);_0x44ae0f['attributes']=_['intersection'](_0x58dd23[_0x45dc('0x43')],qs[_0x45dc('0x48')](_0x5ca319['query'][_0x45dc('0x48')]));_0x44ae0f[_0x45dc('0x49')]=_0x44ae0f[_0x45dc('0x49')][_0x45dc('0x4a')]?_0x44ae0f['attributes']:_0x58dd23[_0x45dc('0x43')];if(!_0x5ca319['query'][_0x45dc('0x4b')](_0x45dc('0x4c'))){_0x44ae0f[_0x45dc('0x30')]=qs[_0x45dc('0x30')](_0x5ca319[_0x45dc('0x44')][_0x45dc('0x30')]);_0x44ae0f[_0x45dc('0x2e')]=qs[_0x45dc('0x2e')](_0x5ca319[_0x45dc('0x44')]['offset']);}_0x44ae0f[_0x45dc('0x4d')]=qs[_0x45dc('0x4e')](_0x5ca319[_0x45dc('0x44')][_0x45dc('0x4e')]);_0x44ae0f['where']=qs['filters'](_[_0x45dc('0x4f')](_0x5ca319[_0x45dc('0x44')],_0x58dd23[_0x45dc('0x46')]),_0x307743);if(_0x5ca319[_0x45dc('0x44')][_0x45dc('0x50')]){_0x44ae0f[_0x45dc('0x51')]=_['merge'](_0x44ae0f[_0x45dc('0x51')],{'$or':_['map'](_0x307743,function(_0x1ea6b7){if(_0x1ea6b7[_0x45dc('0x41')]!==_0x45dc('0x52')){var _0x3f3d10={};_0x3f3d10[_0x1ea6b7[_0x45dc('0x3b')]]={'$like':'%'+_0x5ca319[_0x45dc('0x44')][_0x45dc('0x50')]+'%'};return _0x3f3d10;}})});}_0x44ae0f=_[_0x45dc('0x53')]({},_0x44ae0f,_0x5ca319[_0x45dc('0x54')]);var _0x51e41e={'where':_0x44ae0f[_0x45dc('0x51')]};return db[_0x45dc('0x55')]['count'](_0x51e41e)[_0x45dc('0x38')](function(_0x2a2a07){_0x1d782b[_0x45dc('0x31')]=_0x2a2a07;if(_0x5ca319[_0x45dc('0x44')][_0x45dc('0x56')]){_0x44ae0f[_0x45dc('0x57')]=[{'all':!![]}];}return db[_0x45dc('0x55')]['findAll'](_0x44ae0f);})[_0x45dc('0x38')](function(_0x45648a){_0x1d782b[_0x45dc('0x58')]=_0x45648a;return _0x1d782b;})['then'](respondWithFilteredResult(_0x25d733,_0x44ae0f))[_0x45dc('0x2a')](handleError(_0x25d733,null));};exports[_0x45dc('0x59')]=function(_0x11b170,_0x2cf817){var _0x2523a0={'raw':!![],'where':{'id':_0x11b170[_0x45dc('0x5a')]['id']}},_0x50288e={};_0x50288e['model']=_[_0x45dc('0x45')](db[_0x45dc('0x55')]['rawAttributes']);_0x50288e[_0x45dc('0x44')]=_[_0x45dc('0x45')](_0x11b170[_0x45dc('0x44')]);_0x50288e['filters']=_[_0x45dc('0x47')](_0x50288e[_0x45dc('0x43')],_0x50288e[_0x45dc('0x44')]);_0x2523a0[_0x45dc('0x49')]=_[_0x45dc('0x47')](_0x50288e['model'],qs[_0x45dc('0x48')](_0x11b170[_0x45dc('0x44')][_0x45dc('0x48')]));_0x2523a0[_0x45dc('0x49')]=_0x2523a0[_0x45dc('0x49')]['length']?_0x2523a0[_0x45dc('0x49')]:_0x50288e[_0x45dc('0x43')];if(_0x11b170[_0x45dc('0x44')][_0x45dc('0x56')]){_0x2523a0[_0x45dc('0x57')]=[{'all':!![]}];}_0x2523a0=_[_0x45dc('0x53')]({},_0x2523a0,_0x11b170[_0x45dc('0x54')]);return db[_0x45dc('0x55')]['find'](_0x2523a0)['then'](handleEntityNotFound(_0x2cf817,null))['then'](respondWithResult(_0x2cf817,null))['catch'](handleError(_0x2cf817,null));};exports[_0x45dc('0x5b')]=function(_0x429d49,_0x56ee87){return db['OpenchannelMessage'][_0x45dc('0x5b')](_0x429d49['body'],{})[_0x45dc('0x38')](respondWithResult(_0x56ee87,0xc9))[_0x45dc('0x2a')](handleError(_0x56ee87,null));};exports[_0x45dc('0x37')]=function(_0x18cc40,_0x43f8f3){if(_0x18cc40['body']['id']){delete _0x18cc40[_0x45dc('0x5c')]['id'];}return db[_0x45dc('0x55')][_0x45dc('0x5d')]({'where':{'id':_0x18cc40[_0x45dc('0x5a')]['id']}})[_0x45dc('0x38')](handleEntityNotFound(_0x43f8f3,null))[_0x45dc('0x38')](saveUpdates(_0x18cc40[_0x45dc('0x5c')],null))['then'](respondWithResult(_0x43f8f3,null))[_0x45dc('0x2a')](handleError(_0x43f8f3,null));};exports[_0x45dc('0x39')]=function(_0x21de54,_0xae180e){return db['OpenchannelMessage'][_0x45dc('0x5d')]({'where':{'id':_0x21de54[_0x45dc('0x5a')]['id']}})[_0x45dc('0x38')](handleEntityNotFound(_0xae180e,null))[_0x45dc('0x38')](removeEntity(_0xae180e,null))[_0x45dc('0x2a')](handleError(_0xae180e,null));};exports['describe']=function(_0x583e5e,_0x1bde3a){return db['OpenchannelMessage'][_0x45dc('0x5e')]()[_0x45dc('0x38')](respondWithResult(_0x1bde3a,null))[_0x45dc('0x2a')](handleError(_0x1bde3a,null));};var interaction_log=require(_0x45dc('0x15'))(_0x45dc('0x5f'));exports[_0x45dc('0x60')]=function(_0x361c95,_0xab4ed8,_0x27e493){var _0x763205={'agent':{},'channel':_0x45dc('0x61')};if(_0x361c95[_0x45dc('0x5c')]['id']){delete _0x361c95[_0x45dc('0x5c')]['id'];}_0x361c95[_0x45dc('0x5c')]['read']=!![];_0x361c95[_0x45dc('0x5c')]['readAt']=moment()[_0x45dc('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x361c95[_0x45dc('0x5c')][_0x45dc('0x63')]=_0x361c95[_0x45dc('0x5c')][_0x45dc('0x63')]||_0x361c95['user']['id'];_0x763205[_0x45dc('0x64')]['id']=_0x361c95['body'][_0x45dc('0x63')];return db['OpenchannelMessage']['find']({'where':{'id':_0x361c95['params']['id'],'UserId':null}})[_0x45dc('0x38')](handleEntityNotFound(_0xab4ed8,null))[_0x45dc('0x38')](saveUpdates(_0x361c95[_0x45dc('0x5c')],null))[_0x45dc('0x38')](function(_0xd4aee3){if(_0xd4aee3){_0x763205['message']=_0xd4aee3[_0x45dc('0x65')]({'plain':!![]});return db['OpenchannelInteraction'][_0x45dc('0x5d')]({'where':{'id':_0xd4aee3[_0x45dc('0x66')]}});}return null;})[_0x45dc('0x38')](handleEntityNotFound(_0xab4ed8,null))[_0x45dc('0x38')](function(_0x4101b3){if(_0x4101b3){return _0x4101b3[_0x45dc('0x37')]({'UserId':_0x361c95[_0x45dc('0x5c')][_0x45dc('0x63')],'read1stAt':_['isNil'](_0x4101b3[_0x45dc('0x67')])?moment()['format'](_0x45dc('0x68')):undefined});}return null;})[_0x45dc('0x38')](function(_0x26f7b9){if(_0x26f7b9){_0x763205[_0x45dc('0x69')]=_0x26f7b9['get']({'plain':!![]});interaction_log[_0x45dc('0x22')](_0x45dc('0x6a'),_0x361c95[_0x45dc('0x6b')]['id'],_0x361c95[_0x45dc('0x6b')][_0x45dc('0x3b')],_0x361c95['user'][_0x45dc('0x6c')],_0x763205[_0x45dc('0x69')]['id'],_0x361c95['body']?JSON[_0x45dc('0x25')](_0x361c95[_0x45dc('0x5c')]):_0x45dc('0x6d'));return respondWithRpcPromise(_0x45dc('0x6e'),'acceptMessage',_0x763205);}return null;})['then'](function(_0x502cd4){var _0x47d29b=_0x45dc('0x6f')+_0x502cd4[_0x45dc('0x28')][_0x45dc('0x70')];return db[_0x45dc('0x71')]['query'](_0x47d29b,{'type':db[_0x45dc('0x72')]['QueryTypes'][_0x45dc('0x73')],'raw':!![]})[_0x45dc('0x38')](function(_0x115271){return _0x115271;});})[_0x45dc('0x38')](function(_0x49a195){if(_0x49a195){_0x763205[_0x45dc('0x28')]['contact']=_0x49a195[0x0];if(!_0x361c95['body'][_0x45dc('0x63')])return;return db[_0x45dc('0x74')]['find']({'where':{'id':_0x361c95[_0x45dc('0x5c')][_0x45dc('0x63')],'role':_0x45dc('0x64')},'attributes':['id',_0x45dc('0x3b'),_0x45dc('0x75'),_0x45dc('0x76'),_0x45dc('0x77')],'raw':!![]});}return null;})[_0x45dc('0x38')](function(_0x4f5df7){if(!_0x4f5df7)return null;_0x763205[_0x45dc('0x28')][_0x45dc('0x64')]=_0x4f5df7;return _0x763205;})[_0x45dc('0x38')](function(_0xe67fa1){if(_0xe67fa1){if(_0x361c95[_0x45dc('0x5c')][_0x45dc('0x78')]){_0x763205[_0x45dc('0x28')][_0x45dc('0x79')]=util[_0x45dc('0x62')](_0x45dc('0x7a'),_0x361c95['user'][_0x45dc('0x3b')]);_0x763205['message'][_0x45dc('0x7b')]=_0x763205['channel'];_0x763205[_0x45dc('0x28')][_0x45dc('0x7c')]=_0x763205[_0x45dc('0x7b')];_0x763205[_0x45dc('0x28')][_0x45dc('0x7d')]=_0x45dc('0x60');return respondWithRpcPromise('EventManager',_0x45dc('0x7e'),{'event':'acceptmessage','message':_0x763205[_0x45dc('0x28')]},client9002)[_0x45dc('0x38')](function(){return _0x763205;});}return _0x763205;}return null;})['then'](respondWithResult(_0xab4ed8,null))[_0x45dc('0x2a')](handleError(_0xab4ed8,null));};var interaction_log=require(_0x45dc('0x15'))(_0x45dc('0x5f'));exports[_0x45dc('0x35')]=function(_0x46ecbb,_0x4bf4d1,_0x61199f){var _0x50f116={'agent':{},'channel':_0x45dc('0x61')};if(_0x46ecbb[_0x45dc('0x5c')]['id']){delete _0x46ecbb[_0x45dc('0x5c')]['id'];}_0x46ecbb[_0x45dc('0x5c')][_0x45dc('0x63')]=_0x46ecbb[_0x45dc('0x5c')][_0x45dc('0x63')]||_0x46ecbb[_0x45dc('0x6b')]['id'];_0x50f116[_0x45dc('0x64')]['id']=_0x46ecbb['body'][_0x45dc('0x63')];return db[_0x45dc('0x55')][_0x45dc('0x5d')]({'where':{'id':_0x46ecbb[_0x45dc('0x5a')]['id'],'UserId':null}})[_0x45dc('0x38')](handleEntityNotFound(_0x4bf4d1,null))[_0x45dc('0x38')](function(_0x446a7d){if(_0x446a7d){_0x50f116[_0x45dc('0x28')]=_0x446a7d[_0x45dc('0x65')]({'plain':!![]});return db[_0x45dc('0x7f')][_0x45dc('0x5d')]({'where':{'id':_0x446a7d[_0x45dc('0x66')]}});}return null;})[_0x45dc('0x38')](handleEntityNotFound(_0x4bf4d1,null))[_0x45dc('0x38')](function(_0x2306e2){if(_0x2306e2){_0x50f116[_0x45dc('0x69')]=_0x2306e2[_0x45dc('0x65')]({'plain':!![]});interaction_log[_0x45dc('0x22')](_0x45dc('0x80'),_0x46ecbb['user']['id'],_0x46ecbb['user'][_0x45dc('0x3b')],_0x46ecbb[_0x45dc('0x6b')][_0x45dc('0x6c')],_0x50f116['interaction']['id'],_0x46ecbb['body']?JSON[_0x45dc('0x25')](_0x46ecbb['body']):_0x45dc('0x6d'));return respondWithRpcPromise(_0x45dc('0x81'),_0x45dc('0x82'),_0x50f116);}return null;})[_0x45dc('0x38')](function(_0x4eab24){var _0x2ac1fa=_0x45dc('0x6f')+_0x4eab24[_0x45dc('0x28')][_0x45dc('0x70')];return db['sequelize']['query'](_0x2ac1fa,{'type':db[_0x45dc('0x72')]['QueryTypes'][_0x45dc('0x73')],'raw':!![]})[_0x45dc('0x38')](function(_0x376a27){return _0x376a27;});})['then'](function(_0x2c11ea){if(_0x2c11ea){_0x50f116['message'][_0x45dc('0x83')]=_0x2c11ea[0x0];if(!_0x46ecbb[_0x45dc('0x5c')][_0x45dc('0x63')])return;return db[_0x45dc('0x74')][_0x45dc('0x5d')]({'where':{'id':_0x46ecbb['body'][_0x45dc('0x63')],'role':_0x45dc('0x64')},'attributes':['id',_0x45dc('0x3b'),'fullname',_0x45dc('0x76'),_0x45dc('0x77')],'raw':!![]});}return null;})[_0x45dc('0x38')](function(_0x21321d){if(!_0x21321d)return null;_0x50f116[_0x45dc('0x28')]['agent']=_0x21321d;return _0x50f116;})['then'](function(_0x27548d){if(_0x27548d){_0x27548d['message'][_0x45dc('0x79')]=util[_0x45dc('0x62')]('SIP/%s',_0x46ecbb[_0x45dc('0x6b')][_0x45dc('0x3b')]);_0x27548d['message'][_0x45dc('0x7b')]=_0x50f116['channel'];_0x27548d[_0x45dc('0x28')][_0x45dc('0x7c')]=_0x50f116[_0x45dc('0x7b')];_0x27548d[_0x45dc('0x28')]['event']=_0x45dc('0x35');respondWithRpcPromise(_0x45dc('0x7e'),_0x45dc('0x7e'),{'event':_0x45dc('0x84'),'message':_0x27548d['message']},client9002);return _0x50f116;}return null;})[_0x45dc('0x38')](respondWithResult(_0x4bf4d1,null))[_0x45dc('0x2a')](handleError(_0x4bf4d1,null));}; \ No newline at end of file +var _0x5f6b=['zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','client','then','info','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','OpenchannelMessage,\x20%s,\x20%s','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','destroy','index','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','params','options','find','create','body','update','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId'];(function(_0x2ac622,_0x1fa2ab){var _0x58f106=function(_0x445cde){while(--_0x445cde){_0x2ac622['push'](_0x2ac622['shift']());}};_0x58f106(++_0x1fa2ab);}(_0x5f6b,0x81));var _0xb5f6=function(_0x404807,_0x510841){_0x404807=_0x404807-0x0;var _0x20cdfe=_0x5f6b[_0x404807];return _0x20cdfe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb5f6('0x0'));var jsonpatch=require(_0xb5f6('0x1'));var rp=require(_0xb5f6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb5f6('0x3'));var util=require(_0xb5f6('0x4'));var path=require('path');var sox=require(_0xb5f6('0x5'));var csv=require(_0xb5f6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb5f6('0x7'));var squel=require(_0xb5f6('0x8'));var crypto=require(_0xb5f6('0x9'));var jsforce=require(_0xb5f6('0xa'));var deskjs=require(_0xb5f6('0xb'));var toCsv=require('to-csv');var querystring=require(_0xb5f6('0xc'));var Papa=require(_0xb5f6('0xd'));var Redis=require(_0xb5f6('0xe'));var authService=require(_0xb5f6('0xf'));var qs=require(_0xb5f6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb5f6('0x11'));var logger=require(_0xb5f6('0x12'))(_0xb5f6('0x13'));var utils=require('../../config/utils');var config=require(_0xb5f6('0x14'));var licenseUtil=require(_0xb5f6('0x15'));var db=require(_0xb5f6('0x16'))['db'];config[_0xb5f6('0x17')]=_[_0xb5f6('0x18')](config[_0xb5f6('0x17')],{'host':_0xb5f6('0x19'),'port':0x18eb});var socket=require(_0xb5f6('0x1a'))(new Redis(config[_0xb5f6('0x17')]));require('./openchannelMessage.socket')[_0xb5f6('0x1b')](socket);var jayson=require(_0xb5f6('0x1c'));var client=jayson['client'][_0xb5f6('0x1d')]({'port':0x232c});var client9002=jayson[_0xb5f6('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d5823,_0xfc9507,_0x1eb805,_0x113aaf){return new BPromise(function(_0x2776c2,_0x8c3557){var _0x2ec4ce=_0x113aaf||client;return _0x2ec4ce['request'](_0x5d5823,_0x1eb805)[_0xb5f6('0x1f')](function(_0x16bb32){logger[_0xb5f6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,'request\x20sent');logger['debug'](_0xb5f6('0x21'),_0xfc9507,_0xb5f6('0x22'),JSON['stringify'](_0x16bb32));if(_0x16bb32[_0xb5f6('0x23')]){if(_0x16bb32['error'][_0xb5f6('0x24')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,_0x16bb32[_0xb5f6('0x23')]['message']);return _0x8c3557(_0x16bb32[_0xb5f6('0x23')][_0xb5f6('0x25')]);}logger[_0xb5f6('0x23')](_0xb5f6('0x26'),_0xfc9507,_0x16bb32[_0xb5f6('0x23')]['message']);return _0x2776c2(_0x16bb32['error'][_0xb5f6('0x25')]);}else{logger[_0xb5f6('0x20')]('OpenchannelMessage,\x20%s,\x20%s',_0xfc9507,'request\x20sent');_0x2776c2(_0x16bb32['result'][_0xb5f6('0x25')]);}})[_0xb5f6('0x27')](function(_0x5d4316){logger[_0xb5f6('0x23')](_0xb5f6('0x26'),_0xfc9507,_0x5d4316);_0x8c3557(_0x5d4316);});});}function respondWithStatusCode(_0x26454b,_0x37cedd){_0x37cedd=_0x37cedd||0xcc;return function(_0x3cdf89){if(_0x3cdf89){return _0x26454b[_0xb5f6('0x28')](_0x37cedd);}return _0x26454b[_0xb5f6('0x29')](_0x37cedd)[_0xb5f6('0x2a')]();};}function respondWithResult(_0x1388d8,_0x56f42c){_0x56f42c=_0x56f42c||0xc8;return function(_0x566825){if(_0x566825){return _0x1388d8[_0xb5f6('0x29')](_0x56f42c)[_0xb5f6('0x2b')](_0x566825);}};}function respondWithFilteredResult(_0x6a5707,_0xc499f1){return function(_0x29cb1a){if(_0x29cb1a){var _0x33718d=typeof _0xc499f1[_0xb5f6('0x2c')]===_0xb5f6('0x2d')&&typeof _0xc499f1[_0xb5f6('0x2e')]===_0xb5f6('0x2d');var _0x1e1941=_0x29cb1a['count'];var _0x1fe54b=_0x33718d?0x0:_0xc499f1[_0xb5f6('0x2c')];var _0xb9a9a5=_0x33718d?_0x29cb1a[_0xb5f6('0x2f')]:_0xc499f1['offset']+_0xc499f1['limit'];var _0x8d1994;if(_0xb9a9a5>=_0x1e1941){_0xb9a9a5=_0x1e1941;_0x8d1994=0xc8;}else{_0x8d1994=0xce;}_0x6a5707['status'](_0x8d1994);return _0x6a5707[_0xb5f6('0x30')]('Content-Range',_0x1fe54b+'-'+_0xb9a9a5+'/'+_0x1e1941)[_0xb5f6('0x2b')](_0x29cb1a);}return null;};}function patchUpdates(_0x5982c){return function(_0x55fb5b){try{jsonpatch[_0xb5f6('0x31')](_0x55fb5b,_0x5982c,!![]);}catch(_0x2577bc){return BPromise[_0xb5f6('0x32')](_0x2577bc);}return _0x55fb5b[_0xb5f6('0x33')]();};}function saveUpdates(_0x1c4c4a,_0x5edac4){return function(_0x1da8ee){if(_0x1da8ee){return _0x1da8ee['update'](_0x1c4c4a)[_0xb5f6('0x1f')](function(_0xf9f5f3){return _0xf9f5f3;});}return null;};}function removeEntity(_0xaa6088,_0x427ef7){return function(_0xa65512){if(_0xa65512){return _0xa65512[_0xb5f6('0x34')]()[_0xb5f6('0x1f')](function(){_0xaa6088[_0xb5f6('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1971e5,_0xf0641b){return function(_0x38cd96){if(!_0x38cd96){_0x1971e5[_0xb5f6('0x28')](0x194);}return _0x38cd96;};}function handleError(_0x6b65b1,_0x129752){_0x129752=_0x129752||0x1f4;return function(_0xd62110){logger[_0xb5f6('0x23')](_0xd62110['stack']);if(_0xd62110['name']){delete _0xd62110['name'];}_0x6b65b1[_0xb5f6('0x29')](_0x129752)['send'](_0xd62110);};}exports[_0xb5f6('0x35')]=function(_0x37a3d1,_0x23d6b0){var _0x3ecfbd={},_0x46276d={},_0x34f143={'count':0x0,'rows':[]};var _0x54112f=_[_0xb5f6('0x36')](db[_0xb5f6('0x37')][_0xb5f6('0x38')],function(_0x1e2c00){return{'name':_0x1e2c00[_0xb5f6('0x39')],'type':_0x1e2c00[_0xb5f6('0x3a')][_0xb5f6('0x3b')]};});_0x46276d[_0xb5f6('0x3c')]=_[_0xb5f6('0x36')](_0x54112f,_0xb5f6('0x3d'));_0x46276d[_0xb5f6('0x3e')]=_[_0xb5f6('0x3f')](_0x37a3d1['query']);_0x46276d[_0xb5f6('0x40')]=_[_0xb5f6('0x41')](_0x46276d[_0xb5f6('0x3c')],_0x46276d['query']);_0x3ecfbd[_0xb5f6('0x42')]=_['intersection'](_0x46276d['model'],qs['fields'](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x43')]));_0x3ecfbd[_0xb5f6('0x42')]=_0x3ecfbd[_0xb5f6('0x42')][_0xb5f6('0x44')]?_0x3ecfbd[_0xb5f6('0x42')]:_0x46276d[_0xb5f6('0x3c')];if(!_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x45')](_0xb5f6('0x46'))){_0x3ecfbd[_0xb5f6('0x2e')]=qs[_0xb5f6('0x2e')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x2e')]);_0x3ecfbd[_0xb5f6('0x2c')]=qs[_0xb5f6('0x2c')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x2c')]);}_0x3ecfbd['order']=qs[_0xb5f6('0x47')](_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x47')]);_0x3ecfbd[_0xb5f6('0x48')]=qs[_0xb5f6('0x40')](_[_0xb5f6('0x49')](_0x37a3d1[_0xb5f6('0x3e')],_0x46276d[_0xb5f6('0x40')]),_0x54112f);if(_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4a')]){_0x3ecfbd[_0xb5f6('0x48')]=_['merge'](_0x3ecfbd[_0xb5f6('0x48')],{'$or':_[_0xb5f6('0x36')](_0x54112f,function(_0x3724f5){if(_0x3724f5[_0xb5f6('0x3a')]!==_0xb5f6('0x4b')){var _0x43fc94={};_0x43fc94[_0x3724f5[_0xb5f6('0x3d')]]={'$like':'%'+_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4a')]+'%'};return _0x43fc94;}})});}_0x3ecfbd=_[_0xb5f6('0x4c')]({},_0x3ecfbd,_0x37a3d1['options']);var _0x2ff21d={'where':_0x3ecfbd[_0xb5f6('0x48')]};return db[_0xb5f6('0x37')]['count'](_0x2ff21d)[_0xb5f6('0x1f')](function(_0x351ed5){_0x34f143[_0xb5f6('0x2f')]=_0x351ed5;if(_0x37a3d1[_0xb5f6('0x3e')][_0xb5f6('0x4d')]){_0x3ecfbd[_0xb5f6('0x4e')]=[{'all':!![]}];}return db[_0xb5f6('0x37')][_0xb5f6('0x4f')](_0x3ecfbd);})['then'](function(_0x394a6d){_0x34f143[_0xb5f6('0x50')]=_0x394a6d;return _0x34f143;})[_0xb5f6('0x1f')](respondWithFilteredResult(_0x23d6b0,_0x3ecfbd))[_0xb5f6('0x27')](handleError(_0x23d6b0,null));};exports['show']=function(_0x3651bd,_0x2ae196){var _0x48c185={'raw':!![],'where':{'id':_0x3651bd[_0xb5f6('0x51')]['id']}},_0xaca302={};_0xaca302[_0xb5f6('0x3c')]=_['keys'](db['OpenchannelMessage'][_0xb5f6('0x38')]);_0xaca302['query']=_[_0xb5f6('0x3f')](_0x3651bd[_0xb5f6('0x3e')]);_0xaca302['filters']=_['intersection'](_0xaca302[_0xb5f6('0x3c')],_0xaca302['query']);_0x48c185['attributes']=_['intersection'](_0xaca302[_0xb5f6('0x3c')],qs[_0xb5f6('0x43')](_0x3651bd['query'][_0xb5f6('0x43')]));_0x48c185[_0xb5f6('0x42')]=_0x48c185[_0xb5f6('0x42')][_0xb5f6('0x44')]?_0x48c185[_0xb5f6('0x42')]:_0xaca302[_0xb5f6('0x3c')];if(_0x3651bd['query'][_0xb5f6('0x4d')]){_0x48c185[_0xb5f6('0x4e')]=[{'all':!![]}];}_0x48c185=_[_0xb5f6('0x4c')]({},_0x48c185,_0x3651bd[_0xb5f6('0x52')]);return db['OpenchannelMessage'][_0xb5f6('0x53')](_0x48c185)['then'](handleEntityNotFound(_0x2ae196,null))[_0xb5f6('0x1f')](respondWithResult(_0x2ae196,null))[_0xb5f6('0x27')](handleError(_0x2ae196,null));};exports[_0xb5f6('0x54')]=function(_0x24f585,_0x2179e9){return db[_0xb5f6('0x37')][_0xb5f6('0x54')](_0x24f585[_0xb5f6('0x55')],{})[_0xb5f6('0x1f')](respondWithResult(_0x2179e9,0xc9))[_0xb5f6('0x27')](handleError(_0x2179e9,null));};exports[_0xb5f6('0x56')]=function(_0x4663b2,_0x22464a){if(_0x4663b2[_0xb5f6('0x55')]['id']){delete _0x4663b2[_0xb5f6('0x55')]['id'];}return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x4663b2[_0xb5f6('0x51')]['id']}})['then'](handleEntityNotFound(_0x22464a,null))[_0xb5f6('0x1f')](saveUpdates(_0x4663b2[_0xb5f6('0x55')],null))['then'](respondWithResult(_0x22464a,null))['catch'](handleError(_0x22464a,null));};exports[_0xb5f6('0x34')]=function(_0x186bb1,_0x5d90cb){return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x186bb1[_0xb5f6('0x51')]['id']}})[_0xb5f6('0x1f')](handleEntityNotFound(_0x5d90cb,null))[_0xb5f6('0x1f')](removeEntity(_0x5d90cb,null))[_0xb5f6('0x27')](handleError(_0x5d90cb,null));};exports[_0xb5f6('0x57')]=function(_0x171881,_0x21321e){return db['OpenchannelMessage']['describe']()[_0xb5f6('0x1f')](respondWithResult(_0x21321e,null))[_0xb5f6('0x27')](handleError(_0x21321e,null));};var interaction_log=require('../../config/logger')(_0xb5f6('0x58'));exports[_0xb5f6('0x59')]=function(_0x5575e7,_0x434742,_0x3967f2){var _0x3d8a85={'agent':{},'channel':_0xb5f6('0x5a')};if(_0x5575e7['body']['id']){delete _0x5575e7[_0xb5f6('0x55')]['id'];}_0x5575e7['body'][_0xb5f6('0x5b')]=!![];_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5c')]=moment()[_0xb5f6('0x5d')](_0xb5f6('0x5e'));_0x5575e7['body'][_0xb5f6('0x5f')]=_0x5575e7['body']['UserId']||_0x5575e7['user']['id'];_0x3d8a85[_0xb5f6('0x60')]['id']=_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')];return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x5575e7[_0xb5f6('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x434742,null))[_0xb5f6('0x1f')](saveUpdates(_0x5575e7[_0xb5f6('0x55')],null))[_0xb5f6('0x1f')](function(_0x248944){if(_0x248944){_0x3d8a85['message']=_0x248944[_0xb5f6('0x61')]({'plain':!![]});return db[_0xb5f6('0x62')][_0xb5f6('0x53')]({'where':{'id':_0x248944['OpenchannelInteractionId']}});}return null;})[_0xb5f6('0x1f')](handleEntityNotFound(_0x434742,null))[_0xb5f6('0x1f')](function(_0x2f55cf){if(_0x2f55cf){return _0x2f55cf['update']({'UserId':_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')],'read1stAt':_[_0xb5f6('0x63')](_0x2f55cf['read1stAt'])?moment()[_0xb5f6('0x5d')](_0xb5f6('0x5e')):undefined});}return null;})['then'](function(_0x3e22de){if(_0x3e22de){_0x3d8a85['interaction']=_0x3e22de['get']({'plain':!![]});interaction_log[_0xb5f6('0x20')](_0xb5f6('0x64'),_0x5575e7[_0xb5f6('0x65')]['id'],_0x5575e7[_0xb5f6('0x65')]['name'],_0x5575e7[_0xb5f6('0x65')][_0xb5f6('0x66')],_0x3d8a85['interaction']['id'],_0x5575e7[_0xb5f6('0x55')]?JSON[_0xb5f6('0x67')](_0x5575e7[_0xb5f6('0x55')]):_0xb5f6('0x68'));return respondWithRpcPromise(_0xb5f6('0x69'),_0xb5f6('0x6a'),_0x3d8a85);}return null;})[_0xb5f6('0x1f')](function(_0xe828d1){var _0x6ac522=_0xb5f6('0x6b')+_0xe828d1[_0xb5f6('0x25')]['ContactId'];return db[_0xb5f6('0x6c')][_0xb5f6('0x3e')](_0x6ac522,{'type':db[_0xb5f6('0x6d')][_0xb5f6('0x6e')][_0xb5f6('0x6f')],'raw':!![]})['then'](function(_0x4d0487){return _0x4d0487;});})['then'](function(_0x288b58){if(_0x288b58){_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x70')]=_0x288b58[0x0];if(!_0x5575e7[_0xb5f6('0x55')][_0xb5f6('0x5f')])return;return db[_0xb5f6('0x71')][_0xb5f6('0x53')]({'where':{'id':_0x5575e7['body'][_0xb5f6('0x5f')],'role':_0xb5f6('0x60')},'attributes':['id',_0xb5f6('0x3d'),_0xb5f6('0x72'),_0xb5f6('0x73'),_0xb5f6('0x74')],'raw':!![]});}return null;})[_0xb5f6('0x1f')](function(_0xaa5825){if(!_0xaa5825)return null;_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x60')]=_0xaa5825;return _0x3d8a85;})['then'](function(_0x293e2f){if(_0x293e2f){if(_0x5575e7[_0xb5f6('0x55')]['manual']){_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x75')]=util[_0xb5f6('0x5d')](_0xb5f6('0x76'),_0x5575e7['user'][_0xb5f6('0x3d')]);_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x77')]=_0x3d8a85['channel'];_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x78')]=_0x3d8a85['channel'];_0x3d8a85[_0xb5f6('0x25')][_0xb5f6('0x79')]='accept';return respondWithRpcPromise(_0xb5f6('0x7a'),_0xb5f6('0x7a'),{'event':_0xb5f6('0x7b'),'message':_0x3d8a85[_0xb5f6('0x25')]},client9002)[_0xb5f6('0x1f')](function(){return _0x3d8a85;});}return _0x3d8a85;}return null;})['then'](respondWithResult(_0x434742,null))[_0xb5f6('0x27')](handleError(_0x434742,null));};var interaction_log=require(_0xb5f6('0x12'))(_0xb5f6('0x58'));exports[_0xb5f6('0x32')]=function(_0x31f756,_0x460d71,_0x1076a){var _0x4c724e={'agent':{},'channel':'openchannel'};if(_0x31f756[_0xb5f6('0x55')]['id']){delete _0x31f756['body']['id'];}_0x31f756['body']['UserId']=_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')]||_0x31f756[_0xb5f6('0x65')]['id'];_0x4c724e[_0xb5f6('0x60')]['id']=_0x31f756['body']['UserId'];return db[_0xb5f6('0x37')][_0xb5f6('0x53')]({'where':{'id':_0x31f756[_0xb5f6('0x51')]['id'],'UserId':null}})[_0xb5f6('0x1f')](handleEntityNotFound(_0x460d71,null))['then'](function(_0xa67526){if(_0xa67526){_0x4c724e[_0xb5f6('0x25')]=_0xa67526[_0xb5f6('0x61')]({'plain':!![]});return db[_0xb5f6('0x62')][_0xb5f6('0x53')]({'where':{'id':_0xa67526[_0xb5f6('0x7c')]}});}return null;})['then'](handleEntityNotFound(_0x460d71,null))[_0xb5f6('0x1f')](function(_0x1e9e8a){if(_0x1e9e8a){_0x4c724e[_0xb5f6('0x7d')]=_0x1e9e8a['get']({'plain':!![]});interaction_log['info'](_0xb5f6('0x7e'),_0x31f756[_0xb5f6('0x65')]['id'],_0x31f756['user'][_0xb5f6('0x3d')],_0x31f756[_0xb5f6('0x65')][_0xb5f6('0x66')],_0x4c724e['interaction']['id'],_0x31f756[_0xb5f6('0x55')]?JSON['stringify'](_0x31f756['body']):_0xb5f6('0x68'));return respondWithRpcPromise('RejectMessage',_0xb5f6('0x7f'),_0x4c724e);}return null;})[_0xb5f6('0x1f')](function(_0xdf3857){var _0x2bb951=_0xb5f6('0x6b')+_0xdf3857['message'][_0xb5f6('0x80')];return db[_0xb5f6('0x6c')]['query'](_0x2bb951,{'type':db[_0xb5f6('0x6d')]['QueryTypes'][_0xb5f6('0x6f')],'raw':!![]})[_0xb5f6('0x1f')](function(_0x607097){return _0x607097;});})[_0xb5f6('0x1f')](function(_0x3e35c4){if(_0x3e35c4){_0x4c724e[_0xb5f6('0x25')][_0xb5f6('0x70')]=_0x3e35c4[0x0];if(!_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')])return;return db['User']['find']({'where':{'id':_0x31f756[_0xb5f6('0x55')][_0xb5f6('0x5f')],'role':_0xb5f6('0x60')},'attributes':['id',_0xb5f6('0x3d'),'fullname',_0xb5f6('0x73'),_0xb5f6('0x74')],'raw':!![]});}return null;})[_0xb5f6('0x1f')](function(_0x3e4c29){if(!_0x3e4c29)return null;_0x4c724e[_0xb5f6('0x25')][_0xb5f6('0x60')]=_0x3e4c29;return _0x4c724e;})[_0xb5f6('0x1f')](function(_0x44ee0b){if(_0x44ee0b){_0x44ee0b[_0xb5f6('0x25')][_0xb5f6('0x75')]=util[_0xb5f6('0x5d')](_0xb5f6('0x76'),_0x31f756['user'][_0xb5f6('0x3d')]);_0x44ee0b['message'][_0xb5f6('0x77')]=_0x4c724e[_0xb5f6('0x77')];_0x44ee0b[_0xb5f6('0x25')][_0xb5f6('0x78')]=_0x4c724e['channel'];_0x44ee0b['message']['event']='reject';respondWithRpcPromise('EventManager',_0xb5f6('0x7a'),{'event':'rejectmessage','message':_0x44ee0b[_0xb5f6('0x25')]},client9002);return _0x4c724e;}return null;})['then'](respondWithResult(_0x460d71,null))[_0xb5f6('0x27')](handleError(_0x460d71,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 5610e85..70e85de 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 _0xa7aa=['hasOwnProperty','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x546ebf,_0x51f323){var _0xe82ed3=function(_0x3f89bc){while(--_0x3f89bc){_0x546ebf['push'](_0x546ebf['shift']());}};_0xe82ed3(++_0x51f323);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x5000dc,_0x483dda){_0x5000dc=_0x5000dc-0x0;var _0x11ae91=_0xa7aa[_0x5000dc];return _0x11ae91;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0xaa7a('0x0'))['db'][_0xaa7a('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xaa7a('0x2')](0x0);var events={'afterCreate':_0xaa7a('0x3'),'afterUpdate':_0xaa7a('0x4'),'afterDestroy':_0xaa7a('0x5')};function emitEvent(_0x4d0175){return function(_0x53edc8,_0x428169,_0x5cb06b){OpenchannelMessageEvents['emit'](_0x4d0175+':'+_0x53edc8['id'],_0x53edc8);OpenchannelMessageEvents['emit'](_0x4d0175,_0x53edc8);_0x5cb06b(null);};}for(var e in events){if(events[_0xaa7a('0x6')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0x4df4=['update','emit','hook','events','OpenchannelMessage','save'];(function(_0x3d78d7,_0x44acea){var _0x4b6784=function(_0x284157){while(--_0x284157){_0x3d78d7['push'](_0x3d78d7['shift']());}};_0x4b6784(++_0x44acea);}(_0x4df4,0xa5));var _0x44df=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0x4df4[_0x4179e2];return _0x24cb50;};'use strict';var EventEmitter=require(_0x44df('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x44df('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x44df('0x2'),'afterUpdate':_0x44df('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4404af){return function(_0x3041ef,_0xcf78d3,_0x855b7d){OpenchannelMessageEvents[_0x44df('0x4')](_0x4404af+':'+_0x3041ef['id'],_0x3041ef);OpenchannelMessageEvents[_0x44df('0x4')](_0x4404af,_0x3041ef);_0x855b7d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x44df('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 96aae5e..0709346 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 _0xbd24=['toLowerCase','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelInteraction','Contact','keys','replyUri','afterCreate','format','Interactions','length','Interaction','omit','GET','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','inspect','finally','utf8mb4_unicode_ci','util','api','moment','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','direction','out','secret','UserId','findOne','OpenchannelInteractionId','update','createdAt'];(function(_0x414810,_0x5e924d){var _0x2d4df5=function(_0x390860){while(--_0x390860){_0x414810['push'](_0x414810['shift']());}};_0x2d4df5(++_0x5e924d);}(_0xbd24,0x1db));var _0x4bd2=function(_0xe11a29,_0x3a996f){_0xe11a29=_0xe11a29-0x0;var _0x478c43=_0xbd24[_0xe11a29];return _0x478c43;};'use strict';var _=require('lodash');var util=require(_0x4bd2('0x0'));var logger=require('../../config/logger')(_0x4bd2('0x1'));var moment=require(_0x4bd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x4bd2('0x3'));var fs=require('fs');var path=require(_0x4bd2('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4bd2('0x5'));module[_0x4bd2('0x6')]=function(_0x3f3f22,_0x2b677a){return _0x3f3f22[_0x4bd2('0x7')](_0x4bd2('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x4bd2('0x9'),'fields':[_0x4bd2('0xa')],'type':_0x4bd2('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x52e830,_0x53d67b,_0x5da410){var _0x9b4c4d=_0x3f3f22['models'];var _0x575909=_0x52e830['get']({'plain':!![]});if(_0x575909['direction']['toLowerCase']()==='in'||_0x575909[_0x4bd2('0xc')]['toLowerCase']()===_0x4bd2('0xd')&&!_0x575909[_0x4bd2('0xe')]&&!_['isNil'](_0x575909[_0x4bd2('0xf')])){_0x9b4c4d['OpenchannelInteraction'][_0x4bd2('0x10')]({'where':{'id':_0x575909[_0x4bd2('0x11')]}})['then'](function(_0x29c2dd){if(_0x29c2dd){_0x29c2dd[_0x4bd2('0x12')]({'lastMsgAt':_0x575909[_0x4bd2('0x13')],'lastMsgDirection':_0x575909['direction'][_0x4bd2('0x14')]()});}})[_0x4bd2('0x15')](function(_0x2e5a22){console[_0x4bd2('0x16')](_0x2e5a22);});}if(_0x575909[_0x4bd2('0xc')]===_0x4bd2('0xd')&&!_0x575909['secret']){var _0x57f02a;_0x9b4c4d[_0x4bd2('0x17')][_0x4bd2('0x18')]()[_0x4bd2('0x19')](function(_0x476ccb){return _0x9b4c4d[_0x4bd2('0x1a')][_0x4bd2('0x1b')]({'where':{'id':_0x575909['OpenchannelAccountId']},'include':[{'model':_0x9b4c4d[_0x4bd2('0x1c')],'as':'Interactions','where':{'id':_0x575909['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x9b4c4d[_0x4bd2('0x17')],'as':_0x4bd2('0x1d'),'attributes':_[_0x4bd2('0x1e')](_0x476ccb)}]}]});})[_0x4bd2('0x19')](function(_0x4a3990){_0x57f02a=_0x4a3990['get']({'plain':!![]});if(_0x57f02a&&_0x57f02a[_0x4bd2('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x4bd2('0x20'),util[_0x4bd2('0x21')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x575909['id'],_0x57f02a[_0x4bd2('0x1f')]));if(_0x57f02a[_0x4bd2('0x22')]&&_0x57f02a[_0x4bd2('0x22')][_0x4bd2('0x23')]){_0x575909[_0x4bd2('0x24')]=_[_0x4bd2('0x25')](_0x57f02a[_0x4bd2('0x22')][0x0],'Contact');_0x575909[_0x4bd2('0x1d')]=_0x57f02a[_0x4bd2('0x22')][0x0]['Contact'];}var _0x53d67b={'method':'POST','uri':encodeURI(_0x57f02a[_0x4bd2('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x53d67b['method']){case _0x4bd2('0x26'):_0x53d67b['qs']=_0x575909;break;case'POST':_0x53d67b['body']=_0x575909;break;}return rp(_0x53d67b)[_0x4bd2('0x19')](function(_0x5ee610){logger['info'](_0x4bd2('0x27'),'afterCreate',util[_0x4bd2('0x21')](_0x4bd2('0x28'),_0x575909['id'],_0x57f02a[_0x4bd2('0x1f')]));if(_0x5ee610[_0x4bd2('0xa')][_0x4bd2('0x29')]&&_0x5ee610[_0x4bd2('0xa')][_0x4bd2('0x29')]!=_0x575909[_0x4bd2('0x24')][_0x4bd2('0x29')]){return _0x9b4c4d[_0x4bd2('0x1c')][_0x4bd2('0x12')]({'threadId':_0x5ee610[_0x4bd2('0xa')][_0x4bd2('0x29')]},{'where':{'id':_0x575909[_0x4bd2('0x24')]['id']}});}else{return;}})[_0x4bd2('0x19')](function(){return _0x52e830['update']({'read':!![]});})[_0x4bd2('0x15')](function(_0x384539){logger[_0x4bd2('0x16')](_0x4bd2('0x27'),_0x4bd2('0x20'),util[_0x4bd2('0x2a')](_0x384539,{'showHidden':![],'depth':null}));_0x5da410();});}else{_0x5da410();}})[_0x4bd2('0x2b')](function(){_0x5da410();});}else{_0x5da410();}}},'charset':'utf8mb4','collate':_0x4bd2('0x2c')});}; \ No newline at end of file +var _0x7f46=['POST','method','GET','body','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','OpenchannelMessage','openchannel_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','length','Interaction','omit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7f46,0x170));var _0x67f4=function(_0x58ee19,_0xdf0765){_0x58ee19=_0x58ee19-0x0;var _0x49af25=_0x7f46[_0x58ee19];return _0x49af25;};'use strict';var _=require(_0x67f4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x67f4('0x1'));var moment=require('moment');var BPromise=require(_0x67f4('0x2'));var rp=require(_0x67f4('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x67f4('0x4'));var config=require(_0x67f4('0x5'));var attributes=require('./openchannelMessage.attributes');module[_0x67f4('0x6')]=function(_0x425076,_0x4b2756){return _0x425076[_0x67f4('0x7')](_0x67f4('0x8'),attributes,{'tableName':_0x67f4('0x9'),'paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':_0x67f4('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3146e0,_0x3256c5,_0x252bb8){var _0x5d1271=_0x425076['models'];var _0x2882bb=_0x3146e0[_0x67f4('0xb')]({'plain':!![]});if(_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()==='in'||_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()===_0x67f4('0xe')&&!_0x2882bb[_0x67f4('0xf')]&&!_[_0x67f4('0x10')](_0x2882bb[_0x67f4('0x11')])){_0x5d1271[_0x67f4('0x12')][_0x67f4('0x13')]({'where':{'id':_0x2882bb[_0x67f4('0x14')]}})[_0x67f4('0x15')](function(_0x236fc8){if(_0x236fc8){_0x236fc8[_0x67f4('0x16')]({'lastMsgAt':_0x2882bb[_0x67f4('0x17')],'lastMsgDirection':_0x2882bb[_0x67f4('0xc')][_0x67f4('0xd')]()});}})[_0x67f4('0x18')](function(_0x56b057){console['error'](_0x56b057);});}if(_0x2882bb[_0x67f4('0xc')]===_0x67f4('0xe')&&!_0x2882bb[_0x67f4('0xf')]){var _0x57f6c3;_0x5d1271[_0x67f4('0x19')][_0x67f4('0x1a')]()[_0x67f4('0x15')](function(_0x5e3071){return _0x5d1271[_0x67f4('0x1b')][_0x67f4('0x1c')]({'where':{'id':_0x2882bb[_0x67f4('0x1d')]},'include':[{'model':_0x5d1271[_0x67f4('0x12')],'as':_0x67f4('0x1e'),'where':{'id':_0x2882bb[_0x67f4('0x14')]},'limit':0x1,'include':[{'model':_0x5d1271[_0x67f4('0x19')],'as':_0x67f4('0x1f'),'attributes':_[_0x67f4('0x20')](_0x5e3071)}]}]});})[_0x67f4('0x15')](function(_0xa3741){_0x57f6c3=_0xa3741[_0x67f4('0xb')]({'plain':!![]});if(_0x57f6c3&&_0x57f6c3[_0x67f4('0x21')]){logger['info'](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x24')]('Forwarding\x20message\x20%d\x20to\x20%s',_0x2882bb['id'],_0x57f6c3[_0x67f4('0x21')]));if(_0x57f6c3['Interactions']&&_0x57f6c3[_0x67f4('0x1e')][_0x67f4('0x25')]){_0x2882bb[_0x67f4('0x26')]=_[_0x67f4('0x27')](_0x57f6c3[_0x67f4('0x1e')][0x0],_0x67f4('0x1f'));_0x2882bb[_0x67f4('0x1f')]=_0x57f6c3[_0x67f4('0x1e')][0x0][_0x67f4('0x1f')];}var _0x3256c5={'method':_0x67f4('0x28'),'uri':encodeURI(_0x57f6c3[_0x67f4('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x3256c5[_0x67f4('0x29')]){case _0x67f4('0x2a'):_0x3256c5['qs']=_0x2882bb;break;case _0x67f4('0x28'):_0x3256c5[_0x67f4('0x2b')]=_0x2882bb;break;}return rp(_0x3256c5)['then'](function(_0x6efb65){logger[_0x67f4('0x2c')](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x24')](_0x67f4('0x2d'),_0x2882bb['id'],_0x57f6c3[_0x67f4('0x21')]));if(_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]&&_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]!=_0x2882bb['Interaction']['threadId']){return _0x5d1271[_0x67f4('0x12')][_0x67f4('0x16')]({'threadId':_0x6efb65[_0x67f4('0x2b')][_0x67f4('0x2e')]},{'where':{'id':_0x2882bb[_0x67f4('0x26')]['id']}});}else{return;}})[_0x67f4('0x15')](function(){return _0x3146e0[_0x67f4('0x16')]({'read':!![]});})[_0x67f4('0x18')](function(_0x5242c7){logger[_0x67f4('0x2f')](_0x67f4('0x22'),_0x67f4('0x23'),util[_0x67f4('0x30')](_0x5242c7,{'showHidden':![],'depth':null}));_0x252bb8();});}else{_0x252bb8();}})['finally'](function(){_0x252bb8();});}else{_0x252bb8();}}},'charset':_0x67f4('0x31'),'collate':_0x67f4('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index b16e875..583efba 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 _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(_0x154cc0,_0x37882b){var _0x47813d=function(_0x278f39){while(--_0x278f39){_0x154cc0['push'](_0x154cc0['shift']());}};_0x47813d(++_0x37882b);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c2b66,_0x11cdab){_0x5c2b66=_0x5c2b66-0x0;var _0x421c35=_0x2ef3[_0x5c2b66];return _0x421c35;};'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 +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x45653d,_0xbf9000){var _0x56b1e2=function(_0x36ee1a){while(--_0x36ee1a){_0x45653d['push'](_0x45653d['shift']());}};_0x56b1e2(++_0xbf9000);}(_0x1261,0x144));var _0x1126=function(_0x46cf00,_0x457a43){_0x46cf00=_0x46cf00-0x0;var _0x3974dc=_0x1261[_0x46cf00];return _0x3974dc;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 592bb29..cdf0a30 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 _0x8375=['./openchannelMessage.events','save','remove','emit','register','length','openchannelMessage:'];(function(_0x382132,_0x4ed602){var _0x498938=function(_0x2ba839){while(--_0x2ba839){_0x382132['push'](_0x382132['shift']());}};_0x498938(++_0x4ed602);}(_0x8375,0xa8));var _0x5837=function(_0x83007b,_0x50b5f9){_0x83007b=_0x83007b-0x0;var _0x4fb27b=_0x8375[_0x83007b];return _0x4fb27b;};'use strict';var OpenchannelMessageEvents=require(_0x5837('0x0'));var events=[_0x5837('0x1'),_0x5837('0x2'),'update'];function createListener(_0x24c393,_0x181ec3){return function(_0x86f16a){_0x181ec3[_0x5837('0x3')](_0x24c393,_0x86f16a);};}function removeListener(_0x317452,_0x1edfc5){return function(){OpenchannelMessageEvents['removeListener'](_0x317452,_0x1edfc5);};}exports[_0x5837('0x4')]=function(_0x19491e){for(var _0x365da3=0x0,_0x2e383c=events[_0x5837('0x5')];_0x365da3<_0x2e383c;_0x365da3++){var _0x5bc421=events[_0x365da3];var _0x508caf=createListener(_0x5837('0x6')+_0x5bc421,_0x19491e);OpenchannelMessageEvents['on'](_0x5bc421,_0x508caf);}}; \ No newline at end of file +var _0x96fd=['register','length','openchannelMessage:','save','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x96fd,0x1e9));var _0xd96f=function(_0x4b23be,_0x32964b){_0x4b23be=_0x4b23be-0x0;var _0x5ba2d8=_0x96fd[_0x4b23be];return _0x5ba2d8;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xd96f('0x0'),'remove',_0xd96f('0x1')];function createListener(_0x561a45,_0x4b9472){return function(_0x131315){_0x4b9472[_0xd96f('0x2')](_0x561a45,_0x131315);};}function removeListener(_0x44f63c,_0x22b39b){return function(){OpenchannelMessageEvents['removeListener'](_0x44f63c,_0x22b39b);};}exports[_0xd96f('0x3')]=function(_0xee38ce){for(var _0x5d65d1=0x0,_0xe6000a=events[_0xd96f('0x4')];_0x5d65d1<_0xe6000a;_0x5d65d1++){var _0x3ae72a=events[_0x5d65d1];var _0xb32b34=createListener(_0xd96f('0x5')+_0x3ae72a,_0xee38ce);OpenchannelMessageEvents['on'](_0x3ae72a,_0xb32b34);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 803e93a..a8a75b1 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 _0xcb3c=['addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/users','post','create','/:id/teams','addTeams'];(function(_0x303064,_0x12f0c2){var _0x5a1d3d=function(_0x5b9d81){while(--_0x5b9d81){_0x303064['push'](_0x303064['shift']());}};_0x5a1d3d(++_0x12f0c2);}(_0xcb3c,0x19b));var _0xccb3=function(_0x1bb0b6,_0x1734b7){_0x1bb0b6=_0x1bb0b6-0x0;var _0x45f16b=_0xcb3c[_0x1bb0b6];return _0x45f16b;};'use strict';var multer=require(_0xccb3('0x0'));var util=require(_0xccb3('0x1'));var path=require(_0xccb3('0x2'));var timeout=require(_0xccb3('0x3'));var express=require(_0xccb3('0x4'));var router=express[_0xccb3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xccb3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xccb3('0x7'));var controller=require(_0xccb3('0x8'));router[_0xccb3('0x9')]('/',auth['isAuthenticated'](),controller[_0xccb3('0xa')]);router[_0xccb3('0x9')](_0xccb3('0xb'),auth[_0xccb3('0xc')](),controller[_0xccb3('0xd')]);router[_0xccb3('0x9')](_0xccb3('0xe'),auth[_0xccb3('0xc')](),controller[_0xccb3('0xf')]);router[_0xccb3('0x9')](_0xccb3('0x10'),auth[_0xccb3('0xc')](),controller[_0xccb3('0x11')]);router[_0xccb3('0x9')]('/:id/teams',auth[_0xccb3('0xc')](),controller['getTeams']);router['get'](_0xccb3('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0xccb3('0x13')]('/',auth['isAuthenticated'](),controller[_0xccb3('0x14')]);router[_0xccb3('0x13')](_0xccb3('0x15'),auth[_0xccb3('0xc')](),controller[_0xccb3('0x16')]);router[_0xccb3('0x13')]('/:id/users',auth['isAuthenticated'](),controller[_0xccb3('0x17')]);router[_0xccb3('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xccb3('0x19')]);router[_0xccb3('0x1a')](_0xccb3('0xe'),auth[_0xccb3('0xc')](),controller[_0xccb3('0x1b')]);router[_0xccb3('0x1a')](_0xccb3('0x15'),auth[_0xccb3('0xc')](),controller[_0xccb3('0x1c')]);router[_0xccb3('0x1a')](_0xccb3('0x12'),auth[_0xccb3('0xc')](),controller[_0xccb3('0x1d')]);module[_0xccb3('0x1e')]=router; \ No newline at end of file +var _0xa08d=['create','post','addTeams','addAgents','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa08d,0x1f4));var _0xda08=function(_0x332e13,_0x22183b){_0x332e13=_0x332e13-0x0;var _0x48b51d=_0xa08d[_0x332e13];return _0x48b51d;};'use strict';var multer=require(_0xda08('0x0'));var util=require(_0xda08('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xda08('0x2'));var router=express[_0xda08('0x3')]();var fs_extra=require(_0xda08('0x4'));var auth=require(_0xda08('0x5'));var interaction=require(_0xda08('0x6'));var config=require(_0xda08('0x7'));var controller=require('./openchannelQueue.controller');router[_0xda08('0x8')]('/',auth[_0xda08('0x9')](),controller[_0xda08('0xa')]);router[_0xda08('0x8')](_0xda08('0xb'),auth['isAuthenticated'](),controller[_0xda08('0xc')]);router[_0xda08('0x8')](_0xda08('0xd'),auth[_0xda08('0x9')](),controller[_0xda08('0xe')]);router[_0xda08('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0xda08('0xf')]);router[_0xda08('0x8')](_0xda08('0x10'),auth[_0xda08('0x9')](),controller[_0xda08('0x11')]);router[_0xda08('0x8')](_0xda08('0x12'),auth['isAuthenticated'](),controller[_0xda08('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xda08('0x14')]);router[_0xda08('0x15')]('/:id/teams',auth[_0xda08('0x9')](),controller[_0xda08('0x16')]);router[_0xda08('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0xda08('0x17')]);router['put'](_0xda08('0xd'),auth[_0xda08('0x9')](),controller['update']);router['delete'](_0xda08('0xd'),auth[_0xda08('0x9')](),controller['destroy']);router['delete'](_0xda08('0x10'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xda08('0x18')]('/:id/users',auth[_0xda08('0x9')](),controller['removeAgents']);module[_0xda08('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 1435425..694377a 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 _0x8504=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x8504,0x1cb));var _0x4850=function(_0x59e9ed,_0x150196){_0x59e9ed=_0x59e9ed-0x0;var _0x419eb3=_0x8504[_0x59e9ed];return _0x419eb3;};'use strict';var Sequelize=require(_0x4850('0x0'));module[_0x4850('0x1')]={'name':{'type':Sequelize[_0x4850('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x4850('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4850('0x4')](_0x4850('0x5'),'beepall',_0x4850('0x6'))}}; \ No newline at end of file +var _0x9238=['exports','STRING','INTEGER','ENUM','rrmemory','sequelize'];(function(_0x299e08,_0x16434c){var _0x15a309=function(_0x577944){while(--_0x577944){_0x299e08['push'](_0x299e08['shift']());}};_0x15a309(++_0x16434c);}(_0x9238,0xd7));var _0x8923=function(_0x511284,_0x340356){_0x511284=_0x511284-0x0;var _0x1cacdb=_0x9238[_0x511284];return _0x1cacdb;};'use strict';var Sequelize=require(_0x8923('0x0'));module[_0x8923('0x1')]={'name':{'type':Sequelize[_0x8923('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8923('0x2')]},'timeout':{'type':Sequelize[_0x8923('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8923('0x4')](_0x8923('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 8f345f0..712334f 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 _0xdfd0=['type','key','getOptions','where','include','query','findAll','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','filter','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','%s/%s','createdAt','getTeams','Team','order','addTeams','User','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','ids','select','team_has_openchannel_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','includes','compact','value','removeTeams','isEmpty','removeAgents','emit','addAgents','omit','spread','isArray','userOpenchannelQueue:remove','getAgents','util','lodash','squel','ioredis','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName'];(function(_0x7dee60,_0x3065c0){var _0x5ae906=function(_0x23a3f0){while(--_0x23a3f0){_0x7dee60['push'](_0x7dee60['shift']());}};_0x5ae906(++_0x3065c0);}(_0xdfd0,0xc9));var _0x0dfd=function(_0x4ffeaf,_0x2d8d62){_0x4ffeaf=_0x4ffeaf-0x0;var _0x3ebecd=_0xdfd0[_0x4ffeaf];return _0x3ebecd;};'use strict';var BPromise=require('bluebird');var util=require(_0x0dfd('0x0'));var _=require(_0x0dfd('0x1'));var squel=require(_0x0dfd('0x2'));var Redis=require(_0x0dfd('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x0dfd('0x4'))('api');var config=require('../../config/environment');var db=require(_0x0dfd('0x5'))['db'];config[_0x0dfd('0x6')]=_['defaults'](config['redis'],{'host':_0x0dfd('0x7'),'port':0x18eb});var socket=require(_0x0dfd('0x8'))(new Redis(config[_0x0dfd('0x6')]));require(_0x0dfd('0x9'))[_0x0dfd('0xa')](socket);function respondWithStatusCode(_0xa7917f,_0x5caa61){_0x5caa61=_0x5caa61||0xcc;return function(_0x594baf){if(_0x594baf){return _0xa7917f[_0x0dfd('0xb')](_0x5caa61);}return _0xa7917f['status'](_0x5caa61)['end']();};}function respondWithResult(_0x1524a3,_0x3ff97a){_0x3ff97a=_0x3ff97a||0xc8;return function(_0x2098a4){if(_0x2098a4){return _0x1524a3[_0x0dfd('0xc')](_0x3ff97a)[_0x0dfd('0xd')](_0x2098a4);}};}function respondWithFilteredResult(_0x13b94f,_0x237979){return function(_0x34de00){if(_0x34de00){var _0x4cb573=typeof _0x237979['offset']===_0x0dfd('0xe')&&typeof _0x237979[_0x0dfd('0xf')]===_0x0dfd('0xe');var _0x15d7aa=_0x34de00[_0x0dfd('0x10')];var _0x882220=_0x4cb573?0x0:_0x237979[_0x0dfd('0x11')];var _0x3b6828=_0x4cb573?_0x34de00[_0x0dfd('0x10')]:_0x237979['offset']+_0x237979[_0x0dfd('0xf')];var _0x2c923b;if(_0x3b6828>=_0x15d7aa){_0x3b6828=_0x15d7aa;_0x2c923b=0xc8;}else{_0x2c923b=0xce;}_0x13b94f[_0x0dfd('0xc')](_0x2c923b);return _0x13b94f[_0x0dfd('0x12')](_0x0dfd('0x13'),_0x882220+'-'+_0x3b6828+'/'+_0x15d7aa)[_0x0dfd('0xd')](_0x34de00);}return null;};}function saveUpdates(_0x1f7da4){return function(_0x432cd3){if(_0x432cd3){return _0x432cd3[_0x0dfd('0x14')](_0x1f7da4)[_0x0dfd('0x15')](function(_0x4d719d){return _0x4d719d;});}return null;};}function removeEntity(_0x130e35){return function(_0x2353f5){if(_0x2353f5){return _0x2353f5[_0x0dfd('0x16')]()[_0x0dfd('0x15')](function(){var _0xcc8c6f=_0x2353f5[_0x0dfd('0x17')]({'plain':!![]});var _0xe4cef1='OpenchannelQueues';return db[_0x0dfd('0x18')][_0x0dfd('0x16')]({'where':{'type':_0xe4cef1,'resourceId':_0xcc8c6f['id']}})[_0x0dfd('0x15')](function(){return _0x2353f5;});})['then'](function(){_0x130e35[_0x0dfd('0xc')](0xcc)[_0x0dfd('0x19')]();});}};}function handleEntityNotFound(_0x514836){return function(_0x6c17a8){if(!_0x6c17a8){_0x514836['sendStatus'](0x194);}return _0x6c17a8;};}function handleError(_0x46407b,_0x5793e8){_0x5793e8=_0x5793e8||0x1f4;return function(_0xe1918d){logger[_0x0dfd('0x1a')](_0xe1918d[_0x0dfd('0x1b')]);if(_0xe1918d[_0x0dfd('0x1c')]){delete _0xe1918d[_0x0dfd('0x1c')];}_0x46407b[_0x0dfd('0xc')](_0x5793e8)[_0x0dfd('0x1d')](_0xe1918d);};}exports[_0x0dfd('0x1e')]=function(_0x97d284,_0x172aed){var _0x2d42a5={};var _0x4e7d94={'count':0x0,'rows':[]};var _0x295af2=_[_0x0dfd('0x1f')](db[_0x0dfd('0x20')][_0x0dfd('0x21')],function(_0x544fa6){return{'name':_0x544fa6[_0x0dfd('0x22')],'type':_0x544fa6[_0x0dfd('0x23')][_0x0dfd('0x24')]};});_0x2d42a5=qs[_0x0dfd('0x25')](_0x295af2,_0x97d284);var _0x7545f={'where':_0x2d42a5[_0x0dfd('0x26')]};return db['OpenchannelQueue']['count'](_0x7545f)['then'](function(_0x181a2b){_0x4e7d94[_0x0dfd('0x10')]=_0x181a2b;_0x2d42a5[_0x0dfd('0x27')]=qs[_0x0dfd('0x27')](_0x97d284[_0x0dfd('0x28')]);return db['OpenchannelQueue'][_0x0dfd('0x29')](_0x2d42a5);})[_0x0dfd('0x15')](function(_0x59fca8){_0x4e7d94['rows']=_0x59fca8;return _0x4e7d94;})['then'](respondWithFilteredResult(_0x172aed,_0x2d42a5))[_0x0dfd('0x2a')](handleError(_0x172aed,null));};exports['show']=function(_0x3dff12,_0x5db06c){var _0x1112e8={'raw':!![],'where':{'id':_0x3dff12[_0x0dfd('0x2b')]['id']}},_0x3a1680={};_0x3a1680[_0x0dfd('0x2c')]=_[_0x0dfd('0x2d')](db[_0x0dfd('0x20')][_0x0dfd('0x21')]);_0x3a1680['query']=_['keys'](_0x3dff12[_0x0dfd('0x28')]);_0x3a1680[_0x0dfd('0x2e')]=_[_0x0dfd('0x2f')](_0x3a1680[_0x0dfd('0x2c')],_0x3a1680[_0x0dfd('0x28')]);_0x1112e8[_0x0dfd('0x30')]=_[_0x0dfd('0x2f')](_0x3a1680[_0x0dfd('0x2c')],qs[_0x0dfd('0x31')](_0x3dff12[_0x0dfd('0x28')]['fields']));_0x1112e8[_0x0dfd('0x30')]=_0x1112e8[_0x0dfd('0x30')][_0x0dfd('0x32')]?_0x1112e8[_0x0dfd('0x30')]:_0x3a1680['model'];if(_0x3dff12[_0x0dfd('0x28')][_0x0dfd('0x33')]){_0x1112e8['include']=[{'all':!![]}];}_0x1112e8=_[_0x0dfd('0x34')]({},_0x1112e8,_0x3dff12[_0x0dfd('0x35')]);return db[_0x0dfd('0x20')][_0x0dfd('0x36')](_0x1112e8)[_0x0dfd('0x15')](handleEntityNotFound(_0x5db06c,null))[_0x0dfd('0x15')](respondWithResult(_0x5db06c,null))[_0x0dfd('0x2a')](handleError(_0x5db06c,null));};exports[_0x0dfd('0x37')]=function(_0x6e41a7,_0x10162c){return db[_0x0dfd('0x20')][_0x0dfd('0x37')](_0x6e41a7[_0x0dfd('0x38')],{})[_0x0dfd('0x15')](function(_0x36564a){var _0x2fe19f=_0x6e41a7['user']['get']({'plain':!![]});if(!_0x2fe19f)throw new Error(_0x0dfd('0x39'));if(_0x2fe19f[_0x0dfd('0x3a')]===_0x0dfd('0x3b')){var _0x46421f=_0x36564a['get']({'plain':!![]});var _0x2826b9=_0x0dfd('0x3c');return db[_0x0dfd('0x3d')][_0x0dfd('0x36')]({'where':{'name':_0x2826b9,'userProfileId':_0x2fe19f['userProfileId']},'raw':!![]})[_0x0dfd('0x15')](function(_0x52a73c){if(_0x52a73c&&_0x52a73c['autoAssociation']===0x0){return db['UserProfileResource'][_0x0dfd('0x37')]({'name':_0x46421f[_0x0dfd('0x1c')],'resourceId':_0x46421f['id'],'type':_0x52a73c[_0x0dfd('0x1c')],'sectionId':_0x52a73c['id']},{})[_0x0dfd('0x15')](function(){return _0x36564a;});}else{return _0x36564a;}})[_0x0dfd('0x2a')](function(_0x76d2d1){logger[_0x0dfd('0x1a')](_0x0dfd('0x3e'),_0x76d2d1);throw _0x76d2d1;});}return _0x36564a;})['then'](respondWithResult(_0x10162c,0xc9))[_0x0dfd('0x2a')](handleError(_0x10162c,null));};exports[_0x0dfd('0x14')]=function(_0x1db271,_0x582b39){if(_0x1db271[_0x0dfd('0x38')]['id']){delete _0x1db271[_0x0dfd('0x38')]['id'];}return db['OpenchannelQueue']['find']({'where':{'id':_0x1db271['params']['id']}})[_0x0dfd('0x15')](handleEntityNotFound(_0x582b39,null))['then'](saveUpdates(_0x1db271['body'],null))['then'](respondWithResult(_0x582b39,null))['catch'](handleError(_0x582b39,null));};exports['destroy']=function(_0x417747,_0xdd7d81){return db[_0x0dfd('0x20')]['find']({'where':{'id':_0x417747[_0x0dfd('0x2b')]['id']}})['then'](handleEntityNotFound(_0xdd7d81,null))[_0x0dfd('0x15')](removeEntity(_0xdd7d81,null))[_0x0dfd('0x2a')](handleError(_0xdd7d81,null));};exports[_0x0dfd('0x3f')]=function(_0x152b4a,_0x50ee53){return db[_0x0dfd('0x20')]['describe']()['then'](respondWithResult(_0x50ee53,null))[_0x0dfd('0x2a')](handleError(_0x50ee53,null));};exports['getMembers']=function(_0x58135e,_0xa9fc82){var _0x1eb7e8={'raw':!![],'where':{}},_0x3d468d={},_0xf146ca;return db[_0x0dfd('0x20')][_0x0dfd('0x40')]({'where':{'id':_0x58135e[_0x0dfd('0x2b')]['id']}})[_0x0dfd('0x15')](handleEntityNotFound(_0xa9fc82,null))[_0x0dfd('0x15')](function(_0x44f51a){if(_0x44f51a){_0xf146ca=_0x44f51a['get']({'plain':!![]});_0x3d468d[_0x0dfd('0x2c')]=_[_0x0dfd('0x2d')](db[_0x0dfd('0x41')][_0x0dfd('0x21')]);_0x3d468d['query']=_['keys'](_0x58135e[_0x0dfd('0x28')]);_0x3d468d[_0x0dfd('0x2e')]=_[_0x0dfd('0x2f')](_0x3d468d['model'],_0x3d468d[_0x0dfd('0x28')]);_0x1eb7e8[_0x0dfd('0x30')]=_[_0x0dfd('0x2f')](_0x3d468d[_0x0dfd('0x2c')],qs[_0x0dfd('0x31')](_0x58135e['query'][_0x0dfd('0x31')]));_0x1eb7e8[_0x0dfd('0x30')]=_0x1eb7e8['attributes'][_0x0dfd('0x32')]?_0x1eb7e8[_0x0dfd('0x30')]:_0x3d468d[_0x0dfd('0x2c')];if(!_0x58135e[_0x0dfd('0x28')][_0x0dfd('0x42')](_0x0dfd('0x43'))){_0x1eb7e8[_0x0dfd('0xf')]=qs[_0x0dfd('0xf')](_0x58135e[_0x0dfd('0x28')][_0x0dfd('0xf')]);_0x1eb7e8['offset']=qs[_0x0dfd('0x11')](_0x58135e['query'][_0x0dfd('0x11')]);}_0x1eb7e8['order']=qs[_0x0dfd('0x44')](_0x58135e[_0x0dfd('0x28')][_0x0dfd('0x44')]);_0x1eb7e8[_0x0dfd('0x26')]=qs[_0x0dfd('0x2e')](_[_0x0dfd('0x45')](_0x58135e[_0x0dfd('0x28')],_0x3d468d[_0x0dfd('0x2e')]));_0x1eb7e8[_0x0dfd('0x26')][_0x0dfd('0x46')]=_0x44f51a['id'];if(_0x58135e[_0x0dfd('0x28')]['filter']){_0x1eb7e8[_0x0dfd('0x26')]=_['merge'](_0x1eb7e8[_0x0dfd('0x26')],{'$or':_['map'](_0x1eb7e8[_0x0dfd('0x30')],function(_0x318e10){var _0x43cda5={};_0x43cda5[_0x318e10]={'$like':'%'+_0x58135e[_0x0dfd('0x28')][_0x0dfd('0x47')]+'%'};return _0x43cda5;})});}_0x1eb7e8=_[_0x0dfd('0x34')]({},_0x1eb7e8,_0x58135e[_0x0dfd('0x35')]);return db[_0x0dfd('0x41')][_0x0dfd('0x29')](_0x1eb7e8);}})['then'](function(_0x5502e4){if(_0x5502e4){return db['User'][_0x0dfd('0x48')]({'where':{'id':_[_0x0dfd('0x1f')](_0x5502e4,_0x0dfd('0x49')),'role':_0x0dfd('0x4a')},'attributes':['id',_0x0dfd('0x1c'),_0x0dfd('0x4b'),_0x0dfd('0x4c'),'createdAt']});}})[_0x0dfd('0x15')](function(_0x3cf443){if(_0x3cf443){return{'count':_0x3cf443[_0x0dfd('0x10')],'rows':_['map'](_0x3cf443[_0x0dfd('0x4d')],function(_0xe16b79){return{'membername':_0xe16b79['name'],'UserId':_0xe16b79['id'],'queue_name':_0xf146ca[_0x0dfd('0x1c')],'OpenchannelQueueId':_0xf146ca['id'],'interface':util['format'](_0x0dfd('0x4e'),'SIP',_0xe16b79[_0x0dfd('0x1c')]),'penalty':0x0,'paused':_0xe16b79[_0x0dfd('0x4b')],'createdAt':_0xe16b79[_0x0dfd('0x4f')],'updatedAt':_0xe16b79[_0x0dfd('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0xa9fc82,_0x1eb7e8))['catch'](handleError(_0xa9fc82,null));};exports[_0x0dfd('0x50')]=function(_0x358728,_0x384577){var _0x35fbe1={};var _0x48eccb={};var _0x478322;var _0x4fbf9a;return db[_0x0dfd('0x20')][_0x0dfd('0x40')]({'where':{'id':_0x358728[_0x0dfd('0x2b')]['id']}})[_0x0dfd('0x15')](handleEntityNotFound(_0x384577,null))[_0x0dfd('0x15')](function(_0x4d8830){if(_0x4d8830){_0x478322=_0x4d8830;_0x48eccb[_0x0dfd('0x2c')]=_['keys'](db[_0x0dfd('0x51')][_0x0dfd('0x21')]);_0x48eccb['query']=_[_0x0dfd('0x2d')](_0x358728[_0x0dfd('0x28')]);_0x48eccb[_0x0dfd('0x2e')]=_['intersection'](_0x48eccb[_0x0dfd('0x2c')],_0x48eccb[_0x0dfd('0x28')]);_0x35fbe1[_0x0dfd('0x30')]=_[_0x0dfd('0x2f')](_0x48eccb[_0x0dfd('0x2c')],qs[_0x0dfd('0x31')](_0x358728[_0x0dfd('0x28')][_0x0dfd('0x31')]));_0x35fbe1[_0x0dfd('0x30')]=_0x35fbe1['attributes'][_0x0dfd('0x32')]?_0x35fbe1[_0x0dfd('0x30')]:_0x48eccb[_0x0dfd('0x2c')];_0x35fbe1[_0x0dfd('0x52')]=qs['sort'](_0x358728[_0x0dfd('0x28')][_0x0dfd('0x44')]);_0x35fbe1[_0x0dfd('0x26')]=qs[_0x0dfd('0x2e')](_[_0x0dfd('0x45')](_0x358728[_0x0dfd('0x28')],_0x48eccb[_0x0dfd('0x2e')]));if(_0x358728[_0x0dfd('0x28')][_0x0dfd('0x47')]){_0x35fbe1['where']=_[_0x0dfd('0x34')](_0x35fbe1[_0x0dfd('0x26')],{'$or':_[_0x0dfd('0x1f')](_0x35fbe1[_0x0dfd('0x30')],function(_0x25834c){var _0x5aa8fb={};_0x5aa8fb[_0x25834c]={'$like':'%'+_0x358728[_0x0dfd('0x28')][_0x0dfd('0x47')]+'%'};return _0x5aa8fb;})});}_0x35fbe1=_['merge']({},_0x35fbe1,_0x358728['options']);return _0x478322[_0x0dfd('0x50')](_0x35fbe1);}})[_0x0dfd('0x15')](function(_0x51ef45){if(_0x51ef45){_0x4fbf9a=_0x51ef45[_0x0dfd('0x32')];if(!_0x358728[_0x0dfd('0x28')][_0x0dfd('0x42')](_0x0dfd('0x43'))){_0x35fbe1[_0x0dfd('0xf')]=qs[_0x0dfd('0xf')](_0x358728[_0x0dfd('0x28')][_0x0dfd('0xf')]);_0x35fbe1[_0x0dfd('0x11')]=qs[_0x0dfd('0x11')](_0x358728[_0x0dfd('0x28')]['offset']);}return _0x478322[_0x0dfd('0x50')](_0x35fbe1);}})['then'](function(_0x41a130){if(_0x41a130){return _0x41a130?{'count':_0x4fbf9a,'rows':_0x41a130}:null;}})[_0x0dfd('0x15')](respondWithResult(_0x384577,null))[_0x0dfd('0x2a')](handleError(_0x384577,null));};exports[_0x0dfd('0x53')]=function(_0x3fc0a0,_0x1df645){var _0x4236df=_0x3fc0a0[_0x0dfd('0x38')]['ids'];return db['Team'][_0x0dfd('0x29')]({'where':{'id':_0x4236df},'attributes':['id'],'include':[{'model':db[_0x0dfd('0x54')],'as':_0x0dfd('0x55'),'attributes':['id','name',_0x0dfd('0x56'),'voicePause','interface'],'raw':!![]}]})[_0x0dfd('0x15')](function(_0x5f4bf0){if(_0x5f4bf0){var _0x1eec89=_[_0x0dfd('0x57')](_0x5f4bf0,function(_0x3e3c0d){var _0x4e4dfe=_0x3e3c0d['get']({'plain':!![]});return _0x4e4dfe['Agents'];});return db[_0x0dfd('0x20')][_0x0dfd('0x36')]({'where':{'id':_0x3fc0a0['params']['id']}})[_0x0dfd('0x15')](function(_0x70e8fb){return db[_0x0dfd('0x58')][_0x0dfd('0x59')](function(_0x3205b2){return _0x70e8fb['addTeams'](_0x4236df,{'transaction':_0x3205b2})['then'](function(){return BPromise[_0x0dfd('0x5a')](_0x1eec89,function(_0xc766d8){return db[_0x0dfd('0x41')][_0x0dfd('0x5b')]({'where':{'UserId':_0xc766d8['id'],'OpenchannelQueueId':_0x3fc0a0['params']['id']},'transaction':_0x3205b2});});})['then'](function(){_0x1eec89[_0x0dfd('0x5c')](function(_0x491266){socket['emit'](_0x0dfd('0x5d'),{'UserId':_0x491266['id'],'OpenchannelQueueId':_0x70e8fb['id']});});});});});}})[_0x0dfd('0x15')](respondWithStatusCode(_0x1df645,null))[_0x0dfd('0x2a')](handleError(_0x1df645,null));};exports['removeTeams']=function(_0x509002,_0x30e4d7){return db[_0x0dfd('0x51')][_0x0dfd('0x29')]({'where':{'id':_0x509002[_0x0dfd('0x28')][_0x0dfd('0x5e')]},'attributes':['id'],'include':[{'model':db[_0x0dfd('0x54')],'as':_0x0dfd('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x30e4d7,null))[_0x0dfd('0x15')](function(_0x26cedb){var _0x40021e=_[_0x0dfd('0x1f')](_0x26cedb,'id');var _0x333446=[];var _0x33f73b=[];var _0x1b5869=squel[_0x0dfd('0x5f')]();_0x1b5869['field']('tq.TeamId')['from'](_0x0dfd('0x60'),'tq')['join'](_0x0dfd('0x61'),'ut',_0x0dfd('0x62'))['where']('OpenchannelQueueId\x20=\x20?',_0x509002[_0x0dfd('0x2b')]['id']);for(var _0x38354e=0x0;_0x38354e<_0x26cedb[_0x0dfd('0x32')];_0x38354e+=0x1){let _0x46fb70=_0x26cedb[_0x38354e];for(var _0x5b2e2b=0x0;_0x5b2e2b<_0x46fb70[_0x0dfd('0x55')][_0x0dfd('0x32')];_0x5b2e2b+=0x1){let _0x26297b=_0x46fb70['Agents'][_0x5b2e2b];var _0x41e474=_0x1b5869[_0x0dfd('0x63')]();_0x41e474['where'](_0x0dfd('0x64'),_0x26297b['id']);_0x33f73b[_0x0dfd('0x65')](db[_0x0dfd('0x58')][_0x0dfd('0x28')](_0x41e474['toString'](),{'type':db[_0x0dfd('0x58')][_0x0dfd('0x66')][_0x0dfd('0x67')]})['then'](function(_0x4f9869){if(_0x4f9869[_0x0dfd('0x32')]===0x1){return _0x26297b['id'];}else{var _0xafccaf=_[_0x0dfd('0x68')](_[_0x0dfd('0x1f')](_0x4f9869,'TeamId'),function(_0xea584a){return _[_0x0dfd('0x69')](_0x40021e,_0xea584a);});if(_0xafccaf){return _0x26297b['id'];}}}));}}return BPromise['all'](_0x33f73b)[_0x0dfd('0x15')](function(_0x4d80cc){_0x333446=_(_0x333446)['union'](_0x4d80cc)[_0x0dfd('0x6a')]()[_0x0dfd('0x6b')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x509002[_0x0dfd('0x2b')]['id']}})[_0x0dfd('0x15')](function(_0x40acf9){return db['sequelize'][_0x0dfd('0x59')](function(_0x22e9b7){return _0x40acf9[_0x0dfd('0x6c')](_0x509002[_0x0dfd('0x28')][_0x0dfd('0x5e')],{'transaction':_0x22e9b7})[_0x0dfd('0x15')](function(){if(!_[_0x0dfd('0x6d')](_0x333446)){return _0x40acf9[_0x0dfd('0x6e')](_0x333446,{'transaction':_0x22e9b7});}})['then'](function(){_0x333446[_0x0dfd('0x5c')](function(_0x4b035f){socket[_0x0dfd('0x6f')]('userOpenchannelQueue:remove',{'UserId':_0x4b035f,'OpenchannelQueueId':_0x40acf9['id']});});});});});});})[_0x0dfd('0x15')](respondWithStatusCode(_0x30e4d7,null))[_0x0dfd('0x2a')](handleError(_0x30e4d7,null));};exports[_0x0dfd('0x70')]=function(_0x5bfc16,_0x27e6b1){return db[_0x0dfd('0x20')][_0x0dfd('0x36')]({'where':{'id':_0x5bfc16[_0x0dfd('0x2b')]['id']}})['then'](handleEntityNotFound(_0x27e6b1,null))[_0x0dfd('0x15')](function(_0x7dc6f9){if(_0x7dc6f9){return _0x7dc6f9[_0x0dfd('0x70')](_0x5bfc16[_0x0dfd('0x38')][_0x0dfd('0x5e')],_[_0x0dfd('0x71')](_0x5bfc16['body'],['ids','id'])||{})[_0x0dfd('0x72')](function(_0xa2983e){for(var _0x41fa31=0x0;_0x41fa31<_0x5bfc16[_0x0dfd('0x38')]['ids'][_0x0dfd('0x32')];_0x41fa31+=0x1){socket[_0x0dfd('0x6f')](_0x0dfd('0x5d'),{'UserId':Number(_0x5bfc16[_0x0dfd('0x38')][_0x0dfd('0x5e')][_0x41fa31]),'OpenchannelQueueId':Number(_0x5bfc16[_0x0dfd('0x2b')]['id'])});}return _0xa2983e;});}})['then'](respondWithResult(_0x27e6b1,null))[_0x0dfd('0x2a')](handleError(_0x27e6b1,null));};exports['removeAgents']=function(_0x281d51,_0x3f33ea){return db[_0x0dfd('0x20')][_0x0dfd('0x36')]({'where':{'id':_0x281d51[_0x0dfd('0x2b')]['id']}})[_0x0dfd('0x15')](handleEntityNotFound(_0x3f33ea,null))[_0x0dfd('0x15')](function(_0x4ac5ba){if(_0x4ac5ba){return _0x4ac5ba[_0x0dfd('0x6e')](_0x281d51['query'][_0x0dfd('0x5e')])[_0x0dfd('0x15')](function(){if(_[_0x0dfd('0x73')](_0x281d51['query']['ids'])){for(var _0x475b82=0x0;_0x475b82<_0x281d51['query'][_0x0dfd('0x5e')][_0x0dfd('0x32')];_0x475b82+=0x1){socket[_0x0dfd('0x6f')](_0x0dfd('0x74'),{'UserId':Number(_0x281d51['query']['ids'][_0x475b82]),'OpenchannelQueueId':Number(_0x281d51['params']['id'])});}}else{socket[_0x0dfd('0x6f')](_0x0dfd('0x74'),{'UserId':Number(_0x281d51[_0x0dfd('0x28')][_0x0dfd('0x5e')]),'OpenchannelQueueId':Number(_0x281d51[_0x0dfd('0x2b')]['id'])});}});}})[_0x0dfd('0x15')](respondWithStatusCode(_0x3f33ea,null))[_0x0dfd('0x2a')](handleError(_0x3f33ea,null));};exports[_0x0dfd('0x75')]=function(_0x102ff5,_0x178125){var _0x562d7e={};var _0x527a30={};var _0x5b3a;var _0x2b5964;return db[_0x0dfd('0x20')][_0x0dfd('0x40')]({'where':{'id':_0x102ff5[_0x0dfd('0x2b')]['id']}})[_0x0dfd('0x15')](handleEntityNotFound(_0x178125,null))[_0x0dfd('0x15')](function(_0x46a279){if(_0x46a279){_0x5b3a=_0x46a279;_0x527a30['model']=_[_0x0dfd('0x2d')](db['User'][_0x0dfd('0x21')]);_0x527a30[_0x0dfd('0x28')]=_['keys'](_0x102ff5[_0x0dfd('0x28')]);_0x527a30[_0x0dfd('0x2e')]=_[_0x0dfd('0x2f')](_0x527a30[_0x0dfd('0x2c')],_0x527a30[_0x0dfd('0x28')]);_0x562d7e[_0x0dfd('0x30')]=_[_0x0dfd('0x2f')](_0x527a30[_0x0dfd('0x2c')],qs[_0x0dfd('0x31')](_0x102ff5[_0x0dfd('0x28')][_0x0dfd('0x31')]));_0x562d7e[_0x0dfd('0x30')]=_0x562d7e['attributes']['length']?_0x562d7e[_0x0dfd('0x30')]:_0x527a30['model'];_0x562d7e['order']=qs['sort'](_0x102ff5['query'][_0x0dfd('0x44')]);_0x562d7e[_0x0dfd('0x26')]=qs[_0x0dfd('0x2e')](_[_0x0dfd('0x45')](_0x102ff5[_0x0dfd('0x28')],_0x527a30[_0x0dfd('0x2e')]));if(_0x102ff5['query'][_0x0dfd('0x47')]){_0x562d7e[_0x0dfd('0x26')]=_[_0x0dfd('0x34')](_0x562d7e[_0x0dfd('0x26')],{'$or':_[_0x0dfd('0x1f')](_0x562d7e[_0x0dfd('0x30')],function(_0x2819ae){var _0x3ce0c7={};_0x3ce0c7[_0x2819ae]={'$like':'%'+_0x102ff5[_0x0dfd('0x28')][_0x0dfd('0x47')]+'%'};return _0x3ce0c7;})});}_0x562d7e=_['merge']({},_0x562d7e,_0x102ff5[_0x0dfd('0x35')]);return _0x5b3a['getAgents'](_0x562d7e);}})['then'](function(_0x2c5e72){if(_0x2c5e72){_0x2b5964=_0x2c5e72[_0x0dfd('0x32')];if(!_0x102ff5[_0x0dfd('0x28')][_0x0dfd('0x42')](_0x0dfd('0x43'))){_0x562d7e[_0x0dfd('0xf')]=qs['limit'](_0x102ff5[_0x0dfd('0x28')][_0x0dfd('0xf')]);_0x562d7e[_0x0dfd('0x11')]=qs['offset'](_0x102ff5[_0x0dfd('0x28')][_0x0dfd('0x11')]);}return _0x5b3a[_0x0dfd('0x75')](_0x562d7e);}})['then'](function(_0x475277){if(_0x475277){return _0x475277?{'count':_0x2b5964,'rows':_0x475277}:null;}})['then'](respondWithResult(_0x178125,null))[_0x0dfd('0x2a')](handleError(_0x178125,null));}; \ No newline at end of file +var _0x58a8=['UserId','agent','openchannelPause','updatedAt','createdAt','rows','%s/%s','SIP','getTeams','ids','Team','Agents','online','voicePause','interface','sequelize','transaction','each','emit','select','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','send','map','OpenchannelQueue','rawAttributes','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','name','error','find','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','order','sort','pick','OpenchannelQueueId','filter','findAll','User','findAndCountAll'];(function(_0x4a0c10,_0x3d2660){var _0x1e529b=function(_0x40b83f){while(--_0x40b83f){_0x4a0c10['push'](_0x4a0c10['shift']());}};_0x1e529b(++_0x3d2660);}(_0x58a8,0xa7));var _0x858a=function(_0x2aab90,_0x1a8c9a){_0x2aab90=_0x2aab90-0x0;var _0x3e7fe3=_0x58a8[_0x2aab90];return _0x3e7fe3;};'use strict';var BPromise=require(_0x858a('0x0'));var util=require(_0x858a('0x1'));var _=require(_0x858a('0x2'));var squel=require(_0x858a('0x3'));var Redis=require(_0x858a('0x4'));var qs=require(_0x858a('0x5'));var logger=require(_0x858a('0x6'))(_0x858a('0x7'));var config=require(_0x858a('0x8'));var db=require(_0x858a('0x9'))['db'];config[_0x858a('0xa')]=_[_0x858a('0xb')](config[_0x858a('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x858a('0xc'))(new Redis(config[_0x858a('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithStatusCode(_0x490755,_0x599088){_0x599088=_0x599088||0xcc;return function(_0xb2fad1){if(_0xb2fad1){return _0x490755[_0x858a('0xd')](_0x599088);}return _0x490755[_0x858a('0xe')](_0x599088)[_0x858a('0xf')]();};}function respondWithResult(_0x18837b,_0x51aef1){_0x51aef1=_0x51aef1||0xc8;return function(_0x1c8b69){if(_0x1c8b69){return _0x18837b[_0x858a('0xe')](_0x51aef1)[_0x858a('0x10')](_0x1c8b69);}};}function respondWithFilteredResult(_0x3c48cd,_0x3550bd){return function(_0x58a8c0){if(_0x58a8c0){var _0x414835=typeof _0x3550bd[_0x858a('0x11')]===_0x858a('0x12')&&typeof _0x3550bd[_0x858a('0x13')]===_0x858a('0x12');var _0x133e5f=_0x58a8c0[_0x858a('0x14')];var _0x48fb2a=_0x414835?0x0:_0x3550bd['offset'];var _0x3d6bf=_0x414835?_0x58a8c0[_0x858a('0x14')]:_0x3550bd[_0x858a('0x11')]+_0x3550bd[_0x858a('0x13')];var _0x5577f0;if(_0x3d6bf>=_0x133e5f){_0x3d6bf=_0x133e5f;_0x5577f0=0xc8;}else{_0x5577f0=0xce;}_0x3c48cd['status'](_0x5577f0);return _0x3c48cd['set'](_0x858a('0x15'),_0x48fb2a+'-'+_0x3d6bf+'/'+_0x133e5f)[_0x858a('0x10')](_0x58a8c0);}return null;};}function saveUpdates(_0x1aaf09){return function(_0x58003e){if(_0x58003e){return _0x58003e[_0x858a('0x16')](_0x1aaf09)[_0x858a('0x17')](function(_0x8a5d73){return _0x8a5d73;});}return null;};}function removeEntity(_0x1071e8){return function(_0x6ae741){if(_0x6ae741){return _0x6ae741[_0x858a('0x18')]()[_0x858a('0x17')](function(){var _0x47aec5=_0x6ae741[_0x858a('0x19')]({'plain':!![]});var _0x2f30cd=_0x858a('0x1a');return db[_0x858a('0x1b')]['destroy']({'where':{'type':_0x2f30cd,'resourceId':_0x47aec5['id']}})[_0x858a('0x17')](function(){return _0x6ae741;});})['then'](function(){_0x1071e8['status'](0xcc)[_0x858a('0xf')]();});}};}function handleEntityNotFound(_0x4968bd){return function(_0x58362a){if(!_0x58362a){_0x4968bd[_0x858a('0xd')](0x194);}return _0x58362a;};}function handleError(_0x1e980a,_0x4081f0){_0x4081f0=_0x4081f0||0x1f4;return function(_0x3f21a7){logger['error'](_0x3f21a7[_0x858a('0x1c')]);if(_0x3f21a7['name']){delete _0x3f21a7['name'];}_0x1e980a[_0x858a('0xe')](_0x4081f0)[_0x858a('0x1d')](_0x3f21a7);};}exports['index']=function(_0x1537e4,_0x17a93d){var _0x535d94={};var _0x481bca={'count':0x0,'rows':[]};var _0x3c0596=_[_0x858a('0x1e')](db[_0x858a('0x1f')][_0x858a('0x20')],function(_0x49fa59){return{'name':_0x49fa59['fieldName'],'type':_0x49fa59[_0x858a('0x21')][_0x858a('0x22')]};});_0x535d94=qs[_0x858a('0x23')](_0x3c0596,_0x1537e4);var _0x1a3765={'where':_0x535d94[_0x858a('0x24')]};return db[_0x858a('0x1f')]['count'](_0x1a3765)[_0x858a('0x17')](function(_0x425a4a){_0x481bca['count']=_0x425a4a;_0x535d94[_0x858a('0x25')]=qs[_0x858a('0x25')](_0x1537e4[_0x858a('0x26')]);return db[_0x858a('0x1f')]['findAll'](_0x535d94);})[_0x858a('0x17')](function(_0x5d52fc){_0x481bca['rows']=_0x5d52fc;return _0x481bca;})['then'](respondWithFilteredResult(_0x17a93d,_0x535d94))[_0x858a('0x27')](handleError(_0x17a93d,null));};exports[_0x858a('0x28')]=function(_0x321ca6,_0x4a0033){var _0x36c022={'raw':!![],'where':{'id':_0x321ca6[_0x858a('0x29')]['id']}},_0x33415e={};_0x33415e[_0x858a('0x2a')]=_[_0x858a('0x2b')](db[_0x858a('0x1f')]['rawAttributes']);_0x33415e[_0x858a('0x26')]=_[_0x858a('0x2b')](_0x321ca6['query']);_0x33415e[_0x858a('0x2c')]=_[_0x858a('0x2d')](_0x33415e[_0x858a('0x2a')],_0x33415e[_0x858a('0x26')]);_0x36c022[_0x858a('0x2e')]=_[_0x858a('0x2d')](_0x33415e[_0x858a('0x2a')],qs['fields'](_0x321ca6['query'][_0x858a('0x2f')]));_0x36c022[_0x858a('0x2e')]=_0x36c022[_0x858a('0x2e')][_0x858a('0x30')]?_0x36c022[_0x858a('0x2e')]:_0x33415e['model'];if(_0x321ca6['query'][_0x858a('0x31')]){_0x36c022[_0x858a('0x25')]=[{'all':!![]}];}_0x36c022=_[_0x858a('0x32')]({},_0x36c022,_0x321ca6[_0x858a('0x33')]);return db['OpenchannelQueue']['find'](_0x36c022)[_0x858a('0x17')](handleEntityNotFound(_0x4a0033,null))['then'](respondWithResult(_0x4a0033,null))[_0x858a('0x27')](handleError(_0x4a0033,null));};exports[_0x858a('0x34')]=function(_0x352b5c,_0x218462){return db[_0x858a('0x1f')][_0x858a('0x34')](_0x352b5c[_0x858a('0x35')],{})['then'](function(_0x5401ff){var _0x4c94f3=_0x352b5c[_0x858a('0x36')][_0x858a('0x19')]({'plain':!![]});if(!_0x4c94f3)throw new Error(_0x858a('0x37'));if(_0x4c94f3['role']===_0x858a('0x36')){var _0x56dbc4=_0x5401ff[_0x858a('0x19')]({'plain':!![]});var _0x307965=_0x858a('0x1a');return db[_0x858a('0x38')]['find']({'where':{'name':_0x307965,'userProfileId':_0x4c94f3[_0x858a('0x39')]},'raw':!![]})[_0x858a('0x17')](function(_0x5bb4b4){if(_0x5bb4b4&&_0x5bb4b4[_0x858a('0x3a')]===0x0){return db[_0x858a('0x1b')][_0x858a('0x34')]({'name':_0x56dbc4[_0x858a('0x3b')],'resourceId':_0x56dbc4['id'],'type':_0x5bb4b4['name'],'sectionId':_0x5bb4b4['id']},{})[_0x858a('0x17')](function(){return _0x5401ff;});}else{return _0x5401ff;}})['catch'](function(_0x2ecf16){logger[_0x858a('0x3c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ecf16);throw _0x2ecf16;});}return _0x5401ff;})['then'](respondWithResult(_0x218462,0xc9))[_0x858a('0x27')](handleError(_0x218462,null));};exports[_0x858a('0x16')]=function(_0xb9a66a,_0x4bd8ae){if(_0xb9a66a['body']['id']){delete _0xb9a66a[_0x858a('0x35')]['id'];}return db[_0x858a('0x1f')]['find']({'where':{'id':_0xb9a66a[_0x858a('0x29')]['id']}})['then'](handleEntityNotFound(_0x4bd8ae,null))[_0x858a('0x17')](saveUpdates(_0xb9a66a['body'],null))[_0x858a('0x17')](respondWithResult(_0x4bd8ae,null))[_0x858a('0x27')](handleError(_0x4bd8ae,null));};exports[_0x858a('0x18')]=function(_0x547fad,_0x5c2639){return db[_0x858a('0x1f')][_0x858a('0x3d')]({'where':{'id':_0x547fad[_0x858a('0x29')]['id']}})[_0x858a('0x17')](handleEntityNotFound(_0x5c2639,null))[_0x858a('0x17')](removeEntity(_0x5c2639,null))[_0x858a('0x27')](handleError(_0x5c2639,null));};exports[_0x858a('0x3e')]=function(_0x2824c3,_0x5b5525){return db[_0x858a('0x1f')][_0x858a('0x3e')]()['then'](respondWithResult(_0x5b5525,null))['catch'](handleError(_0x5b5525,null));};exports[_0x858a('0x3f')]=function(_0x3645a7,_0x170270){var _0x38e7c0={'raw':!![],'where':{}},_0x53eabf={},_0x3d103d;return db[_0x858a('0x1f')][_0x858a('0x40')]({'where':{'id':_0x3645a7[_0x858a('0x29')]['id']}})[_0x858a('0x17')](handleEntityNotFound(_0x170270,null))[_0x858a('0x17')](function(_0x5ef74d){if(_0x5ef74d){_0x3d103d=_0x5ef74d[_0x858a('0x19')]({'plain':!![]});_0x53eabf[_0x858a('0x2a')]=_[_0x858a('0x2b')](db[_0x858a('0x41')]['rawAttributes']);_0x53eabf[_0x858a('0x26')]=_[_0x858a('0x2b')](_0x3645a7[_0x858a('0x26')]);_0x53eabf[_0x858a('0x2c')]=_[_0x858a('0x2d')](_0x53eabf[_0x858a('0x2a')],_0x53eabf[_0x858a('0x26')]);_0x38e7c0[_0x858a('0x2e')]=_['intersection'](_0x53eabf[_0x858a('0x2a')],qs['fields'](_0x3645a7[_0x858a('0x26')]['fields']));_0x38e7c0[_0x858a('0x2e')]=_0x38e7c0[_0x858a('0x2e')][_0x858a('0x30')]?_0x38e7c0['attributes']:_0x53eabf['model'];if(!_0x3645a7[_0x858a('0x26')]['hasOwnProperty'](_0x858a('0x42'))){_0x38e7c0[_0x858a('0x13')]=qs[_0x858a('0x13')](_0x3645a7[_0x858a('0x26')][_0x858a('0x13')]);_0x38e7c0['offset']=qs['offset'](_0x3645a7[_0x858a('0x26')][_0x858a('0x11')]);}_0x38e7c0[_0x858a('0x43')]=qs[_0x858a('0x44')](_0x3645a7['query'][_0x858a('0x44')]);_0x38e7c0[_0x858a('0x24')]=qs['filters'](_[_0x858a('0x45')](_0x3645a7[_0x858a('0x26')],_0x53eabf[_0x858a('0x2c')]));_0x38e7c0[_0x858a('0x24')][_0x858a('0x46')]=_0x5ef74d['id'];if(_0x3645a7[_0x858a('0x26')][_0x858a('0x47')]){_0x38e7c0[_0x858a('0x24')]=_[_0x858a('0x32')](_0x38e7c0[_0x858a('0x24')],{'$or':_[_0x858a('0x1e')](_0x38e7c0['attributes'],function(_0x31f7ce){var _0x579e75={};_0x579e75[_0x31f7ce]={'$like':'%'+_0x3645a7[_0x858a('0x26')]['filter']+'%'};return _0x579e75;})});}_0x38e7c0=_['merge']({},_0x38e7c0,_0x3645a7[_0x858a('0x33')]);return db['UserOpenchannelQueue'][_0x858a('0x48')](_0x38e7c0);}})[_0x858a('0x17')](function(_0x3bfb57){if(_0x3bfb57){return db[_0x858a('0x49')][_0x858a('0x4a')]({'where':{'id':_['map'](_0x3bfb57,_0x858a('0x4b')),'role':_0x858a('0x4c')},'attributes':['id','name',_0x858a('0x4d'),_0x858a('0x4e'),_0x858a('0x4f')]});}})[_0x858a('0x17')](function(_0xb73bed){if(_0xb73bed){return{'count':_0xb73bed[_0x858a('0x14')],'rows':_[_0x858a('0x1e')](_0xb73bed[_0x858a('0x50')],function(_0x2a90e9){return{'membername':_0x2a90e9[_0x858a('0x3b')],'UserId':_0x2a90e9['id'],'queue_name':_0x3d103d['name'],'OpenchannelQueueId':_0x3d103d['id'],'interface':util['format'](_0x858a('0x51'),_0x858a('0x52'),_0x2a90e9['name']),'penalty':0x0,'paused':_0x2a90e9[_0x858a('0x4d')],'createdAt':_0x2a90e9[_0x858a('0x4f')],'updatedAt':_0x2a90e9[_0x858a('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x858a('0x17')](respondWithFilteredResult(_0x170270,_0x38e7c0))['catch'](handleError(_0x170270,null));};exports[_0x858a('0x53')]=function(_0x5cd877,_0x481d2d){var _0x4593a9={};var _0x23734c={};var _0x30d336;var _0x418880;return db[_0x858a('0x1f')][_0x858a('0x40')]({'where':{'id':_0x5cd877[_0x858a('0x29')]['id']}})[_0x858a('0x17')](handleEntityNotFound(_0x481d2d,null))[_0x858a('0x17')](function(_0x29b51a){if(_0x29b51a){_0x30d336=_0x29b51a;_0x23734c[_0x858a('0x2a')]=_[_0x858a('0x2b')](db['Team'][_0x858a('0x20')]);_0x23734c['query']=_['keys'](_0x5cd877['query']);_0x23734c[_0x858a('0x2c')]=_[_0x858a('0x2d')](_0x23734c[_0x858a('0x2a')],_0x23734c['query']);_0x4593a9[_0x858a('0x2e')]=_[_0x858a('0x2d')](_0x23734c[_0x858a('0x2a')],qs[_0x858a('0x2f')](_0x5cd877[_0x858a('0x26')][_0x858a('0x2f')]));_0x4593a9[_0x858a('0x2e')]=_0x4593a9['attributes'][_0x858a('0x30')]?_0x4593a9['attributes']:_0x23734c[_0x858a('0x2a')];_0x4593a9[_0x858a('0x43')]=qs[_0x858a('0x44')](_0x5cd877[_0x858a('0x26')]['sort']);_0x4593a9[_0x858a('0x24')]=qs[_0x858a('0x2c')](_[_0x858a('0x45')](_0x5cd877['query'],_0x23734c['filters']));if(_0x5cd877['query']['filter']){_0x4593a9[_0x858a('0x24')]=_[_0x858a('0x32')](_0x4593a9[_0x858a('0x24')],{'$or':_['map'](_0x4593a9[_0x858a('0x2e')],function(_0x9dbf22){var _0x249112={};_0x249112[_0x9dbf22]={'$like':'%'+_0x5cd877[_0x858a('0x26')][_0x858a('0x47')]+'%'};return _0x249112;})});}_0x4593a9=_[_0x858a('0x32')]({},_0x4593a9,_0x5cd877['options']);return _0x30d336[_0x858a('0x53')](_0x4593a9);}})['then'](function(_0x16bec3){if(_0x16bec3){_0x418880=_0x16bec3[_0x858a('0x30')];if(!_0x5cd877[_0x858a('0x26')]['hasOwnProperty'](_0x858a('0x42'))){_0x4593a9[_0x858a('0x13')]=qs[_0x858a('0x13')](_0x5cd877[_0x858a('0x26')][_0x858a('0x13')]);_0x4593a9[_0x858a('0x11')]=qs[_0x858a('0x11')](_0x5cd877[_0x858a('0x26')]['offset']);}return _0x30d336[_0x858a('0x53')](_0x4593a9);}})[_0x858a('0x17')](function(_0x451c3b){if(_0x451c3b){return _0x451c3b?{'count':_0x418880,'rows':_0x451c3b}:null;}})[_0x858a('0x17')](respondWithResult(_0x481d2d,null))['catch'](handleError(_0x481d2d,null));};exports['addTeams']=function(_0x3ddd8e,_0x25377f){var _0xf22cfa=_0x3ddd8e[_0x858a('0x35')][_0x858a('0x54')];return db[_0x858a('0x55')][_0x858a('0x48')]({'where':{'id':_0xf22cfa},'attributes':['id'],'include':[{'model':db[_0x858a('0x49')],'as':_0x858a('0x56'),'attributes':['id',_0x858a('0x3b'),_0x858a('0x57'),_0x858a('0x58'),_0x858a('0x59')],'raw':!![]}]})['then'](function(_0x2ae8fc){if(_0x2ae8fc){var _0x53235e=_['flatMap'](_0x2ae8fc,function(_0x4bc0d3){var _0x1814f9=_0x4bc0d3[_0x858a('0x19')]({'plain':!![]});return _0x1814f9[_0x858a('0x56')];});return db[_0x858a('0x1f')][_0x858a('0x3d')]({'where':{'id':_0x3ddd8e[_0x858a('0x29')]['id']}})[_0x858a('0x17')](function(_0x307378){return db[_0x858a('0x5a')][_0x858a('0x5b')](function(_0x3b0fbb){return _0x307378['addTeams'](_0xf22cfa,{'transaction':_0x3b0fbb})['then'](function(){return BPromise[_0x858a('0x5c')](_0x53235e,function(_0x470e1f){return db[_0x858a('0x41')]['findOrCreate']({'where':{'UserId':_0x470e1f['id'],'OpenchannelQueueId':_0x3ddd8e[_0x858a('0x29')]['id']},'transaction':_0x3b0fbb});});})[_0x858a('0x17')](function(){_0x53235e['forEach'](function(_0x46c450){socket[_0x858a('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x46c450['id'],'OpenchannelQueueId':_0x307378['id']});});});});});}})[_0x858a('0x17')](respondWithStatusCode(_0x25377f,null))[_0x858a('0x27')](handleError(_0x25377f,null));};exports['removeTeams']=function(_0x51a8ca,_0xa65ac4){return db['Team'][_0x858a('0x48')]({'where':{'id':_0x51a8ca[_0x858a('0x26')][_0x858a('0x54')]},'attributes':['id'],'include':[{'model':db[_0x858a('0x49')],'as':_0x858a('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xa65ac4,null))[_0x858a('0x17')](function(_0x4394fa){var _0x30259c=_[_0x858a('0x1e')](_0x4394fa,'id');var _0x279274=[];var _0x42ed23=[];var _0x3cc1a8=squel[_0x858a('0x5e')]();_0x3cc1a8['field'](_0x858a('0x5f'))[_0x858a('0x60')](_0x858a('0x61'),'tq')[_0x858a('0x62')](_0x858a('0x63'),'ut',_0x858a('0x64'))[_0x858a('0x24')](_0x858a('0x65'),_0x51a8ca[_0x858a('0x29')]['id']);for(var _0x281866=0x0;_0x281866<_0x4394fa[_0x858a('0x30')];_0x281866+=0x1){let _0x6c0eb0=_0x4394fa[_0x281866];for(var _0x3a2fd6=0x0;_0x3a2fd6<_0x6c0eb0[_0x858a('0x56')][_0x858a('0x30')];_0x3a2fd6+=0x1){let _0x354212=_0x6c0eb0[_0x858a('0x56')][_0x3a2fd6];var _0x38e320=_0x3cc1a8[_0x858a('0x66')]();_0x38e320[_0x858a('0x24')]('ut.UserId\x20=\x20?',_0x354212['id']);_0x42ed23[_0x858a('0x67')](db[_0x858a('0x5a')]['query'](_0x38e320[_0x858a('0x68')](),{'type':db[_0x858a('0x5a')][_0x858a('0x69')][_0x858a('0x6a')]})[_0x858a('0x17')](function(_0x443abc){if(_0x443abc[_0x858a('0x30')]===0x1){return _0x354212['id'];}else{var _0x2bd3f9=_['every'](_['map'](_0x443abc,_0x858a('0x6b')),function(_0x3c0733){return _[_0x858a('0x6c')](_0x30259c,_0x3c0733);});if(_0x2bd3f9){return _0x354212['id'];}}}));}}return BPromise[_0x858a('0x6d')](_0x42ed23)[_0x858a('0x17')](function(_0x206142){_0x279274=_(_0x279274)[_0x858a('0x6e')](_0x206142)['compact']()[_0x858a('0x6f')]();return db[_0x858a('0x1f')][_0x858a('0x3d')]({'where':{'id':_0x51a8ca[_0x858a('0x29')]['id']}})[_0x858a('0x17')](function(_0xf7308e){return db[_0x858a('0x5a')][_0x858a('0x5b')](function(_0x12999e){return _0xf7308e[_0x858a('0x70')](_0x51a8ca['query'][_0x858a('0x54')],{'transaction':_0x12999e})['then'](function(){if(!_[_0x858a('0x71')](_0x279274)){return _0xf7308e[_0x858a('0x72')](_0x279274,{'transaction':_0x12999e});}})[_0x858a('0x17')](function(){_0x279274['forEach'](function(_0x2f89be){socket[_0x858a('0x5d')](_0x858a('0x73'),{'UserId':_0x2f89be,'OpenchannelQueueId':_0xf7308e['id']});});});});});});})['then'](respondWithStatusCode(_0xa65ac4,null))[_0x858a('0x27')](handleError(_0xa65ac4,null));};exports['addAgents']=function(_0x5983b2,_0x237442){return db['OpenchannelQueue'][_0x858a('0x3d')]({'where':{'id':_0x5983b2['params']['id']}})['then'](handleEntityNotFound(_0x237442,null))[_0x858a('0x17')](function(_0x31e30c){if(_0x31e30c){return _0x31e30c[_0x858a('0x74')](_0x5983b2['body']['ids'],_[_0x858a('0x75')](_0x5983b2[_0x858a('0x35')],[_0x858a('0x54'),'id'])||{})[_0x858a('0x76')](function(_0x334f7a){for(var _0x2ef155=0x0;_0x2ef155<_0x5983b2[_0x858a('0x35')]['ids']['length'];_0x2ef155+=0x1){socket[_0x858a('0x5d')]('userOpenchannelQueue:save',{'UserId':Number(_0x5983b2[_0x858a('0x35')][_0x858a('0x54')][_0x2ef155]),'OpenchannelQueueId':Number(_0x5983b2['params']['id'])});}return _0x334f7a;});}})[_0x858a('0x17')](respondWithResult(_0x237442,null))[_0x858a('0x27')](handleError(_0x237442,null));};exports[_0x858a('0x72')]=function(_0x5f08d6,_0x33e6c7){return db['OpenchannelQueue'][_0x858a('0x3d')]({'where':{'id':_0x5f08d6[_0x858a('0x29')]['id']}})[_0x858a('0x17')](handleEntityNotFound(_0x33e6c7,null))['then'](function(_0x5cc8e0){if(_0x5cc8e0){return _0x5cc8e0[_0x858a('0x72')](_0x5f08d6[_0x858a('0x26')][_0x858a('0x54')])[_0x858a('0x17')](function(){if(_[_0x858a('0x77')](_0x5f08d6[_0x858a('0x26')][_0x858a('0x54')])){for(var _0x1cceb6=0x0;_0x1cceb6<_0x5f08d6[_0x858a('0x26')][_0x858a('0x54')][_0x858a('0x30')];_0x1cceb6+=0x1){socket[_0x858a('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5f08d6[_0x858a('0x26')][_0x858a('0x54')][_0x1cceb6]),'OpenchannelQueueId':Number(_0x5f08d6[_0x858a('0x29')]['id'])});}}else{socket['emit'](_0x858a('0x73'),{'UserId':Number(_0x5f08d6[_0x858a('0x26')][_0x858a('0x54')]),'OpenchannelQueueId':Number(_0x5f08d6['params']['id'])});}});}})[_0x858a('0x17')](respondWithStatusCode(_0x33e6c7,null))[_0x858a('0x27')](handleError(_0x33e6c7,null));};exports[_0x858a('0x78')]=function(_0x48c84f,_0x4ff6e3){var _0x2dd5cf={};var _0x559e23={};var _0x597d4a;var _0xd308b6;return db[_0x858a('0x1f')][_0x858a('0x40')]({'where':{'id':_0x48c84f['params']['id']}})['then'](handleEntityNotFound(_0x4ff6e3,null))[_0x858a('0x17')](function(_0xc2a44a){if(_0xc2a44a){_0x597d4a=_0xc2a44a;_0x559e23[_0x858a('0x2a')]=_[_0x858a('0x2b')](db[_0x858a('0x49')][_0x858a('0x20')]);_0x559e23['query']=_['keys'](_0x48c84f[_0x858a('0x26')]);_0x559e23[_0x858a('0x2c')]=_[_0x858a('0x2d')](_0x559e23[_0x858a('0x2a')],_0x559e23[_0x858a('0x26')]);_0x2dd5cf[_0x858a('0x2e')]=_[_0x858a('0x2d')](_0x559e23[_0x858a('0x2a')],qs[_0x858a('0x2f')](_0x48c84f['query'][_0x858a('0x2f')]));_0x2dd5cf[_0x858a('0x2e')]=_0x2dd5cf[_0x858a('0x2e')][_0x858a('0x30')]?_0x2dd5cf[_0x858a('0x2e')]:_0x559e23['model'];_0x2dd5cf[_0x858a('0x43')]=qs[_0x858a('0x44')](_0x48c84f[_0x858a('0x26')]['sort']);_0x2dd5cf[_0x858a('0x24')]=qs[_0x858a('0x2c')](_[_0x858a('0x45')](_0x48c84f[_0x858a('0x26')],_0x559e23[_0x858a('0x2c')]));if(_0x48c84f[_0x858a('0x26')]['filter']){_0x2dd5cf[_0x858a('0x24')]=_['merge'](_0x2dd5cf[_0x858a('0x24')],{'$or':_[_0x858a('0x1e')](_0x2dd5cf['attributes'],function(_0x22c784){var _0x49cc65={};_0x49cc65[_0x22c784]={'$like':'%'+_0x48c84f[_0x858a('0x26')][_0x858a('0x47')]+'%'};return _0x49cc65;})});}_0x2dd5cf=_[_0x858a('0x32')]({},_0x2dd5cf,_0x48c84f[_0x858a('0x33')]);return _0x597d4a[_0x858a('0x78')](_0x2dd5cf);}})[_0x858a('0x17')](function(_0x4b79c5){if(_0x4b79c5){_0xd308b6=_0x4b79c5[_0x858a('0x30')];if(!_0x48c84f[_0x858a('0x26')]['hasOwnProperty'](_0x858a('0x42'))){_0x2dd5cf[_0x858a('0x13')]=qs[_0x858a('0x13')](_0x48c84f[_0x858a('0x26')][_0x858a('0x13')]);_0x2dd5cf[_0x858a('0x11')]=qs['offset'](_0x48c84f[_0x858a('0x26')][_0x858a('0x11')]);}return _0x597d4a[_0x858a('0x78')](_0x2dd5cf);}})['then'](function(_0x32545a){if(_0x32545a){return _0x32545a?{'count':_0xd308b6,'rows':_0x32545a}:null;}})[_0x858a('0x17')](respondWithResult(_0x4ff6e3,null))[_0x858a('0x27')](handleError(_0x4ff6e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 8957547..8ebdd94 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 _0x1fa8=['events','../../mysqldb','OpenchannelQueue','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3daab4,_0x353666){var _0x3fc7ea=function(_0x1d37bd){while(--_0x1d37bd){_0x3daab4['push'](_0x3daab4['shift']());}};_0x3fc7ea(++_0x353666);}(_0x1fa8,0x1cc));var _0x81fa=function(_0x1eb837,_0x24429f){_0x1eb837=_0x1eb837-0x0;var _0x4ed333=_0x1fa8[_0x1eb837];return _0x4ed333;};'use strict';var EventEmitter=require(_0x81fa('0x0'));var OpenchannelQueue=require(_0x81fa('0x1'))['db'][_0x81fa('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x81fa('0x3'),'afterUpdate':_0x81fa('0x4'),'afterDestroy':_0x81fa('0x5')};function emitEvent(_0x11251c){return function(_0x234351,_0x39cc96,_0x20d8c1){OpenchannelQueueEvents[_0x81fa('0x6')](_0x11251c+':'+_0x234351['id'],_0x234351);OpenchannelQueueEvents[_0x81fa('0x6')](_0x11251c,_0x234351);_0x20d8c1(null);};}for(var e in events){if(events[_0x81fa('0x7')](e)){var event=events[e];OpenchannelQueue[_0x81fa('0x8')](e,emitEvent(event));}}module[_0x81fa('0x9')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x2130=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save'];(function(_0x34c3c3,_0x48ce43){var _0x3dc827=function(_0x1990f4){while(--_0x1990f4){_0x34c3c3['push'](_0x34c3c3['shift']());}};_0x3dc827(++_0x48ce43);}(_0x2130,0xff));var _0x0213=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x2130[_0x4bb66f];return _0xf2772f;};'use strict';var EventEmitter=require(_0x0213('0x0'));var OpenchannelQueue=require(_0x0213('0x1'))['db'][_0x0213('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x0213('0x3')](0x0);var events={'afterCreate':_0x0213('0x4'),'afterUpdate':_0x0213('0x5'),'afterDestroy':_0x0213('0x6')};function emitEvent(_0x36aaa0){return function(_0x3c9482,_0x48154f,_0x36b3a2){OpenchannelQueueEvents[_0x0213('0x7')](_0x36aaa0+':'+_0x3c9482['id'],_0x3c9482);OpenchannelQueueEvents[_0x0213('0x7')](_0x36aaa0,_0x3c9482);_0x36b3a2(null);};}for(var e in events){if(events[_0x0213('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0x0213('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index d3307aa..2228cad 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 _0xcce1=['../../config/environment','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','bluebird'];(function(_0x280dd8,_0x5c8eb8){var _0x2a6aa6=function(_0x118d85){while(--_0x118d85){_0x280dd8['push'](_0x280dd8['shift']());}};_0x2a6aa6(++_0x5c8eb8);}(_0xcce1,0x68));var _0x1cce=function(_0x25df80,_0xa2aec5){_0x25df80=_0x25df80-0x0;var _0x17b6d0=_0xcce1[_0x25df80];return _0x17b6d0;};'use strict';var _=require(_0x1cce('0x0'));var util=require(_0x1cce('0x1'));var logger=require(_0x1cce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1cce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1cce('0x4'));var attributes=require('./openchannelQueue.attributes');module[_0x1cce('0x5')]=function(_0x22287d,_0x12b248){return _0x22287d[_0x1cce('0x6')](_0x1cce('0x7'),attributes,{'tableName':_0x1cce('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b94=['openchannel_queues','lodash','util','api','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue'];(function(_0x6d394d,_0x185b80){var _0x1f0621=function(_0x2e5c81){while(--_0x2e5c81){_0x6d394d['push'](_0x6d394d['shift']());}};_0x1f0621(++_0x185b80);}(_0x7b94,0x1e1));var _0x47b9=function(_0x228b2e,_0x5dc225){_0x228b2e=_0x228b2e-0x0;var _0x4346ab=_0x7b94[_0x228b2e];return _0x4346ab;};'use strict';var _=require(_0x47b9('0x0'));var util=require(_0x47b9('0x1'));var logger=require('../../config/logger')(_0x47b9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x47b9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x47b9('0x4'));var config=require(_0x47b9('0x5'));var attributes=require(_0x47b9('0x6'));module[_0x47b9('0x7')]=function(_0x1be407,_0x56b0fc){return _0x1be407['define'](_0x47b9('0x8'),attributes,{'tableName':_0x47b9('0x9'),'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 d8bca29..766241b 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 _0x8ed3=['register','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','map','include','model','then','info','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./openchannelQueue.socket'];(function(_0x2f861f,_0x34215b){var _0x2bb3d7=function(_0x5a7b2a){while(--_0x5a7b2a){_0x2f861f['push'](_0x2f861f['shift']());}};_0x2bb3d7(++_0x34215b);}(_0x8ed3,0x1b4));var _0x38ed=function(_0x50d0a5,_0x3ece14){_0x50d0a5=_0x50d0a5-0x0;var _0x16a49c=_0x8ed3[_0x50d0a5];return _0x16a49c;};'use strict';var _=require(_0x38ed('0x0'));var util=require(_0x38ed('0x1'));var moment=require(_0x38ed('0x2'));var BPromise=require(_0x38ed('0x3'));var rs=require(_0x38ed('0x4'));var fs=require('fs');var Redis=require(_0x38ed('0x5'));var db=require(_0x38ed('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x38ed('0x7'))(_0x38ed('0x8'));var config=require(_0x38ed('0x9'));var jayson=require(_0x38ed('0xa'));var client=jayson[_0x38ed('0xb')][_0x38ed('0xc')]({'port':0x232a});config[_0x38ed('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38ed('0xd')]));require(_0x38ed('0xe'))[_0x38ed('0xf')](socket);function respondWithRpcPromise(_0x11e802,_0x2d3ab4,_0x266ed0){return new BPromise(function(_0x4b845f,_0x5afe17){return client['request'](_0x11e802,_0x266ed0)['then'](function(_0x515b2f){logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x2d3ab4,'request\x20sent');logger[_0x38ed('0x10')](_0x38ed('0x11'),_0x2d3ab4,_0x38ed('0x12'),JSON[_0x38ed('0x13')](_0x515b2f));if(_0x515b2f[_0x38ed('0x14')]){if(_0x515b2f[_0x38ed('0x14')][_0x38ed('0x15')]===0x1f4){logger['error'](_0x38ed('0x16'),_0x2d3ab4,_0x515b2f[_0x38ed('0x14')][_0x38ed('0x17')]);return _0x5afe17(_0x515b2f[_0x38ed('0x14')]['message']);}logger[_0x38ed('0x14')](_0x38ed('0x16'),_0x2d3ab4,_0x515b2f[_0x38ed('0x14')][_0x38ed('0x17')]);return _0x4b845f(_0x515b2f[_0x38ed('0x14')]['message']);}else{logger['info'](_0x38ed('0x16'),_0x2d3ab4,_0x38ed('0x12'));_0x4b845f(_0x515b2f[_0x38ed('0x18')][_0x38ed('0x17')]);}})[_0x38ed('0x19')](function(_0x48bbc3){logger[_0x38ed('0x14')](_0x38ed('0x16'),_0x2d3ab4,_0x48bbc3);_0x5afe17(_0x48bbc3);});});}exports['GetOpenchannelQueue']=function(_0x50035e){var _0x2d0731=this;return new Promise(function(_0x2d0da6,_0x49f66f){return db[_0x38ed('0x1a')][_0x38ed('0x1b')]({'raw':_0x50035e[_0x38ed('0x1c')]?_0x50035e['options'][_0x38ed('0x1d')]===undefined?!![]:![]:!![],'where':_0x50035e['options']?_0x50035e[_0x38ed('0x1c')][_0x38ed('0x1e')]||null:null,'attributes':_0x50035e[_0x38ed('0x1c')]?_0x50035e[_0x38ed('0x1c')][_0x38ed('0x1f')]||null:null,'limit':_0x50035e[_0x38ed('0x1c')]?_0x50035e[_0x38ed('0x1c')][_0x38ed('0x20')]||null:null,'include':_0x50035e[_0x38ed('0x1c')]?_0x50035e[_0x38ed('0x1c')]['include']?_[_0x38ed('0x21')](_0x50035e[_0x38ed('0x1c')][_0x38ed('0x22')],function(_0x2756b4){return{'model':db[_0x2756b4['model']],'as':_0x2756b4['as'],'attributes':_0x2756b4[_0x38ed('0x1f')],'include':_0x2756b4[_0x38ed('0x22')]?_[_0x38ed('0x21')](_0x2756b4['include'],function(_0x11bd8e){return{'model':db[_0x11bd8e['model']],'as':_0x11bd8e['as'],'attributes':_0x11bd8e[_0x38ed('0x1f')],'include':_0x11bd8e['include']?_[_0x38ed('0x21')](_0x11bd8e[_0x38ed('0x22')],function(_0x18fdeb){return{'model':db[_0x18fdeb[_0x38ed('0x23')]],'as':_0x18fdeb['as'],'attributes':_0x18fdeb['attributes']};}):[]};}):[]};}):[]:[]})[_0x38ed('0x24')](function(_0x422ed8){logger[_0x38ed('0x25')]('GetOpenchannelQueue',_0x50035e);logger[_0x38ed('0x10')](_0x38ed('0x26'),_0x50035e,JSON[_0x38ed('0x13')](_0x422ed8));_0x2d0da6(_0x422ed8);})[_0x38ed('0x19')](function(_0x444471){logger['error'](_0x38ed('0x26'),_0x444471[_0x38ed('0x17')],_0x50035e);_0x49f66f(_0x2d0731['error'](0x1f4,_0x444471[_0x38ed('0x17')]));});});};exports[_0x38ed('0x27')]=function(_0x2ebdc5){var _0x4f20e7=this;return new Promise(function(_0x301dbd,_0x5aa32f){return db[_0x38ed('0x1a')][_0x38ed('0x28')]({'raw':_0x2ebdc5[_0x38ed('0x1c')]?_0x2ebdc5[_0x38ed('0x1c')][_0x38ed('0x1d')]===undefined?!![]:![]:!![],'where':_0x2ebdc5[_0x38ed('0x1c')]?_0x2ebdc5[_0x38ed('0x1c')]['where']||null:null,'attributes':_0x2ebdc5['options']?_0x2ebdc5[_0x38ed('0x1c')][_0x38ed('0x1f')]||null:null,'include':_0x2ebdc5[_0x38ed('0x1c')]?_0x2ebdc5['options'][_0x38ed('0x22')]?_['map'](_0x2ebdc5[_0x38ed('0x1c')][_0x38ed('0x22')],function(_0x4702cf){return{'model':db[_0x4702cf['model']],'as':_0x4702cf['as'],'attributes':_0x4702cf[_0x38ed('0x1f')],'include':_0x4702cf[_0x38ed('0x22')]?_[_0x38ed('0x21')](_0x4702cf[_0x38ed('0x22')],function(_0x3be7c1){return{'model':db[_0x3be7c1[_0x38ed('0x23')]],'as':_0x3be7c1['as'],'attributes':_0x3be7c1['attributes'],'include':_0x3be7c1[_0x38ed('0x22')]?_[_0x38ed('0x21')](_0x3be7c1[_0x38ed('0x22')],function(_0xa0e283){return{'model':db[_0xa0e283[_0x38ed('0x23')]],'as':_0xa0e283['as'],'attributes':_0xa0e283[_0x38ed('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49d656){logger[_0x38ed('0x25')]('ShowOpenchannelQueue',_0x2ebdc5);logger[_0x38ed('0x10')](_0x38ed('0x27'),_0x2ebdc5,JSON[_0x38ed('0x13')](_0x49d656));_0x301dbd(_0x49d656);})[_0x38ed('0x19')](function(_0x5056fc){logger[_0x38ed('0x14')](_0x38ed('0x27'),_0x5056fc[_0x38ed('0x17')],_0x2ebdc5);_0x5aa32f(_0x4f20e7[_0x38ed('0x14')](0x1f4,_0x5056fc['message']));});});}; \ No newline at end of file +var _0x3e95=['catch','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','limit','include','map','model','attributes','then','find','ShowOpenchannelQueue','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1504bd,_0x39395f){var _0x272dec=function(_0x4c5d85){while(--_0x4c5d85){_0x1504bd['push'](_0x1504bd['shift']());}};_0x272dec(++_0x39395f);}(_0x3e95,0x18a));var _0x53e9=function(_0x49f01f,_0x12a498){_0x49f01f=_0x49f01f-0x0;var _0x28673b=_0x3e95[_0x49f01f];return _0x28673b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x53e9('0x0'));var BPromise=require(_0x53e9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x53e9('0x2'));var db=require(_0x53e9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x53e9('0x4'))(_0x53e9('0x5'));var config=require(_0x53e9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x53e9('0x7')][_0x53e9('0x8')]({'port':0x232a});config[_0x53e9('0x9')]=_[_0x53e9('0xa')](config[_0x53e9('0x9')],{'host':_0x53e9('0xb'),'port':0x18eb});var socket=require(_0x53e9('0xc'))(new Redis(config[_0x53e9('0x9')]));require('./openchannelQueue.socket')[_0x53e9('0xd')](socket);function respondWithRpcPromise(_0x159d96,_0x1a7172,_0x272206){return new BPromise(function(_0xc783ca,_0x5c55cc){return client['request'](_0x159d96,_0x272206)['then'](function(_0x11734d){logger[_0x53e9('0xe')](_0x53e9('0xf'),_0x1a7172,_0x53e9('0x10'));logger[_0x53e9('0x11')](_0x53e9('0x12'),_0x1a7172,_0x53e9('0x10'),JSON[_0x53e9('0x13')](_0x11734d));if(_0x11734d[_0x53e9('0x14')]){if(_0x11734d['error'][_0x53e9('0x15')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x1a7172,_0x11734d[_0x53e9('0x14')]['message']);return _0x5c55cc(_0x11734d[_0x53e9('0x14')][_0x53e9('0x16')]);}logger[_0x53e9('0x14')](_0x53e9('0xf'),_0x1a7172,_0x11734d[_0x53e9('0x14')]['message']);return _0xc783ca(_0x11734d[_0x53e9('0x14')]['message']);}else{logger[_0x53e9('0xe')](_0x53e9('0xf'),_0x1a7172,'request\x20sent');_0xc783ca(_0x11734d[_0x53e9('0x17')][_0x53e9('0x16')]);}})[_0x53e9('0x18')](function(_0x311ebf){logger[_0x53e9('0x14')](_0x53e9('0xf'),_0x1a7172,_0x311ebf);_0x5c55cc(_0x311ebf);});});}exports[_0x53e9('0x19')]=function(_0x5b8af4){var _0x350e5b=this;return new Promise(function(_0x5764ff,_0x5948ae){return db[_0x53e9('0x1a')]['findAll']({'raw':_0x5b8af4['options']?_0x5b8af4['options'][_0x53e9('0x1b')]===undefined?!![]:![]:!![],'where':_0x5b8af4[_0x53e9('0x1c')]?_0x5b8af4[_0x53e9('0x1c')][_0x53e9('0x1d')]||null:null,'attributes':_0x5b8af4[_0x53e9('0x1c')]?_0x5b8af4[_0x53e9('0x1c')]['attributes']||null:null,'limit':_0x5b8af4['options']?_0x5b8af4[_0x53e9('0x1c')][_0x53e9('0x1e')]||null:null,'include':_0x5b8af4[_0x53e9('0x1c')]?_0x5b8af4[_0x53e9('0x1c')][_0x53e9('0x1f')]?_[_0x53e9('0x20')](_0x5b8af4['options'][_0x53e9('0x1f')],function(_0xaad57a){return{'model':db[_0xaad57a[_0x53e9('0x21')]],'as':_0xaad57a['as'],'attributes':_0xaad57a[_0x53e9('0x22')],'include':_0xaad57a[_0x53e9('0x1f')]?_[_0x53e9('0x20')](_0xaad57a[_0x53e9('0x1f')],function(_0x166638){return{'model':db[_0x166638['model']],'as':_0x166638['as'],'attributes':_0x166638['attributes'],'include':_0x166638['include']?_[_0x53e9('0x20')](_0x166638['include'],function(_0x4a2355){return{'model':db[_0x4a2355[_0x53e9('0x21')]],'as':_0x4a2355['as'],'attributes':_0x4a2355[_0x53e9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x53e9('0x23')](function(_0x359cb2){logger[_0x53e9('0xe')](_0x53e9('0x19'),_0x5b8af4);logger[_0x53e9('0x11')]('GetOpenchannelQueue',_0x5b8af4,JSON[_0x53e9('0x13')](_0x359cb2));_0x5764ff(_0x359cb2);})[_0x53e9('0x18')](function(_0x1efcaf){logger[_0x53e9('0x14')]('GetOpenchannelQueue',_0x1efcaf[_0x53e9('0x16')],_0x5b8af4);_0x5948ae(_0x350e5b[_0x53e9('0x14')](0x1f4,_0x1efcaf['message']));});});};exports['ShowOpenchannelQueue']=function(_0x4b6848){var _0xa5fd6d=this;return new Promise(function(_0x24e386,_0x3fc061){return db['OpenchannelQueue'][_0x53e9('0x24')]({'raw':_0x4b6848['options']?_0x4b6848[_0x53e9('0x1c')][_0x53e9('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b6848['options']?_0x4b6848['options']['where']||null:null,'attributes':_0x4b6848[_0x53e9('0x1c')]?_0x4b6848[_0x53e9('0x1c')][_0x53e9('0x22')]||null:null,'include':_0x4b6848[_0x53e9('0x1c')]?_0x4b6848[_0x53e9('0x1c')][_0x53e9('0x1f')]?_['map'](_0x4b6848[_0x53e9('0x1c')][_0x53e9('0x1f')],function(_0x14beba){return{'model':db[_0x14beba[_0x53e9('0x21')]],'as':_0x14beba['as'],'attributes':_0x14beba['attributes'],'include':_0x14beba[_0x53e9('0x1f')]?_[_0x53e9('0x20')](_0x14beba[_0x53e9('0x1f')],function(_0x118594){return{'model':db[_0x118594[_0x53e9('0x21')]],'as':_0x118594['as'],'attributes':_0x118594[_0x53e9('0x22')],'include':_0x118594[_0x53e9('0x1f')]?_[_0x53e9('0x20')](_0x118594[_0x53e9('0x1f')],function(_0xa2635){return{'model':db[_0xa2635[_0x53e9('0x21')]],'as':_0xa2635['as'],'attributes':_0xa2635[_0x53e9('0x22')]};}):[]};}):[]};}):[]:[]})[_0x53e9('0x23')](function(_0x1cde49){logger['info']('ShowOpenchannelQueue',_0x4b6848);logger[_0x53e9('0x11')](_0x53e9('0x25'),_0x4b6848,JSON[_0x53e9('0x13')](_0x1cde49));_0x24e386(_0x1cde49);})[_0x53e9('0x18')](function(_0x2521a2){logger[_0x53e9('0x14')](_0x53e9('0x25'),_0x2521a2['message'],_0x4b6848);_0x3fc061(_0xa5fd6d['error'](0x1f4,_0x2521a2[_0x53e9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 5c38833..cb3ec7b 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 _0x2242=['length','openchannelQueue:','./openchannelQueue.events','save','update','emit'];(function(_0x301aa9,_0x397de8){var _0x5907bd=function(_0x41669c){while(--_0x41669c){_0x301aa9['push'](_0x301aa9['shift']());}};_0x5907bd(++_0x397de8);}(_0x2242,0xd4));var _0x2224=function(_0x3d93a4,_0x3b2191){_0x3d93a4=_0x3d93a4-0x0;var _0x539fa2=_0x2242[_0x3d93a4];return _0x539fa2;};'use strict';var OpenchannelQueueEvents=require(_0x2224('0x0'));var events=[_0x2224('0x1'),'remove',_0x2224('0x2')];function createListener(_0x3a52ad,_0x4d53da){return function(_0x2aef68){_0x4d53da[_0x2224('0x3')](_0x3a52ad,_0x2aef68);};}function removeListener(_0x3c60b1,_0x53c467){return function(){OpenchannelQueueEvents['removeListener'](_0x3c60b1,_0x53c467);};}exports['register']=function(_0x2922aa){for(var _0x3761ba=0x0,_0x9d3044=events[_0x2224('0x4')];_0x3761ba<_0x9d3044;_0x3761ba++){var _0x176faa=events[_0x3761ba];var _0x586135=createListener(_0x2224('0x5')+_0x176faa,_0x2922aa);OpenchannelQueueEvents['on'](_0x176faa,_0x586135);}}; \ No newline at end of file +var _0xe264=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove'];(function(_0x467b33,_0x148f33){var _0x1ca4fc=function(_0x42a125){while(--_0x42a125){_0x467b33['push'](_0x467b33['shift']());}};_0x1ca4fc(++_0x148f33);}(_0xe264,0x9f));var _0x4e26=function(_0x4191bc,_0x3096c5){_0x4191bc=_0x4191bc-0x0;var _0x1ffd4e=_0xe264[_0x4191bc];return _0x1ffd4e;};'use strict';var OpenchannelQueueEvents=require(_0x4e26('0x0'));var events=[_0x4e26('0x1'),_0x4e26('0x2'),'update'];function createListener(_0x1e9a6f,_0x5be5a8){return function(_0x95c916){_0x5be5a8['emit'](_0x1e9a6f,_0x95c916);};}function removeListener(_0x32cef8,_0x4438c3){return function(){OpenchannelQueueEvents['removeListener'](_0x32cef8,_0x4438c3);};}exports[_0x4e26('0x3')]=function(_0x2d8290){for(var _0x5c77ad=0x0,_0x82e4b6=events[_0x4e26('0x4')];_0x5c77ad<_0x82e4b6;_0x5c77ad++){var _0x287753=events[_0x5c77ad];var _0x18b5dd=createListener(_0x4e26('0x5')+_0x287753,_0x2d8290);OpenchannelQueueEvents['on'](_0x287753,_0x18b5dd);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 9ab3a46..250eb0e 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 _0x203f=['create','put','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x203f,0x194));var _0xf203=function(_0x3005d5,_0xf588c7){_0x3005d5=_0x3005d5-0x0;var _0x547c7e=_0x203f[_0x3005d5];return _0x547c7e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf203('0x0'));var timeout=require(_0xf203('0x1'));var express=require('express');var router=express[_0xf203('0x2')]();var fs_extra=require(_0xf203('0x3'));var auth=require(_0xf203('0x4'));var interaction=require(_0xf203('0x5'));var config=require('../../config/environment');var controller=require(_0xf203('0x6'));router['get']('/',auth[_0xf203('0x7')](),controller[_0xf203('0x8')]);router[_0xf203('0x9')](_0xf203('0xa'),auth[_0xf203('0x7')](),controller[_0xf203('0xb')]);router[_0xf203('0x9')](_0xf203('0xc'),auth['isAuthenticated'](),controller[_0xf203('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf203('0xe')]);router[_0xf203('0xf')](_0xf203('0xc'),auth[_0xf203('0x7')](),controller['update']);router[_0xf203('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf203('0x11')]);module[_0xf203('0x12')]=router; \ No newline at end of file +var _0x59dc=['util','express','Router','fs-extra','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/:id','post','create','update','delete','exports'];(function(_0x4fe416,_0x5a310a){var _0x252725=function(_0x1d67db){while(--_0x1d67db){_0x4fe416['push'](_0x4fe416['shift']());}};_0x252725(++_0x5a310a);}(_0x59dc,0x12c));var _0xc59d=function(_0x5882fd,_0x414c06){_0x5882fd=_0x5882fd-0x0;var _0xb074b6=_0x59dc[_0x5882fd];return _0xb074b6;};'use strict';var multer=require('multer');var util=require(_0xc59d('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc59d('0x1'));var router=express[_0xc59d('0x2')]();var fs_extra=require(_0xc59d('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc59d('0x4'));var config=require('../../config/environment');var controller=require(_0xc59d('0x5'));router[_0xc59d('0x6')]('/',auth[_0xc59d('0x7')](),controller[_0xc59d('0x8')]);router[_0xc59d('0x6')]('/describe',auth[_0xc59d('0x7')](),controller['describe']);router['get'](_0xc59d('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xc59d('0xa')]('/',auth[_0xc59d('0x7')](),controller[_0xc59d('0xb')]);router['put'](_0xc59d('0x9'),auth['isAuthenticated'](),controller[_0xc59d('0xc')]);router[_0xc59d('0xd')](_0xc59d('0x9'),auth[_0xc59d('0x7')](),controller['destroy']);module[_0xc59d('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 8d5b987..71efe8d 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 _0x7eb2=['moment','sequelize','STRING','DATE'];(function(_0x35a5ae,_0x136fcd){var _0x410324=function(_0x190ece){while(--_0x190ece){_0x35a5ae['push'](_0x35a5ae['shift']());}};_0x410324(++_0x136fcd);}(_0x7eb2,0x11c));var _0x27eb=function(_0x6e9e59,_0x28d145){_0x6e9e59=_0x6e9e59-0x0;var _0x4bee0b=_0x7eb2[_0x6e9e59];return _0x4bee0b;};'use strict';var moment=require(_0x27eb('0x0'));var Sequelize=require(_0x27eb('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x27eb('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x27eb('0x2')]},'joinAt':{'type':Sequelize[_0x27eb('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x27eb('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x27eb('0x2')]}}; \ No newline at end of file +var _0xb3a2=['DATE','moment','exports','STRING'];(function(_0x578f1b,_0x4c7544){var _0x45d217=function(_0x176b89){while(--_0x176b89){_0x578f1b['push'](_0x578f1b['shift']());}};_0x45d217(++_0x4c7544);}(_0xb3a2,0x1ed));var _0x2b3a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xb3a2[_0x543084];return _0x306a57;};'use strict';var moment=require(_0x2b3a('0x0'));var Sequelize=require('sequelize');module[_0x2b3a('0x1')]={'uniqueid':{'type':Sequelize[_0x2b3a('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2b3a('0x2')]},'joinAt':{'type':Sequelize[_0x2b3a('0x3')]},'leaveAt':{'type':Sequelize[_0x2b3a('0x3')]},'acceptAt':{'type':Sequelize[_0x2b3a('0x3')]},'exitAt':{'type':Sequelize[_0x2b3a('0x3')]},'reason':{'type':Sequelize[_0x2b3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index a0e63ce..e1ba9c0 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 _0x0e86=['where','filters','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','fields','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','order','sort'];(function(_0x44511e,_0x2242ba){var _0x243798=function(_0x29a312){while(--_0x29a312){_0x44511e['push'](_0x44511e['shift']());}};_0x243798(++_0x2242ba);}(_0x0e86,0xf1));var _0x60e8=function(_0x281305,_0x2998d6){_0x281305=_0x281305-0x0;var _0x56ffbe=_0x0e86[_0x281305];return _0x56ffbe;};'use strict';var emlformat=require(_0x60e8('0x0'));var rimraf=require(_0x60e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x60e8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x60e8('0x3'));var Mustache=require(_0x60e8('0x4'));var util=require('util');var path=require('path');var sox=require(_0x60e8('0x5'));var csv=require(_0x60e8('0x6'));var ejs=require(_0x60e8('0x7'));var fs=require('fs');var fs_extra=require(_0x60e8('0x8'));var _=require(_0x60e8('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x60e8('0xa'));var deskjs=require(_0x60e8('0xb'));var toCsv=require(_0x60e8('0x6'));var querystring=require(_0x60e8('0xc'));var Papa=require('papaparse');var Redis=require(_0x60e8('0xd'));var authService=require(_0x60e8('0xe'));var qs=require(_0x60e8('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x60e8('0x10'))(_0x60e8('0x11'));var utils=require(_0x60e8('0x12'));var config=require(_0x60e8('0x13'));var licenseUtil=require(_0x60e8('0x14'));var db=require(_0x60e8('0x15'))['db'];function respondWithStatusCode(_0x2e4f02,_0x105128){_0x105128=_0x105128||0xcc;return function(_0x119e92){if(_0x119e92){return _0x2e4f02['sendStatus'](_0x105128);}return _0x2e4f02[_0x60e8('0x16')](_0x105128)['end']();};}function respondWithResult(_0x420201,_0x2384e0){_0x2384e0=_0x2384e0||0xc8;return function(_0x41da26){if(_0x41da26){return _0x420201['status'](_0x2384e0)['json'](_0x41da26);}};}function respondWithFilteredResult(_0x3c7ad0,_0x136ab0){return function(_0x55b1b0){if(_0x55b1b0){var _0x10470e=typeof _0x136ab0[_0x60e8('0x17')]===_0x60e8('0x18')&&typeof _0x136ab0[_0x60e8('0x19')]==='undefined';var _0x33256c=_0x55b1b0[_0x60e8('0x1a')];var _0x3c6c43=_0x10470e?0x0:_0x136ab0[_0x60e8('0x17')];var _0x2079bb=_0x10470e?_0x55b1b0[_0x60e8('0x1a')]:_0x136ab0[_0x60e8('0x17')]+_0x136ab0['limit'];var _0x36dab8;if(_0x2079bb>=_0x33256c){_0x2079bb=_0x33256c;_0x36dab8=0xc8;}else{_0x36dab8=0xce;}_0x3c7ad0[_0x60e8('0x16')](_0x36dab8);return _0x3c7ad0[_0x60e8('0x1b')](_0x60e8('0x1c'),_0x3c6c43+'-'+_0x2079bb+'/'+_0x33256c)[_0x60e8('0x1d')](_0x55b1b0);}return null;};}function patchUpdates(_0x4cbc44){return function(_0x442786){try{jsonpatch[_0x60e8('0x1e')](_0x442786,_0x4cbc44,!![]);}catch(_0x2bb46b){return BPromise[_0x60e8('0x1f')](_0x2bb46b);}return _0x442786[_0x60e8('0x20')]();};}function saveUpdates(_0x336807,_0x179b5d){return function(_0x11a273){if(_0x11a273){return _0x11a273[_0x60e8('0x21')](_0x336807)[_0x60e8('0x22')](function(_0x9ecf58){return _0x9ecf58;});}return null;};}function removeEntity(_0x36930c,_0x14368d){return function(_0x1d40fe){if(_0x1d40fe){return _0x1d40fe[_0x60e8('0x23')]()['then'](function(){_0x36930c[_0x60e8('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x187f3b,_0x2a9ce2){return function(_0x5c444a){if(!_0x5c444a){_0x187f3b[_0x60e8('0x24')](0x194);}return _0x5c444a;};}function handleError(_0x3ac0ad,_0x43a759){_0x43a759=_0x43a759||0x1f4;return function(_0xa37db2){logger['error'](_0xa37db2[_0x60e8('0x25')]);if(_0xa37db2[_0x60e8('0x26')]){delete _0xa37db2[_0x60e8('0x26')];}_0x3ac0ad[_0x60e8('0x16')](_0x43a759)[_0x60e8('0x27')](_0xa37db2);};}exports[_0x60e8('0x28')]=function(_0x2ae9c1,_0x483539){var _0x58ded5={},_0x145d61={},_0x4b1c7b={'count':0x0,'rows':[]};var _0x2ee159=_[_0x60e8('0x29')](db[_0x60e8('0x2a')][_0x60e8('0x2b')],function(_0x2525fe){return{'name':_0x2525fe[_0x60e8('0x2c')],'type':_0x2525fe[_0x60e8('0x2d')][_0x60e8('0x2e')]};});_0x145d61[_0x60e8('0x2f')]=_[_0x60e8('0x29')](_0x2ee159,'name');_0x145d61[_0x60e8('0x30')]=_[_0x60e8('0x31')](_0x2ae9c1[_0x60e8('0x30')]);_0x145d61['filters']=_[_0x60e8('0x32')](_0x145d61[_0x60e8('0x2f')],_0x145d61[_0x60e8('0x30')]);_0x58ded5[_0x60e8('0x33')]=_[_0x60e8('0x32')](_0x145d61[_0x60e8('0x2f')],qs['fields'](_0x2ae9c1['query']['fields']));_0x58ded5['attributes']=_0x58ded5[_0x60e8('0x33')]['length']?_0x58ded5[_0x60e8('0x33')]:_0x145d61[_0x60e8('0x2f')];if(!_0x2ae9c1[_0x60e8('0x30')][_0x60e8('0x34')]('nolimit')){_0x58ded5['limit']=qs[_0x60e8('0x19')](_0x2ae9c1[_0x60e8('0x30')]['limit']);_0x58ded5[_0x60e8('0x17')]=qs[_0x60e8('0x17')](_0x2ae9c1[_0x60e8('0x30')][_0x60e8('0x17')]);}_0x58ded5[_0x60e8('0x35')]=qs['sort'](_0x2ae9c1['query'][_0x60e8('0x36')]);_0x58ded5[_0x60e8('0x37')]=qs[_0x60e8('0x38')](_[_0x60e8('0x39')](_0x2ae9c1[_0x60e8('0x30')],_0x145d61[_0x60e8('0x38')]),_0x2ee159);if(_0x2ae9c1[_0x60e8('0x30')]['filter']){_0x58ded5[_0x60e8('0x37')]=_[_0x60e8('0x3a')](_0x58ded5[_0x60e8('0x37')],{'$or':_[_0x60e8('0x29')](_0x2ee159,function(_0x3c3be3){if(_0x3c3be3[_0x60e8('0x2d')]!==_0x60e8('0x3b')){var _0x49bf0d={};_0x49bf0d[_0x3c3be3['name']]={'$like':'%'+_0x2ae9c1[_0x60e8('0x30')][_0x60e8('0x3c')]+'%'};return _0x49bf0d;}})});}_0x58ded5=_[_0x60e8('0x3a')]({},_0x58ded5,_0x2ae9c1[_0x60e8('0x3d')]);var _0x45ab62={'where':_0x58ded5['where']};return db['OpenchannelQueueReport'][_0x60e8('0x1a')](_0x45ab62)['then'](function(_0x46e9d6){_0x4b1c7b[_0x60e8('0x1a')]=_0x46e9d6;if(_0x2ae9c1[_0x60e8('0x30')]['includeAll']){_0x58ded5[_0x60e8('0x3e')]=[{'all':!![]}];}return db[_0x60e8('0x2a')][_0x60e8('0x3f')](_0x58ded5);})[_0x60e8('0x22')](function(_0x30120e){_0x4b1c7b[_0x60e8('0x40')]=_0x30120e;return _0x4b1c7b;})[_0x60e8('0x22')](respondWithFilteredResult(_0x483539,_0x58ded5))[_0x60e8('0x41')](handleError(_0x483539,null));};exports[_0x60e8('0x42')]=function(_0x592db0,_0x220bb2){var _0x326ac6={'raw':!![],'where':{'id':_0x592db0['params']['id']}},_0x5e0ce2={};_0x5e0ce2[_0x60e8('0x2f')]=_[_0x60e8('0x31')](db[_0x60e8('0x2a')][_0x60e8('0x2b')]);_0x5e0ce2[_0x60e8('0x30')]=_[_0x60e8('0x31')](_0x592db0[_0x60e8('0x30')]);_0x5e0ce2[_0x60e8('0x38')]=_[_0x60e8('0x32')](_0x5e0ce2[_0x60e8('0x2f')],_0x5e0ce2[_0x60e8('0x30')]);_0x326ac6[_0x60e8('0x33')]=_[_0x60e8('0x32')](_0x5e0ce2[_0x60e8('0x2f')],qs[_0x60e8('0x43')](_0x592db0[_0x60e8('0x30')][_0x60e8('0x43')]));_0x326ac6[_0x60e8('0x33')]=_0x326ac6[_0x60e8('0x33')]['length']?_0x326ac6[_0x60e8('0x33')]:_0x5e0ce2['model'];if(_0x592db0[_0x60e8('0x30')][_0x60e8('0x44')]){_0x326ac6[_0x60e8('0x3e')]=[{'all':!![]}];}_0x326ac6=_[_0x60e8('0x3a')]({},_0x326ac6,_0x592db0[_0x60e8('0x3d')]);return db['OpenchannelQueueReport'][_0x60e8('0x45')](_0x326ac6)['then'](handleEntityNotFound(_0x220bb2,null))['then'](respondWithResult(_0x220bb2,null))[_0x60e8('0x41')](handleError(_0x220bb2,null));};exports[_0x60e8('0x46')]=function(_0x14d284,_0x5447ee){return db[_0x60e8('0x2a')]['create'](_0x14d284[_0x60e8('0x47')],{})[_0x60e8('0x22')](respondWithResult(_0x5447ee,0xc9))[_0x60e8('0x41')](handleError(_0x5447ee,null));};exports[_0x60e8('0x21')]=function(_0x1e9ad1,_0x4cde82){if(_0x1e9ad1['body']['id']){delete _0x1e9ad1[_0x60e8('0x47')]['id'];}return db[_0x60e8('0x2a')][_0x60e8('0x45')]({'where':{'id':_0x1e9ad1[_0x60e8('0x48')]['id']}})[_0x60e8('0x22')](handleEntityNotFound(_0x4cde82,null))[_0x60e8('0x22')](saveUpdates(_0x1e9ad1[_0x60e8('0x47')],null))['then'](respondWithResult(_0x4cde82,null))[_0x60e8('0x41')](handleError(_0x4cde82,null));};exports[_0x60e8('0x23')]=function(_0x1b51b3,_0x597884){return db[_0x60e8('0x2a')][_0x60e8('0x45')]({'where':{'id':_0x1b51b3[_0x60e8('0x48')]['id']}})['then'](handleEntityNotFound(_0x597884,null))['then'](removeEntity(_0x597884,null))['catch'](handleError(_0x597884,null));};exports[_0x60e8('0x49')]=function(_0x27439d,_0x53e2dc){return db[_0x60e8('0x2a')][_0x60e8('0x49')]()[_0x60e8('0x22')](respondWithResult(_0x53e2dc,null))[_0x60e8('0x41')](handleError(_0x53e2dc,null));}; \ No newline at end of file +var _0xc77b=['fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL','options','includeAll','include','OpenchannelQueueReport','findAll','rows','catch','params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes'];(function(_0x107a14,_0x2673cc){var _0x4d97ff=function(_0x413549){while(--_0x413549){_0x107a14['push'](_0x107a14['shift']());}};_0x4d97ff(++_0x2673cc);}(_0xc77b,0xf9));var _0xbc77=function(_0x2cce17,_0x11ebcb){_0x2cce17=_0x2cce17-0x0;var _0x18aa3e=_0xc77b[_0x2cce17];return _0x18aa3e;};'use strict';var emlformat=require(_0xbc77('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc77('0x1'));var jsonpatch=require(_0xbc77('0x2'));var rp=require(_0xbc77('0x3'));var moment=require('moment');var BPromise=require(_0xbc77('0x4'));var Mustache=require('mustache');var util=require(_0xbc77('0x5'));var path=require(_0xbc77('0x6'));var sox=require(_0xbc77('0x7'));var csv=require(_0xbc77('0x8'));var ejs=require(_0xbc77('0x9'));var fs=require('fs');var fs_extra=require(_0xbc77('0xa'));var _=require('lodash');var squel=require(_0xbc77('0xb'));var crypto=require(_0xbc77('0xc'));var jsforce=require(_0xbc77('0xd'));var deskjs=require(_0xbc77('0xe'));var toCsv=require(_0xbc77('0x8'));var querystring=require(_0xbc77('0xf'));var Papa=require(_0xbc77('0x10'));var Redis=require(_0xbc77('0x11'));var authService=require(_0xbc77('0x12'));var qs=require(_0xbc77('0x13'));var as=require(_0xbc77('0x14'));var hardwareService=require(_0xbc77('0x15'));var logger=require(_0xbc77('0x16'))(_0xbc77('0x17'));var utils=require('../../config/utils');var config=require(_0xbc77('0x18'));var licenseUtil=require(_0xbc77('0x19'));var db=require(_0xbc77('0x1a'))['db'];function respondWithStatusCode(_0xda3c4b,_0x5483f1){_0x5483f1=_0x5483f1||0xcc;return function(_0x212411){if(_0x212411){return _0xda3c4b[_0xbc77('0x1b')](_0x5483f1);}return _0xda3c4b[_0xbc77('0x1c')](_0x5483f1)[_0xbc77('0x1d')]();};}function respondWithResult(_0x25d710,_0x33d943){_0x33d943=_0x33d943||0xc8;return function(_0x327d45){if(_0x327d45){return _0x25d710[_0xbc77('0x1c')](_0x33d943)[_0xbc77('0x1e')](_0x327d45);}};}function respondWithFilteredResult(_0x4b5ad0,_0x4f01e3){return function(_0x17955d){if(_0x17955d){var _0x5ce4ff=typeof _0x4f01e3[_0xbc77('0x1f')]===_0xbc77('0x20')&&typeof _0x4f01e3['limit']==='undefined';var _0x489bca=_0x17955d[_0xbc77('0x21')];var _0x42455a=_0x5ce4ff?0x0:_0x4f01e3['offset'];var _0x1d2aee=_0x5ce4ff?_0x17955d['count']:_0x4f01e3['offset']+_0x4f01e3[_0xbc77('0x22')];var _0x16e62e;if(_0x1d2aee>=_0x489bca){_0x1d2aee=_0x489bca;_0x16e62e=0xc8;}else{_0x16e62e=0xce;}_0x4b5ad0[_0xbc77('0x1c')](_0x16e62e);return _0x4b5ad0[_0xbc77('0x23')]('Content-Range',_0x42455a+'-'+_0x1d2aee+'/'+_0x489bca)['json'](_0x17955d);}return null;};}function patchUpdates(_0x48f7f9){return function(_0x28572c){try{jsonpatch[_0xbc77('0x24')](_0x28572c,_0x48f7f9,!![]);}catch(_0x4c2346){return BPromise[_0xbc77('0x25')](_0x4c2346);}return _0x28572c[_0xbc77('0x26')]();};}function saveUpdates(_0x39b079,_0x4e5bf9){return function(_0x2851e9){if(_0x2851e9){return _0x2851e9['update'](_0x39b079)[_0xbc77('0x27')](function(_0x44c2a6){return _0x44c2a6;});}return null;};}function removeEntity(_0xfb3123,_0x5b1383){return function(_0x4ef967){if(_0x4ef967){return _0x4ef967[_0xbc77('0x28')]()[_0xbc77('0x27')](function(){_0xfb3123[_0xbc77('0x1c')](0xcc)[_0xbc77('0x1d')]();});}};}function handleEntityNotFound(_0x1c3921,_0x5a4c52){return function(_0x2e7e8a){if(!_0x2e7e8a){_0x1c3921['sendStatus'](0x194);}return _0x2e7e8a;};}function handleError(_0x547dae,_0x189495){_0x189495=_0x189495||0x1f4;return function(_0xfd4787){logger[_0xbc77('0x29')](_0xfd4787['stack']);if(_0xfd4787[_0xbc77('0x2a')]){delete _0xfd4787[_0xbc77('0x2a')];}_0x547dae[_0xbc77('0x1c')](_0x189495)[_0xbc77('0x2b')](_0xfd4787);};}exports[_0xbc77('0x2c')]=function(_0x22a8da,_0x3683ae){var _0x47307b={},_0x15065a={},_0x2447a2={'count':0x0,'rows':[]};var _0x3545ad=_[_0xbc77('0x2d')](db['OpenchannelQueueReport'][_0xbc77('0x2e')],function(_0x56ee2c){return{'name':_0x56ee2c[_0xbc77('0x2f')],'type':_0x56ee2c[_0xbc77('0x30')][_0xbc77('0x31')]};});_0x15065a[_0xbc77('0x32')]=_['map'](_0x3545ad,'name');_0x15065a[_0xbc77('0x33')]=_[_0xbc77('0x34')](_0x22a8da[_0xbc77('0x33')]);_0x15065a[_0xbc77('0x35')]=_[_0xbc77('0x36')](_0x15065a['model'],_0x15065a['query']);_0x47307b[_0xbc77('0x37')]=_['intersection'](_0x15065a['model'],qs['fields'](_0x22a8da[_0xbc77('0x33')][_0xbc77('0x38')]));_0x47307b[_0xbc77('0x37')]=_0x47307b['attributes'][_0xbc77('0x39')]?_0x47307b['attributes']:_0x15065a['model'];if(!_0x22a8da[_0xbc77('0x33')]['hasOwnProperty']('nolimit')){_0x47307b['limit']=qs['limit'](_0x22a8da['query'][_0xbc77('0x22')]);_0x47307b[_0xbc77('0x1f')]=qs[_0xbc77('0x1f')](_0x22a8da[_0xbc77('0x33')][_0xbc77('0x1f')]);}_0x47307b['order']=qs[_0xbc77('0x3a')](_0x22a8da[_0xbc77('0x33')][_0xbc77('0x3a')]);_0x47307b[_0xbc77('0x3b')]=qs['filters'](_['pick'](_0x22a8da[_0xbc77('0x33')],_0x15065a[_0xbc77('0x35')]),_0x3545ad);if(_0x22a8da[_0xbc77('0x33')][_0xbc77('0x3c')]){_0x47307b[_0xbc77('0x3b')]=_[_0xbc77('0x3d')](_0x47307b[_0xbc77('0x3b')],{'$or':_[_0xbc77('0x2d')](_0x3545ad,function(_0x4e8a5e){if(_0x4e8a5e['type']!==_0xbc77('0x3e')){var _0x52015f={};_0x52015f[_0x4e8a5e[_0xbc77('0x2a')]]={'$like':'%'+_0x22a8da[_0xbc77('0x33')]['filter']+'%'};return _0x52015f;}})});}_0x47307b=_[_0xbc77('0x3d')]({},_0x47307b,_0x22a8da[_0xbc77('0x3f')]);var _0x12a552={'where':_0x47307b[_0xbc77('0x3b')]};return db['OpenchannelQueueReport'][_0xbc77('0x21')](_0x12a552)[_0xbc77('0x27')](function(_0x52cf73){_0x2447a2[_0xbc77('0x21')]=_0x52cf73;if(_0x22a8da[_0xbc77('0x33')][_0xbc77('0x40')]){_0x47307b[_0xbc77('0x41')]=[{'all':!![]}];}return db[_0xbc77('0x42')][_0xbc77('0x43')](_0x47307b);})[_0xbc77('0x27')](function(_0x4e85ed){_0x2447a2[_0xbc77('0x44')]=_0x4e85ed;return _0x2447a2;})[_0xbc77('0x27')](respondWithFilteredResult(_0x3683ae,_0x47307b))[_0xbc77('0x45')](handleError(_0x3683ae,null));};exports['show']=function(_0x4af838,_0x25b1e1){var _0x19474a={'raw':!![],'where':{'id':_0x4af838[_0xbc77('0x46')]['id']}},_0x4fe7a1={};_0x4fe7a1[_0xbc77('0x32')]=_[_0xbc77('0x34')](db[_0xbc77('0x42')][_0xbc77('0x2e')]);_0x4fe7a1['query']=_['keys'](_0x4af838[_0xbc77('0x33')]);_0x4fe7a1['filters']=_[_0xbc77('0x36')](_0x4fe7a1[_0xbc77('0x32')],_0x4fe7a1['query']);_0x19474a['attributes']=_[_0xbc77('0x36')](_0x4fe7a1[_0xbc77('0x32')],qs[_0xbc77('0x38')](_0x4af838[_0xbc77('0x33')][_0xbc77('0x38')]));_0x19474a['attributes']=_0x19474a[_0xbc77('0x37')]['length']?_0x19474a[_0xbc77('0x37')]:_0x4fe7a1[_0xbc77('0x32')];if(_0x4af838[_0xbc77('0x33')][_0xbc77('0x40')]){_0x19474a[_0xbc77('0x41')]=[{'all':!![]}];}_0x19474a=_[_0xbc77('0x3d')]({},_0x19474a,_0x4af838['options']);return db[_0xbc77('0x42')][_0xbc77('0x47')](_0x19474a)[_0xbc77('0x27')](handleEntityNotFound(_0x25b1e1,null))['then'](respondWithResult(_0x25b1e1,null))[_0xbc77('0x45')](handleError(_0x25b1e1,null));};exports['create']=function(_0x35bf4e,_0x24c3b0){return db[_0xbc77('0x42')][_0xbc77('0x48')](_0x35bf4e[_0xbc77('0x49')],{})['then'](respondWithResult(_0x24c3b0,0xc9))['catch'](handleError(_0x24c3b0,null));};exports['update']=function(_0x208e1a,_0x48168f){if(_0x208e1a['body']['id']){delete _0x208e1a[_0xbc77('0x49')]['id'];}return db['OpenchannelQueueReport'][_0xbc77('0x47')]({'where':{'id':_0x208e1a[_0xbc77('0x46')]['id']}})['then'](handleEntityNotFound(_0x48168f,null))[_0xbc77('0x27')](saveUpdates(_0x208e1a[_0xbc77('0x49')],null))['then'](respondWithResult(_0x48168f,null))[_0xbc77('0x45')](handleError(_0x48168f,null));};exports[_0xbc77('0x28')]=function(_0x212121,_0x36837e){return db[_0xbc77('0x42')][_0xbc77('0x47')]({'where':{'id':_0x212121['params']['id']}})[_0xbc77('0x27')](handleEntityNotFound(_0x36837e,null))[_0xbc77('0x27')](removeEntity(_0x36837e,null))[_0xbc77('0x45')](handleError(_0x36837e,null));};exports['describe']=function(_0x3c6502,_0x1faa3c){return db[_0xbc77('0x42')]['describe']()[_0xbc77('0x27')](respondWithResult(_0x1faa3c,null))[_0xbc77('0x45')](handleError(_0x1faa3c,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 6327a7c..7ba6caa 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(_0x5c3d21,_0x2f1af2){var _0x196e82=function(_0x4ff05e){while(--_0x4ff05e){_0x5c3d21['push'](_0x5c3d21['shift']());}};_0x196e82(++_0x2f1af2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc4aa[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0xf6256f,_0x44f924){var _0x5cc4b8=function(_0x2143ee){while(--_0x2143ee){_0xf6256f['push'](_0xf6256f['shift']());}};_0x5cc4b8(++_0x44f924);}(_0x326f,0xd1));var _0xf326=function(_0x398677,_0x4c8ee4){_0x398677=_0x398677-0x0;var _0x63f82d=_0x326f[_0x398677];return _0x63f82d;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 9e94d7e..6fb71f2 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 _0xd290=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x4a551a,_0x2b71de){var _0x1b0c21=function(_0x42c05b){while(--_0x42c05b){_0x4a551a['push'](_0x4a551a['shift']());}};_0x1b0c21(++_0x2b71de);}(_0xd290,0x165));var _0x0d29=function(_0x21003c,_0x29d061){_0x21003c=_0x21003c-0x0;var _0x372234=_0xd290[_0x21003c];return _0x372234;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')](_0x488fa2[_0x0d29('0x19')],{'raw':_0x488fa2[_0x0d29('0x1a')]?_0x488fa2['options'][_0x0d29('0x1b')]===undefined?!![]:![]:!![]})[_0x0d29('0xb')](function(_0x215cd7){logger[_0x0d29('0xc')](_0x0d29('0x16'),_0x488fa2);logger[_0x0d29('0xe')](_0x0d29('0x16'),_0x488fa2,JSON[_0x0d29('0x10')](_0x215cd7));_0x2600b3(_0x215cd7);})[_0x0d29('0x15')](function(_0xed8228){logger[_0x0d29('0x11')](_0x0d29('0x16'),_0xed8228[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36['error'](0x1f4,_0xed8228[_0x0d29('0x13')]));});});};exports[_0x0d29('0x1c')]=function(_0x2f0fe2){var _0xd3afa0=this;return new Promise(function(_0x4adc85,_0x249205){return db[_0x0d29('0x17')][_0x0d29('0x1d')](_0x2f0fe2[_0x0d29('0x19')],{'raw':_0x2f0fe2[_0x0d29('0x1a')]?_0x2f0fe2[_0x0d29('0x1a')][_0x0d29('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f0fe2['options']?_0x2f0fe2['options'][_0x0d29('0x1e')]||null:null,'attributes':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['attributes']||null:null,'limit':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['limit']||null:null})[_0x0d29('0xb')](function(_0x5c197f){logger[_0x0d29('0xc')](_0x0d29('0x1c'),_0x2f0fe2);logger['debug'](_0x0d29('0x1c'),_0x2f0fe2,JSON[_0x0d29('0x10')](_0x5c197f));_0x4adc85(_0x5c197f);})[_0x0d29('0x15')](function(_0x58caa6){logger[_0x0d29('0x11')](_0x0d29('0x1c'),_0x58caa6[_0x0d29('0x13')],_0x2f0fe2);_0x249205(_0xd3afa0[_0x0d29('0x11')](0x1f4,_0x58caa6[_0x0d29('0x13')]));});});}; \ No newline at end of file +var _0x9ffd=['raw','UpdateOpenchannelQueueReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','OpenchannelQueueReport,\x20%s,\x20%s','info','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0xe887a2,_0x2fe165){_0xe887a2=_0xe887a2-0x0;var _0x3b7b91=_0x9ffd[_0xe887a2];return _0x3b7b91;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}exports[_0xd9ff('0x17')]=function(_0x3afd19){var _0x5f45c4=this;return new Promise(function(_0x2d4df1,_0x3ccf15){return db[_0xd9ff('0x18')][_0xd9ff('0x19')](_0x3afd19[_0xd9ff('0x1a')],{'raw':_0x3afd19[_0xd9ff('0x1b')]?_0x3afd19[_0xd9ff('0x1b')][_0xd9ff('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4cf8ec){logger[_0xd9ff('0x15')](_0xd9ff('0x17'),_0x3afd19);logger['debug']('CreateOpenchannelQueueReport',_0x3afd19,JSON['stringify'](_0x4cf8ec));_0x2d4df1(_0x4cf8ec);})['catch'](function(_0x1f4d9e){logger['error'](_0xd9ff('0x17'),_0x1f4d9e[_0xd9ff('0x13')],_0x3afd19);_0x3ccf15(_0x5f45c4[_0xd9ff('0x11')](0x1f4,_0x1f4d9e[_0xd9ff('0x13')]));});});};exports[_0xd9ff('0x1d')]=function(_0x42a828){var _0x4b058a=this;return new Promise(function(_0x4fada1,_0x1136e9){return db['OpenchannelQueueReport'][_0xd9ff('0x1e')](_0x42a828['body'],{'raw':_0x42a828[_0xd9ff('0x1b')]?_0x42a828['options'][_0xd9ff('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x42a828[_0xd9ff('0x1b')]?_0x42a828[_0xd9ff('0x1b')][_0xd9ff('0x1f')]||null:null,'attributes':_0x42a828['options']?_0x42a828[_0xd9ff('0x1b')][_0xd9ff('0x20')]||null:null,'limit':_0x42a828[_0xd9ff('0x1b')]?_0x42a828[_0xd9ff('0x1b')]['limit']||null:null})[_0xd9ff('0xc')](function(_0x3792d9){logger[_0xd9ff('0x15')](_0xd9ff('0x1d'),_0x42a828);logger[_0xd9ff('0xd')](_0xd9ff('0x1d'),_0x42a828,JSON[_0xd9ff('0x10')](_0x3792d9));_0x4fada1(_0x3792d9);})[_0xd9ff('0x16')](function(_0x3dc443){logger['error'](_0xd9ff('0x1d'),_0x3dc443['message'],_0x42a828);_0x1136e9(_0x4b058a[_0xd9ff('0x11')](0x1f4,_0x3dc443[_0xd9ff('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index adf7d5f..4ec6437 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 _0x0d62=['isAuthenticated','/describe','describe','show','create','put','update','delete','/:id','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4ac424,_0x554b5d){var _0xe1b890=function(_0x5e85c4){while(--_0x5e85c4){_0x4ac424['push'](_0x4ac424['shift']());}};_0xe1b890(++_0x554b5d);}(_0x0d62,0x7c));var _0x20d6=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x0d62[_0x4706a6];return _0x1bb705;};'use strict';var multer=require(_0x20d6('0x0'));var util=require(_0x20d6('0x1'));var path=require('path');var timeout=require(_0x20d6('0x2'));var express=require('express');var router=express[_0x20d6('0x3')]();var fs_extra=require(_0x20d6('0x4'));var auth=require(_0x20d6('0x5'));var interaction=require(_0x20d6('0x6'));var config=require(_0x20d6('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x20d6('0x8')]('/',auth[_0x20d6('0x9')](),controller['index']);router[_0x20d6('0x8')](_0x20d6('0xa'),auth[_0x20d6('0x9')](),controller[_0x20d6('0xb')]);router[_0x20d6('0x8')]('/:id',auth[_0x20d6('0x9')](),controller[_0x20d6('0xc')]);router['post']('/',auth[_0x20d6('0x9')](),controller[_0x20d6('0xd')]);router[_0x20d6('0xe')]('/:id',auth[_0x20d6('0x9')](),controller[_0x20d6('0xf')]);router[_0x20d6('0x10')](_0x20d6('0x11'),auth[_0x20d6('0x9')](),controller[_0x20d6('0x12')]);module['exports']=router; \ No newline at end of file +var _0x184a=['get','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','/describe','describe'];(function(_0x46d266,_0x26e0f2){var _0x241592=function(_0x1746ec){while(--_0x1746ec){_0x46d266['push'](_0x46d266['shift']());}};_0x241592(++_0x26e0f2);}(_0x184a,0xd1));var _0xa184=function(_0x1dfb69,_0x193305){_0x1dfb69=_0x1dfb69-0x0;var _0x567e7e=_0x184a[_0x1dfb69];return _0x567e7e;};'use strict';var multer=require('multer');var util=require(_0xa184('0x0'));var path=require(_0xa184('0x1'));var timeout=require(_0xa184('0x2'));var express=require(_0xa184('0x3'));var router=express[_0xa184('0x4')]();var fs_extra=require(_0xa184('0x5'));var auth=require(_0xa184('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa184('0x7'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0xa184('0x8')](),controller['index']);router['get'](_0xa184('0x9'),auth['isAuthenticated'](),controller[_0xa184('0xa')]);router[_0xa184('0xb')](_0xa184('0xc'),auth[_0xa184('0x8')](),controller[_0xa184('0xd')]);router[_0xa184('0xe')]('/',auth[_0xa184('0x8')](),controller['create']);router[_0xa184('0xf')](_0xa184('0xc'),auth[_0xa184('0x8')](),controller[_0xa184('0x10')]);router[_0xa184('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xa184('0x12')]);module[_0xa184('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 2fb7cd0..153a1d7 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x3cf90a,_0x4299ce){var _0x52f657=function(_0x527b0e){while(--_0x527b0e){_0x3cf90a['push'](_0x3cf90a['shift']());}};_0x52f657(++_0x4299ce);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xb43b,0x1b2));var _0xbb43=function(_0x116aab,_0x1559b0){_0x116aab=_0x116aab-0x0;var _0x22d09e=_0xb43b[_0x116aab];return _0x22d09e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index af44e29..a861b4d 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 _0xcb45=['fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','error','name','send','index','OpenchannelTransferReport','rawAttributes','fieldName','key','model','map','query','keys','intersection','attributes','fields','length','sort','where','filters','filter','type','VIRTUAL','options','include','findAll','catch','show','includeAll','merge','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x3737a4,_0xe09cfa){var _0x3262b7=function(_0x416673){while(--_0x416673){_0x3737a4['push'](_0x3737a4['shift']());}};_0x3262b7(++_0xe09cfa);}(_0xcb45,0x110));var _0x5cb4=function(_0x16d398,_0x48e064){_0x16d398=_0x16d398-0x0;var _0x41ed1c=_0xcb45[_0x16d398];return _0x41ed1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cb4('0x0'));var zipdir=require(_0x5cb4('0x1'));var jsonpatch=require(_0x5cb4('0x2'));var rp=require(_0x5cb4('0x3'));var moment=require(_0x5cb4('0x4'));var BPromise=require(_0x5cb4('0x5'));var Mustache=require(_0x5cb4('0x6'));var util=require(_0x5cb4('0x7'));var path=require(_0x5cb4('0x8'));var sox=require(_0x5cb4('0x9'));var csv=require(_0x5cb4('0xa'));var ejs=require(_0x5cb4('0xb'));var fs=require('fs');var fs_extra=require(_0x5cb4('0xc'));var _=require(_0x5cb4('0xd'));var squel=require(_0x5cb4('0xe'));var crypto=require(_0x5cb4('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5cb4('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5cb4('0x11'));var Papa=require(_0x5cb4('0x12'));var Redis=require(_0x5cb4('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5cb4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5cb4('0x15'));var logger=require(_0x5cb4('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5cb4('0x17'))['db'];function respondWithStatusCode(_0x38e799,_0x52ab6b){_0x52ab6b=_0x52ab6b||0xcc;return function(_0x4acaa4){if(_0x4acaa4){return _0x38e799[_0x5cb4('0x18')](_0x52ab6b);}return _0x38e799[_0x5cb4('0x19')](_0x52ab6b)[_0x5cb4('0x1a')]();};}function respondWithResult(_0x322859,_0x51abaa){_0x51abaa=_0x51abaa||0xc8;return function(_0xfaf8d){if(_0xfaf8d){return _0x322859[_0x5cb4('0x19')](_0x51abaa)[_0x5cb4('0x1b')](_0xfaf8d);}};}function respondWithFilteredResult(_0x5cdcf1,_0x526edb){return function(_0x4e1ee8){if(_0x4e1ee8){var _0x3d2b5c=typeof _0x526edb[_0x5cb4('0x1c')]==='undefined'&&typeof _0x526edb['limit']===_0x5cb4('0x1d');var _0x558f14=_0x4e1ee8[_0x5cb4('0x1e')];var _0x4b403a=_0x3d2b5c?0x0:_0x526edb[_0x5cb4('0x1c')];var _0x2fd05c=_0x3d2b5c?_0x4e1ee8[_0x5cb4('0x1e')]:_0x526edb[_0x5cb4('0x1c')]+_0x526edb[_0x5cb4('0x1f')];var _0x10b559;if(_0x2fd05c>=_0x558f14){_0x2fd05c=_0x558f14;_0x10b559=0xc8;}else{_0x10b559=0xce;}_0x5cdcf1[_0x5cb4('0x19')](_0x10b559);return _0x5cdcf1[_0x5cb4('0x20')](_0x5cb4('0x21'),_0x4b403a+'-'+_0x2fd05c+'/'+_0x558f14)[_0x5cb4('0x1b')](_0x4e1ee8);}return null;};}function patchUpdates(_0x2fd8f3){return function(_0xeb1af9){try{jsonpatch[_0x5cb4('0x22')](_0xeb1af9,_0x2fd8f3,!![]);}catch(_0x3e622d){return BPromise['reject'](_0x3e622d);}return _0xeb1af9['save']();};}function saveUpdates(_0x3ded5c,_0x1fd1b8){return function(_0x161750){if(_0x161750){return _0x161750[_0x5cb4('0x23')](_0x3ded5c)[_0x5cb4('0x24')](function(_0x532d9b){return _0x532d9b;});}return null;};}function removeEntity(_0x4b624d,_0x29b8ad){return function(_0x49e167){if(_0x49e167){return _0x49e167['destroy']()[_0x5cb4('0x24')](function(){_0x4b624d[_0x5cb4('0x19')](0xcc)[_0x5cb4('0x1a')]();});}};}function handleEntityNotFound(_0x3c8109,_0x16d8b2){return function(_0x34a9bf){if(!_0x34a9bf){_0x3c8109[_0x5cb4('0x18')](0x194);}return _0x34a9bf;};}function handleError(_0x220345,_0x3d4414){_0x3d4414=_0x3d4414||0x1f4;return function(_0x1f3577){logger[_0x5cb4('0x25')](_0x1f3577['stack']);if(_0x1f3577[_0x5cb4('0x26')]){delete _0x1f3577['name'];}_0x220345[_0x5cb4('0x19')](_0x3d4414)[_0x5cb4('0x27')](_0x1f3577);};}exports[_0x5cb4('0x28')]=function(_0x7e931d,_0x482f89){var _0xe89248={},_0x4a4f8d={},_0x5aac79={'count':0x0,'rows':[]};var _0x30dadf=_['map'](db[_0x5cb4('0x29')][_0x5cb4('0x2a')],function(_0x3611c5){return{'name':_0x3611c5[_0x5cb4('0x2b')],'type':_0x3611c5['type'][_0x5cb4('0x2c')]};});_0x4a4f8d[_0x5cb4('0x2d')]=_[_0x5cb4('0x2e')](_0x30dadf,_0x5cb4('0x26'));_0x4a4f8d[_0x5cb4('0x2f')]=_[_0x5cb4('0x30')](_0x7e931d[_0x5cb4('0x2f')]);_0x4a4f8d['filters']=_[_0x5cb4('0x31')](_0x4a4f8d[_0x5cb4('0x2d')],_0x4a4f8d[_0x5cb4('0x2f')]);_0xe89248[_0x5cb4('0x32')]=_[_0x5cb4('0x31')](_0x4a4f8d[_0x5cb4('0x2d')],qs[_0x5cb4('0x33')](_0x7e931d[_0x5cb4('0x2f')][_0x5cb4('0x33')]));_0xe89248[_0x5cb4('0x32')]=_0xe89248[_0x5cb4('0x32')][_0x5cb4('0x34')]?_0xe89248[_0x5cb4('0x32')]:_0x4a4f8d[_0x5cb4('0x2d')];if(!_0x7e931d[_0x5cb4('0x2f')]['hasOwnProperty']('nolimit')){_0xe89248['limit']=qs[_0x5cb4('0x1f')](_0x7e931d[_0x5cb4('0x2f')][_0x5cb4('0x1f')]);_0xe89248['offset']=qs[_0x5cb4('0x1c')](_0x7e931d['query'][_0x5cb4('0x1c')]);}_0xe89248['order']=qs[_0x5cb4('0x35')](_0x7e931d[_0x5cb4('0x2f')][_0x5cb4('0x35')]);_0xe89248[_0x5cb4('0x36')]=qs[_0x5cb4('0x37')](_['pick'](_0x7e931d[_0x5cb4('0x2f')],_0x4a4f8d[_0x5cb4('0x37')]),_0x30dadf);if(_0x7e931d[_0x5cb4('0x2f')][_0x5cb4('0x38')]){_0xe89248[_0x5cb4('0x36')]=_['merge'](_0xe89248[_0x5cb4('0x36')],{'$or':_[_0x5cb4('0x2e')](_0x30dadf,function(_0x2eb4da){if(_0x2eb4da[_0x5cb4('0x39')]!==_0x5cb4('0x3a')){var _0x1a635e={};_0x1a635e[_0x2eb4da[_0x5cb4('0x26')]]={'$like':'%'+_0x7e931d[_0x5cb4('0x2f')]['filter']+'%'};return _0x1a635e;}})});}_0xe89248=_['merge']({},_0xe89248,_0x7e931d[_0x5cb4('0x3b')]);var _0x51b6e8={'where':_0xe89248[_0x5cb4('0x36')]};return db[_0x5cb4('0x29')]['count'](_0x51b6e8)[_0x5cb4('0x24')](function(_0x444d04){_0x5aac79[_0x5cb4('0x1e')]=_0x444d04;if(_0x7e931d[_0x5cb4('0x2f')]['includeAll']){_0xe89248[_0x5cb4('0x3c')]=[{'all':!![]}];}return db[_0x5cb4('0x29')][_0x5cb4('0x3d')](_0xe89248);})[_0x5cb4('0x24')](function(_0x34ffd7){_0x5aac79['rows']=_0x34ffd7;return _0x5aac79;})[_0x5cb4('0x24')](respondWithFilteredResult(_0x482f89,_0xe89248))[_0x5cb4('0x3e')](handleError(_0x482f89,null));};exports[_0x5cb4('0x3f')]=function(_0x42c8d1,_0x4aff26){var _0x57797d={'raw':!![],'where':{'id':_0x42c8d1['params']['id']}},_0x326854={};_0x326854[_0x5cb4('0x2d')]=_['keys'](db['OpenchannelTransferReport'][_0x5cb4('0x2a')]);_0x326854['query']=_[_0x5cb4('0x30')](_0x42c8d1[_0x5cb4('0x2f')]);_0x326854['filters']=_[_0x5cb4('0x31')](_0x326854[_0x5cb4('0x2d')],_0x326854[_0x5cb4('0x2f')]);_0x57797d[_0x5cb4('0x32')]=_['intersection'](_0x326854[_0x5cb4('0x2d')],qs[_0x5cb4('0x33')](_0x42c8d1['query'][_0x5cb4('0x33')]));_0x57797d[_0x5cb4('0x32')]=_0x57797d['attributes']['length']?_0x57797d['attributes']:_0x326854['model'];if(_0x42c8d1[_0x5cb4('0x2f')][_0x5cb4('0x40')]){_0x57797d['include']=[{'all':!![]}];}_0x57797d=_[_0x5cb4('0x41')]({},_0x57797d,_0x42c8d1['options']);return db[_0x5cb4('0x29')][_0x5cb4('0x42')](_0x57797d)[_0x5cb4('0x24')](handleEntityNotFound(_0x4aff26,null))[_0x5cb4('0x24')](respondWithResult(_0x4aff26,null))[_0x5cb4('0x3e')](handleError(_0x4aff26,null));};exports[_0x5cb4('0x43')]=function(_0x5aefc0,_0x420373){return db[_0x5cb4('0x29')][_0x5cb4('0x43')](_0x5aefc0[_0x5cb4('0x44')],{})['then'](respondWithResult(_0x420373,0xc9))[_0x5cb4('0x3e')](handleError(_0x420373,null));};exports[_0x5cb4('0x23')]=function(_0x3fd4de,_0x585dd0){if(_0x3fd4de[_0x5cb4('0x44')]['id']){delete _0x3fd4de[_0x5cb4('0x44')]['id'];}return db[_0x5cb4('0x29')][_0x5cb4('0x42')]({'where':{'id':_0x3fd4de['params']['id']}})[_0x5cb4('0x24')](handleEntityNotFound(_0x585dd0,null))[_0x5cb4('0x24')](saveUpdates(_0x3fd4de[_0x5cb4('0x44')],null))['then'](respondWithResult(_0x585dd0,null))[_0x5cb4('0x3e')](handleError(_0x585dd0,null));};exports['destroy']=function(_0x3fc097,_0x501c3c){return db['OpenchannelTransferReport'][_0x5cb4('0x42')]({'where':{'id':_0x3fc097[_0x5cb4('0x45')]['id']}})[_0x5cb4('0x24')](handleEntityNotFound(_0x501c3c,null))[_0x5cb4('0x24')](removeEntity(_0x501c3c,null))[_0x5cb4('0x3e')](handleError(_0x501c3c,null));};exports[_0x5cb4('0x46')]=function(_0x1947ac,_0x36c825){return db[_0x5cb4('0x29')][_0x5cb4('0x46')]()[_0x5cb4('0x24')](respondWithResult(_0x36c825,null))[_0x5cb4('0x3e')](handleError(_0x36c825,null));}; \ No newline at end of file +var _0xc37f=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x13f58e,_0x265b14){var _0x47f915=function(_0x9676da){while(--_0x9676da){_0x13f58e['push'](_0x13f58e['shift']());}};_0x47f915(++_0x265b14);}(_0xc37f,0xc7));var _0xfc37=function(_0x9f4870,_0x2b40da){_0x9f4870=_0x9f4870-0x0;var _0x503713=_0xc37f[_0x9f4870];return _0x503713;};'use strict';var emlformat=require(_0xfc37('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfc37('0x1'));var jsonpatch=require(_0xfc37('0x2'));var rp=require(_0xfc37('0x3'));var moment=require(_0xfc37('0x4'));var BPromise=require(_0xfc37('0x5'));var Mustache=require('mustache');var util=require(_0xfc37('0x6'));var path=require(_0xfc37('0x7'));var sox=require(_0xfc37('0x8'));var csv=require('to-csv');var ejs=require(_0xfc37('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc37('0xa'));var crypto=require(_0xfc37('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfc37('0xc'));var toCsv=require(_0xfc37('0xd'));var querystring=require('querystring');var Papa=require(_0xfc37('0xe'));var Redis=require('ioredis');var authService=require(_0xfc37('0xf'));var qs=require(_0xfc37('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc37('0x11'));var logger=require(_0xfc37('0x12'))(_0xfc37('0x13'));var utils=require('../../config/utils');var config=require(_0xfc37('0x14'));var licenseUtil=require(_0xfc37('0x15'));var db=require(_0xfc37('0x16'))['db'];function respondWithStatusCode(_0x14ed4b,_0x1266ba){_0x1266ba=_0x1266ba||0xcc;return function(_0x514a10){if(_0x514a10){return _0x14ed4b['sendStatus'](_0x1266ba);}return _0x14ed4b[_0xfc37('0x17')](_0x1266ba)[_0xfc37('0x18')]();};}function respondWithResult(_0x2a8f3f,_0x152f97){_0x152f97=_0x152f97||0xc8;return function(_0x24b7d5){if(_0x24b7d5){return _0x2a8f3f[_0xfc37('0x17')](_0x152f97)[_0xfc37('0x19')](_0x24b7d5);}};}function respondWithFilteredResult(_0x2889a5,_0x2a136e){return function(_0x1975e){if(_0x1975e){var _0x4547dc=typeof _0x2a136e[_0xfc37('0x1a')]===_0xfc37('0x1b')&&typeof _0x2a136e[_0xfc37('0x1c')]===_0xfc37('0x1b');var _0x238d43=_0x1975e[_0xfc37('0x1d')];var _0x1ca242=_0x4547dc?0x0:_0x2a136e[_0xfc37('0x1a')];var _0x462b54=_0x4547dc?_0x1975e['count']:_0x2a136e['offset']+_0x2a136e[_0xfc37('0x1c')];var _0x35bd3c;if(_0x462b54>=_0x238d43){_0x462b54=_0x238d43;_0x35bd3c=0xc8;}else{_0x35bd3c=0xce;}_0x2889a5[_0xfc37('0x17')](_0x35bd3c);return _0x2889a5[_0xfc37('0x1e')](_0xfc37('0x1f'),_0x1ca242+'-'+_0x462b54+'/'+_0x238d43)[_0xfc37('0x19')](_0x1975e);}return null;};}function patchUpdates(_0x309593){return function(_0x2d78ed){try{jsonpatch[_0xfc37('0x20')](_0x2d78ed,_0x309593,!![]);}catch(_0x3dee9a){return BPromise[_0xfc37('0x21')](_0x3dee9a);}return _0x2d78ed[_0xfc37('0x22')]();};}function saveUpdates(_0x5681df,_0x22462c){return function(_0x8bc2a5){if(_0x8bc2a5){return _0x8bc2a5[_0xfc37('0x23')](_0x5681df)[_0xfc37('0x24')](function(_0x939066){return _0x939066;});}return null;};}function removeEntity(_0x3a2bc5,_0x2e88aa){return function(_0x214fe2){if(_0x214fe2){return _0x214fe2['destroy']()['then'](function(){_0x3a2bc5[_0xfc37('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x28ce60,_0x1b8bd1){return function(_0x153023){if(!_0x153023){_0x28ce60[_0xfc37('0x25')](0x194);}return _0x153023;};}function handleError(_0x2d1191,_0x26f98d){_0x26f98d=_0x26f98d||0x1f4;return function(_0x2af11d){logger['error'](_0x2af11d[_0xfc37('0x26')]);if(_0x2af11d[_0xfc37('0x27')]){delete _0x2af11d[_0xfc37('0x27')];}_0x2d1191[_0xfc37('0x17')](_0x26f98d)['send'](_0x2af11d);};}exports[_0xfc37('0x28')]=function(_0x44f580,_0x336dfb){var _0x940bc9={},_0x27a0ef={},_0x13c693={'count':0x0,'rows':[]};var _0x349353=_[_0xfc37('0x29')](db[_0xfc37('0x2a')][_0xfc37('0x2b')],function(_0xa52f8f){return{'name':_0xa52f8f[_0xfc37('0x2c')],'type':_0xa52f8f[_0xfc37('0x2d')][_0xfc37('0x2e')]};});_0x27a0ef[_0xfc37('0x2f')]=_[_0xfc37('0x29')](_0x349353,'name');_0x27a0ef[_0xfc37('0x30')]=_['keys'](_0x44f580[_0xfc37('0x30')]);_0x27a0ef['filters']=_[_0xfc37('0x31')](_0x27a0ef[_0xfc37('0x2f')],_0x27a0ef[_0xfc37('0x30')]);_0x940bc9['attributes']=_['intersection'](_0x27a0ef[_0xfc37('0x2f')],qs['fields'](_0x44f580['query'][_0xfc37('0x32')]));_0x940bc9[_0xfc37('0x33')]=_0x940bc9[_0xfc37('0x33')][_0xfc37('0x34')]?_0x940bc9[_0xfc37('0x33')]:_0x27a0ef['model'];if(!_0x44f580[_0xfc37('0x30')]['hasOwnProperty'](_0xfc37('0x35'))){_0x940bc9['limit']=qs[_0xfc37('0x1c')](_0x44f580['query'][_0xfc37('0x1c')]);_0x940bc9['offset']=qs['offset'](_0x44f580[_0xfc37('0x30')]['offset']);}_0x940bc9[_0xfc37('0x36')]=qs[_0xfc37('0x37')](_0x44f580['query'][_0xfc37('0x37')]);_0x940bc9['where']=qs['filters'](_[_0xfc37('0x38')](_0x44f580['query'],_0x27a0ef[_0xfc37('0x39')]),_0x349353);if(_0x44f580['query'][_0xfc37('0x3a')]){_0x940bc9[_0xfc37('0x3b')]=_[_0xfc37('0x3c')](_0x940bc9['where'],{'$or':_[_0xfc37('0x29')](_0x349353,function(_0x42270f){if(_0x42270f[_0xfc37('0x2d')]!==_0xfc37('0x3d')){var _0x128658={};_0x128658[_0x42270f[_0xfc37('0x27')]]={'$like':'%'+_0x44f580['query'][_0xfc37('0x3a')]+'%'};return _0x128658;}})});}_0x940bc9=_[_0xfc37('0x3c')]({},_0x940bc9,_0x44f580[_0xfc37('0x3e')]);var _0x139a1e={'where':_0x940bc9[_0xfc37('0x3b')]};return db[_0xfc37('0x2a')]['count'](_0x139a1e)[_0xfc37('0x24')](function(_0x1b3ad7){_0x13c693[_0xfc37('0x1d')]=_0x1b3ad7;if(_0x44f580['query'][_0xfc37('0x3f')]){_0x940bc9[_0xfc37('0x40')]=[{'all':!![]}];}return db[_0xfc37('0x2a')][_0xfc37('0x41')](_0x940bc9);})[_0xfc37('0x24')](function(_0x5b2182){_0x13c693['rows']=_0x5b2182;return _0x13c693;})[_0xfc37('0x24')](respondWithFilteredResult(_0x336dfb,_0x940bc9))['catch'](handleError(_0x336dfb,null));};exports[_0xfc37('0x42')]=function(_0x2229bd,_0x38a35b){var _0x205610={'raw':!![],'where':{'id':_0x2229bd[_0xfc37('0x43')]['id']}},_0x4c68f6={};_0x4c68f6['model']=_['keys'](db[_0xfc37('0x2a')][_0xfc37('0x2b')]);_0x4c68f6[_0xfc37('0x30')]=_[_0xfc37('0x44')](_0x2229bd['query']);_0x4c68f6[_0xfc37('0x39')]=_[_0xfc37('0x31')](_0x4c68f6[_0xfc37('0x2f')],_0x4c68f6[_0xfc37('0x30')]);_0x205610[_0xfc37('0x33')]=_[_0xfc37('0x31')](_0x4c68f6[_0xfc37('0x2f')],qs[_0xfc37('0x32')](_0x2229bd[_0xfc37('0x30')][_0xfc37('0x32')]));_0x205610[_0xfc37('0x33')]=_0x205610['attributes'][_0xfc37('0x34')]?_0x205610[_0xfc37('0x33')]:_0x4c68f6['model'];if(_0x2229bd['query'][_0xfc37('0x3f')]){_0x205610[_0xfc37('0x40')]=[{'all':!![]}];}_0x205610=_[_0xfc37('0x3c')]({},_0x205610,_0x2229bd['options']);return db[_0xfc37('0x2a')]['find'](_0x205610)['then'](handleEntityNotFound(_0x38a35b,null))[_0xfc37('0x24')](respondWithResult(_0x38a35b,null))[_0xfc37('0x45')](handleError(_0x38a35b,null));};exports[_0xfc37('0x46')]=function(_0x193d86,_0x2edc9c){return db[_0xfc37('0x2a')][_0xfc37('0x46')](_0x193d86['body'],{})['then'](respondWithResult(_0x2edc9c,0xc9))['catch'](handleError(_0x2edc9c,null));};exports[_0xfc37('0x23')]=function(_0x3893b6,_0x2b78e9){if(_0x3893b6[_0xfc37('0x47')]['id']){delete _0x3893b6[_0xfc37('0x47')]['id'];}return db[_0xfc37('0x2a')][_0xfc37('0x48')]({'where':{'id':_0x3893b6['params']['id']}})[_0xfc37('0x24')](handleEntityNotFound(_0x2b78e9,null))[_0xfc37('0x24')](saveUpdates(_0x3893b6['body'],null))[_0xfc37('0x24')](respondWithResult(_0x2b78e9,null))['catch'](handleError(_0x2b78e9,null));};exports['destroy']=function(_0x53aa1b,_0x46453a){return db[_0xfc37('0x2a')]['find']({'where':{'id':_0x53aa1b[_0xfc37('0x43')]['id']}})[_0xfc37('0x24')](handleEntityNotFound(_0x46453a,null))[_0xfc37('0x24')](removeEntity(_0x46453a,null))[_0xfc37('0x45')](handleError(_0x46453a,null));};exports[_0xfc37('0x49')]=function(_0x464f6c,_0x251345){return db['OpenchannelTransferReport'][_0xfc37('0x49')]()[_0xfc37('0x24')](respondWithResult(_0x251345,null))[_0xfc37('0x45')](handleError(_0x251345,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 6db4bd9..7128499 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 _0x4646=['report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport'];(function(_0x244cee,_0x4b513f){var _0x30a8ff=function(_0xfe60b3){while(--_0xfe60b3){_0x244cee['push'](_0x244cee['shift']());}};_0x30a8ff(++_0x4b513f);}(_0x4646,0x6b));var _0x6464=function(_0x591634,_0x20613d){_0x591634=_0x591634-0x0;var _0x120838=_0x4646[_0x591634];return _0x120838;};'use strict';var _=require(_0x6464('0x0'));var util=require(_0x6464('0x1'));var logger=require(_0x6464('0x2'))(_0x6464('0x3'));var moment=require(_0x6464('0x4'));var BPromise=require(_0x6464('0x5'));var rp=require(_0x6464('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6464('0x7'));var config=require(_0x6464('0x8'));var attributes=require(_0x6464('0x9'));module[_0x6464('0xa')]=function(_0xc496a6,_0x21cba5){return _0xc496a6[_0x6464('0xb')](_0x6464('0xc'),attributes,{'tableName':_0x6464('0xd'),'paranoid':![],'indexes':[{'name':_0x6464('0xe'),'fields':[_0x6464('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3918=['lodash','util','api','bluebird','path','rimraf','../../config/environment','exports','uniqueid'];(function(_0xc095e7,_0x2d5f24){var _0x367b1a=function(_0x238d0c){while(--_0x238d0c){_0xc095e7['push'](_0xc095e7['shift']());}};_0x367b1a(++_0x2d5f24);}(_0x3918,0x171));var _0x8391=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3918[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8391('0x0'));var util=require(_0x8391('0x1'));var logger=require('../../config/logger')(_0x8391('0x2'));var moment=require('moment');var BPromise=require(_0x8391('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8391('0x4'));var rimraf=require(_0x8391('0x5'));var config=require(_0x8391('0x6'));var attributes=require('./openchannelTransferReport.attributes');module[_0x8391('0x7')]=function(_0x54b45d,_0x10a345){return _0x54b45d['define']('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x8391('0x8'),'fields':[_0x8391('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 95f43b8..8582448 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 _0xf767=['debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s'];(function(_0x43a9cd,_0x5996bf){var _0x1d644f=function(_0x2fbc32){while(--_0x2fbc32){_0x43a9cd['push'](_0x43a9cd['shift']());}};_0x1d644f(++_0x5996bf);}(_0xf767,0x76));var _0x7f76=function(_0x5c2e5e,_0x2bc00e){_0x5c2e5e=_0x5c2e5e-0x0;var _0x46a5da=_0xf767[_0x5c2e5e];return _0x46a5da;};'use strict';var _=require('lodash');var util=require(_0x7f76('0x0'));var moment=require(_0x7f76('0x1'));var BPromise=require(_0x7f76('0x2'));var rs=require(_0x7f76('0x3'));var fs=require('fs');var Redis=require(_0x7f76('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f76('0x5'));var logger=require(_0x7f76('0x6'))(_0x7f76('0x7'));var config=require(_0x7f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7f76('0x9')][_0x7f76('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x45ddcc,_0x1eeb08,_0x1fc46c){return new BPromise(function(_0x5acfee,_0x8b5dce){return client[_0x7f76('0xb')](_0x45ddcc,_0x1fc46c)[_0x7f76('0xc')](function(_0x15dcd9){logger['info'](_0x7f76('0xd'),_0x1eeb08,'request\x20sent');logger[_0x7f76('0xe')](_0x7f76('0xf'),_0x1eeb08,_0x7f76('0x10'),JSON[_0x7f76('0x11')](_0x15dcd9));if(_0x15dcd9[_0x7f76('0x12')]){if(_0x15dcd9[_0x7f76('0x12')]['code']===0x1f4){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x8b5dce(_0x15dcd9[_0x7f76('0x12')]['message']);}logger[_0x7f76('0x12')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x1eeb08,_0x15dcd9[_0x7f76('0x12')][_0x7f76('0x13')]);return _0x5acfee(_0x15dcd9['error']['message']);}else{logger['info'](_0x7f76('0xd'),_0x1eeb08,_0x7f76('0x10'));_0x5acfee(_0x15dcd9[_0x7f76('0x14')]['message']);}})[_0x7f76('0x15')](function(_0x522a2c){logger[_0x7f76('0x12')](_0x7f76('0xd'),_0x1eeb08,_0x522a2c);_0x8b5dce(_0x522a2c);});});} \ No newline at end of file +var _0x3148=['then','info','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2ddcb0,_0xf59cdf){var _0x3882ae=function(_0x21737c){while(--_0x21737c){_0x2ddcb0['push'](_0x2ddcb0['shift']());}};_0x3882ae(++_0xf59cdf);}(_0x3148,0x1d3));var _0x8314=function(_0x46a14f,_0x46ca40){_0x46a14f=_0x46a14f-0x0;var _0x4e26f9=_0x3148[_0x46a14f];return _0x4e26f9;};'use strict';var _=require(_0x8314('0x0'));var util=require(_0x8314('0x1'));var moment=require('moment');var BPromise=require(_0x8314('0x2'));var rs=require(_0x8314('0x3'));var fs=require('fs');var Redis=require(_0x8314('0x4'));var db=require(_0x8314('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8314('0x6'))(_0x8314('0x7'));var config=require(_0x8314('0x8'));var jayson=require(_0x8314('0x9'));var client=jayson[_0x8314('0xa')][_0x8314('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bd913,_0x4dd36d,_0x837c1f){return new BPromise(function(_0x4df2b0,_0x35b464){return client[_0x8314('0xc')](_0x1bd913,_0x837c1f)[_0x8314('0xd')](function(_0x357031){logger[_0x8314('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,'request\x20sent');logger[_0x8314('0xf')](_0x8314('0x10'),_0x4dd36d,_0x8314('0x11'),JSON[_0x8314('0x12')](_0x357031));if(_0x357031['error']){if(_0x357031[_0x8314('0x13')][_0x8314('0x14')]===0x1f4){logger['error'](_0x8314('0x15'),_0x4dd36d,_0x357031['error']['message']);return _0x35b464(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}logger[_0x8314('0x13')](_0x8314('0x15'),_0x4dd36d,_0x357031['error'][_0x8314('0x16')]);return _0x4df2b0(_0x357031[_0x8314('0x13')][_0x8314('0x16')]);}else{logger[_0x8314('0xe')](_0x8314('0x15'),_0x4dd36d,_0x8314('0x11'));_0x4df2b0(_0x357031['result']['message']);}})[_0x8314('0x17')](function(_0xf0ad31){logger[_0x8314('0x13')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x4dd36d,_0xf0ad31);_0x35b464(_0xf0ad31);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b81f353..2766eb5 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 _0x670d=['show','post','isAuthenticated','create','put','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./pause.controller','get','/:id'];(function(_0x3b2358,_0x107bba){var _0x450b7c=function(_0x3bb6a2){while(--_0x3bb6a2){_0x3b2358['push'](_0x3b2358['shift']());}};_0x450b7c(++_0x107bba);}(_0x670d,0x1e3));var _0xd670=function(_0x17aa8e,_0x516c2d){_0x17aa8e=_0x17aa8e-0x0;var _0x5d95fc=_0x670d[_0x17aa8e];return _0x5d95fc;};'use strict';var multer=require(_0xd670('0x0'));var util=require(_0xd670('0x1'));var path=require(_0xd670('0x2'));var timeout=require('connect-timeout');var express=require(_0xd670('0x3'));var router=express['Router']();var fs_extra=require(_0xd670('0x4'));var auth=require(_0xd670('0x5'));var interaction=require(_0xd670('0x6'));var config=require('../../config/environment');var controller=require(_0xd670('0x7'));router[_0xd670('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd670('0x9'),auth['isAuthenticated'](),controller[_0xd670('0xa')]);router[_0xd670('0xb')]('/',auth[_0xd670('0xc')](),controller[_0xd670('0xd')]);router[_0xd670('0xe')](_0xd670('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xd670('0x9'),auth['isAuthenticated'](),controller[_0xd670('0xf')]);module[_0xd670('0x10')]=router; \ No newline at end of file +var _0xf9ff=['isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./pause.controller'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf9ff,0x15e));var _0xff9f=function(_0x236c89,_0xd76ba9){_0x236c89=_0x236c89-0x0;var _0x3b2a15=_0xf9ff[_0x236c89];return _0x3b2a15;};'use strict';var multer=require(_0xff9f('0x0'));var util=require('util');var path=require(_0xff9f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff9f('0x2')]();var fs_extra=require(_0xff9f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xff9f('0x4'));var config=require(_0xff9f('0x5'));var controller=require(_0xff9f('0x6'));router['get']('/',auth[_0xff9f('0x7')](),controller[_0xff9f('0x8')]);router[_0xff9f('0x9')](_0xff9f('0xa'),auth[_0xff9f('0x7')](),controller['show']);router[_0xff9f('0xb')]('/',auth[_0xff9f('0x7')](),controller[_0xff9f('0xc')]);router[_0xff9f('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xff9f('0xe')]);router[_0xff9f('0xf')](_0xff9f('0xa'),auth[_0xff9f('0x7')](),controller[_0xff9f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 6f16b90..66df272 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 _0x59fd=['sequelize','exports','name'];(function(_0x179be2,_0x55e7f9){var _0x8eb7d=function(_0x1deade){while(--_0x1deade){_0x179be2['push'](_0x179be2['shift']());}};_0x8eb7d(++_0x55e7f9);}(_0x59fd,0xc9));var _0xd59f=function(_0x5587cd,_0x5239c9){_0x5587cd=_0x5587cd-0x0;var _0x2aac8d=_0x59fd[_0x5587cd];return _0x2aac8d;};'use strict';var Sequelize=require(_0xd59f('0x0'));module[_0xd59f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xd59f('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc15e=['sequelize','exports','STRING','name'];(function(_0x5aa70d,_0x5b1330){var _0x3210c3=function(_0x48c7d3){while(--_0x48c7d3){_0x5aa70d['push'](_0x5aa70d['shift']());}};_0x3210c3(++_0x5b1330);}(_0xc15e,0x114));var _0xec15=function(_0x28518b,_0x4296e5){_0x28518b=_0x28518b-0x0;var _0x3e816e=_0xc15e[_0x28518b];return _0x3e816e;};'use strict';var Sequelize=require(_0xec15('0x0'));module[_0xec15('0x1')]={'name':{'type':Sequelize[_0xec15('0x2')],'unique':_0xec15('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xec15('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index e3beba7..02c0bba 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 _0x5d31=['apply','reject','save','update','then','destroy','get','Pauses','status','error','stack','name','index','Pause','fieldName','type','model','map','query','keys','filters','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','show','rawAttributes','intersection','attributes','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x396aba,_0x3ef523){var _0x74213e=function(_0x31b2db){while(--_0x31b2db){_0x396aba['push'](_0x396aba['shift']());}};_0x74213e(++_0x3ef523);}(_0x5d31,0xc9));var _0x15d3=function(_0x37437c,_0x55dacf){_0x37437c=_0x37437c-0x0;var _0x35e1a1=_0x5d31[_0x37437c];return _0x35e1a1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x15d3('0x0'));var zipdir=require(_0x15d3('0x1'));var jsonpatch=require(_0x15d3('0x2'));var rp=require('request-promise');var moment=require(_0x15d3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x15d3('0x4'));var util=require('util');var path=require(_0x15d3('0x5'));var sox=require(_0x15d3('0x6'));var csv=require(_0x15d3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15d3('0x8'));var squel=require(_0x15d3('0x9'));var crypto=require('crypto');var jsforce=require(_0x15d3('0xa'));var deskjs=require(_0x15d3('0xb'));var toCsv=require(_0x15d3('0x7'));var querystring=require('querystring');var Papa=require(_0x15d3('0xc'));var Redis=require(_0x15d3('0xd'));var authService=require(_0x15d3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x15d3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x15d3('0x10'))(_0x15d3('0x11'));var utils=require(_0x15d3('0x12'));var config=require(_0x15d3('0x13'));var licenseUtil=require(_0x15d3('0x14'));var db=require(_0x15d3('0x15'))['db'];function respondWithStatusCode(_0x1747de,_0x58c511){_0x58c511=_0x58c511||0xcc;return function(_0x5b31f9){if(_0x5b31f9){return _0x1747de[_0x15d3('0x16')](_0x58c511);}return _0x1747de['status'](_0x58c511)['end']();};}function respondWithResult(_0x1763db,_0x314af0){_0x314af0=_0x314af0||0xc8;return function(_0x4af350){if(_0x4af350){return _0x1763db['status'](_0x314af0)[_0x15d3('0x17')](_0x4af350);}};}function respondWithFilteredResult(_0x39598e,_0x4fec98){return function(_0x4565bc){if(_0x4565bc){var _0x4be000=typeof _0x4fec98[_0x15d3('0x18')]===_0x15d3('0x19')&&typeof _0x4fec98[_0x15d3('0x1a')]===_0x15d3('0x19');var _0x286e26=_0x4565bc[_0x15d3('0x1b')];var _0x1af487=_0x4be000?0x0:_0x4fec98[_0x15d3('0x18')];var _0x242a32=_0x4be000?_0x4565bc[_0x15d3('0x1b')]:_0x4fec98[_0x15d3('0x18')]+_0x4fec98['limit'];var _0x481f36;if(_0x242a32>=_0x286e26){_0x242a32=_0x286e26;_0x481f36=0xc8;}else{_0x481f36=0xce;}_0x39598e['status'](_0x481f36);return _0x39598e[_0x15d3('0x1c')](_0x15d3('0x1d'),_0x1af487+'-'+_0x242a32+'/'+_0x286e26)['json'](_0x4565bc);}return null;};}function patchUpdates(_0x5a900a){return function(_0x1cade4){try{jsonpatch[_0x15d3('0x1e')](_0x1cade4,_0x5a900a,!![]);}catch(_0x2f7714){return BPromise[_0x15d3('0x1f')](_0x2f7714);}return _0x1cade4[_0x15d3('0x20')]();};}function saveUpdates(_0x22fde6,_0x3e2bde){return function(_0xf2dfe4){if(_0xf2dfe4){return _0xf2dfe4[_0x15d3('0x21')](_0x22fde6)[_0x15d3('0x22')](function(_0x1a4ed5){return _0x1a4ed5;});}return null;};}function removeEntity(_0x59648f,_0x3c3db6){return function(_0x43df65){if(_0x43df65){return _0x43df65[_0x15d3('0x23')]()['then'](function(){var _0x5b8a19=_0x43df65[_0x15d3('0x24')]({'plain':!![]});var _0x294d35=_0x15d3('0x25');return db['UserProfileResource'][_0x15d3('0x23')]({'where':{'type':_0x294d35,'resourceId':_0x5b8a19['id']}})[_0x15d3('0x22')](function(){return _0x43df65;});})[_0x15d3('0x22')](function(){_0x59648f[_0x15d3('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x513453,_0x2420e7){return function(_0x53c7a9){if(!_0x53c7a9){_0x513453['sendStatus'](0x194);}return _0x53c7a9;};}function handleError(_0x2b6a70,_0x345b73){_0x345b73=_0x345b73||0x1f4;return function(_0x137013){logger[_0x15d3('0x27')](_0x137013[_0x15d3('0x28')]);if(_0x137013[_0x15d3('0x29')]){delete _0x137013['name'];}_0x2b6a70[_0x15d3('0x26')](_0x345b73)['send'](_0x137013);};}exports[_0x15d3('0x2a')]=function(_0x46dade,_0x50c3d5){var _0x33f32a={},_0x24d117={},_0x12eb1a={'count':0x0,'rows':[]};var _0x332347=_['map'](db[_0x15d3('0x2b')]['rawAttributes'],function(_0x4162a8){return{'name':_0x4162a8[_0x15d3('0x2c')],'type':_0x4162a8[_0x15d3('0x2d')]['key']};});_0x24d117[_0x15d3('0x2e')]=_[_0x15d3('0x2f')](_0x332347,'name');_0x24d117[_0x15d3('0x30')]=_[_0x15d3('0x31')](_0x46dade[_0x15d3('0x30')]);_0x24d117[_0x15d3('0x32')]=_['intersection'](_0x24d117[_0x15d3('0x2e')],_0x24d117[_0x15d3('0x30')]);_0x33f32a['attributes']=_['intersection'](_0x24d117[_0x15d3('0x2e')],qs[_0x15d3('0x33')](_0x46dade[_0x15d3('0x30')][_0x15d3('0x33')]));_0x33f32a['attributes']=_0x33f32a['attributes'][_0x15d3('0x34')]?_0x33f32a['attributes']:_0x24d117[_0x15d3('0x2e')];if(!_0x46dade['query'][_0x15d3('0x35')]('nolimit')){_0x33f32a[_0x15d3('0x1a')]=qs[_0x15d3('0x1a')](_0x46dade['query'][_0x15d3('0x1a')]);_0x33f32a[_0x15d3('0x18')]=qs[_0x15d3('0x18')](_0x46dade[_0x15d3('0x30')][_0x15d3('0x18')]);}_0x33f32a['order']=qs[_0x15d3('0x36')](_0x46dade['query'][_0x15d3('0x36')]);_0x33f32a[_0x15d3('0x37')]=qs[_0x15d3('0x32')](_[_0x15d3('0x38')](_0x46dade[_0x15d3('0x30')],_0x24d117[_0x15d3('0x32')]),_0x332347);if(_0x46dade['query'][_0x15d3('0x39')]){_0x33f32a[_0x15d3('0x37')]=_[_0x15d3('0x3a')](_0x33f32a[_0x15d3('0x37')],{'$or':_[_0x15d3('0x2f')](_0x332347,function(_0x3e9877){if(_0x3e9877[_0x15d3('0x2d')]!=='VIRTUAL'){var _0x6f4384={};_0x6f4384[_0x3e9877['name']]={'$like':'%'+_0x46dade[_0x15d3('0x30')][_0x15d3('0x39')]+'%'};return _0x6f4384;}})});}_0x33f32a=_[_0x15d3('0x3a')]({},_0x33f32a,_0x46dade[_0x15d3('0x3b')]);var _0x1fa4d9={'where':_0x33f32a[_0x15d3('0x37')]};return db[_0x15d3('0x2b')][_0x15d3('0x1b')](_0x1fa4d9)[_0x15d3('0x22')](function(_0x5d306d){_0x12eb1a[_0x15d3('0x1b')]=_0x5d306d;if(_0x46dade[_0x15d3('0x30')][_0x15d3('0x3c')]){_0x33f32a[_0x15d3('0x3d')]=[{'all':!![]}];}return db[_0x15d3('0x2b')]['findAll'](_0x33f32a);})[_0x15d3('0x22')](function(_0x36850e){_0x12eb1a['rows']=_0x36850e;return _0x12eb1a;})[_0x15d3('0x22')](respondWithFilteredResult(_0x50c3d5,_0x33f32a))['catch'](handleError(_0x50c3d5,null));};exports[_0x15d3('0x3e')]=function(_0x9f5089,_0x33bc19){var _0x221d3b={'raw':!![],'where':{'id':_0x9f5089['params']['id']}},_0x5affd3={};_0x5affd3[_0x15d3('0x2e')]=_['keys'](db[_0x15d3('0x2b')][_0x15d3('0x3f')]);_0x5affd3[_0x15d3('0x30')]=_['keys'](_0x9f5089['query']);_0x5affd3[_0x15d3('0x32')]=_[_0x15d3('0x40')](_0x5affd3['model'],_0x5affd3[_0x15d3('0x30')]);_0x221d3b['attributes']=_['intersection'](_0x5affd3[_0x15d3('0x2e')],qs[_0x15d3('0x33')](_0x9f5089['query'][_0x15d3('0x33')]));_0x221d3b[_0x15d3('0x41')]=_0x221d3b[_0x15d3('0x41')][_0x15d3('0x34')]?_0x221d3b['attributes']:_0x5affd3['model'];if(_0x9f5089[_0x15d3('0x30')][_0x15d3('0x3c')]){_0x221d3b[_0x15d3('0x3d')]=[{'all':!![]}];}_0x221d3b=_[_0x15d3('0x3a')]({},_0x221d3b,_0x9f5089['options']);return db[_0x15d3('0x2b')][_0x15d3('0x42')](_0x221d3b)['then'](handleEntityNotFound(_0x33bc19,null))['then'](respondWithResult(_0x33bc19,null))[_0x15d3('0x43')](handleError(_0x33bc19,null));};exports[_0x15d3('0x44')]=function(_0x2d0e8b,_0x459ef7){return db[_0x15d3('0x2b')][_0x15d3('0x44')](_0x2d0e8b['body'],{})[_0x15d3('0x22')](function(_0x4cf582){var _0x500134=_0x2d0e8b[_0x15d3('0x45')]['get']({'plain':!![]});if(!_0x500134)throw new Error(_0x15d3('0x46'));if(_0x500134[_0x15d3('0x47')]===_0x15d3('0x45')){var _0x3ab0fa=_0x4cf582[_0x15d3('0x24')]({'plain':!![]});var _0x596f7c='Pauses';return db[_0x15d3('0x48')][_0x15d3('0x42')]({'where':{'name':_0x596f7c,'userProfileId':_0x500134['userProfileId']},'raw':!![]})['then'](function(_0x480007){if(_0x480007&&_0x480007['autoAssociation']===0x0){return db[_0x15d3('0x49')][_0x15d3('0x44')]({'name':_0x3ab0fa[_0x15d3('0x29')],'resourceId':_0x3ab0fa['id'],'type':_0x480007[_0x15d3('0x29')],'sectionId':_0x480007['id']},{})[_0x15d3('0x22')](function(){return _0x4cf582;});}else{return _0x4cf582;}})[_0x15d3('0x43')](function(_0x2c1804){logger['error'](_0x15d3('0x4a'),_0x2c1804);throw _0x2c1804;});}return _0x4cf582;})[_0x15d3('0x22')](respondWithResult(_0x459ef7,0xc9))[_0x15d3('0x43')](handleError(_0x459ef7,null));};exports[_0x15d3('0x21')]=function(_0x4dbed2,_0x14e6f7){if(_0x4dbed2[_0x15d3('0x4b')]['id']){delete _0x4dbed2[_0x15d3('0x4b')]['id'];}return db[_0x15d3('0x2b')]['find']({'where':{'id':_0x4dbed2[_0x15d3('0x4c')]['id']}})[_0x15d3('0x22')](handleEntityNotFound(_0x14e6f7,null))[_0x15d3('0x22')](saveUpdates(_0x4dbed2['body'],null))['then'](respondWithResult(_0x14e6f7,null))[_0x15d3('0x43')](handleError(_0x14e6f7,null));};exports[_0x15d3('0x23')]=function(_0x2d9c45,_0x4db136){return db[_0x15d3('0x2b')]['find']({'where':{'id':_0x2d9c45['params']['id']}})[_0x15d3('0x22')](handleEntityNotFound(_0x4db136,null))[_0x15d3('0x22')](removeEntity(_0x4db136,null))[_0x15d3('0x43')](handleError(_0x4db136,null));}; \ No newline at end of file +var _0xdb82=['UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','Pause','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','reject','save','destroy','then','get','Pauses'];(function(_0xf08ad9,_0x25e201){var _0x5ed8f8=function(_0x4799fb){while(--_0x4799fb){_0xf08ad9['push'](_0xf08ad9['shift']());}};_0x5ed8f8(++_0x25e201);}(_0xdb82,0x81));var _0x2db8=function(_0x1a48ad,_0x2db464){_0x1a48ad=_0x1a48ad-0x0;var _0x47171b=_0xdb82[_0x1a48ad];return _0x47171b;};'use strict';var emlformat=require(_0x2db8('0x0'));var rimraf=require(_0x2db8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2db8('0x2'));var rp=require(_0x2db8('0x3'));var moment=require(_0x2db8('0x4'));var BPromise=require(_0x2db8('0x5'));var Mustache=require(_0x2db8('0x6'));var util=require(_0x2db8('0x7'));var path=require(_0x2db8('0x8'));var sox=require(_0x2db8('0x9'));var csv=require(_0x2db8('0xa'));var ejs=require(_0x2db8('0xb'));var fs=require('fs');var fs_extra=require(_0x2db8('0xc'));var _=require(_0x2db8('0xd'));var squel=require(_0x2db8('0xe'));var crypto=require(_0x2db8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x2db8('0x10'));var toCsv=require(_0x2db8('0xa'));var querystring=require(_0x2db8('0x11'));var Papa=require('papaparse');var Redis=require(_0x2db8('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2db8('0x13'));var hardwareService=require(_0x2db8('0x14'));var logger=require(_0x2db8('0x15'))(_0x2db8('0x16'));var utils=require('../../config/utils');var config=require(_0x2db8('0x17'));var licenseUtil=require(_0x2db8('0x18'));var db=require(_0x2db8('0x19'))['db'];function respondWithStatusCode(_0x3cd9b3,_0x3e86d5){_0x3e86d5=_0x3e86d5||0xcc;return function(_0x1f6bb1){if(_0x1f6bb1){return _0x3cd9b3[_0x2db8('0x1a')](_0x3e86d5);}return _0x3cd9b3[_0x2db8('0x1b')](_0x3e86d5)[_0x2db8('0x1c')]();};}function respondWithResult(_0x596517,_0x251bd9){_0x251bd9=_0x251bd9||0xc8;return function(_0x552f5c){if(_0x552f5c){return _0x596517[_0x2db8('0x1b')](_0x251bd9)['json'](_0x552f5c);}};}function respondWithFilteredResult(_0x52fed6,_0x19bbba){return function(_0x410075){if(_0x410075){var _0x25184f=typeof _0x19bbba['offset']===_0x2db8('0x1d')&&typeof _0x19bbba[_0x2db8('0x1e')]==='undefined';var _0xb77a53=_0x410075[_0x2db8('0x1f')];var _0x32a113=_0x25184f?0x0:_0x19bbba[_0x2db8('0x20')];var _0x5d6cca=_0x25184f?_0x410075[_0x2db8('0x1f')]:_0x19bbba[_0x2db8('0x20')]+_0x19bbba[_0x2db8('0x1e')];var _0x4c87e1;if(_0x5d6cca>=_0xb77a53){_0x5d6cca=_0xb77a53;_0x4c87e1=0xc8;}else{_0x4c87e1=0xce;}_0x52fed6['status'](_0x4c87e1);return _0x52fed6['set'](_0x2db8('0x21'),_0x32a113+'-'+_0x5d6cca+'/'+_0xb77a53)[_0x2db8('0x22')](_0x410075);}return null;};}function patchUpdates(_0x12e24f){return function(_0x649192){try{jsonpatch['apply'](_0x649192,_0x12e24f,!![]);}catch(_0x5ccf37){return BPromise[_0x2db8('0x23')](_0x5ccf37);}return _0x649192[_0x2db8('0x24')]();};}function saveUpdates(_0x1aee62,_0x34c9af){return function(_0x98d57c){if(_0x98d57c){return _0x98d57c['update'](_0x1aee62)['then'](function(_0x218c00){return _0x218c00;});}return null;};}function removeEntity(_0x1b4bf6,_0x11c4c0){return function(_0x564eee){if(_0x564eee){return _0x564eee[_0x2db8('0x25')]()[_0x2db8('0x26')](function(){var _0xacf750=_0x564eee[_0x2db8('0x27')]({'plain':!![]});var _0x4104e5=_0x2db8('0x28');return db[_0x2db8('0x29')][_0x2db8('0x25')]({'where':{'type':_0x4104e5,'resourceId':_0xacf750['id']}})['then'](function(){return _0x564eee;});})['then'](function(){_0x1b4bf6[_0x2db8('0x1b')](0xcc)[_0x2db8('0x1c')]();});}};}function handleEntityNotFound(_0x350c8e,_0x4015da){return function(_0x3a927d){if(!_0x3a927d){_0x350c8e['sendStatus'](0x194);}return _0x3a927d;};}function handleError(_0x3b846d,_0x3827d8){_0x3827d8=_0x3827d8||0x1f4;return function(_0x5a8211){logger[_0x2db8('0x2a')](_0x5a8211[_0x2db8('0x2b')]);if(_0x5a8211[_0x2db8('0x2c')]){delete _0x5a8211['name'];}_0x3b846d[_0x2db8('0x1b')](_0x3827d8)[_0x2db8('0x2d')](_0x5a8211);};}exports['index']=function(_0x2bebad,_0x2b7b07){var _0xb2ca31={},_0x13c2ce={},_0x2d6d62={'count':0x0,'rows':[]};var _0xc61d36=_[_0x2db8('0x2e')](db['Pause'][_0x2db8('0x2f')],function(_0x3ff072){return{'name':_0x3ff072[_0x2db8('0x30')],'type':_0x3ff072['type'][_0x2db8('0x31')]};});_0x13c2ce[_0x2db8('0x32')]=_[_0x2db8('0x2e')](_0xc61d36,_0x2db8('0x2c'));_0x13c2ce[_0x2db8('0x33')]=_[_0x2db8('0x34')](_0x2bebad[_0x2db8('0x33')]);_0x13c2ce[_0x2db8('0x35')]=_[_0x2db8('0x36')](_0x13c2ce[_0x2db8('0x32')],_0x13c2ce[_0x2db8('0x33')]);_0xb2ca31[_0x2db8('0x37')]=_[_0x2db8('0x36')](_0x13c2ce[_0x2db8('0x32')],qs[_0x2db8('0x38')](_0x2bebad[_0x2db8('0x33')]['fields']));_0xb2ca31[_0x2db8('0x37')]=_0xb2ca31[_0x2db8('0x37')][_0x2db8('0x39')]?_0xb2ca31['attributes']:_0x13c2ce[_0x2db8('0x32')];if(!_0x2bebad['query'][_0x2db8('0x3a')]('nolimit')){_0xb2ca31[_0x2db8('0x1e')]=qs['limit'](_0x2bebad[_0x2db8('0x33')][_0x2db8('0x1e')]);_0xb2ca31[_0x2db8('0x20')]=qs[_0x2db8('0x20')](_0x2bebad[_0x2db8('0x33')][_0x2db8('0x20')]);}_0xb2ca31['order']=qs[_0x2db8('0x3b')](_0x2bebad['query'][_0x2db8('0x3b')]);_0xb2ca31[_0x2db8('0x3c')]=qs[_0x2db8('0x35')](_[_0x2db8('0x3d')](_0x2bebad[_0x2db8('0x33')],_0x13c2ce[_0x2db8('0x35')]),_0xc61d36);if(_0x2bebad[_0x2db8('0x33')][_0x2db8('0x3e')]){_0xb2ca31[_0x2db8('0x3c')]=_['merge'](_0xb2ca31[_0x2db8('0x3c')],{'$or':_[_0x2db8('0x2e')](_0xc61d36,function(_0x4791ee){if(_0x4791ee[_0x2db8('0x3f')]!==_0x2db8('0x40')){var _0x134a30={};_0x134a30[_0x4791ee[_0x2db8('0x2c')]]={'$like':'%'+_0x2bebad[_0x2db8('0x33')]['filter']+'%'};return _0x134a30;}})});}_0xb2ca31=_['merge']({},_0xb2ca31,_0x2bebad[_0x2db8('0x41')]);var _0x2aca52={'where':_0xb2ca31[_0x2db8('0x3c')]};return db['Pause'][_0x2db8('0x1f')](_0x2aca52)[_0x2db8('0x26')](function(_0x764d9a){_0x2d6d62[_0x2db8('0x1f')]=_0x764d9a;if(_0x2bebad[_0x2db8('0x33')][_0x2db8('0x42')]){_0xb2ca31[_0x2db8('0x43')]=[{'all':!![]}];}return db[_0x2db8('0x44')][_0x2db8('0x45')](_0xb2ca31);})['then'](function(_0x23e843){_0x2d6d62[_0x2db8('0x46')]=_0x23e843;return _0x2d6d62;})[_0x2db8('0x26')](respondWithFilteredResult(_0x2b7b07,_0xb2ca31))[_0x2db8('0x47')](handleError(_0x2b7b07,null));};exports[_0x2db8('0x48')]=function(_0x2c99bc,_0x58cfbf){var _0x341eb6={'raw':!![],'where':{'id':_0x2c99bc[_0x2db8('0x49')]['id']}},_0x192786={};_0x192786[_0x2db8('0x32')]=_[_0x2db8('0x34')](db[_0x2db8('0x44')][_0x2db8('0x2f')]);_0x192786[_0x2db8('0x33')]=_[_0x2db8('0x34')](_0x2c99bc[_0x2db8('0x33')]);_0x192786[_0x2db8('0x35')]=_[_0x2db8('0x36')](_0x192786[_0x2db8('0x32')],_0x192786[_0x2db8('0x33')]);_0x341eb6['attributes']=_[_0x2db8('0x36')](_0x192786[_0x2db8('0x32')],qs[_0x2db8('0x38')](_0x2c99bc[_0x2db8('0x33')][_0x2db8('0x38')]));_0x341eb6[_0x2db8('0x37')]=_0x341eb6[_0x2db8('0x37')][_0x2db8('0x39')]?_0x341eb6[_0x2db8('0x37')]:_0x192786[_0x2db8('0x32')];if(_0x2c99bc['query']['includeAll']){_0x341eb6[_0x2db8('0x43')]=[{'all':!![]}];}_0x341eb6=_['merge']({},_0x341eb6,_0x2c99bc[_0x2db8('0x41')]);return db['Pause'][_0x2db8('0x4a')](_0x341eb6)[_0x2db8('0x26')](handleEntityNotFound(_0x58cfbf,null))[_0x2db8('0x26')](respondWithResult(_0x58cfbf,null))['catch'](handleError(_0x58cfbf,null));};exports[_0x2db8('0x4b')]=function(_0x18b8ba,_0x4fdc0f){return db['Pause'][_0x2db8('0x4b')](_0x18b8ba[_0x2db8('0x4c')],{})['then'](function(_0x573ced){var _0x53e782=_0x18b8ba['user'][_0x2db8('0x27')]({'plain':!![]});if(!_0x53e782)throw new Error(_0x2db8('0x4d'));if(_0x53e782[_0x2db8('0x4e')]===_0x2db8('0x4f')){var _0xa7bb8d=_0x573ced[_0x2db8('0x27')]({'plain':!![]});var _0x5e0248='Pauses';return db[_0x2db8('0x50')][_0x2db8('0x4a')]({'where':{'name':_0x5e0248,'userProfileId':_0x53e782[_0x2db8('0x51')]},'raw':!![]})[_0x2db8('0x26')](function(_0x55aedc){if(_0x55aedc&&_0x55aedc[_0x2db8('0x52')]===0x0){return db[_0x2db8('0x29')][_0x2db8('0x4b')]({'name':_0xa7bb8d[_0x2db8('0x2c')],'resourceId':_0xa7bb8d['id'],'type':_0x55aedc[_0x2db8('0x2c')],'sectionId':_0x55aedc['id']},{})[_0x2db8('0x26')](function(){return _0x573ced;});}else{return _0x573ced;}})[_0x2db8('0x47')](function(_0x41bb8f){logger['error'](_0x2db8('0x53'),_0x41bb8f);throw _0x41bb8f;});}return _0x573ced;})[_0x2db8('0x26')](respondWithResult(_0x4fdc0f,0xc9))[_0x2db8('0x47')](handleError(_0x4fdc0f,null));};exports[_0x2db8('0x54')]=function(_0x2866a0,_0x238849){if(_0x2866a0[_0x2db8('0x4c')]['id']){delete _0x2866a0[_0x2db8('0x4c')]['id'];}return db['Pause'][_0x2db8('0x4a')]({'where':{'id':_0x2866a0[_0x2db8('0x49')]['id']}})[_0x2db8('0x26')](handleEntityNotFound(_0x238849,null))[_0x2db8('0x26')](saveUpdates(_0x2866a0['body'],null))[_0x2db8('0x26')](respondWithResult(_0x238849,null))[_0x2db8('0x47')](handleError(_0x238849,null));};exports[_0x2db8('0x25')]=function(_0x48b988,_0x50fa36){return db[_0x2db8('0x44')][_0x2db8('0x4a')]({'where':{'id':_0x48b988[_0x2db8('0x49')]['id']}})[_0x2db8('0x26')](handleEntityNotFound(_0x50fa36,null))[_0x2db8('0x26')](removeEntity(_0x50fa36,null))[_0x2db8('0x47')](handleError(_0x50fa36,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index cfb36d2..41ae78a 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 _0x5fc3=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./pause.attributes','exports','define','tools_pauses'];(function(_0x3f1453,_0x55c2cc){var _0x5ad5d2=function(_0x2aefc4){while(--_0x2aefc4){_0x3f1453['push'](_0x3f1453['shift']());}};_0x5ad5d2(++_0x55c2cc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x101a17,_0x5d047a){_0x101a17=_0x101a17-0x0;var _0x3b76ee=_0x5fc3[_0x101a17];return _0x3b76ee;};'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')]('Pause',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x15b192,_0x38c235){_0x15b192=_0x15b192-0x0;var _0x396e73=_0x7fbe[_0x15b192];return _0x396e73;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 07ebfa4..7abdcd1 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x50fb84,_0x70534e){var _0xd39bd4=function(_0x1e6b0c){while(--_0x1e6b0c){_0x50fb84['push'](_0x50fb84['shift']());}};_0xd39bd4(++_0x70534e);}(_0xb10b,0x12a));var _0xbb10=function(_0x12b756,_0x43f6f3){_0x12b756=_0x12b756-0x0;var _0x40cc2e=_0xb10b[_0x12b756];return _0x40cc2e;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _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(_0x2978cf,_0x5ea0ef){var _0x339dac=function(_0x1e38a9){while(--_0x1e38a9){_0x2978cf['push'](_0x2978cf['shift']());}};_0x339dac(++_0x5ea0ef);}(_0xb10b,0x12a));var _0xbb10=function(_0x27062d,_0x24b179){_0x27062d=_0x27062d-0x0;var _0x4f1478=_0xb10b[_0x27062d];return _0x4f1478;};'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 909fa17..1b1c574 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 _0x1cc7=['path','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/webhook','webhookGet','/:id','show','/:id/download','join','server/files/plugins','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','webhookPost','put','delete','exports','multer','util'];(function(_0x53eeac,_0x1babff){var _0x41dddf=function(_0x2e8176){while(--_0x2e8176){_0x53eeac['push'](_0x53eeac['shift']());}};_0x41dddf(++_0x1babff);}(_0x1cc7,0x15a));var _0x71cc=function(_0x185539,_0xc04e94){_0x185539=_0x185539-0x0;var _0x3781cd=_0x1cc7[_0x185539];return _0x3781cd;};'use strict';var multer=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var path=require(_0x71cc('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x71cc('0x3'));var auth=require(_0x71cc('0x4'));var interaction=require(_0x71cc('0x5'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x71cc('0x6')](),controller['index']);router[_0x71cc('0x7')](_0x71cc('0x8'),controller[_0x71cc('0x9')]);router[_0x71cc('0x7')](_0x71cc('0xa'),auth['isAuthenticated'](),controller[_0x71cc('0xb')]);router[_0x71cc('0x7')](_0x71cc('0xc'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b7514,_0xeb4747,_0x2db190){_0x2db190(null,path[_0x71cc('0xd')](config['root'],_0x71cc('0xe')));},'filename':function(_0x550b3c,_0x1aad83,_0x4f9c5c){_0x1aad83[_0x71cc('0xf')]=_0x1aad83['originalname'][_0x71cc('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4f9c5c(null,util[_0x71cc('0x11')](_0x71cc('0x12'),path[_0x71cc('0x13')](_0x1aad83[_0x71cc('0xf')],path['extname'](_0x1aad83[_0x71cc('0xf')])),Date[_0x71cc('0x14')](),path[_0x71cc('0x15')](_0x1aad83[_0x71cc('0xf')])));}})});router[_0x71cc('0x16')]('/',upload[_0x71cc('0x17')](_0x71cc('0x18')),controller['upload']);router[_0x71cc('0x16')](_0x71cc('0x8'),controller[_0x71cc('0x19')]);router[_0x71cc('0x1a')](_0x71cc('0xa'),auth[_0x71cc('0x6')](),controller['update']);router[_0x71cc('0x1b')](_0x71cc('0xa'),auth['isAuthenticated'](),controller['delete']);module[_0x71cc('0x1c')]=router; \ No newline at end of file +var _0x55e0=['webhookPost','update','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','webhookGet','/:id','isAuthenticated','show','/:id/download','download','diskStorage','join','server/files/plugins','originalname','replace','%s-%s%s','basename','extname','post','file','upload','/webhook'];(function(_0x99ad96,_0x32e7e1){var _0x25cadd=function(_0x337845){while(--_0x337845){_0x99ad96['push'](_0x99ad96['shift']());}};_0x25cadd(++_0x32e7e1);}(_0x55e0,0xdc));var _0x055e=function(_0x69d07b,_0x1aa0c5){_0x69d07b=_0x69d07b-0x0;var _0x40b5da=_0x55e0[_0x69d07b];return _0x40b5da;};'use strict';var multer=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var path=require(_0x055e('0x2'));var timeout=require(_0x055e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x055e('0x4'));var auth=require(_0x055e('0x5'));var interaction=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var controller=require(_0x055e('0x8'));router[_0x055e('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x055e('0x9')]('/webhook',controller[_0x055e('0xa')]);router[_0x055e('0x9')](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0xd')]);router['get'](_0x055e('0xe'),auth[_0x055e('0xc')](),controller[_0x055e('0xf')]);var upload=multer({'storage':multer[_0x055e('0x10')]({'destination':function(_0x238068,_0x5237d9,_0x56c78a){_0x56c78a(null,path[_0x055e('0x11')](config['root'],_0x055e('0x12')));},'filename':function(_0x466da3,_0x72d424,_0x101bc3){_0x72d424[_0x055e('0x13')]=_0x72d424[_0x055e('0x13')][_0x055e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x101bc3(null,util['format'](_0x055e('0x15'),path[_0x055e('0x16')](_0x72d424[_0x055e('0x13')],path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])),Date['now'](),path[_0x055e('0x17')](_0x72d424[_0x055e('0x13')])));}})});router[_0x055e('0x18')]('/',upload['single'](_0x055e('0x19')),controller[_0x055e('0x1a')]);router[_0x055e('0x18')](_0x055e('0x1b'),controller[_0x055e('0x1c')]);router['put'](_0x055e('0xb'),auth[_0x055e('0xc')](),controller[_0x055e('0x1d')]);router[_0x055e('0x1e')]('/:id',auth[_0x055e('0xc')](),controller[_0x055e('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 9af1e10..ff77540 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 _0x729a=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','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'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x729a,0xf3));var _0xa729=function(_0x292bf8,_0x544454){_0x292bf8=_0x292bf8-0x0;var _0x1f0f3c=_0x729a[_0x292bf8];return _0x1f0f3c;};'use strict';var Sequelize=require(_0xa729('0x0'));module[_0xa729('0x1')]={'name':{'type':Sequelize[_0xa729('0x2')]},'type':{'type':Sequelize[_0xa729('0x3')](_0xa729('0x4'),_0xa729('0x5'))},'description':{'type':Sequelize[_0xa729('0x6')]},'version':{'type':Sequelize[_0xa729('0x6')]},'path':{'type':Sequelize['STRING'],'comment':_0xa729('0x7')},'active':{'type':Sequelize[_0xa729('0x8')],'defaultValue':0x0,'comment':_0xa729('0x9')},'sidebar':{'type':Sequelize[_0xa729('0x3')](_0xa729('0xa'),_0xa729('0xb'),_0xa729('0xc'),'never'),'defaultValue':'always','comment':_0xa729('0xd')},'icon':{'type':Sequelize[_0xa729('0x2')]},'adminUrl':{'type':Sequelize[_0xa729('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0xa729('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x95e1=['TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports','STRING','ENUM'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x95e1,0x1c5));var _0x195e=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x95e1[_0x273c39];return _0x46d6b5;};'use strict';var Sequelize=require('sequelize');module[_0x195e('0x0')]={'name':{'type':Sequelize[_0x195e('0x1')]},'type':{'type':Sequelize[_0x195e('0x2')]('html','script')},'description':{'type':Sequelize[_0x195e('0x3')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x195e('0x1')],'comment':_0x195e('0x4')},'active':{'type':Sequelize[_0x195e('0x5')],'defaultValue':0x0,'comment':_0x195e('0x6')},'sidebar':{'type':Sequelize[_0x195e('0x2')](_0x195e('0x7'),_0x195e('0x8'),'always',_0x195e('0x9')),'defaultValue':_0x195e('0xa'),'comment':_0x195e('0xb')},'icon':{'type':Sequelize[_0x195e('0x1')]},'adminUrl':{'type':Sequelize[_0x195e('0x1')]},'agentUrl':{'type':Sequelize[_0x195e('0x1')]},'scriptName':{'type':Sequelize[_0x195e('0x1')]},'scriptPath':{'type':Sequelize[_0x195e('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 5e10667..6d0e44d 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 _0x10be=['./plugin.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','params','intersection','include','options','find','catch','download','join','root','server/files/plugins','format','%s.zip','zip','warning','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','lstatSync','isFile','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','description','always','html','plugins','Warning:\x20admin\x20view\x20not\x20specified','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','method','%s%s','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x10be,0x1dd));var _0xe10b=function(_0x2de7f8,_0x4af1ff){_0x2de7f8=_0x2de7f8-0x0;var _0x59022b=_0x10be[_0x2de7f8];return _0x59022b;};'use strict';var emlformat=require(_0xe10b('0x0'));var rimraf=require(_0xe10b('0x1'));var zipdir=require(_0xe10b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe10b('0x3'));var BPromise=require(_0xe10b('0x4'));var Mustache=require(_0xe10b('0x5'));var util=require(_0xe10b('0x6'));var path=require(_0xe10b('0x7'));var sox=require(_0xe10b('0x8'));var csv=require(_0xe10b('0x9'));var ejs=require(_0xe10b('0xa'));var fs=require('fs');var fs_extra=require(_0xe10b('0xb'));var _=require(_0xe10b('0xc'));var squel=require(_0xe10b('0xd'));var crypto=require(_0xe10b('0xe'));var jsforce=require(_0xe10b('0xf'));var deskjs=require(_0xe10b('0x10'));var toCsv=require(_0xe10b('0x9'));var querystring=require(_0xe10b('0x11'));var Papa=require(_0xe10b('0x12'));var extract=require('extract-zip');var rimraf=require(_0xe10b('0x1'));var archiver=require(_0xe10b('0x13'));var Redis=require('ioredis');var authService=require(_0xe10b('0x14'));var qs=require(_0xe10b('0x15'));var as=require(_0xe10b('0x16'));var hardwareService=require(_0xe10b('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xe10b('0x18'));var config=require(_0xe10b('0x19'));var licenseUtil=require(_0xe10b('0x1a'));var db=require('../../mysqldb')['db'];config[_0xe10b('0x1b')]=_['defaults'](config[_0xe10b('0x1b')],{'host':_0xe10b('0x1c'),'port':0x18eb});var socket=require(_0xe10b('0x1d'))(new Redis(config[_0xe10b('0x1b')]));require(_0xe10b('0x1e'))[_0xe10b('0x1f')](socket);function respondWithStatusCode(_0x47b2c9,_0x4c6b55){_0x4c6b55=_0x4c6b55||0xcc;return function(_0x3e685c){if(_0x3e685c){return _0x47b2c9[_0xe10b('0x20')](_0x4c6b55);}return _0x47b2c9[_0xe10b('0x21')](_0x4c6b55)['end']();};}function respondWithResult(_0x445e6a,_0x1141bd){_0x1141bd=_0x1141bd||0xc8;return function(_0x18aee1){if(_0x18aee1){return _0x445e6a[_0xe10b('0x21')](_0x1141bd)[_0xe10b('0x22')](_0x18aee1);}};}function respondWithFilteredResult(_0x387559,_0x3c88dc){return function(_0x291f12){if(_0x291f12){var _0xe869c9=typeof _0x3c88dc[_0xe10b('0x23')]===_0xe10b('0x24')&&typeof _0x3c88dc[_0xe10b('0x25')]===_0xe10b('0x24');var _0x6c08d=_0x291f12[_0xe10b('0x26')];var _0x1a838f=_0xe869c9?0x0:_0x3c88dc[_0xe10b('0x23')];var _0x2119fe=_0xe869c9?_0x291f12['count']:_0x3c88dc[_0xe10b('0x23')]+_0x3c88dc[_0xe10b('0x25')];var _0x3644db;if(_0x2119fe>=_0x6c08d){_0x2119fe=_0x6c08d;_0x3644db=0xc8;}else{_0x3644db=0xce;}_0x387559[_0xe10b('0x21')](_0x3644db);return _0x387559['set'](_0xe10b('0x27'),_0x1a838f+'-'+_0x2119fe+'/'+_0x6c08d)[_0xe10b('0x22')](_0x291f12);}return null;};}function patchUpdates(_0x131fc2){return function(_0xb1755c){try{jsonpatch[_0xe10b('0x28')](_0xb1755c,_0x131fc2,!![]);}catch(_0x3ea606){return BPromise[_0xe10b('0x29')](_0x3ea606);}return _0xb1755c[_0xe10b('0x2a')]();};}function saveUpdates(_0x2066c1,_0x119a80){return function(_0x6688cd){if(_0x6688cd){return _0x6688cd['update'](_0x2066c1)['then'](function(_0x1f4278){return _0x1f4278;});}return null;};}function removeEntity(_0x1809ef,_0x31fda7){return function(_0xc894c6){if(_0xc894c6){return _0xc894c6[_0xe10b('0x2b')]()[_0xe10b('0x2c')](function(){var _0x11aaa8=_0xc894c6[_0xe10b('0x2d')]({'plain':!![]});var _0x3c517e=_0xe10b('0x2e');return db[_0xe10b('0x2f')][_0xe10b('0x2b')]({'where':{'type':_0x3c517e,'resourceId':_0x11aaa8['id']}})[_0xe10b('0x2c')](function(){return _0xc894c6;});})[_0xe10b('0x2c')](function(){_0x1809ef['status'](0xcc)[_0xe10b('0x30')]();});}};}function handleEntityNotFound(_0x536d09,_0x5472aa){return function(_0xad2a25){if(!_0xad2a25){_0x536d09['sendStatus'](0x194);}return _0xad2a25;};}function handleError(_0x1ec48c,_0x238b1f){_0x238b1f=_0x238b1f||0x1f4;return function(_0x4cc158){logger[_0xe10b('0x31')](_0x4cc158[_0xe10b('0x32')]);if(_0x4cc158[_0xe10b('0x33')]){delete _0x4cc158[_0xe10b('0x33')];}_0x1ec48c[_0xe10b('0x21')](_0x238b1f)[_0xe10b('0x34')](_0x4cc158);};}exports[_0xe10b('0x35')]=function(_0x446b04,_0xd2ad83){var _0x44e02b={},_0x435238={},_0xbe3217={'count':0x0,'rows':[]};var _0x3199db=_[_0xe10b('0x36')](db[_0xe10b('0x37')][_0xe10b('0x38')],function(_0x37c65a){return{'name':_0x37c65a[_0xe10b('0x39')],'type':_0x37c65a[_0xe10b('0x3a')]['key']};});_0x435238[_0xe10b('0x3b')]=_[_0xe10b('0x36')](_0x3199db,'name');_0x435238[_0xe10b('0x3c')]=_[_0xe10b('0x3d')](_0x446b04[_0xe10b('0x3c')]);_0x435238['filters']=_['intersection'](_0x435238[_0xe10b('0x3b')],_0x435238['query']);_0x44e02b[_0xe10b('0x3e')]=_['intersection'](_0x435238[_0xe10b('0x3b')],qs['fields'](_0x446b04[_0xe10b('0x3c')][_0xe10b('0x3f')]));_0x44e02b[_0xe10b('0x3e')]=_0x44e02b['attributes'][_0xe10b('0x40')]?_0x44e02b[_0xe10b('0x3e')]:_0x435238[_0xe10b('0x3b')];if(!_0x446b04[_0xe10b('0x3c')][_0xe10b('0x41')](_0xe10b('0x42'))){_0x44e02b[_0xe10b('0x25')]=qs[_0xe10b('0x25')](_0x446b04[_0xe10b('0x3c')][_0xe10b('0x25')]);_0x44e02b['offset']=qs[_0xe10b('0x23')](_0x446b04[_0xe10b('0x3c')]['offset']);}_0x44e02b['order']=qs[_0xe10b('0x43')](_0x446b04['query'][_0xe10b('0x43')]);_0x44e02b[_0xe10b('0x44')]=qs[_0xe10b('0x45')](_[_0xe10b('0x46')](_0x446b04[_0xe10b('0x3c')],_0x435238['filters']),_0x3199db);if(_0x446b04[_0xe10b('0x3c')][_0xe10b('0x47')]){_0x44e02b[_0xe10b('0x44')]=_['merge'](_0x44e02b['where'],{'$or':_[_0xe10b('0x36')](_0x3199db,function(_0x4c1842){if(_0x4c1842[_0xe10b('0x3a')]!==_0xe10b('0x48')){var _0xd38ae0={};_0xd38ae0[_0x4c1842['name']]={'$like':'%'+_0x446b04[_0xe10b('0x3c')][_0xe10b('0x47')]+'%'};return _0xd38ae0;}})});}_0x44e02b=_[_0xe10b('0x49')]({},_0x44e02b,_0x446b04['options']);var _0x33296d={'where':_0x44e02b[_0xe10b('0x44')]};return db['Plugin'][_0xe10b('0x26')](_0x33296d)[_0xe10b('0x2c')](function(_0xcec3d2){_0xbe3217[_0xe10b('0x26')]=_0xcec3d2;if(_0x446b04[_0xe10b('0x3c')][_0xe10b('0x4a')]){_0x44e02b['include']=[{'all':!![]}];}return db[_0xe10b('0x37')][_0xe10b('0x4b')](_0x44e02b);})[_0xe10b('0x2c')](function(_0x3f799e){_0xbe3217[_0xe10b('0x4c')]=_0x3f799e;return _0xbe3217;})[_0xe10b('0x2c')](respondWithFilteredResult(_0xd2ad83,_0x44e02b))['catch'](handleError(_0xd2ad83,null));};exports['show']=function(_0x1e5427,_0x3017c9){var _0xf5de79={'raw':!![],'where':{'id':_0x1e5427[_0xe10b('0x4d')]['id']}},_0x4627ea={};_0x4627ea[_0xe10b('0x3b')]=_[_0xe10b('0x3d')](db['Plugin'][_0xe10b('0x38')]);_0x4627ea[_0xe10b('0x3c')]=_[_0xe10b('0x3d')](_0x1e5427[_0xe10b('0x3c')]);_0x4627ea['filters']=_[_0xe10b('0x4e')](_0x4627ea['model'],_0x4627ea[_0xe10b('0x3c')]);_0xf5de79[_0xe10b('0x3e')]=_[_0xe10b('0x4e')](_0x4627ea[_0xe10b('0x3b')],qs[_0xe10b('0x3f')](_0x1e5427['query'][_0xe10b('0x3f')]));_0xf5de79['attributes']=_0xf5de79[_0xe10b('0x3e')]['length']?_0xf5de79[_0xe10b('0x3e')]:_0x4627ea[_0xe10b('0x3b')];if(_0x1e5427[_0xe10b('0x3c')]['includeAll']){_0xf5de79[_0xe10b('0x4f')]=[{'all':!![]}];}_0xf5de79=_[_0xe10b('0x49')]({},_0xf5de79,_0x1e5427[_0xe10b('0x50')]);return db[_0xe10b('0x37')][_0xe10b('0x51')](_0xf5de79)[_0xe10b('0x2c')](handleEntityNotFound(_0x3017c9,null))[_0xe10b('0x2c')](respondWithResult(_0x3017c9,null))[_0xe10b('0x52')](handleError(_0x3017c9,null));};exports[_0xe10b('0x53')]=function(_0x149dd8,_0x48f006,_0x55580c){return db[_0xe10b('0x37')][_0xe10b('0x51')]({'where':{'id':_0x149dd8[_0xe10b('0x4d')]['id']},'attributes':[_0xe10b('0x33'),_0xe10b('0x7')],'raw':!![]})[_0xe10b('0x2c')](handleEntityNotFound(_0x48f006,null))[_0xe10b('0x2c')](function(_0x32474e){if(_0x32474e){var _0x3df118=path[_0xe10b('0x54')](config[_0xe10b('0x55')],_0xe10b('0x56'),util[_0xe10b('0x57')](_0xe10b('0x58'),path['basename'](_0x32474e['path'])));var _0x5a54b3=fs['createWriteStream'](_0x3df118);var _0x4c39dc=archiver(_0xe10b('0x59'),{'zlib':{'level':0x9}});_0x4c39dc['on'](_0xe10b('0x5a'),function(_0x508996){if(_0x508996['code']==='ENOENT'){logger[_0xe10b('0x31')](_0x508996);}else{throw new db[(_0xe10b('0x5b'))][(_0xe10b('0x5c'))](_0xe10b('0x5d'));}});_0x4c39dc['on'](_0xe10b('0x31'),function(_0x2ad746){throw new db[(_0xe10b('0x5b'))][(_0xe10b('0x5c'))](_0xe10b('0x5d'));});_0x4c39dc[_0xe10b('0x5e')](_0x5a54b3);_0x4c39dc[_0xe10b('0x5f')](_0xe10b('0x60'),{'cwd':path[_0xe10b('0x54')](config[_0xe10b('0x55')],_0xe10b('0x56'),path[_0xe10b('0x61')](_0x32474e[_0xe10b('0x7')])),'ignore':[path['join'](path[_0xe10b('0x62')](_0x32474e['path']),_0xe10b('0x63')),path[_0xe10b('0x54')](path[_0xe10b('0x62')](_0x32474e['path']),_0xe10b('0x64'))],'nodir':!![]})[_0xe10b('0x65')]();_0x5a54b3['on'](_0xe10b('0x66'),function(){if(!fs[_0xe10b('0x67')](_0x3df118)){throw new db['Sequelize'][(_0xe10b('0x5c'))]('Plugin\x20not\x20found');}return _0x48f006['download'](_0x3df118,util[_0xe10b('0x57')](_0xe10b('0x58'),path[_0xe10b('0x62')](_0x32474e[_0xe10b('0x7')])),function(_0x3ba3c9){if(_0x3ba3c9){throw new db[(_0xe10b('0x5b'))][(_0xe10b('0x5c'))](_0xe10b('0x68'));}fs[_0xe10b('0x69')](_0x3df118);logger[_0xe10b('0x6a')](_0xe10b('0x6b'));logger['info']('Temporary\x20file\x20removed');});});}return null;})['catch'](handleError(_0x48f006,null));};exports[_0xe10b('0x6c')]=function(_0x5453af,_0x1c4d80,_0x3e60b5){var _0x3814b5=path['basename'](_0x5453af['file']['filename'],path['extname'](_0x5453af[_0xe10b('0x6d')][_0xe10b('0x6e')]));var _0x242adb=path[_0xe10b('0x54')](config[_0xe10b('0x55')],_0xe10b('0x56'),_0x5453af[_0xe10b('0x6d')]['filename']);var _0x16fc90=path[_0xe10b('0x54')](config[_0xe10b('0x55')],_0xe10b('0x56'),_0x3814b5);logger[_0xe10b('0x6a')](_0xe10b('0x6f'),_0x242adb);logger['info'](_0xe10b('0x70'),_0x16fc90);try{fs[_0xe10b('0x71')](_0x242adb,parseInt(_0xe10b('0x72'),0x8));extract(_0x242adb,{'dir':_0x16fc90},function(_0x137307){if(_0x137307){logger[_0xe10b('0x31')](_0x137307);handleError(_0x137307,!![]);};var _0x434057=fs['readdirSync'](_0x16fc90);if(_0x434057[_0xe10b('0x40')]>0x1){removeReferences(_0x242adb,_0x16fc90);logger['error'](_0xe10b('0x73'));return _0x3e60b5(new Error(_0xe10b('0x73')));}var _0xee812f=fs[_0xe10b('0x74')](path[_0xe10b('0x54')](_0x16fc90,_0x434057[0x0]));if(_0xee812f[_0xe10b('0x75')]()){removeReferences(_0x242adb,_0x16fc90);logger[_0xe10b('0x31')](_0xe10b('0x73'));return _0x3e60b5(new Error('Invalid\x20plugin\x20structure'));}if(_0xee812f['isDirectory']()){var _0x5b0f49=fs['readdirSync'](path[_0xe10b('0x54')](_0x16fc90,_0x434057[0x0]));if(_0x5b0f49[_0xe10b('0x40')]===0x0){removeReferences(_0x242adb,_0x16fc90);logger[_0xe10b('0x31')](_0xe10b('0x73'));return _0x3e60b5(new Error(_0xe10b('0x73')));}var _0x156cc0=_0x5b0f49['some'](function(_0x2495cb){return _0x2495cb==='manifest.json';});if(!_0x156cc0){return _0x3e60b5(new Error(_0xe10b('0x76')));}var _0x18ab4e=fs[_0xe10b('0x77')](path[_0xe10b('0x54')](_0x16fc90,_0x434057[0x0],'manifest.json'));var _0x4645e5=JSON[_0xe10b('0x78')](_0x18ab4e);if(_0xe10b('0x24')==typeof _0x4645e5[_0xe10b('0x33')]){return _0x3e60b5(new Error(_0xe10b('0x79')));}if('undefined'==typeof _0x4645e5[_0xe10b('0x3a')]){return _0x3e60b5(new Error(_0xe10b('0x7a')));}if(_0xe10b('0x24')==typeof _0x4645e5['version']){return _0x3e60b5(new Error(_0xe10b('0x7b')));}if(_0xe10b('0x24')==typeof _0x4645e5[_0xe10b('0x7c')]){return _0x3e60b5(new Error(_0xe10b('0x7d')));}if(_0x4645e5[_0xe10b('0x3a')]==='html'){if('undefined'==typeof _0x4645e5[_0xe10b('0x7c')][_0xe10b('0x7e')]){return _0x3e60b5(new Error(_0xe10b('0x7f')));}if(_0xe10b('0x24')==typeof _0x4645e5['parameters']['views'][_0xe10b('0x80')]&&_0xe10b('0x24')==typeof _0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x81')]){return _0x3e60b5(new Error(_0xe10b('0x82')));}}else if(_0x4645e5[_0xe10b('0x3a')]===_0xe10b('0x83')){if(_0xe10b('0x24')==typeof _0x4645e5['parameters'][_0xe10b('0x84')]){return _0x3e60b5(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x4645e5[_0xe10b('0x7c')][_0xe10b('0x85')]){return _0x3e60b5(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x3e60b5(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1bddc5=_0x4645e5[_0xe10b('0x33')];var _0x5b8df9=_0x4645e5[_0xe10b('0x86')];var _0x496ed8=_0x4645e5['type'];var _0x3c2cdb=_0x4645e5['sidebar']?_0x4645e5['sidebar']:_0xe10b('0x87');var _0xe119c2=_0x4645e5['icon']?_0x4645e5['icon']:'icon-apps';var _0x1f8a56='';var _0x51845e='';var _0x47048f='';var _0x15dd28='';var _0x361dae=_0x4645e5['version'];if(_0x496ed8===_0xe10b('0x88')){if(_0xe10b('0x24')!=typeof _0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x80')]){var _0xd19202=_0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x80')];if(!/^(f|ht)tps?:\/\//i['test'](_0xd19202)){_0x1f8a56=path[_0xe10b('0x54')](_0xe10b('0x89'),_0x3814b5,_0x434057[0x0],_0xd19202);}else{_0x1f8a56=_0xd19202;}}else{logger[_0xe10b('0x6a')](_0xe10b('0x8a'));}if('undefined'!=typeof _0x4645e5[_0xe10b('0x7c')][_0xe10b('0x7e')][_0xe10b('0x81')]){var _0x25aa90=_0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xe10b('0x8b')](_0x25aa90)){_0x51845e=path[_0xe10b('0x54')](_0xe10b('0x89'),_0x3814b5,_0x434057[0x0],_0x25aa90);}else{_0x51845e=_0x25aa90;}}else{logger[_0xe10b('0x6a')](_0xe10b('0x8c'));}}else if(_0x496ed8===_0xe10b('0x83')){_0x47048f=_0x4645e5['parameters'][_0xe10b('0x84')];_0x15dd28=_0x4645e5['parameters'][_0xe10b('0x85')];if(_0xe10b('0x24')!=typeof _0x4645e5[_0xe10b('0x7c')][_0xe10b('0x7e')]){if('undefined'!=typeof _0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x80')]){var _0xd19202=_0x4645e5['parameters'][_0xe10b('0x7e')][_0xe10b('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xe10b('0x8b')](_0xd19202)){_0x1f8a56=path['join'](_0xe10b('0x89'),_0x3814b5,_0x434057[0x0],_0xd19202);}else{_0x1f8a56=_0xd19202;}}if(_0xe10b('0x24')!=typeof _0x4645e5[_0xe10b('0x7c')][_0xe10b('0x7e')][_0xe10b('0x81')]){var _0x25aa90=_0x4645e5[_0xe10b('0x7c')][_0xe10b('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xe10b('0x8b')](_0x25aa90)){_0x51845e=path['join'](_0xe10b('0x89'),_0x3814b5,_0x434057[0x0],_0x25aa90);}else{_0x51845e=_0x25aa90;}}}}var _0x2f64be={'name':_0x1bddc5,'description':_0x5b8df9,'path':path[_0xe10b('0x54')](_0x3814b5,_0x434057[0x0]),'type':_0x496ed8,'sidebar':_0x3c2cdb,'icon':_0xe119c2,'adminUrl':_0x1f8a56,'agentUrl':_0x51845e,'scriptName':_0x47048f,'scriptPath':_0x15dd28,'version':_0x361dae};removeReferences(_0x242adb,null);return db[_0xe10b('0x37')][_0xe10b('0x8d')](_0x2f64be)['then'](function(_0x2f186c){var _0x7b6d69={'role':_0x5453af[_0xe10b('0x8e')][_0xe10b('0x8f')],'userProfileId':_0x5453af[_0xe10b('0x8e')][_0xe10b('0x90')]};if(!_0x7b6d69)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7b6d69[_0xe10b('0x8f')]===_0xe10b('0x91')){var _0x4b5f4d=_0x2f186c[_0xe10b('0x2d')]({'plain':!![]});return db[_0xe10b('0x92')][_0xe10b('0x51')]({'where':{'name':_0xe10b('0x2e'),'userProfileId':_0x7b6d69[_0xe10b('0x90')]},'raw':!![]})[_0xe10b('0x2c')](function(_0x152f12){if(_0x152f12&&_0x152f12[_0xe10b('0x93')]===0x0){return db['UserProfileResource'][_0xe10b('0x8d')]({'name':_0x4b5f4d[_0xe10b('0x33')],'resourceId':_0x4b5f4d['id'],'type':_0x152f12[_0xe10b('0x33')],'sectionId':_0x152f12['id']},{})[_0xe10b('0x2c')](function(){return _0x2f186c;});}else{return _0x2f186c;}})[_0xe10b('0x52')](function(_0x20df2a){logger[_0xe10b('0x31')](_0xe10b('0x94'),_0x20df2a);throw _0x20df2a;});}return _0x2f186c;})[_0xe10b('0x2c')](respondWithResult(_0x1c4d80,null))['catch'](handleError(_0x1c4d80,null));}});}catch(_0x6b3761){_0x1c4d80[_0xe10b('0x21')](0x1f4)['send'](_0x6b3761);}};function removeReferences(_0x57c851,_0x3bd753){try{if(_0x57c851){fs[_0xe10b('0x69')](_0x57c851);logger[_0xe10b('0x6a')](_0xe10b('0x95'));}if(_0x3bd753){rimraf(_0x3bd753,function(){});logger[_0xe10b('0x6a')](_0xe10b('0x96'));}}catch(_0x172cf1){logger[_0xe10b('0x31')](_0x172cf1);}}exports[_0xe10b('0x97')]=function(_0x107317,_0x1f21c8,_0x45aa4f){return db[_0xe10b('0x37')]['find']({'where':{'id':_0x107317[_0xe10b('0x4d')]['id']}})[_0xe10b('0x2c')](handleEntityNotFound(_0x1f21c8,null))['then'](saveUpdates(_0x107317['body'],null))[_0xe10b('0x2c')](respondWithResult(_0x1f21c8,null))[_0xe10b('0x52')](handleError(_0x1f21c8,null));};exports[_0xe10b('0x98')]=function(_0x523904,_0x5b38d6,_0x15a5bb){return db[_0xe10b('0x37')][_0xe10b('0x51')]({'where':{'id':_0x523904[_0xe10b('0x4d')]['id']}})['then'](function(_0x4299de){if(_0x4299de){return _0x4299de[_0xe10b('0x2b')]();}})[_0xe10b('0x2c')](function(_0x226563){rimraf(path['join'](config[_0xe10b('0x55')],'server/files/plugins',path[_0xe10b('0x61')](_0x226563[_0xe10b('0x7')])),function(){});return _0x226563;})[_0xe10b('0x2c')](handleEntityNotFound(_0x5b38d6,null))[_0xe10b('0x2c')](respondWithStatusCode(_0x5b38d6,null))[_0xe10b('0x52')](handleError(_0x5b38d6,null));};exports['webhookGet']=function(_0x58e922,_0x560f8c,_0x42ebae){return BPromise[_0xe10b('0x99')]()[_0xe10b('0x2c')](function(){if(!_0x58e922[_0xe10b('0x3c')][_0xe10b('0x7')]){throw new Error(_0xe10b('0x9a'));}if(!_0x58e922[_0xe10b('0x3c')][_0xe10b('0x9b')]){throw new Error(_0xe10b('0x9c'));}var _0x3af05f=_0x58e922['query'][_0xe10b('0x9d')]?_0x58e922['query']['hostname']+':'+_0x58e922[_0xe10b('0x3c')][_0xe10b('0x9b')]:_0xe10b('0x9e')+_0x58e922['query'][_0xe10b('0x9b')];var _0x4428aa=_0x58e922[_0xe10b('0x3c')]['json']?_0x58e922['query']['json']:!![];var _0x143054=_0x58e922[_0xe10b('0x3c')][_0xe10b('0x9f')]?_0x58e922[_0xe10b('0x3c')][_0xe10b('0x9f')]:null;var _0x35ba60={'method':_0x58e922['method'],'uri':util['format']('%s%s',_0x3af05f,_0x58e922[_0xe10b('0x3c')][_0xe10b('0x7')]),'json':_0x4428aa,'resolveWithFullResponse':!![],'encoding':_0x143054,'qs':_0x58e922[_0xe10b('0x3c')]};if(_0x58e922[_0xe10b('0xa0')]){_0x35ba60[_0xe10b('0xa0')]=_0x58e922[_0xe10b('0xa0')];if(_0x35ba60[_0xe10b('0xa0')]['content-length']){delete _0x35ba60[_0xe10b('0xa0')][_0xe10b('0xa1')];}}if(_0x35ba60['headers']['content-type']){delete _0x35ba60[_0xe10b('0xa0')][_0xe10b('0xa2')];}return rp(_0x35ba60);})[_0xe10b('0x2c')](function(_0x55998e){if(_0x55998e){_0x560f8c[_0xe10b('0xa3')](_0x55998e[_0xe10b('0xa0')]);logger['info'](_0x55998e['body']);if(_[_0xe10b('0xa4')](_0x58e922['query'][_0xe10b('0x7')],_0xe10b('0x53'))&&_0x55998e[_0xe10b('0xa5')]==0x1f4){return _0x560f8c['sendStatus'](_0x55998e[_0xe10b('0xa5')]);}else{return _0x560f8c[_0xe10b('0x21')](_0x55998e[_0xe10b('0xa5')])['send'](_0x55998e['body']);}}else{return _0x560f8c[_0xe10b('0x20')](0xc8);}})[_0xe10b('0x52')](handleError(_0x560f8c,null));};exports[_0xe10b('0xa6')]=function(_0x6559ac,_0xf44724,_0x5e8375){return BPromise[_0xe10b('0x99')]()['then'](function(){if(!_0x6559ac[_0xe10b('0x3c')]['path']){throw new Error(_0xe10b('0x9a'));}if(!_0x6559ac['query']['port']){throw new Error(_0xe10b('0x9c'));}var _0x5ecfa3=_0x6559ac[_0xe10b('0x3c')][_0xe10b('0x9d')]?_0x6559ac[_0xe10b('0x3c')][_0xe10b('0x9d')]+':'+_0x6559ac[_0xe10b('0x3c')]['port']:_0xe10b('0x9e')+_0x6559ac[_0xe10b('0x3c')]['port'];var _0x3c2c24=_0x6559ac[_0xe10b('0x3c')]['json']?_0x6559ac[_0xe10b('0x3c')][_0xe10b('0x22')]:!![];var _0x2dbb62=_0x6559ac[_0xe10b('0x3c')][_0xe10b('0x9f')]?_0x6559ac[_0xe10b('0x3c')]['encoding']:null;var _0x526edd={'method':_0x6559ac[_0xe10b('0xa7')],'uri':util[_0xe10b('0x57')](_0xe10b('0xa8'),_0x5ecfa3,_0x6559ac[_0xe10b('0x3c')]['path']),'json':_0x3c2c24,'resolveWithFullResponse':!![],'encoding':_0x2dbb62,'body':_0x6559ac[_0xe10b('0x8e')]};if(_0x6559ac[_0xe10b('0xa0')]){_0x526edd[_0xe10b('0xa0')]=_0x6559ac[_0xe10b('0xa0')];if(_0x526edd[_0xe10b('0xa0')][_0xe10b('0xa1')]){delete _0x526edd[_0xe10b('0xa0')][_0xe10b('0xa1')];}}if(_0x526edd[_0xe10b('0xa0')][_0xe10b('0xa2')]){delete _0x526edd['headers'][_0xe10b('0xa2')];}return rp(_0x526edd);})['then'](function(_0x5675e2){if(_0x5675e2){_0xf44724['set'](_0x5675e2['headers']);logger[_0xe10b('0x6a')](_0x5675e2[_0xe10b('0x8e')]);return _0xf44724['status'](_0x5675e2[_0xe10b('0xa5')])[_0xe10b('0x34')](_0x5675e2[_0xe10b('0x8e')]);}else{return _0xf44724[_0xe10b('0x20')](0xc8);}})[_0xe10b('0x52')](handleError(_0xf44724,null));}; \ No newline at end of file +var _0x2b85=['moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../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','status','end','json','offset','undefined','count','Content-Range','reject','save','update','then','destroy','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','basename','zip','code','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','format','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','file','filename','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','readdirSync','Invalid\x20plugin\x20structure','lstatSync','some','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','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Extracted\x20folder\x20removed','delete','webhookGet','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-type','endsWith','statusCode','sendStatus','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','method','content-length','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1aad42,_0x301d30){var _0x4320e2=function(_0x10268a){while(--_0x10268a){_0x1aad42['push'](_0x1aad42['shift']());}};_0x4320e2(++_0x301d30);}(_0x2b85,0xa9));var _0x52b8=function(_0x37c3ce,_0xcd551a){_0x37c3ce=_0x37c3ce-0x0;var _0x2d13d9=_0x2b85[_0x37c3ce];return _0x2d13d9;};'use strict';var emlformat=require(_0x52b8('0x0'));var rimraf=require(_0x52b8('0x1'));var zipdir=require(_0x52b8('0x2'));var jsonpatch=require(_0x52b8('0x3'));var rp=require(_0x52b8('0x4'));var moment=require(_0x52b8('0x5'));var BPromise=require(_0x52b8('0x6'));var Mustache=require(_0x52b8('0x7'));var util=require(_0x52b8('0x8'));var path=require(_0x52b8('0x9'));var sox=require(_0x52b8('0xa'));var csv=require(_0x52b8('0xb'));var ejs=require(_0x52b8('0xc'));var fs=require('fs');var fs_extra=require(_0x52b8('0xd'));var _=require(_0x52b8('0xe'));var squel=require('squel');var crypto=require(_0x52b8('0xf'));var jsforce=require(_0x52b8('0x10'));var deskjs=require(_0x52b8('0x11'));var toCsv=require(_0x52b8('0xb'));var querystring=require(_0x52b8('0x12'));var Papa=require(_0x52b8('0x13'));var extract=require(_0x52b8('0x14'));var rimraf=require(_0x52b8('0x1'));var archiver=require(_0x52b8('0x15'));var Redis=require(_0x52b8('0x16'));var authService=require(_0x52b8('0x17'));var qs=require(_0x52b8('0x18'));var as=require(_0x52b8('0x19'));var hardwareService=require(_0x52b8('0x1a'));var logger=require(_0x52b8('0x1b'))(_0x52b8('0x1c'));var utils=require('../../config/utils');var config=require(_0x52b8('0x1d'));var licenseUtil=require(_0x52b8('0x1e'));var db=require(_0x52b8('0x1f'))['db'];config[_0x52b8('0x20')]=_[_0x52b8('0x21')](config[_0x52b8('0x20')],{'host':_0x52b8('0x22'),'port':0x18eb});var socket=require(_0x52b8('0x23'))(new Redis(config[_0x52b8('0x20')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x5ed7a8,_0x2503c8){_0x2503c8=_0x2503c8||0xcc;return function(_0xe887cf){if(_0xe887cf){return _0x5ed7a8['sendStatus'](_0x2503c8);}return _0x5ed7a8[_0x52b8('0x24')](_0x2503c8)[_0x52b8('0x25')]();};}function respondWithResult(_0x32b3de,_0x4a0e57){_0x4a0e57=_0x4a0e57||0xc8;return function(_0x1248be){if(_0x1248be){return _0x32b3de[_0x52b8('0x24')](_0x4a0e57)[_0x52b8('0x26')](_0x1248be);}};}function respondWithFilteredResult(_0xa89307,_0x2bda22){return function(_0x3de4d8){if(_0x3de4d8){var _0x25aaad=typeof _0x2bda22[_0x52b8('0x27')]==='undefined'&&typeof _0x2bda22['limit']===_0x52b8('0x28');var _0x28e570=_0x3de4d8[_0x52b8('0x29')];var _0x20b560=_0x25aaad?0x0:_0x2bda22[_0x52b8('0x27')];var _0x40e6f5=_0x25aaad?_0x3de4d8[_0x52b8('0x29')]:_0x2bda22[_0x52b8('0x27')]+_0x2bda22['limit'];var _0x49602b;if(_0x40e6f5>=_0x28e570){_0x40e6f5=_0x28e570;_0x49602b=0xc8;}else{_0x49602b=0xce;}_0xa89307[_0x52b8('0x24')](_0x49602b);return _0xa89307['set'](_0x52b8('0x2a'),_0x20b560+'-'+_0x40e6f5+'/'+_0x28e570)['json'](_0x3de4d8);}return null;};}function patchUpdates(_0x325b35){return function(_0xf26de7){try{jsonpatch['apply'](_0xf26de7,_0x325b35,!![]);}catch(_0x516e8c){return BPromise[_0x52b8('0x2b')](_0x516e8c);}return _0xf26de7[_0x52b8('0x2c')]();};}function saveUpdates(_0x49afba,_0xd115){return function(_0x4114b8){if(_0x4114b8){return _0x4114b8[_0x52b8('0x2d')](_0x49afba)[_0x52b8('0x2e')](function(_0x2a2f06){return _0x2a2f06;});}return null;};}function removeEntity(_0x37e8e3,_0x14bec9){return function(_0x15a2cb){if(_0x15a2cb){return _0x15a2cb[_0x52b8('0x2f')]()[_0x52b8('0x2e')](function(){var _0x3b94a8=_0x15a2cb['get']({'plain':!![]});var _0x532da5=_0x52b8('0x30');return db[_0x52b8('0x31')]['destroy']({'where':{'type':_0x532da5,'resourceId':_0x3b94a8['id']}})[_0x52b8('0x2e')](function(){return _0x15a2cb;});})[_0x52b8('0x2e')](function(){_0x37e8e3['status'](0xcc)[_0x52b8('0x25')]();});}};}function handleEntityNotFound(_0x276aef,_0x2acd5e){return function(_0x170d2e){if(!_0x170d2e){_0x276aef['sendStatus'](0x194);}return _0x170d2e;};}function handleError(_0x305b98,_0x5d1a25){_0x5d1a25=_0x5d1a25||0x1f4;return function(_0x24485f){logger[_0x52b8('0x32')](_0x24485f[_0x52b8('0x33')]);if(_0x24485f['name']){delete _0x24485f[_0x52b8('0x34')];}_0x305b98['status'](_0x5d1a25)[_0x52b8('0x35')](_0x24485f);};}exports[_0x52b8('0x36')]=function(_0x4cc395,_0x46538d){var _0x33724f={},_0x26aaf6={},_0x53e4c4={'count':0x0,'rows':[]};var _0xa38b11=_[_0x52b8('0x37')](db[_0x52b8('0x38')][_0x52b8('0x39')],function(_0x58b791){return{'name':_0x58b791[_0x52b8('0x3a')],'type':_0x58b791['type'][_0x52b8('0x3b')]};});_0x26aaf6['model']=_[_0x52b8('0x37')](_0xa38b11,_0x52b8('0x34'));_0x26aaf6['query']=_[_0x52b8('0x3c')](_0x4cc395[_0x52b8('0x3d')]);_0x26aaf6[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](_0x26aaf6[_0x52b8('0x40')],_0x26aaf6[_0x52b8('0x3d')]);_0x33724f['attributes']=_[_0x52b8('0x3f')](_0x26aaf6[_0x52b8('0x40')],qs[_0x52b8('0x41')](_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x41')]));_0x33724f['attributes']=_0x33724f[_0x52b8('0x42')][_0x52b8('0x43')]?_0x33724f[_0x52b8('0x42')]:_0x26aaf6[_0x52b8('0x40')];if(!_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x44')]('nolimit')){_0x33724f[_0x52b8('0x45')]=qs[_0x52b8('0x45')](_0x4cc395[_0x52b8('0x3d')]['limit']);_0x33724f[_0x52b8('0x27')]=qs[_0x52b8('0x27')](_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x27')]);}_0x33724f[_0x52b8('0x46')]=qs[_0x52b8('0x47')](_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x47')]);_0x33724f[_0x52b8('0x48')]=qs[_0x52b8('0x3e')](_[_0x52b8('0x49')](_0x4cc395['query'],_0x26aaf6[_0x52b8('0x3e')]),_0xa38b11);if(_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x4a')]){_0x33724f[_0x52b8('0x48')]=_[_0x52b8('0x4b')](_0x33724f['where'],{'$or':_['map'](_0xa38b11,function(_0xefa86e){if(_0xefa86e[_0x52b8('0x4c')]!==_0x52b8('0x4d')){var _0x1eca51={};_0x1eca51[_0xefa86e[_0x52b8('0x34')]]={'$like':'%'+_0x4cc395['query'][_0x52b8('0x4a')]+'%'};return _0x1eca51;}})});}_0x33724f=_[_0x52b8('0x4b')]({},_0x33724f,_0x4cc395['options']);var _0x86f0a9={'where':_0x33724f[_0x52b8('0x48')]};return db['Plugin'][_0x52b8('0x29')](_0x86f0a9)[_0x52b8('0x2e')](function(_0x4062da){_0x53e4c4[_0x52b8('0x29')]=_0x4062da;if(_0x4cc395[_0x52b8('0x3d')][_0x52b8('0x4e')]){_0x33724f[_0x52b8('0x4f')]=[{'all':!![]}];}return db[_0x52b8('0x38')]['findAll'](_0x33724f);})[_0x52b8('0x2e')](function(_0x308158){_0x53e4c4[_0x52b8('0x50')]=_0x308158;return _0x53e4c4;})['then'](respondWithFilteredResult(_0x46538d,_0x33724f))[_0x52b8('0x51')](handleError(_0x46538d,null));};exports[_0x52b8('0x52')]=function(_0x221a69,_0x2c6520){var _0x266f67={'raw':!![],'where':{'id':_0x221a69[_0x52b8('0x53')]['id']}},_0x53d302={};_0x53d302[_0x52b8('0x40')]=_['keys'](db[_0x52b8('0x38')]['rawAttributes']);_0x53d302['query']=_[_0x52b8('0x3c')](_0x221a69[_0x52b8('0x3d')]);_0x53d302[_0x52b8('0x3e')]=_[_0x52b8('0x3f')](_0x53d302['model'],_0x53d302[_0x52b8('0x3d')]);_0x266f67[_0x52b8('0x42')]=_[_0x52b8('0x3f')](_0x53d302[_0x52b8('0x40')],qs[_0x52b8('0x41')](_0x221a69[_0x52b8('0x3d')][_0x52b8('0x41')]));_0x266f67[_0x52b8('0x42')]=_0x266f67[_0x52b8('0x42')][_0x52b8('0x43')]?_0x266f67[_0x52b8('0x42')]:_0x53d302[_0x52b8('0x40')];if(_0x221a69[_0x52b8('0x3d')][_0x52b8('0x4e')]){_0x266f67[_0x52b8('0x4f')]=[{'all':!![]}];}_0x266f67=_[_0x52b8('0x4b')]({},_0x266f67,_0x221a69['options']);return db[_0x52b8('0x38')][_0x52b8('0x54')](_0x266f67)[_0x52b8('0x2e')](handleEntityNotFound(_0x2c6520,null))[_0x52b8('0x2e')](respondWithResult(_0x2c6520,null))[_0x52b8('0x51')](handleError(_0x2c6520,null));};exports[_0x52b8('0x55')]=function(_0x2514b6,_0x426a10,_0xbf6e0e){return db[_0x52b8('0x38')][_0x52b8('0x54')]({'where':{'id':_0x2514b6[_0x52b8('0x53')]['id']},'attributes':[_0x52b8('0x34'),_0x52b8('0x9')],'raw':!![]})[_0x52b8('0x2e')](handleEntityNotFound(_0x426a10,null))['then'](function(_0x4fd6b4){if(_0x4fd6b4){var _0x11c749=path[_0x52b8('0x56')](config[_0x52b8('0x57')],_0x52b8('0x58'),util['format'](_0x52b8('0x59'),path[_0x52b8('0x5a')](_0x4fd6b4[_0x52b8('0x9')])));var _0x1c6d48=fs['createWriteStream'](_0x11c749);var _0x4c58fe=archiver(_0x52b8('0x5b'),{'zlib':{'level':0x9}});_0x4c58fe['on']('warning',function(_0x199ad7){if(_0x199ad7[_0x52b8('0x5c')]==='ENOENT'){logger[_0x52b8('0x32')](_0x199ad7);}else{throw new db[(_0x52b8('0x5d'))][(_0x52b8('0x5e'))](_0x52b8('0x5f'));}});_0x4c58fe['on'](_0x52b8('0x32'),function(_0x2fcdc4){throw new db[(_0x52b8('0x5d'))][(_0x52b8('0x5e'))](_0x52b8('0x5f'));});_0x4c58fe[_0x52b8('0x60')](_0x1c6d48);_0x4c58fe[_0x52b8('0x61')](_0x52b8('0x62'),{'cwd':path[_0x52b8('0x56')](config[_0x52b8('0x57')],_0x52b8('0x58'),path[_0x52b8('0x63')](_0x4fd6b4[_0x52b8('0x9')])),'ignore':[path['join'](path[_0x52b8('0x5a')](_0x4fd6b4[_0x52b8('0x9')]),'node_modules/**/*'),path[_0x52b8('0x56')](path[_0x52b8('0x5a')](_0x4fd6b4[_0x52b8('0x9')]),_0x52b8('0x64'))],'nodir':!![]})[_0x52b8('0x65')]();_0x1c6d48['on']('close',function(){if(!fs[_0x52b8('0x66')](_0x11c749)){throw new db[(_0x52b8('0x5d'))][(_0x52b8('0x5e'))](_0x52b8('0x67'));}return _0x426a10[_0x52b8('0x55')](_0x11c749,util[_0x52b8('0x68')](_0x52b8('0x59'),path[_0x52b8('0x5a')](_0x4fd6b4['path'])),function(_0x5adb93){if(_0x5adb93){throw new db[(_0x52b8('0x5d'))]['Error'](_0x52b8('0x69'));}fs[_0x52b8('0x6a')](_0x11c749);logger[_0x52b8('0x6b')](_0x52b8('0x6c'));logger[_0x52b8('0x6b')]('Temporary\x20file\x20removed');});});}return null;})[_0x52b8('0x51')](handleError(_0x426a10,null));};exports['upload']=function(_0x340736,_0x536a75,_0x44f49e){var _0x56ed4=path[_0x52b8('0x5a')](_0x340736[_0x52b8('0x6d')]['filename'],path['extname'](_0x340736[_0x52b8('0x6d')][_0x52b8('0x6e')]));var _0xc86c65=path['join'](config[_0x52b8('0x57')],_0x52b8('0x58'),_0x340736[_0x52b8('0x6d')][_0x52b8('0x6e')]);var _0x437901=path[_0x52b8('0x56')](config[_0x52b8('0x57')],'server/files/plugins',_0x56ed4);logger[_0x52b8('0x6b')](_0x52b8('0x6f'),_0xc86c65);logger[_0x52b8('0x6b')](_0x52b8('0x70'),_0x437901);try{fs['chmodSync'](_0xc86c65,parseInt('0777',0x8));extract(_0xc86c65,{'dir':_0x437901},function(_0x54859b){if(_0x54859b){logger['error'](_0x54859b);handleError(_0x54859b,!![]);};var _0x2123cd=fs[_0x52b8('0x71')](_0x437901);if(_0x2123cd[_0x52b8('0x43')]>0x1){removeReferences(_0xc86c65,_0x437901);logger[_0x52b8('0x32')](_0x52b8('0x72'));return _0x44f49e(new Error(_0x52b8('0x72')));}var _0x3a02df=fs[_0x52b8('0x73')](path['join'](_0x437901,_0x2123cd[0x0]));if(_0x3a02df['isFile']()){removeReferences(_0xc86c65,_0x437901);logger[_0x52b8('0x32')](_0x52b8('0x72'));return _0x44f49e(new Error(_0x52b8('0x72')));}if(_0x3a02df['isDirectory']()){var _0x16b276=fs['readdirSync'](path['join'](_0x437901,_0x2123cd[0x0]));if(_0x16b276[_0x52b8('0x43')]===0x0){removeReferences(_0xc86c65,_0x437901);logger[_0x52b8('0x32')]('Invalid\x20plugin\x20structure');return _0x44f49e(new Error('Invalid\x20plugin\x20structure'));}var _0x1dcca8=_0x16b276[_0x52b8('0x74')](function(_0x3e77ac){return _0x3e77ac===_0x52b8('0x75');});if(!_0x1dcca8){return _0x44f49e(new Error(_0x52b8('0x76')));}var _0x2f9313=fs[_0x52b8('0x77')](path[_0x52b8('0x56')](_0x437901,_0x2123cd[0x0],_0x52b8('0x75')));var _0x2fa532=JSON[_0x52b8('0x78')](_0x2f9313);if(_0x52b8('0x28')==typeof _0x2fa532[_0x52b8('0x34')]){return _0x44f49e(new Error(_0x52b8('0x79')));}if('undefined'==typeof _0x2fa532[_0x52b8('0x4c')]){return _0x44f49e(new Error(_0x52b8('0x7a')));}if(_0x52b8('0x28')==typeof _0x2fa532[_0x52b8('0x7b')]){return _0x44f49e(new Error(_0x52b8('0x7c')));}if(_0x52b8('0x28')==typeof _0x2fa532[_0x52b8('0x7d')]){return _0x44f49e(new Error(_0x52b8('0x7e')));}if(_0x2fa532['type']===_0x52b8('0x7f')){if(_0x52b8('0x28')==typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')]){return _0x44f49e(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x52b8('0x28')==typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')][_0x52b8('0x81')]&&'undefined'==typeof _0x2fa532['parameters'][_0x52b8('0x80')][_0x52b8('0x82')]){return _0x44f49e(new Error(_0x52b8('0x83')));}}else if(_0x2fa532['type']===_0x52b8('0x84')){if(_0x52b8('0x28')==typeof _0x2fa532['parameters'][_0x52b8('0x85')]){return _0x44f49e(new Error(_0x52b8('0x86')));}if('undefined'==typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x87')]){return _0x44f49e(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x44f49e(new Error(_0x52b8('0x88')));}var _0x457c8a=_0x2fa532[_0x52b8('0x34')];var _0x3641e3=_0x2fa532[_0x52b8('0x89')];var _0x8e9685=_0x2fa532[_0x52b8('0x4c')];var _0x298995=_0x2fa532[_0x52b8('0x8a')]?_0x2fa532[_0x52b8('0x8a')]:_0x52b8('0x8b');var _0x4196c1=_0x2fa532[_0x52b8('0x8c')]?_0x2fa532[_0x52b8('0x8c')]:_0x52b8('0x8d');var _0x51567d='';var _0x3dd457='';var _0x3ba005='';var _0x373dcc='';var _0x27e45b=_0x2fa532['version'];if(_0x8e9685===_0x52b8('0x7f')){if(_0x52b8('0x28')!=typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')][_0x52b8('0x81')]){var _0x3e266c=_0x2fa532[_0x52b8('0x7d')]['views'][_0x52b8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x52b8('0x8e')](_0x3e266c)){_0x51567d=path[_0x52b8('0x56')](_0x52b8('0x8f'),_0x56ed4,_0x2123cd[0x0],_0x3e266c);}else{_0x51567d=_0x3e266c;}}else{logger['info'](_0x52b8('0x90'));}if(_0x52b8('0x28')!=typeof _0x2fa532['parameters'][_0x52b8('0x80')][_0x52b8('0x82')]){var _0x57d1a3=_0x2fa532['parameters'][_0x52b8('0x80')][_0x52b8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x52b8('0x8e')](_0x57d1a3)){_0x3dd457=path['join'](_0x52b8('0x8f'),_0x56ed4,_0x2123cd[0x0],_0x57d1a3);}else{_0x3dd457=_0x57d1a3;}}else{logger['info'](_0x52b8('0x91'));}}else if(_0x8e9685===_0x52b8('0x84')){_0x3ba005=_0x2fa532[_0x52b8('0x7d')][_0x52b8('0x85')];_0x373dcc=_0x2fa532[_0x52b8('0x7d')]['scriptPath'];if(_0x52b8('0x28')!=typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')]){if('undefined'!=typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')]['admin']){var _0x3e266c=_0x2fa532[_0x52b8('0x7d')]['views'][_0x52b8('0x81')];if(!/^(f|ht)tps?:\/\//i[_0x52b8('0x8e')](_0x3e266c)){_0x51567d=path[_0x52b8('0x56')](_0x52b8('0x8f'),_0x56ed4,_0x2123cd[0x0],_0x3e266c);}else{_0x51567d=_0x3e266c;}}if(_0x52b8('0x28')!=typeof _0x2fa532[_0x52b8('0x7d')][_0x52b8('0x80')][_0x52b8('0x82')]){var _0x57d1a3=_0x2fa532[_0x52b8('0x7d')]['views'][_0x52b8('0x82')];if(!/^(f|ht)tps?:\/\//i[_0x52b8('0x8e')](_0x57d1a3)){_0x3dd457=path[_0x52b8('0x56')](_0x52b8('0x8f'),_0x56ed4,_0x2123cd[0x0],_0x57d1a3);}else{_0x3dd457=_0x57d1a3;}}}}var _0x3076d1={'name':_0x457c8a,'description':_0x3641e3,'path':path[_0x52b8('0x56')](_0x56ed4,_0x2123cd[0x0]),'type':_0x8e9685,'sidebar':_0x298995,'icon':_0x4196c1,'adminUrl':_0x51567d,'agentUrl':_0x3dd457,'scriptName':_0x3ba005,'scriptPath':_0x373dcc,'version':_0x27e45b};removeReferences(_0xc86c65,null);return db[_0x52b8('0x38')]['create'](_0x3076d1)[_0x52b8('0x2e')](function(_0x2b652f){var _0x345e45={'role':_0x340736[_0x52b8('0x92')][_0x52b8('0x93')],'userProfileId':_0x340736[_0x52b8('0x92')][_0x52b8('0x94')]};if(!_0x345e45)throw new Error(_0x52b8('0x95'));if(_0x345e45['role']===_0x52b8('0x96')){var _0x249f56=_0x2b652f[_0x52b8('0x97')]({'plain':!![]});return db[_0x52b8('0x98')][_0x52b8('0x54')]({'where':{'name':_0x52b8('0x30'),'userProfileId':_0x345e45[_0x52b8('0x94')]},'raw':!![]})[_0x52b8('0x2e')](function(_0x49824c){if(_0x49824c&&_0x49824c[_0x52b8('0x99')]===0x0){return db[_0x52b8('0x31')][_0x52b8('0x9a')]({'name':_0x249f56[_0x52b8('0x34')],'resourceId':_0x249f56['id'],'type':_0x49824c[_0x52b8('0x34')],'sectionId':_0x49824c['id']},{})[_0x52b8('0x2e')](function(){return _0x2b652f;});}else{return _0x2b652f;}})[_0x52b8('0x51')](function(_0x1b6665){logger['error'](_0x52b8('0x9b'),_0x1b6665);throw _0x1b6665;});}return _0x2b652f;})[_0x52b8('0x2e')](respondWithResult(_0x536a75,null))[_0x52b8('0x51')](handleError(_0x536a75,null));}});}catch(_0x1ec499){_0x536a75[_0x52b8('0x24')](0x1f4)[_0x52b8('0x35')](_0x1ec499);}};function removeReferences(_0x510718,_0x5a2c1d){try{if(_0x510718){fs[_0x52b8('0x6a')](_0x510718);logger[_0x52b8('0x6b')]('Zip\x20archive\x20removed');}if(_0x5a2c1d){rimraf(_0x5a2c1d,function(){});logger[_0x52b8('0x6b')](_0x52b8('0x9c'));}}catch(_0x38aab3){logger[_0x52b8('0x32')](_0x38aab3);}}exports[_0x52b8('0x2d')]=function(_0x3a91e5,_0x30fbcd,_0x206a16){return db[_0x52b8('0x38')][_0x52b8('0x54')]({'where':{'id':_0x3a91e5[_0x52b8('0x53')]['id']}})[_0x52b8('0x2e')](handleEntityNotFound(_0x30fbcd,null))['then'](saveUpdates(_0x3a91e5[_0x52b8('0x92')],null))[_0x52b8('0x2e')](respondWithResult(_0x30fbcd,null))[_0x52b8('0x51')](handleError(_0x30fbcd,null));};exports[_0x52b8('0x9d')]=function(_0x3af08d,_0x37b807,_0x68d146){return db[_0x52b8('0x38')][_0x52b8('0x54')]({'where':{'id':_0x3af08d[_0x52b8('0x53')]['id']}})[_0x52b8('0x2e')](function(_0x22e72f){if(_0x22e72f){return _0x22e72f[_0x52b8('0x2f')]();}})['then'](function(_0x5e9abb){rimraf(path[_0x52b8('0x56')](config[_0x52b8('0x57')],'server/files/plugins',path[_0x52b8('0x63')](_0x5e9abb['path'])),function(){});return _0x5e9abb;})[_0x52b8('0x2e')](handleEntityNotFound(_0x37b807,null))[_0x52b8('0x2e')](respondWithStatusCode(_0x37b807,null))[_0x52b8('0x51')](handleError(_0x37b807,null));};exports[_0x52b8('0x9e')]=function(_0x289e16,_0x253cfd,_0x2d9b70){return BPromise['resolve']()['then'](function(){if(!_0x289e16[_0x52b8('0x3d')][_0x52b8('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x289e16['query'][_0x52b8('0x9f')]){throw new Error(_0x52b8('0xa0'));}var _0x541ba4=_0x289e16[_0x52b8('0x3d')][_0x52b8('0xa1')]?_0x289e16[_0x52b8('0x3d')][_0x52b8('0xa1')]+':'+_0x289e16['query']['port']:_0x52b8('0xa2')+_0x289e16[_0x52b8('0x3d')][_0x52b8('0x9f')];var _0xea6eb6=_0x289e16[_0x52b8('0x3d')][_0x52b8('0x26')]?_0x289e16['query']['json']:!![];var _0x3987a6=_0x289e16['query'][_0x52b8('0xa3')]?_0x289e16['query'][_0x52b8('0xa3')]:null;var _0x443cb0={'method':_0x289e16['method'],'uri':util['format'](_0x52b8('0xa4'),_0x541ba4,_0x289e16[_0x52b8('0x3d')]['path']),'json':_0xea6eb6,'resolveWithFullResponse':!![],'encoding':_0x3987a6,'qs':_0x289e16[_0x52b8('0x3d')]};if(_0x289e16[_0x52b8('0xa5')]){_0x443cb0[_0x52b8('0xa5')]=_0x289e16[_0x52b8('0xa5')];if(_0x443cb0[_0x52b8('0xa5')]['content-length']){delete _0x443cb0[_0x52b8('0xa5')]['content-length'];}}if(_0x443cb0['headers'][_0x52b8('0xa6')]){delete _0x443cb0[_0x52b8('0xa5')]['content-type'];}return rp(_0x443cb0);})['then'](function(_0x387db1){if(_0x387db1){_0x253cfd['set'](_0x387db1[_0x52b8('0xa5')]);logger[_0x52b8('0x6b')](_0x387db1[_0x52b8('0x92')]);if(_[_0x52b8('0xa7')](_0x289e16['query'][_0x52b8('0x9')],'download')&&_0x387db1['statusCode']==0x1f4){return _0x253cfd['sendStatus'](_0x387db1[_0x52b8('0xa8')]);}else{return _0x253cfd[_0x52b8('0x24')](_0x387db1[_0x52b8('0xa8')])[_0x52b8('0x35')](_0x387db1[_0x52b8('0x92')]);}}else{return _0x253cfd[_0x52b8('0xa9')](0xc8);}})[_0x52b8('0x51')](handleError(_0x253cfd,null));};exports['webhookPost']=function(_0x43dd7e,_0x15a436,_0x37605a){return BPromise[_0x52b8('0xaa')]()[_0x52b8('0x2e')](function(){if(!_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0x9')]){throw new Error(_0x52b8('0xab'));}if(!_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0x9f')]){throw new Error(_0x52b8('0xa0'));}var _0x501080=_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0xa1')]?_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0xa1')]+':'+_0x43dd7e[_0x52b8('0x3d')]['port']:_0x52b8('0xa2')+_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0x9f')];var _0x1275d9=_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0x26')]?_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0x26')]:!![];var _0x4aa425=_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0xa3')]?_0x43dd7e[_0x52b8('0x3d')][_0x52b8('0xa3')]:null;var _0x5d781b={'method':_0x43dd7e[_0x52b8('0xac')],'uri':util['format'](_0x52b8('0xa4'),_0x501080,_0x43dd7e['query'][_0x52b8('0x9')]),'json':_0x1275d9,'resolveWithFullResponse':!![],'encoding':_0x4aa425,'body':_0x43dd7e[_0x52b8('0x92')]};if(_0x43dd7e[_0x52b8('0xa5')]){_0x5d781b[_0x52b8('0xa5')]=_0x43dd7e[_0x52b8('0xa5')];if(_0x5d781b[_0x52b8('0xa5')][_0x52b8('0xad')]){delete _0x5d781b['headers'][_0x52b8('0xad')];}}if(_0x5d781b[_0x52b8('0xa5')][_0x52b8('0xa6')]){delete _0x5d781b['headers']['content-type'];}return rp(_0x5d781b);})[_0x52b8('0x2e')](function(_0x14fb42){if(_0x14fb42){_0x15a436['set'](_0x14fb42[_0x52b8('0xa5')]);logger[_0x52b8('0x6b')](_0x14fb42[_0x52b8('0x92')]);return _0x15a436[_0x52b8('0x24')](_0x14fb42['statusCode'])[_0x52b8('0x35')](_0x14fb42[_0x52b8('0x92')]);}else{return _0x15a436[_0x52b8('0xa9')](0xc8);}})[_0x52b8('0x51')](handleError(_0x15a436,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index db97a99..f729a11 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 _0xdbf5=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x3ce2c4,_0x4544c1){var _0x4047c1=function(_0x3fece6){while(--_0x3fece6){_0x3ce2c4['push'](_0x3ce2c4['shift']());}};_0x4047c1(++_0x4544c1);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x371d4c,_0x2ea526){_0x371d4c=_0x371d4c-0x0;var _0x5a0c75=_0xdbf5[_0x371d4c];return _0x5a0c75;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x5dbf('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5dbf('0x1'),'afterUpdate':_0x5dbf('0x2'),'afterDestroy':_0x5dbf('0x3')};function emitEvent(_0x3afe14){return function(_0x38b629,_0x1a1ea9,_0x776036){PluginEvents[_0x5dbf('0x4')](_0x3afe14+':'+_0x38b629['id'],_0x38b629);PluginEvents[_0x5dbf('0x4')](_0x3afe14,_0x38b629);_0x776036(null);};}for(var e in events){if(events[_0x5dbf('0x5')](e)){var event=events[e];Plugin[_0x5dbf('0x6')](e,emitEvent(event));}}module[_0x5dbf('0x7')]=PluginEvents; \ No newline at end of file +var _0x510e=['Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x510e,0x1ed));var _0xe510=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x510e[_0x68c979];return _0x4f0001;};'use strict';var EventEmitter=require(_0xe510('0x0'));var Plugin=require(_0xe510('0x1'))['db'][_0xe510('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe510('0x3')](0x0);var events={'afterCreate':_0xe510('0x4'),'afterUpdate':_0xe510('0x5'),'afterDestroy':_0xe510('0x6')};function emitEvent(_0x2a9a5b){return function(_0x3cd0a5,_0x4dd477,_0x1953ba){PluginEvents[_0xe510('0x7')](_0x2a9a5b+':'+_0x3cd0a5['id'],_0x3cd0a5);PluginEvents[_0xe510('0x7')](_0x2a9a5b,_0x3cd0a5);_0x1953ba(null);};}for(var e in events){if(events[_0xe510('0x8')](e)){var event=events[e];Plugin[_0xe510('0x9')](e,emitEvent(event));}}module[_0xe510('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 a1e0227..86e68b4 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 _0x713d=['define','Plugin','plugins','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x6071bc,_0x47c7f5){var _0x895cc0=function(_0x550f07){while(--_0x550f07){_0x6071bc['push'](_0x6071bc['shift']());}};_0x895cc0(++_0x47c7f5);}(_0x713d,0x16f));var _0xd713=function(_0x1d28d8,_0x22c610){_0x1d28d8=_0x1d28d8-0x0;var _0x1d75bf=_0x713d[_0x1d28d8];return _0x1d75bf;};'use strict';var _=require('lodash');var util=require(_0xd713('0x0'));var logger=require(_0xd713('0x1'))(_0xd713('0x2'));var moment=require(_0xd713('0x3'));var BPromise=require(_0xd713('0x4'));var rp=require(_0xd713('0x5'));var fs=require('fs');var path=require(_0xd713('0x6'));var rimraf=require(_0xd713('0x7'));var config=require(_0xd713('0x8'));var attributes=require(_0xd713('0x9'));module[_0xd713('0xa')]=function(_0x4fabea,_0x5a5f84){return _0x4fabea[_0xd713('0xb')](_0xd713('0xc'),attributes,{'tableName':_0xd713('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9054=['define','Plugin','../../config/logger','api','moment','bluebird','request-promise','rimraf','./plugin.attributes'];(function(_0x2192b3,_0x32cad8){var _0x13313a=function(_0x34bbf7){while(--_0x34bbf7){_0x2192b3['push'](_0x2192b3['shift']());}};_0x13313a(++_0x32cad8);}(_0x9054,0x197));var _0x4905=function(_0x293b66,_0x2eff6a){_0x293b66=_0x293b66-0x0;var _0x2c404d=_0x9054[_0x293b66];return _0x2c404d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4905('0x0'))(_0x4905('0x1'));var moment=require(_0x4905('0x2'));var BPromise=require(_0x4905('0x3'));var rp=require(_0x4905('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4905('0x5'));var config=require('../../config/environment');var attributes=require(_0x4905('0x6'));module['exports']=function(_0x1c35ee,_0x2b91d7){return _0x1c35ee[_0x4905('0x7')](_0x4905('0x8'),attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 9f8a85a..cb66617 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 _0x9175=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','body','lodash','util','moment','bluebird','randomstring'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x9175,0x1ad));var _0x5917=function(_0x553b91,_0x3aadea){_0x553b91=_0x553b91-0x0;var _0x2ce0f5=_0x9175[_0x553b91];return _0x2ce0f5;};'use strict';var _=require(_0x5917('0x0'));var util=require(_0x5917('0x1'));var moment=require(_0x5917('0x2'));var BPromise=require(_0x5917('0x3'));var rs=require(_0x5917('0x4'));var fs=require('fs');var Redis=require(_0x5917('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5917('0x6'))(_0x5917('0x7'));var config=require(_0x5917('0x8'));var jayson=require(_0x5917('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x5917('0xa')]=_[_0x5917('0xb')](config[_0x5917('0xa')],{'host':_0x5917('0xc'),'port':0x18eb});var socket=require(_0x5917('0xd'))(new Redis(config['redis']));require(_0x5917('0xe'))[_0x5917('0xf')](socket);function respondWithRpcPromise(_0x385467,_0x149f32,_0x3c82ad){return new BPromise(function(_0x45b376,_0x446f21){return client[_0x5917('0x10')](_0x385467,_0x3c82ad)[_0x5917('0x11')](function(_0x5413c6){logger[_0x5917('0x12')](_0x5917('0x13'),_0x149f32,_0x5917('0x14'));logger[_0x5917('0x15')](_0x5917('0x16'),_0x149f32,_0x5917('0x14'),JSON[_0x5917('0x17')](_0x5413c6));if(_0x5413c6[_0x5917('0x18')]){if(_0x5413c6[_0x5917('0x18')][_0x5917('0x19')]===0x1f4){logger[_0x5917('0x18')]('Plugin,\x20%s,\x20%s',_0x149f32,_0x5413c6[_0x5917('0x18')]['message']);return _0x446f21(_0x5413c6[_0x5917('0x18')]['message']);}logger[_0x5917('0x18')](_0x5917('0x13'),_0x149f32,_0x5413c6[_0x5917('0x18')][_0x5917('0x1a')]);return _0x45b376(_0x5413c6[_0x5917('0x18')][_0x5917('0x1a')]);}else{logger[_0x5917('0x12')]('Plugin,\x20%s,\x20%s',_0x149f32,_0x5917('0x14'));_0x45b376(_0x5413c6[_0x5917('0x1b')]['message']);}})[_0x5917('0x1c')](function(_0x3490d4){logger[_0x5917('0x18')](_0x5917('0x13'),_0x149f32,_0x3490d4);_0x446f21(_0x3490d4);});});}exports[_0x5917('0x1d')]=function(_0x21dcc1){var _0x5f0eb9=this;return new Promise(function(_0x5b7123,_0xac8f8e){return db['Plugin']['create'](_0x21dcc1[_0x5917('0x1e')],{'raw':_0x21dcc1['options']?_0x21dcc1['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0xb1b9ab){logger['info'](_0x5917('0x1d'),_0x21dcc1);logger[_0x5917('0x15')](_0x5917('0x1d'),_0x21dcc1,JSON[_0x5917('0x17')](_0xb1b9ab));_0x5b7123(_0xb1b9ab);})[_0x5917('0x1c')](function(_0x212434){logger['error'](_0x5917('0x1d'),_0x212434['message'],_0x21dcc1);_0xac8f8e(_0x5f0eb9[_0x5917('0x18')](0x1f4,_0x212434[_0x5917('0x1a')]));});});}; \ No newline at end of file +var _0xa42e=['create','body','options','stringify','lodash','moment','bluebird','../../config/utils','rpc','../../config/environment','client','defaults','socket.io-emitter','redis','./plugin.socket','register','then','info','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','error','Plugin,\x20%s,\x20%s','message','catch','CreatePlugin','Plugin'];(function(_0x45ddfb,_0x233aa1){var _0xf4bcd2=function(_0x2e0667){while(--_0x2e0667){_0x45ddfb['push'](_0x45ddfb['shift']());}};_0xf4bcd2(++_0x233aa1);}(_0xa42e,0xba));var _0xea42=function(_0xdb78b4,_0x47c871){_0xdb78b4=_0xdb78b4-0x0;var _0x32df72=_0xa42e[_0xdb78b4];return _0x32df72;};'use strict';var _=require(_0xea42('0x0'));var util=require('util');var moment=require(_0xea42('0x1'));var BPromise=require(_0xea42('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xea42('0x3'));var logger=require('../../config/logger')(_0xea42('0x4'));var config=require(_0xea42('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xea42('0x6')]['http']({'port':0x232a});config['redis']=_[_0xea42('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xea42('0x8'))(new Redis(config[_0xea42('0x9')]));require(_0xea42('0xa'))[_0xea42('0xb')](socket);function respondWithRpcPromise(_0x3720be,_0x52afe9,_0x445901){return new BPromise(function(_0x34fec0,_0x1c3ff2){return client['request'](_0x3720be,_0x445901)[_0xea42('0xc')](function(_0x3383c9){logger[_0xea42('0xd')]('Plugin,\x20%s,\x20%s',_0x52afe9,_0xea42('0xe'));logger['debug'](_0xea42('0xf'),_0x52afe9,'request\x20sent',JSON['stringify'](_0x3383c9));if(_0x3383c9['error']){if(_0x3383c9[_0xea42('0x10')]['code']===0x1f4){logger['error'](_0xea42('0x11'),_0x52afe9,_0x3383c9[_0xea42('0x10')][_0xea42('0x12')]);return _0x1c3ff2(_0x3383c9[_0xea42('0x10')][_0xea42('0x12')]);}logger['error'](_0xea42('0x11'),_0x52afe9,_0x3383c9[_0xea42('0x10')]['message']);return _0x34fec0(_0x3383c9[_0xea42('0x10')][_0xea42('0x12')]);}else{logger[_0xea42('0xd')]('Plugin,\x20%s,\x20%s',_0x52afe9,_0xea42('0xe'));_0x34fec0(_0x3383c9['result'][_0xea42('0x12')]);}})[_0xea42('0x13')](function(_0x4087a2){logger[_0xea42('0x10')](_0xea42('0x11'),_0x52afe9,_0x4087a2);_0x1c3ff2(_0x4087a2);});});}exports[_0xea42('0x14')]=function(_0x142609){var _0x3ae084=this;return new Promise(function(_0x1debc1,_0xd9d429){return db[_0xea42('0x15')][_0xea42('0x16')](_0x142609[_0xea42('0x17')],{'raw':_0x142609['options']?_0x142609[_0xea42('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xea42('0xc')](function(_0x2462fe){logger[_0xea42('0xd')]('CreatePlugin',_0x142609);logger['debug'](_0xea42('0x14'),_0x142609,JSON[_0xea42('0x19')](_0x2462fe));_0x1debc1(_0x2462fe);})['catch'](function(_0x5370b5){logger[_0xea42('0x10')]('CreatePlugin',_0x5370b5[_0xea42('0x12')],_0x142609);_0xd9d429(_0x3ae084[_0xea42('0x10')](0x1f4,_0x5370b5['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index c935f46..a6c7222 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 _0x5a17=['remove','update','emit','removeListener','register','./plugin.events','save'];(function(_0x2fb11f,_0x9ee5c){var _0x25e686=function(_0xd49629){while(--_0xd49629){_0x2fb11f['push'](_0x2fb11f['shift']());}};_0x25e686(++_0x9ee5c);}(_0x5a17,0x6e));var _0x75a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5a17[_0x3dd15e];return _0x231fd0;};'use strict';var PluginEvents=require(_0x75a1('0x0'));var events=[_0x75a1('0x1'),_0x75a1('0x2'),_0x75a1('0x3')];function createListener(_0x49928c,_0x202a91){return function(_0x10f8cb){_0x202a91[_0x75a1('0x4')](_0x49928c,_0x10f8cb);};}function removeListener(_0x39b83a,_0x30bd18){return function(){PluginEvents[_0x75a1('0x5')](_0x39b83a,_0x30bd18);};}exports[_0x75a1('0x6')]=function(_0x92c841){for(var _0x405276=0x0,_0x45bda7=events['length'];_0x405276<_0x45bda7;_0x405276++){var _0x1291e6=events[_0x405276];var _0x331620=createListener('plugin:'+_0x1291e6,_0x92c841);PluginEvents['on'](_0x1291e6,_0x331620);}}; \ No newline at end of file +var _0xa377=['emit','removeListener','plugin:','save','remove','update'];(function(_0x55d829,_0x43f06c){var _0x52163b=function(_0x493cd8){while(--_0x493cd8){_0x55d829['push'](_0x55d829['shift']());}};_0x52163b(++_0x43f06c);}(_0xa377,0xd5));var _0x7a37=function(_0x44dd11,_0x17b4fa){_0x44dd11=_0x44dd11-0x0;var _0x11ba0d=_0xa377[_0x44dd11];return _0x11ba0d;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x7a37('0x0'),_0x7a37('0x1'),_0x7a37('0x2')];function createListener(_0x311a16,_0x4e9caa){return function(_0x59f4c8){_0x4e9caa[_0x7a37('0x3')](_0x311a16,_0x59f4c8);};}function removeListener(_0x2ecf09,_0xb4f4ab){return function(){PluginEvents[_0x7a37('0x4')](_0x2ecf09,_0xb4f4ab);};}exports['register']=function(_0x22a212){for(var _0x3f10e9=0x0,_0x411f35=events['length'];_0x3f10e9<_0x411f35;_0x3f10e9++){var _0x5ad410=events[_0x3f10e9];var _0x132253=createListener(_0x7a37('0x5')+_0x5ad410,_0x22a212);PluginEvents['on'](_0x5ad410,_0x132253);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cd9b226..05048d7 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(_0x5d32ea,_0x2a9b4e){var _0x5de719=function(_0x559463){while(--_0x559463){_0x5d32ea['push'](_0x5d32ea['shift']());}};_0x5de719(++_0x2a9b4e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'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(_0x250e1b,_0x353641){var _0x4e1dec=function(_0x555a3f){while(--_0x555a3f){_0x250e1b['push'](_0x250e1b['shift']());}};_0x4e1dec(++_0x353641);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 ab2c86e..92f3cd9 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 _0xa902=['then','catch','show','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','status','update','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','sendStatus','json','error','stack','name','send','npm\x20install','info','list','reject','express','motion2','length'];(function(_0x4937c3,_0x18ce66){var _0x43d33a=function(_0x12d29e){while(--_0x12d29e){_0x4937c3['push'](_0x4937c3['shift']());}};_0x43d33a(++_0x18ce66);}(_0xa902,0x8d));var _0x2a90=function(_0x120647,_0x5ab0d0){_0x120647=_0x120647-0x0;var _0x3f7cba=_0xa902[_0x120647];return _0x3f7cba;};'use strict';var _=require(_0x2a90('0x0'));var pm2=require(_0x2a90('0x1'));var logger=require(_0x2a90('0x2'))(_0x2a90('0x3'));var path=require(_0x2a90('0x4'));var exec=require('child_process')[_0x2a90('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x4961c2,_0x169808){return function(_0x2b40c0){if(!_0x2b40c0){_0x4961c2[_0x2a90('0x6')](0x194);;}return _0x2b40c0;};}function respondWithResult(_0x21e1d2,_0x4a32c7){_0x4a32c7=_0x4a32c7||0xc8;return function(_0x25bcfc){if(_0x25bcfc){return _0x21e1d2['status'](_0x4a32c7)[_0x2a90('0x7')](_0x25bcfc);}return null;};}function handleError(_0x570659,_0x5ec2b9){_0x5ec2b9=_0x5ec2b9||0x1f4;return function(_0xc75b6e){logger[_0x2a90('0x8')](_0xc75b6e[_0x2a90('0x9')]);if(_0xc75b6e[_0x2a90('0xa')]){delete _0xc75b6e[_0x2a90('0xa')];}_0x570659['status'](_0x5ec2b9)[_0x2a90('0xb')](_0xc75b6e);};}function execChildProcess(){return new BPromise(function(_0x3dadc2,_0x43c56d){exec(_0x2a90('0xc'),function(_0x541e22,_0x40e6aa,_0x52391c){logger[_0x2a90('0xd')](_0x40e6aa);logger['info'](_0x52391c);if(_0x541e22){logger[_0x2a90('0x8')](_0x541e22);return _0x43c56d(_0x541e22);}return _0x3dadc2(_0x40e6aa);});});}exports['index']=function(_0x407ce5,_0x30e166){return pm2[_0x2a90('0xe')]()['then'](function(_0x56d1b8){if(_0x56d1b8){var _0x57227c=_[_0x2a90('0xf')](_0x56d1b8,function(_0x3a42df){return _0x3a42df['name']===_0x2a90('0x10')||_0x3a42df[_0x2a90('0xa')]===_0x2a90('0x11');});return{'rows':_0x57227c,'count':_0x57227c[_0x2a90('0x12')]};}return null;})[_0x2a90('0x13')](respondWithResult(_0x30e166,null))[_0x2a90('0x14')](handleError(_0x30e166,null));};exports[_0x2a90('0x15')]=function(_0x10cf94,_0x43eea5){return pm2['describe'](_0x10cf94[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](respondWithResult(_0x43eea5,null))[_0x2a90('0x13')](handleEntityNotFound(_0x43eea5,null))['catch'](handleError(_0x43eea5,null));};exports[_0x2a90('0x17')]=function(_0x1f51a6,_0x148d18){if(_0x1f51a6[_0x2a90('0x18')][_0x2a90('0xa')]&&_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]){var _0x114d42=path[_0x2a90('0x1a')](__dirname,_0x2a90('0x1b'),_0x1f51a6[_0x2a90('0x18')][_0x2a90('0x19')]);var _0x4fdd62=process[_0x2a90('0x1c')]();process[_0x2a90('0x1d')](path[_0x2a90('0x1e')](_0x114d42));return execChildProcess()[_0x2a90('0x13')](function(_0x5912fd){process[_0x2a90('0x1d')](_0x4fdd62);return pm2[_0x2a90('0x1f')]({'name':_0x1f51a6['body'][_0x2a90('0xa')],'script':_0x114d42});})[_0x2a90('0x13')](function(_0x10a6dd){pm2[_0x2a90('0x20')]();return _0x10a6dd[0x0];})[_0x2a90('0x13')](respondWithResult(_0x148d18,0xc9))[_0x2a90('0x14')](handleError(_0x148d18,null));}else{return _0x148d18[_0x2a90('0x21')](0x1f4)[_0x2a90('0xb')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x2a90('0x22')]=function(_0x17f978,_0x3934d4){if(_0x17f978[_0x2a90('0x18')]['id']){delete _0x17f978[_0x2a90('0x18')]['id'];}var _0x5208d8={'online':'restart','stopped':_0x2a90('0x23')};if(_0x5208d8['hasOwnProperty'](_0x17f978['body']['status'])){return pm2[_0x5208d8[_0x17f978[_0x2a90('0x18')][_0x2a90('0x21')]]](_0x17f978['params']['id'])['then'](respondWithResult(_0x3934d4,0xc8))[_0x2a90('0x14')](handleError(_0x3934d4,null));}else{return _0x3934d4['status'](0x1f4)[_0x2a90('0xb')]({'message':_0x2a90('0x24')});}};exports[_0x2a90('0x25')]=function(_0x27b6b6,_0xf18d11){if(_0x27b6b6[_0x2a90('0x18')]['id']){delete _0x27b6b6[_0x2a90('0x18')]['id'];}if(_0x27b6b6['params']['id']){return pm2[_0x2a90('0x26')](_0x27b6b6[_0x2a90('0x16')]['id'])[_0x2a90('0x13')](function(_0x5cdeb4){pm2[_0x2a90('0x20')]();return _0x5cdeb4[0x0];})[_0x2a90('0x13')](respondWithResult(_0xf18d11,null))[_0x2a90('0x14')](handleError(_0xf18d11,null));}else{return _0xf18d11[_0x2a90('0x21')](0x1f4)['send']({'message':_0x2a90('0x27')});}}; \ No newline at end of file +var _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x41bb,0xc5));var _0xb41b=function(_0xf0b6c4,_0xef08ea){_0xf0b6c4=_0xf0b6c4-0x0;var _0x2da320=_0x41bb[_0xf0b6c4];return _0x2da320;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 9062885..e71ad77 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 _0x1176=['isAuthenticated','getAgents','/queues','exports','express','Router','../../components/auth/service','./realtime.controller','get','/agents'];(function(_0x5e3114,_0x133436){var _0x2ef59c=function(_0x109194){while(--_0x109194){_0x5e3114['push'](_0x5e3114['shift']());}};_0x2ef59c(++_0x133436);}(_0x1176,0xa4));var _0x6117=function(_0x2e2209,_0x1dd0e4){_0x2e2209=_0x2e2209-0x0;var _0x19c236=_0x1176[_0x2e2209];return _0x19c236;};'use strict';var express=require(_0x6117('0x0'));var router=express[_0x6117('0x1')]();var auth=require(_0x6117('0x2'));var controller=require(_0x6117('0x3'));router[_0x6117('0x4')](_0x6117('0x5'),auth[_0x6117('0x6')](),controller[_0x6117('0x7')]);router[_0x6117('0x4')](_0x6117('0x8'),auth[_0x6117('0x6')](),controller['getQueues']);module[_0x6117('0x9')]=router; \ No newline at end of file +var _0x13df=['./realtime.controller','get','/agents','isAuthenticated','/queues','exports','express','Router'];(function(_0x4f5bcb,_0x59f765){var _0x58dd3e=function(_0xbcca19){while(--_0xbcca19){_0x4f5bcb['push'](_0x4f5bcb['shift']());}};_0x58dd3e(++_0x59f765);}(_0x13df,0x86));var _0xf13d=function(_0x5b60e1,_0x231f8d){_0x5b60e1=_0x5b60e1-0x0;var _0x1f34b2=_0x13df[_0x5b60e1];return _0x1f34b2;};'use strict';var express=require(_0xf13d('0x0'));var router=express[_0xf13d('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xf13d('0x2'));router[_0xf13d('0x3')](_0xf13d('0x4'),auth[_0xf13d('0x5')](),controller['getAgents']);router[_0xf13d('0x3')](_0xf13d('0x6'),auth[_0xf13d('0x5')](),controller['getQueues']);module[_0xf13d('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 4e03a09..c8e25b7 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x5ea36f,_0x5f5cc0){var _0x3fa6ba=function(_0x3d7231){while(--_0x3d7231){_0x5ea36f['push'](_0x5ea36f['shift']());}};_0x3fa6ba(++_0x5f5cc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file +var _0xa9e0=['pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','*pause','Pause','merge','user','userProfileId','Agents','extraQueryConditions','assign','getResources','findAndCountAll','filterAgentAttributes','voice','talking','voiceStatus','Status','sortAgentsByStatus','pick','catch','getQueues','startCase','Queue','name','outbound','Queues','filter','UserProfile','lodash','util','../../components/realtime/agents','../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','undefined','count','limit','json','getAgents','getChannels','query','globalStatusFilter','pauseTypeFilter'];(function(_0x7ca935,_0x5c96f9){var _0x493e5b=function(_0x3c411d){while(--_0x3c411d){_0x7ca935['push'](_0x7ca935['shift']());}};_0x493e5b(++_0x5c96f9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var rta=require(_0x0a9e('0x2'));var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0a9e('0x4'))[_0x0a9e('0x5')];var APIHandleError=require(_0x0a9e('0x4'))[_0x0a9e('0x6')];function respondWithFilteredResult(_0x981158,_0x57b080){return function(_0x219af0){if(_0x219af0){var _0x441e3a=typeof _0x57b080[_0x0a9e('0x7')]==='undefined'&&typeof _0x57b080['limit']===_0x0a9e('0x8');var _0x56465b=_0x219af0['count'];var _0x39753a=_0x441e3a?0x0:_0x57b080[_0x0a9e('0x7')];var _0x307b3e=_0x441e3a?_0x219af0[_0x0a9e('0x9')]:_0x57b080[_0x0a9e('0x7')]+_0x57b080[_0x0a9e('0xa')];var _0x4a4c56;if(_0x307b3e>=_0x56465b){_0x307b3e=_0x56465b;_0x4a4c56=0xc8;}else{_0x4a4c56=0xce;}_0x981158['status'](_0x4a4c56);return _0x981158['set']('Content-Range',_0x39753a+'-'+_0x307b3e+'/'+_0x56465b)[_0x0a9e('0xb')](_0x219af0);}return null;};}exports[_0x0a9e('0xc')]=function(_0xd5b662,_0x26d672){var _0x32d742={'count':0x0,'rows':[]};var _0x69aeb7={};var _0x5db4b0;var _0x4283ce=utils[_0x0a9e('0xd')]();var _0x2b4227;var _0x281129;var _0x44dcfd=_0xd5b662[_0x0a9e('0xe')]['globalQueueFilter'];var _0x22dccb=_0xd5b662['query'][_0x0a9e('0xf')];var _0x519dfd=_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x10')];var _0x48f32d=_0x22dccb===_0x0a9e('0x11')||_0x22dccb==='*pause'?!![]:![];var _0x459eb1=[];var _0x478723;var _0x106033;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util[_0x0a9e('0x16')](_0x0a9e('0x17'),_0xd5b662['query'][_0x0a9e('0x14')]));}_0x5db4b0=_0xd5b662[_0x0a9e('0xe')]['channel'][_0x0a9e('0x18')]();}if(!_0xd5b662['query']['sort']||!_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')][_0x0a9e('0x1a')](_0x0a9e('0x1b'))){_0xd5b662['query'][_0x0a9e('0x19')]=rta[_0x0a9e('0x1c')](_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x19')]);return;}var _0x370d86=rta[_0x0a9e('0x1d')](_0xd5b662[_0x0a9e('0xe')]['sort']);_0xd5b662['query'][_0x0a9e('0x19')]=_0x370d86[_0x0a9e('0x1e')][_0x0a9e('0x1f')](',');_0x478723=_0x370d86[_0x0a9e('0x20')];})['then'](function(){if(!_0x44dcfd){return[];}return rta[_0x0a9e('0x21')](_0x44dcfd,_0x5db4b0);})['then'](function(_0x45a1e7){_0x459eb1=_0x45a1e7;return rta['getRealtimeAgents']();})[_0x0a9e('0x13')](function(_0x34dc65){_0x281129=_0x34dc65[_0x0a9e('0x22')];if((!_0x22dccb||_0x48f32d)&&!_0x478723){return _0x459eb1;}if(_0x478723&&!_0x22dccb){return rta[_0x0a9e('0x23')](_0x281129,_0x459eb1,_0x478723);}else{return rta[_0x0a9e('0x24')](_0x281129,_0x459eb1,_0x22dccb);}})[_0x0a9e('0x13')](function(_0x11c3b6){_0x459eb1=_0x11c3b6;var _0x14de77=![];if(_0x459eb1['length']===0x0){if(_0x44dcfd||_0x22dccb){_0x14de77=!![];}if(_0x48f32d){_0x14de77=![];}}if(_0x14de77){return _0x32d742;}var _0x3652a7=_[_0x0a9e('0x25')](db[_0x0a9e('0x26')][_0x0a9e('0x27')],function(_0x5c877d){return{'name':_0x5c877d[_0x0a9e('0x28')],'type':_0x5c877d[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x2b')]=_0x0a9e('0x2c');_0x69aeb7=qs[_0x0a9e('0x2d')](_0x3652a7,_0xd5b662);_0x69aeb7[_0x0a9e('0x2e')]=!![];var _0x1dbde2=[];if(_0x459eb1['length']>0x0){_0x1dbde2[_0x0a9e('0x2f')]({'id':{'$in':_0x459eb1}});if(_0x478723&&!_0x22dccb){_0x106033=[db['sequelize'][_0x0a9e('0x30')](_0x0a9e('0x31')+_0x459eb1+')')];_0x69aeb7[_0x0a9e('0x20')]=_0x106033;}}if(_0x48f32d){_0x4283ce[_0x0a9e('0x32')](function(_0x25ce3a){var _0x5180f1=!![];if(_0x22dccb===_0x0a9e('0x33')&&_0x5db4b0!==_0x25ce3a){_0x5180f1=![];}_0x1dbde2[_0x0a9e('0x2f')]({[_0x25ce3a+_0x0a9e('0x34')]:_0x5180f1});});if(_0x519dfd){_0x1dbde2[_0x0a9e('0x2f')]({'pauseType':_0x519dfd});}}else if(_0x22dccb){_0x4283ce[_0x0a9e('0x32')](function(_0x409319){_0x1dbde2[_0x0a9e('0x2f')]({[_0x409319+_0x0a9e('0x34')]:![]});});}_0x69aeb7['where']=_[_0x0a9e('0x35')](_0x69aeb7['where'],{'$and':_0x1dbde2});if(_0xd5b662[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x3f3d41={'params':{'id':_0xd5b662['user'][_0x0a9e('0x37')]},'query':{'section':_0x0a9e('0x38'),'role':_0x0a9e('0x2c'),'online':_0xd5b662[_0x0a9e('0xe')]['online']===!![]?!![]:![],'raw':!![],'ids':_0x459eb1,'customSorting':_0x106033}};if(_0x48f32d){_0x3f3d41['query'][_0x0a9e('0x39')]=_0x1dbde2;}_0x3f3d41['query']=Object[_0x0a9e('0x3a')](_0x3f3d41[_0x0a9e('0xe')],_0xd5b662[_0x0a9e('0xe')]);delete _0x3f3d41[_0x0a9e('0xe')]['id'];return db['UserProfile'][_0x0a9e('0x3b')](_0x3f3d41);}return db[_0x0a9e('0x26')][_0x0a9e('0x3c')](_0x69aeb7);})['then'](function(_0x1dbf74){_0x32d742[_0x0a9e('0x9')]=_0x1dbf74[_0x0a9e('0x9')];_0x2b4227=_0x1dbf74['rows'];return _0x2b4227['map'](function(_0x11b61d){var _0x40d766=_['find'](_0x281129,['id',_0x11b61d['id']]);if(_0x40d766){var _0x2b814e=rta[_0x0a9e('0x3d')](_0x40d766);_[_0x0a9e('0x35')](_0x11b61d,_0x2b814e);}_0x11b61d[_0x0a9e('0x1b')]=rta['getAgentStatus'](_0x11b61d);if(_0x11b61d['globalStatus'][_0x0a9e('0x1a')](_0x0a9e('0x11'))){_0x4283ce['forEach'](function(_0x183991){if(_0x11b61d[_0x183991+_0x0a9e('0x34')]){if(_0x183991===_0x0a9e('0x3e')){if(_0x11b61d['voiceStatus']!==_0x0a9e('0x3f')){_0x11b61d[_0x0a9e('0x40')]=_0x0a9e('0x11');}}else{_0x11b61d[_0x183991+_0x0a9e('0x41')]=_0x0a9e('0x11');}}});}return _0x11b61d;});})[_0x0a9e('0x13')](function(_0x2881b3){if(!_0x478723||_0x106033){return _0x2881b3;}return rta[_0x0a9e('0x42')](_0x2881b3,_0x478723);})[_0x0a9e('0x13')](function(_0x3da2cd){var _0x2c3711=null;if(_0xd5b662[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x11ca30=_0xd5b662[_0x0a9e('0xe')]['fields']['split'](',');_0x2c3711=_0x3da2cd[_0x0a9e('0x25')](function(_0xb3795a){return _[_0x0a9e('0x43')](_0xb3795a,_0x11ca30);});}_0x32d742[_0x0a9e('0x22')]=_0x2c3711||_0x3da2cd;return _0x32d742;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x26d672,_0x69aeb7))[_0x0a9e('0x44')](APIHandleError(_0x26d672));};exports[_0x0a9e('0x45')]=function(_0x445e25,_0x432fcc){var _0x25c6e6={'count':0x0,'rows':[]};var _0x2c2cb0={};var _0x35ed4a;var _0x5026aa;var _0x117c99;Promise[_0x0a9e('0x12')]()[_0x0a9e('0x13')](function(){if(_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]){if(!utils[_0x0a9e('0x15')](_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')])){throw new APIBadRequestError(util['format'](_0x0a9e('0x17'),_0x445e25['query'][_0x0a9e('0x14')]));}_0x35ed4a=_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x14')]['toLowerCase']();}var _0x14bec2=_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x47');var _0x34aa5a=_[_0x0a9e('0x25')](db[_0x14bec2][_0x0a9e('0x27')],function(_0x45bf7f){return{'name':_0x45bf7f['fieldName'],'type':_0x45bf7f[_0x0a9e('0x29')][_0x0a9e('0x2a')]};});if(!_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]){var _0x409789=['id',_0x0a9e('0x48')];if(_0x35ed4a===_0x0a9e('0x3e')){_0x409789[_0x0a9e('0x2f')](_0x0a9e('0x29'));if(_0x445e25['query'][_0x0a9e('0x29')]===_0x0a9e('0x49')){_0x409789['push'](['dialActive','dialMethod']);}}_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x1e')]=_0x409789[_0x0a9e('0x1f')](',');}_0x2c2cb0=qs[_0x0a9e('0x2d')](_0x34aa5a,_0x445e25);if(_0x445e25[_0x0a9e('0x36')][_0x0a9e('0x2b')]===_0x0a9e('0x36')){var _0x375c18={'params':{'id':_0x445e25['user']['userProfileId']},'query':{'section':_0x35ed4a==='voice'&&_0x445e25[_0x0a9e('0xe')][_0x0a9e('0x29')]===_0x0a9e('0x49')?'QueueCampaigns':_[_0x0a9e('0x46')](_0x35ed4a)+_0x0a9e('0x4a'),'type':_0x445e25['query']['type'],'nolimit':!![],'sort':_0x0a9e('0x48'),'filter':_0x445e25['query'][_0x0a9e('0x4b')]}};_0x375c18['query']=Object[_0x0a9e('0x3a')](_0x375c18[_0x0a9e('0xe')],_0x445e25[_0x0a9e('0xe')]);delete _0x375c18['query']['id'];return db[_0x0a9e('0x4c')][_0x0a9e('0x3b')](_0x375c18);}return db[_0x14bec2]['findAndCountAll'](_0x2c2cb0);})['then'](function(_0x128aa6){_0x25c6e6[_0x0a9e('0x9')]=_0x128aa6['count'];_0x5026aa=_0x128aa6[_0x0a9e('0x22')];return rtq['getRealtimeQueues'](_0x445e25,_0x35ed4a);})[_0x0a9e('0x13')](function(_0x523cd2){_0x117c99=_0x523cd2[_0x0a9e('0x22')];return rtq['initializeQueues'](_0x5026aa,_0x117c99,_0x35ed4a,_0x445e25['query']['type']);})[_0x0a9e('0x13')](function(_0x47de4c){_0x25c6e6[_0x0a9e('0x22')]=_0x47de4c;return _0x25c6e6;})[_0x0a9e('0x13')](respondWithFilteredResult(_0x432fcc,_0x2c2cb0))[_0x0a9e('0x44')](APIHandleError(_0x432fcc));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 3479155..05ea05e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4e6d1c,_0x52b8a4){var _0x421559=function(_0x3a95e8){while(--_0x3a95e8){_0x4e6d1c['push'](_0x4e6d1c['shift']());}};_0x421559(++_0x52b8a4);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x366ef2,_0x16e62f){var _0x51a5f3=function(_0x2d32ea){while(--_0x2d32ea){_0x366ef2['push'](_0x366ef2['shift']());}};_0x51a5f3(++_0x16e62f);}(_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 3fa8ca4..a0fc05a 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 _0x2cd0=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x48d0b6,_0x6a02b6){var _0x417595=function(_0x2e5956){while(--_0x2e5956){_0x48d0b6['push'](_0x48d0b6['shift']());}};_0x417595(++_0x6a02b6);}(_0x2cd0,0x10f));var _0x02cd=function(_0x11a02b,_0x5eb246){_0x11a02b=_0x11a02b-0x0;var _0x5378cb=_0x2cd0[_0x11a02b];return _0x5378cb;};'use strict';var Sequelize=require(_0x02cd('0x0'));module[_0x02cd('0x1')]={'state':{'type':Sequelize[_0x02cd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x02cd('0x3')]},'scheduledat':{'type':Sequelize[_0x02cd('0x4')]},'uniqueid':{'type':Sequelize[_0x02cd('0x3')]},'starttime':{'type':Sequelize[_0x02cd('0x4')]},'responsetime':{'type':Sequelize[_0x02cd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x02cd('0x3')]},'campaigntype':{'type':Sequelize[_0x02cd('0x3')]},'membername':{'type':Sequelize[_0x02cd('0x3')]}}; \ No newline at end of file +var _0xe75a=['STRING','DATE','INTEGER','sequelize','exports'];(function(_0x2ce412,_0x5dda7b){var _0x6c72f=function(_0x28d1f8){while(--_0x28d1f8){_0x2ce412['push'](_0x2ce412['shift']());}};_0x6c72f(++_0x5dda7b);}(_0xe75a,0x1de));var _0xae75=function(_0x5bff0,_0x20716d){_0x5bff0=_0x5bff0-0x0;var _0x3ead2e=_0xe75a[_0x5bff0];return _0x3ead2e;};'use strict';var Sequelize=require(_0xae75('0x0'));module[_0xae75('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xae75('0x2')]},'scheduledat':{'type':Sequelize[_0xae75('0x3')]},'uniqueid':{'type':Sequelize[_0xae75('0x2')]},'starttime':{'type':Sequelize[_0xae75('0x3')]},'responsetime':{'type':Sequelize[_0xae75('0x3')]},'ringtime':{'type':Sequelize[_0xae75('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xae75('0x2')]},'campaigntype':{'type':Sequelize[_0xae75('0x2')]},'membername':{'type':Sequelize[_0xae75('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 38feb49..acce834 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 _0x83e9=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','define','ReportAgentPreview','lodash','util','api'];(function(_0x52dd39,_0xdb90a5){var _0x1d4076=function(_0x19c184){while(--_0x19c184){_0x52dd39['push'](_0x52dd39['shift']());}};_0x1d4076(++_0xdb90a5);}(_0x83e9,0x111));var _0x983e=function(_0x3abd63,_0x49de10){_0x3abd63=_0x3abd63-0x0;var _0x365275=_0x83e9[_0x3abd63];return _0x365275;};'use strict';var _=require(_0x983e('0x0'));var util=require(_0x983e('0x1'));var logger=require('../../config/logger')(_0x983e('0x2'));var moment=require(_0x983e('0x3'));var BPromise=require(_0x983e('0x4'));var rp=require(_0x983e('0x5'));var fs=require('fs');var path=require(_0x983e('0x6'));var rimraf=require(_0x983e('0x7'));var config=require(_0x983e('0x8'));var attributes=require(_0x983e('0x9'));module['exports']=function(_0x2ed57e,_0x413dbd){return _0x2ed57e[_0x983e('0xa')](_0x983e('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3965=['ReportAgentPreview','report_agent_preview','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define'];(function(_0x544626,_0x2764f1){var _0x16bfd6=function(_0x48759e){while(--_0x48759e){_0x544626['push'](_0x544626['shift']());}};_0x16bfd6(++_0x2764f1);}(_0x3965,0xc6));var _0x5396=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x3965[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x5396('0x0'));var util=require(_0x5396('0x1'));var logger=require('../../config/logger')(_0x5396('0x2'));var moment=require(_0x5396('0x3'));var BPromise=require(_0x5396('0x4'));var rp=require(_0x5396('0x5'));var fs=require('fs');var path=require(_0x5396('0x6'));var rimraf=require(_0x5396('0x7'));var config=require(_0x5396('0x8'));var attributes=require(_0x5396('0x9'));module[_0x5396('0xa')]=function(_0x56bde5,_0x4d224a){return _0x56bde5[_0x5396('0xb')](_0x5396('0xc'),attributes,{'tableName':_0x5396('0xd'),'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 431f146..856327f 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 _0x1f25=['error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','then','debug','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','stringify'];(function(_0x5627c8,_0x5e91fd){var _0x2bc4af=function(_0x467924){while(--_0x467924){_0x5627c8['push'](_0x5627c8['shift']());}};_0x2bc4af(++_0x5e91fd);}(_0x1f25,0x1c7));var _0x51f2=function(_0x22cfc7,_0x53d50c){_0x22cfc7=_0x22cfc7-0x0;var _0x3b152b=_0x1f25[_0x22cfc7];return _0x3b152b;};'use strict';var _=require(_0x51f2('0x0'));var util=require(_0x51f2('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x51f2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51f2('0x3'))['db'];var utils=require(_0x51f2('0x4'));var logger=require(_0x51f2('0x5'))(_0x51f2('0x6'));var config=require(_0x51f2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x51f2('0x8')][_0x51f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41da15,_0x32a933,_0x3d262d){return new BPromise(function(_0x401b44,_0x1d1540){return client['request'](_0x41da15,_0x3d262d)['then'](function(_0x56bc08){logger[_0x51f2('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x32a933,_0x51f2('0xb'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x32a933,_0x51f2('0xb'),JSON[_0x51f2('0xc')](_0x56bc08));if(_0x56bc08[_0x51f2('0xd')]){if(_0x56bc08[_0x51f2('0xd')][_0x51f2('0xe')]===0x1f4){logger[_0x51f2('0xd')](_0x51f2('0xf'),_0x32a933,_0x56bc08[_0x51f2('0xd')][_0x51f2('0x10')]);return _0x1d1540(_0x56bc08[_0x51f2('0xd')][_0x51f2('0x10')]);}logger[_0x51f2('0xd')]('ReportAgentPreview,\x20%s,\x20%s',_0x32a933,_0x56bc08[_0x51f2('0xd')][_0x51f2('0x10')]);return _0x401b44(_0x56bc08[_0x51f2('0xd')][_0x51f2('0x10')]);}else{logger[_0x51f2('0xa')](_0x51f2('0xf'),_0x32a933,'request\x20sent');_0x401b44(_0x56bc08[_0x51f2('0x11')][_0x51f2('0x10')]);}})[_0x51f2('0x12')](function(_0x8c8c2a){logger[_0x51f2('0xd')](_0x51f2('0xf'),_0x32a933,_0x8c8c2a);_0x1d1540(_0x8c8c2a);});});}exports[_0x51f2('0x13')]=function(_0x2960c6){var _0x370c05=this;return new Promise(function(_0x19e06f,_0x24717c){return db[_0x51f2('0x14')]['create'](_0x2960c6[_0x51f2('0x15')],{'raw':_0x2960c6['options']?_0x2960c6[_0x51f2('0x16')][_0x51f2('0x17')]===undefined?!![]:![]:!![]})[_0x51f2('0x18')](function(_0xa55244){logger[_0x51f2('0xa')]('CreateReportAgentPreview',_0x2960c6);logger[_0x51f2('0x19')](_0x51f2('0x13'),_0x2960c6,JSON[_0x51f2('0xc')](_0xa55244));_0x19e06f(_0xa55244);})[_0x51f2('0x12')](function(_0x30b5c6){logger[_0x51f2('0xd')](_0x51f2('0x13'),_0x30b5c6[_0x51f2('0x10')],_0x2960c6);_0x24717c(_0x370c05['error'](0x1f4,_0x30b5c6[_0x51f2('0x10')]));});});}; \ No newline at end of file +var _0xeb63=['jayson/promise','http','then','info','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','ReportAgentPreview,\x20%s,\x20%s','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xeb63,0x1b2));var _0x3eb6=function(_0x14c8ee,_0x34d4fb){_0x14c8ee=_0x14c8ee-0x0;var _0x51acc2=_0xeb63[_0x14c8ee];return _0x51acc2;};'use strict';var _=require(_0x3eb6('0x0'));var util=require(_0x3eb6('0x1'));var moment=require(_0x3eb6('0x2'));var BPromise=require(_0x3eb6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eb6('0x4'));var db=require(_0x3eb6('0x5'))['db'];var utils=require(_0x3eb6('0x6'));var logger=require(_0x3eb6('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3eb6('0x8'));var client=jayson['client'][_0x3eb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36386e,_0xb065db,_0x40abd1){return new BPromise(function(_0x51a0ed,_0x4e1ba1){return client['request'](_0x36386e,_0x40abd1)[_0x3eb6('0xa')](function(_0x49b1a8){logger[_0x3eb6('0xb')]('ReportAgentPreview,\x20%s,\x20%s',_0xb065db,_0x3eb6('0xc'));logger[_0x3eb6('0xd')](_0x3eb6('0xe'),_0xb065db,_0x3eb6('0xc'),JSON[_0x3eb6('0xf')](_0x49b1a8));if(_0x49b1a8[_0x3eb6('0x10')]){if(_0x49b1a8[_0x3eb6('0x10')][_0x3eb6('0x11')]===0x1f4){logger['error'](_0x3eb6('0x12'),_0xb065db,_0x49b1a8[_0x3eb6('0x10')][_0x3eb6('0x13')]);return _0x4e1ba1(_0x49b1a8[_0x3eb6('0x10')][_0x3eb6('0x13')]);}logger[_0x3eb6('0x10')](_0x3eb6('0x12'),_0xb065db,_0x49b1a8['error'][_0x3eb6('0x13')]);return _0x51a0ed(_0x49b1a8[_0x3eb6('0x10')]['message']);}else{logger[_0x3eb6('0xb')](_0x3eb6('0x12'),_0xb065db,_0x3eb6('0xc'));_0x51a0ed(_0x49b1a8[_0x3eb6('0x14')]['message']);}})[_0x3eb6('0x15')](function(_0x42f0c2){logger['error'](_0x3eb6('0x12'),_0xb065db,_0x42f0c2);_0x4e1ba1(_0x42f0c2);});});}exports[_0x3eb6('0x16')]=function(_0x2f8ad2){var _0x232800=this;return new Promise(function(_0x500425,_0x5442de){return db[_0x3eb6('0x17')]['create'](_0x2f8ad2[_0x3eb6('0x18')],{'raw':_0x2f8ad2['options']?_0x2f8ad2[_0x3eb6('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x3eb6('0xa')](function(_0x4e1967){logger['info'](_0x3eb6('0x16'),_0x2f8ad2);logger['debug'](_0x3eb6('0x16'),_0x2f8ad2,JSON[_0x3eb6('0xf')](_0x4e1967));_0x500425(_0x4e1967);})[_0x3eb6('0x15')](function(_0x88e27e){logger[_0x3eb6('0x10')](_0x3eb6('0x16'),_0x88e27e[_0x3eb6('0x13')],_0x2f8ad2);_0x5442de(_0x232800[_0x3eb6('0x10')](0x1f4,_0x88e27e[_0x3eb6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index fe7ecc5..18b1345 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 _0x14d3=['agentNotify','exports','util','express','Router','../../components/auth/service','/voice/channels','get','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/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','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify'];(function(_0x3fe472,_0x513295){var _0x46cf3c=function(_0x5b8b33){while(--_0x5b8b33){_0x3fe472['push'](_0x3fe472['shift']());}};_0x46cf3c(++_0x513295);}(_0x14d3,0x9c));var _0x314d=function(_0x437aa2,_0x48d508){_0x437aa2=_0x437aa2-0x0;var _0x28ac4d=_0x14d3[_0x437aa2];return _0x28ac4d;};'use strict';var multer=require('multer');var util=require(_0x314d('0x0'));var path=require('path');var express=require(_0x314d('0x1'));var router=express[_0x314d('0x2')]();var auth=require(_0x314d('0x3'));var controller=require('./rpc.controller');router['get'](_0x314d('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router[_0x314d('0x5')](_0x314d('0x6'),auth[_0x314d('0x7')](),controller['voiceChannelMixMonitor']);router['get'](_0x314d('0x8'),auth[_0x314d('0x7')](),controller[_0x314d('0x9')]);router[_0x314d('0x5')](_0x314d('0xa'),auth[_0x314d('0x7')](),controller['voiceQueues']);router[_0x314d('0x5')](_0x314d('0xb'),auth[_0x314d('0x7')](),controller[_0x314d('0xc')]);router[_0x314d('0x5')](_0x314d('0xd'),auth[_0x314d('0x7')](),controller[_0x314d('0xe')]);router[_0x314d('0x5')](_0x314d('0xf'),auth[_0x314d('0x7')](),controller[_0x314d('0x10')]);router[_0x314d('0x5')](_0x314d('0x11'),auth[_0x314d('0x7')](),controller[_0x314d('0x12')]);router[_0x314d('0x5')]('/sms/queues',auth[_0x314d('0x7')](),controller['smsQueues']);router['get'](_0x314d('0x13'),auth[_0x314d('0x7')](),controller[_0x314d('0x14')]);router[_0x314d('0x5')](_0x314d('0x15'),auth['isAuthenticated'](),controller[_0x314d('0x16')]);router[_0x314d('0x5')](_0x314d('0x17'),auth[_0x314d('0x7')](),controller[_0x314d('0x18')]);router[_0x314d('0x5')](_0x314d('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0x314d('0x5')]('/voice/queues/channels/:uniqueid',auth[_0x314d('0x7')](),controller[_0x314d('0x1a')]);router[_0x314d('0x5')](_0x314d('0x1b'),auth[_0x314d('0x7')](),controller[_0x314d('0x1c')]);router[_0x314d('0x5')](_0x314d('0x1d'),auth[_0x314d('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x314d('0x5')](_0x314d('0x1e'),auth[_0x314d('0x7')](),controller[_0x314d('0x1f')]);router['put'](_0x314d('0x1e'),auth[_0x314d('0x7')](),controller[_0x314d('0x20')]);router['get']('/outbound',auth['isAuthenticated'](),controller['outbound']);router[_0x314d('0x5')](_0x314d('0x21'),auth['isAuthenticated'](),controller['outboundChannels']);router[_0x314d('0x5')](_0x314d('0x22'),auth[_0x314d('0x7')](),controller['agents']);router['put'](_0x314d('0x23'),auth[_0x314d('0x7')](),controller['agentCapacity']);router[_0x314d('0x5')](_0x314d('0x24'),auth[_0x314d('0x7')](),controller[_0x314d('0x25')]);router['get'](_0x314d('0x26'),auth['isAuthenticated'](),controller['trunks']);router[_0x314d('0x5')]('/campaigns',auth[_0x314d('0x7')](),controller[_0x314d('0x27')]);router[_0x314d('0x5')](_0x314d('0x28'),auth[_0x314d('0x7')](),controller[_0x314d('0x29')]);router[_0x314d('0x5')](_0x314d('0x2a'),auth[_0x314d('0x7')](),controller[_0x314d('0x2b')]);router[_0x314d('0x5')](_0x314d('0x2c'),auth[_0x314d('0x7')](),controller[_0x314d('0x2d')]);router[_0x314d('0x5')](_0x314d('0x2e'),auth[_0x314d('0x7')](),controller[_0x314d('0x2f')]);router['get'](_0x314d('0x30'),auth[_0x314d('0x7')](),controller[_0x314d('0x31')]);router[_0x314d('0x5')](_0x314d('0x32'),auth[_0x314d('0x7')](),controller[_0x314d('0x33')]);router[_0x314d('0x5')](_0x314d('0x34'),auth[_0x314d('0x7')](),controller['whatsappQueuesWaitingInteractions']);router[_0x314d('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x314d('0x35')]);router[_0x314d('0x36')](_0x314d('0x37'),auth[_0x314d('0x7')](),controller[_0x314d('0x38')](_0x314d('0x39')));router[_0x314d('0x5')](_0x314d('0x3a'),auth[_0x314d('0x7')](),controller['showMailQueues']);router['post'](_0x314d('0x3b'),auth[_0x314d('0x7')](),controller['queueNotify']('chat'));router[_0x314d('0x5')](_0x314d('0x3c'),auth[_0x314d('0x7')](),controller[_0x314d('0x3d')]);router['post']('/fax/queues/:id/notify',auth[_0x314d('0x7')](),controller[_0x314d('0x38')](_0x314d('0x3e')));router['get'](_0x314d('0x3f'),auth[_0x314d('0x7')](),controller[_0x314d('0x40')]);router[_0x314d('0x36')](_0x314d('0x41'),auth[_0x314d('0x7')](),controller[_0x314d('0x38')]('openchannel'));router[_0x314d('0x5')](_0x314d('0x42'),auth[_0x314d('0x7')](),controller[_0x314d('0x43')]);router[_0x314d('0x36')](_0x314d('0x44'),auth['isAuthenticated'](),controller[_0x314d('0x38')](_0x314d('0x45')));router[_0x314d('0x36')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x314d('0x38')](_0x314d('0x46')));router[_0x314d('0x5')](_0x314d('0x47'),auth[_0x314d('0x7')](),controller[_0x314d('0x48')]);router[_0x314d('0x5')](_0x314d('0x49'),auth['isAuthenticated'](),controller['showWhatsappQueues']);router[_0x314d('0x36')](_0x314d('0x4a'),auth[_0x314d('0x7')](),controller[_0x314d('0x4b')]);module[_0x314d('0x4c')]=router; \ No newline at end of file +var _0x633b=['/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','/fax/queues','voiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','multer','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues'];(function(_0x57a936,_0x4217fa){var _0x51d4eb=function(_0x35a619){while(--_0x35a619){_0x57a936['push'](_0x57a936['shift']());}};_0x51d4eb(++_0x4217fa);}(_0x633b,0xf1));var _0xb633=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x633b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xb633('0x0'));var util=require('util');var path=require('path');var express=require(_0xb633('0x1'));var router=express[_0xb633('0x2')]();var auth=require(_0xb633('0x3'));var controller=require(_0xb633('0x4'));router[_0xb633('0x5')](_0xb633('0x6'),auth[_0xb633('0x7')](),controller[_0xb633('0x8')]);router[_0xb633('0x5')](_0xb633('0x9'),auth[_0xb633('0x7')](),controller[_0xb633('0xa')]);router[_0xb633('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xb633('0x7')](),controller[_0xb633('0xb')]);router[_0xb633('0x5')](_0xb633('0xc'),auth[_0xb633('0x7')](),controller[_0xb633('0xd')]);router['get'](_0xb633('0xe'),auth[_0xb633('0x7')](),controller[_0xb633('0xf')]);router['get'](_0xb633('0x10'),auth[_0xb633('0x7')](),controller[_0xb633('0x11')]);router[_0xb633('0x5')](_0xb633('0x12'),auth[_0xb633('0x7')](),controller[_0xb633('0x13')]);router[_0xb633('0x5')](_0xb633('0x14'),auth[_0xb633('0x7')](),controller[_0xb633('0x15')]);router[_0xb633('0x5')](_0xb633('0x16'),auth[_0xb633('0x7')](),controller[_0xb633('0x17')]);router[_0xb633('0x5')](_0xb633('0x18'),auth[_0xb633('0x7')](),controller['whatsappQueues']);router[_0xb633('0x5')](_0xb633('0x19'),auth['isAuthenticated'](),controller['faxQueues']);router['get']('/voice/queues/preview/:id',auth[_0xb633('0x7')](),controller[_0xb633('0x1a')]);router[_0xb633('0x5')]('/voice/queues/channels',auth['isAuthenticated'](),controller[_0xb633('0x1b')]);router[_0xb633('0x5')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0xb633('0x1c')]);router['get'](_0xb633('0x1d'),auth['isAuthenticated'](),controller[_0xb633('0x1e')]);router[_0xb633('0x5')](_0xb633('0x1f'),auth[_0xb633('0x7')](),controller[_0xb633('0x20')]);router[_0xb633('0x5')](_0xb633('0x21'),auth['isAuthenticated'](),controller[_0xb633('0x22')]);router[_0xb633('0x23')](_0xb633('0x21'),auth[_0xb633('0x7')](),controller[_0xb633('0x24')]);router[_0xb633('0x5')](_0xb633('0x25'),auth[_0xb633('0x7')](),controller['outbound']);router[_0xb633('0x5')](_0xb633('0x26'),auth['isAuthenticated'](),controller[_0xb633('0x27')]);router['get'](_0xb633('0x28'),auth['isAuthenticated'](),controller[_0xb633('0x29')]);router[_0xb633('0x23')](_0xb633('0x2a'),auth[_0xb633('0x7')](),controller[_0xb633('0x2b')]);router[_0xb633('0x5')]('/telephones',auth[_0xb633('0x7')](),controller[_0xb633('0x2c')]);router[_0xb633('0x5')](_0xb633('0x2d'),auth[_0xb633('0x7')](),controller[_0xb633('0x2e')]);router[_0xb633('0x5')](_0xb633('0x2f'),auth[_0xb633('0x7')](),controller[_0xb633('0x30')]);router[_0xb633('0x5')]('/fax/accounts',auth[_0xb633('0x7')](),controller[_0xb633('0x31')]);router[_0xb633('0x5')](_0xb633('0x32'),auth[_0xb633('0x7')](),controller[_0xb633('0x33')]);router[_0xb633('0x5')](_0xb633('0x34'),auth[_0xb633('0x7')](),controller[_0xb633('0x35')]);router['get']('/openchannel/queues/waitinginteractions',auth[_0xb633('0x7')](),controller[_0xb633('0x36')]);router[_0xb633('0x5')](_0xb633('0x37'),auth[_0xb633('0x7')](),controller[_0xb633('0x38')]);router[_0xb633('0x5')](_0xb633('0x39'),auth[_0xb633('0x7')](),controller[_0xb633('0x3a')]);router[_0xb633('0x5')](_0xb633('0x3b'),auth[_0xb633('0x7')](),controller[_0xb633('0x3c')]);router[_0xb633('0x5')](_0xb633('0x3d'),auth['isAuthenticated'](),controller[_0xb633('0x3e')]);router['post'](_0xb633('0x3f'),auth['isAuthenticated'](),controller[_0xb633('0x40')](_0xb633('0x41')));router['get'](_0xb633('0x42'),auth[_0xb633('0x7')](),controller[_0xb633('0x43')]);router[_0xb633('0x44')](_0xb633('0x45'),auth['isAuthenticated'](),controller[_0xb633('0x40')](_0xb633('0x46')));router[_0xb633('0x5')](_0xb633('0x47'),auth[_0xb633('0x7')](),controller[_0xb633('0x48')]);router[_0xb633('0x44')](_0xb633('0x49'),auth[_0xb633('0x7')](),controller[_0xb633('0x40')](_0xb633('0x4a')));router[_0xb633('0x5')]('/fax/queues/:id',auth[_0xb633('0x7')](),controller['showFaxQueues']);router[_0xb633('0x44')](_0xb633('0x4b'),auth['isAuthenticated'](),controller['queueNotify'](_0xb633('0x4c')));router['get'](_0xb633('0x4d'),auth[_0xb633('0x7')](),controller[_0xb633('0x4e')]);router[_0xb633('0x44')](_0xb633('0x4f'),auth[_0xb633('0x7')](),controller['queueNotify']('sms'));router[_0xb633('0x44')](_0xb633('0x50'),auth['isAuthenticated'](),controller[_0xb633('0x40')]('whatsapp'));router[_0xb633('0x5')]('/sms/queues/:id',auth[_0xb633('0x7')](),controller[_0xb633('0x51')]);router[_0xb633('0x5')](_0xb633('0x52'),auth[_0xb633('0x7')](),controller[_0xb633('0x53')]);router[_0xb633('0x44')](_0xb633('0x54'),auth[_0xb633('0x7')](),controller['agentNotify']);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 7dada87..3dcd360 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 _0xa877=['\x20Queue\x20not\x20found','Message','Interaction','Account','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','create','Start','queue','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Agent\x20not\x20found','agentTransferTimeout','*,*,*,*','bluebird','lodash','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','outboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','format','SIP/%s','interface','agent','internal','capacity','telephones','Telephones','trunks','Trunks','Campaigns','chatQueues','ChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','uniq','value','queue_id','filter','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne'];(function(_0x5b2dc2,_0x59e0ea){var _0x2608e8=function(_0x5c3b2c){while(--_0x5c3b2c){_0x5b2dc2['push'](_0x5b2dc2['shift']());}};_0x2608e8(++_0x59e0ea);}(_0xa877,0x1a1));var _0x7a87=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa877[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x7a87('0x0'));var moment=require('moment');var _=require(_0x7a87('0x1'));var util=require(_0x7a87('0x2'));var db=require(_0x7a87('0x3'))['db'];var logger=require(_0x7a87('0x4'))('api');var jayson=require(_0x7a87('0x5'));var amiClient=jayson[_0x7a87('0x6')][_0x7a87('0x7')]({'port':0x232a});var mailClient=jayson[_0x7a87('0x6')][_0x7a87('0x7')]({'port':0x232b});var routingClient=jayson['client'][_0x7a87('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x10f8da,_0x28ba32,_0x13737c){return new BPromise(function(_0x235077,_0x13562c){var _0x3e03aa=_0x13737c?_0x13737c:amiClient;return _0x3e03aa[_0x7a87('0x8')](_0x10f8da,_0x28ba32)[_0x7a87('0x9')](function(_0x46e204){if(_0x46e204[_0x7a87('0xa')]){if(_0x46e204[_0x7a87('0xa')][_0x7a87('0xb')]===0x1f4){return _0x13562c(_0x46e204[_0x7a87('0xa')][_0x7a87('0xc')]);}return _0x235077(_0x46e204[_0x7a87('0xa')][_0x7a87('0xc')]);}else{_0x235077(_0x46e204[_0x7a87('0xd')]);}})[_0x7a87('0xe')](function(_0x28f7fa){_0x13562c(_0x28f7fa);});});}function respondWithResult(_0x246d8e,_0x33efdd){_0x33efdd=_0x33efdd||0xc8;return function(_0x438785){if(_0x438785){return _0x246d8e[_0x7a87('0xf')](_0x33efdd)[_0x7a87('0x10')](_0x438785);}return _0x246d8e[_0x7a87('0x11')](0x194);};}function handleError(_0x44b1bc,_0x41d8ce){_0x41d8ce=_0x41d8ce||0x1f4;return function(_0x17e6ec){logger['error'](_0x17e6ec[_0x7a87('0x12')]);if(_0x17e6ec[_0x7a87('0x13')]){delete _0x17e6ec[_0x7a87('0x13')];}_0x44b1bc['status'](_0x41d8ce)[_0x7a87('0x14')](_0x17e6ec);};}function findById(_0x18c238){return function(_0x374b06){if(!_['isNil'](_0x18c238)&&!_[_0x7a87('0x15')](_0x374b06)&&!_[_0x7a87('0x15')](_0x374b06[_0x7a87('0x16')])){return _[_0x7a87('0x17')](_0x374b06[_0x7a87('0x16')],function(_0x2b0384){return _0x2b0384['id']==_0x18c238;});}return null;};}exports['voiceChannels']=function(_0xc9e759,_0x936d1b){return respondWithRpcPromise(_0x7a87('0x18'),_0xc9e759[_0x7a87('0x19')])['then'](respondWithResult(_0x936d1b,null))['catch'](handleError(_0x936d1b,null));};exports[_0x7a87('0x1a')]=function(_0x26f038,_0x304095){return respondWithRpcPromise(_0x7a87('0x1b'),_['merge'](_0x26f038[_0x7a87('0x19')],_0x26f038[_0x7a87('0x1c')]))[_0x7a87('0x9')](respondWithResult(_0x304095,null))[_0x7a87('0xe')](handleError(_0x304095,null));};exports[_0x7a87('0x1d')]=function(_0xf095e8,_0x4c3d77){return respondWithRpcPromise(_0x7a87('0x1e'),_[_0x7a87('0x1f')](_0xf095e8[_0x7a87('0x19')],_0xf095e8[_0x7a87('0x1c')]))[_0x7a87('0x9')](respondWithResult(_0x4c3d77,null))[_0x7a87('0xe')](handleError(_0x4c3d77,null));};exports[_0x7a87('0x20')]=function(_0x14a077,_0xae3388){return respondWithRpcPromise(_0x7a87('0x21'),_0x14a077[_0x7a87('0x19')])[_0x7a87('0x9')](respondWithResult(_0xae3388,null))[_0x7a87('0xe')](handleError(_0xae3388,null));};exports[_0x7a87('0x22')]=function(_0x21aa04,_0x3efe28){return respondWithRpcPromise('VoiceQueues',_0x21aa04['query'])[_0x7a87('0x9')](findById(_0x21aa04['params']['id']))[_0x7a87('0x9')](respondWithResult(_0x3efe28,null))[_0x7a87('0xe')](handleError(_0x3efe28,null));};exports[_0x7a87('0x23')]=function(_0x484d9,_0x2e1719){return respondWithRpcPromise(_0x7a87('0x24'),_[_0x7a87('0x1f')](_0x484d9[_0x7a87('0x25')],_0x484d9[_0x7a87('0x1c')]))[_0x7a87('0x9')](respondWithResult(_0x2e1719,null))[_0x7a87('0xe')](handleError(_0x2e1719,null));};exports[_0x7a87('0x26')]=function(_0x5d5800,_0x539eff){return respondWithRpcPromise(_0x7a87('0x27'),_[_0x7a87('0x1f')](_0x5d5800['query'],_0x5d5800['params']))['then'](respondWithResult(_0x539eff,null))['catch'](handleError(_0x539eff,null));};exports['voiceQueuesChannels']=function(_0xdfb474,_0x2b9529){return respondWithRpcPromise(_0x7a87('0x28'),_0xdfb474[_0x7a87('0x19')])['then'](respondWithResult(_0x2b9529,null))[_0x7a87('0xe')](handleError(_0x2b9529,null));};exports[_0x7a87('0x29')]=function(_0x2b15bc,_0x21a126){return respondWithRpcPromise(_0x7a87('0x2a'),_[_0x7a87('0x1f')](_0x2b15bc[_0x7a87('0x19')],_0x2b15bc['params']))['then'](respondWithResult(_0x21a126,null))[_0x7a87('0xe')](handleError(_0x21a126,null));};exports['voiceQueuesChannelHangup']=function(_0x4ad100,_0x23470a){return respondWithRpcPromise(_0x7a87('0x2b'),_[_0x7a87('0x1f')](_0x4ad100['query'],_0x4ad100[_0x7a87('0x1c')]))[_0x7a87('0x9')](respondWithResult(_0x23470a,null))[_0x7a87('0xe')](handleError(_0x23470a,null));};exports[_0x7a87('0x2c')]=function(_0xc1a70,_0x3a37b0){return respondWithRpcPromise(_0x7a87('0x2d'),_[_0x7a87('0x1f')](_0xc1a70[_0x7a87('0x19')],_0xc1a70[_0x7a87('0x1c')]))[_0x7a87('0x9')](respondWithResult(_0x3a37b0,null))['catch'](handleError(_0x3a37b0,null));};exports[_0x7a87('0x2e')]=function(_0x385069,_0x16edee){return respondWithRpcPromise('Outbound',_0x385069[_0x7a87('0x19')])['then'](respondWithResult(_0x16edee,null))[_0x7a87('0xe')](handleError(_0x16edee,null));};exports[_0x7a87('0x2f')]=function(_0x41b954,_0x13cb6a){return respondWithRpcPromise('OutboundChannels',_0x41b954[_0x7a87('0x19')])[_0x7a87('0x9')](respondWithResult(_0x13cb6a,null))[_0x7a87('0xe')](handleError(_0x13cb6a,null));};exports[_0x7a87('0x30')]=function(_0x4e8d6a,_0x440504){var _0x143e85;return respondWithRpcPromise(_0x7a87('0x31'),_0x4e8d6a[_0x7a87('0x19')])[_0x7a87('0x9')](function(_0x1f9d91){_0x143e85=_0x1f9d91;return respondWithRpcPromise(_0x7a87('0x31'),_0x4e8d6a[_0x7a87('0x19')],routingClient);})['then'](function(_0x3be89b){return _[_0x7a87('0x1f')]({},_0x3be89b,_0x143e85);})['then'](respondWithResult(_0x440504,null))['catch'](handleError(_0x440504,null));};exports[_0x7a87('0x32')]=function(_0x35e452,_0x456d6b){if(_0x35e452[_0x7a87('0x25')]&&_0x35e452[_0x7a87('0x25')][_0x7a87('0x33')]&&_0x35e452['user']&&_0x35e452[_0x7a87('0x34')][_0x7a87('0x13')]){for(var _0x5cc2ef in _0x35e452[_0x7a87('0x25')][_0x7a87('0x33')]){if(_0x35e452['body'][_0x7a87('0x33')][_0x7a87('0x35')](_0x5cc2ef)){db[_0x7a87('0x36')][_0x7a87('0x37')]({'where':{'channel':_0x5cc2ef,'membername':_0x35e452['user'][_0x7a87('0x13')],'type':_0x7a87('0x38'),'exitAt':null,'uniqueid':_0x35e452[_0x7a87('0x25')][_0x7a87('0x33')][_0x5cc2ef]&&_0x35e452[_0x7a87('0x25')][_0x7a87('0x33')][_0x5cc2ef][_0x7a87('0x39')]?{'$notIn':_0x35e452[_0x7a87('0x25')][_0x7a87('0x33')][_0x5cc2ef]}:{'$ne':null}}})[_0x7a87('0x9')](function(_0x530815){var _0x1d07c4=moment()['format'](_0x7a87('0x3a'));for(var _0x50cb58=0x0,_0x15d73f=_0x530815['length'];_0x50cb58<_0x15d73f;_0x50cb58+=0x1){_0x530815[_0x50cb58][_0x7a87('0x3b')]({'exitAt':_0x1d07c4});}});for(var _0x27ec60=0x0;_0x27ec60<_0x35e452[_0x7a87('0x25')]['interaction'][_0x5cc2ef][_0x7a87('0x39')];_0x27ec60+=0x1){db[_0x7a87('0x36')][_0x7a87('0x3c')]({'where':{'channel':_0x5cc2ef,'membername':_0x35e452['user'][_0x7a87('0x13')],'type':'INTERACTION','uniqueid':_0x35e452[_0x7a87('0x25')]['interaction'][_0x5cc2ef][_0x27ec60],'exitAt':null},'defaults':{'channel':_0x5cc2ef,'membername':_0x35e452['user'][_0x7a87('0x13')],'interface':_[_0x7a87('0x15')](_0x35e452[_0x7a87('0x34')]['interface'])?util[_0x7a87('0x3d')](_0x7a87('0x3e'),_0x35e452[_0x7a87('0x34')]['name']):_0x35e452[_0x7a87('0x34')][_0x7a87('0x3f')],'type':_0x7a87('0x38'),'enterAt':moment()[_0x7a87('0x3d')](_0x7a87('0x3a')),'role':_0x7a87('0x40'),'internal':_0x35e452['user'][_0x7a87('0x41')],'uniqueid':_0x35e452['body'][_0x7a87('0x33')][_0x5cc2ef][_0x27ec60]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x35e452[_0x7a87('0x1c')]['id'],'capacity':_0x35e452[_0x7a87('0x25')][_0x7a87('0x42')]},routingClient)[_0x7a87('0x9')](respondWithResult(_0x456d6b,null))['catch'](handleError(_0x456d6b,null));};exports[_0x7a87('0x43')]=function(_0x353462,_0x99e6e1){return respondWithRpcPromise(_0x7a87('0x44'),_0x353462[_0x7a87('0x19')])[_0x7a87('0x9')](respondWithResult(_0x99e6e1,null))[_0x7a87('0xe')](handleError(_0x99e6e1,null));};exports[_0x7a87('0x45')]=function(_0x6e9443,_0x4fe371){return respondWithRpcPromise(_0x7a87('0x46'),_0x6e9443['query'])[_0x7a87('0x9')](respondWithResult(_0x4fe371,null))[_0x7a87('0xe')](handleError(_0x4fe371,null));};exports['campaigns']=function(_0x25a6de,_0x45926e){return respondWithRpcPromise(_0x7a87('0x47'),_0x25a6de[_0x7a87('0x19')])[_0x7a87('0x9')](respondWithResult(_0x45926e,null))['catch'](handleError(_0x45926e,null));};exports[_0x7a87('0x48')]=function(_0x251446,_0x57ae27){return respondWithRpcPromise(_0x7a87('0x49'),_0x251446['query'],routingClient)[_0x7a87('0x9')](respondWithResult(_0x57ae27,null))['catch'](handleError(_0x57ae27,null));};exports['showChatQueues']=function(_0x5d9a4d,_0x358335){return respondWithRpcPromise(_0x7a87('0x49'),_0x5d9a4d[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](findById(_0x5d9a4d[_0x7a87('0x1c')]['id']))['then'](respondWithResult(_0x358335,null))[_0x7a87('0xe')](handleError(_0x358335,null));};exports[_0x7a87('0x4a')]=function(_0x46b4c7,_0x368bbc){return respondWithRpcPromise(_0x7a87('0x4b'),_0x46b4c7[_0x7a87('0x19')],routingClient)['then'](respondWithResult(_0x368bbc,null))[_0x7a87('0xe')](handleError(_0x368bbc,null));};exports[_0x7a87('0x4c')]=function(_0x1c2d6e,_0x42d487){return respondWithRpcPromise(_0x7a87('0x4b'),_0x1c2d6e[_0x7a87('0x19')],routingClient)['then'](findById(_0x1c2d6e['params']['id']))[_0x7a87('0x9')](respondWithResult(_0x42d487,null))['catch'](handleError(_0x42d487,null));};exports[_0x7a87('0x4d')]=function(_0x1c1d7a,_0x4df58c){return respondWithRpcPromise(_0x7a87('0x4e'),_0x1c1d7a[_0x7a87('0x19')],mailClient)[_0x7a87('0x9')](respondWithResult(_0x4df58c,null))[_0x7a87('0xe')](handleError(_0x4df58c,null));};exports[_0x7a87('0x4f')]=function(_0x59869d,_0x1d68df){return respondWithRpcPromise(_0x7a87('0x50'),_0x59869d['query'],routingClient)['then'](respondWithResult(_0x1d68df,null))[_0x7a87('0xe')](handleError(_0x1d68df,null));};exports[_0x7a87('0x51')]=function(_0x549a5c,_0x527464){return respondWithRpcPromise(_0x7a87('0x50'),_0x549a5c[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](findById(_0x549a5c[_0x7a87('0x1c')]['id']))['then'](respondWithResult(_0x527464,null))[_0x7a87('0xe')](handleError(_0x527464,null));};exports[_0x7a87('0x52')]=function(_0x1cee86,_0x2d6ea1){return respondWithRpcPromise(_0x7a87('0x53'),_0x1cee86['query'],routingClient)[_0x7a87('0x9')](respondWithResult(_0x2d6ea1,null))[_0x7a87('0xe')](handleError(_0x2d6ea1,null));};exports[_0x7a87('0x54')]=function(_0x5c3822,_0x1a638b){return respondWithRpcPromise(_0x7a87('0x53'),_0x5c3822[_0x7a87('0x19')],routingClient)['then'](findById(_0x5c3822[_0x7a87('0x1c')]['id']))[_0x7a87('0x9')](respondWithResult(_0x1a638b,null))['catch'](handleError(_0x1a638b,null));};exports[_0x7a87('0x55')]=function(_0x2b9a6e,_0x407c0d){return respondWithRpcPromise('WhatsappQueues',_0x2b9a6e['query'],routingClient)[_0x7a87('0x9')](respondWithResult(_0x407c0d,null))['catch'](handleError(_0x407c0d,null));};exports['showWhatsappQueues']=function(_0x20e579,_0x130fe8){return respondWithRpcPromise(_0x7a87('0x56'),_0x20e579[_0x7a87('0x19')],routingClient)['then'](findById(_0x20e579[_0x7a87('0x1c')]['id']))[_0x7a87('0x9')](respondWithResult(_0x130fe8,null))[_0x7a87('0xe')](handleError(_0x130fe8,null));};exports[_0x7a87('0x57')]=function(_0x23d4ce,_0x5c3cef){return respondWithRpcPromise(_0x7a87('0x58'),_0x23d4ce[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](respondWithResult(_0x5c3cef,null))[_0x7a87('0xe')](handleError(_0x5c3cef,null));};exports[_0x7a87('0x59')]=function(_0x3a0565,_0x5549d9){return respondWithRpcPromise('FaxQueues',_0x3a0565[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](findById(_0x3a0565['params']['id']))[_0x7a87('0x9')](respondWithResult(_0x5549d9,null))[_0x7a87('0xe')](handleError(_0x5549d9,null));};exports['faxAccounts']=function(_0x15d8a8,_0x7288e6){return respondWithRpcPromise('FaxAccounts',_0x15d8a8['query'])[_0x7a87('0x9')](respondWithResult(_0x7288e6,null))[_0x7a87('0xe')](handleError(_0x7288e6,null));};exports[_0x7a87('0x5a')]=function(_0xb827ca,_0xd39093){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0xb827ca[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](respondWithResult(_0xd39093,null))[_0x7a87('0xe')](handleError(_0xd39093,null));};exports[_0x7a87('0x5b')]=function(_0x35830f,_0x3136bb){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x35830f[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](respondWithResult(_0x3136bb,null))[_0x7a87('0xe')](handleError(_0x3136bb,null));};exports[_0x7a87('0x5c')]=function(_0x22d6ea,_0xda08f6){return respondWithRpcPromise(_0x7a87('0x5d'),_0x22d6ea[_0x7a87('0x19')],routingClient)['then'](respondWithResult(_0xda08f6,null))[_0x7a87('0xe')](handleError(_0xda08f6,null));};exports[_0x7a87('0x5e')]=function(_0x37035f,_0x57a57a){return respondWithRpcPromise(_0x7a87('0x5d'),_0x37035f[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](function(_0x5c9bc4){if(_0x37035f[_0x7a87('0x19')][_0x7a87('0x5f')]!==undefined){var _0x5a3048=_(_0x5c9bc4[_0x7a87('0x16')])['filter']([_0x37035f[_0x7a87('0x19')][_0x7a87('0x5f')],_0x37035f[_0x7a87('0x1c')]['id']])[_0x7a87('0x60')]('queue_id')[_0x7a87('0x61')]()[_0x7a87('0x62')]();return _0x5c9bc4[_0x7a87('0x16')]['filter'](function(_0x55ae98){return _0x5a3048['indexOf'](_0x55ae98[_0x7a87('0x63')])>-0x1;});}else{return _0x5c9bc4[_0x7a87('0x16')][_0x7a87('0x64')](function(_0x2c5d26){return _0x2c5d26[_0x7a87('0x63')]===parseInt(_0x37035f[_0x7a87('0x1c')]['id']);});}})[_0x7a87('0x9')](respondWithResult(_0x57a57a,null))[_0x7a87('0xe')](handleError(_0x57a57a,null));};exports[_0x7a87('0x65')]=function(_0x2a4ee1,_0x1486dd){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2a4ee1[_0x7a87('0x19')],routingClient)[_0x7a87('0x9')](respondWithResult(_0x1486dd,null))[_0x7a87('0xe')](handleError(_0x1486dd,null));};exports[_0x7a87('0x66')]=function(_0x580101,_0x16114e){return respondWithRpcPromise(_0x7a87('0x67'),_0x580101['query'],routingClient)[_0x7a87('0x9')](respondWithResult(_0x16114e,null))['catch'](handleError(_0x16114e,null));};exports[_0x7a87('0x68')]=function(_0x30b28b,_0x2688e6){return respondWithRpcPromise(_0x7a87('0x69'),_0x30b28b['query'],routingClient)[_0x7a87('0x9')](respondWithResult(_0x2688e6,null))[_0x7a87('0xe')](handleError(_0x2688e6,null));};exports[_0x7a87('0x6a')]=function(_0x4eee93){return function(_0x439b1a,_0x4cc36b){var _0x12c8c1,_0x15c4b1;var _0x40df59=_[_0x7a87('0x6b')](_0x4eee93);var _0x2b12de=_0x4eee93===_0x7a87('0x6c')?'Website':'Account';return db[_0x40df59+_0x7a87('0x6d')][_0x7a87('0x6e')]({'raw':!![],'where':{'id':_0x439b1a[_0x7a87('0x1c')]['id']}})[_0x7a87('0x9')](function(_0x400c02){if(_[_0x7a87('0x15')](_0x400c02)){throw new Error(_0x40df59+_0x7a87('0x6f'));}_0x12c8c1=_0x400c02;return db[_0x40df59+_0x7a87('0x70')][_0x7a87('0x6e')]({'where':{'id':_0x439b1a[_0x7a87('0x25')]['messageId']},'include':[{'model':db[_0x40df59+_0x7a87('0x71')],'as':'Interaction'},{'model':db[_0x40df59+_0x2b12de],'as':_0x7a87('0x72')}]});})[_0x7a87('0x9')](function(_0x481f9a){if(_[_0x7a87('0x15')](_0x481f9a)){throw new Error(_0x40df59+_0x7a87('0x73'));}_0x15c4b1=_0x481f9a;return _0x481f9a[_0x7a87('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7a87('0x9')](function(){var _0x161ed6={'uniqueid':_0x4eee93+'.'+_0x15c4b1['id']+'.'+_0x15c4b1[_0x7a87('0x71')]['id'],'FromUserId':_0x439b1a[_0x7a87('0x34')]['id'],'type':'queue'};_0x161ed6[_0x40df59+_0x7a87('0x75')]=_0x15c4b1['id'];_0x161ed6[_0x40df59+_0x7a87('0x76')]=_0x15c4b1[_0x7a87('0x71')]['id'];_0x161ed6[_0x7a87('0x77')+_0x40df59+_0x2b12de+'Id']=_0x15c4b1[_0x7a87('0x72')]['id'];_0x161ed6['To'+_0x40df59+_0x7a87('0x78')]=_0x12c8c1['id'];return db[_0x40df59+_0x7a87('0x79')][_0x7a87('0x7a')](_0x161ed6);})[_0x7a87('0x9')](function(){return respondWithRpcPromise(_0x7a87('0x7b'),{'channel':_0x4eee93,'interaction':_0x15c4b1[_0x7a87('0x71')],'message':_0x15c4b1,'account':_0x15c4b1[_0x7a87('0x72')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7a87('0x7c'),'appdata':_0x12c8c1[_0x7a87('0x13')]+','+(_0x15c4b1['Account'][_0x7a87('0x7d')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x7a87('0x9')](respondWithResult(_0x4cc36b,null))[_0x7a87('0xe')](handleError(_0x4cc36b,null));};};exports[_0x7a87('0x7e')]=function(_0xcde1c0,_0x111c61){var _0x49a00f,_0x4dbcdf;if(_[_0x7a87('0x15')](_0xcde1c0['body'][_0x7a87('0x7f')])){throw new Error(_0x7a87('0x80'));}var _0x3e8c1b=_0xcde1c0[_0x7a87('0x25')][_0x7a87('0x7f')];var _0x3f9485=_[_0x7a87('0x6b')](_0x3e8c1b);var _0x5de9ba=_0x3e8c1b===_0x7a87('0x6c')?'Website':'Account';return db['User'][_0x7a87('0x6e')]({'raw':!![],'where':{'id':_0xcde1c0[_0x7a87('0x1c')]['id'],'role':_0x7a87('0x40')}})['then'](function(_0x4bd599){if(_[_0x7a87('0x15')](_0x4bd599)){throw new Error(_0x7a87('0x81'));}_0x49a00f=_0x4bd599;return db[_0x3f9485+_0x7a87('0x70')]['findOne']({'where':{'id':_0xcde1c0['body']['messageId']},'include':[{'model':db[_0x3f9485+_0x7a87('0x71')],'as':_0x7a87('0x71')},{'model':db[_0x3f9485+_0x5de9ba],'as':_0x7a87('0x72')}]});})[_0x7a87('0x9')](function(_0x55983a){if(_[_0x7a87('0x15')](_0x55983a)){throw new Error(_0x3f9485+'\x20Message\x20not\x20found');}_0x4dbcdf=_0x55983a;return _0x55983a[_0x7a87('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x7a87('0x9')](function(){var _0x49b3fd={'uniqueid':_0x3e8c1b+'.'+_0x4dbcdf['id']+'.'+_0x4dbcdf[_0x7a87('0x71')]['id'],'FromUserId':_0xcde1c0[_0x7a87('0x34')]['id'],'type':_0x7a87('0x40'),'ToUserId':_0x49a00f['id']};_0x49b3fd[_0x3f9485+_0x7a87('0x75')]=_0x4dbcdf['id'];_0x49b3fd[_0x3f9485+_0x7a87('0x76')]=_0x4dbcdf[_0x7a87('0x71')]['id'];_0x49b3fd[_0x7a87('0x77')+_0x3f9485+_0x5de9ba+'Id']=_0x4dbcdf[_0x7a87('0x72')]['id'];return db[_0x3f9485+_0x7a87('0x79')]['create'](_0x49b3fd);})[_0x7a87('0x9')](function(){return respondWithRpcPromise(_0x7a87('0x7b'),{'channel':_0x3e8c1b,'interaction':_0x4dbcdf['Interaction'],'message':_0x4dbcdf,'account':_0x4dbcdf[_0x7a87('0x72')],'applications':[{'id':0x0,'priority':0x1,'app':_0x7a87('0x40'),'appdata':_0x49a00f[_0x7a87('0x13')]+','+(_0x4dbcdf[_0x7a87('0x72')][_0x7a87('0x82')]||0x12c),'interval':_0x7a87('0x83')}]},routingClient);})[_0x7a87('0x9')](respondWithResult(_0x111c61,null))['catch'](handleError(_0x111c61,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0x5a32e2,_0x21bfaa){var _0x550773=function(_0x37b7e0){while(--_0x37b7e0){_0x5a32e2['push'](_0x5a32e2['shift']());}};_0x550773(++_0x21bfaa);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 102e8c5..3a58505 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 _0xe0c2=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run','run','create','delete','destroy','multer','path','connect-timeout'];(function(_0x5d7c9f,_0x3fa808){var _0x22f332=function(_0x8b0aeb){while(--_0x8b0aeb){_0x5d7c9f['push'](_0x5d7c9f['shift']());}};_0x22f332(++_0x3fa808);}(_0xe0c2,0x95));var _0x2e0c=function(_0x497287,_0x11d321){_0x497287=_0x497287-0x0;var _0x6764a1=_0xe0c2[_0x497287];return _0x6764a1;};'use strict';var multer=require(_0x2e0c('0x0'));var util=require('util');var path=require(_0x2e0c('0x1'));var timeout=require(_0x2e0c('0x2'));var express=require('express');var router=express[_0x2e0c('0x3')]();var fs_extra=require(_0x2e0c('0x4'));var auth=require(_0x2e0c('0x5'));var interaction=require(_0x2e0c('0x6'));var config=require(_0x2e0c('0x7'));var controller=require(_0x2e0c('0x8'));router['get']('/',auth[_0x2e0c('0x9')](),controller[_0x2e0c('0xa')]);router['get'](_0x2e0c('0xb'),auth['isAuthenticated'](),controller[_0x2e0c('0xc')]);router[_0x2e0c('0xd')](_0x2e0c('0xe'),auth[_0x2e0c('0x9')](),controller[_0x2e0c('0xf')]);router['post']('/',auth[_0x2e0c('0x9')](),controller[_0x2e0c('0x10')]);router['put']('/:id',auth[_0x2e0c('0x9')](),controller['update']);router[_0x2e0c('0x11')](_0x2e0c('0xb'),auth[_0x2e0c('0x9')](),controller[_0x2e0c('0x12')]);module['exports']=router; \ No newline at end of file +var _0xe8b4=['show','/:id/run','run','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id'];(function(_0x3fa7d3,_0x37f83c){var _0x4c51bd=function(_0x59e85b){while(--_0x59e85b){_0x3fa7d3['push'](_0x3fa7d3['shift']());}};_0x4c51bd(++_0x37f83c);}(_0xe8b4,0x196));var _0x4e8b=function(_0x29321f,_0x438926){_0x29321f=_0x29321f-0x0;var _0x5435b1=_0xe8b4[_0x29321f];return _0x5435b1;};'use strict';var multer=require(_0x4e8b('0x0'));var util=require(_0x4e8b('0x1'));var path=require(_0x4e8b('0x2'));var timeout=require(_0x4e8b('0x3'));var express=require(_0x4e8b('0x4'));var router=express[_0x4e8b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4e8b('0x6'));var interaction=require(_0x4e8b('0x7'));var config=require(_0x4e8b('0x8'));var controller=require(_0x4e8b('0x9'));router[_0x4e8b('0xa')]('/',auth[_0x4e8b('0xb')](),controller[_0x4e8b('0xc')]);router[_0x4e8b('0xa')](_0x4e8b('0xd'),auth[_0x4e8b('0xb')](),controller[_0x4e8b('0xe')]);router[_0x4e8b('0xa')](_0x4e8b('0xf'),auth[_0x4e8b('0xb')](),controller[_0x4e8b('0x10')]);router['post']('/',auth[_0x4e8b('0xb')](),controller['create']);router[_0x4e8b('0x11')](_0x4e8b('0xd'),auth[_0x4e8b('0xb')](),controller[_0x4e8b('0x12')]);router['delete']('/:id',auth[_0x4e8b('0xb')](),controller[_0x4e8b('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index bb476db..69758c4 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 _0x3f95=['weeks','days','minutes','ENUM','csv','pdf','xlsx','custom','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years'];(function(_0x189d4d,_0x369b2c){var _0x4f6bdc=function(_0x4d69e0){while(--_0x4d69e0){_0x189d4d['push'](_0x189d4d['shift']());}};_0x4f6bdc(++_0x369b2c);}(_0x3f95,0x182));var _0x53f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3f95[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require(_0x53f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x53f9('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x53f9('0x1')]},'active':{'type':Sequelize[_0x53f9('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x53f9('0x1')],'allowNull':![],'defaultValue':_0x53f9('0x3')},'startAt':{'type':Sequelize[_0x53f9('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x53f9('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x53f9('0x5'),'quarters','months',_0x53f9('0x6'),_0x53f9('0x7'),'hours',_0x53f9('0x8')),'allowNull':![],'defaultValue':_0x53f9('0x7')},'output':{'type':Sequelize[_0x53f9('0x9')](_0x53f9('0xa'),_0x53f9('0xb'),_0x53f9('0xc')),'allowNull':![],'defaultValue':_0x53f9('0xa')},'type':{'type':Sequelize[_0x53f9('0x9')](_0x53f9('0xd'),'default'),'allowNull':![],'defaultValue':_0x53f9('0xd')},'sendMail':{'type':Sequelize[_0x53f9('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x53f9('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x53f9('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x83b4=['exports','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','weeks','days','hours','minutes','csv','xlsx','custom','sequelize'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x83b4,0x99));var _0x483b=function(_0x182255,_0x2bd11a){_0x182255=_0x182255-0x0;var _0x50e9db=_0x83b4[_0x182255];return _0x50e9db;};'use strict';var Sequelize=require(_0x483b('0x0'));module[_0x483b('0x1')]={'name':{'type':Sequelize[_0x483b('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x483b('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x483b('0x2')],'allowNull':![],'defaultValue':_0x483b('0x3')},'startAt':{'type':Sequelize[_0x483b('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x483b('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x483b('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x483b('0x6')]('years','quarters','months',_0x483b('0x7'),_0x483b('0x8'),_0x483b('0x9'),_0x483b('0xa')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x483b('0x6')](_0x483b('0xb'),'pdf',_0x483b('0xc')),'allowNull':![],'defaultValue':_0x483b('0xb')},'type':{'type':Sequelize[_0x483b('0x6')](_0x483b('0xd'),'default'),'allowNull':![],'defaultValue':_0x483b('0xd')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x483b('0x2')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 54711fd..57bc3f4 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 _0x6f0c=['ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Scheduler','UserProfileResource','end','stack','name','send','index','Schedule','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','moment','bluebird','mustache','util','path','to-csv'];(function(_0x43556c,_0x9ef7df){var _0x434ebf=function(_0x48d2b5){while(--_0x48d2b5){_0x43556c['push'](_0x43556c['shift']());}};_0x434ebf(++_0x9ef7df);}(_0x6f0c,0x1a1));var _0xc6f0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f0c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc6f0('0x0'));var rimraf=require(_0xc6f0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc6f0('0x2'));var BPromise=require(_0xc6f0('0x3'));var Mustache=require(_0xc6f0('0x4'));var util=require(_0xc6f0('0x5'));var path=require(_0xc6f0('0x6'));var sox=require('sox');var csv=require(_0xc6f0('0x7'));var ejs=require(_0xc6f0('0x8'));var fs=require('fs');var fs_extra=require(_0xc6f0('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc6f0('0xa'));var jsforce=require(_0xc6f0('0xb'));var deskjs=require(_0xc6f0('0xc'));var toCsv=require(_0xc6f0('0x7'));var querystring=require(_0xc6f0('0xd'));var Papa=require(_0xc6f0('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc6f0('0xf'));var as=require(_0xc6f0('0x10'));var hardwareService=require(_0xc6f0('0x11'));var logger=require(_0xc6f0('0x12'))(_0xc6f0('0x13'));var utils=require(_0xc6f0('0x14'));var config=require(_0xc6f0('0x15'));var licenseUtil=require(_0xc6f0('0x16'));var db=require(_0xc6f0('0x17'))['db'];function respondWithStatusCode(_0x4a66a9,_0x16b0d0){_0x16b0d0=_0x16b0d0||0xcc;return function(_0x39063e){if(_0x39063e){return _0x4a66a9[_0xc6f0('0x18')](_0x16b0d0);}return _0x4a66a9[_0xc6f0('0x19')](_0x16b0d0)['end']();};}function respondWithResult(_0x3ae682,_0x529628){_0x529628=_0x529628||0xc8;return function(_0x54e6b9){if(_0x54e6b9){return _0x3ae682[_0xc6f0('0x19')](_0x529628)[_0xc6f0('0x1a')](_0x54e6b9);}};}function respondWithFilteredResult(_0xe41307,_0x2d1427){return function(_0x391c91){if(_0x391c91){var _0x19ae4c=typeof _0x2d1427[_0xc6f0('0x1b')]===_0xc6f0('0x1c')&&typeof _0x2d1427[_0xc6f0('0x1d')]===_0xc6f0('0x1c');var _0x46ae56=_0x391c91[_0xc6f0('0x1e')];var _0x13c50e=_0x19ae4c?0x0:_0x2d1427[_0xc6f0('0x1b')];var _0x4feca=_0x19ae4c?_0x391c91[_0xc6f0('0x1e')]:_0x2d1427[_0xc6f0('0x1b')]+_0x2d1427[_0xc6f0('0x1d')];var _0x3aa3ef;if(_0x4feca>=_0x46ae56){_0x4feca=_0x46ae56;_0x3aa3ef=0xc8;}else{_0x3aa3ef=0xce;}_0xe41307['status'](_0x3aa3ef);return _0xe41307[_0xc6f0('0x1f')](_0xc6f0('0x20'),_0x13c50e+'-'+_0x4feca+'/'+_0x46ae56)['json'](_0x391c91);}return null;};}function patchUpdates(_0x42d810){return function(_0x48d346){try{jsonpatch[_0xc6f0('0x21')](_0x48d346,_0x42d810,!![]);}catch(_0x35af80){return BPromise[_0xc6f0('0x22')](_0x35af80);}return _0x48d346[_0xc6f0('0x23')]();};}function saveUpdates(_0x4a1db8,_0x3cd567){return function(_0x363352){if(_0x363352){return _0x363352['update'](_0x4a1db8)[_0xc6f0('0x24')](function(_0xce1c6f){return _0xce1c6f;});}return null;};}function removeEntity(_0x199a4a,_0xf1d953){return function(_0x421816){if(_0x421816){return _0x421816[_0xc6f0('0x25')]()['then'](function(){var _0x350a28=_0x421816[_0xc6f0('0x26')]({'plain':!![]});var _0x20163c=_0xc6f0('0x27');return db[_0xc6f0('0x28')][_0xc6f0('0x25')]({'where':{'type':_0x20163c,'resourceId':_0x350a28['id']}})['then'](function(){return _0x421816;});})[_0xc6f0('0x24')](function(){_0x199a4a[_0xc6f0('0x19')](0xcc)[_0xc6f0('0x29')]();});}};}function handleEntityNotFound(_0x5780b3,_0xdb6424){return function(_0x4473ae){if(!_0x4473ae){_0x5780b3['sendStatus'](0x194);}return _0x4473ae;};}function handleError(_0x491d37,_0x21f605){_0x21f605=_0x21f605||0x1f4;return function(_0x480a63){logger['error'](_0x480a63[_0xc6f0('0x2a')]);if(_0x480a63[_0xc6f0('0x2b')]){delete _0x480a63[_0xc6f0('0x2b')];}_0x491d37[_0xc6f0('0x19')](_0x21f605)[_0xc6f0('0x2c')](_0x480a63);};}exports[_0xc6f0('0x2d')]=function(_0x59a43d,_0x5e239e){var _0x547083={},_0x1fe783={},_0xf13ae5={'count':0x0,'rows':[]};var _0x3ee3de=_['map'](db[_0xc6f0('0x2e')][_0xc6f0('0x2f')],function(_0x4e9938){return{'name':_0x4e9938[_0xc6f0('0x30')],'type':_0x4e9938[_0xc6f0('0x31')][_0xc6f0('0x32')]};});_0x1fe783[_0xc6f0('0x33')]=_[_0xc6f0('0x34')](_0x3ee3de,'name');_0x1fe783[_0xc6f0('0x35')]=_[_0xc6f0('0x36')](_0x59a43d[_0xc6f0('0x35')]);_0x1fe783[_0xc6f0('0x37')]=_[_0xc6f0('0x38')](_0x1fe783[_0xc6f0('0x33')],_0x1fe783[_0xc6f0('0x35')]);_0x547083[_0xc6f0('0x39')]=_[_0xc6f0('0x38')](_0x1fe783[_0xc6f0('0x33')],qs[_0xc6f0('0x3a')](_0x59a43d['query']['fields']));_0x547083[_0xc6f0('0x39')]=_0x547083[_0xc6f0('0x39')][_0xc6f0('0x3b')]?_0x547083[_0xc6f0('0x39')]:_0x1fe783[_0xc6f0('0x33')];if(!_0x59a43d['query']['hasOwnProperty'](_0xc6f0('0x3c'))){_0x547083['limit']=qs[_0xc6f0('0x1d')](_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x1d')]);_0x547083[_0xc6f0('0x1b')]=qs[_0xc6f0('0x1b')](_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x1b')]);}_0x547083['order']=qs[_0xc6f0('0x3d')](_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x3d')]);_0x547083[_0xc6f0('0x3e')]=qs[_0xc6f0('0x37')](_['pick'](_0x59a43d[_0xc6f0('0x35')],_0x1fe783[_0xc6f0('0x37')]),_0x3ee3de);if(_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x3f')]){_0x547083[_0xc6f0('0x3e')]=_[_0xc6f0('0x40')](_0x547083[_0xc6f0('0x3e')],{'$or':_[_0xc6f0('0x34')](_0x3ee3de,function(_0x2f85a8){if(_0x2f85a8[_0xc6f0('0x31')]!==_0xc6f0('0x41')){var _0x28dc55={};_0x28dc55[_0x2f85a8[_0xc6f0('0x2b')]]={'$like':'%'+_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x3f')]+'%'};return _0x28dc55;}})});}_0x547083=_[_0xc6f0('0x40')]({},_0x547083,_0x59a43d[_0xc6f0('0x42')]);var _0x2776ab={'where':_0x547083[_0xc6f0('0x3e')]};return db[_0xc6f0('0x2e')]['count'](_0x2776ab)['then'](function(_0x5c6157){_0xf13ae5[_0xc6f0('0x1e')]=_0x5c6157;if(_0x59a43d[_0xc6f0('0x35')][_0xc6f0('0x43')]){_0x547083[_0xc6f0('0x44')]=[{'all':!![]}];}return db[_0xc6f0('0x2e')][_0xc6f0('0x45')](_0x547083);})[_0xc6f0('0x24')](function(_0x1ee218){_0xf13ae5[_0xc6f0('0x46')]=_0x1ee218;return _0xf13ae5;})[_0xc6f0('0x24')](respondWithFilteredResult(_0x5e239e,_0x547083))['catch'](handleError(_0x5e239e,null));};exports['show']=function(_0x369a9b,_0x2b0650){var _0x4b4b6a={'raw':![],'where':{'id':_0x369a9b[_0xc6f0('0x47')]['id']}},_0x3f9b5e={};_0x3f9b5e[_0xc6f0('0x33')]=_['keys'](db[_0xc6f0('0x2e')][_0xc6f0('0x2f')]);_0x3f9b5e[_0xc6f0('0x35')]=_[_0xc6f0('0x36')](_0x369a9b[_0xc6f0('0x35')]);_0x3f9b5e['filters']=_['intersection'](_0x3f9b5e[_0xc6f0('0x33')],_0x3f9b5e['query']);_0x4b4b6a[_0xc6f0('0x39')]=_[_0xc6f0('0x38')](_0x3f9b5e[_0xc6f0('0x33')],qs[_0xc6f0('0x3a')](_0x369a9b['query']['fields']));_0x4b4b6a[_0xc6f0('0x39')]=_0x4b4b6a['attributes'][_0xc6f0('0x3b')]?_0x4b4b6a[_0xc6f0('0x39')]:_0x3f9b5e[_0xc6f0('0x33')];if(_0x369a9b[_0xc6f0('0x35')][_0xc6f0('0x43')]){_0x4b4b6a[_0xc6f0('0x44')]=[{'all':!![]}];}_0x4b4b6a=_['merge']({},_0x4b4b6a,_0x369a9b[_0xc6f0('0x42')]);return db['Schedule'][_0xc6f0('0x48')](_0x4b4b6a)['then'](handleEntityNotFound(_0x2b0650,null))[_0xc6f0('0x24')](respondWithResult(_0x2b0650,null))[_0xc6f0('0x49')](handleError(_0x2b0650,null));};exports['create']=function(_0x1fbd34,_0x466a41){return db[_0xc6f0('0x2e')]['create'](_0x1fbd34[_0xc6f0('0x4a')],{})[_0xc6f0('0x24')](function(_0x504032){var _0x4f8ee3=_0x1fbd34['user'][_0xc6f0('0x26')]({'plain':!![]});if(!_0x4f8ee3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4f8ee3[_0xc6f0('0x4b')]===_0xc6f0('0x4c')){var _0x5dda6e=_0x504032[_0xc6f0('0x26')]({'plain':!![]});var _0xeb90bd=_0xc6f0('0x27');return db[_0xc6f0('0x4d')][_0xc6f0('0x48')]({'where':{'name':_0xeb90bd,'userProfileId':_0x4f8ee3[_0xc6f0('0x4e')]},'raw':!![]})[_0xc6f0('0x24')](function(_0x4a9401){if(_0x4a9401&&_0x4a9401[_0xc6f0('0x4f')]===0x0){return db['UserProfileResource'][_0xc6f0('0x50')]({'name':_0x5dda6e['name'],'resourceId':_0x5dda6e['id'],'type':_0x4a9401[_0xc6f0('0x2b')],'sectionId':_0x4a9401['id']},{})[_0xc6f0('0x24')](function(){return _0x504032;});}else{return _0x504032;}})[_0xc6f0('0x49')](function(_0x53bce2){logger['error'](_0xc6f0('0x51'),_0x53bce2);throw _0x53bce2;});}return _0x504032;})[_0xc6f0('0x24')](respondWithResult(_0x466a41,0xc9))['catch'](handleError(_0x466a41,null));};exports[_0xc6f0('0x52')]=function(_0x5bf00a,_0x9317c5){if(_0x5bf00a['body']['id']){delete _0x5bf00a[_0xc6f0('0x4a')]['id'];}return db['Schedule'][_0xc6f0('0x48')]({'where':{'id':_0x5bf00a['params']['id']}})[_0xc6f0('0x24')](handleEntityNotFound(_0x9317c5,null))[_0xc6f0('0x24')](saveUpdates(_0x5bf00a[_0xc6f0('0x4a')],null))['then'](respondWithResult(_0x9317c5,null))[_0xc6f0('0x49')](handleError(_0x9317c5,null));};exports[_0xc6f0('0x25')]=function(_0x373071,_0x1926f5){return db[_0xc6f0('0x2e')][_0xc6f0('0x48')]({'where':{'id':_0x373071[_0xc6f0('0x47')]['id']}})[_0xc6f0('0x24')](handleEntityNotFound(_0x1926f5,null))['then'](removeEntity(_0x1926f5,null))[_0xc6f0('0x49')](handleError(_0x1926f5,null));};exports[_0xc6f0('0x53')]=function(_0xba0d16,_0x498a56,_0x1f1433){var _0x53a299=require(_0xc6f0('0x54'));return db[_0xc6f0('0x2e')][_0xc6f0('0x48')]({'where':{'id':_0xba0d16['params']['id']},'raw':!![]})[_0xc6f0('0x24')](handleEntityNotFound(_0x498a56,null))[_0xc6f0('0x24')](function(){_0x53a299[_0xc6f0('0x53')](_0xba0d16[_0xc6f0('0x47')]['id']);})[_0xc6f0('0x24')](respondWithStatusCode(_0x498a56,null))[_0xc6f0('0x49')](handleError(_0x498a56,null));}; \ No newline at end of file +var _0x6c8e=['lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','then','destroy','get','Scheduler','end','error','stack','send','index','map','Schedule','rawAttributes','type','key','name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x6c8e,0x190));var _0xe6c8=function(_0x52f61,_0x11d7b2){_0x52f61=_0x52f61-0x0;var _0x4afda6=_0x6c8e[_0x52f61];return _0x4afda6;};'use strict';var emlformat=require(_0xe6c8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe6c8('0x1'));var jsonpatch=require(_0xe6c8('0x2'));var rp=require(_0xe6c8('0x3'));var moment=require(_0xe6c8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe6c8('0x5'));var path=require(_0xe6c8('0x6'));var sox=require(_0xe6c8('0x7'));var csv=require('to-csv');var ejs=require(_0xe6c8('0x8'));var fs=require('fs');var fs_extra=require(_0xe6c8('0x9'));var _=require(_0xe6c8('0xa'));var squel=require(_0xe6c8('0xb'));var crypto=require(_0xe6c8('0xc'));var jsforce=require(_0xe6c8('0xd'));var deskjs=require(_0xe6c8('0xe'));var toCsv=require(_0xe6c8('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe6c8('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe6c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6c8('0x12'));var logger=require('../../config/logger')(_0xe6c8('0x13'));var utils=require(_0xe6c8('0x14'));var config=require(_0xe6c8('0x15'));var licenseUtil=require(_0xe6c8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb1d630,_0x5d02db){_0x5d02db=_0x5d02db||0xcc;return function(_0x5f3fc2){if(_0x5f3fc2){return _0xb1d630[_0xe6c8('0x17')](_0x5d02db);}return _0xb1d630[_0xe6c8('0x18')](_0x5d02db)['end']();};}function respondWithResult(_0x5672e7,_0x521d4d){_0x521d4d=_0x521d4d||0xc8;return function(_0x48c48b){if(_0x48c48b){return _0x5672e7[_0xe6c8('0x18')](_0x521d4d)[_0xe6c8('0x19')](_0x48c48b);}};}function respondWithFilteredResult(_0x2d38cb,_0x28f977){return function(_0x141e61){if(_0x141e61){var _0x1c5793=typeof _0x28f977[_0xe6c8('0x1a')]==='undefined'&&typeof _0x28f977[_0xe6c8('0x1b')]==='undefined';var _0x487c15=_0x141e61[_0xe6c8('0x1c')];var _0x468783=_0x1c5793?0x0:_0x28f977[_0xe6c8('0x1a')];var _0x3ee1f7=_0x1c5793?_0x141e61[_0xe6c8('0x1c')]:_0x28f977['offset']+_0x28f977[_0xe6c8('0x1b')];var _0x83a665;if(_0x3ee1f7>=_0x487c15){_0x3ee1f7=_0x487c15;_0x83a665=0xc8;}else{_0x83a665=0xce;}_0x2d38cb[_0xe6c8('0x18')](_0x83a665);return _0x2d38cb[_0xe6c8('0x1d')](_0xe6c8('0x1e'),_0x468783+'-'+_0x3ee1f7+'/'+_0x487c15)['json'](_0x141e61);}return null;};}function patchUpdates(_0x5bb572){return function(_0x2550fd){try{jsonpatch[_0xe6c8('0x1f')](_0x2550fd,_0x5bb572,!![]);}catch(_0x539a28){return BPromise[_0xe6c8('0x20')](_0x539a28);}return _0x2550fd['save']();};}function saveUpdates(_0x500d3b,_0x4221c7){return function(_0x2e6de2){if(_0x2e6de2){return _0x2e6de2['update'](_0x500d3b)[_0xe6c8('0x21')](function(_0x647771){return _0x647771;});}return null;};}function removeEntity(_0xa559ed,_0x10fe1c){return function(_0x1ad634){if(_0x1ad634){return _0x1ad634[_0xe6c8('0x22')]()['then'](function(){var _0x493eb2=_0x1ad634[_0xe6c8('0x23')]({'plain':!![]});var _0x3f7aac=_0xe6c8('0x24');return db['UserProfileResource'][_0xe6c8('0x22')]({'where':{'type':_0x3f7aac,'resourceId':_0x493eb2['id']}})['then'](function(){return _0x1ad634;});})['then'](function(){_0xa559ed[_0xe6c8('0x18')](0xcc)[_0xe6c8('0x25')]();});}};}function handleEntityNotFound(_0x1c82a9,_0x221093){return function(_0x572554){if(!_0x572554){_0x1c82a9[_0xe6c8('0x17')](0x194);}return _0x572554;};}function handleError(_0x58e056,_0x21df6e){_0x21df6e=_0x21df6e||0x1f4;return function(_0x746e00){logger[_0xe6c8('0x26')](_0x746e00[_0xe6c8('0x27')]);if(_0x746e00['name']){delete _0x746e00['name'];}_0x58e056[_0xe6c8('0x18')](_0x21df6e)[_0xe6c8('0x28')](_0x746e00);};}exports[_0xe6c8('0x29')]=function(_0x35a5d7,_0xa8af9f){var _0x4e82c1={},_0x4e4a43={},_0x53b02b={'count':0x0,'rows':[]};var _0x45aa16=_[_0xe6c8('0x2a')](db[_0xe6c8('0x2b')][_0xe6c8('0x2c')],function(_0x9c58b2){return{'name':_0x9c58b2['fieldName'],'type':_0x9c58b2[_0xe6c8('0x2d')][_0xe6c8('0x2e')]};});_0x4e4a43['model']=_[_0xe6c8('0x2a')](_0x45aa16,_0xe6c8('0x2f'));_0x4e4a43[_0xe6c8('0x30')]=_[_0xe6c8('0x31')](_0x35a5d7[_0xe6c8('0x30')]);_0x4e4a43[_0xe6c8('0x32')]=_[_0xe6c8('0x33')](_0x4e4a43[_0xe6c8('0x34')],_0x4e4a43[_0xe6c8('0x30')]);_0x4e82c1['attributes']=_[_0xe6c8('0x33')](_0x4e4a43['model'],qs[_0xe6c8('0x35')](_0x35a5d7[_0xe6c8('0x30')]['fields']));_0x4e82c1[_0xe6c8('0x36')]=_0x4e82c1[_0xe6c8('0x36')][_0xe6c8('0x37')]?_0x4e82c1[_0xe6c8('0x36')]:_0x4e4a43[_0xe6c8('0x34')];if(!_0x35a5d7[_0xe6c8('0x30')]['hasOwnProperty'](_0xe6c8('0x38'))){_0x4e82c1['limit']=qs[_0xe6c8('0x1b')](_0x35a5d7['query'][_0xe6c8('0x1b')]);_0x4e82c1['offset']=qs['offset'](_0x35a5d7['query'][_0xe6c8('0x1a')]);}_0x4e82c1['order']=qs[_0xe6c8('0x39')](_0x35a5d7['query'][_0xe6c8('0x39')]);_0x4e82c1[_0xe6c8('0x3a')]=qs[_0xe6c8('0x32')](_[_0xe6c8('0x3b')](_0x35a5d7[_0xe6c8('0x30')],_0x4e4a43['filters']),_0x45aa16);if(_0x35a5d7[_0xe6c8('0x30')][_0xe6c8('0x3c')]){_0x4e82c1['where']=_['merge'](_0x4e82c1[_0xe6c8('0x3a')],{'$or':_['map'](_0x45aa16,function(_0x3758d4){if(_0x3758d4[_0xe6c8('0x2d')]!=='VIRTUAL'){var _0x1a42ab={};_0x1a42ab[_0x3758d4[_0xe6c8('0x2f')]]={'$like':'%'+_0x35a5d7[_0xe6c8('0x30')][_0xe6c8('0x3c')]+'%'};return _0x1a42ab;}})});}_0x4e82c1=_[_0xe6c8('0x3d')]({},_0x4e82c1,_0x35a5d7['options']);var _0x21755e={'where':_0x4e82c1[_0xe6c8('0x3a')]};return db[_0xe6c8('0x2b')]['count'](_0x21755e)[_0xe6c8('0x21')](function(_0x50504b){_0x53b02b[_0xe6c8('0x1c')]=_0x50504b;if(_0x35a5d7[_0xe6c8('0x30')][_0xe6c8('0x3e')]){_0x4e82c1[_0xe6c8('0x3f')]=[{'all':!![]}];}return db[_0xe6c8('0x2b')][_0xe6c8('0x40')](_0x4e82c1);})[_0xe6c8('0x21')](function(_0x27f2fa){_0x53b02b[_0xe6c8('0x41')]=_0x27f2fa;return _0x53b02b;})[_0xe6c8('0x21')](respondWithFilteredResult(_0xa8af9f,_0x4e82c1))[_0xe6c8('0x42')](handleError(_0xa8af9f,null));};exports['show']=function(_0x5c5a12,_0x155154){var _0x19af4c={'raw':![],'where':{'id':_0x5c5a12[_0xe6c8('0x43')]['id']}},_0x5cb58a={};_0x5cb58a['model']=_[_0xe6c8('0x31')](db[_0xe6c8('0x2b')][_0xe6c8('0x2c')]);_0x5cb58a[_0xe6c8('0x30')]=_[_0xe6c8('0x31')](_0x5c5a12[_0xe6c8('0x30')]);_0x5cb58a[_0xe6c8('0x32')]=_[_0xe6c8('0x33')](_0x5cb58a[_0xe6c8('0x34')],_0x5cb58a[_0xe6c8('0x30')]);_0x19af4c[_0xe6c8('0x36')]=_[_0xe6c8('0x33')](_0x5cb58a[_0xe6c8('0x34')],qs[_0xe6c8('0x35')](_0x5c5a12[_0xe6c8('0x30')]['fields']));_0x19af4c[_0xe6c8('0x36')]=_0x19af4c[_0xe6c8('0x36')][_0xe6c8('0x37')]?_0x19af4c['attributes']:_0x5cb58a[_0xe6c8('0x34')];if(_0x5c5a12[_0xe6c8('0x30')][_0xe6c8('0x3e')]){_0x19af4c[_0xe6c8('0x3f')]=[{'all':!![]}];}_0x19af4c=_[_0xe6c8('0x3d')]({},_0x19af4c,_0x5c5a12[_0xe6c8('0x44')]);return db['Schedule'][_0xe6c8('0x45')](_0x19af4c)[_0xe6c8('0x21')](handleEntityNotFound(_0x155154,null))[_0xe6c8('0x21')](respondWithResult(_0x155154,null))['catch'](handleError(_0x155154,null));};exports[_0xe6c8('0x46')]=function(_0x3fc610,_0x35b346){return db['Schedule'][_0xe6c8('0x46')](_0x3fc610['body'],{})['then'](function(_0x989374){var _0x355ded=_0x3fc610[_0xe6c8('0x47')][_0xe6c8('0x23')]({'plain':!![]});if(!_0x355ded)throw new Error(_0xe6c8('0x48'));if(_0x355ded[_0xe6c8('0x49')]===_0xe6c8('0x47')){var _0x33bae1=_0x989374[_0xe6c8('0x23')]({'plain':!![]});var _0x1c17c5=_0xe6c8('0x24');return db[_0xe6c8('0x4a')][_0xe6c8('0x45')]({'where':{'name':_0x1c17c5,'userProfileId':_0x355ded[_0xe6c8('0x4b')]},'raw':!![]})[_0xe6c8('0x21')](function(_0x5d2954){if(_0x5d2954&&_0x5d2954['autoAssociation']===0x0){return db[_0xe6c8('0x4c')][_0xe6c8('0x46')]({'name':_0x33bae1[_0xe6c8('0x2f')],'resourceId':_0x33bae1['id'],'type':_0x5d2954['name'],'sectionId':_0x5d2954['id']},{})[_0xe6c8('0x21')](function(){return _0x989374;});}else{return _0x989374;}})[_0xe6c8('0x42')](function(_0x2a8084){logger[_0xe6c8('0x26')](_0xe6c8('0x4d'),_0x2a8084);throw _0x2a8084;});}return _0x989374;})['then'](respondWithResult(_0x35b346,0xc9))['catch'](handleError(_0x35b346,null));};exports[_0xe6c8('0x4e')]=function(_0x452141,_0x6facc3){if(_0x452141[_0xe6c8('0x4f')]['id']){delete _0x452141[_0xe6c8('0x4f')]['id'];}return db['Schedule'][_0xe6c8('0x45')]({'where':{'id':_0x452141[_0xe6c8('0x43')]['id']}})[_0xe6c8('0x21')](handleEntityNotFound(_0x6facc3,null))['then'](saveUpdates(_0x452141[_0xe6c8('0x4f')],null))['then'](respondWithResult(_0x6facc3,null))[_0xe6c8('0x42')](handleError(_0x6facc3,null));};exports[_0xe6c8('0x22')]=function(_0x2e1054,_0x25f535){return db[_0xe6c8('0x2b')][_0xe6c8('0x45')]({'where':{'id':_0x2e1054[_0xe6c8('0x43')]['id']}})['then'](handleEntityNotFound(_0x25f535,null))[_0xe6c8('0x21')](removeEntity(_0x25f535,null))[_0xe6c8('0x42')](handleError(_0x25f535,null));};exports[_0xe6c8('0x50')]=function(_0x4f1230,_0x590044,_0xa1e8fb){var _0x1374fd=require(_0xe6c8('0x51'));return db[_0xe6c8('0x2b')][_0xe6c8('0x45')]({'where':{'id':_0x4f1230[_0xe6c8('0x43')]['id']},'raw':!![]})[_0xe6c8('0x21')](handleEntityNotFound(_0x590044,null))[_0xe6c8('0x21')](function(){_0x1374fd[_0xe6c8('0x50')](_0x4f1230[_0xe6c8('0x43')]['id']);})[_0xe6c8('0x21')](respondWithStatusCode(_0x590044,null))[_0xe6c8('0x42')](handleError(_0x590044,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index c9cf59d..e361296 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 _0xd507=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./schedule.attributes','define','Schedule','lodash','util'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xd507,0xc4));var _0x7d50=function(_0x189ae8,_0x593c29){_0x189ae8=_0x189ae8-0x0;var _0xa49cab=_0xd507[_0x189ae8];return _0xa49cab;};'use strict';var _=require(_0x7d50('0x0'));var util=require(_0x7d50('0x1'));var logger=require(_0x7d50('0x2'))(_0x7d50('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7d50('0x4'));var fs=require('fs');var path=require(_0x7d50('0x5'));var rimraf=require(_0x7d50('0x6'));var config=require(_0x7d50('0x7'));var attributes=require(_0x7d50('0x8'));module['exports']=function(_0x48826f,_0x39198a){return _0x48826f[_0x7d50('0x9')](_0x7d50('0xa'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc311=['define','Schedule','tools_schedules','util','../../config/logger','moment','rimraf','../../config/environment','./schedule.attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc311,0x147));var _0x1c31=function(_0x58dc87,_0x3f22d1){_0x58dc87=_0x58dc87-0x0;var _0xb8ec8=_0xc311[_0x58dc87];return _0xb8ec8;};'use strict';var _=require('lodash');var util=require(_0x1c31('0x0'));var logger=require(_0x1c31('0x1'))('api');var moment=require(_0x1c31('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1c31('0x3'));var config=require(_0x1c31('0x4'));var attributes=require(_0x1c31('0x5'));module['exports']=function(_0x4cb570,_0x4e8771){return _0x4cb570[_0x1c31('0x6')](_0x1c31('0x7'),attributes,{'tableName':_0x1c31('0x8'),'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 3733499..4944a13 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 _0xa8c2=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x2fb9d8,_0x23d76d){var _0x3765bf=function(_0xed059a){while(--_0xed059a){_0x2fb9d8['push'](_0x2fb9d8['shift']());}};_0x3765bf(++_0x23d76d);}(_0xa8c2,0x19a));var _0x2a8c=function(_0x421e4e,_0x41b11d){_0x421e4e=_0x421e4e-0x0;var _0x287010=_0xa8c2[_0x421e4e];return _0x287010;};'use strict';var _=require(_0x2a8c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a8c('0x1'));var rs=require(_0x2a8c('0x2'));var fs=require('fs');var Redis=require(_0x2a8c('0x3'));var db=require(_0x2a8c('0x4'))['db'];var utils=require(_0x2a8c('0x5'));var logger=require(_0x2a8c('0x6'))(_0x2a8c('0x7'));var config=require(_0x2a8c('0x8'));var jayson=require(_0x2a8c('0x9'));var client=jayson[_0x2a8c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x355497,_0x5b822a,_0x44c569){return new BPromise(function(_0x47c28f,_0x4dd53a){return client[_0x2a8c('0xb')](_0x355497,_0x44c569)[_0x2a8c('0xc')](function(_0x1943b4){logger[_0x2a8c('0xd')](_0x2a8c('0xe'),_0x5b822a,_0x2a8c('0xf'));logger[_0x2a8c('0x10')]('Schedule,\x20%s,\x20%s,\x20%s',_0x5b822a,_0x2a8c('0xf'),JSON[_0x2a8c('0x11')](_0x1943b4));if(_0x1943b4[_0x2a8c('0x12')]){if(_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x13')]===0x1f4){logger[_0x2a8c('0x12')]('Schedule,\x20%s,\x20%s',_0x5b822a,_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x14')]);return _0x4dd53a(_0x1943b4['error'][_0x2a8c('0x14')]);}logger[_0x2a8c('0x12')](_0x2a8c('0xe'),_0x5b822a,_0x1943b4[_0x2a8c('0x12')]['message']);return _0x47c28f(_0x1943b4[_0x2a8c('0x12')][_0x2a8c('0x14')]);}else{logger['info'](_0x2a8c('0xe'),_0x5b822a,_0x2a8c('0xf'));_0x47c28f(_0x1943b4[_0x2a8c('0x15')]['message']);}})[_0x2a8c('0x16')](function(_0x2cb633){logger[_0x2a8c('0x12')](_0x2a8c('0xe'),_0x5b822a,_0x2cb633);_0x4dd53a(_0x2cb633);});});} \ No newline at end of file +var _0x1793=['../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x57c7e1,_0xaf5b8f){var _0x5c1e08=function(_0x4f6cf6){while(--_0x4f6cf6){_0x57c7e1['push'](_0x57c7e1['shift']());}};_0x5c1e08(++_0xaf5b8f);}(_0x1793,0x1af));var _0x3179=function(_0x1385dc,_0x2c7fd7){_0x1385dc=_0x1385dc-0x0;var _0x2f6469=_0x1793[_0x1385dc];return _0x2f6469;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var moment=require(_0x3179('0x2'));var BPromise=require('bluebird');var rs=require(_0x3179('0x3'));var fs=require('fs');var Redis=require(_0x3179('0x4'));var db=require(_0x3179('0x5'))['db'];var utils=require(_0x3179('0x6'));var logger=require(_0x3179('0x7'))(_0x3179('0x8'));var config=require(_0x3179('0x9'));var jayson=require(_0x3179('0xa'));var client=jayson[_0x3179('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3251,_0x2ca6ca,_0x56a688){return new BPromise(function(_0x37e737,_0x551ba8){return client['request'](_0x4c3251,_0x56a688)['then'](function(_0x437862){logger[_0x3179('0xc')]('Schedule,\x20%s,\x20%s',_0x2ca6ca,_0x3179('0xd'));logger[_0x3179('0xe')]('Schedule,\x20%s,\x20%s,\x20%s',_0x2ca6ca,_0x3179('0xd'),JSON[_0x3179('0xf')](_0x437862));if(_0x437862['error']){if(_0x437862[_0x3179('0x10')][_0x3179('0x11')]===0x1f4){logger[_0x3179('0x10')]('Schedule,\x20%s,\x20%s',_0x2ca6ca,_0x437862[_0x3179('0x10')][_0x3179('0x12')]);return _0x551ba8(_0x437862[_0x3179('0x10')][_0x3179('0x12')]);}logger[_0x3179('0x10')](_0x3179('0x13'),_0x2ca6ca,_0x437862['error'][_0x3179('0x12')]);return _0x37e737(_0x437862[_0x3179('0x10')][_0x3179('0x12')]);}else{logger[_0x3179('0xc')](_0x3179('0x13'),_0x2ca6ca,'request\x20sent');_0x37e737(_0x437862[_0x3179('0x14')][_0x3179('0x12')]);}})[_0x3179('0x15')](function(_0x310885){logger[_0x3179('0x10')](_0x3179('0x13'),_0x2ca6ca,_0x310885);_0x551ba8(_0x310885);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 307e60a..a4d4d67 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 _0xa4ad=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./screenRecording.controller','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','post','put','update','delete'];(function(_0x1b8f52,_0x111226){var _0x17c536=function(_0x3cbea5){while(--_0x3cbea5){_0x1b8f52['push'](_0x1b8f52['shift']());}};_0x17c536(++_0x111226);}(_0xa4ad,0x80));var _0xda4a=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xa4ad[_0x18d631];return _0x50d708;};'use strict';var multer=require(_0xda4a('0x0'));var util=require('util');var path=require(_0xda4a('0x1'));var timeout=require(_0xda4a('0x2'));var express=require(_0xda4a('0x3'));var router=express[_0xda4a('0x4')]();var fs_extra=require(_0xda4a('0x5'));var auth=require(_0xda4a('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xda4a('0x7'));router[_0xda4a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda4a('0x8')](_0xda4a('0x9'),auth[_0xda4a('0xa')](),controller[_0xda4a('0xb')]);router[_0xda4a('0x8')](_0xda4a('0xc'),auth[_0xda4a('0xa')](),controller[_0xda4a('0xd')]);router[_0xda4a('0x8')](_0xda4a('0xe'),auth['isAuthenticated'](),controller['download']);router[_0xda4a('0xf')]('/',auth[_0xda4a('0xa')](),controller['create']);router[_0xda4a('0x10')](_0xda4a('0xc'),auth[_0xda4a('0xa')](),controller[_0xda4a('0x11')]);router[_0xda4a('0x12')](_0xda4a('0xc'),auth[_0xda4a('0xa')](),controller[_0xda4a('0x13')]);module[_0xda4a('0x14')]=router; \ No newline at end of file +var _0xb77a=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','/describe','describe','get','/:id','show','download','post','create','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x45cb2b,_0x285349){var _0x9411a6=function(_0x15da36){while(--_0x15da36){_0x45cb2b['push'](_0x45cb2b['shift']());}};_0x9411a6(++_0x285349);}(_0xb77a,0x11b));var _0xab77=function(_0x556e80,_0x5cde84){_0x556e80=_0x556e80-0x0;var _0x432c6e=_0xb77a[_0x556e80];return _0x432c6e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab77('0x0'));var timeout=require(_0xab77('0x1'));var express=require(_0xab77('0x2'));var router=express[_0xab77('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xab77('0x4'));var interaction=require(_0xab77('0x5'));var config=require(_0xab77('0x6'));var controller=require(_0xab77('0x7'));router['get']('/',auth[_0xab77('0x8')](),controller[_0xab77('0x9')]);router['get'](_0xab77('0xa'),auth[_0xab77('0x8')](),controller[_0xab77('0xb')]);router[_0xab77('0xc')](_0xab77('0xd'),auth[_0xab77('0x8')](),controller[_0xab77('0xe')]);router[_0xab77('0xc')]('/:id/download',auth[_0xab77('0x8')](),controller[_0xab77('0xf')]);router[_0xab77('0x10')]('/',auth[_0xab77('0x8')](),controller[_0xab77('0x11')]);router['put'](_0xab77('0xd'),auth['isAuthenticated'](),controller[_0xab77('0x12')]);router[_0xab77('0x13')](_0xab77('0xd'),auth[_0xab77('0x8')](),controller[_0xab77('0x14')]);module[_0xab77('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 8e4b48e..aaae4fa 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 _0xc00b=['exports','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize'];(function(_0x3275cf,_0x3f56b2){var _0x3015b6=function(_0x4ac0cd){while(--_0x4ac0cd){_0x3275cf['push'](_0x3275cf['shift']());}};_0x3015b6(++_0x3f56b2);}(_0xc00b,0x1e5));var _0xbc00=function(_0x430095,_0x122722){_0x430095=_0x430095-0x0;var _0x115f8a=_0xc00b[_0x430095];return _0x115f8a;};'use strict';var Sequelize=require(_0xbc00('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xbc00('0x1')]={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbc00('0x2')](_0xbc00('0x3'))?path[_0xbc00('0x4')](this[_0xbc00('0x2')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xbc00('0x5')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xbc00('0x5')],'set':function(_0x5362c6){var _0x378982=_0x5362c6[_0xbc00('0x6')](/\\/g,'/');this[_0xbc00('0x7')](_0xbc00('0x3'),_0x378982);}},'rating':{'type':Sequelize[_0xbc00('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xbc00('0x8')],'set':function(_0x51a669){this[_0xbc00('0x7')]('startedAt',moment()[_0xbc00('0x9')](_0x51a669,'ms'));this[_0xbc00('0x7')](_0xbc00('0xa'),moment());this['setDataValue'](_0xbc00('0xb'),_0x51a669);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbc00('0x2')]('startedAt'))[_0xbc00('0xc')](_0xbc00('0xd'))[_0xbc00('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbc00('0x2')](_0xbc00('0xa')))[_0xbc00('0xc')]('MM-DD-YYYY\x20HH:mm')[_0xbc00('0xe')]();}},'createdAt':{'type':Sequelize[_0xbc00('0xf')],'get':function(){return moment(this['getDataValue'](_0xbc00('0x10')))[_0xbc00('0xc')](_0xbc00('0xd'))[_0xbc00('0xe')]();}},'updatedAt':{'type':Sequelize[_0xbc00('0xf')],'get':function(){return moment(this[_0xbc00('0x2')](_0xbc00('0x11')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}}}; \ No newline at end of file +var _0x3f2e=['startedAt','subtract','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','sequelize','path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','setDataValue','INTEGER'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3f2e,0x9d));var _0xe3f2=function(_0x3d5db9,_0x2dbe0a){_0x3d5db9=_0x3d5db9-0x0;var _0x3c114c=_0x3f2e[_0x3d5db9];return _0x3c114c;};'use strict';var Sequelize=require(_0xe3f2('0x0'));var moment=require('moment');var path=require(_0xe3f2('0x1'));var config=require(_0xe3f2('0x2'));module[_0xe3f2('0x3')]={'format':{'type':Sequelize[_0xe3f2('0x4')],'get':function(){return this[_0xe3f2('0x5')](_0xe3f2('0x6'))?path[_0xe3f2('0x7')](this['getDataValue'](_0xe3f2('0x6'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe3f2('0x8')]},'value':{'type':Sequelize[_0xe3f2('0x8')],'set':function(_0x4fc4d9){var _0x48aafe=_0x4fc4d9['replace'](/\\/g,'/');this[_0xe3f2('0x9')](_0xe3f2('0x6'),_0x48aafe);}},'rating':{'type':Sequelize[_0xe3f2('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xe3f2('0xa')],'set':function(_0x577609){this['setDataValue'](_0xe3f2('0xb'),moment()[_0xe3f2('0xc')](_0x577609,'ms'));this[_0xe3f2('0x9')](_0xe3f2('0xd'),moment());this[_0xe3f2('0x9')](_0xe3f2('0xe'),_0x577609);}},'startedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this[_0xe3f2('0x5')](_0xe3f2('0xb')))[_0xe3f2('0x10')](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}},'closedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this['getDataValue'](_0xe3f2('0xd')))[_0xe3f2('0x10')](_0xe3f2('0x11'))['toString']();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xe3f2('0x13')))['format'](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}},'updatedAt':{'type':Sequelize[_0xe3f2('0xf')],'get':function(){return moment(this['getDataValue'](_0xe3f2('0x14')))[_0xe3f2('0x10')](_0xe3f2('0x11'))[_0xe3f2('0x12')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index efa6231..5a1be5a 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 _0x81bd=['Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','type','model','differenceBy','format','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','duration','closedAt','value','params','describe','download','../../components/encryptor','uniqueid','root','%s.cypher','existsSync','secrets','recording','join','server/files/screen_recordings'];(function(_0x29f665,_0x28b5df){var _0x4624f8=function(_0x252541){while(--_0x252541){_0x29f665['push'](_0x29f665['shift']());}};_0x4624f8(++_0x28b5df);}(_0x81bd,0x7c));var _0xd81b=function(_0x2c341e,_0x414d11){_0x2c341e=_0x2c341e-0x0;var _0x43c1e8=_0x81bd[_0x2c341e];return _0x43c1e8;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2ccedf,_0x1bf351){return function(_0x596389){if(!_0x596389){_0x2ccedf[_0xd81b('0x1b')](0x194);}return _0x596389;};}function handleError(_0x99dbc9,_0xe3637a){_0xe3637a=_0xe3637a||0x1f4;return function(_0x31b9fd){logger[_0xd81b('0x2a')](_0x31b9fd[_0xd81b('0x2b')]);if(_0x31b9fd[_0xd81b('0x2c')]){delete _0x31b9fd[_0xd81b('0x2c')];}_0x99dbc9[_0xd81b('0x1d')](_0xe3637a)['send'](_0x31b9fd);};}exports[_0xd81b('0x2d')]=function(_0x4e2eff,_0x5c8aee){var _0xb9ff9f={},_0x260310={},_0x5141e6={'count':0x0,'rows':[]};var _0x481454=_[_0xd81b('0x2e')](db[_0xd81b('0x2f')][_0xd81b('0x30')],function(_0x289f54){return{'name':_0x289f54[_0xd81b('0x31')],'type':_0x289f54[_0xd81b('0x32')]['key']};});_0x260310[_0xd81b('0x33')]=_[_0xd81b('0x34')](_['map'](_0x481454,'name'),[_0xd81b('0x35')]);_0x260310[_0xd81b('0x36')]=_['keys'](_0x4e2eff['query']);_0x260310['filters']=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],_0x260310[_0xd81b('0x36')]);_0xb9ff9f[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x260310[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x4e2eff['query'][_0xd81b('0x39')]));_0xb9ff9f['attributes']=_0xb9ff9f[_0xd81b('0x38')][_0xd81b('0x3a')]?_0xb9ff9f[_0xd81b('0x38')]:_0x260310[_0xd81b('0x33')];if(!_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x3b')](_0xd81b('0x3c'))){_0xb9ff9f[_0xd81b('0x20')]=qs[_0xd81b('0x20')](_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x20')]);_0xb9ff9f[_0xd81b('0x22')]=qs[_0xd81b('0x22')](_0x4e2eff['query']['offset']);}_0xb9ff9f[_0xd81b('0x3d')]=qs[_0xd81b('0x3e')](_0x4e2eff[_0xd81b('0x36')]['sort']);_0xb9ff9f[_0xd81b('0x3f')]=qs[_0xd81b('0x40')](_['pick'](_0x4e2eff[_0xd81b('0x36')],_0x260310[_0xd81b('0x40')]),_0x481454);if(_0x4e2eff['query'][_0xd81b('0x41')]){_0xb9ff9f['where']=_[_0xd81b('0x42')](_0xb9ff9f[_0xd81b('0x3f')],{'$or':_[_0xd81b('0x2e')](_0x481454,function(_0x3f6deb){if(_0x3f6deb['type']!==_0xd81b('0x43')){var _0x3444d4={};_0x3444d4[_0x3f6deb[_0xd81b('0x2c')]]={'$like':'%'+_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x41')]+'%'};return _0x3444d4;}})});}_0xb9ff9f=_[_0xd81b('0x42')]({},_0xb9ff9f,_0x4e2eff[_0xd81b('0x44')]);var _0x532ada={'where':_0xb9ff9f[_0xd81b('0x3f')]};return db[_0xd81b('0x2f')][_0xd81b('0x21')](_0x532ada)['then'](function(_0x3bea7d){_0x5141e6[_0xd81b('0x21')]=_0x3bea7d;if(_0x4e2eff[_0xd81b('0x36')][_0xd81b('0x45')]){_0xb9ff9f[_0xd81b('0x46')]=[{'all':!![]}];}return db['ScreenRecording'][_0xd81b('0x47')](_0xb9ff9f);})[_0xd81b('0x28')](function(_0x448e24){_0x5141e6[_0xd81b('0x48')]=_0x448e24;return _0x5141e6;})[_0xd81b('0x28')](respondWithFilteredResult(_0x5c8aee,_0xb9ff9f))[_0xd81b('0x49')](handleError(_0x5c8aee,null));};exports[_0xd81b('0x4a')]=function(_0x486f0d,_0x4405a8){var _0x3ba339={'raw':![],'where':{'id':_0x486f0d['params']['id']}},_0x1e3690={};_0x1e3690[_0xd81b('0x33')]=_[_0xd81b('0x4b')](db[_0xd81b('0x2f')][_0xd81b('0x30')]);_0x1e3690[_0xd81b('0x36')]=_[_0xd81b('0x4b')](_0x486f0d[_0xd81b('0x36')]);_0x1e3690[_0xd81b('0x40')]=_['intersection'](_0x1e3690['model'],_0x1e3690[_0xd81b('0x36')]);_0x3ba339[_0xd81b('0x38')]=_[_0xd81b('0x37')](_0x1e3690[_0xd81b('0x33')],qs[_0xd81b('0x39')](_0x486f0d[_0xd81b('0x36')][_0xd81b('0x39')]));_0x3ba339[_0xd81b('0x38')]=_0x3ba339[_0xd81b('0x38')][_0xd81b('0x3a')]?_0x3ba339[_0xd81b('0x38')]:_0x1e3690[_0xd81b('0x33')];if(_0x486f0d['query'][_0xd81b('0x45')]){_0x3ba339[_0xd81b('0x46')]=[{'all':!![]}];}_0x3ba339=_[_0xd81b('0x42')]({},_0x3ba339,_0x486f0d[_0xd81b('0x44')]);return db[_0xd81b('0x2f')][_0xd81b('0x4c')](_0x3ba339)[_0xd81b('0x28')](handleEntityNotFound(_0x4405a8,null))[_0xd81b('0x28')](respondWithResult(_0x4405a8,null))[_0xd81b('0x49')](handleError(_0x4405a8,null));};exports['create']=function(_0xf401e0,_0x2368dd){return db[_0xd81b('0x2f')][_0xd81b('0x4d')](_0xf401e0['body'],{})[_0xd81b('0x28')](respondWithResult(_0x2368dd,0xc9))[_0xd81b('0x49')](handleError(_0x2368dd,null));};exports[_0xd81b('0x27')]=function(_0xe874b6,_0x2699e6){if(_0xe874b6[_0xd81b('0x4e')]['id']){delete _0xe874b6[_0xd81b('0x4e')]['id'];}delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x4f')];delete _0xe874b6['body']['createdAt'];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x50')];delete _0xe874b6[_0xd81b('0x4e')][_0xd81b('0x51')];return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0xe874b6[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2699e6,null))['then'](saveUpdates(_0xe874b6[_0xd81b('0x4e')],null))[_0xd81b('0x28')](respondWithResult(_0x2699e6,null))[_0xd81b('0x49')](handleError(_0x2699e6,null));};exports[_0xd81b('0x53')]=function(_0x4651d3,_0x59b13b){return db[_0xd81b('0x2f')][_0xd81b('0x53')]()['then'](respondWithResult(_0x59b13b,null))[_0xd81b('0x49')](handleError(_0x59b13b,null));};exports[_0xd81b('0x54')]=function(_0x100319,_0x3b7ed7,_0x21cd71){var _0xa366c8=require(_0xd81b('0x55'));var _0x22f588=![];var _0x3ed626={};if(_0x100319[_0xd81b('0x36')][_0xd81b('0x32')]&&_0x100319['query'][_0xd81b('0x32')]==='uniqueid'){_0x3ed626[_0xd81b('0x56')]=_0x100319[_0xd81b('0x52')]['id'];}else{_0x3ed626['id']=_0x100319[_0xd81b('0x52')]['id'];}return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':_0x3ed626,'attributes':['id',_0xd81b('0x51')],'raw':!![]})['then'](handleEntityNotFound(_0x3b7ed7,null))[_0xd81b('0x28')](function(_0xe0c9c6){if(_0xe0c9c6){var _0x51f5a1=path['join'](config[_0xd81b('0x57')],'server/files/screen_recordings',_0xe0c9c6[_0xd81b('0x51')]);var _0x51f066=util[_0xd81b('0x35')](_0xd81b('0x58'),_0x51f5a1);if(fs[_0xd81b('0x59')](_0x51f066)){_0x22f588=!![];return _0xa366c8['decryptFile'](_0x51f066,_0x51f5a1,config[_0xd81b('0x5a')][_0xd81b('0x5b')])['then'](function(){return _0xe0c9c6;});}return _0xe0c9c6;}})[_0xd81b('0x28')](function(_0x108aaf){if(_0x108aaf){var _0x5951ec=path[_0xd81b('0x5c')](config['root'],_0xd81b('0x5d'),_0x108aaf[_0xd81b('0x51')]);if(!fs[_0xd81b('0x59')](_0x5951ec)){throw new db[(_0xd81b('0x5e'))][(_0xd81b('0x5f'))](_0xd81b('0x60'));}if(_0x108aaf[_0xd81b('0x61')]){return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,_0x108aaf[_0xd81b('0x61')]+path[_0xd81b('0x62')](_0x5951ec),function(){if(_0x22f588){fs['unlink'](_0x5951ec);}});}else{return _0x3b7ed7[_0xd81b('0x54')](_0x5951ec,function(_0x434434){if(_0x22f588){fs[_0xd81b('0x63')](_0x5951ec);}});}}})[_0xd81b('0x49')](function(_0x1bdf37){if(_0x1bdf37[_0xd81b('0x64')]===_0xd81b('0x60')){_0x3b7ed7['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x3b7ed7,null);}});};exports[_0xd81b('0x29')]=function(_0x12b0bf,_0x37507e){return db[_0xd81b('0x2f')][_0xd81b('0x4c')]({'where':{'id':_0x12b0bf[_0xd81b('0x52')]['id']}})[_0xd81b('0x28')](function(_0x5afecf){if(_[_0xd81b('0x65')](_0x5afecf)){throw new ReferenceError(_0xd81b('0x66'));}return _0x5afecf;})[_0xd81b('0x28')](function(_0x2090e9){var _0x41719b=path[_0xd81b('0x5c')](config[_0xd81b('0x57')],'server/files/screen_recordings',_0x2090e9[_0xd81b('0x51')]);logger[_0xd81b('0x67')](_0xd81b('0x68'),_0x41719b);if(!_[_0xd81b('0x65')](_0x2090e9[_0xd81b('0x51')])&&fs[_0xd81b('0x59')](_0x41719b)){logger[_0xd81b('0x67')](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}_0x41719b=_0x41719b+_0xd81b('0x6c');if(!_[_0xd81b('0x65')](_0x2090e9['value'])&&fs[_0xd81b('0x59')](_0x41719b)){logger['info'](_0xd81b('0x69')+_0x41719b+_0xd81b('0x6a'));fs[_0xd81b('0x6b')](_0x41719b);}return _0x2090e9;})[_0xd81b('0x28')](function(_0xb94a69){if(!_0xb94a69)throw new InternalError();return _0xb94a69[_0xd81b('0x29')]();})[_0xd81b('0x28')](function(){_0x37507e[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();})[_0xd81b('0x49')](handleError(_0x37507e,null));}; \ No newline at end of file +var _0x33c5=['download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','show','params','include','find','catch','create','body','duration','createdAt','closedAt','value','describe'];(function(_0x14ed89,_0x3aafa8){var _0x371e65=function(_0x4f8905){while(--_0x4f8905){_0x14ed89['push'](_0x14ed89['shift']());}};_0x371e65(++_0x3aafa8);}(_0x33c5,0xe6));var _0x533c=function(_0x2cd1e4,_0x23d906){_0x2cd1e4=_0x2cd1e4-0x0;var _0x167374=_0x33c5[_0x2cd1e4];return _0x167374;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x533c('0x0'));var zipdir=require(_0x533c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x533c('0x2'));var moment=require(_0x533c('0x3'));var BPromise=require(_0x533c('0x4'));var Mustache=require(_0x533c('0x5'));var util=require(_0x533c('0x6'));var path=require('path');var sox=require(_0x533c('0x7'));var csv=require(_0x533c('0x8'));var ejs=require(_0x533c('0x9'));var fs=require('fs');var fs_extra=require(_0x533c('0xa'));var _=require(_0x533c('0xb'));var squel=require(_0x533c('0xc'));var crypto=require(_0x533c('0xd'));var jsforce=require(_0x533c('0xe'));var deskjs=require(_0x533c('0xf'));var toCsv=require(_0x533c('0x8'));var querystring=require(_0x533c('0x10'));var Papa=require(_0x533c('0x11'));var Redis=require(_0x533c('0x12'));var authService=require(_0x533c('0x13'));var qs=require(_0x533c('0x14'));var as=require(_0x533c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x533c('0x16'))(_0x533c('0x17'));var utils=require(_0x533c('0x18'));var config=require(_0x533c('0x19'));var licenseUtil=require(_0x533c('0x1a'));var db=require(_0x533c('0x1b'))['db'];function respondWithStatusCode(_0x530e10,_0x5c9462){_0x5c9462=_0x5c9462||0xcc;return function(_0xf93007){if(_0xf93007){return _0x530e10[_0x533c('0x1c')](_0x5c9462);}return _0x530e10[_0x533c('0x1d')](_0x5c9462)[_0x533c('0x1e')]();};}function respondWithResult(_0x1a2a83,_0x8d7c66){_0x8d7c66=_0x8d7c66||0xc8;return function(_0xa616ca){if(_0xa616ca){return _0x1a2a83['status'](_0x8d7c66)[_0x533c('0x1f')](_0xa616ca);}};}function respondWithFilteredResult(_0x7c1d33,_0x3f4a5c){return function(_0x3e544f){if(_0x3e544f){var _0x56dfb7=typeof _0x3f4a5c[_0x533c('0x20')]===_0x533c('0x21')&&typeof _0x3f4a5c[_0x533c('0x22')]===_0x533c('0x21');var _0x2854ab=_0x3e544f[_0x533c('0x23')];var _0x1f0a72=_0x56dfb7?0x0:_0x3f4a5c[_0x533c('0x20')];var _0x1f9f85=_0x56dfb7?_0x3e544f[_0x533c('0x23')]:_0x3f4a5c[_0x533c('0x20')]+_0x3f4a5c[_0x533c('0x22')];var _0x78dd72;if(_0x1f9f85>=_0x2854ab){_0x1f9f85=_0x2854ab;_0x78dd72=0xc8;}else{_0x78dd72=0xce;}_0x7c1d33[_0x533c('0x1d')](_0x78dd72);return _0x7c1d33[_0x533c('0x24')](_0x533c('0x25'),_0x1f0a72+'-'+_0x1f9f85+'/'+_0x2854ab)[_0x533c('0x1f')](_0x3e544f);}return null;};}function patchUpdates(_0x2bc58f){return function(_0x4ba0bd){try{jsonpatch[_0x533c('0x26')](_0x4ba0bd,_0x2bc58f,!![]);}catch(_0x51785c){return BPromise['reject'](_0x51785c);}return _0x4ba0bd[_0x533c('0x27')]();};}function saveUpdates(_0x36d4e4,_0x5f5090){return function(_0x21dfd3){if(_0x21dfd3){return _0x21dfd3[_0x533c('0x28')](_0x36d4e4)[_0x533c('0x29')](function(_0x3dd249){return _0x3dd249;});}return null;};}function removeEntity(_0x5ebbe0,_0x3762f7){return function(_0x42c87b){if(_0x42c87b){return _0x42c87b[_0x533c('0x2a')]()[_0x533c('0x29')](function(){_0x5ebbe0[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();});}};}function handleEntityNotFound(_0xb51a5,_0x43f669){return function(_0xb1c937){if(!_0xb1c937){_0xb51a5[_0x533c('0x1c')](0x194);}return _0xb1c937;};}function handleError(_0x4d47d0,_0x11d775){_0x11d775=_0x11d775||0x1f4;return function(_0xfab4da){logger['error'](_0xfab4da[_0x533c('0x2b')]);if(_0xfab4da['name']){delete _0xfab4da[_0x533c('0x2c')];}_0x4d47d0[_0x533c('0x1d')](_0x11d775)[_0x533c('0x2d')](_0xfab4da);};}exports[_0x533c('0x2e')]=function(_0x425f60,_0x146a8e){var _0x212d1b={},_0x38d886={},_0x3c559b={'count':0x0,'rows':[]};var _0x2fc7fa=_[_0x533c('0x2f')](db[_0x533c('0x30')]['rawAttributes'],function(_0x370263){return{'name':_0x370263['fieldName'],'type':_0x370263[_0x533c('0x31')][_0x533c('0x32')]};});_0x38d886[_0x533c('0x33')]=_[_0x533c('0x34')](_[_0x533c('0x2f')](_0x2fc7fa,_0x533c('0x2c')),[_0x533c('0x35')]);_0x38d886[_0x533c('0x36')]=_[_0x533c('0x37')](_0x425f60[_0x533c('0x36')]);_0x38d886[_0x533c('0x38')]=_[_0x533c('0x39')](_0x38d886[_0x533c('0x33')],_0x38d886[_0x533c('0x36')]);_0x212d1b[_0x533c('0x3a')]=_['intersection'](_0x38d886[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x425f60[_0x533c('0x36')][_0x533c('0x3b')]));_0x212d1b['attributes']=_0x212d1b[_0x533c('0x3a')][_0x533c('0x3c')]?_0x212d1b[_0x533c('0x3a')]:_0x38d886[_0x533c('0x33')];if(!_0x425f60[_0x533c('0x36')]['hasOwnProperty']('nolimit')){_0x212d1b['limit']=qs['limit'](_0x425f60['query'][_0x533c('0x22')]);_0x212d1b['offset']=qs[_0x533c('0x20')](_0x425f60['query'][_0x533c('0x20')]);}_0x212d1b[_0x533c('0x3d')]=qs[_0x533c('0x3e')](_0x425f60['query'][_0x533c('0x3e')]);_0x212d1b[_0x533c('0x3f')]=qs[_0x533c('0x38')](_['pick'](_0x425f60[_0x533c('0x36')],_0x38d886[_0x533c('0x38')]),_0x2fc7fa);if(_0x425f60[_0x533c('0x36')]['filter']){_0x212d1b[_0x533c('0x3f')]=_[_0x533c('0x40')](_0x212d1b[_0x533c('0x3f')],{'$or':_[_0x533c('0x2f')](_0x2fc7fa,function(_0x454dbc){if(_0x454dbc[_0x533c('0x31')]!==_0x533c('0x41')){var _0x2dbd81={};_0x2dbd81[_0x454dbc[_0x533c('0x2c')]]={'$like':'%'+_0x425f60[_0x533c('0x36')][_0x533c('0x42')]+'%'};return _0x2dbd81;}})});}_0x212d1b=_['merge']({},_0x212d1b,_0x425f60[_0x533c('0x43')]);var _0x784493={'where':_0x212d1b[_0x533c('0x3f')]};return db[_0x533c('0x30')][_0x533c('0x23')](_0x784493)[_0x533c('0x29')](function(_0x5d2bf9){_0x3c559b[_0x533c('0x23')]=_0x5d2bf9;if(_0x425f60[_0x533c('0x36')][_0x533c('0x44')]){_0x212d1b['include']=[{'all':!![]}];}return db[_0x533c('0x30')][_0x533c('0x45')](_0x212d1b);})[_0x533c('0x29')](function(_0x1abd47){_0x3c559b['rows']=_0x1abd47;return _0x3c559b;})[_0x533c('0x29')](respondWithFilteredResult(_0x146a8e,_0x212d1b))['catch'](handleError(_0x146a8e,null));};exports[_0x533c('0x46')]=function(_0x39034e,_0x55a372){var _0x3f4015={'raw':![],'where':{'id':_0x39034e[_0x533c('0x47')]['id']}},_0x3f1e47={};_0x3f1e47['model']=_['keys'](db['ScreenRecording']['rawAttributes']);_0x3f1e47[_0x533c('0x36')]=_['keys'](_0x39034e[_0x533c('0x36')]);_0x3f1e47['filters']=_[_0x533c('0x39')](_0x3f1e47['model'],_0x3f1e47[_0x533c('0x36')]);_0x3f4015[_0x533c('0x3a')]=_['intersection'](_0x3f1e47[_0x533c('0x33')],qs[_0x533c('0x3b')](_0x39034e[_0x533c('0x36')][_0x533c('0x3b')]));_0x3f4015[_0x533c('0x3a')]=_0x3f4015['attributes'][_0x533c('0x3c')]?_0x3f4015[_0x533c('0x3a')]:_0x3f1e47[_0x533c('0x33')];if(_0x39034e[_0x533c('0x36')]['includeAll']){_0x3f4015[_0x533c('0x48')]=[{'all':!![]}];}_0x3f4015=_[_0x533c('0x40')]({},_0x3f4015,_0x39034e['options']);return db['ScreenRecording'][_0x533c('0x49')](_0x3f4015)['then'](handleEntityNotFound(_0x55a372,null))[_0x533c('0x29')](respondWithResult(_0x55a372,null))[_0x533c('0x4a')](handleError(_0x55a372,null));};exports[_0x533c('0x4b')]=function(_0x471c59,_0xe9354a){return db[_0x533c('0x30')][_0x533c('0x4b')](_0x471c59[_0x533c('0x4c')],{})['then'](respondWithResult(_0xe9354a,0xc9))[_0x533c('0x4a')](handleError(_0xe9354a,null));};exports[_0x533c('0x28')]=function(_0xaaf682,_0x57c6c6){if(_0xaaf682[_0x533c('0x4c')]['id']){delete _0xaaf682[_0x533c('0x4c')]['id'];}delete _0xaaf682['body'][_0x533c('0x4d')];delete _0xaaf682['body'][_0x533c('0x4e')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x4f')];delete _0xaaf682[_0x533c('0x4c')][_0x533c('0x50')];return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0xaaf682['params']['id']}})[_0x533c('0x29')](handleEntityNotFound(_0x57c6c6,null))[_0x533c('0x29')](saveUpdates(_0xaaf682[_0x533c('0x4c')],null))[_0x533c('0x29')](respondWithResult(_0x57c6c6,null))[_0x533c('0x4a')](handleError(_0x57c6c6,null));};exports[_0x533c('0x51')]=function(_0x3eb174,_0x50d5a2){return db['ScreenRecording']['describe']()['then'](respondWithResult(_0x50d5a2,null))[_0x533c('0x4a')](handleError(_0x50d5a2,null));};exports[_0x533c('0x52')]=function(_0x5c5dd0,_0xac086b,_0x1da579){var _0x2f6794=require('../../components/encryptor');var _0x1de19e=![];var _0x564a31={};if(_0x5c5dd0['query'][_0x533c('0x31')]&&_0x5c5dd0[_0x533c('0x36')][_0x533c('0x31')]===_0x533c('0x53')){_0x564a31[_0x533c('0x53')]=_0x5c5dd0[_0x533c('0x47')]['id'];}else{_0x564a31['id']=_0x5c5dd0[_0x533c('0x47')]['id'];}return db['ScreenRecording'][_0x533c('0x49')]({'where':_0x564a31,'attributes':['id','value'],'raw':!![]})[_0x533c('0x29')](handleEntityNotFound(_0xac086b,null))[_0x533c('0x29')](function(_0x274686){if(_0x274686){var _0x2c7600=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x274686[_0x533c('0x50')]);var _0x58f528=util[_0x533c('0x35')](_0x533c('0x57'),_0x2c7600);if(fs[_0x533c('0x58')](_0x58f528)){_0x1de19e=!![];return _0x2f6794[_0x533c('0x59')](_0x58f528,_0x2c7600,config[_0x533c('0x5a')][_0x533c('0x5b')])['then'](function(){return _0x274686;});}return _0x274686;}})[_0x533c('0x29')](function(_0x554a9f){if(_0x554a9f){var _0x43383e=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0x554a9f[_0x533c('0x50')]);if(!fs[_0x533c('0x58')](_0x43383e)){throw new db['Sequelize']['ValidationError'](_0x533c('0x5c'));}if(_0x554a9f[_0x533c('0x5d')]){return _0xac086b[_0x533c('0x52')](_0x43383e,_0x554a9f[_0x533c('0x5d')]+path['extname'](_0x43383e),function(){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}else{return _0xac086b[_0x533c('0x52')](_0x43383e,function(_0x8e04c7){if(_0x1de19e){fs[_0x533c('0x5e')](_0x43383e);}});}}})[_0x533c('0x4a')](function(_0x2f2863){if(_0x2f2863[_0x533c('0x5f')]===_0x533c('0x5c')){_0xac086b[_0x533c('0x1d')](0x194)[_0x533c('0x2d')](_0x533c('0x60'));}else{return handleError(_0xac086b,null);}});};exports[_0x533c('0x2a')]=function(_0x13a7f2,_0xea6ea2){return db[_0x533c('0x30')][_0x533c('0x49')]({'where':{'id':_0x13a7f2[_0x533c('0x47')]['id']}})['then'](function(_0x31bba1){if(_['isNil'](_0x31bba1)){throw new ReferenceError('Entity\x20not\x20found');}return _0x31bba1;})[_0x533c('0x29')](function(_0xb23f94){var _0x965b85=path[_0x533c('0x54')](config[_0x533c('0x55')],_0x533c('0x56'),_0xb23f94[_0x533c('0x50')]);logger['info'](_0x533c('0x61'),_0x965b85);if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')](_0x533c('0x64')+_0x965b85+_0x533c('0x65'));fs['unlinkSync'](_0x965b85);}_0x965b85=_0x965b85+_0x533c('0x66');if(!_[_0x533c('0x62')](_0xb23f94['value'])&&fs[_0x533c('0x58')](_0x965b85)){logger[_0x533c('0x63')]('File:\x20\x22'+_0x965b85+_0x533c('0x65'));fs[_0x533c('0x67')](_0x965b85);}return _0xb23f94;})['then'](function(_0x444f46){if(!_0x444f46)throw new InternalError();return _0x444f46['destroy']();})['then'](function(){_0xea6ea2[_0x533c('0x1d')](0xcc)[_0x533c('0x1e')]();})[_0x533c('0x4a')](handleError(_0xea6ea2,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index db31265..e8184fc 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 _0x719d=['../../config/environment','./screenRecording.attributes','exports','ScreenRecording','screen_recordings','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x455dde,_0x1402b7){var _0x48e181=function(_0x53a68b){while(--_0x53a68b){_0x455dde['push'](_0x455dde['shift']());}};_0x48e181(++_0x1402b7);}(_0x719d,0x125));var _0xd719=function(_0x335ff9,_0x16d2ec){_0x335ff9=_0x335ff9-0x0;var _0x39df05=_0x719d[_0x335ff9];return _0x39df05;};'use strict';var _=require(_0xd719('0x0'));var util=require('util');var logger=require(_0xd719('0x1'))(_0xd719('0x2'));var moment=require(_0xd719('0x3'));var BPromise=require('bluebird');var rp=require(_0xd719('0x4'));var fs=require('fs');var path=require(_0xd719('0x5'));var rimraf=require(_0xd719('0x6'));var config=require(_0xd719('0x7'));var attributes=require(_0xd719('0x8'));module[_0xd719('0x9')]=function(_0x156071,_0x202651){return _0x156071['define'](_0xd719('0xa'),attributes,{'tableName':_0xd719('0xb'),'paranoid':![],'indexes':[{'name':'interactionid','fields':['interactionid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x144f=['path','rimraf','../../config/environment','exports','define','screen_recordings','interactionid','api','request-promise'];(function(_0x47e45e,_0x1b62ce){var _0x363f37=function(_0x5a6c8e){while(--_0x5a6c8e){_0x47e45e['push'](_0x47e45e['shift']());}};_0x363f37(++_0x1b62ce);}(_0x144f,0xa9));var _0xf144=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x144f[_0x16b9ed];return _0x66b1f8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf144('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf144('0x1'));var fs=require('fs');var path=require(_0xf144('0x2'));var rimraf=require(_0xf144('0x3'));var config=require(_0xf144('0x4'));var attributes=require('./screenRecording.attributes');module[_0xf144('0x5')]=function(_0x20726e,_0x571193){return _0x20726e[_0xf144('0x6')]('ScreenRecording',attributes,{'tableName':_0xf144('0x7'),'paranoid':![],'indexes':[{'name':_0xf144('0x8'),'fields':[_0xf144('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a4d3a5d..349bb35 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 _0x1f99=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f99,0x125));var _0x91f9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1f99[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x91f9('0x0'));var util=require(_0x91f9('0x1'));var moment=require(_0x91f9('0x2'));var BPromise=require(_0x91f9('0x3'));var rs=require(_0x91f9('0x4'));var fs=require('fs');var Redis=require(_0x91f9('0x5'));var db=require(_0x91f9('0x6'))['db'];var utils=require(_0x91f9('0x7'));var logger=require(_0x91f9('0x8'))(_0x91f9('0x9'));var config=require(_0x91f9('0xa'));var jayson=require('jayson/promise');var client=jayson['client'][_0x91f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40e090,_0x285357,_0xca3b7c){return new BPromise(function(_0x46d6da,_0x3c2647){return client[_0x91f9('0xc')](_0x40e090,_0xca3b7c)[_0x91f9('0xd')](function(_0x32a2f7){logger['info'](_0x91f9('0xe'),_0x285357,_0x91f9('0xf'));logger[_0x91f9('0x10')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x285357,'request\x20sent',JSON['stringify'](_0x32a2f7));if(_0x32a2f7['error']){if(_0x32a2f7[_0x91f9('0x11')][_0x91f9('0x12')]===0x1f4){logger['error'](_0x91f9('0xe'),_0x285357,_0x32a2f7[_0x91f9('0x11')][_0x91f9('0x13')]);return _0x3c2647(_0x32a2f7[_0x91f9('0x11')][_0x91f9('0x13')]);}logger[_0x91f9('0x11')](_0x91f9('0xe'),_0x285357,_0x32a2f7[_0x91f9('0x11')][_0x91f9('0x13')]);return _0x46d6da(_0x32a2f7['error'][_0x91f9('0x13')]);}else{logger['info'](_0x91f9('0xe'),_0x285357,_0x91f9('0xf'));_0x46d6da(_0x32a2f7[_0x91f9('0x14')][_0x91f9('0x13')]);}})['catch'](function(_0x372b59){logger[_0x91f9('0x11')](_0x91f9('0xe'),_0x285357,_0x372b59);_0x3c2647(_0x372b59);});});} \ No newline at end of file +var _0xf37b=['lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x1f52ea,_0x1dd436){var _0x2d4b16=function(_0x3cee20){while(--_0x3cee20){_0x1f52ea['push'](_0x1f52ea['shift']());}};_0x2d4b16(++_0x1dd436);}(_0xf37b,0x1b8));var _0xbf37=function(_0x34eb31,_0x8f0f70){_0x34eb31=_0x34eb31-0x0;var _0x254994=_0xf37b[_0x34eb31];return _0x254994;};'use strict';var _=require(_0xbf37('0x0'));var util=require(_0xbf37('0x1'));var moment=require(_0xbf37('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf37('0x3'));var fs=require('fs');var Redis=require(_0xbf37('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf37('0x5'));var logger=require('../../config/logger')(_0xbf37('0x6'));var config=require(_0xbf37('0x7'));var jayson=require(_0xbf37('0x8'));var client=jayson[_0xbf37('0x9')][_0xbf37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1ced72,_0x65e335,_0x1f3004){return new BPromise(function(_0x4f4282,_0x48311f){return client[_0xbf37('0xb')](_0x1ced72,_0x1f3004)['then'](function(_0x22de7d){logger[_0xbf37('0xc')](_0xbf37('0xd'),_0x65e335,_0xbf37('0xe'));logger[_0xbf37('0xf')](_0xbf37('0x10'),_0x65e335,'request\x20sent',JSON['stringify'](_0x22de7d));if(_0x22de7d[_0xbf37('0x11')]){if(_0x22de7d[_0xbf37('0x11')][_0xbf37('0x12')]===0x1f4){logger[_0xbf37('0x11')](_0xbf37('0xd'),_0x65e335,_0x22de7d[_0xbf37('0x11')][_0xbf37('0x13')]);return _0x48311f(_0x22de7d[_0xbf37('0x11')][_0xbf37('0x13')]);}logger['error'](_0xbf37('0xd'),_0x65e335,_0x22de7d[_0xbf37('0x11')]['message']);return _0x4f4282(_0x22de7d[_0xbf37('0x11')]['message']);}else{logger[_0xbf37('0xc')](_0xbf37('0xd'),_0x65e335,_0xbf37('0xe'));_0x4f4282(_0x22de7d[_0xbf37('0x14')]['message']);}})[_0xbf37('0x15')](function(_0x379941){logger[_0xbf37('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x65e335,_0x379941);_0x48311f(_0x379941);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index ffc8fcf..45de63c 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 _0xf986=['/:id/favicon','addFavicon','isAuthenticated','update','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','get','index','/now','/:id','show','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','diskStorage','join','root','server/files/images/logos/','%s%s','logo','extname','post','single','file','addLogo','format','logologin','originalname','addLogoLogin','preferred','addPreferred','favicon'];(function(_0x45c751,_0x522b16){var _0x36e47e=function(_0x40831d){while(--_0x40831d){_0x45c751['push'](_0x45c751['shift']());}};_0x36e47e(++_0x522b16);}(_0xf986,0xb1));var _0x6f98=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf986[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x6f98('0x0'));var util=require('util');var path=require(_0x6f98('0x1'));var timeout=require(_0x6f98('0x2'));var express=require('express');var router=express[_0x6f98('0x3')]();var fs_extra=require(_0x6f98('0x4'));var auth=require(_0x6f98('0x5'));var interaction=require(_0x6f98('0x6'));var config=require('../../config/environment');var controller=require(_0x6f98('0x7'));router[_0x6f98('0x8')]('/',auth['isAuthenticated'](),controller[_0x6f98('0x9')]);router[_0x6f98('0x8')](_0x6f98('0xa'),controller['getDate']);router[_0x6f98('0x8')](_0x6f98('0xb'),controller[_0x6f98('0xc')]);router[_0x6f98('0x8')](_0x6f98('0xd'),controller['getLogo']);router[_0x6f98('0x8')](_0x6f98('0xe'),controller[_0x6f98('0xf')]);router[_0x6f98('0x8')](_0x6f98('0x10'),controller[_0x6f98('0x11')]);router[_0x6f98('0x8')](_0x6f98('0x12'),controller[_0x6f98('0x13')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0x6f98('0x14')]({'destination':function(_0x41a405,_0x221cb2,_0x19ede4){_0x19ede4(null,path[_0x6f98('0x15')](config[_0x6f98('0x16')],_0x6f98('0x17')));},'filename':function(_0x12bc27,_0x5574df,_0x84847f){_0x84847f(null,util['format'](_0x6f98('0x18'),_0x6f98('0x19'),path[_0x6f98('0x1a')](_0x5574df['originalname'])));}})});router[_0x6f98('0x1b')](_0x6f98('0xd'),upload[_0x6f98('0x1c')](_0x6f98('0x1d')),controller[_0x6f98('0x1e')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1315e5,_0x57ba42,_0x54ebcd){_0x54ebcd(null,path[_0x6f98('0x15')](config[_0x6f98('0x16')],_0x6f98('0x17')));},'filename':function(_0x46da41,_0x3abef3,_0x14705a){_0x14705a(null,util[_0x6f98('0x1f')](_0x6f98('0x18'),_0x6f98('0x20'),path[_0x6f98('0x1a')](_0x3abef3[_0x6f98('0x21')])));}})});router[_0x6f98('0x1b')]('/:id/logo_login',upload[_0x6f98('0x1c')](_0x6f98('0x1d')),controller[_0x6f98('0x22')]);var upload=multer({'storage':multer[_0x6f98('0x14')]({'destination':function(_0xf61b09,_0x5e4fb3,_0x5dccd8){_0x5dccd8(null,path[_0x6f98('0x15')](config[_0x6f98('0x16')],_0x6f98('0x17')));},'filename':function(_0x7a7cb9,_0x5d39fe,_0x5d0eda){_0x5d0eda(null,util[_0x6f98('0x1f')](_0x6f98('0x18'),_0x6f98('0x23'),path[_0x6f98('0x1a')](_0x5d39fe[_0x6f98('0x21')])));}})});router[_0x6f98('0x1b')](_0x6f98('0x12'),upload[_0x6f98('0x1c')]('file'),controller[_0x6f98('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4932a6,_0x3cbbb1,_0x715729){_0x715729(null,path[_0x6f98('0x15')](config['root'],_0x6f98('0x17')));},'filename':function(_0x1a536a,_0x2df6d8,_0x2bbee1){_0x2bbee1(null,util[_0x6f98('0x1f')](_0x6f98('0x18'),_0x6f98('0x25'),path[_0x6f98('0x1a')](_0x2df6d8[_0x6f98('0x21')])));}})});router[_0x6f98('0x1b')](_0x6f98('0x26'),upload[_0x6f98('0x1c')]('file'),controller[_0x6f98('0x27')]);router['put'](_0x6f98('0xb'),auth[_0x6f98('0x28')](),controller[_0x6f98('0x29')]);module[_0x6f98('0x2a')]=router; \ No newline at end of file +var _0x20bf=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','post','single','addLogo','logologin','originalname','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','put','/:id','isAuthenticated','update'];(function(_0x103ebb,_0xe27fdf){var _0x31c453=function(_0x584762){while(--_0x584762){_0x103ebb['push'](_0x103ebb['shift']());}};_0x31c453(++_0xe27fdf);}(_0x20bf,0x1e5));var _0xf20b=function(_0x32726e,_0x32d2af){_0x32726e=_0x32726e-0x0;var _0x4e180d=_0x20bf[_0x32726e];return _0x4e180d;};'use strict';var multer=require(_0xf20b('0x0'));var util=require(_0xf20b('0x1'));var path=require(_0xf20b('0x2'));var timeout=require(_0xf20b('0x3'));var express=require('express');var router=express[_0xf20b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf20b('0x5'));var interaction=require(_0xf20b('0x6'));var config=require(_0xf20b('0x7'));var controller=require(_0xf20b('0x8'));router[_0xf20b('0x9')]('/',auth['isAuthenticated'](),controller[_0xf20b('0xa')]);router[_0xf20b('0x9')](_0xf20b('0xb'),controller[_0xf20b('0xc')]);router[_0xf20b('0x9')]('/:id',controller['show']);router['get'](_0xf20b('0xd'),controller[_0xf20b('0xe')]);router[_0xf20b('0x9')](_0xf20b('0xf'),controller[_0xf20b('0x10')]);router[_0xf20b('0x9')](_0xf20b('0x11'),controller['gdpr']);router['get'](_0xf20b('0x12'),controller[_0xf20b('0x13')]);router[_0xf20b('0x9')]('/:id/favicon',controller[_0xf20b('0x14')]);var upload=multer({'storage':multer[_0xf20b('0x15')]({'destination':function(_0x29ea94,_0x2ae182,_0x5b99c2){_0x5b99c2(null,path[_0xf20b('0x16')](config[_0xf20b('0x17')],_0xf20b('0x18')));},'filename':function(_0x54ab43,_0x1add3d,_0x422def){_0x422def(null,util[_0xf20b('0x19')](_0xf20b('0x1a'),'logo',path[_0xf20b('0x1b')](_0x1add3d['originalname'])));}})});router[_0xf20b('0x1c')](_0xf20b('0xd'),upload[_0xf20b('0x1d')]('file'),controller[_0xf20b('0x1e')]);var upload=multer({'storage':multer[_0xf20b('0x15')]({'destination':function(_0x4a5791,_0x534cbf,_0x7b6723){_0x7b6723(null,path['join'](config[_0xf20b('0x17')],_0xf20b('0x18')));},'filename':function(_0x5eef45,_0x1a5f64,_0xbf8fd0){_0xbf8fd0(null,util['format']('%s%s',_0xf20b('0x1f'),path[_0xf20b('0x1b')](_0x1a5f64[_0xf20b('0x20')])));}})});router[_0xf20b('0x1c')](_0xf20b('0xf'),upload[_0xf20b('0x1d')](_0xf20b('0x21')),controller[_0xf20b('0x22')]);var upload=multer({'storage':multer[_0xf20b('0x15')]({'destination':function(_0x14efed,_0x3e2bed,_0x3a4d9f){_0x3a4d9f(null,path['join'](config[_0xf20b('0x17')],_0xf20b('0x18')));},'filename':function(_0x3b602a,_0x4754aa,_0x8eaab8){_0x8eaab8(null,util[_0xf20b('0x19')](_0xf20b('0x1a'),_0xf20b('0x23'),path[_0xf20b('0x1b')](_0x4754aa[_0xf20b('0x20')])));}})});router[_0xf20b('0x1c')](_0xf20b('0x12'),upload['single']('file'),controller[_0xf20b('0x24')]);var upload=multer({'storage':multer[_0xf20b('0x15')]({'destination':function(_0x714254,_0x32e7bc,_0x125b2c){_0x125b2c(null,path[_0xf20b('0x16')](config[_0xf20b('0x17')],_0xf20b('0x18')));},'filename':function(_0x5d7443,_0x31018a,_0x9501e8){_0x9501e8(null,util[_0xf20b('0x19')](_0xf20b('0x1a'),_0xf20b('0x25'),path[_0xf20b('0x1b')](_0x31018a[_0xf20b('0x20')])));}})});router['post']('/:id/favicon',upload[_0xf20b('0x1d')]('file'),controller[_0xf20b('0x26')]);router[_0xf20b('0x27')](_0xf20b('0x28'),auth[_0xf20b('0x29')](),controller[_0xf20b('0x2a')]);module[_0xf20b('0x2b')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 814d6dc..0616537 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(_0x29c3ad,_0x28e4c2){var _0x4868f5=function(_0x2874de){while(--_0x2874de){_0x29c3ad['push'](_0x29c3ad['shift']());}};_0x4868f5(++_0x28e4c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x312f55,_0x5556b0){var _0x540e5d=function(_0x1784f2){while(--_0x1784f2){_0x312f55['push'](_0x312f55['shift']());}};_0x540e5d(++_0x5556b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 fa5fad7..3b12045 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 _0xb903=['filename','logo','find','addLogoLogin','loginLogo','../../config/license/util','server/files/images/logos','getLicense','preferred','defaultLoginLogo','defaultPreferred','existsSync','join','root','default_logo.svg','default','upperFirst','custom','Sequelize','\x20not\x20found','download','getLogoLogin','defaultLogo','toLower','ValidationError','gdpr','securePassword','addPreferred','getPreferred','favicon','defaultFavicon','default_preferred.png','getFavicon','default_favicon.ico','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','then','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','end','name','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','map','VIRTUAL','options','include','findAll','rows','params','includeAll','merge','body','addLogo','file'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb903,0x185));var _0x3b90=function(_0x1d1efa,_0x482cea){_0x1d1efa=_0x1d1efa-0x0;var _0x40d7c9=_0xb903[_0x1d1efa];return _0x40d7c9;};'use strict';var emlformat=require(_0x3b90('0x0'));var rimraf=require(_0x3b90('0x1'));var zipdir=require(_0x3b90('0x2'));var jsonpatch=require(_0x3b90('0x3'));var rp=require('request-promise');var moment=require(_0x3b90('0x4'));var BPromise=require(_0x3b90('0x5'));var Mustache=require(_0x3b90('0x6'));var util=require(_0x3b90('0x7'));var path=require(_0x3b90('0x8'));var sox=require(_0x3b90('0x9'));var csv=require(_0x3b90('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3b90('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3b90('0xc'));var jsforce=require(_0x3b90('0xd'));var deskjs=require(_0x3b90('0xe'));var toCsv=require(_0x3b90('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b90('0xf'));var logger=require(_0x3b90('0x10'))('api');var utils=require(_0x3b90('0x11'));var config=require(_0x3b90('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x3b90('0x13'))['db'];var jayson=require(_0x3b90('0x14'));var client=jayson[_0x3b90('0x15')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5447df,_0x58c4d1,_0x542cb3,_0x492d39){return new BPromise(function(_0x3a0a55,_0x2c72fb){var _0x4824f9=_0x492d39||client;return _0x4824f9['request'](_0x5447df,_0x542cb3)[_0x3b90('0x16')](function(_0x1b6349){logger[_0x3b90('0x17')](_0x3b90('0x18'),_0x58c4d1,_0x3b90('0x19'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x58c4d1,_0x3b90('0x19'),JSON[_0x3b90('0x1a')](_0x1b6349));if(_0x1b6349['error']){if(_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1c')]===0x1f4){logger[_0x3b90('0x1b')](_0x3b90('0x18'),_0x58c4d1,_0x1b6349['error'][_0x3b90('0x1d')]);return _0x2c72fb(_0x1b6349['error'][_0x3b90('0x1d')]);}logger[_0x3b90('0x1b')]('Setting,\x20%s,\x20%s',_0x58c4d1,_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1d')]);return _0x3a0a55(_0x1b6349[_0x3b90('0x1b')][_0x3b90('0x1d')]);}else{logger[_0x3b90('0x17')](_0x3b90('0x18'),_0x58c4d1,_0x3b90('0x19'));_0x3a0a55(_0x1b6349[_0x3b90('0x1e')][_0x3b90('0x1d')]);}})[_0x3b90('0x1f')](function(_0x4e2175){logger[_0x3b90('0x1b')](_0x3b90('0x18'),_0x58c4d1,_0x4e2175);_0x2c72fb(_0x4e2175);});});}function respondWithStatusCode(_0x175b42,_0x7faee){_0x7faee=_0x7faee||0xcc;return function(_0x1227ed){if(_0x1227ed){return _0x175b42[_0x3b90('0x20')](_0x7faee);}return _0x175b42['status'](_0x7faee)['end']();};}function respondWithResult(_0x40955a,_0x29d472){_0x29d472=_0x29d472||0xc8;return function(_0x103324){if(_0x103324){return _0x40955a[_0x3b90('0x21')](_0x29d472)['json'](_0x103324);}};}function respondWithFilteredResult(_0x414462,_0x2936d7){return function(_0x1787d1){if(_0x1787d1){var _0x4caead=typeof _0x2936d7[_0x3b90('0x22')]===_0x3b90('0x23')&&typeof _0x2936d7[_0x3b90('0x24')]===_0x3b90('0x23');var _0x153d7c=_0x1787d1[_0x3b90('0x25')];var _0x4b4d33=_0x4caead?0x0:_0x2936d7[_0x3b90('0x22')];var _0x595ac1=_0x4caead?_0x1787d1[_0x3b90('0x25')]:_0x2936d7[_0x3b90('0x22')]+_0x2936d7[_0x3b90('0x24')];var _0x38eed0;if(_0x595ac1>=_0x153d7c){_0x595ac1=_0x153d7c;_0x38eed0=0xc8;}else{_0x38eed0=0xce;}_0x414462[_0x3b90('0x21')](_0x38eed0);return _0x414462[_0x3b90('0x26')](_0x3b90('0x27'),_0x4b4d33+'-'+_0x595ac1+'/'+_0x153d7c)[_0x3b90('0x28')](_0x1787d1);}return null;};}function patchUpdates(_0x500ceb){return function(_0x4d1f31){try{jsonpatch[_0x3b90('0x29')](_0x4d1f31,_0x500ceb,!![]);}catch(_0x199f73){return BPromise[_0x3b90('0x2a')](_0x199f73);}return _0x4d1f31[_0x3b90('0x2b')]();};}function saveUpdates(_0x522ede,_0x543458){return function(_0xd33ac9){if(_0xd33ac9){return _0xd33ac9[_0x3b90('0x2c')](_0x522ede)[_0x3b90('0x16')](function(_0x4f3ab5){return _0x4f3ab5;});}return null;};}function removeEntity(_0x41bd39,_0x4ca40e){return function(_0x49b4d2){if(_0x49b4d2){return _0x49b4d2[_0x3b90('0x2d')]()[_0x3b90('0x16')](function(){_0x41bd39['status'](0xcc)[_0x3b90('0x2e')]();});}};}function handleEntityNotFound(_0x3d9605,_0x3e30b8){return function(_0x562882){if(!_0x562882){_0x3d9605['sendStatus'](0x194);}return _0x562882;};}function handleError(_0x46c58c,_0x143698){_0x143698=_0x143698||0x1f4;return function(_0x64a5e){logger[_0x3b90('0x1b')](_0x64a5e['stack']);if(_0x64a5e['name']){delete _0x64a5e[_0x3b90('0x2f')];}_0x46c58c[_0x3b90('0x21')](_0x143698)['send'](_0x64a5e);};}exports['index']=function(_0x201712,_0x146bc7){var _0x20416d={},_0x298df6={},_0x5a3266={'count':0x0,'rows':[]};var _0x2154e2=_['map'](db[_0x3b90('0x30')][_0x3b90('0x31')],function(_0x2355bf){return{'name':_0x2355bf[_0x3b90('0x32')],'type':_0x2355bf[_0x3b90('0x33')][_0x3b90('0x34')]};});_0x298df6[_0x3b90('0x35')]=_['map'](_0x2154e2,_0x3b90('0x2f'));_0x298df6[_0x3b90('0x36')]=_[_0x3b90('0x37')](_0x201712[_0x3b90('0x36')]);_0x298df6[_0x3b90('0x38')]=_[_0x3b90('0x39')](_0x298df6[_0x3b90('0x35')],_0x298df6[_0x3b90('0x36')]);_0x20416d[_0x3b90('0x3a')]=_['intersection'](_0x298df6[_0x3b90('0x35')],qs[_0x3b90('0x3b')](_0x201712[_0x3b90('0x36')][_0x3b90('0x3b')]));_0x20416d[_0x3b90('0x3a')]=_0x20416d[_0x3b90('0x3a')][_0x3b90('0x3c')]?_0x20416d[_0x3b90('0x3a')]:_0x298df6[_0x3b90('0x35')];if(!_0x201712[_0x3b90('0x36')][_0x3b90('0x3d')](_0x3b90('0x3e'))){_0x20416d[_0x3b90('0x24')]=qs[_0x3b90('0x24')](_0x201712[_0x3b90('0x36')][_0x3b90('0x24')]);_0x20416d[_0x3b90('0x22')]=qs[_0x3b90('0x22')](_0x201712[_0x3b90('0x36')][_0x3b90('0x22')]);}_0x20416d[_0x3b90('0x3f')]=qs['sort'](_0x201712[_0x3b90('0x36')][_0x3b90('0x40')]);_0x20416d[_0x3b90('0x41')]=qs[_0x3b90('0x38')](_['pick'](_0x201712[_0x3b90('0x36')],_0x298df6['filters']),_0x2154e2);if(_0x201712['query'][_0x3b90('0x42')]){_0x20416d[_0x3b90('0x41')]=_['merge'](_0x20416d[_0x3b90('0x41')],{'$or':_[_0x3b90('0x43')](_0x2154e2,function(_0x2057f5){if(_0x2057f5[_0x3b90('0x33')]!==_0x3b90('0x44')){var _0x3fd5a1={};_0x3fd5a1[_0x2057f5[_0x3b90('0x2f')]]={'$like':'%'+_0x201712[_0x3b90('0x36')][_0x3b90('0x42')]+'%'};return _0x3fd5a1;}})});}_0x20416d=_['merge']({},_0x20416d,_0x201712[_0x3b90('0x45')]);var _0x2e8a90={'where':_0x20416d['where']};return db[_0x3b90('0x30')][_0x3b90('0x25')](_0x2e8a90)[_0x3b90('0x16')](function(_0x1489a2){_0x5a3266[_0x3b90('0x25')]=_0x1489a2;if(_0x201712['query']['includeAll']){_0x20416d[_0x3b90('0x46')]=[{'all':!![]}];}return db['Setting'][_0x3b90('0x47')](_0x20416d);})[_0x3b90('0x16')](function(_0x330002){_0x5a3266[_0x3b90('0x48')]=_0x330002;return _0x5a3266;})[_0x3b90('0x16')](respondWithFilteredResult(_0x146bc7,_0x20416d))['catch'](handleError(_0x146bc7,null));};exports['show']=function(_0x15d262,_0x6bc94a){var _0x9e2ee5={'raw':![],'where':{'id':_0x15d262[_0x3b90('0x49')]['id']}},_0x5d7333={};_0x5d7333[_0x3b90('0x35')]=_[_0x3b90('0x37')](db[_0x3b90('0x30')][_0x3b90('0x31')]);_0x5d7333[_0x3b90('0x36')]=_[_0x3b90('0x37')](_0x15d262[_0x3b90('0x36')]);_0x5d7333[_0x3b90('0x38')]=_['intersection'](_0x5d7333[_0x3b90('0x35')],_0x5d7333[_0x3b90('0x36')]);_0x9e2ee5[_0x3b90('0x3a')]=_['intersection'](_0x5d7333[_0x3b90('0x35')],qs['fields'](_0x15d262[_0x3b90('0x36')][_0x3b90('0x3b')]));_0x9e2ee5[_0x3b90('0x3a')]=_0x9e2ee5['attributes'][_0x3b90('0x3c')]?_0x9e2ee5[_0x3b90('0x3a')]:_0x5d7333['model'];if(_0x15d262['query'][_0x3b90('0x4a')]){_0x9e2ee5[_0x3b90('0x46')]=[{'all':!![]}];}_0x9e2ee5=_[_0x3b90('0x4b')]({},_0x9e2ee5,_0x15d262[_0x3b90('0x45')]);return db['Setting']['find'](_0x9e2ee5)[_0x3b90('0x16')](handleEntityNotFound(_0x6bc94a,null))[_0x3b90('0x16')](respondWithResult(_0x6bc94a,null))[_0x3b90('0x1f')](handleError(_0x6bc94a,null));};exports[_0x3b90('0x2c')]=function(_0x15fe10,_0x4500ed){if(_0x15fe10[_0x3b90('0x4c')]['id']){delete _0x15fe10[_0x3b90('0x4c')]['id'];}return db[_0x3b90('0x30')]['find']({'where':{'id':_0x15fe10[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x4500ed,null))['then'](saveUpdates(_0x15fe10[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x4500ed,null))['catch'](handleError(_0x4500ed,null));};exports[_0x3b90('0x4d')]=function(_0x16c30f,_0x115232,_0x1bada9){if(_0x16c30f[_0x3b90('0x4e')]&&_0x16c30f[_0x3b90('0x4e')][_0x3b90('0x4f')]){_0x16c30f['body'][_0x3b90('0x50')]=_0x16c30f[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x16c30f[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x115232,null))[_0x3b90('0x16')](saveUpdates(_0x16c30f[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x115232,null))[_0x3b90('0x1f')](handleError(_0x115232,null));};exports[_0x3b90('0x52')]=function(_0x176127,_0x15f741,_0x418e36){if(_0x176127['file']&&_0x176127[_0x3b90('0x4e')]['filename']){_0x176127[_0x3b90('0x4c')][_0x3b90('0x53')]=_0x176127[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x176127['params']['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x15f741,null))[_0x3b90('0x16')](saveUpdates(_0x176127[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x15f741,null))[_0x3b90('0x1f')](handleError(_0x15f741,null));};var utilLicense=require(_0x3b90('0x54'));exports['getLogo']=function(_0x49f4bd,_0xa8400,_0xb41920){var _0x536da7=_0x3b90('0x55');var _0x3264ed={'custom':![]};return utilLicense[_0x3b90('0x56')]()[_0x3b90('0x16')](function(_0x2a6c0c){if(_0x2a6c0c){_0x3264ed=_0x2a6c0c;}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x49f4bd[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),'loginLogo',_0x3b90('0x57'),'favicon','defaultLogo',_0x3b90('0x58'),_0x3b90('0x59'),'defaultFavicon'],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0xa8400,null))[_0x3b90('0x16')](function(_0x287be4){if(_0x287be4){var _0x1842f9=_0x287be4[_0x3b90('0x50')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config['root'],_0x536da7,_['toLower'](_0x287be4[_0x3b90('0x50')])))?path['join'](config[_0x3b90('0x5c')],_0x536da7,_['toLower'](_0x287be4[_0x3b90('0x50')])):path['join'](config['root'],_0x536da7,_['toLower'](_0x3b90('0x5d')));var _0x470fe3=_0x3b90('0x5e')+_[_0x3b90('0x5f')](_0x3b90('0x50'));if(_0x287be4[_0x470fe3]||!_0x3264ed[_0x3b90('0x60')]){_0x1842f9=path[_0x3b90('0x5b')](config['root'],_0x536da7,_['toLower']('default_logo.svg'));}if(!fs[_0x3b90('0x5a')](_0x1842f9)){throw new db[(_0x3b90('0x61'))]['ValidationError'](_[_0x3b90('0x5f')](_0x3b90('0x50'))+_0x3b90('0x62'));}return _0xa8400[_0x3b90('0x63')](_0x1842f9);}})[_0x3b90('0x1f')](handleError(_0xa8400,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x64')]=function(_0x89933c,_0x29548f,_0x5ec095){var _0x41100a='server/files/images/logos';var _0x2bbbac={'custom':![]};return utilLicense[_0x3b90('0x56')]()['then'](function(_0x5b34f5){if(_0x5b34f5){_0x2bbbac=_0x5b34f5;}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x89933c[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),'favicon',_0x3b90('0x65'),_0x3b90('0x58'),_0x3b90('0x59'),'defaultFavicon'],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x29548f,null))['then'](function(_0xaec524){if(_0xaec524){var _0x34c02f=_0xaec524[_0x3b90('0x53')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_['toLower'](_0xaec524[_0x3b90('0x53')])))?path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')](_0xaec524[_0x3b90('0x53')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')]('default_loginLogo.svg'));var _0x5f6bf9=_0x3b90('0x5e')+_[_0x3b90('0x5f')](_0x3b90('0x53'));if(_0xaec524[_0x5f6bf9]||!_0x2bbbac[_0x3b90('0x60')]){_0x34c02f=path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x41100a,_[_0x3b90('0x66')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x34c02f)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')]('loginLogo')+_0x3b90('0x62'));}return _0x29548f['download'](_0x34c02f);}})['catch'](handleError(_0x29548f,null));};exports[_0x3b90('0x68')]=function(_0x300d72,_0x2cfcbf){return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x300d72[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x69')]})[_0x3b90('0x16')](respondWithResult(_0x2cfcbf,null))[_0x3b90('0x1f')](handleError(_0x2cfcbf,null));};exports[_0x3b90('0x6a')]=function(_0x1c4424,_0x3a0a51,_0x2e621a){if(_0x1c4424[_0x3b90('0x4e')]&&_0x1c4424[_0x3b90('0x4e')]['filename']){_0x1c4424[_0x3b90('0x4c')][_0x3b90('0x57')]=_0x1c4424['file'][_0x3b90('0x4f')];}return db['Setting'][_0x3b90('0x51')]({'where':{'id':_0x1c4424[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x3a0a51,null))['then'](saveUpdates(_0x1c4424[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x3a0a51,null))[_0x3b90('0x1f')](handleError(_0x3a0a51,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x6b')]=function(_0x15befb,_0x4a167d,_0x14cb4c){var _0xc08310=_0x3b90('0x55');var _0x1bd901={'custom':![]};return utilLicense[_0x3b90('0x56')]()['then'](function(_0x5546af){if(_0x5546af){_0x1bd901=_0x5546af;}return db['Setting'][_0x3b90('0x51')]({'where':{'id':_0x15befb[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),_0x3b90('0x6c'),_0x3b90('0x65'),_0x3b90('0x58'),_0x3b90('0x59'),_0x3b90('0x6d')],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x4a167d,null))['then'](function(_0x4e3516){if(_0x4e3516){var _0x405f12=_0x4e3516[_0x3b90('0x57')]&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x4e3516[_0x3b90('0x57')])))?path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x4e3516[_0x3b90('0x57')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')](_0x3b90('0x6e')));var _0x2790ba=_0x3b90('0x5e')+_[_0x3b90('0x5f')]('preferred');if(_0x4e3516[_0x2790ba]||!_0x1bd901[_0x3b90('0x60')]||!_0x1bd901[_0x3b90('0x57')]){_0x405f12=path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0xc08310,_[_0x3b90('0x66')]('default_preferred.png'));}if(!fs[_0x3b90('0x5a')](_0x405f12)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')](_0x3b90('0x57'))+_0x3b90('0x62'));}return _0x4a167d['download'](_0x405f12);}})[_0x3b90('0x1f')](handleError(_0x4a167d,null));};exports['addFavicon']=function(_0x5ebda5,_0x25b369,_0x29ae3d){if(_0x5ebda5[_0x3b90('0x4e')]&&_0x5ebda5[_0x3b90('0x4e')][_0x3b90('0x4f')]){_0x5ebda5['body'][_0x3b90('0x6c')]=_0x5ebda5[_0x3b90('0x4e')][_0x3b90('0x4f')];}return db[_0x3b90('0x30')][_0x3b90('0x51')]({'where':{'id':_0x5ebda5[_0x3b90('0x49')]['id']}})[_0x3b90('0x16')](handleEntityNotFound(_0x25b369,null))[_0x3b90('0x16')](saveUpdates(_0x5ebda5[_0x3b90('0x4c')],null))[_0x3b90('0x16')](respondWithResult(_0x25b369,null))[_0x3b90('0x1f')](handleError(_0x25b369,null));};var utilLicense=require(_0x3b90('0x54'));exports[_0x3b90('0x6f')]=function(_0x313b07,_0x115aa6,_0x1af0ea){var _0x5f0075=_0x3b90('0x55');var _0x9fcc2={'custom':![]};return utilLicense[_0x3b90('0x56')]()[_0x3b90('0x16')](function(_0x23d3b6){if(_0x23d3b6){_0x9fcc2=_0x23d3b6;}return db[_0x3b90('0x30')]['find']({'where':{'id':_0x313b07[_0x3b90('0x49')]['id']},'attributes':[_0x3b90('0x50'),_0x3b90('0x53'),_0x3b90('0x57'),_0x3b90('0x6c'),'defaultLogo',_0x3b90('0x58'),_0x3b90('0x59'),_0x3b90('0x6d')],'raw':!![]});})[_0x3b90('0x16')](handleEntityNotFound(_0x115aa6,null))['then'](function(_0x52363f){if(_0x52363f){var _0x2b949c=_0x52363f['favicon']&&fs[_0x3b90('0x5a')](path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x5f0075,_[_0x3b90('0x66')](_0x52363f[_0x3b90('0x6c')])))?path['join'](config[_0x3b90('0x5c')],_0x5f0075,_['toLower'](_0x52363f[_0x3b90('0x6c')])):path[_0x3b90('0x5b')](config[_0x3b90('0x5c')],_0x5f0075,_['toLower'](_0x3b90('0x70')));var _0x1ed55e=_0x3b90('0x5e')+_['upperFirst'](_0x3b90('0x6c'));if(_0x52363f[_0x1ed55e]||!_0x9fcc2[_0x3b90('0x60')]){_0x2b949c=path[_0x3b90('0x5b')](config['root'],_0x5f0075,_[_0x3b90('0x66')](_0x3b90('0x70')));}if(!fs[_0x3b90('0x5a')](_0x2b949c)){throw new db[(_0x3b90('0x61'))][(_0x3b90('0x67'))](_[_0x3b90('0x5f')]('favicon')+'\x20not\x20found');}return _0x115aa6['download'](_0x2b949c);}})[_0x3b90('0x1f')](handleError(_0x115aa6,null));};exports['getDate']=function(_0x88a9f3,_0x614c77){var _0x11d805={'offset':moment()[_0x3b90('0x71')]()};_0x11d805[_0x3b90('0x72')]=moment()['utcOffset'](_0x11d805[_0x3b90('0x22')])['format'](_0x3b90('0x73'));return _0x614c77[_0x3b90('0x21')](0xc8)[_0x3b90('0x74')](_0x11d805);}; \ No newline at end of file +var _0x86d5=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','then','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','stack','send','index','map','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Setting','rows','show','params','rawAttributes','find','catch','body','addLogo','file','filename','logo','loginLogo','../../config/license/util','getLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','upperFirst','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','getLicense','existsSync','default_loginLogo.svg','custom','gdpr','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','status','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5cac67,_0x1837d3){var _0x27ce41=function(_0x17910f){while(--_0x17910f){_0x5cac67['push'](_0x5cac67['shift']());}};_0x27ce41(++_0x1837d3);}(_0x86d5,0x71));var _0x586d=function(_0xa9859c,_0x50500d){_0xa9859c=_0xa9859c-0x0;var _0x3e23f9=_0x86d5[_0xa9859c];return _0x3e23f9;};'use strict';var emlformat=require(_0x586d('0x0'));var rimraf=require(_0x586d('0x1'));var zipdir=require(_0x586d('0x2'));var jsonpatch=require(_0x586d('0x3'));var rp=require(_0x586d('0x4'));var moment=require(_0x586d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x586d('0x6'));var util=require(_0x586d('0x7'));var path=require(_0x586d('0x8'));var sox=require(_0x586d('0x9'));var csv=require(_0x586d('0xa'));var ejs=require(_0x586d('0xb'));var fs=require('fs');var fs_extra=require(_0x586d('0xc'));var _=require(_0x586d('0xd'));var squel=require(_0x586d('0xe'));var crypto=require(_0x586d('0xf'));var jsforce=require(_0x586d('0x10'));var deskjs=require(_0x586d('0x11'));var toCsv=require(_0x586d('0xa'));var querystring=require(_0x586d('0x12'));var Papa=require(_0x586d('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x586d('0x14'));var hardwareService=require(_0x586d('0x15'));var logger=require(_0x586d('0x16'))(_0x586d('0x17'));var utils=require(_0x586d('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x586d('0x19'));var client=jayson[_0x586d('0x1a')][_0x586d('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x4d8549,_0x2705ee,_0x47eb8f,_0x3bc516){return new BPromise(function(_0x5b7458,_0x1a873f){var _0x25c6e9=_0x3bc516||client;return _0x25c6e9['request'](_0x4d8549,_0x47eb8f)[_0x586d('0x1c')](function(_0x4f87f9){logger[_0x586d('0x1d')]('Setting,\x20%s,\x20%s',_0x2705ee,_0x586d('0x1e'));logger[_0x586d('0x1f')](_0x586d('0x20'),_0x2705ee,'request\x20sent',JSON[_0x586d('0x21')](_0x4f87f9));if(_0x4f87f9[_0x586d('0x22')]){if(_0x4f87f9[_0x586d('0x22')][_0x586d('0x23')]===0x1f4){logger[_0x586d('0x22')]('Setting,\x20%s,\x20%s',_0x2705ee,_0x4f87f9['error']['message']);return _0x1a873f(_0x4f87f9[_0x586d('0x22')][_0x586d('0x24')]);}logger[_0x586d('0x22')](_0x586d('0x25'),_0x2705ee,_0x4f87f9[_0x586d('0x22')][_0x586d('0x24')]);return _0x5b7458(_0x4f87f9[_0x586d('0x22')][_0x586d('0x24')]);}else{logger[_0x586d('0x1d')](_0x586d('0x25'),_0x2705ee,_0x586d('0x1e'));_0x5b7458(_0x4f87f9['result'][_0x586d('0x24')]);}})['catch'](function(_0x3d3141){logger[_0x586d('0x22')]('Setting,\x20%s,\x20%s',_0x2705ee,_0x3d3141);_0x1a873f(_0x3d3141);});});}function respondWithStatusCode(_0x349636,_0x28c7f4){_0x28c7f4=_0x28c7f4||0xcc;return function(_0x51f0b2){if(_0x51f0b2){return _0x349636[_0x586d('0x26')](_0x28c7f4);}return _0x349636['status'](_0x28c7f4)[_0x586d('0x27')]();};}function respondWithResult(_0x44fb64,_0x1c93cd){_0x1c93cd=_0x1c93cd||0xc8;return function(_0x3ae54a){if(_0x3ae54a){return _0x44fb64['status'](_0x1c93cd)[_0x586d('0x28')](_0x3ae54a);}};}function respondWithFilteredResult(_0x57553e,_0x5ea4ae){return function(_0x59d6ff){if(_0x59d6ff){var _0x44614b=typeof _0x5ea4ae[_0x586d('0x29')]===_0x586d('0x2a')&&typeof _0x5ea4ae[_0x586d('0x2b')]==='undefined';var _0x22b825=_0x59d6ff['count'];var _0xcc5afd=_0x44614b?0x0:_0x5ea4ae[_0x586d('0x29')];var _0x30ca3e=_0x44614b?_0x59d6ff[_0x586d('0x2c')]:_0x5ea4ae['offset']+_0x5ea4ae[_0x586d('0x2b')];var _0x34f83b;if(_0x30ca3e>=_0x22b825){_0x30ca3e=_0x22b825;_0x34f83b=0xc8;}else{_0x34f83b=0xce;}_0x57553e['status'](_0x34f83b);return _0x57553e[_0x586d('0x2d')](_0x586d('0x2e'),_0xcc5afd+'-'+_0x30ca3e+'/'+_0x22b825)[_0x586d('0x28')](_0x59d6ff);}return null;};}function patchUpdates(_0x30681f){return function(_0x386197){try{jsonpatch[_0x586d('0x2f')](_0x386197,_0x30681f,!![]);}catch(_0xd649d6){return BPromise['reject'](_0xd649d6);}return _0x386197[_0x586d('0x30')]();};}function saveUpdates(_0xaff881,_0xc37dad){return function(_0x37c409){if(_0x37c409){return _0x37c409[_0x586d('0x31')](_0xaff881)[_0x586d('0x1c')](function(_0x313980){return _0x313980;});}return null;};}function removeEntity(_0x51b854,_0x10bab6){return function(_0x43efca){if(_0x43efca){return _0x43efca['destroy']()['then'](function(){_0x51b854['status'](0xcc)[_0x586d('0x27')]();});}};}function handleEntityNotFound(_0x123d7b,_0x135449){return function(_0x11e9e3){if(!_0x11e9e3){_0x123d7b[_0x586d('0x26')](0x194);}return _0x11e9e3;};}function handleError(_0x5cc6fd,_0x1d8500){_0x1d8500=_0x1d8500||0x1f4;return function(_0x2177e4){logger[_0x586d('0x22')](_0x2177e4[_0x586d('0x32')]);if(_0x2177e4['name']){delete _0x2177e4['name'];}_0x5cc6fd['status'](_0x1d8500)[_0x586d('0x33')](_0x2177e4);};}exports[_0x586d('0x34')]=function(_0x394e8d,_0xac09c3){var _0x13226a={},_0x564f61={},_0x403b86={'count':0x0,'rows':[]};var _0x1cbbb7=_[_0x586d('0x35')](db['Setting']['rawAttributes'],function(_0x1c97f5){return{'name':_0x1c97f5[_0x586d('0x36')],'type':_0x1c97f5[_0x586d('0x37')][_0x586d('0x38')]};});_0x564f61[_0x586d('0x39')]=_['map'](_0x1cbbb7,_0x586d('0x3a'));_0x564f61[_0x586d('0x3b')]=_[_0x586d('0x3c')](_0x394e8d[_0x586d('0x3b')]);_0x564f61[_0x586d('0x3d')]=_[_0x586d('0x3e')](_0x564f61[_0x586d('0x39')],_0x564f61[_0x586d('0x3b')]);_0x13226a[_0x586d('0x3f')]=_[_0x586d('0x3e')](_0x564f61[_0x586d('0x39')],qs[_0x586d('0x40')](_0x394e8d[_0x586d('0x3b')][_0x586d('0x40')]));_0x13226a[_0x586d('0x3f')]=_0x13226a[_0x586d('0x3f')][_0x586d('0x41')]?_0x13226a[_0x586d('0x3f')]:_0x564f61[_0x586d('0x39')];if(!_0x394e8d['query'][_0x586d('0x42')](_0x586d('0x43'))){_0x13226a[_0x586d('0x2b')]=qs[_0x586d('0x2b')](_0x394e8d[_0x586d('0x3b')][_0x586d('0x2b')]);_0x13226a[_0x586d('0x29')]=qs['offset'](_0x394e8d[_0x586d('0x3b')][_0x586d('0x29')]);}_0x13226a['order']=qs[_0x586d('0x44')](_0x394e8d[_0x586d('0x3b')]['sort']);_0x13226a[_0x586d('0x45')]=qs[_0x586d('0x3d')](_[_0x586d('0x46')](_0x394e8d['query'],_0x564f61[_0x586d('0x3d')]),_0x1cbbb7);if(_0x394e8d[_0x586d('0x3b')][_0x586d('0x47')]){_0x13226a[_0x586d('0x45')]=_[_0x586d('0x48')](_0x13226a[_0x586d('0x45')],{'$or':_[_0x586d('0x35')](_0x1cbbb7,function(_0x4ab21b){if(_0x4ab21b[_0x586d('0x37')]!==_0x586d('0x49')){var _0x1defaf={};_0x1defaf[_0x4ab21b['name']]={'$like':'%'+_0x394e8d[_0x586d('0x3b')][_0x586d('0x47')]+'%'};return _0x1defaf;}})});}_0x13226a=_[_0x586d('0x48')]({},_0x13226a,_0x394e8d[_0x586d('0x4a')]);var _0xa97877={'where':_0x13226a[_0x586d('0x45')]};return db['Setting'][_0x586d('0x2c')](_0xa97877)[_0x586d('0x1c')](function(_0x505abf){_0x403b86['count']=_0x505abf;if(_0x394e8d[_0x586d('0x3b')][_0x586d('0x4b')]){_0x13226a[_0x586d('0x4c')]=[{'all':!![]}];}return db[_0x586d('0x4d')]['findAll'](_0x13226a);})[_0x586d('0x1c')](function(_0x409b3f){_0x403b86[_0x586d('0x4e')]=_0x409b3f;return _0x403b86;})[_0x586d('0x1c')](respondWithFilteredResult(_0xac09c3,_0x13226a))['catch'](handleError(_0xac09c3,null));};exports[_0x586d('0x4f')]=function(_0x495acf,_0x126fd0){var _0x25f107={'raw':![],'where':{'id':_0x495acf[_0x586d('0x50')]['id']}},_0x2af1bf={};_0x2af1bf[_0x586d('0x39')]=_[_0x586d('0x3c')](db['Setting'][_0x586d('0x51')]);_0x2af1bf[_0x586d('0x3b')]=_[_0x586d('0x3c')](_0x495acf[_0x586d('0x3b')]);_0x2af1bf[_0x586d('0x3d')]=_[_0x586d('0x3e')](_0x2af1bf[_0x586d('0x39')],_0x2af1bf[_0x586d('0x3b')]);_0x25f107['attributes']=_[_0x586d('0x3e')](_0x2af1bf[_0x586d('0x39')],qs[_0x586d('0x40')](_0x495acf[_0x586d('0x3b')][_0x586d('0x40')]));_0x25f107['attributes']=_0x25f107[_0x586d('0x3f')][_0x586d('0x41')]?_0x25f107['attributes']:_0x2af1bf[_0x586d('0x39')];if(_0x495acf[_0x586d('0x3b')][_0x586d('0x4b')]){_0x25f107[_0x586d('0x4c')]=[{'all':!![]}];}_0x25f107=_[_0x586d('0x48')]({},_0x25f107,_0x495acf[_0x586d('0x4a')]);return db[_0x586d('0x4d')][_0x586d('0x52')](_0x25f107)[_0x586d('0x1c')](handleEntityNotFound(_0x126fd0,null))[_0x586d('0x1c')](respondWithResult(_0x126fd0,null))[_0x586d('0x53')](handleError(_0x126fd0,null));};exports[_0x586d('0x31')]=function(_0x29453d,_0xa82607){if(_0x29453d[_0x586d('0x54')]['id']){delete _0x29453d[_0x586d('0x54')]['id'];}return db[_0x586d('0x4d')][_0x586d('0x52')]({'where':{'id':_0x29453d[_0x586d('0x50')]['id']}})['then'](handleEntityNotFound(_0xa82607,null))['then'](saveUpdates(_0x29453d['body'],null))[_0x586d('0x1c')](respondWithResult(_0xa82607,null))['catch'](handleError(_0xa82607,null));};exports[_0x586d('0x55')]=function(_0x4c6695,_0x48b2b3,_0x40ecb2){if(_0x4c6695[_0x586d('0x56')]&&_0x4c6695[_0x586d('0x56')][_0x586d('0x57')]){_0x4c6695[_0x586d('0x54')][_0x586d('0x58')]=_0x4c6695[_0x586d('0x56')][_0x586d('0x57')];}return db[_0x586d('0x4d')][_0x586d('0x52')]({'where':{'id':_0x4c6695[_0x586d('0x50')]['id']}})[_0x586d('0x1c')](handleEntityNotFound(_0x48b2b3,null))[_0x586d('0x1c')](saveUpdates(_0x4c6695['body'],null))['then'](respondWithResult(_0x48b2b3,null))[_0x586d('0x53')](handleError(_0x48b2b3,null));};exports['addLogoLogin']=function(_0x27e85b,_0x47e3fb,_0x57e1a9){if(_0x27e85b[_0x586d('0x56')]&&_0x27e85b[_0x586d('0x56')][_0x586d('0x57')]){_0x27e85b[_0x586d('0x54')][_0x586d('0x59')]=_0x27e85b['file'][_0x586d('0x57')];}return db[_0x586d('0x4d')]['find']({'where':{'id':_0x27e85b[_0x586d('0x50')]['id']}})['then'](handleEntityNotFound(_0x47e3fb,null))[_0x586d('0x1c')](saveUpdates(_0x27e85b[_0x586d('0x54')],null))[_0x586d('0x1c')](respondWithResult(_0x47e3fb,null))['catch'](handleError(_0x47e3fb,null));};var utilLicense=require(_0x586d('0x5a'));exports[_0x586d('0x5b')]=function(_0x4cd26d,_0x3f3af0,_0x498ab9){var _0xe3702=_0x586d('0x5c');var _0x9461ea={'custom':![]};return utilLicense['getLicense']()[_0x586d('0x1c')](function(_0xf36a23){if(_0xf36a23){_0x9461ea=_0xf36a23;}return db['Setting'][_0x586d('0x52')]({'where':{'id':_0x4cd26d['params']['id']},'attributes':[_0x586d('0x58'),_0x586d('0x59'),_0x586d('0x5d'),_0x586d('0x5e'),_0x586d('0x5f'),_0x586d('0x60'),_0x586d('0x61'),_0x586d('0x62')],'raw':!![]});})[_0x586d('0x1c')](handleEntityNotFound(_0x3f3af0,null))[_0x586d('0x1c')](function(_0x360730){if(_0x360730){var _0x3ae7df=_0x360730[_0x586d('0x58')]&&fs['existsSync'](path[_0x586d('0x63')](config[_0x586d('0x64')],_0xe3702,_['toLower'](_0x360730['logo'])))?path[_0x586d('0x63')](config[_0x586d('0x64')],_0xe3702,_[_0x586d('0x65')](_0x360730[_0x586d('0x58')])):path['join'](config[_0x586d('0x64')],_0xe3702,_['toLower'](_0x586d('0x66')));var _0x327c35=_0x586d('0x67')+_[_0x586d('0x68')](_0x586d('0x58'));if(_0x360730[_0x327c35]||!_0x9461ea['custom']){_0x3ae7df=path[_0x586d('0x63')](config[_0x586d('0x64')],_0xe3702,_[_0x586d('0x65')](_0x586d('0x66')));}if(!fs['existsSync'](_0x3ae7df)){throw new db[(_0x586d('0x69'))][(_0x586d('0x6a'))](_[_0x586d('0x68')]('logo')+_0x586d('0x6b'));}return _0x3f3af0[_0x586d('0x6c')](_0x3ae7df);}})['catch'](handleError(_0x3f3af0,null));};var utilLicense=require(_0x586d('0x5a'));exports[_0x586d('0x6d')]=function(_0xc65635,_0x26c710,_0x469497){var _0x2f3144=_0x586d('0x5c');var _0x41c426={'custom':![]};return utilLicense[_0x586d('0x6e')]()[_0x586d('0x1c')](function(_0x3a5481){if(_0x3a5481){_0x41c426=_0x3a5481;}return db['Setting'][_0x586d('0x52')]({'where':{'id':_0xc65635[_0x586d('0x50')]['id']},'attributes':[_0x586d('0x58'),_0x586d('0x59'),'preferred','favicon',_0x586d('0x5f'),_0x586d('0x60'),_0x586d('0x61'),_0x586d('0x62')],'raw':!![]});})[_0x586d('0x1c')](handleEntityNotFound(_0x26c710,null))[_0x586d('0x1c')](function(_0x192610){if(_0x192610){var _0x38aeed=_0x192610[_0x586d('0x59')]&&fs[_0x586d('0x6f')](path['join'](config['root'],_0x2f3144,_[_0x586d('0x65')](_0x192610[_0x586d('0x59')])))?path[_0x586d('0x63')](config[_0x586d('0x64')],_0x2f3144,_[_0x586d('0x65')](_0x192610[_0x586d('0x59')])):path['join'](config[_0x586d('0x64')],_0x2f3144,_[_0x586d('0x65')](_0x586d('0x70')));var _0x33ce5b=_0x586d('0x67')+_[_0x586d('0x68')](_0x586d('0x59'));if(_0x192610[_0x33ce5b]||!_0x41c426[_0x586d('0x71')]){_0x38aeed=path[_0x586d('0x63')](config[_0x586d('0x64')],_0x2f3144,_[_0x586d('0x65')](_0x586d('0x70')));}if(!fs[_0x586d('0x6f')](_0x38aeed)){throw new db[(_0x586d('0x69'))]['ValidationError'](_[_0x586d('0x68')](_0x586d('0x59'))+'\x20not\x20found');}return _0x26c710['download'](_0x38aeed);}})[_0x586d('0x53')](handleError(_0x26c710,null));};exports[_0x586d('0x72')]=function(_0x4a2642,_0x4e52aa){return db['Setting'][_0x586d('0x52')]({'where':{'id':_0x4a2642[_0x586d('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x4e52aa,null))[_0x586d('0x53')](handleError(_0x4e52aa,null));};exports['addPreferred']=function(_0x5de3fb,_0x12c10f,_0x56e7bf){if(_0x5de3fb[_0x586d('0x56')]&&_0x5de3fb['file'][_0x586d('0x57')]){_0x5de3fb[_0x586d('0x54')][_0x586d('0x5d')]=_0x5de3fb[_0x586d('0x56')][_0x586d('0x57')];}return db[_0x586d('0x4d')][_0x586d('0x52')]({'where':{'id':_0x5de3fb['params']['id']}})[_0x586d('0x1c')](handleEntityNotFound(_0x12c10f,null))['then'](saveUpdates(_0x5de3fb['body'],null))[_0x586d('0x1c')](respondWithResult(_0x12c10f,null))['catch'](handleError(_0x12c10f,null));};var utilLicense=require(_0x586d('0x5a'));exports[_0x586d('0x73')]=function(_0x17554a,_0x19b2cc,_0x126b2b){var _0x389efa=_0x586d('0x5c');var _0xe073f2={'custom':![]};return utilLicense[_0x586d('0x6e')]()[_0x586d('0x1c')](function(_0x5166b9){if(_0x5166b9){_0xe073f2=_0x5166b9;}return db['Setting'][_0x586d('0x52')]({'where':{'id':_0x17554a[_0x586d('0x50')]['id']},'attributes':[_0x586d('0x58'),_0x586d('0x59'),_0x586d('0x5d'),_0x586d('0x5e'),'defaultLogo',_0x586d('0x60'),'defaultPreferred',_0x586d('0x62')],'raw':!![]});})[_0x586d('0x1c')](handleEntityNotFound(_0x19b2cc,null))[_0x586d('0x1c')](function(_0x1e21d2){if(_0x1e21d2){var _0x329ceb=_0x1e21d2[_0x586d('0x5d')]&&fs[_0x586d('0x6f')](path[_0x586d('0x63')](config[_0x586d('0x64')],_0x389efa,_['toLower'](_0x1e21d2['preferred'])))?path['join'](config[_0x586d('0x64')],_0x389efa,_[_0x586d('0x65')](_0x1e21d2[_0x586d('0x5d')])):path[_0x586d('0x63')](config[_0x586d('0x64')],_0x389efa,_['toLower'](_0x586d('0x74')));var _0x2b59b7='default'+_[_0x586d('0x68')](_0x586d('0x5d'));if(_0x1e21d2[_0x2b59b7]||!_0xe073f2[_0x586d('0x71')]||!_0xe073f2[_0x586d('0x5d')]){_0x329ceb=path[_0x586d('0x63')](config[_0x586d('0x64')],_0x389efa,_[_0x586d('0x65')](_0x586d('0x74')));}if(!fs['existsSync'](_0x329ceb)){throw new db['Sequelize'][(_0x586d('0x6a'))](_[_0x586d('0x68')](_0x586d('0x5d'))+'\x20not\x20found');}return _0x19b2cc[_0x586d('0x6c')](_0x329ceb);}})['catch'](handleError(_0x19b2cc,null));};exports[_0x586d('0x75')]=function(_0x566573,_0x2aa837,_0x239622){if(_0x566573['file']&&_0x566573[_0x586d('0x56')][_0x586d('0x57')]){_0x566573[_0x586d('0x54')][_0x586d('0x5e')]=_0x566573[_0x586d('0x56')][_0x586d('0x57')];}return db['Setting']['find']({'where':{'id':_0x566573[_0x586d('0x50')]['id']}})[_0x586d('0x1c')](handleEntityNotFound(_0x2aa837,null))[_0x586d('0x1c')](saveUpdates(_0x566573['body'],null))[_0x586d('0x1c')](respondWithResult(_0x2aa837,null))[_0x586d('0x53')](handleError(_0x2aa837,null));};var utilLicense=require(_0x586d('0x5a'));exports[_0x586d('0x76')]=function(_0x2dff9c,_0x67acd2,_0x20c917){var _0x5d0bf7=_0x586d('0x5c');var _0x4dcfc7={'custom':![]};return utilLicense[_0x586d('0x6e')]()['then'](function(_0x44e96f){if(_0x44e96f){_0x4dcfc7=_0x44e96f;}return db[_0x586d('0x4d')][_0x586d('0x52')]({'where':{'id':_0x2dff9c[_0x586d('0x50')]['id']},'attributes':['logo',_0x586d('0x59'),_0x586d('0x5d'),_0x586d('0x5e'),'defaultLogo',_0x586d('0x60'),_0x586d('0x61'),_0x586d('0x62')],'raw':!![]});})[_0x586d('0x1c')](handleEntityNotFound(_0x67acd2,null))[_0x586d('0x1c')](function(_0x2107c8){if(_0x2107c8){var _0xcfcbb=_0x2107c8[_0x586d('0x5e')]&&fs[_0x586d('0x6f')](path['join'](config[_0x586d('0x64')],_0x5d0bf7,_[_0x586d('0x65')](_0x2107c8[_0x586d('0x5e')])))?path['join'](config[_0x586d('0x64')],_0x5d0bf7,_['toLower'](_0x2107c8['favicon'])):path[_0x586d('0x63')](config[_0x586d('0x64')],_0x5d0bf7,_[_0x586d('0x65')](_0x586d('0x77')));var _0x340ac2=_0x586d('0x67')+_[_0x586d('0x68')]('favicon');if(_0x2107c8[_0x340ac2]||!_0x4dcfc7[_0x586d('0x71')]){_0xcfcbb=path[_0x586d('0x63')](config[_0x586d('0x64')],_0x5d0bf7,_['toLower'](_0x586d('0x77')));}if(!fs[_0x586d('0x6f')](_0xcfcbb)){throw new db[(_0x586d('0x69'))]['ValidationError'](_[_0x586d('0x68')](_0x586d('0x5e'))+_0x586d('0x6b'));}return _0x67acd2[_0x586d('0x6c')](_0xcfcbb);}})['catch'](handleError(_0x67acd2,null));};exports[_0x586d('0x78')]=function(_0x28f86b,_0x47fdca){var _0x1bd6a2={'offset':moment()[_0x586d('0x79')]()};_0x1bd6a2[_0x586d('0x7a')]=moment()[_0x586d('0x79')](_0x1bd6a2[_0x586d('0x29')])[_0x586d('0x7b')](_0x586d('0x7c'));return _0x47fdca[_0x586d('0x7d')](0xc8)[_0x586d('0x33')](_0x1bd6a2);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index d5094d1..d2e6c63 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x219fa0,_0x18b239){var _0xc603fb=function(_0x3371ad){while(--_0x3371ad){_0x219fa0['push'](_0x219fa0['shift']());}};_0xc603fb(++_0x18b239);}(_0x3e74,0x175));var _0x43e7=function(_0x4f1cfc,_0x4cd8a7){_0x4f1cfc=_0x4f1cfc-0x0;var _0x12b49b=_0x3e74[_0x4f1cfc];return _0x12b49b;};'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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5de532,_0x2941c4){var _0x4e9192=function(_0x548a81){while(--_0x548a81){_0x5de532['push'](_0x5de532['shift']());}};_0x4e9192(++_0x2941c4);}(_0x7217,0x19e));var _0x7721=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x7217[_0x47a7d0];return _0xb9bd08;};'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/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f16e873..fb46e9b 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 _0x6612=['http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Setting','find','options','raw','where','attributes','include','model','map','debug','ShowSetting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x32be39,_0x251f3c){var _0x2ad962=function(_0x292dc5){while(--_0x292dc5){_0x32be39['push'](_0x32be39['shift']());}};_0x2ad962(++_0x251f3c);}(_0x6612,0x106));var _0x2661=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x6612[_0x37bd26];return _0xe83dc4;};'use strict';var _=require(_0x2661('0x0'));var util=require('util');var moment=require(_0x2661('0x1'));var BPromise=require(_0x2661('0x2'));var rs=require(_0x2661('0x3'));var fs=require('fs');var Redis=require(_0x2661('0x4'));var db=require(_0x2661('0x5'))['db'];var utils=require(_0x2661('0x6'));var logger=require(_0x2661('0x7'))(_0x2661('0x8'));var config=require('../../config/environment');var jayson=require(_0x2661('0x9'));var client=jayson['client'][_0x2661('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b3658,_0x5f0540,_0x46f4ee){return new BPromise(function(_0x3ea8bf,_0x5062f7){return client[_0x2661('0xb')](_0x2b3658,_0x46f4ee)[_0x2661('0xc')](function(_0x32a1a8){logger[_0x2661('0xd')](_0x2661('0xe'),_0x5f0540,_0x2661('0xf'));logger['debug'](_0x2661('0x10'),_0x5f0540,_0x2661('0xf'),JSON[_0x2661('0x11')](_0x32a1a8));if(_0x32a1a8[_0x2661('0x12')]){if(_0x32a1a8[_0x2661('0x12')][_0x2661('0x13')]===0x1f4){logger[_0x2661('0x12')]('Setting,\x20%s,\x20%s',_0x5f0540,_0x32a1a8[_0x2661('0x12')][_0x2661('0x14')]);return _0x5062f7(_0x32a1a8[_0x2661('0x12')][_0x2661('0x14')]);}logger[_0x2661('0x12')](_0x2661('0xe'),_0x5f0540,_0x32a1a8[_0x2661('0x12')][_0x2661('0x14')]);return _0x3ea8bf(_0x32a1a8[_0x2661('0x12')]['message']);}else{logger['info']('Setting,\x20%s,\x20%s',_0x5f0540,_0x2661('0xf'));_0x3ea8bf(_0x32a1a8[_0x2661('0x15')][_0x2661('0x14')]);}})[_0x2661('0x16')](function(_0x2cde2f){logger[_0x2661('0x12')]('Setting,\x20%s,\x20%s',_0x5f0540,_0x2cde2f);_0x5062f7(_0x2cde2f);});});}exports['ShowSetting']=function(_0x23bbc8){var _0x24a73f=this;return new Promise(function(_0x218592,_0x28b66c){return db[_0x2661('0x17')][_0x2661('0x18')]({'raw':_0x23bbc8[_0x2661('0x19')]?_0x23bbc8[_0x2661('0x19')][_0x2661('0x1a')]===undefined?!![]:![]:!![],'where':_0x23bbc8[_0x2661('0x19')]?_0x23bbc8['options'][_0x2661('0x1b')]||null:null,'attributes':_0x23bbc8['options']?_0x23bbc8[_0x2661('0x19')][_0x2661('0x1c')]||null:null,'include':_0x23bbc8[_0x2661('0x19')]?_0x23bbc8[_0x2661('0x19')][_0x2661('0x1d')]?_['map'](_0x23bbc8['options'][_0x2661('0x1d')],function(_0x1adbad){return{'model':db[_0x1adbad[_0x2661('0x1e')]],'as':_0x1adbad['as'],'attributes':_0x1adbad[_0x2661('0x1c')],'include':_0x1adbad[_0x2661('0x1d')]?_['map'](_0x1adbad['include'],function(_0x10645f){return{'model':db[_0x10645f['model']],'as':_0x10645f['as'],'attributes':_0x10645f['attributes'],'include':_0x10645f[_0x2661('0x1d')]?_[_0x2661('0x1f')](_0x10645f[_0x2661('0x1d')],function(_0x1f291c){return{'model':db[_0x1f291c[_0x2661('0x1e')]],'as':_0x1f291c['as'],'attributes':_0x1f291c[_0x2661('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2661('0xc')](function(_0x4db002){logger[_0x2661('0xd')]('ShowSetting',_0x23bbc8);logger[_0x2661('0x20')](_0x2661('0x21'),_0x23bbc8,JSON['stringify'](_0x4db002));_0x218592(_0x4db002);})[_0x2661('0x16')](function(_0x1ecd92){logger[_0x2661('0x12')](_0x2661('0x21'),_0x1ecd92[_0x2661('0x14')],_0x23bbc8);_0x28b66c(_0x24a73f[_0x2661('0x12')](0x1f4,_0x1ecd92[_0x2661('0x14')]));});});}; \ No newline at end of file +var _0x2cc1=['model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','request\x20sent','debug','error','code','Setting,\x20%s,\x20%s','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map'];(function(_0x231c4b,_0xca7fc2){var _0x478db0=function(_0x23ca99){while(--_0x23ca99){_0x231c4b['push'](_0x231c4b['shift']());}};_0x478db0(++_0xca7fc2);}(_0x2cc1,0x18f));var _0x12cc=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x2cc1[_0x1c546c];return _0x2cc384;};'use strict';var _=require('lodash');var util=require(_0x12cc('0x0'));var moment=require(_0x12cc('0x1'));var BPromise=require(_0x12cc('0x2'));var rs=require(_0x12cc('0x3'));var fs=require('fs');var Redis=require(_0x12cc('0x4'));var db=require(_0x12cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x12cc('0x6'))(_0x12cc('0x7'));var config=require(_0x12cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x12cc('0x9')][_0x12cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4648c8,_0x444909,_0x1deff1){return new BPromise(function(_0x361281,_0x246b26){return client[_0x12cc('0xb')](_0x4648c8,_0x1deff1)['then'](function(_0x58c5af){logger[_0x12cc('0xc')]('Setting,\x20%s,\x20%s',_0x444909,_0x12cc('0xd'));logger[_0x12cc('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x444909,_0x12cc('0xd'),JSON['stringify'](_0x58c5af));if(_0x58c5af[_0x12cc('0xf')]){if(_0x58c5af[_0x12cc('0xf')][_0x12cc('0x10')]===0x1f4){logger[_0x12cc('0xf')](_0x12cc('0x11'),_0x444909,_0x58c5af[_0x12cc('0xf')][_0x12cc('0x12')]);return _0x246b26(_0x58c5af[_0x12cc('0xf')][_0x12cc('0x12')]);}logger['error'](_0x12cc('0x11'),_0x444909,_0x58c5af['error'][_0x12cc('0x12')]);return _0x361281(_0x58c5af[_0x12cc('0xf')]['message']);}else{logger[_0x12cc('0xc')](_0x12cc('0x11'),_0x444909,_0x12cc('0xd'));_0x361281(_0x58c5af[_0x12cc('0x13')][_0x12cc('0x12')]);}})[_0x12cc('0x14')](function(_0x33ac28){logger[_0x12cc('0xf')]('Setting,\x20%s,\x20%s',_0x444909,_0x33ac28);_0x246b26(_0x33ac28);});});}exports[_0x12cc('0x15')]=function(_0x57f2a9){var _0x10b008=this;return new Promise(function(_0xf9aca1,_0x56b815){return db[_0x12cc('0x16')][_0x12cc('0x17')]({'raw':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x19')]===undefined?!![]:![]:!![],'where':_0x57f2a9['options']?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1a')]||null:null,'attributes':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1b')]||null:null,'include':_0x57f2a9[_0x12cc('0x18')]?_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x57f2a9[_0x12cc('0x18')][_0x12cc('0x1c')],function(_0x2427a1){return{'model':db[_0x2427a1['model']],'as':_0x2427a1['as'],'attributes':_0x2427a1[_0x12cc('0x1b')],'include':_0x2427a1[_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x2427a1[_0x12cc('0x1c')],function(_0x20e0aa){return{'model':db[_0x20e0aa[_0x12cc('0x1e')]],'as':_0x20e0aa['as'],'attributes':_0x20e0aa[_0x12cc('0x1b')],'include':_0x20e0aa[_0x12cc('0x1c')]?_[_0x12cc('0x1d')](_0x20e0aa[_0x12cc('0x1c')],function(_0x3ea4e2){return{'model':db[_0x3ea4e2[_0x12cc('0x1e')]],'as':_0x3ea4e2['as'],'attributes':_0x3ea4e2[_0x12cc('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x12cc('0x1f')](function(_0x20319c){logger[_0x12cc('0xc')](_0x12cc('0x15'),_0x57f2a9);logger[_0x12cc('0xe')](_0x12cc('0x15'),_0x57f2a9,JSON[_0x12cc('0x20')](_0x20319c));_0xf9aca1(_0x20319c);})[_0x12cc('0x14')](function(_0x3df009){logger['error'](_0x12cc('0x15'),_0x3df009[_0x12cc('0x12')],_0x57f2a9);_0x56b815(_0x10b008['error'](0x1f4,_0x3df009['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index dcf6419..3cc02ba 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2b336c,_0x2b631b){var _0x3b0ec=function(_0x148e45){while(--_0x148e45){_0x2b336c['push'](_0x2b336c['shift']());}};_0x3b0ec(++_0x2b631b);}(_0x7a54,0x106));var _0x47a5=function(_0x30597a,_0x254521){_0x30597a=_0x30597a-0x0;var _0x9f6505=_0x7a54[_0x30597a];return _0x9f6505;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x188a93,_0xaf57db){var _0x23b40d=function(_0x599f63){while(--_0x599f63){_0x188a93['push'](_0x188a93['shift']());}};_0x23b40d(++_0xaf57db);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c5654a7..7ca424d 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 _0x7131=['bandwidth','csc','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','twilio','connectel','clicksend','plivo'];(function(_0x5e3a45,_0x45f0c5){var _0x13419f=function(_0x5ac996){while(--_0x5ac996){_0x5e3a45['push'](_0x5e3a45['shift']());}};_0x13419f(++_0x45f0c5);}(_0x7131,0x1c0));var _0x1713=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x7131[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x1713('0x0'));var rs=require(_0x1713('0x1'));module[_0x1713('0x2')]={'name':{'type':Sequelize[_0x1713('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize['ENUM'](_0x1713('0x4'),'skebby',_0x1713('0x5'),_0x1713('0x6'),_0x1713('0x7'),'clickatell',_0x1713('0x8'),_0x1713('0x9'),'infobip',_0x1713('0xa'))},'accountSid':{'type':Sequelize[_0x1713('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1713('0x3')]},'smsMethod':{'type':Sequelize[_0x1713('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x1713('0x3')]},'password':{'type':Sequelize[_0x1713('0x3')]},'apiKey':{'type':Sequelize[_0x1713('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x1713('0x3')]},'senderString':{'type':Sequelize[_0x1713('0x3')]},'deliveryReport':{'type':Sequelize[_0x1713('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x1713('0x3')]},'notificationTemplate':{'type':Sequelize[_0x1713('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1713('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1713('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1713('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1713('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1713('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1713('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x1713('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x1713('0xe')],'comment':_0x1713('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x1713('0xc')],'defaultValue':![],'comment':_0x1713('0x10'),'set':function(_0x166b91){if(!_0x166b91)this[_0x1713('0x11')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0x1713('0x12'),_0x166b91);}}}; \ No newline at end of file +var _0x99aa=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x99aa,0x156));var _0xa99a=function(_0x44e8a9,_0x18bb54){_0x44e8a9=_0x44e8a9-0x0;var _0x5d4037=_0x99aa[_0x44e8a9];return _0x5d4037;};'use strict';var Sequelize=require(_0xa99a('0x0'));var rs=require(_0xa99a('0x1'));module[_0xa99a('0x2')]={'name':{'type':Sequelize[_0xa99a('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa99a('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa99a('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa99a('0x3')],'defaultValue':function(){return rs[_0xa99a('0x4')]();}},'phone':{'type':Sequelize[_0xa99a('0x3')]},'type':{'type':Sequelize[_0xa99a('0x5')]('twilio',_0xa99a('0x6'),_0xa99a('0x7'),_0xa99a('0x8'),_0xa99a('0x9'),_0xa99a('0xa'),_0xa99a('0xb'),_0xa99a('0xc'),_0xa99a('0xd'),_0xa99a('0xe'))},'accountSid':{'type':Sequelize[_0xa99a('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xa99a('0x3')]},'smsMethod':{'type':Sequelize[_0xa99a('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xa99a('0x3')]},'password':{'type':Sequelize[_0xa99a('0x3')]},'apiKey':{'type':Sequelize[_0xa99a('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0xa99a('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa99a('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa99a('0xf')],'defaultValue':function(){return _0xa99a('0x10');}},'notificationSound':{'type':Sequelize[_0xa99a('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa99a('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa99a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa99a('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa99a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa99a('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa99a('0x12')],'comment':_0xa99a('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xa99a('0x11')],'defaultValue':![],'comment':_0xa99a('0x14'),'set':function(_0x1d0032){if(!_0x1d0032)this['setDataValue'](_0xa99a('0x15'),null);this[_0xa99a('0x16')](_0xa99a('0x17'),_0x1d0032);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 7888c67..1fef6a6 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 _0xbccd=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','describe','addDisposition','body','SmsAccountId','getDispositions','findOne','Disposition','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','SmsApplication','applications','orderBy','Applications','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','clickatell','fromNumber','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','push','unmanaged','*,*,*,*','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','text/xml','addApplications','sequelize','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','Tag','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','status_code','groupName','DELIVERED','intelepeer','inspect','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','get','SmsAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','Pause','keys','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation'];(function(_0x5db1b0,_0x2ec8eb){var _0x412704=function(_0x7a62a9){while(--_0x7a62a9){_0x5db1b0['push'](_0x5db1b0['shift']());}};_0x412704(++_0x2ec8eb);}(_0xbccd,0x82));var _0xdbcc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbccd[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xdbcc('0x0'));var rimraf=require(_0xdbcc('0x1'));var zipdir=require(_0xdbcc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbcc('0x3'));var moment=require(_0xdbcc('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbcc('0x5'));var util=require(_0xdbcc('0x6'));var path=require(_0xdbcc('0x7'));var sox=require(_0xdbcc('0x8'));var csv=require(_0xdbcc('0x9'));var ejs=require(_0xdbcc('0xa'));var fs=require('fs');var fs_extra=require(_0xdbcc('0xb'));var _=require(_0xdbcc('0xc'));var squel=require(_0xdbcc('0xd'));var crypto=require(_0xdbcc('0xe'));var jsforce=require(_0xdbcc('0xf'));var deskjs=require(_0xdbcc('0x10'));var toCsv=require(_0xdbcc('0x9'));var querystring=require(_0xdbcc('0x11'));var Papa=require(_0xdbcc('0x12'));var Redis=require('ioredis');var authService=require(_0xdbcc('0x13'));var qs=require(_0xdbcc('0x14'));var as=require(_0xdbcc('0x15'));var hardwareService=require(_0xdbcc('0x16'));var logger=require(_0xdbcc('0x17'))(_0xdbcc('0x18'));var utils=require(_0xdbcc('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xdbcc('0x1a'));var db=require(_0xdbcc('0x1b'))['db'];config['redis']=_[_0xdbcc('0x1c')](config[_0xdbcc('0x1d')],{'host':_0xdbcc('0x1e'),'port':0x18eb});var socket=require(_0xdbcc('0x1f'))(new Redis(config[_0xdbcc('0x1d')]));require('./smsAccount.socket')[_0xdbcc('0x20')](socket);var jayson=require(_0xdbcc('0x21'));var client=jayson['client'][_0xdbcc('0x22')]({'port':0x232c});function respondWithRpcPromise(_0x1e00b8,_0x1d03c4,_0x5c43ee,_0xe1dc02){return new BPromise(function(_0x29f3bb,_0x5d0a7){var _0x2c041a=_0xe1dc02||client;return _0x2c041a[_0xdbcc('0x23')](_0x1e00b8,_0x5c43ee)[_0xdbcc('0x24')](function(_0x12ff32){logger[_0xdbcc('0x25')]('SmsAccount,\x20%s,\x20%s',_0x1d03c4,_0xdbcc('0x26'));logger[_0xdbcc('0x27')](_0xdbcc('0x28'),_0x1d03c4,_0xdbcc('0x26'),JSON[_0xdbcc('0x29')](_0x12ff32));if(_0x12ff32[_0xdbcc('0x2a')]){if(_0x12ff32['error'][_0xdbcc('0x2b')]===0x1f4){logger[_0xdbcc('0x2a')](_0xdbcc('0x2c'),_0x1d03c4,_0x12ff32[_0xdbcc('0x2a')][_0xdbcc('0x2d')]);return _0x5d0a7(_0x12ff32[_0xdbcc('0x2a')][_0xdbcc('0x2d')]);}logger[_0xdbcc('0x2a')](_0xdbcc('0x2c'),_0x1d03c4,_0x12ff32[_0xdbcc('0x2a')][_0xdbcc('0x2d')]);return _0x29f3bb(_0x12ff32[_0xdbcc('0x2a')][_0xdbcc('0x2d')]);}else{logger[_0xdbcc('0x25')](_0xdbcc('0x2c'),_0x1d03c4,_0xdbcc('0x26'));_0x29f3bb(_0x12ff32['result'][_0xdbcc('0x2d')]);}})[_0xdbcc('0x2e')](function(_0x5a41ff){logger[_0xdbcc('0x2a')](_0xdbcc('0x2c'),_0x1d03c4,_0x5a41ff);_0x5d0a7(_0x5a41ff);});});}function respondWithStatusCode(_0x122bc8,_0x5265b7){_0x5265b7=_0x5265b7||0xcc;return function(_0x37e86e){if(_0x37e86e){return _0x122bc8[_0xdbcc('0x2f')](_0x5265b7);}return _0x122bc8['status'](_0x5265b7)['end']();};}function respondWithResult(_0x214425,_0x40acac){_0x40acac=_0x40acac||0xc8;return function(_0x31f45e){if(_0x31f45e){return _0x214425[_0xdbcc('0x30')](_0x40acac)[_0xdbcc('0x31')](_0x31f45e);}};}function respondWithFilteredResult(_0x3f9c9c,_0x22fb78){return function(_0x44536e){if(_0x44536e){var _0x33d524=typeof _0x22fb78[_0xdbcc('0x32')]===_0xdbcc('0x33')&&typeof _0x22fb78[_0xdbcc('0x34')]===_0xdbcc('0x33');var _0x3f777d=_0x44536e[_0xdbcc('0x35')];var _0x128626=_0x33d524?0x0:_0x22fb78[_0xdbcc('0x32')];var _0x205797=_0x33d524?_0x44536e[_0xdbcc('0x35')]:_0x22fb78[_0xdbcc('0x32')]+_0x22fb78[_0xdbcc('0x34')];var _0xe5f420;if(_0x205797>=_0x3f777d){_0x205797=_0x3f777d;_0xe5f420=0xc8;}else{_0xe5f420=0xce;}_0x3f9c9c['status'](_0xe5f420);return _0x3f9c9c[_0xdbcc('0x36')](_0xdbcc('0x37'),_0x128626+'-'+_0x205797+'/'+_0x3f777d)[_0xdbcc('0x31')](_0x44536e);}return null;};}function patchUpdates(_0x5db113){return function(_0x19928b){try{jsonpatch[_0xdbcc('0x38')](_0x19928b,_0x5db113,!![]);}catch(_0x193359){return BPromise[_0xdbcc('0x39')](_0x193359);}return _0x19928b[_0xdbcc('0x3a')]();};}function saveUpdates(_0x28b9cb,_0x353fc3){return function(_0x42ab36){if(_0x42ab36){return _0x42ab36['update'](_0x28b9cb)['then'](function(_0x518a3c){return _0x518a3c;});}return null;};}function removeEntity(_0x444986,_0x40b16b){return function(_0x3e571d){if(_0x3e571d){return _0x3e571d['destroy']()[_0xdbcc('0x24')](function(){var _0xfee79=_0x3e571d[_0xdbcc('0x3b')]({'plain':!![]});var _0x5d8043=_0xdbcc('0x3c');return db[_0xdbcc('0x3d')]['destroy']({'where':{'type':_0x5d8043,'resourceId':_0xfee79['id']}})[_0xdbcc('0x24')](function(){return _0x3e571d;});})[_0xdbcc('0x24')](function(){_0x444986[_0xdbcc('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ec6f1,_0x92e760){return function(_0x447418){if(!_0x447418){_0x1ec6f1[_0xdbcc('0x2f')](0x194);}return _0x447418;};}function handleError(_0x2895f2,_0x5ab52a){_0x5ab52a=_0x5ab52a||0x1f4;return function(_0x5579f9){logger[_0xdbcc('0x2a')](_0x5579f9[_0xdbcc('0x3e')]);if(_0x5579f9[_0xdbcc('0x3f')]){delete _0x5579f9['name'];}_0x2895f2[_0xdbcc('0x30')](_0x5ab52a)[_0xdbcc('0x40')](_0x5579f9);};}exports[_0xdbcc('0x41')]=function(_0x159595,_0x254bf3){var _0x4ebba2={'include':[{'model':db['Pause'],'as':_0xdbcc('0x42')}]},_0x834f96={},_0x9752c6={'count':0x0,'rows':[]};var _0x3f7610=_[_0xdbcc('0x43')](db[_0xdbcc('0x44')][_0xdbcc('0x45')],function(_0x21a801){return{'name':_0x21a801['fieldName'],'type':_0x21a801[_0xdbcc('0x46')]['key']};});_0x834f96[_0xdbcc('0x47')]=_[_0xdbcc('0x43')](_0x3f7610,'name');_0x834f96['query']=_['keys'](_0x159595[_0xdbcc('0x48')]);_0x834f96['filters']=_['intersection'](_0x834f96[_0xdbcc('0x47')],_0x834f96[_0xdbcc('0x48')]);_0x4ebba2[_0xdbcc('0x49')]=_[_0xdbcc('0x4a')](_0x834f96[_0xdbcc('0x47')],qs['fields'](_0x159595[_0xdbcc('0x48')]['fields']));_0x4ebba2[_0xdbcc('0x49')]=_0x4ebba2[_0xdbcc('0x49')][_0xdbcc('0x4b')]?_0x4ebba2['attributes']:_0x834f96[_0xdbcc('0x47')];if(!_0x159595[_0xdbcc('0x48')][_0xdbcc('0x4c')](_0xdbcc('0x4d'))){_0x4ebba2[_0xdbcc('0x34')]=qs[_0xdbcc('0x34')](_0x159595[_0xdbcc('0x48')][_0xdbcc('0x34')]);_0x4ebba2[_0xdbcc('0x32')]=qs[_0xdbcc('0x32')](_0x159595[_0xdbcc('0x48')]['offset']);}_0x4ebba2[_0xdbcc('0x4e')]=qs[_0xdbcc('0x4f')](_0x159595[_0xdbcc('0x48')][_0xdbcc('0x4f')]);_0x4ebba2[_0xdbcc('0x50')]=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x159595['query'],_0x834f96[_0xdbcc('0x51')]),_0x3f7610);if(_0x159595[_0xdbcc('0x48')][_0xdbcc('0x53')]){_0x4ebba2[_0xdbcc('0x50')]=_[_0xdbcc('0x54')](_0x4ebba2[_0xdbcc('0x50')],{'$or':_[_0xdbcc('0x43')](_0x3f7610,function(_0x4158c8){if(_0x4158c8['type']!==_0xdbcc('0x55')){var _0x3c9449={};_0x3c9449[_0x4158c8[_0xdbcc('0x3f')]]={'$like':'%'+_0x159595[_0xdbcc('0x48')][_0xdbcc('0x53')]+'%'};return _0x3c9449;}})});}_0x4ebba2=_[_0xdbcc('0x54')]({},_0x4ebba2,_0x159595[_0xdbcc('0x56')]);var _0x4931ae={'where':_0x4ebba2[_0xdbcc('0x50')]};return db[_0xdbcc('0x44')][_0xdbcc('0x35')](_0x4931ae)[_0xdbcc('0x24')](function(_0x5f0a2a){_0x9752c6[_0xdbcc('0x35')]=_0x5f0a2a;if(_0x159595[_0xdbcc('0x48')][_0xdbcc('0x57')]){_0x4ebba2[_0xdbcc('0x58')]=[{'all':!![]}];}return db[_0xdbcc('0x44')]['findAll'](_0x4ebba2);})['then'](function(_0x4052f6){_0x9752c6[_0xdbcc('0x59')]=_0x4052f6;return _0x9752c6;})[_0xdbcc('0x24')](respondWithFilteredResult(_0x254bf3,_0x4ebba2))[_0xdbcc('0x2e')](handleError(_0x254bf3,null));};exports[_0xdbcc('0x5a')]=function(_0x1e7825,_0x4b9b9e){var _0x229afc={'raw':![],'where':{'id':_0x1e7825[_0xdbcc('0x5b')]['id']},'include':[{'model':db[_0xdbcc('0x5c')],'as':_0xdbcc('0x42')}]},_0x1110c9={};_0x1110c9[_0xdbcc('0x47')]=_[_0xdbcc('0x5d')](db['SmsAccount'][_0xdbcc('0x45')]);_0x1110c9[_0xdbcc('0x48')]=_[_0xdbcc('0x5d')](_0x1e7825[_0xdbcc('0x48')]);_0x1110c9[_0xdbcc('0x51')]=_[_0xdbcc('0x4a')](_0x1110c9[_0xdbcc('0x47')],_0x1110c9[_0xdbcc('0x48')]);_0x229afc[_0xdbcc('0x49')]=_[_0xdbcc('0x4a')](_0x1110c9[_0xdbcc('0x47')],qs[_0xdbcc('0x5e')](_0x1e7825[_0xdbcc('0x48')]['fields']));_0x229afc[_0xdbcc('0x49')]=_0x229afc[_0xdbcc('0x49')][_0xdbcc('0x4b')]?_0x229afc[_0xdbcc('0x49')]:_0x1110c9[_0xdbcc('0x47')];if(_0x1e7825[_0xdbcc('0x48')][_0xdbcc('0x57')]){_0x229afc[_0xdbcc('0x58')]=[{'all':!![]}];}_0x229afc=_[_0xdbcc('0x54')]({},_0x229afc,_0x1e7825['options']);return db['SmsAccount'][_0xdbcc('0x5f')](_0x229afc)[_0xdbcc('0x24')](handleEntityNotFound(_0x4b9b9e,null))[_0xdbcc('0x24')](respondWithResult(_0x4b9b9e,null))[_0xdbcc('0x2e')](handleError(_0x4b9b9e,null));};exports['create']=function(_0x6aba25,_0x494b23){return db['SmsAccount'][_0xdbcc('0x60')](_0x6aba25['body'],{})[_0xdbcc('0x24')](function(_0x1bfe48){var _0x224a37=_0x6aba25[_0xdbcc('0x61')]['get']({'plain':!![]});if(!_0x224a37)throw new Error(_0xdbcc('0x62'));if(_0x224a37['role']===_0xdbcc('0x61')){var _0x37bfdd=_0x1bfe48[_0xdbcc('0x3b')]({'plain':!![]});var _0x20d0ee='SmsAccounts';return db[_0xdbcc('0x63')][_0xdbcc('0x5f')]({'where':{'name':_0x20d0ee,'userProfileId':_0x224a37[_0xdbcc('0x64')]},'raw':!![]})[_0xdbcc('0x24')](function(_0x5e75b9){if(_0x5e75b9&&_0x5e75b9[_0xdbcc('0x65')]===0x0){return db[_0xdbcc('0x3d')]['create']({'name':_0x37bfdd[_0xdbcc('0x3f')],'resourceId':_0x37bfdd['id'],'type':_0x5e75b9[_0xdbcc('0x3f')],'sectionId':_0x5e75b9['id']},{})[_0xdbcc('0x24')](function(){return _0x1bfe48;});}else{return _0x1bfe48;}})[_0xdbcc('0x2e')](function(_0x2823b6){logger[_0xdbcc('0x2a')](_0xdbcc('0x66'),_0x2823b6);throw _0x2823b6;});}return _0x1bfe48;})[_0xdbcc('0x24')](respondWithResult(_0x494b23,0xc9))[_0xdbcc('0x2e')](handleError(_0x494b23,null));};exports[_0xdbcc('0x67')]=function(_0x850a05,_0x376555){if(_0x850a05['body']['id']){delete _0x850a05['body']['id'];}return db[_0xdbcc('0x44')][_0xdbcc('0x5f')]({'where':{'id':_0x850a05['params']['id']},'include':[{'model':db[_0xdbcc('0x5c')],'as':_0xdbcc('0x42')}]})['then'](handleEntityNotFound(_0x376555,null))[_0xdbcc('0x24')](saveUpdates(_0x850a05['body'],null))[_0xdbcc('0x24')](respondWithResult(_0x376555,null))[_0xdbcc('0x2e')](handleError(_0x376555,null));};exports[_0xdbcc('0x68')]=function(_0x30eedd,_0x30482a){return db['SmsAccount'][_0xdbcc('0x5f')]({'where':{'id':_0x30eedd[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x30482a,null))[_0xdbcc('0x24')](removeEntity(_0x30482a,null))[_0xdbcc('0x2e')](handleError(_0x30482a,null));};exports[_0xdbcc('0x69')]=function(_0x58eab7,_0x2b2773){return db['SmsAccount'][_0xdbcc('0x69')]()[_0xdbcc('0x24')](respondWithResult(_0x2b2773,null))[_0xdbcc('0x2e')](handleError(_0x2b2773,null));};exports[_0xdbcc('0x6a')]=function(_0x40cc9f,_0x1fd02e,_0x566e66){if(_0x40cc9f['body']['id']){delete _0x40cc9f[_0xdbcc('0x6b')]['id'];}return db[_0xdbcc('0x44')]['find']({'where':{'id':_0x40cc9f[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x1fd02e,null))[_0xdbcc('0x24')](function(_0xfb5422){if(_0xfb5422){_0x40cc9f['body'][_0xdbcc('0x6c')]=_0xfb5422['id'];return db['Disposition'][_0xdbcc('0x60')](_0x40cc9f[_0xdbcc('0x6b')]);}})[_0xdbcc('0x24')](respondWithResult(_0x1fd02e,null))[_0xdbcc('0x2e')](handleError(_0x1fd02e,null));};exports[_0xdbcc('0x6d')]=function(_0x558ada,_0x57e8cf,_0x19f0a3){var _0x1463e8={'raw':![],'where':{}};var _0x41dfed={};var _0x5624c={'count':0x0,'rows':[]};return db[_0xdbcc('0x44')][_0xdbcc('0x6e')]({'where':{'id':_0x558ada[_0xdbcc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x57e8cf,null))[_0xdbcc('0x24')](function(_0x58bd87){if(_0x58bd87){_0x41dfed[_0xdbcc('0x47')]=_[_0xdbcc('0x5d')](db[_0xdbcc('0x6f')][_0xdbcc('0x45')]);_0x41dfed[_0xdbcc('0x48')]=_[_0xdbcc('0x5d')](_0x558ada[_0xdbcc('0x48')]);_0x41dfed[_0xdbcc('0x51')]=_[_0xdbcc('0x4a')](_0x41dfed[_0xdbcc('0x47')],_0x41dfed[_0xdbcc('0x48')]);_0x1463e8[_0xdbcc('0x49')]=_['intersection'](_0x41dfed[_0xdbcc('0x47')],qs[_0xdbcc('0x5e')](_0x558ada[_0xdbcc('0x48')][_0xdbcc('0x5e')]));_0x1463e8[_0xdbcc('0x49')]=_0x1463e8[_0xdbcc('0x49')]['length']?_0x1463e8[_0xdbcc('0x49')]:_0x41dfed['model'];if(!_0x558ada[_0xdbcc('0x48')][_0xdbcc('0x4c')](_0xdbcc('0x4d'))){_0x1463e8['limit']=qs[_0xdbcc('0x34')](_0x558ada['query']['limit']);_0x1463e8[_0xdbcc('0x32')]=qs[_0xdbcc('0x32')](_0x558ada[_0xdbcc('0x48')][_0xdbcc('0x32')]);}_0x1463e8[_0xdbcc('0x4e')]=qs[_0xdbcc('0x4f')](_0x558ada[_0xdbcc('0x48')][_0xdbcc('0x4f')]);_0x1463e8[_0xdbcc('0x50')]=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x558ada['query'],_0x41dfed[_0xdbcc('0x51')]));_0x1463e8[_0xdbcc('0x50')][_0xdbcc('0x6c')]=_0x58bd87['id'];if(_0x558ada[_0xdbcc('0x48')][_0xdbcc('0x53')]){_0x1463e8[_0xdbcc('0x50')]=_[_0xdbcc('0x54')](_0x1463e8[_0xdbcc('0x50')],{'$or':_['map'](_0x1463e8['attributes'],function(_0xbc0caf){var _0x47a92f={};_0x47a92f[_0xbc0caf]={'$like':'%'+_0x558ada[_0xdbcc('0x48')]['filter']+'%'};return _0x47a92f;})});}_0x1463e8=_['merge']({},_0x1463e8,_0x558ada[_0xdbcc('0x56')]);return db[_0xdbcc('0x6f')]['count']({'where':_0x1463e8[_0xdbcc('0x50')]})[_0xdbcc('0x24')](function(_0x28368b){_0x5624c[_0xdbcc('0x35')]=_0x28368b;if(_0x558ada['query'][_0xdbcc('0x57')]){_0x1463e8['include']=[{'all':!![]}];}return db['Disposition'][_0xdbcc('0x70')](_0x1463e8);})[_0xdbcc('0x24')](function(_0x4002a1){_0x5624c[_0xdbcc('0x59')]=_0x4002a1;return _0x5624c;});}})['then'](respondWithFilteredResult(_0x57e8cf,_0x1463e8))[_0xdbcc('0x2e')](handleError(_0x57e8cf,null));};exports[_0xdbcc('0x71')]=function(_0x4865fd,_0x24a62f,_0x797ea8){return db['SmsAccount'][_0xdbcc('0x5f')]({'where':{'id':_0x4865fd[_0xdbcc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x24a62f,null))[_0xdbcc('0x24')](function(_0x315611){if(_0x315611){return _0x315611[_0xdbcc('0x71')](_0x4865fd[_0xdbcc('0x48')][_0xdbcc('0x72')]);}})[_0xdbcc('0x24')](respondWithStatusCode(_0x24a62f,null))[_0xdbcc('0x2e')](handleError(_0x24a62f,null));};exports[_0xdbcc('0x73')]=function(_0x503dcb,_0xef1a24,_0x4e021d){if(_0x503dcb[_0xdbcc('0x6b')]['id']){delete _0x503dcb['body']['id'];}return db[_0xdbcc('0x44')][_0xdbcc('0x5f')]({'where':{'id':_0x503dcb['params']['id']}})['then'](handleEntityNotFound(_0xef1a24,null))['then'](function(_0x591698){if(_0x591698){_0x503dcb[_0xdbcc('0x6b')][_0xdbcc('0x6c')]=_0x591698['id'];return db[_0xdbcc('0x74')][_0xdbcc('0x60')](_0x503dcb['body']);}})[_0xdbcc('0x24')](respondWithResult(_0xef1a24,null))[_0xdbcc('0x2e')](handleError(_0xef1a24,null));};exports[_0xdbcc('0x75')]=function(_0x570dd0,_0x2b3b74,_0x1e5d8d){var _0x203699={'raw':![],'where':{}};var _0x43f7e0={};var _0x32598a={'count':0x0,'rows':[]};return db[_0xdbcc('0x44')][_0xdbcc('0x6e')]({'where':{'id':_0x570dd0[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x2b3b74,null))['then'](function(_0xa68bc4){if(_0xa68bc4){_0x43f7e0[_0xdbcc('0x47')]=_[_0xdbcc('0x5d')](db[_0xdbcc('0x74')]['rawAttributes']);_0x43f7e0[_0xdbcc('0x48')]=_[_0xdbcc('0x5d')](_0x570dd0[_0xdbcc('0x48')]);_0x43f7e0['filters']=_['intersection'](_0x43f7e0[_0xdbcc('0x47')],_0x43f7e0[_0xdbcc('0x48')]);_0x203699[_0xdbcc('0x49')]=_[_0xdbcc('0x4a')](_0x43f7e0['model'],qs[_0xdbcc('0x5e')](_0x570dd0['query']['fields']));_0x203699['attributes']=_0x203699[_0xdbcc('0x49')]['length']?_0x203699[_0xdbcc('0x49')]:_0x43f7e0[_0xdbcc('0x47')];if(!_0x570dd0[_0xdbcc('0x48')]['hasOwnProperty'](_0xdbcc('0x4d'))){_0x203699[_0xdbcc('0x34')]=qs[_0xdbcc('0x34')](_0x570dd0[_0xdbcc('0x48')][_0xdbcc('0x34')]);_0x203699[_0xdbcc('0x32')]=qs['offset'](_0x570dd0[_0xdbcc('0x48')]['offset']);}_0x203699['order']=qs[_0xdbcc('0x4f')](_0x570dd0[_0xdbcc('0x48')][_0xdbcc('0x4f')]);_0x203699['where']=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x570dd0[_0xdbcc('0x48')],_0x43f7e0['filters']));_0x203699['where']['SmsAccountId']=_0xa68bc4['id'];if(_0x570dd0[_0xdbcc('0x48')][_0xdbcc('0x53')]){_0x203699[_0xdbcc('0x50')]=_[_0xdbcc('0x54')](_0x203699[_0xdbcc('0x50')],{'$or':_['map'](_0x203699['attributes'],function(_0xfc5e3e){var _0x1d4480={};_0x1d4480[_0xfc5e3e]={'$like':'%'+_0x570dd0[_0xdbcc('0x48')][_0xdbcc('0x53')]+'%'};return _0x1d4480;})});}_0x203699=_[_0xdbcc('0x54')]({},_0x203699,_0x570dd0[_0xdbcc('0x56')]);return db['CannedAnswer'][_0xdbcc('0x35')]({'where':_0x203699[_0xdbcc('0x50')]})['then'](function(_0x26c306){_0x32598a[_0xdbcc('0x35')]=_0x26c306;if(_0x570dd0[_0xdbcc('0x48')][_0xdbcc('0x57')]){_0x203699['include']=[{'all':!![]}];}return db[_0xdbcc('0x74')][_0xdbcc('0x70')](_0x203699);})[_0xdbcc('0x24')](function(_0x49eb89){_0x32598a[_0xdbcc('0x59')]=_0x49eb89;return _0x32598a;});}})[_0xdbcc('0x24')](respondWithFilteredResult(_0x2b3b74,_0x203699))[_0xdbcc('0x2e')](handleError(_0x2b3b74,null));};exports[_0xdbcc('0x76')]=function(_0xacf6a2,_0x5f5b18,_0x2d2b1a){return db[_0xdbcc('0x44')][_0xdbcc('0x5f')]({'where':{'id':_0xacf6a2[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x5f5b18,null))[_0xdbcc('0x24')](function(_0x327533){if(_0x327533){return _0x327533['removeAnswers'](_0xacf6a2[_0xdbcc('0x48')][_0xdbcc('0x72')]);}})[_0xdbcc('0x24')](respondWithStatusCode(_0x5f5b18,null))['catch'](handleError(_0x5f5b18,null));};exports['notify']=function(_0x3ff9c2,_0x58d9b2,_0x4ea48a){var _0x58059b={'channel':'sms'};var _0x529a02=[];var _0x83bf64=[];var _0xa9f7dd={};return db['SmsAccount'][_0xdbcc('0x5f')]({'where':{'id':_0x3ff9c2['params']['id']},'include':[{'model':db[_0xdbcc('0x77')],'as':'Applications'}]})[_0xdbcc('0x24')](handleEntityNotFound(_0x58d9b2,null))[_0xdbcc('0x24')](function(_0x33d1b9){_0x58059b['account']=_0x33d1b9;_0x58059b[_0xdbcc('0x78')]=_[_0xdbcc('0x79')](_0x33d1b9[_0xdbcc('0x7a')],[_0xdbcc('0x7b')],[_0xdbcc('0x7c')]);if(_0x58059b['account'][_0xdbcc('0x7a')]){delete _0x58059b[_0xdbcc('0x7d')]['Applications'];}return db[_0xdbcc('0x7e')][_0xdbcc('0x69')]();})[_0xdbcc('0x24')](function(_0x94fe6a){if(!_0x94fe6a){throw new db[(_0xdbcc('0x7f'))][(_0xdbcc('0x80'))](_0xdbcc('0x81'));}_0x529a02=_[_0xdbcc('0x82')](_[_0xdbcc('0x5d')](_0x94fe6a),[_0xdbcc('0x83'),_0xdbcc('0x84')]);_0x83bf64=_[_0xdbcc('0x82')](_['keys'](_0x94fe6a),[_0xdbcc('0x83'),_0xdbcc('0x84'),_0xdbcc('0x85'),_0xdbcc('0x86')]);_0x58059b['body']={'mapKey':_0xdbcc('0x87')};if(_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0x46')]){switch(_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0x46')]){case _0xdbcc('0x88'):_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]=_0x3ff9c2['body'][_0xdbcc('0x8a')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x8b')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2['body']['MessageSid'];break;case _0xdbcc('0x8d'):_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]='+'+_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x8e')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2['body'][_0xdbcc('0x8f')];break;case _0xdbcc('0x90'):_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]=_0x3ff9c2[_0xdbcc('0x6b')]['from'];_0x58059b[_0xdbcc('0x6b')]['body']=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x2d')];break;case'clicksend':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x89')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')]['body'];_0x58059b[_0xdbcc('0x6b')]['messageId']=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x91')];break;case _0xdbcc('0x92'):_0x58059b['body']['from']=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x8a')];_0x58059b['body'][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x93')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x94')];break;case _0xdbcc('0x95'):_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]='+'+_0x3ff9c2[_0xdbcc('0x6b')]['results'][0x0][_0xdbcc('0x89')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2['body'][_0xdbcc('0x96')][0x0][_0xdbcc('0x8f')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2['body']['results'][0x0][_0xdbcc('0x8c')];break;case _0xdbcc('0x97'):_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x98')];_0x58059b['body']['body']=_0x3ff9c2[_0xdbcc('0x6b')]['segmentedMessage'][_0xdbcc('0x2d')];break;case _0xdbcc('0x99'):_0x58059b['body']['from']=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x9a')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x8f')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2[_0xdbcc('0x6b')]['replyMessageId'];break;case'bandwidth':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2[_0xdbcc('0x6b')][0x0][_0xdbcc('0x2d')]['id'];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')]=_0x3ff9c2[_0xdbcc('0x6b')][0x0][_0xdbcc('0x2d')][_0xdbcc('0x89')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')][0x0]['message'][_0xdbcc('0x8f')];break;case'intelepeer':_0x58059b['body'][_0xdbcc('0x89')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x89')];_0x58059b['body'][_0xdbcc('0x6b')]=_0x3ff9c2[_0xdbcc('0x6b')][_0xdbcc('0x2d')];_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')]=_0x3ff9c2['body'][_0xdbcc('0x9b')];break;}}if(_0x58059b['body']['id']){delete _0x58059b[_0xdbcc('0x6b')]['id'];}if(_[_0xdbcc('0x9c')](_0x58059b['body']['from'])){throw new db[(_0xdbcc('0x7f'))][(_0xdbcc('0x80'))](_0xdbcc('0x9d'));}if(_[_0xdbcc('0x9c')](_0x58059b['body'][_0xdbcc('0x6b')])||_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')]===''){throw new db[(_0xdbcc('0x7f'))][(_0xdbcc('0x80'))](_0xdbcc('0x9e'));}if(_[_0xdbcc('0x9c')](_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x9f')])){throw new db['Sequelize'][(_0xdbcc('0x80'))](_0xdbcc('0xa0')+_0x83bf64);}if(!_[_0xdbcc('0xa1')](_0x83bf64,_0x58059b['body']['mapKey'])){throw new db['Sequelize'][(_0xdbcc('0x80'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x83bf64);}_0xa9f7dd[_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x9f')]]=_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')];return db[_0xdbcc('0xa2')]['find']({'where':{'id':_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0x86')]},'include':[{'model':db[_0xdbcc('0x7e')],'as':_0xdbcc('0xa3'),'where':_0xa9f7dd,'limit':0x1,'order':[[_0xdbcc('0x84'),_0xdbcc('0xa4')]]}]});})['then'](handleEntityNotFound(_0x58d9b2,null))[_0xdbcc('0x24')](function(_0x3b5095){if(_0x3b5095){_0x58059b['list']=_[_0xdbcc('0xa5')](_0x3b5095,['Contacts']);if(_0x3b5095[_0xdbcc('0xa3')]['length']){return _0x3b5095[_0xdbcc('0xa3')][0x0];}var _0x500ae9=_[_0xdbcc('0x1c')](_0x58059b[_0xdbcc('0x6b')],{'firstName':_0x58059b[_0xdbcc('0x6b')]['from'],'ListId':_0x3b5095['id']});_0x500ae9[_0x58059b['body'][_0xdbcc('0x9f')]]=_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')];return db[_0xdbcc('0x7e')][_0xdbcc('0x60')](_0x500ae9,{'fields':_0x529a02,'raw':!![]});}})[_0xdbcc('0x24')](handleEntityNotFound(_0x58d9b2,null))[_0xdbcc('0x24')](function(_0x1c1b0b){if(_0x1c1b0b){_0x58059b['contact']=_0x1c1b0b;var _0x234504={'ContactId':_0x1c1b0b['id'],'phone':_0x58059b[_0xdbcc('0x6b')]['from'],'SmsAccountId':_0x3ff9c2[_0xdbcc('0x5b')]['id']};var _0x6fb9b3={'ContactId':_0x1c1b0b['id'],'SmsAccountId':_0x3ff9c2['params']['id'],'closed':![]};return db[_0xdbcc('0xa6')][_0xdbcc('0x5f')]({'where':_0x6fb9b3})[_0xdbcc('0x24')](function(_0x381b57){if(_0x381b57){return[_0x381b57,![]];}return db[_0xdbcc('0xa6')][_0xdbcc('0x60')](_0x234504)[_0xdbcc('0x24')](function(_0x2a9fb3){return[_0x2a9fb3,!![]];});});}})[_0xdbcc('0xa7')](function(_0x42ecbc,_0x2f3fec){_0x58059b[_0xdbcc('0xa8')]=_0x42ecbc[_0xdbcc('0x3b')]({'plain':!![]});_0x58059b['interaction'][_0xdbcc('0xa9')]=![];if(_0x2f3fec){if(_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0xaa')]){_0x58059b['applications'][_0xdbcc('0xab')]({'id':0x0,'priority':_0x58059b[_0xdbcc('0x78')]['length']+0x1,'app':'close','appdata':_0xdbcc('0xac'),'interval':_0xdbcc('0xad')});}_0x58059b[_0xdbcc('0xa8')][_0xdbcc('0xa9')]=!![];}return db[_0xdbcc('0xae')][_0xdbcc('0x60')]({'phone':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x89')],'messageId':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x8c')],'body':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0x6b')],'SmsAccountId':_0x3ff9c2[_0xdbcc('0x5b')]['id'],'SmsInteractionId':_0x42ecbc['id'],'direction':'in','ContactId':_0x42ecbc[_0xdbcc('0xaf')],'AttachmentId':_0x58059b[_0xdbcc('0x6b')][_0xdbcc('0xb0')]});})[_0xdbcc('0x24')](function(_0x5a59ef){_0x58059b[_0xdbcc('0x2d')]=_0x5a59ef;if(!_0x58059b[_0xdbcc('0xa8')][_0xdbcc('0xb1')])return;return db[_0xdbcc('0xb2')][_0xdbcc('0x5f')]({'attributes':['id',_0xdbcc('0x3f')],'where':{'id':_0x58059b['interaction'][_0xdbcc('0xb1')]}});})[_0xdbcc('0x24')](function(_0x3aae0c){if(_0x3aae0c){_0x58059b[_0xdbcc('0x78')][_0xdbcc('0xb3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3aae0c['name']+','+(_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0xb4')]||0xa),'interval':_0xdbcc('0xad')});}if(!_0x58059b[_0xdbcc('0xa8')][_0xdbcc('0xb5')])return;return db[_0xdbcc('0xb6')][_0xdbcc('0x5f')]({'attributes':['id','name'],'where':{'id':_0x58059b[_0xdbcc('0xa8')]['queueId']}});})[_0xdbcc('0x24')](function(_0x8d57d9){if(_0x8d57d9){_0x58059b[_0xdbcc('0x78')][_0xdbcc('0xb3')]({'id':0x0,'priority':0x1,'app':_0xdbcc('0xb7'),'appdata':_0x8d57d9[_0xdbcc('0x3f')]+','+(_0x58059b[_0xdbcc('0x7d')][_0xdbcc('0xb8')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xdbcc('0xb9'),_0x58059b);})[_0xdbcc('0x24')](function(_0x59329e){if(_0x59329e){var _0x296a43=0xc8;var _0x230da0=_0xdbcc('0xba');logger[_0xdbcc('0x25')](_0xdbcc('0x28'),_0x230da0,_0x296a43,'entity\x20found');logger[_0xdbcc('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x230da0,_0x296a43,_0xdbcc('0xbb'),JSON[_0xdbcc('0x29')](_0x59329e));if(_0x58059b[_0xdbcc('0x7d')]['type']==='twilio'){return _0x58d9b2[_0xdbcc('0x30')](_0x296a43)['set']('Content-Type',_0xdbcc('0xbc'))[_0xdbcc('0x40')]('\x0a');}else{return _0x58d9b2[_0xdbcc('0x30')](_0x296a43)[_0xdbcc('0x31')](_0x59329e);}}})[_0xdbcc('0x2e')](handleError(_0x58d9b2,null));};exports[_0xdbcc('0xbd')]=function(_0x33eda3,_0x575c23){var _0x268cfe=_0x33eda3[_0xdbcc('0x5b')]['id'];var _0x4a649c=_0x33eda3[_0xdbcc('0x6b')];var _0x4abc99=0xc8;var _0x33a9e4=null;return db['sequelize']['transaction']({'isolationLevel':db[_0xdbcc('0xbe')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x419ec1){return db[_0xdbcc('0x44')]['findOne']({'where':{'id':_0x268cfe},'transaction':_0x419ec1})[_0xdbcc('0x24')](function(_0xf2a2de){if(_0xf2a2de){return db[_0xdbcc('0x77')]['destroy']({'where':{'SmsAccountId':_0x268cfe},'transaction':_0x419ec1})[_0xdbcc('0x24')](function(){var _0x20f7b2=_[_0xdbcc('0x43')](_0x4a649c,function(_0x154efe){_0x154efe['SmsAccountId']=_0x268cfe;return _0x154efe;});return db[_0xdbcc('0x77')][_0xdbcc('0xbf')](_0x20f7b2,{'transaction':_0x419ec1});});}else{_0x4abc99=0x194;_0x33a9e4=[];}});})[_0xdbcc('0x24')](function(){if(_0x4abc99!==0x194){return db[_0xdbcc('0x77')][_0xdbcc('0xc0')]({'where':{'SmsAccountId':_0x268cfe},'order':_0xdbcc('0x7b')})[_0xdbcc('0x24')](function(_0x4965ee){_0x33a9e4=_0x4965ee;});}})['catch'](function(_0x1e1877){_0x4abc99=0x1f4;logger['error'](_0x1e1877[_0xdbcc('0x3e')]);if(_0x1e1877['name']){delete _0x1e1877[_0xdbcc('0x3f')];}_0x33a9e4=_0x1e1877;})[_0xdbcc('0xc1')](function(){if(_0x33a9e4===null){_0x575c23[_0xdbcc('0x2f')](_0x4abc99);}else{if(_0x4abc99===0x1f4){_0x575c23[_0xdbcc('0x30')](_0x4abc99)['send'](_0x33a9e4);}else{_0x575c23['status'](_0x4abc99)[_0xdbcc('0x31')](_0x33a9e4);}}});};exports[_0xdbcc('0xc2')]=function(_0x41c1a4,_0x284faf,_0x36c976){var _0x14df7b={};var _0x1dc1e8={};var _0x5cac1b;var _0xe1eeef;return db[_0xdbcc('0x44')][_0xdbcc('0x6e')]({'where':{'id':_0x41c1a4[_0xdbcc('0x5b')]['id']}})['then'](handleEntityNotFound(_0x284faf,null))[_0xdbcc('0x24')](function(_0x4142eb){if(_0x4142eb){_0x5cac1b=_0x4142eb;_0x1dc1e8['model']=_[_0xdbcc('0x5d')](db[_0xdbcc('0x77')][_0xdbcc('0x45')]);_0x1dc1e8[_0xdbcc('0x48')]=_[_0xdbcc('0x5d')](_0x41c1a4[_0xdbcc('0x48')]);_0x1dc1e8['filters']=_[_0xdbcc('0x4a')](_0x1dc1e8['model'],_0x1dc1e8[_0xdbcc('0x48')]);_0x14df7b['attributes']=_[_0xdbcc('0x4a')](_0x1dc1e8[_0xdbcc('0x47')],qs['fields'](_0x41c1a4[_0xdbcc('0x48')]['fields']));_0x14df7b[_0xdbcc('0x49')]=_0x14df7b[_0xdbcc('0x49')][_0xdbcc('0x4b')]?_0x14df7b[_0xdbcc('0x49')]:_0x1dc1e8['model'];_0x14df7b[_0xdbcc('0x4e')]=qs[_0xdbcc('0x4f')](_0x41c1a4[_0xdbcc('0x48')]['sort']);_0x14df7b[_0xdbcc('0x50')]=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x41c1a4[_0xdbcc('0x48')],_0x1dc1e8[_0xdbcc('0x51')]));if(_0x41c1a4[_0xdbcc('0x48')][_0xdbcc('0x53')]){_0x14df7b['where']=_['merge'](_0x14df7b[_0xdbcc('0x50')],{'$or':_[_0xdbcc('0x43')](_0x14df7b[_0xdbcc('0x49')],function(_0x347131){var _0x1beb4f={};_0x1beb4f[_0x347131]={'$like':'%'+_0x41c1a4[_0xdbcc('0x48')][_0xdbcc('0x53')]+'%'};return _0x1beb4f;})});}_0x14df7b=_['merge']({},_0x14df7b,_0x41c1a4['options']);return _0x5cac1b[_0xdbcc('0xc2')](_0x14df7b);}})[_0xdbcc('0x24')](function(_0x48fef8){if(_0x48fef8){_0xe1eeef=_0x48fef8[_0xdbcc('0x4b')];if(!_0x41c1a4[_0xdbcc('0x48')][_0xdbcc('0x4c')](_0xdbcc('0x4d'))){_0x14df7b[_0xdbcc('0x34')]=qs[_0xdbcc('0x34')](_0x41c1a4[_0xdbcc('0x48')][_0xdbcc('0x34')]);_0x14df7b['offset']=qs[_0xdbcc('0x32')](_0x41c1a4[_0xdbcc('0x48')][_0xdbcc('0x32')]);}return _0x5cac1b['getApplications'](_0x14df7b);}})[_0xdbcc('0x24')](function(_0x3b6ce){if(_0x3b6ce){return _0x3b6ce?{'count':_0xe1eeef,'rows':_0x3b6ce}:null;}})[_0xdbcc('0x24')](respondWithResult(_0x284faf,null))[_0xdbcc('0x2e')](handleError(_0x284faf,null));};exports[_0xdbcc('0xc3')]=function(_0x50ae60,_0x115f1a,_0x4c3a53){var _0x18b43d={'raw':![],'where':{}};var _0x367b94={};var _0x85950e={'count':0x0,'rows':[]};return db[_0xdbcc('0x44')]['findOne']({'where':{'id':_0x50ae60[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x115f1a,null))[_0xdbcc('0x24')](function(_0x47302b){if(_0x47302b){_0x367b94[_0xdbcc('0x47')]=_[_0xdbcc('0x5d')](db[_0xdbcc('0xa6')][_0xdbcc('0x45')]);_0x367b94[_0xdbcc('0x48')]=_['keys'](_0x50ae60[_0xdbcc('0x48')]);_0x367b94['filters']=_[_0xdbcc('0x4a')](_0x367b94['model'],_0x367b94[_0xdbcc('0x48')]);_0x18b43d['attributes']=_[_0xdbcc('0x4a')](_0x367b94['model'],qs[_0xdbcc('0x5e')](_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0x5e')]));_0x18b43d[_0xdbcc('0x49')]=_0x18b43d['attributes']['length']?_0x18b43d['attributes']:_0x367b94['model'];if(!_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0x4c')](_0xdbcc('0x4d'))){_0x18b43d['limit']=qs[_0xdbcc('0x34')](_0x50ae60[_0xdbcc('0x48')]['limit']);_0x18b43d[_0xdbcc('0x32')]=qs['offset'](_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0x32')]);}_0x18b43d['order']=qs[_0xdbcc('0x4f')](_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0x4f')]);_0x18b43d['where']=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x50ae60[_0xdbcc('0x48')],_0x367b94[_0xdbcc('0x51')]));_0x18b43d['where']['SmsAccountId']=_0x47302b['id'];if(_0x50ae60['query'][_0xdbcc('0x53')]){_0x18b43d[_0xdbcc('0x50')]=_[_0xdbcc('0x54')](_0x18b43d[_0xdbcc('0x50')],{'$or':_[_0xdbcc('0x43')](_0x18b43d[_0xdbcc('0x49')],function(_0x57c727){var _0xcc25e9={};_0xcc25e9[_0x57c727]={'$like':'%'+_0x50ae60['query'][_0xdbcc('0x53')]+'%'};return _0xcc25e9;})});}_0x18b43d=_[_0xdbcc('0x54')]({},_0x18b43d,_0x50ae60['options']);return db[_0xdbcc('0xa6')][_0xdbcc('0x35')]({'where':_0x18b43d[_0xdbcc('0x50')]})['then'](function(_0x2ffb05){_0x85950e['count']=_0x2ffb05;if(_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0x57')]){_0x18b43d[_0xdbcc('0x58')]=[{'model':db[_0xdbcc('0x7e')],'as':_0xdbcc('0xc4'),'required':![]},{'model':db[_0xdbcc('0xb2')],'as':_0xdbcc('0xc5'),'attributes':['name',_0xdbcc('0xc6'),'internal'],'required':![]},{'model':db[_0xdbcc('0xc7')],'as':'Tags','attributes':['id',_0xdbcc('0x3f'),_0xdbcc('0xc8')],'where':_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0xc9')]?{'id':_0x50ae60[_0xdbcc('0x48')][_0xdbcc('0xc9')]}:undefined,'required':_0x50ae60['query'][_0xdbcc('0xc9')]?!![]:![]}];}return db[_0xdbcc('0xa6')][_0xdbcc('0x70')](_0x18b43d);})[_0xdbcc('0x24')](function(_0x3febaa){_0x85950e['rows']=_0x3febaa;return _0x85950e;});}})[_0xdbcc('0x24')](respondWithFilteredResult(_0x115f1a,_0x18b43d))[_0xdbcc('0x2e')](handleError(_0x115f1a,null));};exports[_0xdbcc('0x40')]=function(_0x4c6fe8,_0x2a8641,_0x871dbb){var _0xda9d65,_0x3ab8dc,_0x5ce817;if(_[_0xdbcc('0x9c')](_0x4c6fe8['body'][_0xdbcc('0x6b')])||_0x4c6fe8[_0xdbcc('0x6b')][_0xdbcc('0x6b')]===''){throw new db[(_0xdbcc('0x7f'))][(_0xdbcc('0x80'))](_0xdbcc('0x9e'));}if(_[_0xdbcc('0x9c')](_0x4c6fe8[_0xdbcc('0x6b')]['to'])){throw new db[(_0xdbcc('0x7f'))][(_0xdbcc('0x80'))]('to\x20is\x20mandatory');}_0xda9d65=_0x4c6fe8['body']['to'];return db[_0xdbcc('0x44')][_0xdbcc('0x5f')]({'where':{'id':_0x4c6fe8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0xdbcc('0x7e')],'as':'Contacts','where':{'mobile':_0xda9d65},'limit':0x1,'order':[[_0xdbcc('0x84'),_0xdbcc('0xa4')]]}]}]})[_0xdbcc('0x24')](handleEntityNotFound(_0x2a8641,null))[_0xdbcc('0x24')](function(_0x21d75f){if(_0x21d75f&&_0x21d75f[_0xdbcc('0xca')]){_0x3ab8dc=_0x21d75f['get']({'plain':!![]});if(_0x3ab8dc['List']&&_0x3ab8dc['List'][_0xdbcc('0xa3')][_0xdbcc('0x4b')]){return _0x3ab8dc[_0xdbcc('0xca')][_0xdbcc('0xa3')][0x0];}return db[_0xdbcc('0x7e')]['create'](_['defaults'](_0x4c6fe8[_0xdbcc('0x6b')],{'firstName':_0xda9d65,'mobile':_0xda9d65,'phone':_0xda9d65,'ListId':_0x3ab8dc[_0xdbcc('0x86')]}));}})[_0xdbcc('0x24')](handleEntityNotFound(_0x2a8641,null))[_0xdbcc('0x24')](function(_0x51612d){if(_0x51612d){_0x5ce817=_0x51612d;return db[_0xdbcc('0xa6')][_0xdbcc('0x5f')]({'where':{'ContactId':_0x5ce817['id'],'closed':![],'SmsAccountId':_0x3ab8dc['id']}})['then'](function(_0x376023){if(_0x376023){return[_0x376023,![]];}return db[_0xdbcc('0xa6')][_0xdbcc('0x60')]({'UserId':_0x4c6fe8[_0xdbcc('0x61')]['id'],'ContactId':_0x5ce817['id'],'SmsAccountId':_0x3ab8dc['id'],'phone':_0xda9d65,'firstMsgDirection':_0xdbcc('0xcb'),'Messages':[_[_0xdbcc('0x54')](_0x4c6fe8[_0xdbcc('0x6b')],{'read':![],'body':_0x4c6fe8[_0xdbcc('0x6b')][_0xdbcc('0x6b')],'phone':_0xda9d65,'SmsAccountId':_0x3ab8dc['id'],'UserId':_0x4c6fe8[_0xdbcc('0x61')]['id'],'ContactId':_0x5ce817['id']})]},{'include':[{'model':db[_0xdbcc('0xae')],'as':_0xdbcc('0xcc')}]})[_0xdbcc('0x24')](function(_0x2fcf1a){return[_0x2fcf1a,!![]];});});}})[_0xdbcc('0xa7')](function(_0x1e6ba1,_0x4e6ec3){if(_0x4e6ec3){return _0x1e6ba1;}return db[_0xdbcc('0xae')]['create'](_['merge'](_0x4c6fe8['body'],{'read':![],'body':_0x4c6fe8['body'][_0xdbcc('0x6b')],'phone':_0xda9d65,'SmsAccountId':_0x3ab8dc['id'],'SmsInteractionId':_0x1e6ba1['id'],'UserId':_0x4c6fe8[_0xdbcc('0x61')]['id'],'ContactId':_0x5ce817['id']}))['then'](function(_0x28a1fa){_0x1e6ba1[_0xdbcc('0xcd')][_0xdbcc('0xcc')]=[];_0x1e6ba1[_0xdbcc('0xcd')][_0xdbcc('0xcc')][_0xdbcc('0xab')](_0x28a1fa[_0xdbcc('0xcd')]);return _0x1e6ba1;});})[_0xdbcc('0x24')](respondWithResult(_0x2a8641,null))['catch'](handleError(_0x2a8641,null));};exports[_0xdbcc('0x30')]=function(_0x594835,_0x3f693b,_0x2b9ef3){if(_0x594835[_0xdbcc('0x6b')]['id']){delete _0x594835[_0xdbcc('0x6b')]['id'];}var _0x27487c,_0x5c8e4b,_0x5140fb;return db['SmsAccount']['find']({'where':{'id':_0x594835['params']['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x3f693b,null))[_0xdbcc('0x24')](function(_0x54acaa){if(_0x54acaa){_0x5140fb=_0x54acaa;logger[_0xdbcc('0x27')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0xce'),_0x54acaa['type'],util['inspect'](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));switch(_0x54acaa[_0xdbcc('0x46')]){case _0xdbcc('0x8d'):if(_0x594835[_0xdbcc('0x6b')]['skebby_dispatch_id']&&_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x30')]){_0x5c8e4b=_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x30')];return db[_0xdbcc('0xae')][_0xdbcc('0x5f')]({'where':{'messageId':_0x594835['body'][_0xdbcc('0xcf')]}});}break;case _0xdbcc('0x90'):if(_0x594835[_0xdbcc('0x6b')][_0xdbcc('0xd0')]&&_0x594835[_0xdbcc('0x6b')][_0xdbcc('0xd1')]){_0x5c8e4b=_0x594835['body']['statusInt'];return db['SmsMessage'][_0xdbcc('0x5f')]({'where':{'messageId':_0x594835[_0xdbcc('0x6b')]['requestid']}});}break;case'clicksend':if(_0x594835['body'][_0xdbcc('0x91')]&&_0x594835[_0xdbcc('0x6b')][_0xdbcc('0xd2')]){_0x5c8e4b=_0x594835[_0xdbcc('0x6b')][_0xdbcc('0xd2')];return db[_0xdbcc('0xae')][_0xdbcc('0x5f')]({'where':{'messageId':_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x91')]}});}break;case _0xdbcc('0x95'):var _0x4fe837=_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x96')][0x0];if(_0x4fe837[_0xdbcc('0x8c')]&&_0x4fe837[_0xdbcc('0x30')][_0xdbcc('0xd3')]===_0xdbcc('0xd4')){_0x5c8e4b=_0x4fe837[_0xdbcc('0x30')][_0xdbcc('0xd3')];return db[_0xdbcc('0xae')]['find']({'where':{'messageId':_0x4fe837['messageId']}});}break;case _0xdbcc('0x99'):if(_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x8c')]&&_0x594835[_0xdbcc('0x6b')]['status']){_0x5c8e4b=_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x30')];return db['SmsMessage'][_0xdbcc('0x5f')]({'where':{'messageId':_0x594835[_0xdbcc('0x6b')][_0xdbcc('0x8c')]}});}break;case'bandwidth':if(_0x594835[_0xdbcc('0x6b')][0x0][_0xdbcc('0x2d')]['id']){_0x5c8e4b=_0x594835[_0xdbcc('0x6b')][0x0][_0xdbcc('0x46')];return db[_0xdbcc('0xae')]['find']({'where':{'messageId':_0x594835['body'][0x0][_0xdbcc('0x2d')]['id']}});}break;case _0xdbcc('0xd5'):if(_0x594835[_0xdbcc('0x6b')]['redif']&&_0x594835['body']['status']){_0x5c8e4b=_0x594835['body'][_0xdbcc('0x30')];return db[_0xdbcc('0xae')][_0xdbcc('0x5f')]({'where':{'messageId':_0x594835['body']['redif']}});}break;}}})[_0xdbcc('0x24')](handleEntityNotFound(_0x3f693b,null))[_0xdbcc('0x24')](function(_0x11b623){if(_0x11b623){_0x27487c=_0x11b623;switch(_0x5140fb[_0xdbcc('0x46')]){case'skebby':if(_0x5c8e4b===_0xdbcc('0xd4')){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0x8d'),util[_0xdbcc('0xd6')](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;case _0xdbcc('0x90'):if(_0x5c8e4b==='1'){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger['error'](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0x8d'),util['inspect'](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;case _0xdbcc('0xd7'):if(!_0x594835[_0xdbcc('0x6b')][_0xdbcc('0xd8')]&&_0x5c8e4b>=0xc8&&_0x5c8e4b<=0xce){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0xd7'),util['inspect'](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;case _0xdbcc('0x95'):var _0x16ce3a=_0x594835['body'][_0xdbcc('0x96')][0x0];if(_0x16ce3a[_0xdbcc('0x30')]['groupName']===_0xdbcc('0xd4')){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdbcc('0x30'),_0xdbcc('0x95'),util['inspect'](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;case _0xdbcc('0x99'):if(_0x5c8e4b==_0xdbcc('0xd9')||_0x5c8e4b==_0xdbcc('0xda')){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0x99'),util[_0xdbcc('0xd6')](_0x594835['body'],{'showHidden':![],'depth':null}));}break;case _0xdbcc('0xdb'):if(_0x5c8e4b==_0xdbcc('0xdc')){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')](_0xdbcc('0x28'),_0xdbcc('0x30'),'bandwidth',util[_0xdbcc('0xd6')](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x5c8e4b===_0xdbcc('0xdd')||_0x5c8e4b===_0xdbcc('0xde')){return _0x27487c[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0xd5'),util[_0xdbcc('0xd6')](_0x594835[_0xdbcc('0x6b')],{'showHidden':![],'depth':null}));}break;}return _0x27487c;}})[_0xdbcc('0x24')](respondWithResult(_0x3f693b,null))['catch'](handleError(_0x3f693b,null));};exports['statusGet']=function(_0x265972,_0x540cc2,_0x23573d){var _0x56d1ce,_0x4e16cd,_0x41110c;return db['SmsAccount'][_0xdbcc('0x5f')]({'where':{'id':_0x265972['params']['id']}})['then'](handleEntityNotFound(_0x540cc2,null))[_0xdbcc('0x24')](function(_0x29870d){if(_0x29870d){_0x41110c=_0x29870d;logger[_0xdbcc('0x27')](_0xdbcc('0x28'),_0xdbcc('0x30'),_0xdbcc('0xce'),_0x29870d['type'],util[_0xdbcc('0xd6')](_0x265972[_0xdbcc('0x48')],{'showHidden':![],'depth':null}));switch(_0x29870d['type']){case _0xdbcc('0x97'):if(_0x265972[_0xdbcc('0x48')][_0xdbcc('0xdf')]&&_0x265972[_0xdbcc('0x48')]['state']){_0x4e16cd=_0x265972[_0xdbcc('0x48')][_0xdbcc('0xe0')];return db['SmsMessage'][_0xdbcc('0x5f')]({'where':{'messageId':_0x265972['query'][_0xdbcc('0xdf')]}});}break;}}})[_0xdbcc('0x24')](handleEntityNotFound(_0x540cc2,null))[_0xdbcc('0x24')](function(_0x49c08a){if(_0x49c08a){_0x56d1ce=_0x49c08a;switch(_0x41110c[_0xdbcc('0x46')]){case'csc':if(_0x4e16cd==='2'||_0x4e16cd==='6'){return _0x56d1ce[_0xdbcc('0x67')]({'read':!![]});}else{logger[_0xdbcc('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdbcc('0x30'),'csc',util[_0xdbcc('0xd6')](_0x265972['query'],{'showHidden':![],'depth':null}));};break;}return _0x56d1ce;}})[_0xdbcc('0x24')](respondWithResult(_0x540cc2,null))[_0xdbcc('0x2e')](handleError(_0x540cc2,null));};exports[_0xdbcc('0xe1')]=function(_0x44b925,_0x5167bc,_0x536667){return db['SmsAccount'][_0xdbcc('0x5f')]({'where':{'id':_0x44b925['params']['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x5167bc,null))[_0xdbcc('0x24')](function(_0x3200ac){if(_0x3200ac){return _0x3200ac[_0xdbcc('0xe1')](_0x44b925[_0xdbcc('0x6b')][_0xdbcc('0x72')],_[_0xdbcc('0xa5')](_0x44b925[_0xdbcc('0x6b')],[_0xdbcc('0x72'),'id'])||{})['spread'](function(_0x2294b4){for(var _0x44ba6c=0x0;_0x44ba6c<_0x44b925[_0xdbcc('0x6b')][_0xdbcc('0x72')][_0xdbcc('0x4b')];_0x44ba6c+=0x1){socket[_0xdbcc('0xe2')](_0xdbcc('0xe3'),{'UserId':Number(_0x44b925[_0xdbcc('0x6b')][_0xdbcc('0x72')][_0x44ba6c]),'SmsAccountId':Number(_0x44b925['params']['id'])});}return _0x2294b4;});}})[_0xdbcc('0x24')](respondWithResult(_0x5167bc,null))[_0xdbcc('0x2e')](handleError(_0x5167bc,null));};exports[_0xdbcc('0xe4')]=function(_0x44324c,_0x45ffb6,_0x4b7ed8){return db[_0xdbcc('0x44')][_0xdbcc('0x5f')]({'where':{'id':_0x44324c[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x45ffb6,null))['then'](function(_0x4cd89a){if(_0x4cd89a){return _0x4cd89a[_0xdbcc('0xe4')](_0x44324c['query'][_0xdbcc('0x72')])[_0xdbcc('0x24')](function(){if(_[_0xdbcc('0xe5')](_0x44324c[_0xdbcc('0x48')]['ids'])){for(var _0x333dca=0x0;_0x333dca<_0x44324c[_0xdbcc('0x48')][_0xdbcc('0x72')][_0xdbcc('0x4b')];_0x333dca+=0x1){socket[_0xdbcc('0xe2')](_0xdbcc('0xe6'),{'UserId':Number(_0x44324c['query'][_0xdbcc('0x72')][_0x333dca]),'SmsAccountId':Number(_0x44324c[_0xdbcc('0x5b')]['id'])});}}else{socket[_0xdbcc('0xe2')](_0xdbcc('0xe6'),{'UserId':Number(_0x44324c['query'][_0xdbcc('0x72')]),'SmsAccountId':Number(_0x44324c[_0xdbcc('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x45ffb6,null))['catch'](handleError(_0x45ffb6,null));};exports[_0xdbcc('0xe7')]=function(_0x543483,_0x105448,_0x40d363){var _0xb3d12f={};var _0x285d32={};var _0x2beba6;var _0x1c0939;return db[_0xdbcc('0x44')]['findOne']({'where':{'id':_0x543483[_0xdbcc('0x5b')]['id']}})[_0xdbcc('0x24')](handleEntityNotFound(_0x105448,null))[_0xdbcc('0x24')](function(_0xbcd8d0){if(_0xbcd8d0){_0x2beba6=_0xbcd8d0;_0x285d32['model']=_[_0xdbcc('0x5d')](db[_0xdbcc('0xb2')]['rawAttributes']);_0x285d32[_0xdbcc('0x48')]=_[_0xdbcc('0x5d')](_0x543483[_0xdbcc('0x48')]);_0x285d32[_0xdbcc('0x51')]=_[_0xdbcc('0x4a')](_0x285d32['model'],_0x285d32[_0xdbcc('0x48')]);_0xb3d12f[_0xdbcc('0x49')]=_[_0xdbcc('0x4a')](_0x285d32[_0xdbcc('0x47')],qs[_0xdbcc('0x5e')](_0x543483[_0xdbcc('0x48')][_0xdbcc('0x5e')]));_0xb3d12f[_0xdbcc('0x49')]=_0xb3d12f['attributes']['length']?_0xb3d12f[_0xdbcc('0x49')]:_0x285d32[_0xdbcc('0x47')];_0xb3d12f[_0xdbcc('0x4e')]=qs[_0xdbcc('0x4f')](_0x543483[_0xdbcc('0x48')][_0xdbcc('0x4f')]);_0xb3d12f[_0xdbcc('0x50')]=qs[_0xdbcc('0x51')](_[_0xdbcc('0x52')](_0x543483['query'],_0x285d32[_0xdbcc('0x51')]));if(_0x543483[_0xdbcc('0x48')][_0xdbcc('0x53')]){_0xb3d12f[_0xdbcc('0x50')]=_[_0xdbcc('0x54')](_0xb3d12f['where'],{'$or':_[_0xdbcc('0x43')](_0xb3d12f[_0xdbcc('0x49')],function(_0x55d6c5){var _0x5b0179={};_0x5b0179[_0x55d6c5]={'$like':'%'+_0x543483[_0xdbcc('0x48')][_0xdbcc('0x53')]+'%'};return _0x5b0179;})});}_0xb3d12f=_[_0xdbcc('0x54')]({},_0xb3d12f,_0x543483[_0xdbcc('0x56')]);return _0x2beba6[_0xdbcc('0xe7')](_0xb3d12f);}})[_0xdbcc('0x24')](function(_0x5177f1){if(_0x5177f1){_0x1c0939=_0x5177f1[_0xdbcc('0x4b')];if(!_0x543483[_0xdbcc('0x48')][_0xdbcc('0x4c')]('nolimit')){_0xb3d12f['limit']=qs[_0xdbcc('0x34')](_0x543483[_0xdbcc('0x48')][_0xdbcc('0x34')]);_0xb3d12f[_0xdbcc('0x32')]=qs[_0xdbcc('0x32')](_0x543483[_0xdbcc('0x48')]['offset']);}return _0x2beba6[_0xdbcc('0xe7')](_0xb3d12f);}})['then'](function(_0x513faf){if(_0x513faf){return _0x513faf?{'count':_0x1c0939,'rows':_0x513faf}:null;}})[_0xdbcc('0x24')](respondWithResult(_0x105448,null))[_0xdbcc('0x2e')](handleError(_0x105448,null));}; \ No newline at end of file +var _0x5c34=['SmsQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','\x0a','sequelize','transaction','Transaction','READ_COMMITTED','SmsApplication','finally','getApplications','getInteractions','SmsInteraction','User','Owner','fullname','Tag','Tags','tag','List','out','spread','dataValues','Messages','skebby_dispatch_id','connectel','requestid','statusInt','message_id','status_code','groupName','redif','DELIVERED','inspect','error_code','DELIVRD','ACCEPTD','received\x20delivery\x20report\x20from','state','message-id','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','rimraf','request-promise','moment','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','client','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','SmsAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','show','intersection','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','keys','SmsAccountId','removeDispositions','ids','addAnswer','findOne','CannedAnswer','removeAnswers','notify','account','applications','Applications','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','From','messageId','skebby','sender','text','from','clicksend','plivo','Text','MessageUUID','infobip','results','csc','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','DESC','list','omit','Contacts','contact','push','close','unmanaged','*,*,*,*','interaction','created','SmsMessage','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId'];(function(_0x3c950f,_0x1a9e4b){var _0x23df1c=function(_0xdef971){while(--_0xdef971){_0x3c950f['push'](_0x3c950f['shift']());}};_0x23df1c(++_0x1a9e4b);}(_0x5c34,0x113));var _0x45c3=function(_0xcd9943,_0x4cad04){_0xcd9943=_0xcd9943-0x0;var _0x19a773=_0x5c34[_0xcd9943];return _0x19a773;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45c3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x45c3('0x1'));var moment=require(_0x45c3('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x45c3('0x3'));var util=require(_0x45c3('0x4'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x45c3('0x5'));var fs=require('fs');var fs_extra=require(_0x45c3('0x6'));var _=require(_0x45c3('0x7'));var squel=require(_0x45c3('0x8'));var crypto=require(_0x45c3('0x9'));var jsforce=require(_0x45c3('0xa'));var deskjs=require(_0x45c3('0xb'));var toCsv=require(_0x45c3('0xc'));var querystring=require(_0x45c3('0xd'));var Papa=require(_0x45c3('0xe'));var Redis=require(_0x45c3('0xf'));var authService=require(_0x45c3('0x10'));var qs=require(_0x45c3('0x11'));var as=require(_0x45c3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x45c3('0x13'))(_0x45c3('0x14'));var utils=require(_0x45c3('0x15'));var config=require(_0x45c3('0x16'));var licenseUtil=require(_0x45c3('0x17'));var db=require(_0x45c3('0x18'))['db'];config[_0x45c3('0x19')]=_[_0x45c3('0x1a')](config[_0x45c3('0x19')],{'host':_0x45c3('0x1b'),'port':0x18eb});var socket=require(_0x45c3('0x1c'))(new Redis(config[_0x45c3('0x19')]));require(_0x45c3('0x1d'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x45c3('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x5e2b34,_0x3c4cae,_0x239dd6,_0xa9eeaf){return new BPromise(function(_0x50ebb7,_0x44643a){var _0x30e705=_0xa9eeaf||client;return _0x30e705['request'](_0x5e2b34,_0x239dd6)[_0x45c3('0x1f')](function(_0x528ade){logger[_0x45c3('0x20')](_0x45c3('0x21'),_0x3c4cae,_0x45c3('0x22'));logger[_0x45c3('0x23')](_0x45c3('0x24'),_0x3c4cae,_0x45c3('0x22'),JSON[_0x45c3('0x25')](_0x528ade));if(_0x528ade[_0x45c3('0x26')]){if(_0x528ade[_0x45c3('0x26')][_0x45c3('0x27')]===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x3c4cae,_0x528ade[_0x45c3('0x26')][_0x45c3('0x28')]);return _0x44643a(_0x528ade[_0x45c3('0x26')][_0x45c3('0x28')]);}logger[_0x45c3('0x26')](_0x45c3('0x21'),_0x3c4cae,_0x528ade[_0x45c3('0x26')]['message']);return _0x50ebb7(_0x528ade[_0x45c3('0x26')][_0x45c3('0x28')]);}else{logger[_0x45c3('0x20')](_0x45c3('0x21'),_0x3c4cae,'request\x20sent');_0x50ebb7(_0x528ade[_0x45c3('0x29')][_0x45c3('0x28')]);}})[_0x45c3('0x2a')](function(_0x292d22){logger[_0x45c3('0x26')](_0x45c3('0x21'),_0x3c4cae,_0x292d22);_0x44643a(_0x292d22);});});}function respondWithStatusCode(_0x1460de,_0x1dc6ee){_0x1dc6ee=_0x1dc6ee||0xcc;return function(_0x45ad9d){if(_0x45ad9d){return _0x1460de[_0x45c3('0x2b')](_0x1dc6ee);}return _0x1460de[_0x45c3('0x2c')](_0x1dc6ee)[_0x45c3('0x2d')]();};}function respondWithResult(_0x3c0ce7,_0x23628d){_0x23628d=_0x23628d||0xc8;return function(_0x473ecc){if(_0x473ecc){return _0x3c0ce7[_0x45c3('0x2c')](_0x23628d)[_0x45c3('0x2e')](_0x473ecc);}};}function respondWithFilteredResult(_0x38d57b,_0x3b2163){return function(_0x1c0a12){if(_0x1c0a12){var _0x452dde=typeof _0x3b2163[_0x45c3('0x2f')]===_0x45c3('0x30')&&typeof _0x3b2163[_0x45c3('0x31')]===_0x45c3('0x30');var _0x1c941f=_0x1c0a12['count'];var _0x39059c=_0x452dde?0x0:_0x3b2163[_0x45c3('0x2f')];var _0x2e332b=_0x452dde?_0x1c0a12[_0x45c3('0x32')]:_0x3b2163[_0x45c3('0x2f')]+_0x3b2163[_0x45c3('0x31')];var _0x9fec13;if(_0x2e332b>=_0x1c941f){_0x2e332b=_0x1c941f;_0x9fec13=0xc8;}else{_0x9fec13=0xce;}_0x38d57b['status'](_0x9fec13);return _0x38d57b[_0x45c3('0x33')](_0x45c3('0x34'),_0x39059c+'-'+_0x2e332b+'/'+_0x1c941f)[_0x45c3('0x2e')](_0x1c0a12);}return null;};}function patchUpdates(_0x221ea7){return function(_0x1633ee){try{jsonpatch[_0x45c3('0x35')](_0x1633ee,_0x221ea7,!![]);}catch(_0x274d51){return BPromise[_0x45c3('0x36')](_0x274d51);}return _0x1633ee['save']();};}function saveUpdates(_0x4b7125,_0x3fc66a){return function(_0x3e7e98){if(_0x3e7e98){return _0x3e7e98[_0x45c3('0x37')](_0x4b7125)[_0x45c3('0x1f')](function(_0x167049){return _0x167049;});}return null;};}function removeEntity(_0x5be2ff,_0x3340b7){return function(_0x5838b0){if(_0x5838b0){return _0x5838b0[_0x45c3('0x38')]()[_0x45c3('0x1f')](function(){var _0x394784=_0x5838b0[_0x45c3('0x39')]({'plain':!![]});var _0x817a08=_0x45c3('0x3a');return db[_0x45c3('0x3b')]['destroy']({'where':{'type':_0x817a08,'resourceId':_0x394784['id']}})['then'](function(){return _0x5838b0;});})[_0x45c3('0x1f')](function(){_0x5be2ff[_0x45c3('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b4384,_0x15c07c){return function(_0x28775a){if(!_0x28775a){_0x3b4384[_0x45c3('0x2b')](0x194);}return _0x28775a;};}function handleError(_0x1e1dd2,_0x566e27){_0x566e27=_0x566e27||0x1f4;return function(_0x274bb2){logger['error'](_0x274bb2[_0x45c3('0x3c')]);if(_0x274bb2['name']){delete _0x274bb2[_0x45c3('0x3d')];}_0x1e1dd2[_0x45c3('0x2c')](_0x566e27)[_0x45c3('0x3e')](_0x274bb2);};}exports['index']=function(_0x1d9f9b,_0xe3a695){var _0x561f57={'include':[{'model':db[_0x45c3('0x3f')],'as':_0x45c3('0x40')}]},_0x2e671a={},_0x44e554={'count':0x0,'rows':[]};var _0x5a9a5=_[_0x45c3('0x41')](db[_0x45c3('0x42')][_0x45c3('0x43')],function(_0x289691){return{'name':_0x289691[_0x45c3('0x44')],'type':_0x289691[_0x45c3('0x45')][_0x45c3('0x46')]};});_0x2e671a[_0x45c3('0x47')]=_[_0x45c3('0x41')](_0x5a9a5,_0x45c3('0x3d'));_0x2e671a[_0x45c3('0x48')]=_['keys'](_0x1d9f9b['query']);_0x2e671a[_0x45c3('0x49')]=_['intersection'](_0x2e671a[_0x45c3('0x47')],_0x2e671a[_0x45c3('0x48')]);_0x561f57[_0x45c3('0x4a')]=_['intersection'](_0x2e671a[_0x45c3('0x47')],qs[_0x45c3('0x4b')](_0x1d9f9b[_0x45c3('0x48')][_0x45c3('0x4b')]));_0x561f57[_0x45c3('0x4a')]=_0x561f57[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x561f57['attributes']:_0x2e671a['model'];if(!_0x1d9f9b['query'][_0x45c3('0x4d')](_0x45c3('0x4e'))){_0x561f57['limit']=qs[_0x45c3('0x31')](_0x1d9f9b[_0x45c3('0x48')][_0x45c3('0x31')]);_0x561f57[_0x45c3('0x2f')]=qs[_0x45c3('0x2f')](_0x1d9f9b['query']['offset']);}_0x561f57[_0x45c3('0x4f')]=qs[_0x45c3('0x50')](_0x1d9f9b[_0x45c3('0x48')][_0x45c3('0x50')]);_0x561f57[_0x45c3('0x51')]=qs['filters'](_[_0x45c3('0x52')](_0x1d9f9b[_0x45c3('0x48')],_0x2e671a[_0x45c3('0x49')]),_0x5a9a5);if(_0x1d9f9b[_0x45c3('0x48')]['filter']){_0x561f57[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x561f57[_0x45c3('0x51')],{'$or':_['map'](_0x5a9a5,function(_0x599428){if(_0x599428[_0x45c3('0x45')]!=='VIRTUAL'){var _0x149dbc={};_0x149dbc[_0x599428['name']]={'$like':'%'+_0x1d9f9b[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x149dbc;}})});}_0x561f57=_[_0x45c3('0x53')]({},_0x561f57,_0x1d9f9b[_0x45c3('0x55')]);var _0xa6533b={'where':_0x561f57['where']};return db['SmsAccount']['count'](_0xa6533b)[_0x45c3('0x1f')](function(_0x587dad){_0x44e554['count']=_0x587dad;if(_0x1d9f9b['query'][_0x45c3('0x56')]){_0x561f57['include']=[{'all':!![]}];}return db[_0x45c3('0x42')][_0x45c3('0x57')](_0x561f57);})['then'](function(_0x1a62b4){_0x44e554[_0x45c3('0x58')]=_0x1a62b4;return _0x44e554;})[_0x45c3('0x1f')](respondWithFilteredResult(_0xe3a695,_0x561f57))[_0x45c3('0x2a')](handleError(_0xe3a695,null));};exports[_0x45c3('0x59')]=function(_0x2fcc0c,_0xbae89){var _0x4b756d={'raw':![],'where':{'id':_0x2fcc0c['params']['id']},'include':[{'model':db[_0x45c3('0x3f')],'as':_0x45c3('0x40')}]},_0x3dc989={};_0x3dc989[_0x45c3('0x47')]=_['keys'](db[_0x45c3('0x42')][_0x45c3('0x43')]);_0x3dc989['query']=_['keys'](_0x2fcc0c['query']);_0x3dc989[_0x45c3('0x49')]=_[_0x45c3('0x5a')](_0x3dc989[_0x45c3('0x47')],_0x3dc989[_0x45c3('0x48')]);_0x4b756d[_0x45c3('0x4a')]=_['intersection'](_0x3dc989[_0x45c3('0x47')],qs[_0x45c3('0x4b')](_0x2fcc0c[_0x45c3('0x48')]['fields']));_0x4b756d[_0x45c3('0x4a')]=_0x4b756d[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x4b756d[_0x45c3('0x4a')]:_0x3dc989[_0x45c3('0x47')];if(_0x2fcc0c[_0x45c3('0x48')]['includeAll']){_0x4b756d[_0x45c3('0x5b')]=[{'all':!![]}];}_0x4b756d=_[_0x45c3('0x53')]({},_0x4b756d,_0x2fcc0c[_0x45c3('0x55')]);return db[_0x45c3('0x42')]['find'](_0x4b756d)[_0x45c3('0x1f')](handleEntityNotFound(_0xbae89,null))[_0x45c3('0x1f')](respondWithResult(_0xbae89,null))['catch'](handleError(_0xbae89,null));};exports['create']=function(_0x38e58c,_0x35a935){return db[_0x45c3('0x42')][_0x45c3('0x5c')](_0x38e58c[_0x45c3('0x5d')],{})['then'](function(_0xc19193){var _0x4a6610=_0x38e58c[_0x45c3('0x5e')][_0x45c3('0x39')]({'plain':!![]});if(!_0x4a6610)throw new Error(_0x45c3('0x5f'));if(_0x4a6610[_0x45c3('0x60')]===_0x45c3('0x5e')){var _0x6a0296=_0xc19193[_0x45c3('0x39')]({'plain':!![]});var _0x3fc284=_0x45c3('0x3a');return db['UserProfileSection'][_0x45c3('0x61')]({'where':{'name':_0x3fc284,'userProfileId':_0x4a6610[_0x45c3('0x62')]},'raw':!![]})[_0x45c3('0x1f')](function(_0x53713e){if(_0x53713e&&_0x53713e['autoAssociation']===0x0){return db[_0x45c3('0x3b')][_0x45c3('0x5c')]({'name':_0x6a0296[_0x45c3('0x3d')],'resourceId':_0x6a0296['id'],'type':_0x53713e[_0x45c3('0x3d')],'sectionId':_0x53713e['id']},{})[_0x45c3('0x1f')](function(){return _0xc19193;});}else{return _0xc19193;}})['catch'](function(_0x438ed6){logger['error'](_0x45c3('0x63'),_0x438ed6);throw _0x438ed6;});}return _0xc19193;})[_0x45c3('0x1f')](respondWithResult(_0x35a935,0xc9))['catch'](handleError(_0x35a935,null));};exports[_0x45c3('0x37')]=function(_0x527f53,_0xf3a5d7){if(_0x527f53[_0x45c3('0x5d')]['id']){delete _0x527f53[_0x45c3('0x5d')]['id'];}return db[_0x45c3('0x42')]['find']({'where':{'id':_0x527f53[_0x45c3('0x64')]['id']},'include':[{'model':db[_0x45c3('0x3f')],'as':_0x45c3('0x40')}]})[_0x45c3('0x1f')](handleEntityNotFound(_0xf3a5d7,null))[_0x45c3('0x1f')](saveUpdates(_0x527f53[_0x45c3('0x5d')],null))[_0x45c3('0x1f')](respondWithResult(_0xf3a5d7,null))[_0x45c3('0x2a')](handleError(_0xf3a5d7,null));};exports[_0x45c3('0x38')]=function(_0x267845,_0xb67cee){return db[_0x45c3('0x42')]['find']({'where':{'id':_0x267845[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0xb67cee,null))[_0x45c3('0x1f')](removeEntity(_0xb67cee,null))[_0x45c3('0x2a')](handleError(_0xb67cee,null));};exports[_0x45c3('0x65')]=function(_0x2b9c92,_0x41aaac){return db[_0x45c3('0x42')][_0x45c3('0x65')]()[_0x45c3('0x1f')](respondWithResult(_0x41aaac,null))[_0x45c3('0x2a')](handleError(_0x41aaac,null));};exports[_0x45c3('0x66')]=function(_0x53a96f,_0x400453,_0x4448c0){if(_0x53a96f['body']['id']){delete _0x53a96f['body']['id'];}return db[_0x45c3('0x42')][_0x45c3('0x61')]({'where':{'id':_0x53a96f[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0x400453,null))['then'](function(_0x678dfa){if(_0x678dfa){_0x53a96f['body']['SmsAccountId']=_0x678dfa['id'];return db[_0x45c3('0x67')][_0x45c3('0x5c')](_0x53a96f[_0x45c3('0x5d')]);}})['then'](respondWithResult(_0x400453,null))[_0x45c3('0x2a')](handleError(_0x400453,null));};exports['getDispositions']=function(_0x33247d,_0x121e05,_0x579213){var _0x517cdc={'raw':![],'where':{}};var _0x277044={};var _0x51346f={'count':0x0,'rows':[]};return db[_0x45c3('0x42')]['findOne']({'where':{'id':_0x33247d[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x121e05,null))['then'](function(_0x250baf){if(_0x250baf){_0x277044[_0x45c3('0x47')]=_['keys'](db[_0x45c3('0x67')]['rawAttributes']);_0x277044['query']=_[_0x45c3('0x68')](_0x33247d[_0x45c3('0x48')]);_0x277044[_0x45c3('0x49')]=_['intersection'](_0x277044[_0x45c3('0x47')],_0x277044[_0x45c3('0x48')]);_0x517cdc['attributes']=_[_0x45c3('0x5a')](_0x277044['model'],qs['fields'](_0x33247d[_0x45c3('0x48')][_0x45c3('0x4b')]));_0x517cdc[_0x45c3('0x4a')]=_0x517cdc[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x517cdc[_0x45c3('0x4a')]:_0x277044[_0x45c3('0x47')];if(!_0x33247d[_0x45c3('0x48')]['hasOwnProperty'](_0x45c3('0x4e'))){_0x517cdc[_0x45c3('0x31')]=qs['limit'](_0x33247d[_0x45c3('0x48')][_0x45c3('0x31')]);_0x517cdc['offset']=qs[_0x45c3('0x2f')](_0x33247d[_0x45c3('0x48')]['offset']);}_0x517cdc[_0x45c3('0x4f')]=qs[_0x45c3('0x50')](_0x33247d[_0x45c3('0x48')]['sort']);_0x517cdc[_0x45c3('0x51')]=qs[_0x45c3('0x49')](_['pick'](_0x33247d[_0x45c3('0x48')],_0x277044[_0x45c3('0x49')]));_0x517cdc[_0x45c3('0x51')][_0x45c3('0x69')]=_0x250baf['id'];if(_0x33247d['query'][_0x45c3('0x54')]){_0x517cdc[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x517cdc['where'],{'$or':_['map'](_0x517cdc[_0x45c3('0x4a')],function(_0x83fbd){var _0x5a1536={};_0x5a1536[_0x83fbd]={'$like':'%'+_0x33247d[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x5a1536;})});}_0x517cdc=_[_0x45c3('0x53')]({},_0x517cdc,_0x33247d[_0x45c3('0x55')]);return db[_0x45c3('0x67')]['count']({'where':_0x517cdc['where']})['then'](function(_0x5e7b41){_0x51346f['count']=_0x5e7b41;if(_0x33247d[_0x45c3('0x48')][_0x45c3('0x56')]){_0x517cdc[_0x45c3('0x5b')]=[{'all':!![]}];}return db[_0x45c3('0x67')][_0x45c3('0x57')](_0x517cdc);})[_0x45c3('0x1f')](function(_0x5c4ac5){_0x51346f[_0x45c3('0x58')]=_0x5c4ac5;return _0x51346f;});}})[_0x45c3('0x1f')](respondWithFilteredResult(_0x121e05,_0x517cdc))[_0x45c3('0x2a')](handleError(_0x121e05,null));};exports[_0x45c3('0x6a')]=function(_0x4f6a05,_0x4c84c1,_0x210d53){return db['SmsAccount'][_0x45c3('0x61')]({'where':{'id':_0x4f6a05[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0x4c84c1,null))[_0x45c3('0x1f')](function(_0x256a3e){if(_0x256a3e){return _0x256a3e[_0x45c3('0x6a')](_0x4f6a05[_0x45c3('0x48')][_0x45c3('0x6b')]);}})['then'](respondWithStatusCode(_0x4c84c1,null))[_0x45c3('0x2a')](handleError(_0x4c84c1,null));};exports[_0x45c3('0x6c')]=function(_0xadbab6,_0x3721d2,_0x4faec9){if(_0xadbab6['body']['id']){delete _0xadbab6[_0x45c3('0x5d')]['id'];}return db[_0x45c3('0x42')]['find']({'where':{'id':_0xadbab6[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3721d2,null))[_0x45c3('0x1f')](function(_0x137843){if(_0x137843){_0xadbab6[_0x45c3('0x5d')][_0x45c3('0x69')]=_0x137843['id'];return db['CannedAnswer'][_0x45c3('0x5c')](_0xadbab6['body']);}})[_0x45c3('0x1f')](respondWithResult(_0x3721d2,null))[_0x45c3('0x2a')](handleError(_0x3721d2,null));};exports['getAnswers']=function(_0x91b709,_0x34b8ab,_0x367b6b){var _0x327145={'raw':![],'where':{}};var _0x4c27e9={};var _0x317ebd={'count':0x0,'rows':[]};return db['SmsAccount'][_0x45c3('0x6d')]({'where':{'id':_0x91b709[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0x34b8ab,null))[_0x45c3('0x1f')](function(_0x166293){if(_0x166293){_0x4c27e9[_0x45c3('0x47')]=_[_0x45c3('0x68')](db[_0x45c3('0x6e')][_0x45c3('0x43')]);_0x4c27e9[_0x45c3('0x48')]=_['keys'](_0x91b709[_0x45c3('0x48')]);_0x4c27e9[_0x45c3('0x49')]=_[_0x45c3('0x5a')](_0x4c27e9['model'],_0x4c27e9[_0x45c3('0x48')]);_0x327145[_0x45c3('0x4a')]=_[_0x45c3('0x5a')](_0x4c27e9[_0x45c3('0x47')],qs['fields'](_0x91b709[_0x45c3('0x48')][_0x45c3('0x4b')]));_0x327145[_0x45c3('0x4a')]=_0x327145[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x327145[_0x45c3('0x4a')]:_0x4c27e9['model'];if(!_0x91b709[_0x45c3('0x48')][_0x45c3('0x4d')](_0x45c3('0x4e'))){_0x327145[_0x45c3('0x31')]=qs['limit'](_0x91b709[_0x45c3('0x48')][_0x45c3('0x31')]);_0x327145['offset']=qs[_0x45c3('0x2f')](_0x91b709['query'][_0x45c3('0x2f')]);}_0x327145[_0x45c3('0x4f')]=qs[_0x45c3('0x50')](_0x91b709[_0x45c3('0x48')][_0x45c3('0x50')]);_0x327145[_0x45c3('0x51')]=qs[_0x45c3('0x49')](_[_0x45c3('0x52')](_0x91b709[_0x45c3('0x48')],_0x4c27e9[_0x45c3('0x49')]));_0x327145['where'][_0x45c3('0x69')]=_0x166293['id'];if(_0x91b709['query'][_0x45c3('0x54')]){_0x327145[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x327145[_0x45c3('0x51')],{'$or':_[_0x45c3('0x41')](_0x327145[_0x45c3('0x4a')],function(_0x45b1ae){var _0x1ff5b1={};_0x1ff5b1[_0x45b1ae]={'$like':'%'+_0x91b709[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x1ff5b1;})});}_0x327145=_[_0x45c3('0x53')]({},_0x327145,_0x91b709[_0x45c3('0x55')]);return db[_0x45c3('0x6e')][_0x45c3('0x32')]({'where':_0x327145[_0x45c3('0x51')]})['then'](function(_0x55e281){_0x317ebd['count']=_0x55e281;if(_0x91b709[_0x45c3('0x48')]['includeAll']){_0x327145[_0x45c3('0x5b')]=[{'all':!![]}];}return db[_0x45c3('0x6e')][_0x45c3('0x57')](_0x327145);})[_0x45c3('0x1f')](function(_0x5f5ae0){_0x317ebd[_0x45c3('0x58')]=_0x5f5ae0;return _0x317ebd;});}})[_0x45c3('0x1f')](respondWithFilteredResult(_0x34b8ab,_0x327145))[_0x45c3('0x2a')](handleError(_0x34b8ab,null));};exports[_0x45c3('0x6f')]=function(_0x49ca25,_0xaaa3f7,_0x12440d){return db[_0x45c3('0x42')][_0x45c3('0x61')]({'where':{'id':_0x49ca25[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0xaaa3f7,null))[_0x45c3('0x1f')](function(_0x7ee757){if(_0x7ee757){return _0x7ee757['removeAnswers'](_0x49ca25[_0x45c3('0x48')][_0x45c3('0x6b')]);}})['then'](respondWithStatusCode(_0xaaa3f7,null))[_0x45c3('0x2a')](handleError(_0xaaa3f7,null));};exports[_0x45c3('0x70')]=function(_0x2a78db,_0x31b5e7,_0x373f24){var _0xfa5e8b={'channel':'sms'};var _0x537d60=[];var _0x49dbfa=[];var _0x328fe0={};return db['SmsAccount'][_0x45c3('0x61')]({'where':{'id':_0x2a78db[_0x45c3('0x64')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x45c3('0x1f')](handleEntityNotFound(_0x31b5e7,null))[_0x45c3('0x1f')](function(_0xf9b0a3){_0xfa5e8b[_0x45c3('0x71')]=_0xf9b0a3;_0xfa5e8b[_0x45c3('0x72')]=_['orderBy'](_0xf9b0a3[_0x45c3('0x73')],['priority'],['asc']);if(_0xfa5e8b['account'][_0x45c3('0x73')]){delete _0xfa5e8b['account'][_0x45c3('0x73')];}return db[_0x45c3('0x74')][_0x45c3('0x65')]();})['then'](function(_0x1efb5f){if(!_0x1efb5f){throw new db['Sequelize'][(_0x45c3('0x75'))](_0x45c3('0x76'));}_0x537d60=_[_0x45c3('0x77')](_[_0x45c3('0x68')](_0x1efb5f),[_0x45c3('0x78'),_0x45c3('0x79')]);_0x49dbfa=_[_0x45c3('0x77')](_[_0x45c3('0x68')](_0x1efb5f),[_0x45c3('0x78'),_0x45c3('0x79'),'CompanyId','ListId']);_0xfa5e8b[_0x45c3('0x5d')]={'mapKey':_0x45c3('0x7a')};if(_0xfa5e8b['account'][_0x45c3('0x45')]){switch(_0xfa5e8b[_0x45c3('0x71')][_0x45c3('0x45')]){case _0x45c3('0x7b'):_0xfa5e8b[_0x45c3('0x5d')]['from']=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x7c')];_0xfa5e8b['body'][_0x45c3('0x5d')]=_0x2a78db['body']['Body'];_0xfa5e8b['body'][_0x45c3('0x7d')]=_0x2a78db[_0x45c3('0x5d')]['MessageSid'];break;case _0x45c3('0x7e'):_0xfa5e8b['body']['from']='+'+_0x2a78db['body'][_0x45c3('0x7f')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x80')];break;case'connectel':_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x81')];_0xfa5e8b['body']['body']=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x28')];break;case _0x45c3('0x82'):_0xfa5e8b['body'][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x81')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x5d')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x7d')]=_0x2a78db[_0x45c3('0x5d')]['message_id'];break;case _0x45c3('0x83'):_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x7c')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x84')];_0xfa5e8b[_0x45c3('0x5d')]['messageId']=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x85')];break;case _0x45c3('0x86'):_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]='+'+_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x87')][0x0][_0x45c3('0x81')];_0xfa5e8b['body'][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x87')][0x0][_0x45c3('0x80')];_0xfa5e8b[_0x45c3('0x5d')]['messageId']=_0x2a78db[_0x45c3('0x5d')]['results'][0x0][_0x45c3('0x7d')];break;case _0x45c3('0x88'):_0xfa5e8b['body']['from']=_0x2a78db['body']['originatingAddress'];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x89')][_0x45c3('0x28')];break;case _0x45c3('0x8a'):_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x8b')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')]['text'];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x7d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x8c')];break;case _0x45c3('0x8d'):_0xfa5e8b[_0x45c3('0x5d')]['messageId']=_0x2a78db[_0x45c3('0x5d')][0x0][_0x45c3('0x28')]['id'];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][0x0][_0x45c3('0x28')][_0x45c3('0x81')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][0x0]['message'][_0x45c3('0x80')];break;case _0x45c3('0x8e'):_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x81')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]=_0x2a78db[_0x45c3('0x5d')][_0x45c3('0x28')];_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x7d')]=_0x2a78db['body'][_0x45c3('0x8f')];break;}}if(_0xfa5e8b['body']['id']){delete _0xfa5e8b['body']['id'];}if(_[_0x45c3('0x90')](_0xfa5e8b['body']['from'])){throw new db[(_0x45c3('0x91'))][(_0x45c3('0x75'))](_0x45c3('0x92'));}if(_[_0x45c3('0x90')](_0xfa5e8b['body'][_0x45c3('0x5d')])||_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x5d')]===''){throw new db[(_0x45c3('0x91'))]['ValidationError'](_0x45c3('0x93'));}if(_[_0x45c3('0x90')](_0xfa5e8b['body']['mapKey'])){throw new db[(_0x45c3('0x91'))]['ValidationError'](_0x45c3('0x94')+_0x49dbfa);}if(!_['includes'](_0x49dbfa,_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x95')])){throw new db[(_0x45c3('0x91'))][(_0x45c3('0x75'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x49dbfa);}_0x328fe0[_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x95')]]=_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')];return db[_0x45c3('0x96')][_0x45c3('0x61')]({'where':{'id':_0xfa5e8b[_0x45c3('0x71')][_0x45c3('0x97')]},'include':[{'model':db[_0x45c3('0x74')],'as':'Contacts','where':_0x328fe0,'limit':0x1,'order':[[_0x45c3('0x79'),_0x45c3('0x98')]]}]});})[_0x45c3('0x1f')](handleEntityNotFound(_0x31b5e7,null))[_0x45c3('0x1f')](function(_0x22b7cf){if(_0x22b7cf){_0xfa5e8b[_0x45c3('0x99')]=_[_0x45c3('0x9a')](_0x22b7cf,['Contacts']);if(_0x22b7cf[_0x45c3('0x9b')][_0x45c3('0x4c')]){return _0x22b7cf[_0x45c3('0x9b')][0x0];}var _0x1c29b0=_[_0x45c3('0x1a')](_0xfa5e8b[_0x45c3('0x5d')],{'firstName':_0xfa5e8b['body'][_0x45c3('0x81')],'ListId':_0x22b7cf['id']});_0x1c29b0[_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x95')]]=_0xfa5e8b['body'][_0x45c3('0x81')];return db['CmContact'][_0x45c3('0x5c')](_0x1c29b0,{'fields':_0x537d60,'raw':!![]});}})['then'](handleEntityNotFound(_0x31b5e7,null))['then'](function(_0x154d5d){if(_0x154d5d){_0xfa5e8b[_0x45c3('0x9c')]=_0x154d5d;var _0x5d9b98={'ContactId':_0x154d5d['id'],'phone':_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x81')],'SmsAccountId':_0x2a78db[_0x45c3('0x64')]['id']};var _0x36e980={'ContactId':_0x154d5d['id'],'SmsAccountId':_0x2a78db[_0x45c3('0x64')]['id'],'closed':![]};return db['SmsInteraction'][_0x45c3('0x61')]({'where':_0x36e980})[_0x45c3('0x1f')](function(_0x6d729b){if(_0x6d729b){return[_0x6d729b,![]];}return db['SmsInteraction']['create'](_0x5d9b98)[_0x45c3('0x1f')](function(_0x127777){return[_0x127777,!![]];});});}})['spread'](function(_0x5df608,_0x29081a){_0xfa5e8b['interaction']=_0x5df608['get']({'plain':!![]});_0xfa5e8b['interaction']['created']=![];if(_0x29081a){if(_0xfa5e8b[_0x45c3('0x71')]['autoclose']){_0xfa5e8b[_0x45c3('0x72')][_0x45c3('0x9d')]({'id':0x0,'priority':_0xfa5e8b[_0x45c3('0x72')][_0x45c3('0x4c')]+0x1,'app':_0x45c3('0x9e'),'appdata':_0x45c3('0x9f'),'interval':_0x45c3('0xa0')});}_0xfa5e8b[_0x45c3('0xa1')][_0x45c3('0xa2')]=!![];}return db[_0x45c3('0xa3')][_0x45c3('0x5c')]({'phone':_0xfa5e8b['body']['from'],'messageId':_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0x7d')],'body':_0xfa5e8b['body'][_0x45c3('0x5d')],'SmsAccountId':_0x2a78db['params']['id'],'SmsInteractionId':_0x5df608['id'],'direction':'in','ContactId':_0x5df608[_0x45c3('0xa4')],'AttachmentId':_0xfa5e8b[_0x45c3('0x5d')][_0x45c3('0xa5')]});})[_0x45c3('0x1f')](function(_0x55918e){_0xfa5e8b[_0x45c3('0x28')]=_0x55918e;if(!_0xfa5e8b[_0x45c3('0xa1')]['UserId'])return;return db['User']['find']({'attributes':['id',_0x45c3('0x3d')],'where':{'id':_0xfa5e8b[_0x45c3('0xa1')][_0x45c3('0xa6')]}});})[_0x45c3('0x1f')](function(_0x431c5e){if(_0x431c5e){_0xfa5e8b[_0x45c3('0x72')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x431c5e['name']+','+(_0xfa5e8b[_0x45c3('0x71')][_0x45c3('0xa7')]||0xa),'interval':'*,*,*,*'});}if(!_0xfa5e8b[_0x45c3('0xa1')][_0x45c3('0xa8')])return;return db[_0x45c3('0xa9')][_0x45c3('0x61')]({'attributes':['id',_0x45c3('0x3d')],'where':{'id':_0xfa5e8b[_0x45c3('0xa1')]['queueId']}});})[_0x45c3('0x1f')](function(_0x50cf78){if(_0x50cf78){_0xfa5e8b[_0x45c3('0x72')][_0x45c3('0xaa')]({'id':0x0,'priority':0x1,'app':_0x45c3('0xab'),'appdata':_0x50cf78[_0x45c3('0x3d')]+','+(_0xfa5e8b['account'][_0x45c3('0xac')]||0x12c),'interval':_0x45c3('0xa0')});}return respondWithRpcPromise(_0x45c3('0xad'),_0x45c3('0xae'),_0xfa5e8b);})[_0x45c3('0x1f')](function(_0x2d15ea){if(_0x2d15ea){var _0x513632=0xc8;var _0x230753=_0x45c3('0xaf');logger[_0x45c3('0x20')](_0x45c3('0x24'),_0x230753,_0x513632,_0x45c3('0xb0'));logger[_0x45c3('0x23')](_0x45c3('0xb1'),_0x230753,_0x513632,_0x45c3('0xb0'),JSON[_0x45c3('0x25')](_0x2d15ea));if(_0xfa5e8b[_0x45c3('0x71')][_0x45c3('0x45')]===_0x45c3('0x7b')){return _0x31b5e7[_0x45c3('0x2c')](_0x513632)[_0x45c3('0x33')](_0x45c3('0xb2'),'text/xml')['send'](_0x45c3('0xb3'));}else{return _0x31b5e7[_0x45c3('0x2c')](_0x513632)[_0x45c3('0x2e')](_0x2d15ea);}}})[_0x45c3('0x2a')](handleError(_0x31b5e7,null));};exports['addApplications']=function(_0x3211a1,_0x4a6d09){var _0x15912d=_0x3211a1[_0x45c3('0x64')]['id'];var _0x3bcfdf=_0x3211a1[_0x45c3('0x5d')];var _0x5c342b=0xc8;var _0x571577=null;return db[_0x45c3('0xb4')][_0x45c3('0xb5')]({'isolationLevel':db[_0x45c3('0xb4')][_0x45c3('0xb6')]['ISOLATION_LEVELS'][_0x45c3('0xb7')]},function(_0x5c42d5){return db[_0x45c3('0x42')][_0x45c3('0x6d')]({'where':{'id':_0x15912d},'transaction':_0x5c42d5})[_0x45c3('0x1f')](function(_0x5d9311){if(_0x5d9311){return db[_0x45c3('0xb8')][_0x45c3('0x38')]({'where':{'SmsAccountId':_0x15912d},'transaction':_0x5c42d5})[_0x45c3('0x1f')](function(){var _0x379e74=_[_0x45c3('0x41')](_0x3bcfdf,function(_0xbbfd41){_0xbbfd41[_0x45c3('0x69')]=_0x15912d;return _0xbbfd41;});return db[_0x45c3('0xb8')]['bulkCreate'](_0x379e74,{'transaction':_0x5c42d5});});}else{_0x5c342b=0x194;_0x571577=[];}});})[_0x45c3('0x1f')](function(){if(_0x5c342b!==0x194){return db[_0x45c3('0xb8')]['findAndCountAll']({'where':{'SmsAccountId':_0x15912d},'order':'priority'})[_0x45c3('0x1f')](function(_0x325871){_0x571577=_0x325871;});}})[_0x45c3('0x2a')](function(_0x4e9771){_0x5c342b=0x1f4;logger[_0x45c3('0x26')](_0x4e9771[_0x45c3('0x3c')]);if(_0x4e9771[_0x45c3('0x3d')]){delete _0x4e9771[_0x45c3('0x3d')];}_0x571577=_0x4e9771;})[_0x45c3('0xb9')](function(){if(_0x571577===null){_0x4a6d09[_0x45c3('0x2b')](_0x5c342b);}else{if(_0x5c342b===0x1f4){_0x4a6d09[_0x45c3('0x2c')](_0x5c342b)[_0x45c3('0x3e')](_0x571577);}else{_0x4a6d09['status'](_0x5c342b)[_0x45c3('0x2e')](_0x571577);}}});};exports[_0x45c3('0xba')]=function(_0x4f56eb,_0x370e40,_0x98d612){var _0x19a24f={};var _0xfe7208={};var _0x1ab6af;var _0x37d465;return db[_0x45c3('0x42')][_0x45c3('0x6d')]({'where':{'id':_0x4f56eb['params']['id']}})['then'](handleEntityNotFound(_0x370e40,null))[_0x45c3('0x1f')](function(_0xa40973){if(_0xa40973){_0x1ab6af=_0xa40973;_0xfe7208[_0x45c3('0x47')]=_[_0x45c3('0x68')](db[_0x45c3('0xb8')][_0x45c3('0x43')]);_0xfe7208[_0x45c3('0x48')]=_[_0x45c3('0x68')](_0x4f56eb['query']);_0xfe7208[_0x45c3('0x49')]=_['intersection'](_0xfe7208[_0x45c3('0x47')],_0xfe7208[_0x45c3('0x48')]);_0x19a24f[_0x45c3('0x4a')]=_[_0x45c3('0x5a')](_0xfe7208[_0x45c3('0x47')],qs['fields'](_0x4f56eb[_0x45c3('0x48')]['fields']));_0x19a24f[_0x45c3('0x4a')]=_0x19a24f[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x19a24f[_0x45c3('0x4a')]:_0xfe7208[_0x45c3('0x47')];_0x19a24f[_0x45c3('0x4f')]=qs[_0x45c3('0x50')](_0x4f56eb['query'][_0x45c3('0x50')]);_0x19a24f['where']=qs[_0x45c3('0x49')](_[_0x45c3('0x52')](_0x4f56eb[_0x45c3('0x48')],_0xfe7208[_0x45c3('0x49')]));if(_0x4f56eb[_0x45c3('0x48')][_0x45c3('0x54')]){_0x19a24f[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x19a24f['where'],{'$or':_[_0x45c3('0x41')](_0x19a24f['attributes'],function(_0x40ac3f){var _0x1b2537={};_0x1b2537[_0x40ac3f]={'$like':'%'+_0x4f56eb[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x1b2537;})});}_0x19a24f=_['merge']({},_0x19a24f,_0x4f56eb[_0x45c3('0x55')]);return _0x1ab6af[_0x45c3('0xba')](_0x19a24f);}})[_0x45c3('0x1f')](function(_0xc6c741){if(_0xc6c741){_0x37d465=_0xc6c741[_0x45c3('0x4c')];if(!_0x4f56eb['query']['hasOwnProperty'](_0x45c3('0x4e'))){_0x19a24f[_0x45c3('0x31')]=qs['limit'](_0x4f56eb[_0x45c3('0x48')][_0x45c3('0x31')]);_0x19a24f['offset']=qs[_0x45c3('0x2f')](_0x4f56eb[_0x45c3('0x48')][_0x45c3('0x2f')]);}return _0x1ab6af[_0x45c3('0xba')](_0x19a24f);}})['then'](function(_0x5b2956){if(_0x5b2956){return _0x5b2956?{'count':_0x37d465,'rows':_0x5b2956}:null;}})[_0x45c3('0x1f')](respondWithResult(_0x370e40,null))['catch'](handleError(_0x370e40,null));};exports[_0x45c3('0xbb')]=function(_0x36818e,_0x49f576,_0x47206c){var _0x50c50a={'raw':![],'where':{}};var _0x2ce177={};var _0xc5d509={'count':0x0,'rows':[]};return db[_0x45c3('0x42')][_0x45c3('0x6d')]({'where':{'id':_0x36818e[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x49f576,null))[_0x45c3('0x1f')](function(_0x4d6e84){if(_0x4d6e84){_0x2ce177[_0x45c3('0x47')]=_[_0x45c3('0x68')](db[_0x45c3('0xbc')][_0x45c3('0x43')]);_0x2ce177[_0x45c3('0x48')]=_[_0x45c3('0x68')](_0x36818e['query']);_0x2ce177['filters']=_[_0x45c3('0x5a')](_0x2ce177[_0x45c3('0x47')],_0x2ce177['query']);_0x50c50a[_0x45c3('0x4a')]=_[_0x45c3('0x5a')](_0x2ce177['model'],qs[_0x45c3('0x4b')](_0x36818e[_0x45c3('0x48')]['fields']));_0x50c50a[_0x45c3('0x4a')]=_0x50c50a[_0x45c3('0x4a')][_0x45c3('0x4c')]?_0x50c50a[_0x45c3('0x4a')]:_0x2ce177[_0x45c3('0x47')];if(!_0x36818e[_0x45c3('0x48')][_0x45c3('0x4d')](_0x45c3('0x4e'))){_0x50c50a['limit']=qs[_0x45c3('0x31')](_0x36818e[_0x45c3('0x48')][_0x45c3('0x31')]);_0x50c50a[_0x45c3('0x2f')]=qs[_0x45c3('0x2f')](_0x36818e['query'][_0x45c3('0x2f')]);}_0x50c50a[_0x45c3('0x4f')]=qs[_0x45c3('0x50')](_0x36818e['query'][_0x45c3('0x50')]);_0x50c50a[_0x45c3('0x51')]=qs[_0x45c3('0x49')](_['pick'](_0x36818e[_0x45c3('0x48')],_0x2ce177[_0x45c3('0x49')]));_0x50c50a[_0x45c3('0x51')][_0x45c3('0x69')]=_0x4d6e84['id'];if(_0x36818e[_0x45c3('0x48')][_0x45c3('0x54')]){_0x50c50a[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x50c50a[_0x45c3('0x51')],{'$or':_[_0x45c3('0x41')](_0x50c50a[_0x45c3('0x4a')],function(_0x4cf659){var _0x5623ef={};_0x5623ef[_0x4cf659]={'$like':'%'+_0x36818e[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x5623ef;})});}_0x50c50a=_[_0x45c3('0x53')]({},_0x50c50a,_0x36818e[_0x45c3('0x55')]);return db[_0x45c3('0xbc')][_0x45c3('0x32')]({'where':_0x50c50a[_0x45c3('0x51')]})['then'](function(_0x43b61f){_0xc5d509['count']=_0x43b61f;if(_0x36818e[_0x45c3('0x48')][_0x45c3('0x56')]){_0x50c50a[_0x45c3('0x5b')]=[{'model':db[_0x45c3('0x74')],'as':'Contact','required':![]},{'model':db[_0x45c3('0xbd')],'as':_0x45c3('0xbe'),'attributes':['name',_0x45c3('0xbf'),'internal'],'required':![]},{'model':db[_0x45c3('0xc0')],'as':_0x45c3('0xc1'),'attributes':['id',_0x45c3('0x3d'),'color'],'where':_0x36818e[_0x45c3('0x48')][_0x45c3('0xc2')]?{'id':_0x36818e[_0x45c3('0x48')][_0x45c3('0xc2')]}:undefined,'required':_0x36818e[_0x45c3('0x48')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x45c3('0x57')](_0x50c50a);})[_0x45c3('0x1f')](function(_0x2899b4){_0xc5d509['rows']=_0x2899b4;return _0xc5d509;});}})[_0x45c3('0x1f')](respondWithFilteredResult(_0x49f576,_0x50c50a))[_0x45c3('0x2a')](handleError(_0x49f576,null));};exports[_0x45c3('0x3e')]=function(_0x11fb45,_0x960ce8,_0x1893de){var _0x1341a0,_0x4a1df4,_0x51c015;if(_[_0x45c3('0x90')](_0x11fb45[_0x45c3('0x5d')][_0x45c3('0x5d')])||_0x11fb45[_0x45c3('0x5d')][_0x45c3('0x5d')]===''){throw new db[(_0x45c3('0x91'))][(_0x45c3('0x75'))](_0x45c3('0x93'));}if(_['isNil'](_0x11fb45[_0x45c3('0x5d')]['to'])){throw new db['Sequelize'][(_0x45c3('0x75'))]('to\x20is\x20mandatory');}_0x1341a0=_0x11fb45[_0x45c3('0x5d')]['to'];return db[_0x45c3('0x42')][_0x45c3('0x61')]({'where':{'id':_0x11fb45['params']['id']},'include':[{'model':db['CmList'],'as':_0x45c3('0xc3'),'include':[{'model':db[_0x45c3('0x74')],'as':'Contacts','where':{'mobile':_0x1341a0},'limit':0x1,'order':[[_0x45c3('0x79'),_0x45c3('0x98')]]}]}]})[_0x45c3('0x1f')](handleEntityNotFound(_0x960ce8,null))[_0x45c3('0x1f')](function(_0x24c0a9){if(_0x24c0a9&&_0x24c0a9[_0x45c3('0xc3')]){_0x4a1df4=_0x24c0a9[_0x45c3('0x39')]({'plain':!![]});if(_0x4a1df4['List']&&_0x4a1df4[_0x45c3('0xc3')][_0x45c3('0x9b')][_0x45c3('0x4c')]){return _0x4a1df4[_0x45c3('0xc3')][_0x45c3('0x9b')][0x0];}return db[_0x45c3('0x74')]['create'](_['defaults'](_0x11fb45[_0x45c3('0x5d')],{'firstName':_0x1341a0,'mobile':_0x1341a0,'phone':_0x1341a0,'ListId':_0x4a1df4[_0x45c3('0x97')]}));}})['then'](handleEntityNotFound(_0x960ce8,null))[_0x45c3('0x1f')](function(_0x256de6){if(_0x256de6){_0x51c015=_0x256de6;return db[_0x45c3('0xbc')][_0x45c3('0x61')]({'where':{'ContactId':_0x51c015['id'],'closed':![],'SmsAccountId':_0x4a1df4['id']}})[_0x45c3('0x1f')](function(_0x31fb95){if(_0x31fb95){return[_0x31fb95,![]];}return db['SmsInteraction']['create']({'UserId':_0x11fb45['user']['id'],'ContactId':_0x51c015['id'],'SmsAccountId':_0x4a1df4['id'],'phone':_0x1341a0,'firstMsgDirection':_0x45c3('0xc4'),'Messages':[_[_0x45c3('0x53')](_0x11fb45[_0x45c3('0x5d')],{'read':![],'body':_0x11fb45[_0x45c3('0x5d')][_0x45c3('0x5d')],'phone':_0x1341a0,'SmsAccountId':_0x4a1df4['id'],'UserId':_0x11fb45[_0x45c3('0x5e')]['id'],'ContactId':_0x51c015['id']})]},{'include':[{'model':db[_0x45c3('0xa3')],'as':'Messages'}]})[_0x45c3('0x1f')](function(_0x3245fc){return[_0x3245fc,!![]];});});}})[_0x45c3('0xc5')](function(_0x1e27b9,_0x5c0c49){if(_0x5c0c49){return _0x1e27b9;}return db[_0x45c3('0xa3')][_0x45c3('0x5c')](_[_0x45c3('0x53')](_0x11fb45[_0x45c3('0x5d')],{'read':![],'body':_0x11fb45['body'][_0x45c3('0x5d')],'phone':_0x1341a0,'SmsAccountId':_0x4a1df4['id'],'SmsInteractionId':_0x1e27b9['id'],'UserId':_0x11fb45['user']['id'],'ContactId':_0x51c015['id']}))[_0x45c3('0x1f')](function(_0x50aeba){_0x1e27b9[_0x45c3('0xc6')][_0x45c3('0xc7')]=[];_0x1e27b9[_0x45c3('0xc6')][_0x45c3('0xc7')]['push'](_0x50aeba[_0x45c3('0xc6')]);return _0x1e27b9;});})['then'](respondWithResult(_0x960ce8,null))[_0x45c3('0x2a')](handleError(_0x960ce8,null));};exports[_0x45c3('0x2c')]=function(_0x1af54f,_0xbcf91a,_0x91029a){if(_0x1af54f[_0x45c3('0x5d')]['id']){delete _0x1af54f[_0x45c3('0x5d')]['id'];}var _0x5e47bd,_0x5e57cb,_0xab3c11;return db['SmsAccount'][_0x45c3('0x61')]({'where':{'id':_0x1af54f[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0xbcf91a,null))[_0x45c3('0x1f')](function(_0x525838){if(_0x525838){_0xab3c11=_0x525838;logger[_0x45c3('0x23')](_0x45c3('0x24'),_0x45c3('0x2c'),'received\x20delivery\x20report\x20from',_0x525838['type'],util['inspect'](_0x1af54f['body'],{'showHidden':![],'depth':null}));switch(_0x525838[_0x45c3('0x45')]){case _0x45c3('0x7e'):if(_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xc8')]&&_0x1af54f[_0x45c3('0x5d')][_0x45c3('0x2c')]){_0x5e57cb=_0x1af54f[_0x45c3('0x5d')][_0x45c3('0x2c')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xc8')]}});}break;case _0x45c3('0xc9'):if(_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xca')]&&_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcb')]){_0x5e57cb=_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcb')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xca')]}});}break;case _0x45c3('0x82'):if(_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcc')]&&_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcd')]){_0x5e57cb=_0x1af54f['body'][_0x45c3('0xcd')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcc')]}});}break;case _0x45c3('0x86'):var _0x2de327=_0x1af54f[_0x45c3('0x5d')][_0x45c3('0x87')][0x0];if(_0x2de327[_0x45c3('0x7d')]&&_0x2de327[_0x45c3('0x2c')][_0x45c3('0xce')]==='DELIVERED'){_0x5e57cb=_0x2de327[_0x45c3('0x2c')][_0x45c3('0xce')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x2de327[_0x45c3('0x7d')]}});}break;case _0x45c3('0x8a'):if(_0x1af54f['body'][_0x45c3('0x7d')]&&_0x1af54f[_0x45c3('0x5d')]['status']){_0x5e57cb=_0x1af54f[_0x45c3('0x5d')]['status'];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f[_0x45c3('0x5d')][_0x45c3('0x7d')]}});}break;case'bandwidth':if(_0x1af54f['body'][0x0]['message']['id']){_0x5e57cb=_0x1af54f[_0x45c3('0x5d')][0x0][_0x45c3('0x45')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f['body'][0x0][_0x45c3('0x28')]['id']}});}break;case _0x45c3('0x8e'):if(_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xcf')]&&_0x1af54f['body']['status']){_0x5e57cb=_0x1af54f[_0x45c3('0x5d')][_0x45c3('0x2c')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0x1af54f[_0x45c3('0x5d')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0xbcf91a,null))[_0x45c3('0x1f')](function(_0x2e5160){if(_0x2e5160){_0x5e47bd=_0x2e5160;switch(_0xab3c11[_0x45c3('0x45')]){case _0x45c3('0x7e'):if(_0x5e57cb===_0x45c3('0xd0')){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger['error'](_0x45c3('0x24'),_0x45c3('0x2c'),_0x45c3('0x7e'),util['inspect'](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x45c3('0xc9'):if(_0x5e57cb==='1'){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger[_0x45c3('0x26')](_0x45c3('0x24'),'status',_0x45c3('0x7e'),util[_0x45c3('0xd1')](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x45c3('0x82'):if(!_0x1af54f[_0x45c3('0x5d')][_0x45c3('0xd2')]&&_0x5e57cb>=0xc8&&_0x5e57cb<=0xce){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger[_0x45c3('0x26')](_0x45c3('0x24'),_0x45c3('0x2c'),_0x45c3('0x82'),util[_0x45c3('0xd1')](_0x1af54f['body'],{'showHidden':![],'depth':null}));}break;case _0x45c3('0x86'):var _0x55e19f=_0x1af54f['body'][_0x45c3('0x87')][0x0];if(_0x55e19f[_0x45c3('0x2c')][_0x45c3('0xce')]===_0x45c3('0xd0')){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger[_0x45c3('0x26')](_0x45c3('0x24'),_0x45c3('0x2c'),_0x45c3('0x86'),util[_0x45c3('0xd1')](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x45c3('0x8a'):if(_0x5e57cb=='DELIVERED_TO_GATEWAY'||_0x5e57cb=='RECEIVED_BY_RECIPIENT'){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger[_0x45c3('0x26')](_0x45c3('0x24'),_0x45c3('0x2c'),_0x45c3('0x8a'),util[_0x45c3('0xd1')](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x45c3('0x8d'):if(_0x5e57cb=='message-delivered'){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x45c3('0x2c'),'bandwidth',util[_0x45c3('0xd1')](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x45c3('0x8e'):if(_0x5e57cb===_0x45c3('0xd3')||_0x5e57cb===_0x45c3('0xd4')){return _0x5e47bd[_0x45c3('0x37')]({'read':!![]});}else{logger[_0x45c3('0x26')](_0x45c3('0x24'),_0x45c3('0x2c'),_0x45c3('0x8e'),util[_0x45c3('0xd1')](_0x1af54f[_0x45c3('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x5e47bd;}})['then'](respondWithResult(_0xbcf91a,null))[_0x45c3('0x2a')](handleError(_0xbcf91a,null));};exports['statusGet']=function(_0xea6a9f,_0x3503a4,_0x225dfc){var _0x524855,_0x602388,_0xafcbf7;return db[_0x45c3('0x42')][_0x45c3('0x61')]({'where':{'id':_0xea6a9f[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x3503a4,null))[_0x45c3('0x1f')](function(_0x4ca837){if(_0x4ca837){_0xafcbf7=_0x4ca837;logger[_0x45c3('0x23')](_0x45c3('0x24'),'status',_0x45c3('0xd5'),_0x4ca837[_0x45c3('0x45')],util[_0x45c3('0xd1')](_0xea6a9f[_0x45c3('0x48')],{'showHidden':![],'depth':null}));switch(_0x4ca837['type']){case _0x45c3('0x88'):if(_0xea6a9f[_0x45c3('0x48')]['message-id']&&_0xea6a9f[_0x45c3('0x48')][_0x45c3('0xd6')]){_0x602388=_0xea6a9f[_0x45c3('0x48')][_0x45c3('0xd6')];return db[_0x45c3('0xa3')][_0x45c3('0x61')]({'where':{'messageId':_0xea6a9f[_0x45c3('0x48')][_0x45c3('0xd7')]}});}break;}}})[_0x45c3('0x1f')](handleEntityNotFound(_0x3503a4,null))['then'](function(_0x19e358){if(_0x19e358){_0x524855=_0x19e358;switch(_0xafcbf7[_0x45c3('0x45')]){case _0x45c3('0x88'):if(_0x602388==='2'||_0x602388==='6'){return _0x524855[_0x45c3('0x37')]({'read':!![]});}else{logger['error'](_0x45c3('0x24'),'status',_0x45c3('0x88'),util[_0x45c3('0xd1')](_0xea6a9f[_0x45c3('0x48')],{'showHidden':![],'depth':null}));};break;}return _0x524855;}})[_0x45c3('0x1f')](respondWithResult(_0x3503a4,null))['catch'](handleError(_0x3503a4,null));};exports['addAgents']=function(_0x2890a9,_0x580a32,_0x3386d4){return db['SmsAccount'][_0x45c3('0x61')]({'where':{'id':_0x2890a9[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x580a32,null))['then'](function(_0x35a737){if(_0x35a737){return _0x35a737['addAgents'](_0x2890a9[_0x45c3('0x5d')][_0x45c3('0x6b')],_[_0x45c3('0x9a')](_0x2890a9[_0x45c3('0x5d')],['ids','id'])||{})[_0x45c3('0xc5')](function(_0xe9999){for(var _0x2a3ec4=0x0;_0x2a3ec4<_0x2890a9[_0x45c3('0x5d')][_0x45c3('0x6b')][_0x45c3('0x4c')];_0x2a3ec4+=0x1){socket[_0x45c3('0xd8')](_0x45c3('0xd9'),{'UserId':Number(_0x2890a9[_0x45c3('0x5d')][_0x45c3('0x6b')][_0x2a3ec4]),'SmsAccountId':Number(_0x2890a9[_0x45c3('0x64')]['id'])});}return _0xe9999;});}})[_0x45c3('0x1f')](respondWithResult(_0x580a32,null))['catch'](handleError(_0x580a32,null));};exports[_0x45c3('0xda')]=function(_0x43e3e0,_0x1dd206,_0x10a961){return db[_0x45c3('0x42')][_0x45c3('0x61')]({'where':{'id':_0x43e3e0[_0x45c3('0x64')]['id']}})['then'](handleEntityNotFound(_0x1dd206,null))[_0x45c3('0x1f')](function(_0x5cab98){if(_0x5cab98){return _0x5cab98['removeAgents'](_0x43e3e0[_0x45c3('0x48')]['ids'])[_0x45c3('0x1f')](function(){if(_[_0x45c3('0xdb')](_0x43e3e0[_0x45c3('0x48')][_0x45c3('0x6b')])){for(var _0x429565=0x0;_0x429565<_0x43e3e0[_0x45c3('0x48')][_0x45c3('0x6b')]['length'];_0x429565+=0x1){socket[_0x45c3('0xd8')](_0x45c3('0xdc'),{'UserId':Number(_0x43e3e0[_0x45c3('0x48')][_0x45c3('0x6b')][_0x429565]),'SmsAccountId':Number(_0x43e3e0['params']['id'])});}}else{socket[_0x45c3('0xd8')](_0x45c3('0xdc'),{'UserId':Number(_0x43e3e0[_0x45c3('0x48')]['ids']),'SmsAccountId':Number(_0x43e3e0[_0x45c3('0x64')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dd206,null))[_0x45c3('0x2a')](handleError(_0x1dd206,null));};exports[_0x45c3('0xdd')]=function(_0xe55c3b,_0x5c8032,_0x2474fb){var _0x32aa01={};var _0x2bc71b={};var _0x48e02f;var _0x342f2b;return db[_0x45c3('0x42')][_0x45c3('0x6d')]({'where':{'id':_0xe55c3b[_0x45c3('0x64')]['id']}})[_0x45c3('0x1f')](handleEntityNotFound(_0x5c8032,null))[_0x45c3('0x1f')](function(_0x122aec){if(_0x122aec){_0x48e02f=_0x122aec;_0x2bc71b[_0x45c3('0x47')]=_['keys'](db['User'][_0x45c3('0x43')]);_0x2bc71b[_0x45c3('0x48')]=_['keys'](_0xe55c3b[_0x45c3('0x48')]);_0x2bc71b[_0x45c3('0x49')]=_['intersection'](_0x2bc71b[_0x45c3('0x47')],_0x2bc71b[_0x45c3('0x48')]);_0x32aa01['attributes']=_['intersection'](_0x2bc71b[_0x45c3('0x47')],qs[_0x45c3('0x4b')](_0xe55c3b[_0x45c3('0x48')][_0x45c3('0x4b')]));_0x32aa01['attributes']=_0x32aa01['attributes']['length']?_0x32aa01[_0x45c3('0x4a')]:_0x2bc71b[_0x45c3('0x47')];_0x32aa01[_0x45c3('0x4f')]=qs['sort'](_0xe55c3b[_0x45c3('0x48')]['sort']);_0x32aa01[_0x45c3('0x51')]=qs[_0x45c3('0x49')](_[_0x45c3('0x52')](_0xe55c3b[_0x45c3('0x48')],_0x2bc71b[_0x45c3('0x49')]));if(_0xe55c3b[_0x45c3('0x48')][_0x45c3('0x54')]){_0x32aa01[_0x45c3('0x51')]=_[_0x45c3('0x53')](_0x32aa01['where'],{'$or':_[_0x45c3('0x41')](_0x32aa01[_0x45c3('0x4a')],function(_0x40415f){var _0x207af2={};_0x207af2[_0x40415f]={'$like':'%'+_0xe55c3b[_0x45c3('0x48')][_0x45c3('0x54')]+'%'};return _0x207af2;})});}_0x32aa01=_[_0x45c3('0x53')]({},_0x32aa01,_0xe55c3b[_0x45c3('0x55')]);return _0x48e02f[_0x45c3('0xdd')](_0x32aa01);}})[_0x45c3('0x1f')](function(_0x1aca29){if(_0x1aca29){_0x342f2b=_0x1aca29['length'];if(!_0xe55c3b[_0x45c3('0x48')][_0x45c3('0x4d')]('nolimit')){_0x32aa01[_0x45c3('0x31')]=qs[_0x45c3('0x31')](_0xe55c3b['query'][_0x45c3('0x31')]);_0x32aa01[_0x45c3('0x2f')]=qs[_0x45c3('0x2f')](_0xe55c3b[_0x45c3('0x48')][_0x45c3('0x2f')]);}return _0x48e02f[_0x45c3('0xdd')](_0x32aa01);}})[_0x45c3('0x1f')](function(_0x330ce0){if(_0x330ce0){return _0x330ce0?{'count':_0x342f2b,'rows':_0x330ce0}:null;}})['then'](respondWithResult(_0x5c8032,null))['catch'](handleError(_0x5c8032,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index fb50af0..7e12210 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 _0x7f51=['update','remove','emit','hook','events','SmsAccount','save'];(function(_0x2facb7,_0x2777fe){var _0x2fe7c1=function(_0x66f605){while(--_0x66f605){_0x2facb7['push'](_0x2facb7['shift']());}};_0x2fe7c1(++_0x2777fe);}(_0x7f51,0x1c4));var _0x17f5=function(_0x202d7e,_0x258c91){_0x202d7e=_0x202d7e-0x0;var _0x3b8c27=_0x7f51[_0x202d7e];return _0x3b8c27;};'use strict';var EventEmitter=require(_0x17f5('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x17f5('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x17f5('0x2'),'afterUpdate':_0x17f5('0x3'),'afterDestroy':_0x17f5('0x4')};function emitEvent(_0x12de3e){return function(_0x3f3d8f,_0x58ad2e,_0x4fa7fb){SmsAccountEvents[_0x17f5('0x5')](_0x12de3e+':'+_0x3f3d8f['id'],_0x3f3d8f);SmsAccountEvents[_0x17f5('0x5')](_0x12de3e,_0x3f3d8f);_0x4fa7fb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x17f5('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0x4868=['SmsAccount','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x483e1c,_0x165e7c){var _0x2c82f5=function(_0x50395a){while(--_0x50395a){_0x483e1c['push'](_0x483e1c['shift']());}};_0x2c82f5(++_0x165e7c);}(_0x4868,0xee));var _0x8486=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4868[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x8486('0x0'));var SmsAccount=require(_0x8486('0x1'))['db'][_0x8486('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x8486('0x3')](0x0);var events={'afterCreate':_0x8486('0x4'),'afterUpdate':_0x8486('0x5'),'afterDestroy':_0x8486('0x6')};function emitEvent(_0x1a450e){return function(_0x3037cd,_0x3ae355,_0x23f8d8){SmsAccountEvents[_0x8486('0x7')](_0x1a450e+':'+_0x3037cd['id'],_0x3037cd);SmsAccountEvents['emit'](_0x1a450e,_0x3037cd);_0x23f8d8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x8486('0x8')](e,emitEvent(event));}}module[_0x8486('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ed34382..350d4ba 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 _0xf358=['../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xf358,0x1d9));var _0x8f35=function(_0x511383,_0x419494){_0x511383=_0x511383-0x0;var _0x5287ab=_0xf358[_0x511383];return _0x5287ab;};'use strict';var _=require(_0x8f35('0x0'));var util=require(_0x8f35('0x1'));var logger=require(_0x8f35('0x2'))('api');var moment=require(_0x8f35('0x3'));var BPromise=require(_0x8f35('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8f35('0x5'));var rimraf=require(_0x8f35('0x6'));var config=require(_0x8f35('0x7'));var attributes=require(_0x8f35('0x8'));module[_0x8f35('0x9')]=function(_0x2289b2,_0x48958f){return _0x2289b2['define'](_0x8f35('0xa'),attributes,{'tableName':_0x8f35('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x223f=['rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0x223f,0xd6));var _0xf223=function(_0x23c3e4,_0x22f0c7){_0x23c3e4=_0x23c3e4-0x0;var _0x3d59af=_0x223f[_0x23c3e4];return _0x3d59af;};'use strict';var _=require(_0xf223('0x0'));var util=require(_0xf223('0x1'));var logger=require(_0xf223('0x2'))('api');var moment=require(_0xf223('0x3'));var BPromise=require(_0xf223('0x4'));var rp=require(_0xf223('0x5'));var fs=require('fs');var path=require(_0xf223('0x6'));var rimraf=require(_0xf223('0x7'));var config=require(_0xf223('0x8'));var attributes=require('./smsAccount.attributes');module[_0xf223('0x9')]=function(_0x24b6dc,_0x307065){return _0x24b6dc[_0xf223('0xa')](_0xf223('0xb'),attributes,{'tableName':_0xf223('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index da1cb49..eda8050 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 _0x509d=['util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','SmsAccount','options','raw','where','attributes','include','model','map','ShowSmsAccount','catch','lodash'];(function(_0x52e8a4,_0x786e74){var _0x4ea258=function(_0x69d918){while(--_0x69d918){_0x52e8a4['push'](_0x52e8a4['shift']());}};_0x4ea258(++_0x786e74);}(_0x509d,0x1db));var _0xd509=function(_0x4abab9,_0xde21a4){_0x4abab9=_0x4abab9-0x0;var _0x374eba=_0x509d[_0x4abab9];return _0x374eba;};'use strict';var _=require(_0xd509('0x0'));var util=require(_0xd509('0x1'));var moment=require(_0xd509('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd509('0x3'));var db=require(_0xd509('0x4'))['db'];var utils=require(_0xd509('0x5'));var logger=require(_0xd509('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd509('0x7'));var client=jayson[_0xd509('0x8')][_0xd509('0x9')]({'port':0x232a});config[_0xd509('0xa')]=_[_0xd509('0xb')](config[_0xd509('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd509('0xa')]));require(_0xd509('0xc'))[_0xd509('0xd')](socket);function respondWithRpcPromise(_0x3f14c5,_0x2f63f1,_0x22893a){return new BPromise(function(_0x445a0e,_0x55ed79){return client[_0xd509('0xe')](_0x3f14c5,_0x22893a)[_0xd509('0xf')](function(_0x4a9856){logger[_0xd509('0x10')](_0xd509('0x11'),_0x2f63f1,_0xd509('0x12'));logger[_0xd509('0x13')](_0xd509('0x14'),_0x2f63f1,_0xd509('0x12'),JSON[_0xd509('0x15')](_0x4a9856));if(_0x4a9856[_0xd509('0x16')]){if(_0x4a9856[_0xd509('0x16')]['code']===0x1f4){logger[_0xd509('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2f63f1,_0x4a9856[_0xd509('0x16')][_0xd509('0x17')]);return _0x55ed79(_0x4a9856[_0xd509('0x16')]['message']);}logger[_0xd509('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2f63f1,_0x4a9856[_0xd509('0x16')][_0xd509('0x17')]);return _0x445a0e(_0x4a9856[_0xd509('0x16')][_0xd509('0x17')]);}else{logger['info'](_0xd509('0x11'),_0x2f63f1,_0xd509('0x12'));_0x445a0e(_0x4a9856['result'][_0xd509('0x17')]);}})['catch'](function(_0x3eea14){logger[_0xd509('0x16')](_0xd509('0x11'),_0x2f63f1,_0x3eea14);_0x55ed79(_0x3eea14);});});}exports['ShowSmsAccount']=function(_0x5ab953){var _0x388496=this;return new Promise(function(_0x1e40a1,_0x1c2a4e){return db[_0xd509('0x18')]['find']({'raw':_0x5ab953[_0xd509('0x19')]?_0x5ab953[_0xd509('0x19')][_0xd509('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ab953[_0xd509('0x19')]?_0x5ab953[_0xd509('0x19')][_0xd509('0x1b')]||null:null,'attributes':_0x5ab953[_0xd509('0x19')]?_0x5ab953[_0xd509('0x19')][_0xd509('0x1c')]||null:null,'include':_0x5ab953[_0xd509('0x19')]?_0x5ab953[_0xd509('0x19')][_0xd509('0x1d')]?_['map'](_0x5ab953[_0xd509('0x19')][_0xd509('0x1d')],function(_0xdc5fa0){return{'model':db[_0xdc5fa0[_0xd509('0x1e')]],'as':_0xdc5fa0['as'],'attributes':_0xdc5fa0[_0xd509('0x1c')],'include':_0xdc5fa0[_0xd509('0x1d')]?_[_0xd509('0x1f')](_0xdc5fa0[_0xd509('0x1d')],function(_0x5d806c){return{'model':db[_0x5d806c[_0xd509('0x1e')]],'as':_0x5d806c['as'],'attributes':_0x5d806c[_0xd509('0x1c')],'include':_0x5d806c[_0xd509('0x1d')]?_[_0xd509('0x1f')](_0x5d806c['include'],function(_0x397196){return{'model':db[_0x397196[_0xd509('0x1e')]],'as':_0x397196['as'],'attributes':_0x397196[_0xd509('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xd509('0xf')](function(_0x390280){logger[_0xd509('0x10')]('ShowSmsAccount',_0x5ab953);logger[_0xd509('0x13')](_0xd509('0x20'),_0x5ab953,JSON['stringify'](_0x390280));_0x1e40a1(_0x390280);})[_0xd509('0x21')](function(_0x5a3409){logger[_0xd509('0x16')]('ShowSmsAccount',_0x5a3409[_0xd509('0x17')],_0x5ab953);_0x1c2a4e(_0x388496[_0xd509('0x16')](0x1f4,_0x5a3409[_0xd509('0x17')]));});});}; \ No newline at end of file +var _0x782f=['find','options','where','include','map','model','attributes','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowSmsAccount','SmsAccount'];(function(_0x725a4c,_0x102507){var _0x37b2cc=function(_0x505fc9){while(--_0x505fc9){_0x725a4c['push'](_0x725a4c['shift']());}};_0x37b2cc(++_0x102507);}(_0x782f,0xec));var _0xf782=function(_0x2aa7d9,_0xc69c98){_0x2aa7d9=_0x2aa7d9-0x0;var _0x109308=_0x782f[_0x2aa7d9];return _0x109308;};'use strict';var _=require('lodash');var util=require(_0xf782('0x0'));var moment=require(_0xf782('0x1'));var BPromise=require(_0xf782('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf782('0x3'));var db=require(_0xf782('0x4'))['db'];var utils=require(_0xf782('0x5'));var logger=require(_0xf782('0x6'))(_0xf782('0x7'));var config=require('../../config/environment');var jayson=require(_0xf782('0x8'));var client=jayson[_0xf782('0x9')][_0xf782('0xa')]({'port':0x232a});config['redis']=_[_0xf782('0xb')](config[_0xf782('0xc')],{'host':_0xf782('0xd'),'port':0x18eb});var socket=require(_0xf782('0xe'))(new Redis(config[_0xf782('0xc')]));require('./smsAccount.socket')[_0xf782('0xf')](socket);function respondWithRpcPromise(_0x641688,_0x327515,_0x45b764){return new BPromise(function(_0x4c87e5,_0x70153){return client[_0xf782('0x10')](_0x641688,_0x45b764)[_0xf782('0x11')](function(_0x41c9a){logger[_0xf782('0x12')](_0xf782('0x13'),_0x327515,_0xf782('0x14'));logger[_0xf782('0x15')](_0xf782('0x16'),_0x327515,_0xf782('0x14'),JSON['stringify'](_0x41c9a));if(_0x41c9a['error']){if(_0x41c9a[_0xf782('0x17')][_0xf782('0x18')]===0x1f4){logger[_0xf782('0x17')]('SmsAccount,\x20%s,\x20%s',_0x327515,_0x41c9a['error']['message']);return _0x70153(_0x41c9a['error'][_0xf782('0x19')]);}logger['error'](_0xf782('0x13'),_0x327515,_0x41c9a[_0xf782('0x17')][_0xf782('0x19')]);return _0x4c87e5(_0x41c9a[_0xf782('0x17')][_0xf782('0x19')]);}else{logger[_0xf782('0x12')](_0xf782('0x13'),_0x327515,_0xf782('0x14'));_0x4c87e5(_0x41c9a[_0xf782('0x1a')][_0xf782('0x19')]);}})[_0xf782('0x1b')](function(_0x359586){logger[_0xf782('0x17')](_0xf782('0x13'),_0x327515,_0x359586);_0x70153(_0x359586);});});}exports[_0xf782('0x1c')]=function(_0x2c0b56){var _0x42f092=this;return new Promise(function(_0x191dc0,_0x4b4c50){return db[_0xf782('0x1d')][_0xf782('0x1e')]({'raw':_0x2c0b56[_0xf782('0x1f')]?_0x2c0b56['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c0b56[_0xf782('0x1f')]?_0x2c0b56['options'][_0xf782('0x20')]||null:null,'attributes':_0x2c0b56[_0xf782('0x1f')]?_0x2c0b56[_0xf782('0x1f')]['attributes']||null:null,'include':_0x2c0b56[_0xf782('0x1f')]?_0x2c0b56['options'][_0xf782('0x21')]?_[_0xf782('0x22')](_0x2c0b56[_0xf782('0x1f')]['include'],function(_0xd9d066){return{'model':db[_0xd9d066[_0xf782('0x23')]],'as':_0xd9d066['as'],'attributes':_0xd9d066[_0xf782('0x24')],'include':_0xd9d066[_0xf782('0x21')]?_['map'](_0xd9d066[_0xf782('0x21')],function(_0x564420){return{'model':db[_0x564420[_0xf782('0x23')]],'as':_0x564420['as'],'attributes':_0x564420[_0xf782('0x24')],'include':_0x564420[_0xf782('0x21')]?_['map'](_0x564420[_0xf782('0x21')],function(_0xda1326){return{'model':db[_0xda1326[_0xf782('0x23')]],'as':_0xda1326['as'],'attributes':_0xda1326[_0xf782('0x24')]};}):[]};}):[]};}):[]:[]})[_0xf782('0x11')](function(_0x5b880d){logger['info'](_0xf782('0x1c'),_0x2c0b56);logger['debug']('ShowSmsAccount',_0x2c0b56,JSON[_0xf782('0x25')](_0x5b880d));_0x191dc0(_0x5b880d);})[_0xf782('0x1b')](function(_0x20cbc5){logger[_0xf782('0x17')](_0xf782('0x1c'),_0x20cbc5[_0xf782('0x19')],_0x2c0b56);_0x4b4c50(_0x42f092[_0xf782('0x17')](0x1f4,_0x20cbc5['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 801feed..d9bd727 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 79f6789..b687aa2 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5cdb4a,_0x4681dc){var _0x1275d2=function(_0x3e441f){while(--_0x3e441f){_0x5cdb4a['push'](_0x5cdb4a['shift']());}};_0x1275d2(++_0x4681dc);}(_0xedd9,0xfc));var _0x9edd=function(_0x303698,_0x3aa04a){_0x303698=_0x303698-0x0;var _0x295f92=_0xedd9[_0x303698];return _0x295f92;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 09ced8a..c4db1bd 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 _0xd367=['*,*,*,*','sequelize','exports','STRING','noop','TEXT'];(function(_0x1ace29,_0x247594){var _0x2ea5a3=function(_0x45b00c){while(--_0x45b00c){_0x1ace29['push'](_0x1ace29['shift']());}};_0x2ea5a3(++_0x247594);}(_0xd367,0x18d));var _0x7d36=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd367[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x7d36('0x0'));module[_0x7d36('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7d36('0x2')],'allowNull':![],'defaultValue':_0x7d36('0x3')},'appdata':{'type':Sequelize[_0x7d36('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7d36('0x2')],'defaultValue':_0x7d36('0x5')}}; \ No newline at end of file +var _0xd4eb=['exports','INTEGER','noop','TEXT','STRING','sequelize'];(function(_0x5c92f4,_0x1555a1){var _0x162828=function(_0x21b8cb){while(--_0x21b8cb){_0x5c92f4['push'](_0x5c92f4['shift']());}};_0x162828(++_0x1555a1);}(_0xd4eb,0xfb));var _0xbd4e=function(_0x198960,_0x6873c0){_0x198960=_0x198960-0x0;var _0xc4a22c=_0xd4eb[_0x198960];return _0xc4a22c;};'use strict';var Sequelize=require(_0xbd4e('0x0'));module[_0xbd4e('0x1')]={'priority':{'type':Sequelize[_0xbd4e('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd4e('0x3')},'appdata':{'type':Sequelize[_0xbd4e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xbd4e('0x5')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index fe5d988..bd23bbc 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 _0x5dc7=['destroy','then','sendStatus','error','stack','name','index','SmsApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5dc7,0x1e5));var _0x75dc=function(_0x5e4fed,_0x31cdff){_0x5e4fed=_0x5e4fed-0x0;var _0x4424b4=_0x5dc7[_0x5e4fed];return _0x4424b4;};'use strict';var emlformat=require(_0x75dc('0x0'));var rimraf=require(_0x75dc('0x1'));var zipdir=require(_0x75dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x75dc('0x3'));var moment=require(_0x75dc('0x4'));var BPromise=require(_0x75dc('0x5'));var Mustache=require('mustache');var util=require(_0x75dc('0x6'));var path=require(_0x75dc('0x7'));var sox=require(_0x75dc('0x8'));var csv=require(_0x75dc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75dc('0xa'));var _=require(_0x75dc('0xb'));var squel=require(_0x75dc('0xc'));var crypto=require(_0x75dc('0xd'));var jsforce=require(_0x75dc('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x75dc('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75dc('0xf'));var authService=require(_0x75dc('0x10'));var qs=require(_0x75dc('0x11'));var as=require(_0x75dc('0x12'));var hardwareService=require(_0x75dc('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x75dc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x75dc('0x15'));var db=require(_0x75dc('0x16'))['db'];function respondWithStatusCode(_0x3d02e7,_0x2489ed){_0x2489ed=_0x2489ed||0xcc;return function(_0x52cd79){if(_0x52cd79){return _0x3d02e7['sendStatus'](_0x2489ed);}return _0x3d02e7[_0x75dc('0x17')](_0x2489ed)[_0x75dc('0x18')]();};}function respondWithResult(_0x543b96,_0xa988e5){_0xa988e5=_0xa988e5||0xc8;return function(_0x212732){if(_0x212732){return _0x543b96[_0x75dc('0x17')](_0xa988e5)[_0x75dc('0x19')](_0x212732);}};}function respondWithFilteredResult(_0x1a98e0,_0x4df2d7){return function(_0x3e28f1){if(_0x3e28f1){var _0x2be504=typeof _0x4df2d7[_0x75dc('0x1a')]===_0x75dc('0x1b')&&typeof _0x4df2d7[_0x75dc('0x1c')]===_0x75dc('0x1b');var _0x2d3069=_0x3e28f1[_0x75dc('0x1d')];var _0x599a09=_0x2be504?0x0:_0x4df2d7[_0x75dc('0x1a')];var _0x22d5c2=_0x2be504?_0x3e28f1[_0x75dc('0x1d')]:_0x4df2d7[_0x75dc('0x1a')]+_0x4df2d7[_0x75dc('0x1c')];var _0x576b48;if(_0x22d5c2>=_0x2d3069){_0x22d5c2=_0x2d3069;_0x576b48=0xc8;}else{_0x576b48=0xce;}_0x1a98e0[_0x75dc('0x17')](_0x576b48);return _0x1a98e0['set'](_0x75dc('0x1e'),_0x599a09+'-'+_0x22d5c2+'/'+_0x2d3069)[_0x75dc('0x19')](_0x3e28f1);}return null;};}function patchUpdates(_0x47a11f){return function(_0x3fea5c){try{jsonpatch[_0x75dc('0x1f')](_0x3fea5c,_0x47a11f,!![]);}catch(_0x35167a){return BPromise[_0x75dc('0x20')](_0x35167a);}return _0x3fea5c['save']();};}function saveUpdates(_0x269d59,_0x538423){return function(_0x2b3a9c){if(_0x2b3a9c){return _0x2b3a9c['update'](_0x269d59)['then'](function(_0x43f4d9){return _0x43f4d9;});}return null;};}function removeEntity(_0x1d95cb,_0x3a1b52){return function(_0x3a020d){if(_0x3a020d){return _0x3a020d[_0x75dc('0x21')]()[_0x75dc('0x22')](function(){_0x1d95cb[_0x75dc('0x17')](0xcc)[_0x75dc('0x18')]();});}};}function handleEntityNotFound(_0x48e96d,_0x3e2f53){return function(_0x43af9d){if(!_0x43af9d){_0x48e96d[_0x75dc('0x23')](0x194);}return _0x43af9d;};}function handleError(_0x49bae9,_0x5b25d6){_0x5b25d6=_0x5b25d6||0x1f4;return function(_0x51e891){logger[_0x75dc('0x24')](_0x51e891[_0x75dc('0x25')]);if(_0x51e891[_0x75dc('0x26')]){delete _0x51e891['name'];}_0x49bae9[_0x75dc('0x17')](_0x5b25d6)['send'](_0x51e891);};}exports[_0x75dc('0x27')]=function(_0x5ca70f,_0x71c58f){var _0x21c942={},_0x50416a={},_0x5a7901={'count':0x0,'rows':[]};var _0x3009af=_['map'](db[_0x75dc('0x28')][_0x75dc('0x29')],function(_0x180ee6){return{'name':_0x180ee6[_0x75dc('0x2a')],'type':_0x180ee6[_0x75dc('0x2b')]['key']};});_0x50416a[_0x75dc('0x2c')]=_[_0x75dc('0x2d')](_0x3009af,_0x75dc('0x26'));_0x50416a[_0x75dc('0x2e')]=_[_0x75dc('0x2f')](_0x5ca70f[_0x75dc('0x2e')]);_0x50416a[_0x75dc('0x30')]=_[_0x75dc('0x31')](_0x50416a[_0x75dc('0x2c')],_0x50416a['query']);_0x21c942[_0x75dc('0x32')]=_[_0x75dc('0x31')](_0x50416a[_0x75dc('0x2c')],qs[_0x75dc('0x33')](_0x5ca70f[_0x75dc('0x2e')][_0x75dc('0x33')]));_0x21c942[_0x75dc('0x32')]=_0x21c942[_0x75dc('0x32')][_0x75dc('0x34')]?_0x21c942[_0x75dc('0x32')]:_0x50416a[_0x75dc('0x2c')];if(!_0x5ca70f[_0x75dc('0x2e')][_0x75dc('0x35')](_0x75dc('0x36'))){_0x21c942[_0x75dc('0x1c')]=qs['limit'](_0x5ca70f[_0x75dc('0x2e')]['limit']);_0x21c942[_0x75dc('0x1a')]=qs[_0x75dc('0x1a')](_0x5ca70f[_0x75dc('0x2e')][_0x75dc('0x1a')]);}_0x21c942[_0x75dc('0x37')]=qs[_0x75dc('0x38')](_0x5ca70f['query'][_0x75dc('0x38')]);_0x21c942['where']=qs[_0x75dc('0x30')](_[_0x75dc('0x39')](_0x5ca70f[_0x75dc('0x2e')],_0x50416a[_0x75dc('0x30')]),_0x3009af);if(_0x5ca70f[_0x75dc('0x2e')]['filter']){_0x21c942[_0x75dc('0x3a')]=_[_0x75dc('0x3b')](_0x21c942[_0x75dc('0x3a')],{'$or':_['map'](_0x3009af,function(_0x1f6632){if(_0x1f6632[_0x75dc('0x2b')]!==_0x75dc('0x3c')){var _0x4a071c={};_0x4a071c[_0x1f6632[_0x75dc('0x26')]]={'$like':'%'+_0x5ca70f[_0x75dc('0x2e')][_0x75dc('0x3d')]+'%'};return _0x4a071c;}})});}_0x21c942=_['merge']({},_0x21c942,_0x5ca70f['options']);var _0x1ab585={'where':_0x21c942[_0x75dc('0x3a')]};return db['SmsApplication']['count'](_0x1ab585)[_0x75dc('0x22')](function(_0x308732){_0x5a7901[_0x75dc('0x1d')]=_0x308732;if(_0x5ca70f[_0x75dc('0x2e')][_0x75dc('0x3e')]){_0x21c942[_0x75dc('0x3f')]=[{'all':!![]}];}return db['SmsApplication'][_0x75dc('0x40')](_0x21c942);})[_0x75dc('0x22')](function(_0x1e9552){_0x5a7901[_0x75dc('0x41')]=_0x1e9552;return _0x5a7901;})[_0x75dc('0x22')](respondWithFilteredResult(_0x71c58f,_0x21c942))[_0x75dc('0x42')](handleError(_0x71c58f,null));};exports[_0x75dc('0x43')]=function(_0x2a0330,_0x4b7963){var _0x548039={'raw':!![],'where':{'id':_0x2a0330[_0x75dc('0x44')]['id']}},_0x143e8b={};_0x143e8b[_0x75dc('0x2c')]=_[_0x75dc('0x2f')](db['SmsApplication'][_0x75dc('0x29')]);_0x143e8b[_0x75dc('0x2e')]=_[_0x75dc('0x2f')](_0x2a0330['query']);_0x143e8b['filters']=_[_0x75dc('0x31')](_0x143e8b[_0x75dc('0x2c')],_0x143e8b[_0x75dc('0x2e')]);_0x548039[_0x75dc('0x32')]=_['intersection'](_0x143e8b[_0x75dc('0x2c')],qs[_0x75dc('0x33')](_0x2a0330[_0x75dc('0x2e')][_0x75dc('0x33')]));_0x548039[_0x75dc('0x32')]=_0x548039['attributes']['length']?_0x548039[_0x75dc('0x32')]:_0x143e8b['model'];if(_0x2a0330[_0x75dc('0x2e')][_0x75dc('0x3e')]){_0x548039['include']=[{'all':!![]}];}_0x548039=_[_0x75dc('0x3b')]({},_0x548039,_0x2a0330[_0x75dc('0x45')]);return db[_0x75dc('0x28')][_0x75dc('0x46')](_0x548039)['then'](handleEntityNotFound(_0x4b7963,null))['then'](respondWithResult(_0x4b7963,null))[_0x75dc('0x42')](handleError(_0x4b7963,null));};exports['create']=function(_0x46227d,_0x41a94d){return db['SmsApplication'][_0x75dc('0x47')](_0x46227d[_0x75dc('0x48')],{})[_0x75dc('0x22')](respondWithResult(_0x41a94d,0xc9))[_0x75dc('0x42')](handleError(_0x41a94d,null));};exports[_0x75dc('0x49')]=function(_0x54b718,_0x434c69){if(_0x54b718[_0x75dc('0x48')]['id']){delete _0x54b718[_0x75dc('0x48')]['id'];}return db[_0x75dc('0x28')][_0x75dc('0x46')]({'where':{'id':_0x54b718[_0x75dc('0x44')]['id']}})['then'](handleEntityNotFound(_0x434c69,null))[_0x75dc('0x22')](saveUpdates(_0x54b718[_0x75dc('0x48')],null))[_0x75dc('0x22')](respondWithResult(_0x434c69,null))[_0x75dc('0x42')](handleError(_0x434c69,null));};exports[_0x75dc('0x21')]=function(_0x50b6d3,_0x6edeaf){return db[_0x75dc('0x28')]['find']({'where':{'id':_0x50b6d3['params']['id']}})[_0x75dc('0x22')](handleEntityNotFound(_0x6edeaf,null))['then'](removeEntity(_0x6edeaf,null))[_0x75dc('0x42')](handleError(_0x6edeaf,null));}; \ No newline at end of file +var _0x41e8=['api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','SmsApplication','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','keys','length','find','create','update','body','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x41e8,0x189));var _0x841e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x41e8[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require(_0x841e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x841e('0x1'));var jsonpatch=require(_0x841e('0x2'));var rp=require(_0x841e('0x3'));var moment=require('moment');var BPromise=require(_0x841e('0x4'));var Mustache=require(_0x841e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x841e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x841e('0x7'));var _=require(_0x841e('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x841e('0x9'));var deskjs=require(_0x841e('0xa'));var toCsv=require('to-csv');var querystring=require(_0x841e('0xb'));var Papa=require('papaparse');var Redis=require(_0x841e('0xc'));var authService=require(_0x841e('0xd'));var qs=require(_0x841e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x841e('0xf'));var utils=require(_0x841e('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x841e('0x11'));var db=require(_0x841e('0x12'))['db'];function respondWithStatusCode(_0x58e5e0,_0x5ded8f){_0x5ded8f=_0x5ded8f||0xcc;return function(_0x328b62){if(_0x328b62){return _0x58e5e0[_0x841e('0x13')](_0x5ded8f);}return _0x58e5e0[_0x841e('0x14')](_0x5ded8f)[_0x841e('0x15')]();};}function respondWithResult(_0x3da528,_0x3eeb10){_0x3eeb10=_0x3eeb10||0xc8;return function(_0x105cc9){if(_0x105cc9){return _0x3da528[_0x841e('0x14')](_0x3eeb10)[_0x841e('0x16')](_0x105cc9);}};}function respondWithFilteredResult(_0x5cfb0f,_0xe73124){return function(_0x269465){if(_0x269465){var _0xdede9c=typeof _0xe73124[_0x841e('0x17')]===_0x841e('0x18')&&typeof _0xe73124[_0x841e('0x19')]==='undefined';var _0x2b3514=_0x269465[_0x841e('0x1a')];var _0x5d95f8=_0xdede9c?0x0:_0xe73124[_0x841e('0x17')];var _0x2d6bcf=_0xdede9c?_0x269465['count']:_0xe73124[_0x841e('0x17')]+_0xe73124[_0x841e('0x19')];var _0x5515ed;if(_0x2d6bcf>=_0x2b3514){_0x2d6bcf=_0x2b3514;_0x5515ed=0xc8;}else{_0x5515ed=0xce;}_0x5cfb0f[_0x841e('0x14')](_0x5515ed);return _0x5cfb0f[_0x841e('0x1b')](_0x841e('0x1c'),_0x5d95f8+'-'+_0x2d6bcf+'/'+_0x2b3514)['json'](_0x269465);}return null;};}function patchUpdates(_0x43970f){return function(_0x1d0192){try{jsonpatch[_0x841e('0x1d')](_0x1d0192,_0x43970f,!![]);}catch(_0x5c4491){return BPromise[_0x841e('0x1e')](_0x5c4491);}return _0x1d0192[_0x841e('0x1f')]();};}function saveUpdates(_0x3eaf35,_0x5b4fc4){return function(_0x48ddc5){if(_0x48ddc5){return _0x48ddc5['update'](_0x3eaf35)[_0x841e('0x20')](function(_0x6c88c){return _0x6c88c;});}return null;};}function removeEntity(_0x157e6f,_0x4563a6){return function(_0xcfbb4b){if(_0xcfbb4b){return _0xcfbb4b[_0x841e('0x21')]()['then'](function(){_0x157e6f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2be749,_0x1e52f0){return function(_0x2ecc16){if(!_0x2ecc16){_0x2be749[_0x841e('0x13')](0x194);}return _0x2ecc16;};}function handleError(_0x27976e,_0x37ccb4){_0x37ccb4=_0x37ccb4||0x1f4;return function(_0x38b714){logger[_0x841e('0x22')](_0x38b714[_0x841e('0x23')]);if(_0x38b714[_0x841e('0x24')]){delete _0x38b714[_0x841e('0x24')];}_0x27976e['status'](_0x37ccb4)[_0x841e('0x25')](_0x38b714);};}exports['index']=function(_0x2d7093,_0x5103f5){var _0x54b7e2={},_0x2d3bc1={},_0x4ad8a8={'count':0x0,'rows':[]};var _0x2ba3b6=_[_0x841e('0x26')](db[_0x841e('0x27')]['rawAttributes'],function(_0xeb0ba8){return{'name':_0xeb0ba8['fieldName'],'type':_0xeb0ba8['type'][_0x841e('0x28')]};});_0x2d3bc1[_0x841e('0x29')]=_[_0x841e('0x26')](_0x2ba3b6,_0x841e('0x24'));_0x2d3bc1['query']=_['keys'](_0x2d7093[_0x841e('0x2a')]);_0x2d3bc1[_0x841e('0x2b')]=_[_0x841e('0x2c')](_0x2d3bc1[_0x841e('0x29')],_0x2d3bc1[_0x841e('0x2a')]);_0x54b7e2[_0x841e('0x2d')]=_[_0x841e('0x2c')](_0x2d3bc1[_0x841e('0x29')],qs[_0x841e('0x2e')](_0x2d7093[_0x841e('0x2a')]['fields']));_0x54b7e2[_0x841e('0x2d')]=_0x54b7e2[_0x841e('0x2d')]['length']?_0x54b7e2[_0x841e('0x2d')]:_0x2d3bc1['model'];if(!_0x2d7093[_0x841e('0x2a')][_0x841e('0x2f')](_0x841e('0x30'))){_0x54b7e2[_0x841e('0x19')]=qs[_0x841e('0x19')](_0x2d7093[_0x841e('0x2a')]['limit']);_0x54b7e2['offset']=qs['offset'](_0x2d7093['query'][_0x841e('0x17')]);}_0x54b7e2['order']=qs[_0x841e('0x31')](_0x2d7093[_0x841e('0x2a')]['sort']);_0x54b7e2[_0x841e('0x32')]=qs['filters'](_[_0x841e('0x33')](_0x2d7093[_0x841e('0x2a')],_0x2d3bc1[_0x841e('0x2b')]),_0x2ba3b6);if(_0x2d7093[_0x841e('0x2a')][_0x841e('0x34')]){_0x54b7e2['where']=_['merge'](_0x54b7e2[_0x841e('0x32')],{'$or':_[_0x841e('0x26')](_0x2ba3b6,function(_0x1d3695){if(_0x1d3695[_0x841e('0x35')]!==_0x841e('0x36')){var _0x572588={};_0x572588[_0x1d3695[_0x841e('0x24')]]={'$like':'%'+_0x2d7093[_0x841e('0x2a')]['filter']+'%'};return _0x572588;}})});}_0x54b7e2=_['merge']({},_0x54b7e2,_0x2d7093[_0x841e('0x37')]);var _0x4e8557={'where':_0x54b7e2[_0x841e('0x32')]};return db[_0x841e('0x27')][_0x841e('0x1a')](_0x4e8557)[_0x841e('0x20')](function(_0x517dba){_0x4ad8a8[_0x841e('0x1a')]=_0x517dba;if(_0x2d7093[_0x841e('0x2a')]['includeAll']){_0x54b7e2[_0x841e('0x38')]=[{'all':!![]}];}return db[_0x841e('0x27')]['findAll'](_0x54b7e2);})['then'](function(_0x43fd58){_0x4ad8a8[_0x841e('0x39')]=_0x43fd58;return _0x4ad8a8;})[_0x841e('0x20')](respondWithFilteredResult(_0x5103f5,_0x54b7e2))[_0x841e('0x3a')](handleError(_0x5103f5,null));};exports[_0x841e('0x3b')]=function(_0x3e1646,_0x57ae57){var _0x1326ae={'raw':!![],'where':{'id':_0x3e1646[_0x841e('0x3c')]['id']}},_0x37ca5a={};_0x37ca5a[_0x841e('0x29')]=_['keys'](db['SmsApplication'][_0x841e('0x3d')]);_0x37ca5a[_0x841e('0x2a')]=_[_0x841e('0x3e')](_0x3e1646[_0x841e('0x2a')]);_0x37ca5a[_0x841e('0x2b')]=_['intersection'](_0x37ca5a[_0x841e('0x29')],_0x37ca5a[_0x841e('0x2a')]);_0x1326ae[_0x841e('0x2d')]=_[_0x841e('0x2c')](_0x37ca5a[_0x841e('0x29')],qs[_0x841e('0x2e')](_0x3e1646['query']['fields']));_0x1326ae[_0x841e('0x2d')]=_0x1326ae['attributes'][_0x841e('0x3f')]?_0x1326ae[_0x841e('0x2d')]:_0x37ca5a[_0x841e('0x29')];if(_0x3e1646[_0x841e('0x2a')]['includeAll']){_0x1326ae['include']=[{'all':!![]}];}_0x1326ae=_['merge']({},_0x1326ae,_0x3e1646[_0x841e('0x37')]);return db['SmsApplication'][_0x841e('0x40')](_0x1326ae)['then'](handleEntityNotFound(_0x57ae57,null))[_0x841e('0x20')](respondWithResult(_0x57ae57,null))[_0x841e('0x3a')](handleError(_0x57ae57,null));};exports[_0x841e('0x41')]=function(_0x1939e2,_0x36a455){return db['SmsApplication'][_0x841e('0x41')](_0x1939e2['body'],{})[_0x841e('0x20')](respondWithResult(_0x36a455,0xc9))[_0x841e('0x3a')](handleError(_0x36a455,null));};exports[_0x841e('0x42')]=function(_0x1d3ec4,_0x4edd9){if(_0x1d3ec4['body']['id']){delete _0x1d3ec4[_0x841e('0x43')]['id'];}return db[_0x841e('0x27')]['find']({'where':{'id':_0x1d3ec4[_0x841e('0x3c')]['id']}})[_0x841e('0x20')](handleEntityNotFound(_0x4edd9,null))[_0x841e('0x20')](saveUpdates(_0x1d3ec4[_0x841e('0x43')],null))['then'](respondWithResult(_0x4edd9,null))[_0x841e('0x3a')](handleError(_0x4edd9,null));};exports[_0x841e('0x21')]=function(_0x23e684,_0x2fc0ae){return db[_0x841e('0x27')][_0x841e('0x40')]({'where':{'id':_0x23e684[_0x841e('0x3c')]['id']}})[_0x841e('0x20')](handleEntityNotFound(_0x2fc0ae,null))[_0x841e('0x20')](removeEntity(_0x2fc0ae,null))[_0x841e('0x3a')](handleError(_0x2fc0ae,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 5cd6897..ab9c43f 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 _0x2e15=['bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4','../../config/logger','moment'];(function(_0x4053d9,_0x18b688){var _0x5480f0=function(_0x390fd3){while(--_0x390fd3){_0x4053d9['push'](_0x4053d9['shift']());}};_0x5480f0(++_0x18b688);}(_0x2e15,0xda));var _0x52e1=function(_0x4932a6,_0x530e29){_0x4932a6=_0x4932a6-0x0;var _0x3b45b9=_0x2e15[_0x4932a6];return _0x3b45b9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x52e1('0x0'))('api');var moment=require(_0x52e1('0x1'));var BPromise=require(_0x52e1('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x52e1('0x3'));var rimraf=require(_0x52e1('0x4'));var config=require(_0x52e1('0x5'));var attributes=require(_0x52e1('0x6'));module[_0x52e1('0x7')]=function(_0x59ea2c,_0x4a8c8b){return _0x59ea2c['define'](_0x52e1('0x8'),attributes,{'tableName':_0x52e1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x52e1('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x0037=['SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports'];(function(_0x4cf3ba,_0x4623d4){var _0xb1da73=function(_0x7baa28){while(--_0x7baa28){_0x4cf3ba['push'](_0x4cf3ba['shift']());}};_0xb1da73(++_0x4623d4);}(_0x0037,0xac));var _0x7003=function(_0x5b4024,_0x24883b){_0x5b4024=_0x5b4024-0x0;var _0x52eeab=_0x0037[_0x5b4024];return _0x52eeab;};'use strict';var _=require(_0x7003('0x0'));var util=require('util');var logger=require(_0x7003('0x1'))(_0x7003('0x2'));var moment=require(_0x7003('0x3'));var BPromise=require(_0x7003('0x4'));var rp=require(_0x7003('0x5'));var fs=require('fs');var path=require(_0x7003('0x6'));var rimraf=require(_0x7003('0x7'));var config=require('../../config/environment');var attributes=require(_0x7003('0x8'));module[_0x7003('0x9')]=function(_0x1ed923,_0x43300e){return _0x1ed923['define'](_0x7003('0xa'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7003('0xb'),'collate':_0x7003('0xc')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 319b4c5..5886d47 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 _0xd08d=['http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x56ec01,_0x38ef57){var _0x288514=function(_0x1b8a58){while(--_0x1b8a58){_0x56ec01['push'](_0x56ec01['shift']());}};_0x288514(++_0x38ef57);}(_0xd08d,0x81));var _0xdd08=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xd08d[_0x1cb18a];return _0x22442e;};'use strict';var _=require('lodash');var util=require(_0xdd08('0x0'));var moment=require(_0xdd08('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd08('0x2'));var fs=require('fs');var Redis=require(_0xdd08('0x3'));var db=require(_0xdd08('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd08('0x5'))(_0xdd08('0x6'));var config=require(_0xdd08('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd08('0x8')][_0xdd08('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x13999f,_0x28d59c,_0x147a23){return new BPromise(function(_0x54a5a3,_0x15416b){return client[_0xdd08('0xa')](_0x13999f,_0x147a23)[_0xdd08('0xb')](function(_0x51ce97){logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));logger[_0xdd08('0xf')](_0xdd08('0x10'),_0x28d59c,_0xdd08('0xe'),JSON[_0xdd08('0x11')](_0x51ce97));if(_0x51ce97[_0xdd08('0x12')]){if(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x13')]===0x1f4){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97['error'][_0xdd08('0x14')]);return _0x15416b(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);return _0x54a5a3(_0x51ce97[_0xdd08('0x12')][_0xdd08('0x14')]);}else{logger[_0xdd08('0xc')](_0xdd08('0xd'),_0x28d59c,_0xdd08('0xe'));_0x54a5a3(_0x51ce97[_0xdd08('0x15')][_0xdd08('0x14')]);}})[_0xdd08('0x16')](function(_0x278f5e){logger[_0xdd08('0x12')](_0xdd08('0xd'),_0x28d59c,_0x278f5e);_0x15416b(_0x278f5e);});});} \ No newline at end of file +var _0x97b2=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','SmsApplication,\x20%s,\x20%s','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash'];(function(_0x252b69,_0x9307cf){var _0xc8fd8b=function(_0x47632f){while(--_0x47632f){_0x252b69['push'](_0x252b69['shift']());}};_0xc8fd8b(++_0x9307cf);}(_0x97b2,0x1b7));var _0x297b=function(_0x1b3a5c,_0x2f9d5f){_0x1b3a5c=_0x1b3a5c-0x0;var _0x2ae8cb=_0x97b2[_0x1b3a5c];return _0x2ae8cb;};'use strict';var _=require(_0x297b('0x0'));var util=require(_0x297b('0x1'));var moment=require(_0x297b('0x2'));var BPromise=require(_0x297b('0x3'));var rs=require(_0x297b('0x4'));var fs=require('fs');var Redis=require(_0x297b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x297b('0x6'));var logger=require(_0x297b('0x7'))('rpc');var config=require(_0x297b('0x8'));var jayson=require(_0x297b('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x541d7b,_0x2c5bf5,_0x18a663){return new BPromise(function(_0x520b38,_0x27a761){return client[_0x297b('0xa')](_0x541d7b,_0x18a663)['then'](function(_0x176f98){logger['info'](_0x297b('0xb'),_0x2c5bf5,'request\x20sent');logger[_0x297b('0xc')](_0x297b('0xd'),_0x2c5bf5,_0x297b('0xe'),JSON[_0x297b('0xf')](_0x176f98));if(_0x176f98[_0x297b('0x10')]){if(_0x176f98[_0x297b('0x10')][_0x297b('0x11')]===0x1f4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);return _0x27a761(_0x176f98[_0x297b('0x10')][_0x297b('0x12')]);}logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x176f98['error'][_0x297b('0x12')]);return _0x520b38(_0x176f98[_0x297b('0x10')]['message']);}else{logger[_0x297b('0x13')](_0x297b('0xb'),_0x2c5bf5,_0x297b('0xe'));_0x520b38(_0x176f98[_0x297b('0x14')][_0x297b('0x12')]);}})[_0x297b('0x15')](function(_0x4882a4){logger[_0x297b('0x10')](_0x297b('0xb'),_0x2c5bf5,_0x4882a4);_0x27a761(_0x4882a4);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 1518330..a9d5902 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 _0xea28=['put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','/:id/download','download','create','post','tracked','sms','smsinteraction:addtags','addTags'];(function(_0x468f6a,_0x5ca66b){var _0x32fd80=function(_0x48b7d9){while(--_0x48b7d9){_0x468f6a['push'](_0x468f6a['shift']());}};_0x32fd80(++_0x5ca66b);}(_0xea28,0x13a));var _0x8ea2=function(_0x56d510,_0x1b58fd){_0x56d510=_0x56d510-0x0;var _0x2b0137=_0xea28[_0x56d510];return _0x2b0137;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getMessages']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['post']('/',auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x14')]);router[_0x8ea2('0x15')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['addMessage']);router[_0x8ea2('0x15')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x18')),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1b')),controller[_0x8ea2('0x1c')]);router[_0x8ea2('0x1d')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),interaction[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x8ea2('0x1e')),controller[_0x8ea2('0x1f')]);router[_0x8ea2('0x1d')](_0x8ea2('0x20'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x21')]);module['exports']=router; \ No newline at end of file +var _0x3266=['isAuthenticated','index','get','/:id','show','getMessages','/:id/download','download','post','create','addMessage','sms','smsinteraction:addtags','addTags','put','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsInteraction.controller'];(function(_0x1b89b9,_0x2809df){var _0xf7770f=function(_0x53b8d0){while(--_0x53b8d0){_0x1b89b9['push'](_0x1b89b9['shift']());}};_0xf7770f(++_0x2809df);}(_0x3266,0x6a));var _0x6326=function(_0x454018,_0x46e33a){_0x454018=_0x454018-0x0;var _0x24697d=_0x3266[_0x454018];return _0x24697d;};'use strict';var multer=require(_0x6326('0x0'));var util=require(_0x6326('0x1'));var path=require(_0x6326('0x2'));var timeout=require(_0x6326('0x3'));var express=require(_0x6326('0x4'));var router=express[_0x6326('0x5')]();var fs_extra=require(_0x6326('0x6'));var auth=require(_0x6326('0x7'));var interaction=require(_0x6326('0x8'));var config=require('../../config/environment');var controller=require(_0x6326('0x9'));router['get']('/',auth[_0x6326('0xa')](),controller[_0x6326('0xb')]);router[_0x6326('0xc')]('/describe',auth[_0x6326('0xa')](),controller['describe']);router[_0x6326('0xc')](_0x6326('0xd'),auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xc')]('/:id/messages',auth[_0x6326('0xa')](),controller[_0x6326('0xf')]);router[_0x6326('0xc')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x11')]);router[_0x6326('0x12')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);router[_0x6326('0x12')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6326('0x14')]);router[_0x6326('0x12')]('/:id/tags',auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x16')),controller[_0x6326('0x17')]);router[_0x6326('0x18')](_0x6326('0xd'),auth[_0x6326('0xa')](),interaction['tracked'](_0x6326('0x15'),'smsinteraction:update'),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x6326('0x15'),_0x6326('0x19')),controller[_0x6326('0x1a')]);router['delete']('/:id/tags',auth[_0x6326('0xa')](),controller[_0x6326('0x1b')]);module[_0x6326('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 7999524..b33d754 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 _0xa8b1=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0xa8b1,0x182));var _0x1a8b=function(_0x326b32,_0x1ae49b){_0x326b32=_0x326b32-0x0;var _0x3c59aa=_0xa8b1[_0x326b32];return _0x3c59aa;};'use strict';var Sequelize=require(_0x1a8b('0x0'));var moment=require(_0x1a8b('0x1'));module[_0x1a8b('0x2')]={'closed':{'type':Sequelize[_0x1a8b('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1a8b('0x4')]},'disposition':{'type':Sequelize[_0x1a8b('0x5')]},'secondDisposition':{'type':Sequelize[_0x1a8b('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1a8b('0x5')]},'read1stAt':{'type':Sequelize[_0x1a8b('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1a8b('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1a8b('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x1a8b('0x7')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x1a8b('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1a8b('0x8')]}}; \ No newline at end of file +var _0x4ca7=['DATE','STRING','ENUM','out','BOOLEAN','INTEGER','sequelize','moment','exports'];(function(_0x10db7f,_0x5ec9c6){var _0x5673d6=function(_0x4d3e9e){while(--_0x4d3e9e){_0x10db7f['push'](_0x10db7f['shift']());}};_0x5673d6(++_0x5ec9c6);}(_0x4ca7,0x1e3));var _0x74ca=function(_0x125a18,_0x59c4e6){_0x125a18=_0x125a18-0x0;var _0x1c2f00=_0x4ca7[_0x125a18];return _0x1c2f00;};'use strict';var Sequelize=require(_0x74ca('0x0'));var moment=require(_0x74ca('0x1'));module[_0x74ca('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74ca('0x3')]},'disposition':{'type':Sequelize[_0x74ca('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74ca('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x74ca('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x74ca('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74ca('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x74ca('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74ca('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x74ca('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 688029e..7ec3fcd 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 _0x234d=['../../config/logger','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./smsInteraction.socket','status','json','offset','limit','undefined','count','set','Content-Range','update','then','end','sendStatus','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','query','user','catch','show','params','model','keys','intersection','fields','attributes','length','includeAll','merge','find','create','body','destroy','describe','addMessage','SmsMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','include','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','files','tmp','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','Messages','createdAt','direction','secret','SmsAccount','Owner','get','mkdirSync','Sms','closed','closedAt','out','System','firstName','read','value','renderFile','root','views','downloadInteraction.ejs','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs'];(function(_0x2c67f9,_0x358108){var _0x4aaae7=function(_0x5f40cb){while(--_0x5f40cb){_0x2c67f9['push'](_0x2c67f9['shift']());}};_0x4aaae7(++_0x358108);}(_0x234d,0x1d6));var _0xd234=function(_0x47aa3f,_0x9a5a94){_0x47aa3f=_0x47aa3f-0x0;var _0x1a7a7b=_0x234d[_0x47aa3f];return _0x1a7a7b;};'use strict';var rimraf=require(_0xd234('0x0'));var zipdir=require(_0xd234('0x1'));var moment=require(_0xd234('0x2'));var BPromise=require('bluebird');var util=require(_0xd234('0x3'));var path=require(_0xd234('0x4'));var ejs=require(_0xd234('0x5'));var fs=require('fs');var _=require(_0xd234('0x6'));var Redis=require(_0xd234('0x7'));var interaction=require(_0xd234('0x8'));var qs=require(_0xd234('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0xd234('0xa'))('api');var config=require(_0xd234('0xb'));var db=require(_0xd234('0xc'))['db'];config['redis']=_[_0xd234('0xd')](config[_0xd234('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xd234('0xf'))(new Redis(config[_0xd234('0xe')]));require(_0xd234('0x10'))['register'](socket);function respondWithStatusCode(_0x13342c,_0x1a03ae){_0x1a03ae=_0x1a03ae||0xcc;return function(_0x2814a3){if(_0x2814a3){return _0x13342c['sendStatus'](_0x1a03ae);}return _0x13342c[_0xd234('0x11')](_0x1a03ae)['end']();};}function respondWithResult(_0x73d60b,_0x449fc8){_0x449fc8=_0x449fc8||0xc8;return function(_0x1b5d1c){if(_0x1b5d1c){return _0x73d60b[_0xd234('0x11')](_0x449fc8)[_0xd234('0x12')](_0x1b5d1c);}};}function respondWithFilteredResult(_0x1534e2,_0x1c9e3c){return function(_0x1af440){if(_0x1af440){var _0x57bc51=typeof _0x1c9e3c[_0xd234('0x13')]==='undefined'&&typeof _0x1c9e3c[_0xd234('0x14')]===_0xd234('0x15');var _0x425bd7=_0x1af440[_0xd234('0x16')];var _0x2456f2=_0x57bc51?0x0:_0x1c9e3c[_0xd234('0x13')];var _0x5067b0=_0x57bc51?_0x1af440['count']:_0x1c9e3c[_0xd234('0x13')]+_0x1c9e3c[_0xd234('0x14')];var _0x496e66;if(_0x5067b0>=_0x425bd7){_0x5067b0=_0x425bd7;_0x496e66=0xc8;}else{_0x496e66=0xce;}_0x1534e2[_0xd234('0x11')](_0x496e66);return _0x1534e2[_0xd234('0x17')](_0xd234('0x18'),_0x2456f2+'-'+_0x5067b0+'/'+_0x425bd7)['json'](_0x1af440);}return null;};}function saveUpdates(_0x1c0622){return function(_0x3a78fb){if(_0x3a78fb){return _0x3a78fb[_0xd234('0x19')](_0x1c0622)[_0xd234('0x1a')](function(_0x55f016){return _0x55f016;});}return null;};}function removeEntity(_0x28e55f){return function(_0x49e45f){if(_0x49e45f){return _0x49e45f['destroy']()[_0xd234('0x1a')](function(){_0x28e55f[_0xd234('0x11')](0xcc)[_0xd234('0x1b')]();});}};}function handleEntityNotFound(_0x3a847b){return function(_0x3e4a0b){if(!_0x3e4a0b){_0x3a847b[_0xd234('0x1c')](0x194);}return _0x3e4a0b;};}function handleError(_0x4bb32a,_0x5acfee){_0x5acfee=_0x5acfee||0x1f4;return function(_0x2de093){logger['error'](_0x2de093[_0xd234('0x1d')]);if(_0x2de093[_0xd234('0x1e')]){delete _0x2de093[_0xd234('0x1e')];}_0x4bb32a[_0xd234('0x11')](_0x5acfee)[_0xd234('0x1f')](_0x2de093);};}exports[_0xd234('0x20')]=function(_0x389773,_0x249051){var _0x5459de={};var _0x527def=_['map'](db[_0xd234('0x21')][_0xd234('0x22')],function(_0x2cd6aa){return{'name':_0x2cd6aa[_0xd234('0x23')],'type':_0x2cd6aa[_0xd234('0x24')]['key']};});_0x5459de=qs[_0xd234('0x25')](_0x527def,_0x389773);return interaction[_0xd234('0x26')]('sms',_0x389773[_0xd234('0x27')],_0x389773[_0xd234('0x28')],_0x5459de,_0x527def)[_0xd234('0x1a')](respondWithFilteredResult(_0x249051,_0x5459de))[_0xd234('0x29')](handleError(_0x249051,null));};exports[_0xd234('0x2a')]=function(_0x1bee90,_0x233f74){var _0x13b49a={'raw':![],'where':{'id':_0x1bee90[_0xd234('0x2b')]['id']}},_0x3d284f={};_0x3d284f[_0xd234('0x2c')]=_[_0xd234('0x2d')](db[_0xd234('0x21')]['rawAttributes']);_0x3d284f[_0xd234('0x27')]=_[_0xd234('0x2d')](_0x1bee90['query']);_0x3d284f['filters']=_[_0xd234('0x2e')](_0x3d284f['model'],_0x3d284f[_0xd234('0x27')]);_0x13b49a['attributes']=_['intersection'](_0x3d284f[_0xd234('0x2c')],qs['fields'](_0x1bee90[_0xd234('0x27')][_0xd234('0x2f')]));_0x13b49a[_0xd234('0x30')]=_0x13b49a[_0xd234('0x30')][_0xd234('0x31')]?_0x13b49a['attributes']:_0x3d284f['model'];if(_0x1bee90[_0xd234('0x27')][_0xd234('0x32')]){_0x13b49a['include']=[{'all':!![]}];}_0x13b49a=_[_0xd234('0x33')]({},_0x13b49a,_0x1bee90['options']);return db[_0xd234('0x21')][_0xd234('0x34')](_0x13b49a)[_0xd234('0x1a')](handleEntityNotFound(_0x233f74,null))[_0xd234('0x1a')](respondWithResult(_0x233f74,null))[_0xd234('0x29')](handleError(_0x233f74,null));};exports[_0xd234('0x35')]=function(_0x15fbbd,_0x4ee847){return db['SmsInteraction']['create'](_0x15fbbd[_0xd234('0x36')],{})[_0xd234('0x1a')](respondWithResult(_0x4ee847,0xc9))[_0xd234('0x29')](handleError(_0x4ee847,null));};exports[_0xd234('0x19')]=function(_0x356a37,_0xead640){if(_0x356a37[_0xd234('0x36')]['id']){delete _0x356a37[_0xd234('0x36')]['id'];}return db[_0xd234('0x21')][_0xd234('0x34')]({'where':{'id':_0x356a37[_0xd234('0x2b')]['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0xead640,null))['then'](saveUpdates(_0x356a37[_0xd234('0x36')],null))['then'](respondWithResult(_0xead640,null))[_0xd234('0x29')](handleError(_0xead640,null));};exports[_0xd234('0x37')]=function(_0x2c7ecd,_0x253fd9){return db[_0xd234('0x21')]['find']({'where':{'id':_0x2c7ecd[_0xd234('0x2b')]['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x253fd9,null))['then'](removeEntity(_0x253fd9,null))[_0xd234('0x29')](handleError(_0x253fd9,null));};exports[_0xd234('0x38')]=function(_0x3b046d,_0x306277){return db['SmsInteraction']['describe']()[_0xd234('0x1a')](respondWithResult(_0x306277,null))[_0xd234('0x29')](handleError(_0x306277,null));};exports[_0xd234('0x39')]=function(_0x45328a,_0x1c3a6d){return db[_0xd234('0x3a')][_0xd234('0x34')]({'where':{'id':_0x45328a['params']['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x1c3a6d,null))[_0xd234('0x1a')](function(_0x2438ca){if(_0x2438ca){return _0x2438ca[_0xd234('0x39')](_0x45328a[_0xd234('0x36')][_0xd234('0x3b')],_[_0xd234('0x3c')](_0x45328a[_0xd234('0x36')],['ids','id'])||{});}})[_0xd234('0x1a')](respondWithResult(_0x1c3a6d,null))[_0xd234('0x29')](handleError(_0x1c3a6d,null));};exports[_0xd234('0x3d')]=function(_0x56d013,_0x2f230e){var _0x153ea6={'raw':![],'where':{}};var _0x1e6723={};var _0x46bf06={'count':0x0,'rows':[]};return db[_0xd234('0x21')]['findOne']({'where':{'id':_0x56d013['params']['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x2f230e,null))[_0xd234('0x1a')](function(_0x3bebc9){if(_0x3bebc9){_0x1e6723['model']=_[_0xd234('0x2d')](db[_0xd234('0x3a')][_0xd234('0x22')]);_0x1e6723[_0xd234('0x27')]=_[_0xd234('0x2d')](_0x56d013[_0xd234('0x27')]);_0x1e6723[_0xd234('0x3e')]=_['intersection'](_0x1e6723[_0xd234('0x2c')],_0x1e6723[_0xd234('0x27')]);_0x153ea6[_0xd234('0x30')]=_[_0xd234('0x2e')](_0x1e6723[_0xd234('0x2c')],qs['fields'](_0x56d013[_0xd234('0x27')][_0xd234('0x2f')]));_0x153ea6[_0xd234('0x30')]=_0x153ea6[_0xd234('0x30')][_0xd234('0x31')]?_0x153ea6[_0xd234('0x30')]:_0x1e6723[_0xd234('0x2c')];if(!_0x56d013[_0xd234('0x27')][_0xd234('0x3f')](_0xd234('0x40'))){_0x153ea6[_0xd234('0x14')]=qs['limit'](_0x56d013[_0xd234('0x27')]['limit']);_0x153ea6[_0xd234('0x13')]=qs[_0xd234('0x13')](_0x56d013[_0xd234('0x27')]['offset']);}_0x153ea6['order']=qs[_0xd234('0x41')](_0x56d013['query'][_0xd234('0x41')]);_0x153ea6[_0xd234('0x42')]=qs['filters'](_['pick'](_0x56d013[_0xd234('0x27')],_0x1e6723[_0xd234('0x3e')]));_0x153ea6[_0xd234('0x42')][_0xd234('0x43')]=_0x3bebc9['id'];if(_0x56d013['query'][_0xd234('0x44')]){_0x153ea6['where']=_[_0xd234('0x33')](_0x153ea6[_0xd234('0x42')],{'$or':_[_0xd234('0x45')](_0x153ea6[_0xd234('0x30')],function(_0x533358){var _0x21431d={};_0x21431d[_0x533358]={'$like':'%'+_0x56d013[_0xd234('0x27')][_0xd234('0x44')]+'%'};return _0x21431d;})});}if(_0x56d013[_0xd234('0x27')][_0xd234('0x46')]){var _0x494451=_0x56d013[_0xd234('0x27')]['$gte'][_0xd234('0x47')](',');var _0x466cac={};_0x466cac[_0x494451[0x0]]={'$gte':moment(_0x494451[0x1])[_0xd234('0x48')](_0xd234('0x49'))};_0x153ea6['where']=_[_0xd234('0x33')](_0x153ea6[_0xd234('0x42')],_0x466cac);}_0x153ea6=_[_0xd234('0x33')]({},_0x153ea6,_0x56d013[_0xd234('0x4a')]);return db['SmsMessage'][_0xd234('0x16')]({'where':_0x153ea6[_0xd234('0x42')]})[_0xd234('0x1a')](function(_0x100a9b){_0x46bf06['count']=_0x100a9b;if(_0x56d013[_0xd234('0x27')][_0xd234('0x32')]){_0x153ea6[_0xd234('0x4b')]=[{'all':!![]}];}return db[_0xd234('0x3a')][_0xd234('0x26')](_0x153ea6);})[_0xd234('0x1a')](function(_0x48ca77){_0x46bf06['rows']=_0x48ca77;return _0x46bf06;});}})[_0xd234('0x1a')](respondWithFilteredResult(_0x2f230e,_0x153ea6))[_0xd234('0x29')](handleError(_0x2f230e,null));};exports[_0xd234('0x4c')]=function(_0x40d5da,_0x27410a){return db[_0xd234('0x21')][_0xd234('0x34')]({'where':{'id':_0x40d5da['params']['id']}})[_0xd234('0x1a')](handleEntityNotFound(_0x27410a,null))['then'](function(_0x537275){if(_0x537275){return _0x537275[_0xd234('0x4d')](_0x40d5da[_0xd234('0x36')][_0xd234('0x3b')],_[_0xd234('0x3c')](_0x40d5da[_0xd234('0x36')],[_0xd234('0x3b'),'id'])||{})[_0xd234('0x4e')](function(){return db[_0xd234('0x4f')][_0xd234('0x26')]({'attributes':['id','name',_0xd234('0x50')],'where':{'id':_0x40d5da[_0xd234('0x36')][_0xd234('0x3b')]}});})[_0xd234('0x1a')](function(_0x41ba6e){socket[_0xd234('0x51')](_0xd234('0x52'),{'id':Number(_0x40d5da[_0xd234('0x2b')]['id']),'tags':_0x41ba6e||[]});return{'id':Number(_0x40d5da['params']['id']),'tags':_0x41ba6e||[]};});}})[_0xd234('0x1a')](respondWithResult(_0x27410a,null))[_0xd234('0x29')](handleError(_0x27410a,null));};exports[_0xd234('0x53')]=function(_0x226199,_0x3a9bd8){return db[_0xd234('0x21')][_0xd234('0x34')]({'where':{'id':_0x226199[_0xd234('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3a9bd8,null))[_0xd234('0x1a')](function(_0x199f80){if(_0x199f80){return _0x199f80[_0xd234('0x53')](_0x226199['query'][_0xd234('0x3b')]);}})[_0xd234('0x1a')](respondWithStatusCode(_0x3a9bd8,null))['catch'](handleError(_0x3a9bd8,null));};exports['download']=function(_0x4ad837,_0x239eb8){var _0x51388d=moment()[_0xd234('0x54')]()[_0xd234('0x55')]();var _0x33d6e3=path[_0xd234('0x56')](config['root'],'server',_0xd234('0x57'),_0xd234('0x58'));var _0x391b36=path[_0xd234('0x56')](_0x33d6e3,_0x51388d);var _0x38a835=util[_0xd234('0x48')](_0xd234('0x59'),_0x4ad837['params']['id'],_0x51388d);var _0x5b02ea=path[_0xd234('0x56')](_0x33d6e3,_0x38a835);var _0x51e35a=[];_0x51e35a['push']({'model':db[_0xd234('0x5a')],'as':_0xd234('0x5a'),'attributes':['id',_0xd234('0x5b')],'raw':!![]});_0x51e35a[_0xd234('0x5c')]({'model':db[_0xd234('0x5d')],'as':_0xd234('0x5e'),'attributes':['id','firstName',_0xd234('0x5f')],'raw':!![]});var _0x3cb664=[{'model':db['SmsMessage'],'as':_0xd234('0x60'),'attributes':['id','body',_0xd234('0x61'),_0xd234('0x62'),_0xd234('0x63'),'read'],'include':_0x51e35a}];_0x3cb664['push']({'model':db[_0xd234('0x64')],'as':'Account','attributes':['id',_0xd234('0x1e')]});_0x3cb664[_0xd234('0x5c')]({'model':db[_0xd234('0x5a')],'as':_0xd234('0x65'),'attributes':['id',_0xd234('0x5b')]});return db[_0xd234('0x21')][_0xd234('0x34')]({'where':{'id':_0x4ad837[_0xd234('0x2b')]['id']},'include':_0x3cb664})['then'](handleEntityNotFound(_0x239eb8,null))['then'](function(_0x2f0ceb){if(_0x2f0ceb){var _0x55794b=_0x2f0ceb[_0xd234('0x66')]({'plain':!![]});fs[_0xd234('0x67')](_0x391b36);var _0x4093ea={'channel':_0xd234('0x68'),'account':_0x55794b['Account'][_0xd234('0x1e')],'agent':_0x55794b[_0xd234('0x65')]?_0x55794b['Owner'][_0xd234('0x5b')]:'N.A.','createdAt':moment(_0x55794b[_0xd234('0x61')])[_0xd234('0x48')](_0xd234('0x49'))[_0xd234('0x55')](),'closedAt':_0x55794b[_0xd234('0x69')]?moment(_0x55794b[_0xd234('0x6a')])[_0xd234('0x48')](_0xd234('0x49'))['toString']():'','disposition':_0x55794b['disposition'],'messages':_(_0x55794b[_0xd234('0x60')])[_0xd234('0x44')]({'secret':![]})['map'](function(_0x577bcf){return{'date':moment(_0x577bcf[_0xd234('0x61')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x577bcf[_0xd234('0x62')]===_0xd234('0x6b')?_0x577bcf['User']?_0x577bcf[_0xd234('0x5a')][_0xd234('0x5b')]:_0xd234('0x6c'):_0x577bcf[_0xd234('0x5e')][_0xd234('0x6d')]+(_0x577bcf[_0xd234('0x5e')][_0xd234('0x5f')]?'\x20'+_0x577bcf['Contact']['lastName']:''),'body':_0x577bcf[_0xd234('0x36')],'direction':_0x577bcf[_0xd234('0x62')]==='out'?'A':'C','secret':_0x577bcf[_0xd234('0x63')],'read':_0x577bcf[_0xd234('0x6e')]};})[_0xd234('0x6f')]()};return ejs[_0xd234('0x70')](path[_0xd234('0x56')](config[_0xd234('0x71')],'server',_0xd234('0x72'),_0xd234('0x73')),{'interaction':_0x4093ea})[_0xd234('0x1a')](function(_0x5dfcd4){var _0x115a1d=path[_0xd234('0x56')](_0x391b36,'transcript-'+_0x55794b['id']+'-'+_0x51388d+'.pdf');var _0x2b99b4={'path':_0x115a1d,'channel':_0xd234('0x68'),'interactionId':_0x55794b['id']};return pdf[_0xd234('0x74')](_0x5dfcd4,_0x2b99b4);})[_0xd234('0x1a')](function(){return new BPromise(function(_0x19fa7b,_0x38f0de){zipdir(_0x391b36,{'saveTo':_0x5b02ea},function(_0x377b82,_0x5f12a4){if(_0x377b82)return _0x38f0de(_0x377b82);return _0x19fa7b(_0x5f12a4);});})[_0xd234('0x1a')](function(){return new BPromise(function(_0x1eb017,_0x243621){rimraf(_0x391b36,function(_0x3e58f0){if(_0x3e58f0)_0x243621(_0x3e58f0);return _0x1eb017();});});})[_0xd234('0x1a')](function(){return _0x239eb8['download'](_0x5b02ea,_0x38a835,function(_0x579e55){if(_0x579e55){console[_0xd234('0x75')](_0xd234('0x76'),_0x579e55);}else{fs[_0xd234('0x77')](_0x5b02ea);}});});});}else{return _0x239eb8[_0xd234('0x1c')](0xc8);}})[_0xd234('0x29')](handleError(_0x239eb8,null));}; \ No newline at end of file +var _0x24dd=['direction','read','Account','Owner','get','mkdirSync','Sms','N.A.','closed','closedAt','disposition','Messages','out','System','Contact','secret','value','renderFile','downloadInteraction.ejs','.pdf','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','index','map','SmsInteraction','type','sms','catch','show','keys','rawAttributes','query','filters','intersection','attributes','fields','length','model','includeAll','options','find','create','body','params','describe','addMessage','SmsMessage','ids','omit','findOne','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','addTags','setTags','spread','Tag','color','emit','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','createdAt'];(function(_0x4b2680,_0x1c92ad){var _0x40f43f=function(_0x2d7cb2){while(--_0x2d7cb2){_0x4b2680['push'](_0x4b2680['shift']());}};_0x40f43f(++_0x1c92ad);}(_0x24dd,0x109));var _0xd24d=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x24dd[_0x247fa1];return _0x244f35;};'use strict';var rimraf=require(_0xd24d('0x0'));var zipdir=require(_0xd24d('0x1'));var moment=require(_0xd24d('0x2'));var BPromise=require(_0xd24d('0x3'));var util=require(_0xd24d('0x4'));var path=require(_0xd24d('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xd24d('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xd24d('0x7'));var pdf=require(_0xd24d('0x8'));var logger=require(_0xd24d('0x9'))(_0xd24d('0xa'));var config=require(_0xd24d('0xb'));var db=require(_0xd24d('0xc'))['db'];config[_0xd24d('0xd')]=_[_0xd24d('0xe')](config[_0xd24d('0xd')],{'host':_0xd24d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd24d('0xd')]));require(_0xd24d('0x10'))[_0xd24d('0x11')](socket);function respondWithStatusCode(_0x14e0b8,_0x1b7949){_0x1b7949=_0x1b7949||0xcc;return function(_0x3b0f87){if(_0x3b0f87){return _0x14e0b8[_0xd24d('0x12')](_0x1b7949);}return _0x14e0b8[_0xd24d('0x13')](_0x1b7949)['end']();};}function respondWithResult(_0x46254e,_0x1c545f){_0x1c545f=_0x1c545f||0xc8;return function(_0x3de3e1){if(_0x3de3e1){return _0x46254e[_0xd24d('0x13')](_0x1c545f)[_0xd24d('0x14')](_0x3de3e1);}};}function respondWithFilteredResult(_0x12c4e5,_0x154a96){return function(_0x1cf55f){if(_0x1cf55f){var _0x4a6595=typeof _0x154a96[_0xd24d('0x15')]===_0xd24d('0x16')&&typeof _0x154a96[_0xd24d('0x17')]===_0xd24d('0x16');var _0x12891d=_0x1cf55f['count'];var _0x2a94bf=_0x4a6595?0x0:_0x154a96[_0xd24d('0x15')];var _0x50229c=_0x4a6595?_0x1cf55f[_0xd24d('0x18')]:_0x154a96[_0xd24d('0x15')]+_0x154a96[_0xd24d('0x17')];var _0x3c0b86;if(_0x50229c>=_0x12891d){_0x50229c=_0x12891d;_0x3c0b86=0xc8;}else{_0x3c0b86=0xce;}_0x12c4e5[_0xd24d('0x13')](_0x3c0b86);return _0x12c4e5[_0xd24d('0x19')](_0xd24d('0x1a'),_0x2a94bf+'-'+_0x50229c+'/'+_0x12891d)[_0xd24d('0x14')](_0x1cf55f);}return null;};}function saveUpdates(_0xd6b38){return function(_0x3b90f4){if(_0x3b90f4){return _0x3b90f4[_0xd24d('0x1b')](_0xd6b38)['then'](function(_0x5e668a){return _0x5e668a;});}return null;};}function removeEntity(_0x18acea){return function(_0x3db89d){if(_0x3db89d){return _0x3db89d[_0xd24d('0x1c')]()[_0xd24d('0x1d')](function(){_0x18acea[_0xd24d('0x13')](0xcc)[_0xd24d('0x1e')]();});}};}function handleEntityNotFound(_0x7c2000){return function(_0x58c968){if(!_0x58c968){_0x7c2000[_0xd24d('0x12')](0x194);}return _0x58c968;};}function handleError(_0x201140,_0x345f6b){_0x345f6b=_0x345f6b||0x1f4;return function(_0xd1b706){logger[_0xd24d('0x1f')](_0xd1b706[_0xd24d('0x20')]);if(_0xd1b706[_0xd24d('0x21')]){delete _0xd1b706['name'];}_0x201140[_0xd24d('0x13')](_0x345f6b)[_0xd24d('0x22')](_0xd1b706);};}exports[_0xd24d('0x23')]=function(_0x2fa2b4,_0x54e13d){var _0x3cfd1d={};var _0x596fe4=_[_0xd24d('0x24')](db[_0xd24d('0x25')]['rawAttributes'],function(_0x2aff0b){return{'name':_0x2aff0b['fieldName'],'type':_0x2aff0b[_0xd24d('0x26')]['key']};});_0x3cfd1d=qs['getOptions'](_0x596fe4,_0x2fa2b4);return interaction['findAll'](_0xd24d('0x27'),_0x2fa2b4['query'],_0x2fa2b4['user'],_0x3cfd1d,_0x596fe4)['then'](respondWithFilteredResult(_0x54e13d,_0x3cfd1d))[_0xd24d('0x28')](handleError(_0x54e13d,null));};exports[_0xd24d('0x29')]=function(_0x5b8fe3,_0x19a253){var _0x413369={'raw':![],'where':{'id':_0x5b8fe3['params']['id']}},_0x51c638={};_0x51c638['model']=_[_0xd24d('0x2a')](db['SmsInteraction'][_0xd24d('0x2b')]);_0x51c638[_0xd24d('0x2c')]=_['keys'](_0x5b8fe3[_0xd24d('0x2c')]);_0x51c638[_0xd24d('0x2d')]=_[_0xd24d('0x2e')](_0x51c638['model'],_0x51c638[_0xd24d('0x2c')]);_0x413369[_0xd24d('0x2f')]=_[_0xd24d('0x2e')](_0x51c638['model'],qs[_0xd24d('0x30')](_0x5b8fe3[_0xd24d('0x2c')][_0xd24d('0x30')]));_0x413369[_0xd24d('0x2f')]=_0x413369[_0xd24d('0x2f')][_0xd24d('0x31')]?_0x413369[_0xd24d('0x2f')]:_0x51c638[_0xd24d('0x32')];if(_0x5b8fe3[_0xd24d('0x2c')][_0xd24d('0x33')]){_0x413369['include']=[{'all':!![]}];}_0x413369=_['merge']({},_0x413369,_0x5b8fe3[_0xd24d('0x34')]);return db['SmsInteraction'][_0xd24d('0x35')](_0x413369)[_0xd24d('0x1d')](handleEntityNotFound(_0x19a253,null))[_0xd24d('0x1d')](respondWithResult(_0x19a253,null))['catch'](handleError(_0x19a253,null));};exports['create']=function(_0x202695,_0x364d50){return db[_0xd24d('0x25')][_0xd24d('0x36')](_0x202695[_0xd24d('0x37')],{})[_0xd24d('0x1d')](respondWithResult(_0x364d50,0xc9))[_0xd24d('0x28')](handleError(_0x364d50,null));};exports['update']=function(_0x146fb9,_0x297335){if(_0x146fb9[_0xd24d('0x37')]['id']){delete _0x146fb9['body']['id'];}return db[_0xd24d('0x25')]['find']({'where':{'id':_0x146fb9[_0xd24d('0x38')]['id']}})['then'](handleEntityNotFound(_0x297335,null))[_0xd24d('0x1d')](saveUpdates(_0x146fb9[_0xd24d('0x37')],null))['then'](respondWithResult(_0x297335,null))[_0xd24d('0x28')](handleError(_0x297335,null));};exports[_0xd24d('0x1c')]=function(_0x45cbc5,_0x47c323){return db[_0xd24d('0x25')][_0xd24d('0x35')]({'where':{'id':_0x45cbc5['params']['id']}})['then'](handleEntityNotFound(_0x47c323,null))[_0xd24d('0x1d')](removeEntity(_0x47c323,null))['catch'](handleError(_0x47c323,null));};exports[_0xd24d('0x39')]=function(_0x1e0326,_0xcacdcb){return db['SmsInteraction'][_0xd24d('0x39')]()[_0xd24d('0x1d')](respondWithResult(_0xcacdcb,null))['catch'](handleError(_0xcacdcb,null));};exports[_0xd24d('0x3a')]=function(_0x2653bc,_0x194ba8){return db[_0xd24d('0x3b')][_0xd24d('0x35')]({'where':{'id':_0x2653bc[_0xd24d('0x38')]['id']}})[_0xd24d('0x1d')](handleEntityNotFound(_0x194ba8,null))['then'](function(_0x13495d){if(_0x13495d){return _0x13495d[_0xd24d('0x3a')](_0x2653bc['body'][_0xd24d('0x3c')],_[_0xd24d('0x3d')](_0x2653bc['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x194ba8,null))[_0xd24d('0x28')](handleError(_0x194ba8,null));};exports['getMessages']=function(_0x4cda9c,_0x4394bd){var _0x1f8970={'raw':![],'where':{}};var _0x5ae4dd={};var _0x57f62b={'count':0x0,'rows':[]};return db[_0xd24d('0x25')][_0xd24d('0x3e')]({'where':{'id':_0x4cda9c[_0xd24d('0x38')]['id']}})[_0xd24d('0x1d')](handleEntityNotFound(_0x4394bd,null))[_0xd24d('0x1d')](function(_0x5626f5){if(_0x5626f5){_0x5ae4dd[_0xd24d('0x32')]=_[_0xd24d('0x2a')](db['SmsMessage'][_0xd24d('0x2b')]);_0x5ae4dd[_0xd24d('0x2c')]=_['keys'](_0x4cda9c[_0xd24d('0x2c')]);_0x5ae4dd[_0xd24d('0x2d')]=_[_0xd24d('0x2e')](_0x5ae4dd[_0xd24d('0x32')],_0x5ae4dd[_0xd24d('0x2c')]);_0x1f8970[_0xd24d('0x2f')]=_[_0xd24d('0x2e')](_0x5ae4dd[_0xd24d('0x32')],qs[_0xd24d('0x30')](_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x30')]));_0x1f8970[_0xd24d('0x2f')]=_0x1f8970['attributes'][_0xd24d('0x31')]?_0x1f8970[_0xd24d('0x2f')]:_0x5ae4dd[_0xd24d('0x32')];if(!_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x3f')](_0xd24d('0x40'))){_0x1f8970[_0xd24d('0x17')]=qs[_0xd24d('0x17')](_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x17')]);_0x1f8970[_0xd24d('0x15')]=qs[_0xd24d('0x15')](_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x15')]);}_0x1f8970['order']=qs[_0xd24d('0x41')](_0x4cda9c['query']['sort']);_0x1f8970[_0xd24d('0x42')]=qs[_0xd24d('0x2d')](_['pick'](_0x4cda9c[_0xd24d('0x2c')],_0x5ae4dd[_0xd24d('0x2d')]));_0x1f8970[_0xd24d('0x42')][_0xd24d('0x43')]=_0x5626f5['id'];if(_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x44')]){_0x1f8970[_0xd24d('0x42')]=_[_0xd24d('0x45')](_0x1f8970[_0xd24d('0x42')],{'$or':_[_0xd24d('0x24')](_0x1f8970[_0xd24d('0x2f')],function(_0x5d5a43){var _0x3f62ab={};_0x3f62ab[_0x5d5a43]={'$like':'%'+_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x44')]+'%'};return _0x3f62ab;})});}if(_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x46')]){var _0x314f58=_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x46')][_0xd24d('0x47')](',');var _0x5f3c3c={};_0x5f3c3c[_0x314f58[0x0]]={'$gte':moment(_0x314f58[0x1])[_0xd24d('0x48')](_0xd24d('0x49'))};_0x1f8970[_0xd24d('0x42')]=_[_0xd24d('0x45')](_0x1f8970[_0xd24d('0x42')],_0x5f3c3c);}_0x1f8970=_[_0xd24d('0x45')]({},_0x1f8970,_0x4cda9c[_0xd24d('0x34')]);return db[_0xd24d('0x3b')][_0xd24d('0x18')]({'where':_0x1f8970[_0xd24d('0x42')]})['then'](function(_0x105077){_0x57f62b[_0xd24d('0x18')]=_0x105077;if(_0x4cda9c[_0xd24d('0x2c')][_0xd24d('0x33')]){_0x1f8970[_0xd24d('0x4a')]=[{'all':!![]}];}return db['SmsMessage'][_0xd24d('0x4b')](_0x1f8970);})['then'](function(_0x44a6ce){_0x57f62b['rows']=_0x44a6ce;return _0x57f62b;});}})[_0xd24d('0x1d')](respondWithFilteredResult(_0x4394bd,_0x1f8970))['catch'](handleError(_0x4394bd,null));};exports[_0xd24d('0x4c')]=function(_0x138e3a,_0x3be9a5){return db[_0xd24d('0x25')]['find']({'where':{'id':_0x138e3a[_0xd24d('0x38')]['id']}})[_0xd24d('0x1d')](handleEntityNotFound(_0x3be9a5,null))['then'](function(_0x548cfb){if(_0x548cfb){return _0x548cfb[_0xd24d('0x4d')](_0x138e3a[_0xd24d('0x37')]['ids'],_[_0xd24d('0x3d')](_0x138e3a[_0xd24d('0x37')],[_0xd24d('0x3c'),'id'])||{})[_0xd24d('0x4e')](function(){return db[_0xd24d('0x4f')][_0xd24d('0x4b')]({'attributes':['id',_0xd24d('0x21'),_0xd24d('0x50')],'where':{'id':_0x138e3a[_0xd24d('0x37')]['ids']}});})[_0xd24d('0x1d')](function(_0x953ea1){socket[_0xd24d('0x51')]('smsInteractionTags:save',{'id':Number(_0x138e3a[_0xd24d('0x38')]['id']),'tags':_0x953ea1||[]});return{'id':Number(_0x138e3a[_0xd24d('0x38')]['id']),'tags':_0x953ea1||[]};});}})[_0xd24d('0x1d')](respondWithResult(_0x3be9a5,null))[_0xd24d('0x28')](handleError(_0x3be9a5,null));};exports[_0xd24d('0x52')]=function(_0x3278bf,_0xf23df1){return db[_0xd24d('0x25')][_0xd24d('0x35')]({'where':{'id':_0x3278bf['params']['id']}})[_0xd24d('0x1d')](handleEntityNotFound(_0xf23df1,null))['then'](function(_0x1c4a1b){if(_0x1c4a1b){return _0x1c4a1b['removeTags'](_0x3278bf[_0xd24d('0x2c')]['ids']);}})[_0xd24d('0x1d')](respondWithStatusCode(_0xf23df1,null))[_0xd24d('0x28')](handleError(_0xf23df1,null));};exports[_0xd24d('0x53')]=function(_0x2c510f,_0x362158){var _0x3f4bdd=moment()['unix']()[_0xd24d('0x54')]();var _0xfff876=path[_0xd24d('0x55')](config[_0xd24d('0x56')],_0xd24d('0x57'),_0xd24d('0x58'),_0xd24d('0x59'));var _0x19359e=path[_0xd24d('0x55')](_0xfff876,_0x3f4bdd);var _0x58f281=util[_0xd24d('0x48')](_0xd24d('0x5a'),_0x2c510f[_0xd24d('0x38')]['id'],_0x3f4bdd);var _0x4d1643=path[_0xd24d('0x55')](_0xfff876,_0x58f281);var _0x5c7fd8=[];_0x5c7fd8[_0xd24d('0x5b')]({'model':db[_0xd24d('0x5c')],'as':_0xd24d('0x5c'),'attributes':['id',_0xd24d('0x5d')],'raw':!![]});_0x5c7fd8[_0xd24d('0x5b')]({'model':db[_0xd24d('0x5e')],'as':'Contact','attributes':['id',_0xd24d('0x5f'),_0xd24d('0x60')],'raw':!![]});var _0x3ab32a=[{'model':db[_0xd24d('0x3b')],'as':'Messages','attributes':['id','body',_0xd24d('0x61'),_0xd24d('0x62'),'secret',_0xd24d('0x63')],'include':_0x5c7fd8}];_0x3ab32a[_0xd24d('0x5b')]({'model':db['SmsAccount'],'as':_0xd24d('0x64'),'attributes':['id','name']});_0x3ab32a[_0xd24d('0x5b')]({'model':db[_0xd24d('0x5c')],'as':_0xd24d('0x65'),'attributes':['id',_0xd24d('0x5d')]});return db['SmsInteraction'][_0xd24d('0x35')]({'where':{'id':_0x2c510f['params']['id']},'include':_0x3ab32a})[_0xd24d('0x1d')](handleEntityNotFound(_0x362158,null))[_0xd24d('0x1d')](function(_0x5a7486){if(_0x5a7486){var _0x19f9e=_0x5a7486[_0xd24d('0x66')]({'plain':!![]});fs[_0xd24d('0x67')](_0x19359e);var _0x2897c4={'channel':_0xd24d('0x68'),'account':_0x19f9e[_0xd24d('0x64')][_0xd24d('0x21')],'agent':_0x19f9e[_0xd24d('0x65')]?_0x19f9e['Owner'][_0xd24d('0x5d')]:_0xd24d('0x69'),'createdAt':moment(_0x19f9e['createdAt'])[_0xd24d('0x48')](_0xd24d('0x49'))['toString'](),'closedAt':_0x19f9e[_0xd24d('0x6a')]?moment(_0x19f9e[_0xd24d('0x6b')])[_0xd24d('0x48')](_0xd24d('0x49'))[_0xd24d('0x54')]():'','disposition':_0x19f9e[_0xd24d('0x6c')],'messages':_(_0x19f9e[_0xd24d('0x6d')])[_0xd24d('0x44')]({'secret':![]})['map'](function(_0x360ad7){return{'date':moment(_0x360ad7['createdAt'])['format'](_0xd24d('0x49'))[_0xd24d('0x54')](),'sender':_0x360ad7[_0xd24d('0x62')]===_0xd24d('0x6e')?_0x360ad7[_0xd24d('0x5c')]?_0x360ad7[_0xd24d('0x5c')][_0xd24d('0x5d')]:_0xd24d('0x6f'):_0x360ad7[_0xd24d('0x70')][_0xd24d('0x5f')]+(_0x360ad7[_0xd24d('0x70')]['lastName']?'\x20'+_0x360ad7[_0xd24d('0x70')]['lastName']:''),'body':_0x360ad7['body'],'direction':_0x360ad7[_0xd24d('0x62')]==='out'?'A':'C','secret':_0x360ad7[_0xd24d('0x71')],'read':_0x360ad7[_0xd24d('0x63')]};})[_0xd24d('0x72')]()};return ejs[_0xd24d('0x73')](path[_0xd24d('0x55')](config['root'],_0xd24d('0x57'),'views',_0xd24d('0x74')),{'interaction':_0x2897c4})[_0xd24d('0x1d')](function(_0x3295ef){var _0x762d41=path['join'](_0x19359e,'transcript-'+_0x19f9e['id']+'-'+_0x3f4bdd+_0xd24d('0x75'));var _0x5c2181={'path':_0x762d41,'channel':_0xd24d('0x68'),'interactionId':_0x19f9e['id']};return pdf['createPdfFromHTML'](_0x3295ef,_0x5c2181);})[_0xd24d('0x1d')](function(){return new BPromise(function(_0x599f0f,_0x5dfdea){zipdir(_0x19359e,{'saveTo':_0x4d1643},function(_0x4debff,_0x69cef8){if(_0x4debff)return _0x5dfdea(_0x4debff);return _0x599f0f(_0x69cef8);});})['then'](function(){return new BPromise(function(_0x4ebf4d,_0x2d83bd){rimraf(_0x19359e,function(_0x1b98f6){if(_0x1b98f6)_0x2d83bd(_0x1b98f6);return _0x4ebf4d();});});})[_0xd24d('0x1d')](function(){return _0x362158['download'](_0x4d1643,_0x58f281,function(_0x5ada4a){if(_0x5ada4a){console[_0xd24d('0x76')](_0xd24d('0x77'),_0x5ada4a);}else{fs[_0xd24d('0x78')](_0x4d1643);}});});});}else{return _0x362158[_0xd24d('0x12')](0xc8);}})[_0xd24d('0x28')](handleError(_0x362158,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 5f2d6a0..6dfa2e5 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 _0x32b6=['exports','events','../../mysqldb','SmsMessage','update','remove','getUsers','then','setDataValue','map','findAll','length','emit','catch','hasOwnProperty','hook'];(function(_0x546c82,_0x1f0998){var _0x598e2a=function(_0x517ce5){while(--_0x517ce5){_0x546c82['push'](_0x546c82['shift']());}};_0x598e2a(++_0x1f0998);}(_0x32b6,0x1d1));var _0x632b=function(_0x2b4575,_0x4fabae){_0x2b4575=_0x2b4575-0x0;var _0x9e295=_0x32b6[_0x2b4575];return _0x9e295;};'use strict';var EventEmitter=require(_0x632b('0x0'));var SmsInteraction=require(_0x632b('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x632b('0x1'))['db'][_0x632b('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x632b('0x3'),'afterDestroy':_0x632b('0x4')};function emitEvent(_0x3ba3a7){return function(_0x3a0e0e,_0x1adfe6,_0x122768){_0x3a0e0e[_0x632b('0x5')]({'attributes':['id'],'raw':!![]})[_0x632b('0x6')](function(_0x3bbf43){_0x3a0e0e[_0x632b('0x7')]('Users',_0x3bbf43[_0x632b('0x8')](function(_0x173270){return{'id':_0x173270['id']};}));return SmsMessage[_0x632b('0x9')]({'where':{'SmsInteractionId':_0x3a0e0e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x632b('0x6')](function(_0x4961b1){_0x3a0e0e['setDataValue']('unreadMessages',_0x4961b1[_0x632b('0xa')]);SmsInteractionEvents['emit'](_0x3ba3a7+':'+_0x3a0e0e['id'],_0x3a0e0e);SmsInteractionEvents[_0x632b('0xb')](_0x3ba3a7,_0x3a0e0e);_0x122768(null);})[_0x632b('0xc')](_0x122768(null));};}for(var e in events){if(events[_0x632b('0xd')](e)){var event=events[e];SmsInteraction[_0x632b('0xe')](e,emitEvent(event));}}module[_0x632b('0xf')]=SmsInteractionEvents; \ No newline at end of file +var _0x5f2f=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','length'];(function(_0x255dc4,_0x1697db){var _0x510d24=function(_0x36be19){while(--_0x36be19){_0x255dc4['push'](_0x255dc4['shift']());}};_0x510d24(++_0x1697db);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2058cc,_0x1e7f74){_0x2058cc=_0x2058cc-0x0;var _0x22dda1=_0x5f2f[_0x2058cc];return _0x22dda1;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var SmsInteraction=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var SmsMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf5f2('0x4')](0x0);var events={'afterCreate':_0xf5f2('0x5'),'afterUpdate':_0xf5f2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4854b6){return function(_0x1665c7,_0x192215,_0xad7f65){_0x1665c7[_0xf5f2('0x7')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x8')](function(_0x473100){_0x1665c7['setDataValue'](_0xf5f2('0x9'),_0x473100[_0xf5f2('0xa')](function(_0x2ec345){return{'id':_0x2ec345['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1665c7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5f2('0x8')](function(_0x15dd7c){_0x1665c7[_0xf5f2('0xb')]('unreadMessages',_0x15dd7c[_0xf5f2('0xc')]);SmsInteractionEvents['emit'](_0x4854b6+':'+_0x1665c7['id'],_0x1665c7);SmsInteractionEvents['emit'](_0x4854b6,_0x1665c7);_0xad7f65(null);})[_0xf5f2('0xd')](_0xad7f65(null));};}for(var e in events){if(events[_0xf5f2('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xf5f2('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 312f970..6db8441 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 _0x4b63=['moment','bluebird','request-promise','path','../../config/environment','./smsInteraction.attributes','define','SmsInteraction','sms_interactions','changed','closed','closedAt','lodash','../../config/logger','api'];(function(_0x5582d7,_0x306e66){var _0x29ebc1=function(_0x346b72){while(--_0x346b72){_0x5582d7['push'](_0x5582d7['shift']());}};_0x29ebc1(++_0x306e66);}(_0x4b63,0x129));var _0x34b6=function(_0x1ddc6a,_0x3d7047){_0x1ddc6a=_0x1ddc6a-0x0;var _0x5930e7=_0x4b63[_0x1ddc6a];return _0x5930e7;};'use strict';var _=require(_0x34b6('0x0'));var util=require('util');var logger=require(_0x34b6('0x1'))(_0x34b6('0x2'));var moment=require(_0x34b6('0x3'));var BPromise=require(_0x34b6('0x4'));var rp=require(_0x34b6('0x5'));var fs=require('fs');var path=require(_0x34b6('0x6'));var rimraf=require('rimraf');var config=require(_0x34b6('0x7'));var attributes=require(_0x34b6('0x8'));module['exports']=function(_0x227f14,_0x4932a6){return _0x227f14[_0x34b6('0x9')](_0x34b6('0xa'),attributes,{'tableName':_0x34b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x134090,_0x2c2ba5,_0x211e95){if(_0x134090[_0x34b6('0xc')](_0x34b6('0xd'))){_0x134090[_0x34b6('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x211e95(null,_0x134090);}}});}; \ No newline at end of file +var _0x5e67=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','path','./smsInteraction.attributes','define','sms_interactions','changed'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5e67,0x1be));var _0x75e6=function(_0x3f8c96,_0x4d4b52){_0x3f8c96=_0x3f8c96-0x0;var _0x18bfa4=_0x5e67[_0x3f8c96];return _0x18bfa4;};'use strict';var _=require(_0x75e6('0x0'));var util=require(_0x75e6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75e6('0x2'));var BPromise=require(_0x75e6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x75e6('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x75e6('0x5'));module['exports']=function(_0x5d18be,_0x546e5c){return _0x5d18be[_0x75e6('0x6')]('SmsInteraction',attributes,{'tableName':_0x75e6('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5df17e,_0x3c0dde,_0x3b4a06){if(_0x5df17e[_0x75e6('0x8')](_0x75e6('0x9'))){_0x5df17e[_0x75e6('0xa')]=moment()[_0x75e6('0xb')](_0x75e6('0xc'));}_0x3b4a06(null,_0x5df17e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index ce03cbf..a371a3e 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 _0xbc83=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','then','info','find','addTags','ids','AddTags','lodash','util'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbc83,0x73));var _0x3bc8=function(_0x368edf,_0x132b95){_0x368edf=_0x368edf-0x0;var _0x11fc80=_0xbc83[_0x368edf];return _0x11fc80;};'use strict';var _=require(_0x3bc8('0x0'));var util=require(_0x3bc8('0x1'));var moment=require(_0x3bc8('0x2'));var BPromise=require('bluebird');var rs=require(_0x3bc8('0x3'));var fs=require('fs');var Redis=require(_0x3bc8('0x4'));var db=require(_0x3bc8('0x5'))['db'];var utils=require(_0x3bc8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3bc8('0x7'));var client=jayson[_0x3bc8('0x8')]['http']({'port':0x232a});config['redis']=_[_0x3bc8('0x9')](config[_0x3bc8('0xa')],{'host':_0x3bc8('0xb'),'port':0x18eb});var socket=require(_0x3bc8('0xc'))(new Redis(config[_0x3bc8('0xa')]));require(_0x3bc8('0xd'))['register'](socket);function respondWithRpcPromise(_0x25977d,_0x36892f,_0x4d8c50){return new BPromise(function(_0x2273c4,_0x50ab46){return client[_0x3bc8('0xe')](_0x25977d,_0x4d8c50)['then'](function(_0x37597f){logger['info'](_0x3bc8('0xf'),_0x36892f,_0x3bc8('0x10'));logger[_0x3bc8('0x11')](_0x3bc8('0x12'),_0x36892f,_0x3bc8('0x10'),JSON[_0x3bc8('0x13')](_0x37597f));if(_0x37597f[_0x3bc8('0x14')]){if(_0x37597f[_0x3bc8('0x14')]['code']===0x1f4){logger[_0x3bc8('0x14')](_0x3bc8('0xf'),_0x36892f,_0x37597f[_0x3bc8('0x14')][_0x3bc8('0x15')]);return _0x50ab46(_0x37597f['error']['message']);}logger[_0x3bc8('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x36892f,_0x37597f[_0x3bc8('0x14')][_0x3bc8('0x15')]);return _0x2273c4(_0x37597f['error'][_0x3bc8('0x15')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x36892f,'request\x20sent');_0x2273c4(_0x37597f[_0x3bc8('0x16')]['message']);}})[_0x3bc8('0x17')](function(_0x190427){logger[_0x3bc8('0x14')](_0x3bc8('0xf'),_0x36892f,_0x190427);_0x50ab46(_0x190427);});});}exports[_0x3bc8('0x18')]=function(_0x13e1d1){var _0x4c6db1=this;return new Promise(function(_0x2d962a,_0x49785d){return db[_0x3bc8('0x19')][_0x3bc8('0x1a')](_0x13e1d1[_0x3bc8('0x1b')],{'raw':_0x13e1d1[_0x3bc8('0x1c')]?_0x13e1d1[_0x3bc8('0x1c')][_0x3bc8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13e1d1[_0x3bc8('0x1c')]?_0x13e1d1[_0x3bc8('0x1c')][_0x3bc8('0x1e')]||null:null,'attributes':_0x13e1d1['options']?_0x13e1d1[_0x3bc8('0x1c')][_0x3bc8('0x1f')]||null:null,'limit':_0x13e1d1['options']?_0x13e1d1[_0x3bc8('0x1c')][_0x3bc8('0x20')]||null:null})[_0x3bc8('0x21')](function(_0x24c3a3){logger[_0x3bc8('0x22')](_0x3bc8('0x18'),_0x13e1d1);logger[_0x3bc8('0x11')](_0x3bc8('0x18'),_0x13e1d1,JSON['stringify'](_0x24c3a3));_0x2d962a(_0x24c3a3);})[_0x3bc8('0x17')](function(_0x57da98){logger[_0x3bc8('0x14')](_0x3bc8('0x18'),_0x57da98[_0x3bc8('0x15')],_0x13e1d1);_0x49785d(_0x4c6db1[_0x3bc8('0x14')](0x1f4,_0x57da98['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x599954){return new Promise(function(_0x37dc0c,_0x313feb){return db[_0x3bc8('0x19')][_0x3bc8('0x23')]({'where':_0x599954['options']?_0x599954[_0x3bc8('0x1c')]['where']||null:null})[_0x3bc8('0x21')](function(_0x8fa861){if(_0x8fa861){return _0x8fa861[_0x3bc8('0x24')](_0x599954[_0x3bc8('0x1b')][_0x3bc8('0x25')],_['omit'](_0x599954[_0x3bc8('0x1b')],[_0x3bc8('0x25'),'id'])||{});}})['spread'](function(_0x266ec4){logger[_0x3bc8('0x22')](_0x3bc8('0x26'),_0x599954);logger[_0x3bc8('0x11')](_0x3bc8('0x26'),_0x599954,JSON[_0x3bc8('0x13')](_0x266ec4));_0x37dc0c(_0x266ec4);})[_0x3bc8('0x17')](function(_0xae73b0){logger['error']('AddTags',_0xae73b0[_0x3bc8('0x15')],_0x599954);_0x313feb(_this[_0x3bc8('0x14')](0x1f4,_0xae73b0[_0x3bc8('0x15')]));});});}; \ No newline at end of file +var _0x8ddd=['../../config/utils','rpc','../../config/environment','client','http','redis','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','body','options','raw','where','attributes','limit','debug','find','addTags','ids','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2e8ff3,_0x3164b6){var _0x1662b6=function(_0x49952e){while(--_0x49952e){_0x2e8ff3['push'](_0x2e8ff3['shift']());}};_0x1662b6(++_0x3164b6);}(_0x8ddd,0x19d));var _0xd8dd=function(_0x3081ab,_0xd644e8){_0x3081ab=_0x3081ab-0x0;var _0x2b590b=_0x8ddd[_0x3081ab];return _0x2b590b;};'use strict';var _=require(_0xd8dd('0x0'));var util=require('util');var moment=require(_0xd8dd('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8dd('0x2'));var fs=require('fs');var Redis=require(_0xd8dd('0x3'));var db=require(_0xd8dd('0x4'))['db'];var utils=require(_0xd8dd('0x5'));var logger=require('../../config/logger')(_0xd8dd('0x6'));var config=require(_0xd8dd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd8dd('0x8')][_0xd8dd('0x9')]({'port':0x232a});config[_0xd8dd('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8dd('0xa')]));require(_0xd8dd('0xb'))[_0xd8dd('0xc')](socket);function respondWithRpcPromise(_0x3fc5ed,_0x192ce8,_0x3d0fe4){return new BPromise(function(_0x1f4e6f,_0x2dd1be){return client[_0xd8dd('0xd')](_0x3fc5ed,_0x3d0fe4)[_0xd8dd('0xe')](function(_0x460bae){logger[_0xd8dd('0xf')](_0xd8dd('0x10'),_0x192ce8,_0xd8dd('0x11'));logger['debug'](_0xd8dd('0x12'),_0x192ce8,_0xd8dd('0x11'),JSON[_0xd8dd('0x13')](_0x460bae));if(_0x460bae[_0xd8dd('0x14')]){if(_0x460bae[_0xd8dd('0x14')][_0xd8dd('0x15')]===0x1f4){logger[_0xd8dd('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x192ce8,_0x460bae[_0xd8dd('0x14')][_0xd8dd('0x16')]);return _0x2dd1be(_0x460bae[_0xd8dd('0x14')]['message']);}logger['error']('SmsInteraction,\x20%s,\x20%s',_0x192ce8,_0x460bae[_0xd8dd('0x14')]['message']);return _0x1f4e6f(_0x460bae[_0xd8dd('0x14')]['message']);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x192ce8,_0xd8dd('0x11'));_0x1f4e6f(_0x460bae['result']['message']);}})[_0xd8dd('0x17')](function(_0x2d1f68){logger[_0xd8dd('0x14')](_0xd8dd('0x10'),_0x192ce8,_0x2d1f68);_0x2dd1be(_0x2d1f68);});});}exports[_0xd8dd('0x18')]=function(_0x2178b6){var _0x2bcdf5=this;return new Promise(function(_0x9bc898,_0x42a83a){return db['SmsInteraction']['update'](_0x2178b6[_0xd8dd('0x19')],{'raw':_0x2178b6[_0xd8dd('0x1a')]?_0x2178b6['options'][_0xd8dd('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2178b6[_0xd8dd('0x1a')]?_0x2178b6[_0xd8dd('0x1a')][_0xd8dd('0x1c')]||null:null,'attributes':_0x2178b6[_0xd8dd('0x1a')]?_0x2178b6[_0xd8dd('0x1a')][_0xd8dd('0x1d')]||null:null,'limit':_0x2178b6[_0xd8dd('0x1a')]?_0x2178b6[_0xd8dd('0x1a')][_0xd8dd('0x1e')]||null:null})[_0xd8dd('0xe')](function(_0x486250){logger['info'](_0xd8dd('0x18'),_0x2178b6);logger[_0xd8dd('0x1f')]('UpdateSmsInteraction',_0x2178b6,JSON['stringify'](_0x486250));_0x9bc898(_0x486250);})[_0xd8dd('0x17')](function(_0x27393b){logger['error'](_0xd8dd('0x18'),_0x27393b[_0xd8dd('0x16')],_0x2178b6);_0x42a83a(_0x2bcdf5['error'](0x1f4,_0x27393b['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x3e03e3){return new Promise(function(_0x32fbef,_0x45d4f1){return db['SmsInteraction'][_0xd8dd('0x20')]({'where':_0x3e03e3[_0xd8dd('0x1a')]?_0x3e03e3[_0xd8dd('0x1a')][_0xd8dd('0x1c')]||null:null})[_0xd8dd('0xe')](function(_0x2bd565){if(_0x2bd565){return _0x2bd565[_0xd8dd('0x21')](_0x3e03e3[_0xd8dd('0x19')][_0xd8dd('0x22')],_[_0xd8dd('0x23')](_0x3e03e3['body'],[_0xd8dd('0x22'),'id'])||{});}})[_0xd8dd('0x24')](function(_0x22d2dd){logger[_0xd8dd('0xf')](_0xd8dd('0x25'),_0x3e03e3);logger[_0xd8dd('0x1f')]('AddTags',_0x3e03e3,JSON[_0xd8dd('0x13')](_0x22d2dd));_0x32fbef(_0x22d2dd);})[_0xd8dd('0x17')](function(_0x1150a5){logger['error'](_0xd8dd('0x25'),_0x1150a5[_0xd8dd('0x16')],_0x3e03e3);_0x45d4f1(_this[_0xd8dd('0x14')](0x1f4,_0x1150a5[_0xd8dd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index a7704e1..c253e0a 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 _0xa41c=['removeListener','register','length','smsInteraction:','./smsInteraction.events','update'];(function(_0x2ee53d,_0x291cb2){var _0x45c550=function(_0x2b917c){while(--_0x2b917c){_0x2ee53d['push'](_0x2ee53d['shift']());}};_0x45c550(++_0x291cb2);}(_0xa41c,0x112));var _0xca41=function(_0x1191fa,_0x485c85){_0x1191fa=_0x1191fa-0x0;var _0x71a0cb=_0xa41c[_0x1191fa];return _0x71a0cb;};'use strict';var SmsInteractionEvents=require(_0xca41('0x0'));var events=['save','remove',_0xca41('0x1')];function createListener(_0x20b4ef,_0x389b9b){return function(_0x4364ac){_0x389b9b['emit'](_0x20b4ef,_0x4364ac);};}function removeListener(_0x3d3bcf,_0x4f4cd0){return function(){SmsInteractionEvents[_0xca41('0x2')](_0x3d3bcf,_0x4f4cd0);};}exports[_0xca41('0x3')]=function(_0x5c274c){for(var _0x2cf7ca=0x0,_0x547489=events[_0xca41('0x4')];_0x2cf7ca<_0x547489;_0x2cf7ca++){var _0x57824c=events[_0x2cf7ca];var _0xbe4caf=createListener(_0xca41('0x5')+_0x57824c,_0x5c274c);SmsInteractionEvents['on'](_0x57824c,_0xbe4caf);}}; \ No newline at end of file +var _0x3db7=['removeListener','register','length','smsInteraction:','./smsInteraction.events','save','remove','emit'];(function(_0x5d9be4,_0x5df4b6){var _0x44650b=function(_0x105191){while(--_0x105191){_0x5d9be4['push'](_0x5d9be4['shift']());}};_0x44650b(++_0x5df4b6);}(_0x3db7,0x1ec));var _0x73db=function(_0x32e416,_0x487ef1){_0x32e416=_0x32e416-0x0;var _0x1ad487=_0x3db7[_0x32e416];return _0x1ad487;};'use strict';var SmsInteractionEvents=require(_0x73db('0x0'));var events=[_0x73db('0x1'),_0x73db('0x2'),'update'];function createListener(_0x38fae3,_0x1ddbfe){return function(_0x4a68a6){_0x1ddbfe[_0x73db('0x3')](_0x38fae3,_0x4a68a6);};}function removeListener(_0x226651,_0x5053a4){return function(){SmsInteractionEvents[_0x73db('0x4')](_0x226651,_0x5053a4);};}exports[_0x73db('0x5')]=function(_0x3df0b5){for(var _0x345e01=0x0,_0x3e9f84=events[_0x73db('0x6')];_0x345e01<_0x3e9f84;_0x345e01++){var _0x35039c=events[_0x345e01];var _0x2da2e4=createListener(_0x73db('0x7')+_0x35039c,_0x3df0b5);SmsInteractionEvents['on'](_0x35039c,_0x2da2e4);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 6ff7bf3..d35a887 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 _0x2e18=['status','put','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','isAuthenticated','index','/describe','describe','get','/:id','show','post','tracked','smsmessage:create','create','/:id/status'];(function(_0x5e745e,_0xde2931){var _0x122dab=function(_0xe396a5){while(--_0xe396a5){_0x5e745e['push'](_0x5e745e['shift']());}};_0x122dab(++_0xde2931);}(_0x2e18,0x19c));var _0x82e1=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2e18[_0x199572];return _0x13cfa3;};'use strict';var multer=require(_0x82e1('0x0'));var util=require(_0x82e1('0x1'));var path=require(_0x82e1('0x2'));var timeout=require('connect-timeout');var express=require(_0x82e1('0x3'));var router=express[_0x82e1('0x4')]();var fs_extra=require(_0x82e1('0x5'));var auth=require(_0x82e1('0x6'));var interaction=require(_0x82e1('0x7'));var config=require(_0x82e1('0x8'));var controller=require(_0x82e1('0x9'));router['get']('/',auth[_0x82e1('0xa')](),controller[_0x82e1('0xb')]);router['get'](_0x82e1('0xc'),auth[_0x82e1('0xa')](),controller[_0x82e1('0xd')]);router[_0x82e1('0xe')](_0x82e1('0xf'),auth[_0x82e1('0xa')](),controller[_0x82e1('0x10')]);router[_0x82e1('0x11')]('/',auth[_0x82e1('0xa')](),interaction[_0x82e1('0x12')]('sms',_0x82e1('0x13')),controller[_0x82e1('0x14')]);router['post'](_0x82e1('0x15'),controller[_0x82e1('0x16')]);router[_0x82e1('0x17')](_0x82e1('0xf'),auth[_0x82e1('0xa')](),controller[_0x82e1('0x18')]);router['put'](_0x82e1('0x19'),auth['isAuthenticated'](),controller[_0x82e1('0x1a')]);router['put'](_0x82e1('0x1b'),auth[_0x82e1('0xa')](),controller[_0x82e1('0x1c')]);router[_0x82e1('0x1d')](_0x82e1('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x82e1('0x1e')]=router; \ No newline at end of file +var _0x30ad=['./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../config/environment'];(function(_0x33e2a0,_0x3b5a3b){var _0x42efc5=function(_0x6df3f7){while(--_0x6df3f7){_0x33e2a0['push'](_0x33e2a0['shift']());}};_0x42efc5(++_0x3b5a3b);}(_0x30ad,0x1ac));var _0xd30a=function(_0x2b8c66,_0x572e6e){_0x2b8c66=_0x2b8c66-0x0;var _0x30f3d4=_0x30ad[_0x2b8c66];return _0x30f3d4;};'use strict';var multer=require(_0xd30a('0x0'));var util=require(_0xd30a('0x1'));var path=require(_0xd30a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd30a('0x3'));var router=express[_0xd30a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd30a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd30a('0x6'));var controller=require(_0xd30a('0x7'));router[_0xd30a('0x8')]('/',auth[_0xd30a('0x9')](),controller[_0xd30a('0xa')]);router[_0xd30a('0x8')](_0xd30a('0xb'),auth[_0xd30a('0x9')](),controller[_0xd30a('0xc')]);router[_0xd30a('0x8')](_0xd30a('0xd'),auth[_0xd30a('0x9')](),controller[_0xd30a('0xe')]);router[_0xd30a('0xf')]('/',auth[_0xd30a('0x9')](),interaction[_0xd30a('0x10')]('sms',_0xd30a('0x11')),controller[_0xd30a('0x12')]);router[_0xd30a('0xf')](_0xd30a('0x13'),controller[_0xd30a('0x14')]);router[_0xd30a('0x15')](_0xd30a('0xd'),auth[_0xd30a('0x9')](),controller[_0xd30a('0x16')]);router[_0xd30a('0x15')](_0xd30a('0x17'),auth[_0xd30a('0x9')](),controller[_0xd30a('0x18')]);router['put'](_0xd30a('0x19'),auth[_0xd30a('0x9')](),controller['reject']);router[_0xd30a('0x1a')](_0xd30a('0xd'),auth[_0xd30a('0x9')](),controller[_0xd30a('0x1b')]);module[_0xd30a('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 140b5c2..5d7a55d 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 _0xf9d7=['exports','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x193927,_0x545c88){var _0x1d21b1=function(_0x55ab7d){while(--_0x55ab7d){_0x193927['push'](_0x193927['shift']());}};_0x1d21b1(++_0x545c88);}(_0xf9d7,0x12f));var _0x7f9d=function(_0x4544d3,_0x149a72){_0x4544d3=_0x4544d3-0x0;var _0x36aeca=_0xf9d7[_0x4544d3];return _0x36aeca;};'use strict';var Sequelize=require(_0x7f9d('0x0'));module[_0x7f9d('0x1')]={'body':{'type':Sequelize['TEXT'](_0x7f9d('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7f9d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7f9d('0x4')]('in','out'),'defaultValue':_0x7f9d('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x7f9d('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x7f9d('0x7')]},'secret':{'type':Sequelize[_0x7f9d('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7f9d('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xd307=['STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x63631a,_0x4d3976){var _0x2d66a0=function(_0x453179){while(--_0x453179){_0x63631a['push'](_0x63631a['shift']());}};_0x2d66a0(++_0x4d3976);}(_0xd307,0x110));var _0x7d30=function(_0x356421,_0x4cdcf5){_0x356421=_0x356421-0x0;var _0x12d1c5=_0xd307[_0x356421];return _0x12d1c5;};'use strict';var Sequelize=require(_0x7d30('0x0'));module[_0x7d30('0x1')]={'body':{'type':Sequelize[_0x7d30('0x2')](_0x7d30('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x7d30('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7d30('0x5')]('in',_0x7d30('0x6')),'defaultValue':_0x7d30('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x7d30('0x7')]},'readAt':{'type':Sequelize[_0x7d30('0x8')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x7d30('0x7')]},'providerResponse':{'type':Sequelize[_0x7d30('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 0983573..8bdfce1 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 _0xacc6=['[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','SmsInteraction','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','delivered','Status','plivio','groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','client','http','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','destroy','stack','name','map','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','SmsMessage','includeAll','include','findAll','rows','show','params','find','create','body','update','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId'];(function(_0x5cfe7b,_0x528015){var _0xfc7a25=function(_0x17aa71){while(--_0x17aa71){_0x5cfe7b['push'](_0x5cfe7b['shift']());}};_0xfc7a25(++_0x528015);}(_0xacc6,0x150));var _0x6acc=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0xacc6[_0x79b649];return _0x1af9b1;};'use strict';var emlformat=require(_0x6acc('0x0'));var rimraf=require(_0x6acc('0x1'));var zipdir=require(_0x6acc('0x2'));var jsonpatch=require(_0x6acc('0x3'));var rp=require(_0x6acc('0x4'));var moment=require('moment');var BPromise=require(_0x6acc('0x5'));var Mustache=require(_0x6acc('0x6'));var util=require(_0x6acc('0x7'));var path=require('path');var sox=require(_0x6acc('0x8'));var csv=require('to-csv');var ejs=require(_0x6acc('0x9'));var fs=require('fs');var fs_extra=require(_0x6acc('0xa'));var _=require('lodash');var squel=require(_0x6acc('0xb'));var crypto=require('crypto');var jsforce=require(_0x6acc('0xc'));var deskjs=require(_0x6acc('0xd'));var toCsv=require(_0x6acc('0xe'));var querystring=require(_0x6acc('0xf'));var Papa=require('papaparse');var Redis=require(_0x6acc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6acc('0x11'));var as=require(_0x6acc('0x12'));var hardwareService=require(_0x6acc('0x13'));var logger=require(_0x6acc('0x14'))(_0x6acc('0x15'));var utils=require(_0x6acc('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6acc('0x17'));var db=require(_0x6acc('0x18'))['db'];config[_0x6acc('0x19')]=_[_0x6acc('0x1a')](config[_0x6acc('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6acc('0x19')]));require(_0x6acc('0x1b'))[_0x6acc('0x1c')](socket);var jayson=require(_0x6acc('0x1d'));var client=jayson[_0x6acc('0x1e')][_0x6acc('0x1f')]({'port':0x232c});var client9002=jayson[_0x6acc('0x1e')][_0x6acc('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xf24527,_0xc07208,_0x1fe0ac,_0x14312b){return new BPromise(function(_0x31c4c2,_0x410afb){var _0x24f513=_0x14312b||client;return _0x24f513[_0x6acc('0x20')](_0xf24527,_0x1fe0ac)[_0x6acc('0x21')](function(_0x17e367){logger['info'](_0x6acc('0x22'),_0xc07208,_0x6acc('0x23'));logger[_0x6acc('0x24')](_0x6acc('0x25'),_0xc07208,'request\x20sent',JSON[_0x6acc('0x26')](_0x17e367));if(_0x17e367['error']){if(_0x17e367['error'][_0x6acc('0x27')]===0x1f4){logger['error'](_0x6acc('0x22'),_0xc07208,_0x17e367[_0x6acc('0x28')][_0x6acc('0x29')]);return _0x410afb(_0x17e367[_0x6acc('0x28')][_0x6acc('0x29')]);}logger['error'](_0x6acc('0x22'),_0xc07208,_0x17e367[_0x6acc('0x28')]['message']);return _0x31c4c2(_0x17e367[_0x6acc('0x28')]['message']);}else{logger[_0x6acc('0x2a')](_0x6acc('0x22'),_0xc07208,_0x6acc('0x23'));_0x31c4c2(_0x17e367[_0x6acc('0x2b')]['message']);}})[_0x6acc('0x2c')](function(_0xa4d97c){logger['error'](_0x6acc('0x22'),_0xc07208,_0xa4d97c);_0x410afb(_0xa4d97c);});});}function respondWithStatusCode(_0x1cec1e,_0x441f90){_0x441f90=_0x441f90||0xcc;return function(_0x125084){if(_0x125084){return _0x1cec1e[_0x6acc('0x2d')](_0x441f90);}return _0x1cec1e[_0x6acc('0x2e')](_0x441f90)[_0x6acc('0x2f')]();};}function respondWithResult(_0xa15e0f,_0x4d1c18){_0x4d1c18=_0x4d1c18||0xc8;return function(_0x89c205){if(_0x89c205){return _0xa15e0f[_0x6acc('0x2e')](_0x4d1c18)[_0x6acc('0x30')](_0x89c205);}};}function respondWithFilteredResult(_0x490ce6,_0x1bcfad){return function(_0x8e75a9){if(_0x8e75a9){var _0x3c8c95=typeof _0x1bcfad[_0x6acc('0x31')]===_0x6acc('0x32')&&typeof _0x1bcfad[_0x6acc('0x33')]==='undefined';var _0x4bd95a=_0x8e75a9['count'];var _0x5b6fab=_0x3c8c95?0x0:_0x1bcfad[_0x6acc('0x31')];var _0x23a581=_0x3c8c95?_0x8e75a9[_0x6acc('0x34')]:_0x1bcfad[_0x6acc('0x31')]+_0x1bcfad[_0x6acc('0x33')];var _0x2c6c4e;if(_0x23a581>=_0x4bd95a){_0x23a581=_0x4bd95a;_0x2c6c4e=0xc8;}else{_0x2c6c4e=0xce;}_0x490ce6['status'](_0x2c6c4e);return _0x490ce6['set'](_0x6acc('0x35'),_0x5b6fab+'-'+_0x23a581+'/'+_0x4bd95a)[_0x6acc('0x30')](_0x8e75a9);}return null;};}function patchUpdates(_0x34c75a){return function(_0x363cbe){try{jsonpatch['apply'](_0x363cbe,_0x34c75a,!![]);}catch(_0x2fa0c0){return BPromise[_0x6acc('0x36')](_0x2fa0c0);}return _0x363cbe['save']();};}function saveUpdates(_0x46e7f5,_0x3ce52f){return function(_0x33208e){if(_0x33208e){return _0x33208e['update'](_0x46e7f5)['then'](function(_0xa7bd17){return _0xa7bd17;});}return null;};}function removeEntity(_0x29dc9a,_0x594cc5){return function(_0x50eef5){if(_0x50eef5){return _0x50eef5[_0x6acc('0x37')]()[_0x6acc('0x21')](function(){_0x29dc9a[_0x6acc('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x210fe7,_0x1133f8){return function(_0x103da4){if(!_0x103da4){_0x210fe7[_0x6acc('0x2d')](0x194);}return _0x103da4;};}function handleError(_0x37544d,_0x4e52dd){_0x4e52dd=_0x4e52dd||0x1f4;return function(_0x113c7d){logger['error'](_0x113c7d[_0x6acc('0x38')]);if(_0x113c7d[_0x6acc('0x39')]){delete _0x113c7d['name'];}_0x37544d[_0x6acc('0x2e')](_0x4e52dd)['send'](_0x113c7d);};}exports['index']=function(_0x81e316,_0x2f28cc){var _0x11290e={},_0x5bf680={},_0x96474d={'count':0x0,'rows':[]};var _0x490897=_[_0x6acc('0x3a')](db['SmsMessage'][_0x6acc('0x3b')],function(_0x13f74a){return{'name':_0x13f74a['fieldName'],'type':_0x13f74a[_0x6acc('0x3c')][_0x6acc('0x3d')]};});_0x5bf680[_0x6acc('0x3e')]=_[_0x6acc('0x3a')](_0x490897,_0x6acc('0x39'));_0x5bf680[_0x6acc('0x3f')]=_[_0x6acc('0x40')](_0x81e316['query']);_0x5bf680['filters']=_[_0x6acc('0x41')](_0x5bf680[_0x6acc('0x3e')],_0x5bf680[_0x6acc('0x3f')]);_0x11290e['attributes']=_[_0x6acc('0x41')](_0x5bf680[_0x6acc('0x3e')],qs[_0x6acc('0x42')](_0x81e316[_0x6acc('0x3f')][_0x6acc('0x42')]));_0x11290e[_0x6acc('0x43')]=_0x11290e[_0x6acc('0x43')][_0x6acc('0x44')]?_0x11290e[_0x6acc('0x43')]:_0x5bf680[_0x6acc('0x3e')];if(!_0x81e316[_0x6acc('0x3f')][_0x6acc('0x45')]('nolimit')){_0x11290e['limit']=qs['limit'](_0x81e316[_0x6acc('0x3f')]['limit']);_0x11290e['offset']=qs[_0x6acc('0x31')](_0x81e316[_0x6acc('0x3f')][_0x6acc('0x31')]);}_0x11290e[_0x6acc('0x46')]=qs[_0x6acc('0x47')](_0x81e316[_0x6acc('0x3f')][_0x6acc('0x47')]);_0x11290e[_0x6acc('0x48')]=qs[_0x6acc('0x49')](_[_0x6acc('0x4a')](_0x81e316[_0x6acc('0x3f')],_0x5bf680[_0x6acc('0x49')]),_0x490897);if(_0x81e316[_0x6acc('0x3f')]['filter']){_0x11290e[_0x6acc('0x48')]=_[_0x6acc('0x4b')](_0x11290e['where'],{'$or':_[_0x6acc('0x3a')](_0x490897,function(_0x4e2504){if(_0x4e2504[_0x6acc('0x3c')]!==_0x6acc('0x4c')){var _0x52b118={};_0x52b118[_0x4e2504[_0x6acc('0x39')]]={'$like':'%'+_0x81e316[_0x6acc('0x3f')][_0x6acc('0x4d')]+'%'};return _0x52b118;}})});}_0x11290e=_[_0x6acc('0x4b')]({},_0x11290e,_0x81e316[_0x6acc('0x4e')]);var _0x495f8d={'where':_0x11290e[_0x6acc('0x48')]};return db[_0x6acc('0x4f')][_0x6acc('0x34')](_0x495f8d)[_0x6acc('0x21')](function(_0x3e05ae){_0x96474d[_0x6acc('0x34')]=_0x3e05ae;if(_0x81e316[_0x6acc('0x3f')][_0x6acc('0x50')]){_0x11290e[_0x6acc('0x51')]=[{'all':!![]}];}return db[_0x6acc('0x4f')][_0x6acc('0x52')](_0x11290e);})[_0x6acc('0x21')](function(_0x2b4d94){_0x96474d[_0x6acc('0x53')]=_0x2b4d94;return _0x96474d;})[_0x6acc('0x21')](respondWithFilteredResult(_0x2f28cc,_0x11290e))[_0x6acc('0x2c')](handleError(_0x2f28cc,null));};exports[_0x6acc('0x54')]=function(_0x594cc4,_0x5ab4af){var _0x5e1fe6={'raw':!![],'where':{'id':_0x594cc4[_0x6acc('0x55')]['id']}},_0x3c93f0={};_0x3c93f0['model']=_[_0x6acc('0x40')](db[_0x6acc('0x4f')][_0x6acc('0x3b')]);_0x3c93f0[_0x6acc('0x3f')]=_['keys'](_0x594cc4[_0x6acc('0x3f')]);_0x3c93f0[_0x6acc('0x49')]=_[_0x6acc('0x41')](_0x3c93f0[_0x6acc('0x3e')],_0x3c93f0[_0x6acc('0x3f')]);_0x5e1fe6['attributes']=_[_0x6acc('0x41')](_0x3c93f0[_0x6acc('0x3e')],qs[_0x6acc('0x42')](_0x594cc4['query'][_0x6acc('0x42')]));_0x5e1fe6[_0x6acc('0x43')]=_0x5e1fe6[_0x6acc('0x43')][_0x6acc('0x44')]?_0x5e1fe6['attributes']:_0x3c93f0[_0x6acc('0x3e')];if(_0x594cc4[_0x6acc('0x3f')]['includeAll']){_0x5e1fe6[_0x6acc('0x51')]=[{'all':!![]}];}_0x5e1fe6=_['merge']({},_0x5e1fe6,_0x594cc4['options']);return db[_0x6acc('0x4f')][_0x6acc('0x56')](_0x5e1fe6)[_0x6acc('0x21')](handleEntityNotFound(_0x5ab4af,null))[_0x6acc('0x21')](respondWithResult(_0x5ab4af,null))['catch'](handleError(_0x5ab4af,null));};exports[_0x6acc('0x57')]=function(_0x38be46,_0x5140c4){return db[_0x6acc('0x4f')][_0x6acc('0x57')](_0x38be46[_0x6acc('0x58')],{})[_0x6acc('0x21')](respondWithResult(_0x5140c4,0xc9))[_0x6acc('0x2c')](handleError(_0x5140c4,null));};exports[_0x6acc('0x59')]=function(_0x357232,_0x5818fa){if(_0x357232['body']['id']){delete _0x357232['body']['id'];}return db[_0x6acc('0x4f')][_0x6acc('0x56')]({'where':{'id':_0x357232['params']['id']}})[_0x6acc('0x21')](handleEntityNotFound(_0x5818fa,null))[_0x6acc('0x21')](saveUpdates(_0x357232['body'],null))[_0x6acc('0x21')](respondWithResult(_0x5818fa,null))['catch'](handleError(_0x5818fa,null));};exports[_0x6acc('0x37')]=function(_0x2ba259,_0x457d78){return db[_0x6acc('0x4f')]['find']({'where':{'id':_0x2ba259['params']['id']}})['then'](handleEntityNotFound(_0x457d78,null))['then'](removeEntity(_0x457d78,null))['catch'](handleError(_0x457d78,null));};exports[_0x6acc('0x5a')]=function(_0x6a2d56,_0x1eb10e){return db[_0x6acc('0x4f')]['describe']()['then'](respondWithResult(_0x1eb10e,null))[_0x6acc('0x2c')](handleError(_0x1eb10e,null));};var interaction_log=require('../../config/logger')(_0x6acc('0x5b'));exports['accept']=function(_0x263c2a,_0x1e2a63,_0x7e28ff){var _0x40435c={'agent':{},'channel':_0x6acc('0x5c')};if(_0x263c2a[_0x6acc('0x58')]['id']){delete _0x263c2a[_0x6acc('0x58')]['id'];}_0x263c2a[_0x6acc('0x58')][_0x6acc('0x5d')]=!![];_0x263c2a[_0x6acc('0x58')][_0x6acc('0x5e')]=moment()[_0x6acc('0x5f')](_0x6acc('0x60'));_0x263c2a[_0x6acc('0x58')][_0x6acc('0x61')]=_0x263c2a[_0x6acc('0x58')][_0x6acc('0x61')]||_0x263c2a[_0x6acc('0x62')]['id'];_0x40435c[_0x6acc('0x63')]['id']=_0x263c2a['body'][_0x6acc('0x61')];return db['SmsMessage'][_0x6acc('0x56')]({'where':{'id':_0x263c2a['params']['id'],'UserId':null}})[_0x6acc('0x21')](handleEntityNotFound(_0x1e2a63,null))['then'](saveUpdates(_0x263c2a[_0x6acc('0x58')],null))['then'](function(_0x54da14){if(_0x54da14){_0x40435c[_0x6acc('0x29')]=_0x54da14[_0x6acc('0x64')]({'plain':!![]});return db['SmsInteraction'][_0x6acc('0x56')]({'where':{'id':_0x54da14[_0x6acc('0x65')]}});}return null;})[_0x6acc('0x21')](handleEntityNotFound(_0x1e2a63,null))['then'](function(_0x42097a){if(_0x42097a){return _0x42097a[_0x6acc('0x59')]({'UserId':_0x263c2a[_0x6acc('0x58')][_0x6acc('0x61')],'read1stAt':_['isNil'](_0x42097a['read1stAt'])?moment()[_0x6acc('0x5f')](_0x6acc('0x60')):undefined});}return null;})[_0x6acc('0x21')](function(_0x4cdde4){if(_0x4cdde4){_0x40435c['interaction']=_0x4cdde4[_0x6acc('0x64')]({'plain':!![]});interaction_log[_0x6acc('0x2a')](_0x6acc('0x66'),_0x263c2a['user']['id'],_0x263c2a['user'][_0x6acc('0x39')],_0x263c2a[_0x6acc('0x62')][_0x6acc('0x67')],_0x40435c['interaction']['id'],_0x263c2a[_0x6acc('0x58')]?JSON[_0x6acc('0x26')](_0x263c2a[_0x6acc('0x58')]):_0x6acc('0x68'));return respondWithRpcPromise(_0x6acc('0x69'),_0x6acc('0x6a'),_0x40435c);}return null;})[_0x6acc('0x21')](function(_0x358824){var _0x1b20dd=_0x6acc('0x6b')+_0x358824[_0x6acc('0x29')][_0x6acc('0x6c')];return db['sequelize'][_0x6acc('0x3f')](_0x1b20dd,{'type':db[_0x6acc('0x6d')][_0x6acc('0x6e')][_0x6acc('0x6f')],'raw':!![]})['then'](function(_0x340705){return _0x340705;});})[_0x6acc('0x21')](function(_0x2ffe7b){if(_0x2ffe7b){_0x40435c[_0x6acc('0x29')][_0x6acc('0x70')]=_0x2ffe7b[0x0];if(!_0x263c2a['body'][_0x6acc('0x61')])return;return db['User'][_0x6acc('0x56')]({'where':{'id':_0x263c2a[_0x6acc('0x58')][_0x6acc('0x61')],'role':_0x6acc('0x63')},'attributes':['id',_0x6acc('0x39'),_0x6acc('0x71'),_0x6acc('0x72'),_0x6acc('0x73')],'raw':!![]});}return null;})[_0x6acc('0x21')](function(_0x4cc475){if(!_0x4cc475)return null;_0x40435c[_0x6acc('0x29')][_0x6acc('0x63')]=_0x4cc475;return _0x40435c;})['then'](function(_0x150e3f){if(_0x150e3f){if(_0x263c2a[_0x6acc('0x58')]['manual']){_0x40435c[_0x6acc('0x29')][_0x6acc('0x74')]=util['format'](_0x6acc('0x75'),_0x263c2a['user'][_0x6acc('0x39')]);_0x40435c[_0x6acc('0x29')]['channel']=_0x40435c['channel'];_0x40435c[_0x6acc('0x29')]['motionChannel']=_0x40435c[_0x6acc('0x76')];_0x40435c[_0x6acc('0x29')][_0x6acc('0x77')]=_0x6acc('0x78');return respondWithRpcPromise(_0x6acc('0x79'),_0x6acc('0x79'),{'event':_0x6acc('0x7a'),'message':_0x40435c[_0x6acc('0x29')]},client9002)['then'](function(){return _0x40435c;});}return _0x40435c;}return null;})[_0x6acc('0x21')](respondWithResult(_0x1e2a63,null))[_0x6acc('0x2c')](handleError(_0x1e2a63,null));};var interaction_log=require(_0x6acc('0x14'))(_0x6acc('0x5b'));exports[_0x6acc('0x36')]=function(_0x3034e7,_0x385cd7,_0x528ede){var _0x527629={'agent':{},'channel':_0x6acc('0x5c')};if(_0x3034e7[_0x6acc('0x58')]['id']){delete _0x3034e7[_0x6acc('0x58')]['id'];}_0x3034e7[_0x6acc('0x58')][_0x6acc('0x61')]=_0x3034e7[_0x6acc('0x58')]['UserId']||_0x3034e7[_0x6acc('0x62')]['id'];_0x527629[_0x6acc('0x63')]['id']=_0x3034e7['body'][_0x6acc('0x61')];return db['SmsMessage'][_0x6acc('0x56')]({'where':{'id':_0x3034e7[_0x6acc('0x55')]['id'],'UserId':null}})[_0x6acc('0x21')](handleEntityNotFound(_0x385cd7,null))[_0x6acc('0x21')](function(_0x2b8146){if(_0x2b8146){_0x527629['message']=_0x2b8146[_0x6acc('0x64')]({'plain':!![]});return db[_0x6acc('0x7b')]['find']({'where':{'id':_0x2b8146[_0x6acc('0x65')]}});}return null;})[_0x6acc('0x21')](handleEntityNotFound(_0x385cd7,null))[_0x6acc('0x21')](function(_0x2f2a8a){if(_0x2f2a8a){_0x527629[_0x6acc('0x7c')]=_0x2f2a8a[_0x6acc('0x64')]({'plain':!![]});interaction_log[_0x6acc('0x2a')](_0x6acc('0x7d'),_0x3034e7[_0x6acc('0x62')]['id'],_0x3034e7[_0x6acc('0x62')][_0x6acc('0x39')],_0x3034e7[_0x6acc('0x62')][_0x6acc('0x67')],_0x527629['interaction']['id'],_0x3034e7['body']?JSON[_0x6acc('0x26')](_0x3034e7[_0x6acc('0x58')]):_0x6acc('0x68'));return respondWithRpcPromise(_0x6acc('0x7e'),_0x6acc('0x7f'),_0x527629);}return null;})[_0x6acc('0x21')](function(_0x511964){var _0x525d1e=_0x6acc('0x6b')+_0x511964[_0x6acc('0x29')]['ContactId'];return db[_0x6acc('0x80')][_0x6acc('0x3f')](_0x525d1e,{'type':db[_0x6acc('0x6d')][_0x6acc('0x6e')][_0x6acc('0x6f')],'raw':!![]})['then'](function(_0x574f5b){return _0x574f5b;});})['then'](function(_0x286fb5){if(_0x286fb5){_0x527629[_0x6acc('0x29')][_0x6acc('0x70')]=_0x286fb5[0x0];if(!_0x3034e7[_0x6acc('0x58')][_0x6acc('0x61')])return;return db['User'][_0x6acc('0x56')]({'where':{'id':_0x3034e7[_0x6acc('0x58')]['UserId'],'role':_0x6acc('0x63')},'attributes':['id',_0x6acc('0x39'),_0x6acc('0x71'),_0x6acc('0x72'),_0x6acc('0x73')],'raw':!![]});}return null;})[_0x6acc('0x21')](function(_0x1ae5b1){if(!_0x1ae5b1)return null;_0x527629[_0x6acc('0x29')][_0x6acc('0x63')]=_0x1ae5b1;return _0x527629;})[_0x6acc('0x21')](function(_0x11407e){if(_0x11407e){_0x11407e['message'][_0x6acc('0x74')]=util['format'](_0x6acc('0x75'),_0x3034e7['user'][_0x6acc('0x39')]);_0x11407e[_0x6acc('0x29')][_0x6acc('0x76')]=_0x527629[_0x6acc('0x76')];_0x11407e[_0x6acc('0x29')]['motionChannel']=_0x527629[_0x6acc('0x76')];_0x11407e[_0x6acc('0x29')]['event']='reject';respondWithRpcPromise(_0x6acc('0x79'),'EventManager',{'event':_0x6acc('0x81'),'message':_0x11407e['message']},client9002);return _0x527629;}return null;})[_0x6acc('0x21')](respondWithResult(_0x385cd7,null))[_0x6acc('0x2c')](handleError(_0x385cd7,null));};exports[_0x6acc('0x2e')]=function(_0x577a27,_0x13850e,_0xdfe622){if(_0x577a27[_0x6acc('0x58')]['id']){delete _0x577a27[_0x6acc('0x58')]['id'];}var _0x392758;return db[_0x6acc('0x4f')][_0x6acc('0x56')]({'where':{'id':_0x577a27[_0x6acc('0x55')]['id']}})['then'](handleEntityNotFound(_0x13850e,null))[_0x6acc('0x21')](function(_0x5ebcc7){if(_0x5ebcc7){_0x392758=_0x5ebcc7;return db[_0x6acc('0x82')][_0x6acc('0x56')]({'where':{'id':_0x5ebcc7[_0x6acc('0x83')]}});}})[_0x6acc('0x21')](handleEntityNotFound(_0x13850e,null))[_0x6acc('0x21')](function(_0x51298e){if(_0x51298e){logger[_0x6acc('0x24')](_0x6acc('0x25'),_0x6acc('0x2e'),_0x6acc('0x84'),_0x51298e[_0x6acc('0x3c')],util[_0x6acc('0x85')](_0x577a27[_0x6acc('0x58')],{'showHidden':![],'depth':null}));switch(_0x51298e['type']){case _0x6acc('0x86'):if(_0x577a27[_0x6acc('0x58')][_0x6acc('0x87')]&&_0x577a27[_0x6acc('0x58')][_0x6acc('0x87')]===_0x392758[_0x6acc('0x88')]){return _0x392758[_0x6acc('0x59')]({'read':!![]});}else{logger['error'](_0x6acc('0x89'),_0x6acc('0x2e'),_0x6acc('0x86'),util['inspect'](_0x577a27[_0x6acc('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x577a27['body'][_0x6acc('0x8a')]&&_0x577a27[_0x6acc('0x58')][_0x6acc('0x8a')]===_0x392758[_0x6acc('0x88')]&&_[_0x6acc('0x8b')](['sent',_0x6acc('0x8c')],_0x577a27[_0x6acc('0x58')][_0x6acc('0x8d')])>=0x0){return _0x392758[_0x6acc('0x59')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6acc('0x2e'),_0x6acc('0x8e'),util['inspect'](_0x577a27[_0x6acc('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x27aa9e=_0x577a27[_0x6acc('0x58')]['results'][0x0];if(_0x27aa9e[_0x6acc('0x2e')][_0x6acc('0x8f')]===_0x6acc('0x90')){return _0x392758['update']({'read':!![]});}else{logger['error'](_0x6acc('0x89'),'status',_0x6acc('0x91'),util[_0x6acc('0x85')](_0x577a27[_0x6acc('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x392758;}})['then'](respondWithResult(_0x13850e,null))[_0x6acc('0x2c')](handleError(_0x13850e,null));}; \ No newline at end of file +var _0xfc64=['groupName','DELIVERED','infobip','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','index','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','describe','sms-interactions','sms','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','rejectMessage','ContactId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','sent','delivered','plivio'];(function(_0x17a3bf,_0x3fe868){var _0x1ff0e6=function(_0x22deb1){while(--_0x22deb1){_0x17a3bf['push'](_0x17a3bf['shift']());}};_0x1ff0e6(++_0x3fe868);}(_0xfc64,0x1b3));var _0x4fc6=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xfc64[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x4fc6('0x0'));var rimraf=require(_0x4fc6('0x1'));var zipdir=require(_0x4fc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4fc6('0x3'));var moment=require(_0x4fc6('0x4'));var BPromise=require(_0x4fc6('0x5'));var Mustache=require(_0x4fc6('0x6'));var util=require(_0x4fc6('0x7'));var path=require('path');var sox=require(_0x4fc6('0x8'));var csv=require(_0x4fc6('0x9'));var ejs=require(_0x4fc6('0xa'));var fs=require('fs');var fs_extra=require(_0x4fc6('0xb'));var _=require(_0x4fc6('0xc'));var squel=require(_0x4fc6('0xd'));var crypto=require(_0x4fc6('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4fc6('0xf'));var toCsv=require(_0x4fc6('0x9'));var querystring=require(_0x4fc6('0x10'));var Papa=require(_0x4fc6('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4fc6('0x12'));var as=require(_0x4fc6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4fc6('0x14'));var utils=require(_0x4fc6('0x15'));var config=require(_0x4fc6('0x16'));var licenseUtil=require(_0x4fc6('0x17'));var db=require(_0x4fc6('0x18'))['db'];config[_0x4fc6('0x19')]=_[_0x4fc6('0x1a')](config[_0x4fc6('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fc6('0x1b'))(new Redis(config[_0x4fc6('0x19')]));require('./smsMessage.socket')[_0x4fc6('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x4fc6('0x1d')][_0x4fc6('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x4810e3,_0x55426f,_0x24a112,_0x53dfd6){return new BPromise(function(_0x40dc97,_0x27aec2){var _0x275f31=_0x53dfd6||client;return _0x275f31[_0x4fc6('0x1f')](_0x4810e3,_0x24a112)['then'](function(_0x3eef8e){logger[_0x4fc6('0x20')]('SmsMessage,\x20%s,\x20%s',_0x55426f,_0x4fc6('0x21'));logger[_0x4fc6('0x22')](_0x4fc6('0x23'),_0x55426f,_0x4fc6('0x21'),JSON[_0x4fc6('0x24')](_0x3eef8e));if(_0x3eef8e[_0x4fc6('0x25')]){if(_0x3eef8e[_0x4fc6('0x25')][_0x4fc6('0x26')]===0x1f4){logger[_0x4fc6('0x25')](_0x4fc6('0x27'),_0x55426f,_0x3eef8e[_0x4fc6('0x25')]['message']);return _0x27aec2(_0x3eef8e[_0x4fc6('0x25')][_0x4fc6('0x28')]);}logger[_0x4fc6('0x25')]('SmsMessage,\x20%s,\x20%s',_0x55426f,_0x3eef8e[_0x4fc6('0x25')][_0x4fc6('0x28')]);return _0x40dc97(_0x3eef8e[_0x4fc6('0x25')]['message']);}else{logger[_0x4fc6('0x20')]('SmsMessage,\x20%s,\x20%s',_0x55426f,_0x4fc6('0x21'));_0x40dc97(_0x3eef8e[_0x4fc6('0x29')][_0x4fc6('0x28')]);}})[_0x4fc6('0x2a')](function(_0x1a0596){logger[_0x4fc6('0x25')]('SmsMessage,\x20%s,\x20%s',_0x55426f,_0x1a0596);_0x27aec2(_0x1a0596);});});}function respondWithStatusCode(_0x16632c,_0x3f6e3e){_0x3f6e3e=_0x3f6e3e||0xcc;return function(_0x5c64b5){if(_0x5c64b5){return _0x16632c[_0x4fc6('0x2b')](_0x3f6e3e);}return _0x16632c[_0x4fc6('0x2c')](_0x3f6e3e)[_0x4fc6('0x2d')]();};}function respondWithResult(_0x40f240,_0x15e29b){_0x15e29b=_0x15e29b||0xc8;return function(_0x3b7e8d){if(_0x3b7e8d){return _0x40f240['status'](_0x15e29b)[_0x4fc6('0x2e')](_0x3b7e8d);}};}function respondWithFilteredResult(_0x48be65,_0x266d75){return function(_0x589bb1){if(_0x589bb1){var _0x1d0870=typeof _0x266d75[_0x4fc6('0x2f')]===_0x4fc6('0x30')&&typeof _0x266d75[_0x4fc6('0x31')]===_0x4fc6('0x30');var _0x37eac8=_0x589bb1[_0x4fc6('0x32')];var _0x467182=_0x1d0870?0x0:_0x266d75['offset'];var _0x218986=_0x1d0870?_0x589bb1[_0x4fc6('0x32')]:_0x266d75[_0x4fc6('0x2f')]+_0x266d75[_0x4fc6('0x31')];var _0x652420;if(_0x218986>=_0x37eac8){_0x218986=_0x37eac8;_0x652420=0xc8;}else{_0x652420=0xce;}_0x48be65['status'](_0x652420);return _0x48be65['set'](_0x4fc6('0x33'),_0x467182+'-'+_0x218986+'/'+_0x37eac8)[_0x4fc6('0x2e')](_0x589bb1);}return null;};}function patchUpdates(_0x2cebbf){return function(_0x2958d9){try{jsonpatch[_0x4fc6('0x34')](_0x2958d9,_0x2cebbf,!![]);}catch(_0x56dd81){return BPromise['reject'](_0x56dd81);}return _0x2958d9[_0x4fc6('0x35')]();};}function saveUpdates(_0x5d036f,_0x5c3add){return function(_0x1b45a8){if(_0x1b45a8){return _0x1b45a8[_0x4fc6('0x36')](_0x5d036f)[_0x4fc6('0x37')](function(_0xa076e7){return _0xa076e7;});}return null;};}function removeEntity(_0x3967dc,_0xe86b53){return function(_0x23b6f4){if(_0x23b6f4){return _0x23b6f4[_0x4fc6('0x38')]()[_0x4fc6('0x37')](function(){_0x3967dc[_0x4fc6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7794,_0x386000){return function(_0x7e9c0a){if(!_0x7e9c0a){_0x4a7794[_0x4fc6('0x2b')](0x194);}return _0x7e9c0a;};}function handleError(_0x4b3b9e,_0x833e5){_0x833e5=_0x833e5||0x1f4;return function(_0x16d88d){logger['error'](_0x16d88d[_0x4fc6('0x39')]);if(_0x16d88d[_0x4fc6('0x3a')]){delete _0x16d88d['name'];}_0x4b3b9e[_0x4fc6('0x2c')](_0x833e5)['send'](_0x16d88d);};}exports[_0x4fc6('0x3b')]=function(_0x3f8f2d,_0x3a47ce){var _0x3c0b64={},_0x6bf8b8={},_0x54c8c2={'count':0x0,'rows':[]};var _0x2cc5a7=_['map'](db[_0x4fc6('0x3c')][_0x4fc6('0x3d')],function(_0x2cf18b){return{'name':_0x2cf18b[_0x4fc6('0x3e')],'type':_0x2cf18b[_0x4fc6('0x3f')][_0x4fc6('0x40')]};});_0x6bf8b8[_0x4fc6('0x41')]=_['map'](_0x2cc5a7,'name');_0x6bf8b8[_0x4fc6('0x42')]=_[_0x4fc6('0x43')](_0x3f8f2d[_0x4fc6('0x42')]);_0x6bf8b8[_0x4fc6('0x44')]=_[_0x4fc6('0x45')](_0x6bf8b8[_0x4fc6('0x41')],_0x6bf8b8[_0x4fc6('0x42')]);_0x3c0b64['attributes']=_[_0x4fc6('0x45')](_0x6bf8b8[_0x4fc6('0x41')],qs[_0x4fc6('0x46')](_0x3f8f2d[_0x4fc6('0x42')]['fields']));_0x3c0b64['attributes']=_0x3c0b64[_0x4fc6('0x47')]['length']?_0x3c0b64[_0x4fc6('0x47')]:_0x6bf8b8[_0x4fc6('0x41')];if(!_0x3f8f2d[_0x4fc6('0x42')][_0x4fc6('0x48')](_0x4fc6('0x49'))){_0x3c0b64[_0x4fc6('0x31')]=qs['limit'](_0x3f8f2d['query'][_0x4fc6('0x31')]);_0x3c0b64[_0x4fc6('0x2f')]=qs[_0x4fc6('0x2f')](_0x3f8f2d[_0x4fc6('0x42')]['offset']);}_0x3c0b64['order']=qs[_0x4fc6('0x4a')](_0x3f8f2d[_0x4fc6('0x42')][_0x4fc6('0x4a')]);_0x3c0b64[_0x4fc6('0x4b')]=qs[_0x4fc6('0x44')](_['pick'](_0x3f8f2d['query'],_0x6bf8b8[_0x4fc6('0x44')]),_0x2cc5a7);if(_0x3f8f2d['query']['filter']){_0x3c0b64['where']=_[_0x4fc6('0x4c')](_0x3c0b64[_0x4fc6('0x4b')],{'$or':_[_0x4fc6('0x4d')](_0x2cc5a7,function(_0x534555){if(_0x534555[_0x4fc6('0x3f')]!==_0x4fc6('0x4e')){var _0x2cec50={};_0x2cec50[_0x534555[_0x4fc6('0x3a')]]={'$like':'%'+_0x3f8f2d[_0x4fc6('0x42')]['filter']+'%'};return _0x2cec50;}})});}_0x3c0b64=_[_0x4fc6('0x4c')]({},_0x3c0b64,_0x3f8f2d[_0x4fc6('0x4f')]);var _0x313cd5={'where':_0x3c0b64[_0x4fc6('0x4b')]};return db[_0x4fc6('0x3c')][_0x4fc6('0x32')](_0x313cd5)[_0x4fc6('0x37')](function(_0x4647b1){_0x54c8c2['count']=_0x4647b1;if(_0x3f8f2d[_0x4fc6('0x42')][_0x4fc6('0x50')]){_0x3c0b64[_0x4fc6('0x51')]=[{'all':!![]}];}return db[_0x4fc6('0x3c')][_0x4fc6('0x52')](_0x3c0b64);})['then'](function(_0x458784){_0x54c8c2[_0x4fc6('0x53')]=_0x458784;return _0x54c8c2;})['then'](respondWithFilteredResult(_0x3a47ce,_0x3c0b64))[_0x4fc6('0x2a')](handleError(_0x3a47ce,null));};exports[_0x4fc6('0x54')]=function(_0x768994,_0x588e61){var _0x1be3fa={'raw':!![],'where':{'id':_0x768994[_0x4fc6('0x55')]['id']}},_0x1d1776={};_0x1d1776[_0x4fc6('0x41')]=_[_0x4fc6('0x43')](db['SmsMessage']['rawAttributes']);_0x1d1776[_0x4fc6('0x42')]=_[_0x4fc6('0x43')](_0x768994[_0x4fc6('0x42')]);_0x1d1776['filters']=_[_0x4fc6('0x45')](_0x1d1776[_0x4fc6('0x41')],_0x1d1776[_0x4fc6('0x42')]);_0x1be3fa['attributes']=_['intersection'](_0x1d1776['model'],qs[_0x4fc6('0x46')](_0x768994[_0x4fc6('0x42')][_0x4fc6('0x46')]));_0x1be3fa[_0x4fc6('0x47')]=_0x1be3fa[_0x4fc6('0x47')]['length']?_0x1be3fa['attributes']:_0x1d1776[_0x4fc6('0x41')];if(_0x768994[_0x4fc6('0x42')][_0x4fc6('0x50')]){_0x1be3fa[_0x4fc6('0x51')]=[{'all':!![]}];}_0x1be3fa=_['merge']({},_0x1be3fa,_0x768994[_0x4fc6('0x4f')]);return db[_0x4fc6('0x3c')][_0x4fc6('0x56')](_0x1be3fa)[_0x4fc6('0x37')](handleEntityNotFound(_0x588e61,null))[_0x4fc6('0x37')](respondWithResult(_0x588e61,null))[_0x4fc6('0x2a')](handleError(_0x588e61,null));};exports[_0x4fc6('0x57')]=function(_0x10efcd,_0x462a74){return db[_0x4fc6('0x3c')][_0x4fc6('0x57')](_0x10efcd['body'],{})[_0x4fc6('0x37')](respondWithResult(_0x462a74,0xc9))[_0x4fc6('0x2a')](handleError(_0x462a74,null));};exports[_0x4fc6('0x36')]=function(_0x13f5e6,_0x40b9b0){if(_0x13f5e6[_0x4fc6('0x58')]['id']){delete _0x13f5e6[_0x4fc6('0x58')]['id'];}return db[_0x4fc6('0x3c')][_0x4fc6('0x56')]({'where':{'id':_0x13f5e6['params']['id']}})['then'](handleEntityNotFound(_0x40b9b0,null))[_0x4fc6('0x37')](saveUpdates(_0x13f5e6[_0x4fc6('0x58')],null))[_0x4fc6('0x37')](respondWithResult(_0x40b9b0,null))[_0x4fc6('0x2a')](handleError(_0x40b9b0,null));};exports['destroy']=function(_0x532f4f,_0x56feff){return db[_0x4fc6('0x3c')][_0x4fc6('0x56')]({'where':{'id':_0x532f4f[_0x4fc6('0x55')]['id']}})['then'](handleEntityNotFound(_0x56feff,null))[_0x4fc6('0x37')](removeEntity(_0x56feff,null))[_0x4fc6('0x2a')](handleError(_0x56feff,null));};exports['describe']=function(_0x5484ce,_0x380430){return db[_0x4fc6('0x3c')][_0x4fc6('0x59')]()['then'](respondWithResult(_0x380430,null))[_0x4fc6('0x2a')](handleError(_0x380430,null));};var interaction_log=require('../../config/logger')(_0x4fc6('0x5a'));exports['accept']=function(_0x42ebf1,_0x16ed4a,_0x483709){var _0x208038={'agent':{},'channel':_0x4fc6('0x5b')};if(_0x42ebf1[_0x4fc6('0x58')]['id']){delete _0x42ebf1[_0x4fc6('0x58')]['id'];}_0x42ebf1[_0x4fc6('0x58')][_0x4fc6('0x5c')]=!![];_0x42ebf1[_0x4fc6('0x58')]['readAt']=moment()[_0x4fc6('0x5d')](_0x4fc6('0x5e'));_0x42ebf1['body'][_0x4fc6('0x5f')]=_0x42ebf1[_0x4fc6('0x58')][_0x4fc6('0x5f')]||_0x42ebf1[_0x4fc6('0x60')]['id'];_0x208038[_0x4fc6('0x61')]['id']=_0x42ebf1['body']['UserId'];return db[_0x4fc6('0x3c')]['find']({'where':{'id':_0x42ebf1['params']['id'],'UserId':null}})[_0x4fc6('0x37')](handleEntityNotFound(_0x16ed4a,null))['then'](saveUpdates(_0x42ebf1[_0x4fc6('0x58')],null))['then'](function(_0xcbfd73){if(_0xcbfd73){_0x208038[_0x4fc6('0x28')]=_0xcbfd73[_0x4fc6('0x62')]({'plain':!![]});return db[_0x4fc6('0x63')]['find']({'where':{'id':_0xcbfd73[_0x4fc6('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x16ed4a,null))[_0x4fc6('0x37')](function(_0x1dfdf0){if(_0x1dfdf0){return _0x1dfdf0[_0x4fc6('0x36')]({'UserId':_0x42ebf1[_0x4fc6('0x58')]['UserId'],'read1stAt':_[_0x4fc6('0x65')](_0x1dfdf0['read1stAt'])?moment()['format'](_0x4fc6('0x5e')):undefined});}return null;})[_0x4fc6('0x37')](function(_0x4058d7){if(_0x4058d7){_0x208038[_0x4fc6('0x66')]=_0x4058d7[_0x4fc6('0x62')]({'plain':!![]});interaction_log['info'](_0x4fc6('0x67'),_0x42ebf1[_0x4fc6('0x60')]['id'],_0x42ebf1['user'][_0x4fc6('0x3a')],_0x42ebf1[_0x4fc6('0x60')][_0x4fc6('0x68')],_0x208038[_0x4fc6('0x66')]['id'],_0x42ebf1[_0x4fc6('0x58')]?JSON[_0x4fc6('0x24')](_0x42ebf1[_0x4fc6('0x58')]):_0x4fc6('0x69'));return respondWithRpcPromise(_0x4fc6('0x6a'),_0x4fc6('0x6b'),_0x208038);}return null;})[_0x4fc6('0x37')](function(_0x5c70b5){var _0x1a07af=_0x4fc6('0x6c')+_0x5c70b5[_0x4fc6('0x28')]['ContactId'];return db[_0x4fc6('0x6d')][_0x4fc6('0x42')](_0x1a07af,{'type':db[_0x4fc6('0x6e')][_0x4fc6('0x6f')][_0x4fc6('0x70')],'raw':!![]})['then'](function(_0x301e6e){return _0x301e6e;});})[_0x4fc6('0x37')](function(_0x233386){if(_0x233386){_0x208038[_0x4fc6('0x28')][_0x4fc6('0x71')]=_0x233386[0x0];if(!_0x42ebf1['body'][_0x4fc6('0x5f')])return;return db[_0x4fc6('0x72')][_0x4fc6('0x56')]({'where':{'id':_0x42ebf1[_0x4fc6('0x58')][_0x4fc6('0x5f')],'role':_0x4fc6('0x61')},'attributes':['id',_0x4fc6('0x3a'),_0x4fc6('0x73'),_0x4fc6('0x74'),_0x4fc6('0x75')],'raw':!![]});}return null;})['then'](function(_0x44ed6f){if(!_0x44ed6f)return null;_0x208038[_0x4fc6('0x28')][_0x4fc6('0x61')]=_0x44ed6f;return _0x208038;})['then'](function(_0x3c7613){if(_0x3c7613){if(_0x42ebf1[_0x4fc6('0x58')][_0x4fc6('0x76')]){_0x208038['message'][_0x4fc6('0x77')]=util['format'](_0x4fc6('0x78'),_0x42ebf1[_0x4fc6('0x60')][_0x4fc6('0x3a')]);_0x208038[_0x4fc6('0x28')][_0x4fc6('0x79')]=_0x208038[_0x4fc6('0x79')];_0x208038[_0x4fc6('0x28')][_0x4fc6('0x7a')]=_0x208038[_0x4fc6('0x79')];_0x208038[_0x4fc6('0x28')][_0x4fc6('0x7b')]='accept';return respondWithRpcPromise(_0x4fc6('0x7c'),_0x4fc6('0x7c'),{'event':_0x4fc6('0x7d'),'message':_0x208038[_0x4fc6('0x28')]},client9002)['then'](function(){return _0x208038;});}return _0x208038;}return null;})[_0x4fc6('0x37')](respondWithResult(_0x16ed4a,null))['catch'](handleError(_0x16ed4a,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x4fc6('0x7e')]=function(_0x294f0d,_0x10158e,_0x39d308){var _0x5cfce5={'agent':{},'channel':_0x4fc6('0x5b')};if(_0x294f0d[_0x4fc6('0x58')]['id']){delete _0x294f0d[_0x4fc6('0x58')]['id'];}_0x294f0d['body'][_0x4fc6('0x5f')]=_0x294f0d[_0x4fc6('0x58')]['UserId']||_0x294f0d['user']['id'];_0x5cfce5[_0x4fc6('0x61')]['id']=_0x294f0d[_0x4fc6('0x58')][_0x4fc6('0x5f')];return db[_0x4fc6('0x3c')][_0x4fc6('0x56')]({'where':{'id':_0x294f0d[_0x4fc6('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10158e,null))['then'](function(_0x691c5e){if(_0x691c5e){_0x5cfce5[_0x4fc6('0x28')]=_0x691c5e['get']({'plain':!![]});return db[_0x4fc6('0x63')][_0x4fc6('0x56')]({'where':{'id':_0x691c5e['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x10158e,null))[_0x4fc6('0x37')](function(_0x59868c){if(_0x59868c){_0x5cfce5[_0x4fc6('0x66')]=_0x59868c[_0x4fc6('0x62')]({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x294f0d[_0x4fc6('0x60')]['id'],_0x294f0d[_0x4fc6('0x60')][_0x4fc6('0x3a')],_0x294f0d[_0x4fc6('0x60')][_0x4fc6('0x68')],_0x5cfce5['interaction']['id'],_0x294f0d['body']?JSON[_0x4fc6('0x24')](_0x294f0d['body']):_0x4fc6('0x69'));return respondWithRpcPromise('RejectMessage',_0x4fc6('0x7f'),_0x5cfce5);}return null;})[_0x4fc6('0x37')](function(_0x316043){var _0x2ecb26='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x316043['message'][_0x4fc6('0x80')];return db[_0x4fc6('0x6d')][_0x4fc6('0x42')](_0x2ecb26,{'type':db[_0x4fc6('0x6e')]['QueryTypes'][_0x4fc6('0x70')],'raw':!![]})[_0x4fc6('0x37')](function(_0x4077a9){return _0x4077a9;});})[_0x4fc6('0x37')](function(_0x1d5f08){if(_0x1d5f08){_0x5cfce5['message'][_0x4fc6('0x71')]=_0x1d5f08[0x0];if(!_0x294f0d[_0x4fc6('0x58')][_0x4fc6('0x5f')])return;return db[_0x4fc6('0x72')][_0x4fc6('0x56')]({'where':{'id':_0x294f0d[_0x4fc6('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x4fc6('0x3a'),_0x4fc6('0x73'),_0x4fc6('0x74'),'internal'],'raw':!![]});}return null;})[_0x4fc6('0x37')](function(_0x9d35c7){if(!_0x9d35c7)return null;_0x5cfce5[_0x4fc6('0x28')]['agent']=_0x9d35c7;return _0x5cfce5;})[_0x4fc6('0x37')](function(_0x3b9852){if(_0x3b9852){_0x3b9852[_0x4fc6('0x28')][_0x4fc6('0x77')]=util[_0x4fc6('0x5d')](_0x4fc6('0x78'),_0x294f0d['user'][_0x4fc6('0x3a')]);_0x3b9852[_0x4fc6('0x28')][_0x4fc6('0x79')]=_0x5cfce5['channel'];_0x3b9852[_0x4fc6('0x28')][_0x4fc6('0x7a')]=_0x5cfce5[_0x4fc6('0x79')];_0x3b9852[_0x4fc6('0x28')]['event']=_0x4fc6('0x7e');respondWithRpcPromise(_0x4fc6('0x7c'),'EventManager',{'event':'rejectmessage','message':_0x3b9852['message']},client9002);return _0x5cfce5;}return null;})['then'](respondWithResult(_0x10158e,null))[_0x4fc6('0x2a')](handleError(_0x10158e,null));};exports[_0x4fc6('0x2c')]=function(_0x4e2c6a,_0x15e533,_0x132da8){if(_0x4e2c6a[_0x4fc6('0x58')]['id']){delete _0x4e2c6a[_0x4fc6('0x58')]['id'];}var _0x3a8a9b;return db['SmsMessage']['find']({'where':{'id':_0x4e2c6a['params']['id']}})[_0x4fc6('0x37')](handleEntityNotFound(_0x15e533,null))['then'](function(_0xbbef33){if(_0xbbef33){_0x3a8a9b=_0xbbef33;return db['SmsAccount'][_0x4fc6('0x56')]({'where':{'id':_0xbbef33['SmsAccountId']}});}})[_0x4fc6('0x37')](handleEntityNotFound(_0x15e533,null))[_0x4fc6('0x37')](function(_0x592756){if(_0x592756){logger[_0x4fc6('0x22')](_0x4fc6('0x23'),'status',_0x4fc6('0x81'),_0x592756['type'],util[_0x4fc6('0x82')](_0x4e2c6a[_0x4fc6('0x58')],{'showHidden':![],'depth':null}));switch(_0x592756['type']){case _0x4fc6('0x83'):if(_0x4e2c6a[_0x4fc6('0x58')][_0x4fc6('0x84')]&&_0x4e2c6a[_0x4fc6('0x58')][_0x4fc6('0x84')]===_0x3a8a9b[_0x4fc6('0x85')]){return _0x3a8a9b[_0x4fc6('0x36')]({'read':!![]});}else{logger[_0x4fc6('0x25')](_0x4fc6('0x86'),'status',_0x4fc6('0x83'),util[_0x4fc6('0x82')](_0x4e2c6a[_0x4fc6('0x58')],{'showHidden':![],'depth':null}));}break;case _0x4fc6('0x87'):if(_0x4e2c6a['body']['MessageUUID']&&_0x4e2c6a[_0x4fc6('0x58')][_0x4fc6('0x88')]===_0x3a8a9b['messageId']&&_[_0x4fc6('0x89')]([_0x4fc6('0x8a'),_0x4fc6('0x8b')],_0x4e2c6a[_0x4fc6('0x58')]['Status'])>=0x0){return _0x3a8a9b[_0x4fc6('0x36')]({'read':!![]});}else{logger['error'](_0x4fc6('0x86'),'status',_0x4fc6('0x8c'),util[_0x4fc6('0x82')](_0x4e2c6a['body'],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1b26e5=_0x4e2c6a[_0x4fc6('0x58')]['results'][0x0];if(_0x1b26e5['status'][_0x4fc6('0x8d')]===_0x4fc6('0x8e')){return _0x3a8a9b['update']({'read':!![]});}else{logger[_0x4fc6('0x25')](_0x4fc6('0x86'),_0x4fc6('0x2c'),_0x4fc6('0x8f'),util[_0x4fc6('0x82')](_0x4e2c6a['body'],{'showHidden':![],'depth':null}));}break;}return _0x3a8a9b;}})[_0x4fc6('0x37')](respondWithResult(_0x15e533,null))['catch'](handleError(_0x15e533,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index d402a54..ef7fb4e 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 _0xaec5=['SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x5e0664,_0x4307dc){var _0x51ed02=function(_0x4b5b88){while(--_0x4b5b88){_0x5e0664['push'](_0x5e0664['shift']());}};_0x51ed02(++_0x4307dc);}(_0xaec5,0xc6));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x5aec('0x0'));var SmsMessage=require(_0x5aec('0x1'))['db'][_0x5aec('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x5aec('0x3')](0x0);var events={'afterCreate':_0x5aec('0x4'),'afterUpdate':_0x5aec('0x5'),'afterDestroy':_0x5aec('0x6')};function emitEvent(_0x57c24e){return function(_0x247a91,_0x195a27,_0x4531a9){SmsMessageEvents[_0x5aec('0x7')](_0x57c24e+':'+_0x247a91['id'],_0x247a91);SmsMessageEvents[_0x5aec('0x7')](_0x57c24e,_0x247a91);_0x4531a9(null);};}for(var e in events){if(events[_0x5aec('0x8')](e)){var event=events[e];SmsMessage[_0x5aec('0x9')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0xeace=['update','remove','emit','hasOwnProperty','hook','events','SmsMessage','setMaxListeners','save'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xeace,0xdd));var _0xeeac=function(_0x53b7c3,_0x3d0fbb){_0x53b7c3=_0x53b7c3-0x0;var _0x457aec=_0xeace[_0x53b7c3];return _0x457aec;};'use strict';var EventEmitter=require(_0xeeac('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0xeeac('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xeeac('0x2')](0x0);var events={'afterCreate':_0xeeac('0x3'),'afterUpdate':_0xeeac('0x4'),'afterDestroy':_0xeeac('0x5')};function emitEvent(_0x16a724){return function(_0x5f27e1,_0x41a11b,_0xb1a9ea){SmsMessageEvents[_0xeeac('0x6')](_0x16a724+':'+_0x5f27e1['id'],_0x5f27e1);SmsMessageEvents[_0xeeac('0x6')](_0x16a724,_0x5f27e1);_0xb1a9ea(null);};}for(var e in events){if(events[_0xeeac('0x7')](e)){var event=events[e];SmsMessage[_0xeeac('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c69ef0a..0cefb44 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 _0x27b0=['requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','Basic\x20%s','toString','base64','http_code','data','queued_count','clickSend','Missing\x20parameters:\x20username,\x20password','https://api.plivo.com/v1/Account/%s/Message/','authId','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','login','text','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','define','messageId','body','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','SmsAccount','find','SmsAccountId','type','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio','inspect','error','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','sender','&password=','GET','split','sms','user_key','session_key','internal_order_id','deliveryReport','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/'];(function(_0x4653d4,_0x17c5c1){var _0x55e8b6=function(_0x46dbe4){while(--_0x46dbe4){_0x4653d4['push'](_0x4653d4['shift']());}};_0x55e8b6(++_0x17c5c1);}(_0x27b0,0x139));var _0x027b=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x27b0[_0x55c00d];return _0x254a8f;};'use strict';var _=require('lodash');var util=require(_0x027b('0x0'));var logger=require(_0x027b('0x1'))('api');var moment=require(_0x027b('0x2'));var BPromise=require(_0x027b('0x3'));var rp=require(_0x027b('0x4'));var fs=require('fs');var path=require(_0x027b('0x5'));var rimraf=require(_0x027b('0x6'));var config=require(_0x027b('0x7'));var attributes=require(_0x027b('0x8'));module['exports']=function(_0x534539,_0x40ece1){return _0x534539[_0x027b('0x9')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x027b('0xa'),'fields':[_0x027b('0xa')]},{'name':'fti_sms_messages','fields':[_0x027b('0xb')],'type':_0x027b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x314078,_0x166b15,_0x2ef243){var _0x31f831=_0x534539['models'];var _0x151211=_0x314078[_0x027b('0xd')]({'plain':!![]});if(_0x151211['direction'][_0x027b('0xe')]()==='in'||_0x151211[_0x027b('0xf')]['toLowerCase']()===_0x027b('0x10')&&!_0x151211[_0x027b('0x11')]&&!_[_0x027b('0x12')](_0x151211[_0x027b('0x13')])&&!_['isNil'](_0x151211[_0x027b('0x14')])){_0x31f831[_0x027b('0x15')][_0x027b('0x16')]({'where':{'id':_0x151211[_0x027b('0x14')]}})[_0x027b('0x17')](function(_0x188f67){if(_0x188f67){_0x188f67[_0x027b('0x18')]({'lastMsgAt':_0x151211[_0x027b('0x19')],'lastMsgDirection':_0x151211[_0x027b('0xf')]['toLowerCase']()});}})[_0x027b('0x1a')](function(_0x1e0611){console['error'](_0x1e0611);});}if(_0x151211['direction']===_0x027b('0x10')&&!_0x151211[_0x027b('0x11')]){var _0xf61891;_0x31f831[_0x027b('0x1b')][_0x027b('0x1c')]({'where':{'id':_0x151211[_0x027b('0x1d')]},'raw':!![]})[_0x027b('0x17')](function(_0x243063){_0xf61891=_0x243063;if(_0xf61891&&_0xf61891[_0x027b('0x1e')]){switch(_0xf61891[_0x027b('0x1e')]){case'twilio':var _0x532af5=require('twilio');if(_0xf61891['accountSid']&&_0xf61891[_0x027b('0x1f')]&&_0xf61891[_0x027b('0x20')]){var _0x30ff47=new _0x532af5(_0xf61891[_0x027b('0x21')],_0xf61891[_0x027b('0x1f')]);_0x30ff47[_0x027b('0x22')][_0x027b('0x23')]({'body':_0x151211[_0x027b('0xb')],'to':_0x151211['phone'],'from':_0xf61891[_0x027b('0x20')],'statusCallback':_0xf61891[_0x027b('0x24')]+_0x027b('0x25')+_0x151211['id']+_0x027b('0x26')+_0xf61891[_0x027b('0x27')]})['then'](function(_0x3b2bfe){if(_0x3b2bfe['sid']){return _0x314078[_0x027b('0x18')]({'messageId':_0x3b2bfe[_0x027b('0x28')]});}})[_0x027b('0x1a')](function(_0x4619d1){logger['error'](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x2b'),util[_0x027b('0x2c')](_0x4619d1,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),_0x027b('0x2b'),_0x027b('0x2e'));}break;case _0x027b('0x2f'):var _0x337377=_0x027b('0x30');if(_0xf61891[_0x027b('0x31')]&&_0xf61891[_0x027b('0x32')]){var _0x3cda99={'recipient':[_0x151211['phone']],'message':_0x151211[_0x027b('0xb')],'message_type':_0xf61891[_0x027b('0x33')]};if(_0xf61891[_0x027b('0x33')]&&_0xf61891[_0x027b('0x33')]!=='SI'){_0x3cda99[_0x027b('0x34')]=_0xf61891[_0x027b('0x20')];}var _0x41193a={'url':_0x337377+'login?username='+_0xf61891['username']+_0x027b('0x35')+_0xf61891[_0x027b('0x32')],'method':_0x027b('0x36')};rp(_0x41193a)[_0x027b('0x17')](function(_0x53ac9c){var _0xcc10e5=_0x53ac9c[_0x027b('0x37')](';');var _0x2e7217={'user_key':_0xcc10e5[0x0],'session_key':_0xcc10e5[0x1]};_0x41193a={'url':_0x337377+_0x027b('0x38'),'method':'POST','headers':{'user_key':_0x2e7217[_0x027b('0x39')],'Session_key':_0x2e7217[_0x027b('0x3a')]},'json':!![],'body':_0x3cda99};return rp(_0x41193a);})[_0x027b('0x17')](function(_0x485881){if(_0x485881['total_sent']>=0x1){var _0x1a0198={'messageId':_0x485881[_0x027b('0x3b')]};if(_0xf61891[_0x027b('0x33')]!=='GP'||!_0xf61891[_0x027b('0x3c')]){_0x1a0198['read']=!![];}return _0x314078[_0x027b('0x18')](_0x1a0198);}else{return logger['error'](_0x027b('0x29'),'afterCreate',_0x027b('0x2f'),util[_0x027b('0x2c')](_0x485881,{'showHidden':![],'depth':null}));}})[_0x027b('0x1a')](function(_0x14b12c){return logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),'skebby',util[_0x027b('0x2c')](_0x14b12c,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x027b('0x3d'):if(_0xf61891[_0x027b('0x1f')]){var _0x7fde28={'recipient':_0x151211['phone'],'message':_0x151211[_0x027b('0xb')],'sender':_0xf61891[_0x027b('0x3e')]||_0xf61891[_0x027b('0x20')],'authorization':_0xf61891[_0x027b('0x1f')]};var _0x166b15={'method':_0x027b('0x3f'),'uri':_0x027b('0x40'),'body':_0x7fde28,'json':!![]};rp(_0x166b15)[_0x027b('0x17')](function(_0x1ae731){var _0x37f713={'messageId':_0x1ae731[_0x027b('0x41')]};if(!_0xf61891['deliveryReport']){_0x37f713[_0x027b('0x42')]=!![];}return _0x314078[_0x027b('0x18')](_0x37f713);})[_0x027b('0x1a')](function(_0x2e8d27){logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x3d'),util[_0x027b('0x2c')](_0x2e8d27,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')](_0x027b('0x29'),'afterCreate',_0x027b('0x3d'),_0x027b('0x43'));}break;case _0x027b('0x44'):if(_0xf61891['username']&&_0xf61891['password']){var _0x7fde28={'messages':[{'source':_0x027b('0x45'),'to':_0x151211[_0x027b('0x20')],'body':_0x151211['body'],'from':_0xf61891[_0x027b('0x3e')]||_0xf61891[_0x027b('0x20')]}]};var _0x13c391=util[_0x027b('0x46')](_0x027b('0x47'),_0xf61891['username'],_0xf61891[_0x027b('0x32')]);var _0x166b15={'method':_0x027b('0x3f'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x7fde28,'headers':{'Authorization':util[_0x027b('0x46')](_0x027b('0x48'),new Buffer(_0x13c391)[_0x027b('0x49')](_0x027b('0x4a')))},'json':!![]};rp(_0x166b15)[_0x027b('0x17')](function(_0x5cc6ce){if(_0x5cc6ce[_0x027b('0x4b')]>=0xc8&&_0x5cc6ce[_0x027b('0x4b')]<=0xce){if(_0x5cc6ce[_0x027b('0x4c')]&&_0x5cc6ce[_0x027b('0x4c')][_0x027b('0x4d')]>0x0){var _0x17aa81=_['head'](_0x5cc6ce['data'][_0x027b('0x22')]);var _0x43055e={'messageId':_0x17aa81['message_id']};if(!_0xf61891[_0x027b('0x3c')]){_0x43055e['read']=!![];}return _0x314078[_0x027b('0x18')](_0x43055e);}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x4e'),util[_0x027b('0x2c')](_0x5cc6ce,{'showHidden':![],'depth':null}));}}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x4e'),util[_0x027b('0x2c')](_0x5cc6ce,{'showHidden':![],'depth':null}));}})[_0x027b('0x1a')](function(_0x80026a){logger[_0x027b('0x2d')](_0x027b('0x29'),'afterCreate',_0x027b('0x4e'),util[_0x027b('0x2c')](_0x80026a,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')](_0x027b('0x29'),'afterCreate','clickSend',_0x027b('0x4f'));}break;case'plivo':if(_0xf61891['authId']&&_0xf61891[_0x027b('0x1f')]){var _0x7fde28={'dst':_0x151211['phone'],'text':_0x151211['body'],'src':_0xf61891['senderString']||_0xf61891[_0x027b('0x20')],'url':_0xf61891[_0x027b('0x24')]+_0x027b('0x25')+_0x151211['id']+_0x027b('0x26')+_0xf61891['token']};var _0x13c391=util[_0x027b('0x46')](_0x027b('0x47'),_0xf61891['authId'],_0xf61891[_0x027b('0x1f')]);var _0x166b15={'method':'POST','uri':util[_0x027b('0x46')](_0x027b('0x50'),_0xf61891[_0x027b('0x51')]),'body':_0x7fde28,'headers':{'Authorization':util[_0x027b('0x46')](_0x027b('0x48'),new Buffer(_0x13c391)[_0x027b('0x49')](_0x027b('0x4a')))},'json':!![]};rp(_0x166b15)[_0x027b('0x17')](function(_0x3ea56f){var _0xaedf69={'messageId':_0x3ea56f[_0x027b('0x52')][0x0]};return _0x314078['update'](_0xaedf69);})[_0x027b('0x1a')](function(_0x32b858){logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),_0x027b('0x53'),util['inspect'](_0x32b858,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x53'),_0x027b('0x54'));}break;case _0x027b('0x55'):if(_0xf61891[_0x027b('0x31')]&&_0xf61891[_0x027b('0x32')]){if(_0xf61891[_0x027b('0x56')]){var _0x4b9319={'method':_0x027b('0x3f'),'uri':_0xf61891['baseUrl']+_0x027b('0x57'),'body':{'username':_0xf61891[_0x027b('0x31')],'password':_0xf61891['password']},'json':!![]};return rp(_0x4b9319)['then'](function(_0x3fedff){var _0x1e8e57={'method':_0x027b('0x3f'),'uri':_0xf61891['baseUrl']+_0x027b('0x58'),'body':{'messages':[{'from':_0xf61891[_0x027b('0x20')],'destinations':[{'to':_0x151211[_0x027b('0x20')]}],'text':_0x151211['body'],'notifyUrl':_0xf61891[_0x027b('0x24')]+_0x027b('0x25')+_0x151211['id']+_0x027b('0x26')+_0xf61891[_0x027b('0x27')],'notifyContentType':_0x027b('0x59'),'callbackData':_0xf61891[_0x027b('0x20')]+';'+_0x151211[_0x027b('0xb')]}]},'headers':{'Authorization':_0x027b('0x5a')+_0x3fedff[_0x027b('0x27')]},'json':!![]};return rp(_0x1e8e57)[_0x027b('0x17')](function(_0x24362b){if(_0x24362b[_0x027b('0x22')]){var _0x1f251a={'messageId':_0x24362b['messages'][0x0]['messageId']};if(!_0xf61891[_0x027b('0x3c')]){_0x1f251a['read']=!![];}return _0x314078[_0x027b('0x18')](_0x1f251a);}else{return logger['error'](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x55'),util[_0x027b('0x2c')](_0x24362b,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x2014dc){return logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),_0x027b('0x55'),util[_0x027b('0x2c')](_0x2014dc,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),'infobip',_0x027b('0x5b'));}}else{logger[_0x027b('0x2d')](_0x027b('0x29'),'afterCreate',_0x027b('0x55'),_0x027b('0x4f'));}break;case _0x027b('0x5c'):var _0x741002=require('crypto');if(_0xf61891['apiKey']){var _0x1cc950={};_0x1cc950[_0x027b('0x5d')]=_0xf61891['username'];_0x1cc950['phone']=_0x151211['phone'];_0x1cc950[_0x027b('0x34')]=_0xf61891[_0x027b('0x20')];_0x1cc950[_0x027b('0x5e')]=_0x151211[_0x027b('0xb')];_0x1cc950['timestamp']=+new Date();var _0x13a06d='';var _0x2603d7='';var _0x2d6c3b=Object[_0x027b('0x5f')](_0x1cc950);_0x2d6c3b[_0x027b('0x60')]();for(var _0x1da69b=0x0;_0x1da69b<_0x2d6c3b[_0x027b('0x61')];_0x1da69b++){if(_0x13a06d!=''){_0x13a06d+='&';}_0x13a06d+=_0x2d6c3b[_0x1da69b]+'='+encodeURIComponent(_0x1cc950[_0x2d6c3b[_0x1da69b]]);_0x2603d7+=_0x1cc950[_0x2d6c3b[_0x1da69b]];}_0x2603d7+=_0xf61891['apiKey'];_0x2603d7=_0x741002[_0x027b('0x62')](_0x027b('0x63'))[_0x027b('0x18')](_0x2603d7)[_0x027b('0x64')](_0x027b('0x65'));if(_0x13a06d!==''){_0x13a06d+='&';}_0x13a06d+=_0x027b('0x66')+_0x2603d7;var _0x41193a={'method':_0x027b('0x36'),'uri':_0xf61891['baseUrl']+_0x027b('0x67')+_0x13a06d,'json':!![]};return rp(_0x41193a)['then'](function(_0x50bcfa){var _0x40010b=Object[_0x027b('0x5f')](_0x50bcfa);if(_0x50bcfa[_0x40010b[0x0]]['error']&&parseInt(_0x50bcfa[_0x40010b[0x0]][_0x027b('0x2d')])===0x0){var _0x50ba98={'messageId':_0x50bcfa[_0x40010b[0x0]]['id_sms']};if(!_0xf61891[_0x027b('0x3c')]){_0x50ba98['read']=!![];}return _0x314078[_0x027b('0x18')](_0x50ba98);}else{return logger['error'](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x5c'),util['inspect'](_0x50bcfa[_0x027b('0x2d')],{'showHidden':![],'depth':null}));}})[_0x027b('0x1a')](function(_0x34753f){return logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x5c'),util[_0x027b('0x2c')](_0x34753f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x027b('0x29'),'afterCreate','csc',_0x027b('0x68'));}break;case'clickatell':if(_0xf61891[_0x027b('0x69')]){var _0x13946b={'method':_0x027b('0x3f'),'uri':_0x027b('0x6a'),'headers':{'Authorization':_0xf61891['apiKey']},'body':{'content':_0x151211[_0x027b('0xb')],'to':[_0x151211[_0x027b('0x20')]],'from':_0xf61891[_0x027b('0x20')],'binary':![],'clientMessageId':_0x027b('0x6b'),'charset':_0x027b('0x6c')},'json':!![]};rp(_0x13946b)[_0x027b('0x17')](function(_0x395b63){if(!_0x395b63['error']){var _0x393230={'messageId':_0x395b63['messages'][0x0][_0x027b('0x6d')]};if(!_0xf61891[_0x027b('0x3c')]){_0x393230[_0x027b('0x42')]=!![];}return _0x314078[_0x027b('0x18')](_0x393230);}else{return logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),'clickatell',util[_0x027b('0x2c')](_0x395b63['error'],{'showHidden':![],'depth':null}));}})[_0x027b('0x1a')](function(_0x2c0413){return logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x027b('0x6e'),util[_0x027b('0x2c')](_0x2c0413,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x6e'),_0x027b('0x68'));}break;case _0x027b('0x6f'):if(_0xf61891['username']&&_0xf61891[_0x027b('0x32')]){var _0x13c391=util[_0x027b('0x46')](_0x027b('0x47'),_0xf61891[_0x027b('0x31')],_0xf61891['password']);var _0x166b15={'method':_0x027b('0x3f'),'uri':_0x027b('0x70')+_0xf61891[_0x027b('0x71')]+'/messages','body':{'to':[_0x151211['phone']],'text':_0x151211[_0x027b('0xb')],'from':_0xf61891['phone'],'applicationId':_0xf61891[_0x027b('0x72')]},'headers':{'Authorization':util['format'](_0x027b('0x48'),new Buffer(_0x13c391)['toString'](_0x027b('0x4a')))},'json':!![]};rp(_0x166b15)['then'](function(_0x4d5a2e){if(_0x4d5a2e['id']){var _0x5e2003={'messageId':_0x4d5a2e['id']};return _0x314078['update'](_0x5e2003);}else{logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x6f'),util[_0x027b('0x2c')](_0x4d5a2e,{'showHidden':![],'depth':null}));}})[_0x027b('0x1a')](function(_0x471a46){logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),'bandwidth',util[_0x027b('0x2c')](_0x471a46,{'showHidden':![],'depth':null}));});}else{logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),_0x027b('0x6f'),_0x027b('0x4f'));}break;case'intelepeer':if(_0xf61891[_0x027b('0x69')]){var _0x2e72ed={};var _0x41193a={'method':_0x027b('0x3f'),'uri':_0x027b('0x73'),'headers':{'Authorization':_0x027b('0x74')+_0xf61891[_0x027b('0x69')],'Content-Type':'application/json'},'body':{'from':_0xf61891[_0x027b('0x20')],'to':_0x151211[_0x027b('0x20')],'text':_0x151211[_0x027b('0xb')]},'json':!![]};return rp(_0x41193a)[_0x027b('0x17')](function(_0x374053){if(_0x374053[_0x027b('0x75')]==0xca){_0x2e72ed['message']=_0x374053;var _0x198bc9={'method':_0x027b('0x3f'),'uri':_0x027b('0x76'),'headers':{'Authorization':_0x027b('0x74')+_0xf61891['apiKey'],'Content-Type':_0x027b('0x59')},'body':{'refid':_0x2e72ed[_0x027b('0x77')][_0x027b('0x78')]},'json':!![]};return rp(_0x198bc9)[_0x027b('0x17')](function(_0x54aa94){_0x2e72ed['status']=_0x54aa94;var _0x336f3b={'messageId':_0x2e72ed[_0x027b('0x77')][_0x027b('0x78')],'read':!![]};return _0x314078[_0x027b('0x18')](_0x336f3b);});}else{return logger[_0x027b('0x2d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x027b('0x2a'),_0x027b('0x79'),util[_0x027b('0x2c')](_0x374053,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3a52c2){return logger[_0x027b('0x2d')](_0x027b('0x29'),_0x027b('0x2a'),_0x027b('0x79'),util[_0x027b('0x2c')](_0x3a52c2,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x027b('0x29'),'afterCreate',_0x027b('0x79'),_0x027b('0x7a'));}break;}}})[_0x027b('0x7b')](function(){_0x2ef243();});}else{_0x2ef243();}}},'charset':_0x027b('0x7c'),'collate':_0x027b('0x7d')});}; \ No newline at end of file +var _0x36a3=['Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','SmsInteractionId','then','createdAt','error','SmsAccount','SmsAccountId','type','twilio','accountSid','authToken','phone','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','&password=','GET','split','POST','user_key','read','update','catch','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','deliveryReport','Missing\x20parameters:\x20authToken','%s:%s','format','Basic\x20%s','http_code','data','queued_count','messages','message_id','clickSend','plivo','/api/sms/messages/','authId','toString','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','Missing\x20parameters:\x20base_url','csc','apiKey','login','sort','createHash','md5','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','uuid','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','base64','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x36a3,0x151));var _0x336a=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x36a3[_0x874cf1];return _0x233579;};'use strict';var _=require('lodash');var util=require(_0x336a('0x0'));var logger=require(_0x336a('0x1'))('api');var moment=require(_0x336a('0x2'));var BPromise=require(_0x336a('0x3'));var rp=require(_0x336a('0x4'));var fs=require('fs');var path=require(_0x336a('0x5'));var rimraf=require(_0x336a('0x6'));var config=require(_0x336a('0x7'));var attributes=require('./smsMessage.attributes');module[_0x336a('0x8')]=function(_0x5be596,_0x1986ec){return _0x5be596['define'](_0x336a('0x9'),attributes,{'tableName':_0x336a('0xa'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x336a('0xb')]},{'name':_0x336a('0xc'),'fields':[_0x336a('0xd')],'type':_0x336a('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x43cb75,_0x3f4dbc,_0x2d52ff){var _0x180cb3=_0x5be596[_0x336a('0xf')];var _0x4cfcd2=_0x43cb75['get']({'plain':!![]});if(_0x4cfcd2[_0x336a('0x10')]['toLowerCase']()==='in'||_0x4cfcd2[_0x336a('0x10')][_0x336a('0x11')]()===_0x336a('0x12')&&!_0x4cfcd2[_0x336a('0x13')]&&!_[_0x336a('0x14')](_0x4cfcd2[_0x336a('0x15')])&&!_[_0x336a('0x14')](_0x4cfcd2['SmsInteractionId'])){_0x180cb3[_0x336a('0x16')]['findOne']({'where':{'id':_0x4cfcd2[_0x336a('0x17')]}})[_0x336a('0x18')](function(_0x55f544){if(_0x55f544){_0x55f544['update']({'lastMsgAt':_0x4cfcd2[_0x336a('0x19')],'lastMsgDirection':_0x4cfcd2['direction'][_0x336a('0x11')]()});}})['catch'](function(_0x535cc9){console[_0x336a('0x1a')](_0x535cc9);});}if(_0x4cfcd2['direction']===_0x336a('0x12')&&!_0x4cfcd2[_0x336a('0x13')]){var _0x4b3503;_0x180cb3[_0x336a('0x1b')]['find']({'where':{'id':_0x4cfcd2[_0x336a('0x1c')]},'raw':!![]})[_0x336a('0x18')](function(_0x373a83){_0x4b3503=_0x373a83;if(_0x4b3503&&_0x4b3503[_0x336a('0x1d')]){switch(_0x4b3503[_0x336a('0x1d')]){case _0x336a('0x1e'):var _0x80f068=require(_0x336a('0x1e'));if(_0x4b3503[_0x336a('0x1f')]&&_0x4b3503[_0x336a('0x20')]&&_0x4b3503[_0x336a('0x21')]){var _0x40b9a7=new _0x80f068(_0x4b3503[_0x336a('0x1f')],_0x4b3503[_0x336a('0x20')]);_0x40b9a7['messages']['create']({'body':_0x4cfcd2[_0x336a('0xd')],'to':_0x4cfcd2[_0x336a('0x21')],'from':_0x4b3503['phone'],'statusCallback':_0x4b3503[_0x336a('0x22')]+'/api/sms/messages/'+_0x4cfcd2['id']+_0x336a('0x23')+_0x4b3503[_0x336a('0x24')]})[_0x336a('0x18')](function(_0x2ce7ae){if(_0x2ce7ae['sid']){return _0x43cb75['update']({'messageId':_0x2ce7ae[_0x336a('0x25')]});}})['catch'](function(_0x287efb){logger['error'](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x1e'),util[_0x336a('0x28')](_0x287efb,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x1e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x336a('0x29'):var _0x40a10d=_0x336a('0x2a');if(_0x4b3503['username']&&_0x4b3503[_0x336a('0x2b')]){var _0x191662={'recipient':[_0x4cfcd2[_0x336a('0x21')]],'message':_0x4cfcd2[_0x336a('0xd')],'message_type':_0x4b3503[_0x336a('0x2c')]};if(_0x4b3503[_0x336a('0x2c')]&&_0x4b3503[_0x336a('0x2c')]!=='SI'){_0x191662[_0x336a('0x2d')]=_0x4b3503[_0x336a('0x21')];}var _0x3a05db={'url':_0x40a10d+_0x336a('0x2e')+_0x4b3503[_0x336a('0x2f')]+_0x336a('0x30')+_0x4b3503[_0x336a('0x2b')],'method':_0x336a('0x31')};rp(_0x3a05db)['then'](function(_0x9f750e){var _0x1b570a=_0x9f750e[_0x336a('0x32')](';');var _0x375d5d={'user_key':_0x1b570a[0x0],'session_key':_0x1b570a[0x1]};_0x3a05db={'url':_0x40a10d+'sms','method':_0x336a('0x33'),'headers':{'user_key':_0x375d5d[_0x336a('0x34')],'Session_key':_0x375d5d['session_key']},'json':!![],'body':_0x191662};return rp(_0x3a05db);})['then'](function(_0x54f109){if(_0x54f109['total_sent']>=0x1){var _0x4a5fac={'messageId':_0x54f109['internal_order_id']};if(_0x4b3503[_0x336a('0x2c')]!=='GP'||!_0x4b3503['deliveryReport']){_0x4a5fac[_0x336a('0x35')]=!![];}return _0x43cb75[_0x336a('0x36')](_0x4a5fac);}else{return logger[_0x336a('0x1a')](_0x336a('0x26'),'afterCreate',_0x336a('0x29'),util[_0x336a('0x28')](_0x54f109,{'showHidden':![],'depth':null}));}})[_0x336a('0x37')](function(_0x49ac27){return logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'skebby',util[_0x336a('0x28')](_0x49ac27,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')](_0x336a('0x26'),'afterCreate','skebby',_0x336a('0x38'));}break;case _0x336a('0x39'):if(_0x4b3503['authToken']){var _0x406f75={'recipient':_0x4cfcd2['phone'],'message':_0x4cfcd2[_0x336a('0xd')],'sender':_0x4b3503[_0x336a('0x3a')]||_0x4b3503[_0x336a('0x21')],'authorization':_0x4b3503[_0x336a('0x20')]};var _0x3f4dbc={'method':'POST','uri':_0x336a('0x3b'),'body':_0x406f75,'json':!![]};rp(_0x3f4dbc)[_0x336a('0x18')](function(_0x5403c9){var _0x54d855={'messageId':_0x5403c9['requestid']};if(!_0x4b3503[_0x336a('0x3c')]){_0x54d855[_0x336a('0x35')]=!![];}return _0x43cb75[_0x336a('0x36')](_0x54d855);})['catch'](function(_0x1acc92){logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'connectel',util[_0x336a('0x28')](_0x1acc92,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x336a('0x39'),_0x336a('0x3d'));}break;case'clicksend':if(_0x4b3503[_0x336a('0x2f')]&&_0x4b3503[_0x336a('0x2b')]){var _0x406f75={'messages':[{'source':'xCALLY\x20Motion','to':_0x4cfcd2[_0x336a('0x21')],'body':_0x4cfcd2['body'],'from':_0x4b3503['senderString']||_0x4b3503['phone']}]};var _0x5986d7=util['format'](_0x336a('0x3e'),_0x4b3503['username'],_0x4b3503['password']);var _0x3f4dbc={'method':'POST','uri':'https://rest.clicksend.com/v3/sms/send','body':_0x406f75,'headers':{'Authorization':util[_0x336a('0x3f')](_0x336a('0x40'),new Buffer(_0x5986d7)['toString']('base64'))},'json':!![]};rp(_0x3f4dbc)[_0x336a('0x18')](function(_0x4a183f){if(_0x4a183f[_0x336a('0x41')]>=0xc8&&_0x4a183f['http_code']<=0xce){if(_0x4a183f[_0x336a('0x42')]&&_0x4a183f[_0x336a('0x42')][_0x336a('0x43')]>0x0){var _0x1a82ee=_['head'](_0x4a183f[_0x336a('0x42')][_0x336a('0x44')]);var _0x440c33={'messageId':_0x1a82ee[_0x336a('0x45')]};if(!_0x4b3503[_0x336a('0x3c')]){_0x440c33[_0x336a('0x35')]=!![];}return _0x43cb75[_0x336a('0x36')](_0x440c33);}else{logger[_0x336a('0x1a')](_0x336a('0x26'),'afterCreate',_0x336a('0x46'),util[_0x336a('0x28')](_0x4a183f,{'showHidden':![],'depth':null}));}}else{logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),'clickSend',util[_0x336a('0x28')](_0x4a183f,{'showHidden':![],'depth':null}));}})[_0x336a('0x37')](function(_0x2f3dff){logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x46'),util['inspect'](_0x2f3dff,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')](_0x336a('0x26'),'afterCreate',_0x336a('0x46'),_0x336a('0x38'));}break;case _0x336a('0x47'):if(_0x4b3503['authId']&&_0x4b3503[_0x336a('0x20')]){var _0x406f75={'dst':_0x4cfcd2['phone'],'text':_0x4cfcd2[_0x336a('0xd')],'src':_0x4b3503[_0x336a('0x3a')]||_0x4b3503[_0x336a('0x21')],'url':_0x4b3503[_0x336a('0x22')]+_0x336a('0x48')+_0x4cfcd2['id']+_0x336a('0x23')+_0x4b3503[_0x336a('0x24')]};var _0x5986d7=util[_0x336a('0x3f')](_0x336a('0x3e'),_0x4b3503[_0x336a('0x49')],_0x4b3503[_0x336a('0x20')]);var _0x3f4dbc={'method':_0x336a('0x33'),'uri':util[_0x336a('0x3f')]('https://api.plivo.com/v1/Account/%s/Message/',_0x4b3503['authId']),'body':_0x406f75,'headers':{'Authorization':util[_0x336a('0x3f')]('Basic\x20%s',new Buffer(_0x5986d7)[_0x336a('0x4a')]('base64'))},'json':!![]};rp(_0x3f4dbc)[_0x336a('0x18')](function(_0xb22a29){var _0x16ebc1={'messageId':_0xb22a29['message_uuid'][0x0]};return _0x43cb75[_0x336a('0x36')](_0x16ebc1);})[_0x336a('0x37')](function(_0x1e07d5){logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),'plivo',util[_0x336a('0x28')](_0x1e07d5,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x47'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x336a('0x4b'):if(_0x4b3503[_0x336a('0x2f')]&&_0x4b3503[_0x336a('0x2b')]){if(_0x4b3503[_0x336a('0x4c')]){var _0x5a386b={'method':_0x336a('0x33'),'uri':_0x4b3503[_0x336a('0x4c')]+_0x336a('0x4d'),'body':{'username':_0x4b3503[_0x336a('0x2f')],'password':_0x4b3503['password']},'json':!![]};return rp(_0x5a386b)[_0x336a('0x18')](function(_0x22c696){var _0x12addf={'method':'POST','uri':_0x4b3503[_0x336a('0x4c')]+_0x336a('0x4e'),'body':{'messages':[{'from':_0x4b3503[_0x336a('0x21')],'destinations':[{'to':_0x4cfcd2['phone']}],'text':_0x4cfcd2['body'],'notifyUrl':_0x4b3503[_0x336a('0x22')]+_0x336a('0x48')+_0x4cfcd2['id']+_0x336a('0x23')+_0x4b3503[_0x336a('0x24')],'notifyContentType':'application/json','callbackData':_0x4b3503[_0x336a('0x21')]+';'+_0x4cfcd2[_0x336a('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x22c696['token']},'json':!![]};return rp(_0x12addf)[_0x336a('0x18')](function(_0x51d100){if(_0x51d100[_0x336a('0x44')]){var _0x2ce2f7={'messageId':_0x51d100[_0x336a('0x44')][0x0][_0x336a('0xb')]};if(!_0x4b3503[_0x336a('0x3c')]){_0x2ce2f7[_0x336a('0x35')]=!![];}return _0x43cb75['update'](_0x2ce2f7);}else{return logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x4b'),util[_0x336a('0x28')](_0x51d100,{'showHidden':![],'depth':null}));}});})[_0x336a('0x37')](function(_0x51c99d){return logger['error'](_0x336a('0x26'),'afterCreate','infobip',util[_0x336a('0x28')](_0x51c99d,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x4b'),_0x336a('0x4f'));}}else{logger[_0x336a('0x1a')](_0x336a('0x26'),'afterCreate',_0x336a('0x4b'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x336a('0x50'):var _0x4198e5=require('crypto');if(_0x4b3503[_0x336a('0x51')]){var _0x17c2e0={};_0x17c2e0[_0x336a('0x52')]=_0x4b3503[_0x336a('0x2f')];_0x17c2e0['phone']=_0x4cfcd2[_0x336a('0x21')];_0x17c2e0['sender']=_0x4b3503[_0x336a('0x21')];_0x17c2e0['text']=_0x4cfcd2['body'];_0x17c2e0['timestamp']=+new Date();var _0x33e686='';var _0x282529='';var _0x134c4a=Object['keys'](_0x17c2e0);_0x134c4a[_0x336a('0x53')]();for(var _0x45add5=0x0;_0x45add5<_0x134c4a['length'];_0x45add5++){if(_0x33e686!=''){_0x33e686+='&';}_0x33e686+=_0x134c4a[_0x45add5]+'='+encodeURIComponent(_0x17c2e0[_0x134c4a[_0x45add5]]);_0x282529+=_0x17c2e0[_0x134c4a[_0x45add5]];}_0x282529+=_0x4b3503[_0x336a('0x51')];_0x282529=_0x4198e5[_0x336a('0x54')](_0x336a('0x55'))[_0x336a('0x36')](_0x282529)['digest'](_0x336a('0x56'));if(_0x33e686!==''){_0x33e686+='&';}_0x33e686+=_0x336a('0x57')+_0x282529;var _0x3a05db={'method':_0x336a('0x31'),'uri':_0x4b3503['baseUrl']+_0x336a('0x58')+_0x33e686,'json':!![]};return rp(_0x3a05db)['then'](function(_0x17b68e){var _0x4d77c7=Object['keys'](_0x17b68e);if(_0x17b68e[_0x4d77c7[0x0]][_0x336a('0x1a')]&&parseInt(_0x17b68e[_0x4d77c7[0x0]][_0x336a('0x1a')])===0x0){var _0x54e62b={'messageId':_0x17b68e[_0x4d77c7[0x0]]['id_sms']};if(!_0x4b3503[_0x336a('0x3c')]){_0x54e62b[_0x336a('0x35')]=!![];}return _0x43cb75['update'](_0x54e62b);}else{return logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'csc',util[_0x336a('0x28')](_0x17b68e['error'],{'showHidden':![],'depth':null}));}})[_0x336a('0x37')](function(_0x5c0a2e){return logger['error'](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x50'),util['inspect'](_0x5c0a2e,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'csc',_0x336a('0x59'));}break;case _0x336a('0x5a'):if(_0x4b3503[_0x336a('0x51')]){var _0x36912e={'method':_0x336a('0x33'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x4b3503['apiKey']},'body':{'content':_0x4cfcd2[_0x336a('0xd')],'to':[_0x4cfcd2[_0x336a('0x21')]],'from':_0x4b3503[_0x336a('0x21')],'binary':![],'clientMessageId':_0x336a('0x5b'),'charset':_0x336a('0x5c')},'json':!![]};rp(_0x36912e)[_0x336a('0x18')](function(_0x18b9d4){if(!_0x18b9d4[_0x336a('0x1a')]){var _0x3c6fb4={'messageId':_0x18b9d4[_0x336a('0x44')][0x0][_0x336a('0x5d')]};if(!_0x4b3503[_0x336a('0x3c')]){_0x3c6fb4[_0x336a('0x35')]=!![];}return _0x43cb75['update'](_0x3c6fb4);}else{return logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'clickatell',util[_0x336a('0x28')](_0x18b9d4[_0x336a('0x1a')],{'showHidden':![],'depth':null}));}})[_0x336a('0x37')](function(_0x411b79){return logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x336a('0x5a'),util[_0x336a('0x28')](_0x411b79,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x336a('0x26'),'afterCreate',_0x336a('0x5a'),'Missing\x20parameters:\x20apiKey');}break;case _0x336a('0x5e'):if(_0x4b3503[_0x336a('0x2f')]&&_0x4b3503[_0x336a('0x2b')]){var _0x5986d7=util[_0x336a('0x3f')](_0x336a('0x3e'),_0x4b3503[_0x336a('0x2f')],_0x4b3503[_0x336a('0x2b')]);var _0x3f4dbc={'method':_0x336a('0x33'),'uri':_0x336a('0x5f')+_0x4b3503[_0x336a('0x60')]+_0x336a('0x61'),'body':{'to':[_0x4cfcd2['phone']],'text':_0x4cfcd2[_0x336a('0xd')],'from':_0x4b3503[_0x336a('0x21')],'applicationId':_0x4b3503['applicationId']},'headers':{'Authorization':util[_0x336a('0x3f')](_0x336a('0x40'),new Buffer(_0x5986d7)[_0x336a('0x4a')](_0x336a('0x62')))},'json':!![]};rp(_0x3f4dbc)[_0x336a('0x18')](function(_0x5eb3cf){if(_0x5eb3cf['id']){var _0xfee1dd={'messageId':_0x5eb3cf['id']};return _0x43cb75[_0x336a('0x36')](_0xfee1dd);}else{logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),'bandwidth',util['inspect'](_0x5eb3cf,{'showHidden':![],'depth':null}));}})[_0x336a('0x37')](function(_0x160ffa){logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x5e'),util['inspect'](_0x160ffa,{'showHidden':![],'depth':null}));});}else{logger[_0x336a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x5e'),_0x336a('0x38'));}break;case'intelepeer':if(_0x4b3503[_0x336a('0x51')]){var _0x1a2401={};var _0x3a05db={'method':_0x336a('0x33'),'uri':_0x336a('0x63'),'headers':{'Authorization':_0x336a('0x64')+_0x4b3503['apiKey'],'Content-Type':_0x336a('0x65')},'body':{'from':_0x4b3503[_0x336a('0x21')],'to':_0x4cfcd2[_0x336a('0x21')],'text':_0x4cfcd2[_0x336a('0xd')]},'json':!![]};return rp(_0x3a05db)[_0x336a('0x18')](function(_0x27d1ee){if(_0x27d1ee[_0x336a('0x66')]==0xca){_0x1a2401['message']=_0x27d1ee;var _0x1570f2={'method':_0x336a('0x33'),'uri':_0x336a('0x67'),'headers':{'Authorization':_0x336a('0x64')+_0x4b3503[_0x336a('0x51')],'Content-Type':_0x336a('0x65')},'body':{'refid':_0x1a2401['message'][_0x336a('0x68')]},'json':!![]};return rp(_0x1570f2)['then'](function(_0x4c5446){_0x1a2401[_0x336a('0x69')]=_0x4c5446;var _0x41f100={'messageId':_0x1a2401['message']['refid'],'read':!![]};return _0x43cb75[_0x336a('0x36')](_0x41f100);});}else{return logger[_0x336a('0x1a')](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x6a'),util[_0x336a('0x28')](_0x27d1ee,{'showHidden':![],'depth':null}));}})['catch'](function(_0xd0b723){return logger['error'](_0x336a('0x26'),_0x336a('0x27'),_0x336a('0x6a'),util[_0x336a('0x28')](_0xd0b723,{'showHidden':![],'depth':null}));});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x336a('0x27'),_0x336a('0x6a'),_0x336a('0x6b'));}break;}}})[_0x336a('0x6c')](function(){_0x2d52ff();});}else{_0x2d52ff();}}},'charset':_0x336a('0x6d'),'collate':_0x336a('0x6e')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index d288a9f..f307233 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 _0xb01e=['client','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','SmsMessage,\x20%s,\x20%s','result','SmsMessage','create','options','CreateSmsMessage','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x465010,_0x269113){var _0x31f794=function(_0x52335a){while(--_0x52335a){_0x465010['push'](_0x465010['shift']());}};_0x31f794(++_0x269113);}(_0xb01e,0x8d));var _0xeb01=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb01e[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require(_0xeb01('0x0'));var moment=require(_0xeb01('0x1'));var BPromise=require(_0xeb01('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeb01('0x3'))['db'];var utils=require(_0xeb01('0x4'));var logger=require(_0xeb01('0x5'))(_0xeb01('0x6'));var config=require(_0xeb01('0x7'));var jayson=require(_0xeb01('0x8'));var client=jayson[_0xeb01('0x9')]['http']({'port':0x232a});config['redis']=_[_0xeb01('0xa')](config[_0xeb01('0xb')],{'host':_0xeb01('0xc'),'port':0x18eb});var socket=require(_0xeb01('0xd'))(new Redis(config[_0xeb01('0xb')]));require(_0xeb01('0xe'))['register'](socket);function respondWithRpcPromise(_0x4c7e91,_0x161c15,_0xcc16a0){return new BPromise(function(_0x45c140,_0x17e2fd){return client[_0xeb01('0xf')](_0x4c7e91,_0xcc16a0)[_0xeb01('0x10')](function(_0xba3c){logger[_0xeb01('0x11')]('SmsMessage,\x20%s,\x20%s',_0x161c15,_0xeb01('0x12'));logger[_0xeb01('0x13')](_0xeb01('0x14'),_0x161c15,_0xeb01('0x12'),JSON['stringify'](_0xba3c));if(_0xba3c[_0xeb01('0x15')]){if(_0xba3c[_0xeb01('0x15')]['code']===0x1f4){logger[_0xeb01('0x15')]('SmsMessage,\x20%s,\x20%s',_0x161c15,_0xba3c['error'][_0xeb01('0x16')]);return _0x17e2fd(_0xba3c[_0xeb01('0x15')]['message']);}logger['error'](_0xeb01('0x17'),_0x161c15,_0xba3c['error'][_0xeb01('0x16')]);return _0x45c140(_0xba3c[_0xeb01('0x15')][_0xeb01('0x16')]);}else{logger[_0xeb01('0x11')]('SmsMessage,\x20%s,\x20%s',_0x161c15,'request\x20sent');_0x45c140(_0xba3c[_0xeb01('0x18')][_0xeb01('0x16')]);}})['catch'](function(_0x1db96d){logger['error'](_0xeb01('0x17'),_0x161c15,_0x1db96d);_0x17e2fd(_0x1db96d);});});}exports['CreateSmsMessage']=function(_0x372f29){var _0x3d4a56=this;return new Promise(function(_0x59618c,_0x1a0d18){return db[_0xeb01('0x19')][_0xeb01('0x1a')](_0x372f29['body'],{'raw':_0x372f29[_0xeb01('0x1b')]?_0x372f29['options']['raw']===undefined?!![]:![]:!![]})[_0xeb01('0x10')](function(_0x26d99f){logger[_0xeb01('0x11')](_0xeb01('0x1c'),_0x372f29);logger[_0xeb01('0x13')](_0xeb01('0x1c'),_0x372f29,JSON['stringify'](_0x26d99f));_0x59618c(_0x26d99f);})[_0xeb01('0x1d')](function(_0xfc9fc1){logger[_0xeb01('0x15')](_0xeb01('0x1c'),_0xfc9fc1[_0xeb01('0x16')],_0x372f29);_0x1a0d18(_0x3d4a56[_0xeb01('0x15')](0x1f4,_0xfc9fc1[_0xeb01('0x16')]));});});}; \ No newline at end of file +var _0x1639=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','SmsMessage','create','body','options','raw','then','CreateSmsMessage','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x580ffa,_0x338e4a){var _0x2fa3d3=function(_0x992bc4){while(--_0x992bc4){_0x580ffa['push'](_0x580ffa['shift']());}};_0x2fa3d3(++_0x338e4a);}(_0x1639,0x1d6));var _0x9163=function(_0x154d2d,_0x2faa49){_0x154d2d=_0x154d2d-0x0;var _0x1ae71a=_0x1639[_0x154d2d];return _0x1ae71a;};'use strict';var _=require(_0x9163('0x0'));var util=require(_0x9163('0x1'));var moment=require('moment');var BPromise=require(_0x9163('0x2'));var rs=require(_0x9163('0x3'));var fs=require('fs');var Redis=require(_0x9163('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9163('0x5'));var logger=require(_0x9163('0x6'))(_0x9163('0x7'));var config=require(_0x9163('0x8'));var jayson=require(_0x9163('0x9'));var client=jayson[_0x9163('0xa')][_0x9163('0xb')]({'port':0x232a});config['redis']=_[_0x9163('0xc')](config[_0x9163('0xd')],{'host':_0x9163('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9163('0xd')]));require('./smsMessage.socket')[_0x9163('0xf')](socket);function respondWithRpcPromise(_0x5d40bf,_0x51d310,_0x2f5c74){return new BPromise(function(_0x2db65d,_0x4b6f9a){return client['request'](_0x5d40bf,_0x2f5c74)['then'](function(_0x2fdbc1){logger['info'](_0x9163('0x10'),_0x51d310,'request\x20sent');logger[_0x9163('0x11')](_0x9163('0x12'),_0x51d310,_0x9163('0x13'),JSON[_0x9163('0x14')](_0x2fdbc1));if(_0x2fdbc1[_0x9163('0x15')]){if(_0x2fdbc1[_0x9163('0x15')][_0x9163('0x16')]===0x1f4){logger['error'](_0x9163('0x10'),_0x51d310,_0x2fdbc1[_0x9163('0x15')][_0x9163('0x17')]);return _0x4b6f9a(_0x2fdbc1[_0x9163('0x15')][_0x9163('0x17')]);}logger[_0x9163('0x15')](_0x9163('0x10'),_0x51d310,_0x2fdbc1[_0x9163('0x15')][_0x9163('0x17')]);return _0x2db65d(_0x2fdbc1[_0x9163('0x15')][_0x9163('0x17')]);}else{logger[_0x9163('0x18')](_0x9163('0x10'),_0x51d310,_0x9163('0x13'));_0x2db65d(_0x2fdbc1[_0x9163('0x19')][_0x9163('0x17')]);}})[_0x9163('0x1a')](function(_0x2a04cc){logger['error'](_0x9163('0x10'),_0x51d310,_0x2a04cc);_0x4b6f9a(_0x2a04cc);});});}exports['CreateSmsMessage']=function(_0x735737){var _0x577636=this;return new Promise(function(_0x3e42b6,_0x5c825d){return db[_0x9163('0x1b')][_0x9163('0x1c')](_0x735737[_0x9163('0x1d')],{'raw':_0x735737[_0x9163('0x1e')]?_0x735737[_0x9163('0x1e')][_0x9163('0x1f')]===undefined?!![]:![]:!![]})[_0x9163('0x20')](function(_0x579bf7){logger[_0x9163('0x18')](_0x9163('0x21'),_0x735737);logger[_0x9163('0x11')](_0x9163('0x21'),_0x735737,JSON[_0x9163('0x14')](_0x579bf7));_0x3e42b6(_0x579bf7);})[_0x9163('0x1a')](function(_0x894213){logger['error'](_0x9163('0x21'),_0x894213['message'],_0x735737);_0x5c825d(_0x577636[_0x9163('0x15')](0x1f4,_0x894213['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 801df93..76d6a1f 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 _0x49e8=['save','remove','update','emit','removeListener','register','length','./smsMessage.events'];(function(_0x40fade,_0x6379){var _0x55b4c5=function(_0x347c48){while(--_0x347c48){_0x40fade['push'](_0x40fade['shift']());}};_0x55b4c5(++_0x6379);}(_0x49e8,0x157));var _0x849e=function(_0x345a17,_0x3b9d2a){_0x345a17=_0x345a17-0x0;var _0xd0f947=_0x49e8[_0x345a17];return _0xd0f947;};'use strict';var SmsMessageEvents=require(_0x849e('0x0'));var events=[_0x849e('0x1'),_0x849e('0x2'),_0x849e('0x3')];function createListener(_0x48e19e,_0x44da54){return function(_0x8b8476){_0x44da54[_0x849e('0x4')](_0x48e19e,_0x8b8476);};}function removeListener(_0x3f68a3,_0x3b519e){return function(){SmsMessageEvents[_0x849e('0x5')](_0x3f68a3,_0x3b519e);};}exports[_0x849e('0x6')]=function(_0x11189b){for(var _0x444db2=0x0,_0x38a06f=events[_0x849e('0x7')];_0x444db2<_0x38a06f;_0x444db2++){var _0x5cc91e=events[_0x444db2];var _0x221894=createListener('smsMessage:'+_0x5cc91e,_0x11189b);SmsMessageEvents['on'](_0x5cc91e,_0x221894);}}; \ No newline at end of file +var _0xa5fb=['./smsMessage.events','save','remove','update','emit','register','length'];(function(_0x470212,_0x1387de){var _0x5083cb=function(_0x3bec27){while(--_0x3bec27){_0x470212['push'](_0x470212['shift']());}};_0x5083cb(++_0x1387de);}(_0xa5fb,0x1e3));var _0xba5f=function(_0x50a53c,_0x31cf4e){_0x50a53c=_0x50a53c-0x0;var _0x28840c=_0xa5fb[_0x50a53c];return _0x28840c;};'use strict';var SmsMessageEvents=require(_0xba5f('0x0'));var events=[_0xba5f('0x1'),_0xba5f('0x2'),_0xba5f('0x3')];function createListener(_0x3d99e5,_0x57147e){return function(_0x2a281f){_0x57147e[_0xba5f('0x4')](_0x3d99e5,_0x2a281f);};}function removeListener(_0x3c2f83,_0x4139c6){return function(){SmsMessageEvents['removeListener'](_0x3c2f83,_0x4139c6);};}exports[_0xba5f('0x5')]=function(_0x1c67e9){for(var _0x3c1cc1=0x0,_0x3c4585=events[_0xba5f('0x6')];_0x3c1cc1<_0x3c4585;_0x3c1cc1++){var _0x141cf3=events[_0x3c1cc1];var _0x1ac995=createListener('smsMessage:'+_0x141cf3,_0x1c67e9);SmsMessageEvents['on'](_0x141cf3,_0x1ac995);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 90d2ac0..88737df 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 _0x199d=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','delete','/:id','removeTeams','removeAgents','exports','multer','path'];(function(_0x48274e,_0x2fcce4){var _0x464908=function(_0x5ab36c){while(--_0x5ab36c){_0x48274e['push'](_0x48274e['shift']());}};_0x464908(++_0x2fcce4);}(_0x199d,0x85));var _0xd199=function(_0x4c630b,_0x25f8ef){_0x4c630b=_0x4c630b-0x0;var _0x181259=_0x199d[_0x4c630b];return _0x181259;};'use strict';var multer=require(_0xd199('0x0'));var util=require('util');var path=require(_0xd199('0x1'));var timeout=require('connect-timeout');var express=require(_0xd199('0x2'));var router=express['Router']();var fs_extra=require(_0xd199('0x3'));var auth=require(_0xd199('0x4'));var interaction=require(_0xd199('0x5'));var config=require(_0xd199('0x6'));var controller=require(_0xd199('0x7'));router[_0xd199('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd199('0x8')](_0xd199('0x9'),auth[_0xd199('0xa')](),controller[_0xd199('0xb')]);router[_0xd199('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xd199('0xc')]);router[_0xd199('0x8')](_0xd199('0xd'),auth[_0xd199('0xa')](),controller[_0xd199('0xe')]);router[_0xd199('0x8')](_0xd199('0xf'),auth[_0xd199('0xa')](),controller[_0xd199('0x10')]);router[_0xd199('0x8')]('/:id/users',auth[_0xd199('0xa')](),controller[_0xd199('0x11')]);router[_0xd199('0x12')]('/',auth[_0xd199('0xa')](),controller['create']);router[_0xd199('0x12')]('/:id/teams',auth[_0xd199('0xa')](),controller[_0xd199('0x13')]);router[_0xd199('0x12')](_0xd199('0x14'),auth['isAuthenticated'](),controller[_0xd199('0x15')]);router['put']('/:id',auth[_0xd199('0xa')](),controller['update']);router[_0xd199('0x16')](_0xd199('0x17'),auth[_0xd199('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xd199('0xa')](),controller[_0xd199('0x18')]);router['delete'](_0xd199('0x14'),auth['isAuthenticated'](),controller[_0xd199('0x19')]);module[_0xd199('0x1a')]=router; \ No newline at end of file +var _0xd4e6=['addAgents','update','removeTeams','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','/:id/users'];(function(_0x4fe79a,_0x3f49e5){var _0x813a0a=function(_0xaf46d8){while(--_0xaf46d8){_0x4fe79a['push'](_0x4fe79a['shift']());}};_0x813a0a(++_0x3f49e5);}(_0xd4e6,0x155));var _0x6d4e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xd4e6[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x6d4e('0x0'));var util=require(_0x6d4e('0x1'));var path=require('path');var timeout=require(_0x6d4e('0x2'));var express=require('express');var router=express[_0x6d4e('0x3')]();var fs_extra=require(_0x6d4e('0x4'));var auth=require(_0x6d4e('0x5'));var interaction=require(_0x6d4e('0x6'));var config=require(_0x6d4e('0x7'));var controller=require(_0x6d4e('0x8'));router[_0x6d4e('0x9')]('/',auth[_0x6d4e('0xa')](),controller[_0x6d4e('0xb')]);router['get'](_0x6d4e('0xc'),auth[_0x6d4e('0xa')](),controller[_0x6d4e('0xd')]);router[_0x6d4e('0x9')](_0x6d4e('0xe'),auth[_0x6d4e('0xa')](),controller['show']);router['get'](_0x6d4e('0xf'),auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x10')]);router['get']('/:id/teams',auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x11')]);router[_0x6d4e('0x9')]('/:id/users',auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x12')]);router[_0x6d4e('0x13')]('/',auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x14')]);router[_0x6d4e('0x13')](_0x6d4e('0x15'),auth[_0x6d4e('0xa')](),controller['addTeams']);router['post'](_0x6d4e('0x16'),auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x17')]);router['put'](_0x6d4e('0xe'),auth[_0x6d4e('0xa')](),controller[_0x6d4e('0x18')]);router['delete'](_0x6d4e('0xe'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6d4e('0x15'),auth['isAuthenticated'](),controller[_0x6d4e('0x19')]);router[_0x6d4e('0x1a')](_0x6d4e('0x16'),auth[_0x6d4e('0xa')](),controller['removeAgents']);module[_0x6d4e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 0e5682a..3fea540 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 _0x3714=['INTEGER','rrmemory','beepall','roundrobin','sequelize','STRING','name'];(function(_0x295ed6,_0x3417f2){var _0x3c574f=function(_0x2fa3b7){while(--_0x2fa3b7){_0x295ed6['push'](_0x295ed6['shift']());}};_0x3c574f(++_0x3417f2);}(_0x3714,0x107));var _0x4371=function(_0x2bf3b3,_0x4f0441){_0x2bf3b3=_0x2bf3b3-0x0;var _0xce1706=_0x3714[_0x2bf3b3];return _0xce1706;};'use strict';var Sequelize=require(_0x4371('0x0'));module['exports']={'name':{'type':Sequelize[_0x4371('0x1')],'unique':_0x4371('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4371('0x1')]},'timeout':{'type':Sequelize[_0x4371('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x4371('0x4'),_0x4371('0x5'),_0x4371('0x6'))}}; \ No newline at end of file +var _0xfe52=['ENUM','beepall','roundrobin','exports','STRING','name'];(function(_0x3cfe80,_0x366a38){var _0x11c155=function(_0x2f2dab){while(--_0x2f2dab){_0x3cfe80['push'](_0x3cfe80['shift']());}};_0x11c155(++_0x366a38);}(_0xfe52,0xf3));var _0x2fe5=function(_0x4503c0,_0x33391f){_0x4503c0=_0x4503c0-0x0;var _0x581f21=_0xfe52[_0x4503c0];return _0x581f21;};'use strict';var Sequelize=require('sequelize');module[_0x2fe5('0x0')]={'name':{'type':Sequelize[_0x2fe5('0x1')],'unique':_0x2fe5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2fe5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2fe5('0x3')]('rrmemory',_0x2fe5('0x4'),_0x2fe5('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 008f6b2..a81f9e5 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 _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x2baf40,_0x5ebef2){var _0x2bb2cb=function(_0x1a3fc1){while(--_0x1a3fc1){_0x2baf40['push'](_0x2baf40['shift']());}};_0x2bb2cb(++_0x5ebef2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x48d3c4,_0x1c98bf){_0x48d3c4=_0x48d3c4-0x0;var _0x3e564c=_0x5f2f[_0x48d3c4];return _0x3e564c;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0x552968,_0x2f8515){var _0x12b6b7=function(_0x4a70e1){while(--_0x4a70e1){_0x552968['push'](_0x552968['shift']());}};_0x12b6b7(++_0x2f8515);}(_0xdb28,0x106));var _0x8db2=function(_0x5da38a,_0x323010){_0x5da38a=_0x5da38a-0x0;var _0x206f85=_0xdb28[_0x5da38a];return _0x206f85;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index c73767a..04bf3e6 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 _0xddd3=['events','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x179bea,_0x1eb52d){var _0x4359f0=function(_0x117340){while(--_0x117340){_0x179bea['push'](_0x179bea['shift']());}};_0x4359f0(++_0x1eb52d);}(_0xddd3,0x1e8));var _0x3ddd=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xddd3[_0x46aff0];return _0x9d78cf;};'use strict';var EventEmitter=require(_0x3ddd('0x0'));var SmsQueue=require('../../mysqldb')['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x3ddd('0x1')](0x0);var events={'afterCreate':_0x3ddd('0x2'),'afterUpdate':_0x3ddd('0x3'),'afterDestroy':_0x3ddd('0x4')};function emitEvent(_0x7e36e4){return function(_0x5378ca,_0x1e0d7f,_0x424ae0){SmsQueueEvents[_0x3ddd('0x5')](_0x7e36e4+':'+_0x5378ca['id'],_0x5378ca);SmsQueueEvents[_0x3ddd('0x5')](_0x7e36e4,_0x5378ca);_0x424ae0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0x3ddd('0x6')](e,emitEvent(event));}}module[_0x3ddd('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x66d6=['emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x28813d,_0x2f3eb3){var _0x3869d1=function(_0x302fc2){while(--_0x302fc2){_0x28813d['push'](_0x28813d['shift']());}};_0x3869d1(++_0x2f3eb3);}(_0x66d6,0x67));var _0x666d=function(_0x3c2576,_0x10994b){_0x3c2576=_0x3c2576-0x0;var _0x3435d0=_0x66d6[_0x3c2576];return _0x3435d0;};'use strict';var EventEmitter=require(_0x666d('0x0'));var SmsQueue=require(_0x666d('0x1'))['db'][_0x666d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x666d('0x3')](0x0);var events={'afterCreate':_0x666d('0x4'),'afterUpdate':_0x666d('0x5'),'afterDestroy':_0x666d('0x6')};function emitEvent(_0xe2b2e3){return function(_0x453ace,_0x213404,_0x466cae){SmsQueueEvents[_0x666d('0x7')](_0xe2b2e3+':'+_0x453ace['id'],_0x453ace);SmsQueueEvents[_0x666d('0x7')](_0xe2b2e3,_0x453ace);_0x466cae(null);};}for(var e in events){if(events[_0x666d('0x8')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x666d('0x9')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index e4a2e92..7257785 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 _0x46b3=['exports','SmsQueue','sms_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsQueue.attributes'];(function(_0x53615b,_0xf060d5){var _0x6058f=function(_0x559d20){while(--_0x559d20){_0x53615b['push'](_0x53615b['shift']());}};_0x6058f(++_0xf060d5);}(_0x46b3,0x66));var _0x346b=function(_0x25f591,_0x56fe41){_0x25f591=_0x25f591-0x0;var _0x130949=_0x46b3[_0x25f591];return _0x130949;};'use strict';var _=require(_0x346b('0x0'));var util=require('util');var logger=require(_0x346b('0x1'))(_0x346b('0x2'));var moment=require(_0x346b('0x3'));var BPromise=require(_0x346b('0x4'));var rp=require(_0x346b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x346b('0x6'));var config=require('../../config/environment');var attributes=require(_0x346b('0x7'));module[_0x346b('0x8')]=function(_0x8f081e,_0x4b19f5){return _0x8f081e['define'](_0x346b('0x9'),attributes,{'tableName':_0x346b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9aa=['exports','SmsQueue','sms_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xf9aa,0xab));var _0xaf9a=function(_0x58bf7c,_0x1ab137){_0x58bf7c=_0x58bf7c-0x0;var _0x292f7f=_0xf9aa[_0x58bf7c];return _0x292f7f;};'use strict';var _=require(_0xaf9a('0x0'));var util=require(_0xaf9a('0x1'));var logger=require('../../config/logger')(_0xaf9a('0x2'));var moment=require('moment');var BPromise=require(_0xaf9a('0x3'));var rp=require(_0xaf9a('0x4'));var fs=require('fs');var path=require(_0xaf9a('0x5'));var rimraf=require(_0xaf9a('0x6'));var config=require(_0xaf9a('0x7'));var attributes=require(_0xaf9a('0x8'));module[_0xaf9a('0x9')]=function(_0x4d3dd7,_0x18fdca){return _0x4d3dd7['define'](_0xaf9a('0xa'),attributes,{'tableName':_0xaf9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index 204908a..588d41d 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 _0xeda1=['SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','map','include','ShowSmsQueue','find','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then'];(function(_0x512f81,_0x4a7986){var _0xa15099=function(_0x1f7371){while(--_0x1f7371){_0x512f81['push'](_0x512f81['shift']());}};_0xa15099(++_0x4a7986);}(_0xeda1,0x1ea));var _0x1eda=function(_0x12f7d1,_0xea85b3){_0x12f7d1=_0x12f7d1-0x0;var _0x17a408=_0xeda1[_0x12f7d1];return _0x17a408;};'use strict';var _=require('lodash');var util=require(_0x1eda('0x0'));var moment=require(_0x1eda('0x1'));var BPromise=require('bluebird');var rs=require(_0x1eda('0x2'));var fs=require('fs');var Redis=require(_0x1eda('0x3'));var db=require(_0x1eda('0x4'))['db'];var utils=require(_0x1eda('0x5'));var logger=require(_0x1eda('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1eda('0x7'));var client=jayson[_0x1eda('0x8')][_0x1eda('0x9')]({'port':0x232a});config[_0x1eda('0xa')]=_[_0x1eda('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1eda('0xc'))(new Redis(config[_0x1eda('0xa')]));require(_0x1eda('0xd'))[_0x1eda('0xe')](socket);function respondWithRpcPromise(_0x1f84ad,_0x37d5c2,_0x2af171){return new BPromise(function(_0x5cde37,_0x3ca8f9){return client[_0x1eda('0xf')](_0x1f84ad,_0x2af171)[_0x1eda('0x10')](function(_0x46fc8b){logger['info'](_0x1eda('0x11'),_0x37d5c2,_0x1eda('0x12'));logger[_0x1eda('0x13')](_0x1eda('0x14'),_0x37d5c2,_0x1eda('0x12'),JSON[_0x1eda('0x15')](_0x46fc8b));if(_0x46fc8b[_0x1eda('0x16')]){if(_0x46fc8b[_0x1eda('0x16')][_0x1eda('0x17')]===0x1f4){logger[_0x1eda('0x16')](_0x1eda('0x11'),_0x37d5c2,_0x46fc8b['error']['message']);return _0x3ca8f9(_0x46fc8b[_0x1eda('0x16')][_0x1eda('0x18')]);}logger[_0x1eda('0x16')]('SmsQueue,\x20%s,\x20%s',_0x37d5c2,_0x46fc8b[_0x1eda('0x16')]['message']);return _0x5cde37(_0x46fc8b[_0x1eda('0x16')]['message']);}else{logger[_0x1eda('0x19')](_0x1eda('0x11'),_0x37d5c2,_0x1eda('0x12'));_0x5cde37(_0x46fc8b['result'][_0x1eda('0x18')]);}})[_0x1eda('0x1a')](function(_0x224ffe){logger[_0x1eda('0x16')](_0x1eda('0x11'),_0x37d5c2,_0x224ffe);_0x3ca8f9(_0x224ffe);});});}exports[_0x1eda('0x1b')]=function(_0x49dfec){var _0x5bccf7=this;return new Promise(function(_0x73fd19,_0x51b24f){return db[_0x1eda('0x1c')]['findAll']({'raw':_0x49dfec[_0x1eda('0x1d')]?_0x49dfec['options'][_0x1eda('0x1e')]===undefined?!![]:![]:!![],'where':_0x49dfec[_0x1eda('0x1d')]?_0x49dfec[_0x1eda('0x1d')][_0x1eda('0x1f')]||null:null,'attributes':_0x49dfec[_0x1eda('0x1d')]?_0x49dfec[_0x1eda('0x1d')][_0x1eda('0x20')]||null:null,'limit':_0x49dfec[_0x1eda('0x1d')]?_0x49dfec[_0x1eda('0x1d')][_0x1eda('0x21')]||null:null,'include':_0x49dfec[_0x1eda('0x1d')]?_0x49dfec['options']['include']?_[_0x1eda('0x22')](_0x49dfec[_0x1eda('0x1d')][_0x1eda('0x23')],function(_0xfb2cbb){return{'model':db[_0xfb2cbb['model']],'as':_0xfb2cbb['as'],'attributes':_0xfb2cbb[_0x1eda('0x20')],'include':_0xfb2cbb[_0x1eda('0x23')]?_['map'](_0xfb2cbb['include'],function(_0x31ef53){return{'model':db[_0x31ef53['model']],'as':_0x31ef53['as'],'attributes':_0x31ef53['attributes'],'include':_0x31ef53[_0x1eda('0x23')]?_['map'](_0x31ef53['include'],function(_0x54f8e2){return{'model':db[_0x54f8e2['model']],'as':_0x54f8e2['as'],'attributes':_0x54f8e2[_0x1eda('0x20')]};}):[]};}):[]};}):[]:[]})[_0x1eda('0x10')](function(_0x27fcb3){logger[_0x1eda('0x19')](_0x1eda('0x1b'),_0x49dfec);logger[_0x1eda('0x13')]('GetSmsQueue',_0x49dfec,JSON[_0x1eda('0x15')](_0x27fcb3));_0x73fd19(_0x27fcb3);})[_0x1eda('0x1a')](function(_0x1238f7){logger['error'](_0x1eda('0x1b'),_0x1238f7['message'],_0x49dfec);_0x51b24f(_0x5bccf7[_0x1eda('0x16')](0x1f4,_0x1238f7[_0x1eda('0x18')]));});});};exports[_0x1eda('0x24')]=function(_0x5bbe38){var _0x61f598=this;return new Promise(function(_0x3513e5,_0x43069e){return db[_0x1eda('0x1c')][_0x1eda('0x25')]({'raw':_0x5bbe38[_0x1eda('0x1d')]?_0x5bbe38[_0x1eda('0x1d')][_0x1eda('0x1e')]===undefined?!![]:![]:!![],'where':_0x5bbe38[_0x1eda('0x1d')]?_0x5bbe38[_0x1eda('0x1d')][_0x1eda('0x1f')]||null:null,'attributes':_0x5bbe38['options']?_0x5bbe38[_0x1eda('0x1d')]['attributes']||null:null,'include':_0x5bbe38[_0x1eda('0x1d')]?_0x5bbe38['options'][_0x1eda('0x23')]?_[_0x1eda('0x22')](_0x5bbe38[_0x1eda('0x1d')][_0x1eda('0x23')],function(_0x229f04){return{'model':db[_0x229f04[_0x1eda('0x26')]],'as':_0x229f04['as'],'attributes':_0x229f04['attributes'],'include':_0x229f04['include']?_[_0x1eda('0x22')](_0x229f04[_0x1eda('0x23')],function(_0x955b63){return{'model':db[_0x955b63['model']],'as':_0x955b63['as'],'attributes':_0x955b63[_0x1eda('0x20')],'include':_0x955b63[_0x1eda('0x23')]?_[_0x1eda('0x22')](_0x955b63[_0x1eda('0x23')],function(_0x4f1487){return{'model':db[_0x4f1487[_0x1eda('0x26')]],'as':_0x4f1487['as'],'attributes':_0x4f1487[_0x1eda('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16e44b){logger[_0x1eda('0x19')](_0x1eda('0x24'),_0x5bbe38);logger[_0x1eda('0x13')]('ShowSmsQueue',_0x5bbe38,JSON['stringify'](_0x16e44b));_0x3513e5(_0x16e44b);})[_0x1eda('0x1a')](function(_0xadb374){logger[_0x1eda('0x16')](_0x1eda('0x24'),_0xadb374[_0x1eda('0x18')],_0x5bbe38);_0x43069e(_0x61f598[_0x1eda('0x16')](0x1f4,_0xadb374[_0x1eda('0x18')]));});});}; \ No newline at end of file +var _0x1689=['client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','findAll','options','attributes','include','map','model','catch','ShowSmsQueue','find','where','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x1689,0x120));var _0x9168=function(_0x5f5d69,_0x46ca8d){_0x5f5d69=_0x5f5d69-0x0;var _0x555e25=_0x1689[_0x5f5d69];return _0x555e25;};'use strict';var _=require('lodash');var util=require(_0x9168('0x0'));var moment=require(_0x9168('0x1'));var BPromise=require(_0x9168('0x2'));var rs=require(_0x9168('0x3'));var fs=require('fs');var Redis=require(_0x9168('0x4'));var db=require(_0x9168('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9168('0x6'))(_0x9168('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9168('0x8')]['http']({'port':0x232a});config[_0x9168('0x9')]=_[_0x9168('0xa')](config[_0x9168('0x9')],{'host':_0x9168('0xb'),'port':0x18eb});var socket=require(_0x9168('0xc'))(new Redis(config[_0x9168('0x9')]));require(_0x9168('0xd'))[_0x9168('0xe')](socket);function respondWithRpcPromise(_0x1271f2,_0x3a3924,_0x21ded5){return new BPromise(function(_0x3d5fe9,_0x430450){return client['request'](_0x1271f2,_0x21ded5)['then'](function(_0x5738ee){logger[_0x9168('0xf')](_0x9168('0x10'),_0x3a3924,_0x9168('0x11'));logger[_0x9168('0x12')](_0x9168('0x13'),_0x3a3924,_0x9168('0x11'),JSON[_0x9168('0x14')](_0x5738ee));if(_0x5738ee[_0x9168('0x15')]){if(_0x5738ee['error'][_0x9168('0x16')]===0x1f4){logger[_0x9168('0x15')](_0x9168('0x10'),_0x3a3924,_0x5738ee[_0x9168('0x15')][_0x9168('0x17')]);return _0x430450(_0x5738ee['error'][_0x9168('0x17')]);}logger[_0x9168('0x15')](_0x9168('0x10'),_0x3a3924,_0x5738ee[_0x9168('0x15')]['message']);return _0x3d5fe9(_0x5738ee[_0x9168('0x15')][_0x9168('0x17')]);}else{logger['info'](_0x9168('0x10'),_0x3a3924,_0x9168('0x11'));_0x3d5fe9(_0x5738ee[_0x9168('0x18')][_0x9168('0x17')]);}})['catch'](function(_0x23e724){logger[_0x9168('0x15')](_0x9168('0x10'),_0x3a3924,_0x23e724);_0x430450(_0x23e724);});});}exports[_0x9168('0x19')]=function(_0x3a6f53){var _0x3453cd=this;return new Promise(function(_0x14d660,_0x3d39bd){return db['SmsQueue'][_0x9168('0x1a')]({'raw':_0x3a6f53['options']?_0x3a6f53[_0x9168('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3a6f53['options']?_0x3a6f53['options']['where']||null:null,'attributes':_0x3a6f53[_0x9168('0x1b')]?_0x3a6f53['options'][_0x9168('0x1c')]||null:null,'limit':_0x3a6f53[_0x9168('0x1b')]?_0x3a6f53[_0x9168('0x1b')]['limit']||null:null,'include':_0x3a6f53[_0x9168('0x1b')]?_0x3a6f53[_0x9168('0x1b')][_0x9168('0x1d')]?_[_0x9168('0x1e')](_0x3a6f53[_0x9168('0x1b')][_0x9168('0x1d')],function(_0x4ae2d0){return{'model':db[_0x4ae2d0[_0x9168('0x1f')]],'as':_0x4ae2d0['as'],'attributes':_0x4ae2d0[_0x9168('0x1c')],'include':_0x4ae2d0[_0x9168('0x1d')]?_[_0x9168('0x1e')](_0x4ae2d0[_0x9168('0x1d')],function(_0x4f93d0){return{'model':db[_0x4f93d0['model']],'as':_0x4f93d0['as'],'attributes':_0x4f93d0[_0x9168('0x1c')],'include':_0x4f93d0[_0x9168('0x1d')]?_[_0x9168('0x1e')](_0x4f93d0[_0x9168('0x1d')],function(_0x197437){return{'model':db[_0x197437[_0x9168('0x1f')]],'as':_0x197437['as'],'attributes':_0x197437[_0x9168('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d5641){logger[_0x9168('0xf')](_0x9168('0x19'),_0x3a6f53);logger['debug']('GetSmsQueue',_0x3a6f53,JSON[_0x9168('0x14')](_0x1d5641));_0x14d660(_0x1d5641);})[_0x9168('0x20')](function(_0x94648a){logger[_0x9168('0x15')](_0x9168('0x19'),_0x94648a['message'],_0x3a6f53);_0x3d39bd(_0x3453cd['error'](0x1f4,_0x94648a[_0x9168('0x17')]));});});};exports[_0x9168('0x21')]=function(_0x5778e7){var _0x15c0da=this;return new Promise(function(_0x104751,_0x95d29c){return db['SmsQueue'][_0x9168('0x22')]({'raw':_0x5778e7[_0x9168('0x1b')]?_0x5778e7[_0x9168('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x5778e7[_0x9168('0x1b')]?_0x5778e7[_0x9168('0x1b')][_0x9168('0x23')]||null:null,'attributes':_0x5778e7[_0x9168('0x1b')]?_0x5778e7[_0x9168('0x1b')][_0x9168('0x1c')]||null:null,'include':_0x5778e7[_0x9168('0x1b')]?_0x5778e7[_0x9168('0x1b')][_0x9168('0x1d')]?_['map'](_0x5778e7[_0x9168('0x1b')]['include'],function(_0x462b4e){return{'model':db[_0x462b4e[_0x9168('0x1f')]],'as':_0x462b4e['as'],'attributes':_0x462b4e['attributes'],'include':_0x462b4e['include']?_[_0x9168('0x1e')](_0x462b4e['include'],function(_0x201a4b){return{'model':db[_0x201a4b[_0x9168('0x1f')]],'as':_0x201a4b['as'],'attributes':_0x201a4b[_0x9168('0x1c')],'include':_0x201a4b['include']?_[_0x9168('0x1e')](_0x201a4b[_0x9168('0x1d')],function(_0x216ff7){return{'model':db[_0x216ff7[_0x9168('0x1f')]],'as':_0x216ff7['as'],'attributes':_0x216ff7[_0x9168('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9168('0x24')](function(_0x597f06){logger['info'](_0x9168('0x21'),_0x5778e7);logger['debug'](_0x9168('0x21'),_0x5778e7,JSON['stringify'](_0x597f06));_0x104751(_0x597f06);})[_0x9168('0x20')](function(_0x28aa65){logger[_0x9168('0x15')](_0x9168('0x21'),_0x28aa65[_0x9168('0x17')],_0x5778e7);_0x95d29c(_0x15c0da[_0x9168('0x15')](0x1f4,_0x28aa65['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 5f14ec4..b0fcab9 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 _0x2547=['removeListener','register','smsQueue:','./smsQueue.events','save','remove','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x2547,0x1c3));var _0x7254=function(_0x91fea0,_0xbc4b37){_0x91fea0=_0x91fea0-0x0;var _0x5ebe20=_0x2547[_0x91fea0];return _0x5ebe20;};'use strict';var SmsQueueEvents=require(_0x7254('0x0'));var events=[_0x7254('0x1'),_0x7254('0x2'),_0x7254('0x3')];function createListener(_0x488611,_0x7b3cbf){return function(_0x317291){_0x7b3cbf['emit'](_0x488611,_0x317291);};}function removeListener(_0x424925,_0x237480){return function(){SmsQueueEvents[_0x7254('0x4')](_0x424925,_0x237480);};}exports[_0x7254('0x5')]=function(_0x52f759){for(var _0x1b1961=0x0,_0x4cb077=events['length'];_0x1b1961<_0x4cb077;_0x1b1961++){var _0x5230d8=events[_0x1b1961];var _0x2cb488=createListener(_0x7254('0x6')+_0x5230d8,_0x52f759);SmsQueueEvents['on'](_0x5230d8,_0x2cb488);}}; \ No newline at end of file +var _0xa987=['save','remove','update','emit','removeListener','register','length','smsQueue:'];(function(_0x2842bd,_0x76ab14){var _0x14ac8c=function(_0x3ee5b9){while(--_0x3ee5b9){_0x2842bd['push'](_0x2842bd['shift']());}};_0x14ac8c(++_0x76ab14);}(_0xa987,0x108));var _0x7a98=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xa987[_0x49b207];return _0x2dc8fa;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0x7a98('0x0'),_0x7a98('0x1'),_0x7a98('0x2')];function createListener(_0x3706c1,_0x258df2){return function(_0x312dd2){_0x258df2[_0x7a98('0x3')](_0x3706c1,_0x312dd2);};}function removeListener(_0x1884ad,_0x244b73){return function(){SmsQueueEvents[_0x7a98('0x4')](_0x1884ad,_0x244b73);};}exports[_0x7a98('0x5')]=function(_0x51f280){for(var _0xa69ae0=0x0,_0x39cfbf=events[_0x7a98('0x6')];_0xa69ae0<_0x39cfbf;_0xa69ae0++){var _0x1baaac=events[_0xa69ae0];var _0x481554=createListener(_0x7a98('0x7')+_0x1baaac,_0x51f280);SmsQueueEvents['on'](_0x1baaac,_0x481554);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9ae57af..9e37f7a 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 _0xb7d8=['../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','update','delete','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x3ad58c,_0x1fd63b){var _0x172063=function(_0x4cd87a){while(--_0x4cd87a){_0x3ad58c['push'](_0x3ad58c['shift']());}};_0x172063(++_0x1fd63b);}(_0xb7d8,0x163));var _0x8b7d=function(_0x5a5a11,_0x45ac63){_0x5a5a11=_0x5a5a11-0x0;var _0x510cb3=_0xb7d8[_0x5a5a11];return _0x510cb3;};'use strict';var multer=require(_0x8b7d('0x0'));var util=require(_0x8b7d('0x1'));var path=require('path');var timeout=require(_0x8b7d('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8b7d('0x3'));var auth=require(_0x8b7d('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b7d('0x5'));var controller=require(_0x8b7d('0x6'));router[_0x8b7d('0x7')]('/',auth[_0x8b7d('0x8')](),controller[_0x8b7d('0x9')]);router[_0x8b7d('0x7')](_0x8b7d('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x8b7d('0x7')](_0x8b7d('0xb'),auth[_0x8b7d('0x8')](),controller[_0x8b7d('0xc')]);router[_0x8b7d('0xd')]('/',auth[_0x8b7d('0x8')](),controller[_0x8b7d('0xe')]);router['put'](_0x8b7d('0xb'),auth[_0x8b7d('0x8')](),controller[_0x8b7d('0xf')]);router[_0x8b7d('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8b7d('0x11')]=router; \ No newline at end of file +var _0x9b8a=['isAuthenticated','index','get','/describe','describe','/:id','show','post','create','delete','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller'];(function(_0x309279,_0x35327c){var _0xe8a8d5=function(_0x137269){while(--_0x137269){_0x309279['push'](_0x309279['shift']());}};_0xe8a8d5(++_0x35327c);}(_0x9b8a,0x106));var _0xa9b8=function(_0x441eab,_0x583ba5){_0x441eab=_0x441eab-0x0;var _0xe6ff41=_0x9b8a[_0x441eab];return _0xe6ff41;};'use strict';var multer=require(_0xa9b8('0x0'));var util=require(_0xa9b8('0x1'));var path=require(_0xa9b8('0x2'));var timeout=require(_0xa9b8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa9b8('0x4'));var auth=require(_0xa9b8('0x5'));var interaction=require(_0xa9b8('0x6'));var config=require('../../config/environment');var controller=require(_0xa9b8('0x7'));router['get']('/',auth[_0xa9b8('0x8')](),controller[_0xa9b8('0x9')]);router[_0xa9b8('0xa')](_0xa9b8('0xb'),auth['isAuthenticated'](),controller[_0xa9b8('0xc')]);router[_0xa9b8('0xa')](_0xa9b8('0xd'),auth[_0xa9b8('0x8')](),controller[_0xa9b8('0xe')]);router[_0xa9b8('0xf')]('/',auth[_0xa9b8('0x8')](),controller[_0xa9b8('0x10')]);router['put'](_0xa9b8('0xd'),auth[_0xa9b8('0x8')](),controller['update']);router[_0xa9b8('0x11')](_0xa9b8('0xd'),auth[_0xa9b8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 14914c1..3034242 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 _0x6334=['DATE','moment','sequelize','exports','STRING'];(function(_0x3e3e8d,_0x4b3914){var _0x3d51d4=function(_0x3f0d40){while(--_0x3f0d40){_0x3e3e8d['push'](_0x3e3e8d['shift']());}};_0x3d51d4(++_0x4b3914);}(_0x6334,0x119));var _0x4633=function(_0x154b4c,_0xa38e2){_0x154b4c=_0x154b4c-0x0;var _0x100586=_0x6334[_0x154b4c];return _0x100586;};'use strict';var moment=require(_0x4633('0x0'));var Sequelize=require(_0x4633('0x1'));module[_0x4633('0x2')]={'uniqueid':{'type':Sequelize[_0x4633('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4633('0x3')]},'joinAt':{'type':Sequelize[_0x4633('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x4633('0x4')]},'exitAt':{'type':Sequelize[_0x4633('0x4')]},'reason':{'type':Sequelize[_0x4633('0x3')]}}; \ No newline at end of file +var _0xf0f8=['STRING','DATE','moment','sequelize','exports'];(function(_0x15cbe9,_0xeec048){var _0x18b32f=function(_0x308080){while(--_0x308080){_0x15cbe9['push'](_0x15cbe9['shift']());}};_0x18b32f(++_0xeec048);}(_0xf0f8,0xbb));var _0x8f0f=function(_0x1cbbab,_0x9fa96f){_0x1cbbab=_0x1cbbab-0x0;var _0x4d08d9=_0xf0f8[_0x1cbbab];return _0x4d08d9;};'use strict';var moment=require(_0x8f0f('0x0'));var Sequelize=require(_0x8f0f('0x1'));module[_0x8f0f('0x2')]={'uniqueid':{'type':Sequelize[_0x8f0f('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x8f0f('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8f0f('0x4')]},'exitAt':{'type':Sequelize[_0x8f0f('0x4')]},'reason':{'type':Sequelize[_0x8f0f('0x3')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 285bfdc..15931f1 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 _0xaf6c=['sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','stack','send','map','SmsQueueReport','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x315ed1,_0x1c0a0c){var _0x188b55=function(_0x376b90){while(--_0x376b90){_0x315ed1['push'](_0x315ed1['shift']());}};_0x188b55(++_0x1c0a0c);}(_0xaf6c,0x156));var _0xcaf6=function(_0x35a5c2,_0x595a75){_0x35a5c2=_0x35a5c2-0x0;var _0xc69a31=_0xaf6c[_0x35a5c2];return _0xc69a31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaf6('0x0'));var zipdir=require(_0xcaf6('0x1'));var jsonpatch=require(_0xcaf6('0x2'));var rp=require(_0xcaf6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcaf6('0x4'));var path=require('path');var sox=require(_0xcaf6('0x5'));var csv=require(_0xcaf6('0x6'));var ejs=require(_0xcaf6('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaf6('0x8'));var squel=require(_0xcaf6('0x9'));var crypto=require(_0xcaf6('0xa'));var jsforce=require(_0xcaf6('0xb'));var deskjs=require(_0xcaf6('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcaf6('0xd'));var Papa=require(_0xcaf6('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcaf6('0xf'));var hardwareService=require(_0xcaf6('0x10'));var logger=require(_0xcaf6('0x11'))(_0xcaf6('0x12'));var utils=require(_0xcaf6('0x13'));var config=require(_0xcaf6('0x14'));var licenseUtil=require(_0xcaf6('0x15'));var db=require(_0xcaf6('0x16'))['db'];function respondWithStatusCode(_0x2f61d4,_0x27d88e){_0x27d88e=_0x27d88e||0xcc;return function(_0x3eeb1d){if(_0x3eeb1d){return _0x2f61d4[_0xcaf6('0x17')](_0x27d88e);}return _0x2f61d4[_0xcaf6('0x18')](_0x27d88e)[_0xcaf6('0x19')]();};}function respondWithResult(_0x18afd2,_0x1bf724){_0x1bf724=_0x1bf724||0xc8;return function(_0x36afd2){if(_0x36afd2){return _0x18afd2[_0xcaf6('0x18')](_0x1bf724)[_0xcaf6('0x1a')](_0x36afd2);}};}function respondWithFilteredResult(_0x97e40b,_0x520f87){return function(_0x3d109b){if(_0x3d109b){var _0x1cdbe5=typeof _0x520f87[_0xcaf6('0x1b')]===_0xcaf6('0x1c')&&typeof _0x520f87[_0xcaf6('0x1d')]===_0xcaf6('0x1c');var _0x3de33b=_0x3d109b[_0xcaf6('0x1e')];var _0x3bab9b=_0x1cdbe5?0x0:_0x520f87['offset'];var _0x3a41f9=_0x1cdbe5?_0x3d109b[_0xcaf6('0x1e')]:_0x520f87[_0xcaf6('0x1b')]+_0x520f87[_0xcaf6('0x1d')];var _0x4d485e;if(_0x3a41f9>=_0x3de33b){_0x3a41f9=_0x3de33b;_0x4d485e=0xc8;}else{_0x4d485e=0xce;}_0x97e40b['status'](_0x4d485e);return _0x97e40b['set'](_0xcaf6('0x1f'),_0x3bab9b+'-'+_0x3a41f9+'/'+_0x3de33b)[_0xcaf6('0x1a')](_0x3d109b);}return null;};}function patchUpdates(_0xafc0af){return function(_0x20279a){try{jsonpatch['apply'](_0x20279a,_0xafc0af,!![]);}catch(_0x14bfa5){return BPromise[_0xcaf6('0x20')](_0x14bfa5);}return _0x20279a['save']();};}function saveUpdates(_0x46d28b,_0x5e2113){return function(_0x201127){if(_0x201127){return _0x201127[_0xcaf6('0x21')](_0x46d28b)[_0xcaf6('0x22')](function(_0x18aff5){return _0x18aff5;});}return null;};}function removeEntity(_0x5cebd2,_0x256e97){return function(_0x2cd37e){if(_0x2cd37e){return _0x2cd37e[_0xcaf6('0x23')]()[_0xcaf6('0x22')](function(){_0x5cebd2[_0xcaf6('0x18')](0xcc)[_0xcaf6('0x19')]();});}};}function handleEntityNotFound(_0x3a92bc,_0x1e767d){return function(_0x1f6dd7){if(!_0x1f6dd7){_0x3a92bc[_0xcaf6('0x17')](0x194);}return _0x1f6dd7;};}function handleError(_0x26b7af,_0x7410a4){_0x7410a4=_0x7410a4||0x1f4;return function(_0xca6cb0){logger['error'](_0xca6cb0[_0xcaf6('0x24')]);if(_0xca6cb0['name']){delete _0xca6cb0['name'];}_0x26b7af[_0xcaf6('0x18')](_0x7410a4)[_0xcaf6('0x25')](_0xca6cb0);};}exports['index']=function(_0x5309cd,_0xabe2b2){var _0x4e6074={},_0x201b37={},_0x39981e={'count':0x0,'rows':[]};var _0x3d3626=_[_0xcaf6('0x26')](db[_0xcaf6('0x27')]['rawAttributes'],function(_0x555ab1){return{'name':_0x555ab1[_0xcaf6('0x28')],'type':_0x555ab1[_0xcaf6('0x29')][_0xcaf6('0x2a')]};});_0x201b37[_0xcaf6('0x2b')]=_[_0xcaf6('0x26')](_0x3d3626,_0xcaf6('0x2c'));_0x201b37['query']=_[_0xcaf6('0x2d')](_0x5309cd[_0xcaf6('0x2e')]);_0x201b37['filters']=_[_0xcaf6('0x2f')](_0x201b37[_0xcaf6('0x2b')],_0x201b37[_0xcaf6('0x2e')]);_0x4e6074[_0xcaf6('0x30')]=_[_0xcaf6('0x2f')](_0x201b37[_0xcaf6('0x2b')],qs[_0xcaf6('0x31')](_0x5309cd['query'][_0xcaf6('0x31')]));_0x4e6074[_0xcaf6('0x30')]=_0x4e6074[_0xcaf6('0x30')][_0xcaf6('0x32')]?_0x4e6074['attributes']:_0x201b37[_0xcaf6('0x2b')];if(!_0x5309cd[_0xcaf6('0x2e')][_0xcaf6('0x33')](_0xcaf6('0x34'))){_0x4e6074[_0xcaf6('0x1d')]=qs[_0xcaf6('0x1d')](_0x5309cd['query'][_0xcaf6('0x1d')]);_0x4e6074[_0xcaf6('0x1b')]=qs[_0xcaf6('0x1b')](_0x5309cd[_0xcaf6('0x2e')][_0xcaf6('0x1b')]);}_0x4e6074[_0xcaf6('0x35')]=qs[_0xcaf6('0x36')](_0x5309cd['query'][_0xcaf6('0x36')]);_0x4e6074[_0xcaf6('0x37')]=qs[_0xcaf6('0x38')](_[_0xcaf6('0x39')](_0x5309cd['query'],_0x201b37[_0xcaf6('0x38')]),_0x3d3626);if(_0x5309cd[_0xcaf6('0x2e')][_0xcaf6('0x3a')]){_0x4e6074[_0xcaf6('0x37')]=_[_0xcaf6('0x3b')](_0x4e6074['where'],{'$or':_['map'](_0x3d3626,function(_0x5ec5c1){if(_0x5ec5c1[_0xcaf6('0x29')]!==_0xcaf6('0x3c')){var _0x5a00c2={};_0x5a00c2[_0x5ec5c1[_0xcaf6('0x2c')]]={'$like':'%'+_0x5309cd['query'][_0xcaf6('0x3a')]+'%'};return _0x5a00c2;}})});}_0x4e6074=_['merge']({},_0x4e6074,_0x5309cd['options']);var _0x2f7a94={'where':_0x4e6074[_0xcaf6('0x37')]};return db[_0xcaf6('0x27')][_0xcaf6('0x1e')](_0x2f7a94)[_0xcaf6('0x22')](function(_0xc7a86c){_0x39981e['count']=_0xc7a86c;if(_0x5309cd[_0xcaf6('0x2e')][_0xcaf6('0x3d')]){_0x4e6074[_0xcaf6('0x3e')]=[{'all':!![]}];}return db[_0xcaf6('0x27')][_0xcaf6('0x3f')](_0x4e6074);})[_0xcaf6('0x22')](function(_0x14b2a1){_0x39981e[_0xcaf6('0x40')]=_0x14b2a1;return _0x39981e;})['then'](respondWithFilteredResult(_0xabe2b2,_0x4e6074))['catch'](handleError(_0xabe2b2,null));};exports[_0xcaf6('0x41')]=function(_0x30f34c,_0x279a31){var _0xdc3d9c={'raw':!![],'where':{'id':_0x30f34c[_0xcaf6('0x42')]['id']}},_0x50bfbb={};_0x50bfbb['model']=_[_0xcaf6('0x2d')](db[_0xcaf6('0x27')][_0xcaf6('0x43')]);_0x50bfbb[_0xcaf6('0x2e')]=_['keys'](_0x30f34c[_0xcaf6('0x2e')]);_0x50bfbb['filters']=_[_0xcaf6('0x2f')](_0x50bfbb[_0xcaf6('0x2b')],_0x50bfbb[_0xcaf6('0x2e')]);_0xdc3d9c['attributes']=_['intersection'](_0x50bfbb[_0xcaf6('0x2b')],qs['fields'](_0x30f34c[_0xcaf6('0x2e')][_0xcaf6('0x31')]));_0xdc3d9c[_0xcaf6('0x30')]=_0xdc3d9c[_0xcaf6('0x30')][_0xcaf6('0x32')]?_0xdc3d9c[_0xcaf6('0x30')]:_0x50bfbb[_0xcaf6('0x2b')];if(_0x30f34c[_0xcaf6('0x2e')][_0xcaf6('0x3d')]){_0xdc3d9c['include']=[{'all':!![]}];}_0xdc3d9c=_['merge']({},_0xdc3d9c,_0x30f34c['options']);return db[_0xcaf6('0x27')]['find'](_0xdc3d9c)[_0xcaf6('0x22')](handleEntityNotFound(_0x279a31,null))[_0xcaf6('0x22')](respondWithResult(_0x279a31,null))[_0xcaf6('0x44')](handleError(_0x279a31,null));};exports['create']=function(_0x441362,_0x19f5bc){return db['SmsQueueReport'][_0xcaf6('0x45')](_0x441362[_0xcaf6('0x46')],{})[_0xcaf6('0x22')](respondWithResult(_0x19f5bc,0xc9))[_0xcaf6('0x44')](handleError(_0x19f5bc,null));};exports[_0xcaf6('0x21')]=function(_0x1f00ff,_0x1b55d1){if(_0x1f00ff[_0xcaf6('0x46')]['id']){delete _0x1f00ff[_0xcaf6('0x46')]['id'];}return db['SmsQueueReport'][_0xcaf6('0x47')]({'where':{'id':_0x1f00ff[_0xcaf6('0x42')]['id']}})[_0xcaf6('0x22')](handleEntityNotFound(_0x1b55d1,null))['then'](saveUpdates(_0x1f00ff[_0xcaf6('0x46')],null))['then'](respondWithResult(_0x1b55d1,null))[_0xcaf6('0x44')](handleError(_0x1b55d1,null));};exports[_0xcaf6('0x23')]=function(_0x4efd27,_0x5354fe){return db['SmsQueueReport'][_0xcaf6('0x47')]({'where':{'id':_0x4efd27[_0xcaf6('0x42')]['id']}})[_0xcaf6('0x22')](handleEntityNotFound(_0x5354fe,null))[_0xcaf6('0x22')](removeEntity(_0x5354fe,null))['catch'](handleError(_0x5354fe,null));};exports[_0xcaf6('0x48')]=function(_0x582ab4,_0x2e726a){return db[_0xcaf6('0x27')][_0xcaf6('0x48')]()[_0xcaf6('0x22')](respondWithResult(_0x2e726a,null))[_0xcaf6('0x44')](handleError(_0x2e726a,null));}; \ No newline at end of file +var _0xeed0=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','then','destroy','error','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x17c829,_0x10960a){var _0x55dc40=function(_0x3c0987){while(--_0x3c0987){_0x17c829['push'](_0x17c829['shift']());}};_0x55dc40(++_0x10960a);}(_0xeed0,0x182));var _0x0eed=function(_0x5c972f,_0x2806e1){_0x5c972f=_0x5c972f-0x0;var _0x41bc72=_0xeed0[_0x5c972f];return _0x41bc72;};'use strict';var emlformat=require(_0x0eed('0x0'));var rimraf=require(_0x0eed('0x1'));var zipdir=require(_0x0eed('0x2'));var jsonpatch=require(_0x0eed('0x3'));var rp=require(_0x0eed('0x4'));var moment=require(_0x0eed('0x5'));var BPromise=require(_0x0eed('0x6'));var Mustache=require(_0x0eed('0x7'));var util=require(_0x0eed('0x8'));var path=require(_0x0eed('0x9'));var sox=require(_0x0eed('0xa'));var csv=require(_0x0eed('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0eed('0xc'));var crypto=require(_0x0eed('0xd'));var jsforce=require(_0x0eed('0xe'));var deskjs=require(_0x0eed('0xf'));var toCsv=require('to-csv');var querystring=require(_0x0eed('0x10'));var Papa=require(_0x0eed('0x11'));var Redis=require(_0x0eed('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0eed('0x13'));var as=require(_0x0eed('0x14'));var hardwareService=require(_0x0eed('0x15'));var logger=require(_0x0eed('0x16'))(_0x0eed('0x17'));var utils=require(_0x0eed('0x18'));var config=require(_0x0eed('0x19'));var licenseUtil=require(_0x0eed('0x1a'));var db=require(_0x0eed('0x1b'))['db'];function respondWithStatusCode(_0x180857,_0x3a9663){_0x3a9663=_0x3a9663||0xcc;return function(_0x2ea523){if(_0x2ea523){return _0x180857[_0x0eed('0x1c')](_0x3a9663);}return _0x180857[_0x0eed('0x1d')](_0x3a9663)[_0x0eed('0x1e')]();};}function respondWithResult(_0x122c35,_0x309c7c){_0x309c7c=_0x309c7c||0xc8;return function(_0x4e5cb9){if(_0x4e5cb9){return _0x122c35['status'](_0x309c7c)[_0x0eed('0x1f')](_0x4e5cb9);}};}function respondWithFilteredResult(_0x5038ce,_0x4e3fd0){return function(_0x5448cb){if(_0x5448cb){var _0x50a68f=typeof _0x4e3fd0[_0x0eed('0x20')]===_0x0eed('0x21')&&typeof _0x4e3fd0[_0x0eed('0x22')]===_0x0eed('0x21');var _0x21d725=_0x5448cb[_0x0eed('0x23')];var _0x14f48f=_0x50a68f?0x0:_0x4e3fd0[_0x0eed('0x20')];var _0x8986cf=_0x50a68f?_0x5448cb[_0x0eed('0x23')]:_0x4e3fd0[_0x0eed('0x20')]+_0x4e3fd0['limit'];var _0x559bb2;if(_0x8986cf>=_0x21d725){_0x8986cf=_0x21d725;_0x559bb2=0xc8;}else{_0x559bb2=0xce;}_0x5038ce['status'](_0x559bb2);return _0x5038ce[_0x0eed('0x24')]('Content-Range',_0x14f48f+'-'+_0x8986cf+'/'+_0x21d725)[_0x0eed('0x1f')](_0x5448cb);}return null;};}function patchUpdates(_0x59dde4){return function(_0x525f47){try{jsonpatch[_0x0eed('0x25')](_0x525f47,_0x59dde4,!![]);}catch(_0x205f81){return BPromise[_0x0eed('0x26')](_0x205f81);}return _0x525f47['save']();};}function saveUpdates(_0x379774,_0x1aae0c){return function(_0x5aeb95){if(_0x5aeb95){return _0x5aeb95[_0x0eed('0x27')](_0x379774)[_0x0eed('0x28')](function(_0x3a0ea0){return _0x3a0ea0;});}return null;};}function removeEntity(_0x53fe46,_0x1017e8){return function(_0x1ba5b1){if(_0x1ba5b1){return _0x1ba5b1[_0x0eed('0x29')]()['then'](function(){_0x53fe46[_0x0eed('0x1d')](0xcc)[_0x0eed('0x1e')]();});}};}function handleEntityNotFound(_0x423482,_0x5a40d7){return function(_0x3fd6cb){if(!_0x3fd6cb){_0x423482[_0x0eed('0x1c')](0x194);}return _0x3fd6cb;};}function handleError(_0x3da90b,_0x32029e){_0x32029e=_0x32029e||0x1f4;return function(_0x2bb0c0){logger[_0x0eed('0x2a')](_0x2bb0c0['stack']);if(_0x2bb0c0['name']){delete _0x2bb0c0[_0x0eed('0x2b')];}_0x3da90b[_0x0eed('0x1d')](_0x32029e)[_0x0eed('0x2c')](_0x2bb0c0);};}exports[_0x0eed('0x2d')]=function(_0x43f8cb,_0x5b3531){var _0x1ad404={},_0x2405ed={},_0x1bebf6={'count':0x0,'rows':[]};var _0x13fa24=_[_0x0eed('0x2e')](db[_0x0eed('0x2f')][_0x0eed('0x30')],function(_0x5f1822){return{'name':_0x5f1822[_0x0eed('0x31')],'type':_0x5f1822['type']['key']};});_0x2405ed[_0x0eed('0x32')]=_[_0x0eed('0x2e')](_0x13fa24,'name');_0x2405ed[_0x0eed('0x33')]=_[_0x0eed('0x34')](_0x43f8cb[_0x0eed('0x33')]);_0x2405ed[_0x0eed('0x35')]=_[_0x0eed('0x36')](_0x2405ed['model'],_0x2405ed[_0x0eed('0x33')]);_0x1ad404[_0x0eed('0x37')]=_[_0x0eed('0x36')](_0x2405ed[_0x0eed('0x32')],qs[_0x0eed('0x38')](_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x38')]));_0x1ad404['attributes']=_0x1ad404[_0x0eed('0x37')][_0x0eed('0x39')]?_0x1ad404[_0x0eed('0x37')]:_0x2405ed[_0x0eed('0x32')];if(!_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x3a')]('nolimit')){_0x1ad404[_0x0eed('0x22')]=qs[_0x0eed('0x22')](_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x22')]);_0x1ad404[_0x0eed('0x20')]=qs[_0x0eed('0x20')](_0x43f8cb[_0x0eed('0x33')]['offset']);}_0x1ad404[_0x0eed('0x3b')]=qs[_0x0eed('0x3c')](_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x3c')]);_0x1ad404[_0x0eed('0x3d')]=qs[_0x0eed('0x35')](_[_0x0eed('0x3e')](_0x43f8cb[_0x0eed('0x33')],_0x2405ed[_0x0eed('0x35')]),_0x13fa24);if(_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x3f')]){_0x1ad404[_0x0eed('0x3d')]=_[_0x0eed('0x40')](_0x1ad404[_0x0eed('0x3d')],{'$or':_[_0x0eed('0x2e')](_0x13fa24,function(_0x23040e){if(_0x23040e[_0x0eed('0x41')]!==_0x0eed('0x42')){var _0x1ebaf0={};_0x1ebaf0[_0x23040e[_0x0eed('0x2b')]]={'$like':'%'+_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x3f')]+'%'};return _0x1ebaf0;}})});}_0x1ad404=_[_0x0eed('0x40')]({},_0x1ad404,_0x43f8cb['options']);var _0x284d7d={'where':_0x1ad404[_0x0eed('0x3d')]};return db[_0x0eed('0x2f')][_0x0eed('0x23')](_0x284d7d)[_0x0eed('0x28')](function(_0x56bf07){_0x1bebf6[_0x0eed('0x23')]=_0x56bf07;if(_0x43f8cb[_0x0eed('0x33')][_0x0eed('0x43')]){_0x1ad404[_0x0eed('0x44')]=[{'all':!![]}];}return db[_0x0eed('0x2f')]['findAll'](_0x1ad404);})['then'](function(_0x434b8c){_0x1bebf6[_0x0eed('0x45')]=_0x434b8c;return _0x1bebf6;})['then'](respondWithFilteredResult(_0x5b3531,_0x1ad404))[_0x0eed('0x46')](handleError(_0x5b3531,null));};exports[_0x0eed('0x47')]=function(_0xe44d87,_0x156003){var _0x2b7276={'raw':!![],'where':{'id':_0xe44d87[_0x0eed('0x48')]['id']}},_0x4f575c={};_0x4f575c[_0x0eed('0x32')]=_['keys'](db[_0x0eed('0x2f')][_0x0eed('0x30')]);_0x4f575c[_0x0eed('0x33')]=_['keys'](_0xe44d87['query']);_0x4f575c['filters']=_[_0x0eed('0x36')](_0x4f575c['model'],_0x4f575c['query']);_0x2b7276['attributes']=_[_0x0eed('0x36')](_0x4f575c[_0x0eed('0x32')],qs[_0x0eed('0x38')](_0xe44d87[_0x0eed('0x33')][_0x0eed('0x38')]));_0x2b7276[_0x0eed('0x37')]=_0x2b7276[_0x0eed('0x37')][_0x0eed('0x39')]?_0x2b7276[_0x0eed('0x37')]:_0x4f575c[_0x0eed('0x32')];if(_0xe44d87[_0x0eed('0x33')]['includeAll']){_0x2b7276[_0x0eed('0x44')]=[{'all':!![]}];}_0x2b7276=_[_0x0eed('0x40')]({},_0x2b7276,_0xe44d87[_0x0eed('0x49')]);return db[_0x0eed('0x2f')][_0x0eed('0x4a')](_0x2b7276)[_0x0eed('0x28')](handleEntityNotFound(_0x156003,null))[_0x0eed('0x28')](respondWithResult(_0x156003,null))[_0x0eed('0x46')](handleError(_0x156003,null));};exports[_0x0eed('0x4b')]=function(_0x1c2c4b,_0xd0260b){return db['SmsQueueReport'][_0x0eed('0x4b')](_0x1c2c4b[_0x0eed('0x4c')],{})[_0x0eed('0x28')](respondWithResult(_0xd0260b,0xc9))[_0x0eed('0x46')](handleError(_0xd0260b,null));};exports[_0x0eed('0x27')]=function(_0x3a8fda,_0x33d71f){if(_0x3a8fda[_0x0eed('0x4c')]['id']){delete _0x3a8fda[_0x0eed('0x4c')]['id'];}return db[_0x0eed('0x2f')]['find']({'where':{'id':_0x3a8fda['params']['id']}})[_0x0eed('0x28')](handleEntityNotFound(_0x33d71f,null))['then'](saveUpdates(_0x3a8fda[_0x0eed('0x4c')],null))['then'](respondWithResult(_0x33d71f,null))[_0x0eed('0x46')](handleError(_0x33d71f,null));};exports[_0x0eed('0x29')]=function(_0x3a5618,_0x338b30){return db['SmsQueueReport'][_0x0eed('0x4a')]({'where':{'id':_0x3a5618[_0x0eed('0x48')]['id']}})[_0x0eed('0x28')](handleEntityNotFound(_0x338b30,null))[_0x0eed('0x28')](removeEntity(_0x338b30,null))[_0x0eed('0x46')](handleError(_0x338b30,null));};exports[_0x0eed('0x4d')]=function(_0x51bdca,_0x32b544){return db['SmsQueueReport'][_0x0eed('0x4d')]()[_0x0eed('0x28')](respondWithResult(_0x32b544,null))[_0x0eed('0x46')](handleError(_0x32b544,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 3974be1..c3c9d01 100644 --- a/server/api/smsQueueReport/smsQueueReport.model.js +++ b/server/api/smsQueueReport/smsQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x5091f8,_0x3726ac){var _0x43d687=function(_0x3ca200){while(--_0x3ca200){_0x5091f8['push'](_0x5091f8['shift']());}};_0x43d687(++_0x3726ac);}(_0x70e0,0x17b));var _0x070e=function(_0x511238,_0x38450e){_0x511238=_0x511238-0x0;var _0x15572c=_0x70e0[_0x511238];return _0x15572c;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0x1d70db,_0x142b63){var _0x3060c6=function(_0x347866){while(--_0x347866){_0x1d70db['push'](_0x1d70db['shift']());}};_0x3060c6(++_0x142b63);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0358d3c..afb9d6f 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 _0x057d=['body','options','raw','UpdateSmsQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','CreateSmsQueueReport','SmsQueueReport','create'];(function(_0x67498f,_0x3de928){var _0x1b7a05=function(_0x43799e){while(--_0x43799e){_0x67498f['push'](_0x67498f['shift']());}};_0x1b7a05(++_0x3de928);}(_0x057d,0x13d));var _0xd057=function(_0x4c825d,_0x10ec2b){_0x4c825d=_0x4c825d-0x0;var _0x43de87=_0x057d[_0x4c825d];return _0x43de87;};'use strict';var _=require('lodash');var util=require(_0xd057('0x0'));var moment=require(_0xd057('0x1'));var BPromise=require(_0xd057('0x2'));var rs=require(_0xd057('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd057('0x4'))['db'];var utils=require(_0xd057('0x5'));var logger=require(_0xd057('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd057('0x7'));var client=jayson[_0xd057('0x8')][_0xd057('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf4fd7,_0x56b2c4,_0x59925a){return new BPromise(function(_0x3a6530,_0x4fd503){return client[_0xd057('0xa')](_0xbf4fd7,_0x59925a)[_0xd057('0xb')](function(_0x2e4a04){logger['info'](_0xd057('0xc'),_0x56b2c4,'request\x20sent');logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x56b2c4,'request\x20sent',JSON[_0xd057('0xd')](_0x2e4a04));if(_0x2e4a04[_0xd057('0xe')]){if(_0x2e4a04['error'][_0xd057('0xf')]===0x1f4){logger[_0xd057('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x56b2c4,_0x2e4a04['error'][_0xd057('0x10')]);return _0x4fd503(_0x2e4a04['error'][_0xd057('0x10')]);}logger[_0xd057('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x56b2c4,_0x2e4a04[_0xd057('0xe')][_0xd057('0x10')]);return _0x3a6530(_0x2e4a04[_0xd057('0xe')][_0xd057('0x10')]);}else{logger[_0xd057('0x11')](_0xd057('0xc'),_0x56b2c4,_0xd057('0x12'));_0x3a6530(_0x2e4a04[_0xd057('0x13')][_0xd057('0x10')]);}})[_0xd057('0x14')](function(_0x3cc289){logger[_0xd057('0xe')](_0xd057('0xc'),_0x56b2c4,_0x3cc289);_0x4fd503(_0x3cc289);});});}exports[_0xd057('0x15')]=function(_0x534e89){var _0x25977c=this;return new Promise(function(_0x123c4b,_0xbc9b73){return db[_0xd057('0x16')][_0xd057('0x17')](_0x534e89[_0xd057('0x18')],{'raw':_0x534e89[_0xd057('0x19')]?_0x534e89[_0xd057('0x19')][_0xd057('0x1a')]===undefined?!![]:![]:!![]})[_0xd057('0xb')](function(_0x5e8ca4){logger[_0xd057('0x11')]('CreateSmsQueueReport',_0x534e89);logger['debug']('CreateSmsQueueReport',_0x534e89,JSON[_0xd057('0xd')](_0x5e8ca4));_0x123c4b(_0x5e8ca4);})['catch'](function(_0x36797e){logger[_0xd057('0xe')]('CreateSmsQueueReport',_0x36797e[_0xd057('0x10')],_0x534e89);_0xbc9b73(_0x25977c[_0xd057('0xe')](0x1f4,_0x36797e['message']));});});};exports[_0xd057('0x1b')]=function(_0x3788a9){var _0x293363=this;return new Promise(function(_0x241c94,_0x1b5695){return db[_0xd057('0x16')]['update'](_0x3788a9['body'],{'raw':_0x3788a9[_0xd057('0x19')]?_0x3788a9[_0xd057('0x19')][_0xd057('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3788a9[_0xd057('0x19')]?_0x3788a9[_0xd057('0x19')][_0xd057('0x1c')]||null:null,'attributes':_0x3788a9[_0xd057('0x19')]?_0x3788a9[_0xd057('0x19')][_0xd057('0x1d')]||null:null,'limit':_0x3788a9[_0xd057('0x19')]?_0x3788a9[_0xd057('0x19')][_0xd057('0x1e')]||null:null})['then'](function(_0xa66cca){logger[_0xd057('0x11')](_0xd057('0x1b'),_0x3788a9);logger['debug']('UpdateSmsQueueReport',_0x3788a9,JSON[_0xd057('0xd')](_0xa66cca));_0x241c94(_0xa66cca);})[_0xd057('0x14')](function(_0x3432d2){logger[_0xd057('0xe')](_0xd057('0x1b'),_0x3432d2['message'],_0x3788a9);_0x1b5695(_0x293363[_0xd057('0xe')](0x1f4,_0x3432d2[_0xd057('0x10')]));});});}; \ No newline at end of file +var _0xb053=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','update','where','limit','UpdateSmsQueueReport','lodash','util','moment','ioredis'];(function(_0x1f7527,_0xd2526e){var _0x1e9851=function(_0x3849b7){while(--_0x3849b7){_0x1f7527['push'](_0x1f7527['shift']());}};_0x1e9851(++_0xd2526e);}(_0xb053,0xb0));var _0x3b05=function(_0x27ed5b,_0x5a0692){_0x27ed5b=_0x27ed5b-0x0;var _0x3585ba=_0xb053[_0x27ed5b];return _0x3585ba;};'use strict';var _=require(_0x3b05('0x0'));var util=require(_0x3b05('0x1'));var moment=require(_0x3b05('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b05('0x3'));var db=require(_0x3b05('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b05('0x5'))(_0x3b05('0x6'));var config=require(_0x3b05('0x7'));var jayson=require(_0x3b05('0x8'));var client=jayson[_0x3b05('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x251c0c,_0x4f9fe0,_0x293cf1){return new BPromise(function(_0x107053,_0x4edda9){return client['request'](_0x251c0c,_0x293cf1)['then'](function(_0x42b772){logger['info'](_0x3b05('0xa'),_0x4f9fe0,_0x3b05('0xb'));logger[_0x3b05('0xc')](_0x3b05('0xd'),_0x4f9fe0,_0x3b05('0xb'),JSON[_0x3b05('0xe')](_0x42b772));if(_0x42b772[_0x3b05('0xf')]){if(_0x42b772[_0x3b05('0xf')][_0x3b05('0x10')]===0x1f4){logger[_0x3b05('0xf')](_0x3b05('0xa'),_0x4f9fe0,_0x42b772[_0x3b05('0xf')][_0x3b05('0x11')]);return _0x4edda9(_0x42b772[_0x3b05('0xf')]['message']);}logger[_0x3b05('0xf')](_0x3b05('0xa'),_0x4f9fe0,_0x42b772[_0x3b05('0xf')]['message']);return _0x107053(_0x42b772[_0x3b05('0xf')][_0x3b05('0x11')]);}else{logger[_0x3b05('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x4f9fe0,_0x3b05('0xb'));_0x107053(_0x42b772[_0x3b05('0x13')][_0x3b05('0x11')]);}})[_0x3b05('0x14')](function(_0x5736a1){logger[_0x3b05('0xf')]('SmsQueueReport,\x20%s,\x20%s',_0x4f9fe0,_0x5736a1);_0x4edda9(_0x5736a1);});});}exports[_0x3b05('0x15')]=function(_0x5f035f){var _0x429b4f=this;return new Promise(function(_0xfa848e,_0x4fb817){return db[_0x3b05('0x16')][_0x3b05('0x17')](_0x5f035f['body'],{'raw':_0x5f035f[_0x3b05('0x18')]?_0x5f035f[_0x3b05('0x18')][_0x3b05('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x4d588d){logger['info'](_0x3b05('0x15'),_0x5f035f);logger[_0x3b05('0xc')]('CreateSmsQueueReport',_0x5f035f,JSON['stringify'](_0x4d588d));_0xfa848e(_0x4d588d);})['catch'](function(_0x41d5c5){logger['error'](_0x3b05('0x15'),_0x41d5c5[_0x3b05('0x11')],_0x5f035f);_0x4fb817(_0x429b4f['error'](0x1f4,_0x41d5c5[_0x3b05('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x1417d3){var _0x5cb2ce=this;return new Promise(function(_0x5e99a7,_0x1473b0){return db[_0x3b05('0x16')][_0x3b05('0x1a')](_0x1417d3['body'],{'raw':_0x1417d3[_0x3b05('0x18')]?_0x1417d3[_0x3b05('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1417d3[_0x3b05('0x18')]?_0x1417d3['options'][_0x3b05('0x1b')]||null:null,'attributes':_0x1417d3[_0x3b05('0x18')]?_0x1417d3[_0x3b05('0x18')]['attributes']||null:null,'limit':_0x1417d3[_0x3b05('0x18')]?_0x1417d3[_0x3b05('0x18')][_0x3b05('0x1c')]||null:null})['then'](function(_0x5776e6){logger[_0x3b05('0x12')](_0x3b05('0x1d'),_0x1417d3);logger[_0x3b05('0xc')](_0x3b05('0x1d'),_0x1417d3,JSON['stringify'](_0x5776e6));_0x5e99a7(_0x5776e6);})['catch'](function(_0x5703bb){logger[_0x3b05('0xf')](_0x3b05('0x1d'),_0x5703bb[_0x3b05('0x11')],_0x1417d3);_0x1473b0(_0x5cb2ce[_0x3b05('0xf')](0x1f4,_0x5703bb[_0x3b05('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 6ab81a9..049ff78 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 _0x33c5=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x33c5,0xe6));var _0x533c=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x33c5[_0x3a5648];return _0x34126d;};'use strict';var multer=require('multer');var util=require(_0x533c('0x0'));var path=require(_0x533c('0x1'));var timeout=require('connect-timeout');var express=require(_0x533c('0x2'));var router=express[_0x533c('0x3')]();var fs_extra=require(_0x533c('0x4'));var auth=require(_0x533c('0x5'));var interaction=require(_0x533c('0x6'));var config=require('../../config/environment');var controller=require(_0x533c('0x7'));router[_0x533c('0x8')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0xa')]);router[_0x533c('0x8')](_0x533c('0xb'),auth[_0x533c('0x9')](),controller[_0x533c('0xc')]);router[_0x533c('0x8')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0xe')]);router[_0x533c('0xf')]('/',auth[_0x533c('0x9')](),controller[_0x533c('0x10')]);router[_0x533c('0x11')]('/:id',auth[_0x533c('0x9')](),controller[_0x533c('0x12')]);router[_0x533c('0x13')](_0x533c('0xd'),auth[_0x533c('0x9')](),controller[_0x533c('0x14')]);module['exports']=router; \ No newline at end of file +var _0xee24=['put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee24,0x1a6));var _0x4ee2=function(_0x4953c9,_0x24591d){_0x4953c9=_0x4953c9-0x0;var _0x263a5e=_0xee24[_0x4953c9];return _0x263a5e;};'use strict';var multer=require('multer');var util=require(_0x4ee2('0x0'));var path=require(_0x4ee2('0x1'));var timeout=require('connect-timeout');var express=require(_0x4ee2('0x2'));var router=express[_0x4ee2('0x3')]();var fs_extra=require(_0x4ee2('0x4'));var auth=require(_0x4ee2('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4ee2('0x6'));var controller=require(_0x4ee2('0x7'));router[_0x4ee2('0x8')]('/',auth[_0x4ee2('0x9')](),controller['index']);router[_0x4ee2('0x8')](_0x4ee2('0xa'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xb')]);router[_0x4ee2('0x8')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4ee2('0xe')]);router[_0x4ee2('0xf')](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x10')]);router['delete'](_0x4ee2('0xc'),auth[_0x4ee2('0x9')](),controller[_0x4ee2('0x11')]);module[_0x4ee2('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index ea319d1..04a3673 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 _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x289ed7,_0xb5ad46){var _0x8f2db=function(_0x580945){while(--_0x580945){_0x289ed7['push'](_0x289ed7['shift']());}};_0x8f2db(++_0xb5ad46);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x29632e,_0x5ecba4){_0x29632e=_0x29632e-0x0;var _0x426e04=_0xcb91[_0x29632e];return _0x426e04;};'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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x11ca63,_0xea9f9c){var _0x41f1f6=function(_0xb80b69){while(--_0xb80b69){_0x11ca63['push'](_0x11ca63['shift']());}};_0x41f1f6(++_0xea9f9c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x30f6e4,_0xc65634){_0x30f6e4=_0x30f6e4-0x0;var _0x3547dc=_0xb43b[_0x30f6e4];return _0x3547dc;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index c1cc0fc..ebca10d 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 _0x61a7=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','SmsTransferReport','rawAttributes','fieldName','type','key','model','query','filters'];(function(_0x5b66ca,_0x132e14){var _0x1dcc64=function(_0x4fd0a3){while(--_0x4fd0a3){_0x5b66ca['push'](_0x5b66ca['shift']());}};_0x1dcc64(++_0x132e14);}(_0x61a7,0xb2));var _0x761a=function(_0x17304b,_0x3cf1fe){_0x17304b=_0x17304b-0x0;var _0x2e4071=_0x61a7[_0x17304b];return _0x2e4071;};'use strict';var emlformat=require(_0x761a('0x0'));var rimraf=require(_0x761a('0x1'));var zipdir=require(_0x761a('0x2'));var jsonpatch=require(_0x761a('0x3'));var rp=require(_0x761a('0x4'));var moment=require('moment');var BPromise=require(_0x761a('0x5'));var Mustache=require(_0x761a('0x6'));var util=require('util');var path=require(_0x761a('0x7'));var sox=require(_0x761a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x761a('0x9'));var _=require(_0x761a('0xa'));var squel=require('squel');var crypto=require(_0x761a('0xb'));var jsforce=require(_0x761a('0xc'));var deskjs=require(_0x761a('0xd'));var toCsv=require(_0x761a('0xe'));var querystring=require(_0x761a('0xf'));var Papa=require(_0x761a('0x10'));var Redis=require(_0x761a('0x11'));var authService=require(_0x761a('0x12'));var qs=require(_0x761a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x761a('0x14'))('api');var utils=require(_0x761a('0x15'));var config=require(_0x761a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x761a('0x17'))['db'];function respondWithStatusCode(_0x1b63ac,_0x5d9a74){_0x5d9a74=_0x5d9a74||0xcc;return function(_0x552c12){if(_0x552c12){return _0x1b63ac[_0x761a('0x18')](_0x5d9a74);}return _0x1b63ac[_0x761a('0x19')](_0x5d9a74)[_0x761a('0x1a')]();};}function respondWithResult(_0x28ad22,_0x4663e2){_0x4663e2=_0x4663e2||0xc8;return function(_0x2026b9){if(_0x2026b9){return _0x28ad22['status'](_0x4663e2)[_0x761a('0x1b')](_0x2026b9);}};}function respondWithFilteredResult(_0x564619,_0x4c9e54){return function(_0x287f7e){if(_0x287f7e){var _0x43c378=typeof _0x4c9e54[_0x761a('0x1c')]===_0x761a('0x1d')&&typeof _0x4c9e54[_0x761a('0x1e')]==='undefined';var _0x2167df=_0x287f7e[_0x761a('0x1f')];var _0x75ad11=_0x43c378?0x0:_0x4c9e54[_0x761a('0x1c')];var _0x5f35b4=_0x43c378?_0x287f7e[_0x761a('0x1f')]:_0x4c9e54[_0x761a('0x1c')]+_0x4c9e54[_0x761a('0x1e')];var _0x53af2c;if(_0x5f35b4>=_0x2167df){_0x5f35b4=_0x2167df;_0x53af2c=0xc8;}else{_0x53af2c=0xce;}_0x564619[_0x761a('0x19')](_0x53af2c);return _0x564619[_0x761a('0x20')](_0x761a('0x21'),_0x75ad11+'-'+_0x5f35b4+'/'+_0x2167df)[_0x761a('0x1b')](_0x287f7e);}return null;};}function patchUpdates(_0x38ed2c){return function(_0xb85353){try{jsonpatch[_0x761a('0x22')](_0xb85353,_0x38ed2c,!![]);}catch(_0x51341c){return BPromise[_0x761a('0x23')](_0x51341c);}return _0xb85353[_0x761a('0x24')]();};}function saveUpdates(_0x1eb452,_0x27bf78){return function(_0x39e474){if(_0x39e474){return _0x39e474[_0x761a('0x25')](_0x1eb452)[_0x761a('0x26')](function(_0x35de8a){return _0x35de8a;});}return null;};}function removeEntity(_0x549cf2,_0x2852e0){return function(_0x538046){if(_0x538046){return _0x538046[_0x761a('0x27')]()[_0x761a('0x26')](function(){_0x549cf2[_0x761a('0x19')](0xcc)[_0x761a('0x1a')]();});}};}function handleEntityNotFound(_0x5566c0,_0x446967){return function(_0x51302a){if(!_0x51302a){_0x5566c0[_0x761a('0x18')](0x194);}return _0x51302a;};}function handleError(_0x2f9d4f,_0x274d37){_0x274d37=_0x274d37||0x1f4;return function(_0x3f234c){logger[_0x761a('0x28')](_0x3f234c[_0x761a('0x29')]);if(_0x3f234c[_0x761a('0x2a')]){delete _0x3f234c[_0x761a('0x2a')];}_0x2f9d4f['status'](_0x274d37)['send'](_0x3f234c);};}exports[_0x761a('0x2b')]=function(_0x1effff,_0x887b1d){var _0x16b2fa={},_0x5376a2={},_0x38826c={'count':0x0,'rows':[]};var _0x422341=_[_0x761a('0x2c')](db[_0x761a('0x2d')][_0x761a('0x2e')],function(_0x215715){return{'name':_0x215715[_0x761a('0x2f')],'type':_0x215715[_0x761a('0x30')][_0x761a('0x31')]};});_0x5376a2[_0x761a('0x32')]=_['map'](_0x422341,'name');_0x5376a2[_0x761a('0x33')]=_['keys'](_0x1effff['query']);_0x5376a2[_0x761a('0x34')]=_[_0x761a('0x35')](_0x5376a2[_0x761a('0x32')],_0x5376a2[_0x761a('0x33')]);_0x16b2fa[_0x761a('0x36')]=_[_0x761a('0x35')](_0x5376a2[_0x761a('0x32')],qs[_0x761a('0x37')](_0x1effff[_0x761a('0x33')][_0x761a('0x37')]));_0x16b2fa[_0x761a('0x36')]=_0x16b2fa[_0x761a('0x36')][_0x761a('0x38')]?_0x16b2fa[_0x761a('0x36')]:_0x5376a2['model'];if(!_0x1effff[_0x761a('0x33')][_0x761a('0x39')](_0x761a('0x3a'))){_0x16b2fa['limit']=qs[_0x761a('0x1e')](_0x1effff['query'][_0x761a('0x1e')]);_0x16b2fa['offset']=qs[_0x761a('0x1c')](_0x1effff[_0x761a('0x33')][_0x761a('0x1c')]);}_0x16b2fa[_0x761a('0x3b')]=qs[_0x761a('0x3c')](_0x1effff[_0x761a('0x33')][_0x761a('0x3c')]);_0x16b2fa[_0x761a('0x3d')]=qs['filters'](_[_0x761a('0x3e')](_0x1effff[_0x761a('0x33')],_0x5376a2[_0x761a('0x34')]),_0x422341);if(_0x1effff['query'][_0x761a('0x3f')]){_0x16b2fa[_0x761a('0x3d')]=_[_0x761a('0x40')](_0x16b2fa[_0x761a('0x3d')],{'$or':_[_0x761a('0x2c')](_0x422341,function(_0x206c79){if(_0x206c79['type']!=='VIRTUAL'){var _0xb4815b={};_0xb4815b[_0x206c79[_0x761a('0x2a')]]={'$like':'%'+_0x1effff['query'][_0x761a('0x3f')]+'%'};return _0xb4815b;}})});}_0x16b2fa=_[_0x761a('0x40')]({},_0x16b2fa,_0x1effff[_0x761a('0x41')]);var _0x2e0005={'where':_0x16b2fa[_0x761a('0x3d')]};return db[_0x761a('0x2d')][_0x761a('0x1f')](_0x2e0005)[_0x761a('0x26')](function(_0x2d0228){_0x38826c[_0x761a('0x1f')]=_0x2d0228;if(_0x1effff['query'][_0x761a('0x42')]){_0x16b2fa[_0x761a('0x43')]=[{'all':!![]}];}return db['SmsTransferReport']['findAll'](_0x16b2fa);})['then'](function(_0x3ac8d2){_0x38826c[_0x761a('0x44')]=_0x3ac8d2;return _0x38826c;})['then'](respondWithFilteredResult(_0x887b1d,_0x16b2fa))[_0x761a('0x45')](handleError(_0x887b1d,null));};exports[_0x761a('0x46')]=function(_0x5c960d,_0x5d84f4){var _0x3dc68c={'raw':!![],'where':{'id':_0x5c960d['params']['id']}},_0x132b55={};_0x132b55['model']=_[_0x761a('0x47')](db[_0x761a('0x2d')][_0x761a('0x2e')]);_0x132b55[_0x761a('0x33')]=_[_0x761a('0x47')](_0x5c960d[_0x761a('0x33')]);_0x132b55['filters']=_['intersection'](_0x132b55[_0x761a('0x32')],_0x132b55[_0x761a('0x33')]);_0x3dc68c['attributes']=_[_0x761a('0x35')](_0x132b55[_0x761a('0x32')],qs[_0x761a('0x37')](_0x5c960d[_0x761a('0x33')]['fields']));_0x3dc68c['attributes']=_0x3dc68c[_0x761a('0x36')][_0x761a('0x38')]?_0x3dc68c['attributes']:_0x132b55['model'];if(_0x5c960d[_0x761a('0x33')][_0x761a('0x42')]){_0x3dc68c['include']=[{'all':!![]}];}_0x3dc68c=_[_0x761a('0x40')]({},_0x3dc68c,_0x5c960d['options']);return db[_0x761a('0x2d')]['find'](_0x3dc68c)[_0x761a('0x26')](handleEntityNotFound(_0x5d84f4,null))[_0x761a('0x26')](respondWithResult(_0x5d84f4,null))['catch'](handleError(_0x5d84f4,null));};exports[_0x761a('0x48')]=function(_0x54ba43,_0x3a118a){return db[_0x761a('0x2d')][_0x761a('0x48')](_0x54ba43[_0x761a('0x49')],{})['then'](respondWithResult(_0x3a118a,0xc9))['catch'](handleError(_0x3a118a,null));};exports['update']=function(_0x33fa6c,_0x53c1ce){if(_0x33fa6c[_0x761a('0x49')]['id']){delete _0x33fa6c[_0x761a('0x49')]['id'];}return db[_0x761a('0x2d')][_0x761a('0x4a')]({'where':{'id':_0x33fa6c[_0x761a('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53c1ce,null))[_0x761a('0x26')](saveUpdates(_0x33fa6c[_0x761a('0x49')],null))[_0x761a('0x26')](respondWithResult(_0x53c1ce,null))[_0x761a('0x45')](handleError(_0x53c1ce,null));};exports[_0x761a('0x27')]=function(_0x224007,_0x1c05e5){return db[_0x761a('0x2d')][_0x761a('0x4a')]({'where':{'id':_0x224007[_0x761a('0x4b')]['id']}})[_0x761a('0x26')](handleEntityNotFound(_0x1c05e5,null))['then'](removeEntity(_0x1c05e5,null))['catch'](handleError(_0x1c05e5,null));};exports[_0x761a('0x4c')]=function(_0x219043,_0x3411ea){return db[_0x761a('0x2d')][_0x761a('0x4c')]()[_0x761a('0x26')](respondWithResult(_0x3411ea,null))[_0x761a('0x45')](handleError(_0x3411ea,null));}; \ No newline at end of file +var _0xa72d=['merge','options','includeAll','include','findAll','then','rows','catch','show','params','fields','find','create','body','describe','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','stack','name','map','SmsTransferReport','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0xa72d,0x12b));var _0xda72=function(_0x1958bd,_0x5b3b98){_0x1958bd=_0x1958bd-0x0;var _0x4ba947=_0xa72d[_0x1958bd];return _0x4ba947;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xda72('0x0'));var zipdir=require(_0xda72('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xda72('0x2'));var moment=require(_0xda72('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xda72('0x4'));var util=require('util');var path=require(_0xda72('0x5'));var sox=require(_0xda72('0x6'));var csv=require(_0xda72('0x7'));var ejs=require(_0xda72('0x8'));var fs=require('fs');var fs_extra=require(_0xda72('0x9'));var _=require(_0xda72('0xa'));var squel=require(_0xda72('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xda72('0xc'));var toCsv=require(_0xda72('0x7'));var querystring=require(_0xda72('0xd'));var Papa=require(_0xda72('0xe'));var Redis=require(_0xda72('0xf'));var authService=require(_0xda72('0x10'));var qs=require(_0xda72('0x11'));var as=require(_0xda72('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xda72('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xda72('0x14'));var db=require(_0xda72('0x15'))['db'];function respondWithStatusCode(_0x3c0a71,_0x13b2a5){_0x13b2a5=_0x13b2a5||0xcc;return function(_0x8a382d){if(_0x8a382d){return _0x3c0a71[_0xda72('0x16')](_0x13b2a5);}return _0x3c0a71[_0xda72('0x17')](_0x13b2a5)[_0xda72('0x18')]();};}function respondWithResult(_0x59cfb2,_0x573823){_0x573823=_0x573823||0xc8;return function(_0x2d5eb2){if(_0x2d5eb2){return _0x59cfb2[_0xda72('0x17')](_0x573823)[_0xda72('0x19')](_0x2d5eb2);}};}function respondWithFilteredResult(_0x3a9f05,_0x47c0a3){return function(_0xf0df20){if(_0xf0df20){var _0xfc137b=typeof _0x47c0a3['offset']===_0xda72('0x1a')&&typeof _0x47c0a3[_0xda72('0x1b')]==='undefined';var _0x2a4a5f=_0xf0df20[_0xda72('0x1c')];var _0x56a604=_0xfc137b?0x0:_0x47c0a3[_0xda72('0x1d')];var _0x341228=_0xfc137b?_0xf0df20[_0xda72('0x1c')]:_0x47c0a3['offset']+_0x47c0a3[_0xda72('0x1b')];var _0x3f0dcd;if(_0x341228>=_0x2a4a5f){_0x341228=_0x2a4a5f;_0x3f0dcd=0xc8;}else{_0x3f0dcd=0xce;}_0x3a9f05['status'](_0x3f0dcd);return _0x3a9f05[_0xda72('0x1e')](_0xda72('0x1f'),_0x56a604+'-'+_0x341228+'/'+_0x2a4a5f)[_0xda72('0x19')](_0xf0df20);}return null;};}function patchUpdates(_0x485c70){return function(_0x431c8e){try{jsonpatch[_0xda72('0x20')](_0x431c8e,_0x485c70,!![]);}catch(_0x5792f8){return BPromise['reject'](_0x5792f8);}return _0x431c8e[_0xda72('0x21')]();};}function saveUpdates(_0x56d402,_0x5c69f7){return function(_0x1bd2e1){if(_0x1bd2e1){return _0x1bd2e1[_0xda72('0x22')](_0x56d402)['then'](function(_0x48fb0a){return _0x48fb0a;});}return null;};}function removeEntity(_0x4c4cf3,_0x3a87f8){return function(_0xfdf2e6){if(_0xfdf2e6){return _0xfdf2e6[_0xda72('0x23')]()['then'](function(){_0x4c4cf3['status'](0xcc)[_0xda72('0x18')]();});}};}function handleEntityNotFound(_0xd068ce,_0x5e69ff){return function(_0x56bc7e){if(!_0x56bc7e){_0xd068ce[_0xda72('0x16')](0x194);}return _0x56bc7e;};}function handleError(_0x285c1c,_0x4f5960){_0x4f5960=_0x4f5960||0x1f4;return function(_0x21c0c1){logger['error'](_0x21c0c1[_0xda72('0x24')]);if(_0x21c0c1[_0xda72('0x25')]){delete _0x21c0c1[_0xda72('0x25')];}_0x285c1c[_0xda72('0x17')](_0x4f5960)['send'](_0x21c0c1);};}exports['index']=function(_0x4ae275,_0x4a898b){var _0x9a64cd={},_0x312d12={},_0x594fb5={'count':0x0,'rows':[]};var _0x569246=_[_0xda72('0x26')](db[_0xda72('0x27')]['rawAttributes'],function(_0xb3dfc4){return{'name':_0xb3dfc4['fieldName'],'type':_0xb3dfc4[_0xda72('0x28')][_0xda72('0x29')]};});_0x312d12[_0xda72('0x2a')]=_[_0xda72('0x26')](_0x569246,_0xda72('0x25'));_0x312d12[_0xda72('0x2b')]=_[_0xda72('0x2c')](_0x4ae275['query']);_0x312d12[_0xda72('0x2d')]=_[_0xda72('0x2e')](_0x312d12[_0xda72('0x2a')],_0x312d12['query']);_0x9a64cd[_0xda72('0x2f')]=_['intersection'](_0x312d12[_0xda72('0x2a')],qs['fields'](_0x4ae275[_0xda72('0x2b')]['fields']));_0x9a64cd[_0xda72('0x2f')]=_0x9a64cd[_0xda72('0x2f')][_0xda72('0x30')]?_0x9a64cd[_0xda72('0x2f')]:_0x312d12['model'];if(!_0x4ae275[_0xda72('0x2b')][_0xda72('0x31')](_0xda72('0x32'))){_0x9a64cd['limit']=qs['limit'](_0x4ae275[_0xda72('0x2b')]['limit']);_0x9a64cd[_0xda72('0x1d')]=qs[_0xda72('0x1d')](_0x4ae275[_0xda72('0x2b')][_0xda72('0x1d')]);}_0x9a64cd[_0xda72('0x33')]=qs[_0xda72('0x34')](_0x4ae275['query'][_0xda72('0x34')]);_0x9a64cd[_0xda72('0x35')]=qs[_0xda72('0x2d')](_[_0xda72('0x36')](_0x4ae275[_0xda72('0x2b')],_0x312d12['filters']),_0x569246);if(_0x4ae275[_0xda72('0x2b')][_0xda72('0x37')]){_0x9a64cd[_0xda72('0x35')]=_[_0xda72('0x38')](_0x9a64cd[_0xda72('0x35')],{'$or':_[_0xda72('0x26')](_0x569246,function(_0x11ffb2){if(_0x11ffb2['type']!=='VIRTUAL'){var _0x19864c={};_0x19864c[_0x11ffb2['name']]={'$like':'%'+_0x4ae275['query'][_0xda72('0x37')]+'%'};return _0x19864c;}})});}_0x9a64cd=_[_0xda72('0x38')]({},_0x9a64cd,_0x4ae275[_0xda72('0x39')]);var _0x2f687f={'where':_0x9a64cd[_0xda72('0x35')]};return db[_0xda72('0x27')]['count'](_0x2f687f)['then'](function(_0x520122){_0x594fb5[_0xda72('0x1c')]=_0x520122;if(_0x4ae275['query'][_0xda72('0x3a')]){_0x9a64cd[_0xda72('0x3b')]=[{'all':!![]}];}return db[_0xda72('0x27')][_0xda72('0x3c')](_0x9a64cd);})[_0xda72('0x3d')](function(_0x51ff8c){_0x594fb5[_0xda72('0x3e')]=_0x51ff8c;return _0x594fb5;})[_0xda72('0x3d')](respondWithFilteredResult(_0x4a898b,_0x9a64cd))[_0xda72('0x3f')](handleError(_0x4a898b,null));};exports[_0xda72('0x40')]=function(_0x1a370c,_0x488e69){var _0x32e413={'raw':!![],'where':{'id':_0x1a370c[_0xda72('0x41')]['id']}},_0x40189c={};_0x40189c[_0xda72('0x2a')]=_['keys'](db[_0xda72('0x27')]['rawAttributes']);_0x40189c['query']=_[_0xda72('0x2c')](_0x1a370c[_0xda72('0x2b')]);_0x40189c[_0xda72('0x2d')]=_[_0xda72('0x2e')](_0x40189c[_0xda72('0x2a')],_0x40189c[_0xda72('0x2b')]);_0x32e413[_0xda72('0x2f')]=_[_0xda72('0x2e')](_0x40189c[_0xda72('0x2a')],qs[_0xda72('0x42')](_0x1a370c[_0xda72('0x2b')][_0xda72('0x42')]));_0x32e413[_0xda72('0x2f')]=_0x32e413[_0xda72('0x2f')][_0xda72('0x30')]?_0x32e413[_0xda72('0x2f')]:_0x40189c[_0xda72('0x2a')];if(_0x1a370c[_0xda72('0x2b')]['includeAll']){_0x32e413['include']=[{'all':!![]}];}_0x32e413=_[_0xda72('0x38')]({},_0x32e413,_0x1a370c[_0xda72('0x39')]);return db[_0xda72('0x27')][_0xda72('0x43')](_0x32e413)[_0xda72('0x3d')](handleEntityNotFound(_0x488e69,null))[_0xda72('0x3d')](respondWithResult(_0x488e69,null))[_0xda72('0x3f')](handleError(_0x488e69,null));};exports[_0xda72('0x44')]=function(_0x389b98,_0x4318d1){return db[_0xda72('0x27')][_0xda72('0x44')](_0x389b98[_0xda72('0x45')],{})['then'](respondWithResult(_0x4318d1,0xc9))[_0xda72('0x3f')](handleError(_0x4318d1,null));};exports[_0xda72('0x22')]=function(_0x46a3cb,_0x830b35){if(_0x46a3cb[_0xda72('0x45')]['id']){delete _0x46a3cb['body']['id'];}return db[_0xda72('0x27')][_0xda72('0x43')]({'where':{'id':_0x46a3cb[_0xda72('0x41')]['id']}})[_0xda72('0x3d')](handleEntityNotFound(_0x830b35,null))[_0xda72('0x3d')](saveUpdates(_0x46a3cb['body'],null))[_0xda72('0x3d')](respondWithResult(_0x830b35,null))[_0xda72('0x3f')](handleError(_0x830b35,null));};exports[_0xda72('0x23')]=function(_0x5aacde,_0x158be3){return db[_0xda72('0x27')][_0xda72('0x43')]({'where':{'id':_0x5aacde[_0xda72('0x41')]['id']}})[_0xda72('0x3d')](handleEntityNotFound(_0x158be3,null))[_0xda72('0x3d')](removeEntity(_0x158be3,null))['catch'](handleError(_0x158be3,null));};exports[_0xda72('0x46')]=function(_0x368471,_0x1aa517){return db[_0xda72('0x27')][_0xda72('0x46')]()[_0xda72('0x3d')](respondWithResult(_0x1aa517,null))[_0xda72('0x3f')](handleError(_0x1aa517,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 4899a9e..d9e026c 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 _0xfb09=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','report_sms_transfer','uniqueid','lodash','util'];(function(_0x4be8b6,_0x319fa7){var _0x4e5cc4=function(_0x58778d){while(--_0x58778d){_0x4be8b6['push'](_0x4be8b6['shift']());}};_0x4e5cc4(++_0x319fa7);}(_0xfb09,0xa3));var _0x9fb0=function(_0x51404c,_0x3e87fb){_0x51404c=_0x51404c-0x0;var _0x205bb9=_0xfb09[_0x51404c];return _0x205bb9;};'use strict';var _=require(_0x9fb0('0x0'));var util=require(_0x9fb0('0x1'));var logger=require(_0x9fb0('0x2'))(_0x9fb0('0x3'));var moment=require(_0x9fb0('0x4'));var BPromise=require(_0x9fb0('0x5'));var rp=require(_0x9fb0('0x6'));var fs=require('fs');var path=require(_0x9fb0('0x7'));var rimraf=require(_0x9fb0('0x8'));var config=require(_0x9fb0('0x9'));var attributes=require(_0x9fb0('0xa'));module[_0x9fb0('0xb')]=function(_0x49d0e5,_0xb5d812){return _0x49d0e5[_0x9fb0('0xc')]('SmsTransferReport',attributes,{'tableName':_0x9fb0('0xd'),'paranoid':![],'indexes':[{'name':_0x9fb0('0xe'),'fields':[_0x9fb0('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa031=['report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','SmsTransferReport'];(function(_0x35333a,_0x13d996){var _0x2d1332=function(_0x56c76f){while(--_0x56c76f){_0x35333a['push'](_0x35333a['shift']());}};_0x2d1332(++_0x13d996);}(_0xa031,0x1f0));var _0x1a03=function(_0x342200,_0x18593b){_0x342200=_0x342200-0x0;var _0x593c70=_0xa031[_0x342200];return _0x593c70;};'use strict';var _=require(_0x1a03('0x0'));var util=require('util');var logger=require(_0x1a03('0x1'))(_0x1a03('0x2'));var moment=require(_0x1a03('0x3'));var BPromise=require(_0x1a03('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a03('0x5'));var rimraf=require(_0x1a03('0x6'));var config=require(_0x1a03('0x7'));var attributes=require(_0x1a03('0x8'));module[_0x1a03('0x9')]=function(_0x1e0643,_0x5d40dd){return _0x1e0643['define'](_0x1a03('0xa'),attributes,{'tableName':_0x1a03('0xb'),'paranoid':![],'indexes':[{'name':_0x1a03('0xc'),'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 a4c6565..e2fbfbd 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 _0x6e12=['stringify','error','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x556644,_0x2ce9d7){var _0x58424a=function(_0xe06098){while(--_0xe06098){_0x556644['push'](_0x556644['shift']());}};_0x58424a(++_0x2ce9d7);}(_0x6e12,0x154));var _0x26e1=function(_0x573321,_0x27ea73){_0x573321=_0x573321-0x0;var _0x3ca3ba=_0x6e12[_0x573321];return _0x3ca3ba;};'use strict';var _=require(_0x26e1('0x0'));var util=require(_0x26e1('0x1'));var moment=require(_0x26e1('0x2'));var BPromise=require(_0x26e1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26e1('0x4'));var db=require(_0x26e1('0x5'))['db'];var utils=require(_0x26e1('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x26e1('0x7'));var jayson=require(_0x26e1('0x8'));var client=jayson[_0x26e1('0x9')][_0x26e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb8941a,_0x4b4fd5,_0x3d543a){return new BPromise(function(_0x3e594f,_0xdabd67){return client[_0x26e1('0xb')](_0xb8941a,_0x3d543a)[_0x26e1('0xc')](function(_0x52fc56){logger[_0x26e1('0xd')](_0x26e1('0xe'),_0x4b4fd5,_0x26e1('0xf'));logger['debug'](_0x26e1('0x10'),_0x4b4fd5,_0x26e1('0xf'),JSON[_0x26e1('0x11')](_0x52fc56));if(_0x52fc56[_0x26e1('0x12')]){if(_0x52fc56[_0x26e1('0x12')]['code']===0x1f4){logger[_0x26e1('0x12')](_0x26e1('0xe'),_0x4b4fd5,_0x52fc56[_0x26e1('0x12')]['message']);return _0xdabd67(_0x52fc56[_0x26e1('0x12')][_0x26e1('0x13')]);}logger[_0x26e1('0x12')](_0x26e1('0xe'),_0x4b4fd5,_0x52fc56['error']['message']);return _0x3e594f(_0x52fc56[_0x26e1('0x12')][_0x26e1('0x13')]);}else{logger[_0x26e1('0xd')](_0x26e1('0xe'),_0x4b4fd5,_0x26e1('0xf'));_0x3e594f(_0x52fc56['result'][_0x26e1('0x13')]);}})[_0x26e1('0x14')](function(_0x545727){logger[_0x26e1('0x12')](_0x26e1('0xe'),_0x4b4fd5,_0x545727);_0xdabd67(_0x545727);});});} \ No newline at end of file +var _0xf50b=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1a1388,_0x39b561){var _0x54d57b=function(_0x562ac2){while(--_0x562ac2){_0x1a1388['push'](_0x1a1388['shift']());}};_0x54d57b(++_0x39b561);}(_0xf50b,0xc8));var _0xbf50=function(_0x28f94d,_0x42eb7d){_0x28f94d=_0x28f94d-0x0;var _0x42faa8=_0xf50b[_0x28f94d];return _0x42faa8;};'use strict';var _=require(_0xbf50('0x0'));var util=require(_0xbf50('0x1'));var moment=require('moment');var BPromise=require(_0xbf50('0x2'));var rs=require(_0xbf50('0x3'));var fs=require('fs');var Redis=require(_0xbf50('0x4'));var db=require(_0xbf50('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf50('0x6'))('rpc');var config=require(_0xbf50('0x7'));var jayson=require(_0xbf50('0x8'));var client=jayson[_0xbf50('0x9')][_0xbf50('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dd305,_0x3378ff,_0xce290){return new BPromise(function(_0x497c4c,_0x160dc7){return client[_0xbf50('0xb')](_0x3dd305,_0xce290)[_0xbf50('0xc')](function(_0x4eb908){logger['info'](_0xbf50('0xd'),_0x3378ff,_0xbf50('0xe'));logger[_0xbf50('0xf')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x3378ff,_0xbf50('0xe'),JSON[_0xbf50('0x10')](_0x4eb908));if(_0x4eb908[_0xbf50('0x11')]){if(_0x4eb908[_0xbf50('0x11')][_0xbf50('0x12')]===0x1f4){logger[_0xbf50('0x11')](_0xbf50('0xd'),_0x3378ff,_0x4eb908['error'][_0xbf50('0x13')]);return _0x160dc7(_0x4eb908[_0xbf50('0x11')][_0xbf50('0x13')]);}logger[_0xbf50('0x11')](_0xbf50('0xd'),_0x3378ff,_0x4eb908['error']['message']);return _0x497c4c(_0x4eb908['error'][_0xbf50('0x13')]);}else{logger['info'](_0xbf50('0xd'),_0x3378ff,_0xbf50('0xe'));_0x497c4c(_0x4eb908[_0xbf50('0x14')]['message']);}})[_0xbf50('0x15')](function(_0x5be8ae){logger[_0xbf50('0x11')](_0xbf50('0xd'),_0x3378ff,_0x5be8ae);_0x160dc7(_0x5be8ae);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c073f94..8bf7b65 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 _0xcc2d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','isAuthenticated','index','/:id','show','get','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','update','delete','exports','multer','util','path'];(function(_0x3851e3,_0x765cc9){var _0x47804d=function(_0x3ddf2e){while(--_0x3ddf2e){_0x3851e3['push'](_0x3851e3['shift']());}};_0x47804d(++_0x765cc9);}(_0xcc2d,0xa7));var _0xdcc2=function(_0x5c350f,_0x534f2a){_0x5c350f=_0x5c350f-0x0;var _0x42369d=_0xcc2d[_0x5c350f];return _0x42369d;};'use strict';var multer=require(_0xdcc2('0x0'));var util=require(_0xdcc2('0x1'));var path=require(_0xdcc2('0x2'));var timeout=require(_0xdcc2('0x3'));var express=require(_0xdcc2('0x4'));var router=express[_0xdcc2('0x5')]();var fs_extra=require(_0xdcc2('0x6'));var auth=require(_0xdcc2('0x7'));var interaction=require(_0xdcc2('0x8'));var config=require('../../config/environment');var controller=require(_0xdcc2('0x9'));router['get']('/',auth[_0xdcc2('0xa')](),controller[_0xdcc2('0xb')]);router['get'](_0xdcc2('0xc'),auth[_0xdcc2('0xa')](),controller[_0xdcc2('0xd')]);router[_0xdcc2('0xe')](_0xdcc2('0xf'),auth[_0xdcc2('0xa')](),controller[_0xdcc2('0x10')]);var upload=multer({'storage':multer[_0xdcc2('0x11')]({'destination':function(_0x2cf2b3,_0x3a0b00,_0xddae74){_0xddae74(null,path['join'](config[_0xdcc2('0x12')],_0xdcc2('0x13')));},'filename':function(_0x7c8542,_0x13ceed,_0x4bd916){_0x13ceed[_0xdcc2('0x14')]=_0x13ceed[_0xdcc2('0x14')][_0xdcc2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4bd916(null,util[_0xdcc2('0x16')](_0xdcc2('0x17'),path[_0xdcc2('0x18')](_0x13ceed[_0xdcc2('0x14')],path[_0xdcc2('0x19')](_0x13ceed['originalname'])),Date[_0xdcc2('0x1a')](),path[_0xdcc2('0x19')](_0x13ceed[_0xdcc2('0x14')])));}})});router[_0xdcc2('0x1b')]('/',upload[_0xdcc2('0x1c')](_0xdcc2('0x1d')),controller['create']);router[_0xdcc2('0x1e')]('/:id',auth[_0xdcc2('0xa')](),controller[_0xdcc2('0x1f')]);router[_0xdcc2('0x20')]('/:id',auth[_0xdcc2('0xa')](),controller[_0xdcc2('0x20')]);module[_0xdcc2('0x21')]=router; \ No newline at end of file +var _0xfad1=['%s-%s%s','basename','extname','now','post','file','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','./sound.controller','isAuthenticated','index','/:id','show','get','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0xfad1,0x1af));var _0x1fad=function(_0x3d0e88,_0x21db93){_0x3d0e88=_0x3d0e88-0x0;var _0x3cb556=_0xfad1[_0x3d0e88];return _0x3cb556;};'use strict';var multer=require(_0x1fad('0x0'));var util=require(_0x1fad('0x1'));var path=require('path');var timeout=require(_0x1fad('0x2'));var express=require(_0x1fad('0x3'));var router=express[_0x1fad('0x4')]();var fs_extra=require(_0x1fad('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1fad('0x6'));router['get']('/',auth[_0x1fad('0x7')](),controller[_0x1fad('0x8')]);router['get'](_0x1fad('0x9'),auth[_0x1fad('0x7')](),controller[_0x1fad('0xa')]);router[_0x1fad('0xb')](_0x1fad('0xc'),auth[_0x1fad('0x7')](),controller[_0x1fad('0xd')]);var upload=multer({'storage':multer[_0x1fad('0xe')]({'destination':function(_0x3b71ee,_0x5578b1,_0x56fc2b){_0x56fc2b(null,path[_0x1fad('0xf')](config[_0x1fad('0x10')],_0x1fad('0x11')));},'filename':function(_0x379eaa,_0x412633,_0x240e7e){_0x412633['originalname']=_0x412633[_0x1fad('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x240e7e(null,util['format'](_0x1fad('0x13'),path[_0x1fad('0x14')](_0x412633[_0x1fad('0x12')],path[_0x1fad('0x15')](_0x412633[_0x1fad('0x12')])),Date[_0x1fad('0x16')](),path[_0x1fad('0x15')](_0x412633['originalname'])));}})});router[_0x1fad('0x17')]('/',upload['single'](_0x1fad('0x18')),controller[_0x1fad('0x19')]);router[_0x1fad('0x1a')](_0x1fad('0x9'),auth['isAuthenticated'](),controller[_0x1fad('0x1b')]);router[_0x1fad('0x1c')]('/:id',auth[_0x1fad('0x7')](),controller['delete']);module[_0x1fad('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 3cfed45..e4d6bea 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 _0xc93d=['BIGINT','INTEGER','STRING'];(function(_0x21a5f6,_0x5a99f5){var _0x573f8a=function(_0x2d6e13){while(--_0x2d6e13){_0x21a5f6['push'](_0x21a5f6['shift']());}};_0x573f8a(++_0x5a99f5);}(_0xc93d,0x18b));var _0xdc93=function(_0x5eaa0b,_0x433b2f){_0x5eaa0b=_0x5eaa0b-0x0;var _0x28b295=_0xc93d[_0x5eaa0b];return _0x28b295;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdc93('0x0')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xdc93('0x0')]},'display_name':{'type':Sequelize[_0xdc93('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0xdc93('0x0')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xdc93('0x1')]},'original_channelCount':{'type':Sequelize[_0xdc93('0x2')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xdc93('0x2')]},'converted_format':{'type':Sequelize[_0xdc93('0x0')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xdc93('0x1')]},'converted_channelCount':{'type':Sequelize[_0xdc93('0x2')]},'converted_bitRate':{'type':Sequelize[_0xdc93('0x1')]},'converted_sampleRate':{'type':Sequelize[_0xdc93('0x2')]}}; \ No newline at end of file +var _0x81e3=['STRING','FLOAT','BIGINT','INTEGER','sequelize'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x81e3,0x162));var _0x381e=function(_0x2b7fd3,_0x17556d){_0x2b7fd3=_0x2b7fd3-0x0;var _0x1bd260=_0x81e3[_0x2b7fd3];return _0x1bd260;};'use strict';var Sequelize=require(_0x381e('0x0'));module['exports']={'name':{'type':Sequelize[_0x381e('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x381e('0x1')]},'display_name':{'type':Sequelize[_0x381e('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x381e('0x1')]},'original_format':{'type':Sequelize[_0x381e('0x1')]},'original_duration':{'type':Sequelize[_0x381e('0x2')]},'original_sampleCount':{'type':Sequelize[_0x381e('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x381e('0x3')]},'original_sampleRate':{'type':Sequelize[_0x381e('0x4')]},'converted_format':{'type':Sequelize[_0x381e('0x1')]},'converted_duration':{'type':Sequelize[_0x381e('0x2')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x381e('0x4')]},'converted_bitRate':{'type':Sequelize[_0x381e('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x381e('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b653a54..30106e2 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 _0x79ad=['pick','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','Content-Range','json','apply','reject','update','then','destroy','get','Sounds','error','stack','name','send','Sound','type','key','map','query','keys','filters','attributes','intersection','fields','model','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','length','download','find','save_name','converted_format','existsSync','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','join','format','originalname','file','basename','filename','extname','substring','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20destination:\x20%s','0777','unlinkSync','src','original_duration','duration','original_sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','sampleCount','converted_bitRate','bitRate','converted_sampleRate','chmodSync','create','role','body','userProfileId','user','UserProfileSection','start'];(function(_0x3328bd,_0x34b6cc){var _0xf2012a=function(_0x35a4e5){while(--_0x35a4e5){_0x3328bd['push'](_0x3328bd['shift']());}};_0xf2012a(++_0x34b6cc);}(_0x79ad,0xf9));var _0xd79a=function(_0x48cce5,_0x328cb0){_0x48cce5=_0x48cce5-0x0;var _0x20f3d3=_0x79ad[_0x48cce5];return _0x20f3d3;};'use strict';var emlformat=require(_0xd79a('0x0'));var rimraf=require(_0xd79a('0x1'));var zipdir=require(_0xd79a('0x2'));var jsonpatch=require(_0xd79a('0x3'));var rp=require(_0xd79a('0x4'));var moment=require(_0xd79a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd79a('0x6'));var util=require(_0xd79a('0x7'));var path=require(_0xd79a('0x8'));var sox=require(_0xd79a('0x9'));var csv=require(_0xd79a('0xa'));var ejs=require(_0xd79a('0xb'));var fs=require('fs');var fs_extra=require(_0xd79a('0xc'));var _=require('lodash');var squel=require(_0xd79a('0xd'));var crypto=require(_0xd79a('0xe'));var jsforce=require(_0xd79a('0xf'));var deskjs=require(_0xd79a('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd79a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd79a('0x12'));var hardwareService=require(_0xd79a('0x13'));var logger=require(_0xd79a('0x14'))(_0xd79a('0x15'));var utils=require(_0xd79a('0x16'));var config=require(_0xd79a('0x17'));var licenseUtil=require(_0xd79a('0x18'));var db=require(_0xd79a('0x19'))['db'];function respondWithStatusCode(_0x544da8,_0x52f6de){_0x52f6de=_0x52f6de||0xcc;return function(_0x2a2182){if(_0x2a2182){return _0x544da8[_0xd79a('0x1a')](_0x52f6de);}return _0x544da8[_0xd79a('0x1b')](_0x52f6de)[_0xd79a('0x1c')]();};}function respondWithResult(_0x31a166,_0x3e0b99){_0x3e0b99=_0x3e0b99||0xc8;return function(_0x1d8f38){if(_0x1d8f38){return _0x31a166[_0xd79a('0x1b')](_0x3e0b99)['json'](_0x1d8f38);}};}function respondWithFilteredResult(_0x3a8790,_0x5ca5df){return function(_0x684aa){if(_0x684aa){var _0x46a0fa=typeof _0x5ca5df[_0xd79a('0x1d')]==='undefined'&&typeof _0x5ca5df[_0xd79a('0x1e')]==='undefined';var _0x3d0719=_0x684aa[_0xd79a('0x1f')];var _0x414f69=_0x46a0fa?0x0:_0x5ca5df['offset'];var _0x52d6f1=_0x46a0fa?_0x684aa[_0xd79a('0x1f')]:_0x5ca5df['offset']+_0x5ca5df[_0xd79a('0x1e')];var _0x979010;if(_0x52d6f1>=_0x3d0719){_0x52d6f1=_0x3d0719;_0x979010=0xc8;}else{_0x979010=0xce;}_0x3a8790[_0xd79a('0x1b')](_0x979010);return _0x3a8790['set'](_0xd79a('0x20'),_0x414f69+'-'+_0x52d6f1+'/'+_0x3d0719)[_0xd79a('0x21')](_0x684aa);}return null;};}function patchUpdates(_0x2a9fae){return function(_0x10f827){try{jsonpatch[_0xd79a('0x22')](_0x10f827,_0x2a9fae,!![]);}catch(_0x335070){return BPromise[_0xd79a('0x23')](_0x335070);}return _0x10f827['save']();};}function saveUpdates(_0x59783e,_0x3dfac4){return function(_0x9cbe7d){if(_0x9cbe7d){return _0x9cbe7d[_0xd79a('0x24')](_0x59783e)[_0xd79a('0x25')](function(_0x10dcef){return _0x10dcef;});}return null;};}function removeEntity(_0x15470b,_0x51b8c3){return function(_0x3e420e){if(_0x3e420e){return _0x3e420e[_0xd79a('0x26')]()[_0xd79a('0x25')](function(){var _0x3554d6=_0x3e420e[_0xd79a('0x27')]({'plain':!![]});var _0x22634f=_0xd79a('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x22634f,'resourceId':_0x3554d6['id']}})['then'](function(){return _0x3e420e;});})[_0xd79a('0x25')](function(){_0x15470b[_0xd79a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6ce2,_0x2e6141){return function(_0x3bba7a){if(!_0x3bba7a){_0x4a6ce2[_0xd79a('0x1a')](0x194);}return _0x3bba7a;};}function handleError(_0x358e5a,_0x4483a3){_0x4483a3=_0x4483a3||0x1f4;return function(_0x2f75c0){logger[_0xd79a('0x29')](_0x2f75c0[_0xd79a('0x2a')]);if(_0x2f75c0[_0xd79a('0x2b')]){delete _0x2f75c0[_0xd79a('0x2b')];}_0x358e5a[_0xd79a('0x1b')](_0x4483a3)[_0xd79a('0x2c')](_0x2f75c0);};}exports['index']=function(_0x591d62,_0x41f5cb){var _0x4e9aa7={},_0x2531fe={},_0x3e9fc0={'count':0x0,'rows':[]};var _0x5b8e66=_['map'](db[_0xd79a('0x2d')]['rawAttributes'],function(_0x2ef565){return{'name':_0x2ef565['fieldName'],'type':_0x2ef565[_0xd79a('0x2e')][_0xd79a('0x2f')]};});_0x2531fe['model']=_[_0xd79a('0x30')](_0x5b8e66,_0xd79a('0x2b'));_0x2531fe[_0xd79a('0x31')]=_[_0xd79a('0x32')](_0x591d62[_0xd79a('0x31')]);_0x2531fe[_0xd79a('0x33')]=_['intersection'](_0x2531fe['model'],_0x2531fe[_0xd79a('0x31')]);_0x4e9aa7[_0xd79a('0x34')]=_[_0xd79a('0x35')](_0x2531fe['model'],qs[_0xd79a('0x36')](_0x591d62[_0xd79a('0x31')][_0xd79a('0x36')]));_0x4e9aa7[_0xd79a('0x34')]=_0x4e9aa7['attributes']['length']?_0x4e9aa7[_0xd79a('0x34')]:_0x2531fe[_0xd79a('0x37')];if(!_0x591d62[_0xd79a('0x31')][_0xd79a('0x38')](_0xd79a('0x39'))){_0x4e9aa7['limit']=qs['limit'](_0x591d62[_0xd79a('0x31')][_0xd79a('0x1e')]);_0x4e9aa7['offset']=qs[_0xd79a('0x1d')](_0x591d62[_0xd79a('0x31')][_0xd79a('0x1d')]);}_0x4e9aa7[_0xd79a('0x3a')]=qs[_0xd79a('0x3b')](_0x591d62[_0xd79a('0x31')]['sort']);_0x4e9aa7[_0xd79a('0x3c')]=qs['filters'](_['pick'](_0x591d62['query'],_0x2531fe[_0xd79a('0x33')]),_0x5b8e66);if(_0x591d62[_0xd79a('0x31')][_0xd79a('0x3d')]){_0x4e9aa7[_0xd79a('0x3c')]=_[_0xd79a('0x3e')](_0x4e9aa7[_0xd79a('0x3c')],{'$or':_[_0xd79a('0x30')](_0x5b8e66,function(_0x45e905){if(_0x45e905[_0xd79a('0x2e')]!=='VIRTUAL'){var _0x5f01f5={};_0x5f01f5[_0x45e905[_0xd79a('0x2b')]]={'$like':'%'+_0x591d62[_0xd79a('0x31')][_0xd79a('0x3d')]+'%'};return _0x5f01f5;}})});}_0x4e9aa7=_[_0xd79a('0x3e')]({},_0x4e9aa7,_0x591d62[_0xd79a('0x3f')]);var _0x66aa9e={'where':_0x4e9aa7[_0xd79a('0x3c')]};return db['Sound'][_0xd79a('0x1f')](_0x66aa9e)[_0xd79a('0x25')](function(_0x8c67bd){_0x3e9fc0['count']=_0x8c67bd;if(_0x591d62[_0xd79a('0x31')][_0xd79a('0x40')]){_0x4e9aa7[_0xd79a('0x41')]=[{'all':!![]}];}return db[_0xd79a('0x2d')][_0xd79a('0x42')](_0x4e9aa7);})[_0xd79a('0x25')](function(_0xe41151){_0x3e9fc0['rows']=_0xe41151;return _0x3e9fc0;})[_0xd79a('0x25')](respondWithFilteredResult(_0x41f5cb,_0x4e9aa7))[_0xd79a('0x43')](handleError(_0x41f5cb,null));};exports[_0xd79a('0x44')]=function(_0x30fe50,_0x4ac7da){var _0x352e68={'raw':!![],'where':{'id':_0x30fe50[_0xd79a('0x45')]['id']}},_0x369cf5={};_0x369cf5[_0xd79a('0x37')]=_[_0xd79a('0x32')](db[_0xd79a('0x2d')][_0xd79a('0x46')]);_0x369cf5[_0xd79a('0x31')]=_[_0xd79a('0x32')](_0x30fe50[_0xd79a('0x31')]);_0x369cf5[_0xd79a('0x33')]=_['intersection'](_0x369cf5['model'],_0x369cf5[_0xd79a('0x31')]);_0x352e68[_0xd79a('0x34')]=_[_0xd79a('0x35')](_0x369cf5[_0xd79a('0x37')],qs['fields'](_0x30fe50['query'][_0xd79a('0x36')]));_0x352e68[_0xd79a('0x34')]=_0x352e68[_0xd79a('0x34')][_0xd79a('0x47')]?_0x352e68[_0xd79a('0x34')]:_0x369cf5['model'];if(_0x30fe50[_0xd79a('0x31')][_0xd79a('0x40')]){_0x352e68[_0xd79a('0x41')]=[{'all':!![]}];}_0x352e68=_['merge']({},_0x352e68,_0x30fe50['options']);return db['Sound']['find'](_0x352e68)[_0xd79a('0x25')](handleEntityNotFound(_0x4ac7da,null))['then'](respondWithResult(_0x4ac7da,null))[_0xd79a('0x43')](handleError(_0x4ac7da,null));};exports[_0xd79a('0x48')]=function(_0x166825,_0x1cd75a,_0x19f9d1){return db[_0xd79a('0x2d')][_0xd79a('0x49')]({'where':{'id':_0x166825[_0xd79a('0x45')]['id']},'attributes':[_0xd79a('0x2b'),_0xd79a('0x4a'),_0xd79a('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x1cd75a,null))['then'](function(_0x5eb286){if(_0x5eb286){if(!fs[_0xd79a('0x4c')](path['join'](config[_0xd79a('0x4d')],_0xd79a('0x4e'),_0x5eb286[_0xd79a('0x4a')]+'.'+_0x5eb286[_0xd79a('0x4b')]))){throw new db[(_0xd79a('0x4f'))][(_0xd79a('0x50'))](_0xd79a('0x51'));}return _0x1cd75a[_0xd79a('0x48')](path[_0xd79a('0x52')](config[_0xd79a('0x4d')],_0xd79a('0x4e'),util[_0xd79a('0x53')]('%s.%s',_0x5eb286['save_name'],_0x5eb286[_0xd79a('0x4b')])),util[_0xd79a('0x53')]('%s.%s',_0x5eb286[_0xd79a('0x2b')],_0x5eb286[_0xd79a('0x4b')]));}return null;})[_0xd79a('0x43')](handleError(_0x1cd75a,null));};exports['create']=function(_0x48c9da,_0x4ba1f9,_0x26d52b){var _0x59491e={'name':path['basename'](_0x48c9da['file'][_0xd79a('0x54')],path['extname'](_0x48c9da[_0xd79a('0x55')][_0xd79a('0x54')])),'save_name':path[_0xd79a('0x56')](_0x48c9da[_0xd79a('0x55')][_0xd79a('0x57')],path[_0xd79a('0x58')](_0x48c9da[_0xd79a('0x55')]['filename'])),'original_format':path[_0xd79a('0x58')](_0x48c9da[_0xd79a('0x55')][_0xd79a('0x54')])[_0xd79a('0x59')](0x1),'converted_format':_0xd79a('0x5a')};var _0x487525=path[_0xd79a('0x52')](config[_0xd79a('0x4d')],_0xd79a('0x5b'),_0x48c9da[_0xd79a('0x55')][_0xd79a('0x57')]);var _0x3dd043=path[_0xd79a('0x52')](config[_0xd79a('0x4d')],_0xd79a('0x4e'),util[_0xd79a('0x53')](_0xd79a('0x5c'),path[_0xd79a('0x56')](_0x48c9da[_0xd79a('0x55')]['filename'],path[_0xd79a('0x58')](_0x48c9da[_0xd79a('0x55')]['filename'])),_0x59491e[_0xd79a('0x4b')]));logger[_0xd79a('0x5d')]('Sound\x20upload\x20filepath:\x20%s',_0x487525);logger[_0xd79a('0x5d')](_0xd79a('0x5e'),_0x3dd043);try{fs['chmodSync'](_0x487525,parseInt(_0xd79a('0x5f'),0x8));var _0xee19d9=sox['transcode'](_0x487525,_0x3dd043,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xee19d9['on'](_0xd79a('0x29'),function(_0x18ecca){fs[_0xd79a('0x60')](_0x487525);_0x4ba1f9[_0xd79a('0x1b')](0x1f4)[_0xd79a('0x2c')](_0x18ecca);});_0xee19d9['on'](_0xd79a('0x61'),function(_0x12d04c){_0x59491e[_0xd79a('0x62')]=isNaN(_0x12d04c[_0xd79a('0x63')])?null:_0x12d04c['duration']*0x3e8;_0x59491e[_0xd79a('0x64')]=isNaN(_0x12d04c['sampleCount'])?null:_0x12d04c['sampleCount'];_0x59491e[_0xd79a('0x65')]=isNaN(_0x12d04c[_0xd79a('0x66')])?null:_0x12d04c[_0xd79a('0x66')];_0x59491e[_0xd79a('0x67')]=isNaN(_0x12d04c['bitRate'])?null:_0x12d04c['bitRate'];_0x59491e[_0xd79a('0x68')]=isNaN(_0x12d04c['sampleRate'])?null:_0x12d04c[_0xd79a('0x69')];});_0xee19d9['on']('dest',function(_0x59173a){_0x59491e[_0xd79a('0x6a')]=isNaN(_0x59173a[_0xd79a('0x63')])?null:_0x59173a[_0xd79a('0x63')]*0x3e8;_0x59491e[_0xd79a('0x6b')]=isNaN(_0x59173a[_0xd79a('0x6c')])?null:_0x59173a[_0xd79a('0x6c')];_0x59491e['converted_channelCount']=isNaN(_0x59173a['channelCount'])?null:_0x59173a[_0xd79a('0x66')];_0x59491e[_0xd79a('0x6d')]=isNaN(_0x59173a[_0xd79a('0x6e')])?null:_0x59173a['bitRate'];_0x59491e[_0xd79a('0x6f')]=isNaN(_0x59173a['sampleRate'])?null:_0x59173a[_0xd79a('0x69')];});_0xee19d9['on'](_0xd79a('0x1c'),function(){fs[_0xd79a('0x70')](_0x3dd043,parseInt(_0xd79a('0x5f'),0x8));return db[_0xd79a('0x2d')][_0xd79a('0x71')](_0x59491e)['then'](function(_0xfbf4f2){var _0x2bb631={'role':_0x48c9da['body'][_0xd79a('0x72')],'userProfileId':_0x48c9da[_0xd79a('0x73')][_0xd79a('0x74')]};if(!_0x2bb631)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2bb631['role']===_0xd79a('0x75')){var _0x529f87=_0xfbf4f2[_0xd79a('0x27')]({'plain':!![]});return db[_0xd79a('0x76')][_0xd79a('0x49')]({'where':{'name':_0xd79a('0x28'),'userProfileId':_0x2bb631[_0xd79a('0x74')]},'raw':!![]})['then'](function(_0x5481a2){if(_0x5481a2&&_0x5481a2['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x529f87['name'],'resourceId':_0x529f87['id'],'type':_0x5481a2[_0xd79a('0x2b')],'sectionId':_0x5481a2['id']},{})[_0xd79a('0x25')](function(){return _0xfbf4f2;});}else{return _0xfbf4f2;}})[_0xd79a('0x43')](function(_0x4dcfea){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4dcfea);throw _0x4dcfea;});}return _0xfbf4f2;})[_0xd79a('0x25')](respondWithResult(_0x4ba1f9,null))['catch'](handleError(_0x4ba1f9,null));});_0xee19d9[_0xd79a('0x77')]();}catch(_0x48cdf2){_0x4ba1f9[_0xd79a('0x1b')](0x1f4)['send'](_0x48cdf2);}};exports[_0xd79a('0x24')]=function(_0x5757c6,_0x541605,_0x25c0b8){return db['Sound'][_0xd79a('0x49')]({'where':{'id':_0x5757c6['params']['id']}})[_0xd79a('0x25')](handleEntityNotFound(_0x541605,null))[_0xd79a('0x25')](saveUpdates(_[_0xd79a('0x78')](_0x5757c6[_0xd79a('0x73')],['name',_0xd79a('0x79')]),null))[_0xd79a('0x25')](respondWithResult(_0x541605,null))[_0xd79a('0x43')](handleError(_0x541605,null));};exports['delete']=function(_0x1022d8,_0x4896cd,_0x2f5fec){return db['Sound'][_0xd79a('0x49')]({'where':{'id':_0x1022d8['params']['id']}})['then'](function(_0x379b2d){if(_0x379b2d){return _0x379b2d['destroy']();}})[_0xd79a('0x25')](function(_0x21ae27){var _0x9436f7=path[_0xd79a('0x52')](config[_0xd79a('0x4d')],_0xd79a('0x5b'),util['format'](_0xd79a('0x5c'),_0x21ae27['save_name'],_0x21ae27[_0xd79a('0x7a')]));var _0x49b35f=path['join'](config[_0xd79a('0x4d')],_0xd79a('0x4e'),util[_0xd79a('0x53')](_0xd79a('0x5c'),_0x21ae27[_0xd79a('0x4a')],_0x21ae27[_0xd79a('0x4b')]));fs[_0xd79a('0x60')](_0x9436f7);fs['unlinkSync'](_0x49b35f);return _0x21ae27;})[_0xd79a('0x25')](function(_0x2a0b9e){if(_0x2a0b9e){return _0x4896cd[_0xd79a('0x1b')](0xcc)[_0xd79a('0x1c')]();}})[_0xd79a('0x25')](handleEntityNotFound(_0x4896cd,null))[_0xd79a('0x43')](handleError(_0x4896cd,null));}; \ No newline at end of file +var _0x6edf=['original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','delete','destroy','server/files/sounds/original','eml-format','rimraf','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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','offset','set','Content-Range','reject','save','then','get','Sounds','UserProfileResource','end','send','index','map','Sound','rawAttributes','fieldName','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','download','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','%s.%s','format','basename','file','originalname','extname','substring','wav','filename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x6edf,0x1a1));var _0xf6ed=function(_0x3bd1d6,_0x137d1e){_0x3bd1d6=_0x3bd1d6-0x0;var _0x5ea198=_0x6edf[_0x3bd1d6];return _0x5ea198;};'use strict';var emlformat=require(_0xf6ed('0x0'));var rimraf=require(_0xf6ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf6ed('0x2'));var rp=require(_0xf6ed('0x3'));var moment=require(_0xf6ed('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf6ed('0x5'));var util=require(_0xf6ed('0x6'));var path=require(_0xf6ed('0x7'));var sox=require(_0xf6ed('0x8'));var csv=require(_0xf6ed('0x9'));var ejs=require(_0xf6ed('0xa'));var fs=require('fs');var fs_extra=require(_0xf6ed('0xb'));var _=require(_0xf6ed('0xc'));var squel=require(_0xf6ed('0xd'));var crypto=require(_0xf6ed('0xe'));var jsforce=require(_0xf6ed('0xf'));var deskjs=require(_0xf6ed('0x10'));var toCsv=require(_0xf6ed('0x9'));var querystring=require(_0xf6ed('0x11'));var Papa=require(_0xf6ed('0x12'));var Redis=require(_0xf6ed('0x13'));var authService=require(_0xf6ed('0x14'));var qs=require(_0xf6ed('0x15'));var as=require(_0xf6ed('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6ed('0x17'))(_0xf6ed('0x18'));var utils=require('../../config/utils');var config=require(_0xf6ed('0x19'));var licenseUtil=require(_0xf6ed('0x1a'));var db=require(_0xf6ed('0x1b'))['db'];function respondWithStatusCode(_0x4b0dd7,_0x3a0c49){_0x3a0c49=_0x3a0c49||0xcc;return function(_0x34b1cd){if(_0x34b1cd){return _0x4b0dd7[_0xf6ed('0x1c')](_0x3a0c49);}return _0x4b0dd7[_0xf6ed('0x1d')](_0x3a0c49)['end']();};}function respondWithResult(_0xedab73,_0xd81459){_0xd81459=_0xd81459||0xc8;return function(_0x373a84){if(_0x373a84){return _0xedab73[_0xf6ed('0x1d')](_0xd81459)[_0xf6ed('0x1e')](_0x373a84);}};}function respondWithFilteredResult(_0x3d0c78,_0x58525f){return function(_0x8fa267){if(_0x8fa267){var _0x50b776=typeof _0x58525f['offset']==='undefined'&&typeof _0x58525f[_0xf6ed('0x1f')]==='undefined';var _0x138b62=_0x8fa267['count'];var _0xdb0229=_0x50b776?0x0:_0x58525f[_0xf6ed('0x20')];var _0x47a0c4=_0x50b776?_0x8fa267['count']:_0x58525f['offset']+_0x58525f['limit'];var _0x701ee8;if(_0x47a0c4>=_0x138b62){_0x47a0c4=_0x138b62;_0x701ee8=0xc8;}else{_0x701ee8=0xce;}_0x3d0c78[_0xf6ed('0x1d')](_0x701ee8);return _0x3d0c78[_0xf6ed('0x21')](_0xf6ed('0x22'),_0xdb0229+'-'+_0x47a0c4+'/'+_0x138b62)[_0xf6ed('0x1e')](_0x8fa267);}return null;};}function patchUpdates(_0x73a9bb){return function(_0x10cea4){try{jsonpatch['apply'](_0x10cea4,_0x73a9bb,!![]);}catch(_0x279d62){return BPromise[_0xf6ed('0x23')](_0x279d62);}return _0x10cea4[_0xf6ed('0x24')]();};}function saveUpdates(_0x5f30b8,_0x338b1e){return function(_0x2354b1){if(_0x2354b1){return _0x2354b1['update'](_0x5f30b8)[_0xf6ed('0x25')](function(_0x14b604){return _0x14b604;});}return null;};}function removeEntity(_0x23e1d0,_0x3eac8c){return function(_0x561c5e){if(_0x561c5e){return _0x561c5e['destroy']()[_0xf6ed('0x25')](function(){var _0x5013d4=_0x561c5e[_0xf6ed('0x26')]({'plain':!![]});var _0x5493bc=_0xf6ed('0x27');return db[_0xf6ed('0x28')]['destroy']({'where':{'type':_0x5493bc,'resourceId':_0x5013d4['id']}})[_0xf6ed('0x25')](function(){return _0x561c5e;});})['then'](function(){_0x23e1d0[_0xf6ed('0x1d')](0xcc)[_0xf6ed('0x29')]();});}};}function handleEntityNotFound(_0x3cfdb6,_0x1c0987){return function(_0x4a5ba1){if(!_0x4a5ba1){_0x3cfdb6[_0xf6ed('0x1c')](0x194);}return _0x4a5ba1;};}function handleError(_0x53bfd4,_0x5f481d){_0x5f481d=_0x5f481d||0x1f4;return function(_0x272358){logger['error'](_0x272358['stack']);if(_0x272358['name']){delete _0x272358['name'];}_0x53bfd4[_0xf6ed('0x1d')](_0x5f481d)[_0xf6ed('0x2a')](_0x272358);};}exports[_0xf6ed('0x2b')]=function(_0x369617,_0x46977c){var _0x52908e={},_0x3fad8e={},_0x4cc35f={'count':0x0,'rows':[]};var _0x2d577a=_[_0xf6ed('0x2c')](db[_0xf6ed('0x2d')][_0xf6ed('0x2e')],function(_0x4e6f53){return{'name':_0x4e6f53[_0xf6ed('0x2f')],'type':_0x4e6f53['type']['key']};});_0x3fad8e[_0xf6ed('0x30')]=_['map'](_0x2d577a,_0xf6ed('0x31'));_0x3fad8e['query']=_[_0xf6ed('0x32')](_0x369617[_0xf6ed('0x33')]);_0x3fad8e[_0xf6ed('0x34')]=_[_0xf6ed('0x35')](_0x3fad8e[_0xf6ed('0x30')],_0x3fad8e[_0xf6ed('0x33')]);_0x52908e[_0xf6ed('0x36')]=_[_0xf6ed('0x35')](_0x3fad8e[_0xf6ed('0x30')],qs['fields'](_0x369617[_0xf6ed('0x33')][_0xf6ed('0x37')]));_0x52908e[_0xf6ed('0x36')]=_0x52908e[_0xf6ed('0x36')][_0xf6ed('0x38')]?_0x52908e[_0xf6ed('0x36')]:_0x3fad8e[_0xf6ed('0x30')];if(!_0x369617['query'][_0xf6ed('0x39')]('nolimit')){_0x52908e['limit']=qs[_0xf6ed('0x1f')](_0x369617['query'][_0xf6ed('0x1f')]);_0x52908e[_0xf6ed('0x20')]=qs[_0xf6ed('0x20')](_0x369617[_0xf6ed('0x33')]['offset']);}_0x52908e[_0xf6ed('0x3a')]=qs[_0xf6ed('0x3b')](_0x369617[_0xf6ed('0x33')][_0xf6ed('0x3b')]);_0x52908e[_0xf6ed('0x3c')]=qs[_0xf6ed('0x34')](_[_0xf6ed('0x3d')](_0x369617[_0xf6ed('0x33')],_0x3fad8e['filters']),_0x2d577a);if(_0x369617[_0xf6ed('0x33')][_0xf6ed('0x3e')]){_0x52908e[_0xf6ed('0x3c')]=_[_0xf6ed('0x3f')](_0x52908e[_0xf6ed('0x3c')],{'$or':_[_0xf6ed('0x2c')](_0x2d577a,function(_0xcc42ab){if(_0xcc42ab[_0xf6ed('0x40')]!==_0xf6ed('0x41')){var _0x3c2c1f={};_0x3c2c1f[_0xcc42ab[_0xf6ed('0x31')]]={'$like':'%'+_0x369617[_0xf6ed('0x33')][_0xf6ed('0x3e')]+'%'};return _0x3c2c1f;}})});}_0x52908e=_[_0xf6ed('0x3f')]({},_0x52908e,_0x369617[_0xf6ed('0x42')]);var _0x117d52={'where':_0x52908e['where']};return db[_0xf6ed('0x2d')][_0xf6ed('0x43')](_0x117d52)[_0xf6ed('0x25')](function(_0x57bc64){_0x4cc35f[_0xf6ed('0x43')]=_0x57bc64;if(_0x369617[_0xf6ed('0x33')][_0xf6ed('0x44')]){_0x52908e[_0xf6ed('0x45')]=[{'all':!![]}];}return db[_0xf6ed('0x2d')][_0xf6ed('0x46')](_0x52908e);})['then'](function(_0x2f2186){_0x4cc35f[_0xf6ed('0x47')]=_0x2f2186;return _0x4cc35f;})['then'](respondWithFilteredResult(_0x46977c,_0x52908e))[_0xf6ed('0x48')](handleError(_0x46977c,null));};exports[_0xf6ed('0x49')]=function(_0x4b7c70,_0xa11163){var _0x59e4d6={'raw':!![],'where':{'id':_0x4b7c70[_0xf6ed('0x4a')]['id']}},_0x107587={};_0x107587[_0xf6ed('0x30')]=_[_0xf6ed('0x32')](db[_0xf6ed('0x2d')][_0xf6ed('0x2e')]);_0x107587[_0xf6ed('0x33')]=_['keys'](_0x4b7c70[_0xf6ed('0x33')]);_0x107587[_0xf6ed('0x34')]=_[_0xf6ed('0x35')](_0x107587[_0xf6ed('0x30')],_0x107587[_0xf6ed('0x33')]);_0x59e4d6[_0xf6ed('0x36')]=_[_0xf6ed('0x35')](_0x107587[_0xf6ed('0x30')],qs[_0xf6ed('0x37')](_0x4b7c70[_0xf6ed('0x33')][_0xf6ed('0x37')]));_0x59e4d6[_0xf6ed('0x36')]=_0x59e4d6[_0xf6ed('0x36')]['length']?_0x59e4d6[_0xf6ed('0x36')]:_0x107587['model'];if(_0x4b7c70[_0xf6ed('0x33')][_0xf6ed('0x44')]){_0x59e4d6[_0xf6ed('0x45')]=[{'all':!![]}];}_0x59e4d6=_[_0xf6ed('0x3f')]({},_0x59e4d6,_0x4b7c70['options']);return db[_0xf6ed('0x2d')][_0xf6ed('0x4b')](_0x59e4d6)['then'](handleEntityNotFound(_0xa11163,null))[_0xf6ed('0x25')](respondWithResult(_0xa11163,null))['catch'](handleError(_0xa11163,null));};exports[_0xf6ed('0x4c')]=function(_0x1f1862,_0x2fef65,_0x749245){return db[_0xf6ed('0x2d')][_0xf6ed('0x4b')]({'where':{'id':_0x1f1862[_0xf6ed('0x4a')]['id']},'attributes':['name',_0xf6ed('0x4d'),_0xf6ed('0x4e')],'raw':!![]})[_0xf6ed('0x25')](handleEntityNotFound(_0x2fef65,null))[_0xf6ed('0x25')](function(_0x373288){if(_0x373288){if(!fs[_0xf6ed('0x4f')](path[_0xf6ed('0x50')](config[_0xf6ed('0x51')],_0xf6ed('0x52'),_0x373288[_0xf6ed('0x4d')]+'.'+_0x373288['converted_format']))){throw new db[(_0xf6ed('0x53'))][(_0xf6ed('0x54'))](_0xf6ed('0x55'));}return _0x2fef65[_0xf6ed('0x4c')](path['join'](config[_0xf6ed('0x51')],_0xf6ed('0x52'),util['format'](_0xf6ed('0x56'),_0x373288[_0xf6ed('0x4d')],_0x373288['converted_format'])),util[_0xf6ed('0x57')](_0xf6ed('0x56'),_0x373288[_0xf6ed('0x31')],_0x373288[_0xf6ed('0x4e')]));}return null;})[_0xf6ed('0x48')](handleError(_0x2fef65,null));};exports['create']=function(_0x40e44c,_0x410aae,_0x4bba38){var _0x56999c={'name':path[_0xf6ed('0x58')](_0x40e44c[_0xf6ed('0x59')]['originalname'],path['extname'](_0x40e44c['file'][_0xf6ed('0x5a')])),'save_name':path[_0xf6ed('0x58')](_0x40e44c[_0xf6ed('0x59')]['filename'],path['extname'](_0x40e44c[_0xf6ed('0x59')]['filename'])),'original_format':path[_0xf6ed('0x5b')](_0x40e44c[_0xf6ed('0x59')][_0xf6ed('0x5a')])[_0xf6ed('0x5c')](0x1),'converted_format':_0xf6ed('0x5d')};var _0x27fedf=path[_0xf6ed('0x50')](config[_0xf6ed('0x51')],'server/files/sounds/original',_0x40e44c['file']['filename']);var _0x4d2534=path[_0xf6ed('0x50')](config[_0xf6ed('0x51')],_0xf6ed('0x52'),util[_0xf6ed('0x57')](_0xf6ed('0x56'),path[_0xf6ed('0x58')](_0x40e44c[_0xf6ed('0x59')][_0xf6ed('0x5e')],path[_0xf6ed('0x5b')](_0x40e44c['file'][_0xf6ed('0x5e')])),_0x56999c[_0xf6ed('0x4e')]));logger[_0xf6ed('0x5f')](_0xf6ed('0x60'),_0x27fedf);logger['info'](_0xf6ed('0x61'),_0x4d2534);try{fs[_0xf6ed('0x62')](_0x27fedf,parseInt(_0xf6ed('0x63'),0x8));var _0x5681e9=sox[_0xf6ed('0x64')](_0x27fedf,_0x4d2534,{'sampleRate':0x1f40,'format':_0xf6ed('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5681e9['on'](_0xf6ed('0x65'),function(_0x229e70){fs[_0xf6ed('0x66')](_0x27fedf);_0x410aae[_0xf6ed('0x1d')](0x1f4)[_0xf6ed('0x2a')](_0x229e70);});_0x5681e9['on'](_0xf6ed('0x67'),function(_0x2a3750){_0x56999c[_0xf6ed('0x68')]=isNaN(_0x2a3750[_0xf6ed('0x69')])?null:_0x2a3750[_0xf6ed('0x69')]*0x3e8;_0x56999c[_0xf6ed('0x6a')]=isNaN(_0x2a3750['sampleCount'])?null:_0x2a3750['sampleCount'];_0x56999c[_0xf6ed('0x6b')]=isNaN(_0x2a3750[_0xf6ed('0x6c')])?null:_0x2a3750[_0xf6ed('0x6c')];_0x56999c[_0xf6ed('0x6d')]=isNaN(_0x2a3750[_0xf6ed('0x6e')])?null:_0x2a3750[_0xf6ed('0x6e')];_0x56999c[_0xf6ed('0x6f')]=isNaN(_0x2a3750[_0xf6ed('0x70')])?null:_0x2a3750[_0xf6ed('0x70')];});_0x5681e9['on']('dest',function(_0x59f0bc){_0x56999c[_0xf6ed('0x71')]=isNaN(_0x59f0bc[_0xf6ed('0x69')])?null:_0x59f0bc['duration']*0x3e8;_0x56999c['converted_sampleCount']=isNaN(_0x59f0bc[_0xf6ed('0x72')])?null:_0x59f0bc['sampleCount'];_0x56999c[_0xf6ed('0x73')]=isNaN(_0x59f0bc['channelCount'])?null:_0x59f0bc[_0xf6ed('0x6c')];_0x56999c[_0xf6ed('0x74')]=isNaN(_0x59f0bc['bitRate'])?null:_0x59f0bc[_0xf6ed('0x6e')];_0x56999c[_0xf6ed('0x75')]=isNaN(_0x59f0bc[_0xf6ed('0x70')])?null:_0x59f0bc['sampleRate'];});_0x5681e9['on'](_0xf6ed('0x29'),function(){fs[_0xf6ed('0x62')](_0x4d2534,parseInt(_0xf6ed('0x63'),0x8));return db[_0xf6ed('0x2d')][_0xf6ed('0x76')](_0x56999c)['then'](function(_0x5ad409){var _0x5cdc25={'role':_0x40e44c[_0xf6ed('0x77')][_0xf6ed('0x78')],'userProfileId':_0x40e44c[_0xf6ed('0x77')]['userProfileId']};if(!_0x5cdc25)throw new Error(_0xf6ed('0x79'));if(_0x5cdc25[_0xf6ed('0x78')]===_0xf6ed('0x7a')){var _0x36814a=_0x5ad409[_0xf6ed('0x26')]({'plain':!![]});return db[_0xf6ed('0x7b')][_0xf6ed('0x4b')]({'where':{'name':_0xf6ed('0x27'),'userProfileId':_0x5cdc25[_0xf6ed('0x7c')]},'raw':!![]})[_0xf6ed('0x25')](function(_0x55dede){if(_0x55dede&&_0x55dede[_0xf6ed('0x7d')]===0x0){return db[_0xf6ed('0x28')][_0xf6ed('0x76')]({'name':_0x36814a[_0xf6ed('0x31')],'resourceId':_0x36814a['id'],'type':_0x55dede['name'],'sectionId':_0x55dede['id']},{})[_0xf6ed('0x25')](function(){return _0x5ad409;});}else{return _0x5ad409;}})['catch'](function(_0x57efaa){logger[_0xf6ed('0x65')](_0xf6ed('0x7e'),_0x57efaa);throw _0x57efaa;});}return _0x5ad409;})['then'](respondWithResult(_0x410aae,null))[_0xf6ed('0x48')](handleError(_0x410aae,null));});_0x5681e9['start']();}catch(_0x4ab280){_0x410aae[_0xf6ed('0x1d')](0x1f4)[_0xf6ed('0x2a')](_0x4ab280);}};exports[_0xf6ed('0x7f')]=function(_0x56877d,_0x27e05a,_0x1228c5){return db[_0xf6ed('0x2d')][_0xf6ed('0x4b')]({'where':{'id':_0x56877d['params']['id']}})[_0xf6ed('0x25')](handleEntityNotFound(_0x27e05a,null))[_0xf6ed('0x25')](saveUpdates(_[_0xf6ed('0x3d')](_0x56877d[_0xf6ed('0x77')],[_0xf6ed('0x31'),'description']),null))[_0xf6ed('0x25')](respondWithResult(_0x27e05a,null))[_0xf6ed('0x48')](handleError(_0x27e05a,null));};exports[_0xf6ed('0x80')]=function(_0x1d8669,_0x3dae54,_0x496af2){return db[_0xf6ed('0x2d')][_0xf6ed('0x4b')]({'where':{'id':_0x1d8669[_0xf6ed('0x4a')]['id']}})[_0xf6ed('0x25')](function(_0x1a2ed6){if(_0x1a2ed6){return _0x1a2ed6[_0xf6ed('0x81')]();}})[_0xf6ed('0x25')](function(_0x1fd40d){var _0x5bd01f=path[_0xf6ed('0x50')](config[_0xf6ed('0x51')],_0xf6ed('0x82'),util['format']('%s.%s',_0x1fd40d[_0xf6ed('0x4d')],_0x1fd40d['original_format']));var _0x4d6054=path[_0xf6ed('0x50')](config[_0xf6ed('0x51')],_0xf6ed('0x52'),util[_0xf6ed('0x57')]('%s.%s',_0x1fd40d[_0xf6ed('0x4d')],_0x1fd40d[_0xf6ed('0x4e')]));fs[_0xf6ed('0x66')](_0x5bd01f);fs[_0xf6ed('0x66')](_0x4d6054);return _0x1fd40d;})[_0xf6ed('0x25')](function(_0x45972c){if(_0x45972c){return _0x3dae54[_0xf6ed('0x1d')](0xcc)[_0xf6ed('0x29')]();}})[_0xf6ed('0x25')](handleEntityNotFound(_0x3dae54,null))[_0xf6ed('0x48')](handleError(_0x3dae54,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index a5ef853..2229872 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 _0xca28=['request-promise','path','../../config/environment','exports','define','Sound','tools_sounds','lodash','util','../../config/logger','moment','bluebird'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xca28,0xa3));var _0x8ca2=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xca28[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x8ca2('0x0'));var util=require(_0x8ca2('0x1'));var logger=require(_0x8ca2('0x2'))('api');var moment=require(_0x8ca2('0x3'));var BPromise=require(_0x8ca2('0x4'));var rp=require(_0x8ca2('0x5'));var fs=require('fs');var path=require(_0x8ca2('0x6'));var rimraf=require('rimraf');var config=require(_0x8ca2('0x7'));var attributes=require('./sound.attributes');module[_0x8ca2('0x8')]=function(_0x2215bb,_0x204714){return _0x2215bb[_0x8ca2('0x9')](_0x8ca2('0xa'),attributes,{'tableName':_0x8ca2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1d1e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util'];(function(_0x3a9b08,_0x2df26d){var _0x3ea265=function(_0x19cc90){while(--_0x19cc90){_0x3a9b08['push'](_0x3a9b08['shift']());}};_0x3ea265(++_0x2df26d);}(_0x1d1e,0x124));var _0xe1d1=function(_0x568bba,_0x2cabca){_0x568bba=_0x568bba-0x0;var _0x3b49e0=_0x1d1e[_0x568bba];return _0x3b49e0;};'use strict';var _=require(_0xe1d1('0x0'));var util=require(_0xe1d1('0x1'));var logger=require('../../config/logger')(_0xe1d1('0x2'));var moment=require(_0xe1d1('0x3'));var BPromise=require(_0xe1d1('0x4'));var rp=require(_0xe1d1('0x5'));var fs=require('fs');var path=require(_0xe1d1('0x6'));var rimraf=require(_0xe1d1('0x7'));var config=require(_0xe1d1('0x8'));var attributes=require(_0xe1d1('0x9'));module[_0xe1d1('0xa')]=function(_0x2781f0,_0x3f8723){return _0x2781f0[_0xe1d1('0xb')](_0xe1d1('0xc'),attributes,{'tableName':_0xe1d1('0xd'),'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 a64050d..020b240 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 _0xb14c=['then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound','Sound','find','options','where','attributes','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xba40e1,_0x4c3fa5){var _0x1d8a19=function(_0x27751a){while(--_0x27751a){_0xba40e1['push'](_0xba40e1['shift']());}};_0x1d8a19(++_0x4c3fa5);}(_0xb14c,0x173));var _0xcb14=function(_0x7b17fe,_0x1233ff){_0x7b17fe=_0x7b17fe-0x0;var _0x5215be=_0xb14c[_0x7b17fe];return _0x5215be;};'use strict';var _=require(_0xcb14('0x0'));var util=require(_0xcb14('0x1'));var moment=require(_0xcb14('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcb14('0x3'));var db=require(_0xcb14('0x4'))['db'];var utils=require(_0xcb14('0x5'));var logger=require(_0xcb14('0x6'))(_0xcb14('0x7'));var config=require(_0xcb14('0x8'));var jayson=require(_0xcb14('0x9'));var client=jayson[_0xcb14('0xa')][_0xcb14('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xff0564,_0x5660ea,_0xee4202){return new BPromise(function(_0x4dc816,_0x1e1115){return client[_0xcb14('0xc')](_0xff0564,_0xee4202)[_0xcb14('0xd')](function(_0x34adfc){logger[_0xcb14('0xe')](_0xcb14('0xf'),_0x5660ea,_0xcb14('0x10'));logger[_0xcb14('0x11')](_0xcb14('0x12'),_0x5660ea,'request\x20sent',JSON[_0xcb14('0x13')](_0x34adfc));if(_0x34adfc[_0xcb14('0x14')]){if(_0x34adfc[_0xcb14('0x14')]['code']===0x1f4){logger[_0xcb14('0x14')](_0xcb14('0xf'),_0x5660ea,_0x34adfc['error']['message']);return _0x1e1115(_0x34adfc[_0xcb14('0x14')]['message']);}logger[_0xcb14('0x14')]('Sound,\x20%s,\x20%s',_0x5660ea,_0x34adfc[_0xcb14('0x14')][_0xcb14('0x15')]);return _0x4dc816(_0x34adfc[_0xcb14('0x14')][_0xcb14('0x15')]);}else{logger[_0xcb14('0xe')](_0xcb14('0xf'),_0x5660ea,'request\x20sent');_0x4dc816(_0x34adfc['result'][_0xcb14('0x15')]);}})[_0xcb14('0x16')](function(_0xfd030d){logger[_0xcb14('0x14')](_0xcb14('0xf'),_0x5660ea,_0xfd030d);_0x1e1115(_0xfd030d);});});}exports[_0xcb14('0x17')]=function(_0x3a0a9c){var _0x4da535=this;return new Promise(function(_0x29083c,_0x53513e){return db[_0xcb14('0x18')][_0xcb14('0x19')]({'raw':_0x3a0a9c[_0xcb14('0x1a')]?_0x3a0a9c[_0xcb14('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x3a0a9c['options']?_0x3a0a9c['options'][_0xcb14('0x1b')]||null:null,'attributes':_0x3a0a9c[_0xcb14('0x1a')]?_0x3a0a9c[_0xcb14('0x1a')][_0xcb14('0x1c')]||null:null,'include':_0x3a0a9c['options']?_0x3a0a9c['options'][_0xcb14('0x1d')]?_[_0xcb14('0x1e')](_0x3a0a9c[_0xcb14('0x1a')][_0xcb14('0x1d')],function(_0x3b2fcf){return{'model':db[_0x3b2fcf['model']],'as':_0x3b2fcf['as'],'attributes':_0x3b2fcf[_0xcb14('0x1c')],'include':_0x3b2fcf[_0xcb14('0x1d')]?_[_0xcb14('0x1e')](_0x3b2fcf[_0xcb14('0x1d')],function(_0x31e6cd){return{'model':db[_0x31e6cd[_0xcb14('0x1f')]],'as':_0x31e6cd['as'],'attributes':_0x31e6cd[_0xcb14('0x1c')],'include':_0x31e6cd[_0xcb14('0x1d')]?_['map'](_0x31e6cd[_0xcb14('0x1d')],function(_0x58eac7){return{'model':db[_0x58eac7[_0xcb14('0x1f')]],'as':_0x58eac7['as'],'attributes':_0x58eac7['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb14('0xd')](function(_0x12c744){logger[_0xcb14('0xe')](_0xcb14('0x17'),_0x3a0a9c);logger['debug'](_0xcb14('0x17'),_0x3a0a9c,JSON[_0xcb14('0x13')](_0x12c744));_0x29083c(_0x12c744);})[_0xcb14('0x16')](function(_0x28972b){logger[_0xcb14('0x14')](_0xcb14('0x17'),_0x28972b[_0xcb14('0x15')],_0x3a0a9c);_0x53513e(_0x4da535['error'](0x1f4,_0x28972b['message']));});});}; \ No newline at end of file +var _0x58f1=['stringify','error','code','message','info','catch','ShowSound','Sound','find','options','attributes','map','include','model','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x58f1,0xd2));var _0x158f=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x58f1[_0x280f4a];return _0x1bb157;};'use strict';var _=require('lodash');var util=require(_0x158f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x158f('0x1'));var db=require(_0x158f('0x2'))['db'];var utils=require(_0x158f('0x3'));var logger=require('../../config/logger')(_0x158f('0x4'));var config=require(_0x158f('0x5'));var jayson=require(_0x158f('0x6'));var client=jayson[_0x158f('0x7')][_0x158f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e114b,_0x10c622,_0x28af0d){return new BPromise(function(_0x11ed3a,_0x4e8618){return client['request'](_0x1e114b,_0x28af0d)[_0x158f('0x9')](function(_0x32b955){logger['info'](_0x158f('0xa'),_0x10c622,'request\x20sent');logger[_0x158f('0xb')](_0x158f('0xc'),_0x10c622,_0x158f('0xd'),JSON[_0x158f('0xe')](_0x32b955));if(_0x32b955[_0x158f('0xf')]){if(_0x32b955[_0x158f('0xf')][_0x158f('0x10')]===0x1f4){logger[_0x158f('0xf')](_0x158f('0xa'),_0x10c622,_0x32b955[_0x158f('0xf')][_0x158f('0x11')]);return _0x4e8618(_0x32b955[_0x158f('0xf')]['message']);}logger[_0x158f('0xf')](_0x158f('0xa'),_0x10c622,_0x32b955[_0x158f('0xf')]['message']);return _0x11ed3a(_0x32b955[_0x158f('0xf')][_0x158f('0x11')]);}else{logger[_0x158f('0x12')](_0x158f('0xa'),_0x10c622,'request\x20sent');_0x11ed3a(_0x32b955['result'][_0x158f('0x11')]);}})[_0x158f('0x13')](function(_0x54d2bc){logger['error']('Sound,\x20%s,\x20%s',_0x10c622,_0x54d2bc);_0x4e8618(_0x54d2bc);});});}exports[_0x158f('0x14')]=function(_0x21ce30){var _0x3db25d=this;return new Promise(function(_0x27658c,_0x218d38){return db[_0x158f('0x15')][_0x158f('0x16')]({'raw':_0x21ce30[_0x158f('0x17')]?_0x21ce30['options']['raw']===undefined?!![]:![]:!![],'where':_0x21ce30[_0x158f('0x17')]?_0x21ce30[_0x158f('0x17')]['where']||null:null,'attributes':_0x21ce30[_0x158f('0x17')]?_0x21ce30[_0x158f('0x17')][_0x158f('0x18')]||null:null,'include':_0x21ce30['options']?_0x21ce30[_0x158f('0x17')]['include']?_[_0x158f('0x19')](_0x21ce30[_0x158f('0x17')][_0x158f('0x1a')],function(_0x5589ef){return{'model':db[_0x5589ef[_0x158f('0x1b')]],'as':_0x5589ef['as'],'attributes':_0x5589ef[_0x158f('0x18')],'include':_0x5589ef[_0x158f('0x1a')]?_[_0x158f('0x19')](_0x5589ef['include'],function(_0x43f6a5){return{'model':db[_0x43f6a5[_0x158f('0x1b')]],'as':_0x43f6a5['as'],'attributes':_0x43f6a5[_0x158f('0x18')],'include':_0x43f6a5['include']?_[_0x158f('0x19')](_0x43f6a5[_0x158f('0x1a')],function(_0x2a0631){return{'model':db[_0x2a0631[_0x158f('0x1b')]],'as':_0x2a0631['as'],'attributes':_0x2a0631['attributes']};}):[]};}):[]};}):[]:[]})[_0x158f('0x9')](function(_0xc0579d){logger[_0x158f('0x12')](_0x158f('0x14'),_0x21ce30);logger[_0x158f('0xb')]('ShowSound',_0x21ce30,JSON[_0x158f('0xe')](_0xc0579d));_0x27658c(_0xc0579d);})['catch'](function(_0x40354b){logger[_0x158f('0xf')](_0x158f('0x14'),_0x40354b[_0x158f('0x11')],_0x21ce30);_0x218d38(_0x3db25d[_0x158f('0xf')](0x1f4,_0x40354b[_0x158f('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index a811419..f4dd3b1 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 _0xb10b=['./squareMessage.controller','get','index','isAuthenticated','show','post','create','put','/:id','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x63c210,_0x7ac34f){var _0x4263f6=function(_0x281b8b){while(--_0x281b8b){_0x63c210['push'](_0x63c210['shift']());}};_0x4263f6(++_0x7ac34f);}(_0xb10b,0x12a));var _0xbb10=function(_0x3655e5,_0x469eae){_0x3655e5=_0x3655e5-0x0;var _0x37dfac=_0xb10b[_0x3655e5];return _0x37dfac;};'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('0xd')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['update']);router['delete'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb7e7=['exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','index','get','/:id','show','post','isAuthenticated','create','put','delete','destroy'];(function(_0x71d6f7,_0xab7539){var _0x5c9d1a=function(_0x20bb50){while(--_0x20bb50){_0x71d6f7['push'](_0x71d6f7['shift']());}};_0x5c9d1a(++_0xab7539);}(_0xb7e7,0x121));var _0x7b7e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb7e7[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7b7e('0x0'));var util=require('util');var path=require(_0x7b7e('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b7e('0x2'));var router=express['Router']();var fs_extra=require(_0x7b7e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var controller=require(_0x7b7e('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b7e('0x7')]);router[_0x7b7e('0x8')](_0x7b7e('0x9'),auth['isAuthenticated'](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0xb')]('/',auth[_0x7b7e('0xc')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller['update']);router[_0x7b7e('0xf')](_0x7b7e('0x9'),auth[_0x7b7e('0xc')](),controller[_0x7b7e('0x10')]);module[_0x7b7e('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index e54adb1..706d7ed 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 _0xff05=['exports','TEXT','medium','ENUM','out','STRING','sequelize'];(function(_0x3cda5a,_0x12a608){var _0x1a8fcb=function(_0x876290){while(--_0x876290){_0x3cda5a['push'](_0x3cda5a['shift']());}};_0x1a8fcb(++_0x12a608);}(_0xff05,0x1e2));var _0x5ff0=function(_0x23119e,_0x3edc41){_0x23119e=_0x23119e-0x0;var _0xe1dd57=_0xff05[_0x23119e];return _0xe1dd57;};'use strict';var Sequelize=require(_0x5ff0('0x0'));module[_0x5ff0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x5ff0('0x2')](_0x5ff0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x5ff0('0x4')]('in',_0x5ff0('0x5')),'defaultValue':_0x5ff0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x5ff0('0x6')]},'providerResponse':{'type':Sequelize[_0x5ff0('0x2')]}}; \ No newline at end of file +var _0x9fff=['sequelize','exports','STRING','TEXT','medium','ENUM','out'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9fff,0x134));var _0xf9ff=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9fff[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf9ff('0x0'));module[_0xf9ff('0x1')]={'uniqueid':{'type':Sequelize[_0xf9ff('0x2')]},'body':{'type':Sequelize[_0xf9ff('0x3')](_0xf9ff('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0xf9ff('0x5')]('in','out'),'defaultValue':_0xf9ff('0x6'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 8d2118e..c1f65b7 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 _0x7f6f=['json','save','update','then','destroy','stack','send','map','rawAttributes','fieldName','type','key','name','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','options','SquareMessage','include','rows','show','params','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','count','offset','limit'];(function(_0x24e680,_0xc2e569){var _0xc7b2b4=function(_0x584cc6){while(--_0x584cc6){_0x24e680['push'](_0x24e680['shift']());}};_0xc7b2b4(++_0xc2e569);}(_0x7f6f,0x6c));var _0xf7f6=function(_0x3734bc,_0xf0ad5f){_0x3734bc=_0x3734bc-0x0;var _0x5d965c=_0x7f6f[_0x3734bc];return _0x5d965c;};'use strict';var emlformat=require(_0xf7f6('0x0'));var rimraf=require(_0xf7f6('0x1'));var zipdir=require(_0xf7f6('0x2'));var jsonpatch=require(_0xf7f6('0x3'));var rp=require(_0xf7f6('0x4'));var moment=require(_0xf7f6('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf7f6('0x6'));var path=require(_0xf7f6('0x7'));var sox=require(_0xf7f6('0x8'));var csv=require(_0xf7f6('0x9'));var ejs=require(_0xf7f6('0xa'));var fs=require('fs');var fs_extra=require(_0xf7f6('0xb'));var _=require(_0xf7f6('0xc'));var squel=require(_0xf7f6('0xd'));var crypto=require(_0xf7f6('0xe'));var jsforce=require(_0xf7f6('0xf'));var deskjs=require(_0xf7f6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf7f6('0x11'));var Papa=require('papaparse');var Redis=require(_0xf7f6('0x12'));var authService=require(_0xf7f6('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf7f6('0x14'));var hardwareService=require(_0xf7f6('0x15'));var logger=require(_0xf7f6('0x16'))(_0xf7f6('0x17'));var utils=require(_0xf7f6('0x18'));var config=require(_0xf7f6('0x19'));var licenseUtil=require(_0xf7f6('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb5a46f,_0x35601d){_0x35601d=_0x35601d||0xcc;return function(_0xceb207){if(_0xceb207){return _0xb5a46f[_0xf7f6('0x1b')](_0x35601d);}return _0xb5a46f[_0xf7f6('0x1c')](_0x35601d)[_0xf7f6('0x1d')]();};}function respondWithResult(_0xe3a975,_0x52e914){_0x52e914=_0x52e914||0xc8;return function(_0x23115d){if(_0x23115d){return _0xe3a975[_0xf7f6('0x1c')](_0x52e914)['json'](_0x23115d);}};}function respondWithFilteredResult(_0x3892e3,_0x418a5e){return function(_0x3cb4bd){if(_0x3cb4bd){var _0x7c3594=typeof _0x418a5e['offset']===_0xf7f6('0x1e')&&typeof _0x418a5e['limit']==='undefined';var _0x578499=_0x3cb4bd[_0xf7f6('0x1f')];var _0x23794f=_0x7c3594?0x0:_0x418a5e[_0xf7f6('0x20')];var _0x40a530=_0x7c3594?_0x3cb4bd[_0xf7f6('0x1f')]:_0x418a5e[_0xf7f6('0x20')]+_0x418a5e[_0xf7f6('0x21')];var _0x1fa1aa;if(_0x40a530>=_0x578499){_0x40a530=_0x578499;_0x1fa1aa=0xc8;}else{_0x1fa1aa=0xce;}_0x3892e3[_0xf7f6('0x1c')](_0x1fa1aa);return _0x3892e3['set']('Content-Range',_0x23794f+'-'+_0x40a530+'/'+_0x578499)[_0xf7f6('0x22')](_0x3cb4bd);}return null;};}function patchUpdates(_0x2e687e){return function(_0x440a5a){try{jsonpatch['apply'](_0x440a5a,_0x2e687e,!![]);}catch(_0x17c38c){return BPromise['reject'](_0x17c38c);}return _0x440a5a[_0xf7f6('0x23')]();};}function saveUpdates(_0x426a22,_0x3afa02){return function(_0x16aadb){if(_0x16aadb){return _0x16aadb[_0xf7f6('0x24')](_0x426a22)[_0xf7f6('0x25')](function(_0x57576a){return _0x57576a;});}return null;};}function removeEntity(_0x595930,_0x35c008){return function(_0x1539d6){if(_0x1539d6){return _0x1539d6[_0xf7f6('0x26')]()['then'](function(){_0x595930[_0xf7f6('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29fe4c,_0x32852b){return function(_0x3ecd51){if(!_0x3ecd51){_0x29fe4c[_0xf7f6('0x1b')](0x194);}return _0x3ecd51;};}function handleError(_0x3cfd36,_0x2f65ef){_0x2f65ef=_0x2f65ef||0x1f4;return function(_0xa29153){logger['error'](_0xa29153[_0xf7f6('0x27')]);if(_0xa29153['name']){delete _0xa29153['name'];}_0x3cfd36[_0xf7f6('0x1c')](_0x2f65ef)[_0xf7f6('0x28')](_0xa29153);};}exports['index']=function(_0x49b232,_0x2fefb6){var _0x5d7fff={},_0x2fdd5f={},_0x52fa6a={'count':0x0,'rows':[]};var _0x2b4f0e=_[_0xf7f6('0x29')](db['SquareMessage'][_0xf7f6('0x2a')],function(_0x2a8a96){return{'name':_0x2a8a96[_0xf7f6('0x2b')],'type':_0x2a8a96[_0xf7f6('0x2c')][_0xf7f6('0x2d')]};});_0x2fdd5f['model']=_[_0xf7f6('0x29')](_0x2b4f0e,_0xf7f6('0x2e'));_0x2fdd5f['query']=_['keys'](_0x49b232[_0xf7f6('0x2f')]);_0x2fdd5f['filters']=_[_0xf7f6('0x30')](_0x2fdd5f[_0xf7f6('0x31')],_0x2fdd5f[_0xf7f6('0x2f')]);_0x5d7fff[_0xf7f6('0x32')]=_[_0xf7f6('0x30')](_0x2fdd5f[_0xf7f6('0x31')],qs[_0xf7f6('0x33')](_0x49b232[_0xf7f6('0x2f')][_0xf7f6('0x33')]));_0x5d7fff[_0xf7f6('0x32')]=_0x5d7fff[_0xf7f6('0x32')][_0xf7f6('0x34')]?_0x5d7fff[_0xf7f6('0x32')]:_0x2fdd5f[_0xf7f6('0x31')];if(!_0x49b232[_0xf7f6('0x2f')][_0xf7f6('0x35')](_0xf7f6('0x36'))){_0x5d7fff['limit']=qs[_0xf7f6('0x21')](_0x49b232['query'][_0xf7f6('0x21')]);_0x5d7fff['offset']=qs['offset'](_0x49b232['query'][_0xf7f6('0x20')]);}_0x5d7fff[_0xf7f6('0x37')]=qs[_0xf7f6('0x38')](_0x49b232[_0xf7f6('0x2f')][_0xf7f6('0x38')]);_0x5d7fff[_0xf7f6('0x39')]=qs['filters'](_[_0xf7f6('0x3a')](_0x49b232[_0xf7f6('0x2f')],_0x2fdd5f[_0xf7f6('0x3b')]),_0x2b4f0e);if(_0x49b232[_0xf7f6('0x2f')]['filter']){_0x5d7fff[_0xf7f6('0x39')]=_[_0xf7f6('0x3c')](_0x5d7fff[_0xf7f6('0x39')],{'$or':_[_0xf7f6('0x29')](_0x2b4f0e,function(_0x34a4a7){if(_0x34a4a7[_0xf7f6('0x2c')]!=='VIRTUAL'){var _0x650d28={};_0x650d28[_0x34a4a7[_0xf7f6('0x2e')]]={'$like':'%'+_0x49b232[_0xf7f6('0x2f')]['filter']+'%'};return _0x650d28;}})});}_0x5d7fff=_[_0xf7f6('0x3c')]({},_0x5d7fff,_0x49b232[_0xf7f6('0x3d')]);var _0x4b495c={'where':_0x5d7fff[_0xf7f6('0x39')]};return db[_0xf7f6('0x3e')][_0xf7f6('0x1f')](_0x4b495c)[_0xf7f6('0x25')](function(_0x1a0e4f){_0x52fa6a[_0xf7f6('0x1f')]=_0x1a0e4f;if(_0x49b232['query']['includeAll']){_0x5d7fff[_0xf7f6('0x3f')]=[{'all':!![]}];}return db[_0xf7f6('0x3e')]['findAll'](_0x5d7fff);})[_0xf7f6('0x25')](function(_0x269dc6){_0x52fa6a[_0xf7f6('0x40')]=_0x269dc6;return _0x52fa6a;})[_0xf7f6('0x25')](respondWithFilteredResult(_0x2fefb6,_0x5d7fff))['catch'](handleError(_0x2fefb6,null));};exports[_0xf7f6('0x41')]=function(_0x1caa88,_0x1c1b6f){var _0x110c57={'raw':!![],'where':{'id':_0x1caa88[_0xf7f6('0x42')]['id']}},_0x25470d={};_0x25470d[_0xf7f6('0x31')]=_['keys'](db[_0xf7f6('0x3e')][_0xf7f6('0x2a')]);_0x25470d[_0xf7f6('0x2f')]=_['keys'](_0x1caa88[_0xf7f6('0x2f')]);_0x25470d[_0xf7f6('0x3b')]=_[_0xf7f6('0x30')](_0x25470d[_0xf7f6('0x31')],_0x25470d[_0xf7f6('0x2f')]);_0x110c57['attributes']=_[_0xf7f6('0x30')](_0x25470d[_0xf7f6('0x31')],qs[_0xf7f6('0x33')](_0x1caa88[_0xf7f6('0x2f')][_0xf7f6('0x33')]));_0x110c57[_0xf7f6('0x32')]=_0x110c57[_0xf7f6('0x32')][_0xf7f6('0x34')]?_0x110c57[_0xf7f6('0x32')]:_0x25470d[_0xf7f6('0x31')];if(_0x1caa88['query']['includeAll']){_0x110c57[_0xf7f6('0x3f')]=[{'all':!![]}];}_0x110c57=_['merge']({},_0x110c57,_0x1caa88[_0xf7f6('0x3d')]);return db[_0xf7f6('0x3e')][_0xf7f6('0x43')](_0x110c57)[_0xf7f6('0x25')](handleEntityNotFound(_0x1c1b6f,null))[_0xf7f6('0x25')](respondWithResult(_0x1c1b6f,null))[_0xf7f6('0x44')](handleError(_0x1c1b6f,null));};exports[_0xf7f6('0x45')]=function(_0x7e5539,_0xe1e644){return db['SquareMessage']['create'](_0x7e5539['body'],{})[_0xf7f6('0x25')](respondWithResult(_0xe1e644,0xc9))[_0xf7f6('0x44')](handleError(_0xe1e644,null));};exports[_0xf7f6('0x24')]=function(_0x551f59,_0x5b34fb){if(_0x551f59['body']['id']){delete _0x551f59['body']['id'];}return db['SquareMessage'][_0xf7f6('0x43')]({'where':{'id':_0x551f59[_0xf7f6('0x42')]['id']}})[_0xf7f6('0x25')](handleEntityNotFound(_0x5b34fb,null))[_0xf7f6('0x25')](saveUpdates(_0x551f59[_0xf7f6('0x46')],null))[_0xf7f6('0x25')](respondWithResult(_0x5b34fb,null))[_0xf7f6('0x44')](handleError(_0x5b34fb,null));};exports[_0xf7f6('0x26')]=function(_0xf19a0a,_0x1d6685){return db['SquareMessage'][_0xf7f6('0x43')]({'where':{'id':_0xf19a0a[_0xf7f6('0x42')]['id']}})[_0xf7f6('0x25')](handleEntityNotFound(_0x1d6685,null))[_0xf7f6('0x25')](removeEntity(_0x1d6685,null))[_0xf7f6('0x44')](handleError(_0x1d6685,null));}; \ No newline at end of file +var _0xe6e4=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','SquareMessage','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra'];(function(_0x5b083b,_0x145a9b){var _0x6c2225=function(_0xcc6435){while(--_0xcc6435){_0x5b083b['push'](_0x5b083b['shift']());}};_0x6c2225(++_0x145a9b);}(_0xe6e4,0x139));var _0x4e6e=function(_0x5dd351,_0x19ebc5){_0x5dd351=_0x5dd351-0x0;var _0x1fbdba=_0xe6e4[_0x5dd351];return _0x1fbdba;};'use strict';var emlformat=require(_0x4e6e('0x0'));var rimraf=require(_0x4e6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e6e('0x2'));var rp=require(_0x4e6e('0x3'));var moment=require(_0x4e6e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e6e('0x5'));var util=require(_0x4e6e('0x6'));var path=require(_0x4e6e('0x7'));var sox=require(_0x4e6e('0x8'));var csv=require('to-csv');var ejs=require(_0x4e6e('0x9'));var fs=require('fs');var fs_extra=require(_0x4e6e('0xa'));var _=require(_0x4e6e('0xb'));var squel=require(_0x4e6e('0xc'));var crypto=require(_0x4e6e('0xd'));var jsforce=require(_0x4e6e('0xe'));var deskjs=require(_0x4e6e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4e6e('0x10'));var Papa=require(_0x4e6e('0x11'));var Redis=require(_0x4e6e('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4e6e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e6e('0x14'));var logger=require(_0x4e6e('0x15'))(_0x4e6e('0x16'));var utils=require('../../config/utils');var config=require(_0x4e6e('0x17'));var licenseUtil=require(_0x4e6e('0x18'));var db=require(_0x4e6e('0x19'))['db'];function respondWithStatusCode(_0x2163e8,_0x2b1ef8){_0x2b1ef8=_0x2b1ef8||0xcc;return function(_0xef9381){if(_0xef9381){return _0x2163e8[_0x4e6e('0x1a')](_0x2b1ef8);}return _0x2163e8['status'](_0x2b1ef8)['end']();};}function respondWithResult(_0x1795ee,_0x30712c){_0x30712c=_0x30712c||0xc8;return function(_0x22b970){if(_0x22b970){return _0x1795ee[_0x4e6e('0x1b')](_0x30712c)[_0x4e6e('0x1c')](_0x22b970);}};}function respondWithFilteredResult(_0x1a3a68,_0x75fa54){return function(_0x3dad06){if(_0x3dad06){var _0x2af2fe=typeof _0x75fa54[_0x4e6e('0x1d')]===_0x4e6e('0x1e')&&typeof _0x75fa54[_0x4e6e('0x1f')]===_0x4e6e('0x1e');var _0x361feb=_0x3dad06[_0x4e6e('0x20')];var _0x4924e9=_0x2af2fe?0x0:_0x75fa54['offset'];var _0x45f45b=_0x2af2fe?_0x3dad06[_0x4e6e('0x20')]:_0x75fa54['offset']+_0x75fa54[_0x4e6e('0x1f')];var _0x575591;if(_0x45f45b>=_0x361feb){_0x45f45b=_0x361feb;_0x575591=0xc8;}else{_0x575591=0xce;}_0x1a3a68[_0x4e6e('0x1b')](_0x575591);return _0x1a3a68[_0x4e6e('0x21')](_0x4e6e('0x22'),_0x4924e9+'-'+_0x45f45b+'/'+_0x361feb)['json'](_0x3dad06);}return null;};}function patchUpdates(_0x56f592){return function(_0x65770){try{jsonpatch[_0x4e6e('0x23')](_0x65770,_0x56f592,!![]);}catch(_0x1767eb){return BPromise[_0x4e6e('0x24')](_0x1767eb);}return _0x65770[_0x4e6e('0x25')]();};}function saveUpdates(_0x5860a2,_0x16f958){return function(_0x13b0b9){if(_0x13b0b9){return _0x13b0b9[_0x4e6e('0x26')](_0x5860a2)[_0x4e6e('0x27')](function(_0x105c60){return _0x105c60;});}return null;};}function removeEntity(_0x5df95f,_0x44eab1){return function(_0x53d08c){if(_0x53d08c){return _0x53d08c[_0x4e6e('0x28')]()[_0x4e6e('0x27')](function(){_0x5df95f[_0x4e6e('0x1b')](0xcc)[_0x4e6e('0x29')]();});}};}function handleEntityNotFound(_0x2122fc,_0xeff3af){return function(_0x3419f2){if(!_0x3419f2){_0x2122fc[_0x4e6e('0x1a')](0x194);}return _0x3419f2;};}function handleError(_0x4ac91a,_0x164c3c){_0x164c3c=_0x164c3c||0x1f4;return function(_0x334bac){logger[_0x4e6e('0x2a')](_0x334bac[_0x4e6e('0x2b')]);if(_0x334bac[_0x4e6e('0x2c')]){delete _0x334bac['name'];}_0x4ac91a[_0x4e6e('0x1b')](_0x164c3c)[_0x4e6e('0x2d')](_0x334bac);};}exports[_0x4e6e('0x2e')]=function(_0x4d9ac9,_0x598bb6){var _0x476b4b={},_0x406dd6={},_0x137ce0={'count':0x0,'rows':[]};var _0x4f01dd=_['map'](db['SquareMessage'][_0x4e6e('0x2f')],function(_0x25da20){return{'name':_0x25da20[_0x4e6e('0x30')],'type':_0x25da20['type'][_0x4e6e('0x31')]};});_0x406dd6['model']=_[_0x4e6e('0x32')](_0x4f01dd,'name');_0x406dd6[_0x4e6e('0x33')]=_[_0x4e6e('0x34')](_0x4d9ac9[_0x4e6e('0x33')]);_0x406dd6[_0x4e6e('0x35')]=_['intersection'](_0x406dd6[_0x4e6e('0x36')],_0x406dd6[_0x4e6e('0x33')]);_0x476b4b[_0x4e6e('0x37')]=_[_0x4e6e('0x38')](_0x406dd6[_0x4e6e('0x36')],qs[_0x4e6e('0x39')](_0x4d9ac9[_0x4e6e('0x33')][_0x4e6e('0x39')]));_0x476b4b[_0x4e6e('0x37')]=_0x476b4b[_0x4e6e('0x37')][_0x4e6e('0x3a')]?_0x476b4b[_0x4e6e('0x37')]:_0x406dd6['model'];if(!_0x4d9ac9[_0x4e6e('0x33')][_0x4e6e('0x3b')](_0x4e6e('0x3c'))){_0x476b4b[_0x4e6e('0x1f')]=qs[_0x4e6e('0x1f')](_0x4d9ac9[_0x4e6e('0x33')][_0x4e6e('0x1f')]);_0x476b4b[_0x4e6e('0x1d')]=qs[_0x4e6e('0x1d')](_0x4d9ac9[_0x4e6e('0x33')]['offset']);}_0x476b4b[_0x4e6e('0x3d')]=qs[_0x4e6e('0x3e')](_0x4d9ac9['query'][_0x4e6e('0x3e')]);_0x476b4b[_0x4e6e('0x3f')]=qs[_0x4e6e('0x35')](_[_0x4e6e('0x40')](_0x4d9ac9[_0x4e6e('0x33')],_0x406dd6[_0x4e6e('0x35')]),_0x4f01dd);if(_0x4d9ac9[_0x4e6e('0x33')][_0x4e6e('0x41')]){_0x476b4b['where']=_[_0x4e6e('0x42')](_0x476b4b['where'],{'$or':_[_0x4e6e('0x32')](_0x4f01dd,function(_0x3f74c8){if(_0x3f74c8[_0x4e6e('0x43')]!==_0x4e6e('0x44')){var _0x2ba26c={};_0x2ba26c[_0x3f74c8[_0x4e6e('0x2c')]]={'$like':'%'+_0x4d9ac9[_0x4e6e('0x33')]['filter']+'%'};return _0x2ba26c;}})});}_0x476b4b=_[_0x4e6e('0x42')]({},_0x476b4b,_0x4d9ac9['options']);var _0x19281a={'where':_0x476b4b[_0x4e6e('0x3f')]};return db[_0x4e6e('0x45')][_0x4e6e('0x20')](_0x19281a)[_0x4e6e('0x27')](function(_0xff8fcd){_0x137ce0[_0x4e6e('0x20')]=_0xff8fcd;if(_0x4d9ac9[_0x4e6e('0x33')][_0x4e6e('0x46')]){_0x476b4b[_0x4e6e('0x47')]=[{'all':!![]}];}return db['SquareMessage'][_0x4e6e('0x48')](_0x476b4b);})[_0x4e6e('0x27')](function(_0x210083){_0x137ce0[_0x4e6e('0x49')]=_0x210083;return _0x137ce0;})['then'](respondWithFilteredResult(_0x598bb6,_0x476b4b))[_0x4e6e('0x4a')](handleError(_0x598bb6,null));};exports[_0x4e6e('0x4b')]=function(_0x2051cb,_0x37b306){var _0x25ba3e={'raw':!![],'where':{'id':_0x2051cb[_0x4e6e('0x4c')]['id']}},_0x5c1948={};_0x5c1948[_0x4e6e('0x36')]=_['keys'](db[_0x4e6e('0x45')][_0x4e6e('0x2f')]);_0x5c1948['query']=_[_0x4e6e('0x34')](_0x2051cb[_0x4e6e('0x33')]);_0x5c1948[_0x4e6e('0x35')]=_[_0x4e6e('0x38')](_0x5c1948['model'],_0x5c1948[_0x4e6e('0x33')]);_0x25ba3e[_0x4e6e('0x37')]=_[_0x4e6e('0x38')](_0x5c1948[_0x4e6e('0x36')],qs[_0x4e6e('0x39')](_0x2051cb[_0x4e6e('0x33')][_0x4e6e('0x39')]));_0x25ba3e[_0x4e6e('0x37')]=_0x25ba3e[_0x4e6e('0x37')][_0x4e6e('0x3a')]?_0x25ba3e['attributes']:_0x5c1948[_0x4e6e('0x36')];if(_0x2051cb['query']['includeAll']){_0x25ba3e[_0x4e6e('0x47')]=[{'all':!![]}];}_0x25ba3e=_[_0x4e6e('0x42')]({},_0x25ba3e,_0x2051cb[_0x4e6e('0x4d')]);return db[_0x4e6e('0x45')][_0x4e6e('0x4e')](_0x25ba3e)['then'](handleEntityNotFound(_0x37b306,null))[_0x4e6e('0x27')](respondWithResult(_0x37b306,null))[_0x4e6e('0x4a')](handleError(_0x37b306,null));};exports[_0x4e6e('0x4f')]=function(_0x4379b7,_0x358e9a){return db['SquareMessage'][_0x4e6e('0x4f')](_0x4379b7[_0x4e6e('0x50')],{})[_0x4e6e('0x27')](respondWithResult(_0x358e9a,0xc9))[_0x4e6e('0x4a')](handleError(_0x358e9a,null));};exports[_0x4e6e('0x26')]=function(_0x1c562c,_0x3f3aae){if(_0x1c562c[_0x4e6e('0x50')]['id']){delete _0x1c562c[_0x4e6e('0x50')]['id'];}return db['SquareMessage'][_0x4e6e('0x4e')]({'where':{'id':_0x1c562c[_0x4e6e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3f3aae,null))[_0x4e6e('0x27')](saveUpdates(_0x1c562c[_0x4e6e('0x50')],null))[_0x4e6e('0x27')](respondWithResult(_0x3f3aae,null))[_0x4e6e('0x4a')](handleError(_0x3f3aae,null));};exports[_0x4e6e('0x28')]=function(_0x31ed68,_0x36fc43){return db[_0x4e6e('0x45')]['find']({'where':{'id':_0x31ed68['params']['id']}})[_0x4e6e('0x27')](handleEntityNotFound(_0x36fc43,null))['then'](removeEntity(_0x36fc43,null))[_0x4e6e('0x4a')](handleError(_0x36fc43,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index b4f86a5..2175e6a 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 _0x5d89=['request-promise','rimraf','../../config/environment','./squareMessage.attributes','SquareMessage','square_messages','util','bluebird'];(function(_0x51a197,_0xfdd177){var _0x5d1efd=function(_0x55b058){while(--_0x55b058){_0x51a197['push'](_0x51a197['shift']());}};_0x5d1efd(++_0xfdd177);}(_0x5d89,0x17e));var _0x95d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x95d8('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x95d8('0x1'));var rp=require(_0x95d8('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x95d8('0x3'));var config=require(_0x95d8('0x4'));var attributes=require(_0x95d8('0x5'));module['exports']=function(_0x365fb4,_0x14d4f6){return _0x365fb4['define'](_0x95d8('0x6'),attributes,{'tableName':_0x95d8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f8e=['rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages','lodash','util','api','moment','request-promise','path'];(function(_0x2e2e41,_0x3a7848){var _0x266226=function(_0x458e0a){while(--_0x458e0a){_0x2e2e41['push'](_0x2e2e41['shift']());}};_0x266226(++_0x3a7848);}(_0x8f8e,0x13f));var _0xe8f8=function(_0x329664,_0x130748){_0x329664=_0x329664-0x0;var _0x4e346e=_0x8f8e[_0x329664];return _0x4e346e;};'use strict';var _=require(_0xe8f8('0x0'));var util=require(_0xe8f8('0x1'));var logger=require('../../config/logger')(_0xe8f8('0x2'));var moment=require(_0xe8f8('0x3'));var BPromise=require('bluebird');var rp=require(_0xe8f8('0x4'));var fs=require('fs');var path=require(_0xe8f8('0x5'));var rimraf=require(_0xe8f8('0x6'));var config=require(_0xe8f8('0x7'));var attributes=require(_0xe8f8('0x8'));module[_0xe8f8('0x9')]=function(_0x5f198e,_0x245657){return _0x5f198e[_0xe8f8('0xa')](_0xe8f8('0xb'),attributes,{'tableName':_0xe8f8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 117d452..a9c7cf1 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 _0x392f=['code','error','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x29eeb1,_0x40ee55){var _0xe62f34=function(_0x3768ea){while(--_0x3768ea){_0x29eeb1['push'](_0x29eeb1['shift']());}};_0xe62f34(++_0x40ee55);}(_0x392f,0x143));var _0xf392=function(_0x14f5a3,_0x268d64){_0x14f5a3=_0x14f5a3-0x0;var _0xc84d0e=_0x392f[_0x14f5a3];return _0xc84d0e;};'use strict';var _=require('lodash');var util=require(_0xf392('0x0'));var moment=require('moment');var BPromise=require(_0xf392('0x1'));var rs=require(_0xf392('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf392('0x3'))['db'];var utils=require(_0xf392('0x4'));var logger=require('../../config/logger')(_0xf392('0x5'));var config=require('../../config/environment');var jayson=require(_0xf392('0x6'));var client=jayson['client'][_0xf392('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x48cc02,_0x4b1e16,_0x27ca0d){return new BPromise(function(_0x261c50,_0x1defce){return client[_0xf392('0x8')](_0x48cc02,_0x27ca0d)[_0xf392('0x9')](function(_0x28d595){logger[_0xf392('0xa')](_0xf392('0xb'),_0x4b1e16,_0xf392('0xc'));logger[_0xf392('0xd')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4b1e16,'request\x20sent',JSON[_0xf392('0xe')](_0x28d595));if(_0x28d595['error']){if(_0x28d595['error'][_0xf392('0xf')]===0x1f4){logger[_0xf392('0x10')](_0xf392('0xb'),_0x4b1e16,_0x28d595[_0xf392('0x10')][_0xf392('0x11')]);return _0x1defce(_0x28d595[_0xf392('0x10')][_0xf392('0x11')]);}logger[_0xf392('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4b1e16,_0x28d595[_0xf392('0x10')][_0xf392('0x11')]);return _0x261c50(_0x28d595[_0xf392('0x10')][_0xf392('0x11')]);}else{logger[_0xf392('0xa')](_0xf392('0xb'),_0x4b1e16,_0xf392('0xc'));_0x261c50(_0x28d595[_0xf392('0x12')][_0xf392('0x11')]);}})[_0xf392('0x13')](function(_0x115d5e){logger[_0xf392('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4b1e16,_0x115d5e);_0x1defce(_0x115d5e);});});}exports[_0xf392('0x14')]=function(_0x3f4bb4){var _0x2ade56=this;return new Promise(function(_0x31b10e,_0x21244){return db[_0xf392('0x15')][_0xf392('0x16')](_0x3f4bb4[_0xf392('0x17')],{'raw':_0x3f4bb4[_0xf392('0x18')]?_0x3f4bb4[_0xf392('0x18')][_0xf392('0x19')]===undefined?!![]:![]:!![]})[_0xf392('0x9')](function(_0x1b4d08){logger['info'](_0xf392('0x14'),_0x3f4bb4);logger['debug']('CreateSquareMessage',_0x3f4bb4,JSON[_0xf392('0xe')](_0x1b4d08));_0x31b10e(_0x1b4d08);})['catch'](function(_0x23c93c){logger['error'](_0xf392('0x14'),_0x23c93c['message'],_0x3f4bb4);_0x21244(_0x2ade56[_0xf392('0x10')](0x1f4,_0x23c93c[_0xf392('0x11')]));});});}; \ No newline at end of file +var _0x336a=['bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareMessage,\x20%s,\x20%s','catch','SquareMessage','create','body','raw','CreateSquareMessage','lodash','util'];(function(_0xd95a4f,_0x5b2faf){var _0x913026=function(_0x4e9711){while(--_0x4e9711){_0xd95a4f['push'](_0xd95a4f['shift']());}};_0x913026(++_0x5b2faf);}(_0x336a,0x1ec));var _0xa336=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0x336a[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xa336('0x0'));var util=require(_0xa336('0x1'));var moment=require('moment');var BPromise=require(_0xa336('0x2'));var rs=require(_0xa336('0x3'));var fs=require('fs');var Redis=require(_0xa336('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa336('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa336('0x6'));var client=jayson[_0xa336('0x7')][_0xa336('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52227c,_0x158174,_0x402bb8){return new BPromise(function(_0xf3c41c,_0x2cdb99){return client[_0xa336('0x9')](_0x52227c,_0x402bb8)[_0xa336('0xa')](function(_0x144ef1){logger[_0xa336('0xb')]('SquareMessage,\x20%s,\x20%s',_0x158174,_0xa336('0xc'));logger[_0xa336('0xd')](_0xa336('0xe'),_0x158174,_0xa336('0xc'),JSON[_0xa336('0xf')](_0x144ef1));if(_0x144ef1[_0xa336('0x10')]){if(_0x144ef1['error'][_0xa336('0x11')]===0x1f4){logger[_0xa336('0x10')]('SquareMessage,\x20%s,\x20%s',_0x158174,_0x144ef1[_0xa336('0x10')][_0xa336('0x12')]);return _0x2cdb99(_0x144ef1[_0xa336('0x10')][_0xa336('0x12')]);}logger[_0xa336('0x10')](_0xa336('0x13'),_0x158174,_0x144ef1[_0xa336('0x10')][_0xa336('0x12')]);return _0xf3c41c(_0x144ef1[_0xa336('0x10')][_0xa336('0x12')]);}else{logger[_0xa336('0xb')]('SquareMessage,\x20%s,\x20%s',_0x158174,_0xa336('0xc'));_0xf3c41c(_0x144ef1['result'][_0xa336('0x12')]);}})[_0xa336('0x14')](function(_0x4dd3a9){logger[_0xa336('0x10')]('SquareMessage,\x20%s,\x20%s',_0x158174,_0x4dd3a9);_0x2cdb99(_0x4dd3a9);});});}exports['CreateSquareMessage']=function(_0x582327){var _0x1f3404=this;return new Promise(function(_0x2c4f73,_0x95c923){return db[_0xa336('0x15')][_0xa336('0x16')](_0x582327[_0xa336('0x17')],{'raw':_0x582327['options']?_0x582327['options'][_0xa336('0x18')]===undefined?!![]:![]:!![]})[_0xa336('0xa')](function(_0x2d348d){logger[_0xa336('0xb')](_0xa336('0x19'),_0x582327);logger[_0xa336('0xd')](_0xa336('0x19'),_0x582327,JSON['stringify'](_0x2d348d));_0x2c4f73(_0x2d348d);})[_0xa336('0x14')](function(_0x103a0b){logger[_0xa336('0x10')](_0xa336('0x19'),_0x103a0b[_0xa336('0x12')],_0x582327);_0x95c923(_0x1f3404[_0xa336('0x10')](0x1f4,_0x103a0b[_0xa336('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 578f930..d3d6b05 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 _0x44d9=['exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','/:id/test','15s','create','delete'];(function(_0x3bcdb1,_0xa8c1bc){var _0x47bc5d=function(_0x891b46){while(--_0x891b46){_0x3bcdb1['push'](_0x3bcdb1['shift']());}};_0x47bc5d(++_0xa8c1bc);}(_0x44d9,0x144));var _0x944d=function(_0x2c8b72,_0x1697c2){_0x2c8b72=_0x2c8b72-0x0;var _0x1b0885=_0x44d9[_0x2c8b72];return _0x1b0885;};'use strict';var multer=require(_0x944d('0x0'));var util=require(_0x944d('0x1'));var path=require('path');var timeout=require(_0x944d('0x2'));var express=require('express');var router=express[_0x944d('0x3')]();var fs_extra=require(_0x944d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x944d('0x5'));var config=require(_0x944d('0x6'));var controller=require(_0x944d('0x7'));router[_0x944d('0x8')]('/',auth[_0x944d('0x9')](),controller[_0x944d('0xa')]);router[_0x944d('0x8')](_0x944d('0xb'),auth[_0x944d('0x9')](),controller['show']);router[_0x944d('0x8')](_0x944d('0xc'),auth['isAuthenticated'](),timeout(_0x944d('0xd')),controller['test']);router['post']('/',auth[_0x944d('0x9')](),controller[_0x944d('0xe')]);router['put'](_0x944d('0xb'),auth[_0x944d('0x9')](),controller['update']);router[_0x944d('0xf')]('/:id',auth[_0x944d('0x9')](),controller['destroy']);module[_0x944d('0x10')]=router; \ No newline at end of file +var _0xe43f=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','/:id','show','15s','test','post','create','put','update','exports'];(function(_0x40779e,_0xbaa21){var _0x2b9d32=function(_0x28247e){while(--_0x28247e){_0x40779e['push'](_0x40779e['shift']());}};_0x2b9d32(++_0xbaa21);}(_0xe43f,0x168));var _0xfe43=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0xe43f[_0x3158d2];return _0x57c15a;};'use strict';var multer=require('multer');var util=require(_0xfe43('0x0'));var path=require(_0xfe43('0x1'));var timeout=require(_0xfe43('0x2'));var express=require(_0xfe43('0x3'));var router=express[_0xfe43('0x4')]();var fs_extra=require(_0xfe43('0x5'));var auth=require(_0xfe43('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe43('0x7'));var controller=require(_0xfe43('0x8'));router[_0xfe43('0x9')]('/',auth[_0xfe43('0xa')](),controller['index']);router[_0xfe43('0x9')](_0xfe43('0xb'),auth[_0xfe43('0xa')](),controller[_0xfe43('0xc')]);router[_0xfe43('0x9')]('/:id/test',auth['isAuthenticated'](),timeout(_0xfe43('0xd')),controller[_0xfe43('0xe')]);router[_0xfe43('0xf')]('/',auth[_0xfe43('0xa')](),controller[_0xfe43('0x10')]);router[_0xfe43('0x11')](_0xfe43('0xb'),auth[_0xfe43('0xa')](),controller[_0xfe43('0x12')]);router['delete']('/:id',auth[_0xfe43('0xa')](),controller['destroy']);module[_0xfe43('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 4899866..e629502 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 _0xec25=['sequelize','STRING','name'];(function(_0x5bc07a,_0x9d2e5d){var _0x1f0693=function(_0x8aeafe){while(--_0x8aeafe){_0x5bc07a['push'](_0x5bc07a['shift']());}};_0x1f0693(++_0x9d2e5d);}(_0xec25,0x1dd));var _0x5ec2=function(_0x35f8f2,_0x883bf7){_0x35f8f2=_0x35f8f2-0x0;var _0x5af027=_0xec25[_0x35f8f2];return _0x5af027;};'use strict';var Sequelize=require(_0x5ec2('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ec2('0x1')],'unique':_0x5ec2('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0x5ec2('0x1')]},'description':{'type':Sequelize[_0x5ec2('0x1')]}}; \ No newline at end of file +var _0x3344=['STRING','name','sequelize','exports'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x3344,0x17e));var _0x4334=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3344[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x4334('0x0'));module[_0x4334('0x1')]={'name':{'type':Sequelize[_0x4334('0x2')],'unique':_0x4334('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x4334('0x2')]},'description':{'type':Sequelize[_0x4334('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 22fae1f..179a775 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 _0x12fb=['fs-extra','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','status','set','apply','reject','update','then','get','ODBC','UserProfileResource','destroy','sendStatus','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','VIRTUAL','merge','includeAll','include','rows','catch','show','params','keys','fields','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','openSync','closeSync','eml-format','fast-json-patch','request-promise','mustache','util','to-csv','ejs'];(function(_0x1e4e1a,_0x3bdb4a){var _0x462e08=function(_0x4e3359){while(--_0x4e3359){_0x1e4e1a['push'](_0x1e4e1a['shift']());}};_0x462e08(++_0x3bdb4a);}(_0x12fb,0x145));var _0xb12f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x12fb[_0x4709c0];return _0x13348b;};'use strict';var emlformat=require(_0xb12f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb12f('0x1'));var rp=require(_0xb12f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb12f('0x3'));var util=require(_0xb12f('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xb12f('0x5'));var ejs=require(_0xb12f('0x6'));var fs=require('fs');var fs_extra=require(_0xb12f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb12f('0x8'));var toCsv=require(_0xb12f('0x5'));var querystring=require(_0xb12f('0x9'));var Papa=require(_0xb12f('0xa'));var Redis=require(_0xb12f('0xb'));var authService=require(_0xb12f('0xc'));var qs=require(_0xb12f('0xd'));var as=require(_0xb12f('0xe'));var hardwareService=require(_0xb12f('0xf'));var logger=require('../../config/logger')(_0xb12f('0x10'));var utils=require(_0xb12f('0x11'));var config=require(_0xb12f('0x12'));var licenseUtil=require(_0xb12f('0x13'));var db=require(_0xb12f('0x14'))['db'];function respondWithStatusCode(_0x2d4c22,_0x581719){_0x581719=_0x581719||0xcc;return function(_0xd9b32c){if(_0xd9b32c){return _0x2d4c22['sendStatus'](_0x581719);}return _0x2d4c22['status'](_0x581719)[_0xb12f('0x15')]();};}function respondWithResult(_0x236c81,_0x19a8ea){_0x19a8ea=_0x19a8ea||0xc8;return function(_0x2207da){if(_0x2207da){return _0x236c81['status'](_0x19a8ea)[_0xb12f('0x16')](_0x2207da);}};}function respondWithFilteredResult(_0xc4d94d,_0x327ac1){return function(_0x432c8d){if(_0x432c8d){var _0x12e3ab=typeof _0x327ac1[_0xb12f('0x17')]===_0xb12f('0x18')&&typeof _0x327ac1[_0xb12f('0x19')]===_0xb12f('0x18');var _0x2df201=_0x432c8d['count'];var _0x587eee=_0x12e3ab?0x0:_0x327ac1[_0xb12f('0x17')];var _0x44abef=_0x12e3ab?_0x432c8d[_0xb12f('0x1a')]:_0x327ac1[_0xb12f('0x17')]+_0x327ac1[_0xb12f('0x19')];var _0x57ad0d;if(_0x44abef>=_0x2df201){_0x44abef=_0x2df201;_0x57ad0d=0xc8;}else{_0x57ad0d=0xce;}_0xc4d94d[_0xb12f('0x1b')](_0x57ad0d);return _0xc4d94d[_0xb12f('0x1c')]('Content-Range',_0x587eee+'-'+_0x44abef+'/'+_0x2df201)[_0xb12f('0x16')](_0x432c8d);}return null;};}function patchUpdates(_0x31a78e){return function(_0x20ac5d){try{jsonpatch[_0xb12f('0x1d')](_0x20ac5d,_0x31a78e,!![]);}catch(_0x57bb3f){return BPromise[_0xb12f('0x1e')](_0x57bb3f);}return _0x20ac5d['save']();};}function saveUpdates(_0x24086c,_0x6c564){return function(_0x2d0d45){if(_0x2d0d45){return _0x2d0d45[_0xb12f('0x1f')](_0x24086c)[_0xb12f('0x20')](function(_0x2c9d5f){return _0x2c9d5f;});}return null;};}function removeEntity(_0x1569b4,_0x464576){return function(_0x1934ea){if(_0x1934ea){return _0x1934ea['destroy']()[_0xb12f('0x20')](function(){var _0x4820c9=_0x1934ea[_0xb12f('0x21')]({'plain':!![]});var _0x35a0f6=_0xb12f('0x22');return db[_0xb12f('0x23')][_0xb12f('0x24')]({'where':{'type':_0x35a0f6,'resourceId':_0x4820c9['id']}})[_0xb12f('0x20')](function(){return _0x1934ea;});})[_0xb12f('0x20')](function(){_0x1569b4[_0xb12f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc49523,_0x5a00f7){return function(_0x459995){if(!_0x459995){_0xc49523[_0xb12f('0x25')](0x194);}return _0x459995;};}function handleError(_0x547ba5,_0x3c5bc7){_0x3c5bc7=_0x3c5bc7||0x1f4;return function(_0x435acc){logger['error'](_0x435acc[_0xb12f('0x26')]);if(_0x435acc[_0xb12f('0x27')]){delete _0x435acc['name'];}_0x547ba5[_0xb12f('0x1b')](_0x3c5bc7)['send'](_0x435acc);};}exports[_0xb12f('0x28')]=function(_0x3056a3,_0x202078){var _0x1bc5e7={},_0xed2df7={},_0x40752a={'count':0x0,'rows':[]};var _0x2b1749=_[_0xb12f('0x29')](db[_0xb12f('0x2a')][_0xb12f('0x2b')],function(_0x51ed6e){return{'name':_0x51ed6e[_0xb12f('0x2c')],'type':_0x51ed6e[_0xb12f('0x2d')][_0xb12f('0x2e')]};});_0xed2df7[_0xb12f('0x2f')]=_[_0xb12f('0x29')](_0x2b1749,_0xb12f('0x27'));_0xed2df7[_0xb12f('0x30')]=_['keys'](_0x3056a3[_0xb12f('0x30')]);_0xed2df7['filters']=_[_0xb12f('0x31')](_0xed2df7[_0xb12f('0x2f')],_0xed2df7[_0xb12f('0x30')]);_0x1bc5e7[_0xb12f('0x32')]=_[_0xb12f('0x31')](_0xed2df7[_0xb12f('0x2f')],qs['fields'](_0x3056a3[_0xb12f('0x30')]['fields']));_0x1bc5e7[_0xb12f('0x32')]=_0x1bc5e7[_0xb12f('0x32')][_0xb12f('0x33')]?_0x1bc5e7['attributes']:_0xed2df7[_0xb12f('0x2f')];if(!_0x3056a3[_0xb12f('0x30')][_0xb12f('0x34')](_0xb12f('0x35'))){_0x1bc5e7[_0xb12f('0x19')]=qs[_0xb12f('0x19')](_0x3056a3['query']['limit']);_0x1bc5e7[_0xb12f('0x17')]=qs[_0xb12f('0x17')](_0x3056a3[_0xb12f('0x30')]['offset']);}_0x1bc5e7[_0xb12f('0x36')]=qs[_0xb12f('0x37')](_0x3056a3[_0xb12f('0x30')][_0xb12f('0x37')]);_0x1bc5e7[_0xb12f('0x38')]=qs[_0xb12f('0x39')](_['pick'](_0x3056a3[_0xb12f('0x30')],_0xed2df7[_0xb12f('0x39')]),_0x2b1749);if(_0x3056a3['query']['filter']){_0x1bc5e7[_0xb12f('0x38')]=_['merge'](_0x1bc5e7[_0xb12f('0x38')],{'$or':_['map'](_0x2b1749,function(_0x5ce41b){if(_0x5ce41b[_0xb12f('0x2d')]!==_0xb12f('0x3a')){var _0x2818ff={};_0x2818ff[_0x5ce41b[_0xb12f('0x27')]]={'$like':'%'+_0x3056a3['query']['filter']+'%'};return _0x2818ff;}})});}_0x1bc5e7=_[_0xb12f('0x3b')]({},_0x1bc5e7,_0x3056a3['options']);var _0x164d78={'where':_0x1bc5e7[_0xb12f('0x38')]};return db['SquareOdbc'][_0xb12f('0x1a')](_0x164d78)[_0xb12f('0x20')](function(_0x2d73ed){_0x40752a[_0xb12f('0x1a')]=_0x2d73ed;if(_0x3056a3[_0xb12f('0x30')][_0xb12f('0x3c')]){_0x1bc5e7[_0xb12f('0x3d')]=[{'all':!![]}];}return db[_0xb12f('0x2a')]['findAll'](_0x1bc5e7);})[_0xb12f('0x20')](function(_0x358a49){_0x40752a[_0xb12f('0x3e')]=_0x358a49;return _0x40752a;})[_0xb12f('0x20')](respondWithFilteredResult(_0x202078,_0x1bc5e7))[_0xb12f('0x3f')](handleError(_0x202078,null));};exports[_0xb12f('0x40')]=function(_0x5a5f70,_0x58ae2e){var _0x594d00={'raw':!![],'where':{'id':_0x5a5f70[_0xb12f('0x41')]['id']}},_0x273fbb={};_0x273fbb[_0xb12f('0x2f')]=_[_0xb12f('0x42')](db[_0xb12f('0x2a')]['rawAttributes']);_0x273fbb[_0xb12f('0x30')]=_[_0xb12f('0x42')](_0x5a5f70[_0xb12f('0x30')]);_0x273fbb[_0xb12f('0x39')]=_[_0xb12f('0x31')](_0x273fbb[_0xb12f('0x2f')],_0x273fbb[_0xb12f('0x30')]);_0x594d00[_0xb12f('0x32')]=_[_0xb12f('0x31')](_0x273fbb[_0xb12f('0x2f')],qs['fields'](_0x5a5f70[_0xb12f('0x30')][_0xb12f('0x43')]));_0x594d00[_0xb12f('0x32')]=_0x594d00[_0xb12f('0x32')][_0xb12f('0x33')]?_0x594d00[_0xb12f('0x32')]:_0x273fbb[_0xb12f('0x2f')];if(_0x5a5f70[_0xb12f('0x30')][_0xb12f('0x3c')]){_0x594d00[_0xb12f('0x3d')]=[{'all':!![]}];}_0x594d00=_[_0xb12f('0x3b')]({},_0x594d00,_0x5a5f70[_0xb12f('0x44')]);return db['SquareOdbc'][_0xb12f('0x45')](_0x594d00)[_0xb12f('0x20')](handleEntityNotFound(_0x58ae2e,null))[_0xb12f('0x20')](respondWithResult(_0x58ae2e,null))[_0xb12f('0x3f')](handleError(_0x58ae2e,null));};exports[_0xb12f('0x46')]=function(_0x5933dd,_0x2d9997){return db[_0xb12f('0x2a')][_0xb12f('0x46')](_0x5933dd['body'],{})[_0xb12f('0x20')](function(_0x395880){var _0x4d515c=_0x5933dd[_0xb12f('0x47')]['get']({'plain':!![]});if(!_0x4d515c)throw new Error(_0xb12f('0x48'));if(_0x4d515c[_0xb12f('0x49')]==='user'){var _0xff74de=_0x395880[_0xb12f('0x21')]({'plain':!![]});var _0x310e79=_0xb12f('0x22');return db[_0xb12f('0x4a')]['find']({'where':{'name':_0x310e79,'userProfileId':_0x4d515c[_0xb12f('0x4b')]},'raw':!![]})[_0xb12f('0x20')](function(_0x1c0bfd){if(_0x1c0bfd&&_0x1c0bfd[_0xb12f('0x4c')]===0x0){return db['UserProfileResource'][_0xb12f('0x46')]({'name':_0xff74de[_0xb12f('0x27')],'resourceId':_0xff74de['id'],'type':_0x1c0bfd[_0xb12f('0x27')],'sectionId':_0x1c0bfd['id']},{})['then'](function(){return _0x395880;});}else{return _0x395880;}})[_0xb12f('0x3f')](function(_0x2c243b){logger['error'](_0xb12f('0x4d'),_0x2c243b);throw _0x2c243b;});}return _0x395880;})['then'](respondWithResult(_0x2d9997,0xc9))['catch'](handleError(_0x2d9997,null));};exports[_0xb12f('0x1f')]=function(_0x2ac5f9,_0x53b509){if(_0x2ac5f9['body']['id']){delete _0x2ac5f9[_0xb12f('0x4e')]['id'];}return db[_0xb12f('0x2a')][_0xb12f('0x45')]({'where':{'id':_0x2ac5f9[_0xb12f('0x41')]['id']}})[_0xb12f('0x20')](handleEntityNotFound(_0x53b509,null))[_0xb12f('0x20')](saveUpdates(_0x2ac5f9[_0xb12f('0x4e')],null))['then'](respondWithResult(_0x53b509,null))[_0xb12f('0x3f')](handleError(_0x53b509,null));};exports[_0xb12f('0x24')]=function(_0x447c6d,_0x42a317){return db['SquareOdbc']['find']({'where':{'id':_0x447c6d[_0xb12f('0x41')]['id']}})['then'](handleEntityNotFound(_0x42a317,null))[_0xb12f('0x20')](removeEntity(_0x42a317,null))[_0xb12f('0x3f')](handleError(_0x42a317,null));};exports[_0xb12f('0x4f')]=function(_0x228b45,_0x312822,_0x3f615a){var _0x107cfb;return db[_0xb12f('0x2a')][_0xb12f('0x45')]({'where':{'id':_0x228b45[_0xb12f('0x41')]['id']},'attributes':['id',_0xb12f('0x50')]})[_0xb12f('0x20')](handleEntityNotFound(_0x312822,null))[_0xb12f('0x20')](function(_0x29d867){if(_0x29d867){var _0x447f7d=require('odbc')();_0x447f7d[_0xb12f('0x51')](_0x29d867[_0xb12f('0x50')]);_0x447f7d[_0xb12f('0x52')]();return _0x29d867;}})['then'](respondWithResult(_0x312822,null))['catch'](handleError(_0x312822,null));}; \ No newline at end of file +var _0xd772=['where','pick','merge','name','filter','options','includeAll','include','findAll','rows','show','params','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','crypto','to-csv','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2797c5,_0x1eed11){var _0x18b956=function(_0x54464b){while(--_0x54464b){_0x2797c5['push'](_0x2797c5['shift']());}};_0x18b956(++_0x1eed11);}(_0xd772,0x67));var _0x2d77=function(_0x5b2907,_0x91946c){_0x5b2907=_0x5b2907-0x0;var _0x5f40e1=_0xd772[_0x5b2907];return _0x5f40e1;};'use strict';var emlformat=require(_0x2d77('0x0'));var rimraf=require(_0x2d77('0x1'));var zipdir=require(_0x2d77('0x2'));var jsonpatch=require(_0x2d77('0x3'));var rp=require(_0x2d77('0x4'));var moment=require('moment');var BPromise=require(_0x2d77('0x5'));var Mustache=require('mustache');var util=require(_0x2d77('0x6'));var path=require('path');var sox=require(_0x2d77('0x7'));var csv=require('to-csv');var ejs=require(_0x2d77('0x8'));var fs=require('fs');var fs_extra=require(_0x2d77('0x9'));var _=require(_0x2d77('0xa'));var squel=require('squel');var crypto=require(_0x2d77('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d77('0xc'));var querystring=require(_0x2d77('0xd'));var Papa=require(_0x2d77('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2d77('0xf'));var hardwareService=require(_0x2d77('0x10'));var logger=require('../../config/logger')(_0x2d77('0x11'));var utils=require(_0x2d77('0x12'));var config=require(_0x2d77('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2d77('0x14'))['db'];function respondWithStatusCode(_0x1e4269,_0x4fbb71){_0x4fbb71=_0x4fbb71||0xcc;return function(_0x3786c0){if(_0x3786c0){return _0x1e4269[_0x2d77('0x15')](_0x4fbb71);}return _0x1e4269['status'](_0x4fbb71)[_0x2d77('0x16')]();};}function respondWithResult(_0x3754c0,_0x547c05){_0x547c05=_0x547c05||0xc8;return function(_0x3e3d45){if(_0x3e3d45){return _0x3754c0[_0x2d77('0x17')](_0x547c05)[_0x2d77('0x18')](_0x3e3d45);}};}function respondWithFilteredResult(_0x27b213,_0x3c44a9){return function(_0x558193){if(_0x558193){var _0x35e37d=typeof _0x3c44a9[_0x2d77('0x19')]===_0x2d77('0x1a')&&typeof _0x3c44a9[_0x2d77('0x1b')]===_0x2d77('0x1a');var _0x459143=_0x558193[_0x2d77('0x1c')];var _0x3902fe=_0x35e37d?0x0:_0x3c44a9['offset'];var _0x238cf3=_0x35e37d?_0x558193[_0x2d77('0x1c')]:_0x3c44a9['offset']+_0x3c44a9[_0x2d77('0x1b')];var _0x30cd60;if(_0x238cf3>=_0x459143){_0x238cf3=_0x459143;_0x30cd60=0xc8;}else{_0x30cd60=0xce;}_0x27b213[_0x2d77('0x17')](_0x30cd60);return _0x27b213[_0x2d77('0x1d')](_0x2d77('0x1e'),_0x3902fe+'-'+_0x238cf3+'/'+_0x459143)[_0x2d77('0x18')](_0x558193);}return null;};}function patchUpdates(_0x54a6e9){return function(_0x3250bc){try{jsonpatch[_0x2d77('0x1f')](_0x3250bc,_0x54a6e9,!![]);}catch(_0x303efb){return BPromise[_0x2d77('0x20')](_0x303efb);}return _0x3250bc[_0x2d77('0x21')]();};}function saveUpdates(_0x449639,_0x5c94ba){return function(_0x404f9e){if(_0x404f9e){return _0x404f9e[_0x2d77('0x22')](_0x449639)[_0x2d77('0x23')](function(_0x276488){return _0x276488;});}return null;};}function removeEntity(_0x342a2b,_0x15601f){return function(_0x2a1a60){if(_0x2a1a60){return _0x2a1a60[_0x2d77('0x24')]()[_0x2d77('0x23')](function(){var _0x4e410e=_0x2a1a60[_0x2d77('0x25')]({'plain':!![]});var _0x3e7f32='ODBC';return db['UserProfileResource'][_0x2d77('0x24')]({'where':{'type':_0x3e7f32,'resourceId':_0x4e410e['id']}})['then'](function(){return _0x2a1a60;});})[_0x2d77('0x23')](function(){_0x342a2b[_0x2d77('0x17')](0xcc)[_0x2d77('0x16')]();});}};}function handleEntityNotFound(_0x19dad5,_0x36d48b){return function(_0x5da109){if(!_0x5da109){_0x19dad5['sendStatus'](0x194);}return _0x5da109;};}function handleError(_0x406550,_0x20280e){_0x20280e=_0x20280e||0x1f4;return function(_0x328fac){logger[_0x2d77('0x26')](_0x328fac[_0x2d77('0x27')]);if(_0x328fac['name']){delete _0x328fac['name'];}_0x406550['status'](_0x20280e)['send'](_0x328fac);};}exports['index']=function(_0x5ac10d,_0xd46861){var _0x5c36a7={},_0x2c6c91={},_0x5bf779={'count':0x0,'rows':[]};var _0x5cad74=_[_0x2d77('0x28')](db[_0x2d77('0x29')][_0x2d77('0x2a')],function(_0x44a349){return{'name':_0x44a349[_0x2d77('0x2b')],'type':_0x44a349[_0x2d77('0x2c')][_0x2d77('0x2d')]};});_0x2c6c91[_0x2d77('0x2e')]=_[_0x2d77('0x28')](_0x5cad74,'name');_0x2c6c91['query']=_[_0x2d77('0x2f')](_0x5ac10d[_0x2d77('0x30')]);_0x2c6c91[_0x2d77('0x31')]=_[_0x2d77('0x32')](_0x2c6c91[_0x2d77('0x2e')],_0x2c6c91['query']);_0x5c36a7[_0x2d77('0x33')]=_[_0x2d77('0x32')](_0x2c6c91[_0x2d77('0x2e')],qs[_0x2d77('0x34')](_0x5ac10d[_0x2d77('0x30')]['fields']));_0x5c36a7['attributes']=_0x5c36a7[_0x2d77('0x33')][_0x2d77('0x35')]?_0x5c36a7['attributes']:_0x2c6c91[_0x2d77('0x2e')];if(!_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x36')](_0x2d77('0x37'))){_0x5c36a7['limit']=qs['limit'](_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x1b')]);_0x5c36a7['offset']=qs['offset'](_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x19')]);}_0x5c36a7['order']=qs[_0x2d77('0x38')](_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x38')]);_0x5c36a7[_0x2d77('0x39')]=qs[_0x2d77('0x31')](_[_0x2d77('0x3a')](_0x5ac10d['query'],_0x2c6c91['filters']),_0x5cad74);if(_0x5ac10d[_0x2d77('0x30')]['filter']){_0x5c36a7[_0x2d77('0x39')]=_[_0x2d77('0x3b')](_0x5c36a7[_0x2d77('0x39')],{'$or':_[_0x2d77('0x28')](_0x5cad74,function(_0x552c16){if(_0x552c16[_0x2d77('0x2c')]!=='VIRTUAL'){var _0x34c7bb={};_0x34c7bb[_0x552c16[_0x2d77('0x3c')]]={'$like':'%'+_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x3d')]+'%'};return _0x34c7bb;}})});}_0x5c36a7=_[_0x2d77('0x3b')]({},_0x5c36a7,_0x5ac10d[_0x2d77('0x3e')]);var _0x3ad04f={'where':_0x5c36a7[_0x2d77('0x39')]};return db[_0x2d77('0x29')][_0x2d77('0x1c')](_0x3ad04f)[_0x2d77('0x23')](function(_0x2b2e2b){_0x5bf779[_0x2d77('0x1c')]=_0x2b2e2b;if(_0x5ac10d[_0x2d77('0x30')][_0x2d77('0x3f')]){_0x5c36a7[_0x2d77('0x40')]=[{'all':!![]}];}return db[_0x2d77('0x29')][_0x2d77('0x41')](_0x5c36a7);})[_0x2d77('0x23')](function(_0x357023){_0x5bf779[_0x2d77('0x42')]=_0x357023;return _0x5bf779;})[_0x2d77('0x23')](respondWithFilteredResult(_0xd46861,_0x5c36a7))['catch'](handleError(_0xd46861,null));};exports[_0x2d77('0x43')]=function(_0x192894,_0x117a5f){var _0x58d844={'raw':!![],'where':{'id':_0x192894[_0x2d77('0x44')]['id']}},_0x2eb803={};_0x2eb803[_0x2d77('0x2e')]=_[_0x2d77('0x2f')](db[_0x2d77('0x29')][_0x2d77('0x2a')]);_0x2eb803[_0x2d77('0x30')]=_[_0x2d77('0x2f')](_0x192894['query']);_0x2eb803['filters']=_[_0x2d77('0x32')](_0x2eb803[_0x2d77('0x2e')],_0x2eb803[_0x2d77('0x30')]);_0x58d844['attributes']=_[_0x2d77('0x32')](_0x2eb803[_0x2d77('0x2e')],qs[_0x2d77('0x34')](_0x192894['query']['fields']));_0x58d844[_0x2d77('0x33')]=_0x58d844[_0x2d77('0x33')][_0x2d77('0x35')]?_0x58d844[_0x2d77('0x33')]:_0x2eb803[_0x2d77('0x2e')];if(_0x192894['query'][_0x2d77('0x3f')]){_0x58d844[_0x2d77('0x40')]=[{'all':!![]}];}_0x58d844=_[_0x2d77('0x3b')]({},_0x58d844,_0x192894[_0x2d77('0x3e')]);return db[_0x2d77('0x29')]['find'](_0x58d844)[_0x2d77('0x23')](handleEntityNotFound(_0x117a5f,null))[_0x2d77('0x23')](respondWithResult(_0x117a5f,null))[_0x2d77('0x45')](handleError(_0x117a5f,null));};exports[_0x2d77('0x46')]=function(_0x2be34c,_0x2bbd8b){return db[_0x2d77('0x29')][_0x2d77('0x46')](_0x2be34c['body'],{})['then'](function(_0x10f3e8){var _0x19ceb9=_0x2be34c[_0x2d77('0x47')][_0x2d77('0x25')]({'plain':!![]});if(!_0x19ceb9)throw new Error(_0x2d77('0x48'));if(_0x19ceb9[_0x2d77('0x49')]==='user'){var _0x2f9a93=_0x10f3e8[_0x2d77('0x25')]({'plain':!![]});var _0x3983aa='ODBC';return db['UserProfileSection'][_0x2d77('0x4a')]({'where':{'name':_0x3983aa,'userProfileId':_0x19ceb9['userProfileId']},'raw':!![]})['then'](function(_0xdae7a8){if(_0xdae7a8&&_0xdae7a8['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2f9a93[_0x2d77('0x3c')],'resourceId':_0x2f9a93['id'],'type':_0xdae7a8[_0x2d77('0x3c')],'sectionId':_0xdae7a8['id']},{})['then'](function(){return _0x10f3e8;});}else{return _0x10f3e8;}})[_0x2d77('0x45')](function(_0x3ee162){logger['error'](_0x2d77('0x4b'),_0x3ee162);throw _0x3ee162;});}return _0x10f3e8;})[_0x2d77('0x23')](respondWithResult(_0x2bbd8b,0xc9))[_0x2d77('0x45')](handleError(_0x2bbd8b,null));};exports[_0x2d77('0x22')]=function(_0x783537,_0x127b0d){if(_0x783537['body']['id']){delete _0x783537['body']['id'];}return db['SquareOdbc'][_0x2d77('0x4a')]({'where':{'id':_0x783537[_0x2d77('0x44')]['id']}})['then'](handleEntityNotFound(_0x127b0d,null))[_0x2d77('0x23')](saveUpdates(_0x783537[_0x2d77('0x4c')],null))[_0x2d77('0x23')](respondWithResult(_0x127b0d,null))[_0x2d77('0x45')](handleError(_0x127b0d,null));};exports[_0x2d77('0x24')]=function(_0xe8271f,_0x3ca8a0){return db[_0x2d77('0x29')][_0x2d77('0x4a')]({'where':{'id':_0xe8271f[_0x2d77('0x44')]['id']}})[_0x2d77('0x23')](handleEntityNotFound(_0x3ca8a0,null))[_0x2d77('0x23')](removeEntity(_0x3ca8a0,null))['catch'](handleError(_0x3ca8a0,null));};exports['test']=function(_0x2effc8,_0x404c33,_0x3a3b8b){var _0x347016;return db[_0x2d77('0x29')]['find']({'where':{'id':_0x2effc8['params']['id']},'attributes':['id','dsn']})[_0x2d77('0x23')](handleEntityNotFound(_0x404c33,null))[_0x2d77('0x23')](function(_0x573e1a){if(_0x573e1a){var _0x52436d=require('odbc')();_0x52436d[_0x2d77('0x4d')](_0x573e1a[_0x2d77('0x4e')]);_0x52436d[_0x2d77('0x4f')]();return _0x573e1a;}})[_0x2d77('0x23')](respondWithResult(_0x404c33,null))[_0x2d77('0x45')](handleError(_0x404c33,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 6efdd8a..e2d66bd 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 _0x980a=['path','rimraf','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a263c,_0x28f9a3){var _0x241a6a=function(_0x3230bb){while(--_0x3230bb){_0x4a263c['push'](_0x4a263c['shift']());}};_0x241a6a(++_0x28f9a3);}(_0x980a,0x18c));var _0xa980=function(_0x3f4b26,_0x934701){_0x3f4b26=_0x3f4b26-0x0;var _0x244ddd=_0x980a[_0x3f4b26];return _0x244ddd;};'use strict';var _=require(_0xa980('0x0'));var util=require(_0xa980('0x1'));var logger=require(_0xa980('0x2'))(_0xa980('0x3'));var moment=require(_0xa980('0x4'));var BPromise=require(_0xa980('0x5'));var rp=require(_0xa980('0x6'));var fs=require('fs');var path=require(_0xa980('0x7'));var rimraf=require(_0xa980('0x8'));var config=require('../../config/environment');var attributes=require(_0xa980('0x9'));module[_0xa980('0xa')]=function(_0x34a92c,_0x3ea04e){return _0x34a92c['define'](_0xa980('0xb'),attributes,{'tableName':_0xa980('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0fb0=['exports','api','bluebird','path','../../config/environment'];(function(_0x4ae333,_0x44dcfa){var _0xa129e0=function(_0x5b7963){while(--_0x5b7963){_0x4ae333['push'](_0x4ae333['shift']());}};_0xa129e0(++_0x44dcfa);}(_0x0fb0,0x155));var _0x00fb=function(_0x1a6dd4,_0x51ba5e){_0x1a6dd4=_0x1a6dd4-0x0;var _0x293921=_0x0fb0[_0x1a6dd4];return _0x293921;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x00fb('0x0'));var moment=require('moment');var BPromise=require(_0x00fb('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x00fb('0x2'));var rimraf=require('rimraf');var config=require(_0x00fb('0x3'));var attributes=require('./squareOdbc.attributes');module[_0x00fb('0x4')]=function(_0x362cd5,_0x19ceb7){return _0x362cd5['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 440f57b..e969be7 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 _0xcfb8=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','debug','catch','lodash','util','randomstring'];(function(_0x3d1dba,_0x2a42bb){var _0x15d472=function(_0x5c8951){while(--_0x5c8951){_0x3d1dba['push'](_0x3d1dba['shift']());}};_0x15d472(++_0x2a42bb);}(_0xcfb8,0x1af));var _0x8cfb=function(_0x330249,_0x5c1f1b){_0x330249=_0x330249-0x0;var _0x3d401c=_0xcfb8[_0x330249];return _0x3d401c;};'use strict';var _=require(_0x8cfb('0x0'));var util=require(_0x8cfb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8cfb('0x2'));var fs=require('fs');var Redis=require(_0x8cfb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8cfb('0x4'));var logger=require('../../config/logger')(_0x8cfb('0x5'));var config=require(_0x8cfb('0x6'));var jayson=require(_0x8cfb('0x7'));var client=jayson[_0x8cfb('0x8')][_0x8cfb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d0a22,_0x2df690,_0x53b921){return new BPromise(function(_0x23a7d3,_0x5ed0ce){return client[_0x8cfb('0xa')](_0x5d0a22,_0x53b921)[_0x8cfb('0xb')](function(_0x467dca){logger['info'](_0x8cfb('0xc'),_0x2df690,_0x8cfb('0xd'));logger['debug'](_0x8cfb('0xe'),_0x2df690,'request\x20sent',JSON['stringify'](_0x467dca));if(_0x467dca[_0x8cfb('0xf')]){if(_0x467dca['error']['code']===0x1f4){logger[_0x8cfb('0xf')](_0x8cfb('0xc'),_0x2df690,_0x467dca['error'][_0x8cfb('0x10')]);return _0x5ed0ce(_0x467dca[_0x8cfb('0xf')][_0x8cfb('0x10')]);}logger[_0x8cfb('0xf')](_0x8cfb('0xc'),_0x2df690,_0x467dca['error'][_0x8cfb('0x10')]);return _0x23a7d3(_0x467dca[_0x8cfb('0xf')][_0x8cfb('0x10')]);}else{logger[_0x8cfb('0x11')](_0x8cfb('0xc'),_0x2df690,_0x8cfb('0xd'));_0x23a7d3(_0x467dca[_0x8cfb('0x12')][_0x8cfb('0x10')]);}})['catch'](function(_0x54425f){logger[_0x8cfb('0xf')](_0x8cfb('0xc'),_0x2df690,_0x54425f);_0x5ed0ce(_0x54425f);});});}exports[_0x8cfb('0x13')]=function(_0xde6745){var _0x476e9b=this;return new Promise(function(_0x613ca5,_0x4d376c){return db[_0x8cfb('0x14')][_0x8cfb('0x15')]({'raw':_0xde6745[_0x8cfb('0x16')]?_0xde6745['options'][_0x8cfb('0x17')]===undefined?!![]:![]:!![],'where':_0xde6745[_0x8cfb('0x16')]?_0xde6745[_0x8cfb('0x16')][_0x8cfb('0x18')]||null:null,'attributes':_0xde6745[_0x8cfb('0x16')]?_0xde6745[_0x8cfb('0x16')][_0x8cfb('0x19')]||null:null,'include':_0xde6745[_0x8cfb('0x16')]?_0xde6745[_0x8cfb('0x16')][_0x8cfb('0x1a')]?_[_0x8cfb('0x1b')](_0xde6745[_0x8cfb('0x16')][_0x8cfb('0x1a')],function(_0x5433c8){return{'model':db[_0x5433c8[_0x8cfb('0x1c')]],'as':_0x5433c8['as'],'attributes':_0x5433c8[_0x8cfb('0x19')],'include':_0x5433c8[_0x8cfb('0x1a')]?_['map'](_0x5433c8[_0x8cfb('0x1a')],function(_0x3a1ca5){return{'model':db[_0x3a1ca5[_0x8cfb('0x1c')]],'as':_0x3a1ca5['as'],'attributes':_0x3a1ca5['attributes'],'include':_0x3a1ca5[_0x8cfb('0x1a')]?_[_0x8cfb('0x1b')](_0x3a1ca5[_0x8cfb('0x1a')],function(_0x48934d){return{'model':db[_0x48934d['model']],'as':_0x48934d['as'],'attributes':_0x48934d[_0x8cfb('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8cfb('0xb')](function(_0x2967db){logger['info']('ShowSquareOdbc',_0xde6745);logger[_0x8cfb('0x1d')](_0x8cfb('0x13'),_0xde6745,JSON['stringify'](_0x2967db));_0x613ca5(_0x2967db);})[_0x8cfb('0x1e')](function(_0x560d32){logger['error']('ShowSquareOdbc',_0x560d32[_0x8cfb('0x10')],_0xde6745);_0x4d376c(_0x476e9b[_0x8cfb('0xf')](0x1f4,_0x560d32[_0x8cfb('0x10')]));});});}; \ No newline at end of file +var _0x9d95=['jayson/promise','client','http','request','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','find','options','where','include','map','model','attributes','then','ShowSquareOdbc','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5c525c,_0x779b6d){var _0x5bbcc1=function(_0x24a2c6){while(--_0x24a2c6){_0x5c525c['push'](_0x5c525c['shift']());}};_0x5bbcc1(++_0x779b6d);}(_0x9d95,0x190));var _0x59d9=function(_0x4741d0,_0x591f74){_0x4741d0=_0x4741d0-0x0;var _0x216fde=_0x9d95[_0x4741d0];return _0x216fde;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x59d9('0x0'));var BPromise=require(_0x59d9('0x1'));var rs=require(_0x59d9('0x2'));var fs=require('fs');var Redis=require(_0x59d9('0x3'));var db=require(_0x59d9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x59d9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59d9('0x6'));var client=jayson[_0x59d9('0x7')][_0x59d9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5473f0,_0x557272,_0x4f1e89){return new BPromise(function(_0x562de1,_0x6ff635){return client[_0x59d9('0x9')](_0x5473f0,_0x4f1e89)['then'](function(_0x9a6fa7){logger[_0x59d9('0xa')](_0x59d9('0xb'),_0x557272,_0x59d9('0xc'));logger[_0x59d9('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x557272,_0x59d9('0xc'),JSON[_0x59d9('0xe')](_0x9a6fa7));if(_0x9a6fa7[_0x59d9('0xf')]){if(_0x9a6fa7[_0x59d9('0xf')][_0x59d9('0x10')]===0x1f4){logger[_0x59d9('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x557272,_0x9a6fa7[_0x59d9('0xf')][_0x59d9('0x11')]);return _0x6ff635(_0x9a6fa7[_0x59d9('0xf')][_0x59d9('0x11')]);}logger[_0x59d9('0xf')](_0x59d9('0xb'),_0x557272,_0x9a6fa7[_0x59d9('0xf')][_0x59d9('0x11')]);return _0x562de1(_0x9a6fa7[_0x59d9('0xf')][_0x59d9('0x11')]);}else{logger[_0x59d9('0xa')](_0x59d9('0xb'),_0x557272,_0x59d9('0xc'));_0x562de1(_0x9a6fa7[_0x59d9('0x12')]['message']);}})['catch'](function(_0x55e9e5){logger[_0x59d9('0xf')](_0x59d9('0xb'),_0x557272,_0x55e9e5);_0x6ff635(_0x55e9e5);});});}exports['ShowSquareOdbc']=function(_0x2d32e1){var _0x46c4d8=this;return new Promise(function(_0x551a31,_0x4603d9){return db['SquareOdbc'][_0x59d9('0x13')]({'raw':_0x2d32e1[_0x59d9('0x14')]?_0x2d32e1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2d32e1[_0x59d9('0x14')]?_0x2d32e1['options'][_0x59d9('0x15')]||null:null,'attributes':_0x2d32e1[_0x59d9('0x14')]?_0x2d32e1[_0x59d9('0x14')]['attributes']||null:null,'include':_0x2d32e1['options']?_0x2d32e1[_0x59d9('0x14')][_0x59d9('0x16')]?_[_0x59d9('0x17')](_0x2d32e1[_0x59d9('0x14')][_0x59d9('0x16')],function(_0x2f360b){return{'model':db[_0x2f360b[_0x59d9('0x18')]],'as':_0x2f360b['as'],'attributes':_0x2f360b[_0x59d9('0x19')],'include':_0x2f360b[_0x59d9('0x16')]?_[_0x59d9('0x17')](_0x2f360b['include'],function(_0x3ff7e1){return{'model':db[_0x3ff7e1['model']],'as':_0x3ff7e1['as'],'attributes':_0x3ff7e1[_0x59d9('0x19')],'include':_0x3ff7e1[_0x59d9('0x16')]?_[_0x59d9('0x17')](_0x3ff7e1[_0x59d9('0x16')],function(_0x39dc06){return{'model':db[_0x39dc06[_0x59d9('0x18')]],'as':_0x39dc06['as'],'attributes':_0x39dc06[_0x59d9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x59d9('0x1a')](function(_0x24d6c1){logger[_0x59d9('0xa')](_0x59d9('0x1b'),_0x2d32e1);logger[_0x59d9('0xd')](_0x59d9('0x1b'),_0x2d32e1,JSON['stringify'](_0x24d6c1));_0x551a31(_0x24d6c1);})[_0x59d9('0x1c')](function(_0x1eabdb){logger[_0x59d9('0xf')]('ShowSquareOdbc',_0x1eabdb['message'],_0x2d32e1);_0x4603d9(_0x46c4d8['error'](0x1f4,_0x1eabdb[_0x59d9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 88d7773..91c73e3 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 _0x66c5=['update','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x40df4f,_0x12b287){var _0x42d529=function(_0x340bcf){while(--_0x340bcf){_0x40df4f['push'](_0x40df4f['shift']());}};_0x42d529(++_0x12b287);}(_0x66c5,0xa4));var _0x566c=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x66c5[_0x2b35ca];return _0x68389e;};'use strict';var multer=require(_0x566c('0x0'));var util=require('util');var path=require(_0x566c('0x1'));var timeout=require(_0x566c('0x2'));var express=require('express');var router=express[_0x566c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x566c('0x4'));var interaction=require(_0x566c('0x5'));var config=require(_0x566c('0x6'));var controller=require(_0x566c('0x7'));router[_0x566c('0x8')]('/',auth['isAuthenticated'](),controller[_0x566c('0x9')]);router[_0x566c('0x8')](_0x566c('0xa'),auth[_0x566c('0xb')](),controller[_0x566c('0xc')]);router[_0x566c('0xd')]('/',auth[_0x566c('0xb')](),controller[_0x566c('0xe')]);router[_0x566c('0xf')](_0x566c('0xa'),auth[_0x566c('0xb')](),controller[_0x566c('0x10')]);router['delete'](_0x566c('0xa'),auth[_0x566c('0xb')](),controller['destroy']);module[_0x566c('0x11')]=router; \ No newline at end of file +var _0x56f4=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete'];(function(_0x3fc823,_0x4e978f){var _0x1d8073=function(_0x2d4f83){while(--_0x2d4f83){_0x3fc823['push'](_0x3fc823['shift']());}};_0x1d8073(++_0x4e978f);}(_0x56f4,0x99));var _0x456f=function(_0x429aca,_0x82730a){_0x429aca=_0x429aca-0x0;var _0x19f033=_0x56f4[_0x429aca];return _0x19f033;};'use strict';var multer=require('multer');var util=require(_0x456f('0x0'));var path=require(_0x456f('0x1'));var timeout=require(_0x456f('0x2'));var express=require(_0x456f('0x3'));var router=express[_0x456f('0x4')]();var fs_extra=require(_0x456f('0x5'));var auth=require(_0x456f('0x6'));var interaction=require(_0x456f('0x7'));var config=require('../../config/environment');var controller=require(_0x456f('0x8'));router[_0x456f('0x9')]('/',auth[_0x456f('0xa')](),controller[_0x456f('0xb')]);router[_0x456f('0x9')](_0x456f('0xc'),auth[_0x456f('0xa')](),controller['show']);router[_0x456f('0xd')]('/',auth[_0x456f('0xa')](),controller[_0x456f('0xe')]);router[_0x456f('0xf')](_0x456f('0xc'),auth['isAuthenticated'](),controller[_0x456f('0x10')]);router[_0x456f('0x11')]('/:id',auth[_0x456f('0xa')](),controller[_0x456f('0x12')]);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 82da756..e430d8d 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 _0x068d=['name','TEXT','BLOB','long','getDataValue','preproduction','toString','utf8','production','DATE','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x068d,0x166));var _0xd068=function(_0x562404,_0x2b5929){_0x562404=_0x562404-0x0;var _0x505e39=_0x068d[_0x562404];return _0x505e39;};'use strict';var Sequelize=require('sequelize');module[_0xd068('0x0')]={'name':{'type':Sequelize[_0xd068('0x1')],'unique':_0xd068('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xd068('0x3')]},'preproduction':{'type':Sequelize[_0xd068('0x4')](_0xd068('0x5')),'get':function(){if(this[_0xd068('0x6')](_0xd068('0x7'))){return this[_0xd068('0x6')](_0xd068('0x7'))[_0xd068('0x8')](_0xd068('0x9'));}}},'production':{'type':Sequelize[_0xd068('0x4')](_0xd068('0x5')),'get':function(){if(this['getDataValue'](_0xd068('0xa'))){return this[_0xd068('0x6')](_0xd068('0xa'))[_0xd068('0x8')](_0xd068('0x9'));}}},'savedAt':{'type':Sequelize[_0xd068('0xb')]},'publishedAt':{'type':Sequelize[_0xd068('0xb')]}}; \ No newline at end of file +var _0x7e89=['preproduction','toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x7403f7,_0x142a90){var _0x212744=function(_0x55eeb9){while(--_0x55eeb9){_0x7403f7['push'](_0x7403f7['shift']());}};_0x212744(++_0x142a90);}(_0x7e89,0x1bf));var _0x97e8=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0x7e89[_0x3cafb8];return _0x4b7f85;};'use strict';var Sequelize=require(_0x97e8('0x0'));module[_0x97e8('0x1')]={'name':{'type':Sequelize[_0x97e8('0x2')],'unique':_0x97e8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x97e8('0x2')]},'notes':{'type':Sequelize[_0x97e8('0x4')]},'preproduction':{'type':Sequelize[_0x97e8('0x5')](_0x97e8('0x6')),'get':function(){if(this[_0x97e8('0x7')]('preproduction')){return this[_0x97e8('0x7')](_0x97e8('0x8'))[_0x97e8('0x9')](_0x97e8('0xa'));}}},'production':{'type':Sequelize[_0x97e8('0x5')](_0x97e8('0x6')),'get':function(){if(this[_0x97e8('0x7')]('production')){return this['getDataValue'](_0x97e8('0xb'))[_0x97e8('0x9')](_0x97e8('0xa'));}}},'savedAt':{'type':Sequelize[_0x97e8('0xc')]},'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 2ba8bc4..ec1fd7a 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 _0xf485=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','intersection','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','update','body','params','production','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','then','destroy','get','SquareProjects','UserProfileResource','publish','agi','stringify','sendStatus','error','stack','name','send','index','map','fieldName','key','model','query','filters','fields','attributes','length','nolimit','sort','where','pick','merge','VIRTUAL','options','SquareProject'];(function(_0x4408f6,_0x597ade){var _0x31f8fd=function(_0x384b2a){while(--_0x384b2a){_0x4408f6['push'](_0x4408f6['shift']());}};_0x31f8fd(++_0x597ade);}(_0xf485,0xe7));var _0x5f48=function(_0x3b8597,_0x57ce17){_0x3b8597=_0x3b8597-0x0;var _0x2089dc=_0xf485[_0x3b8597];return _0x2089dc;};'use strict';var _=require(_0x5f48('0x0'));var Redis=require('ioredis');var qs=require(_0x5f48('0x1'));var logger=require(_0x5f48('0x2'))(_0x5f48('0x3'));var config=require(_0x5f48('0x4'));var db=require('../../mysqldb')['db'];config[_0x5f48('0x5')]=_[_0x5f48('0x6')](config[_0x5f48('0x5')],{'host':_0x5f48('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5f48('0x8'))[_0x5f48('0x9')](socket);function respondWithResult(_0x5ad1f6,_0x3a23ce){_0x3a23ce=_0x3a23ce||0xc8;return function(_0x47e52f){if(_0x47e52f){return _0x5ad1f6[_0x5f48('0xa')](_0x3a23ce)[_0x5f48('0xb')](_0x47e52f);}};}function respondWithFilteredResult(_0x2ae04f,_0x4991e9){return function(_0x20b040){if(_0x20b040){var _0x62d41e=typeof _0x4991e9[_0x5f48('0xc')]==='undefined'&&typeof _0x4991e9[_0x5f48('0xd')]===_0x5f48('0xe');var _0x43cc94=_0x20b040[_0x5f48('0xf')];var _0x586228=_0x62d41e?0x0:_0x4991e9[_0x5f48('0xc')];var _0x149b4c=_0x62d41e?_0x20b040[_0x5f48('0xf')]:_0x4991e9['offset']+_0x4991e9[_0x5f48('0xd')];var _0x1bf082;if(_0x149b4c>=_0x43cc94){_0x149b4c=_0x43cc94;_0x1bf082=0xc8;}else{_0x1bf082=0xce;}_0x2ae04f[_0x5f48('0xa')](_0x1bf082);return _0x2ae04f[_0x5f48('0x10')](_0x5f48('0x11'),_0x586228+'-'+_0x149b4c+'/'+_0x43cc94)[_0x5f48('0xb')](_0x20b040);}return null;};}function saveUpdates(_0x402c29){return function(_0x24fcbc){if(_0x24fcbc){return _0x24fcbc['update'](_0x402c29)[_0x5f48('0x12')](function(_0x545e3c){return _0x545e3c;});}return null;};}function removeEntity(_0x546d78){return function(_0x4d2c10){if(_0x4d2c10){return _0x4d2c10[_0x5f48('0x13')]()['then'](function(){var _0x3a3c54=_0x4d2c10[_0x5f48('0x14')]({'plain':!![]});var _0x3624a4=_0x5f48('0x15');return db[_0x5f48('0x16')][_0x5f48('0x13')]({'where':{'type':_0x3624a4,'resourceId':_0x3a3c54['id']}})[_0x5f48('0x12')](function(){return _0x4d2c10;});})['then'](function(){var _0x58a07f=new Redis(config[_0x5f48('0x5')]);_0x58a07f[_0x5f48('0x17')](_0x5f48('0x18'),JSON[_0x5f48('0x19')]({'id':_0x4d2c10['id'],'deleted':!![]}));})[_0x5f48('0x12')](function(){_0x546d78['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x315393){return function(_0x1c8048){if(!_0x1c8048){_0x315393[_0x5f48('0x1a')](0x194);}return _0x1c8048;};}function handleError(_0x376592,_0x4440e8){_0x4440e8=_0x4440e8||0x1f4;return function(_0x6e307b){logger[_0x5f48('0x1b')](_0x6e307b[_0x5f48('0x1c')]);if(_0x6e307b[_0x5f48('0x1d')]){delete _0x6e307b['name'];}_0x376592[_0x5f48('0xa')](_0x4440e8)[_0x5f48('0x1e')](_0x6e307b);};}exports[_0x5f48('0x1f')]=function(_0x46dd83,_0x192816){var _0x1992a1={},_0x3cb5c7={},_0x1f72d9={'count':0x0,'rows':[]};var _0x45ac33=_[_0x5f48('0x20')](db['SquareProject']['rawAttributes'],function(_0x228f21){return{'name':_0x228f21[_0x5f48('0x21')],'type':_0x228f21['type'][_0x5f48('0x22')]};});_0x3cb5c7[_0x5f48('0x23')]=_[_0x5f48('0x20')](_0x45ac33,_0x5f48('0x1d'));_0x3cb5c7[_0x5f48('0x24')]=_['keys'](_0x46dd83['query']);_0x3cb5c7[_0x5f48('0x25')]=_['intersection'](_0x3cb5c7['model'],_0x3cb5c7[_0x5f48('0x24')]);_0x1992a1['attributes']=_['intersection'](_0x3cb5c7[_0x5f48('0x23')],qs[_0x5f48('0x26')](_0x46dd83[_0x5f48('0x24')][_0x5f48('0x26')]));_0x1992a1[_0x5f48('0x27')]=_0x1992a1['attributes'][_0x5f48('0x28')]?_0x1992a1['attributes']:_0x3cb5c7[_0x5f48('0x23')];if(!_0x46dd83[_0x5f48('0x24')]['hasOwnProperty'](_0x5f48('0x29'))){_0x1992a1[_0x5f48('0xd')]=qs['limit'](_0x46dd83[_0x5f48('0x24')]['limit']);_0x1992a1[_0x5f48('0xc')]=qs[_0x5f48('0xc')](_0x46dd83[_0x5f48('0x24')]['offset']);}_0x1992a1['order']=qs[_0x5f48('0x2a')](_0x46dd83[_0x5f48('0x24')][_0x5f48('0x2a')]);_0x1992a1[_0x5f48('0x2b')]=qs['filters'](_[_0x5f48('0x2c')](_0x46dd83[_0x5f48('0x24')],_0x3cb5c7[_0x5f48('0x25')]),_0x45ac33);if(_0x46dd83[_0x5f48('0x24')]['filter']){_0x1992a1['where']=_[_0x5f48('0x2d')](_0x1992a1['where'],{'$or':_[_0x5f48('0x20')](_0x45ac33,function(_0x3e7345){if(_0x3e7345['type']!==_0x5f48('0x2e')){var _0x5ec385={};_0x5ec385[_0x3e7345[_0x5f48('0x1d')]]={'$like':'%'+_0x46dd83[_0x5f48('0x24')]['filter']+'%'};return _0x5ec385;}})});}_0x1992a1=_[_0x5f48('0x2d')]({},_0x1992a1,_0x46dd83[_0x5f48('0x2f')]);var _0x120084={'where':_0x1992a1[_0x5f48('0x2b')]};return db[_0x5f48('0x30')]['count'](_0x120084)[_0x5f48('0x12')](function(_0x3cfba9){_0x1f72d9['count']=_0x3cfba9;if(_0x46dd83['query'][_0x5f48('0x31')]){_0x1992a1[_0x5f48('0x32')]=[{'all':!![]}];}return db['SquareProject'][_0x5f48('0x33')](_0x1992a1);})[_0x5f48('0x12')](function(_0x3f9ce1){_0x1f72d9[_0x5f48('0x34')]=_0x3f9ce1;return _0x1f72d9;})[_0x5f48('0x12')](respondWithFilteredResult(_0x192816,_0x1992a1))[_0x5f48('0x35')](handleError(_0x192816,null));};exports[_0x5f48('0x36')]=function(_0x444bb8,_0x547a22){var _0xc91b01={'raw':![],'where':{'id':_0x444bb8['params']['id']}},_0x373149={};_0x373149[_0x5f48('0x23')]=_[_0x5f48('0x37')](db[_0x5f48('0x30')][_0x5f48('0x38')]);_0x373149['query']=_[_0x5f48('0x37')](_0x444bb8[_0x5f48('0x24')]);_0x373149[_0x5f48('0x25')]=_[_0x5f48('0x39')](_0x373149[_0x5f48('0x23')],_0x373149[_0x5f48('0x24')]);_0xc91b01[_0x5f48('0x27')]=_[_0x5f48('0x39')](_0x373149[_0x5f48('0x23')],qs['fields'](_0x444bb8[_0x5f48('0x24')][_0x5f48('0x26')]));_0xc91b01[_0x5f48('0x27')]=_0xc91b01[_0x5f48('0x27')][_0x5f48('0x28')]?_0xc91b01[_0x5f48('0x27')]:_0x373149[_0x5f48('0x23')];if(_0x444bb8[_0x5f48('0x24')][_0x5f48('0x31')]){_0xc91b01[_0x5f48('0x32')]=[{'all':!![]}];}_0xc91b01=_[_0x5f48('0x2d')]({},_0xc91b01,_0x444bb8['options']);return db[_0x5f48('0x30')][_0x5f48('0x3a')](_0xc91b01)[_0x5f48('0x12')](handleEntityNotFound(_0x547a22,null))[_0x5f48('0x12')](respondWithResult(_0x547a22,null))[_0x5f48('0x35')](handleError(_0x547a22,null));};exports[_0x5f48('0x3b')]=function(_0x5ae128,_0x338354){return db[_0x5f48('0x30')][_0x5f48('0x3b')](_0x5ae128['body'],{})[_0x5f48('0x12')](function(_0x220e34){var _0x23f6bc=_0x5ae128[_0x5f48('0x3c')]['get']({'plain':!![]});if(!_0x23f6bc)throw new Error(_0x5f48('0x3d'));if(_0x23f6bc[_0x5f48('0x3e')]===_0x5f48('0x3c')){var _0x518efb=_0x220e34[_0x5f48('0x14')]({'plain':!![]});var _0x38c8b4=_0x5f48('0x15');return db[_0x5f48('0x3f')]['find']({'where':{'name':_0x38c8b4,'userProfileId':_0x23f6bc[_0x5f48('0x40')]},'raw':!![]})[_0x5f48('0x12')](function(_0x3ebaf2){if(_0x3ebaf2&&_0x3ebaf2[_0x5f48('0x41')]===0x0){return db[_0x5f48('0x16')]['create']({'name':_0x518efb['name'],'resourceId':_0x518efb['id'],'type':_0x3ebaf2[_0x5f48('0x1d')],'sectionId':_0x3ebaf2['id']},{})[_0x5f48('0x12')](function(){return _0x220e34;});}else{return _0x220e34;}})['catch'](function(_0x19953a){logger[_0x5f48('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19953a);throw _0x19953a;});}return _0x220e34;})[_0x5f48('0x12')](respondWithResult(_0x338354,0xc9))[_0x5f48('0x35')](handleError(_0x338354,null));};exports[_0x5f48('0x42')]=function(_0x13f9fc,_0x5ab9ed){if(_0x13f9fc['body']['id']){delete _0x13f9fc[_0x5f48('0x43')]['id'];}return db[_0x5f48('0x30')][_0x5f48('0x3a')]({'where':{'id':_0x13f9fc[_0x5f48('0x44')]['id']}})[_0x5f48('0x12')](handleEntityNotFound(_0x5ab9ed,null))[_0x5f48('0x12')](saveUpdates(_0x13f9fc[_0x5f48('0x43')],null))[_0x5f48('0x12')](function(_0x416e59){if(!_0x416e59)return;var _0x9e1f82=_0x416e59['get']({'plain':!![]});return _0x9e1f82;})[_0x5f48('0x12')](function(_0x1dc33c){var _0x4a45d2=new Redis(config[_0x5f48('0x5')]);_0x4a45d2[_0x5f48('0x17')](_0x5f48('0x18'),JSON[_0x5f48('0x19')](_[_0x5f48('0x2c')](_0x1dc33c,['id',_0x5f48('0x1d'),_0x5f48('0x45')])));return _0x1dc33c;})[_0x5f48('0x12')](respondWithResult(_0x5ab9ed,null))[_0x5f48('0x35')](handleError(_0x5ab9ed,null));};exports[_0x5f48('0x13')]=function(_0x58af4c,_0x3d9fb0){return db[_0x5f48('0x30')]['find']({'where':{'id':_0x58af4c[_0x5f48('0x44')]['id']}})[_0x5f48('0x12')](handleEntityNotFound(_0x3d9fb0,null))['then'](removeEntity(_0x3d9fb0,null))[_0x5f48('0x35')](handleError(_0x3d9fb0,null));}; \ No newline at end of file +var _0xb8eb=['query','filters','model','intersection','fields','attributes','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','catch','show','params','keys','length','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','pick','production','lodash','ioredis','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','undefined','count','status','set','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','sendStatus','error','stack','name','index','map','SquareProject','rawAttributes','type'];(function(_0x2c1ec8,_0x27770d){var _0x24f31e=function(_0x171c3c){while(--_0x171c3c){_0x2c1ec8['push'](_0x2c1ec8['shift']());}};_0x24f31e(++_0x27770d);}(_0xb8eb,0x1b8));var _0xbb8e=function(_0x460d64,_0x5dcfb4){_0x460d64=_0x460d64-0x0;var _0x1bd445=_0xb8eb[_0x460d64];return _0x1bd445;};'use strict';var _=require(_0xbb8e('0x0'));var Redis=require(_0xbb8e('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xbb8e('0x2'));var config=require(_0xbb8e('0x3'));var db=require(_0xbb8e('0x4'))['db'];config[_0xbb8e('0x5')]=_[_0xbb8e('0x6')](config[_0xbb8e('0x5')],{'host':_0xbb8e('0x7'),'port':0x18eb});var socket=require(_0xbb8e('0x8'))(new Redis(config[_0xbb8e('0x5')]));require(_0xbb8e('0x9'))[_0xbb8e('0xa')](socket);function respondWithResult(_0x4d31d9,_0x31cdf6){_0x31cdf6=_0x31cdf6||0xc8;return function(_0x262168){if(_0x262168){return _0x4d31d9['status'](_0x31cdf6)[_0xbb8e('0xb')](_0x262168);}};}function respondWithFilteredResult(_0x48dadb,_0x5622c8){return function(_0x52af88){if(_0x52af88){var _0x286017=typeof _0x5622c8[_0xbb8e('0xc')]===_0xbb8e('0xd')&&typeof _0x5622c8['limit']===_0xbb8e('0xd');var _0x2ae32d=_0x52af88[_0xbb8e('0xe')];var _0x539928=_0x286017?0x0:_0x5622c8[_0xbb8e('0xc')];var _0x4b3b90=_0x286017?_0x52af88['count']:_0x5622c8[_0xbb8e('0xc')]+_0x5622c8['limit'];var _0x181b7e;if(_0x4b3b90>=_0x2ae32d){_0x4b3b90=_0x2ae32d;_0x181b7e=0xc8;}else{_0x181b7e=0xce;}_0x48dadb[_0xbb8e('0xf')](_0x181b7e);return _0x48dadb[_0xbb8e('0x10')](_0xbb8e('0x11'),_0x539928+'-'+_0x4b3b90+'/'+_0x2ae32d)[_0xbb8e('0xb')](_0x52af88);}return null;};}function saveUpdates(_0x557b70){return function(_0x42f41e){if(_0x42f41e){return _0x42f41e[_0xbb8e('0x12')](_0x557b70)[_0xbb8e('0x13')](function(_0x543545){return _0x543545;});}return null;};}function removeEntity(_0x3a3f9f){return function(_0x38f0b8){if(_0x38f0b8){return _0x38f0b8[_0xbb8e('0x14')]()[_0xbb8e('0x13')](function(){var _0x48eeef=_0x38f0b8[_0xbb8e('0x15')]({'plain':!![]});var _0x2eb7c0=_0xbb8e('0x16');return db[_0xbb8e('0x17')][_0xbb8e('0x14')]({'where':{'type':_0x2eb7c0,'resourceId':_0x48eeef['id']}})[_0xbb8e('0x13')](function(){return _0x38f0b8;});})[_0xbb8e('0x13')](function(){var _0x3f9dee=new Redis(config[_0xbb8e('0x5')]);_0x3f9dee['publish'](_0xbb8e('0x18'),JSON[_0xbb8e('0x19')]({'id':_0x38f0b8['id'],'deleted':!![]}));})['then'](function(){_0x3a3f9f[_0xbb8e('0xf')](0xcc)[_0xbb8e('0x1a')]();});}};}function handleEntityNotFound(_0x2cde11){return function(_0x4a376a){if(!_0x4a376a){_0x2cde11[_0xbb8e('0x1b')](0x194);}return _0x4a376a;};}function handleError(_0x278068,_0x1e07f3){_0x1e07f3=_0x1e07f3||0x1f4;return function(_0x576c01){logger[_0xbb8e('0x1c')](_0x576c01[_0xbb8e('0x1d')]);if(_0x576c01['name']){delete _0x576c01[_0xbb8e('0x1e')];}_0x278068['status'](_0x1e07f3)['send'](_0x576c01);};}exports[_0xbb8e('0x1f')]=function(_0x4bfd37,_0x228a93){var _0x90bf97={},_0xb0d148={},_0x44a809={'count':0x0,'rows':[]};var _0x858864=_[_0xbb8e('0x20')](db[_0xbb8e('0x21')][_0xbb8e('0x22')],function(_0x4c14f8){return{'name':_0x4c14f8['fieldName'],'type':_0x4c14f8[_0xbb8e('0x23')]['key']};});_0xb0d148['model']=_[_0xbb8e('0x20')](_0x858864,_0xbb8e('0x1e'));_0xb0d148['query']=_['keys'](_0x4bfd37[_0xbb8e('0x24')]);_0xb0d148[_0xbb8e('0x25')]=_['intersection'](_0xb0d148[_0xbb8e('0x26')],_0xb0d148[_0xbb8e('0x24')]);_0x90bf97['attributes']=_[_0xbb8e('0x27')](_0xb0d148[_0xbb8e('0x26')],qs[_0xbb8e('0x28')](_0x4bfd37[_0xbb8e('0x24')][_0xbb8e('0x28')]));_0x90bf97[_0xbb8e('0x29')]=_0x90bf97[_0xbb8e('0x29')]['length']?_0x90bf97['attributes']:_0xb0d148[_0xbb8e('0x26')];if(!_0x4bfd37['query']['hasOwnProperty'](_0xbb8e('0x2a'))){_0x90bf97[_0xbb8e('0x2b')]=qs[_0xbb8e('0x2b')](_0x4bfd37[_0xbb8e('0x24')]['limit']);_0x90bf97[_0xbb8e('0xc')]=qs[_0xbb8e('0xc')](_0x4bfd37[_0xbb8e('0x24')][_0xbb8e('0xc')]);}_0x90bf97[_0xbb8e('0x2c')]=qs[_0xbb8e('0x2d')](_0x4bfd37['query']['sort']);_0x90bf97[_0xbb8e('0x2e')]=qs[_0xbb8e('0x25')](_['pick'](_0x4bfd37[_0xbb8e('0x24')],_0xb0d148[_0xbb8e('0x25')]),_0x858864);if(_0x4bfd37['query'][_0xbb8e('0x2f')]){_0x90bf97['where']=_[_0xbb8e('0x30')](_0x90bf97[_0xbb8e('0x2e')],{'$or':_[_0xbb8e('0x20')](_0x858864,function(_0x2f16db){if(_0x2f16db[_0xbb8e('0x23')]!==_0xbb8e('0x31')){var _0x50cfa9={};_0x50cfa9[_0x2f16db[_0xbb8e('0x1e')]]={'$like':'%'+_0x4bfd37['query']['filter']+'%'};return _0x50cfa9;}})});}_0x90bf97=_[_0xbb8e('0x30')]({},_0x90bf97,_0x4bfd37['options']);var _0x46f19e={'where':_0x90bf97[_0xbb8e('0x2e')]};return db[_0xbb8e('0x21')][_0xbb8e('0xe')](_0x46f19e)[_0xbb8e('0x13')](function(_0x425dc0){_0x44a809[_0xbb8e('0xe')]=_0x425dc0;if(_0x4bfd37[_0xbb8e('0x24')][_0xbb8e('0x32')]){_0x90bf97[_0xbb8e('0x33')]=[{'all':!![]}];}return db[_0xbb8e('0x21')]['findAll'](_0x90bf97);})['then'](function(_0x47bd7d){_0x44a809['rows']=_0x47bd7d;return _0x44a809;})[_0xbb8e('0x13')](respondWithFilteredResult(_0x228a93,_0x90bf97))[_0xbb8e('0x34')](handleError(_0x228a93,null));};exports[_0xbb8e('0x35')]=function(_0x977be7,_0x3ff055){var _0x10d93b={'raw':![],'where':{'id':_0x977be7[_0xbb8e('0x36')]['id']}},_0x5db1a1={};_0x5db1a1['model']=_['keys'](db[_0xbb8e('0x21')][_0xbb8e('0x22')]);_0x5db1a1[_0xbb8e('0x24')]=_[_0xbb8e('0x37')](_0x977be7[_0xbb8e('0x24')]);_0x5db1a1[_0xbb8e('0x25')]=_[_0xbb8e('0x27')](_0x5db1a1[_0xbb8e('0x26')],_0x5db1a1['query']);_0x10d93b[_0xbb8e('0x29')]=_[_0xbb8e('0x27')](_0x5db1a1[_0xbb8e('0x26')],qs[_0xbb8e('0x28')](_0x977be7['query'][_0xbb8e('0x28')]));_0x10d93b[_0xbb8e('0x29')]=_0x10d93b['attributes'][_0xbb8e('0x38')]?_0x10d93b['attributes']:_0x5db1a1['model'];if(_0x977be7[_0xbb8e('0x24')][_0xbb8e('0x32')]){_0x10d93b[_0xbb8e('0x33')]=[{'all':!![]}];}_0x10d93b=_['merge']({},_0x10d93b,_0x977be7[_0xbb8e('0x39')]);return db[_0xbb8e('0x21')][_0xbb8e('0x3a')](_0x10d93b)[_0xbb8e('0x13')](handleEntityNotFound(_0x3ff055,null))[_0xbb8e('0x13')](respondWithResult(_0x3ff055,null))[_0xbb8e('0x34')](handleError(_0x3ff055,null));};exports['create']=function(_0x10f4f2,_0x4f0428){return db[_0xbb8e('0x21')]['create'](_0x10f4f2[_0xbb8e('0x3b')],{})[_0xbb8e('0x13')](function(_0x3d1970){var _0x51d28a=_0x10f4f2[_0xbb8e('0x3c')]['get']({'plain':!![]});if(!_0x51d28a)throw new Error(_0xbb8e('0x3d'));if(_0x51d28a[_0xbb8e('0x3e')]===_0xbb8e('0x3c')){var _0xea04e=_0x3d1970[_0xbb8e('0x15')]({'plain':!![]});var _0x18b8bf=_0xbb8e('0x16');return db['UserProfileSection'][_0xbb8e('0x3a')]({'where':{'name':_0x18b8bf,'userProfileId':_0x51d28a['userProfileId']},'raw':!![]})[_0xbb8e('0x13')](function(_0x9e54c8){if(_0x9e54c8&&_0x9e54c8[_0xbb8e('0x3f')]===0x0){return db[_0xbb8e('0x17')]['create']({'name':_0xea04e[_0xbb8e('0x1e')],'resourceId':_0xea04e['id'],'type':_0x9e54c8[_0xbb8e('0x1e')],'sectionId':_0x9e54c8['id']},{})[_0xbb8e('0x13')](function(){return _0x3d1970;});}else{return _0x3d1970;}})[_0xbb8e('0x34')](function(_0x292934){logger['error'](_0xbb8e('0x40'),_0x292934);throw _0x292934;});}return _0x3d1970;})[_0xbb8e('0x13')](respondWithResult(_0x4f0428,0xc9))[_0xbb8e('0x34')](handleError(_0x4f0428,null));};exports[_0xbb8e('0x12')]=function(_0x1363d1,_0x5428b8){if(_0x1363d1['body']['id']){delete _0x1363d1[_0xbb8e('0x3b')]['id'];}return db[_0xbb8e('0x21')][_0xbb8e('0x3a')]({'where':{'id':_0x1363d1[_0xbb8e('0x36')]['id']}})['then'](handleEntityNotFound(_0x5428b8,null))[_0xbb8e('0x13')](saveUpdates(_0x1363d1[_0xbb8e('0x3b')],null))[_0xbb8e('0x13')](function(_0x114655){if(!_0x114655)return;var _0x34581a=_0x114655[_0xbb8e('0x15')]({'plain':!![]});return _0x34581a;})[_0xbb8e('0x13')](function(_0x2e6c34){var _0x44cf69=new Redis(config[_0xbb8e('0x5')]);_0x44cf69[_0xbb8e('0x41')](_0xbb8e('0x18'),JSON['stringify'](_[_0xbb8e('0x42')](_0x2e6c34,['id','name',_0xbb8e('0x43')])));return _0x2e6c34;})[_0xbb8e('0x13')](respondWithResult(_0x5428b8,null))[_0xbb8e('0x34')](handleError(_0x5428b8,null));};exports['destroy']=function(_0x1b4152,_0x237c4e){return db[_0xbb8e('0x21')]['find']({'where':{'id':_0x1b4152[_0xbb8e('0x36')]['id']}})[_0xbb8e('0x13')](handleEntityNotFound(_0x237c4e,null))['then'](removeEntity(_0x237c4e,null))[_0xbb8e('0x34')](handleError(_0x237c4e,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 59d7c21..24b9945 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 _0x2fa8=['../../mysqldb','SquareProject','save','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3181cc,_0x28447f){var _0x547a4a=function(_0x3ede80){while(--_0x3ede80){_0x3181cc['push'](_0x3181cc['shift']());}};_0x547a4a(++_0x28447f);}(_0x2fa8,0x18b));var _0x82fa=function(_0x7077a7,_0x416a4f){_0x7077a7=_0x7077a7-0x0;var _0x194479=_0x2fa8[_0x7077a7];return _0x194479;};'use strict';var EventEmitter=require(_0x82fa('0x0'));var SquareProject=require(_0x82fa('0x1'))['db'][_0x82fa('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x82fa('0x3'),'afterUpdate':'update','afterDestroy':_0x82fa('0x4')};function emitEvent(_0x454cf1){return function(_0x25da1b,_0x4a2f73,_0x403e48){SquareProjectEvents[_0x82fa('0x5')](_0x454cf1+':'+_0x25da1b['id'],_0x25da1b);SquareProjectEvents[_0x82fa('0x5')](_0x454cf1,_0x25da1b);_0x403e48(null);};}for(var e in events){if(events[_0x82fa('0x6')](e)){var event=events[e];SquareProject[_0x82fa('0x7')](e,emitEvent(event));}}module[_0x82fa('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xe2bb=['../../mysqldb','SquareProject','setMaxListeners','emit','hook','exports','events'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0xe2bb,0xb5));var _0xbe2b=function(_0x543865,_0x502676){_0x543865=_0x543865-0x0;var _0x1d3e67=_0xe2bb[_0x543865];return _0x1d3e67;};'use strict';var EventEmitter=require(_0xbe2b('0x0'));var SquareProject=require(_0xbe2b('0x1'))['db'][_0xbe2b('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbe2b('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x45e4dc){return function(_0x123f8f,_0x252960,_0x160fc9){SquareProjectEvents[_0xbe2b('0x4')](_0x45e4dc+':'+_0x123f8f['id'],_0x123f8f);SquareProjectEvents[_0xbe2b('0x4')](_0x45e4dc,_0x123f8f);_0x160fc9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0xbe2b('0x5')](e,emitEvent(event));}}module[_0xbe2b('0x6')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 6cca56a..b392a72 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 _0x0c10=['../../config/environment','./squareProject.attributes','exports','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','moment','bluebird','request-promise','path','rimraf'];(function(_0x469361,_0x42f6ab){var _0x418e39=function(_0x3b519f){while(--_0x3b519f){_0x469361['push'](_0x469361['shift']());}};_0x418e39(++_0x42f6ab);}(_0x0c10,0xaf));var _0x00c1=function(_0x470a01,_0x1ef188){_0x470a01=_0x470a01-0x0;var _0x5df181=_0x0c10[_0x470a01];return _0x5df181;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x00c1('0x0'));var BPromise=require(_0x00c1('0x1'));var rp=require(_0x00c1('0x2'));var fs=require('fs');var path=require(_0x00c1('0x3'));var rimraf=require(_0x00c1('0x4'));var config=require(_0x00c1('0x5'));var attributes=require(_0x00c1('0x6'));module[_0x00c1('0x7')]=function(_0x684a05,_0x1cc960){return _0x684a05['define']('SquareProject',attributes,{'tableName':_0x00c1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f8616,_0x5c855e,_0x2240b0){if(_0x3f8616[_0x00c1('0x9')]('preproduction')){_0x3f8616[_0x00c1('0xa')]=moment()[_0x00c1('0xb')](_0x00c1('0xc'));}if(_0x3f8616[_0x00c1('0x9')](_0x00c1('0xd'))){_0x3f8616[_0x00c1('0xe')]=moment()[_0x00c1('0xb')](_0x00c1('0xc'));}_0x2240b0(null,_0x3f8616);}}});}; \ No newline at end of file +var _0xb024=['square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','publishedAt','format','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','SquareProject'];(function(_0x303506,_0x31a0e9){var _0x45d789=function(_0x1ecfb9){while(--_0x1ecfb9){_0x303506['push'](_0x303506['shift']());}};_0x45d789(++_0x31a0e9);}(_0xb024,0x15d));var _0x4b02=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xb024[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x4b02('0x0'));var logger=require('../../config/logger')(_0x4b02('0x1'));var moment=require(_0x4b02('0x2'));var BPromise=require(_0x4b02('0x3'));var rp=require(_0x4b02('0x4'));var fs=require('fs');var path=require(_0x4b02('0x5'));var rimraf=require(_0x4b02('0x6'));var config=require(_0x4b02('0x7'));var attributes=require(_0x4b02('0x8'));module[_0x4b02('0x9')]=function(_0x5e66c0,_0x4be644){return _0x5e66c0[_0x4b02('0xa')](_0x4b02('0xb'),attributes,{'tableName':_0x4b02('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3da234,_0x587082,_0x33301b){if(_0x3da234[_0x4b02('0xd')](_0x4b02('0xe'))){_0x3da234[_0x4b02('0xf')]=moment()['format'](_0x4b02('0x10'));}if(_0x3da234[_0x4b02('0xd')]('production')){_0x3da234[_0x4b02('0x11')]=moment()[_0x4b02('0x12')](_0x4b02('0x10'));}_0x33301b(null,_0x3da234);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5f27790..79885cc 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 _0xf44c=['catch','error','find','where','info','ShowSquareProject','message','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','options','raw','attributes','limit','include','map','model','then','debug','stringify'];(function(_0x273e2c,_0x2acc61){var _0x11928d=function(_0x554b68){while(--_0x554b68){_0x273e2c['push'](_0x273e2c['shift']());}};_0x11928d(++_0x2acc61);}(_0xf44c,0x9d));var _0xcf44=function(_0x1271ea,_0x591780){_0x1271ea=_0x1271ea-0x0;var _0x4130fe=_0xf44c[_0x1271ea];return _0x4130fe;};'use strict';var _=require(_0xcf44('0x0'));var Redis=require(_0xcf44('0x1'));var db=require(_0xcf44('0x2'))['db'];var logger=require(_0xcf44('0x3'))('rpc');var config=require(_0xcf44('0x4'));config[_0xcf44('0x5')]=_[_0xcf44('0x6')](config[_0xcf44('0x5')],{'host':_0xcf44('0x7'),'port':0x18eb});var socket=require(_0xcf44('0x8'))(new Redis(config[_0xcf44('0x5')]));require(_0xcf44('0x9'))[_0xcf44('0xa')](socket);exports[_0xcf44('0xb')]=function(_0x41843c){var _0xbbe875=this;return new Promise(function(_0x11e934,_0x9793e7){return db[_0xcf44('0xc')]['findAll']({'raw':_0x41843c[_0xcf44('0xd')]?_0x41843c[_0xcf44('0xd')][_0xcf44('0xe')]===undefined?!![]:![]:!![],'where':_0x41843c[_0xcf44('0xd')]?_0x41843c[_0xcf44('0xd')]['where']||null:null,'attributes':_0x41843c[_0xcf44('0xd')]?_0x41843c['options'][_0xcf44('0xf')]||null:null,'limit':_0x41843c[_0xcf44('0xd')]?_0x41843c['options'][_0xcf44('0x10')]||null:null,'include':_0x41843c[_0xcf44('0xd')]?_0x41843c['options'][_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x41843c['options'][_0xcf44('0x11')],function(_0x8e6943){return{'model':db[_0x8e6943[_0xcf44('0x13')]],'as':_0x8e6943['as'],'attributes':_0x8e6943[_0xcf44('0xf')],'include':_0x8e6943[_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x8e6943[_0xcf44('0x11')],function(_0x1e97a3){return{'model':db[_0x1e97a3[_0xcf44('0x13')]],'as':_0x1e97a3['as'],'attributes':_0x1e97a3[_0xcf44('0xf')],'include':_0x1e97a3[_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x1e97a3[_0xcf44('0x11')],function(_0x4e9e05){return{'model':db[_0x4e9e05[_0xcf44('0x13')]],'as':_0x4e9e05['as'],'attributes':_0x4e9e05[_0xcf44('0xf')]};}):[]};}):[]};}):[]:[]})[_0xcf44('0x14')](function(_0x1e0311){logger['info']('GetSquareProjects',_0x41843c);logger[_0xcf44('0x15')](_0xcf44('0xb'),_0x41843c,JSON[_0xcf44('0x16')](_0x1e0311));_0x11e934(_0x1e0311);})[_0xcf44('0x17')](function(_0x5792ae){logger[_0xcf44('0x18')](_0xcf44('0xb'),_0x5792ae['message'],_0x41843c);_0x9793e7(_0xbbe875[_0xcf44('0x18')](0x1f4,_0x5792ae['message']));});});};exports['ShowSquareProject']=function(_0x4beb9e){var _0x593f68=this;return new Promise(function(_0x1e9438,_0x40f621){return db['SquareProject'][_0xcf44('0x19')]({'raw':_0x4beb9e[_0xcf44('0xd')]?_0x4beb9e[_0xcf44('0xd')][_0xcf44('0xe')]===undefined?!![]:![]:!![],'where':_0x4beb9e[_0xcf44('0xd')]?_0x4beb9e[_0xcf44('0xd')][_0xcf44('0x1a')]||null:null,'attributes':_0x4beb9e[_0xcf44('0xd')]?_0x4beb9e[_0xcf44('0xd')]['attributes']||null:null,'include':_0x4beb9e['options']?_0x4beb9e['options'][_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x4beb9e[_0xcf44('0xd')][_0xcf44('0x11')],function(_0x429ba7){return{'model':db[_0x429ba7[_0xcf44('0x13')]],'as':_0x429ba7['as'],'attributes':_0x429ba7[_0xcf44('0xf')],'include':_0x429ba7[_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x429ba7[_0xcf44('0x11')],function(_0x4767db){return{'model':db[_0x4767db['model']],'as':_0x4767db['as'],'attributes':_0x4767db[_0xcf44('0xf')],'include':_0x4767db[_0xcf44('0x11')]?_[_0xcf44('0x12')](_0x4767db[_0xcf44('0x11')],function(_0x4c9734){return{'model':db[_0x4c9734[_0xcf44('0x13')]],'as':_0x4c9734['as'],'attributes':_0x4c9734[_0xcf44('0xf')]};}):[]};}):[]};}):[]:[]})[_0xcf44('0x14')](function(_0x5b5487){logger[_0xcf44('0x1b')](_0xcf44('0x1c'),_0x4beb9e);logger[_0xcf44('0x15')](_0xcf44('0x1c'),_0x4beb9e,JSON['stringify'](_0x5b5487));_0x1e9438(_0x5b5487);})['catch'](function(_0x535f38){logger[_0xcf44('0x18')](_0xcf44('0x1c'),_0x535f38[_0xcf44('0x1d')],_0x4beb9e);_0x40f621(_0x593f68[_0xcf44('0x18')](0x1f4,_0x535f38[_0xcf44('0x1d')]));});});}; \ No newline at end of file +var _0x869e=['GetSquareProjects','stringify','catch','error','message','ShowSquareProject','raw','where','lodash','ioredis','../../mysqldb','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','limit','include','model','attributes','map','then','info','debug'];(function(_0x3a479d,_0x4efe9b){var _0x550943=function(_0x5a5d86){while(--_0x5a5d86){_0x3a479d['push'](_0x3a479d['shift']());}};_0x550943(++_0x4efe9b);}(_0x869e,0x12a));var _0xe869=function(_0x58903c,_0x441edf){_0x58903c=_0x58903c-0x0;var _0xa339ba=_0x869e[_0x58903c];return _0xa339ba;};'use strict';var _=require(_0xe869('0x0'));var Redis=require(_0xe869('0x1'));var db=require(_0xe869('0x2'))['db'];var logger=require('../../config/logger')(_0xe869('0x3'));var config=require(_0xe869('0x4'));config[_0xe869('0x5')]=_[_0xe869('0x6')](config[_0xe869('0x5')],{'host':_0xe869('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe869('0x5')]));require(_0xe869('0x8'))[_0xe869('0x9')](socket);exports['GetSquareProjects']=function(_0x4d8f86){var _0x4372af=this;return new Promise(function(_0x3a0bf6,_0xe046eb){return db[_0xe869('0xa')][_0xe869('0xb')]({'raw':_0x4d8f86[_0xe869('0xc')]?_0x4d8f86[_0xe869('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x4d8f86[_0xe869('0xc')]?_0x4d8f86[_0xe869('0xc')]['where']||null:null,'attributes':_0x4d8f86[_0xe869('0xc')]?_0x4d8f86['options']['attributes']||null:null,'limit':_0x4d8f86['options']?_0x4d8f86[_0xe869('0xc')][_0xe869('0xd')]||null:null,'include':_0x4d8f86[_0xe869('0xc')]?_0x4d8f86[_0xe869('0xc')][_0xe869('0xe')]?_['map'](_0x4d8f86[_0xe869('0xc')][_0xe869('0xe')],function(_0x373388){return{'model':db[_0x373388[_0xe869('0xf')]],'as':_0x373388['as'],'attributes':_0x373388[_0xe869('0x10')],'include':_0x373388['include']?_['map'](_0x373388['include'],function(_0x2f3604){return{'model':db[_0x2f3604[_0xe869('0xf')]],'as':_0x2f3604['as'],'attributes':_0x2f3604['attributes'],'include':_0x2f3604[_0xe869('0xe')]?_[_0xe869('0x11')](_0x2f3604[_0xe869('0xe')],function(_0x473215){return{'model':db[_0x473215['model']],'as':_0x473215['as'],'attributes':_0x473215[_0xe869('0x10')]};}):[]};}):[]};}):[]:[]})[_0xe869('0x12')](function(_0x685d82){logger[_0xe869('0x13')]('GetSquareProjects',_0x4d8f86);logger[_0xe869('0x14')](_0xe869('0x15'),_0x4d8f86,JSON[_0xe869('0x16')](_0x685d82));_0x3a0bf6(_0x685d82);})[_0xe869('0x17')](function(_0x3273e0){logger[_0xe869('0x18')](_0xe869('0x15'),_0x3273e0['message'],_0x4d8f86);_0xe046eb(_0x4372af['error'](0x1f4,_0x3273e0[_0xe869('0x19')]));});});};exports[_0xe869('0x1a')]=function(_0x4bcd46){var _0x44089a=this;return new Promise(function(_0x47013c,_0x35d9b4){return db[_0xe869('0xa')]['find']({'raw':_0x4bcd46[_0xe869('0xc')]?_0x4bcd46[_0xe869('0xc')][_0xe869('0x1b')]===undefined?!![]:![]:!![],'where':_0x4bcd46['options']?_0x4bcd46[_0xe869('0xc')][_0xe869('0x1c')]||null:null,'attributes':_0x4bcd46[_0xe869('0xc')]?_0x4bcd46[_0xe869('0xc')][_0xe869('0x10')]||null:null,'include':_0x4bcd46[_0xe869('0xc')]?_0x4bcd46[_0xe869('0xc')][_0xe869('0xe')]?_[_0xe869('0x11')](_0x4bcd46[_0xe869('0xc')][_0xe869('0xe')],function(_0x5ed11d){return{'model':db[_0x5ed11d[_0xe869('0xf')]],'as':_0x5ed11d['as'],'attributes':_0x5ed11d[_0xe869('0x10')],'include':_0x5ed11d[_0xe869('0xe')]?_[_0xe869('0x11')](_0x5ed11d[_0xe869('0xe')],function(_0x33a9a2){return{'model':db[_0x33a9a2['model']],'as':_0x33a9a2['as'],'attributes':_0x33a9a2[_0xe869('0x10')],'include':_0x33a9a2[_0xe869('0xe')]?_[_0xe869('0x11')](_0x33a9a2[_0xe869('0xe')],function(_0x1dafd8){return{'model':db[_0x1dafd8[_0xe869('0xf')]],'as':_0x1dafd8['as'],'attributes':_0x1dafd8[_0xe869('0x10')]};}):[]};}):[]};}):[]:[]})[_0xe869('0x12')](function(_0x16e63f){logger[_0xe869('0x13')](_0xe869('0x1a'),_0x4bcd46);logger['debug'](_0xe869('0x1a'),_0x4bcd46,JSON[_0xe869('0x16')](_0x16e63f));_0x47013c(_0x16e63f);})[_0xe869('0x17')](function(_0x334213){logger[_0xe869('0x18')]('ShowSquareProject',_0x334213[_0xe869('0x19')],_0x4bcd46);_0x35d9b4(_0x44089a[_0xe869('0x18')](0x1f4,_0x334213['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index db0be76..fbe47f8 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 _0xa724=['remove','emit','removeListener','register','length','./squareProject.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa724,0xbf));var _0x4a72=function(_0x361945,_0x5a1358){_0x361945=_0x361945-0x0;var _0x14e349=_0xa724[_0x361945];return _0x14e349;};'use strict';var SquareProjectEvents=require(_0x4a72('0x0'));var events=['save',_0x4a72('0x1'),'update'];function createListener(_0x2467c1,_0x2cec6b){return function(_0x30c0c5){_0x2cec6b[_0x4a72('0x2')](_0x2467c1,_0x30c0c5);};}function removeListener(_0x5c8d93,_0x4a338a){return function(){SquareProjectEvents[_0x4a72('0x3')](_0x5c8d93,_0x4a338a);};}exports[_0x4a72('0x4')]=function(_0x507e3d){for(var _0x2586fe=0x0,_0x35fe8f=events[_0x4a72('0x5')];_0x2586fe<_0x35fe8f;_0x2586fe++){var _0x4e6e56=events[_0x2586fe];var _0x54b31f=createListener('squareProject:'+_0x4e6e56,_0x507e3d);SquareProjectEvents['on'](_0x4e6e56,_0x54b31f);}}; \ No newline at end of file +var _0xabf9=['update','register','squareProject:','./squareProject.events','save','remove'];(function(_0x3a83c8,_0x489ffd){var _0x5c89db=function(_0x35a94a){while(--_0x35a94a){_0x3a83c8['push'](_0x3a83c8['shift']());}};_0x5c89db(++_0x489ffd);}(_0xabf9,0x1b3));var _0x9abf=function(_0x248f22,_0xe4bd18){_0x248f22=_0x248f22-0x0;var _0x22af03=_0xabf9[_0x248f22];return _0x22af03;};'use strict';var SquareProjectEvents=require(_0x9abf('0x0'));var events=[_0x9abf('0x1'),_0x9abf('0x2'),_0x9abf('0x3')];function createListener(_0x3ef354,_0x472d4a){return function(_0x34e75a){_0x472d4a['emit'](_0x3ef354,_0x34e75a);};}function removeListener(_0x47fda4,_0x155ef4){return function(){SquareProjectEvents['removeListener'](_0x47fda4,_0x155ef4);};}exports[_0x9abf('0x4')]=function(_0x2b4f9b){for(var _0x304d33=0x0,_0x36a466=events['length'];_0x304d33<_0x36a466;_0x304d33++){var _0xc3726d=events[_0x304d33];var _0x13d76b=createListener(_0x9abf('0x5')+_0xc3726d,_0x2b4f9b);SquareProjectEvents['on'](_0xc3726d,_0x13d76b);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 08a133c..6f4446e 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x440a3d,_0x2ae549){var _0x4d56c6=function(_0x70fcfe){while(--_0x70fcfe){_0x440a3d['push'](_0x440a3d['shift']());}};_0x4d56c6(++_0x2ae549);}(_0x4975,0x86));var _0x5497=function(_0x2615d4,_0x3064cb){_0x2615d4=_0x2615d4-0x0;var _0x10cd67=_0x4975[_0x2615d4];return _0x10cd67;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file +var _0x53ec=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareRecording.controller','isAuthenticated','get','/:id','show','/:id/download','download','post','create','put'];(function(_0x510f5d,_0x4ac744){var _0x1692a7=function(_0x1fb77c){while(--_0x1fb77c){_0x510f5d['push'](_0x510f5d['shift']());}};_0x1692a7(++_0x4ac744);}(_0x53ec,0x192));var _0xc53e=function(_0x28383d,_0x4c101e){_0x28383d=_0x28383d-0x0;var _0x2e919e=_0x53ec[_0x28383d];return _0x2e919e;};'use strict';var multer=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var path=require(_0xc53e('0x2'));var timeout=require(_0xc53e('0x3'));var express=require(_0xc53e('0x4'));var router=express[_0xc53e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc53e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc53e('0x7'));var controller=require(_0xc53e('0x8'));router['get']('/',auth[_0xc53e('0x9')](),controller['index']);router[_0xc53e('0xa')](_0xc53e('0xb'),auth['isAuthenticated'](),controller[_0xc53e('0xc')]);router[_0xc53e('0xa')](_0xc53e('0xd'),auth[_0xc53e('0x9')](),controller[_0xc53e('0xe')]);router[_0xc53e('0xf')]('/',auth[_0xc53e('0x9')](),controller[_0xc53e('0x10')]);router[_0xc53e('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xc53e('0x12')]);router['delete']('/:id',auth[_0xc53e('0x9')](),controller[_0xc53e('0x13')]);module[_0xc53e('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index cdda31a..9ba1f76 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 _0xdbf5=['lastIndexOf','exports','STRING','VIRTUAL','savePath'];(function(_0x2420a0,_0x11fd0d){var _0x43412b=function(_0x2751a9){while(--_0x2751a9){_0x2420a0['push'](_0x2420a0['shift']());}};_0x43412b(++_0x11fd0d);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x5579ba,_0x57a04f){_0x5579ba=_0x5579ba-0x0;var _0x288bbd=_0xdbf5[_0x5579ba];return _0x288bbd;};'use strict';var Sequelize=require('sequelize');module[_0x5dbf('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5dbf('0x1')]},'context':{'type':Sequelize[_0x5dbf('0x1')]},'extension':{'type':Sequelize[_0x5dbf('0x1')]},'priority':{'type':Sequelize[_0x5dbf('0x1')]},'accountcode':{'type':Sequelize[_0x5dbf('0x1')]},'dnid':{'type':Sequelize[_0x5dbf('0x1')]},'projectName':{'type':Sequelize[_0x5dbf('0x1')]},'saveName':{'type':Sequelize[_0x5dbf('0x1')]},'filename':{'type':Sequelize[_0x5dbf('0x1')]},'savePath':{'type':Sequelize[_0x5dbf('0x1')]},'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){var _0x88128e='';var _0x93e657=this['getDataValue'](_0x5dbf('0x3'));if(_0x93e657){_0x88128e=_0x93e657['substring'](_0x93e657[_0x5dbf('0x4')]('.'));}return _0x88128e;}}}; \ No newline at end of file +var _0x5fd1=['STRING','VIRTUAL','getDataValue','savePath','substring','sequelize'];(function(_0x52b108,_0x2a83f3){var _0x17113a=function(_0x56dc57){while(--_0x56dc57){_0x52b108['push'](_0x52b108['shift']());}};_0x17113a(++_0x2a83f3);}(_0x5fd1,0x155));var _0x15fd=function(_0x3bb7fa,_0x16f173){_0x3bb7fa=_0x3bb7fa-0x0;var _0x2862a0=_0x5fd1[_0x3bb7fa];return _0x2862a0;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x15fd('0x1')]},'callerid':{'type':Sequelize[_0x15fd('0x1')]},'calleridname':{'type':Sequelize[_0x15fd('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x15fd('0x1')]},'accountcode':{'type':Sequelize[_0x15fd('0x1')]},'dnid':{'type':Sequelize[_0x15fd('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize[_0x15fd('0x1')]},'filename':{'type':Sequelize[_0x15fd('0x1')]},'savePath':{'type':Sequelize[_0x15fd('0x1')]},'format':{'type':Sequelize[_0x15fd('0x2')],'get':function(){var _0x225728='';var _0x534e63=this[_0x15fd('0x3')](_0x15fd('0x4'));if(_0x534e63){_0x225728=_0x534e63[_0x15fd('0x5')](_0x534e63['lastIndexOf']('.'));}return _0x225728;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index dc2a008..d1453d3 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 _0x1f5d=['update','../../components/encryptor','uniqueid','filename','savePath','format','%s.cypher','decryptFile','recording','Sequelize','ValidationError','download','unlink','message','SquareRecording\x20not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','existsSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','error','name','send','index','SquareRecording','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','params','find','create','body'];(function(_0x288fec,_0x7dc19f){var _0x24e12a=function(_0x1b81b3){while(--_0x1b81b3){_0x288fec['push'](_0x288fec['shift']());}};_0x24e12a(++_0x7dc19f);}(_0x1f5d,0x76));var _0xd1f5=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0x1f5d[_0x4c9f6a];return _0x5df5b9;};'use strict';var emlformat=require(_0xd1f5('0x0'));var rimraf=require(_0xd1f5('0x1'));var zipdir=require(_0xd1f5('0x2'));var jsonpatch=require(_0xd1f5('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd1f5('0x4'));var util=require('util');var path=require(_0xd1f5('0x5'));var sox=require(_0xd1f5('0x6'));var csv=require(_0xd1f5('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd1f5('0x8'));var _=require(_0xd1f5('0x9'));var squel=require(_0xd1f5('0xa'));var crypto=require(_0xd1f5('0xb'));var jsforce=require(_0xd1f5('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd1f5('0xd'));var Papa=require(_0xd1f5('0xe'));var Redis=require(_0xd1f5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd1f5('0x10'));var hardwareService=require(_0xd1f5('0x11'));var logger=require(_0xd1f5('0x12'))(_0xd1f5('0x13'));var utils=require(_0xd1f5('0x14'));var config=require(_0xd1f5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xd1f5('0x16'))['db'];function respondWithStatusCode(_0x46c17d,_0x29587c){_0x29587c=_0x29587c||0xcc;return function(_0x4f8ecb){if(_0x4f8ecb){return _0x46c17d[_0xd1f5('0x17')](_0x29587c);}return _0x46c17d[_0xd1f5('0x18')](_0x29587c)[_0xd1f5('0x19')]();};}function respondWithResult(_0x1d6465,_0x533c6a){_0x533c6a=_0x533c6a||0xc8;return function(_0x55af73){if(_0x55af73){return _0x1d6465[_0xd1f5('0x18')](_0x533c6a)[_0xd1f5('0x1a')](_0x55af73);}};}function respondWithFilteredResult(_0x25600f,_0x447123){return function(_0x37d3ea){if(_0x37d3ea){var _0x27b877=typeof _0x447123[_0xd1f5('0x1b')]===_0xd1f5('0x1c')&&typeof _0x447123[_0xd1f5('0x1d')]===_0xd1f5('0x1c');var _0x11fd8a=_0x37d3ea[_0xd1f5('0x1e')];var _0x1f8863=_0x27b877?0x0:_0x447123['offset'];var _0x5453de=_0x27b877?_0x37d3ea[_0xd1f5('0x1e')]:_0x447123[_0xd1f5('0x1b')]+_0x447123[_0xd1f5('0x1d')];var _0x9549d3;if(_0x5453de>=_0x11fd8a){_0x5453de=_0x11fd8a;_0x9549d3=0xc8;}else{_0x9549d3=0xce;}_0x25600f['status'](_0x9549d3);return _0x25600f[_0xd1f5('0x1f')](_0xd1f5('0x20'),_0x1f8863+'-'+_0x5453de+'/'+_0x11fd8a)['json'](_0x37d3ea);}return null;};}function patchUpdates(_0x441c7f){return function(_0x3629ab){try{jsonpatch['apply'](_0x3629ab,_0x441c7f,!![]);}catch(_0x5e881d){return BPromise[_0xd1f5('0x21')](_0x5e881d);}return _0x3629ab[_0xd1f5('0x22')]();};}function saveUpdates(_0x16b903,_0x10494f){return function(_0x397ac2){if(_0x397ac2){return _0x397ac2['update'](_0x16b903)[_0xd1f5('0x23')](function(_0x5d2036){return _0x5d2036;});}return null;};}function removeEntity(_0x1e9681,_0x5a562c){return function(_0xfce66e){if(_0xfce66e){return _0xfce66e[_0xd1f5('0x24')]()['then'](function(){_0x1e9681['status'](0xcc)[_0xd1f5('0x19')]();});}};}function handleEntityNotFound(_0x2f5d2d,_0x2d24a1){return function(_0x475b52){if(!_0x475b52){_0x2f5d2d[_0xd1f5('0x17')](0x194);}return _0x475b52;};}function handleError(_0xa3898f,_0x4cb9b5){_0x4cb9b5=_0x4cb9b5||0x1f4;return function(_0x33379f){logger[_0xd1f5('0x25')](_0x33379f['stack']);if(_0x33379f[_0xd1f5('0x26')]){delete _0x33379f[_0xd1f5('0x26')];}_0xa3898f[_0xd1f5('0x18')](_0x4cb9b5)[_0xd1f5('0x27')](_0x33379f);};}exports[_0xd1f5('0x28')]=function(_0x14ecda,_0x361a31){var _0x371ef5={},_0x3b14ed={},_0x2c9a9d={'count':0x0,'rows':[]};var _0x142517=_['map'](db[_0xd1f5('0x29')][_0xd1f5('0x2a')],function(_0x165d53){return{'name':_0x165d53[_0xd1f5('0x2b')],'type':_0x165d53[_0xd1f5('0x2c')][_0xd1f5('0x2d')]};});_0x3b14ed['model']=_[_0xd1f5('0x2e')](_0x142517,_0xd1f5('0x26'));_0x3b14ed[_0xd1f5('0x2f')]=_[_0xd1f5('0x30')](_0x14ecda[_0xd1f5('0x2f')]);_0x3b14ed[_0xd1f5('0x31')]=_['intersection'](_0x3b14ed[_0xd1f5('0x32')],_0x3b14ed[_0xd1f5('0x2f')]);_0x371ef5[_0xd1f5('0x33')]=_[_0xd1f5('0x34')](_0x3b14ed[_0xd1f5('0x32')],qs['fields'](_0x14ecda[_0xd1f5('0x2f')][_0xd1f5('0x35')]));_0x371ef5[_0xd1f5('0x33')]=_0x371ef5[_0xd1f5('0x33')][_0xd1f5('0x36')]?_0x371ef5['attributes']:_0x3b14ed[_0xd1f5('0x32')];if(!_0x14ecda['query'][_0xd1f5('0x37')](_0xd1f5('0x38'))){_0x371ef5[_0xd1f5('0x1d')]=qs[_0xd1f5('0x1d')](_0x14ecda['query'][_0xd1f5('0x1d')]);_0x371ef5[_0xd1f5('0x1b')]=qs['offset'](_0x14ecda[_0xd1f5('0x2f')][_0xd1f5('0x1b')]);}_0x371ef5[_0xd1f5('0x39')]=qs[_0xd1f5('0x3a')](_0x14ecda['query'][_0xd1f5('0x3a')]);_0x371ef5[_0xd1f5('0x3b')]=qs[_0xd1f5('0x31')](_[_0xd1f5('0x3c')](_0x14ecda[_0xd1f5('0x2f')],_0x3b14ed['filters']),_0x142517);if(_0x14ecda[_0xd1f5('0x2f')]['filter']){_0x371ef5['where']=_[_0xd1f5('0x3d')](_0x371ef5['where'],{'$or':_[_0xd1f5('0x2e')](_0x142517,function(_0x12d3cd){if(_0x12d3cd[_0xd1f5('0x2c')]!=='VIRTUAL'){var _0x40a12b={};_0x40a12b[_0x12d3cd[_0xd1f5('0x26')]]={'$like':'%'+_0x14ecda[_0xd1f5('0x2f')][_0xd1f5('0x3e')]+'%'};return _0x40a12b;}})});}_0x371ef5=_['merge']({},_0x371ef5,_0x14ecda[_0xd1f5('0x3f')]);var _0xa85afe={'where':_0x371ef5[_0xd1f5('0x3b')]};return db[_0xd1f5('0x29')][_0xd1f5('0x1e')](_0xa85afe)['then'](function(_0x248f4a){_0x2c9a9d[_0xd1f5('0x1e')]=_0x248f4a;if(_0x14ecda[_0xd1f5('0x2f')][_0xd1f5('0x40')]){_0x371ef5[_0xd1f5('0x41')]=[{'all':!![]}];}return db[_0xd1f5('0x29')][_0xd1f5('0x42')](_0x371ef5);})[_0xd1f5('0x23')](function(_0x4ffda0){_0x2c9a9d['rows']=_0x4ffda0;return _0x2c9a9d;})[_0xd1f5('0x23')](respondWithFilteredResult(_0x361a31,_0x371ef5))[_0xd1f5('0x43')](handleError(_0x361a31,null));};exports['show']=function(_0x546ae8,_0x237bbc){var _0xd0e885={'raw':!![],'where':{'id':_0x546ae8[_0xd1f5('0x44')]['id']}},_0x479f5b={};_0x479f5b[_0xd1f5('0x32')]=_[_0xd1f5('0x30')](db['SquareRecording'][_0xd1f5('0x2a')]);_0x479f5b['query']=_[_0xd1f5('0x30')](_0x546ae8[_0xd1f5('0x2f')]);_0x479f5b['filters']=_[_0xd1f5('0x34')](_0x479f5b[_0xd1f5('0x32')],_0x479f5b[_0xd1f5('0x2f')]);_0xd0e885['attributes']=_[_0xd1f5('0x34')](_0x479f5b[_0xd1f5('0x32')],qs['fields'](_0x546ae8['query'][_0xd1f5('0x35')]));_0xd0e885[_0xd1f5('0x33')]=_0xd0e885[_0xd1f5('0x33')][_0xd1f5('0x36')]?_0xd0e885[_0xd1f5('0x33')]:_0x479f5b[_0xd1f5('0x32')];if(_0x546ae8['query'][_0xd1f5('0x40')]){_0xd0e885[_0xd1f5('0x41')]=[{'all':!![]}];}_0xd0e885=_[_0xd1f5('0x3d')]({},_0xd0e885,_0x546ae8[_0xd1f5('0x3f')]);return db['SquareRecording'][_0xd1f5('0x45')](_0xd0e885)[_0xd1f5('0x23')](handleEntityNotFound(_0x237bbc,null))[_0xd1f5('0x23')](respondWithResult(_0x237bbc,null))['catch'](handleError(_0x237bbc,null));};exports[_0xd1f5('0x46')]=function(_0x5d2c68,_0x5d2719){return db[_0xd1f5('0x29')][_0xd1f5('0x46')](_0x5d2c68[_0xd1f5('0x47')],{})['then'](respondWithResult(_0x5d2719,0xc9))['catch'](handleError(_0x5d2719,null));};exports[_0xd1f5('0x48')]=function(_0x158311,_0x1ce186){if(_0x158311[_0xd1f5('0x47')]['id']){delete _0x158311[_0xd1f5('0x47')]['id'];}return db[_0xd1f5('0x29')]['find']({'where':{'id':_0x158311['params']['id']}})[_0xd1f5('0x23')](handleEntityNotFound(_0x1ce186,null))['then'](saveUpdates(_0x158311['body'],null))[_0xd1f5('0x23')](respondWithResult(_0x1ce186,null))[_0xd1f5('0x43')](handleError(_0x1ce186,null));};exports['download']=function(_0x518242,_0x4d9cc3,_0x1afcf0){var _0xb21a1a=require(_0xd1f5('0x49'));var _0x153aeb=![];var _0x2e9af3={};if(_0x518242['query']['type']&&_0x518242['query'][_0xd1f5('0x2c')]==='uniqueid'){_0x2e9af3[_0xd1f5('0x4a')]=_0x518242[_0xd1f5('0x44')]['id'];}else{_0x2e9af3['id']=_0x518242[_0xd1f5('0x44')]['id'];}return db[_0xd1f5('0x29')]['find']({'where':_0x2e9af3,'attributes':['id','savePath',_0xd1f5('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x4d9cc3,null))['then'](function(_0x6580ee){if(_0x6580ee){var _0x216e55=_0x6580ee[_0xd1f5('0x4c')];var _0x39a158=util[_0xd1f5('0x4d')](_0xd1f5('0x4e'),_0x216e55);if(fs['existsSync'](_0x39a158)){_0x153aeb=!![];return _0xb21a1a[_0xd1f5('0x4f')](_0x39a158,_0x216e55,config['secrets'][_0xd1f5('0x50')])[_0xd1f5('0x23')](function(){return _0x6580ee;});}return _0x6580ee;}})['then'](function(_0xb8595d){if(_0xb8595d){var _0x20ee21=_0xb8595d[_0xd1f5('0x4c')];if(!fs['existsSync'](_0x20ee21)){throw new db[(_0xd1f5('0x51'))][(_0xd1f5('0x52'))]('SquareRecording\x20not\x20found');}if(_0xb8595d[_0xd1f5('0x4b')]){return _0x4d9cc3[_0xd1f5('0x53')](_0x20ee21,_0xb8595d[_0xd1f5('0x4b')]+path['extname'](_0x20ee21),function(){if(_0x153aeb){fs[_0xd1f5('0x54')](_0x20ee21);}});}else{return _0x4d9cc3[_0xd1f5('0x53')](_0x20ee21,function(_0x5a2231){if(_0x153aeb){fs[_0xd1f5('0x54')](_0x20ee21);}});}}})[_0xd1f5('0x43')](function(_0x5badee){if(_0x5badee[_0xd1f5('0x55')]===_0xd1f5('0x56')){_0x4d9cc3['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x4d9cc3,null);}});};exports[_0xd1f5('0x24')]=function(_0x2a0d23,_0x39178f){return db['SquareRecording'][_0xd1f5('0x45')]({'where':{'id':_0x2a0d23['params']['id']}})[_0xd1f5('0x23')](function(_0x19e67a){if(_[_0xd1f5('0x57')](_0x19e67a)){throw new ReferenceError(_0xd1f5('0x58'));}return _0x19e67a;})[_0xd1f5('0x23')](function(_0x2b8a18){var _0x426243=_0x2b8a18[_0xd1f5('0x4c')];logger[_0xd1f5('0x59')](_0xd1f5('0x5a'),_0x426243);if(!_[_0xd1f5('0x57')](_0x2b8a18[_0xd1f5('0x4c')])&&fs['existsSync'](_0x426243)){logger[_0xd1f5('0x59')](_0xd1f5('0x5b')+_0x426243+_0xd1f5('0x5c'));fs[_0xd1f5('0x5d')](_0x426243);}_0x426243=_0x426243+'.cypher';if(!_[_0xd1f5('0x57')](_0x2b8a18[_0xd1f5('0x4c')])&&fs[_0xd1f5('0x5e')](_0x426243)){logger[_0xd1f5('0x59')](_0xd1f5('0x5b')+_0x426243+_0xd1f5('0x5c'));fs[_0xd1f5('0x5d')](_0x426243);}return _0x2b8a18;})['then'](function(_0x518e00){if(!_0x518e00)throw new InternalError();return _0x518e00[_0xd1f5('0x24')]();})['then'](function(){_0x39178f[_0xd1f5('0x18')](0xcc)[_0xd1f5('0x19')]();})[_0xd1f5('0x43')](handleError(_0x39178f,null));}; \ No newline at end of file +var _0xd6a7=['secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','end','eml-format','rimraf','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','name','filter','options','includeAll','include','findAll','catch','params','find','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync'];(function(_0x3d9b73,_0x332c82){var _0x1684b0=function(_0x5ab46e){while(--_0x5ab46e){_0x3d9b73['push'](_0x3d9b73['shift']());}};_0x1684b0(++_0x332c82);}(_0xd6a7,0x125));var _0x7d6a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd6a7[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x7d6a('0x0'));var rimraf=require(_0x7d6a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d6a('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7d6a('0x3'));var util=require('util');var path=require(_0x7d6a('0x4'));var sox=require(_0x7d6a('0x5'));var csv=require(_0x7d6a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7d6a('0x7'));var _=require(_0x7d6a('0x8'));var squel=require(_0x7d6a('0x9'));var crypto=require('crypto');var jsforce=require(_0x7d6a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7d6a('0x6'));var querystring=require('querystring');var Papa=require(_0x7d6a('0xb'));var Redis=require(_0x7d6a('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x7d6a('0xd'));var as=require(_0x7d6a('0xe'));var hardwareService=require(_0x7d6a('0xf'));var logger=require(_0x7d6a('0x10'))(_0x7d6a('0x11'));var utils=require(_0x7d6a('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7d6a('0x13'))['db'];function respondWithStatusCode(_0x46e1b0,_0x3939c7){_0x3939c7=_0x3939c7||0xcc;return function(_0x222456){if(_0x222456){return _0x46e1b0[_0x7d6a('0x14')](_0x3939c7);}return _0x46e1b0[_0x7d6a('0x15')](_0x3939c7)['end']();};}function respondWithResult(_0x9428f8,_0x253170){_0x253170=_0x253170||0xc8;return function(_0x364975){if(_0x364975){return _0x9428f8[_0x7d6a('0x15')](_0x253170)[_0x7d6a('0x16')](_0x364975);}};}function respondWithFilteredResult(_0xe890fa,_0x5935c8){return function(_0x479bf9){if(_0x479bf9){var _0x1d4bd4=typeof _0x5935c8[_0x7d6a('0x17')]===_0x7d6a('0x18')&&typeof _0x5935c8[_0x7d6a('0x19')]===_0x7d6a('0x18');var _0x36aed2=_0x479bf9[_0x7d6a('0x1a')];var _0x15c8b9=_0x1d4bd4?0x0:_0x5935c8[_0x7d6a('0x17')];var _0x803fb4=_0x1d4bd4?_0x479bf9['count']:_0x5935c8[_0x7d6a('0x17')]+_0x5935c8[_0x7d6a('0x19')];var _0x234d25;if(_0x803fb4>=_0x36aed2){_0x803fb4=_0x36aed2;_0x234d25=0xc8;}else{_0x234d25=0xce;}_0xe890fa[_0x7d6a('0x15')](_0x234d25);return _0xe890fa['set'](_0x7d6a('0x1b'),_0x15c8b9+'-'+_0x803fb4+'/'+_0x36aed2)[_0x7d6a('0x16')](_0x479bf9);}return null;};}function patchUpdates(_0x2b490f){return function(_0x28ec35){try{jsonpatch['apply'](_0x28ec35,_0x2b490f,!![]);}catch(_0x5981ca){return BPromise[_0x7d6a('0x1c')](_0x5981ca);}return _0x28ec35[_0x7d6a('0x1d')]();};}function saveUpdates(_0x4a3083,_0x182e3d){return function(_0x4139a9){if(_0x4139a9){return _0x4139a9[_0x7d6a('0x1e')](_0x4a3083)[_0x7d6a('0x1f')](function(_0x3b4361){return _0x3b4361;});}return null;};}function removeEntity(_0x38e316,_0x1c222d){return function(_0x449021){if(_0x449021){return _0x449021[_0x7d6a('0x20')]()['then'](function(){_0x38e316['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x330552,_0x4ea049){return function(_0xfeea92){if(!_0xfeea92){_0x330552[_0x7d6a('0x14')](0x194);}return _0xfeea92;};}function handleError(_0x36fc0c,_0xfe1d1a){_0xfe1d1a=_0xfe1d1a||0x1f4;return function(_0x39ce54){logger[_0x7d6a('0x21')](_0x39ce54['stack']);if(_0x39ce54['name']){delete _0x39ce54['name'];}_0x36fc0c[_0x7d6a('0x15')](_0xfe1d1a)[_0x7d6a('0x22')](_0x39ce54);};}exports[_0x7d6a('0x23')]=function(_0x3e751c,_0x3f0331){var _0x11af85={},_0xe53777={},_0x1785bb={'count':0x0,'rows':[]};var _0x11febc=_[_0x7d6a('0x24')](db[_0x7d6a('0x25')][_0x7d6a('0x26')],function(_0x548408){return{'name':_0x548408[_0x7d6a('0x27')],'type':_0x548408[_0x7d6a('0x28')][_0x7d6a('0x29')]};});_0xe53777[_0x7d6a('0x2a')]=_['map'](_0x11febc,'name');_0xe53777[_0x7d6a('0x2b')]=_[_0x7d6a('0x2c')](_0x3e751c['query']);_0xe53777[_0x7d6a('0x2d')]=_[_0x7d6a('0x2e')](_0xe53777[_0x7d6a('0x2a')],_0xe53777['query']);_0x11af85[_0x7d6a('0x2f')]=_['intersection'](_0xe53777['model'],qs[_0x7d6a('0x30')](_0x3e751c[_0x7d6a('0x2b')]['fields']));_0x11af85['attributes']=_0x11af85[_0x7d6a('0x2f')][_0x7d6a('0x31')]?_0x11af85[_0x7d6a('0x2f')]:_0xe53777[_0x7d6a('0x2a')];if(!_0x3e751c[_0x7d6a('0x2b')][_0x7d6a('0x32')](_0x7d6a('0x33'))){_0x11af85[_0x7d6a('0x19')]=qs[_0x7d6a('0x19')](_0x3e751c[_0x7d6a('0x2b')][_0x7d6a('0x19')]);_0x11af85[_0x7d6a('0x17')]=qs['offset'](_0x3e751c[_0x7d6a('0x2b')][_0x7d6a('0x17')]);}_0x11af85[_0x7d6a('0x34')]=qs[_0x7d6a('0x35')](_0x3e751c[_0x7d6a('0x2b')][_0x7d6a('0x35')]);_0x11af85[_0x7d6a('0x36')]=qs[_0x7d6a('0x2d')](_[_0x7d6a('0x37')](_0x3e751c[_0x7d6a('0x2b')],_0xe53777[_0x7d6a('0x2d')]),_0x11febc);if(_0x3e751c[_0x7d6a('0x2b')]['filter']){_0x11af85[_0x7d6a('0x36')]=_[_0x7d6a('0x38')](_0x11af85[_0x7d6a('0x36')],{'$or':_['map'](_0x11febc,function(_0x10b2fc){if(_0x10b2fc[_0x7d6a('0x28')]!=='VIRTUAL'){var _0x8f172b={};_0x8f172b[_0x10b2fc[_0x7d6a('0x39')]]={'$like':'%'+_0x3e751c['query'][_0x7d6a('0x3a')]+'%'};return _0x8f172b;}})});}_0x11af85=_[_0x7d6a('0x38')]({},_0x11af85,_0x3e751c[_0x7d6a('0x3b')]);var _0x58b831={'where':_0x11af85[_0x7d6a('0x36')]};return db['SquareRecording'][_0x7d6a('0x1a')](_0x58b831)[_0x7d6a('0x1f')](function(_0x14467c){_0x1785bb[_0x7d6a('0x1a')]=_0x14467c;if(_0x3e751c[_0x7d6a('0x2b')][_0x7d6a('0x3c')]){_0x11af85[_0x7d6a('0x3d')]=[{'all':!![]}];}return db[_0x7d6a('0x25')][_0x7d6a('0x3e')](_0x11af85);})[_0x7d6a('0x1f')](function(_0x528dcf){_0x1785bb['rows']=_0x528dcf;return _0x1785bb;})[_0x7d6a('0x1f')](respondWithFilteredResult(_0x3f0331,_0x11af85))[_0x7d6a('0x3f')](handleError(_0x3f0331,null));};exports['show']=function(_0x6c81ad,_0x1bb8b8){var _0x55348a={'raw':!![],'where':{'id':_0x6c81ad[_0x7d6a('0x40')]['id']}},_0x3bd33f={};_0x3bd33f[_0x7d6a('0x2a')]=_['keys'](db[_0x7d6a('0x25')][_0x7d6a('0x26')]);_0x3bd33f[_0x7d6a('0x2b')]=_[_0x7d6a('0x2c')](_0x6c81ad['query']);_0x3bd33f[_0x7d6a('0x2d')]=_[_0x7d6a('0x2e')](_0x3bd33f[_0x7d6a('0x2a')],_0x3bd33f[_0x7d6a('0x2b')]);_0x55348a['attributes']=_[_0x7d6a('0x2e')](_0x3bd33f[_0x7d6a('0x2a')],qs[_0x7d6a('0x30')](_0x6c81ad[_0x7d6a('0x2b')][_0x7d6a('0x30')]));_0x55348a[_0x7d6a('0x2f')]=_0x55348a['attributes']['length']?_0x55348a[_0x7d6a('0x2f')]:_0x3bd33f[_0x7d6a('0x2a')];if(_0x6c81ad[_0x7d6a('0x2b')][_0x7d6a('0x3c')]){_0x55348a[_0x7d6a('0x3d')]=[{'all':!![]}];}_0x55348a=_[_0x7d6a('0x38')]({},_0x55348a,_0x6c81ad[_0x7d6a('0x3b')]);return db[_0x7d6a('0x25')][_0x7d6a('0x41')](_0x55348a)[_0x7d6a('0x1f')](handleEntityNotFound(_0x1bb8b8,null))[_0x7d6a('0x1f')](respondWithResult(_0x1bb8b8,null))[_0x7d6a('0x3f')](handleError(_0x1bb8b8,null));};exports[_0x7d6a('0x42')]=function(_0x52c4a3,_0x4b8f21){return db[_0x7d6a('0x25')][_0x7d6a('0x42')](_0x52c4a3[_0x7d6a('0x43')],{})[_0x7d6a('0x1f')](respondWithResult(_0x4b8f21,0xc9))[_0x7d6a('0x3f')](handleError(_0x4b8f21,null));};exports[_0x7d6a('0x1e')]=function(_0x45933e,_0x23fa82){if(_0x45933e[_0x7d6a('0x43')]['id']){delete _0x45933e[_0x7d6a('0x43')]['id'];}return db[_0x7d6a('0x25')][_0x7d6a('0x41')]({'where':{'id':_0x45933e[_0x7d6a('0x40')]['id']}})['then'](handleEntityNotFound(_0x23fa82,null))[_0x7d6a('0x1f')](saveUpdates(_0x45933e['body'],null))[_0x7d6a('0x1f')](respondWithResult(_0x23fa82,null))['catch'](handleError(_0x23fa82,null));};exports[_0x7d6a('0x44')]=function(_0x4d30bc,_0x513eaa,_0x40d777){var _0x123b5a=require(_0x7d6a('0x45'));var _0x30ec35=![];var _0x43107e={};if(_0x4d30bc['query'][_0x7d6a('0x28')]&&_0x4d30bc[_0x7d6a('0x2b')][_0x7d6a('0x28')]===_0x7d6a('0x46')){_0x43107e['uniqueid']=_0x4d30bc[_0x7d6a('0x40')]['id'];}else{_0x43107e['id']=_0x4d30bc['params']['id'];}return db[_0x7d6a('0x25')][_0x7d6a('0x41')]({'where':_0x43107e,'attributes':['id',_0x7d6a('0x47'),_0x7d6a('0x48')],'raw':!![]})[_0x7d6a('0x1f')](handleEntityNotFound(_0x513eaa,null))[_0x7d6a('0x1f')](function(_0x5ca52d){if(_0x5ca52d){var _0x4ca2ad=_0x5ca52d[_0x7d6a('0x47')];var _0x343683=util[_0x7d6a('0x49')]('%s.cypher',_0x4ca2ad);if(fs[_0x7d6a('0x4a')](_0x343683)){_0x30ec35=!![];return _0x123b5a['decryptFile'](_0x343683,_0x4ca2ad,config[_0x7d6a('0x4b')][_0x7d6a('0x4c')])[_0x7d6a('0x1f')](function(){return _0x5ca52d;});}return _0x5ca52d;}})['then'](function(_0x511c4a){if(_0x511c4a){var _0x34d8d1=_0x511c4a[_0x7d6a('0x47')];if(!fs['existsSync'](_0x34d8d1)){throw new db[(_0x7d6a('0x4d'))][(_0x7d6a('0x4e'))](_0x7d6a('0x4f'));}if(_0x511c4a[_0x7d6a('0x48')]){return _0x513eaa[_0x7d6a('0x44')](_0x34d8d1,_0x511c4a[_0x7d6a('0x48')]+path[_0x7d6a('0x50')](_0x34d8d1),function(){if(_0x30ec35){fs['unlink'](_0x34d8d1);}});}else{return _0x513eaa[_0x7d6a('0x44')](_0x34d8d1,function(_0x47cc50){if(_0x30ec35){fs[_0x7d6a('0x51')](_0x34d8d1);}});}}})[_0x7d6a('0x3f')](function(_0x48b0ca){if(_0x48b0ca[_0x7d6a('0x52')]===_0x7d6a('0x4f')){_0x513eaa[_0x7d6a('0x15')](0x194)['send'](_0x7d6a('0x53'));}else{return handleError(_0x513eaa,null);}});};exports['destroy']=function(_0x2b35b8,_0x3bb8aa){return db[_0x7d6a('0x25')][_0x7d6a('0x41')]({'where':{'id':_0x2b35b8[_0x7d6a('0x40')]['id']}})['then'](function(_0x1b628b){if(_['isNil'](_0x1b628b)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1b628b;})[_0x7d6a('0x1f')](function(_0x193780){var _0x24cfa3=_0x193780[_0x7d6a('0x47')];logger[_0x7d6a('0x54')](_0x7d6a('0x55'),_0x24cfa3);if(!_[_0x7d6a('0x56')](_0x193780[_0x7d6a('0x47')])&&fs[_0x7d6a('0x4a')](_0x24cfa3)){logger[_0x7d6a('0x54')]('File:\x20\x22'+_0x24cfa3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x7d6a('0x57')](_0x24cfa3);}_0x24cfa3=_0x24cfa3+_0x7d6a('0x58');if(!_['isNil'](_0x193780[_0x7d6a('0x47')])&&fs['existsSync'](_0x24cfa3)){logger[_0x7d6a('0x54')](_0x7d6a('0x59')+_0x24cfa3+_0x7d6a('0x5a'));fs['unlinkSync'](_0x24cfa3);}return _0x193780;})['then'](function(_0x846062){if(!_0x846062)throw new InternalError();return _0x846062[_0x7d6a('0x20')]();})[_0x7d6a('0x1f')](function(){_0x3bb8aa[_0x7d6a('0x15')](0xcc)[_0x7d6a('0x5b')]();})[_0x7d6a('0x3f')](handleError(_0x3bb8aa,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 328fbc7..3f9f0e9 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 _0x7e02=['../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x127e89,_0x29e4fb){var _0x584342=function(_0x1afb1f){while(--_0x1afb1f){_0x127e89['push'](_0x127e89['shift']());}};_0x584342(++_0x29e4fb);}(_0x7e02,0x71));var _0x27e0=function(_0x25344e,_0x41b2f1){_0x25344e=_0x25344e-0x0;var _0x3bf737=_0x7e02[_0x25344e];return _0x3bf737;};'use strict';var _=require(_0x27e0('0x0'));var util=require(_0x27e0('0x1'));var logger=require(_0x27e0('0x2'))(_0x27e0('0x3'));var moment=require(_0x27e0('0x4'));var BPromise=require(_0x27e0('0x5'));var rp=require(_0x27e0('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x27e0('0x7'));var attributes=require('./squareRecording.attributes');module[_0x27e0('0x8')]=function(_0x1f98c5,_0x3ddcd2){return _0x1f98c5[_0x27e0('0x9')](_0x27e0('0xa'),attributes,{'tableName':_0x27e0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2bc=['./squareRecording.attributes','exports','define','square_recordings','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xce9195,_0x1963e1){var _0x530fe6=function(_0x1b8055){while(--_0x1b8055){_0xce9195['push'](_0xce9195['shift']());}};_0x530fe6(++_0x1963e1);}(_0xe2bc,0x1a6));var _0xce2b=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xe2bc[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xce2b('0x0'));var util=require('util');var logger=require(_0xce2b('0x1'))('api');var moment=require(_0xce2b('0x2'));var BPromise=require(_0xce2b('0x3'));var rp=require(_0xce2b('0x4'));var fs=require('fs');var path=require(_0xce2b('0x5'));var rimraf=require(_0xce2b('0x6'));var config=require('../../config/environment');var attributes=require(_0xce2b('0x7'));module[_0xce2b('0x8')]=function(_0x3c15d3,_0x343373){return _0x3c15d3[_0xce2b('0x9')]('SquareRecording',attributes,{'tableName':_0xce2b('0xa'),'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 576771d..e4c7101 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 _0xf401=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','request\x20sent','debug','stringify','error','SquareRecording,\x20%s,\x20%s','message','info','result','CreateSquareRecording','SquareRecording','create','body','options','catch'];(function(_0x595b9b,_0xa58ff){var _0x3be4c6=function(_0x324f94){while(--_0x324f94){_0x595b9b['push'](_0x595b9b['shift']());}};_0x3be4c6(++_0xa58ff);}(_0xf401,0x1db));var _0x1f40=function(_0x579859,_0x4e9af7){_0x579859=_0x579859-0x0;var _0x49565f=_0xf401[_0x579859];return _0x49565f;};'use strict';var _=require('lodash');var util=require(_0x1f40('0x0'));var moment=require('moment');var BPromise=require(_0x1f40('0x1'));var rs=require(_0x1f40('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f40('0x3'))['db'];var utils=require(_0x1f40('0x4'));var logger=require(_0x1f40('0x5'))(_0x1f40('0x6'));var config=require(_0x1f40('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1f40('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x63f79b,_0x35fc64,_0x334d3d){return new BPromise(function(_0x56ee6e,_0x812af6){return client[_0x1f40('0x9')](_0x63f79b,_0x334d3d)[_0x1f40('0xa')](function(_0x58be1b){logger['info']('SquareRecording,\x20%s,\x20%s',_0x35fc64,_0x1f40('0xb'));logger[_0x1f40('0xc')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x35fc64,'request\x20sent',JSON[_0x1f40('0xd')](_0x58be1b));if(_0x58be1b[_0x1f40('0xe')]){if(_0x58be1b['error']['code']===0x1f4){logger[_0x1f40('0xe')](_0x1f40('0xf'),_0x35fc64,_0x58be1b['error'][_0x1f40('0x10')]);return _0x812af6(_0x58be1b[_0x1f40('0xe')][_0x1f40('0x10')]);}logger[_0x1f40('0xe')]('SquareRecording,\x20%s,\x20%s',_0x35fc64,_0x58be1b['error'][_0x1f40('0x10')]);return _0x56ee6e(_0x58be1b['error']['message']);}else{logger[_0x1f40('0x11')]('SquareRecording,\x20%s,\x20%s',_0x35fc64,_0x1f40('0xb'));_0x56ee6e(_0x58be1b[_0x1f40('0x12')]['message']);}})['catch'](function(_0x339556){logger[_0x1f40('0xe')](_0x1f40('0xf'),_0x35fc64,_0x339556);_0x812af6(_0x339556);});});}exports[_0x1f40('0x13')]=function(_0x5912dc){var _0x338fae=this;return new Promise(function(_0x10d1f7,_0x1f4cf0){return db[_0x1f40('0x14')][_0x1f40('0x15')](_0x5912dc[_0x1f40('0x16')],{'raw':_0x5912dc[_0x1f40('0x17')]?_0x5912dc[_0x1f40('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x1f40('0xa')](function(_0x4729c9){logger[_0x1f40('0x11')](_0x1f40('0x13'),_0x5912dc);logger[_0x1f40('0xc')](_0x1f40('0x13'),_0x5912dc,JSON[_0x1f40('0xd')](_0x4729c9));_0x10d1f7(_0x4729c9);})[_0x1f40('0x18')](function(_0x3f37ea){logger['error'](_0x1f40('0x13'),_0x3f37ea[_0x1f40('0x10')],_0x5912dc);_0x1f4cf0(_0x338fae[_0x1f40('0xe')](0x1f4,_0x3f37ea[_0x1f40('0x10')]));});});}; \ No newline at end of file +var _0x19dd=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareRecording','SquareRecording','body','options','debug','lodash','util','randomstring'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x19dd,0x195));var _0xd19d=function(_0x2ff87e,_0x34ee8b){_0x2ff87e=_0x2ff87e-0x0;var _0x207cdf=_0x19dd[_0x2ff87e];return _0x207cdf;};'use strict';var _=require(_0xd19d('0x0'));var util=require(_0xd19d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd19d('0x2'));var fs=require('fs');var Redis=require(_0xd19d('0x3'));var db=require(_0xd19d('0x4'))['db'];var utils=require(_0xd19d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd19d('0x6'));var jayson=require(_0xd19d('0x7'));var client=jayson[_0xd19d('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x372f88,_0x12322c,_0x516ab9){return new BPromise(function(_0x5cf96e,_0x1b87a8){return client[_0xd19d('0x9')](_0x372f88,_0x516ab9)[_0xd19d('0xa')](function(_0xe87d70){logger[_0xd19d('0xb')](_0xd19d('0xc'),_0x12322c,_0xd19d('0xd'));logger['debug'](_0xd19d('0xe'),_0x12322c,_0xd19d('0xd'),JSON[_0xd19d('0xf')](_0xe87d70));if(_0xe87d70[_0xd19d('0x10')]){if(_0xe87d70[_0xd19d('0x10')][_0xd19d('0x11')]===0x1f4){logger[_0xd19d('0x10')]('SquareRecording,\x20%s,\x20%s',_0x12322c,_0xe87d70[_0xd19d('0x10')][_0xd19d('0x12')]);return _0x1b87a8(_0xe87d70[_0xd19d('0x10')][_0xd19d('0x12')]);}logger[_0xd19d('0x10')]('SquareRecording,\x20%s,\x20%s',_0x12322c,_0xe87d70[_0xd19d('0x10')][_0xd19d('0x12')]);return _0x5cf96e(_0xe87d70[_0xd19d('0x10')]['message']);}else{logger[_0xd19d('0xb')]('SquareRecording,\x20%s,\x20%s',_0x12322c,_0xd19d('0xd'));_0x5cf96e(_0xe87d70['result'][_0xd19d('0x12')]);}})['catch'](function(_0xbfef9){logger[_0xd19d('0x10')](_0xd19d('0xc'),_0x12322c,_0xbfef9);_0x1b87a8(_0xbfef9);});});}exports[_0xd19d('0x13')]=function(_0x18c6fe){var _0x303b79=this;return new Promise(function(_0x2dadd5,_0x7207e8){return db[_0xd19d('0x14')]['create'](_0x18c6fe[_0xd19d('0x15')],{'raw':_0x18c6fe[_0xd19d('0x16')]?_0x18c6fe[_0xd19d('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xd19d('0xa')](function(_0x427dbd){logger['info'](_0xd19d('0x13'),_0x18c6fe);logger[_0xd19d('0x17')](_0xd19d('0x13'),_0x18c6fe,JSON['stringify'](_0x427dbd));_0x2dadd5(_0x427dbd);})['catch'](function(_0x1c5df2){logger[_0xd19d('0x10')]('CreateSquareRecording',_0x1c5df2['message'],_0x18c6fe);_0x7207e8(_0x303b79[_0xd19d('0x10')](0x1f4,_0x1c5df2['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 620c2a1..b36e38f 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(_0x3cf887,_0x9ade13){var _0x256779=function(_0x4eddf3){while(--_0x4eddf3){_0x3cf887['push'](_0x3cf887['shift']());}};_0x256779(++_0x9ade13);}(_0xe706,0xa3));var _0x6e70=function(_0x304bf7,_0x4fcafc){_0x304bf7=_0x304bf7-0x0;var _0x5036cd=_0xe706[_0x304bf7];return _0x5036cd;};'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 _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(_0x1f863c,_0x536329){var _0x10256f=function(_0x2ba276){while(--_0x2ba276){_0x1f863c['push'](_0x1f863c['shift']());}};_0x10256f(++_0x536329);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 883b82d..cfd93b1 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 _0x8a30=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x607239,_0x3efc77){var _0x3c0434=function(_0x4adbe3){while(--_0x4adbe3){_0x607239['push'](_0x607239['shift']());}};_0x3c0434(++_0x3efc77);}(_0x8a30,0x93));var _0x08a3=function(_0x562460,_0x52321a){_0x562460=_0x562460-0x0;var _0x5ea413=_0x8a30[_0x562460];return _0x5ea413;};'use strict';var Sequelize=require(_0x08a3('0x0'));module[_0x08a3('0x1')]={'network':{'type':Sequelize[_0x08a3('0x2')]},'network_script':{'type':Sequelize[_0x08a3('0x2')]},'request':{'type':Sequelize[_0x08a3('0x2')]},'channel':{'type':Sequelize[_0x08a3('0x2')]},'language':{'type':Sequelize[_0x08a3('0x2')]},'type':{'type':Sequelize[_0x08a3('0x2')]},'uniqueid':{'type':Sequelize[_0x08a3('0x2')]},'version':{'type':Sequelize[_0x08a3('0x2')]},'callerid':{'type':Sequelize[_0x08a3('0x2')]},'calleridname':{'type':Sequelize[_0x08a3('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x08a3('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x08a3('0x2')]},'dnid':{'type':Sequelize[_0x08a3('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x08a3('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x08a3('0x2')]},'enhanced':{'type':Sequelize[_0x08a3('0x2')]},'accountcode':{'type':Sequelize[_0x08a3('0x2')]},'threadid':{'type':Sequelize[_0x08a3('0x2')]},'project_name':{'type':Sequelize[_0x08a3('0x2')]},'joinAt':{'type':Sequelize[_0x08a3('0x3')]},'leaveAt':{'type':Sequelize[_0x08a3('0x3')]},'bot':{'type':Sequelize[_0x08a3('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x59b0=['BOOLEAN','exports','STRING'];(function(_0x5131f5,_0x125b9f){var _0x5d651a=function(_0x3ef440){while(--_0x3ef440){_0x5131f5['push'](_0x5131f5['shift']());}};_0x5d651a(++_0x125b9f);}(_0x59b0,0x12a));var _0x059b=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0x59b0[_0x390a19];return _0x5d8230;};'use strict';var Sequelize=require('sequelize');module[_0x059b('0x0')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize[_0x059b('0x1')]},'request':{'type':Sequelize[_0x059b('0x1')]},'channel':{'type':Sequelize[_0x059b('0x1')]},'language':{'type':Sequelize[_0x059b('0x1')]},'type':{'type':Sequelize[_0x059b('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x059b('0x1')]},'callerid':{'type':Sequelize[_0x059b('0x1')]},'calleridname':{'type':Sequelize[_0x059b('0x1')]},'callingpres':{'type':Sequelize[_0x059b('0x1')]},'callingani2':{'type':Sequelize[_0x059b('0x1')]},'callington':{'type':Sequelize[_0x059b('0x1')]},'callingtns':{'type':Sequelize[_0x059b('0x1')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize[_0x059b('0x1')]},'context':{'type':Sequelize[_0x059b('0x1')]},'extension':{'type':Sequelize[_0x059b('0x1')]},'priority':{'type':Sequelize[_0x059b('0x1')]},'enhanced':{'type':Sequelize[_0x059b('0x1')]},'accountcode':{'type':Sequelize[_0x059b('0x1')]},'threadid':{'type':Sequelize[_0x059b('0x1')]},'project_name':{'type':Sequelize[_0x059b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x059b('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 8ebc576..16db3e2 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 _0x409e=['../../mysqldb','status','end','limit','undefined','count','set','Content-Range','json','apply','save','then','destroy','error','stack','name','send','map','SquareReport','fieldName','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','offset','sort','filter','where','type','options','includeAll','findAll','rows','catch','show','fields','length','include','merge','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','crypto','desk.js','papaparse','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x4791b7,_0x33898c){var _0x49068a=function(_0x31a160){while(--_0x31a160){_0x4791b7['push'](_0x4791b7['shift']());}};_0x49068a(++_0x33898c);}(_0x409e,0x1bd));var _0xe409=function(_0x27fcf0,_0x2abcbe){_0x27fcf0=_0x27fcf0-0x0;var _0x47ab65=_0x409e[_0x27fcf0];return _0x47ab65;};'use strict';var emlformat=require(_0xe409('0x0'));var rimraf=require(_0xe409('0x1'));var zipdir=require(_0xe409('0x2'));var jsonpatch=require(_0xe409('0x3'));var rp=require(_0xe409('0x4'));var moment=require(_0xe409('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe409('0x6'));var path=require(_0xe409('0x7'));var sox=require(_0xe409('0x8'));var csv=require(_0xe409('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xe409('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe409('0xb'));var toCsv=require(_0xe409('0x9'));var querystring=require('querystring');var Papa=require(_0xe409('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe409('0xd'));var logger=require('../../config/logger')('api');var utils=require(_0xe409('0xe'));var config=require(_0xe409('0xf'));var licenseUtil=require(_0xe409('0x10'));var db=require(_0xe409('0x11'))['db'];function respondWithStatusCode(_0x3636ce,_0x187f24){_0x187f24=_0x187f24||0xcc;return function(_0x104fe9){if(_0x104fe9){return _0x3636ce['sendStatus'](_0x187f24);}return _0x3636ce[_0xe409('0x12')](_0x187f24)[_0xe409('0x13')]();};}function respondWithResult(_0x2fe234,_0x13b3a4){_0x13b3a4=_0x13b3a4||0xc8;return function(_0x516362){if(_0x516362){return _0x2fe234[_0xe409('0x12')](_0x13b3a4)['json'](_0x516362);}};}function respondWithFilteredResult(_0x3249bc,_0x37ef50){return function(_0x5adeea){if(_0x5adeea){var _0x3f6fdd=typeof _0x37ef50['offset']==='undefined'&&typeof _0x37ef50[_0xe409('0x14')]===_0xe409('0x15');var _0x22a458=_0x5adeea[_0xe409('0x16')];var _0x2d128a=_0x3f6fdd?0x0:_0x37ef50['offset'];var _0x2191f5=_0x3f6fdd?_0x5adeea[_0xe409('0x16')]:_0x37ef50['offset']+_0x37ef50[_0xe409('0x14')];var _0x19b6ce;if(_0x2191f5>=_0x22a458){_0x2191f5=_0x22a458;_0x19b6ce=0xc8;}else{_0x19b6ce=0xce;}_0x3249bc['status'](_0x19b6ce);return _0x3249bc[_0xe409('0x17')](_0xe409('0x18'),_0x2d128a+'-'+_0x2191f5+'/'+_0x22a458)[_0xe409('0x19')](_0x5adeea);}return null;};}function patchUpdates(_0x1f4e2a){return function(_0x3db69e){try{jsonpatch[_0xe409('0x1a')](_0x3db69e,_0x1f4e2a,!![]);}catch(_0x3c16dd){return BPromise['reject'](_0x3c16dd);}return _0x3db69e[_0xe409('0x1b')]();};}function saveUpdates(_0x15abd4,_0x3dac17){return function(_0xa705fc){if(_0xa705fc){return _0xa705fc['update'](_0x15abd4)[_0xe409('0x1c')](function(_0x9f4bc2){return _0x9f4bc2;});}return null;};}function removeEntity(_0x7fd2a,_0x53e2fd){return function(_0x57a7e4){if(_0x57a7e4){return _0x57a7e4[_0xe409('0x1d')]()[_0xe409('0x1c')](function(){_0x7fd2a[_0xe409('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x142898,_0x1e73cf){return function(_0x263de3){if(!_0x263de3){_0x142898['sendStatus'](0x194);}return _0x263de3;};}function handleError(_0x5508d4,_0x5c6427){_0x5c6427=_0x5c6427||0x1f4;return function(_0xf517be){logger[_0xe409('0x1e')](_0xf517be[_0xe409('0x1f')]);if(_0xf517be[_0xe409('0x20')]){delete _0xf517be['name'];}_0x5508d4[_0xe409('0x12')](_0x5c6427)[_0xe409('0x21')](_0xf517be);};}exports['index']=function(_0x28b63b,_0x1eb3b2){var _0x1c087a={},_0x15a7df={},_0xc686de={'count':0x0,'rows':[]};var _0x116296=_[_0xe409('0x22')](db[_0xe409('0x23')]['rawAttributes'],function(_0x395182){return{'name':_0x395182[_0xe409('0x24')],'type':_0x395182['type'][_0xe409('0x25')]};});_0x15a7df['model']=_[_0xe409('0x22')](_0x116296,_0xe409('0x20'));_0x15a7df[_0xe409('0x26')]=_[_0xe409('0x27')](_0x28b63b[_0xe409('0x26')]);_0x15a7df[_0xe409('0x28')]=_[_0xe409('0x29')](_0x15a7df[_0xe409('0x2a')],_0x15a7df[_0xe409('0x26')]);_0x1c087a[_0xe409('0x2b')]=_[_0xe409('0x29')](_0x15a7df[_0xe409('0x2a')],qs['fields'](_0x28b63b[_0xe409('0x26')]['fields']));_0x1c087a[_0xe409('0x2b')]=_0x1c087a['attributes']['length']?_0x1c087a[_0xe409('0x2b')]:_0x15a7df[_0xe409('0x2a')];if(!_0x28b63b['query'][_0xe409('0x2c')](_0xe409('0x2d'))){_0x1c087a[_0xe409('0x14')]=qs['limit'](_0x28b63b[_0xe409('0x26')][_0xe409('0x14')]);_0x1c087a[_0xe409('0x2e')]=qs[_0xe409('0x2e')](_0x28b63b[_0xe409('0x26')]['offset']);}_0x1c087a['order']=qs[_0xe409('0x2f')](_0x28b63b['query'][_0xe409('0x2f')]);_0x1c087a['where']=qs[_0xe409('0x28')](_['pick'](_0x28b63b[_0xe409('0x26')],_0x15a7df[_0xe409('0x28')]),_0x116296);if(_0x28b63b[_0xe409('0x26')][_0xe409('0x30')]){_0x1c087a['where']=_['merge'](_0x1c087a[_0xe409('0x31')],{'$or':_[_0xe409('0x22')](_0x116296,function(_0x5c7583){if(_0x5c7583[_0xe409('0x32')]!=='VIRTUAL'){var _0x423583={};_0x423583[_0x5c7583[_0xe409('0x20')]]={'$like':'%'+_0x28b63b[_0xe409('0x26')][_0xe409('0x30')]+'%'};return _0x423583;}})});}_0x1c087a=_['merge']({},_0x1c087a,_0x28b63b[_0xe409('0x33')]);var _0x5142ab={'where':_0x1c087a[_0xe409('0x31')]};return db[_0xe409('0x23')][_0xe409('0x16')](_0x5142ab)[_0xe409('0x1c')](function(_0x15b870){_0xc686de[_0xe409('0x16')]=_0x15b870;if(_0x28b63b[_0xe409('0x26')][_0xe409('0x34')]){_0x1c087a['include']=[{'all':!![]}];}return db[_0xe409('0x23')][_0xe409('0x35')](_0x1c087a);})[_0xe409('0x1c')](function(_0x3cdd36){_0xc686de[_0xe409('0x36')]=_0x3cdd36;return _0xc686de;})[_0xe409('0x1c')](respondWithFilteredResult(_0x1eb3b2,_0x1c087a))[_0xe409('0x37')](handleError(_0x1eb3b2,null));};exports[_0xe409('0x38')]=function(_0x3b9789,_0x590a1d){var _0x3d7a3b={'raw':!![],'where':{'id':_0x3b9789['params']['id']}},_0x12c919={};_0x12c919[_0xe409('0x2a')]=_[_0xe409('0x27')](db[_0xe409('0x23')]['rawAttributes']);_0x12c919['query']=_[_0xe409('0x27')](_0x3b9789[_0xe409('0x26')]);_0x12c919[_0xe409('0x28')]=_['intersection'](_0x12c919[_0xe409('0x2a')],_0x12c919[_0xe409('0x26')]);_0x3d7a3b[_0xe409('0x2b')]=_[_0xe409('0x29')](_0x12c919[_0xe409('0x2a')],qs['fields'](_0x3b9789['query'][_0xe409('0x39')]));_0x3d7a3b['attributes']=_0x3d7a3b['attributes'][_0xe409('0x3a')]?_0x3d7a3b['attributes']:_0x12c919[_0xe409('0x2a')];if(_0x3b9789[_0xe409('0x26')][_0xe409('0x34')]){_0x3d7a3b[_0xe409('0x3b')]=[{'all':!![]}];}_0x3d7a3b=_[_0xe409('0x3c')]({},_0x3d7a3b,_0x3b9789[_0xe409('0x33')]);return db[_0xe409('0x23')][_0xe409('0x3d')](_0x3d7a3b)[_0xe409('0x1c')](handleEntityNotFound(_0x590a1d,null))[_0xe409('0x1c')](respondWithResult(_0x590a1d,null))[_0xe409('0x37')](handleError(_0x590a1d,null));};exports[_0xe409('0x3e')]=function(_0x3a7a2f,_0x102e6f){return db[_0xe409('0x23')][_0xe409('0x3e')](_0x3a7a2f[_0xe409('0x3f')],{})[_0xe409('0x1c')](respondWithResult(_0x102e6f,0xc9))[_0xe409('0x37')](handleError(_0x102e6f,null));};exports[_0xe409('0x40')]=function(_0x7f466,_0x149a62){if(_0x7f466['body']['id']){delete _0x7f466[_0xe409('0x3f')]['id'];}return db[_0xe409('0x23')][_0xe409('0x3d')]({'where':{'id':_0x7f466['params']['id']}})['then'](handleEntityNotFound(_0x149a62,null))['then'](saveUpdates(_0x7f466['body'],null))[_0xe409('0x1c')](respondWithResult(_0x149a62,null))[_0xe409('0x37')](handleError(_0x149a62,null));};exports[_0xe409('0x1d')]=function(_0x1fef60,_0x4da53a){return db[_0xe409('0x23')][_0xe409('0x3d')]({'where':{'id':_0x1fef60['params']['id']}})[_0xe409('0x1c')](handleEntityNotFound(_0x4da53a,null))['then'](removeEntity(_0x4da53a,null))[_0xe409('0x37')](handleError(_0x4da53a,null));};exports[_0xe409('0x41')]=function(_0x1bf10e,_0xb07e37){return db['SquareReport'][_0xe409('0x41')]()['then'](respondWithResult(_0xb07e37,null))[_0xe409('0x37')](handleError(_0xb07e37,null));}; \ No newline at end of file +var _0xc64c=['model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','count','Content-Range','apply','reject','save','destroy','then','sendStatus','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key'];(function(_0x506d08,_0x19c173){var _0x7fa1d0=function(_0x28efc7){while(--_0x28efc7){_0x506d08['push'](_0x506d08['shift']());}};_0x7fa1d0(++_0x19c173);}(_0xc64c,0x69));var _0xcc64=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0xc64c[_0x3c504b];return _0x2e5354;};'use strict';var emlformat=require(_0xcc64('0x0'));var rimraf=require(_0xcc64('0x1'));var zipdir=require(_0xcc64('0x2'));var jsonpatch=require(_0xcc64('0x3'));var rp=require(_0xcc64('0x4'));var moment=require(_0xcc64('0x5'));var BPromise=require(_0xcc64('0x6'));var Mustache=require(_0xcc64('0x7'));var util=require(_0xcc64('0x8'));var path=require('path');var sox=require(_0xcc64('0x9'));var csv=require(_0xcc64('0xa'));var ejs=require(_0xcc64('0xb'));var fs=require('fs');var fs_extra=require(_0xcc64('0xc'));var _=require(_0xcc64('0xd'));var squel=require('squel');var crypto=require(_0xcc64('0xe'));var jsforce=require(_0xcc64('0xf'));var deskjs=require(_0xcc64('0x10'));var toCsv=require(_0xcc64('0xa'));var querystring=require(_0xcc64('0x11'));var Papa=require(_0xcc64('0x12'));var Redis=require(_0xcc64('0x13'));var authService=require(_0xcc64('0x14'));var qs=require(_0xcc64('0x15'));var as=require(_0xcc64('0x16'));var hardwareService=require(_0xcc64('0x17'));var logger=require(_0xcc64('0x18'))(_0xcc64('0x19'));var utils=require(_0xcc64('0x1a'));var config=require(_0xcc64('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc64('0x1c'))['db'];function respondWithStatusCode(_0x39bd52,_0x3ef068){_0x3ef068=_0x3ef068||0xcc;return function(_0x91e087){if(_0x91e087){return _0x39bd52['sendStatus'](_0x3ef068);}return _0x39bd52[_0xcc64('0x1d')](_0x3ef068)[_0xcc64('0x1e')]();};}function respondWithResult(_0x40f8f1,_0x50bbd9){_0x50bbd9=_0x50bbd9||0xc8;return function(_0x47122e){if(_0x47122e){return _0x40f8f1[_0xcc64('0x1d')](_0x50bbd9)[_0xcc64('0x1f')](_0x47122e);}};}function respondWithFilteredResult(_0xda51ea,_0x2e3c87){return function(_0x5a298e){if(_0x5a298e){var _0x5b0302=typeof _0x2e3c87[_0xcc64('0x20')]==='undefined'&&typeof _0x2e3c87[_0xcc64('0x21')]==='undefined';var _0x2e399f=_0x5a298e[_0xcc64('0x22')];var _0x48f8ab=_0x5b0302?0x0:_0x2e3c87[_0xcc64('0x20')];var _0x4d2fe4=_0x5b0302?_0x5a298e[_0xcc64('0x22')]:_0x2e3c87[_0xcc64('0x20')]+_0x2e3c87[_0xcc64('0x21')];var _0xcae47b;if(_0x4d2fe4>=_0x2e399f){_0x4d2fe4=_0x2e399f;_0xcae47b=0xc8;}else{_0xcae47b=0xce;}_0xda51ea['status'](_0xcae47b);return _0xda51ea['set'](_0xcc64('0x23'),_0x48f8ab+'-'+_0x4d2fe4+'/'+_0x2e399f)[_0xcc64('0x1f')](_0x5a298e);}return null;};}function patchUpdates(_0x1631c1){return function(_0x14728d){try{jsonpatch[_0xcc64('0x24')](_0x14728d,_0x1631c1,!![]);}catch(_0x5548ab){return BPromise[_0xcc64('0x25')](_0x5548ab);}return _0x14728d[_0xcc64('0x26')]();};}function saveUpdates(_0x1f80fd,_0x2eb468){return function(_0x2d29c9){if(_0x2d29c9){return _0x2d29c9['update'](_0x1f80fd)['then'](function(_0x14d0a8){return _0x14d0a8;});}return null;};}function removeEntity(_0x61427b,_0xccfe8){return function(_0x35310e){if(_0x35310e){return _0x35310e[_0xcc64('0x27')]()[_0xcc64('0x28')](function(){_0x61427b['status'](0xcc)[_0xcc64('0x1e')]();});}};}function handleEntityNotFound(_0x7cd002,_0x5cdc1e){return function(_0x5c135d){if(!_0x5c135d){_0x7cd002[_0xcc64('0x29')](0x194);}return _0x5c135d;};}function handleError(_0x4ffae9,_0x2f824d){_0x2f824d=_0x2f824d||0x1f4;return function(_0x5cf9ae){logger['error'](_0x5cf9ae[_0xcc64('0x2a')]);if(_0x5cf9ae[_0xcc64('0x2b')]){delete _0x5cf9ae[_0xcc64('0x2b')];}_0x4ffae9[_0xcc64('0x1d')](_0x2f824d)['send'](_0x5cf9ae);};}exports[_0xcc64('0x2c')]=function(_0x2ffa6e,_0x468398){var _0x3385c8={},_0x5298cc={},_0x978ae9={'count':0x0,'rows':[]};var _0x524b38=_[_0xcc64('0x2d')](db[_0xcc64('0x2e')][_0xcc64('0x2f')],function(_0x12d196){return{'name':_0x12d196[_0xcc64('0x30')],'type':_0x12d196[_0xcc64('0x31')][_0xcc64('0x32')]};});_0x5298cc[_0xcc64('0x33')]=_[_0xcc64('0x2d')](_0x524b38,_0xcc64('0x2b'));_0x5298cc[_0xcc64('0x34')]=_['keys'](_0x2ffa6e[_0xcc64('0x34')]);_0x5298cc[_0xcc64('0x35')]=_[_0xcc64('0x36')](_0x5298cc[_0xcc64('0x33')],_0x5298cc['query']);_0x3385c8['attributes']=_[_0xcc64('0x36')](_0x5298cc['model'],qs[_0xcc64('0x37')](_0x2ffa6e[_0xcc64('0x34')]['fields']));_0x3385c8[_0xcc64('0x38')]=_0x3385c8[_0xcc64('0x38')][_0xcc64('0x39')]?_0x3385c8[_0xcc64('0x38')]:_0x5298cc['model'];if(!_0x2ffa6e[_0xcc64('0x34')][_0xcc64('0x3a')](_0xcc64('0x3b'))){_0x3385c8[_0xcc64('0x21')]=qs[_0xcc64('0x21')](_0x2ffa6e[_0xcc64('0x34')][_0xcc64('0x21')]);_0x3385c8[_0xcc64('0x20')]=qs[_0xcc64('0x20')](_0x2ffa6e[_0xcc64('0x34')][_0xcc64('0x20')]);}_0x3385c8['order']=qs[_0xcc64('0x3c')](_0x2ffa6e['query'][_0xcc64('0x3c')]);_0x3385c8['where']=qs[_0xcc64('0x35')](_[_0xcc64('0x3d')](_0x2ffa6e[_0xcc64('0x34')],_0x5298cc[_0xcc64('0x35')]),_0x524b38);if(_0x2ffa6e[_0xcc64('0x34')][_0xcc64('0x3e')]){_0x3385c8[_0xcc64('0x3f')]=_[_0xcc64('0x40')](_0x3385c8[_0xcc64('0x3f')],{'$or':_['map'](_0x524b38,function(_0x2e88c9){if(_0x2e88c9[_0xcc64('0x31')]!=='VIRTUAL'){var _0x234ac0={};_0x234ac0[_0x2e88c9[_0xcc64('0x2b')]]={'$like':'%'+_0x2ffa6e['query'][_0xcc64('0x3e')]+'%'};return _0x234ac0;}})});}_0x3385c8=_[_0xcc64('0x40')]({},_0x3385c8,_0x2ffa6e[_0xcc64('0x41')]);var _0x582861={'where':_0x3385c8['where']};return db['SquareReport'][_0xcc64('0x22')](_0x582861)[_0xcc64('0x28')](function(_0x5ec062){_0x978ae9[_0xcc64('0x22')]=_0x5ec062;if(_0x2ffa6e[_0xcc64('0x34')][_0xcc64('0x42')]){_0x3385c8[_0xcc64('0x43')]=[{'all':!![]}];}return db[_0xcc64('0x2e')][_0xcc64('0x44')](_0x3385c8);})['then'](function(_0x5099e9){_0x978ae9[_0xcc64('0x45')]=_0x5099e9;return _0x978ae9;})['then'](respondWithFilteredResult(_0x468398,_0x3385c8))['catch'](handleError(_0x468398,null));};exports[_0xcc64('0x46')]=function(_0x41ba9b,_0x23d2c3){var _0x3af05c={'raw':!![],'where':{'id':_0x41ba9b[_0xcc64('0x47')]['id']}},_0x3305d3={};_0x3305d3[_0xcc64('0x33')]=_['keys'](db[_0xcc64('0x2e')][_0xcc64('0x2f')]);_0x3305d3[_0xcc64('0x34')]=_[_0xcc64('0x48')](_0x41ba9b['query']);_0x3305d3[_0xcc64('0x35')]=_['intersection'](_0x3305d3['model'],_0x3305d3[_0xcc64('0x34')]);_0x3af05c[_0xcc64('0x38')]=_[_0xcc64('0x36')](_0x3305d3[_0xcc64('0x33')],qs['fields'](_0x41ba9b['query'][_0xcc64('0x37')]));_0x3af05c[_0xcc64('0x38')]=_0x3af05c['attributes']['length']?_0x3af05c[_0xcc64('0x38')]:_0x3305d3[_0xcc64('0x33')];if(_0x41ba9b[_0xcc64('0x34')][_0xcc64('0x42')]){_0x3af05c[_0xcc64('0x43')]=[{'all':!![]}];}_0x3af05c=_[_0xcc64('0x40')]({},_0x3af05c,_0x41ba9b['options']);return db[_0xcc64('0x2e')]['find'](_0x3af05c)[_0xcc64('0x28')](handleEntityNotFound(_0x23d2c3,null))['then'](respondWithResult(_0x23d2c3,null))[_0xcc64('0x49')](handleError(_0x23d2c3,null));};exports[_0xcc64('0x4a')]=function(_0x312a03,_0x44e5fd){return db[_0xcc64('0x2e')][_0xcc64('0x4a')](_0x312a03[_0xcc64('0x4b')],{})['then'](respondWithResult(_0x44e5fd,0xc9))[_0xcc64('0x49')](handleError(_0x44e5fd,null));};exports['update']=function(_0x3c0b5c,_0xc5c238){if(_0x3c0b5c[_0xcc64('0x4b')]['id']){delete _0x3c0b5c[_0xcc64('0x4b')]['id'];}return db[_0xcc64('0x2e')][_0xcc64('0x4c')]({'where':{'id':_0x3c0b5c['params']['id']}})[_0xcc64('0x28')](handleEntityNotFound(_0xc5c238,null))[_0xcc64('0x28')](saveUpdates(_0x3c0b5c['body'],null))[_0xcc64('0x28')](respondWithResult(_0xc5c238,null))['catch'](handleError(_0xc5c238,null));};exports['destroy']=function(_0x325ebe,_0x311cd8){return db[_0xcc64('0x2e')][_0xcc64('0x4c')]({'where':{'id':_0x325ebe['params']['id']}})['then'](handleEntityNotFound(_0x311cd8,null))[_0xcc64('0x28')](removeEntity(_0x311cd8,null))['catch'](handleError(_0x311cd8,null));};exports[_0xcc64('0x4d')]=function(_0x456ebb,_0x5823cf){return db['SquareReport'][_0xcc64('0x4d')]()['then'](respondWithResult(_0x5823cf,null))[_0xcc64('0x49')](handleError(_0x5823cf,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 72da3e7..61f08a9 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 _0x4258=['project_name','leaveAt','lodash','api','moment','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','uid_pname','uniqueid'];(function(_0x522629,_0x27cdae){var _0x47e144=function(_0xfa75ed){while(--_0xfa75ed){_0x522629['push'](_0x522629['shift']());}};_0x47e144(++_0x27cdae);}(_0x4258,0x197));var _0x8425=function(_0x4b280a,_0x448f46){_0x4b280a=_0x4b280a-0x0;var _0x10fdf8=_0x4258[_0x4b280a];return _0x10fdf8;};'use strict';var _=require(_0x8425('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8425('0x1'));var moment=require(_0x8425('0x2'));var BPromise=require(_0x8425('0x3'));var rp=require(_0x8425('0x4'));var fs=require('fs');var path=require(_0x8425('0x5'));var rimraf=require(_0x8425('0x6'));var config=require('../../config/environment');var attributes=require(_0x8425('0x7'));module[_0x8425('0x8')]=function(_0x4fabc5,_0x37df12){return _0x4fabc5[_0x8425('0x9')](_0x8425('0xa'),attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x8425('0xb'),'fields':[_0x8425('0xc'),_0x8425('0xd')]},{'name':_0x8425('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf36b=['project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./squareReport.attributes','define','report_square','uid_pname','uniqueid'];(function(_0x1d357f,_0x2a064){var _0x425d68=function(_0x3418e1){while(--_0x3418e1){_0x1d357f['push'](_0x1d357f['shift']());}};_0x425d68(++_0x2a064);}(_0xf36b,0x110));var _0xbf36=function(_0xdcb4e4,_0xb3d63c){_0xdcb4e4=_0xdcb4e4-0x0;var _0x105a6b=_0xf36b[_0xdcb4e4];return _0x105a6b;};'use strict';var _=require(_0xbf36('0x0'));var util=require(_0xbf36('0x1'));var logger=require(_0xbf36('0x2'))(_0xbf36('0x3'));var moment=require(_0xbf36('0x4'));var BPromise=require(_0xbf36('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbf36('0x6'));var rimraf=require(_0xbf36('0x7'));var config=require('../../config/environment');var attributes=require(_0xbf36('0x8'));module['exports']=function(_0x5a793b,_0x39d5f9){return _0x5a793b[_0xbf36('0x9')]('SquareReport',attributes,{'tableName':_0xbf36('0xa'),'paranoid':![],'indexes':[{'name':_0xbf36('0xb'),'fields':[_0xbf36('0xc'),_0xbf36('0xd')]},{'name':_0xbf36('0xe'),'fields':[_0xbf36('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index ad2cbba..0d83d22 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 _0x69ca=['attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport'];(function(_0x133296,_0xe8ff9a){var _0x193517=function(_0x161ffd){while(--_0x161ffd){_0x133296['push'](_0x133296['shift']());}};_0x193517(++_0xe8ff9a);}(_0x69ca,0xfb));var _0xa69c=function(_0x1dc82c,_0x4f43eb){_0x1dc82c=_0x1dc82c-0x0;var _0x39b34a=_0x69ca[_0x1dc82c];return _0x39b34a;};'use strict';var _=require('lodash');var util=require(_0xa69c('0x0'));var moment=require(_0xa69c('0x1'));var BPromise=require(_0xa69c('0x2'));var rs=require(_0xa69c('0x3'));var fs=require('fs');var Redis=require(_0xa69c('0x4'));var db=require(_0xa69c('0x5'))['db'];var utils=require(_0xa69c('0x6'));var logger=require(_0xa69c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa69c('0x8'));var client=jayson['client'][_0xa69c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x130aef,_0x375164,_0x4e5af6){return new BPromise(function(_0x231592,_0x303ceb){return client[_0xa69c('0xa')](_0x130aef,_0x4e5af6)[_0xa69c('0xb')](function(_0x30e04c){logger['info'](_0xa69c('0xc'),_0x375164,'request\x20sent');logger['debug'](_0xa69c('0xd'),_0x375164,_0xa69c('0xe'),JSON[_0xa69c('0xf')](_0x30e04c));if(_0x30e04c[_0xa69c('0x10')]){if(_0x30e04c['error']['code']===0x1f4){logger[_0xa69c('0x10')](_0xa69c('0xc'),_0x375164,_0x30e04c[_0xa69c('0x10')]['message']);return _0x303ceb(_0x30e04c[_0xa69c('0x10')][_0xa69c('0x11')]);}logger[_0xa69c('0x10')]('SquareReport,\x20%s,\x20%s',_0x375164,_0x30e04c[_0xa69c('0x10')][_0xa69c('0x11')]);return _0x231592(_0x30e04c[_0xa69c('0x10')][_0xa69c('0x11')]);}else{logger[_0xa69c('0x12')]('SquareReport,\x20%s,\x20%s',_0x375164,_0xa69c('0xe'));_0x231592(_0x30e04c[_0xa69c('0x13')][_0xa69c('0x11')]);}})['catch'](function(_0x835181){logger['error'](_0xa69c('0xc'),_0x375164,_0x835181);_0x303ceb(_0x835181);});});}exports[_0xa69c('0x14')]=function(_0x2bf801){var _0x2328bc=this;return new Promise(function(_0x117d7d,_0x194213){return db[_0xa69c('0x15')][_0xa69c('0x16')](_0x2bf801[_0xa69c('0x17')],{'raw':_0x2bf801[_0xa69c('0x18')]?_0x2bf801[_0xa69c('0x18')][_0xa69c('0x19')]===undefined?!![]:![]:!![]})[_0xa69c('0xb')](function(_0x1960c3){logger[_0xa69c('0x12')](_0xa69c('0x14'),_0x2bf801);logger[_0xa69c('0x1a')](_0xa69c('0x14'),_0x2bf801,JSON[_0xa69c('0xf')](_0x1960c3));_0x117d7d(_0x1960c3);})['catch'](function(_0x5f16b8){logger[_0xa69c('0x10')](_0xa69c('0x14'),_0x5f16b8[_0xa69c('0x11')],_0x2bf801);_0x194213(_0x2328bc['error'](0x1f4,_0x5f16b8['message']));});});};exports[_0xa69c('0x1b')]=function(_0x52c226){var _0x14e6fc=this;return new Promise(function(_0x16e011,_0x46dc55){return db[_0xa69c('0x15')]['update'](_0x52c226['body'],{'raw':_0x52c226[_0xa69c('0x18')]?_0x52c226[_0xa69c('0x18')][_0xa69c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52c226[_0xa69c('0x18')]?_0x52c226[_0xa69c('0x18')]['where']||null:null,'attributes':_0x52c226['options']?_0x52c226[_0xa69c('0x18')][_0xa69c('0x1c')]||null:null,'limit':_0x52c226[_0xa69c('0x18')]?_0x52c226[_0xa69c('0x18')][_0xa69c('0x1d')]||null:null})[_0xa69c('0xb')](function(_0x35b624){logger[_0xa69c('0x12')](_0xa69c('0x1b'),_0x52c226);logger['debug']('UpdateSquareReport',_0x52c226,JSON['stringify'](_0x35b624));_0x16e011(_0x35b624);})[_0xa69c('0x1e')](function(_0x5616ca){logger['error'](_0xa69c('0x1b'),_0x5616ca[_0xa69c('0x11')],_0x52c226);_0x46dc55(_0x14e6fc[_0xa69c('0x10')](0x1f4,_0x5616ca[_0xa69c('0x11')]));});});}; \ No newline at end of file +var _0x486c=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','body','options','raw','UpdateSquareReport','update','where','attributes','limit','lodash','util','ioredis','../../mysqldb'];(function(_0x57f12a,_0x5b40e3){var _0x1fe002=function(_0x1699af){while(--_0x1699af){_0x57f12a['push'](_0x57f12a['shift']());}};_0x1fe002(++_0x5b40e3);}(_0x486c,0x1eb));var _0xc486=function(_0x25c508,_0x48265f){_0x25c508=_0x25c508-0x0;var _0xfc6162=_0x486c[_0x25c508];return _0xfc6162;};'use strict';var _=require(_0xc486('0x0'));var util=require(_0xc486('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc486('0x2'));var db=require(_0xc486('0x3'))['db'];var utils=require(_0xc486('0x4'));var logger=require('../../config/logger')(_0xc486('0x5'));var config=require('../../config/environment');var jayson=require(_0xc486('0x6'));var client=jayson[_0xc486('0x7')][_0xc486('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x267d24,_0x532c48,_0x4ebab4){return new BPromise(function(_0x136193,_0x12ed7b){return client[_0xc486('0x9')](_0x267d24,_0x4ebab4)[_0xc486('0xa')](function(_0x4e3c5c){logger[_0xc486('0xb')](_0xc486('0xc'),_0x532c48,_0xc486('0xd'));logger[_0xc486('0xe')](_0xc486('0xf'),_0x532c48,_0xc486('0xd'),JSON[_0xc486('0x10')](_0x4e3c5c));if(_0x4e3c5c['error']){if(_0x4e3c5c[_0xc486('0x11')][_0xc486('0x12')]===0x1f4){logger[_0xc486('0x11')]('SquareReport,\x20%s,\x20%s',_0x532c48,_0x4e3c5c['error']['message']);return _0x12ed7b(_0x4e3c5c[_0xc486('0x11')]['message']);}logger[_0xc486('0x11')]('SquareReport,\x20%s,\x20%s',_0x532c48,_0x4e3c5c[_0xc486('0x11')]['message']);return _0x136193(_0x4e3c5c[_0xc486('0x11')][_0xc486('0x13')]);}else{logger[_0xc486('0xb')](_0xc486('0xc'),_0x532c48,_0xc486('0xd'));_0x136193(_0x4e3c5c[_0xc486('0x14')]['message']);}})[_0xc486('0x15')](function(_0x1ce65d){logger[_0xc486('0x11')]('SquareReport,\x20%s,\x20%s',_0x532c48,_0x1ce65d);_0x12ed7b(_0x1ce65d);});});}exports[_0xc486('0x16')]=function(_0x6b8bac){var _0x4c9fe8=this;return new Promise(function(_0x298d92,_0x1220ca){return db[_0xc486('0x17')][_0xc486('0x18')](_0x6b8bac[_0xc486('0x19')],{'raw':_0x6b8bac[_0xc486('0x1a')]?_0x6b8bac[_0xc486('0x1a')][_0xc486('0x1b')]===undefined?!![]:![]:!![]})[_0xc486('0xa')](function(_0x4ce4cb){logger[_0xc486('0xb')](_0xc486('0x16'),_0x6b8bac);logger[_0xc486('0xe')](_0xc486('0x16'),_0x6b8bac,JSON[_0xc486('0x10')](_0x4ce4cb));_0x298d92(_0x4ce4cb);})[_0xc486('0x15')](function(_0x4a862b){logger[_0xc486('0x11')](_0xc486('0x16'),_0x4a862b[_0xc486('0x13')],_0x6b8bac);_0x1220ca(_0x4c9fe8['error'](0x1f4,_0x4a862b['message']));});});};exports[_0xc486('0x1c')]=function(_0x412334){var _0x342b85=this;return new Promise(function(_0x59b147,_0x5d51af){return db[_0xc486('0x17')][_0xc486('0x1d')](_0x412334['body'],{'raw':_0x412334[_0xc486('0x1a')]?_0x412334['options'][_0xc486('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x412334[_0xc486('0x1a')]?_0x412334[_0xc486('0x1a')][_0xc486('0x1e')]||null:null,'attributes':_0x412334[_0xc486('0x1a')]?_0x412334[_0xc486('0x1a')][_0xc486('0x1f')]||null:null,'limit':_0x412334[_0xc486('0x1a')]?_0x412334[_0xc486('0x1a')][_0xc486('0x20')]||null:null})[_0xc486('0xa')](function(_0x29ab2c){logger[_0xc486('0xb')]('UpdateSquareReport',_0x412334);logger['debug']('UpdateSquareReport',_0x412334,JSON['stringify'](_0x29ab2c));_0x59b147(_0x29ab2c);})['catch'](function(_0x183bef){logger[_0xc486('0x11')](_0xc486('0x1c'),_0x183bef[_0xc486('0x13')],_0x412334);_0x5d51af(_0x342b85[_0xc486('0x11')](0x1f4,_0x183bef[_0xc486('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 6b482ae..2027950 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 _0xdaf7=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','show','post','/:id','update','destroy','exports'];(function(_0x1feffd,_0x10faf0){var _0x35eb9a=function(_0x4e5f58){while(--_0x4e5f58){_0x1feffd['push'](_0x1feffd['shift']());}};_0x35eb9a(++_0x10faf0);}(_0xdaf7,0x160));var _0x7daf=function(_0x54e519,_0x542fc7){_0x54e519=_0x54e519-0x0;var _0x1bec40=_0xdaf7[_0x54e519];return _0x1bec40;};'use strict';var multer=require('multer');var util=require(_0x7daf('0x0'));var path=require('path');var timeout=require(_0x7daf('0x1'));var express=require(_0x7daf('0x2'));var router=express[_0x7daf('0x3')]();var fs_extra=require(_0x7daf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x7daf('0x5'));var config=require(_0x7daf('0x6'));var controller=require('./squareReportDetail.controller');router[_0x7daf('0x7')]('/',auth[_0x7daf('0x8')](),controller['index']);router[_0x7daf('0x7')]('/describe',auth[_0x7daf('0x8')](),controller[_0x7daf('0x9')]);router[_0x7daf('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x7daf('0xa')]);router[_0x7daf('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7daf('0xc'),auth['isAuthenticated'](),controller[_0x7daf('0xd')]);router['delete'](_0x7daf('0xc'),auth[_0x7daf('0x8')](),controller[_0x7daf('0xe')]);module[_0x7daf('0xf')]=router; \ No newline at end of file +var _0xd760=['/describe','describe','/:id','show','post','put','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index'];(function(_0x30e675,_0x4eebc7){var _0x258b27=function(_0x253d97){while(--_0x253d97){_0x30e675['push'](_0x30e675['shift']());}};_0x258b27(++_0x4eebc7);}(_0xd760,0x7a));var _0x0d76=function(_0x3a9b0f,_0x1a9746){_0x3a9b0f=_0x3a9b0f-0x0;var _0x1fe3aa=_0xd760[_0x3a9b0f];return _0x1fe3aa;};'use strict';var multer=require(_0x0d76('0x0'));var util=require(_0x0d76('0x1'));var path=require(_0x0d76('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d76('0x3'));var router=express['Router']();var fs_extra=require(_0x0d76('0x4'));var auth=require(_0x0d76('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0d76('0x6'));var controller=require(_0x0d76('0x7'));router[_0x0d76('0x8')]('/',auth[_0x0d76('0x9')](),controller[_0x0d76('0xa')]);router[_0x0d76('0x8')](_0x0d76('0xb'),auth[_0x0d76('0x9')](),controller[_0x0d76('0xc')]);router[_0x0d76('0x8')](_0x0d76('0xd'),auth[_0x0d76('0x9')](),controller[_0x0d76('0xe')]);router[_0x0d76('0xf')]('/',auth[_0x0d76('0x9')](),controller['create']);router[_0x0d76('0x10')]('/:id',auth[_0x0d76('0x9')](),controller['update']);router[_0x0d76('0x11')]('/:id',auth[_0x0d76('0x9')](),controller['destroy']);module[_0x0d76('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c94079e..005af75 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 _0xcb97=['exports','STRING','TEXT','sequelize'];(function(_0x4deab5,_0x15ee18){var _0x4d6f5b=function(_0x54dada){while(--_0x54dada){_0x4deab5['push'](_0x4deab5['shift']());}};_0x4d6f5b(++_0x15ee18);}(_0xcb97,0x73));var _0x7cb9=function(_0x725a4c,_0x102507){_0x725a4c=_0x725a4c-0x0;var _0x37b2cc=_0xcb97[_0x725a4c];return _0x37b2cc;};'use strict';var Sequelize=require(_0x7cb9('0x0'));module[_0x7cb9('0x1')]={'uniqueid':{'type':Sequelize[_0x7cb9('0x2')]},'node':{'type':Sequelize[_0x7cb9('0x2')]},'application':{'type':Sequelize[_0x7cb9('0x2')]},'data':{'type':Sequelize[_0x7cb9('0x3')]},'project_name':{'type':Sequelize[_0x7cb9('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x42f1=['STRING'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x42f1,0x19a));var _0x142f=function(_0x237f13,_0x485c64){_0x237f13=_0x237f13-0x0;var _0x3da70f=_0x42f1[_0x237f13];return _0x3da70f;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x142f('0x0')]},'node':{'type':Sequelize[_0x142f('0x0')]},'application':{'type':Sequelize[_0x142f('0x0')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x142f('0x0')]},'callerid':{'type':Sequelize[_0x142f('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index e7b607b..9fac5f3 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 _0xa490=['name','send','index','rawAttributes','type','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','SquareDetailsReport','count','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','set','save','update','destroy','then','sendStatus','error','stack'];(function(_0x34fe4b,_0x4e59a5){var _0x2a5101=function(_0x200965){while(--_0x200965){_0x34fe4b['push'](_0x34fe4b['shift']());}};_0x2a5101(++_0x4e59a5);}(_0xa490,0xf5));var _0x0a49=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa490[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0a49('0x0'));var rimraf=require(_0x0a49('0x1'));var zipdir=require(_0x0a49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0a49('0x3'));var moment=require(_0x0a49('0x4'));var BPromise=require(_0x0a49('0x5'));var Mustache=require(_0x0a49('0x6'));var util=require(_0x0a49('0x7'));var path=require(_0x0a49('0x8'));var sox=require(_0x0a49('0x9'));var csv=require(_0x0a49('0xa'));var ejs=require(_0x0a49('0xb'));var fs=require('fs');var fs_extra=require(_0x0a49('0xc'));var _=require('lodash');var squel=require(_0x0a49('0xd'));var crypto=require(_0x0a49('0xe'));var jsforce=require(_0x0a49('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0a49('0xa'));var querystring=require('querystring');var Papa=require(_0x0a49('0x10'));var Redis=require(_0x0a49('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0a49('0x12'));var as=require(_0x0a49('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a49('0x14'))(_0x0a49('0x15'));var utils=require('../../config/utils');var config=require(_0x0a49('0x16'));var licenseUtil=require(_0x0a49('0x17'));var db=require(_0x0a49('0x18'))['db'];function respondWithStatusCode(_0x1fd442,_0x127e31){_0x127e31=_0x127e31||0xcc;return function(_0x10456b){if(_0x10456b){return _0x1fd442['sendStatus'](_0x127e31);}return _0x1fd442[_0x0a49('0x19')](_0x127e31)[_0x0a49('0x1a')]();};}function respondWithResult(_0x54e569,_0x4681df){_0x4681df=_0x4681df||0xc8;return function(_0x412528){if(_0x412528){return _0x54e569[_0x0a49('0x19')](_0x4681df)[_0x0a49('0x1b')](_0x412528);}};}function respondWithFilteredResult(_0x2c09b7,_0xf31831){return function(_0xd28729){if(_0xd28729){var _0x410d5d=typeof _0xf31831[_0x0a49('0x1c')]==='undefined'&&typeof _0xf31831[_0x0a49('0x1d')]===_0x0a49('0x1e');var _0x4dc4dd=_0xd28729['count'];var _0x9a88f5=_0x410d5d?0x0:_0xf31831[_0x0a49('0x1c')];var _0x46b696=_0x410d5d?_0xd28729['count']:_0xf31831[_0x0a49('0x1c')]+_0xf31831[_0x0a49('0x1d')];var _0x428dda;if(_0x46b696>=_0x4dc4dd){_0x46b696=_0x4dc4dd;_0x428dda=0xc8;}else{_0x428dda=0xce;}_0x2c09b7['status'](_0x428dda);return _0x2c09b7[_0x0a49('0x1f')]('Content-Range',_0x9a88f5+'-'+_0x46b696+'/'+_0x4dc4dd)['json'](_0xd28729);}return null;};}function patchUpdates(_0x5e2a66){return function(_0x4ab5c2){try{jsonpatch['apply'](_0x4ab5c2,_0x5e2a66,!![]);}catch(_0x4ca5a5){return BPromise['reject'](_0x4ca5a5);}return _0x4ab5c2[_0x0a49('0x20')]();};}function saveUpdates(_0x5b73eb,_0x105d35){return function(_0x4449b3){if(_0x4449b3){return _0x4449b3[_0x0a49('0x21')](_0x5b73eb)['then'](function(_0x79b5f8){return _0x79b5f8;});}return null;};}function removeEntity(_0x13af13,_0x29ef80){return function(_0x28d1f5){if(_0x28d1f5){return _0x28d1f5[_0x0a49('0x22')]()[_0x0a49('0x23')](function(){_0x13af13[_0x0a49('0x19')](0xcc)[_0x0a49('0x1a')]();});}};}function handleEntityNotFound(_0x10c385,_0x3476df){return function(_0x411cbe){if(!_0x411cbe){_0x10c385[_0x0a49('0x24')](0x194);}return _0x411cbe;};}function handleError(_0x2b2cd7,_0x5a835f){_0x5a835f=_0x5a835f||0x1f4;return function(_0x1200df){logger[_0x0a49('0x25')](_0x1200df[_0x0a49('0x26')]);if(_0x1200df[_0x0a49('0x27')]){delete _0x1200df[_0x0a49('0x27')];}_0x2b2cd7[_0x0a49('0x19')](_0x5a835f)[_0x0a49('0x28')](_0x1200df);};}exports[_0x0a49('0x29')]=function(_0x36387f,_0x300eeb){var _0x5e434d={},_0x5e1062={},_0x5030fa={'count':0x0,'rows':[]};var _0x228df1=_['map'](db['SquareDetailsReport'][_0x0a49('0x2a')],function(_0x37b92b){return{'name':_0x37b92b['fieldName'],'type':_0x37b92b[_0x0a49('0x2b')]['key']};});_0x5e1062[_0x0a49('0x2c')]=_[_0x0a49('0x2d')](_0x228df1,_0x0a49('0x27'));_0x5e1062[_0x0a49('0x2e')]=_[_0x0a49('0x2f')](_0x36387f['query']);_0x5e1062[_0x0a49('0x30')]=_[_0x0a49('0x31')](_0x5e1062['model'],_0x5e1062[_0x0a49('0x2e')]);_0x5e434d[_0x0a49('0x32')]=_[_0x0a49('0x31')](_0x5e1062[_0x0a49('0x2c')],qs[_0x0a49('0x33')](_0x36387f['query']['fields']));_0x5e434d['attributes']=_0x5e434d[_0x0a49('0x32')][_0x0a49('0x34')]?_0x5e434d[_0x0a49('0x32')]:_0x5e1062[_0x0a49('0x2c')];if(!_0x36387f[_0x0a49('0x2e')]['hasOwnProperty']('nolimit')){_0x5e434d['limit']=qs[_0x0a49('0x1d')](_0x36387f[_0x0a49('0x2e')]['limit']);_0x5e434d['offset']=qs[_0x0a49('0x1c')](_0x36387f['query'][_0x0a49('0x1c')]);}_0x5e434d['order']=qs['sort'](_0x36387f[_0x0a49('0x2e')][_0x0a49('0x35')]);_0x5e434d[_0x0a49('0x36')]=qs['filters'](_[_0x0a49('0x37')](_0x36387f[_0x0a49('0x2e')],_0x5e1062[_0x0a49('0x30')]),_0x228df1);if(_0x36387f['query'][_0x0a49('0x38')]){_0x5e434d[_0x0a49('0x36')]=_[_0x0a49('0x39')](_0x5e434d[_0x0a49('0x36')],{'$or':_['map'](_0x228df1,function(_0x20d09b){if(_0x20d09b[_0x0a49('0x2b')]!==_0x0a49('0x3a')){var _0x25d253={};_0x25d253[_0x20d09b[_0x0a49('0x27')]]={'$like':'%'+_0x36387f['query'][_0x0a49('0x38')]+'%'};return _0x25d253;}})});}_0x5e434d=_[_0x0a49('0x39')]({},_0x5e434d,_0x36387f[_0x0a49('0x3b')]);var _0xf812ee={'where':_0x5e434d[_0x0a49('0x36')]};return db[_0x0a49('0x3c')][_0x0a49('0x3d')](_0xf812ee)[_0x0a49('0x23')](function(_0x38cb43){_0x5030fa['count']=_0x38cb43;if(_0x36387f[_0x0a49('0x2e')]['includeAll']){_0x5e434d[_0x0a49('0x3e')]=[{'all':!![]}];}return db[_0x0a49('0x3c')]['findAll'](_0x5e434d);})[_0x0a49('0x23')](function(_0x5f5989){_0x5030fa[_0x0a49('0x3f')]=_0x5f5989;return _0x5030fa;})['then'](respondWithFilteredResult(_0x300eeb,_0x5e434d))[_0x0a49('0x40')](handleError(_0x300eeb,null));};exports[_0x0a49('0x41')]=function(_0x5d252d,_0x43e09d){var _0x175c1c={'raw':!![],'where':{'id':_0x5d252d[_0x0a49('0x42')]['id']}},_0x46f836={};_0x46f836['model']=_['keys'](db[_0x0a49('0x3c')][_0x0a49('0x2a')]);_0x46f836[_0x0a49('0x2e')]=_[_0x0a49('0x2f')](_0x5d252d['query']);_0x46f836['filters']=_[_0x0a49('0x31')](_0x46f836[_0x0a49('0x2c')],_0x46f836[_0x0a49('0x2e')]);_0x175c1c[_0x0a49('0x32')]=_[_0x0a49('0x31')](_0x46f836[_0x0a49('0x2c')],qs[_0x0a49('0x33')](_0x5d252d[_0x0a49('0x2e')][_0x0a49('0x33')]));_0x175c1c[_0x0a49('0x32')]=_0x175c1c['attributes'][_0x0a49('0x34')]?_0x175c1c['attributes']:_0x46f836[_0x0a49('0x2c')];if(_0x5d252d[_0x0a49('0x2e')]['includeAll']){_0x175c1c['include']=[{'all':!![]}];}_0x175c1c=_['merge']({},_0x175c1c,_0x5d252d['options']);return db[_0x0a49('0x3c')][_0x0a49('0x43')](_0x175c1c)['then'](handleEntityNotFound(_0x43e09d,null))[_0x0a49('0x23')](respondWithResult(_0x43e09d,null))[_0x0a49('0x40')](handleError(_0x43e09d,null));};exports[_0x0a49('0x44')]=function(_0x13a07d,_0x327f18){return db[_0x0a49('0x3c')][_0x0a49('0x44')](_0x13a07d[_0x0a49('0x45')],{})[_0x0a49('0x23')](respondWithResult(_0x327f18,0xc9))[_0x0a49('0x40')](handleError(_0x327f18,null));};exports[_0x0a49('0x21')]=function(_0xc26151,_0x5950cf){if(_0xc26151[_0x0a49('0x45')]['id']){delete _0xc26151[_0x0a49('0x45')]['id'];}return db[_0x0a49('0x3c')][_0x0a49('0x43')]({'where':{'id':_0xc26151['params']['id']}})[_0x0a49('0x23')](handleEntityNotFound(_0x5950cf,null))[_0x0a49('0x23')](saveUpdates(_0xc26151[_0x0a49('0x45')],null))[_0x0a49('0x23')](respondWithResult(_0x5950cf,null))[_0x0a49('0x40')](handleError(_0x5950cf,null));};exports['destroy']=function(_0x5c7f67,_0x55c73){return db[_0x0a49('0x3c')]['find']({'where':{'id':_0x5c7f67[_0x0a49('0x42')]['id']}})[_0x0a49('0x23')](handleEntityNotFound(_0x55c73,null))[_0x0a49('0x23')](removeEntity(_0x55c73,null))[_0x0a49('0x40')](handleError(_0x55c73,null));};exports[_0x0a49('0x46')]=function(_0x525823,_0x2e41d3){return db['SquareDetailsReport'][_0x0a49('0x46')]()['then'](respondWithResult(_0x2e41d3,null))[_0x0a49('0x40')](handleError(_0x2e41d3,null));}; \ No newline at end of file +var _0x23cb=['SquareDetailsReport','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','findAll','rows','show','params','includeAll','catch','create','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','name','send','index','map'];(function(_0x388ef4,_0x3f99fb){var _0x13d1ae=function(_0xe9e22f){while(--_0xe9e22f){_0x388ef4['push'](_0x388ef4['shift']());}};_0x13d1ae(++_0x3f99fb);}(_0x23cb,0x19d));var _0xb23c=function(_0x5cb5df,_0x59388f){_0x5cb5df=_0x5cb5df-0x0;var _0x30cf67=_0x23cb[_0x5cb5df];return _0x30cf67;};'use strict';var emlformat=require(_0xb23c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb23c('0x1'));var jsonpatch=require(_0xb23c('0x2'));var rp=require(_0xb23c('0x3'));var moment=require('moment');var BPromise=require(_0xb23c('0x4'));var Mustache=require(_0xb23c('0x5'));var util=require(_0xb23c('0x6'));var path=require('path');var sox=require(_0xb23c('0x7'));var csv=require('to-csv');var ejs=require(_0xb23c('0x8'));var fs=require('fs');var fs_extra=require(_0xb23c('0x9'));var _=require('lodash');var squel=require(_0xb23c('0xa'));var crypto=require('crypto');var jsforce=require(_0xb23c('0xb'));var deskjs=require(_0xb23c('0xc'));var toCsv=require(_0xb23c('0xd'));var querystring=require(_0xb23c('0xe'));var Papa=require(_0xb23c('0xf'));var Redis=require(_0xb23c('0x10'));var authService=require(_0xb23c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb23c('0x12'));var logger=require(_0xb23c('0x13'))(_0xb23c('0x14'));var utils=require(_0xb23c('0x15'));var config=require(_0xb23c('0x16'));var licenseUtil=require(_0xb23c('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x388a7f,_0x5a2e89){_0x5a2e89=_0x5a2e89||0xcc;return function(_0x120d4d){if(_0x120d4d){return _0x388a7f[_0xb23c('0x18')](_0x5a2e89);}return _0x388a7f[_0xb23c('0x19')](_0x5a2e89)[_0xb23c('0x1a')]();};}function respondWithResult(_0x1b6398,_0x3ba50f){_0x3ba50f=_0x3ba50f||0xc8;return function(_0x14df4c){if(_0x14df4c){return _0x1b6398[_0xb23c('0x19')](_0x3ba50f)[_0xb23c('0x1b')](_0x14df4c);}};}function respondWithFilteredResult(_0x503fe2,_0x32d57c){return function(_0x274511){if(_0x274511){var _0x523070=typeof _0x32d57c['offset']===_0xb23c('0x1c')&&typeof _0x32d57c[_0xb23c('0x1d')]===_0xb23c('0x1c');var _0x48810c=_0x274511[_0xb23c('0x1e')];var _0x4c6f79=_0x523070?0x0:_0x32d57c[_0xb23c('0x1f')];var _0x2778fd=_0x523070?_0x274511[_0xb23c('0x1e')]:_0x32d57c[_0xb23c('0x1f')]+_0x32d57c[_0xb23c('0x1d')];var _0x41c0b7;if(_0x2778fd>=_0x48810c){_0x2778fd=_0x48810c;_0x41c0b7=0xc8;}else{_0x41c0b7=0xce;}_0x503fe2[_0xb23c('0x19')](_0x41c0b7);return _0x503fe2[_0xb23c('0x20')](_0xb23c('0x21'),_0x4c6f79+'-'+_0x2778fd+'/'+_0x48810c)['json'](_0x274511);}return null;};}function patchUpdates(_0x443709){return function(_0x4ca412){try{jsonpatch[_0xb23c('0x22')](_0x4ca412,_0x443709,!![]);}catch(_0x5ba384){return BPromise[_0xb23c('0x23')](_0x5ba384);}return _0x4ca412[_0xb23c('0x24')]();};}function saveUpdates(_0x338397,_0x57ed18){return function(_0x5c88f0){if(_0x5c88f0){return _0x5c88f0['update'](_0x338397)[_0xb23c('0x25')](function(_0x58b167){return _0x58b167;});}return null;};}function removeEntity(_0x2a585b,_0x3fec09){return function(_0x15fee7){if(_0x15fee7){return _0x15fee7[_0xb23c('0x26')]()[_0xb23c('0x25')](function(){_0x2a585b[_0xb23c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3db1a4,_0x10ddca){return function(_0x5be8bf){if(!_0x5be8bf){_0x3db1a4[_0xb23c('0x18')](0x194);}return _0x5be8bf;};}function handleError(_0xf1dec3,_0x818138){_0x818138=_0x818138||0x1f4;return function(_0x4681c0){logger['error'](_0x4681c0['stack']);if(_0x4681c0['name']){delete _0x4681c0[_0xb23c('0x27')];}_0xf1dec3[_0xb23c('0x19')](_0x818138)[_0xb23c('0x28')](_0x4681c0);};}exports[_0xb23c('0x29')]=function(_0x54ff5c,_0x4e0520){var _0x142b1c={},_0x3c1d8c={},_0x37f2ec={'count':0x0,'rows':[]};var _0x3b5883=_[_0xb23c('0x2a')](db[_0xb23c('0x2b')][_0xb23c('0x2c')],function(_0x593166){return{'name':_0x593166[_0xb23c('0x2d')],'type':_0x593166[_0xb23c('0x2e')]['key']};});_0x3c1d8c[_0xb23c('0x2f')]=_[_0xb23c('0x2a')](_0x3b5883,_0xb23c('0x27'));_0x3c1d8c[_0xb23c('0x30')]=_[_0xb23c('0x31')](_0x54ff5c[_0xb23c('0x30')]);_0x3c1d8c['filters']=_[_0xb23c('0x32')](_0x3c1d8c[_0xb23c('0x2f')],_0x3c1d8c[_0xb23c('0x30')]);_0x142b1c['attributes']=_[_0xb23c('0x32')](_0x3c1d8c[_0xb23c('0x2f')],qs[_0xb23c('0x33')](_0x54ff5c['query']['fields']));_0x142b1c['attributes']=_0x142b1c[_0xb23c('0x34')][_0xb23c('0x35')]?_0x142b1c[_0xb23c('0x34')]:_0x3c1d8c[_0xb23c('0x2f')];if(!_0x54ff5c[_0xb23c('0x30')][_0xb23c('0x36')](_0xb23c('0x37'))){_0x142b1c['limit']=qs['limit'](_0x54ff5c[_0xb23c('0x30')]['limit']);_0x142b1c[_0xb23c('0x1f')]=qs[_0xb23c('0x1f')](_0x54ff5c['query'][_0xb23c('0x1f')]);}_0x142b1c[_0xb23c('0x38')]=qs['sort'](_0x54ff5c['query'][_0xb23c('0x39')]);_0x142b1c[_0xb23c('0x3a')]=qs[_0xb23c('0x3b')](_[_0xb23c('0x3c')](_0x54ff5c[_0xb23c('0x30')],_0x3c1d8c[_0xb23c('0x3b')]),_0x3b5883);if(_0x54ff5c[_0xb23c('0x30')]['filter']){_0x142b1c['where']=_[_0xb23c('0x3d')](_0x142b1c[_0xb23c('0x3a')],{'$or':_[_0xb23c('0x2a')](_0x3b5883,function(_0x35d012){if(_0x35d012[_0xb23c('0x2e')]!=='VIRTUAL'){var _0x3a5faf={};_0x3a5faf[_0x35d012[_0xb23c('0x27')]]={'$like':'%'+_0x54ff5c[_0xb23c('0x30')][_0xb23c('0x3e')]+'%'};return _0x3a5faf;}})});}_0x142b1c=_[_0xb23c('0x3d')]({},_0x142b1c,_0x54ff5c[_0xb23c('0x3f')]);var _0x4dd82b={'where':_0x142b1c[_0xb23c('0x3a')]};return db[_0xb23c('0x2b')]['count'](_0x4dd82b)[_0xb23c('0x25')](function(_0xe239bc){_0x37f2ec[_0xb23c('0x1e')]=_0xe239bc;if(_0x54ff5c[_0xb23c('0x30')]['includeAll']){_0x142b1c[_0xb23c('0x40')]=[{'all':!![]}];}return db[_0xb23c('0x2b')][_0xb23c('0x41')](_0x142b1c);})[_0xb23c('0x25')](function(_0xb9b547){_0x37f2ec[_0xb23c('0x42')]=_0xb9b547;return _0x37f2ec;})[_0xb23c('0x25')](respondWithFilteredResult(_0x4e0520,_0x142b1c))['catch'](handleError(_0x4e0520,null));};exports[_0xb23c('0x43')]=function(_0x4b7e15,_0x35b0cd){var _0x49aad6={'raw':!![],'where':{'id':_0x4b7e15[_0xb23c('0x44')]['id']}},_0x2cf50f={};_0x2cf50f[_0xb23c('0x2f')]=_[_0xb23c('0x31')](db[_0xb23c('0x2b')][_0xb23c('0x2c')]);_0x2cf50f[_0xb23c('0x30')]=_[_0xb23c('0x31')](_0x4b7e15[_0xb23c('0x30')]);_0x2cf50f[_0xb23c('0x3b')]=_[_0xb23c('0x32')](_0x2cf50f[_0xb23c('0x2f')],_0x2cf50f['query']);_0x49aad6[_0xb23c('0x34')]=_[_0xb23c('0x32')](_0x2cf50f[_0xb23c('0x2f')],qs[_0xb23c('0x33')](_0x4b7e15[_0xb23c('0x30')][_0xb23c('0x33')]));_0x49aad6[_0xb23c('0x34')]=_0x49aad6[_0xb23c('0x34')][_0xb23c('0x35')]?_0x49aad6[_0xb23c('0x34')]:_0x2cf50f['model'];if(_0x4b7e15[_0xb23c('0x30')][_0xb23c('0x45')]){_0x49aad6[_0xb23c('0x40')]=[{'all':!![]}];}_0x49aad6=_[_0xb23c('0x3d')]({},_0x49aad6,_0x4b7e15[_0xb23c('0x3f')]);return db[_0xb23c('0x2b')]['find'](_0x49aad6)[_0xb23c('0x25')](handleEntityNotFound(_0x35b0cd,null))[_0xb23c('0x25')](respondWithResult(_0x35b0cd,null))[_0xb23c('0x46')](handleError(_0x35b0cd,null));};exports[_0xb23c('0x47')]=function(_0x1db099,_0x4ac97b){return db['SquareDetailsReport'][_0xb23c('0x47')](_0x1db099[_0xb23c('0x48')],{})[_0xb23c('0x25')](respondWithResult(_0x4ac97b,0xc9))[_0xb23c('0x46')](handleError(_0x4ac97b,null));};exports[_0xb23c('0x49')]=function(_0x25e7ab,_0x2afadd){if(_0x25e7ab['body']['id']){delete _0x25e7ab[_0xb23c('0x48')]['id'];}return db[_0xb23c('0x2b')][_0xb23c('0x4a')]({'where':{'id':_0x25e7ab[_0xb23c('0x44')]['id']}})[_0xb23c('0x25')](handleEntityNotFound(_0x2afadd,null))['then'](saveUpdates(_0x25e7ab[_0xb23c('0x48')],null))[_0xb23c('0x25')](respondWithResult(_0x2afadd,null))[_0xb23c('0x46')](handleError(_0x2afadd,null));};exports['destroy']=function(_0x2e5385,_0x28dfed){return db[_0xb23c('0x2b')][_0xb23c('0x4a')]({'where':{'id':_0x2e5385[_0xb23c('0x44')]['id']}})[_0xb23c('0x25')](handleEntityNotFound(_0x28dfed,null))[_0xb23c('0x25')](removeEntity(_0x28dfed,null))['catch'](handleError(_0x28dfed,null));};exports[_0xb23c('0x4b')]=function(_0x327a55,_0x32c803){return db[_0xb23c('0x2b')]['describe']()['then'](respondWithResult(_0x32c803,null))['catch'](handleError(_0x32c803,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 7e46da2..55c410f 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 _0x74b4=['path','../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','api','moment','request-promise'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x74b4,0x1f0));var _0x474b=function(_0xdf63ba,_0x4622c6){_0xdf63ba=_0xdf63ba-0x0;var _0xfb3a08=_0x74b4[_0xdf63ba];return _0xfb3a08;};'use strict';var _=require(_0x474b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x474b('0x1'));var moment=require(_0x474b('0x2'));var BPromise=require('bluebird');var rp=require(_0x474b('0x3'));var fs=require('fs');var path=require(_0x474b('0x4'));var rimraf=require('rimraf');var config=require(_0x474b('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0x474b('0x6')]=function(_0x1e4c3f,_0x1aa517){return _0x1e4c3f[_0x474b('0x7')](_0x474b('0x8'),attributes,{'tableName':_0x474b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6398=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReportDetail.attributes','exports','report_square_details'];(function(_0x37a4b6,_0x3c840a){var _0x5b6192=function(_0x30138b){while(--_0x30138b){_0x37a4b6['push'](_0x37a4b6['shift']());}};_0x5b6192(++_0x3c840a);}(_0x6398,0x174));var _0x8639=function(_0x431ff8,_0x4085dd){_0x431ff8=_0x431ff8-0x0;var _0x84ccd4=_0x6398[_0x431ff8];return _0x84ccd4;};'use strict';var _=require(_0x8639('0x0'));var util=require(_0x8639('0x1'));var logger=require(_0x8639('0x2'))(_0x8639('0x3'));var moment=require(_0x8639('0x4'));var BPromise=require(_0x8639('0x5'));var rp=require(_0x8639('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8639('0x7'));var config=require(_0x8639('0x8'));var attributes=require(_0x8639('0x9'));module[_0x8639('0xa')]=function(_0x2758cd,_0x4d69c4){return _0x2758cd['define']('SquareDetailsReport',attributes,{'tableName':_0x8639('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index 9801dd5..9fcd314 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 _0x5204=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','lodash'];(function(_0x1325d1,_0x3585b3){var _0x1bc2fc=function(_0x3b601f){while(--_0x3b601f){_0x1325d1['push'](_0x1325d1['shift']());}};_0x1bc2fc(++_0x3585b3);}(_0x5204,0xdf));var _0x4520=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0x5204[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var moment=require('moment');var BPromise=require(_0x4520('0x2'));var rs=require(_0x4520('0x3'));var fs=require('fs');var Redis=require(_0x4520('0x4'));var db=require(_0x4520('0x5'))['db'];var utils=require(_0x4520('0x6'));var logger=require('../../config/logger')(_0x4520('0x7'));var config=require('../../config/environment');var jayson=require(_0x4520('0x8'));var client=jayson[_0x4520('0x9')][_0x4520('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe741c2,_0x396d29,_0x446dc9){return new BPromise(function(_0x27890f,_0x55b44f){return client[_0x4520('0xb')](_0xe741c2,_0x446dc9)['then'](function(_0x168e62){logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));logger[_0x4520('0xf')](_0x4520('0x10'),_0x396d29,_0x4520('0xe'),JSON[_0x4520('0x11')](_0x168e62));if(_0x168e62[_0x4520('0x12')]){if(_0x168e62[_0x4520('0x12')][_0x4520('0x13')]===0x1f4){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x55b44f(_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);}logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x168e62[_0x4520('0x12')][_0x4520('0x14')]);return _0x27890f(_0x168e62['error'][_0x4520('0x14')]);}else{logger[_0x4520('0xc')](_0x4520('0xd'),_0x396d29,_0x4520('0xe'));_0x27890f(_0x168e62[_0x4520('0x15')]['message']);}})[_0x4520('0x16')](function(_0x33ac29){logger[_0x4520('0x12')](_0x4520('0xd'),_0x396d29,_0x33ac29);_0x55b44f(_0x33ac29);});});}exports[_0x4520('0x17')]=function(_0x2e00f4){var _0x1dcf51=this;return new Promise(function(_0x4ba69f,_0x3791b6){return db[_0x4520('0x18')][_0x4520('0x19')](_0x2e00f4[_0x4520('0x1a')],{'raw':_0x2e00f4['options']?_0x2e00f4[_0x4520('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4c46c5){logger[_0x4520('0xc')]('CreateSquareDetailsReport',_0x2e00f4);logger[_0x4520('0xf')](_0x4520('0x17'),_0x2e00f4,JSON[_0x4520('0x11')](_0x4c46c5));_0x4ba69f(_0x4c46c5);})['catch'](function(_0x3199a9){logger[_0x4520('0x12')](_0x4520('0x17'),_0x3199a9['message'],_0x2e00f4);_0x3791b6(_0x1dcf51[_0x4520('0x12')](0x1f4,_0x3199a9[_0x4520('0x14')]));});});}; \ No newline at end of file +var _0x3495=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x3495,0x1de));var _0x5349=function(_0x26cf6f,_0x86e045){_0x26cf6f=_0x26cf6f-0x0;var _0x4b9ebd=_0x3495[_0x26cf6f];return _0x4b9ebd;};'use strict';var _=require(_0x5349('0x0'));var util=require(_0x5349('0x1'));var moment=require(_0x5349('0x2'));var BPromise=require(_0x5349('0x3'));var rs=require(_0x5349('0x4'));var fs=require('fs');var Redis=require(_0x5349('0x5'));var db=require(_0x5349('0x6'))['db'];var utils=require(_0x5349('0x7'));var logger=require(_0x5349('0x8'))('rpc');var config=require(_0x5349('0x9'));var jayson=require(_0x5349('0xa'));var client=jayson['client'][_0x5349('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x538385,_0x6fb5dc,_0x529323){return new BPromise(function(_0x393873,_0x583cee){return client[_0x5349('0xc')](_0x538385,_0x529323)[_0x5349('0xd')](function(_0x22a3d3){logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,_0x5349('0x10'));logger[_0x5349('0x11')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x6fb5dc,_0x5349('0x10'),JSON['stringify'](_0x22a3d3));if(_0x22a3d3[_0x5349('0x12')]){if(_0x22a3d3[_0x5349('0x12')][_0x5349('0x13')]===0x1f4){logger[_0x5349('0x12')](_0x5349('0xf'),_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x583cee(_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);}logger[_0x5349('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x6fb5dc,_0x22a3d3[_0x5349('0x12')][_0x5349('0x14')]);return _0x393873(_0x22a3d3['error'][_0x5349('0x14')]);}else{logger[_0x5349('0xe')](_0x5349('0xf'),_0x6fb5dc,'request\x20sent');_0x393873(_0x22a3d3['result']['message']);}})[_0x5349('0x15')](function(_0x5c873d){logger[_0x5349('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x6fb5dc,_0x5c873d);_0x583cee(_0x5c873d);});});}exports[_0x5349('0x16')]=function(_0x2c1f1){var _0x1f5747=this;return new Promise(function(_0x132639,_0x4e128c){return db[_0x5349('0x17')][_0x5349('0x18')](_0x2c1f1[_0x5349('0x19')],{'raw':_0x2c1f1[_0x5349('0x1a')]?_0x2c1f1['options'][_0x5349('0x1b')]===undefined?!![]:![]:!![]})[_0x5349('0xd')](function(_0x4f2cb6){logger['info']('CreateSquareDetailsReport',_0x2c1f1);logger[_0x5349('0x11')]('CreateSquareDetailsReport',_0x2c1f1,JSON[_0x5349('0x1c')](_0x4f2cb6));_0x132639(_0x4f2cb6);})[_0x5349('0x15')](function(_0x164978){logger[_0x5349('0x12')](_0x5349('0x16'),_0x164978[_0x5349('0x14')],_0x2c1f1);_0x4e128c(_0x1f5747[_0x5349('0x12')](0x1f4,_0x164978[_0x5349('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1ab4ccd..1f598e7 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 _0x9f77=['get','/process/:pid/kill','isAuthenticated','exports','express','Router','../../components/auth/service','./system.controller'];(function(_0x27ed41,_0xb780a1){var _0x507934=function(_0x1f09ab){while(--_0x1f09ab){_0x27ed41['push'](_0x27ed41['shift']());}};_0x507934(++_0xb780a1);}(_0x9f77,0x114));var _0x79f7=function(_0x49a3ac,_0x381b36){_0x49a3ac=_0x49a3ac-0x0;var _0x7cec7c=_0x9f77[_0x49a3ac];return _0x7cec7c;};'use strict';var express=require(_0x79f7('0x0'));var router=express[_0x79f7('0x1')]();var auth=require(_0x79f7('0x2'));var controller=require(_0x79f7('0x3'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x79f7('0x4')](_0x79f7('0x5'),auth[_0x79f7('0x6')](),controller['killProcess']);module[_0x79f7('0x7')]=router; \ No newline at end of file +var _0x38c4=['Router','../../components/auth/service','./system.controller','index','isAuthenticated','killProcess','express'];(function(_0x354a8e,_0x23f6ea){var _0x30f96e=function(_0xac6a76){while(--_0xac6a76){_0x354a8e['push'](_0x354a8e['shift']());}};_0x30f96e(++_0x23f6ea);}(_0x38c4,0x6f));var _0x438c=function(_0x32669d,_0x14b65e){_0x32669d=_0x32669d-0x0;var _0x3a12b5=_0x38c4[_0x32669d];return _0x3a12b5;};'use strict';var express=require(_0x438c('0x0'));var router=express[_0x438c('0x1')]();var auth=require(_0x438c('0x2'));var controller=require(_0x438c('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x438c('0x4')]);router['get']('/process/:pid/kill',auth[_0x438c('0x5')](),controller[_0x438c('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index ea8ac8e..2cacbec 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 _0x46e5=['name','status','send','index','getAllData','then','json','format','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','killProcess','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x1b8682,_0x3002d6){var _0x4d10e9=function(_0x3d9b99){while(--_0x3d9b99){_0x1b8682['push'](_0x1b8682['shift']());}};_0x4d10e9(++_0x3002d6);}(_0x46e5,0x9f));var _0x546e=function(_0x22bcf5,_0x17b13f){_0x22bcf5=_0x22bcf5-0x0;var _0xdfe420=_0x46e5[_0x22bcf5];return _0xdfe420;};'use strict';var info=require(_0x546e('0x0'));var exec=require(_0x546e('0x1'))[_0x546e('0x2')];var logger=require(_0x546e('0x3'))(_0x546e('0x4'));var util=require(_0x546e('0x5'));var BPromise=require(_0x546e('0x6'));var _=require(_0x546e('0x7'));function handleError(_0x5d2569,_0x15da45,_0x402d80){_0x15da45=_0x15da45||0x1f4;return function(_0x5ce386){logger['error'](_0x546e('0x8'),_0x402d80,_0x15da45,util['inspect'](_0x5ce386,{'showHidden':![],'depth':null}));delete _0x5ce386[_0x546e('0x9')];_0x5d2569[_0x546e('0xa')](_0x15da45)[_0x546e('0xb')](_0x5ce386);};}exports[_0x546e('0xc')]=function(_0x62c381,_0x2e8b6d){return info[_0x546e('0xd')]()[_0x546e('0xe')](function(_0x362e8a){return _0x2e8b6d[_0x546e('0xa')](0xc8)[_0x546e('0xf')](_0x362e8a);})['catch'](function(_0x392d4d){return _0x2e8b6d[_0x546e('0xa')](0x1f4)['json'](_0x392d4d);});};exports['killProcess']=function(_0x229f16,_0x27fb95){var _0x629487=['components/import/cm'];return new BPromise(function(_0x154edb,_0x21f142){return exec(util[_0x546e('0x10')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x229f16['params'][_0x546e('0x11')]),function(_0x52fb50,_0x4ffe05,_0x10a41b){if(_0x52fb50){return _0x21f142(_0x52fb50);}return _0x154edb(_0x4ffe05);});})['then'](function(_0x41a102){var _0x1d554c=![];var _0x328e96=_0x41a102[_0x546e('0x12')](/\n/);for(var _0x3a7a8e=0x0,_0x4cca94=_0x629487[_0x546e('0x13')];_0x3a7a8e<_0x4cca94,_0x1d554c===![];_0x3a7a8e+=0x1){if(_0x41a102[_0x546e('0x14')](_0x629487[_0x3a7a8e])>=0x0){_0x1d554c=!![];}}if(!_0x1d554c){throw new Error(util[_0x546e('0x10')](_0x546e('0x15'),_0x229f16[_0x546e('0x16')][_0x546e('0x11')]));}process['kill'](_0x229f16[_0x546e('0x16')][_0x546e('0x11')],'SIGINT');return _0x27fb95[_0x546e('0xa')](0xc8)['json']({'message':util[_0x546e('0x10')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x229f16['params'][_0x546e('0x11')])});})['catch'](handleError(_0x27fb95,null,_0x546e('0x17')));}; \ No newline at end of file +var _0x470e=['status','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','exec','../../config/logger','api','util','bluebird','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name'];(function(_0x347c96,_0x238cdb){var _0x3bb169=function(_0xdf4d12){while(--_0xdf4d12){_0x347c96['push'](_0x347c96['shift']());}};_0x3bb169(++_0x238cdb);}(_0x470e,0x1e5));var _0xe470=function(_0xf47939,_0x124b6a){_0xf47939=_0xf47939-0x0;var _0x5f1ec1=_0x470e[_0xf47939];return _0x5f1ec1;};'use strict';var info=require(_0xe470('0x0'));var exec=require('child_process')[_0xe470('0x1')];var logger=require(_0xe470('0x2'))(_0xe470('0x3'));var util=require(_0xe470('0x4'));var BPromise=require(_0xe470('0x5'));var _=require(_0xe470('0x6'));function handleError(_0x5c47f3,_0x293b16,_0x3ea8a4){_0x293b16=_0x293b16||0x1f4;return function(_0x10f673){logger['error'](_0xe470('0x7'),_0x3ea8a4,_0x293b16,util['inspect'](_0x10f673,{'showHidden':![],'depth':null}));delete _0x10f673[_0xe470('0x8')];_0x5c47f3[_0xe470('0x9')](_0x293b16)['send'](_0x10f673);};}exports[_0xe470('0xa')]=function(_0x32cff9,_0x5bfc89){return info[_0xe470('0xb')]()[_0xe470('0xc')](function(_0x1ea4bc){return _0x5bfc89[_0xe470('0x9')](0xc8)[_0xe470('0xd')](_0x1ea4bc);})[_0xe470('0xe')](function(_0x37af74){return _0x5bfc89['status'](0x1f4)[_0xe470('0xd')](_0x37af74);});};exports[_0xe470('0xf')]=function(_0x214f17,_0x2b2ecb){var _0x2764bc=[_0xe470('0x10')];return new BPromise(function(_0x9748e,_0x581b90){return exec(util[_0xe470('0x11')](_0xe470('0x12'),_0x214f17[_0xe470('0x13')][_0xe470('0x14')]),function(_0x2598e8,_0x348035,_0x245f40){if(_0x2598e8){return _0x581b90(_0x2598e8);}return _0x9748e(_0x348035);});})[_0xe470('0xc')](function(_0x303c05){var _0x50891b=![];var _0x1fd6bc=_0x303c05[_0xe470('0x15')](/\n/);for(var _0x59df88=0x0,_0x39c235=_0x2764bc[_0xe470('0x16')];_0x59df88<_0x39c235,_0x50891b===![];_0x59df88+=0x1){if(_0x303c05['indexOf'](_0x2764bc[_0x59df88])>=0x0){_0x50891b=!![];}}if(!_0x50891b){throw new Error(util[_0xe470('0x11')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x214f17[_0xe470('0x13')][_0xe470('0x14')]));}process[_0xe470('0x17')](_0x214f17[_0xe470('0x13')][_0xe470('0x14')],_0xe470('0x18'));return _0x2b2ecb['status'](0xc8)[_0xe470('0xd')]({'message':util[_0xe470('0x11')](_0xe470('0x19'),_0x214f17['params'][_0xe470('0x14')])});})[_0xe470('0xe')](handleError(_0x2b2ecb,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 7543917..7a89ff9 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 _0x0c19=['isAuthenticated','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x4d682d,_0x5d4a79){var _0x50eeff=function(_0x2aa222){while(--_0x2aa222){_0x4d682d['push'](_0x4d682d['shift']());}};_0x50eeff(++_0x5d4a79);}(_0x0c19,0xf5));var _0x90c1=function(_0x1d60cc,_0x224c79){_0x1d60cc=_0x1d60cc-0x0;var _0x489804=_0x0c19[_0x1d60cc];return _0x489804;};'use strict';var multer=require(_0x90c1('0x0'));var util=require(_0x90c1('0x1'));var path=require(_0x90c1('0x2'));var timeout=require(_0x90c1('0x3'));var express=require(_0x90c1('0x4'));var router=express[_0x90c1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x90c1('0x6'));var interaction=require(_0x90c1('0x7'));var config=require(_0x90c1('0x8'));var controller=require('./tag.controller');router[_0x90c1('0x9')]('/',auth[_0x90c1('0xa')](),controller['index']);router[_0x90c1('0x9')](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller[_0x90c1('0xc')]);router[_0x90c1('0xd')]('/',auth[_0x90c1('0xa')](),controller[_0x90c1('0xe')]);router['put'](_0x90c1('0xb'),auth[_0x90c1('0xa')](),controller['update']);router[_0x90c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x90c1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x05e2=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x251f27,_0x1237bc){var _0x452654=function(_0x38cbf1){while(--_0x38cbf1){_0x251f27['push'](_0x251f27['shift']());}};_0x452654(++_0x1237bc);}(_0x05e2,0x179));var _0x205e=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0x05e2[_0x337748];return _0x3bb03f;};'use strict';var multer=require(_0x205e('0x0'));var util=require(_0x205e('0x1'));var path=require(_0x205e('0x2'));var timeout=require(_0x205e('0x3'));var express=require(_0x205e('0x4'));var router=express[_0x205e('0x5')]();var fs_extra=require(_0x205e('0x6'));var auth=require(_0x205e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x205e('0x8'));var controller=require(_0x205e('0x9'));router[_0x205e('0xa')]('/',auth[_0x205e('0xb')](),controller[_0x205e('0xc')]);router[_0x205e('0xa')](_0x205e('0xd'),auth[_0x205e('0xb')](),controller['show']);router[_0x205e('0xe')]('/',auth[_0x205e('0xb')](),controller[_0x205e('0xf')]);router[_0x205e('0x10')](_0x205e('0xd'),auth[_0x205e('0xb')](),controller[_0x205e('0x11')]);router[_0x205e('0x12')]('/:id',auth[_0x205e('0xb')](),controller[_0x205e('0x13')]);module[_0x205e('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 01e6fb4..da47326 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 _0x8c11=['sequelize','exports','STRING','name','#0091EA'];(function(_0x43747e,_0x13b832){var _0x7fb853=function(_0x4b1028){while(--_0x4b1028){_0x43747e['push'](_0x43747e['shift']());}};_0x7fb853(++_0x13b832);}(_0x8c11,0xf5));var _0x18c1=function(_0x346497,_0x5b109c){_0x346497=_0x346497-0x0;var _0x5b46b8=_0x8c11[_0x346497];return _0x5b46b8;};'use strict';var Sequelize=require(_0x18c1('0x0'));module[_0x18c1('0x1')]={'name':{'type':Sequelize[_0x18c1('0x2')],'unique':_0x18c1('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x18c1('0x2')],'defaultValue':_0x18c1('0x4')},'description':{'type':Sequelize[_0x18c1('0x2')]}}; \ No newline at end of file +var _0xfbac=['STRING','name','#0091EA','exports'];(function(_0x597c49,_0x5acdff){var _0x58b05a=function(_0xee5448){while(--_0xee5448){_0x597c49['push'](_0x597c49['shift']());}};_0x58b05a(++_0x5acdff);}(_0xfbac,0x167));var _0xcfba=function(_0x173a0c,_0x1cabe4){_0x173a0c=_0x173a0c-0x0;var _0x4c5642=_0xfbac[_0x173a0c];return _0x4c5642;};'use strict';var Sequelize=require('sequelize');module[_0xcfba('0x0')]={'name':{'type':Sequelize[_0xcfba('0x1')],'unique':_0xcfba('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xcfba('0x1')],'defaultValue':_0xcfba('0x3')},'description':{'type':Sequelize[_0xcfba('0x1')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index dcf3c6e..d57817e 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 _0xde2c=['send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','save','update','destroy','get','Tags','UserProfileResource','then','error','stack','name'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xde2c,0x7f));var _0xcde2=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0xde2c[_0x2d61b2];return _0x12df89;};'use strict';var emlformat=require(_0xcde2('0x0'));var rimraf=require(_0xcde2('0x1'));var zipdir=require(_0xcde2('0x2'));var jsonpatch=require(_0xcde2('0x3'));var rp=require(_0xcde2('0x4'));var moment=require(_0xcde2('0x5'));var BPromise=require(_0xcde2('0x6'));var Mustache=require(_0xcde2('0x7'));var util=require('util');var path=require(_0xcde2('0x8'));var sox=require(_0xcde2('0x9'));var csv=require(_0xcde2('0xa'));var ejs=require(_0xcde2('0xb'));var fs=require('fs');var fs_extra=require(_0xcde2('0xc'));var _=require('lodash');var squel=require(_0xcde2('0xd'));var crypto=require(_0xcde2('0xe'));var jsforce=require(_0xcde2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcde2('0x10'));var Papa=require(_0xcde2('0x11'));var Redis=require('ioredis');var authService=require(_0xcde2('0x12'));var qs=require(_0xcde2('0x13'));var as=require(_0xcde2('0x14'));var hardwareService=require(_0xcde2('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xcde2('0x16'));var config=require(_0xcde2('0x17'));var licenseUtil=require(_0xcde2('0x18'));var db=require(_0xcde2('0x19'))['db'];function respondWithStatusCode(_0x932b90,_0x1ea4bb){_0x1ea4bb=_0x1ea4bb||0xcc;return function(_0x599294){if(_0x599294){return _0x932b90[_0xcde2('0x1a')](_0x1ea4bb);}return _0x932b90['status'](_0x1ea4bb)[_0xcde2('0x1b')]();};}function respondWithResult(_0x4f0ac9,_0x4b0e0e){_0x4b0e0e=_0x4b0e0e||0xc8;return function(_0x34e079){if(_0x34e079){return _0x4f0ac9[_0xcde2('0x1c')](_0x4b0e0e)[_0xcde2('0x1d')](_0x34e079);}};}function respondWithFilteredResult(_0x19b54b,_0x11665c){return function(_0x5312c7){if(_0x5312c7){var _0x39b023=typeof _0x11665c['offset']===_0xcde2('0x1e')&&typeof _0x11665c[_0xcde2('0x1f')]===_0xcde2('0x1e');var _0x1f1858=_0x5312c7['count'];var _0x4fd5aa=_0x39b023?0x0:_0x11665c['offset'];var _0x2b4468=_0x39b023?_0x5312c7['count']:_0x11665c[_0xcde2('0x20')]+_0x11665c[_0xcde2('0x1f')];var _0x252372;if(_0x2b4468>=_0x1f1858){_0x2b4468=_0x1f1858;_0x252372=0xc8;}else{_0x252372=0xce;}_0x19b54b['status'](_0x252372);return _0x19b54b[_0xcde2('0x21')](_0xcde2('0x22'),_0x4fd5aa+'-'+_0x2b4468+'/'+_0x1f1858)[_0xcde2('0x1d')](_0x5312c7);}return null;};}function patchUpdates(_0x3c1d7e){return function(_0x43df7a){try{jsonpatch['apply'](_0x43df7a,_0x3c1d7e,!![]);}catch(_0x4bce90){return BPromise['reject'](_0x4bce90);}return _0x43df7a[_0xcde2('0x23')]();};}function saveUpdates(_0x3e5170,_0x2c9562){return function(_0x4063d4){if(_0x4063d4){return _0x4063d4[_0xcde2('0x24')](_0x3e5170)['then'](function(_0x1104b8){return _0x1104b8;});}return null;};}function removeEntity(_0x52368b,_0x280d8c){return function(_0xb2123c){if(_0xb2123c){return _0xb2123c[_0xcde2('0x25')]()['then'](function(){var _0x593aa4=_0xb2123c[_0xcde2('0x26')]({'plain':!![]});var _0x207a12=_0xcde2('0x27');return db[_0xcde2('0x28')][_0xcde2('0x25')]({'where':{'type':_0x207a12,'resourceId':_0x593aa4['id']}})['then'](function(){return _0xb2123c;});})[_0xcde2('0x29')](function(){_0x52368b[_0xcde2('0x1c')](0xcc)[_0xcde2('0x1b')]();});}};}function handleEntityNotFound(_0x513965,_0x2487eb){return function(_0x348ca1){if(!_0x348ca1){_0x513965[_0xcde2('0x1a')](0x194);}return _0x348ca1;};}function handleError(_0x40309d,_0xd7019){_0xd7019=_0xd7019||0x1f4;return function(_0x5b2b7){logger[_0xcde2('0x2a')](_0x5b2b7[_0xcde2('0x2b')]);if(_0x5b2b7['name']){delete _0x5b2b7[_0xcde2('0x2c')];}_0x40309d['status'](_0xd7019)[_0xcde2('0x2d')](_0x5b2b7);};}exports[_0xcde2('0x2e')]=function(_0x43706c,_0x49cb58){var _0xae46dc={},_0x28fedd={},_0x58afb1={'count':0x0,'rows':[]};var _0x26ec42=_[_0xcde2('0x2f')](db[_0xcde2('0x30')][_0xcde2('0x31')],function(_0x14f784){return{'name':_0x14f784[_0xcde2('0x32')],'type':_0x14f784[_0xcde2('0x33')][_0xcde2('0x34')]};});_0x28fedd['model']=_[_0xcde2('0x2f')](_0x26ec42,_0xcde2('0x2c'));_0x28fedd[_0xcde2('0x35')]=_[_0xcde2('0x36')](_0x43706c['query']);_0x28fedd[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],_0x28fedd[_0xcde2('0x35')]);_0xae46dc['attributes']=_[_0xcde2('0x38')](_0x28fedd[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x43706c[_0xcde2('0x35')]['fields']));_0xae46dc[_0xcde2('0x3b')]=_0xae46dc[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0xae46dc[_0xcde2('0x3b')]:_0x28fedd[_0xcde2('0x39')];if(!_0x43706c['query'][_0xcde2('0x3d')](_0xcde2('0x3e'))){_0xae46dc[_0xcde2('0x1f')]=qs[_0xcde2('0x1f')](_0x43706c['query']['limit']);_0xae46dc[_0xcde2('0x20')]=qs[_0xcde2('0x20')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x20')]);}_0xae46dc[_0xcde2('0x3f')]=qs[_0xcde2('0x40')](_0x43706c[_0xcde2('0x35')][_0xcde2('0x40')]);_0xae46dc[_0xcde2('0x41')]=qs['filters'](_[_0xcde2('0x42')](_0x43706c[_0xcde2('0x35')],_0x28fedd[_0xcde2('0x37')]),_0x26ec42);if(_0x43706c[_0xcde2('0x35')][_0xcde2('0x43')]){_0xae46dc['where']=_['merge'](_0xae46dc[_0xcde2('0x41')],{'$or':_[_0xcde2('0x2f')](_0x26ec42,function(_0x20dfad){if(_0x20dfad[_0xcde2('0x33')]!==_0xcde2('0x44')){var _0x1939a0={};_0x1939a0[_0x20dfad['name']]={'$like':'%'+_0x43706c['query']['filter']+'%'};return _0x1939a0;}})});}_0xae46dc=_[_0xcde2('0x45')]({},_0xae46dc,_0x43706c[_0xcde2('0x46')]);var _0x1cfe20={'where':_0xae46dc[_0xcde2('0x41')]};return db[_0xcde2('0x30')][_0xcde2('0x47')](_0x1cfe20)[_0xcde2('0x29')](function(_0x49b862){_0x58afb1['count']=_0x49b862;if(_0x43706c[_0xcde2('0x35')]['includeAll']){_0xae46dc[_0xcde2('0x48')]=[{'all':!![]}];}return db['Tag'][_0xcde2('0x49')](_0xae46dc);})[_0xcde2('0x29')](function(_0x2cf372){_0x58afb1['rows']=_0x2cf372;return _0x58afb1;})[_0xcde2('0x29')](respondWithFilteredResult(_0x49cb58,_0xae46dc))['catch'](handleError(_0x49cb58,null));};exports[_0xcde2('0x4a')]=function(_0x24a46a,_0x1e661f){var _0x79e073={'raw':!![],'where':{'id':_0x24a46a[_0xcde2('0x4b')]['id']}},_0xcafd7={};_0xcafd7['model']=_['keys'](db[_0xcde2('0x30')]['rawAttributes']);_0xcafd7['query']=_[_0xcde2('0x36')](_0x24a46a['query']);_0xcafd7[_0xcde2('0x37')]=_[_0xcde2('0x38')](_0xcafd7['model'],_0xcafd7[_0xcde2('0x35')]);_0x79e073['attributes']=_['intersection'](_0xcafd7[_0xcde2('0x39')],qs[_0xcde2('0x3a')](_0x24a46a['query'][_0xcde2('0x3a')]));_0x79e073['attributes']=_0x79e073[_0xcde2('0x3b')][_0xcde2('0x3c')]?_0x79e073[_0xcde2('0x3b')]:_0xcafd7[_0xcde2('0x39')];if(_0x24a46a[_0xcde2('0x35')]['includeAll']){_0x79e073[_0xcde2('0x48')]=[{'all':!![]}];}_0x79e073=_[_0xcde2('0x45')]({},_0x79e073,_0x24a46a[_0xcde2('0x46')]);return db[_0xcde2('0x30')]['find'](_0x79e073)['then'](handleEntityNotFound(_0x1e661f,null))[_0xcde2('0x29')](respondWithResult(_0x1e661f,null))['catch'](handleError(_0x1e661f,null));};exports[_0xcde2('0x4c')]=function(_0x3e9e79,_0x381bd4){return db[_0xcde2('0x30')][_0xcde2('0x4c')](_0x3e9e79[_0xcde2('0x4d')],{})['then'](function(_0x1ce5fe){var _0x5b996d=_0x3e9e79[_0xcde2('0x4e')]['get']({'plain':!![]});if(!_0x5b996d)throw new Error(_0xcde2('0x4f'));if(_0x5b996d[_0xcde2('0x50')]===_0xcde2('0x4e')){var _0x16cddb=_0x1ce5fe[_0xcde2('0x26')]({'plain':!![]});var _0x5071ce='Tags';return db[_0xcde2('0x51')]['find']({'where':{'name':_0x5071ce,'userProfileId':_0x5b996d[_0xcde2('0x52')]},'raw':!![]})[_0xcde2('0x29')](function(_0x3d2ce7){if(_0x3d2ce7&&_0x3d2ce7[_0xcde2('0x53')]===0x0){return db[_0xcde2('0x28')][_0xcde2('0x4c')]({'name':_0x16cddb[_0xcde2('0x2c')],'resourceId':_0x16cddb['id'],'type':_0x3d2ce7[_0xcde2('0x2c')],'sectionId':_0x3d2ce7['id']},{})[_0xcde2('0x29')](function(){return _0x1ce5fe;});}else{return _0x1ce5fe;}})[_0xcde2('0x54')](function(_0x3c5a17){logger[_0xcde2('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c5a17);throw _0x3c5a17;});}return _0x1ce5fe;})['then'](respondWithResult(_0x381bd4,0xc9))['catch'](handleError(_0x381bd4,null));};exports[_0xcde2('0x24')]=function(_0x59a64d,_0x1751dd){if(_0x59a64d[_0xcde2('0x4d')]['id']){delete _0x59a64d[_0xcde2('0x4d')]['id'];}return db['Tag'][_0xcde2('0x55')]({'where':{'id':_0x59a64d['params']['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x1751dd,null))['then'](saveUpdates(_0x59a64d[_0xcde2('0x4d')],null))[_0xcde2('0x29')](respondWithResult(_0x1751dd,null))['catch'](handleError(_0x1751dd,null));};exports[_0xcde2('0x25')]=function(_0x4dfabb,_0x5e6fd3){return db[_0xcde2('0x30')][_0xcde2('0x55')]({'where':{'id':_0x4dfabb[_0xcde2('0x4b')]['id']}})[_0xcde2('0x29')](handleEntityNotFound(_0x5e6fd3,null))[_0xcde2('0x29')](removeEntity(_0x5e6fd3,null))[_0xcde2('0x54')](handleError(_0x5e6fd3,null));}; \ No newline at end of file +var _0x2750=['sendStatus','status','end','json','undefined','limit','count','offset','set','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','send','map','Tag','fieldName','type','key','query','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','length','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x58680a,_0x67f9b9){var _0x9f2184=function(_0x290a7b){while(--_0x290a7b){_0x58680a['push'](_0x58680a['shift']());}};_0x9f2184(++_0x67f9b9);}(_0x2750,0x13b));var _0x0275=function(_0x8ad787,_0x512719){_0x8ad787=_0x8ad787-0x0;var _0x23af19=_0x2750[_0x8ad787];return _0x23af19;};'use strict';var emlformat=require(_0x0275('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0275('0x1'));var jsonpatch=require(_0x0275('0x2'));var rp=require(_0x0275('0x3'));var moment=require(_0x0275('0x4'));var BPromise=require(_0x0275('0x5'));var Mustache=require(_0x0275('0x6'));var util=require(_0x0275('0x7'));var path=require(_0x0275('0x8'));var sox=require(_0x0275('0x9'));var csv=require(_0x0275('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0275('0xb'));var _=require(_0x0275('0xc'));var squel=require(_0x0275('0xd'));var crypto=require(_0x0275('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x0275('0xf'));var toCsv=require(_0x0275('0xa'));var querystring=require(_0x0275('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0275('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0275('0x12'));var hardwareService=require(_0x0275('0x13'));var logger=require(_0x0275('0x14'))(_0x0275('0x15'));var utils=require(_0x0275('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0275('0x17'));var db=require(_0x0275('0x18'))['db'];function respondWithStatusCode(_0x1f128d,_0x4c6ee0){_0x4c6ee0=_0x4c6ee0||0xcc;return function(_0x55ffd6){if(_0x55ffd6){return _0x1f128d[_0x0275('0x19')](_0x4c6ee0);}return _0x1f128d[_0x0275('0x1a')](_0x4c6ee0)[_0x0275('0x1b')]();};}function respondWithResult(_0x46a729,_0x28827b){_0x28827b=_0x28827b||0xc8;return function(_0x36921c){if(_0x36921c){return _0x46a729['status'](_0x28827b)[_0x0275('0x1c')](_0x36921c);}};}function respondWithFilteredResult(_0x3030c0,_0x4aa412){return function(_0x6344fc){if(_0x6344fc){var _0xaae367=typeof _0x4aa412['offset']===_0x0275('0x1d')&&typeof _0x4aa412[_0x0275('0x1e')]==='undefined';var _0x5e7466=_0x6344fc['count'];var _0x591d27=_0xaae367?0x0:_0x4aa412['offset'];var _0x566ad6=_0xaae367?_0x6344fc[_0x0275('0x1f')]:_0x4aa412[_0x0275('0x20')]+_0x4aa412['limit'];var _0x7075c9;if(_0x566ad6>=_0x5e7466){_0x566ad6=_0x5e7466;_0x7075c9=0xc8;}else{_0x7075c9=0xce;}_0x3030c0[_0x0275('0x1a')](_0x7075c9);return _0x3030c0[_0x0275('0x21')]('Content-Range',_0x591d27+'-'+_0x566ad6+'/'+_0x5e7466)[_0x0275('0x1c')](_0x6344fc);}return null;};}function patchUpdates(_0x402f0d){return function(_0x575786){try{jsonpatch['apply'](_0x575786,_0x402f0d,!![]);}catch(_0x31ba9e){return BPromise[_0x0275('0x22')](_0x31ba9e);}return _0x575786[_0x0275('0x23')]();};}function saveUpdates(_0x592a53,_0xf3b68e){return function(_0x5ab9e7){if(_0x5ab9e7){return _0x5ab9e7[_0x0275('0x24')](_0x592a53)['then'](function(_0x26f2c2){return _0x26f2c2;});}return null;};}function removeEntity(_0xfa0081,_0x594321){return function(_0x140a18){if(_0x140a18){return _0x140a18[_0x0275('0x25')]()[_0x0275('0x26')](function(){var _0x52946b=_0x140a18[_0x0275('0x27')]({'plain':!![]});var _0x44bbf8=_0x0275('0x28');return db[_0x0275('0x29')][_0x0275('0x25')]({'where':{'type':_0x44bbf8,'resourceId':_0x52946b['id']}})[_0x0275('0x26')](function(){return _0x140a18;});})['then'](function(){_0xfa0081[_0x0275('0x1a')](0xcc)[_0x0275('0x1b')]();});}};}function handleEntityNotFound(_0x1d24b2,_0x275dac){return function(_0x4689a3){if(!_0x4689a3){_0x1d24b2['sendStatus'](0x194);}return _0x4689a3;};}function handleError(_0x1ffd57,_0xd59d69){_0xd59d69=_0xd59d69||0x1f4;return function(_0x3246ea){logger[_0x0275('0x2a')](_0x3246ea[_0x0275('0x2b')]);if(_0x3246ea['name']){delete _0x3246ea[_0x0275('0x2c')];}_0x1ffd57[_0x0275('0x1a')](_0xd59d69)[_0x0275('0x2d')](_0x3246ea);};}exports['index']=function(_0x5e2e22,_0x3cb2d7){var _0x299190={},_0x5dc2bc={},_0x7eff96={'count':0x0,'rows':[]};var _0x155a50=_[_0x0275('0x2e')](db[_0x0275('0x2f')]['rawAttributes'],function(_0x24c762){return{'name':_0x24c762[_0x0275('0x30')],'type':_0x24c762[_0x0275('0x31')][_0x0275('0x32')]};});_0x5dc2bc['model']=_[_0x0275('0x2e')](_0x155a50,'name');_0x5dc2bc[_0x0275('0x33')]=_['keys'](_0x5e2e22[_0x0275('0x33')]);_0x5dc2bc[_0x0275('0x34')]=_['intersection'](_0x5dc2bc[_0x0275('0x35')],_0x5dc2bc[_0x0275('0x33')]);_0x299190[_0x0275('0x36')]=_[_0x0275('0x37')](_0x5dc2bc['model'],qs[_0x0275('0x38')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x38')]));_0x299190[_0x0275('0x36')]=_0x299190[_0x0275('0x36')]['length']?_0x299190[_0x0275('0x36')]:_0x5dc2bc[_0x0275('0x35')];if(!_0x5e2e22[_0x0275('0x33')][_0x0275('0x39')](_0x0275('0x3a'))){_0x299190[_0x0275('0x1e')]=qs[_0x0275('0x1e')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x1e')]);_0x299190[_0x0275('0x20')]=qs[_0x0275('0x20')](_0x5e2e22['query'][_0x0275('0x20')]);}_0x299190[_0x0275('0x3b')]=qs[_0x0275('0x3c')](_0x5e2e22[_0x0275('0x33')][_0x0275('0x3c')]);_0x299190[_0x0275('0x3d')]=qs[_0x0275('0x34')](_[_0x0275('0x3e')](_0x5e2e22[_0x0275('0x33')],_0x5dc2bc[_0x0275('0x34')]),_0x155a50);if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]){_0x299190[_0x0275('0x3d')]=_[_0x0275('0x40')](_0x299190['where'],{'$or':_[_0x0275('0x2e')](_0x155a50,function(_0x1cc40d){if(_0x1cc40d['type']!==_0x0275('0x41')){var _0x76b8fa={};_0x76b8fa[_0x1cc40d[_0x0275('0x2c')]]={'$like':'%'+_0x5e2e22[_0x0275('0x33')][_0x0275('0x3f')]+'%'};return _0x76b8fa;}})});}_0x299190=_[_0x0275('0x40')]({},_0x299190,_0x5e2e22[_0x0275('0x42')]);var _0x5e57b5={'where':_0x299190[_0x0275('0x3d')]};return db[_0x0275('0x2f')][_0x0275('0x1f')](_0x5e57b5)[_0x0275('0x26')](function(_0x4f888c){_0x7eff96[_0x0275('0x1f')]=_0x4f888c;if(_0x5e2e22[_0x0275('0x33')][_0x0275('0x43')]){_0x299190[_0x0275('0x44')]=[{'all':!![]}];}return db['Tag'][_0x0275('0x45')](_0x299190);})['then'](function(_0x261e66){_0x7eff96[_0x0275('0x46')]=_0x261e66;return _0x7eff96;})[_0x0275('0x26')](respondWithFilteredResult(_0x3cb2d7,_0x299190))[_0x0275('0x47')](handleError(_0x3cb2d7,null));};exports['show']=function(_0x13c651,_0x3d1bfc){var _0x59839d={'raw':!![],'where':{'id':_0x13c651[_0x0275('0x48')]['id']}},_0x1e143e={};_0x1e143e[_0x0275('0x35')]=_['keys'](db[_0x0275('0x2f')][_0x0275('0x49')]);_0x1e143e['query']=_[_0x0275('0x4a')](_0x13c651[_0x0275('0x33')]);_0x1e143e[_0x0275('0x34')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],_0x1e143e[_0x0275('0x33')]);_0x59839d[_0x0275('0x36')]=_[_0x0275('0x37')](_0x1e143e[_0x0275('0x35')],qs[_0x0275('0x38')](_0x13c651[_0x0275('0x33')]['fields']));_0x59839d[_0x0275('0x36')]=_0x59839d[_0x0275('0x36')][_0x0275('0x4b')]?_0x59839d[_0x0275('0x36')]:_0x1e143e[_0x0275('0x35')];if(_0x13c651[_0x0275('0x33')][_0x0275('0x43')]){_0x59839d[_0x0275('0x44')]=[{'all':!![]}];}_0x59839d=_[_0x0275('0x40')]({},_0x59839d,_0x13c651[_0x0275('0x42')]);return db[_0x0275('0x2f')]['find'](_0x59839d)['then'](handleEntityNotFound(_0x3d1bfc,null))[_0x0275('0x26')](respondWithResult(_0x3d1bfc,null))[_0x0275('0x47')](handleError(_0x3d1bfc,null));};exports[_0x0275('0x4c')]=function(_0x3bd019,_0x310c6b){return db['Tag'][_0x0275('0x4c')](_0x3bd019['body'],{})[_0x0275('0x26')](function(_0x17dde0){var _0x27a469=_0x3bd019[_0x0275('0x4d')]['get']({'plain':!![]});if(!_0x27a469)throw new Error(_0x0275('0x4e'));if(_0x27a469['role']==='user'){var _0x515860=_0x17dde0[_0x0275('0x27')]({'plain':!![]});var _0x4e36fc=_0x0275('0x28');return db[_0x0275('0x4f')][_0x0275('0x50')]({'where':{'name':_0x4e36fc,'userProfileId':_0x27a469[_0x0275('0x51')]},'raw':!![]})[_0x0275('0x26')](function(_0x11794b){if(_0x11794b&&_0x11794b[_0x0275('0x52')]===0x0){return db['UserProfileResource'][_0x0275('0x4c')]({'name':_0x515860['name'],'resourceId':_0x515860['id'],'type':_0x11794b[_0x0275('0x2c')],'sectionId':_0x11794b['id']},{})[_0x0275('0x26')](function(){return _0x17dde0;});}else{return _0x17dde0;}})[_0x0275('0x47')](function(_0x1686d9){logger[_0x0275('0x2a')](_0x0275('0x53'),_0x1686d9);throw _0x1686d9;});}return _0x17dde0;})[_0x0275('0x26')](respondWithResult(_0x310c6b,0xc9))[_0x0275('0x47')](handleError(_0x310c6b,null));};exports[_0x0275('0x24')]=function(_0x3673ad,_0x545333){if(_0x3673ad['body']['id']){delete _0x3673ad[_0x0275('0x54')]['id'];}return db['Tag']['find']({'where':{'id':_0x3673ad[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x545333,null))[_0x0275('0x26')](saveUpdates(_0x3673ad[_0x0275('0x54')],null))[_0x0275('0x26')](respondWithResult(_0x545333,null))[_0x0275('0x47')](handleError(_0x545333,null));};exports['destroy']=function(_0x104232,_0x163ce2){return db[_0x0275('0x2f')][_0x0275('0x50')]({'where':{'id':_0x104232[_0x0275('0x48')]['id']}})[_0x0275('0x26')](handleEntityNotFound(_0x163ce2,null))['then'](removeEntity(_0x163ce2,null))[_0x0275('0x47')](handleError(_0x163ce2,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 103abcd..42cb848 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 _0xa0ef=['tools_tags','lodash','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag'];(function(_0xfdc98e,_0x3f3e0e){var _0x5b0307=function(_0x281147){while(--_0x281147){_0xfdc98e['push'](_0xfdc98e['shift']());}};_0x5b0307(++_0x3f3e0e);}(_0xa0ef,0xb1));var _0xfa0e=function(_0x2b698c,_0x5bbdd5){_0x2b698c=_0x2b698c-0x0;var _0x535317=_0xa0ef[_0x2b698c];return _0x535317;};'use strict';var _=require(_0xfa0e('0x0'));var util=require('util');var logger=require(_0xfa0e('0x1'))(_0xfa0e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xfa0e('0x3'));var fs=require('fs');var path=require(_0xfa0e('0x4'));var rimraf=require(_0xfa0e('0x5'));var config=require(_0xfa0e('0x6'));var attributes=require(_0xfa0e('0x7'));module[_0xfa0e('0x8')]=function(_0x2715f5,_0xa87618){return _0x2715f5['define'](_0xfa0e('0x9'),attributes,{'tableName':_0xfa0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d43=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./tag.attributes','exports','define','Tag','tools_tags'];(function(_0x13c1e9,_0x1198f4){var _0x21c7b1=function(_0x260ab4){while(--_0x260ab4){_0x13c1e9['push'](_0x13c1e9['shift']());}};_0x21c7b1(++_0x1198f4);}(_0x7d43,0x12c));var _0x37d4=function(_0x23521f,_0x661e98){_0x23521f=_0x23521f-0x0;var _0x3db7ff=_0x7d43[_0x23521f];return _0x3db7ff;};'use strict';var _=require(_0x37d4('0x0'));var util=require('util');var logger=require(_0x37d4('0x1'))(_0x37d4('0x2'));var moment=require('moment');var BPromise=require(_0x37d4('0x3'));var rp=require(_0x37d4('0x4'));var fs=require('fs');var path=require(_0x37d4('0x5'));var rimraf=require(_0x37d4('0x6'));var config=require('../../config/environment');var attributes=require(_0x37d4('0x7'));module[_0x37d4('0x8')]=function(_0x16cc17,_0x32762e){return _0x16cc17[_0x37d4('0x9')](_0x37d4('0xa'),attributes,{'tableName':_0x37d4('0xb'),'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 8ed2e51..7bd68f1 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 _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x536170,_0x25b0f1){var _0x189f99=function(_0x4170fe){while(--_0x4170fe){_0x536170['push'](_0x536170['shift']());}};_0x189f99(++_0x25b0f1);}(_0x579c,0xda));var _0xc579=function(_0x2b9a0a,_0x2abbd4){_0x2b9a0a=_0x2b9a0a-0x0;var _0x1658e6=_0x579c[_0x2b9a0a];return _0x1658e6;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file +var _0xf9f7=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x38075c,_0x5a8758){var _0x1e48d8=function(_0x1088ec){while(--_0x1088ec){_0x38075c['push'](_0x38075c['shift']());}};_0x1e48d8(++_0x5a8758);}(_0xf9f7,0xdf));var _0x7f9f=function(_0x2126c7,_0x5cd37f){_0x2126c7=_0x2126c7-0x0;var _0x2d91f4=_0xf9f7[_0x2126c7];return _0x2d91f4;};'use strict';var _=require(_0x7f9f('0x0'));var util=require(_0x7f9f('0x1'));var moment=require(_0x7f9f('0x2'));var BPromise=require(_0x7f9f('0x3'));var rs=require(_0x7f9f('0x4'));var fs=require('fs');var Redis=require(_0x7f9f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7f9f('0x6'))(_0x7f9f('0x7'));var config=require(_0x7f9f('0x8'));var jayson=require(_0x7f9f('0x9'));var client=jayson[_0x7f9f('0xa')][_0x7f9f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b5819,_0x37e39f,_0x3da87e){return new BPromise(function(_0x181328,_0x3e9e75){return client[_0x7f9f('0xc')](_0x5b5819,_0x3da87e)['then'](function(_0x3fda85){logger[_0x7f9f('0xd')](_0x7f9f('0xe'),_0x37e39f,_0x7f9f('0xf'));logger[_0x7f9f('0x10')](_0x7f9f('0x11'),_0x37e39f,_0x7f9f('0xf'),JSON['stringify'](_0x3fda85));if(_0x3fda85[_0x7f9f('0x12')]){if(_0x3fda85[_0x7f9f('0x12')]['code']===0x1f4){logger['error'](_0x7f9f('0xe'),_0x37e39f,_0x3fda85['error'][_0x7f9f('0x13')]);return _0x3e9e75(_0x3fda85[_0x7f9f('0x12')]['message']);}logger[_0x7f9f('0x12')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);return _0x181328(_0x3fda85[_0x7f9f('0x12')][_0x7f9f('0x13')]);}else{logger[_0x7f9f('0xd')]('Tag,\x20%s,\x20%s',_0x37e39f,_0x7f9f('0xf'));_0x181328(_0x3fda85[_0x7f9f('0x14')]['message']);}})[_0x7f9f('0x15')](function(_0x4a36c8){logger[_0x7f9f('0x12')](_0x7f9f('0xe'),_0x37e39f,_0x4a36c8);_0x3e9e75(_0x4a36c8);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ad8dc63..320583c 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(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 cb0e91a..a5e55bd 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(_0x516c4e,_0x31fc1f){var _0x485d1b=function(_0x41b288){while(--_0x41b288){_0x516c4e['push'](_0x516c4e['shift']());}};_0x485d1b(++_0x31fc1f);}(_0x757a,0xde));var _0xa757=function(_0x3d28f6,_0x2c86dc){_0x3d28f6=_0x3d28f6-0x0;var _0x200a5d=_0x757a[_0x3d28f6];return _0x200a5d;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x757a=['exports','STRING'];(function(_0x778865,_0x29794a){var _0xa2a374=function(_0x21d517){while(--_0x21d517){_0x778865['push'](_0x778865['shift']());}};_0xa2a374(++_0x29794a);}(_0x757a,0xde));var _0xa757=function(_0x2570da,_0x2d90fd){_0x2570da=_0x2570da-0x0;var _0x29bed1=_0x757a[_0x2570da];return _0x29bed1;};'use strict';var Sequelize=require('sequelize');module[_0xa757('0x0')]={'name':{'type':Sequelize[_0xa757('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 76c76db..934771c 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 _0x1f1e=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','end','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','pick','Queues','addQueues','add','ids','removeQueues','addAgents','Voice','Chat','Mail','Sms','Fax','Whatsapp','through','penalty','defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','QueueId','User','findAll','online','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','VoicePrefixId','spread','removeAgents','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','undefined','offset','count','limit','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1f1e,0x17e));var _0xe1f1=function(_0x4c38f9,_0x45f174){_0x4c38f9=_0x4c38f9-0x0;var _0x4d3b0d=_0x1f1e[_0x4c38f9];return _0x4d3b0d;};'use strict';var emlformat=require(_0xe1f1('0x0'));var rimraf=require(_0xe1f1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1f1('0x2'));var rp=require(_0xe1f1('0x3'));var moment=require(_0xe1f1('0x4'));var BPromise=require(_0xe1f1('0x5'));var Mustache=require(_0xe1f1('0x6'));var util=require(_0xe1f1('0x7'));var path=require('path');var sox=require(_0xe1f1('0x8'));var csv=require(_0xe1f1('0x9'));var ejs=require(_0xe1f1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe1f1('0xb'));var squel=require(_0xe1f1('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe1f1('0x9'));var querystring=require(_0xe1f1('0xd'));var Papa=require(_0xe1f1('0xe'));var Redis=require(_0xe1f1('0xf'));var authService=require(_0xe1f1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe1f1('0x11'));var hardwareService=require(_0xe1f1('0x12'));var logger=require(_0xe1f1('0x13'))(_0xe1f1('0x14'));var utils=require(_0xe1f1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe1f1('0x16'))['db'];config[_0xe1f1('0x17')]=_['defaults'](config['redis'],{'host':_0xe1f1('0x18'),'port':0x18eb});var socket=require(_0xe1f1('0x19'))(new Redis(config['redis']));require(_0xe1f1('0x1a'))[_0xe1f1('0x1b')](socket);function respondWithStatusCode(_0x54aae5,_0x56f8d1){_0x56f8d1=_0x56f8d1||0xcc;return function(_0x262ca7){if(_0x262ca7){return _0x54aae5[_0xe1f1('0x1c')](_0x56f8d1);}return _0x54aae5['status'](_0x56f8d1)['end']();};}function respondWithResult(_0x487c85,_0x36c3d5){_0x36c3d5=_0x36c3d5||0xc8;return function(_0x5b0287){if(_0x5b0287){return _0x487c85[_0xe1f1('0x1d')](_0x36c3d5)['json'](_0x5b0287);}};}function respondWithFilteredResult(_0x5830f0,_0x4bb249){return function(_0x52af5b){if(_0x52af5b){var _0x59417f=typeof _0x4bb249['offset']==='undefined'&&typeof _0x4bb249['limit']===_0xe1f1('0x1e');var _0x1d2fec=_0x52af5b['count'];var _0x1ccfa5=_0x59417f?0x0:_0x4bb249[_0xe1f1('0x1f')];var _0x569c8f=_0x59417f?_0x52af5b[_0xe1f1('0x20')]:_0x4bb249['offset']+_0x4bb249[_0xe1f1('0x21')];var _0x5b05d4;if(_0x569c8f>=_0x1d2fec){_0x569c8f=_0x1d2fec;_0x5b05d4=0xc8;}else{_0x5b05d4=0xce;}_0x5830f0[_0xe1f1('0x1d')](_0x5b05d4);return _0x5830f0[_0xe1f1('0x22')](_0xe1f1('0x23'),_0x1ccfa5+'-'+_0x569c8f+'/'+_0x1d2fec)[_0xe1f1('0x24')](_0x52af5b);}return null;};}function patchUpdates(_0x179c73){return function(_0x5bac1e){try{jsonpatch[_0xe1f1('0x25')](_0x5bac1e,_0x179c73,!![]);}catch(_0x625460){return BPromise[_0xe1f1('0x26')](_0x625460);}return _0x5bac1e[_0xe1f1('0x27')]();};}function saveUpdates(_0x2f04a5,_0xca79a0){return function(_0x1f211b){if(_0x1f211b){return _0x1f211b[_0xe1f1('0x28')](_0x2f04a5)[_0xe1f1('0x29')](function(_0x47ae74){return _0x47ae74;});}return null;};}function handleEntityNotFound(_0x5b1d54,_0x362be7){return function(_0x5a259f){if(!_0x5a259f){_0x5b1d54[_0xe1f1('0x1c')](0x194);}return _0x5a259f;};}function handleError(_0x3d844b,_0xfec52e){_0xfec52e=_0xfec52e||0x1f4;return function(_0x557cb8){logger[_0xe1f1('0x2a')](_0x557cb8[_0xe1f1('0x2b')]);if(_0x557cb8[_0xe1f1('0x2c')]){delete _0x557cb8[_0xe1f1('0x2c')];}_0x3d844b[_0xe1f1('0x1d')](_0xfec52e)[_0xe1f1('0x2d')](_0x557cb8);};}exports[_0xe1f1('0x2e')]=function(_0x48f50c,_0x6cc233){var _0x58619e={},_0x1ed18f={},_0xf0be07={'count':0x0,'rows':[]};var _0x58cca7=_[_0xe1f1('0x2f')](db[_0xe1f1('0x30')][_0xe1f1('0x31')],function(_0x188c95){return{'name':_0x188c95[_0xe1f1('0x32')],'type':_0x188c95['type']['key']};});_0x1ed18f[_0xe1f1('0x33')]=_[_0xe1f1('0x2f')](_0x58cca7,'name');_0x1ed18f[_0xe1f1('0x34')]=_[_0xe1f1('0x35')](_0x48f50c[_0xe1f1('0x34')]);_0x1ed18f['filters']=_['intersection'](_0x1ed18f[_0xe1f1('0x33')],_0x1ed18f[_0xe1f1('0x34')]);_0x58619e[_0xe1f1('0x36')]=_[_0xe1f1('0x37')](_0x1ed18f[_0xe1f1('0x33')],qs[_0xe1f1('0x38')](_0x48f50c['query'][_0xe1f1('0x38')]));_0x58619e[_0xe1f1('0x36')]=_0x58619e[_0xe1f1('0x36')][_0xe1f1('0x39')]?_0x58619e[_0xe1f1('0x36')]:_0x1ed18f['model'];if(!_0x48f50c[_0xe1f1('0x34')][_0xe1f1('0x3a')](_0xe1f1('0x3b'))){_0x58619e[_0xe1f1('0x21')]=qs[_0xe1f1('0x21')](_0x48f50c['query'][_0xe1f1('0x21')]);_0x58619e[_0xe1f1('0x1f')]=qs[_0xe1f1('0x1f')](_0x48f50c['query'][_0xe1f1('0x1f')]);}_0x58619e[_0xe1f1('0x3c')]=qs[_0xe1f1('0x3d')](_0x48f50c[_0xe1f1('0x34')]['sort']);_0x58619e[_0xe1f1('0x3e')]=qs[_0xe1f1('0x3f')](_['pick'](_0x48f50c[_0xe1f1('0x34')],_0x1ed18f[_0xe1f1('0x3f')]),_0x58cca7);if(_0x48f50c[_0xe1f1('0x34')][_0xe1f1('0x40')]){_0x58619e['where']=_[_0xe1f1('0x41')](_0x58619e[_0xe1f1('0x3e')],{'$or':_[_0xe1f1('0x2f')](_0x58cca7,function(_0xa2c6a7){if(_0xa2c6a7['type']!==_0xe1f1('0x42')){var _0x45acfc={};_0x45acfc[_0xa2c6a7[_0xe1f1('0x2c')]]={'$like':'%'+_0x48f50c[_0xe1f1('0x34')][_0xe1f1('0x40')]+'%'};return _0x45acfc;}})});}_0x58619e=_[_0xe1f1('0x41')]({},_0x58619e,_0x48f50c[_0xe1f1('0x43')]);var _0x99e520={'where':_0x58619e[_0xe1f1('0x3e')]};return db[_0xe1f1('0x30')][_0xe1f1('0x20')](_0x99e520)['then'](function(_0x3f23ec){_0xf0be07[_0xe1f1('0x20')]=_0x3f23ec;if(_0x48f50c[_0xe1f1('0x34')][_0xe1f1('0x44')]){_0x58619e[_0xe1f1('0x45')]=[{'all':!![]}];}return db[_0xe1f1('0x30')]['findAll'](_0x58619e);})[_0xe1f1('0x29')](function(_0x4edc1d){_0xf0be07[_0xe1f1('0x46')]=_0x4edc1d;return _0xf0be07;})['then'](respondWithFilteredResult(_0x6cc233,_0x58619e))['catch'](handleError(_0x6cc233,null));};exports[_0xe1f1('0x47')]=function(_0x26d6dc,_0x4f7483){var _0x1703da={'raw':![],'where':{'id':_0x26d6dc[_0xe1f1('0x48')]['id']}},_0x21b6af={};_0x21b6af[_0xe1f1('0x33')]=_[_0xe1f1('0x35')](db[_0xe1f1('0x30')][_0xe1f1('0x31')]);_0x21b6af['query']=_[_0xe1f1('0x35')](_0x26d6dc[_0xe1f1('0x34')]);_0x21b6af[_0xe1f1('0x3f')]=_[_0xe1f1('0x37')](_0x21b6af[_0xe1f1('0x33')],_0x21b6af[_0xe1f1('0x34')]);_0x1703da[_0xe1f1('0x36')]=_['intersection'](_0x21b6af[_0xe1f1('0x33')],qs[_0xe1f1('0x38')](_0x26d6dc[_0xe1f1('0x34')][_0xe1f1('0x38')]));_0x1703da[_0xe1f1('0x36')]=_0x1703da[_0xe1f1('0x36')][_0xe1f1('0x39')]?_0x1703da[_0xe1f1('0x36')]:_0x21b6af[_0xe1f1('0x33')];if(_0x26d6dc['query'][_0xe1f1('0x44')]){_0x1703da[_0xe1f1('0x45')]=[{'all':!![]}];}_0x1703da=_[_0xe1f1('0x41')]({},_0x1703da,_0x26d6dc[_0xe1f1('0x43')]);return db[_0xe1f1('0x30')][_0xe1f1('0x49')](_0x1703da)[_0xe1f1('0x29')](handleEntityNotFound(_0x4f7483,null))[_0xe1f1('0x29')](respondWithResult(_0x4f7483,null))['catch'](handleError(_0x4f7483,null));};exports[_0xe1f1('0x4a')]=function(_0x150788,_0x1843c7){return db['Team'][_0xe1f1('0x4a')](_0x150788[_0xe1f1('0x4b')],{})[_0xe1f1('0x29')](function(_0x2f6230){var _0x777c6e=_0x150788['user'][_0xe1f1('0x4c')]({'plain':!![]});if(!_0x777c6e)throw new Error(_0xe1f1('0x4d'));if(_0x777c6e[_0xe1f1('0x4e')]===_0xe1f1('0x4f')){var _0xfdf67e=_0x2f6230[_0xe1f1('0x4c')]({'plain':!![]});var _0x151bfb=_0xe1f1('0x50');return db[_0xe1f1('0x51')][_0xe1f1('0x49')]({'where':{'name':_0x151bfb,'userProfileId':_0x777c6e[_0xe1f1('0x52')]},'raw':!![]})[_0xe1f1('0x29')](function(_0x465455){if(_0x465455&&_0x465455[_0xe1f1('0x53')]===0x0){return db[_0xe1f1('0x54')][_0xe1f1('0x4a')]({'name':_0xfdf67e['name'],'resourceId':_0xfdf67e['id'],'type':_0x465455[_0xe1f1('0x2c')],'sectionId':_0x465455['id']},{})[_0xe1f1('0x29')](function(){return _0x2f6230;});}else{return _0x2f6230;}})[_0xe1f1('0x55')](function(_0x32519c){logger[_0xe1f1('0x2a')](_0xe1f1('0x56'),_0x32519c);throw _0x32519c;});}return _0x2f6230;})['then'](respondWithResult(_0x1843c7,0xc9))[_0xe1f1('0x55')](handleError(_0x1843c7,null));};exports[_0xe1f1('0x28')]=function(_0x3a6ddb,_0x39f265){if(_0x3a6ddb[_0xe1f1('0x4b')]['id']){delete _0x3a6ddb[_0xe1f1('0x4b')]['id'];}return db[_0xe1f1('0x30')]['find']({'where':{'id':_0x3a6ddb[_0xe1f1('0x48')]['id']}})[_0xe1f1('0x29')](handleEntityNotFound(_0x39f265,null))[_0xe1f1('0x29')](saveUpdates(_0x3a6ddb[_0xe1f1('0x4b')],null))['then'](respondWithResult(_0x39f265,null))[_0xe1f1('0x55')](handleError(_0x39f265,null));};exports[_0xe1f1('0x57')]=function(_0x3016f4,_0x1379f2){var _0x380211=_0x3016f4[_0xe1f1('0x48')]['id'];var _0x1a8825=[];return db[_0xe1f1('0x58')][_0xe1f1('0x59')](function(_0x448bd8){var _0x3c203c='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x380211;return db[_0xe1f1('0x58')]['query'](_0x3c203c,{'type':db[_0xe1f1('0x5a')][_0xe1f1('0x5b')][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8})[_0xe1f1('0x29')](function(_0x2764d4){_0x1a8825=_[_0xe1f1('0x2f')](_0x2764d4,function(_0x2c85ab){return Number(_0x2c85ab[_0xe1f1('0x5d')]);});})[_0xe1f1('0x29')](function(){var _0x3bf565=_0xe1f1('0x5e')+_0x380211;return db[_0xe1f1('0x58')][_0xe1f1('0x34')](_0x3bf565,{'type':db[_0xe1f1('0x5a')][_0xe1f1('0x5b')][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8});})['then'](function(_0x8ba930){var _0x454e1e=_['map'](_0x8ba930,function(_0x4d78af){return Number(_0x4d78af[_0xe1f1('0x5f')]);});return db[_0xe1f1('0x60')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'VoiceQueueId':{'$in':_0x454e1e}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){var _0x579a94=_0xe1f1('0x61')+_0x380211;return db[_0xe1f1('0x58')][_0xe1f1('0x34')](_0x579a94,{'type':db['Sequelize'][_0xe1f1('0x5b')][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(_0x52e06a){var _0x2c8398=_[_0xe1f1('0x2f')](_0x52e06a,function(_0x2cb80e){return Number(_0x2cb80e[_0xe1f1('0x62')]);});return db['UserMailQueue'][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'MailQueueId':{'$in':_0x2c8398}},'transaction':_0x448bd8});})['then'](function(){var _0xfd6b7=_0xe1f1('0x63')+_0x380211;return db['sequelize'][_0xe1f1('0x34')](_0xfd6b7,{'type':db[_0xe1f1('0x5a')][_0xe1f1('0x5b')]['SELECT'],'raw':!![],'transaction':_0x448bd8});})['then'](function(_0x5b4ef6){var _0x809379=_[_0xe1f1('0x2f')](_0x5b4ef6,function(_0x1ed409){return Number(_0x1ed409[_0xe1f1('0x64')]);});return db[_0xe1f1('0x65')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'SmsQueueId':{'$in':_0x809379}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){var _0xc789d4=_0xe1f1('0x66')+_0x380211;return db[_0xe1f1('0x58')][_0xe1f1('0x34')](_0xc789d4,{'type':db['Sequelize'][_0xe1f1('0x5b')][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8});})['then'](function(_0x178db0){var _0x3d3b27=_[_0xe1f1('0x2f')](_0x178db0,function(_0x11d557){return Number(_0x11d557[_0xe1f1('0x67')]);});return db[_0xe1f1('0x68')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'ChatQueueId':{'$in':_0x3d3b27}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){var _0x3a080e='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x380211;return db[_0xe1f1('0x58')][_0xe1f1('0x34')](_0x3a080e,{'type':db[_0xe1f1('0x5a')][_0xe1f1('0x5b')][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(_0x1e086e){var _0x43282a=_[_0xe1f1('0x2f')](_0x1e086e,function(_0x5aaee9){return Number(_0x5aaee9['FaxQueueId']);});return db[_0xe1f1('0x69')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'FaxQueueId':{'$in':_0x43282a}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){var _0x54cc17=_0xe1f1('0x6a')+_0x380211;return db['sequelize'][_0xe1f1('0x34')](_0x54cc17,{'type':db[_0xe1f1('0x5a')][_0xe1f1('0x5b')]['SELECT'],'raw':!![],'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(_0x5b8e8f){var _0x1ab300=_['map'](_0x5b8e8f,function(_0x3398fd){return Number(_0x3398fd['OpenchannelQueueId']);});return db[_0xe1f1('0x6b')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'OpenchannelQueueId':{'$in':_0x1ab300}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){var _0x7515f4=_0xe1f1('0x6c')+_0x380211;return db[_0xe1f1('0x58')][_0xe1f1('0x34')](_0x7515f4,{'type':db[_0xe1f1('0x5a')]['QueryTypes'][_0xe1f1('0x5c')],'raw':!![],'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(_0x16d068){var _0x1b75c3=_[_0xe1f1('0x2f')](_0x16d068,function(_0x3f6a88){return Number(_0x3f6a88[_0xe1f1('0x6d')]);});return db[_0xe1f1('0x6e')][_0xe1f1('0x57')]({'where':{'UserId':{'$in':_0x1a8825},'WhatsappQueueId':{'$in':_0x1b75c3}},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){return db[_0xe1f1('0x6f')][_0xe1f1('0x49')]({'where':{'TeamId':_0x380211}});})[_0xe1f1('0x29')](function(_0x57562a){if(_0x57562a===null){return;}return db[_0xe1f1('0x70')]['destroy']({'where':{'UserId':{'$in':_0x1a8825},'VoicePrefixId':_0x57562a['VoicePrefixId']},'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(){return db[_0xe1f1('0x30')]['destroy']({'where':{'id':_0x380211},'cascade':!![],'transaction':_0x448bd8});})[_0xe1f1('0x29')](function(_0x3506da){if(_0x3506da===0x0){_0x1379f2[_0xe1f1('0x1c')](0x194);}else{return db[_0xe1f1('0x54')][_0xe1f1('0x57')]({'where':{'type':_0xe1f1('0x50'),'resourceId':_0x380211},'cascade':!![],'transaction':_0x448bd8})[_0xe1f1('0x29')](function(){_0x1379f2[_0xe1f1('0x1d')](0xcc)[_0xe1f1('0x71')]();});}})[_0xe1f1('0x55')](function(_0x281dc1){_0x1379f2['status'](0x1f4)['send'](_0x281dc1);});});};exports['getQueues']=function(_0x15f747,_0x1bc3e6,_0x43f48a){return db[_0xe1f1('0x30')][_0xe1f1('0x72')]({'where':{'id':_0x15f747['params']['id']}})[_0xe1f1('0x29')](handleEntityNotFound(_0x1bc3e6,null))['then'](function(_0x15d55f){if(!_0x15f747[_0xe1f1('0x34')][_0xe1f1('0x73')]||!utils[_0xe1f1('0x74')](_0x15f747[_0xe1f1('0x34')][_0xe1f1('0x73')])){throw new db[(_0xe1f1('0x5a'))][(_0xe1f1('0x75'))]('Unknown\x20channel');}var _0xede8fb={};var _0x4d381a={};_0x4d381a[_0xe1f1('0x33')]=_[_0xe1f1('0x35')](db[_[_0xe1f1('0x76')](_0x15f747[_0xe1f1('0x34')][_0xe1f1('0x73')][_0xe1f1('0x77')]())+_0xe1f1('0x78')][_0xe1f1('0x31')]);_0x4d381a[_0xe1f1('0x34')]=_[_0xe1f1('0x35')](_0x15f747[_0xe1f1('0x34')]);_0x4d381a[_0xe1f1('0x3f')]=_[_0xe1f1('0x37')](_0x4d381a[_0xe1f1('0x33')],_0x4d381a[_0xe1f1('0x34')]);_0xede8fb[_0xe1f1('0x36')]=_[_0xe1f1('0x37')](_0x4d381a[_0xe1f1('0x33')],qs['fields'](_0x15f747['query'][_0xe1f1('0x38')]));_0xede8fb['attributes']=_0xede8fb[_0xe1f1('0x36')][_0xe1f1('0x39')]?_0xede8fb['attributes']:_0x4d381a[_0xe1f1('0x33')];_0xede8fb[_0xe1f1('0x21')]=qs[_0xe1f1('0x21')](_0x15f747['query'][_0xe1f1('0x21')]);_0xede8fb[_0xe1f1('0x1f')]=qs[_0xe1f1('0x1f')](_0x15f747[_0xe1f1('0x34')][_0xe1f1('0x1f')]);_0xede8fb[_0xe1f1('0x3c')]=qs['sort'](_0x15f747[_0xe1f1('0x34')][_0xe1f1('0x3d')]);_0xede8fb[_0xe1f1('0x3e')]=qs[_0xe1f1('0x3f')](_[_0xe1f1('0x79')](_0x15f747['query'],_0x4d381a[_0xe1f1('0x3f')]));_0xede8fb=_[_0xe1f1('0x41')]({},_0xede8fb,_0x15f747[_0xe1f1('0x43')]);return _0x15d55f[_0xe1f1('0x4c')+_[_0xe1f1('0x76')](_0x15f747['query']['channel']['toLowerCase']())+_0xe1f1('0x7a')](_0xede8fb);})[_0xe1f1('0x29')](respondWithResult(_0x1bc3e6,null))['catch'](handleError(_0x1bc3e6,null));};exports[_0xe1f1('0x7b')]=function(_0x5744fe,_0x2d54f9,_0x6b329e){return db[_0xe1f1('0x30')][_0xe1f1('0x72')]({'where':{'id':_0x5744fe[_0xe1f1('0x48')]['id']}})[_0xe1f1('0x29')](function(_0x4b4ee4){if(_0x4b4ee4){if(!_0x5744fe[_0xe1f1('0x4b')][_0xe1f1('0x73')]||!utils[_0xe1f1('0x74')](_0x5744fe[_0xe1f1('0x4b')][_0xe1f1('0x73')])){throw new db['Sequelize'][(_0xe1f1('0x75'))]('Unknown\x20channel');}return _0x4b4ee4[_0xe1f1('0x7c')+_[_0xe1f1('0x76')](_0x5744fe[_0xe1f1('0x4b')][_0xe1f1('0x73')][_0xe1f1('0x77')]())+_0xe1f1('0x7a')](_0x5744fe[_0xe1f1('0x4b')][_0xe1f1('0x7d')]);}return null;})[_0xe1f1('0x29')](handleEntityNotFound(_0x2d54f9,null))[_0xe1f1('0x29')](respondWithStatusCode(_0x2d54f9,null))['catch'](handleError(_0x2d54f9,null));};exports[_0xe1f1('0x7e')]=function(_0x4babeb,_0x2ea28f,_0x2a9b14){return db['Team']['findOne']({'where':{'id':_0x4babeb[_0xe1f1('0x48')]['id']}})[_0xe1f1('0x29')](function(_0x9f7f05){if(_0x9f7f05){if(!_0x4babeb['query']['channel']||!utils[_0xe1f1('0x74')](_0x4babeb[_0xe1f1('0x34')][_0xe1f1('0x73')])){throw new db['Sequelize'][(_0xe1f1('0x75'))]('Unknown\x20channel');}return _0x9f7f05['remove'+_[_0xe1f1('0x76')](_0x4babeb[_0xe1f1('0x34')][_0xe1f1('0x73')][_0xe1f1('0x77')]())+_0xe1f1('0x7a')](_0x4babeb[_0xe1f1('0x34')][_0xe1f1('0x7d')]);}return null;})['then'](handleEntityNotFound(_0x2ea28f,null))['then'](respondWithStatusCode(_0x2ea28f,null))[_0xe1f1('0x55')](handleError(_0x2ea28f,null));};exports[_0xe1f1('0x7f')]=function(_0x44e230,_0x9cdae8){var _0x3e017e=_['isArray'](_0x44e230[_0xe1f1('0x4b')][_0xe1f1('0x7d')])?_0x44e230[_0xe1f1('0x4b')][_0xe1f1('0x7d')]:[_0x44e230[_0xe1f1('0x4b')][_0xe1f1('0x7d')]];var _0x1549a5=_0x44e230['params']['id'];return db[_0xe1f1('0x30')][_0xe1f1('0x49')]({'where':{'id':_0x1549a5}})[_0xe1f1('0x29')](handleEntityNotFound(_0x9cdae8,null))[_0xe1f1('0x29')](function(_0x1fdd1a){if(_0x1fdd1a){var _0x5471ae=[_0xe1f1('0x80'),_0xe1f1('0x81'),_0xe1f1('0x82'),_0xe1f1('0x83'),_0xe1f1('0x84'),'Openchannel',_0xe1f1('0x85')];return db['sequelize'][_0xe1f1('0x59')](function(_0x45030d){var _0x21f2a0=_[_0xe1f1('0x2f')](_0x5471ae,function(_0x17be0d){var _0x556f64={'attributes':['id',_0xe1f1('0x2c')]};if(_0x17be0d==='Voice'){_0x556f64[_0xe1f1('0x86')]={'attributes':[_0xe1f1('0x87')]};}return _0x1fdd1a[_0xe1f1('0x4c')+_0x17be0d+_0xe1f1('0x7a')](_0x556f64)[_0xe1f1('0x29')](function(_0x1c2216){var _0x4946ed=_[_0xe1f1('0x2f')](_0x1c2216,function(_0x51f181){var _0x22c6e5=_[_0xe1f1('0x2f')](_0x3e017e,function(_0x324858){var _0x4d349d={'where':{'UserId':_0x324858,[_0x17be0d+'QueueId']:_0x51f181['id']},'transaction':_0x45030d};if(_0x17be0d==='Voice'){_0x4d349d[_0xe1f1('0x88')]={'penalty':_0x51f181[_0xe1f1('0x89')][_0xe1f1('0x87')]};}return db['User'+_0x17be0d+_0xe1f1('0x78')][_0xe1f1('0x8a')](_0x4d349d)[_0xe1f1('0x29')](function(){socket[_0xe1f1('0x8b')]('user'+_0x17be0d+_0xe1f1('0x8c'),{'UserId':_0x324858,[_0x17be0d+_0xe1f1('0x8d')]:_0x51f181['id']});if(_0x17be0d!==_0xe1f1('0x80')){return;}return db[_0xe1f1('0x8e')][_0xe1f1('0x8f')]({'where':{'id':_0x3e017e,'online':0x1},'attributes':['id',_0xe1f1('0x2c'),_0xe1f1('0x90'),'voicePause',_0xe1f1('0x91')],'raw':!![]})[_0xe1f1('0x29')](function(_0x50bacd){var _0x143785=_[_0xe1f1('0x2f')](_0x50bacd,function(_0x3fc164){return db[_0xe1f1('0x92')]['upsert']({'membername':_0x3fc164[_0xe1f1('0x2c')],'UserId':_0x3fc164['id'],'queue_name':_0x51f181['name'],'VoiceQueueId':_0x51f181['id'],'interface':_[_0xe1f1('0x93')](_0x3fc164[_0xe1f1('0x91')])?util[_0xe1f1('0x94')](_0xe1f1('0x95'),_0x3fc164['name']):_0x3fc164[_0xe1f1('0x91')],'paused':_0x3fc164['voicePause']||![],'penalty':_0x51f181[_0xe1f1('0x89')][_0xe1f1('0x87')]},{'transaction':_0x45030d});});return Promise[_0xe1f1('0x96')](_0x143785);});});});return Promise['all'](_0x22c6e5);});return Promise[_0xe1f1('0x96')](_0x4946ed);})[_0xe1f1('0x29')](function(){return db['TeamVoicePrefix'][_0xe1f1('0x72')]({'where':{'teamId':_0x1549a5}})[_0xe1f1('0x29')](function(_0x57a2b6){if(_0x57a2b6){var _0xfdf465=_[_0xe1f1('0x2f')](_0x3e017e,function(_0x3cfaa6){db[_0xe1f1('0x70')]['upsert']({'UserId':_0x3cfaa6,'VoicePrefixId':_0x57a2b6[_0xe1f1('0x97')]});});return Promise['all'](_0xfdf465);}});});});return Promise[_0xe1f1('0x96')](_0x21f2a0)[_0xe1f1('0x29')](function(){return _0x1fdd1a[_0xe1f1('0x7f')](_0x3e017e,{'transaction':_0x45030d})[_0xe1f1('0x98')](function(_0x197939){return _0x197939;});});});}})['then'](respondWithResult(_0x9cdae8,null))[_0xe1f1('0x55')](handleError(_0x9cdae8,null));};exports[_0xe1f1('0x99')]=function(_0x3017cb,_0x39ecff){var _0x4bf76d=_['isArray'](_0x3017cb['query']['ids'])?_0x3017cb[_0xe1f1('0x34')][_0xe1f1('0x7d')]:[_0x3017cb[_0xe1f1('0x34')][_0xe1f1('0x7d')]];var _0x5a1fec=_0x3017cb[_0xe1f1('0x48')]['id'];return db[_0xe1f1('0x30')][_0xe1f1('0x49')]({'where':{'id':_0x5a1fec}})['then'](handleEntityNotFound(_0x39ecff,null))['then'](function(_0x31edb7){if(_0x31edb7){var _0xb6c00c=[_0xe1f1('0x80'),'Chat',_0xe1f1('0x82'),_0xe1f1('0x83'),_0xe1f1('0x84'),'Openchannel','Whatsapp'];return db[_0xe1f1('0x58')][_0xe1f1('0x59')](function(_0x42d520){var _0x49c096=_['map'](_0xb6c00c,function(_0x577360){var _0x4572c7={'attributes':['id',_0xe1f1('0x2c')]};return _0x31edb7[_0xe1f1('0x4c')+_0x577360+'Queues'](_0x4572c7)[_0xe1f1('0x29')](function(_0x1bd252){var _0xcdd23a=_[_0xe1f1('0x2f')](_0x1bd252,function(_0x3d6f50){return _0x3d6f50[_0xe1f1('0x99')](_0x4bf76d,{'transaction':_0x42d520})[_0xe1f1('0x29')](function(){var _0x5bdfbd=_[_0xe1f1('0x2f')](_0x4bf76d,function(_0x11f4d9){socket[_0xe1f1('0x8b')](_0xe1f1('0x4f')+_0x577360+_0xe1f1('0x9a'),{'UserId':Number(_0x11f4d9),[_0x577360+_0xe1f1('0x8d')]:_0x3d6f50['id']});if(_0x577360!==_0xe1f1('0x80')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x3d6f50['id'],'UserId':_0x11f4d9},'transaction':_0x42d520});});return Promise['all'](_0x5bdfbd);});});return Promise['all'](_0xcdd23a);});});return Promise[_0xe1f1('0x96')](_0x49c096)[_0xe1f1('0x29')](function(){return _0x31edb7[_0xe1f1('0x99')](_0x4bf76d,{'transaction':_0x42d520});})[_0xe1f1('0x29')](function(){return db[_0xe1f1('0x6f')][_0xe1f1('0x72')]({'where':{'teamId':_0x5a1fec}})[_0xe1f1('0x29')](function(_0x110b4c){if(_0x110b4c){var _0x6ceac7=_['map'](_0x4bf76d,function(_0x1dbdca){db[_0xe1f1('0x70')][_0xe1f1('0x57')]({'where':{'UserId':_0x1dbdca,'VoicePrefixId':_0x110b4c[_0xe1f1('0x97')]}});});return Promise[_0xe1f1('0x96')](_0x6ceac7);}});});});}})['then'](respondWithStatusCode(_0x39ecff,null))[_0xe1f1('0x55')](handleError(_0x39ecff,null));};exports['getAgents']=function(_0xfbd5a2,_0x3fd9b2,_0x4b6f1c){var _0x377884={};var _0x312021={};var _0x504674;var _0x4f3159;return db[_0xe1f1('0x30')][_0xe1f1('0x72')]({'where':{'id':_0xfbd5a2[_0xe1f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x3fd9b2,null))[_0xe1f1('0x29')](function(_0x3c04a2){if(_0x3c04a2){_0x504674=_0x3c04a2;_0x312021['model']=_[_0xe1f1('0x35')](db[_0xe1f1('0x8e')][_0xe1f1('0x31')]);_0x312021['query']=_['keys'](_0xfbd5a2['query']);_0x312021['filters']=_[_0xe1f1('0x37')](_0x312021[_0xe1f1('0x33')],_0x312021['query']);_0x377884['attributes']=_[_0xe1f1('0x37')](_0x312021[_0xe1f1('0x33')],qs['fields'](_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x38')]));_0x377884['attributes']=_0x377884['attributes'][_0xe1f1('0x39')]?_0x377884[_0xe1f1('0x36')]:_0x312021['model'];_0x377884[_0xe1f1('0x3c')]=qs[_0xe1f1('0x3d')](_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x3d')]);_0x377884[_0xe1f1('0x3e')]=qs[_0xe1f1('0x3f')](_['pick'](_0xfbd5a2[_0xe1f1('0x34')],_0x312021[_0xe1f1('0x3f')]));if(_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x40')]){_0x377884['where']=_[_0xe1f1('0x41')](_0x377884['where'],{'$or':_[_0xe1f1('0x2f')](_0x377884[_0xe1f1('0x36')],function(_0x17b81c){var _0x3efdfa={};_0x3efdfa[_0x17b81c]={'$like':'%'+_0xfbd5a2[_0xe1f1('0x34')]['filter']+'%'};return _0x3efdfa;})});}_0x377884=_[_0xe1f1('0x41')]({},_0x377884,_0xfbd5a2[_0xe1f1('0x43')]);return _0x504674[_0xe1f1('0x9b')](_0x377884);}})[_0xe1f1('0x29')](function(_0x53006a){if(_0x53006a){_0x4f3159=_0x53006a[_0xe1f1('0x39')];if(!_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x3a')](_0xe1f1('0x3b'))){_0x377884['limit']=qs[_0xe1f1('0x21')](_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x21')]);_0x377884[_0xe1f1('0x1f')]=qs[_0xe1f1('0x1f')](_0xfbd5a2[_0xe1f1('0x34')][_0xe1f1('0x1f')]);}return _0x504674[_0xe1f1('0x9b')](_0x377884);}})[_0xe1f1('0x29')](function(_0x3b2a39){if(_0x3b2a39){return _0x3b2a39?{'count':_0x4f3159,'rows':_0x3b2a39}:null;}})[_0xe1f1('0x29')](respondWithResult(_0x3fd9b2,null))['catch'](handleError(_0x3fd9b2,null));}; \ No newline at end of file +var _0xa8f7=['addAgents','removeAgents','Chat','Sms','Queue:remove','getAgents','hasOwnProperty','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','error','stack','name','index','map','Team','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','catch','show','params','find','create','body','get','role','user','Teams','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','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','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','VoicePrefixId','UserProfileResource','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','Queues','ids','removeQueues','remove','isArray','Voice','Mail','Fax','Openchannel','Whatsapp','transaction','through','defaults','TeamVoiceQueue','penalty','findOrCreate','emit','Queue:save','QueueId','User','online','voicePause','UserVoiceQueueRt','isNil','interface','format','SIP/%s','all','TeamVoicePrefix','UserVoicePrefix','upsert'];(function(_0x274638,_0x578968){var _0x5755df=function(_0x3227d5){while(--_0x3227d5){_0x274638['push'](_0x274638['shift']());}};_0x5755df(++_0x578968);}(_0xa8f7,0xac));var _0x7a8f=function(_0x3660db,_0x218d3f){_0x3660db=_0x3660db-0x0;var _0x3b394e=_0xa8f7[_0x3660db];return _0x3b394e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a8f('0x0'));var zipdir=require(_0x7a8f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7a8f('0x2'));var BPromise=require(_0x7a8f('0x3'));var Mustache=require(_0x7a8f('0x4'));var util=require(_0x7a8f('0x5'));var path=require(_0x7a8f('0x6'));var sox=require(_0x7a8f('0x7'));var csv=require('to-csv');var ejs=require(_0x7a8f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8f('0x9'));var squel=require(_0x7a8f('0xa'));var crypto=require(_0x7a8f('0xb'));var jsforce=require(_0x7a8f('0xc'));var deskjs=require(_0x7a8f('0xd'));var toCsv=require(_0x7a8f('0xe'));var querystring=require(_0x7a8f('0xf'));var Papa=require(_0x7a8f('0x10'));var Redis=require(_0x7a8f('0x11'));var authService=require(_0x7a8f('0x12'));var qs=require(_0x7a8f('0x13'));var as=require(_0x7a8f('0x14'));var hardwareService=require(_0x7a8f('0x15'));var logger=require(_0x7a8f('0x16'))(_0x7a8f('0x17'));var utils=require('../../config/utils');var config=require(_0x7a8f('0x18'));var licenseUtil=require(_0x7a8f('0x19'));var db=require(_0x7a8f('0x1a'))['db'];config[_0x7a8f('0x1b')]=_['defaults'](config[_0x7a8f('0x1b')],{'host':_0x7a8f('0x1c'),'port':0x18eb});var socket=require(_0x7a8f('0x1d'))(new Redis(config[_0x7a8f('0x1b')]));require('./team.socket')[_0x7a8f('0x1e')](socket);function respondWithStatusCode(_0x39098d,_0x1fedbc){_0x1fedbc=_0x1fedbc||0xcc;return function(_0x59592f){if(_0x59592f){return _0x39098d[_0x7a8f('0x1f')](_0x1fedbc);}return _0x39098d[_0x7a8f('0x20')](_0x1fedbc)[_0x7a8f('0x21')]();};}function respondWithResult(_0x58c66f,_0xcb856c){_0xcb856c=_0xcb856c||0xc8;return function(_0x5c1e2f){if(_0x5c1e2f){return _0x58c66f[_0x7a8f('0x20')](_0xcb856c)[_0x7a8f('0x22')](_0x5c1e2f);}};}function respondWithFilteredResult(_0x22c28d,_0x418e81){return function(_0x41065f){if(_0x41065f){var _0x21b79c=typeof _0x418e81[_0x7a8f('0x23')]==='undefined'&&typeof _0x418e81[_0x7a8f('0x24')]==='undefined';var _0x5e1cc2=_0x41065f[_0x7a8f('0x25')];var _0x14560b=_0x21b79c?0x0:_0x418e81['offset'];var _0x13b22b=_0x21b79c?_0x41065f[_0x7a8f('0x25')]:_0x418e81[_0x7a8f('0x23')]+_0x418e81['limit'];var _0x2edd34;if(_0x13b22b>=_0x5e1cc2){_0x13b22b=_0x5e1cc2;_0x2edd34=0xc8;}else{_0x2edd34=0xce;}_0x22c28d[_0x7a8f('0x20')](_0x2edd34);return _0x22c28d[_0x7a8f('0x26')](_0x7a8f('0x27'),_0x14560b+'-'+_0x13b22b+'/'+_0x5e1cc2)[_0x7a8f('0x22')](_0x41065f);}return null;};}function patchUpdates(_0x1cb497){return function(_0x35fd68){try{jsonpatch[_0x7a8f('0x28')](_0x35fd68,_0x1cb497,!![]);}catch(_0x349820){return BPromise[_0x7a8f('0x29')](_0x349820);}return _0x35fd68[_0x7a8f('0x2a')]();};}function saveUpdates(_0x38a630,_0x21fe33){return function(_0x70b0be){if(_0x70b0be){return _0x70b0be[_0x7a8f('0x2b')](_0x38a630)['then'](function(_0x342a62){return _0x342a62;});}return null;};}function handleEntityNotFound(_0x59d687,_0x85e982){return function(_0x1ce638){if(!_0x1ce638){_0x59d687['sendStatus'](0x194);}return _0x1ce638;};}function handleError(_0x647dcb,_0x3d034d){_0x3d034d=_0x3d034d||0x1f4;return function(_0x2e71f7){logger[_0x7a8f('0x2c')](_0x2e71f7[_0x7a8f('0x2d')]);if(_0x2e71f7[_0x7a8f('0x2e')]){delete _0x2e71f7['name'];}_0x647dcb[_0x7a8f('0x20')](_0x3d034d)['send'](_0x2e71f7);};}exports[_0x7a8f('0x2f')]=function(_0x20031b,_0x40b569){var _0x4f0fbd={},_0x46f638={},_0x5e9ac9={'count':0x0,'rows':[]};var _0x22bd33=_[_0x7a8f('0x30')](db[_0x7a8f('0x31')][_0x7a8f('0x32')],function(_0x1654ac){return{'name':_0x1654ac[_0x7a8f('0x33')],'type':_0x1654ac[_0x7a8f('0x34')][_0x7a8f('0x35')]};});_0x46f638[_0x7a8f('0x36')]=_['map'](_0x22bd33,_0x7a8f('0x2e'));_0x46f638[_0x7a8f('0x37')]=_[_0x7a8f('0x38')](_0x20031b[_0x7a8f('0x37')]);_0x46f638[_0x7a8f('0x39')]=_['intersection'](_0x46f638[_0x7a8f('0x36')],_0x46f638[_0x7a8f('0x37')]);_0x4f0fbd[_0x7a8f('0x3a')]=_[_0x7a8f('0x3b')](_0x46f638['model'],qs['fields'](_0x20031b['query'][_0x7a8f('0x3c')]));_0x4f0fbd[_0x7a8f('0x3a')]=_0x4f0fbd['attributes'][_0x7a8f('0x3d')]?_0x4f0fbd['attributes']:_0x46f638[_0x7a8f('0x36')];if(!_0x20031b[_0x7a8f('0x37')]['hasOwnProperty'](_0x7a8f('0x3e'))){_0x4f0fbd[_0x7a8f('0x24')]=qs['limit'](_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x24')]);_0x4f0fbd['offset']=qs[_0x7a8f('0x23')](_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x23')]);}_0x4f0fbd[_0x7a8f('0x3f')]=qs[_0x7a8f('0x40')](_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x40')]);_0x4f0fbd[_0x7a8f('0x41')]=qs[_0x7a8f('0x39')](_[_0x7a8f('0x42')](_0x20031b[_0x7a8f('0x37')],_0x46f638[_0x7a8f('0x39')]),_0x22bd33);if(_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x43')]){_0x4f0fbd[_0x7a8f('0x41')]=_[_0x7a8f('0x44')](_0x4f0fbd[_0x7a8f('0x41')],{'$or':_[_0x7a8f('0x30')](_0x22bd33,function(_0x328073){if(_0x328073[_0x7a8f('0x34')]!==_0x7a8f('0x45')){var _0x4c6498={};_0x4c6498[_0x328073[_0x7a8f('0x2e')]]={'$like':'%'+_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x43')]+'%'};return _0x4c6498;}})});}_0x4f0fbd=_['merge']({},_0x4f0fbd,_0x20031b[_0x7a8f('0x46')]);var _0xa55d71={'where':_0x4f0fbd[_0x7a8f('0x41')]};return db[_0x7a8f('0x31')][_0x7a8f('0x25')](_0xa55d71)[_0x7a8f('0x47')](function(_0x55b25b){_0x5e9ac9[_0x7a8f('0x25')]=_0x55b25b;if(_0x20031b[_0x7a8f('0x37')][_0x7a8f('0x48')]){_0x4f0fbd[_0x7a8f('0x49')]=[{'all':!![]}];}return db['Team'][_0x7a8f('0x4a')](_0x4f0fbd);})[_0x7a8f('0x47')](function(_0x1a2859){_0x5e9ac9['rows']=_0x1a2859;return _0x5e9ac9;})[_0x7a8f('0x47')](respondWithFilteredResult(_0x40b569,_0x4f0fbd))[_0x7a8f('0x4b')](handleError(_0x40b569,null));};exports[_0x7a8f('0x4c')]=function(_0x4e3eb9,_0x2d6965){var _0x1afa3e={'raw':![],'where':{'id':_0x4e3eb9[_0x7a8f('0x4d')]['id']}},_0x328402={};_0x328402[_0x7a8f('0x36')]=_[_0x7a8f('0x38')](db[_0x7a8f('0x31')]['rawAttributes']);_0x328402[_0x7a8f('0x37')]=_['keys'](_0x4e3eb9[_0x7a8f('0x37')]);_0x328402['filters']=_[_0x7a8f('0x3b')](_0x328402[_0x7a8f('0x36')],_0x328402[_0x7a8f('0x37')]);_0x1afa3e[_0x7a8f('0x3a')]=_[_0x7a8f('0x3b')](_0x328402['model'],qs[_0x7a8f('0x3c')](_0x4e3eb9[_0x7a8f('0x37')][_0x7a8f('0x3c')]));_0x1afa3e[_0x7a8f('0x3a')]=_0x1afa3e[_0x7a8f('0x3a')][_0x7a8f('0x3d')]?_0x1afa3e[_0x7a8f('0x3a')]:_0x328402[_0x7a8f('0x36')];if(_0x4e3eb9[_0x7a8f('0x37')][_0x7a8f('0x48')]){_0x1afa3e[_0x7a8f('0x49')]=[{'all':!![]}];}_0x1afa3e=_[_0x7a8f('0x44')]({},_0x1afa3e,_0x4e3eb9['options']);return db['Team'][_0x7a8f('0x4e')](_0x1afa3e)[_0x7a8f('0x47')](handleEntityNotFound(_0x2d6965,null))[_0x7a8f('0x47')](respondWithResult(_0x2d6965,null))[_0x7a8f('0x4b')](handleError(_0x2d6965,null));};exports[_0x7a8f('0x4f')]=function(_0x5d8b59,_0x226c5e){return db[_0x7a8f('0x31')][_0x7a8f('0x4f')](_0x5d8b59[_0x7a8f('0x50')],{})['then'](function(_0x5b16ef){var _0x57f7b4=_0x5d8b59['user'][_0x7a8f('0x51')]({'plain':!![]});if(!_0x57f7b4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57f7b4[_0x7a8f('0x52')]===_0x7a8f('0x53')){var _0x4cf6a7=_0x5b16ef[_0x7a8f('0x51')]({'plain':!![]});var _0x332e46=_0x7a8f('0x54');return db[_0x7a8f('0x55')][_0x7a8f('0x4e')]({'where':{'name':_0x332e46,'userProfileId':_0x57f7b4[_0x7a8f('0x56')]},'raw':!![]})[_0x7a8f('0x47')](function(_0x212d30){if(_0x212d30&&_0x212d30[_0x7a8f('0x57')]===0x0){return db['UserProfileResource']['create']({'name':_0x4cf6a7[_0x7a8f('0x2e')],'resourceId':_0x4cf6a7['id'],'type':_0x212d30[_0x7a8f('0x2e')],'sectionId':_0x212d30['id']},{})[_0x7a8f('0x47')](function(){return _0x5b16ef;});}else{return _0x5b16ef;}})[_0x7a8f('0x4b')](function(_0x47f52e){logger[_0x7a8f('0x2c')](_0x7a8f('0x58'),_0x47f52e);throw _0x47f52e;});}return _0x5b16ef;})[_0x7a8f('0x47')](respondWithResult(_0x226c5e,0xc9))[_0x7a8f('0x4b')](handleError(_0x226c5e,null));};exports[_0x7a8f('0x2b')]=function(_0x13d8ff,_0x50817b){if(_0x13d8ff[_0x7a8f('0x50')]['id']){delete _0x13d8ff[_0x7a8f('0x50')]['id'];}return db['Team']['find']({'where':{'id':_0x13d8ff[_0x7a8f('0x4d')]['id']}})[_0x7a8f('0x47')](handleEntityNotFound(_0x50817b,null))[_0x7a8f('0x47')](saveUpdates(_0x13d8ff['body'],null))['then'](respondWithResult(_0x50817b,null))[_0x7a8f('0x4b')](handleError(_0x50817b,null));};exports[_0x7a8f('0x59')]=function(_0x50312f,_0x4000ee){var _0x537236=_0x50312f[_0x7a8f('0x4d')]['id'];var _0x511591=[];return db[_0x7a8f('0x5a')]['transaction'](function(_0x1382d4){var _0x336a47='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x537236;return db['sequelize']['query'](_0x336a47,{'type':db[_0x7a8f('0x5b')]['QueryTypes'][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4})['then'](function(_0x4c7444){_0x511591=_['map'](_0x4c7444,function(_0x51a33d){return Number(_0x51a33d[_0x7a8f('0x5d')]);});})[_0x7a8f('0x47')](function(){var _0x20bcf6=_0x7a8f('0x5e')+_0x537236;return db[_0x7a8f('0x5a')][_0x7a8f('0x37')](_0x20bcf6,{'type':db[_0x7a8f('0x5b')][_0x7a8f('0x5f')][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x4caac5){var _0xf407a3=_[_0x7a8f('0x30')](_0x4caac5,function(_0x270271){return Number(_0x270271[_0x7a8f('0x60')]);});return db['UserVoiceQueue'][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'VoiceQueueId':{'$in':_0xf407a3}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){var _0x171ab4=_0x7a8f('0x61')+_0x537236;return db[_0x7a8f('0x5a')][_0x7a8f('0x37')](_0x171ab4,{'type':db[_0x7a8f('0x5b')]['QueryTypes'][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})['then'](function(_0xdfcb10){var _0x28b52c=_['map'](_0xdfcb10,function(_0x5d1e85){return Number(_0x5d1e85[_0x7a8f('0x62')]);});return db[_0x7a8f('0x63')]['destroy']({'where':{'UserId':{'$in':_0x511591},'MailQueueId':{'$in':_0x28b52c}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){var _0xe3da26=_0x7a8f('0x64')+_0x537236;return db[_0x7a8f('0x5a')]['query'](_0xe3da26,{'type':db[_0x7a8f('0x5b')]['QueryTypes'][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x5da3bb){var _0x1b65c8=_[_0x7a8f('0x30')](_0x5da3bb,function(_0x3675ef){return Number(_0x3675ef[_0x7a8f('0x65')]);});return db[_0x7a8f('0x66')]['destroy']({'where':{'UserId':{'$in':_0x511591},'SmsQueueId':{'$in':_0x1b65c8}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){var _0xf5830=_0x7a8f('0x67')+_0x537236;return db['sequelize']['query'](_0xf5830,{'type':db[_0x7a8f('0x5b')][_0x7a8f('0x5f')][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x1bfdf0){var _0x3af696=_['map'](_0x1bfdf0,function(_0x158e5a){return Number(_0x158e5a[_0x7a8f('0x68')]);});return db[_0x7a8f('0x69')][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'ChatQueueId':{'$in':_0x3af696}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){var _0x437ab2=_0x7a8f('0x6a')+_0x537236;return db[_0x7a8f('0x5a')][_0x7a8f('0x37')](_0x437ab2,{'type':db['Sequelize']['QueryTypes'][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x285e3a){var _0x64e808=_[_0x7a8f('0x30')](_0x285e3a,function(_0x4ea673){return Number(_0x4ea673[_0x7a8f('0x6b')]);});return db[_0x7a8f('0x6c')][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'FaxQueueId':{'$in':_0x64e808}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){var _0x5d12b1=_0x7a8f('0x6d')+_0x537236;return db[_0x7a8f('0x5a')][_0x7a8f('0x37')](_0x5d12b1,{'type':db['Sequelize'][_0x7a8f('0x5f')][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x3d37bf){var _0x4926e2=_[_0x7a8f('0x30')](_0x3d37bf,function(_0x24b5d3){return Number(_0x24b5d3[_0x7a8f('0x6e')]);});return db[_0x7a8f('0x6f')][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'OpenchannelQueueId':{'$in':_0x4926e2}},'transaction':_0x1382d4});})['then'](function(){var _0x27d11d=_0x7a8f('0x70')+_0x537236;return db[_0x7a8f('0x5a')][_0x7a8f('0x37')](_0x27d11d,{'type':db[_0x7a8f('0x5b')][_0x7a8f('0x5f')][_0x7a8f('0x5c')],'raw':!![],'transaction':_0x1382d4});})['then'](function(_0x20e4da){var _0x3b4526=_[_0x7a8f('0x30')](_0x20e4da,function(_0x4dde2e){return Number(_0x4dde2e['WhatsappQueueId']);});return db[_0x7a8f('0x71')][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'WhatsappQueueId':{'$in':_0x3b4526}},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x537236}});})[_0x7a8f('0x47')](function(_0x111efe){if(_0x111efe===null){return;}return db['UserVoicePrefix'][_0x7a8f('0x59')]({'where':{'UserId':{'$in':_0x511591},'VoicePrefixId':_0x111efe[_0x7a8f('0x72')]},'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(){return db['Team'][_0x7a8f('0x59')]({'where':{'id':_0x537236},'cascade':!![],'transaction':_0x1382d4});})[_0x7a8f('0x47')](function(_0x261935){if(_0x261935===0x0){_0x4000ee[_0x7a8f('0x1f')](0x194);}else{return db[_0x7a8f('0x73')]['destroy']({'where':{'type':'Teams','resourceId':_0x537236},'cascade':!![],'transaction':_0x1382d4})['then'](function(){_0x4000ee['status'](0xcc)['end']();});}})[_0x7a8f('0x4b')](function(_0x5b9f0f){_0x4000ee['status'](0x1f4)[_0x7a8f('0x74')](_0x5b9f0f);});});};exports[_0x7a8f('0x75')]=function(_0x5c2608,_0x216603,_0x121fa2){return db[_0x7a8f('0x31')][_0x7a8f('0x76')]({'where':{'id':_0x5c2608[_0x7a8f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x216603,null))[_0x7a8f('0x47')](function(_0x5177a4){if(!_0x5c2608[_0x7a8f('0x37')][_0x7a8f('0x77')]||!utils[_0x7a8f('0x78')](_0x5c2608['query'][_0x7a8f('0x77')])){throw new db[(_0x7a8f('0x5b'))][(_0x7a8f('0x79'))](_0x7a8f('0x7a'));}var _0x2e662c={};var _0x2a7d8b={};_0x2a7d8b[_0x7a8f('0x36')]=_['keys'](db[_[_0x7a8f('0x7b')](_0x5c2608[_0x7a8f('0x37')][_0x7a8f('0x77')][_0x7a8f('0x7c')]())+_0x7a8f('0x7d')][_0x7a8f('0x32')]);_0x2a7d8b['query']=_[_0x7a8f('0x38')](_0x5c2608['query']);_0x2a7d8b[_0x7a8f('0x39')]=_[_0x7a8f('0x3b')](_0x2a7d8b[_0x7a8f('0x36')],_0x2a7d8b['query']);_0x2e662c[_0x7a8f('0x3a')]=_['intersection'](_0x2a7d8b[_0x7a8f('0x36')],qs[_0x7a8f('0x3c')](_0x5c2608[_0x7a8f('0x37')]['fields']));_0x2e662c[_0x7a8f('0x3a')]=_0x2e662c[_0x7a8f('0x3a')][_0x7a8f('0x3d')]?_0x2e662c[_0x7a8f('0x3a')]:_0x2a7d8b['model'];_0x2e662c[_0x7a8f('0x24')]=qs[_0x7a8f('0x24')](_0x5c2608['query'][_0x7a8f('0x24')]);_0x2e662c[_0x7a8f('0x23')]=qs[_0x7a8f('0x23')](_0x5c2608[_0x7a8f('0x37')][_0x7a8f('0x23')]);_0x2e662c[_0x7a8f('0x3f')]=qs[_0x7a8f('0x40')](_0x5c2608[_0x7a8f('0x37')]['sort']);_0x2e662c[_0x7a8f('0x41')]=qs['filters'](_[_0x7a8f('0x42')](_0x5c2608[_0x7a8f('0x37')],_0x2a7d8b['filters']));_0x2e662c=_[_0x7a8f('0x44')]({},_0x2e662c,_0x5c2608['options']);return _0x5177a4[_0x7a8f('0x51')+_[_0x7a8f('0x7b')](_0x5c2608['query'][_0x7a8f('0x77')][_0x7a8f('0x7c')]())+'Queues'](_0x2e662c);})[_0x7a8f('0x47')](respondWithResult(_0x216603,null))[_0x7a8f('0x4b')](handleError(_0x216603,null));};exports[_0x7a8f('0x7e')]=function(_0x2f9f2a,_0x7aead1,_0x18bae6){return db[_0x7a8f('0x31')]['findOne']({'where':{'id':_0x2f9f2a[_0x7a8f('0x4d')]['id']}})['then'](function(_0x3537d5){if(_0x3537d5){if(!_0x2f9f2a[_0x7a8f('0x50')][_0x7a8f('0x77')]||!utils[_0x7a8f('0x78')](_0x2f9f2a[_0x7a8f('0x50')][_0x7a8f('0x77')])){throw new db[(_0x7a8f('0x5b'))]['ValidationError'](_0x7a8f('0x7a'));}return _0x3537d5['add'+_[_0x7a8f('0x7b')](_0x2f9f2a[_0x7a8f('0x50')][_0x7a8f('0x77')][_0x7a8f('0x7c')]())+_0x7a8f('0x7f')](_0x2f9f2a[_0x7a8f('0x50')][_0x7a8f('0x80')]);}return null;})['then'](handleEntityNotFound(_0x7aead1,null))['then'](respondWithStatusCode(_0x7aead1,null))[_0x7a8f('0x4b')](handleError(_0x7aead1,null));};exports[_0x7a8f('0x81')]=function(_0x37e4a0,_0x3d7099,_0x444634){return db['Team'][_0x7a8f('0x76')]({'where':{'id':_0x37e4a0['params']['id']}})['then'](function(_0x4c14dc){if(_0x4c14dc){if(!_0x37e4a0[_0x7a8f('0x37')][_0x7a8f('0x77')]||!utils[_0x7a8f('0x78')](_0x37e4a0[_0x7a8f('0x37')]['channel'])){throw new db[(_0x7a8f('0x5b'))][(_0x7a8f('0x79'))](_0x7a8f('0x7a'));}return _0x4c14dc[_0x7a8f('0x82')+_[_0x7a8f('0x7b')](_0x37e4a0[_0x7a8f('0x37')][_0x7a8f('0x77')][_0x7a8f('0x7c')]())+'Queues'](_0x37e4a0[_0x7a8f('0x37')][_0x7a8f('0x80')]);}return null;})[_0x7a8f('0x47')](handleEntityNotFound(_0x3d7099,null))[_0x7a8f('0x47')](respondWithStatusCode(_0x3d7099,null))[_0x7a8f('0x4b')](handleError(_0x3d7099,null));};exports['addAgents']=function(_0x21444e,_0x2af480){var _0xda60e3=_[_0x7a8f('0x83')](_0x21444e[_0x7a8f('0x50')][_0x7a8f('0x80')])?_0x21444e[_0x7a8f('0x50')][_0x7a8f('0x80')]:[_0x21444e['body'][_0x7a8f('0x80')]];var _0x27693b=_0x21444e[_0x7a8f('0x4d')]['id'];return db[_0x7a8f('0x31')][_0x7a8f('0x4e')]({'where':{'id':_0x27693b}})[_0x7a8f('0x47')](handleEntityNotFound(_0x2af480,null))[_0x7a8f('0x47')](function(_0x564196){if(_0x564196){var _0x4c2643=[_0x7a8f('0x84'),'Chat',_0x7a8f('0x85'),'Sms',_0x7a8f('0x86'),_0x7a8f('0x87'),_0x7a8f('0x88')];return db[_0x7a8f('0x5a')][_0x7a8f('0x89')](function(_0x5d75ad){var _0x336554=_[_0x7a8f('0x30')](_0x4c2643,function(_0x36bb8b){var _0x2e04d3={'attributes':['id',_0x7a8f('0x2e')]};if(_0x36bb8b==='Voice'){_0x2e04d3[_0x7a8f('0x8a')]={'attributes':['penalty']};}return _0x564196[_0x7a8f('0x51')+_0x36bb8b+_0x7a8f('0x7f')](_0x2e04d3)[_0x7a8f('0x47')](function(_0x35e297){var _0x22c208=_[_0x7a8f('0x30')](_0x35e297,function(_0x4ab0d3){var _0x347d4a=_[_0x7a8f('0x30')](_0xda60e3,function(_0x9d3919){var _0x3b2a03={'where':{'UserId':_0x9d3919,[_0x36bb8b+'QueueId']:_0x4ab0d3['id']},'transaction':_0x5d75ad};if(_0x36bb8b===_0x7a8f('0x84')){_0x3b2a03[_0x7a8f('0x8b')]={'penalty':_0x4ab0d3[_0x7a8f('0x8c')][_0x7a8f('0x8d')]};}return db['User'+_0x36bb8b+'Queue'][_0x7a8f('0x8e')](_0x3b2a03)['then'](function(){socket[_0x7a8f('0x8f')](_0x7a8f('0x53')+_0x36bb8b+_0x7a8f('0x90'),{'UserId':_0x9d3919,[_0x36bb8b+_0x7a8f('0x91')]:_0x4ab0d3['id']});if(_0x36bb8b!==_0x7a8f('0x84')){return;}return db[_0x7a8f('0x92')][_0x7a8f('0x4a')]({'where':{'id':_0xda60e3,'online':0x1},'attributes':['id',_0x7a8f('0x2e'),_0x7a8f('0x93'),_0x7a8f('0x94'),'interface'],'raw':!![]})[_0x7a8f('0x47')](function(_0xa4420c){var _0x4d92c1=_['map'](_0xa4420c,function(_0x48f88f){return db[_0x7a8f('0x95')]['upsert']({'membername':_0x48f88f['name'],'UserId':_0x48f88f['id'],'queue_name':_0x4ab0d3[_0x7a8f('0x2e')],'VoiceQueueId':_0x4ab0d3['id'],'interface':_[_0x7a8f('0x96')](_0x48f88f[_0x7a8f('0x97')])?util[_0x7a8f('0x98')](_0x7a8f('0x99'),_0x48f88f[_0x7a8f('0x2e')]):_0x48f88f['interface'],'paused':_0x48f88f['voicePause']||![],'penalty':_0x4ab0d3[_0x7a8f('0x8c')][_0x7a8f('0x8d')]},{'transaction':_0x5d75ad});});return Promise['all'](_0x4d92c1);});});});return Promise[_0x7a8f('0x9a')](_0x347d4a);});return Promise[_0x7a8f('0x9a')](_0x22c208);})['then'](function(){return db[_0x7a8f('0x9b')][_0x7a8f('0x76')]({'where':{'teamId':_0x27693b}})[_0x7a8f('0x47')](function(_0x46d49c){if(_0x46d49c){var _0x39c09b=_[_0x7a8f('0x30')](_0xda60e3,function(_0x41d8b6){db[_0x7a8f('0x9c')][_0x7a8f('0x9d')]({'UserId':_0x41d8b6,'VoicePrefixId':_0x46d49c['VoicePrefixId']});});return Promise[_0x7a8f('0x9a')](_0x39c09b);}});});});return Promise[_0x7a8f('0x9a')](_0x336554)['then'](function(){return _0x564196[_0x7a8f('0x9e')](_0xda60e3,{'transaction':_0x5d75ad})['spread'](function(_0x132e7e){return _0x132e7e;});});});}})[_0x7a8f('0x47')](respondWithResult(_0x2af480,null))[_0x7a8f('0x4b')](handleError(_0x2af480,null));};exports[_0x7a8f('0x9f')]=function(_0x3763fe,_0x1992b5){var _0x57542a=_[_0x7a8f('0x83')](_0x3763fe[_0x7a8f('0x37')][_0x7a8f('0x80')])?_0x3763fe[_0x7a8f('0x37')][_0x7a8f('0x80')]:[_0x3763fe['query']['ids']];var _0x5a310b=_0x3763fe['params']['id'];return db[_0x7a8f('0x31')]['find']({'where':{'id':_0x5a310b}})[_0x7a8f('0x47')](handleEntityNotFound(_0x1992b5,null))[_0x7a8f('0x47')](function(_0x5ed0b2){if(_0x5ed0b2){var _0x41aea2=[_0x7a8f('0x84'),_0x7a8f('0xa0'),_0x7a8f('0x85'),_0x7a8f('0xa1'),'Fax',_0x7a8f('0x87'),_0x7a8f('0x88')];return db[_0x7a8f('0x5a')][_0x7a8f('0x89')](function(_0x2fa54b){var _0x2d8f73=_[_0x7a8f('0x30')](_0x41aea2,function(_0x416279){var _0x50137b={'attributes':['id',_0x7a8f('0x2e')]};return _0x5ed0b2[_0x7a8f('0x51')+_0x416279+_0x7a8f('0x7f')](_0x50137b)[_0x7a8f('0x47')](function(_0x4af53a){var _0x322bdb=_[_0x7a8f('0x30')](_0x4af53a,function(_0x1dea56){return _0x1dea56[_0x7a8f('0x9f')](_0x57542a,{'transaction':_0x2fa54b})[_0x7a8f('0x47')](function(){var _0x288b47=_[_0x7a8f('0x30')](_0x57542a,function(_0x8df7df){socket[_0x7a8f('0x8f')]('user'+_0x416279+_0x7a8f('0xa2'),{'UserId':Number(_0x8df7df),[_0x416279+'QueueId']:_0x1dea56['id']});if(_0x416279!==_0x7a8f('0x84')){return;}return db[_0x7a8f('0x95')][_0x7a8f('0x59')]({'where':{'VoiceQueueId':_0x1dea56['id'],'UserId':_0x8df7df},'transaction':_0x2fa54b});});return Promise[_0x7a8f('0x9a')](_0x288b47);});});return Promise[_0x7a8f('0x9a')](_0x322bdb);});});return Promise[_0x7a8f('0x9a')](_0x2d8f73)[_0x7a8f('0x47')](function(){return _0x5ed0b2[_0x7a8f('0x9f')](_0x57542a,{'transaction':_0x2fa54b});})[_0x7a8f('0x47')](function(){return db[_0x7a8f('0x9b')][_0x7a8f('0x76')]({'where':{'teamId':_0x5a310b}})[_0x7a8f('0x47')](function(_0x406ae4){if(_0x406ae4){var _0x490ae3=_[_0x7a8f('0x30')](_0x57542a,function(_0x4d9e09){db['UserVoicePrefix'][_0x7a8f('0x59')]({'where':{'UserId':_0x4d9e09,'VoicePrefixId':_0x406ae4[_0x7a8f('0x72')]}});});return Promise['all'](_0x490ae3);}});});});}})[_0x7a8f('0x47')](respondWithStatusCode(_0x1992b5,null))[_0x7a8f('0x4b')](handleError(_0x1992b5,null));};exports[_0x7a8f('0xa3')]=function(_0x10c0a0,_0x507043,_0xda122b){var _0x1e503d={};var _0x963f1={};var _0xc18c31;var _0x2fda0e;return db['Team'][_0x7a8f('0x76')]({'where':{'id':_0x10c0a0[_0x7a8f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x507043,null))[_0x7a8f('0x47')](function(_0x5de3a0){if(_0x5de3a0){_0xc18c31=_0x5de3a0;_0x963f1['model']=_[_0x7a8f('0x38')](db['User'][_0x7a8f('0x32')]);_0x963f1[_0x7a8f('0x37')]=_['keys'](_0x10c0a0[_0x7a8f('0x37')]);_0x963f1['filters']=_['intersection'](_0x963f1[_0x7a8f('0x36')],_0x963f1['query']);_0x1e503d['attributes']=_[_0x7a8f('0x3b')](_0x963f1[_0x7a8f('0x36')],qs[_0x7a8f('0x3c')](_0x10c0a0['query']['fields']));_0x1e503d[_0x7a8f('0x3a')]=_0x1e503d[_0x7a8f('0x3a')]['length']?_0x1e503d[_0x7a8f('0x3a')]:_0x963f1['model'];_0x1e503d[_0x7a8f('0x3f')]=qs['sort'](_0x10c0a0[_0x7a8f('0x37')]['sort']);_0x1e503d[_0x7a8f('0x41')]=qs[_0x7a8f('0x39')](_[_0x7a8f('0x42')](_0x10c0a0[_0x7a8f('0x37')],_0x963f1['filters']));if(_0x10c0a0[_0x7a8f('0x37')][_0x7a8f('0x43')]){_0x1e503d['where']=_[_0x7a8f('0x44')](_0x1e503d[_0x7a8f('0x41')],{'$or':_[_0x7a8f('0x30')](_0x1e503d[_0x7a8f('0x3a')],function(_0x3077ff){var _0x62d017={};_0x62d017[_0x3077ff]={'$like':'%'+_0x10c0a0[_0x7a8f('0x37')][_0x7a8f('0x43')]+'%'};return _0x62d017;})});}_0x1e503d=_[_0x7a8f('0x44')]({},_0x1e503d,_0x10c0a0[_0x7a8f('0x46')]);return _0xc18c31[_0x7a8f('0xa3')](_0x1e503d);}})[_0x7a8f('0x47')](function(_0x2bea3b){if(_0x2bea3b){_0x2fda0e=_0x2bea3b[_0x7a8f('0x3d')];if(!_0x10c0a0['query'][_0x7a8f('0xa4')](_0x7a8f('0x3e'))){_0x1e503d[_0x7a8f('0x24')]=qs[_0x7a8f('0x24')](_0x10c0a0[_0x7a8f('0x37')][_0x7a8f('0x24')]);_0x1e503d[_0x7a8f('0x23')]=qs['offset'](_0x10c0a0[_0x7a8f('0x37')][_0x7a8f('0x23')]);}return _0xc18c31[_0x7a8f('0xa3')](_0x1e503d);}})[_0x7a8f('0x47')](function(_0x21ed10){if(_0x21ed10){return _0x21ed10?{'count':_0x2fda0e,'rows':_0x21ed10}:null;}})[_0x7a8f('0x47')](respondWithResult(_0x507043,null))[_0x7a8f('0x4b')](handleError(_0x507043,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7f94617..f89594c 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 _0xf209=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Team','setMaxListeners','update'];(function(_0x42aa10,_0x334b06){var _0xebae1c=function(_0x34eed9){while(--_0x34eed9){_0x42aa10['push'](_0x42aa10['shift']());}};_0xebae1c(++_0x334b06);}(_0xf209,0x9b));var _0x9f20=function(_0x241eb9,_0x5ccc3f){_0x241eb9=_0x241eb9-0x0;var _0x4f916b=_0xf209[_0x241eb9];return _0x4f916b;};'use strict';var EventEmitter=require(_0x9f20('0x0'));var Team=require(_0x9f20('0x1'))['db'][_0x9f20('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x9f20('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9f20('0x4'),'afterDestroy':_0x9f20('0x5')};function emitEvent(_0x1ac43c){return function(_0x19eaed,_0x3f78da,_0x63e332){TeamEvents[_0x9f20('0x6')](_0x1ac43c+':'+_0x19eaed['id'],_0x19eaed);TeamEvents[_0x9f20('0x6')](_0x1ac43c,_0x19eaed);_0x63e332(null);};}for(var e in events){if(events[_0x9f20('0x7')](e)){var event=events[e];Team[_0x9f20('0x8')](e,emitEvent(event));}}module[_0x9f20('0x9')]=TeamEvents; \ No newline at end of file +var _0x0033=['update','remove','emit','hasOwnProperty','hook','events','Team','setMaxListeners','save'];(function(_0x24580b,_0x3f1f93){var _0x3163dc=function(_0x5305f1){while(--_0x5305f1){_0x24580b['push'](_0x24580b['shift']());}};_0x3163dc(++_0x3f1f93);}(_0x0033,0x1c7));var _0x3003=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0x0033[_0x3eee78];return _0x53a5e5;};'use strict';var EventEmitter=require(_0x3003('0x0'));var Team=require('../../mysqldb')['db'][_0x3003('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x3003('0x2')](0x0);var events={'afterCreate':_0x3003('0x3'),'afterUpdate':_0x3003('0x4'),'afterDestroy':_0x3003('0x5')};function emitEvent(_0x29f156){return function(_0xa9a726,_0x525d7d,_0x26761a){TeamEvents[_0x3003('0x6')](_0x29f156+':'+_0xa9a726['id'],_0xa9a726);TeamEvents[_0x3003('0x6')](_0x29f156,_0xa9a726);_0x26761a(null);};}for(var e in events){if(events[_0x3003('0x7')](e)){var event=events[e];Team[_0x3003('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 052c1d2..1e5c3f8 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 _0x07cd=['Mail','Openchannel','Sms','resolve','all','lodash','get','Queues','then','map','channel','catch','exports','define','Team','Fax'];(function(_0x20b4bd,_0x313899){var _0x4677c0=function(_0x364cc0){while(--_0x364cc0){_0x20b4bd['push'](_0x20b4bd['shift']());}};_0x4677c0(++_0x313899);}(_0x07cd,0x115));var _0xd07c=function(_0x4c2623,_0x4838bb){_0x4c2623=_0x4c2623-0x0;var _0x2be431=_0x07cd[_0x4c2623];return _0x2be431;};'use strict';var _=require(_0xd07c('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x16f02c,_0x54c944){var _0x4cfe2c=_0xd07c('0x1')+_0x54c944+_0xd07c('0x2');return _0x16f02c[_0x4cfe2c]()[_0xd07c('0x3')](function(_0x587655){return _[_0xd07c('0x4')](_0x587655,function(_0x35c467){_0x35c467['setDataValue'](_0xd07c('0x5'),_0x54c944);return _0x35c467;});})[_0xd07c('0x6')](function(_0x1acdf1){throw _0x1acdf1;});}module[_0xd07c('0x7')]=function(_0x167f6a){return _0x167f6a[_0xd07c('0x8')](_0xd07c('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x23f32a=this;var _0x59271d=['Chat',_0xd07c('0xa'),_0xd07c('0xb'),_0xd07c('0xc'),_0xd07c('0xd'),'Voice','Whatsapp'];return Promise[_0xd07c('0xe')]()['then'](function(){var _0x5de9da=_[_0xd07c('0x4')](_0x59271d,function(_0x136ebd){return getQueuesByChannel(_0x23f32a,_0x136ebd);});return Promise[_0xd07c('0xf')](_0x5de9da);})['catch'](function(_0xecb5cd){throw _0xecb5cd;});}}});}; \ No newline at end of file +var _0x5e18=['map','setDataValue','channel','catch','exports','Team','teams','Chat','Fax','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','Queues','then'];(function(_0x203a0b,_0x583c98){var _0x590daf=function(_0xe79875){while(--_0xe79875){_0x203a0b['push'](_0x203a0b['shift']());}};_0x590daf(++_0x583c98);}(_0x5e18,0xf3));var _0x85e1=function(_0x170c8b,_0x356ef8){_0x170c8b=_0x170c8b-0x0;var _0x118ab0=_0x5e18[_0x170c8b];return _0x118ab0;};'use strict';var _=require(_0x85e1('0x0'));var attributes=require(_0x85e1('0x1'));function getQueuesByChannel(_0x46c230,_0x4a75d4){var _0x4d60af='get'+_0x4a75d4+_0x85e1('0x2');return _0x46c230[_0x4d60af]()[_0x85e1('0x3')](function(_0xe31a6b){return _[_0x85e1('0x4')](_0xe31a6b,function(_0x4b3945){_0x4b3945[_0x85e1('0x5')](_0x85e1('0x6'),_0x4a75d4);return _0x4b3945;});})[_0x85e1('0x7')](function(_0x202bb6){throw _0x202bb6;});}module[_0x85e1('0x8')]=function(_0x54853f){return _0x54853f['define'](_0x85e1('0x9'),attributes,{'tableName':_0x85e1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x510813=this;var _0x40004f=[_0x85e1('0xb'),_0x85e1('0xc'),'Mail',_0x85e1('0xd'),_0x85e1('0xe'),_0x85e1('0xf'),_0x85e1('0x10')];return Promise[_0x85e1('0x11')]()['then'](function(){var _0xfc4df6=_[_0x85e1('0x4')](_0x40004f,function(_0x5ab427){return getQueuesByChannel(_0x510813,_0x5ab427);});return Promise[_0x85e1('0x12')](_0xfc4df6);})[_0x85e1('0x7')](function(_0x2bb68e){throw _0x2bb68e;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 81090e4..a64b4ce 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 _0x7e34=['code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./team.socket','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x40b66c,_0x578758){var _0x2fd22b=function(_0x3b721b){while(--_0x3b721b){_0x40b66c['push'](_0x40b66c['shift']());}};_0x2fd22b(++_0x578758);}(_0x7e34,0x87));var _0x47e3=function(_0x4bffe3,_0x35a43b){_0x4bffe3=_0x4bffe3-0x0;var _0x56e020=_0x7e34[_0x4bffe3];return _0x56e020;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x47e3('0x0'));var rs=require(_0x47e3('0x1'));var fs=require('fs');var Redis=require(_0x47e3('0x2'));var db=require(_0x47e3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x47e3('0x4'))(_0x47e3('0x5'));var config=require(_0x47e3('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x47e3('0x7')]({'port':0x232a});config['redis']=_[_0x47e3('0x8')](config[_0x47e3('0x9')],{'host':_0x47e3('0xa'),'port':0x18eb});var socket=require(_0x47e3('0xb'))(new Redis(config['redis']));require(_0x47e3('0xc'))['register'](socket);function respondWithRpcPromise(_0x3e09ef,_0x469361,_0x46938e){return new BPromise(function(_0x59fd7d,_0x4bace5){return client[_0x47e3('0xd')](_0x3e09ef,_0x46938e)[_0x47e3('0xe')](function(_0x50e02b){logger['info'](_0x47e3('0xf'),_0x469361,_0x47e3('0x10'));logger[_0x47e3('0x11')](_0x47e3('0x12'),_0x469361,_0x47e3('0x10'),JSON[_0x47e3('0x13')](_0x50e02b));if(_0x50e02b[_0x47e3('0x14')]){if(_0x50e02b[_0x47e3('0x14')][_0x47e3('0x15')]===0x1f4){logger['error'](_0x47e3('0xf'),_0x469361,_0x50e02b['error'][_0x47e3('0x16')]);return _0x4bace5(_0x50e02b[_0x47e3('0x14')]['message']);}logger[_0x47e3('0x14')](_0x47e3('0xf'),_0x469361,_0x50e02b[_0x47e3('0x14')]['message']);return _0x59fd7d(_0x50e02b[_0x47e3('0x14')][_0x47e3('0x16')]);}else{logger[_0x47e3('0x17')](_0x47e3('0xf'),_0x469361,'request\x20sent');_0x59fd7d(_0x50e02b[_0x47e3('0x18')][_0x47e3('0x16')]);}})[_0x47e3('0x19')](function(_0x4cc9c5){logger['error'](_0x47e3('0xf'),_0x469361,_0x4cc9c5);_0x4bace5(_0x4cc9c5);});});} \ No newline at end of file +var _0x781b=['defaults','localhost','socket.io-emitter','./team.socket','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../config/utils','../../config/logger','client','http','redis'];(function(_0x356270,_0x5e94a1){var _0x31a942=function(_0x4c804b){while(--_0x4c804b){_0x356270['push'](_0x356270['shift']());}};_0x31a942(++_0x5e94a1);}(_0x781b,0xf5));var _0xb781=function(_0x5b89a0,_0x315a2a){_0x5b89a0=_0x5b89a0-0x0;var _0x44d81a=_0x781b[_0x5b89a0];return _0x44d81a;};'use strict';var _=require(_0xb781('0x0'));var util=require('util');var moment=require(_0xb781('0x1'));var BPromise=require(_0xb781('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb781('0x3'));var logger=require(_0xb781('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb781('0x5')][_0xb781('0x6')]({'port':0x232a});config[_0xb781('0x7')]=_[_0xb781('0x8')](config[_0xb781('0x7')],{'host':_0xb781('0x9'),'port':0x18eb});var socket=require(_0xb781('0xa'))(new Redis(config[_0xb781('0x7')]));require(_0xb781('0xb'))['register'](socket);function respondWithRpcPromise(_0x542205,_0x43066b,_0x4b503a){return new BPromise(function(_0x18119f,_0x4b187c){return client['request'](_0x542205,_0x4b503a)[_0xb781('0xc')](function(_0x329b12){logger[_0xb781('0xd')]('Team,\x20%s,\x20%s',_0x43066b,_0xb781('0xe'));logger[_0xb781('0xf')](_0xb781('0x10'),_0x43066b,'request\x20sent',JSON[_0xb781('0x11')](_0x329b12));if(_0x329b12[_0xb781('0x12')]){if(_0x329b12['error'][_0xb781('0x13')]===0x1f4){logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x329b12['error'][_0xb781('0x15')]);return _0x4b187c(_0x329b12[_0xb781('0x12')][_0xb781('0x15')]);}logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x329b12[_0xb781('0x12')][_0xb781('0x15')]);return _0x18119f(_0x329b12[_0xb781('0x12')]['message']);}else{logger[_0xb781('0xd')](_0xb781('0x14'),_0x43066b,'request\x20sent');_0x18119f(_0x329b12[_0xb781('0x16')][_0xb781('0x15')]);}})['catch'](function(_0x4023cf){logger[_0xb781('0x12')](_0xb781('0x14'),_0x43066b,_0x4023cf);_0x4b187c(_0x4023cf);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index ed0721b..743676c 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 _0x5453=['save','remove','update','removeListener','team:','./team.events'];(function(_0x130d34,_0xb829c2){var _0x3bf5d2=function(_0x279065){while(--_0x279065){_0x130d34['push'](_0x130d34['shift']());}};_0x3bf5d2(++_0xb829c2);}(_0x5453,0x18b));var _0x3545=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5453[_0x2c91e9];return _0x13f0ff;};'use strict';var TeamEvents=require(_0x3545('0x0'));var events=[_0x3545('0x1'),_0x3545('0x2'),_0x3545('0x3')];function createListener(_0x14b021,_0x2fffbe){return function(_0x34b051){_0x2fffbe['emit'](_0x14b021,_0x34b051);};}function removeListener(_0x5bcdad,_0x28e4b7){return function(){TeamEvents[_0x3545('0x4')](_0x5bcdad,_0x28e4b7);};}exports['register']=function(_0x22a172){for(var _0x59ce7b=0x0,_0x290aa5=events['length'];_0x59ce7b<_0x290aa5;_0x59ce7b++){var _0x5d5808=events[_0x59ce7b];var _0x2974ae=createListener(_0x3545('0x5')+_0x5d5808,_0x22a172);TeamEvents['on'](_0x5d5808,_0x2974ae);}}; \ No newline at end of file +var _0x1c19=['./team.events','save','remove','removeListener','register','length'];(function(_0x1c4863,_0x426495){var _0x2678cb=function(_0x1dfb7a){while(--_0x1dfb7a){_0x1c4863['push'](_0x1c4863['shift']());}};_0x2678cb(++_0x426495);}(_0x1c19,0x1f2));var _0x91c1=function(_0x598b5d,_0x3f4d1e){_0x598b5d=_0x598b5d-0x0;var _0x54ab06=_0x1c19[_0x598b5d];return _0x54ab06;};'use strict';var TeamEvents=require(_0x91c1('0x0'));var events=[_0x91c1('0x1'),_0x91c1('0x2'),'update'];function createListener(_0x3d2df6,_0x44a264){return function(_0x546ff1){_0x44a264['emit'](_0x3d2df6,_0x546ff1);};}function removeListener(_0x31f1da,_0x5a8654){return function(){TeamEvents[_0x91c1('0x3')](_0x31f1da,_0x5a8654);};}exports[_0x91c1('0x4')]=function(_0x105260){for(var _0xc05b49=0x0,_0x1a2ff5=events[_0x91c1('0x5')];_0xc05b49<_0x1a2ff5;_0xc05b49++){var _0x2a60b1=events[_0xc05b49];var _0x5ca804=createListener('team:'+_0x2a60b1,_0x105260);TeamEvents['on'](_0x2a60b1,_0x5ca804);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 3930adb..57cd6f7 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 _0x7d19=['sequelize','INTEGER'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7d19,0x9e));var _0x97d1=function(_0x5c3ea5,_0xa9ed0c){_0x5c3ea5=_0x5c3ea5-0x0;var _0x102b61=_0x7d19[_0x5c3ea5];return _0x102b61;};'use strict';var Sequelize=require(_0x97d1('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x97d1('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x97d1('0x1')]}}; \ No newline at end of file +var _0xb7d1=['INTEGER','sequelize','exports'];(function(_0x8721e7,_0xae8693){var _0x5835c3=function(_0xd87e01){while(--_0xd87e01){_0x8721e7['push'](_0x8721e7['shift']());}};_0x5835c3(++_0xae8693);}(_0xb7d1,0x79));var _0x1b7d=function(_0x25f77c,_0x4d2cd2){_0x25f77c=_0x25f77c-0x0;var _0x282076=_0xb7d1[_0x25f77c];return _0x282076;};'use strict';var Sequelize=require(_0x1b7d('0x0'));module[_0x1b7d('0x1')]={'TeamId':{'type':Sequelize[_0x1b7d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x1b7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 7bf8664..c233488 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 _0x4e65=['api','moment','bluebird','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x57c2f6,_0x1ee1bf){var _0x1cbd95=function(_0x295da4){while(--_0x295da4){_0x57c2f6['push'](_0x57c2f6['shift']());}};_0x1cbd95(++_0x1ee1bf);}(_0x4e65,0xc4));var _0x54e6=function(_0x51078e,_0x1c14d4){_0x51078e=_0x51078e-0x0;var _0x5cb65b=_0x4e65[_0x51078e];return _0x5cb65b;};'use strict';var _=require('lodash');var util=require(_0x54e6('0x0'));var logger=require(_0x54e6('0x1'))(_0x54e6('0x2'));var moment=require(_0x54e6('0x3'));var BPromise=require(_0x54e6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54e6('0x5'));var config=require(_0x54e6('0x6'));var attributes=require(_0x54e6('0x7'));module[_0x54e6('0x8')]=function(_0x23b09a,_0x5d1ffc){return _0x23b09a[_0x54e6('0x9')]('TeamVoicePrefix',attributes,{'tableName':_0x54e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6594=['exports','define','team_has_voice_prefixes','moment','bluebird','request-promise','path','rimraf'];(function(_0x139646,_0x15679b){var _0xe03c7c=function(_0x70a09c){while(--_0x70a09c){_0x139646['push'](_0x139646['shift']());}};_0xe03c7c(++_0x15679b);}(_0x6594,0xcb));var _0x4659=function(_0x4271f1,_0xdbdc80){_0x4271f1=_0x4271f1-0x0;var _0x1bc9c9=_0x6594[_0x4271f1];return _0x1bc9c9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4659('0x0'));var BPromise=require(_0x4659('0x1'));var rp=require(_0x4659('0x2'));var fs=require('fs');var path=require(_0x4659('0x3'));var rimraf=require(_0x4659('0x4'));var config=require('../../config/environment');var attributes=require('./teamVoicePrefix.attributes');module[_0x4659('0x5')]=function(_0x2f59ce,_0x246729){return _0x2f59ce[_0x4659('0x6')]('TeamVoicePrefix',attributes,{'tableName':_0x4659('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 8b248dd..7f51c65 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x476123,_0x47b9cc){var _0x5ca23f=function(_0x44d115){while(--_0x44d115){_0x476123['push'](_0x476123['shift']());}};_0x5ca23f(++_0x47b9cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x57efb6,_0x576b58){var _0x4a0e03=function(_0xa82ee2){while(--_0xa82ee2){_0x57efb6['push'](_0x57efb6['shift']());}};_0x4a0e03(++_0x576b58);}(_0x70e0,0x17b));var _0x070e=function(_0x18309c,_0x566741){_0x18309c=_0x18309c-0x0;var _0x45d46b=_0x70e0[_0x18309c];return _0x45d46b;};'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 46f7413..c655946 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 _0xf45b=['sequelize','exports','INTEGER'];(function(_0x328cf7,_0x2c7d51){var _0x9e596d=function(_0x70e533){while(--_0x70e533){_0x328cf7['push'](_0x328cf7['shift']());}};_0x9e596d(++_0x2c7d51);}(_0xf45b,0x13e));var _0xbf45=function(_0x5a9776,_0x4b5ab3){_0x5a9776=_0x5a9776-0x0;var _0x454edb=_0xf45b[_0x5a9776];return _0x454edb;};'use strict';var Sequelize=require(_0xbf45('0x0'));module[_0xbf45('0x1')]={'penalty':{'type':Sequelize[_0xbf45('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc6bd=['INTEGER','exports'];(function(_0x27af39,_0x5ba0c2){var _0x3cc625=function(_0x336cca){while(--_0x336cca){_0x27af39['push'](_0x27af39['shift']());}};_0x3cc625(++_0x5ba0c2);}(_0xc6bd,0x1e9));var _0xdc6b=function(_0xf5690a,_0x47949d){_0xf5690a=_0xf5690a-0x0;var _0x3e684e=_0xc6bd[_0xf5690a];return _0x3e684e;};'use strict';var Sequelize=require('sequelize');module[_0xdc6b('0x0')]={'penalty':{'type':Sequelize[_0xdc6b('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 5b5f22c..ea7005c 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 _0xbacb=['rimraf','exports','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x1b1948,_0x49f451){var _0x3cbd38=function(_0x2ca4f2){while(--_0x2ca4f2){_0x1b1948['push'](_0x1b1948['shift']());}};_0x3cbd38(++_0x49f451);}(_0xbacb,0x1a6));var _0xbbac=function(_0x53f0db,_0x35c67c){_0x53f0db=_0x53f0db-0x0;var _0xae0a5c=_0xbacb[_0x53f0db];return _0xae0a5c;};'use strict';var _=require(_0xbbac('0x0'));var util=require(_0xbbac('0x1'));var logger=require('../../config/logger')(_0xbbac('0x2'));var moment=require(_0xbbac('0x3'));var BPromise=require(_0xbbac('0x4'));var rp=require(_0xbbac('0x5'));var fs=require('fs');var path=require(_0xbbac('0x6'));var rimraf=require(_0xbbac('0x7'));var config=require('../../config/environment');var attributes=require('./teamVoiceQueue.attributes');module[_0xbbac('0x8')]=function(_0x2b9236,_0x210763){return _0x2b9236[_0xbbac('0x9')]('TeamVoiceQueue',attributes,{'tableName':_0xbbac('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f94=['path','rimraf','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x39dec1,_0x55be61){var _0x1f3325=function(_0x86633e){while(--_0x86633e){_0x39dec1['push'](_0x39dec1['shift']());}};_0x1f3325(++_0x55be61);}(_0x9f94,0x1e7));var _0x49f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x9f94[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x49f9('0x0'));var util=require(_0x49f9('0x1'));var logger=require(_0x49f9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x49f9('0x3'));var rp=require(_0x49f9('0x4'));var fs=require('fs');var path=require(_0x49f9('0x5'));var rimraf=require(_0x49f9('0x6'));var config=require(_0x49f9('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0x49f9('0x8')]=function(_0x31a7fe,_0x3cd35a){return _0x31a7fe[_0x49f9('0x9')](_0x49f9('0xa'),attributes,{'tableName':_0x49f9('0xb'),'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 02064bd..01336d4 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 _0x87a4=['rpc','../../config/environment','jayson/promise','client','then','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','randomstring','ioredis'];(function(_0x5c2278,_0x5e1e08){var _0x482004=function(_0xb56a0e){while(--_0xb56a0e){_0x5c2278['push'](_0x5c2278['shift']());}};_0x482004(++_0x5e1e08);}(_0x87a4,0x12e));var _0x487a=function(_0x5bae43,_0xdc3682){_0x5bae43=_0x5bae43-0x0;var _0x5f1277=_0x87a4[_0x5bae43];return _0x5f1277;};'use strict';var _=require(_0x487a('0x0'));var util=require(_0x487a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x487a('0x2'));var fs=require('fs');var Redis=require(_0x487a('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x487a('0x4'));var config=require(_0x487a('0x5'));var jayson=require(_0x487a('0x6'));var client=jayson[_0x487a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x319a5c,_0x356a3e,_0x3a1e6f){return new BPromise(function(_0x17d0e2,_0x533969){return client['request'](_0x319a5c,_0x3a1e6f)[_0x487a('0x8')](function(_0xbb05cc){logger['info'](_0x487a('0x9'),_0x356a3e,_0x487a('0xa'));logger[_0x487a('0xb')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x356a3e,_0x487a('0xa'),JSON['stringify'](_0xbb05cc));if(_0xbb05cc[_0x487a('0xc')]){if(_0xbb05cc['error'][_0x487a('0xd')]===0x1f4){logger[_0x487a('0xc')](_0x487a('0x9'),_0x356a3e,_0xbb05cc['error']['message']);return _0x533969(_0xbb05cc['error'][_0x487a('0xe')]);}logger['error'](_0x487a('0x9'),_0x356a3e,_0xbb05cc[_0x487a('0xc')][_0x487a('0xe')]);return _0x17d0e2(_0xbb05cc[_0x487a('0xc')][_0x487a('0xe')]);}else{logger[_0x487a('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x356a3e,_0x487a('0xa'));_0x17d0e2(_0xbb05cc[_0x487a('0x10')][_0x487a('0xe')]);}})[_0x487a('0x11')](function(_0x167346){logger['error'](_0x487a('0x9'),_0x356a3e,_0x167346);_0x533969(_0x167346);});});} \ No newline at end of file +var _0xff96=['TeamVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3caa84,_0x7e8d4e){var _0x5235bd=function(_0x194834){while(--_0x194834){_0x3caa84['push'](_0x3caa84['shift']());}};_0x5235bd(++_0x7e8d4e);}(_0xff96,0x179));var _0x6ff9=function(_0x15f43a,_0x57c8b5){_0x15f43a=_0x15f43a-0x0;var _0x2369bc=_0xff96[_0x15f43a];return _0x2369bc;};'use strict';var _=require(_0x6ff9('0x0'));var util=require(_0x6ff9('0x1'));var moment=require(_0x6ff9('0x2'));var BPromise=require(_0x6ff9('0x3'));var rs=require(_0x6ff9('0x4'));var fs=require('fs');var Redis=require(_0x6ff9('0x5'));var db=require(_0x6ff9('0x6'))['db'];var utils=require(_0x6ff9('0x7'));var logger=require(_0x6ff9('0x8'))(_0x6ff9('0x9'));var config=require(_0x6ff9('0xa'));var jayson=require(_0x6ff9('0xb'));var client=jayson['client'][_0x6ff9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5509ee,_0x502cf2,_0x4f982b){return new BPromise(function(_0x5d56f4,_0x2b1b7d){return client[_0x6ff9('0xd')](_0x5509ee,_0x4f982b)[_0x6ff9('0xe')](function(_0x1ce5a3){logger[_0x6ff9('0xf')]('TeamVoiceQueue,\x20%s,\x20%s',_0x502cf2,_0x6ff9('0x10'));logger[_0x6ff9('0x11')](_0x6ff9('0x12'),_0x502cf2,_0x6ff9('0x10'),JSON[_0x6ff9('0x13')](_0x1ce5a3));if(_0x1ce5a3[_0x6ff9('0x14')]){if(_0x1ce5a3[_0x6ff9('0x14')][_0x6ff9('0x15')]===0x1f4){logger[_0x6ff9('0x14')]('TeamVoiceQueue,\x20%s,\x20%s',_0x502cf2,_0x1ce5a3['error'][_0x6ff9('0x16')]);return _0x2b1b7d(_0x1ce5a3['error'][_0x6ff9('0x16')]);}logger[_0x6ff9('0x14')](_0x6ff9('0x17'),_0x502cf2,_0x1ce5a3['error']['message']);return _0x5d56f4(_0x1ce5a3[_0x6ff9('0x14')][_0x6ff9('0x16')]);}else{logger[_0x6ff9('0xf')](_0x6ff9('0x17'),_0x502cf2,'request\x20sent');_0x5d56f4(_0x1ce5a3['result'][_0x6ff9('0x16')]);}})[_0x6ff9('0x18')](function(_0x3d4268){logger[_0x6ff9('0x14')](_0x6ff9('0x17'),_0x502cf2,_0x3d4268);_0x2b1b7d(_0x3d4268);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 97a2f1e..12184e1 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 _0x3c91=['show','post','create','update','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x42864e,_0x2562fe){var _0x20840b=function(_0xf3caf1){while(--_0xf3caf1){_0x42864e['push'](_0x42864e['shift']());}};_0x20840b(++_0x2562fe);}(_0x3c91,0x1af));var _0x13c9=function(_0x812ca4,_0x2348d0){_0x812ca4=_0x812ca4-0x0;var _0x28b699=_0x3c91[_0x812ca4];return _0x28b699;};'use strict';var multer=require(_0x13c9('0x0'));var util=require(_0x13c9('0x1'));var path=require(_0x13c9('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x13c9('0x3')]();var fs_extra=require(_0x13c9('0x4'));var auth=require(_0x13c9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x13c9('0x6'));var controller=require(_0x13c9('0x7'));router[_0x13c9('0x8')]('/',auth[_0x13c9('0x9')](),controller[_0x13c9('0xa')]);router['get']('/:id',auth[_0x13c9('0x9')](),controller[_0x13c9('0xb')]);router[_0x13c9('0xc')]('/',auth[_0x13c9('0x9')](),controller[_0x13c9('0xd')]);router['put']('/:id',auth[_0x13c9('0x9')](),controller[_0x13c9('0xe')]);router['delete']('/:id',auth[_0x13c9('0x9')](),controller[_0x13c9('0xf')]);module[_0x13c9('0x10')]=router; \ No newline at end of file +var _0x323f=['../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x21f2a6,_0x418f76){var _0x69238f=function(_0x144e7a){while(--_0x144e7a){_0x21f2a6['push'](_0x21f2a6['shift']());}};_0x69238f(++_0x418f76);}(_0x323f,0x1ee));var _0xf323=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x323f[_0x46aff0];return _0x9d78cf;};'use strict';var multer=require('multer');var util=require(_0xf323('0x0'));var path=require('path');var timeout=require(_0xf323('0x1'));var express=require(_0xf323('0x2'));var router=express[_0xf323('0x3')]();var fs_extra=require(_0xf323('0x4'));var auth=require(_0xf323('0x5'));var interaction=require(_0xf323('0x6'));var config=require(_0xf323('0x7'));var controller=require(_0xf323('0x8'));router[_0xf323('0x9')]('/',auth[_0xf323('0xa')](),controller['index']);router[_0xf323('0x9')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0xc')]);router[_0xf323('0xd')]('/',auth[_0xf323('0xa')](),controller[_0xf323('0xe')]);router[_0xf323('0xf')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x10')]);router[_0xf323('0x11')](_0xf323('0xb'),auth[_0xf323('0xa')](),controller[_0xf323('0x12')]);module[_0xf323('0x13')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 9b6fa6d..d9d4062 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 _0x8707=['TEXT','sequelize','STRING'];(function(_0x14cd29,_0x1b8dfc){var _0x1de2d5=function(_0x11e2ef){while(--_0x11e2ef){_0x14cd29['push'](_0x14cd29['shift']());}};_0x1de2d5(++_0x1b8dfc);}(_0x8707,0x17e));var _0x7870=function(_0x2f9e28,_0x5867d3){_0x2f9e28=_0x2f9e28-0x0;var _0x57e774=_0x8707[_0x2f9e28];return _0x57e774;};'use strict';var Sequelize=require(_0x7870('0x0'));module['exports']={'name':{'type':Sequelize[_0x7870('0x1')]},'description':{'type':Sequelize[_0x7870('0x1')]},'html':{'type':Sequelize[_0x7870('0x2')]}}; \ No newline at end of file +var _0x8241=['STRING','TEXT','sequelize','exports'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x8241,0x13e));var _0x1824=function(_0xbf05fc,_0x2d2584){_0xbf05fc=_0xbf05fc-0x0;var _0xc402d3=_0x8241[_0xbf05fc];return _0xc402d3;};'use strict';var Sequelize=require(_0x1824('0x0'));module[_0x1824('0x1')]={'name':{'type':Sequelize[_0x1824('0x2')]},'description':{'type':Sequelize[_0x1824('0x2')]},'html':{'type':Sequelize[_0x1824('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 4ff7c45..eea0131 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 _0xabfe=['include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','error','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','get','Templates','UserProfileResource','destroy','stack','name','index','rawAttributes','type','map','query','keys','intersection','attributes','fields','length','model','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','Template','includeAll'];(function(_0x3ad2e5,_0x94d414){var _0xc4e565=function(_0x2c96e3){while(--_0x2c96e3){_0x3ad2e5['push'](_0x3ad2e5['shift']());}};_0xc4e565(++_0x94d414);}(_0xabfe,0x146));var _0xeabf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabfe[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeabf('0x0'));var jsonpatch=require(_0xeabf('0x1'));var rp=require('request-promise');var moment=require(_0xeabf('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xeabf('0x3'));var util=require(_0xeabf('0x4'));var path=require(_0xeabf('0x5'));var sox=require('sox');var csv=require(_0xeabf('0x6'));var ejs=require(_0xeabf('0x7'));var fs=require('fs');var fs_extra=require(_0xeabf('0x8'));var _=require(_0xeabf('0x9'));var squel=require('squel');var crypto=require(_0xeabf('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xeabf('0xb'));var Papa=require(_0xeabf('0xc'));var Redis=require(_0xeabf('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xeabf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xeabf('0xf'))(_0xeabf('0x10'));var utils=require(_0xeabf('0x11'));var config=require(_0xeabf('0x12'));var licenseUtil=require(_0xeabf('0x13'));var db=require(_0xeabf('0x14'))['db'];function respondWithStatusCode(_0x59c404,_0x47eea8){_0x47eea8=_0x47eea8||0xcc;return function(_0x1ff389){if(_0x1ff389){return _0x59c404[_0xeabf('0x15')](_0x47eea8);}return _0x59c404[_0xeabf('0x16')](_0x47eea8)[_0xeabf('0x17')]();};}function respondWithResult(_0x5649c8,_0x26e6ed){_0x26e6ed=_0x26e6ed||0xc8;return function(_0x3df2c6){if(_0x3df2c6){return _0x5649c8[_0xeabf('0x16')](_0x26e6ed)[_0xeabf('0x18')](_0x3df2c6);}};}function respondWithFilteredResult(_0x313221,_0x3d83e3){return function(_0x4b8e21){if(_0x4b8e21){var _0x157df4=typeof _0x3d83e3[_0xeabf('0x19')]===_0xeabf('0x1a')&&typeof _0x3d83e3[_0xeabf('0x1b')]==='undefined';var _0x4e37ae=_0x4b8e21[_0xeabf('0x1c')];var _0x34c764=_0x157df4?0x0:_0x3d83e3[_0xeabf('0x19')];var _0x220bfa=_0x157df4?_0x4b8e21[_0xeabf('0x1c')]:_0x3d83e3[_0xeabf('0x19')]+_0x3d83e3[_0xeabf('0x1b')];var _0x3fde02;if(_0x220bfa>=_0x4e37ae){_0x220bfa=_0x4e37ae;_0x3fde02=0xc8;}else{_0x3fde02=0xce;}_0x313221['status'](_0x3fde02);return _0x313221[_0xeabf('0x1d')](_0xeabf('0x1e'),_0x34c764+'-'+_0x220bfa+'/'+_0x4e37ae)['json'](_0x4b8e21);}return null;};}function patchUpdates(_0x5dc8f2){return function(_0x338a0b){try{jsonpatch['apply'](_0x338a0b,_0x5dc8f2,!![]);}catch(_0xf78ba2){return BPromise[_0xeabf('0x1f')](_0xf78ba2);}return _0x338a0b[_0xeabf('0x20')]();};}function saveUpdates(_0x277ff4,_0x532575){return function(_0x113c55){if(_0x113c55){return _0x113c55[_0xeabf('0x21')](_0x277ff4)['then'](function(_0x4d37a7){return _0x4d37a7;});}return null;};}function removeEntity(_0x320c50,_0x5e722b){return function(_0x43af11){if(_0x43af11){return _0x43af11['destroy']()[_0xeabf('0x22')](function(){var _0x3c05b1=_0x43af11[_0xeabf('0x23')]({'plain':!![]});var _0xdb5f86=_0xeabf('0x24');return db[_0xeabf('0x25')][_0xeabf('0x26')]({'where':{'type':_0xdb5f86,'resourceId':_0x3c05b1['id']}})['then'](function(){return _0x43af11;});})[_0xeabf('0x22')](function(){_0x320c50[_0xeabf('0x16')](0xcc)[_0xeabf('0x17')]();});}};}function handleEntityNotFound(_0x2af80c,_0x50b4db){return function(_0x425026){if(!_0x425026){_0x2af80c[_0xeabf('0x15')](0x194);}return _0x425026;};}function handleError(_0x1c1193,_0x5c46ab){_0x5c46ab=_0x5c46ab||0x1f4;return function(_0xfdf102){logger['error'](_0xfdf102[_0xeabf('0x27')]);if(_0xfdf102[_0xeabf('0x28')]){delete _0xfdf102['name'];}_0x1c1193[_0xeabf('0x16')](_0x5c46ab)['send'](_0xfdf102);};}exports[_0xeabf('0x29')]=function(_0x4a7519,_0x2fa82c){var _0x5e47d2={},_0xc28b77={},_0x2cde2f={'count':0x0,'rows':[]};var _0x129227=_['map'](db['Template'][_0xeabf('0x2a')],function(_0x26c87f){return{'name':_0x26c87f['fieldName'],'type':_0x26c87f[_0xeabf('0x2b')]['key']};});_0xc28b77['model']=_[_0xeabf('0x2c')](_0x129227,'name');_0xc28b77[_0xeabf('0x2d')]=_[_0xeabf('0x2e')](_0x4a7519[_0xeabf('0x2d')]);_0xc28b77['filters']=_[_0xeabf('0x2f')](_0xc28b77['model'],_0xc28b77[_0xeabf('0x2d')]);_0x5e47d2[_0xeabf('0x30')]=_['intersection'](_0xc28b77['model'],qs[_0xeabf('0x31')](_0x4a7519[_0xeabf('0x2d')]['fields']));_0x5e47d2[_0xeabf('0x30')]=_0x5e47d2[_0xeabf('0x30')][_0xeabf('0x32')]?_0x5e47d2[_0xeabf('0x30')]:_0xc28b77[_0xeabf('0x33')];if(!_0x4a7519[_0xeabf('0x2d')]['hasOwnProperty'](_0xeabf('0x34'))){_0x5e47d2[_0xeabf('0x1b')]=qs[_0xeabf('0x1b')](_0x4a7519[_0xeabf('0x2d')][_0xeabf('0x1b')]);_0x5e47d2[_0xeabf('0x19')]=qs[_0xeabf('0x19')](_0x4a7519[_0xeabf('0x2d')][_0xeabf('0x19')]);}_0x5e47d2[_0xeabf('0x35')]=qs[_0xeabf('0x36')](_0x4a7519['query']['sort']);_0x5e47d2['where']=qs[_0xeabf('0x37')](_[_0xeabf('0x38')](_0x4a7519['query'],_0xc28b77[_0xeabf('0x37')]),_0x129227);if(_0x4a7519[_0xeabf('0x2d')][_0xeabf('0x39')]){_0x5e47d2[_0xeabf('0x3a')]=_[_0xeabf('0x3b')](_0x5e47d2[_0xeabf('0x3a')],{'$or':_[_0xeabf('0x2c')](_0x129227,function(_0x255d8e){if(_0x255d8e[_0xeabf('0x2b')]!==_0xeabf('0x3c')){var _0xc9cd24={};_0xc9cd24[_0x255d8e[_0xeabf('0x28')]]={'$like':'%'+_0x4a7519[_0xeabf('0x2d')][_0xeabf('0x39')]+'%'};return _0xc9cd24;}})});}_0x5e47d2=_[_0xeabf('0x3b')]({},_0x5e47d2,_0x4a7519[_0xeabf('0x3d')]);var _0x5e007b={'where':_0x5e47d2[_0xeabf('0x3a')]};return db[_0xeabf('0x3e')][_0xeabf('0x1c')](_0x5e007b)['then'](function(_0x58242d){_0x2cde2f[_0xeabf('0x1c')]=_0x58242d;if(_0x4a7519['query'][_0xeabf('0x3f')]){_0x5e47d2[_0xeabf('0x40')]=[{'all':!![]}];}return db[_0xeabf('0x3e')][_0xeabf('0x41')](_0x5e47d2);})[_0xeabf('0x22')](function(_0x340f08){_0x2cde2f['rows']=_0x340f08;return _0x2cde2f;})['then'](respondWithFilteredResult(_0x2fa82c,_0x5e47d2))[_0xeabf('0x42')](handleError(_0x2fa82c,null));};exports[_0xeabf('0x43')]=function(_0x46e069,_0x86d2fd){var _0x2d69e3={'raw':!![],'where':{'id':_0x46e069[_0xeabf('0x44')]['id']}},_0x361a56={};_0x361a56[_0xeabf('0x33')]=_['keys'](db[_0xeabf('0x3e')][_0xeabf('0x2a')]);_0x361a56[_0xeabf('0x2d')]=_[_0xeabf('0x2e')](_0x46e069[_0xeabf('0x2d')]);_0x361a56[_0xeabf('0x37')]=_[_0xeabf('0x2f')](_0x361a56[_0xeabf('0x33')],_0x361a56[_0xeabf('0x2d')]);_0x2d69e3[_0xeabf('0x30')]=_['intersection'](_0x361a56[_0xeabf('0x33')],qs[_0xeabf('0x31')](_0x46e069[_0xeabf('0x2d')][_0xeabf('0x31')]));_0x2d69e3[_0xeabf('0x30')]=_0x2d69e3[_0xeabf('0x30')][_0xeabf('0x32')]?_0x2d69e3[_0xeabf('0x30')]:_0x361a56[_0xeabf('0x33')];if(_0x46e069[_0xeabf('0x2d')][_0xeabf('0x3f')]){_0x2d69e3[_0xeabf('0x40')]=[{'all':!![]}];}_0x2d69e3=_[_0xeabf('0x3b')]({},_0x2d69e3,_0x46e069[_0xeabf('0x3d')]);return db[_0xeabf('0x3e')][_0xeabf('0x45')](_0x2d69e3)[_0xeabf('0x22')](handleEntityNotFound(_0x86d2fd,null))[_0xeabf('0x22')](respondWithResult(_0x86d2fd,null))[_0xeabf('0x42')](handleError(_0x86d2fd,null));};exports['create']=function(_0x4a9f13,_0xe651c7){return db[_0xeabf('0x3e')][_0xeabf('0x46')](_0x4a9f13[_0xeabf('0x47')],{})[_0xeabf('0x22')](function(_0x241492){var _0x5911bc=_0x4a9f13[_0xeabf('0x48')][_0xeabf('0x23')]({'plain':!![]});if(!_0x5911bc)throw new Error(_0xeabf('0x49'));if(_0x5911bc[_0xeabf('0x4a')]===_0xeabf('0x48')){var _0x3c9067=_0x241492[_0xeabf('0x23')]({'plain':!![]});var _0x317c57=_0xeabf('0x24');return db['UserProfileSection'][_0xeabf('0x45')]({'where':{'name':_0x317c57,'userProfileId':_0x5911bc[_0xeabf('0x4b')]},'raw':!![]})[_0xeabf('0x22')](function(_0x2d69c5){if(_0x2d69c5&&_0x2d69c5[_0xeabf('0x4c')]===0x0){return db[_0xeabf('0x25')][_0xeabf('0x46')]({'name':_0x3c9067[_0xeabf('0x28')],'resourceId':_0x3c9067['id'],'type':_0x2d69c5['name'],'sectionId':_0x2d69c5['id']},{})['then'](function(){return _0x241492;});}else{return _0x241492;}})[_0xeabf('0x42')](function(_0x252401){logger[_0xeabf('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x252401);throw _0x252401;});}return _0x241492;})[_0xeabf('0x22')](respondWithResult(_0xe651c7,0xc9))['catch'](handleError(_0xe651c7,null));};exports['update']=function(_0x5ec57d,_0x403a41){if(_0x5ec57d['body']['id']){delete _0x5ec57d[_0xeabf('0x47')]['id'];}return db[_0xeabf('0x3e')]['find']({'where':{'id':_0x5ec57d[_0xeabf('0x44')]['id']}})[_0xeabf('0x22')](handleEntityNotFound(_0x403a41,null))['then'](saveUpdates(_0x5ec57d[_0xeabf('0x47')],null))[_0xeabf('0x22')](respondWithResult(_0x403a41,null))[_0xeabf('0x42')](handleError(_0x403a41,null));};exports[_0xeabf('0x26')]=function(_0x57f71b,_0x181ebc){return db[_0xeabf('0x3e')][_0xeabf('0x45')]({'where':{'id':_0x57f71b['params']['id']}})[_0xeabf('0x22')](handleEntityNotFound(_0x181ebc,null))['then'](removeEntity(_0x181ebc,null))[_0xeabf('0x42')](handleError(_0x181ebc,null));}; \ No newline at end of file +var _0x73f4=['status','apply','reject','save','then','destroy','get','Templates','UserProfileResource','end','sendStatus','error','stack','send','index','map','Template','rawAttributes','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','merge','VIRTUAL','filter','options','where','includeAll','include','rows','show','keys','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count'];(function(_0x874cf1,_0x2a4954){var _0x233579=function(_0xa6e939){while(--_0xa6e939){_0x874cf1['push'](_0x874cf1['shift']());}};_0x233579(++_0x2a4954);}(_0x73f4,0x124));var _0x473f=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x73f4[_0x19159a];return _0xa677f4;};'use strict';var emlformat=require(_0x473f('0x0'));var rimraf=require(_0x473f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x473f('0x2'));var moment=require(_0x473f('0x3'));var BPromise=require(_0x473f('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x473f('0x5'));var sox=require(_0x473f('0x6'));var csv=require('to-csv');var ejs=require(_0x473f('0x7'));var fs=require('fs');var fs_extra=require(_0x473f('0x8'));var _=require('lodash');var squel=require(_0x473f('0x9'));var crypto=require('crypto');var jsforce=require(_0x473f('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x473f('0xb'));var querystring=require(_0x473f('0xc'));var Papa=require(_0x473f('0xd'));var Redis=require(_0x473f('0xe'));var authService=require(_0x473f('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x473f('0x10'));var hardwareService=require(_0x473f('0x11'));var logger=require(_0x473f('0x12'))(_0x473f('0x13'));var utils=require(_0x473f('0x14'));var config=require(_0x473f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x473f('0x16'))['db'];function respondWithStatusCode(_0x14cfd7,_0x6ffc1d){_0x6ffc1d=_0x6ffc1d||0xcc;return function(_0x5ecd53){if(_0x5ecd53){return _0x14cfd7['sendStatus'](_0x6ffc1d);}return _0x14cfd7['status'](_0x6ffc1d)['end']();};}function respondWithResult(_0x3e1cab,_0x76fc0b){_0x76fc0b=_0x76fc0b||0xc8;return function(_0x2bfc42){if(_0x2bfc42){return _0x3e1cab['status'](_0x76fc0b)[_0x473f('0x17')](_0x2bfc42);}};}function respondWithFilteredResult(_0x49406e,_0x363d27){return function(_0x162975){if(_0x162975){var _0x4209ef=typeof _0x363d27[_0x473f('0x18')]===_0x473f('0x19')&&typeof _0x363d27[_0x473f('0x1a')]===_0x473f('0x19');var _0x284fa4=_0x162975[_0x473f('0x1b')];var _0x2ee803=_0x4209ef?0x0:_0x363d27[_0x473f('0x18')];var _0x53c50a=_0x4209ef?_0x162975['count']:_0x363d27['offset']+_0x363d27[_0x473f('0x1a')];var _0x259b70;if(_0x53c50a>=_0x284fa4){_0x53c50a=_0x284fa4;_0x259b70=0xc8;}else{_0x259b70=0xce;}_0x49406e[_0x473f('0x1c')](_0x259b70);return _0x49406e['set']('Content-Range',_0x2ee803+'-'+_0x53c50a+'/'+_0x284fa4)[_0x473f('0x17')](_0x162975);}return null;};}function patchUpdates(_0x28395c){return function(_0x4506e6){try{jsonpatch[_0x473f('0x1d')](_0x4506e6,_0x28395c,!![]);}catch(_0x497269){return BPromise[_0x473f('0x1e')](_0x497269);}return _0x4506e6[_0x473f('0x1f')]();};}function saveUpdates(_0xd16e54,_0x16788b){return function(_0x43d062){if(_0x43d062){return _0x43d062['update'](_0xd16e54)[_0x473f('0x20')](function(_0x5a0b8d){return _0x5a0b8d;});}return null;};}function removeEntity(_0x182e94,_0x319a03){return function(_0x55f99f){if(_0x55f99f){return _0x55f99f[_0x473f('0x21')]()[_0x473f('0x20')](function(){var _0x1b4e7c=_0x55f99f[_0x473f('0x22')]({'plain':!![]});var _0x1b126d=_0x473f('0x23');return db[_0x473f('0x24')][_0x473f('0x21')]({'where':{'type':_0x1b126d,'resourceId':_0x1b4e7c['id']}})[_0x473f('0x20')](function(){return _0x55f99f;});})['then'](function(){_0x182e94[_0x473f('0x1c')](0xcc)[_0x473f('0x25')]();});}};}function handleEntityNotFound(_0x5dba85,_0x21f6bb){return function(_0x37ea68){if(!_0x37ea68){_0x5dba85[_0x473f('0x26')](0x194);}return _0x37ea68;};}function handleError(_0xb61772,_0x68a0c3){_0x68a0c3=_0x68a0c3||0x1f4;return function(_0x544bca){logger[_0x473f('0x27')](_0x544bca[_0x473f('0x28')]);if(_0x544bca['name']){delete _0x544bca['name'];}_0xb61772[_0x473f('0x1c')](_0x68a0c3)[_0x473f('0x29')](_0x544bca);};}exports[_0x473f('0x2a')]=function(_0x3e28ee,_0x3aeada){var _0x46b5bc={},_0x1136ad={},_0x4ced33={'count':0x0,'rows':[]};var _0x305308=_[_0x473f('0x2b')](db[_0x473f('0x2c')][_0x473f('0x2d')],function(_0x2ab97a){return{'name':_0x2ab97a['fieldName'],'type':_0x2ab97a[_0x473f('0x2e')][_0x473f('0x2f')]};});_0x1136ad[_0x473f('0x30')]=_[_0x473f('0x2b')](_0x305308,_0x473f('0x31'));_0x1136ad['query']=_['keys'](_0x3e28ee[_0x473f('0x32')]);_0x1136ad[_0x473f('0x33')]=_[_0x473f('0x34')](_0x1136ad[_0x473f('0x30')],_0x1136ad['query']);_0x46b5bc['attributes']=_[_0x473f('0x34')](_0x1136ad[_0x473f('0x30')],qs[_0x473f('0x35')](_0x3e28ee[_0x473f('0x32')][_0x473f('0x35')]));_0x46b5bc[_0x473f('0x36')]=_0x46b5bc['attributes'][_0x473f('0x37')]?_0x46b5bc[_0x473f('0x36')]:_0x1136ad[_0x473f('0x30')];if(!_0x3e28ee[_0x473f('0x32')][_0x473f('0x38')]('nolimit')){_0x46b5bc['limit']=qs[_0x473f('0x1a')](_0x3e28ee['query'][_0x473f('0x1a')]);_0x46b5bc[_0x473f('0x18')]=qs['offset'](_0x3e28ee[_0x473f('0x32')]['offset']);}_0x46b5bc['order']=qs[_0x473f('0x39')](_0x3e28ee[_0x473f('0x32')][_0x473f('0x39')]);_0x46b5bc['where']=qs['filters'](_['pick'](_0x3e28ee['query'],_0x1136ad[_0x473f('0x33')]),_0x305308);if(_0x3e28ee[_0x473f('0x32')]['filter']){_0x46b5bc['where']=_[_0x473f('0x3a')](_0x46b5bc['where'],{'$or':_[_0x473f('0x2b')](_0x305308,function(_0x1adeab){if(_0x1adeab['type']!==_0x473f('0x3b')){var _0x1c8f33={};_0x1c8f33[_0x1adeab[_0x473f('0x31')]]={'$like':'%'+_0x3e28ee[_0x473f('0x32')][_0x473f('0x3c')]+'%'};return _0x1c8f33;}})});}_0x46b5bc=_['merge']({},_0x46b5bc,_0x3e28ee[_0x473f('0x3d')]);var _0x458244={'where':_0x46b5bc[_0x473f('0x3e')]};return db[_0x473f('0x2c')][_0x473f('0x1b')](_0x458244)[_0x473f('0x20')](function(_0x1f678c){_0x4ced33[_0x473f('0x1b')]=_0x1f678c;if(_0x3e28ee[_0x473f('0x32')][_0x473f('0x3f')]){_0x46b5bc[_0x473f('0x40')]=[{'all':!![]}];}return db[_0x473f('0x2c')]['findAll'](_0x46b5bc);})[_0x473f('0x20')](function(_0xb20cac){_0x4ced33[_0x473f('0x41')]=_0xb20cac;return _0x4ced33;})['then'](respondWithFilteredResult(_0x3aeada,_0x46b5bc))['catch'](handleError(_0x3aeada,null));};exports[_0x473f('0x42')]=function(_0x13caa6,_0x46f365){var _0x24180a={'raw':!![],'where':{'id':_0x13caa6['params']['id']}},_0xc29e90={};_0xc29e90[_0x473f('0x30')]=_['keys'](db[_0x473f('0x2c')][_0x473f('0x2d')]);_0xc29e90[_0x473f('0x32')]=_[_0x473f('0x43')](_0x13caa6[_0x473f('0x32')]);_0xc29e90[_0x473f('0x33')]=_['intersection'](_0xc29e90[_0x473f('0x30')],_0xc29e90[_0x473f('0x32')]);_0x24180a[_0x473f('0x36')]=_[_0x473f('0x34')](_0xc29e90[_0x473f('0x30')],qs[_0x473f('0x35')](_0x13caa6[_0x473f('0x32')][_0x473f('0x35')]));_0x24180a[_0x473f('0x36')]=_0x24180a['attributes'][_0x473f('0x37')]?_0x24180a[_0x473f('0x36')]:_0xc29e90[_0x473f('0x30')];if(_0x13caa6['query'][_0x473f('0x3f')]){_0x24180a[_0x473f('0x40')]=[{'all':!![]}];}_0x24180a=_[_0x473f('0x3a')]({},_0x24180a,_0x13caa6[_0x473f('0x3d')]);return db[_0x473f('0x2c')][_0x473f('0x44')](_0x24180a)[_0x473f('0x20')](handleEntityNotFound(_0x46f365,null))[_0x473f('0x20')](respondWithResult(_0x46f365,null))[_0x473f('0x45')](handleError(_0x46f365,null));};exports[_0x473f('0x46')]=function(_0x19ecf2,_0x50db4b){return db[_0x473f('0x2c')]['create'](_0x19ecf2['body'],{})['then'](function(_0x28765b){var _0x5aca93=_0x19ecf2[_0x473f('0x47')][_0x473f('0x22')]({'plain':!![]});if(!_0x5aca93)throw new Error(_0x473f('0x48'));if(_0x5aca93[_0x473f('0x49')]===_0x473f('0x47')){var _0x30f203=_0x28765b[_0x473f('0x22')]({'plain':!![]});var _0x110f78='Templates';return db[_0x473f('0x4a')]['find']({'where':{'name':_0x110f78,'userProfileId':_0x5aca93[_0x473f('0x4b')]},'raw':!![]})[_0x473f('0x20')](function(_0x533462){if(_0x533462&&_0x533462['autoAssociation']===0x0){return db[_0x473f('0x24')]['create']({'name':_0x30f203[_0x473f('0x31')],'resourceId':_0x30f203['id'],'type':_0x533462[_0x473f('0x31')],'sectionId':_0x533462['id']},{})[_0x473f('0x20')](function(){return _0x28765b;});}else{return _0x28765b;}})[_0x473f('0x45')](function(_0x4f24e7){logger[_0x473f('0x27')](_0x473f('0x4c'),_0x4f24e7);throw _0x4f24e7;});}return _0x28765b;})[_0x473f('0x20')](respondWithResult(_0x50db4b,0xc9))['catch'](handleError(_0x50db4b,null));};exports[_0x473f('0x4d')]=function(_0x142f58,_0x53abc7){if(_0x142f58[_0x473f('0x4e')]['id']){delete _0x142f58[_0x473f('0x4e')]['id'];}return db['Template']['find']({'where':{'id':_0x142f58[_0x473f('0x4f')]['id']}})[_0x473f('0x20')](handleEntityNotFound(_0x53abc7,null))[_0x473f('0x20')](saveUpdates(_0x142f58[_0x473f('0x4e')],null))[_0x473f('0x20')](respondWithResult(_0x53abc7,null))[_0x473f('0x45')](handleError(_0x53abc7,null));};exports['destroy']=function(_0x1c362c,_0x1f8942){return db[_0x473f('0x2c')][_0x473f('0x44')]({'where':{'id':_0x1c362c[_0x473f('0x4f')]['id']}})[_0x473f('0x20')](handleEntityNotFound(_0x1f8942,null))[_0x473f('0x20')](removeEntity(_0x1f8942,null))[_0x473f('0x45')](handleError(_0x1f8942,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ab729cf..5d5addc 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 _0xb027=['./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x1aa2f0,_0x3e9718){var _0x177573=function(_0xfd78b0){while(--_0xfd78b0){_0x1aa2f0['push'](_0x1aa2f0['shift']());}};_0x177573(++_0x3e9718);}(_0xb027,0x1b1));var _0x7b02=function(_0xb827f1,_0x3c6daf){_0xb827f1=_0xb827f1-0x0;var _0x549403=_0xb027[_0xb827f1];return _0x549403;};'use strict';var _=require(_0x7b02('0x0'));var util=require(_0x7b02('0x1'));var logger=require(_0x7b02('0x2'))(_0x7b02('0x3'));var moment=require(_0x7b02('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7b02('0x5'));var config=require(_0x7b02('0x6'));var attributes=require(_0x7b02('0x7'));module[_0x7b02('0x8')]=function(_0x5ebecb,_0x2f594d){return _0x5ebecb[_0x7b02('0x9')](_0x7b02('0xa'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7dff=['rimraf','../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','util','moment','bluebird','request-promise','path'];(function(_0x51bcbb,_0x240654){var _0x32fa38=function(_0x3ebbe8){while(--_0x3ebbe8){_0x51bcbb['push'](_0x51bcbb['shift']());}};_0x32fa38(++_0x240654);}(_0x7dff,0x125));var _0xf7df=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x7dff[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0xf7df('0x0'));var util=require(_0xf7df('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf7df('0x2'));var BPromise=require(_0xf7df('0x3'));var rp=require(_0xf7df('0x4'));var fs=require('fs');var path=require(_0xf7df('0x5'));var rimraf=require(_0xf7df('0x6'));var config=require(_0xf7df('0x7'));var attributes=require(_0xf7df('0x8'));module[_0xf7df('0x9')]=function(_0x387acb,_0x2d6160){return _0x387acb[_0xf7df('0xa')](_0xf7df('0xb'),attributes,{'tableName':_0xf7df('0xc'),'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 2d81d38..72fd1b6 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 _0xb3fb=['include','model','map','stringify','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetTemplate','Template','findAll','options','raw','where','attributes','limit'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0xb3fb,0x6d));var _0xbb3f=function(_0x2bbe84,_0x27e011){_0x2bbe84=_0x2bbe84-0x0;var _0x5467bd=_0xb3fb[_0x2bbe84];return _0x5467bd;};'use strict';var _=require(_0xbb3f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbb3f('0x1'));var rs=require(_0xbb3f('0x2'));var fs=require('fs');var Redis=require(_0xbb3f('0x3'));var db=require(_0xbb3f('0x4'))['db'];var utils=require(_0xbb3f('0x5'));var logger=require(_0xbb3f('0x6'))(_0xbb3f('0x7'));var config=require(_0xbb3f('0x8'));var jayson=require(_0xbb3f('0x9'));var client=jayson[_0xbb3f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x122df2,_0x248a80,_0x1a4135){return new BPromise(function(_0x57798f,_0x24bdc4){return client[_0xbb3f('0xb')](_0x122df2,_0x1a4135)[_0xbb3f('0xc')](function(_0x2fa739){logger[_0xbb3f('0xd')](_0xbb3f('0xe'),_0x248a80,'request\x20sent');logger[_0xbb3f('0xf')](_0xbb3f('0x10'),_0x248a80,_0xbb3f('0x11'),JSON['stringify'](_0x2fa739));if(_0x2fa739['error']){if(_0x2fa739['error'][_0xbb3f('0x12')]===0x1f4){logger[_0xbb3f('0x13')](_0xbb3f('0xe'),_0x248a80,_0x2fa739[_0xbb3f('0x13')][_0xbb3f('0x14')]);return _0x24bdc4(_0x2fa739[_0xbb3f('0x13')][_0xbb3f('0x14')]);}logger[_0xbb3f('0x13')]('Template,\x20%s,\x20%s',_0x248a80,_0x2fa739[_0xbb3f('0x13')][_0xbb3f('0x14')]);return _0x57798f(_0x2fa739[_0xbb3f('0x13')][_0xbb3f('0x14')]);}else{logger[_0xbb3f('0xd')](_0xbb3f('0xe'),_0x248a80,_0xbb3f('0x11'));_0x57798f(_0x2fa739[_0xbb3f('0x15')][_0xbb3f('0x14')]);}})[_0xbb3f('0x16')](function(_0x55bd48){logger[_0xbb3f('0x13')](_0xbb3f('0xe'),_0x248a80,_0x55bd48);_0x24bdc4(_0x55bd48);});});}exports[_0xbb3f('0x17')]=function(_0x14ec8d){var _0x1c164a=this;return new Promise(function(_0x22948c,_0x85922c){return db[_0xbb3f('0x18')][_0xbb3f('0x19')]({'raw':_0x14ec8d[_0xbb3f('0x1a')]?_0x14ec8d['options'][_0xbb3f('0x1b')]===undefined?!![]:![]:!![],'where':_0x14ec8d['options']?_0x14ec8d[_0xbb3f('0x1a')][_0xbb3f('0x1c')]||null:null,'attributes':_0x14ec8d['options']?_0x14ec8d[_0xbb3f('0x1a')][_0xbb3f('0x1d')]||null:null,'limit':_0x14ec8d[_0xbb3f('0x1a')]?_0x14ec8d[_0xbb3f('0x1a')][_0xbb3f('0x1e')]||null:null,'include':_0x14ec8d[_0xbb3f('0x1a')]?_0x14ec8d[_0xbb3f('0x1a')]['include']?_['map'](_0x14ec8d[_0xbb3f('0x1a')][_0xbb3f('0x1f')],function(_0x453f17){return{'model':db[_0x453f17[_0xbb3f('0x20')]],'as':_0x453f17['as'],'attributes':_0x453f17[_0xbb3f('0x1d')],'include':_0x453f17[_0xbb3f('0x1f')]?_[_0xbb3f('0x21')](_0x453f17[_0xbb3f('0x1f')],function(_0x1b80c1){return{'model':db[_0x1b80c1['model']],'as':_0x1b80c1['as'],'attributes':_0x1b80c1[_0xbb3f('0x1d')],'include':_0x1b80c1[_0xbb3f('0x1f')]?_[_0xbb3f('0x21')](_0x1b80c1[_0xbb3f('0x1f')],function(_0x46e192){return{'model':db[_0x46e192[_0xbb3f('0x20')]],'as':_0x46e192['as'],'attributes':_0x46e192[_0xbb3f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbb3f('0xc')](function(_0x740d98){logger[_0xbb3f('0xd')](_0xbb3f('0x17'),_0x14ec8d);logger['debug'](_0xbb3f('0x17'),_0x14ec8d,JSON[_0xbb3f('0x22')](_0x740d98));_0x22948c(_0x740d98);})[_0xbb3f('0x16')](function(_0x1c1920){logger[_0xbb3f('0x13')](_0xbb3f('0x17'),_0x1c1920[_0xbb3f('0x14')],_0x14ec8d);_0x85922c(_0x1c164a[_0xbb3f('0x13')](0x1f4,_0x1c1920[_0xbb3f('0x14')]));});});}; \ No newline at end of file +var _0x62f0=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','Template','findAll','options','where','include','map','model','attributes','GetTemplate','moment','bluebird','randomstring','ioredis'];(function(_0x279676,_0x5ab5eb){var _0x29aea5=function(_0x13d485){while(--_0x13d485){_0x279676['push'](_0x279676['shift']());}};_0x29aea5(++_0x5ab5eb);}(_0x62f0,0x1ae));var _0x062f=function(_0x427352,_0x1bce61){_0x427352=_0x427352-0x0;var _0x23e0e6=_0x62f0[_0x427352];return _0x23e0e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x062f('0x0'));var BPromise=require(_0x062f('0x1'));var rs=require(_0x062f('0x2'));var fs=require('fs');var Redis=require(_0x062f('0x3'));var db=require(_0x062f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x062f('0x5'))(_0x062f('0x6'));var config=require(_0x062f('0x7'));var jayson=require(_0x062f('0x8'));var client=jayson[_0x062f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10f7a0,_0x582088,_0x1209f6){return new BPromise(function(_0x36dcc7,_0x3fb188){return client[_0x062f('0xa')](_0x10f7a0,_0x1209f6)[_0x062f('0xb')](function(_0x6810bb){logger['info'](_0x062f('0xc'),_0x582088,_0x062f('0xd'));logger[_0x062f('0xe')](_0x062f('0xf'),_0x582088,'request\x20sent',JSON[_0x062f('0x10')](_0x6810bb));if(_0x6810bb[_0x062f('0x11')]){if(_0x6810bb[_0x062f('0x11')][_0x062f('0x12')]===0x1f4){logger['error'](_0x062f('0xc'),_0x582088,_0x6810bb[_0x062f('0x11')][_0x062f('0x13')]);return _0x3fb188(_0x6810bb['error']['message']);}logger[_0x062f('0x11')](_0x062f('0xc'),_0x582088,_0x6810bb[_0x062f('0x11')][_0x062f('0x13')]);return _0x36dcc7(_0x6810bb[_0x062f('0x11')][_0x062f('0x13')]);}else{logger[_0x062f('0x14')]('Template,\x20%s,\x20%s',_0x582088,'request\x20sent');_0x36dcc7(_0x6810bb['result'][_0x062f('0x13')]);}})[_0x062f('0x15')](function(_0x573c45){logger[_0x062f('0x11')]('Template,\x20%s,\x20%s',_0x582088,_0x573c45);_0x3fb188(_0x573c45);});});}exports['GetTemplate']=function(_0x51f508){var _0xc57137=this;return new Promise(function(_0x20dd63,_0x280f1d){return db[_0x062f('0x16')][_0x062f('0x17')]({'raw':_0x51f508[_0x062f('0x18')]?_0x51f508[_0x062f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51f508['options']?_0x51f508[_0x062f('0x18')][_0x062f('0x19')]||null:null,'attributes':_0x51f508[_0x062f('0x18')]?_0x51f508['options']['attributes']||null:null,'limit':_0x51f508[_0x062f('0x18')]?_0x51f508[_0x062f('0x18')]['limit']||null:null,'include':_0x51f508[_0x062f('0x18')]?_0x51f508['options'][_0x062f('0x1a')]?_[_0x062f('0x1b')](_0x51f508[_0x062f('0x18')][_0x062f('0x1a')],function(_0x3f2500){return{'model':db[_0x3f2500[_0x062f('0x1c')]],'as':_0x3f2500['as'],'attributes':_0x3f2500[_0x062f('0x1d')],'include':_0x3f2500[_0x062f('0x1a')]?_[_0x062f('0x1b')](_0x3f2500[_0x062f('0x1a')],function(_0x50dd43){return{'model':db[_0x50dd43[_0x062f('0x1c')]],'as':_0x50dd43['as'],'attributes':_0x50dd43[_0x062f('0x1d')],'include':_0x50dd43[_0x062f('0x1a')]?_[_0x062f('0x1b')](_0x50dd43[_0x062f('0x1a')],function(_0x21d56a){return{'model':db[_0x21d56a[_0x062f('0x1c')]],'as':_0x21d56a['as'],'attributes':_0x21d56a[_0x062f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x062f('0xb')](function(_0x169ba9){logger[_0x062f('0x14')](_0x062f('0x1e'),_0x51f508);logger[_0x062f('0xe')]('GetTemplate',_0x51f508,JSON[_0x062f('0x10')](_0x169ba9));_0x20dd63(_0x169ba9);})[_0x062f('0x15')](function(_0x46830f){logger[_0x062f('0x11')](_0x062f('0x1e'),_0x46830f[_0x062f('0x13')],_0x51f508);_0x280f1d(_0xc57137[_0x062f('0x11')](0x1f4,_0x46830f['message']));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index c2346aa..4c3c320 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 _0xe3bb=['isAuthenticated','show','/:id/all_conditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction','put','update','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0xe3bb,0x1c8));var _0xbe3b=function(_0x47899b,_0x3a9171){_0x47899b=_0x47899b-0x0;var _0x3cf890=_0xe3bb[_0x47899b];return _0x3cf890;};'use strict';var multer=require(_0xbe3b('0x0'));var util=require(_0xbe3b('0x1'));var path=require(_0xbe3b('0x2'));var timeout=require(_0xbe3b('0x3'));var express=require(_0xbe3b('0x4'));var router=express['Router']();var fs_extra=require(_0xbe3b('0x5'));var auth=require(_0xbe3b('0x6'));var interaction=require(_0xbe3b('0x7'));var config=require(_0xbe3b('0x8'));var controller=require(_0xbe3b('0x9'));router[_0xbe3b('0xa')]('/',auth['isAuthenticated'](),controller[_0xbe3b('0xb')]);router[_0xbe3b('0xa')]('/:id',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0xd')]);router[_0xbe3b('0xa')](_0xbe3b('0xe'),auth[_0xbe3b('0xc')](),controller['getAllConditions']);router[_0xbe3b('0xa')](_0xbe3b('0xf'),auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x10')]);router[_0xbe3b('0xa')](_0xbe3b('0x11'),auth[_0xbe3b('0xc')](),controller['getActions']);router[_0xbe3b('0x12')]('/',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x13')]);router[_0xbe3b('0x12')]('/:id/all_conditions',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x14')]);router[_0xbe3b('0x12')](_0xbe3b('0xf'),auth[_0xbe3b('0xc')](),controller['addAnyCondition']);router[_0xbe3b('0x12')](_0xbe3b('0x11'),auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x15')]);router[_0xbe3b('0x16')]('/:id',auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x17')]);router['delete'](_0xbe3b('0x18'),auth[_0xbe3b('0xc')](),controller[_0xbe3b('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd7fa=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/any_conditions','/:id/actions','getActions','post','create','/:id/all_conditions','addAllCondition','addAnyCondition','addAction','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x178cfe,_0x5e23af){var _0x24b40c=function(_0x35b61c){while(--_0x35b61c){_0x178cfe['push'](_0x178cfe['shift']());}};_0x24b40c(++_0x5e23af);}(_0xd7fa,0x127));var _0xad7f=function(_0x281011,_0x597419){_0x281011=_0x281011-0x0;var _0x322acc=_0xd7fa[_0x281011];return _0x322acc;};'use strict';var multer=require(_0xad7f('0x0'));var util=require(_0xad7f('0x1'));var path=require(_0xad7f('0x2'));var timeout=require(_0xad7f('0x3'));var express=require(_0xad7f('0x4'));var router=express[_0xad7f('0x5')]();var fs_extra=require(_0xad7f('0x6'));var auth=require(_0xad7f('0x7'));var interaction=require(_0xad7f('0x8'));var config=require(_0xad7f('0x9'));var controller=require(_0xad7f('0xa'));router[_0xad7f('0xb')]('/',auth[_0xad7f('0xc')](),controller[_0xad7f('0xd')]);router['get'](_0xad7f('0xe'),auth['isAuthenticated'](),controller[_0xad7f('0xf')]);router['get']('/:id/all_conditions',auth['isAuthenticated'](),controller['getAllConditions']);router['get'](_0xad7f('0x10'),auth[_0xad7f('0xc')](),controller['getAnyConditions']);router[_0xad7f('0xb')](_0xad7f('0x11'),auth[_0xad7f('0xc')](),controller[_0xad7f('0x12')]);router[_0xad7f('0x13')]('/',auth['isAuthenticated'](),controller[_0xad7f('0x14')]);router['post'](_0xad7f('0x15'),auth['isAuthenticated'](),controller[_0xad7f('0x16')]);router[_0xad7f('0x13')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0xad7f('0x17')]);router['post'](_0xad7f('0x11'),auth['isAuthenticated'](),controller[_0xad7f('0x18')]);router[_0xad7f('0x19')](_0xad7f('0xe'),auth['isAuthenticated'](),controller[_0xad7f('0x1a')]);router[_0xad7f('0x1b')](_0xad7f('0xe'),auth[_0xad7f('0xc')](),controller[_0xad7f('0x1c')]);module[_0xad7f('0x1d')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 18f1881..56e4940 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 _0x102c=['sequelize','exports','STRING'];(function(_0x367449,_0x1c1725){var _0x1f8faf=function(_0x3013e0){while(--_0x3013e0){_0x367449['push'](_0x367449['shift']());}};_0x1f8faf(++_0x1c1725);}(_0x102c,0xf9));var _0xc102=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x102c[_0x5bd426];return _0x23a7eb;};'use strict';var Sequelize=require(_0xc102('0x0'));module[_0xc102('0x1')]={'name':{'type':Sequelize[_0xc102('0x2')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc102('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xbaa1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x24eb35,_0xc05f3b){var _0x8e7f4=function(_0x1df495){while(--_0x1df495){_0x24eb35['push'](_0x24eb35['shift']());}};_0x8e7f4(++_0xc05f3b);}(_0xbaa1,0x1c4));var _0x1baa=function(_0x37c88c,_0x211269){_0x37c88c=_0x37c88c-0x0;var _0x2ad952=_0xbaa1[_0x37c88c];return _0x2ad952;};'use strict';var Sequelize=require(_0x1baa('0x0'));module[_0x1baa('0x1')]={'name':{'type':Sequelize[_0x1baa('0x2')]},'channel':{'type':Sequelize[_0x1baa('0x2')]},'description':{'type':Sequelize[_0x1baa('0x2')]},'status':{'type':Sequelize[_0x1baa('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index dc32835..75ba3e4 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 _0x3f12=['destroy','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','Trigger','findAll','rows','catch','show','params','length','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','update','find','addAllCondition','TriggerAllId','Condition','TriggerAnyId','getAllConditions','findOne','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','then','Triggers','UserProfileResource'];(function(_0x280820,_0xce9bc7){var _0x474787=function(_0x3d224e){while(--_0x3d224e){_0x280820['push'](_0x280820['shift']());}};_0x474787(++_0xce9bc7);}(_0x3f12,0xfd));var _0x23f1=function(_0x427c83,_0x247882){_0x427c83=_0x427c83-0x0;var _0xb404a6=_0x3f12[_0x427c83];return _0xb404a6;};'use strict';var emlformat=require(_0x23f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x23f1('0x1'));var jsonpatch=require(_0x23f1('0x2'));var rp=require(_0x23f1('0x3'));var moment=require('moment');var BPromise=require(_0x23f1('0x4'));var Mustache=require('mustache');var util=require(_0x23f1('0x5'));var path=require('path');var sox=require(_0x23f1('0x6'));var csv=require('to-csv');var ejs=require(_0x23f1('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x23f1('0x8'));var squel=require(_0x23f1('0x9'));var crypto=require(_0x23f1('0xa'));var jsforce=require(_0x23f1('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x23f1('0xc'));var querystring=require(_0x23f1('0xd'));var Papa=require(_0x23f1('0xe'));var Redis=require(_0x23f1('0xf'));var authService=require(_0x23f1('0x10'));var qs=require(_0x23f1('0x11'));var as=require(_0x23f1('0x12'));var hardwareService=require(_0x23f1('0x13'));var logger=require(_0x23f1('0x14'))(_0x23f1('0x15'));var utils=require(_0x23f1('0x16'));var config=require(_0x23f1('0x17'));var licenseUtil=require(_0x23f1('0x18'));var db=require(_0x23f1('0x19'))['db'];function respondWithStatusCode(_0x21d022,_0x3ae133){_0x3ae133=_0x3ae133||0xcc;return function(_0x493a06){if(_0x493a06){return _0x21d022[_0x23f1('0x1a')](_0x3ae133);}return _0x21d022[_0x23f1('0x1b')](_0x3ae133)[_0x23f1('0x1c')]();};}function respondWithResult(_0x14a3b2,_0x3486f1){_0x3486f1=_0x3486f1||0xc8;return function(_0x555b45){if(_0x555b45){return _0x14a3b2['status'](_0x3486f1)[_0x23f1('0x1d')](_0x555b45);}};}function respondWithFilteredResult(_0x2f910e,_0x3b3142){return function(_0x19db02){if(_0x19db02){var _0x2d4c70=typeof _0x3b3142['offset']===_0x23f1('0x1e')&&typeof _0x3b3142['limit']==='undefined';var _0x357ad5=_0x19db02[_0x23f1('0x1f')];var _0x5d9b6d=_0x2d4c70?0x0:_0x3b3142[_0x23f1('0x20')];var _0x2386dd=_0x2d4c70?_0x19db02[_0x23f1('0x1f')]:_0x3b3142[_0x23f1('0x20')]+_0x3b3142[_0x23f1('0x21')];var _0x3c664c;if(_0x2386dd>=_0x357ad5){_0x2386dd=_0x357ad5;_0x3c664c=0xc8;}else{_0x3c664c=0xce;}_0x2f910e[_0x23f1('0x1b')](_0x3c664c);return _0x2f910e['set'](_0x23f1('0x22'),_0x5d9b6d+'-'+_0x2386dd+'/'+_0x357ad5)[_0x23f1('0x1d')](_0x19db02);}return null;};}function patchUpdates(_0x586114){return function(_0x3257a5){try{jsonpatch[_0x23f1('0x23')](_0x3257a5,_0x586114,!![]);}catch(_0x163705){return BPromise[_0x23f1('0x24')](_0x163705);}return _0x3257a5[_0x23f1('0x25')]();};}function saveUpdates(_0xcb1d12,_0x474fd1){return function(_0x579d5e){if(_0x579d5e){return _0x579d5e['update'](_0xcb1d12)['then'](function(_0x1f1e4f){return _0x1f1e4f;});}return null;};}function removeEntity(_0x1eea25,_0x72fa39){return function(_0x1118f8){if(_0x1118f8){return _0x1118f8['destroy']()[_0x23f1('0x26')](function(){var _0x530de1=_0x1118f8['get']({'plain':!![]});var _0x26d3a6=_0x23f1('0x27');return db[_0x23f1('0x28')][_0x23f1('0x29')]({'where':{'type':_0x26d3a6,'resourceId':_0x530de1['id']}})[_0x23f1('0x26')](function(){return _0x1118f8;});})[_0x23f1('0x26')](function(){_0x1eea25['status'](0xcc)[_0x23f1('0x1c')]();});}};}function handleEntityNotFound(_0x819c6c,_0x4b5d18){return function(_0x3bede6){if(!_0x3bede6){_0x819c6c[_0x23f1('0x1a')](0x194);}return _0x3bede6;};}function handleError(_0x8f029d,_0x1acbf4){_0x1acbf4=_0x1acbf4||0x1f4;return function(_0x1967b5){logger['error'](_0x1967b5[_0x23f1('0x2a')]);if(_0x1967b5[_0x23f1('0x2b')]){delete _0x1967b5[_0x23f1('0x2b')];}_0x8f029d[_0x23f1('0x1b')](_0x1acbf4)['send'](_0x1967b5);};}exports[_0x23f1('0x2c')]=function(_0x559b33,_0x58faf1){var _0x3d5efd={},_0x383fa9={},_0x41b124={'count':0x0,'rows':[]};var _0x586ff8=_[_0x23f1('0x2d')](db['Trigger'][_0x23f1('0x2e')],function(_0x507369){return{'name':_0x507369[_0x23f1('0x2f')],'type':_0x507369[_0x23f1('0x30')][_0x23f1('0x31')]};});_0x383fa9[_0x23f1('0x32')]=_['map'](_0x586ff8,_0x23f1('0x2b'));_0x383fa9[_0x23f1('0x33')]=_[_0x23f1('0x34')](_0x559b33[_0x23f1('0x33')]);_0x383fa9[_0x23f1('0x35')]=_['intersection'](_0x383fa9['model'],_0x383fa9[_0x23f1('0x33')]);_0x3d5efd[_0x23f1('0x36')]=_[_0x23f1('0x37')](_0x383fa9[_0x23f1('0x32')],qs[_0x23f1('0x38')](_0x559b33[_0x23f1('0x33')][_0x23f1('0x38')]));_0x3d5efd[_0x23f1('0x36')]=_0x3d5efd[_0x23f1('0x36')]['length']?_0x3d5efd['attributes']:_0x383fa9[_0x23f1('0x32')];if(!_0x559b33['query'][_0x23f1('0x39')]('nolimit')){_0x3d5efd[_0x23f1('0x21')]=qs[_0x23f1('0x21')](_0x559b33[_0x23f1('0x33')][_0x23f1('0x21')]);_0x3d5efd['offset']=qs[_0x23f1('0x20')](_0x559b33[_0x23f1('0x33')][_0x23f1('0x20')]);}_0x3d5efd[_0x23f1('0x3a')]=qs['sort'](_0x559b33[_0x23f1('0x33')][_0x23f1('0x3b')]);_0x3d5efd[_0x23f1('0x3c')]=qs[_0x23f1('0x35')](_[_0x23f1('0x3d')](_0x559b33[_0x23f1('0x33')],_0x383fa9[_0x23f1('0x35')]),_0x586ff8);if(_0x559b33[_0x23f1('0x33')][_0x23f1('0x3e')]){_0x3d5efd['where']=_[_0x23f1('0x3f')](_0x3d5efd['where'],{'$or':_[_0x23f1('0x2d')](_0x586ff8,function(_0x4b449f){if(_0x4b449f['type']!=='VIRTUAL'){var _0x26ac41={};_0x26ac41[_0x4b449f[_0x23f1('0x2b')]]={'$like':'%'+_0x559b33[_0x23f1('0x33')][_0x23f1('0x3e')]+'%'};return _0x26ac41;}})});}_0x3d5efd=_[_0x23f1('0x3f')]({},_0x3d5efd,_0x559b33[_0x23f1('0x40')]);var _0x53e4f8={'where':_0x3d5efd['where']};return db['Trigger']['count'](_0x53e4f8)[_0x23f1('0x26')](function(_0x33db20){_0x41b124['count']=_0x33db20;if(_0x559b33['query'][_0x23f1('0x41')]){_0x3d5efd[_0x23f1('0x42')]=[{'all':!![]}];}return db[_0x23f1('0x43')][_0x23f1('0x44')](_0x3d5efd);})[_0x23f1('0x26')](function(_0x55c2d4){_0x41b124[_0x23f1('0x45')]=_0x55c2d4;return _0x41b124;})[_0x23f1('0x26')](respondWithFilteredResult(_0x58faf1,_0x3d5efd))[_0x23f1('0x46')](handleError(_0x58faf1,null));};exports[_0x23f1('0x47')]=function(_0x4d9013,_0x34aec5){var _0x4cec59={'raw':![],'where':{'id':_0x4d9013[_0x23f1('0x48')]['id']}},_0x51cd9f={};_0x51cd9f['model']=_[_0x23f1('0x34')](db[_0x23f1('0x43')]['rawAttributes']);_0x51cd9f[_0x23f1('0x33')]=_['keys'](_0x4d9013[_0x23f1('0x33')]);_0x51cd9f[_0x23f1('0x35')]=_['intersection'](_0x51cd9f[_0x23f1('0x32')],_0x51cd9f[_0x23f1('0x33')]);_0x4cec59[_0x23f1('0x36')]=_[_0x23f1('0x37')](_0x51cd9f['model'],qs[_0x23f1('0x38')](_0x4d9013[_0x23f1('0x33')][_0x23f1('0x38')]));_0x4cec59[_0x23f1('0x36')]=_0x4cec59[_0x23f1('0x36')][_0x23f1('0x49')]?_0x4cec59['attributes']:_0x51cd9f[_0x23f1('0x32')];if(_0x4d9013['query'][_0x23f1('0x41')]){_0x4cec59[_0x23f1('0x42')]=[{'all':!![]}];}_0x4cec59=_[_0x23f1('0x3f')]({},_0x4cec59,_0x4d9013['options']);return db['Trigger']['find'](_0x4cec59)[_0x23f1('0x26')](handleEntityNotFound(_0x34aec5,null))[_0x23f1('0x26')](respondWithResult(_0x34aec5,null))['catch'](handleError(_0x34aec5,null));};exports[_0x23f1('0x4a')]=function(_0xd17880,_0xfd437a){return db[_0x23f1('0x43')][_0x23f1('0x4a')](_0xd17880[_0x23f1('0x4b')],{})[_0x23f1('0x26')](function(_0x4a6c1c){var _0xe4ec78=_0xd17880[_0x23f1('0x4c')]['get']({'plain':!![]});if(!_0xe4ec78)throw new Error(_0x23f1('0x4d'));if(_0xe4ec78[_0x23f1('0x4e')]==='user'){var _0x13a56a=_0x4a6c1c['get']({'plain':!![]});var _0x48f125=_0x23f1('0x27');return db[_0x23f1('0x4f')]['find']({'where':{'name':_0x48f125,'userProfileId':_0xe4ec78[_0x23f1('0x50')]},'raw':!![]})[_0x23f1('0x26')](function(_0x39a3f1){if(_0x39a3f1&&_0x39a3f1[_0x23f1('0x51')]===0x0){return db['UserProfileResource'][_0x23f1('0x4a')]({'name':_0x13a56a[_0x23f1('0x2b')],'resourceId':_0x13a56a['id'],'type':_0x39a3f1[_0x23f1('0x2b')],'sectionId':_0x39a3f1['id']},{})[_0x23f1('0x26')](function(){return _0x4a6c1c;});}else{return _0x4a6c1c;}})[_0x23f1('0x46')](function(_0x444ea6){logger[_0x23f1('0x52')](_0x23f1('0x53'),_0x444ea6);throw _0x444ea6;});}return _0x4a6c1c;})[_0x23f1('0x26')](respondWithResult(_0xfd437a,0xc9))[_0x23f1('0x46')](handleError(_0xfd437a,null));};exports[_0x23f1('0x54')]=function(_0x5c0807,_0x51a32b){if(_0x5c0807[_0x23f1('0x4b')]['id']){delete _0x5c0807['body']['id'];}return db[_0x23f1('0x43')][_0x23f1('0x55')]({'where':{'id':_0x5c0807[_0x23f1('0x48')]['id']}})['then'](handleEntityNotFound(_0x51a32b,null))[_0x23f1('0x26')](saveUpdates(_0x5c0807['body'],null))['then'](respondWithResult(_0x51a32b,null))[_0x23f1('0x46')](handleError(_0x51a32b,null));};exports['destroy']=function(_0x341105,_0xe7364){return db[_0x23f1('0x43')][_0x23f1('0x55')]({'where':{'id':_0x341105[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0xe7364,null))[_0x23f1('0x26')](removeEntity(_0xe7364,null))[_0x23f1('0x46')](handleError(_0xe7364,null));};exports[_0x23f1('0x56')]=function(_0xec8b47,_0x1f726b,_0x4b1e1b){if(_0xec8b47['body']['id']){delete _0xec8b47[_0x23f1('0x4b')]['id'];}return db[_0x23f1('0x43')][_0x23f1('0x55')]({'where':{'id':_0xec8b47[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x1f726b,null))[_0x23f1('0x26')](function(_0x4624c3){if(_0x4624c3){_0xec8b47[_0x23f1('0x4b')][_0x23f1('0x57')]=_0x4624c3['id'];return db[_0x23f1('0x58')][_0x23f1('0x4a')](_0xec8b47['body']);}})[_0x23f1('0x26')](respondWithResult(_0x1f726b,null))['catch'](handleError(_0x1f726b,null));};exports['addAnyCondition']=function(_0x4d0a3c,_0x30d569,_0x12a7eb){if(_0x4d0a3c[_0x23f1('0x4b')]['id']){delete _0x4d0a3c['body']['id'];}return db[_0x23f1('0x43')][_0x23f1('0x55')]({'where':{'id':_0x4d0a3c['params']['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x30d569,null))[_0x23f1('0x26')](function(_0x221275){if(_0x221275){_0x4d0a3c[_0x23f1('0x4b')][_0x23f1('0x59')]=_0x221275['id'];return db[_0x23f1('0x58')]['create'](_0x4d0a3c[_0x23f1('0x4b')]);}})['then'](respondWithResult(_0x30d569,null))['catch'](handleError(_0x30d569,null));};exports[_0x23f1('0x5a')]=function(_0x4faa22,_0x70a656,_0x566753){var _0x40b27d={};var _0x15d57f={};var _0x3aaace;var _0x5481b8;return db[_0x23f1('0x43')][_0x23f1('0x5b')]({'where':{'id':_0x4faa22[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x70a656,null))[_0x23f1('0x26')](function(_0x55c12d){if(_0x55c12d){_0x3aaace=_0x55c12d;_0x15d57f[_0x23f1('0x32')]=_[_0x23f1('0x34')](db[_0x23f1('0x58')][_0x23f1('0x2e')]);_0x15d57f['query']=_[_0x23f1('0x34')](_0x4faa22[_0x23f1('0x33')]);_0x15d57f[_0x23f1('0x35')]=_[_0x23f1('0x37')](_0x15d57f['model'],_0x15d57f[_0x23f1('0x33')]);_0x40b27d[_0x23f1('0x36')]=_[_0x23f1('0x37')](_0x15d57f[_0x23f1('0x32')],qs[_0x23f1('0x38')](_0x4faa22[_0x23f1('0x33')][_0x23f1('0x38')]));_0x40b27d[_0x23f1('0x36')]=_0x40b27d[_0x23f1('0x36')][_0x23f1('0x49')]?_0x40b27d['attributes']:_0x15d57f[_0x23f1('0x32')];_0x40b27d['order']=qs[_0x23f1('0x3b')](_0x4faa22[_0x23f1('0x33')][_0x23f1('0x3b')]);_0x40b27d[_0x23f1('0x3c')]=qs[_0x23f1('0x35')](_['pick'](_0x4faa22['query'],_0x15d57f[_0x23f1('0x35')]));if(_0x4faa22[_0x23f1('0x33')]['filter']){_0x40b27d[_0x23f1('0x3c')]=_[_0x23f1('0x3f')](_0x40b27d[_0x23f1('0x3c')],{'$or':_[_0x23f1('0x2d')](_0x40b27d[_0x23f1('0x36')],function(_0x3f48b7){var _0x2521e5={};_0x2521e5[_0x3f48b7]={'$like':'%'+_0x4faa22[_0x23f1('0x33')][_0x23f1('0x3e')]+'%'};return _0x2521e5;})});}_0x40b27d=_[_0x23f1('0x3f')]({},_0x40b27d,_0x4faa22['options']);return _0x3aaace['getAllConditions'](_0x40b27d);}})[_0x23f1('0x26')](function(_0x4472e3){if(_0x4472e3){_0x5481b8=_0x4472e3['length'];if(!_0x4faa22[_0x23f1('0x33')]['hasOwnProperty'](_0x23f1('0x5c'))){_0x40b27d['limit']=qs[_0x23f1('0x21')](_0x4faa22[_0x23f1('0x33')]['limit']);_0x40b27d[_0x23f1('0x20')]=qs[_0x23f1('0x20')](_0x4faa22['query']['offset']);}return _0x3aaace[_0x23f1('0x5a')](_0x40b27d);}})[_0x23f1('0x26')](function(_0x2e43d7){if(_0x2e43d7){return _0x2e43d7?{'count':_0x5481b8,'rows':_0x2e43d7}:null;}})[_0x23f1('0x26')](respondWithResult(_0x70a656,null))['catch'](handleError(_0x70a656,null));};exports[_0x23f1('0x5d')]=function(_0x11cc10,_0x537914,_0xf01e5b){var _0x1a83b8={};var _0x578c0d={};var _0x4737fc;var _0x1ec9a8;return db[_0x23f1('0x43')][_0x23f1('0x5b')]({'where':{'id':_0x11cc10[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x537914,null))[_0x23f1('0x26')](function(_0xb3ad2f){if(_0xb3ad2f){_0x4737fc=_0xb3ad2f;_0x578c0d['model']=_[_0x23f1('0x34')](db[_0x23f1('0x58')]['rawAttributes']);_0x578c0d[_0x23f1('0x33')]=_[_0x23f1('0x34')](_0x11cc10[_0x23f1('0x33')]);_0x578c0d[_0x23f1('0x35')]=_[_0x23f1('0x37')](_0x578c0d[_0x23f1('0x32')],_0x578c0d[_0x23f1('0x33')]);_0x1a83b8[_0x23f1('0x36')]=_[_0x23f1('0x37')](_0x578c0d['model'],qs[_0x23f1('0x38')](_0x11cc10[_0x23f1('0x33')][_0x23f1('0x38')]));_0x1a83b8[_0x23f1('0x36')]=_0x1a83b8['attributes'][_0x23f1('0x49')]?_0x1a83b8[_0x23f1('0x36')]:_0x578c0d[_0x23f1('0x32')];_0x1a83b8['order']=qs[_0x23f1('0x3b')](_0x11cc10[_0x23f1('0x33')][_0x23f1('0x3b')]);_0x1a83b8[_0x23f1('0x3c')]=qs[_0x23f1('0x35')](_[_0x23f1('0x3d')](_0x11cc10[_0x23f1('0x33')],_0x578c0d[_0x23f1('0x35')]));if(_0x11cc10['query'][_0x23f1('0x3e')]){_0x1a83b8['where']=_['merge'](_0x1a83b8[_0x23f1('0x3c')],{'$or':_[_0x23f1('0x2d')](_0x1a83b8['attributes'],function(_0x2d853c){var _0x580ee4={};_0x580ee4[_0x2d853c]={'$like':'%'+_0x11cc10[_0x23f1('0x33')][_0x23f1('0x3e')]+'%'};return _0x580ee4;})});}_0x1a83b8=_[_0x23f1('0x3f')]({},_0x1a83b8,_0x11cc10[_0x23f1('0x40')]);return _0x4737fc[_0x23f1('0x5d')](_0x1a83b8);}})[_0x23f1('0x26')](function(_0x48618a){if(_0x48618a){_0x1ec9a8=_0x48618a[_0x23f1('0x49')];if(!_0x11cc10[_0x23f1('0x33')][_0x23f1('0x39')](_0x23f1('0x5c'))){_0x1a83b8[_0x23f1('0x21')]=qs[_0x23f1('0x21')](_0x11cc10[_0x23f1('0x33')][_0x23f1('0x21')]);_0x1a83b8['offset']=qs[_0x23f1('0x20')](_0x11cc10[_0x23f1('0x33')]['offset']);}return _0x4737fc['getAnyConditions'](_0x1a83b8);}})['then'](function(_0x5b43e5){if(_0x5b43e5){return _0x5b43e5?{'count':_0x1ec9a8,'rows':_0x5b43e5}:null;}})['then'](respondWithResult(_0x537914,null))['catch'](handleError(_0x537914,null));};exports[_0x23f1('0x5e')]=function(_0x1921de,_0x58ec01,_0x35fac5){if(_0x1921de[_0x23f1('0x4b')]['id']){delete _0x1921de[_0x23f1('0x4b')]['id'];}return db[_0x23f1('0x43')][_0x23f1('0x55')]({'where':{'id':_0x1921de[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x58ec01,null))[_0x23f1('0x26')](function(_0x2e4a55){if(_0x2e4a55){_0x1921de[_0x23f1('0x4b')][_0x23f1('0x5f')]=_0x2e4a55['id'];return db[_0x23f1('0x60')][_0x23f1('0x4a')](_0x1921de['body']);}})[_0x23f1('0x26')](respondWithResult(_0x58ec01,null))[_0x23f1('0x46')](handleError(_0x58ec01,null));};exports[_0x23f1('0x61')]=function(_0x7df507,_0x165c4b,_0x464479){var _0x4d27fd={};var _0xe49298={};var _0x449aa6;var _0x38f252;return db[_0x23f1('0x43')][_0x23f1('0x5b')]({'where':{'id':_0x7df507[_0x23f1('0x48')]['id']}})[_0x23f1('0x26')](handleEntityNotFound(_0x165c4b,null))[_0x23f1('0x26')](function(_0x5367ef){if(_0x5367ef){_0x449aa6=_0x5367ef;_0xe49298[_0x23f1('0x32')]=_[_0x23f1('0x34')](db[_0x23f1('0x60')][_0x23f1('0x2e')]);_0xe49298['query']=_[_0x23f1('0x34')](_0x7df507[_0x23f1('0x33')]);_0xe49298[_0x23f1('0x35')]=_[_0x23f1('0x37')](_0xe49298[_0x23f1('0x32')],_0xe49298[_0x23f1('0x33')]);_0x4d27fd[_0x23f1('0x36')]=_[_0x23f1('0x37')](_0xe49298['model'],qs[_0x23f1('0x38')](_0x7df507[_0x23f1('0x33')][_0x23f1('0x38')]));_0x4d27fd['attributes']=_0x4d27fd[_0x23f1('0x36')]['length']?_0x4d27fd[_0x23f1('0x36')]:_0xe49298[_0x23f1('0x32')];_0x4d27fd['order']=qs[_0x23f1('0x3b')](_0x7df507[_0x23f1('0x33')]['sort']);_0x4d27fd[_0x23f1('0x3c')]=qs['filters'](_['pick'](_0x7df507[_0x23f1('0x33')],_0xe49298[_0x23f1('0x35')]));if(_0x7df507[_0x23f1('0x33')][_0x23f1('0x3e')]){_0x4d27fd[_0x23f1('0x3c')]=_['merge'](_0x4d27fd['where'],{'$or':_[_0x23f1('0x2d')](_0x4d27fd['attributes'],function(_0x365787){var _0x4bb76a={};_0x4bb76a[_0x365787]={'$like':'%'+_0x7df507[_0x23f1('0x33')][_0x23f1('0x3e')]+'%'};return _0x4bb76a;})});}_0x4d27fd=_[_0x23f1('0x3f')]({},_0x4d27fd,_0x7df507['options']);return _0x449aa6[_0x23f1('0x61')](_0x4d27fd);}})[_0x23f1('0x26')](function(_0x89a18b){if(_0x89a18b){_0x38f252=_0x89a18b[_0x23f1('0x49')];if(!_0x7df507[_0x23f1('0x33')][_0x23f1('0x39')]('nolimit')){_0x4d27fd[_0x23f1('0x21')]=qs[_0x23f1('0x21')](_0x7df507[_0x23f1('0x33')]['limit']);_0x4d27fd[_0x23f1('0x20')]=qs[_0x23f1('0x20')](_0x7df507['query'][_0x23f1('0x20')]);}return _0x449aa6['getActions'](_0x4d27fd);}})['then'](function(_0x49c71d){if(_0x49c71d){return _0x49c71d?{'count':_0x38f252,'rows':_0x49c71d}:null;}})[_0x23f1('0x26')](respondWithResult(_0x165c4b,null))[_0x23f1('0x46')](handleError(_0x165c4b,null));}; \ No newline at end of file +var _0xc470=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','Triggers','UserProfileResource','then','error','stack','name','send','Trigger','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','body','addAllCondition','addAnyCondition','TriggerAnyId','Condition','length','getAllConditions','nolimit','pick','hasOwnProperty','addAction','TriggerId','Action','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x2a0a38,_0x4a6de5){var _0x4a200e=function(_0x2ef26b){while(--_0x2ef26b){_0x2a0a38['push'](_0x2a0a38['shift']());}};_0x4a200e(++_0x4a6de5);}(_0xc470,0x10f));var _0x0c47=function(_0x258b93,_0x188ccc){_0x258b93=_0x258b93-0x0;var _0x35484b=_0xc470[_0x258b93];return _0x35484b;};'use strict';var emlformat=require(_0x0c47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c47('0x1'));var jsonpatch=require(_0x0c47('0x2'));var rp=require(_0x0c47('0x3'));var moment=require(_0x0c47('0x4'));var BPromise=require(_0x0c47('0x5'));var Mustache=require(_0x0c47('0x6'));var util=require(_0x0c47('0x7'));var path=require(_0x0c47('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0c47('0x9'));var fs=require('fs');var fs_extra=require(_0x0c47('0xa'));var _=require(_0x0c47('0xb'));var squel=require(_0x0c47('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0c47('0xd'));var toCsv=require(_0x0c47('0xe'));var querystring=require('querystring');var Papa=require(_0x0c47('0xf'));var Redis=require(_0x0c47('0x10'));var authService=require(_0x0c47('0x11'));var qs=require(_0x0c47('0x12'));var as=require(_0x0c47('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0c47('0x14'))('api');var utils=require(_0x0c47('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0c47('0x16'));var db=require(_0x0c47('0x17'))['db'];function respondWithStatusCode(_0x289cd1,_0x560256){_0x560256=_0x560256||0xcc;return function(_0x267a2d){if(_0x267a2d){return _0x289cd1['sendStatus'](_0x560256);}return _0x289cd1[_0x0c47('0x18')](_0x560256)[_0x0c47('0x19')]();};}function respondWithResult(_0x2be12c,_0x1e6738){_0x1e6738=_0x1e6738||0xc8;return function(_0x345c0a){if(_0x345c0a){return _0x2be12c[_0x0c47('0x18')](_0x1e6738)[_0x0c47('0x1a')](_0x345c0a);}};}function respondWithFilteredResult(_0x4c173,_0x4062b8){return function(_0x11a020){if(_0x11a020){var _0xf6ae1e=typeof _0x4062b8['offset']===_0x0c47('0x1b')&&typeof _0x4062b8[_0x0c47('0x1c')]===_0x0c47('0x1b');var _0x1d2a14=_0x11a020[_0x0c47('0x1d')];var _0x38f956=_0xf6ae1e?0x0:_0x4062b8[_0x0c47('0x1e')];var _0x704527=_0xf6ae1e?_0x11a020['count']:_0x4062b8['offset']+_0x4062b8['limit'];var _0x470720;if(_0x704527>=_0x1d2a14){_0x704527=_0x1d2a14;_0x470720=0xc8;}else{_0x470720=0xce;}_0x4c173[_0x0c47('0x18')](_0x470720);return _0x4c173[_0x0c47('0x1f')](_0x0c47('0x20'),_0x38f956+'-'+_0x704527+'/'+_0x1d2a14)[_0x0c47('0x1a')](_0x11a020);}return null;};}function patchUpdates(_0x235dea){return function(_0x38c2f4){try{jsonpatch[_0x0c47('0x21')](_0x38c2f4,_0x235dea,!![]);}catch(_0x4e625f){return BPromise[_0x0c47('0x22')](_0x4e625f);}return _0x38c2f4[_0x0c47('0x23')]();};}function saveUpdates(_0x8a5940,_0x482f15){return function(_0x54569a){if(_0x54569a){return _0x54569a[_0x0c47('0x24')](_0x8a5940)['then'](function(_0x628f9b){return _0x628f9b;});}return null;};}function removeEntity(_0x29c3a4,_0x4bd374){return function(_0x35dc92){if(_0x35dc92){return _0x35dc92[_0x0c47('0x25')]()['then'](function(){var _0x193030=_0x35dc92[_0x0c47('0x26')]({'plain':!![]});var _0x58326e=_0x0c47('0x27');return db[_0x0c47('0x28')][_0x0c47('0x25')]({'where':{'type':_0x58326e,'resourceId':_0x193030['id']}})[_0x0c47('0x29')](function(){return _0x35dc92;});})[_0x0c47('0x29')](function(){_0x29c3a4[_0x0c47('0x18')](0xcc)[_0x0c47('0x19')]();});}};}function handleEntityNotFound(_0x30afab,_0x34091e){return function(_0xa6cd82){if(!_0xa6cd82){_0x30afab['sendStatus'](0x194);}return _0xa6cd82;};}function handleError(_0x5a1e76,_0x52f094){_0x52f094=_0x52f094||0x1f4;return function(_0x23e4da){logger[_0x0c47('0x2a')](_0x23e4da[_0x0c47('0x2b')]);if(_0x23e4da[_0x0c47('0x2c')]){delete _0x23e4da['name'];}_0x5a1e76[_0x0c47('0x18')](_0x52f094)[_0x0c47('0x2d')](_0x23e4da);};}exports['index']=function(_0x2d4660,_0x26ab49){var _0x3e6e41={},_0xb7f938={},_0x1db700={'count':0x0,'rows':[]};var _0x24c07c=_['map'](db[_0x0c47('0x2e')][_0x0c47('0x2f')],function(_0x39c9f6){return{'name':_0x39c9f6[_0x0c47('0x30')],'type':_0x39c9f6[_0x0c47('0x31')][_0x0c47('0x32')]};});_0xb7f938[_0x0c47('0x33')]=_[_0x0c47('0x34')](_0x24c07c,_0x0c47('0x2c'));_0xb7f938[_0x0c47('0x35')]=_[_0x0c47('0x36')](_0x2d4660['query']);_0xb7f938['filters']=_[_0x0c47('0x37')](_0xb7f938[_0x0c47('0x33')],_0xb7f938[_0x0c47('0x35')]);_0x3e6e41['attributes']=_['intersection'](_0xb7f938[_0x0c47('0x33')],qs['fields'](_0x2d4660[_0x0c47('0x35')][_0x0c47('0x38')]));_0x3e6e41['attributes']=_0x3e6e41[_0x0c47('0x39')]['length']?_0x3e6e41[_0x0c47('0x39')]:_0xb7f938[_0x0c47('0x33')];if(!_0x2d4660['query']['hasOwnProperty']('nolimit')){_0x3e6e41['limit']=qs[_0x0c47('0x1c')](_0x2d4660[_0x0c47('0x35')][_0x0c47('0x1c')]);_0x3e6e41[_0x0c47('0x1e')]=qs[_0x0c47('0x1e')](_0x2d4660['query'][_0x0c47('0x1e')]);}_0x3e6e41[_0x0c47('0x3a')]=qs[_0x0c47('0x3b')](_0x2d4660[_0x0c47('0x35')][_0x0c47('0x3b')]);_0x3e6e41[_0x0c47('0x3c')]=qs[_0x0c47('0x3d')](_['pick'](_0x2d4660['query'],_0xb7f938[_0x0c47('0x3d')]),_0x24c07c);if(_0x2d4660[_0x0c47('0x35')][_0x0c47('0x3e')]){_0x3e6e41['where']=_[_0x0c47('0x3f')](_0x3e6e41[_0x0c47('0x3c')],{'$or':_['map'](_0x24c07c,function(_0x48c7ff){if(_0x48c7ff['type']!==_0x0c47('0x40')){var _0x1b002a={};_0x1b002a[_0x48c7ff[_0x0c47('0x2c')]]={'$like':'%'+_0x2d4660[_0x0c47('0x35')]['filter']+'%'};return _0x1b002a;}})});}_0x3e6e41=_[_0x0c47('0x3f')]({},_0x3e6e41,_0x2d4660[_0x0c47('0x41')]);var _0x17a9f9={'where':_0x3e6e41[_0x0c47('0x3c')]};return db[_0x0c47('0x2e')][_0x0c47('0x1d')](_0x17a9f9)[_0x0c47('0x29')](function(_0x4b57ea){_0x1db700[_0x0c47('0x1d')]=_0x4b57ea;if(_0x2d4660[_0x0c47('0x35')][_0x0c47('0x42')]){_0x3e6e41['include']=[{'all':!![]}];}return db['Trigger'][_0x0c47('0x43')](_0x3e6e41);})[_0x0c47('0x29')](function(_0x2c57b4){_0x1db700[_0x0c47('0x44')]=_0x2c57b4;return _0x1db700;})['then'](respondWithFilteredResult(_0x26ab49,_0x3e6e41))[_0x0c47('0x45')](handleError(_0x26ab49,null));};exports['show']=function(_0x288872,_0x1f8981){var _0x321519={'raw':![],'where':{'id':_0x288872[_0x0c47('0x46')]['id']}},_0x38f4e8={};_0x38f4e8[_0x0c47('0x33')]=_[_0x0c47('0x36')](db[_0x0c47('0x2e')][_0x0c47('0x2f')]);_0x38f4e8[_0x0c47('0x35')]=_['keys'](_0x288872[_0x0c47('0x35')]);_0x38f4e8[_0x0c47('0x3d')]=_[_0x0c47('0x37')](_0x38f4e8[_0x0c47('0x33')],_0x38f4e8[_0x0c47('0x35')]);_0x321519[_0x0c47('0x39')]=_[_0x0c47('0x37')](_0x38f4e8[_0x0c47('0x33')],qs[_0x0c47('0x38')](_0x288872[_0x0c47('0x35')][_0x0c47('0x38')]));_0x321519['attributes']=_0x321519[_0x0c47('0x39')]['length']?_0x321519['attributes']:_0x38f4e8[_0x0c47('0x33')];if(_0x288872[_0x0c47('0x35')][_0x0c47('0x42')]){_0x321519[_0x0c47('0x47')]=[{'all':!![]}];}_0x321519=_[_0x0c47('0x3f')]({},_0x321519,_0x288872['options']);return db[_0x0c47('0x2e')]['find'](_0x321519)[_0x0c47('0x29')](handleEntityNotFound(_0x1f8981,null))[_0x0c47('0x29')](respondWithResult(_0x1f8981,null))[_0x0c47('0x45')](handleError(_0x1f8981,null));};exports[_0x0c47('0x48')]=function(_0x2f2271,_0x12f905){return db['Trigger']['create'](_0x2f2271['body'],{})[_0x0c47('0x29')](function(_0x37d9fe){var _0x1f604b=_0x2f2271[_0x0c47('0x49')][_0x0c47('0x26')]({'plain':!![]});if(!_0x1f604b)throw new Error(_0x0c47('0x4a'));if(_0x1f604b[_0x0c47('0x4b')]===_0x0c47('0x49')){var _0x167cad=_0x37d9fe[_0x0c47('0x26')]({'plain':!![]});var _0x21ad18=_0x0c47('0x27');return db[_0x0c47('0x4c')][_0x0c47('0x4d')]({'where':{'name':_0x21ad18,'userProfileId':_0x1f604b[_0x0c47('0x4e')]},'raw':!![]})[_0x0c47('0x29')](function(_0x5b2640){if(_0x5b2640&&_0x5b2640[_0x0c47('0x4f')]===0x0){return db[_0x0c47('0x28')]['create']({'name':_0x167cad['name'],'resourceId':_0x167cad['id'],'type':_0x5b2640[_0x0c47('0x2c')],'sectionId':_0x5b2640['id']},{})[_0x0c47('0x29')](function(){return _0x37d9fe;});}else{return _0x37d9fe;}})['catch'](function(_0xe09614){logger[_0x0c47('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe09614);throw _0xe09614;});}return _0x37d9fe;})[_0x0c47('0x29')](respondWithResult(_0x12f905,0xc9))[_0x0c47('0x45')](handleError(_0x12f905,null));};exports[_0x0c47('0x24')]=function(_0x51a243,_0x438fdc){if(_0x51a243[_0x0c47('0x50')]['id']){delete _0x51a243[_0x0c47('0x50')]['id'];}return db[_0x0c47('0x2e')][_0x0c47('0x4d')]({'where':{'id':_0x51a243[_0x0c47('0x46')]['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x438fdc,null))[_0x0c47('0x29')](saveUpdates(_0x51a243[_0x0c47('0x50')],null))[_0x0c47('0x29')](respondWithResult(_0x438fdc,null))['catch'](handleError(_0x438fdc,null));};exports[_0x0c47('0x25')]=function(_0x1fc471,_0x225d5e){return db[_0x0c47('0x2e')][_0x0c47('0x4d')]({'where':{'id':_0x1fc471['params']['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x225d5e,null))['then'](removeEntity(_0x225d5e,null))[_0x0c47('0x45')](handleError(_0x225d5e,null));};exports[_0x0c47('0x51')]=function(_0x370011,_0x4fcae8,_0x36d4e1){if(_0x370011['body']['id']){delete _0x370011['body']['id'];}return db[_0x0c47('0x2e')]['find']({'where':{'id':_0x370011[_0x0c47('0x46')]['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x4fcae8,null))[_0x0c47('0x29')](function(_0x54242d){if(_0x54242d){_0x370011[_0x0c47('0x50')]['TriggerAllId']=_0x54242d['id'];return db['Condition'][_0x0c47('0x48')](_0x370011[_0x0c47('0x50')]);}})[_0x0c47('0x29')](respondWithResult(_0x4fcae8,null))['catch'](handleError(_0x4fcae8,null));};exports[_0x0c47('0x52')]=function(_0x180bba,_0x12d75b,_0x212058){if(_0x180bba['body']['id']){delete _0x180bba[_0x0c47('0x50')]['id'];}return db[_0x0c47('0x2e')]['find']({'where':{'id':_0x180bba['params']['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x12d75b,null))[_0x0c47('0x29')](function(_0x32275b){if(_0x32275b){_0x180bba[_0x0c47('0x50')][_0x0c47('0x53')]=_0x32275b['id'];return db[_0x0c47('0x54')][_0x0c47('0x48')](_0x180bba[_0x0c47('0x50')]);}})[_0x0c47('0x29')](respondWithResult(_0x12d75b,null))[_0x0c47('0x45')](handleError(_0x12d75b,null));};exports['getAllConditions']=function(_0xe33b4f,_0xe9ef92,_0x144ed5){var _0x38a7bf={};var _0x21d46d={};var _0x4d3625;var _0x12030c;return db[_0x0c47('0x2e')]['findOne']({'where':{'id':_0xe33b4f[_0x0c47('0x46')]['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0xe9ef92,null))[_0x0c47('0x29')](function(_0x5aed24){if(_0x5aed24){_0x4d3625=_0x5aed24;_0x21d46d['model']=_[_0x0c47('0x36')](db[_0x0c47('0x54')][_0x0c47('0x2f')]);_0x21d46d[_0x0c47('0x35')]=_[_0x0c47('0x36')](_0xe33b4f[_0x0c47('0x35')]);_0x21d46d[_0x0c47('0x3d')]=_[_0x0c47('0x37')](_0x21d46d[_0x0c47('0x33')],_0x21d46d[_0x0c47('0x35')]);_0x38a7bf[_0x0c47('0x39')]=_[_0x0c47('0x37')](_0x21d46d[_0x0c47('0x33')],qs[_0x0c47('0x38')](_0xe33b4f[_0x0c47('0x35')][_0x0c47('0x38')]));_0x38a7bf[_0x0c47('0x39')]=_0x38a7bf[_0x0c47('0x39')][_0x0c47('0x55')]?_0x38a7bf[_0x0c47('0x39')]:_0x21d46d[_0x0c47('0x33')];_0x38a7bf[_0x0c47('0x3a')]=qs[_0x0c47('0x3b')](_0xe33b4f['query'][_0x0c47('0x3b')]);_0x38a7bf[_0x0c47('0x3c')]=qs[_0x0c47('0x3d')](_['pick'](_0xe33b4f[_0x0c47('0x35')],_0x21d46d[_0x0c47('0x3d')]));if(_0xe33b4f['query']['filter']){_0x38a7bf[_0x0c47('0x3c')]=_['merge'](_0x38a7bf[_0x0c47('0x3c')],{'$or':_[_0x0c47('0x34')](_0x38a7bf[_0x0c47('0x39')],function(_0x5a7d96){var _0x4219b4={};_0x4219b4[_0x5a7d96]={'$like':'%'+_0xe33b4f[_0x0c47('0x35')][_0x0c47('0x3e')]+'%'};return _0x4219b4;})});}_0x38a7bf=_['merge']({},_0x38a7bf,_0xe33b4f[_0x0c47('0x41')]);return _0x4d3625[_0x0c47('0x56')](_0x38a7bf);}})[_0x0c47('0x29')](function(_0xc7827c){if(_0xc7827c){_0x12030c=_0xc7827c['length'];if(!_0xe33b4f[_0x0c47('0x35')]['hasOwnProperty'](_0x0c47('0x57'))){_0x38a7bf[_0x0c47('0x1c')]=qs[_0x0c47('0x1c')](_0xe33b4f[_0x0c47('0x35')]['limit']);_0x38a7bf[_0x0c47('0x1e')]=qs[_0x0c47('0x1e')](_0xe33b4f['query']['offset']);}return _0x4d3625[_0x0c47('0x56')](_0x38a7bf);}})['then'](function(_0x574cfb){if(_0x574cfb){return _0x574cfb?{'count':_0x12030c,'rows':_0x574cfb}:null;}})[_0x0c47('0x29')](respondWithResult(_0xe9ef92,null))['catch'](handleError(_0xe9ef92,null));};exports['getAnyConditions']=function(_0x2739b8,_0x26ca81,_0x4a34a5){var _0xa15845={};var _0x3bfc2b={};var _0x2d1eac;var _0x4c8b2d;return db[_0x0c47('0x2e')]['findOne']({'where':{'id':_0x2739b8[_0x0c47('0x46')]['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x26ca81,null))[_0x0c47('0x29')](function(_0x327038){if(_0x327038){_0x2d1eac=_0x327038;_0x3bfc2b[_0x0c47('0x33')]=_[_0x0c47('0x36')](db[_0x0c47('0x54')][_0x0c47('0x2f')]);_0x3bfc2b[_0x0c47('0x35')]=_[_0x0c47('0x36')](_0x2739b8[_0x0c47('0x35')]);_0x3bfc2b[_0x0c47('0x3d')]=_[_0x0c47('0x37')](_0x3bfc2b[_0x0c47('0x33')],_0x3bfc2b[_0x0c47('0x35')]);_0xa15845[_0x0c47('0x39')]=_[_0x0c47('0x37')](_0x3bfc2b[_0x0c47('0x33')],qs[_0x0c47('0x38')](_0x2739b8[_0x0c47('0x35')][_0x0c47('0x38')]));_0xa15845['attributes']=_0xa15845['attributes'][_0x0c47('0x55')]?_0xa15845['attributes']:_0x3bfc2b[_0x0c47('0x33')];_0xa15845[_0x0c47('0x3a')]=qs[_0x0c47('0x3b')](_0x2739b8[_0x0c47('0x35')][_0x0c47('0x3b')]);_0xa15845['where']=qs['filters'](_[_0x0c47('0x58')](_0x2739b8['query'],_0x3bfc2b['filters']));if(_0x2739b8[_0x0c47('0x35')][_0x0c47('0x3e')]){_0xa15845['where']=_['merge'](_0xa15845[_0x0c47('0x3c')],{'$or':_['map'](_0xa15845[_0x0c47('0x39')],function(_0x1a7441){var _0x239963={};_0x239963[_0x1a7441]={'$like':'%'+_0x2739b8['query'][_0x0c47('0x3e')]+'%'};return _0x239963;})});}_0xa15845=_[_0x0c47('0x3f')]({},_0xa15845,_0x2739b8[_0x0c47('0x41')]);return _0x2d1eac['getAnyConditions'](_0xa15845);}})['then'](function(_0x56cf44){if(_0x56cf44){_0x4c8b2d=_0x56cf44[_0x0c47('0x55')];if(!_0x2739b8[_0x0c47('0x35')][_0x0c47('0x59')](_0x0c47('0x57'))){_0xa15845[_0x0c47('0x1c')]=qs[_0x0c47('0x1c')](_0x2739b8[_0x0c47('0x35')][_0x0c47('0x1c')]);_0xa15845['offset']=qs['offset'](_0x2739b8[_0x0c47('0x35')][_0x0c47('0x1e')]);}return _0x2d1eac['getAnyConditions'](_0xa15845);}})[_0x0c47('0x29')](function(_0x439c86){if(_0x439c86){return _0x439c86?{'count':_0x4c8b2d,'rows':_0x439c86}:null;}})[_0x0c47('0x29')](respondWithResult(_0x26ca81,null))[_0x0c47('0x45')](handleError(_0x26ca81,null));};exports[_0x0c47('0x5a')]=function(_0x36afaf,_0x27c068,_0x1044b8){if(_0x36afaf[_0x0c47('0x50')]['id']){delete _0x36afaf['body']['id'];}return db['Trigger'][_0x0c47('0x4d')]({'where':{'id':_0x36afaf[_0x0c47('0x46')]['id']}})[_0x0c47('0x29')](handleEntityNotFound(_0x27c068,null))[_0x0c47('0x29')](function(_0xa8e1a6){if(_0xa8e1a6){_0x36afaf[_0x0c47('0x50')][_0x0c47('0x5b')]=_0xa8e1a6['id'];return db[_0x0c47('0x5c')][_0x0c47('0x48')](_0x36afaf[_0x0c47('0x50')]);}})[_0x0c47('0x29')](respondWithResult(_0x27c068,null))[_0x0c47('0x45')](handleError(_0x27c068,null));};exports[_0x0c47('0x5d')]=function(_0xafded3,_0x56b6f2,_0x2b42ae){var _0x3a9433={};var _0x1bf061={};var _0x3c09ca;var _0x12ae56;return db[_0x0c47('0x2e')][_0x0c47('0x5e')]({'where':{'id':_0xafded3[_0x0c47('0x46')]['id']}})['then'](handleEntityNotFound(_0x56b6f2,null))['then'](function(_0x56c1ad){if(_0x56c1ad){_0x3c09ca=_0x56c1ad;_0x1bf061['model']=_[_0x0c47('0x36')](db['Action'][_0x0c47('0x2f')]);_0x1bf061[_0x0c47('0x35')]=_['keys'](_0xafded3[_0x0c47('0x35')]);_0x1bf061[_0x0c47('0x3d')]=_['intersection'](_0x1bf061[_0x0c47('0x33')],_0x1bf061[_0x0c47('0x35')]);_0x3a9433[_0x0c47('0x39')]=_['intersection'](_0x1bf061[_0x0c47('0x33')],qs[_0x0c47('0x38')](_0xafded3[_0x0c47('0x35')][_0x0c47('0x38')]));_0x3a9433[_0x0c47('0x39')]=_0x3a9433[_0x0c47('0x39')]['length']?_0x3a9433['attributes']:_0x1bf061[_0x0c47('0x33')];_0x3a9433[_0x0c47('0x3a')]=qs[_0x0c47('0x3b')](_0xafded3[_0x0c47('0x35')]['sort']);_0x3a9433[_0x0c47('0x3c')]=qs[_0x0c47('0x3d')](_['pick'](_0xafded3[_0x0c47('0x35')],_0x1bf061[_0x0c47('0x3d')]));if(_0xafded3['query'][_0x0c47('0x3e')]){_0x3a9433[_0x0c47('0x3c')]=_[_0x0c47('0x3f')](_0x3a9433[_0x0c47('0x3c')],{'$or':_['map'](_0x3a9433[_0x0c47('0x39')],function(_0x226c18){var _0x959b4={};_0x959b4[_0x226c18]={'$like':'%'+_0xafded3['query'][_0x0c47('0x3e')]+'%'};return _0x959b4;})});}_0x3a9433=_['merge']({},_0x3a9433,_0xafded3[_0x0c47('0x41')]);return _0x3c09ca['getActions'](_0x3a9433);}})[_0x0c47('0x29')](function(_0xfe3cb5){if(_0xfe3cb5){_0x12ae56=_0xfe3cb5[_0x0c47('0x55')];if(!_0xafded3[_0x0c47('0x35')][_0x0c47('0x59')](_0x0c47('0x57'))){_0x3a9433['limit']=qs[_0x0c47('0x1c')](_0xafded3[_0x0c47('0x35')]['limit']);_0x3a9433[_0x0c47('0x1e')]=qs[_0x0c47('0x1e')](_0xafded3[_0x0c47('0x35')]['offset']);}return _0x3c09ca[_0x0c47('0x5d')](_0x3a9433);}})[_0x0c47('0x29')](function(_0x37d74b){if(_0x37d74b){return _0x37d74b?{'count':_0x12ae56,'rows':_0x37d74b}:null;}})['then'](respondWithResult(_0x56b6f2,null))[_0x0c47('0x45')](handleError(_0x56b6f2,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index db00f02..3f94099 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 _0xbd3b=['request-promise','path','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','moment','bluebird'];(function(_0x290ab7,_0x491c1e){var _0x4404b3=function(_0x697349){while(--_0x697349){_0x290ab7['push'](_0x290ab7['shift']());}};_0x4404b3(++_0x491c1e);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x5eae84,_0x193d5e){_0x5eae84=_0x5eae84-0x0;var _0x5b44cc=_0xbd3b[_0x5eae84];return _0x5b44cc;};'use strict';var _=require(_0xbbd3('0x0'));var util=require(_0xbbd3('0x1'));var logger=require(_0xbbd3('0x2'))('api');var moment=require(_0xbbd3('0x3'));var BPromise=require(_0xbbd3('0x4'));var rp=require(_0xbbd3('0x5'));var fs=require('fs');var path=require(_0xbbd3('0x6'));var rimraf=require('rimraf');var config=require(_0xbbd3('0x7'));var attributes=require(_0xbbd3('0x8'));module['exports']=function(_0x2e1bcb,_0x494774){return _0x2e1bcb[_0xbbd3('0x9')](_0xbbd3('0xa'),attributes,{'tableName':_0xbbd3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb07f=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash'];(function(_0x42cf3b,_0x3bb5d7){var _0x416c2d=function(_0x2c774c){while(--_0x2c774c){_0x42cf3b['push'](_0x42cf3b['shift']());}};_0x416c2d(++_0x3bb5d7);}(_0xb07f,0x109));var _0xfb07=function(_0x1a8c0c,_0x18ee77){_0x1a8c0c=_0x1a8c0c-0x0;var _0x2d46b6=_0xb07f[_0x1a8c0c];return _0x2d46b6;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var logger=require(_0xfb07('0x2'))(_0xfb07('0x3'));var moment=require(_0xfb07('0x4'));var BPromise=require(_0xfb07('0x5'));var rp=require(_0xfb07('0x6'));var fs=require('fs');var path=require(_0xfb07('0x7'));var rimraf=require(_0xfb07('0x8'));var config=require(_0xfb07('0x9'));var attributes=require(_0xfb07('0xa'));module['exports']=function(_0x3c79a9,_0x934f98){return _0x3c79a9[_0xfb07('0xb')](_0xfb07('0xc'),attributes,{'tableName':_0xfb07('0xd'),'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 7e9d87d..b2b71ce 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 _0x6644=['options','attributes','limit','include','map','model','find','raw','where','ShowTrigger','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetTrigger','Trigger','findAll'];(function(_0x496ee0,_0x5e592f){var _0x5bc3f9=function(_0x11fc57){while(--_0x11fc57){_0x496ee0['push'](_0x496ee0['shift']());}};_0x5bc3f9(++_0x5e592f);}(_0x6644,0x6a));var _0x4664=function(_0x4a1d44,_0x1c0a96){_0x4a1d44=_0x4a1d44-0x0;var _0x23b462=_0x6644[_0x4a1d44];return _0x23b462;};'use strict';var _=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var moment=require(_0x4664('0x2'));var BPromise=require('bluebird');var rs=require(_0x4664('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4664('0x4'))['db'];var utils=require(_0x4664('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4664('0x6')][_0x4664('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4236b1,_0x555c2a,_0x4266dd){return new BPromise(function(_0x148311,_0x2b1d8c){return client[_0x4664('0x8')](_0x4236b1,_0x4266dd)[_0x4664('0x9')](function(_0x2d6221){logger[_0x4664('0xa')](_0x4664('0xb'),_0x555c2a,_0x4664('0xc'));logger[_0x4664('0xd')]('Trigger,\x20%s,\x20%s,\x20%s',_0x555c2a,_0x4664('0xc'),JSON[_0x4664('0xe')](_0x2d6221));if(_0x2d6221['error']){if(_0x2d6221[_0x4664('0xf')]['code']===0x1f4){logger['error'](_0x4664('0xb'),_0x555c2a,_0x2d6221[_0x4664('0xf')][_0x4664('0x10')]);return _0x2b1d8c(_0x2d6221[_0x4664('0xf')][_0x4664('0x10')]);}logger[_0x4664('0xf')](_0x4664('0xb'),_0x555c2a,_0x2d6221[_0x4664('0xf')][_0x4664('0x10')]);return _0x148311(_0x2d6221[_0x4664('0xf')][_0x4664('0x10')]);}else{logger[_0x4664('0xa')](_0x4664('0xb'),_0x555c2a,_0x4664('0xc'));_0x148311(_0x2d6221[_0x4664('0x11')][_0x4664('0x10')]);}})[_0x4664('0x12')](function(_0x1a8cbc){logger[_0x4664('0xf')]('Trigger,\x20%s,\x20%s',_0x555c2a,_0x1a8cbc);_0x2b1d8c(_0x1a8cbc);});});}exports[_0x4664('0x13')]=function(_0x4a235d){var _0x226b04=this;return new Promise(function(_0x396057,_0x856fc7){return db[_0x4664('0x14')][_0x4664('0x15')]({'raw':_0x4a235d[_0x4664('0x16')]?_0x4a235d[_0x4664('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4a235d[_0x4664('0x16')]?_0x4a235d['options']['where']||null:null,'attributes':_0x4a235d[_0x4664('0x16')]?_0x4a235d['options'][_0x4664('0x17')]||null:null,'limit':_0x4a235d['options']?_0x4a235d['options'][_0x4664('0x18')]||null:null,'include':_0x4a235d[_0x4664('0x16')]?_0x4a235d['options'][_0x4664('0x19')]?_['map'](_0x4a235d[_0x4664('0x16')][_0x4664('0x19')],function(_0x43f683){return{'model':db[_0x43f683['model']],'as':_0x43f683['as'],'attributes':_0x43f683['attributes'],'include':_0x43f683[_0x4664('0x19')]?_[_0x4664('0x1a')](_0x43f683[_0x4664('0x19')],function(_0x429d37){return{'model':db[_0x429d37['model']],'as':_0x429d37['as'],'attributes':_0x429d37[_0x4664('0x17')],'include':_0x429d37[_0x4664('0x19')]?_[_0x4664('0x1a')](_0x429d37[_0x4664('0x19')],function(_0x5a89a1){return{'model':db[_0x5a89a1[_0x4664('0x1b')]],'as':_0x5a89a1['as'],'attributes':_0x5a89a1[_0x4664('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4664('0x9')](function(_0x4ab07f){logger[_0x4664('0xa')]('GetTrigger',_0x4a235d);logger[_0x4664('0xd')](_0x4664('0x13'),_0x4a235d,JSON[_0x4664('0xe')](_0x4ab07f));_0x396057(_0x4ab07f);})[_0x4664('0x12')](function(_0x4b1e8c){logger[_0x4664('0xf')](_0x4664('0x13'),_0x4b1e8c[_0x4664('0x10')],_0x4a235d);_0x856fc7(_0x226b04[_0x4664('0xf')](0x1f4,_0x4b1e8c[_0x4664('0x10')]));});});};exports['ShowTrigger']=function(_0x6b5543){var _0x35dd08=this;return new Promise(function(_0x2ddacb,_0x5c48ca){return db[_0x4664('0x14')][_0x4664('0x1c')]({'raw':_0x6b5543['options']?_0x6b5543['options'][_0x4664('0x1d')]===undefined?!![]:![]:!![],'where':_0x6b5543[_0x4664('0x16')]?_0x6b5543[_0x4664('0x16')][_0x4664('0x1e')]||null:null,'attributes':_0x6b5543['options']?_0x6b5543[_0x4664('0x16')][_0x4664('0x17')]||null:null,'include':_0x6b5543[_0x4664('0x16')]?_0x6b5543['options'][_0x4664('0x19')]?_[_0x4664('0x1a')](_0x6b5543[_0x4664('0x16')][_0x4664('0x19')],function(_0xc329a4){return{'model':db[_0xc329a4[_0x4664('0x1b')]],'as':_0xc329a4['as'],'attributes':_0xc329a4[_0x4664('0x17')],'include':_0xc329a4[_0x4664('0x19')]?_[_0x4664('0x1a')](_0xc329a4[_0x4664('0x19')],function(_0x3c30f7){return{'model':db[_0x3c30f7[_0x4664('0x1b')]],'as':_0x3c30f7['as'],'attributes':_0x3c30f7[_0x4664('0x17')],'include':_0x3c30f7[_0x4664('0x19')]?_['map'](_0x3c30f7[_0x4664('0x19')],function(_0x206be2){return{'model':db[_0x206be2[_0x4664('0x1b')]],'as':_0x206be2['as'],'attributes':_0x206be2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4664('0x9')](function(_0x2914de){logger[_0x4664('0xa')](_0x4664('0x1f'),_0x6b5543);logger[_0x4664('0xd')](_0x4664('0x1f'),_0x6b5543,JSON[_0x4664('0xe')](_0x2914de));_0x2ddacb(_0x2914de);})['catch'](function(_0x4e9374){logger['error'](_0x4664('0x1f'),_0x4e9374['message'],_0x6b5543);_0x5c48ca(_0x35dd08[_0x4664('0xf')](0x1f4,_0x4e9374[_0x4664('0x10')]));});});}; \ No newline at end of file +var _0x058c=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTrigger','Trigger','findAll','options','where','attributes','limit','include','map','model','ShowTrigger','find','raw','debug','moment','bluebird'];(function(_0x222c9d,_0x15af2d){var _0x12cbbe=function(_0x3e1821){while(--_0x3e1821){_0x222c9d['push'](_0x222c9d['shift']());}};_0x12cbbe(++_0x15af2d);}(_0x058c,0x169));var _0xc058=function(_0x286075,_0x2268a1){_0x286075=_0x286075-0x0;var _0x1e174a=_0x058c[_0x286075];return _0x1e174a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc058('0x0'));var BPromise=require(_0xc058('0x1'));var rs=require(_0xc058('0x2'));var fs=require('fs');var Redis=require(_0xc058('0x3'));var db=require(_0xc058('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc058('0x5'));var config=require(_0xc058('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc058('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x550bc0,_0xc4db7e,_0x49be31){return new BPromise(function(_0x4a1885,_0x56be0a){return client[_0xc058('0x8')](_0x550bc0,_0x49be31)[_0xc058('0x9')](function(_0x563d60){logger['info'](_0xc058('0xa'),_0xc4db7e,_0xc058('0xb'));logger['debug'](_0xc058('0xc'),_0xc4db7e,_0xc058('0xb'),JSON[_0xc058('0xd')](_0x563d60));if(_0x563d60['error']){if(_0x563d60[_0xc058('0xe')][_0xc058('0xf')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0xc4db7e,_0x563d60[_0xc058('0xe')][_0xc058('0x10')]);return _0x56be0a(_0x563d60['error'][_0xc058('0x10')]);}logger[_0xc058('0xe')](_0xc058('0xa'),_0xc4db7e,_0x563d60[_0xc058('0xe')]['message']);return _0x4a1885(_0x563d60[_0xc058('0xe')]['message']);}else{logger[_0xc058('0x11')](_0xc058('0xa'),_0xc4db7e,_0xc058('0xb'));_0x4a1885(_0x563d60['result'][_0xc058('0x10')]);}})[_0xc058('0x12')](function(_0x53eeaa){logger[_0xc058('0xe')]('Trigger,\x20%s,\x20%s',_0xc4db7e,_0x53eeaa);_0x56be0a(_0x53eeaa);});});}exports[_0xc058('0x13')]=function(_0x4386ad){var _0x53d8b4=this;return new Promise(function(_0x54fde8,_0x5ac60d){return db[_0xc058('0x14')][_0xc058('0x15')]({'raw':_0x4386ad[_0xc058('0x16')]?_0x4386ad['options']['raw']===undefined?!![]:![]:!![],'where':_0x4386ad['options']?_0x4386ad['options'][_0xc058('0x17')]||null:null,'attributes':_0x4386ad['options']?_0x4386ad[_0xc058('0x16')][_0xc058('0x18')]||null:null,'limit':_0x4386ad['options']?_0x4386ad[_0xc058('0x16')][_0xc058('0x19')]||null:null,'include':_0x4386ad[_0xc058('0x16')]?_0x4386ad['options'][_0xc058('0x1a')]?_[_0xc058('0x1b')](_0x4386ad[_0xc058('0x16')][_0xc058('0x1a')],function(_0x2001e0){return{'model':db[_0x2001e0[_0xc058('0x1c')]],'as':_0x2001e0['as'],'attributes':_0x2001e0[_0xc058('0x18')],'include':_0x2001e0[_0xc058('0x1a')]?_[_0xc058('0x1b')](_0x2001e0[_0xc058('0x1a')],function(_0x551175){return{'model':db[_0x551175[_0xc058('0x1c')]],'as':_0x551175['as'],'attributes':_0x551175[_0xc058('0x18')],'include':_0x551175[_0xc058('0x1a')]?_[_0xc058('0x1b')](_0x551175[_0xc058('0x1a')],function(_0x2f058b){return{'model':db[_0x2f058b[_0xc058('0x1c')]],'as':_0x2f058b['as'],'attributes':_0x2f058b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc058('0x9')](function(_0x1f2f36){logger[_0xc058('0x11')]('GetTrigger',_0x4386ad);logger['debug'](_0xc058('0x13'),_0x4386ad,JSON[_0xc058('0xd')](_0x1f2f36));_0x54fde8(_0x1f2f36);})[_0xc058('0x12')](function(_0x307068){logger[_0xc058('0xe')](_0xc058('0x13'),_0x307068[_0xc058('0x10')],_0x4386ad);_0x5ac60d(_0x53d8b4['error'](0x1f4,_0x307068[_0xc058('0x10')]));});});};exports[_0xc058('0x1d')]=function(_0x12ace1){var _0x281bcd=this;return new Promise(function(_0xc6a11e,_0x5eae98){return db[_0xc058('0x14')][_0xc058('0x1e')]({'raw':_0x12ace1[_0xc058('0x16')]?_0x12ace1[_0xc058('0x16')][_0xc058('0x1f')]===undefined?!![]:![]:!![],'where':_0x12ace1['options']?_0x12ace1[_0xc058('0x16')]['where']||null:null,'attributes':_0x12ace1['options']?_0x12ace1[_0xc058('0x16')]['attributes']||null:null,'include':_0x12ace1[_0xc058('0x16')]?_0x12ace1[_0xc058('0x16')][_0xc058('0x1a')]?_[_0xc058('0x1b')](_0x12ace1[_0xc058('0x16')][_0xc058('0x1a')],function(_0xe3c353){return{'model':db[_0xe3c353['model']],'as':_0xe3c353['as'],'attributes':_0xe3c353['attributes'],'include':_0xe3c353[_0xc058('0x1a')]?_[_0xc058('0x1b')](_0xe3c353[_0xc058('0x1a')],function(_0x522e3e){return{'model':db[_0x522e3e[_0xc058('0x1c')]],'as':_0x522e3e['as'],'attributes':_0x522e3e[_0xc058('0x18')],'include':_0x522e3e[_0xc058('0x1a')]?_[_0xc058('0x1b')](_0x522e3e[_0xc058('0x1a')],function(_0xa32912){return{'model':db[_0xa32912[_0xc058('0x1c')]],'as':_0xa32912['as'],'attributes':_0xa32912[_0xc058('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc058('0x9')](function(_0x3a1c31){logger['info'](_0xc058('0x1d'),_0x12ace1);logger[_0xc058('0x20')]('ShowTrigger',_0x12ace1,JSON[_0xc058('0xd')](_0x3a1c31));_0xc6a11e(_0x3a1c31);})['catch'](function(_0x8b0a71){logger[_0xc058('0xe')](_0xc058('0x1d'),_0x8b0a71['message'],_0x12ace1);_0x5eae98(_0x281bcd[_0xc058('0xe')](0x1f4,_0x8b0a71['message']));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 905631c..c9fc1d9 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 _0xf55d=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','destroy'];(function(_0x9749b1,_0xd10407){var _0x4ee028=function(_0x4c6990){while(--_0x4c6990){_0x9749b1['push'](_0x9749b1['shift']());}};_0x4ee028(++_0xd10407);}(_0xf55d,0x12d));var _0xdf55=function(_0x4bf023,_0x47890d){_0x4bf023=_0x4bf023-0x0;var _0x27e9d4=_0xf55d[_0x4bf023];return _0x27e9d4;};'use strict';var multer=require(_0xdf55('0x0'));var util=require(_0xdf55('0x1'));var path=require(_0xdf55('0x2'));var timeout=require(_0xdf55('0x3'));var express=require(_0xdf55('0x4'));var router=express['Router']();var fs_extra=require(_0xdf55('0x5'));var auth=require(_0xdf55('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdf55('0x7'));var controller=require(_0xdf55('0x8'));router[_0xdf55('0x9')]('/',auth[_0xdf55('0xa')](),controller[_0xdf55('0xb')]);router[_0xdf55('0x9')](_0xdf55('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xdf55('0xd')](_0xdf55('0xe'),auth['isAuthenticated'](),controller[_0xdf55('0xf')]);router[_0xdf55('0xd')]('/',auth[_0xdf55('0xa')](),controller[_0xdf55('0x10')]);router[_0xdf55('0x11')](_0xdf55('0xc'),auth[_0xdf55('0xa')](),controller['update']);router['delete'](_0xdf55('0xc'),auth['isAuthenticated'](),controller[_0xdf55('0x12')]);module[_0xdf55('0x13')]=router; \ No newline at end of file +var _0x8a8a=['put','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8a8a,0x158));var _0xa8a8=function(_0x1f05f6,_0x27c69d){_0x1f05f6=_0x1f05f6-0x0;var _0x1ccf07=_0x8a8a[_0x1f05f6];return _0x1ccf07;};'use strict';var multer=require(_0xa8a8('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa8a8('0x1'));var express=require(_0xa8a8('0x2'));var router=express[_0xa8a8('0x3')]();var fs_extra=require(_0xa8a8('0x4'));var auth=require(_0xa8a8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa8a8('0x6'));var controller=require(_0xa8a8('0x7'));router[_0xa8a8('0x8')]('/',auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xa')]);router['get'](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller['show']);router[_0xa8a8('0xc')](_0xa8a8('0xd'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xe')]);router[_0xa8a8('0xc')]('/',auth[_0xa8a8('0x9')](),controller[_0xa8a8('0xf')]);router[_0xa8a8('0x10')](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0x11')]);router[_0xa8a8('0x12')](_0xa8a8('0xb'),auth[_0xa8a8('0x9')](),controller[_0xa8a8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 3d65e93..88acc59 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 _0xe68f=['certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','ENUM','friend','user','peer','STRING','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','INTEGER','always','accept','refuse','originate','uas','pai','fingerprint'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0xe68f,0x110));var _0xfe68=function(_0x13db34,_0x580cb1){_0x13db34=_0x13db34-0x0;var _0x5ad37b=_0xe68f[_0x13db34];return _0x5ad37b;};'use strict';var Sequelize=require(_0xfe68('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x2'),_0xfe68('0x3'),_0xfe68('0x4')),'allowNull':![],'defaultValue':_0xfe68('0x2')},'context':{'type':Sequelize[_0xfe68('0x5')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x6'),_0xfe68('0x7'),'ALLOWED_FAILED_SCREEN',_0xfe68('0x8'),_0xfe68('0x9'),_0xfe68('0xa'),'PROHIB_FAILED_SCREEN',_0xfe68('0xb'))},'deny':{'type':Sequelize[_0xfe68('0x5')]},'permit':{'type':Sequelize[_0xfe68('0x5')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0xfe68('0x5')]},'remotesecret':{'type':Sequelize[_0xfe68('0x5')]},'transport':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':_0xfe68('0xc'),'set':function(_0x481191){this[_0xfe68('0xd')](_0xfe68('0xe'),_0x481191?_0x481191[_0xfe68('0xf')](','):null);},'get':function(){return this[_0xfe68('0x10')](_0xfe68('0xe'))?this[_0xfe68('0x10')](_0xfe68('0xe'))[_0xfe68('0x11')](','):null;},'comment':_0xfe68('0x12')},'dtmfmode':{'type':Sequelize['ENUM'](_0xfe68('0x13'),'info',_0xfe68('0x14'),_0xfe68('0x15'),_0xfe68('0x16')),'defaultValue':_0xfe68('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no',_0xfe68('0x18'),_0xfe68('0x19'),_0xfe68('0x1a')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xfe68('0x5')]},'directmediadeny':{'type':Sequelize[_0xfe68('0x5')]},'nat':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':_0xfe68('0x1b'),'set':function(_0x46dc55){this['setDataValue'](_0xfe68('0x1c'),_0x46dc55?_0x46dc55['join'](','):null);},'get':function(){return this[_0xfe68('0x10')](_0xfe68('0x1c'))?this[_0xfe68('0x10')](_0xfe68('0x1c'))['split'](','):null;},'comment':_0xfe68('0x1d')},'callgroup':{'type':Sequelize[_0xfe68('0x5')]},'namedcallgroup':{'type':Sequelize[_0xfe68('0x5')]},'pickupgroup':{'type':Sequelize[_0xfe68('0x5')]},'namedpickupgroup':{'type':Sequelize[_0xfe68('0x5')]},'language':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xfe68('0x5')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xfe68('0x1e')},'allow':{'type':Sequelize[_0xfe68('0x5')],'allowNull':![],'defaultValue':_0xfe68('0x1f'),'set':function(_0x2c58d7){this[_0xfe68('0xd')](_0xfe68('0x20'),_0x2c58d7?_0x2c58d7[_0xfe68('0xf')](';'):_0xfe68('0x1f'));},'get':function(){return this[_0xfe68('0x10')](_0xfe68('0x20'))?this[_0xfe68('0x10')](_0xfe68('0x20'))[_0xfe68('0x11')](';'):null;},'comment':_0xfe68('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no')},'insecure':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':'port,invite','set':function(_0x5e075e){this['setDataValue'](_0xfe68('0x22'),_0x5e075e?_0x5e075e[_0xfe68('0xf')](','):null);},'get':function(){return this['getDataValue'](_0xfe68('0x22'))?this['getDataValue'](_0xfe68('0x22'))[_0xfe68('0x11')](','):null;},'comment':_0xfe68('0x23')},'trustrpid':{'type':Sequelize[_0xfe68('0x1')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xfe68('0x1')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xfe68('0x1')]('yes','no',_0xfe68('0x24'))},'promiscredir':{'type':Sequelize[_0xfe68('0x1')]('yes','no')},'useclientcode':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize[_0xfe68('0x5')]},'callerid':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':_0xfe68('0x25')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no'),'defaultValue':_0xfe68('0x17')},'busylevel':{'type':Sequelize[_0xfe68('0x26')](0xb)},'allowoverlap':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0xfe68('0x5')]},'template':{'type':Sequelize[_0xfe68('0x5')]},'videosupport':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no',_0xfe68('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xfe68('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x28'),_0xfe68('0x29'),_0xfe68('0x2a'))},'session_expires':{'type':Sequelize[_0xfe68('0x26')](0xb)},'session_minse':{'type':Sequelize[_0xfe68('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0xfe68('0x1')]('uac','uas'),'defaultValue':_0xfe68('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xfe68('0x5')]},'regexten':{'type':Sequelize[_0xfe68('0x5')]},'fromdomain':{'type':Sequelize[_0xfe68('0x5')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfe68('0x26')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no'),'defaultValue':_0xfe68('0x17')},'keepalive':{'type':Sequelize[_0xfe68('0x26')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xfe68('0x5')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xfe68('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0xfe68('0x1')]('yes','no',_0xfe68('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xfe68('0x5')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0xfe68('0x26')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0xfe68('0x26')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xfe68('0x5')]},'contactacl':{'type':Sequelize[_0xfe68('0x5')]},'unsolicited_mailbox':{'type':Sequelize[_0xfe68('0x5')]},'use_q850_reason':{'type':Sequelize[_0xfe68('0x5')]},'maxforwards':{'type':Sequelize[_0xfe68('0x26')](0xb)},'encryption':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'force_avp':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xfe68('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no',_0xfe68('0x2d'),_0xfe68('0x2e'))},'dtlsrekey':{'type':Sequelize[_0xfe68('0x26')](0xb)},'dtlscertfile':{'type':Sequelize[_0xfe68('0x5')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0xfe68('0x5')]},'dtlscafile':{'type':Sequelize[_0xfe68('0x5')]},'dtlscapath':{'type':Sequelize[_0xfe68('0x5')]},'dtlssetup':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x2f'),_0xfe68('0x30'),_0xfe68('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xfe68('0x5')]},'usereqphone':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xfe68('0x5')]},'call_limit':{'type':Sequelize[_0xfe68('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0xfe68('0x1')]('yes','no')},'vmexten':{'type':Sequelize[_0xfe68('0x5')]},'mohinterpret':{'type':Sequelize[_0xfe68('0x5')]},'mohsuggest':{'type':Sequelize[_0xfe68('0x5')]},'parkinglot':{'type':Sequelize[_0xfe68('0x5')]},'description':{'type':Sequelize[_0xfe68('0x5')]},'host':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':_0xfe68('0x32')},'canreinvite':{'type':Sequelize[_0xfe68('0x1')](_0xfe68('0x17'),'no',_0xfe68('0x18'),_0xfe68('0x19'),_0xfe68('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xfe68('0x5')]},'otherFields':{'type':Sequelize[_0xfe68('0x5')]},'active':{'type':Sequelize[_0xfe68('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xfe68('0x5')],'defaultValue':'no'}}; \ No newline at end of file +var _0x5e7b=['getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','nonat','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','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<>','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','dynamic','update,nonat','sequelize','exports','STRING','name','ENUM','friend','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x5e7b,0x141));var _0xb5e7=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x5e7b[_0x5e9a69];return _0x5979c8;};'use strict';var Sequelize=require(_0xb5e7('0x0'));module[_0xb5e7('0x1')]={'name':{'type':Sequelize[_0xb5e7('0x2')],'allowNull':![],'unique':_0xb5e7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x5'),'user',_0xb5e7('0x6')),'allowNull':![],'defaultValue':_0xb5e7('0x5')},'context':{'type':Sequelize[_0xb5e7('0x2')],'allowNull':![],'defaultValue':_0xb5e7('0x7')},'callingpres':{'type':Sequelize[_0xb5e7('0x4')]('ALLOWED_NOT_SCREENED',_0xb5e7('0x8'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xb5e7('0x9'),_0xb5e7('0xa'),_0xb5e7('0xb'),_0xb5e7('0xc'))},'deny':{'type':Sequelize[_0xb5e7('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xb5e7('0x2')]},'transport':{'type':Sequelize[_0xb5e7('0x2')],'defaultValue':'udp','set':function(_0x514b60){this['setDataValue'](_0xb5e7('0xd'),_0x514b60?_0x514b60[_0xb5e7('0xe')](','):null);},'get':function(){return this[_0xb5e7('0xf')]('transport')?this[_0xb5e7('0xf')](_0xb5e7('0xd'))[_0xb5e7('0x10')](','):null;},'comment':_0xb5e7('0x11')},'dtmfmode':{'type':Sequelize['ENUM'](_0xb5e7('0x12'),_0xb5e7('0x13'),_0xb5e7('0x14'),_0xb5e7('0x15'),_0xb5e7('0x16')),'defaultValue':_0xb5e7('0x12')},'directmedia':{'type':Sequelize[_0xb5e7('0x4')]('yes','no',_0xb5e7('0x17'),'update',_0xb5e7('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xb5e7('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xb5e7('0x1a'),'set':function(_0x22a712){this[_0xb5e7('0x1b')](_0xb5e7('0x1c'),_0x22a712?_0x22a712[_0xb5e7('0xe')](','):null);},'get':function(){return this['getDataValue'](_0xb5e7('0x1c'))?this['getDataValue'](_0xb5e7('0x1c'))[_0xb5e7('0x10')](','):null;},'comment':_0xb5e7('0x1d')},'callgroup':{'type':Sequelize[_0xb5e7('0x2')]},'namedcallgroup':{'type':Sequelize[_0xb5e7('0x2')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0xb5e7('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xb5e7('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x15cf50){this[_0xb5e7('0x1b')](_0xb5e7('0x1e'),_0x15cf50?_0x15cf50[_0xb5e7('0xe')](';'):_0xb5e7('0x1f'));},'get':function(){return this[_0xb5e7('0xf')]('allow')?this[_0xb5e7('0xf')](_0xb5e7('0x1e'))['split'](';'):null;},'comment':_0xb5e7('0x20')},'autoframing':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'insecure':{'type':Sequelize[_0xb5e7('0x2')],'defaultValue':'port,invite','set':function(_0x55b8ef){this[_0xb5e7('0x1b')]('insecure',_0x55b8ef?_0x55b8ef[_0xb5e7('0xe')](','):null);},'get':function(){return this[_0xb5e7('0xf')](_0xb5e7('0x21'))?this[_0xb5e7('0xf')](_0xb5e7('0x21'))[_0xb5e7('0x10')](','):null;},'comment':_0xb5e7('0x22')},'trustrpid':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no',_0xb5e7('0x23'))},'promiscredir':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no')},'useclientcode':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'accountcode':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'setvar':{'type':Sequelize[_0xb5e7('0x2')]},'callerid':{'type':Sequelize[_0xb5e7('0x2')],'defaultValue':_0xb5e7('0x25')},'amaflags':{'type':Sequelize[_0xb5e7('0x2')]},'callcounter':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no'),'defaultValue':_0xb5e7('0x19')},'busylevel':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'allowoverlap':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0xb5e7('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb)},'rfc2833compensate':{'type':Sequelize[_0xb5e7('0x4')]('yes','no')},'mailbox':{'type':Sequelize[_0xb5e7('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0xb5e7('0x26'),_0xb5e7('0x27'),_0xb5e7('0x28'))},'session_expires':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'session_minse':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x29'),_0xb5e7('0x2a')),'defaultValue':_0xb5e7('0x2a')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xb5e7('0x2')]},'fromuser':{'type':Sequelize[_0xb5e7('0x2')]},'port':{'type':Sequelize[_0xb5e7('0x24')](0x5)},'qualify':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xb5e7('0x2')]},'rtptimeout':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xb5e7('0x2')]},'callbackextension':{'type':Sequelize[_0xb5e7('0x2')]},'timert1':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'timerb':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'contactpermit':{'type':Sequelize[_0xb5e7('0x2')]},'contactdeny':{'type':Sequelize[_0xb5e7('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xb5e7('0x2')]},'use_q850_reason':{'type':Sequelize[_0xb5e7('0x2')]},'maxforwards':{'type':Sequelize[_0xb5e7('0x24')](0xb)},'encryption':{'type':Sequelize[_0xb5e7('0x4')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'force_avp':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no')},'icesupport':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no',_0xb5e7('0x2b'),_0xb5e7('0x2c'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xb5e7('0x2')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0xb5e7('0x2')]},'dtlscapath':{'type':Sequelize[_0xb5e7('0x2')]},'dtlssetup':{'type':Sequelize[_0xb5e7('0x4')]('active',_0xb5e7('0x2d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xb5e7('0x2')]},'usereqphone':{'type':Sequelize[_0xb5e7('0x4')](_0xb5e7('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xb5e7('0x2')]},'recordofffeature':{'type':Sequelize[_0xb5e7('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0xb5e7('0x4')]('yes','no')},'vmexten':{'type':Sequelize[_0xb5e7('0x2')]},'mohinterpret':{'type':Sequelize[_0xb5e7('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xb5e7('0x2')]},'description':{'type':Sequelize[_0xb5e7('0x2')]},'host':{'type':Sequelize[_0xb5e7('0x2')],'defaultValue':_0xb5e7('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0xb5e7('0x19'),'no',_0xb5e7('0x17'),'update',_0xb5e7('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xb5e7('0x2')]},'otherFields':{'type':Sequelize[_0xb5e7('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xb5e7('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 9127da7..6eb5f47 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 _0xbec5=['readFileSync','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_registers.conf','Reload','Unable\x20to\x20retrieve\x20the\x20current\x20user','update','/etc/asterisk/sip_xcally_trunks.conf','chan_sip.so','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','end','offset','limit','undefined','count','set','json','apply','reject','Trunks','UserProfileResource','destroy','stack','name','send','map','Trunk','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','attributes','find','clone','get','omit','updatedAt','body','createdAt','create','user','role','UserProfileSection','userProfileId','autoAssociation','join','server/files/templates/trunk.ejs','utf8'];(function(_0x1b4d0c,_0x5f1350){var _0x30d5b7=function(_0x270510){while(--_0x270510){_0x1b4d0c['push'](_0x1b4d0c['shift']());}};_0x30d5b7(++_0x5f1350);}(_0xbec5,0xe5));var _0x5bec=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0xbec5[_0x5e9a69];return _0x5979c8;};'use strict';var emlformat=require(_0x5bec('0x0'));var rimraf=require(_0x5bec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bec('0x2'));var rp=require(_0x5bec('0x3'));var moment=require(_0x5bec('0x4'));var BPromise=require(_0x5bec('0x5'));var Mustache=require(_0x5bec('0x6'));var util=require('util');var path=require(_0x5bec('0x7'));var sox=require(_0x5bec('0x8'));var csv=require(_0x5bec('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bec('0xa'));var _=require(_0x5bec('0xb'));var squel=require(_0x5bec('0xc'));var crypto=require(_0x5bec('0xd'));var jsforce=require(_0x5bec('0xe'));var deskjs=require(_0x5bec('0xf'));var toCsv=require(_0x5bec('0x9'));var querystring=require(_0x5bec('0x10'));var Papa=require('papaparse');var Redis=require(_0x5bec('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5bec('0x12'));var as=require(_0x5bec('0x13'));var hardwareService=require(_0x5bec('0x14'));var logger=require('../../config/logger')(_0x5bec('0x15'));var utils=require(_0x5bec('0x16'));var config=require(_0x5bec('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5bec('0x18'))['db'];var jayson=require(_0x5bec('0x19'));var client=jayson['client'][_0x5bec('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xaa984d,_0x35393a,_0x6888a4,_0x3198e0){return new BPromise(function(_0xcd6d90,_0x24dcd6){var _0x43fd2a=_0x3198e0||client;return _0x43fd2a[_0x5bec('0x1b')](_0xaa984d,_0x6888a4)[_0x5bec('0x1c')](function(_0x31b9e4){logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,'request\x20sent');logger['debug'](_0x5bec('0x1f'),_0x35393a,_0x5bec('0x20'),JSON[_0x5bec('0x21')](_0x31b9e4));if(_0x31b9e4[_0x5bec('0x22')]){if(_0x31b9e4['error']['code']===0x1f4){logger[_0x5bec('0x22')](_0x5bec('0x1e'),_0x35393a,_0x31b9e4['error'][_0x5bec('0x23')]);return _0x24dcd6(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x31b9e4[_0x5bec('0x22')]['message']);return _0xcd6d90(_0x31b9e4[_0x5bec('0x22')][_0x5bec('0x23')]);}else{logger[_0x5bec('0x1d')](_0x5bec('0x1e'),_0x35393a,_0x5bec('0x20'));_0xcd6d90(_0x31b9e4['result'][_0x5bec('0x23')]);}})['catch'](function(_0x2b2d26){logger[_0x5bec('0x22')]('Trunk,\x20%s,\x20%s',_0x35393a,_0x2b2d26);_0x24dcd6(_0x2b2d26);});});}function respondWithStatusCode(_0xa414f8,_0xbef70b){_0xbef70b=_0xbef70b||0xcc;return function(_0x4e0ca2){if(_0x4e0ca2){return _0xa414f8[_0x5bec('0x24')](_0xbef70b);}return _0xa414f8[_0x5bec('0x25')](_0xbef70b)[_0x5bec('0x26')]();};}function respondWithResult(_0x20da89,_0x226d55){_0x226d55=_0x226d55||0xc8;return function(_0x131143){if(_0x131143){return _0x20da89[_0x5bec('0x25')](_0x226d55)['json'](_0x131143);}};}function respondWithFilteredResult(_0x5b63ab,_0x5e44b3){return function(_0x2961bd){if(_0x2961bd){var _0x2cdd2f=typeof _0x5e44b3[_0x5bec('0x27')]==='undefined'&&typeof _0x5e44b3[_0x5bec('0x28')]===_0x5bec('0x29');var _0x57331b=_0x2961bd[_0x5bec('0x2a')];var _0x63ac8=_0x2cdd2f?0x0:_0x5e44b3['offset'];var _0x5336b3=_0x2cdd2f?_0x2961bd[_0x5bec('0x2a')]:_0x5e44b3[_0x5bec('0x27')]+_0x5e44b3[_0x5bec('0x28')];var _0x2c7a7b;if(_0x5336b3>=_0x57331b){_0x5336b3=_0x57331b;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x5b63ab[_0x5bec('0x25')](_0x2c7a7b);return _0x5b63ab[_0x5bec('0x2b')]('Content-Range',_0x63ac8+'-'+_0x5336b3+'/'+_0x57331b)[_0x5bec('0x2c')](_0x2961bd);}return null;};}function patchUpdates(_0x59b5b6){return function(_0x45863b){try{jsonpatch[_0x5bec('0x2d')](_0x45863b,_0x59b5b6,!![]);}catch(_0x3034c9){return BPromise[_0x5bec('0x2e')](_0x3034c9);}return _0x45863b['save']();};}function saveUpdates(_0x2b42c8,_0x1aba46){return function(_0xfc7d41){if(_0xfc7d41){return _0xfc7d41['update'](_0x2b42c8)[_0x5bec('0x1c')](function(_0x4cfb89){return _0x4cfb89;});}return null;};}function removeEntity(_0x14cdbf,_0x207192){return function(_0x29df14){if(_0x29df14){return _0x29df14['destroy']()[_0x5bec('0x1c')](function(){var _0x420ad4=_0x29df14['get']({'plain':!![]});var _0x34b441=_0x5bec('0x2f');return db[_0x5bec('0x30')][_0x5bec('0x31')]({'where':{'type':_0x34b441,'resourceId':_0x420ad4['id']}})[_0x5bec('0x1c')](function(){return _0x29df14;});})['then'](function(){_0x14cdbf[_0x5bec('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d3793,_0x384f04){return function(_0x182b86){if(!_0x182b86){_0x2d3793[_0x5bec('0x24')](0x194);}return _0x182b86;};}function handleError(_0x2e421e,_0x1923fc){_0x1923fc=_0x1923fc||0x1f4;return function(_0x49c8ef){logger[_0x5bec('0x22')](_0x49c8ef[_0x5bec('0x32')]);if(_0x49c8ef[_0x5bec('0x33')]){delete _0x49c8ef['name'];}_0x2e421e[_0x5bec('0x25')](_0x1923fc)[_0x5bec('0x34')](_0x49c8ef);};}exports['index']=function(_0xdb0430,_0x58c34e){var _0x400e22={},_0x2c0b08={},_0x402e5d={'count':0x0,'rows':[]};var _0x49cdfa=_[_0x5bec('0x35')](db[_0x5bec('0x36')][_0x5bec('0x37')],function(_0x139859){return{'name':_0x139859[_0x5bec('0x38')],'type':_0x139859[_0x5bec('0x39')][_0x5bec('0x3a')]};});_0x2c0b08['model']=_[_0x5bec('0x35')](_0x49cdfa,_0x5bec('0x33'));_0x2c0b08[_0x5bec('0x3b')]=_[_0x5bec('0x3c')](_0xdb0430['query']);_0x2c0b08[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],_0x2c0b08['query']);_0x400e22['attributes']=_[_0x5bec('0x3e')](_0x2c0b08[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x40')]));_0x400e22['attributes']=_0x400e22['attributes'][_0x5bec('0x41')]?_0x400e22['attributes']:_0x2c0b08[_0x5bec('0x3f')];if(!_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x42')]('nolimit')){_0x400e22[_0x5bec('0x28')]=qs[_0x5bec('0x28')](_0xdb0430['query'][_0x5bec('0x28')]);_0x400e22[_0x5bec('0x27')]=qs[_0x5bec('0x27')](_0xdb0430[_0x5bec('0x3b')][_0x5bec('0x27')]);}_0x400e22[_0x5bec('0x43')]=qs[_0x5bec('0x44')](_0xdb0430['query']['sort']);_0x400e22[_0x5bec('0x45')]=qs['filters'](_['pick'](_0xdb0430[_0x5bec('0x3b')],_0x2c0b08['filters']),_0x49cdfa);if(_0xdb0430['query']['filter']){_0x400e22[_0x5bec('0x45')]=_[_0x5bec('0x46')](_0x400e22[_0x5bec('0x45')],{'$or':_[_0x5bec('0x35')](_0x49cdfa,function(_0x48858a){if(_0x48858a[_0x5bec('0x39')]!==_0x5bec('0x47')){var _0xa4d32={};_0xa4d32[_0x48858a[_0x5bec('0x33')]]={'$like':'%'+_0xdb0430['query'][_0x5bec('0x48')]+'%'};return _0xa4d32;}})});}_0x400e22=_[_0x5bec('0x46')]({},_0x400e22,_0xdb0430[_0x5bec('0x49')]);var _0x51a3f9={'where':_0x400e22[_0x5bec('0x45')]};return db['Trunk'][_0x5bec('0x2a')](_0x51a3f9)[_0x5bec('0x1c')](function(_0x133d5c){_0x402e5d[_0x5bec('0x2a')]=_0x133d5c;if(_0xdb0430['query'][_0x5bec('0x4a')]){_0x400e22[_0x5bec('0x4b')]=[{'all':!![]}];}return db[_0x5bec('0x36')][_0x5bec('0x4c')](_0x400e22);})[_0x5bec('0x1c')](function(_0x123758){_0x402e5d[_0x5bec('0x4d')]=_0x123758;return _0x402e5d;})['then'](respondWithFilteredResult(_0x58c34e,_0x400e22))[_0x5bec('0x4e')](handleError(_0x58c34e,null));};exports[_0x5bec('0x4f')]=function(_0x5775ca,_0x273e09){var _0x3e6180={'raw':![],'where':{'id':_0x5775ca[_0x5bec('0x50')]['id']}},_0x34ee24={};_0x34ee24[_0x5bec('0x3f')]=_[_0x5bec('0x3c')](db[_0x5bec('0x36')]['rawAttributes']);_0x34ee24[_0x5bec('0x3b')]=_['keys'](_0x5775ca[_0x5bec('0x3b')]);_0x34ee24[_0x5bec('0x3d')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],_0x34ee24[_0x5bec('0x3b')]);_0x3e6180[_0x5bec('0x51')]=_[_0x5bec('0x3e')](_0x34ee24[_0x5bec('0x3f')],qs[_0x5bec('0x40')](_0x5775ca[_0x5bec('0x3b')]['fields']));_0x3e6180[_0x5bec('0x51')]=_0x3e6180['attributes']['length']?_0x3e6180[_0x5bec('0x51')]:_0x34ee24['model'];if(_0x5775ca['query'][_0x5bec('0x4a')]){_0x3e6180[_0x5bec('0x4b')]=[{'all':!![]}];}_0x3e6180=_[_0x5bec('0x46')]({},_0x3e6180,_0x5775ca['options']);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0x3e6180)[_0x5bec('0x1c')](handleEntityNotFound(_0x273e09,null))[_0x5bec('0x1c')](respondWithResult(_0x273e09,null))['catch'](handleError(_0x273e09,null));};exports[_0x5bec('0x53')]=function(_0x209da3,_0x9cae50){var _0xc8563a={'where':{'id':_0x209da3[_0x5bec('0x50')]['id']}},_0x2f736c={};_0x2f736c[_0x5bec('0x3f')]=_['keys'](db['Trunk'][_0x5bec('0x37')]);_0xc8563a['attributes']=_[_0x5bec('0x3e')](_0x2f736c[_0x5bec('0x3f')],qs['fields'](_0x209da3[_0x5bec('0x3b')]['fields']));_0xc8563a[_0x5bec('0x51')]=_0xc8563a[_0x5bec('0x51')][_0x5bec('0x41')]?_0xc8563a[_0x5bec('0x51')]:_0x2f736c[_0x5bec('0x3f')];if(_0x209da3[_0x5bec('0x3b')][_0x5bec('0x4a')]){_0xc8563a[_0x5bec('0x4b')]=[{'all':!![]}];}_0xc8563a=_[_0x5bec('0x46')]({},_0xc8563a,_0x209da3[_0x5bec('0x49')]);return db[_0x5bec('0x36')][_0x5bec('0x52')](_0xc8563a)[_0x5bec('0x1c')](handleEntityNotFound(_0x9cae50,null))[_0x5bec('0x1c')](function(_0x51b25d){if(_0x51b25d){var _0x2e33a7=_0x51b25d[_0x5bec('0x54')]({'plain':!![]});_0x2e33a7=qs[_0x5bec('0x55')](_0x2e33a7,['id','createdAt',_0x5bec('0x56')]);_0x209da3[_0x5bec('0x57')]=_[_0x5bec('0x55')](_0x209da3[_0x5bec('0x57')],['id',_0x5bec('0x58'),'updatedAt']);return db[_0x5bec('0x36')][_0x5bec('0x59')](_[_0x5bec('0x46')](_0x2e33a7,_0x209da3[_0x5bec('0x57')]),{'include':_0x209da3['query'][_0x5bec('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x2b701f){var _0x38deb0=_0x209da3[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0x38deb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38deb0[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x1b3c40=_0x2b701f[_0x5bec('0x54')]({'plain':!![]});var _0xc3e3df=_0x5bec('0x2f');return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0xc3e3df,'userProfileId':_0x38deb0[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0xfa751f){if(_0xfa751f&&_0xfa751f[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x1b3c40[_0x5bec('0x33')],'resourceId':_0x1b3c40['id'],'type':_0xfa751f['name'],'sectionId':_0xfa751f['id']},{})[_0x5bec('0x1c')](function(){return _0x2b701f;});}else{return _0x2b701f;}})[_0x5bec('0x4e')](function(_0x4e899c){logger[_0x5bec('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4e899c);throw _0x4e899c;});}return _0x2b701f;});}})[_0x5bec('0x1c')](respondWithResult(_0x9cae50,0xc9))[_0x5bec('0x4e')](handleError(_0x9cae50,null));};exports['create']=function(_0x5a2a85,_0xd54be0,_0xcac51d){var _0xb6cf85;return db[_0x5bec('0x36')][_0x5bec('0x59')](_0x5a2a85['body'],{'raw':!![]})[_0x5bec('0x1c')](function(_0x39cb06){_0xb6cf85=_0x39cb06;return db['Trunk'][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x44a945){var _0x34f31c=fs['readFileSync'](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),_0x5bec('0x61'));var _0x3ede1d=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x1ee139=ejs[_0x5bec('0x65')](_0x34f31c,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ee139);if(_0xb6cf85['registry']){var _0x3c305e=ejs[_0x5bec('0x65')](_0x3ede1d,{'trunks':_0x44a945||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0x3c305e);}})[_0x5bec('0x1c')](function(){return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x59'),{'module':'chan_sip.so'});})['then'](function(){var _0xc81e8f=_0x5a2a85[_0x5bec('0x5a')][_0x5bec('0x54')]({'plain':!![]});if(!_0xc81e8f)throw new Error(_0x5bec('0x69'));if(_0xc81e8f[_0x5bec('0x5b')]===_0x5bec('0x5a')){var _0x17cd00=_0xb6cf85[_0x5bec('0x54')]({'plain':!![]});return db[_0x5bec('0x5c')][_0x5bec('0x52')]({'where':{'name':_0x5bec('0x2f'),'userProfileId':_0xc81e8f[_0x5bec('0x5d')]},'raw':!![]})[_0x5bec('0x1c')](function(_0x325044){if(_0x325044&&_0x325044[_0x5bec('0x5e')]===0x0){return db[_0x5bec('0x30')][_0x5bec('0x59')]({'name':_0x17cd00[_0x5bec('0x33')],'resourceId':_0x17cd00['id'],'type':_0x325044[_0x5bec('0x33')],'sectionId':_0x325044['id']},{})[_0x5bec('0x1c')](function(){return _0xb6cf85;});}else{return _0xb6cf85;}})['catch'](function(_0x2e76c0){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e76c0);throw _0x2e76c0;});}return _0xb6cf85;})[_0x5bec('0x1c')](respondWithResult(_0xd54be0,0xc9))['catch'](handleError(_0xd54be0,null));};exports[_0x5bec('0x6a')]=function(_0x5d6af3,_0x5ca280,_0x2e849b){var _0x1b5ec0;return db['Trunk'][_0x5bec('0x52')]({'where':{'id':_0x5d6af3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x5ca280,null))[_0x5bec('0x1c')](saveUpdates(_0x5d6af3[_0x5bec('0x57')],null))[_0x5bec('0x1c')](function(_0xb76af2){if(_0xb76af2){_0x1b5ec0=_0xb76af2;return db[_0x5bec('0x36')]['findAll']({'raw':!![]});}})['then'](function(_0x2e8cd3){if(_0x2e8cd3){var _0x122c7f=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config['root'],_0x5bec('0x60')),'utf8');var _0x44ceec=fs[_0x5bec('0x62')](path[_0x5bec('0x5f')](config[_0x5bec('0x63')],_0x5bec('0x64')),_0x5bec('0x61'));var _0x38be2d=ejs[_0x5bec('0x65')](_0x122c7f,{'trunks':_0x2e8cd3||[]});fs['writeFileSync'](_0x5bec('0x6b'),_0x38be2d);var _0xe5f9e5=ejs[_0x5bec('0x65')](_0x44ceec,{'trunks':_0x2e8cd3||[]});fs[_0x5bec('0x66')](_0x5bec('0x67'),_0xe5f9e5);return respondWithRpcPromise('Reload',_0x5bec('0x6a'),{'module':_0x5bec('0x6c')});}return null;})['then'](function(_0x195c12){if(_0x195c12){return _0x1b5ec0;}})['then'](respondWithResult(_0x5ca280,null))[_0x5bec('0x4e')](handleError(_0x5ca280,null));};exports[_0x5bec('0x31')]=function(_0x4646a3,_0x313e1c,_0x437c3e){var _0x3d7600;return db[_0x5bec('0x36')][_0x5bec('0x52')]({'where':{'id':_0x4646a3[_0x5bec('0x50')]['id']}})[_0x5bec('0x1c')](handleEntityNotFound(_0x313e1c,null))[_0x5bec('0x1c')](removeEntity(_0x313e1c,null))[_0x5bec('0x1c')](function(){return db[_0x5bec('0x36')][_0x5bec('0x4c')]({'raw':!![]});})[_0x5bec('0x1c')](function(_0x1eaf2f){var _0x317e2a=fs[_0x5bec('0x62')](path['join'](config[_0x5bec('0x63')],'server/files/templates/trunk.ejs'),_0x5bec('0x61'));var _0xfcef92=fs['readFileSync'](path['join'](config[_0x5bec('0x63')],'server/files/templates/registry.ejs'),_0x5bec('0x61'));var _0x4b70df=ejs[_0x5bec('0x65')](_0x317e2a,{'trunks':_0x1eaf2f});var _0x27b40b=ejs['render'](_0xfcef92,{'trunks':_0x1eaf2f});fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4b70df);fs[_0x5bec('0x66')]('/etc/asterisk/sip_xcally_registers.conf',_0x27b40b);return respondWithRpcPromise(_0x5bec('0x68'),_0x5bec('0x31'),{'module':'chan_sip.so'});})[_0x5bec('0x4e')](handleError(_0x313e1c,null));}; \ No newline at end of file +var _0x9f62=['updatedAt','body','create','user','role','UserProfileSection','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','render','/etc/asterisk/sip_xcally_trunks.conf','Reload','server/files/templates/registry.ejs','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','get','Trunks','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','map','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','Trunk','findAll','rows','show','params','clone','find','omit','createdAt'];(function(_0x509b2a,_0xf91802){var _0x59ff9e=function(_0x5af97a){while(--_0x5af97a){_0x509b2a['push'](_0x509b2a['shift']());}};_0x59ff9e(++_0xf91802);}(_0x9f62,0x154));var _0x29f6=function(_0x414dc2,_0x4da6de){_0x414dc2=_0x414dc2-0x0;var _0x212dad=_0x9f62[_0x414dc2];return _0x212dad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x29f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29f6('0x1'));var rp=require(_0x29f6('0x2'));var moment=require(_0x29f6('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x29f6('0x4'));var path=require(_0x29f6('0x5'));var sox=require(_0x29f6('0x6'));var csv=require(_0x29f6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x29f6('0x8'));var _=require(_0x29f6('0x9'));var squel=require(_0x29f6('0xa'));var crypto=require(_0x29f6('0xb'));var jsforce=require(_0x29f6('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x29f6('0xd'));var authService=require(_0x29f6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29f6('0xf'));var logger=require(_0x29f6('0x10'))('api');var utils=require(_0x29f6('0x11'));var config=require(_0x29f6('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x29f6('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x55cf4,_0x189344,_0x11a1fd,_0x17de6e){return new BPromise(function(_0x156c96,_0x35d2e2){var _0x2418ee=_0x17de6e||client;return _0x2418ee[_0x29f6('0x14')](_0x55cf4,_0x11a1fd)[_0x29f6('0x15')](function(_0x28d314){logger[_0x29f6('0x16')](_0x29f6('0x17'),_0x189344,_0x29f6('0x18'));logger[_0x29f6('0x19')](_0x29f6('0x1a'),_0x189344,_0x29f6('0x18'),JSON['stringify'](_0x28d314));if(_0x28d314['error']){if(_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1c')]===0x1f4){logger[_0x29f6('0x1b')]('Trunk,\x20%s,\x20%s',_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x35d2e2(_0x28d314['error'][_0x29f6('0x1d')]);}logger[_0x29f6('0x1b')](_0x29f6('0x17'),_0x189344,_0x28d314[_0x29f6('0x1b')][_0x29f6('0x1d')]);return _0x156c96(_0x28d314[_0x29f6('0x1b')]['message']);}else{logger[_0x29f6('0x16')]('Trunk,\x20%s,\x20%s',_0x189344,'request\x20sent');_0x156c96(_0x28d314[_0x29f6('0x1e')][_0x29f6('0x1d')]);}})[_0x29f6('0x1f')](function(_0xafb5dd){logger['error'](_0x29f6('0x17'),_0x189344,_0xafb5dd);_0x35d2e2(_0xafb5dd);});});}function respondWithStatusCode(_0x49f67d,_0xd4179c){_0xd4179c=_0xd4179c||0xcc;return function(_0xcce041){if(_0xcce041){return _0x49f67d[_0x29f6('0x20')](_0xd4179c);}return _0x49f67d[_0x29f6('0x21')](_0xd4179c)['end']();};}function respondWithResult(_0x4290a2,_0x4d494f){_0x4d494f=_0x4d494f||0xc8;return function(_0x47c385){if(_0x47c385){return _0x4290a2[_0x29f6('0x21')](_0x4d494f)[_0x29f6('0x22')](_0x47c385);}};}function respondWithFilteredResult(_0x2519ac,_0x342038){return function(_0x84ccb7){if(_0x84ccb7){var _0x4333bc=typeof _0x342038[_0x29f6('0x23')]==='undefined'&&typeof _0x342038[_0x29f6('0x24')]===_0x29f6('0x25');var _0x1ab8d8=_0x84ccb7[_0x29f6('0x26')];var _0xda0a63=_0x4333bc?0x0:_0x342038[_0x29f6('0x23')];var _0x3790f5=_0x4333bc?_0x84ccb7[_0x29f6('0x26')]:_0x342038[_0x29f6('0x23')]+_0x342038[_0x29f6('0x24')];var _0x2915bc;if(_0x3790f5>=_0x1ab8d8){_0x3790f5=_0x1ab8d8;_0x2915bc=0xc8;}else{_0x2915bc=0xce;}_0x2519ac[_0x29f6('0x21')](_0x2915bc);return _0x2519ac[_0x29f6('0x27')](_0x29f6('0x28'),_0xda0a63+'-'+_0x3790f5+'/'+_0x1ab8d8)[_0x29f6('0x22')](_0x84ccb7);}return null;};}function patchUpdates(_0x218931){return function(_0x3a7249){try{jsonpatch['apply'](_0x3a7249,_0x218931,!![]);}catch(_0x5582d3){return BPromise[_0x29f6('0x29')](_0x5582d3);}return _0x3a7249['save']();};}function saveUpdates(_0x341071,_0xc8d2c5){return function(_0x1e1bb6){if(_0x1e1bb6){return _0x1e1bb6[_0x29f6('0x2a')](_0x341071)['then'](function(_0x53e11f){return _0x53e11f;});}return null;};}function removeEntity(_0x1bde69,_0xa6377c){return function(_0x2edc2e){if(_0x2edc2e){return _0x2edc2e[_0x29f6('0x2b')]()[_0x29f6('0x15')](function(){var _0x20bc5e=_0x2edc2e[_0x29f6('0x2c')]({'plain':!![]});var _0x1c3f0f=_0x29f6('0x2d');return db[_0x29f6('0x2e')][_0x29f6('0x2b')]({'where':{'type':_0x1c3f0f,'resourceId':_0x20bc5e['id']}})[_0x29f6('0x15')](function(){return _0x2edc2e;});})[_0x29f6('0x15')](function(){_0x1bde69[_0x29f6('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e31dd,_0x206beb){return function(_0x44cf19){if(!_0x44cf19){_0x5e31dd[_0x29f6('0x20')](0x194);}return _0x44cf19;};}function handleError(_0x5416dc,_0x3e1e25){_0x3e1e25=_0x3e1e25||0x1f4;return function(_0x749b9d){logger[_0x29f6('0x1b')](_0x749b9d[_0x29f6('0x2f')]);if(_0x749b9d[_0x29f6('0x30')]){delete _0x749b9d['name'];}_0x5416dc[_0x29f6('0x21')](_0x3e1e25)[_0x29f6('0x31')](_0x749b9d);};}exports[_0x29f6('0x32')]=function(_0x1b51cc,_0x4f5fe1){var _0x30d747={},_0x2a09e8={},_0x14b392={'count':0x0,'rows':[]};var _0x105557=_['map'](db['Trunk'][_0x29f6('0x33')],function(_0x4bfc80){return{'name':_0x4bfc80[_0x29f6('0x34')],'type':_0x4bfc80['type'][_0x29f6('0x35')]};});_0x2a09e8['model']=_[_0x29f6('0x36')](_0x105557,_0x29f6('0x30'));_0x2a09e8['query']=_[_0x29f6('0x37')](_0x1b51cc['query']);_0x2a09e8[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x2a09e8['model'],_0x2a09e8[_0x29f6('0x3a')]);_0x30d747[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2a09e8[_0x29f6('0x3c')],qs['fields'](_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x3d')]));_0x30d747[_0x29f6('0x3b')]=_0x30d747[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x30d747['attributes']:_0x2a09e8[_0x29f6('0x3c')];if(!_0x1b51cc['query'][_0x29f6('0x3f')]('nolimit')){_0x30d747[_0x29f6('0x24')]=qs[_0x29f6('0x24')](_0x1b51cc['query'][_0x29f6('0x24')]);_0x30d747[_0x29f6('0x23')]=qs[_0x29f6('0x23')](_0x1b51cc[_0x29f6('0x3a')]['offset']);}_0x30d747[_0x29f6('0x40')]=qs[_0x29f6('0x41')](_0x1b51cc[_0x29f6('0x3a')]['sort']);_0x30d747[_0x29f6('0x42')]=qs['filters'](_[_0x29f6('0x43')](_0x1b51cc['query'],_0x2a09e8['filters']),_0x105557);if(_0x1b51cc['query'][_0x29f6('0x44')]){_0x30d747[_0x29f6('0x42')]=_[_0x29f6('0x45')](_0x30d747[_0x29f6('0x42')],{'$or':_[_0x29f6('0x36')](_0x105557,function(_0x270842){if(_0x270842[_0x29f6('0x46')]!==_0x29f6('0x47')){var _0x352119={};_0x352119[_0x270842[_0x29f6('0x30')]]={'$like':'%'+_0x1b51cc['query']['filter']+'%'};return _0x352119;}})});}_0x30d747=_[_0x29f6('0x45')]({},_0x30d747,_0x1b51cc[_0x29f6('0x48')]);var _0x7a65c0={'where':_0x30d747[_0x29f6('0x42')]};return db['Trunk'][_0x29f6('0x26')](_0x7a65c0)[_0x29f6('0x15')](function(_0x532df5){_0x14b392[_0x29f6('0x26')]=_0x532df5;if(_0x1b51cc[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x30d747[_0x29f6('0x4a')]=[{'all':!![]}];}return db[_0x29f6('0x4b')][_0x29f6('0x4c')](_0x30d747);})[_0x29f6('0x15')](function(_0x1f03b6){_0x14b392[_0x29f6('0x4d')]=_0x1f03b6;return _0x14b392;})[_0x29f6('0x15')](respondWithFilteredResult(_0x4f5fe1,_0x30d747))[_0x29f6('0x1f')](handleError(_0x4f5fe1,null));};exports[_0x29f6('0x4e')]=function(_0x58ea69,_0x416c24){var _0x463551={'raw':![],'where':{'id':_0x58ea69[_0x29f6('0x4f')]['id']}},_0x335ec1={};_0x335ec1[_0x29f6('0x3c')]=_['keys'](db[_0x29f6('0x4b')]['rawAttributes']);_0x335ec1['query']=_[_0x29f6('0x37')](_0x58ea69[_0x29f6('0x3a')]);_0x335ec1[_0x29f6('0x38')]=_[_0x29f6('0x39')](_0x335ec1[_0x29f6('0x3c')],_0x335ec1['query']);_0x463551[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x335ec1['model'],qs[_0x29f6('0x3d')](_0x58ea69['query'][_0x29f6('0x3d')]));_0x463551[_0x29f6('0x3b')]=_0x463551[_0x29f6('0x3b')][_0x29f6('0x3e')]?_0x463551['attributes']:_0x335ec1[_0x29f6('0x3c')];if(_0x58ea69[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x463551[_0x29f6('0x4a')]=[{'all':!![]}];}_0x463551=_[_0x29f6('0x45')]({},_0x463551,_0x58ea69[_0x29f6('0x48')]);return db[_0x29f6('0x4b')]['find'](_0x463551)[_0x29f6('0x15')](handleEntityNotFound(_0x416c24,null))[_0x29f6('0x15')](respondWithResult(_0x416c24,null))[_0x29f6('0x1f')](handleError(_0x416c24,null));};exports[_0x29f6('0x50')]=function(_0x36e52c,_0x1ac20d){var _0x37c3c1={'where':{'id':_0x36e52c[_0x29f6('0x4f')]['id']}},_0x2f356d={};_0x2f356d[_0x29f6('0x3c')]=_['keys'](db['Trunk'][_0x29f6('0x33')]);_0x37c3c1[_0x29f6('0x3b')]=_[_0x29f6('0x39')](_0x2f356d['model'],qs[_0x29f6('0x3d')](_0x36e52c['query']['fields']));_0x37c3c1[_0x29f6('0x3b')]=_0x37c3c1[_0x29f6('0x3b')]['length']?_0x37c3c1['attributes']:_0x2f356d[_0x29f6('0x3c')];if(_0x36e52c[_0x29f6('0x3a')][_0x29f6('0x49')]){_0x37c3c1['include']=[{'all':!![]}];}_0x37c3c1=_[_0x29f6('0x45')]({},_0x37c3c1,_0x36e52c[_0x29f6('0x48')]);return db[_0x29f6('0x4b')][_0x29f6('0x51')](_0x37c3c1)[_0x29f6('0x15')](handleEntityNotFound(_0x1ac20d,null))[_0x29f6('0x15')](function(_0x7700da){if(_0x7700da){var _0x33b1d7=_0x7700da[_0x29f6('0x2c')]({'plain':!![]});_0x33b1d7=qs[_0x29f6('0x52')](_0x33b1d7,['id',_0x29f6('0x53'),_0x29f6('0x54')]);_0x36e52c[_0x29f6('0x55')]=_['omit'](_0x36e52c['body'],['id',_0x29f6('0x53'),'updatedAt']);return db[_0x29f6('0x4b')][_0x29f6('0x56')](_[_0x29f6('0x45')](_0x33b1d7,_0x36e52c[_0x29f6('0x55')]),{'include':_0x36e52c[_0x29f6('0x3a')]['includeAll']?[{'all':!![]}]:undefined})[_0x29f6('0x15')](function(_0x38d684){var _0x2f694e=_0x36e52c[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x2f694e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2f694e[_0x29f6('0x58')]==='user'){var _0x51b9dc=_0x38d684[_0x29f6('0x2c')]({'plain':!![]});var _0x336b8e='Trunks';return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':_0x336b8e,'userProfileId':_0x2f694e['userProfileId']},'raw':!![]})[_0x29f6('0x15')](function(_0x2ba44c){if(_0x2ba44c&&_0x2ba44c[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')][_0x29f6('0x56')]({'name':_0x51b9dc[_0x29f6('0x30')],'resourceId':_0x51b9dc['id'],'type':_0x2ba44c[_0x29f6('0x30')],'sectionId':_0x2ba44c['id']},{})['then'](function(){return _0x38d684;});}else{return _0x38d684;}})[_0x29f6('0x1f')](function(_0x50ddd6){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50ddd6);throw _0x50ddd6;});}return _0x38d684;});}})['then'](respondWithResult(_0x1ac20d,0xc9))[_0x29f6('0x1f')](handleError(_0x1ac20d,null));};exports[_0x29f6('0x56')]=function(_0x195887,_0x536b0c,_0x6ae738){var _0x373cf6;return db[_0x29f6('0x4b')]['create'](_0x195887[_0x29f6('0x55')],{'raw':!![]})[_0x29f6('0x15')](function(_0x66a7bb){_0x373cf6=_0x66a7bb;return db[_0x29f6('0x4b')][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x6587f3){var _0x41c1b9=fs['readFileSync'](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x1636f1=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],'server/files/templates/registry.ejs'),_0x29f6('0x5e'));var _0x1ca187=ejs['render'](_0x41c1b9,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x1ca187);if(_0x373cf6[_0x29f6('0x61')]){var _0x5a383f=ejs['render'](_0x1636f1,{'trunks':_0x6587f3||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x5a383f);}})['then'](function(){return respondWithRpcPromise('Reload','create',{'module':_0x29f6('0x63')});})[_0x29f6('0x15')](function(){var _0x144c76=_0x195887[_0x29f6('0x57')][_0x29f6('0x2c')]({'plain':!![]});if(!_0x144c76)throw new Error(_0x29f6('0x64'));if(_0x144c76[_0x29f6('0x58')]==='user'){var _0x11ef85=_0x373cf6[_0x29f6('0x2c')]({'plain':!![]});return db[_0x29f6('0x59')][_0x29f6('0x51')]({'where':{'name':'Trunks','userProfileId':_0x144c76[_0x29f6('0x65')]},'raw':!![]})[_0x29f6('0x15')](function(_0x32a862){if(_0x32a862&&_0x32a862[_0x29f6('0x5a')]===0x0){return db[_0x29f6('0x2e')]['create']({'name':_0x11ef85[_0x29f6('0x30')],'resourceId':_0x11ef85['id'],'type':_0x32a862[_0x29f6('0x30')],'sectionId':_0x32a862['id']},{})[_0x29f6('0x15')](function(){return _0x373cf6;});}else{return _0x373cf6;}})[_0x29f6('0x1f')](function(_0x4273a3){logger[_0x29f6('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4273a3);throw _0x4273a3;});}return _0x373cf6;})[_0x29f6('0x15')](respondWithResult(_0x536b0c,0xc9))['catch'](handleError(_0x536b0c,null));};exports['update']=function(_0x4f9907,_0x842ae3,_0x5bcf90){var _0x425da2;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x4f9907[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x842ae3,null))[_0x29f6('0x15')](saveUpdates(_0x4f9907[_0x29f6('0x55')],null))['then'](function(_0x3a23f3){if(_0x3a23f3){_0x425da2=_0x3a23f3;return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});}})[_0x29f6('0x15')](function(_0x32fa77){if(_0x32fa77){var _0x1d6e32=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0xe14459=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0xa31c7d=ejs[_0x29f6('0x66')](_0x1d6e32,{'trunks':_0x32fa77||[]});fs['writeFileSync'](_0x29f6('0x67'),_0xa31c7d);var _0x57b9fb=ejs[_0x29f6('0x66')](_0xe14459,{'trunks':_0x32fa77||[]});fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x57b9fb);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2a'),{'module':_0x29f6('0x63')});}return null;})[_0x29f6('0x15')](function(_0x4203f1){if(_0x4203f1){return _0x425da2;}})[_0x29f6('0x15')](respondWithResult(_0x842ae3,null))[_0x29f6('0x1f')](handleError(_0x842ae3,null));};exports['destroy']=function(_0x1d61ff,_0x4c0acc,_0x16bb3c){var _0x144d8c;return db[_0x29f6('0x4b')][_0x29f6('0x51')]({'where':{'id':_0x1d61ff[_0x29f6('0x4f')]['id']}})[_0x29f6('0x15')](handleEntityNotFound(_0x4c0acc,null))[_0x29f6('0x15')](removeEntity(_0x4c0acc,null))[_0x29f6('0x15')](function(){return db['Trunk'][_0x29f6('0x4c')]({'raw':!![]});})[_0x29f6('0x15')](function(_0x4e185f){var _0x4bb53f=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x5d')),_0x29f6('0x5e'));var _0x906098=fs[_0x29f6('0x5f')](path[_0x29f6('0x5b')](config[_0x29f6('0x5c')],_0x29f6('0x69')),_0x29f6('0x5e'));var _0x3f51fa=ejs['render'](_0x4bb53f,{'trunks':_0x4e185f});var _0x4b9631=ejs[_0x29f6('0x66')](_0x906098,{'trunks':_0x4e185f});fs[_0x29f6('0x60')]('/etc/asterisk/sip_xcally_trunks.conf',_0x3f51fa);fs[_0x29f6('0x60')](_0x29f6('0x62'),_0x4b9631);return respondWithRpcPromise(_0x29f6('0x68'),_0x29f6('0x2b'),{'module':_0x29f6('0x63')});})[_0x29f6('0x1f')](handleError(_0x4c0acc,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index cea55a4..bd87123 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 _0x27b5=['bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x1101d2,_0x2447c5){var _0x413f14=function(_0x2f7145){while(--_0x2f7145){_0x1101d2['push'](_0x1101d2['shift']());}};_0x413f14(++_0x2447c5);}(_0x27b5,0xbb));var _0x527b=function(_0x4828b1,_0x5c8cf3){_0x4828b1=_0x4828b1-0x0;var _0x1fec1b=_0x27b5[_0x4828b1];return _0x1fec1b;};'use strict';var _=require(_0x527b('0x0'));var util=require(_0x527b('0x1'));var logger=require(_0x527b('0x2'))(_0x527b('0x3'));var moment=require(_0x527b('0x4'));var BPromise=require(_0x527b('0x5'));var rp=require(_0x527b('0x6'));var fs=require('fs');var path=require(_0x527b('0x7'));var rimraf=require(_0x527b('0x8'));var config=require(_0x527b('0x9'));var attributes=require(_0x527b('0xa'));module['exports']=function(_0x276f27,_0x509699){return _0x276f27[_0x527b('0xb')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c68=['../../config/logger','api','bluebird','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','lodash','util'];(function(_0x238323,_0x34df18){var _0x1575de=function(_0x1acff8){while(--_0x1acff8){_0x238323['push'](_0x238323['shift']());}};_0x1575de(++_0x34df18);}(_0x8c68,0x11e));var _0x88c6=function(_0x53867f,_0x528117){_0x53867f=_0x53867f-0x0;var _0x4bfe05=_0x8c68[_0x53867f];return _0x4bfe05;};'use strict';var _=require(_0x88c6('0x0'));var util=require(_0x88c6('0x1'));var logger=require(_0x88c6('0x2'))(_0x88c6('0x3'));var moment=require('moment');var BPromise=require(_0x88c6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x88c6('0x5'));var rimraf=require(_0x88c6('0x6'));var config=require(_0x88c6('0x7'));var attributes=require(_0x88c6('0x8'));module[_0x88c6('0x9')]=function(_0x2edc31,_0x2a4a2e){return _0x2edc31[_0x88c6('0xa')](_0x88c6('0xb'),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 bfa48dd..01d1f01 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 _0x8936=['client','request','then','info','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll','options','where','attributes','limit','include','map','model','raw','ShowTrunk','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8a533c,_0x58eb4b){var _0xbaadd9=function(_0x16ba4e){while(--_0x16ba4e){_0x8a533c['push'](_0x8a533c['shift']());}};_0xbaadd9(++_0x58eb4b);}(_0x8936,0x19b));var _0x6893=function(_0x529870,_0x975245){_0x529870=_0x529870-0x0;var _0x39435f=_0x8936[_0x529870];return _0x39435f;};'use strict';var _=require(_0x6893('0x0'));var util=require(_0x6893('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6893('0x2'));var fs=require('fs');var Redis=require(_0x6893('0x3'));var db=require(_0x6893('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6893('0x5'))(_0x6893('0x6'));var config=require(_0x6893('0x7'));var jayson=require(_0x6893('0x8'));var client=jayson[_0x6893('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6e1e95,_0x5dcc26,_0x35edea){return new BPromise(function(_0x20536d,_0x2dbddb){return client[_0x6893('0xa')](_0x6e1e95,_0x35edea)[_0x6893('0xb')](function(_0x48ed4c){logger[_0x6893('0xc')]('Trunk,\x20%s,\x20%s',_0x5dcc26,_0x6893('0xd'));logger['debug'](_0x6893('0xe'),_0x5dcc26,_0x6893('0xd'),JSON[_0x6893('0xf')](_0x48ed4c));if(_0x48ed4c[_0x6893('0x10')]){if(_0x48ed4c[_0x6893('0x10')][_0x6893('0x11')]===0x1f4){logger[_0x6893('0x10')](_0x6893('0x12'),_0x5dcc26,_0x48ed4c[_0x6893('0x10')][_0x6893('0x13')]);return _0x2dbddb(_0x48ed4c[_0x6893('0x10')][_0x6893('0x13')]);}logger[_0x6893('0x10')](_0x6893('0x12'),_0x5dcc26,_0x48ed4c[_0x6893('0x10')][_0x6893('0x13')]);return _0x20536d(_0x48ed4c['error']['message']);}else{logger[_0x6893('0xc')]('Trunk,\x20%s,\x20%s',_0x5dcc26,_0x6893('0xd'));_0x20536d(_0x48ed4c[_0x6893('0x14')][_0x6893('0x13')]);}})[_0x6893('0x15')](function(_0x3507f8){logger[_0x6893('0x10')](_0x6893('0x12'),_0x5dcc26,_0x3507f8);_0x2dbddb(_0x3507f8);});});}exports[_0x6893('0x16')]=function(_0x2a7c78){var _0x4938ac=this;return new Promise(function(_0x22f409,_0x7c211c){return db[_0x6893('0x17')][_0x6893('0x18')]({'raw':_0x2a7c78[_0x6893('0x19')]?_0x2a7c78[_0x6893('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2a7c78[_0x6893('0x19')]?_0x2a7c78['options'][_0x6893('0x1a')]||null:null,'attributes':_0x2a7c78[_0x6893('0x19')]?_0x2a7c78[_0x6893('0x19')][_0x6893('0x1b')]||null:null,'limit':_0x2a7c78[_0x6893('0x19')]?_0x2a7c78['options'][_0x6893('0x1c')]||null:null,'include':_0x2a7c78[_0x6893('0x19')]?_0x2a7c78[_0x6893('0x19')][_0x6893('0x1d')]?_[_0x6893('0x1e')](_0x2a7c78[_0x6893('0x19')][_0x6893('0x1d')],function(_0x9d458e){return{'model':db[_0x9d458e[_0x6893('0x1f')]],'as':_0x9d458e['as'],'attributes':_0x9d458e[_0x6893('0x1b')],'include':_0x9d458e['include']?_['map'](_0x9d458e[_0x6893('0x1d')],function(_0x44d4ed){return{'model':db[_0x44d4ed[_0x6893('0x1f')]],'as':_0x44d4ed['as'],'attributes':_0x44d4ed[_0x6893('0x1b')],'include':_0x44d4ed[_0x6893('0x1d')]?_['map'](_0x44d4ed[_0x6893('0x1d')],function(_0x13ea3e){return{'model':db[_0x13ea3e[_0x6893('0x1f')]],'as':_0x13ea3e['as'],'attributes':_0x13ea3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6893('0xb')](function(_0x1fb72d){logger['info'](_0x6893('0x16'),_0x2a7c78);logger['debug'](_0x6893('0x16'),_0x2a7c78,JSON['stringify'](_0x1fb72d));_0x22f409(_0x1fb72d);})[_0x6893('0x15')](function(_0x1afbde){logger[_0x6893('0x10')](_0x6893('0x16'),_0x1afbde[_0x6893('0x13')],_0x2a7c78);_0x7c211c(_0x4938ac[_0x6893('0x10')](0x1f4,_0x1afbde[_0x6893('0x13')]));});});};exports['ShowTrunk']=function(_0xd88cf1){var _0xeb7d44=this;return new Promise(function(_0x1ba2e3,_0x1c2f00){return db[_0x6893('0x17')]['find']({'raw':_0xd88cf1['options']?_0xd88cf1[_0x6893('0x19')][_0x6893('0x20')]===undefined?!![]:![]:!![],'where':_0xd88cf1[_0x6893('0x19')]?_0xd88cf1['options'][_0x6893('0x1a')]||null:null,'attributes':_0xd88cf1[_0x6893('0x19')]?_0xd88cf1['options'][_0x6893('0x1b')]||null:null,'include':_0xd88cf1[_0x6893('0x19')]?_0xd88cf1['options'][_0x6893('0x1d')]?_['map'](_0xd88cf1[_0x6893('0x19')][_0x6893('0x1d')],function(_0x4a8d60){return{'model':db[_0x4a8d60[_0x6893('0x1f')]],'as':_0x4a8d60['as'],'attributes':_0x4a8d60['attributes'],'include':_0x4a8d60[_0x6893('0x1d')]?_[_0x6893('0x1e')](_0x4a8d60['include'],function(_0x5e1232){return{'model':db[_0x5e1232[_0x6893('0x1f')]],'as':_0x5e1232['as'],'attributes':_0x5e1232[_0x6893('0x1b')],'include':_0x5e1232[_0x6893('0x1d')]?_['map'](_0x5e1232[_0x6893('0x1d')],function(_0x1e927a){return{'model':db[_0x1e927a[_0x6893('0x1f')]],'as':_0x1e927a['as'],'attributes':_0x1e927a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x185737){logger[_0x6893('0xc')](_0x6893('0x21'),_0xd88cf1);logger[_0x6893('0x22')]('ShowTrunk',_0xd88cf1,JSON[_0x6893('0xf')](_0x185737));_0x1ba2e3(_0x185737);})[_0x6893('0x15')](function(_0x18560c){logger[_0x6893('0x10')](_0x6893('0x21'),_0x18560c[_0x6893('0x13')],_0xd88cf1);_0x1c2f00(_0xeb7d44[_0x6893('0x10')](0x1f4,_0x18560c[_0x6893('0x13')]));});});}; \ No newline at end of file +var _0xf96e=['raw','where','limit','include','model','attributes','map','then','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk','findAll','options'];(function(_0x56fb33,_0x37be08){var _0x435ee4=function(_0xa80804){while(--_0xa80804){_0x56fb33['push'](_0x56fb33['shift']());}};_0x435ee4(++_0x37be08);}(_0xf96e,0x196));var _0xef96=function(_0x373a38,_0x487022){_0x373a38=_0x373a38-0x0;var _0x261328=_0xf96e[_0x373a38];return _0x261328;};'use strict';var _=require(_0xef96('0x0'));var util=require(_0xef96('0x1'));var moment=require(_0xef96('0x2'));var BPromise=require(_0xef96('0x3'));var rs=require(_0xef96('0x4'));var fs=require('fs');var Redis=require(_0xef96('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xef96('0x6'));var logger=require('../../config/logger')(_0xef96('0x7'));var config=require(_0xef96('0x8'));var jayson=require(_0xef96('0x9'));var client=jayson['client'][_0xef96('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4550f0,_0x56959c,_0x284ba5){return new BPromise(function(_0x354299,_0x4756d3){return client['request'](_0x4550f0,_0x284ba5)['then'](function(_0x24b246){logger[_0xef96('0xb')](_0xef96('0xc'),_0x56959c,_0xef96('0xd'));logger[_0xef96('0xe')](_0xef96('0xf'),_0x56959c,_0xef96('0xd'),JSON[_0xef96('0x10')](_0x24b246));if(_0x24b246['error']){if(_0x24b246[_0xef96('0x11')][_0xef96('0x12')]===0x1f4){logger[_0xef96('0x11')](_0xef96('0xc'),_0x56959c,_0x24b246[_0xef96('0x11')]['message']);return _0x4756d3(_0x24b246[_0xef96('0x11')][_0xef96('0x13')]);}logger['error'](_0xef96('0xc'),_0x56959c,_0x24b246[_0xef96('0x11')][_0xef96('0x13')]);return _0x354299(_0x24b246[_0xef96('0x11')]['message']);}else{logger[_0xef96('0xb')](_0xef96('0xc'),_0x56959c,'request\x20sent');_0x354299(_0x24b246[_0xef96('0x14')][_0xef96('0x13')]);}})[_0xef96('0x15')](function(_0x4560e0){logger[_0xef96('0x11')](_0xef96('0xc'),_0x56959c,_0x4560e0);_0x4756d3(_0x4560e0);});});}exports[_0xef96('0x16')]=function(_0x161f7f){var _0x5d81a8=this;return new Promise(function(_0x12b222,_0x27d67a){return db[_0xef96('0x17')][_0xef96('0x18')]({'raw':_0x161f7f['options']?_0x161f7f[_0xef96('0x19')][_0xef96('0x1a')]===undefined?!![]:![]:!![],'where':_0x161f7f[_0xef96('0x19')]?_0x161f7f['options'][_0xef96('0x1b')]||null:null,'attributes':_0x161f7f[_0xef96('0x19')]?_0x161f7f[_0xef96('0x19')]['attributes']||null:null,'limit':_0x161f7f['options']?_0x161f7f[_0xef96('0x19')][_0xef96('0x1c')]||null:null,'include':_0x161f7f[_0xef96('0x19')]?_0x161f7f['options'][_0xef96('0x1d')]?_['map'](_0x161f7f[_0xef96('0x19')][_0xef96('0x1d')],function(_0x432a6f){return{'model':db[_0x432a6f[_0xef96('0x1e')]],'as':_0x432a6f['as'],'attributes':_0x432a6f[_0xef96('0x1f')],'include':_0x432a6f[_0xef96('0x1d')]?_[_0xef96('0x20')](_0x432a6f['include'],function(_0x1fda2d){return{'model':db[_0x1fda2d[_0xef96('0x1e')]],'as':_0x1fda2d['as'],'attributes':_0x1fda2d['attributes'],'include':_0x1fda2d[_0xef96('0x1d')]?_['map'](_0x1fda2d['include'],function(_0x4fe30c){return{'model':db[_0x4fe30c[_0xef96('0x1e')]],'as':_0x4fe30c['as'],'attributes':_0x4fe30c[_0xef96('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xef96('0x21')](function(_0x41671e){logger[_0xef96('0xb')](_0xef96('0x16'),_0x161f7f);logger['debug'](_0xef96('0x16'),_0x161f7f,JSON[_0xef96('0x10')](_0x41671e));_0x12b222(_0x41671e);})['catch'](function(_0x4e884b){logger[_0xef96('0x11')](_0xef96('0x16'),_0x4e884b[_0xef96('0x13')],_0x161f7f);_0x27d67a(_0x5d81a8['error'](0x1f4,_0x4e884b[_0xef96('0x13')]));});});};exports[_0xef96('0x22')]=function(_0x5a9111){var _0x3f5e6c=this;return new Promise(function(_0x7950f8,_0xc8de60){return db['Trunk'][_0xef96('0x23')]({'raw':_0x5a9111[_0xef96('0x19')]?_0x5a9111[_0xef96('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x5a9111[_0xef96('0x19')]?_0x5a9111[_0xef96('0x19')]['where']||null:null,'attributes':_0x5a9111[_0xef96('0x19')]?_0x5a9111['options']['attributes']||null:null,'include':_0x5a9111[_0xef96('0x19')]?_0x5a9111[_0xef96('0x19')][_0xef96('0x1d')]?_[_0xef96('0x20')](_0x5a9111[_0xef96('0x19')][_0xef96('0x1d')],function(_0x16160b){return{'model':db[_0x16160b['model']],'as':_0x16160b['as'],'attributes':_0x16160b[_0xef96('0x1f')],'include':_0x16160b['include']?_['map'](_0x16160b[_0xef96('0x1d')],function(_0x232f89){return{'model':db[_0x232f89[_0xef96('0x1e')]],'as':_0x232f89['as'],'attributes':_0x232f89[_0xef96('0x1f')],'include':_0x232f89[_0xef96('0x1d')]?_['map'](_0x232f89['include'],function(_0x484b70){return{'model':db[_0x484b70[_0xef96('0x1e')]],'as':_0x484b70['as'],'attributes':_0x484b70['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x47d3e5){logger[_0xef96('0xb')](_0xef96('0x22'),_0x5a9111);logger['debug'](_0xef96('0x22'),_0x5a9111,JSON[_0xef96('0x10')](_0x47d3e5));_0x7950f8(_0x47d3e5);})[_0xef96('0x15')](function(_0x409b7c){logger['error'](_0xef96('0x22'),_0x409b7c[_0xef96('0x13')],_0x5a9111);_0xc8de60(_0x3f5e6c[_0xef96('0x11')](0x1f4,_0x409b7c[_0xef96('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index ca80628..95f0f89 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 _0x3998=['isAuthenticated','update','exports','express','Router','put'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x3998,0x1bf));var _0x8399=function(_0x34cb6a,_0x4956d0){_0x34cb6a=_0x34cb6a-0x0;var _0x16cabb=_0x3998[_0x34cb6a];return _0x16cabb;};'use strict';var express=require(_0x8399('0x0'));var router=express[_0x8399('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x8399('0x2')]('/:id',auth[_0x8399('0x3')](),controller[_0x8399('0x4')]);module[_0x8399('0x5')]=router; \ No newline at end of file +var _0x74ec=['../../components/auth/service','put','isAuthenticated','update','express'];(function(_0x2c3b20,_0x23bada){var _0x26f206=function(_0x44369a){while(--_0x44369a){_0x2c3b20['push'](_0x2c3b20['shift']());}};_0x26f206(++_0x23bada);}(_0x74ec,0xc2));var _0xc74e=function(_0x4c463f,_0x33dc34){_0x4c463f=_0x4c463f-0x0;var _0x5252bc=_0x74ec[_0x4c463f];return _0x5252bc;};'use strict';var express=require(_0xc74e('0x0'));var router=express['Router']();var auth=require(_0xc74e('0x1'));var controller=require('./user-setting.controller');router[_0xc74e('0x2')]('/:id',auth[_0xc74e('0x3')](),controller[_0xc74e('0x4')]);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 d3bea56..3b22893 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 _0x2563=['UserId','sequelize','warning','info','debug','exports','ENUM','TEXT','DATE'];(function(_0xfa8a0,_0x3385b6){var _0x1b070b=function(_0x3671e2){while(--_0x3671e2){_0xfa8a0['push'](_0xfa8a0['shift']());}};_0x1b070b(++_0x3385b6);}(_0x2563,0x172));var _0x3256=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2563[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3256('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x3256('0x1'),_0x3256('0x2'),_0x3256('0x3')];module[_0x3256('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3256('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':'error','validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3256('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3256('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0x3256('0x8')}}; \ No newline at end of file +var _0xca7a=['exports','error','BOOLEAN','TEXT','INTEGER','sequelize'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0xca7a,0xdd));var _0xaca7=function(_0x4cf0b7,_0x560029){_0x4cf0b7=_0x4cf0b7-0x0;var _0x545f10=_0xca7a[_0x4cf0b7];return _0x545f10;};'use strict';var Sequelize=require(_0xaca7('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning','info','debug'];module[_0xaca7('0x1')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xaca7('0x2'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xaca7('0x3')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xaca7('0x4')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xaca7('0x5')],'unique':'UserId'}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 98918a8..691cc1a 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 _0x5ff3=['Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','ioredis','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','json','then','name','status','send','user','admin'];(function(_0x147daa,_0x567d78){var _0x5d1832=function(_0x564f30){while(--_0x564f30){_0x147daa['push'](_0x147daa['shift']());}};_0x5d1832(++_0x567d78);}(_0x5ff3,0x17d));var _0x35ff=function(_0x46f176,_0x1feba9){_0x46f176=_0x46f176-0x0;var _0x4bd660=_0x5ff3[_0x46f176];return _0x4bd660;};'use strict';var _=require('lodash');var Redis=require(_0x35ff('0x0'));var logger=require('../../config/logger')(_0x35ff('0x1'));var config=require('../../config/environment');var db=require(_0x35ff('0x2'))['db'];var socket=require(_0x35ff('0x3'))(new Redis(config[_0x35ff('0x4')]));require(_0x35ff('0x5'))['register'](socket);config[_0x35ff('0x4')]=_[_0x35ff('0x6')](config[_0x35ff('0x4')],{'host':_0x35ff('0x7'),'port':0x18eb});function respondWithResult(_0x30c3ff,_0x495c31){_0x495c31=_0x495c31||0xc8;return function(_0x92b403){if(_0x92b403){return _0x30c3ff['status'](_0x495c31)[_0x35ff('0x8')](_0x92b403);}};}function saveUpdates(_0xfcec34){return function(_0x224ce5){if(_0x224ce5){return _0x224ce5['update'](_0xfcec34)[_0x35ff('0x9')](function(_0x59ec4f){return _0x59ec4f;});}return null;};}function handleEntityNotFound(_0x1cd2c6){return function(_0x228fea){if(!_0x228fea){_0x1cd2c6['sendStatus'](0x194);}return _0x228fea;};}function handleError(_0x5c3131,_0x3aba51){_0x3aba51=_0x3aba51||0x1f4;return function(_0x574c81){logger['error'](_0x574c81['stack']);if(_0x574c81[_0x35ff('0xa')]){delete _0x574c81[_0x35ff('0xa')];}_0x5c3131[_0x35ff('0xb')](_0x3aba51)[_0x35ff('0xc')](_0x574c81);};}exports['update']=function(_0x33154f,_0xab42e6){if(_0x33154f[_0x35ff('0xd')]['role']!==_0x35ff('0xe'))throw new Error(_0x35ff('0xf'));if(isNaN(Number(_0x33154f[_0x35ff('0x10')]['id'])))throw new Error(_0x35ff('0x11'));return db[_0x35ff('0x12')][_0x35ff('0x13')]({'where':{'id':_0x33154f[_0x35ff('0x10')]['id']}})[_0x35ff('0x9')](handleEntityNotFound(_0xab42e6,null))[_0x35ff('0x9')](saveUpdates(_0x33154f[_0x35ff('0x14')],null))[_0x35ff('0x9')](respondWithResult(_0xab42e6,null))[_0x35ff('0x15')](handleError(_0xab42e6,null));}; \ No newline at end of file +var _0xcb81=['sendStatus','error','name','send','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch','lodash','ioredis','api','redis','./user-setting.socket','register','defaults','localhost','status','json'];(function(_0xab3a88,_0x4c30a3){var _0x43cc25=function(_0x48ca9e){while(--_0x48ca9e){_0xab3a88['push'](_0xab3a88['shift']());}};_0x43cc25(++_0x4c30a3);}(_0xcb81,0x154));var _0x1cb8=function(_0x4914ad,_0x551a18){_0x4914ad=_0x4914ad-0x0;var _0x3cd61f=_0xcb81[_0x4914ad];return _0x3cd61f;};'use strict';var _=require(_0x1cb8('0x0'));var Redis=require(_0x1cb8('0x1'));var logger=require('../../config/logger')(_0x1cb8('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1cb8('0x3')]));require(_0x1cb8('0x4'))[_0x1cb8('0x5')](socket);config[_0x1cb8('0x3')]=_[_0x1cb8('0x6')](config['redis'],{'host':_0x1cb8('0x7'),'port':0x18eb});function respondWithResult(_0x2ac2d6,_0x584b16){_0x584b16=_0x584b16||0xc8;return function(_0x2408c2){if(_0x2408c2){return _0x2ac2d6[_0x1cb8('0x8')](_0x584b16)[_0x1cb8('0x9')](_0x2408c2);}};}function saveUpdates(_0x503efb){return function(_0x1ff267){if(_0x1ff267){return _0x1ff267['update'](_0x503efb)['then'](function(_0x29e901){return _0x29e901;});}return null;};}function handleEntityNotFound(_0x2158a9){return function(_0x16600b){if(!_0x16600b){_0x2158a9[_0x1cb8('0xa')](0x194);}return _0x16600b;};}function handleError(_0x267dde,_0x32715a){_0x32715a=_0x32715a||0x1f4;return function(_0xb8048c){logger[_0x1cb8('0xb')](_0xb8048c['stack']);if(_0xb8048c[_0x1cb8('0xc')]){delete _0xb8048c[_0x1cb8('0xc')];}_0x267dde[_0x1cb8('0x8')](_0x32715a)[_0x1cb8('0xd')](_0xb8048c);};}exports[_0x1cb8('0xe')]=function(_0x5dfde1,_0x389c12){if(_0x5dfde1[_0x1cb8('0xf')][_0x1cb8('0x10')]!==_0x1cb8('0x11'))throw new Error(_0x1cb8('0x12'));if(isNaN(Number(_0x5dfde1[_0x1cb8('0x13')]['id'])))throw new Error(_0x1cb8('0x14'));return db[_0x1cb8('0x15')]['find']({'where':{'id':_0x5dfde1[_0x1cb8('0x13')]['id']}})['then'](handleEntityNotFound(_0x389c12,null))[_0x1cb8('0x16')](saveUpdates(_0x5dfde1[_0x1cb8('0x17')],null))[_0x1cb8('0x16')](respondWithResult(_0x389c12,null))[_0x1cb8('0x18')](handleError(_0x389c12,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 e981c4a..03075ca 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 _0x8b29=['setMaxListeners','remove','hasOwnProperty','hook','../../mysqldb'];(function(_0x17823f,_0xffd807){var _0x51fc21=function(_0x5e4921){while(--_0x5e4921){_0x17823f['push'](_0x17823f['shift']());}};_0x51fc21(++_0xffd807);}(_0x8b29,0x135));var _0x98b2=function(_0x3d0984,_0x1ba1e4){_0x3d0984=_0x3d0984-0x0;var _0x206dba=_0x8b29[_0x3d0984];return _0x206dba;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x98b2('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x98b2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x98b2('0x2')};function emitEvent(_0x34258a){return function(_0x10a936,_0x24f5ea,_0x151f1f){UserSettingEvents['emit'](_0x34258a+':'+_0x10a936['id'],_0x10a936);UserSettingEvents['emit'](_0x34258a,_0x10a936);_0x151f1f(null);};}for(var e in events){if(events[_0x98b2('0x3')](e)){var event=events[e];UserSetting[_0x98b2('0x4')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x44ab=['emit','hook','exports','events','../../mysqldb','UserSetting','save','remove'];(function(_0x308de4,_0x55b6e2){var _0x5e569f=function(_0x4eb8c1){while(--_0x4eb8c1){_0x308de4['push'](_0x308de4['shift']());}};_0x5e569f(++_0x55b6e2);}(_0x44ab,0x6b));var _0xb44a=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x44ab[_0xf48cce];return _0x2a5c38;};'use strict';var EventEmitter=require(_0xb44a('0x0'));var UserSetting=require(_0xb44a('0x1'))['db'][_0xb44a('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb44a('0x3'),'afterUpdate':'update','afterDestroy':_0xb44a('0x4')};function emitEvent(_0x6b8334){return function(_0x4f771a,_0x5b7564,_0xfdb73d){UserSettingEvents['emit'](_0x6b8334+':'+_0x4f771a['id'],_0x4f771a);UserSettingEvents[_0xb44a('0x5')](_0x6b8334,_0x4f771a);_0xfdb73d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xb44a('0x6')](e,emitEvent(event));}}module[_0xb44a('0x7')]=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 28d9d9c..96cb133 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 _0x8868=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x3fbed6,_0x3f5767){var _0x15da9b=function(_0x24f428){while(--_0x24f428){_0x3fbed6['push'](_0x3fbed6['shift']());}};_0x15da9b(++_0x3f5767);}(_0x8868,0x1ca));var _0x8886=function(_0x7c3f6c,_0x1965e1){_0x7c3f6c=_0x7c3f6c-0x0;var _0x14d4bc=_0x8868[_0x7c3f6c];return _0x14d4bc;};'use strict';var attributes=require(_0x8886('0x0'));module[_0x8886('0x1')]=function(_0xb1c240){return _0xb1c240[_0x8886('0x2')](_0x8886('0x3'),attributes,{'tableName':_0x8886('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34cd50){if(!_0x34cd50[_0x8886('0x5')])_0x34cd50[_0x8886('0x6')]=null;else if(_0x34cd50[_0x8886('0x6')]===null)_0x34cd50[_0x8886('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x16d2=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x1b62b8,_0x3e78d9){var _0x47a5a0=function(_0x479a5b){while(--_0x479a5b){_0x1b62b8['push'](_0x1b62b8['shift']());}};_0x47a5a0(++_0x3e78d9);}(_0x16d2,0x123));var _0x216d=function(_0x47b5e0,_0x273723){_0x47b5e0=_0x47b5e0-0x0;var _0x128d60=_0x16d2[_0x47b5e0];return _0x128d60;};'use strict';var attributes=require(_0x216d('0x0'));module[_0x216d('0x1')]=function(_0x398c34){return _0x398c34[_0x216d('0x2')](_0x216d('0x3'),attributes,{'tableName':_0x216d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x34cf5b){if(!_0x34cf5b[_0x216d('0x5')])_0x34cf5b[_0x216d('0x6')]=null;else if(_0x34cf5b['clientSideLoggingEnabledSince']===null)_0x34cf5b[_0x216d('0x6')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 73dafed..048c3f5 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 _0x693a=['UserId','register','length','remove','update','emit','user-setting:update'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x693a,0x10d));var _0xa693=function(_0x46a671,_0x758e9a){_0x46a671=_0x46a671-0x0;var _0x526d75=_0x693a[_0x46a671];return _0x526d75;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save',_0xa693('0x0'),_0xa693('0x1')];function createListener(_0x440a06,_0xc9b180){return function(_0x2e5bf0){_0xc9b180[_0xa693('0x2')](_0x440a06,_0x2e5bf0);if(_0x440a06===_0xa693('0x3')){_0xc9b180[_0xa693('0x2')]('user-setting:update:user-'+_0x2e5bf0[_0xa693('0x4')],_0x2e5bf0);}};}exports[_0xa693('0x5')]=function(_0x4a3c48){for(var _0x2b78c0=0x0,_0x2cc159=events[_0xa693('0x6')];_0x2b78c0<_0x2cc159;_0x2b78c0++){var _0x30ef83=events[_0x2b78c0];var _0x5f5bd7=createListener('user-setting:'+_0x30ef83,_0x4a3c48);UserSettingEvents['on'](_0x30ef83,_0x5f5bd7);}}; \ No newline at end of file +var _0xe11d=['length','user-setting:','save','emit','user-setting:update','user-setting:update:user-','register'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xe11d,0x175));var _0xde11=function(_0x2018c3,_0x34b67d){_0x2018c3=_0x2018c3-0x0;var _0x3f36ec=_0xe11d[_0x2018c3];return _0x3f36ec;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0xde11('0x0'),'remove','update'];function createListener(_0x36df50,_0x422238){return function(_0x4330dd){_0x422238[_0xde11('0x1')](_0x36df50,_0x4330dd);if(_0x36df50===_0xde11('0x2')){_0x422238[_0xde11('0x1')](_0xde11('0x3')+_0x4330dd['UserId'],_0x4330dd);}};}exports[_0xde11('0x4')]=function(_0xe29445){for(var _0x79e6d2=0x0,_0x1f219d=events[_0xde11('0x5')];_0x79e6d2<_0x1f219d;_0x79e6d2++){var _0x4d8921=events[_0x79e6d2];var _0x1a2306=createListener(_0xde11('0x6')+_0x4d8921,_0xe29445);UserSettingEvents['on'](_0x4d8921,_0x1a2306);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 424bddd..dd64b10 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 _0xe939=['../../config/environment','./user.controller','get','isAuthenticated','index','/describe','whoami','/presence','getPresence','/:id','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','post','create','/create_many','bulkCreate','addQueues','diskStorage','join','root','format','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','/:id/mail_accounts','addMailAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','createApiKey','put','/:id/password','removeQueues','removeTeams','delete','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x21e5a8,_0x4decc1){var _0xac0343=function(_0x3b2383){while(--_0x3b2383){_0x21e5a8['push'](_0x21e5a8['shift']());}};_0xac0343(++_0x4decc1);}(_0xe939,0xda));var _0x9e93=function(_0x384053,_0x45027b){_0x384053=_0x384053-0x0;var _0x148f8c=_0xe939[_0x384053];return _0x148f8c;};'use strict';var multer=require(_0x9e93('0x0'));var util=require(_0x9e93('0x1'));var path=require(_0x9e93('0x2'));var timeout=require(_0x9e93('0x3'));var express=require(_0x9e93('0x4'));var router=express[_0x9e93('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9e93('0x6'));var interaction=require(_0x9e93('0x7'));var config=require(_0x9e93('0x8'));var controller=require(_0x9e93('0x9'));router[_0x9e93('0xa')]('/',auth[_0x9e93('0xb')](),controller[_0x9e93('0xc')]);router[_0x9e93('0xa')](_0x9e93('0xd'),auth[_0x9e93('0xb')](),controller['describe']);router[_0x9e93('0xa')]('/whoami',auth[_0x9e93('0xb')](),controller[_0x9e93('0xe')]);router['get'](_0x9e93('0xf'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x10')]);router[_0x9e93('0xa')](_0x9e93('0x11'),auth[_0x9e93('0xb')](),controller['show']);router[_0x9e93('0xa')](_0x9e93('0x12'),controller['getAvatar']);router[_0x9e93('0xa')](_0x9e93('0x13'),auth[_0x9e93('0xb')](),controller['getOpenTabs']);router[_0x9e93('0xa')](_0x9e93('0x14'),auth['isAuthenticated'](),controller[_0x9e93('0x15')]);router[_0x9e93('0xa')](_0x9e93('0x16'),auth[_0x9e93('0xb')](),controller['getQueues']);router[_0x9e93('0xa')]('/:id/queues_rt',auth[_0x9e93('0xb')](),controller[_0x9e93('0x17')]);router[_0x9e93('0xa')](_0x9e93('0x18'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x19')]);router[_0x9e93('0xa')]('/:id/recordings',auth[_0x9e93('0xb')](),controller[_0x9e93('0x1a')]);router['get']('/:id/screen_recordings',auth[_0x9e93('0xb')](),controller[_0x9e93('0x1b')]);router[_0x9e93('0xa')]('/:id/chat/interactions',auth[_0x9e93('0xb')](),controller[_0x9e93('0x1c')]);router[_0x9e93('0xa')](_0x9e93('0x1d'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x1e')]);router['get'](_0x9e93('0x1f'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x20')]);router[_0x9e93('0xa')]('/:id/sms/interactions',auth[_0x9e93('0xb')](),controller['getSmsInteractions']);router[_0x9e93('0xa')]('/:id/fax/interactions',auth['isAuthenticated'](),controller[_0x9e93('0x21')]);router[_0x9e93('0xa')](_0x9e93('0x22'),auth[_0x9e93('0xb')](),controller['getWhatsappInteractions']);router[_0x9e93('0xa')](_0x9e93('0x23'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x24')]);router['get'](_0x9e93('0x25'),auth[_0x9e93('0xb')](),controller['getLists']);router['get'](_0x9e93('0x26'),auth[_0x9e93('0xb')](),controller['getAgents']);router[_0x9e93('0xa')](_0x9e93('0x27'),auth['isAuthenticated'](),controller[_0x9e93('0x28')]);router[_0x9e93('0xa')](_0x9e93('0x29'),auth['isAuthenticated'](),controller[_0x9e93('0x2a')]);router['get']('/:id/mail_accounts',auth[_0x9e93('0xb')](),controller[_0x9e93('0x2b')]);router[_0x9e93('0xa')](_0x9e93('0x2c'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x2d')]);router[_0x9e93('0xa')](_0x9e93('0x2e'),auth['isAuthenticated'](),controller[_0x9e93('0x2f')]);router['get'](_0x9e93('0x30'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x31')]);router[_0x9e93('0xa')]('/:id/whatsapp_accounts',auth[_0x9e93('0xb')](),controller['getWhatsappAccounts']);router['get'](_0x9e93('0x32'),auth['isAuthenticated'](),controller[_0x9e93('0x33')]);router[_0x9e93('0xa')](_0x9e93('0x34'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x35')]);router['post'](_0x9e93('0x14'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x36')]);router[_0x9e93('0x37')]('/',auth[_0x9e93('0xb')](),controller[_0x9e93('0x38')]);router[_0x9e93('0x37')](_0x9e93('0x39'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x3a')]);router['post'](_0x9e93('0x16'),auth['isAuthenticated'](),controller[_0x9e93('0x3b')]);var upload=multer({'storage':multer[_0x9e93('0x3c')]({'destination':function(_0x3cab27,_0x21e54b,_0x42fc9e){_0x42fc9e(null,path[_0x9e93('0x3d')](config[_0x9e93('0x3e')],'server/files/images/'));},'filename':function(_0x545002,_0x10fbbe,_0x15758f){_0x15758f(null,util[_0x9e93('0x3f')](_0x9e93('0x40'),Date[_0x9e93('0x41')](),_0x10fbbe[_0x9e93('0x42')]));}})});router[_0x9e93('0x37')](_0x9e93('0x12'),upload[_0x9e93('0x43')](_0x9e93('0x44')),controller[_0x9e93('0x45')]);router[_0x9e93('0x37')](_0x9e93('0x46'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x47')]);router[_0x9e93('0x37')](_0x9e93('0x48'),auth['isAuthenticated'](),controller[_0x9e93('0x49')]);router['post'](_0x9e93('0x4a'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x4b')]);router[_0x9e93('0x37')](_0x9e93('0x4c'),auth['isAuthenticated'](),controller[_0x9e93('0x4d')]);router[_0x9e93('0x37')](_0x9e93('0x23'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x4e')]);router[_0x9e93('0x37')](_0x9e93('0x4f'),auth[_0x9e93('0xb')](),controller['addChatInteractions']);router[_0x9e93('0x37')](_0x9e93('0x50'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x51')]);router[_0x9e93('0x37')](_0x9e93('0x52'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x53')]);router[_0x9e93('0x37')](_0x9e93('0x54'),auth['isAuthenticated'](),controller[_0x9e93('0x55')]);router[_0x9e93('0x37')]('/:id/openchannel_interactions',auth[_0x9e93('0xb')](),controller[_0x9e93('0x56')]);router[_0x9e93('0x37')](_0x9e93('0x57'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x58')]);router[_0x9e93('0x37')](_0x9e93('0x29'),auth[_0x9e93('0xb')](),controller['addFaxAccounts']);router[_0x9e93('0x37')](_0x9e93('0x59'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x5a')]);router[_0x9e93('0x37')](_0x9e93('0x2c'),auth[_0x9e93('0xb')](),controller['addOpenchannelAccounts']);router[_0x9e93('0x37')]('/:id/sms_accounts',auth[_0x9e93('0xb')](),controller['addSmsAccounts']);router[_0x9e93('0x37')](_0x9e93('0x30'),auth[_0x9e93('0xb')](),controller['addChatWebsites']);router[_0x9e93('0x37')](_0x9e93('0x5b'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x5c')]);router[_0x9e93('0x37')]('/:id/api_key',auth[_0x9e93('0xb')](),controller[_0x9e93('0x5d')]);router['put'](_0x9e93('0x11'),auth[_0x9e93('0xb')](),controller['update']);router[_0x9e93('0x5e')](_0x9e93('0x5f'),auth[_0x9e93('0xb')](),controller['changePassword']);router['delete'](_0x9e93('0x16'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x60')]);router['delete'](_0x9e93('0x23'),auth['isAuthenticated'](),controller[_0x9e93('0x61')]);router[_0x9e93('0x62')](_0x9e93('0x11'),auth['isAuthenticated'](),controller['destroy']);router[_0x9e93('0x62')](_0x9e93('0x4f'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x63')]);router[_0x9e93('0x62')](_0x9e93('0x50'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x64')]);router[_0x9e93('0x62')](_0x9e93('0x52'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x65')]);router['delete'](_0x9e93('0x54'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x66')]);router[_0x9e93('0x62')](_0x9e93('0x67'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x68')]);router[_0x9e93('0x62')]('/:id/whatsapp_interactions',auth[_0x9e93('0xb')](),controller[_0x9e93('0x69')]);router[_0x9e93('0x62')](_0x9e93('0x29'),auth['isAuthenticated'](),controller[_0x9e93('0x6a')]);router[_0x9e93('0x62')]('/:id/mail_accounts',auth[_0x9e93('0xb')](),controller['removeMailAccounts']);router['delete'](_0x9e93('0x2c'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x6b')]);router[_0x9e93('0x62')](_0x9e93('0x2e'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x6c')]);router[_0x9e93('0x62')](_0x9e93('0x30'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x6d')]);router['delete'](_0x9e93('0x5b'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x6e')]);router[_0x9e93('0x62')](_0x9e93('0x34'),auth[_0x9e93('0xb')](),controller[_0x9e93('0x6f')]);router[_0x9e93('0x37')]('/:id/messengerSoundNotification',auth[_0x9e93('0xb')](),controller[_0x9e93('0x70')]);module['exports']=router; \ No newline at end of file +var _0x547e=['/:id/pause','pause','/:id/unpause','unpause','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','update','/:id/password','delete','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeWhatsappInteractions','removeFaxAccounts','/:id/mail_accounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','/:id/contacts','create','bulkCreate','addQueues','join','root','server/files/images/','format','now','originalname','/:id/avatar','file','addAvatar','login','/:id/logout','logout'];(function(_0xd4b7e3,_0x36c198){var _0x14e1c2=function(_0x2bcc4b){while(--_0x2bcc4b){_0xd4b7e3['push'](_0xd4b7e3['shift']());}};_0x14e1c2(++_0x36c198);}(_0x547e,0xfd));var _0xe547=function(_0x387f77,_0x496272){_0x387f77=_0x387f77-0x0;var _0xc20b0b=_0x547e[_0x387f77];return _0xc20b0b;};'use strict';var multer=require(_0xe547('0x0'));var util=require('util');var path=require(_0xe547('0x1'));var timeout=require(_0xe547('0x2'));var express=require('express');var router=express[_0xe547('0x3')]();var fs_extra=require(_0xe547('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe547('0x5'));var config=require(_0xe547('0x6'));var controller=require('./user.controller');router[_0xe547('0x7')]('/',auth['isAuthenticated'](),controller[_0xe547('0x8')]);router[_0xe547('0x7')]('/describe',auth[_0xe547('0x9')](),controller[_0xe547('0xa')]);router[_0xe547('0x7')](_0xe547('0xb'),auth[_0xe547('0x9')](),controller[_0xe547('0xc')]);router[_0xe547('0x7')](_0xe547('0xd'),auth[_0xe547('0x9')](),controller[_0xe547('0xe')]);router[_0xe547('0x7')](_0xe547('0xf'),auth['isAuthenticated'](),controller[_0xe547('0x10')]);router[_0xe547('0x7')]('/:id/avatar',controller[_0xe547('0x11')]);router[_0xe547('0x7')]('/:id/open_tabs',auth['isAuthenticated'](),controller[_0xe547('0x12')]);router['get']('/:id/contacts',auth[_0xe547('0x9')](),controller[_0xe547('0x13')]);router[_0xe547('0x7')](_0xe547('0x14'),auth['isAuthenticated'](),controller[_0xe547('0x15')]);router['get'](_0xe547('0x16'),auth['isAuthenticated'](),controller[_0xe547('0x17')]);router[_0xe547('0x7')](_0xe547('0x18'),auth[_0xe547('0x9')](),controller[_0xe547('0x19')]);router[_0xe547('0x7')](_0xe547('0x1a'),auth['isAuthenticated'](),controller[_0xe547('0x1b')]);router[_0xe547('0x7')](_0xe547('0x1c'),auth[_0xe547('0x9')](),controller[_0xe547('0x1d')]);router[_0xe547('0x7')](_0xe547('0x1e'),auth['isAuthenticated'](),controller['getChatInteractions']);router[_0xe547('0x7')]('/:id/openchannel/interactions',auth[_0xe547('0x9')](),controller['getOpenchannelInteractions']);router[_0xe547('0x7')]('/:id/mail/interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x1f')]);router['get']('/:id/sms/interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x20')]);router['get'](_0xe547('0x21'),auth[_0xe547('0x9')](),controller[_0xe547('0x22')]);router[_0xe547('0x7')]('/:id/whatsapp/interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x23')]);router[_0xe547('0x7')](_0xe547('0x24'),auth[_0xe547('0x9')](),controller[_0xe547('0x25')]);router[_0xe547('0x7')](_0xe547('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0xe547('0x7')](_0xe547('0x27'),auth[_0xe547('0x9')](),controller[_0xe547('0x28')]);router['get']('/:id/prefixes',auth[_0xe547('0x9')](),controller[_0xe547('0x29')]);router[_0xe547('0x7')](_0xe547('0x2a'),auth[_0xe547('0x9')](),controller[_0xe547('0x2b')]);router['get']('/:id/mail_accounts',auth[_0xe547('0x9')](),controller[_0xe547('0x2c')]);router['get'](_0xe547('0x2d'),auth[_0xe547('0x9')](),controller[_0xe547('0x2e')]);router['get'](_0xe547('0x2f'),auth['isAuthenticated'](),controller[_0xe547('0x30')]);router[_0xe547('0x7')](_0xe547('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router[_0xe547('0x7')](_0xe547('0x32'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xe547('0x7')](_0xe547('0x33'),auth[_0xe547('0x9')](),controller[_0xe547('0x34')]);router[_0xe547('0x7')](_0xe547('0x35'),auth[_0xe547('0x9')](),controller['getApiKey']);router[_0xe547('0x36')](_0xe547('0x37'),auth[_0xe547('0x9')](),controller['addContacts']);router[_0xe547('0x36')]('/',auth['isAuthenticated'](),controller[_0xe547('0x38')]);router[_0xe547('0x36')]('/create_many',auth[_0xe547('0x9')](),controller[_0xe547('0x39')]);router[_0xe547('0x36')]('/:id/queues',auth[_0xe547('0x9')](),controller[_0xe547('0x3a')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1bfbab,_0x1396ca,_0x2d9e47){_0x2d9e47(null,path[_0xe547('0x3b')](config[_0xe547('0x3c')],_0xe547('0x3d')));},'filename':function(_0x557932,_0x5e57ac,_0x37d66b){_0x37d66b(null,util[_0xe547('0x3e')]('%s-%s',Date[_0xe547('0x3f')](),_0x5e57ac[_0xe547('0x40')]));}})});router[_0xe547('0x36')](_0xe547('0x41'),upload['single'](_0xe547('0x42')),controller[_0xe547('0x43')]);router[_0xe547('0x36')]('/:id/login',auth[_0xe547('0x9')](),controller[_0xe547('0x44')]);router[_0xe547('0x36')](_0xe547('0x45'),auth['isAuthenticated'](),controller[_0xe547('0x46')]);router[_0xe547('0x36')](_0xe547('0x47'),auth[_0xe547('0x9')](),controller[_0xe547('0x48')]);router[_0xe547('0x36')](_0xe547('0x49'),auth[_0xe547('0x9')](),controller[_0xe547('0x4a')]);router['post'](_0xe547('0x24'),auth['isAuthenticated'](),controller['addTeams']);router[_0xe547('0x36')](_0xe547('0x4b'),auth[_0xe547('0x9')](),controller['addChatInteractions']);router[_0xe547('0x36')](_0xe547('0x4c'),auth[_0xe547('0x9')](),controller[_0xe547('0x4d')]);router['post']('/:id/fax_interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x4e')]);router['post']('/:id/sms_interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x4f')]);router[_0xe547('0x36')](_0xe547('0x50'),auth[_0xe547('0x9')](),controller['addOpenchannelInteractions']);router[_0xe547('0x36')](_0xe547('0x51'),auth[_0xe547('0x9')](),controller[_0xe547('0x52')]);router[_0xe547('0x36')]('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0xe547('0x53')]);router[_0xe547('0x36')]('/:id/mail_accounts',auth[_0xe547('0x9')](),controller[_0xe547('0x54')]);router['post'](_0xe547('0x2d'),auth[_0xe547('0x9')](),controller[_0xe547('0x55')]);router['post'](_0xe547('0x2f'),auth[_0xe547('0x9')](),controller[_0xe547('0x56')]);router['post'](_0xe547('0x31'),auth[_0xe547('0x9')](),controller['addChatWebsites']);router['post']('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller[_0xe547('0x57')]);router[_0xe547('0x36')](_0xe547('0x35'),auth[_0xe547('0x9')](),controller[_0xe547('0x58')]);router['put'](_0xe547('0xf'),auth[_0xe547('0x9')](),controller[_0xe547('0x59')]);router['put'](_0xe547('0x5a'),auth[_0xe547('0x9')](),controller['changePassword']);router['delete'](_0xe547('0x14'),auth[_0xe547('0x9')](),controller['removeQueues']);router[_0xe547('0x5b')](_0xe547('0x24'),auth[_0xe547('0x9')](),controller[_0xe547('0x5c')]);router[_0xe547('0x5b')](_0xe547('0xf'),auth[_0xe547('0x9')](),controller[_0xe547('0x5d')]);router[_0xe547('0x5b')](_0xe547('0x4b'),auth['isAuthenticated'](),controller[_0xe547('0x5e')]);router['delete'](_0xe547('0x4c'),auth[_0xe547('0x9')](),controller['removeMailInteractions']);router[_0xe547('0x5b')](_0xe547('0x5f'),auth[_0xe547('0x9')](),controller[_0xe547('0x60')]);router[_0xe547('0x5b')]('/:id/sms_interactions',auth[_0xe547('0x9')](),controller[_0xe547('0x61')]);router['delete'](_0xe547('0x50'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xe547('0x5b')](_0xe547('0x51'),auth[_0xe547('0x9')](),controller[_0xe547('0x62')]);router['delete'](_0xe547('0x2a'),auth[_0xe547('0x9')](),controller[_0xe547('0x63')]);router[_0xe547('0x5b')](_0xe547('0x64'),auth[_0xe547('0x9')](),controller[_0xe547('0x65')]);router[_0xe547('0x5b')]('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0xe547('0x66')]);router[_0xe547('0x5b')](_0xe547('0x2f'),auth[_0xe547('0x9')](),controller[_0xe547('0x67')]);router[_0xe547('0x5b')](_0xe547('0x31'),auth[_0xe547('0x9')](),controller['removeChatWebsites']);router[_0xe547('0x5b')](_0xe547('0x32'),auth[_0xe547('0x9')](),controller[_0xe547('0x68')]);router[_0xe547('0x5b')](_0xe547('0x35'),auth[_0xe547('0x9')](),controller[_0xe547('0x69')]);router[_0xe547('0x36')](_0xe547('0x6a'),auth[_0xe547('0x9')](),controller['messengerSoundNotification']);module[_0xe547('0x6b')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d8c34c2..4e0b530 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 _0x0326=['update,nonat','showWebBar','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','util','lodash','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','callerid','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','INTEGER','accountcode','format','BOOLEAN','DATE','DEFAULT\x20PAUSE','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','rfc2833','info','shortinfo','inband','yes','nonat','update','outgoing','nat','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','uas','fingerprint','certificate','active','passive','actpass'];(function(_0x496b15,_0x2a0e38){var _0x29ce84=function(_0x31ac83){while(--_0x31ac83){_0x496b15['push'](_0x496b15['shift']());}};_0x29ce84(++_0x2a0e38);}(_0x0326,0xd6));var _0x6032=function(_0x459c2b,_0x44b2d9){_0x459c2b=_0x459c2b-0x0;var _0x26bc62=_0x0326[_0x459c2b];return _0x26bc62;};'use strict';var Sequelize=require(_0x6032('0x0'));var moment=require('moment');var util=require(_0x6032('0x1'));var _=require(_0x6032('0x2'));module['exports']={'name':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x131f0e){this[_0x6032('0x4')](_0x6032('0x5'),_0x131f0e);this[_0x6032('0x4')](_0x6032('0x6'),_0x131f0e);},'comment':_0x6032('0x7')},'fullname':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'set':function(_0x37ca71){this[_0x6032('0x4')]('fullname',_0x37ca71);this[_0x6032('0x4')](_0x6032('0x8'),util['format'](_0x6032('0x9'),_0x37ca71,this[_0x6032('0xa')](_0x6032('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xbd0e2e){if(_0xbd0e2e){this[_0x6032('0x4')](_0x6032('0xc'),_0xbd0e2e[_0x6032('0xd')]());}}},'role':{'type':Sequelize[_0x6032('0xe')](_0x6032('0xf'),_0x6032('0x10'),_0x6032('0x11'),_0x6032('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x6032('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':![],'unique':_0x6032('0xb'),'set':function(_0x45163c){this['setDataValue'](_0x6032('0xb'),_0x45163c);this[_0x6032('0x4')](_0x6032('0x14'),_0x45163c);this[_0x6032('0x4')](_0x6032('0x8'),util[_0x6032('0x15')](_0x6032('0x9'),this[_0x6032('0xa')]('fullname'),_0x45163c));}},'salt':{'type':Sequelize[_0x6032('0x3')]},'phone':{'type':Sequelize[_0x6032('0x3')]},'mobile':{'type':Sequelize[_0x6032('0x3')]},'address':{'type':Sequelize[_0x6032('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x6032('0x3')]},'country':{'type':Sequelize[_0x6032('0x3')]},'online':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x6032('0x17')]},'voicePause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6032('0x3')],'defaultValue':_0x6032('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x6032('0x13')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x6032('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x19'),_0x6032('0x10'),_0x6032('0x1a')),'allowNull':!![],'defaultValue':_0x6032('0x19')},'context':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x1b'),_0x6032('0x1c'),_0x6032('0x1d'),_0x6032('0x1e'),_0x6032('0x1f'),_0x6032('0x20'),_0x6032('0x21'),_0x6032('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![],'defaultValue':_0x6032('0x23'),'set':function(_0x1f98a3){this[_0x6032('0x4')](_0x6032('0x24'),_0x1f98a3?_0x1f98a3[_0x6032('0x25')](','):null);},'get':function(){return this[_0x6032('0xa')](_0x6032('0x24'))?this[_0x6032('0xa')](_0x6032('0x24'))[_0x6032('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x27'),_0x6032('0x28'),_0x6032('0x29'),_0x6032('0x2a'),'auto'),'allowNull':!![],'defaultValue':_0x6032('0x27')},'directmedia':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no',_0x6032('0x2c'),_0x6032('0x2d'),_0x6032('0x2e')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x236ed4){this[_0x6032('0x4')](_0x6032('0x2f'),_0x236ed4?_0x236ed4['join'](','):null);},'get':function(){return this[_0x6032('0xa')](_0x6032('0x2f'))?this[_0x6032('0xa')](_0x6032('0x2f'))[_0x6032('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x6032('0x3')]},'namedcallgroup':{'type':Sequelize[_0x6032('0x3')]},'pickupgroup':{'type':Sequelize[_0x6032('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x6032('0x3')]},'language':{'type':Sequelize[_0x6032('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6032('0x3')]},'disallow':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'defaultValue':_0x6032('0x30')},'allow':{'type':Sequelize[_0x6032('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xe6d3ef){this[_0x6032('0x4')]('allow',_0xe6d3ef?_0xe6d3ef[_0x6032('0x25')](';'):_0x6032('0x31'));},'get':function(){return this[_0x6032('0xa')]('allow')?this[_0x6032('0xa')](_0x6032('0x32'))[_0x6032('0x26')](';'):null;},'comment':_0x6032('0x33')},'autoframing':{'type':Sequelize[_0x6032('0xe')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![],'set':function(_0x2baabb){this[_0x6032('0x4')](_0x6032('0x34'),_0x2baabb?_0x2baabb['join'](','):null);},'get':function(){return this[_0x6032('0xa')](_0x6032('0x34'))?this[_0x6032('0xa')](_0x6032('0x34'))[_0x6032('0x26')](','):null;},'comment':_0x6032('0x35')},'trustrpid':{'type':Sequelize[_0x6032('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no',_0x6032('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![],'defaultValue':_0x6032('0x37')},'amaflags':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x6032('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x39'),_0x6032('0x3a'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x6032('0xe')]('uac',_0x6032('0x3b')),'allowNull':!![],'defaultValue':_0x6032('0x3b')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![],'defaultValue':_0x6032('0x2b')},'keepalive':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6032('0xe')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no',_0x6032('0x3c'),_0x6032('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x6032('0x3e'),_0x6032('0x3f'),_0x6032('0x40')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6032('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6032('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x6032('0xe')](_0x6032('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x6032('0x2b'),'no','nonat',_0x6032('0x2d'),_0x6032('0x41')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x6032('0x17')]},'passwordResetAt':{'type':Sequelize[_0x6032('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0,'set':function(_0x4fac0e){this[_0x6032('0x4')](_0x6032('0x42'),_0x4fac0e);var _0x50a530=this['get']({'plain':!![]});switch(_0x4fac0e){case 0x0:case 0x1:var _0x1a4014=_0x50a530[_0x6032('0x24')]?_[_0x6032('0x43')](_0x50a530['transport'])?_0x50a530[_0x6032('0x24')]['join']():_0x50a530['transport']:_0x6032('0x23');if(_0x1a4014===_0x6032('0x44')){_0x1a4014=_0x6032('0x23');}this[_0x6032('0x4')](_0x6032('0x24'),_0x1a4014);this[_0x6032('0x4')](_0x6032('0x45'),'no');this['setDataValue'](_0x6032('0x46'),null);this[_0x6032('0x4')](_0x6032('0x47'),null);this[_0x6032('0x4')](_0x6032('0x48'),null);this[_0x6032('0x4')](_0x6032('0x49'),null);this[_0x6032('0x4')](_0x6032('0x4a'),null);this[_0x6032('0x4')](_0x6032('0x4b'),null);this['setDataValue']('dtlscertfile',null);this[_0x6032('0x4')](_0x6032('0x4c'),null);this[_0x6032('0x4')](_0x6032('0x4d'),'no');break;case 0x2:this[_0x6032('0x4')]('transport',_0x6032('0x44'));this['setDataValue'](_0x6032('0x45'),_0x6032('0x2b'));this[_0x6032('0x4')](_0x6032('0x46'),_0x6032('0x2b'));this['setDataValue'](_0x6032('0x47'),'yes');this['setDataValue'](_0x6032('0x48'),_0x6032('0x2b'));this['setDataValue'](_0x6032('0x49'),_0x6032('0x2b'));this[_0x6032('0x4')](_0x6032('0x4a'),'no');this['setDataValue']('dtlssetup',_0x6032('0x40'));this[_0x6032('0x4')](_0x6032('0x4e'),_0x50a530[_0x6032('0x4e')]||_0x6032('0x4f'));this[_0x6032('0x4')](_0x6032('0x4c'),_0x50a530[_0x6032('0x4c')]||_0x6032('0x50'));this[_0x6032('0x4')](_0x6032('0x4d'),_0x6032('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0x6032('0x51')],'set':function(_0x43ae0b){this[_0x6032('0x4')](_0x6032('0x52'),_0x43ae0b?_0x43ae0b['join'](','):[]);},'get':function(){return this[_0x6032('0xa')](_0x6032('0x52'))?_[_0x6032('0x53')](this[_0x6032('0xa')]('permissions')[_0x6032('0x26')](','),function(_0x161a7d){return parseInt(_0x161a7d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6032('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6032('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6032('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x6032('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6032('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6032('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6032('0xe')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6032('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x6032('0x54')],'get':function(){return this['getDataValue'](_0x6032('0x55'))?this[_0x6032('0xa')](_0x6032('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x6032('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x29cf5f){if(typeof _0x29cf5f===_0x6032('0x56')){var _0x461f94=_0x29cf5f==='1'?!![]:_0x29cf5f==='0'?![]:_0x29cf5f===_0x6032('0x57')?!![]:_0x29cf5f==='false'?![]:![];this['setDataValue'](_0x6032('0x58'),_0x461f94);}else{this[_0x6032('0x4')](_0x6032('0x58'),_0x29cf5f);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x53516e){this[_0x6032('0x4')](_0x6032('0x59'),_0x53516e);if(_0x53516e===!![]){this[_0x6032('0x4')]('blockedAt',moment());this[_0x6032('0x4')](_0x6032('0x5a'),0x0);}else{this[_0x6032('0x4')](_0x6032('0x5b'),null);}}},'blockedAt':{'type':Sequelize[_0x6032('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6032('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6032('0x13')](0x5)[_0x6032('0x5c')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6032('0x16')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6032('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6032('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6032('0x16')],'defaultValue':![]}}; \ No newline at end of file +var _0xafca=['info','shortinfo','auto','rfc2833','yes','outgoing','force_rport,comedia','nat','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\x22gsm\x22]','insecure','never','always','refuse','originate','uac','uas','fingerprint','active','passive','nonat','update','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlssetup','rtcp_mux','dtlsverify','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','format','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','accountcode','callerid','\x22%s\x22\x20<%s>','BOOLEAN','DATE','INTEGER','dynamic','friend','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split'];(function(_0x13dbb9,_0x233a7b){var _0xcf6af2=function(_0x2768a0){while(--_0x2768a0){_0x13dbb9['push'](_0x13dbb9['shift']());}};_0xcf6af2(++_0x233a7b);}(_0xafca,0x19b));var _0xaafc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xafca[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xaafc('0x0'));var moment=require('moment');var util=require(_0xaafc('0x1'));var _=require('lodash');module[_0xaafc('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaafc('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x44b8a5){this[_0xaafc('0x4')]('name',_0x44b8a5);this[_0xaafc('0x4')](_0xaafc('0x5'),_0x44b8a5);},'comment':_0xaafc('0x6')},'fullname':{'type':Sequelize[_0xaafc('0x7')],'allowNull':![],'set':function(_0x36ed7c){this[_0xaafc('0x4')](_0xaafc('0x8'),_0x36ed7c);this['setDataValue']('callerid',util[_0xaafc('0x9')]('\x22%s\x22\x20<%s>',_0x36ed7c,this[_0xaafc('0xa')](_0xaafc('0xb'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xaafc('0xc'),'validate':{'isEmail':!![]},'set':function(_0x7e00ed){if(_0x7e00ed){this[_0xaafc('0x4')](_0xaafc('0xc'),_0x7e00ed[_0xaafc('0xd')]());}}},'role':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0xf'),_0xaafc('0x10'),_0xaafc('0x11'),_0xaafc('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xaafc('0x7')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xaafc('0x7')],'defaultValue':_0xaafc('0x13')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':'internal','set':function(_0x307435){this[_0xaafc('0x4')]('internal',_0x307435);this[_0xaafc('0x4')](_0xaafc('0x14'),_0x307435);this[_0xaafc('0x4')](_0xaafc('0x15'),util['format'](_0xaafc('0x16'),this[_0xaafc('0xa')](_0xaafc('0x8')),_0x307435));}},'salt':{'type':Sequelize[_0xaafc('0x7')]},'phone':{'type':Sequelize[_0xaafc('0x7')]},'mobile':{'type':Sequelize[_0xaafc('0x7')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xaafc('0x7')]},'userpic':{'type':Sequelize[_0xaafc('0x7')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xaafc('0x18')]},'voicePause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xaafc('0x18')]},'chatCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xaafc('0x19')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xaafc('0x19')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xaafc('0x1a')},'ipaddr':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'port':{'type':Sequelize[_0xaafc('0x19')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xaafc('0x10'),'peer'),'allowNull':!![],'defaultValue':_0xaafc('0x1b')},'context':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![],'defaultValue':_0xaafc('0x1c')},'callingpres':{'type':Sequelize[_0xaafc('0xe')]('ALLOWED_NOT_SCREENED',_0xaafc('0x1d'),_0xaafc('0x1e'),_0xaafc('0x1f'),_0xaafc('0x20'),'PROHIB_PASSED_SCREEN',_0xaafc('0x21'),_0xaafc('0x22')),'allowNull':!![]},'deny':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'permit':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'secret':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xaafc('0x23'),'set':function(_0x528231){this[_0xaafc('0x4')](_0xaafc('0x24'),_0x528231?_0x528231[_0xaafc('0x25')](','):null);},'get':function(){return this[_0xaafc('0xa')](_0xaafc('0x24'))?this[_0xaafc('0xa')](_0xaafc('0x24'))[_0xaafc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xaafc('0xe')]('rfc2833',_0xaafc('0x27'),_0xaafc('0x28'),'inband',_0xaafc('0x29')),'allowNull':!![],'defaultValue':_0xaafc('0x2a')},'directmedia':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no','nonat','update',_0xaafc('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'nat':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![],'defaultValue':_0xaafc('0x2d'),'set':function(_0x22c472){this[_0xaafc('0x4')](_0xaafc('0x2e'),_0x22c472?_0x22c472[_0xaafc('0x25')](','):null);},'get':function(){return this[_0xaafc('0xa')]('nat')?this[_0xaafc('0xa')]('nat')[_0xaafc('0x26')](','):null;},'comment':_0xaafc('0x2f')},'callgroup':{'type':Sequelize[_0xaafc('0x7')]},'namedcallgroup':{'type':Sequelize[_0xaafc('0x7')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xaafc('0x7')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xaafc('0x30')},'allow':{'type':Sequelize[_0xaafc('0x7')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2449db){this[_0xaafc('0x4')](_0xaafc('0x31'),_0x2449db?_0x2449db['join'](';'):_0xaafc('0x32'));},'get':function(){return this[_0xaafc('0xa')](_0xaafc('0x31'))?this[_0xaafc('0xa')](_0xaafc('0x31'))[_0xaafc('0x26')](';'):null;},'comment':_0xaafc('0x33')},'autoframing':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![],'set':function(_0x4fd069){this[_0xaafc('0x4')]('insecure',_0x4fd069?_0x4fd069['join'](','):null);},'get':function(){return this[_0xaafc('0xa')](_0xaafc('0x34'))?this[_0xaafc('0xa')](_0xaafc('0x34'))[_0xaafc('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xaafc('0xe')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no',_0xaafc('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xaafc('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xaafc('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xaafc('0x2b')},'busylevel':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xaafc('0xe')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xaafc('0xe')]('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no',_0xaafc('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xaafc('0x37'),_0xaafc('0x38')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xaafc('0x39'),_0xaafc('0x3a')),'allowNull':!![],'defaultValue':_0xaafc('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xaafc('0xe')]('yes','no'),'allowNull':!![],'defaultValue':_0xaafc('0x2b')},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0xaafc('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xaafc('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no',_0xaafc('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0xaafc('0x3c'),_0xaafc('0x3d'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xaafc('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xaafc('0x19')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no',_0xaafc('0x3e'),_0xaafc('0x3f'),_0xaafc('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xaafc('0x7')]},'resetPasswordExpires':{'type':Sequelize[_0xaafc('0x18')]},'passwordResetAt':{'type':Sequelize[_0xaafc('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xaafc('0x41')]},'showWebBar':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0,'set':function(_0x1d9e25){this[_0xaafc('0x4')](_0xaafc('0x42'),_0x1d9e25);var _0x46a956=this[_0xaafc('0x43')]({'plain':!![]});switch(_0x1d9e25){case 0x0:case 0x1:var _0x3b4812=_0x46a956[_0xaafc('0x24')]?_[_0xaafc('0x44')](_0x46a956[_0xaafc('0x24')])?_0x46a956[_0xaafc('0x24')][_0xaafc('0x25')]():_0x46a956['transport']:_0xaafc('0x23');if(_0x3b4812===_0xaafc('0x45')){_0x3b4812=_0xaafc('0x23');}this[_0xaafc('0x4')](_0xaafc('0x24'),_0x3b4812);this[_0xaafc('0x4')](_0xaafc('0x46'),'no');this[_0xaafc('0x4')]('avpf',null);this[_0xaafc('0x4')](_0xaafc('0x47'),null);this[_0xaafc('0x4')](_0xaafc('0x48'),null);this[_0xaafc('0x4')]('dtlsenable',null);this[_0xaafc('0x4')]('dtlsverify',null);this['setDataValue'](_0xaafc('0x49'),null);this['setDataValue']('dtlscertfile',null);this[_0xaafc('0x4')]('dtlsprivatekey',null);this[_0xaafc('0x4')](_0xaafc('0x4a'),'no');break;case 0x2:this[_0xaafc('0x4')](_0xaafc('0x24'),_0xaafc('0x45'));this[_0xaafc('0x4')]('encryption','yes');this[_0xaafc('0x4')]('avpf',_0xaafc('0x2b'));this[_0xaafc('0x4')]('force_avp','yes');this['setDataValue']('icesupport',_0xaafc('0x2b'));this[_0xaafc('0x4')]('dtlsenable',_0xaafc('0x2b'));this[_0xaafc('0x4')](_0xaafc('0x4b'),'no');this['setDataValue'](_0xaafc('0x49'),'actpass');this[_0xaafc('0x4')]('dtlscertfile',_0x46a956[_0xaafc('0x4c')]||_0xaafc('0x4d'));this[_0xaafc('0x4')](_0xaafc('0x4e'),_0x46a956[_0xaafc('0x4e')]||_0xaafc('0x4f'));this[_0xaafc('0x4')](_0xaafc('0x4a'),_0xaafc('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xaafc('0x41')],'set':function(_0x46bd4e){this['setDataValue'](_0xaafc('0x50'),_0x46bd4e?_0x46bd4e[_0xaafc('0x25')](','):[]);},'get':function(){return this[_0xaafc('0xa')](_0xaafc('0x50'))?_['map'](this['getDataValue'](_0xaafc('0x50'))[_0xaafc('0x26')](','),function(_0x5c4304){return parseInt(_0x5c4304,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xaafc('0x7')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xaafc('0xe')](_0xaafc('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xaafc('0x7')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xaafc('0x51')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this['getDataValue'](_0xaafc('0x52')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xaafc('0x7')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xaafc('0x7')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![],'set':function(_0x26941d){if(typeof _0x26941d===_0xaafc('0x53')){var _0x39232e=_0x26941d==='1'?!![]:_0x26941d==='0'?![]:_0x26941d===_0xaafc('0x54')?!![]:_0x26941d===_0xaafc('0x55')?![]:![];this[_0xaafc('0x4')](_0xaafc('0x56'),_0x39232e);}else{this[_0xaafc('0x4')](_0xaafc('0x56'),_0x26941d);}}},'blocked':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![],'set':function(_0x2432b7){this[_0xaafc('0x4')](_0xaafc('0x57'),_0x2432b7);if(_0x2432b7===!![]){this[_0xaafc('0x4')](_0xaafc('0x58'),moment());this[_0xaafc('0x4')]('loginAttempts',0x0);}else{this['setDataValue'](_0xaafc('0x58'),null);}}},'blockedAt':{'type':Sequelize[_0xaafc('0x18')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xaafc('0x19')](0x5)[_0xaafc('0x59')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xaafc('0x19')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xaafc('0x17')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 2028d85..98cca0b 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 _0x391e=['download','server/files/images/','userpic','getOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','Tag','Tags','color','tag','getQueues','isValidChannel','model','keys','Queue','rawAttributes','filters','intersection','fields','order','sort','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','getScreenRecordings','ScreenRecording','UserId','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','WhatsappInteraction','getWhatsappInteractions','login','phone','LOCAL/%s@from-sip/n','intrf','user:forcelogout','headers','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','loginInPause','UserVoiceQueue.penalty','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','pause','updateAttributes','getChannels','DEFAULT\x20PAUSE','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','flattenDeep','getDataValue','Voice','UserVoicePrefix','VoicePrefixId','removeTeams','getAssociatedQueues','removeAgent','TeamVoicePrefix','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gt','$gte','$lte','$ne','$eq','$not','$between','$in','$notIn','$notLike','$notILike','$like','$contains','$contained','$any','firstName','lastName','dialActive','VoiceQueue','getApiKey','retrieveApiKey','json','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','toString','lower','col','desc','asc','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','toUpperCase','slice','SELECT','select','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','path','lodash','ioredis','../../components/auth/service','../../components/contacts','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','handleError','../../mysqldb','socket.io-emitter','redis','register','defaults','sendStatus','end','limit','undefined','count','offset','status','then','role','agent','emit','destroy','get','admin','Users','user','Telephones','filter','ignore','map','value','includes','find','name','UserProfileResource','stack','send','User','type','key','salt','previousPasswords','resetPasswordToken','index','getOptions','where','query','true','include','UserSetting','attributes','rows','openTabs','length','push','dataValues','sms','fax','mail','whatsapp','all','catch','params','includeAll','userSetting','merge','options','chat','openchannel','body','describe','addContacts','ids','omit','internal','Setting','findById','securePassword','validatePasswordPattern','password','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','from','voicemail','VoiceMail','email','permissions','101','102','113','105','107','108','109','100','111','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','telephone','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','updatePasswordsHistory','addQueues','channel','online','interface','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','QueueId','Queue:save','voice','format','SIP/%s','upsert','remove','isArray','Queue:remove','UserVoiceQueueRt','addAvatar','file','filename','getAvatar','join','root'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0x391e,0xda));var _0xe391=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x391e[_0x9c2427];return _0x51984f;};'use strict';var moment=require('moment');var util=require('util');var path=require(_0xe391('0x0'));var fs=require('fs');var _=require(_0xe391('0x1'));var squel=require('squel');var Redis=require(_0xe391('0x2'));var authService=require(_0xe391('0x3'));var contacts=require(_0xe391('0x4'));var qs=require(_0xe391('0x5'));var rta=require('../../components/realtime/agents');var logger=require('../../config/logger')(_0xe391('0x6'));var utils=require(_0xe391('0x7'));var config=require(_0xe391('0x8'));var licenseUtil=require(_0xe391('0x9'));var APIBadRequestError=require('../../errors/api')[_0xe391('0xa')];var APINotFoundError=require(_0xe391('0xb'))[_0xe391('0xc')];var APIHandleError=require(_0xe391('0xb'))[_0xe391('0xd')];var db=require(_0xe391('0xe'))['db'];var socket=require(_0xe391('0xf'))(new Redis(config[_0xe391('0x10')]));require('./user.socket')[_0xe391('0x11')](socket);config['redis']=_[_0xe391('0x12')](config[_0xe391('0x10')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x2fde4d,_0x3aca3a){_0x3aca3a=_0x3aca3a||0xcc;return function(_0x3cde54){if(_0x3cde54){return _0x2fde4d[_0xe391('0x13')](_0x3aca3a);}return _0x2fde4d['status'](_0x3aca3a)[_0xe391('0x14')]();};}function respondWithResult(_0x1176a4,_0x597aa3){_0x597aa3=_0x597aa3||0xc8;return function(_0x2648a1){if(_0x2648a1){return _0x1176a4['status'](_0x597aa3)['json'](_0x2648a1);}};}function respondWithFilteredResult(_0x5aad34,_0x46b0ab){return function(_0x370944){if(_0x370944){var _0xa33755=typeof _0x46b0ab['offset']==='undefined'&&typeof _0x46b0ab[_0xe391('0x15')]===_0xe391('0x16');var _0x44c0e9=_0x370944[_0xe391('0x17')];var _0x4c2b2a=_0xa33755?0x0:_0x46b0ab[_0xe391('0x18')];var _0x59fc22=_0xa33755?_0x370944[_0xe391('0x17')]:_0x46b0ab['offset']+_0x46b0ab['limit'];var _0x1635ca;if(_0x59fc22>=_0x44c0e9){_0x59fc22=_0x44c0e9;_0x1635ca=0xc8;}else{_0x1635ca=0xce;}_0x5aad34[_0xe391('0x19')](_0x1635ca);return _0x5aad34['set']('Content-Range',_0x4c2b2a+'-'+_0x59fc22+'/'+_0x44c0e9)['json'](_0x370944);}return null;};}function saveUpdates(_0x212752){return function(_0x366936){if(_0x366936){return _0x366936['update'](_0x212752)[_0xe391('0x1a')](function(_0x27431f){if(_0x27431f[_0xe391('0x1b')]===_0xe391('0x1c')){socket[_0xe391('0x1d')]('userNotification:recalc:'+_0x27431f['id'],_0x27431f);}return _0x27431f;});}return null;};}function removeEntity(_0xcd50d8){return function(_0x35784f){if(_0x35784f){return _0x35784f[_0xe391('0x1e')]()[_0xe391('0x1a')](function(){var _0x53615c=_0x35784f[_0xe391('0x1f')]({'plain':!![]});if(_0x53615c[_0xe391('0x1b')]===_0xe391('0x20'))return;var _0x16c00f=[{'name':_0xe391('0x21'),'value':_0xe391('0x22'),'ignore':!![]},{'name':'Agents','value':_0xe391('0x1c'),'ignore':![]},{'name':_0xe391('0x23'),'value':'telephone','ignore':![]}];var _0x5db9b9=_(_0x16c00f)[_0xe391('0x24')](_0xe391('0x25'))[_0xe391('0x26')](_0xe391('0x27'))[_0xe391('0x27')]();if(_[_0xe391('0x28')](_0x5db9b9,_0x53615c[_0xe391('0x1b')])){return;}var _0x1a22b6=_[_0xe391('0x29')](_0x16c00f,[_0xe391('0x27'),_0x53615c[_0xe391('0x1b')]])[_0xe391('0x2a')];return db[_0xe391('0x2b')][_0xe391('0x1e')]({'where':{'type':_0x1a22b6,'resourceId':_0x53615c['id']}})[_0xe391('0x1a')](function(){return _0x35784f;});})[_0xe391('0x1a')](function(){_0xcd50d8[_0xe391('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51830c){return function(_0xa58c11){if(!_0xa58c11){_0x51830c[_0xe391('0x13')](0x194);}return _0xa58c11;};}function handleError(_0x2ef9e4,_0x167e9b){_0x167e9b=_0x167e9b||0x1f4;return function(_0x3f1064){logger['error'](_0x3f1064[_0xe391('0x2c')]);if(_0x3f1064['name']){delete _0x3f1064[_0xe391('0x2a')];}_0x2ef9e4[_0xe391('0x19')](_0x167e9b)[_0xe391('0x2d')](_0x3f1064);};}function getUserAttributes(){return _(db[_0xe391('0x2e')]['rawAttributes'])['map'](function(_0x47c5f5){return{'name':_0x47c5f5['fieldName'],'type':_0x47c5f5[_0xe391('0x2f')][_0xe391('0x30')]};})[_0xe391('0x24')](function(_0x1f933d){return!['password',_0xe391('0x31'),_0xe391('0x32'),_0xe391('0x33'),'resetPasswordExpires','md5secret']['includes'](_0x1f933d[_0xe391('0x2a')]);})[_0xe391('0x27')]();}exports[_0xe391('0x34')]=function(_0x340954,_0x33aa53){var _0x595feb={},_0x571064={'count':0x0,'rows':[]};var _0x29c8d5=getUserAttributes();_0x595feb=qs[_0xe391('0x35')](_0x29c8d5,_0x340954);var _0x28b403={'where':_0x595feb[_0xe391('0x36')]};return db[_0xe391('0x2e')]['count'](_0x28b403)['then'](function(_0x3b028e){_0x571064[_0xe391('0x17')]=_0x3b028e;if(_0x340954[_0xe391('0x37')]['includeAll']){_0x595feb['include']=[{'all':!![]}];}if(_0x340954['query']['userSetting']===_0xe391('0x38')){_0x595feb[_0xe391('0x39')]=[{'model':db[_0xe391('0x3a')],'as':'userSetting'}];}if(!_[_0xe391('0x28')](_0x595feb[_0xe391('0x3b')],'id')){_0x595feb[_0xe391('0x3b')]['push']('id');}return db[_0xe391('0x2e')]['findAll'](_0x595feb);})[_0xe391('0x1a')](function(_0x2a2f90){_0x571064[_0xe391('0x3c')]=_0x2a2f90;if(_0x340954[_0xe391('0x37')][_0xe391('0x3d')]===_0xe391('0x38')){var _0x47467e=[];for(var _0x8ba7c3=0x0;_0x8ba7c3<_0x571064[_0xe391('0x3c')][_0xe391('0x3e')];_0x8ba7c3++){_0x47467e[_0xe391('0x3f')](get_open_tabs('chat',_0x571064[_0xe391('0x3c')][_0x8ba7c3][_0xe391('0x40')]));_0x47467e[_0xe391('0x3f')](get_open_tabs(_0xe391('0x41'),_0x571064[_0xe391('0x3c')][_0x8ba7c3][_0xe391('0x40')]));_0x47467e[_0xe391('0x3f')](get_open_tabs(_0xe391('0x42'),_0x571064[_0xe391('0x3c')][_0x8ba7c3][_0xe391('0x40')]));_0x47467e[_0xe391('0x3f')](get_open_tabs(_0xe391('0x43'),_0x571064[_0xe391('0x3c')][_0x8ba7c3]['dataValues']));_0x47467e['push'](get_open_tabs('openchannel',_0x571064[_0xe391('0x3c')][_0x8ba7c3][_0xe391('0x40')]));_0x47467e[_0xe391('0x3f')](get_open_tabs(_0xe391('0x44'),_0x571064[_0xe391('0x3c')][_0x8ba7c3]['dataValues']));}return Promise[_0xe391('0x45')](_0x47467e)['then'](function(){return _0x571064;});}else{return _0x571064;}})[_0xe391('0x1a')](respondWithFilteredResult(_0x33aa53,_0x595feb))[_0xe391('0x46')](handleError(_0x33aa53,null));};exports['show']=function(_0x472586,_0x2d02df){var _0x3347df=getUserAttributes();_0x472586[_0xe391('0x37')]['id']=_0x472586[_0xe391('0x47')]['id'];var _0x16118e=qs[_0xe391('0x35')](_0x3347df,_0x472586);if(_0x472586[_0xe391('0x37')][_0xe391('0x48')]){_0x16118e[_0xe391('0x39')]=[{'all':!![]}];}if(_0x472586[_0xe391('0x37')][_0xe391('0x49')]==='true'){_0x16118e[_0xe391('0x39')]=[{'model':db[_0xe391('0x3a')],'as':_0xe391('0x49')}];}_0x16118e=_[_0xe391('0x4a')]({},_0x16118e,_0x472586[_0xe391('0x4b')]);if(!_['includes'](_0x16118e[_0xe391('0x3b')],'id')){_0x16118e[_0xe391('0x3b')][_0xe391('0x3f')]('id');}return db[_0xe391('0x2e')][_0xe391('0x29')](_0x16118e)[_0xe391('0x1a')](handleEntityNotFound(_0x2d02df,null))[_0xe391('0x1a')](function(_0x4cf25f){var _0x4d20ea=[];values=_0x4cf25f;if(_0x472586[_0xe391('0x37')][_0xe391('0x3d')]==='true'){_0x4d20ea['push'](get_open_tabs(_0xe391('0x4c'),_0x4cf25f[_0xe391('0x40')]));_0x4d20ea[_0xe391('0x3f')](get_open_tabs('sms',_0x4cf25f[_0xe391('0x40')]));_0x4d20ea['push'](get_open_tabs(_0xe391('0x4d'),_0x4cf25f[_0xe391('0x40')]));_0x4d20ea[_0xe391('0x3f')](get_open_tabs(_0xe391('0x44'),_0x4cf25f[_0xe391('0x40')]));_0x4d20ea['push'](get_open_tabs(_0xe391('0x42'),_0x4cf25f[_0xe391('0x40')]));_0x4d20ea[_0xe391('0x3f')](get_open_tabs(_0xe391('0x43'),_0x4cf25f[_0xe391('0x40')]));return Promise[_0xe391('0x45')](_0x4d20ea);}else{return values;}})[_0xe391('0x1a')](function(){return values;})[_0xe391('0x1a')](respondWithResult(_0x2d02df,null))[_0xe391('0x46')](handleError(_0x2d02df,null));};exports['update']=function(_0x54ab24,_0x628c66){if(_0x54ab24[_0xe391('0x4e')]['id']){delete _0x54ab24[_0xe391('0x4e')]['id'];}delete _0x54ab24[_0xe391('0x4e')][_0xe391('0x1b')];return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x54ab24[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x628c66,null))[_0xe391('0x1a')](saveUpdates(_0x54ab24['body'],null))[_0xe391('0x1a')](respondWithResult(_0x628c66,null))['catch'](handleError(_0x628c66,null));};exports[_0xe391('0x4f')]=function(_0x5cbb8b,_0x24058f){return db[_0xe391('0x2e')]['describe']()['then'](respondWithResult(_0x24058f,null))['catch'](handleError(_0x24058f,null));};exports[_0xe391('0x50')]=function(_0x1064e9,_0x3190fc){return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x1064e9[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x3190fc,null))[_0xe391('0x1a')](function(_0x206012){if(_0x206012){return _0x206012[_0xe391('0x50')](_0x1064e9[_0xe391('0x4e')][_0xe391('0x51')],_[_0xe391('0x52')](_0x1064e9[_0xe391('0x4e')],[_0xe391('0x51'),'id'])||{});}})[_0xe391('0x1a')](respondWithResult(_0x3190fc,null))[_0xe391('0x46')](handleError(_0x3190fc,null));};function validateUser(_0x3fc7b1){return new Promise(function(_0x1dcac1,_0x15952d){if(_0x3fc7b1[_0xe391('0x53')])return _0x1dcac1(_0x3fc7b1);return db[_0xe391('0x54')][_0xe391('0x55')](0x1)[_0xe391('0x1a')](function(_0x81eb6f){if(_0x81eb6f[_0xe391('0x56')])authService[_0xe391('0x57')](_0x3fc7b1[_0xe391('0x58')]);db['User'][_0xe391('0x59')](_0xe391('0x53'))['then'](function(_0x2cf8f3){if(_[_0xe391('0x5a')](_0x2cf8f3)){_0x3fc7b1[_0xe391('0x53')]=_0x81eb6f['min_internal']||0x1;return;}if(_['isNil'](_0x81eb6f[_0xe391('0x5b')])||_0x81eb6f[_0xe391('0x5b')]===_0x2cf8f3){_0x3fc7b1[_0xe391('0x53')]=_0x2cf8f3+0x1;return;}if(_0x81eb6f['min_internal']>_0x2cf8f3){_0x3fc7b1[_0xe391('0x53')]=_0x81eb6f['min_internal'];return;}return db['sequelize'][_0xe391('0x37')](_0xe391('0x5c'),{'type':db[_0xe391('0x5d')]['QueryTypes']['SELECT']})[_0xe391('0x1a')](function(_0x4212d4){if(_0x4212d4&&_0x4212d4[_0xe391('0x3e')]){for(var _0x209788=0x0,_0x309847=_0x4212d4[_0xe391('0x3e')];_0x209788<_0x309847&&_[_0xe391('0x5a')](_0x3fc7b1[_0xe391('0x53')]);_0x209788++){if(_0x81eb6f['min_internal']<=_0x4212d4[_0x209788][_0xe391('0x5e')]){_0x3fc7b1[_0xe391('0x53')]=_0x4212d4[_0x209788][_0xe391('0x5e')];}else if(_0x81eb6f[_0xe391('0x5b')]>_0x4212d4[_0x209788][_0xe391('0x5e')]&&_0x81eb6f[_0xe391('0x5b')]<=_0x4212d4[_0x209788]['to']){_0x3fc7b1[_0xe391('0x53')]=_0x81eb6f['min_internal'];}}}if(_['isNil'](_0x3fc7b1['internal'])){_0x3fc7b1[_0xe391('0x53')]=_0x2cf8f3+0x1;}return _0x1dcac1(_0x3fc7b1);});});})[_0xe391('0x46')](function(_0xf96e0f){_0x15952d(_0xf96e0f);});});}function updateUser(_0x33660d){return new Promise(function(_0x2b1c15,_0x2b293e){try{if(_0x33660d[_0xe391('0x5f')]){_0x33660d['mailbox']=_0x33660d[_0xe391('0x53')];_0x33660d[_0xe391('0x60')]={'mailbox':_0x33660d[_0xe391('0x53')],'password':_0x33660d[_0xe391('0x58')],'fullname':_0x33660d['fullname'],'email':_0x33660d[_0xe391('0x61')]};}if(_0x33660d[_0xe391('0x1b')]===_0xe391('0x1c')){if(!_0x33660d[_0xe391('0x62')])_0x33660d['permissions']=[_0xe391('0x63'),_0xe391('0x64'),'103',_0xe391('0x65'),'110','104',_0xe391('0x66'),'106',_0xe391('0x67'),_0xe391('0x68'),_0xe391('0x69'),_0xe391('0x6a'),_0xe391('0x6b'),'114',_0xe391('0x6c')];}_0x2b1c15(_0x33660d);}catch(_0xf9d100){_0x2b293e(_0xf9d100);}});}exports[_0xe391('0x6d')]=function(_0x160246,_0x4e351b){if(_0x160246[_0xe391('0x22')][_0xe391('0x1b')]===_0xe391('0x1c'))throw new Error('Unauthorized');if(_0x160246[_0xe391('0x4e')][_0xe391('0x1b')]===_0xe391('0x22')&&_0x160246[_0xe391('0x22')][_0xe391('0x1b')]!==_0xe391('0x20')){throw new Error(_0xe391('0x6e'));}if(_0x160246[_0xe391('0x4e')]['role']===_0xe391('0x20')&&_0x160246['user'][_0xe391('0x1b')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xe391('0x6f')]([_0x160246['body']])[_0xe391('0x1a')](function(){return validateUser(_0x160246[_0xe391('0x4e')]);})[_0xe391('0x1a')](function(_0x5e64fa){return updateUser(_0x5e64fa)[_0xe391('0x1a')](function(_0x1794fd){if(_0x1794fd[_0xe391('0x1b')]==='admin'){_0x1794fd['settingsEnabled']=_0x160246[_0xe391('0x22')][_0xe391('0x70')];delete _0x1794fd[_0xe391('0x71')];}return _0x1794fd;});})[_0xe391('0x1a')](function(_0x41e697){return db[_0xe391('0x2e')]['create'](_0x41e697,{'include':[{'model':db[_0xe391('0x60')],'as':_0xe391('0x60')}]});})[_0xe391('0x1a')](function(_0x40eedb){if(_0x160246[_0xe391('0x4e')][_0xe391('0x1b')]==='user')return _0x40eedb;if(_0x160246[_0xe391('0x22')][_0xe391('0x1b')]!=='user')return _0x40eedb;return db[_0xe391('0x72')][_0xe391('0x29')]({'where':{'name':_0x40eedb[_0xe391('0x1b')]===_0xe391('0x1c')?_0xe391('0x73'):_0xe391('0x23'),'userProfileId':_0x160246[_0xe391('0x22')][_0xe391('0x71')]},'raw':!![]})[_0xe391('0x1a')](function(_0x71b662){if(!_0x71b662||_0x71b662[_0xe391('0x74')]!=0x0)return _0x40eedb;return db[_0xe391('0x2b')][_0xe391('0x6d')]({'name':_0x40eedb['name'],'resourceId':_0x40eedb['id'],'type':_0x71b662[_0xe391('0x2a')],'sectionId':_0x71b662['id']},{})[_0xe391('0x1a')](function(){return _0x40eedb;});})['catch'](function(_0x17ce6a){logger['error'](_0xe391('0x75'),_0x17ce6a);throw _0x17ce6a;});})[_0xe391('0x1a')](respondWithResult(_0x4e351b,0xc9))[_0xe391('0x46')](handleError(_0x4e351b,null));};exports[_0xe391('0x76')]=function(_0x3d892c,_0x4eefc9){var _0x11ae6e=_0x3d892c[_0xe391('0x4e')];var _0x440fbb=[];if(_0x3d892c[_0xe391('0x22')][_0xe391('0x1b')]==='agent')throw new Error(_0xe391('0x77'));if(_[_0xe391('0x78')](_0x11ae6e,[_0xe391('0x1b'),'user'])&&_0x3d892c[_0xe391('0x22')][_0xe391('0x1b')]!=='admin'){throw new Error(_0xe391('0x6e'));}if(_[_0xe391('0x78')](_0x11ae6e,[_0xe391('0x1b'),'admin'])&&_0x3d892c[_0xe391('0x22')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xe391('0x6f')](_0x11ae6e)['then'](function(){return validateUser(_0x11ae6e[0x0]);})[_0xe391('0x1a')](function(){for(var _0x38ea91=0x1;_0x38ea91<_0x11ae6e[_0xe391('0x3e')];_0x38ea91++){var _0x454fec=_0x11ae6e[_0x38ea91-0x1][_0xe391('0x53')];if(!_0x11ae6e[_0x38ea91][_0xe391('0x53')])_0x11ae6e[_0x38ea91][_0xe391('0x53')]=_0x454fec+0x1;_0x440fbb[_0xe391('0x3f')](validateUser(_0x11ae6e[_0x38ea91]));}return Promise['all'](_0x440fbb);})[_0xe391('0x1a')](function(){_0x440fbb=[];for(var _0x5aafdf=0x0;_0x5aafdf<_0x11ae6e[_0xe391('0x3e')];_0x5aafdf++){_0x440fbb[_0xe391('0x3f')](updateUser(_0x11ae6e[_0x5aafdf]));}return Promise[_0xe391('0x45')](_0x440fbb);})['then'](function(){_0x440fbb=_0x11ae6e[_0xe391('0x26')](function(_0x14fab5){return db[_0xe391('0x2e')]['create'](_0x14fab5,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})['then'](function(_0x53e0dd){_0x14fab5['id']=_0x53e0dd['id'];return _0x14fab5;});});return Promise[_0xe391('0x45')](_0x440fbb);})[_0xe391('0x1a')](function(_0x172a8f){if(_0x3d892c['body'][_0xe391('0x1b')]===_0xe391('0x22'))return _0x172a8f;if(_0x3d892c[_0xe391('0x22')][_0xe391('0x1b')]!=='user')return _0x172a8f;var _0x1ec87f=_[_0xe391('0x78')](_0x172a8f,function(_0x2d51fc){return _0x2d51fc['role']===_0xe391('0x1c')||_0x2d51fc[_0xe391('0x1b')]===_0xe391('0x79');});if(!_0x1ec87f)return _0x172a8f;return db[_0xe391('0x72')][_0xe391('0x7a')]({'where':{'name':{'$or':[_0xe391('0x73'),'Telephones']},'userProfileId':_0x3d892c[_0xe391('0x22')][_0xe391('0x71')]},'raw':!![]})[_0xe391('0x1a')](function(_0x5de7f4){if(_[_0xe391('0x7b')](_0x5de7f4)||!_['some'](_0x5de7f4,['autoAssociation',0x0]))return _0x172a8f;_0x440fbb=[];var _0x4491b6=_(_0x5de7f4)[_0xe391('0x26')](function(_0x1fe789){if(_0x1fe789['autoAssociation']===0x1)return;return _0x1fe789[_0xe391('0x2a')]===_0xe391('0x73')?_0xe391('0x1c'):_0xe391('0x79');})[_0xe391('0x7c')]()[_0xe391('0x27')]();for(var _0x5541a4=0x0;_0x5541a4<_0x172a8f[_0xe391('0x3e')];_0x5541a4++){if(!_[_0xe391('0x28')](_0x4491b6,_0x172a8f[_0x5541a4][_0xe391('0x1b')]))return;var _0x43c658=_0x172a8f[_0x5541a4][_0xe391('0x1b')]===_0xe391('0x1c')?_0xe391('0x73'):'Telephones';_0x440fbb['push'](db[_0xe391('0x2b')][_0xe391('0x6d')]({'name':_0x172a8f[_0x5541a4][_0xe391('0x2a')],'resourceId':_0x172a8f[_0x5541a4]['id'],'type':_0x43c658,'sectionId':_[_0xe391('0x29')](_0x5de7f4,[_0xe391('0x2a'),_0x43c658])['id']},{}));}return Promise['all'](_0x440fbb);});})[_0xe391('0x1a')](respondWithResult(_0x4eefc9,0xc9))['catch'](handleError(_0x4eefc9,null));};exports[_0xe391('0x7d')]=function(_0x1a960a,_0x37eb5c){if(_0x1a960a['body']['id']){delete _0x1a960a[_0xe391('0x4e')]['id'];}return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x1a960a['params']['id']}})[_0xe391('0x1a')](function(_0x3d7473){if(!_0x3d7473)return null;if(_0x3d7473['id']===_0x1a960a['user']['id']){if(!_0x1a960a[_0xe391('0x4e')][_0xe391('0x7e')]||!_0x1a960a[_0xe391('0x4e')][_0xe391('0x7f')]){throw new db[(_0xe391('0x80'))]['ValidationError'](_0xe391('0x81'));}if(!_0x3d7473['authenticate'](_0x1a960a[_0xe391('0x4e')][_0xe391('0x7e')])){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x83'));}if(_0x1a960a[_0xe391('0x4e')][_0xe391('0x7e')]===_0x1a960a['body'][_0xe391('0x7f')]){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x84'));}}else if(_0x1a960a[_0xe391('0x22')][_0xe391('0x1b')]===_0xe391('0x20')){if(!_0x1a960a[_0xe391('0x4e')]['newPassword']){throw new db[(_0xe391('0x80'))]['ValidationError'](_0xe391('0x85'));}}else if(_0x1a960a['user'][_0xe391('0x1b')]===_0xe391('0x22')){if(!_0x1a960a[_0xe391('0x4e')]['newPassword']){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x85'));}if(_0x3d7473[_0xe391('0x1b')]!==_0xe391('0x1c')){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))]('Unauthorized');}}else{throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x77'));}return _0x3d7473;})[_0xe391('0x1a')](handleEntityNotFound(_0x37eb5c,null))[_0xe391('0x1a')](function(_0x1449ae){return db[_0xe391('0x54')][_0xe391('0x86')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xe391('0x87')]})[_0xe391('0x1a')](function(_0x3f54a1){if(_0x3f54a1[_0xe391('0x56')])authService[_0xe391('0x57')](_0x1a960a['body'][_0xe391('0x7f')]);if(!_0x3f54a1['enforcePasswordHistory']||!_0x1449ae['previousPasswords'])return _0x1449ae;authService['validatePasswordHistory'](_0x1a960a['body']['newPassword'],_0x1449ae['previousPasswords'],_0x3f54a1[_0xe391('0x87')]);return _0x1449ae;})['then'](saveUpdates({'password':_0x1a960a[_0xe391('0x4e')][_0xe391('0x7f')],'passwordResetAt':_0x1a960a[_0xe391('0x22')]['id']==_0x1a960a[_0xe391('0x47')]['id']?moment():null,'previousPasswords':authService[_0xe391('0x88')](_0x1a960a[_0xe391('0x4e')][_0xe391('0x7f')],_0x1449ae[_0xe391('0x32')])},null));})[_0xe391('0x1a')](respondWithResult(_0x37eb5c,null))[_0xe391('0x46')](handleError(_0x37eb5c,null));};exports[_0xe391('0x89')]=function(_0x567e54,_0x21c04a){var _0x545ed7=_0x567e54[_0xe391('0x4e')][_0xe391('0x8a')];return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x567e54[_0xe391('0x47')]['id']},'attributes':['id',_0xe391('0x2a'),_0xe391('0x1b'),_0xe391('0x8b'),'loginInPause','voicePause',_0xe391('0x8c')]})['then'](handleEntityNotFound(_0x21c04a,null))['then'](function(_0x523a5f){if(_0x523a5f){if(!utils['isValidChannel'](_0x545ed7)){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x8d'));}return _0x523a5f[_0xe391('0x8e')+_[_0xe391('0x8f')](_0x545ed7[_0xe391('0x90')]())+_0xe391('0x91')](_0x567e54[_0xe391('0x4e')][_0xe391('0x51')],{'penalty':_0x567e54[_0xe391('0x4e')][_0xe391('0x92')]||0x0})[_0xe391('0x93')](function(_0x45c0c6){for(var _0x1aa963=0x0;_0x1aa963<_0x567e54[_0xe391('0x4e')][_0xe391('0x51')][_0xe391('0x3e')];_0x1aa963+=0x1){var _0x937378={'UserId':Number(_0x567e54[_0xe391('0x47')]['id'])};_0x937378[_['capitalize'](_0x545ed7[_0xe391('0x90')]())+_0xe391('0x94')]=Number(_0x567e54['body'][_0xe391('0x51')][_0x1aa963]);socket[_0xe391('0x1d')](_0xe391('0x22')+_['capitalize'](_0x545ed7[_0xe391('0x90')]())+_0xe391('0x95'),_0x937378);}return _0x45c0c6;})[_0xe391('0x1a')](function(){if(_0x545ed7===_0xe391('0x96')){return db['VoiceQueue']['findAll']({'where':{'id':_0x567e54[_0xe391('0x4e')][_0xe391('0x51')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x480316){var _0x41dec7=_0x523a5f['get']({'plain':!![]});var _0x1681bd=[];if(_0x545ed7===_0xe391('0x96')&&_0x41dec7[_0xe391('0x1b')]===_0xe391('0x1c')&&_0x41dec7[_0xe391('0x8b')]){for(let _0x57bec=0x0;_0x57bec<_0x480316[_0xe391('0x3e')];_0x57bec+=0x1){_0x1681bd['push']({'membername':_0x41dec7['name'],'UserId':_0x41dec7['id'],'queue_name':_0x480316[_0x57bec][_0xe391('0x2a')],'VoiceQueueId':_0x480316[_0x57bec]['id'],'interface':_[_0xe391('0x5a')](_0x41dec7['interface'])?util[_0xe391('0x97')](_0xe391('0x98'),_0x41dec7['name']):_0x41dec7['interface'],'paused':_0x41dec7['voicePause']||![],'penalty':_0x567e54[_0xe391('0x4e')][_0xe391('0x92')]||0x0});}return Promise['all'](_0x1681bd['map'](function(_0x4c35a2){return db['UserVoiceQueueRt'][_0xe391('0x99')](_0x4c35a2);}));}return _0x523a5f;});}})[_0xe391('0x1a')](respondWithStatusCode(_0x21c04a,null))[_0xe391('0x46')](handleError(_0x21c04a,null));};exports['removeQueues']=function(_0xa47237,_0x203a2e){var _0x32eb45,_0x3d8f47;return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0xa47237[_0xe391('0x47')]['id']},'attributes':['id',_0xe391('0x2a'),_0xe391('0x1b')]})[_0xe391('0x1a')](handleEntityNotFound(_0x203a2e,null))[_0xe391('0x1a')](function(_0x2728cd){if(_0x2728cd){_0x32eb45=_0x2728cd;if(!_0xa47237[_0xe391('0x37')][_0xe391('0x8a')]||!utils['isValidChannel'](_0xa47237['query'][_0xe391('0x8a')])){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))]('Unknown\x20channel');}return _0x2728cd[_0xe391('0x9a')+_[_0xe391('0x8f')](_0xa47237['query'][_0xe391('0x8a')][_0xe391('0x90')]())+'Queues'](_0xa47237[_0xe391('0x37')][_0xe391('0x51')]);}})['then'](function(_0x2a36e8){if(_[_0xe391('0x9b')](_0xa47237[_0xe391('0x37')]['ids'])){for(var _0xa5c240=0x0;_0xa5c240<_0xa47237[_0xe391('0x37')]['ids'][_0xe391('0x3e')];_0xa5c240+=0x1){_0x3d8f47={'UserId':Number(_0xa47237[_0xe391('0x47')]['id'])};_0x3d8f47[_['capitalize'](_0xa47237['query'][_0xe391('0x8a')][_0xe391('0x90')]())+_0xe391('0x94')]=Number(_0xa47237[_0xe391('0x37')][_0xe391('0x51')][_0xa5c240]);socket[_0xe391('0x1d')](_0xe391('0x22')+_[_0xe391('0x8f')](_0xa47237['query'][_0xe391('0x8a')][_0xe391('0x90')]())+_0xe391('0x9c'),_0x3d8f47);}}else{_0x3d8f47={'UserId':Number(_0xa47237[_0xe391('0x47')]['id'])};_0x3d8f47[_[_0xe391('0x8f')](_0xa47237[_0xe391('0x37')][_0xe391('0x8a')][_0xe391('0x90')]())+_0xe391('0x94')]=Number(_0xa47237[_0xe391('0x37')][_0xe391('0x51')]);socket[_0xe391('0x1d')](_0xe391('0x22')+_[_0xe391('0x8f')](_0xa47237[_0xe391('0x37')][_0xe391('0x8a')][_0xe391('0x90')]())+_0xe391('0x9c'),_0x3d8f47);}return _0x2a36e8;})[_0xe391('0x1a')](function(){if(_0xa47237[_0xe391('0x37')][_0xe391('0x8a')]==='voice'){return db[_0xe391('0x9d')][_0xe391('0x1e')]({'where':{'UserId':_0xa47237[_0xe391('0x47')]['id'],'VoiceQueueId':_0xa47237[_0xe391('0x37')][_0xe391('0x51')]},'individualHooks':!![]})[_0xe391('0x1a')](function(){return _0x32eb45;});}return _0x32eb45;})[_0xe391('0x1a')](respondWithStatusCode(_0x203a2e,null))[_0xe391('0x46')](handleError(_0x203a2e,null));};exports[_0xe391('0x9e')]=function(_0x425984,_0x155451){_0x425984[_0xe391('0x4e')]['userpic']=_0x425984[_0xe391('0x9f')][_0xe391('0xa0')];return db[_0xe391('0x2e')]['find']({'where':{'id':_0x425984[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x155451,null))['then'](saveUpdates(_0x425984[_0xe391('0x4e')],null))[_0xe391('0x1a')](respondWithResult(_0x155451,null))[_0xe391('0x46')](handleError(_0x155451,null));};exports[_0xe391('0xa1')]=function(_0x2b144c,_0xcbccb8){var _0x18419a=path[_0xe391('0xa2')](config[_0xe391('0xa3')],'server/files/images/logos/default_profile.png');return db[_0xe391('0x2e')]['find']({'where':{'id':_0x2b144c[_0xe391('0x47')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0xcbccb8,null))[_0xe391('0x1a')](function(_0x3c6224){if(_0x3c6224){if(_['isNil'](_0x3c6224['userpic'])){return _0xcbccb8[_0xe391('0xa4')](_0x18419a);}else{if(!fs['existsSync'](path['join'](config['root'],_0xe391('0xa5'),_0x3c6224[_0xe391('0xa6')]))){return _0xcbccb8[_0xe391('0xa4')](_0x18419a);}return _0xcbccb8['download'](path[_0xe391('0xa2')](config[_0xe391('0xa3')],_0xe391('0xa5'),_0x3c6224[_0xe391('0xa6')]));}}})[_0xe391('0x46')](handleError(_0xcbccb8,null));};exports[_0xe391('0xa7')]=function(_0x112172,_0x42b124){return db[_0xe391('0x2e')]['find']({'where':{'id':_0x112172[_0xe391('0x47')]['id']},'attributes':['id']})[_0xe391('0x1a')](handleEntityNotFound(_0x42b124,null))[_0xe391('0x1a')](function(_0x3e1e61){var _0x1a0f4d=[];values=_0x3e1e61['dataValues'];_0x1a0f4d[_0xe391('0x3f')](get_open_tabs('chat',_0x3e1e61[_0xe391('0x40')]));_0x1a0f4d['push'](get_open_tabs(_0xe391('0x41'),_0x3e1e61['dataValues']));_0x1a0f4d[_0xe391('0x3f')](get_open_tabs(_0xe391('0x4d'),_0x3e1e61['dataValues']));_0x1a0f4d[_0xe391('0x3f')](get_open_tabs(_0xe391('0x44'),_0x3e1e61[_0xe391('0x40')]));_0x1a0f4d[_0xe391('0x3f')](get_open_tabs(_0xe391('0x42'),_0x3e1e61[_0xe391('0x40')]));_0x1a0f4d[_0xe391('0x3f')](get_open_tabs(_0xe391('0x43'),_0x3e1e61[_0xe391('0x40')]));return Promise[_0xe391('0x45')](_0x1a0f4d);})[_0xe391('0x1a')](function(_0x2e8874){if(_0x2e8874){var _0x26c35d=_['map'](values['ChatOpenTabs'],function(_0x4d9019){return{'channel':_0xe391('0xa8'),'id':_0x4d9019['id'],'createdAt':_0x4d9019[_0xe391('0xa9')]};});var _0x247603=_[_0xe391('0x26')](values[_0xe391('0xaa')],function(_0x51ec1c){return{'channel':_0xe391('0xab'),'id':_0x51ec1c['id'],'createdAt':_0x51ec1c[_0xe391('0xa9')]};});var _0x2f676b=_['map'](values[_0xe391('0xac')],function(_0x407c7){return{'channel':_0xe391('0xad'),'id':_0x407c7['id'],'createdAt':_0x407c7[_0xe391('0xa9')]};});var _0x50eec0=_[_0xe391('0x26')](values[_0xe391('0xae')],function(_0x24978c){return{'channel':_0xe391('0xaf'),'id':_0x24978c['id'],'createdAt':_0x24978c[_0xe391('0xa9')]};});var _0x3e5fca=_[_0xe391('0x26')](values[_0xe391('0xb0')],function(_0x78c57a){return{'channel':_0xe391('0xb1'),'id':_0x78c57a['id'],'createdAt':_0x78c57a[_0xe391('0xa9')]};});var _0x2aee05=_['map'](values[_0xe391('0xb2')],function(_0x3e9fa0){return{'channel':_0xe391('0xb3'),'id':_0x3e9fa0['id'],'createdAt':_0x3e9fa0[_0xe391('0xa9')]};});var _0x596924=_[_0xe391('0xb4')](_0x26c35d,_0x247603,_0x2f676b,_0x50eec0,_0x3e5fca,_0x2aee05);var _0x5974e4={'count':_0x596924[_0xe391('0x3e')],'rows':_0x596924};return _0x5974e4;}else return null;})[_0xe391('0x1a')](respondWithResult(_0x42b124,null))['catch'](handleError(_0x42b124,null));};exports['getContacts']=function(_0x3d2219,_0x379218){var _0x175a22={};return db[_0xe391('0x2e')]['findOne']({'where':{'id':_0x3d2219[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](function(_0x4e51ad){if(!_0x4e51ad){throw new APINotFoundError(util[_0xe391('0x97')](_0xe391('0xb5'),_0x3d2219[_0xe391('0x47')]['id']));}return contacts[_0xe391('0x4f')]();})[_0xe391('0x1a')](function(_0x5c1ce3){_0x3d2219[_0xe391('0x37')][_0xe391('0x2e')]=_0x3d2219[_0xe391('0x47')]['id'];_0x175a22=qs['getOptions'](_0x5c1ce3,_0x3d2219);if(_0x3d2219[_0xe391('0x37')]['hasOwnProperty'](_0xe391('0x48'))){_0x175a22['include']=[{'model':db['CmList'],'as':'List','required':![]},{'model':db[_0xe391('0xb6')],'as':_0xe391('0xb7'),'attributes':['id',_0xe391('0x2a'),_0xe391('0xb8')],'where':_0x3d2219['query'][_0xe391('0xb9')]?{'id':_0x3d2219[_0xe391('0x37')][_0xe391('0xb9')]}:undefined,'required':_0x3d2219[_0xe391('0x37')][_0xe391('0xb9')]?!![]:![]}];}return contacts[_0xe391('0x7a')](_0x3d2219[_0xe391('0x37')],_0x3d2219[_0xe391('0x22')],_0x175a22,_0x5c1ce3);})['then'](respondWithFilteredResult(_0x379218,_0x175a22))[_0xe391('0x46')](APIHandleError(_0x379218));};exports[_0xe391('0xba')]=function(_0x28716e,_0x1ba57a){var _0x34b575;var _0x260b8c={};var _0x1e82f7;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x28716e[_0xe391('0x47')]['id']},'attributes':['id',_0xe391('0x2a'),'role']})[_0xe391('0x1a')](handleEntityNotFound(_0x1ba57a,null))['then'](function(_0x481119){if(!utils[_0xe391('0xbb')](_0x28716e[_0xe391('0x37')][_0xe391('0x8a')])){throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0x8d'));}_0x34b575=_0x481119;var _0x194694={};_0x194694[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_[_0xe391('0x8f')](_0x28716e['query'][_0xe391('0x8a')])+_0xe391('0xbe')][_0xe391('0xbf')]);_0x194694[_0xe391('0x37')]=_[_0xe391('0xbd')](_0x28716e[_0xe391('0x37')]);_0x194694[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x194694[_0xe391('0xbc')],_0x194694[_0xe391('0x37')]);_0x260b8c[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x194694[_0xe391('0xbc')],qs['fields'](_0x28716e[_0xe391('0x37')][_0xe391('0xc2')]));_0x260b8c[_0xe391('0x3b')]=_0x260b8c[_0xe391('0x3b')]['length']?_0x260b8c[_0xe391('0x3b')]:_0x194694[_0xe391('0xbc')];_0x260b8c[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x28716e['query'][_0xe391('0xc4')]);_0x260b8c[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x28716e[_0xe391('0x37')],_0x194694[_0xe391('0xc0')]));if(_0x28716e[_0xe391('0x37')][_0xe391('0x24')]){_0x260b8c[_0xe391('0x36')]=_['merge'](_0x260b8c[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x260b8c['attributes'],function(_0x435fbb){var _0x1d0037={};_0x1d0037[_0x435fbb]={'$like':'%'+_0x28716e[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x1d0037;})});}_0x260b8c=_[_0xe391('0x4a')]({},_0x260b8c,_0x28716e[_0xe391('0x4b')]);switch(_0x34b575[_0xe391('0x1b')]){case _0xe391('0x20'):return db[_[_0xe391('0x8f')](_0x28716e[_0xe391('0x37')]['channel'])+_0xe391('0xbe')]['findAll'](_0x260b8c);case _0xe391('0x22'):case _0xe391('0x1c'):return _0x34b575['get'+_[_0xe391('0x8f')](_0x28716e['query'][_0xe391('0x8a')])+_0xe391('0x91')](_0x260b8c);default:throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0xc6'));}})[_0xe391('0x1a')](function(_0x3791bf){_0x1e82f7=_0x3791bf[_0xe391('0x3e')];if(!_0x28716e[_0xe391('0x37')][_0xe391('0xc7')](_0xe391('0xc8'))){_0x260b8c[_0xe391('0x15')]=qs['limit'](_0x28716e[_0xe391('0x37')]['limit']);_0x260b8c[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x28716e[_0xe391('0x37')]['offset']);}switch(_0x34b575['role']){case _0xe391('0x20'):return db[_[_0xe391('0x8f')](_0x28716e[_0xe391('0x37')][_0xe391('0x8a')])+_0xe391('0xbe')][_0xe391('0x7a')](_0x260b8c);case _0xe391('0x22'):case _0xe391('0x1c'):return _0x34b575[_0xe391('0x1f')+_[_0xe391('0x8f')](_0x28716e['query'][_0xe391('0x8a')])+_0xe391('0x91')](_0x260b8c);}})['then'](function(_0x4d5ebd){return{'count':_0x1e82f7,'rows':_0x4d5ebd};})[_0xe391('0x1a')](respondWithResult(_0x1ba57a,null))[_0xe391('0x46')](handleError(_0x1ba57a,null));};exports[_0xe391('0xc9')]=function(_0x3ea6c4,_0x58bda8){var _0xcac44e={};var _0x4b19a9={};var _0x27aeb3;var _0x166fb3;return db['User']['findOne']({'where':{'id':_0x3ea6c4[_0xe391('0x47')]['id']}})['then'](handleEntityNotFound(_0x58bda8,null))[_0xe391('0x1a')](function(_0x4ffa8e){if(_0x4ffa8e){_0x27aeb3=_0x4ffa8e;_0x4b19a9[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0x9d')][_0xe391('0xbf')]);_0x4b19a9[_0xe391('0x37')]=_['keys'](_0x3ea6c4[_0xe391('0x37')]);_0x4b19a9['filters']=_[_0xe391('0xc1')](_0x4b19a9['model'],_0x4b19a9[_0xe391('0x37')]);_0xcac44e[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x4b19a9[_0xe391('0xbc')],qs['fields'](_0x3ea6c4[_0xe391('0x37')][_0xe391('0xc2')]));_0xcac44e[_0xe391('0x3b')]=_0xcac44e[_0xe391('0x3b')][_0xe391('0x3e')]?_0xcac44e[_0xe391('0x3b')]:_0x4b19a9[_0xe391('0xbc')];_0xcac44e[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x3ea6c4[_0xe391('0x37')][_0xe391('0xc4')]);_0xcac44e[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x3ea6c4[_0xe391('0x37')],_0x4b19a9[_0xe391('0xc0')]));if(_0x3ea6c4['query'][_0xe391('0x24')]){_0xcac44e[_0xe391('0x36')]=_['merge'](_0xcac44e[_0xe391('0x36')],{'$or':_['map'](_0xcac44e[_0xe391('0x3b')],function(_0x4aef92){var _0x5c3b3a={};_0x5c3b3a[_0x4aef92]={'$like':'%'+_0x3ea6c4[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x5c3b3a;})});}_0xcac44e=_['merge']({},_0xcac44e,_0x3ea6c4[_0xe391('0x4b')]);return _0x27aeb3[_0xe391('0xc9')](_0xcac44e);}})['then'](function(_0xa63c8c){if(_0xa63c8c){_0x166fb3=_0xa63c8c[_0xe391('0x3e')];if(!_0x3ea6c4[_0xe391('0x37')][_0xe391('0xc7')](_0xe391('0xc8'))){_0xcac44e[_0xe391('0x15')]=qs[_0xe391('0x15')](_0x3ea6c4[_0xe391('0x37')][_0xe391('0x15')]);_0xcac44e[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x3ea6c4['query'][_0xe391('0x18')]);}return _0x27aeb3['getVoiceQueuesRt'](_0xcac44e);}})[_0xe391('0x1a')](function(_0x3af1a9){if(_0x3af1a9){return _0x3af1a9?{'count':_0x166fb3,'rows':_0x3af1a9}:null;}})[_0xe391('0x1a')](respondWithResult(_0x58bda8,null))[_0xe391('0x46')](handleError(_0x58bda8,null));};exports[_0xe391('0xca')]=function(_0x4e13f1,_0x13fbba){var _0x309bb6={};var _0x22e44a={};var _0x24aa4c;var _0x3b04a4;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x4e13f1[_0xe391('0x47')]['id']}})['then'](handleEntityNotFound(_0x13fbba,null))[_0xe391('0x1a')](function(_0x50b625){if(_0x50b625){_0x24aa4c=_0x50b625;_0x22e44a[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xcb')]['rawAttributes']);_0x22e44a[_0xe391('0x37')]=_[_0xe391('0xbd')](_0x4e13f1[_0xe391('0x37')]);_0x22e44a['filters']=_['intersection'](_0x22e44a[_0xe391('0xbc')],_0x22e44a[_0xe391('0x37')]);_0x309bb6[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x22e44a['model'],qs['fields'](_0x4e13f1['query'][_0xe391('0xc2')]));_0x309bb6[_0xe391('0x3b')]=_0x309bb6[_0xe391('0x3b')][_0xe391('0x3e')]?_0x309bb6[_0xe391('0x3b')]:_0x22e44a[_0xe391('0xbc')];_0x309bb6[_0xe391('0xc3')]=qs['sort'](_0x4e13f1[_0xe391('0x37')][_0xe391('0xc4')]);_0x309bb6[_0xe391('0x36')]=qs[_0xe391('0xc0')](_['pick'](_0x4e13f1[_0xe391('0x37')],_0x22e44a[_0xe391('0xc0')]));if(_0x4e13f1[_0xe391('0x37')][_0xe391('0x24')]){_0x309bb6[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x309bb6[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x309bb6[_0xe391('0x3b')],function(_0x12f816){var _0x3768ee={};_0x3768ee[_0x12f816]={'$like':'%'+_0x4e13f1['query'][_0xe391('0x24')]+'%'};return _0x3768ee;})});}_0x309bb6=_[_0xe391('0x4a')]({},_0x309bb6,_0x4e13f1['options']);return _0x24aa4c[_0xe391('0xca')](_0x309bb6);}})[_0xe391('0x1a')](function(_0x4bf734){if(_0x4bf734){_0x3b04a4=_0x4bf734['length'];if(!_0x4e13f1[_0xe391('0x37')][_0xe391('0xc7')]('nolimit')){_0x309bb6['limit']=qs[_0xe391('0x15')](_0x4e13f1[_0xe391('0x37')][_0xe391('0x15')]);_0x309bb6['offset']=qs['offset'](_0x4e13f1['query'][_0xe391('0x18')]);}return _0x24aa4c['getGroups'](_0x309bb6);}})['then'](function(_0x141649){if(_0x141649){return _0x141649?{'count':_0x3b04a4,'rows':_0x141649}:null;}})[_0xe391('0x1a')](respondWithResult(_0x13fbba,null))['catch'](handleError(_0x13fbba,null));};exports[_0xe391('0xcc')]=function(_0xa293a6,_0xe146e){var _0x52a3a9={'raw':!![],'where':{}};var _0x9584ae={};var _0x431949={'count':0x0,'rows':[]};return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0xa293a6[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0xe146e,null))[_0xe391('0x1a')](function(_0x3dfa0f){if(_0x3dfa0f){_0x9584ae['model']=_[_0xe391('0xbd')](db[_0xe391('0xcd')][_0xe391('0xbf')]);_0x9584ae[_0xe391('0x37')]=_['keys'](_0xa293a6[_0xe391('0x37')]);_0x9584ae[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x9584ae['model'],_0x9584ae[_0xe391('0x37')]);_0x52a3a9[_0xe391('0x3b')]=_['intersection'](_0x9584ae['model'],qs[_0xe391('0xc2')](_0xa293a6[_0xe391('0x37')][_0xe391('0xc2')]));_0x52a3a9[_0xe391('0x3b')]=_0x52a3a9[_0xe391('0x3b')][_0xe391('0x3e')]?_0x52a3a9[_0xe391('0x3b')]:_0x9584ae['model'];if(!_0xa293a6['query'][_0xe391('0xc7')](_0xe391('0xc8'))){_0x52a3a9['limit']=qs['limit'](_0xa293a6[_0xe391('0x37')][_0xe391('0x15')]);_0x52a3a9[_0xe391('0x18')]=qs[_0xe391('0x18')](_0xa293a6[_0xe391('0x37')]['offset']);}_0x52a3a9[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0xa293a6[_0xe391('0x37')][_0xe391('0xc4')]);_0x52a3a9[_0xe391('0x36')]=qs['filters'](_[_0xe391('0xc5')](_0xa293a6[_0xe391('0x37')],_0x9584ae[_0xe391('0xc0')]));_0x52a3a9[_0xe391('0x36')]['UserId']=_0x3dfa0f['id'];if(_0xa293a6[_0xe391('0x37')][_0xe391('0x24')]){_0x52a3a9[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x52a3a9[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x52a3a9['attributes'],function(_0x4ccc87){var _0x3e657d={};_0x3e657d[_0x4ccc87]={'$like':'%'+_0xa293a6[_0xe391('0x37')]['filter']+'%'};return _0x3e657d;})});}_0x52a3a9=_[_0xe391('0x4a')]({},_0x52a3a9,_0xa293a6[_0xe391('0x4b')]);return db[_0xe391('0xcd')]['count']({'where':_0x52a3a9[_0xe391('0x36')]})[_0xe391('0x1a')](function(_0x273e16){_0x431949[_0xe391('0x17')]=_0x273e16;if(_0xa293a6[_0xe391('0x37')][_0xe391('0x48')]){_0x52a3a9[_0xe391('0x39')]=[{'all':!![]}];}return db[_0xe391('0xcd')][_0xe391('0x7a')](_0x52a3a9);})[_0xe391('0x1a')](function(_0x5c9b11){_0x431949['rows']=_0x5c9b11;return _0x431949;});}})[_0xe391('0x1a')](respondWithFilteredResult(_0xe146e,_0x52a3a9))[_0xe391('0x46')](handleError(_0xe146e,null));};exports[_0xe391('0xce')]=function(_0x354a89,_0x289187){var _0xc5c1c3={'raw':!![],'where':{}};var _0x34ce78={};var _0x1b6f92={'count':0x0,'rows':[]};return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x354a89[_0xe391('0x47')]['id']}})['then'](handleEntityNotFound(_0x289187,null))[_0xe391('0x1a')](function(_0x4d818b){if(_0x4d818b){_0x34ce78['model']=_[_0xe391('0xbd')](db[_0xe391('0xcf')][_0xe391('0xbf')]);_0x34ce78[_0xe391('0x37')]=_['keys'](_0x354a89[_0xe391('0x37')]);_0x34ce78['filters']=_[_0xe391('0xc1')](_0x34ce78[_0xe391('0xbc')],_0x34ce78['query']);_0xc5c1c3[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x34ce78[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x354a89[_0xe391('0x37')][_0xe391('0xc2')]));_0xc5c1c3['attributes']=_0xc5c1c3[_0xe391('0x3b')][_0xe391('0x3e')]?_0xc5c1c3[_0xe391('0x3b')]:_0x34ce78[_0xe391('0xbc')];if(!_0x354a89['query'][_0xe391('0xc7')]('nolimit')){_0xc5c1c3[_0xe391('0x15')]=qs['limit'](_0x354a89[_0xe391('0x37')][_0xe391('0x15')]);_0xc5c1c3[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x354a89[_0xe391('0x37')][_0xe391('0x18')]);}_0xc5c1c3[_0xe391('0xc3')]=qs['sort'](_0x354a89[_0xe391('0x37')]['sort']);_0xc5c1c3[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x354a89[_0xe391('0x37')],_0x34ce78['filters']));_0xc5c1c3['where'][_0xe391('0xd0')]=_0x4d818b['id'];if(_0x354a89[_0xe391('0x37')][_0xe391('0x24')]){_0xc5c1c3[_0xe391('0x36')]=_[_0xe391('0x4a')](_0xc5c1c3[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0xc5c1c3[_0xe391('0x3b')],function(_0x23f782){var _0x348887={};_0x348887[_0x23f782]={'$like':'%'+_0x354a89[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x348887;})});}_0xc5c1c3=_[_0xe391('0x4a')]({},_0xc5c1c3,_0x354a89[_0xe391('0x4b')]);return db[_0xe391('0xcf')][_0xe391('0x17')]({'where':_0xc5c1c3[_0xe391('0x36')]})['then'](function(_0x4fdf94){_0x1b6f92[_0xe391('0x17')]=_0x4fdf94;if(_0x354a89[_0xe391('0x37')][_0xe391('0x48')]){_0xc5c1c3[_0xe391('0x39')]=[{'all':!![]}];}return db[_0xe391('0xcf')][_0xe391('0x7a')](_0xc5c1c3);})[_0xe391('0x1a')](function(_0x5a77c2){_0x1b6f92[_0xe391('0x3c')]=_0x5a77c2;return _0x1b6f92;});}})[_0xe391('0x1a')](respondWithFilteredResult(_0x289187,_0xc5c1c3))['catch'](handleError(_0x289187,null));};exports[_0xe391('0xd1')]=function(_0x53d4a7,_0x5b2b09){var _0x3d54e1={};var _0x2d246d={};var _0x395ad7;var _0x202fb5;return db['User']['findOne']({'where':{'id':_0x53d4a7[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x5b2b09,null))[_0xe391('0x1a')](function(_0x31f022){if(_0x31f022){_0x395ad7=_0x31f022;_0x2d246d[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xd2')]['rawAttributes']);_0x2d246d['query']=_[_0xe391('0xbd')](_0x53d4a7[_0xe391('0x37')]);_0x2d246d[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x2d246d[_0xe391('0xbc')],_0x2d246d[_0xe391('0x37')]);_0x3d54e1['attributes']=_[_0xe391('0xc1')](_0x2d246d[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x53d4a7['query'][_0xe391('0xc2')]));_0x3d54e1[_0xe391('0x3b')]=_0x3d54e1['attributes'][_0xe391('0x3e')]?_0x3d54e1[_0xe391('0x3b')]:_0x2d246d[_0xe391('0xbc')];_0x3d54e1[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x53d4a7[_0xe391('0x37')][_0xe391('0xc4')]);_0x3d54e1[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x53d4a7[_0xe391('0x37')],_0x2d246d['filters']));if(_0x53d4a7[_0xe391('0x37')][_0xe391('0x24')]){_0x3d54e1[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x3d54e1['where'],{'$or':_[_0xe391('0x26')](_0x3d54e1[_0xe391('0x3b')],function(_0x2e0cba){var _0x54a506={};_0x54a506[_0x2e0cba]={'$like':'%'+_0x53d4a7['query'][_0xe391('0x24')]+'%'};return _0x54a506;})});}_0x3d54e1=_[_0xe391('0x4a')]({},_0x3d54e1,_0x53d4a7[_0xe391('0x4b')]);return _0x395ad7[_0xe391('0xd1')](_0x3d54e1);}})['then'](function(_0x518561){if(_0x518561){_0x202fb5=_0x518561[_0xe391('0x3e')];if(!_0x53d4a7[_0xe391('0x37')][_0xe391('0xc7')](_0xe391('0xc8'))){_0x3d54e1[_0xe391('0x15')]=qs[_0xe391('0x15')](_0x53d4a7[_0xe391('0x37')]['limit']);_0x3d54e1[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x53d4a7[_0xe391('0x37')][_0xe391('0x18')]);}return _0x395ad7['getChatInteractions'](_0x3d54e1);}})[_0xe391('0x1a')](function(_0x154fce){if(_0x154fce){return _0x154fce?{'count':_0x202fb5,'rows':_0x154fce}:null;}})['then'](respondWithResult(_0x5b2b09,null))[_0xe391('0x46')](handleError(_0x5b2b09,null));};exports['getOpenchannelInteractions']=function(_0x9702e1,_0x1c6dba){var _0x16b368={};var _0x4fc386={};var _0x516a61;var _0x1f7553;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x9702e1[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x1c6dba,null))[_0xe391('0x1a')](function(_0x14d218){if(_0x14d218){_0x516a61=_0x14d218;_0x4fc386[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xd3')]['rawAttributes']);_0x4fc386['query']=_[_0xe391('0xbd')](_0x9702e1[_0xe391('0x37')]);_0x4fc386['filters']=_[_0xe391('0xc1')](_0x4fc386['model'],_0x4fc386[_0xe391('0x37')]);_0x16b368[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x4fc386['model'],qs[_0xe391('0xc2')](_0x9702e1[_0xe391('0x37')]['fields']));_0x16b368['attributes']=_0x16b368[_0xe391('0x3b')][_0xe391('0x3e')]?_0x16b368['attributes']:_0x4fc386[_0xe391('0xbc')];_0x16b368[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x9702e1[_0xe391('0x37')]['sort']);_0x16b368[_0xe391('0x36')]=qs['filters'](_[_0xe391('0xc5')](_0x9702e1[_0xe391('0x37')],_0x4fc386[_0xe391('0xc0')]));if(_0x9702e1[_0xe391('0x37')]['filter']){_0x16b368['where']=_['merge'](_0x16b368[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x16b368[_0xe391('0x3b')],function(_0x406514){var _0x158cd3={};_0x158cd3[_0x406514]={'$like':'%'+_0x9702e1['query']['filter']+'%'};return _0x158cd3;})});}_0x16b368=_[_0xe391('0x4a')]({},_0x16b368,_0x9702e1[_0xe391('0x4b')]);return _0x516a61[_0xe391('0xd4')](_0x16b368);}})[_0xe391('0x1a')](function(_0x3d1bbd){if(_0x3d1bbd){_0x1f7553=_0x3d1bbd['length'];if(!_0x9702e1['query'][_0xe391('0xc7')](_0xe391('0xc8'))){_0x16b368[_0xe391('0x15')]=qs['limit'](_0x9702e1[_0xe391('0x37')][_0xe391('0x15')]);_0x16b368[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x9702e1[_0xe391('0x37')][_0xe391('0x18')]);}return _0x516a61[_0xe391('0xd4')](_0x16b368);}})[_0xe391('0x1a')](function(_0x1fc826){if(_0x1fc826){return _0x1fc826?{'count':_0x1f7553,'rows':_0x1fc826}:null;}})[_0xe391('0x1a')](respondWithResult(_0x1c6dba,null))[_0xe391('0x46')](handleError(_0x1c6dba,null));};exports[_0xe391('0xd5')]=function(_0x37fb7a,_0x6260cf){var _0x5461ef={'raw':!![],'where':{}};var _0x280cd8={};var _0x3ad7b1={'count':0x0,'rows':[]};return db[_0xe391('0x2e')]['findOne']({'where':{'id':_0x37fb7a[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x6260cf,null))['then'](function(_0x3e1f99){if(_0x3e1f99){_0x280cd8[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xd6')]['rawAttributes']);_0x280cd8['query']=_[_0xe391('0xbd')](_0x37fb7a[_0xe391('0x37')]);_0x280cd8[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x280cd8['model'],_0x280cd8[_0xe391('0x37')]);_0x5461ef['attributes']=_['intersection'](_0x280cd8[_0xe391('0xbc')],qs['fields'](_0x37fb7a[_0xe391('0x37')][_0xe391('0xc2')]));_0x5461ef[_0xe391('0x3b')]=_0x5461ef[_0xe391('0x3b')][_0xe391('0x3e')]?_0x5461ef[_0xe391('0x3b')]:_0x280cd8[_0xe391('0xbc')];if(!_0x37fb7a[_0xe391('0x37')][_0xe391('0xc7')]('nolimit')){_0x5461ef[_0xe391('0x15')]=qs['limit'](_0x37fb7a['query'][_0xe391('0x15')]);_0x5461ef[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x37fb7a['query'][_0xe391('0x18')]);}_0x5461ef['order']=qs[_0xe391('0xc4')](_0x37fb7a['query'][_0xe391('0xc4')]);_0x5461ef[_0xe391('0x36')]=qs[_0xe391('0xc0')](_['pick'](_0x37fb7a[_0xe391('0x37')],_0x280cd8['filters']));_0x5461ef[_0xe391('0x36')][_0xe391('0xd0')]=_0x3e1f99['id'];if(_0x37fb7a[_0xe391('0x37')]['filter']){_0x5461ef['where']=_[_0xe391('0x4a')](_0x5461ef[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x5461ef[_0xe391('0x3b')],function(_0x16ce57){var _0x3ec49d={};_0x3ec49d[_0x16ce57]={'$like':'%'+_0x37fb7a[_0xe391('0x37')]['filter']+'%'};return _0x3ec49d;})});}_0x5461ef=_[_0xe391('0x4a')]({},_0x5461ef,_0x37fb7a['options']);return db['MailInteraction']['count']({'where':_0x5461ef[_0xe391('0x36')]})[_0xe391('0x1a')](function(_0x3531dd){_0x3ad7b1['count']=_0x3531dd;if(_0x37fb7a['query'][_0xe391('0x48')]){_0x5461ef[_0xe391('0x39')]=[{'all':!![]}];}return db['MailInteraction'][_0xe391('0x7a')](_0x5461ef);})['then'](function(_0x2ed6f6){_0x3ad7b1[_0xe391('0x3c')]=_0x2ed6f6;return _0x3ad7b1;});}})[_0xe391('0x1a')](respondWithFilteredResult(_0x6260cf,_0x5461ef))[_0xe391('0x46')](handleError(_0x6260cf,null));};exports[_0xe391('0xd7')]=function(_0x507c32,_0x1a5398){var _0xa27cf2={};var _0x10c959={};var _0xa5eef5;var _0x57f9bc;return db[_0xe391('0x2e')]['findOne']({'where':{'id':_0x507c32[_0xe391('0x47')]['id']}})['then'](handleEntityNotFound(_0x1a5398,null))[_0xe391('0x1a')](function(_0x323bc1){if(_0x323bc1){_0xa5eef5=_0x323bc1;_0x10c959[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xd8')]['rawAttributes']);_0x10c959[_0xe391('0x37')]=_[_0xe391('0xbd')](_0x507c32[_0xe391('0x37')]);_0x10c959[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x10c959[_0xe391('0xbc')],_0x10c959[_0xe391('0x37')]);_0xa27cf2[_0xe391('0x3b')]=_['intersection'](_0x10c959[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x507c32['query']['fields']));_0xa27cf2['attributes']=_0xa27cf2[_0xe391('0x3b')]['length']?_0xa27cf2[_0xe391('0x3b')]:_0x10c959['model'];_0xa27cf2[_0xe391('0xc3')]=qs['sort'](_0x507c32[_0xe391('0x37')][_0xe391('0xc4')]);_0xa27cf2[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x507c32[_0xe391('0x37')],_0x10c959[_0xe391('0xc0')]));if(_0x507c32[_0xe391('0x37')][_0xe391('0x24')]){_0xa27cf2['where']=_[_0xe391('0x4a')](_0xa27cf2[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0xa27cf2[_0xe391('0x3b')],function(_0xfb0e8b){var _0x4b87e1={};_0x4b87e1[_0xfb0e8b]={'$like':'%'+_0x507c32[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x4b87e1;})});}_0xa27cf2=_[_0xe391('0x4a')]({},_0xa27cf2,_0x507c32[_0xe391('0x4b')]);return _0xa5eef5[_0xe391('0xd7')](_0xa27cf2);}})[_0xe391('0x1a')](function(_0x544dc2){if(_0x544dc2){_0x57f9bc=_0x544dc2[_0xe391('0x3e')];if(!_0x507c32[_0xe391('0x37')][_0xe391('0xc7')](_0xe391('0xc8'))){_0xa27cf2['limit']=qs[_0xe391('0x15')](_0x507c32['query'][_0xe391('0x15')]);_0xa27cf2['offset']=qs['offset'](_0x507c32[_0xe391('0x37')]['offset']);}return _0xa5eef5[_0xe391('0xd7')](_0xa27cf2);}})[_0xe391('0x1a')](function(_0x496599){if(_0x496599){return _0x496599?{'count':_0x57f9bc,'rows':_0x496599}:null;}})[_0xe391('0x1a')](respondWithResult(_0x1a5398,null))[_0xe391('0x46')](handleError(_0x1a5398,null));};exports['getFaxInteractions']=function(_0x51ce29,_0x7dc4cf){var _0x16f5fd={};var _0x45cb74={};var _0x2ad443;var _0x27e7ee;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x51ce29['params']['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x7dc4cf,null))[_0xe391('0x1a')](function(_0x99065f){if(_0x99065f){_0x2ad443=_0x99065f;_0x45cb74[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0xd9')][_0xe391('0xbf')]);_0x45cb74[_0xe391('0x37')]=_['keys'](_0x51ce29[_0xe391('0x37')]);_0x45cb74[_0xe391('0xc0')]=_['intersection'](_0x45cb74[_0xe391('0xbc')],_0x45cb74[_0xe391('0x37')]);_0x16f5fd['attributes']=_['intersection'](_0x45cb74[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x51ce29['query'][_0xe391('0xc2')]));_0x16f5fd[_0xe391('0x3b')]=_0x16f5fd[_0xe391('0x3b')][_0xe391('0x3e')]?_0x16f5fd[_0xe391('0x3b')]:_0x45cb74['model'];_0x16f5fd[_0xe391('0xc3')]=qs['sort'](_0x51ce29['query']['sort']);_0x16f5fd[_0xe391('0x36')]=qs[_0xe391('0xc0')](_[_0xe391('0xc5')](_0x51ce29[_0xe391('0x37')],_0x45cb74['filters']));if(_0x51ce29[_0xe391('0x37')][_0xe391('0x24')]){_0x16f5fd['where']=_['merge'](_0x16f5fd[_0xe391('0x36')],{'$or':_['map'](_0x16f5fd[_0xe391('0x3b')],function(_0x5373af){var _0x726387={};_0x726387[_0x5373af]={'$like':'%'+_0x51ce29[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x726387;})});}_0x16f5fd=_['merge']({},_0x16f5fd,_0x51ce29[_0xe391('0x4b')]);return _0x2ad443[_0xe391('0xda')](_0x16f5fd);}})['then'](function(_0x78ff48){if(_0x78ff48){_0x27e7ee=_0x78ff48[_0xe391('0x3e')];if(!_0x51ce29[_0xe391('0x37')]['hasOwnProperty'](_0xe391('0xc8'))){_0x16f5fd['limit']=qs[_0xe391('0x15')](_0x51ce29[_0xe391('0x37')]['limit']);_0x16f5fd[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x51ce29['query'][_0xe391('0x18')]);}return _0x2ad443['getFaxInteractions'](_0x16f5fd);}})[_0xe391('0x1a')](function(_0x3f7808){if(_0x3f7808){return _0x3f7808?{'count':_0x27e7ee,'rows':_0x3f7808}:null;}})[_0xe391('0x1a')](respondWithResult(_0x7dc4cf,null))[_0xe391('0x46')](handleError(_0x7dc4cf,null));};exports['getWhatsappInteractions']=function(_0x47f046,_0x50ff2f){var _0x579ae9={};var _0x31eef6={};var _0x422d02;var _0x2466dc;return db[_0xe391('0x2e')]['findOne']({'where':{'id':_0x47f046[_0xe391('0x47')]['id']}})['then'](handleEntityNotFound(_0x50ff2f,null))['then'](function(_0x583718){if(_0x583718){_0x422d02=_0x583718;_0x31eef6[_0xe391('0xbc')]=_['keys'](db[_0xe391('0xdb')]['rawAttributes']);_0x31eef6['query']=_[_0xe391('0xbd')](_0x47f046[_0xe391('0x37')]);_0x31eef6[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x31eef6[_0xe391('0xbc')],_0x31eef6['query']);_0x579ae9[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x31eef6['model'],qs['fields'](_0x47f046['query'][_0xe391('0xc2')]));_0x579ae9[_0xe391('0x3b')]=_0x579ae9[_0xe391('0x3b')]['length']?_0x579ae9[_0xe391('0x3b')]:_0x31eef6[_0xe391('0xbc')];_0x579ae9[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x47f046[_0xe391('0x37')]['sort']);_0x579ae9[_0xe391('0x36')]=qs[_0xe391('0xc0')](_['pick'](_0x47f046['query'],_0x31eef6[_0xe391('0xc0')]));if(_0x47f046['query']['filter']){_0x579ae9['where']=_[_0xe391('0x4a')](_0x579ae9[_0xe391('0x36')],{'$or':_[_0xe391('0x26')](_0x579ae9[_0xe391('0x3b')],function(_0x4dd8af){var _0x952b3f={};_0x952b3f[_0x4dd8af]={'$like':'%'+_0x47f046[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x952b3f;})});}_0x579ae9=_[_0xe391('0x4a')]({},_0x579ae9,_0x47f046['options']);return _0x422d02['getWhatsappInteractions'](_0x579ae9);}})[_0xe391('0x1a')](function(_0x39f3e9){if(_0x39f3e9){_0x2466dc=_0x39f3e9[_0xe391('0x3e')];if(!_0x47f046[_0xe391('0x37')]['hasOwnProperty'](_0xe391('0xc8'))){_0x579ae9['limit']=qs[_0xe391('0x15')](_0x47f046[_0xe391('0x37')]['limit']);_0x579ae9['offset']=qs[_0xe391('0x18')](_0x47f046[_0xe391('0x37')][_0xe391('0x18')]);}return _0x422d02[_0xe391('0xdc')](_0x579ae9);}})[_0xe391('0x1a')](function(_0x5e8184){if(_0x5e8184){return _0x5e8184?{'count':_0x2466dc,'rows':_0x5e8184}:null;}})[_0xe391('0x1a')](respondWithResult(_0x50ff2f,null))[_0xe391('0x46')](handleError(_0x50ff2f,null));};exports[_0xe391('0xdd')]=function(_0x58faa4,_0x155af9,_0x5722f0){var _0x419958;var _0x4c8046;var _0x400c77;var _0x16b1b6=!_['isNil'](_0x58faa4[_0xe391('0x47')]['id'])?_0x58faa4[_0xe391('0x47')]['id']:!_[_0xe391('0x5a')](_0x58faa4[_0xe391('0x22')]['id'])?_0x58faa4[_0xe391('0x22')]['id']:null;return db[_0xe391('0x2e')]['find']({'where':{'id':_0x16b1b6,'role':{'$or':[_0xe391('0x20'),_0xe391('0x22'),_0xe391('0x1c')]}},'attributes':['id',_0xe391('0x2a'),_0xe391('0xde'),'mobile',_0xe391('0x1b'),_0xe391('0x53'),'loginInPause']})[_0xe391('0x1a')](function(_0x246b03){if(_0x246b03){if(_0x246b03[_0xe391('0x1b')]==='agent'){_0x419958=_0x246b03;if(_0x58faa4[_0xe391('0x4e')]['interface']){_0x400c77=util[_0xe391('0x97')](_0xe391('0xdf'),_0x419958[_0x58faa4['body'][_0xe391('0x8c')]]);}else if(_0x58faa4[_0xe391('0x4e')][_0xe391('0xe0')]){_0x400c77=util[_0xe391('0x97')](_0xe391('0x98'),_0x58faa4[_0xe391('0x4e')]['intrf']);}else{_0x400c77=util[_0xe391('0x97')](_0xe391('0x98'),_0x419958[_0xe391('0x2a')]);}socket['to'](util[_0xe391('0x97')]('user:%s',_0x419958['name']))[_0xe391('0x1d')](_0xe391('0xe1'),{'user':{'id':_0x419958['id'],'name':_0x419958[_0xe391('0x2a')]},'ip':_0x58faa4[_0xe391('0xe2')]['x-forwarded-for']||_0x58faa4[_0xe391('0xe3')][_0xe391('0xe4')]||_0x58faa4[_0xe391('0xe5')][_0xe391('0xe4')]||_0x58faa4[_0xe391('0xe3')][_0xe391('0xe5')][_0xe391('0xe4')]});return db[_0xe391('0x9d')][_0xe391('0x1e')]({'where':{'membername':_0x419958[_0xe391('0x2a')]},'individualHooks':!![]});}}else{throw new db[(_0xe391('0x80'))][(_0xe391('0x82'))](_0xe391('0xe6'));}})['then'](function(){if(_0x419958){return _0x419958[_0xe391('0xe7')]({'raw':!![]});}})[_0xe391('0x1a')](function(_0x3165de){if(_0x419958){if(_0x3165de){_0x4c8046=_0x3165de;if(_0x4c8046['length']){var _0xf278a=_0x4c8046[_0xe391('0x26')](function(_0x44620f){var _0x37b101={'membername':_0x419958['name'],'UserId':_0x419958['id'],'queue_name':_0x44620f['name'],'VoiceQueueId':_0x44620f['id'],'interface':_0x400c77,'paused':_0x419958[_0xe391('0xe8')]||![],'penalty':_0x44620f[_0xe391('0xe9')]||0x0};return db[_0xe391('0x9d')][_0xe391('0x99')](_0x37b101);});return Promise[_0xe391('0x45')](_0xf278a);}}}})['then'](function(){if(_0x419958){return db[_0xe391('0xea')][_0xe391('0x7a')]({'where':{'membername':_0x419958[_0xe391('0x2a')],'exitAt':null}});}})[_0xe391('0x1a')](function(_0x26535b){if(_0x419958){var _0x165f4d=[];_0x26535b[_0xe391('0xeb')](function(_0x398ac3){_0x165f4d[_0xe391('0x3f')](_0x398ac3[_0xe391('0xec')]({'exitAt':moment()[_0xe391('0x97')](_0xe391('0xed'))}));});return Promise[_0xe391('0x45')](_0x165f4d);}})[_0xe391('0x1a')](function(){if(_0x419958){var _0x13d078=[];var _0x5856ac=[];var _0xf90bf1=utils['getChannels']();var _0x4a2456={'membername':_0x419958[_0xe391('0x2a')],'interface':_0x400c77,'enterAt':moment()[_0xe391('0x97')](_0xe391('0xed')),'role':_0x419958[_0xe391('0x1b')],'internal':_0x419958[_0xe391('0x53')]};_0xf90bf1[_0xe391('0xeb')](function(_0x3d03da){_0x13d078['push'](_[_0xe391('0x4a')]({'channel':_0x3d03da,'type':_0xe391('0xee'),'data1':_0x58faa4[_0xe391('0x4e')][_0xe391('0xef')],'data2':_0x400c77},_0x4a2456));if(_0x419958[_0xe391('0xe8')]){_0x5856ac[_0xe391('0x3f')](_[_0xe391('0x4a')]({'channel':_0x3d03da,'type':_0xe391('0xf0'),'data1':_0xe391('0xf1')},_0x4a2456));}});return db[_0xe391('0xea')][_0xe391('0x76')](_0x13d078['concat'](_0x5856ac),{'individualHooks':!![]});}})[_0xe391('0x1a')](function(){if(_0x419958){return _0x419958['update']({'online':!![],'lastLoginAt':moment()[_0xe391('0x97')](_0xe391('0xed')),'voicePause':_0x419958[_0xe391('0xe8')]||![],'mailPause':_0x419958['loginInPause']||![],'chatPause':_0x419958['loginInPause']||![],'faxPause':_0x419958[_0xe391('0xe8')]||![],'smsPause':_0x419958[_0xe391('0xe8')]||![],'openchannelPause':_0x419958['loginInPause']||![],'whatsappPause':_0x419958[_0xe391('0xe8')]||![],'pauseType':_0x419958[_0xe391('0xe8')]?_0xe391('0xf1'):null,'interface':_0x400c77,'lastPauseAt':moment()['format'](_0xe391('0xed'))});}})['then'](function(_0x10aa9b){if(_0x58faa4[_0xe391('0xf2')]){return _0x5722f0();}else{return Promise[_0xe391('0xf3')](_0x10aa9b)[_0xe391('0x1a')](respondWithResult(_0x155af9,null));}})[_0xe391('0x46')](handleError(_0x155af9,null));};exports['logout']=function(_0x393b28,_0x2e87b9){var _0xd99f42;return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x393b28[_0xe391('0x47')]['id'],'role':_0xe391('0x1c')},'attributes':['id',_0xe391('0x2a'),'role']})['then'](handleEntityNotFound(_0x2e87b9,null))[_0xe391('0x1a')](function(_0x37a62b){if(_0x37a62b){_0xd99f42=_0x37a62b;return db[_0xe391('0x9d')][_0xe391('0x1e')]({'where':{'membername':_0xd99f42[_0xe391('0x2a')]},'individualHooks':!![]});}})['then'](function(){return db[_0xe391('0xea')]['findAll']({'where':{'membername':_0xd99f42['name'],'exitAt':null}});})[_0xe391('0x1a')](function(_0x8390c3){var _0x188c16=[];_0x8390c3[_0xe391('0xeb')](function(_0x769575){_0x188c16[_0xe391('0x3f')](_0x769575[_0xe391('0xec')]({'exitAt':moment()[_0xe391('0x97')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe391('0x45')](_0x188c16);})[_0xe391('0x1a')](function(){return _0xd99f42[_0xe391('0xec')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe391('0x1a')](respondWithResult(_0x2e87b9,null))[_0xe391('0x46')](handleError(_0x2e87b9,null));};exports[_0xe391('0xf4')]=function(_0x1221a7,_0x509a1e){var _0x56328d;return db[_0xe391('0x9d')][_0xe391('0xec')]({'paused':0x1},{'where':{'UserId':_0x1221a7[_0xe391('0x47')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x1221a7[_0xe391('0x47')]['id'],'role':'agent'},'attributes':['id','name','role',_0xe391('0x53'),_0xe391('0x8c'),_0xe391('0x8b')]});})[_0xe391('0x1a')](handleEntityNotFound(_0x509a1e,null))[_0xe391('0x1a')](function(_0x590b43){if(_0x590b43){_0x56328d=_0x590b43;return db[_0xe391('0xea')]['findAll']({'where':{'membername':_0x56328d[_0xe391('0x2a')],'type':_0xe391('0xf0'),'exitAt':null}});}})[_0xe391('0x1a')](function(_0x3f405c){if(_0x3f405c[_0xe391('0x3e')]){var _0x2be113=moment()[_0xe391('0x97')](_0xe391('0xed'));for(var _0x3e3e51=0x0,_0x460f89=_0x3f405c['length'];_0x3e3e51<_0x460f89;_0x3e3e51++){_0x3f405c[_0x3e3e51][_0xe391('0xf5')]({'exitAt':_0x2be113});}}})[_0xe391('0x1a')](function(){var _0x122643=[];var _0x425a0a=utils[_0xe391('0xf6')]();_0x425a0a[_0xe391('0xeb')](function(_0x118fe2){_0x122643[_0xe391('0x3f')]({'channel':_0x118fe2,'membername':_0x56328d[_0xe391('0x2a')],'interface':_[_0xe391('0x5a')](_0x56328d[_0xe391('0x8c')])?util[_0xe391('0x97')](_0xe391('0x98'),_0x56328d[_0xe391('0x2a')]):_0x56328d['interface'],'type':'PAUSE','enterAt':moment()[_0xe391('0x97')](_0xe391('0xed')),'data1':_0x1221a7['body']['type']||_0xe391('0xf7'),'role':_0x56328d[_0xe391('0x1b')],'internal':_0x56328d[_0xe391('0x53')]});});return db[_0xe391('0xea')][_0xe391('0x76')](_0x122643,{'individualHooks':!![]});})[_0xe391('0x1a')](function(){return _0x56328d['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1221a7[_0xe391('0x4e')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe391('0x97')](_0xe391('0xed'))});})[_0xe391('0x1a')](respondWithResult(_0x509a1e,null))['catch'](handleError(_0x509a1e,null));};exports['unpause']=function(_0x540836,_0x563d58){if(_0x540836['body'][_0xe391('0x8a')]&&!utils['isValidChannel'](_0x540836[_0xe391('0x4e')][_0xe391('0x8a')])){throw new APIBadRequestError(util['format'](_0xe391('0xf8'),_0x540836[_0xe391('0x4e')][_0xe391('0x8a')]));}return db[_0xe391('0x2e')][_0xe391('0x29')]({'where':{'id':_0x540836[_0xe391('0x47')]['id']},'attributes':['id','name',_0xe391('0x1b'),_0xe391('0x53'),_0xe391('0x8c'),_0xe391('0x8b'),_0xe391('0xf9'),_0xe391('0xfa'),_0xe391('0xfb'),'faxPause',_0xe391('0xfc'),_0xe391('0xfd'),_0xe391('0xfe'),_0xe391('0xff'),_0xe391('0x100')]})[_0xe391('0x1a')](function(_0x173c32){if(!_0x173c32){throw new APINotFoundError(util[_0xe391('0x97')]('User\x20with\x20id\x20%s\x20not\x20found',_0x540836[_0xe391('0x47')]['id']));}return _0x173c32['unpause'](_0x540836[_0xe391('0x4e')][_0xe391('0x8a')]);})[_0xe391('0x1a')](respondWithResult(_0x563d58,null))[_0xe391('0x46')](APIHandleError(_0x563d58));};exports[_0xe391('0x101')]=function(_0x49a6bd,_0x3ae4c8){var _0x10e4cd={};var _0x163fc3={};var _0x20d481;var _0x20fd6a;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x49a6bd[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x3ae4c8,null))[_0xe391('0x1a')](function(_0xbef920){if(_0xbef920){_0x20d481=_0xbef920;_0x163fc3['model']=_[_0xe391('0xbd')](db[_0xe391('0x102')]['rawAttributes']);_0x163fc3[_0xe391('0x37')]=_['keys'](_0x49a6bd[_0xe391('0x37')]);_0x163fc3[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x163fc3[_0xe391('0xbc')],_0x163fc3[_0xe391('0x37')]);_0x10e4cd[_0xe391('0x3b')]=_['intersection'](_0x163fc3[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x49a6bd['query'][_0xe391('0xc2')]));_0x10e4cd[_0xe391('0x3b')]=_0x10e4cd[_0xe391('0x3b')][_0xe391('0x3e')]?_0x10e4cd[_0xe391('0x3b')]:_0x163fc3[_0xe391('0xbc')];_0x10e4cd[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x49a6bd[_0xe391('0x37')][_0xe391('0xc4')]);_0x10e4cd[_0xe391('0x36')]=qs[_0xe391('0xc0')](_['pick'](_0x49a6bd[_0xe391('0x37')],_0x163fc3[_0xe391('0xc0')]));if(_0x49a6bd[_0xe391('0x37')][_0xe391('0x24')]){_0x10e4cd[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x10e4cd['where'],{'$or':_[_0xe391('0x26')](_0x10e4cd[_0xe391('0x3b')],function(_0xd8c38a){var _0x3510e9={};_0x3510e9[_0xd8c38a]={'$like':'%'+_0x49a6bd[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x3510e9;})});}_0x10e4cd=_[_0xe391('0x4a')]({},_0x10e4cd,_0x49a6bd['options']);return _0x20d481[_0xe391('0x101')](_0x10e4cd);}})[_0xe391('0x1a')](function(_0x1cd841){if(_0x1cd841){_0x20fd6a=_0x1cd841[_0xe391('0x3e')];if(!_0x49a6bd[_0xe391('0x37')][_0xe391('0xc7')]('nolimit')){_0x10e4cd['limit']=qs[_0xe391('0x15')](_0x49a6bd[_0xe391('0x37')][_0xe391('0x15')]);_0x10e4cd[_0xe391('0x18')]=qs[_0xe391('0x18')](_0x49a6bd[_0xe391('0x37')][_0xe391('0x18')]);}return _0x20d481['getTeams'](_0x10e4cd);}})[_0xe391('0x1a')](function(_0x116499){if(_0x116499){return _0x116499?{'count':_0x20fd6a,'rows':_0x116499}:null;}})[_0xe391('0x1a')](respondWithResult(_0x3ae4c8,null))['catch'](handleError(_0x3ae4c8,null));};exports[_0xe391('0x103')]=function(_0x233c0e,_0x451f79){var _0x2af63c=_0x233c0e['params']['id'];var _0x1bcd37=_0x233c0e[_0xe391('0x4e')]?_0x233c0e[_0xe391('0x4e')][_0xe391('0x51')]:null;var _0x174d61=[];return Promise[_0xe391('0xf3')]()['then'](function(){if(!_0x1bcd37)throw new APIBadRequestError(_0xe391('0x104'));})['then'](function(){return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x2af63c}});})[_0xe391('0x1a')](function(_0x231549){if(!_0x231549)throw new APINotFoundError(util[_0xe391('0x97')](_0xe391('0xb5'),_0x233c0e[_0xe391('0x47')]['id']));return db[_0xe391('0x5d')][_0xe391('0x105')](function(_0x973d2e){return _0x231549[_0xe391('0x103')](_0x1bcd37,{'transaction':_0x973d2e})['then'](function(){return db[_0xe391('0x102')]['findAll']({'where':{'id':{'$in':_0x1bcd37}}});})[_0xe391('0x1a')](function(_0x157c05){var _0x32f4ee=_[_0xe391('0x26')](_0x157c05,function(_0x1da188){return _0x1da188['getAssociatedQueues']();});return Promise['all'](_0x32f4ee);})[_0xe391('0x1a')](function(_0x194515){_0x174d61=_[_0xe391('0x106')](_0x194515);var _0x3dff5c=_[_0xe391('0x26')](_0x174d61,function(_0x51d6e0){return _0x51d6e0['addAgent'](_0x231549['id'],{'transaction':_0x973d2e});});return Promise['all'](_0x3dff5c);})[_0xe391('0x1a')](function(){if(!_0x231549['online'])return;var _0xd1cf98=_['filter'](_0x174d61,function(_0x2eddad){return _0x2eddad[_0xe391('0x107')](_0xe391('0x8a'))===_0xe391('0x108');});var _0x431ee0=_['map'](_0xd1cf98,function(_0x16abea){return db[_0xe391('0x9d')][_0xe391('0x99')]({'membername':_0x231549[_0xe391('0x2a')],'UserId':_0x231549['id'],'queue_name':_0x16abea[_0xe391('0x2a')],'VoiceQueueId':_0x16abea['id'],'interface':_['isNil'](_0x231549[_0xe391('0x8c')])?util[_0xe391('0x97')](_0xe391('0x98'),_0x231549[_0xe391('0x2a')]):_0x231549[_0xe391('0x8c')],'paused':_0x231549[_0xe391('0xf9')]||![],'penalty':_0x231549[_0xe391('0x92')]},{'transaction':_0x973d2e});});return Promise[_0xe391('0x45')](_0x431ee0);})[_0xe391('0x1a')](function(){return db['TeamVoicePrefix'][_0xe391('0x7a')]({'where':{'teamId':{'$in':_0x1bcd37}}});})[_0xe391('0x1a')](function(_0x247166){var _0x2b9a10=_[_0xe391('0x26')](_0x247166,function(_0x367f6a){return db[_0xe391('0x109')][_0xe391('0x6d')]({'UserId':_0x231549['id'],'VoicePrefixId':_0x367f6a[_0xe391('0x10a')]},{'transaction':_0x973d2e});});return Promise['all'](_0x2b9a10);});});})[_0xe391('0x1a')](function(){for(var _0x623ead=0x0;_0x623ead<_0x174d61[_0xe391('0x3e')];_0x623ead++){var _0x3b02c3=_0x174d61[_0x623ead][_0xe391('0x107')]('channel');var _0x469e6c=_0x3b02c3+_0xe391('0x94');socket[_0xe391('0x1d')](_0xe391('0x22')+_0x3b02c3+_0xe391('0x95'),{'UserId':_0x2af63c,['queueField']:_0x174d61[_0x623ead]['id']});}})[_0xe391('0x1a')](respondWithStatusCode(_0x451f79,null))['catch'](APIHandleError(_0x451f79));};exports[_0xe391('0x10b')]=function(_0x43e33c,_0x5a9637){var _0x54ac50=_0x43e33c[_0xe391('0x47')]['id'];var _0x52cdfc=null;if(_0x43e33c['query'][_0xe391('0x51')]){_0x52cdfc=_['isArray'](_0x43e33c[_0xe391('0x37')][_0xe391('0x51')])?_0x43e33c[_0xe391('0x37')][_0xe391('0x51')]:[_0x43e33c[_0xe391('0x37')][_0xe391('0x51')]];}var _0x193e84=[];return Promise[_0xe391('0xf3')]()[_0xe391('0x1a')](function(){if(!_0x52cdfc)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xe391('0x1a')](function(){return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x54ac50}});})[_0xe391('0x1a')](function(_0x6d7d05){if(!_0x6d7d05)throw new APINotFoundError(util[_0xe391('0x97')]('User\x20with\x20id\x20%s\x20not\x20found',_0x43e33c['params']['id']));return db['sequelize'][_0xe391('0x105')](function(_0x2f5c59){return _0x6d7d05[_0xe391('0x10b')](_0x52cdfc,{'transaction':_0x2f5c59})[_0xe391('0x1a')](function(){return db['Team'][_0xe391('0x7a')]({'where':{'id':{'$in':_0x52cdfc}}});})[_0xe391('0x1a')](function(_0x311c1c){var _0x18b763=_['map'](_0x311c1c,function(_0x2a9115){return _0x2a9115[_0xe391('0x10c')]();});return Promise[_0xe391('0x45')](_0x18b763);})[_0xe391('0x1a')](function(_0x48aa4d){_0x193e84=_['flattenDeep'](_0x48aa4d);var _0x71c27a=_[_0xe391('0x26')](_0x193e84,function(_0x594f1a){return _0x594f1a[_0xe391('0x10d')](_0x6d7d05['id'],{'transaction':_0x2f5c59});});return Promise[_0xe391('0x45')](_0x71c27a);})[_0xe391('0x1a')](function(){if(!_0x6d7d05['online'])return;var _0x10aed7=_[_0xe391('0x24')](_0x193e84,function(_0x227085){return _0x227085[_0xe391('0x107')](_0xe391('0x8a'))===_0xe391('0x108');});var _0x3abe7a=_['map'](_0x10aed7,function(_0x14aa24){return db[_0xe391('0x9d')][_0xe391('0x1e')]({'where':{'VoiceQueueId':_0x14aa24['id'],'UserId':_0x6d7d05['id']},'transaction':_0x2f5c59});});return Promise['all'](_0x3abe7a);})[_0xe391('0x1a')](function(){return db[_0xe391('0x10e')][_0xe391('0x7a')]({'where':{'teamId':{'$in':_0x52cdfc}}});})[_0xe391('0x1a')](function(_0xf08b3a){var _0x1ab051=_[_0xe391('0x26')](_0xf08b3a,function(_0x5040ce){return db[_0xe391('0x109')][_0xe391('0x1e')]({'where':{'UserId':_0x6d7d05['id'],'VoicePrefixId':_0x5040ce[_0xe391('0x10a')]}},{'transaction':_0x2f5c59});});return Promise[_0xe391('0x45')](_0x1ab051);});});})[_0xe391('0x1a')](function(){for(var _0x15e2ce=0x0;_0x15e2ce<_0x193e84[_0xe391('0x3e')];_0x15e2ce++){var _0x32145e=_0x193e84[_0x15e2ce][_0xe391('0x107')]('channel');var _0x332af4=_0x32145e+'QueueId';socket[_0xe391('0x1d')]('user'+_0x32145e+_0xe391('0x9c'),{'UserId':_0x54ac50,['queueField']:_0x193e84[_0x15e2ce]['id']});}})['then'](respondWithStatusCode(_0x5a9637,null))[_0xe391('0x46')](APIHandleError(_0x5a9637));};exports[_0xe391('0x10f')]=function(_0x3e6f74,_0x1c6c9d){var _0x1a63fb={};var _0x3336d7={};var _0x4bf6b0;var _0x33afd8;return db['User'][_0xe391('0x86')]({'where':{'id':_0x3e6f74['params']['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x1c6c9d,null))['then'](function(_0x389380){if(_0x389380){_0x4bf6b0=_0x389380;_0x3336d7[_0xe391('0xbc')]=_[_0xe391('0xbd')](db[_0xe391('0x110')][_0xe391('0xbf')]);_0x3336d7[_0xe391('0x37')]=_['keys'](_0x3e6f74[_0xe391('0x37')]);_0x3336d7[_0xe391('0xc0')]=_[_0xe391('0xc1')](_0x3336d7['model'],_0x3336d7['query']);_0x1a63fb[_0xe391('0x3b')]=_[_0xe391('0xc1')](_0x3336d7[_0xe391('0xbc')],qs['fields'](_0x3e6f74[_0xe391('0x37')][_0xe391('0xc2')]));_0x1a63fb[_0xe391('0x3b')]=_0x1a63fb[_0xe391('0x3b')][_0xe391('0x3e')]?_0x1a63fb[_0xe391('0x3b')]:_0x3336d7['model'];_0x1a63fb['order']=qs[_0xe391('0xc4')](_0x3e6f74[_0xe391('0x37')][_0xe391('0xc4')]);_0x1a63fb['where']=qs['filters'](_[_0xe391('0xc5')](_0x3e6f74[_0xe391('0x37')],_0x3336d7[_0xe391('0xc0')]));if(_0x3e6f74[_0xe391('0x37')]['filter']){_0x1a63fb[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x1a63fb['where'],{'$or':_[_0xe391('0x26')](_0x1a63fb[_0xe391('0x3b')],function(_0x158d03){var _0x169caa={};_0x169caa[_0x158d03]={'$like':'%'+_0x3e6f74[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x169caa;})});}_0x1a63fb=_[_0xe391('0x4a')]({},_0x1a63fb,_0x3e6f74[_0xe391('0x4b')]);return _0x4bf6b0[_0xe391('0x10f')](_0x1a63fb);}})['then'](function(_0x37dabb){if(_0x37dabb){_0x33afd8=_0x37dabb[_0xe391('0x3e')];if(!_0x3e6f74[_0xe391('0x37')][_0xe391('0xc7')](_0xe391('0xc8'))){_0x1a63fb['limit']=qs[_0xe391('0x15')](_0x3e6f74[_0xe391('0x37')][_0xe391('0x15')]);_0x1a63fb[_0xe391('0x18')]=qs['offset'](_0x3e6f74[_0xe391('0x37')][_0xe391('0x18')]);}return _0x4bf6b0[_0xe391('0x10f')](_0x1a63fb);}})[_0xe391('0x1a')](function(_0x2f0722){if(_0x2f0722){return _0x2f0722?{'count':_0x33afd8,'rows':_0x2f0722}:null;}})[_0xe391('0x1a')](respondWithResult(_0x1c6c9d,null))[_0xe391('0x46')](handleError(_0x1c6c9d,null));};exports[_0xe391('0x111')]=function(_0x28feca,_0x19ab35){var _0x432a9b={};var _0x475d4a={};var _0x2332e8;return db[_0xe391('0x2e')][_0xe391('0x86')]({'where':{'id':_0x28feca[_0xe391('0x47')]['id']}})[_0xe391('0x1a')](handleEntityNotFound(_0x19ab35,null))[_0xe391('0x1a')](function(_0x41249e){if(_0x41249e){_0x2332e8=_0x41249e;_0x475d4a['model']=_[_0xe391('0xbd')](db[_0xe391('0x2e')]['rawAttributes']);_0x475d4a[_0xe391('0x37')]=_[_0xe391('0xbd')](_0x28feca[_0xe391('0x37')]);_0x475d4a['filters']=_[_0xe391('0xc1')](_0x475d4a['model'],_0x475d4a[_0xe391('0x37')]);_0x432a9b[_0xe391('0x3b')]=_['intersection'](_0x475d4a[_0xe391('0xbc')],qs[_0xe391('0xc2')](_0x28feca[_0xe391('0x37')][_0xe391('0xc2')]));_0x432a9b['attributes']=_0x432a9b[_0xe391('0x3b')][_0xe391('0x3e')]?_0x432a9b[_0xe391('0x3b')]:_0x475d4a[_0xe391('0xbc')];_0x432a9b[_0xe391('0xc3')]=qs[_0xe391('0xc4')](_0x28feca[_0xe391('0x37')][_0xe391('0xc4')]);_0x432a9b[_0xe391('0x36')]=qs[_0xe391('0xc0')](_['pick'](_0x28feca[_0xe391('0x37')],_0x475d4a[_0xe391('0xc0')]));if(_0x28feca['query']['filter']){_0x432a9b[_0xe391('0x36')]=_[_0xe391('0x4a')](_0x432a9b['where'],{'$or':_[_0xe391('0x26')](_0x432a9b[_0xe391('0x3b')],function(_0x4b4836){var _0x2968a4={};_0x2968a4[_0x4b4836]={'$like':'%'+_0x28feca[_0xe391('0x37')][_0xe391('0x24')]+'%'};return _0x2968a4;})});}_0x432a9b['model']=db[_0xe391('0x2e')];_0x432a9b['as']=_0xe391('0x73');_0x432a9b=_['merge']({},_0x432a9b,_0x28feca[_0xe391('0x4b')]);return _0x2332e8[_0xe391('0xe7')]({'include':[_0x432a9b]});}})[_0xe391('0x1a')](function(_0x5f5357){if(_0x5f5357){var _0x3db20a={},_0x373625=[];for(var _0x5808cd=0x0;_0x5808cd<_0x5f5357['length'];_0x5808cd+=0x1){for(var _0x3c4bd9=0x0,_0x32b061;_0x3c4bd9<_0x5f5357[_0x5808cd]['Agents'][_0xe391('0x3e')];_0x3c4bd9+=0x1){_0x32b061=_0x5f5357[_0x5808cd]['Agents'][_0x3c4bd9]['get']({'plain':!![]});_0x3db20a[_0x32b061['id']]=_0x32b061;}}_0x3db20a=_[_0xe391('0x112')](_0x3db20a);for(var _0x442664=qs[_0xe391('0x18')](_0x28feca[_0xe391('0x37')][_0xe391('0x18')]);_0x442664<_0x3db20a['length']&&_0x373625['length']=_0x5051cc){_0x1b0ad2=_0x5051cc;_0x2f80cd=0xc8;}else{_0x2f80cd=0xce;}_0x3c45d4[_0x2348('0x1e')](_0x2f80cd);return _0x3c45d4[_0x2348('0x1f')]('Content-Range',_0x7fafd7+'-'+_0x1b0ad2+'/'+_0x5051cc)[_0x2348('0x19')](_0xba00db);}return null;};}function saveUpdates(_0x529604){return function(_0x11f4f7){if(_0x11f4f7){return _0x11f4f7[_0x2348('0x20')](_0x529604)[_0x2348('0x21')](function(_0x1c3a62){if(_0x1c3a62[_0x2348('0x22')]===_0x2348('0x23')){socket['emit'](_0x2348('0x24')+_0x1c3a62['id'],_0x1c3a62);}return _0x1c3a62;});}return null;};}function removeEntity(_0x31a963){return function(_0x5d6c06){if(_0x5d6c06){return _0x5d6c06[_0x2348('0x25')]()[_0x2348('0x21')](function(){var _0x208b2b=_0x5d6c06['get']({'plain':!![]});if(_0x208b2b['role']===_0x2348('0x26'))return;var _0x5d8854=[{'name':_0x2348('0x27'),'value':'user','ignore':!![]},{'name':'Agents','value':_0x2348('0x23'),'ignore':![]},{'name':_0x2348('0x28'),'value':_0x2348('0x29'),'ignore':![]}];var _0x210cbb=_(_0x5d8854)[_0x2348('0x2a')](_0x2348('0x2b'))[_0x2348('0x2c')](_0x2348('0x2d'))[_0x2348('0x2d')]();if(_[_0x2348('0x2e')](_0x210cbb,_0x208b2b[_0x2348('0x22')])){return;}var _0x31eb46=_[_0x2348('0x2f')](_0x5d8854,[_0x2348('0x2d'),_0x208b2b['role']])['name'];return db['UserProfileResource'][_0x2348('0x25')]({'where':{'type':_0x31eb46,'resourceId':_0x208b2b['id']}})[_0x2348('0x21')](function(){return _0x5d6c06;});})['then'](function(){_0x31a963[_0x2348('0x1e')](0xcc)[_0x2348('0x30')]();});}};}function handleEntityNotFound(_0x206ed3){return function(_0x3363fc){if(!_0x3363fc){_0x206ed3[_0x2348('0x18')](0x194);}return _0x3363fc;};}function handleError(_0x1fa769,_0x43d50e){_0x43d50e=_0x43d50e||0x1f4;return function(_0x23e81a){logger['error'](_0x23e81a[_0x2348('0x31')]);if(_0x23e81a[_0x2348('0x32')]){delete _0x23e81a[_0x2348('0x32')];}_0x1fa769[_0x2348('0x1e')](_0x43d50e)['send'](_0x23e81a);};}function getUserAttributes(){return _(db[_0x2348('0x33')][_0x2348('0x34')])[_0x2348('0x2c')](function(_0x425940){return{'name':_0x425940['fieldName'],'type':_0x425940['type'][_0x2348('0x35')]};})[_0x2348('0x2a')](function(_0x358750){return![_0x2348('0x36'),_0x2348('0x37'),'previousPasswords',_0x2348('0x38'),'resetPasswordExpires',_0x2348('0x39')][_0x2348('0x2e')](_0x358750['name']);})[_0x2348('0x2d')]();}exports['index']=function(_0x2dc0bd,_0x21ed2f){var _0x59bb3e={},_0x115292={'count':0x0,'rows':[]};var _0x1fb9dc=getUserAttributes();_0x59bb3e=qs[_0x2348('0x3a')](_0x1fb9dc,_0x2dc0bd);var _0x388831={'where':_0x59bb3e['where']};return db['User'][_0x2348('0x1b')](_0x388831)[_0x2348('0x21')](function(_0x3c38fc){_0x115292[_0x2348('0x1b')]=_0x3c38fc;if(_0x2dc0bd[_0x2348('0x3b')][_0x2348('0x3c')]){_0x59bb3e[_0x2348('0x3d')]=[{'all':!![]}];}if(_0x2dc0bd['query'][_0x2348('0x3e')]===_0x2348('0x3f')){_0x59bb3e['include']=[{'model':db[_0x2348('0x40')],'as':_0x2348('0x3e')}];}if(!_[_0x2348('0x2e')](_0x59bb3e['attributes'],'id')){_0x59bb3e['attributes']['push']('id');}return db['User'][_0x2348('0x41')](_0x59bb3e);})['then'](function(_0x360ead){_0x115292[_0x2348('0x42')]=_0x360ead;if(_0x2dc0bd[_0x2348('0x3b')][_0x2348('0x43')]===_0x2348('0x3f')){var _0x4a4891=[];for(var _0x411c8f=0x0;_0x411c8f<_0x115292[_0x2348('0x42')][_0x2348('0x44')];_0x411c8f++){_0x4a4891[_0x2348('0x45')](get_open_tabs('chat',_0x115292['rows'][_0x411c8f][_0x2348('0x46')]));_0x4a4891['push'](get_open_tabs(_0x2348('0x47'),_0x115292[_0x2348('0x42')][_0x411c8f]['dataValues']));_0x4a4891['push'](get_open_tabs(_0x2348('0x48'),_0x115292['rows'][_0x411c8f][_0x2348('0x46')]));_0x4a4891['push'](get_open_tabs('mail',_0x115292[_0x2348('0x42')][_0x411c8f][_0x2348('0x46')]));_0x4a4891[_0x2348('0x45')](get_open_tabs(_0x2348('0x49'),_0x115292[_0x2348('0x42')][_0x411c8f][_0x2348('0x46')]));_0x4a4891['push'](get_open_tabs(_0x2348('0x4a'),_0x115292[_0x2348('0x42')][_0x411c8f]['dataValues']));}return Promise[_0x2348('0x4b')](_0x4a4891)['then'](function(){return _0x115292;});}else{return _0x115292;}})[_0x2348('0x21')](respondWithFilteredResult(_0x21ed2f,_0x59bb3e))[_0x2348('0x4c')](handleError(_0x21ed2f,null));};exports['show']=function(_0x2a3ab0,_0x541f89){var _0x196573=getUserAttributes();_0x2a3ab0[_0x2348('0x3b')]['id']=_0x2a3ab0['params']['id'];var _0x2a4177=qs['getOptions'](_0x196573,_0x2a3ab0);if(_0x2a3ab0[_0x2348('0x3b')][_0x2348('0x3c')]){_0x2a4177[_0x2348('0x3d')]=[{'all':!![]}];}if(_0x2a3ab0['query'][_0x2348('0x3e')]===_0x2348('0x3f')){_0x2a4177[_0x2348('0x3d')]=[{'model':db[_0x2348('0x40')],'as':_0x2348('0x3e')}];}_0x2a4177=_[_0x2348('0x4d')]({},_0x2a4177,_0x2a3ab0[_0x2348('0x4e')]);if(!_[_0x2348('0x2e')](_0x2a4177[_0x2348('0x4f')],'id')){_0x2a4177[_0x2348('0x4f')][_0x2348('0x45')]('id');}return db['User'][_0x2348('0x2f')](_0x2a4177)['then'](handleEntityNotFound(_0x541f89,null))[_0x2348('0x21')](function(_0x1b02ab){var _0x2ced3f=[];values=_0x1b02ab;if(_0x2a3ab0[_0x2348('0x3b')][_0x2348('0x43')]===_0x2348('0x3f')){_0x2ced3f[_0x2348('0x45')](get_open_tabs(_0x2348('0x50'),_0x1b02ab[_0x2348('0x46')]));_0x2ced3f[_0x2348('0x45')](get_open_tabs(_0x2348('0x47'),_0x1b02ab[_0x2348('0x46')]));_0x2ced3f[_0x2348('0x45')](get_open_tabs(_0x2348('0x49'),_0x1b02ab[_0x2348('0x46')]));_0x2ced3f[_0x2348('0x45')](get_open_tabs('whatsapp',_0x1b02ab['dataValues']));_0x2ced3f['push'](get_open_tabs(_0x2348('0x48'),_0x1b02ab['dataValues']));_0x2ced3f['push'](get_open_tabs(_0x2348('0x51'),_0x1b02ab[_0x2348('0x46')]));return Promise[_0x2348('0x4b')](_0x2ced3f);}else{return values;}})[_0x2348('0x21')](function(){return values;})[_0x2348('0x21')](respondWithResult(_0x541f89,null))[_0x2348('0x4c')](handleError(_0x541f89,null));};exports[_0x2348('0x20')]=function(_0x55aa39,_0x1680ef){if(_0x55aa39['body']['id']){delete _0x55aa39[_0x2348('0x52')]['id'];}delete _0x55aa39['body'][_0x2348('0x22')];return db[_0x2348('0x33')]['find']({'where':{'id':_0x55aa39[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x1680ef,null))[_0x2348('0x21')](saveUpdates(_0x55aa39[_0x2348('0x52')],null))['then'](respondWithResult(_0x1680ef,null))[_0x2348('0x4c')](handleError(_0x1680ef,null));};exports[_0x2348('0x54')]=function(_0x536f2a,_0x5ce924){return db[_0x2348('0x33')][_0x2348('0x54')]()[_0x2348('0x21')](respondWithResult(_0x5ce924,null))[_0x2348('0x4c')](handleError(_0x5ce924,null));};exports[_0x2348('0x55')]=function(_0x87c8eb,_0x45d158){return db['User'][_0x2348('0x2f')]({'where':{'id':_0x87c8eb[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x45d158,null))['then'](function(_0x2e5143){if(_0x2e5143){return _0x2e5143[_0x2348('0x55')](_0x87c8eb['body'][_0x2348('0x56')],_[_0x2348('0x57')](_0x87c8eb[_0x2348('0x52')],[_0x2348('0x56'),'id'])||{});}})['then'](respondWithResult(_0x45d158,null))[_0x2348('0x4c')](handleError(_0x45d158,null));};function validateUser(_0x1147a6){return new Promise(function(_0x293931,_0x2d784b){if(_0x1147a6[_0x2348('0x58')])return _0x293931(_0x1147a6);return db['Setting'][_0x2348('0x59')](0x1)[_0x2348('0x21')](function(_0x27ab2d){if(_0x27ab2d[_0x2348('0x5a')])authService[_0x2348('0x5b')](_0x1147a6[_0x2348('0x36')]);db['User']['max'](_0x2348('0x58'))[_0x2348('0x21')](function(_0x1f9ecd){if(_[_0x2348('0x5c')](_0x1f9ecd)){_0x1147a6[_0x2348('0x58')]=_0x27ab2d['min_internal']||0x1;return;}if(_[_0x2348('0x5c')](_0x27ab2d['min_internal'])||_0x27ab2d[_0x2348('0x5d')]===_0x1f9ecd){_0x1147a6[_0x2348('0x58')]=_0x1f9ecd+0x1;return;}if(_0x27ab2d[_0x2348('0x5d')]>_0x1f9ecd){_0x1147a6[_0x2348('0x58')]=_0x27ab2d['min_internal'];return;}return db[_0x2348('0x5e')]['query'](_0x2348('0x5f'),{'type':db['sequelize'][_0x2348('0x60')]['SELECT']})[_0x2348('0x21')](function(_0x3eac08){if(_0x3eac08&&_0x3eac08['length']){for(var _0x47fd63=0x0,_0x5e56b7=_0x3eac08[_0x2348('0x44')];_0x47fd63<_0x5e56b7&&_['isNil'](_0x1147a6[_0x2348('0x58')]);_0x47fd63++){if(_0x27ab2d['min_internal']<=_0x3eac08[_0x47fd63][_0x2348('0x61')]){_0x1147a6[_0x2348('0x58')]=_0x3eac08[_0x47fd63][_0x2348('0x61')];}else if(_0x27ab2d[_0x2348('0x5d')]>_0x3eac08[_0x47fd63][_0x2348('0x61')]&&_0x27ab2d[_0x2348('0x5d')]<=_0x3eac08[_0x47fd63]['to']){_0x1147a6['internal']=_0x27ab2d['min_internal'];}}}if(_['isNil'](_0x1147a6[_0x2348('0x58')])){_0x1147a6[_0x2348('0x58')]=_0x1f9ecd+0x1;}return _0x293931(_0x1147a6);});});})[_0x2348('0x4c')](function(_0xef8d87){_0x2d784b(_0xef8d87);});});}function updateUser(_0x522055){return new Promise(function(_0x1cf0e7,_0x3ea609){try{if(_0x522055[_0x2348('0x62')]){_0x522055['mailbox']=_0x522055['internal'];_0x522055[_0x2348('0x63')]={'mailbox':_0x522055[_0x2348('0x58')],'password':_0x522055['password'],'fullname':_0x522055[_0x2348('0x64')],'email':_0x522055[_0x2348('0x65')]};}if(_0x522055[_0x2348('0x22')]==='agent'){if(!_0x522055[_0x2348('0x66')])_0x522055[_0x2348('0x66')]=[_0x2348('0x67'),_0x2348('0x68'),_0x2348('0x69'),_0x2348('0x6a'),_0x2348('0x6b'),'104','105','106',_0x2348('0x6c'),_0x2348('0x6d'),_0x2348('0x6e'),'100',_0x2348('0x6f'),_0x2348('0x70'),'115'];}_0x1cf0e7(_0x522055);}catch(_0x6ae876){_0x3ea609(_0x6ae876);}});}exports[_0x2348('0x71')]=function(_0x47fc85,_0x46af0b){if(_0x47fc85[_0x2348('0x72')][_0x2348('0x22')]==='agent')throw new Error(_0x2348('0x73'));if(_0x47fc85[_0x2348('0x52')][_0x2348('0x22')]==='user'&&_0x47fc85[_0x2348('0x72')][_0x2348('0x22')]!==_0x2348('0x26')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x47fc85[_0x2348('0x52')][_0x2348('0x22')]===_0x2348('0x26')&&_0x47fc85['user'][_0x2348('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x47fc85[_0x2348('0x52')]])[_0x2348('0x21')](function(){return validateUser(_0x47fc85['body']);})[_0x2348('0x21')](function(_0x329e58){return updateUser(_0x329e58)[_0x2348('0x21')](function(_0x4c3a92){if(_0x4c3a92['role']===_0x2348('0x26')){_0x4c3a92[_0x2348('0x74')]=_0x47fc85[_0x2348('0x72')][_0x2348('0x74')];delete _0x4c3a92[_0x2348('0x75')];}return _0x4c3a92;});})[_0x2348('0x21')](function(_0x3360b7){return db[_0x2348('0x33')]['create'](_0x3360b7,{'include':[{'model':db[_0x2348('0x63')],'as':'VoiceMail'}]});})['then'](function(_0x121c30){if(_0x47fc85['body']['role']==='user')return _0x121c30;if(_0x47fc85[_0x2348('0x72')]['role']!==_0x2348('0x72'))return _0x121c30;return db[_0x2348('0x76')][_0x2348('0x2f')]({'where':{'name':_0x121c30[_0x2348('0x22')]==='agent'?_0x2348('0x77'):_0x2348('0x28'),'userProfileId':_0x47fc85['user'][_0x2348('0x75')]},'raw':!![]})[_0x2348('0x21')](function(_0x334bed){if(!_0x334bed||_0x334bed[_0x2348('0x78')]!=0x0)return _0x121c30;return db[_0x2348('0x79')][_0x2348('0x71')]({'name':_0x121c30[_0x2348('0x32')],'resourceId':_0x121c30['id'],'type':_0x334bed[_0x2348('0x32')],'sectionId':_0x334bed['id']},{})['then'](function(){return _0x121c30;});})[_0x2348('0x4c')](function(_0xeb26cf){logger[_0x2348('0x7a')](_0x2348('0x7b'),_0xeb26cf);throw _0xeb26cf;});})[_0x2348('0x21')](respondWithResult(_0x46af0b,0xc9))['catch'](handleError(_0x46af0b,null));};exports[_0x2348('0x7c')]=function(_0x1af861,_0x2a035b){var _0x56c737=_0x1af861[_0x2348('0x52')];var _0x4a1ad7=[];if(_0x1af861['user'][_0x2348('0x22')]===_0x2348('0x23'))throw new Error('Unauthorized');if(_[_0x2348('0x7d')](_0x56c737,[_0x2348('0x22'),_0x2348('0x72')])&&_0x1af861[_0x2348('0x72')][_0x2348('0x22')]!=='admin'){throw new Error(_0x2348('0x7e'));}if(_[_0x2348('0x7d')](_0x56c737,[_0x2348('0x22'),_0x2348('0x26')])&&_0x1af861['user'][_0x2348('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x2348('0x7f')](_0x56c737)['then'](function(){return validateUser(_0x56c737[0x0]);})['then'](function(){for(var _0x1feb7b=0x1;_0x1feb7b<_0x56c737[_0x2348('0x44')];_0x1feb7b++){var _0x5d39aa=_0x56c737[_0x1feb7b-0x1]['internal'];if(!_0x56c737[_0x1feb7b]['internal'])_0x56c737[_0x1feb7b][_0x2348('0x58')]=_0x5d39aa+0x1;_0x4a1ad7['push'](validateUser(_0x56c737[_0x1feb7b]));}return Promise[_0x2348('0x4b')](_0x4a1ad7);})['then'](function(){_0x4a1ad7=[];for(var _0x48597f=0x0;_0x48597f<_0x56c737[_0x2348('0x44')];_0x48597f++){_0x4a1ad7[_0x2348('0x45')](updateUser(_0x56c737[_0x48597f]));}return Promise['all'](_0x4a1ad7);})[_0x2348('0x21')](function(){_0x4a1ad7=_0x56c737[_0x2348('0x2c')](function(_0xdf1eea){return db[_0x2348('0x33')][_0x2348('0x71')](_0xdf1eea,{'include':[{'model':db[_0x2348('0x63')],'as':_0x2348('0x63')}]})[_0x2348('0x21')](function(_0x44e81a){_0xdf1eea['id']=_0x44e81a['id'];return _0xdf1eea;});});return Promise[_0x2348('0x4b')](_0x4a1ad7);})[_0x2348('0x21')](function(_0x48575c){if(_0x1af861[_0x2348('0x52')][_0x2348('0x22')]===_0x2348('0x72'))return _0x48575c;if(_0x1af861[_0x2348('0x72')][_0x2348('0x22')]!==_0x2348('0x72'))return _0x48575c;var _0x4460d0=_[_0x2348('0x7d')](_0x48575c,function(_0x454646){return _0x454646[_0x2348('0x22')]===_0x2348('0x23')||_0x454646['role']===_0x2348('0x29');});if(!_0x4460d0)return _0x48575c;return db[_0x2348('0x76')][_0x2348('0x41')]({'where':{'name':{'$or':[_0x2348('0x77'),_0x2348('0x28')]},'userProfileId':_0x1af861[_0x2348('0x72')][_0x2348('0x75')]},'raw':!![]})['then'](function(_0x49cd27){if(_[_0x2348('0x80')](_0x49cd27)||!_[_0x2348('0x7d')](_0x49cd27,['autoAssociation',0x0]))return _0x48575c;_0x4a1ad7=[];var _0xac89d4=_(_0x49cd27)[_0x2348('0x2c')](function(_0x1a03c0){if(_0x1a03c0['autoAssociation']===0x1)return;return _0x1a03c0[_0x2348('0x32')]===_0x2348('0x77')?_0x2348('0x23'):'telephone';})[_0x2348('0x81')]()[_0x2348('0x2d')]();for(var _0xb1ba9b=0x0;_0xb1ba9b<_0x48575c[_0x2348('0x44')];_0xb1ba9b++){if(!_[_0x2348('0x2e')](_0xac89d4,_0x48575c[_0xb1ba9b][_0x2348('0x22')]))return;var _0x5a1bdd=_0x48575c[_0xb1ba9b][_0x2348('0x22')]==='agent'?'Agents':_0x2348('0x28');_0x4a1ad7[_0x2348('0x45')](db[_0x2348('0x79')][_0x2348('0x71')]({'name':_0x48575c[_0xb1ba9b][_0x2348('0x32')],'resourceId':_0x48575c[_0xb1ba9b]['id'],'type':_0x5a1bdd,'sectionId':_[_0x2348('0x2f')](_0x49cd27,[_0x2348('0x32'),_0x5a1bdd])['id']},{}));}return Promise[_0x2348('0x4b')](_0x4a1ad7);});})[_0x2348('0x21')](respondWithResult(_0x2a035b,0xc9))[_0x2348('0x4c')](handleError(_0x2a035b,null));};exports[_0x2348('0x82')]=function(_0x207f1c,_0x3dfe27){if(_0x207f1c[_0x2348('0x52')]['id']){delete _0x207f1c[_0x2348('0x52')]['id'];}return db[_0x2348('0x33')]['find']({'where':{'id':_0x207f1c['params']['id']}})['then'](function(_0x1d2fc3){if(!_0x1d2fc3)return null;if(_0x1d2fc3['id']===_0x207f1c[_0x2348('0x72')]['id']){if(!_0x207f1c[_0x2348('0x52')]['oldPassword']||!_0x207f1c[_0x2348('0x52')][_0x2348('0x83')]){throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x1d2fc3[_0x2348('0x86')](_0x207f1c[_0x2348('0x52')]['oldPassword'])){throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))](_0x2348('0x87'));}if(_0x207f1c[_0x2348('0x52')]['oldPassword']===_0x207f1c['body']['newPassword']){throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))](_0x2348('0x88'));}}else if(_0x207f1c['user'][_0x2348('0x22')]===_0x2348('0x26')){if(!_0x207f1c[_0x2348('0x52')][_0x2348('0x83')]){throw new db['Sequelize'][(_0x2348('0x85'))](_0x2348('0x89'));}}else if(_0x207f1c[_0x2348('0x72')][_0x2348('0x22')]==='user'){if(!_0x207f1c['body'][_0x2348('0x83')]){throw new db['Sequelize'][(_0x2348('0x85'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x1d2fc3['role']!==_0x2348('0x23')){throw new db[(_0x2348('0x84'))]['ValidationError']('Unauthorized');}}else{throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))]('Unauthorized');}return _0x1d2fc3;})[_0x2348('0x21')](handleEntityNotFound(_0x3dfe27,null))[_0x2348('0x21')](function(_0x4c69b1){return db[_0x2348('0x8a')]['findOne']({'attributes':['id',_0x2348('0x5a'),'enforcePasswordHistory','passwordHistoryLimit']})[_0x2348('0x21')](function(_0x403cac){if(_0x403cac[_0x2348('0x5a')])authService['validatePasswordPattern'](_0x207f1c['body'][_0x2348('0x83')]);if(!_0x403cac[_0x2348('0x8b')]||!_0x4c69b1[_0x2348('0x8c')])return _0x4c69b1;authService[_0x2348('0x8d')](_0x207f1c['body'][_0x2348('0x83')],_0x4c69b1['previousPasswords'],_0x403cac[_0x2348('0x8e')]);return _0x4c69b1;})[_0x2348('0x21')](saveUpdates({'password':_0x207f1c['body']['newPassword'],'passwordResetAt':_0x207f1c['user']['id']==_0x207f1c['params']['id']?moment():null,'previousPasswords':authService[_0x2348('0x8f')](_0x207f1c[_0x2348('0x52')]['newPassword'],_0x4c69b1[_0x2348('0x8c')])},null));})['then'](respondWithResult(_0x3dfe27,null))[_0x2348('0x4c')](handleError(_0x3dfe27,null));};exports[_0x2348('0x90')]=function(_0x40a9d3,_0x4db59b){var _0x4b8b20=_0x40a9d3['body'][_0x2348('0x91')];return db['User'][_0x2348('0x2f')]({'where':{'id':_0x40a9d3[_0x2348('0x53')]['id']},'attributes':['id',_0x2348('0x32'),_0x2348('0x22'),'online',_0x2348('0x92'),_0x2348('0x93'),'interface']})[_0x2348('0x21')](handleEntityNotFound(_0x4db59b,null))[_0x2348('0x21')](function(_0x5e1476){if(_0x5e1476){if(!utils[_0x2348('0x94')](_0x4b8b20)){throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))](_0x2348('0x95'));}return _0x5e1476[_0x2348('0x96')+_[_0x2348('0x97')](_0x4b8b20[_0x2348('0x98')]())+_0x2348('0x99')](_0x40a9d3[_0x2348('0x52')][_0x2348('0x56')],{'penalty':_0x40a9d3[_0x2348('0x52')][_0x2348('0x9a')]||0x0})[_0x2348('0x9b')](function(_0x367f5b){for(var _0x3ccd28=0x0;_0x3ccd28<_0x40a9d3[_0x2348('0x52')][_0x2348('0x56')]['length'];_0x3ccd28+=0x1){var _0x519c9e={'UserId':Number(_0x40a9d3['params']['id'])};_0x519c9e[_[_0x2348('0x97')](_0x4b8b20[_0x2348('0x98')]())+_0x2348('0x9c')]=Number(_0x40a9d3[_0x2348('0x52')]['ids'][_0x3ccd28]);socket['emit'](_0x2348('0x72')+_[_0x2348('0x97')](_0x4b8b20['toLowerCase']())+_0x2348('0x9d'),_0x519c9e);}return _0x367f5b;})[_0x2348('0x21')](function(){if(_0x4b8b20===_0x2348('0x9e')){return db[_0x2348('0x9f')]['findAll']({'where':{'id':_0x40a9d3['body'][_0x2348('0x56')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x459cf0){var _0x3014a5=_0x5e1476[_0x2348('0xa0')]({'plain':!![]});var _0x30bf35=[];if(_0x4b8b20==='voice'&&_0x3014a5['role']===_0x2348('0x23')&&_0x3014a5['online']){for(let _0x334e45=0x0;_0x334e45<_0x459cf0['length'];_0x334e45+=0x1){_0x30bf35[_0x2348('0x45')]({'membername':_0x3014a5[_0x2348('0x32')],'UserId':_0x3014a5['id'],'queue_name':_0x459cf0[_0x334e45]['name'],'VoiceQueueId':_0x459cf0[_0x334e45]['id'],'interface':_['isNil'](_0x3014a5[_0x2348('0xa1')])?util['format']('SIP/%s',_0x3014a5['name']):_0x3014a5[_0x2348('0xa1')],'paused':_0x3014a5[_0x2348('0x93')]||![],'penalty':_0x40a9d3['body'][_0x2348('0x9a')]||0x0});}return Promise[_0x2348('0x4b')](_0x30bf35['map'](function(_0x11a5fd){return db['UserVoiceQueueRt'][_0x2348('0xa2')](_0x11a5fd);}));}return _0x5e1476;});}})[_0x2348('0x21')](respondWithStatusCode(_0x4db59b,null))[_0x2348('0x4c')](handleError(_0x4db59b,null));};exports['removeQueues']=function(_0x39e8ec,_0x5137bd){var _0x1b5506,_0x28a336;return db['User']['find']({'where':{'id':_0x39e8ec[_0x2348('0x53')]['id']},'attributes':['id',_0x2348('0x32'),_0x2348('0x22')]})[_0x2348('0x21')](handleEntityNotFound(_0x5137bd,null))[_0x2348('0x21')](function(_0x2b403d){if(_0x2b403d){_0x1b5506=_0x2b403d;if(!_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')]||!utils[_0x2348('0x94')](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')])){throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))](_0x2348('0x95'));}return _0x2b403d['remove'+_[_0x2348('0x97')](_0x39e8ec['query'][_0x2348('0x91')]['toLowerCase']())+'Queues'](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x56')]);}})[_0x2348('0x21')](function(_0x287daa){if(_[_0x2348('0xa3')](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x56')])){for(var _0x4abb83=0x0;_0x4abb83<_0x39e8ec[_0x2348('0x3b')][_0x2348('0x56')][_0x2348('0x44')];_0x4abb83+=0x1){_0x28a336={'UserId':Number(_0x39e8ec[_0x2348('0x53')]['id'])};_0x28a336[_[_0x2348('0x97')](_0x39e8ec['query'][_0x2348('0x91')][_0x2348('0x98')]())+_0x2348('0x9c')]=Number(_0x39e8ec[_0x2348('0x3b')]['ids'][_0x4abb83]);socket[_0x2348('0xa4')](_0x2348('0x72')+_[_0x2348('0x97')](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')][_0x2348('0x98')]())+'Queue:remove',_0x28a336);}}else{_0x28a336={'UserId':Number(_0x39e8ec[_0x2348('0x53')]['id'])};_0x28a336[_[_0x2348('0x97')](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')][_0x2348('0x98')]())+_0x2348('0x9c')]=Number(_0x39e8ec[_0x2348('0x3b')]['ids']);socket[_0x2348('0xa4')](_0x2348('0x72')+_[_0x2348('0x97')](_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')]['toLowerCase']())+'Queue:remove',_0x28a336);}return _0x287daa;})[_0x2348('0x21')](function(){if(_0x39e8ec[_0x2348('0x3b')][_0x2348('0x91')]===_0x2348('0x9e')){return db[_0x2348('0xa5')][_0x2348('0x25')]({'where':{'UserId':_0x39e8ec[_0x2348('0x53')]['id'],'VoiceQueueId':_0x39e8ec[_0x2348('0x3b')][_0x2348('0x56')]},'individualHooks':!![]})[_0x2348('0x21')](function(){return _0x1b5506;});}return _0x1b5506;})[_0x2348('0x21')](respondWithStatusCode(_0x5137bd,null))[_0x2348('0x4c')](handleError(_0x5137bd,null));};exports['addAvatar']=function(_0x4e487e,_0x5156ba){_0x4e487e[_0x2348('0x52')]['userpic']=_0x4e487e[_0x2348('0xa6')]['filename'];return db[_0x2348('0x33')][_0x2348('0x2f')]({'where':{'id':_0x4e487e[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x5156ba,null))['then'](saveUpdates(_0x4e487e[_0x2348('0x52')],null))['then'](respondWithResult(_0x5156ba,null))[_0x2348('0x4c')](handleError(_0x5156ba,null));};exports[_0x2348('0xa7')]=function(_0x248410,_0x3645ec){var _0x33880f=path['join'](config[_0x2348('0xa8')],_0x2348('0xa9'));return db[_0x2348('0x33')][_0x2348('0x2f')]({'where':{'id':_0x248410[_0x2348('0x53')]['id']},'attributes':['id',_0x2348('0xaa')],'raw':!![]})['then'](handleEntityNotFound(_0x3645ec,null))['then'](function(_0xc0cb9f){if(_0xc0cb9f){if(_[_0x2348('0x5c')](_0xc0cb9f['userpic'])){return _0x3645ec[_0x2348('0xab')](_0x33880f);}else{if(!fs[_0x2348('0xac')](path[_0x2348('0xad')](config[_0x2348('0xa8')],_0x2348('0xae'),_0xc0cb9f[_0x2348('0xaa')]))){return _0x3645ec[_0x2348('0xab')](_0x33880f);}return _0x3645ec[_0x2348('0xab')](path['join'](config[_0x2348('0xa8')],'server/files/images/',_0xc0cb9f[_0x2348('0xaa')]));}}})[_0x2348('0x4c')](handleError(_0x3645ec,null));};exports[_0x2348('0xaf')]=function(_0x4c20be,_0x56b6e0){return db['User'][_0x2348('0x2f')]({'where':{'id':_0x4c20be[_0x2348('0x53')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x56b6e0,null))[_0x2348('0x21')](function(_0x310a46){var _0xea8919=[];values=_0x310a46[_0x2348('0x46')];_0xea8919[_0x2348('0x45')](get_open_tabs(_0x2348('0x50'),_0x310a46[_0x2348('0x46')]));_0xea8919[_0x2348('0x45')](get_open_tabs(_0x2348('0x47'),_0x310a46['dataValues']));_0xea8919[_0x2348('0x45')](get_open_tabs('openchannel',_0x310a46['dataValues']));_0xea8919[_0x2348('0x45')](get_open_tabs(_0x2348('0x4a'),_0x310a46[_0x2348('0x46')]));_0xea8919['push'](get_open_tabs(_0x2348('0x48'),_0x310a46[_0x2348('0x46')]));_0xea8919['push'](get_open_tabs('mail',_0x310a46[_0x2348('0x46')]));return Promise['all'](_0xea8919);})['then'](function(_0x3f0520){if(_0x3f0520){var _0x219127=_['map'](values[_0x2348('0xb0')],function(_0x311963){return{'channel':_0x2348('0xb1'),'id':_0x311963['id'],'createdAt':_0x311963[_0x2348('0xb2')]};});var _0x36d4e1=_['map'](values[_0x2348('0xb3')],function(_0x2166a1){return{'channel':_0x2348('0xb4'),'id':_0x2166a1['id'],'createdAt':_0x2166a1[_0x2348('0xb2')]};});var _0x53639b=_['map'](values[_0x2348('0xb5')],function(_0x177fa6){return{'channel':_0x2348('0xb6'),'id':_0x177fa6['id'],'createdAt':_0x177fa6[_0x2348('0xb2')]};});var _0x579255=_[_0x2348('0x2c')](values[_0x2348('0xb7')],function(_0x14d772){return{'channel':_0x2348('0xb8'),'id':_0x14d772['id'],'createdAt':_0x14d772[_0x2348('0xb2')]};});var _0x2747f7=_[_0x2348('0x2c')](values[_0x2348('0xb9')],function(_0x14da28){return{'channel':_0x2348('0xba'),'id':_0x14da28['id'],'createdAt':_0x14da28[_0x2348('0xb2')]};});var _0x6f367c=_[_0x2348('0x2c')](values[_0x2348('0xbb')],function(_0x1a2978){return{'channel':_0x2348('0xbc'),'id':_0x1a2978['id'],'createdAt':_0x1a2978[_0x2348('0xb2')]};});var _0x445349=_[_0x2348('0xbd')](_0x219127,_0x36d4e1,_0x53639b,_0x579255,_0x2747f7,_0x6f367c);var _0x61fa7c={'count':_0x445349[_0x2348('0x44')],'rows':_0x445349};return _0x61fa7c;}else return null;})['then'](respondWithResult(_0x56b6e0,null))[_0x2348('0x4c')](handleError(_0x56b6e0,null));};exports[_0x2348('0xbe')]=function(_0x163fc4,_0x4afe38){var _0x305c24={};return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x163fc4['params']['id']}})[_0x2348('0x21')](function(_0x578085){if(!_0x578085){throw new APINotFoundError(util['format'](_0x2348('0xc0'),_0x163fc4[_0x2348('0x53')]['id']));}return contacts[_0x2348('0x54')]();})[_0x2348('0x21')](function(_0x102c2b){_0x163fc4['query'][_0x2348('0x33')]=_0x163fc4[_0x2348('0x53')]['id'];_0x305c24=qs['getOptions'](_0x102c2b,_0x163fc4);if(_0x163fc4[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0x3c'))){_0x305c24['include']=[{'model':db[_0x2348('0xc2')],'as':_0x2348('0xc3'),'required':![]},{'model':db['Tag'],'as':_0x2348('0xc4'),'attributes':['id',_0x2348('0x32'),_0x2348('0xc5')],'where':_0x163fc4['query'][_0x2348('0xc6')]?{'id':_0x163fc4[_0x2348('0x3b')][_0x2348('0xc6')]}:undefined,'required':_0x163fc4['query'][_0x2348('0xc6')]?!![]:![]}];}return contacts[_0x2348('0x41')](_0x163fc4[_0x2348('0x3b')],_0x163fc4[_0x2348('0x72')],_0x305c24,_0x102c2b);})['then'](respondWithFilteredResult(_0x4afe38,_0x305c24))[_0x2348('0x4c')](APIHandleError(_0x4afe38));};exports['getQueues']=function(_0x26e8eb,_0x472663){var _0x330e17;var _0x3147c1={};var _0x345be5;return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x26e8eb[_0x2348('0x53')]['id']},'attributes':['id',_0x2348('0x32'),_0x2348('0x22')]})[_0x2348('0x21')](handleEntityNotFound(_0x472663,null))[_0x2348('0x21')](function(_0x4aa8a5){if(!utils[_0x2348('0x94')](_0x26e8eb['query']['channel'])){throw new db['Sequelize']['ValidationError'](_0x2348('0x95'));}_0x330e17=_0x4aa8a5;var _0x443748={};_0x443748[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_[_0x2348('0x97')](_0x26e8eb['query']['channel'])+_0x2348('0xc9')][_0x2348('0x34')]);_0x443748[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x26e8eb[_0x2348('0x3b')]);_0x443748[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x443748[_0x2348('0xc7')],_0x443748[_0x2348('0x3b')]);_0x3147c1['attributes']=_[_0x2348('0xcb')](_0x443748['model'],qs[_0x2348('0xcc')](_0x26e8eb[_0x2348('0x3b')][_0x2348('0xcc')]));_0x3147c1[_0x2348('0x4f')]=_0x3147c1[_0x2348('0x4f')][_0x2348('0x44')]?_0x3147c1['attributes']:_0x443748[_0x2348('0xc7')];_0x3147c1[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x26e8eb[_0x2348('0x3b')][_0x2348('0xce')]);_0x3147c1[_0x2348('0xcf')]=qs['filters'](_[_0x2348('0xd0')](_0x26e8eb['query'],_0x443748[_0x2348('0xca')]));if(_0x26e8eb[_0x2348('0x3b')][_0x2348('0x2a')]){_0x3147c1['where']=_[_0x2348('0x4d')](_0x3147c1[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x3147c1['attributes'],function(_0x331781){var _0x37309c={};_0x37309c[_0x331781]={'$like':'%'+_0x26e8eb[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x37309c;})});}_0x3147c1=_[_0x2348('0x4d')]({},_0x3147c1,_0x26e8eb[_0x2348('0x4e')]);switch(_0x330e17[_0x2348('0x22')]){case _0x2348('0x26'):return db[_['capitalize'](_0x26e8eb[_0x2348('0x3b')]['channel'])+'Queue'][_0x2348('0x41')](_0x3147c1);case _0x2348('0x72'):case'agent':return _0x330e17[_0x2348('0xa0')+_[_0x2348('0x97')](_0x26e8eb[_0x2348('0x3b')][_0x2348('0x91')])+_0x2348('0x99')](_0x3147c1);default:throw new db[(_0x2348('0x84'))][(_0x2348('0x85'))](_0x2348('0xd1'));}})['then'](function(_0x1a1918){_0x345be5=_0x1a1918['length'];if(!_0x26e8eb[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0xd2'))){_0x3147c1[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x26e8eb[_0x2348('0x3b')]['limit']);_0x3147c1[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x26e8eb[_0x2348('0x3b')]['offset']);}switch(_0x330e17[_0x2348('0x22')]){case _0x2348('0x26'):return db[_[_0x2348('0x97')](_0x26e8eb['query'][_0x2348('0x91')])+_0x2348('0xc9')]['findAll'](_0x3147c1);case _0x2348('0x72'):case'agent':return _0x330e17[_0x2348('0xa0')+_['capitalize'](_0x26e8eb['query'][_0x2348('0x91')])+_0x2348('0x99')](_0x3147c1);}})['then'](function(_0x16dd54){return{'count':_0x345be5,'rows':_0x16dd54};})['then'](respondWithResult(_0x472663,null))[_0x2348('0x4c')](handleError(_0x472663,null));};exports[_0x2348('0xd3')]=function(_0x232aeb,_0x3aab0b){var _0x586f74={};var _0x5bb56f={};var _0x5cf016;var _0x3c1316;return db['User'][_0x2348('0xbf')]({'where':{'id':_0x232aeb[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x3aab0b,null))[_0x2348('0x21')](function(_0x272277){if(_0x272277){_0x5cf016=_0x272277;_0x5bb56f[_0x2348('0xc7')]=_[_0x2348('0xc8')](db['UserVoiceQueueRt'][_0x2348('0x34')]);_0x5bb56f[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x232aeb[_0x2348('0x3b')]);_0x5bb56f[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x5bb56f[_0x2348('0xc7')],_0x5bb56f[_0x2348('0x3b')]);_0x586f74['attributes']=_['intersection'](_0x5bb56f[_0x2348('0xc7')],qs[_0x2348('0xcc')](_0x232aeb[_0x2348('0x3b')][_0x2348('0xcc')]));_0x586f74[_0x2348('0x4f')]=_0x586f74[_0x2348('0x4f')][_0x2348('0x44')]?_0x586f74[_0x2348('0x4f')]:_0x5bb56f['model'];_0x586f74[_0x2348('0xcd')]=qs['sort'](_0x232aeb[_0x2348('0x3b')][_0x2348('0xce')]);_0x586f74[_0x2348('0xcf')]=qs['filters'](_[_0x2348('0xd0')](_0x232aeb[_0x2348('0x3b')],_0x5bb56f[_0x2348('0xca')]));if(_0x232aeb[_0x2348('0x3b')][_0x2348('0x2a')]){_0x586f74[_0x2348('0xcf')]=_['merge'](_0x586f74[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x586f74[_0x2348('0x4f')],function(_0x1dc4a7){var _0x2e1912={};_0x2e1912[_0x1dc4a7]={'$like':'%'+_0x232aeb[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x2e1912;})});}_0x586f74=_['merge']({},_0x586f74,_0x232aeb[_0x2348('0x4e')]);return _0x5cf016[_0x2348('0xd3')](_0x586f74);}})[_0x2348('0x21')](function(_0x13d559){if(_0x13d559){_0x3c1316=_0x13d559[_0x2348('0x44')];if(!_0x232aeb[_0x2348('0x3b')]['hasOwnProperty'](_0x2348('0xd2'))){_0x586f74[_0x2348('0x1d')]=qs['limit'](_0x232aeb[_0x2348('0x3b')][_0x2348('0x1d')]);_0x586f74[_0x2348('0x1c')]=qs['offset'](_0x232aeb[_0x2348('0x3b')][_0x2348('0x1c')]);}return _0x5cf016['getVoiceQueuesRt'](_0x586f74);}})[_0x2348('0x21')](function(_0x3e5648){if(_0x3e5648){return _0x3e5648?{'count':_0x3c1316,'rows':_0x3e5648}:null;}})['then'](respondWithResult(_0x3aab0b,null))[_0x2348('0x4c')](handleError(_0x3aab0b,null));};exports[_0x2348('0xd4')]=function(_0x3d6446,_0x1a3204){var _0x30e30b={};var _0x4a66d3={};var _0x2455fc;var _0xc0499b;return db['User'][_0x2348('0xbf')]({'where':{'id':_0x3d6446[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a3204,null))['then'](function(_0x5b919f){if(_0x5b919f){_0x2455fc=_0x5b919f;_0x4a66d3[_0x2348('0xc7')]=_[_0x2348('0xc8')](db['ChatGroup'][_0x2348('0x34')]);_0x4a66d3[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x3d6446[_0x2348('0x3b')]);_0x4a66d3[_0x2348('0xca')]=_['intersection'](_0x4a66d3[_0x2348('0xc7')],_0x4a66d3[_0x2348('0x3b')]);_0x30e30b[_0x2348('0x4f')]=_['intersection'](_0x4a66d3[_0x2348('0xc7')],qs['fields'](_0x3d6446['query'][_0x2348('0xcc')]));_0x30e30b[_0x2348('0x4f')]=_0x30e30b[_0x2348('0x4f')][_0x2348('0x44')]?_0x30e30b[_0x2348('0x4f')]:_0x4a66d3[_0x2348('0xc7')];_0x30e30b[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x3d6446[_0x2348('0x3b')][_0x2348('0xce')]);_0x30e30b[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x3d6446[_0x2348('0x3b')],_0x4a66d3['filters']));if(_0x3d6446[_0x2348('0x3b')][_0x2348('0x2a')]){_0x30e30b[_0x2348('0xcf')]=_['merge'](_0x30e30b['where'],{'$or':_[_0x2348('0x2c')](_0x30e30b[_0x2348('0x4f')],function(_0x49d960){var _0x323aa6={};_0x323aa6[_0x49d960]={'$like':'%'+_0x3d6446[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x323aa6;})});}_0x30e30b=_['merge']({},_0x30e30b,_0x3d6446['options']);return _0x2455fc[_0x2348('0xd4')](_0x30e30b);}})[_0x2348('0x21')](function(_0x1a3d41){if(_0x1a3d41){_0xc0499b=_0x1a3d41[_0x2348('0x44')];if(!_0x3d6446['query'][_0x2348('0xc1')](_0x2348('0xd2'))){_0x30e30b['limit']=qs[_0x2348('0x1d')](_0x3d6446['query'][_0x2348('0x1d')]);_0x30e30b[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x3d6446[_0x2348('0x3b')][_0x2348('0x1c')]);}return _0x2455fc[_0x2348('0xd4')](_0x30e30b);}})[_0x2348('0x21')](function(_0x18efb4){if(_0x18efb4){return _0x18efb4?{'count':_0xc0499b,'rows':_0x18efb4}:null;}})['then'](respondWithResult(_0x1a3204,null))[_0x2348('0x4c')](handleError(_0x1a3204,null));};exports[_0x2348('0xd5')]=function(_0x356b95,_0x49284e){var _0x3b0ef3={'raw':!![],'where':{}};var _0x178c83={};var _0xa6b806={'count':0x0,'rows':[]};return db['User'][_0x2348('0xbf')]({'where':{'id':_0x356b95[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x49284e,null))[_0x2348('0x21')](function(_0x2bef8d){if(_0x2bef8d){_0x178c83[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xd6')][_0x2348('0x34')]);_0x178c83[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x356b95[_0x2348('0x3b')]);_0x178c83[_0x2348('0xca')]=_['intersection'](_0x178c83[_0x2348('0xc7')],_0x178c83[_0x2348('0x3b')]);_0x3b0ef3[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x178c83['model'],qs[_0x2348('0xcc')](_0x356b95[_0x2348('0x3b')][_0x2348('0xcc')]));_0x3b0ef3[_0x2348('0x4f')]=_0x3b0ef3[_0x2348('0x4f')][_0x2348('0x44')]?_0x3b0ef3[_0x2348('0x4f')]:_0x178c83[_0x2348('0xc7')];if(!_0x356b95[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0xd2'))){_0x3b0ef3['limit']=qs[_0x2348('0x1d')](_0x356b95[_0x2348('0x3b')][_0x2348('0x1d')]);_0x3b0ef3[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x356b95['query']['offset']);}_0x3b0ef3['order']=qs[_0x2348('0xce')](_0x356b95['query'][_0x2348('0xce')]);_0x3b0ef3['where']=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x356b95[_0x2348('0x3b')],_0x178c83[_0x2348('0xca')]));_0x3b0ef3['where']['UserId']=_0x2bef8d['id'];if(_0x356b95[_0x2348('0x3b')][_0x2348('0x2a')]){_0x3b0ef3[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x3b0ef3[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x3b0ef3[_0x2348('0x4f')],function(_0x47ccb0){var _0x45873e={};_0x45873e[_0x47ccb0]={'$like':'%'+_0x356b95[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x45873e;})});}_0x3b0ef3=_[_0x2348('0x4d')]({},_0x3b0ef3,_0x356b95[_0x2348('0x4e')]);return db[_0x2348('0xd6')]['count']({'where':_0x3b0ef3[_0x2348('0xcf')]})['then'](function(_0x1f6f6d){_0xa6b806[_0x2348('0x1b')]=_0x1f6f6d;if(_0x356b95[_0x2348('0x3b')][_0x2348('0x3c')]){_0x3b0ef3['include']=[{'all':!![]}];}return db[_0x2348('0xd6')]['findAll'](_0x3b0ef3);})[_0x2348('0x21')](function(_0x4719d6){_0xa6b806[_0x2348('0x42')]=_0x4719d6;return _0xa6b806;});}})[_0x2348('0x21')](respondWithFilteredResult(_0x49284e,_0x3b0ef3))[_0x2348('0x4c')](handleError(_0x49284e,null));};exports[_0x2348('0xd7')]=function(_0x1a941e,_0x1468e9){var _0x5ddd01={'raw':!![],'where':{}};var _0x2ec03a={};var _0x2d9b93={'count':0x0,'rows':[]};return db['User'][_0x2348('0xbf')]({'where':{'id':_0x1a941e[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x1468e9,null))[_0x2348('0x21')](function(_0x30094e){if(_0x30094e){_0x2ec03a[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xd8')][_0x2348('0x34')]);_0x2ec03a[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x1a941e['query']);_0x2ec03a['filters']=_[_0x2348('0xcb')](_0x2ec03a[_0x2348('0xc7')],_0x2ec03a[_0x2348('0x3b')]);_0x5ddd01[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x2ec03a[_0x2348('0xc7')],qs['fields'](_0x1a941e[_0x2348('0x3b')][_0x2348('0xcc')]));_0x5ddd01[_0x2348('0x4f')]=_0x5ddd01['attributes'][_0x2348('0x44')]?_0x5ddd01[_0x2348('0x4f')]:_0x2ec03a['model'];if(!_0x1a941e[_0x2348('0x3b')][_0x2348('0xc1')]('nolimit')){_0x5ddd01[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x1a941e[_0x2348('0x3b')]['limit']);_0x5ddd01[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x1a941e[_0x2348('0x3b')][_0x2348('0x1c')]);}_0x5ddd01[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x1a941e[_0x2348('0x3b')][_0x2348('0xce')]);_0x5ddd01[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x1a941e[_0x2348('0x3b')],_0x2ec03a['filters']));_0x5ddd01[_0x2348('0xcf')][_0x2348('0xd9')]=_0x30094e['id'];if(_0x1a941e[_0x2348('0x3b')][_0x2348('0x2a')]){_0x5ddd01[_0x2348('0xcf')]=_['merge'](_0x5ddd01['where'],{'$or':_[_0x2348('0x2c')](_0x5ddd01[_0x2348('0x4f')],function(_0x42e5a0){var _0xe75b80={};_0xe75b80[_0x42e5a0]={'$like':'%'+_0x1a941e[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0xe75b80;})});}_0x5ddd01=_[_0x2348('0x4d')]({},_0x5ddd01,_0x1a941e[_0x2348('0x4e')]);return db[_0x2348('0xd8')]['count']({'where':_0x5ddd01[_0x2348('0xcf')]})['then'](function(_0x43f199){_0x2d9b93[_0x2348('0x1b')]=_0x43f199;if(_0x1a941e['query'][_0x2348('0x3c')]){_0x5ddd01['include']=[{'all':!![]}];}return db[_0x2348('0xd8')][_0x2348('0x41')](_0x5ddd01);})[_0x2348('0x21')](function(_0x2071b1){_0x2d9b93[_0x2348('0x42')]=_0x2071b1;return _0x2d9b93;});}})[_0x2348('0x21')](respondWithFilteredResult(_0x1468e9,_0x5ddd01))[_0x2348('0x4c')](handleError(_0x1468e9,null));};exports[_0x2348('0xda')]=function(_0x4d45c6,_0x12d26a){var _0x4bd754={};var _0x4b1a59={};var _0x4e60fb;var _0x59cd51;return db[_0x2348('0x33')]['findOne']({'where':{'id':_0x4d45c6[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x12d26a,null))[_0x2348('0x21')](function(_0x4463ad){if(_0x4463ad){_0x4e60fb=_0x4463ad;_0x4b1a59[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xdb')]['rawAttributes']);_0x4b1a59[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x4d45c6[_0x2348('0x3b')]);_0x4b1a59[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x4b1a59['model'],_0x4b1a59[_0x2348('0x3b')]);_0x4bd754['attributes']=_[_0x2348('0xcb')](_0x4b1a59[_0x2348('0xc7')],qs['fields'](_0x4d45c6[_0x2348('0x3b')][_0x2348('0xcc')]));_0x4bd754['attributes']=_0x4bd754[_0x2348('0x4f')][_0x2348('0x44')]?_0x4bd754[_0x2348('0x4f')]:_0x4b1a59[_0x2348('0xc7')];_0x4bd754[_0x2348('0xcd')]=qs['sort'](_0x4d45c6['query'][_0x2348('0xce')]);_0x4bd754[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x4d45c6[_0x2348('0x3b')],_0x4b1a59[_0x2348('0xca')]));if(_0x4d45c6[_0x2348('0x3b')][_0x2348('0x2a')]){_0x4bd754['where']=_[_0x2348('0x4d')](_0x4bd754[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x4bd754[_0x2348('0x4f')],function(_0x140e6e){var _0x2f7a99={};_0x2f7a99[_0x140e6e]={'$like':'%'+_0x4d45c6[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x2f7a99;})});}_0x4bd754=_[_0x2348('0x4d')]({},_0x4bd754,_0x4d45c6[_0x2348('0x4e')]);return _0x4e60fb['getChatInteractions'](_0x4bd754);}})[_0x2348('0x21')](function(_0x2c70cc){if(_0x2c70cc){_0x59cd51=_0x2c70cc[_0x2348('0x44')];if(!_0x4d45c6[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0xd2'))){_0x4bd754[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x4d45c6[_0x2348('0x3b')][_0x2348('0x1d')]);_0x4bd754[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x4d45c6['query'][_0x2348('0x1c')]);}return _0x4e60fb['getChatInteractions'](_0x4bd754);}})['then'](function(_0x5364f6){if(_0x5364f6){return _0x5364f6?{'count':_0x59cd51,'rows':_0x5364f6}:null;}})[_0x2348('0x21')](respondWithResult(_0x12d26a,null))['catch'](handleError(_0x12d26a,null));};exports[_0x2348('0xdc')]=function(_0x1f2fb1,_0x322c6f){var _0x561d6d={};var _0x2a75f2={};var _0x40e64c;var _0x1b4b05;return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x1f2fb1[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x322c6f,null))[_0x2348('0x21')](function(_0x2e8d66){if(_0x2e8d66){_0x40e64c=_0x2e8d66;_0x2a75f2[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xdd')]['rawAttributes']);_0x2a75f2[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x1f2fb1[_0x2348('0x3b')]);_0x2a75f2[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x2a75f2[_0x2348('0xc7')],_0x2a75f2[_0x2348('0x3b')]);_0x561d6d[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x2a75f2[_0x2348('0xc7')],qs['fields'](_0x1f2fb1['query']['fields']));_0x561d6d[_0x2348('0x4f')]=_0x561d6d[_0x2348('0x4f')][_0x2348('0x44')]?_0x561d6d[_0x2348('0x4f')]:_0x2a75f2[_0x2348('0xc7')];_0x561d6d[_0x2348('0xcd')]=qs['sort'](_0x1f2fb1['query']['sort']);_0x561d6d[_0x2348('0xcf')]=qs[_0x2348('0xca')](_['pick'](_0x1f2fb1[_0x2348('0x3b')],_0x2a75f2[_0x2348('0xca')]));if(_0x1f2fb1[_0x2348('0x3b')][_0x2348('0x2a')]){_0x561d6d[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x561d6d['where'],{'$or':_[_0x2348('0x2c')](_0x561d6d[_0x2348('0x4f')],function(_0x34e8ad){var _0x5499b1={};_0x5499b1[_0x34e8ad]={'$like':'%'+_0x1f2fb1[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x5499b1;})});}_0x561d6d=_['merge']({},_0x561d6d,_0x1f2fb1['options']);return _0x40e64c[_0x2348('0xdc')](_0x561d6d);}})['then'](function(_0x22a002){if(_0x22a002){_0x1b4b05=_0x22a002[_0x2348('0x44')];if(!_0x1f2fb1[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0xd2'))){_0x561d6d[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x1f2fb1[_0x2348('0x3b')][_0x2348('0x1d')]);_0x561d6d[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x1f2fb1[_0x2348('0x3b')][_0x2348('0x1c')]);}return _0x40e64c[_0x2348('0xdc')](_0x561d6d);}})['then'](function(_0x3e04ac){if(_0x3e04ac){return _0x3e04ac?{'count':_0x1b4b05,'rows':_0x3e04ac}:null;}})[_0x2348('0x21')](respondWithResult(_0x322c6f,null))[_0x2348('0x4c')](handleError(_0x322c6f,null));};exports['getMailInteractions']=function(_0x54221a,_0xd86ba5){var _0x3c32f4={'raw':!![],'where':{}};var _0x3cb02a={};var _0x383b04={'count':0x0,'rows':[]};return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x54221a['params']['id']}})[_0x2348('0x21')](handleEntityNotFound(_0xd86ba5,null))[_0x2348('0x21')](function(_0x49075a){if(_0x49075a){_0x3cb02a[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xde')][_0x2348('0x34')]);_0x3cb02a['query']=_['keys'](_0x54221a[_0x2348('0x3b')]);_0x3cb02a[_0x2348('0xca')]=_['intersection'](_0x3cb02a[_0x2348('0xc7')],_0x3cb02a[_0x2348('0x3b')]);_0x3c32f4[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x3cb02a['model'],qs[_0x2348('0xcc')](_0x54221a[_0x2348('0x3b')][_0x2348('0xcc')]));_0x3c32f4[_0x2348('0x4f')]=_0x3c32f4[_0x2348('0x4f')][_0x2348('0x44')]?_0x3c32f4['attributes']:_0x3cb02a[_0x2348('0xc7')];if(!_0x54221a[_0x2348('0x3b')][_0x2348('0xc1')]('nolimit')){_0x3c32f4[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x54221a[_0x2348('0x3b')][_0x2348('0x1d')]);_0x3c32f4[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x54221a[_0x2348('0x3b')][_0x2348('0x1c')]);}_0x3c32f4[_0x2348('0xcd')]=qs['sort'](_0x54221a[_0x2348('0x3b')][_0x2348('0xce')]);_0x3c32f4['where']=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x54221a[_0x2348('0x3b')],_0x3cb02a[_0x2348('0xca')]));_0x3c32f4[_0x2348('0xcf')][_0x2348('0xd9')]=_0x49075a['id'];if(_0x54221a['query'][_0x2348('0x2a')]){_0x3c32f4['where']=_[_0x2348('0x4d')](_0x3c32f4[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x3c32f4[_0x2348('0x4f')],function(_0x23ae82){var _0x18915e={};_0x18915e[_0x23ae82]={'$like':'%'+_0x54221a['query'][_0x2348('0x2a')]+'%'};return _0x18915e;})});}_0x3c32f4=_[_0x2348('0x4d')]({},_0x3c32f4,_0x54221a[_0x2348('0x4e')]);return db[_0x2348('0xde')]['count']({'where':_0x3c32f4[_0x2348('0xcf')]})[_0x2348('0x21')](function(_0x1ae9e8){_0x383b04[_0x2348('0x1b')]=_0x1ae9e8;if(_0x54221a[_0x2348('0x3b')][_0x2348('0x3c')]){_0x3c32f4[_0x2348('0x3d')]=[{'all':!![]}];}return db['MailInteraction'][_0x2348('0x41')](_0x3c32f4);})[_0x2348('0x21')](function(_0x177af5){_0x383b04[_0x2348('0x42')]=_0x177af5;return _0x383b04;});}})[_0x2348('0x21')](respondWithFilteredResult(_0xd86ba5,_0x3c32f4))[_0x2348('0x4c')](handleError(_0xd86ba5,null));};exports[_0x2348('0xdf')]=function(_0x48bc26,_0x3b84b3){var _0x2dd646={};var _0x374c8d={};var _0x2d424d;var _0x1c80a9;return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x48bc26[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x3b84b3,null))[_0x2348('0x21')](function(_0x3a0c75){if(_0x3a0c75){_0x2d424d=_0x3a0c75;_0x374c8d[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xe0')][_0x2348('0x34')]);_0x374c8d[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x48bc26[_0x2348('0x3b')]);_0x374c8d['filters']=_[_0x2348('0xcb')](_0x374c8d[_0x2348('0xc7')],_0x374c8d[_0x2348('0x3b')]);_0x2dd646[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x374c8d['model'],qs[_0x2348('0xcc')](_0x48bc26[_0x2348('0x3b')][_0x2348('0xcc')]));_0x2dd646['attributes']=_0x2dd646['attributes'][_0x2348('0x44')]?_0x2dd646[_0x2348('0x4f')]:_0x374c8d[_0x2348('0xc7')];_0x2dd646[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x48bc26[_0x2348('0x3b')][_0x2348('0xce')]);_0x2dd646['where']=qs['filters'](_['pick'](_0x48bc26[_0x2348('0x3b')],_0x374c8d['filters']));if(_0x48bc26[_0x2348('0x3b')]['filter']){_0x2dd646[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x2dd646['where'],{'$or':_[_0x2348('0x2c')](_0x2dd646[_0x2348('0x4f')],function(_0xb63478){var _0x20d90e={};_0x20d90e[_0xb63478]={'$like':'%'+_0x48bc26[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x20d90e;})});}_0x2dd646=_[_0x2348('0x4d')]({},_0x2dd646,_0x48bc26[_0x2348('0x4e')]);return _0x2d424d[_0x2348('0xdf')](_0x2dd646);}})[_0x2348('0x21')](function(_0xc668b8){if(_0xc668b8){_0x1c80a9=_0xc668b8['length'];if(!_0x48bc26[_0x2348('0x3b')][_0x2348('0xc1')]('nolimit')){_0x2dd646[_0x2348('0x1d')]=qs['limit'](_0x48bc26[_0x2348('0x3b')][_0x2348('0x1d')]);_0x2dd646[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x48bc26[_0x2348('0x3b')]['offset']);}return _0x2d424d['getSmsInteractions'](_0x2dd646);}})[_0x2348('0x21')](function(_0x4d6127){if(_0x4d6127){return _0x4d6127?{'count':_0x1c80a9,'rows':_0x4d6127}:null;}})[_0x2348('0x21')](respondWithResult(_0x3b84b3,null))[_0x2348('0x4c')](handleError(_0x3b84b3,null));};exports[_0x2348('0xe1')]=function(_0x3477b9,_0x1560cb){var _0x211d83={};var _0x34c04c={};var _0x3fe372;var _0x2bc736;return db[_0x2348('0x33')]['findOne']({'where':{'id':_0x3477b9[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x1560cb,null))['then'](function(_0x9550e){if(_0x9550e){_0x3fe372=_0x9550e;_0x34c04c[_0x2348('0xc7')]=_['keys'](db[_0x2348('0xe2')][_0x2348('0x34')]);_0x34c04c[_0x2348('0x3b')]=_['keys'](_0x3477b9[_0x2348('0x3b')]);_0x34c04c[_0x2348('0xca')]=_['intersection'](_0x34c04c[_0x2348('0xc7')],_0x34c04c[_0x2348('0x3b')]);_0x211d83['attributes']=_[_0x2348('0xcb')](_0x34c04c['model'],qs[_0x2348('0xcc')](_0x3477b9[_0x2348('0x3b')][_0x2348('0xcc')]));_0x211d83[_0x2348('0x4f')]=_0x211d83[_0x2348('0x4f')][_0x2348('0x44')]?_0x211d83[_0x2348('0x4f')]:_0x34c04c[_0x2348('0xc7')];_0x211d83[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x3477b9[_0x2348('0x3b')][_0x2348('0xce')]);_0x211d83[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x3477b9[_0x2348('0x3b')],_0x34c04c[_0x2348('0xca')]));if(_0x3477b9['query'][_0x2348('0x2a')]){_0x211d83[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x211d83[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x211d83[_0x2348('0x4f')],function(_0x169274){var _0x4ee642={};_0x4ee642[_0x169274]={'$like':'%'+_0x3477b9['query'][_0x2348('0x2a')]+'%'};return _0x4ee642;})});}_0x211d83=_['merge']({},_0x211d83,_0x3477b9['options']);return _0x3fe372[_0x2348('0xe1')](_0x211d83);}})[_0x2348('0x21')](function(_0xac6399){if(_0xac6399){_0x2bc736=_0xac6399[_0x2348('0x44')];if(!_0x3477b9['query']['hasOwnProperty'](_0x2348('0xd2'))){_0x211d83[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x3477b9[_0x2348('0x3b')][_0x2348('0x1d')]);_0x211d83[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x3477b9[_0x2348('0x3b')][_0x2348('0x1c')]);}return _0x3fe372['getFaxInteractions'](_0x211d83);}})[_0x2348('0x21')](function(_0x4b3e37){if(_0x4b3e37){return _0x4b3e37?{'count':_0x2bc736,'rows':_0x4b3e37}:null;}})[_0x2348('0x21')](respondWithResult(_0x1560cb,null))['catch'](handleError(_0x1560cb,null));};exports[_0x2348('0xe3')]=function(_0x24b239,_0x287c89){var _0x1295d7={};var _0x5d331d={};var _0x2ae7d6;var _0x5da8fa;return db['User']['findOne']({'where':{'id':_0x24b239[_0x2348('0x53')]['id']}})['then'](handleEntityNotFound(_0x287c89,null))[_0x2348('0x21')](function(_0x24bcb8){if(_0x24bcb8){_0x2ae7d6=_0x24bcb8;_0x5d331d[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xe4')][_0x2348('0x34')]);_0x5d331d[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x24b239[_0x2348('0x3b')]);_0x5d331d[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x5d331d[_0x2348('0xc7')],_0x5d331d['query']);_0x1295d7[_0x2348('0x4f')]=_['intersection'](_0x5d331d[_0x2348('0xc7')],qs[_0x2348('0xcc')](_0x24b239[_0x2348('0x3b')][_0x2348('0xcc')]));_0x1295d7[_0x2348('0x4f')]=_0x1295d7['attributes'][_0x2348('0x44')]?_0x1295d7[_0x2348('0x4f')]:_0x5d331d[_0x2348('0xc7')];_0x1295d7[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x24b239[_0x2348('0x3b')][_0x2348('0xce')]);_0x1295d7[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x24b239[_0x2348('0x3b')],_0x5d331d['filters']));if(_0x24b239[_0x2348('0x3b')]['filter']){_0x1295d7['where']=_[_0x2348('0x4d')](_0x1295d7[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x1295d7['attributes'],function(_0x2b4b05){var _0x5f06c6={};_0x5f06c6[_0x2b4b05]={'$like':'%'+_0x24b239['query'][_0x2348('0x2a')]+'%'};return _0x5f06c6;})});}_0x1295d7=_[_0x2348('0x4d')]({},_0x1295d7,_0x24b239[_0x2348('0x4e')]);return _0x2ae7d6[_0x2348('0xe3')](_0x1295d7);}})['then'](function(_0x57ef1c){if(_0x57ef1c){_0x5da8fa=_0x57ef1c[_0x2348('0x44')];if(!_0x24b239['query'][_0x2348('0xc1')](_0x2348('0xd2'))){_0x1295d7[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x24b239[_0x2348('0x3b')][_0x2348('0x1d')]);_0x1295d7['offset']=qs[_0x2348('0x1c')](_0x24b239[_0x2348('0x3b')][_0x2348('0x1c')]);}return _0x2ae7d6[_0x2348('0xe3')](_0x1295d7);}})['then'](function(_0x586223){if(_0x586223){return _0x586223?{'count':_0x5da8fa,'rows':_0x586223}:null;}})[_0x2348('0x21')](respondWithResult(_0x287c89,null))[_0x2348('0x4c')](handleError(_0x287c89,null));};exports['login']=function(_0x59a4a0,_0xacc007,_0x1269ad){var _0x580107;var _0x30d20e;var _0x361f00;var _0x1e000a=!_[_0x2348('0x5c')](_0x59a4a0[_0x2348('0x53')]['id'])?_0x59a4a0[_0x2348('0x53')]['id']:!_[_0x2348('0x5c')](_0x59a4a0[_0x2348('0x72')]['id'])?_0x59a4a0[_0x2348('0x72')]['id']:null;return db['User'][_0x2348('0x2f')]({'where':{'id':_0x1e000a,'role':{'$or':[_0x2348('0x26'),_0x2348('0x72'),_0x2348('0x23')]}},'attributes':['id',_0x2348('0x32'),_0x2348('0xe5'),_0x2348('0xe6'),_0x2348('0x22'),_0x2348('0x58'),'loginInPause']})[_0x2348('0x21')](function(_0x1a81f1){if(_0x1a81f1){if(_0x1a81f1[_0x2348('0x22')]===_0x2348('0x23')){_0x580107=_0x1a81f1;if(_0x59a4a0[_0x2348('0x52')][_0x2348('0xa1')]){_0x361f00=util[_0x2348('0xe7')]('LOCAL/%s@from-sip/n',_0x580107[_0x59a4a0[_0x2348('0x52')][_0x2348('0xa1')]]);}else if(_0x59a4a0[_0x2348('0x52')][_0x2348('0xe8')]){_0x361f00=util['format'](_0x2348('0xe9'),_0x59a4a0[_0x2348('0x52')]['intrf']);}else{_0x361f00=util[_0x2348('0xe7')]('SIP/%s',_0x580107[_0x2348('0x32')]);}socket['to'](util['format']('user:%s',_0x580107[_0x2348('0x32')]))[_0x2348('0xa4')](_0x2348('0xea'),{'user':{'id':_0x580107['id'],'name':_0x580107[_0x2348('0x32')]},'ip':_0x59a4a0[_0x2348('0xeb')][_0x2348('0xec')]||_0x59a4a0[_0x2348('0xed')][_0x2348('0xee')]||_0x59a4a0[_0x2348('0xef')][_0x2348('0xee')]||_0x59a4a0[_0x2348('0xed')]['socket'][_0x2348('0xee')]});return db['UserVoiceQueueRt'][_0x2348('0x25')]({'where':{'membername':_0x580107[_0x2348('0x32')]},'individualHooks':!![]});}}else{throw new db['Sequelize']['ValidationError']('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2348('0x21')](function(){if(_0x580107){return _0x580107[_0x2348('0xf0')]({'raw':!![]});}})[_0x2348('0x21')](function(_0x28d9fb){if(_0x580107){if(_0x28d9fb){_0x30d20e=_0x28d9fb;if(_0x30d20e[_0x2348('0x44')]){var _0x2e46ae=_0x30d20e[_0x2348('0x2c')](function(_0x391a01){var _0xc53087={'membername':_0x580107['name'],'UserId':_0x580107['id'],'queue_name':_0x391a01[_0x2348('0x32')],'VoiceQueueId':_0x391a01['id'],'interface':_0x361f00,'paused':_0x580107[_0x2348('0x92')]||![],'penalty':_0x391a01[_0x2348('0xf1')]||0x0};return db[_0x2348('0xa5')][_0x2348('0xa2')](_0xc53087);});return Promise[_0x2348('0x4b')](_0x2e46ae);}}}})['then'](function(){if(_0x580107){return db[_0x2348('0xf2')][_0x2348('0x41')]({'where':{'membername':_0x580107[_0x2348('0x32')],'exitAt':null}});}})[_0x2348('0x21')](function(_0x15e92d){if(_0x580107){var _0x5b9fd6=[];_0x15e92d['forEach'](function(_0x147cdc){_0x5b9fd6[_0x2348('0x45')](_0x147cdc['update']({'exitAt':moment()[_0x2348('0xe7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2348('0x4b')](_0x5b9fd6);}})[_0x2348('0x21')](function(){if(_0x580107){var _0x58f175=[];var _0x1fc669=[];var _0x39c74b=utils[_0x2348('0xf3')]();var _0x488205={'membername':_0x580107['name'],'interface':_0x361f00,'enterAt':moment()[_0x2348('0xe7')](_0x2348('0xf4')),'role':_0x580107['role'],'internal':_0x580107['internal']};_0x39c74b[_0x2348('0xf5')](function(_0xed3891){_0x58f175[_0x2348('0x45')](_[_0x2348('0x4d')]({'channel':_0xed3891,'type':_0x2348('0xf6'),'data1':_0x59a4a0[_0x2348('0x52')]['device'],'data2':_0x361f00},_0x488205));if(_0x580107['loginInPause']){_0x1fc669[_0x2348('0x45')](_[_0x2348('0x4d')]({'channel':_0xed3891,'type':_0x2348('0xf7'),'data1':_0x2348('0xf8')},_0x488205));}});return db['MemberReport'][_0x2348('0x7c')](_0x58f175[_0x2348('0xbd')](_0x1fc669),{'individualHooks':!![]});}})[_0x2348('0x21')](function(){if(_0x580107){return _0x580107['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x580107[_0x2348('0x92')]||![],'mailPause':_0x580107[_0x2348('0x92')]||![],'chatPause':_0x580107[_0x2348('0x92')]||![],'faxPause':_0x580107['loginInPause']||![],'smsPause':_0x580107[_0x2348('0x92')]||![],'openchannelPause':_0x580107[_0x2348('0x92')]||![],'whatsappPause':_0x580107['loginInPause']||![],'pauseType':_0x580107[_0x2348('0x92')]?_0x2348('0xf8'):null,'interface':_0x361f00,'lastPauseAt':moment()['format'](_0x2348('0xf4'))});}})[_0x2348('0x21')](function(_0x462621){if(_0x59a4a0[_0x2348('0xf9')]){return _0x1269ad();}else{return Promise[_0x2348('0xfa')](_0x462621)['then'](respondWithResult(_0xacc007,null));}})[_0x2348('0x4c')](handleError(_0xacc007,null));};exports[_0x2348('0xfb')]=function(_0x1874e4,_0xe72a6f){var _0x15f7d9;return db[_0x2348('0x33')]['find']({'where':{'id':_0x1874e4[_0x2348('0x53')]['id'],'role':_0x2348('0x23')},'attributes':['id','name',_0x2348('0x22')]})[_0x2348('0x21')](handleEntityNotFound(_0xe72a6f,null))[_0x2348('0x21')](function(_0x36ab88){if(_0x36ab88){_0x15f7d9=_0x36ab88;return db[_0x2348('0xa5')]['destroy']({'where':{'membername':_0x15f7d9[_0x2348('0x32')]},'individualHooks':!![]});}})[_0x2348('0x21')](function(){return db[_0x2348('0xf2')][_0x2348('0x41')]({'where':{'membername':_0x15f7d9[_0x2348('0x32')],'exitAt':null}});})['then'](function(_0x29bd5b){var _0x112b4d=[];_0x29bd5b[_0x2348('0xf5')](function(_0x5aadf2){_0x112b4d[_0x2348('0x45')](_0x5aadf2['update']({'exitAt':moment()[_0x2348('0xe7')](_0x2348('0xf4'))}));});return Promise[_0x2348('0x4b')](_0x112b4d);})[_0x2348('0x21')](function(){return _0x15f7d9[_0x2348('0x20')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2348('0x21')](respondWithResult(_0xe72a6f,null))['catch'](handleError(_0xe72a6f,null));};exports[_0x2348('0xfc')]=function(_0x5b8f3c,_0x56a52f){var _0x1f0dec;return db['UserVoiceQueueRt'][_0x2348('0x20')]({'paused':0x1},{'where':{'UserId':_0x5b8f3c[_0x2348('0x53')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x2348('0x33')][_0x2348('0x2f')]({'where':{'id':_0x5b8f3c[_0x2348('0x53')]['id'],'role':_0x2348('0x23')},'attributes':['id',_0x2348('0x32'),_0x2348('0x22'),_0x2348('0x58'),_0x2348('0xa1'),_0x2348('0xfd')]});})[_0x2348('0x21')](handleEntityNotFound(_0x56a52f,null))['then'](function(_0x30fbed){if(_0x30fbed){_0x1f0dec=_0x30fbed;return db['MemberReport']['findAll']({'where':{'membername':_0x1f0dec[_0x2348('0x32')],'type':_0x2348('0xf7'),'exitAt':null}});}})[_0x2348('0x21')](function(_0x2e49b7){if(_0x2e49b7[_0x2348('0x44')]){var _0x3f5b3f=moment()[_0x2348('0xe7')](_0x2348('0xf4'));for(var _0x29ce27=0x0,_0x389202=_0x2e49b7[_0x2348('0x44')];_0x29ce27<_0x389202;_0x29ce27++){_0x2e49b7[_0x29ce27][_0x2348('0xfe')]({'exitAt':_0x3f5b3f});}}})['then'](function(){var _0x2ea578=[];var _0x5e6cff=utils[_0x2348('0xf3')]();_0x5e6cff['forEach'](function(_0x12129a){_0x2ea578['push']({'channel':_0x12129a,'membername':_0x1f0dec[_0x2348('0x32')],'interface':_[_0x2348('0x5c')](_0x1f0dec[_0x2348('0xa1')])?util[_0x2348('0xe7')](_0x2348('0xe9'),_0x1f0dec['name']):_0x1f0dec[_0x2348('0xa1')],'type':_0x2348('0xf7'),'enterAt':moment()['format'](_0x2348('0xf4')),'data1':_0x5b8f3c[_0x2348('0x52')]['type']||_0x2348('0xff'),'role':_0x1f0dec['role'],'internal':_0x1f0dec[_0x2348('0x58')]});});return db[_0x2348('0xf2')][_0x2348('0x7c')](_0x2ea578,{'individualHooks':!![]});})[_0x2348('0x21')](function(){return _0x1f0dec[_0x2348('0x20')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5b8f3c[_0x2348('0x52')][_0x2348('0x100')]||_0x2348('0xff'),'lastPauseAt':moment()[_0x2348('0xe7')](_0x2348('0xf4'))});})[_0x2348('0x21')](respondWithResult(_0x56a52f,null))[_0x2348('0x4c')](handleError(_0x56a52f,null));};exports[_0x2348('0x101')]=function(_0x5cb935,_0x3f1024){if(_0x5cb935[_0x2348('0x52')][_0x2348('0x91')]&&!utils[_0x2348('0x94')](_0x5cb935['body'][_0x2348('0x91')])){throw new APIBadRequestError(util[_0x2348('0xe7')](_0x2348('0x102'),_0x5cb935[_0x2348('0x52')][_0x2348('0x91')]));}return db[_0x2348('0x33')][_0x2348('0x2f')]({'where':{'id':_0x5cb935[_0x2348('0x53')]['id']},'attributes':['id',_0x2348('0x32'),_0x2348('0x22'),_0x2348('0x58'),_0x2348('0xa1'),'online',_0x2348('0x93'),_0x2348('0x103'),_0x2348('0x104'),_0x2348('0x105'),'openchannelPause',_0x2348('0x106'),_0x2348('0x107'),'pauseType',_0x2348('0x108')]})[_0x2348('0x21')](function(_0x40cda4){if(!_0x40cda4){throw new APINotFoundError(util[_0x2348('0xe7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x5cb935['params']['id']));}return _0x40cda4[_0x2348('0x101')](_0x5cb935[_0x2348('0x52')][_0x2348('0x91')]);})[_0x2348('0x21')](respondWithResult(_0x3f1024,null))[_0x2348('0x4c')](APIHandleError(_0x3f1024));};exports[_0x2348('0x109')]=function(_0x130b41,_0x4189cf){var _0x33c8b3={};var _0x4b6d88={};var _0x1f4715;var _0xfdca0d;return db['User'][_0x2348('0xbf')]({'where':{'id':_0x130b41[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x4189cf,null))[_0x2348('0x21')](function(_0x49d2d8){if(_0x49d2d8){_0x1f4715=_0x49d2d8;_0x4b6d88[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0x10a')][_0x2348('0x34')]);_0x4b6d88[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x130b41['query']);_0x4b6d88[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x4b6d88[_0x2348('0xc7')],_0x4b6d88['query']);_0x33c8b3[_0x2348('0x4f')]=_['intersection'](_0x4b6d88[_0x2348('0xc7')],qs['fields'](_0x130b41[_0x2348('0x3b')]['fields']));_0x33c8b3[_0x2348('0x4f')]=_0x33c8b3[_0x2348('0x4f')][_0x2348('0x44')]?_0x33c8b3[_0x2348('0x4f')]:_0x4b6d88['model'];_0x33c8b3['order']=qs[_0x2348('0xce')](_0x130b41[_0x2348('0x3b')][_0x2348('0xce')]);_0x33c8b3[_0x2348('0xcf')]=qs[_0x2348('0xca')](_[_0x2348('0xd0')](_0x130b41[_0x2348('0x3b')],_0x4b6d88[_0x2348('0xca')]));if(_0x130b41[_0x2348('0x3b')]['filter']){_0x33c8b3['where']=_['merge'](_0x33c8b3[_0x2348('0xcf')],{'$or':_[_0x2348('0x2c')](_0x33c8b3[_0x2348('0x4f')],function(_0x4fff97){var _0x3b02f9={};_0x3b02f9[_0x4fff97]={'$like':'%'+_0x130b41['query'][_0x2348('0x2a')]+'%'};return _0x3b02f9;})});}_0x33c8b3=_[_0x2348('0x4d')]({},_0x33c8b3,_0x130b41['options']);return _0x1f4715['getTeams'](_0x33c8b3);}})[_0x2348('0x21')](function(_0x26774c){if(_0x26774c){_0xfdca0d=_0x26774c[_0x2348('0x44')];if(!_0x130b41[_0x2348('0x3b')][_0x2348('0xc1')](_0x2348('0xd2'))){_0x33c8b3[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x130b41[_0x2348('0x3b')][_0x2348('0x1d')]);_0x33c8b3[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x130b41['query'][_0x2348('0x1c')]);}return _0x1f4715[_0x2348('0x109')](_0x33c8b3);}})[_0x2348('0x21')](function(_0x16c067){if(_0x16c067){return _0x16c067?{'count':_0xfdca0d,'rows':_0x16c067}:null;}})[_0x2348('0x21')](respondWithResult(_0x4189cf,null))['catch'](handleError(_0x4189cf,null));};exports['addTeams']=function(_0xe890c8,_0x52951d){var _0x26b240=_0xe890c8[_0x2348('0x53')]['id'];var _0x1b1599=_0xe890c8['body']?_0xe890c8['body'][_0x2348('0x56')]:null;var _0x9a5cab=[];return Promise[_0x2348('0xfa')]()[_0x2348('0x21')](function(){if(!_0x1b1599)throw new APIBadRequestError(_0x2348('0x10b'));})['then'](function(){return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x26b240}});})[_0x2348('0x21')](function(_0x164cb4){if(!_0x164cb4)throw new APINotFoundError(util[_0x2348('0xe7')](_0x2348('0xc0'),_0xe890c8['params']['id']));return db[_0x2348('0x5e')]['transaction'](function(_0x185831){return _0x164cb4[_0x2348('0x10c')](_0x1b1599,{'transaction':_0x185831})[_0x2348('0x21')](function(){return db[_0x2348('0x10a')]['findAll']({'where':{'id':{'$in':_0x1b1599}}});})[_0x2348('0x21')](function(_0x47838e){var _0x47d9dd=_[_0x2348('0x2c')](_0x47838e,function(_0x55c0ea){return _0x55c0ea[_0x2348('0x10d')]();});return Promise[_0x2348('0x4b')](_0x47d9dd);})[_0x2348('0x21')](function(_0xd00e9f){_0x9a5cab=_[_0x2348('0x10e')](_0xd00e9f);var _0x4f31a5=_['map'](_0x9a5cab,function(_0x55cde2){return _0x55cde2[_0x2348('0x10f')](_0x164cb4['id'],{'transaction':_0x185831});});return Promise[_0x2348('0x4b')](_0x4f31a5);})[_0x2348('0x21')](function(){if(!_0x164cb4[_0x2348('0xfd')])return;var _0x416478=_[_0x2348('0x2a')](_0x9a5cab,function(_0x174511){return _0x174511[_0x2348('0x110')](_0x2348('0x91'))==='Voice';});var _0x1ab679=_[_0x2348('0x2c')](_0x416478,function(_0x1dc08f){return db['UserVoiceQueueRt'][_0x2348('0xa2')]({'membername':_0x164cb4['name'],'UserId':_0x164cb4['id'],'queue_name':_0x1dc08f[_0x2348('0x32')],'VoiceQueueId':_0x1dc08f['id'],'interface':_[_0x2348('0x5c')](_0x164cb4[_0x2348('0xa1')])?util[_0x2348('0xe7')]('SIP/%s',_0x164cb4[_0x2348('0x32')]):_0x164cb4['interface'],'paused':_0x164cb4[_0x2348('0x93')]||![],'penalty':_0x164cb4['penalty']},{'transaction':_0x185831});});return Promise[_0x2348('0x4b')](_0x1ab679);})[_0x2348('0x21')](function(){return db['TeamVoicePrefix'][_0x2348('0x41')]({'where':{'teamId':{'$in':_0x1b1599}}});})[_0x2348('0x21')](function(_0x39a168){var _0x3d893b=_[_0x2348('0x2c')](_0x39a168,function(_0xb71d0e){return db['UserVoicePrefix'][_0x2348('0x71')]({'UserId':_0x164cb4['id'],'VoicePrefixId':_0xb71d0e['VoicePrefixId']},{'transaction':_0x185831});});return Promise['all'](_0x3d893b);});});})[_0x2348('0x21')](function(){for(var _0x60ac25=0x0;_0x60ac25<_0x9a5cab[_0x2348('0x44')];_0x60ac25++){var _0x3d4eb8=_0x9a5cab[_0x60ac25][_0x2348('0x110')]('channel');var _0xd20613=_0x3d4eb8+_0x2348('0x9c');socket['emit'](_0x2348('0x72')+_0x3d4eb8+'Queue:save',{'UserId':_0x26b240,['queueField']:_0x9a5cab[_0x60ac25]['id']});}})['then'](respondWithStatusCode(_0x52951d,null))['catch'](APIHandleError(_0x52951d));};exports['removeTeams']=function(_0x177852,_0x2f71db){var _0x229920=_0x177852[_0x2348('0x53')]['id'];var _0x441f6=null;if(_0x177852['query'][_0x2348('0x56')]){_0x441f6=_[_0x2348('0xa3')](_0x177852[_0x2348('0x3b')]['ids'])?_0x177852[_0x2348('0x3b')]['ids']:[_0x177852[_0x2348('0x3b')][_0x2348('0x56')]];}var _0x936899=[];return Promise['resolve']()[_0x2348('0x21')](function(){if(!_0x441f6)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x229920}});})[_0x2348('0x21')](function(_0x1dff9c){if(!_0x1dff9c)throw new APINotFoundError(util[_0x2348('0xe7')](_0x2348('0xc0'),_0x177852['params']['id']));return db['sequelize']['transaction'](function(_0x55bf87){return _0x1dff9c[_0x2348('0x111')](_0x441f6,{'transaction':_0x55bf87})[_0x2348('0x21')](function(){return db[_0x2348('0x10a')][_0x2348('0x41')]({'where':{'id':{'$in':_0x441f6}}});})['then'](function(_0x347bb9){var _0x48df82=_[_0x2348('0x2c')](_0x347bb9,function(_0x322d9b){return _0x322d9b[_0x2348('0x10d')]();});return Promise[_0x2348('0x4b')](_0x48df82);})[_0x2348('0x21')](function(_0x8a9647){_0x936899=_[_0x2348('0x10e')](_0x8a9647);var _0x21dc4c=_[_0x2348('0x2c')](_0x936899,function(_0x202304){return _0x202304[_0x2348('0x112')](_0x1dff9c['id'],{'transaction':_0x55bf87});});return Promise[_0x2348('0x4b')](_0x21dc4c);})[_0x2348('0x21')](function(){if(!_0x1dff9c['online'])return;var _0x1215a6=_[_0x2348('0x2a')](_0x936899,function(_0x3c745d){return _0x3c745d[_0x2348('0x110')](_0x2348('0x91'))==='Voice';});var _0x337ddf=_[_0x2348('0x2c')](_0x1215a6,function(_0x195758){return db[_0x2348('0xa5')][_0x2348('0x25')]({'where':{'VoiceQueueId':_0x195758['id'],'UserId':_0x1dff9c['id']},'transaction':_0x55bf87});});return Promise[_0x2348('0x4b')](_0x337ddf);})[_0x2348('0x21')](function(){return db['TeamVoicePrefix'][_0x2348('0x41')]({'where':{'teamId':{'$in':_0x441f6}}});})[_0x2348('0x21')](function(_0x4dac75){var _0x269cc9=_['map'](_0x4dac75,function(_0x415734){return db[_0x2348('0x113')][_0x2348('0x25')]({'where':{'UserId':_0x1dff9c['id'],'VoicePrefixId':_0x415734[_0x2348('0x114')]}},{'transaction':_0x55bf87});});return Promise[_0x2348('0x4b')](_0x269cc9);});});})[_0x2348('0x21')](function(){for(var _0x133c4a=0x0;_0x133c4a<_0x936899[_0x2348('0x44')];_0x133c4a++){var _0x92d0ce=_0x936899[_0x133c4a][_0x2348('0x110')]('channel');var _0x1bc805=_0x92d0ce+'QueueId';socket[_0x2348('0xa4')]('user'+_0x92d0ce+_0x2348('0x115'),{'UserId':_0x229920,['queueField']:_0x936899[_0x133c4a]['id']});}})[_0x2348('0x21')](respondWithStatusCode(_0x2f71db,null))[_0x2348('0x4c')](APIHandleError(_0x2f71db));};exports[_0x2348('0x116')]=function(_0x47a88f,_0x8de8ac){var _0x58e24a={};var _0x389cf4={};var _0x399fc4;var _0x9a2e2e;return db[_0x2348('0x33')][_0x2348('0xbf')]({'where':{'id':_0x47a88f[_0x2348('0x53')]['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x8de8ac,null))[_0x2348('0x21')](function(_0x4bcfb4){if(_0x4bcfb4){_0x399fc4=_0x4bcfb4;_0x389cf4[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0xc2')]['rawAttributes']);_0x389cf4['query']=_['keys'](_0x47a88f[_0x2348('0x3b')]);_0x389cf4[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x389cf4['model'],_0x389cf4[_0x2348('0x3b')]);_0x58e24a[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x389cf4[_0x2348('0xc7')],qs[_0x2348('0xcc')](_0x47a88f['query'][_0x2348('0xcc')]));_0x58e24a[_0x2348('0x4f')]=_0x58e24a[_0x2348('0x4f')][_0x2348('0x44')]?_0x58e24a[_0x2348('0x4f')]:_0x389cf4['model'];_0x58e24a[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x47a88f['query'][_0x2348('0xce')]);_0x58e24a[_0x2348('0xcf')]=qs['filters'](_[_0x2348('0xd0')](_0x47a88f[_0x2348('0x3b')],_0x389cf4[_0x2348('0xca')]));if(_0x47a88f[_0x2348('0x3b')][_0x2348('0x2a')]){_0x58e24a[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x58e24a['where'],{'$or':_['map'](_0x58e24a['attributes'],function(_0x2a9f90){var _0x5e4913={};_0x5e4913[_0x2a9f90]={'$like':'%'+_0x47a88f['query'][_0x2348('0x2a')]+'%'};return _0x5e4913;})});}_0x58e24a=_[_0x2348('0x4d')]({},_0x58e24a,_0x47a88f[_0x2348('0x4e')]);return _0x399fc4[_0x2348('0x116')](_0x58e24a);}})[_0x2348('0x21')](function(_0x4a7d85){if(_0x4a7d85){_0x9a2e2e=_0x4a7d85[_0x2348('0x44')];if(!_0x47a88f[_0x2348('0x3b')][_0x2348('0xc1')]('nolimit')){_0x58e24a[_0x2348('0x1d')]=qs[_0x2348('0x1d')](_0x47a88f[_0x2348('0x3b')][_0x2348('0x1d')]);_0x58e24a[_0x2348('0x1c')]=qs[_0x2348('0x1c')](_0x47a88f[_0x2348('0x3b')]['offset']);}return _0x399fc4['getLists'](_0x58e24a);}})[_0x2348('0x21')](function(_0x11cc58){if(_0x11cc58){return _0x11cc58?{'count':_0x9a2e2e,'rows':_0x11cc58}:null;}})[_0x2348('0x21')](respondWithResult(_0x8de8ac,null))['catch'](handleError(_0x8de8ac,null));};exports[_0x2348('0x117')]=function(_0x55c431,_0x17bf80){var _0x4f23e9={};var _0x408e75={};var _0xc97c4f;return db['User'][_0x2348('0xbf')]({'where':{'id':_0x55c431['params']['id']}})[_0x2348('0x21')](handleEntityNotFound(_0x17bf80,null))['then'](function(_0x2a4249){if(_0x2a4249){_0xc97c4f=_0x2a4249;_0x408e75[_0x2348('0xc7')]=_[_0x2348('0xc8')](db[_0x2348('0x33')]['rawAttributes']);_0x408e75[_0x2348('0x3b')]=_[_0x2348('0xc8')](_0x55c431['query']);_0x408e75[_0x2348('0xca')]=_[_0x2348('0xcb')](_0x408e75[_0x2348('0xc7')],_0x408e75[_0x2348('0x3b')]);_0x4f23e9[_0x2348('0x4f')]=_[_0x2348('0xcb')](_0x408e75[_0x2348('0xc7')],qs[_0x2348('0xcc')](_0x55c431[_0x2348('0x3b')][_0x2348('0xcc')]));_0x4f23e9[_0x2348('0x4f')]=_0x4f23e9[_0x2348('0x4f')][_0x2348('0x44')]?_0x4f23e9['attributes']:_0x408e75[_0x2348('0xc7')];_0x4f23e9[_0x2348('0xcd')]=qs[_0x2348('0xce')](_0x55c431['query'][_0x2348('0xce')]);_0x4f23e9['where']=qs['filters'](_['pick'](_0x55c431[_0x2348('0x3b')],_0x408e75['filters']));if(_0x55c431[_0x2348('0x3b')][_0x2348('0x2a')]){_0x4f23e9[_0x2348('0xcf')]=_[_0x2348('0x4d')](_0x4f23e9[_0x2348('0xcf')],{'$or':_['map'](_0x4f23e9[_0x2348('0x4f')],function(_0x432357){var _0x58121e={};_0x58121e[_0x432357]={'$like':'%'+_0x55c431[_0x2348('0x3b')][_0x2348('0x2a')]+'%'};return _0x58121e;})});}_0x4f23e9['model']=db[_0x2348('0x33')];_0x4f23e9['as']=_0x2348('0x77');_0x4f23e9=_['merge']({},_0x4f23e9,_0x55c431[_0x2348('0x4e')]);return _0xc97c4f['getVoiceQueues']({'include':[_0x4f23e9]});}})[_0x2348('0x21')](function(_0x2db655){if(_0x2db655){var _0x42af32={},_0x46e324=[];for(var _0x503685=0x0;_0x503685<_0x2db655[_0x2348('0x44')];_0x503685+=0x1){for(var _0x3d1053=0x0,_0x54d467;_0x3d1053<_0x2db655[_0x503685][_0x2348('0x77')][_0x2348('0x44')];_0x3d1053+=0x1){_0x54d467=_0x2db655[_0x503685][_0x2348('0x77')][_0x3d1053][_0x2348('0xa0')]({'plain':!![]});_0x42af32[_0x54d467['id']]=_0x54d467;}}_0x42af32=_['values'](_0x42af32);for(var _0x51b645=qs[_0x2348('0x1c')](_0x55c431[_0x2348('0x3b')][_0x2348('0x1c')]);_0x51b645<_0x42af32['length']&&_0x46e324[_0x2348('0x44')]=_0x912613[_0x7b1d('0x4b')]){throw new Error(_0x7b1d('0x4c'));}})['then'](function(){if(_0x54ce90){return db[_0x7b1d('0x24')]['destroy']({'where':{'membername':_0x54ce90[_0x7b1d('0x1e')]},'individualHooks':!![]});}})['then'](function(){if(_0x54ce90){return _0x54ce90[_0x7b1d('0x4d')]({'raw':!![]});}})['then'](function(_0x124d2f){if(_0x54ce90){if(_0x124d2f){var _0xc9c8da=[];_0x3a8714=_0x124d2f;if(_0x3a8714[_0x7b1d('0x27')]){for(var _0x3c37f4=0x0;_0x3c37f4<_0x3a8714[_0x7b1d('0x27')];_0x3c37f4++){_0xc9c8da[_0x7b1d('0x2b')](db[_0x7b1d('0x24')][_0x7b1d('0x4e')]({'membername':_0x54ce90[_0x7b1d('0x1e')],'UserId':_0x54ce90['id'],'queue_name':_0x3a8714[_0x3c37f4][_0x7b1d('0x1e')],'VoiceQueueId':_0x3a8714[_0x3c37f4]['id'],'interface':_0x15f2ac,'paused':_0x54ce90[_0x7b1d('0x48')]||![],'penalty':_0x3a8714[_0x3c37f4]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x7b1d('0x4f')](_0xc9c8da);}}}})[_0x7b1d('0x1a')](function(){if(_0x54ce90){return db[_0x7b1d('0x25')][_0x7b1d('0xc')]({'where':{'membername':_0x54ce90[_0x7b1d('0x1e')],'exitAt':null}});}})[_0x7b1d('0x1a')](function(_0x44e0a3){if(_0x54ce90){if(_0x44e0a3&&_0x44e0a3['length']){var _0x2fdfff=[];_0x44e0a3[_0x7b1d('0x2a')](function(_0xea1636){_0x2fdfff[_0x7b1d('0x2b')](_0xea1636[_0x7b1d('0x32')]({'exitAt':moment()[_0x7b1d('0x22')](_0x7b1d('0x2c'))}));});return BPromise[_0x7b1d('0x4f')](_0x2fdfff);}}})[_0x7b1d('0x1a')](function(){if(_0x54ce90){var _0x257a38=[];var _0x13b4ee=[];var _0x5570c4=utils[_0x7b1d('0x29')]();var _0x15c92c={'membername':_0x54ce90[_0x7b1d('0x1e')],'interface':_0x15f2ac,'enterAt':moment()[_0x7b1d('0x22')](_0x7b1d('0x2c')),'role':_0x54ce90[_0x7b1d('0x1f')],'internal':_0x54ce90[_0x7b1d('0x20')]};_0x5570c4[_0x7b1d('0x2a')](function(_0x326b4b){_0x257a38[_0x7b1d('0x2b')](_[_0x7b1d('0x50')]({'channel':_0x326b4b,'type':'LOGIN','data1':_0x7b1d('0x51'),'data2':_0x15f2ac},_0x15c92c));if(_0x54ce90[_0x7b1d('0x48')]){_0x13b4ee['push'](_[_0x7b1d('0x50')]({'channel':_0x326b4b,'type':_0x7b1d('0x26'),'data1':_0x7b1d('0x52')},_0x15c92c));}});return db[_0x7b1d('0x25')][_0x7b1d('0x31')](_0x257a38[_0x7b1d('0x53')](_0x13b4ee),{'individualHooks':!![]});}})[_0x7b1d('0x1a')](function(){if(_0x54ce90){return _0x54ce90['update']({'online':!![],'lastLoginAt':moment()['format'](_0x7b1d('0x2c')),'voicePause':_0x54ce90[_0x7b1d('0x48')]||![],'mailPause':_0x54ce90[_0x7b1d('0x48')]||![],'chatPause':_0x54ce90[_0x7b1d('0x48')]||![],'faxPause':_0x54ce90[_0x7b1d('0x48')]||![],'smsPause':_0x54ce90['loginInPause']||![],'openchannelPause':_0x54ce90[_0x7b1d('0x48')]||![],'pauseType':_0x54ce90[_0x7b1d('0x48')]?_0x7b1d('0x52'):null,'lastPauseAt':moment()[_0x7b1d('0x22')](_0x7b1d('0x2c')),'interface':_0x15f2ac});}})[_0x7b1d('0x1a')](function(_0x213734){_0x5b685b(_0x213734);})[_0x7b1d('0x1c')](function(_0x2fc249){_0x1980e5(_0x1cc9b0[_0x7b1d('0x16')](0x1f4,_0x2fc249[_0x7b1d('0x1d')]));});});}; \ No newline at end of file +var _0xbc16=['destroy','upsert','UserVoiceQueue.penalty','all','LOGIN','callysquare','LOGININPAUSE','bulkCreate','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','GetUser','User','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowUser','find','raw','PauseUser','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','PAUSE','YYYY-MM-DD\x20HH:mm:ss','getChannels','forEach','push','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','MemberReport','update','UnpauseUser','resolve','channel','isValidChannel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','internal','voicePause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','LogoutUser','length','LoginUser','mobile','phone','loginInPause','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xbc16,0x1b2));var _0x6bc1=function(_0x82e426,_0x447a3f){_0x82e426=_0x82e426-0x0;var _0x4c11ca=_0xbc16[_0x82e426];return _0x4c11ca;};'use strict';var _=require(_0x6bc1('0x0'));var util=require(_0x6bc1('0x1'));var moment=require(_0x6bc1('0x2'));var BPromise=require('bluebird');var Redis=require(_0x6bc1('0x3'));var db=require(_0x6bc1('0x4'))['db'];var utils=require(_0x6bc1('0x5'));var logger=require(_0x6bc1('0x6'))(_0x6bc1('0x7'));var config=require(_0x6bc1('0x8'));config[_0x6bc1('0x9')]=_[_0x6bc1('0xa')](config[_0x6bc1('0x9')],{'host':_0x6bc1('0xb'),'port':0x18eb});var socket=require(_0x6bc1('0xc'))(new Redis(config['redis']));require(_0x6bc1('0xd'))['register'](socket);exports[_0x6bc1('0xe')]=function(_0x5e4ccc){var _0x73242f=this;return new Promise(function(_0x58a8b7,_0x55171b){return db[_0x6bc1('0xf')][_0x6bc1('0x10')]({'raw':_0x5e4ccc[_0x6bc1('0x11')]?_0x5e4ccc[_0x6bc1('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x5e4ccc[_0x6bc1('0x11')]?_0x5e4ccc[_0x6bc1('0x11')][_0x6bc1('0x12')]||null:null,'attributes':_0x5e4ccc[_0x6bc1('0x11')]?_0x5e4ccc[_0x6bc1('0x11')][_0x6bc1('0x13')]||null:null,'limit':_0x5e4ccc[_0x6bc1('0x11')]?_0x5e4ccc['options']['limit']||null:null,'include':_0x5e4ccc[_0x6bc1('0x11')]?_0x5e4ccc[_0x6bc1('0x11')][_0x6bc1('0x14')]?_[_0x6bc1('0x15')](_0x5e4ccc[_0x6bc1('0x11')][_0x6bc1('0x14')],function(_0xad690e){return{'model':db[_0xad690e[_0x6bc1('0x16')]],'as':_0xad690e['as'],'attributes':_0xad690e[_0x6bc1('0x13')],'include':_0xad690e[_0x6bc1('0x14')]?_[_0x6bc1('0x15')](_0xad690e['include'],function(_0x5f0548){return{'model':db[_0x5f0548[_0x6bc1('0x16')]],'as':_0x5f0548['as'],'attributes':_0x5f0548['attributes'],'include':_0x5f0548[_0x6bc1('0x14')]?_[_0x6bc1('0x15')](_0x5f0548[_0x6bc1('0x14')],function(_0x674a17){return{'model':db[_0x674a17['model']],'as':_0x674a17['as'],'attributes':_0x674a17[_0x6bc1('0x13')]};}):[]};}):[]};}):[]:[]})[_0x6bc1('0x17')](function(_0x1bbc9f){logger[_0x6bc1('0x18')]('GetUser',_0x5e4ccc);logger[_0x6bc1('0x19')]('GetUser',_0x5e4ccc,JSON[_0x6bc1('0x1a')](_0x1bbc9f));_0x58a8b7(_0x1bbc9f);})[_0x6bc1('0x1b')](function(_0x5dceee){logger[_0x6bc1('0x1c')]('GetUser',_0x5dceee[_0x6bc1('0x1d')],_0x5e4ccc);_0x55171b(_0x73242f[_0x6bc1('0x1c')](0x1f4,_0x5dceee['message']));});});};exports[_0x6bc1('0x1e')]=function(_0x3c850e){var _0x18ad88=this;return new Promise(function(_0x2a91fa,_0x2861e1){return db[_0x6bc1('0xf')][_0x6bc1('0x1f')]({'raw':_0x3c850e[_0x6bc1('0x11')]?_0x3c850e[_0x6bc1('0x11')][_0x6bc1('0x20')]===undefined?!![]:![]:!![],'where':_0x3c850e[_0x6bc1('0x11')]?_0x3c850e['options'][_0x6bc1('0x12')]||null:null,'attributes':_0x3c850e[_0x6bc1('0x11')]?_0x3c850e['options'][_0x6bc1('0x13')]||null:null,'include':_0x3c850e[_0x6bc1('0x11')]?_0x3c850e[_0x6bc1('0x11')][_0x6bc1('0x14')]?_[_0x6bc1('0x15')](_0x3c850e[_0x6bc1('0x11')][_0x6bc1('0x14')],function(_0x3cee7b){return{'model':db[_0x3cee7b[_0x6bc1('0x16')]],'as':_0x3cee7b['as'],'attributes':_0x3cee7b[_0x6bc1('0x13')],'include':_0x3cee7b[_0x6bc1('0x14')]?_[_0x6bc1('0x15')](_0x3cee7b[_0x6bc1('0x14')],function(_0x289167){return{'model':db[_0x289167[_0x6bc1('0x16')]],'as':_0x289167['as'],'attributes':_0x289167[_0x6bc1('0x13')],'include':_0x289167[_0x6bc1('0x14')]?_['map'](_0x289167[_0x6bc1('0x14')],function(_0x320675){return{'model':db[_0x320675[_0x6bc1('0x16')]],'as':_0x320675['as'],'attributes':_0x320675['attributes']};}):[]};}):[]};}):[]:[]})[_0x6bc1('0x17')](function(_0x4265f6){logger[_0x6bc1('0x18')](_0x6bc1('0x1e'),_0x3c850e);logger[_0x6bc1('0x19')](_0x6bc1('0x1e'),_0x3c850e,JSON['stringify'](_0x4265f6));_0x2a91fa(_0x4265f6);})[_0x6bc1('0x1b')](function(_0x5d7d23){logger[_0x6bc1('0x1c')](_0x6bc1('0x1e'),_0x5d7d23[_0x6bc1('0x1d')],_0x3c850e);_0x2861e1(_0x18ad88[_0x6bc1('0x1c')](0x1f4,_0x5d7d23[_0x6bc1('0x1d')]));});});};exports[_0x6bc1('0x21')]=function(_0x179e52){var _0x45eeac;return db[_0x6bc1('0xf')]['find']({'where':_0x179e52[_0x6bc1('0x11')][_0x6bc1('0x12')]||{},'attributes':['id',_0x6bc1('0x22'),_0x6bc1('0x23'),'internal',_0x6bc1('0x24')]})[_0x6bc1('0x17')](function(_0x37591f){if(!_0x37591f){throw new Error(util[_0x6bc1('0x25')](_0x6bc1('0x26'),_0x179e52[_0x6bc1('0x27')]['id']));}_0x45eeac=_0x37591f;return db[_0x6bc1('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x45eeac['id']},'individualHooks':!![]});})['then'](function(){return db['MemberReport'][_0x6bc1('0x10')]({'where':{'membername':_0x45eeac['name'],'type':_0x6bc1('0x29'),'exitAt':null}});})[_0x6bc1('0x17')](function(_0x54a452){if(_0x54a452&&_0x54a452['length']){var _0x65892f=moment()[_0x6bc1('0x25')](_0x6bc1('0x2a'));for(var _0x54ff13=0x0,_0x36321b=_0x54a452['length'];_0x54ff13<_0x36321b;_0x54ff13++){_0x54a452[_0x54ff13]['updateAttributes']({'exitAt':_0x65892f});}}})[_0x6bc1('0x17')](function(){var _0x22f837=[];var _0x5a3f6c=utils[_0x6bc1('0x2b')]();_0x5a3f6c[_0x6bc1('0x2c')](function(_0x36d902){_0x22f837[_0x6bc1('0x2d')]({'channel':_0x36d902,'membername':_0x45eeac[_0x6bc1('0x22')],'interface':_[_0x6bc1('0x2e')](_0x45eeac[_0x6bc1('0x24')])?util[_0x6bc1('0x25')](_0x6bc1('0x2f'),_0x45eeac[_0x6bc1('0x22')]):_0x45eeac[_0x6bc1('0x24')],'type':_0x6bc1('0x29'),'enterAt':moment()[_0x6bc1('0x25')](_0x6bc1('0x2a')),'data1':_0x179e52[_0x6bc1('0x30')]['type']||_0x6bc1('0x31'),'role':_0x45eeac['role'],'internal':_0x45eeac['internal'],'uniqueid':_0x179e52[_0x6bc1('0x30')][_0x6bc1('0x32')]||null});});return db[_0x6bc1('0x33')]['bulkCreate'](_0x22f837,{'individualHooks':!![]});})[_0x6bc1('0x17')](function(){return _0x45eeac[_0x6bc1('0x34')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x179e52['body']['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x6bc1('0x25')](_0x6bc1('0x2a'))});})[_0x6bc1('0x1b')](function(_0x25ec50){throw _0x25ec50;});};exports[_0x6bc1('0x35')]=function(_0x22a9f4){return Promise[_0x6bc1('0x36')]()[_0x6bc1('0x17')](function(){if(_0x22a9f4[_0x6bc1('0x30')][_0x6bc1('0x37')]&&!utils[_0x6bc1('0x38')](_0x22a9f4['body'][_0x6bc1('0x37')])){throw new Error(util[_0x6bc1('0x25')](_0x6bc1('0x39'),_0x22a9f4[_0x6bc1('0x30')][_0x6bc1('0x37')]));}return db[_0x6bc1('0xf')][_0x6bc1('0x3a')]({'where':_0x22a9f4[_0x6bc1('0x11')][_0x6bc1('0x12')]||{},'attributes':['id',_0x6bc1('0x22'),_0x6bc1('0x23'),_0x6bc1('0x3b'),_0x6bc1('0x24'),'online',_0x6bc1('0x3c'),'mailPause',_0x6bc1('0x3d'),'faxPause',_0x6bc1('0x3e'),_0x6bc1('0x3f'),_0x6bc1('0x40'),_0x6bc1('0x41'),_0x6bc1('0x42')]});})[_0x6bc1('0x17')](function(_0x56a99f){if(!_0x56a99f){throw new Error(util[_0x6bc1('0x25')]('User\x20with\x20id\x20%s\x20not\x20found',_0x22a9f4[_0x6bc1('0x27')]['id']));}return _0x56a99f['unpause'](_0x22a9f4[_0x6bc1('0x30')][_0x6bc1('0x37')],'system');})[_0x6bc1('0x1b')](function(_0x1cf8ba){throw _0x1cf8ba;});};exports[_0x6bc1('0x43')]=function(_0x5b0080){var _0x2653c4=this;return new Promise(function(_0x2dfff8,_0x5af7a1){var _0x5ee247;return db[_0x6bc1('0xf')][_0x6bc1('0x3a')]({'where':_0x5b0080[_0x6bc1('0x11')]['where']||{},'attributes':['id',_0x6bc1('0x22')]})['then'](function(_0x10fd49){if(_0x10fd49){_0x5ee247=_0x10fd49;return db[_0x6bc1('0x28')]['destroy']({'where':{'membername':_0x5ee247['name']},'individualHooks':!![]});}})[_0x6bc1('0x17')](function(){if(_0x5ee247){return db[_0x6bc1('0x33')]['findAll']({'where':{'membername':_0x5ee247['name'],'exitAt':null}});}})[_0x6bc1('0x17')](function(_0x5dbbdb){if(_0x5ee247){if(_0x5dbbdb&&_0x5dbbdb[_0x6bc1('0x44')]){var _0x29a2b2=[];_0x5dbbdb['forEach'](function(_0x3d8419){_0x29a2b2['push'](_0x3d8419[_0x6bc1('0x34')]({'exitAt':moment()[_0x6bc1('0x25')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x29a2b2);}}})[_0x6bc1('0x17')](function(){if(_0x5ee247){return _0x5ee247['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x6bc1('0x17')](function(_0x57975){_0x2dfff8(_0x57975);})['catch'](function(_0x34a4a5){_0x5af7a1(_0x2653c4[_0x6bc1('0x1c')](0x1f4,_0x34a4a5['message']));});});};exports[_0x6bc1('0x45')]=function(_0x315048){var _0x50d11f=this;return new Promise(function(_0x174d2e,_0x53e286){var _0x5084e8;var _0x54d43b;var _0x4af83d;var _0x5755c4;return db['User']['findOne']({'where':_0x315048['options'][_0x6bc1('0x12')]||{},'attributes':['id',_0x6bc1('0x22'),_0x6bc1('0x23'),_0x6bc1('0x46'),_0x6bc1('0x47'),_0x6bc1('0x3b'),_0x6bc1('0x48'),_0x6bc1('0x24')]})[_0x6bc1('0x17')](function(_0x454199){if(_0x454199){_0x5084e8=_0x454199;_0x5755c4=_0x315048[_0x6bc1('0x30')]['interface']?_0x315048[_0x6bc1('0x30')]['interface']:util[_0x6bc1('0x25')](_0x6bc1('0x2f'),_0x5084e8[_0x6bc1('0x22')]);return db['User']['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5084e8['id']}}});}})[_0x6bc1('0x17')](function(_0x3aae2f){if(_0x3aae2f){_0x4af83d=_0x3aae2f;return require(_0x6bc1('0x49'))['getLicense']();}})[_0x6bc1('0x17')](function(_0x50f424){if(_0x50f424&&_0x50f424[_0x6bc1('0x4a')]&&_0x4af83d>=_0x50f424[_0x6bc1('0x4a')]){throw new Error(_0x6bc1('0x4b'));}})['then'](function(){if(_0x5084e8){return db['UserVoiceQueueRt'][_0x6bc1('0x4c')]({'where':{'membername':_0x5084e8['name']},'individualHooks':!![]});}})[_0x6bc1('0x17')](function(){if(_0x5084e8){return _0x5084e8['getVoiceQueues']({'raw':!![]});}})[_0x6bc1('0x17')](function(_0x162c5b){if(_0x5084e8){if(_0x162c5b){var _0x36f2d0=[];_0x54d43b=_0x162c5b;if(_0x54d43b['length']){for(var _0x2dd948=0x0;_0x2dd948<_0x54d43b[_0x6bc1('0x44')];_0x2dd948++){_0x36f2d0[_0x6bc1('0x2d')](db[_0x6bc1('0x28')][_0x6bc1('0x4d')]({'membername':_0x5084e8[_0x6bc1('0x22')],'UserId':_0x5084e8['id'],'queue_name':_0x54d43b[_0x2dd948][_0x6bc1('0x22')],'VoiceQueueId':_0x54d43b[_0x2dd948]['id'],'interface':_0x5755c4,'paused':_0x5084e8[_0x6bc1('0x48')]||![],'penalty':_0x54d43b[_0x2dd948][_0x6bc1('0x4e')]||0x0}));}return BPromise[_0x6bc1('0x4f')](_0x36f2d0);}}}})['then'](function(){if(_0x5084e8){return db[_0x6bc1('0x33')][_0x6bc1('0x10')]({'where':{'membername':_0x5084e8[_0x6bc1('0x22')],'exitAt':null}});}})[_0x6bc1('0x17')](function(_0x2958bf){if(_0x5084e8){if(_0x2958bf&&_0x2958bf[_0x6bc1('0x44')]){var _0xaca4ff=[];_0x2958bf['forEach'](function(_0x5736d2){_0xaca4ff[_0x6bc1('0x2d')](_0x5736d2['update']({'exitAt':moment()[_0x6bc1('0x25')](_0x6bc1('0x2a'))}));});return BPromise['all'](_0xaca4ff);}}})['then'](function(){if(_0x5084e8){var _0x15c02d=[];var _0xcc5d3f=[];var _0x5ceb6e=utils[_0x6bc1('0x2b')]();var _0x5ddaed={'membername':_0x5084e8[_0x6bc1('0x22')],'interface':_0x5755c4,'enterAt':moment()[_0x6bc1('0x25')](_0x6bc1('0x2a')),'role':_0x5084e8[_0x6bc1('0x23')],'internal':_0x5084e8[_0x6bc1('0x3b')]};_0x5ceb6e[_0x6bc1('0x2c')](function(_0x3cc6e3){_0x15c02d[_0x6bc1('0x2d')](_['merge']({'channel':_0x3cc6e3,'type':_0x6bc1('0x50'),'data1':_0x6bc1('0x51'),'data2':_0x5755c4},_0x5ddaed));if(_0x5084e8[_0x6bc1('0x48')]){_0xcc5d3f[_0x6bc1('0x2d')](_['merge']({'channel':_0x3cc6e3,'type':_0x6bc1('0x29'),'data1':_0x6bc1('0x52')},_0x5ddaed));}});return db[_0x6bc1('0x33')][_0x6bc1('0x53')](_0x15c02d[_0x6bc1('0x54')](_0xcc5d3f),{'individualHooks':!![]});}})[_0x6bc1('0x17')](function(){if(_0x5084e8){return _0x5084e8['update']({'online':!![],'lastLoginAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x5084e8['loginInPause']||![],'mailPause':_0x5084e8[_0x6bc1('0x48')]||![],'chatPause':_0x5084e8[_0x6bc1('0x48')]||![],'faxPause':_0x5084e8[_0x6bc1('0x48')]||![],'smsPause':_0x5084e8[_0x6bc1('0x48')]||![],'openchannelPause':_0x5084e8[_0x6bc1('0x48')]||![],'pauseType':_0x5084e8['loginInPause']?_0x6bc1('0x52'):null,'lastPauseAt':moment()[_0x6bc1('0x25')](_0x6bc1('0x2a')),'interface':_0x5755c4});}})[_0x6bc1('0x17')](function(_0xf76c66){_0x174d2e(_0xf76c66);})[_0x6bc1('0x1b')](function(_0x3ec22a){_0x53e286(_0x50d11f[_0x6bc1('0x1c')](0x1f4,_0x3ec22a[_0x6bc1('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index d04eb47..89cd70f 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 _0x49ca=['remove','update','emit','removeListener','register','length','user:','save'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x49ca,0xbf));var _0xa49c=function(_0x26893e,_0x50e86d){_0x26893e=_0x26893e-0x0;var _0x2de2e8=_0x49ca[_0x26893e];return _0x2de2e8;};'use strict';var UserEvents=require('./user.events');var events=[_0xa49c('0x0'),_0xa49c('0x1'),_0xa49c('0x2')];function createListener(_0x310c15,_0x1a3974){return function(_0x119992){_0x1a3974[_0xa49c('0x3')](_0x310c15,_0x119992);};}function removeListener(_0x2be557,_0x283820){return function(){UserEvents[_0xa49c('0x4')](_0x2be557,_0x283820);};}exports[_0xa49c('0x5')]=function(_0x392bfe){for(var _0x15a6f1=0x0,_0x14ab5e=events[_0xa49c('0x6')];_0x15a6f1<_0x14ab5e;_0x15a6f1++){var _0x298285=events[_0x15a6f1];var _0x6f54d5=createListener(_0xa49c('0x7')+_0x298285,_0x392bfe);UserEvents['on'](_0x298285,_0x6f54d5);}}; \ No newline at end of file +var _0xf7eb=['user:','remove','update','emit','removeListener','register'];(function(_0x3011f6,_0x15f69d){var _0x56d25c=function(_0x2f0c7e){while(--_0x2f0c7e){_0x3011f6['push'](_0x3011f6['shift']());}};_0x56d25c(++_0x15f69d);}(_0xf7eb,0x15d));var _0xbf7e=function(_0x5e868c,_0x5d6375){_0x5e868c=_0x5e868c-0x0;var _0x576a4c=_0xf7eb[_0x5e868c];return _0x576a4c;};'use strict';var UserEvents=require('./user.events');var events=['save',_0xbf7e('0x0'),_0xbf7e('0x1')];function createListener(_0x57f43a,_0x818683){return function(_0x182762){_0x818683[_0xbf7e('0x2')](_0x57f43a,_0x182762);};}function removeListener(_0x570d5b,_0xd92fb9){return function(){UserEvents[_0xbf7e('0x3')](_0x570d5b,_0xd92fb9);};}exports[_0xbf7e('0x4')]=function(_0x2b10f4){for(var _0x1be580=0x0,_0x50621c=events['length'];_0x1be580<_0x50621c;_0x1be580++){var _0x561740=events[_0x1be580];var _0x5514c2=createListener(_0xbf7e('0x5')+_0x561740,_0x2b10f4);UserEvents['on'](_0x561740,_0x5514c2);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 89fd256..116828a 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x26449d,_0x4ed8c9){var _0x270315=function(_0x3f76c){while(--_0x3f76c){_0x26449d['push'](_0x26449d['shift']());}};_0x270315(++_0x4ed8c9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xcb91[_0x541a67];return _0x45da2a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3837fc,_0xc73b86){var _0x5e2b79=function(_0x27c41f){while(--_0x27c41f){_0x3837fc['push'](_0x3837fc['shift']());}};_0x5e2b79(++_0xc73b86);}(_0xe706,0xa3));var _0x6e70=function(_0x5dfd65,_0x1ad889){_0x5dfd65=_0x5dfd65-0x0;var _0x47f853=_0xe706[_0x5dfd65];return _0x47f853;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 889ffd9..36b8088 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 _0x9970=['exports','INTEGER'];(function(_0x34f1a2,_0x1f7b1c){var _0x2572b9=function(_0x1b7f78){while(--_0x1b7f78){_0x34f1a2['push'](_0x34f1a2['shift']());}};_0x2572b9(++_0x1f7b1c);}(_0x9970,0x1e2));var _0x0997=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x9970[_0x36dfbd];return _0x4ecad9;};'use strict';var Sequelize=require('sequelize');module[_0x0997('0x0')]={'penalty':{'type':Sequelize[_0x0997('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa7a7=['INTEGER'];(function(_0x465700,_0x13c6e7){var _0x3bfa10=function(_0x30e153){while(--_0x30e153){_0x465700['push'](_0x465700['shift']());}};_0x3bfa10(++_0x13c6e7);}(_0xa7a7,0xad));var _0x7a7a=function(_0x3db2f3,_0x5744d3){_0x3db2f3=_0x3db2f3-0x0;var _0x44d577=_0xa7a7[_0x3db2f3];return _0x44d577;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x7a7a('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 8f570d9..f2e4d2c 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 _0x4410=['rimraf','./userChatQueue.attributes','define','UserChatQueue','lodash','moment','bluebird','request-promise','path'];(function(_0x4d815e,_0x5ec9d1){var _0x5dfd59=function(_0x1fbf7e){while(--_0x1fbf7e){_0x4d815e['push'](_0x4d815e['shift']());}};_0x5dfd59(++_0x5ec9d1);}(_0x4410,0x199));var _0x0441=function(_0x2ce6d5,_0x333e0c){_0x2ce6d5=_0x2ce6d5-0x0;var _0x32d272=_0x4410[_0x2ce6d5];return _0x32d272;};'use strict';var _=require(_0x0441('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x0441('0x1'));var BPromise=require(_0x0441('0x2'));var rp=require(_0x0441('0x3'));var fs=require('fs');var path=require(_0x0441('0x4'));var rimraf=require(_0x0441('0x5'));var config=require('../../config/environment');var attributes=require(_0x0441('0x6'));module['exports']=function(_0x553d0b,_0x3fa572){return _0x553d0b[_0x0441('0x7')](_0x0441('0x8'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaeba=['UserChatQueue','lodash','api','moment','bluebird','request-promise','path','rimraf','./userChatQueue.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xaeba,0x191));var _0xaaeb=function(_0x16d24c,_0x152c47){_0x16d24c=_0x16d24c-0x0;var _0x30a8ca=_0xaeba[_0x16d24c];return _0x30a8ca;};'use strict';var _=require(_0xaaeb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaaeb('0x1'));var moment=require(_0xaaeb('0x2'));var BPromise=require(_0xaaeb('0x3'));var rp=require(_0xaaeb('0x4'));var fs=require('fs');var path=require(_0xaaeb('0x5'));var rimraf=require(_0xaaeb('0x6'));var config=require('../../config/environment');var attributes=require(_0xaaeb('0x7'));module[_0xaaeb('0x8')]=function(_0x402985,_0x56187c){return _0x402985['define'](_0xaaeb('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index bc53955..742de4c 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 _0xfc79=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserChatQueue,\x20%s,\x20%s','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent'];(function(_0x3f6b1b,_0x58d3d6){var _0x4a3d2b=function(_0x5648f0){while(--_0x5648f0){_0x3f6b1b['push'](_0x3f6b1b['shift']());}};_0x4a3d2b(++_0x58d3d6);}(_0xfc79,0x155));var _0x9fc7=function(_0x15624a,_0x2c0f34){_0x15624a=_0x15624a-0x0;var _0x2a6a9b=_0xfc79[_0x15624a];return _0x2a6a9b;};'use strict';var _=require('lodash');var util=require(_0x9fc7('0x0'));var moment=require('moment');var BPromise=require(_0x9fc7('0x1'));var rs=require(_0x9fc7('0x2'));var fs=require('fs');var Redis=require(_0x9fc7('0x3'));var db=require(_0x9fc7('0x4'))['db'];var utils=require(_0x9fc7('0x5'));var logger=require(_0x9fc7('0x6'))(_0x9fc7('0x7'));var config=require('../../config/environment');var jayson=require(_0x9fc7('0x8'));var client=jayson[_0x9fc7('0x9')][_0x9fc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xac1d99,_0x7e3af1,_0x177217){return new BPromise(function(_0x43023b,_0x3c3226){return client[_0x9fc7('0xb')](_0xac1d99,_0x177217)['then'](function(_0x345258){logger['info'](_0x9fc7('0xc'),_0x7e3af1,'request\x20sent');logger['debug'](_0x9fc7('0xd'),_0x7e3af1,'request\x20sent',JSON[_0x9fc7('0xe')](_0x345258));if(_0x345258[_0x9fc7('0xf')]){if(_0x345258[_0x9fc7('0xf')][_0x9fc7('0x10')]===0x1f4){logger[_0x9fc7('0xf')](_0x9fc7('0xc'),_0x7e3af1,_0x345258[_0x9fc7('0xf')][_0x9fc7('0x11')]);return _0x3c3226(_0x345258[_0x9fc7('0xf')][_0x9fc7('0x11')]);}logger['error'](_0x9fc7('0xc'),_0x7e3af1,_0x345258['error'][_0x9fc7('0x11')]);return _0x43023b(_0x345258[_0x9fc7('0xf')]['message']);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x7e3af1,_0x9fc7('0x12'));_0x43023b(_0x345258['result'][_0x9fc7('0x11')]);}})[_0x9fc7('0x13')](function(_0x78b754){logger[_0x9fc7('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x7e3af1,_0x78b754);_0x3c3226(_0x78b754);});});} \ No newline at end of file +var _0x4502=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x50584a,_0x278d6e){var _0x34bcd0=function(_0x4e6822){while(--_0x4e6822){_0x50584a['push'](_0x50584a['shift']());}};_0x34bcd0(++_0x278d6e);}(_0x4502,0xd5));var _0x2450=function(_0x1cf484,_0x46beb3){_0x1cf484=_0x1cf484-0x0;var _0x3641ee=_0x4502[_0x1cf484];return _0x3641ee;};'use strict';var _=require(_0x2450('0x0'));var util=require(_0x2450('0x1'));var moment=require(_0x2450('0x2'));var BPromise=require(_0x2450('0x3'));var rs=require(_0x2450('0x4'));var fs=require('fs');var Redis=require(_0x2450('0x5'));var db=require(_0x2450('0x6'))['db'];var utils=require(_0x2450('0x7'));var logger=require('../../config/logger')(_0x2450('0x8'));var config=require(_0x2450('0x9'));var jayson=require(_0x2450('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x374ccd,_0x4456e5,_0x3dab9b){return new BPromise(function(_0x421134,_0x5a34b1){return client[_0x2450('0xb')](_0x374ccd,_0x3dab9b)['then'](function(_0xc6bd){logger[_0x2450('0xc')](_0x2450('0xd'),_0x4456e5,_0x2450('0xe'));logger['debug'](_0x2450('0xf'),_0x4456e5,_0x2450('0xe'),JSON[_0x2450('0x10')](_0xc6bd));if(_0xc6bd[_0x2450('0x11')]){if(_0xc6bd[_0x2450('0x11')]['code']===0x1f4){logger[_0x2450('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x4456e5,_0xc6bd[_0x2450('0x11')][_0x2450('0x12')]);return _0x5a34b1(_0xc6bd[_0x2450('0x11')]['message']);}logger[_0x2450('0x11')](_0x2450('0xd'),_0x4456e5,_0xc6bd['error'][_0x2450('0x12')]);return _0x421134(_0xc6bd[_0x2450('0x11')][_0x2450('0x12')]);}else{logger[_0x2450('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x4456e5,_0x2450('0xe'));_0x421134(_0xc6bd['result']['message']);}})['catch'](function(_0xfb0b85){logger['error'](_0x2450('0xd'),_0x4456e5,_0xfb0b85);_0x5a34b1(_0xfb0b85);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7dd7317..fad427c 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xab66d9,_0x12e1be){var _0x23392a=function(_0x1c1794){while(--_0x1c1794){_0xab66d9['push'](_0xab66d9['shift']());}};_0x23392a(++_0x12e1be);}(_0xe706,0xa3));var _0x6e70=function(_0x2a1275,_0x20c2d2){_0x2a1275=_0x2a1275-0x0;var _0x2e4ed9=_0xe706[_0x2a1275];return _0x2e4ed9;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x506bde,_0x56bc1f){var _0x38a3b1=function(_0x2ffdaf){while(--_0x2ffdaf){_0x506bde['push'](_0x506bde['shift']());}};_0x38a3b1(++_0x56bc1f);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f2e6e,_0x74f56b){_0x4f2e6e=_0x4f2e6e-0x0;var _0x38d3de=_0xedd9[_0x4f2e6e];return _0x38d3de;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 81e3154..8726900 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 _0xa95d=['STRING','exports','INTEGER'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa95d,0x1d2));var _0xda95=function(_0x2b3dda,_0x46c98b){_0x2b3dda=_0x2b3dda-0x0;var _0x360cea=_0xa95d[_0x2b3dda];return _0x360cea;};'use strict';var Sequelize=require('sequelize');module[_0xda95('0x0')]={'penalty':{'type':Sequelize[_0xda95('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xda95('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xda95('0x2')]}}; \ No newline at end of file +var _0x49e8=['exports','INTEGER','sequelize'];(function(_0x48bd8f,_0x1475fc){var _0x1255f4=function(_0x11d55d){while(--_0x11d55d){_0x48bd8f['push'](_0x48bd8f['shift']());}};_0x1255f4(++_0x1475fc);}(_0x49e8,0x18e));var _0x849e=function(_0x285d34,_0x42dd2d){_0x285d34=_0x285d34-0x0;var _0x59e21d=_0x49e8[_0x285d34];return _0x59e21d;};'use strict';var Sequelize=require(_0x849e('0x0'));module[_0x849e('0x1')]={'penalty':{'type':Sequelize[_0x849e('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x849e('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 2a996c5..c41ab45 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 _0xa4e0=['path','rimraf','../../config/environment','exports','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2154c3,_0x573153){var _0x394f4d=function(_0x4266c1){while(--_0x4266c1){_0x2154c3['push'](_0x2154c3['shift']());}};_0x394f4d(++_0x573153);}(_0xa4e0,0xd2));var _0x0a4e=function(_0x6973bc,_0x3396dd){_0x6973bc=_0x6973bc-0x0;var _0x1168c5=_0xa4e0[_0x6973bc];return _0x1168c5;};'use strict';var _=require(_0x0a4e('0x0'));var util=require(_0x0a4e('0x1'));var logger=require(_0x0a4e('0x2'))(_0x0a4e('0x3'));var moment=require('moment');var BPromise=require(_0x0a4e('0x4'));var rp=require(_0x0a4e('0x5'));var fs=require('fs');var path=require(_0x0a4e('0x6'));var rimraf=require(_0x0a4e('0x7'));var config=require(_0x0a4e('0x8'));var attributes=require('./userFaxQueue.attributes');module[_0x0a4e('0x9')]=function(_0x5cf90c,_0x40b2c9){return _0x5cf90c['define'](_0x0a4e('0xa'),attributes,{'tableName':_0x0a4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe7d8=['path','../../config/environment','exports','define','UserFaxQueue','lodash','util','api','moment','bluebird','request-promise'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xe7d8,0x17b));var _0x8e7d=function(_0x44d9ab,_0x76bc69){_0x44d9ab=_0x44d9ab-0x0;var _0x31485e=_0xe7d8[_0x44d9ab];return _0x31485e;};'use strict';var _=require(_0x8e7d('0x0'));var util=require(_0x8e7d('0x1'));var logger=require('../../config/logger')(_0x8e7d('0x2'));var moment=require(_0x8e7d('0x3'));var BPromise=require(_0x8e7d('0x4'));var rp=require(_0x8e7d('0x5'));var fs=require('fs');var path=require(_0x8e7d('0x6'));var rimraf=require('rimraf');var config=require(_0x8e7d('0x7'));var attributes=require('./userFaxQueue.attributes');module[_0x8e7d('0x8')]=function(_0x147b4b,_0x240a22){return _0x147b4b[_0x8e7d('0x9')](_0x8e7d('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.rpc.js b/server/api/userFaxQueue/userFaxQueue.rpc.js index 3d29134..1f5cdb4 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 _0x53a5=['request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserFaxQueue,\x20%s,\x20%s'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0x53a5,0xaa));var _0x553a=function(_0x40dcc2,_0x473444){_0x40dcc2=_0x40dcc2-0x0;var _0x5f96a3=_0x53a5[_0x40dcc2];return _0x5f96a3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x553a('0x0'));var BPromise=require(_0x553a('0x1'));var rs=require(_0x553a('0x2'));var fs=require('fs');var Redis=require(_0x553a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x553a('0x4'));var logger=require(_0x553a('0x5'))(_0x553a('0x6'));var config=require(_0x553a('0x7'));var jayson=require(_0x553a('0x8'));var client=jayson[_0x553a('0x9')][_0x553a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc3f75f,_0x191a20,_0xac6b98){return new BPromise(function(_0x107a4d,_0x52b09c){return client[_0x553a('0xb')](_0xc3f75f,_0xac6b98)['then'](function(_0x5989cd){logger[_0x553a('0xc')](_0x553a('0xd'),_0x191a20,_0x553a('0xe'));logger[_0x553a('0xf')](_0x553a('0x10'),_0x191a20,_0x553a('0xe'),JSON[_0x553a('0x11')](_0x5989cd));if(_0x5989cd[_0x553a('0x12')]){if(_0x5989cd[_0x553a('0x12')][_0x553a('0x13')]===0x1f4){logger[_0x553a('0x12')](_0x553a('0xd'),_0x191a20,_0x5989cd[_0x553a('0x12')][_0x553a('0x14')]);return _0x52b09c(_0x5989cd[_0x553a('0x12')][_0x553a('0x14')]);}logger[_0x553a('0x12')](_0x553a('0xd'),_0x191a20,_0x5989cd[_0x553a('0x12')][_0x553a('0x14')]);return _0x107a4d(_0x5989cd['error']['message']);}else{logger[_0x553a('0xc')](_0x553a('0xd'),_0x191a20,_0x553a('0xe'));_0x107a4d(_0x5989cd[_0x553a('0x15')][_0x553a('0x14')]);}})[_0x553a('0x16')](function(_0x3539d4){logger[_0x553a('0x12')](_0x553a('0xd'),_0x191a20,_0x3539d4);_0x52b09c(_0x3539d4);});});} \ No newline at end of file +var _0x2d09=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d09,0x15d));var _0x92d0=function(_0x3e890e,_0x19c4f9){_0x3e890e=_0x3e890e-0x0;var _0x16b15a=_0x2d09[_0x3e890e];return _0x16b15a;};'use strict';var _=require(_0x92d0('0x0'));var util=require(_0x92d0('0x1'));var moment=require(_0x92d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x92d0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92d0('0x4'))['db'];var utils=require(_0x92d0('0x5'));var logger=require(_0x92d0('0x6'))(_0x92d0('0x7'));var config=require(_0x92d0('0x8'));var jayson=require(_0x92d0('0x9'));var client=jayson[_0x92d0('0xa')][_0x92d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33e348,_0x4c74e7,_0x4f3ce2){return new BPromise(function(_0x46bec2,_0x7d4587){return client[_0x92d0('0xc')](_0x33e348,_0x4f3ce2)[_0x92d0('0xd')](function(_0x31eda3){logger[_0x92d0('0xe')](_0x92d0('0xf'),_0x4c74e7,_0x92d0('0x10'));logger[_0x92d0('0x11')](_0x92d0('0x12'),_0x4c74e7,_0x92d0('0x10'),JSON[_0x92d0('0x13')](_0x31eda3));if(_0x31eda3[_0x92d0('0x14')]){if(_0x31eda3[_0x92d0('0x14')][_0x92d0('0x15')]===0x1f4){logger[_0x92d0('0x14')](_0x92d0('0xf'),_0x4c74e7,_0x31eda3['error'][_0x92d0('0x16')]);return _0x7d4587(_0x31eda3[_0x92d0('0x14')][_0x92d0('0x16')]);}logger[_0x92d0('0x14')](_0x92d0('0xf'),_0x4c74e7,_0x31eda3[_0x92d0('0x14')]['message']);return _0x46bec2(_0x31eda3[_0x92d0('0x14')][_0x92d0('0x16')]);}else{logger[_0x92d0('0xe')](_0x92d0('0xf'),_0x4c74e7,'request\x20sent');_0x46bec2(_0x31eda3['result'][_0x92d0('0x16')]);}})[_0x92d0('0x17')](function(_0x1c6c8d){logger[_0x92d0('0x14')](_0x92d0('0xf'),_0x4c74e7,_0x1c6c8d);_0x7d4587(_0x1c6c8d);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index fae2cde..2a72e44 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x1b173e,_0x4e709d){var _0x5d9d77=function(_0x28d33c){while(--_0x28d33c){_0x1b173e['push'](_0x1b173e['shift']());}};_0x5d9d77(++_0x4e709d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x544099,_0x372b30){_0x544099=_0x544099-0x0;var _0x20ab09=_0xcb91[_0x544099];return _0x20ab09;};'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(_0x4a0a13,_0x2aeb9b){var _0x831737=function(_0xa2eab9){while(--_0xa2eab9){_0x4a0a13['push'](_0x4a0a13['shift']());}};_0x831737(++_0x2aeb9b);}(_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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index dae893e..8af76e0 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 _0x64b0=['exports','INTEGER','sequelize'];(function(_0xfeb7e0,_0x1fe55c){var _0x171707=function(_0x15f675){while(--_0x15f675){_0xfeb7e0['push'](_0xfeb7e0['shift']());}};_0x171707(++_0x1fe55c);}(_0x64b0,0x74));var _0x064b=function(_0x66133d,_0x3cb3ea){_0x66133d=_0x66133d-0x0;var _0x3af9b9=_0x64b0[_0x66133d];return _0x3af9b9;};'use strict';var Sequelize=require(_0x064b('0x0'));module[_0x064b('0x1')]={'penalty':{'type':Sequelize[_0x064b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa63a=['exports'];(function(_0x25ec03,_0x31392a){var _0x2d8f89=function(_0x14eaef){while(--_0x14eaef){_0x25ec03['push'](_0x25ec03['shift']());}};_0x2d8f89(++_0x31392a);}(_0xa63a,0xa9));var _0xaa63=function(_0x560924,_0x258a47){_0x560924=_0x560924-0x0;var _0x5c694d=_0xa63a[_0x560924];return _0x5c694d;};'use strict';var Sequelize=require('sequelize');module[_0xaa63('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 2fe187d..79bb54d 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 _0xc2a1=['define','UserMailQueue','lodash','util','api','moment','bluebird','path','rimraf','./userMailQueue.attributes','exports'];(function(_0x2182c9,_0x152a52){var _0x258a41=function(_0x576ba0){while(--_0x576ba0){_0x2182c9['push'](_0x2182c9['shift']());}};_0x258a41(++_0x152a52);}(_0xc2a1,0x1e6));var _0x1c2a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xc2a1[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x1c2a('0x0'));var util=require(_0x1c2a('0x1'));var logger=require('../../config/logger')(_0x1c2a('0x2'));var moment=require(_0x1c2a('0x3'));var BPromise=require(_0x1c2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c2a('0x5'));var rimraf=require(_0x1c2a('0x6'));var config=require('../../config/environment');var attributes=require(_0x1c2a('0x7'));module[_0x1c2a('0x8')]=function(_0x281453,_0x1f669d){return _0x281453[_0x1c2a('0x9')](_0x1c2a('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x564f=['UserMailQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x41df26,_0x2c6553){var _0x349d11=function(_0x4c9dc3){while(--_0x4c9dc3){_0x41df26['push'](_0x41df26['shift']());}};_0x349d11(++_0x2c6553);}(_0x564f,0x17a));var _0xf564=function(_0x48f8d5,_0x34f897){_0x48f8d5=_0x48f8d5-0x0;var _0x47f9e5=_0x564f[_0x48f8d5];return _0x47f9e5;};'use strict';var _=require(_0xf564('0x0'));var util=require(_0xf564('0x1'));var logger=require(_0xf564('0x2'))(_0xf564('0x3'));var moment=require(_0xf564('0x4'));var BPromise=require(_0xf564('0x5'));var rp=require(_0xf564('0x6'));var fs=require('fs');var path=require(_0xf564('0x7'));var rimraf=require(_0xf564('0x8'));var config=require(_0xf564('0x9'));var attributes=require(_0xf564('0xa'));module[_0xf564('0xb')]=function(_0x2f57c7,_0x2ea510){return _0x2f57c7['define'](_0xf564('0xc'),attributes,{'tableName':'user_has_mail_queues','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 6dc4c53..4e5dda6 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 _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x264891,_0x162549){var _0x4968de=function(_0x5a4606){while(--_0x5a4606){_0x264891['push'](_0x264891['shift']());}};_0x4968de(++_0x162549);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3a4318,_0x13c6eb){_0x3a4318=_0x3a4318-0x0;var _0x36d746=_0xf3cd[_0x3a4318];return _0x36d746;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3bae2b,_0x43944f){var _0x3039ca=function(_0x134859){while(--_0x134859){_0x3bae2b['push'](_0x3bae2b['shift']());}};_0x3039ca(++_0x43944f);}(_0x34e8,0x12c));var _0x834e=function(_0x796a8b,_0x5ccb50){_0x796a8b=_0x796a8b-0x0;var _0x2c8973=_0x34e8[_0x796a8b];return _0x2c8973;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6da20a5..5a5bfe4 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 _0x9e07=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','post','isAuthenticated','sendUserNotification','exports'];(function(_0x1cab68,_0x35efaf){var _0x270c1c=function(_0x38f328){while(--_0x38f328){_0x1cab68['push'](_0x1cab68['shift']());}};_0x270c1c(++_0x35efaf);}(_0x9e07,0xc0));var _0x79e0=function(_0x4a76fd,_0x487fbb){_0x4a76fd=_0x4a76fd-0x0;var _0x56516b=_0x9e07[_0x4a76fd];return _0x56516b;};'use strict';var multer=require('multer');var util=require(_0x79e0('0x0'));var path=require('path');var timeout=require(_0x79e0('0x1'));var express=require(_0x79e0('0x2'));var router=express[_0x79e0('0x3')]();var fs_extra=require(_0x79e0('0x4'));var auth=require(_0x79e0('0x5'));var interaction=require(_0x79e0('0x6'));var config=require(_0x79e0('0x7'));var controller=require('./userNotification.controller');router[_0x79e0('0x8')]('/',auth[_0x79e0('0x9')](),controller[_0x79e0('0xa')]);module[_0x79e0('0xb')]=router; \ No newline at end of file +var _0x9841=['Router','../../components/auth/service','./userNotification.controller','post','exports','util','path','connect-timeout'];(function(_0x5490d1,_0x537c78){var _0x4b5633=function(_0x10a34c){while(--_0x10a34c){_0x5490d1['push'](_0x5490d1['shift']());}};_0x4b5633(++_0x537c78);}(_0x9841,0xbd));var _0x1984=function(_0x436836,_0x563455){_0x436836=_0x436836-0x0;var _0x5a310b=_0x9841[_0x436836];return _0x5a310b;};'use strict';var multer=require('multer');var util=require(_0x1984('0x0'));var path=require(_0x1984('0x1'));var timeout=require(_0x1984('0x2'));var express=require('express');var router=express[_0x1984('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1984('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x1984('0x5'));router[_0x1984('0x6')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x1984('0x7')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 8369bd5..72a38c6 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 _0xf15f=['sequelize','exports','TEXT','STRING'];(function(_0x3fd500,_0x25e875){var _0x4bee16=function(_0x1c67e6){while(--_0x1c67e6){_0x3fd500['push'](_0x3fd500['shift']());}};_0x4bee16(++_0x25e875);}(_0xf15f,0x78));var _0xff15=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf15f[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xff15('0x0'));module[_0xff15('0x1')]={'body':{'type':Sequelize[_0xff15('0x2')]},'senderName':{'type':Sequelize[_0xff15('0x3')]},'recipientsId':{'type':Sequelize[_0xff15('0x2')]},'recipientsDescription':{'type':Sequelize[_0xff15('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x6e92=['exports','STRING','BOOLEAN'];(function(_0x49e07e,_0x2d0733){var _0x5234db=function(_0x1d398d){while(--_0x1d398d){_0x49e07e['push'](_0x49e07e['shift']());}};_0x5234db(++_0x2d0733);}(_0x6e92,0x1bf));var _0x26e9=function(_0x407de4,_0x39b031){_0x407de4=_0x407de4-0x0;var _0x49b3a5=_0x6e92[_0x407de4];return _0x49b3a5;};'use strict';var Sequelize=require('sequelize');module[_0x26e9('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0x26e9('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x26e9('0x1')]},'beep':{'type':Sequelize[_0x26e9('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0d705ff..4b95880 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 _0x49a7=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','json','offset','undefined','limit','set','Content-Range','save','then','destroy','end','error','stack','name','send','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','chatqueue','faxqueue','smsqueue','voicequeue','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','UserNotification','create','emit','userNotification:send','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','catch','forEach','ids','includes','queue','replace','Queue','push','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x49e584,_0x2886f8){var _0x58b1be=function(_0x40397c){while(--_0x40397c){_0x49e584['push'](_0x49e584['shift']());}};_0x58b1be(++_0x2886f8);}(_0x49a7,0x1cc));var _0x749a=function(_0x1596af,_0x4f063c){_0x1596af=_0x1596af-0x0;var _0xc82b31=_0x49a7[_0x1596af];return _0xc82b31;};'use strict';var emlformat=require(_0x749a('0x0'));var rimraf=require(_0x749a('0x1'));var zipdir=require(_0x749a('0x2'));var jsonpatch=require(_0x749a('0x3'));var rp=require(_0x749a('0x4'));var moment=require(_0x749a('0x5'));var BPromise=require(_0x749a('0x6'));var Mustache=require(_0x749a('0x7'));var util=require(_0x749a('0x8'));var path=require(_0x749a('0x9'));var sox=require('sox');var csv=require(_0x749a('0xa'));var ejs=require(_0x749a('0xb'));var fs=require('fs');var fs_extra=require(_0x749a('0xc'));var _=require(_0x749a('0xd'));var squel=require(_0x749a('0xe'));var crypto=require(_0x749a('0xf'));var jsforce=require(_0x749a('0x10'));var deskjs=require(_0x749a('0x11'));var toCsv=require(_0x749a('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x749a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x749a('0x13'));var as=require(_0x749a('0x14'));var hardwareService=require(_0x749a('0x15'));var logger=require(_0x749a('0x16'))(_0x749a('0x17'));var utils=require(_0x749a('0x18'));var config=require(_0x749a('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x749a('0x1a'))['db'];config[_0x749a('0x1b')]=_[_0x749a('0x1c')](config[_0x749a('0x1b')],{'host':_0x749a('0x1d'),'port':0x18eb});var socket=require(_0x749a('0x1e'))(new Redis(config[_0x749a('0x1b')]));require(_0x749a('0x1f'))[_0x749a('0x20')](socket);function respondWithStatusCode(_0x5175dc,_0x2a1786){_0x2a1786=_0x2a1786||0xcc;return function(_0x243327){if(_0x243327){return _0x5175dc[_0x749a('0x21')](_0x2a1786);}return _0x5175dc[_0x749a('0x22')](_0x2a1786)['end']();};}function respondWithResult(_0x28cf00,_0x3203a9){_0x3203a9=_0x3203a9||0xc8;return function(_0x466d02){if(_0x466d02){return _0x28cf00['status'](_0x3203a9)[_0x749a('0x23')](_0x466d02);}};}function respondWithFilteredResult(_0x149875,_0x3e1036){return function(_0x49954b){if(_0x49954b){var _0x1fee72=typeof _0x3e1036[_0x749a('0x24')]===_0x749a('0x25')&&typeof _0x3e1036['limit']===_0x749a('0x25');var _0x19d7d8=_0x49954b['count'];var _0x35baf0=_0x1fee72?0x0:_0x3e1036[_0x749a('0x24')];var _0x282219=_0x1fee72?_0x49954b['count']:_0x3e1036['offset']+_0x3e1036[_0x749a('0x26')];var _0x183467;if(_0x282219>=_0x19d7d8){_0x282219=_0x19d7d8;_0x183467=0xc8;}else{_0x183467=0xce;}_0x149875[_0x749a('0x22')](_0x183467);return _0x149875[_0x749a('0x27')](_0x749a('0x28'),_0x35baf0+'-'+_0x282219+'/'+_0x19d7d8)[_0x749a('0x23')](_0x49954b);}return null;};}function patchUpdates(_0xbb70c0){return function(_0x54cb3c){try{jsonpatch['apply'](_0x54cb3c,_0xbb70c0,!![]);}catch(_0x5c6c58){return BPromise['reject'](_0x5c6c58);}return _0x54cb3c[_0x749a('0x29')]();};}function saveUpdates(_0x308416,_0x4290d7){return function(_0x1629c7){if(_0x1629c7){return _0x1629c7['update'](_0x308416)[_0x749a('0x2a')](function(_0x4cc17b){return _0x4cc17b;});}return null;};}function removeEntity(_0x40438a,_0x3e0213){return function(_0x503dac){if(_0x503dac){return _0x503dac[_0x749a('0x2b')]()[_0x749a('0x2a')](function(){_0x40438a[_0x749a('0x22')](0xcc)[_0x749a('0x2c')]();});}};}function handleEntityNotFound(_0x36aad9,_0x303250){return function(_0x5ed141){if(!_0x5ed141){_0x36aad9[_0x749a('0x21')](0x194);}return _0x5ed141;};}function handleError(_0x2c45f5,_0x2ada21){_0x2ada21=_0x2ada21||0x1f4;return function(_0x17d638){logger[_0x749a('0x2d')](_0x17d638[_0x749a('0x2e')]);if(_0x17d638[_0x749a('0x2f')]){delete _0x17d638[_0x749a('0x2f')];}_0x2c45f5[_0x749a('0x22')](_0x2ada21)[_0x749a('0x30')](_0x17d638);};}exports[_0x749a('0x31')]=function(_0x42c98d,_0x50ef2e,_0x1484ae){if(!_0x42c98d[_0x749a('0x32')][_0x749a('0x33')]('text')&&!_0x42c98d[_0x749a('0x32')]['hasOwnProperty'](_0x749a('0x34'))){throw new db[(_0x749a('0x35'))]['ValidationError'](_0x749a('0x36'));}else{if(_0x42c98d[_0x749a('0x32')][_0x749a('0x33')]('TemplateId')&&!_0x42c98d[_0x749a('0x32')]['hasOwnProperty'](_0x749a('0x37'))){throw new db[(_0x749a('0x35'))][(_0x749a('0x38'))](_0x749a('0x39'));}if(!_0x42c98d[_0x749a('0x32')][_0x749a('0x33')](_0x749a('0x3a'))){throw new db[(_0x749a('0x35'))][(_0x749a('0x38'))](_0x749a('0x3b'));}else{try{var _0x4eafc5=JSON['parse'](_0x42c98d[_0x749a('0x32')][_0x749a('0x3a')]);}catch(_0x4a68fc){logger[_0x749a('0x2d')](_0x4a68fc);throw new db[(_0x749a('0x35'))][(_0x749a('0x38'))]('Invalid\x20\x27recipients\x27\x20object');}var _0x1193de=[_0x749a('0x3c'),_0x749a('0x3d'),'mailqueue','openchannelqueue',_0x749a('0x3e'),_0x749a('0x3f'),'whatsappqueue','team',_0x749a('0x40')];if(_[_0x749a('0x41')](_0x4eafc5,function(_0x5a864f){return!_['includes'](_0x1193de,_0x5a864f[_0x749a('0x42')][_0x749a('0x43')]());})){throw new db[(_0x749a('0x35'))][(_0x749a('0x38'))](_0x749a('0x44'));}}}var _0x238b0d={};_0x238b0d[_0x749a('0x45')]=_0x42c98d[_0x749a('0x32')][_0x749a('0x33')]('senderName')?_0x42c98d[_0x749a('0x32')][_0x749a('0x45')]:_0x42c98d['user'][_0x749a('0x46')];_0x238b0d['recipientsDescription']=_['isEmpty'](_0x42c98d[_0x749a('0x32')]['recipientsDescription'])?null:_0x42c98d[_0x749a('0x32')][_0x749a('0x47')];_0x238b0d[_0x749a('0x48')]=_0x42c98d[_0x749a('0x32')][_0x749a('0x48')]||![];_0x238b0d[_0x749a('0x49')]=_0x42c98d['user']['id'];return getContent(_0x42c98d[_0x749a('0x32')])['then'](function(_0x466277){_0x238b0d[_0x749a('0x32')]=_0x466277;return getRecipients(_0x4eafc5);})['then'](function(_0x582f6c){_0x238b0d[_0x749a('0x4a')]=_[_0x749a('0x4b')](_0x582f6c)['join'](',');return db['sequelize']['transaction'](function(_0x2b26b4){return db[_0x749a('0x4c')][_0x749a('0x4d')](_0x238b0d,{'raw':!![],'transaction':_0x2b26b4})[_0x749a('0x2a')](function(_0x508e10){var _0x23dda6={'sender':_0x238b0d[_0x749a('0x45')],'description':_0x238b0d['recipientsDescription'],'content':_0x238b0d[_0x749a('0x32')],'beep':_0x238b0d[_0x749a('0x48')]};_0x582f6c['forEach'](function(_0xf1653){_0x23dda6['recipient']=_0xf1653;socket[_0x749a('0x4e')](_0x749a('0x4f'),_0x23dda6);});return _0x508e10;});});})[_0x749a('0x2a')](respondWithResult(_0x50ef2e,0xc9))['catch'](handleError(_0x50ef2e,null));};function getContent(_0x4940e7){return new BPromise(function(_0x155af9,_0x1348c7){if(_0x4940e7[_0x749a('0x50')]){_0x155af9(_0x4940e7['text']);return;}return db[_0x749a('0x51')][_0x749a('0x52')]({'attributes':['html'],'where':{'id':_0x4940e7[_0x749a('0x34')]},'raw':!![]})[_0x749a('0x2a')](function(_0x4a1726){if(!_0x4a1726)throw new db['Sequelize'][(_0x749a('0x38'))](_0x749a('0x53'));var _0x252a08=Mustache['render'](_0x4a1726[_0x749a('0x54')],_0x4940e7['view']);_0x155af9(_0x252a08);})[_0x749a('0x55')](function(_0x171956){_0x1348c7(_0x171956);});});}function getRecipients(_0x1aec05){return new BPromise(function(_0x456f5b,_0x19ed12){var _0x1f0c48=[];var _0x5b1658=[];_0x1aec05[_0x749a('0x56')](function(_0x15eb33){var _0x2f564c=_['startCase'](_0x15eb33[_0x749a('0x42')][_0x749a('0x43')]());if(_0x2f564c==='User'){_0x1f0c48=_['union'](_0x1f0c48,_0x15eb33[_0x749a('0x57')]);}else{if(_[_0x749a('0x58')](_0x2f564c,_0x749a('0x59')))_0x2f564c=_0x2f564c[_0x749a('0x5a')](_0x749a('0x59'),_0x749a('0x5b'));_0x15eb33[_0x749a('0x57')]['forEach'](function(_0x126a6c){_0x5b1658[_0x749a('0x5c')](getAgents(_0x2f564c,_0x126a6c));});}});return BPromise[_0x749a('0x5d')](_0x5b1658)[_0x749a('0x2a')](function(_0x179433){_0x1f0c48=_[_0x749a('0x5e')](_0x1f0c48,_[_0x749a('0x5f')](_0x179433));_0x456f5b(_0x1f0c48);})[_0x749a('0x55')](function(_0x3a8cce){_0x19ed12(_0x3a8cce);});});}function getAgents(_0x2560b6,_0x42c0de){return new BPromise(function(_0x56427a,_0x2813aa){return db[_0x2560b6][_0x749a('0x52')]({'where':{'id':_0x42c0de}})['then'](function(_0x4610ac){return _0x4610ac['getAgents']({'attributes':['id'],'raw':!![]})[_0x749a('0x2a')](function(_0x425141){var _0x1dbe1c=_[_0x749a('0x60')](_0x425141,'id');_0x56427a(_0x1dbe1c);});})[_0x749a('0x55')](function(_0x2a5956){_0x2813aa(_0x2a5956);});});} \ No newline at end of file +var _0x9074=['../../config/logger','api','../../config/environment','../../config/license/util','defaults','redis','./userNotification.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','sendUserNotification','text','body','hasOwnProperty','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','sortBy','sequelize','UserNotification','create','forEach','emit','userNotification:send','Template','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','model','User','ids','queue','replace','Queue','union','flatten','findOne','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x14b7c4,_0x3ce59c){var _0x18ef66=function(_0xdc96d1){while(--_0xdc96d1){_0x14b7c4['push'](_0x14b7c4['shift']());}};_0x18ef66(++_0x3ce59c);}(_0x9074,0x120));var _0x4907=function(_0x4799e5,_0x3d622f){_0x4799e5=_0x4799e5-0x0;var _0x4ed3e4=_0x9074[_0x4799e5];return _0x4ed3e4;};'use strict';var emlformat=require(_0x4907('0x0'));var rimraf=require(_0x4907('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4907('0x2'));var rp=require(_0x4907('0x3'));var moment=require(_0x4907('0x4'));var BPromise=require(_0x4907('0x5'));var Mustache=require(_0x4907('0x6'));var util=require(_0x4907('0x7'));var path=require(_0x4907('0x8'));var sox=require(_0x4907('0x9'));var csv=require(_0x4907('0xa'));var ejs=require(_0x4907('0xb'));var fs=require('fs');var fs_extra=require(_0x4907('0xc'));var _=require(_0x4907('0xd'));var squel=require(_0x4907('0xe'));var crypto=require(_0x4907('0xf'));var jsforce=require(_0x4907('0x10'));var deskjs=require(_0x4907('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4907('0x12'));var Papa=require('papaparse');var Redis=require(_0x4907('0x13'));var authService=require(_0x4907('0x14'));var qs=require(_0x4907('0x15'));var as=require(_0x4907('0x16'));var hardwareService=require(_0x4907('0x17'));var logger=require(_0x4907('0x18'))(_0x4907('0x19'));var utils=require('../../config/utils');var config=require(_0x4907('0x1a'));var licenseUtil=require(_0x4907('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x4907('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4907('0x1d')]));require(_0x4907('0x1e'))[_0x4907('0x1f')](socket);function respondWithStatusCode(_0x401333,_0x250f75){_0x250f75=_0x250f75||0xcc;return function(_0x33ac33){if(_0x33ac33){return _0x401333[_0x4907('0x20')](_0x250f75);}return _0x401333[_0x4907('0x21')](_0x250f75)[_0x4907('0x22')]();};}function respondWithResult(_0xee5e98,_0x3ff7a5){_0x3ff7a5=_0x3ff7a5||0xc8;return function(_0x1f8069){if(_0x1f8069){return _0xee5e98[_0x4907('0x21')](_0x3ff7a5)[_0x4907('0x23')](_0x1f8069);}};}function respondWithFilteredResult(_0x433517,_0xd9554a){return function(_0x2924c6){if(_0x2924c6){var _0x8072ea=typeof _0xd9554a[_0x4907('0x24')]==='undefined'&&typeof _0xd9554a[_0x4907('0x25')]===_0x4907('0x26');var _0x4e3dcc=_0x2924c6[_0x4907('0x27')];var _0x142be4=_0x8072ea?0x0:_0xd9554a[_0x4907('0x24')];var _0xddb107=_0x8072ea?_0x2924c6[_0x4907('0x27')]:_0xd9554a['offset']+_0xd9554a['limit'];var _0x290f4a;if(_0xddb107>=_0x4e3dcc){_0xddb107=_0x4e3dcc;_0x290f4a=0xc8;}else{_0x290f4a=0xce;}_0x433517['status'](_0x290f4a);return _0x433517[_0x4907('0x28')](_0x4907('0x29'),_0x142be4+'-'+_0xddb107+'/'+_0x4e3dcc)[_0x4907('0x23')](_0x2924c6);}return null;};}function patchUpdates(_0x4376a0){return function(_0x533800){try{jsonpatch[_0x4907('0x2a')](_0x533800,_0x4376a0,!![]);}catch(_0x40dc59){return BPromise[_0x4907('0x2b')](_0x40dc59);}return _0x533800['save']();};}function saveUpdates(_0x24492f,_0x22cf0b){return function(_0x544cc2){if(_0x544cc2){return _0x544cc2[_0x4907('0x2c')](_0x24492f)['then'](function(_0x2712be){return _0x2712be;});}return null;};}function removeEntity(_0x6b129c,_0x13ae43){return function(_0x40d8d0){if(_0x40d8d0){return _0x40d8d0[_0x4907('0x2d')]()[_0x4907('0x2e')](function(){_0x6b129c[_0x4907('0x21')](0xcc)[_0x4907('0x22')]();});}};}function handleEntityNotFound(_0x41b633,_0x372735){return function(_0x45deea){if(!_0x45deea){_0x41b633[_0x4907('0x20')](0x194);}return _0x45deea;};}function handleError(_0x128b8a,_0x203ec8){_0x203ec8=_0x203ec8||0x1f4;return function(_0x1a1b7e){logger['error'](_0x1a1b7e[_0x4907('0x2f')]);if(_0x1a1b7e[_0x4907('0x30')]){delete _0x1a1b7e[_0x4907('0x30')];}_0x128b8a[_0x4907('0x21')](_0x203ec8)[_0x4907('0x31')](_0x1a1b7e);};}exports[_0x4907('0x32')]=function(_0x34b4e5,_0x85b177,_0x2f31ad){if(!_0x34b4e5['body']['hasOwnProperty'](_0x4907('0x33'))&&!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('TemplateId')){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x38'));}else{if(_0x34b4e5['body'][_0x4907('0x35')](_0x4907('0x39'))&&!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('view')){throw new db['Sequelize'][(_0x4907('0x37'))](_0x4907('0x3a'));}if(!_0x34b4e5[_0x4907('0x34')][_0x4907('0x35')]('recipients')){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x3b'));}else{try{var _0x4a27b4=JSON[_0x4907('0x3c')](_0x34b4e5[_0x4907('0x34')][_0x4907('0x3d')]);}catch(_0x462d66){logger[_0x4907('0x3e')](_0x462d66);throw new db['Sequelize'][(_0x4907('0x37'))](_0x4907('0x3f'));}var _0x2c56bd=[_0x4907('0x40'),'faxqueue',_0x4907('0x41'),'openchannelqueue',_0x4907('0x42'),_0x4907('0x43'),_0x4907('0x44'),_0x4907('0x45'),'user'];if(_[_0x4907('0x46')](_0x4a27b4,function(_0x50f29a){return!_[_0x4907('0x47')](_0x2c56bd,_0x50f29a['model'][_0x4907('0x48')]());})){throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x49'));}}}var _0x2a2f2e={};_0x2a2f2e['senderName']=_0x34b4e5['body'][_0x4907('0x35')](_0x4907('0x4a'))?_0x34b4e5[_0x4907('0x34')][_0x4907('0x4a')]:_0x34b4e5[_0x4907('0x4b')][_0x4907('0x4c')];_0x2a2f2e[_0x4907('0x4d')]=_[_0x4907('0x4e')](_0x34b4e5[_0x4907('0x34')]['recipientsDescription'])?null:_0x34b4e5[_0x4907('0x34')][_0x4907('0x4d')];_0x2a2f2e['beep']=_0x34b4e5[_0x4907('0x34')][_0x4907('0x4f')]||![];_0x2a2f2e[_0x4907('0x50')]=_0x34b4e5[_0x4907('0x4b')]['id'];return getContent(_0x34b4e5[_0x4907('0x34')])[_0x4907('0x2e')](function(_0x5196f4){_0x2a2f2e[_0x4907('0x34')]=_0x5196f4;return getRecipients(_0x4a27b4);})[_0x4907('0x2e')](function(_0x18a590){_0x2a2f2e['recipientsId']=_[_0x4907('0x51')](_0x18a590)['join'](',');return db[_0x4907('0x52')]['transaction'](function(_0x4b4cfc){return db[_0x4907('0x53')][_0x4907('0x54')](_0x2a2f2e,{'raw':!![],'transaction':_0x4b4cfc})[_0x4907('0x2e')](function(_0x4b4301){var _0xc52b5a={'sender':_0x2a2f2e[_0x4907('0x4a')],'description':_0x2a2f2e[_0x4907('0x4d')],'content':_0x2a2f2e[_0x4907('0x34')],'beep':_0x2a2f2e['beep']};_0x18a590[_0x4907('0x55')](function(_0x48ce67){_0xc52b5a['recipient']=_0x48ce67;socket[_0x4907('0x56')](_0x4907('0x57'),_0xc52b5a);});return _0x4b4301;});});})[_0x4907('0x2e')](respondWithResult(_0x85b177,0xc9))['catch'](handleError(_0x85b177,null));};function getContent(_0x314b0e){return new BPromise(function(_0x2af8a9,_0x25abd4){if(_0x314b0e['text']){_0x2af8a9(_0x314b0e['text']);return;}return db[_0x4907('0x58')]['findOne']({'attributes':[_0x4907('0x59')],'where':{'id':_0x314b0e[_0x4907('0x39')]},'raw':!![]})['then'](function(_0x3cbfaa){if(!_0x3cbfaa)throw new db[(_0x4907('0x36'))][(_0x4907('0x37'))](_0x4907('0x5a'));var _0x44bf77=Mustache[_0x4907('0x5b')](_0x3cbfaa[_0x4907('0x59')],_0x314b0e['view']);_0x2af8a9(_0x44bf77);})[_0x4907('0x5c')](function(_0x3ccbd9){_0x25abd4(_0x3ccbd9);});});}function getRecipients(_0x54dbef){return new BPromise(function(_0x3bc19b,_0x1f91e2){var _0x24f2e7=[];var _0x270008=[];_0x54dbef['forEach'](function(_0x4c68e2){var _0x198394=_['startCase'](_0x4c68e2[_0x4907('0x5d')][_0x4907('0x48')]());if(_0x198394===_0x4907('0x5e')){_0x24f2e7=_['union'](_0x24f2e7,_0x4c68e2[_0x4907('0x5f')]);}else{if(_[_0x4907('0x47')](_0x198394,_0x4907('0x60')))_0x198394=_0x198394[_0x4907('0x61')]('queue',_0x4907('0x62'));_0x4c68e2[_0x4907('0x5f')][_0x4907('0x55')](function(_0x2b9da4){_0x270008['push'](getAgents(_0x198394,_0x2b9da4));});}});return BPromise['all'](_0x270008)[_0x4907('0x2e')](function(_0xfc5322){_0x24f2e7=_[_0x4907('0x63')](_0x24f2e7,_[_0x4907('0x64')](_0xfc5322));_0x3bc19b(_0x24f2e7);})[_0x4907('0x5c')](function(_0x1921ba){_0x1f91e2(_0x1921ba);});});}function getAgents(_0x22e52e,_0x9b4747){return new BPromise(function(_0x3a6ed0,_0x260872){return db[_0x22e52e][_0x4907('0x65')]({'where':{'id':_0x9b4747}})[_0x4907('0x2e')](function(_0x5eebee){return _0x5eebee[_0x4907('0x66')]({'attributes':['id'],'raw':!![]})['then'](function(_0x51e7b6){var _0x66870e=_[_0x4907('0x67')](_0x51e7b6,'id');_0x3a6ed0(_0x66870e);});})[_0x4907('0x5c')](function(_0x43934d){_0x260872(_0x43934d);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ecd247d..c3b0bde 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 _0x5681=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x262fad,_0x490151){var _0x48b332=function(_0xcb2d9b){while(--_0xcb2d9b){_0x262fad['push'](_0x262fad['shift']());}};_0x48b332(++_0x490151);}(_0x5681,0x1ea));var _0x1568=function(_0x5d9606,_0x53c05a){_0x5d9606=_0x5d9606-0x0;var _0x4ee8e1=_0x5681[_0x5d9606];return _0x4ee8e1;};'use strict';var EventEmitter=require(_0x1568('0x0'));var UserNotification=require(_0x1568('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x1568('0x2')](0x0);var events={'afterCreate':_0x1568('0x3'),'afterUpdate':_0x1568('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4bfe26){return function(_0x22b994,_0x427c27,_0x301774){UserNotificationEvents[_0x1568('0x5')](_0x4bfe26+':'+_0x22b994['id'],_0x22b994);UserNotificationEvents[_0x1568('0x5')](_0x4bfe26,_0x22b994);_0x301774(null);};}for(var e in events){if(events[_0x1568('0x6')](e)){var event=events[e];UserNotification[_0x1568('0x7')](e,emitEvent(event));}}module[_0x1568('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0xc08c=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','save','update','emit'];(function(_0x5cb36b,_0x22450a){var _0x58610d=function(_0x4dbee3){while(--_0x4dbee3){_0x5cb36b['push'](_0x5cb36b['shift']());}};_0x58610d(++_0x22450a);}(_0xc08c,0x152));var _0xcc08=function(_0x227378,_0x2073f2){_0x227378=_0x227378-0x0;var _0x502efe=_0xc08c[_0x227378];return _0x502efe;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xcc08('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xcc08('0x1')](0x0);var events={'afterCreate':_0xcc08('0x2'),'afterUpdate':_0xcc08('0x3'),'afterDestroy':'remove'};function emitEvent(_0x376191){return function(_0x444476,_0x54a8d0,_0x3caf87){UserNotificationEvents[_0xcc08('0x4')](_0x376191+':'+_0x444476['id'],_0x444476);UserNotificationEvents[_0xcc08('0x4')](_0x376191,_0x444476);_0x3caf87(null);};}for(var e in events){if(events[_0xcc08('0x5')](e)){var event=events[e];UserNotification[_0xcc08('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 016c061..42ade28 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 _0xeee6=['../../config/environment','./userNotification.attributes','exports','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x364863,_0x511c26){var _0x119850=function(_0x7c5028){while(--_0x7c5028){_0x364863['push'](_0x364863['shift']());}};_0x119850(++_0x511c26);}(_0xeee6,0x84));var _0x6eee=function(_0x1b5ec6,_0x519ee6){_0x1b5ec6=_0x1b5ec6-0x0;var _0x34334f=_0xeee6[_0x1b5ec6];return _0x34334f;};'use strict';var _=require(_0x6eee('0x0'));var util=require(_0x6eee('0x1'));var logger=require(_0x6eee('0x2'))('api');var moment=require(_0x6eee('0x3'));var BPromise=require(_0x6eee('0x4'));var rp=require(_0x6eee('0x5'));var fs=require('fs');var path=require(_0x6eee('0x6'));var rimraf=require(_0x6eee('0x7'));var config=require(_0x6eee('0x8'));var attributes=require(_0x6eee('0x9'));module[_0x6eee('0xa')]=function(_0x23e822,_0x2042b5){return _0x23e822['define'](_0x6eee('0xb'),attributes,{'tableName':_0x6eee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6eee('0xd')});}; \ No newline at end of file +var _0xc2e8=['rimraf','./userNotification.attributes','exports','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path'];(function(_0xcdeb92,_0x3605d7){var _0x12c4ce=function(_0x2249fa){while(--_0x2249fa){_0xcdeb92['push'](_0xcdeb92['shift']());}};_0x12c4ce(++_0x3605d7);}(_0xc2e8,0x70));var _0x8c2e=function(_0x45d98b,_0x2ed187){_0x45d98b=_0x45d98b-0x0;var _0x24d6ab=_0xc2e8[_0x45d98b];return _0x24d6ab;};'use strict';var _=require(_0x8c2e('0x0'));var util=require(_0x8c2e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8c2e('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c2e('0x3'));var fs=require('fs');var path=require(_0x8c2e('0x4'));var rimraf=require(_0x8c2e('0x5'));var config=require('../../config/environment');var attributes=require(_0x8c2e('0x6'));module[_0x8c2e('0x7')]=function(_0x2b784d,_0x4d1434){return _0x2b784d['define']('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8c2e('0x8')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 0e455bc..97f34d9 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 _0x82d9=['localhost','socket.io-emitter','./userNotification.socket','register','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x1d7d07,_0x6447fe){var _0x38c15c=function(_0x12200a){while(--_0x12200a){_0x1d7d07['push'](_0x1d7d07['shift']());}};_0x38c15c(++_0x6447fe);}(_0x82d9,0x185));var _0x982d=function(_0x2529c1,_0x1268f3){_0x2529c1=_0x2529c1-0x0;var _0x3f5bbe=_0x82d9[_0x2529c1];return _0x3f5bbe;};'use strict';var _=require(_0x982d('0x0'));var util=require(_0x982d('0x1'));var moment=require(_0x982d('0x2'));var BPromise=require('bluebird');var rs=require(_0x982d('0x3'));var fs=require('fs');var Redis=require(_0x982d('0x4'));var db=require(_0x982d('0x5'))['db'];var utils=require(_0x982d('0x6'));var logger=require('../../config/logger')(_0x982d('0x7'));var config=require(_0x982d('0x8'));var jayson=require(_0x982d('0x9'));var client=jayson[_0x982d('0xa')][_0x982d('0xb')]({'port':0x232a});config['redis']=_[_0x982d('0xc')](config[_0x982d('0xd')],{'host':_0x982d('0xe'),'port':0x18eb});var socket=require(_0x982d('0xf'))(new Redis(config['redis']));require(_0x982d('0x10'))[_0x982d('0x11')](socket);function respondWithRpcPromise(_0x3b406b,_0xdef55d,_0x1362ae){return new BPromise(function(_0x29c6aa,_0x529fb6){return client[_0x982d('0x12')](_0x3b406b,_0x1362ae)[_0x982d('0x13')](function(_0x198e55){logger['info'](_0x982d('0x14'),_0xdef55d,_0x982d('0x15'));logger[_0x982d('0x16')](_0x982d('0x17'),_0xdef55d,_0x982d('0x15'),JSON[_0x982d('0x18')](_0x198e55));if(_0x198e55['error']){if(_0x198e55[_0x982d('0x19')][_0x982d('0x1a')]===0x1f4){logger['error'](_0x982d('0x14'),_0xdef55d,_0x198e55[_0x982d('0x19')][_0x982d('0x1b')]);return _0x529fb6(_0x198e55[_0x982d('0x19')][_0x982d('0x1b')]);}logger[_0x982d('0x19')](_0x982d('0x14'),_0xdef55d,_0x198e55[_0x982d('0x19')][_0x982d('0x1b')]);return _0x29c6aa(_0x198e55[_0x982d('0x19')]['message']);}else{logger[_0x982d('0x1c')]('UserNotification,\x20%s,\x20%s',_0xdef55d,_0x982d('0x15'));_0x29c6aa(_0x198e55[_0x982d('0x1d')][_0x982d('0x1b')]);}})[_0x982d('0x1e')](function(_0x5dd67a){logger['error']('UserNotification,\x20%s,\x20%s',_0xdef55d,_0x5dd67a);_0x529fb6(_0x5dd67a);});});} \ No newline at end of file +var _0xef08=['then','info','request\x20sent','UserNotification,\x20%s,\x20%s,\x20%s','error','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','localhost','socket.io-emitter','./userNotification.socket','request'];(function(_0x5184d1,_0x12d323){var _0x1a8857=function(_0x31b75c){while(--_0x31b75c){_0x5184d1['push'](_0x5184d1['shift']());}};_0x1a8857(++_0x12d323);}(_0xef08,0x104));var _0x8ef0=function(_0x55fe92,_0x1dfe8d){_0x55fe92=_0x55fe92-0x0;var _0x2bfae6=_0xef08[_0x55fe92];return _0x2bfae6;};'use strict';var _=require(_0x8ef0('0x0'));var util=require(_0x8ef0('0x1'));var moment=require(_0x8ef0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8ef0('0x3'))['db'];var utils=require(_0x8ef0('0x4'));var logger=require(_0x8ef0('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ef0('0x6')][_0x8ef0('0x7')]({'port':0x232a});config[_0x8ef0('0x8')]=_['defaults'](config['redis'],{'host':_0x8ef0('0x9'),'port':0x18eb});var socket=require(_0x8ef0('0xa'))(new Redis(config[_0x8ef0('0x8')]));require(_0x8ef0('0xb'))['register'](socket);function respondWithRpcPromise(_0xfb0073,_0x4914c6,_0x36cc66){return new BPromise(function(_0x48cb0e,_0x175355){return client[_0x8ef0('0xc')](_0xfb0073,_0x36cc66)[_0x8ef0('0xd')](function(_0x8d86bf){logger[_0x8ef0('0xe')]('UserNotification,\x20%s,\x20%s',_0x4914c6,_0x8ef0('0xf'));logger['debug'](_0x8ef0('0x10'),_0x4914c6,_0x8ef0('0xf'),JSON['stringify'](_0x8d86bf));if(_0x8d86bf[_0x8ef0('0x11')]){if(_0x8d86bf[_0x8ef0('0x11')]['code']===0x1f4){logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x4914c6,_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);return _0x175355(_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);}logger[_0x8ef0('0x11')](_0x8ef0('0x12'),_0x4914c6,_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);return _0x48cb0e(_0x8d86bf[_0x8ef0('0x11')][_0x8ef0('0x13')]);}else{logger[_0x8ef0('0xe')](_0x8ef0('0x12'),_0x4914c6,_0x8ef0('0xf'));_0x48cb0e(_0x8d86bf['result']['message']);}})[_0x8ef0('0x14')](function(_0x2bcb1f){logger[_0x8ef0('0x11')]('UserNotification,\x20%s,\x20%s',_0x4914c6,_0x2bcb1f);_0x175355(_0x2bcb1f);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index fd5fdb0..2d2c2db 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 _0xc8b9=['update','emit','removeListener','register','length','userNotification:','./userNotification.events','save','remove'];(function(_0x4cdbb2,_0x7c8b5a){var _0x2f6dba=function(_0x21ac2d){while(--_0x21ac2d){_0x4cdbb2['push'](_0x4cdbb2['shift']());}};_0x2f6dba(++_0x7c8b5a);}(_0xc8b9,0x96));var _0x9c8b=function(_0x21d3ec,_0x9433d4){_0x21d3ec=_0x21d3ec-0x0;var _0x4ae10a=_0xc8b9[_0x21d3ec];return _0x4ae10a;};'use strict';var UserNotificationEvents=require(_0x9c8b('0x0'));var events=[_0x9c8b('0x1'),_0x9c8b('0x2'),_0x9c8b('0x3')];function createListener(_0x15b63a,_0xbd3de3){return function(_0x507ba2){_0xbd3de3[_0x9c8b('0x4')](_0x15b63a,_0x507ba2);};}function removeListener(_0x384f0b,_0x32e6dd){return function(){UserNotificationEvents[_0x9c8b('0x5')](_0x384f0b,_0x32e6dd);};}exports[_0x9c8b('0x6')]=function(_0x4f978e){for(var _0x41e5ae=0x0,_0x3ebf0b=events[_0x9c8b('0x7')];_0x41e5ae<_0x3ebf0b;_0x41e5ae++){var _0x32d036=events[_0x41e5ae];var _0x2fb01f=createListener(_0x9c8b('0x8')+_0x32d036,_0x4f978e);UserNotificationEvents['on'](_0x32d036,_0x2fb01f);}}; \ No newline at end of file +var _0x44c4=['emit','removeListener','register','length','userNotification:','./userNotification.events','remove','update'];(function(_0x4883eb,_0xd40de7){var _0x3e1946=function(_0x1daff2){while(--_0x1daff2){_0x4883eb['push'](_0x4883eb['shift']());}};_0x3e1946(++_0xd40de7);}(_0x44c4,0x11d));var _0x444c=function(_0x53ea9f,_0xad6e7c){_0x53ea9f=_0x53ea9f-0x0;var _0x5bd94e=_0x44c4[_0x53ea9f];return _0x5bd94e;};'use strict';var UserNotificationEvents=require(_0x444c('0x0'));var events=['save',_0x444c('0x1'),_0x444c('0x2')];function createListener(_0x3b9fa6,_0xdd6e6f){return function(_0x5c3726){_0xdd6e6f[_0x444c('0x3')](_0x3b9fa6,_0x5c3726);};}function removeListener(_0x57a3e0,_0x443d3c){return function(){UserNotificationEvents[_0x444c('0x4')](_0x57a3e0,_0x443d3c);};}exports[_0x444c('0x5')]=function(_0x1f7657){for(var _0xa9709c=0x0,_0x5aa605=events[_0x444c('0x6')];_0xa9709c<_0x5aa605;_0xa9709c++){var _0xd123f9=events[_0xa9709c];var _0xe04a7c=createListener(_0x444c('0x7')+_0xd123f9,_0x1f7657);UserNotificationEvents['on'](_0xd123f9,_0xe04a7c);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 7ee4066..9ef083c 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x44b0ff,_0x5d6bcc){var _0x4a04b9=function(_0x398744){while(--_0x398744){_0x44b0ff['push'](_0x44b0ff['shift']());}};_0x4a04b9(++_0x5d6bcc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1cfa4e,_0x1f0832){var _0x2de52b=function(_0x17292a){while(--_0x17292a){_0x1cfa4e['push'](_0x1cfa4e['shift']());}};_0x2de52b(++_0x1f0832);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 102fd5e..90759bd 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 _0x386f=['sequelize','exports','INTEGER'];(function(_0x5c8e6f,_0x1488a1){var _0x42948b=function(_0x944a23){while(--_0x944a23){_0x5c8e6f['push'](_0x5c8e6f['shift']());}};_0x42948b(++_0x1488a1);}(_0x386f,0x11a));var _0xf386=function(_0x2a1054,_0x50362d){_0x2a1054=_0x2a1054-0x0;var _0x3ec74f=_0x386f[_0x2a1054];return _0x3ec74f;};'use strict';var Sequelize=require(_0xf386('0x0'));module[_0xf386('0x1')]={'penalty':{'type':Sequelize[_0xf386('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbad5=['INTEGER','sequelize'];(function(_0x39d4c6,_0x5ed7d5){var _0xfca84c=function(_0x1277b6){while(--_0x1277b6){_0x39d4c6['push'](_0x39d4c6['shift']());}};_0xfca84c(++_0x5ed7d5);}(_0xbad5,0xa5));var _0x5bad=function(_0x5c2bb5,_0x5d11be){_0x5c2bb5=_0x5c2bb5-0x0;var _0x37eeb5=_0xbad5[_0x5c2bb5];return _0x37eeb5;};'use strict';var Sequelize=require(_0x5bad('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x5bad('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 b210db1..7ef12b1 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 _0xe2e6=['path','rimraf','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x410af6,_0x545b9e){var _0x392507=function(_0x45924a){while(--_0x45924a){_0x410af6['push'](_0x410af6['shift']());}};_0x392507(++_0x545b9e);}(_0xe2e6,0xd9));var _0x6e2e=function(_0x5944e9,_0xf3da60){_0x5944e9=_0x5944e9-0x0;var _0x1098b8=_0xe2e6[_0x5944e9];return _0x1098b8;};'use strict';var _=require(_0x6e2e('0x0'));var util=require(_0x6e2e('0x1'));var logger=require(_0x6e2e('0x2'))(_0x6e2e('0x3'));var moment=require(_0x6e2e('0x4'));var BPromise=require(_0x6e2e('0x5'));var rp=require(_0x6e2e('0x6'));var fs=require('fs');var path=require(_0x6e2e('0x7'));var rimraf=require(_0x6e2e('0x8'));var config=require('../../config/environment');var attributes=require(_0x6e2e('0x9'));module[_0x6e2e('0xa')]=function(_0x19a41e,_0x142dd7){return _0x19a41e[_0x6e2e('0xb')](_0x6e2e('0xc'),attributes,{'tableName':_0x6e2e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57b8=['util','../../config/logger','moment','bluebird','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x2cb71c,_0x503573){var _0x9c5a36=function(_0x34bf5a){while(--_0x34bf5a){_0x2cb71c['push'](_0x2cb71c['shift']());}};_0x9c5a36(++_0x503573);}(_0x57b8,0x113));var _0x857b=function(_0x497aae,_0x824f7f){_0x497aae=_0x497aae-0x0;var _0x28d670=_0x57b8[_0x497aae];return _0x28d670;};'use strict';var _=require('lodash');var util=require(_0x857b('0x0'));var logger=require(_0x857b('0x1'))('api');var moment=require(_0x857b('0x2'));var BPromise=require(_0x857b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x857b('0x4'));var config=require(_0x857b('0x5'));var attributes=require(_0x857b('0x6'));module[_0x857b('0x7')]=function(_0x41db17,_0x389bfe){return _0x41db17[_0x857b('0x8')](_0x857b('0x9'),attributes,{'tableName':_0x857b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 5e7c4b1..fe1b852 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 _0x689f=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis'];(function(_0x589c2c,_0x229428){var _0xd46bd4=function(_0x303292){while(--_0x303292){_0x589c2c['push'](_0x589c2c['shift']());}};_0xd46bd4(++_0x229428);}(_0x689f,0x150));var _0xf689=function(_0x5ad546,_0x40bcea){_0x5ad546=_0x5ad546-0x0;var _0x2750be=_0x689f[_0x5ad546];return _0x2750be;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf689('0x0'));var BPromise=require(_0xf689('0x1'));var rs=require(_0xf689('0x2'));var fs=require('fs');var Redis=require(_0xf689('0x3'));var db=require(_0xf689('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf689('0x5'))(_0xf689('0x6'));var config=require('../../config/environment');var jayson=require(_0xf689('0x7'));var client=jayson[_0xf689('0x8')][_0xf689('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x307b94,_0x49bb7f,_0x175805){return new BPromise(function(_0x2ab704,_0x5c3fbc){return client[_0xf689('0xa')](_0x307b94,_0x175805)['then'](function(_0x31a399){logger[_0xf689('0xb')](_0xf689('0xc'),_0x49bb7f,_0xf689('0xd'));logger[_0xf689('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x49bb7f,'request\x20sent',JSON[_0xf689('0xf')](_0x31a399));if(_0x31a399[_0xf689('0x10')]){if(_0x31a399[_0xf689('0x10')]['code']===0x1f4){logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x31a399[_0xf689('0x10')][_0xf689('0x11')]);return _0x5c3fbc(_0x31a399[_0xf689('0x10')][_0xf689('0x11')]);}logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x31a399['error'][_0xf689('0x11')]);return _0x2ab704(_0x31a399[_0xf689('0x10')]['message']);}else{logger[_0xf689('0xb')](_0xf689('0xc'),_0x49bb7f,_0xf689('0xd'));_0x2ab704(_0x31a399[_0xf689('0x12')][_0xf689('0x11')]);}})[_0xf689('0x13')](function(_0x3580f6){logger[_0xf689('0x10')](_0xf689('0xc'),_0x49bb7f,_0x3580f6);_0x5c3fbc(_0x3580f6);});});} \ No newline at end of file +var _0x8a78=['rpc','jayson/promise','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x8a78,0x158));var _0x88a7=function(_0x13ed69,_0x229161){_0x13ed69=_0x13ed69-0x0;var _0x50c72e=_0x8a78[_0x13ed69];return _0x50c72e;};'use strict';var _=require(_0x88a7('0x0'));var util=require(_0x88a7('0x1'));var moment=require(_0x88a7('0x2'));var BPromise=require(_0x88a7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x88a7('0x4'));var db=require(_0x88a7('0x5'))['db'];var utils=require(_0x88a7('0x6'));var logger=require(_0x88a7('0x7'))(_0x88a7('0x8'));var config=require('../../config/environment');var jayson=require(_0x88a7('0x9'));var client=jayson['client'][_0x88a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x443560,_0x118b71,_0x38201b){return new BPromise(function(_0x585571,_0xd25e66){return client[_0x88a7('0xb')](_0x443560,_0x38201b)[_0x88a7('0xc')](function(_0x2ef7f8){logger[_0x88a7('0xd')](_0x88a7('0xe'),_0x118b71,_0x88a7('0xf'));logger[_0x88a7('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x118b71,_0x88a7('0xf'),JSON[_0x88a7('0x11')](_0x2ef7f8));if(_0x2ef7f8['error']){if(_0x2ef7f8[_0x88a7('0x12')]['code']===0x1f4){logger[_0x88a7('0x12')](_0x88a7('0xe'),_0x118b71,_0x2ef7f8[_0x88a7('0x12')]['message']);return _0xd25e66(_0x2ef7f8[_0x88a7('0x12')][_0x88a7('0x13')]);}logger[_0x88a7('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x118b71,_0x2ef7f8[_0x88a7('0x12')][_0x88a7('0x13')]);return _0x585571(_0x2ef7f8['error'][_0x88a7('0x13')]);}else{logger['info'](_0x88a7('0xe'),_0x118b71,_0x88a7('0xf'));_0x585571(_0x2ef7f8[_0x88a7('0x14')][_0x88a7('0x13')]);}})[_0x88a7('0x15')](function(_0x38f265){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x118b71,_0x38f265);_0xd25e66(_0x38f265);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 88a6f6c..6a12ad4 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 _0xe4be=['../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/sections','/:id/resources','create','post','/:id/clone','clone','addSections','update','delete','removeSections','removeResources','multer','util','path','express','Router','fs-extra'];(function(_0xaf2313,_0x5d01e1){var _0x239cd2=function(_0x14ed90){while(--_0x14ed90){_0xaf2313['push'](_0xaf2313['shift']());}};_0x239cd2(++_0x5d01e1);}(_0xe4be,0xda));var _0xee4b=function(_0x80ed0a,_0xf4b7e6){_0x80ed0a=_0x80ed0a-0x0;var _0x221013=_0xe4be[_0x80ed0a];return _0x221013;};'use strict';var multer=require(_0xee4b('0x0'));var util=require(_0xee4b('0x1'));var path=require(_0xee4b('0x2'));var timeout=require('connect-timeout');var express=require(_0xee4b('0x3'));var router=express[_0xee4b('0x4')]();var fs_extra=require(_0xee4b('0x5'));var auth=require(_0xee4b('0x6'));var interaction=require(_0xee4b('0x7'));var config=require(_0xee4b('0x8'));var controller=require(_0xee4b('0x9'));router[_0xee4b('0xa')]('/',auth['isAuthenticated'](),controller[_0xee4b('0xb')]);router[_0xee4b('0xa')](_0xee4b('0xc'),auth[_0xee4b('0xd')](),controller[_0xee4b('0xe')]);router['get'](_0xee4b('0xf'),auth[_0xee4b('0xd')](),controller[_0xee4b('0x10')]);router[_0xee4b('0xa')](_0xee4b('0x11'),auth['isAuthenticated'](),controller['getSections']);router['get'](_0xee4b('0x12'),auth[_0xee4b('0xd')](),controller['getResources']);router['post']('/',auth[_0xee4b('0xd')](),controller[_0xee4b('0x13')]);router[_0xee4b('0x14')](_0xee4b('0x15'),auth['isAuthenticated'](),controller[_0xee4b('0x16')]);router[_0xee4b('0x14')](_0xee4b('0x11'),auth['isAuthenticated'](),controller[_0xee4b('0x17')]);router[_0xee4b('0x14')](_0xee4b('0x12'),auth[_0xee4b('0xd')](),controller['addResources']);router['put'](_0xee4b('0xf'),auth['isAuthenticated'](),controller[_0xee4b('0x18')]);router['delete'](_0xee4b('0xf'),auth[_0xee4b('0xd')](),controller['destroy']);router[_0xee4b('0x19')]('/:id/sections',auth[_0xee4b('0xd')](),controller[_0xee4b('0x1a')]);router[_0xee4b('0x19')](_0xee4b('0x12'),auth[_0xee4b('0xd')](),controller[_0xee4b('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x7b9d=['../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xa85690,_0x2d449f){var _0x41bfc1=function(_0x3bf50f){while(--_0x3bf50f){_0xa85690['push'](_0xa85690['shift']());}};_0x41bfc1(++_0x2d449f);}(_0x7b9d,0xa1));var _0xd7b9=function(_0xfd80d5,_0x303f80){_0xfd80d5=_0xfd80d5-0x0;var _0xeb957d=_0x7b9d[_0xfd80d5];return _0xeb957d;};'use strict';var multer=require(_0xd7b9('0x0'));var util=require(_0xd7b9('0x1'));var path=require(_0xd7b9('0x2'));var timeout=require(_0xd7b9('0x3'));var express=require(_0xd7b9('0x4'));var router=express[_0xd7b9('0x5')]();var fs_extra=require(_0xd7b9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd7b9('0x7'));var config=require(_0xd7b9('0x8'));var controller=require('./userProfile.controller');router[_0xd7b9('0x9')]('/',auth[_0xd7b9('0xa')](),controller['index']);router['get'](_0xd7b9('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xd7b9('0xc'),auth['isAuthenticated'](),controller[_0xd7b9('0xd')]);router[_0xd7b9('0x9')](_0xd7b9('0xe'),auth['isAuthenticated'](),controller['getSections']);router['get'](_0xd7b9('0xf'),auth[_0xd7b9('0xa')](),controller[_0xd7b9('0x10')]);router[_0xd7b9('0x11')]('/',auth[_0xd7b9('0xa')](),controller[_0xd7b9('0x12')]);router[_0xd7b9('0x11')](_0xd7b9('0x13'),auth['isAuthenticated'](),controller[_0xd7b9('0x14')]);router[_0xd7b9('0x11')](_0xd7b9('0xe'),auth['isAuthenticated'](),controller[_0xd7b9('0x15')]);router[_0xd7b9('0x11')]('/:id/resources',auth[_0xd7b9('0xa')](),controller['addResources']);router[_0xd7b9('0x16')](_0xd7b9('0xc'),auth[_0xd7b9('0xa')](),controller[_0xd7b9('0x17')]);router[_0xd7b9('0x18')](_0xd7b9('0xc'),auth['isAuthenticated'](),controller[_0xd7b9('0x19')]);router['delete'](_0xd7b9('0xe'),auth[_0xd7b9('0xa')](),controller[_0xd7b9('0x1a')]);router['delete'](_0xd7b9('0xf'),auth[_0xd7b9('0xa')](),controller['removeResources']);module[_0xd7b9('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 682f0c8..f46a631 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 _0xa014=['join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','crudPermissions'];(function(_0x30149d,_0x263b5c){var _0x41732c=function(_0x6ff1b0){while(--_0x6ff1b0){_0x30149d['push'](_0x30149d['shift']());}};_0x41732c(++_0x263b5c);}(_0xa014,0x11c));var _0x4a01=function(_0x3589f4,_0x60e9cc){_0x3589f4=_0x3589f4-0x0;var _0x4d3a18=_0xa014[_0x3589f4];return _0x4d3a18;};'use strict';var Sequelize=require(_0x4a01('0x0'));module[_0x4a01('0x1')]={'name':{'type':Sequelize[_0x4a01('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x4a01('0x2')],'set':function(_0x18b595){this['setDataValue'](_0x4a01('0x3'),_0x18b595?_0x18b595[_0x4a01('0x4')](''):[]);},'get':function(){return this[_0x4a01('0x5')](_0x4a01('0x3'))?this[_0x4a01('0x5')](_0x4a01('0x3'))[_0x4a01('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x4a01('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4a01('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x49b1=['split','STRING','BOOLEAN','sequelize','exports','crudPermissions'];(function(_0x36dfbd,_0x5bfe2d){var _0x4ecad9=function(_0x5230da){while(--_0x5230da){_0x36dfbd['push'](_0x36dfbd['shift']());}};_0x4ecad9(++_0x5bfe2d);}(_0x49b1,0x69));var _0x149b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x49b1[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x149b('0x0'));module[_0x149b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1e64b5){this['setDataValue']('crudPermissions',_0x1e64b5?_0x1e64b5['join'](''):[]);},'get':function(){return this['getDataValue'](_0x149b('0x2'))?this['getDataValue'](_0x149b('0x2'))[_0x149b('0x3')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x149b('0x4')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x149b('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x149b('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 92764b7..3fa5fc1 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 _0xc475=['userProfileId','Resources','update','describe','addSections','push','removeSections','ids','getSections','enabled','isEmpty','subsections','includes','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','removeResources','getResources','section','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','localhost','socket.io-emitter','redis','status','end','json','undefined','limit','count','offset','set','Content-Range','save','destroy','then','sendStatus','error','stack','name','send','map','UserProfile','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','rawAttributes','include','find','create','body','clone','params','get','omit','updatedAt','crudPermissions','createdAt','transaction','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId'];(function(_0x5124c5,_0x5bf687){var _0x155c78=function(_0x512a92){while(--_0x512a92){_0x5124c5['push'](_0x5124c5['shift']());}};_0x155c78(++_0x5bf687);}(_0xc475,0x8a));var _0x5c47=function(_0x4bf895,_0x996dcd){_0x4bf895=_0x4bf895-0x0;var _0x3ff8c2=_0xc475[_0x4bf895];return _0x3ff8c2;};'use strict';var emlformat=require(_0x5c47('0x0'));var rimraf=require(_0x5c47('0x1'));var zipdir=require(_0x5c47('0x2'));var jsonpatch=require(_0x5c47('0x3'));var rp=require(_0x5c47('0x4'));var moment=require(_0x5c47('0x5'));var BPromise=require(_0x5c47('0x6'));var Mustache=require(_0x5c47('0x7'));var util=require(_0x5c47('0x8'));var path=require(_0x5c47('0x9'));var sox=require(_0x5c47('0xa'));var csv=require(_0x5c47('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c47('0xc'));var _=require(_0x5c47('0xd'));var squel=require(_0x5c47('0xe'));var crypto=require(_0x5c47('0xf'));var jsforce=require(_0x5c47('0x10'));var deskjs=require(_0x5c47('0x11'));var toCsv=require(_0x5c47('0xb'));var querystring=require('querystring');var Papa=require(_0x5c47('0x12'));var Redis=require(_0x5c47('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x5c47('0x14'));var as=require(_0x5c47('0x15'));var hardwareService=require(_0x5c47('0x16'));var logger=require(_0x5c47('0x17'))(_0x5c47('0x18'));var utils=require(_0x5c47('0x19'));var config=require(_0x5c47('0x1a'));var licenseUtil=require(_0x5c47('0x1b'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x5c47('0x1c'),'port':0x18eb});var socket=require(_0x5c47('0x1d'))(new Redis(config[_0x5c47('0x1e')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x29dd7e,_0x1c5696){_0x1c5696=_0x1c5696||0xcc;return function(_0x5251be){if(_0x5251be){return _0x29dd7e['sendStatus'](_0x1c5696);}return _0x29dd7e[_0x5c47('0x1f')](_0x1c5696)[_0x5c47('0x20')]();};}function respondWithResult(_0x477b94,_0x5bae07){_0x5bae07=_0x5bae07||0xc8;return function(_0x12da3b){if(_0x12da3b){return _0x477b94[_0x5c47('0x1f')](_0x5bae07)[_0x5c47('0x21')](_0x12da3b);}};}function respondWithFilteredResult(_0x306e96,_0x136594){return function(_0x19744f){if(_0x19744f){var _0xe6ed21=typeof _0x136594['offset']===_0x5c47('0x22')&&typeof _0x136594[_0x5c47('0x23')]===_0x5c47('0x22');var _0x3eaad8=_0x19744f[_0x5c47('0x24')];var _0x193b0a=_0xe6ed21?0x0:_0x136594[_0x5c47('0x25')];var _0x546e76=_0xe6ed21?_0x19744f[_0x5c47('0x24')]:_0x136594[_0x5c47('0x25')]+_0x136594[_0x5c47('0x23')];var _0xc5e140;if(_0x546e76>=_0x3eaad8){_0x546e76=_0x3eaad8;_0xc5e140=0xc8;}else{_0xc5e140=0xce;}_0x306e96['status'](_0xc5e140);return _0x306e96[_0x5c47('0x26')](_0x5c47('0x27'),_0x193b0a+'-'+_0x546e76+'/'+_0x3eaad8)[_0x5c47('0x21')](_0x19744f);}return null;};}function patchUpdates(_0x51692b){return function(_0x2b04dc){try{jsonpatch['apply'](_0x2b04dc,_0x51692b,!![]);}catch(_0x10c97d){return BPromise['reject'](_0x10c97d);}return _0x2b04dc[_0x5c47('0x28')]();};}function saveUpdates(_0x31103a,_0x3884d3){return function(_0x9b0418){if(_0x9b0418){return _0x9b0418['update'](_0x31103a)['then'](function(_0x1dc7f1){return _0x1dc7f1;});}return null;};}function removeEntity(_0x55102c,_0x51f2be){return function(_0x2ac1f5){if(_0x2ac1f5){return _0x2ac1f5[_0x5c47('0x29')]()[_0x5c47('0x2a')](function(){_0x55102c['status'](0xcc)[_0x5c47('0x20')]();});}};}function handleEntityNotFound(_0x366c99,_0x58ab22){return function(_0x333b84){if(!_0x333b84){_0x366c99[_0x5c47('0x2b')](0x194);}return _0x333b84;};}function handleError(_0x3d32bb,_0x2f01c7){_0x2f01c7=_0x2f01c7||0x1f4;return function(_0x1a0cdd){logger[_0x5c47('0x2c')](_0x1a0cdd[_0x5c47('0x2d')]);if(_0x1a0cdd[_0x5c47('0x2e')]){delete _0x1a0cdd[_0x5c47('0x2e')];}_0x3d32bb[_0x5c47('0x1f')](_0x2f01c7)[_0x5c47('0x2f')](_0x1a0cdd);};}exports['index']=function(_0x79d318,_0x2bf99b){var _0x4a1c63={},_0x4f066a={},_0x700ee5={'count':0x0,'rows':[]};var _0x23af93=_[_0x5c47('0x30')](db[_0x5c47('0x31')]['rawAttributes'],function(_0x175e68){return{'name':_0x175e68[_0x5c47('0x32')],'type':_0x175e68[_0x5c47('0x33')][_0x5c47('0x34')]};});_0x4f066a[_0x5c47('0x35')]=_[_0x5c47('0x30')](_0x23af93,_0x5c47('0x2e'));_0x4f066a[_0x5c47('0x36')]=_[_0x5c47('0x37')](_0x79d318['query']);_0x4f066a['filters']=_[_0x5c47('0x38')](_0x4f066a[_0x5c47('0x35')],_0x4f066a[_0x5c47('0x36')]);_0x4a1c63[_0x5c47('0x39')]=_['intersection'](_0x4f066a[_0x5c47('0x35')],qs['fields'](_0x79d318[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x4a1c63['attributes']=_0x4a1c63['attributes'][_0x5c47('0x3b')]?_0x4a1c63[_0x5c47('0x39')]:_0x4f066a[_0x5c47('0x35')];if(!_0x79d318[_0x5c47('0x36')]['hasOwnProperty']('nolimit')){_0x4a1c63[_0x5c47('0x23')]=qs[_0x5c47('0x23')](_0x79d318[_0x5c47('0x36')]['limit']);_0x4a1c63[_0x5c47('0x25')]=qs[_0x5c47('0x25')](_0x79d318[_0x5c47('0x36')][_0x5c47('0x25')]);}_0x4a1c63[_0x5c47('0x3c')]=qs[_0x5c47('0x3d')](_0x79d318['query'][_0x5c47('0x3d')]);_0x4a1c63[_0x5c47('0x3e')]=qs['filters'](_[_0x5c47('0x3f')](_0x79d318[_0x5c47('0x36')],_0x4f066a['filters']),_0x23af93);if(_0x79d318[_0x5c47('0x36')]['filter']){_0x4a1c63[_0x5c47('0x3e')]=_[_0x5c47('0x40')](_0x4a1c63['where'],{'$or':_[_0x5c47('0x30')](_0x23af93,function(_0x1dbd96){if(_0x1dbd96[_0x5c47('0x33')]!==_0x5c47('0x41')){var _0x43432c={};_0x43432c[_0x1dbd96[_0x5c47('0x2e')]]={'$like':'%'+_0x79d318[_0x5c47('0x36')][_0x5c47('0x42')]+'%'};return _0x43432c;}})});}_0x4a1c63=_[_0x5c47('0x40')]({},_0x4a1c63,_0x79d318[_0x5c47('0x43')]);var _0xcaf22e={'where':_0x4a1c63[_0x5c47('0x3e')]};return db[_0x5c47('0x31')][_0x5c47('0x24')](_0xcaf22e)[_0x5c47('0x2a')](function(_0x534763){_0x700ee5['count']=_0x534763;if(_0x79d318[_0x5c47('0x36')][_0x5c47('0x44')]){_0x4a1c63['include']=[{'all':!![]}];}return db[_0x5c47('0x31')][_0x5c47('0x45')](_0x4a1c63);})[_0x5c47('0x2a')](function(_0xe4639){_0x700ee5[_0x5c47('0x46')]=_0xe4639;return _0x700ee5;})[_0x5c47('0x2a')](respondWithFilteredResult(_0x2bf99b,_0x4a1c63))[_0x5c47('0x47')](handleError(_0x2bf99b,null));};exports['show']=function(_0x5bd2e1,_0x1e90ab){var _0x47b131={'raw':![],'where':{'id':_0x5bd2e1['params']['id']}},_0x47930c={};_0x47930c['model']=_[_0x5c47('0x37')](db[_0x5c47('0x31')][_0x5c47('0x48')]);_0x47930c[_0x5c47('0x36')]=_[_0x5c47('0x37')](_0x5bd2e1['query']);_0x47930c['filters']=_[_0x5c47('0x38')](_0x47930c[_0x5c47('0x35')],_0x47930c[_0x5c47('0x36')]);_0x47b131['attributes']=_['intersection'](_0x47930c[_0x5c47('0x35')],qs[_0x5c47('0x3a')](_0x5bd2e1[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x47b131[_0x5c47('0x39')]=_0x47b131[_0x5c47('0x39')][_0x5c47('0x3b')]?_0x47b131['attributes']:_0x47930c['model'];if(_0x5bd2e1[_0x5c47('0x36')][_0x5c47('0x44')]){_0x47b131[_0x5c47('0x49')]=[{'all':!![]}];}_0x47b131=_[_0x5c47('0x40')]({},_0x47b131,_0x5bd2e1[_0x5c47('0x43')]);return db[_0x5c47('0x31')][_0x5c47('0x4a')](_0x47b131)[_0x5c47('0x2a')](handleEntityNotFound(_0x1e90ab,null))[_0x5c47('0x2a')](respondWithResult(_0x1e90ab,null))['catch'](handleError(_0x1e90ab,null));};exports[_0x5c47('0x4b')]=function(_0x1604e6,_0x351d31){return db[_0x5c47('0x31')][_0x5c47('0x4b')](_0x1604e6[_0x5c47('0x4c')],{})[_0x5c47('0x2a')](respondWithResult(_0x351d31,0xc9))['catch'](handleError(_0x351d31,null));};exports[_0x5c47('0x4d')]=function(_0x5b8ef7,_0x24483c){var _0x1bcfc4={'where':{'id':_0x5b8ef7[_0x5c47('0x4e')]['id']}},_0x5a7ca6={};_0x5a7ca6[_0x5c47('0x35')]=_['keys'](db[_0x5c47('0x31')][_0x5c47('0x48')]);_0x1bcfc4['attributes']=_['intersection'](_0x5a7ca6[_0x5c47('0x35')],qs[_0x5c47('0x3a')](_0x5b8ef7[_0x5c47('0x36')][_0x5c47('0x3a')]));_0x1bcfc4[_0x5c47('0x39')]=_0x1bcfc4[_0x5c47('0x39')][_0x5c47('0x3b')]?_0x1bcfc4[_0x5c47('0x39')]:_0x5a7ca6['model'];if(_0x5b8ef7[_0x5c47('0x36')][_0x5c47('0x44')]){_0x1bcfc4[_0x5c47('0x49')]=[{'all':!![]}];}_0x1bcfc4=_['merge']({},_0x1bcfc4,_0x5b8ef7[_0x5c47('0x43')]);return db[_0x5c47('0x31')]['find'](_0x1bcfc4)[_0x5c47('0x2a')](handleEntityNotFound(_0x24483c,null))[_0x5c47('0x2a')](function(_0x1b0c59){if(_0x1b0c59){var _0x1d9be1=_0x1b0c59[_0x5c47('0x4f')]({'plain':!![]});_0x1d9be1=qs[_0x5c47('0x50')](_0x1d9be1,['id','createdAt',_0x5c47('0x51'),_0x5c47('0x52')]);_0x5b8ef7['body']=_[_0x5c47('0x50')](_0x5b8ef7['body'],['id',_0x5c47('0x53'),_0x5c47('0x51')]);return db['sequelize'][_0x5c47('0x54')](function(_0x552732){return db['UserProfile'][_0x5c47('0x4b')](_['merge'](_0x1d9be1,_0x5b8ef7[_0x5c47('0x4c')]),{'include':_0x5b8ef7[_0x5c47('0x36')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x552732})['then'](function(_0x41007a){var _0x1bbcd1=_0x41007a[_0x5c47('0x4f')]({'plain':!![]});return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x5b8ef7[_0x5c47('0x4e')]['id']},'raw':!![]})[_0x5c47('0x2a')](function(_0x2f349a){if(_0x2f349a){return BPromise[_0x5c47('0x56')](_0x2f349a,function(_0x221b82){return new BPromise(function(_0x355469,_0x3cbfcc){if(_0x221b82['autoAssociation']===null||_0x221b82[_0x5c47('0x57')]===0x1)_0x355469(null);return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x221b82['id']},'raw':!![]})[_0x5c47('0x2a')](function(_0x188139){var _0xbedd5b=_[_0x5c47('0x30')](_0x188139,function(_0x824bbe){return qs[_0x5c47('0x50')](_0x824bbe,['id',_0x5c47('0x53'),_0x5c47('0x51'),_0x5c47('0x59')]);});_0x355469(_0xbedd5b);})[_0x5c47('0x47')](function(_0x3872e5){_0x3cbfcc(_0x3872e5);});})[_0x5c47('0x2a')](function(_0x4ed255){var _0x40b1a1=qs[_0x5c47('0x50')](_0x221b82,['id',_0x5c47('0x53'),'updatedAt']);_0x40b1a1[_0x5c47('0x5a')]=_0x1bbcd1['id'];if(_0x4ed255)_0x40b1a1[_0x5c47('0x5b')]=_0x4ed255;return _0x40b1a1;})[_0x5c47('0x2a')](function(_0x444bd3){return db[_0x5c47('0x55')][_0x5c47('0x4b')](_0x444bd3,{'include':[{'model':db['UserProfileResource'],'as':_0x5c47('0x5b')}],'raw':!![],'transaction':_0x552732});});})[_0x5c47('0x2a')](function(){return _0x1bbcd1;});}});});});}})['then'](respondWithResult(_0x24483c,0xc9))[_0x5c47('0x47')](handleError(_0x24483c,null));};exports[_0x5c47('0x5c')]=function(_0x1a5d53,_0x189b67){if(_0x1a5d53['body']['id']){delete _0x1a5d53[_0x5c47('0x4c')]['id'];}return db['UserProfile'][_0x5c47('0x4a')]({'where':{'id':_0x1a5d53['params']['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x189b67,null))[_0x5c47('0x2a')](saveUpdates(_0x1a5d53[_0x5c47('0x4c')],null))[_0x5c47('0x2a')](respondWithResult(_0x189b67,null))[_0x5c47('0x47')](handleError(_0x189b67,null));};exports[_0x5c47('0x29')]=function(_0x278ea2,_0x5ec32e){return db['UserProfile'][_0x5c47('0x4a')]({'where':{'id':_0x278ea2['params']['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x5ec32e,null))['then'](removeEntity(_0x5ec32e,null))[_0x5c47('0x47')](handleError(_0x5ec32e,null));};exports['describe']=function(_0x2f16ef,_0x44e376){return db['UserProfile'][_0x5c47('0x5d')]()[_0x5c47('0x2a')](respondWithResult(_0x44e376,null))[_0x5c47('0x47')](handleError(_0x44e376,null));};exports[_0x5c47('0x5e')]=function(_0xa89643,_0x19293b){var _0x266134=_0xa89643[_0x5c47('0x4c')];return db[_0x5c47('0x31')][_0x5c47('0x4a')]({'where':{'id':_0xa89643[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x19293b,null))[_0x5c47('0x2a')](function(_0x617f67){if(_0x617f67){return db['sequelize']['transaction'](function(_0x12efe6){return db[_0x5c47('0x55')][_0x5c47('0x29')]({'where':{'userProfileId':_0xa89643[_0x5c47('0x4e')]['id'],'sectionId':_[_0x5c47('0x30')](_0x266134,function(_0x55c465){return _0x55c465['sectionId'];})},'transaction':_0x12efe6})[_0x5c47('0x2a')](function(){var _0x27c8cb=_[_0x5c47('0x30')](_0x266134,function(_0x5e1763){_0x5e1763[_0x5c47('0x5a')]=_0xa89643[_0x5c47('0x4e')]['id'];return _0x5e1763;});var _0x3100a4=[];return BPromise['each'](_0x27c8cb,function(_0x259c3e){return db[_0x5c47('0x55')]['create'](_0x259c3e,{'include':[{'model':db['UserProfileResource'],'as':_0x5c47('0x5b')}],'raw':!![],'transaction':_0x12efe6})['then'](function(_0x19d3fa){_0x3100a4[_0x5c47('0x5f')](_0x19d3fa[_0x5c47('0x4f')]({'plain':!![]}));});})[_0x5c47('0x2a')](function(){return _0x3100a4;});});});}})[_0x5c47('0x2a')](function(_0x4b2148){return _0x4b2148;})[_0x5c47('0x2a')](respondWithResult(_0x19293b,null))['catch'](handleError(_0x19293b,null));};exports[_0x5c47('0x60')]=function(_0x1a5eb5,_0x1df33d){var _0x34e745;return db['UserProfile']['find']({'where':{'id':_0x1a5eb5[_0x5c47('0x4e')]['id']},'attributes':['id',_0x5c47('0x2e')]})[_0x5c47('0x2a')](handleEntityNotFound(_0x1df33d,null))['then'](function(_0x169ec8){if(_0x169ec8){_0x34e745=_0x169ec8;return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1a5eb5[_0x5c47('0x4e')]['id'],'sectionId':_0x1a5eb5[_0x5c47('0x36')][_0x5c47('0x61')]}});}})['then'](function(){return _0x34e745;})[_0x5c47('0x2a')](respondWithStatusCode(_0x1df33d,null))[_0x5c47('0x47')](handleError(_0x1df33d,null));};exports[_0x5c47('0x62')]=function(_0x2f72ba,_0xd99b44){var _0x286b59=[];var _0x3ad4db=[];return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x2f72ba[_0x5c47('0x4e')]['id']},'raw':!![]})['then'](function(_0x390f34){_0x286b59=_[_0x5c47('0x42')](_0x390f34,function(_0x47d02b){return _0x47d02b[_0x5c47('0x63')]===0x1||_['includes']([0x3eb,0x709],_0x47d02b['sectionId']);});if(!_[_0x5c47('0x64')](_0x286b59)){return _['map'](_0x286b59,function(_0x3a0c5b){return _0x3a0c5b[_0x5c47('0x59')];});}else{return;}})[_0x5c47('0x2a')](function(_0x54e012){if(_0x54e012)_0x3ad4db=_0x54e012;if(_['includes'](_0x3ad4db,0x64)){var _0x238150=_[_0x5c47('0x4a')](_0x286b59,{'sectionId':0x64});return hasDefaultDashboard(_0x238150)[_0x5c47('0x2a')](function(_0x4f7086){return _['map'](_0x286b59,function(_0x294938){if(_0x294938[_0x5c47('0x59')]===0x64){_0x294938[_0x5c47('0x65')]=_0x4f7086;}return _0x294938;});});}else{return;}})[_0x5c47('0x2a')](function(_0xd54304){if(_0xd54304)_0x286b59=_0xd54304;if(_[_0x5c47('0x66')](_0x3ad4db,0x3eb)){var _0x3d09c9=_['find'](_0x286b59,{'sectionId':0x3eb});return getCustomDashboards(_0x3d09c9)[_0x5c47('0x2a')](function(_0x1c6266){return _['map'](_0x286b59,function(_0x25822e){if(_0x3d09c9['enabled']){if(_0x25822e[_0x5c47('0x59')]===0x3eb){_0x25822e[_0x5c47('0x65')]=_0x1c6266;}}else{if(_0x25822e[_0x5c47('0x59')]===0x64){if(!_0x25822e[_0x5c47('0x65')]){_0x25822e['subsections']=[];}_0x25822e[_0x5c47('0x65')]=_0x25822e[_0x5c47('0x65')][_0x5c47('0x67')](_0x1c6266);}}return _0x25822e;});});}else{return;}})[_0x5c47('0x2a')](function(_0x496f52){if(_0x496f52)_0x286b59=_0x496f52;if(_[_0x5c47('0x66')](_0x3ad4db,0x709)){var _0x460f0e=_[_0x5c47('0x4a')](_0x286b59,{'sectionId':0x709});return getPlugins(_0x460f0e)[_0x5c47('0x2a')](function(_0x20757a){if(_0x460f0e[_0x5c47('0x63')]){return _[_0x5c47('0x30')](_0x286b59,function(_0x318acf){if(_0x318acf['sectionId']===0x709){_0x318acf[_0x5c47('0x65')]=_0x20757a;}return _0x318acf;});}else{var _0x3a46c6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x20757a};var _0x1bbfa4=_[_0x5c47('0x30')](_0x286b59);_0x1bbfa4[_0x5c47('0x5f')](_0x3a46c6);return _0x1bbfa4;}});}else{return;}})[_0x5c47('0x2a')](function(_0x128468){if(_0x128468)_0x286b59=_0x128468;return _[_0x5c47('0x42')](_0x286b59,[_0x5c47('0x63'),0x1]);})[_0x5c47('0x2a')](respondWithResult(_0xd99b44,null))[_0x5c47('0x47')](handleError(_0xd99b44,null));};function hasDefaultDashboard(_0x18c8c4){var _0x4d69bb=[0x65];return new BPromise(function(_0x330653,_0x48a6ce){try{if(_0x18c8c4[_0x5c47('0x57')]){_0x330653(_0x4d69bb);}else{return db[_0x5c47('0x58')][_0x5c47('0x68')]({'where':{'sectionId':_0x18c8c4['id']},'raw':!![]})['then'](function(_0x5dc1fc){_0x5dc1fc?_0x330653(_0x4d69bb):_0x330653();});}}catch(_0x107108){_0x48a6ce(_0x107108);}});}function getCustomDashboards(_0x279bd4){var _0x1ad603=[];return new BPromise(function(_0x5aed0f,_0x80cce1){try{if(_0x279bd4['autoAssociation']){return db[_0x5c47('0x69')][_0x5c47('0x45')]({'raw':!![]})[_0x5c47('0x2a')](function(_0x4134d4){_0x4134d4[_0x5c47('0x6a')](function(_0x14222e){_0x1ad603[_0x5c47('0x5f')](_0x14222e['id']+0x1869f);});_0x5aed0f(_0x1ad603);});}else{return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x279bd4['id']},'raw':!![]})['then'](function(_0x3ce425){_0x3ce425[_0x5c47('0x6a')](function(_0x58cc3d){_0x1ad603[_0x5c47('0x5f')](_0x58cc3d[_0x5c47('0x6b')]+0x1869f);});_0x5aed0f(_0x1ad603);});}}catch(_0x5d297f){_0x80cce1(_0x5d297f);}});}function getPlugins(_0x3871bc){var _0x1e8252=[];return new BPromise(function(_0x115175,_0x103b49){try{if(_0x3871bc[_0x5c47('0x57')]){return db[_0x5c47('0x6c')][_0x5c47('0x45')]({'raw':!![]})[_0x5c47('0x2a')](function(_0x4880e0){_0x4880e0[_0x5c47('0x6a')](function(_0x494018){_0x1e8252[_0x5c47('0x5f')](_0x494018['id']+0x15b38);});_0x115175(_0x1e8252);});}else{return db[_0x5c47('0x58')][_0x5c47('0x45')]({'where':{'sectionId':_0x3871bc['id']},'raw':!![]})['then'](function(_0x4cc045){_0x4cc045[_0x5c47('0x6a')](function(_0x2415be){_0x1e8252[_0x5c47('0x5f')](_0x2415be[_0x5c47('0x6b')]+0x15b38);});_0x115175(_0x1e8252);});}}catch(_0x5e91b9){_0x103b49(_0x5e91b9);}});}exports[_0x5c47('0x6d')]=function(_0x3eff63,_0x4136a9){return db[_0x5c47('0x31')][_0x5c47('0x4a')]({'where':{'id':_0x3eff63[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](handleEntityNotFound(_0x4136a9,null))[_0x5c47('0x2a')](function(_0x4fb7b0){if(_0x4fb7b0){return db['sequelize']['transaction'](function(_0x7d86ad){return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id']},'attributes':['id'],'raw':!![]})[_0x5c47('0x2a')](function(_0x392c4c){if(_0x392c4c){return db[_0x5c47('0x55')]['destroy']({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id'],'id':_['map'](_0x392c4c,function(_0x537686){return _0x537686['id'];})},'transaction':_0x7d86ad});}})[_0x5c47('0x2a')](function(_0x564f32){var _0x3830ea=_['map'](_0x3eff63[_0x5c47('0x4c')],function(_0x57143f){_0x57143f[_0x5c47('0x5a')]=_0x3eff63[_0x5c47('0x4e')]['id'];return _0x57143f;});return db[_0x5c47('0x55')]['bulkCreate'](_0x3830ea,{'raw':!![],'transaction':_0x7d86ad});})[_0x5c47('0x2a')](function(_0x46643d){var _0x1ac9bb=_[_0x5c47('0x42')](_[_0x5c47('0x30')](_0x46643d,function(_0x3e8f23){return _0x3e8f23[_0x5c47('0x4f')]({'plain':!![]});}),{'includeAll':![]});if(_0x1ac9bb){return db[_0x5c47('0x55')][_0x5c47('0x45')]({'where':{'userProfileId':_0x3eff63[_0x5c47('0x4e')]['id'],'sectionId':_[_0x5c47('0x30')](_0x1ac9bb,function(_0x38a1c9){return _0x38a1c9[_0x5c47('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x3c0fdd){var _0x2f4af4=_['map'](_0x3eff63[_0x5c47('0x4c')],function(_0x2ff0d2){_0x2ff0d2[_0x5c47('0x5a')]=_0x3eff63[_0x5c47('0x4e')]['id'];return _0x2ff0d2;});return db[_0x5c47('0x58')]['bulkCreate'](_0x2f4af4,{'raw':!![],'transaction':_0x7d86ad});});}})[_0x5c47('0x47')](handleError(_0x4136a9,null));});}})[_0x5c47('0x2a')](function(_0x3ef80b){var _0x365a63=_[_0x5c47('0x30')](_0x3ef80b,function(_0x5aa437){return _0x5aa437[_0x5c47('0x4f')]({'plain':!![]});});})[_0x5c47('0x2a')](respondWithResult(_0x4136a9,null))[_0x5c47('0x47')](handleError(_0x4136a9,null));};exports[_0x5c47('0x6e')]=function(_0x18351a,_0x5c0064,_0x1a5d94){return db[_0x5c47('0x31')]['find']({'where':{'id':_0x18351a[_0x5c47('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5c0064,null))[_0x5c47('0x2a')](function(_0x2592d8){if(_0x2592d8){return _0x2592d8[_0x5c47('0x6e')](_0x18351a[_0x5c47('0x36')]['ids']);}})[_0x5c47('0x2a')](respondWithStatusCode(_0x5c0064,null))['catch'](handleError(_0x5c0064,null));};exports[_0x5c47('0x6f')]=function(_0x2c23c4,_0x3050ea){var _0x28e28a={};if(!_0x2c23c4['query'][_0x5c47('0x70')])throw new Error('Missing\x20section\x20parameter');if(!_0x2c23c4['query'][_0x5c47('0x71')]('nolimit')){_0x28e28a['limit']=qs['limit'](_0x2c23c4[_0x5c47('0x36')][_0x5c47('0x23')]);_0x28e28a[_0x5c47('0x25')]=qs[_0x5c47('0x25')](_0x2c23c4[_0x5c47('0x36')][_0x5c47('0x25')]);}return db[_0x5c47('0x31')]['find']({'where':{'id':_0x2c23c4[_0x5c47('0x4e')]['id']}})[_0x5c47('0x2a')](function(_0x4cbc55){if(!_0x4cbc55)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x2c23c4['params']['id']);return db[_0x5c47('0x31')][_0x5c47('0x6f')](_0x2c23c4);})[_0x5c47('0x2a')](respondWithFilteredResult(_0x3050ea,_0x28e28a))[_0x5c47('0x47')](handleError(_0x3050ea,null));}; \ No newline at end of file +var _0xcc5f=['No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','UserProfile','includeAll','include','rows','catch','show','params','options','find','create','clone','get','omit','createdAt','updatedAt','crudPermissions','body','transaction','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','sequelize','push','ids','getSections','enabled','isEmpty','includes','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','hasOwnProperty'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0xcc5f,0x157));var _0xfcc5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcc5f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfcc5('0x0'));var zipdir=require(_0xfcc5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfcc5('0x2'));var Mustache=require(_0xfcc5('0x3'));var util=require('util');var path=require(_0xfcc5('0x4'));var sox=require(_0xfcc5('0x5'));var csv=require(_0xfcc5('0x6'));var ejs=require(_0xfcc5('0x7'));var fs=require('fs');var fs_extra=require(_0xfcc5('0x8'));var _=require(_0xfcc5('0x9'));var squel=require(_0xfcc5('0xa'));var crypto=require(_0xfcc5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xfcc5('0xc'));var toCsv=require(_0xfcc5('0x6'));var querystring=require('querystring');var Papa=require(_0xfcc5('0xd'));var Redis=require(_0xfcc5('0xe'));var authService=require(_0xfcc5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xfcc5('0x10'));var hardwareService=require(_0xfcc5('0x11'));var logger=require(_0xfcc5('0x12'))(_0xfcc5('0x13'));var utils=require('../../config/utils');var config=require(_0xfcc5('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0xfcc5('0x15')](config[_0xfcc5('0x16')],{'host':_0xfcc5('0x17'),'port':0x18eb});var socket=require(_0xfcc5('0x18'))(new Redis(config[_0xfcc5('0x16')]));require(_0xfcc5('0x19'))[_0xfcc5('0x1a')](socket);function respondWithStatusCode(_0x3995f3,_0x34756f){_0x34756f=_0x34756f||0xcc;return function(_0x249053){if(_0x249053){return _0x3995f3[_0xfcc5('0x1b')](_0x34756f);}return _0x3995f3[_0xfcc5('0x1c')](_0x34756f)[_0xfcc5('0x1d')]();};}function respondWithResult(_0x36d7d5,_0x3181fd){_0x3181fd=_0x3181fd||0xc8;return function(_0x379329){if(_0x379329){return _0x36d7d5['status'](_0x3181fd)[_0xfcc5('0x1e')](_0x379329);}};}function respondWithFilteredResult(_0x262cac,_0x4ac8e2){return function(_0x587f2f){if(_0x587f2f){var _0x2c6000=typeof _0x4ac8e2[_0xfcc5('0x1f')]===_0xfcc5('0x20')&&typeof _0x4ac8e2[_0xfcc5('0x21')]===_0xfcc5('0x20');var _0x1d2166=_0x587f2f['count'];var _0x373be7=_0x2c6000?0x0:_0x4ac8e2[_0xfcc5('0x1f')];var _0x38e016=_0x2c6000?_0x587f2f[_0xfcc5('0x22')]:_0x4ac8e2[_0xfcc5('0x1f')]+_0x4ac8e2[_0xfcc5('0x21')];var _0x188b9f;if(_0x38e016>=_0x1d2166){_0x38e016=_0x1d2166;_0x188b9f=0xc8;}else{_0x188b9f=0xce;}_0x262cac['status'](_0x188b9f);return _0x262cac['set'](_0xfcc5('0x23'),_0x373be7+'-'+_0x38e016+'/'+_0x1d2166)[_0xfcc5('0x1e')](_0x587f2f);}return null;};}function patchUpdates(_0x3681e1){return function(_0x1e9442){try{jsonpatch[_0xfcc5('0x24')](_0x1e9442,_0x3681e1,!![]);}catch(_0x25f9b8){return BPromise[_0xfcc5('0x25')](_0x25f9b8);}return _0x1e9442['save']();};}function saveUpdates(_0xf5ade,_0x439dbd){return function(_0x52c2d2){if(_0x52c2d2){return _0x52c2d2[_0xfcc5('0x26')](_0xf5ade)[_0xfcc5('0x27')](function(_0x125370){return _0x125370;});}return null;};}function removeEntity(_0x4358a9,_0x3eac25){return function(_0x4f1d1d){if(_0x4f1d1d){return _0x4f1d1d[_0xfcc5('0x28')]()[_0xfcc5('0x27')](function(){_0x4358a9[_0xfcc5('0x1c')](0xcc)[_0xfcc5('0x1d')]();});}};}function handleEntityNotFound(_0x54d662,_0x275ebf){return function(_0x50dbc7){if(!_0x50dbc7){_0x54d662['sendStatus'](0x194);}return _0x50dbc7;};}function handleError(_0x359970,_0x39586b){_0x39586b=_0x39586b||0x1f4;return function(_0x4de8a6){logger[_0xfcc5('0x29')](_0x4de8a6[_0xfcc5('0x2a')]);if(_0x4de8a6[_0xfcc5('0x2b')]){delete _0x4de8a6['name'];}_0x359970['status'](_0x39586b)[_0xfcc5('0x2c')](_0x4de8a6);};}exports[_0xfcc5('0x2d')]=function(_0x96ad60,_0x1911aa){var _0x5b20f4={},_0x377134={},_0xc31737={'count':0x0,'rows':[]};var _0xeec8ee=_[_0xfcc5('0x2e')](db['UserProfile'][_0xfcc5('0x2f')],function(_0x326763){return{'name':_0x326763[_0xfcc5('0x30')],'type':_0x326763['type']['key']};});_0x377134['model']=_['map'](_0xeec8ee,_0xfcc5('0x2b'));_0x377134[_0xfcc5('0x31')]=_[_0xfcc5('0x32')](_0x96ad60['query']);_0x377134[_0xfcc5('0x33')]=_[_0xfcc5('0x34')](_0x377134[_0xfcc5('0x35')],_0x377134[_0xfcc5('0x31')]);_0x5b20f4[_0xfcc5('0x36')]=_[_0xfcc5('0x34')](_0x377134['model'],qs[_0xfcc5('0x37')](_0x96ad60[_0xfcc5('0x31')][_0xfcc5('0x37')]));_0x5b20f4['attributes']=_0x5b20f4[_0xfcc5('0x36')][_0xfcc5('0x38')]?_0x5b20f4[_0xfcc5('0x36')]:_0x377134['model'];if(!_0x96ad60[_0xfcc5('0x31')]['hasOwnProperty'](_0xfcc5('0x39'))){_0x5b20f4[_0xfcc5('0x21')]=qs[_0xfcc5('0x21')](_0x96ad60['query'][_0xfcc5('0x21')]);_0x5b20f4[_0xfcc5('0x1f')]=qs[_0xfcc5('0x1f')](_0x96ad60[_0xfcc5('0x31')]['offset']);}_0x5b20f4[_0xfcc5('0x3a')]=qs['sort'](_0x96ad60[_0xfcc5('0x31')][_0xfcc5('0x3b')]);_0x5b20f4[_0xfcc5('0x3c')]=qs[_0xfcc5('0x33')](_[_0xfcc5('0x3d')](_0x96ad60['query'],_0x377134[_0xfcc5('0x33')]),_0xeec8ee);if(_0x96ad60[_0xfcc5('0x31')][_0xfcc5('0x3e')]){_0x5b20f4[_0xfcc5('0x3c')]=_[_0xfcc5('0x3f')](_0x5b20f4[_0xfcc5('0x3c')],{'$or':_[_0xfcc5('0x2e')](_0xeec8ee,function(_0x483464){if(_0x483464[_0xfcc5('0x40')]!=='VIRTUAL'){var _0x59299f={};_0x59299f[_0x483464[_0xfcc5('0x2b')]]={'$like':'%'+_0x96ad60[_0xfcc5('0x31')][_0xfcc5('0x3e')]+'%'};return _0x59299f;}})});}_0x5b20f4=_[_0xfcc5('0x3f')]({},_0x5b20f4,_0x96ad60['options']);var _0x3a79bb={'where':_0x5b20f4[_0xfcc5('0x3c')]};return db[_0xfcc5('0x41')][_0xfcc5('0x22')](_0x3a79bb)[_0xfcc5('0x27')](function(_0x44a286){_0xc31737[_0xfcc5('0x22')]=_0x44a286;if(_0x96ad60[_0xfcc5('0x31')][_0xfcc5('0x42')]){_0x5b20f4[_0xfcc5('0x43')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x5b20f4);})[_0xfcc5('0x27')](function(_0x509bdd){_0xc31737[_0xfcc5('0x44')]=_0x509bdd;return _0xc31737;})[_0xfcc5('0x27')](respondWithFilteredResult(_0x1911aa,_0x5b20f4))[_0xfcc5('0x45')](handleError(_0x1911aa,null));};exports[_0xfcc5('0x46')]=function(_0x45dbc6,_0x50fb63){var _0x29cc67={'raw':![],'where':{'id':_0x45dbc6[_0xfcc5('0x47')]['id']}},_0x129a58={};_0x129a58[_0xfcc5('0x35')]=_[_0xfcc5('0x32')](db['UserProfile'][_0xfcc5('0x2f')]);_0x129a58[_0xfcc5('0x31')]=_[_0xfcc5('0x32')](_0x45dbc6[_0xfcc5('0x31')]);_0x129a58[_0xfcc5('0x33')]=_[_0xfcc5('0x34')](_0x129a58['model'],_0x129a58['query']);_0x29cc67[_0xfcc5('0x36')]=_['intersection'](_0x129a58[_0xfcc5('0x35')],qs[_0xfcc5('0x37')](_0x45dbc6[_0xfcc5('0x31')][_0xfcc5('0x37')]));_0x29cc67[_0xfcc5('0x36')]=_0x29cc67[_0xfcc5('0x36')]['length']?_0x29cc67[_0xfcc5('0x36')]:_0x129a58[_0xfcc5('0x35')];if(_0x45dbc6[_0xfcc5('0x31')][_0xfcc5('0x42')]){_0x29cc67[_0xfcc5('0x43')]=[{'all':!![]}];}_0x29cc67=_[_0xfcc5('0x3f')]({},_0x29cc67,_0x45dbc6[_0xfcc5('0x48')]);return db[_0xfcc5('0x41')][_0xfcc5('0x49')](_0x29cc67)[_0xfcc5('0x27')](handleEntityNotFound(_0x50fb63,null))[_0xfcc5('0x27')](respondWithResult(_0x50fb63,null))[_0xfcc5('0x45')](handleError(_0x50fb63,null));};exports['create']=function(_0x5927a1,_0x3643e2){return db[_0xfcc5('0x41')][_0xfcc5('0x4a')](_0x5927a1['body'],{})[_0xfcc5('0x27')](respondWithResult(_0x3643e2,0xc9))['catch'](handleError(_0x3643e2,null));};exports[_0xfcc5('0x4b')]=function(_0x5c9a9b,_0x16efaf){var _0x2d6216={'where':{'id':_0x5c9a9b['params']['id']}},_0x4538f8={};_0x4538f8['model']=_['keys'](db['UserProfile'][_0xfcc5('0x2f')]);_0x2d6216[_0xfcc5('0x36')]=_[_0xfcc5('0x34')](_0x4538f8[_0xfcc5('0x35')],qs[_0xfcc5('0x37')](_0x5c9a9b[_0xfcc5('0x31')]['fields']));_0x2d6216['attributes']=_0x2d6216[_0xfcc5('0x36')][_0xfcc5('0x38')]?_0x2d6216[_0xfcc5('0x36')]:_0x4538f8[_0xfcc5('0x35')];if(_0x5c9a9b['query'][_0xfcc5('0x42')]){_0x2d6216['include']=[{'all':!![]}];}_0x2d6216=_[_0xfcc5('0x3f')]({},_0x2d6216,_0x5c9a9b[_0xfcc5('0x48')]);return db['UserProfile'][_0xfcc5('0x49')](_0x2d6216)[_0xfcc5('0x27')](handleEntityNotFound(_0x16efaf,null))[_0xfcc5('0x27')](function(_0x373e12){if(_0x373e12){var _0x5048f3=_0x373e12[_0xfcc5('0x4c')]({'plain':!![]});_0x5048f3=qs[_0xfcc5('0x4d')](_0x5048f3,['id',_0xfcc5('0x4e'),_0xfcc5('0x4f'),_0xfcc5('0x50')]);_0x5c9a9b[_0xfcc5('0x51')]=_[_0xfcc5('0x4d')](_0x5c9a9b[_0xfcc5('0x51')],['id',_0xfcc5('0x4e'),'updatedAt']);return db['sequelize'][_0xfcc5('0x52')](function(_0x32e8c9){return db[_0xfcc5('0x41')][_0xfcc5('0x4a')](_[_0xfcc5('0x3f')](_0x5048f3,_0x5c9a9b[_0xfcc5('0x51')]),{'include':_0x5c9a9b['query'][_0xfcc5('0x42')]?[{'all':!![]}]:undefined,'transaction':_0x32e8c9})[_0xfcc5('0x27')](function(_0x5b98b2){var _0xe71ce2=_0x5b98b2[_0xfcc5('0x4c')]({'plain':!![]});return db[_0xfcc5('0x53')][_0xfcc5('0x54')]({'where':{'userProfileId':_0x5c9a9b[_0xfcc5('0x47')]['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x1ee504){if(_0x1ee504){return BPromise[_0xfcc5('0x55')](_0x1ee504,function(_0x33a757){return new BPromise(function(_0x4b8d93,_0x4bd749){if(_0x33a757['autoAssociation']===null||_0x33a757[_0xfcc5('0x56')]===0x1)_0x4b8d93(null);return db[_0xfcc5('0x57')]['findAll']({'where':{'sectionId':_0x33a757['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x526495){var _0x4e289a=_['map'](_0x526495,function(_0x7dc798){return qs[_0xfcc5('0x4d')](_0x7dc798,['id',_0xfcc5('0x4e'),_0xfcc5('0x4f'),_0xfcc5('0x58')]);});_0x4b8d93(_0x4e289a);})[_0xfcc5('0x45')](function(_0x572612){_0x4bd749(_0x572612);});})['then'](function(_0x39ef87){var _0x10c422=qs[_0xfcc5('0x4d')](_0x33a757,['id',_0xfcc5('0x4e'),_0xfcc5('0x4f')]);_0x10c422[_0xfcc5('0x59')]=_0xe71ce2['id'];if(_0x39ef87)_0x10c422[_0xfcc5('0x5a')]=_0x39ef87;return _0x10c422;})[_0xfcc5('0x27')](function(_0x3017cd){return db[_0xfcc5('0x53')][_0xfcc5('0x4a')](_0x3017cd,{'include':[{'model':db[_0xfcc5('0x57')],'as':_0xfcc5('0x5a')}],'raw':!![],'transaction':_0x32e8c9});});})[_0xfcc5('0x27')](function(){return _0xe71ce2;});}});});});}})[_0xfcc5('0x27')](respondWithResult(_0x16efaf,0xc9))[_0xfcc5('0x45')](handleError(_0x16efaf,null));};exports[_0xfcc5('0x26')]=function(_0x57ea56,_0x469032){if(_0x57ea56[_0xfcc5('0x51')]['id']){delete _0x57ea56[_0xfcc5('0x51')]['id'];}return db[_0xfcc5('0x41')][_0xfcc5('0x49')]({'where':{'id':_0x57ea56[_0xfcc5('0x47')]['id']}})['then'](handleEntityNotFound(_0x469032,null))['then'](saveUpdates(_0x57ea56['body'],null))[_0xfcc5('0x27')](respondWithResult(_0x469032,null))['catch'](handleError(_0x469032,null));};exports[_0xfcc5('0x28')]=function(_0x11ac5b,_0x2a7e4b){return db[_0xfcc5('0x41')][_0xfcc5('0x49')]({'where':{'id':_0x11ac5b['params']['id']}})[_0xfcc5('0x27')](handleEntityNotFound(_0x2a7e4b,null))['then'](removeEntity(_0x2a7e4b,null))[_0xfcc5('0x45')](handleError(_0x2a7e4b,null));};exports[_0xfcc5('0x5b')]=function(_0x133c42,_0x83e313){return db[_0xfcc5('0x41')]['describe']()['then'](respondWithResult(_0x83e313,null))['catch'](handleError(_0x83e313,null));};exports['addSections']=function(_0x3c9662,_0xc7b19){var _0x28c86a=_0x3c9662[_0xfcc5('0x51')];return db['UserProfile'][_0xfcc5('0x49')]({'where':{'id':_0x3c9662[_0xfcc5('0x47')]['id']}})[_0xfcc5('0x27')](handleEntityNotFound(_0xc7b19,null))[_0xfcc5('0x27')](function(_0x4bc1a0){if(_0x4bc1a0){return db[_0xfcc5('0x5c')]['transaction'](function(_0x17ea5f){return db[_0xfcc5('0x53')][_0xfcc5('0x28')]({'where':{'userProfileId':_0x3c9662[_0xfcc5('0x47')]['id'],'sectionId':_[_0xfcc5('0x2e')](_0x28c86a,function(_0x2c82f0){return _0x2c82f0[_0xfcc5('0x58')];})},'transaction':_0x17ea5f})[_0xfcc5('0x27')](function(){var _0x37ecb2=_[_0xfcc5('0x2e')](_0x28c86a,function(_0x3d8046){_0x3d8046[_0xfcc5('0x59')]=_0x3c9662[_0xfcc5('0x47')]['id'];return _0x3d8046;});var _0x4e1f9d=[];return BPromise[_0xfcc5('0x55')](_0x37ecb2,function(_0x5aae9c){return db[_0xfcc5('0x53')][_0xfcc5('0x4a')](_0x5aae9c,{'include':[{'model':db[_0xfcc5('0x57')],'as':_0xfcc5('0x5a')}],'raw':!![],'transaction':_0x17ea5f})['then'](function(_0x576d16){_0x4e1f9d[_0xfcc5('0x5d')](_0x576d16[_0xfcc5('0x4c')]({'plain':!![]}));});})['then'](function(){return _0x4e1f9d;});});});}})[_0xfcc5('0x27')](function(_0x38a506){return _0x38a506;})[_0xfcc5('0x27')](respondWithResult(_0xc7b19,null))['catch'](handleError(_0xc7b19,null));};exports['removeSections']=function(_0x24926d,_0x24d701){var _0x1a25c9;return db[_0xfcc5('0x41')]['find']({'where':{'id':_0x24926d['params']['id']},'attributes':['id',_0xfcc5('0x2b')]})[_0xfcc5('0x27')](handleEntityNotFound(_0x24d701,null))[_0xfcc5('0x27')](function(_0x3810da){if(_0x3810da){_0x1a25c9=_0x3810da;return db['UserProfileSection'][_0xfcc5('0x28')]({'where':{'userProfileId':_0x24926d['params']['id'],'sectionId':_0x24926d[_0xfcc5('0x31')][_0xfcc5('0x5e')]}});}})[_0xfcc5('0x27')](function(){return _0x1a25c9;})['then'](respondWithStatusCode(_0x24d701,null))[_0xfcc5('0x45')](handleError(_0x24d701,null));};exports[_0xfcc5('0x5f')]=function(_0x22445a,_0x11f6c0){var _0x7fc3b5=[];var _0x37e8e8=[];return db[_0xfcc5('0x53')][_0xfcc5('0x54')]({'where':{'userProfileId':_0x22445a[_0xfcc5('0x47')]['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x21db50){_0x7fc3b5=_['filter'](_0x21db50,function(_0x380f09){return _0x380f09[_0xfcc5('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x380f09[_0xfcc5('0x58')]);});if(!_[_0xfcc5('0x61')](_0x7fc3b5)){return _[_0xfcc5('0x2e')](_0x7fc3b5,function(_0x1e9e26){return _0x1e9e26[_0xfcc5('0x58')];});}else{return;}})[_0xfcc5('0x27')](function(_0x41ff6d){if(_0x41ff6d)_0x37e8e8=_0x41ff6d;if(_[_0xfcc5('0x62')](_0x37e8e8,0x64)){var _0x37f495=_[_0xfcc5('0x49')](_0x7fc3b5,{'sectionId':0x64});return hasDefaultDashboard(_0x37f495)[_0xfcc5('0x27')](function(_0x50ccf1){return _[_0xfcc5('0x2e')](_0x7fc3b5,function(_0x38da42){if(_0x38da42[_0xfcc5('0x58')]===0x64){_0x38da42[_0xfcc5('0x63')]=_0x50ccf1;}return _0x38da42;});});}else{return;}})[_0xfcc5('0x27')](function(_0x130869){if(_0x130869)_0x7fc3b5=_0x130869;if(_[_0xfcc5('0x62')](_0x37e8e8,0x3eb)){var _0xbd9835=_[_0xfcc5('0x49')](_0x7fc3b5,{'sectionId':0x3eb});return getCustomDashboards(_0xbd9835)['then'](function(_0x2ab5a9){return _['map'](_0x7fc3b5,function(_0x2daa41){if(_0xbd9835[_0xfcc5('0x60')]){if(_0x2daa41[_0xfcc5('0x58')]===0x3eb){_0x2daa41['subsections']=_0x2ab5a9;}}else{if(_0x2daa41[_0xfcc5('0x58')]===0x64){if(!_0x2daa41[_0xfcc5('0x63')]){_0x2daa41[_0xfcc5('0x63')]=[];}_0x2daa41[_0xfcc5('0x63')]=_0x2daa41[_0xfcc5('0x63')][_0xfcc5('0x64')](_0x2ab5a9);}}return _0x2daa41;});});}else{return;}})[_0xfcc5('0x27')](function(_0x596a3f){if(_0x596a3f)_0x7fc3b5=_0x596a3f;if(_['includes'](_0x37e8e8,0x709)){var _0x1772d6=_[_0xfcc5('0x49')](_0x7fc3b5,{'sectionId':0x709});return getPlugins(_0x1772d6)['then'](function(_0x21ed46){if(_0x1772d6['enabled']){return _[_0xfcc5('0x2e')](_0x7fc3b5,function(_0x3a95c3){if(_0x3a95c3[_0xfcc5('0x58')]===0x709){_0x3a95c3[_0xfcc5('0x63')]=_0x21ed46;}return _0x3a95c3;});}else{var _0x2e7ca9={'sectionId':0x76c,'enabled':0x1,'subsections':_0x21ed46};var _0x19b0d9=_[_0xfcc5('0x2e')](_0x7fc3b5);_0x19b0d9[_0xfcc5('0x5d')](_0x2e7ca9);return _0x19b0d9;}});}else{return;}})[_0xfcc5('0x27')](function(_0x53b511){if(_0x53b511)_0x7fc3b5=_0x53b511;return _[_0xfcc5('0x3e')](_0x7fc3b5,[_0xfcc5('0x60'),0x1]);})['then'](respondWithResult(_0x11f6c0,null))[_0xfcc5('0x45')](handleError(_0x11f6c0,null));};function hasDefaultDashboard(_0x500c89){var _0x2a2fd7=[0x65];return new BPromise(function(_0x5186c2,_0x29dd01){try{if(_0x500c89['autoAssociation']){_0x5186c2(_0x2a2fd7);}else{return db[_0xfcc5('0x57')][_0xfcc5('0x65')]({'where':{'sectionId':_0x500c89['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x34126c){_0x34126c?_0x5186c2(_0x2a2fd7):_0x5186c2();});}}catch(_0x38e2b6){_0x29dd01(_0x38e2b6);}});}function getCustomDashboards(_0x210c7d){var _0x447db7=[];return new BPromise(function(_0x5eeb98,_0x1be62e){try{if(_0x210c7d[_0xfcc5('0x56')]){return db[_0xfcc5('0x66')][_0xfcc5('0x54')]({'raw':!![]})[_0xfcc5('0x27')](function(_0x33ca9a){_0x33ca9a[_0xfcc5('0x67')](function(_0x567893){_0x447db7[_0xfcc5('0x5d')](_0x567893['id']+0x1869f);});_0x5eeb98(_0x447db7);});}else{return db[_0xfcc5('0x57')][_0xfcc5('0x54')]({'where':{'sectionId':_0x210c7d['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x570b49){_0x570b49['forEach'](function(_0x4dee22){_0x447db7[_0xfcc5('0x5d')](_0x4dee22[_0xfcc5('0x68')]+0x1869f);});_0x5eeb98(_0x447db7);});}}catch(_0x33cf61){_0x1be62e(_0x33cf61);}});}function getPlugins(_0x1907bd){var _0x1f525d=[];return new BPromise(function(_0x3fddc3,_0x4a1750){try{if(_0x1907bd['autoAssociation']){return db[_0xfcc5('0x69')][_0xfcc5('0x54')]({'raw':!![]})[_0xfcc5('0x27')](function(_0xfeea97){_0xfeea97['forEach'](function(_0x54dcf1){_0x1f525d[_0xfcc5('0x5d')](_0x54dcf1['id']+0x15b38);});_0x3fddc3(_0x1f525d);});}else{return db['UserProfileResource'][_0xfcc5('0x54')]({'where':{'sectionId':_0x1907bd['id']},'raw':!![]})[_0xfcc5('0x27')](function(_0x350ed8){_0x350ed8[_0xfcc5('0x67')](function(_0xfafbf1){_0x1f525d['push'](_0xfafbf1[_0xfcc5('0x68')]+0x15b38);});_0x3fddc3(_0x1f525d);});}}catch(_0x53feff){_0x4a1750(_0x53feff);}});}exports[_0xfcc5('0x6a')]=function(_0x501f3f,_0x41311d){return db[_0xfcc5('0x41')][_0xfcc5('0x49')]({'where':{'id':_0x501f3f[_0xfcc5('0x47')]['id']}})[_0xfcc5('0x27')](handleEntityNotFound(_0x41311d,null))['then'](function(_0x333902){if(_0x333902){return db[_0xfcc5('0x5c')][_0xfcc5('0x52')](function(_0x5de4e9){return db[_0xfcc5('0x53')]['findAll']({'where':{'userProfileId':_0x501f3f[_0xfcc5('0x47')]['id']},'attributes':['id'],'raw':!![]})[_0xfcc5('0x27')](function(_0x109056){if(_0x109056){return db[_0xfcc5('0x53')]['destroy']({'where':{'userProfileId':_0x501f3f['params']['id'],'id':_['map'](_0x109056,function(_0x1fe6ab){return _0x1fe6ab['id'];})},'transaction':_0x5de4e9});}})[_0xfcc5('0x27')](function(_0x246818){var _0x33924c=_[_0xfcc5('0x2e')](_0x501f3f[_0xfcc5('0x51')],function(_0xe21b10){_0xe21b10['userProfileId']=_0x501f3f[_0xfcc5('0x47')]['id'];return _0xe21b10;});return db[_0xfcc5('0x53')][_0xfcc5('0x6b')](_0x33924c,{'raw':!![],'transaction':_0x5de4e9});})['then'](function(_0x44ca91){var _0x2275f0=_[_0xfcc5('0x3e')](_[_0xfcc5('0x2e')](_0x44ca91,function(_0x13e8b9){return _0x13e8b9[_0xfcc5('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x2275f0){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x501f3f[_0xfcc5('0x47')]['id'],'sectionId':_[_0xfcc5('0x2e')](_0x2275f0,function(_0x1382f3){return _0x1382f3['sectionId'];})},'attributes':['id',_0xfcc5('0x58')],'raw':!![]})[_0xfcc5('0x27')](function(_0xe92ac7){var _0x20dd4c=_[_0xfcc5('0x2e')](_0x501f3f[_0xfcc5('0x51')],function(_0x5ecf5f){_0x5ecf5f[_0xfcc5('0x59')]=_0x501f3f[_0xfcc5('0x47')]['id'];return _0x5ecf5f;});return db['UserProfileResource'][_0xfcc5('0x6b')](_0x20dd4c,{'raw':!![],'transaction':_0x5de4e9});});}})['catch'](handleError(_0x41311d,null));});}})[_0xfcc5('0x27')](function(_0x1ed9f7){var _0x40ad78=_[_0xfcc5('0x2e')](_0x1ed9f7,function(_0x2abd2a){return _0x2abd2a[_0xfcc5('0x4c')]({'plain':!![]});});})[_0xfcc5('0x27')](respondWithResult(_0x41311d,null))['catch'](handleError(_0x41311d,null));};exports[_0xfcc5('0x6c')]=function(_0x507285,_0x2091e1,_0x411f6f){return db[_0xfcc5('0x41')]['find']({'where':{'id':_0x507285[_0xfcc5('0x47')]['id']}})[_0xfcc5('0x27')](handleEntityNotFound(_0x2091e1,null))['then'](function(_0x40c35f){if(_0x40c35f){return _0x40c35f[_0xfcc5('0x6c')](_0x507285['query'][_0xfcc5('0x5e')]);}})['then'](respondWithStatusCode(_0x2091e1,null))[_0xfcc5('0x45')](handleError(_0x2091e1,null));};exports[_0xfcc5('0x6d')]=function(_0x1b3ba7,_0x590e36){var _0x34c326={};if(!_0x1b3ba7[_0xfcc5('0x31')][_0xfcc5('0x6e')])throw new Error(_0xfcc5('0x6f'));if(!_0x1b3ba7[_0xfcc5('0x31')][_0xfcc5('0x70')](_0xfcc5('0x39'))){_0x34c326['limit']=qs['limit'](_0x1b3ba7['query'][_0xfcc5('0x21')]);_0x34c326[_0xfcc5('0x1f')]=qs[_0xfcc5('0x1f')](_0x1b3ba7[_0xfcc5('0x31')][_0xfcc5('0x1f')]);}return db[_0xfcc5('0x41')][_0xfcc5('0x49')]({'where':{'id':_0x1b3ba7[_0xfcc5('0x47')]['id']}})[_0xfcc5('0x27')](function(_0x748aa9){if(!_0x748aa9)throw new Error(_0xfcc5('0x71')+_0x1b3ba7[_0xfcc5('0x47')]['id']);return db[_0xfcc5('0x41')][_0xfcc5('0x6d')](_0x1b3ba7);})[_0xfcc5('0x27')](respondWithFilteredResult(_0x590e36,_0x34c326))['catch'](handleError(_0x590e36,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 439bb0e..b47f7a6 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 _0xb145=['exports','../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5966b4,_0x6ffc5c){var _0x45eddd=function(_0x1441fe){while(--_0x1441fe){_0x5966b4['push'](_0x5966b4['shift']());}};_0x45eddd(++_0x6ffc5c);}(_0xb145,0xa3));var _0x5b14=function(_0x16d8c1,_0x21bf2b){_0x16d8c1=_0x16d8c1-0x0;var _0x5f11ba=_0xb145[_0x16d8c1];return _0x5f11ba;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x5b14('0x0'))['db'][_0x5b14('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x5b14('0x2')](0x0);var events={'afterCreate':_0x5b14('0x3'),'afterUpdate':_0x5b14('0x4'),'afterDestroy':_0x5b14('0x5')};function emitEvent(_0x31f6f0){return function(_0x34b4cd,_0x5111cd,_0x1e0b5b){UserProfileEvents[_0x5b14('0x6')](_0x31f6f0+':'+_0x34b4cd['id'],_0x34b4cd);UserProfileEvents[_0x5b14('0x6')](_0x31f6f0,_0x34b4cd);_0x1e0b5b(null);};}for(var e in events){if(events[_0x5b14('0x7')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x5b14('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x1623=['emit','hasOwnProperty','exports','events','setMaxListeners','save','update','remove'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1623,0xab));var _0x3162=function(_0x1cc754,_0x27057b){_0x1cc754=_0x1cc754-0x0;var _0x13bb3e=_0x1623[_0x1cc754];return _0x13bb3e;};'use strict';var EventEmitter=require(_0x3162('0x0'));var UserProfile=require('../../mysqldb')['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x3162('0x1')](0x0);var events={'afterCreate':_0x3162('0x2'),'afterUpdate':_0x3162('0x3'),'afterDestroy':_0x3162('0x4')};function emitEvent(_0x428dd7){return function(_0x4ce2bd,_0x5d49d0,_0x7a4559){UserProfileEvents['emit'](_0x428dd7+':'+_0x4ce2bd['id'],_0x4ce2bd);UserProfileEvents[_0x3162('0x5')](_0x428dd7,_0x4ce2bd);_0x7a4559(null);};}for(var e in events){if(events[_0x3162('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0x3162('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8aba751..c92bbc3 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 _0xf868=['AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','all','ignore','union','length','find','autoAssociation','model','rawAttributes','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','sort','where','pick','key','VIRTUAL','foreignKey','forEach','merge','options','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','order','extraQueryConditions','includeAll','Tags','color','tag','true','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','map','catch','associatedResources','UserProfileResource','AnalyticExtractedReport','resourceId','type','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','name','projectName','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','telephone','VoiceQueue','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','agents','telephones','Users','user','Telephones','zendeskaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','CannedAnswer','dispositions','Disposition','customdashboards','intervals','pauses','Pause','scheduler','Schedule','tags','Tag','templates','Template','triggers','Trigger','Trunk','variables','plugins','Plugin','extractedreports','Reports','reportId','metrics'];(function(_0x1e829b,_0x5490cc){var _0x213be3=function(_0x1b7f4a){while(--_0x1b7f4a){_0x1e829b['push'](_0x1e829b['shift']());}};_0x213be3(++_0x5490cc);}(_0xf868,0x109));var _0x8f86=function(_0x4855ac,_0x57608e){_0x4855ac=_0x4855ac-0x0;var _0x4f4cd4=_0xf868[_0x4855ac];return _0x4f4cd4;};'use strict';var _=require('lodash');var attributes=require(_0x8f86('0x0'));var squel=require(_0x8f86('0x1'));module[_0x8f86('0x2')]=function(_0x528890){var _0x3fbffa=_0x528890[_0x8f86('0x3')];function _0x38461b(_0x79cd,_0xfe7173){return new Promise(function(_0x8847df,_0x38d588){if(!_0xfe7173)return _0x8847df(null);var _0x1194e1=_0xfe7173[_0x8f86('0x4')]?{[_0xfe7173['filter'][_0x8f86('0x5')]]:_0xfe7173[_0x8f86('0x4')][_0x8f86('0x6')]}:undefined;return _0x3fbffa[_0x79cd][_0x8f86('0x7')]({'where':_0x1194e1,'raw':!![]})[_0x8f86('0x8')](function(_0x506217){_0xfe7173['associatedResources']=_[_0x8f86('0x9')](_0x506217,'id');_0x8847df(_0xfe7173);})[_0x8f86('0xa')](function(_0x4b49c1){_0x38d588(_0x4b49c1);});});}function _0x4ef7ed(_0x26280b,_0x2bf180){return new Promise(function(_0x272a0a,_0x34363e){var _0x4f2263=_0x26280b[_0x8f86('0x4')]?{[_0x26280b[_0x8f86('0x4')][_0x8f86('0x5')]]:_0x26280b[_0x8f86('0x4')][_0x8f86('0x6')]}:undefined;return _0x3fbffa[_0x26280b['model']][_0x8f86('0x7')]({'where':_0x4f2263,'raw':!![]})['then'](function(_0x2c15f1){_0x2bf180[_0x8f86('0xb')]=_[_0x8f86('0x9')](_0x2c15f1,function(_0x52ede2){return _0x52ede2['name'];});_0x272a0a(_0x2bf180);})[_0x8f86('0xa')](function(_0x1cb6f9){_0x34363e(_0x1cb6f9);});});}function _0x41b650(_0xac0d41,_0x3a16b4,_0x56cd58){if(!_0x3a16b4)return Promise['resolve'](null);return new Promise(function(_0x5d87f3,_0x123f61){return _0x3fbffa[_0x8f86('0xc')]['findAll']({'where':{'sectionId':_0x3a16b4['id']},'raw':!![]})['then'](function(_0x4f5e4f){if(_0xac0d41['field']&&_0xac0d41[_0x8f86('0x5')]!=='id'){_0x3a16b4[_0x8f86('0xb')]=_[_0x8f86('0x9')](_0x4f5e4f,function(_0x1f5965){return _0x1f5965[_0xac0d41[_0x8f86('0x5')]];});}else{if(_0x56cd58===_0x8f86('0xd')){_0x3a16b4[_0x8f86('0xb')]=_[_0x8f86('0x9')](_0x4f5e4f,function(_0xa12f4c){return{'id':_0xa12f4c[_0x8f86('0xe')],'type':_0xa12f4c[_0x8f86('0xf')]};});}else{_0x3a16b4[_0x8f86('0xb')]=_[_0x8f86('0x9')](_0x4f5e4f,function(_0x10339a){return _0x10339a['resourceId'];});}}_0x5d87f3(_0x3a16b4);})['catch'](function(_0x537e20){_0x123f61(_0x537e20);});});}function _0x4a948d(_0x856114,_0x3e6eae){var _0x3a922e={'parentSections':[]};switch(_0x856114['toLowerCase']()){case _0x8f86('0x10'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x12');break;case _0x8f86('0x13'):_0x3a922e[_0x8f86('0x11')]='SquareOdbc';break;case _0x8f86('0x14'):_0x3a922e['childModel']=_0x8f86('0x15');_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x17'),'field':_0x8f86('0x18'),'foreignKey':_0x8f86('0x19')}];break;case'projects':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x1a');break;case'contacts':_0x3a922e['childModel']=_0x8f86('0x1b');_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x1c'),'field':'id','foreignKey':_0x8f86('0x1d')}];break;case _0x8f86('0x1e'):_0x3a922e['childModel']=_0x8f86('0x1f');break;case _0x8f86('0x20'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x21');break;case'globalcustomfields':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x22');break;case _0x8f86('0x23'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x24');break;case'chatwebsites':_0x3a922e['childModel']='ChatWebsite';break;case _0x8f86('0x25'):_0x3a922e[_0x8f86('0x11')]='FaxQueue';break;case'faxaccounts':_0x3a922e['childModel']=_0x8f86('0x26');break;case _0x8f86('0x27'):case _0x8f86('0x28'):case _0x8f86('0x29'):_0x3a922e['childModel']=_0x8f86('0x2a');break;case'contexts':_0x3a922e['childModel']='VoiceContext';break;case _0x8f86('0x2b'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x2c');break;case _0x8f86('0x2d'):_0x3a922e['childModel']=_0x8f86('0x2e');_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x2f'),'field':_0x8f86('0x18'),'foreignKey':_0x8f86('0x30'),'model':_0x8f86('0x31'),'filter':{'field':_0x8f86('0x32'),'value':[_0x8f86('0x33')]}},{'name':'Telephones','field':_0x8f86('0x18'),'foreignKey':'membername','model':_0x8f86('0x31'),'filter':{'field':'role','value':[_0x8f86('0x34')]}},{'name':'VoiceQueues','field':_0x8f86('0x18'),'foreignKey':'queue','model':_0x8f86('0x35'),'filter':{'field':_0x8f86('0xf'),'value':['inbound']}},{'name':_0x8f86('0x36'),'field':_0x8f86('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x8f86('0xf'),'value':[_0x8f86('0x37')]}}];break;case _0x8f86('0x38'):_0x3a922e['childModel']=_0x8f86('0x39');break;case _0x8f86('0x3a'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x3b');break;case _0x8f86('0x3c'):_0x3a922e['childModel']=_0x8f86('0x3d');break;case'ivrcampaigns':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x3e');break;case'mailqueues':_0x3a922e['childModel']=_0x8f86('0x3f');break;case _0x8f86('0x40'):_0x3a922e['childModel']='MailAccount';break;case _0x8f86('0x41'):_0x3a922e[_0x8f86('0x11')]='MailSubstatus';break;case _0x8f86('0x42'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x43');break;case'openchannelaccounts':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x44');break;case _0x8f86('0x45'):_0x3a922e['childModel']=_0x8f86('0x46');break;case'smsaccounts':_0x3a922e['childModel']=_0x8f86('0x47');break;case _0x8f86('0x48'):_0x3a922e['childModel']=_0x8f86('0x49');break;case _0x8f86('0x4a'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x4b');break;case _0x8f86('0x4c'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x4d');break;case _0x8f86('0x4e'):case _0x8f86('0x4f'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x35');if(_0x3e6eae){_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x50')},{'name':_0x8f86('0x36')}];}break;case _0x8f86('0x51'):case _0x8f86('0x52'):case _0x8f86('0x53'):_0x3a922e['childModel']='User';if(_0x3e6eae){_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x54'),'filter':{'field':_0x8f86('0x32'),'value':['admin',_0x8f86('0x55')]},'ignore':!![]},{'name':_0x8f86('0x2f')},{'name':_0x8f86('0x56')}];}break;case _0x8f86('0x57'):_0x3a922e[_0x8f86('0x11')]='ZendeskAccount';break;case'salesforceaccounts':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x58');break;case _0x8f86('0x59'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x5a');break;case _0x8f86('0x5b'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x5c');break;case _0x8f86('0x5d'):_0x3a922e['childModel']=_0x8f86('0x5e');break;case _0x8f86('0x5f'):_0x3a922e['childModel']='ZohoAccount';break;case'vtigeraccounts':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x31');break;case'cannedanswers':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x60');break;case _0x8f86('0x61'):_0x3a922e['childModel']=_0x8f86('0x62');break;case _0x8f86('0x63'):_0x3a922e[_0x8f86('0x11')]='Dashboard';break;case _0x8f86('0x64'):_0x3a922e[_0x8f86('0x11')]='Interval';break;case _0x8f86('0x65'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x66');break;case _0x8f86('0x67'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x68');break;case'sounds':_0x3a922e[_0x8f86('0x11')]='Sound';break;case _0x8f86('0x69'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x6a');break;case _0x8f86('0x6b'):_0x3a922e['childModel']=_0x8f86('0x6c');break;case _0x8f86('0x6d'):_0x3a922e['childModel']=_0x8f86('0x6e');break;case'trunks':_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x6f');break;case _0x8f86('0x70'):_0x3a922e['childModel']='Variable';break;case _0x8f86('0x71'):_0x3a922e['childModel']=_0x8f86('0x72');break;case _0x8f86('0x73'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0xd');_0x3a922e[_0x8f86('0x16')]=[{'name':_0x8f86('0x74'),'field':'id','foreignKey':_0x8f86('0x75')}];break;case _0x8f86('0x76'):_0x3a922e[_0x8f86('0x11')]=_0x8f86('0x77');break;}return _0x3a922e;}function _0x131eb5(_0x1c7259,_0x4ff171){var _0x7692d5=_0x1c7259[_0x8f86('0x78')](0x0)[_0x8f86('0x79')]()+_0x1c7259[_0x8f86('0x7a')](0x1);var _0x3bc42a={'type':_0x3fbffa['Sequelize'][_0x8f86('0x7b')][_0x8f86('0x7c')],'raw':!![]};return new Promise(function(_0x34fbc8,_0x3c5ff5){var _0x59647f=squel[_0x8f86('0x7d')]()[_0x8f86('0x5')](_0x8f86('0x7e')+_0x7692d5+_0x8f86('0x7f'),'id')[_0x8f86('0x5')](_0x8f86('0x80'))[_0x8f86('0x81')](_0x8f86('0x82')+_0x1c7259+_0x8f86('0x83'),'ui')['where'](_0x8f86('0x84'),_0x4ff171['id']);return _0x3fbffa[_0x8f86('0x85')][_0x8f86('0x86')](_0x59647f['toString'](),_0x3bc42a)[_0x8f86('0x8')](function(_0x19fdb7){_0x4ff171[_0x7692d5+_0x8f86('0x87')]=_0x19fdb7;_0x34fbc8(_0x19fdb7);})['catch'](function(_0x475142){_0x3c5ff5(_0x475142);});});}return _0x528890['define'](_0x8f86('0x88'),attributes,{'tableName':_0x8f86('0x89'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5671aa){var _0x31e621=require(_0x8f86('0x8a'));var _0x13e189={'raw':_0x5671aa[_0x8f86('0x86')][_0x8f86('0x8b')],'where':{}};var _0x211ddb={};var _0x3b3048={'count':0x0,'rows':[]};var _0x4826cb=_0x5671aa['query']['section'];var _0x2a211b=_0x5671aa[_0x8f86('0x86')][_0x8f86('0x8c')]||![];var _0x2aafdd=_0x4a948d(_0x4826cb,_0x2a211b);if(!_0x2aafdd[_0x8f86('0x11')])throw new Error(_0x8f86('0x8d')+_0x4826cb+'\x27');var _0x415066=[{'name':_0x4826cb}];if(!_[_0x8f86('0x8e')](_0x2aafdd[_0x8f86('0x16')]))_0x415066=_0x2aafdd[_0x8f86('0x16')];var _0x211507=[];for(var _0x24e684=0x0;_0x24e684<_0x415066['length'];_0x24e684++){_0x211507[_0x8f86('0x8f')](_0x3fbffa[_0x8f86('0x90')]['find']({'where':{'userProfileId':_0x5671aa['params']['id'],'name':_0x415066[_0x24e684][_0x8f86('0x18')]},'raw':!![]}));}return Promise[_0x8f86('0x91')](_0x211507)[_0x8f86('0x8')](function(_0x4ab660){var _0x3d59e0=_[_0x8f86('0x4')](_0x4ab660,function(_0x106405){return _0x106405?_0x106405:undefined;});var _0xe7e179=_[_0x8f86('0x4')](_0x415066,[_0x8f86('0x92'),!![]]);var _0x50554e=_['isEmpty'](_0x3d59e0)&&_[_0x8f86('0x8e')](_0xe7e179)?null:_[_0x8f86('0x93')](_0xe7e179,_0x3d59e0);if(!_0x50554e)return null;var _0x58b9b7=[];for(var _0x42a259=0x0;_0x42a259<_0x50554e[_0x8f86('0x94')];_0x42a259++){var _0x194f4e=_[_0x8f86('0x95')](_0x415066,function(_0xe3cdff){return _0x50554e[_0x42a259]?_0xe3cdff[_0x8f86('0x18')]===_0x50554e[_0x42a259]['name']:null;});if(_0x194f4e){if(_0x50554e[_0x42a259]['ignore']){_0x58b9b7[_0x8f86('0x8f')](_0x38461b(_0x2aafdd[_0x8f86('0x11')],_0x50554e[_0x42a259]));}else{if(!_0x50554e[_0x42a259][_0x8f86('0x96')]){_0x58b9b7['push'](_0x41b650(_0x194f4e,_0x50554e[_0x42a259],_0x2aafdd[_0x8f86('0x11')]));}else{if(_0x194f4e[_0x8f86('0x97')]){_0x58b9b7[_0x8f86('0x8f')](_0x4ef7ed(_0x194f4e,_0x50554e[_0x42a259]));}}}}}return Promise[_0x8f86('0x91')](_0x58b9b7);})[_0x8f86('0x8')](function(_0x1fe3a3){var _0x1ef935=_0x1fe3a3;var _0x413153=null;if(_0x1ef935){_0x413153=_0x1ef935['length']===0x1?_0x1ef935[0x0]:null;}if(!_0x413153&&!_0x1ef935)return _0x3b3048;var _0x4ed94f=_0x3fbffa[_0x2aafdd[_0x8f86('0x11')]][_0x8f86('0x98')];_0x211ddb[_0x8f86('0x97')]=_[_0x8f86('0x99')](_0x4ed94f);_0x211ddb[_0x8f86('0x86')]=_[_0x8f86('0x99')](_0x5671aa['query']);_0x211ddb[_0x8f86('0x9a')]=_['intersection'](_0x211ddb['model'],_0x211ddb[_0x8f86('0x86')]);_0x13e189[_0x8f86('0x9b')]=_[_0x8f86('0x9c')](_0x211ddb['model'],_0x31e621[_0x8f86('0x9d')](_0x5671aa[_0x8f86('0x86')][_0x8f86('0x9d')]));_0x13e189['attributes']=_0x13e189[_0x8f86('0x9b')][_0x8f86('0x94')]?_0x13e189[_0x8f86('0x9b')]:_0x211ddb[_0x8f86('0x97')];if(!_0x5671aa[_0x8f86('0x86')][_0x8f86('0x9e')](_0x8f86('0x9f'))){_0x13e189[_0x8f86('0xa0')]=_0x31e621[_0x8f86('0xa0')](_0x5671aa[_0x8f86('0x86')][_0x8f86('0xa0')]);_0x13e189[_0x8f86('0xa1')]=_0x31e621['offset'](_0x5671aa['query'][_0x8f86('0xa1')]);}_0x13e189['order']=_0x31e621[_0x8f86('0xa2')](_0x5671aa['query'][_0x8f86('0xa2')]);_0x13e189[_0x8f86('0xa3')]=_0x31e621[_0x8f86('0x9a')](_[_0x8f86('0xa4')](_0x5671aa[_0x8f86('0x86')],_0x211ddb[_0x8f86('0x9a')]));if(_0x5671aa[_0x8f86('0x86')][_0x8f86('0x4')]){_0x13e189['where']=_['merge'](_0x13e189[_0x8f86('0xa3')],{'$or':_['map'](_0x4ed94f,function(_0x106665){if(_0x106665[_0x8f86('0xf')][_0x8f86('0xa5')]!==_0x8f86('0xa6')){var _0x4a61bd={};_0x4a61bd[_0x106665[_0x8f86('0x5')]]={'$like':'%'+_0x5671aa[_0x8f86('0x86')][_0x8f86('0x4')]+'%'};return _0x4a61bd;}})});}var _0x49d0e1=[];var _0x472f7a=null;var _0x4f2f56={};if(_0x413153){_0x472f7a=_[_0x8f86('0x95')](_0x415066,[_0x8f86('0x18'),_0x413153[_0x8f86('0x18')]]);if(_0x472f7a[_0x8f86('0x5')]){_0x4f2f56={};if(_0x2aafdd[_0x8f86('0x11')]==='AnalyticExtractedReport'){_0x4f2f56[_0x472f7a[_0x8f86('0xa7')]]=_[_0x8f86('0x9')](_0x413153[_0x8f86('0xb')],'id');}else{_0x4f2f56[_0x472f7a[_0x8f86('0xa7')]]=_0x413153[_0x8f86('0xb')];}_0x49d0e1[_0x8f86('0x8f')](_0x4f2f56);}else{_0x13e189[_0x8f86('0xa3')]['id']=_0x413153[_0x8f86('0xb')];}}else{for(var _0x5d54f0=0x0;_0x5d54f0<_0x1ef935[_0x8f86('0x94')];_0x5d54f0++){_0x472f7a=_[_0x8f86('0x95')](_0x415066,['name',_0x1ef935[_0x5d54f0][_0x8f86('0x18')]]);if(_0x472f7a[_0x8f86('0x5')]){_0x4f2f56={};_0x4f2f56[_0x472f7a[_0x8f86('0xa7')]]=_0x1ef935[_0x5d54f0][_0x8f86('0xb')];_0x49d0e1[_0x8f86('0x8f')](_0x4f2f56);}else{if(!_0x13e189[_0x8f86('0xa3')]['id'])_0x13e189[_0x8f86('0xa3')]['id']=[];_0x1ef935[_0x5d54f0]['associatedResources'][_0x8f86('0xa8')](function(_0x278f6c){_0x13e189['where']['id'][_0x8f86('0x8f')](_0x278f6c);});}}}if(!_['isEmpty'](_0x49d0e1)){_0x13e189[_0x8f86('0xa3')]=_[_0x8f86('0xa9')](_0x13e189[_0x8f86('0xa3')],{'$and':{'$or':_0x49d0e1}});}_0x13e189=_['merge']({},_0x13e189,_0x5671aa[_0x8f86('0xaa')]);if(_0x413153&&!_0x413153[_0x8f86('0x96')]&&_0x2aafdd['childModel']===_0x8f86('0xd')){if(_0x5671aa[_0x8f86('0x86')]['includeAll']){_0x13e189[_0x8f86('0xab')]=[{'all':!![]}];}return _0x3fbffa[_0x2aafdd[_0x8f86('0x11')]][_0x8f86('0x7')](_0x13e189)[_0x8f86('0x8')](function(_0x564e9d){var _0x4f58e7=[];_0x564e9d[_0x8f86('0xa8')](function(_0x1fe52c){var _0x1d6f48;switch(_0x1fe52c[_0x8f86('0xac')]){case _0x8f86('0xad'):_0x1d6f48=_[_0x8f86('0x95')](_0x413153[_0x8f86('0xb')],function(_0x4e378d){return _0x4e378d['id']===_0x1fe52c['reportId']&&_0x4e378d[_0x8f86('0xf')]===_0x8f86('0xae');});break;case _0x8f86('0xaf'):_0x1d6f48=_['find'](_0x413153['associatedResources'],function(_0x380969){return _0x380969['id']===_0x1fe52c[_0x8f86('0x75')]&&_0x380969['type']===_0x8f86('0xb0');});break;}if(_0x1d6f48)_0x4f58e7['push'](_0x1fe52c);});_0x3b3048[_0x8f86('0xb1')]=_0x4f58e7[_0x8f86('0x94')];_0x3b3048[_0x8f86('0xb2')]=_0x4f58e7;return _0x3b3048;});}else{if(!_['isEmpty'](_0x5671aa['query']['ids'])){_0x13e189[_0x8f86('0xa3')]['id']=_0x13e189[_0x8f86('0xa3')]['id']?_[_0x8f86('0x9c')](_0x13e189[_0x8f86('0xa3')]['id'],_0x5671aa['query'][_0x8f86('0xb3')]):_0x5671aa[_0x8f86('0x86')][_0x8f86('0xb3')];if(_0x5671aa[_0x8f86('0x86')]['customSorting']){_0x13e189[_0x8f86('0xb4')]=_0x5671aa[_0x8f86('0x86')]['customSorting'];}}if(_0x5671aa['query']['extraQueryConditions']){_0x13e189[_0x8f86('0xa3')]=_['merge'](_0x13e189[_0x8f86('0xa3')],{'$and':_0x5671aa[_0x8f86('0x86')][_0x8f86('0xb5')]});}return _0x3fbffa[_0x2aafdd[_0x8f86('0x11')]]['count']({'where':_0x13e189['where']})[_0x8f86('0x8')](function(_0x44dadd){_0x3b3048['count']=_0x44dadd;if(_0x5671aa[_0x8f86('0x86')][_0x8f86('0xb6')]){if(_0x2aafdd[_0x8f86('0x11')]===_0x8f86('0x1b')){_0x13e189[_0x8f86('0xab')]=[{'model':_0x3fbffa['Tag'],'as':_0x8f86('0xb7'),'attributes':['id',_0x8f86('0x18'),'color'],'required':_0x5671aa['query']['tag']?!![]:![]},{'model':_0x3fbffa[_0x8f86('0x6a')],'as':'ThroughTags','attributes':['id',_0x8f86('0x18'),_0x8f86('0xb8')],'through':_0x5671aa[_0x8f86('0x86')][_0x8f86('0xb9')]?{'attributes':[],'where':{'TagId':_0x5671aa[_0x8f86('0x86')][_0x8f86('0xb9')]||undefined}}:{},'required':_0x5671aa[_0x8f86('0x86')]['tag']?!![]:![]}];}else{_0x13e189[_0x8f86('0xab')]=[{'all':!![]}];}}return _0x3fbffa[_0x2aafdd[_0x8f86('0x11')]]['findAll'](_0x13e189);})[_0x8f86('0x8')](function(_0x6baaab){_0x3b3048[_0x8f86('0xb2')]=_0x6baaab;if(_0x4826cb===_0x8f86('0x2f')&&_0x5671aa[_0x8f86('0x86')]['openTabs']===_0x8f86('0xba')){var _0x5ca5b2=[];for(var _0x14fb87=0x0;_0x14fb87<_0x3b3048[_0x8f86('0xb2')][_0x8f86('0x94')];_0x14fb87++){_0x5ca5b2[_0x8f86('0x8f')](_0x131eb5('chat',_0x3b3048[_0x8f86('0xb2')][_0x14fb87][_0x8f86('0xbb')]));_0x5ca5b2[_0x8f86('0x8f')](_0x131eb5(_0x8f86('0xbc'),_0x3b3048['rows'][_0x14fb87]['dataValues']));_0x5ca5b2[_0x8f86('0x8f')](_0x131eb5(_0x8f86('0xbd'),_0x3b3048[_0x8f86('0xb2')][_0x14fb87]['dataValues']));_0x5ca5b2[_0x8f86('0x8f')](_0x131eb5(_0x8f86('0xbe'),_0x3b3048[_0x8f86('0xb2')][_0x14fb87][_0x8f86('0xbb')]));_0x5ca5b2['push'](_0x131eb5(_0x8f86('0xbf'),_0x3b3048[_0x8f86('0xb2')][_0x14fb87]['dataValues']));_0x5ca5b2['push'](_0x131eb5('whatsapp',_0x3b3048['rows'][_0x14fb87][_0x8f86('0xbb')]));}return Promise[_0x8f86('0x91')](_0x5ca5b2)[_0x8f86('0x8')](function(){return _0x3b3048;});}return _0x3b3048;});}});}}});}; \ No newline at end of file +var _0x9a69=['freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Interval','pauses','Pause','scheduler','sounds','Sound','tags','Template','Trigger','trunks','Variable','plugins','Plugin','extractedreports','reportId','metrics','charAt','toUpperCase','SELECT','select','ui.','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','user_profiles','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','find','all','union','length','ignore','autoAssociation','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','filters','pick','key','VIRTUAL','foreignKey','forEach','merge','options','include','DefaultReports','custom','CustomReports','count','ids','extraQueryConditions','includeAll','Tag','color','ThroughTags','tag','rows','openTabs','dataValues','sms','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','findAll','then','associatedResources','map','value','model','name','catch','resolve','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','JscriptyProject','contacts','parentSections','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceMail','voicerecordings','Agents','membername','User','agent','Telephones','role','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0x9a69,0x111));var _0x99a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9a69[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x99a6('0x0'));var attributes=require(_0x99a6('0x1'));var squel=require(_0x99a6('0x2'));module[_0x99a6('0x3')]=function(_0x21c139){var _0x288723=_0x21c139[_0x99a6('0x4')];function _0x2f4b01(_0x2b1b15,_0x19b8bf){return new Promise(function(_0x2cface,_0x2b8825){if(!_0x19b8bf)return _0x2cface(null);var _0x4970d4=_0x19b8bf[_0x99a6('0x5')]?{[_0x19b8bf[_0x99a6('0x5')][_0x99a6('0x6')]]:_0x19b8bf['filter']['value']}:undefined;return _0x288723[_0x2b1b15][_0x99a6('0x7')]({'where':_0x4970d4,'raw':!![]})[_0x99a6('0x8')](function(_0x3786b3){_0x19b8bf[_0x99a6('0x9')]=_[_0x99a6('0xa')](_0x3786b3,'id');_0x2cface(_0x19b8bf);})['catch'](function(_0x2059db){_0x2b8825(_0x2059db);});});}function _0xadd092(_0x4706f5,_0x48e3f5){return new Promise(function(_0x244a6e,_0x320824){var _0x59f8f1=_0x4706f5[_0x99a6('0x5')]?{[_0x4706f5['filter']['field']]:_0x4706f5[_0x99a6('0x5')][_0x99a6('0xb')]}:undefined;return _0x288723[_0x4706f5[_0x99a6('0xc')]]['findAll']({'where':_0x59f8f1,'raw':!![]})[_0x99a6('0x8')](function(_0x22b2fd){_0x48e3f5['associatedResources']=_[_0x99a6('0xa')](_0x22b2fd,function(_0x455c49){return _0x455c49[_0x99a6('0xd')];});_0x244a6e(_0x48e3f5);})[_0x99a6('0xe')](function(_0x5891a9){_0x320824(_0x5891a9);});});}function _0xbacd6b(_0x5a97f3,_0xab6ac8,_0x5346cd){if(!_0xab6ac8)return Promise[_0x99a6('0xf')](null);return new Promise(function(_0x5ae6ca,_0x3830a1){return _0x288723['UserProfileResource'][_0x99a6('0x7')]({'where':{'sectionId':_0xab6ac8['id']},'raw':!![]})['then'](function(_0x53a872){if(_0x5a97f3[_0x99a6('0x6')]&&_0x5a97f3[_0x99a6('0x6')]!=='id'){_0xab6ac8[_0x99a6('0x9')]=_[_0x99a6('0xa')](_0x53a872,function(_0x1573bb){return _0x1573bb[_0x5a97f3[_0x99a6('0x6')]];});}else{if(_0x5346cd===_0x99a6('0x10')){_0xab6ac8[_0x99a6('0x9')]=_[_0x99a6('0xa')](_0x53a872,function(_0x42aaec){return{'id':_0x42aaec['resourceId'],'type':_0x42aaec[_0x99a6('0x11')]};});}else{_0xab6ac8[_0x99a6('0x9')]=_[_0x99a6('0xa')](_0x53a872,function(_0x442310){return _0x442310[_0x99a6('0x12')];});}}_0x5ae6ca(_0xab6ac8);})[_0x99a6('0xe')](function(_0x134e5b){_0x3830a1(_0x134e5b);});});}function _0x2099d9(_0x3fd9ac,_0x475bc5){var _0x5c4981={'parentSections':[]};switch(_0x3fd9ac['toLowerCase']()){case _0x99a6('0x13'):_0x5c4981[_0x99a6('0x14')]='SquareProject';break;case _0x99a6('0x15'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x16');break;case _0x99a6('0x17'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x18');_0x5c4981['parentSections']=[{'name':_0x99a6('0x19'),'field':_0x99a6('0xd'),'foreignKey':_0x99a6('0x1a')}];break;case'projects':_0x5c4981['childModel']=_0x99a6('0x1b');break;case _0x99a6('0x1c'):_0x5c4981['childModel']='CmContact';_0x5c4981[_0x99a6('0x1d')]=[{'name':_0x99a6('0x1e'),'field':'id','foreignKey':_0x99a6('0x1f')}];break;case _0x99a6('0x20'):_0x5c4981['childModel']=_0x99a6('0x21');break;case _0x99a6('0x22'):_0x5c4981['childModel']=_0x99a6('0x23');break;case _0x99a6('0x24'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x25');break;case _0x99a6('0x26'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x27');break;case'chatwebsites':_0x5c4981[_0x99a6('0x14')]='ChatWebsite';break;case _0x99a6('0x28'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x29');break;case'faxaccounts':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x2a');break;case _0x99a6('0x2b'):case _0x99a6('0x2c'):case _0x99a6('0x2d'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x2e');break;case _0x99a6('0x2f'):_0x5c4981[_0x99a6('0x14')]='VoiceContext';break;case'voicemails':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x30');break;case _0x99a6('0x31'):_0x5c4981[_0x99a6('0x14')]='VoiceRecording';_0x5c4981[_0x99a6('0x1d')]=[{'name':_0x99a6('0x32'),'field':_0x99a6('0xd'),'foreignKey':_0x99a6('0x33'),'model':_0x99a6('0x34'),'filter':{'field':'role','value':[_0x99a6('0x35')]}},{'name':_0x99a6('0x36'),'field':'name','foreignKey':_0x99a6('0x33'),'model':'User','filter':{'field':_0x99a6('0x37'),'value':['telephone']}},{'name':_0x99a6('0x38'),'field':_0x99a6('0xd'),'foreignKey':_0x99a6('0x39'),'model':_0x99a6('0x3a'),'filter':{'field':_0x99a6('0x11'),'value':[_0x99a6('0x3b')]}},{'name':_0x99a6('0x3c'),'field':_0x99a6('0xd'),'foreignKey':_0x99a6('0x39'),'model':_0x99a6('0x3a'),'filter':{'field':_0x99a6('0x11'),'value':['outbound']}}];break;case _0x99a6('0x3d'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x3e');break;case _0x99a6('0x3f'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x40');break;case'voiceprefixes':_0x5c4981['childModel']=_0x99a6('0x41');break;case _0x99a6('0x42'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x43');break;case _0x99a6('0x44'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x45');break;case'mailaccounts':_0x5c4981[_0x99a6('0x14')]='MailAccount';break;case _0x99a6('0x46'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x47');break;case _0x99a6('0x48'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x49');break;case'openchannelaccounts':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x4a');break;case _0x99a6('0x4b'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x4c');break;case _0x99a6('0x4d'):_0x5c4981[_0x99a6('0x14')]='SmsAccount';break;case _0x99a6('0x4e'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x4f');break;case'whatsappaccounts':_0x5c4981['childModel']=_0x99a6('0x50');break;case'teams':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x51');break;case _0x99a6('0x52'):case _0x99a6('0x53'):_0x5c4981['childModel']=_0x99a6('0x3a');if(_0x475bc5){_0x5c4981['parentSections']=[{'name':_0x99a6('0x38')},{'name':'QueueCampaigns'}];}break;case _0x99a6('0x54'):case'agents':case _0x99a6('0x55'):_0x5c4981[_0x99a6('0x14')]='User';if(_0x475bc5){_0x5c4981[_0x99a6('0x1d')]=[{'name':_0x99a6('0x56'),'filter':{'field':_0x99a6('0x37'),'value':[_0x99a6('0x57'),_0x99a6('0x58')]},'ignore':!![]},{'name':_0x99a6('0x32')},{'name':_0x99a6('0x36')}];}break;case'zendeskaccounts':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x59');break;case _0x99a6('0x5a'):_0x5c4981[_0x99a6('0x14')]='SalesforceAccount';break;case _0x99a6('0x5b'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x5c');break;case _0x99a6('0x5d'):_0x5c4981[_0x99a6('0x14')]='SugarcrmAccount';break;case'deskaccounts':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x5e');break;case'zohoaccounts':_0x5c4981[_0x99a6('0x14')]='ZohoAccount';break;case _0x99a6('0x5f'):_0x5c4981['childModel']=_0x99a6('0x34');break;case _0x99a6('0x60'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x61');break;case'dispositions':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x62');break;case _0x99a6('0x63'):_0x5c4981[_0x99a6('0x14')]='Dashboard';break;case'intervals':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x64');break;case _0x99a6('0x65'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x66');break;case _0x99a6('0x67'):_0x5c4981[_0x99a6('0x14')]='Schedule';break;case _0x99a6('0x68'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x69');break;case _0x99a6('0x6a'):_0x5c4981[_0x99a6('0x14')]='Tag';break;case'templates':_0x5c4981['childModel']=_0x99a6('0x6b');break;case'triggers':_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x6c');break;case _0x99a6('0x6d'):_0x5c4981[_0x99a6('0x14')]='Trunk';break;case'variables':_0x5c4981['childModel']=_0x99a6('0x6e');break;case _0x99a6('0x6f'):_0x5c4981['childModel']=_0x99a6('0x70');break;case _0x99a6('0x71'):_0x5c4981[_0x99a6('0x14')]=_0x99a6('0x10');_0x5c4981['parentSections']=[{'name':'Reports','field':'id','foreignKey':_0x99a6('0x72')}];break;case _0x99a6('0x73'):_0x5c4981[_0x99a6('0x14')]='AnalyticMetric';break;}return _0x5c4981;}function _0x2ff33c(_0x8d93ec,_0x1f5d63){var _0x2ea714=_0x8d93ec[_0x99a6('0x74')](0x0)[_0x99a6('0x75')]()+_0x8d93ec['slice'](0x1);var _0x4da818={'type':_0x288723['Sequelize']['QueryTypes'][_0x99a6('0x76')],'raw':!![]};return new Promise(function(_0x5744bf,_0x4ddc58){var _0x1f1901=squel[_0x99a6('0x77')]()[_0x99a6('0x6')](_0x99a6('0x78')+_0x2ea714+'InteractionId','id')[_0x99a6('0x6')](_0x99a6('0x79'))[_0x99a6('0x7a')](_0x99a6('0x7b')+_0x8d93ec+_0x99a6('0x7c'),'ui')[_0x99a6('0x7d')]('ui.UserId\x20=\x20?',_0x1f5d63['id']);return _0x288723[_0x99a6('0x7e')][_0x99a6('0x7f')](_0x1f1901[_0x99a6('0x80')](),_0x4da818)[_0x99a6('0x8')](function(_0x286152){_0x1f5d63[_0x2ea714+_0x99a6('0x81')]=_0x286152;_0x5744bf(_0x286152);})[_0x99a6('0xe')](function(_0x2ff1b4){_0x4ddc58(_0x2ff1b4);});});}return _0x21c139['define']('UserProfile',attributes,{'tableName':_0x99a6('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2c83b1){var _0x36073c=require(_0x99a6('0x83'));var _0x35ef87={'raw':_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0x84')],'where':{}};var _0xd20b2f={};var _0x599138={'count':0x0,'rows':[]};var _0x17e994=_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0x85')];var _0x2b07ae=_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0x86')]||![];var _0x2971dd=_0x2099d9(_0x17e994,_0x2b07ae);if(!_0x2971dd[_0x99a6('0x14')])throw new Error(_0x99a6('0x87')+_0x17e994+'\x27');var _0x5bc97d=[{'name':_0x17e994}];if(!_[_0x99a6('0x88')](_0x2971dd[_0x99a6('0x1d')]))_0x5bc97d=_0x2971dd[_0x99a6('0x1d')];var _0x11323e=[];for(var _0x3dddbd=0x0;_0x3dddbd<_0x5bc97d['length'];_0x3dddbd++){_0x11323e[_0x99a6('0x89')](_0x288723[_0x99a6('0x8a')][_0x99a6('0x8b')]({'where':{'userProfileId':_0x2c83b1['params']['id'],'name':_0x5bc97d[_0x3dddbd][_0x99a6('0xd')]},'raw':!![]}));}return Promise[_0x99a6('0x8c')](_0x11323e)[_0x99a6('0x8')](function(_0x5e1372){var _0x988af4=_[_0x99a6('0x5')](_0x5e1372,function(_0x29952e){return _0x29952e?_0x29952e:undefined;});var _0x569cab=_['filter'](_0x5bc97d,['ignore',!![]]);var _0x1fa9c6=_[_0x99a6('0x88')](_0x988af4)&&_[_0x99a6('0x88')](_0x569cab)?null:_[_0x99a6('0x8d')](_0x569cab,_0x988af4);if(!_0x1fa9c6)return null;var _0x24e033=[];for(var _0x10314b=0x0;_0x10314b<_0x1fa9c6[_0x99a6('0x8e')];_0x10314b++){var _0x5e854c=_['find'](_0x5bc97d,function(_0x3eb7f2){return _0x1fa9c6[_0x10314b]?_0x3eb7f2[_0x99a6('0xd')]===_0x1fa9c6[_0x10314b]['name']:null;});if(_0x5e854c){if(_0x1fa9c6[_0x10314b][_0x99a6('0x8f')]){_0x24e033[_0x99a6('0x89')](_0x2f4b01(_0x2971dd[_0x99a6('0x14')],_0x1fa9c6[_0x10314b]));}else{if(!_0x1fa9c6[_0x10314b][_0x99a6('0x90')]){_0x24e033[_0x99a6('0x89')](_0xbacd6b(_0x5e854c,_0x1fa9c6[_0x10314b],_0x2971dd[_0x99a6('0x14')]));}else{if(_0x5e854c['model']){_0x24e033[_0x99a6('0x89')](_0xadd092(_0x5e854c,_0x1fa9c6[_0x10314b]));}}}}}return Promise[_0x99a6('0x8c')](_0x24e033);})[_0x99a6('0x8')](function(_0xad40fc){var _0x410ba1=_0xad40fc;var _0x236033=null;if(_0x410ba1){_0x236033=_0x410ba1[_0x99a6('0x8e')]===0x1?_0x410ba1[0x0]:null;}if(!_0x236033&&!_0x410ba1)return _0x599138;var _0x4b8240=_0x288723[_0x2971dd[_0x99a6('0x14')]][_0x99a6('0x91')];_0xd20b2f[_0x99a6('0xc')]=_['keys'](_0x4b8240);_0xd20b2f[_0x99a6('0x7f')]=_[_0x99a6('0x92')](_0x2c83b1['query']);_0xd20b2f['filters']=_[_0x99a6('0x93')](_0xd20b2f['model'],_0xd20b2f['query']);_0x35ef87[_0x99a6('0x94')]=_[_0x99a6('0x93')](_0xd20b2f[_0x99a6('0xc')],_0x36073c[_0x99a6('0x95')](_0x2c83b1['query'][_0x99a6('0x95')]));_0x35ef87[_0x99a6('0x94')]=_0x35ef87[_0x99a6('0x94')][_0x99a6('0x8e')]?_0x35ef87['attributes']:_0xd20b2f[_0x99a6('0xc')];if(!_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0x96')](_0x99a6('0x97'))){_0x35ef87[_0x99a6('0x98')]=_0x36073c[_0x99a6('0x98')](_0x2c83b1['query'][_0x99a6('0x98')]);_0x35ef87[_0x99a6('0x99')]=_0x36073c[_0x99a6('0x99')](_0x2c83b1['query'][_0x99a6('0x99')]);}_0x35ef87[_0x99a6('0x9a')]=_0x36073c['sort'](_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0x9b')]);_0x35ef87[_0x99a6('0x7d')]=_0x36073c[_0x99a6('0x9c')](_[_0x99a6('0x9d')](_0x2c83b1[_0x99a6('0x7f')],_0xd20b2f[_0x99a6('0x9c')]));if(_0x2c83b1[_0x99a6('0x7f')]['filter']){_0x35ef87['where']=_['merge'](_0x35ef87[_0x99a6('0x7d')],{'$or':_[_0x99a6('0xa')](_0x4b8240,function(_0x14cece){if(_0x14cece[_0x99a6('0x11')][_0x99a6('0x9e')]!==_0x99a6('0x9f')){var _0x1f7202={};_0x1f7202[_0x14cece[_0x99a6('0x6')]]={'$like':'%'+_0x2c83b1['query'][_0x99a6('0x5')]+'%'};return _0x1f7202;}})});}var _0x483cf4=[];var _0x152b92=null;var _0xc68068={};if(_0x236033){_0x152b92=_[_0x99a6('0x8b')](_0x5bc97d,[_0x99a6('0xd'),_0x236033['name']]);if(_0x152b92[_0x99a6('0x6')]){_0xc68068={};if(_0x2971dd['childModel']==='AnalyticExtractedReport'){_0xc68068[_0x152b92[_0x99a6('0xa0')]]=_[_0x99a6('0xa')](_0x236033[_0x99a6('0x9')],'id');}else{_0xc68068[_0x152b92['foreignKey']]=_0x236033['associatedResources'];}_0x483cf4[_0x99a6('0x89')](_0xc68068);}else{_0x35ef87[_0x99a6('0x7d')]['id']=_0x236033[_0x99a6('0x9')];}}else{for(var _0x1b57b4=0x0;_0x1b57b4<_0x410ba1[_0x99a6('0x8e')];_0x1b57b4++){_0x152b92=_[_0x99a6('0x8b')](_0x5bc97d,['name',_0x410ba1[_0x1b57b4][_0x99a6('0xd')]]);if(_0x152b92[_0x99a6('0x6')]){_0xc68068={};_0xc68068[_0x152b92['foreignKey']]=_0x410ba1[_0x1b57b4][_0x99a6('0x9')];_0x483cf4['push'](_0xc68068);}else{if(!_0x35ef87['where']['id'])_0x35ef87['where']['id']=[];_0x410ba1[_0x1b57b4][_0x99a6('0x9')][_0x99a6('0xa1')](function(_0x35547a){_0x35ef87[_0x99a6('0x7d')]['id'][_0x99a6('0x89')](_0x35547a);});}}}if(!_[_0x99a6('0x88')](_0x483cf4)){_0x35ef87[_0x99a6('0x7d')]=_['merge'](_0x35ef87['where'],{'$and':{'$or':_0x483cf4}});}_0x35ef87=_[_0x99a6('0xa2')]({},_0x35ef87,_0x2c83b1[_0x99a6('0xa3')]);if(_0x236033&&!_0x236033[_0x99a6('0x90')]&&_0x2971dd[_0x99a6('0x14')]===_0x99a6('0x10')){if(_0x2c83b1[_0x99a6('0x7f')]['includeAll']){_0x35ef87[_0x99a6('0xa4')]=[{'all':!![]}];}return _0x288723[_0x2971dd['childModel']][_0x99a6('0x7')](_0x35ef87)[_0x99a6('0x8')](function(_0x54782a){var _0x54ecc7=[];_0x54782a[_0x99a6('0xa1')](function(_0x3549b0){var _0x3e4bd9;switch(_0x3549b0['reportType']){case'default':_0x3e4bd9=_[_0x99a6('0x8b')](_0x236033[_0x99a6('0x9')],function(_0x28acda){return _0x28acda['id']===_0x3549b0[_0x99a6('0x72')]&&_0x28acda[_0x99a6('0x11')]===_0x99a6('0xa5');});break;case _0x99a6('0xa6'):_0x3e4bd9=_[_0x99a6('0x8b')](_0x236033[_0x99a6('0x9')],function(_0x854083){return _0x854083['id']===_0x3549b0[_0x99a6('0x72')]&&_0x854083[_0x99a6('0x11')]===_0x99a6('0xa7');});break;}if(_0x3e4bd9)_0x54ecc7[_0x99a6('0x89')](_0x3549b0);});_0x599138[_0x99a6('0xa8')]=_0x54ecc7['length'];_0x599138['rows']=_0x54ecc7;return _0x599138;});}else{if(!_[_0x99a6('0x88')](_0x2c83b1['query'][_0x99a6('0xa9')])){_0x35ef87[_0x99a6('0x7d')]['id']=_0x35ef87[_0x99a6('0x7d')]['id']?_[_0x99a6('0x93')](_0x35ef87[_0x99a6('0x7d')]['id'],_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xa9')]):_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xa9')];if(_0x2c83b1['query']['customSorting']){_0x35ef87[_0x99a6('0x9a')]=_0x2c83b1[_0x99a6('0x7f')]['customSorting'];}}if(_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xaa')]){_0x35ef87[_0x99a6('0x7d')]=_[_0x99a6('0xa2')](_0x35ef87['where'],{'$and':_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xaa')]});}return _0x288723[_0x2971dd['childModel']][_0x99a6('0xa8')]({'where':_0x35ef87[_0x99a6('0x7d')]})[_0x99a6('0x8')](function(_0x4503d2){_0x599138[_0x99a6('0xa8')]=_0x4503d2;if(_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xab')]){if(_0x2971dd['childModel']==='CmContact'){_0x35ef87[_0x99a6('0xa4')]=[{'model':_0x288723[_0x99a6('0xac')],'as':'Tags','attributes':['id',_0x99a6('0xd'),_0x99a6('0xad')],'required':_0x2c83b1[_0x99a6('0x7f')]['tag']?!![]:![]},{'model':_0x288723[_0x99a6('0xac')],'as':_0x99a6('0xae'),'attributes':['id','name',_0x99a6('0xad')],'through':_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xaf')]?{'attributes':[],'where':{'TagId':_0x2c83b1[_0x99a6('0x7f')]['tag']||undefined}}:{},'required':_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xaf')]?!![]:![]}];}else{_0x35ef87[_0x99a6('0xa4')]=[{'all':!![]}];}}return _0x288723[_0x2971dd[_0x99a6('0x14')]]['findAll'](_0x35ef87);})[_0x99a6('0x8')](function(_0x2c8b1c){_0x599138[_0x99a6('0xb0')]=_0x2c8b1c;if(_0x17e994===_0x99a6('0x32')&&_0x2c83b1[_0x99a6('0x7f')][_0x99a6('0xb1')]==='true'){var _0x34c7e5=[];for(var _0x4da012=0x0;_0x4da012<_0x599138[_0x99a6('0xb0')][_0x99a6('0x8e')];_0x4da012++){_0x34c7e5['push'](_0x2ff33c('chat',_0x599138[_0x99a6('0xb0')][_0x4da012][_0x99a6('0xb2')]));_0x34c7e5[_0x99a6('0x89')](_0x2ff33c(_0x99a6('0xb3'),_0x599138[_0x99a6('0xb0')][_0x4da012]['dataValues']));_0x34c7e5['push'](_0x2ff33c('fax',_0x599138[_0x99a6('0xb0')][_0x4da012][_0x99a6('0xb2')]));_0x34c7e5[_0x99a6('0x89')](_0x2ff33c('mail',_0x599138[_0x99a6('0xb0')][_0x4da012][_0x99a6('0xb2')]));_0x34c7e5[_0x99a6('0x89')](_0x2ff33c(_0x99a6('0xb4'),_0x599138['rows'][_0x4da012][_0x99a6('0xb2')]));_0x34c7e5[_0x99a6('0x89')](_0x2ff33c(_0x99a6('0xb5'),_0x599138[_0x99a6('0xb0')][_0x4da012][_0x99a6('0xb2')]));}return Promise['all'](_0x34c7e5)[_0x99a6('0x8')](function(){return _0x599138;});}return _0x599138;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 062641d..1fcbb40 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 _0x8110=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./userProfile.socket','register','then','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','ioredis'];(function(_0x9d1cb4,_0x3dbed0){var _0x2ad7c7=function(_0x58ee59){while(--_0x58ee59){_0x9d1cb4['push'](_0x9d1cb4['shift']());}};_0x2ad7c7(++_0x3dbed0);}(_0x8110,0x185));var _0x0811=function(_0x533365,_0x2c31bb){_0x533365=_0x533365-0x0;var _0x3e8575=_0x8110[_0x533365];return _0x3e8575;};'use strict';var _=require('lodash');var util=require(_0x0811('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0811('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0811('0x2'));var logger=require(_0x0811('0x3'))(_0x0811('0x4'));var config=require(_0x0811('0x5'));var jayson=require(_0x0811('0x6'));var client=jayson['client'][_0x0811('0x7')]({'port':0x232a});config['redis']=_[_0x0811('0x8')](config[_0x0811('0x9')],{'host':_0x0811('0xa'),'port':0x18eb});var socket=require(_0x0811('0xb'))(new Redis(config[_0x0811('0x9')]));require(_0x0811('0xc'))[_0x0811('0xd')](socket);function respondWithRpcPromise(_0x297459,_0x2baaa3,_0x37e502){return new BPromise(function(_0x4aea9e,_0x521f2a){return client['request'](_0x297459,_0x37e502)[_0x0811('0xe')](function(_0x5122c6){logger['info'](_0x0811('0xf'),_0x2baaa3,'request\x20sent');logger[_0x0811('0x10')](_0x0811('0x11'),_0x2baaa3,_0x0811('0x12'),JSON[_0x0811('0x13')](_0x5122c6));if(_0x5122c6[_0x0811('0x14')]){if(_0x5122c6['error']['code']===0x1f4){logger[_0x0811('0x14')]('UserProfile,\x20%s,\x20%s',_0x2baaa3,_0x5122c6['error'][_0x0811('0x15')]);return _0x521f2a(_0x5122c6['error']['message']);}logger['error'](_0x0811('0xf'),_0x2baaa3,_0x5122c6[_0x0811('0x14')][_0x0811('0x15')]);return _0x4aea9e(_0x5122c6[_0x0811('0x14')][_0x0811('0x15')]);}else{logger['info'](_0x0811('0xf'),_0x2baaa3,_0x0811('0x12'));_0x4aea9e(_0x5122c6[_0x0811('0x16')][_0x0811('0x15')]);}})['catch'](function(_0x5f0a08){logger[_0x0811('0x14')](_0x0811('0xf'),_0x2baaa3,_0x5f0a08);_0x521f2a(_0x5f0a08);});});} \ No newline at end of file +var _0x8ff3=['../../config/utils','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','then','info','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','error','UserProfile,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4c260a,_0x148241){var _0x17bbdd=function(_0x4f3e9f){while(--_0x4f3e9f){_0x4c260a['push'](_0x4c260a['shift']());}};_0x17bbdd(++_0x148241);}(_0x8ff3,0x72));var _0x38ff=function(_0x2e9b61,_0x2120cf){_0x2e9b61=_0x2e9b61-0x0;var _0x597ccd=_0x8ff3[_0x2e9b61];return _0x597ccd;};'use strict';var _=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var moment=require('moment');var BPromise=require(_0x38ff('0x2'));var rs=require(_0x38ff('0x3'));var fs=require('fs');var Redis=require(_0x38ff('0x4'));var db=require(_0x38ff('0x5'))['db'];var utils=require(_0x38ff('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x38ff('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38ff('0x8')]['http']({'port':0x232a});config[_0x38ff('0x9')]=_[_0x38ff('0xa')](config[_0x38ff('0x9')],{'host':_0x38ff('0xb'),'port':0x18eb});var socket=require(_0x38ff('0xc'))(new Redis(config[_0x38ff('0x9')]));require(_0x38ff('0xd'))[_0x38ff('0xe')](socket);function respondWithRpcPromise(_0x17820a,_0x3a701b,_0x261325){return new BPromise(function(_0x217abf,_0x11058d){return client['request'](_0x17820a,_0x261325)[_0x38ff('0xf')](function(_0x9d5d77){logger[_0x38ff('0x10')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x38ff('0x11'));logger[_0x38ff('0x12')](_0x38ff('0x13'),_0x3a701b,_0x38ff('0x11'),JSON['stringify'](_0x9d5d77));if(_0x9d5d77[_0x38ff('0x14')]){if(_0x9d5d77[_0x38ff('0x14')]['code']===0x1f4){logger[_0x38ff('0x14')](_0x38ff('0x15'),_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x11058d(_0x9d5d77[_0x38ff('0x14')]['message']);}logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x9d5d77[_0x38ff('0x14')]['message']);return _0x217abf(_0x9d5d77['error'][_0x38ff('0x16')]);}else{logger[_0x38ff('0x10')](_0x38ff('0x15'),_0x3a701b,_0x38ff('0x11'));_0x217abf(_0x9d5d77[_0x38ff('0x17')][_0x38ff('0x16')]);}})['catch'](function(_0x2f9a29){logger[_0x38ff('0x14')]('UserProfile,\x20%s,\x20%s',_0x3a701b,_0x2f9a29);_0x11058d(_0x2f9a29);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e15c940..cf3f14d 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 _0xc092=['removeListener','userProfile:','./userProfile.events','save','remove','update','emit'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc092,0x64));var _0x2c09=function(_0x4d393f,_0x30d030){_0x4d393f=_0x4d393f-0x0;var _0xbcf0d0=_0xc092[_0x4d393f];return _0xbcf0d0;};'use strict';var UserProfileEvents=require(_0x2c09('0x0'));var events=[_0x2c09('0x1'),_0x2c09('0x2'),_0x2c09('0x3')];function createListener(_0x487172,_0x186790){return function(_0x3932f3){_0x186790[_0x2c09('0x4')](_0x487172,_0x3932f3);};}function removeListener(_0x2a63ed,_0x11356d){return function(){UserProfileEvents[_0x2c09('0x5')](_0x2a63ed,_0x11356d);};}exports['register']=function(_0x39560a){for(var _0x4de1b1=0x0,_0x4349a4=events['length'];_0x4de1b1<_0x4349a4;_0x4de1b1++){var _0x3bf3e6=events[_0x4de1b1];var _0x311c9c=createListener(_0x2c09('0x6')+_0x3bf3e6,_0x39560a);UserProfileEvents['on'](_0x3bf3e6,_0x311c9c);}}; \ No newline at end of file +var _0x49f4=['update','register','userProfile:','./userProfile.events','remove'];(function(_0x2acab3,_0x9d8a85){var _0x3ace4f=function(_0x557fde){while(--_0x557fde){_0x2acab3['push'](_0x2acab3['shift']());}};_0x3ace4f(++_0x9d8a85);}(_0x49f4,0x1cf));var _0x449f=function(_0x170cbb,_0x9093e){_0x170cbb=_0x170cbb-0x0;var _0x39fae4=_0x49f4[_0x170cbb];return _0x39fae4;};'use strict';var UserProfileEvents=require(_0x449f('0x0'));var events=['save',_0x449f('0x1'),_0x449f('0x2')];function createListener(_0x5ccfec,_0xc189dc){return function(_0x423b12){_0xc189dc['emit'](_0x5ccfec,_0x423b12);};}function removeListener(_0x3793ed,_0x391ce3){return function(){UserProfileEvents['removeListener'](_0x3793ed,_0x391ce3);};}exports[_0x449f('0x3')]=function(_0x4811f2){for(var _0x4754b7=0x0,_0x229f9c=events['length'];_0x4754b7<_0x229f9c;_0x4754b7++){var _0x842815=events[_0x4754b7];var _0x32b8bd=createListener(_0x449f('0x4')+_0x842815,_0x4811f2);UserProfileEvents['on'](_0x842815,_0x32b8bd);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index f2a392b..0cfbc09 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 _0x677c=['/:id','delete','destroy','exports','multer','util','path','express','Router','fs-extra','./userProfileResource.controller','isAuthenticated','index','get','/describe','describe','show','post','create'];(function(_0x6387ab,_0x423fad){var _0x1f55ed=function(_0x511d9f){while(--_0x511d9f){_0x6387ab['push'](_0x6387ab['shift']());}};_0x1f55ed(++_0x423fad);}(_0x677c,0x10e));var _0xc677=function(_0x25cfbb,_0x8ebccc){_0x25cfbb=_0x25cfbb-0x0;var _0x495876=_0x677c[_0x25cfbb];return _0x495876;};'use strict';var multer=require(_0xc677('0x0'));var util=require(_0xc677('0x1'));var path=require(_0xc677('0x2'));var timeout=require('connect-timeout');var express=require(_0xc677('0x3'));var router=express[_0xc677('0x4')]();var fs_extra=require(_0xc677('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc677('0x6'));router['get']('/',auth[_0xc677('0x7')](),controller[_0xc677('0x8')]);router[_0xc677('0x9')](_0xc677('0xa'),auth['isAuthenticated'](),controller[_0xc677('0xb')]);router[_0xc677('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xc677('0xc')]);router[_0xc677('0xd')]('/',auth['isAuthenticated'](),controller[_0xc677('0xe')]);router['put'](_0xc677('0xf'),auth[_0xc677('0x7')](),controller['update']);router[_0xc677('0x10')](_0xc677('0xf'),auth[_0xc677('0x7')](),controller[_0xc677('0x11')]);module[_0xc677('0x12')]=router; \ No newline at end of file +var _0x2308=['update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','create','put','/:id'];(function(_0x525299,_0x4c589e){var _0x5139bd=function(_0x2bcc6d){while(--_0x2bcc6d){_0x525299['push'](_0x525299['shift']());}};_0x5139bd(++_0x4c589e);}(_0x2308,0xb7));var _0x8230=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x2308[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x8230('0x0'));var util=require(_0x8230('0x1'));var path=require(_0x8230('0x2'));var timeout=require(_0x8230('0x3'));var express=require(_0x8230('0x4'));var router=express['Router']();var fs_extra=require(_0x8230('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8230('0x6'));var config=require(_0x8230('0x7'));var controller=require('./userProfileResource.controller');router[_0x8230('0x8')]('/',auth[_0x8230('0x9')](),controller[_0x8230('0xa')]);router[_0x8230('0x8')](_0x8230('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0x8230('0x9')](),controller['show']);router['post']('/',auth[_0x8230('0x9')](),controller[_0x8230('0xc')]);router[_0x8230('0xd')](_0x8230('0xe'),auth[_0x8230('0x9')](),controller[_0x8230('0xf')]);router['delete'](_0x8230('0xe'),auth[_0x8230('0x9')](),controller[_0x8230('0x10')]);module[_0x8230('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index c7ba188..12f47f4 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 _0x3899=['INTEGER','sequelize','STRING'];(function(_0x2373f3,_0x39a74a){var _0x908a47=function(_0x3d9703){while(--_0x3d9703){_0x2373f3['push'](_0x2373f3['shift']());}};_0x908a47(++_0x39a74a);}(_0x3899,0x139));var _0x9389=function(_0x19aaac,_0x1ecb05){_0x19aaac=_0x19aaac-0x0;var _0x16972a=_0x3899[_0x19aaac];return _0x16972a;};'use strict';var Sequelize=require(_0x9389('0x0'));module['exports']={'name':{'type':Sequelize[_0x9389('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x9389('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9389('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9aa7=['STRING','INTEGER','exports'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0x9aa7,0x1c7));var _0x79aa=function(_0x3c9750,_0x2d4a4a){_0x3c9750=_0x3c9750-0x0;var _0x403e82=_0x9aa7[_0x3c9750];return _0x403e82;};'use strict';var Sequelize=require('sequelize');module[_0x79aa('0x0')]={'name':{'type':Sequelize[_0x79aa('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x79aa('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79aa('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3024105..ef4c4ff 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 _0x66fa=['end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','includeAll','include','UserProfileResource','findAll','rows','catch','merge','options','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x66fa,0x117));var _0xa66f=function(_0x354418,_0x20e61d){_0x354418=_0x354418-0x0;var _0x1ef58a=_0x66fa[_0x354418];return _0x1ef58a;};'use strict';var emlformat=require(_0xa66f('0x0'));var rimraf=require(_0xa66f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa66f('0x2'));var rp=require(_0xa66f('0x3'));var moment=require(_0xa66f('0x4'));var BPromise=require(_0xa66f('0x5'));var Mustache=require(_0xa66f('0x6'));var util=require(_0xa66f('0x7'));var path=require(_0xa66f('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa66f('0x9'));var fs=require('fs');var fs_extra=require(_0xa66f('0xa'));var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xa66f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x251189,_0x14af70){_0x14af70=_0x14af70||0xcc;return function(_0xca12f8){if(_0xca12f8){return _0x251189['sendStatus'](_0x14af70);}return _0x251189['status'](_0x14af70)[_0xa66f('0x15')]();};}function respondWithResult(_0x4e09cf,_0x528427){_0x528427=_0x528427||0xc8;return function(_0x5a7b16){if(_0x5a7b16){return _0x4e09cf[_0xa66f('0x16')](_0x528427)[_0xa66f('0x17')](_0x5a7b16);}};}function respondWithFilteredResult(_0x267129,_0x236d64){return function(_0xd348f9){if(_0xd348f9){var _0x567d4f=typeof _0x236d64['offset']===_0xa66f('0x18')&&typeof _0x236d64[_0xa66f('0x19')]===_0xa66f('0x18');var _0x403f4d=_0xd348f9['count'];var _0x1cbe64=_0x567d4f?0x0:_0x236d64['offset'];var _0x4a28d4=_0x567d4f?_0xd348f9[_0xa66f('0x1a')]:_0x236d64[_0xa66f('0x1b')]+_0x236d64[_0xa66f('0x19')];var _0x355ddc;if(_0x4a28d4>=_0x403f4d){_0x4a28d4=_0x403f4d;_0x355ddc=0xc8;}else{_0x355ddc=0xce;}_0x267129[_0xa66f('0x16')](_0x355ddc);return _0x267129[_0xa66f('0x1c')](_0xa66f('0x1d'),_0x1cbe64+'-'+_0x4a28d4+'/'+_0x403f4d)[_0xa66f('0x17')](_0xd348f9);}return null;};}function patchUpdates(_0x2033a4){return function(_0x2d9602){try{jsonpatch[_0xa66f('0x1e')](_0x2d9602,_0x2033a4,!![]);}catch(_0xbba376){return BPromise[_0xa66f('0x1f')](_0xbba376);}return _0x2d9602[_0xa66f('0x20')]();};}function saveUpdates(_0x82924d,_0x5cd613){return function(_0x27f570){if(_0x27f570){return _0x27f570[_0xa66f('0x21')](_0x82924d)[_0xa66f('0x22')](function(_0x37ee13){return _0x37ee13;});}return null;};}function removeEntity(_0x5cbd82,_0x337602){return function(_0x473822){if(_0x473822){return _0x473822[_0xa66f('0x23')]()[_0xa66f('0x22')](function(){_0x5cbd82['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xed98b9,_0x598942){return function(_0x3a3e4f){if(!_0x3a3e4f){_0xed98b9[_0xa66f('0x24')](0x194);}return _0x3a3e4f;};}function handleError(_0x384164,_0x57da7f){_0x57da7f=_0x57da7f||0x1f4;return function(_0x4683c7){logger[_0xa66f('0x25')](_0x4683c7[_0xa66f('0x26')]);if(_0x4683c7[_0xa66f('0x27')]){delete _0x4683c7[_0xa66f('0x27')];}_0x384164[_0xa66f('0x16')](_0x57da7f)[_0xa66f('0x28')](_0x4683c7);};}exports[_0xa66f('0x29')]=function(_0x20ee67,_0x117d03){var _0x45f71c={},_0x63650b={},_0x42b966={'count':0x0,'rows':[]};var _0xeeb22e=_['map'](db['UserProfileResource'][_0xa66f('0x2a')],function(_0x27ceae){return{'name':_0x27ceae['fieldName'],'type':_0x27ceae[_0xa66f('0x2b')][_0xa66f('0x2c')]};});_0x63650b['model']=_[_0xa66f('0x2d')](_0xeeb22e,_0xa66f('0x27'));_0x63650b[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x20ee67[_0xa66f('0x2e')]);_0x63650b['filters']=_[_0xa66f('0x30')](_0x63650b['model'],_0x63650b[_0xa66f('0x2e')]);_0x45f71c[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x63650b['model'],qs[_0xa66f('0x32')](_0x20ee67[_0xa66f('0x2e')]['fields']));_0x45f71c[_0xa66f('0x31')]=_0x45f71c[_0xa66f('0x31')][_0xa66f('0x33')]?_0x45f71c[_0xa66f('0x31')]:_0x63650b[_0xa66f('0x34')];if(!_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x35')](_0xa66f('0x36'))){_0x45f71c[_0xa66f('0x19')]=qs[_0xa66f('0x19')](_0x20ee67['query'][_0xa66f('0x19')]);_0x45f71c['offset']=qs[_0xa66f('0x1b')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x1b')]);}_0x45f71c[_0xa66f('0x37')]=qs[_0xa66f('0x38')](_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x38')]);_0x45f71c[_0xa66f('0x39')]=qs['filters'](_[_0xa66f('0x3a')](_0x20ee67['query'],_0x63650b[_0xa66f('0x3b')]),_0xeeb22e);if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3c')]){_0x45f71c['where']=_['merge'](_0x45f71c[_0xa66f('0x39')],{'$or':_[_0xa66f('0x2d')](_0xeeb22e,function(_0x20b07e){if(_0x20b07e[_0xa66f('0x2b')]!==_0xa66f('0x3d')){var _0x581dca={};_0x581dca[_0x20b07e['name']]={'$like':'%'+_0x20ee67['query'][_0xa66f('0x3c')]+'%'};return _0x581dca;}})});}_0x45f71c=_['merge']({},_0x45f71c,_0x20ee67['options']);var _0x5bf856={'where':_0x45f71c[_0xa66f('0x39')]};return db['UserProfileResource'][_0xa66f('0x1a')](_0x5bf856)[_0xa66f('0x22')](function(_0x23a546){_0x42b966[_0xa66f('0x1a')]=_0x23a546;if(_0x20ee67[_0xa66f('0x2e')][_0xa66f('0x3e')]){_0x45f71c[_0xa66f('0x3f')]=[{'all':!![]}];}return db[_0xa66f('0x40')][_0xa66f('0x41')](_0x45f71c);})[_0xa66f('0x22')](function(_0x3a7929){_0x42b966[_0xa66f('0x42')]=_0x3a7929;return _0x42b966;})[_0xa66f('0x22')](respondWithFilteredResult(_0x117d03,_0x45f71c))[_0xa66f('0x43')](handleError(_0x117d03,null));};exports['show']=function(_0x36037c,_0x25c2cb){var _0x58c1f2={'raw':![],'where':{'id':_0x36037c['params']['id']}},_0x248587={};_0x248587[_0xa66f('0x34')]=_[_0xa66f('0x2f')](db['UserProfileResource'][_0xa66f('0x2a')]);_0x248587[_0xa66f('0x2e')]=_[_0xa66f('0x2f')](_0x36037c['query']);_0x248587[_0xa66f('0x3b')]=_['intersection'](_0x248587[_0xa66f('0x34')],_0x248587[_0xa66f('0x2e')]);_0x58c1f2[_0xa66f('0x31')]=_[_0xa66f('0x30')](_0x248587[_0xa66f('0x34')],qs[_0xa66f('0x32')](_0x36037c[_0xa66f('0x2e')]['fields']));_0x58c1f2[_0xa66f('0x31')]=_0x58c1f2[_0xa66f('0x31')][_0xa66f('0x33')]?_0x58c1f2[_0xa66f('0x31')]:_0x248587[_0xa66f('0x34')];if(_0x36037c['query']['includeAll']){_0x58c1f2[_0xa66f('0x3f')]=[{'all':!![]}];}_0x58c1f2=_[_0xa66f('0x44')]({},_0x58c1f2,_0x36037c[_0xa66f('0x45')]);return db[_0xa66f('0x40')][_0xa66f('0x46')](_0x58c1f2)[_0xa66f('0x22')](handleEntityNotFound(_0x25c2cb,null))['then'](respondWithResult(_0x25c2cb,null))[_0xa66f('0x43')](handleError(_0x25c2cb,null));};exports[_0xa66f('0x47')]=function(_0x3f9cdd,_0x5651e9){return db['UserProfileResource'][_0xa66f('0x47')](_0x3f9cdd[_0xa66f('0x48')],{})[_0xa66f('0x22')](respondWithResult(_0x5651e9,0xc9))['catch'](handleError(_0x5651e9,null));};exports['update']=function(_0x52054e,_0x19e7ce){if(_0x52054e[_0xa66f('0x48')]['id']){delete _0x52054e[_0xa66f('0x48')]['id'];}return db[_0xa66f('0x40')][_0xa66f('0x46')]({'where':{'id':_0x52054e[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x19e7ce,null))[_0xa66f('0x22')](saveUpdates(_0x52054e['body'],null))[_0xa66f('0x22')](respondWithResult(_0x19e7ce,null))[_0xa66f('0x43')](handleError(_0x19e7ce,null));};exports[_0xa66f('0x23')]=function(_0x393755,_0x11597b){return db[_0xa66f('0x40')]['find']({'where':{'id':_0x393755[_0xa66f('0x49')]['id']}})[_0xa66f('0x22')](handleEntityNotFound(_0x11597b,null))[_0xa66f('0x22')](removeEntity(_0x11597b,null))[_0xa66f('0x43')](handleError(_0x11597b,null));};exports[_0xa66f('0x4a')]=function(_0x5d77d1,_0x389b9a){return db['UserProfileResource'][_0xa66f('0x4a')]()['then'](respondWithResult(_0x389b9a,null))['catch'](handleError(_0x389b9a,null));}; \ No newline at end of file +var _0x4991=['hasOwnProperty','nolimit','order','sort','where','merge','type','filter','options','UserProfileResource','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','describe','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','intersection','attributes','fields','length'];(function(_0x1cbeba,_0x5b3232){var _0x208431=function(_0x1d94ff){while(--_0x1d94ff){_0x1cbeba['push'](_0x1cbeba['shift']());}};_0x208431(++_0x5b3232);}(_0x4991,0xf7));var _0x1499=function(_0x1767bd,_0x34c458){_0x1767bd=_0x1767bd-0x0;var _0x5c830d=_0x4991[_0x1767bd];return _0x5c830d;};'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['UserProfileResource'][_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));};exports[_0x1499('0x4a')]=function(_0x9f0520,_0x278178){return db['UserProfileResource'][_0x1499('0x4a')]()[_0x1499('0x24')](respondWithResult(_0x278178,null))['catch'](handleError(_0x278178,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 785b3db..e45179c 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 _0x6f67=['api','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger'];(function(_0x2a2172,_0x44a272){var _0x295c85=function(_0x5960e6){while(--_0x5960e6){_0x2a2172['push'](_0x2a2172['shift']());}};_0x295c85(++_0x44a272);}(_0x6f67,0xc1));var _0x76f6=function(_0x492063,_0xe743cd){_0x492063=_0x492063-0x0;var _0x5f2c12=_0x6f67[_0x492063];return _0x5f2c12;};'use strict';var _=require(_0x76f6('0x0'));var util=require('util');var logger=require(_0x76f6('0x1'))(_0x76f6('0x2'));var moment=require(_0x76f6('0x3'));var BPromise=require(_0x76f6('0x4'));var rp=require(_0x76f6('0x5'));var fs=require('fs');var path=require(_0x76f6('0x6'));var rimraf=require(_0x76f6('0x7'));var config=require('../../config/environment');var attributes=require(_0x76f6('0x8'));module[_0x76f6('0x9')]=function(_0x47345c,_0x44a0ad){return _0x47345c[_0x76f6('0xa')]('UserProfileResource',attributes,{'tableName':_0x76f6('0xb'),'paranoid':![],'indexes':[{'name':_0x76f6('0xc'),'fields':[_0x76f6('0xd'),_0x76f6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x065b=['define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports'];(function(_0x56f17e,_0x2dd0aa){var _0x401579=function(_0xeb0524){while(--_0xeb0524){_0x56f17e['push'](_0x56f17e['shift']());}};_0x401579(++_0x2dd0aa);}(_0x065b,0xe2));var _0xb065=function(_0x4da4ea,_0x2875d3){_0x4da4ea=_0x4da4ea-0x0;var _0x3cc102=_0x065b[_0x4da4ea];return _0x3cc102;};'use strict';var _=require(_0xb065('0x0'));var util=require(_0xb065('0x1'));var logger=require(_0xb065('0x2'))(_0xb065('0x3'));var moment=require(_0xb065('0x4'));var BPromise=require(_0xb065('0x5'));var rp=require(_0xb065('0x6'));var fs=require('fs');var path=require(_0xb065('0x7'));var rimraf=require(_0xb065('0x8'));var config=require(_0xb065('0x9'));var attributes=require(_0xb065('0xa'));module[_0xb065('0xb')]=function(_0x4333ed,_0x2b2542){return _0x4333ed[_0xb065('0xc')](_0xb065('0xd'),attributes,{'tableName':_0xb065('0xe'),'paranoid':![],'indexes':[{'name':_0xb065('0xf'),'fields':[_0xb065('0x10'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 8685d2a..bc198a0 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 _0x47e4=['then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x54d7bf,_0x1e321b){var _0x38528d=function(_0x2d632e){while(--_0x2d632e){_0x54d7bf['push'](_0x54d7bf['shift']());}};_0x38528d(++_0x1e321b);}(_0x47e4,0x196));var _0x447e=function(_0x2b7248,_0x17b24e){_0x2b7248=_0x2b7248-0x0;var _0x418838=_0x47e4[_0x2b7248];return _0x418838;};'use strict';var _=require(_0x447e('0x0'));var util=require(_0x447e('0x1'));var moment=require(_0x447e('0x2'));var BPromise=require(_0x447e('0x3'));var rs=require(_0x447e('0x4'));var fs=require('fs');var Redis=require(_0x447e('0x5'));var db=require(_0x447e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x447e('0x7'))(_0x447e('0x8'));var config=require('../../config/environment');var jayson=require(_0x447e('0x9'));var client=jayson[_0x447e('0xa')][_0x447e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28b094,_0x3c1121,_0x10c3bd){return new BPromise(function(_0x19e14a,_0x4234b4){return client['request'](_0x28b094,_0x10c3bd)[_0x447e('0xc')](function(_0x3a9c35){logger[_0x447e('0xd')](_0x447e('0xe'),_0x3c1121,_0x447e('0xf'));logger[_0x447e('0x10')](_0x447e('0x11'),_0x3c1121,_0x447e('0xf'),JSON['stringify'](_0x3a9c35));if(_0x3a9c35[_0x447e('0x12')]){if(_0x3a9c35['error']['code']===0x1f4){logger[_0x447e('0x12')](_0x447e('0xe'),_0x3c1121,_0x3a9c35['error'][_0x447e('0x13')]);return _0x4234b4(_0x3a9c35['error'][_0x447e('0x13')]);}logger['error'](_0x447e('0xe'),_0x3c1121,_0x3a9c35[_0x447e('0x12')][_0x447e('0x13')]);return _0x19e14a(_0x3a9c35['error'][_0x447e('0x13')]);}else{logger['info'](_0x447e('0xe'),_0x3c1121,_0x447e('0xf'));_0x19e14a(_0x3a9c35[_0x447e('0x14')]['message']);}})[_0x447e('0x15')](function(_0x146641){logger[_0x447e('0x12')](_0x447e('0xe'),_0x3c1121,_0x146641);_0x4234b4(_0x146641);});});} \ No newline at end of file +var _0x88a2=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring'];(function(_0x4f0e62,_0x28e44f){var _0x117ab8=function(_0x1a74bb){while(--_0x1a74bb){_0x4f0e62['push'](_0x4f0e62['shift']());}};_0x117ab8(++_0x28e44f);}(_0x88a2,0x9d));var _0x288a=function(_0x310463,_0x7e69a1){_0x310463=_0x310463-0x0;var _0x32f582=_0x88a2[_0x310463];return _0x32f582;};'use strict';var _=require('lodash');var util=require(_0x288a('0x0'));var moment=require('moment');var BPromise=require(_0x288a('0x1'));var rs=require(_0x288a('0x2'));var fs=require('fs');var Redis=require(_0x288a('0x3'));var db=require(_0x288a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x288a('0x5'));var config=require(_0x288a('0x6'));var jayson=require(_0x288a('0x7'));var client=jayson[_0x288a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40dc91,_0x85d235,_0x3ca42f){return new BPromise(function(_0x334e4c,_0x3e5fa2){return client[_0x288a('0x9')](_0x40dc91,_0x3ca42f)[_0x288a('0xa')](function(_0x6730e1){logger[_0x288a('0xb')](_0x288a('0xc'),_0x85d235,_0x288a('0xd'));logger[_0x288a('0xe')](_0x288a('0xf'),_0x85d235,'request\x20sent',JSON['stringify'](_0x6730e1));if(_0x6730e1[_0x288a('0x10')]){if(_0x6730e1[_0x288a('0x10')]['code']===0x1f4){logger['error'](_0x288a('0xc'),_0x85d235,_0x6730e1['error'][_0x288a('0x11')]);return _0x3e5fa2(_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);}logger[_0x288a('0x10')](_0x288a('0xc'),_0x85d235,_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);return _0x334e4c(_0x6730e1[_0x288a('0x10')][_0x288a('0x11')]);}else{logger[_0x288a('0xb')](_0x288a('0xc'),_0x85d235,_0x288a('0xd'));_0x334e4c(_0x6730e1[_0x288a('0x12')]['message']);}})[_0x288a('0x13')](function(_0x2094ba){logger['error'](_0x288a('0xc'),_0x85d235,_0x2094ba);_0x3e5fa2(_0x2094ba);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 322fca3..32c37f8 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 _0xeb74=['Router','fs-extra','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','destroy','exports','util','path','connect-timeout','express'];(function(_0x2be7ce,_0x1f2ba6){var _0x3a7d53=function(_0x1adbf){while(--_0x1adbf){_0x2be7ce['push'](_0x2be7ce['shift']());}};_0x3a7d53(++_0x1f2ba6);}(_0xeb74,0x18c));var _0x4eb7=function(_0x40db76,_0xad7ade){_0x40db76=_0x40db76-0x0;var _0x5e312a=_0xeb74[_0x40db76];return _0x5e312a;};'use strict';var multer=require('multer');var util=require(_0x4eb7('0x0'));var path=require(_0x4eb7('0x1'));var timeout=require(_0x4eb7('0x2'));var express=require(_0x4eb7('0x3'));var router=express[_0x4eb7('0x4')]();var fs_extra=require(_0x4eb7('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4eb7('0x6'));var controller=require(_0x4eb7('0x7'));router[_0x4eb7('0x8')]('/',auth[_0x4eb7('0x9')](),controller[_0x4eb7('0xa')]);router[_0x4eb7('0x8')](_0x4eb7('0xb'),auth[_0x4eb7('0x9')](),controller[_0x4eb7('0xc')]);router[_0x4eb7('0x8')](_0x4eb7('0xd'),auth[_0x4eb7('0x9')](),controller[_0x4eb7('0xe')]);router['post']('/',auth[_0x4eb7('0x9')](),controller[_0x4eb7('0xf')]);router[_0x4eb7('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x4eb7('0x11')]);router['delete'](_0x4eb7('0xd'),auth['isAuthenticated'](),controller[_0x4eb7('0x12')]);module[_0x4eb7('0x13')]=router; \ No newline at end of file +var _0xa72a=['describe','/:id','show','post','create','put','update','delete','destroy','util','path','express','Router','../../config/environment','./userProfileSection.controller','isAuthenticated','index','get','/describe'];(function(_0x4da7a9,_0x186528){var _0x2b84f6=function(_0x99499b){while(--_0x99499b){_0x4da7a9['push'](_0x4da7a9['shift']());}};_0x2b84f6(++_0x186528);}(_0xa72a,0xed));var _0xaa72=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0xa72a[_0x2532a6];return _0x1d6b92;};'use strict';var multer=require('multer');var util=require(_0xaa72('0x0'));var path=require(_0xaa72('0x1'));var timeout=require('connect-timeout');var express=require(_0xaa72('0x2'));var router=express[_0xaa72('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaa72('0x4'));var controller=require(_0xaa72('0x5'));router['get']('/',auth[_0xaa72('0x6')](),controller[_0xaa72('0x7')]);router[_0xaa72('0x8')](_0xaa72('0x9'),auth[_0xaa72('0x6')](),controller[_0xaa72('0xa')]);router[_0xaa72('0x8')](_0xaa72('0xb'),auth[_0xaa72('0x6')](),controller[_0xaa72('0xc')]);router[_0xaa72('0xd')]('/',auth[_0xaa72('0x6')](),controller[_0xaa72('0xe')]);router[_0xaa72('0xf')](_0xaa72('0xb'),auth['isAuthenticated'](),controller[_0xaa72('0x10')]);router[_0xaa72('0x11')]('/:id',auth[_0xaa72('0x6')](),controller[_0xaa72('0x12')]);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 fac79c7..dab08c5 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 _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x57f8,0x198));var _0x857f=function(_0x1ef71d,_0x453e87){_0x1ef71d=_0x1ef71d-0x0;var _0x5bd739=_0x57f8[_0x1ef71d];return _0x5bd739;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file +var _0xe2cf=['crudPermissions','join','getDataValue','exports','STRING','BOOLEAN'];(function(_0x53c3fb,_0x163f71){var _0x47c75d=function(_0x32d4f8){while(--_0x32d4f8){_0x53c3fb['push'](_0x53c3fb['shift']());}};_0x47c75d(++_0x163f71);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0xe2cf[_0x1222fa];return _0x1dcd74;};'use strict';var Sequelize=require('sequelize');module[_0xfe2c('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0xfe2c('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xfe2c('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xfe2c('0x1')],'set':function(_0x11b6b8){this['setDataValue'](_0xfe2c('0x3'),_0x11b6b8?_0x11b6b8[_0xfe2c('0x4')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0xfe2c('0x5')](_0xfe2c('0x3'))['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index c354812..d7aa2c1 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 _0xcd82=['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','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','filters','attributes','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','keys','intersection','find','create','body','catch','update','params','describe','eml-format','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto'];(function(_0x4ccda5,_0x3dc4e1){var _0x50d744=function(_0x3e0c90){while(--_0x3e0c90){_0x4ccda5['push'](_0x4ccda5['shift']());}};_0x50d744(++_0x3dc4e1);}(_0xcd82,0x1b6));var _0x2cd8=function(_0x18fac0,_0x523ba4){_0x18fac0=_0x18fac0-0x0;var _0x20e0a0=_0xcd82[_0x18fac0];return _0x20e0a0;};'use strict';var emlformat=require(_0x2cd8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2cd8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cd8('0x2'));var moment=require('moment');var BPromise=require(_0x2cd8('0x3'));var Mustache=require('mustache');var util=require(_0x2cd8('0x4'));var path=require(_0x2cd8('0x5'));var sox=require(_0x2cd8('0x6'));var csv=require(_0x2cd8('0x7'));var ejs=require(_0x2cd8('0x8'));var fs=require('fs');var fs_extra=require(_0x2cd8('0x9'));var _=require('lodash');var squel=require(_0x2cd8('0xa'));var crypto=require(_0x2cd8('0xb'));var jsforce=require(_0x2cd8('0xc'));var deskjs=require(_0x2cd8('0xd'));var toCsv=require(_0x2cd8('0x7'));var querystring=require('querystring');var Papa=require(_0x2cd8('0xe'));var Redis=require(_0x2cd8('0xf'));var authService=require(_0x2cd8('0x10'));var qs=require(_0x2cd8('0x11'));var as=require(_0x2cd8('0x12'));var hardwareService=require(_0x2cd8('0x13'));var logger=require(_0x2cd8('0x14'))(_0x2cd8('0x15'));var utils=require(_0x2cd8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2cd8('0x17'));var db=require(_0x2cd8('0x18'))['db'];function respondWithStatusCode(_0x328bc2,_0x37837b){_0x37837b=_0x37837b||0xcc;return function(_0x2d8c07){if(_0x2d8c07){return _0x328bc2[_0x2cd8('0x19')](_0x37837b);}return _0x328bc2[_0x2cd8('0x1a')](_0x37837b)[_0x2cd8('0x1b')]();};}function respondWithResult(_0x96e5b0,_0x404d46){_0x404d46=_0x404d46||0xc8;return function(_0x332079){if(_0x332079){return _0x96e5b0[_0x2cd8('0x1a')](_0x404d46)[_0x2cd8('0x1c')](_0x332079);}};}function respondWithFilteredResult(_0x2f1a42,_0x559773){return function(_0x16a009){if(_0x16a009){var _0x1887f3=typeof _0x559773[_0x2cd8('0x1d')]===_0x2cd8('0x1e')&&typeof _0x559773[_0x2cd8('0x1f')]==='undefined';var _0x14f9f4=_0x16a009['count'];var _0x3a4b92=_0x1887f3?0x0:_0x559773[_0x2cd8('0x1d')];var _0x544812=_0x1887f3?_0x16a009[_0x2cd8('0x20')]:_0x559773[_0x2cd8('0x1d')]+_0x559773[_0x2cd8('0x1f')];var _0x594a36;if(_0x544812>=_0x14f9f4){_0x544812=_0x14f9f4;_0x594a36=0xc8;}else{_0x594a36=0xce;}_0x2f1a42[_0x2cd8('0x1a')](_0x594a36);return _0x2f1a42['set'](_0x2cd8('0x21'),_0x3a4b92+'-'+_0x544812+'/'+_0x14f9f4)['json'](_0x16a009);}return null;};}function patchUpdates(_0x1670e9){return function(_0xcbee60){try{jsonpatch[_0x2cd8('0x22')](_0xcbee60,_0x1670e9,!![]);}catch(_0x278549){return BPromise[_0x2cd8('0x23')](_0x278549);}return _0xcbee60[_0x2cd8('0x24')]();};}function saveUpdates(_0x278ef1,_0x4c8a14){return function(_0x213588){if(_0x213588){return _0x213588['update'](_0x278ef1)[_0x2cd8('0x25')](function(_0x17b30f){return _0x17b30f;});}return null;};}function removeEntity(_0x2122e1,_0x405b78){return function(_0x2be45e){if(_0x2be45e){return _0x2be45e[_0x2cd8('0x26')]()[_0x2cd8('0x25')](function(){_0x2122e1['status'](0xcc)[_0x2cd8('0x1b')]();});}};}function handleEntityNotFound(_0x4a6a36,_0xea354b){return function(_0x39ddf2){if(!_0x39ddf2){_0x4a6a36[_0x2cd8('0x19')](0x194);}return _0x39ddf2;};}function handleError(_0x5dd2dc,_0x106938){_0x106938=_0x106938||0x1f4;return function(_0x46557b){logger['error'](_0x46557b[_0x2cd8('0x27')]);if(_0x46557b[_0x2cd8('0x28')]){delete _0x46557b[_0x2cd8('0x28')];}_0x5dd2dc[_0x2cd8('0x1a')](_0x106938)[_0x2cd8('0x29')](_0x46557b);};}exports[_0x2cd8('0x2a')]=function(_0x4e556c,_0x200ea0){var _0x2e1347={},_0x843b6b={},_0x24943f={'count':0x0,'rows':[]};var _0x77ed2e=_[_0x2cd8('0x2b')](db[_0x2cd8('0x2c')][_0x2cd8('0x2d')],function(_0x176270){return{'name':_0x176270[_0x2cd8('0x2e')],'type':_0x176270['type'][_0x2cd8('0x2f')]};});_0x843b6b[_0x2cd8('0x30')]=_['map'](_0x77ed2e,_0x2cd8('0x28'));_0x843b6b[_0x2cd8('0x31')]=_['keys'](_0x4e556c[_0x2cd8('0x31')]);_0x843b6b[_0x2cd8('0x32')]=_['intersection'](_0x843b6b[_0x2cd8('0x30')],_0x843b6b[_0x2cd8('0x31')]);_0x2e1347[_0x2cd8('0x33')]=_['intersection'](_0x843b6b[_0x2cd8('0x30')],qs['fields'](_0x4e556c['query'][_0x2cd8('0x34')]));_0x2e1347['attributes']=_0x2e1347[_0x2cd8('0x33')][_0x2cd8('0x35')]?_0x2e1347[_0x2cd8('0x33')]:_0x843b6b[_0x2cd8('0x30')];if(!_0x4e556c['query']['hasOwnProperty']('nolimit')){_0x2e1347[_0x2cd8('0x1f')]=qs['limit'](_0x4e556c[_0x2cd8('0x31')]['limit']);_0x2e1347['offset']=qs['offset'](_0x4e556c[_0x2cd8('0x31')][_0x2cd8('0x1d')]);}_0x2e1347['order']=qs[_0x2cd8('0x36')](_0x4e556c[_0x2cd8('0x31')][_0x2cd8('0x36')]);_0x2e1347[_0x2cd8('0x37')]=qs[_0x2cd8('0x32')](_[_0x2cd8('0x38')](_0x4e556c[_0x2cd8('0x31')],_0x843b6b[_0x2cd8('0x32')]),_0x77ed2e);if(_0x4e556c['query'][_0x2cd8('0x39')]){_0x2e1347[_0x2cd8('0x37')]=_[_0x2cd8('0x3a')](_0x2e1347[_0x2cd8('0x37')],{'$or':_[_0x2cd8('0x2b')](_0x77ed2e,function(_0x1cf97d){if(_0x1cf97d['type']!==_0x2cd8('0x3b')){var _0x3d21f6={};_0x3d21f6[_0x1cf97d[_0x2cd8('0x28')]]={'$like':'%'+_0x4e556c[_0x2cd8('0x31')][_0x2cd8('0x39')]+'%'};return _0x3d21f6;}})});}_0x2e1347=_[_0x2cd8('0x3a')]({},_0x2e1347,_0x4e556c[_0x2cd8('0x3c')]);var _0x5358d3={'where':_0x2e1347[_0x2cd8('0x37')]};return db['UserProfileSection'][_0x2cd8('0x20')](_0x5358d3)[_0x2cd8('0x25')](function(_0x49ae5e){_0x24943f[_0x2cd8('0x20')]=_0x49ae5e;if(_0x4e556c[_0x2cd8('0x31')][_0x2cd8('0x3d')]){_0x2e1347[_0x2cd8('0x3e')]=[{'all':!![]}];}return db[_0x2cd8('0x2c')][_0x2cd8('0x3f')](_0x2e1347);})[_0x2cd8('0x25')](function(_0x3749c1){_0x24943f[_0x2cd8('0x40')]=_0x3749c1;return _0x24943f;})['then'](respondWithFilteredResult(_0x200ea0,_0x2e1347))['catch'](handleError(_0x200ea0,null));};exports[_0x2cd8('0x41')]=function(_0xb30841,_0x295c71){var _0x5ea121={'raw':![],'where':{'id':_0xb30841['params']['id']}},_0x509c55={};_0x509c55[_0x2cd8('0x30')]=_[_0x2cd8('0x42')](db['UserProfileSection'][_0x2cd8('0x2d')]);_0x509c55[_0x2cd8('0x31')]=_[_0x2cd8('0x42')](_0xb30841[_0x2cd8('0x31')]);_0x509c55[_0x2cd8('0x32')]=_[_0x2cd8('0x43')](_0x509c55[_0x2cd8('0x30')],_0x509c55['query']);_0x5ea121['attributes']=_[_0x2cd8('0x43')](_0x509c55[_0x2cd8('0x30')],qs[_0x2cd8('0x34')](_0xb30841[_0x2cd8('0x31')][_0x2cd8('0x34')]));_0x5ea121['attributes']=_0x5ea121[_0x2cd8('0x33')][_0x2cd8('0x35')]?_0x5ea121[_0x2cd8('0x33')]:_0x509c55['model'];if(_0xb30841[_0x2cd8('0x31')]['includeAll']){_0x5ea121[_0x2cd8('0x3e')]=[{'all':!![]}];}_0x5ea121=_[_0x2cd8('0x3a')]({},_0x5ea121,_0xb30841['options']);return db[_0x2cd8('0x2c')][_0x2cd8('0x44')](_0x5ea121)[_0x2cd8('0x25')](handleEntityNotFound(_0x295c71,null))['then'](respondWithResult(_0x295c71,null))['catch'](handleError(_0x295c71,null));};exports['create']=function(_0x687229,_0x2d5ce6){return db[_0x2cd8('0x2c')][_0x2cd8('0x45')](_0x687229[_0x2cd8('0x46')],{})['then'](respondWithResult(_0x2d5ce6,0xc9))[_0x2cd8('0x47')](handleError(_0x2d5ce6,null));};exports[_0x2cd8('0x48')]=function(_0x1a9667,_0x1ff6ae){if(_0x1a9667[_0x2cd8('0x46')]['id']){delete _0x1a9667[_0x2cd8('0x46')]['id'];}return db[_0x2cd8('0x2c')][_0x2cd8('0x44')]({'where':{'id':_0x1a9667[_0x2cd8('0x49')]['id']}})[_0x2cd8('0x25')](handleEntityNotFound(_0x1ff6ae,null))[_0x2cd8('0x25')](saveUpdates(_0x1a9667[_0x2cd8('0x46')],null))['then'](respondWithResult(_0x1ff6ae,null))[_0x2cd8('0x47')](handleError(_0x1ff6ae,null));};exports[_0x2cd8('0x26')]=function(_0x1e2703,_0x4fbfaa){return db[_0x2cd8('0x2c')]['find']({'where':{'id':_0x1e2703['params']['id']}})[_0x2cd8('0x25')](handleEntityNotFound(_0x4fbfaa,null))[_0x2cd8('0x25')](removeEntity(_0x4fbfaa,null))['catch'](handleError(_0x4fbfaa,null));};exports['describe']=function(_0x511632,_0x2c707b){return db[_0x2cd8('0x2c')][_0x2cd8('0x4a')]()[_0x2cd8('0x25')](respondWithResult(_0x2c707b,null))['catch'](handleError(_0x2c707b,null));}; \ No newline at end of file +var _0xda3d=['sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','error','stack','send','index','map','UserProfileSection','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xda3d,0xe6));var _0xdda3=function(_0xe38bb1,_0x38a9ff){_0xe38bb1=_0xe38bb1-0x0;var _0x431789=_0xda3d[_0xe38bb1];return _0x431789;};'use strict';var emlformat=require(_0xdda3('0x0'));var rimraf=require(_0xdda3('0x1'));var zipdir=require(_0xdda3('0x2'));var jsonpatch=require(_0xdda3('0x3'));var rp=require(_0xdda3('0x4'));var moment=require(_0xdda3('0x5'));var BPromise=require(_0xdda3('0x6'));var Mustache=require(_0xdda3('0x7'));var util=require(_0xdda3('0x8'));var path=require(_0xdda3('0x9'));var sox=require(_0xdda3('0xa'));var csv=require(_0xdda3('0xb'));var ejs=require(_0xdda3('0xc'));var fs=require('fs');var fs_extra=require(_0xdda3('0xd'));var _=require('lodash');var squel=require(_0xdda3('0xe'));var crypto=require(_0xdda3('0xf'));var jsforce=require(_0xdda3('0x10'));var deskjs=require(_0xdda3('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdda3('0x12'));var Papa=require(_0xdda3('0x13'));var Redis=require(_0xdda3('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdda3('0x15'));var as=require(_0xdda3('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdda3('0x17'))(_0xdda3('0x18'));var utils=require('../../config/utils');var config=require(_0xdda3('0x19'));var licenseUtil=require(_0xdda3('0x1a'));var db=require(_0xdda3('0x1b'))['db'];function respondWithStatusCode(_0x4ff1aa,_0x13de6f){_0x13de6f=_0x13de6f||0xcc;return function(_0x52696e){if(_0x52696e){return _0x4ff1aa[_0xdda3('0x1c')](_0x13de6f);}return _0x4ff1aa[_0xdda3('0x1d')](_0x13de6f)[_0xdda3('0x1e')]();};}function respondWithResult(_0xbab1ee,_0x5193c7){_0x5193c7=_0x5193c7||0xc8;return function(_0x57f37a){if(_0x57f37a){return _0xbab1ee['status'](_0x5193c7)['json'](_0x57f37a);}};}function respondWithFilteredResult(_0x5e138c,_0xdf9c9c){return function(_0x7d5878){if(_0x7d5878){var _0x65fa47=typeof _0xdf9c9c[_0xdda3('0x1f')]===_0xdda3('0x20')&&typeof _0xdf9c9c['limit']==='undefined';var _0x48993a=_0x7d5878[_0xdda3('0x21')];var _0x29478c=_0x65fa47?0x0:_0xdf9c9c[_0xdda3('0x1f')];var _0x5c5970=_0x65fa47?_0x7d5878[_0xdda3('0x21')]:_0xdf9c9c['offset']+_0xdf9c9c[_0xdda3('0x22')];var _0x3feb92;if(_0x5c5970>=_0x48993a){_0x5c5970=_0x48993a;_0x3feb92=0xc8;}else{_0x3feb92=0xce;}_0x5e138c[_0xdda3('0x1d')](_0x3feb92);return _0x5e138c[_0xdda3('0x23')](_0xdda3('0x24'),_0x29478c+'-'+_0x5c5970+'/'+_0x48993a)[_0xdda3('0x25')](_0x7d5878);}return null;};}function patchUpdates(_0x2b0163){return function(_0xf7249c){try{jsonpatch[_0xdda3('0x26')](_0xf7249c,_0x2b0163,!![]);}catch(_0x2557a8){return BPromise[_0xdda3('0x27')](_0x2557a8);}return _0xf7249c['save']();};}function saveUpdates(_0x237be2,_0x1ed2b7){return function(_0x1183f0){if(_0x1183f0){return _0x1183f0[_0xdda3('0x28')](_0x237be2)[_0xdda3('0x29')](function(_0x284aba){return _0x284aba;});}return null;};}function removeEntity(_0x1186c4,_0x1ce9c5){return function(_0x4e4ccd){if(_0x4e4ccd){return _0x4e4ccd[_0xdda3('0x2a')]()[_0xdda3('0x29')](function(){_0x1186c4[_0xdda3('0x1d')](0xcc)[_0xdda3('0x1e')]();});}};}function handleEntityNotFound(_0x104bab,_0x5f5446){return function(_0x168c76){if(!_0x168c76){_0x104bab['sendStatus'](0x194);}return _0x168c76;};}function handleError(_0x161f4f,_0x2b96ce){_0x2b96ce=_0x2b96ce||0x1f4;return function(_0x5d9fd1){logger[_0xdda3('0x2b')](_0x5d9fd1[_0xdda3('0x2c')]);if(_0x5d9fd1['name']){delete _0x5d9fd1['name'];}_0x161f4f['status'](_0x2b96ce)[_0xdda3('0x2d')](_0x5d9fd1);};}exports[_0xdda3('0x2e')]=function(_0x125363,_0x199aec){var _0x1f1f9f={},_0x3810f2={},_0xc63223={'count':0x0,'rows':[]};var _0x17c85b=_[_0xdda3('0x2f')](db[_0xdda3('0x30')]['rawAttributes'],function(_0x58cf67){return{'name':_0x58cf67['fieldName'],'type':_0x58cf67[_0xdda3('0x31')][_0xdda3('0x32')]};});_0x3810f2[_0xdda3('0x33')]=_[_0xdda3('0x2f')](_0x17c85b,'name');_0x3810f2[_0xdda3('0x34')]=_[_0xdda3('0x35')](_0x125363[_0xdda3('0x34')]);_0x3810f2[_0xdda3('0x36')]=_[_0xdda3('0x37')](_0x3810f2['model'],_0x3810f2[_0xdda3('0x34')]);_0x1f1f9f[_0xdda3('0x38')]=_[_0xdda3('0x37')](_0x3810f2[_0xdda3('0x33')],qs[_0xdda3('0x39')](_0x125363[_0xdda3('0x34')][_0xdda3('0x39')]));_0x1f1f9f[_0xdda3('0x38')]=_0x1f1f9f[_0xdda3('0x38')][_0xdda3('0x3a')]?_0x1f1f9f[_0xdda3('0x38')]:_0x3810f2[_0xdda3('0x33')];if(!_0x125363['query']['hasOwnProperty']('nolimit')){_0x1f1f9f[_0xdda3('0x22')]=qs[_0xdda3('0x22')](_0x125363['query'][_0xdda3('0x22')]);_0x1f1f9f[_0xdda3('0x1f')]=qs[_0xdda3('0x1f')](_0x125363['query'][_0xdda3('0x1f')]);}_0x1f1f9f[_0xdda3('0x3b')]=qs[_0xdda3('0x3c')](_0x125363[_0xdda3('0x34')]['sort']);_0x1f1f9f[_0xdda3('0x3d')]=qs[_0xdda3('0x36')](_[_0xdda3('0x3e')](_0x125363[_0xdda3('0x34')],_0x3810f2['filters']),_0x17c85b);if(_0x125363[_0xdda3('0x34')][_0xdda3('0x3f')]){_0x1f1f9f[_0xdda3('0x3d')]=_[_0xdda3('0x40')](_0x1f1f9f['where'],{'$or':_[_0xdda3('0x2f')](_0x17c85b,function(_0x596618){if(_0x596618[_0xdda3('0x31')]!==_0xdda3('0x41')){var _0xb5ec3d={};_0xb5ec3d[_0x596618[_0xdda3('0x42')]]={'$like':'%'+_0x125363[_0xdda3('0x34')][_0xdda3('0x3f')]+'%'};return _0xb5ec3d;}})});}_0x1f1f9f=_[_0xdda3('0x40')]({},_0x1f1f9f,_0x125363[_0xdda3('0x43')]);var _0x8a9dac={'where':_0x1f1f9f[_0xdda3('0x3d')]};return db['UserProfileSection']['count'](_0x8a9dac)[_0xdda3('0x29')](function(_0xad7e8f){_0xc63223[_0xdda3('0x21')]=_0xad7e8f;if(_0x125363['query'][_0xdda3('0x44')]){_0x1f1f9f[_0xdda3('0x45')]=[{'all':!![]}];}return db[_0xdda3('0x30')][_0xdda3('0x46')](_0x1f1f9f);})[_0xdda3('0x29')](function(_0x462ae8){_0xc63223[_0xdda3('0x47')]=_0x462ae8;return _0xc63223;})[_0xdda3('0x29')](respondWithFilteredResult(_0x199aec,_0x1f1f9f))[_0xdda3('0x48')](handleError(_0x199aec,null));};exports[_0xdda3('0x49')]=function(_0x4ff3ed,_0x7b08f8){var _0x43ea49={'raw':![],'where':{'id':_0x4ff3ed[_0xdda3('0x4a')]['id']}},_0x17edd0={};_0x17edd0[_0xdda3('0x33')]=_[_0xdda3('0x35')](db['UserProfileSection'][_0xdda3('0x4b')]);_0x17edd0[_0xdda3('0x34')]=_[_0xdda3('0x35')](_0x4ff3ed[_0xdda3('0x34')]);_0x17edd0[_0xdda3('0x36')]=_[_0xdda3('0x37')](_0x17edd0['model'],_0x17edd0['query']);_0x43ea49[_0xdda3('0x38')]=_[_0xdda3('0x37')](_0x17edd0[_0xdda3('0x33')],qs[_0xdda3('0x39')](_0x4ff3ed[_0xdda3('0x34')][_0xdda3('0x39')]));_0x43ea49[_0xdda3('0x38')]=_0x43ea49['attributes']['length']?_0x43ea49[_0xdda3('0x38')]:_0x17edd0[_0xdda3('0x33')];if(_0x4ff3ed[_0xdda3('0x34')][_0xdda3('0x44')]){_0x43ea49['include']=[{'all':!![]}];}_0x43ea49=_[_0xdda3('0x40')]({},_0x43ea49,_0x4ff3ed['options']);return db['UserProfileSection'][_0xdda3('0x4c')](_0x43ea49)[_0xdda3('0x29')](handleEntityNotFound(_0x7b08f8,null))[_0xdda3('0x29')](respondWithResult(_0x7b08f8,null))['catch'](handleError(_0x7b08f8,null));};exports[_0xdda3('0x4d')]=function(_0x721b56,_0x3b99e4){return db['UserProfileSection']['create'](_0x721b56['body'],{})[_0xdda3('0x29')](respondWithResult(_0x3b99e4,0xc9))[_0xdda3('0x48')](handleError(_0x3b99e4,null));};exports[_0xdda3('0x28')]=function(_0x400b5c,_0x2ea5ad){if(_0x400b5c[_0xdda3('0x4e')]['id']){delete _0x400b5c[_0xdda3('0x4e')]['id'];}return db[_0xdda3('0x30')]['find']({'where':{'id':_0x400b5c[_0xdda3('0x4a')]['id']}})[_0xdda3('0x29')](handleEntityNotFound(_0x2ea5ad,null))[_0xdda3('0x29')](saveUpdates(_0x400b5c['body'],null))[_0xdda3('0x29')](respondWithResult(_0x2ea5ad,null))['catch'](handleError(_0x2ea5ad,null));};exports[_0xdda3('0x2a')]=function(_0x50b760,_0x27788a){return db[_0xdda3('0x30')][_0xdda3('0x4c')]({'where':{'id':_0x50b760[_0xdda3('0x4a')]['id']}})[_0xdda3('0x29')](handleEntityNotFound(_0x27788a,null))[_0xdda3('0x29')](removeEntity(_0x27788a,null))[_0xdda3('0x48')](handleError(_0x27788a,null));};exports[_0xdda3('0x4f')]=function(_0x7f020,_0x8d3dd0){return db[_0xdda3('0x30')][_0xdda3('0x4f')]()[_0xdda3('0x29')](respondWithResult(_0x8d3dd0,null))[_0xdda3('0x48')](handleError(_0x8d3dd0,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 28aab61..b24661f 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 _0xe0bf=['../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','api','moment','request-promise','path','rimraf'];(function(_0x2f2d64,_0x33b2c6){var _0x1a7048=function(_0x1182a3){while(--_0x1182a3){_0x2f2d64['push'](_0x2f2d64['shift']());}};_0x1a7048(++_0x33b2c6);}(_0xe0bf,0x121));var _0xfe0b=function(_0xba2420,_0x264f3c){_0xba2420=_0xba2420-0x0;var _0x5b176c=_0xe0bf[_0xba2420];return _0x5b176c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xfe0b('0x0'));var moment=require(_0xfe0b('0x1'));var BPromise=require('bluebird');var rp=require(_0xfe0b('0x2'));var fs=require('fs');var path=require(_0xfe0b('0x3'));var rimraf=require(_0xfe0b('0x4'));var config=require(_0xfe0b('0x5'));var attributes=require(_0xfe0b('0x6'));module[_0xfe0b('0x7')]=function(_0x4ac197,_0x2c084b){return _0x4ac197[_0xfe0b('0x8')](_0xfe0b('0x9'),attributes,{'tableName':_0xfe0b('0xa'),'paranoid':![],'indexes':[{'name':_0xfe0b('0xb'),'fields':[_0xfe0b('0xc'),_0xfe0b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x85b9=['bluebird','path','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','moment'];(function(_0x1aa444,_0x4d6b5f){var _0xb36b20=function(_0x29eb0f){while(--_0x29eb0f){_0x1aa444['push'](_0x1aa444['shift']());}};_0xb36b20(++_0x4d6b5f);}(_0x85b9,0xbe));var _0x985b=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0x85b9[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x985b('0x0'));var util=require(_0x985b('0x1'));var logger=require(_0x985b('0x2'))(_0x985b('0x3'));var moment=require(_0x985b('0x4'));var BPromise=require(_0x985b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x985b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userProfileSection.attributes');module[_0x985b('0x7')]=function(_0x5b17d5,_0x5878ab){return _0x5b17d5[_0x985b('0x8')]('UserProfileSection',attributes,{'tableName':_0x985b('0x9'),'paranoid':![],'indexes':[{'name':_0x985b('0xa'),'fields':[_0x985b('0xb'),_0x985b('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 9c7ebd7..23209e5 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 _0x8a5a=['UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a5a,0x66));var _0xa8a5=function(_0x138e2d,_0x1380f6){_0x138e2d=_0x138e2d-0x0;var _0x5dd2a0=_0x8a5a[_0x138e2d];return _0x5dd2a0;};'use strict';var _=require('lodash');var util=require(_0xa8a5('0x0'));var moment=require('moment');var BPromise=require(_0xa8a5('0x1'));var rs=require(_0xa8a5('0x2'));var fs=require('fs');var Redis=require(_0xa8a5('0x3'));var db=require(_0xa8a5('0x4'))['db'];var utils=require(_0xa8a5('0x5'));var logger=require('../../config/logger')(_0xa8a5('0x6'));var config=require(_0xa8a5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa8a5('0x8')][_0xa8a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1add0a,_0x141646,_0x82e92a){return new BPromise(function(_0x474ff6,_0x4af2ac){return client[_0xa8a5('0xa')](_0x1add0a,_0x82e92a)[_0xa8a5('0xb')](function(_0x1d18da){logger[_0xa8a5('0xc')](_0xa8a5('0xd'),_0x141646,_0xa8a5('0xe'));logger[_0xa8a5('0xf')](_0xa8a5('0x10'),_0x141646,_0xa8a5('0xe'),JSON[_0xa8a5('0x11')](_0x1d18da));if(_0x1d18da[_0xa8a5('0x12')]){if(_0x1d18da['error'][_0xa8a5('0x13')]===0x1f4){logger[_0xa8a5('0x12')](_0xa8a5('0xd'),_0x141646,_0x1d18da[_0xa8a5('0x12')]['message']);return _0x4af2ac(_0x1d18da[_0xa8a5('0x12')][_0xa8a5('0x14')]);}logger[_0xa8a5('0x12')](_0xa8a5('0xd'),_0x141646,_0x1d18da['error'][_0xa8a5('0x14')]);return _0x474ff6(_0x1d18da['error']['message']);}else{logger[_0xa8a5('0xc')]('UserProfileSection,\x20%s,\x20%s',_0x141646,_0xa8a5('0xe'));_0x474ff6(_0x1d18da[_0xa8a5('0x15')][_0xa8a5('0x14')]);}})[_0xa8a5('0x16')](function(_0x2d0100){logger[_0xa8a5('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x141646,_0x2d0100);_0x4af2ac(_0x2d0100);});});} \ No newline at end of file +var _0x8dbd=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x38289c,_0x16c002){var _0x335486=function(_0x3be7fa){while(--_0x3be7fa){_0x38289c['push'](_0x38289c['shift']());}};_0x335486(++_0x16c002);}(_0x8dbd,0x159));var _0xd8db=function(_0x501b9b,_0x55ed20){_0x501b9b=_0x501b9b-0x0;var _0x508f16=_0x8dbd[_0x501b9b];return _0x508f16;};'use strict';var _=require(_0xd8db('0x0'));var util=require(_0xd8db('0x1'));var moment=require('moment');var BPromise=require(_0xd8db('0x2'));var rs=require(_0xd8db('0x3'));var fs=require('fs');var Redis=require(_0xd8db('0x4'));var db=require(_0xd8db('0x5'))['db'];var utils=require(_0xd8db('0x6'));var logger=require(_0xd8db('0x7'))(_0xd8db('0x8'));var config=require(_0xd8db('0x9'));var jayson=require(_0xd8db('0xa'));var client=jayson[_0xd8db('0xb')][_0xd8db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2c08cf,_0x1fc5f1,_0x80f8e9){return new BPromise(function(_0x3bdf6a,_0x53afb5){return client[_0xd8db('0xd')](_0x2c08cf,_0x80f8e9)['then'](function(_0x10c57e){logger[_0xd8db('0xe')](_0xd8db('0xf'),_0x1fc5f1,_0xd8db('0x10'));logger[_0xd8db('0x11')](_0xd8db('0x12'),_0x1fc5f1,_0xd8db('0x10'),JSON[_0xd8db('0x13')](_0x10c57e));if(_0x10c57e[_0xd8db('0x14')]){if(_0x10c57e[_0xd8db('0x14')]['code']===0x1f4){logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);return _0x53afb5(_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);}logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x10c57e['error']['message']);return _0x3bdf6a(_0x10c57e[_0xd8db('0x14')][_0xd8db('0x15')]);}else{logger['info'](_0xd8db('0xf'),_0x1fc5f1,_0xd8db('0x10'));_0x3bdf6a(_0x10c57e['result'][_0xd8db('0x15')]);}})[_0xd8db('0x16')](function(_0x437806){logger[_0xd8db('0x14')](_0xd8db('0xf'),_0x1fc5f1,_0x437806);_0x53afb5(_0x437806);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index c8558f0..60d4d08 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x35da13,_0x5be649){var _0x3541fe=function(_0x3ebcb5){while(--_0x3ebcb5){_0x35da13['push'](_0x35da13['shift']());}};_0x3541fe(++_0x5be649);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2ab8f5,_0x920f88){var _0x35be11=function(_0x5d5a65){while(--_0x5d5a65){_0x2ab8f5['push'](_0x2ab8f5['shift']());}};_0x35be11(++_0x920f88);}(_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 diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index eabac00..dab6c1b 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 _0x1023=['INTEGER','exports'];(function(_0x10244a,_0x3e96f4){var _0x4daacd=function(_0x3ef358){while(--_0x3ef358){_0x10244a['push'](_0x10244a['shift']());}};_0x4daacd(++_0x3e96f4);}(_0x1023,0x7b));var _0x3102=function(_0x61bb5e,_0x626cf7){_0x61bb5e=_0x61bb5e-0x0;var _0x4f4258=_0x1023[_0x61bb5e];return _0x4f4258;};'use strict';var Sequelize=require('sequelize');module[_0x3102('0x0')]={'penalty':{'type':Sequelize[_0x3102('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfc98=['sequelize','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xfc98,0x154));var _0x8fc9=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xfc98[_0x1762b4];return _0x29beda;};'use strict';var Sequelize=require(_0x8fc9('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8fc9('0x1')],'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 5747583..029bade 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 _0xe944=['define','UserSmsQueue','user_has_sms_queues','lodash','api','request-promise','../../config/environment','./userSmsQueue.attributes','exports'];(function(_0x505ee8,_0x23ab38){var _0x3a3a92=function(_0x5997c6){while(--_0x5997c6){_0x505ee8['push'](_0x505ee8['shift']());}};_0x3a3a92(++_0x23ab38);}(_0xe944,0x174));var _0x4e94=function(_0x6403c5,_0x2b825b){_0x6403c5=_0x6403c5-0x0;var _0x1db19a=_0xe944[_0x6403c5];return _0x1db19a;};'use strict';var _=require(_0x4e94('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4e94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4e94('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e94('0x3'));var attributes=require(_0x4e94('0x4'));module[_0x4e94('0x5')]=function(_0xbb43ae,_0x4d00e5){return _0xbb43ae[_0x4e94('0x6')](_0x4e94('0x7'),attributes,{'tableName':_0x4e94('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4991=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues'];(function(_0x7a93a0,_0x42e1cb){var _0x7d44d0=function(_0x5df003){while(--_0x5df003){_0x7a93a0['push'](_0x7a93a0['shift']());}};_0x7d44d0(++_0x42e1cb);}(_0x4991,0xf7));var _0x1499=function(_0x33f794,_0x3018dd){_0x33f794=_0x33f794-0x0;var _0x3491a3=_0x4991[_0x33f794];return _0x3491a3;};'use strict';var _=require(_0x1499('0x0'));var util=require('util');var logger=require(_0x1499('0x1'))('api');var moment=require(_0x1499('0x2'));var BPromise=require(_0x1499('0x3'));var rp=require(_0x1499('0x4'));var fs=require('fs');var path=require(_0x1499('0x5'));var rimraf=require(_0x1499('0x6'));var config=require(_0x1499('0x7'));var attributes=require(_0x1499('0x8'));module[_0x1499('0x9')]=function(_0x4b6154,_0x2a8e96){return _0x4b6154[_0x1499('0xa')](_0x1499('0xb'),attributes,{'tableName':_0x1499('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index eaa0655..b89d0fd 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 _0x9866=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','catch','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x44292b,_0x288e40){var _0x24e71c=function(_0x101351){while(--_0x101351){_0x44292b['push'](_0x44292b['shift']());}};_0x24e71c(++_0x288e40);}(_0x9866,0x9a));var _0x6986=function(_0x3f04bd,_0xaff76e){_0x3f04bd=_0x3f04bd-0x0;var _0x20437f=_0x9866[_0x3f04bd];return _0x20437f;};'use strict';var _=require(_0x6986('0x0'));var util=require(_0x6986('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6986('0x2'));var fs=require('fs');var Redis=require(_0x6986('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6986('0x4'));var logger=require(_0x6986('0x5'))(_0x6986('0x6'));var config=require(_0x6986('0x7'));var jayson=require(_0x6986('0x8'));var client=jayson[_0x6986('0x9')][_0x6986('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x946ff3,_0x3d726a,_0x36d330){return new BPromise(function(_0x315e81,_0x52fe5d){return client[_0x6986('0xb')](_0x946ff3,_0x36d330)[_0x6986('0xc')](function(_0x4cf09d){logger[_0x6986('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x3d726a,_0x6986('0xe'));logger[_0x6986('0xf')](_0x6986('0x10'),_0x3d726a,_0x6986('0xe'),JSON[_0x6986('0x11')](_0x4cf09d));if(_0x4cf09d['error']){if(_0x4cf09d[_0x6986('0x12')][_0x6986('0x13')]===0x1f4){logger[_0x6986('0x12')](_0x6986('0x14'),_0x3d726a,_0x4cf09d[_0x6986('0x12')][_0x6986('0x15')]);return _0x52fe5d(_0x4cf09d['error'][_0x6986('0x15')]);}logger[_0x6986('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x3d726a,_0x4cf09d[_0x6986('0x12')][_0x6986('0x15')]);return _0x315e81(_0x4cf09d[_0x6986('0x12')][_0x6986('0x15')]);}else{logger[_0x6986('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x3d726a,_0x6986('0xe'));_0x315e81(_0x4cf09d['result']['message']);}})[_0x6986('0x16')](function(_0x15b822){logger[_0x6986('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x3d726a,_0x15b822);_0x52fe5d(_0x15b822);});});} \ No newline at end of file +var _0x9f1d=['debug','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserSmsQueue,\x20%s,\x20%s'];(function(_0x54a966,_0x20bfeb){var _0x293427=function(_0x13f0b5){while(--_0x13f0b5){_0x54a966['push'](_0x54a966['shift']());}};_0x293427(++_0x20bfeb);}(_0x9f1d,0xb0));var _0xd9f1=function(_0x3abb95,_0x36b2a4){_0x3abb95=_0x3abb95-0x0;var _0x26f99e=_0x9f1d[_0x3abb95];return _0x26f99e;};'use strict';var _=require('lodash');var util=require(_0xd9f1('0x0'));var moment=require(_0xd9f1('0x1'));var BPromise=require(_0xd9f1('0x2'));var rs=require(_0xd9f1('0x3'));var fs=require('fs');var Redis=require(_0xd9f1('0x4'));var db=require(_0xd9f1('0x5'))['db'];var utils=require(_0xd9f1('0x6'));var logger=require(_0xd9f1('0x7'))(_0xd9f1('0x8'));var config=require(_0xd9f1('0x9'));var jayson=require(_0xd9f1('0xa'));var client=jayson[_0xd9f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa50472,_0x3791c4,_0x306ed7){return new BPromise(function(_0x14c6c5,_0x5c04bb){return client[_0xd9f1('0xc')](_0xa50472,_0x306ed7)[_0xd9f1('0xd')](function(_0x34033b){logger[_0xd9f1('0xe')](_0xd9f1('0xf'),_0x3791c4,'request\x20sent');logger[_0xd9f1('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x3791c4,_0xd9f1('0x11'),JSON[_0xd9f1('0x12')](_0x34033b));if(_0x34033b['error']){if(_0x34033b[_0xd9f1('0x13')][_0xd9f1('0x14')]===0x1f4){logger[_0xd9f1('0x13')](_0xd9f1('0xf'),_0x3791c4,_0x34033b[_0xd9f1('0x13')][_0xd9f1('0x15')]);return _0x5c04bb(_0x34033b[_0xd9f1('0x13')][_0xd9f1('0x15')]);}logger[_0xd9f1('0x13')](_0xd9f1('0xf'),_0x3791c4,_0x34033b[_0xd9f1('0x13')]['message']);return _0x14c6c5(_0x34033b[_0xd9f1('0x13')][_0xd9f1('0x15')]);}else{logger[_0xd9f1('0xe')](_0xd9f1('0xf'),_0x3791c4,_0xd9f1('0x11'));_0x14c6c5(_0x34033b[_0xd9f1('0x16')][_0xd9f1('0x15')]);}})[_0xd9f1('0x17')](function(_0x15bbea){logger[_0xd9f1('0x13')](_0xd9f1('0xf'),_0x3791c4,_0x15bbea);_0x5c04bb(_0x15bbea);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 53da6c0..51cd8c2 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 _0x2654=['INTEGER','exports'];(function(_0x35cbca,_0xe7b440){var _0x15e554=function(_0x5303a0){while(--_0x5303a0){_0x35cbca['push'](_0x35cbca['shift']());}};_0x15e554(++_0xe7b440);}(_0x2654,0x12d));var _0x4265=function(_0x1fd6b0,_0x5a40a0){_0x1fd6b0=_0x1fd6b0-0x0;var _0x202a08=_0x2654[_0x1fd6b0];return _0x202a08;};'use strict';var Sequelize=require('sequelize');module[_0x4265('0x0')]={'UserId':{'type':Sequelize[_0x4265('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x4265('0x1')]}}; \ No newline at end of file +var _0x2933=['sequelize','exports','INTEGER'];(function(_0x1cc702,_0x93766d){var _0x4631ff=function(_0x2a83b7){while(--_0x2a83b7){_0x1cc702['push'](_0x1cc702['shift']());}};_0x4631ff(++_0x93766d);}(_0x2933,0x13e));var _0x3293=function(_0x523abf,_0x35c56c){_0x523abf=_0x523abf-0x0;var _0x225e45=_0x2933[_0x523abf];return _0x225e45;};'use strict';var Sequelize=require(_0x3293('0x0'));module[_0x3293('0x1')]={'UserId':{'type':Sequelize[_0x3293('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3293('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 4abf09a..b4cb9e6 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(_0xa2d241,_0x540589){var _0x9926ab=function(_0xb430f8){while(--_0xb430f8){_0xa2d241['push'](_0xa2d241['shift']());}};_0x9926ab(++_0x540589);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'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(_0x144260,_0x1da1b7){var _0x29e6a4=function(_0x18473a){while(--_0x18473a){_0x144260['push'](_0x144260['shift']());}};_0x29e6a4(++_0x1da1b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'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 e617de5..6bb8629 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x14fc67,_0x2ea1fe){var _0x3cb64b=function(_0x3a32bd){while(--_0x3a32bd){_0x14fc67['push'](_0x14fc67['shift']());}};_0x3cb64b(++_0x2ea1fe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x49a5f6,_0x2eea42){var _0x22fe92=function(_0x4ed337){while(--_0x4ed337){_0x49a5f6['push'](_0x49a5f6['shift']());}};_0x22fe92(++_0x2eea42);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 62362a3..9374b62 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 _0xf938=['INTEGER','sequelize','exports'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf938,0x106));var _0x8f93=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0xf938[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0x8f93('0x0'));module[_0x8f93('0x1')]={'penalty':{'type':Sequelize[_0x8f93('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd5b1=['sequelize'];(function(_0x556745,_0x390f2a){var _0x2a09bc=function(_0x766ded){while(--_0x766ded){_0x556745['push'](_0x556745['shift']());}};_0x2a09bc(++_0x390f2a);}(_0xd5b1,0x116));var _0x1d5b=function(_0x1414b3,_0x477031){_0x1414b3=_0x1414b3-0x0;var _0x5761ab=_0xd5b1[_0x1414b3];return _0x5761ab;};'use strict';var Sequelize=require(_0x1d5b('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'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 5fdbf71..310cd53 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 _0x3f4b=['../../config/logger','api','moment','path','rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash'];(function(_0x305b6d,_0x302fae){var _0x5c891b=function(_0x45230a){while(--_0x45230a){_0x305b6d['push'](_0x305b6d['shift']());}};_0x5c891b(++_0x302fae);}(_0x3f4b,0x1d8));var _0xb3f4=function(_0x3be075,_0x50d5b0){_0x3be075=_0x3be075-0x0;var _0xbe567b=_0x3f4b[_0x3be075];return _0xbe567b;};'use strict';var _=require(_0xb3f4('0x0'));var util=require('util');var logger=require(_0xb3f4('0x1'))(_0xb3f4('0x2'));var moment=require(_0xb3f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb3f4('0x4'));var rimraf=require(_0xb3f4('0x5'));var config=require(_0xb3f4('0x6'));var attributes=require(_0xb3f4('0x7'));module['exports']=function(_0x32e949,_0x515ae5){return _0x32e949[_0xb3f4('0x8')](_0xb3f4('0x9'),attributes,{'tableName':_0xb3f4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1d1=['rimraf','../../config/environment','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','request-promise','path'];(function(_0x4b1032,_0x36952e){var _0x5a1d55=function(_0x282e9b){while(--_0x282e9b){_0x4b1032['push'](_0x4b1032['shift']());}};_0x5a1d55(++_0x36952e);}(_0xc1d1,0x1ec));var _0x1c1d=function(_0x4ea438,_0x121371){_0x4ea438=_0x4ea438-0x0;var _0x397e67=_0xc1d1[_0x4ea438];return _0x397e67;};'use strict';var _=require(_0x1c1d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1c1d('0x1'));var fs=require('fs');var path=require(_0x1c1d('0x2'));var rimraf=require(_0x1c1d('0x3'));var config=require(_0x1c1d('0x4'));var attributes=require('./userVoiceQueue.attributes');module[_0x1c1d('0x5')]=function(_0x2a34b2,_0x14a578){return _0x2a34b2[_0x1c1d('0x6')](_0x1c1d('0x7'),attributes,{'tableName':_0x1c1d('0x8'),'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 f0564d5..5216cef 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 _0x40f7=['error','code','message','UserVoiceQueue,\x20%s,\x20%s','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x364299,_0x5e116d){var _0xbd4952=function(_0x109a6a){while(--_0x109a6a){_0x364299['push'](_0x364299['shift']());}};_0xbd4952(++_0x5e116d);}(_0x40f7,0xae));var _0x740f=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0x40f7[_0x3a9083];return _0x160306;};'use strict';var _=require(_0x740f('0x0'));var util=require('util');var moment=require(_0x740f('0x1'));var BPromise=require('bluebird');var rs=require(_0x740f('0x2'));var fs=require('fs');var Redis=require(_0x740f('0x3'));var db=require(_0x740f('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x740f('0x5'))(_0x740f('0x6'));var config=require(_0x740f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x740f('0x8')][_0x740f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1de594,_0x26d525,_0x2ed124){return new BPromise(function(_0x3a8250,_0x36b78f){return client[_0x740f('0xa')](_0x1de594,_0x2ed124)[_0x740f('0xb')](function(_0x244e1d){logger[_0x740f('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x26d525,_0x740f('0xd'));logger['debug'](_0x740f('0xe'),_0x26d525,_0x740f('0xd'),JSON['stringify'](_0x244e1d));if(_0x244e1d[_0x740f('0xf')]){if(_0x244e1d[_0x740f('0xf')][_0x740f('0x10')]===0x1f4){logger[_0x740f('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x26d525,_0x244e1d[_0x740f('0xf')][_0x740f('0x11')]);return _0x36b78f(_0x244e1d[_0x740f('0xf')]['message']);}logger[_0x740f('0xf')](_0x740f('0x12'),_0x26d525,_0x244e1d['error'][_0x740f('0x11')]);return _0x3a8250(_0x244e1d['error'][_0x740f('0x11')]);}else{logger[_0x740f('0xc')](_0x740f('0x12'),_0x26d525,_0x740f('0xd'));_0x3a8250(_0x244e1d[_0x740f('0x13')][_0x740f('0x11')]);}})[_0x740f('0x14')](function(_0x38a64b){logger[_0x740f('0xf')](_0x740f('0x12'),_0x26d525,_0x38a64b);_0x36b78f(_0x38a64b);});});} \ No newline at end of file +var _0x0e5d=['rpc','../../config/environment','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0e5d,0x1c0));var _0xd0e5=function(_0x14d38a,_0x57f85d){_0x14d38a=_0x14d38a-0x0;var _0x35e2c2=_0x0e5d[_0x14d38a];return _0x35e2c2;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var moment=require(_0xd0e5('0x2'));var BPromise=require(_0xd0e5('0x3'));var rs=require(_0xd0e5('0x4'));var fs=require('fs');var Redis=require(_0xd0e5('0x5'));var db=require(_0xd0e5('0x6'))['db'];var utils=require(_0xd0e5('0x7'));var logger=require('../../config/logger')(_0xd0e5('0x8'));var config=require(_0xd0e5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd0e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad865,_0x548da2,_0x2d6941){return new BPromise(function(_0x41cab8,_0x5369ad){return client['request'](_0x5ad865,_0x2d6941)['then'](function(_0xbc9207){logger['info'](_0xd0e5('0xb'),_0x548da2,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x548da2,_0xd0e5('0xc'),JSON[_0xd0e5('0xd')](_0xbc9207));if(_0xbc9207[_0xd0e5('0xe')]){if(_0xbc9207[_0xd0e5('0xe')][_0xd0e5('0xf')]===0x1f4){logger[_0xd0e5('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x548da2,_0xbc9207[_0xd0e5('0xe')][_0xd0e5('0x10')]);return _0x5369ad(_0xbc9207['error'][_0xd0e5('0x10')]);}logger['error'](_0xd0e5('0xb'),_0x548da2,_0xbc9207[_0xd0e5('0xe')]['message']);return _0x41cab8(_0xbc9207['error'][_0xd0e5('0x10')]);}else{logger[_0xd0e5('0x11')](_0xd0e5('0xb'),_0x548da2,'request\x20sent');_0x41cab8(_0xbc9207[_0xd0e5('0x12')][_0xd0e5('0x10')]);}})['catch'](function(_0x2959f3){logger[_0xd0e5('0xe')](_0xd0e5('0xb'),_0x548da2,_0x2959f3);_0x5369ad(_0x2959f3);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index b5bcb41..a890a7b 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x367336,_0x18c229){var _0x3423a7=function(_0xa8fa05){while(--_0xa8fa05){_0x367336['push'](_0x367336['shift']());}};_0x3423a7(++_0x18c229);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x1572c5,_0x42b5ec){var _0x2dbf81=function(_0x568a2c){while(--_0x568a2c){_0x1572c5['push'](_0x1572c5['shift']());}};_0x2dbf81(++_0x42b5ec);}(_0x70e0,0x17b));var _0x070e=function(_0x4971f6,_0x36d3e4){_0x4971f6=_0x4971f6-0x0;var _0x445524=_0x70e0[_0x4971f6];return _0x445524;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index a3db614..088a794 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 _0xe683=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','sequelize','exports'];(function(_0x4e9047,_0x3b24b3){var _0x403b10=function(_0x4a2e47){while(--_0x4a2e47){_0x4e9047['push'](_0x4e9047['shift']());}};_0x403b10(++_0x3b24b3);}(_0xe683,0x1d2));var _0x3e68=function(_0x4b1ccb,_0x208574){_0x4b1ccb=_0x4b1ccb-0x0;var _0x156cf3=_0xe683[_0x4b1ccb];return _0x156cf3;};'use strict';var Sequelize=require(_0x3e68('0x0'));module[_0x3e68('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3e68('0x2')},'membername':{'type':Sequelize[_0x3e68('0x3')],'allowNull':![],'comment':_0x3e68('0x2')},'UserId':{'type':Sequelize[_0x3e68('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3e68('0x3')],'allowNull':![],'unique':_0x3e68('0x5'),'comment':_0x3e68('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x3e68('0x5'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x3e68('0x4')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x3e68('0x4')](0xb),'defaultValue':0x0,'comment':_0x3e68('0x2')}}; \ No newline at end of file +var _0x19d1=['STRING','queue_interface','Required\x20by\x20Asterisk','INTEGER','exports'];(function(_0x2b7928,_0x333f01){var _0x2148fd=function(_0x57c871){while(--_0x57c871){_0x2b7928['push'](_0x2b7928['shift']());}};_0x2148fd(++_0x333f01);}(_0x19d1,0xd6));var _0x119d=function(_0x46ca05,_0x1a3449){_0x46ca05=_0x46ca05-0x0;var _0x503f71=_0x19d1[_0x46ca05];return _0x503f71;};'use strict';var Sequelize=require('sequelize');module[_0x119d('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0x119d('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x119d('0x1')],'allowNull':![],'unique':_0x119d('0x2'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x119d('0x2'),'comment':_0x119d('0x3')},'penalty':{'type':Sequelize[_0x119d('0x4')](0xb),'defaultValue':0x0,'comment':_0x119d('0x3')},'paused':{'type':Sequelize[_0x119d('0x4')](0xb),'defaultValue':0x0,'comment':_0x119d('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 802b447..f3c8178 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 _0x7dbd=['update','emit','hasOwnProperty','exports','events','../../mysqldb','UserVoiceQueueRt','save'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x7dbd,0x64));var _0xd7db=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0x7dbd[_0x18b2a3];return _0x50659f;};'use strict';var EventEmitter=require(_0xd7db('0x0'));var UserVoiceQueueRt=require(_0xd7db('0x1'))['db'][_0xd7db('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd7db('0x3'),'afterUpdate':_0xd7db('0x4'),'afterDestroy':'remove'};function emitEvent(_0x42cd01){return function(_0x48ef7e,_0x4a18c2,_0x13df13){UserVoiceQueueRtEvents[_0xd7db('0x5')](_0x42cd01+':'+_0x48ef7e['id'],_0x48ef7e);UserVoiceQueueRtEvents[_0xd7db('0x5')](_0x42cd01,_0x48ef7e);_0x13df13(null);};}for(var e in events){if(events[_0xd7db('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xd7db('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x511e=['../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x337945,_0x19ad92){var _0x16a9d2=function(_0x55ac11){while(--_0x55ac11){_0x337945['push'](_0x337945['shift']());}};_0x16a9d2(++_0x19ad92);}(_0x511e,0x155));var _0xe511=function(_0xa3463d,_0x32f8da){_0xa3463d=_0xa3463d-0x0;var _0x50fd67=_0x511e[_0xa3463d];return _0x50fd67;};'use strict';var EventEmitter=require(_0xe511('0x0'));var UserVoiceQueueRt=require(_0xe511('0x1'))['db'][_0xe511('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xe511('0x3')](0x0);var events={'afterCreate':_0xe511('0x4'),'afterUpdate':'update','afterDestroy':_0xe511('0x5')};function emitEvent(_0x3fa923){return function(_0x43093f,_0x439746,_0x37a33a){UserVoiceQueueRtEvents[_0xe511('0x6')](_0x3fa923+':'+_0x43093f['id'],_0x43093f);UserVoiceQueueRtEvents['emit'](_0x3fa923,_0x43093f);_0x37a33a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xe511('0x7')](e,emitEvent(event));}}module[_0xe511('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 48bd4ce..3d0a5eb 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 _0xb4d2=['./userVoiceQueueRt.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xb4d2,0x1b2));var _0x2b4d=function(_0x3ae76a,_0x494469){_0x3ae76a=_0x3ae76a-0x0;var _0x22e9c5=_0xb4d2[_0x3ae76a];return _0x22e9c5;};'use strict';var _=require(_0x2b4d('0x0'));var util=require(_0x2b4d('0x1'));var logger=require(_0x2b4d('0x2'))(_0x2b4d('0x3'));var moment=require(_0x2b4d('0x4'));var BPromise=require(_0x2b4d('0x5'));var rp=require(_0x2b4d('0x6'));var fs=require('fs');var path=require(_0x2b4d('0x7'));var rimraf=require(_0x2b4d('0x8'));var config=require(_0x2b4d('0x9'));var attributes=require(_0x2b4d('0xa'));module['exports']=function(_0xd7a7c,_0x128562){return _0xd7a7c[_0x2b4d('0xb')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe52c=['request-promise','rimraf','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xe52c,0xcc));var _0xce52=function(_0x3f85bc,_0xd31b2d){_0x3f85bc=_0x3f85bc-0x0;var _0x25ffac=_0xe52c[_0x3f85bc];return _0x25ffac;};'use strict';var _=require(_0xce52('0x0'));var util=require(_0xce52('0x1'));var logger=require(_0xce52('0x2'))(_0xce52('0x3'));var moment=require(_0xce52('0x4'));var BPromise=require(_0xce52('0x5'));var rp=require(_0xce52('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce52('0x7'));var config=require('../../config/environment');var attributes=require('./userVoiceQueueRt.attributes');module['exports']=function(_0x39226b,_0x3dcb68){return _0x39226b['define'](_0xce52('0x8'),attributes,{'tableName':_0xce52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 0d12797..492db07 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 _0x62f9=['then','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','redis','defaults','localhost','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','message','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses'];(function(_0x908173,_0x10430c){var _0x16c1d3=function(_0x45029d){while(--_0x45029d){_0x908173['push'](_0x908173['shift']());}};_0x16c1d3(++_0x10430c);}(_0x62f9,0x1f2));var _0x962f=function(_0xf168d3,_0x43dcfc){_0xf168d3=_0xf168d3-0x0;var _0x17fb54=_0x62f9[_0xf168d3];return _0x17fb54;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x962f('0x0'));var rs=require(_0x962f('0x1'));var fs=require('fs');var Redis=require(_0x962f('0x2'));var db=require(_0x962f('0x3'))['db'];var utils=require(_0x962f('0x4'));var logger=require('../../config/logger')(_0x962f('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x962f('0x6')]({'port':0x232a});config[_0x962f('0x7')]=_[_0x962f('0x8')](config['redis'],{'host':_0x962f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x962f('0x7')]));require(_0x962f('0xa'))[_0x962f('0xb')](socket);function respondWithRpcPromise(_0x3c4d0a,_0x40daa0,_0x4c26c8){return new BPromise(function(_0x398590,_0x5998bc){return client['request'](_0x3c4d0a,_0x4c26c8)['then'](function(_0x4f0235){logger[_0x962f('0xc')](_0x962f('0xd'),_0x40daa0,_0x962f('0xe'));logger['debug'](_0x962f('0xf'),_0x40daa0,'request\x20sent',JSON['stringify'](_0x4f0235));if(_0x4f0235[_0x962f('0x10')]){if(_0x4f0235[_0x962f('0x10')][_0x962f('0x11')]===0x1f4){logger['error'](_0x962f('0xd'),_0x40daa0,_0x4f0235[_0x962f('0x10')][_0x962f('0x12')]);return _0x5998bc(_0x4f0235[_0x962f('0x10')][_0x962f('0x12')]);}logger[_0x962f('0x10')](_0x962f('0xd'),_0x40daa0,_0x4f0235[_0x962f('0x10')][_0x962f('0x12')]);return _0x398590(_0x4f0235[_0x962f('0x10')][_0x962f('0x12')]);}else{logger[_0x962f('0xc')](_0x962f('0xd'),_0x40daa0,_0x962f('0xe'));_0x398590(_0x4f0235['result'][_0x962f('0x12')]);}})['catch'](function(_0x507062){logger[_0x962f('0x10')](_0x962f('0xd'),_0x40daa0,_0x507062);_0x5998bc(_0x507062);});});}exports[_0x962f('0x13')]=function(_0x1f11b3){var _0x1d5089=this;return new Promise(function(_0x336fc5,_0x2e5407){return db[_0x962f('0x14')][_0x962f('0x15')]({'raw':_0x1f11b3[_0x962f('0x16')]?_0x1f11b3[_0x962f('0x16')][_0x962f('0x17')]===undefined?!![]:![]:!![],'where':_0x1f11b3[_0x962f('0x16')]?_0x1f11b3['options'][_0x962f('0x18')]||null:null,'attributes':[[db[_0x962f('0x19')]['fn']('COUNT',db[_0x962f('0x19')]['fn']('IF',db[_0x962f('0x19')][_0x962f('0x1a')](_0x962f('0x1b')))),_0x962f('0x1c')]]})[_0x962f('0x1d')](function(_0x4943cb){logger[_0x962f('0xc')](_0x962f('0x13'),_0x1f11b3);logger['debug'](_0x962f('0x13'),_0x1f11b3,JSON['stringify'](_0x4943cb));_0x336fc5(_0x4943cb);})[_0x962f('0x1e')](function(_0x5078fc){logger[_0x962f('0x10')]('GetVoiceQueueRtPauses',_0x5078fc[_0x962f('0x12')],_0x1f11b3);_0x2e5407(_0x1d5089[_0x962f('0x10')](0x1f4,_0x5078fc[_0x962f('0x12')]));});});}; \ No newline at end of file +var _0xcd61=['info','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','result','GetVoiceQueueRtPauses','findAll','options','raw','where','sequelize','COUNT','`paused`\x20=\x201,\x201,\x20null','then','stringify','util','moment','randomstring','ioredis','../../config/utils','jayson/promise','defaults','redis','localhost','./userVoiceQueueRt.socket','register','request'];(function(_0x9182e0,_0x2ec5b5){var _0x15e6f8=function(_0x4c0feb){while(--_0x4c0feb){_0x9182e0['push'](_0x9182e0['shift']());}};_0x15e6f8(++_0x2ec5b5);}(_0xcd61,0x8f));var _0x1cd6=function(_0x3c0bc1,_0x47bd5c){_0x3c0bc1=_0x3c0bc1-0x0;var _0x49c5d1=_0xcd61[_0x3c0bc1];return _0x49c5d1;};'use strict';var _=require('lodash');var util=require(_0x1cd6('0x0'));var moment=require(_0x1cd6('0x1'));var BPromise=require('bluebird');var rs=require(_0x1cd6('0x2'));var fs=require('fs');var Redis=require(_0x1cd6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cd6('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1cd6('0x5'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x1cd6('0x6')](config[_0x1cd6('0x7')],{'host':_0x1cd6('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1cd6('0x9'))[_0x1cd6('0xa')](socket);function respondWithRpcPromise(_0x46607c,_0x186410,_0x5267e5){return new BPromise(function(_0x31276a,_0x5abf3d){return client[_0x1cd6('0xb')](_0x46607c,_0x5267e5)['then'](function(_0x3533ee){logger[_0x1cd6('0xc')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x186410,_0x1cd6('0xd'));logger[_0x1cd6('0xe')](_0x1cd6('0xf'),_0x186410,_0x1cd6('0xd'),JSON['stringify'](_0x3533ee));if(_0x3533ee[_0x1cd6('0x10')]){if(_0x3533ee['error'][_0x1cd6('0x11')]===0x1f4){logger['error'](_0x1cd6('0x12'),_0x186410,_0x3533ee[_0x1cd6('0x10')]['message']);return _0x5abf3d(_0x3533ee['error'][_0x1cd6('0x13')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x186410,_0x3533ee[_0x1cd6('0x10')]['message']);return _0x31276a(_0x3533ee[_0x1cd6('0x10')][_0x1cd6('0x13')]);}else{logger[_0x1cd6('0xc')](_0x1cd6('0x12'),_0x186410,_0x1cd6('0xd'));_0x31276a(_0x3533ee[_0x1cd6('0x14')][_0x1cd6('0x13')]);}})['catch'](function(_0x34a35b){logger[_0x1cd6('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x186410,_0x34a35b);_0x5abf3d(_0x34a35b);});});}exports[_0x1cd6('0x15')]=function(_0x4410a0){var _0x2b5db0=this;return new Promise(function(_0x246637,_0x40ac6c){return db['UserVoiceQueueRt'][_0x1cd6('0x16')]({'raw':_0x4410a0[_0x1cd6('0x17')]?_0x4410a0[_0x1cd6('0x17')][_0x1cd6('0x18')]===undefined?!![]:![]:!![],'where':_0x4410a0[_0x1cd6('0x17')]?_0x4410a0[_0x1cd6('0x17')][_0x1cd6('0x19')]||null:null,'attributes':[[db[_0x1cd6('0x1a')]['fn'](_0x1cd6('0x1b'),db[_0x1cd6('0x1a')]['fn']('IF',db[_0x1cd6('0x1a')]['literal'](_0x1cd6('0x1c')))),'outboundQueuePauses']]})[_0x1cd6('0x1d')](function(_0x67bf27){logger[_0x1cd6('0xc')]('GetVoiceQueueRtPauses',_0x4410a0);logger[_0x1cd6('0xe')](_0x1cd6('0x15'),_0x4410a0,JSON[_0x1cd6('0x1e')](_0x67bf27));_0x246637(_0x67bf27);})['catch'](function(_0x13484d){logger[_0x1cd6('0x10')]('GetVoiceQueueRtPauses',_0x13484d[_0x1cd6('0x13')],_0x4410a0);_0x40ac6c(_0x2b5db0[_0x1cd6('0x10')](0x1f4,_0x13484d[_0x1cd6('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 4d268ed..a5a481b 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 _0x379e=['./userVoiceQueueRt.events','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x1a6a4c,_0x1488f2){var _0x1b9e0f=function(_0x3b133a){while(--_0x3b133a){_0x1a6a4c['push'](_0x1a6a4c['shift']());}};_0x1b9e0f(++_0x1488f2);}(_0x379e,0x104));var _0xe379=function(_0x3bff39,_0x20e4ce){_0x3bff39=_0x3bff39-0x0;var _0x364f98=_0x379e[_0x3bff39];return _0x364f98;};'use strict';var UserVoiceQueueRtEvents=require(_0xe379('0x0'));var events=['save','remove','update'];function createListener(_0x594cd4,_0xccbef2){return function(_0x1e24f9){_0xccbef2[_0xe379('0x1')](_0x594cd4,_0x1e24f9);};}function removeListener(_0x3db31a,_0x475418){return function(){UserVoiceQueueRtEvents[_0xe379('0x2')](_0x3db31a,_0x475418);};}exports['register']=function(_0x1f6c46){for(var _0x24221c=0x0,_0x166621=events[_0xe379('0x3')];_0x24221c<_0x166621;_0x24221c++){var _0x22cb37=events[_0x24221c];var _0x5475e7=createListener(_0xe379('0x4')+_0x22cb37,_0x1f6c46);UserVoiceQueueRtEvents['on'](_0x22cb37,_0x5475e7);}}; \ No newline at end of file +var _0x7f3f=['userVoiceQueueRt:','./userVoiceQueueRt.events','save','update','emit','removeListener','length'];(function(_0x40f31d,_0x166318){var _0x10d4e4=function(_0x427148){while(--_0x427148){_0x40f31d['push'](_0x40f31d['shift']());}};_0x10d4e4(++_0x166318);}(_0x7f3f,0x1c8));var _0xf7f3=function(_0x81dcac,_0x8ff7db){_0x81dcac=_0x81dcac-0x0;var _0xc7803b=_0x7f3f[_0x81dcac];return _0xc7803b;};'use strict';var UserVoiceQueueRtEvents=require(_0xf7f3('0x0'));var events=[_0xf7f3('0x1'),'remove',_0xf7f3('0x2')];function createListener(_0x445831,_0x2925b0){return function(_0x1354ec){_0x2925b0[_0xf7f3('0x3')](_0x445831,_0x1354ec);};}function removeListener(_0x4b4dbb,_0x19374c){return function(){UserVoiceQueueRtEvents[_0xf7f3('0x4')](_0x4b4dbb,_0x19374c);};}exports['register']=function(_0x163eab){for(var _0x2c1059=0x0,_0xe75375=events[_0xf7f3('0x5')];_0x2c1059<_0xe75375;_0x2c1059++){var _0x14b371=events[_0x2c1059];var _0x31beac=createListener(_0xf7f3('0x6')+_0x14b371,_0x163eab);UserVoiceQueueRtEvents['on'](_0x14b371,_0x31beac);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index c0e3d23..1a88860 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(_0x4e9682,_0x59125b){var _0x5444a6=function(_0x2863f2){while(--_0x2863f2){_0x4e9682['push'](_0x4e9682['shift']());}};_0x5444a6(++_0x59125b);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x190f18,_0x396009){var _0x2cdc3b=function(_0x164a11){while(--_0x164a11){_0x190f18['push'](_0x190f18['shift']());}};_0x2cdc3b(++_0x396009);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 74f3860..c2409cb 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 _0x354c=['sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x354c,0x12d));var _0xc354=function(_0x4b0dee,_0x549481){_0x4b0dee=_0x4b0dee-0x0;var _0x163142=_0x354c[_0x4b0dee];return _0x163142;};'use strict';var Sequelize=require(_0xc354('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x8d8c=['exports','sequelize'];(function(_0x3b3b8d,_0x14d463){var _0x47b4df=function(_0x1a323e){while(--_0x1a323e){_0x3b3b8d['push'](_0x3b3b8d['shift']());}};_0x47b4df(++_0x14d463);}(_0x8d8c,0x1dd));var _0xc8d8=function(_0x5a2db8,_0x409f2a){_0x5a2db8=_0x5a2db8-0x0;var _0x28b4f8=_0x8d8c[_0x5a2db8];return _0x28b4f8;};'use strict';var Sequelize=require(_0xc8d8('0x0'));module[_0xc8d8('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 70e61dc..174cc60 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 _0x7664=['../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','util','moment','bluebird','path'];(function(_0x5335a2,_0x46233a){var _0x20d6c5=function(_0x116ddc){while(--_0x116ddc){_0x5335a2['push'](_0x5335a2['shift']());}};_0x20d6c5(++_0x46233a);}(_0x7664,0x144));var _0x4766=function(_0x449e0b,_0x504aaa){_0x449e0b=_0x449e0b-0x0;var _0x1f3de8=_0x7664[_0x449e0b];return _0x1f3de8;};'use strict';var _=require('lodash');var util=require(_0x4766('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x4766('0x1'));var BPromise=require(_0x4766('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4766('0x3'));var rimraf=require('rimraf');var config=require(_0x4766('0x4'));var attributes=require(_0x4766('0x5'));module['exports']=function(_0x4857fd,_0x496c8a){return _0x4857fd[_0x4766('0x6')](_0x4766('0x7'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe3e6=['exports','define','UserWhatsappQueue','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes'];(function(_0x59a803,_0x18d193){var _0x22b534=function(_0x1b1254){while(--_0x1b1254){_0x59a803['push'](_0x59a803['shift']());}};_0x22b534(++_0x18d193);}(_0xe3e6,0x123));var _0x6e3e=function(_0x4207f4,_0x1f778b){_0x4207f4=_0x4207f4-0x0;var _0x29a621=_0xe3e6[_0x4207f4];return _0x29a621;};'use strict';var _=require(_0x6e3e('0x0'));var util=require('util');var logger=require(_0x6e3e('0x1'))('api');var moment=require(_0x6e3e('0x2'));var BPromise=require(_0x6e3e('0x3'));var rp=require(_0x6e3e('0x4'));var fs=require('fs');var path=require(_0x6e3e('0x5'));var rimraf=require(_0x6e3e('0x6'));var config=require(_0x6e3e('0x7'));var attributes=require(_0x6e3e('0x8'));module[_0x6e3e('0x9')]=function(_0x337f5a,_0x3d2ad5){return _0x337f5a[_0x6e3e('0xa')](_0x6e3e('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 1fa3023..a8bc644 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 _0xeb8a=['http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2a6415,_0x6c94d6){var _0x121cfd=function(_0x504270){while(--_0x504270){_0x2a6415['push'](_0x2a6415['shift']());}};_0x121cfd(++_0x6c94d6);}(_0xeb8a,0xe8));var _0xaeb8=function(_0x51e64e,_0x47f103){_0x51e64e=_0x51e64e-0x0;var _0x7870c9=_0xeb8a[_0x51e64e];return _0x7870c9;};'use strict';var _=require(_0xaeb8('0x0'));var util=require(_0xaeb8('0x1'));var moment=require(_0xaeb8('0x2'));var BPromise=require(_0xaeb8('0x3'));var rs=require(_0xaeb8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaeb8('0x5'))['db'];var utils=require(_0xaeb8('0x6'));var logger=require(_0xaeb8('0x7'))(_0xaeb8('0x8'));var config=require(_0xaeb8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaeb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xefea28,_0x3d9bdf,_0x2585f3){return new BPromise(function(_0x421fe9,_0x4e484b){return client[_0xaeb8('0xb')](_0xefea28,_0x2585f3)[_0xaeb8('0xc')](function(_0xf59ea8){logger[_0xaeb8('0xd')](_0xaeb8('0xe'),_0x3d9bdf,_0xaeb8('0xf'));logger[_0xaeb8('0x10')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3d9bdf,'request\x20sent',JSON[_0xaeb8('0x11')](_0xf59ea8));if(_0xf59ea8[_0xaeb8('0x12')]){if(_0xf59ea8[_0xaeb8('0x12')][_0xaeb8('0x13')]===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3d9bdf,_0xf59ea8[_0xaeb8('0x12')][_0xaeb8('0x14')]);return _0x4e484b(_0xf59ea8['error'][_0xaeb8('0x14')]);}logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x3d9bdf,_0xf59ea8[_0xaeb8('0x12')]['message']);return _0x421fe9(_0xf59ea8[_0xaeb8('0x12')][_0xaeb8('0x14')]);}else{logger[_0xaeb8('0xd')](_0xaeb8('0xe'),_0x3d9bdf,'request\x20sent');_0x421fe9(_0xf59ea8['result'][_0xaeb8('0x14')]);}})[_0xaeb8('0x15')](function(_0xb7c0c8){logger[_0xaeb8('0x12')](_0xaeb8('0xe'),_0x3d9bdf,_0xb7c0c8);_0x4e484b(_0xb7c0c8);});});} \ No newline at end of file +var _0x3673=['../../config/logger','rpc','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5b0f82,_0x4ae236){var _0x3d9cd5=function(_0x343eca){while(--_0x343eca){_0x5b0f82['push'](_0x5b0f82['shift']());}};_0x3d9cd5(++_0x4ae236);}(_0x3673,0xb1));var _0x3367=function(_0x34b6aa,_0x5ddd29){_0x34b6aa=_0x34b6aa-0x0;var _0x3ead29=_0x3673[_0x34b6aa];return _0x3ead29;};'use strict';var _=require(_0x3367('0x0'));var util=require(_0x3367('0x1'));var moment=require(_0x3367('0x2'));var BPromise=require('bluebird');var rs=require(_0x3367('0x3'));var fs=require('fs');var Redis=require(_0x3367('0x4'));var db=require(_0x3367('0x5'))['db'];var utils=require(_0x3367('0x6'));var logger=require(_0x3367('0x7'))(_0x3367('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3367('0x9')][_0x3367('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39e123,_0x1d56dc,_0x31dc5c){return new BPromise(function(_0x574fde,_0x3aa14f){return client[_0x3367('0xb')](_0x39e123,_0x31dc5c)[_0x3367('0xc')](function(_0x200cfc){logger[_0x3367('0xd')](_0x3367('0xe'),_0x1d56dc,_0x3367('0xf'));logger[_0x3367('0x10')](_0x3367('0x11'),_0x1d56dc,_0x3367('0xf'),JSON[_0x3367('0x12')](_0x200cfc));if(_0x200cfc[_0x3367('0x13')]){if(_0x200cfc[_0x3367('0x13')]['code']===0x1f4){logger[_0x3367('0x13')](_0x3367('0xe'),_0x1d56dc,_0x200cfc[_0x3367('0x13')][_0x3367('0x14')]);return _0x3aa14f(_0x200cfc[_0x3367('0x13')]['message']);}logger[_0x3367('0x13')](_0x3367('0xe'),_0x1d56dc,_0x200cfc[_0x3367('0x13')][_0x3367('0x14')]);return _0x574fde(_0x200cfc[_0x3367('0x13')][_0x3367('0x14')]);}else{logger['info'](_0x3367('0xe'),_0x1d56dc,'request\x20sent');_0x574fde(_0x200cfc[_0x3367('0x15')][_0x3367('0x14')]);}})[_0x3367('0x16')](function(_0x88f7d4){logger[_0x3367('0x13')](_0x3367('0xe'),_0x1d56dc,_0x88f7d4);_0x3aa14f(_0x88f7d4);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1e74879..b43e8c4 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 _0x6208=['put','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x3ef786,_0xf54e56){var _0x2dbabe=function(_0x4981e5){while(--_0x4981e5){_0x3ef786['push'](_0x3ef786['shift']());}};_0x2dbabe(++_0xf54e56);}(_0x6208,0x17d));var _0x8620=function(_0x50f392,_0x1d8441){_0x50f392=_0x50f392-0x0;var _0x5926f2=_0x6208[_0x50f392];return _0x5926f2;};'use strict';var multer=require(_0x8620('0x0'));var util=require('util');var path=require(_0x8620('0x1'));var timeout=require(_0x8620('0x2'));var express=require('express');var router=express[_0x8620('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8620('0x4'));var interaction=require(_0x8620('0x5'));var config=require(_0x8620('0x6'));var controller=require(_0x8620('0x7'));router[_0x8620('0x8')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xa')]);router['get'](_0x8620('0xb'),auth[_0x8620('0x9')](),controller[_0x8620('0xc')]);router[_0x8620('0xd')]('/',auth[_0x8620('0x9')](),controller[_0x8620('0xe')]);router[_0x8620('0xf')](_0x8620('0xb'),auth[_0x8620('0x9')](),controller['update']);router[_0x8620('0x10')](_0x8620('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x8620('0x11')]=router; \ No newline at end of file +var _0x94dc=['Router','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create','/:id','update','delete','exports','multer','path','express'];(function(_0x3113f0,_0x485dbc){var _0x5d8773=function(_0x2e9f7f){while(--_0x2e9f7f){_0x3113f0['push'](_0x3113f0['shift']());}};_0x5d8773(++_0x485dbc);}(_0x94dc,0xb1));var _0xc94d=function(_0x427c48,_0x4420eb){_0x427c48=_0x427c48-0x0;var _0x19026d=_0x94dc[_0x427c48];return _0x19026d;};'use strict';var multer=require(_0xc94d('0x0'));var util=require('util');var path=require(_0xc94d('0x1'));var timeout=require('connect-timeout');var express=require(_0xc94d('0x2'));var router=express[_0xc94d('0x3')]();var fs_extra=require(_0xc94d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc94d('0x5'));var config=require(_0xc94d('0x6'));var controller=require(_0xc94d('0x7'));router[_0xc94d('0x8')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xa')]);router[_0xc94d('0x8')]('/:id',auth[_0xc94d('0x9')](),controller[_0xc94d('0xb')]);router[_0xc94d('0xc')]('/',auth[_0xc94d('0x9')](),controller[_0xc94d('0xd')]);router['put'](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller[_0xc94d('0xf')]);router[_0xc94d('0x10')](_0xc94d('0xe'),auth[_0xc94d('0x9')](),controller['destroy']);module[_0xc94d('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 3a3f8bb..e4f3f3c 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 _0x26f5=['exports','sequelize'];(function(_0xa36320,_0x273867){var _0x259785=function(_0x412e7d){while(--_0x412e7d){_0xa36320['push'](_0xa36320['shift']());}};_0x259785(++_0x273867);}(_0x26f5,0x16d));var _0x526f=function(_0x1aff0e,_0x45e3a8){_0x1aff0e=_0x1aff0e-0x0;var _0x4a6920=_0x26f5[_0x1aff0e];return _0x4a6920;};'use strict';var Sequelize=require(_0x526f('0x0'));module[_0x526f('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x858a=['STRING','name','sequelize','exports'];(function(_0x156a0d,_0x3946ce){var _0x98a9ba=function(_0x46c1b2){while(--_0x46c1b2){_0x156a0d['push'](_0x156a0d['shift']());}};_0x98a9ba(++_0x3946ce);}(_0x858a,0x1a2));var _0xa858=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x858a[_0x36c5b0];return _0xf19333;};'use strict';var Sequelize=require(_0xa858('0x0'));module[_0xa858('0x1')]={'name':{'type':Sequelize[_0xa858('0x2')],'unique':_0xa858('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xa858('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index 64060c7..42648ce 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 _0x38de=['sort','where','pick','type','VIRTUAL','merge','options','includeAll','include','rows','show','params','keys','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','UserProfileResource','stack','name','send','index','map','Variable','rawAttributes','fieldName','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','order'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x38de,0x6d));var _0xe38d=function(_0x2a72ac,_0x29f1cb){_0x2a72ac=_0x2a72ac-0x0;var _0x184b07=_0x38de[_0x2a72ac];return _0x184b07;};'use strict';var emlformat=require(_0xe38d('0x0'));var rimraf=require(_0xe38d('0x1'));var zipdir=require(_0xe38d('0x2'));var jsonpatch=require(_0xe38d('0x3'));var rp=require(_0xe38d('0x4'));var moment=require(_0xe38d('0x5'));var BPromise=require(_0xe38d('0x6'));var Mustache=require('mustache');var util=require(_0xe38d('0x7'));var path=require(_0xe38d('0x8'));var sox=require(_0xe38d('0x9'));var csv=require(_0xe38d('0xa'));var ejs=require(_0xe38d('0xb'));var fs=require('fs');var fs_extra=require(_0xe38d('0xc'));var _=require(_0xe38d('0xd'));var squel=require(_0xe38d('0xe'));var crypto=require('crypto');var jsforce=require(_0xe38d('0xf'));var deskjs=require(_0xe38d('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe38d('0x11'));var Papa=require(_0xe38d('0x12'));var Redis=require(_0xe38d('0x13'));var authService=require(_0xe38d('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe38d('0x15'));var logger=require(_0xe38d('0x16'))('api');var utils=require(_0xe38d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe38d('0x18'))['db'];function respondWithStatusCode(_0x10546e,_0x2e1827){_0x2e1827=_0x2e1827||0xcc;return function(_0x573aba){if(_0x573aba){return _0x10546e[_0xe38d('0x19')](_0x2e1827);}return _0x10546e[_0xe38d('0x1a')](_0x2e1827)[_0xe38d('0x1b')]();};}function respondWithResult(_0x2d4358,_0x30ecd2){_0x30ecd2=_0x30ecd2||0xc8;return function(_0x4ecfc9){if(_0x4ecfc9){return _0x2d4358['status'](_0x30ecd2)[_0xe38d('0x1c')](_0x4ecfc9);}};}function respondWithFilteredResult(_0xc4c084,_0x12af87){return function(_0x5a1f9c){if(_0x5a1f9c){var _0x38f2af=typeof _0x12af87[_0xe38d('0x1d')]===_0xe38d('0x1e')&&typeof _0x12af87['limit']===_0xe38d('0x1e');var _0xb2e71=_0x5a1f9c[_0xe38d('0x1f')];var _0x3297e8=_0x38f2af?0x0:_0x12af87['offset'];var _0x286832=_0x38f2af?_0x5a1f9c['count']:_0x12af87[_0xe38d('0x1d')]+_0x12af87[_0xe38d('0x20')];var _0x2efeab;if(_0x286832>=_0xb2e71){_0x286832=_0xb2e71;_0x2efeab=0xc8;}else{_0x2efeab=0xce;}_0xc4c084[_0xe38d('0x1a')](_0x2efeab);return _0xc4c084[_0xe38d('0x21')](_0xe38d('0x22'),_0x3297e8+'-'+_0x286832+'/'+_0xb2e71)[_0xe38d('0x1c')](_0x5a1f9c);}return null;};}function patchUpdates(_0x5967ce){return function(_0x3b7303){try{jsonpatch['apply'](_0x3b7303,_0x5967ce,!![]);}catch(_0x24a229){return BPromise['reject'](_0x24a229);}return _0x3b7303['save']();};}function saveUpdates(_0x2ad594,_0x5365f9){return function(_0x244aa7){if(_0x244aa7){return _0x244aa7[_0xe38d('0x23')](_0x2ad594)[_0xe38d('0x24')](function(_0xa08fa0){return _0xa08fa0;});}return null;};}function removeEntity(_0x48612e,_0x559560){return function(_0xa31ef2){if(_0xa31ef2){return _0xa31ef2[_0xe38d('0x25')]()[_0xe38d('0x24')](function(){var _0x32346a=_0xa31ef2['get']({'plain':!![]});var _0x404f47='Variables';return db[_0xe38d('0x26')]['destroy']({'where':{'type':_0x404f47,'resourceId':_0x32346a['id']}})['then'](function(){return _0xa31ef2;});})[_0xe38d('0x24')](function(){_0x48612e[_0xe38d('0x1a')](0xcc)[_0xe38d('0x1b')]();});}};}function handleEntityNotFound(_0x395f17,_0xcfc010){return function(_0x1e37a9){if(!_0x1e37a9){_0x395f17[_0xe38d('0x19')](0x194);}return _0x1e37a9;};}function handleError(_0x290f41,_0x50ce8e){_0x50ce8e=_0x50ce8e||0x1f4;return function(_0x2d57ea){logger['error'](_0x2d57ea[_0xe38d('0x27')]);if(_0x2d57ea[_0xe38d('0x28')]){delete _0x2d57ea['name'];}_0x290f41['status'](_0x50ce8e)[_0xe38d('0x29')](_0x2d57ea);};}exports[_0xe38d('0x2a')]=function(_0x26cec5,_0x2a7d51){var _0x58fe7b={},_0x32c6cf={},_0x2d8a1={'count':0x0,'rows':[]};var _0x2053a4=_[_0xe38d('0x2b')](db[_0xe38d('0x2c')][_0xe38d('0x2d')],function(_0x5cd62a){return{'name':_0x5cd62a[_0xe38d('0x2e')],'type':_0x5cd62a['type'][_0xe38d('0x2f')]};});_0x32c6cf['model']=_[_0xe38d('0x2b')](_0x2053a4,_0xe38d('0x28'));_0x32c6cf['query']=_['keys'](_0x26cec5[_0xe38d('0x30')]);_0x32c6cf[_0xe38d('0x31')]=_['intersection'](_0x32c6cf[_0xe38d('0x32')],_0x32c6cf['query']);_0x58fe7b['attributes']=_[_0xe38d('0x33')](_0x32c6cf[_0xe38d('0x32')],qs[_0xe38d('0x34')](_0x26cec5[_0xe38d('0x30')]['fields']));_0x58fe7b[_0xe38d('0x35')]=_0x58fe7b['attributes'][_0xe38d('0x36')]?_0x58fe7b[_0xe38d('0x35')]:_0x32c6cf[_0xe38d('0x32')];if(!_0x26cec5[_0xe38d('0x30')][_0xe38d('0x37')]('nolimit')){_0x58fe7b[_0xe38d('0x20')]=qs['limit'](_0x26cec5[_0xe38d('0x30')][_0xe38d('0x20')]);_0x58fe7b[_0xe38d('0x1d')]=qs[_0xe38d('0x1d')](_0x26cec5[_0xe38d('0x30')]['offset']);}_0x58fe7b[_0xe38d('0x38')]=qs[_0xe38d('0x39')](_0x26cec5[_0xe38d('0x30')]['sort']);_0x58fe7b[_0xe38d('0x3a')]=qs['filters'](_[_0xe38d('0x3b')](_0x26cec5['query'],_0x32c6cf[_0xe38d('0x31')]),_0x2053a4);if(_0x26cec5[_0xe38d('0x30')]['filter']){_0x58fe7b['where']=_['merge'](_0x58fe7b[_0xe38d('0x3a')],{'$or':_[_0xe38d('0x2b')](_0x2053a4,function(_0x58663f){if(_0x58663f[_0xe38d('0x3c')]!==_0xe38d('0x3d')){var _0x145825={};_0x145825[_0x58663f[_0xe38d('0x28')]]={'$like':'%'+_0x26cec5[_0xe38d('0x30')]['filter']+'%'};return _0x145825;}})});}_0x58fe7b=_[_0xe38d('0x3e')]({},_0x58fe7b,_0x26cec5[_0xe38d('0x3f')]);var _0x251605={'where':_0x58fe7b['where']};return db[_0xe38d('0x2c')][_0xe38d('0x1f')](_0x251605)[_0xe38d('0x24')](function(_0x10173a){_0x2d8a1['count']=_0x10173a;if(_0x26cec5[_0xe38d('0x30')][_0xe38d('0x40')]){_0x58fe7b[_0xe38d('0x41')]=[{'all':!![]}];}return db['Variable']['findAll'](_0x58fe7b);})[_0xe38d('0x24')](function(_0x4f9fd4){_0x2d8a1[_0xe38d('0x42')]=_0x4f9fd4;return _0x2d8a1;})[_0xe38d('0x24')](respondWithFilteredResult(_0x2a7d51,_0x58fe7b))['catch'](handleError(_0x2a7d51,null));};exports[_0xe38d('0x43')]=function(_0x4dd478,_0x1e43c2){var _0x469e0d={'raw':!![],'where':{'id':_0x4dd478[_0xe38d('0x44')]['id']}},_0x5f539a={};_0x5f539a[_0xe38d('0x32')]=_[_0xe38d('0x45')](db['Variable']['rawAttributes']);_0x5f539a['query']=_['keys'](_0x4dd478[_0xe38d('0x30')]);_0x5f539a[_0xe38d('0x31')]=_[_0xe38d('0x33')](_0x5f539a[_0xe38d('0x32')],_0x5f539a['query']);_0x469e0d[_0xe38d('0x35')]=_[_0xe38d('0x33')](_0x5f539a['model'],qs[_0xe38d('0x34')](_0x4dd478['query'][_0xe38d('0x34')]));_0x469e0d[_0xe38d('0x35')]=_0x469e0d[_0xe38d('0x35')]['length']?_0x469e0d['attributes']:_0x5f539a[_0xe38d('0x32')];if(_0x4dd478[_0xe38d('0x30')]['includeAll']){_0x469e0d[_0xe38d('0x41')]=[{'all':!![]}];}_0x469e0d=_[_0xe38d('0x3e')]({},_0x469e0d,_0x4dd478[_0xe38d('0x3f')]);return db['Variable'][_0xe38d('0x46')](_0x469e0d)[_0xe38d('0x24')](handleEntityNotFound(_0x1e43c2,null))[_0xe38d('0x24')](respondWithResult(_0x1e43c2,null))[_0xe38d('0x47')](handleError(_0x1e43c2,null));};exports[_0xe38d('0x48')]=function(_0x5ee527,_0x34a9d5){return db[_0xe38d('0x2c')]['create'](_0x5ee527[_0xe38d('0x49')],{})['then'](function(_0xc7603d){var _0x5a8a69=_0x5ee527['user']['get']({'plain':!![]});if(!_0x5a8a69)throw new Error(_0xe38d('0x4a'));if(_0x5a8a69[_0xe38d('0x4b')]===_0xe38d('0x4c')){var _0x5ca604=_0xc7603d[_0xe38d('0x4d')]({'plain':!![]});var _0x42c72a='Variables';return db[_0xe38d('0x4e')][_0xe38d('0x46')]({'where':{'name':_0x42c72a,'userProfileId':_0x5a8a69[_0xe38d('0x4f')]},'raw':!![]})['then'](function(_0x40c92c){if(_0x40c92c&&_0x40c92c[_0xe38d('0x50')]===0x0){return db[_0xe38d('0x26')][_0xe38d('0x48')]({'name':_0x5ca604[_0xe38d('0x28')],'resourceId':_0x5ca604['id'],'type':_0x40c92c[_0xe38d('0x28')],'sectionId':_0x40c92c['id']},{})['then'](function(){return _0xc7603d;});}else{return _0xc7603d;}})[_0xe38d('0x47')](function(_0x2a975b){logger[_0xe38d('0x51')](_0xe38d('0x52'),_0x2a975b);throw _0x2a975b;});}return _0xc7603d;})[_0xe38d('0x24')](respondWithResult(_0x34a9d5,0xc9))[_0xe38d('0x47')](handleError(_0x34a9d5,null));};exports['update']=function(_0x3d22c1,_0x55757e){if(_0x3d22c1['body']['id']){delete _0x3d22c1[_0xe38d('0x49')]['id'];}return db[_0xe38d('0x2c')][_0xe38d('0x46')]({'where':{'id':_0x3d22c1[_0xe38d('0x44')]['id']}})[_0xe38d('0x24')](handleEntityNotFound(_0x55757e,null))[_0xe38d('0x24')](saveUpdates(_0x3d22c1[_0xe38d('0x49')],null))[_0xe38d('0x24')](respondWithResult(_0x55757e,null))[_0xe38d('0x47')](handleError(_0x55757e,null));};exports[_0xe38d('0x25')]=function(_0x53bba5,_0x8ff1bc){return db[_0xe38d('0x2c')]['find']({'where':{'id':_0x53bba5[_0xe38d('0x44')]['id']}})[_0xe38d('0x24')](handleEntityNotFound(_0x8ff1bc,null))[_0xe38d('0x24')](removeEntity(_0x8ff1bc,null))[_0xe38d('0x47')](handleError(_0x8ff1bc,null));}; \ No newline at end of file +var _0x4c0a=['count','set','Content-Range','json','apply','reject','save','update','then','destroy','Variables','UserProfileResource','error','stack','name','index','map','type','key','model','query','intersection','attributes','fields','hasOwnProperty','sort','where','filters','filter','VIRTUAL','Variable','include','rows','catch','show','params','keys','length','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','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','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0xdd7a7b,_0x254b3a){var _0x40ca7d=function(_0x4c2744){while(--_0x4c2744){_0xdd7a7b['push'](_0xdd7a7b['shift']());}};_0x40ca7d(++_0x254b3a);}(_0x4c0a,0x181));var _0xa4c0=function(_0x1b4c9d,_0x1b9e7b){_0x1b4c9d=_0x1b4c9d-0x0;var _0x2f75ac=_0x4c0a[_0x1b4c9d];return _0x2f75ac;};'use strict';var emlformat=require(_0xa4c0('0x0'));var rimraf=require(_0xa4c0('0x1'));var zipdir=require(_0xa4c0('0x2'));var jsonpatch=require(_0xa4c0('0x3'));var rp=require(_0xa4c0('0x4'));var moment=require(_0xa4c0('0x5'));var BPromise=require(_0xa4c0('0x6'));var Mustache=require(_0xa4c0('0x7'));var util=require(_0xa4c0('0x8'));var path=require('path');var sox=require(_0xa4c0('0x9'));var csv=require(_0xa4c0('0xa'));var ejs=require(_0xa4c0('0xb'));var fs=require('fs');var fs_extra=require(_0xa4c0('0xc'));var _=require(_0xa4c0('0xd'));var squel=require(_0xa4c0('0xe'));var crypto=require(_0xa4c0('0xf'));var jsforce=require(_0xa4c0('0x10'));var deskjs=require(_0xa4c0('0x11'));var toCsv=require(_0xa4c0('0xa'));var querystring=require(_0xa4c0('0x12'));var Papa=require(_0xa4c0('0x13'));var Redis=require(_0xa4c0('0x14'));var authService=require(_0xa4c0('0x15'));var qs=require(_0xa4c0('0x16'));var as=require(_0xa4c0('0x17'));var hardwareService=require(_0xa4c0('0x18'));var logger=require(_0xa4c0('0x19'))(_0xa4c0('0x1a'));var utils=require(_0xa4c0('0x1b'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa4c0('0x1c'))['db'];function respondWithStatusCode(_0x35263f,_0x40c819){_0x40c819=_0x40c819||0xcc;return function(_0x31c60a){if(_0x31c60a){return _0x35263f[_0xa4c0('0x1d')](_0x40c819);}return _0x35263f[_0xa4c0('0x1e')](_0x40c819)[_0xa4c0('0x1f')]();};}function respondWithResult(_0x4eef62,_0x251ccf){_0x251ccf=_0x251ccf||0xc8;return function(_0x918693){if(_0x918693){return _0x4eef62[_0xa4c0('0x1e')](_0x251ccf)['json'](_0x918693);}};}function respondWithFilteredResult(_0x440616,_0x3ba2c0){return function(_0x52e26b){if(_0x52e26b){var _0x19430f=typeof _0x3ba2c0[_0xa4c0('0x20')]===_0xa4c0('0x21')&&typeof _0x3ba2c0[_0xa4c0('0x22')]===_0xa4c0('0x21');var _0x277732=_0x52e26b[_0xa4c0('0x23')];var _0x34f8ef=_0x19430f?0x0:_0x3ba2c0['offset'];var _0x4dacc6=_0x19430f?_0x52e26b['count']:_0x3ba2c0[_0xa4c0('0x20')]+_0x3ba2c0[_0xa4c0('0x22')];var _0x4c57cb;if(_0x4dacc6>=_0x277732){_0x4dacc6=_0x277732;_0x4c57cb=0xc8;}else{_0x4c57cb=0xce;}_0x440616[_0xa4c0('0x1e')](_0x4c57cb);return _0x440616[_0xa4c0('0x24')](_0xa4c0('0x25'),_0x34f8ef+'-'+_0x4dacc6+'/'+_0x277732)[_0xa4c0('0x26')](_0x52e26b);}return null;};}function patchUpdates(_0x12b037){return function(_0x4dc1f7){try{jsonpatch[_0xa4c0('0x27')](_0x4dc1f7,_0x12b037,!![]);}catch(_0x33ba35){return BPromise[_0xa4c0('0x28')](_0x33ba35);}return _0x4dc1f7[_0xa4c0('0x29')]();};}function saveUpdates(_0x4f877b,_0xe59b24){return function(_0x4aed76){if(_0x4aed76){return _0x4aed76[_0xa4c0('0x2a')](_0x4f877b)[_0xa4c0('0x2b')](function(_0x514717){return _0x514717;});}return null;};}function removeEntity(_0x446a16,_0x29c8cf){return function(_0x1b672a){if(_0x1b672a){return _0x1b672a[_0xa4c0('0x2c')]()['then'](function(){var _0x1977b3=_0x1b672a['get']({'plain':!![]});var _0xe729e7=_0xa4c0('0x2d');return db[_0xa4c0('0x2e')][_0xa4c0('0x2c')]({'where':{'type':_0xe729e7,'resourceId':_0x1977b3['id']}})[_0xa4c0('0x2b')](function(){return _0x1b672a;});})['then'](function(){_0x446a16[_0xa4c0('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39ad2b,_0x61c726){return function(_0x2dd2ae){if(!_0x2dd2ae){_0x39ad2b[_0xa4c0('0x1d')](0x194);}return _0x2dd2ae;};}function handleError(_0x3d37d2,_0x245cf5){_0x245cf5=_0x245cf5||0x1f4;return function(_0x412ee3){logger[_0xa4c0('0x2f')](_0x412ee3[_0xa4c0('0x30')]);if(_0x412ee3['name']){delete _0x412ee3[_0xa4c0('0x31')];}_0x3d37d2[_0xa4c0('0x1e')](_0x245cf5)['send'](_0x412ee3);};}exports[_0xa4c0('0x32')]=function(_0x5904f2,_0x1f659a){var _0x5a2ebe={},_0x5b572e={},_0x5b68d5={'count':0x0,'rows':[]};var _0x541819=_[_0xa4c0('0x33')](db['Variable']['rawAttributes'],function(_0x25398b){return{'name':_0x25398b['fieldName'],'type':_0x25398b[_0xa4c0('0x34')][_0xa4c0('0x35')]};});_0x5b572e[_0xa4c0('0x36')]=_[_0xa4c0('0x33')](_0x541819,_0xa4c0('0x31'));_0x5b572e['query']=_['keys'](_0x5904f2[_0xa4c0('0x37')]);_0x5b572e['filters']=_[_0xa4c0('0x38')](_0x5b572e[_0xa4c0('0x36')],_0x5b572e['query']);_0x5a2ebe[_0xa4c0('0x39')]=_['intersection'](_0x5b572e[_0xa4c0('0x36')],qs['fields'](_0x5904f2['query'][_0xa4c0('0x3a')]));_0x5a2ebe[_0xa4c0('0x39')]=_0x5a2ebe[_0xa4c0('0x39')]['length']?_0x5a2ebe[_0xa4c0('0x39')]:_0x5b572e[_0xa4c0('0x36')];if(!_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3b')]('nolimit')){_0x5a2ebe[_0xa4c0('0x22')]=qs['limit'](_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x22')]);_0x5a2ebe['offset']=qs[_0xa4c0('0x20')](_0x5904f2[_0xa4c0('0x37')]['offset']);}_0x5a2ebe['order']=qs[_0xa4c0('0x3c')](_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3c')]);_0x5a2ebe[_0xa4c0('0x3d')]=qs[_0xa4c0('0x3e')](_['pick'](_0x5904f2['query'],_0x5b572e[_0xa4c0('0x3e')]),_0x541819);if(_0x5904f2[_0xa4c0('0x37')][_0xa4c0('0x3f')]){_0x5a2ebe['where']=_['merge'](_0x5a2ebe[_0xa4c0('0x3d')],{'$or':_[_0xa4c0('0x33')](_0x541819,function(_0x4dd8cf){if(_0x4dd8cf[_0xa4c0('0x34')]!==_0xa4c0('0x40')){var _0x2eeab9={};_0x2eeab9[_0x4dd8cf[_0xa4c0('0x31')]]={'$like':'%'+_0x5904f2['query'][_0xa4c0('0x3f')]+'%'};return _0x2eeab9;}})});}_0x5a2ebe=_['merge']({},_0x5a2ebe,_0x5904f2['options']);var _0x349c7a={'where':_0x5a2ebe[_0xa4c0('0x3d')]};return db[_0xa4c0('0x41')][_0xa4c0('0x23')](_0x349c7a)['then'](function(_0xeb4456){_0x5b68d5['count']=_0xeb4456;if(_0x5904f2['query']['includeAll']){_0x5a2ebe[_0xa4c0('0x42')]=[{'all':!![]}];}return db[_0xa4c0('0x41')]['findAll'](_0x5a2ebe);})[_0xa4c0('0x2b')](function(_0x50e0d8){_0x5b68d5[_0xa4c0('0x43')]=_0x50e0d8;return _0x5b68d5;})[_0xa4c0('0x2b')](respondWithFilteredResult(_0x1f659a,_0x5a2ebe))[_0xa4c0('0x44')](handleError(_0x1f659a,null));};exports[_0xa4c0('0x45')]=function(_0x240ca4,_0x3177f2){var _0x1506d0={'raw':!![],'where':{'id':_0x240ca4[_0xa4c0('0x46')]['id']}},_0x48ebab={};_0x48ebab[_0xa4c0('0x36')]=_[_0xa4c0('0x47')](db['Variable']['rawAttributes']);_0x48ebab['query']=_[_0xa4c0('0x47')](_0x240ca4[_0xa4c0('0x37')]);_0x48ebab[_0xa4c0('0x3e')]=_['intersection'](_0x48ebab[_0xa4c0('0x36')],_0x48ebab[_0xa4c0('0x37')]);_0x1506d0[_0xa4c0('0x39')]=_['intersection'](_0x48ebab[_0xa4c0('0x36')],qs[_0xa4c0('0x3a')](_0x240ca4[_0xa4c0('0x37')][_0xa4c0('0x3a')]));_0x1506d0[_0xa4c0('0x39')]=_0x1506d0[_0xa4c0('0x39')][_0xa4c0('0x48')]?_0x1506d0['attributes']:_0x48ebab[_0xa4c0('0x36')];if(_0x240ca4['query'][_0xa4c0('0x49')]){_0x1506d0[_0xa4c0('0x42')]=[{'all':!![]}];}_0x1506d0=_[_0xa4c0('0x4a')]({},_0x1506d0,_0x240ca4['options']);return db[_0xa4c0('0x41')][_0xa4c0('0x4b')](_0x1506d0)[_0xa4c0('0x2b')](handleEntityNotFound(_0x3177f2,null))[_0xa4c0('0x2b')](respondWithResult(_0x3177f2,null))['catch'](handleError(_0x3177f2,null));};exports['create']=function(_0x3f8ca6,_0x4b5b91){return db['Variable']['create'](_0x3f8ca6[_0xa4c0('0x4c')],{})[_0xa4c0('0x2b')](function(_0x500c6e){var _0x31ee1b=_0x3f8ca6[_0xa4c0('0x4d')]['get']({'plain':!![]});if(!_0x31ee1b)throw new Error(_0xa4c0('0x4e'));if(_0x31ee1b[_0xa4c0('0x4f')]===_0xa4c0('0x4d')){var _0xff5e84=_0x500c6e[_0xa4c0('0x50')]({'plain':!![]});var _0x900908=_0xa4c0('0x2d');return db[_0xa4c0('0x51')][_0xa4c0('0x4b')]({'where':{'name':_0x900908,'userProfileId':_0x31ee1b[_0xa4c0('0x52')]},'raw':!![]})[_0xa4c0('0x2b')](function(_0x1da664){if(_0x1da664&&_0x1da664['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xff5e84[_0xa4c0('0x31')],'resourceId':_0xff5e84['id'],'type':_0x1da664[_0xa4c0('0x31')],'sectionId':_0x1da664['id']},{})[_0xa4c0('0x2b')](function(){return _0x500c6e;});}else{return _0x500c6e;}})[_0xa4c0('0x44')](function(_0x26f9db){logger['error'](_0xa4c0('0x53'),_0x26f9db);throw _0x26f9db;});}return _0x500c6e;})[_0xa4c0('0x2b')](respondWithResult(_0x4b5b91,0xc9))[_0xa4c0('0x44')](handleError(_0x4b5b91,null));};exports[_0xa4c0('0x2a')]=function(_0x50db44,_0x229a59){if(_0x50db44[_0xa4c0('0x4c')]['id']){delete _0x50db44[_0xa4c0('0x4c')]['id'];}return db['Variable'][_0xa4c0('0x4b')]({'where':{'id':_0x50db44['params']['id']}})[_0xa4c0('0x2b')](handleEntityNotFound(_0x229a59,null))[_0xa4c0('0x2b')](saveUpdates(_0x50db44[_0xa4c0('0x4c')],null))[_0xa4c0('0x2b')](respondWithResult(_0x229a59,null))[_0xa4c0('0x44')](handleError(_0x229a59,null));};exports['destroy']=function(_0x5a0441,_0x494a76){return db['Variable']['find']({'where':{'id':_0x5a0441[_0xa4c0('0x46')]['id']}})[_0xa4c0('0x2b')](handleEntityNotFound(_0x494a76,null))['then'](removeEntity(_0x494a76,null))[_0xa4c0('0x44')](handleError(_0x494a76,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index faa887f..94454f0 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 _0x5849=['bluebird','request-promise','path','rimraf','../../config/environment','tools_variables','lodash','../../config/logger','api','moment'];(function(_0xb8cfbe,_0x2e81b6){var _0x227d51=function(_0x5cb1ff){while(--_0x5cb1ff){_0xb8cfbe['push'](_0xb8cfbe['shift']());}};_0x227d51(++_0x2e81b6);}(_0x5849,0x1aa));var _0x9584=function(_0x26ce2f,_0x4251b9){_0x26ce2f=_0x26ce2f-0x0;var _0x159b88=_0x5849[_0x26ce2f];return _0x159b88;};'use strict';var _=require(_0x9584('0x0'));var util=require('util');var logger=require(_0x9584('0x1'))(_0x9584('0x2'));var moment=require(_0x9584('0x3'));var BPromise=require(_0x9584('0x4'));var rp=require(_0x9584('0x5'));var fs=require('fs');var path=require(_0x9584('0x6'));var rimraf=require(_0x9584('0x7'));var config=require(_0x9584('0x8'));var attributes=require('./variable.attributes');module['exports']=function(_0x19267d,_0x5dca18){return _0x19267d['define']('Variable',attributes,{'tableName':_0x9584('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17dd=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./variable.attributes','exports','define','Variable','tools_variables'];(function(_0x2e6654,_0x57362d){var _0x685f78=function(_0x16d8f1){while(--_0x16d8f1){_0x2e6654['push'](_0x2e6654['shift']());}};_0x685f78(++_0x57362d);}(_0x17dd,0xd2));var _0xd17d=function(_0x28e310,_0x32aa11){_0x28e310=_0x28e310-0x0;var _0x4ca02f=_0x17dd[_0x28e310];return _0x4ca02f;};'use strict';var _=require(_0xd17d('0x0'));var util=require(_0xd17d('0x1'));var logger=require(_0xd17d('0x2'))(_0xd17d('0x3'));var moment=require(_0xd17d('0x4'));var BPromise=require(_0xd17d('0x5'));var rp=require(_0xd17d('0x6'));var fs=require('fs');var path=require(_0xd17d('0x7'));var rimraf=require('rimraf');var config=require(_0xd17d('0x8'));var attributes=require(_0xd17d('0x9'));module[_0xd17d('0xa')]=function(_0x89db12,_0x34dcd7){return _0x89db12[_0xd17d('0xb')](_0xd17d('0xc'),attributes,{'tableName':_0xd17d('0xd'),'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 25d5c61..38a47dc 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 _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x31ef15,_0x5e9517){var _0x41dc8c=function(_0x421fee){while(--_0x421fee){_0x31ef15['push'](_0x31ef15['shift']());}};_0x41dc8c(++_0x5e9517);}(_0x6aa7,0x178));var _0x76aa=function(_0x3e6937,_0x157fb4){_0x3e6937=_0x3e6937-0x0;var _0x5c8ca7=_0x6aa7[_0x3e6937];return _0x5c8ca7;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file +var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x2d8e43,_0x486bca){var _0x3290bd=function(_0x22364e){while(--_0x22364e){_0x2d8e43['push'](_0x2d8e43['shift']());}};_0x3290bd(++_0x486bca);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 736a773..bca978b 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 _0xe18d=['/reset','reset','/pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller','get','isAuthenticated','canUpdate','fetch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe18d,0x138));var _0xde18=function(_0x14d6b8,_0xee7808){_0x14d6b8=_0x14d6b8-0x0;var _0x170fd6=_0xe18d[_0x14d6b8];return _0x170fd6;};'use strict';var express=require(_0xde18('0x0'));var router=express[_0xde18('0x1')]();var auth=require(_0xde18('0x2'));var controller=require(_0xde18('0x3'));router[_0xde18('0x4')]('/',controller['index']);router[_0xde18('0x4')]('/fetch',auth[_0xde18('0x5')](),auth[_0xde18('0x6')](),controller[_0xde18('0x7')]);router[_0xde18('0x4')](_0xde18('0x8'),auth[_0xde18('0x5')](),auth[_0xde18('0x6')](),controller[_0xde18('0x9')]);router['get'](_0xde18('0xa'),auth[_0xde18('0x5')](),auth[_0xde18('0x6')](),controller['pull']);router[_0xde18('0x4')](_0xde18('0xb'),auth[_0xde18('0x5')](),controller[_0xde18('0xc')]);router[_0xde18('0x4')](_0xde18('0xd'),controller[_0xde18('0xe')]);module[_0xde18('0xf')]=router; \ No newline at end of file +var _0x46d8=['index','get','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x3733fb,_0xd13dff){var _0x220bda=function(_0x13083d){while(--_0x13083d){_0x3733fb['push'](_0x3733fb['shift']());}};_0x220bda(++_0xd13dff);}(_0x46d8,0x1ac));var _0x846d=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x46d8[_0x12bcf7];return _0x2825a;};'use strict';var express=require(_0x846d('0x0'));var router=express[_0x846d('0x1')]();var auth=require(_0x846d('0x2'));var controller=require(_0x846d('0x3'));router['get']('/',controller[_0x846d('0x4')]);router[_0x846d('0x5')]('/fetch',auth[_0x846d('0x6')](),auth[_0x846d('0x7')](),controller[_0x846d('0x8')]);router['get'](_0x846d('0x9'),auth[_0x846d('0x6')](),auth['canUpdate'](),controller[_0x846d('0xa')]);router[_0x846d('0x5')](_0x846d('0xb'),auth[_0x846d('0x6')](),auth[_0x846d('0x7')](),controller[_0x846d('0xc')]);router[_0x846d('0x5')]('/restart',auth[_0x846d('0x6')](),controller[_0x846d('0xd')]);router[_0x846d('0x5')]('/migrations',controller[_0x846d('0xe')]);module[_0x846d('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 5a149a2..a5a121b 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 _0x7c77=['../../config/environment','update','index','version','query','latest','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','push','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','lodash','pkginfo','child_process','../../mysqldb'];(function(_0x278ddf,_0x390e18){var _0x4692c8=function(_0x11fda0){while(--_0x11fda0){_0x278ddf['push'](_0x278ddf['shift']());}};_0x4692c8(++_0x390e18);}(_0x7c77,0x183));var _0x77c7=function(_0x25239d,_0x4a72ec){_0x25239d=_0x25239d-0x0;var _0x456d9e=_0x7c77[_0x25239d];return _0x456d9e;};'use strict';var Umzug=require(_0x77c7('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x77c7('0x1'));var pkginfo=require(_0x77c7('0x2'))(module,'version');var compareVersions=require('compare-versions');var exec=require(_0x77c7('0x3'))['exec'];var db=require(_0x77c7('0x4'))['db'];var config=require(_0x77c7('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x77c7('0x6'));var git=require('simple-git')(config['root']);exports[_0x77c7('0x7')]=function(_0x19ce7c,_0x160d8f){var _0x50b0ca={'current':module['exports'][_0x77c7('0x8')],'phonebar':0x2};if(_0x19ce7c[_0x77c7('0x9')]&&_0x19ce7c['query'][_0x77c7('0xa')]){return git['fetch']()['tags'](function(_0x38ca37,_0x2f830f){_0x50b0ca[_0x77c7('0xa')]=(_0x38ca37?module[_0x77c7('0xb')][_0x77c7('0x8')]:_0x2f830f[_0x77c7('0xa')])||_0x77c7('0xc');return _0x160d8f[_0x77c7('0xd')](0xc8)[_0x77c7('0xe')](_0x50b0ca);});}else{return _0x160d8f['status'](0xc8)['json'](_0x50b0ca);}};exports[_0x77c7('0xf')]=function(_0x33c5a2,_0x48137f){return git[_0x77c7('0xf')]([_0x77c7('0x10'),_0x77c7('0x11')],function(_0x44bb0f){if(_0x44bb0f){logger[_0x77c7('0x12')](_0x44bb0f);return _0x48137f['status'](0x1f4)[_0x77c7('0xe')](_0x44bb0f);}logger[_0x77c7('0x13')]('git\x20fetch');return _0x48137f[_0x77c7('0xd')](0xc8)['json']({'output':_0x77c7('0x14')});});};exports[_0x77c7('0x15')]=function(_0x42cb6f,_0x5ca615){return git['reset']([_0x77c7('0x16'),_0x77c7('0x17')],function(_0x35cf20){if(_0x35cf20){logger['error'](_0x35cf20);return _0x5ca615[_0x77c7('0xd')](0x1f4)['json'](_0x35cf20);}logger[_0x77c7('0x13')](_0x77c7('0x18'));return _0x5ca615[_0x77c7('0xd')](0xc8)[_0x77c7('0xe')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0xc6409e,_0x52b17c){exec(_0x77c7('0x19'),function(_0x529e84,_0x10c899,_0x5ebe0a){logger[_0x77c7('0x13')](_0x10c899);logger['info'](_0x5ebe0a);if(_0x529e84){logger['error'](_0x529e84);return _0x52b17c[_0x77c7('0xd')](0x1f4)[_0x77c7('0xe')](_0x529e84);}return _0x52b17c[_0x77c7('0xd')](0xc8)[_0x77c7('0xe')]({'output':_0x10c899});});};exports[_0x77c7('0x1a')]=function(_0x564236,_0x434427){return pm2[_0x77c7('0x1a')]('motion2')[_0x77c7('0x1b')](function(_0xb4e7a9){logger[_0x77c7('0x13')](_0x77c7('0x1c'),_0xb4e7a9);return _0x434427[_0x77c7('0xd')](0xc8)['json']({'output':_0x77c7('0x1d')});})[_0x77c7('0x1e')](function(_0x1946bf){logger[_0x77c7('0x12')](_0x1946bf);return _0x434427[_0x77c7('0xd')](0x1f4)[_0x77c7('0xe')](_0x1946bf);});};exports[_0x77c7('0x1f')]=function(_0x5172c6,_0x3aacd9){var _0x3934bb=fs[_0x77c7('0x20')](path[_0x77c7('0x21')](config[_0x77c7('0x22')],_0x77c7('0x23'),_0x77c7('0x1f')));var _0x1f5d93=[];for(var _0x321b65=0x0;_0x321b65<_0x3934bb[_0x77c7('0x24')];_0x321b65++){var _0x2e81e0=_0x3934bb[_0x321b65][_0x77c7('0x25')]('.js','');if(compareVersions(module[_0x77c7('0xb')][_0x77c7('0x8')],_0x2e81e0)===-0x1){_0x1f5d93[_0x77c7('0x26')](_0x2e81e0);}}if(_0x1f5d93['length']){var _0x3ed95d=_0x1f5d93['sort'](compareVersions);var _0x2d4ac2=new Umzug({'storage':_0x77c7('0x27'),'storageOptions':{'model':db['Migration'],'modelName':_0x77c7('0x28'),'columnName':_0x77c7('0x8')},'migrations':{'params':[db[_0x77c7('0x27')][_0x77c7('0x29')](),db['sequelize'][_0x77c7('0x2a')],function(){throw new Error(_0x77c7('0x2b'));}],'path':path['join'](config[_0x77c7('0x22')],_0x77c7('0x23'),_0x77c7('0x1f')),'pattern':/\.js$/}});_0x2d4ac2['up']({'migrations':_['map'](_0x3ed95d,function(_0x47211a){return _0x47211a+_0x77c7('0x2c');})})[_0x77c7('0x1b')](function(){return _0x3aacd9[_0x77c7('0xd')](0xc8)[_0x77c7('0xe')]({'output':_0x77c7('0x2d')+module[_0x77c7('0xb')][_0x77c7('0x8')]+_0x77c7('0x2e')+_['last'](_0x3ed95d),'migrations':_[_0x77c7('0x21')](_0x3ed95d)});})[_0x77c7('0x1e')](function(_0xda4463){if(_0xda4463 instanceof db[_0x77c7('0x27')][_0x77c7('0x2f')]){return _0x3aacd9['status'](0xc8)[_0x77c7('0xe')]({'output':_0x77c7('0x30')});}else{return _0x3aacd9[_0x77c7('0xd')](0x1f4)['json'](_0xda4463);}});}else{return _0x3aacd9['status'](0xc8)[_0x77c7('0xe')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x6047=['git\x20reset\x20--hard','pull','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','sort','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','map','then','\x20to\x20','last','Database\x20already\x20up-to-date','umzug','path','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','root','index','exports','fetch','tags','2.0.0','status','json','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD'];(function(_0x528ea8,_0x24cbfe){var _0x150edf=function(_0xee47ae){while(--_0xee47ae){_0x528ea8['push'](_0x528ea8['shift']());}};_0x150edf(++_0x24cbfe);}(_0x6047,0x11d));var _0x7604=function(_0x4eadb5,_0x2e1b5f){_0x4eadb5=_0x4eadb5-0x0;var _0x3b7e17=_0x6047[_0x4eadb5];return _0x3b7e17;};'use strict';var Umzug=require(_0x7604('0x0'));var path=require(_0x7604('0x1'));var fs=require('fs');var _=require(_0x7604('0x2'));var pkginfo=require('pkginfo')(module,_0x7604('0x3'));var compareVersions=require(_0x7604('0x4'));var exec=require(_0x7604('0x5'))[_0x7604('0x6')];var db=require(_0x7604('0x7'))['db'];var config=require(_0x7604('0x8'));var pm2=require(_0x7604('0x9'));var logger=require('../../config/logger')('update');var git=require('simple-git')(config[_0x7604('0xa')]);exports[_0x7604('0xb')]=function(_0x339a44,_0x8b7cb8){var _0x577d65={'current':module[_0x7604('0xc')][_0x7604('0x3')],'phonebar':0x2};if(_0x339a44['query']&&_0x339a44['query']['latest']){return git[_0x7604('0xd')]()[_0x7604('0xe')](function(_0x1dcb1e,_0x1a9db0){_0x577d65['latest']=(_0x1dcb1e?module['exports'][_0x7604('0x3')]:_0x1a9db0['latest'])||_0x7604('0xf');return _0x8b7cb8[_0x7604('0x10')](0xc8)[_0x7604('0x11')](_0x577d65);});}else{return _0x8b7cb8[_0x7604('0x10')](0xc8)['json'](_0x577d65);}};exports[_0x7604('0xd')]=function(_0x46112f,_0x9c48d4){return git[_0x7604('0xd')]([_0x7604('0x12'),_0x7604('0x13')],function(_0x3f4bf1){if(_0x3f4bf1){logger[_0x7604('0x14')](_0x3f4bf1);return _0x9c48d4['status'](0x1f4)[_0x7604('0x11')](_0x3f4bf1);}logger[_0x7604('0x15')](_0x7604('0x16'));return _0x9c48d4['status'](0xc8)[_0x7604('0x11')]({'output':_0x7604('0x17')});});};exports[_0x7604('0x18')]=function(_0x1e7bf9,_0x295a6c){return git[_0x7604('0x18')](['--hard',_0x7604('0x19')],function(_0x48be8b){if(_0x48be8b){logger[_0x7604('0x14')](_0x48be8b);return _0x295a6c['status'](0x1f4)['json'](_0x48be8b);}logger[_0x7604('0x15')](_0x7604('0x1a'));return _0x295a6c[_0x7604('0x10')](0xc8)[_0x7604('0x11')]({'output':_0x7604('0x1b')});});};exports[_0x7604('0x1c')]=function(_0x48ba0e,_0x341ec8){exec('npm\x20install\x20--production',function(_0x3c897b,_0x54e39d,_0x5bb4c9){logger[_0x7604('0x15')](_0x54e39d);logger[_0x7604('0x15')](_0x5bb4c9);if(_0x3c897b){logger[_0x7604('0x14')](_0x3c897b);return _0x341ec8[_0x7604('0x10')](0x1f4)[_0x7604('0x11')](_0x3c897b);}return _0x341ec8[_0x7604('0x10')](0xc8)[_0x7604('0x11')]({'output':_0x54e39d});});};exports[_0x7604('0x1d')]=function(_0x59b39a,_0x44b548){return pm2[_0x7604('0x1d')](_0x7604('0x1e'))['then'](function(_0x5c0a8f){logger[_0x7604('0x15')](_0x7604('0x1f'),_0x5c0a8f);return _0x44b548[_0x7604('0x10')](0xc8)[_0x7604('0x11')]({'output':_0x7604('0x20')});})[_0x7604('0x21')](function(_0x7a94e0){logger['error'](_0x7a94e0);return _0x44b548[_0x7604('0x10')](0x1f4)[_0x7604('0x11')](_0x7a94e0);});};exports[_0x7604('0x22')]=function(_0x5be0bc,_0x51876b){var _0x579651=fs[_0x7604('0x23')](path['join'](config[_0x7604('0xa')],_0x7604('0x24'),_0x7604('0x22')));var _0x4ad53d=[];for(var _0x2a5390=0x0;_0x2a5390<_0x579651[_0x7604('0x25')];_0x2a5390++){var _0x424555=_0x579651[_0x2a5390][_0x7604('0x26')](_0x7604('0x27'),'');if(compareVersions(module[_0x7604('0xc')][_0x7604('0x3')],_0x424555)===-0x1){_0x4ad53d[_0x7604('0x28')](_0x424555);}}if(_0x4ad53d[_0x7604('0x25')]){var _0x5dc26a=_0x4ad53d[_0x7604('0x29')](compareVersions);var _0x334c31=new Umzug({'storage':_0x7604('0x2a'),'storageOptions':{'model':db[_0x7604('0x2b')],'modelName':_0x7604('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0x7604('0x2a')][_0x7604('0x2c')](),db[_0x7604('0x2a')]['constructor'],function(){throw new Error(_0x7604('0x2d'));}],'path':path[_0x7604('0x2e')](config[_0x7604('0xa')],_0x7604('0x24'),_0x7604('0x22')),'pattern':/\.js$/}});_0x334c31['up']({'migrations':_[_0x7604('0x2f')](_0x5dc26a,function(_0x2570c7){return _0x2570c7+_0x7604('0x27');})})[_0x7604('0x30')](function(){return _0x51876b['status'](0xc8)['json']({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x7604('0xc')][_0x7604('0x3')]+_0x7604('0x31')+_[_0x7604('0x32')](_0x5dc26a),'migrations':_[_0x7604('0x2e')](_0x5dc26a)});})[_0x7604('0x21')](function(_0x3b9401){if(_0x3b9401 instanceof db[_0x7604('0x2a')]['UniqueConstraintError']){return _0x51876b['status'](0xc8)[_0x7604('0x11')]({'output':_0x7604('0x33')});}else{return _0x51876b[_0x7604('0x10')](0x1f4)[_0x7604('0x11')](_0x3b9401);}});}else{return _0x51876b[_0x7604('0x10')](0xc8)[_0x7604('0x11')]({'output':_0x7604('0x33')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index ddd20e2..3ffdc5c 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 _0xa1ab=['Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','post','put','/:id','update','exports','path','express'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0xa1ab,0x1ae));var _0xba1a=function(_0x59369f,_0x51c98b){_0x59369f=_0x59369f-0x0;var _0x91e247=_0xa1ab[_0x59369f];return _0x91e247;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba1a('0x0'));var timeout=require('connect-timeout');var express=require(_0xba1a('0x1'));var router=express[_0xba1a('0x2')]();var fs_extra=require(_0xba1a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xba1a('0x4'));var config=require(_0xba1a('0x5'));var controller=require('./voiceAgentReport.controller');router[_0xba1a('0x6')]('/',auth[_0xba1a('0x7')](),controller[_0xba1a('0x8')]);router[_0xba1a('0x6')](_0xba1a('0x9'),auth[_0xba1a('0x7')](),controller[_0xba1a('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xba1a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xba1a('0xc')](_0xba1a('0xd'),auth[_0xba1a('0x7')](),controller[_0xba1a('0xe')]);router['delete'](_0xba1a('0xd'),auth[_0xba1a('0x7')](),controller['destroy']);module[_0xba1a('0xf')]=router; \ No newline at end of file +var _0x7df3=['Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','multer','util','path','connect-timeout','express'];(function(_0x2c7377,_0x32ade5){var _0x35e181=function(_0x1be1e6){while(--_0x1be1e6){_0x2c7377['push'](_0x2c7377['shift']());}};_0x35e181(++_0x32ade5);}(_0x7df3,0x160));var _0x37df=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x7df3[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x37df('0x0'));var util=require(_0x37df('0x1'));var path=require(_0x37df('0x2'));var timeout=require(_0x37df('0x3'));var express=require(_0x37df('0x4'));var router=express[_0x37df('0x5')]();var fs_extra=require(_0x37df('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x37df('0x7'));var config=require(_0x37df('0x8'));var controller=require(_0x37df('0x9'));router[_0x37df('0xa')]('/',auth[_0x37df('0xb')](),controller[_0x37df('0xc')]);router[_0x37df('0xa')](_0x37df('0xd'),auth[_0x37df('0xb')](),controller[_0x37df('0xe')]);router[_0x37df('0xa')](_0x37df('0xf'),auth[_0x37df('0xb')](),controller[_0x37df('0x10')]);router[_0x37df('0x11')]('/',auth[_0x37df('0xb')](),controller['create']);router[_0x37df('0x12')](_0x37df('0xf'),auth['isAuthenticated'](),controller[_0x37df('0x13')]);router[_0x37df('0x14')](_0x37df('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 0836c6c..ac0c21e 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 _0x7df3=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x1ebb10,_0x156b3e){var _0x20d709=function(_0x4cc093){while(--_0x4cc093){_0x1ebb10['push'](_0x1ebb10['shift']());}};_0x20d709(++_0x156b3e);}(_0x7df3,0x1cc));var _0x37df=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7df3[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x37df('0x0'));module[_0x37df('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x37df('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x37df('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x37df('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x37df('0x3')]},'agentconnectAt':{'type':Sequelize[_0x37df('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x37df('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x37df('0x3')]},'agentdumpAt':{'type':Sequelize[_0x37df('0x3')]},'holdtime':{'type':Sequelize[_0x37df('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x37df('0x4')]},'agentacw':{'type':Sequelize[_0x37df('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x37df('0x4')]},'reason':{'type':Sequelize[_0x37df('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x37df('0x2')]},'channelstate':{'type':Sequelize[_0x37df('0x4')]},'channelstatedesc':{'type':Sequelize[_0x37df('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x37df('0x2')]},'language':{'type':Sequelize[_0x37df('0x2')]},'accountcode':{'type':Sequelize[_0x37df('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x37df('0x2')]},'priority':{'type':Sequelize[_0x37df('0x2')]},'destchannel':{'type':Sequelize[_0x37df('0x2')]},'destchannelstate':{'type':Sequelize[_0x37df('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x37df('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x37df('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x37df('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x37df('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x37df('0x2')]},'destcontext':{'type':Sequelize[_0x37df('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x37df('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x37df('0x2')]},'transfer':{'type':Sequelize[_0x37df('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x37df('0x2')],'comment':_0x37df('0x6')},'transferexten':{'type':Sequelize[_0x37df('0x2')]},'transferuniqueid':{'type':Sequelize[_0x37df('0x2')]},'agententerreason':{'type':Sequelize[_0x37df('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc224=['DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc224,0x1af));var _0x4c22=function(_0x1a58e5,_0x43dfa6){_0x1a58e5=_0x1a58e5-0x0;var _0x54a83d=_0xc224[_0x1a58e5];return _0x54a83d;};'use strict';var Sequelize=require(_0x4c22('0x0'));module[_0x4c22('0x1')]={'type':{'type':Sequelize[_0x4c22('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x4c22('0x2')]},'calleridname':{'type':Sequelize[_0x4c22('0x2')]},'queue':{'type':Sequelize[_0x4c22('0x2')]},'interface':{'type':Sequelize[_0x4c22('0x2')]},'membername':{'type':Sequelize[_0x4c22('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4c22('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4c22('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4c22('0x3')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4c22('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x4c22('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x4c22('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4c22('0x5')]},'agentacw':{'type':Sequelize[_0x4c22('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4c22('0x5')]},'reason':{'type':Sequelize[_0x4c22('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4c22('0x2')]},'channelstate':{'type':Sequelize[_0x4c22('0x5')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x4c22('0x2')]},'language':{'type':Sequelize[_0x4c22('0x2')]},'accountcode':{'type':Sequelize[_0x4c22('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4c22('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x4c22('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4c22('0x2')]},'destcalleridname':{'type':Sequelize[_0x4c22('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4c22('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4c22('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x4c22('0x2')]},'destcontext':{'type':Sequelize[_0x4c22('0x2')]},'destexten':{'type':Sequelize[_0x4c22('0x2')]},'destpriority':{'type':Sequelize[_0x4c22('0x2')]},'destuniqueid':{'type':Sequelize[_0x4c22('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x4c22('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4c22('0x2')],'comment':_0x4c22('0x6')},'transferexten':{'type':Sequelize[_0x4c22('0x2')]},'transferuniqueid':{'type':Sequelize[_0x4c22('0x2')]},'agententerreason':{'type':Sequelize[_0x4c22('0x5')],'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 754492c..5bb5792 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'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 d074c7e..e65f1e3 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 _0xa990=['exports','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./voiceAgentReport.attributes'];(function(_0x2d1c74,_0x1b8682){var _0x56e449=function(_0x6c0d8d){while(--_0x6c0d8d){_0x2d1c74['push'](_0x2d1c74['shift']());}};_0x56e449(++_0x1b8682);}(_0xa990,0xc9));var _0x0a99=function(_0x49967f,_0x4286d5){_0x49967f=_0x49967f-0x0;var _0x35c7e0=_0xa990[_0x49967f];return _0x35c7e0;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var logger=require(_0x0a99('0x2'))(_0x0a99('0x3'));var moment=require(_0x0a99('0x4'));var BPromise=require(_0x0a99('0x5'));var rp=require(_0x0a99('0x6'));var fs=require('fs');var path=require(_0x0a99('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0a99('0x8'));module[_0x0a99('0x9')]=function(_0xfdb594,_0x320560){return _0xfdb594[_0x0a99('0xa')](_0x0a99('0xb'),attributes,{'tableName':_0x0a99('0xc'),'paranoid':![],'indexes':[{'fields':[_0x0a99('0xd'),_0x0a99('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x16a6=['moment','bluebird','request-promise','path','rimraf','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','destuniqueid','lodash','util','api'];(function(_0xf82b95,_0x3e4dc5){var _0x1ffa8f=function(_0x5cbe02){while(--_0x5cbe02){_0xf82b95['push'](_0xf82b95['shift']());}};_0x1ffa8f(++_0x3e4dc5);}(_0x16a6,0x15c));var _0x616a=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x16a6[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require('../../config/logger')(_0x616a('0x2'));var moment=require(_0x616a('0x3'));var BPromise=require(_0x616a('0x4'));var rp=require(_0x616a('0x5'));var fs=require('fs');var path=require(_0x616a('0x6'));var rimraf=require(_0x616a('0x7'));var config=require('../../config/environment');var attributes=require(_0x616a('0x8'));module[_0x616a('0x9')]=function(_0x4c1641,_0x56eaab){return _0x4c1641[_0x616a('0xa')](_0x616a('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid',_0x616a('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 82f3ae8..5a29fdb 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 _0xbe08=['attributes','limit','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','catch','UpdateVoiceAgentReport','where'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0xbe08,0x1f2));var _0x8be0=function(_0x2588e4,_0x454aac){_0x2588e4=_0x2588e4-0x0;var _0x4e8e28=_0xbe08[_0x2588e4];return _0x4e8e28;};'use strict';var _=require(_0x8be0('0x0'));var util=require(_0x8be0('0x1'));var moment=require(_0x8be0('0x2'));var BPromise=require(_0x8be0('0x3'));var rs=require(_0x8be0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8be0('0x5'))['db'];var utils=require(_0x8be0('0x6'));var logger=require(_0x8be0('0x7'))(_0x8be0('0x8'));var config=require(_0x8be0('0x9'));var jayson=require(_0x8be0('0xa'));var client=jayson[_0x8be0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31c153,_0x574291,_0xcd053c){return new BPromise(function(_0x288557,_0x4f6194){return client[_0x8be0('0xc')](_0x31c153,_0xcd053c)[_0x8be0('0xd')](function(_0x22574a){logger[_0x8be0('0xe')](_0x8be0('0xf'),_0x574291,_0x8be0('0x10'));logger[_0x8be0('0x11')](_0x8be0('0x12'),_0x574291,'request\x20sent',JSON['stringify'](_0x22574a));if(_0x22574a['error']){if(_0x22574a[_0x8be0('0x13')]['code']===0x1f4){logger[_0x8be0('0x13')](_0x8be0('0xf'),_0x574291,_0x22574a['error']['message']);return _0x4f6194(_0x22574a[_0x8be0('0x13')][_0x8be0('0x14')]);}logger[_0x8be0('0x13')]('VoiceAgentReport,\x20%s,\x20%s',_0x574291,_0x22574a['error'][_0x8be0('0x14')]);return _0x288557(_0x22574a['error'][_0x8be0('0x14')]);}else{logger[_0x8be0('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x574291,_0x8be0('0x10'));_0x288557(_0x22574a[_0x8be0('0x15')][_0x8be0('0x14')]);}})['catch'](function(_0x5a87cc){logger[_0x8be0('0x13')](_0x8be0('0xf'),_0x574291,_0x5a87cc);_0x4f6194(_0x5a87cc);});});}exports[_0x8be0('0x16')]=function(_0x299fd0){var _0x1e783e=this;return new Promise(function(_0x1a3bb7,_0x9604fd){return db[_0x8be0('0x17')]['create'](_0x299fd0[_0x8be0('0x18')],{'raw':_0x299fd0['options']?_0x299fd0[_0x8be0('0x19')][_0x8be0('0x1a')]===undefined?!![]:![]:!![]})[_0x8be0('0xd')](function(_0x2709d1){logger[_0x8be0('0xe')](_0x8be0('0x16'),_0x299fd0);logger['debug'](_0x8be0('0x16'),_0x299fd0,JSON['stringify'](_0x2709d1));_0x1a3bb7(_0x2709d1);})[_0x8be0('0x1b')](function(_0x1e9e90){logger[_0x8be0('0x13')](_0x8be0('0x16'),_0x1e9e90[_0x8be0('0x14')],_0x299fd0);_0x9604fd(_0x1e783e[_0x8be0('0x13')](0x1f4,_0x1e9e90[_0x8be0('0x14')]));});});};exports[_0x8be0('0x1c')]=function(_0x12cf9b){var _0x39698e=this;return new Promise(function(_0x21e5c4,_0x3bb10f){return db[_0x8be0('0x17')]['update'](_0x12cf9b[_0x8be0('0x18')],{'raw':_0x12cf9b['options']?_0x12cf9b[_0x8be0('0x19')][_0x8be0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x12cf9b[_0x8be0('0x19')]?_0x12cf9b[_0x8be0('0x19')][_0x8be0('0x1d')]||null:null,'attributes':_0x12cf9b[_0x8be0('0x19')]?_0x12cf9b['options'][_0x8be0('0x1e')]||null:null,'limit':_0x12cf9b[_0x8be0('0x19')]?_0x12cf9b[_0x8be0('0x19')][_0x8be0('0x1f')]||null:null})[_0x8be0('0xd')](function(_0x2febf9){logger[_0x8be0('0xe')](_0x8be0('0x1c'),_0x12cf9b);logger[_0x8be0('0x11')](_0x8be0('0x1c'),_0x12cf9b,JSON[_0x8be0('0x20')](_0x2febf9));_0x21e5c4(_0x2febf9);})[_0x8be0('0x1b')](function(_0x29cdba){logger[_0x8be0('0x13')](_0x8be0('0x1c'),_0x29cdba['message'],_0x12cf9b);_0x3bb10f(_0x39698e[_0x8be0('0x13')](0x1f4,_0x29cdba['message']));});});}; \ No newline at end of file +var _0x8f11=['debug','stringify','error','message','result','catch','VoiceAgentReport','create','body','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f11,0xe0));var _0x18f1=function(_0x410175,_0x3006ee){_0x410175=_0x410175-0x0;var _0x13afc8=_0x8f11[_0x410175];return _0x13afc8;};'use strict';var _=require(_0x18f1('0x0'));var util=require(_0x18f1('0x1'));var moment=require(_0x18f1('0x2'));var BPromise=require(_0x18f1('0x3'));var rs=require(_0x18f1('0x4'));var fs=require('fs');var Redis=require(_0x18f1('0x5'));var db=require(_0x18f1('0x6'))['db'];var utils=require(_0x18f1('0x7'));var logger=require('../../config/logger')(_0x18f1('0x8'));var config=require(_0x18f1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18f1('0xa')][_0x18f1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdd483f,_0x1ff2f6,_0x2e831d){return new BPromise(function(_0x9441c5,_0x285ef2){return client['request'](_0xdd483f,_0x2e831d)[_0x18f1('0xc')](function(_0x5d03f8){logger[_0x18f1('0xd')](_0x18f1('0xe'),_0x1ff2f6,_0x18f1('0xf'));logger[_0x18f1('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1ff2f6,_0x18f1('0xf'),JSON[_0x18f1('0x11')](_0x5d03f8));if(_0x5d03f8['error']){if(_0x5d03f8[_0x18f1('0x12')]['code']===0x1f4){logger[_0x18f1('0x12')](_0x18f1('0xe'),_0x1ff2f6,_0x5d03f8[_0x18f1('0x12')][_0x18f1('0x13')]);return _0x285ef2(_0x5d03f8[_0x18f1('0x12')]['message']);}logger[_0x18f1('0x12')](_0x18f1('0xe'),_0x1ff2f6,_0x5d03f8[_0x18f1('0x12')]['message']);return _0x9441c5(_0x5d03f8[_0x18f1('0x12')][_0x18f1('0x13')]);}else{logger[_0x18f1('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x1ff2f6,_0x18f1('0xf'));_0x9441c5(_0x5d03f8[_0x18f1('0x14')][_0x18f1('0x13')]);}})[_0x18f1('0x15')](function(_0x5c1008){logger[_0x18f1('0x12')](_0x18f1('0xe'),_0x1ff2f6,_0x5c1008);_0x285ef2(_0x5c1008);});});}exports['CreateVoiceAgentReport']=function(_0x4a609d){var _0x1a9f86=this;return new Promise(function(_0x841cb4,_0x9c2b43){return db[_0x18f1('0x16')][_0x18f1('0x17')](_0x4a609d[_0x18f1('0x18')],{'raw':_0x4a609d[_0x18f1('0x19')]?_0x4a609d['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2e73d2){logger[_0x18f1('0xd')](_0x18f1('0x1a'),_0x4a609d);logger[_0x18f1('0x10')](_0x18f1('0x1a'),_0x4a609d,JSON['stringify'](_0x2e73d2));_0x841cb4(_0x2e73d2);})['catch'](function(_0x560606){logger[_0x18f1('0x12')](_0x18f1('0x1a'),_0x560606[_0x18f1('0x13')],_0x4a609d);_0x9c2b43(_0x1a9f86['error'](0x1f4,_0x560606[_0x18f1('0x13')]));});});};exports[_0x18f1('0x1b')]=function(_0x10920f){var _0x22738d=this;return new Promise(function(_0x3049a5,_0x56aa3f){return db[_0x18f1('0x16')]['update'](_0x10920f['body'],{'raw':_0x10920f['options']?_0x10920f['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10920f[_0x18f1('0x19')]?_0x10920f['options'][_0x18f1('0x1c')]||null:null,'attributes':_0x10920f[_0x18f1('0x19')]?_0x10920f[_0x18f1('0x19')]['attributes']||null:null,'limit':_0x10920f[_0x18f1('0x19')]?_0x10920f[_0x18f1('0x19')][_0x18f1('0x1d')]||null:null})[_0x18f1('0xc')](function(_0x28552c){logger['info']('UpdateVoiceAgentReport',_0x10920f);logger[_0x18f1('0x10')](_0x18f1('0x1b'),_0x10920f,JSON['stringify'](_0x28552c));_0x3049a5(_0x28552c);})['catch'](function(_0x328afa){logger['error']('UpdateVoiceAgentReport',_0x328afa[_0x18f1('0x13')],_0x10920f);_0x56aa3f(_0x22738d[_0x18f1('0x12')](0x1f4,_0x328afa[_0x18f1('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index d538c20..d3e0a1a 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 _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id'];(function(_0x4c4348,_0x51c544){var _0x8b9dd=function(_0x8788b5){while(--_0x8788b5){_0x4c4348['push'](_0x4c4348['shift']());}};_0x8b9dd(++_0x51c544);}(_0xac31,0xca));var _0x1ac3=function(_0x4dda05,_0xc7508b){_0x4dda05=_0x4dda05-0x0;var _0x2c448c=_0xac31[_0x4dda05];return _0x2c448c;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),auth[_0x1ac3('0x9')](),controller['describe']);router[_0x1ac3('0xb')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xd')]);router[_0x1ac3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0x11'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file +var _0x44e8=['show','post','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x15a65a,_0x362595){var _0x2b3c27=function(_0x139943){while(--_0x139943){_0x15a65a['push'](_0x15a65a['shift']());}};_0x2b3c27(++_0x362595);}(_0x44e8,0xd7));var _0x844e=function(_0x1033a4,_0x41e4f3){_0x1033a4=_0x1033a4-0x0;var _0x333c35=_0x44e8[_0x1033a4];return _0x333c35;};'use strict';var multer=require(_0x844e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x844e('0x1'));var express=require(_0x844e('0x2'));var router=express[_0x844e('0x3')]();var fs_extra=require(_0x844e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x844e('0x5'));var config=require(_0x844e('0x6'));var controller=require(_0x844e('0x7'));router[_0x844e('0x8')]('/',auth['isAuthenticated'](),controller[_0x844e('0x9')]);router[_0x844e('0x8')](_0x844e('0xa'),auth[_0x844e('0xb')](),controller['describe']);router[_0x844e('0x8')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0xd')]);router[_0x844e('0xe')]('/',auth[_0x844e('0xb')](),controller['create']);router[_0x844e('0xf')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller[_0x844e('0x10')]);router[_0x844e('0x11')](_0x844e('0xc'),auth[_0x844e('0xb')](),controller['destroy']);module[_0x844e('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f202836..ad7c794 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 _0x8292=['DATE','INTEGER','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8292,0x14c));var _0x2829=function(_0x2b3c9d,_0x1c8c0c){_0x2b3c9d=_0x2b3c9d-0x0;var _0x4b8037=_0x8292[_0x2b3c9d];return _0x4b8037;};'use strict';var Sequelize=require('sequelize');module[_0x2829('0x0')]={'uniqueid':{'type':Sequelize[_0x2829('0x1')]},'type':{'type':Sequelize['ENUM'](_0x2829('0x2'),_0x2829('0x3'),_0x2829('0x4'),_0x2829('0x5'),_0x2829('0x6'),_0x2829('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x2829('0x1')]},'source':{'type':Sequelize[_0x2829('0x1')]},'destination':{'type':Sequelize[_0x2829('0x1')]},'destinationcontext':{'type':Sequelize[_0x2829('0x1')]},'callerid':{'type':Sequelize[_0x2829('0x1')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize[_0x2829('0x1')]},'lastapplication':{'type':Sequelize[_0x2829('0x1')]},'lastdata':{'type':Sequelize[_0x2829('0x8')]},'starttime':{'type':Sequelize[_0x2829('0x9')]},'systemanswertime':{'type':Sequelize[_0x2829('0x9')]},'answertime':{'type':Sequelize[_0x2829('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x2829('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2829('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x2829('0x1')]},'amaflags':{'type':Sequelize[_0x2829('0x1')]},'userfield':{'type':Sequelize[_0x2829('0x1')]},'userDisposition':{'type':Sequelize[_0x2829('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x2829('0x1')]},'note':{'type':Sequelize[_0x2829('0x1')]},'prefix':{'type':Sequelize[_0x2829('0x1')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x2829('0x1')]}}; \ No newline at end of file +var _0x3854=['inbound','outbound','inbound-fax','outbound-fax','dialer','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x56ed09,_0x47abc8){var _0x1d5fae=function(_0x4657d5){while(--_0x4657d5){_0x56ed09['push'](_0x56ed09['shift']());}};_0x1d5fae(++_0x47abc8);}(_0x3854,0x80));var _0x4385=function(_0x2c96c7,_0x13b62c){_0x2c96c7=_0x2c96c7-0x0;var _0x298921=_0x3854[_0x2c96c7];return _0x298921;};'use strict';var Sequelize=require(_0x4385('0x0'));module[_0x4385('0x1')]={'uniqueid':{'type':Sequelize[_0x4385('0x2')]},'type':{'type':Sequelize[_0x4385('0x3')](_0x4385('0x4'),'internal',_0x4385('0x5'),_0x4385('0x6'),_0x4385('0x7'),_0x4385('0x8'))},'tag':{'type':Sequelize[_0x4385('0x2')]},'accountcode':{'type':Sequelize[_0x4385('0x2')]},'source':{'type':Sequelize[_0x4385('0x2')]},'destination':{'type':Sequelize[_0x4385('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4385('0x2')]},'channel':{'type':Sequelize[_0x4385('0x2')]},'destinationchannel':{'type':Sequelize[_0x4385('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x4385('0x9')]},'systemanswertime':{'type':Sequelize[_0x4385('0x9')]},'answertime':{'type':Sequelize[_0x4385('0x9')]},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4385('0xa')]},'billableseconds':{'type':Sequelize[_0x4385('0xa')]},'mohtime':{'type':Sequelize[_0x4385('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x4385('0x2')]},'amaflags':{'type':Sequelize[_0x4385('0x2')]},'userfield':{'type':Sequelize[_0x4385('0x2')]},'userDisposition':{'type':Sequelize[_0x4385('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x4385('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x4385('0x2')]},'note':{'type':Sequelize[_0x4385('0x2')]},'prefix':{'type':Sequelize[_0x4385('0x2')]},'routeid':{'type':Sequelize[_0x4385('0xa')]},'sipcallid':{'type':Sequelize[_0x4385('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 30ea1dd..9cf00f0 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(_0x1a0da8,_0xb2b752){var _0x2d9c5f=function(_0x5d66a0){while(--_0x5d66a0){_0x1a0da8['push'](_0x1a0da8['shift']());}};_0x2d9c5f(++_0xb2b752);}(_0x0b0e,0x187));var _0xe0b0=function(_0x507056,_0xe16b72){_0x507056=_0x507056-0x0;var _0x4eaecc=_0x0b0e[_0x507056];return _0x4eaecc;};'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 _0x5f2f=['stack','name','send','index','VoiceCallReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','fullname','alias','User','findAll','catch','params','keys','find','create','body','destroy','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3038f7,_0x152179){_0x3038f7=_0x3038f7-0x0;var _0x4e844c=_0x5f2f[_0x3038f7];return _0x4e844c;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'attributes':['id',_0xf5f2('0x26'),_0xf5f2('0x3e'),_0xf5f2('0x3f')],'model':db['User'],'as':_0xf5f2('0x40')}];}return db[_0xf5f2('0x29')][_0xf5f2('0x41')](_0x22c826);})['then'](function(_0x509dbc){_0x11c771['rows']=_0x509dbc;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x42')](handleError(_0x53cb96,null));};exports['show']=function(_0x106272,_0xeed03d){var _0x28e33f={'raw':!![],'where':{'id':_0x106272[_0xf5f2('0x43')]['id']}},_0x31f86c={};_0x31f86c[_0xf5f2('0x31')]=_[_0xf5f2('0x44')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x31f86c[_0xf5f2('0x2e')]=_[_0xf5f2('0x44')](_0x106272[_0xf5f2('0x2e')]);_0x31f86c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x31f86c['model'],_0x31f86c[_0xf5f2('0x2e')]);_0x28e33f['attributes']=_[_0xf5f2('0x30')](_0x31f86c[_0xf5f2('0x31')],qs[_0xf5f2('0x33')](_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x28e33f[_0xf5f2('0x32')]=_0x28e33f['attributes'][_0xf5f2('0x34')]?_0x28e33f[_0xf5f2('0x32')]:_0x31f86c[_0xf5f2('0x31')];if(_0x106272[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x28e33f[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x28e33f=_[_0xf5f2('0x39')]({},_0x28e33f,_0x106272[_0xf5f2('0x3b')]);return db['VoiceCallReport'][_0xf5f2('0x45')](_0x28e33f)[_0xf5f2('0x24')](handleEntityNotFound(_0xeed03d,null))[_0xf5f2('0x24')](respondWithResult(_0xeed03d,null))['catch'](handleError(_0xeed03d,null));};exports[_0xf5f2('0x46')]=function(_0xc91b64,_0x3179a9){return db['VoiceCallReport']['create'](_0xc91b64[_0xf5f2('0x47')],{})[_0xf5f2('0x24')](respondWithResult(_0x3179a9,0xc9))['catch'](handleError(_0x3179a9,null));};exports[_0xf5f2('0x48')]=function(_0x533cca,_0x740321){return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'id':_0x533cca['params']['id']}})[_0xf5f2('0x24')](handleEntityNotFound(_0x740321,null))[_0xf5f2('0x24')](removeEntity(_0x740321,null))[_0xf5f2('0x42')](handleError(_0x740321,null));};exports[_0xf5f2('0x49')]=function(_0x4fa738,_0x3154c1){return db[_0xf5f2('0x29')]['describe']()['then'](respondWithResult(_0x3154c1,null))[_0xf5f2('0x42')](handleError(_0x3154c1,null));};exports[_0xf5f2('0x4a')]=function(_0x57782c,_0x22b645){if(_0x57782c[_0xf5f2('0x47')][_0xf5f2('0x4b')]){delete _0x57782c[_0xf5f2('0x47')]['uniqueid'];}return db['VoiceCallReport'][_0xf5f2('0x45')]({'where':{'uniqueid':_0x57782c[_0xf5f2('0x43')]['id'],'UserId':{'$or':[null,_0x57782c['user']['id']]}}})[_0xf5f2('0x24')](handleEntityNotFound(_0x22b645,null))[_0xf5f2('0x24')](saveUpdates(_0x57782c[_0xf5f2('0x47')],null))[_0xf5f2('0x24')](respondWithResult(_0x22b645,null))[_0xf5f2('0x42')](handleError(_0x22b645,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c0f5b9b..72dc483 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 _0x366d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util'];(function(_0x2cd27a,_0x595a26){var _0x1f66ca=function(_0x35b78d){while(--_0x35b78d){_0x2cd27a['push'](_0x2cd27a['shift']());}};_0x1f66ca(++_0x595a26);}(_0x366d,0xde));var _0xd366=function(_0x187453,_0x16e20f){_0x187453=_0x187453-0x0;var _0x2b5db9=_0x366d[_0x187453];return _0x2b5db9;};'use strict';var _=require(_0xd366('0x0'));var util=require(_0xd366('0x1'));var logger=require(_0xd366('0x2'))(_0xd366('0x3'));var moment=require(_0xd366('0x4'));var BPromise=require(_0xd366('0x5'));var rp=require(_0xd366('0x6'));var fs=require('fs');var path=require(_0xd366('0x7'));var rimraf=require(_0xd366('0x8'));var config=require(_0xd366('0x9'));var attributes=require(_0xd366('0xa'));module[_0xd366('0xb')]=function(_0x44ef31,_0x42f37e){return _0x44ef31[_0xd366('0xc')](_0xd366('0xd'),attributes,{'tableName':_0xd366('0xe'),'paranoid':![],'indexes':[{'fields':[_0xd366('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbe23=['../../config/environment','./voiceCallReport.attributes','exports','VoiceCallReport','report_call','uniqueid','lodash','api','moment','bluebird','path','rimraf'];(function(_0x4a3472,_0x402876){var _0x4fe794=function(_0x1b0f7e){while(--_0x1b0f7e){_0x4a3472['push'](_0x4a3472['shift']());}};_0x4fe794(++_0x402876);}(_0xbe23,0x1c2));var _0x3be2=function(_0x2e5221,_0x330661){_0x2e5221=_0x2e5221-0x0;var _0x893264=_0xbe23[_0x2e5221];return _0x893264;};'use strict';var _=require(_0x3be2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3be2('0x1'));var moment=require(_0x3be2('0x2'));var BPromise=require(_0x3be2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3be2('0x4'));var rimraf=require(_0x3be2('0x5'));var config=require(_0x3be2('0x6'));var attributes=require(_0x3be2('0x7'));module[_0x3be2('0x8')]=function(_0x3d9e74,_0x573121){return _0x3d9e74['define'](_0x3be2('0x9'),attributes,{'tableName':_0x3be2('0xa'),'paranoid':![],'indexes':[{'fields':[_0x3be2('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 42abe69..2e36fe3 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 _0xe102=['create','body','then','CreateVoiceCallReport','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','catch','VoiceCallReport','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport'];(function(_0x1d4696,_0x37daa5){var _0x311b88=function(_0xe881a0){while(--_0xe881a0){_0x1d4696['push'](_0x1d4696['shift']());}};_0x311b88(++_0x37daa5);}(_0xe102,0x1ce));var _0x2e10=function(_0x28125e,_0x370d11){_0x28125e=_0x28125e-0x0;var _0x2c694f=_0xe102[_0x28125e];return _0x2c694f;};'use strict';var _=require(_0x2e10('0x0'));var util=require(_0x2e10('0x1'));var moment=require(_0x2e10('0x2'));var BPromise=require(_0x2e10('0x3'));var rs=require(_0x2e10('0x4'));var fs=require('fs');var Redis=require(_0x2e10('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2e10('0x6'))(_0x2e10('0x7'));var config=require(_0x2e10('0x8'));var jayson=require(_0x2e10('0x9'));var client=jayson[_0x2e10('0xa')][_0x2e10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x15d8eb,_0x3ae79e,_0x3c614a){return new BPromise(function(_0x59ca1e,_0xb354c0){return client[_0x2e10('0xc')](_0x15d8eb,_0x3c614a)['then'](function(_0x211b74){logger[_0x2e10('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x3ae79e,_0x2e10('0xe'));logger[_0x2e10('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x3ae79e,_0x2e10('0xe'),JSON[_0x2e10('0x10')](_0x211b74));if(_0x211b74[_0x2e10('0x11')]){if(_0x211b74[_0x2e10('0x11')][_0x2e10('0x12')]===0x1f4){logger[_0x2e10('0x11')](_0x2e10('0x13'),_0x3ae79e,_0x211b74['error']['message']);return _0xb354c0(_0x211b74[_0x2e10('0x11')][_0x2e10('0x14')]);}logger[_0x2e10('0x11')](_0x2e10('0x13'),_0x3ae79e,_0x211b74[_0x2e10('0x11')][_0x2e10('0x14')]);return _0x59ca1e(_0x211b74[_0x2e10('0x11')]['message']);}else{logger[_0x2e10('0xd')](_0x2e10('0x13'),_0x3ae79e,_0x2e10('0xe'));_0x59ca1e(_0x211b74['result']['message']);}})[_0x2e10('0x15')](function(_0x69c6bb){logger[_0x2e10('0x11')](_0x2e10('0x13'),_0x3ae79e,_0x69c6bb);_0xb354c0(_0x69c6bb);});});}exports['GetVoiceCallReport']=function(_0x34d492){var _0xbf00ae=this;return new Promise(function(_0x401ec8,_0x208f2d){return db[_0x2e10('0x16')]['findAll']({'raw':_0x34d492['options']?_0x34d492[_0x2e10('0x17')][_0x2e10('0x18')]===undefined?!![]:![]:!![],'where':_0x34d492['options']?_0x34d492['options'][_0x2e10('0x19')]||null:null,'attributes':_0x34d492[_0x2e10('0x17')]?_0x34d492['options'][_0x2e10('0x1a')]||null:null,'limit':_0x34d492['options']?_0x34d492['options'][_0x2e10('0x1b')]||null:null,'include':_0x34d492[_0x2e10('0x17')]?_0x34d492[_0x2e10('0x17')]['include']?_['map'](_0x34d492[_0x2e10('0x17')][_0x2e10('0x1c')],function(_0x206f63){return{'model':db[_0x206f63[_0x2e10('0x1d')]],'as':_0x206f63['as'],'attributes':_0x206f63[_0x2e10('0x1a')],'include':_0x206f63['include']?_[_0x2e10('0x1e')](_0x206f63[_0x2e10('0x1c')],function(_0x40993b){return{'model':db[_0x40993b['model']],'as':_0x40993b['as'],'attributes':_0x40993b[_0x2e10('0x1a')],'include':_0x40993b['include']?_[_0x2e10('0x1e')](_0x40993b['include'],function(_0x373d3c){return{'model':db[_0x373d3c['model']],'as':_0x373d3c['as'],'attributes':_0x373d3c[_0x2e10('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21f263){logger[_0x2e10('0xd')](_0x2e10('0x1f'),_0x34d492);logger['debug'](_0x2e10('0x1f'),_0x34d492,JSON[_0x2e10('0x10')](_0x21f263));_0x401ec8(_0x21f263);})[_0x2e10('0x15')](function(_0xa324d2){logger['error'](_0x2e10('0x1f'),_0xa324d2[_0x2e10('0x14')],_0x34d492);_0x208f2d(_0xbf00ae['error'](0x1f4,_0xa324d2[_0x2e10('0x14')]));});});};exports['CreateVoiceCallReport']=function(_0x56f5ca){var _0x12eca8=this;return new Promise(function(_0x1c9f26,_0x507ec3){return db[_0x2e10('0x16')][_0x2e10('0x20')](_0x56f5ca[_0x2e10('0x21')],{'raw':_0x56f5ca[_0x2e10('0x17')]?_0x56f5ca[_0x2e10('0x17')][_0x2e10('0x18')]===undefined?!![]:![]:!![]})[_0x2e10('0x22')](function(_0x3dfc95){logger['info']('CreateVoiceCallReport',_0x56f5ca);logger[_0x2e10('0xf')](_0x2e10('0x23'),_0x56f5ca,JSON[_0x2e10('0x10')](_0x3dfc95));_0x1c9f26(_0x3dfc95);})[_0x2e10('0x15')](function(_0x2e226b){logger[_0x2e10('0x11')](_0x2e10('0x23'),_0x2e226b[_0x2e10('0x14')],_0x56f5ca);_0x507ec3(_0x12eca8[_0x2e10('0x11')](0x1f4,_0x2e226b[_0x2e10('0x14')]));});});};exports[_0x2e10('0x24')]=function(_0x6a1d91){var _0x5171d8=this;return new Promise(function(_0x3547d2,_0x1e6b5d){return db[_0x2e10('0x16')][_0x2e10('0x25')](_0x6a1d91[_0x2e10('0x21')],{'raw':_0x6a1d91[_0x2e10('0x17')]?_0x6a1d91[_0x2e10('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x6a1d91['options']?_0x6a1d91['options']['where']||null:null,'attributes':_0x6a1d91[_0x2e10('0x17')]?_0x6a1d91[_0x2e10('0x17')]['attributes']||null:null,'limit':_0x6a1d91[_0x2e10('0x17')]?_0x6a1d91[_0x2e10('0x17')]['limit']||null:null})[_0x2e10('0x22')](function(_0x17a091){logger[_0x2e10('0xd')](_0x2e10('0x24'),_0x6a1d91);logger[_0x2e10('0xf')]('UpdateVoiceCallReport',_0x6a1d91,JSON['stringify'](_0x17a091));_0x3547d2(_0x17a091);})[_0x2e10('0x15')](function(_0x49ca5a){logger[_0x2e10('0x11')](_0x2e10('0x24'),_0x49ca5a[_0x2e10('0x14')],_0x6a1d91);_0x1e6b5d(_0x5171d8[_0x2e10('0x11')](0x1f4,_0x49ca5a[_0x2e10('0x14')]));});});}; \ No newline at end of file +var _0x568a=['request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceCallReport,\x20%s,\x20%s','message','GetVoiceCallReport','VoiceCallReport','findAll','options','where','include','map','model','attributes','CreateVoiceCallReport','create','body','raw','UpdateVoiceCallReport','limit','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x7c7019,_0x11ef75){var _0x5aa169=function(_0x2f7677){while(--_0x2f7677){_0x7c7019['push'](_0x7c7019['shift']());}};_0x5aa169(++_0x11ef75);}(_0x568a,0x11e));var _0xa568=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x568a[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xa568('0x0'));var moment=require(_0xa568('0x1'));var BPromise=require(_0xa568('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa568('0x3'));var db=require(_0xa568('0x4'))['db'];var utils=require(_0xa568('0x5'));var logger=require(_0xa568('0x6'))(_0xa568('0x7'));var config=require('../../config/environment');var jayson=require(_0xa568('0x8'));var client=jayson['client'][_0xa568('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4219e4,_0x11d0d,_0x32d55c){return new BPromise(function(_0x4b7d65,_0x11b045){return client[_0xa568('0xa')](_0x4219e4,_0x32d55c)[_0xa568('0xb')](function(_0x103cf6){logger[_0xa568('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x11d0d,_0xa568('0xd'));logger[_0xa568('0xe')](_0xa568('0xf'),_0x11d0d,_0xa568('0xd'),JSON[_0xa568('0x10')](_0x103cf6));if(_0x103cf6[_0xa568('0x11')]){if(_0x103cf6[_0xa568('0x11')][_0xa568('0x12')]===0x1f4){logger['error'](_0xa568('0x13'),_0x11d0d,_0x103cf6[_0xa568('0x11')][_0xa568('0x14')]);return _0x11b045(_0x103cf6[_0xa568('0x11')][_0xa568('0x14')]);}logger[_0xa568('0x11')](_0xa568('0x13'),_0x11d0d,_0x103cf6['error'][_0xa568('0x14')]);return _0x4b7d65(_0x103cf6[_0xa568('0x11')]['message']);}else{logger[_0xa568('0xc')](_0xa568('0x13'),_0x11d0d,'request\x20sent');_0x4b7d65(_0x103cf6['result'][_0xa568('0x14')]);}})['catch'](function(_0x3188fc){logger[_0xa568('0x11')](_0xa568('0x13'),_0x11d0d,_0x3188fc);_0x11b045(_0x3188fc);});});}exports[_0xa568('0x15')]=function(_0x1d59b9){var _0xd2bc54=this;return new Promise(function(_0x347056,_0x2c585d){return db[_0xa568('0x16')][_0xa568('0x17')]({'raw':_0x1d59b9[_0xa568('0x18')]?_0x1d59b9['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d59b9[_0xa568('0x18')]?_0x1d59b9[_0xa568('0x18')][_0xa568('0x19')]||null:null,'attributes':_0x1d59b9[_0xa568('0x18')]?_0x1d59b9[_0xa568('0x18')]['attributes']||null:null,'limit':_0x1d59b9[_0xa568('0x18')]?_0x1d59b9[_0xa568('0x18')]['limit']||null:null,'include':_0x1d59b9[_0xa568('0x18')]?_0x1d59b9[_0xa568('0x18')][_0xa568('0x1a')]?_[_0xa568('0x1b')](_0x1d59b9[_0xa568('0x18')][_0xa568('0x1a')],function(_0x147a37){return{'model':db[_0x147a37[_0xa568('0x1c')]],'as':_0x147a37['as'],'attributes':_0x147a37[_0xa568('0x1d')],'include':_0x147a37[_0xa568('0x1a')]?_['map'](_0x147a37[_0xa568('0x1a')],function(_0x2f45c8){return{'model':db[_0x2f45c8[_0xa568('0x1c')]],'as':_0x2f45c8['as'],'attributes':_0x2f45c8[_0xa568('0x1d')],'include':_0x2f45c8['include']?_['map'](_0x2f45c8[_0xa568('0x1a')],function(_0x45fd73){return{'model':db[_0x45fd73[_0xa568('0x1c')]],'as':_0x45fd73['as'],'attributes':_0x45fd73[_0xa568('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd5fc2c){logger[_0xa568('0xc')](_0xa568('0x15'),_0x1d59b9);logger['debug']('GetVoiceCallReport',_0x1d59b9,JSON[_0xa568('0x10')](_0xd5fc2c));_0x347056(_0xd5fc2c);})['catch'](function(_0x1e534b){logger[_0xa568('0x11')](_0xa568('0x15'),_0x1e534b[_0xa568('0x14')],_0x1d59b9);_0x2c585d(_0xd2bc54['error'](0x1f4,_0x1e534b[_0xa568('0x14')]));});});};exports[_0xa568('0x1e')]=function(_0x2e779d){var _0x2812ea=this;return new Promise(function(_0x29deb8,_0x5da8af){return db['VoiceCallReport'][_0xa568('0x1f')](_0x2e779d[_0xa568('0x20')],{'raw':_0x2e779d[_0xa568('0x18')]?_0x2e779d[_0xa568('0x18')][_0xa568('0x21')]===undefined?!![]:![]:!![]})[_0xa568('0xb')](function(_0x2c899e){logger[_0xa568('0xc')]('CreateVoiceCallReport',_0x2e779d);logger[_0xa568('0xe')](_0xa568('0x1e'),_0x2e779d,JSON[_0xa568('0x10')](_0x2c899e));_0x29deb8(_0x2c899e);})['catch'](function(_0x37eedd){logger['error'](_0xa568('0x1e'),_0x37eedd[_0xa568('0x14')],_0x2e779d);_0x5da8af(_0x2812ea['error'](0x1f4,_0x37eedd[_0xa568('0x14')]));});});};exports[_0xa568('0x22')]=function(_0x46eb5a){var _0x4759d7=this;return new Promise(function(_0x30df20,_0x2bcd4c){return db[_0xa568('0x16')]['update'](_0x46eb5a[_0xa568('0x20')],{'raw':_0x46eb5a['options']?_0x46eb5a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46eb5a[_0xa568('0x18')]?_0x46eb5a['options']['where']||null:null,'attributes':_0x46eb5a[_0xa568('0x18')]?_0x46eb5a['options'][_0xa568('0x1d')]||null:null,'limit':_0x46eb5a[_0xa568('0x18')]?_0x46eb5a[_0xa568('0x18')][_0xa568('0x23')]||null:null})['then'](function(_0x439991){logger[_0xa568('0xc')]('UpdateVoiceCallReport',_0x46eb5a);logger['debug'](_0xa568('0x22'),_0x46eb5a,JSON['stringify'](_0x439991));_0x30df20(_0x439991);})[_0xa568('0x24')](function(_0x49a190){logger[_0xa568('0x11')](_0xa568('0x22'),_0x49a190['message'],_0x46eb5a);_0x2bcd4c(_0x4759d7[_0xa568('0x11')](0x1f4,_0x49a190[_0xa568('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5fa8282..e0db312 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 _0x5712=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','multer'];(function(_0x19fb04,_0xa2a0a1){var _0x2f80d8=function(_0x166cae){while(--_0x166cae){_0x19fb04['push'](_0x19fb04['shift']());}};_0x2f80d8(++_0xa2a0a1);}(_0x5712,0x13a));var _0x2571=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5712[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x2571('0x0'));var util=require('util');var path=require(_0x2571('0x1'));var timeout=require('connect-timeout');var express=require(_0x2571('0x2'));var router=express[_0x2571('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2571('0x4'));var interaction=require(_0x2571('0x5'));var config=require(_0x2571('0x6'));var controller=require(_0x2571('0x7'));router[_0x2571('0x8')]('/',auth[_0x2571('0x9')](),controller[_0x2571('0xa')]);router[_0x2571('0x8')](_0x2571('0xb'),auth[_0x2571('0x9')](),controller[_0x2571('0xc')]);router[_0x2571('0xd')]('/',auth[_0x2571('0x9')](),controller[_0x2571('0xe')]);router['put'](_0x2571('0xb'),auth[_0x2571('0x9')](),controller['update']);router['delete'](_0x2571('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x81ef=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','put'];(function(_0x3eae73,_0x22e3d0){var _0x42487b=function(_0x1a5494){while(--_0x1a5494){_0x3eae73['push'](_0x3eae73['shift']());}};_0x42487b(++_0x22e3d0);}(_0x81ef,0x16c));var _0xf81e=function(_0x46b585,_0x23442e){_0x46b585=_0x46b585-0x0;var _0xa437f3=_0x81ef[_0x46b585];return _0xa437f3;};'use strict';var multer=require(_0xf81e('0x0'));var util=require(_0xf81e('0x1'));var path=require('path');var timeout=require(_0xf81e('0x2'));var express=require(_0xf81e('0x3'));var router=express[_0xf81e('0x4')]();var fs_extra=require(_0xf81e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf81e('0x6'));var config=require('../../config/environment');var controller=require(_0xf81e('0x7'));router[_0xf81e('0x8')]('/',auth[_0xf81e('0x9')](),controller[_0xf81e('0xa')]);router[_0xf81e('0x8')](_0xf81e('0xb'),auth[_0xf81e('0x9')](),controller[_0xf81e('0xc')]);router['post']('/',auth[_0xf81e('0x9')](),controller['create']);router[_0xf81e('0xd')](_0xf81e('0xb'),auth[_0xf81e('0x9')](),controller[_0xf81e('0xe')]);router[_0xf81e('0xf')]('/:id',auth[_0xf81e('0x9')](),controller[_0xf81e('0x10')]);module[_0xf81e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 1407f9a..f1fae45 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 _0x4c44=['split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x26793a,_0x2530c1){var _0x281092=function(_0xe8df35){while(--_0xe8df35){_0x26793a['push'](_0x26793a['shift']());}};_0x281092(++_0x2530c1);}(_0x4c44,0x142));var _0x44c4=function(_0x4f750b,_0x4e3e43){_0x4f750b=_0x4f750b-0x0;var _0x918b39=_0x4c44[_0x4f750b];return _0x918b39;};'use strict';var Sequelize=require(_0x44c4('0x0'));module[_0x44c4('0x1')]={'name':{'type':Sequelize[_0x44c4('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x44c4('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x44c4('0x2')],'set':function(_0x22568e){this[_0x44c4('0x4')](_0x44c4('0x5'),_0x22568e?_0x22568e[_0x44c4('0x6')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x44c4('0x7')](_0x44c4('0x5'))[_0x44c4('0x8')](''):[];}},'auth':{'type':Sequelize[_0x44c4('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x44c4('0x2')]},'record':{'type':Sequelize[_0x44c4('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x44c4('0x2')]},'description':{'type':Sequelize[_0x44c4('0x2')]}}; \ No newline at end of file +var _0xf029=['name','setDataValue','getDataValue','options','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x27ac95,_0x4fa3ca){var _0x24150a=function(_0x15049b){while(--_0x15049b){_0x27ac95['push'](_0x27ac95['shift']());}};_0x24150a(++_0x4fa3ca);}(_0xf029,0x1d1));var _0x9f02=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf029[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x9f02('0x0'));module[_0x9f02('0x1')]={'name':{'type':Sequelize[_0x9f02('0x2')]},'prefix':{'type':Sequelize[_0x9f02('0x2')],'unique':_0x9f02('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x1c996f){this[_0x9f02('0x4')]('options',_0x1c996f?_0x1c996f['join'](''):[]);},'get':function(){return this[_0x9f02('0x5')](_0x9f02('0x6'))?this[_0x9f02('0x5')](_0x9f02('0x6'))[_0x9f02('0x7')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x9f02('0x2')]},'record':{'type':Sequelize[_0x9f02('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x9f02('0x2')]},'description':{'type':Sequelize[_0x9f02('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 8e8213e..051242c 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 _0xc368=['error','name','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','keys','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','UserProfileResource'];(function(_0xdb5808,_0x58c067){var _0x111072=function(_0x3c3f27){while(--_0x3c3f27){_0xdb5808['push'](_0xdb5808['shift']());}};_0x111072(++_0x58c067);}(_0xc368,0x7b));var _0x8c36=function(_0x31655d,_0x16e5ee){_0x31655d=_0x31655d-0x0;var _0x311b1f=_0xc368[_0x31655d];return _0x311b1f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8c36('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8c36('0x1'));var rp=require(_0x8c36('0x2'));var moment=require(_0x8c36('0x3'));var BPromise=require(_0x8c36('0x4'));var Mustache=require(_0x8c36('0x5'));var util=require('util');var path=require(_0x8c36('0x6'));var sox=require(_0x8c36('0x7'));var csv=require(_0x8c36('0x8'));var ejs=require(_0x8c36('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8c36('0xa'));var crypto=require(_0x8c36('0xb'));var jsforce=require(_0x8c36('0xc'));var deskjs=require(_0x8c36('0xd'));var toCsv=require(_0x8c36('0x8'));var querystring=require(_0x8c36('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8c36('0xf'));var as=require(_0x8c36('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8c36('0x11'))(_0x8c36('0x12'));var utils=require(_0x8c36('0x13'));var config=require(_0x8c36('0x14'));var licenseUtil=require(_0x8c36('0x15'));var db=require(_0x8c36('0x16'))['db'];function respondWithStatusCode(_0xa09884,_0x23eb71){_0x23eb71=_0x23eb71||0xcc;return function(_0x205d5c){if(_0x205d5c){return _0xa09884[_0x8c36('0x17')](_0x23eb71);}return _0xa09884[_0x8c36('0x18')](_0x23eb71)[_0x8c36('0x19')]();};}function respondWithResult(_0x3c824b,_0x220f18){_0x220f18=_0x220f18||0xc8;return function(_0x5dfcd5){if(_0x5dfcd5){return _0x3c824b[_0x8c36('0x18')](_0x220f18)['json'](_0x5dfcd5);}};}function respondWithFilteredResult(_0xea7509,_0x3f83aa){return function(_0x29e791){if(_0x29e791){var _0x1fc68e=typeof _0x3f83aa[_0x8c36('0x1a')]===_0x8c36('0x1b')&&typeof _0x3f83aa[_0x8c36('0x1c')]===_0x8c36('0x1b');var _0x30229e=_0x29e791['count'];var _0x2be9b0=_0x1fc68e?0x0:_0x3f83aa[_0x8c36('0x1a')];var _0x47832a=_0x1fc68e?_0x29e791[_0x8c36('0x1d')]:_0x3f83aa[_0x8c36('0x1a')]+_0x3f83aa['limit'];var _0x15100f;if(_0x47832a>=_0x30229e){_0x47832a=_0x30229e;_0x15100f=0xc8;}else{_0x15100f=0xce;}_0xea7509[_0x8c36('0x18')](_0x15100f);return _0xea7509[_0x8c36('0x1e')](_0x8c36('0x1f'),_0x2be9b0+'-'+_0x47832a+'/'+_0x30229e)[_0x8c36('0x20')](_0x29e791);}return null;};}function patchUpdates(_0x2b07ad){return function(_0xfb9763){try{jsonpatch[_0x8c36('0x21')](_0xfb9763,_0x2b07ad,!![]);}catch(_0x153735){return BPromise[_0x8c36('0x22')](_0x153735);}return _0xfb9763[_0x8c36('0x23')]();};}function saveUpdates(_0x14ee6b,_0x46645d){return function(_0x51fd6c){if(_0x51fd6c){return _0x51fd6c['update'](_0x14ee6b)['then'](function(_0x55b844){return _0x55b844;});}return null;};}function removeEntity(_0x2269f5,_0x7effb8){return function(_0x2088aa){if(_0x2088aa){return _0x2088aa[_0x8c36('0x24')]()[_0x8c36('0x25')](function(){var _0x27c0df=_0x2088aa['get']({'plain':!![]});var _0x1d39ca='ChanSpies';return db[_0x8c36('0x26')]['destroy']({'where':{'type':_0x1d39ca,'resourceId':_0x27c0df['id']}})[_0x8c36('0x25')](function(){return _0x2088aa;});})[_0x8c36('0x25')](function(){_0x2269f5[_0x8c36('0x18')](0xcc)[_0x8c36('0x19')]();});}};}function handleEntityNotFound(_0x50aa48,_0x55cbfb){return function(_0x7e7e56){if(!_0x7e7e56){_0x50aa48[_0x8c36('0x17')](0x194);}return _0x7e7e56;};}function handleError(_0x5ad933,_0x4fc3ba){_0x4fc3ba=_0x4fc3ba||0x1f4;return function(_0x418663){logger[_0x8c36('0x27')](_0x418663['stack']);if(_0x418663[_0x8c36('0x28')]){delete _0x418663[_0x8c36('0x28')];}_0x5ad933[_0x8c36('0x18')](_0x4fc3ba)['send'](_0x418663);};}exports['index']=function(_0x46b72f,_0x1531fc){var _0x3d7056={},_0x192ce3={},_0x3ae970={'count':0x0,'rows':[]};var _0x2e8855=_[_0x8c36('0x29')](db[_0x8c36('0x2a')][_0x8c36('0x2b')],function(_0x2d6476){return{'name':_0x2d6476[_0x8c36('0x2c')],'type':_0x2d6476[_0x8c36('0x2d')][_0x8c36('0x2e')]};});_0x192ce3[_0x8c36('0x2f')]=_[_0x8c36('0x29')](_0x2e8855,_0x8c36('0x28'));_0x192ce3[_0x8c36('0x30')]=_['keys'](_0x46b72f['query']);_0x192ce3['filters']=_[_0x8c36('0x31')](_0x192ce3[_0x8c36('0x2f')],_0x192ce3[_0x8c36('0x30')]);_0x3d7056[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x192ce3[_0x8c36('0x2f')],qs[_0x8c36('0x33')](_0x46b72f['query'][_0x8c36('0x33')]));_0x3d7056['attributes']=_0x3d7056[_0x8c36('0x32')]['length']?_0x3d7056[_0x8c36('0x32')]:_0x192ce3[_0x8c36('0x2f')];if(!_0x46b72f[_0x8c36('0x30')]['hasOwnProperty'](_0x8c36('0x34'))){_0x3d7056[_0x8c36('0x1c')]=qs[_0x8c36('0x1c')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x1c')]);_0x3d7056[_0x8c36('0x1a')]=qs[_0x8c36('0x1a')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x1a')]);}_0x3d7056[_0x8c36('0x35')]=qs[_0x8c36('0x36')](_0x46b72f[_0x8c36('0x30')][_0x8c36('0x36')]);_0x3d7056[_0x8c36('0x37')]=qs[_0x8c36('0x38')](_[_0x8c36('0x39')](_0x46b72f[_0x8c36('0x30')],_0x192ce3['filters']),_0x2e8855);if(_0x46b72f[_0x8c36('0x30')]['filter']){_0x3d7056[_0x8c36('0x37')]=_[_0x8c36('0x3a')](_0x3d7056[_0x8c36('0x37')],{'$or':_[_0x8c36('0x29')](_0x2e8855,function(_0x4da574){if(_0x4da574['type']!==_0x8c36('0x3b')){var _0x15a553={};_0x15a553[_0x4da574[_0x8c36('0x28')]]={'$like':'%'+_0x46b72f['query']['filter']+'%'};return _0x15a553;}})});}_0x3d7056=_[_0x8c36('0x3a')]({},_0x3d7056,_0x46b72f['options']);var _0x568290={'where':_0x3d7056[_0x8c36('0x37')]};return db[_0x8c36('0x2a')][_0x8c36('0x1d')](_0x568290)[_0x8c36('0x25')](function(_0x2a0272){_0x3ae970[_0x8c36('0x1d')]=_0x2a0272;if(_0x46b72f[_0x8c36('0x30')][_0x8c36('0x3c')]){_0x3d7056[_0x8c36('0x3d')]=[{'all':!![]}];}return db[_0x8c36('0x2a')]['findAll'](_0x3d7056);})[_0x8c36('0x25')](function(_0x24505c){_0x3ae970[_0x8c36('0x3e')]=_0x24505c;return _0x3ae970;})[_0x8c36('0x25')](respondWithFilteredResult(_0x1531fc,_0x3d7056))[_0x8c36('0x3f')](handleError(_0x1531fc,null));};exports['show']=function(_0xb1f8ac,_0x3dde7b){var _0x31699c={'raw':![],'where':{'id':_0xb1f8ac[_0x8c36('0x40')]['id']}},_0x18e28e={};_0x18e28e[_0x8c36('0x2f')]=_['keys'](db[_0x8c36('0x2a')][_0x8c36('0x2b')]);_0x18e28e[_0x8c36('0x30')]=_[_0x8c36('0x41')](_0xb1f8ac[_0x8c36('0x30')]);_0x18e28e[_0x8c36('0x38')]=_[_0x8c36('0x31')](_0x18e28e['model'],_0x18e28e[_0x8c36('0x30')]);_0x31699c[_0x8c36('0x32')]=_[_0x8c36('0x31')](_0x18e28e[_0x8c36('0x2f')],qs[_0x8c36('0x33')](_0xb1f8ac[_0x8c36('0x30')][_0x8c36('0x33')]));_0x31699c[_0x8c36('0x32')]=_0x31699c[_0x8c36('0x32')][_0x8c36('0x42')]?_0x31699c[_0x8c36('0x32')]:_0x18e28e[_0x8c36('0x2f')];if(_0xb1f8ac['query']['includeAll']){_0x31699c[_0x8c36('0x3d')]=[{'all':!![]}];}_0x31699c=_[_0x8c36('0x3a')]({},_0x31699c,_0xb1f8ac[_0x8c36('0x43')]);return db[_0x8c36('0x2a')]['find'](_0x31699c)[_0x8c36('0x25')](handleEntityNotFound(_0x3dde7b,null))[_0x8c36('0x25')](respondWithResult(_0x3dde7b,null))['catch'](handleError(_0x3dde7b,null));};exports['create']=function(_0x4edf8e,_0xb4ebae){return db[_0x8c36('0x2a')][_0x8c36('0x44')](_0x4edf8e[_0x8c36('0x45')],{})[_0x8c36('0x25')](function(_0x2778b3){var _0x4dd393=_0x4edf8e[_0x8c36('0x46')][_0x8c36('0x47')]({'plain':!![]});if(!_0x4dd393)throw new Error(_0x8c36('0x48'));if(_0x4dd393[_0x8c36('0x49')]==='user'){var _0x5e668d=_0x2778b3['get']({'plain':!![]});var _0x3887e4=_0x8c36('0x4a');return db[_0x8c36('0x4b')][_0x8c36('0x4c')]({'where':{'name':_0x3887e4,'userProfileId':_0x4dd393[_0x8c36('0x4d')]},'raw':!![]})[_0x8c36('0x25')](function(_0x43b5e2){if(_0x43b5e2&&_0x43b5e2[_0x8c36('0x4e')]===0x0){return db[_0x8c36('0x26')]['create']({'name':_0x5e668d['name'],'resourceId':_0x5e668d['id'],'type':_0x43b5e2[_0x8c36('0x28')],'sectionId':_0x43b5e2['id']},{})['then'](function(){return _0x2778b3;});}else{return _0x2778b3;}})['catch'](function(_0x9955bc){logger['error'](_0x8c36('0x4f'),_0x9955bc);throw _0x9955bc;});}return _0x2778b3;})[_0x8c36('0x25')](respondWithResult(_0xb4ebae,0xc9))['catch'](handleError(_0xb4ebae,null));};exports[_0x8c36('0x50')]=function(_0x5af860,_0x31fbde){if(_0x5af860[_0x8c36('0x45')]['id']){delete _0x5af860[_0x8c36('0x45')]['id'];}return db['VoiceChanSpy'][_0x8c36('0x4c')]({'where':{'id':_0x5af860[_0x8c36('0x40')]['id']}})[_0x8c36('0x25')](handleEntityNotFound(_0x31fbde,null))[_0x8c36('0x25')](saveUpdates(_0x5af860[_0x8c36('0x45')],null))[_0x8c36('0x25')](respondWithResult(_0x31fbde,null))[_0x8c36('0x3f')](handleError(_0x31fbde,null));};exports[_0x8c36('0x24')]=function(_0x20f1d9,_0x4cd57c){return db['VoiceChanSpy']['find']({'where':{'id':_0x20f1d9[_0x8c36('0x40')]['id']}})['then'](handleEntityNotFound(_0x4cd57c,null))['then'](removeEntity(_0x4cd57c,null))[_0x8c36('0x3f')](handleError(_0x4cd57c,null));}; \ No newline at end of file +var _0x33a4=['offset','undefined','count','limit','set','json','reject','save','update','then','get','ChanSpies','UserProfileResource','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x122386,_0x36ddc7){var _0x5c7a98=function(_0x35d38f){while(--_0x35d38f){_0x122386['push'](_0x122386['shift']());}};_0x5c7a98(++_0x36ddc7);}(_0x33a4,0x88));var _0x433a=function(_0x118229,_0xcff41b){_0x118229=_0x118229-0x0;var _0x1befc3=_0x33a4[_0x118229];return _0x1befc3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x433a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x433a('0x1'));var rp=require(_0x433a('0x2'));var moment=require(_0x433a('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x433a('0x4'));var sox=require(_0x433a('0x5'));var csv=require(_0x433a('0x6'));var ejs=require(_0x433a('0x7'));var fs=require('fs');var fs_extra=require(_0x433a('0x8'));var _=require('lodash');var squel=require(_0x433a('0x9'));var crypto=require('crypto');var jsforce=require(_0x433a('0xa'));var deskjs=require(_0x433a('0xb'));var toCsv=require(_0x433a('0x6'));var querystring=require(_0x433a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x433a('0xd'));var qs=require(_0x433a('0xe'));var as=require(_0x433a('0xf'));var hardwareService=require(_0x433a('0x10'));var logger=require(_0x433a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x433a('0x12'));var licenseUtil=require(_0x433a('0x13'));var db=require(_0x433a('0x14'))['db'];function respondWithStatusCode(_0xd9260c,_0x5edeaf){_0x5edeaf=_0x5edeaf||0xcc;return function(_0x2d064c){if(_0x2d064c){return _0xd9260c[_0x433a('0x15')](_0x5edeaf);}return _0xd9260c['status'](_0x5edeaf)[_0x433a('0x16')]();};}function respondWithResult(_0x524a57,_0x36d1a6){_0x36d1a6=_0x36d1a6||0xc8;return function(_0x1f6cee){if(_0x1f6cee){return _0x524a57[_0x433a('0x17')](_0x36d1a6)['json'](_0x1f6cee);}};}function respondWithFilteredResult(_0x4ba178,_0x14e3a7){return function(_0x24311f){if(_0x24311f){var _0x35ebaf=typeof _0x14e3a7[_0x433a('0x18')]===_0x433a('0x19')&&typeof _0x14e3a7['limit']==='undefined';var _0x2f6a70=_0x24311f[_0x433a('0x1a')];var _0x4254c4=_0x35ebaf?0x0:_0x14e3a7[_0x433a('0x18')];var _0x255e47=_0x35ebaf?_0x24311f[_0x433a('0x1a')]:_0x14e3a7[_0x433a('0x18')]+_0x14e3a7[_0x433a('0x1b')];var _0x382f45;if(_0x255e47>=_0x2f6a70){_0x255e47=_0x2f6a70;_0x382f45=0xc8;}else{_0x382f45=0xce;}_0x4ba178[_0x433a('0x17')](_0x382f45);return _0x4ba178[_0x433a('0x1c')]('Content-Range',_0x4254c4+'-'+_0x255e47+'/'+_0x2f6a70)[_0x433a('0x1d')](_0x24311f);}return null;};}function patchUpdates(_0x566ae7){return function(_0x2f16a8){try{jsonpatch['apply'](_0x2f16a8,_0x566ae7,!![]);}catch(_0x4fd99){return BPromise[_0x433a('0x1e')](_0x4fd99);}return _0x2f16a8[_0x433a('0x1f')]();};}function saveUpdates(_0xa2dfe5,_0x389b90){return function(_0x1501f2){if(_0x1501f2){return _0x1501f2[_0x433a('0x20')](_0xa2dfe5)['then'](function(_0x5b2ce0){return _0x5b2ce0;});}return null;};}function removeEntity(_0x2a5a13,_0x5a50ff){return function(_0x326785){if(_0x326785){return _0x326785['destroy']()[_0x433a('0x21')](function(){var _0x24ab09=_0x326785[_0x433a('0x22')]({'plain':!![]});var _0x3ef4ab=_0x433a('0x23');return db[_0x433a('0x24')]['destroy']({'where':{'type':_0x3ef4ab,'resourceId':_0x24ab09['id']}})[_0x433a('0x21')](function(){return _0x326785;});})[_0x433a('0x21')](function(){_0x2a5a13['status'](0xcc)[_0x433a('0x16')]();});}};}function handleEntityNotFound(_0x571461,_0x590b7e){return function(_0x5ec211){if(!_0x5ec211){_0x571461[_0x433a('0x15')](0x194);}return _0x5ec211;};}function handleError(_0x4fcecc,_0x1b0d85){_0x1b0d85=_0x1b0d85||0x1f4;return function(_0x499e8c){logger['error'](_0x499e8c[_0x433a('0x25')]);if(_0x499e8c[_0x433a('0x26')]){delete _0x499e8c[_0x433a('0x26')];}_0x4fcecc['status'](_0x1b0d85)[_0x433a('0x27')](_0x499e8c);};}exports[_0x433a('0x28')]=function(_0x469b41,_0x59bfb0){var _0x4c8d1d={},_0x713b41={},_0xd2f2fb={'count':0x0,'rows':[]};var _0x1b1ab2=_[_0x433a('0x29')](db[_0x433a('0x2a')][_0x433a('0x2b')],function(_0x1fd322){return{'name':_0x1fd322[_0x433a('0x2c')],'type':_0x1fd322['type'][_0x433a('0x2d')]};});_0x713b41[_0x433a('0x2e')]=_[_0x433a('0x29')](_0x1b1ab2,_0x433a('0x26'));_0x713b41[_0x433a('0x2f')]=_[_0x433a('0x30')](_0x469b41[_0x433a('0x2f')]);_0x713b41[_0x433a('0x31')]=_[_0x433a('0x32')](_0x713b41[_0x433a('0x2e')],_0x713b41[_0x433a('0x2f')]);_0x4c8d1d['attributes']=_[_0x433a('0x32')](_0x713b41[_0x433a('0x2e')],qs[_0x433a('0x33')](_0x469b41[_0x433a('0x2f')][_0x433a('0x33')]));_0x4c8d1d[_0x433a('0x34')]=_0x4c8d1d[_0x433a('0x34')][_0x433a('0x35')]?_0x4c8d1d[_0x433a('0x34')]:_0x713b41[_0x433a('0x2e')];if(!_0x469b41[_0x433a('0x2f')]['hasOwnProperty'](_0x433a('0x36'))){_0x4c8d1d[_0x433a('0x1b')]=qs['limit'](_0x469b41['query'][_0x433a('0x1b')]);_0x4c8d1d['offset']=qs[_0x433a('0x18')](_0x469b41[_0x433a('0x2f')][_0x433a('0x18')]);}_0x4c8d1d['order']=qs['sort'](_0x469b41[_0x433a('0x2f')][_0x433a('0x37')]);_0x4c8d1d[_0x433a('0x38')]=qs[_0x433a('0x31')](_[_0x433a('0x39')](_0x469b41[_0x433a('0x2f')],_0x713b41['filters']),_0x1b1ab2);if(_0x469b41['query'][_0x433a('0x3a')]){_0x4c8d1d[_0x433a('0x38')]=_['merge'](_0x4c8d1d[_0x433a('0x38')],{'$or':_[_0x433a('0x29')](_0x1b1ab2,function(_0x1024fb){if(_0x1024fb[_0x433a('0x3b')]!==_0x433a('0x3c')){var _0x3fc012={};_0x3fc012[_0x1024fb['name']]={'$like':'%'+_0x469b41[_0x433a('0x2f')][_0x433a('0x3a')]+'%'};return _0x3fc012;}})});}_0x4c8d1d=_[_0x433a('0x3d')]({},_0x4c8d1d,_0x469b41[_0x433a('0x3e')]);var _0x1f9689={'where':_0x4c8d1d[_0x433a('0x38')]};return db[_0x433a('0x2a')]['count'](_0x1f9689)['then'](function(_0x2e56d5){_0xd2f2fb[_0x433a('0x1a')]=_0x2e56d5;if(_0x469b41[_0x433a('0x2f')]['includeAll']){_0x4c8d1d[_0x433a('0x3f')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x433a('0x40')](_0x4c8d1d);})[_0x433a('0x21')](function(_0x18cc54){_0xd2f2fb[_0x433a('0x41')]=_0x18cc54;return _0xd2f2fb;})['then'](respondWithFilteredResult(_0x59bfb0,_0x4c8d1d))[_0x433a('0x42')](handleError(_0x59bfb0,null));};exports[_0x433a('0x43')]=function(_0x1297f6,_0x3e3441){var _0xa850dc={'raw':![],'where':{'id':_0x1297f6[_0x433a('0x44')]['id']}},_0x246b87={};_0x246b87['model']=_[_0x433a('0x30')](db[_0x433a('0x2a')][_0x433a('0x2b')]);_0x246b87[_0x433a('0x2f')]=_[_0x433a('0x30')](_0x1297f6[_0x433a('0x2f')]);_0x246b87[_0x433a('0x31')]=_[_0x433a('0x32')](_0x246b87[_0x433a('0x2e')],_0x246b87['query']);_0xa850dc[_0x433a('0x34')]=_[_0x433a('0x32')](_0x246b87[_0x433a('0x2e')],qs[_0x433a('0x33')](_0x1297f6['query'][_0x433a('0x33')]));_0xa850dc[_0x433a('0x34')]=_0xa850dc[_0x433a('0x34')][_0x433a('0x35')]?_0xa850dc['attributes']:_0x246b87['model'];if(_0x1297f6[_0x433a('0x2f')][_0x433a('0x45')]){_0xa850dc[_0x433a('0x3f')]=[{'all':!![]}];}_0xa850dc=_[_0x433a('0x3d')]({},_0xa850dc,_0x1297f6[_0x433a('0x3e')]);return db[_0x433a('0x2a')][_0x433a('0x46')](_0xa850dc)[_0x433a('0x21')](handleEntityNotFound(_0x3e3441,null))[_0x433a('0x21')](respondWithResult(_0x3e3441,null))[_0x433a('0x42')](handleError(_0x3e3441,null));};exports['create']=function(_0x4458e7,_0x9372ec){return db[_0x433a('0x2a')]['create'](_0x4458e7['body'],{})[_0x433a('0x21')](function(_0x1ba1fc){var _0x3777a5=_0x4458e7[_0x433a('0x47')][_0x433a('0x22')]({'plain':!![]});if(!_0x3777a5)throw new Error(_0x433a('0x48'));if(_0x3777a5['role']===_0x433a('0x47')){var _0x364460=_0x1ba1fc[_0x433a('0x22')]({'plain':!![]});var _0x244ac6=_0x433a('0x23');return db['UserProfileSection'][_0x433a('0x46')]({'where':{'name':_0x244ac6,'userProfileId':_0x3777a5[_0x433a('0x49')]},'raw':!![]})[_0x433a('0x21')](function(_0x24046c){if(_0x24046c&&_0x24046c[_0x433a('0x4a')]===0x0){return db['UserProfileResource'][_0x433a('0x4b')]({'name':_0x364460[_0x433a('0x26')],'resourceId':_0x364460['id'],'type':_0x24046c[_0x433a('0x26')],'sectionId':_0x24046c['id']},{})['then'](function(){return _0x1ba1fc;});}else{return _0x1ba1fc;}})[_0x433a('0x42')](function(_0x4b93b5){logger[_0x433a('0x4c')](_0x433a('0x4d'),_0x4b93b5);throw _0x4b93b5;});}return _0x1ba1fc;})['then'](respondWithResult(_0x9372ec,0xc9))['catch'](handleError(_0x9372ec,null));};exports[_0x433a('0x20')]=function(_0x2efeb7,_0x4246dc){if(_0x2efeb7[_0x433a('0x4e')]['id']){delete _0x2efeb7[_0x433a('0x4e')]['id'];}return db[_0x433a('0x2a')][_0x433a('0x46')]({'where':{'id':_0x2efeb7[_0x433a('0x44')]['id']}})['then'](handleEntityNotFound(_0x4246dc,null))[_0x433a('0x21')](saveUpdates(_0x2efeb7['body'],null))[_0x433a('0x21')](respondWithResult(_0x4246dc,null))[_0x433a('0x42')](handleError(_0x4246dc,null));};exports[_0x433a('0x4f')]=function(_0x500105,_0x171576){return db[_0x433a('0x2a')][_0x433a('0x46')]({'where':{'id':_0x500105[_0x433a('0x44')]['id']}})[_0x433a('0x21')](handleEntityNotFound(_0x171576,null))['then'](removeEntity(_0x171576,null))[_0x433a('0x42')](handleError(_0x171576,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 4e36468..2e06f13 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 _0x1d51=['catch','lodash','util','bluebird','from-sip','format','%s%s','prefix','system','push','merge','CDR(type)=%s','record','recordingFormat','Authenticate','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','agent','then','exports','define','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','destroy'];(function(_0x100576,_0x142f00){var _0xb44366=function(_0x29f758){while(--_0x29f758){_0x100576['push'](_0x100576['shift']());}};_0xb44366(++_0x142f00);}(_0x1d51,0x1cf));var _0x11d5=function(_0x386444,_0x485c59){_0x386444=_0x386444-0x0;var _0x31a4b6=_0x1d51[_0x386444];return _0x31a4b6;};'use strict';var _=require(_0x11d5('0x0'));var util=require(_0x11d5('0x1'));var BPromise=require(_0x11d5('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x39d27d,_0x3312bf,_0x4bb2a0){var _0x38f398=0x1;var _0x359466=[];var _0x5d0f26={'context':_0x3312bf['context']||_0x11d5('0x3'),'exten':util[_0x11d5('0x4')](_0x11d5('0x5'),_0x39d27d[_0x11d5('0x6')],_0x4bb2a0),'type':_0x11d5('0x7'),'isApp':![],'ChanSpyId':_0x39d27d['id'],'UserId':_0x3312bf['id']};_0x359466[_0x11d5('0x8')](_[_0x11d5('0x9')]({'app':'Set','appdata':util[_0x11d5('0x4')](_0x11d5('0xa'),'chanspy'),'priority':_0x38f398++},_0x5d0f26));if(_0x39d27d[_0x11d5('0xb')]){_0x359466[_0x11d5('0x8')](_[_0x11d5('0x9')]({'app':'MixMonitor','appdata':util[_0x11d5('0x4')]('${UNIQUEID}.%s,a',_0x39d27d[_0x11d5('0xc')]),'priority':_0x38f398++},_0x5d0f26));}if(_0x39d27d['auth']){_0x359466[_0x11d5('0x8')](_['merge']({'app':_0x11d5('0xd'),'appdata':_0x39d27d['password'],'priority':_0x38f398++},_0x5d0f26));}_0x359466['push'](_['merge']({'app':_0x11d5('0xe'),'appdata':util[_0x11d5('0x4')](_0x11d5('0xf'),_0x3312bf[_0x11d5('0x10')],_0x39d27d[_0x11d5('0x11')]?_0x39d27d[_0x11d5('0x11')][_0x11d5('0x12')](''):''),'priority':_0x38f398++},_0x5d0f26));if(_0x39d27d['record']){_0x359466['push'](_[_0x11d5('0x9')]({'app':_0x11d5('0x13'),'priority':_0x38f398++},_0x5d0f26));}return _0x359466;};var getChanSpyApplications=function(_0x53ac3b,_0x216b62){var _0x4c779f=[];for(var _0x21e2f9=0x0,_0x2f7cbf=0x1;_0x21e2f9<_0x216b62['length'];_0x21e2f9++,_0x2f7cbf=0x1){_0x4c779f=_0x4c779f[_0x11d5('0x14')](getUserApplications(_0x53ac3b,_0x216b62[_0x21e2f9],_0x216b62[_0x21e2f9][_0x11d5('0x15')]));if(_0x216b62[_0x21e2f9][_0x11d5('0x15')]!=_0x216b62[_0x21e2f9][_0x11d5('0x10')]){_0x4c779f=_0x4c779f[_0x11d5('0x14')](getUserApplications(_0x53ac3b,_0x216b62[_0x21e2f9],_0x216b62[_0x21e2f9][_0x11d5('0x10')]));}}return _0x4c779f;};var getChanSpyPromise=function(_0x2d9b8f,_0x24b766){return new BPromise(function(_0x37344a,_0x43732d){return _0x2d9b8f['User']['findAll']({'attributes':['id',_0x11d5('0x10'),_0x11d5('0x15')],'where':{'role':_0x11d5('0x16'),'chanspy':!![]},'raw':!![]})[_0x11d5('0x17')](function(_0x18306e){if(_0x18306e){return _0x37344a(getChanSpyApplications(_0x24b766,_0x18306e));}return _0x37344a([]);})['catch'](function(_0x3c9007){_0x43732d(_0x3c9007);});});};module[_0x11d5('0x18')]=function(_0x47c980,_0x16701b){var _0x46b38a=_0x47c980['models'];return _0x47c980[_0x11d5('0x19')](_0x11d5('0x1a'),attributes,{'tableName':_0x11d5('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x186806,_0x29acf2,_0x3f0f80){return getChanSpyPromise(_0x46b38a,_0x186806)[_0x11d5('0x17')](function(_0x5ce13c){if(_0x5ce13c&&_0x5ce13c[_0x11d5('0x1c')]){return _0x46b38a[_0x11d5('0x1d')][_0x11d5('0x1e')](_0x5ce13c);}})[_0x11d5('0x17')](function(){_0x3f0f80();})['catch'](function(_0x141b33){_0x3f0f80(_0x141b33);});},'afterUpdate':function(_0x4b9f88,_0x1df041,_0x108dd9){return _0x46b38a['VoiceExtension'][_0x11d5('0x1f')]({'where':{'ChanSpyId':_0x4b9f88['id']}})[_0x11d5('0x17')](function(){return getChanSpyPromise(_0x46b38a,_0x4b9f88);})['then'](function(_0x5d40c6){if(_0x5d40c6&&_0x5d40c6[_0x11d5('0x1c')]){return _0x46b38a[_0x11d5('0x1d')][_0x11d5('0x1e')](_0x5d40c6);}})[_0x11d5('0x17')](function(){_0x108dd9();})[_0x11d5('0x20')](function(_0x5f40e3){_0x108dd9(_0x5f40e3);});},'afterDestroy':function(_0x13abd9,_0xef0742,_0xda3b6){return _0x46b38a[_0x11d5('0x1d')][_0x11d5('0x1f')]({'where':{'ChanSpyId':_0x13abd9['id']}})[_0x11d5('0x17')](function(){_0xda3b6();})[_0x11d5('0x20')](function(_0xf18ed3){_0xda3b6(_0xf18ed3);});}}});}; \ No newline at end of file +var _0x2cdf=['context','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','record','StopMixMonitor','length','concat','User','findAll','agent','then','models','voice_chanspy','VoiceExtension','bulkCreate','destroy','catch','lodash','util','bluebird','./voiceChanSpy.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2cdf,0xd4));var _0xf2cd=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x2cdf[_0x39096d];return _0x13da4f;};'use strict';var _=require(_0xf2cd('0x0'));var util=require(_0xf2cd('0x1'));var BPromise=require(_0xf2cd('0x2'));var attributes=require(_0xf2cd('0x3'));var getUserApplications=function(_0x124cf3,_0x5959ea,_0x502aad){var _0x189f93=0x1;var _0x4d7b6c=[];var _0x2b4774={'context':_0x5959ea[_0xf2cd('0x4')]||_0xf2cd('0x5'),'exten':util[_0xf2cd('0x6')](_0xf2cd('0x7'),_0x124cf3[_0xf2cd('0x8')],_0x502aad),'type':_0xf2cd('0x9'),'isApp':![],'ChanSpyId':_0x124cf3['id'],'UserId':_0x5959ea['id']};_0x4d7b6c[_0xf2cd('0xa')](_[_0xf2cd('0xb')]({'app':_0xf2cd('0xc'),'appdata':util[_0xf2cd('0x6')](_0xf2cd('0xd'),'chanspy'),'priority':_0x189f93++},_0x2b4774));if(_0x124cf3['record']){_0x4d7b6c['push'](_[_0xf2cd('0xb')]({'app':'MixMonitor','appdata':util[_0xf2cd('0x6')](_0xf2cd('0xe'),_0x124cf3['recordingFormat']),'priority':_0x189f93++},_0x2b4774));}if(_0x124cf3[_0xf2cd('0xf')]){_0x4d7b6c['push'](_[_0xf2cd('0xb')]({'app':_0xf2cd('0x10'),'appdata':_0x124cf3[_0xf2cd('0x11')],'priority':_0x189f93++},_0x2b4774));}_0x4d7b6c[_0xf2cd('0xa')](_[_0xf2cd('0xb')]({'app':_0xf2cd('0x12'),'appdata':util[_0xf2cd('0x6')](_0xf2cd('0x13'),_0x5959ea[_0xf2cd('0x14')],_0x124cf3[_0xf2cd('0x15')]?_0x124cf3['options']['join'](''):''),'priority':_0x189f93++},_0x2b4774));if(_0x124cf3[_0xf2cd('0x16')]){_0x4d7b6c['push'](_[_0xf2cd('0xb')]({'app':_0xf2cd('0x17'),'priority':_0x189f93++},_0x2b4774));}return _0x4d7b6c;};var getChanSpyApplications=function(_0x3f98f9,_0x5e6afd){var _0x4d3a27=[];for(var _0x4af15e=0x0,_0x144c39=0x1;_0x4af15e<_0x5e6afd[_0xf2cd('0x18')];_0x4af15e++,_0x144c39=0x1){_0x4d3a27=_0x4d3a27[_0xf2cd('0x19')](getUserApplications(_0x3f98f9,_0x5e6afd[_0x4af15e],_0x5e6afd[_0x4af15e]['internal']));if(_0x5e6afd[_0x4af15e]['internal']!=_0x5e6afd[_0x4af15e][_0xf2cd('0x14')]){_0x4d3a27=_0x4d3a27[_0xf2cd('0x19')](getUserApplications(_0x3f98f9,_0x5e6afd[_0x4af15e],_0x5e6afd[_0x4af15e][_0xf2cd('0x14')]));}}return _0x4d3a27;};var getChanSpyPromise=function(_0x56d290,_0x320c6c){return new BPromise(function(_0x52de1f,_0x2a9266){return _0x56d290[_0xf2cd('0x1a')][_0xf2cd('0x1b')]({'attributes':['id',_0xf2cd('0x14'),'internal'],'where':{'role':_0xf2cd('0x1c'),'chanspy':!![]},'raw':!![]})[_0xf2cd('0x1d')](function(_0x16b3e1){if(_0x16b3e1){return _0x52de1f(getChanSpyApplications(_0x320c6c,_0x16b3e1));}return _0x52de1f([]);})['catch'](function(_0x14e3d4){_0x2a9266(_0x14e3d4);});});};module['exports']=function(_0x4b8d3d,_0x529816){var _0xd48314=_0x4b8d3d[_0xf2cd('0x1e')];return _0x4b8d3d['define']('VoiceChanSpy',attributes,{'tableName':_0xf2cd('0x1f'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x171a75,_0x7da0d0,_0x2f4bef){return getChanSpyPromise(_0xd48314,_0x171a75)[_0xf2cd('0x1d')](function(_0x48e8c9){if(_0x48e8c9&&_0x48e8c9[_0xf2cd('0x18')]){return _0xd48314[_0xf2cd('0x20')][_0xf2cd('0x21')](_0x48e8c9);}})[_0xf2cd('0x1d')](function(){_0x2f4bef();})['catch'](function(_0x25ccb1){_0x2f4bef(_0x25ccb1);});},'afterUpdate':function(_0x530aa0,_0x47c771,_0x248532){return _0xd48314[_0xf2cd('0x20')][_0xf2cd('0x22')]({'where':{'ChanSpyId':_0x530aa0['id']}})[_0xf2cd('0x1d')](function(){return getChanSpyPromise(_0xd48314,_0x530aa0);})[_0xf2cd('0x1d')](function(_0x387ea4){if(_0x387ea4&&_0x387ea4[_0xf2cd('0x18')]){return _0xd48314[_0xf2cd('0x20')][_0xf2cd('0x21')](_0x387ea4);}})[_0xf2cd('0x1d')](function(){_0x248532();})[_0xf2cd('0x23')](function(_0x272fbd){_0x248532(_0x272fbd);});},'afterDestroy':function(_0x598c6c,_0x430ae8,_0xc492fa){return _0xd48314[_0xf2cd('0x20')][_0xf2cd('0x22')]({'where':{'ChanSpyId':_0x598c6c['id']}})[_0xf2cd('0x1d')](function(){_0xc492fa();})[_0xf2cd('0x23')](function(_0x5dd6f5){_0xc492fa(_0x5dd6f5);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7385c5d..9cc85b5 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 _0xa9e0=['http','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\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(_0x48487b,_0x199e89){var _0x5a7c0d=function(_0x28b3da){while(--_0x28b3da){_0x48487b['push'](_0x48487b['shift']());}};_0x5a7c0d(++_0x199e89);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 _0x00b3=['util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x3d7b08,_0x3ba5fe){var _0x10a819=function(_0x2ed46a){while(--_0x2ed46a){_0x3d7b08['push'](_0x3d7b08['shift']());}};_0x10a819(++_0x3ba5fe);}(_0x00b3,0x17a));var _0x300b=function(_0x384c67,_0x5ccc4b){_0x384c67=_0x384c67-0x0;var _0x5e0d43=_0x00b3[_0x384c67];return _0x5e0d43;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5af470,_0x5dabb9,_0x30b3fe){return new BPromise(function(_0x590c4d,_0x5e283c){return client[_0x300b('0xa')](_0x5af470,_0x30b3fe)[_0x300b('0xb')](function(_0x457aa3){logger['info'](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));logger[_0x300b('0xe')](_0x300b('0xf'),_0x5dabb9,'request\x20sent',JSON[_0x300b('0x10')](_0x457aa3));if(_0x457aa3[_0x300b('0x11')]){if(_0x457aa3[_0x300b('0x11')]['code']===0x1f4){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);return _0x5e283c(_0x457aa3[_0x300b('0x11')][_0x300b('0x12')]);}logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x457aa3['error']['message']);return _0x590c4d(_0x457aa3['error']['message']);}else{logger[_0x300b('0x13')](_0x300b('0xc'),_0x5dabb9,_0x300b('0xd'));_0x590c4d(_0x457aa3[_0x300b('0x14')]['message']);}})['catch'](function(_0x35b1d7){logger[_0x300b('0x11')](_0x300b('0xc'),_0x5dabb9,_0x35b1d7);_0x5e283c(_0x35b1d7);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 679062f..c0ebdc3 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 _0x49e4=['post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x49e4,0xde));var _0x449e=function(_0x19d6e3,_0x5c8e34){_0x19d6e3=_0x19d6e3-0x0;var _0x1d31ca=_0x49e4[_0x19d6e3];return _0x1d31ca;};'use strict';var multer=require(_0x449e('0x0'));var util=require(_0x449e('0x1'));var path=require(_0x449e('0x2'));var timeout=require('connect-timeout');var express=require(_0x449e('0x3'));var router=express[_0x449e('0x4')]();var fs_extra=require(_0x449e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x449e('0x6'));var config=require(_0x449e('0x7'));var controller=require('./voiceContext.controller');router[_0x449e('0x8')]('/',auth[_0x449e('0x9')](),controller['index']);router[_0x449e('0x8')](_0x449e('0xa'),auth[_0x449e('0x9')](),controller[_0x449e('0xb')]);router[_0x449e('0xc')]('/',auth['isAuthenticated'](),controller[_0x449e('0xd')]);router[_0x449e('0xe')](_0x449e('0xa'),auth[_0x449e('0x9')](),controller[_0x449e('0xf')]);router[_0x449e('0x10')](_0x449e('0xa'),auth[_0x449e('0x9')](),controller['destroy']);module[_0x449e('0x11')]=router; \ No newline at end of file +var _0x1350=['isAuthenticated','show','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x1350,0x126));var _0x0135=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1350[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0135('0x0'));var path=require(_0x0135('0x1'));var timeout=require(_0x0135('0x2'));var express=require(_0x0135('0x3'));var router=express[_0x0135('0x4')]();var fs_extra=require(_0x0135('0x5'));var auth=require(_0x0135('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0135('0x7'));var controller=require('./voiceContext.controller');router[_0x0135('0x8')]('/',auth['isAuthenticated'](),controller[_0x0135('0x9')]);router['get']('/:id',auth[_0x0135('0xa')](),controller[_0x0135('0xb')]);router['post']('/',auth[_0x0135('0xa')](),controller[_0x0135('0xc')]);router[_0x0135('0xd')](_0x0135('0xe'),auth[_0x0135('0xa')](),controller[_0x0135('0xf')]);router[_0x0135('0x10')](_0x0135('0xe'),auth[_0x0135('0xa')](),controller[_0x0135('0x11')]);module[_0x0135('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 2de2e5b..c950153 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 _0xc162=['BOOLEAN','sequelize','exports','STRING'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xc162,0xa1));var _0x2c16=function(_0x41385c,_0x1cba4f){_0x41385c=_0x41385c-0x0;var _0x188956=_0xc162[_0x41385c];return _0x188956;};'use strict';var Sequelize=require(_0x2c16('0x0'));module[_0x2c16('0x1')]={'name':{'type':Sequelize[_0x2c16('0x2')],'unique':'name'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x2c16('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7847=['exports','STRING','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x7847,0x1a3));var _0x7784=function(_0x11a422,_0x5907a5){_0x11a422=_0x11a422-0x0;var _0x547177=_0x7847[_0x11a422];return _0x547177;};'use strict';var Sequelize=require(_0x7784('0x0'));module[_0x7784('0x1')]={'name':{'type':Sequelize[_0x7784('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x7784('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 65c896d..bdd0aea 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 _0x1dc1=['where','options','includeAll','include','findAll','show','rawAttributes','merge','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','UserProfileResource','name','send','index','map','VoiceContext','fieldName','type','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x1dc1,0xe5));var _0x11dc=function(_0x3fdaec,_0x17c64d){_0x3fdaec=_0x3fdaec-0x0;var _0x2e3cb3=_0x1dc1[_0x3fdaec];return _0x2e3cb3;};'use strict';var emlformat=require(_0x11dc('0x0'));var rimraf=require(_0x11dc('0x1'));var zipdir=require(_0x11dc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x11dc('0x3'));var moment=require(_0x11dc('0x4'));var BPromise=require(_0x11dc('0x5'));var Mustache=require(_0x11dc('0x6'));var util=require(_0x11dc('0x7'));var path=require(_0x11dc('0x8'));var sox=require(_0x11dc('0x9'));var csv=require(_0x11dc('0xa'));var ejs=require(_0x11dc('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11dc('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x11dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x11dc('0xa'));var querystring=require(_0x11dc('0xe'));var Papa=require(_0x11dc('0xf'));var Redis=require(_0x11dc('0x10'));var authService=require(_0x11dc('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x11dc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11dc('0x13'))(_0x11dc('0x14'));var utils=require(_0x11dc('0x15'));var config=require(_0x11dc('0x16'));var licenseUtil=require(_0x11dc('0x17'));var db=require(_0x11dc('0x18'))['db'];var jayson=require(_0x11dc('0x19'));var client=jayson[_0x11dc('0x1a')][_0x11dc('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x5ec7f4,_0x46a20f,_0x8d17c0,_0x10b427){return new BPromise(function(_0x368470,_0x1e1e0b){var _0x145b66=_0x10b427||client;return _0x145b66[_0x11dc('0x1c')](_0x5ec7f4,_0x8d17c0)[_0x11dc('0x1d')](function(_0x5edeb8){logger[_0x11dc('0x1e')](_0x11dc('0x1f'),_0x46a20f,_0x11dc('0x20'));logger['debug'](_0x11dc('0x21'),_0x46a20f,_0x11dc('0x20'),JSON[_0x11dc('0x22')](_0x5edeb8));if(_0x5edeb8[_0x11dc('0x23')]){if(_0x5edeb8['error']['code']===0x1f4){logger['error'](_0x11dc('0x1f'),_0x46a20f,_0x5edeb8['error'][_0x11dc('0x24')]);return _0x1e1e0b(_0x5edeb8[_0x11dc('0x23')][_0x11dc('0x24')]);}logger['error'](_0x11dc('0x1f'),_0x46a20f,_0x5edeb8[_0x11dc('0x23')][_0x11dc('0x24')]);return _0x368470(_0x5edeb8[_0x11dc('0x23')][_0x11dc('0x24')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x46a20f,'request\x20sent');_0x368470(_0x5edeb8['result'][_0x11dc('0x24')]);}})[_0x11dc('0x25')](function(_0x4a1493){logger[_0x11dc('0x23')](_0x11dc('0x1f'),_0x46a20f,_0x4a1493);_0x1e1e0b(_0x4a1493);});});}function respondWithStatusCode(_0x312677,_0x1f9570){_0x1f9570=_0x1f9570||0xcc;return function(_0x4a9874){if(_0x4a9874){return _0x312677[_0x11dc('0x26')](_0x1f9570);}return _0x312677[_0x11dc('0x27')](_0x1f9570)[_0x11dc('0x28')]();};}function respondWithResult(_0x5124dc,_0x39630f){_0x39630f=_0x39630f||0xc8;return function(_0x5a35e5){if(_0x5a35e5){return _0x5124dc[_0x11dc('0x27')](_0x39630f)[_0x11dc('0x29')](_0x5a35e5);}};}function respondWithFilteredResult(_0x41bfca,_0x49bcc0){return function(_0x27bd74){if(_0x27bd74){var _0x40d192=typeof _0x49bcc0[_0x11dc('0x2a')]===_0x11dc('0x2b')&&typeof _0x49bcc0[_0x11dc('0x2c')]===_0x11dc('0x2b');var _0x2284c6=_0x27bd74['count'];var _0x172b43=_0x40d192?0x0:_0x49bcc0['offset'];var _0x4ee65d=_0x40d192?_0x27bd74[_0x11dc('0x2d')]:_0x49bcc0[_0x11dc('0x2a')]+_0x49bcc0[_0x11dc('0x2c')];var _0x2b43c6;if(_0x4ee65d>=_0x2284c6){_0x4ee65d=_0x2284c6;_0x2b43c6=0xc8;}else{_0x2b43c6=0xce;}_0x41bfca[_0x11dc('0x27')](_0x2b43c6);return _0x41bfca[_0x11dc('0x2e')](_0x11dc('0x2f'),_0x172b43+'-'+_0x4ee65d+'/'+_0x2284c6)[_0x11dc('0x29')](_0x27bd74);}return null;};}function patchUpdates(_0x4bc37c){return function(_0x7b74bf){try{jsonpatch['apply'](_0x7b74bf,_0x4bc37c,!![]);}catch(_0x1bf016){return BPromise[_0x11dc('0x30')](_0x1bf016);}return _0x7b74bf[_0x11dc('0x31')]();};}function saveUpdates(_0x294819,_0xa0f6f8){return function(_0x35283a){if(_0x35283a){return _0x35283a['update'](_0x294819)[_0x11dc('0x1d')](function(_0x1d7242){return _0x1d7242;});}return null;};}function removeEntity(_0x6cff2d,_0x3ace28){return function(_0x3ecaa2){if(_0x3ecaa2){return _0x3ecaa2[_0x11dc('0x32')]()[_0x11dc('0x1d')](function(){var _0xcae523=_0x3ecaa2[_0x11dc('0x33')]({'plain':!![]});var _0x1773d1='Contexts';return db[_0x11dc('0x34')][_0x11dc('0x32')]({'where':{'type':_0x1773d1,'resourceId':_0xcae523['id']}})[_0x11dc('0x1d')](function(){return _0x3ecaa2;});})[_0x11dc('0x1d')](function(){_0x6cff2d[_0x11dc('0x27')](0xcc)[_0x11dc('0x28')]();});}};}function handleEntityNotFound(_0x2dd461,_0x42d7f6){return function(_0x55a9ab){if(!_0x55a9ab){_0x2dd461[_0x11dc('0x26')](0x194);}return _0x55a9ab;};}function handleError(_0x1fab53,_0xa9a9d4){_0xa9a9d4=_0xa9a9d4||0x1f4;return function(_0x51fc3e){logger[_0x11dc('0x23')](_0x51fc3e['stack']);if(_0x51fc3e[_0x11dc('0x35')]){delete _0x51fc3e[_0x11dc('0x35')];}_0x1fab53[_0x11dc('0x27')](_0xa9a9d4)[_0x11dc('0x36')](_0x51fc3e);};}exports[_0x11dc('0x37')]=function(_0x3abd51,_0x512e7f){var _0x5aae23={},_0x1839f3={},_0x2daa1f={'count':0x0,'rows':[]};var _0xebce1=_[_0x11dc('0x38')](db[_0x11dc('0x39')]['rawAttributes'],function(_0xcc0f06){return{'name':_0xcc0f06[_0x11dc('0x3a')],'type':_0xcc0f06[_0x11dc('0x3b')]['key']};});_0x1839f3['model']=_[_0x11dc('0x38')](_0xebce1,_0x11dc('0x35'));_0x1839f3['query']=_[_0x11dc('0x3c')](_0x3abd51['query']);_0x1839f3['filters']=_[_0x11dc('0x3d')](_0x1839f3[_0x11dc('0x3e')],_0x1839f3[_0x11dc('0x3f')]);_0x5aae23[_0x11dc('0x40')]=_[_0x11dc('0x3d')](_0x1839f3[_0x11dc('0x3e')],qs[_0x11dc('0x41')](_0x3abd51[_0x11dc('0x3f')]['fields']));_0x5aae23[_0x11dc('0x40')]=_0x5aae23[_0x11dc('0x40')][_0x11dc('0x42')]?_0x5aae23[_0x11dc('0x40')]:_0x1839f3[_0x11dc('0x3e')];if(!_0x3abd51['query'][_0x11dc('0x43')](_0x11dc('0x44'))){_0x5aae23[_0x11dc('0x2c')]=qs[_0x11dc('0x2c')](_0x3abd51[_0x11dc('0x3f')][_0x11dc('0x2c')]);_0x5aae23[_0x11dc('0x2a')]=qs[_0x11dc('0x2a')](_0x3abd51[_0x11dc('0x3f')][_0x11dc('0x2a')]);}_0x5aae23[_0x11dc('0x45')]=qs[_0x11dc('0x46')](_0x3abd51[_0x11dc('0x3f')][_0x11dc('0x46')]);_0x5aae23['where']=qs[_0x11dc('0x47')](_[_0x11dc('0x48')](_0x3abd51['query'],_0x1839f3[_0x11dc('0x47')]),_0xebce1);if(_0x3abd51[_0x11dc('0x3f')][_0x11dc('0x49')]){_0x5aae23[_0x11dc('0x4a')]=_['merge'](_0x5aae23[_0x11dc('0x4a')],{'$or':_[_0x11dc('0x38')](_0xebce1,function(_0x39ce7b){if(_0x39ce7b[_0x11dc('0x3b')]!=='VIRTUAL'){var _0x4af9b6={};_0x4af9b6[_0x39ce7b[_0x11dc('0x35')]]={'$like':'%'+_0x3abd51[_0x11dc('0x3f')]['filter']+'%'};return _0x4af9b6;}})});}_0x5aae23=_['merge']({},_0x5aae23,_0x3abd51[_0x11dc('0x4b')]);var _0x66d235={'where':_0x5aae23[_0x11dc('0x4a')]};return db[_0x11dc('0x39')]['count'](_0x66d235)['then'](function(_0xf97c29){_0x2daa1f[_0x11dc('0x2d')]=_0xf97c29;if(_0x3abd51['query'][_0x11dc('0x4c')]){_0x5aae23[_0x11dc('0x4d')]=[{'all':!![]}];}return db[_0x11dc('0x39')][_0x11dc('0x4e')](_0x5aae23);})[_0x11dc('0x1d')](function(_0x32c856){_0x2daa1f['rows']=_0x32c856;return _0x2daa1f;})[_0x11dc('0x1d')](respondWithFilteredResult(_0x512e7f,_0x5aae23))[_0x11dc('0x25')](handleError(_0x512e7f,null));};exports[_0x11dc('0x4f')]=function(_0x3e2c89,_0x43cce8){var _0x30fffa={'raw':![],'where':{'id':_0x3e2c89['params']['id']}},_0x5159fb={};_0x5159fb[_0x11dc('0x3e')]=_[_0x11dc('0x3c')](db[_0x11dc('0x39')][_0x11dc('0x50')]);_0x5159fb[_0x11dc('0x3f')]=_['keys'](_0x3e2c89[_0x11dc('0x3f')]);_0x5159fb['filters']=_['intersection'](_0x5159fb['model'],_0x5159fb['query']);_0x30fffa[_0x11dc('0x40')]=_['intersection'](_0x5159fb[_0x11dc('0x3e')],qs['fields'](_0x3e2c89[_0x11dc('0x3f')][_0x11dc('0x41')]));_0x30fffa[_0x11dc('0x40')]=_0x30fffa[_0x11dc('0x40')]['length']?_0x30fffa[_0x11dc('0x40')]:_0x5159fb[_0x11dc('0x3e')];if(_0x3e2c89[_0x11dc('0x3f')]['includeAll']){_0x30fffa[_0x11dc('0x4d')]=[{'all':!![]}];}_0x30fffa=_[_0x11dc('0x51')]({},_0x30fffa,_0x3e2c89[_0x11dc('0x4b')]);return db[_0x11dc('0x39')][_0x11dc('0x52')](_0x30fffa)['then'](handleEntityNotFound(_0x43cce8,null))[_0x11dc('0x1d')](respondWithResult(_0x43cce8,null))[_0x11dc('0x25')](handleError(_0x43cce8,null));};exports['create']=function(_0x4f87ae,_0x55f67f,_0xf7d446){var _0x88d55a;return db[_0x11dc('0x39')][_0x11dc('0x53')](_0x4f87ae['body'],{'raw':!![]})['then'](function(_0x51dd02){_0x88d55a=_0x51dd02;return db[_0x11dc('0x39')]['findAll']({'raw':!![]});})[_0x11dc('0x1d')](function(_0x1f4f91){var _0x3f73cf=fs[_0x11dc('0x54')](path[_0x11dc('0x55')](config[_0x11dc('0x56')],_0x11dc('0x57')),_0x11dc('0x58'));var _0xc9ee2f=ejs[_0x11dc('0x59')](_0x3f73cf,{'contexts':_0x1f4f91||[]});fs[_0x11dc('0x5a')](_0x11dc('0x5b'),_0xc9ee2f);})['then'](function(){return respondWithRpcPromise(_0x11dc('0x5c'),_0x11dc('0x53'),{'module':_0x11dc('0x5d')});})[_0x11dc('0x1d')](function(){var _0x2bd7bb=_0x4f87ae['user'][_0x11dc('0x33')]({'plain':!![]});if(!_0x2bd7bb)throw new Error(_0x11dc('0x5e'));if(_0x2bd7bb[_0x11dc('0x5f')]===_0x11dc('0x60')){var _0x5423cb=_0x88d55a['get']({'plain':!![]});return db['UserProfileSection'][_0x11dc('0x52')]({'where':{'name':'Contexts','userProfileId':_0x2bd7bb['userProfileId']},'raw':!![]})[_0x11dc('0x1d')](function(_0x33a97a){if(_0x33a97a&&_0x33a97a[_0x11dc('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x5423cb[_0x11dc('0x35')],'resourceId':_0x5423cb['id'],'type':_0x33a97a['name'],'sectionId':_0x33a97a['id']},{})['then'](function(){return _0x88d55a;});}else{return _0x88d55a;}})[_0x11dc('0x25')](function(_0x470e28){logger[_0x11dc('0x23')](_0x11dc('0x62'),_0x470e28);throw _0x470e28;});}return _0x88d55a;})['then'](respondWithResult(_0x55f67f,0xc9))[_0x11dc('0x25')](handleError(_0x55f67f,null));};exports[_0x11dc('0x63')]=function(_0x53e4fe,_0x448e21,_0x2fa644){var _0x1655d4;return db[_0x11dc('0x39')][_0x11dc('0x52')]({'where':{'id':_0x53e4fe[_0x11dc('0x64')]['id']}})[_0x11dc('0x1d')](handleEntityNotFound(_0x448e21,null))[_0x11dc('0x1d')](saveUpdates(_0x53e4fe['body'],null))[_0x11dc('0x1d')](function(_0x3243b6){if(_0x3243b6){_0x1655d4=_0x3243b6;return db['VoiceContext'][_0x11dc('0x4e')]({'raw':!![]});}})['then'](function(_0x71b57b){var _0x2cd9b5=fs[_0x11dc('0x54')](path[_0x11dc('0x55')](config['root'],'server/files/templates/context.ejs'),_0x11dc('0x58'));var _0xe8eae0=ejs[_0x11dc('0x59')](_0x2cd9b5,{'contexts':_0x71b57b||[]});fs[_0x11dc('0x5a')](_0x11dc('0x5b'),_0xe8eae0);})[_0x11dc('0x1d')](function(){return respondWithRpcPromise(_0x11dc('0x5c'),'update',{'module':'chan_sip.so'});})[_0x11dc('0x1d')](function(){return _0x1655d4;})['then'](respondWithResult(_0x448e21,null))['catch'](handleError(_0x448e21,null));};exports[_0x11dc('0x32')]=function(_0x3c0384,_0x4c5089,_0x5733f1){var _0x7ab070;return db[_0x11dc('0x39')][_0x11dc('0x52')]({'where':{'id':_0x3c0384[_0x11dc('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c5089,null))['then'](removeEntity(_0x4c5089,null))[_0x11dc('0x1d')](function(){return db[_0x11dc('0x39')][_0x11dc('0x4e')]({'raw':!![]});})[_0x11dc('0x1d')](function(_0x28ed02){var _0x16db27=fs['readFileSync'](path[_0x11dc('0x55')](config[_0x11dc('0x56')],_0x11dc('0x57')),_0x11dc('0x58'));var _0x2bbb9c=ejs['render'](_0x16db27,{'contexts':_0x28ed02});fs[_0x11dc('0x5a')](_0x11dc('0x5b'),_0x2bbb9c);return respondWithRpcPromise('Reload',_0x11dc('0x32'),{'module':_0x11dc('0x5d')});})['catch'](handleError(_0x4c5089,null));}; \ No newline at end of file +var _0xa8d9=['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','count','limit','Content-Range','apply','reject','save','update','destroy','get','Contexts','UserProfileResource','stack','name','index','map','VoiceContext','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','show','rawAttributes','includeAll','find','create','findAll','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','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0xa8d9,0xb0));var _0x9a8d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa8d9[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a8d('0x0'));var zipdir=require(_0x9a8d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a8d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x9a8d('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a8d('0x4'));var ejs=require(_0x9a8d('0x5'));var fs=require('fs');var fs_extra=require(_0x9a8d('0x6'));var _=require(_0x9a8d('0x7'));var squel=require(_0x9a8d('0x8'));var crypto=require(_0x9a8d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x9a8d('0xa'));var toCsv=require(_0x9a8d('0x4'));var querystring=require(_0x9a8d('0xb'));var Papa=require(_0x9a8d('0xc'));var Redis=require(_0x9a8d('0xd'));var authService=require(_0x9a8d('0xe'));var qs=require(_0x9a8d('0xf'));var as=require(_0x9a8d('0x10'));var hardwareService=require(_0x9a8d('0x11'));var logger=require(_0x9a8d('0x12'))(_0x9a8d('0x13'));var utils=require(_0x9a8d('0x14'));var config=require(_0x9a8d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a8d('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9a8d('0x17')][_0x9a8d('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x58d7bc,_0x11ccb0,_0x36ab9b,_0x156ada){return new BPromise(function(_0x3c6e22,_0x5d4c52){var _0x2dc875=_0x156ada||client;return _0x2dc875[_0x9a8d('0x19')](_0x58d7bc,_0x36ab9b)[_0x9a8d('0x1a')](function(_0x22efce){logger[_0x9a8d('0x1b')](_0x9a8d('0x1c'),_0x11ccb0,_0x9a8d('0x1d'));logger[_0x9a8d('0x1e')](_0x9a8d('0x1f'),_0x11ccb0,_0x9a8d('0x1d'),JSON[_0x9a8d('0x20')](_0x22efce));if(_0x22efce[_0x9a8d('0x21')]){if(_0x22efce[_0x9a8d('0x21')][_0x9a8d('0x22')]===0x1f4){logger[_0x9a8d('0x21')](_0x9a8d('0x1c'),_0x11ccb0,_0x22efce[_0x9a8d('0x21')]['message']);return _0x5d4c52(_0x22efce['error'][_0x9a8d('0x23')]);}logger[_0x9a8d('0x21')](_0x9a8d('0x1c'),_0x11ccb0,_0x22efce[_0x9a8d('0x21')][_0x9a8d('0x23')]);return _0x3c6e22(_0x22efce[_0x9a8d('0x21')]['message']);}else{logger[_0x9a8d('0x1b')]('VoiceContext,\x20%s,\x20%s',_0x11ccb0,_0x9a8d('0x1d'));_0x3c6e22(_0x22efce[_0x9a8d('0x24')]['message']);}})[_0x9a8d('0x25')](function(_0x28e964){logger[_0x9a8d('0x21')](_0x9a8d('0x1c'),_0x11ccb0,_0x28e964);_0x5d4c52(_0x28e964);});});}function respondWithStatusCode(_0x59465a,_0x148d49){_0x148d49=_0x148d49||0xcc;return function(_0x422ee7){if(_0x422ee7){return _0x59465a[_0x9a8d('0x26')](_0x148d49);}return _0x59465a[_0x9a8d('0x27')](_0x148d49)[_0x9a8d('0x28')]();};}function respondWithResult(_0x5e4e00,_0x31e403){_0x31e403=_0x31e403||0xc8;return function(_0x3f4f44){if(_0x3f4f44){return _0x5e4e00['status'](_0x31e403)[_0x9a8d('0x29')](_0x3f4f44);}};}function respondWithFilteredResult(_0x56aae2,_0x37645e){return function(_0x597088){if(_0x597088){var _0x2ed1aa=typeof _0x37645e[_0x9a8d('0x2a')]==='undefined'&&typeof _0x37645e['limit']==='undefined';var _0x5e315b=_0x597088['count'];var _0x1973cd=_0x2ed1aa?0x0:_0x37645e[_0x9a8d('0x2a')];var _0x3c7830=_0x2ed1aa?_0x597088[_0x9a8d('0x2b')]:_0x37645e[_0x9a8d('0x2a')]+_0x37645e[_0x9a8d('0x2c')];var _0x122c00;if(_0x3c7830>=_0x5e315b){_0x3c7830=_0x5e315b;_0x122c00=0xc8;}else{_0x122c00=0xce;}_0x56aae2[_0x9a8d('0x27')](_0x122c00);return _0x56aae2['set'](_0x9a8d('0x2d'),_0x1973cd+'-'+_0x3c7830+'/'+_0x5e315b)['json'](_0x597088);}return null;};}function patchUpdates(_0x1c4f58){return function(_0x2795a4){try{jsonpatch[_0x9a8d('0x2e')](_0x2795a4,_0x1c4f58,!![]);}catch(_0x4c0e9c){return BPromise[_0x9a8d('0x2f')](_0x4c0e9c);}return _0x2795a4[_0x9a8d('0x30')]();};}function saveUpdates(_0x221799,_0xbb2f76){return function(_0x3b1fd5){if(_0x3b1fd5){return _0x3b1fd5[_0x9a8d('0x31')](_0x221799)[_0x9a8d('0x1a')](function(_0xdba7ec){return _0xdba7ec;});}return null;};}function removeEntity(_0x73f786,_0x10eef2){return function(_0x233096){if(_0x233096){return _0x233096[_0x9a8d('0x32')]()[_0x9a8d('0x1a')](function(){var _0x589e1b=_0x233096[_0x9a8d('0x33')]({'plain':!![]});var _0x5e7265=_0x9a8d('0x34');return db[_0x9a8d('0x35')][_0x9a8d('0x32')]({'where':{'type':_0x5e7265,'resourceId':_0x589e1b['id']}})['then'](function(){return _0x233096;});})[_0x9a8d('0x1a')](function(){_0x73f786[_0x9a8d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f4d1e,_0x21eee5){return function(_0x2b8e67){if(!_0x2b8e67){_0x3f4d1e[_0x9a8d('0x26')](0x194);}return _0x2b8e67;};}function handleError(_0x55f34c,_0x4750c7){_0x4750c7=_0x4750c7||0x1f4;return function(_0xa83847){logger[_0x9a8d('0x21')](_0xa83847[_0x9a8d('0x36')]);if(_0xa83847[_0x9a8d('0x37')]){delete _0xa83847['name'];}_0x55f34c[_0x9a8d('0x27')](_0x4750c7)['send'](_0xa83847);};}exports[_0x9a8d('0x38')]=function(_0x36d38f,_0x287be8){var _0x46b7b2={},_0x4fcb59={},_0xa1674f={'count':0x0,'rows':[]};var _0x564706=_[_0x9a8d('0x39')](db[_0x9a8d('0x3a')]['rawAttributes'],function(_0x5af7bf){return{'name':_0x5af7bf[_0x9a8d('0x3b')],'type':_0x5af7bf[_0x9a8d('0x3c')][_0x9a8d('0x3d')]};});_0x4fcb59[_0x9a8d('0x3e')]=_['map'](_0x564706,_0x9a8d('0x37'));_0x4fcb59['query']=_['keys'](_0x36d38f[_0x9a8d('0x3f')]);_0x4fcb59[_0x9a8d('0x40')]=_[_0x9a8d('0x41')](_0x4fcb59[_0x9a8d('0x3e')],_0x4fcb59['query']);_0x46b7b2['attributes']=_[_0x9a8d('0x41')](_0x4fcb59[_0x9a8d('0x3e')],qs[_0x9a8d('0x42')](_0x36d38f[_0x9a8d('0x3f')][_0x9a8d('0x42')]));_0x46b7b2[_0x9a8d('0x43')]=_0x46b7b2[_0x9a8d('0x43')][_0x9a8d('0x44')]?_0x46b7b2[_0x9a8d('0x43')]:_0x4fcb59[_0x9a8d('0x3e')];if(!_0x36d38f['query'][_0x9a8d('0x45')](_0x9a8d('0x46'))){_0x46b7b2[_0x9a8d('0x2c')]=qs[_0x9a8d('0x2c')](_0x36d38f[_0x9a8d('0x3f')]['limit']);_0x46b7b2['offset']=qs[_0x9a8d('0x2a')](_0x36d38f[_0x9a8d('0x3f')][_0x9a8d('0x2a')]);}_0x46b7b2[_0x9a8d('0x47')]=qs[_0x9a8d('0x48')](_0x36d38f[_0x9a8d('0x3f')][_0x9a8d('0x48')]);_0x46b7b2['where']=qs[_0x9a8d('0x40')](_[_0x9a8d('0x49')](_0x36d38f[_0x9a8d('0x3f')],_0x4fcb59['filters']),_0x564706);if(_0x36d38f[_0x9a8d('0x3f')][_0x9a8d('0x4a')]){_0x46b7b2[_0x9a8d('0x4b')]=_['merge'](_0x46b7b2[_0x9a8d('0x4b')],{'$or':_[_0x9a8d('0x39')](_0x564706,function(_0xe9345c){if(_0xe9345c[_0x9a8d('0x3c')]!=='VIRTUAL'){var _0x33b858={};_0x33b858[_0xe9345c[_0x9a8d('0x37')]]={'$like':'%'+_0x36d38f['query'][_0x9a8d('0x4a')]+'%'};return _0x33b858;}})});}_0x46b7b2=_[_0x9a8d('0x4c')]({},_0x46b7b2,_0x36d38f[_0x9a8d('0x4d')]);var _0xd5526e={'where':_0x46b7b2['where']};return db['VoiceContext'][_0x9a8d('0x2b')](_0xd5526e)[_0x9a8d('0x1a')](function(_0x128542){_0xa1674f[_0x9a8d('0x2b')]=_0x128542;if(_0x36d38f[_0x9a8d('0x3f')]['includeAll']){_0x46b7b2[_0x9a8d('0x4e')]=[{'all':!![]}];}return db[_0x9a8d('0x3a')]['findAll'](_0x46b7b2);})['then'](function(_0x5601b6){_0xa1674f[_0x9a8d('0x4f')]=_0x5601b6;return _0xa1674f;})[_0x9a8d('0x1a')](respondWithFilteredResult(_0x287be8,_0x46b7b2))[_0x9a8d('0x25')](handleError(_0x287be8,null));};exports[_0x9a8d('0x50')]=function(_0x43c324,_0x5cde7b){var _0x9d9103={'raw':![],'where':{'id':_0x43c324['params']['id']}},_0x41f6f1={};_0x41f6f1[_0x9a8d('0x3e')]=_['keys'](db[_0x9a8d('0x3a')][_0x9a8d('0x51')]);_0x41f6f1[_0x9a8d('0x3f')]=_['keys'](_0x43c324['query']);_0x41f6f1[_0x9a8d('0x40')]=_[_0x9a8d('0x41')](_0x41f6f1['model'],_0x41f6f1[_0x9a8d('0x3f')]);_0x9d9103[_0x9a8d('0x43')]=_[_0x9a8d('0x41')](_0x41f6f1[_0x9a8d('0x3e')],qs[_0x9a8d('0x42')](_0x43c324[_0x9a8d('0x3f')]['fields']));_0x9d9103[_0x9a8d('0x43')]=_0x9d9103[_0x9a8d('0x43')][_0x9a8d('0x44')]?_0x9d9103[_0x9a8d('0x43')]:_0x41f6f1['model'];if(_0x43c324[_0x9a8d('0x3f')][_0x9a8d('0x52')]){_0x9d9103['include']=[{'all':!![]}];}_0x9d9103=_['merge']({},_0x9d9103,_0x43c324[_0x9a8d('0x4d')]);return db[_0x9a8d('0x3a')][_0x9a8d('0x53')](_0x9d9103)[_0x9a8d('0x1a')](handleEntityNotFound(_0x5cde7b,null))[_0x9a8d('0x1a')](respondWithResult(_0x5cde7b,null))['catch'](handleError(_0x5cde7b,null));};exports[_0x9a8d('0x54')]=function(_0x9b5db0,_0x18be93,_0x3b3769){var _0xb22004;return db[_0x9a8d('0x3a')][_0x9a8d('0x54')](_0x9b5db0['body'],{'raw':!![]})[_0x9a8d('0x1a')](function(_0x388610){_0xb22004=_0x388610;return db[_0x9a8d('0x3a')][_0x9a8d('0x55')]({'raw':!![]});})[_0x9a8d('0x1a')](function(_0x42f2a3){var _0x6a9eb5=fs['readFileSync'](path[_0x9a8d('0x56')](config[_0x9a8d('0x57')],_0x9a8d('0x58')),_0x9a8d('0x59'));var _0x31a39d=ejs[_0x9a8d('0x5a')](_0x6a9eb5,{'contexts':_0x42f2a3||[]});fs[_0x9a8d('0x5b')](_0x9a8d('0x5c'),_0x31a39d);})['then'](function(){return respondWithRpcPromise(_0x9a8d('0x5d'),_0x9a8d('0x54'),{'module':_0x9a8d('0x5e')});})['then'](function(){var _0x273e6e=_0x9b5db0[_0x9a8d('0x5f')][_0x9a8d('0x33')]({'plain':!![]});if(!_0x273e6e)throw new Error(_0x9a8d('0x60'));if(_0x273e6e[_0x9a8d('0x61')]===_0x9a8d('0x5f')){var _0x1e8025=_0xb22004[_0x9a8d('0x33')]({'plain':!![]});return db[_0x9a8d('0x62')][_0x9a8d('0x53')]({'where':{'name':_0x9a8d('0x34'),'userProfileId':_0x273e6e[_0x9a8d('0x63')]},'raw':!![]})['then'](function(_0x39bb60){if(_0x39bb60&&_0x39bb60['autoAssociation']===0x0){return db[_0x9a8d('0x35')]['create']({'name':_0x1e8025['name'],'resourceId':_0x1e8025['id'],'type':_0x39bb60[_0x9a8d('0x37')],'sectionId':_0x39bb60['id']},{})['then'](function(){return _0xb22004;});}else{return _0xb22004;}})[_0x9a8d('0x25')](function(_0x51ab44){logger[_0x9a8d('0x21')](_0x9a8d('0x64'),_0x51ab44);throw _0x51ab44;});}return _0xb22004;})['then'](respondWithResult(_0x18be93,0xc9))[_0x9a8d('0x25')](handleError(_0x18be93,null));};exports[_0x9a8d('0x31')]=function(_0x328402,_0x2cf25e,_0x2c8b20){var _0x738d9c;return db[_0x9a8d('0x3a')][_0x9a8d('0x53')]({'where':{'id':_0x328402['params']['id']}})[_0x9a8d('0x1a')](handleEntityNotFound(_0x2cf25e,null))[_0x9a8d('0x1a')](saveUpdates(_0x328402[_0x9a8d('0x65')],null))[_0x9a8d('0x1a')](function(_0xab6f04){if(_0xab6f04){_0x738d9c=_0xab6f04;return db[_0x9a8d('0x3a')]['findAll']({'raw':!![]});}})[_0x9a8d('0x1a')](function(_0x4f0afe){var _0x3e4256=fs['readFileSync'](path[_0x9a8d('0x56')](config[_0x9a8d('0x57')],_0x9a8d('0x58')),_0x9a8d('0x59'));var _0x5d3813=ejs['render'](_0x3e4256,{'contexts':_0x4f0afe||[]});fs['writeFileSync'](_0x9a8d('0x5c'),_0x5d3813);})[_0x9a8d('0x1a')](function(){return respondWithRpcPromise('Reload',_0x9a8d('0x31'),{'module':_0x9a8d('0x5e')});})['then'](function(){return _0x738d9c;})[_0x9a8d('0x1a')](respondWithResult(_0x2cf25e,null))[_0x9a8d('0x25')](handleError(_0x2cf25e,null));};exports[_0x9a8d('0x32')]=function(_0x2b4ba1,_0x4298e4,_0x2be86d){var _0xf87b5f;return db[_0x9a8d('0x3a')]['find']({'where':{'id':_0x2b4ba1['params']['id']}})[_0x9a8d('0x1a')](handleEntityNotFound(_0x4298e4,null))['then'](removeEntity(_0x4298e4,null))[_0x9a8d('0x1a')](function(){return db['VoiceContext'][_0x9a8d('0x55')]({'raw':!![]});})[_0x9a8d('0x1a')](function(_0x173d01){var _0xbc89a3=fs['readFileSync'](path['join'](config['root'],_0x9a8d('0x58')),_0x9a8d('0x59'));var _0x2a8107=ejs[_0x9a8d('0x5a')](_0xbc89a3,{'contexts':_0x173d01});fs['writeFileSync'](_0x9a8d('0x5c'),_0x2a8107);return respondWithRpcPromise(_0x9a8d('0x5d'),_0x9a8d('0x32'),{'module':_0x9a8d('0x5e')});})[_0x9a8d('0x25')](handleError(_0x4298e4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 2ae476d..9428e38 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 _0x0c11=['VoiceContext','voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0x0c11,0x179));var _0x10c1=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x0c11[_0xa9a245];return _0x2d0eaa;};'use strict';var _=require(_0x10c1('0x0'));var util=require(_0x10c1('0x1'));var logger=require(_0x10c1('0x2'))(_0x10c1('0x3'));var moment=require(_0x10c1('0x4'));var BPromise=require(_0x10c1('0x5'));var rp=require(_0x10c1('0x6'));var fs=require('fs');var path=require(_0x10c1('0x7'));var rimraf=require(_0x10c1('0x8'));var config=require(_0x10c1('0x9'));var attributes=require(_0x10c1('0xa'));module[_0x10c1('0xb')]=function(_0x346a17,_0x233fa7){return _0x346a17[_0x10c1('0xc')](_0x10c1('0xd'),attributes,{'tableName':_0x10c1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e5c=['voice_contexts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','VoiceContext'];(function(_0x3f18e2,_0x1a6acb){var _0x5274fc=function(_0x1cbd8b){while(--_0x1cbd8b){_0x3f18e2['push'](_0x3f18e2['shift']());}};_0x5274fc(++_0x1a6acb);}(_0x2e5c,0xbc));var _0xc2e5=function(_0x1b4b23,_0x5dd6d6){_0x1b4b23=_0x1b4b23-0x0;var _0x2a325b=_0x2e5c[_0x1b4b23];return _0x2a325b;};'use strict';var _=require(_0xc2e5('0x0'));var util=require('util');var logger=require(_0xc2e5('0x1'))(_0xc2e5('0x2'));var moment=require(_0xc2e5('0x3'));var BPromise=require(_0xc2e5('0x4'));var rp=require(_0xc2e5('0x5'));var fs=require('fs');var path=require(_0xc2e5('0x6'));var rimraf=require('rimraf');var config=require(_0xc2e5('0x7'));var attributes=require(_0xc2e5('0x8'));module['exports']=function(_0x56398b,_0x263358){return _0x56398b['define'](_0xc2e5('0x9'),attributes,{'tableName':_0xc2e5('0xa'),'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 0e66897..bd1a58f 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 _0x2162=['error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','request\x20sent','debug','stringify'];(function(_0x33bcdb,_0x11846b){var _0x18a9bf=function(_0x34417a){while(--_0x34417a){_0x33bcdb['push'](_0x33bcdb['shift']());}};_0x18a9bf(++_0x11846b);}(_0x2162,0x110));var _0x2216=function(_0x39941c,_0x4ad1bb){_0x39941c=_0x39941c-0x0;var _0x52d9c7=_0x2162[_0x39941c];return _0x52d9c7;};'use strict';var _=require('lodash');var util=require(_0x2216('0x0'));var moment=require('moment');var BPromise=require(_0x2216('0x1'));var rs=require(_0x2216('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2216('0x3'))['db'];var utils=require(_0x2216('0x4'));var logger=require('../../config/logger')(_0x2216('0x5'));var config=require(_0x2216('0x6'));var jayson=require(_0x2216('0x7'));var client=jayson['client'][_0x2216('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4db005,_0x4e1280,_0x32cf2d){return new BPromise(function(_0x2fe93c,_0x2a01d1){return client[_0x2216('0x9')](_0x4db005,_0x32cf2d)['then'](function(_0x5dc257){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'));logger[_0x2216('0xb')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'),JSON[_0x2216('0xc')](_0x5dc257));if(_0x5dc257[_0x2216('0xd')]){if(_0x5dc257[_0x2216('0xd')]['code']===0x1f4){logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x5dc257[_0x2216('0xd')][_0x2216('0xf')]);return _0x2a01d1(_0x5dc257[_0x2216('0xd')][_0x2216('0xf')]);}logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x5dc257['error'][_0x2216('0xf')]);return _0x2fe93c(_0x5dc257[_0x2216('0xd')]['message']);}else{logger[_0x2216('0x10')]('VoiceContext,\x20%s,\x20%s',_0x4e1280,_0x2216('0xa'));_0x2fe93c(_0x5dc257[_0x2216('0x11')][_0x2216('0xf')]);}})[_0x2216('0x12')](function(_0x219326){logger[_0x2216('0xd')](_0x2216('0xe'),_0x4e1280,_0x219326);_0x2a01d1(_0x219326);});});} \ No newline at end of file +var _0x56a4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2bb9b3,_0x1d2c25){var _0x601b6=function(_0x4f8d09){while(--_0x4f8d09){_0x2bb9b3['push'](_0x2bb9b3['shift']());}};_0x601b6(++_0x1d2c25);}(_0x56a4,0x73));var _0x456a=function(_0x4f8886,_0x9be826){_0x4f8886=_0x4f8886-0x0;var _0x3c49e4=_0x56a4[_0x4f8886];return _0x3c49e4;};'use strict';var _=require('lodash');var util=require(_0x456a('0x0'));var moment=require(_0x456a('0x1'));var BPromise=require(_0x456a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x456a('0x3'))['db'];var utils=require(_0x456a('0x4'));var logger=require(_0x456a('0x5'))(_0x456a('0x6'));var config=require(_0x456a('0x7'));var jayson=require(_0x456a('0x8'));var client=jayson[_0x456a('0x9')][_0x456a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f7f60,_0x490cbc,_0x13d017){return new BPromise(function(_0x4a78f9,_0x4f815b){return client[_0x456a('0xb')](_0x4f7f60,_0x13d017)['then'](function(_0x317f3e){logger[_0x456a('0xc')](_0x456a('0xd'),_0x490cbc,_0x456a('0xe'));logger[_0x456a('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x490cbc,_0x456a('0xe'),JSON['stringify'](_0x317f3e));if(_0x317f3e['error']){if(_0x317f3e[_0x456a('0x10')][_0x456a('0x11')]===0x1f4){logger[_0x456a('0x10')](_0x456a('0xd'),_0x490cbc,_0x317f3e[_0x456a('0x10')][_0x456a('0x12')]);return _0x4f815b(_0x317f3e[_0x456a('0x10')]['message']);}logger[_0x456a('0x10')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x317f3e[_0x456a('0x10')]['message']);return _0x4a78f9(_0x317f3e[_0x456a('0x10')]['message']);}else{logger[_0x456a('0xc')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x456a('0xe'));_0x4a78f9(_0x317f3e['result'][_0x456a('0x12')]);}})[_0x456a('0x13')](function(_0x280952){logger[_0x456a('0x10')]('VoiceContext,\x20%s,\x20%s',_0x490cbc,_0x280952);_0x4f815b(_0x280952);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index f141955..e267715 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 _0xd8b4=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update'];(function(_0x17072d,_0x165140){var _0x4c534a=function(_0x124804){while(--_0x124804){_0x17072d['push'](_0x17072d['shift']());}};_0x4c534a(++_0x165140);}(_0xd8b4,0xff));var _0x4d8b=function(_0x5500bd,_0x179cb7){_0x5500bd=_0x5500bd-0x0;var _0x31a46b=_0xd8b4[_0x5500bd];return _0x31a46b;};'use strict';var multer=require(_0x4d8b('0x0'));var util=require(_0x4d8b('0x1'));var path=require(_0x4d8b('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d8b('0x3'));var router=express[_0x4d8b('0x4')]();var fs_extra=require(_0x4d8b('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d8b('0x6'));var controller=require(_0x4d8b('0x7'));router[_0x4d8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x4d8b('0x9')]);router[_0x4d8b('0x8')](_0x4d8b('0xa'),auth[_0x4d8b('0xb')](),controller['describe']);router[_0x4d8b('0x8')]('/:id',auth[_0x4d8b('0xb')](),controller[_0x4d8b('0xc')]);router[_0x4d8b('0xd')]('/',auth['isAuthenticated'](),controller[_0x4d8b('0xe')]);router[_0x4d8b('0xf')](_0x4d8b('0x10'),auth[_0x4d8b('0xb')](),controller[_0x4d8b('0x11')]);router[_0x4d8b('0x12')](_0x4d8b('0x10'),auth['isAuthenticated'](),controller[_0x4d8b('0x13')]);module[_0x4d8b('0x14')]=router; \ No newline at end of file +var _0xa0de=['describe','/:id','show','post','put','update','delete','destroy','exports','multer','connect-timeout','fs-extra','../../config/environment','./voiceDialReport.controller','isAuthenticated','get','/describe'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa0de,0x1c3));var _0xea0d=function(_0x368a35,_0x26458b){_0x368a35=_0x368a35-0x0;var _0x1e03fc=_0xa0de[_0x368a35];return _0x1e03fc;};'use strict';var multer=require(_0xea0d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xea0d('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xea0d('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xea0d('0x3'));var controller=require(_0xea0d('0x4'));router['get']('/',auth[_0xea0d('0x5')](),controller['index']);router[_0xea0d('0x6')](_0xea0d('0x7'),auth['isAuthenticated'](),controller[_0xea0d('0x8')]);router['get'](_0xea0d('0x9'),auth[_0xea0d('0x5')](),controller[_0xea0d('0xa')]);router[_0xea0d('0xb')]('/',auth[_0xea0d('0x5')](),controller['create']);router[_0xea0d('0xc')](_0xea0d('0x9'),auth[_0xea0d('0x5')](),controller[_0xea0d('0xd')]);router[_0xea0d('0xe')](_0xea0d('0x9'),auth[_0xea0d('0x5')](),controller[_0xea0d('0xf')]);module[_0xea0d('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index c27aaf2..a2f2b7d 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 _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x34c083,_0x202058){var _0x1dd43d=function(_0xd764d1){while(--_0xd764d1){_0x34c083['push'](_0x34c083['shift']());}};_0x1dd43d(++_0x202058);}(_0x81bd,0x7c));var _0xd81b=function(_0x504c88,_0x1c3016){_0x504c88=_0x504c88-0x0;var _0xb5611e=_0x81bd[_0x504c88];return _0xb5611e;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file +var _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x2be783,_0x1e41b4){var _0x58cb9d=function(_0xf04326){while(--_0xf04326){_0x2be783['push'](_0x2be783['shift']());}};_0x58cb9d(++_0x1e41b4);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index e633538..c0c4e66 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 _0x09d7=['../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','VoiceDialReport','includeAll','include','rows','catch','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api'];(function(_0x5468d1,_0x19b293){var _0x5766fc=function(_0x3e92aa){while(--_0x3e92aa){_0x5468d1['push'](_0x5468d1['shift']());}};_0x5766fc(++_0x19b293);}(_0x09d7,0x7d));var _0x709d=function(_0x4a4771,_0x274d55){_0x4a4771=_0x4a4771-0x0;var _0x8ac8ea=_0x09d7[_0x4a4771];return _0x8ac8ea;};'use strict';var emlformat=require(_0x709d('0x0'));var rimraf=require(_0x709d('0x1'));var zipdir=require(_0x709d('0x2'));var jsonpatch=require(_0x709d('0x3'));var rp=require('request-promise');var moment=require(_0x709d('0x4'));var BPromise=require(_0x709d('0x5'));var Mustache=require(_0x709d('0x6'));var util=require(_0x709d('0x7'));var path=require(_0x709d('0x8'));var sox=require('sox');var csv=require(_0x709d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x709d('0xa'));var squel=require(_0x709d('0xb'));var crypto=require(_0x709d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x709d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x709d('0xe'));var Papa=require(_0x709d('0xf'));var Redis=require(_0x709d('0x10'));var authService=require(_0x709d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x709d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x709d('0x13'))(_0x709d('0x14'));var utils=require('../../config/utils');var config=require(_0x709d('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59542e,_0x1c18fd){_0x1c18fd=_0x1c18fd||0xcc;return function(_0x5af892){if(_0x5af892){return _0x59542e[_0x709d('0x16')](_0x1c18fd);}return _0x59542e[_0x709d('0x17')](_0x1c18fd)[_0x709d('0x18')]();};}function respondWithResult(_0x327de6,_0x5f1ddf){_0x5f1ddf=_0x5f1ddf||0xc8;return function(_0x5dab5e){if(_0x5dab5e){return _0x327de6['status'](_0x5f1ddf)[_0x709d('0x19')](_0x5dab5e);}};}function respondWithFilteredResult(_0x245cb0,_0x3efb2d){return function(_0x554bf9){if(_0x554bf9){var _0x181762=typeof _0x3efb2d[_0x709d('0x1a')]==='undefined'&&typeof _0x3efb2d[_0x709d('0x1b')]===_0x709d('0x1c');var _0xa351ed=_0x554bf9[_0x709d('0x1d')];var _0x9a8bcb=_0x181762?0x0:_0x3efb2d[_0x709d('0x1a')];var _0x3dc230=_0x181762?_0x554bf9[_0x709d('0x1d')]:_0x3efb2d[_0x709d('0x1a')]+_0x3efb2d[_0x709d('0x1b')];var _0x10cc9a;if(_0x3dc230>=_0xa351ed){_0x3dc230=_0xa351ed;_0x10cc9a=0xc8;}else{_0x10cc9a=0xce;}_0x245cb0[_0x709d('0x17')](_0x10cc9a);return _0x245cb0[_0x709d('0x1e')](_0x709d('0x1f'),_0x9a8bcb+'-'+_0x3dc230+'/'+_0xa351ed)['json'](_0x554bf9);}return null;};}function patchUpdates(_0xa2edea){return function(_0x289bde){try{jsonpatch[_0x709d('0x20')](_0x289bde,_0xa2edea,!![]);}catch(_0x102527){return BPromise[_0x709d('0x21')](_0x102527);}return _0x289bde[_0x709d('0x22')]();};}function saveUpdates(_0x3c73de,_0x105754){return function(_0x209829){if(_0x209829){return _0x209829[_0x709d('0x23')](_0x3c73de)[_0x709d('0x24')](function(_0x19ed59){return _0x19ed59;});}return null;};}function removeEntity(_0x4200d6,_0x31ceff){return function(_0x39055c){if(_0x39055c){return _0x39055c[_0x709d('0x25')]()[_0x709d('0x24')](function(){_0x4200d6[_0x709d('0x17')](0xcc)[_0x709d('0x18')]();});}};}function handleEntityNotFound(_0x4c7994,_0x3ad404){return function(_0x7fa8dc){if(!_0x7fa8dc){_0x4c7994['sendStatus'](0x194);}return _0x7fa8dc;};}function handleError(_0x1e5c6a,_0x4cbe96){_0x4cbe96=_0x4cbe96||0x1f4;return function(_0x3be644){logger[_0x709d('0x26')](_0x3be644[_0x709d('0x27')]);if(_0x3be644[_0x709d('0x28')]){delete _0x3be644[_0x709d('0x28')];}_0x1e5c6a['status'](_0x4cbe96)[_0x709d('0x29')](_0x3be644);};}exports[_0x709d('0x2a')]=function(_0x340fe2,_0x5bf138){var _0x1ba81d={},_0x4c048b={},_0x5c3605={'count':0x0,'rows':[]};var _0x41878d=_[_0x709d('0x2b')](db['VoiceDialReport'][_0x709d('0x2c')],function(_0x3462e6){return{'name':_0x3462e6['fieldName'],'type':_0x3462e6[_0x709d('0x2d')][_0x709d('0x2e')]};});_0x4c048b[_0x709d('0x2f')]=_[_0x709d('0x2b')](_0x41878d,_0x709d('0x28'));_0x4c048b[_0x709d('0x30')]=_[_0x709d('0x31')](_0x340fe2[_0x709d('0x30')]);_0x4c048b[_0x709d('0x32')]=_[_0x709d('0x33')](_0x4c048b[_0x709d('0x2f')],_0x4c048b[_0x709d('0x30')]);_0x1ba81d[_0x709d('0x34')]=_[_0x709d('0x33')](_0x4c048b[_0x709d('0x2f')],qs['fields'](_0x340fe2[_0x709d('0x30')][_0x709d('0x35')]));_0x1ba81d[_0x709d('0x34')]=_0x1ba81d['attributes'][_0x709d('0x36')]?_0x1ba81d[_0x709d('0x34')]:_0x4c048b[_0x709d('0x2f')];if(!_0x340fe2['query']['hasOwnProperty'](_0x709d('0x37'))){_0x1ba81d[_0x709d('0x1b')]=qs[_0x709d('0x1b')](_0x340fe2[_0x709d('0x30')][_0x709d('0x1b')]);_0x1ba81d[_0x709d('0x1a')]=qs[_0x709d('0x1a')](_0x340fe2[_0x709d('0x30')][_0x709d('0x1a')]);}_0x1ba81d['order']=qs[_0x709d('0x38')](_0x340fe2[_0x709d('0x30')][_0x709d('0x38')]);_0x1ba81d[_0x709d('0x39')]=qs[_0x709d('0x32')](_[_0x709d('0x3a')](_0x340fe2[_0x709d('0x30')],_0x4c048b[_0x709d('0x32')]),_0x41878d);if(_0x340fe2['query'][_0x709d('0x3b')]){_0x1ba81d[_0x709d('0x39')]=_['merge'](_0x1ba81d['where'],{'$or':_['map'](_0x41878d,function(_0x4c9b4c){if(_0x4c9b4c['type']!==_0x709d('0x3c')){var _0x1dd870={};_0x1dd870[_0x4c9b4c[_0x709d('0x28')]]={'$like':'%'+_0x340fe2['query'][_0x709d('0x3b')]+'%'};return _0x1dd870;}})});}_0x1ba81d=_[_0x709d('0x3d')]({},_0x1ba81d,_0x340fe2[_0x709d('0x3e')]);var _0x29f4b4={'where':_0x1ba81d['where']};return db[_0x709d('0x3f')][_0x709d('0x1d')](_0x29f4b4)[_0x709d('0x24')](function(_0x362382){_0x5c3605['count']=_0x362382;if(_0x340fe2['query'][_0x709d('0x40')]){_0x1ba81d[_0x709d('0x41')]=[{'all':!![]}];}return db[_0x709d('0x3f')]['findAll'](_0x1ba81d);})[_0x709d('0x24')](function(_0x1dfc6a){_0x5c3605[_0x709d('0x42')]=_0x1dfc6a;return _0x5c3605;})[_0x709d('0x24')](respondWithFilteredResult(_0x5bf138,_0x1ba81d))[_0x709d('0x43')](handleError(_0x5bf138,null));};exports['show']=function(_0x5f253f,_0x5e15c0){var _0x1f4094={'raw':!![],'where':{'id':_0x5f253f['params']['id']}},_0x264f1f={};_0x264f1f[_0x709d('0x2f')]=_[_0x709d('0x31')](db['VoiceDialReport'][_0x709d('0x2c')]);_0x264f1f[_0x709d('0x30')]=_[_0x709d('0x31')](_0x5f253f['query']);_0x264f1f[_0x709d('0x32')]=_[_0x709d('0x33')](_0x264f1f[_0x709d('0x2f')],_0x264f1f[_0x709d('0x30')]);_0x1f4094[_0x709d('0x34')]=_['intersection'](_0x264f1f[_0x709d('0x2f')],qs[_0x709d('0x35')](_0x5f253f[_0x709d('0x30')][_0x709d('0x35')]));_0x1f4094['attributes']=_0x1f4094[_0x709d('0x34')][_0x709d('0x36')]?_0x1f4094[_0x709d('0x34')]:_0x264f1f[_0x709d('0x2f')];if(_0x5f253f[_0x709d('0x30')][_0x709d('0x40')]){_0x1f4094['include']=[{'all':!![]}];}_0x1f4094=_[_0x709d('0x3d')]({},_0x1f4094,_0x5f253f[_0x709d('0x3e')]);return db[_0x709d('0x3f')][_0x709d('0x44')](_0x1f4094)['then'](handleEntityNotFound(_0x5e15c0,null))['then'](respondWithResult(_0x5e15c0,null))['catch'](handleError(_0x5e15c0,null));};exports[_0x709d('0x45')]=function(_0x159c14,_0x5bc7ba){return db[_0x709d('0x3f')]['create'](_0x159c14[_0x709d('0x46')],{})['then'](respondWithResult(_0x5bc7ba,0xc9))[_0x709d('0x43')](handleError(_0x5bc7ba,null));};exports[_0x709d('0x23')]=function(_0x37cad3,_0x52670a){if(_0x37cad3[_0x709d('0x46')]['id']){delete _0x37cad3['body']['id'];}return db[_0x709d('0x3f')][_0x709d('0x44')]({'where':{'id':_0x37cad3[_0x709d('0x47')]['id']}})[_0x709d('0x24')](handleEntityNotFound(_0x52670a,null))[_0x709d('0x24')](saveUpdates(_0x37cad3[_0x709d('0x46')],null))[_0x709d('0x24')](respondWithResult(_0x52670a,null))[_0x709d('0x43')](handleError(_0x52670a,null));};exports[_0x709d('0x25')]=function(_0x19eb29,_0x29b9de){return db[_0x709d('0x3f')][_0x709d('0x44')]({'where':{'id':_0x19eb29[_0x709d('0x47')]['id']}})[_0x709d('0x24')](handleEntityNotFound(_0x29b9de,null))[_0x709d('0x24')](removeEntity(_0x29b9de,null))[_0x709d('0x43')](handleError(_0x29b9de,null));};exports[_0x709d('0x48')]=function(_0x25840f,_0x4b75fd){return db['VoiceDialReport'][_0x709d('0x48')]()[_0x709d('0x24')](respondWithResult(_0x4b75fd,null))['catch'](handleError(_0x4b75fd,null));}; \ No newline at end of file +var _0x0727=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','catch','params','includeAll','include','find','create','update','body','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','status','sendStatus','error','name','send','index','map','VoiceDialReport','rawAttributes','key','model','query','keys','filters','intersection','attributes'];(function(_0x39ae36,_0x4e0719){var _0x535e19=function(_0x2306df){while(--_0x2306df){_0x39ae36['push'](_0x39ae36['shift']());}};_0x535e19(++_0x4e0719);}(_0x0727,0xb0));var _0x7072=function(_0x1c156e,_0x3263a6){_0x1c156e=_0x1c156e-0x0;var _0x58fc22=_0x0727[_0x1c156e];return _0x58fc22;};'use strict';var emlformat=require(_0x7072('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7072('0x1'));var jsonpatch=require(_0x7072('0x2'));var rp=require(_0x7072('0x3'));var moment=require(_0x7072('0x4'));var BPromise=require(_0x7072('0x5'));var Mustache=require(_0x7072('0x6'));var util=require(_0x7072('0x7'));var path=require('path');var sox=require(_0x7072('0x8'));var csv=require(_0x7072('0x9'));var ejs=require(_0x7072('0xa'));var fs=require('fs');var fs_extra=require(_0x7072('0xb'));var _=require(_0x7072('0xc'));var squel=require(_0x7072('0xd'));var crypto=require(_0x7072('0xe'));var jsforce=require(_0x7072('0xf'));var deskjs=require(_0x7072('0x10'));var toCsv=require(_0x7072('0x9'));var querystring=require(_0x7072('0x11'));var Papa=require(_0x7072('0x12'));var Redis=require(_0x7072('0x13'));var authService=require(_0x7072('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7072('0x15'));var hardwareService=require(_0x7072('0x16'));var logger=require(_0x7072('0x17'))(_0x7072('0x18'));var utils=require('../../config/utils');var config=require(_0x7072('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dd424,_0x1c3415){_0x1c3415=_0x1c3415||0xcc;return function(_0x15ddbd){if(_0x15ddbd){return _0x5dd424['sendStatus'](_0x1c3415);}return _0x5dd424['status'](_0x1c3415)[_0x7072('0x1a')]();};}function respondWithResult(_0x48bed0,_0x153b38){_0x153b38=_0x153b38||0xc8;return function(_0x5d1f02){if(_0x5d1f02){return _0x48bed0['status'](_0x153b38)[_0x7072('0x1b')](_0x5d1f02);}};}function respondWithFilteredResult(_0x1ce67a,_0x31ff0d){return function(_0x5a3c85){if(_0x5a3c85){var _0x3a1a1f=typeof _0x31ff0d['offset']===_0x7072('0x1c')&&typeof _0x31ff0d['limit']===_0x7072('0x1c');var _0x5f5d27=_0x5a3c85[_0x7072('0x1d')];var _0x1f3294=_0x3a1a1f?0x0:_0x31ff0d[_0x7072('0x1e')];var _0x4a5fe0=_0x3a1a1f?_0x5a3c85[_0x7072('0x1d')]:_0x31ff0d[_0x7072('0x1e')]+_0x31ff0d[_0x7072('0x1f')];var _0x799067;if(_0x4a5fe0>=_0x5f5d27){_0x4a5fe0=_0x5f5d27;_0x799067=0xc8;}else{_0x799067=0xce;}_0x1ce67a['status'](_0x799067);return _0x1ce67a[_0x7072('0x20')](_0x7072('0x21'),_0x1f3294+'-'+_0x4a5fe0+'/'+_0x5f5d27)[_0x7072('0x1b')](_0x5a3c85);}return null;};}function patchUpdates(_0x3e6869){return function(_0x45cdc2){try{jsonpatch[_0x7072('0x22')](_0x45cdc2,_0x3e6869,!![]);}catch(_0x4c0a69){return BPromise[_0x7072('0x23')](_0x4c0a69);}return _0x45cdc2[_0x7072('0x24')]();};}function saveUpdates(_0x20e888,_0x42567c){return function(_0x26b3b2){if(_0x26b3b2){return _0x26b3b2['update'](_0x20e888)[_0x7072('0x25')](function(_0x23762a){return _0x23762a;});}return null;};}function removeEntity(_0x2f38d7,_0x38d84a){return function(_0x9a757b){if(_0x9a757b){return _0x9a757b[_0x7072('0x26')]()['then'](function(){_0x2f38d7[_0x7072('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0d0a,_0x144ac1){return function(_0xbe054e){if(!_0xbe054e){_0x1d0d0a[_0x7072('0x28')](0x194);}return _0xbe054e;};}function handleError(_0x1f5807,_0x206b8c){_0x206b8c=_0x206b8c||0x1f4;return function(_0x4d4a04){logger[_0x7072('0x29')](_0x4d4a04['stack']);if(_0x4d4a04['name']){delete _0x4d4a04[_0x7072('0x2a')];}_0x1f5807[_0x7072('0x27')](_0x206b8c)[_0x7072('0x2b')](_0x4d4a04);};}exports[_0x7072('0x2c')]=function(_0x37e54a,_0x41c61a){var _0x25043b={},_0x2ae4df={},_0x17215c={'count':0x0,'rows':[]};var _0x5948ff=_[_0x7072('0x2d')](db[_0x7072('0x2e')][_0x7072('0x2f')],function(_0x560b35){return{'name':_0x560b35['fieldName'],'type':_0x560b35['type'][_0x7072('0x30')]};});_0x2ae4df[_0x7072('0x31')]=_[_0x7072('0x2d')](_0x5948ff,_0x7072('0x2a'));_0x2ae4df[_0x7072('0x32')]=_[_0x7072('0x33')](_0x37e54a[_0x7072('0x32')]);_0x2ae4df[_0x7072('0x34')]=_[_0x7072('0x35')](_0x2ae4df[_0x7072('0x31')],_0x2ae4df[_0x7072('0x32')]);_0x25043b[_0x7072('0x36')]=_['intersection'](_0x2ae4df['model'],qs[_0x7072('0x37')](_0x37e54a[_0x7072('0x32')][_0x7072('0x37')]));_0x25043b[_0x7072('0x36')]=_0x25043b[_0x7072('0x36')][_0x7072('0x38')]?_0x25043b[_0x7072('0x36')]:_0x2ae4df[_0x7072('0x31')];if(!_0x37e54a[_0x7072('0x32')][_0x7072('0x39')](_0x7072('0x3a'))){_0x25043b[_0x7072('0x1f')]=qs[_0x7072('0x1f')](_0x37e54a[_0x7072('0x32')][_0x7072('0x1f')]);_0x25043b[_0x7072('0x1e')]=qs['offset'](_0x37e54a[_0x7072('0x32')][_0x7072('0x1e')]);}_0x25043b['order']=qs[_0x7072('0x3b')](_0x37e54a['query'][_0x7072('0x3b')]);_0x25043b[_0x7072('0x3c')]=qs['filters'](_[_0x7072('0x3d')](_0x37e54a['query'],_0x2ae4df[_0x7072('0x34')]),_0x5948ff);if(_0x37e54a[_0x7072('0x32')][_0x7072('0x3e')]){_0x25043b[_0x7072('0x3c')]=_[_0x7072('0x3f')](_0x25043b['where'],{'$or':_[_0x7072('0x2d')](_0x5948ff,function(_0x22c3d0){if(_0x22c3d0[_0x7072('0x40')]!==_0x7072('0x41')){var _0x3021fb={};_0x3021fb[_0x22c3d0[_0x7072('0x2a')]]={'$like':'%'+_0x37e54a[_0x7072('0x32')][_0x7072('0x3e')]+'%'};return _0x3021fb;}})});}_0x25043b=_[_0x7072('0x3f')]({},_0x25043b,_0x37e54a[_0x7072('0x42')]);var _0x7afbe5={'where':_0x25043b[_0x7072('0x3c')]};return db[_0x7072('0x2e')]['count'](_0x7afbe5)[_0x7072('0x25')](function(_0xdae186){_0x17215c['count']=_0xdae186;if(_0x37e54a[_0x7072('0x32')]['includeAll']){_0x25043b['include']=[{'all':!![]}];}return db[_0x7072('0x2e')][_0x7072('0x43')](_0x25043b);})[_0x7072('0x25')](function(_0x38b0da){_0x17215c['rows']=_0x38b0da;return _0x17215c;})[_0x7072('0x25')](respondWithFilteredResult(_0x41c61a,_0x25043b))[_0x7072('0x44')](handleError(_0x41c61a,null));};exports['show']=function(_0x238e1c,_0x481c85){var _0x36936c={'raw':!![],'where':{'id':_0x238e1c[_0x7072('0x45')]['id']}},_0x14473d={};_0x14473d['model']=_[_0x7072('0x33')](db['VoiceDialReport']['rawAttributes']);_0x14473d[_0x7072('0x32')]=_[_0x7072('0x33')](_0x238e1c[_0x7072('0x32')]);_0x14473d[_0x7072('0x34')]=_[_0x7072('0x35')](_0x14473d[_0x7072('0x31')],_0x14473d[_0x7072('0x32')]);_0x36936c[_0x7072('0x36')]=_[_0x7072('0x35')](_0x14473d['model'],qs['fields'](_0x238e1c[_0x7072('0x32')][_0x7072('0x37')]));_0x36936c[_0x7072('0x36')]=_0x36936c['attributes']['length']?_0x36936c['attributes']:_0x14473d[_0x7072('0x31')];if(_0x238e1c[_0x7072('0x32')][_0x7072('0x46')]){_0x36936c[_0x7072('0x47')]=[{'all':!![]}];}_0x36936c=_[_0x7072('0x3f')]({},_0x36936c,_0x238e1c[_0x7072('0x42')]);return db[_0x7072('0x2e')][_0x7072('0x48')](_0x36936c)[_0x7072('0x25')](handleEntityNotFound(_0x481c85,null))[_0x7072('0x25')](respondWithResult(_0x481c85,null))[_0x7072('0x44')](handleError(_0x481c85,null));};exports[_0x7072('0x49')]=function(_0x3072f6,_0x5e7909){return db[_0x7072('0x2e')][_0x7072('0x49')](_0x3072f6['body'],{})[_0x7072('0x25')](respondWithResult(_0x5e7909,0xc9))[_0x7072('0x44')](handleError(_0x5e7909,null));};exports[_0x7072('0x4a')]=function(_0x581bf6,_0x5c6841){if(_0x581bf6[_0x7072('0x4b')]['id']){delete _0x581bf6[_0x7072('0x4b')]['id'];}return db[_0x7072('0x2e')][_0x7072('0x48')]({'where':{'id':_0x581bf6[_0x7072('0x45')]['id']}})['then'](handleEntityNotFound(_0x5c6841,null))[_0x7072('0x25')](saveUpdates(_0x581bf6[_0x7072('0x4b')],null))['then'](respondWithResult(_0x5c6841,null))['catch'](handleError(_0x5c6841,null));};exports[_0x7072('0x26')]=function(_0x5f58c4,_0x1715c6){return db[_0x7072('0x2e')][_0x7072('0x48')]({'where':{'id':_0x5f58c4[_0x7072('0x45')]['id']}})[_0x7072('0x25')](handleEntityNotFound(_0x1715c6,null))[_0x7072('0x25')](removeEntity(_0x1715c6,null))[_0x7072('0x44')](handleError(_0x1715c6,null));};exports[_0x7072('0x4c')]=function(_0x2494e9,_0x4b92bd){return db[_0x7072('0x2e')][_0x7072('0x4c')]()['then'](respondWithResult(_0x4b92bd,null))[_0x7072('0x44')](handleError(_0x4b92bd,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 9d8dd54..3e8735f 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 _0xde6c=['report_dial','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes'];(function(_0x48a8d4,_0x3f35bd){var _0x277106=function(_0x5b44ab){while(--_0x5b44ab){_0x48a8d4['push'](_0x48a8d4['shift']());}};_0x277106(++_0x3f35bd);}(_0xde6c,0x119));var _0xcde6=function(_0x38baac,_0x2772b3){_0x38baac=_0x38baac-0x0;var _0x47baf1=_0xde6c[_0x38baac];return _0x47baf1;};'use strict';var _=require(_0xcde6('0x0'));var util=require(_0xcde6('0x1'));var logger=require('../../config/logger')(_0xcde6('0x2'));var moment=require(_0xcde6('0x3'));var BPromise=require(_0xcde6('0x4'));var rp=require(_0xcde6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcde6('0x6'));var config=require(_0xcde6('0x7'));var attributes=require(_0xcde6('0x8'));module['exports']=function(_0x430ed4,_0xed7d8d){return _0x430ed4['define']('VoiceDialReport',attributes,{'tableName':_0xcde6('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ee6=['path','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x1da756,_0x4d56b6){var _0x336622=function(_0x37c976){while(--_0x37c976){_0x1da756['push'](_0x1da756['shift']());}};_0x336622(++_0x4d56b6);}(_0x9ee6,0x125));var _0x69ee=function(_0x487ab4,_0x1e24e8){_0x487ab4=_0x487ab4-0x0;var _0x3bef77=_0x9ee6[_0x487ab4];return _0x3bef77;};'use strict';var _=require(_0x69ee('0x0'));var util=require(_0x69ee('0x1'));var logger=require(_0x69ee('0x2'))(_0x69ee('0x3'));var moment=require('moment');var BPromise=require(_0x69ee('0x4'));var rp=require(_0x69ee('0x5'));var fs=require('fs');var path=require(_0x69ee('0x6'));var rimraf=require('rimraf');var config=require(_0x69ee('0x7'));var attributes=require(_0x69ee('0x8'));module['exports']=function(_0x1f8799,_0x52f3fe){return _0x1f8799[_0x69ee('0x9')](_0x69ee('0xa'),attributes,{'tableName':_0x69ee('0xb'),'paranoid':![],'indexes':[{'fields':[_0x69ee('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 a77512b..2895d5a 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 _0xee8e=['rpc','../../config/environment','jayson/promise','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','then','stringify','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a052e,_0x5f14f5){var _0x2497cc=function(_0x4bfbe8){while(--_0x4bfbe8){_0x4a052e['push'](_0x4a052e['shift']());}};_0x2497cc(++_0x5f14f5);}(_0xee8e,0x16e));var _0xeee8=function(_0x5bd411,_0x4c52ec){_0x5bd411=_0x5bd411-0x0;var _0x43fed2=_0xee8e[_0x5bd411];return _0x43fed2;};'use strict';var _=require(_0xeee8('0x0'));var util=require(_0xeee8('0x1'));var moment=require(_0xeee8('0x2'));var BPromise=require(_0xeee8('0x3'));var rs=require(_0xeee8('0x4'));var fs=require('fs');var Redis=require(_0xeee8('0x5'));var db=require(_0xeee8('0x6'))['db'];var utils=require(_0xeee8('0x7'));var logger=require('../../config/logger')(_0xeee8('0x8'));var config=require(_0xeee8('0x9'));var jayson=require(_0xeee8('0xa'));var client=jayson[_0xeee8('0xb')][_0xeee8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x31f31a,_0x2d1ee2,_0xf9a843){return new BPromise(function(_0x340b39,_0x211fd6){return client['request'](_0x31f31a,_0xf9a843)['then'](function(_0x3cdb34){logger[_0xeee8('0xd')](_0xeee8('0xe'),_0x2d1ee2,_0xeee8('0xf'));logger[_0xeee8('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x2d1ee2,'request\x20sent',JSON['stringify'](_0x3cdb34));if(_0x3cdb34[_0xeee8('0x11')]){if(_0x3cdb34[_0xeee8('0x11')][_0xeee8('0x12')]===0x1f4){logger[_0xeee8('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x2d1ee2,_0x3cdb34[_0xeee8('0x11')][_0xeee8('0x13')]);return _0x211fd6(_0x3cdb34[_0xeee8('0x11')]['message']);}logger[_0xeee8('0x11')]('VoiceDialReport,\x20%s,\x20%s',_0x2d1ee2,_0x3cdb34[_0xeee8('0x11')][_0xeee8('0x13')]);return _0x340b39(_0x3cdb34[_0xeee8('0x11')]['message']);}else{logger[_0xeee8('0xd')](_0xeee8('0xe'),_0x2d1ee2,'request\x20sent');_0x340b39(_0x3cdb34[_0xeee8('0x14')][_0xeee8('0x13')]);}})[_0xeee8('0x15')](function(_0x41e30f){logger[_0xeee8('0x11')](_0xeee8('0xe'),_0x2d1ee2,_0x41e30f);_0x211fd6(_0x41e30f);});});}exports[_0xeee8('0x16')]=function(_0xd2e20f){var _0x63054=this;return new Promise(function(_0x5dc1ae,_0x2f203e){return db[_0xeee8('0x17')]['create'](_0xd2e20f[_0xeee8('0x18')],{'raw':_0xd2e20f[_0xeee8('0x19')]?_0xd2e20f[_0xeee8('0x19')][_0xeee8('0x1a')]===undefined?!![]:![]:!![]})[_0xeee8('0x1b')](function(_0x13443e){logger[_0xeee8('0xd')](_0xeee8('0x16'),_0xd2e20f);logger[_0xeee8('0x10')](_0xeee8('0x16'),_0xd2e20f,JSON[_0xeee8('0x1c')](_0x13443e));_0x5dc1ae(_0x13443e);})[_0xeee8('0x15')](function(_0x3849a8){logger[_0xeee8('0x11')](_0xeee8('0x16'),_0x3849a8[_0xeee8('0x13')],_0xd2e20f);_0x2f203e(_0x63054[_0xeee8('0x11')](0x1f4,_0x3849a8[_0xeee8('0x13')]));});});};exports[_0xeee8('0x1d')]=function(_0x44b5c1){var _0x5a6ec3=this;return new Promise(function(_0x3a163b,_0x320aca){return db[_0xeee8('0x17')][_0xeee8('0x1e')](_0x44b5c1[_0xeee8('0x18')],{'raw':_0x44b5c1['options']?_0x44b5c1['options'][_0xeee8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44b5c1[_0xeee8('0x19')]?_0x44b5c1[_0xeee8('0x19')][_0xeee8('0x1f')]||null:null,'attributes':_0x44b5c1[_0xeee8('0x19')]?_0x44b5c1[_0xeee8('0x19')][_0xeee8('0x20')]||null:null,'limit':_0x44b5c1[_0xeee8('0x19')]?_0x44b5c1[_0xeee8('0x19')][_0xeee8('0x21')]||null:null})['then'](function(_0x3dc187){logger[_0xeee8('0xd')](_0xeee8('0x1d'),_0x44b5c1);logger['debug'](_0xeee8('0x1d'),_0x44b5c1,JSON[_0xeee8('0x1c')](_0x3dc187));_0x3a163b(_0x3dc187);})[_0xeee8('0x15')](function(_0x5bcfbf){logger[_0xeee8('0x11')](_0xeee8('0x1d'),_0x5bcfbf[_0xeee8('0x13')],_0x44b5c1);_0x320aca(_0x5a6ec3[_0xeee8('0x11')](0x1f4,_0x5bcfbf[_0xeee8('0x13')]));});});}; \ No newline at end of file +var _0x8807=['error','code','message','result','catch','VoiceDialReport','create','body','options','CreateVoiceDialReport','UpdateVoiceDialReport','update','raw','attributes','limit','lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x34f7e3,_0x44e8b1){var _0x132cd0=function(_0x23b91e){while(--_0x23b91e){_0x34f7e3['push'](_0x34f7e3['shift']());}};_0x132cd0(++_0x44e8b1);}(_0x8807,0x14f));var _0x7880=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x8807[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0x7880('0x0'));var util=require(_0x7880('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7880('0x2'));var fs=require('fs');var Redis=require(_0x7880('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7880('0x4'));var logger=require(_0x7880('0x5'))('rpc');var config=require(_0x7880('0x6'));var jayson=require(_0x7880('0x7'));var client=jayson[_0x7880('0x8')][_0x7880('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8db4fb,_0x54df00,_0x2c90a4){return new BPromise(function(_0x24311e,_0x3569ac){return client[_0x7880('0xa')](_0x8db4fb,_0x2c90a4)[_0x7880('0xb')](function(_0x2763f6){logger[_0x7880('0xc')](_0x7880('0xd'),_0x54df00,_0x7880('0xe'));logger[_0x7880('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x54df00,'request\x20sent',JSON[_0x7880('0x10')](_0x2763f6));if(_0x2763f6[_0x7880('0x11')]){if(_0x2763f6[_0x7880('0x11')][_0x7880('0x12')]===0x1f4){logger[_0x7880('0x11')](_0x7880('0xd'),_0x54df00,_0x2763f6[_0x7880('0x11')]['message']);return _0x3569ac(_0x2763f6[_0x7880('0x11')][_0x7880('0x13')]);}logger[_0x7880('0x11')](_0x7880('0xd'),_0x54df00,_0x2763f6[_0x7880('0x11')]['message']);return _0x24311e(_0x2763f6[_0x7880('0x11')][_0x7880('0x13')]);}else{logger[_0x7880('0xc')](_0x7880('0xd'),_0x54df00,_0x7880('0xe'));_0x24311e(_0x2763f6[_0x7880('0x14')]['message']);}})[_0x7880('0x15')](function(_0x2c7510){logger['error'](_0x7880('0xd'),_0x54df00,_0x2c7510);_0x3569ac(_0x2c7510);});});}exports['CreateVoiceDialReport']=function(_0x4b65b0){var _0x2dc677=this;return new Promise(function(_0x4e1e60,_0x2e1195){return db[_0x7880('0x16')][_0x7880('0x17')](_0x4b65b0[_0x7880('0x18')],{'raw':_0x4b65b0['options']?_0x4b65b0[_0x7880('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7880('0xb')](function(_0x1a3cbf){logger[_0x7880('0xc')](_0x7880('0x1a'),_0x4b65b0);logger['debug'](_0x7880('0x1a'),_0x4b65b0,JSON[_0x7880('0x10')](_0x1a3cbf));_0x4e1e60(_0x1a3cbf);})['catch'](function(_0x4c2731){logger[_0x7880('0x11')]('CreateVoiceDialReport',_0x4c2731[_0x7880('0x13')],_0x4b65b0);_0x2e1195(_0x2dc677[_0x7880('0x11')](0x1f4,_0x4c2731[_0x7880('0x13')]));});});};exports[_0x7880('0x1b')]=function(_0xd685f6){var _0x130470=this;return new Promise(function(_0x35007a,_0x3c4019){return db[_0x7880('0x16')][_0x7880('0x1c')](_0xd685f6['body'],{'raw':_0xd685f6[_0x7880('0x19')]?_0xd685f6[_0x7880('0x19')][_0x7880('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd685f6[_0x7880('0x19')]?_0xd685f6[_0x7880('0x19')]['where']||null:null,'attributes':_0xd685f6['options']?_0xd685f6[_0x7880('0x19')][_0x7880('0x1e')]||null:null,'limit':_0xd685f6[_0x7880('0x19')]?_0xd685f6[_0x7880('0x19')][_0x7880('0x1f')]||null:null})[_0x7880('0xb')](function(_0x112c30){logger[_0x7880('0xc')](_0x7880('0x1b'),_0xd685f6);logger[_0x7880('0xf')](_0x7880('0x1b'),_0xd685f6,JSON[_0x7880('0x10')](_0x112c30));_0x35007a(_0x112c30);})['catch'](function(_0x31efd7){logger[_0x7880('0x11')](_0x7880('0x1b'),_0x31efd7['message'],_0xd685f6);_0x3c4019(_0x130470[_0x7880('0x11')](0x1f4,_0x31efd7['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 5b69aa1..c51b9ab 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 _0xefbf=['./voiceExtension.controller','get','isAuthenticated','index','show','post','/:id/applications','addApplications','put','delete','/:id','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x47f6be,_0x7d5c1c){var _0x501239=function(_0x5793be){while(--_0x5793be){_0x47f6be['push'](_0x47f6be['shift']());}};_0x501239(++_0x7d5c1c);}(_0xefbf,0x148));var _0xfefb=function(_0x38a2a9,_0xb5ecd5){_0x38a2a9=_0x38a2a9-0x0;var _0x3d7053=_0xefbf[_0x38a2a9];return _0x3d7053;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfefb('0x0'));var timeout=require(_0xfefb('0x1'));var express=require(_0xfefb('0x2'));var router=express[_0xfefb('0x3')]();var fs_extra=require(_0xfefb('0x4'));var auth=require(_0xfefb('0x5'));var interaction=require(_0xfefb('0x6'));var config=require(_0xfefb('0x7'));var controller=require(_0xfefb('0x8'));router[_0xfefb('0x9')]('/',auth[_0xfefb('0xa')](),controller[_0xfefb('0xb')]);router[_0xfefb('0x9')]('/:id',auth[_0xfefb('0xa')](),controller[_0xfefb('0xc')]);router[_0xfefb('0xd')]('/',auth[_0xfefb('0xa')](),controller['create']);router[_0xfefb('0xd')](_0xfefb('0xe'),auth['isAuthenticated'](),controller[_0xfefb('0xf')]);router[_0xfefb('0x10')]('/:id',auth[_0xfefb('0xa')](),controller['update']);router[_0xfefb('0x11')](_0xfefb('0x12'),auth[_0xfefb('0xa')](),controller[_0xfefb('0x13')]);module[_0xfefb('0x14')]=router; \ No newline at end of file +var _0x591d=['create','addApplications','put','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post'];(function(_0x41d1c3,_0x34c408){var _0x51cf15=function(_0x35da3e){while(--_0x35da3e){_0x41d1c3['push'](_0x41d1c3['shift']());}};_0x51cf15(++_0x34c408);}(_0x591d,0x95));var _0xd591=function(_0x5e78ef,_0x3458dd){_0x5e78ef=_0x5e78ef-0x0;var _0x41bae9=_0x591d[_0x5e78ef];return _0x41bae9;};'use strict';var multer=require(_0xd591('0x0'));var util=require('util');var path=require(_0xd591('0x1'));var timeout=require(_0xd591('0x2'));var express=require('express');var router=express[_0xd591('0x3')]();var fs_extra=require(_0xd591('0x4'));var auth=require(_0xd591('0x5'));var interaction=require(_0xd591('0x6'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xd591('0x7')]('/',auth[_0xd591('0x8')](),controller[_0xd591('0x9')]);router[_0xd591('0x7')](_0xd591('0xa'),auth['isAuthenticated'](),controller[_0xd591('0xb')]);router[_0xd591('0xc')]('/',auth['isAuthenticated'](),controller[_0xd591('0xd')]);router[_0xd591('0xc')]('/:id/applications',auth[_0xd591('0x8')](),controller[_0xd591('0xe')]);router[_0xd591('0xf')]('/:id',auth[_0xd591('0x8')](),controller[_0xd591('0x10')]);router['delete'](_0xd591('0xa'),auth[_0xd591('0x8')](),controller[_0xd591('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index d9e4d7d..f673c7f 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 _0x2dbb=['NoOp','ENUM','inbound','outbound','internal','inbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0x2dbb,0x178));var _0xb2db=function(_0x527f20,_0x37af13){_0x527f20=_0x527f20-0x0;var _0x2981d7=_0x2dbb[_0x527f20];return _0x2981d7;};'use strict';var Sequelize=require(_0xb2db('0x0'));module[_0xb2db('0x1')]={'context':{'type':Sequelize[_0xb2db('0x2')],'allowNull':![],'unique':_0xb2db('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xb2db('0x3')},'priority':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'1','unique':_0xb2db('0x3')},'tag':{'type':Sequelize[_0xb2db('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xb2db('0x2')],'allowNull':![],'defaultValue':_0xb2db('0x4')},'appdata':{'type':Sequelize[_0xb2db('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xb2db('0x5')](_0xb2db('0x6'),_0xb2db('0x7'),_0xb2db('0x8'),_0xb2db('0x9'),'outbound-fax',_0xb2db('0xa'),_0xb2db('0xb')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xb2db('0x2')],'allowNull':![],'defaultValue':_0xb2db('0xc')},'IntervalId':{'type':Sequelize[_0xb2db('0xd')]},'isApp':{'type':Sequelize[_0xb2db('0xe')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xb2db('0x2')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0xb2db('0xe')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xb2db('0xd')]},'recordingFormat':{'type':Sequelize[_0xb2db('0x2')],'defaultValue':_0xb2db('0xf')},'answer':{'type':Sequelize[_0xb2db('0xe')],'defaultValue':!![]},'name':{'type':Sequelize[_0xb2db('0x10')],'get':function(_0x453de9){return this[_0xb2db('0x11')](_0xb2db('0x12'));}},'alias':{'type':Sequelize[_0xb2db('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x128e=['inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','sequelize','exports','compositeIndex','STRING','NoOp','ENUM'];(function(_0x438874,_0x50bced){var _0x3a51c1=function(_0x92bd43){while(--_0x92bd43){_0x438874['push'](_0x438874['shift']());}};_0x3a51c1(++_0x50bced);}(_0x128e,0x1aa));var _0xe128=function(_0x5977fa,_0x27accd){_0x5977fa=_0x5977fa-0x0;var _0x3f313e=_0x128e[_0x5977fa];return _0x3f313e;};'use strict';var Sequelize=require(_0xe128('0x0'));module[_0xe128('0x1')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xe128('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xe128('0x3')],'allowNull':![],'defaultValue':'1','unique':_0xe128('0x2')},'tag':{'type':Sequelize[_0xe128('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0xe128('0x3')],'allowNull':![],'defaultValue':_0xe128('0x4')},'appdata':{'type':Sequelize[_0xe128('0x3')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xe128('0x5')](_0xe128('0x6'),_0xe128('0x7'),_0xe128('0x8'),_0xe128('0x9'),_0xe128('0xa'),_0xe128('0xb'),_0xe128('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0xe128('0x3')]},'interval':{'type':Sequelize[_0xe128('0x3')],'allowNull':![],'defaultValue':_0xe128('0xd')},'IntervalId':{'type':Sequelize[_0xe128('0xe')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xe128('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0xe128('0x3')],'allowNull':!![]},'record':{'type':Sequelize[_0xe128('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0xe128('0xe')]},'recordingFormat':{'type':Sequelize[_0xe128('0x3')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0xe128('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0xe128('0x10')],'get':function(_0x56f441){return this[_0xe128('0x11')]('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 59ce991..430b257 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 _0xa92f=['recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','value','includes','find','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','create','body','startsWith','exten','concat','user','role','InternalRoutes','internal','userProfileId','autoAssociation','error','update','context','description'];(function(_0x41c4a6,_0xae9564){var _0x14d706=function(_0x229c97){while(--_0x229c97){_0x41c4a6['push'](_0x41c4a6['shift']());}};_0x14d706(++_0xae9564);}(_0xa92f,0x68));var _0xfa92=function(_0x38e533,_0x462860){_0x38e533=_0x38e533-0x0;var _0x34df2f=_0xa92f[_0x38e533];return _0x34df2f;};'use strict';var _=require(_0xfa92('0x0'));var Redis=require('ioredis');var qs=require(_0xfa92('0x1'));var logger=require(_0xfa92('0x2'))(_0xfa92('0x3'));var config=require('../../config/environment');var db=require(_0xfa92('0x4'))['db'];config[_0xfa92('0x5')]=_[_0xfa92('0x6')](config[_0xfa92('0x5')],{'host':_0xfa92('0x7'),'port':0x18eb});var socket=require(_0xfa92('0x8'))(new Redis(config[_0xfa92('0x5')]));require(_0xfa92('0x9'))['register'](socket);function respondWithStatusCode(_0x17af73,_0x28eec6){_0x28eec6=_0x28eec6||0xcc;return function(_0x181662){if(_0x181662){return _0x17af73[_0xfa92('0xa')](_0x28eec6);}return _0x17af73[_0xfa92('0xb')](_0x28eec6)[_0xfa92('0xc')]();};}function respondWithResult(_0x4d0f10,_0x2e5ffd){_0x2e5ffd=_0x2e5ffd||0xc8;return function(_0x388ffc){if(_0x388ffc){return _0x4d0f10[_0xfa92('0xb')](_0x2e5ffd)[_0xfa92('0xd')](_0x388ffc);}};}function respondWithFilteredResult(_0x5ecc8e,_0x73598f){return function(_0x543a14){if(_0x543a14){var _0x2703c4=typeof _0x73598f[_0xfa92('0xe')]===_0xfa92('0xf')&&typeof _0x73598f['limit']===_0xfa92('0xf');var _0x383171=_0x543a14[_0xfa92('0x10')];var _0x27578b=_0x2703c4?0x0:_0x73598f['offset'];var _0x4a71a2=_0x2703c4?_0x543a14[_0xfa92('0x10')]:_0x73598f[_0xfa92('0xe')]+_0x73598f[_0xfa92('0x11')];var _0x20016c;if(_0x4a71a2>=_0x383171){_0x4a71a2=_0x383171;_0x20016c=0xc8;}else{_0x20016c=0xce;}_0x5ecc8e[_0xfa92('0xb')](_0x20016c);return _0x5ecc8e[_0xfa92('0x12')]('Content-Range',_0x27578b+'-'+_0x4a71a2+'/'+_0x383171)[_0xfa92('0xd')](_0x543a14);}return null;};}function removeEntity(_0x348ae8){return function(_0x1d7dd8){if(_0x1d7dd8){return _0x1d7dd8[_0xfa92('0x13')]()[_0xfa92('0x14')](function(){var _0x26a3d1=_0x1d7dd8[_0xfa92('0x15')]({'plain':!![]});var _0x44f6b8=[{'name':_0xfa92('0x16'),'value':_0xfa92('0x17'),'ignore':![]},{'name':_0xfa92('0x18'),'value':_0xfa92('0x19'),'ignore':![]},{'name':'InternalRoutes','value':'internal','ignore':![]}];var _0x5c3215=_(_0x44f6b8)['filter']('ignore')['map'](_0xfa92('0x1a'))[_0xfa92('0x1a')]();if(_[_0xfa92('0x1b')](_0x5c3215,_0x26a3d1['type'])){return;}var _0x577f07=_[_0xfa92('0x1c')](_0x44f6b8,[_0xfa92('0x1a'),_0x26a3d1[_0xfa92('0x1d')]])[_0xfa92('0x1e')];return db[_0xfa92('0x1f')][_0xfa92('0x13')]({'where':{'type':_0x577f07,'resourceId':_0x26a3d1['id']}})[_0xfa92('0x14')](function(){return _0x1d7dd8;});})[_0xfa92('0x14')](function(){_0x348ae8[_0xfa92('0xb')](0xcc)[_0xfa92('0xc')]();});}};}function handleEntityNotFound(_0x3b9e0a){return function(_0x41c24d){if(!_0x41c24d){_0x3b9e0a[_0xfa92('0xa')](0x194);}return _0x41c24d;};}function handleError(_0x24192c,_0x357af7){_0x357af7=_0x357af7||0x1f4;return function(_0xfd4cd){logger['error'](_0xfd4cd[_0xfa92('0x20')]);if(_0xfd4cd[_0xfa92('0x1e')]){delete _0xfd4cd[_0xfa92('0x1e')];}_0x24192c[_0xfa92('0xb')](_0x357af7)[_0xfa92('0x21')](_0xfd4cd);};}exports[_0xfa92('0x22')]=function(_0x5cf22b,_0x2343cb){var _0x9dc577={},_0xd3ed4f={},_0x271969={'count':0x0,'rows':[]};var _0x40a0af=_['map'](db[_0xfa92('0x23')][_0xfa92('0x24')],function(_0x487c9d){return{'name':_0x487c9d[_0xfa92('0x25')],'type':_0x487c9d[_0xfa92('0x1d')]['key']};});_0xd3ed4f[_0xfa92('0x26')]=_[_0xfa92('0x27')](_0x40a0af,_0xfa92('0x1e'));_0xd3ed4f[_0xfa92('0x28')]=_[_0xfa92('0x29')](_0x5cf22b[_0xfa92('0x28')]);_0xd3ed4f[_0xfa92('0x2a')]=_[_0xfa92('0x2b')](_0xd3ed4f[_0xfa92('0x26')],_0xd3ed4f[_0xfa92('0x28')]);_0x9dc577[_0xfa92('0x2c')]=_[_0xfa92('0x2b')](_0xd3ed4f[_0xfa92('0x26')],qs[_0xfa92('0x2d')](_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x2d')]));_0x9dc577[_0xfa92('0x2c')]=_0x9dc577[_0xfa92('0x2c')][_0xfa92('0x2e')]?_0x9dc577[_0xfa92('0x2c')]:_0xd3ed4f[_0xfa92('0x26')];if(!_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x2f')](_0xfa92('0x30'))){_0x9dc577['limit']=qs[_0xfa92('0x11')](_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x11')]);_0x9dc577['offset']=qs[_0xfa92('0xe')](_0x5cf22b[_0xfa92('0x28')][_0xfa92('0xe')]);}_0x9dc577['order']=qs['sort'](_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x31')]);_0x9dc577[_0xfa92('0x32')]=qs[_0xfa92('0x2a')](_[_0xfa92('0x33')](_0x5cf22b[_0xfa92('0x28')],_0xd3ed4f[_0xfa92('0x2a')]),_0x40a0af);if(_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x34')]){_0x9dc577[_0xfa92('0x32')]=_[_0xfa92('0x35')](_0x9dc577[_0xfa92('0x32')],{'$or':_[_0xfa92('0x27')](_0x40a0af,function(_0x54273a){if(_0x54273a[_0xfa92('0x1d')]!=='VIRTUAL'){var _0x2f64d5={};_0x2f64d5[_0x54273a[_0xfa92('0x1e')]]={'$like':'%'+_0x5cf22b[_0xfa92('0x28')][_0xfa92('0x34')]+'%'};return _0x2f64d5;}})});}_0x9dc577=_[_0xfa92('0x35')]({},_0x9dc577,_0x5cf22b[_0xfa92('0x36')]);var _0x21912f={'where':_0x9dc577[_0xfa92('0x32')]};return db[_0xfa92('0x23')][_0xfa92('0x10')](_0x21912f)[_0xfa92('0x14')](function(_0x42ee5c){_0x271969['count']=_0x42ee5c;if(_0x5cf22b['query'][_0xfa92('0x37')]){_0x9dc577[_0xfa92('0x38')]=[{'all':!![]}];}return db[_0xfa92('0x23')][_0xfa92('0x39')](_0x9dc577);})['then'](function(_0x401365){_0x271969[_0xfa92('0x3a')]=_0x401365;return _0x271969;})[_0xfa92('0x14')](respondWithFilteredResult(_0x2343cb,_0x9dc577))[_0xfa92('0x3b')](handleError(_0x2343cb,null));};exports['show']=function(_0xa4c010,_0x2930fc){var _0x5ec990={'raw':![],'where':{'id':_0xa4c010[_0xfa92('0x3c')]['id']}},_0x832738={};_0x832738[_0xfa92('0x26')]=_[_0xfa92('0x29')](db[_0xfa92('0x23')]['rawAttributes']);_0x832738['query']=_[_0xfa92('0x29')](_0xa4c010[_0xfa92('0x28')]);_0x832738['filters']=_[_0xfa92('0x2b')](_0x832738['model'],_0x832738['query']);_0x5ec990[_0xfa92('0x2c')]=_['intersection'](_0x832738[_0xfa92('0x26')],qs[_0xfa92('0x2d')](_0xa4c010[_0xfa92('0x28')][_0xfa92('0x2d')]));_0x5ec990[_0xfa92('0x2c')]=_0x5ec990[_0xfa92('0x2c')][_0xfa92('0x2e')]?_0x5ec990[_0xfa92('0x2c')]:_0x832738[_0xfa92('0x26')];if(_0xa4c010[_0xfa92('0x28')][_0xfa92('0x37')]){_0x5ec990[_0xfa92('0x38')]=[{'all':!![]}];}_0x5ec990=_[_0xfa92('0x35')]({},_0x5ec990,_0xa4c010['options']);return db[_0xfa92('0x23')]['find'](_0x5ec990)['then'](handleEntityNotFound(_0x2930fc,null))[_0xfa92('0x14')](respondWithResult(_0x2930fc,null))[_0xfa92('0x3b')](handleError(_0x2930fc,null));};exports[_0xfa92('0x13')]=function(_0x56ec12,_0x2a3391){return db[_0xfa92('0x23')][_0xfa92('0x1c')]({'where':{'id':_0x56ec12['params']['id']}})['then'](handleEntityNotFound(_0x2a3391,null))[_0xfa92('0x14')](removeEntity(_0x2a3391,null))[_0xfa92('0x3b')](handleError(_0x2a3391,null));};exports[_0xfa92('0x3d')]=function(_0x1c2497,_0x4e488d){if(_0x1c2497[_0xfa92('0x3e')][_0xfa92('0x1d')]===_0xfa92('0x19')&&!_[_0xfa92('0x3f')](_0x1c2497['body'][_0xfa92('0x40')],'_')){_0x1c2497[_0xfa92('0x3e')][_0xfa92('0x40')]='_'[_0xfa92('0x41')](_0x1c2497[_0xfa92('0x3e')][_0xfa92('0x40')]);}return db[_0xfa92('0x23')]['create'](_0x1c2497[_0xfa92('0x3e')],{'raw':![]})[_0xfa92('0x14')](function(_0x9db821){var _0x170464=_0x1c2497[_0xfa92('0x42')][_0xfa92('0x15')]({'plain':!![]});if(!_0x170464)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x170464[_0xfa92('0x43')]==='user'){var _0x5a8916=_0x9db821['get']({'plain':!![]});var _0x1fdf50=[{'name':'InboundRoutes','value':_0xfa92('0x17')},{'name':_0xfa92('0x18'),'value':_0xfa92('0x19')},{'name':_0xfa92('0x44'),'value':_0xfa92('0x45')}];var _0x453dce=_['find'](_0x1fdf50,[_0xfa92('0x1a'),_0x5a8916[_0xfa92('0x1d')]])[_0xfa92('0x1e')];return db['UserProfileSection'][_0xfa92('0x1c')]({'where':{'name':_0x453dce,'userProfileId':_0x170464[_0xfa92('0x46')]},'raw':!![]})[_0xfa92('0x14')](function(_0x121f6b){if(_0x121f6b&&_0x121f6b[_0xfa92('0x47')]===0x0){return db[_0xfa92('0x1f')]['create']({'name':_0x5a8916[_0xfa92('0x1e')],'resourceId':_0x5a8916['id'],'type':_0x121f6b[_0xfa92('0x1e')],'sectionId':_0x121f6b['id']},{})[_0xfa92('0x14')](function(){return _0x9db821;});}else{return _0x9db821;}})[_0xfa92('0x3b')](function(_0xba3c46){logger[_0xfa92('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xba3c46);throw _0xba3c46;});}return _0x9db821;})[_0xfa92('0x14')](respondWithResult(_0x4e488d,0xc9))[_0xfa92('0x3b')](handleError(_0x4e488d,null));};exports[_0xfa92('0x49')]=function(_0x53f00c,_0x172fd0){if(_0x53f00c['body']['id']){delete _0x53f00c[_0xfa92('0x3e')]['id'];}return db[_0xfa92('0x23')][_0xfa92('0x1c')]({'where':{'id':_0x53f00c[_0xfa92('0x3c')]['id']}})['then'](handleEntityNotFound(_0x172fd0,null))['then'](function(_0x54e682){if(_0x54e682){return db['VoiceExtension'][_0xfa92('0x49')](_[_0xfa92('0x33')](_0x53f00c['body'],['exten',_0xfa92('0x4a'),_0xfa92('0x4b'),_0xfa92('0x4c'),_0xfa92('0x4d'),_0xfa92('0x4e'),_0xfa92('0x4f')]),{'where':{'context':_0x54e682[_0xfa92('0x4a')],'exten':_0x54e682['exten']},'individualHooks':!![]})[_0xfa92('0x14')](function(_0x248212){return _0x248212;});}return null;})['then'](respondWithStatusCode(_0x172fd0,null))['catch'](handleError(_0x172fd0,null));};exports[_0xfa92('0x50')]=function(_0x23d741,_0x5244e3){var _0x23f333=_0x23d741[_0xfa92('0x3c')]['id'];var _0x108b14=_0x23d741[_0xfa92('0x3e')];var _0xbb7bcf=0xc8;var _0x29778d=null;return db[_0xfa92('0x51')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xfa92('0x52')][_0xfa92('0x53')]},function(_0x387c34){return db[_0xfa92('0x23')]['findOne']({'where':{'id':_0x23f333},'transaction':_0x387c34})['then'](function(_0x5718c6){if(_0x5718c6){return db[_0xfa92('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x23f333},'transaction':_0x387c34})[_0xfa92('0x14')](function(){var _0x485088=_['map'](_0x108b14,function(_0x4b555d){_0x4b555d[_0xfa92('0x54')]=_0x23f333;_0x4b555d['isApp']=!![];return _0x4b555d;});return _0x5718c6[_0xfa92('0x55')](_0x485088);})[_0xfa92('0x14')](function(_0x2c1008){return db[_0xfa92('0x23')][_0xfa92('0x56')](_0x2c1008,{'transaction':_0x387c34});});}else{_0xbb7bcf=0x194;_0x29778d=[];}});})[_0xfa92('0x14')](function(){if(_0xbb7bcf!==0x194){return db[_0xfa92('0x23')][_0xfa92('0x57')]({'where':{'isApp':!![],'VoiceExtensionId':_0x23f333},'order':_0xfa92('0x58')})[_0xfa92('0x14')](function(_0x7d07bc){_0x29778d=_0x7d07bc;});}})['catch'](function(_0x382fe1){_0xbb7bcf=0x1f4;logger[_0xfa92('0x48')](_0x382fe1['stack']);if(_0x382fe1[_0xfa92('0x1e')]){delete _0x382fe1[_0xfa92('0x1e')];}_0x29778d=_0x382fe1;})[_0xfa92('0x59')](function(){if(_0x29778d===null){_0x5244e3[_0xfa92('0xa')](_0xbb7bcf);}else{if(_0xbb7bcf===0x1f4){_0x5244e3['status'](_0xbb7bcf)[_0xfa92('0x21')](_0x29778d);}else{_0x5244e3[_0xfa92('0xb')](_0xbb7bcf)[_0xfa92('0xd')](_0x29778d);}}});}; \ No newline at end of file +var _0x6bbc=['stack','name','index','map','VoiceExtension','rawAttributes','model','query','keys','filters','attributes','fields','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','includeAll','include','rows','catch','show','intersection','merge','options','params','create','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','send','../../components/parsers/qs','api','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','outbound','internal','filter','ignore','value','find','type','UserProfileResource','error'];(function(_0x483635,_0x5e66ae){var _0x686b8=function(_0x50aab8){while(--_0x50aab8){_0x483635['push'](_0x483635['shift']());}};_0x686b8(++_0x5e66ae);}(_0x6bbc,0x91));var _0xc6bb=function(_0x1d86c2,_0x45468a){_0x1d86c2=_0x1d86c2-0x0;var _0x2f07e0=_0x6bbc[_0x1d86c2];return _0x2f07e0;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xc6bb('0x0'));var logger=require('../../config/logger')(_0xc6bb('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xc6bb('0x2')]=_[_0xc6bb('0x3')](config[_0xc6bb('0x2')],{'host':_0xc6bb('0x4'),'port':0x18eb});var socket=require(_0xc6bb('0x5'))(new Redis(config['redis']));require(_0xc6bb('0x6'))[_0xc6bb('0x7')](socket);function respondWithStatusCode(_0x557b98,_0x2e997b){_0x2e997b=_0x2e997b||0xcc;return function(_0x59bd17){if(_0x59bd17){return _0x557b98[_0xc6bb('0x8')](_0x2e997b);}return _0x557b98['status'](_0x2e997b)[_0xc6bb('0x9')]();};}function respondWithResult(_0x3dbedf,_0x1b4e64){_0x1b4e64=_0x1b4e64||0xc8;return function(_0x481f00){if(_0x481f00){return _0x3dbedf[_0xc6bb('0xa')](_0x1b4e64)['json'](_0x481f00);}};}function respondWithFilteredResult(_0x44b110,_0x1ae404){return function(_0x12aa71){if(_0x12aa71){var _0x216ab0=typeof _0x1ae404[_0xc6bb('0xb')]===_0xc6bb('0xc')&&typeof _0x1ae404['limit']===_0xc6bb('0xc');var _0x332789=_0x12aa71[_0xc6bb('0xd')];var _0x38c4ff=_0x216ab0?0x0:_0x1ae404['offset'];var _0x25f7fd=_0x216ab0?_0x12aa71[_0xc6bb('0xd')]:_0x1ae404['offset']+_0x1ae404['limit'];var _0x37207b;if(_0x25f7fd>=_0x332789){_0x25f7fd=_0x332789;_0x37207b=0xc8;}else{_0x37207b=0xce;}_0x44b110[_0xc6bb('0xa')](_0x37207b);return _0x44b110[_0xc6bb('0xe')](_0xc6bb('0xf'),_0x38c4ff+'-'+_0x25f7fd+'/'+_0x332789)[_0xc6bb('0x10')](_0x12aa71);}return null;};}function removeEntity(_0x3bffd9){return function(_0x2a6e77){if(_0x2a6e77){return _0x2a6e77[_0xc6bb('0x11')]()[_0xc6bb('0x12')](function(){var _0x30f12c=_0x2a6e77[_0xc6bb('0x13')]({'plain':!![]});var _0x6cbbfd=[{'name':_0xc6bb('0x14'),'value':_0xc6bb('0x15'),'ignore':![]},{'name':'OutboundRoutes','value':_0xc6bb('0x16'),'ignore':![]},{'name':'InternalRoutes','value':_0xc6bb('0x17'),'ignore':![]}];var _0x338b2b=_(_0x6cbbfd)[_0xc6bb('0x18')](_0xc6bb('0x19'))['map']('value')[_0xc6bb('0x1a')]();if(_['includes'](_0x338b2b,_0x30f12c['type'])){return;}var _0x2733c4=_[_0xc6bb('0x1b')](_0x6cbbfd,[_0xc6bb('0x1a'),_0x30f12c[_0xc6bb('0x1c')]])['name'];return db[_0xc6bb('0x1d')]['destroy']({'where':{'type':_0x2733c4,'resourceId':_0x30f12c['id']}})['then'](function(){return _0x2a6e77;});})[_0xc6bb('0x12')](function(){_0x3bffd9['status'](0xcc)[_0xc6bb('0x9')]();});}};}function handleEntityNotFound(_0x3f3732){return function(_0x4833ef){if(!_0x4833ef){_0x3f3732[_0xc6bb('0x8')](0x194);}return _0x4833ef;};}function handleError(_0x3c5152,_0x4f1ad4){_0x4f1ad4=_0x4f1ad4||0x1f4;return function(_0x83e821){logger[_0xc6bb('0x1e')](_0x83e821[_0xc6bb('0x1f')]);if(_0x83e821[_0xc6bb('0x20')]){delete _0x83e821[_0xc6bb('0x20')];}_0x3c5152[_0xc6bb('0xa')](_0x4f1ad4)['send'](_0x83e821);};}exports[_0xc6bb('0x21')]=function(_0x1b1e6f,_0x12bc64){var _0x35fa21={},_0x4b4a56={},_0x786774={'count':0x0,'rows':[]};var _0x522e8d=_[_0xc6bb('0x22')](db[_0xc6bb('0x23')][_0xc6bb('0x24')],function(_0x362e29){return{'name':_0x362e29['fieldName'],'type':_0x362e29[_0xc6bb('0x1c')]['key']};});_0x4b4a56[_0xc6bb('0x25')]=_[_0xc6bb('0x22')](_0x522e8d,'name');_0x4b4a56[_0xc6bb('0x26')]=_[_0xc6bb('0x27')](_0x1b1e6f[_0xc6bb('0x26')]);_0x4b4a56[_0xc6bb('0x28')]=_['intersection'](_0x4b4a56[_0xc6bb('0x25')],_0x4b4a56[_0xc6bb('0x26')]);_0x35fa21[_0xc6bb('0x29')]=_['intersection'](_0x4b4a56[_0xc6bb('0x25')],qs['fields'](_0x1b1e6f[_0xc6bb('0x26')][_0xc6bb('0x2a')]));_0x35fa21['attributes']=_0x35fa21['attributes'][_0xc6bb('0x2b')]?_0x35fa21[_0xc6bb('0x29')]:_0x4b4a56['model'];if(!_0x1b1e6f['query'][_0xc6bb('0x2c')]('nolimit')){_0x35fa21['limit']=qs[_0xc6bb('0x2d')](_0x1b1e6f['query'][_0xc6bb('0x2d')]);_0x35fa21['offset']=qs[_0xc6bb('0xb')](_0x1b1e6f[_0xc6bb('0x26')][_0xc6bb('0xb')]);}_0x35fa21[_0xc6bb('0x2e')]=qs['sort'](_0x1b1e6f[_0xc6bb('0x26')][_0xc6bb('0x2f')]);_0x35fa21[_0xc6bb('0x30')]=qs[_0xc6bb('0x28')](_['pick'](_0x1b1e6f[_0xc6bb('0x26')],_0x4b4a56['filters']),_0x522e8d);if(_0x1b1e6f['query'][_0xc6bb('0x18')]){_0x35fa21[_0xc6bb('0x30')]=_['merge'](_0x35fa21[_0xc6bb('0x30')],{'$or':_[_0xc6bb('0x22')](_0x522e8d,function(_0x56f340){if(_0x56f340['type']!==_0xc6bb('0x31')){var _0x48f205={};_0x48f205[_0x56f340['name']]={'$like':'%'+_0x1b1e6f[_0xc6bb('0x26')][_0xc6bb('0x18')]+'%'};return _0x48f205;}})});}_0x35fa21=_['merge']({},_0x35fa21,_0x1b1e6f['options']);var _0x38ea45={'where':_0x35fa21[_0xc6bb('0x30')]};return db['VoiceExtension'][_0xc6bb('0xd')](_0x38ea45)['then'](function(_0x14ee7e){_0x786774[_0xc6bb('0xd')]=_0x14ee7e;if(_0x1b1e6f[_0xc6bb('0x26')][_0xc6bb('0x32')]){_0x35fa21[_0xc6bb('0x33')]=[{'all':!![]}];}return db[_0xc6bb('0x23')]['findAll'](_0x35fa21);})['then'](function(_0x1b4f1f){_0x786774[_0xc6bb('0x34')]=_0x1b4f1f;return _0x786774;})['then'](respondWithFilteredResult(_0x12bc64,_0x35fa21))[_0xc6bb('0x35')](handleError(_0x12bc64,null));};exports[_0xc6bb('0x36')]=function(_0x3a5f88,_0x27c22f){var _0x23e41b={'raw':![],'where':{'id':_0x3a5f88['params']['id']}},_0x4c1228={};_0x4c1228[_0xc6bb('0x25')]=_[_0xc6bb('0x27')](db[_0xc6bb('0x23')]['rawAttributes']);_0x4c1228['query']=_[_0xc6bb('0x27')](_0x3a5f88[_0xc6bb('0x26')]);_0x4c1228[_0xc6bb('0x28')]=_[_0xc6bb('0x37')](_0x4c1228[_0xc6bb('0x25')],_0x4c1228[_0xc6bb('0x26')]);_0x23e41b[_0xc6bb('0x29')]=_[_0xc6bb('0x37')](_0x4c1228[_0xc6bb('0x25')],qs['fields'](_0x3a5f88[_0xc6bb('0x26')][_0xc6bb('0x2a')]));_0x23e41b[_0xc6bb('0x29')]=_0x23e41b['attributes']['length']?_0x23e41b[_0xc6bb('0x29')]:_0x4c1228[_0xc6bb('0x25')];if(_0x3a5f88['query']['includeAll']){_0x23e41b[_0xc6bb('0x33')]=[{'all':!![]}];}_0x23e41b=_[_0xc6bb('0x38')]({},_0x23e41b,_0x3a5f88[_0xc6bb('0x39')]);return db['VoiceExtension'][_0xc6bb('0x1b')](_0x23e41b)[_0xc6bb('0x12')](handleEntityNotFound(_0x27c22f,null))[_0xc6bb('0x12')](respondWithResult(_0x27c22f,null))[_0xc6bb('0x35')](handleError(_0x27c22f,null));};exports[_0xc6bb('0x11')]=function(_0x160a08,_0x374d06){return db[_0xc6bb('0x23')]['find']({'where':{'id':_0x160a08[_0xc6bb('0x3a')]['id']}})[_0xc6bb('0x12')](handleEntityNotFound(_0x374d06,null))[_0xc6bb('0x12')](removeEntity(_0x374d06,null))[_0xc6bb('0x35')](handleError(_0x374d06,null));};exports[_0xc6bb('0x3b')]=function(_0x231996,_0x205a6f){if(_0x231996[_0xc6bb('0x3c')][_0xc6bb('0x1c')]===_0xc6bb('0x16')&&!_['startsWith'](_0x231996[_0xc6bb('0x3c')][_0xc6bb('0x3d')],'_')){_0x231996[_0xc6bb('0x3c')][_0xc6bb('0x3d')]='_'[_0xc6bb('0x3e')](_0x231996[_0xc6bb('0x3c')][_0xc6bb('0x3d')]);}return db['VoiceExtension'][_0xc6bb('0x3b')](_0x231996[_0xc6bb('0x3c')],{'raw':![]})[_0xc6bb('0x12')](function(_0x5668b3){var _0x2e3f2f=_0x231996['user'][_0xc6bb('0x13')]({'plain':!![]});if(!_0x2e3f2f)throw new Error(_0xc6bb('0x3f'));if(_0x2e3f2f[_0xc6bb('0x40')]==='user'){var _0x45c6fe=_0x5668b3[_0xc6bb('0x13')]({'plain':!![]});var _0x19748d=[{'name':_0xc6bb('0x14'),'value':'inbound'},{'name':'OutboundRoutes','value':_0xc6bb('0x16')},{'name':_0xc6bb('0x41'),'value':_0xc6bb('0x17')}];var _0x1e9507=_[_0xc6bb('0x1b')](_0x19748d,[_0xc6bb('0x1a'),_0x45c6fe[_0xc6bb('0x1c')]])[_0xc6bb('0x20')];return db[_0xc6bb('0x42')][_0xc6bb('0x1b')]({'where':{'name':_0x1e9507,'userProfileId':_0x2e3f2f[_0xc6bb('0x43')]},'raw':!![]})[_0xc6bb('0x12')](function(_0x1c0aeb){if(_0x1c0aeb&&_0x1c0aeb[_0xc6bb('0x44')]===0x0){return db[_0xc6bb('0x1d')][_0xc6bb('0x3b')]({'name':_0x45c6fe[_0xc6bb('0x20')],'resourceId':_0x45c6fe['id'],'type':_0x1c0aeb[_0xc6bb('0x20')],'sectionId':_0x1c0aeb['id']},{})[_0xc6bb('0x12')](function(){return _0x5668b3;});}else{return _0x5668b3;}})[_0xc6bb('0x35')](function(_0x207489){logger[_0xc6bb('0x1e')](_0xc6bb('0x45'),_0x207489);throw _0x207489;});}return _0x5668b3;})['then'](respondWithResult(_0x205a6f,0xc9))[_0xc6bb('0x35')](handleError(_0x205a6f,null));};exports[_0xc6bb('0x46')]=function(_0x5b7ca3,_0x3e8189){if(_0x5b7ca3[_0xc6bb('0x3c')]['id']){delete _0x5b7ca3[_0xc6bb('0x3c')]['id'];}return db['VoiceExtension'][_0xc6bb('0x1b')]({'where':{'id':_0x5b7ca3[_0xc6bb('0x3a')]['id']}})[_0xc6bb('0x12')](handleEntityNotFound(_0x3e8189,null))[_0xc6bb('0x12')](function(_0x31d341){if(_0x31d341){return db[_0xc6bb('0x23')][_0xc6bb('0x46')](_['pick'](_0x5b7ca3[_0xc6bb('0x3c')],['exten',_0xc6bb('0x47'),_0xc6bb('0x48'),_0xc6bb('0x49'),_0xc6bb('0x4a'),'mandatoryDisposition',_0xc6bb('0x4b')]),{'where':{'context':_0x31d341[_0xc6bb('0x47')],'exten':_0x31d341[_0xc6bb('0x3d')]},'individualHooks':!![]})[_0xc6bb('0x12')](function(_0x42f896){return _0x42f896;});}return null;})['then'](respondWithStatusCode(_0x3e8189,null))[_0xc6bb('0x35')](handleError(_0x3e8189,null));};exports[_0xc6bb('0x4c')]=function(_0x5d731b,_0x1a1fbe){var _0x40e1d2=_0x5d731b[_0xc6bb('0x3a')]['id'];var _0x8f2d94=_0x5d731b['body'];var _0xdf9c56=0xc8;var _0x1866a0=null;return db[_0xc6bb('0x4d')][_0xc6bb('0x4e')]({'isolationLevel':db[_0xc6bb('0x4d')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x5b0dfd){return db['VoiceExtension'][_0xc6bb('0x4f')]({'where':{'id':_0x40e1d2},'transaction':_0x5b0dfd})[_0xc6bb('0x12')](function(_0xedf870){if(_0xedf870){return db[_0xc6bb('0x23')][_0xc6bb('0x11')]({'where':{'VoiceExtensionId':_0x40e1d2},'transaction':_0x5b0dfd})['then'](function(){var _0x1ac490=_['map'](_0x8f2d94,function(_0x3ed236){_0x3ed236[_0xc6bb('0x50')]=_0x40e1d2;_0x3ed236[_0xc6bb('0x51')]=!![];return _0x3ed236;});return _0xedf870[_0xc6bb('0x52')](_0x1ac490);})['then'](function(_0x4641ff){return db[_0xc6bb('0x23')][_0xc6bb('0x53')](_0x4641ff,{'transaction':_0x5b0dfd});});}else{_0xdf9c56=0x194;_0x1866a0=[];}});})[_0xc6bb('0x12')](function(){if(_0xdf9c56!==0x194){return db[_0xc6bb('0x23')][_0xc6bb('0x54')]({'where':{'isApp':!![],'VoiceExtensionId':_0x40e1d2},'order':_0xc6bb('0x55')})[_0xc6bb('0x12')](function(_0x269277){_0x1866a0=_0x269277;});}})[_0xc6bb('0x35')](function(_0x4499b1){_0xdf9c56=0x1f4;logger[_0xc6bb('0x1e')](_0x4499b1[_0xc6bb('0x1f')]);if(_0x4499b1[_0xc6bb('0x20')]){delete _0x4499b1['name'];}_0x1866a0=_0x4499b1;})[_0xc6bb('0x56')](function(){if(_0x1866a0===null){_0x1a1fbe[_0xc6bb('0x8')](_0xdf9c56);}else{if(_0xdf9c56===0x1f4){_0x1a1fbe[_0xc6bb('0xa')](_0xdf9c56)[_0xc6bb('0x57')](_0x1866a0);}else{_0x1a1fbe[_0xc6bb('0xa')](_0xdf9c56)['json'](_0x1866a0);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index b20add8..4016fb3 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 _0xbad5=['VoiceExtension','setMaxListeners','update','emit','hasOwnProperty','events'];(function(_0x1697b5,_0x9c02f3){var _0x5894e3=function(_0x43466b){while(--_0x43466b){_0x1697b5['push'](_0x1697b5['shift']());}};_0x5894e3(++_0x9c02f3);}(_0xbad5,0x1a9));var _0x5bad=function(_0x55f5e0,_0x4c0d32){_0x55f5e0=_0x55f5e0-0x0;var _0x51f3d5=_0xbad5[_0x55f5e0];return _0x51f3d5;};'use strict';var EventEmitter=require(_0x5bad('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x5bad('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5bad('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5bad('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2f6be1){return function(_0x210c5d,_0x581fb3,_0x312264){VoiceExtensionEvents[_0x5bad('0x4')](_0x2f6be1+':'+_0x210c5d['id'],_0x210c5d);VoiceExtensionEvents[_0x5bad('0x4')](_0x2f6be1,_0x210c5d);_0x312264(null);};}for(var e in events){if(events[_0x5bad('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x77af=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','VoiceExtension'];(function(_0x3df7c7,_0x15e60f){var _0x267105=function(_0x531785){while(--_0x531785){_0x3df7c7['push'](_0x3df7c7['shift']());}};_0x267105(++_0x15e60f);}(_0x77af,0x92));var _0xf77a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x77af[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0xf77a('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xf77a('0x1')](0x0);var events={'afterCreate':_0xf77a('0x2'),'afterUpdate':'update','afterDestroy':_0xf77a('0x3')};function emitEvent(_0x13e219){return function(_0xf479b2,_0x46859d,_0x45b2b6){VoiceExtensionEvents[_0xf77a('0x4')](_0x13e219+':'+_0xf479b2['id'],_0xf479b2);VoiceExtensionEvents[_0xf77a('0x4')](_0x13e219,_0xf479b2);_0x45b2b6(null);};}for(var e in events){if(events[_0xf77a('0x5')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0xf77a('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index c6f6653..32a975e 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 _0xb6cb=['outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','timeout','options','url','split','param','prefix','phone','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','Interval','findAll','interval','IntervalId','then','length','intervals','map','filter','toLowerCase','hasOwnProperty','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','includes','app','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','exten','NoOp','CDR(routeAlias)=','alias','No\x20alias\x20set','inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','${EXTEN:','cutdigits','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab'];(function(_0x11ba46,_0x1d6752){var _0x1c8c6f=function(_0x4cf96f){while(--_0x4cf96f){_0x11ba46['push'](_0x11ba46['shift']());}};_0x1c8c6f(++_0x1d6752);}(_0xb6cb,0x189));var _0xbb6c=function(_0x25f805,_0x59caf3){_0x25f805=_0x25f805-0x0;var _0xf6628f=_0xb6cb[_0x25f805];return _0xf6628f;};'use strict';var _=require(_0xbb6c('0x0'));var attributes=require(_0xbb6c('0x1'));module[_0xbb6c('0x2')]=function(_0x17f02c){var _0x22c8a8=_0x17f02c[_0xbb6c('0x3')];function _0x374ebe(_0x287318){var _0x1ab2d3=0x2;var _0x4c7063=[{'type':_0x287318[_0xbb6c('0x4')],'app':_0xbb6c('0x5'),'appdata':'CDR(type)='+_0x287318['type'],'context':_0x287318[_0xbb6c('0x6')],'exten':_0x287318[_0xbb6c('0x7')],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']},{'type':_0x287318['type'],'app':_0x287318['alias']?_0xbb6c('0x5'):_0xbb6c('0x8'),'appdata':_0x287318['alias']?_0xbb6c('0x9')+_0x287318[_0xbb6c('0xa')]:_0xbb6c('0xb'),'context':_0x287318['context'],'exten':_0x287318['exten'],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']}];if(_0x287318[_0xbb6c('0x4')]===_0xbb6c('0xc')){_0x4c7063['push']({'type':_0xbb6c('0xc'),'app':_0xbb6c('0x5'),'appdata':'CDR(routeid)='+_0x287318['id'],'context':_0x287318['context'],'exten':_0x287318[_0xbb6c('0x7')],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']});}_0x4c7063[_0xbb6c('0xd')]({'type':_0x287318[_0xbb6c('0x4')],'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0xe'),'context':_0x287318[_0xbb6c('0x6')],'exten':_0x287318['exten'],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']},{'type':_0x287318[_0xbb6c('0x4')],'app':'Set','appdata':_0xbb6c('0xf'),'context':_0x287318['context'],'exten':_0x287318['exten'],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']},{'type':_0x287318['type'],'app':_0xbb6c('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x287318[_0xbb6c('0x6')],'exten':_0x287318[_0xbb6c('0x7')],'priority':_0x1ab2d3++,'VoiceExtensionId':_0x287318['id']});return _0x4c7063;}function _0x329142(_0x2cf4f4){var _0x5d0856=0x2;var _0x8e4536=[{'type':_0xbb6c('0x10'),'app':'Set','appdata':'CDR(type)=outbound','context':_0x2cf4f4['context'],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0x2cf4f4[_0xbb6c('0xa')]?_0xbb6c('0x5'):'NoOp','appdata':_0x2cf4f4[_0xbb6c('0xa')]?_0xbb6c('0x9')+_0x2cf4f4[_0xbb6c('0xa')]:'No\x20alias\x20set','context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0xbb6c('0x5'),'appdata':'CDR(destination)='+(_0x2cf4f4['cutdigits']?_0xbb6c('0x11')+_0x2cf4f4[_0xbb6c('0x12')]+'}':_0xbb6c('0x13')),'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':'Set','appdata':_0xbb6c('0x14')+_0x2cf4f4['id'],'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4['exten'],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0xbb6c('0x15'),'appdata':_0xbb6c('0x16')+(_0x5d0856+0x2)+_0xbb6c('0x17')+(_0x5d0856+0x1)+')','context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0xbb6c('0x5'),'appdata':_0x2cf4f4['cutdigits']?_0xbb6c('0x18')+_0x2cf4f4['cutdigits']+'}':_0xbb6c('0x19'),'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4['exten'],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0xe'),'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4['exten'],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':'Set','appdata':_0xbb6c('0xf'),'context':_0x2cf4f4['context'],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':'Set','appdata':_0xbb6c('0x1a'),'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':'outbound','app':'Set','appdata':_0xbb6c('0x1b')+_0x2cf4f4['id'],'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4['exten'],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']}];if(_0x2cf4f4['hasOwnProperty'](_0xbb6c('0x1c'))&&_0x2cf4f4[_0xbb6c('0x1c')]!==_0xbb6c('0x1d')){_0x8e4536['push']({'type':_0xbb6c('0x10'),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x1e'),'context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']},{'type':_0xbb6c('0x10'),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x1f')+_0x2cf4f4[_0xbb6c('0x1c')]||'wav','context':_0x2cf4f4[_0xbb6c('0x6')],'exten':_0x2cf4f4[_0xbb6c('0x7')],'priority':_0x5d0856++,'VoiceExtensionId':_0x2cf4f4['id']});}return _0x8e4536;}function _0x1cad93(_0x2272f1,_0x34ddd3){var _0x1045bc=[{'name':_0xbb6c('0x20'),'param':0x0},{'name':_0xbb6c('0x21'),'param':0x1},{'name':_0xbb6c('0x22'),'param':0x2},{'name':_0xbb6c('0x23'),'param':0x3}];var _0x25443a={};var _0x12cc83=_0x34ddd3[_0xbb6c('0x24')](',');var _0x2dfd13=[];for(var _0xd930ff=0x0;_0xd930ff<_0x1045bc['length'];_0xd930ff++){switch(_0x1045bc[_0xd930ff]['name']){case _0xbb6c('0x20'):_0x25443a[_0xbb6c('0x20')]=_0x12cc83[_0x1045bc[_0xd930ff]['param']][_0xbb6c('0x24')]('/')[0x1];_0x25443a['phone']=_0x12cc83[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]][_0xbb6c('0x24')]('/')[0x2];_0x25443a[_0xbb6c('0x26')]=_0x25443a[_0xbb6c('0x27')]?_0x25443a['phone'][_0xbb6c('0x24')]('$')[0x0]:undefined;_0x25443a[_0xbb6c('0x27')]=_0x2272f1[_0xbb6c('0x12')]?(_0x25443a['prefix']||'')+'${EXTEN:'+_0x2272f1[_0xbb6c('0x12')]+'}':(_0x25443a['prefix']||'')+_0xbb6c('0x13');_0x2dfd13[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]]=['SIP',_0x25443a[_0xbb6c('0x20')],_0x25443a[_0xbb6c('0x27')]]['join']('/');break;case _0xbb6c('0x22'):_0x25443a['options']=_0x12cc83[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]];if(_0x2272f1[_0xbb6c('0x1c')]!==_0xbb6c('0x1d')){if(_0x25443a['options'][_0xbb6c('0x28')](_0xbb6c('0x29'))<0x0){_0x25443a['options']+=_0xbb6c('0x29');}}else{_0x25443a[_0xbb6c('0x22')]=_0x25443a[_0xbb6c('0x22')]['replace'](_0xbb6c('0x29'),'');}_0x2dfd13[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]]=_0x25443a[_0xbb6c('0x22')];break;default:_0x2dfd13[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]]=_0x12cc83[_0x1045bc[_0xd930ff][_0xbb6c('0x25')]];}}return _0x2dfd13[_0xbb6c('0x2a')](',');}function _0x2fa23a(_0x32932f,_0x24126d,_0x46c025){return new Promise(function(_0x8fdff3,_0x36d1dd){var _0x905cd=[];if(_[_0xbb6c('0x2b')](_0x24126d))return _0x8fdff3(_0x905cd);_0x22c8a8[_0xbb6c('0x2c')][_0xbb6c('0x2d')]({'attributes':['id',_0xbb6c('0x2e'),_0xbb6c('0x2f')],'raw':!![]})[_0xbb6c('0x30')](function(_0x58c509){for(var _0x468a10=0x0,_0x5a1d1c=0x0;_0x468a10<_0x24126d[_0xbb6c('0x31')];_0x468a10++,_0x5a1d1c=0x0){var _0x27a362=_0x24126d[_0x468a10];var _0x66fe42=[];var _0x1c3c45=[];delete _0x27a362['id'];if(_0x27a362['interval']!=='*,*,*,*'){_0x27a362[_0xbb6c('0x32')]=[_0x27a362[_0xbb6c('0x2e')]];}else{_0x27a362[_0xbb6c('0x32')]=_0x27a362[_0xbb6c('0x2f')]?_[_0xbb6c('0x33')](_[_0xbb6c('0x34')](_0x58c509,{'IntervalId':_0x27a362[_0xbb6c('0x2f')]}),_0xbb6c('0x2e')):[];}_0x27a362[_0xbb6c('0x6')]=_0x32932f[_0xbb6c('0x6')];_0x27a362[_0xbb6c('0x7')]=_0x32932f[_0xbb6c('0x7')];if(_0x27a362[_0xbb6c('0x4')])_0x27a362[_0xbb6c('0x4')]=_0x27a362['type'][_0xbb6c('0x35')]();if(_0x32932f[_0xbb6c('0x4')]==='outbound'){if(_0x27a362[_0xbb6c('0x36')](_0xbb6c('0x37'))&&_0x27a362[_0xbb6c('0x37')]&&_0x27a362[_0xbb6c('0x37')]!=='--'){_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362[_0xbb6c('0x4')][_0xbb6c('0x35')](),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x38')+_0x27a362[_0xbb6c('0x37')],'context':_0x32932f[_0xbb6c('0x6')],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});}_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362[_0xbb6c('0x4')][_0xbb6c('0x35')](),'app':'ExecIf','appdata':_0xbb6c('0x39')+(_0x27a362[_0xbb6c('0x3a')]?'Set(CALLERID(all)='+_0x27a362['callerID']+')':_0xbb6c('0x3b')),'context':_0x32932f[_0xbb6c('0x6')],'exten':_0x32932f['exten'],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});}else{if(_0x27a362[_0xbb6c('0x36')](_0xbb6c('0x3c'))){if([_0xbb6c('0x3d'),'playback'][_0xbb6c('0x3e')](_0x27a362[_0xbb6c('0x3f')][_0xbb6c('0x35')]())&&_0x27a362['appType']!=='custom'){if(_0x27a362[_0xbb6c('0x3c')]){_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362[_0xbb6c('0x4')][_0xbb6c('0x35')](),'app':_0xbb6c('0x15'),'appdata':_0xbb6c('0x40'),'context':_0x32932f['context'],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362[_0xbb6c('0x4')]['toLowerCase'](),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x41'),'context':_0x32932f[_0xbb6c('0x6')],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')]['length']+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});}else{_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362['type'][_0xbb6c('0x35')](),'app':_0xbb6c('0x15'),'appdata':_0xbb6c('0x42'),'context':_0x32932f['context'],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});_0x66fe42[_0xbb6c('0xd')]({'type':_0x27a362['type'][_0xbb6c('0x35')](),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x43'),'context':_0x32932f['context'],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});}}}}for(var _0x190038=0x0;_0x190038<_0x27a362['intervals'][_0xbb6c('0x31')];_0x190038++){var _0x3310c6=_0x46c025+_0x27a362[_0xbb6c('0x32')]['length'];var _0x5ebf15=_0x190038===_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]-0x1?_0x46c025+_0x66fe42['length']+_0x1c3c45['length']+0x2:_0x46c025+_0x190038+0x1;_0x66fe42['splice'](_0x190038,0x0,{'type':_0x32932f['type'],'app':_0xbb6c('0x44'),'appdata':_0x27a362[_0xbb6c('0x32')][_0x190038]+'?'+_0x32932f['context']+_0xbb6c('0x45')+_0x3310c6+':'+_0x32932f['context']+',${EXTEN},'+_0x5ebf15,'exten':_0x32932f['exten'],'context':_0x32932f[_0xbb6c('0x6')],'priority':_0x46c025+_0x190038,'VoiceExtensionId':_0x32932f['id']});}if(_0x27a362[_0xbb6c('0x46')]===_0xbb6c('0x47')){_0x27a362['appdata']=_0x1cad93(_0x32932f,_0x27a362[_0xbb6c('0x48')]);}if(_0x27a362['appType']===_0xbb6c('0x49')){_0x66fe42['push']({'type':_0x27a362[_0xbb6c('0x4')][_0xbb6c('0x35')](),'app':_0xbb6c('0x5'),'appdata':_0xbb6c('0x4a'),'context':_0x32932f[_0xbb6c('0x6')],'exten':_0x32932f[_0xbb6c('0x7')],'priority':_0x27a362[_0xbb6c('0x32')][_0xbb6c('0x31')]+_0x46c025+_0x5a1d1c++,'VoiceExtensionId':_0x32932f['id']});}_0x27a362[_0xbb6c('0x4b')]=_0x66fe42[_0xbb6c('0x31')]?_['last'](_0x66fe42)[_0xbb6c('0x4b')]+0x1:_0x46c025;_0x905cd=_[_0xbb6c('0x4c')](_0x905cd,_0x66fe42,[_0x27a362],_0x1c3c45);_0x46c025=_[_0xbb6c('0x4d')](_0x905cd)[_0xbb6c('0x4b')]+0x1;}return _0x8fdff3(_0x905cd);})[_0xbb6c('0x4e')](function(_0x2fb699){_0x36d1dd(_0x2fb699);});});}return _0x17f02c[_0xbb6c('0x4f')](_0xbb6c('0x50'),attributes,{'tableName':_0xbb6c('0x51'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x5cbc6b){var _0x8b18cf=this[_0xbb6c('0x52')]({'plain':!![]});var _0x1600b6=_0x8b18cf['type']==='outbound'?_0x329142(_0x8b18cf):_0x374ebe(_0x8b18cf);return _0x2fa23a(_0x8b18cf,_0x5cbc6b,_[_0xbb6c('0x4d')](_0x1600b6)[_0xbb6c('0x4b')]+0x1)[_0xbb6c('0x30')](function(_0x112925){var _0x3517d9=_[_0xbb6c('0x4c')](_0x1600b6,_0x112925);_0x3517d9[_0xbb6c('0xd')]({'type':_0x8b18cf['type'],'app':_0xbb6c('0x53'),'exten':_0x8b18cf[_0xbb6c('0x7')],'context':_0x8b18cf[_0xbb6c('0x6')],'priority':_[_0xbb6c('0x4d')](_0x3517d9)[_0xbb6c('0x4b')]+0x1,'VoiceExtensionId':_0x8b18cf['id']});return _0x3517d9;});}}});}; \ No newline at end of file +var _0x6be5=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','cutdigits','${EXTEN:','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','url','split','length','name','param','phone','prefix','${EXTEN}','SIP','join','options','none','indexOf','U(xcally-mixmonitor-context)','findAll','interval','then','intervals','IntervalId','map','filter','tag','toLowerCase'];(function(_0x1ee8ca,_0x538c0a){var _0x1cb63b=function(_0x2f1282){while(--_0x2f1282){_0x1ee8ca['push'](_0x1ee8ca['shift']());}};_0x1cb63b(++_0x538c0a);}(_0x6be5,0x71));var _0x56be=function(_0x4ffdcf,_0x29428e){_0x4ffdcf=_0x4ffdcf-0x0;var _0x4433ae=_0x6be5[_0x4ffdcf];return _0x4433ae;};'use strict';var _=require(_0x56be('0x0'));var attributes=require(_0x56be('0x1'));module[_0x56be('0x2')]=function(_0x22fba){var _0x2c51d5=_0x22fba[_0x56be('0x3')];function _0x1a1355(_0x44f17d){var _0x30e28b=0x2;var _0x235ad1=[{'type':_0x44f17d[_0x56be('0x4')],'app':_0x56be('0x5'),'appdata':'CDR(type)='+_0x44f17d[_0x56be('0x4')],'context':_0x44f17d[_0x56be('0x6')],'exten':_0x44f17d['exten'],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']},{'type':_0x44f17d[_0x56be('0x4')],'app':_0x44f17d[_0x56be('0x7')]?_0x56be('0x5'):_0x56be('0x8'),'appdata':_0x44f17d[_0x56be('0x7')]?_0x56be('0x9')+_0x44f17d['alias']:_0x56be('0xa'),'context':_0x44f17d[_0x56be('0x6')],'exten':_0x44f17d[_0x56be('0xb')],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']}];if(_0x44f17d[_0x56be('0x4')]===_0x56be('0xc')){_0x235ad1[_0x56be('0xd')]({'type':_0x56be('0xc'),'app':_0x56be('0x5'),'appdata':_0x56be('0xe')+_0x44f17d['id'],'context':_0x44f17d['context'],'exten':_0x44f17d[_0x56be('0xb')],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']});}_0x235ad1[_0x56be('0xd')]({'type':_0x44f17d[_0x56be('0x4')],'app':_0x56be('0x5'),'appdata':_0x56be('0xf'),'context':_0x44f17d[_0x56be('0x6')],'exten':_0x44f17d[_0x56be('0xb')],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']},{'type':_0x44f17d[_0x56be('0x4')],'app':_0x56be('0x5'),'appdata':_0x56be('0x10'),'context':_0x44f17d[_0x56be('0x6')],'exten':_0x44f17d['exten'],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']},{'type':_0x44f17d[_0x56be('0x4')],'app':_0x56be('0x5'),'appdata':_0x56be('0x11'),'context':_0x44f17d[_0x56be('0x6')],'exten':_0x44f17d[_0x56be('0xb')],'priority':_0x30e28b++,'VoiceExtensionId':_0x44f17d['id']});return _0x235ad1;}function _0x2f83cc(_0x38f38b){var _0x53b5fa=0x2;var _0x3d83cc=[{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':'CDR(type)=outbound','context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x38f38b[_0x56be('0x7')]?'Set':'NoOp','appdata':_0x38f38b[_0x56be('0x7')]?_0x56be('0x9')+_0x38f38b[_0x56be('0x7')]:_0x56be('0xa'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':'CDR(destination)='+(_0x38f38b[_0x56be('0x13')]?_0x56be('0x14')+_0x38f38b[_0x56be('0x13')]+'}':'${EXTEN}'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':'outbound','app':_0x56be('0x5'),'appdata':_0x56be('0xe')+_0x38f38b['id'],'context':_0x38f38b['context'],'exten':_0x38f38b[_0x56be('0xb')],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x53b5fa+0x2)+_0x56be('0x16')+(_0x53b5fa+0x1)+')','context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b[_0x56be('0xb')],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':'outbound','app':_0x56be('0x5'),'appdata':_0x38f38b[_0x56be('0x13')]?_0x56be('0x17')+_0x38f38b[_0x56be('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':_0x56be('0xf'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b[_0x56be('0xb')],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':_0x56be('0x10'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':_0x56be('0x11'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b[_0x56be('0xb')],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':_0x56be('0x18')+_0x38f38b['id'],'context':_0x38f38b['context'],'exten':_0x38f38b[_0x56be('0xb')],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']}];if(_0x38f38b[_0x56be('0x19')](_0x56be('0x1a'))&&_0x38f38b['recordingFormat']!=='none'){_0x3d83cc['push']({'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':_0x56be('0x1b'),'context':_0x38f38b['context'],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']},{'type':_0x56be('0x12'),'app':_0x56be('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x38f38b[_0x56be('0x1a')]||_0x56be('0x1c'),'context':_0x38f38b[_0x56be('0x6')],'exten':_0x38f38b['exten'],'priority':_0x53b5fa++,'VoiceExtensionId':_0x38f38b['id']});}return _0x3d83cc;}function _0x25ee58(_0x2952c7,_0x39cfc7){var _0x28955e=[{'name':_0x56be('0x1d'),'param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x56be('0x1e'),'param':0x3}];var _0xf08622={};var _0x391c67=_0x39cfc7[_0x56be('0x1f')](',');var _0x14202d=[];for(var _0x33b9ea=0x0;_0x33b9ea<_0x28955e[_0x56be('0x20')];_0x33b9ea++){switch(_0x28955e[_0x33b9ea][_0x56be('0x21')]){case _0x56be('0x1d'):_0xf08622['trunk']=_0x391c67[_0x28955e[_0x33b9ea][_0x56be('0x22')]][_0x56be('0x1f')]('/')[0x1];_0xf08622[_0x56be('0x23')]=_0x391c67[_0x28955e[_0x33b9ea][_0x56be('0x22')]]['split']('/')[0x2];_0xf08622['prefix']=_0xf08622[_0x56be('0x23')]?_0xf08622[_0x56be('0x23')][_0x56be('0x1f')]('$')[0x0]:undefined;_0xf08622['phone']=_0x2952c7[_0x56be('0x13')]?(_0xf08622[_0x56be('0x24')]||'')+_0x56be('0x14')+_0x2952c7[_0x56be('0x13')]+'}':(_0xf08622[_0x56be('0x24')]||'')+_0x56be('0x25');_0x14202d[_0x28955e[_0x33b9ea][_0x56be('0x22')]]=[_0x56be('0x26'),_0xf08622['trunk'],_0xf08622[_0x56be('0x23')]][_0x56be('0x27')]('/');break;case _0x56be('0x28'):_0xf08622['options']=_0x391c67[_0x28955e[_0x33b9ea][_0x56be('0x22')]];if(_0x2952c7[_0x56be('0x1a')]!==_0x56be('0x29')){if(_0xf08622[_0x56be('0x28')][_0x56be('0x2a')](_0x56be('0x2b'))<0x0){_0xf08622['options']+=_0x56be('0x2b');}}else{_0xf08622['options']=_0xf08622[_0x56be('0x28')]['replace'](_0x56be('0x2b'),'');}_0x14202d[_0x28955e[_0x33b9ea][_0x56be('0x22')]]=_0xf08622['options'];break;default:_0x14202d[_0x28955e[_0x33b9ea][_0x56be('0x22')]]=_0x391c67[_0x28955e[_0x33b9ea][_0x56be('0x22')]];}}return _0x14202d[_0x56be('0x27')](',');}function _0x3791e2(_0x2868d2,_0x3771a6,_0x50b98b){return new Promise(function(_0xcf98ea,_0x26a84a){var _0x339d75=[];if(_['isEmpty'](_0x3771a6))return _0xcf98ea(_0x339d75);_0x2c51d5['Interval'][_0x56be('0x2c')]({'attributes':['id',_0x56be('0x2d'),'IntervalId'],'raw':!![]})[_0x56be('0x2e')](function(_0x2e8a94){for(var _0x17a55d=0x0,_0x51f15a=0x0;_0x17a55d<_0x3771a6['length'];_0x17a55d++,_0x51f15a=0x0){var _0x539a05=_0x3771a6[_0x17a55d];var _0x25da2e=[];var _0x37b836=[];delete _0x539a05['id'];if(_0x539a05[_0x56be('0x2d')]!=='*,*,*,*'){_0x539a05[_0x56be('0x2f')]=[_0x539a05['interval']];}else{_0x539a05[_0x56be('0x2f')]=_0x539a05[_0x56be('0x30')]?_[_0x56be('0x31')](_[_0x56be('0x32')](_0x2e8a94,{'IntervalId':_0x539a05[_0x56be('0x30')]}),_0x56be('0x2d')):[];}_0x539a05['context']=_0x2868d2[_0x56be('0x6')];_0x539a05[_0x56be('0xb')]=_0x2868d2['exten'];if(_0x539a05['type'])_0x539a05[_0x56be('0x4')]=_0x539a05[_0x56be('0x4')]['toLowerCase']();if(_0x2868d2[_0x56be('0x4')]===_0x56be('0x12')){if(_0x539a05[_0x56be('0x19')](_0x56be('0x33'))&&_0x539a05[_0x56be('0x33')]&&_0x539a05['tag']!=='--'){_0x25da2e[_0x56be('0xd')]({'type':_0x539a05[_0x56be('0x4')][_0x56be('0x34')](),'app':_0x56be('0x5'),'appdata':'CDR(tag)='+_0x539a05['tag'],'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2[_0x56be('0xb')],'priority':_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});}_0x25da2e[_0x56be('0xd')]({'type':_0x539a05[_0x56be('0x4')][_0x56be('0x34')](),'app':_0x56be('0x15'),'appdata':_0x56be('0x35')+(_0x539a05[_0x56be('0x36')]?'Set(CALLERID(all)='+_0x539a05['callerID']+')':_0x56be('0x37')),'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2[_0x56be('0xb')],'priority':_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});}else{if(_0x539a05[_0x56be('0x19')](_0x56be('0x38'))){if([_0x56be('0x39'),_0x56be('0x3a')][_0x56be('0x3b')](_0x539a05[_0x56be('0x3c')][_0x56be('0x34')]())&&_0x539a05[_0x56be('0x3d')]!==_0x56be('0x3e')){if(_0x539a05['answer']){_0x25da2e['push']({'type':_0x539a05[_0x56be('0x4')][_0x56be('0x34')](),'app':_0x56be('0x15'),'appdata':_0x56be('0x3f'),'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2['exten'],'priority':_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});_0x25da2e[_0x56be('0xd')]({'type':_0x539a05['type'][_0x56be('0x34')](),'app':_0x56be('0x5'),'appdata':_0x56be('0x40'),'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2[_0x56be('0xb')],'priority':_0x539a05[_0x56be('0x2f')]['length']+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});}else{_0x25da2e[_0x56be('0xd')]({'type':_0x539a05[_0x56be('0x4')][_0x56be('0x34')](),'app':_0x56be('0x15'),'appdata':_0x56be('0x41'),'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2['exten'],'priority':_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});_0x25da2e[_0x56be('0xd')]({'type':_0x539a05[_0x56be('0x4')]['toLowerCase'](),'app':_0x56be('0x5'),'appdata':_0x56be('0x42'),'context':_0x2868d2['context'],'exten':_0x2868d2[_0x56be('0xb')],'priority':_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});}}}}for(var _0x451561=0x0;_0x451561<_0x539a05['intervals'][_0x56be('0x20')];_0x451561++){var _0x1650e2=_0x50b98b+_0x539a05[_0x56be('0x2f')][_0x56be('0x20')];var _0x5d30ce=_0x451561===_0x539a05[_0x56be('0x2f')][_0x56be('0x20')]-0x1?_0x50b98b+_0x25da2e[_0x56be('0x20')]+_0x37b836['length']+0x2:_0x50b98b+_0x451561+0x1;_0x25da2e[_0x56be('0x43')](_0x451561,0x0,{'type':_0x2868d2[_0x56be('0x4')],'app':_0x56be('0x44'),'appdata':_0x539a05['intervals'][_0x451561]+'?'+_0x2868d2[_0x56be('0x6')]+_0x56be('0x45')+_0x1650e2+':'+_0x2868d2[_0x56be('0x6')]+_0x56be('0x45')+_0x5d30ce,'exten':_0x2868d2[_0x56be('0xb')],'context':_0x2868d2[_0x56be('0x6')],'priority':_0x50b98b+_0x451561,'VoiceExtensionId':_0x2868d2['id']});}if(_0x539a05[_0x56be('0x3d')]===_0x56be('0x46')){_0x539a05[_0x56be('0x47')]=_0x25ee58(_0x2868d2,_0x539a05[_0x56be('0x47')]);}if(_0x539a05['appType']===_0x56be('0x48')){_0x25da2e[_0x56be('0xd')]({'type':_0x539a05[_0x56be('0x4')]['toLowerCase'](),'app':'Set','appdata':_0x56be('0x49'),'context':_0x2868d2[_0x56be('0x6')],'exten':_0x2868d2[_0x56be('0xb')],'priority':_0x539a05[_0x56be('0x2f')]['length']+_0x50b98b+_0x51f15a++,'VoiceExtensionId':_0x2868d2['id']});}_0x539a05[_0x56be('0x4a')]=_0x25da2e['length']?_[_0x56be('0x4b')](_0x25da2e)['priority']+0x1:_0x50b98b;_0x339d75=_[_0x56be('0x4c')](_0x339d75,_0x25da2e,[_0x539a05],_0x37b836);_0x50b98b=_[_0x56be('0x4b')](_0x339d75)[_0x56be('0x4a')]+0x1;}return _0xcf98ea(_0x339d75);})[_0x56be('0x4d')](function(_0x485221){_0x26a84a(_0x485221);});});}return _0x22fba[_0x56be('0x4e')](_0x56be('0x4f'),attributes,{'tableName':_0x56be('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4fe999){var _0x2ad5db=this[_0x56be('0x51')]({'plain':!![]});var _0x394f8a=_0x2ad5db[_0x56be('0x4')]===_0x56be('0x12')?_0x2f83cc(_0x2ad5db):_0x1a1355(_0x2ad5db);return _0x3791e2(_0x2ad5db,_0x4fe999,_[_0x56be('0x4b')](_0x394f8a)['priority']+0x1)['then'](function(_0x307d2b){var _0x4b7eb6=_[_0x56be('0x4c')](_0x394f8a,_0x307d2b);_0x4b7eb6[_0x56be('0xd')]({'type':_0x2ad5db[_0x56be('0x4')],'app':_0x56be('0x52'),'exten':_0x2ad5db[_0x56be('0xb')],'context':_0x2ad5db[_0x56be('0x6')],'priority':_[_0x56be('0x4b')](_0x4b7eb6)['priority']+0x1,'VoiceExtensionId':_0x2ad5db['id']});return _0x4b7eb6;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index d93ccab..133f091 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 _0xadf0=['../../mysqldb','../../config/utils','rpc','redis','defaults','socket.io-emitter','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','findAll','options','raw','where','attributes','limit','map','include','model','debug','stringify','util','moment','bluebird','randomstring','ioredis'];(function(_0x3ff0b0,_0x5b985d){var _0x334054=function(_0x465e40){while(--_0x465e40){_0x3ff0b0['push'](_0x3ff0b0['shift']());}};_0x334054(++_0x5b985d);}(_0xadf0,0x12d));var _0x0adf=function(_0xa9713a,_0x466f35){_0xa9713a=_0xa9713a-0x0;var _0x1c2744=_0xadf0[_0xa9713a];return _0x1c2744;};'use strict';var _=require('lodash');var util=require(_0x0adf('0x0'));var moment=require(_0x0adf('0x1'));var BPromise=require(_0x0adf('0x2'));var rs=require(_0x0adf('0x3'));var fs=require('fs');var Redis=require(_0x0adf('0x4'));var db=require(_0x0adf('0x5'))['db'];var utils=require(_0x0adf('0x6'));var logger=require('../../config/logger')(_0x0adf('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0x0adf('0x8')]=_[_0x0adf('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0adf('0xa'))(new Redis(config[_0x0adf('0x8')]));require('./voiceExtension.socket')[_0x0adf('0xb')](socket);function respondWithRpcPromise(_0x1aac49,_0x5cb4d9,_0x4712d7){return new BPromise(function(_0x169c4c,_0x4d7775){return client['request'](_0x1aac49,_0x4712d7)[_0x0adf('0xc')](function(_0x43cbf5){logger[_0x0adf('0xd')](_0x0adf('0xe'),_0x5cb4d9,_0x0adf('0xf'));logger['debug'](_0x0adf('0x10'),_0x5cb4d9,_0x0adf('0xf'),JSON['stringify'](_0x43cbf5));if(_0x43cbf5[_0x0adf('0x11')]){if(_0x43cbf5['error'][_0x0adf('0x12')]===0x1f4){logger['error'](_0x0adf('0xe'),_0x5cb4d9,_0x43cbf5[_0x0adf('0x11')][_0x0adf('0x13')]);return _0x4d7775(_0x43cbf5[_0x0adf('0x11')][_0x0adf('0x13')]);}logger[_0x0adf('0x11')](_0x0adf('0xe'),_0x5cb4d9,_0x43cbf5[_0x0adf('0x11')]['message']);return _0x169c4c(_0x43cbf5[_0x0adf('0x11')][_0x0adf('0x13')]);}else{logger['info'](_0x0adf('0xe'),_0x5cb4d9,'request\x20sent');_0x169c4c(_0x43cbf5[_0x0adf('0x14')][_0x0adf('0x13')]);}})[_0x0adf('0x15')](function(_0x3170da){logger['error'](_0x0adf('0xe'),_0x5cb4d9,_0x3170da);_0x4d7775(_0x3170da);});});}exports[_0x0adf('0x16')]=function(_0x283f67){var _0x3f8b08=this;return new Promise(function(_0x420c4f,_0x42f1d6){return db['VoiceExtension'][_0x0adf('0x17')]({'raw':_0x283f67[_0x0adf('0x18')]?_0x283f67[_0x0adf('0x18')][_0x0adf('0x19')]===undefined?!![]:![]:!![],'where':_0x283f67['options']?_0x283f67[_0x0adf('0x18')][_0x0adf('0x1a')]||null:null,'attributes':_0x283f67[_0x0adf('0x18')]?_0x283f67['options'][_0x0adf('0x1b')]||null:null,'limit':_0x283f67[_0x0adf('0x18')]?_0x283f67[_0x0adf('0x18')][_0x0adf('0x1c')]||null:null,'include':_0x283f67[_0x0adf('0x18')]?_0x283f67[_0x0adf('0x18')]['include']?_[_0x0adf('0x1d')](_0x283f67[_0x0adf('0x18')][_0x0adf('0x1e')],function(_0x39a337){return{'model':db[_0x39a337[_0x0adf('0x1f')]],'as':_0x39a337['as'],'attributes':_0x39a337[_0x0adf('0x1b')],'include':_0x39a337['include']?_[_0x0adf('0x1d')](_0x39a337[_0x0adf('0x1e')],function(_0x272205){return{'model':db[_0x272205['model']],'as':_0x272205['as'],'attributes':_0x272205['attributes'],'include':_0x272205['include']?_[_0x0adf('0x1d')](_0x272205[_0x0adf('0x1e')],function(_0x364fcf){return{'model':db[_0x364fcf[_0x0adf('0x1f')]],'as':_0x364fcf['as'],'attributes':_0x364fcf[_0x0adf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0adf('0xc')](function(_0x19fa54){logger[_0x0adf('0xd')](_0x0adf('0x16'),_0x283f67);logger[_0x0adf('0x20')](_0x0adf('0x16'),_0x283f67,JSON[_0x0adf('0x21')](_0x19fa54));_0x420c4f(_0x19fa54);})[_0x0adf('0x15')](function(_0x366d20){logger[_0x0adf('0x11')]('GetVoiceExtension',_0x366d20[_0x0adf('0x13')],_0x283f67);_0x42f1d6(_0x3f8b08[_0x0adf('0x11')](0x1f4,_0x366d20[_0x0adf('0x13')]));});});}; \ No newline at end of file +var _0xc359=['options','raw','where','limit','map','include','attributes','debug','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceExtension','findAll'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc359,0x1d9));var _0x9c35=function(_0x3fe6df,_0x5a04d4){_0x3fe6df=_0x3fe6df-0x0;var _0x372a0e=_0xc359[_0x3fe6df];return _0x372a0e;};'use strict';var _=require('lodash');var util=require(_0x9c35('0x0'));var moment=require('moment');var BPromise=require(_0x9c35('0x1'));var rs=require(_0x9c35('0x2'));var fs=require('fs');var Redis=require(_0x9c35('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9c35('0x4'));var logger=require('../../config/logger')(_0x9c35('0x5'));var config=require('../../config/environment');var jayson=require(_0x9c35('0x6'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x9c35('0x7')],{'host':_0x9c35('0x8'),'port':0x18eb});var socket=require(_0x9c35('0x9'))(new Redis(config[_0x9c35('0x7')]));require(_0x9c35('0xa'))[_0x9c35('0xb')](socket);function respondWithRpcPromise(_0x56d3fb,_0x21df9a,_0x467add){return new BPromise(function(_0x500420,_0x4e3834){return client['request'](_0x56d3fb,_0x467add)[_0x9c35('0xc')](function(_0x4d012f){logger[_0x9c35('0xd')](_0x9c35('0xe'),_0x21df9a,_0x9c35('0xf'));logger['debug'](_0x9c35('0x10'),_0x21df9a,_0x9c35('0xf'),JSON[_0x9c35('0x11')](_0x4d012f));if(_0x4d012f[_0x9c35('0x12')]){if(_0x4d012f[_0x9c35('0x12')]['code']===0x1f4){logger[_0x9c35('0x12')](_0x9c35('0xe'),_0x21df9a,_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);return _0x4e3834(_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);}logger[_0x9c35('0x12')](_0x9c35('0xe'),_0x21df9a,_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);return _0x500420(_0x4d012f[_0x9c35('0x12')][_0x9c35('0x13')]);}else{logger[_0x9c35('0xd')](_0x9c35('0xe'),_0x21df9a,_0x9c35('0xf'));_0x500420(_0x4d012f['result'][_0x9c35('0x13')]);}})[_0x9c35('0x14')](function(_0x26911d){logger[_0x9c35('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x21df9a,_0x26911d);_0x4e3834(_0x26911d);});});}exports[_0x9c35('0x15')]=function(_0x3c3858){var _0x2edb26=this;return new Promise(function(_0x50d7b8,_0x69d118){return db['VoiceExtension'][_0x9c35('0x16')]({'raw':_0x3c3858['options']?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x18')]===undefined?!![]:![]:!![],'where':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x19')]||null:null,'attributes':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')]['attributes']||null:null,'limit':_0x3c3858['options']?_0x3c3858[_0x9c35('0x17')][_0x9c35('0x1a')]||null:null,'include':_0x3c3858[_0x9c35('0x17')]?_0x3c3858[_0x9c35('0x17')]['include']?_[_0x9c35('0x1b')](_0x3c3858['options'][_0x9c35('0x1c')],function(_0x4bf0ea){return{'model':db[_0x4bf0ea['model']],'as':_0x4bf0ea['as'],'attributes':_0x4bf0ea[_0x9c35('0x1d')],'include':_0x4bf0ea[_0x9c35('0x1c')]?_[_0x9c35('0x1b')](_0x4bf0ea['include'],function(_0x3bfdfd){return{'model':db[_0x3bfdfd['model']],'as':_0x3bfdfd['as'],'attributes':_0x3bfdfd[_0x9c35('0x1d')],'include':_0x3bfdfd[_0x9c35('0x1c')]?_[_0x9c35('0x1b')](_0x3bfdfd[_0x9c35('0x1c')],function(_0x4525c9){return{'model':db[_0x4525c9['model']],'as':_0x4525c9['as'],'attributes':_0x4525c9[_0x9c35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9c35('0xc')](function(_0x568925){logger[_0x9c35('0xd')](_0x9c35('0x15'),_0x3c3858);logger[_0x9c35('0x1e')](_0x9c35('0x15'),_0x3c3858,JSON[_0x9c35('0x11')](_0x568925));_0x50d7b8(_0x568925);})['catch'](function(_0x37379c){logger[_0x9c35('0x12')](_0x9c35('0x15'),_0x37379c[_0x9c35('0x13')],_0x3c3858);_0x69d118(_0x2edb26[_0x9c35('0x12')](0x1f4,_0x37379c[_0x9c35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index b7510f4..9b23022 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 _0x5fab=['emit','removeListener','register','length','./voiceExtension.events','save','update'];(function(_0x44fc0d,_0x15a897){var _0x3da2d1=function(_0x3036f9){while(--_0x3036f9){_0x44fc0d['push'](_0x44fc0d['shift']());}};_0x3da2d1(++_0x15a897);}(_0x5fab,0x177));var _0xb5fa=function(_0x2d2885,_0x667d70){_0x2d2885=_0x2d2885-0x0;var _0x2cea6=_0x5fab[_0x2d2885];return _0x2cea6;};'use strict';var VoiceExtensionEvents=require(_0xb5fa('0x0'));var events=[_0xb5fa('0x1'),'remove',_0xb5fa('0x2')];function createListener(_0x2e2a50,_0x3fc227){return function(_0x316ad0){_0x3fc227[_0xb5fa('0x3')](_0x2e2a50,_0x316ad0);};}function removeListener(_0x595d8b,_0x29390a){return function(){VoiceExtensionEvents[_0xb5fa('0x4')](_0x595d8b,_0x29390a);};}exports[_0xb5fa('0x5')]=function(_0x44df89){for(var _0x4a0249=0x0,_0x5d70f6=events[_0xb5fa('0x6')];_0x4a0249<_0x5d70f6;_0x4a0249++){var _0x1aec3e=events[_0x4a0249];var _0x9c7bce=createListener('voiceExtension:'+_0x1aec3e,_0x44df89);VoiceExtensionEvents['on'](_0x1aec3e,_0x9c7bce);}}; \ No newline at end of file +var _0x326f=['update','emit','removeListener','register','length','./voiceExtension.events'];(function(_0x51feb0,_0x1637f8){var _0x1ac519=function(_0x34232e){while(--_0x34232e){_0x51feb0['push'](_0x51feb0['shift']());}};_0x1ac519(++_0x1637f8);}(_0x326f,0xd1));var _0xf326=function(_0x12cf56,_0x3831f8){_0x12cf56=_0x12cf56-0x0;var _0x1be76d=_0x326f[_0x12cf56];return _0x1be76d;};'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 f40c0f3..5607be7 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 _0x9f0e=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','/:id','isAuthenticated','/:id/messages','getMessages','post','create','put','update','delete','destroy','multer','util'];(function(_0x9a41ad,_0x2b6a8f){var _0x446d06=function(_0x31d936){while(--_0x31d936){_0x9a41ad['push'](_0x9a41ad['shift']());}};_0x446d06(++_0x2b6a8f);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1c87c1,_0x35d5c4){_0x1c87c1=_0x1c87c1-0x0;var _0x1523b6=_0x9f0e[_0x1c87c1];return _0x1523b6;};'use strict';var multer=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var path=require(_0xe9f0('0x2'));var timeout=require(_0xe9f0('0x3'));var express=require(_0xe9f0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe9f0('0x5'));var interaction=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var controller=require(_0xe9f0('0x8'));router[_0xe9f0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe9f0('0x9')](_0xe9f0('0xa'),auth[_0xe9f0('0xb')](),controller['show']);router[_0xe9f0('0x9')](_0xe9f0('0xc'),auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xd')]);router[_0xe9f0('0xe')]('/',auth[_0xe9f0('0xb')](),controller[_0xe9f0('0xf')]);router[_0xe9f0('0x10')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x11')]);router[_0xe9f0('0x12')](_0xe9f0('0xa'),auth['isAuthenticated'](),controller[_0xe9f0('0x13')]);module['exports']=router; \ No newline at end of file +var _0x781d=['/:id','show','post','put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x22ceb6,_0x96269d){var _0x3fab26=function(_0x562f1e){while(--_0x562f1e){_0x22ceb6['push'](_0x22ceb6['shift']());}};_0x3fab26(++_0x96269d);}(_0x781d,0x14a));var _0xd781=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x781d[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0x9')]('/:id/messages',auth[_0xd781('0xa')](),controller['getMessages']);router[_0xd781('0xe')]('/',auth[_0xd781('0xa')](),controller['create']);router[_0xd781('0xf')](_0xd781('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xd781('0x10')](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0x11')]);module[_0xd781('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 1b8ad1d..af4e5ba 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 _0xdee8=['getDataValue','mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','email','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdee8,0x17c));var _0x8dee=function(_0x4cc699,_0x362682){_0x4cc699=_0x4cc699-0x0;var _0x5b4101=_0xdee8[_0x4cc699];return _0x5b4101;};'use strict';var Sequelize=require(_0x8dee('0x0'));module[_0x8dee('0x1')]={'customer_id':{'type':Sequelize[_0x8dee('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0x8dee('0x3'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0x8dee('0x2')],'defaultValue':'','allowNull':![],'unique':_0x8dee('0x4')},'password':{'type':Sequelize[_0x8dee('0x2')]},'fullname':{'type':Sequelize[_0x8dee('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x23b638){this['setDataValue'](_0x8dee('0x5'),typeof _0x23b638==='string'&&_0x23b638[_0x8dee('0x6')]()?_0x23b638[_0x8dee('0x6')]():null);}},'pager':{'type':Sequelize[_0x8dee('0x2')]},'tz':{'type':Sequelize[_0x8dee('0x2')],'defaultValue':_0x8dee('0x7')},'attach':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':_0x8dee('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8dee('0x8')]('yes','no'),'defaultValue':_0x8dee('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8dee('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8dee('0x8')]('yes','no'),'defaultValue':_0x8dee('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8dee('0x8')](_0x8dee('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8dee('0x8')]('yes','no'),'defaultValue':_0x8dee('0x9'),'allowNull':![]},'stamp':{'type':_0x8dee('0xb')},'emailsubject':{'type':Sequelize[_0x8dee('0x2')]},'emailbody':{'type':Sequelize[_0x8dee('0x2')]},'maxsecs':{'type':Sequelize[_0x8dee('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8dee('0xd')],'get':function(){return this['getDataValue'](_0x8dee('0xe'))+_0x8dee('0xf')+this[_0x8dee('0x10')](_0x8dee('0x11'));}}}; \ No newline at end of file +var _0xc55e=['getDataValue','fullname','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x40eebf,_0x231390){var _0x400b1c=function(_0x12fb32){while(--_0x12fb32){_0x40eebf['push'](_0x40eebf['shift']());}};_0x400b1c(++_0x231390);}(_0xc55e,0xc9));var _0xec55=function(_0x111975,_0x2e5305){_0x111975=_0x111975-0x0;var _0x4508cb=_0xc55e[_0x111975];return _0x4508cb;};'use strict';var Sequelize=require(_0xec55('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xec55('0x1')],'defaultValue':_0xec55('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0xec55('0x3')},'password':{'type':Sequelize[_0xec55('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xec55('0x1')],'validate':{'isEmail':!![]},'set':function(_0x28e45b){this[_0xec55('0x4')](_0xec55('0x5'),typeof _0x28e45b===_0xec55('0x6')&&_0x28e45b[_0xec55('0x7')]()?_0x28e45b['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0xec55('0x1')],'defaultValue':_0xec55('0x8')},'attach':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xec55('0x9'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xec55('0x9'),'no'),'defaultValue':_0xec55('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xec55('0x1')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xec55('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xec55('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xec55('0xa')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xec55('0xa')]('yes','no'),'defaultValue':_0xec55('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xec55('0xa')](_0xec55('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xec55('0xa')]('yes','no'),'defaultValue':_0xec55('0x9'),'allowNull':![]},'stamp':{'type':_0xec55('0xc')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xec55('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xec55('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xec55('0xe')],'get':function(){return this[_0xec55('0xf')](_0xec55('0x10'))+'\x20-\x20'+this[_0xec55('0xf')](_0xec55('0x11'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index a60ba04..69424ad 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 _0x1c7c=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceMail','includeAll','include','findAll','rows','catch','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path'];(function(_0x107f10,_0x5529f2){var _0x811cab=function(_0xc160ea){while(--_0xc160ea){_0x107f10['push'](_0x107f10['shift']());}};_0x811cab(++_0x5529f2);}(_0x1c7c,0x164));var _0xc1c7=function(_0x439653,_0x19e12d){_0x439653=_0x439653-0x0;var _0x23f244=_0x1c7c[_0x439653];return _0x23f244;};'use strict';var emlformat=require(_0xc1c7('0x0'));var rimraf=require(_0xc1c7('0x1'));var zipdir=require(_0xc1c7('0x2'));var jsonpatch=require(_0xc1c7('0x3'));var rp=require('request-promise');var moment=require(_0xc1c7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc1c7('0x5'));var util=require(_0xc1c7('0x6'));var path=require(_0xc1c7('0x7'));var sox=require(_0xc1c7('0x8'));var csv=require(_0xc1c7('0x9'));var ejs=require(_0xc1c7('0xa'));var fs=require('fs');var fs_extra=require(_0xc1c7('0xb'));var _=require(_0xc1c7('0xc'));var squel=require(_0xc1c7('0xd'));var crypto=require(_0xc1c7('0xe'));var jsforce=require(_0xc1c7('0xf'));var deskjs=require(_0xc1c7('0x10'));var toCsv=require(_0xc1c7('0x9'));var querystring=require(_0xc1c7('0x11'));var Papa=require(_0xc1c7('0x12'));var Redis=require(_0xc1c7('0x13'));var authService=require(_0xc1c7('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xc1c7('0x15'));var hardwareService=require(_0xc1c7('0x16'));var logger=require('../../config/logger')(_0xc1c7('0x17'));var utils=require(_0xc1c7('0x18'));var config=require(_0xc1c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1c7('0x1a'))['db'];function respondWithStatusCode(_0x44bf88,_0x376cab){_0x376cab=_0x376cab||0xcc;return function(_0x35feaa){if(_0x35feaa){return _0x44bf88[_0xc1c7('0x1b')](_0x376cab);}return _0x44bf88[_0xc1c7('0x1c')](_0x376cab)[_0xc1c7('0x1d')]();};}function respondWithResult(_0x1b57ab,_0xdfc7d9){_0xdfc7d9=_0xdfc7d9||0xc8;return function(_0x1b6905){if(_0x1b6905){return _0x1b57ab[_0xc1c7('0x1c')](_0xdfc7d9)[_0xc1c7('0x1e')](_0x1b6905);}};}function respondWithFilteredResult(_0x49576d,_0x3e1f0e){return function(_0x335600){if(_0x335600){var _0x21911c=typeof _0x3e1f0e['offset']===_0xc1c7('0x1f')&&typeof _0x3e1f0e[_0xc1c7('0x20')]===_0xc1c7('0x1f');var _0x39ac54=_0x335600[_0xc1c7('0x21')];var _0xb42702=_0x21911c?0x0:_0x3e1f0e[_0xc1c7('0x22')];var _0x2e93e5=_0x21911c?_0x335600['count']:_0x3e1f0e[_0xc1c7('0x22')]+_0x3e1f0e[_0xc1c7('0x20')];var _0x3ec66a;if(_0x2e93e5>=_0x39ac54){_0x2e93e5=_0x39ac54;_0x3ec66a=0xc8;}else{_0x3ec66a=0xce;}_0x49576d[_0xc1c7('0x1c')](_0x3ec66a);return _0x49576d['set'](_0xc1c7('0x23'),_0xb42702+'-'+_0x2e93e5+'/'+_0x39ac54)['json'](_0x335600);}return null;};}function patchUpdates(_0x5e7e4a){return function(_0x195c5f){try{jsonpatch['apply'](_0x195c5f,_0x5e7e4a,!![]);}catch(_0x5846f0){return BPromise[_0xc1c7('0x24')](_0x5846f0);}return _0x195c5f[_0xc1c7('0x25')]();};}function saveUpdates(_0x2f1b87,_0x4c6b34){return function(_0x813853){if(_0x813853){return _0x813853[_0xc1c7('0x26')](_0x2f1b87)[_0xc1c7('0x27')](function(_0x31a0e0){return _0x31a0e0;});}return null;};}function removeEntity(_0x2e64c4,_0x3a2483){return function(_0x3180fd){if(_0x3180fd){return _0x3180fd[_0xc1c7('0x28')]()[_0xc1c7('0x27')](function(){var _0x1540c1=_0x3180fd[_0xc1c7('0x29')]({'plain':!![]});var _0x363fbc=_0xc1c7('0x2a');return db[_0xc1c7('0x2b')][_0xc1c7('0x28')]({'where':{'type':_0x363fbc,'resourceId':_0x1540c1['id']}})[_0xc1c7('0x27')](function(){return _0x3180fd;});})['then'](function(){_0x2e64c4[_0xc1c7('0x1c')](0xcc)[_0xc1c7('0x1d')]();});}};}function handleEntityNotFound(_0x4e1721,_0x52a1d5){return function(_0x352f24){if(!_0x352f24){_0x4e1721['sendStatus'](0x194);}return _0x352f24;};}function handleError(_0x544fbb,_0x541f12){_0x541f12=_0x541f12||0x1f4;return function(_0x1b873c){logger[_0xc1c7('0x2c')](_0x1b873c[_0xc1c7('0x2d')]);if(_0x1b873c[_0xc1c7('0x2e')]){delete _0x1b873c['name'];}_0x544fbb['status'](_0x541f12)[_0xc1c7('0x2f')](_0x1b873c);};}exports[_0xc1c7('0x30')]=function(_0x9a0ab3,_0x3a786f){var _0x2e35f1={},_0x4968b0={},_0x50042f={'count':0x0,'rows':[]};var _0x125920=_[_0xc1c7('0x31')](db['VoiceMail'][_0xc1c7('0x32')],function(_0x3cf425){return{'name':_0x3cf425[_0xc1c7('0x33')],'type':_0x3cf425[_0xc1c7('0x34')][_0xc1c7('0x35')]};});_0x4968b0[_0xc1c7('0x36')]=_[_0xc1c7('0x31')](_0x125920,'name');_0x4968b0[_0xc1c7('0x37')]=_[_0xc1c7('0x38')](_0x9a0ab3[_0xc1c7('0x37')]);_0x4968b0[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x4968b0[_0xc1c7('0x36')],_0x4968b0[_0xc1c7('0x37')]);_0x2e35f1[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4968b0['model'],qs['fields'](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3c')]));_0x2e35f1[_0xc1c7('0x3b')]=_0x2e35f1[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x2e35f1[_0xc1c7('0x3b')]:_0x4968b0[_0xc1c7('0x36')];if(!_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x2e35f1[_0xc1c7('0x20')]=qs[_0xc1c7('0x20')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x2e35f1[_0xc1c7('0x22')]=qs[_0xc1c7('0x22')](_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x22')]);}_0x2e35f1[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x9a0ab3[_0xc1c7('0x37')]['sort']);_0x2e35f1['where']=qs['filters'](_[_0xc1c7('0x42')](_0x9a0ab3['query'],_0x4968b0['filters']),_0x125920);if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x2e35f1[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x2e35f1['where'],{'$or':_[_0xc1c7('0x31')](_0x125920,function(_0x25e005){if(_0x25e005[_0xc1c7('0x34')]!==_0xc1c7('0x46')){var _0x1a395c={};_0x1a395c[_0x25e005[_0xc1c7('0x2e')]]={'$like':'%'+_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x1a395c;}})});}_0x2e35f1=_[_0xc1c7('0x45')]({},_0x2e35f1,_0x9a0ab3[_0xc1c7('0x47')]);var _0x955ba6={'where':_0x2e35f1[_0xc1c7('0x44')]};return db[_0xc1c7('0x48')]['count'](_0x955ba6)[_0xc1c7('0x27')](function(_0x412520){_0x50042f['count']=_0x412520;if(_0x9a0ab3[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x2e35f1[_0xc1c7('0x4a')]=[{'all':!![]}];}return db[_0xc1c7('0x48')][_0xc1c7('0x4b')](_0x2e35f1);})[_0xc1c7('0x27')](function(_0xd5e06a){_0x50042f[_0xc1c7('0x4c')]=_0xd5e06a;return _0x50042f;})[_0xc1c7('0x27')](respondWithFilteredResult(_0x3a786f,_0x2e35f1))[_0xc1c7('0x4d')](handleError(_0x3a786f,null));};exports['show']=function(_0x14b61f,_0x16fbf5){var _0x519665={'raw':!![],'where':{'id':_0x14b61f[_0xc1c7('0x4e')]['id']}},_0x4c6834={};_0x4c6834[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db[_0xc1c7('0x48')][_0xc1c7('0x32')]);_0x4c6834['query']=_[_0xc1c7('0x38')](_0x14b61f[_0xc1c7('0x37')]);_0x4c6834['filters']=_['intersection'](_0x4c6834['model'],_0x4c6834[_0xc1c7('0x37')]);_0x519665[_0xc1c7('0x3b')]=_[_0xc1c7('0x3a')](_0x4c6834['model'],qs[_0xc1c7('0x3c')](_0x14b61f[_0xc1c7('0x37')]['fields']));_0x519665[_0xc1c7('0x3b')]=_0x519665[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x519665[_0xc1c7('0x3b')]:_0x4c6834[_0xc1c7('0x36')];if(_0x14b61f[_0xc1c7('0x37')][_0xc1c7('0x49')]){_0x519665[_0xc1c7('0x4a')]=[{'all':!![]}];}_0x519665=_[_0xc1c7('0x45')]({},_0x519665,_0x14b61f[_0xc1c7('0x47')]);return db[_0xc1c7('0x48')][_0xc1c7('0x4f')](_0x519665)[_0xc1c7('0x27')](handleEntityNotFound(_0x16fbf5,null))[_0xc1c7('0x27')](respondWithResult(_0x16fbf5,null))[_0xc1c7('0x4d')](handleError(_0x16fbf5,null));};exports[_0xc1c7('0x50')]=function(_0x2967b7,_0x1addc8){return db['VoiceMail'][_0xc1c7('0x50')](_0x2967b7['body'],{})[_0xc1c7('0x27')](function(_0x23f42f){var _0x2840a3=_0x2967b7['user'][_0xc1c7('0x29')]({'plain':!![]});if(!_0x2840a3)throw new Error(_0xc1c7('0x51'));if(_0x2840a3['role']==='user'){var _0x5c96cc=_0x23f42f[_0xc1c7('0x29')]({'plain':!![]});var _0x415416='Voicemails';return db[_0xc1c7('0x52')][_0xc1c7('0x4f')]({'where':{'name':_0x415416,'userProfileId':_0x2840a3[_0xc1c7('0x53')]},'raw':!![]})[_0xc1c7('0x27')](function(_0x37374c){if(_0x37374c&&_0x37374c[_0xc1c7('0x54')]===0x0){return db['UserProfileResource'][_0xc1c7('0x50')]({'name':_0x5c96cc['name'],'resourceId':_0x5c96cc['id'],'type':_0x37374c[_0xc1c7('0x2e')],'sectionId':_0x37374c['id']},{})[_0xc1c7('0x27')](function(){return _0x23f42f;});}else{return _0x23f42f;}})[_0xc1c7('0x4d')](function(_0x557cb6){logger[_0xc1c7('0x2c')](_0xc1c7('0x55'),_0x557cb6);throw _0x557cb6;});}return _0x23f42f;})[_0xc1c7('0x27')](respondWithResult(_0x1addc8,0xc9))[_0xc1c7('0x4d')](handleError(_0x1addc8,null));};exports[_0xc1c7('0x26')]=function(_0x45dfa2,_0x1dc39f){if(_0x45dfa2[_0xc1c7('0x56')]['id']){delete _0x45dfa2['body']['id'];}return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x45dfa2[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1dc39f,null))['then'](saveUpdates(_0x45dfa2[_0xc1c7('0x56')],null))[_0xc1c7('0x27')](respondWithResult(_0x1dc39f,null))[_0xc1c7('0x4d')](handleError(_0x1dc39f,null));};exports['destroy']=function(_0x1c636c,_0x48304a){return db[_0xc1c7('0x48')][_0xc1c7('0x4f')]({'where':{'id':_0x1c636c[_0xc1c7('0x4e')]['id']}})[_0xc1c7('0x27')](handleEntityNotFound(_0x48304a,null))[_0xc1c7('0x27')](removeEntity(_0x48304a,null))[_0xc1c7('0x4d')](handleError(_0x48304a,null));};exports[_0xc1c7('0x57')]=function(_0x4df2f8,_0x11c116,_0x2ad2d5){return db[_0xc1c7('0x48')]['findOne']({'where':{'id':_0x4df2f8[_0xc1c7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x11c116,null))[_0xc1c7('0x27')](function(_0x528986){var _0x39d3e2;var _0x212d53={},_0x314232={};_0x314232[_0xc1c7('0x36')]=_[_0xc1c7('0x38')](db['VoiceMailMessage']['rawAttributes']);_0x314232['query']=_[_0xc1c7('0x38')](_0x4df2f8[_0xc1c7('0x37')]);_0x314232[_0xc1c7('0x39')]=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],_0x314232[_0xc1c7('0x37')]);_0x212d53['attributes']=_[_0xc1c7('0x3a')](_0x314232[_0xc1c7('0x36')],qs[_0xc1c7('0x3c')](_0x4df2f8[_0xc1c7('0x37')]['fields']));_0x212d53[_0xc1c7('0x3b')]=_0x212d53[_0xc1c7('0x3b')][_0xc1c7('0x3d')]?_0x212d53['attributes']:_0x314232[_0xc1c7('0x36')];if(!_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x3e')](_0xc1c7('0x3f'))){_0x212d53['limit']=qs['limit'](_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x20')]);_0x212d53['offset']=qs[_0xc1c7('0x22')](_0x4df2f8[_0xc1c7('0x37')]['offset']);}_0x212d53[_0xc1c7('0x40')]=qs[_0xc1c7('0x41')](_0x4df2f8['query'][_0xc1c7('0x41')]);_0x212d53[_0xc1c7('0x44')]=qs[_0xc1c7('0x39')](_[_0xc1c7('0x42')](_0x4df2f8[_0xc1c7('0x37')],_0x314232[_0xc1c7('0x39')]));if(_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]){_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'$or':_[_0xc1c7('0x31')](_0x212d53[_0xc1c7('0x3b')],function(_0x3c9ffe){var _0x342fc8={};_0x342fc8[_0x3c9ffe]={'$like':'%'+_0x4df2f8[_0xc1c7('0x37')][_0xc1c7('0x43')]+'%'};return _0x342fc8;})});}_0x212d53[_0xc1c7('0x44')]=_[_0xc1c7('0x45')](_0x212d53[_0xc1c7('0x44')],{'mailboxuser':_0x528986[_0xc1c7('0x58')]});_0x212d53=_[_0xc1c7('0x45')]({},_0x212d53,_0x4df2f8[_0xc1c7('0x47')]);return db[_0xc1c7('0x59')][_0xc1c7('0x5a')](_0x212d53)[_0xc1c7('0x27')](respondWithFilteredResult(_0x11c116,_0x212d53));})[_0xc1c7('0x4d')](handleError(_0x11c116,null));}; \ No newline at end of file +var _0x36ee=['set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','stack','index','map','VoiceMail','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','mailbox','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x7a84f2,_0x1e1e67){var _0x2822f0=function(_0x5eac00){while(--_0x5eac00){_0x7a84f2['push'](_0x7a84f2['shift']());}};_0x2822f0(++_0x1e1e67);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe36e('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe36e('0x1'));var moment=require(_0xe36e('0x2'));var BPromise=require(_0xe36e('0x3'));var Mustache=require(_0xe36e('0x4'));var util=require(_0xe36e('0x5'));var path=require(_0xe36e('0x6'));var sox=require(_0xe36e('0x7'));var csv=require(_0xe36e('0x8'));var ejs=require(_0xe36e('0x9'));var fs=require('fs');var fs_extra=require(_0xe36e('0xa'));var _=require(_0xe36e('0xb'));var squel=require(_0xe36e('0xc'));var crypto=require('crypto');var jsforce=require(_0xe36e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe36e('0x8'));var querystring=require(_0xe36e('0xe'));var Papa=require(_0xe36e('0xf'));var Redis=require('ioredis');var authService=require(_0xe36e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xe36e('0x11'));var hardwareService=require(_0xe36e('0x12'));var logger=require(_0xe36e('0x13'))(_0xe36e('0x14'));var utils=require(_0xe36e('0x15'));var config=require(_0xe36e('0x16'));var licenseUtil=require(_0xe36e('0x17'));var db=require(_0xe36e('0x18'))['db'];function respondWithStatusCode(_0x4fbdb2,_0x32981d){_0x32981d=_0x32981d||0xcc;return function(_0x27841e){if(_0x27841e){return _0x4fbdb2[_0xe36e('0x19')](_0x32981d);}return _0x4fbdb2[_0xe36e('0x1a')](_0x32981d)['end']();};}function respondWithResult(_0x3e264a,_0x521afa){_0x521afa=_0x521afa||0xc8;return function(_0x525155){if(_0x525155){return _0x3e264a[_0xe36e('0x1a')](_0x521afa)[_0xe36e('0x1b')](_0x525155);}};}function respondWithFilteredResult(_0x26fb37,_0x278135){return function(_0xd6828e){if(_0xd6828e){var _0x924cd5=typeof _0x278135[_0xe36e('0x1c')]===_0xe36e('0x1d')&&typeof _0x278135[_0xe36e('0x1e')]===_0xe36e('0x1d');var _0x5792e8=_0xd6828e[_0xe36e('0x1f')];var _0x2184ae=_0x924cd5?0x0:_0x278135['offset'];var _0x21d9a3=_0x924cd5?_0xd6828e['count']:_0x278135[_0xe36e('0x1c')]+_0x278135[_0xe36e('0x1e')];var _0x5e15f5;if(_0x21d9a3>=_0x5792e8){_0x21d9a3=_0x5792e8;_0x5e15f5=0xc8;}else{_0x5e15f5=0xce;}_0x26fb37[_0xe36e('0x1a')](_0x5e15f5);return _0x26fb37[_0xe36e('0x20')](_0xe36e('0x21'),_0x2184ae+'-'+_0x21d9a3+'/'+_0x5792e8)['json'](_0xd6828e);}return null;};}function patchUpdates(_0x21e95e){return function(_0x21bcf9){try{jsonpatch[_0xe36e('0x22')](_0x21bcf9,_0x21e95e,!![]);}catch(_0x3c4017){return BPromise[_0xe36e('0x23')](_0x3c4017);}return _0x21bcf9[_0xe36e('0x24')]();};}function saveUpdates(_0x4f438a,_0xd71137){return function(_0x4f214a){if(_0x4f214a){return _0x4f214a[_0xe36e('0x25')](_0x4f438a)[_0xe36e('0x26')](function(_0x437f3f){return _0x437f3f;});}return null;};}function removeEntity(_0x53e13a,_0x598a7a){return function(_0x4749a8){if(_0x4749a8){return _0x4749a8[_0xe36e('0x27')]()[_0xe36e('0x26')](function(){var _0xb32195=_0x4749a8[_0xe36e('0x28')]({'plain':!![]});var _0x1507f9=_0xe36e('0x29');return db['UserProfileResource'][_0xe36e('0x27')]({'where':{'type':_0x1507f9,'resourceId':_0xb32195['id']}})[_0xe36e('0x26')](function(){return _0x4749a8;});})[_0xe36e('0x26')](function(){_0x53e13a[_0xe36e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d757c,_0x5a3133){return function(_0xf7b02e){if(!_0xf7b02e){_0x2d757c['sendStatus'](0x194);}return _0xf7b02e;};}function handleError(_0x19f001,_0x5884cb){_0x5884cb=_0x5884cb||0x1f4;return function(_0x410504){logger['error'](_0x410504[_0xe36e('0x2a')]);if(_0x410504['name']){delete _0x410504['name'];}_0x19f001['status'](_0x5884cb)['send'](_0x410504);};}exports[_0xe36e('0x2b')]=function(_0x1fc639,_0x4cf185){var _0x4ac819={},_0x1fa1ec={},_0xb8d44e={'count':0x0,'rows':[]};var _0x259e19=_[_0xe36e('0x2c')](db[_0xe36e('0x2d')][_0xe36e('0x2e')],function(_0x57bb9b){return{'name':_0x57bb9b[_0xe36e('0x2f')],'type':_0x57bb9b[_0xe36e('0x30')]['key']};});_0x1fa1ec[_0xe36e('0x31')]=_[_0xe36e('0x2c')](_0x259e19,_0xe36e('0x32'));_0x1fa1ec[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x1fc639[_0xe36e('0x33')]);_0x1fa1ec[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x1fa1ec[_0xe36e('0x31')],_0x1fa1ec[_0xe36e('0x33')]);_0x4ac819[_0xe36e('0x37')]=_['intersection'](_0x1fa1ec[_0xe36e('0x31')],qs['fields'](_0x1fc639['query'][_0xe36e('0x38')]));_0x4ac819['attributes']=_0x4ac819[_0xe36e('0x37')][_0xe36e('0x39')]?_0x4ac819[_0xe36e('0x37')]:_0x1fa1ec[_0xe36e('0x31')];if(!_0x1fc639['query']['hasOwnProperty'](_0xe36e('0x3a'))){_0x4ac819[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x1fc639[_0xe36e('0x33')]['limit']);_0x4ac819[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x1fc639[_0xe36e('0x33')]['offset']);}_0x4ac819[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x1fc639['query'][_0xe36e('0x3c')]);_0x4ac819[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x1fc639[_0xe36e('0x33')],_0x1fa1ec[_0xe36e('0x35')]),_0x259e19);if(_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]){_0x4ac819[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x4ac819[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x259e19,function(_0x3c4703){if(_0x3c4703['type']!==_0xe36e('0x41')){var _0x134fb2={};_0x134fb2[_0x3c4703[_0xe36e('0x32')]]={'$like':'%'+_0x1fc639[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0x134fb2;}})});}_0x4ac819=_['merge']({},_0x4ac819,_0x1fc639['options']);var _0x4094c6={'where':_0x4ac819[_0xe36e('0x3d')]};return db[_0xe36e('0x2d')][_0xe36e('0x1f')](_0x4094c6)[_0xe36e('0x26')](function(_0x34a1ba){_0xb8d44e[_0xe36e('0x1f')]=_0x34a1ba;if(_0x1fc639[_0xe36e('0x33')]['includeAll']){_0x4ac819[_0xe36e('0x42')]=[{'all':!![]}];}return db[_0xe36e('0x2d')]['findAll'](_0x4ac819);})[_0xe36e('0x26')](function(_0x5ef3e4){_0xb8d44e[_0xe36e('0x43')]=_0x5ef3e4;return _0xb8d44e;})[_0xe36e('0x26')](respondWithFilteredResult(_0x4cf185,_0x4ac819))[_0xe36e('0x44')](handleError(_0x4cf185,null));};exports[_0xe36e('0x45')]=function(_0x3b1269,_0x4c5e10){var _0x2ffc34={'raw':!![],'where':{'id':_0x3b1269[_0xe36e('0x46')]['id']}},_0x2961c9={};_0x2961c9[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x2d')]['rawAttributes']);_0x2961c9[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x3b1269[_0xe36e('0x33')]);_0x2961c9[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x2961c9['model'],_0x2961c9[_0xe36e('0x33')]);_0x2ffc34[_0xe36e('0x37')]=_[_0xe36e('0x36')](_0x2961c9[_0xe36e('0x31')],qs[_0xe36e('0x38')](_0x3b1269[_0xe36e('0x33')][_0xe36e('0x38')]));_0x2ffc34[_0xe36e('0x37')]=_0x2ffc34[_0xe36e('0x37')]['length']?_0x2ffc34['attributes']:_0x2961c9[_0xe36e('0x31')];if(_0x3b1269['query'][_0xe36e('0x47')]){_0x2ffc34[_0xe36e('0x42')]=[{'all':!![]}];}_0x2ffc34=_[_0xe36e('0x40')]({},_0x2ffc34,_0x3b1269[_0xe36e('0x48')]);return db['VoiceMail'][_0xe36e('0x49')](_0x2ffc34)[_0xe36e('0x26')](handleEntityNotFound(_0x4c5e10,null))['then'](respondWithResult(_0x4c5e10,null))[_0xe36e('0x44')](handleError(_0x4c5e10,null));};exports[_0xe36e('0x4a')]=function(_0x2c26e6,_0x42eae5){return db[_0xe36e('0x2d')][_0xe36e('0x4a')](_0x2c26e6[_0xe36e('0x4b')],{})[_0xe36e('0x26')](function(_0x17555e){var _0x3a99aa=_0x2c26e6[_0xe36e('0x4c')][_0xe36e('0x28')]({'plain':!![]});if(!_0x3a99aa)throw new Error(_0xe36e('0x4d'));if(_0x3a99aa[_0xe36e('0x4e')]===_0xe36e('0x4c')){var _0x5678d3=_0x17555e[_0xe36e('0x28')]({'plain':!![]});var _0x55aadf='Voicemails';return db[_0xe36e('0x4f')][_0xe36e('0x49')]({'where':{'name':_0x55aadf,'userProfileId':_0x3a99aa['userProfileId']},'raw':!![]})[_0xe36e('0x26')](function(_0x3814eb){if(_0x3814eb&&_0x3814eb[_0xe36e('0x50')]===0x0){return db[_0xe36e('0x51')][_0xe36e('0x4a')]({'name':_0x5678d3[_0xe36e('0x32')],'resourceId':_0x5678d3['id'],'type':_0x3814eb[_0xe36e('0x32')],'sectionId':_0x3814eb['id']},{})[_0xe36e('0x26')](function(){return _0x17555e;});}else{return _0x17555e;}})[_0xe36e('0x44')](function(_0x55d190){logger[_0xe36e('0x52')](_0xe36e('0x53'),_0x55d190);throw _0x55d190;});}return _0x17555e;})['then'](respondWithResult(_0x42eae5,0xc9))[_0xe36e('0x44')](handleError(_0x42eae5,null));};exports[_0xe36e('0x25')]=function(_0x3e1040,_0x206f75){if(_0x3e1040[_0xe36e('0x4b')]['id']){delete _0x3e1040['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0x3e1040['params']['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x206f75,null))[_0xe36e('0x26')](saveUpdates(_0x3e1040[_0xe36e('0x4b')],null))[_0xe36e('0x26')](respondWithResult(_0x206f75,null))[_0xe36e('0x44')](handleError(_0x206f75,null));};exports[_0xe36e('0x27')]=function(_0x7c3766,_0x17965c){return db[_0xe36e('0x2d')]['find']({'where':{'id':_0x7c3766[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x17965c,null))['then'](removeEntity(_0x17965c,null))[_0xe36e('0x44')](handleError(_0x17965c,null));};exports[_0xe36e('0x54')]=function(_0x169369,_0x443154,_0x700b63){return db[_0xe36e('0x2d')][_0xe36e('0x55')]({'where':{'id':_0x169369[_0xe36e('0x46')]['id']}})[_0xe36e('0x26')](handleEntityNotFound(_0x443154,null))[_0xe36e('0x26')](function(_0x56718a){var _0x2cf7fc;var _0x389e91={},_0x6f979f={};_0x6f979f[_0xe36e('0x31')]=_[_0xe36e('0x34')](db[_0xe36e('0x56')][_0xe36e('0x2e')]);_0x6f979f[_0xe36e('0x33')]=_[_0xe36e('0x34')](_0x169369[_0xe36e('0x33')]);_0x6f979f[_0xe36e('0x35')]=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],_0x6f979f[_0xe36e('0x33')]);_0x389e91['attributes']=_[_0xe36e('0x36')](_0x6f979f[_0xe36e('0x31')],qs['fields'](_0x169369[_0xe36e('0x33')][_0xe36e('0x38')]));_0x389e91[_0xe36e('0x37')]=_0x389e91[_0xe36e('0x37')][_0xe36e('0x39')]?_0x389e91[_0xe36e('0x37')]:_0x6f979f['model'];if(!_0x169369[_0xe36e('0x33')]['hasOwnProperty'](_0xe36e('0x3a'))){_0x389e91[_0xe36e('0x1e')]=qs[_0xe36e('0x1e')](_0x169369[_0xe36e('0x33')][_0xe36e('0x1e')]);_0x389e91[_0xe36e('0x1c')]=qs[_0xe36e('0x1c')](_0x169369[_0xe36e('0x33')]['offset']);}_0x389e91[_0xe36e('0x3b')]=qs[_0xe36e('0x3c')](_0x169369['query'][_0xe36e('0x3c')]);_0x389e91[_0xe36e('0x3d')]=qs[_0xe36e('0x35')](_[_0xe36e('0x3e')](_0x169369[_0xe36e('0x33')],_0x6f979f[_0xe36e('0x35')]));if(_0x169369[_0xe36e('0x33')]['filter']){_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91[_0xe36e('0x3d')],{'$or':_[_0xe36e('0x2c')](_0x389e91[_0xe36e('0x37')],function(_0x43d8c2){var _0xc1daf8={};_0xc1daf8[_0x43d8c2]={'$like':'%'+_0x169369[_0xe36e('0x33')][_0xe36e('0x3f')]+'%'};return _0xc1daf8;})});}_0x389e91[_0xe36e('0x3d')]=_[_0xe36e('0x40')](_0x389e91['where'],{'mailboxuser':_0x56718a[_0xe36e('0x57')]});_0x389e91=_[_0xe36e('0x40')]({},_0x389e91,_0x169369[_0xe36e('0x48')]);return db[_0xe36e('0x56')]['findAndCountAll'](_0x389e91)['then'](respondWithFilteredResult(_0x443154,_0x389e91));})[_0xe36e('0x44')](handleError(_0x443154,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 7a5ed96..40e7f94 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 _0x1b7d=['../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x35df67,_0x5939af){var _0x55adf1=function(_0x22d3fc){while(--_0x22d3fc){_0x35df67['push'](_0x35df67['shift']());}};_0x55adf1(++_0x5939af);}(_0x1b7d,0xd9));var _0xd1b7=function(_0x242595,_0x471b3c){_0x242595=_0x242595-0x0;var _0x1503ab=_0x1b7d[_0x242595];return _0x1503ab;};'use strict';var _=require(_0xd1b7('0x0'));var util=require(_0xd1b7('0x1'));var logger=require(_0xd1b7('0x2'))(_0xd1b7('0x3'));var moment=require(_0xd1b7('0x4'));var BPromise=require(_0xd1b7('0x5'));var rp=require(_0xd1b7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd1b7('0x7'));var config=require(_0xd1b7('0x8'));var attributes=require(_0xd1b7('0x9'));module[_0xd1b7('0xa')]=function(_0x157578,_0x56daa6){return _0x157578[_0xd1b7('0xb')]('VoiceMail',attributes,{'tableName':_0xd1b7('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xd1b7('0xd'),_0xd1b7('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6469=['context','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail'];(function(_0x358d5a,_0x58b017){var _0x15f29d=function(_0x46e633){while(--_0x46e633){_0x358d5a['push'](_0x358d5a['shift']());}};_0x15f29d(++_0x58b017);}(_0x6469,0xa9));var _0x9646=function(_0x1460ab,_0x74d06e){_0x1460ab=_0x1460ab-0x0;var _0x1eeb5c=_0x6469[_0x1460ab];return _0x1eeb5c;};'use strict';var _=require(_0x9646('0x0'));var util=require(_0x9646('0x1'));var logger=require('../../config/logger')(_0x9646('0x2'));var moment=require(_0x9646('0x3'));var BPromise=require(_0x9646('0x4'));var rp=require(_0x9646('0x5'));var fs=require('fs');var path=require(_0x9646('0x6'));var rimraf=require('rimraf');var config=require(_0x9646('0x7'));var attributes=require(_0x9646('0x8'));module[_0x9646('0x9')]=function(_0xeedfab,_0x47d4c5){return _0xeedfab[_0x9646('0xa')](_0x9646('0xb'),attributes,{'tableName':_0x9646('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x9646('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fe89c82..0a708d2 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 _0x01f2=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x01f2,0x1b6));var _0x201f=function(_0x1c8b00,_0x514624){_0x1c8b00=_0x1c8b00-0x0;var _0xeb7bc3=_0x01f2[_0x1c8b00];return _0xeb7bc3;};'use strict';var _=require(_0x201f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x201f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x201f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x201f('0x3'));var logger=require(_0x201f('0x4'))(_0x201f('0x5'));var config=require(_0x201f('0x6'));var jayson=require(_0x201f('0x7'));var client=jayson['client'][_0x201f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49bff1,_0x4f89fb,_0x17020f){return new BPromise(function(_0x35c263,_0x5e0df9){return client[_0x201f('0x9')](_0x49bff1,_0x17020f)[_0x201f('0xa')](function(_0xab9774){logger[_0x201f('0xb')](_0x201f('0xc'),_0x4f89fb,_0x201f('0xd'));logger[_0x201f('0xe')](_0x201f('0xf'),_0x4f89fb,_0x201f('0xd'),JSON[_0x201f('0x10')](_0xab9774));if(_0xab9774[_0x201f('0x11')]){if(_0xab9774[_0x201f('0x11')]['code']===0x1f4){logger[_0x201f('0x11')](_0x201f('0xc'),_0x4f89fb,_0xab9774[_0x201f('0x11')][_0x201f('0x12')]);return _0x5e0df9(_0xab9774[_0x201f('0x11')][_0x201f('0x12')]);}logger[_0x201f('0x11')](_0x201f('0xc'),_0x4f89fb,_0xab9774['error'][_0x201f('0x12')]);return _0x35c263(_0xab9774[_0x201f('0x11')][_0x201f('0x12')]);}else{logger[_0x201f('0xb')](_0x201f('0xc'),_0x4f89fb,'request\x20sent');_0x35c263(_0xab9774[_0x201f('0x13')][_0x201f('0x12')]);}})['catch'](function(_0x3ee993){logger[_0x201f('0x11')](_0x201f('0xc'),_0x4f89fb,_0x3ee993);_0x5e0df9(_0x3ee993);});});} \ No newline at end of file +var _0xd239=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xd239,0x1aa));var _0x9d23=function(_0x3fe613,_0x6f7d4d){_0x3fe613=_0x3fe613-0x0;var _0x14d091=_0xd239[_0x3fe613];return _0x14d091;};'use strict';var _=require(_0x9d23('0x0'));var util=require(_0x9d23('0x1'));var moment=require(_0x9d23('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d23('0x3'));var fs=require('fs');var Redis=require(_0x9d23('0x4'));var db=require(_0x9d23('0x5'))['db'];var utils=require(_0x9d23('0x6'));var logger=require(_0x9d23('0x7'))(_0x9d23('0x8'));var config=require(_0x9d23('0x9'));var jayson=require(_0x9d23('0xa'));var client=jayson[_0x9d23('0xb')][_0x9d23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20c1f7,_0x5bd77f,_0x51dbac){return new BPromise(function(_0x3846b7,_0x3aa3be){return client[_0x9d23('0xd')](_0x20c1f7,_0x51dbac)[_0x9d23('0xe')](function(_0x11d2e4){logger[_0x9d23('0xf')](_0x9d23('0x10'),_0x5bd77f,_0x9d23('0x11'));logger[_0x9d23('0x12')](_0x9d23('0x13'),_0x5bd77f,_0x9d23('0x11'),JSON[_0x9d23('0x14')](_0x11d2e4));if(_0x11d2e4[_0x9d23('0x15')]){if(_0x11d2e4[_0x9d23('0x15')][_0x9d23('0x16')]===0x1f4){logger[_0x9d23('0x15')](_0x9d23('0x10'),_0x5bd77f,_0x11d2e4['error']['message']);return _0x3aa3be(_0x11d2e4[_0x9d23('0x15')][_0x9d23('0x17')]);}logger['error'](_0x9d23('0x10'),_0x5bd77f,_0x11d2e4[_0x9d23('0x15')][_0x9d23('0x17')]);return _0x3846b7(_0x11d2e4[_0x9d23('0x15')]['message']);}else{logger[_0x9d23('0xf')]('VoiceMail,\x20%s,\x20%s',_0x5bd77f,_0x9d23('0x11'));_0x3846b7(_0x11d2e4[_0x9d23('0x18')][_0x9d23('0x17')]);}})['catch'](function(_0x24cce0){logger[_0x9d23('0x15')](_0x9d23('0x10'),_0x5bd77f,_0x24cce0);_0x3aa3be(_0x24cce0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index acb5d17..f67f851 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 _0x11e4=['isAuthenticated','index','/:id','show','/:id/download','download','post','put','update','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','./voiceMailMessage.controller','get'];(function(_0x388493,_0x23301e){var _0x5300a1=function(_0x1d9c91){while(--_0x1d9c91){_0x388493['push'](_0x388493['shift']());}};_0x5300a1(++_0x23301e);}(_0x11e4,0x102));var _0x411e=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x11e4[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x411e('0x0'));var util=require(_0x411e('0x1'));var path=require(_0x411e('0x2'));var timeout=require('connect-timeout');var express=require(_0x411e('0x3'));var router=express['Router']();var fs_extra=require(_0x411e('0x4'));var auth=require(_0x411e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x411e('0x6'));router[_0x411e('0x7')]('/',auth[_0x411e('0x8')](),controller[_0x411e('0x9')]);router[_0x411e('0x7')](_0x411e('0xa'),auth['isAuthenticated'](),controller[_0x411e('0xb')]);router['get'](_0x411e('0xc'),auth['isAuthenticated'](),controller[_0x411e('0xd')]);router[_0x411e('0xe')]('/',auth[_0x411e('0x8')](),controller['create']);router[_0x411e('0xf')](_0x411e('0xa'),auth['isAuthenticated'](),controller[_0x411e('0x10')]);router['delete']('/:id',auth[_0x411e('0x8')](),controller[_0x411e('0x11')]);module[_0x411e('0x12')]=router; \ No newline at end of file +var _0x6cb9=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','/:id/download','download','post','create','put','update','delete','destroy'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6cb9,0xf3));var _0x96cb=function(_0x316a6e,_0x5b99ca){_0x316a6e=_0x316a6e-0x0;var _0x1f1c01=_0x6cb9[_0x316a6e];return _0x1f1c01;};'use strict';var multer=require(_0x96cb('0x0'));var util=require(_0x96cb('0x1'));var path=require(_0x96cb('0x2'));var timeout=require(_0x96cb('0x3'));var express=require(_0x96cb('0x4'));var router=express[_0x96cb('0x5')]();var fs_extra=require(_0x96cb('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x96cb('0x7'));var config=require(_0x96cb('0x8'));var controller=require(_0x96cb('0x9'));router[_0x96cb('0xa')]('/',auth[_0x96cb('0xb')](),controller['index']);router['get'](_0x96cb('0xc'),auth[_0x96cb('0xb')](),controller['show']);router[_0x96cb('0xa')](_0x96cb('0xd'),auth[_0x96cb('0xb')](),controller[_0x96cb('0xe')]);router[_0x96cb('0xf')]('/',auth[_0x96cb('0xb')](),controller[_0x96cb('0x10')]);router[_0x96cb('0x11')](_0x96cb('0xc'),auth[_0x96cb('0xb')](),controller[_0x96cb('0x12')]);router[_0x96cb('0x13')](_0x96cb('0xc'),auth[_0x96cb('0xb')](),controller[_0x96cb('0x14')]);module[_0x96cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index c1bf707..20fc4fd 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 _0x97d7=['exports','VIRTUAL','STRING','BLOB','TIMESTAMP','literal'];(function(_0x3a8ad6,_0x56c2ab){var _0xb041fd=function(_0x27cbc2){while(--_0x27cbc2){_0x3a8ad6['push'](_0x3a8ad6['shift']());}};_0xb041fd(++_0x56c2ab);}(_0x97d7,0x18c));var _0x797d=function(_0x10ab62,_0x21d1da){_0x10ab62=_0x10ab62-0x0;var _0x3b325b=_0x97d7[_0x10ab62];return _0x3b325b;};'use strict';var Sequelize=require('sequelize');module[_0x797d('0x0')]={'name':{'type':Sequelize[_0x797d('0x1')],'get':function(_0x552afe){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'context':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'recording':{'type':Sequelize[_0x797d('0x3')]('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0x797d('0x2')],'defaultValue':''},'stamp':{'type':_0x797d('0x4'),'defaultValue':Sequelize[_0x797d('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x047d=['getDataValue','INTEGER','STRING','long','TIMESTAMP','literal','exports','VIRTUAL'];(function(_0x24aba8,_0xdf50f5){var _0x4f53b0=function(_0x1e54e1){while(--_0x1e54e1){_0x24aba8['push'](_0x24aba8['shift']());}};_0x4f53b0(++_0xdf50f5);}(_0x047d,0x19e));var _0xd047=function(_0xefc558,_0x17f4ab){_0xefc558=_0xefc558-0x0;var _0x1efb41=_0x047d[_0xefc558];return _0x1efb41;};'use strict';var Sequelize=require('sequelize');module[_0xd047('0x0')]={'name':{'type':Sequelize[_0xd047('0x1')],'get':function(_0x52d6c7){return this[_0xd047('0x2')]('id');}},'msgnum':{'type':Sequelize[_0xd047('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0xd047('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xd047('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0xd047('0x6'),'defaultValue':Sequelize[_0xd047('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index f82934a..2952268 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 _0xb9a4=['set','Content-Range','apply','update','then','destroy','stack','name','map','rawAttributes','fieldName','type','key','differenceBy','query','keys','attributes','model','fields','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','VoiceMailMessage','intersection','include','options','create','body','find','download','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','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','offset','undefined','limit'];(function(_0x20e3fa,_0x5805e1){var _0x1012bb=function(_0x266b7d){while(--_0x266b7d){_0x20e3fa['push'](_0x20e3fa['shift']());}};_0x1012bb(++_0x5805e1);}(_0xb9a4,0x84));var _0x4b9a=function(_0x53140a,_0x44b0fb){_0x53140a=_0x53140a-0x0;var _0x35d74f=_0xb9a4[_0x53140a];return _0x35d74f;};'use strict';var emlformat=require(_0x4b9a('0x0'));var rimraf=require(_0x4b9a('0x1'));var zipdir=require(_0x4b9a('0x2'));var jsonpatch=require(_0x4b9a('0x3'));var rp=require(_0x4b9a('0x4'));var moment=require(_0x4b9a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4b9a('0x6'));var util=require(_0x4b9a('0x7'));var path=require(_0x4b9a('0x8'));var sox=require(_0x4b9a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b9a('0xa'));var _=require(_0x4b9a('0xb'));var squel=require(_0x4b9a('0xc'));var crypto=require(_0x4b9a('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4b9a('0xe'));var toCsv=require(_0x4b9a('0xf'));var querystring=require(_0x4b9a('0x10'));var Papa=require(_0x4b9a('0x11'));var Redis=require(_0x4b9a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4b9a('0x13'));var as=require(_0x4b9a('0x14'));var hardwareService=require(_0x4b9a('0x15'));var logger=require('../../config/logger')(_0x4b9a('0x16'));var utils=require(_0x4b9a('0x17'));var config=require(_0x4b9a('0x18'));var licenseUtil=require(_0x4b9a('0x19'));var db=require(_0x4b9a('0x1a'))['db'];function respondWithStatusCode(_0x4ee3d0,_0x263c59){_0x263c59=_0x263c59||0xcc;return function(_0x26617a){if(_0x26617a){return _0x4ee3d0[_0x4b9a('0x1b')](_0x263c59);}return _0x4ee3d0[_0x4b9a('0x1c')](_0x263c59)[_0x4b9a('0x1d')]();};}function respondWithResult(_0x1cc41a,_0x1aadf3){_0x1aadf3=_0x1aadf3||0xc8;return function(_0x5071f0){if(_0x5071f0){return _0x1cc41a[_0x4b9a('0x1c')](_0x1aadf3)[_0x4b9a('0x1e')](_0x5071f0);}};}function respondWithFilteredResult(_0x4620eb,_0x2a6570){return function(_0x482344){if(_0x482344){var _0x56452e=typeof _0x2a6570[_0x4b9a('0x1f')]===_0x4b9a('0x20')&&typeof _0x2a6570[_0x4b9a('0x21')]===_0x4b9a('0x20');var _0x5bbced=_0x482344['count'];var _0xf5cd58=_0x56452e?0x0:_0x2a6570[_0x4b9a('0x1f')];var _0x29ec9=_0x56452e?_0x482344['count']:_0x2a6570[_0x4b9a('0x1f')]+_0x2a6570[_0x4b9a('0x21')];var _0x2820fd;if(_0x29ec9>=_0x5bbced){_0x29ec9=_0x5bbced;_0x2820fd=0xc8;}else{_0x2820fd=0xce;}_0x4620eb[_0x4b9a('0x1c')](_0x2820fd);return _0x4620eb[_0x4b9a('0x22')](_0x4b9a('0x23'),_0xf5cd58+'-'+_0x29ec9+'/'+_0x5bbced)['json'](_0x482344);}return null;};}function patchUpdates(_0x3456f1){return function(_0x5cb1f7){try{jsonpatch[_0x4b9a('0x24')](_0x5cb1f7,_0x3456f1,!![]);}catch(_0xee29b1){return BPromise['reject'](_0xee29b1);}return _0x5cb1f7['save']();};}function saveUpdates(_0x25e238,_0x2eef91){return function(_0x158c0e){if(_0x158c0e){return _0x158c0e[_0x4b9a('0x25')](_0x25e238)[_0x4b9a('0x26')](function(_0x68917){return _0x68917;});}return null;};}function removeEntity(_0x5ed4eb,_0x5ddcc7){return function(_0x232f97){if(_0x232f97){return _0x232f97[_0x4b9a('0x27')]()['then'](function(){_0x5ed4eb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x463bcc,_0x3d622c){return function(_0x11b939){if(!_0x11b939){_0x463bcc['sendStatus'](0x194);}return _0x11b939;};}function handleError(_0x55c472,_0x1143c4){_0x1143c4=_0x1143c4||0x1f4;return function(_0x2e0da3){logger['error'](_0x2e0da3[_0x4b9a('0x28')]);if(_0x2e0da3[_0x4b9a('0x29')]){delete _0x2e0da3['name'];}_0x55c472[_0x4b9a('0x1c')](_0x1143c4)['send'](_0x2e0da3);};}exports['index']=function(_0x571b79,_0x39db3f){var _0x427a78={},_0x481353={},_0x5a6967={'count':0x0,'rows':[]};var _0x18a66d=_[_0x4b9a('0x2a')](db['VoiceMailMessage'][_0x4b9a('0x2b')],function(_0x3ba560){return{'name':_0x3ba560[_0x4b9a('0x2c')],'type':_0x3ba560[_0x4b9a('0x2d')][_0x4b9a('0x2e')]};});_0x481353['model']=_[_0x4b9a('0x2f')](_[_0x4b9a('0x2a')](_0x18a66d,'name'),['name']);_0x481353[_0x4b9a('0x30')]=_[_0x4b9a('0x31')](_0x571b79[_0x4b9a('0x30')]);_0x481353['filters']=_['intersection'](_0x481353['model'],_0x481353[_0x4b9a('0x30')]);_0x427a78[_0x4b9a('0x32')]=_['intersection'](_0x481353[_0x4b9a('0x33')],qs[_0x4b9a('0x34')](_0x571b79[_0x4b9a('0x30')]['fields']));_0x427a78['attributes']=_0x427a78['attributes'][_0x4b9a('0x35')]?_0x427a78[_0x4b9a('0x32')]:_0x481353['model'];if(!_0x571b79[_0x4b9a('0x30')]['hasOwnProperty'](_0x4b9a('0x36'))){_0x427a78['limit']=qs['limit'](_0x571b79[_0x4b9a('0x30')][_0x4b9a('0x21')]);_0x427a78[_0x4b9a('0x1f')]=qs[_0x4b9a('0x1f')](_0x571b79[_0x4b9a('0x30')][_0x4b9a('0x1f')]);}_0x427a78[_0x4b9a('0x37')]=qs[_0x4b9a('0x38')](_0x571b79[_0x4b9a('0x30')][_0x4b9a('0x38')]);_0x427a78[_0x4b9a('0x39')]=qs[_0x4b9a('0x3a')](_['pick'](_0x571b79['query'],_0x481353['filters']),_0x18a66d);if(_0x571b79['query'][_0x4b9a('0x3b')]){_0x427a78[_0x4b9a('0x39')]=_[_0x4b9a('0x3c')](_0x427a78[_0x4b9a('0x39')],{'$or':_[_0x4b9a('0x2a')](_0x18a66d,function(_0x265da6){if(_0x265da6[_0x4b9a('0x2d')]!==_0x4b9a('0x3d')){var _0x79378c={};_0x79378c[_0x265da6[_0x4b9a('0x29')]]={'$like':'%'+_0x571b79['query'][_0x4b9a('0x3b')]+'%'};return _0x79378c;}})});}_0x427a78=_[_0x4b9a('0x3c')]({},_0x427a78,_0x571b79['options']);var _0x29d30a={'where':_0x427a78[_0x4b9a('0x39')]};return db['VoiceMailMessage'][_0x4b9a('0x3e')](_0x29d30a)[_0x4b9a('0x26')](function(_0x99e414){_0x5a6967[_0x4b9a('0x3e')]=_0x99e414;if(_0x571b79[_0x4b9a('0x30')][_0x4b9a('0x3f')]){_0x427a78['include']=[{'all':!![]}];}return db['VoiceMailMessage'][_0x4b9a('0x40')](_0x427a78);})[_0x4b9a('0x26')](function(_0x1d90ae){_0x5a6967[_0x4b9a('0x41')]=_0x1d90ae;return _0x5a6967;})[_0x4b9a('0x26')](respondWithFilteredResult(_0x39db3f,_0x427a78))[_0x4b9a('0x42')](handleError(_0x39db3f,null));};exports[_0x4b9a('0x43')]=function(_0x204faf,_0x604b52){var _0x10cdec={'raw':!![],'where':{'id':_0x204faf[_0x4b9a('0x44')]['id']}},_0x18cb6d={};_0x18cb6d[_0x4b9a('0x33')]=_[_0x4b9a('0x31')](db[_0x4b9a('0x45')]['rawAttributes']);_0x18cb6d[_0x4b9a('0x30')]=_[_0x4b9a('0x31')](_0x204faf[_0x4b9a('0x30')]);_0x18cb6d[_0x4b9a('0x3a')]=_[_0x4b9a('0x46')](_0x18cb6d[_0x4b9a('0x33')],_0x18cb6d[_0x4b9a('0x30')]);_0x10cdec[_0x4b9a('0x32')]=_[_0x4b9a('0x46')](_0x18cb6d['model'],qs[_0x4b9a('0x34')](_0x204faf[_0x4b9a('0x30')][_0x4b9a('0x34')]));_0x10cdec['attributes']=_0x10cdec['attributes'][_0x4b9a('0x35')]?_0x10cdec['attributes']:_0x18cb6d[_0x4b9a('0x33')];if(_0x204faf[_0x4b9a('0x30')]['includeAll']){_0x10cdec[_0x4b9a('0x47')]=[{'all':!![]}];}_0x10cdec=_['merge']({},_0x10cdec,_0x204faf[_0x4b9a('0x48')]);return db[_0x4b9a('0x45')]['find'](_0x10cdec)[_0x4b9a('0x26')](handleEntityNotFound(_0x604b52,null))[_0x4b9a('0x26')](respondWithResult(_0x604b52,null))[_0x4b9a('0x42')](handleError(_0x604b52,null));};exports[_0x4b9a('0x49')]=function(_0xaa85d3,_0x36ccee){return db[_0x4b9a('0x45')][_0x4b9a('0x49')](_0xaa85d3[_0x4b9a('0x4a')],{})[_0x4b9a('0x26')](respondWithResult(_0x36ccee,0xc9))['catch'](handleError(_0x36ccee,null));};exports[_0x4b9a('0x25')]=function(_0x2d3100,_0x1d63b4){if(_0x2d3100[_0x4b9a('0x4a')]['id']){delete _0x2d3100['body']['id'];}return db[_0x4b9a('0x45')][_0x4b9a('0x4b')]({'where':{'id':_0x2d3100[_0x4b9a('0x44')]['id']}})['then'](handleEntityNotFound(_0x1d63b4,null))['then'](saveUpdates(_0x2d3100[_0x4b9a('0x4a')],null))['then'](respondWithResult(_0x1d63b4,null))['catch'](handleError(_0x1d63b4,null));};exports[_0x4b9a('0x27')]=function(_0x3d631e,_0x383c2d){return db['VoiceMailMessage'][_0x4b9a('0x4b')]({'where':{'id':_0x3d631e[_0x4b9a('0x44')]['id']}})[_0x4b9a('0x26')](handleEntityNotFound(_0x383c2d,null))[_0x4b9a('0x26')](removeEntity(_0x383c2d,null))[_0x4b9a('0x42')](handleError(_0x383c2d,null));};exports[_0x4b9a('0x4c')]=function(_0x5a27d6,_0x4a04cf,_0x1fd662){return db['VoiceMailMessage']['find']({'where':{'id':_0x5a27d6[_0x4b9a('0x44')]['id']},'attributes':['id','recording',_0x4b9a('0x4d')]})[_0x4b9a('0x26')](handleEntityNotFound(_0x4a04cf,null))[_0x4b9a('0x26')](function(_0x39c8fe){if(_0x39c8fe){if(!_0x39c8fe['recording']){throw new db['Sequelize'][(_0x4b9a('0x4e'))](_0x4b9a('0x4f'));}var _0x93b900={'Content-Type':_0x4b9a('0x50'),'Content-Disposition':'attachment'};if(_0x39c8fe[_0x4b9a('0x4d')]){_0x93b900[_0x4b9a('0x51')]='attachment;\x20filename=\x22'+_0x39c8fe[_0x4b9a('0x4d')]+_0x4b9a('0x52');}_0x4a04cf[_0x4b9a('0x22')](_0x93b900);return _0x4a04cf['send'](new Buffer(_0x39c8fe['recording']));}})[_0x4b9a('0x42')](handleError(_0x4a04cf,null));}; \ No newline at end of file +var _0x519a=['params','rawAttributes','options','find','catch','create','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','destroy','then','sendStatus','stack','name','send','index','map','fieldName','key','model','differenceBy','keys','query','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','VoiceMailMessage','includeAll','include','rows'];(function(_0x1900ae,_0x1272a2){var _0x1cea3d=function(_0x5e831c){while(--_0x5e831c){_0x1900ae['push'](_0x1900ae['shift']());}};_0x1cea3d(++_0x1272a2);}(_0x519a,0x64));var _0xa519=function(_0x423097,_0x8a09f4){_0x423097=_0x423097-0x0;var _0x3a73f1=_0x519a[_0x423097];return _0x3a73f1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa519('0x0'));var zipdir=require(_0xa519('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa519('0x2'));var moment=require('moment');var BPromise=require(_0xa519('0x3'));var Mustache=require(_0xa519('0x4'));var util=require(_0xa519('0x5'));var path=require(_0xa519('0x6'));var sox=require(_0xa519('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa519('0x8'));var _=require(_0xa519('0x9'));var squel=require(_0xa519('0xa'));var crypto=require(_0xa519('0xb'));var jsforce=require(_0xa519('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa519('0xd'));var Papa=require('papaparse');var Redis=require(_0xa519('0xe'));var authService=require(_0xa519('0xf'));var qs=require(_0xa519('0x10'));var as=require(_0xa519('0x11'));var hardwareService=require(_0xa519('0x12'));var logger=require(_0xa519('0x13'))(_0xa519('0x14'));var utils=require(_0xa519('0x15'));var config=require(_0xa519('0x16'));var licenseUtil=require(_0xa519('0x17'));var db=require(_0xa519('0x18'))['db'];function respondWithStatusCode(_0x128266,_0x7d28b8){_0x7d28b8=_0x7d28b8||0xcc;return function(_0x54bcc6){if(_0x54bcc6){return _0x128266['sendStatus'](_0x7d28b8);}return _0x128266[_0xa519('0x19')](_0x7d28b8)[_0xa519('0x1a')]();};}function respondWithResult(_0x1ec87c,_0x186b11){_0x186b11=_0x186b11||0xc8;return function(_0x12618a){if(_0x12618a){return _0x1ec87c[_0xa519('0x19')](_0x186b11)[_0xa519('0x1b')](_0x12618a);}};}function respondWithFilteredResult(_0x4dd02b,_0x477964){return function(_0x462342){if(_0x462342){var _0x6caf3b=typeof _0x477964[_0xa519('0x1c')]===_0xa519('0x1d')&&typeof _0x477964['limit']===_0xa519('0x1d');var _0x5de074=_0x462342[_0xa519('0x1e')];var _0x50ffa8=_0x6caf3b?0x0:_0x477964['offset'];var _0x126ed8=_0x6caf3b?_0x462342[_0xa519('0x1e')]:_0x477964['offset']+_0x477964['limit'];var _0xd9738;if(_0x126ed8>=_0x5de074){_0x126ed8=_0x5de074;_0xd9738=0xc8;}else{_0xd9738=0xce;}_0x4dd02b[_0xa519('0x19')](_0xd9738);return _0x4dd02b[_0xa519('0x1f')](_0xa519('0x20'),_0x50ffa8+'-'+_0x126ed8+'/'+_0x5de074)[_0xa519('0x1b')](_0x462342);}return null;};}function patchUpdates(_0x1ccd01){return function(_0x12efbd){try{jsonpatch[_0xa519('0x21')](_0x12efbd,_0x1ccd01,!![]);}catch(_0x89b3a7){return BPromise['reject'](_0x89b3a7);}return _0x12efbd[_0xa519('0x22')]();};}function saveUpdates(_0x44303a,_0x6c9d98){return function(_0x5e919f){if(_0x5e919f){return _0x5e919f[_0xa519('0x23')](_0x44303a)['then'](function(_0x48db3f){return _0x48db3f;});}return null;};}function removeEntity(_0x43293a,_0x1412a4){return function(_0x598feb){if(_0x598feb){return _0x598feb[_0xa519('0x24')]()[_0xa519('0x25')](function(){_0x43293a['status'](0xcc)[_0xa519('0x1a')]();});}};}function handleEntityNotFound(_0x54bfc4,_0x2d56b8){return function(_0x5868a6){if(!_0x5868a6){_0x54bfc4[_0xa519('0x26')](0x194);}return _0x5868a6;};}function handleError(_0x252680,_0x364015){_0x364015=_0x364015||0x1f4;return function(_0x322863){logger['error'](_0x322863[_0xa519('0x27')]);if(_0x322863[_0xa519('0x28')]){delete _0x322863[_0xa519('0x28')];}_0x252680[_0xa519('0x19')](_0x364015)[_0xa519('0x29')](_0x322863);};}exports[_0xa519('0x2a')]=function(_0x3e0c33,_0x1b03d1){var _0x4053ca={},_0x1173f7={},_0x495268={'count':0x0,'rows':[]};var _0x4ef0e7=_[_0xa519('0x2b')](db['VoiceMailMessage']['rawAttributes'],function(_0x554a28){return{'name':_0x554a28[_0xa519('0x2c')],'type':_0x554a28['type'][_0xa519('0x2d')]};});_0x1173f7[_0xa519('0x2e')]=_[_0xa519('0x2f')](_[_0xa519('0x2b')](_0x4ef0e7,'name'),[_0xa519('0x28')]);_0x1173f7['query']=_[_0xa519('0x30')](_0x3e0c33[_0xa519('0x31')]);_0x1173f7[_0xa519('0x32')]=_[_0xa519('0x33')](_0x1173f7[_0xa519('0x2e')],_0x1173f7['query']);_0x4053ca[_0xa519('0x34')]=_[_0xa519('0x33')](_0x1173f7[_0xa519('0x2e')],qs[_0xa519('0x35')](_0x3e0c33[_0xa519('0x31')][_0xa519('0x35')]));_0x4053ca[_0xa519('0x34')]=_0x4053ca[_0xa519('0x34')][_0xa519('0x36')]?_0x4053ca['attributes']:_0x1173f7[_0xa519('0x2e')];if(!_0x3e0c33[_0xa519('0x31')]['hasOwnProperty'](_0xa519('0x37'))){_0x4053ca[_0xa519('0x38')]=qs[_0xa519('0x38')](_0x3e0c33[_0xa519('0x31')][_0xa519('0x38')]);_0x4053ca[_0xa519('0x1c')]=qs['offset'](_0x3e0c33[_0xa519('0x31')]['offset']);}_0x4053ca['order']=qs[_0xa519('0x39')](_0x3e0c33[_0xa519('0x31')]['sort']);_0x4053ca[_0xa519('0x3a')]=qs[_0xa519('0x32')](_[_0xa519('0x3b')](_0x3e0c33[_0xa519('0x31')],_0x1173f7[_0xa519('0x32')]),_0x4ef0e7);if(_0x3e0c33['query'][_0xa519('0x3c')]){_0x4053ca[_0xa519('0x3a')]=_[_0xa519('0x3d')](_0x4053ca[_0xa519('0x3a')],{'$or':_[_0xa519('0x2b')](_0x4ef0e7,function(_0x545481){if(_0x545481[_0xa519('0x3e')]!==_0xa519('0x3f')){var _0x4a3a66={};_0x4a3a66[_0x545481[_0xa519('0x28')]]={'$like':'%'+_0x3e0c33[_0xa519('0x31')][_0xa519('0x3c')]+'%'};return _0x4a3a66;}})});}_0x4053ca=_['merge']({},_0x4053ca,_0x3e0c33['options']);var _0x385845={'where':_0x4053ca[_0xa519('0x3a')]};return db[_0xa519('0x40')][_0xa519('0x1e')](_0x385845)[_0xa519('0x25')](function(_0x14f6a0){_0x495268['count']=_0x14f6a0;if(_0x3e0c33['query'][_0xa519('0x41')]){_0x4053ca[_0xa519('0x42')]=[{'all':!![]}];}return db[_0xa519('0x40')]['findAll'](_0x4053ca);})[_0xa519('0x25')](function(_0x254234){_0x495268[_0xa519('0x43')]=_0x254234;return _0x495268;})[_0xa519('0x25')](respondWithFilteredResult(_0x1b03d1,_0x4053ca))['catch'](handleError(_0x1b03d1,null));};exports['show']=function(_0x64080b,_0x4120d9){var _0x567d73={'raw':!![],'where':{'id':_0x64080b[_0xa519('0x44')]['id']}},_0x5f3b90={};_0x5f3b90['model']=_[_0xa519('0x30')](db[_0xa519('0x40')][_0xa519('0x45')]);_0x5f3b90['query']=_['keys'](_0x64080b[_0xa519('0x31')]);_0x5f3b90['filters']=_['intersection'](_0x5f3b90[_0xa519('0x2e')],_0x5f3b90[_0xa519('0x31')]);_0x567d73[_0xa519('0x34')]=_[_0xa519('0x33')](_0x5f3b90[_0xa519('0x2e')],qs[_0xa519('0x35')](_0x64080b[_0xa519('0x31')][_0xa519('0x35')]));_0x567d73[_0xa519('0x34')]=_0x567d73[_0xa519('0x34')][_0xa519('0x36')]?_0x567d73[_0xa519('0x34')]:_0x5f3b90[_0xa519('0x2e')];if(_0x64080b[_0xa519('0x31')]['includeAll']){_0x567d73[_0xa519('0x42')]=[{'all':!![]}];}_0x567d73=_[_0xa519('0x3d')]({},_0x567d73,_0x64080b[_0xa519('0x46')]);return db[_0xa519('0x40')][_0xa519('0x47')](_0x567d73)[_0xa519('0x25')](handleEntityNotFound(_0x4120d9,null))[_0xa519('0x25')](respondWithResult(_0x4120d9,null))[_0xa519('0x48')](handleError(_0x4120d9,null));};exports[_0xa519('0x49')]=function(_0x45649a,_0x47027f){return db[_0xa519('0x40')]['create'](_0x45649a[_0xa519('0x4a')],{})[_0xa519('0x25')](respondWithResult(_0x47027f,0xc9))[_0xa519('0x48')](handleError(_0x47027f,null));};exports[_0xa519('0x23')]=function(_0x1c6efc,_0x4e17f6){if(_0x1c6efc['body']['id']){delete _0x1c6efc[_0xa519('0x4a')]['id'];}return db[_0xa519('0x40')]['find']({'where':{'id':_0x1c6efc[_0xa519('0x44')]['id']}})[_0xa519('0x25')](handleEntityNotFound(_0x4e17f6,null))['then'](saveUpdates(_0x1c6efc['body'],null))[_0xa519('0x25')](respondWithResult(_0x4e17f6,null))[_0xa519('0x48')](handleError(_0x4e17f6,null));};exports[_0xa519('0x24')]=function(_0x3ba10d,_0xd40898){return db[_0xa519('0x40')][_0xa519('0x47')]({'where':{'id':_0x3ba10d[_0xa519('0x44')]['id']}})['then'](handleEntityNotFound(_0xd40898,null))['then'](removeEntity(_0xd40898,null))['catch'](handleError(_0xd40898,null));};exports['download']=function(_0x1ab14e,_0x228a15,_0x4fe46b){return db[_0xa519('0x40')]['find']({'where':{'id':_0x1ab14e[_0xa519('0x44')]['id']},'attributes':['id',_0xa519('0x4b'),_0xa519('0x4c')]})[_0xa519('0x25')](handleEntityNotFound(_0x228a15,null))[_0xa519('0x25')](function(_0x3f2c1c){if(_0x3f2c1c){if(!_0x3f2c1c[_0xa519('0x4b')]){throw new db['Sequelize'][(_0xa519('0x4d'))](_0xa519('0x4e'));}var _0x1e83f6={'Content-Type':_0xa519('0x4f'),'Content-Disposition':_0xa519('0x50')};if(_0x3f2c1c[_0xa519('0x4c')]){_0x1e83f6[_0xa519('0x51')]=_0xa519('0x52')+_0x3f2c1c[_0xa519('0x4c')]+_0xa519('0x53');}_0x228a15[_0xa519('0x1f')](_0x1e83f6);return _0x228a15[_0xa519('0x29')](new Buffer(_0x3f2c1c['recording']));}})[_0xa519('0x48')](handleError(_0x228a15,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 3a58025..17526e1 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 _0xf56b=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','VoiceMailMessage','voice_voicemail_messages','dir'];(function(_0x510c7e,_0x141164){var _0x4eef93=function(_0x12d4b0){while(--_0x12d4b0){_0x510c7e['push'](_0x510c7e['shift']());}};_0x4eef93(++_0x141164);}(_0xf56b,0xe1));var _0xbf56=function(_0x29cb48,_0x5eea49){_0x29cb48=_0x29cb48-0x0;var _0x36bb62=_0xf56b[_0x29cb48];return _0x36bb62;};'use strict';var _=require(_0xbf56('0x0'));var util=require(_0xbf56('0x1'));var logger=require(_0xbf56('0x2'))(_0xbf56('0x3'));var moment=require(_0xbf56('0x4'));var BPromise=require(_0xbf56('0x5'));var rp=require(_0xbf56('0x6'));var fs=require('fs');var path=require(_0xbf56('0x7'));var rimraf=require(_0xbf56('0x8'));var config=require(_0xbf56('0x9'));var attributes=require(_0xbf56('0xa'));module[_0xbf56('0xb')]=function(_0x134ace,_0x511bb0){return _0x134ace['define'](_0xbf56('0xc'),attributes,{'tableName':_0xbf56('0xd'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0xbf56('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0xd022=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x347102,_0x374cc9){var _0xf4e6b1=function(_0x1ab761){while(--_0x1ab761){_0x347102['push'](_0x347102['shift']());}};_0xf4e6b1(++_0x374cc9);}(_0xd022,0x1cf));var _0x2d02=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd022[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x2d02('0x0'));var util=require(_0x2d02('0x1'));var logger=require('../../config/logger')(_0x2d02('0x2'));var moment=require(_0x2d02('0x3'));var BPromise=require(_0x2d02('0x4'));var rp=require(_0x2d02('0x5'));var fs=require('fs');var path=require(_0x2d02('0x6'));var rimraf=require(_0x2d02('0x7'));var config=require(_0x2d02('0x8'));var attributes=require(_0x2d02('0x9'));module[_0x2d02('0xa')]=function(_0xaebb85,_0x2dcfae){return _0xaebb85[_0x2d02('0xb')](_0x2d02('0xc'),attributes,{'tableName':_0x2d02('0xd'),'paranoid':![],'indexes':[{'name':_0x2d02('0xe'),'fields':[_0x2d02('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 3abdbc1..54aed00 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 _0x20e1=['request\x20sent','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug'];(function(_0xb9b8d9,_0x69e921){var _0x3966df=function(_0x33e0ab){while(--_0x33e0ab){_0xb9b8d9['push'](_0xb9b8d9['shift']());}};_0x3966df(++_0x69e921);}(_0x20e1,0x1f3));var _0x120e=function(_0x1aa277,_0x1edd4f){_0x1aa277=_0x1aa277-0x0;var _0x2f21e5=_0x20e1[_0x1aa277];return _0x2f21e5;};'use strict';var _=require(_0x120e('0x0'));var util=require(_0x120e('0x1'));var moment=require(_0x120e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x120e('0x3'));var db=require(_0x120e('0x4'))['db'];var utils=require(_0x120e('0x5'));var logger=require('../../config/logger')(_0x120e('0x6'));var config=require('../../config/environment');var jayson=require(_0x120e('0x7'));var client=jayson[_0x120e('0x8')][_0x120e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b01e,_0x1c28d6,_0x2f82ca){return new BPromise(function(_0x1e504b,_0x503d2d){return client['request'](_0x36b01e,_0x2f82ca)[_0x120e('0xa')](function(_0x4d055c){logger[_0x120e('0xb')](_0x120e('0xc'),_0x1c28d6,'request\x20sent');logger[_0x120e('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1c28d6,_0x120e('0xe'),JSON['stringify'](_0x4d055c));if(_0x4d055c['error']){if(_0x4d055c[_0x120e('0xf')]['code']===0x1f4){logger['error'](_0x120e('0xc'),_0x1c28d6,_0x4d055c['error']['message']);return _0x503d2d(_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);}logger[_0x120e('0xf')](_0x120e('0xc'),_0x1c28d6,_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);return _0x1e504b(_0x4d055c[_0x120e('0xf')][_0x120e('0x10')]);}else{logger[_0x120e('0xb')](_0x120e('0xc'),_0x1c28d6,_0x120e('0xe'));_0x1e504b(_0x4d055c[_0x120e('0x11')][_0x120e('0x10')]);}})[_0x120e('0x12')](function(_0x247849){logger['error'](_0x120e('0xc'),_0x1c28d6,_0x247849);_0x503d2d(_0x247849);});});} \ No newline at end of file +var _0xc74e=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','then','info','VoiceMailMessage,\x20%s,\x20%s','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x303962,_0x4febc7){var _0x393675=function(_0x8f4417){while(--_0x8f4417){_0x303962['push'](_0x303962['shift']());}};_0x393675(++_0x4febc7);}(_0xc74e,0xe0));var _0xec74=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc74e[_0x432682];return _0x463d05;};'use strict';var _=require(_0xec74('0x0'));var util=require(_0xec74('0x1'));var moment=require(_0xec74('0x2'));var BPromise=require(_0xec74('0x3'));var rs=require(_0xec74('0x4'));var fs=require('fs');var Redis=require(_0xec74('0x5'));var db=require(_0xec74('0x6'))['db'];var utils=require(_0xec74('0x7'));var logger=require(_0xec74('0x8'))(_0xec74('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xec74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x341436,_0x1e718e,_0x4569f7){return new BPromise(function(_0x1c7419,_0x3863ca){return client['request'](_0x341436,_0x4569f7)[_0xec74('0xb')](function(_0x373393){logger[_0xec74('0xc')](_0xec74('0xd'),_0x1e718e,'request\x20sent');logger[_0xec74('0xe')](_0xec74('0xf'),_0x1e718e,_0xec74('0x10'),JSON[_0xec74('0x11')](_0x373393));if(_0x373393[_0xec74('0x12')]){if(_0x373393[_0xec74('0x12')][_0xec74('0x13')]===0x1f4){logger['error'](_0xec74('0xd'),_0x1e718e,_0x373393[_0xec74('0x12')][_0xec74('0x14')]);return _0x3863ca(_0x373393[_0xec74('0x12')]['message']);}logger['error'](_0xec74('0xd'),_0x1e718e,_0x373393[_0xec74('0x12')][_0xec74('0x14')]);return _0x1c7419(_0x373393[_0xec74('0x12')]['message']);}else{logger[_0xec74('0xc')](_0xec74('0xd'),_0x1e718e,'request\x20sent');_0x1c7419(_0x373393[_0xec74('0x15')][_0xec74('0x14')]);}})[_0xec74('0x16')](function(_0xe27fa6){logger[_0xec74('0x12')](_0xec74('0xd'),_0x1e718e,_0xe27fa6);_0x3863ca(_0xe27fa6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 397647f..726ac16 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 _0x88a3=['index','show','/:id/sounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0x22957a,_0x398c57){var _0x44ff76=function(_0x144fe8){while(--_0x144fe8){_0x22957a['push'](_0x22957a['shift']());}};_0x44ff76(++_0x398c57);}(_0x88a3,0x108));var _0x388a=function(_0x79b649,_0x2115b3){_0x79b649=_0x79b649-0x0;var _0x1af9b1=_0x88a3[_0x79b649];return _0x1af9b1;};'use strict';var multer=require(_0x388a('0x0'));var util=require(_0x388a('0x1'));var path=require(_0x388a('0x2'));var timeout=require(_0x388a('0x3'));var express=require(_0x388a('0x4'));var router=express[_0x388a('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x388a('0x6'));var interaction=require(_0x388a('0x7'));var config=require('../../config/environment');var controller=require(_0x388a('0x8'));router[_0x388a('0x9')]('/',auth[_0x388a('0xa')](),controller[_0x388a('0xb')]);router[_0x388a('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x388a('0xc')]);router[_0x388a('0x9')](_0x388a('0xd'),auth[_0x388a('0xa')](),controller['getSounds']);router[_0x388a('0xe')]('/',auth[_0x388a('0xa')](),controller[_0x388a('0xf')]);router[_0x388a('0xe')]('/:id/sounds',auth[_0x388a('0xa')](),controller[_0x388a('0x10')]);router[_0x388a('0x11')](_0x388a('0x12'),auth[_0x388a('0xa')](),controller[_0x388a('0x13')]);router[_0x388a('0x14')](_0x388a('0x12'),auth[_0x388a('0xa')](),controller[_0x388a('0x15')]);router[_0x388a('0x14')](_0x388a('0x16'),auth[_0x388a('0xa')](),controller[_0x388a('0x17')]);module[_0x388a('0x18')]=router; \ No newline at end of file +var _0x7057=['express','fs-extra','../../components/auth/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','destroy','removeSound','exports','multer','util','path','connect-timeout'];(function(_0x56c9cd,_0x305ab0){var _0x13bed1=function(_0x4a0ed0){while(--_0x4a0ed0){_0x56c9cd['push'](_0x56c9cd['shift']());}};_0x13bed1(++_0x305ab0);}(_0x7057,0x92));var _0x7705=function(_0x35af23,_0x9190f6){_0x35af23=_0x35af23-0x0;var _0x340506=_0x7057[_0x35af23];return _0x340506;};'use strict';var multer=require(_0x7705('0x0'));var util=require(_0x7705('0x1'));var path=require(_0x7705('0x2'));var timeout=require(_0x7705('0x3'));var express=require(_0x7705('0x4'));var router=express['Router']();var fs_extra=require(_0x7705('0x5'));var auth=require(_0x7705('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7705('0x7'));var controller=require(_0x7705('0x8'));router[_0x7705('0x9')]('/',auth[_0x7705('0xa')](),controller[_0x7705('0xb')]);router[_0x7705('0x9')](_0x7705('0xc'),auth['isAuthenticated'](),controller[_0x7705('0xd')]);router[_0x7705('0x9')](_0x7705('0xe'),auth[_0x7705('0xa')](),controller[_0x7705('0xf')]);router[_0x7705('0x10')]('/',auth[_0x7705('0xa')](),controller[_0x7705('0x11')]);router['post'](_0x7705('0xe'),auth['isAuthenticated'](),controller[_0x7705('0x12')]);router[_0x7705('0x13')](_0x7705('0xc'),auth['isAuthenticated'](),controller[_0x7705('0x14')]);router[_0x7705('0x15')](_0x7705('0xc'),auth[_0x7705('0xa')](),controller[_0x7705('0x16')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x7705('0x17')]);module[_0x7705('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0ebf166..ca0afe7 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 _0x5fc4=['quietmp3','mp3','files','alpha','TIMESTAMP','BOOLEAN','exports','STRING','ENUM','mp3nb','quietmp3nb'];(function(_0x4ac2ee,_0x1b80f5){var _0x4273ed=function(_0x5a4e38){while(--_0x5a4e38){_0x4ac2ee['push'](_0x4ac2ee['shift']());}};_0x4273ed(++_0x1b80f5);}(_0x5fc4,0xb6));var _0x45fc=function(_0x5a778b,_0x717daa){_0x5a778b=_0x5a778b-0x0;var _0x32f0da=_0x5fc4[_0x5a778b];return _0x32f0da;};'use strict';var Sequelize=require('sequelize');module[_0x45fc('0x0')]={'name':{'type':Sequelize[_0x45fc('0x1')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x45fc('0x2')]('custom','files',_0x45fc('0x3'),_0x45fc('0x4'),_0x45fc('0x5'),_0x45fc('0x6')),'allowNull':!![],'defaultValue':_0x45fc('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x45fc('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x45fc('0x1')],'allowNull':!![],'defaultValue':_0x45fc('0x8')},'format':{'type':Sequelize[_0x45fc('0x1')],'allowNull':!![]},'stamp':{'type':_0x45fc('0x9')},'defaultEntry':{'type':Sequelize[_0x45fc('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x30e9=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize','exports'];(function(_0x3403e6,_0x361618){var _0x4406a0=function(_0x176ce8){while(--_0x176ce8){_0x3403e6['push'](_0x3403e6['shift']());}};_0x4406a0(++_0x361618);}(_0x30e9,0x1ec));var _0x930e=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x30e9[_0x278e3c];return _0x3e2d9b;};'use strict';var Sequelize=require(_0x930e('0x0'));module[_0x930e('0x1')]={'name':{'type':Sequelize[_0x930e('0x2')],'allowNull':![],'unique':_0x930e('0x3')},'mode':{'type':Sequelize[_0x930e('0x4')](_0x930e('0x5'),_0x930e('0x6'),_0x930e('0x7'),_0x930e('0x8'),_0x930e('0x9'),_0x930e('0xa')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x930e('0x2')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x930e('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x930e('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x930e('0xb')},'defaultEntry':{'type':Sequelize[_0x930e('0xc')],'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 9fefd6f..e78eb42 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 _0xbe1e=['hasOwnProperty','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','UserProfileResource','error','name','send','index','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','filter','merge','options','VoiceMusicOnHold','includeAll','include','findAll','show','params','rawAttributes','catch','body','find','create','sequelize','mode','files','directory','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','MusicOnHolds','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','Sequelize','ValidationError','message','addSound','findOne','converted_format','root','server/files/sounds/converted','format','basename','save_name','extname','join','%s.%s','symlinkSync','removeSound','id2','Sound','createdAt','getSounds','pick'];(function(_0x9ce139,_0x177061){var _0x471c3f=function(_0x3b8af9){while(--_0x3b8af9){_0x9ce139['push'](_0x9ce139['shift']());}};_0x471c3f(++_0x177061);}(_0xbe1e,0x1cd));var _0xebe1=function(_0x50a7d6,_0x109734){_0x50a7d6=_0x50a7d6-0x0;var _0x37feb7=_0xbe1e[_0x50a7d6];return _0x37feb7;};'use strict';var emlformat=require(_0xebe1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xebe1('0x1'));var jsonpatch=require(_0xebe1('0x2'));var rp=require(_0xebe1('0x3'));var moment=require(_0xebe1('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xebe1('0x5'));var util=require(_0xebe1('0x6'));var path=require(_0xebe1('0x7'));var sox=require(_0xebe1('0x8'));var csv=require('to-csv');var ejs=require(_0xebe1('0x9'));var fs=require('fs');var fs_extra=require(_0xebe1('0xa'));var _=require(_0xebe1('0xb'));var squel=require(_0xebe1('0xc'));var crypto=require(_0xebe1('0xd'));var jsforce=require(_0xebe1('0xe'));var deskjs=require(_0xebe1('0xf'));var toCsv=require(_0xebe1('0x10'));var querystring=require(_0xebe1('0x11'));var Papa=require(_0xebe1('0x12'));var Redis=require(_0xebe1('0x13'));var authService=require(_0xebe1('0x14'));var qs=require(_0xebe1('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xebe1('0x16'));var logger=require(_0xebe1('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xebe1('0x18'))['db'];function respondWithStatusCode(_0x33dc63,_0x471fb4){_0x471fb4=_0x471fb4||0xcc;return function(_0x216298){if(_0x216298){return _0x33dc63[_0xebe1('0x19')](_0x471fb4);}return _0x33dc63['status'](_0x471fb4)[_0xebe1('0x1a')]();};}function respondWithResult(_0x75a72b,_0x263dd3){_0x263dd3=_0x263dd3||0xc8;return function(_0x229260){if(_0x229260){return _0x75a72b[_0xebe1('0x1b')](_0x263dd3)[_0xebe1('0x1c')](_0x229260);}};}function respondWithFilteredResult(_0x37fe04,_0x441918){return function(_0x3b9941){if(_0x3b9941){var _0x52a939=typeof _0x441918[_0xebe1('0x1d')]===_0xebe1('0x1e')&&typeof _0x441918[_0xebe1('0x1f')]===_0xebe1('0x1e');var _0x7c0234=_0x3b9941[_0xebe1('0x20')];var _0x3449c8=_0x52a939?0x0:_0x441918[_0xebe1('0x1d')];var _0x38720d=_0x52a939?_0x3b9941[_0xebe1('0x20')]:_0x441918['offset']+_0x441918[_0xebe1('0x1f')];var _0xd9fbb6;if(_0x38720d>=_0x7c0234){_0x38720d=_0x7c0234;_0xd9fbb6=0xc8;}else{_0xd9fbb6=0xce;}_0x37fe04['status'](_0xd9fbb6);return _0x37fe04['set'](_0xebe1('0x21'),_0x3449c8+'-'+_0x38720d+'/'+_0x7c0234)[_0xebe1('0x1c')](_0x3b9941);}return null;};}function patchUpdates(_0x15f448){return function(_0x34a43c){try{jsonpatch[_0xebe1('0x22')](_0x34a43c,_0x15f448,!![]);}catch(_0x42e778){return BPromise[_0xebe1('0x23')](_0x42e778);}return _0x34a43c[_0xebe1('0x24')]();};}function saveUpdates(_0x2be729,_0x1d3d80){return function(_0x4b2d0f){if(_0x4b2d0f){return _0x4b2d0f[_0xebe1('0x25')](_0x2be729)['then'](function(_0xc9a36){return _0xc9a36;});}return null;};}function removeEntity(_0x342201,_0x4b052b){return function(_0x3516ed){if(_0x3516ed){return _0x3516ed[_0xebe1('0x26')]()[_0xebe1('0x27')](function(){var _0x209e87=_0x3516ed[_0xebe1('0x28')]({'plain':!![]});var _0x172210='MusicOnHolds';return db[_0xebe1('0x29')][_0xebe1('0x26')]({'where':{'type':_0x172210,'resourceId':_0x209e87['id']}})[_0xebe1('0x27')](function(){return _0x3516ed;});})[_0xebe1('0x27')](function(){_0x342201[_0xebe1('0x1b')](0xcc)[_0xebe1('0x1a')]();});}};}function handleEntityNotFound(_0xb3462d,_0x5ef476){return function(_0x58032c){if(!_0x58032c){_0xb3462d['sendStatus'](0x194);}return _0x58032c;};}function handleError(_0x493dec,_0x458896){_0x458896=_0x458896||0x1f4;return function(_0x35d4e1){logger[_0xebe1('0x2a')](_0x35d4e1['stack']);if(_0x35d4e1[_0xebe1('0x2b')]){delete _0x35d4e1[_0xebe1('0x2b')];}_0x493dec[_0xebe1('0x1b')](_0x458896)[_0xebe1('0x2c')](_0x35d4e1);};}exports[_0xebe1('0x2d')]=function(_0x11652a,_0x3361fb){var _0x77911d={},_0x4891f0={},_0x2a4be5={'count':0x0,'rows':[]};var _0x1cb82c=_[_0xebe1('0x2e')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x49d8b0){return{'name':_0x49d8b0[_0xebe1('0x2f')],'type':_0x49d8b0[_0xebe1('0x30')]['key']};});_0x4891f0[_0xebe1('0x31')]=_[_0xebe1('0x2e')](_0x1cb82c,'name');_0x4891f0[_0xebe1('0x32')]=_[_0xebe1('0x33')](_0x11652a[_0xebe1('0x32')]);_0x4891f0[_0xebe1('0x34')]=_['intersection'](_0x4891f0[_0xebe1('0x31')],_0x4891f0[_0xebe1('0x32')]);_0x77911d[_0xebe1('0x35')]=_[_0xebe1('0x36')](_0x4891f0[_0xebe1('0x31')],qs[_0xebe1('0x37')](_0x11652a[_0xebe1('0x32')][_0xebe1('0x37')]));_0x77911d[_0xebe1('0x35')]=_0x77911d[_0xebe1('0x35')][_0xebe1('0x38')]?_0x77911d[_0xebe1('0x35')]:_0x4891f0[_0xebe1('0x31')];if(!_0x11652a[_0xebe1('0x32')]['hasOwnProperty'](_0xebe1('0x39'))){_0x77911d[_0xebe1('0x1f')]=qs['limit'](_0x11652a[_0xebe1('0x32')]['limit']);_0x77911d['offset']=qs[_0xebe1('0x1d')](_0x11652a[_0xebe1('0x32')][_0xebe1('0x1d')]);}_0x77911d['order']=qs[_0xebe1('0x3a')](_0x11652a[_0xebe1('0x32')]['sort']);delete _0x11652a[_0xebe1('0x32')]['sort'];_0x77911d[_0xebe1('0x3b')]=qs[_0xebe1('0x34')](_['pick'](_0x11652a[_0xebe1('0x32')],_0x4891f0[_0xebe1('0x34')]),_0x1cb82c);if(_0x11652a[_0xebe1('0x32')][_0xebe1('0x3c')]){_0x77911d['where']=_['merge'](_0x77911d[_0xebe1('0x3b')],{'$or':_['map'](_0x1cb82c,function(_0x34e180){if(_0x34e180[_0xebe1('0x30')]!=='VIRTUAL'){var _0x16ea09={};_0x16ea09[_0x34e180['name']]={'$like':'%'+_0x11652a[_0xebe1('0x32')][_0xebe1('0x3c')]+'%'};return _0x16ea09;}})});}_0x77911d=_[_0xebe1('0x3d')]({},_0x77911d,_0x11652a[_0xebe1('0x3e')]);var _0x459da6={'where':_0x77911d['where']};return db[_0xebe1('0x3f')][_0xebe1('0x20')](_0x459da6)['then'](function(_0x336807){_0x2a4be5[_0xebe1('0x20')]=_0x336807;if(_0x11652a[_0xebe1('0x32')][_0xebe1('0x40')]){_0x77911d[_0xebe1('0x41')]=[{'all':!![]}];}return db[_0xebe1('0x3f')][_0xebe1('0x42')](_0x77911d);})['then'](function(_0x9ebc5b){_0x2a4be5['rows']=_0x9ebc5b;return _0x2a4be5;})[_0xebe1('0x27')](respondWithFilteredResult(_0x3361fb,_0x77911d))['catch'](handleError(_0x3361fb,null));};exports[_0xebe1('0x43')]=function(_0x3ae344,_0x547a33){var _0x3fb984={'raw':![],'where':{'id':_0x3ae344[_0xebe1('0x44')]['id']}},_0x46bad5={};_0x46bad5[_0xebe1('0x31')]=_[_0xebe1('0x33')](db[_0xebe1('0x3f')][_0xebe1('0x45')]);_0x46bad5[_0xebe1('0x32')]=_[_0xebe1('0x33')](_0x3ae344[_0xebe1('0x32')]);_0x46bad5[_0xebe1('0x34')]=_['intersection'](_0x46bad5[_0xebe1('0x31')],_0x46bad5['query']);_0x3fb984[_0xebe1('0x35')]=_[_0xebe1('0x36')](_0x46bad5['model'],qs[_0xebe1('0x37')](_0x3ae344[_0xebe1('0x32')][_0xebe1('0x37')]));_0x3fb984[_0xebe1('0x35')]=_0x3fb984[_0xebe1('0x35')][_0xebe1('0x38')]?_0x3fb984[_0xebe1('0x35')]:_0x46bad5[_0xebe1('0x31')];if(_0x3ae344[_0xebe1('0x32')]['includeAll']){_0x3fb984[_0xebe1('0x41')]=[{'all':!![]}];}_0x3fb984=_['merge']({},_0x3fb984,_0x3ae344[_0xebe1('0x3e')]);return db['VoiceMusicOnHold']['find'](_0x3fb984)['then'](handleEntityNotFound(_0x547a33,null))['then'](respondWithResult(_0x547a33,null))[_0xebe1('0x46')](handleError(_0x547a33,null));};exports['update']=function(_0x196929,_0x12a084){if(_0x196929['body']['id']){delete _0x196929[_0xebe1('0x47')]['id'];}return db[_0xebe1('0x3f')][_0xebe1('0x48')]({'where':{'id':_0x196929[_0xebe1('0x44')]['id']}})[_0xebe1('0x27')](handleEntityNotFound(_0x12a084,null))[_0xebe1('0x27')](saveUpdates(_0x196929['body'],null))[_0xebe1('0x27')](respondWithResult(_0x12a084,null))[_0xebe1('0x46')](handleError(_0x12a084,null));};exports[_0xebe1('0x49')]=function(_0x36cc10,_0x5c31d9,_0x124009){return db[_0xebe1('0x4a')]['transaction'](function(_0x51d250){if(_0x36cc10['body'][_0xebe1('0x4b')]===_0xebe1('0x4c')){_0x36cc10[_0xebe1('0x47')][_0xebe1('0x4d')]=path['join'](config['root'],_0xebe1('0x4e'),_0x36cc10[_0xebe1('0x47')][_0xebe1('0x2b')]);}return db[_0xebe1('0x3f')]['create'](_0x36cc10['body'],{'transaction':_0x51d250})[_0xebe1('0x27')](function(_0x5d155c){if(_0x36cc10['body'][_0xebe1('0x4b')]===_0xebe1('0x4c')){fs[_0xebe1('0x4f')](_0x5d155c[_0xebe1('0x4d')],parseInt(_0xebe1('0x50'),0x8));}var _0x40702b=_0x36cc10['user']['get']({'plain':!![]});if(!_0x40702b)throw new Error(_0xebe1('0x51'));if(_0x40702b[_0xebe1('0x52')]===_0xebe1('0x53')){var _0x3ab73b=_0x5d155c[_0xebe1('0x28')]({'plain':!![]});return db[_0xebe1('0x54')][_0xebe1('0x48')]({'where':{'name':_0xebe1('0x55'),'userProfileId':_0x40702b[_0xebe1('0x56')]},'raw':!![]})[_0xebe1('0x27')](function(_0x163bc3){if(_0x163bc3&&_0x163bc3[_0xebe1('0x57')]===0x0){return db['UserProfileResource'][_0xebe1('0x49')]({'name':_0x3ab73b['name'],'resourceId':_0x3ab73b['id'],'type':_0x163bc3[_0xebe1('0x2b')],'sectionId':_0x163bc3['id']},{})['then'](function(){return _0x5d155c;});}else{return _0x5d155c;}})[_0xebe1('0x46')](function(_0x53d0a1){logger[_0xebe1('0x2a')](_0xebe1('0x58'),_0x53d0a1);});}return _0x5d155c;});})[_0xebe1('0x27')](respondWithResult(_0x5c31d9,0xc9))['catch'](handleError(_0x5c31d9,null));};exports[_0xebe1('0x26')]=function(_0x43cf78,_0xb0e783,_0xa0025f){var _0x1b0fb6;return db['VoiceMusicOnHold']['find']({'where':{'id':_0x43cf78[_0xebe1('0x44')]['id']}})['then'](function(_0x415463){if(_0x415463){return db[_0xebe1('0x4a')][_0xebe1('0x59')](function(_0xe2902a){return _0x415463[_0xebe1('0x26')]({'transaction':_0xe2902a,'raw':!![]})[_0xebe1('0x27')](function(_0x261f98){if(_0x261f98['directory']){fs[_0xebe1('0x5a')](_0x261f98[_0xebe1('0x4d')])[_0xebe1('0x5b')](function(_0x2801e1){fs[_0xebe1('0x5c')](path['join'](_0x261f98[_0xebe1('0x4d')],_0x2801e1));});fs['rmdirSync'](_0x261f98[_0xebe1('0x4d')]);}return _0x261f98;});})['catch'](function(_0x2b717d){throw new db[(_0xebe1('0x5d'))][(_0xebe1('0x5e'))](_0x2b717d[_0xebe1('0x5f')]);});}})[_0xebe1('0x27')](handleEntityNotFound(_0xb0e783,null))[_0xebe1('0x27')](removeEntity(_0xb0e783,null))['catch'](handleError(_0xb0e783,null));};exports[_0xebe1('0x60')]=function(_0x3b84f1,_0x2ac56e,_0x37d6e7){return db[_0xebe1('0x4a')][_0xebe1('0x59')](function(_0x1fcaff){var _0x4b6f18;return db[_0xebe1('0x3f')]['find']({'where':{'id':_0x3b84f1[_0xebe1('0x44')]['id']}})['then'](function(_0x645b5d){if(_0x645b5d){_0x4b6f18=_0x645b5d;return _0x645b5d[_0xebe1('0x60')](_0x3b84f1['body']['id'],{'transaction':_0x1fcaff});}})[_0xebe1('0x27')](function(_0xd37dde){if(_0xd37dde){return db['Sound'][_0xebe1('0x61')]({'where':{'id':_0x3b84f1[_0xebe1('0x47')]['id']},'attributes':['id',_0xebe1('0x2b'),'save_name',_0xebe1('0x62'),'createdAt'],'raw':!![]});}})[_0xebe1('0x27')](function(_0x45fd66){if(_0x45fd66){var _0x3b9dbe=path['join'](config[_0xebe1('0x63')],_0xebe1('0x64'),util[_0xebe1('0x65')]('%s.%s',path[_0xebe1('0x66')](_0x45fd66[_0xebe1('0x67')],path[_0xebe1('0x68')](_0x45fd66['save_name'])),_0x45fd66[_0xebe1('0x62')]));var _0x2e9013=path[_0xebe1('0x69')](config[_0xebe1('0x63')],_0xebe1('0x4e'),_0x4b6f18[_0xebe1('0x2b')],util[_0xebe1('0x65')](_0xebe1('0x6a'),_0x45fd66[_0xebe1('0x2b')],_0x45fd66['converted_format']));fs[_0xebe1('0x6b')](_0x3b9dbe,_0x2e9013);return _0x45fd66;}})[_0xebe1('0x46')](function(_0x212d3c){throw new db[(_0xebe1('0x5d'))][(_0xebe1('0x5e'))](_0x212d3c[_0xebe1('0x5f')]);});})[_0xebe1('0x27')](handleEntityNotFound(_0x2ac56e,null))[_0xebe1('0x27')](respondWithResult(_0x2ac56e,0xc9))[_0xebe1('0x46')](handleError(_0x2ac56e,null));};exports['removeSound']=function(_0x98de5b,_0x4447bb,_0xb14e7){return db[_0xebe1('0x4a')][_0xebe1('0x59')](function(_0x26a844){var _0x22a788;return db[_0xebe1('0x3f')][_0xebe1('0x61')]({'where':{'id':_0x98de5b[_0xebe1('0x44')]['id']}})['then'](handleEntityNotFound(_0x4447bb,null))[_0xebe1('0x27')](function(_0x2ab509){if(_0x2ab509){_0x22a788=_0x2ab509;return _0x2ab509[_0xebe1('0x6c')](_0x98de5b[_0xebe1('0x44')][_0xebe1('0x6d')]);}})[_0xebe1('0x27')](function(_0x333ad5){if(_0x333ad5){return db[_0xebe1('0x6e')][_0xebe1('0x61')]({'where':{'id':_0x98de5b[_0xebe1('0x44')]['id2']},'attributes':['id',_0xebe1('0x2b'),'save_name','converted_format',_0xebe1('0x6f')],'raw':!![]});}})['then'](function(_0x4a27de){if(_0x4a27de){fs['unlinkSync'](path[_0xebe1('0x69')](_0x22a788[_0xebe1('0x4d')],util['format'](_0xebe1('0x6a'),_0x4a27de[_0xebe1('0x2b')],_0x4a27de[_0xebe1('0x62')])));return _0x4a27de;}})[_0xebe1('0x46')](function(_0x39ff4c){throw new db[(_0xebe1('0x5d'))][(_0xebe1('0x5e'))](_0x39ff4c[_0xebe1('0x5f')]);});})['then'](handleEntityNotFound(_0x4447bb,null))[_0xebe1('0x27')](respondWithStatusCode(_0x4447bb,0xcc))[_0xebe1('0x46')](handleError(_0x4447bb,null));};exports[_0xebe1('0x70')]=function(_0x2314f4,_0x57b91d,_0xdea200){var _0x1584bd={};var _0x581462={};var _0x2094ec;var _0x13b941;return db[_0xebe1('0x3f')][_0xebe1('0x61')]({'where':{'id':_0x2314f4[_0xebe1('0x44')]['id']}})[_0xebe1('0x27')](handleEntityNotFound(_0x57b91d,null))['then'](function(_0x2625ae){if(_0x2625ae){_0x2094ec=_0x2625ae;_0x581462[_0xebe1('0x31')]=_[_0xebe1('0x33')](db[_0xebe1('0x6e')][_0xebe1('0x45')]);_0x581462[_0xebe1('0x32')]=_['keys'](_0x2314f4[_0xebe1('0x32')]);_0x581462[_0xebe1('0x34')]=_[_0xebe1('0x36')](_0x581462['model'],_0x581462[_0xebe1('0x32')]);_0x1584bd[_0xebe1('0x35')]=_[_0xebe1('0x36')](_0x581462[_0xebe1('0x31')],qs[_0xebe1('0x37')](_0x2314f4['query'][_0xebe1('0x37')]));_0x1584bd[_0xebe1('0x35')]=_0x1584bd[_0xebe1('0x35')][_0xebe1('0x38')]?_0x1584bd['attributes']:_0x581462[_0xebe1('0x31')];_0x1584bd['order']=qs[_0xebe1('0x3a')](_0x2314f4['query'][_0xebe1('0x3a')]);_0x1584bd[_0xebe1('0x3b')]=qs[_0xebe1('0x34')](_[_0xebe1('0x71')](_0x2314f4[_0xebe1('0x32')],_0x581462[_0xebe1('0x34')]));if(_0x2314f4['query'][_0xebe1('0x3c')]){_0x1584bd['where']=_['merge'](_0x1584bd[_0xebe1('0x3b')],{'$or':_[_0xebe1('0x2e')](_0x1584bd[_0xebe1('0x35')],function(_0x5d13dd){var _0x5919d5={};_0x5919d5[_0x5d13dd]={'$like':'%'+_0x2314f4[_0xebe1('0x32')][_0xebe1('0x3c')]+'%'};return _0x5919d5;})});}_0x1584bd=_['merge']({},_0x1584bd,_0x2314f4[_0xebe1('0x3e')]);return _0x2094ec[_0xebe1('0x70')](_0x1584bd);}})[_0xebe1('0x27')](function(_0x901060){if(_0x901060){_0x13b941=_0x901060[_0xebe1('0x38')];if(!_0x2314f4[_0xebe1('0x32')][_0xebe1('0x72')](_0xebe1('0x39'))){_0x1584bd['limit']=qs['limit'](_0x2314f4['query'][_0xebe1('0x1f')]);_0x1584bd[_0xebe1('0x1d')]=qs['offset'](_0x2314f4[_0xebe1('0x32')][_0xebe1('0x1d')]);}return _0x2094ec[_0xebe1('0x70')](_0x1584bd);}})[_0xebe1('0x27')](function(_0x14b928){if(_0x14b928){return _0x14b928?{'count':_0x13b941,'rows':_0x14b928}:null;}})[_0xebe1('0x27')](respondWithResult(_0x57b91d,null))[_0xebe1('0x46')](handleError(_0x57b91d,null));}; \ No newline at end of file +var _0xab0c=['message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','Sequelize','removeSound','id2','getSounds','pick','hasOwnProperty','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','ioredis','../../components/auth/service','../../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','destroy','MusicOnHolds','UserProfileResource','then','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','update','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError'];(function(_0x618644,_0x24242b){var _0x401623=function(_0x58dcce){while(--_0x58dcce){_0x618644['push'](_0x618644['shift']());}};_0x401623(++_0x24242b);}(_0xab0c,0x102));var _0xcab0=function(_0x3233d5,_0xd6788d){_0x3233d5=_0x3233d5-0x0;var _0x1fdf57=_0xab0c[_0x3233d5];return _0x1fdf57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcab0('0x0'));var zipdir=require(_0xcab0('0x1'));var jsonpatch=require(_0xcab0('0x2'));var rp=require(_0xcab0('0x3'));var moment=require(_0xcab0('0x4'));var BPromise=require(_0xcab0('0x5'));var Mustache=require(_0xcab0('0x6'));var util=require(_0xcab0('0x7'));var path=require(_0xcab0('0x8'));var sox=require(_0xcab0('0x9'));var csv=require(_0xcab0('0xa'));var ejs=require(_0xcab0('0xb'));var fs=require('fs');var fs_extra=require(_0xcab0('0xc'));var _=require(_0xcab0('0xd'));var squel=require(_0xcab0('0xe'));var crypto=require(_0xcab0('0xf'));var jsforce=require(_0xcab0('0x10'));var deskjs=require(_0xcab0('0x11'));var toCsv=require('to-csv');var querystring=require(_0xcab0('0x12'));var Papa=require('papaparse');var Redis=require(_0xcab0('0x13'));var authService=require(_0xcab0('0x14'));var qs=require(_0xcab0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcab0('0x16'));var logger=require(_0xcab0('0x17'))(_0xcab0('0x18'));var utils=require(_0xcab0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xcab0('0x1a'));var db=require(_0xcab0('0x1b'))['db'];function respondWithStatusCode(_0x151d5f,_0x18d317){_0x18d317=_0x18d317||0xcc;return function(_0x5dbad3){if(_0x5dbad3){return _0x151d5f[_0xcab0('0x1c')](_0x18d317);}return _0x151d5f['status'](_0x18d317)[_0xcab0('0x1d')]();};}function respondWithResult(_0x319d95,_0x5ee99a){_0x5ee99a=_0x5ee99a||0xc8;return function(_0x50a88e){if(_0x50a88e){return _0x319d95[_0xcab0('0x1e')](_0x5ee99a)['json'](_0x50a88e);}};}function respondWithFilteredResult(_0x5211da,_0x4841c3){return function(_0x173281){if(_0x173281){var _0x5e3df1=typeof _0x4841c3[_0xcab0('0x1f')]===_0xcab0('0x20')&&typeof _0x4841c3[_0xcab0('0x21')]==='undefined';var _0x175d87=_0x173281[_0xcab0('0x22')];var _0x3114c9=_0x5e3df1?0x0:_0x4841c3[_0xcab0('0x1f')];var _0x1e7ca2=_0x5e3df1?_0x173281[_0xcab0('0x22')]:_0x4841c3[_0xcab0('0x1f')]+_0x4841c3[_0xcab0('0x21')];var _0x4c1bb3;if(_0x1e7ca2>=_0x175d87){_0x1e7ca2=_0x175d87;_0x4c1bb3=0xc8;}else{_0x4c1bb3=0xce;}_0x5211da['status'](_0x4c1bb3);return _0x5211da[_0xcab0('0x23')](_0xcab0('0x24'),_0x3114c9+'-'+_0x1e7ca2+'/'+_0x175d87)[_0xcab0('0x25')](_0x173281);}return null;};}function patchUpdates(_0x2ef1d1){return function(_0x1586be){try{jsonpatch['apply'](_0x1586be,_0x2ef1d1,!![]);}catch(_0x4bef00){return BPromise['reject'](_0x4bef00);}return _0x1586be['save']();};}function saveUpdates(_0x18eaf7,_0x47a999){return function(_0xb7606b){if(_0xb7606b){return _0xb7606b['update'](_0x18eaf7)['then'](function(_0x4b89bc){return _0x4b89bc;});}return null;};}function removeEntity(_0x485ac6,_0x439d9c){return function(_0x165982){if(_0x165982){return _0x165982[_0xcab0('0x26')]()['then'](function(){var _0x1eb6cf=_0x165982['get']({'plain':!![]});var _0x55efb4=_0xcab0('0x27');return db[_0xcab0('0x28')]['destroy']({'where':{'type':_0x55efb4,'resourceId':_0x1eb6cf['id']}})[_0xcab0('0x29')](function(){return _0x165982;});})[_0xcab0('0x29')](function(){_0x485ac6['status'](0xcc)[_0xcab0('0x1d')]();});}};}function handleEntityNotFound(_0x14adcc,_0x5b7f94){return function(_0x1b82f9){if(!_0x1b82f9){_0x14adcc[_0xcab0('0x1c')](0x194);}return _0x1b82f9;};}function handleError(_0x1cf7af,_0x5ce90d){_0x5ce90d=_0x5ce90d||0x1f4;return function(_0x307d52){logger[_0xcab0('0x2a')](_0x307d52[_0xcab0('0x2b')]);if(_0x307d52[_0xcab0('0x2c')]){delete _0x307d52[_0xcab0('0x2c')];}_0x1cf7af[_0xcab0('0x1e')](_0x5ce90d)[_0xcab0('0x2d')](_0x307d52);};}exports[_0xcab0('0x2e')]=function(_0x2c41c4,_0x1fb55a){var _0x422dff={},_0x197fd0={},_0x397e0f={'count':0x0,'rows':[]};var _0x36a489=_['map'](db[_0xcab0('0x2f')][_0xcab0('0x30')],function(_0x16fa6f){return{'name':_0x16fa6f[_0xcab0('0x31')],'type':_0x16fa6f[_0xcab0('0x32')][_0xcab0('0x33')]};});_0x197fd0[_0xcab0('0x34')]=_[_0xcab0('0x35')](_0x36a489,_0xcab0('0x2c'));_0x197fd0[_0xcab0('0x36')]=_[_0xcab0('0x37')](_0x2c41c4[_0xcab0('0x36')]);_0x197fd0[_0xcab0('0x38')]=_[_0xcab0('0x39')](_0x197fd0[_0xcab0('0x34')],_0x197fd0[_0xcab0('0x36')]);_0x422dff['attributes']=_['intersection'](_0x197fd0[_0xcab0('0x34')],qs['fields'](_0x2c41c4[_0xcab0('0x36')][_0xcab0('0x3a')]));_0x422dff[_0xcab0('0x3b')]=_0x422dff['attributes'][_0xcab0('0x3c')]?_0x422dff[_0xcab0('0x3b')]:_0x197fd0[_0xcab0('0x34')];if(!_0x2c41c4[_0xcab0('0x36')]['hasOwnProperty'](_0xcab0('0x3d'))){_0x422dff['limit']=qs[_0xcab0('0x21')](_0x2c41c4['query'][_0xcab0('0x21')]);_0x422dff[_0xcab0('0x1f')]=qs[_0xcab0('0x1f')](_0x2c41c4[_0xcab0('0x36')]['offset']);}_0x422dff[_0xcab0('0x3e')]=qs[_0xcab0('0x3f')](_0x2c41c4[_0xcab0('0x36')][_0xcab0('0x3f')]);delete _0x2c41c4[_0xcab0('0x36')][_0xcab0('0x3f')];_0x422dff[_0xcab0('0x40')]=qs[_0xcab0('0x38')](_['pick'](_0x2c41c4[_0xcab0('0x36')],_0x197fd0['filters']),_0x36a489);if(_0x2c41c4[_0xcab0('0x36')][_0xcab0('0x41')]){_0x422dff['where']=_['merge'](_0x422dff['where'],{'$or':_['map'](_0x36a489,function(_0x1812f0){if(_0x1812f0[_0xcab0('0x32')]!==_0xcab0('0x42')){var _0x79ecac={};_0x79ecac[_0x1812f0['name']]={'$like':'%'+_0x2c41c4[_0xcab0('0x36')][_0xcab0('0x41')]+'%'};return _0x79ecac;}})});}_0x422dff=_[_0xcab0('0x43')]({},_0x422dff,_0x2c41c4['options']);var _0x5821db={'where':_0x422dff[_0xcab0('0x40')]};return db[_0xcab0('0x2f')]['count'](_0x5821db)[_0xcab0('0x29')](function(_0x497136){_0x397e0f[_0xcab0('0x22')]=_0x497136;if(_0x2c41c4[_0xcab0('0x36')]['includeAll']){_0x422dff[_0xcab0('0x44')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xcab0('0x45')](_0x422dff);})[_0xcab0('0x29')](function(_0x5ea1d5){_0x397e0f[_0xcab0('0x46')]=_0x5ea1d5;return _0x397e0f;})[_0xcab0('0x29')](respondWithFilteredResult(_0x1fb55a,_0x422dff))[_0xcab0('0x47')](handleError(_0x1fb55a,null));};exports[_0xcab0('0x48')]=function(_0x5bebc5,_0x3c7983){var _0x30285c={'raw':![],'where':{'id':_0x5bebc5[_0xcab0('0x49')]['id']}},_0x3097d7={};_0x3097d7[_0xcab0('0x34')]=_['keys'](db[_0xcab0('0x2f')][_0xcab0('0x30')]);_0x3097d7[_0xcab0('0x36')]=_[_0xcab0('0x37')](_0x5bebc5[_0xcab0('0x36')]);_0x3097d7[_0xcab0('0x38')]=_[_0xcab0('0x39')](_0x3097d7[_0xcab0('0x34')],_0x3097d7[_0xcab0('0x36')]);_0x30285c[_0xcab0('0x3b')]=_[_0xcab0('0x39')](_0x3097d7[_0xcab0('0x34')],qs['fields'](_0x5bebc5[_0xcab0('0x36')][_0xcab0('0x3a')]));_0x30285c[_0xcab0('0x3b')]=_0x30285c['attributes']['length']?_0x30285c['attributes']:_0x3097d7['model'];if(_0x5bebc5[_0xcab0('0x36')][_0xcab0('0x4a')]){_0x30285c[_0xcab0('0x44')]=[{'all':!![]}];}_0x30285c=_[_0xcab0('0x43')]({},_0x30285c,_0x5bebc5[_0xcab0('0x4b')]);return db[_0xcab0('0x2f')][_0xcab0('0x4c')](_0x30285c)['then'](handleEntityNotFound(_0x3c7983,null))[_0xcab0('0x29')](respondWithResult(_0x3c7983,null))[_0xcab0('0x47')](handleError(_0x3c7983,null));};exports[_0xcab0('0x4d')]=function(_0x5004b3,_0x26e3e1){if(_0x5004b3['body']['id']){delete _0x5004b3['body']['id'];}return db[_0xcab0('0x2f')][_0xcab0('0x4c')]({'where':{'id':_0x5004b3[_0xcab0('0x49')]['id']}})['then'](handleEntityNotFound(_0x26e3e1,null))[_0xcab0('0x29')](saveUpdates(_0x5004b3[_0xcab0('0x4e')],null))[_0xcab0('0x29')](respondWithResult(_0x26e3e1,null))[_0xcab0('0x47')](handleError(_0x26e3e1,null));};exports[_0xcab0('0x4f')]=function(_0x1e1906,_0x1b25b4,_0x3f13e1){return db[_0xcab0('0x50')][_0xcab0('0x51')](function(_0x169275){if(_0x1e1906[_0xcab0('0x4e')][_0xcab0('0x52')]===_0xcab0('0x53')){_0x1e1906[_0xcab0('0x4e')][_0xcab0('0x54')]=path[_0xcab0('0x55')](config[_0xcab0('0x56')],_0xcab0('0x57'),_0x1e1906[_0xcab0('0x4e')][_0xcab0('0x2c')]);}return db[_0xcab0('0x2f')]['create'](_0x1e1906[_0xcab0('0x4e')],{'transaction':_0x169275})[_0xcab0('0x29')](function(_0x1841c9){if(_0x1e1906[_0xcab0('0x4e')][_0xcab0('0x52')]===_0xcab0('0x53')){fs[_0xcab0('0x58')](_0x1841c9[_0xcab0('0x54')],parseInt(_0xcab0('0x59'),0x8));}var _0x39eca6=_0x1e1906['user']['get']({'plain':!![]});if(!_0x39eca6)throw new Error(_0xcab0('0x5a'));if(_0x39eca6[_0xcab0('0x5b')]===_0xcab0('0x5c')){var _0x2e4fe4=_0x1841c9[_0xcab0('0x5d')]({'plain':!![]});return db['UserProfileSection'][_0xcab0('0x4c')]({'where':{'name':_0xcab0('0x27'),'userProfileId':_0x39eca6[_0xcab0('0x5e')]},'raw':!![]})[_0xcab0('0x29')](function(_0x33d5cb){if(_0x33d5cb&&_0x33d5cb[_0xcab0('0x5f')]===0x0){return db[_0xcab0('0x28')][_0xcab0('0x4f')]({'name':_0x2e4fe4[_0xcab0('0x2c')],'resourceId':_0x2e4fe4['id'],'type':_0x33d5cb[_0xcab0('0x2c')],'sectionId':_0x33d5cb['id']},{})[_0xcab0('0x29')](function(){return _0x1841c9;});}else{return _0x1841c9;}})['catch'](function(_0x1e34c9){logger['error'](_0xcab0('0x60'),_0x1e34c9);});}return _0x1841c9;});})[_0xcab0('0x29')](respondWithResult(_0x1b25b4,0xc9))[_0xcab0('0x47')](handleError(_0x1b25b4,null));};exports[_0xcab0('0x26')]=function(_0x3cffe9,_0x44a6c9,_0x20c45d){var _0x596c5c;return db[_0xcab0('0x2f')]['find']({'where':{'id':_0x3cffe9[_0xcab0('0x49')]['id']}})[_0xcab0('0x29')](function(_0x5265f7){if(_0x5265f7){return db[_0xcab0('0x50')]['transaction'](function(_0x141808){return _0x5265f7[_0xcab0('0x26')]({'transaction':_0x141808,'raw':!![]})['then'](function(_0x20cbd0){if(_0x20cbd0[_0xcab0('0x54')]){fs[_0xcab0('0x61')](_0x20cbd0[_0xcab0('0x54')])[_0xcab0('0x62')](function(_0xfb813a){fs[_0xcab0('0x63')](path['join'](_0x20cbd0['directory'],_0xfb813a));});fs[_0xcab0('0x64')](_0x20cbd0['directory']);}return _0x20cbd0;});})[_0xcab0('0x47')](function(_0x162841){throw new db['Sequelize'][(_0xcab0('0x65'))](_0x162841[_0xcab0('0x66')]);});}})[_0xcab0('0x29')](handleEntityNotFound(_0x44a6c9,null))[_0xcab0('0x29')](removeEntity(_0x44a6c9,null))[_0xcab0('0x47')](handleError(_0x44a6c9,null));};exports[_0xcab0('0x67')]=function(_0x41d308,_0xd2a148,_0x2ab7f9){return db[_0xcab0('0x50')][_0xcab0('0x51')](function(_0x34a766){var _0x3be4e9;return db['VoiceMusicOnHold'][_0xcab0('0x4c')]({'where':{'id':_0x41d308[_0xcab0('0x49')]['id']}})[_0xcab0('0x29')](function(_0x4623b0){if(_0x4623b0){_0x3be4e9=_0x4623b0;return _0x4623b0[_0xcab0('0x67')](_0x41d308[_0xcab0('0x4e')]['id'],{'transaction':_0x34a766});}})[_0xcab0('0x29')](function(_0x6eb68a){if(_0x6eb68a){return db[_0xcab0('0x68')][_0xcab0('0x69')]({'where':{'id':_0x41d308[_0xcab0('0x4e')]['id']},'attributes':['id','name',_0xcab0('0x6a'),_0xcab0('0x6b'),_0xcab0('0x6c')],'raw':!![]});}})['then'](function(_0x2db81c){if(_0x2db81c){var _0x30fed9=path['join'](config[_0xcab0('0x56')],_0xcab0('0x6d'),util[_0xcab0('0x6e')](_0xcab0('0x6f'),path[_0xcab0('0x70')](_0x2db81c['save_name'],path['extname'](_0x2db81c[_0xcab0('0x6a')])),_0x2db81c[_0xcab0('0x6b')]));var _0x3f8e6d=path['join'](config[_0xcab0('0x56')],_0xcab0('0x57'),_0x3be4e9[_0xcab0('0x2c')],util[_0xcab0('0x6e')](_0xcab0('0x6f'),_0x2db81c['name'],_0x2db81c[_0xcab0('0x6b')]));fs[_0xcab0('0x71')](_0x30fed9,_0x3f8e6d);return _0x2db81c;}})[_0xcab0('0x47')](function(_0x131714){throw new db[(_0xcab0('0x72'))][(_0xcab0('0x65'))](_0x131714[_0xcab0('0x66')]);});})[_0xcab0('0x29')](handleEntityNotFound(_0xd2a148,null))[_0xcab0('0x29')](respondWithResult(_0xd2a148,0xc9))[_0xcab0('0x47')](handleError(_0xd2a148,null));};exports[_0xcab0('0x73')]=function(_0x2f1080,_0x283bc7,_0x45e182){return db['sequelize'][_0xcab0('0x51')](function(_0x47fda6){var _0x42a774;return db[_0xcab0('0x2f')]['findOne']({'where':{'id':_0x2f1080[_0xcab0('0x49')]['id']}})['then'](handleEntityNotFound(_0x283bc7,null))[_0xcab0('0x29')](function(_0x51bade){if(_0x51bade){_0x42a774=_0x51bade;return _0x51bade[_0xcab0('0x73')](_0x2f1080['params'][_0xcab0('0x74')]);}})['then'](function(_0x46dc06){if(_0x46dc06){return db[_0xcab0('0x68')][_0xcab0('0x69')]({'where':{'id':_0x2f1080[_0xcab0('0x49')]['id2']},'attributes':['id',_0xcab0('0x2c'),_0xcab0('0x6a'),'converted_format',_0xcab0('0x6c')],'raw':!![]});}})['then'](function(_0x1a7ec3){if(_0x1a7ec3){fs[_0xcab0('0x63')](path[_0xcab0('0x55')](_0x42a774[_0xcab0('0x54')],util[_0xcab0('0x6e')](_0xcab0('0x6f'),_0x1a7ec3['name'],_0x1a7ec3['converted_format'])));return _0x1a7ec3;}})[_0xcab0('0x47')](function(_0x5e1a35){throw new db[(_0xcab0('0x72'))][(_0xcab0('0x65'))](_0x5e1a35[_0xcab0('0x66')]);});})[_0xcab0('0x29')](handleEntityNotFound(_0x283bc7,null))[_0xcab0('0x29')](respondWithStatusCode(_0x283bc7,0xcc))[_0xcab0('0x47')](handleError(_0x283bc7,null));};exports[_0xcab0('0x75')]=function(_0x4a4ba4,_0xc532c6,_0x2f1cdd){var _0x248271={};var _0x2cae66={};var _0x3b2a8d;var _0x552fcb;return db[_0xcab0('0x2f')][_0xcab0('0x69')]({'where':{'id':_0x4a4ba4[_0xcab0('0x49')]['id']}})[_0xcab0('0x29')](handleEntityNotFound(_0xc532c6,null))['then'](function(_0x35bbe2){if(_0x35bbe2){_0x3b2a8d=_0x35bbe2;_0x2cae66[_0xcab0('0x34')]=_['keys'](db[_0xcab0('0x68')]['rawAttributes']);_0x2cae66[_0xcab0('0x36')]=_[_0xcab0('0x37')](_0x4a4ba4['query']);_0x2cae66[_0xcab0('0x38')]=_[_0xcab0('0x39')](_0x2cae66[_0xcab0('0x34')],_0x2cae66['query']);_0x248271[_0xcab0('0x3b')]=_['intersection'](_0x2cae66['model'],qs[_0xcab0('0x3a')](_0x4a4ba4[_0xcab0('0x36')][_0xcab0('0x3a')]));_0x248271[_0xcab0('0x3b')]=_0x248271['attributes'][_0xcab0('0x3c')]?_0x248271[_0xcab0('0x3b')]:_0x2cae66[_0xcab0('0x34')];_0x248271[_0xcab0('0x3e')]=qs[_0xcab0('0x3f')](_0x4a4ba4[_0xcab0('0x36')][_0xcab0('0x3f')]);_0x248271[_0xcab0('0x40')]=qs[_0xcab0('0x38')](_[_0xcab0('0x76')](_0x4a4ba4[_0xcab0('0x36')],_0x2cae66['filters']));if(_0x4a4ba4['query'][_0xcab0('0x41')]){_0x248271[_0xcab0('0x40')]=_[_0xcab0('0x43')](_0x248271['where'],{'$or':_[_0xcab0('0x35')](_0x248271[_0xcab0('0x3b')],function(_0x45f853){var _0x4d34ed={};_0x4d34ed[_0x45f853]={'$like':'%'+_0x4a4ba4[_0xcab0('0x36')][_0xcab0('0x41')]+'%'};return _0x4d34ed;})});}_0x248271=_['merge']({},_0x248271,_0x4a4ba4[_0xcab0('0x4b')]);return _0x3b2a8d[_0xcab0('0x75')](_0x248271);}})[_0xcab0('0x29')](function(_0x236733){if(_0x236733){_0x552fcb=_0x236733[_0xcab0('0x3c')];if(!_0x4a4ba4[_0xcab0('0x36')][_0xcab0('0x77')](_0xcab0('0x3d'))){_0x248271[_0xcab0('0x21')]=qs[_0xcab0('0x21')](_0x4a4ba4[_0xcab0('0x36')][_0xcab0('0x21')]);_0x248271[_0xcab0('0x1f')]=qs[_0xcab0('0x1f')](_0x4a4ba4[_0xcab0('0x36')]['offset']);}return _0x3b2a8d['getSounds'](_0x248271);}})[_0xcab0('0x29')](function(_0x2ae777){if(_0x2ae777){return _0x2ae777?{'count':_0x552fcb,'rows':_0x2ae777}:null;}})[_0xcab0('0x29')](respondWithResult(_0xc532c6,null))['catch'](handleError(_0xc532c6,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 0da8ab1..b790573 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 _0x83ab=['exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x571780,_0x27314e){var _0x572b30=function(_0x4d94ef){while(--_0x4d94ef){_0x571780['push'](_0x571780['shift']());}};_0x572b30(++_0x27314e);}(_0x83ab,0xfe));var _0xb83a=function(_0x45fe9c,_0x55e0d7){_0x45fe9c=_0x45fe9c-0x0;var _0x233d48=_0x83ab[_0x45fe9c];return _0x233d48;};'use strict';var _=require('lodash');var util=require(_0xb83a('0x0'));var logger=require(_0xb83a('0x1'))(_0xb83a('0x2'));var moment=require(_0xb83a('0x3'));var BPromise=require(_0xb83a('0x4'));var rp=require(_0xb83a('0x5'));var fs=require('fs');var path=require(_0xb83a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xb83a('0x7')]=function(_0x461377,_0x15e99b){return _0x461377[_0xb83a('0x8')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2678=['define','voice_musiconhold','lodash','api','moment','bluebird','path','rimraf','./voiceMusicOnHold.attributes','exports'];(function(_0x18b7f0,_0x403e49){var _0x38a953=function(_0x387f9c){while(--_0x387f9c){_0x18b7f0['push'](_0x18b7f0['shift']());}};_0x38a953(++_0x403e49);}(_0x2678,0x1a6));var _0x8267=function(_0x1406d9,_0x483ccd){_0x1406d9=_0x1406d9-0x0;var _0x28eaf0=_0x2678[_0x1406d9];return _0x28eaf0;};'use strict';var _=require(_0x8267('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8267('0x1'));var moment=require(_0x8267('0x2'));var BPromise=require(_0x8267('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8267('0x4'));var rimraf=require(_0x8267('0x5'));var config=require('../../config/environment');var attributes=require(_0x8267('0x6'));module[_0x8267('0x7')]=function(_0x4f95f7,_0x108504){return _0x4f95f7[_0x8267('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x8267('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 9e0db3d..b924ef9 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(_0x4d99c1,_0x18f8f4){var _0x339457=function(_0x4c1872){while(--_0x4c1872){_0x4d99c1['push'](_0x4d99c1['shift']());}};_0x339457(++_0x18f8f4);}(_0xedd9,0xfc));var _0x9edd=function(_0x1eee30,_0xb24060){_0x1eee30=_0x1eee30-0x0;var _0x8660ab=_0xedd9[_0x1eee30];return _0x8660ab;};'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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s'];(function(_0x300d18,_0x5dac40){var _0x42029d=function(_0x325701){while(--_0x325701){_0x300d18['push'](_0x300d18['shift']());}};_0x42029d(++_0x5dac40);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0xcb91[_0x4b7b69];return _0x173b4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 975d4e8..c77cd56 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 _0xa8ca=['removeTeams','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/users','getAgents','/:id/teams','getTeams','post','create','addAgents','addTeams','put','update','delete','/:id','destroy'];(function(_0x1ec826,_0x3ec611){var _0x48eb14=function(_0x18cf30){while(--_0x18cf30){_0x1ec826['push'](_0x1ec826['shift']());}};_0x48eb14(++_0x3ec611);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x2667c3,_0x5cbc3c){_0x2667c3=_0x2667c3-0x0;var _0x52274d=_0xa8ca[_0x2667c3];return _0x52274d;};'use strict';var multer=require(_0xaa8c('0x0'));var util=require('util');var path=require(_0xaa8c('0x1'));var timeout=require('connect-timeout');var express=require(_0xaa8c('0x2'));var router=express[_0xaa8c('0x3')]();var fs_extra=require(_0xaa8c('0x4'));var auth=require(_0xaa8c('0x5'));var interaction=require(_0xaa8c('0x6'));var config=require(_0xaa8c('0x7'));var controller=require('./voicePrefix.controller');router[_0xaa8c('0x8')]('/',auth[_0xaa8c('0x9')](),controller['index']);router['get'](_0xaa8c('0xa'),auth[_0xaa8c('0x9')](),controller['describe']);router['get']('/:id',auth[_0xaa8c('0x9')](),controller[_0xaa8c('0xb')]);router[_0xaa8c('0x8')](_0xaa8c('0xc'),auth[_0xaa8c('0x9')](),controller[_0xaa8c('0xd')]);router[_0xaa8c('0x8')](_0xaa8c('0xe'),auth[_0xaa8c('0x9')](),controller[_0xaa8c('0xf')]);router[_0xaa8c('0x10')]('/',auth[_0xaa8c('0x9')](),controller[_0xaa8c('0x11')]);router['post'](_0xaa8c('0xc'),auth['isAuthenticated'](),controller[_0xaa8c('0x12')]);router[_0xaa8c('0x10')](_0xaa8c('0xe'),auth['isAuthenticated'](),controller[_0xaa8c('0x13')]);router[_0xaa8c('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xaa8c('0x15')]);router[_0xaa8c('0x16')](_0xaa8c('0x17'),auth[_0xaa8c('0x9')](),controller[_0xaa8c('0x18')]);router['delete'](_0xaa8c('0xc'),auth[_0xaa8c('0x9')](),controller['removeAgents']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xaa8c('0x19')]);module[_0xaa8c('0x1a')]=router; \ No newline at end of file +var _0x59c3=['describe','/:id','show','/:id/users','getAgents','/:id/teams','post','create','addAgents','addTeams','put','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x155890,_0x21813e){var _0x3f156d=function(_0x3edc20){while(--_0x3edc20){_0x155890['push'](_0x155890['shift']());}};_0x3f156d(++_0x21813e);}(_0x59c3,0x133));var _0x359c=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x59c3[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0x359c('0x0'));var util=require(_0x359c('0x1'));var path=require(_0x359c('0x2'));var timeout=require(_0x359c('0x3'));var express=require(_0x359c('0x4'));var router=express[_0x359c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x359c('0x6'));var interaction=require(_0x359c('0x7'));var config=require(_0x359c('0x8'));var controller=require(_0x359c('0x9'));router[_0x359c('0xa')]('/',auth[_0x359c('0xb')](),controller['index']);router[_0x359c('0xa')]('/describe',auth[_0x359c('0xb')](),controller[_0x359c('0xc')]);router[_0x359c('0xa')](_0x359c('0xd'),auth['isAuthenticated'](),controller[_0x359c('0xe')]);router['get'](_0x359c('0xf'),auth[_0x359c('0xb')](),controller[_0x359c('0x10')]);router[_0x359c('0xa')](_0x359c('0x11'),auth[_0x359c('0xb')](),controller['getTeams']);router[_0x359c('0x12')]('/',auth[_0x359c('0xb')](),controller[_0x359c('0x13')]);router[_0x359c('0x12')](_0x359c('0xf'),auth[_0x359c('0xb')](),controller[_0x359c('0x14')]);router[_0x359c('0x12')](_0x359c('0x11'),auth[_0x359c('0xb')](),controller[_0x359c('0x15')]);router[_0x359c('0x16')]('/:id',auth[_0x359c('0xb')](),controller[_0x359c('0x17')]);router['delete'](_0x359c('0xd'),auth[_0x359c('0xb')](),controller[_0x359c('0x18')]);router[_0x359c('0x19')](_0x359c('0xf'),auth[_0x359c('0xb')](),controller[_0x359c('0x1a')]);router[_0x359c('0x19')](_0x359c('0x11'),auth[_0x359c('0xb')](),controller[_0x359c('0x1b')]);module[_0x359c('0x1c')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index edd6572..8082ef0 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 _0x4cca=['VIRTUAL','system-','INTEGER','exports','STRING','name'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x4cca,0x99));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xa4cc('0x0')]={'name':{'type':Sequelize[_0xa4cc('0x1')],'allowNull':![],'unique':_0xa4cc('0x2')},'prefix':{'type':Sequelize[_0xa4cc('0x3')],'get':function(_0x83fad){return _0xa4cc('0x4')+this['getDataValue'](_0xa4cc('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xa4cc('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xa4cc('0x5')]}}; \ No newline at end of file +var _0xf5c5=['name','system-','getDataValue','INTEGER','sequelize','STRING'];(function(_0xd57ee0,_0x21c68e){var _0x33c40f=function(_0x5940c8){while(--_0x5940c8){_0xd57ee0['push'](_0xd57ee0['shift']());}};_0x33c40f(++_0x21c68e);}(_0xf5c5,0x94));var _0x5f5c=function(_0x5bb825,_0xfc2941){_0x5bb825=_0x5bb825-0x0;var _0x543072=_0xf5c5[_0x5bb825];return _0x543072;};'use strict';var Sequelize=require(_0x5f5c('0x0'));module['exports']={'name':{'type':Sequelize[_0x5f5c('0x1')],'allowNull':![],'unique':_0x5f5c('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x5a3914){return _0x5f5c('0x3')+this[_0x5f5c('0x4')](_0x5f5c('0x2'))+'-';}},'description':{'type':Sequelize[_0x5f5c('0x1')]},'callerIdAll':{'type':Sequelize[_0x5f5c('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x5f5c('0x5')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 6610d29..c0090ed 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 _0x5fdc=['fs-extra','lodash','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','index','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','includeAll','catch','show','include','options','find','params','describe','create','sequelize','transaction','body','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoiceExtension','VoicePrefixId','Extensions\x20creation\x20failed','push','callerIdAll','Set','PREFIX-CALLERIDALL=','goto','${EXTEN:','charAt','system-','addAgents','ids','omit','spread','emit','removeAgents','isArray','getAgents','findOne','User','filter','getTeams','Team','findAll','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','Agents','select','field','tq.TeamId','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x5fdc,0x127));var _0xc5fd=function(_0x1cd8e3,_0x2e5b28){_0x1cd8e3=_0x1cd8e3-0x0;var _0x56c533=_0x5fdc[_0x1cd8e3];return _0x56c533;};'use strict';var emlformat=require(_0xc5fd('0x0'));var rimraf=require(_0xc5fd('0x1'));var zipdir=require(_0xc5fd('0x2'));var jsonpatch=require(_0xc5fd('0x3'));var rp=require(_0xc5fd('0x4'));var moment=require(_0xc5fd('0x5'));var BPromise=require(_0xc5fd('0x6'));var Mustache=require(_0xc5fd('0x7'));var util=require(_0xc5fd('0x8'));var path=require(_0xc5fd('0x9'));var sox=require(_0xc5fd('0xa'));var csv=require(_0xc5fd('0xb'));var ejs=require(_0xc5fd('0xc'));var fs=require('fs');var fs_extra=require(_0xc5fd('0xd'));var _=require(_0xc5fd('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc5fd('0xf'));var toCsv=require(_0xc5fd('0xb'));var querystring=require(_0xc5fd('0x10'));var Papa=require(_0xc5fd('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc5fd('0x12'));var as=require(_0xc5fd('0x13'));var hardwareService=require(_0xc5fd('0x14'));var logger=require(_0xc5fd('0x15'))(_0xc5fd('0x16'));var utils=require(_0xc5fd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xc5fd('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc5fd('0x19')](config[_0xc5fd('0x1a')],{'host':_0xc5fd('0x1b'),'port':0x18eb});var socket=require(_0xc5fd('0x1c'))(new Redis(config[_0xc5fd('0x1a')]));require(_0xc5fd('0x1d'))[_0xc5fd('0x1e')](socket);function respondWithStatusCode(_0xa7a954,_0x51233a){_0x51233a=_0x51233a||0xcc;return function(_0x124651){if(_0x124651){return _0xa7a954[_0xc5fd('0x1f')](_0x51233a);}return _0xa7a954[_0xc5fd('0x20')](_0x51233a)[_0xc5fd('0x21')]();};}function respondWithResult(_0x4d3636,_0x4fd364){_0x4fd364=_0x4fd364||0xc8;return function(_0x4efafd){if(_0x4efafd){return _0x4d3636['status'](_0x4fd364)['json'](_0x4efafd);}};}function respondWithFilteredResult(_0x35a9d0,_0x430e52){return function(_0x27f611){if(_0x27f611){var _0xd0a9f1=typeof _0x430e52[_0xc5fd('0x22')]===_0xc5fd('0x23')&&typeof _0x430e52[_0xc5fd('0x24')]==='undefined';var _0xb7bab1=_0x27f611[_0xc5fd('0x25')];var _0x32eac2=_0xd0a9f1?0x0:_0x430e52[_0xc5fd('0x22')];var _0x3b3093=_0xd0a9f1?_0x27f611['count']:_0x430e52[_0xc5fd('0x22')]+_0x430e52[_0xc5fd('0x24')];var _0x18048e;if(_0x3b3093>=_0xb7bab1){_0x3b3093=_0xb7bab1;_0x18048e=0xc8;}else{_0x18048e=0xce;}_0x35a9d0[_0xc5fd('0x20')](_0x18048e);return _0x35a9d0['set']('Content-Range',_0x32eac2+'-'+_0x3b3093+'/'+_0xb7bab1)[_0xc5fd('0x26')](_0x27f611);}return null;};}function patchUpdates(_0x2ab935){return function(_0x3d7211){try{jsonpatch[_0xc5fd('0x27')](_0x3d7211,_0x2ab935,!![]);}catch(_0x334401){return BPromise[_0xc5fd('0x28')](_0x334401);}return _0x3d7211['save']();};}function saveUpdates(_0x1a3f21,_0x2701f7){return function(_0x1a5174){if(_0x1a5174){return _0x1a5174[_0xc5fd('0x29')](_0x1a3f21)[_0xc5fd('0x2a')](function(_0x4020af){return _0x4020af;});}return null;};}function removeEntity(_0x475b91,_0x527018){return function(_0x3a86f9){if(_0x3a86f9){return _0x3a86f9['destroy']()[_0xc5fd('0x2a')](function(){var _0x231368=_0x3a86f9[_0xc5fd('0x2b')]({'plain':!![]});var _0x2bee22='VoicePrefixes';return db[_0xc5fd('0x2c')][_0xc5fd('0x2d')]({'where':{'type':_0x2bee22,'resourceId':_0x231368['id']}})[_0xc5fd('0x2a')](function(){return _0x3a86f9;});})[_0xc5fd('0x2a')](function(){_0x475b91[_0xc5fd('0x20')](0xcc)[_0xc5fd('0x21')]();});}};}function handleEntityNotFound(_0x541c12,_0x412ef7){return function(_0x5d4f70){if(!_0x5d4f70){_0x541c12['sendStatus'](0x194);}return _0x5d4f70;};}function handleError(_0x12a962,_0x165ee2){_0x165ee2=_0x165ee2||0x1f4;return function(_0x39b21a){logger[_0xc5fd('0x2e')](_0x39b21a[_0xc5fd('0x2f')]);if(_0x39b21a[_0xc5fd('0x30')]){delete _0x39b21a[_0xc5fd('0x30')];}_0x12a962[_0xc5fd('0x20')](_0x165ee2)['send'](_0x39b21a);};}exports[_0xc5fd('0x31')]=function(_0x1b2957,_0x6bb14d){var _0x3b9699={},_0x14c832={},_0x40ed4d={'count':0x0,'rows':[]};var _0x3c0f64=_[_0xc5fd('0x32')](db[_0xc5fd('0x33')][_0xc5fd('0x34')],function(_0x104f37){return{'name':_0x104f37[_0xc5fd('0x35')],'type':_0x104f37['type'][_0xc5fd('0x36')]};});_0x14c832[_0xc5fd('0x37')]=_[_0xc5fd('0x32')](_0x3c0f64,_0xc5fd('0x30'));_0x14c832[_0xc5fd('0x38')]=_[_0xc5fd('0x39')](_0x1b2957[_0xc5fd('0x38')]);_0x14c832[_0xc5fd('0x3a')]=_[_0xc5fd('0x3b')](_0x14c832['model'],_0x14c832[_0xc5fd('0x38')]);_0x3b9699[_0xc5fd('0x3c')]=_[_0xc5fd('0x3b')](_0x14c832[_0xc5fd('0x37')],qs[_0xc5fd('0x3d')](_0x1b2957[_0xc5fd('0x38')][_0xc5fd('0x3d')]));_0x3b9699['attributes']=_0x3b9699[_0xc5fd('0x3c')][_0xc5fd('0x3e')]?_0x3b9699['attributes']:_0x14c832[_0xc5fd('0x37')];if(!_0x1b2957['query'][_0xc5fd('0x3f')](_0xc5fd('0x40'))){_0x3b9699[_0xc5fd('0x24')]=qs['limit'](_0x1b2957[_0xc5fd('0x38')][_0xc5fd('0x24')]);_0x3b9699['offset']=qs[_0xc5fd('0x22')](_0x1b2957[_0xc5fd('0x38')][_0xc5fd('0x22')]);}_0x3b9699[_0xc5fd('0x41')]=qs[_0xc5fd('0x42')](_0x1b2957[_0xc5fd('0x38')]['sort']);_0x3b9699[_0xc5fd('0x43')]=qs[_0xc5fd('0x3a')](_[_0xc5fd('0x44')](_0x1b2957[_0xc5fd('0x38')],_0x14c832['filters']),_0x3c0f64);if(_0x1b2957['query']['filter']){_0x3b9699[_0xc5fd('0x43')]=_[_0xc5fd('0x45')](_0x3b9699[_0xc5fd('0x43')],{'$or':_[_0xc5fd('0x32')](_0x3c0f64,function(_0x125c02){if(_0x125c02[_0xc5fd('0x46')]!==_0xc5fd('0x47')){var _0x2ef96f={};_0x2ef96f[_0x125c02[_0xc5fd('0x30')]]={'$like':'%'+_0x1b2957['query']['filter']+'%'};return _0x2ef96f;}})});}_0x3b9699=_[_0xc5fd('0x45')]({},_0x3b9699,_0x1b2957['options']);var _0x970623={'where':_0x3b9699[_0xc5fd('0x43')]};return db[_0xc5fd('0x33')]['count'](_0x970623)[_0xc5fd('0x2a')](function(_0x350753){_0x40ed4d['count']=_0x350753;if(_0x1b2957[_0xc5fd('0x38')][_0xc5fd('0x48')]){_0x3b9699['include']=[{'all':!![]}];}return db[_0xc5fd('0x33')]['findAll'](_0x3b9699);})[_0xc5fd('0x2a')](function(_0x17ce12){_0x40ed4d['rows']=_0x17ce12;return _0x40ed4d;})[_0xc5fd('0x2a')](respondWithFilteredResult(_0x6bb14d,_0x3b9699))[_0xc5fd('0x49')](handleError(_0x6bb14d,null));};exports[_0xc5fd('0x4a')]=function(_0x4825fa,_0x408edb){var _0x74a071={'raw':![],'where':{'id':_0x4825fa['params']['id']}},_0x559282={};_0x559282[_0xc5fd('0x37')]=_['keys'](db['VoicePrefix']['rawAttributes']);_0x559282[_0xc5fd('0x38')]=_[_0xc5fd('0x39')](_0x4825fa[_0xc5fd('0x38')]);_0x559282[_0xc5fd('0x3a')]=_[_0xc5fd('0x3b')](_0x559282[_0xc5fd('0x37')],_0x559282['query']);_0x74a071['attributes']=_['intersection'](_0x559282[_0xc5fd('0x37')],qs[_0xc5fd('0x3d')](_0x4825fa[_0xc5fd('0x38')]['fields']));_0x74a071[_0xc5fd('0x3c')]=_0x74a071['attributes'][_0xc5fd('0x3e')]?_0x74a071[_0xc5fd('0x3c')]:_0x559282[_0xc5fd('0x37')];if(_0x4825fa[_0xc5fd('0x38')][_0xc5fd('0x48')]){_0x74a071[_0xc5fd('0x4b')]=[{'all':!![]}];}_0x74a071=_['merge']({},_0x74a071,_0x4825fa[_0xc5fd('0x4c')]);return db[_0xc5fd('0x33')]['find'](_0x74a071)['then'](handleEntityNotFound(_0x408edb,null))[_0xc5fd('0x2a')](respondWithResult(_0x408edb,null))['catch'](handleError(_0x408edb,null));};exports['destroy']=function(_0x6e5626,_0x2436e9){return db['VoicePrefix'][_0xc5fd('0x4d')]({'where':{'id':_0x6e5626[_0xc5fd('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2436e9,null))[_0xc5fd('0x2a')](removeEntity(_0x2436e9,null))[_0xc5fd('0x49')](handleError(_0x2436e9,null));};exports[_0xc5fd('0x4f')]=function(_0x12b847,_0x1940e3){return db[_0xc5fd('0x33')][_0xc5fd('0x4f')]()[_0xc5fd('0x2a')](respondWithResult(_0x1940e3,null))[_0xc5fd('0x49')](handleError(_0x1940e3,null));};exports[_0xc5fd('0x50')]=function(_0x3e1471,_0x4c10a7){var _0x3c9b99;return db[_0xc5fd('0x51')][_0xc5fd('0x52')](function(_0x4989ce){return db[_0xc5fd('0x33')][_0xc5fd('0x50')](_0x3e1471[_0xc5fd('0x53')],{'transaction':_0x4989ce})[_0xc5fd('0x2a')](function(_0x5c7d68){_0x3c9b99=_0x5c7d68[_0xc5fd('0x2b')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x3c9b99[_0xc5fd('0x54')]},'raw':!![]})[_0xc5fd('0x2a')](function(_0x236d04){return createVoicePrefixExtensions(_0x3c9b99,_0x236d04,_0x4989ce);});});})[_0xc5fd('0x2a')](function(){var _0x275e18=_0x3e1471['user']['get']({'plain':!![]});if(!_0x275e18)throw new Error(_0xc5fd('0x55'));if(_0x275e18[_0xc5fd('0x56')]==='user'){var _0x4e9495=_0x3c9b99;return db['UserProfileSection'][_0xc5fd('0x4d')]({'where':{'name':'VoicePrefixes','userProfileId':_0x275e18[_0xc5fd('0x57')]},'raw':!![]})[_0xc5fd('0x2a')](function(_0x2503cd){if(_0x2503cd&&_0x2503cd[_0xc5fd('0x58')]===0x0){return db[_0xc5fd('0x2c')][_0xc5fd('0x50')]({'name':_0x4e9495[_0xc5fd('0x30')],'resourceId':_0x4e9495['id'],'type':_0x2503cd['name'],'sectionId':_0x2503cd['id']},{})[_0xc5fd('0x2a')](function(){return _0x3c9b99;});}else{return _0x3c9b99;}})[_0xc5fd('0x49')](function(_0x228e40){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x228e40);throw _0x228e40;});}return _0x3c9b99;})[_0xc5fd('0x2a')](respondWithResult(_0x4c10a7,null))[_0xc5fd('0x49')](handleError(_0x4c10a7,null));};function Extension(_0x2f30d6,_0x149483,_0x69367,_0x45f9fd){this[_0xc5fd('0x59')]=_0xc5fd('0x5a');this[_0xc5fd('0x5b')]=_0x2f30d6;this[_0xc5fd('0x5c')]=_0x69367;this[_0xc5fd('0x46')]=_0xc5fd('0x5d');this[_0xc5fd('0x5e')]=_0xc5fd('0x5f');this[_0xc5fd('0x60')]=_0x149483;this[_0xc5fd('0x61')]=_0x45f9fd;}function createVoicePrefixExtensions(_0x548b65,_0x404759,_0xc05f80){return new BPromise(function(_0x3eeae0,_0x53a3ee){var _0x32a240=new Extension(formatPrefixName(_0x548b65[_0xc5fd('0x62')]),0x1,_0xc5fd('0x63'),_0xc5fd('0x64'));_0x32a240['VoicePrefixId']=_0x548b65['id'];return db[_0xc5fd('0x65')][_0xc5fd('0x50')](_0x32a240,{'transaction':_0xc05f80})['then'](function(_0x27a1f5){var _0x53ea3d=_0x27a1f5[_0xc5fd('0x2b')]({'plain':!![]});var _0x70a6d=_[_0xc5fd('0x32')](addVoicePrefixExtensions(_0x548b65,_0x404759),function(_0xcaa6b0){_0xcaa6b0[_0xc5fd('0x54')]=_0x53ea3d['id'];_0xcaa6b0[_0xc5fd('0x66')]=_0x548b65['id'];return _0xcaa6b0;});return db['VoiceExtension']['bulkCreate'](_0x70a6d,{'transaction':_0xc05f80})[_0xc5fd('0x2a')](function(_0x1ff40b){if(!_0x1ff40b){return _0x53a3ee(_0xc5fd('0x67'));}else{return _0x3eeae0(_0x1ff40b);}})[_0xc5fd('0x49')](function(_0x27b533){return _0x53a3ee(_0x27b533);});});;});};function addVoicePrefixExtensions(_0x2f4b60,_0x189d7d){var _0x77a940=[];var _0x4d6f97=formatPrefixName(_0x2f4b60[_0xc5fd('0x62')]);_0x77a940[_0xc5fd('0x68')](new Extension(_0x4d6f97,0x2,'Set','CDR(prefix)='+_0x2f4b60[_0xc5fd('0x30')]));if(_0x2f4b60[_0xc5fd('0x69')]){_0x77a940[_0xc5fd('0x68')](new Extension(_0x4d6f97,0x3,_0xc5fd('0x6a'),_0xc5fd('0x6b')+_0x2f4b60[_0xc5fd('0x69')]));}else{_0x77a940[_0xc5fd('0x68')](new Extension(_0x4d6f97,0x3,_0xc5fd('0x63'),'No\x20callerid\x20available'));}_0x77a940[_0xc5fd('0x68')](new Extension(_0x4d6f97,0x4,_0xc5fd('0x6c'),_0x189d7d['context']+','+_0xc5fd('0x6d')+(0x8+_0x2f4b60[_0xc5fd('0x30')]['length'])+'}'+','+0x1));return _0x77a940;}function formatPrefixName(_0x4591be){var _0x2a8c7f='_';for(var _0x5e3f8=0x0;_0x5e3f8<_0x4591be[_0xc5fd('0x3e')];_0x5e3f8++){if(_0x4591be[_0xc5fd('0x6e')](_0x5e3f8)=='-'){_0x2a8c7f+=_0x4591be[_0xc5fd('0x6e')](_0x5e3f8);}else{_0x2a8c7f+='['+_0x4591be[_0xc5fd('0x6e')](_0x5e3f8)+']';}}_0x2a8c7f+='.';return _0x2a8c7f;}exports[_0xc5fd('0x29')]=function(_0x3d1940,_0x130b7b,_0x539c0a){var _0x5131ba=_0x3d1940[_0xc5fd('0x53')];_0x5131ba[_0xc5fd('0x62')]=_0xc5fd('0x6f')+_0x5131ba['name']+'-';return db[_0xc5fd('0x51')][_0xc5fd('0x52')](function(_0x2696be){return db['VoicePrefix'][_0xc5fd('0x29')](_0x5131ba,{'where':{'id':_0x5131ba['id']},'transaction':_0x2696be})[_0xc5fd('0x2a')](function(){return db[_0xc5fd('0x65')]['destroy']({'where':{'VoicePrefixId':_0x5131ba['id']},'transaction':_0x2696be})['then'](function(){return db[_0xc5fd('0x65')][_0xc5fd('0x4d')]({'where':{'id':_0x5131ba['VoiceExtensionId']},'raw':!![]})[_0xc5fd('0x2a')](function(_0x55d691){return createVoicePrefixExtensions(_0x5131ba,_0x55d691,_0x2696be);});});});})[_0xc5fd('0x2a')](function(){return db[_0xc5fd('0x33')]['findById'](_0x5131ba['id']);})['then'](respondWithResult(_0x130b7b,null))[_0xc5fd('0x49')](handleError(_0x130b7b,null));};exports[_0xc5fd('0x70')]=function(_0x39624c,_0x152212,_0x281cf9){return db[_0xc5fd('0x33')]['find']({'where':{'id':_0x39624c[_0xc5fd('0x4e')]['id']}})[_0xc5fd('0x2a')](handleEntityNotFound(_0x152212,null))[_0xc5fd('0x2a')](function(_0x24ecc2){if(_0x24ecc2){return _0x24ecc2[_0xc5fd('0x70')](_0x39624c[_0xc5fd('0x53')][_0xc5fd('0x71')],_[_0xc5fd('0x72')](_0x39624c[_0xc5fd('0x53')],['ids','id'])||{})[_0xc5fd('0x73')](function(_0x58ca76){for(var _0x151d13=0x0;_0x151d13<_0x39624c[_0xc5fd('0x53')][_0xc5fd('0x71')]['length'];_0x151d13+=0x1){socket[_0xc5fd('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x39624c['body'][_0xc5fd('0x71')][_0x151d13]),'VoicePrefixId':Number(_0x39624c[_0xc5fd('0x4e')]['id'])});}return _0x58ca76;});}})[_0xc5fd('0x2a')](respondWithResult(_0x152212,null))[_0xc5fd('0x49')](handleError(_0x152212,null));};exports[_0xc5fd('0x75')]=function(_0x58df99,_0x4b43fc,_0x1ab84b){return db[_0xc5fd('0x33')][_0xc5fd('0x4d')]({'where':{'id':_0x58df99[_0xc5fd('0x4e')]['id']}})[_0xc5fd('0x2a')](handleEntityNotFound(_0x4b43fc,null))['then'](function(_0x3a89a9){if(_0x3a89a9){return _0x3a89a9[_0xc5fd('0x75')](_0x58df99[_0xc5fd('0x38')][_0xc5fd('0x71')])[_0xc5fd('0x2a')](function(){if(_[_0xc5fd('0x76')](_0x58df99[_0xc5fd('0x38')]['ids'])){for(var _0x9e84d2=0x0;_0x9e84d2<_0x58df99[_0xc5fd('0x38')][_0xc5fd('0x71')][_0xc5fd('0x3e')];_0x9e84d2+=0x1){socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x58df99['query'][_0xc5fd('0x71')][_0x9e84d2]),'VoicePrefixId':Number(_0x58df99[_0xc5fd('0x4e')]['id'])});}}else{socket[_0xc5fd('0x74')]('userVoicePrefix:remove',{'UserId':Number(_0x58df99[_0xc5fd('0x38')][_0xc5fd('0x71')]),'VoicePrefixId':Number(_0x58df99[_0xc5fd('0x4e')]['id'])});}});}})[_0xc5fd('0x2a')](respondWithStatusCode(_0x4b43fc,null))[_0xc5fd('0x49')](handleError(_0x4b43fc,null));};exports[_0xc5fd('0x77')]=function(_0x31fb3d,_0x5199f3,_0x32a6f3){var _0xe69dd8={};var _0x312b34={};var _0x38c97e;var _0x320249;return db[_0xc5fd('0x33')][_0xc5fd('0x78')]({'where':{'id':_0x31fb3d[_0xc5fd('0x4e')]['id']}})[_0xc5fd('0x2a')](handleEntityNotFound(_0x5199f3,null))[_0xc5fd('0x2a')](function(_0x4e67e7){if(_0x4e67e7){_0x38c97e=_0x4e67e7;_0x312b34[_0xc5fd('0x37')]=_[_0xc5fd('0x39')](db[_0xc5fd('0x79')][_0xc5fd('0x34')]);_0x312b34[_0xc5fd('0x38')]=_[_0xc5fd('0x39')](_0x31fb3d[_0xc5fd('0x38')]);_0x312b34['filters']=_[_0xc5fd('0x3b')](_0x312b34['model'],_0x312b34[_0xc5fd('0x38')]);_0xe69dd8[_0xc5fd('0x3c')]=_[_0xc5fd('0x3b')](_0x312b34[_0xc5fd('0x37')],qs[_0xc5fd('0x3d')](_0x31fb3d[_0xc5fd('0x38')]['fields']));_0xe69dd8[_0xc5fd('0x3c')]=_0xe69dd8['attributes'][_0xc5fd('0x3e')]?_0xe69dd8[_0xc5fd('0x3c')]:_0x312b34['model'];_0xe69dd8[_0xc5fd('0x41')]=qs[_0xc5fd('0x42')](_0x31fb3d[_0xc5fd('0x38')][_0xc5fd('0x42')]);_0xe69dd8[_0xc5fd('0x43')]=qs[_0xc5fd('0x3a')](_[_0xc5fd('0x44')](_0x31fb3d[_0xc5fd('0x38')],_0x312b34[_0xc5fd('0x3a')]));if(_0x31fb3d[_0xc5fd('0x38')][_0xc5fd('0x7a')]){_0xe69dd8[_0xc5fd('0x43')]=_['merge'](_0xe69dd8[_0xc5fd('0x43')],{'$or':_['map'](_0xe69dd8[_0xc5fd('0x3c')],function(_0xcab6e8){var _0x5951b4={};_0x5951b4[_0xcab6e8]={'$like':'%'+_0x31fb3d['query'][_0xc5fd('0x7a')]+'%'};return _0x5951b4;})});}_0xe69dd8=_['merge']({},_0xe69dd8,_0x31fb3d['options']);return _0x38c97e[_0xc5fd('0x77')](_0xe69dd8);}})[_0xc5fd('0x2a')](function(_0x58b8ce){if(_0x58b8ce){_0x320249=_0x58b8ce[_0xc5fd('0x3e')];if(!_0x31fb3d[_0xc5fd('0x38')]['hasOwnProperty'](_0xc5fd('0x40'))){_0xe69dd8[_0xc5fd('0x24')]=qs[_0xc5fd('0x24')](_0x31fb3d[_0xc5fd('0x38')][_0xc5fd('0x24')]);_0xe69dd8[_0xc5fd('0x22')]=qs[_0xc5fd('0x22')](_0x31fb3d[_0xc5fd('0x38')][_0xc5fd('0x22')]);}return _0x38c97e['getAgents'](_0xe69dd8);}})[_0xc5fd('0x2a')](function(_0x41d546){if(_0x41d546){return _0x41d546?{'count':_0x320249,'rows':_0x41d546}:null;}})[_0xc5fd('0x2a')](respondWithResult(_0x5199f3,null))[_0xc5fd('0x49')](handleError(_0x5199f3,null));};exports[_0xc5fd('0x7b')]=function(_0x3260de,_0x52f4a2,_0x3b04bb){var _0x54625d={};var _0x8cc5f6={};var _0x1f8bec;var _0x5cccd3;return db[_0xc5fd('0x33')][_0xc5fd('0x78')]({'where':{'id':_0x3260de['params']['id']}})['then'](handleEntityNotFound(_0x52f4a2,null))[_0xc5fd('0x2a')](function(_0x588469){if(_0x588469){_0x1f8bec=_0x588469;_0x8cc5f6[_0xc5fd('0x37')]=_[_0xc5fd('0x39')](db[_0xc5fd('0x7c')][_0xc5fd('0x34')]);_0x8cc5f6[_0xc5fd('0x38')]=_['keys'](_0x3260de[_0xc5fd('0x38')]);_0x8cc5f6[_0xc5fd('0x3a')]=_[_0xc5fd('0x3b')](_0x8cc5f6['model'],_0x8cc5f6[_0xc5fd('0x38')]);_0x54625d[_0xc5fd('0x3c')]=_['intersection'](_0x8cc5f6[_0xc5fd('0x37')],qs[_0xc5fd('0x3d')](_0x3260de['query'][_0xc5fd('0x3d')]));_0x54625d[_0xc5fd('0x3c')]=_0x54625d[_0xc5fd('0x3c')][_0xc5fd('0x3e')]?_0x54625d[_0xc5fd('0x3c')]:_0x8cc5f6[_0xc5fd('0x37')];_0x54625d['order']=qs[_0xc5fd('0x42')](_0x3260de[_0xc5fd('0x38')][_0xc5fd('0x42')]);_0x54625d[_0xc5fd('0x43')]=qs[_0xc5fd('0x3a')](_[_0xc5fd('0x44')](_0x3260de['query'],_0x8cc5f6[_0xc5fd('0x3a')]));if(_0x3260de[_0xc5fd('0x38')]['filter']){_0x54625d[_0xc5fd('0x43')]=_[_0xc5fd('0x45')](_0x54625d[_0xc5fd('0x43')],{'$or':_[_0xc5fd('0x32')](_0x54625d[_0xc5fd('0x3c')],function(_0x431e42){var _0x147657={};_0x147657[_0x431e42]={'$like':'%'+_0x3260de[_0xc5fd('0x38')][_0xc5fd('0x7a')]+'%'};return _0x147657;})});}_0x54625d=_[_0xc5fd('0x45')]({},_0x54625d,_0x3260de['options']);return _0x1f8bec[_0xc5fd('0x7b')](_0x54625d);}})[_0xc5fd('0x2a')](function(_0x815f86){if(_0x815f86){_0x5cccd3=_0x815f86[_0xc5fd('0x3e')];if(!_0x3260de[_0xc5fd('0x38')]['hasOwnProperty'](_0xc5fd('0x40'))){_0x54625d[_0xc5fd('0x24')]=qs[_0xc5fd('0x24')](_0x3260de[_0xc5fd('0x38')][_0xc5fd('0x24')]);_0x54625d[_0xc5fd('0x22')]=qs[_0xc5fd('0x22')](_0x3260de[_0xc5fd('0x38')][_0xc5fd('0x22')]);}return _0x1f8bec['getTeams'](_0x54625d);}})[_0xc5fd('0x2a')](function(_0x1e9c2c){if(_0x1e9c2c){return _0x1e9c2c?{'count':_0x5cccd3,'rows':_0x1e9c2c}:null;}})[_0xc5fd('0x2a')](respondWithResult(_0x52f4a2,null))[_0xc5fd('0x49')](handleError(_0x52f4a2,null));};exports['addTeams']=function(_0x1e5d78,_0x4bcd48,_0x5afaf5){var _0x5e0206=_0x1e5d78['body'][_0xc5fd('0x71')];var _0x5a3c8c;return db[_0xc5fd('0x7c')][_0xc5fd('0x7d')]({'where':{'id':_0x5e0206},'attributes':['id'],'include':[{'model':db[_0xc5fd('0x79')],'as':'Agents','attributes':['id',_0xc5fd('0x30'),'online','voicePause','interface'],'raw':!![]}]})[_0xc5fd('0x2a')](function(_0x1cb1a6){if(_0x1cb1a6){_0x5a3c8c=_0x1cb1a6;var _0x358648=_['flatMap'](_0x1cb1a6,function(_0x56a5d0){var _0x2bf91e=_0x56a5d0[_0xc5fd('0x2b')]({'plain':!![]});return _0x2bf91e['Agents'];});return db[_0xc5fd('0x33')][_0xc5fd('0x4d')]({'where':{'id':_0x1e5d78['params']['id']}})[_0xc5fd('0x2a')](function(_0x3c94ec){return db[_0xc5fd('0x51')][_0xc5fd('0x52')](function(_0x3bd95a){return _0x3c94ec[_0xc5fd('0x7e')](_0x5e0206,{'transaction':_0x3bd95a})[_0xc5fd('0x2a')](function(){return BPromise[_0xc5fd('0x7f')](_0x5a3c8c,function(_0x1e23e7){return db[_0xc5fd('0x80')][_0xc5fd('0x81')]({'TeamId':_0x1e23e7['id'],'VoicePrefixId':_0x1e5d78[_0xc5fd('0x4e')]['id']},{'transaction':_0x3bd95a});});})['then'](function(){return BPromise[_0xc5fd('0x7f')](_0x358648,function(_0x4c3fbb){return db[_0xc5fd('0x82')][_0xc5fd('0x83')]({'where':{'UserId':_0x4c3fbb['id'],'VoicePrefixId':_0x1e5d78[_0xc5fd('0x4e')]['id']},'transaction':_0x3bd95a});});})['then'](function(){_0x358648[_0xc5fd('0x84')](function(_0x5a438e){socket[_0xc5fd('0x74')](_0xc5fd('0x85'),{'UserId':_0x5a438e['id'],'VoicePrefixId':_0x3c94ec['id']});});});});});}})[_0xc5fd('0x2a')](respondWithStatusCode(_0x4bcd48,null))[_0xc5fd('0x49')](handleError(_0x4bcd48,null));};exports[_0xc5fd('0x86')]=function(_0x4065d9,_0xf709eb,_0x241693){return db[_0xc5fd('0x7c')][_0xc5fd('0x7d')]({'where':{'id':_0x4065d9[_0xc5fd('0x38')][_0xc5fd('0x71')]},'attributes':['id'],'include':[{'model':db[_0xc5fd('0x79')],'as':_0xc5fd('0x87'),'attributes':['id'],'raw':!![]}]})[_0xc5fd('0x2a')](handleEntityNotFound(_0xf709eb,null))[_0xc5fd('0x2a')](function(_0x2fb5f4){var _0x281c9e=_[_0xc5fd('0x32')](_0x2fb5f4,'id');var _0x5ca2a9=[];var _0x6594ae=[];var _0x1af269=squel[_0xc5fd('0x88')]();_0x1af269[_0xc5fd('0x89')](_0xc5fd('0x8a'))['from'](_0xc5fd('0x8b'),'tq')['join'](_0xc5fd('0x8c'),'ut',_0xc5fd('0x8d'))['where']('VoicePrefixId\x20=\x20?',_0x4065d9[_0xc5fd('0x4e')]['id']);for(var _0x4debb8=0x0;_0x4debb8<_0x2fb5f4[_0xc5fd('0x3e')];_0x4debb8+=0x1){let _0x474579=_0x2fb5f4[_0x4debb8];for(var _0x2ab188=0x0;_0x2ab188<_0x474579['Agents']['length'];_0x2ab188+=0x1){let _0x516a64=_0x474579[_0xc5fd('0x87')][_0x2ab188];var _0x41a3b6=_0x1af269[_0xc5fd('0x8e')]();_0x41a3b6[_0xc5fd('0x43')](_0xc5fd('0x8f'),_0x516a64['id']);_0x6594ae[_0xc5fd('0x68')](db[_0xc5fd('0x51')][_0xc5fd('0x38')](_0x41a3b6[_0xc5fd('0x90')](),{'type':db[_0xc5fd('0x51')][_0xc5fd('0x91')][_0xc5fd('0x92')]})[_0xc5fd('0x2a')](function(_0x492f78){if(_0x492f78[_0xc5fd('0x3e')]===0x1){return _0x516a64['id'];}else{var _0x12e1a8=_[_0xc5fd('0x93')](_[_0xc5fd('0x32')](_0x492f78,'TeamId'),function(_0x4751af){return _[_0xc5fd('0x94')](_0x281c9e,_0x4751af);});if(_0x12e1a8){return _0x516a64['id'];}}}));}}return BPromise[_0xc5fd('0x95')](_0x6594ae)[_0xc5fd('0x2a')](function(_0x2917b5){_0x5ca2a9=_(_0x5ca2a9)[_0xc5fd('0x96')](_0x2917b5)[_0xc5fd('0x97')]()[_0xc5fd('0x98')]();return db[_0xc5fd('0x33')][_0xc5fd('0x4d')]({'where':{'id':_0x4065d9['params']['id']}})[_0xc5fd('0x2a')](function(_0x21526e){return db[_0xc5fd('0x51')][_0xc5fd('0x52')](function(_0x2456d8){return _0x21526e['removeTeams'](_0x4065d9[_0xc5fd('0x38')][_0xc5fd('0x71')],{'transaction':_0x2456d8})['then'](function(){if(!_[_0xc5fd('0x99')](_0x5ca2a9)){return _0x21526e['removeAgents'](_0x5ca2a9,{'transaction':_0x2456d8});}})[_0xc5fd('0x2a')](function(){_0x5ca2a9['forEach'](function(_0x233398){socket[_0xc5fd('0x74')]('userVoicePrefix:remove',{'UserId':_0x233398,'VoicePrefixId':_0x21526e['id']});});});});});});})['then'](respondWithStatusCode(_0xf709eb,null))['catch'](handleError(_0xf709eb,null));}; \ No newline at end of file +var _0xef0f=['sequelize','transaction','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','order','where','filter','getTeams','findOne','Team','online','interface','Agents','addTeams','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','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','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','end','status','json','offset','undefined','limit','count','set','reject','save','destroy','then','get','UserProfileResource','sendStatus','error','name','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','options','VoicePrefix','includeAll','include','findAll','catch','show','params','rawAttributes','find','describe','create','body','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','VoicePrefixes','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','Voice\x20Prefix\x20Extension','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','map','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','update','system-'];(function(_0x25dcbd,_0x1d2baf){var _0x5af92f=function(_0x286f4b){while(--_0x286f4b){_0x25dcbd['push'](_0x25dcbd['shift']());}};_0x5af92f(++_0x1d2baf);}(_0xef0f,0x168));var _0xfef0=function(_0x446eac,_0x29f115){_0x446eac=_0x446eac-0x0;var _0x2d0614=_0xef0f[_0x446eac];return _0x2d0614;};'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'];config['redis']=_[_0xfef0('0x1b')](config[_0xfef0('0x1c')],{'host':_0xfef0('0x1d'),'port':0x18eb});var socket=require(_0xfef0('0x1e'))(new Redis(config[_0xfef0('0x1c')]));require(_0xfef0('0x1f'))[_0xfef0('0x20')](socket);function respondWithStatusCode(_0x573ae7,_0x3d1f02){_0x3d1f02=_0x3d1f02||0xcc;return function(_0x554aaa){if(_0x554aaa){return _0x573ae7['sendStatus'](_0x3d1f02);}return _0x573ae7['status'](_0x3d1f02)[_0xfef0('0x21')]();};}function respondWithResult(_0x284b6d,_0x3510a7){_0x3510a7=_0x3510a7||0xc8;return function(_0x1bce2f){if(_0x1bce2f){return _0x284b6d[_0xfef0('0x22')](_0x3510a7)[_0xfef0('0x23')](_0x1bce2f);}};}function respondWithFilteredResult(_0x155833,_0x2887e6){return function(_0x581459){if(_0x581459){var _0xd60678=typeof _0x2887e6[_0xfef0('0x24')]===_0xfef0('0x25')&&typeof _0x2887e6[_0xfef0('0x26')]===_0xfef0('0x25');var _0x55912f=_0x581459[_0xfef0('0x27')];var _0x4e24de=_0xd60678?0x0:_0x2887e6[_0xfef0('0x24')];var _0x1a0aa0=_0xd60678?_0x581459[_0xfef0('0x27')]:_0x2887e6['offset']+_0x2887e6[_0xfef0('0x26')];var _0x4c304d;if(_0x1a0aa0>=_0x55912f){_0x1a0aa0=_0x55912f;_0x4c304d=0xc8;}else{_0x4c304d=0xce;}_0x155833[_0xfef0('0x22')](_0x4c304d);return _0x155833[_0xfef0('0x28')]('Content-Range',_0x4e24de+'-'+_0x1a0aa0+'/'+_0x55912f)['json'](_0x581459);}return null;};}function patchUpdates(_0x4b8b22){return function(_0x19fde8){try{jsonpatch['apply'](_0x19fde8,_0x4b8b22,!![]);}catch(_0x1f9970){return BPromise[_0xfef0('0x29')](_0x1f9970);}return _0x19fde8[_0xfef0('0x2a')]();};}function saveUpdates(_0x4483f2,_0x249fe4){return function(_0xd687ed){if(_0xd687ed){return _0xd687ed['update'](_0x4483f2)['then'](function(_0x316e20){return _0x316e20;});}return null;};}function removeEntity(_0x1ffaa4,_0x924f6e){return function(_0x34ca65){if(_0x34ca65){return _0x34ca65[_0xfef0('0x2b')]()[_0xfef0('0x2c')](function(){var _0x5df04f=_0x34ca65[_0xfef0('0x2d')]({'plain':!![]});var _0x391279='VoicePrefixes';return db[_0xfef0('0x2e')][_0xfef0('0x2b')]({'where':{'type':_0x391279,'resourceId':_0x5df04f['id']}})[_0xfef0('0x2c')](function(){return _0x34ca65;});})[_0xfef0('0x2c')](function(){_0x1ffaa4[_0xfef0('0x22')](0xcc)[_0xfef0('0x21')]();});}};}function handleEntityNotFound(_0x3e3c4c,_0x3e026a){return function(_0x26cb9a){if(!_0x26cb9a){_0x3e3c4c[_0xfef0('0x2f')](0x194);}return _0x26cb9a;};}function handleError(_0x3ee42f,_0x3ffea0){_0x3ffea0=_0x3ffea0||0x1f4;return function(_0x51af0f){logger[_0xfef0('0x30')](_0x51af0f['stack']);if(_0x51af0f['name']){delete _0x51af0f[_0xfef0('0x31')];}_0x3ee42f[_0xfef0('0x22')](_0x3ffea0)['send'](_0x51af0f);};}exports['index']=function(_0x5cf518,_0x4f65cd){var _0x4cce8a={},_0x417535={},_0x172d94={'count':0x0,'rows':[]};var _0x2fffae=_['map'](db['VoicePrefix']['rawAttributes'],function(_0x1f8110){return{'name':_0x1f8110['fieldName'],'type':_0x1f8110[_0xfef0('0x32')][_0xfef0('0x33')]};});_0x417535[_0xfef0('0x34')]=_['map'](_0x2fffae,_0xfef0('0x31'));_0x417535['query']=_[_0xfef0('0x35')](_0x5cf518[_0xfef0('0x36')]);_0x417535[_0xfef0('0x37')]=_[_0xfef0('0x38')](_0x417535[_0xfef0('0x34')],_0x417535[_0xfef0('0x36')]);_0x4cce8a[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x417535['model'],qs[_0xfef0('0x3a')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3a')]));_0x4cce8a[_0xfef0('0x39')]=_0x4cce8a[_0xfef0('0x39')][_0xfef0('0x3b')]?_0x4cce8a[_0xfef0('0x39')]:_0x417535[_0xfef0('0x34')];if(!_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x4cce8a[_0xfef0('0x26')]=qs[_0xfef0('0x26')](_0x5cf518['query'][_0xfef0('0x26')]);_0x4cce8a['offset']=qs[_0xfef0('0x24')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x24')]);}_0x4cce8a['order']=qs[_0xfef0('0x3e')](_0x5cf518[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x4cce8a['where']=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x5cf518[_0xfef0('0x36')],_0x417535['filters']),_0x2fffae);if(_0x5cf518[_0xfef0('0x36')]['filter']){_0x4cce8a['where']=_[_0xfef0('0x40')](_0x4cce8a['where'],{'$or':_['map'](_0x2fffae,function(_0xbf6ddd){if(_0xbf6ddd[_0xfef0('0x32')]!==_0xfef0('0x41')){var _0x1a6593={};_0x1a6593[_0xbf6ddd[_0xfef0('0x31')]]={'$like':'%'+_0x5cf518[_0xfef0('0x36')]['filter']+'%'};return _0x1a6593;}})});}_0x4cce8a=_[_0xfef0('0x40')]({},_0x4cce8a,_0x5cf518[_0xfef0('0x42')]);var _0x5a9ed3={'where':_0x4cce8a['where']};return db[_0xfef0('0x43')]['count'](_0x5a9ed3)[_0xfef0('0x2c')](function(_0x22c940){_0x172d94[_0xfef0('0x27')]=_0x22c940;if(_0x5cf518[_0xfef0('0x36')][_0xfef0('0x44')]){_0x4cce8a[_0xfef0('0x45')]=[{'all':!![]}];}return db[_0xfef0('0x43')][_0xfef0('0x46')](_0x4cce8a);})['then'](function(_0x1813dc){_0x172d94['rows']=_0x1813dc;return _0x172d94;})['then'](respondWithFilteredResult(_0x4f65cd,_0x4cce8a))[_0xfef0('0x47')](handleError(_0x4f65cd,null));};exports[_0xfef0('0x48')]=function(_0x5bf416,_0x2af79f){var _0x5587a9={'raw':![],'where':{'id':_0x5bf416[_0xfef0('0x49')]['id']}},_0x39df7c={};_0x39df7c[_0xfef0('0x34')]=_[_0xfef0('0x35')](db['VoicePrefix'][_0xfef0('0x4a')]);_0x39df7c[_0xfef0('0x36')]=_['keys'](_0x5bf416['query']);_0x39df7c[_0xfef0('0x37')]=_['intersection'](_0x39df7c[_0xfef0('0x34')],_0x39df7c[_0xfef0('0x36')]);_0x5587a9[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x39df7c[_0xfef0('0x34')],qs[_0xfef0('0x3a')](_0x5bf416['query'][_0xfef0('0x3a')]));_0x5587a9['attributes']=_0x5587a9['attributes'][_0xfef0('0x3b')]?_0x5587a9[_0xfef0('0x39')]:_0x39df7c[_0xfef0('0x34')];if(_0x5bf416['query'][_0xfef0('0x44')]){_0x5587a9['include']=[{'all':!![]}];}_0x5587a9=_['merge']({},_0x5587a9,_0x5bf416['options']);return db[_0xfef0('0x43')][_0xfef0('0x4b')](_0x5587a9)[_0xfef0('0x2c')](handleEntityNotFound(_0x2af79f,null))[_0xfef0('0x2c')](respondWithResult(_0x2af79f,null))[_0xfef0('0x47')](handleError(_0x2af79f,null));};exports[_0xfef0('0x2b')]=function(_0x1b78af,_0x3853bb){return db[_0xfef0('0x43')]['find']({'where':{'id':_0x1b78af['params']['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x3853bb,null))[_0xfef0('0x2c')](removeEntity(_0x3853bb,null))[_0xfef0('0x47')](handleError(_0x3853bb,null));};exports[_0xfef0('0x4c')]=function(_0x393fee,_0x1e1458){return db[_0xfef0('0x43')][_0xfef0('0x4c')]()['then'](respondWithResult(_0x1e1458,null))[_0xfef0('0x47')](handleError(_0x1e1458,null));};exports[_0xfef0('0x4d')]=function(_0x247caf,_0x10378e){var _0x6591d4;return db['sequelize']['transaction'](function(_0x523763){return db[_0xfef0('0x43')][_0xfef0('0x4d')](_0x247caf[_0xfef0('0x4e')],{'transaction':_0x523763})[_0xfef0('0x2c')](function(_0x4e959e){_0x6591d4=_0x4e959e[_0xfef0('0x2d')]({'plain':!![]});return db[_0xfef0('0x4f')][_0xfef0('0x4b')]({'where':{'id':_0x6591d4[_0xfef0('0x50')]},'raw':!![]})[_0xfef0('0x2c')](function(_0x2f94c4){return createVoicePrefixExtensions(_0x6591d4,_0x2f94c4,_0x523763);});});})[_0xfef0('0x2c')](function(){var _0x4cd0fd=_0x247caf[_0xfef0('0x51')][_0xfef0('0x2d')]({'plain':!![]});if(!_0x4cd0fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4cd0fd[_0xfef0('0x52')]==='user'){var _0x175e97=_0x6591d4;return db[_0xfef0('0x53')]['find']({'where':{'name':_0xfef0('0x54'),'userProfileId':_0x4cd0fd['userProfileId']},'raw':!![]})['then'](function(_0x4812c7){if(_0x4812c7&&_0x4812c7[_0xfef0('0x55')]===0x0){return db[_0xfef0('0x2e')][_0xfef0('0x4d')]({'name':_0x175e97[_0xfef0('0x31')],'resourceId':_0x175e97['id'],'type':_0x4812c7[_0xfef0('0x31')],'sectionId':_0x4812c7['id']},{})[_0xfef0('0x2c')](function(){return _0x6591d4;});}else{return _0x6591d4;}})['catch'](function(_0xa365e5){logger[_0xfef0('0x30')](_0xfef0('0x56'),_0xa365e5);throw _0xa365e5;});}return _0x6591d4;})[_0xfef0('0x2c')](respondWithResult(_0x10378e,null))[_0xfef0('0x47')](handleError(_0x10378e,null));};function Extension(_0x58d95e,_0x59d1b6,_0x4aef94,_0x135653){this['context']=_0xfef0('0x57');this[_0xfef0('0x58')]=_0x58d95e;this[_0xfef0('0x59')]=_0x4aef94;this[_0xfef0('0x32')]=_0xfef0('0x5a');this['description']=_0xfef0('0x5b');this['priority']=_0x59d1b6;this[_0xfef0('0x5c')]=_0x135653;}function createVoicePrefixExtensions(_0x4a1316,_0x4a4d36,_0x3a12c5){return new BPromise(function(_0x3c5640,_0xd6de4d){var _0x35a486=new Extension(formatPrefixName(_0x4a1316[_0xfef0('0x5d')]),0x1,_0xfef0('0x5e'),_0xfef0('0x5f'));_0x35a486[_0xfef0('0x60')]=_0x4a1316['id'];return db[_0xfef0('0x4f')][_0xfef0('0x4d')](_0x35a486,{'transaction':_0x3a12c5})[_0xfef0('0x2c')](function(_0x46d0bb){var _0x5df358=_0x46d0bb[_0xfef0('0x2d')]({'plain':!![]});var _0x3b660c=_[_0xfef0('0x61')](addVoicePrefixExtensions(_0x4a1316,_0x4a4d36),function(_0x312dcf){_0x312dcf[_0xfef0('0x50')]=_0x5df358['id'];_0x312dcf['VoicePrefixId']=_0x4a1316['id'];return _0x312dcf;});return db[_0xfef0('0x4f')][_0xfef0('0x62')](_0x3b660c,{'transaction':_0x3a12c5})[_0xfef0('0x2c')](function(_0x3c6bb8){if(!_0x3c6bb8){return _0xd6de4d(_0xfef0('0x63'));}else{return _0x3c5640(_0x3c6bb8);}})[_0xfef0('0x47')](function(_0xb9693b){return _0xd6de4d(_0xb9693b);});});;});};function addVoicePrefixExtensions(_0x103ca3,_0x14d53d){var _0x3f26d9=[];var _0x4f7ad3=formatPrefixName(_0x103ca3[_0xfef0('0x5d')]);_0x3f26d9['push'](new Extension(_0x4f7ad3,0x2,_0xfef0('0x64'),_0xfef0('0x65')+_0x103ca3['name']));if(_0x103ca3[_0xfef0('0x66')]){_0x3f26d9[_0xfef0('0x67')](new Extension(_0x4f7ad3,0x3,_0xfef0('0x64'),_0xfef0('0x68')+_0x103ca3[_0xfef0('0x66')]));}else{_0x3f26d9['push'](new Extension(_0x4f7ad3,0x3,_0xfef0('0x5e'),_0xfef0('0x69')));}_0x3f26d9[_0xfef0('0x67')](new Extension(_0x4f7ad3,0x4,'goto',_0x14d53d[_0xfef0('0x6a')]+','+_0xfef0('0x6b')+(0x8+_0x103ca3[_0xfef0('0x31')][_0xfef0('0x3b')])+'}'+','+0x1));return _0x3f26d9;}function formatPrefixName(_0x7186c8){var _0x3cfe32='_';for(var _0x45ba65=0x0;_0x45ba65<_0x7186c8['length'];_0x45ba65++){if(_0x7186c8[_0xfef0('0x6c')](_0x45ba65)=='-'){_0x3cfe32+=_0x7186c8[_0xfef0('0x6c')](_0x45ba65);}else{_0x3cfe32+='['+_0x7186c8[_0xfef0('0x6c')](_0x45ba65)+']';}}_0x3cfe32+='.';return _0x3cfe32;}exports[_0xfef0('0x6d')]=function(_0x317eda,_0x2dde67,_0x488db4){var _0x340517=_0x317eda[_0xfef0('0x4e')];_0x340517[_0xfef0('0x5d')]=_0xfef0('0x6e')+_0x340517['name']+'-';return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x5a33a1){return db[_0xfef0('0x43')][_0xfef0('0x6d')](_0x340517,{'where':{'id':_0x340517['id']},'transaction':_0x5a33a1})[_0xfef0('0x2c')](function(){return db[_0xfef0('0x4f')][_0xfef0('0x2b')]({'where':{'VoicePrefixId':_0x340517['id']},'transaction':_0x5a33a1})['then'](function(){return db['VoiceExtension']['find']({'where':{'id':_0x340517[_0xfef0('0x50')]},'raw':!![]})[_0xfef0('0x2c')](function(_0x2474b2){return createVoicePrefixExtensions(_0x340517,_0x2474b2,_0x5a33a1);});});});})['then'](function(){return db[_0xfef0('0x43')]['findById'](_0x340517['id']);})['then'](respondWithResult(_0x2dde67,null))['catch'](handleError(_0x2dde67,null));};exports[_0xfef0('0x71')]=function(_0x1cf182,_0x50cd7a,_0x166aab){return db[_0xfef0('0x43')][_0xfef0('0x4b')]({'where':{'id':_0x1cf182['params']['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x50cd7a,null))['then'](function(_0x5ee0c0){if(_0x5ee0c0){return _0x5ee0c0[_0xfef0('0x71')](_0x1cf182[_0xfef0('0x4e')][_0xfef0('0x72')],_[_0xfef0('0x73')](_0x1cf182['body'],['ids','id'])||{})['spread'](function(_0xd973d3){for(var _0x546455=0x0;_0x546455<_0x1cf182[_0xfef0('0x4e')][_0xfef0('0x72')][_0xfef0('0x3b')];_0x546455+=0x1){socket[_0xfef0('0x74')](_0xfef0('0x75'),{'UserId':Number(_0x1cf182['body'][_0xfef0('0x72')][_0x546455]),'VoicePrefixId':Number(_0x1cf182['params']['id'])});}return _0xd973d3;});}})['then'](respondWithResult(_0x50cd7a,null))[_0xfef0('0x47')](handleError(_0x50cd7a,null));};exports[_0xfef0('0x76')]=function(_0xc30175,_0x3bfe3f,_0x5a17a9){return db['VoicePrefix'][_0xfef0('0x4b')]({'where':{'id':_0xc30175[_0xfef0('0x49')]['id']}})['then'](handleEntityNotFound(_0x3bfe3f,null))[_0xfef0('0x2c')](function(_0x3bbb7e){if(_0x3bbb7e){return _0x3bbb7e[_0xfef0('0x76')](_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')])[_0xfef0('0x2c')](function(){if(_[_0xfef0('0x77')](_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')])){for(var _0x52fe45=0x0;_0x52fe45<_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')][_0xfef0('0x3b')];_0x52fe45+=0x1){socket[_0xfef0('0x74')](_0xfef0('0x78'),{'UserId':Number(_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')][_0x52fe45]),'VoicePrefixId':Number(_0xc30175['params']['id'])});}}else{socket[_0xfef0('0x74')](_0xfef0('0x78'),{'UserId':Number(_0xc30175[_0xfef0('0x36')][_0xfef0('0x72')]),'VoicePrefixId':Number(_0xc30175[_0xfef0('0x49')]['id'])});}});}})[_0xfef0('0x2c')](respondWithStatusCode(_0x3bfe3f,null))[_0xfef0('0x47')](handleError(_0x3bfe3f,null));};exports[_0xfef0('0x79')]=function(_0x32944e,_0x39c591,_0x1f2413){var _0x17c350={};var _0x283d5a={};var _0x5630a6;var _0x32aab6;return db['VoicePrefix']['findOne']({'where':{'id':_0x32944e[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x39c591,null))['then'](function(_0x299116){if(_0x299116){_0x5630a6=_0x299116;_0x283d5a['model']=_['keys'](db[_0xfef0('0x7a')][_0xfef0('0x4a')]);_0x283d5a[_0xfef0('0x36')]=_[_0xfef0('0x35')](_0x32944e['query']);_0x283d5a[_0xfef0('0x37')]=_[_0xfef0('0x38')](_0x283d5a['model'],_0x283d5a[_0xfef0('0x36')]);_0x17c350[_0xfef0('0x39')]=_[_0xfef0('0x38')](_0x283d5a['model'],qs['fields'](_0x32944e[_0xfef0('0x36')]['fields']));_0x17c350['attributes']=_0x17c350[_0xfef0('0x39')]['length']?_0x17c350[_0xfef0('0x39')]:_0x283d5a[_0xfef0('0x34')];_0x17c350[_0xfef0('0x7b')]=qs[_0xfef0('0x3e')](_0x32944e[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x17c350[_0xfef0('0x7c')]=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x32944e[_0xfef0('0x36')],_0x283d5a['filters']));if(_0x32944e[_0xfef0('0x36')]['filter']){_0x17c350['where']=_[_0xfef0('0x40')](_0x17c350['where'],{'$or':_[_0xfef0('0x61')](_0x17c350[_0xfef0('0x39')],function(_0x2e7268){var _0x34b802={};_0x34b802[_0x2e7268]={'$like':'%'+_0x32944e[_0xfef0('0x36')][_0xfef0('0x7d')]+'%'};return _0x34b802;})});}_0x17c350=_['merge']({},_0x17c350,_0x32944e[_0xfef0('0x42')]);return _0x5630a6[_0xfef0('0x79')](_0x17c350);}})[_0xfef0('0x2c')](function(_0x17a514){if(_0x17a514){_0x32aab6=_0x17a514[_0xfef0('0x3b')];if(!_0x32944e[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x17c350['limit']=qs[_0xfef0('0x26')](_0x32944e[_0xfef0('0x36')]['limit']);_0x17c350[_0xfef0('0x24')]=qs[_0xfef0('0x24')](_0x32944e[_0xfef0('0x36')]['offset']);}return _0x5630a6[_0xfef0('0x79')](_0x17c350);}})['then'](function(_0x1cb952){if(_0x1cb952){return _0x1cb952?{'count':_0x32aab6,'rows':_0x1cb952}:null;}})[_0xfef0('0x2c')](respondWithResult(_0x39c591,null))['catch'](handleError(_0x39c591,null));};exports[_0xfef0('0x7e')]=function(_0x51f79b,_0x1fa881,_0x8c4979){var _0x1b8ee7={};var _0x3eff14={};var _0x14d871;var _0x306319;return db[_0xfef0('0x43')][_0xfef0('0x7f')]({'where':{'id':_0x51f79b[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](handleEntityNotFound(_0x1fa881,null))[_0xfef0('0x2c')](function(_0x5b7ffa){if(_0x5b7ffa){_0x14d871=_0x5b7ffa;_0x3eff14[_0xfef0('0x34')]=_['keys'](db['Team'][_0xfef0('0x4a')]);_0x3eff14['query']=_[_0xfef0('0x35')](_0x51f79b['query']);_0x3eff14['filters']=_[_0xfef0('0x38')](_0x3eff14['model'],_0x3eff14['query']);_0x1b8ee7['attributes']=_[_0xfef0('0x38')](_0x3eff14[_0xfef0('0x34')],qs[_0xfef0('0x3a')](_0x51f79b[_0xfef0('0x36')]['fields']));_0x1b8ee7[_0xfef0('0x39')]=_0x1b8ee7[_0xfef0('0x39')][_0xfef0('0x3b')]?_0x1b8ee7[_0xfef0('0x39')]:_0x3eff14[_0xfef0('0x34')];_0x1b8ee7['order']=qs['sort'](_0x51f79b[_0xfef0('0x36')][_0xfef0('0x3e')]);_0x1b8ee7['where']=qs[_0xfef0('0x37')](_[_0xfef0('0x3f')](_0x51f79b[_0xfef0('0x36')],_0x3eff14[_0xfef0('0x37')]));if(_0x51f79b[_0xfef0('0x36')][_0xfef0('0x7d')]){_0x1b8ee7[_0xfef0('0x7c')]=_[_0xfef0('0x40')](_0x1b8ee7['where'],{'$or':_['map'](_0x1b8ee7[_0xfef0('0x39')],function(_0x4135b0){var _0x14fc20={};_0x14fc20[_0x4135b0]={'$like':'%'+_0x51f79b[_0xfef0('0x36')][_0xfef0('0x7d')]+'%'};return _0x14fc20;})});}_0x1b8ee7=_[_0xfef0('0x40')]({},_0x1b8ee7,_0x51f79b[_0xfef0('0x42')]);return _0x14d871[_0xfef0('0x7e')](_0x1b8ee7);}})['then'](function(_0x5d7df9){if(_0x5d7df9){_0x306319=_0x5d7df9[_0xfef0('0x3b')];if(!_0x51f79b[_0xfef0('0x36')][_0xfef0('0x3c')](_0xfef0('0x3d'))){_0x1b8ee7[_0xfef0('0x26')]=qs[_0xfef0('0x26')](_0x51f79b['query'][_0xfef0('0x26')]);_0x1b8ee7[_0xfef0('0x24')]=qs['offset'](_0x51f79b[_0xfef0('0x36')][_0xfef0('0x24')]);}return _0x14d871[_0xfef0('0x7e')](_0x1b8ee7);}})[_0xfef0('0x2c')](function(_0x3b8b10){if(_0x3b8b10){return _0x3b8b10?{'count':_0x306319,'rows':_0x3b8b10}:null;}})[_0xfef0('0x2c')](respondWithResult(_0x1fa881,null))['catch'](handleError(_0x1fa881,null));};exports['addTeams']=function(_0x1084b9,_0xd7c5b,_0xd2c0be){var _0x15eefc=_0x1084b9[_0xfef0('0x4e')][_0xfef0('0x72')];var _0x4df302;return db[_0xfef0('0x80')]['findAll']({'where':{'id':_0x15eefc},'attributes':['id'],'include':[{'model':db[_0xfef0('0x7a')],'as':'Agents','attributes':['id',_0xfef0('0x31'),_0xfef0('0x81'),'voicePause',_0xfef0('0x82')],'raw':!![]}]})[_0xfef0('0x2c')](function(_0xc91fea){if(_0xc91fea){_0x4df302=_0xc91fea;var _0x4d56e5=_['flatMap'](_0xc91fea,function(_0x57083a){var _0x3a28b2=_0x57083a['get']({'plain':!![]});return _0x3a28b2[_0xfef0('0x83')];});return db[_0xfef0('0x43')]['find']({'where':{'id':_0x1084b9[_0xfef0('0x49')]['id']}})['then'](function(_0x43ee5f){return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x1a9ed3){return _0x43ee5f[_0xfef0('0x84')](_0x15eefc,{'transaction':_0x1a9ed3})[_0xfef0('0x2c')](function(){return BPromise[_0xfef0('0x85')](_0x4df302,function(_0x53ecba){return db[_0xfef0('0x86')][_0xfef0('0x87')]({'TeamId':_0x53ecba['id'],'VoicePrefixId':_0x1084b9[_0xfef0('0x49')]['id']},{'transaction':_0x1a9ed3});});})[_0xfef0('0x2c')](function(){return BPromise[_0xfef0('0x85')](_0x4d56e5,function(_0x110ef9){return db[_0xfef0('0x88')][_0xfef0('0x89')]({'where':{'UserId':_0x110ef9['id'],'VoicePrefixId':_0x1084b9[_0xfef0('0x49')]['id']},'transaction':_0x1a9ed3});});})[_0xfef0('0x2c')](function(){_0x4d56e5[_0xfef0('0x8a')](function(_0x34f1db){socket[_0xfef0('0x74')](_0xfef0('0x75'),{'UserId':_0x34f1db['id'],'VoicePrefixId':_0x43ee5f['id']});});});});});}})['then'](respondWithStatusCode(_0xd7c5b,null))[_0xfef0('0x47')](handleError(_0xd7c5b,null));};exports[_0xfef0('0x8b')]=function(_0x29ad24,_0x1ee5ad,_0xeea2ff){return db[_0xfef0('0x80')][_0xfef0('0x46')]({'where':{'id':_0x29ad24[_0xfef0('0x36')][_0xfef0('0x72')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfef0('0x2c')](handleEntityNotFound(_0x1ee5ad,null))['then'](function(_0x63704){var _0x3d85ec=_[_0xfef0('0x61')](_0x63704,'id');var _0x17ab00=[];var _0xd9c290=[];var _0x365938=squel[_0xfef0('0x8c')]();_0x365938[_0xfef0('0x8d')](_0xfef0('0x8e'))[_0xfef0('0x8f')](_0xfef0('0x90'),'tq')['join'](_0xfef0('0x91'),'ut',_0xfef0('0x92'))['where'](_0xfef0('0x93'),_0x29ad24[_0xfef0('0x49')]['id']);for(var _0x524db7=0x0;_0x524db7<_0x63704[_0xfef0('0x3b')];_0x524db7+=0x1){let _0x591f01=_0x63704[_0x524db7];for(var _0x6ccbf8=0x0;_0x6ccbf8<_0x591f01[_0xfef0('0x83')][_0xfef0('0x3b')];_0x6ccbf8+=0x1){let _0xdf3db9=_0x591f01[_0xfef0('0x83')][_0x6ccbf8];var _0x520ff3=_0x365938[_0xfef0('0x94')]();_0x520ff3[_0xfef0('0x7c')]('ut.UserId\x20=\x20?',_0xdf3db9['id']);_0xd9c290[_0xfef0('0x67')](db['sequelize'][_0xfef0('0x36')](_0x520ff3[_0xfef0('0x95')](),{'type':db[_0xfef0('0x6f')]['QueryTypes'][_0xfef0('0x96')]})['then'](function(_0x5dde37){if(_0x5dde37[_0xfef0('0x3b')]===0x1){return _0xdf3db9['id'];}else{var _0x57b2b4=_[_0xfef0('0x97')](_[_0xfef0('0x61')](_0x5dde37,_0xfef0('0x98')),function(_0x11c5f0){return _[_0xfef0('0x99')](_0x3d85ec,_0x11c5f0);});if(_0x57b2b4){return _0xdf3db9['id'];}}}));}}return BPromise[_0xfef0('0x9a')](_0xd9c290)[_0xfef0('0x2c')](function(_0x547b4d){_0x17ab00=_(_0x17ab00)['union'](_0x547b4d)[_0xfef0('0x9b')]()['value']();return db[_0xfef0('0x43')][_0xfef0('0x4b')]({'where':{'id':_0x29ad24[_0xfef0('0x49')]['id']}})[_0xfef0('0x2c')](function(_0x3f9588){return db[_0xfef0('0x6f')][_0xfef0('0x70')](function(_0x326c85){return _0x3f9588['removeTeams'](_0x29ad24['query'][_0xfef0('0x72')],{'transaction':_0x326c85})[_0xfef0('0x2c')](function(){if(!_[_0xfef0('0x9c')](_0x17ab00)){return _0x3f9588[_0xfef0('0x76')](_0x17ab00,{'transaction':_0x326c85});}})[_0xfef0('0x2c')](function(){_0x17ab00['forEach'](function(_0x54d98e){socket['emit'](_0xfef0('0x78'),{'UserId':_0x54d98e,'VoicePrefixId':_0x3f9588['id']});});});});});});})[_0xfef0('0x2c')](respondWithStatusCode(_0x1ee5ad,null))['catch'](handleError(_0x1ee5ad,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 36b658e..b2fe0a7 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 _0xc778=['remove','emit','hasOwnProperty','hook','../../mysqldb'];(function(_0x1d546c,_0x48b498){var _0x322435=function(_0x10df92){while(--_0x10df92){_0x1d546c['push'](_0x1d546c['shift']());}};_0x322435(++_0x48b498);}(_0xc778,0x14e));var _0x8c77=function(_0x3880e3,_0xe460ce){_0x3880e3=_0x3880e3-0x0;var _0x4e8909=_0xc778[_0x3880e3];return _0x4e8909;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x8c77('0x0'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8c77('0x1')};function emitEvent(_0x5eb7b7){return function(_0x39f356,_0x386b96,_0x2fdabc){VoicePrefixEvents[_0x8c77('0x2')](_0x5eb7b7+':'+_0x39f356['id'],_0x39f356);VoicePrefixEvents[_0x8c77('0x2')](_0x5eb7b7,_0x39f356);_0x2fdabc(null);};}for(var e in events){if(events[_0x8c77('0x3')](e)){var event=events[e];VoicePrefix[_0x8c77('0x4')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x10b4=['VoicePrefix','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x10b4,0x127));var _0x410b=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x10b4[_0x455c6c];return _0x488242;};'use strict';var EventEmitter=require(_0x410b('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0x410b('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x410b('0x2')](0x0);var events={'afterCreate':_0x410b('0x3'),'afterUpdate':_0x410b('0x4'),'afterDestroy':_0x410b('0x5')};function emitEvent(_0x283300){return function(_0x4bf600,_0x5aed6c,_0x3b601e){VoicePrefixEvents[_0x410b('0x6')](_0x283300+':'+_0x4bf600['id'],_0x4bf600);VoicePrefixEvents[_0x410b('0x6')](_0x283300,_0x4bf600);_0x3b601e(null);};}for(var e in events){if(events[_0x410b('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index a1958a4..b8c4653 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 _0x60c0=['bluebird','request-promise','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes','util','api'];(function(_0x3c94ed,_0x34617b){var _0x47806d=function(_0x1f52e6){while(--_0x1f52e6){_0x3c94ed['push'](_0x3c94ed['shift']());}};_0x47806d(++_0x34617b);}(_0x60c0,0x139));var _0x060c=function(_0x3f6b67,_0x2736d1){_0x3f6b67=_0x3f6b67-0x0;var _0x3d2b4c=_0x60c0[_0x3f6b67];return _0x3d2b4c;};'use strict';var _=require('lodash');var util=require(_0x060c('0x0'));var logger=require('../../config/logger')(_0x060c('0x1'));var moment=require('moment');var BPromise=require(_0x060c('0x2'));var rp=require(_0x060c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x060c('0x4'));var attributes=require(_0x060c('0x5'));module[_0x060c('0x6')]=function(_0x251307,_0x471fc5){return _0x251307['define'](_0x060c('0x7'),attributes,{'tableName':_0x060c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfdbf=['define','VoicePrefix','voice_prefixes','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x3a07c1,_0x34d57f){var _0x2bbe15=function(_0x5a02fb){while(--_0x5a02fb){_0x3a07c1['push'](_0x3a07c1['shift']());}};_0x2bbe15(++_0x34d57f);}(_0xfdbf,0x17c));var _0xffdb=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xfdbf[_0x2bf141];return _0x48277b;};'use strict';var _=require(_0xffdb('0x0'));var util=require(_0xffdb('0x1'));var logger=require('../../config/logger')(_0xffdb('0x2'));var moment=require(_0xffdb('0x3'));var BPromise=require(_0xffdb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xffdb('0x5'));var rimraf=require(_0xffdb('0x6'));var config=require(_0xffdb('0x7'));var attributes=require(_0xffdb('0x8'));module[_0xffdb('0x9')]=function(_0x2ce7dd,_0x3e22ee){return _0x2ce7dd[_0xffdb('0xa')](_0xffdb('0xb'),attributes,{'tableName':_0xffdb('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 cec5cdf..cb942fa 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 _0x27a0=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http'];(function(_0x79892a,_0x394268){var _0xbec551=function(_0x2af89e){while(--_0x2af89e){_0x79892a['push'](_0x79892a['shift']());}};_0xbec551(++_0x394268);}(_0x27a0,0xbf));var _0x027a=function(_0x4b8b34,_0x2ebf7e){_0x4b8b34=_0x4b8b34-0x0;var _0x30b48d=_0x27a0[_0x4b8b34];return _0x30b48d;};'use strict';var _=require('lodash');var util=require(_0x027a('0x0'));var moment=require(_0x027a('0x1'));var BPromise=require(_0x027a('0x2'));var rs=require(_0x027a('0x3'));var fs=require('fs');var Redis=require(_0x027a('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x027a('0x5'));var jayson=require(_0x027a('0x6'));var client=jayson[_0x027a('0x7')][_0x027a('0x8')]({'port':0x232a});config[_0x027a('0x9')]=_[_0x027a('0xa')](config['redis'],{'host':_0x027a('0xb'),'port':0x18eb});var socket=require(_0x027a('0xc'))(new Redis(config[_0x027a('0x9')]));require('./voicePrefix.socket')[_0x027a('0xd')](socket);function respondWithRpcPromise(_0x42ccac,_0x2d13a2,_0x534902){return new BPromise(function(_0x6d5b04,_0xe5df59){return client[_0x027a('0xe')](_0x42ccac,_0x534902)[_0x027a('0xf')](function(_0x172eb4){logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));logger[_0x027a('0x13')](_0x027a('0x14'),_0x2d13a2,_0x027a('0x12'),JSON['stringify'](_0x172eb4));if(_0x172eb4[_0x027a('0x15')]){if(_0x172eb4[_0x027a('0x15')][_0x027a('0x16')]===0x1f4){logger[_0x027a('0x15')](_0x027a('0x11'),_0x2d13a2,_0x172eb4['error']['message']);return _0xe5df59(_0x172eb4[_0x027a('0x15')]['message']);}logger[_0x027a('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x2d13a2,_0x172eb4[_0x027a('0x15')]['message']);return _0x6d5b04(_0x172eb4['error']['message']);}else{logger[_0x027a('0x10')](_0x027a('0x11'),_0x2d13a2,_0x027a('0x12'));_0x6d5b04(_0x172eb4[_0x027a('0x17')]['message']);}})[_0x027a('0x18')](function(_0x2fccf6){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x2d13a2,_0x2fccf6);_0xe5df59(_0x2fccf6);});});} \ No newline at end of file +var _0x82d8=['result','catch','lodash','moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','request','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x440353,_0x6424b9){var _0x5891a7=function(_0xc8ee03){while(--_0xc8ee03){_0x440353['push'](_0x440353['shift']());}};_0x5891a7(++_0x6424b9);}(_0x82d8,0xff));var _0x882d=function(_0x38be8f,_0x58a00e){_0x38be8f=_0x38be8f-0x0;var _0x250d1f=_0x82d8[_0x38be8f];return _0x250d1f;};'use strict';var _=require(_0x882d('0x0'));var util=require('util');var moment=require(_0x882d('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x882d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x882d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x882d('0x4'));var jayson=require(_0x882d('0x5'));var client=jayson[_0x882d('0x6')][_0x882d('0x7')]({'port':0x232a});config[_0x882d('0x8')]=_[_0x882d('0x9')](config[_0x882d('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x882d('0xa'))(new Redis(config[_0x882d('0x8')]));require(_0x882d('0xb'))['register'](socket);function respondWithRpcPromise(_0x2781b1,_0x3ad799,_0x5e342a){return new BPromise(function(_0x130954,_0xa2ca7f){return client[_0x882d('0xc')](_0x2781b1,_0x5e342a)['then'](function(_0x287672){logger[_0x882d('0xd')](_0x882d('0xe'),_0x3ad799,_0x882d('0xf'));logger[_0x882d('0x10')](_0x882d('0x11'),_0x3ad799,_0x882d('0xf'),JSON['stringify'](_0x287672));if(_0x287672['error']){if(_0x287672[_0x882d('0x12')][_0x882d('0x13')]===0x1f4){logger[_0x882d('0x12')](_0x882d('0xe'),_0x3ad799,_0x287672[_0x882d('0x12')]['message']);return _0xa2ca7f(_0x287672[_0x882d('0x12')][_0x882d('0x14')]);}logger[_0x882d('0x12')](_0x882d('0xe'),_0x3ad799,_0x287672[_0x882d('0x12')][_0x882d('0x14')]);return _0x130954(_0x287672[_0x882d('0x12')][_0x882d('0x14')]);}else{logger[_0x882d('0xd')]('VoicePrefix,\x20%s,\x20%s',_0x3ad799,'request\x20sent');_0x130954(_0x287672[_0x882d('0x15')]['message']);}})[_0x882d('0x16')](function(_0x47d6a0){logger[_0x882d('0x12')](_0x882d('0xe'),_0x3ad799,_0x47d6a0);_0xa2ca7f(_0x47d6a0);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a4e6005..6aadf75 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 _0x1d90=['./voicePrefix.events','remove','emit','removeListener','register','length'];(function(_0x536c48,_0x56b18d){var _0x4a5007=function(_0xe1e874){while(--_0xe1e874){_0x536c48['push'](_0x536c48['shift']());}};_0x4a5007(++_0x56b18d);}(_0x1d90,0x13e));var _0x01d9=function(_0x48f8c4,_0x4e3dba){_0x48f8c4=_0x48f8c4-0x0;var _0x118849=_0x1d90[_0x48f8c4];return _0x118849;};'use strict';var VoicePrefixEvents=require(_0x01d9('0x0'));var events=['save',_0x01d9('0x1'),'update'];function createListener(_0x433fc8,_0x5525be){return function(_0x1d6da0){_0x5525be[_0x01d9('0x2')](_0x433fc8,_0x1d6da0);};}function removeListener(_0x47e13e,_0x2f2e27){return function(){VoicePrefixEvents[_0x01d9('0x3')](_0x47e13e,_0x2f2e27);};}exports[_0x01d9('0x4')]=function(_0x549267){for(var _0x500fb7=0x0,_0x1664eb=events[_0x01d9('0x5')];_0x500fb7<_0x1664eb;_0x500fb7++){var _0x598409=events[_0x500fb7];var _0xef9d5b=createListener('voicePrefix:'+_0x598409,_0x549267);VoicePrefixEvents['on'](_0x598409,_0xef9d5b);}}; \ No newline at end of file +var _0x4fdb=['removeListener','length','./voicePrefix.events','save','remove','update','emit'];(function(_0x1a1072,_0x84a807){var _0x415142=function(_0x3c20d6){while(--_0x3c20d6){_0x1a1072['push'](_0x1a1072['shift']());}};_0x415142(++_0x84a807);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xd34467,_0x57205e){_0xd34467=_0xd34467-0x0;var _0x3aeda9=_0x4fdb[_0xd34467];return _0x3aeda9;};'use strict';var VoicePrefixEvents=require(_0xb4fd('0x0'));var events=[_0xb4fd('0x1'),_0xb4fd('0x2'),_0xb4fd('0x3')];function createListener(_0x3b399e,_0xafe34b){return function(_0x260a35){_0xafe34b[_0xb4fd('0x4')](_0x3b399e,_0x260a35);};}function removeListener(_0x1c0b08,_0x5b73bb){return function(){VoicePrefixEvents[_0xb4fd('0x5')](_0x1c0b08,_0x5b73bb);};}exports['register']=function(_0x14052b){for(var _0x5d8b39=0x0,_0x53273f=events[_0xb4fd('0x6')];_0x5d8b39<_0x53273f;_0x5d8b39++){var _0x3af8e3=events[_0x5d8b39];var _0x1151b5=createListener('voicePrefix:'+_0x3af8e3,_0x14052b);VoicePrefixEvents['on'](_0x3af8e3,_0x1151b5);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 98288c0..00e2447 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(_0x2bfefe,_0x3e0e91){var _0x26adc3=function(_0xd9ff1a){while(--_0xd9ff1a){_0x2bfefe['push'](_0x2bfefe['shift']());}};_0x26adc3(++_0x3e0e91);}(_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 +var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x26299e,_0x394ad1){var _0x6c4f4a=function(_0x539ae9){while(--_0x539ae9){_0x26299e['push'](_0x26299e['shift']());}};_0x6c4f4a(++_0x394ad1);}(_0xb10b,0x12a));var _0xbb10=function(_0x249565,_0x2a026a){_0x249565=_0x249565-0x0;var _0x43dee8=_0xb10b[_0x249565];return _0x43dee8;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b2aace1..324215e 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 _0xd3d8=['exports','STRING','name','ENUM','outbound','inbound','default','ringall','leastrecent','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','type','strategy','booked','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','acw','wrapuptime','BOOLEAN','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)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','always','never','onlyIfOpen','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)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\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)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize'];(function(_0xac16fb,_0x48eab2){var _0x461c7d=function(_0x5b21f6){while(--_0x5b21f6){_0xac16fb['push'](_0xac16fb['shift']());}};_0x461c7d(++_0x48eab2);}(_0xd3d8,0x1e5));var _0x8d3d=function(_0x149c70,_0x433afb){_0x149c70=_0x149c70-0x0;var _0x52dab6=_0xd3d8[_0x149c70];return _0x52dab6;};'use strict';var Sequelize=require(_0x8d3d('0x0'));module[_0x8d3d('0x1')]={'name':{'type':Sequelize[_0x8d3d('0x2')],'allowNull':![],'unique':_0x8d3d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x8d3d('0x4')]('inbound',_0x8d3d('0x5')),'allowNull':![],'defaultValue':_0x8d3d('0x6')},'musiconhold':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':_0x8d3d('0x7')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x8d3d('0x4')]('rr',_0x8d3d('0x8'),_0x8d3d('0x9'),'fewestcalls','random',_0x8d3d('0xa'),_0x8d3d('0xb'),_0x8d3d('0xc'),_0x8d3d('0xd')),'allowNull':![],'defaultValue':'ringall','set':function(_0x1dff58){this[_0x8d3d('0xe')]('strategy',_0x1dff58?_0x1dff58:_0x8d3d('0xa'));},'get':function(){var _0x5492bd=this[_0x8d3d('0xf')](_0x8d3d('0x10'));var _0x11fd52=this[_0x8d3d('0xf')]('dialMethod');var _0x24e1d7=this[_0x8d3d('0xf')](_0x8d3d('0x11'));if(_0x5492bd==='outbound'){if(_0x11fd52==='preview'){return null;}if(_0x11fd52===_0x8d3d('0x12')&&![_0x8d3d('0xa'),_0x8d3d('0x13')][_0x8d3d('0x14')](_0x24e1d7)){this[_0x8d3d('0xe')](_0x8d3d('0x11'),_0x8d3d('0xa'));}}return _0x24e1d7;}},'servicelevel':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x8d3d('0x15')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x8d3d('0x2')]},'weight':{'type':Sequelize[_0x8d3d('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM'](_0x8d3d('0x16'),'no'),'defaultValue':_0x8d3d('0x16')},'autopause':{'type':Sequelize['ENUM'](_0x8d3d('0x16'),'no',_0x8d3d('0x17')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x8d3d('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0x8d3d('0x4')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x8d3d('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x8d3d('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x8d3d('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x8d3d('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x8d3d('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defaultValue':_0x8d3d('0x16')},'announce_holdtime':{'type':Sequelize['ENUM'](_0x8d3d('0x16'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no')},'announce_position_limit':{'type':Sequelize[_0x8d3d('0x15')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x8d3d('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x8d3d('0x2')]},'queue_youarenext':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x8d3d('0x2')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x8d3d('0x2')]},'queue_less_than':{'type':Sequelize[_0x8d3d('0x2')]},'periodic_announce':{'type':Sequelize[_0x8d3d('0x18')],'set':function(_0x36f019){this['setDataValue'](_0x8d3d('0x19'),_0x36f019?_0x36f019[_0x8d3d('0x1a')](','):[]);},'get':function(){return this[_0x8d3d('0xf')]('periodic_announce')?this[_0x8d3d('0xf')]('periodic_announce')[_0x8d3d('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':_0x8d3d('0x16'),'set':function(_0x250253){this[_0x8d3d('0xe')](_0x8d3d('0x1c'),_0x250253?_0x250253['join'](','):undefined);},'get':function(){return this[_0x8d3d('0xf')](_0x8d3d('0x1c'))?this['getDataValue'](_0x8d3d('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':'no','set':function(_0x107136){this[_0x8d3d('0xe')](_0x8d3d('0x1d'),_0x107136?_0x107136[_0x8d3d('0x1a')](','):undefined);},'get':function(){return this[_0x8d3d('0xf')](_0x8d3d('0x1d'))?this['getDataValue'](_0x8d3d('0x1d'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x8d3d('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x8d3d('0x2')]},'description':{'type':Sequelize[_0x8d3d('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x281bf2){this[_0x8d3d('0xe')](_0x8d3d('0x1e'),_0x281bf2);if(_0x281bf2){if(this[_0x8d3d('0xf')](_0x8d3d('0x1f'))<0x2){this[_0x8d3d('0xe')](_0x8d3d('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':0x0,'comment':_0x8d3d('0x21')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x8d3d('0x22'),_0x8d3d('0x23'),_0x8d3d('0x24'),_0x8d3d('0x12')),'defaultValue':_0x8d3d('0x22'),'comment':_0x8d3d('0x25')},'dialLimitChannel':{'type':Sequelize[_0x8d3d('0x15')](0x4)[_0x8d3d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8d3d('0x27')},'dialLimitQueue':{'type':Sequelize[_0x8d3d('0x15')](0x4)[_0x8d3d('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x8d3d('0x28')},'dialPowerLevel':{'type':Sequelize[_0x8d3d('0x29')](0x2)[_0x8d3d('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x8d3d('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x8d3d('0x2b'),_0x8d3d('0x2c')),'defaultValue':_0x8d3d('0x2c'),'comment':_0x8d3d('0x2d')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x8d3d('0x2e')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x8d3d('0x2f')},'dialOriginateCallerIdName':{'type':Sequelize[_0x8d3d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x8d3d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x30')},'dialQueueOptions':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':'tTxX','comment':_0x8d3d('0x31')},'dialQueueTimeout':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x32')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'comment':_0x8d3d('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x8d3d('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x8d3d('0x38'),_0x8d3d('0x39'),_0x8d3d('0x3a')),'defaultValue':_0x8d3d('0x38')},'dialAMDActive':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':0x0,'comment':_0x8d3d('0x3b')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x8d3d('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x8d3d('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x8d3d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x8d3d('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x8d3d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x8d3d('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x8d3d('0x15')](0x9)[_0x8d3d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x8d3d('0x15')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x8d3d('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x8d3d('0x15')](0x9)[_0x8d3d('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x8d3d('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x8d3d('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x8d3d('0x15')](0x9)[_0x8d3d('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x8d3d('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':0x0,'comment':_0x8d3d('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x8d3d('0x4')](_0x8d3d('0x43'),_0x8d3d('0x44')),'defaultValue':_0x8d3d('0x43')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8d3d('0x45')},'dialCutDigit':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x8d3d('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x8d3d('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x8d3d('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x8d3d('0x15')](0x5)[_0x8d3d('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x8d3d('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8d3d('0x15')],'allowNull':!![],'comment':_0x8d3d('0x4e')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x8d3d('0x4f'),'set':function(_0x1abae6){if(!_0x1abae6)this[_0x8d3d('0xe')](_0x8d3d('0x50'),null);this[_0x8d3d('0xe')]('mandatoryDisposition',_0x1abae6);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x8d3d('0x15')](0x3)[_0x8d3d('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x8d3d('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x8d3d('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x5a1e=['#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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','ENUM','ringall','fewestcalls','linear','setDataValue','strategy','rrmemory','getDataValue','type','dialMethod','outbound','preview','booked','roundrobin','includes','INTEGER','yes','all','TEXT','periodic_announce','split','joinempty','join','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','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)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x5a1e,0xaa));var _0xe5a1=function(_0x310223,_0x1fd62d){_0x310223=_0x310223-0x0;var _0x4d2dc2=_0x5a1e[_0x310223];return _0x4d2dc2;};'use strict';var Sequelize=require(_0xe5a1('0x0'));module[_0xe5a1('0x1')]={'name':{'type':Sequelize[_0xe5a1('0x2')],'allowNull':![],'unique':_0xe5a1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xe5a1('0x4'),'outbound'),'allowNull':![],'defaultValue':_0xe5a1('0x4')},'musiconhold':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':'default'},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0xe5a1('0x5')]('rr',_0xe5a1('0x6'),'leastrecent',_0xe5a1('0x7'),'random','rrmemory',_0xe5a1('0x8'),'wrandom','rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0x22e416){this[_0xe5a1('0x9')](_0xe5a1('0xa'),_0x22e416?_0x22e416:_0xe5a1('0xb'));},'get':function(){var _0x8d47d2=this[_0xe5a1('0xc')](_0xe5a1('0xd'));var _0x2fdf98=this['getDataValue'](_0xe5a1('0xe'));var _0x2ce0de=this[_0xe5a1('0xc')](_0xe5a1('0xa'));if(_0x8d47d2===_0xe5a1('0xf')){if(_0x2fdf98===_0xe5a1('0x10')){return null;}if(_0x2fdf98===_0xe5a1('0x11')&&![_0xe5a1('0xb'),_0xe5a1('0x12')][_0xe5a1('0x13')](_0x2ce0de)){this[_0xe5a1('0x9')]('strategy',_0xe5a1('0xb'));}}return _0x2ce0de;}},'servicelevel':{'type':Sequelize[_0xe5a1('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xe5a1('0x14')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xe5a1('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xe5a1('0x2')]},'weight':{'type':Sequelize[_0xe5a1('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':_0xe5a1('0x15')},'autopause':{'type':Sequelize['ENUM'](_0xe5a1('0x15'),'no',_0xe5a1('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xe5a1('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0xe5a1('0x5')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xe5a1('0x5')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xe5a1('0x5')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xe5a1('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xe5a1('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xe5a1('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xe5a1('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xe5a1('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xe5a1('0x5')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xe5a1('0x2')]},'queue_youarenext':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xe5a1('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xe5a1('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0xe5a1('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xe5a1('0x2')]},'periodic_announce':{'type':Sequelize[_0xe5a1('0x17')],'set':function(_0x6f55c){this['setDataValue'](_0xe5a1('0x18'),_0x6f55c?_0x6f55c['join'](','):[]);},'get':function(){return this[_0xe5a1('0xc')](_0xe5a1('0x18'))?this['getDataValue']('periodic_announce')[_0xe5a1('0x19')](','):[];}},'joinempty':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':_0xe5a1('0x15'),'set':function(_0x4ed9b3){this[_0xe5a1('0x9')](_0xe5a1('0x1a'),_0x4ed9b3?_0x4ed9b3[_0xe5a1('0x1b')](','):undefined);},'get':function(){return this['getDataValue'](_0xe5a1('0x1a'))?this[_0xe5a1('0xc')]('joinempty')[_0xe5a1('0x19')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':'no','set':function(_0xf4f15){this[_0xe5a1('0x9')]('leavewhenempty',_0xf4f15?_0xf4f15[_0xe5a1('0x1b')](','):undefined);},'get':function(){return this[_0xe5a1('0xc')](_0xe5a1('0x1c'))?this[_0xe5a1('0xc')](_0xe5a1('0x1c'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xe5a1('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xe5a1('0x2')]},'description':{'type':Sequelize[_0xe5a1('0x2')]},'acw':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':0x0,'set':function(_0x51a970){this[_0xe5a1('0x9')](_0xe5a1('0x1e'),_0x51a970);if(_0x51a970){if(this['getDataValue'](_0xe5a1('0x1f'))<0x2){this[_0xe5a1('0x9')](_0xe5a1('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':0x0,'comment':_0xe5a1('0x20')},'dialMethod':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x10'),'progressive',_0xe5a1('0x21'),_0xe5a1('0x22'),_0xe5a1('0x11')),'defaultValue':_0xe5a1('0x23'),'comment':_0xe5a1('0x24')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xe5a1('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xe5a1('0x26')},'dialLimitQueue':{'type':Sequelize[_0xe5a1('0x14')](0x4)[_0xe5a1('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xe5a1('0x27')](0x2)[_0xe5a1('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xe5a1('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x29'),_0xe5a1('0x2a')),'defaultValue':_0xe5a1('0x2a'),'comment':_0xe5a1('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xe5a1('0x27')](0x2)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xe5a1('0x2c')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xe5a1('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xe5a1('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xe5a1('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x2e')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xe5a1('0x2f'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x30')},'dialQueueProject':{'type':Sequelize[_0xe5a1('0x2')],'comment':_0xe5a1('0x31')},'dialCongestionMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x33')},'dialBusyRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5a1('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'comment':_0xe5a1('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5a1('0x36')},'dialGlobalMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':_0xe5a1('0x37')},'dialPrefix':{'type':Sequelize[_0xe5a1('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x38'),'never',_0xe5a1('0x39')),'defaultValue':_0xe5a1('0x38')},'dialAMDActive':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xe5a1('0x14')](0x9)[_0xe5a1('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xe5a1('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0xe5a1('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xe5a1('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xe5a1('0x14')](0x9)[_0xe5a1('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xe5a1('0x14')](0x9)[_0xe5a1('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xe5a1('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0xe5a1('0x14')](0x9)[_0xe5a1('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xe5a1('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xe5a1('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xe5a1('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xe5a1('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xe5a1('0x3f')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xe5a1('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xe5a1('0x40')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xe5a1('0x14')](0x9)[_0xe5a1('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xe5a1('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':0x0,'comment':_0xe5a1('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xe5a1('0x5')](_0xe5a1('0x43'),_0xe5a1('0x44')),'defaultValue':_0xe5a1('0x43')},'dialQueueProject2':{'type':Sequelize[_0xe5a1('0x2')],'comment':_0xe5a1('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5a1('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5a1('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x49')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xe5a1('0x14')](0x3)[_0xe5a1('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xe5a1('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xe5a1('0x14')](0x5)[_0xe5a1('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xe5a1('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe5a1('0x14')],'allowNull':!![],'comment':_0xe5a1('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':![],'comment':_0xe5a1('0x4d'),'set':function(_0x275481){if(!_0x275481)this[_0xe5a1('0x9')](_0xe5a1('0x4e'),null);this[_0xe5a1('0x9')](_0xe5a1('0x4f'),_0x275481);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xe5a1('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xe5a1('0x14')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xe5a1('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index d7a44df..5c25689 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 _0x008c=['deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','into','fromQuery','COALESCE(phone,\x27\x27)','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','count','set','Content-Range','then','inbound','map','value','includes','type','UserProfileResource','destroy','status','send','index','VoiceQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','VoiceQueues','QueueCampaigns','outbound','name','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','limit','sort','pick','VoiceQueueId','filter','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isEmpty','UserVoiceQueueRt','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','cm_contacts'];(function(_0x5d7118,_0x495f38){var _0x593c1d=function(_0x249ccb){while(--_0x249ccb){_0x5d7118['push'](_0x5d7118['shift']());}};_0x593c1d(++_0x495f38);}(_0x008c,0x188));var _0xc008=function(_0x492445,_0x1454f9){_0x492445=_0x492445-0x0;var _0x34ca20=_0x008c[_0x492445];return _0x34ca20;};'use strict';var moment=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));var squel=require(_0xc008('0x4'));var Redis=require('ioredis');var qs=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var db=require(_0xc008('0x9'))['db'];config[_0xc008('0xa')]=_[_0xc008('0xb')](config[_0xc008('0xa')],{'host':_0xc008('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0xa')]));require('./voiceQueue.socket')[_0xc008('0xd')](socket);function respondWithStatusCode(_0x5b64f8,_0x52041f){_0x52041f=_0x52041f||0xcc;return function(_0x27830d){if(_0x27830d){return _0x5b64f8[_0xc008('0xe')](_0x52041f);}return _0x5b64f8['status'](_0x52041f)['end']();};}function respondWithResult(_0x543eb8,_0x1eacfa){_0x1eacfa=_0x1eacfa||0xc8;return function(_0xc881aa){if(_0xc881aa){return _0x543eb8['status'](_0x1eacfa)[_0xc008('0xf')](_0xc881aa);}};}function respondWithFilteredResult(_0x332fd4,_0x2ea200){return function(_0x2a5b4e){if(_0x2a5b4e){var _0x9ffa93=typeof _0x2ea200[_0xc008('0x10')]===_0xc008('0x11')&&typeof _0x2ea200['limit']==='undefined';var _0x33f44c=_0x2a5b4e['count'];var _0x25e13f=_0x9ffa93?0x0:_0x2ea200[_0xc008('0x10')];var _0x2073ef=_0x9ffa93?_0x2a5b4e[_0xc008('0x12')]:_0x2ea200[_0xc008('0x10')]+_0x2ea200['limit'];var _0x5e894e;if(_0x2073ef>=_0x33f44c){_0x2073ef=_0x33f44c;_0x5e894e=0xc8;}else{_0x5e894e=0xce;}_0x332fd4['status'](_0x5e894e);return _0x332fd4[_0xc008('0x13')](_0xc008('0x14'),_0x25e13f+'-'+_0x2073ef+'/'+_0x33f44c)[_0xc008('0xf')](_0x2a5b4e);}return null;};}function saveUpdates(_0x3eb12a){return function(_0x4fe771){if(_0x4fe771){return _0x4fe771['update'](_0x3eb12a)['then'](function(_0x5c2668){return _0x5c2668;});}return null;};}function removeEntity(_0x46042b){return function(_0x462af5){if(_0x462af5){return _0x462af5['destroy']()[_0xc008('0x15')](function(){var _0x5906e6=_0x462af5['get']({'plain':!![]});var _0x543e5d=[{'name':'VoiceQueues','value':_0xc008('0x16'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x590a71=_(_0x543e5d)['filter']('ignore')[_0xc008('0x17')](_0xc008('0x18'))[_0xc008('0x18')]();if(_[_0xc008('0x19')](_0x590a71,_0x5906e6[_0xc008('0x1a')])){return;}var _0x110128=_['find'](_0x543e5d,[_0xc008('0x18'),_0x5906e6['type']])['name'];return db[_0xc008('0x1b')][_0xc008('0x1c')]({'where':{'type':_0x110128,'resourceId':_0x5906e6['id']}})[_0xc008('0x15')](function(){return _0x462af5;});})[_0xc008('0x15')](function(){_0x46042b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x5de1e9[_0xc008('0xe')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x1d')](_0x2e31c2)[_0xc008('0x1e')](_0x5bebd9);};}exports[_0xc008('0x1f')]=function(_0x529961,_0x24c14c){var _0x32390d={};var _0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x20')][_0xc008('0x21')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x22')]};});_0x32390d=qs[_0xc008('0x23')](_0x2a7d4f,_0x529961);var _0xf831f2={'where':_0x32390d[_0xc008('0x24')]};return db[_0xc008('0x20')][_0xc008('0x12')](_0xf831f2)[_0xc008('0x15')](function(_0x22d8e8){_0x209591[_0xc008('0x12')]=_0x22d8e8;_0x32390d[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x529961[_0xc008('0x26')]);return db['VoiceQueue'][_0xc008('0x27')](_0x32390d);})[_0xc008('0x15')](function(_0x499754){_0x209591[_0xc008('0x28')]=_0x499754;return _0x209591;})[_0xc008('0x15')](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x29')](handleError(_0x24c14c,null));};exports[_0xc008('0x2a')]=function(_0xd0e05a,_0x3cd878){var _0x7cfbc5={'raw':![],'where':{'id':_0xd0e05a[_0xc008('0x2b')]['id']}},_0x470e79={};_0x470e79['model']=_[_0xc008('0x2c')](db[_0xc008('0x20')][_0xc008('0x21')]);_0x470e79[_0xc008('0x26')]=_[_0xc008('0x2c')](_0xd0e05a[_0xc008('0x26')]);_0x470e79[_0xc008('0x2d')]=_['intersection'](_0x470e79[_0xc008('0x2e')],_0x470e79[_0xc008('0x26')]);_0x7cfbc5['attributes']=_[_0xc008('0x2f')](_0x470e79[_0xc008('0x2e')],qs['fields'](_0xd0e05a[_0xc008('0x26')][_0xc008('0x30')]));_0x7cfbc5[_0xc008('0x31')]=_0x7cfbc5['attributes']['length']?_0x7cfbc5['attributes']:_0x470e79[_0xc008('0x2e')];if(_0xd0e05a['query'][_0xc008('0x32')]){_0x7cfbc5[_0xc008('0x25')]=[{'all':!![]}];}_0x7cfbc5=_[_0xc008('0x33')]({},_0x7cfbc5,_0xd0e05a[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x7cfbc5)[_0xc008('0x15')](handleEntityNotFound(_0x3cd878,null))[_0xc008('0x15')](respondWithResult(_0x3cd878,null))[_0xc008('0x29')](handleError(_0x3cd878,null));};exports[_0xc008('0x36')]=function(_0x3ebb83,_0xdfca2e){return db[_0xc008('0x20')][_0xc008('0x36')](_0x3ebb83['body'],{})[_0xc008('0x15')](function(_0x23c4db){var _0x30b7df=_0x3ebb83[_0xc008('0x37')]['get']({'plain':!![]});if(!_0x30b7df)throw new Error(_0xc008('0x38'));if(_0x30b7df[_0xc008('0x39')]===_0xc008('0x37')){var _0x36e7ae=_0x23c4db[_0xc008('0x3a')]({'plain':!![]});var _0x5706bb=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':_0xc008('0x3c'),'value':_0xc008('0x3d')}];var _0x7279e8=_['find'](_0x5706bb,[_0xc008('0x18'),_0x36e7ae[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')]['find']({'where':{'name':_0x7279e8,'userProfileId':_0x30b7df[_0xc008('0x40')]},'raw':!![]})[_0xc008('0x15')](function(_0x351d5c){if(_0x351d5c&&_0x351d5c['autoAssociation']===0x0){return db[_0xc008('0x1b')]['create']({'name':_0x36e7ae[_0xc008('0x3e')],'resourceId':_0x36e7ae['id'],'type':_0x351d5c['name'],'sectionId':_0x351d5c['id']},{})[_0xc008('0x15')](function(){return _0x23c4db;});}else{return _0x23c4db;}})[_0xc008('0x29')](function(_0x5a5d85){logger[_0xc008('0x41')](_0xc008('0x42'),_0x5a5d85);throw _0x5a5d85;});}return _0x23c4db;})[_0xc008('0x15')](respondWithResult(_0xdfca2e,0xc9))['catch'](handleError(_0xdfca2e,null));};exports[_0xc008('0x43')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'where':{'id':_0x2a9b5c[_0xc008('0x2b')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x21')]);_0x44fc5d[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x347629[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x2a9b5c[_0xc008('0x26')][_0xc008('0x30')]));_0x44fc5d[_0xc008('0x31')]=_0x44fc5d['attributes']['length']?_0x44fc5d['attributes']:_0x347629[_0xc008('0x2e')];if(_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]){_0x44fc5d['include']=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x33')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x44fc5d)[_0xc008('0x15')](handleEntityNotFound(_0x200469,null))[_0xc008('0x15')](function(_0x17ec90){if(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x3a')]({'plain':!![]});_0x405e87=qs[_0xc008('0x44')](_0x405e87,['id','createdAt','updatedAt']);_0x2a9b5c[_0xc008('0x45')]=_['omit'](_0x2a9b5c[_0xc008('0x45')],['id',_0xc008('0x46'),_0xc008('0x47')]);return db['VoiceQueue'][_0xc008('0x36')](_[_0xc008('0x33')](_0x405e87,_0x2a9b5c[_0xc008('0x45')]),{'include':_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7b3b){var _0x27b022=_0x2a9b5c['user'][_0xc008('0x3a')]({'plain':!![]});if(!_0x27b022)throw new Error(_0xc008('0x38'));if(_0x27b022['role']==='user'){var _0x2df905=_0x3a7b3b[_0xc008('0x3a')]({'plain':!![]});var _0x20947b=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':'QueueCampaigns','value':'outbound'}];var _0x34b72a=_['find'](_0x20947b,[_0xc008('0x18'),_0x2df905[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')][_0xc008('0x35')]({'where':{'name':_0x34b72a,'userProfileId':_0x27b022[_0xc008('0x40')]},'raw':!![]})['then'](function(_0x2ea742){if(_0x2ea742&&_0x2ea742[_0xc008('0x48')]===0x0){return db[_0xc008('0x1b')][_0xc008('0x36')]({'name':_0x2df905[_0xc008('0x3e')],'resourceId':_0x2df905['id'],'type':_0x2ea742['name'],'sectionId':_0x2ea742['id']},{})[_0xc008('0x15')](function(){return _0x3a7b3b;});}else{return _0x3a7b3b;}})['catch'](function(_0x535e6e){logger['error'](_0xc008('0x42'),_0x535e6e);throw _0x535e6e;});}return _0x3a7b3b;});}})[_0xc008('0x15')](respondWithResult(_0x200469,0xc9))[_0xc008('0x29')](handleError(_0x200469,null));};exports['update']=function(_0x3aeeab,_0x2d8361){if(_0x3aeeab[_0xc008('0x45')]['id']){delete _0x3aeeab['body']['id'];}return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x3aeeab[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2d8361,null))['then'](saveUpdates(_0x3aeeab[_0xc008('0x45')],null))['then'](respondWithResult(_0x2d8361,null))[_0xc008('0x29')](handleError(_0x2d8361,null));};exports[_0xc008('0x1c')]=function(_0x2ae14e,_0x943c91){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2ae14e['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x943c91,null))['then'](removeEntity(_0x943c91,null))['catch'](handleError(_0x943c91,null));};exports[_0xc008('0x49')]=function(_0x30aa1e,_0x56e755){var _0xb1befa={'raw':![],'where':{}};var _0xb8ba7={};var _0x3e373e={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x30aa1e[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x56e755,null))['then'](function(_0x16e052){if(_0x16e052){_0xb8ba7[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x4b')][_0xc008('0x21')]);_0xb8ba7[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x30aa1e[_0xc008('0x26')]);_0xb8ba7[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0xb8ba7[_0xc008('0x2e')],_0xb8ba7[_0xc008('0x26')]);_0xb1befa[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xb8ba7['model'],qs[_0xc008('0x30')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x30')]));_0xb1befa['attributes']=_0xb1befa[_0xc008('0x31')][_0xc008('0x4c')]?_0xb1befa['attributes']:_0xb8ba7['model'];if(!_0x30aa1e[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0xb1befa[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x4f')]);_0xb1befa[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x10')]);}_0xb1befa['order']=qs[_0xc008('0x50')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x50')]);_0xb1befa[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x30aa1e['query'],_0xb8ba7[_0xc008('0x2d')]));_0xb1befa[_0xc008('0x24')][_0xc008('0x52')]=_0x16e052['id'];if(_0x30aa1e['query'][_0xc008('0x53')]){_0xb1befa[_0xc008('0x24')]=_[_0xc008('0x33')](_0xb1befa['where'],{'$or':_[_0xc008('0x17')](_0xb1befa['attributes'],function(_0x50ee03){var _0xee7a85={};_0xee7a85[_0x50ee03]={'$like':'%'+_0x30aa1e[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0xee7a85;})});}_0xb1befa=_[_0xc008('0x33')]({},_0xb1befa,_0x30aa1e['options']);return db[_0xc008('0x4b')][_0xc008('0x12')]({'where':_0xb1befa['where']})[_0xc008('0x15')](function(_0x5233bb){_0x3e373e[_0xc008('0x12')]=_0x5233bb;if(_0x30aa1e['query'][_0xc008('0x32')]){_0xb1befa['include']=[{'all':!![]}];}return db[_0xc008('0x4b')][_0xc008('0x27')](_0xb1befa);})[_0xc008('0x15')](function(_0x47337b){_0x3e373e['rows']=_0x47337b;return _0x3e373e;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x56e755,_0xb1befa))[_0xc008('0x29')](handleError(_0x56e755,null));};exports[_0xc008('0x54')]=function(_0x1d49db,_0x321500){var _0x13ef78={'raw':!![],'where':{}};var _0xd9e3fd={};var _0x3b46e4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x4a')]({'where':{'id':_0x1d49db['params']['id']}})['then'](handleEntityNotFound(_0x321500,null))['then'](function(_0x406ead){if(_0x406ead){_0xd9e3fd[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x55')][_0xc008('0x21')]);_0xd9e3fd[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x1d49db[_0xc008('0x26')]);_0xd9e3fd[_0xc008('0x2d')]=_['intersection'](_0xd9e3fd[_0xc008('0x2e')],_0xd9e3fd[_0xc008('0x26')]);_0x13ef78[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xd9e3fd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1d49db[_0xc008('0x26')][_0xc008('0x30')]));_0x13ef78[_0xc008('0x31')]=_0x13ef78[_0xc008('0x31')][_0xc008('0x4c')]?_0x13ef78[_0xc008('0x31')]:_0xd9e3fd['model'];if(!_0x1d49db['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x13ef78[_0xc008('0x4f')]=qs['limit'](_0x1d49db[_0xc008('0x26')][_0xc008('0x4f')]);_0x13ef78['offset']=qs['offset'](_0x1d49db['query'][_0xc008('0x10')]);}_0x13ef78[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1d49db[_0xc008('0x26')][_0xc008('0x50')]);_0x13ef78[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x1d49db[_0xc008('0x26')],_0xd9e3fd[_0xc008('0x2d')]));_0x13ef78['where']['VoiceQueueId']=_0x406ead['id'];if(_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]){_0x13ef78[_0xc008('0x24')]=_[_0xc008('0x33')](_0x13ef78[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x13ef78['attributes'],function(_0x5794fe){var _0x68372f={};_0x68372f[_0x5794fe]={'$like':'%'+_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x68372f;})});}_0x13ef78=_['merge']({},_0x13ef78,_0x1d49db['options']);return db['CmHopperHistory']['count']({'where':_0x13ef78['where']})['then'](function(_0x276de2){_0x3b46e4['count']=_0x276de2;if(_0x1d49db[_0xc008('0x26')]['includeAll']){_0x13ef78[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x55')][_0xc008('0x27')](_0x13ef78);})['then'](function(_0x58f348){_0x3b46e4[_0xc008('0x28')]=_0x58f348;return _0x3b46e4;});}})['then'](respondWithFilteredResult(_0x321500,_0x13ef78))[_0xc008('0x29')](handleError(_0x321500,null));};exports[_0xc008('0x57')]=function(_0x544519,_0x7b7246){var _0x4db90b={'raw':!![],'where':{}};var _0x554cf4={};var _0x23bece={'count':0x0,'rows':[]};return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x544519[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x7b7246,null))[_0xc008('0x15')](function(_0x4bd290){if(_0x4bd290){_0x554cf4[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x58')][_0xc008('0x21')]);_0x554cf4[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x544519['query']);_0x554cf4[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],_0x554cf4['query']);_0x4db90b[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],qs['fields'](_0x544519['query']['fields']));_0x4db90b[_0xc008('0x31')]=_0x4db90b[_0xc008('0x31')][_0xc008('0x4c')]?_0x4db90b[_0xc008('0x31')]:_0x554cf4[_0xc008('0x2e')];if(!_0x544519[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x4db90b['limit']=qs[_0xc008('0x4f')](_0x544519[_0xc008('0x26')]['limit']);_0x4db90b['offset']=qs[_0xc008('0x10')](_0x544519[_0xc008('0x26')][_0xc008('0x10')]);}_0x4db90b[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x544519['query'][_0xc008('0x50')]);_0x4db90b[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x544519[_0xc008('0x26')],_0x554cf4[_0xc008('0x2d')]));_0x4db90b[_0xc008('0x24')]['VoiceQueueId']=_0x4bd290['id'];if(_0x544519[_0xc008('0x26')][_0xc008('0x53')]){_0x4db90b[_0xc008('0x24')]=_[_0xc008('0x33')](_0x4db90b['where'],{'$or':_[_0xc008('0x17')](_0x4db90b[_0xc008('0x31')],function(_0x57cf19){var _0x555e8a={};_0x555e8a[_0x57cf19]={'$like':'%'+_0x544519[_0xc008('0x26')]['filter']+'%'};return _0x555e8a;})});}_0x4db90b=_[_0xc008('0x33')]({},_0x4db90b,_0x544519[_0xc008('0x34')]);return db['CmHopperFinal'][_0xc008('0x12')]({'where':_0x4db90b[_0xc008('0x24')]})[_0xc008('0x15')](function(_0xbe42a2){_0x23bece[_0xc008('0x12')]=_0xbe42a2;if(_0x544519[_0xc008('0x26')][_0xc008('0x32')]){_0x4db90b[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x58')][_0xc008('0x27')](_0x4db90b);})['then'](function(_0x49e6d5){_0x23bece[_0xc008('0x28')]=_0x49e6d5;return _0x23bece;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x7b7246,_0x4db90b))['catch'](handleError(_0x7b7246,null));};exports[_0xc008('0x59')]=function(_0x1bdaa9,_0x698d5c){var _0x5f1e48={'raw':!![],'where':{}};var _0x303cdd={};var _0x38239a={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x1bdaa9[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x698d5c,null))[_0xc008('0x15')](function(_0x5bd010){if(_0x5bd010){_0x303cdd[_0xc008('0x2e')]=_['keys'](db[_0xc008('0x5a')][_0xc008('0x21')]);_0x303cdd[_0xc008('0x26')]=_['keys'](_0x1bdaa9[_0xc008('0x26')]);_0x303cdd[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],_0x303cdd[_0xc008('0x26')]);_0x5f1e48[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1bdaa9[_0xc008('0x26')]['fields']));_0x5f1e48[_0xc008('0x31')]=_0x5f1e48[_0xc008('0x31')][_0xc008('0x4c')]?_0x5f1e48[_0xc008('0x31')]:_0x303cdd[_0xc008('0x2e')];if(!_0x1bdaa9['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x5f1e48[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x4f')]);_0x5f1e48[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x10')]);}_0x5f1e48[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x50')]);_0x5f1e48[_0xc008('0x24')]=qs['filters'](_['pick'](_0x1bdaa9[_0xc008('0x26')],_0x303cdd[_0xc008('0x2d')]));_0x5f1e48[_0xc008('0x24')][_0xc008('0x52')]=_0x5bd010['id'];if(_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]){_0x5f1e48[_0xc008('0x24')]=_[_0xc008('0x33')](_0x5f1e48[_0xc008('0x24')],{'$or':_['map'](_0x5f1e48[_0xc008('0x31')],function(_0x2bbadf){var _0x54fd75={};_0x54fd75[_0x2bbadf]={'$like':'%'+_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x54fd75;})});}_0x5f1e48=_[_0xc008('0x33')]({},_0x5f1e48,_0x1bdaa9[_0xc008('0x34')]);return db[_0xc008('0x5a')][_0xc008('0x12')]({'where':_0x5f1e48['where']})[_0xc008('0x15')](function(_0x321532){_0x38239a[_0xc008('0x12')]=_0x321532;if(_0x1bdaa9[_0xc008('0x26')]['includeAll']){_0x5f1e48[_0xc008('0x25')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc008('0x27')](_0x5f1e48);})[_0xc008('0x15')](function(_0x5b47c3){_0x38239a[_0xc008('0x28')]=_0x5b47c3;return _0x38239a;});}})['then'](respondWithFilteredResult(_0x698d5c,_0x5f1e48))[_0xc008('0x29')](handleError(_0x698d5c,null));};exports['getTeams']=function(_0x5b387d,_0x5351f7){var _0x79dfea={};var _0x402b67={};var _0x48f40f;var _0x4fda8;return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x5b387d[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5351f7,null))[_0xc008('0x15')](function(_0x5843ee){if(_0x5843ee){_0x48f40f=_0x5843ee;_0x402b67[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x5b')][_0xc008('0x21')]);_0x402b67[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x5b387d[_0xc008('0x26')]);_0x402b67[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],_0x402b67[_0xc008('0x26')]);_0x79dfea['attributes']=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5b387d['query'][_0xc008('0x30')]));_0x79dfea[_0xc008('0x31')]=_0x79dfea[_0xc008('0x31')]['length']?_0x79dfea[_0xc008('0x31')]:_0x402b67['model'];_0x79dfea[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5b387d[_0xc008('0x26')]['sort']);_0x79dfea[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x5b387d[_0xc008('0x26')],_0x402b67[_0xc008('0x2d')]));if(_0x5b387d[_0xc008('0x26')][_0xc008('0x53')]){_0x79dfea['where']=_[_0xc008('0x33')](_0x79dfea[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x79dfea[_0xc008('0x31')],function(_0x5a61d6){var _0x46fba5={};_0x46fba5[_0x5a61d6]={'$like':'%'+_0x5b387d['query'][_0xc008('0x53')]+'%'};return _0x46fba5;})});}_0x79dfea=_[_0xc008('0x33')]({},_0x79dfea,_0x5b387d[_0xc008('0x34')]);return _0x48f40f[_0xc008('0x5c')](_0x79dfea);}})[_0xc008('0x15')](function(_0x9f266e){if(_0x9f266e){_0x4fda8=_0x9f266e[_0xc008('0x4c')];if(!_0x5b387d['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x79dfea[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5b387d['query'][_0xc008('0x4f')]);_0x79dfea['offset']=qs[_0xc008('0x10')](_0x5b387d[_0xc008('0x26')][_0xc008('0x10')]);}return _0x48f40f['getTeams'](_0x79dfea);}})['then'](function(_0x39bfc0){if(_0x39bfc0){return _0x39bfc0?{'count':_0x4fda8,'rows':_0x39bfc0}:null;}})['then'](respondWithResult(_0x5351f7,null))[_0xc008('0x29')](handleError(_0x5351f7,null));};exports[_0xc008('0x5d')]=function(_0x1c2e63,_0xaf3bed){var _0x58ae7b=_0x1c2e63[_0xc008('0x45')][_0xc008('0x5e')];var _0x537e5e=_['map'](_0x58ae7b,'id');return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x537e5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc008('0x5f'),'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),_0xc008('0x61'),'interface'],'raw':!![]}]})[_0xc008('0x15')](function(_0x3721e8){if(_0x3721e8){var _0xc344a7=_[_0xc008('0x62')](_0x3721e8,function(_0x78b833){var _0x177733=_0x78b833[_0xc008('0x3a')]({'plain':!![]});_0x177733[_0xc008('0x5f')][_0xc008('0x63')](function(_0xa332b1){_0xa332b1[_0xc008('0x64')]=_[_0xc008('0x35')](_0x58ae7b,{'id':_0x177733['id']})[_0xc008('0x64')];});return _0x177733['Agents'];});return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1c2e63[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](function(_0x4447ba){return db[_0xc008('0x65')][_0xc008('0x66')](function(_0xe5d226){return _0x4447ba['addTeams'](_0x537e5e,{'transaction':_0xe5d226})['then'](function(){return BPromise[_0xc008('0x67')](_0x58ae7b,function(_0x3d33ed){return db[_0xc008('0x68')]['upsert']({'TeamId':_0x3d33ed['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id'],'penalty':_0x3d33ed[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_0xc344a7,function(_0x156ec3){return db[_0xc008('0x69')][_0xc008('0x6a')]({'where':{'UserId':_0x156ec3['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id']},'defaults':{'penalty':_0x156ec3[_0xc008('0x64')]},'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_[_0xc008('0x53')](_0xc344a7,{'online':!![]}),function(_0x4ffaa3){return db['UserVoiceQueueRt'][_0xc008('0x6b')]({'membername':_0x4ffaa3[_0xc008('0x3e')],'UserId':_0x4ffaa3['id'],'queue_name':_0x4447ba['name'],'VoiceQueueId':_0x4447ba['id'],'interface':_[_0xc008('0x6c')](_0x4ffaa3[_0xc008('0x6d')])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0x4ffaa3[_0xc008('0x3e')]):_0x4ffaa3[_0xc008('0x6d')],'paused':_0x4ffaa3[_0xc008('0x61')]||![],'penalty':_0x4ffaa3[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){_0xc344a7['forEach'](function(_0x51b305){socket['emit'](_0xc008('0x70'),{'UserId':_0x51b305['id'],'VoiceQueueId':_0x4447ba['id']});});});});});}})['then'](respondWithStatusCode(_0xaf3bed,null))[_0xc008('0x29')](handleError(_0xaf3bed,null));};exports[_0xc008('0x71')]=function(_0x2c6a48,_0x177e8e){return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x73')],'as':_0xc008('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x15')](handleEntityNotFound(_0x177e8e,null))[_0xc008('0x15')](function(_0x1fea74){var _0x304083=_[_0xc008('0x17')](_0x1fea74,'id');var _0x473f44=[];var _0x41d1ea=[];var _0x5c2ca1=squel[_0xc008('0x74')]();_0x5c2ca1['field'](_0xc008('0x75'))[_0xc008('0x76')](_0xc008('0x77'),'tq')['join'](_0xc008('0x78'),'ut',_0xc008('0x79'))[_0xc008('0x24')](_0xc008('0x7a'),_0x2c6a48[_0xc008('0x2b')]['id']);for(var _0x377754=0x0;_0x377754<_0x1fea74[_0xc008('0x4c')];_0x377754+=0x1){let _0x57b8da=_0x1fea74[_0x377754];for(var _0x1cad4b=0x0;_0x1cad4b<_0x57b8da[_0xc008('0x5f')][_0xc008('0x4c')];_0x1cad4b+=0x1){let _0xdb4cef=_0x57b8da['Agents'][_0x1cad4b];var _0x555e8c=_0x5c2ca1['clone']();_0x555e8c['where'](_0xc008('0x7b'),_0xdb4cef['id']);_0x41d1ea[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x555e8c['toString'](),{'type':db[_0xc008('0x65')][_0xc008('0x7d')][_0xc008('0x7e')]})['then'](function(_0x438195){if(_0x438195['length']===0x1){return _0xdb4cef['id'];}else{var _0x3d76b7=_['every'](_[_0xc008('0x17')](_0x438195,_0xc008('0x7f')),function(_0x1aaf89){return _[_0xc008('0x19')](_0x304083,_0x1aaf89);});if(_0x3d76b7){return _0xdb4cef['id'];}}}));}}return BPromise['all'](_0x41d1ea)[_0xc008('0x15')](function(_0x19dcb7){_0x473f44=_(_0x473f44)[_0xc008('0x80')](_0x19dcb7)[_0xc008('0x81')]()[_0xc008('0x18')]();return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2c6a48['params']['id']}})[_0xc008('0x15')](function(_0x30b6af){return db[_0xc008('0x65')]['transaction'](function(_0x5ba04f){return _0x30b6af[_0xc008('0x71')](_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')],{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){if(!_['isEmpty'](_0x473f44)){return _0x30b6af[_0xc008('0x82')](_0x473f44,{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2c6a48['params']['id'],'UserId':_0x473f44},'transaction':_0x5ba04f});});}})[_0xc008('0x15')](function(){_0x473f44['forEach'](function(_0x3744e1){socket['emit'](_0xc008('0x83'),{'UserId':_0x3744e1,'VoiceQueueId':_0x30b6af['id']});});});});});});})[_0xc008('0x15')](respondWithStatusCode(_0x177e8e,null))[_0xc008('0x29')](handleError(_0x177e8e,null));};exports[_0xc008('0x84')]=function(_0x5c24cd,_0x5effd6){var _0x23ba7e,_0x274739;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5c24cd[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5effd6,null))[_0xc008('0x15')](function(_0x272d98){if(_0x272d98){_0x274739=_0x272d98;return _0x272d98[_0xc008('0x84')](_0x5c24cd[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5c24cd[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{})[_0xc008('0x85')](function(_0x57687f){for(var _0x5ea13a=0x0;_0x5ea13a<_0x5c24cd[_0xc008('0x45')]['ids'][_0xc008('0x4c')];_0x5ea13a+=0x1){socket[_0xc008('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x5c24cd['body'][_0xc008('0x72')][_0x5ea13a]),'VoiceQueueId':Number(_0x5c24cd[_0xc008('0x2b')]['id'])});}return _0x57687f;});}})[_0xc008('0x15')](function(_0x129cbf){_0x23ba7e=_0x129cbf||[];if(_0x274739){return db[_0xc008('0x73')][_0xc008('0x27')]({'where':{'id':_0x5c24cd['body'][_0xc008('0x72')]},'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),'voicePause',_0xc008('0x6d')],'raw':!![]});}})[_0xc008('0x15')](function(_0xcef0e4){if(!_[_0xc008('0x87')](_0xcef0e4)){var _0x49f92e=[];for(var _0x4ae026=0x0;_0x4ae026<_0xcef0e4[_0xc008('0x4c')];_0x4ae026++){if(_0xcef0e4[_0x4ae026]['online']){_0x49f92e[_0xc008('0x7c')](db[_0xc008('0x88')][_0xc008('0x6b')]({'membername':_0xcef0e4[_0x4ae026][_0xc008('0x3e')],'UserId':_0xcef0e4[_0x4ae026]['id'],'queue_name':_0x274739[_0xc008('0x3e')],'VoiceQueueId':_0x274739['id'],'interface':_['isNil'](_0xcef0e4[_0x4ae026]['interface'])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0xcef0e4[_0x4ae026][_0xc008('0x3e')]):_0xcef0e4[_0x4ae026][_0xc008('0x6d')],'paused':_0xcef0e4[_0x4ae026][_0xc008('0x61')]||![],'penalty':_0x5c24cd[_0xc008('0x45')][_0xc008('0x64')]||0x0}));}}return BPromise['all'](_0x49f92e);}})[_0xc008('0x15')](function(){return _0x23ba7e;})[_0xc008('0x15')](respondWithResult(_0x5effd6,null))[_0xc008('0x29')](handleError(_0x5effd6,null));};exports[_0xc008('0x82')]=function(_0x1afb32,_0x1c2263){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x1afb32[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x1c2263,null))[_0xc008('0x15')](function(_0x328284){if(_0x328284){return _0x328284['removeAgents'](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])['then'](function(){if(_[_0xc008('0x89')](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])){for(var _0x2598be=0x0;_0x2598be<_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0xc008('0x4c')];_0x2598be+=0x1){socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0x2598be]),'VoiceQueueId':Number(_0x1afb32['params']['id'])});}}else{socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]),'VoiceQueueId':Number(_0x1afb32[_0xc008('0x2b')]['id'])});}});}})[_0xc008('0x15')](function(_0x12f5d1){return db[_0xc008('0x88')][_0xc008('0x1c')]({'where':{'VoiceQueueId':_0x1afb32[_0xc008('0x2b')]['id'],'UserId':_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]}})[_0xc008('0x15')](function(){return _0x12f5d1;});})[_0xc008('0x15')](respondWithStatusCode(_0x1c2263,null))[_0xc008('0x29')](handleError(_0x1c2263,null));};exports[_0xc008('0x8a')]=function(_0x5c358b,_0x49688b){var _0x51fd86={};var _0x10778f={};var _0x237ffb;var _0x3f80f4;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x5c358b[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x49688b,null))['then'](function(_0x3e7099){if(_0x3e7099){_0x237ffb=_0x3e7099;_0x10778f['model']=_['keys'](db[_0xc008('0x73')][_0xc008('0x21')]);_0x10778f['query']=_[_0xc008('0x2c')](_0x5c358b[_0xc008('0x26')]);_0x10778f[_0xc008('0x2d')]=_['intersection'](_0x10778f[_0xc008('0x2e')],_0x10778f[_0xc008('0x26')]);_0x51fd86[_0xc008('0x31')]=_['intersection'](_0x10778f[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5c358b[_0xc008('0x26')][_0xc008('0x30')]));_0x51fd86[_0xc008('0x31')]=_0x51fd86[_0xc008('0x31')][_0xc008('0x4c')]?_0x51fd86[_0xc008('0x31')]:_0x10778f['model'];_0x51fd86[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5c358b[_0xc008('0x26')][_0xc008('0x50')]);_0x51fd86[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x5c358b[_0xc008('0x26')],_0x10778f[_0xc008('0x2d')]));if(_0x5c358b[_0xc008('0x26')][_0xc008('0x53')]){_0x51fd86[_0xc008('0x24')]=_[_0xc008('0x33')](_0x51fd86[_0xc008('0x24')],{'$or':_['map'](_0x51fd86[_0xc008('0x31')],function(_0x231318){var _0x3df369={};_0x3df369[_0x231318]={'$like':'%'+_0x5c358b[_0xc008('0x26')]['filter']+'%'};return _0x3df369;})});}_0x51fd86=_['merge']({},_0x51fd86,_0x5c358b[_0xc008('0x34')]);return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})['then'](function(_0x30e433){if(_0x30e433){_0x3f80f4=_0x30e433[_0xc008('0x4c')];if(!_0x5c358b[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x51fd86[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5c358b['query']['limit']);_0x51fd86[_0xc008('0x10')]=qs['offset'](_0x5c358b[_0xc008('0x26')][_0xc008('0x10')]);}return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})[_0xc008('0x15')](function(_0x2ea1db){if(_0x2ea1db){return _0x2ea1db?{'count':_0x3f80f4,'rows':_0x2ea1db}:null;}})[_0xc008('0x15')](respondWithResult(_0x49688b,null))[_0xc008('0x29')](handleError(_0x49688b,null));};exports[_0xc008('0x8b')]=function(_0x367873,_0x356a82){var _0x368c1f={};var _0x4fd0ff={};var _0x22772e;var _0x39fd43;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x367873[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x356a82,null))[_0xc008('0x15')](function(_0x506dc0){if(_0x506dc0){_0x22772e=_0x506dc0;_0x4fd0ff[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x88')]['rawAttributes']);_0x4fd0ff[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x367873[_0xc008('0x26')]);_0x4fd0ff[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],_0x4fd0ff['query']);_0x368c1f['attributes']=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x367873[_0xc008('0x26')][_0xc008('0x30')]));_0x368c1f['attributes']=_0x368c1f[_0xc008('0x31')]['length']?_0x368c1f[_0xc008('0x31')]:_0x4fd0ff[_0xc008('0x2e')];_0x368c1f['order']=qs[_0xc008('0x50')](_0x367873[_0xc008('0x26')][_0xc008('0x50')]);_0x368c1f[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x367873[_0xc008('0x26')],_0x4fd0ff[_0xc008('0x2d')]));if(_0x367873[_0xc008('0x26')][_0xc008('0x53')]){_0x368c1f['where']=_[_0xc008('0x33')](_0x368c1f[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x368c1f['attributes'],function(_0x43f96e){var _0x353cd5={};_0x353cd5[_0x43f96e]={'$like':'%'+_0x367873[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x353cd5;})});}_0x368c1f=_['merge']({},_0x368c1f,_0x367873[_0xc008('0x34')]);return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x9afcd6){if(_0x9afcd6){_0x39fd43=_0x9afcd6[_0xc008('0x4c')];if(!_0x367873['query'][_0xc008('0x4d')]('nolimit')){_0x368c1f['limit']=qs[_0xc008('0x4f')](_0x367873['query'][_0xc008('0x4f')]);_0x368c1f[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x367873[_0xc008('0x26')][_0xc008('0x10')]);}return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x5e9e9c){return _0x5e9e9c?{'count':_0x39fd43,'rows':_0x5e9e9c}:null;})[_0xc008('0x15')](respondWithResult(_0x356a82,null))[_0xc008('0x29')](handleError(_0x356a82,null));};exports[_0xc008('0x8c')]=function(_0x45fe90,_0xc046ce){var _0x46fc75={};var _0x59b5b9={};var _0x3c3ead;var _0x3c8a79;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x45fe90[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0xc046ce,null))[_0xc008('0x15')](function(_0x3aa9b4){if(_0x3aa9b4){_0x3c3ead=_0x3aa9b4;_0x59b5b9['model']=_['keys'](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x59b5b9['query']=_[_0xc008('0x2c')](_0x45fe90['query']);_0x59b5b9[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],_0x59b5b9[_0xc008('0x26')]);_0x46fc75[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],qs['fields'](_0x45fe90[_0xc008('0x26')]['fields']));_0x46fc75[_0xc008('0x31')]=_0x46fc75[_0xc008('0x31')][_0xc008('0x4c')]?_0x46fc75[_0xc008('0x31')]:_0x59b5b9[_0xc008('0x2e')];_0x46fc75[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x45fe90['query'][_0xc008('0x50')]);_0x46fc75[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x45fe90[_0xc008('0x26')],_0x59b5b9[_0xc008('0x2d')]));if(_0x45fe90[_0xc008('0x26')][_0xc008('0x53')]){_0x46fc75[_0xc008('0x24')]=_['merge'](_0x46fc75[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x46fc75[_0xc008('0x31')],function(_0x3e7c19){var _0x47d263={};_0x47d263[_0x3e7c19]={'$like':'%'+_0x45fe90['query']['filter']+'%'};return _0x47d263;})});}_0x46fc75=_[_0xc008('0x33')]({},_0x46fc75,_0x45fe90[_0xc008('0x34')]);return _0x3c3ead['getLists'](_0x46fc75);}})['then'](function(_0x5035ca){if(_0x5035ca){_0x3c8a79=_0x5035ca['length'];if(!_0x45fe90[_0xc008('0x26')][_0xc008('0x4d')]('nolimit')){_0x46fc75[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x45fe90[_0xc008('0x26')][_0xc008('0x4f')]);_0x46fc75[_0xc008('0x10')]=qs['offset'](_0x45fe90['query'][_0xc008('0x10')]);}return _0x3c3ead[_0xc008('0x8c')](_0x46fc75);}})[_0xc008('0x15')](function(_0x46f9ab){if(_0x46f9ab){return _0x46f9ab?{'count':_0x3c8a79,'rows':_0x46f9ab}:null;}})[_0xc008('0x15')](respondWithResult(_0xc046ce,null))[_0xc008('0x29')](handleError(_0xc046ce,null));};exports[_0xc008('0x8e')]=function(_0x5645bb,_0x2ebe07){var _0x3d6f0d=moment()[_0xc008('0x6e')](_0xc008('0x8f'));var _0x3be328,_0x3bcf94;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5645bb['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2ebe07,null))[_0xc008('0x15')](function(_0x11bcba){if(_0x11bcba){_0x3bcf94=_0x11bcba;return _0x11bcba[_0xc008('0x8e')](_0x5645bb[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5645bb[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0xefba5){var _0x202826;_0x3be328=_0xefba5||[];var _0x37e1f2=[];if(_0xefba5){for(var _0x5161f3=0x0;_0x5161f3<_0xefba5['length'];_0x5161f3+=0x1){var _0x43ec81=_0xefba5[_0x5161f3][_0xc008('0x3a')]({'plain':!![]});_0x3bcf94[_0xc008('0x90')]=_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]?_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]:_0x3bcf94['dialCheckDuplicateType'];switch(_0x3bcf94['dialCheckDuplicateType']){case'always':_0x202826=squel[_0xc008('0x91')]()['into']('cm_hopper')['fromQuery']([_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','scheduledAt')['field']('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),'VoiceQueueId')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')['field']('\x27'+_0x3d6f0d+'\x27','updatedAt')['from'](_0xc008('0x99'))['where'](_0xc008('0x9a'))[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81['CmListId']['toString']())[_0xc008('0x24')](_0xc008('0x9c'))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x9e'))[_0xc008('0x76')](_0xc008('0x9f'))[_0xc008('0x24')](_0xc008('0x7a'),_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')]()))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0xc008('0x76')](_0xc008('0xa0'))[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id']['toString']())))['toString']();break;case _0xc008('0xa1'):_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x93'),'ContactId',_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0x92'),_0xc008('0x92'))['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))[_0xc008('0x96')]('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81['CmListId'][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),_0xc008('0x52'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where'](_0xc008('0x9a'))['where']('ListId\x20=\x20?',_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL')[_0xc008('0x24')](_0xc008('0x9d'),squel['select']()[_0xc008('0x96')](_0xc008('0xa4'))['from']('cm_hopper')[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id'][_0xc008('0x98')]())))['toString']();break;default:_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),'scheduledAt','ContactId',_0xc008('0x95'),'VoiceQueueId',_0xc008('0x46'),'updatedAt'],squel['select']()['field'](_0xc008('0x92'),'phone')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))['field']('id','ContactId')[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))['field'](_0x5645bb['params']['id'][_0xc008('0x98')](),'VoiceQueueId')['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')['from']('cm_contacts')[_0xc008('0x24')]('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x37e1f2[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x202826));}return BPromise[_0xc008('0xa5')](_0x37e1f2);}})[_0xc008('0x15')](function(){var _0x262b79=[];var _0x15c5a2=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa6'))[_0xc008('0xa3')]([_0xc008('0xa7'),'phone',_0xc008('0xa8'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0xa9'))[_0xc008('0x96')](_0xc008('0xaa'))[_0xc008('0x96')](_0xc008('0xab'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')[_0xc008('0x76')](_0xc008('0xac'),'ci')[_0xc008('0xad')](_0xc008('0xa0'),'h',_0xc008('0xae'))[_0xc008('0x24')](_0xc008('0xaf'),_0x3d6f0d)['where'](_0xc008('0xb0'),'PHONE'))[_0xc008('0x98')]();_0x262b79[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x15c5a2));return BPromise[_0xc008('0xa5')](_0x262b79);})[_0xc008('0x15')](function(){return _0x3be328;})[_0xc008('0x15')](respondWithResult(_0x2ebe07,null))[_0xc008('0x29')](handleError(_0x2ebe07,null));};exports[_0xc008('0xb1')]=function(_0x471780,_0x4fae34){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x471780[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x4fae34,null))[_0xc008('0x15')](function(_0x1cc6a6){if(_0x1cc6a6){return _0x1cc6a6[_0xc008('0xb1')](_0x471780[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x471618){if(_0x471618){return db[_0xc008('0x4b')][_0xc008('0x1c')]({'where':{'ListId':_0x471780['query'][_0xc008('0x72')],'VoiceQueueId':_0x471780['params']['id']}})[_0xc008('0x15')](function(){return _0x471618;});}})[_0xc008('0x15')](respondWithStatusCode(_0x4fae34,null))[_0xc008('0x29')](handleError(_0x4fae34,null));};exports[_0xc008('0xb2')]=function(_0x370234,_0x3ff7d2){var _0x478794={};var _0x406de6={};var _0x34cbce;var _0x337acd;return db['VoiceQueue']['findOne']({'where':{'id':_0x370234['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3ff7d2,null))[_0xc008('0x15')](function(_0x2ccfcf){if(_0x2ccfcf){_0x34cbce=_0x2ccfcf;_0x406de6[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x406de6['query']=_[_0xc008('0x2c')](_0x370234[_0xc008('0x26')]);_0x406de6[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],_0x406de6['query']);_0x478794[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x370234[_0xc008('0x26')][_0xc008('0x30')]));_0x478794[_0xc008('0x31')]=_0x478794[_0xc008('0x31')][_0xc008('0x4c')]?_0x478794[_0xc008('0x31')]:_0x406de6[_0xc008('0x2e')];_0x478794['order']=qs[_0xc008('0x50')](_0x370234['query'][_0xc008('0x50')]);_0x478794[_0xc008('0x24')]=qs[_0xc008('0x2d')](_['pick'](_0x370234[_0xc008('0x26')],_0x406de6['filters']));if(_0x370234[_0xc008('0x26')][_0xc008('0x53')]){_0x478794[_0xc008('0x24')]=_[_0xc008('0x33')](_0x478794[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x478794[_0xc008('0x31')],function(_0x89601c){var _0x22bb2a={};_0x22bb2a[_0x89601c]={'$like':'%'+_0x370234[_0xc008('0x26')]['filter']+'%'};return _0x22bb2a;})});}_0x478794=_[_0xc008('0x33')]({},_0x478794,_0x370234['options']);return _0x34cbce['getBlackLists'](_0x478794);}})[_0xc008('0x15')](function(_0x55ad1f){if(_0x55ad1f){_0x337acd=_0x55ad1f[_0xc008('0x4c')];if(!_0x370234[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x478794['limit']=qs[_0xc008('0x4f')](_0x370234[_0xc008('0x26')][_0xc008('0x4f')]);_0x478794[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x370234['query'][_0xc008('0x10')]);}return _0x34cbce[_0xc008('0xb2')](_0x478794);}})['then'](function(_0x247e3a){if(_0x247e3a){return _0x247e3a?{'count':_0x337acd,'rows':_0x247e3a}:null;}})[_0xc008('0x15')](respondWithResult(_0x3ff7d2,null))[_0xc008('0x29')](handleError(_0x3ff7d2,null));};exports[_0xc008('0xb3')]=function(_0x252c44,_0x3b46db){var _0x482efd;return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x252c44[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3b46db,null))[_0xc008('0x15')](function(_0x2f217e){if(_0x2f217e){return _0x2f217e[_0xc008('0xb3')](_0x252c44[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x252c44['body'],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0x298783){var _0xe349bd;_0x482efd=_0x298783||[];var _0x50db48=[];if(_0x298783){for(var _0x384f2f=0x0;_0x384f2f<_0x298783[_0xc008('0x4c')];_0x384f2f+=0x1){var _0x367581=_0x298783[_0x384f2f][_0xc008('0x3a')]({'plain':!![]});_0xe349bd=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xb4'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel['select']()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('id',_0xc008('0x94'))['field'](_0x367581[_0xc008('0x97')][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x252c44[_0xc008('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xc008('0x46'))['field']('NOW()',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where']('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x367581[_0xc008('0x97')][_0xc008('0x98')]())['where'](_0xc008('0x9c')))[_0xc008('0x98')]();_0x50db48['push'](db[_0xc008('0x65')]['query'](_0xe349bd));}return BPromise['all'](_0x50db48);}})[_0xc008('0x15')](function(){return _0x482efd;})[_0xc008('0x15')](respondWithResult(_0x3b46db,null))['catch'](handleError(_0x3b46db,null));};exports['removeBlackLists']=function(_0x1e3098,_0x9b997d){return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1e3098['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x9b997d,null))[_0xc008('0x15')](function(_0x1422ab){if(_0x1422ab){return _0x1422ab[_0xc008('0xb5')](_0x1e3098[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x41a8a6){if(_0x41a8a6){return db['CmHopperBlack'][_0xc008('0x1c')]({'where':{'ListId':_0x1e3098['query'][_0xc008('0x72')],'VoiceQueueId':_0x1e3098['params']['id']}})['then'](function(){return _0x41a8a6;});}})[_0xc008('0x15')](respondWithStatusCode(_0x9b997d,null))[_0xc008('0x29')](handleError(_0x9b997d,null));}; \ No newline at end of file +var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x4e612e,_0x1e9da3){var _0x3e1f99=function(_0x313b37){while(--_0x313b37){_0x4e612e['push'](_0x4e612e['shift']());}};_0x3e1f99(++_0x1e9da3);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index e6ef7e8..b8359f9 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 _0x0d21=['exports','events','../../mysqldb','VoiceQueue','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0d21,0x1c3));var _0x10d2=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x0d21[_0x4c7fb5];return _0x2e10ac;};'use strict';var EventEmitter=require(_0x10d2('0x0'));var VoiceQueue=require(_0x10d2('0x1'))['db'][_0x10d2('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x10d2('0x3'),'afterUpdate':_0x10d2('0x4'),'afterDestroy':_0x10d2('0x5')};function emitEvent(_0x241451){return function(_0x10384f,_0x3084c9,_0x257d74){VoiceQueueEvents[_0x10d2('0x6')](_0x241451+':'+_0x10384f['id'],_0x10384f);VoiceQueueEvents['emit'](_0x241451,_0x10384f);_0x257d74(null);};}for(var e in events){if(events[_0x10d2('0x7')](e)){var event=events[e];VoiceQueue[_0x10d2('0x8')](e,emitEvent(event));}}module[_0x10d2('0x9')]=VoiceQueueEvents; \ No newline at end of file +var _0x85ed=['exports','events','VoiceQueue','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3a5c68,_0x2e2c7b){var _0x127add=function(_0x3adedd){while(--_0x3adedd){_0x3a5c68['push'](_0x3a5c68['shift']());}};_0x127add(++_0x2e2c7b);}(_0x85ed,0xb9));var _0xd85e=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0x85ed[_0x45783c];return _0x1161da;};'use strict';var EventEmitter=require(_0xd85e('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xd85e('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd85e('0x2')](0x0);var events={'afterCreate':_0xd85e('0x3'),'afterUpdate':_0xd85e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1131a2){return function(_0x1d25d2,_0xc0e2e0,_0x438982){VoiceQueueEvents['emit'](_0x1131a2+':'+_0x1d25d2['id'],_0x1d25d2);VoiceQueueEvents[_0xd85e('0x5')](_0x1131a2,_0x1d25d2);_0x438982(null);};}for(var e in events){if(events[_0xd85e('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd85e('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 1eb1646..d169156 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x52456a,_0x2c7184){var _0x1bb66b=function(_0x13489c){while(--_0x13489c){_0x52456a['push'](_0x52456a['shift']());}};_0x1bb66b(++_0x2c7184);}(_0xedd9,0xfc));var _0x9edd=function(_0x17b0d6,_0x444f52){_0x17b0d6=_0x17b0d6-0x0;var _0x2b6b40=_0xedd9[_0x17b0d6];return _0x2b6b40;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','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(_0x184b41,_0x4a3dc3){var _0x1d717a=function(_0xb8de7){while(--_0xb8de7){_0x184b41['push'](_0x184b41['shift']());}};_0x1d717a(++_0x4a3dc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'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 ed2c447..460d2cf 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 _0x5eaa=['VoiceQueue','findAll','options','raw','where','include','map','model','attributes','ShowVoiceQueue','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetVoiceQueue'];(function(_0x23c848,_0x562e30){var _0x1eb23d=function(_0x1f2757){while(--_0x1f2757){_0x23c848['push'](_0x23c848['shift']());}};_0x1eb23d(++_0x562e30);}(_0x5eaa,0x1df));var _0xa5ea=function(_0x4897ca,_0x38b6e5){_0x4897ca=_0x4897ca-0x0;var _0x5e156e=_0x5eaa[_0x4897ca];return _0x5e156e;};'use strict';var _=require('lodash');var util=require(_0xa5ea('0x0'));var moment=require(_0xa5ea('0x1'));var BPromise=require(_0xa5ea('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5ea('0x3'))['db'];var utils=require(_0xa5ea('0x4'));var logger=require(_0xa5ea('0x5'))(_0xa5ea('0x6'));var config=require(_0xa5ea('0x7'));var jayson=require(_0xa5ea('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xa5ea('0x9')]=_[_0xa5ea('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa5ea('0x9')]));require(_0xa5ea('0xb'))['register'](socket);function respondWithRpcPromise(_0x4c7f40,_0x3586c2,_0x24a676){return new BPromise(function(_0x1aa556,_0x269616){return client[_0xa5ea('0xc')](_0x4c7f40,_0x24a676)[_0xa5ea('0xd')](function(_0x22a746){logger[_0xa5ea('0xe')](_0xa5ea('0xf'),_0x3586c2,_0xa5ea('0x10'));logger[_0xa5ea('0x11')](_0xa5ea('0x12'),_0x3586c2,_0xa5ea('0x10'),JSON[_0xa5ea('0x13')](_0x22a746));if(_0x22a746[_0xa5ea('0x14')]){if(_0x22a746[_0xa5ea('0x14')]['code']===0x1f4){logger[_0xa5ea('0x14')](_0xa5ea('0xf'),_0x3586c2,_0x22a746['error'][_0xa5ea('0x15')]);return _0x269616(_0x22a746[_0xa5ea('0x14')][_0xa5ea('0x15')]);}logger['error'](_0xa5ea('0xf'),_0x3586c2,_0x22a746['error'][_0xa5ea('0x15')]);return _0x1aa556(_0x22a746['error'][_0xa5ea('0x15')]);}else{logger[_0xa5ea('0xe')](_0xa5ea('0xf'),_0x3586c2,_0xa5ea('0x10'));_0x1aa556(_0x22a746[_0xa5ea('0x16')][_0xa5ea('0x15')]);}})[_0xa5ea('0x17')](function(_0xc0a44e){logger[_0xa5ea('0x14')](_0xa5ea('0xf'),_0x3586c2,_0xc0a44e);_0x269616(_0xc0a44e);});});}exports[_0xa5ea('0x18')]=function(_0x2049f5){var _0x5f02fd=this;return new Promise(function(_0x422a75,_0x3604b5){return db[_0xa5ea('0x19')][_0xa5ea('0x1a')]({'raw':_0x2049f5[_0xa5ea('0x1b')]?_0x2049f5[_0xa5ea('0x1b')][_0xa5ea('0x1c')]===undefined?!![]:![]:!![],'where':_0x2049f5[_0xa5ea('0x1b')]?_0x2049f5['options'][_0xa5ea('0x1d')]||null:null,'attributes':_0x2049f5[_0xa5ea('0x1b')]?_0x2049f5[_0xa5ea('0x1b')]['attributes']||null:null,'limit':_0x2049f5[_0xa5ea('0x1b')]?_0x2049f5['options']['limit']||null:null,'include':_0x2049f5['options']?_0x2049f5[_0xa5ea('0x1b')][_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x2049f5['options']['include'],function(_0x479ce4){return{'model':db[_0x479ce4[_0xa5ea('0x20')]],'as':_0x479ce4['as'],'attributes':_0x479ce4[_0xa5ea('0x21')],'include':_0x479ce4[_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x479ce4[_0xa5ea('0x1e')],function(_0x347d9a){return{'model':db[_0x347d9a[_0xa5ea('0x20')]],'as':_0x347d9a['as'],'attributes':_0x347d9a[_0xa5ea('0x21')],'include':_0x347d9a[_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x347d9a[_0xa5ea('0x1e')],function(_0x521b9f){return{'model':db[_0x521b9f[_0xa5ea('0x20')]],'as':_0x521b9f['as'],'attributes':_0x521b9f[_0xa5ea('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa5ea('0xd')](function(_0x1fb021){logger[_0xa5ea('0xe')](_0xa5ea('0x18'),_0x2049f5);logger[_0xa5ea('0x11')](_0xa5ea('0x18'),_0x2049f5,JSON['stringify'](_0x1fb021));_0x422a75(_0x1fb021);})[_0xa5ea('0x17')](function(_0x5350a5){logger['error'](_0xa5ea('0x18'),_0x5350a5['message'],_0x2049f5);_0x3604b5(_0x5f02fd['error'](0x1f4,_0x5350a5[_0xa5ea('0x15')]));});});};exports[_0xa5ea('0x22')]=function(_0x3c4146){var _0x46779d=this;return new Promise(function(_0x411c21,_0x24423d){return db[_0xa5ea('0x19')][_0xa5ea('0x23')]({'raw':_0x3c4146['options']?_0x3c4146[_0xa5ea('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x3c4146['options']?_0x3c4146['options']['where']||null:null,'attributes':_0x3c4146['options']?_0x3c4146[_0xa5ea('0x1b')][_0xa5ea('0x21')]||null:null,'include':_0x3c4146[_0xa5ea('0x1b')]?_0x3c4146['options'][_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x3c4146[_0xa5ea('0x1b')][_0xa5ea('0x1e')],function(_0x2dc84e){return{'model':db[_0x2dc84e[_0xa5ea('0x20')]],'as':_0x2dc84e['as'],'attributes':_0x2dc84e['attributes'],'include':_0x2dc84e[_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x2dc84e[_0xa5ea('0x1e')],function(_0x2cd965){return{'model':db[_0x2cd965[_0xa5ea('0x20')]],'as':_0x2cd965['as'],'attributes':_0x2cd965[_0xa5ea('0x21')],'include':_0x2cd965[_0xa5ea('0x1e')]?_[_0xa5ea('0x1f')](_0x2cd965[_0xa5ea('0x1e')],function(_0x348b72){return{'model':db[_0x348b72[_0xa5ea('0x20')]],'as':_0x348b72['as'],'attributes':_0x348b72['attributes']};}):[]};}):[]};}):[]:[]})[_0xa5ea('0xd')](function(_0x2302a8){logger[_0xa5ea('0xe')]('ShowVoiceQueue',_0x3c4146);logger[_0xa5ea('0x11')](_0xa5ea('0x22'),_0x3c4146,JSON[_0xa5ea('0x13')](_0x2302a8));_0x411c21(_0x2302a8);})[_0xa5ea('0x17')](function(_0x1f36ae){logger['error']('ShowVoiceQueue',_0x1f36ae[_0xa5ea('0x15')],_0x3c4146);_0x24423d(_0x46779d['error'](0x1f4,_0x1f36ae[_0xa5ea('0x15')]));});});}; \ No newline at end of file +var _0xafd9=['http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetVoiceQueue','findAll','options','where','attributes','include','map','model','catch','ShowVoiceQueue','VoiceQueue','find','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x238a15,_0x3bc459){var _0x4d5d19=function(_0x50fbc7){while(--_0x50fbc7){_0x238a15['push'](_0x238a15['shift']());}};_0x4d5d19(++_0x3bc459);}(_0xafd9,0xb9));var _0x9afd=function(_0x5c368b,_0x427a8d){_0x5c368b=_0x5c368b-0x0;var _0x2ce687=_0xafd9[_0x5c368b];return _0x2ce687;};'use strict';var _=require(_0x9afd('0x0'));var util=require(_0x9afd('0x1'));var moment=require(_0x9afd('0x2'));var BPromise=require('bluebird');var rs=require(_0x9afd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9afd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9afd('0x5'))(_0x9afd('0x6'));var config=require(_0x9afd('0x7'));var jayson=require(_0x9afd('0x8'));var client=jayson[_0x9afd('0x9')][_0x9afd('0xa')]({'port':0x232a});config[_0x9afd('0xb')]=_[_0x9afd('0xc')](config[_0x9afd('0xb')],{'host':_0x9afd('0xd'),'port':0x18eb});var socket=require(_0x9afd('0xe'))(new Redis(config[_0x9afd('0xb')]));require(_0x9afd('0xf'))['register'](socket);function respondWithRpcPromise(_0x1367af,_0x3d0496,_0x19e0ff){return new BPromise(function(_0x4f690a,_0xbfbfc1){return client[_0x9afd('0x10')](_0x1367af,_0x19e0ff)[_0x9afd('0x11')](function(_0xdf621c){logger['info'](_0x9afd('0x12'),_0x3d0496,_0x9afd('0x13'));logger[_0x9afd('0x14')](_0x9afd('0x15'),_0x3d0496,_0x9afd('0x13'),JSON[_0x9afd('0x16')](_0xdf621c));if(_0xdf621c[_0x9afd('0x17')]){if(_0xdf621c[_0x9afd('0x17')][_0x9afd('0x18')]===0x1f4){logger[_0x9afd('0x17')](_0x9afd('0x12'),_0x3d0496,_0xdf621c[_0x9afd('0x17')][_0x9afd('0x19')]);return _0xbfbfc1(_0xdf621c[_0x9afd('0x17')][_0x9afd('0x19')]);}logger[_0x9afd('0x17')](_0x9afd('0x12'),_0x3d0496,_0xdf621c[_0x9afd('0x17')][_0x9afd('0x19')]);return _0x4f690a(_0xdf621c['error'][_0x9afd('0x19')]);}else{logger[_0x9afd('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x3d0496,'request\x20sent');_0x4f690a(_0xdf621c['result']['message']);}})['catch'](function(_0x3a96f9){logger['error'](_0x9afd('0x12'),_0x3d0496,_0x3a96f9);_0xbfbfc1(_0x3a96f9);});});}exports[_0x9afd('0x1b')]=function(_0x4fa266){var _0x263ad6=this;return new Promise(function(_0x5aab9b,_0x441b55){return db['VoiceQueue'][_0x9afd('0x1c')]({'raw':_0x4fa266[_0x9afd('0x1d')]?_0x4fa266[_0x9afd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x4fa266['options']?_0x4fa266['options'][_0x9afd('0x1e')]||null:null,'attributes':_0x4fa266[_0x9afd('0x1d')]?_0x4fa266[_0x9afd('0x1d')][_0x9afd('0x1f')]||null:null,'limit':_0x4fa266['options']?_0x4fa266[_0x9afd('0x1d')]['limit']||null:null,'include':_0x4fa266[_0x9afd('0x1d')]?_0x4fa266[_0x9afd('0x1d')][_0x9afd('0x20')]?_[_0x9afd('0x21')](_0x4fa266[_0x9afd('0x1d')][_0x9afd('0x20')],function(_0x1e806c){return{'model':db[_0x1e806c[_0x9afd('0x22')]],'as':_0x1e806c['as'],'attributes':_0x1e806c[_0x9afd('0x1f')],'include':_0x1e806c[_0x9afd('0x20')]?_[_0x9afd('0x21')](_0x1e806c[_0x9afd('0x20')],function(_0x356c30){return{'model':db[_0x356c30[_0x9afd('0x22')]],'as':_0x356c30['as'],'attributes':_0x356c30[_0x9afd('0x1f')],'include':_0x356c30['include']?_[_0x9afd('0x21')](_0x356c30[_0x9afd('0x20')],function(_0x3fcd03){return{'model':db[_0x3fcd03[_0x9afd('0x22')]],'as':_0x3fcd03['as'],'attributes':_0x3fcd03['attributes']};}):[]};}):[]};}):[]:[]})[_0x9afd('0x11')](function(_0xcdfef4){logger[_0x9afd('0x1a')]('GetVoiceQueue',_0x4fa266);logger['debug'](_0x9afd('0x1b'),_0x4fa266,JSON[_0x9afd('0x16')](_0xcdfef4));_0x5aab9b(_0xcdfef4);})[_0x9afd('0x23')](function(_0xb4aee6){logger['error'](_0x9afd('0x1b'),_0xb4aee6['message'],_0x4fa266);_0x441b55(_0x263ad6[_0x9afd('0x17')](0x1f4,_0xb4aee6[_0x9afd('0x19')]));});});};exports[_0x9afd('0x24')]=function(_0x11bbe6){var _0x4ceab7=this;return new Promise(function(_0x169e3d,_0x36c526){return db[_0x9afd('0x25')][_0x9afd('0x26')]({'raw':_0x11bbe6[_0x9afd('0x1d')]?_0x11bbe6[_0x9afd('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x11bbe6[_0x9afd('0x1d')]?_0x11bbe6[_0x9afd('0x1d')][_0x9afd('0x1e')]||null:null,'attributes':_0x11bbe6['options']?_0x11bbe6[_0x9afd('0x1d')][_0x9afd('0x1f')]||null:null,'include':_0x11bbe6[_0x9afd('0x1d')]?_0x11bbe6[_0x9afd('0x1d')][_0x9afd('0x20')]?_[_0x9afd('0x21')](_0x11bbe6[_0x9afd('0x1d')][_0x9afd('0x20')],function(_0xceb815){return{'model':db[_0xceb815[_0x9afd('0x22')]],'as':_0xceb815['as'],'attributes':_0xceb815[_0x9afd('0x1f')],'include':_0xceb815[_0x9afd('0x20')]?_[_0x9afd('0x21')](_0xceb815['include'],function(_0x49c996){return{'model':db[_0x49c996['model']],'as':_0x49c996['as'],'attributes':_0x49c996[_0x9afd('0x1f')],'include':_0x49c996[_0x9afd('0x20')]?_[_0x9afd('0x21')](_0x49c996[_0x9afd('0x20')],function(_0x2272dc){return{'model':db[_0x2272dc[_0x9afd('0x22')]],'as':_0x2272dc['as'],'attributes':_0x2272dc[_0x9afd('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x376637){logger[_0x9afd('0x1a')](_0x9afd('0x24'),_0x11bbe6);logger[_0x9afd('0x14')](_0x9afd('0x24'),_0x11bbe6,JSON[_0x9afd('0x16')](_0x376637));_0x169e3d(_0x376637);})[_0x9afd('0x23')](function(_0x2982e1){logger[_0x9afd('0x17')](_0x9afd('0x24'),_0x2982e1[_0x9afd('0x19')],_0x11bbe6);_0x36c526(_0x4ceab7[_0x9afd('0x17')](0x1f4,_0x2982e1[_0x9afd('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c63459e..6c22104 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 _0xb606=['register','voiceQueue:','./voiceQueue.events','save','remove','update'];(function(_0x3da9b1,_0x7db7b8){var _0x4c7061=function(_0x23da67){while(--_0x23da67){_0x3da9b1['push'](_0x3da9b1['shift']());}};_0x4c7061(++_0x7db7b8);}(_0xb606,0x98));var _0x6b60=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0xb606[_0x1627ae];return _0x34b38f;};'use strict';var VoiceQueueEvents=require(_0x6b60('0x0'));var events=[_0x6b60('0x1'),_0x6b60('0x2'),_0x6b60('0x3')];function createListener(_0x32b03d,_0x3b6da7){return function(_0x4edd4e){_0x3b6da7['emit'](_0x32b03d,_0x4edd4e);};}function removeListener(_0x23180e,_0xe668aa){return function(){VoiceQueueEvents['removeListener'](_0x23180e,_0xe668aa);};}exports[_0x6b60('0x4')]=function(_0x1ca33d){for(var _0x10cf30=0x0,_0x461d51=events['length'];_0x10cf30<_0x461d51;_0x10cf30++){var _0x50cc27=events[_0x10cf30];var _0x398dc4=createListener(_0x6b60('0x5')+_0x50cc27,_0x1ca33d);VoiceQueueEvents['on'](_0x50cc27,_0x398dc4);}}; \ No newline at end of file +var _0x2cbd=['removeListener','length','voiceQueue:','save','remove','update','emit'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x2cbd,0xc0));var _0xd2cb=function(_0x3c5e54,_0x2b991b){_0x3c5e54=_0x3c5e54-0x0;var _0x3ae1f3=_0x2cbd[_0x3c5e54];return _0x3ae1f3;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xd2cb('0x0'),_0xd2cb('0x1'),_0xd2cb('0x2')];function createListener(_0x376bcb,_0x4dc520){return function(_0xfa82f8){_0x4dc520[_0xd2cb('0x3')](_0x376bcb,_0xfa82f8);};}function removeListener(_0x7fbf95,_0x20178a){return function(){VoiceQueueEvents[_0xd2cb('0x4')](_0x7fbf95,_0x20178a);};}exports['register']=function(_0x25ee69){for(var _0x52048c=0x0,_0x20fdc1=events[_0xd2cb('0x5')];_0x52048c<_0x20fdc1;_0x52048c++){var _0x55070e=events[_0x52048c];var _0xa21de6=createListener(_0xd2cb('0x6')+_0x55070e,_0x25ee69);VoiceQueueEvents['on'](_0x55070e,_0xa21de6);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 08b5c05..deb42ce 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 _0xc48c=['../../config/environment','get','isAuthenticated','index','/describe','getVoiceQueuesReport','/:id','show','create','update','delete','destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc48c,0x1d4));var _0xcc48=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xc48c[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require(_0xcc48('0x0'));var path=require(_0xcc48('0x1'));var timeout=require(_0xcc48('0x2'));var express=require(_0xcc48('0x3'));var router=express['Router']();var fs_extra=require(_0xcc48('0x4'));var auth=require(_0xcc48('0x5'));var interaction=require(_0xcc48('0x6'));var config=require(_0xcc48('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xcc48('0x8')]('/',auth[_0xcc48('0x9')](),controller[_0xcc48('0xa')]);router[_0xcc48('0x8')](_0xcc48('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/index',auth[_0xcc48('0x9')](),controller[_0xcc48('0xc')]);router[_0xcc48('0x8')](_0xcc48('0xd'),auth[_0xcc48('0x9')](),controller[_0xcc48('0xe')]);router['post']('/',auth[_0xcc48('0x9')](),controller[_0xcc48('0xf')]);router['put'](_0xcc48('0xd'),auth['isAuthenticated'](),controller[_0xcc48('0x10')]);router[_0xcc48('0x11')]('/:id',auth[_0xcc48('0x9')](),controller[_0xcc48('0x12')]);module['exports']=router; \ No newline at end of file +var _0x052f=['post','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceQueueReport.controller','get','index','isAuthenticated','describe','/index','getVoiceQueuesReport','/:id','show'];(function(_0x274e0e,_0x3aace4){var _0x4ca356=function(_0x59e7a3){while(--_0x59e7a3){_0x274e0e['push'](_0x274e0e['shift']());}};_0x4ca356(++_0x3aace4);}(_0x052f,0x17c));var _0xf052=function(_0x57d71b,_0x2fd938){_0x57d71b=_0x57d71b-0x0;var _0x613e79=_0x052f[_0x57d71b];return _0x613e79;};'use strict';var multer=require('multer');var util=require(_0xf052('0x0'));var path=require(_0xf052('0x1'));var timeout=require(_0xf052('0x2'));var express=require(_0xf052('0x3'));var router=express[_0xf052('0x4')]();var fs_extra=require(_0xf052('0x5'));var auth=require(_0xf052('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf052('0x7'));router[_0xf052('0x8')]('/',auth['isAuthenticated'](),controller[_0xf052('0x9')]);router[_0xf052('0x8')]('/describe',auth[_0xf052('0xa')](),controller[_0xf052('0xb')]);router[_0xf052('0x8')](_0xf052('0xc'),auth['isAuthenticated'](),controller[_0xf052('0xd')]);router[_0xf052('0x8')](_0xf052('0xe'),auth[_0xf052('0xa')](),controller[_0xf052('0xf')]);router[_0xf052('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf052('0x11')](_0xf052('0xe'),auth[_0xf052('0xa')](),controller[_0xf052('0x12')]);router[_0xf052('0x13')]('/:id',auth[_0xf052('0xa')](),controller[_0xf052('0x14')]);module[_0xf052('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 1cea97f..0f9fd3d 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 _0x15d8=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x2bd839,_0x324135){var _0x31a8a9=function(_0x40b957){while(--_0x40b957){_0x2bd839['push'](_0x2bd839['shift']());}};_0x31a8a9(++_0x324135);}(_0x15d8,0x8a));var _0x815d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x15d8[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x815d('0x0'));var moment=require(_0x815d('0x1'));module[_0x815d('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x815d('0x3')]},'calleridname':{'type':Sequelize[_0x815d('0x3')]},'queue':{'type':Sequelize[_0x815d('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x815d('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x4bcd35){var _0x226f9f=moment(_0x4bcd35);var _0x542e63=moment(this[_0x815d('0x5')](_0x815d('0x6')))[_0x815d('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x35b006=_0x226f9f['diff'](_0x542e63,_0x815d('0x8'));this[_0x815d('0x9')]('queuecallerleaveAt',_0x4bcd35);this[_0x815d('0x9')](_0x815d('0xa'),_0x35b006||null);}},'position':{'type':Sequelize[_0x815d('0xb')]},'count':{'type':Sequelize[_0x815d('0xb')]},'queuecallerabandon':{'type':Sequelize[_0x815d('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x815d('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x815d('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x815d('0x4')]},'queuecallerexit':{'type':Sequelize[_0x815d('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x815d('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x815d('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x815d('0xb')]},'channel':{'type':Sequelize[_0x815d('0x3')]},'connectedlinenum':{'type':Sequelize[_0x815d('0x3')]},'connectedlinename':{'type':Sequelize[_0x815d('0x3')]},'accountcode':{'type':Sequelize[_0x815d('0x3')]},'context':{'type':Sequelize[_0x815d('0x3')]},'exten':{'type':Sequelize[_0x815d('0x3')]},'priority':{'type':Sequelize[_0x815d('0x3')]},'holdtime':{'type':Sequelize[_0x815d('0xb')]},'mohtime':{'type':Sequelize[_0x815d('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x815d('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x815d('0x3')]},'transfer':{'type':Sequelize[_0x815d('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x815d('0x3')],'comment':_0x815d('0xd')},'transferexten':{'type':Sequelize[_0x815d('0x3')]},'transferuniqueid':{'type':Sequelize[_0x815d('0x3')]},'disposition':{'type':Sequelize[_0x815d('0x3')]},'secondDisposition':{'type':Sequelize[_0x815d('0x3')]},'thirdDisposition':{'type':Sequelize[_0x815d('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x815d('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x815d('0x3')]}}; \ No newline at end of file +var _0x303c=['DATE','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','sequelize','exports','STRING'];(function(_0x12f03e,_0x320adb){var _0x5690bb=function(_0x510d61){while(--_0x510d61){_0x12f03e['push'](_0x12f03e['shift']());}};_0x5690bb(++_0x320adb);}(_0x303c,0x15c));var _0xc303=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x303c[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xc303('0x0'));var moment=require('moment');module[_0xc303('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc303('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc303('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc303('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc303('0x3')],'set':function(_0x1639a0){var _0x373574=moment(_0x1639a0);var _0x19fbb1=moment(this['getDataValue'](_0xc303('0x4')))[_0xc303('0x5')](_0xc303('0x6'));var _0x3292cd=_0x373574['diff'](_0x19fbb1,'seconds');this[_0xc303('0x7')](_0xc303('0x8'),_0x1639a0);this[_0xc303('0x7')](_0xc303('0x9'),_0x3292cd||null);}},'position':{'type':Sequelize[_0xc303('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc303('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xc303('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc303('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xc303('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0xc303('0x2')],'comment':_0xc303('0xc')},'originalposition':{'type':Sequelize[_0xc303('0xa')]},'channel':{'type':Sequelize[_0xc303('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc303('0x2')]},'connectedlinename':{'type':Sequelize[_0xc303('0x2')]},'accountcode':{'type':Sequelize[_0xc303('0x2')]},'context':{'type':Sequelize[_0xc303('0x2')]},'exten':{'type':Sequelize[_0xc303('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xc303('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc303('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xc303('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xc303('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xc303('0x2')]},'secondDisposition':{'type':Sequelize[_0xc303('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc303('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc303('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 26f8153..6ae963c 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 _0x961b=['model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','VoiceQueueReport','fieldName','type','key'];(function(_0x13f20b,_0x85d184){var _0x4f1fb4=function(_0x18c8e8){while(--_0x18c8e8){_0x13f20b['push'](_0x13f20b['shift']());}};_0x4f1fb4(++_0x85d184);}(_0x961b,0x1c4));var _0xb961=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x961b[_0xd1d19a];return _0x52a79d;};'use strict';var emlformat=require(_0xb961('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb961('0x1'));var jsonpatch=require(_0xb961('0x2'));var rp=require(_0xb961('0x3'));var moment=require(_0xb961('0x4'));var BPromise=require(_0xb961('0x5'));var Mustache=require(_0xb961('0x6'));var util=require(_0xb961('0x7'));var path=require(_0xb961('0x8'));var sox=require(_0xb961('0x9'));var csv=require(_0xb961('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb961('0xb'));var _=require('lodash');var squel=require(_0xb961('0xc'));var crypto=require(_0xb961('0xd'));var jsforce=require(_0xb961('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb961('0xa'));var querystring=require(_0xb961('0xf'));var Papa=require(_0xb961('0x10'));var Redis=require('ioredis');var authService=require(_0xb961('0x11'));var qs=require(_0xb961('0x12'));var as=require(_0xb961('0x13'));var hardwareService=require(_0xb961('0x14'));var logger=require(_0xb961('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb961('0x16'))['db'];config[_0xb961('0x17')]=_[_0xb961('0x18')](config[_0xb961('0x17')],{'host':_0xb961('0x19'),'port':0x18eb});var socket=require(_0xb961('0x1a'))(new Redis(config[_0xb961('0x17')]));require(_0xb961('0x1b'))['register'](socket);function respondWithStatusCode(_0xefe3b9,_0x1023ef){_0x1023ef=_0x1023ef||0xcc;return function(_0x3e3ea9){if(_0x3e3ea9){return _0xefe3b9[_0xb961('0x1c')](_0x1023ef);}return _0xefe3b9[_0xb961('0x1d')](_0x1023ef)[_0xb961('0x1e')]();};}function respondWithResult(_0x2ccba6,_0x548aed){_0x548aed=_0x548aed||0xc8;return function(_0x4231dd){if(_0x4231dd){return _0x2ccba6[_0xb961('0x1d')](_0x548aed)[_0xb961('0x1f')](_0x4231dd);}};}function respondWithFilteredResult(_0x3c719e,_0x25aeb2){return function(_0x2d355a){if(_0x2d355a){var _0x56cc2a=typeof _0x25aeb2['offset']==='undefined'&&typeof _0x25aeb2[_0xb961('0x20')]===_0xb961('0x21');var _0x1b7cf9=_0x2d355a[_0xb961('0x22')];var _0x2fcb63=_0x56cc2a?0x0:_0x25aeb2[_0xb961('0x23')];var _0x29fc9a=_0x56cc2a?_0x2d355a[_0xb961('0x22')]:_0x25aeb2[_0xb961('0x23')]+_0x25aeb2[_0xb961('0x20')];var _0x185f42;if(_0x29fc9a>=_0x1b7cf9){_0x29fc9a=_0x1b7cf9;_0x185f42=0xc8;}else{_0x185f42=0xce;}_0x3c719e[_0xb961('0x1d')](_0x185f42);return _0x3c719e[_0xb961('0x24')](_0xb961('0x25'),_0x2fcb63+'-'+_0x29fc9a+'/'+_0x1b7cf9)[_0xb961('0x1f')](_0x2d355a);}return null;};}function patchUpdates(_0x24bf8a){return function(_0x4d8538){try{jsonpatch[_0xb961('0x26')](_0x4d8538,_0x24bf8a,!![]);}catch(_0x367c0a){return BPromise[_0xb961('0x27')](_0x367c0a);}return _0x4d8538[_0xb961('0x28')]();};}function saveUpdates(_0x293663,_0xfe9bef){return function(_0x24ad9f){if(_0x24ad9f){return _0x24ad9f[_0xb961('0x29')](_0x293663)[_0xb961('0x2a')](function(_0x7e1edb){return _0x7e1edb;});}return null;};}function removeEntity(_0x23fcc9,_0x1892c1){return function(_0x12856e){if(_0x12856e){return _0x12856e['destroy']()[_0xb961('0x2a')](function(){_0x23fcc9[_0xb961('0x1d')](0xcc)[_0xb961('0x1e')]();});}};}function handleEntityNotFound(_0x31f37b,_0x2d7f5e){return function(_0x5a9b98){if(!_0x5a9b98){_0x31f37b[_0xb961('0x1c')](0x194);}return _0x5a9b98;};}function handleError(_0x5226b7,_0x205af1){_0x205af1=_0x205af1||0x1f4;return function(_0x53ea2){logger[_0xb961('0x2b')](_0x53ea2[_0xb961('0x2c')]);if(_0x53ea2['name']){delete _0x53ea2[_0xb961('0x2d')];}_0x5226b7[_0xb961('0x1d')](_0x205af1)[_0xb961('0x2e')](_0x53ea2);};}exports[_0xb961('0x2f')]=function(_0x38e099,_0x58d414){var _0x37c988={},_0x571618={},_0x8cd966={'count':0x0,'rows':[]};var _0x29bd2e=_['map'](db[_0xb961('0x30')]['rawAttributes'],function(_0x4b4a8e){return{'name':_0x4b4a8e[_0xb961('0x31')],'type':_0x4b4a8e[_0xb961('0x32')][_0xb961('0x33')]};});_0x571618[_0xb961('0x34')]=_[_0xb961('0x35')](_0x29bd2e,_0xb961('0x2d'));_0x571618[_0xb961('0x36')]=_['keys'](_0x38e099[_0xb961('0x36')]);_0x571618[_0xb961('0x37')]=_['intersection'](_0x571618['model'],_0x571618[_0xb961('0x36')]);_0x37c988[_0xb961('0x38')]=_[_0xb961('0x39')](_0x571618['model'],qs[_0xb961('0x3a')](_0x38e099[_0xb961('0x36')][_0xb961('0x3a')]));_0x37c988[_0xb961('0x38')]=_0x37c988['attributes'][_0xb961('0x3b')]?_0x37c988[_0xb961('0x38')]:_0x571618['model'];if(!_0x38e099[_0xb961('0x36')][_0xb961('0x3c')]('nolimit')){_0x37c988[_0xb961('0x20')]=qs[_0xb961('0x20')](_0x38e099[_0xb961('0x36')]['limit']);_0x37c988['offset']=qs['offset'](_0x38e099[_0xb961('0x36')][_0xb961('0x23')]);}_0x37c988[_0xb961('0x3d')]=qs[_0xb961('0x3e')](_0x38e099['query'][_0xb961('0x3e')]);_0x37c988[_0xb961('0x3f')]=qs['filters'](_[_0xb961('0x40')](_0x38e099[_0xb961('0x36')],_0x571618[_0xb961('0x37')]),_0x29bd2e);if(_0x38e099['query'][_0xb961('0x41')]){_0x37c988['where']=_[_0xb961('0x42')](_0x37c988[_0xb961('0x3f')],{'$or':_[_0xb961('0x35')](_0x29bd2e,function(_0x24136f){if(_0x24136f[_0xb961('0x32')]!==_0xb961('0x43')){var _0x438237={};_0x438237[_0x24136f[_0xb961('0x2d')]]={'$like':'%'+_0x38e099[_0xb961('0x36')]['filter']+'%'};return _0x438237;}})});}_0x37c988=_['merge']({},_0x37c988,_0x38e099[_0xb961('0x44')]);var _0x44e9f5={'where':_0x37c988[_0xb961('0x3f')]};return db[_0xb961('0x30')]['count'](_0x44e9f5)['then'](function(_0x192f42){_0x8cd966['count']=_0x192f42;if(_0x38e099[_0xb961('0x36')][_0xb961('0x45')]){_0x37c988[_0xb961('0x46')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xb961('0x47')](_0x37c988);})[_0xb961('0x2a')](function(_0x3b772c){_0x8cd966['rows']=_0x3b772c;return _0x8cd966;})[_0xb961('0x2a')](respondWithFilteredResult(_0x58d414,_0x37c988))[_0xb961('0x48')](handleError(_0x58d414,null));};exports[_0xb961('0x49')]=function(_0x1c64ff,_0x29744e){var _0x418c42={'raw':![],'where':{'id':_0x1c64ff[_0xb961('0x4a')]['id']}},_0x45ae1a={};_0x45ae1a[_0xb961('0x34')]=_[_0xb961('0x4b')](db[_0xb961('0x30')][_0xb961('0x4c')]);_0x45ae1a[_0xb961('0x36')]=_[_0xb961('0x4b')](_0x1c64ff[_0xb961('0x36')]);_0x45ae1a[_0xb961('0x37')]=_['intersection'](_0x45ae1a['model'],_0x45ae1a['query']);_0x418c42[_0xb961('0x38')]=_[_0xb961('0x39')](_0x45ae1a[_0xb961('0x34')],qs[_0xb961('0x3a')](_0x1c64ff[_0xb961('0x36')][_0xb961('0x3a')]));_0x418c42[_0xb961('0x38')]=_0x418c42[_0xb961('0x38')][_0xb961('0x3b')]?_0x418c42[_0xb961('0x38')]:_0x45ae1a[_0xb961('0x34')];if(_0x1c64ff[_0xb961('0x36')][_0xb961('0x45')]){_0x418c42[_0xb961('0x46')]=[{'all':!![]}];}_0x418c42=_[_0xb961('0x42')]({},_0x418c42,_0x1c64ff[_0xb961('0x44')]);return db[_0xb961('0x30')][_0xb961('0x4d')](_0x418c42)['then'](handleEntityNotFound(_0x29744e,null))[_0xb961('0x2a')](respondWithResult(_0x29744e,null))['catch'](handleError(_0x29744e,null));};exports[_0xb961('0x4e')]=function(_0x526bba,_0x385774){return db[_0xb961('0x30')][_0xb961('0x4e')](_0x526bba[_0xb961('0x4f')],{})[_0xb961('0x2a')](respondWithResult(_0x385774,0xc9))['catch'](handleError(_0x385774,null));};exports[_0xb961('0x29')]=function(_0x5f2eed,_0x401e0c){if(_0x5f2eed[_0xb961('0x4f')]['id']){delete _0x5f2eed[_0xb961('0x4f')]['id'];}return db['VoiceQueueReport'][_0xb961('0x4d')]({'where':{'id':_0x5f2eed[_0xb961('0x4a')]['id']}})[_0xb961('0x2a')](handleEntityNotFound(_0x401e0c,null))[_0xb961('0x2a')](saveUpdates(_0x5f2eed[_0xb961('0x4f')],null))[_0xb961('0x2a')](respondWithResult(_0x401e0c,null))[_0xb961('0x48')](handleError(_0x401e0c,null));};exports[_0xb961('0x50')]=function(_0x2a0131,_0x586acc){return db[_0xb961('0x30')][_0xb961('0x4d')]({'where':{'id':_0x2a0131[_0xb961('0x4a')]['id']}})[_0xb961('0x2a')](handleEntityNotFound(_0x586acc,null))['then'](removeEntity(_0x586acc,null))['catch'](handleError(_0x586acc,null));};exports[_0xb961('0x51')]=function(_0x212cbb,_0x558466){return db[_0xb961('0x30')][_0xb961('0x51')]()['then'](respondWithResult(_0x558466,null))[_0xb961('0x48')](handleError(_0x558466,null));};exports[_0xb961('0x52')]=function(_0x37480e,_0x50d80a){var _0x1dee8f={},_0xb1ce73={},_0x55760d={'count':0x0,'rows':[]};_0xb1ce73[_0xb961('0x34')]=_[_0xb961('0x4b')](db['VoiceQueueReport'][_0xb961('0x4c')]);_0xb1ce73['query']=_[_0xb961('0x4b')](_0x37480e['query']);_0xb1ce73[_0xb961('0x37')]=_[_0xb961('0x39')](_0xb1ce73[_0xb961('0x34')],_0xb1ce73[_0xb961('0x36')]);_0x1dee8f[_0xb961('0x38')]=_[_0xb961('0x39')](_0xb1ce73[_0xb961('0x34')],qs[_0xb961('0x3a')](_0x37480e[_0xb961('0x36')][_0xb961('0x3a')]));_0x1dee8f[_0xb961('0x38')]=_0x1dee8f[_0xb961('0x38')][_0xb961('0x3b')]?_0x1dee8f[_0xb961('0x38')]:_0xb1ce73[_0xb961('0x34')];if(!_0x37480e[_0xb961('0x36')][_0xb961('0x3c')](_0xb961('0x53'))){_0x1dee8f[_0xb961('0x20')]=qs[_0xb961('0x20')](_0x37480e['query'][_0xb961('0x20')]);_0x1dee8f[_0xb961('0x23')]=qs[_0xb961('0x23')](_0x37480e['query']['offset']);}_0x1dee8f['order']=qs[_0xb961('0x3e')](_0x37480e[_0xb961('0x36')]['sort']);_0x1dee8f[_0xb961('0x3f')]=qs['filters'](_[_0xb961('0x40')](_0x37480e[_0xb961('0x36')],_0xb1ce73[_0xb961('0x37')]));if(_0x37480e['query']['filter']){_0x1dee8f[_0xb961('0x3f')]=_[_0xb961('0x42')](_0x1dee8f[_0xb961('0x3f')],{'$or':_['map'](_0x1dee8f['attributes'],function(_0x20804c){var _0x2e4394={};_0x2e4394[_0x20804c]={'$like':'%'+_0x37480e[_0xb961('0x36')][_0xb961('0x41')]+'%'};return _0x2e4394;})});}_0x1dee8f=_[_0xb961('0x42')]({},_0x1dee8f,_0x37480e['options']);var _0x5725c0={'where':_0x1dee8f[_0xb961('0x3f')]};return db[_0xb961('0x30')][_0xb961('0x22')](_0x5725c0)[_0xb961('0x2a')](function(_0x59ddf3){_0x55760d[_0xb961('0x22')]=_0x59ddf3;if(_0x37480e[_0xb961('0x36')][_0xb961('0x45')]){_0x1dee8f['include']=[{'all':!![]}];}return db[_0xb961('0x30')][_0xb961('0x47')](_0x1dee8f);})[_0xb961('0x2a')](function(_0x3311be){_0x55760d['rows']=_0x3311be;return _0x55760d;})[_0xb961('0x2a')](respondWithFilteredResult(_0x50d80a,_0x1dee8f,'getVoiceQueuesReport'))['catch'](handleError(_0x50d80a,null,_0xb961('0x52')));}; \ No newline at end of file +var _0xc18d=['query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','VoiceQueueReport','include','findAll','catch','show','params','keys','includeAll','find','create','body','destroy','describe','getVoiceQueuesReport','fields','length','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','redis','./voiceQueueReport.socket','register','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','then','status','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','key','model'];(function(_0x2c4949,_0x2476d2){var _0x5e9161=function(_0x436268){while(--_0x436268){_0x2c4949['push'](_0x2c4949['shift']());}};_0x5e9161(++_0x2476d2);}(_0xc18d,0x74));var _0xdc18=function(_0x582e7e,_0x12e036){_0x582e7e=_0x582e7e-0x0;var _0x416583=_0xc18d[_0x582e7e];return _0x416583;};'use strict';var emlformat=require(_0xdc18('0x0'));var rimraf=require(_0xdc18('0x1'));var zipdir=require(_0xdc18('0x2'));var jsonpatch=require(_0xdc18('0x3'));var rp=require(_0xdc18('0x4'));var moment=require(_0xdc18('0x5'));var BPromise=require(_0xdc18('0x6'));var Mustache=require('mustache');var util=require(_0xdc18('0x7'));var path=require(_0xdc18('0x8'));var sox=require(_0xdc18('0x9'));var csv=require(_0xdc18('0xa'));var ejs=require(_0xdc18('0xb'));var fs=require('fs');var fs_extra=require(_0xdc18('0xc'));var _=require(_0xdc18('0xd'));var squel=require(_0xdc18('0xe'));var crypto=require(_0xdc18('0xf'));var jsforce=require(_0xdc18('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc18('0x11'));var Papa=require(_0xdc18('0x12'));var Redis=require('ioredis');var authService=require(_0xdc18('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xdc18('0x14'));var hardwareService=require(_0xdc18('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xdc18('0x16'));var config=require(_0xdc18('0x17'));var licenseUtil=require(_0xdc18('0x18'));var db=require(_0xdc18('0x19'))['db'];config['redis']=_[_0xdc18('0x1a')](config['redis'],{'host':_0xdc18('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdc18('0x1c')]));require(_0xdc18('0x1d'))[_0xdc18('0x1e')](socket);function respondWithStatusCode(_0x17f850,_0x8051c3){_0x8051c3=_0x8051c3||0xcc;return function(_0x40df40){if(_0x40df40){return _0x17f850['sendStatus'](_0x8051c3);}return _0x17f850['status'](_0x8051c3)[_0xdc18('0x1f')]();};}function respondWithResult(_0x530250,_0x3ef07e){_0x3ef07e=_0x3ef07e||0xc8;return function(_0x204429){if(_0x204429){return _0x530250['status'](_0x3ef07e)['json'](_0x204429);}};}function respondWithFilteredResult(_0x5cc81b,_0x131f08){return function(_0x53080b){if(_0x53080b){var _0x52394f=typeof _0x131f08[_0xdc18('0x20')]==='undefined'&&typeof _0x131f08[_0xdc18('0x21')]===_0xdc18('0x22');var _0x289a4a=_0x53080b[_0xdc18('0x23')];var _0x38f918=_0x52394f?0x0:_0x131f08[_0xdc18('0x20')];var _0xfba01b=_0x52394f?_0x53080b[_0xdc18('0x23')]:_0x131f08[_0xdc18('0x20')]+_0x131f08[_0xdc18('0x21')];var _0x360105;if(_0xfba01b>=_0x289a4a){_0xfba01b=_0x289a4a;_0x360105=0xc8;}else{_0x360105=0xce;}_0x5cc81b['status'](_0x360105);return _0x5cc81b[_0xdc18('0x24')](_0xdc18('0x25'),_0x38f918+'-'+_0xfba01b+'/'+_0x289a4a)[_0xdc18('0x26')](_0x53080b);}return null;};}function patchUpdates(_0x2cbf98){return function(_0x57024d){try{jsonpatch[_0xdc18('0x27')](_0x57024d,_0x2cbf98,!![]);}catch(_0x3a454c){return BPromise[_0xdc18('0x28')](_0x3a454c);}return _0x57024d['save']();};}function saveUpdates(_0x22a88c,_0x395122){return function(_0x427b10){if(_0x427b10){return _0x427b10[_0xdc18('0x29')](_0x22a88c)[_0xdc18('0x2a')](function(_0x4ca953){return _0x4ca953;});}return null;};}function removeEntity(_0x1b774b,_0x17173e){return function(_0x52d5a5){if(_0x52d5a5){return _0x52d5a5['destroy']()[_0xdc18('0x2a')](function(){_0x1b774b[_0xdc18('0x2b')](0xcc)[_0xdc18('0x1f')]();});}};}function handleEntityNotFound(_0x3edcb2,_0xf04bf9){return function(_0x21a235){if(!_0x21a235){_0x3edcb2[_0xdc18('0x2c')](0x194);}return _0x21a235;};}function handleError(_0xe0a145,_0x460712){_0x460712=_0x460712||0x1f4;return function(_0x4dea12){logger[_0xdc18('0x2d')](_0x4dea12[_0xdc18('0x2e')]);if(_0x4dea12[_0xdc18('0x2f')]){delete _0x4dea12[_0xdc18('0x2f')];}_0xe0a145[_0xdc18('0x2b')](_0x460712)['send'](_0x4dea12);};}exports[_0xdc18('0x30')]=function(_0x45a667,_0x13889b){var _0x4cf798={},_0x3c54ce={},_0x36fb67={'count':0x0,'rows':[]};var _0x498819=_['map'](db['VoiceQueueReport'][_0xdc18('0x31')],function(_0x314d2e){return{'name':_0x314d2e[_0xdc18('0x32')],'type':_0x314d2e[_0xdc18('0x33')][_0xdc18('0x34')]};});_0x3c54ce[_0xdc18('0x35')]=_['map'](_0x498819,_0xdc18('0x2f'));_0x3c54ce[_0xdc18('0x36')]=_['keys'](_0x45a667[_0xdc18('0x36')]);_0x3c54ce[_0xdc18('0x37')]=_[_0xdc18('0x38')](_0x3c54ce[_0xdc18('0x35')],_0x3c54ce[_0xdc18('0x36')]);_0x4cf798[_0xdc18('0x39')]=_[_0xdc18('0x38')](_0x3c54ce['model'],qs['fields'](_0x45a667[_0xdc18('0x36')]['fields']));_0x4cf798[_0xdc18('0x39')]=_0x4cf798[_0xdc18('0x39')]['length']?_0x4cf798[_0xdc18('0x39')]:_0x3c54ce[_0xdc18('0x35')];if(!_0x45a667['query']['hasOwnProperty'](_0xdc18('0x3a'))){_0x4cf798[_0xdc18('0x21')]=qs[_0xdc18('0x21')](_0x45a667[_0xdc18('0x36')][_0xdc18('0x21')]);_0x4cf798[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x45a667['query']['offset']);}_0x4cf798[_0xdc18('0x3b')]=qs['sort'](_0x45a667[_0xdc18('0x36')][_0xdc18('0x3c')]);_0x4cf798[_0xdc18('0x3d')]=qs['filters'](_[_0xdc18('0x3e')](_0x45a667[_0xdc18('0x36')],_0x3c54ce[_0xdc18('0x37')]),_0x498819);if(_0x45a667['query'][_0xdc18('0x3f')]){_0x4cf798['where']=_[_0xdc18('0x40')](_0x4cf798[_0xdc18('0x3d')],{'$or':_[_0xdc18('0x41')](_0x498819,function(_0x4cb35f){if(_0x4cb35f[_0xdc18('0x33')]!==_0xdc18('0x42')){var _0xed9b69={};_0xed9b69[_0x4cb35f['name']]={'$like':'%'+_0x45a667[_0xdc18('0x36')][_0xdc18('0x3f')]+'%'};return _0xed9b69;}})});}_0x4cf798=_[_0xdc18('0x40')]({},_0x4cf798,_0x45a667[_0xdc18('0x43')]);var _0x2bf2d7={'where':_0x4cf798[_0xdc18('0x3d')]};return db[_0xdc18('0x44')][_0xdc18('0x23')](_0x2bf2d7)[_0xdc18('0x2a')](function(_0x24909e){_0x36fb67[_0xdc18('0x23')]=_0x24909e;if(_0x45a667[_0xdc18('0x36')]['includeAll']){_0x4cf798[_0xdc18('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xdc18('0x46')](_0x4cf798);})['then'](function(_0x27f962){_0x36fb67['rows']=_0x27f962;return _0x36fb67;})['then'](respondWithFilteredResult(_0x13889b,_0x4cf798))[_0xdc18('0x47')](handleError(_0x13889b,null));};exports[_0xdc18('0x48')]=function(_0x146368,_0x24b635){var _0x333173={'raw':![],'where':{'id':_0x146368[_0xdc18('0x49')]['id']}},_0x330d12={};_0x330d12[_0xdc18('0x35')]=_[_0xdc18('0x4a')](db['VoiceQueueReport'][_0xdc18('0x31')]);_0x330d12[_0xdc18('0x36')]=_[_0xdc18('0x4a')](_0x146368[_0xdc18('0x36')]);_0x330d12['filters']=_[_0xdc18('0x38')](_0x330d12['model'],_0x330d12[_0xdc18('0x36')]);_0x333173[_0xdc18('0x39')]=_[_0xdc18('0x38')](_0x330d12[_0xdc18('0x35')],qs['fields'](_0x146368['query']['fields']));_0x333173[_0xdc18('0x39')]=_0x333173[_0xdc18('0x39')]['length']?_0x333173[_0xdc18('0x39')]:_0x330d12['model'];if(_0x146368[_0xdc18('0x36')][_0xdc18('0x4b')]){_0x333173[_0xdc18('0x45')]=[{'all':!![]}];}_0x333173=_[_0xdc18('0x40')]({},_0x333173,_0x146368[_0xdc18('0x43')]);return db['VoiceQueueReport'][_0xdc18('0x4c')](_0x333173)[_0xdc18('0x2a')](handleEntityNotFound(_0x24b635,null))[_0xdc18('0x2a')](respondWithResult(_0x24b635,null))['catch'](handleError(_0x24b635,null));};exports[_0xdc18('0x4d')]=function(_0x4bf86e,_0x3c2eef){return db['VoiceQueueReport'][_0xdc18('0x4d')](_0x4bf86e[_0xdc18('0x4e')],{})[_0xdc18('0x2a')](respondWithResult(_0x3c2eef,0xc9))['catch'](handleError(_0x3c2eef,null));};exports[_0xdc18('0x29')]=function(_0x9f3e48,_0x49fac3){if(_0x9f3e48[_0xdc18('0x4e')]['id']){delete _0x9f3e48[_0xdc18('0x4e')]['id'];}return db[_0xdc18('0x44')]['find']({'where':{'id':_0x9f3e48[_0xdc18('0x49')]['id']}})['then'](handleEntityNotFound(_0x49fac3,null))['then'](saveUpdates(_0x9f3e48[_0xdc18('0x4e')],null))['then'](respondWithResult(_0x49fac3,null))[_0xdc18('0x47')](handleError(_0x49fac3,null));};exports[_0xdc18('0x4f')]=function(_0x2f7eba,_0x18477a){return db[_0xdc18('0x44')][_0xdc18('0x4c')]({'where':{'id':_0x2f7eba[_0xdc18('0x49')]['id']}})[_0xdc18('0x2a')](handleEntityNotFound(_0x18477a,null))[_0xdc18('0x2a')](removeEntity(_0x18477a,null))[_0xdc18('0x47')](handleError(_0x18477a,null));};exports[_0xdc18('0x50')]=function(_0x11bd89,_0xadb53d){return db[_0xdc18('0x44')][_0xdc18('0x50')]()['then'](respondWithResult(_0xadb53d,null))[_0xdc18('0x47')](handleError(_0xadb53d,null));};exports[_0xdc18('0x51')]=function(_0x5cf034,_0x2066a6){var _0x4731ba={},_0x2345c5={},_0x5b4ca6={'count':0x0,'rows':[]};_0x2345c5[_0xdc18('0x35')]=_[_0xdc18('0x4a')](db['VoiceQueueReport']['rawAttributes']);_0x2345c5['query']=_[_0xdc18('0x4a')](_0x5cf034['query']);_0x2345c5[_0xdc18('0x37')]=_['intersection'](_0x2345c5[_0xdc18('0x35')],_0x2345c5[_0xdc18('0x36')]);_0x4731ba['attributes']=_[_0xdc18('0x38')](_0x2345c5[_0xdc18('0x35')],qs[_0xdc18('0x52')](_0x5cf034[_0xdc18('0x36')][_0xdc18('0x52')]));_0x4731ba[_0xdc18('0x39')]=_0x4731ba[_0xdc18('0x39')][_0xdc18('0x53')]?_0x4731ba[_0xdc18('0x39')]:_0x2345c5[_0xdc18('0x35')];if(!_0x5cf034[_0xdc18('0x36')]['hasOwnProperty']('nolimit')){_0x4731ba[_0xdc18('0x21')]=qs['limit'](_0x5cf034[_0xdc18('0x36')]['limit']);_0x4731ba[_0xdc18('0x20')]=qs[_0xdc18('0x20')](_0x5cf034[_0xdc18('0x36')]['offset']);}_0x4731ba[_0xdc18('0x3b')]=qs[_0xdc18('0x3c')](_0x5cf034[_0xdc18('0x36')]['sort']);_0x4731ba[_0xdc18('0x3d')]=qs['filters'](_['pick'](_0x5cf034[_0xdc18('0x36')],_0x2345c5[_0xdc18('0x37')]));if(_0x5cf034[_0xdc18('0x36')]['filter']){_0x4731ba[_0xdc18('0x3d')]=_['merge'](_0x4731ba[_0xdc18('0x3d')],{'$or':_[_0xdc18('0x41')](_0x4731ba['attributes'],function(_0xb3379b){var _0xa00c56={};_0xa00c56[_0xb3379b]={'$like':'%'+_0x5cf034[_0xdc18('0x36')][_0xdc18('0x3f')]+'%'};return _0xa00c56;})});}_0x4731ba=_[_0xdc18('0x40')]({},_0x4731ba,_0x5cf034[_0xdc18('0x43')]);var _0x5763f3={'where':_0x4731ba[_0xdc18('0x3d')]};return db['VoiceQueueReport'][_0xdc18('0x23')](_0x5763f3)[_0xdc18('0x2a')](function(_0x44671e){_0x5b4ca6['count']=_0x44671e;if(_0x5cf034[_0xdc18('0x36')][_0xdc18('0x4b')]){_0x4731ba[_0xdc18('0x45')]=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x4731ba);})[_0xdc18('0x2a')](function(_0x38dc69){_0x5b4ca6[_0xdc18('0x54')]=_0x38dc69;return _0x5b4ca6;})[_0xdc18('0x2a')](respondWithFilteredResult(_0x2066a6,_0x4731ba,_0xdc18('0x51')))[_0xdc18('0x47')](handleError(_0x2066a6,null,_0xdc18('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8eaf6a9..f01f42a 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 _0x48e6=['update','remove','emit','hook','../../mysqldb','save'];(function(_0x5c0034,_0x2ab9b7){var _0x59b18f=function(_0x47043b){while(--_0x47043b){_0x5c0034['push'](_0x5c0034['shift']());}};_0x59b18f(++_0x2ab9b7);}(_0x48e6,0x1b4));var _0x648e=function(_0x595a6e,_0x199124){_0x595a6e=_0x595a6e-0x0;var _0x399445=_0x48e6[_0x595a6e];return _0x399445;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0x648e('0x0'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x648e('0x1'),'afterUpdate':_0x648e('0x2'),'afterDestroy':_0x648e('0x3')};function emitEvent(_0x167709){return function(_0x46500d,_0x3964af,_0x5c47dc){VoiceQueueReportEvents['emit'](_0x167709+':'+_0x46500d['id'],_0x46500d);VoiceQueueReportEvents[_0x648e('0x4')](_0x167709,_0x46500d);_0x5c47dc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x648e('0x5')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0xf5da=['VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xf5da,0xf8));var _0xaf5d=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0xf5da[_0x3f670b];return _0x1c0978;};'use strict';var EventEmitter=require(_0xaf5d('0x0'));var VoiceQueueReport=require(_0xaf5d('0x1'))['db'][_0xaf5d('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xaf5d('0x3')](0x0);var events={'afterCreate':_0xaf5d('0x4'),'afterUpdate':'update','afterDestroy':_0xaf5d('0x5')};function emitEvent(_0x1b1cba){return function(_0x4472f3,_0x30f49c,_0x48082f){VoiceQueueReportEvents[_0xaf5d('0x6')](_0x1b1cba+':'+_0x4472f3['id'],_0x4472f3);VoiceQueueReportEvents[_0xaf5d('0x6')](_0x1b1cba,_0x4472f3);_0x48082f(null);};}for(var e in events){if(events[_0xaf5d('0x7')](e)){var event=events[e];VoiceQueueReport[_0xaf5d('0x8')](e,emitEvent(event));}}module[_0xaf5d('0x9')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index b699f81..d573177 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 _0x6429=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x6429,0x1bc));var _0x9642=function(_0x2fdbf8,_0x461a51){_0x2fdbf8=_0x2fdbf8-0x0;var _0x5dc976=_0x6429[_0x2fdbf8];return _0x5dc976;};'use strict';var _=require(_0x9642('0x0'));var util=require(_0x9642('0x1'));var logger=require(_0x9642('0x2'))(_0x9642('0x3'));var moment=require(_0x9642('0x4'));var BPromise=require('bluebird');var rp=require(_0x9642('0x5'));var fs=require('fs');var path=require(_0x9642('0x6'));var rimraf=require(_0x9642('0x7'));var config=require(_0x9642('0x8'));var attributes=require(_0x9642('0x9'));module[_0x9642('0xa')]=function(_0x265307,_0x1bb079){return _0x265307['define'](_0x9642('0xb'),attributes,{'tableName':_0x9642('0xc'),'paranoid':![],'indexes':[{'fields':[_0x9642('0xd')]},{'fields':[_0x9642('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9f69=['util','api','moment','bluebird','rimraf','./voiceQueueReport.attributes','exports','report_queue','uniqueid','calleridnum'];(function(_0x5f58a1,_0x4301f2){var _0x3db084=function(_0x3dcb14){while(--_0x3dcb14){_0x5f58a1['push'](_0x5f58a1['shift']());}};_0x3db084(++_0x4301f2);}(_0x9f69,0x122));var _0x99f6=function(_0x17fc3d,_0x2d35d5){_0x17fc3d=_0x17fc3d-0x0;var _0x4e83e8=_0x9f69[_0x17fc3d];return _0x4e83e8;};'use strict';var _=require('lodash');var util=require(_0x99f6('0x0'));var logger=require('../../config/logger')(_0x99f6('0x1'));var moment=require(_0x99f6('0x2'));var BPromise=require(_0x99f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x99f6('0x4'));var config=require('../../config/environment');var attributes=require(_0x99f6('0x5'));module[_0x99f6('0x6')]=function(_0x222e62,_0x5ad8ae){return _0x222e62['define']('VoiceQueueReport',attributes,{'tableName':_0x99f6('0x7'),'paranoid':![],'indexes':[{'fields':[_0x99f6('0x8')]},{'fields':[_0x99f6('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index bfc87f5..6fc17dd 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 _0x3897=['options','where','attributes','include','model','map','GetVoiceQueueReport','CreateVoiceQueueReport','VoiceQueueReport','create','raw','update','body','UpdateVoiceQueueReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','catch','findAll'];(function(_0x5b516f,_0x61325c){var _0x106e68=function(_0x967048){while(--_0x967048){_0x5b516f['push'](_0x5b516f['shift']());}};_0x106e68(++_0x61325c);}(_0x3897,0x188));var _0x7389=function(_0x311aad,_0x54d658){_0x311aad=_0x311aad-0x0;var _0x1779bd=_0x3897[_0x311aad];return _0x1779bd;};'use strict';var _=require(_0x7389('0x0'));var util=require(_0x7389('0x1'));var moment=require('moment');var BPromise=require(_0x7389('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7389('0x3'));var db=require(_0x7389('0x4'))['db'];var utils=require(_0x7389('0x5'));var logger=require(_0x7389('0x6'))(_0x7389('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7389('0x8')][_0x7389('0x9')]({'port':0x232a});config[_0x7389('0xa')]=_[_0x7389('0xb')](config[_0x7389('0xa')],{'host':_0x7389('0xc'),'port':0x18eb});var socket=require(_0x7389('0xd'))(new Redis(config[_0x7389('0xa')]));require('./voiceQueueReport.socket')[_0x7389('0xe')](socket);function respondWithRpcPromise(_0x480e9f,_0x2386e5,_0x55fa2e){return new BPromise(function(_0x16afe0,_0x54f327){return client[_0x7389('0xf')](_0x480e9f,_0x55fa2e)[_0x7389('0x10')](function(_0x5225c2){logger[_0x7389('0x11')]('VoiceQueueReport,\x20%s,\x20%s',_0x2386e5,_0x7389('0x12'));logger[_0x7389('0x13')](_0x7389('0x14'),_0x2386e5,_0x7389('0x12'),JSON[_0x7389('0x15')](_0x5225c2));if(_0x5225c2[_0x7389('0x16')]){if(_0x5225c2[_0x7389('0x16')][_0x7389('0x17')]===0x1f4){logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x5225c2['error']['message']);return _0x54f327(_0x5225c2[_0x7389('0x16')][_0x7389('0x19')]);}logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x5225c2['error'][_0x7389('0x19')]);return _0x16afe0(_0x5225c2[_0x7389('0x16')][_0x7389('0x19')]);}else{logger[_0x7389('0x11')](_0x7389('0x18'),_0x2386e5,_0x7389('0x12'));_0x16afe0(_0x5225c2['result']['message']);}})[_0x7389('0x1a')](function(_0x3caa09){logger[_0x7389('0x16')](_0x7389('0x18'),_0x2386e5,_0x3caa09);_0x54f327(_0x3caa09);});});}exports['GetVoiceQueueReport']=function(_0x55267d){var _0x569ae6=this;return new Promise(function(_0x4cad21,_0x164694){return db['VoiceQueueReport'][_0x7389('0x1b')]({'raw':_0x55267d[_0x7389('0x1c')]?_0x55267d[_0x7389('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x55267d['options']?_0x55267d[_0x7389('0x1c')][_0x7389('0x1d')]||null:null,'attributes':_0x55267d[_0x7389('0x1c')]?_0x55267d['options'][_0x7389('0x1e')]||null:null,'limit':_0x55267d[_0x7389('0x1c')]?_0x55267d['options']['limit']||null:null,'include':_0x55267d['options']?_0x55267d[_0x7389('0x1c')][_0x7389('0x1f')]?_['map'](_0x55267d[_0x7389('0x1c')][_0x7389('0x1f')],function(_0x36de41){return{'model':db[_0x36de41[_0x7389('0x20')]],'as':_0x36de41['as'],'attributes':_0x36de41[_0x7389('0x1e')],'include':_0x36de41[_0x7389('0x1f')]?_[_0x7389('0x21')](_0x36de41[_0x7389('0x1f')],function(_0x486091){return{'model':db[_0x486091[_0x7389('0x20')]],'as':_0x486091['as'],'attributes':_0x486091[_0x7389('0x1e')],'include':_0x486091[_0x7389('0x1f')]?_[_0x7389('0x21')](_0x486091['include'],function(_0x1a55cb){return{'model':db[_0x1a55cb[_0x7389('0x20')]],'as':_0x1a55cb['as'],'attributes':_0x1a55cb[_0x7389('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7389('0x10')](function(_0x597091){logger[_0x7389('0x11')](_0x7389('0x22'),_0x55267d);logger['debug']('GetVoiceQueueReport',_0x55267d,JSON[_0x7389('0x15')](_0x597091));_0x4cad21(_0x597091);})['catch'](function(_0x227d7a){logger[_0x7389('0x16')](_0x7389('0x22'),_0x227d7a[_0x7389('0x19')],_0x55267d);_0x164694(_0x569ae6[_0x7389('0x16')](0x1f4,_0x227d7a['message']));});});};exports[_0x7389('0x23')]=function(_0x2d1385){var _0x171888=this;return new Promise(function(_0x2f851b,_0x4aaafd){return db[_0x7389('0x24')][_0x7389('0x25')](_0x2d1385['body'],{'raw':_0x2d1385['options']?_0x2d1385[_0x7389('0x1c')][_0x7389('0x26')]===undefined?!![]:![]:!![]})['then'](function(_0x5f3c14){logger[_0x7389('0x11')]('CreateVoiceQueueReport',_0x2d1385);logger['debug'](_0x7389('0x23'),_0x2d1385,JSON[_0x7389('0x15')](_0x5f3c14));_0x2f851b(_0x5f3c14);})[_0x7389('0x1a')](function(_0x5147d0){logger[_0x7389('0x16')]('CreateVoiceQueueReport',_0x5147d0[_0x7389('0x19')],_0x2d1385);_0x4aaafd(_0x171888[_0x7389('0x16')](0x1f4,_0x5147d0['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x525310){var _0x253e66=this;return new Promise(function(_0x557788,_0x56f639){return db[_0x7389('0x24')][_0x7389('0x27')](_0x525310[_0x7389('0x28')],{'raw':_0x525310['options']?_0x525310['options'][_0x7389('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x525310['options']?_0x525310['options'][_0x7389('0x1d')]||null:null,'attributes':_0x525310[_0x7389('0x1c')]?_0x525310['options'][_0x7389('0x1e')]||null:null,'limit':_0x525310['options']?_0x525310[_0x7389('0x1c')]['limit']||null:null})['then'](function(_0x2eed49){logger[_0x7389('0x11')]('UpdateVoiceQueueReport',_0x525310);logger[_0x7389('0x13')]('UpdateVoiceQueueReport',_0x525310,JSON[_0x7389('0x15')](_0x2eed49));_0x557788(_0x2eed49);})[_0x7389('0x1a')](function(_0x4129a2){logger[_0x7389('0x16')](_0x7389('0x29'),_0x4129a2['message'],_0x525310);_0x56f639(_0x253e66[_0x7389('0x16')](0x1f4,_0x4129a2[_0x7389('0x19')]));});});}; \ No newline at end of file +var _0xbb54=['CreateVoiceQueueReport','UpdateVoiceQueueReport','update','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','create','body'];(function(_0x8420e5,_0x2dd552){var _0x22ea1f=function(_0x456494){while(--_0x456494){_0x8420e5['push'](_0x8420e5['shift']());}};_0x22ea1f(++_0x2dd552);}(_0xbb54,0x1d1));var _0x4bb5=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0xbb54[_0x77773a];return _0x1091a2;};'use strict';var _=require('lodash');var util=require(_0x4bb5('0x0'));var moment=require('moment');var BPromise=require(_0x4bb5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4bb5('0x2'))['db'];var utils=require(_0x4bb5('0x3'));var logger=require(_0x4bb5('0x4'))('rpc');var config=require(_0x4bb5('0x5'));var jayson=require(_0x4bb5('0x6'));var client=jayson[_0x4bb5('0x7')]['http']({'port':0x232a});config[_0x4bb5('0x8')]=_[_0x4bb5('0x9')](config[_0x4bb5('0x8')],{'host':_0x4bb5('0xa'),'port':0x18eb});var socket=require(_0x4bb5('0xb'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0x4bb5('0xc')](socket);function respondWithRpcPromise(_0x581b48,_0x4db5fe,_0x54a909){return new BPromise(function(_0xf2383e,_0x42bae7){return client[_0x4bb5('0xd')](_0x581b48,_0x54a909)[_0x4bb5('0xe')](function(_0x399345){logger[_0x4bb5('0xf')](_0x4bb5('0x10'),_0x4db5fe,_0x4bb5('0x11'));logger[_0x4bb5('0x12')](_0x4bb5('0x13'),_0x4db5fe,_0x4bb5('0x11'),JSON[_0x4bb5('0x14')](_0x399345));if(_0x399345[_0x4bb5('0x15')]){if(_0x399345[_0x4bb5('0x15')][_0x4bb5('0x16')]===0x1f4){logger[_0x4bb5('0x15')](_0x4bb5('0x10'),_0x4db5fe,_0x399345['error'][_0x4bb5('0x17')]);return _0x42bae7(_0x399345[_0x4bb5('0x15')][_0x4bb5('0x17')]);}logger[_0x4bb5('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4db5fe,_0x399345[_0x4bb5('0x15')][_0x4bb5('0x17')]);return _0xf2383e(_0x399345[_0x4bb5('0x15')]['message']);}else{logger[_0x4bb5('0xf')]('VoiceQueueReport,\x20%s,\x20%s',_0x4db5fe,_0x4bb5('0x11'));_0xf2383e(_0x399345[_0x4bb5('0x18')]['message']);}})[_0x4bb5('0x19')](function(_0x3f7716){logger[_0x4bb5('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x4db5fe,_0x3f7716);_0x42bae7(_0x3f7716);});});}exports[_0x4bb5('0x1a')]=function(_0x4170b1){var _0x170060=this;return new Promise(function(_0x299453,_0x42a02b){return db[_0x4bb5('0x1b')][_0x4bb5('0x1c')]({'raw':_0x4170b1[_0x4bb5('0x1d')]?_0x4170b1[_0x4bb5('0x1d')][_0x4bb5('0x1e')]===undefined?!![]:![]:!![],'where':_0x4170b1[_0x4bb5('0x1d')]?_0x4170b1[_0x4bb5('0x1d')][_0x4bb5('0x1f')]||null:null,'attributes':_0x4170b1['options']?_0x4170b1[_0x4bb5('0x1d')][_0x4bb5('0x20')]||null:null,'limit':_0x4170b1[_0x4bb5('0x1d')]?_0x4170b1[_0x4bb5('0x1d')][_0x4bb5('0x21')]||null:null,'include':_0x4170b1[_0x4bb5('0x1d')]?_0x4170b1[_0x4bb5('0x1d')][_0x4bb5('0x22')]?_[_0x4bb5('0x23')](_0x4170b1['options'][_0x4bb5('0x22')],function(_0xe006dd){return{'model':db[_0xe006dd['model']],'as':_0xe006dd['as'],'attributes':_0xe006dd[_0x4bb5('0x20')],'include':_0xe006dd[_0x4bb5('0x22')]?_[_0x4bb5('0x23')](_0xe006dd[_0x4bb5('0x22')],function(_0x3634a2){return{'model':db[_0x3634a2[_0x4bb5('0x24')]],'as':_0x3634a2['as'],'attributes':_0x3634a2[_0x4bb5('0x20')],'include':_0x3634a2['include']?_[_0x4bb5('0x23')](_0x3634a2[_0x4bb5('0x22')],function(_0x2e833a){return{'model':db[_0x2e833a['model']],'as':_0x2e833a['as'],'attributes':_0x2e833a[_0x4bb5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48067c){logger[_0x4bb5('0xf')](_0x4bb5('0x1a'),_0x4170b1);logger[_0x4bb5('0x12')](_0x4bb5('0x1a'),_0x4170b1,JSON['stringify'](_0x48067c));_0x299453(_0x48067c);})[_0x4bb5('0x19')](function(_0x340295){logger[_0x4bb5('0x15')](_0x4bb5('0x1a'),_0x340295[_0x4bb5('0x17')],_0x4170b1);_0x42a02b(_0x170060['error'](0x1f4,_0x340295[_0x4bb5('0x17')]));});});};exports['CreateVoiceQueueReport']=function(_0x30e659){var _0x19a016=this;return new Promise(function(_0x1b37be,_0x28b011){return db[_0x4bb5('0x1b')][_0x4bb5('0x25')](_0x30e659[_0x4bb5('0x26')],{'raw':_0x30e659[_0x4bb5('0x1d')]?_0x30e659[_0x4bb5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x4bb5('0xe')](function(_0x45eaa4){logger[_0x4bb5('0xf')]('CreateVoiceQueueReport',_0x30e659);logger['debug'](_0x4bb5('0x27'),_0x30e659,JSON[_0x4bb5('0x14')](_0x45eaa4));_0x1b37be(_0x45eaa4);})[_0x4bb5('0x19')](function(_0x4478d9){logger[_0x4bb5('0x15')](_0x4bb5('0x27'),_0x4478d9[_0x4bb5('0x17')],_0x30e659);_0x28b011(_0x19a016[_0x4bb5('0x15')](0x1f4,_0x4478d9[_0x4bb5('0x17')]));});});};exports[_0x4bb5('0x28')]=function(_0x35f1b7){var _0x382817=this;return new Promise(function(_0x3468c6,_0x5e9e4c){return db['VoiceQueueReport'][_0x4bb5('0x29')](_0x35f1b7[_0x4bb5('0x26')],{'raw':_0x35f1b7['options']?_0x35f1b7[_0x4bb5('0x1d')][_0x4bb5('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35f1b7[_0x4bb5('0x1d')]?_0x35f1b7['options'][_0x4bb5('0x1f')]||null:null,'attributes':_0x35f1b7[_0x4bb5('0x1d')]?_0x35f1b7[_0x4bb5('0x1d')]['attributes']||null:null,'limit':_0x35f1b7[_0x4bb5('0x1d')]?_0x35f1b7[_0x4bb5('0x1d')][_0x4bb5('0x21')]||null:null})[_0x4bb5('0xe')](function(_0xa4af28){logger[_0x4bb5('0xf')](_0x4bb5('0x28'),_0x35f1b7);logger['debug']('UpdateVoiceQueueReport',_0x35f1b7,JSON[_0x4bb5('0x14')](_0xa4af28));_0x3468c6(_0xa4af28);})['catch'](function(_0x4db8ac){logger[_0x4bb5('0x15')](_0x4bb5('0x28'),_0x4db8ac['message'],_0x35f1b7);_0x5e9e4c(_0x382817[_0x4bb5('0x15')](0x1f4,_0x4db8ac['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 2f1aab3..8329324 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 _0x444a=['emit','register','length','voiceQueueReport:','./voiceQueueReport.events','remove','update'];(function(_0x4a8361,_0x5bce27){var _0x7c7641=function(_0x10e7d4){while(--_0x10e7d4){_0x4a8361['push'](_0x4a8361['shift']());}};_0x7c7641(++_0x5bce27);}(_0x444a,0x170));var _0xa444=function(_0x4a2718,_0x2b8edb){_0x4a2718=_0x4a2718-0x0;var _0x41cddf=_0x444a[_0x4a2718];return _0x41cddf;};'use strict';var VoiceQueueReportEvents=require(_0xa444('0x0'));var events=['save',_0xa444('0x1'),_0xa444('0x2')];function createListener(_0xb8db2e,_0x242673){return function(_0xc3acef){_0x242673[_0xa444('0x3')](_0xb8db2e,_0xc3acef);};}function removeListener(_0x5a3426,_0x30b1e8){return function(){VoiceQueueReportEvents['removeListener'](_0x5a3426,_0x30b1e8);};}exports[_0xa444('0x4')]=function(_0x5e66c2){for(var _0x295b09=0x0,_0x1782e4=events[_0xa444('0x5')];_0x295b09<_0x1782e4;_0x295b09++){var _0x136a95=events[_0x295b09];var _0x56b735=createListener(_0xa444('0x6')+_0x136a95,_0x5e66c2);VoiceQueueReportEvents['on'](_0x136a95,_0x56b735);}}; \ No newline at end of file +var _0x5977=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x4e3387,_0x126e07){var _0x3c48f0=function(_0x2a75d6){while(--_0x2a75d6){_0x4e3387['push'](_0x4e3387['shift']());}};_0x3c48f0(++_0x126e07);}(_0x5977,0xe1));var _0x7597=function(_0x8dfffb,_0x2bf2b4){_0x8dfffb=_0x8dfffb-0x0;var _0x3a17e4=_0x5977[_0x8dfffb];return _0x3a17e4;};'use strict';var VoiceQueueReportEvents=require(_0x7597('0x0'));var events=[_0x7597('0x1'),_0x7597('0x2'),_0x7597('0x3')];function createListener(_0x5f0d35,_0x4afdb1){return function(_0x1970b0){_0x4afdb1[_0x7597('0x4')](_0x5f0d35,_0x1970b0);};}function removeListener(_0x536908,_0x402e4d){return function(){VoiceQueueReportEvents[_0x7597('0x5')](_0x536908,_0x402e4d);};}exports[_0x7597('0x6')]=function(_0x3bd23e){for(var _0xe9bf18=0x0,_0x151a59=events[_0x7597('0x7')];_0xe9bf18<_0x151a59;_0xe9bf18++){var _0x43c863=events[_0xe9bf18];var _0x1039e2=createListener(_0x7597('0x8')+_0x43c863,_0x3bd23e);VoiceQueueReportEvents['on'](_0x43c863,_0x1039e2);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index d5ad9a4..10b323d 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 _0x6836=['update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','/:id','isAuthenticated','create'];(function(_0x3b215a,_0x5667a0){var _0x1ec6a8=function(_0x3a9ed3){while(--_0x3a9ed3){_0x3b215a['push'](_0x3b215a['shift']());}};_0x1ec6a8(++_0x5667a0);}(_0x6836,0x133));var _0x6683=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x6836[_0x3ab9ee];return _0x82ee88;};'use strict';var multer=require(_0x6683('0x0'));var util=require(_0x6683('0x1'));var path=require('path');var timeout=require(_0x6683('0x2'));var express=require(_0x6683('0x3'));var router=express[_0x6683('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6683('0x5'));var interaction=require(_0x6683('0x6'));var config=require(_0x6683('0x7'));var controller=require(_0x6683('0x8'));router[_0x6683('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6683('0x9')](_0x6683('0xa'),auth[_0x6683('0xb')](),controller['show']);router['post']('/',auth[_0x6683('0xb')](),controller[_0x6683('0xc')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x6683('0xd')]);router[_0x6683('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6683('0xf')]=router; \ No newline at end of file +var _0xb3e9=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueuesLog.controller','isAuthenticated','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb3e9,0x1eb));var _0x9b3e=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xb3e9[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x9b3e('0x0'));var util=require('util');var path=require(_0x9b3e('0x1'));var timeout=require(_0x9b3e('0x2'));var express=require(_0x9b3e('0x3'));var router=express[_0x9b3e('0x4')]();var fs_extra=require(_0x9b3e('0x5'));var auth=require(_0x9b3e('0x6'));var interaction=require(_0x9b3e('0x7'));var config=require('../../config/environment');var controller=require(_0x9b3e('0x8'));router['get']('/',auth[_0x9b3e('0x9')](),controller['index']);router['get']('/:id',auth[_0x9b3e('0x9')](),controller['show']);router['post']('/',auth[_0x9b3e('0x9')](),controller[_0x9b3e('0xa')]);router[_0x9b3e('0xb')](_0x9b3e('0xc'),auth[_0x9b3e('0x9')](),controller[_0x9b3e('0xd')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9b3e('0xe')]);module[_0x9b3e('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 6c3b580..d7c8e6d 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 _0xafc4=['STRING','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x2ec4a5,_0x36e0e9){var _0x4d4057=function(_0x1592f1){while(--_0x1592f1){_0x2ec4a5['push'](_0x2ec4a5['shift']());}};_0x4d4057(++_0x36e0e9);}(_0xafc4,0x117));var _0x4afc=function(_0x1d06c7,_0x7f1b8b){_0x1d06c7=_0x1d06c7-0x0;var _0x35c86c=_0xafc4[_0x1d06c7];return _0x35c86c;};'use strict';var Sequelize=require(_0x4afc('0x0'));var moment=require(_0x4afc('0x1'));module[_0x4afc('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4afc('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x4afc('0x4')](_0x4afc('0x5'))}}; \ No newline at end of file +var _0xaa77=['sequelize','moment','exports','STRING','DATE'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xaa77,0x177));var _0x7aa7=function(_0x32b55d,_0x2b6b4d){_0x32b55d=_0x32b55d-0x0;var _0x216839=_0xaa77[_0x32b55d];return _0x216839;};'use strict';var Sequelize=require(_0x7aa7('0x0'));var moment=require(_0x7aa7('0x1'));module[_0x7aa7('0x2')]={'time':{'type':Sequelize[_0x7aa7('0x3')]},'callid':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x7aa7('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x7aa7('0x4')],'allowNull':![],'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 4b0db7d..33cb8ba 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 _0x05e0=['bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','stack','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','name','includeAll','include','findAll','rows','catch','options','find','create','body','params','rimraf','fast-json-patch','request-promise','moment'];(function(_0x99ff94,_0x47a1b1){var _0x1b5bc0=function(_0x25821f){while(--_0x25821f){_0x99ff94['push'](_0x99ff94['shift']());}};_0x1b5bc0(++_0x47a1b1);}(_0x05e0,0xd1));var _0x005e=function(_0x413b37,_0x171b29){_0x413b37=_0x413b37-0x0;var _0x515881=_0x05e0[_0x413b37];return _0x515881;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x005e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x005e('0x1'));var rp=require(_0x005e('0x2'));var moment=require(_0x005e('0x3'));var BPromise=require(_0x005e('0x4'));var Mustache=require(_0x005e('0x5'));var util=require('util');var path=require('path');var sox=require(_0x005e('0x6'));var csv=require(_0x005e('0x7'));var ejs=require(_0x005e('0x8'));var fs=require('fs');var fs_extra=require(_0x005e('0x9'));var _=require(_0x005e('0xa'));var squel=require(_0x005e('0xb'));var crypto=require('crypto');var jsforce=require(_0x005e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x005e('0x7'));var querystring=require(_0x005e('0xd'));var Papa=require('papaparse');var Redis=require(_0x005e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x005e('0xf'))(_0x005e('0x10'));var utils=require(_0x005e('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x005e('0x12'));var db=require(_0x005e('0x13'))['db'];function respondWithStatusCode(_0x4f9070,_0x11a249){_0x11a249=_0x11a249||0xcc;return function(_0x56bc50){if(_0x56bc50){return _0x4f9070[_0x005e('0x14')](_0x11a249);}return _0x4f9070[_0x005e('0x15')](_0x11a249)[_0x005e('0x16')]();};}function respondWithResult(_0x41f849,_0x5a762b){_0x5a762b=_0x5a762b||0xc8;return function(_0x2f1710){if(_0x2f1710){return _0x41f849[_0x005e('0x15')](_0x5a762b)[_0x005e('0x17')](_0x2f1710);}};}function respondWithFilteredResult(_0x5af960,_0xc747ec){return function(_0x42c38b){if(_0x42c38b){var _0xeee247=typeof _0xc747ec[_0x005e('0x18')]==='undefined'&&typeof _0xc747ec[_0x005e('0x19')]===_0x005e('0x1a');var _0x266b64=_0x42c38b['count'];var _0x27b4e0=_0xeee247?0x0:_0xc747ec['offset'];var _0x2eb749=_0xeee247?_0x42c38b[_0x005e('0x1b')]:_0xc747ec[_0x005e('0x18')]+_0xc747ec[_0x005e('0x19')];var _0x1c73fe;if(_0x2eb749>=_0x266b64){_0x2eb749=_0x266b64;_0x1c73fe=0xc8;}else{_0x1c73fe=0xce;}_0x5af960[_0x005e('0x15')](_0x1c73fe);return _0x5af960['set'](_0x005e('0x1c'),_0x27b4e0+'-'+_0x2eb749+'/'+_0x266b64)[_0x005e('0x17')](_0x42c38b);}return null;};}function patchUpdates(_0x256611){return function(_0x7b6db0){try{jsonpatch[_0x005e('0x1d')](_0x7b6db0,_0x256611,!![]);}catch(_0x37910b){return BPromise[_0x005e('0x1e')](_0x37910b);}return _0x7b6db0[_0x005e('0x1f')]();};}function saveUpdates(_0x5f4bcc,_0xcf07e0){return function(_0x36519f){if(_0x36519f){return _0x36519f[_0x005e('0x20')](_0x5f4bcc)[_0x005e('0x21')](function(_0x38707d){return _0x38707d;});}return null;};}function removeEntity(_0x2a7479,_0x281574){return function(_0x25bc7d){if(_0x25bc7d){return _0x25bc7d[_0x005e('0x22')]()['then'](function(){_0x2a7479['status'](0xcc)[_0x005e('0x16')]();});}};}function handleEntityNotFound(_0x5615d8,_0x3ad646){return function(_0x3cacd9){if(!_0x3cacd9){_0x5615d8[_0x005e('0x14')](0x194);}return _0x3cacd9;};}function handleError(_0x46e50e,_0x14bf18){_0x14bf18=_0x14bf18||0x1f4;return function(_0x299a48){logger['error'](_0x299a48[_0x005e('0x23')]);if(_0x299a48['name']){delete _0x299a48['name'];}_0x46e50e[_0x005e('0x15')](_0x14bf18)[_0x005e('0x24')](_0x299a48);};}exports[_0x005e('0x25')]=function(_0x548eda,_0x1ad663){var _0x2f9ae0={},_0x124242={},_0x28fdb0={'count':0x0,'rows':[]};var _0x1da9ab=_[_0x005e('0x26')](db[_0x005e('0x27')][_0x005e('0x28')],function(_0x1a17c8){return{'name':_0x1a17c8[_0x005e('0x29')],'type':_0x1a17c8[_0x005e('0x2a')][_0x005e('0x2b')]};});_0x124242[_0x005e('0x2c')]=_['map'](_0x1da9ab,'name');_0x124242[_0x005e('0x2d')]=_[_0x005e('0x2e')](_0x548eda['query']);_0x124242[_0x005e('0x2f')]=_[_0x005e('0x30')](_0x124242['model'],_0x124242['query']);_0x2f9ae0[_0x005e('0x31')]=_[_0x005e('0x30')](_0x124242['model'],qs[_0x005e('0x32')](_0x548eda[_0x005e('0x2d')][_0x005e('0x32')]));_0x2f9ae0[_0x005e('0x31')]=_0x2f9ae0[_0x005e('0x31')][_0x005e('0x33')]?_0x2f9ae0['attributes']:_0x124242[_0x005e('0x2c')];if(!_0x548eda['query'][_0x005e('0x34')](_0x005e('0x35'))){_0x2f9ae0[_0x005e('0x19')]=qs[_0x005e('0x19')](_0x548eda[_0x005e('0x2d')][_0x005e('0x19')]);_0x2f9ae0['offset']=qs[_0x005e('0x18')](_0x548eda[_0x005e('0x2d')][_0x005e('0x18')]);}_0x2f9ae0[_0x005e('0x36')]=qs['sort'](_0x548eda[_0x005e('0x2d')][_0x005e('0x37')]);_0x2f9ae0[_0x005e('0x38')]=qs[_0x005e('0x2f')](_[_0x005e('0x39')](_0x548eda[_0x005e('0x2d')],_0x124242[_0x005e('0x2f')]),_0x1da9ab);if(_0x548eda[_0x005e('0x2d')][_0x005e('0x3a')]){_0x2f9ae0[_0x005e('0x38')]=_[_0x005e('0x3b')](_0x2f9ae0[_0x005e('0x38')],{'$or':_[_0x005e('0x26')](_0x1da9ab,function(_0x3c4113){if(_0x3c4113[_0x005e('0x2a')]!=='VIRTUAL'){var _0x27bf67={};_0x27bf67[_0x3c4113[_0x005e('0x3c')]]={'$like':'%'+_0x548eda[_0x005e('0x2d')][_0x005e('0x3a')]+'%'};return _0x27bf67;}})});}_0x2f9ae0=_[_0x005e('0x3b')]({},_0x2f9ae0,_0x548eda['options']);var _0xe58ad1={'where':_0x2f9ae0[_0x005e('0x38')]};return db['VoiceQueuesLog'][_0x005e('0x1b')](_0xe58ad1)['then'](function(_0x15853f){_0x28fdb0['count']=_0x15853f;if(_0x548eda[_0x005e('0x2d')][_0x005e('0x3d')]){_0x2f9ae0[_0x005e('0x3e')]=[{'all':!![]}];}return db[_0x005e('0x27')][_0x005e('0x3f')](_0x2f9ae0);})[_0x005e('0x21')](function(_0x3119c7){_0x28fdb0[_0x005e('0x40')]=_0x3119c7;return _0x28fdb0;})[_0x005e('0x21')](respondWithFilteredResult(_0x1ad663,_0x2f9ae0))[_0x005e('0x41')](handleError(_0x1ad663,null));};exports['show']=function(_0x320642,_0x3ec2b2){var _0x4d5c75={'raw':!![],'where':{'id':_0x320642['params']['id']}},_0x186f59={};_0x186f59['model']=_[_0x005e('0x2e')](db[_0x005e('0x27')][_0x005e('0x28')]);_0x186f59[_0x005e('0x2d')]=_[_0x005e('0x2e')](_0x320642['query']);_0x186f59['filters']=_['intersection'](_0x186f59[_0x005e('0x2c')],_0x186f59[_0x005e('0x2d')]);_0x4d5c75[_0x005e('0x31')]=_[_0x005e('0x30')](_0x186f59[_0x005e('0x2c')],qs[_0x005e('0x32')](_0x320642[_0x005e('0x2d')][_0x005e('0x32')]));_0x4d5c75[_0x005e('0x31')]=_0x4d5c75[_0x005e('0x31')]['length']?_0x4d5c75[_0x005e('0x31')]:_0x186f59['model'];if(_0x320642['query'][_0x005e('0x3d')]){_0x4d5c75[_0x005e('0x3e')]=[{'all':!![]}];}_0x4d5c75=_[_0x005e('0x3b')]({},_0x4d5c75,_0x320642[_0x005e('0x42')]);return db[_0x005e('0x27')][_0x005e('0x43')](_0x4d5c75)[_0x005e('0x21')](handleEntityNotFound(_0x3ec2b2,null))[_0x005e('0x21')](respondWithResult(_0x3ec2b2,null))['catch'](handleError(_0x3ec2b2,null));};exports[_0x005e('0x44')]=function(_0x2cc938,_0x4bcaa2){return db[_0x005e('0x27')][_0x005e('0x44')](_0x2cc938[_0x005e('0x45')],{})[_0x005e('0x21')](respondWithResult(_0x4bcaa2,0xc9))['catch'](handleError(_0x4bcaa2,null));};exports[_0x005e('0x20')]=function(_0x107a75,_0x13fbc7){if(_0x107a75[_0x005e('0x45')]['id']){delete _0x107a75[_0x005e('0x45')]['id'];}return db['VoiceQueuesLog'][_0x005e('0x43')]({'where':{'id':_0x107a75['params']['id']}})[_0x005e('0x21')](handleEntityNotFound(_0x13fbc7,null))[_0x005e('0x21')](saveUpdates(_0x107a75['body'],null))[_0x005e('0x21')](respondWithResult(_0x13fbc7,null))[_0x005e('0x41')](handleError(_0x13fbc7,null));};exports[_0x005e('0x22')]=function(_0x17a0f6,_0x3b9a00){return db[_0x005e('0x27')][_0x005e('0x43')]({'where':{'id':_0x17a0f6[_0x005e('0x46')]['id']}})[_0x005e('0x21')](handleEntityNotFound(_0x3b9a00,null))[_0x005e('0x21')](removeEntity(_0x3b9a00,null))[_0x005e('0x41')](handleError(_0x3b9a00,null));}; \ No newline at end of file +var _0xfbc6=['where','filters','pick','filter','VIRTUAL','include','findAll','catch','params','includeAll','options','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','destroy','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3654af,_0x50d0e5){var _0x515540=function(_0x28e474){while(--_0x28e474){_0x3654af['push'](_0x3654af['shift']());}};_0x515540(++_0x50d0e5);}(_0xfbc6,0xef));var _0x6fbc=function(_0x393438,_0x4883a6){_0x393438=_0x393438-0x0;var _0x2a0986=_0xfbc6[_0x393438];return _0x2a0986;};'use strict';var emlformat=require(_0x6fbc('0x0'));var rimraf=require(_0x6fbc('0x1'));var zipdir=require(_0x6fbc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6fbc('0x3'));var moment=require(_0x6fbc('0x4'));var BPromise=require(_0x6fbc('0x5'));var Mustache=require(_0x6fbc('0x6'));var util=require(_0x6fbc('0x7'));var path=require(_0x6fbc('0x8'));var sox=require(_0x6fbc('0x9'));var csv=require(_0x6fbc('0xa'));var ejs=require(_0x6fbc('0xb'));var fs=require('fs');var fs_extra=require(_0x6fbc('0xc'));var _=require(_0x6fbc('0xd'));var squel=require(_0x6fbc('0xe'));var crypto=require(_0x6fbc('0xf'));var jsforce=require(_0x6fbc('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6fbc('0x11'));var Papa=require('papaparse');var Redis=require(_0x6fbc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6fbc('0x13'));var as=require(_0x6fbc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6fbc('0x15'))(_0x6fbc('0x16'));var utils=require(_0x6fbc('0x17'));var config=require(_0x6fbc('0x18'));var licenseUtil=require(_0x6fbc('0x19'));var db=require(_0x6fbc('0x1a'))['db'];function respondWithStatusCode(_0x1959a0,_0x15ec9c){_0x15ec9c=_0x15ec9c||0xcc;return function(_0x52aac3){if(_0x52aac3){return _0x1959a0[_0x6fbc('0x1b')](_0x15ec9c);}return _0x1959a0[_0x6fbc('0x1c')](_0x15ec9c)[_0x6fbc('0x1d')]();};}function respondWithResult(_0x5523ce,_0xbc25){_0xbc25=_0xbc25||0xc8;return function(_0x3cc872){if(_0x3cc872){return _0x5523ce[_0x6fbc('0x1c')](_0xbc25)[_0x6fbc('0x1e')](_0x3cc872);}};}function respondWithFilteredResult(_0x11ede4,_0x5ab2ad){return function(_0x159239){if(_0x159239){var _0x429e0d=typeof _0x5ab2ad['offset']===_0x6fbc('0x1f')&&typeof _0x5ab2ad[_0x6fbc('0x20')]===_0x6fbc('0x1f');var _0x8b17ea=_0x159239[_0x6fbc('0x21')];var _0x5926ba=_0x429e0d?0x0:_0x5ab2ad[_0x6fbc('0x22')];var _0x5bb1e6=_0x429e0d?_0x159239[_0x6fbc('0x21')]:_0x5ab2ad[_0x6fbc('0x22')]+_0x5ab2ad[_0x6fbc('0x20')];var _0x5a5b34;if(_0x5bb1e6>=_0x8b17ea){_0x5bb1e6=_0x8b17ea;_0x5a5b34=0xc8;}else{_0x5a5b34=0xce;}_0x11ede4['status'](_0x5a5b34);return _0x11ede4['set']('Content-Range',_0x5926ba+'-'+_0x5bb1e6+'/'+_0x8b17ea)[_0x6fbc('0x1e')](_0x159239);}return null;};}function patchUpdates(_0x3a46cd){return function(_0x332084){try{jsonpatch[_0x6fbc('0x23')](_0x332084,_0x3a46cd,!![]);}catch(_0x11d653){return BPromise[_0x6fbc('0x24')](_0x11d653);}return _0x332084['save']();};}function saveUpdates(_0x29c5be,_0x1ae424){return function(_0x29e4d7){if(_0x29e4d7){return _0x29e4d7[_0x6fbc('0x25')](_0x29c5be)['then'](function(_0x452745){return _0x452745;});}return null;};}function removeEntity(_0x38c532,_0x48abe9){return function(_0x2ad910){if(_0x2ad910){return _0x2ad910[_0x6fbc('0x26')]()[_0x6fbc('0x27')](function(){_0x38c532[_0x6fbc('0x1c')](0xcc)[_0x6fbc('0x1d')]();});}};}function handleEntityNotFound(_0x2a5cf0,_0x5bd0a5){return function(_0x54db10){if(!_0x54db10){_0x2a5cf0[_0x6fbc('0x1b')](0x194);}return _0x54db10;};}function handleError(_0x3e0f7f,_0x2c7078){_0x2c7078=_0x2c7078||0x1f4;return function(_0x5ad225){logger[_0x6fbc('0x28')](_0x5ad225[_0x6fbc('0x29')]);if(_0x5ad225[_0x6fbc('0x2a')]){delete _0x5ad225['name'];}_0x3e0f7f[_0x6fbc('0x1c')](_0x2c7078)[_0x6fbc('0x2b')](_0x5ad225);};}exports[_0x6fbc('0x2c')]=function(_0x2621ae,_0x5b563d){var _0x3ab162={},_0x8c83e3={},_0x58e2f3={'count':0x0,'rows':[]};var _0x27afda=_['map'](db[_0x6fbc('0x2d')][_0x6fbc('0x2e')],function(_0x418b86){return{'name':_0x418b86[_0x6fbc('0x2f')],'type':_0x418b86[_0x6fbc('0x30')]['key']};});_0x8c83e3[_0x6fbc('0x31')]=_[_0x6fbc('0x32')](_0x27afda,'name');_0x8c83e3[_0x6fbc('0x33')]=_[_0x6fbc('0x34')](_0x2621ae[_0x6fbc('0x33')]);_0x8c83e3['filters']=_[_0x6fbc('0x35')](_0x8c83e3['model'],_0x8c83e3[_0x6fbc('0x33')]);_0x3ab162[_0x6fbc('0x36')]=_[_0x6fbc('0x35')](_0x8c83e3['model'],qs[_0x6fbc('0x37')](_0x2621ae[_0x6fbc('0x33')]['fields']));_0x3ab162[_0x6fbc('0x36')]=_0x3ab162['attributes'][_0x6fbc('0x38')]?_0x3ab162['attributes']:_0x8c83e3['model'];if(!_0x2621ae[_0x6fbc('0x33')][_0x6fbc('0x39')](_0x6fbc('0x3a'))){_0x3ab162[_0x6fbc('0x20')]=qs[_0x6fbc('0x20')](_0x2621ae[_0x6fbc('0x33')][_0x6fbc('0x20')]);_0x3ab162[_0x6fbc('0x22')]=qs['offset'](_0x2621ae[_0x6fbc('0x33')][_0x6fbc('0x22')]);}_0x3ab162[_0x6fbc('0x3b')]=qs[_0x6fbc('0x3c')](_0x2621ae[_0x6fbc('0x33')]['sort']);_0x3ab162[_0x6fbc('0x3d')]=qs[_0x6fbc('0x3e')](_[_0x6fbc('0x3f')](_0x2621ae[_0x6fbc('0x33')],_0x8c83e3[_0x6fbc('0x3e')]),_0x27afda);if(_0x2621ae[_0x6fbc('0x33')][_0x6fbc('0x40')]){_0x3ab162[_0x6fbc('0x3d')]=_['merge'](_0x3ab162[_0x6fbc('0x3d')],{'$or':_[_0x6fbc('0x32')](_0x27afda,function(_0x4488ce){if(_0x4488ce[_0x6fbc('0x30')]!==_0x6fbc('0x41')){var _0x3f6fd5={};_0x3f6fd5[_0x4488ce[_0x6fbc('0x2a')]]={'$like':'%'+_0x2621ae[_0x6fbc('0x33')][_0x6fbc('0x40')]+'%'};return _0x3f6fd5;}})});}_0x3ab162=_['merge']({},_0x3ab162,_0x2621ae['options']);var _0x212f28={'where':_0x3ab162['where']};return db[_0x6fbc('0x2d')][_0x6fbc('0x21')](_0x212f28)['then'](function(_0x563793){_0x58e2f3[_0x6fbc('0x21')]=_0x563793;if(_0x2621ae['query']['includeAll']){_0x3ab162[_0x6fbc('0x42')]=[{'all':!![]}];}return db[_0x6fbc('0x2d')][_0x6fbc('0x43')](_0x3ab162);})[_0x6fbc('0x27')](function(_0x210d88){_0x58e2f3['rows']=_0x210d88;return _0x58e2f3;})['then'](respondWithFilteredResult(_0x5b563d,_0x3ab162))[_0x6fbc('0x44')](handleError(_0x5b563d,null));};exports['show']=function(_0xc8a942,_0x26c141){var _0x48ba07={'raw':!![],'where':{'id':_0xc8a942[_0x6fbc('0x45')]['id']}},_0x4f0f7d={};_0x4f0f7d[_0x6fbc('0x31')]=_[_0x6fbc('0x34')](db[_0x6fbc('0x2d')][_0x6fbc('0x2e')]);_0x4f0f7d[_0x6fbc('0x33')]=_[_0x6fbc('0x34')](_0xc8a942[_0x6fbc('0x33')]);_0x4f0f7d['filters']=_[_0x6fbc('0x35')](_0x4f0f7d[_0x6fbc('0x31')],_0x4f0f7d[_0x6fbc('0x33')]);_0x48ba07[_0x6fbc('0x36')]=_[_0x6fbc('0x35')](_0x4f0f7d[_0x6fbc('0x31')],qs[_0x6fbc('0x37')](_0xc8a942[_0x6fbc('0x33')][_0x6fbc('0x37')]));_0x48ba07[_0x6fbc('0x36')]=_0x48ba07['attributes'][_0x6fbc('0x38')]?_0x48ba07[_0x6fbc('0x36')]:_0x4f0f7d[_0x6fbc('0x31')];if(_0xc8a942['query'][_0x6fbc('0x46')]){_0x48ba07[_0x6fbc('0x42')]=[{'all':!![]}];}_0x48ba07=_['merge']({},_0x48ba07,_0xc8a942[_0x6fbc('0x47')]);return db[_0x6fbc('0x2d')][_0x6fbc('0x48')](_0x48ba07)[_0x6fbc('0x27')](handleEntityNotFound(_0x26c141,null))[_0x6fbc('0x27')](respondWithResult(_0x26c141,null))['catch'](handleError(_0x26c141,null));};exports[_0x6fbc('0x49')]=function(_0x298f6a,_0x38b0f8){return db[_0x6fbc('0x2d')][_0x6fbc('0x49')](_0x298f6a['body'],{})[_0x6fbc('0x27')](respondWithResult(_0x38b0f8,0xc9))[_0x6fbc('0x44')](handleError(_0x38b0f8,null));};exports[_0x6fbc('0x25')]=function(_0xae9bf2,_0x395a9f){if(_0xae9bf2[_0x6fbc('0x4a')]['id']){delete _0xae9bf2[_0x6fbc('0x4a')]['id'];}return db[_0x6fbc('0x2d')][_0x6fbc('0x48')]({'where':{'id':_0xae9bf2[_0x6fbc('0x45')]['id']}})[_0x6fbc('0x27')](handleEntityNotFound(_0x395a9f,null))[_0x6fbc('0x27')](saveUpdates(_0xae9bf2[_0x6fbc('0x4a')],null))['then'](respondWithResult(_0x395a9f,null))['catch'](handleError(_0x395a9f,null));};exports[_0x6fbc('0x26')]=function(_0x59bdc3,_0xed1fa4){return db[_0x6fbc('0x2d')][_0x6fbc('0x48')]({'where':{'id':_0x59bdc3[_0x6fbc('0x45')]['id']}})[_0x6fbc('0x27')](handleEntityNotFound(_0xed1fa4,null))[_0x6fbc('0x27')](removeEntity(_0xed1fa4,null))[_0x6fbc('0x44')](handleError(_0xed1fa4,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 8b3b79a..0558c54 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 _0xd243=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xc66c50,_0x4dfbc1){var _0x48bc6f=function(_0x781d40){while(--_0x781d40){_0xc66c50['push'](_0xc66c50['shift']());}};_0x48bc6f(++_0x4dfbc1);}(_0xd243,0xaa));var _0x3d24=function(_0x4b2988,_0xed692d){_0x4b2988=_0x4b2988-0x0;var _0x303455=_0xd243[_0x4b2988];return _0x303455;};'use strict';var _=require(_0x3d24('0x0'));var util=require('util');var logger=require(_0x3d24('0x1'))(_0x3d24('0x2'));var moment=require(_0x3d24('0x3'));var BPromise=require(_0x3d24('0x4'));var rp=require(_0x3d24('0x5'));var fs=require('fs');var path=require(_0x3d24('0x6'));var rimraf=require(_0x3d24('0x7'));var config=require(_0x3d24('0x8'));var attributes=require(_0x3d24('0x9'));module['exports']=function(_0x4009af,_0x5d77a6){return _0x4009af[_0x3d24('0xa')](_0x3d24('0xb'),attributes,{'tableName':_0x3d24('0xc'),'paranoid':![],'indexes':[{'name':_0x3d24('0xd'),'fields':[_0x3d24('0xe'),_0x3d24('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0x49c0=['rimraf','../../config/environment','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x25c931,_0x44327b){var _0xc1d128=function(_0xe2f758){while(--_0xe2f758){_0x25c931['push'](_0x25c931['shift']());}};_0xc1d128(++_0x44327b);}(_0x49c0,0x188));var _0x049c=function(_0x3b0af5,_0x265965){_0x3b0af5=_0x3b0af5-0x0;var _0x35f157=_0x49c0[_0x3b0af5];return _0x35f157;};'use strict';var _=require(_0x049c('0x0'));var util=require(_0x049c('0x1'));var logger=require(_0x049c('0x2'))(_0x049c('0x3'));var moment=require(_0x049c('0x4'));var BPromise=require(_0x049c('0x5'));var rp=require(_0x049c('0x6'));var fs=require('fs');var path=require(_0x049c('0x7'));var rimraf=require(_0x049c('0x8'));var config=require(_0x049c('0x9'));var attributes=require('./voiceQueuesLog.attributes');module[_0x049c('0xa')]=function(_0x89b6ca,_0x4ccfbc){return _0x89b6ca[_0x049c('0xb')](_0x049c('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x049c('0xd'),'fields':[_0x049c('0xe'),_0x049c('0xf')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 84b4ac8..3393878 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 _0x4676=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result'];(function(_0x31ef15,_0x4bda00){var _0x1b242e=function(_0x1f234d){while(--_0x1f234d){_0x31ef15['push'](_0x31ef15['shift']());}};_0x1b242e(++_0x4bda00);}(_0x4676,0x1e4));var _0x6467=function(_0x401b51,_0x5a05c1){_0x401b51=_0x401b51-0x0;var _0x395ae6=_0x4676[_0x401b51];return _0x395ae6;};'use strict';var _=require(_0x6467('0x0'));var util=require('util');var moment=require(_0x6467('0x1'));var BPromise=require(_0x6467('0x2'));var rs=require(_0x6467('0x3'));var fs=require('fs');var Redis=require(_0x6467('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6467('0x5'));var logger=require(_0x6467('0x6'))(_0x6467('0x7'));var config=require(_0x6467('0x8'));var jayson=require(_0x6467('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c43db,_0x1ab400,_0x4969a7){return new BPromise(function(_0x4a3dd3,_0x2bd50c){return client[_0x6467('0xa')](_0x1c43db,_0x4969a7)[_0x6467('0xb')](function(_0x13b804){logger[_0x6467('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1ab400,_0x6467('0xd'));logger[_0x6467('0xe')](_0x6467('0xf'),_0x1ab400,_0x6467('0xd'),JSON[_0x6467('0x10')](_0x13b804));if(_0x13b804[_0x6467('0x11')]){if(_0x13b804[_0x6467('0x11')][_0x6467('0x12')]===0x1f4){logger[_0x6467('0x11')](_0x6467('0x13'),_0x1ab400,_0x13b804[_0x6467('0x11')][_0x6467('0x14')]);return _0x2bd50c(_0x13b804[_0x6467('0x11')][_0x6467('0x14')]);}logger[_0x6467('0x11')](_0x6467('0x13'),_0x1ab400,_0x13b804[_0x6467('0x11')]['message']);return _0x4a3dd3(_0x13b804[_0x6467('0x11')][_0x6467('0x14')]);}else{logger[_0x6467('0xc')](_0x6467('0x13'),_0x1ab400,'request\x20sent');_0x4a3dd3(_0x13b804[_0x6467('0x15')][_0x6467('0x14')]);}})[_0x6467('0x16')](function(_0x17f6a5){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x1ab400,_0x17f6a5);_0x2bd50c(_0x17f6a5);});});} \ No newline at end of file +var _0x9f40=['stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x49cb81,_0x3baa4c){var _0x4f6f12=function(_0x4c0973){while(--_0x4c0973){_0x49cb81['push'](_0x49cb81['shift']());}};_0x4f6f12(++_0x3baa4c);}(_0x9f40,0xc0));var _0x09f4=function(_0x7c0132,_0xb27d3d){_0x7c0132=_0x7c0132-0x0;var _0x1bd1a2=_0x9f40[_0x7c0132];return _0x1bd1a2;};'use strict';var _=require('lodash');var util=require(_0x09f4('0x0'));var moment=require(_0x09f4('0x1'));var BPromise=require(_0x09f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09f4('0x3'));var db=require(_0x09f4('0x4'))['db'];var utils=require(_0x09f4('0x5'));var logger=require(_0x09f4('0x6'))(_0x09f4('0x7'));var config=require(_0x09f4('0x8'));var jayson=require(_0x09f4('0x9'));var client=jayson[_0x09f4('0xa')][_0x09f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1bbb6c,_0x38a66d,_0x54bde5){return new BPromise(function(_0x5dbe30,_0xf84fbb){return client[_0x09f4('0xc')](_0x1bbb6c,_0x54bde5)['then'](function(_0x57ea6f){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x38a66d,_0x09f4('0xd'));logger['debug'](_0x09f4('0xe'),_0x38a66d,_0x09f4('0xd'),JSON[_0x09f4('0xf')](_0x57ea6f));if(_0x57ea6f[_0x09f4('0x10')]){if(_0x57ea6f[_0x09f4('0x10')][_0x09f4('0x11')]===0x1f4){logger['error'](_0x09f4('0x12'),_0x38a66d,_0x57ea6f[_0x09f4('0x10')]['message']);return _0xf84fbb(_0x57ea6f[_0x09f4('0x10')][_0x09f4('0x13')]);}logger[_0x09f4('0x10')](_0x09f4('0x12'),_0x38a66d,_0x57ea6f[_0x09f4('0x10')][_0x09f4('0x13')]);return _0x5dbe30(_0x57ea6f[_0x09f4('0x10')][_0x09f4('0x13')]);}else{logger[_0x09f4('0x14')]('VoiceQueuesLog,\x20%s,\x20%s',_0x38a66d,_0x09f4('0xd'));_0x5dbe30(_0x57ea6f[_0x09f4('0x15')]['message']);}})[_0x09f4('0x16')](function(_0x18a5ea){logger[_0x09f4('0x10')](_0x09f4('0x12'),_0x38a66d,_0x18a5ea);_0xf84fbb(_0x18a5ea);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 60468e3..bd42d62 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 _0xe74d=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','index','get','/describe','/:id','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x20099c,_0xb9ef8c){var _0xfcc41f=function(_0x3b61a9){while(--_0x3b61a9){_0x20099c['push'](_0x20099c['shift']());}};_0xfcc41f(++_0xb9ef8c);}(_0xe74d,0x1e3));var _0xde74=function(_0x1ec1fa,_0x3efb52){_0x1ec1fa=_0x1ec1fa-0x0;var _0x3e00f0=_0xe74d[_0x1ec1fa];return _0x3e00f0;};'use strict';var multer=require(_0xde74('0x0'));var util=require('util');var path=require(_0xde74('0x1'));var timeout=require(_0xde74('0x2'));var express=require(_0xde74('0x3'));var router=express[_0xde74('0x4')]();var fs_extra=require(_0xde74('0x5'));var auth=require(_0xde74('0x6'));var interaction=require(_0xde74('0x7'));var config=require(_0xde74('0x8'));var controller=require(_0xde74('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xde74('0xa')]);router[_0xde74('0xb')](_0xde74('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xde74('0xd'),auth[_0xde74('0xe')](),controller[_0xde74('0xf')]);router[_0xde74('0xb')](_0xde74('0x10'),auth[_0xde74('0xe')](),controller[_0xde74('0x11')]);router[_0xde74('0xb')](_0xde74('0x12'),controller[_0xde74('0x13')]);router[_0xde74('0xb')](_0xde74('0x14'),auth['isAuthenticated'](),controller['downloadTranscribe']);router[_0xde74('0x15')]('/',auth['isAuthenticated'](),controller[_0xde74('0x16')]);router[_0xde74('0x15')](_0xde74('0x14'),auth[_0xde74('0xe')](),controller[_0xde74('0x17')]);router['put'](_0xde74('0xd'),auth[_0xde74('0xe')](),controller['update']);router[_0xde74('0x18')](_0xde74('0xd'),auth['isAuthenticated'](),controller[_0xde74('0x19')]);module[_0xde74('0x1a')]=router; \ No newline at end of file +var _0x8d0c=['Router','fs-extra','../../components/interaction/service','../../config/environment','index','isAuthenticated','describe','get','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0x8d0c,0x1df));var _0xc8d0=function(_0x8d0d40,_0x1c0928){_0x8d0d40=_0x8d0d40-0x0;var _0x90f0da=_0x8d0c[_0x8d0d40];return _0x90f0da;};'use strict';var multer=require('multer');var util=require(_0xc8d0('0x0'));var path=require(_0xc8d0('0x1'));var timeout=require(_0xc8d0('0x2'));var express=require(_0xc8d0('0x3'));var router=express[_0xc8d0('0x4')]();var fs_extra=require(_0xc8d0('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc8d0('0x6'));var config=require(_0xc8d0('0x7'));var controller=require('./voiceRecording.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc8d0('0x8')]);router['get']('/describe',auth[_0xc8d0('0x9')](),controller[_0xc8d0('0xa')]);router[_0xc8d0('0xb')](_0xc8d0('0xc'),auth[_0xc8d0('0x9')](),controller['show']);router[_0xc8d0('0xb')](_0xc8d0('0xd'),auth[_0xc8d0('0x9')](),controller[_0xc8d0('0xe')]);router[_0xc8d0('0xb')](_0xc8d0('0xf'),controller[_0xc8d0('0x10')]);router[_0xc8d0('0xb')](_0xc8d0('0x11'),auth[_0xc8d0('0x9')](),controller[_0xc8d0('0x12')]);router[_0xc8d0('0x13')]('/',auth[_0xc8d0('0x9')](),controller['create']);router[_0xc8d0('0x13')](_0xc8d0('0x11'),auth[_0xc8d0('0x9')](),controller['runTranscribe']);router['put'](_0xc8d0('0xc'),auth[_0xc8d0('0x9')](),controller['update']);router[_0xc8d0('0x14')]('/:id',auth[_0xc8d0('0x9')](),controller[_0xc8d0('0x15')]);module[_0xc8d0('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 6d3f1fb..8c2187b 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(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'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(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 a49f7fb..2dec624 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 _0x2f65=['recording','Sequelize','ValidationError','filename','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','MD5','col','uniqueid','token','$and','push','decryptFile','extname','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','downloadTranscribe','fileText','root','.txt','Transcript\x20not\x20available','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','VoiceRecording','rawAttributes','type','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','show','params','keys','create','body','find','describe','download','../../components/encryptor','value','%s.cypher','existsSync','secrets'];(function(_0x4a5516,_0x4cf973){var _0x161148=function(_0xe05e8a){while(--_0xe05e8a){_0x4a5516['push'](_0x4a5516['shift']());}};_0x161148(++_0x4cf973);}(_0x2f65,0x179));var _0x52f6=function(_0x5900bb,_0x35566b){_0x5900bb=_0x5900bb-0x0;var _0x1fe8ca=_0x2f65[_0x5900bb];return _0x1fe8ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52f6('0x0'));var zipdir=require(_0x52f6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x52f6('0x2'));var moment=require(_0x52f6('0x3'));var BPromise=require(_0x52f6('0x4'));var Mustache=require('mustache');var util=require(_0x52f6('0x5'));var path=require(_0x52f6('0x6'));var sox=require(_0x52f6('0x7'));var csv=require(_0x52f6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x52f6('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x52f6('0xa'));var jsforce=require(_0x52f6('0xb'));var deskjs=require(_0x52f6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x52f6('0xd'));var Papa=require(_0x52f6('0xe'));var AWS=require('aws-sdk');var uuidv4=require(_0x52f6('0xf'));var Redis=require(_0x52f6('0x10'));var authService=require(_0x52f6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x52f6('0x12'));var hardwareService=require(_0x52f6('0x13'));var logger=require(_0x52f6('0x14'))(_0x52f6('0x15'));var utils=require(_0x52f6('0x16'));var config=require(_0x52f6('0x17'));var licenseUtil=require(_0x52f6('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x360b87,_0x29e3f2){_0x29e3f2=_0x29e3f2||0xcc;return function(_0x5544d3){if(_0x5544d3){return _0x360b87[_0x52f6('0x19')](_0x29e3f2);}return _0x360b87['status'](_0x29e3f2)[_0x52f6('0x1a')]();};}function respondWithResult(_0x7d9d8c,_0xf196ed){_0xf196ed=_0xf196ed||0xc8;return function(_0x26c3c4){if(_0x26c3c4){return _0x7d9d8c[_0x52f6('0x1b')](_0xf196ed)[_0x52f6('0x1c')](_0x26c3c4);}};}function respondWithFilteredResult(_0x359d33,_0x5341f4){return function(_0x16e9e0){if(_0x16e9e0){var _0x7cb89b=typeof _0x5341f4[_0x52f6('0x1d')]===_0x52f6('0x1e')&&typeof _0x5341f4[_0x52f6('0x1f')]==='undefined';var _0x42c0e5=_0x16e9e0[_0x52f6('0x20')];var _0xfcd933=_0x7cb89b?0x0:_0x5341f4['offset'];var _0x18f3d3=_0x7cb89b?_0x16e9e0[_0x52f6('0x20')]:_0x5341f4[_0x52f6('0x1d')]+_0x5341f4['limit'];var _0x20b9ca;if(_0x18f3d3>=_0x42c0e5){_0x18f3d3=_0x42c0e5;_0x20b9ca=0xc8;}else{_0x20b9ca=0xce;}_0x359d33['status'](_0x20b9ca);return _0x359d33['set'](_0x52f6('0x21'),_0xfcd933+'-'+_0x18f3d3+'/'+_0x42c0e5)['json'](_0x16e9e0);}return null;};}function patchUpdates(_0x3eab03){return function(_0x33876a){try{jsonpatch[_0x52f6('0x22')](_0x33876a,_0x3eab03,!![]);}catch(_0x720c7a){return BPromise['reject'](_0x720c7a);}return _0x33876a[_0x52f6('0x23')]();};}function saveUpdates(_0x44fe32,_0x1e83e0){return function(_0x5180ee){if(_0x5180ee){return _0x5180ee[_0x52f6('0x24')](_0x44fe32)[_0x52f6('0x25')](function(_0x47fa26){return _0x47fa26;});}return null;};}function removeEntity(_0x1fa6a1,_0x3002e5){return function(_0x2196f1){if(_0x2196f1){return _0x2196f1[_0x52f6('0x26')]()[_0x52f6('0x25')](function(){_0x1fa6a1[_0x52f6('0x1b')](0xcc)[_0x52f6('0x1a')]();});}};}function handleEntityNotFound(_0x1de416,_0x486d20){return function(_0x19a259){if(!_0x19a259){_0x1de416[_0x52f6('0x19')](0x194);}return _0x19a259;};}function handleError(_0x13cd2e,_0x4767b7){_0x4767b7=_0x4767b7||0x1f4;return function(_0x466c88){logger[_0x52f6('0x27')](_0x466c88[_0x52f6('0x28')]);if(_0x466c88[_0x52f6('0x29')]){delete _0x466c88[_0x52f6('0x29')];}_0x13cd2e[_0x52f6('0x1b')](_0x4767b7)[_0x52f6('0x2a')](_0x466c88);};}exports['index']=function(_0x4d31dc,_0x1a609d){var _0x132688={},_0x5a74e2={},_0x54fa2d={'count':0x0,'rows':[]};var _0x36a875=_['map'](db[_0x52f6('0x2b')][_0x52f6('0x2c')],function(_0x1b7759){return{'name':_0x1b7759['fieldName'],'type':_0x1b7759[_0x52f6('0x2d')]['key']};});_0x5a74e2[_0x52f6('0x2e')]=_[_0x52f6('0x2f')](_[_0x52f6('0x30')](_0x36a875,_0x52f6('0x29')),[_0x52f6('0x31')]);_0x5a74e2[_0x52f6('0x32')]=_['keys'](_0x4d31dc[_0x52f6('0x32')]);_0x5a74e2[_0x52f6('0x33')]=_[_0x52f6('0x34')](_0x5a74e2[_0x52f6('0x2e')],_0x5a74e2[_0x52f6('0x32')]);_0x132688[_0x52f6('0x35')]=_[_0x52f6('0x34')](_0x5a74e2[_0x52f6('0x2e')],qs['fields'](_0x4d31dc[_0x52f6('0x32')][_0x52f6('0x36')]));_0x132688[_0x52f6('0x35')]=_0x132688['attributes'][_0x52f6('0x37')]?_0x132688[_0x52f6('0x35')]:_0x5a74e2['model'];if(!_0x4d31dc['query'][_0x52f6('0x38')](_0x52f6('0x39'))){_0x132688[_0x52f6('0x1f')]=qs[_0x52f6('0x1f')](_0x4d31dc['query'][_0x52f6('0x1f')]);_0x132688[_0x52f6('0x1d')]=qs[_0x52f6('0x1d')](_0x4d31dc[_0x52f6('0x32')][_0x52f6('0x1d')]);}_0x132688['order']=qs['sort'](_0x4d31dc[_0x52f6('0x32')][_0x52f6('0x3a')]);_0x132688[_0x52f6('0x3b')]=qs['filters'](_[_0x52f6('0x3c')](_0x4d31dc[_0x52f6('0x32')],_0x5a74e2[_0x52f6('0x33')]),_0x36a875);if(_0x4d31dc[_0x52f6('0x32')]['filter']){_0x132688['where']=_['merge'](_0x132688[_0x52f6('0x3b')],{'$or':_[_0x52f6('0x30')](_0x36a875,function(_0x543f50){if(_0x543f50[_0x52f6('0x2d')]!==_0x52f6('0x3d')){var _0x576104={};_0x576104[_0x543f50[_0x52f6('0x29')]]={'$like':'%'+_0x4d31dc[_0x52f6('0x32')][_0x52f6('0x3e')]+'%'};return _0x576104;}})});}_0x132688=_[_0x52f6('0x3f')]({},_0x132688,_0x4d31dc[_0x52f6('0x40')]);var _0x65ed5f={'where':_0x132688[_0x52f6('0x3b')]};return db['VoiceRecording'][_0x52f6('0x20')](_0x65ed5f)[_0x52f6('0x25')](function(_0x262741){_0x54fa2d[_0x52f6('0x20')]=_0x262741;if(_0x4d31dc[_0x52f6('0x32')][_0x52f6('0x41')]){_0x132688[_0x52f6('0x42')]=[{'all':!![]}];}return db[_0x52f6('0x2b')]['findAll'](_0x132688);})['then'](function(_0x5b996e){_0x54fa2d[_0x52f6('0x43')]=_0x5b996e;return _0x54fa2d;})[_0x52f6('0x25')](respondWithFilteredResult(_0x1a609d,_0x132688))[_0x52f6('0x44')](handleError(_0x1a609d,null));};exports[_0x52f6('0x45')]=function(_0x27f794,_0x58a2f3){var _0x333d3e={'raw':![],'where':{'id':_0x27f794[_0x52f6('0x46')]['id']}},_0x4b139a={};_0x4b139a[_0x52f6('0x2e')]=_[_0x52f6('0x47')](db[_0x52f6('0x2b')][_0x52f6('0x2c')]);_0x4b139a[_0x52f6('0x32')]=_[_0x52f6('0x47')](_0x27f794['query']);_0x4b139a[_0x52f6('0x33')]=_[_0x52f6('0x34')](_0x4b139a[_0x52f6('0x2e')],_0x4b139a[_0x52f6('0x32')]);_0x333d3e[_0x52f6('0x35')]=_['intersection'](_0x4b139a[_0x52f6('0x2e')],qs[_0x52f6('0x36')](_0x27f794[_0x52f6('0x32')][_0x52f6('0x36')]));_0x333d3e['attributes']=_0x333d3e['attributes'][_0x52f6('0x37')]?_0x333d3e[_0x52f6('0x35')]:_0x4b139a[_0x52f6('0x2e')];if(_0x27f794['query'][_0x52f6('0x41')]){_0x333d3e[_0x52f6('0x42')]=[{'all':!![]}];}_0x333d3e=_[_0x52f6('0x3f')]({},_0x333d3e,_0x27f794[_0x52f6('0x40')]);return db[_0x52f6('0x2b')]['find'](_0x333d3e)[_0x52f6('0x25')](handleEntityNotFound(_0x58a2f3,null))[_0x52f6('0x25')](respondWithResult(_0x58a2f3,null))[_0x52f6('0x44')](handleError(_0x58a2f3,null));};exports[_0x52f6('0x48')]=function(_0x419e07,_0x441016){return db[_0x52f6('0x2b')][_0x52f6('0x48')](_0x419e07[_0x52f6('0x49')],{})[_0x52f6('0x25')](respondWithResult(_0x441016,0xc9))[_0x52f6('0x44')](handleError(_0x441016,null));};exports[_0x52f6('0x24')]=function(_0x26149e,_0x23fc77){if(_0x26149e[_0x52f6('0x49')]['id']){delete _0x26149e[_0x52f6('0x49')]['id'];}return db[_0x52f6('0x2b')][_0x52f6('0x4a')]({'where':{'id':_0x26149e['params']['id']}})[_0x52f6('0x25')](handleEntityNotFound(_0x23fc77,null))[_0x52f6('0x25')](saveUpdates(_0x26149e[_0x52f6('0x49')],null))[_0x52f6('0x25')](respondWithResult(_0x23fc77,null))[_0x52f6('0x44')](handleError(_0x23fc77,null));};exports[_0x52f6('0x4b')]=function(_0x54a4b5,_0x166522){return db[_0x52f6('0x2b')][_0x52f6('0x4b')]()[_0x52f6('0x25')](respondWithResult(_0x166522,null))[_0x52f6('0x44')](handleError(_0x166522,null));};exports[_0x52f6('0x4c')]=function(_0x413a96,_0x55ddbf,_0x4b3f9d){var _0x2e3160=require(_0x52f6('0x4d'));var _0x3368ae=![];var _0x106632={};if(_0x413a96['query'][_0x52f6('0x2d')]&&_0x413a96[_0x52f6('0x32')][_0x52f6('0x2d')]==='uniqueid'){_0x106632['uniqueid']=_0x413a96[_0x52f6('0x46')]['id'];}else{_0x106632['id']=_0x413a96[_0x52f6('0x46')]['id'];}return db[_0x52f6('0x2b')]['find']({'where':_0x106632,'attributes':['id',_0x52f6('0x4e')],'raw':!![]})[_0x52f6('0x25')](handleEntityNotFound(_0x55ddbf,null))[_0x52f6('0x25')](function(_0x55feaf){if(_0x55feaf){var _0x43be82=_0x55feaf[_0x52f6('0x4e')];var _0x54dc90=util[_0x52f6('0x31')](_0x52f6('0x4f'),_0x43be82);if(fs[_0x52f6('0x50')](_0x54dc90)){_0x3368ae=!![];return _0x2e3160['decryptFile'](_0x54dc90,_0x43be82,config[_0x52f6('0x51')][_0x52f6('0x52')])[_0x52f6('0x25')](function(){return _0x55feaf;});}return _0x55feaf;}})[_0x52f6('0x25')](function(_0x61b1a6){if(_0x61b1a6){var _0x170ff5=_0x61b1a6['value'];if(!fs[_0x52f6('0x50')](_0x170ff5)){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x61b1a6[_0x52f6('0x55')]){return _0x55ddbf[_0x52f6('0x4c')](_0x170ff5,_0x61b1a6[_0x52f6('0x55')]+path['extname'](_0x170ff5),function(){if(_0x3368ae){fs[_0x52f6('0x56')](_0x170ff5);}});}else{return _0x55ddbf['download'](_0x170ff5,function(_0x2bd554){if(_0x3368ae){fs[_0x52f6('0x56')](_0x170ff5);}});}}})[_0x52f6('0x44')](function(_0x590732){if(_0x590732[_0x52f6('0x57')]===_0x52f6('0x58')){_0x55ddbf[_0x52f6('0x1b')](0x194)[_0x52f6('0x2a')]('Not\x20found');}else{return handleError(_0x55ddbf,null);}});};exports[_0x52f6('0x59')]=function(_0x26a59b,_0xd7b79,_0x2bafd5){var _0x1c0bd0=require('../../components/encryptor');var _0x571584=![];var _0xd353ab={'$and':[db[_0x52f6('0x5a')][_0x52f6('0x3b')](db[_0x52f6('0x5a')]['fn'](_0x52f6('0x5b'),db[_0x52f6('0x5a')][_0x52f6('0x5c')](_0x52f6('0x5d'))),_0x26a59b[_0x52f6('0x32')][_0x52f6('0x5e')])]};if(_0x26a59b['query'][_0x52f6('0x2d')]&&_0x26a59b[_0x52f6('0x32')][_0x52f6('0x2d')]===_0x52f6('0x5d')){_0xd353ab[_0x52f6('0x5f')][_0x52f6('0x60')]({'uniqueid':_0x26a59b[_0x52f6('0x46')]['id']});}else{_0xd353ab[_0x52f6('0x5f')][_0x52f6('0x60')]({'id':_0x26a59b[_0x52f6('0x46')]['id']});}return db[_0x52f6('0x2b')][_0x52f6('0x4a')]({'where':_0xd353ab,'attributes':['id',_0x52f6('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0xd7b79,null))[_0x52f6('0x25')](function(_0x8fa41a){if(_0x8fa41a){var _0x5a044f=util[_0x52f6('0x31')](_0x52f6('0x4f'),_0x8fa41a[_0x52f6('0x4e')]);if(fs[_0x52f6('0x50')](_0x5a044f)){_0x571584=!![];return _0x1c0bd0[_0x52f6('0x61')](_0x5a044f,_0x8fa41a[_0x52f6('0x4e')],config[_0x52f6('0x51')]['recording'])[_0x52f6('0x25')](function(){return _0x8fa41a;});}return _0x8fa41a;}})['then'](function(_0x3e432a){if(_0x3e432a){if(!fs[_0x52f6('0x50')](_0x3e432a[_0x52f6('0x4e')])){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))](_0x52f6('0x58'));}if(_0x3e432a['filename']){return _0xd7b79[_0x52f6('0x4c')](_0x3e432a[_0x52f6('0x4e')],_0x3e432a[_0x52f6('0x55')]+path[_0x52f6('0x62')](_0x3e432a[_0x52f6('0x4e')]),function(){if(_0x571584){fs['unlink'](_0x3e432a[_0x52f6('0x4e')]);}});}else{return _0xd7b79[_0x52f6('0x4c')](_0x3e432a[_0x52f6('0x4e')],function(_0x2eb9f7){if(_0x571584){fs['unlink'](_0x3e432a[_0x52f6('0x4e')]);}});}}})[_0x52f6('0x44')](handleError(_0xd7b79,null));};exports[_0x52f6('0x26')]=function(_0x4d13cc,_0x216999){return db['VoiceRecording'][_0x52f6('0x4a')]({'where':{'id':_0x4d13cc['params']['id']}})[_0x52f6('0x25')](function(_0x40e798){if(_[_0x52f6('0x63')](_0x40e798)){throw new ReferenceError(_0x52f6('0x64'));}return _0x40e798;})[_0x52f6('0x25')](function(_0x5cdaa6){var _0x22604d=_0x5cdaa6[_0x52f6('0x4e')];logger[_0x52f6('0x65')](_0x52f6('0x66'),_0x22604d);if(!_[_0x52f6('0x63')](_0x5cdaa6[_0x52f6('0x4e')])&&fs['existsSync'](_0x22604d)){logger[_0x52f6('0x65')](_0x52f6('0x67')+_0x22604d+_0x52f6('0x68'));fs['unlinkSync'](_0x22604d);}_0x22604d=_0x22604d+'.cypher';if(!_['isNil'](_0x5cdaa6[_0x52f6('0x4e')])&&fs['existsSync'](_0x22604d)){logger[_0x52f6('0x65')]('File:\x20\x22'+_0x22604d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x52f6('0x69')](_0x22604d);}return _0x5cdaa6;})[_0x52f6('0x25')](function(_0x5a6a82){if(!_0x5a6a82)throw new InternalError();return _0x5a6a82[_0x52f6('0x26')]();})[_0x52f6('0x25')](function(){_0x216999[_0x52f6('0x1b')](0xcc)['end']();})[_0x52f6('0x44')](handleError(_0x216999,null));};function getBucketslist(_0x58609e,_0xc4d16f,_0x4c8ad8){return new Promise(function(_0x5ad19c,_0xfc6f33){var _0x427901=new AWS['S3']({'accessKeyId':_0xc4d16f,'secretAccessKey':_0x58609e,'region':_0x4c8ad8});_0x427901['listBuckets']({},function(_0x181cae,_0x4ff7d8){if(_0x181cae){return _0xfc6f33(_0x181cae);}else{return _0x5ad19c(_0x4ff7d8);}});});}function createBucket(_0x3a2e30,_0x15814c,_0x238cb0,_0xcc8c21){return new Promise(function(_0x196a33,_0x3aac91){var _0x58ad42=new AWS['S3']({'accessKeyId':_0x15814c,'secretAccessKey':_0x3a2e30,'region':_0x238cb0});_0x58ad42[_0x52f6('0x6a')]({'Bucket':_0xcc8c21},function(_0x8f7a39,_0x1440dc){if(_0x8f7a39){return _0x3aac91(_0x8f7a39);}else{return _0x196a33(_0x1440dc);}});});}function uploadFile(_0x2fa7ce,_0x4ae6cb,_0x322c78,_0x206729,_0x148fd5,_0x332477){return new Promise(function(_0x3e8aeb,_0x593bb4){var _0x591376=new AWS['S3']({'accessKeyId':_0x4ae6cb,'secretAccessKey':_0x2fa7ce,'region':_0x322c78});_0x591376[_0x52f6('0x6b')]({'Bucket':_0x206729,'Key':_0x148fd5,'Body':_0x332477},function(_0x43f02d,_0x59bf9b){if(_0x43f02d){return _0x593bb4(_0x43f02d);}else{return _0x3e8aeb(_0x59bf9b);}});});}function startTranscribe(_0x508072,_0x3908a8,_0x3d90c8,_0x59819d,_0x44cc19,_0x3a5120){return new Promise(function(_0x46f850,_0x885443){var _0x345208=new AWS[(_0x52f6('0x6c'))]({'accessKeyId':_0x3908a8,'secretAccessKey':_0x508072,'region':_0x3d90c8});_0x345208[_0x52f6('0x6d')]({'TranscriptionJobName':_0x59819d,'LanguageCode':_0x44cc19,'Media':{'MediaFileUri':_0x3a5120}},function(_0x5cf7b9,_0x2308da){if(_0x5cf7b9){return _0x885443(_0x5cf7b9);}else{return _0x46f850(_0x2308da);}});});}function transcribe(_0x1ac51f,_0x2c43ce,_0x4113fb,_0x184902,_0x1d8d74,_0x4fd573,_0x13ec0e){return new Promise(function(_0x1d0446,_0x4159a3){var _0x43f963={};logger[_0x52f6('0x65')](util[_0x52f6('0x31')](_0x52f6('0x6e'),_0x1ac51f,_0x1d8d74));return uploadFile(_0x2c43ce,_0x4113fb,_0x184902,_0x1d8d74,path[_0x52f6('0x6f')](_0x4fd573),fs[_0x52f6('0x70')](_0x4fd573))[_0x52f6('0x25')](function(_0x4baf14){logger[_0x52f6('0x65')](util[_0x52f6('0x31')](_0x52f6('0x71'),_0x1ac51f,_0x1d8d74,_0x4baf14[_0x52f6('0x72')]));_0x43f963[_0x52f6('0x73')]=_0x4baf14[_0x52f6('0x74')];_0x43f963[_0x52f6('0x75')]=_0x4baf14[_0x52f6('0x72')];logger[_0x52f6('0x65')](util[_0x52f6('0x31')](_0x52f6('0x76'),_0x1ac51f));return startTranscribe(_0x2c43ce,_0x4113fb,_0x184902,uuidv4(),_0x13ec0e,_0x4baf14[_0x52f6('0x72')]);})['then'](function(_0xef3264){logger[_0x52f6('0x65')](util['format'](_0x52f6('0x77'),_0x1ac51f,_0xef3264[_0x52f6('0x78')][_0x52f6('0x79')]));_0x43f963['transcribeName']=_0xef3264[_0x52f6('0x78')]['TranscriptionJobName'];_0x43f963[_0x52f6('0x7a')]=_0xef3264[_0x52f6('0x78')][_0x52f6('0x7b')];return _0x1d0446(_0x43f963);})[_0x52f6('0x44')](function(_0x34760e){return _0x4159a3(_0x34760e);});});}exports[_0x52f6('0x7c')]=function(_0x3d8fbe,_0x3e7c8e,_0x1fa53a){var _0x3ace0b;var _0x2f7831;var _0x39fa6e;var _0x3c1a29=require(_0x52f6('0x4d'));return db[_0x52f6('0x2b')][_0x52f6('0x7d')]({'where':{'id':_0x3d8fbe['params']['id']}})[_0x52f6('0x25')](function(_0x16c1f6){if(_0x16c1f6){var _0xa96b85=util[_0x52f6('0x31')](_0x52f6('0x4f'),_0x16c1f6[_0x52f6('0x4e')]);if(fs[_0x52f6('0x50')](_0xa96b85)){cypher=!![];return _0x3c1a29[_0x52f6('0x61')](_0xa96b85,_0x16c1f6['value'],config['secrets'][_0x52f6('0x52')])[_0x52f6('0x25')](function(){return _0x16c1f6;});}return _0x16c1f6;}})[_0x52f6('0x25')](function(_0x1fff7a){if(!_0x1fff7a){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))](_0x52f6('0x7e'));}_0x2f7831=_0x1fff7a;return db[_0x52f6('0x7f')][_0x52f6('0x7d')]({'where':{'id':0x1}});})[_0x52f6('0x25')](handleEntityNotFound(_0x3e7c8e,null))[_0x52f6('0x25')](function(_0x557e33){if(_0x557e33){_0x3ace0b=_0x557e33;if(!_0x3ace0b[_0x52f6('0x80')]||!_0x3ace0b[_0x52f6('0x81')]||!_0x3ace0b[_0x52f6('0x82')]||!_0x3ace0b[_0x52f6('0x83')]||!_0x3ace0b[_0x52f6('0x73')]){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))]('Transcribe\x20not\x20configured');}if(_0x3d8fbe[_0x52f6('0x49')]['runSentiment']&&(!_0x3ace0b[_0x52f6('0x84')]||!_0x3ace0b[_0x52f6('0x85')]||!_0x3ace0b[_0x52f6('0x86')]||!_0x3ace0b[_0x52f6('0x83')]||!_0x3ace0b[_0x52f6('0x73')])){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))](_0x52f6('0x87'));}return db[_0x52f6('0x88')][_0x52f6('0x7d')]({'where':{'id':_0x3ace0b[_0x52f6('0x81')]}});}})[_0x52f6('0x25')](function(_0xd6a688){if(!_0xd6a688){throw new db['Sequelize']['ValidationError'](_0x52f6('0x89'));}if(!_0xd6a688[_0x52f6('0x8a')]||!_0xd6a688['data2']){throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))]('Cloud\x20Provider\x20not\x20configured');}_0x39fa6e=_0xd6a688;return getBucketslist(_0x39fa6e['data1'],_0x39fa6e[_0x52f6('0x8b')],_0x3ace0b[_0x52f6('0x82')]);})[_0x52f6('0x25')](function(_0x5dcefd){if(_0x5dcefd&&_0x5dcefd[_0x52f6('0x8c')]){var _0x3614c4=_[_0x52f6('0x4a')](_0x5dcefd[_0x52f6('0x8c')],function(_0x5b49eb){return _0x5b49eb[_0x52f6('0x8d')]===_0x3ace0b['bucket'];});if(!_0x3614c4){logger['info'](util['format'](_0x52f6('0x8e'),_0x3d8fbe['params']['id'],_0x3ace0b[_0x52f6('0x73')]));return createBucket(_0x39fa6e[_0x52f6('0x8a')],_0x39fa6e[_0x52f6('0x8b')],_0x3ace0b[_0x52f6('0x82')],_0x3ace0b['bucket']);}logger[_0x52f6('0x65')](util[_0x52f6('0x31')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3d8fbe[_0x52f6('0x46')]['id'],_0x3ace0b['bucket']));return;}})[_0x52f6('0x25')](function(_0x135f64){if(_0x2f7831[_0x52f6('0x7a')]===_0x52f6('0x8f')){return transcribe(_0x3d8fbe['params']['id'],_0x39fa6e[_0x52f6('0x8a')],_0x39fa6e[_0x52f6('0x8b')],_0x3ace0b[_0x52f6('0x82')],_0x3ace0b[_0x52f6('0x73')],_0x2f7831[_0x52f6('0x4e')],_0x3ace0b[_0x52f6('0x83')]);}else{logger[_0x52f6('0x65')](util[_0x52f6('0x31')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3d8fbe[_0x52f6('0x46')]['id']));return{'transcribeStatus':_0x52f6('0x90')};}})[_0x52f6('0x25')](function(_0x4bcd13){if(_0x4bcd13){_0x4bcd13[_0x52f6('0x91')]=_0x3d8fbe[_0x52f6('0x49')][_0x52f6('0x92')];return _0x2f7831[_0x52f6('0x93')](_0x4bcd13);}})[_0x52f6('0x25')](respondWithResult(_0x3e7c8e,null))[_0x52f6('0x44')](handleError(_0x3e7c8e,null));};function writeFile(_0x41b201,_0x2151f8){return new Promise(function(_0x5360d8,_0x2e75d7){fs['writeFile'](_0x2151f8,_0x41b201,function(_0xf2284c,_0x8ab64a){if(_0xf2284c){return _0x2e75d7(_0xf2284c);}else{return _0x5360d8(_0x8ab64a);}});});}exports[_0x52f6('0x94')]=function(_0x5b9581,_0x523fc6,_0x3fe964){return db['VoiceRecording'][_0x52f6('0x7d')]({'where':{'id':_0x5b9581['params']['id']}})['then'](handleEntityNotFound(_0x523fc6))[_0x52f6('0x25')](function(_0x5e343f){if(_0x5e343f&&_0x5e343f[_0x52f6('0x95')]){var _0x583bc4=_0x5e343f[_0x52f6('0x95')];var _0x5773d5=config[_0x52f6('0x96')]+'/server/files/transcribes/transcribe_'+_0x5e343f['id']+_0x52f6('0x97');if(fs[_0x52f6('0x50')](_0x5773d5)){return _0x5773d5;}return writeFile(_0x583bc4,_0x5773d5)[_0x52f6('0x25')](function(){return _0x5773d5;});}else{throw new db[(_0x52f6('0x53'))][(_0x52f6('0x54'))](_0x52f6('0x98'));}})[_0x52f6('0x25')](function(_0x3e8040){return _0x523fc6[_0x52f6('0x4c')](_0x3e8040);})[_0x52f6('0x44')](handleError(_0x523fc6));}; \ No newline at end of file +var _0x391e=['TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','CloudProvider','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','to-csv','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','map','VoiceRecording','fieldName','type','key','format','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','describe','../../components/encryptor','value','existsSync','decryptFile','recording','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','send','Not\x20found','sequelize','col','token','$and','push','secrets','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus'];(function(_0x343af8,_0x34185e){var _0x38c094=function(_0x4fa8c0){while(--_0x4fa8c0){_0x343af8['push'](_0x343af8['shift']());}};_0x38c094(++_0x34185e);}(_0x391e,0xb8));var _0xe391=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x391e[_0x11005e];return _0x29338f;};'use strict';var emlformat=require(_0xe391('0x0'));var rimraf=require(_0xe391('0x1'));var zipdir=require(_0xe391('0x2'));var jsonpatch=require(_0xe391('0x3'));var rp=require(_0xe391('0x4'));var moment=require(_0xe391('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe391('0x6'));var util=require(_0xe391('0x7'));var path=require(_0xe391('0x8'));var sox=require(_0xe391('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe391('0xa'));var _=require('lodash');var squel=require(_0xe391('0xb'));var crypto=require(_0xe391('0xc'));var jsforce=require(_0xe391('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe391('0xe'));var querystring=require(_0xe391('0xf'));var Papa=require('papaparse');var AWS=require(_0xe391('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xe391('0x11'));var authService=require(_0xe391('0x12'));var qs=require(_0xe391('0x13'));var as=require(_0xe391('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe391('0x15'))(_0xe391('0x16'));var utils=require(_0xe391('0x17'));var config=require(_0xe391('0x18'));var licenseUtil=require(_0xe391('0x19'));var db=require(_0xe391('0x1a'))['db'];function respondWithStatusCode(_0x4152cd,_0x44428c){_0x44428c=_0x44428c||0xcc;return function(_0x207533){if(_0x207533){return _0x4152cd['sendStatus'](_0x44428c);}return _0x4152cd[_0xe391('0x1b')](_0x44428c)[_0xe391('0x1c')]();};}function respondWithResult(_0x29e25d,_0x20de8f){_0x20de8f=_0x20de8f||0xc8;return function(_0x86df1e){if(_0x86df1e){return _0x29e25d[_0xe391('0x1b')](_0x20de8f)[_0xe391('0x1d')](_0x86df1e);}};}function respondWithFilteredResult(_0x3c4a51,_0x5f9068){return function(_0xe82076){if(_0xe82076){var _0x5cde3a=typeof _0x5f9068['offset']===_0xe391('0x1e')&&typeof _0x5f9068[_0xe391('0x1f')]===_0xe391('0x1e');var _0x185460=_0xe82076[_0xe391('0x20')];var _0x5239f3=_0x5cde3a?0x0:_0x5f9068['offset'];var _0x20276a=_0x5cde3a?_0xe82076[_0xe391('0x20')]:_0x5f9068[_0xe391('0x21')]+_0x5f9068[_0xe391('0x1f')];var _0x5318e7;if(_0x20276a>=_0x185460){_0x20276a=_0x185460;_0x5318e7=0xc8;}else{_0x5318e7=0xce;}_0x3c4a51['status'](_0x5318e7);return _0x3c4a51[_0xe391('0x22')](_0xe391('0x23'),_0x5239f3+'-'+_0x20276a+'/'+_0x185460)['json'](_0xe82076);}return null;};}function patchUpdates(_0xd44cd1){return function(_0xa27a80){try{jsonpatch[_0xe391('0x24')](_0xa27a80,_0xd44cd1,!![]);}catch(_0x1d2d0f){return BPromise[_0xe391('0x25')](_0x1d2d0f);}return _0xa27a80['save']();};}function saveUpdates(_0x2aba26,_0x4b458d){return function(_0x200152){if(_0x200152){return _0x200152[_0xe391('0x26')](_0x2aba26)[_0xe391('0x27')](function(_0xdfbd6){return _0xdfbd6;});}return null;};}function removeEntity(_0x554076,_0x4f9ecc){return function(_0x2967ea){if(_0x2967ea){return _0x2967ea[_0xe391('0x28')]()['then'](function(){_0x554076[_0xe391('0x1b')](0xcc)[_0xe391('0x1c')]();});}};}function handleEntityNotFound(_0x91d39f,_0x35cb6c){return function(_0x57894b){if(!_0x57894b){_0x91d39f[_0xe391('0x29')](0x194);}return _0x57894b;};}function handleError(_0x45f38b,_0x4fe468){_0x4fe468=_0x4fe468||0x1f4;return function(_0x24f1c6){logger[_0xe391('0x2a')](_0x24f1c6[_0xe391('0x2b')]);if(_0x24f1c6[_0xe391('0x2c')]){delete _0x24f1c6['name'];}_0x45f38b[_0xe391('0x1b')](_0x4fe468)['send'](_0x24f1c6);};}exports['index']=function(_0x597632,_0x53cc4c){var _0x5455db={},_0x3c2015={},_0x1b1b1c={'count':0x0,'rows':[]};var _0x1d198e=_[_0xe391('0x2d')](db[_0xe391('0x2e')]['rawAttributes'],function(_0x5ae499){return{'name':_0x5ae499[_0xe391('0x2f')],'type':_0x5ae499[_0xe391('0x30')][_0xe391('0x31')]};});_0x3c2015['model']=_['differenceBy'](_[_0xe391('0x2d')](_0x1d198e,_0xe391('0x2c')),[_0xe391('0x32')]);_0x3c2015['query']=_['keys'](_0x597632[_0xe391('0x33')]);_0x3c2015['filters']=_[_0xe391('0x34')](_0x3c2015[_0xe391('0x35')],_0x3c2015['query']);_0x5455db['attributes']=_[_0xe391('0x34')](_0x3c2015[_0xe391('0x35')],qs[_0xe391('0x36')](_0x597632[_0xe391('0x33')][_0xe391('0x36')]));_0x5455db[_0xe391('0x37')]=_0x5455db[_0xe391('0x37')][_0xe391('0x38')]?_0x5455db[_0xe391('0x37')]:_0x3c2015[_0xe391('0x35')];if(!_0x597632[_0xe391('0x33')][_0xe391('0x39')](_0xe391('0x3a'))){_0x5455db[_0xe391('0x1f')]=qs['limit'](_0x597632[_0xe391('0x33')]['limit']);_0x5455db[_0xe391('0x21')]=qs[_0xe391('0x21')](_0x597632[_0xe391('0x33')]['offset']);}_0x5455db[_0xe391('0x3b')]=qs[_0xe391('0x3c')](_0x597632[_0xe391('0x33')][_0xe391('0x3c')]);_0x5455db['where']=qs[_0xe391('0x3d')](_[_0xe391('0x3e')](_0x597632[_0xe391('0x33')],_0x3c2015[_0xe391('0x3d')]),_0x1d198e);if(_0x597632[_0xe391('0x33')][_0xe391('0x3f')]){_0x5455db['where']=_[_0xe391('0x40')](_0x5455db[_0xe391('0x41')],{'$or':_[_0xe391('0x2d')](_0x1d198e,function(_0x26ef95){if(_0x26ef95[_0xe391('0x30')]!==_0xe391('0x42')){var _0x26c5e2={};_0x26c5e2[_0x26ef95[_0xe391('0x2c')]]={'$like':'%'+_0x597632[_0xe391('0x33')][_0xe391('0x3f')]+'%'};return _0x26c5e2;}})});}_0x5455db=_['merge']({},_0x5455db,_0x597632[_0xe391('0x43')]);var _0xf2d5c1={'where':_0x5455db[_0xe391('0x41')]};return db[_0xe391('0x2e')][_0xe391('0x20')](_0xf2d5c1)[_0xe391('0x27')](function(_0x51d4e3){_0x1b1b1c[_0xe391('0x20')]=_0x51d4e3;if(_0x597632[_0xe391('0x33')]['includeAll']){_0x5455db[_0xe391('0x44')]=[{'all':!![]}];}return db[_0xe391('0x2e')][_0xe391('0x45')](_0x5455db);})[_0xe391('0x27')](function(_0x16677f){_0x1b1b1c[_0xe391('0x46')]=_0x16677f;return _0x1b1b1c;})[_0xe391('0x27')](respondWithFilteredResult(_0x53cc4c,_0x5455db))[_0xe391('0x47')](handleError(_0x53cc4c,null));};exports['show']=function(_0x3fc612,_0x434be4){var _0x42d4d6={'raw':![],'where':{'id':_0x3fc612[_0xe391('0x48')]['id']}},_0x3911b7={};_0x3911b7[_0xe391('0x35')]=_[_0xe391('0x49')](db[_0xe391('0x2e')]['rawAttributes']);_0x3911b7[_0xe391('0x33')]=_[_0xe391('0x49')](_0x3fc612[_0xe391('0x33')]);_0x3911b7['filters']=_[_0xe391('0x34')](_0x3911b7['model'],_0x3911b7[_0xe391('0x33')]);_0x42d4d6[_0xe391('0x37')]=_[_0xe391('0x34')](_0x3911b7[_0xe391('0x35')],qs[_0xe391('0x36')](_0x3fc612[_0xe391('0x33')][_0xe391('0x36')]));_0x42d4d6[_0xe391('0x37')]=_0x42d4d6['attributes'][_0xe391('0x38')]?_0x42d4d6[_0xe391('0x37')]:_0x3911b7[_0xe391('0x35')];if(_0x3fc612[_0xe391('0x33')][_0xe391('0x4a')]){_0x42d4d6[_0xe391('0x44')]=[{'all':!![]}];}_0x42d4d6=_['merge']({},_0x42d4d6,_0x3fc612['options']);return db['VoiceRecording'][_0xe391('0x4b')](_0x42d4d6)[_0xe391('0x27')](handleEntityNotFound(_0x434be4,null))[_0xe391('0x27')](respondWithResult(_0x434be4,null))[_0xe391('0x47')](handleError(_0x434be4,null));};exports['create']=function(_0x4d0f58,_0x28dbdf){return db[_0xe391('0x2e')][_0xe391('0x4c')](_0x4d0f58['body'],{})[_0xe391('0x27')](respondWithResult(_0x28dbdf,0xc9))['catch'](handleError(_0x28dbdf,null));};exports['update']=function(_0x56f093,_0x189ea9){if(_0x56f093['body']['id']){delete _0x56f093[_0xe391('0x4d')]['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x56f093[_0xe391('0x48')]['id']}})['then'](handleEntityNotFound(_0x189ea9,null))['then'](saveUpdates(_0x56f093[_0xe391('0x4d')],null))['then'](respondWithResult(_0x189ea9,null))[_0xe391('0x47')](handleError(_0x189ea9,null));};exports[_0xe391('0x4e')]=function(_0x4b4297,_0x466c0a){return db[_0xe391('0x2e')][_0xe391('0x4e')]()[_0xe391('0x27')](respondWithResult(_0x466c0a,null))[_0xe391('0x47')](handleError(_0x466c0a,null));};exports['download']=function(_0x2a7b79,_0x2252f3,_0x390910){var _0xebdbe0=require(_0xe391('0x4f'));var _0x17d57d=![];var _0x737aed={};if(_0x2a7b79[_0xe391('0x33')][_0xe391('0x30')]&&_0x2a7b79[_0xe391('0x33')]['type']==='uniqueid'){_0x737aed['uniqueid']=_0x2a7b79[_0xe391('0x48')]['id'];}else{_0x737aed['id']=_0x2a7b79[_0xe391('0x48')]['id'];}return db['VoiceRecording'][_0xe391('0x4b')]({'where':_0x737aed,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x2252f3,null))[_0xe391('0x27')](function(_0x245103){if(_0x245103){var _0x5669de=_0x245103[_0xe391('0x50')];var _0x30574b=util[_0xe391('0x32')]('%s.cypher',_0x5669de);if(fs[_0xe391('0x51')](_0x30574b)){_0x17d57d=!![];return _0xebdbe0[_0xe391('0x52')](_0x30574b,_0x5669de,config['secrets'][_0xe391('0x53')])[_0xe391('0x27')](function(){return _0x245103;});}return _0x245103;}})[_0xe391('0x27')](function(_0x4e0cbc){if(_0x4e0cbc){var _0x4b17d5=_0x4e0cbc[_0xe391('0x50')];if(!fs[_0xe391('0x51')](_0x4b17d5)){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x4e0cbc[_0xe391('0x56')]){return _0x2252f3[_0xe391('0x57')](_0x4b17d5,_0x4e0cbc[_0xe391('0x56')]+path[_0xe391('0x58')](_0x4b17d5),function(){if(_0x17d57d){fs[_0xe391('0x59')](_0x4b17d5);}});}else{return _0x2252f3[_0xe391('0x57')](_0x4b17d5,function(_0x74c10){if(_0x17d57d){fs[_0xe391('0x59')](_0x4b17d5);}});}}})['catch'](function(_0x36e819){if(_0x36e819[_0xe391('0x5a')]===_0xe391('0x5b')){_0x2252f3['status'](0x194)[_0xe391('0x5c')](_0xe391('0x5d'));}else{return handleError(_0x2252f3,null);}});};exports['downloads']=function(_0x4e75a9,_0x1f68e5,_0x458bfb){var _0x5346c8=require(_0xe391('0x4f'));var _0xc5dc26=![];var _0xedd192={'$and':[db[_0xe391('0x5e')][_0xe391('0x41')](db[_0xe391('0x5e')]['fn']('MD5',db[_0xe391('0x5e')][_0xe391('0x5f')]('uniqueid')),_0x4e75a9[_0xe391('0x33')][_0xe391('0x60')])]};if(_0x4e75a9[_0xe391('0x33')][_0xe391('0x30')]&&_0x4e75a9[_0xe391('0x33')][_0xe391('0x30')]==='uniqueid'){_0xedd192[_0xe391('0x61')][_0xe391('0x62')]({'uniqueid':_0x4e75a9[_0xe391('0x48')]['id']});}else{_0xedd192[_0xe391('0x61')][_0xe391('0x62')]({'id':_0x4e75a9['params']['id']});}return db['VoiceRecording']['find']({'where':_0xedd192,'attributes':['id','value'],'raw':!![]})[_0xe391('0x27')](handleEntityNotFound(_0x1f68e5,null))['then'](function(_0x2f5197){if(_0x2f5197){var _0xa34f85=util[_0xe391('0x32')]('%s.cypher',_0x2f5197['value']);if(fs[_0xe391('0x51')](_0xa34f85)){_0xc5dc26=!![];return _0x5346c8[_0xe391('0x52')](_0xa34f85,_0x2f5197['value'],config[_0xe391('0x63')]['recording'])['then'](function(){return _0x2f5197;});}return _0x2f5197;}})[_0xe391('0x27')](function(_0x1ee2bd){if(_0x1ee2bd){if(!fs[_0xe391('0x51')](_0x1ee2bd[_0xe391('0x50')])){throw new db[(_0xe391('0x54'))]['ValidationError'](_0xe391('0x5b'));}if(_0x1ee2bd[_0xe391('0x56')]){return _0x1f68e5[_0xe391('0x57')](_0x1ee2bd['value'],_0x1ee2bd[_0xe391('0x56')]+path['extname'](_0x1ee2bd['value']),function(){if(_0xc5dc26){fs[_0xe391('0x59')](_0x1ee2bd[_0xe391('0x50')]);}});}else{return _0x1f68e5[_0xe391('0x57')](_0x1ee2bd[_0xe391('0x50')],function(_0x284aed){if(_0xc5dc26){fs[_0xe391('0x59')](_0x1ee2bd[_0xe391('0x50')]);}});}}})[_0xe391('0x47')](handleError(_0x1f68e5,null));};exports[_0xe391('0x28')]=function(_0x5a7f54,_0x558316){return db[_0xe391('0x2e')][_0xe391('0x4b')]({'where':{'id':_0x5a7f54[_0xe391('0x48')]['id']}})[_0xe391('0x27')](function(_0x2ce3ab){if(_[_0xe391('0x64')](_0x2ce3ab)){throw new ReferenceError(_0xe391('0x65'));}return _0x2ce3ab;})[_0xe391('0x27')](function(_0x12a593){var _0xb428d9=_0x12a593[_0xe391('0x50')];logger[_0xe391('0x66')](_0xe391('0x67'),_0xb428d9);if(!_[_0xe391('0x64')](_0x12a593['value'])&&fs[_0xe391('0x51')](_0xb428d9)){logger[_0xe391('0x66')]('File:\x20\x22'+_0xb428d9+_0xe391('0x68'));fs[_0xe391('0x69')](_0xb428d9);}_0xb428d9=_0xb428d9+_0xe391('0x6a');if(!_['isNil'](_0x12a593[_0xe391('0x50')])&&fs[_0xe391('0x51')](_0xb428d9)){logger[_0xe391('0x66')](_0xe391('0x6b')+_0xb428d9+_0xe391('0x68'));fs['unlinkSync'](_0xb428d9);}return _0x12a593;})['then'](function(_0x10237e){if(!_0x10237e)throw new InternalError();return _0x10237e['destroy']();})[_0xe391('0x27')](function(){_0x558316[_0xe391('0x1b')](0xcc)[_0xe391('0x1c')]();})[_0xe391('0x47')](handleError(_0x558316,null));};function getBucketslist(_0xed65c0,_0x341a67,_0x3e9b8e){return new Promise(function(_0x49ec11,_0xbbe532){var _0xfaceba=new AWS['S3']({'accessKeyId':_0x341a67,'secretAccessKey':_0xed65c0,'region':_0x3e9b8e});_0xfaceba[_0xe391('0x6c')]({},function(_0x415f1a,_0x4e30b3){if(_0x415f1a){return _0xbbe532(_0x415f1a);}else{return _0x49ec11(_0x4e30b3);}});});}function createBucket(_0x4cefc4,_0x421511,_0x5a824b,_0x78aa6d){return new Promise(function(_0x170f03,_0x73d338){var _0x46bc33=new AWS['S3']({'accessKeyId':_0x421511,'secretAccessKey':_0x4cefc4,'region':_0x5a824b});_0x46bc33[_0xe391('0x6d')]({'Bucket':_0x78aa6d},function(_0x27e01f,_0x27a20f){if(_0x27e01f){return _0x73d338(_0x27e01f);}else{return _0x170f03(_0x27a20f);}});});}function uploadFile(_0x2252f0,_0x2fe904,_0x31f7e7,_0x8309c8,_0x5b088c,_0x19e1a7){return new Promise(function(_0x56360d,_0x19ef35){var _0x1be7c3=new AWS['S3']({'accessKeyId':_0x2fe904,'secretAccessKey':_0x2252f0,'region':_0x31f7e7});_0x1be7c3[_0xe391('0x6e')]({'Bucket':_0x8309c8,'Key':_0x5b088c,'Body':_0x19e1a7},function(_0x692fea,_0x37dd25){if(_0x692fea){return _0x19ef35(_0x692fea);}else{return _0x56360d(_0x37dd25);}});});}function startTranscribe(_0x14d725,_0x22b20e,_0xb0beee,_0x4c004f,_0x104b78,_0x844c22){return new Promise(function(_0xcde64f,_0x2d1152){var _0x46f9a2=new AWS[(_0xe391('0x6f'))]({'accessKeyId':_0x22b20e,'secretAccessKey':_0x14d725,'region':_0xb0beee});_0x46f9a2[_0xe391('0x70')]({'TranscriptionJobName':_0x4c004f,'LanguageCode':_0x104b78,'Media':{'MediaFileUri':_0x844c22}},function(_0x16cf99,_0x4217f8){if(_0x16cf99){return _0x2d1152(_0x16cf99);}else{return _0xcde64f(_0x4217f8);}});});}function transcribe(_0x1f004f,_0x44ee3c,_0x4cb724,_0x2f7cc4,_0x500c44,_0x48b81d,_0x4f0d15){return new Promise(function(_0x3bddb0,_0x1fff2c){var _0xcb2947={};logger[_0xe391('0x66')](util['format'](_0xe391('0x71'),_0x1f004f,_0x500c44));return uploadFile(_0x44ee3c,_0x4cb724,_0x2f7cc4,_0x500c44,path[_0xe391('0x72')](_0x48b81d),fs[_0xe391('0x73')](_0x48b81d))[_0xe391('0x27')](function(_0x3a1232){logger[_0xe391('0x66')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x1f004f,_0x500c44,_0x3a1232[_0xe391('0x74')]));_0xcb2947[_0xe391('0x75')]=_0x3a1232['Bucket'];_0xcb2947[_0xe391('0x76')]=_0x3a1232[_0xe391('0x74')];logger[_0xe391('0x66')](util['format'](_0xe391('0x77'),_0x1f004f));return startTranscribe(_0x44ee3c,_0x4cb724,_0x2f7cc4,uuidv4(),_0x4f0d15,_0x3a1232[_0xe391('0x74')]);})[_0xe391('0x27')](function(_0x17e893){logger[_0xe391('0x66')](util[_0xe391('0x32')](_0xe391('0x78'),_0x1f004f,_0x17e893[_0xe391('0x79')][_0xe391('0x7a')]));_0xcb2947['transcribeName']=_0x17e893[_0xe391('0x79')][_0xe391('0x7a')];_0xcb2947[_0xe391('0x7b')]=_0x17e893['TranscriptionJob'][_0xe391('0x7c')];return _0x3bddb0(_0xcb2947);})['catch'](function(_0x249392){return _0x1fff2c(_0x249392);});});}exports[_0xe391('0x7d')]=function(_0x4846f9,_0x58f759,_0x327c91){var _0x296dfc;var _0x288ae0;var _0x44e701;var _0x302a95=require('../../components/encryptor');return db[_0xe391('0x2e')][_0xe391('0x7e')]({'where':{'id':_0x4846f9[_0xe391('0x48')]['id']}})[_0xe391('0x27')](function(_0x4bc039){if(_0x4bc039){var _0x5cde86=util[_0xe391('0x32')](_0xe391('0x7f'),_0x4bc039['value']);if(fs[_0xe391('0x51')](_0x5cde86)){cypher=!![];return _0x302a95[_0xe391('0x52')](_0x5cde86,_0x4bc039[_0xe391('0x50')],config['secrets']['recording'])[_0xe391('0x27')](function(){return _0x4bc039;});}return _0x4bc039;}})[_0xe391('0x27')](function(_0x49d0c5){if(!_0x49d0c5){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))](_0xe391('0x80'));}_0x288ae0=_0x49d0c5;return db[_0xe391('0x81')][_0xe391('0x7e')]({'where':{'id':0x1}});})[_0xe391('0x27')](handleEntityNotFound(_0x58f759,null))['then'](function(_0x21eadf){if(_0x21eadf){_0x296dfc=_0x21eadf;if(!_0x296dfc[_0xe391('0x82')]||!_0x296dfc['transcribeAccountId']||!_0x296dfc['transcribeRegion']||!_0x296dfc[_0xe391('0x83')]||!_0x296dfc[_0xe391('0x75')]){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))](_0xe391('0x84'));}if(_0x4846f9[_0xe391('0x4d')][_0xe391('0x85')]&&(!_0x296dfc['sentiment']||!_0x296dfc[_0xe391('0x86')]||!_0x296dfc[_0xe391('0x87')]||!_0x296dfc[_0xe391('0x83')]||!_0x296dfc['bucket'])){throw new db[(_0xe391('0x54'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xe391('0x88')][_0xe391('0x7e')]({'where':{'id':_0x296dfc[_0xe391('0x89')]}});}})[_0xe391('0x27')](function(_0x20e3fc){if(!_0x20e3fc){throw new db[(_0xe391('0x54'))][(_0xe391('0x55'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x20e3fc[_0xe391('0x8a')]||!_0x20e3fc[_0xe391('0x8b')]){throw new db['Sequelize'][(_0xe391('0x55'))](_0xe391('0x8c'));}_0x44e701=_0x20e3fc;return getBucketslist(_0x44e701[_0xe391('0x8a')],_0x44e701[_0xe391('0x8b')],_0x296dfc[_0xe391('0x8d')]);})['then'](function(_0x57ff7c){if(_0x57ff7c&&_0x57ff7c[_0xe391('0x8e')]){var _0x5cd070=_[_0xe391('0x4b')](_0x57ff7c[_0xe391('0x8e')],function(_0x32729c){return _0x32729c[_0xe391('0x8f')]===_0x296dfc[_0xe391('0x75')];});if(!_0x5cd070){logger['info'](util[_0xe391('0x32')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x4846f9[_0xe391('0x48')]['id'],_0x296dfc[_0xe391('0x75')]));return createBucket(_0x44e701['data1'],_0x44e701[_0xe391('0x8b')],_0x296dfc[_0xe391('0x8d')],_0x296dfc[_0xe391('0x75')]);}logger[_0xe391('0x66')](util[_0xe391('0x32')](_0xe391('0x90'),_0x4846f9[_0xe391('0x48')]['id'],_0x296dfc[_0xe391('0x75')]));return;}})['then'](function(_0x3997f2){if(_0x288ae0[_0xe391('0x7b')]===_0xe391('0x91')){return transcribe(_0x4846f9[_0xe391('0x48')]['id'],_0x44e701['data1'],_0x44e701['data2'],_0x296dfc['transcribeRegion'],_0x296dfc[_0xe391('0x75')],_0x288ae0['value'],_0x296dfc['language']);}else{logger[_0xe391('0x66')](util[_0xe391('0x32')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x4846f9['params']['id']));return{'transcribeStatus':_0xe391('0x92')};}})[_0xe391('0x27')](function(_0xf33e6e){if(_0xf33e6e){_0xf33e6e[_0xe391('0x93')]=_0x4846f9['body'][_0xe391('0x85')];return _0x288ae0['updateAttributes'](_0xf33e6e);}})['then'](respondWithResult(_0x58f759,null))[_0xe391('0x47')](handleError(_0x58f759,null));};function writeFile(_0x21245d,_0x505393){return new Promise(function(_0x2960c9,_0x529a24){fs[_0xe391('0x94')](_0x505393,_0x21245d,function(_0x40db62,_0x529c85){if(_0x40db62){return _0x529a24(_0x40db62);}else{return _0x2960c9(_0x529c85);}});});}exports[_0xe391('0x95')]=function(_0x553601,_0x218afd,_0x5c8f2c){return db['VoiceRecording'][_0xe391('0x7e')]({'where':{'id':_0x553601[_0xe391('0x48')]['id']}})[_0xe391('0x27')](handleEntityNotFound(_0x218afd))['then'](function(_0x32e942){if(_0x32e942&&_0x32e942[_0xe391('0x96')]){var _0x17e25b=_0x32e942[_0xe391('0x96')];var _0x239e3b=config[_0xe391('0x97')]+_0xe391('0x98')+_0x32e942['id']+_0xe391('0x99');if(fs[_0xe391('0x51')](_0x239e3b)){return _0x239e3b;}return writeFile(_0x17e25b,_0x239e3b)[_0xe391('0x27')](function(){return _0x239e3b;});}else{throw new db['Sequelize'][(_0xe391('0x55'))]('Transcript\x20not\x20available');}})[_0xe391('0x27')](function(_0x507f50){return _0x218afd[_0xe391('0x57')](_0x507f50);})[_0xe391('0x47')](handleError(_0x218afd));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index c31e37b..6f72cba 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 _0xb2ff=['exports','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x5241f5,_0x289c4c){var _0x164f5f=function(_0x275a7b){while(--_0x275a7b){_0x5241f5['push'](_0x5241f5['shift']());}};_0x164f5f(++_0x289c4c);}(_0xb2ff,0x123));var _0xfb2f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xb2ff[_0x2641f9];return _0x585741;};'use strict';var attributes=require(_0xfb2f('0x0'));module[_0xfb2f('0x1')]=function(_0x585db4,_0x3e4c2f){return _0x585db4['define']('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xfb2f('0x2'),'fields':['uniqueid']},{'name':_0xfb2f('0x3'),'fields':[_0xfb2f('0x3')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe94a=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xe94a,0x1c7));var _0xae94=function(_0x401609,_0x5eb61d){_0x401609=_0x401609-0x0;var _0x35fd57=_0xe94a[_0x401609];return _0x35fd57;};'use strict';var attributes=require(_0xae94('0x0'));module[_0xae94('0x1')]=function(_0x1735f9,_0x59a458){return _0x1735f9[_0xae94('0x2')](_0xae94('0x3'),attributes,{'tableName':_0xae94('0x4'),'paranoid':![],'indexes':[{'name':_0xae94('0x5'),'fields':[_0xae94('0x5')]},{'name':_0xae94('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index eb4ed03..a6f3fb3 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 _0x33af=['error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','limit','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x39e177,_0x1f09d9){var _0x441aa0=function(_0x533eef){while(--_0x533eef){_0x39e177['push'](_0x39e177['shift']());}};_0x441aa0(++_0x1f09d9);}(_0x33af,0xec));var _0xf33a=function(_0x57fda8,_0x5e80a0){_0x57fda8=_0x57fda8-0x0;var _0x11c895=_0x33af[_0x57fda8];return _0x11c895;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});}exports[_0xf33a('0x15')]=function(_0x524109){var _0x2946ef=this;return new Promise(function(_0x23d9e2,_0x38d69a){return db[_0xf33a('0x16')]['update'](_0x524109[_0xf33a('0x17')],{'raw':_0x524109[_0xf33a('0x18')]?_0x524109[_0xf33a('0x18')][_0xf33a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x524109[_0xf33a('0x18')]?_0x524109[_0xf33a('0x18')][_0xf33a('0x1a')]||null:null,'attributes':_0x524109[_0xf33a('0x18')]?_0x524109[_0xf33a('0x18')][_0xf33a('0x1b')]||null:null,'limit':_0x524109['options']?_0x524109[_0xf33a('0x18')][_0xf33a('0x1c')]||null:null})[_0xf33a('0xa')](function(_0x27faa1){logger[_0xf33a('0xb')]('UpdateVoiceRecording',_0x524109);logger[_0xf33a('0xe')]('UpdateVoiceRecording',_0x524109,JSON[_0xf33a('0xf')](_0x27faa1));_0x23d9e2(_0x27faa1);})[_0xf33a('0x14')](function(_0x394468){logger[_0xf33a('0x10')](_0xf33a('0x15'),_0x394468['message'],_0x524109);_0x38d69a(_0x2946ef[_0xf33a('0x10')](0x1f4,_0x394468[_0xf33a('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x4af24a){var _0x16ef31=this;return new Promise(function(_0x5f0a53,_0x5cf981){var _0x38eba2=require('../../components/encryptor');var _0x79d653;return db['Setting'][_0xf33a('0x1d')]({'attributes':['id',_0xf33a('0x1e')],'where':{'id':0x1},'raw':!![]})[_0xf33a('0xa')](function(_0x729fca){_0x79d653=_0x729fca;return db[_0xf33a('0x16')][_0xf33a('0x1f')](_0x4af24a[_0xf33a('0x17')]);})[_0xf33a('0xa')](function(_0x26e81){if(_0x79d653[_0xf33a('0x1e')]&&fs[_0xf33a('0x20')](_0x26e81[_0xf33a('0x21')])){var _0x22c9f2=util[_0xf33a('0x22')](_0xf33a('0x23'),_0x26e81['value']);return _0x38eba2[_0xf33a('0x24')](_0x26e81[_0xf33a('0x21')],_0x22c9f2,config[_0xf33a('0x25')][_0xf33a('0x26')])['then'](function(){fs[_0xf33a('0x27')](_0x26e81[_0xf33a('0x21')]);logger[_0xf33a('0xb')](_0xf33a('0x28'));return _0x26e81;});}return _0x26e81;})[_0xf33a('0xa')](function(_0x109d84){logger['info'](_0xf33a('0x29'),_0x4af24a);logger[_0xf33a('0xe')](_0xf33a('0x29'),_0x4af24a,JSON[_0xf33a('0xf')](_0x109d84));_0x5f0a53(_0x109d84);})[_0xf33a('0x14')](function(_0x57e7be){logger['error'](_0xf33a('0x29'),_0x57e7be['message'],_0x4af24a);_0x5cf981(_0x16ef31['error'](0x1f4,_0x57e7be['message']));});});}; \ No newline at end of file +var _0xaebd=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceRecording,\x20%s,\x20%s','catch','UpdateVoiceRecording','update','options','raw','where','attributes','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','body','value','format','%s.cypher','encryptFile','recording','unlink','lodash','moment','bluebird'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x4ab015,_0x332cc4){_0x4ab015=_0x4ab015-0x0;var _0x19410d=_0xaebd[_0x4ab015];return _0x19410d;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['VoiceRecording'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5243['options']?_0x1b5243['options'][_0xdaeb('0x19')]||null:null,'attributes':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')]||null:null,'limit':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243['options']['limit']||null:null})[_0xdaeb('0xc')](function(_0x3cfcaf){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x1b')]('UpdateVoiceRecording',_0x1b5243,JSON[_0xdaeb('0x10')](_0x3cfcaf));_0x2d8f11(_0x3cfcaf);})['catch'](function(_0x130c35){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x130c35[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x130c35['message']));});});};exports[_0xdaeb('0x1c')]=function(_0x34fa21){var _0x338687=this;return new Promise(function(_0x4eb719,_0x57c2c4){var _0x43095f=require('../../components/encryptor');var _0x5045f8;return db[_0xdaeb('0x1d')][_0xdaeb('0x1e')]({'attributes':['id',_0xdaeb('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5e6f97){_0x5045f8=_0x5e6f97;return db[_0xdaeb('0x20')][_0xdaeb('0x21')](_0x34fa21[_0xdaeb('0x22')]);})['then'](function(_0x36c933){if(_0x5045f8['callRecordingEncryption']&&fs['existsSync'](_0x36c933[_0xdaeb('0x23')])){var _0x21f6cf=util[_0xdaeb('0x24')](_0xdaeb('0x25'),_0x36c933[_0xdaeb('0x23')]);return _0x43095f[_0xdaeb('0x26')](_0x36c933[_0xdaeb('0x23')],_0x21f6cf,config['secrets'][_0xdaeb('0x27')])[_0xdaeb('0xc')](function(){fs[_0xdaeb('0x28')](_0x36c933[_0xdaeb('0x23')]);logger[_0xdaeb('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x36c933;});}return _0x36c933;})[_0xdaeb('0xc')](function(_0x3de2bd){logger['info'](_0xdaeb('0x1c'),_0x34fa21);logger[_0xdaeb('0x1b')](_0xdaeb('0x1c'),_0x34fa21,JSON[_0xdaeb('0x10')](_0x3de2bd));_0x4eb719(_0x3de2bd);})[_0xdaeb('0x14')](function(_0x1628b8){logger[_0xdaeb('0x11')](_0xdaeb('0x1c'),_0x1628b8[_0xdaeb('0x12')],_0x34fa21);_0x57c2c4(_0x338687[_0xdaeb('0x11')](0x1f4,_0x1628b8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 59fa35c..cc2ac3b 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 _0x578e=['isAuthenticated','describe','/:id','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','get','/describe'];(function(_0x508819,_0x5b8588){var _0x6668b7=function(_0x143512){while(--_0x143512){_0x508819['push'](_0x508819['shift']());}};_0x6668b7(++_0x5b8588);}(_0x578e,0x15f));var _0xe578=function(_0x2f431e,_0x427aa7){_0x2f431e=_0x2f431e-0x0;var _0x297da2=_0x578e[_0x2f431e];return _0x297da2;};'use strict';var multer=require(_0xe578('0x0'));var util=require(_0xe578('0x1'));var path=require(_0xe578('0x2'));var timeout=require(_0xe578('0x3'));var express=require(_0xe578('0x4'));var router=express['Router']();var fs_extra=require(_0xe578('0x5'));var auth=require(_0xe578('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0xe578('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe578('0x7')](_0xe578('0x8'),auth[_0xe578('0x9')](),controller[_0xe578('0xa')]);router['get'](_0xe578('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe578('0xc')]('/',auth['isAuthenticated'](),controller[_0xe578('0xd')]);router[_0xe578('0xe')](_0xe578('0xb'),auth['isAuthenticated'](),controller[_0xe578('0xf')]);router['delete'](_0xe578('0xb'),auth[_0xe578('0x9')](),controller[_0xe578('0x10')]);module[_0xe578('0x11')]=router; \ No newline at end of file +var _0x72fa=['isAuthenticated','describe','/:id','show','post','put','update','destroy','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe'];(function(_0x1e477c,_0x59206c){var _0xc7f81c=function(_0x1c6b7b){while(--_0x1c6b7b){_0x1e477c['push'](_0x1e477c['shift']());}};_0xc7f81c(++_0x59206c);}(_0x72fa,0xa1));var _0xa72f=function(_0x7cce8d,_0x8d7c9c){_0x7cce8d=_0x7cce8d-0x0;var _0x381b50=_0x72fa[_0x7cce8d];return _0x381b50;};'use strict';var multer=require('multer');var util=require(_0xa72f('0x0'));var path=require(_0xa72f('0x1'));var timeout=require(_0xa72f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa72f('0x3'));var interaction=require(_0xa72f('0x4'));var config=require(_0xa72f('0x5'));var controller=require('./voiceTransferReport.controller');router[_0xa72f('0x6')]('/',auth['isAuthenticated'](),controller[_0xa72f('0x7')]);router[_0xa72f('0x6')](_0xa72f('0x8'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xa')]);router[_0xa72f('0x6')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xc')]);router[_0xa72f('0xd')]('/',auth[_0xa72f('0x9')](),controller['create']);router[_0xa72f('0xe')](_0xa72f('0xb'),auth[_0xa72f('0x9')](),controller[_0xa72f('0xf')]);router['delete'](_0xa72f('0xb'),auth['isAuthenticated'](),controller[_0xa72f('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 9d97767..d015a7b 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 _0xa166=['ENUM','blind','attended','STRING','sequelize','exports'];(function(_0x4c45ef,_0x1b574d){var _0x55a377=function(_0x2aceda){while(--_0x2aceda){_0x4c45ef['push'](_0x4c45ef['shift']());}};_0x55a377(++_0x1b574d);}(_0xa166,0x172));var _0x6a16=function(_0x8f011,_0x717e9d){_0x8f011=_0x8f011-0x0;var _0x4f0d10=_0xa166[_0x8f011];return _0x4f0d10;};'use strict';var Sequelize=require(_0x6a16('0x0'));var moment=require('moment');module[_0x6a16('0x1')]={'type':{'type':Sequelize[_0x6a16('0x2')](_0x6a16('0x3'),_0x6a16('0x4'))},'result':{'type':Sequelize[_0x6a16('0x5')]},'transfererchannel':{'type':Sequelize[_0x6a16('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x6a16('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x6a16('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x6a16('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x6a16('0x5')]},'transferercontext':{'type':Sequelize[_0x6a16('0x5')]},'transfererexten':{'type':Sequelize[_0x6a16('0x5')]},'transfererlinkedid':{'type':Sequelize[_0x6a16('0x5')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x6a16('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6a16('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x6a16('0x5')]},'transfereecontext':{'type':Sequelize[_0x6a16('0x5')]},'transfereeexten':{'type':Sequelize[_0x6a16('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x6a16('0x5')]},'isexternal':{'type':Sequelize[_0x6a16('0x2')]('Yes','No')},'context':{'type':Sequelize[_0x6a16('0x5')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a6c=['Yes','sequelize','moment','exports','ENUM','blind','STRING'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0x9a6c,0xb0));var _0xc9a6=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x9a6c[_0x13ce0c];return _0x4388fb;};'use strict';var Sequelize=require(_0xc9a6('0x0'));var moment=require(_0xc9a6('0x1'));module[_0xc9a6('0x2')]={'type':{'type':Sequelize[_0xc9a6('0x3')](_0xc9a6('0x4'),'attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xc9a6('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xc9a6('0x5')]},'transferercalleridname':{'type':Sequelize[_0xc9a6('0x5')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0xc9a6('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xc9a6('0x5')]},'transferercontext':{'type':Sequelize[_0xc9a6('0x5')]},'transfererexten':{'type':Sequelize[_0xc9a6('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xc9a6('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0xc9a6('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xc9a6('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xc9a6('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xc9a6('0x5')]},'transfereeexten':{'type':Sequelize[_0xc9a6('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xc9a6('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xc9a6('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc9a6('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c783936..4265627 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 _0x1d48=['merge','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','options','then','includeAll','findAll','rows','catch','params'];(function(_0x46dd12,_0x1ee56e){var _0x2e04f0=function(_0x1b343b){while(--_0x1b343b){_0x46dd12['push'](_0x46dd12['shift']());}};_0x2e04f0(++_0x1ee56e);}(_0x1d48,0x95));var _0x81d4=function(_0x5b5493,_0x320140){_0x5b5493=_0x5b5493-0x0;var _0x586f56=_0x1d48[_0x5b5493];return _0x586f56;};'use strict';var emlformat=require(_0x81d4('0x0'));var rimraf=require(_0x81d4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x81d4('0x2'));var rp=require(_0x81d4('0x3'));var moment=require(_0x81d4('0x4'));var BPromise=require(_0x81d4('0x5'));var Mustache=require(_0x81d4('0x6'));var util=require(_0x81d4('0x7'));var path=require(_0x81d4('0x8'));var sox=require('sox');var csv=require(_0x81d4('0x9'));var ejs=require(_0x81d4('0xa'));var fs=require('fs');var fs_extra=require(_0x81d4('0xb'));var _=require(_0x81d4('0xc'));var squel=require('squel');var crypto=require(_0x81d4('0xd'));var jsforce=require(_0x81d4('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x81d4('0x9'));var querystring=require('querystring');var Papa=require(_0x81d4('0xf'));var Redis=require(_0x81d4('0x10'));var authService=require(_0x81d4('0x11'));var qs=require(_0x81d4('0x12'));var as=require(_0x81d4('0x13'));var hardwareService=require(_0x81d4('0x14'));var logger=require('../../config/logger')(_0x81d4('0x15'));var utils=require('../../config/utils');var config=require(_0x81d4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x81d4('0x17'))['db'];function respondWithStatusCode(_0x4599ef,_0x5e72fa){_0x5e72fa=_0x5e72fa||0xcc;return function(_0x26d436){if(_0x26d436){return _0x4599ef[_0x81d4('0x18')](_0x5e72fa);}return _0x4599ef[_0x81d4('0x19')](_0x5e72fa)[_0x81d4('0x1a')]();};}function respondWithResult(_0x305127,_0x46d8fd){_0x46d8fd=_0x46d8fd||0xc8;return function(_0x5007ef){if(_0x5007ef){return _0x305127[_0x81d4('0x19')](_0x46d8fd)[_0x81d4('0x1b')](_0x5007ef);}};}function respondWithFilteredResult(_0x42bd2a,_0x1b4ffd){return function(_0x1e99b4){if(_0x1e99b4){var _0x3ce9fc=typeof _0x1b4ffd[_0x81d4('0x1c')]==='undefined'&&typeof _0x1b4ffd['limit']===_0x81d4('0x1d');var _0x4c10b9=_0x1e99b4[_0x81d4('0x1e')];var _0xe95f9d=_0x3ce9fc?0x0:_0x1b4ffd['offset'];var _0x4c23e2=_0x3ce9fc?_0x1e99b4[_0x81d4('0x1e')]:_0x1b4ffd['offset']+_0x1b4ffd[_0x81d4('0x1f')];var _0x11340f;if(_0x4c23e2>=_0x4c10b9){_0x4c23e2=_0x4c10b9;_0x11340f=0xc8;}else{_0x11340f=0xce;}_0x42bd2a[_0x81d4('0x19')](_0x11340f);return _0x42bd2a[_0x81d4('0x20')](_0x81d4('0x21'),_0xe95f9d+'-'+_0x4c23e2+'/'+_0x4c10b9)['json'](_0x1e99b4);}return null;};}function patchUpdates(_0x1032bb){return function(_0x2fcced){try{jsonpatch['apply'](_0x2fcced,_0x1032bb,!![]);}catch(_0x3e499a){return BPromise[_0x81d4('0x22')](_0x3e499a);}return _0x2fcced['save']();};}function saveUpdates(_0xc2aa08,_0x3cc515){return function(_0x3f1b45){if(_0x3f1b45){return _0x3f1b45[_0x81d4('0x23')](_0xc2aa08)['then'](function(_0x467fe7){return _0x467fe7;});}return null;};}function removeEntity(_0x4a2657,_0x36d740){return function(_0x23cac5){if(_0x23cac5){return _0x23cac5[_0x81d4('0x24')]()['then'](function(){_0x4a2657[_0x81d4('0x19')](0xcc)[_0x81d4('0x1a')]();});}};}function handleEntityNotFound(_0x22b1f6,_0x314652){return function(_0x147dae){if(!_0x147dae){_0x22b1f6[_0x81d4('0x18')](0x194);}return _0x147dae;};}function handleError(_0x44aa97,_0x48a79e){_0x48a79e=_0x48a79e||0x1f4;return function(_0x2fb1bc){logger[_0x81d4('0x25')](_0x2fb1bc[_0x81d4('0x26')]);if(_0x2fb1bc[_0x81d4('0x27')]){delete _0x2fb1bc[_0x81d4('0x27')];}_0x44aa97[_0x81d4('0x19')](_0x48a79e)[_0x81d4('0x28')](_0x2fb1bc);};}exports['index']=function(_0x42c54c,_0x23ff6c){var _0xc555c1={},_0x16ed9e={},_0x470f17={'count':0x0,'rows':[]};var _0x3e8157=_[_0x81d4('0x29')](db[_0x81d4('0x2a')][_0x81d4('0x2b')],function(_0x21408b){return{'name':_0x21408b[_0x81d4('0x2c')],'type':_0x21408b[_0x81d4('0x2d')][_0x81d4('0x2e')]};});_0x16ed9e[_0x81d4('0x2f')]=_[_0x81d4('0x29')](_0x3e8157,_0x81d4('0x27'));_0x16ed9e['query']=_[_0x81d4('0x30')](_0x42c54c[_0x81d4('0x31')]);_0x16ed9e[_0x81d4('0x32')]=_[_0x81d4('0x33')](_0x16ed9e[_0x81d4('0x2f')],_0x16ed9e[_0x81d4('0x31')]);_0xc555c1['attributes']=_['intersection'](_0x16ed9e[_0x81d4('0x2f')],qs[_0x81d4('0x34')](_0x42c54c[_0x81d4('0x31')][_0x81d4('0x34')]));_0xc555c1[_0x81d4('0x35')]=_0xc555c1['attributes'][_0x81d4('0x36')]?_0xc555c1[_0x81d4('0x35')]:_0x16ed9e['model'];if(!_0x42c54c[_0x81d4('0x31')][_0x81d4('0x37')](_0x81d4('0x38'))){_0xc555c1[_0x81d4('0x1f')]=qs[_0x81d4('0x1f')](_0x42c54c['query'][_0x81d4('0x1f')]);_0xc555c1[_0x81d4('0x1c')]=qs[_0x81d4('0x1c')](_0x42c54c['query']['offset']);}_0xc555c1[_0x81d4('0x39')]=qs[_0x81d4('0x3a')](_0x42c54c[_0x81d4('0x31')]['sort']);_0xc555c1[_0x81d4('0x3b')]=qs[_0x81d4('0x32')](_['pick'](_0x42c54c[_0x81d4('0x31')],_0x16ed9e['filters']),_0x3e8157);if(_0x42c54c[_0x81d4('0x31')]['filter']){_0xc555c1[_0x81d4('0x3b')]=_['merge'](_0xc555c1[_0x81d4('0x3b')],{'$or':_['map'](_0x3e8157,function(_0x375874){if(_0x375874[_0x81d4('0x2d')]!=='VIRTUAL'){var _0x15007f={};_0x15007f[_0x375874[_0x81d4('0x27')]]={'$like':'%'+_0x42c54c['query']['filter']+'%'};return _0x15007f;}})});}_0xc555c1=_['merge']({},_0xc555c1,_0x42c54c[_0x81d4('0x3c')]);var _0x588b9b={'where':_0xc555c1[_0x81d4('0x3b')]};return db[_0x81d4('0x2a')]['count'](_0x588b9b)[_0x81d4('0x3d')](function(_0x4647c6){_0x470f17['count']=_0x4647c6;if(_0x42c54c[_0x81d4('0x31')][_0x81d4('0x3e')]){_0xc555c1['include']=[{'all':!![]}];}return db['VoiceTransferReport'][_0x81d4('0x3f')](_0xc555c1);})[_0x81d4('0x3d')](function(_0x30c6e5){_0x470f17[_0x81d4('0x40')]=_0x30c6e5;return _0x470f17;})[_0x81d4('0x3d')](respondWithFilteredResult(_0x23ff6c,_0xc555c1))[_0x81d4('0x41')](handleError(_0x23ff6c,null));};exports['show']=function(_0x52a2ad,_0x1d8e10){var _0x1d3b1a={'raw':!![],'where':{'id':_0x52a2ad[_0x81d4('0x42')]['id']}},_0x2b6201={};_0x2b6201[_0x81d4('0x2f')]=_['keys'](db['VoiceTransferReport'][_0x81d4('0x2b')]);_0x2b6201[_0x81d4('0x31')]=_[_0x81d4('0x30')](_0x52a2ad[_0x81d4('0x31')]);_0x2b6201[_0x81d4('0x32')]=_[_0x81d4('0x33')](_0x2b6201[_0x81d4('0x2f')],_0x2b6201[_0x81d4('0x31')]);_0x1d3b1a[_0x81d4('0x35')]=_[_0x81d4('0x33')](_0x2b6201[_0x81d4('0x2f')],qs[_0x81d4('0x34')](_0x52a2ad[_0x81d4('0x31')]['fields']));_0x1d3b1a[_0x81d4('0x35')]=_0x1d3b1a[_0x81d4('0x35')][_0x81d4('0x36')]?_0x1d3b1a[_0x81d4('0x35')]:_0x2b6201[_0x81d4('0x2f')];if(_0x52a2ad[_0x81d4('0x31')][_0x81d4('0x3e')]){_0x1d3b1a['include']=[{'all':!![]}];}_0x1d3b1a=_[_0x81d4('0x43')]({},_0x1d3b1a,_0x52a2ad[_0x81d4('0x3c')]);return db[_0x81d4('0x2a')][_0x81d4('0x44')](_0x1d3b1a)[_0x81d4('0x3d')](handleEntityNotFound(_0x1d8e10,null))[_0x81d4('0x3d')](respondWithResult(_0x1d8e10,null))[_0x81d4('0x41')](handleError(_0x1d8e10,null));};exports[_0x81d4('0x45')]=function(_0x5a9536,_0x581abe){return db['VoiceTransferReport']['create'](_0x5a9536[_0x81d4('0x46')],{})[_0x81d4('0x3d')](respondWithResult(_0x581abe,0xc9))['catch'](handleError(_0x581abe,null));};exports[_0x81d4('0x23')]=function(_0x596bbf,_0x349717){if(_0x596bbf[_0x81d4('0x46')]['id']){delete _0x596bbf['body']['id'];}return db[_0x81d4('0x2a')]['find']({'where':{'id':_0x596bbf[_0x81d4('0x42')]['id']}})[_0x81d4('0x3d')](handleEntityNotFound(_0x349717,null))[_0x81d4('0x3d')](saveUpdates(_0x596bbf[_0x81d4('0x46')],null))['then'](respondWithResult(_0x349717,null))[_0x81d4('0x41')](handleError(_0x349717,null));};exports['destroy']=function(_0x1ab44f,_0x3d9fe0){return db['VoiceTransferReport'][_0x81d4('0x44')]({'where':{'id':_0x1ab44f['params']['id']}})[_0x81d4('0x3d')](handleEntityNotFound(_0x3d9fe0,null))[_0x81d4('0x3d')](removeEntity(_0x3d9fe0,null))[_0x81d4('0x41')](handleError(_0x3d9fe0,null));};exports[_0x81d4('0x47')]=function(_0x1e08b3,_0x4e0e62){return db[_0x81d4('0x2a')][_0x81d4('0x47')]()[_0x81d4('0x3d')](respondWithResult(_0x4e0e62,null))['catch'](handleError(_0x4e0e62,null));}; \ No newline at end of file +var _0x693d=['stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error'];(function(_0x53dc28,_0x1bcd5b){var _0x135dac=function(_0x1ac2a7){while(--_0x1ac2a7){_0x53dc28['push'](_0x53dc28['shift']());}};_0x135dac(++_0x1bcd5b);}(_0x693d,0xbd));var _0xd693=function(_0x50cb13,_0x41a8c2){_0x50cb13=_0x50cb13-0x0;var _0x3301e7=_0x693d[_0x50cb13];return _0x3301e7;};'use strict';var emlformat=require(_0xd693('0x0'));var rimraf=require(_0xd693('0x1'));var zipdir=require(_0xd693('0x2'));var jsonpatch=require(_0xd693('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd693('0x4'));var Mustache=require(_0xd693('0x5'));var util=require(_0xd693('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(_0xd693('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd693('0x8'));var jsforce=require(_0xd693('0x9'));var deskjs=require(_0xd693('0xa'));var toCsv=require(_0xd693('0xb'));var querystring=require(_0xd693('0xc'));var Papa=require(_0xd693('0xd'));var Redis=require(_0xd693('0xe'));var authService=require(_0xd693('0xf'));var qs=require(_0xd693('0x10'));var as=require(_0xd693('0x11'));var hardwareService=require(_0xd693('0x12'));var logger=require(_0xd693('0x13'))(_0xd693('0x14'));var utils=require(_0xd693('0x15'));var config=require(_0xd693('0x16'));var licenseUtil=require(_0xd693('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x587705,_0x10e9f6){_0x10e9f6=_0x10e9f6||0xcc;return function(_0x21c0c3){if(_0x21c0c3){return _0x587705[_0xd693('0x18')](_0x10e9f6);}return _0x587705[_0xd693('0x19')](_0x10e9f6)[_0xd693('0x1a')]();};}function respondWithResult(_0x302316,_0x33b1a1){_0x33b1a1=_0x33b1a1||0xc8;return function(_0x52ef71){if(_0x52ef71){return _0x302316['status'](_0x33b1a1)[_0xd693('0x1b')](_0x52ef71);}};}function respondWithFilteredResult(_0x8414b6,_0xa8e57f){return function(_0xef9ab2){if(_0xef9ab2){var _0x1a67ea=typeof _0xa8e57f[_0xd693('0x1c')]===_0xd693('0x1d')&&typeof _0xa8e57f[_0xd693('0x1e')]===_0xd693('0x1d');var _0xbb83c9=_0xef9ab2[_0xd693('0x1f')];var _0x297ecd=_0x1a67ea?0x0:_0xa8e57f[_0xd693('0x1c')];var _0x326458=_0x1a67ea?_0xef9ab2[_0xd693('0x1f')]:_0xa8e57f[_0xd693('0x1c')]+_0xa8e57f['limit'];var _0x2f16fb;if(_0x326458>=_0xbb83c9){_0x326458=_0xbb83c9;_0x2f16fb=0xc8;}else{_0x2f16fb=0xce;}_0x8414b6['status'](_0x2f16fb);return _0x8414b6[_0xd693('0x20')]('Content-Range',_0x297ecd+'-'+_0x326458+'/'+_0xbb83c9)[_0xd693('0x1b')](_0xef9ab2);}return null;};}function patchUpdates(_0x590002){return function(_0x44a0f8){try{jsonpatch[_0xd693('0x21')](_0x44a0f8,_0x590002,!![]);}catch(_0x13c95b){return BPromise[_0xd693('0x22')](_0x13c95b);}return _0x44a0f8[_0xd693('0x23')]();};}function saveUpdates(_0x5a84fd,_0x2abbb6){return function(_0x542662){if(_0x542662){return _0x542662[_0xd693('0x24')](_0x5a84fd)[_0xd693('0x25')](function(_0x668ff3){return _0x668ff3;});}return null;};}function removeEntity(_0x20a1fa,_0x5c012c){return function(_0xce90b1){if(_0xce90b1){return _0xce90b1['destroy']()[_0xd693('0x25')](function(){_0x20a1fa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49dd7a,_0x89dbd9){return function(_0x49fc22){if(!_0x49fc22){_0x49dd7a[_0xd693('0x18')](0x194);}return _0x49fc22;};}function handleError(_0x1a2725,_0x39d218){_0x39d218=_0x39d218||0x1f4;return function(_0x15feca){logger[_0xd693('0x26')](_0x15feca[_0xd693('0x27')]);if(_0x15feca[_0xd693('0x28')]){delete _0x15feca[_0xd693('0x28')];}_0x1a2725[_0xd693('0x19')](_0x39d218)[_0xd693('0x29')](_0x15feca);};}exports['index']=function(_0x140657,_0x34d17a){var _0xb27d96={},_0x474d2b={},_0x5a26fc={'count':0x0,'rows':[]};var _0x3737e0=_[_0xd693('0x2a')](db[_0xd693('0x2b')][_0xd693('0x2c')],function(_0x4c48dd){return{'name':_0x4c48dd[_0xd693('0x2d')],'type':_0x4c48dd[_0xd693('0x2e')]['key']};});_0x474d2b[_0xd693('0x2f')]=_[_0xd693('0x2a')](_0x3737e0,_0xd693('0x28'));_0x474d2b['query']=_[_0xd693('0x30')](_0x140657[_0xd693('0x31')]);_0x474d2b[_0xd693('0x32')]=_['intersection'](_0x474d2b['model'],_0x474d2b['query']);_0xb27d96[_0xd693('0x33')]=_[_0xd693('0x34')](_0x474d2b[_0xd693('0x2f')],qs[_0xd693('0x35')](_0x140657[_0xd693('0x31')][_0xd693('0x35')]));_0xb27d96['attributes']=_0xb27d96[_0xd693('0x33')]['length']?_0xb27d96[_0xd693('0x33')]:_0x474d2b['model'];if(!_0x140657[_0xd693('0x31')][_0xd693('0x36')](_0xd693('0x37'))){_0xb27d96['limit']=qs[_0xd693('0x1e')](_0x140657[_0xd693('0x31')][_0xd693('0x1e')]);_0xb27d96['offset']=qs[_0xd693('0x1c')](_0x140657[_0xd693('0x31')][_0xd693('0x1c')]);}_0xb27d96[_0xd693('0x38')]=qs[_0xd693('0x39')](_0x140657[_0xd693('0x31')][_0xd693('0x39')]);_0xb27d96[_0xd693('0x3a')]=qs['filters'](_[_0xd693('0x3b')](_0x140657[_0xd693('0x31')],_0x474d2b[_0xd693('0x32')]),_0x3737e0);if(_0x140657[_0xd693('0x31')]['filter']){_0xb27d96[_0xd693('0x3a')]=_[_0xd693('0x3c')](_0xb27d96[_0xd693('0x3a')],{'$or':_[_0xd693('0x2a')](_0x3737e0,function(_0x2e81ee){if(_0x2e81ee[_0xd693('0x2e')]!==_0xd693('0x3d')){var _0x3d7bab={};_0x3d7bab[_0x2e81ee['name']]={'$like':'%'+_0x140657['query'][_0xd693('0x3e')]+'%'};return _0x3d7bab;}})});}_0xb27d96=_[_0xd693('0x3c')]({},_0xb27d96,_0x140657[_0xd693('0x3f')]);var _0x3bb8e3={'where':_0xb27d96[_0xd693('0x3a')]};return db[_0xd693('0x2b')]['count'](_0x3bb8e3)[_0xd693('0x25')](function(_0x143b9b){_0x5a26fc[_0xd693('0x1f')]=_0x143b9b;if(_0x140657[_0xd693('0x31')][_0xd693('0x40')]){_0xb27d96[_0xd693('0x41')]=[{'all':!![]}];}return db[_0xd693('0x2b')][_0xd693('0x42')](_0xb27d96);})[_0xd693('0x25')](function(_0x2fc785){_0x5a26fc[_0xd693('0x43')]=_0x2fc785;return _0x5a26fc;})[_0xd693('0x25')](respondWithFilteredResult(_0x34d17a,_0xb27d96))[_0xd693('0x44')](handleError(_0x34d17a,null));};exports['show']=function(_0x2bf49f,_0x16fdd9){var _0x1a987c={'raw':!![],'where':{'id':_0x2bf49f['params']['id']}},_0x3da8c5={};_0x3da8c5['model']=_[_0xd693('0x30')](db[_0xd693('0x2b')][_0xd693('0x2c')]);_0x3da8c5['query']=_[_0xd693('0x30')](_0x2bf49f[_0xd693('0x31')]);_0x3da8c5[_0xd693('0x32')]=_[_0xd693('0x34')](_0x3da8c5[_0xd693('0x2f')],_0x3da8c5[_0xd693('0x31')]);_0x1a987c[_0xd693('0x33')]=_[_0xd693('0x34')](_0x3da8c5[_0xd693('0x2f')],qs[_0xd693('0x35')](_0x2bf49f[_0xd693('0x31')][_0xd693('0x35')]));_0x1a987c[_0xd693('0x33')]=_0x1a987c[_0xd693('0x33')][_0xd693('0x45')]?_0x1a987c[_0xd693('0x33')]:_0x3da8c5['model'];if(_0x2bf49f[_0xd693('0x31')][_0xd693('0x40')]){_0x1a987c[_0xd693('0x41')]=[{'all':!![]}];}_0x1a987c=_['merge']({},_0x1a987c,_0x2bf49f[_0xd693('0x3f')]);return db['VoiceTransferReport'][_0xd693('0x46')](_0x1a987c)[_0xd693('0x25')](handleEntityNotFound(_0x16fdd9,null))[_0xd693('0x25')](respondWithResult(_0x16fdd9,null))[_0xd693('0x44')](handleError(_0x16fdd9,null));};exports[_0xd693('0x47')]=function(_0x401ea0,_0x449cbd){return db[_0xd693('0x2b')][_0xd693('0x47')](_0x401ea0[_0xd693('0x48')],{})['then'](respondWithResult(_0x449cbd,0xc9))[_0xd693('0x44')](handleError(_0x449cbd,null));};exports[_0xd693('0x24')]=function(_0x1ccd64,_0x3ee0cf){if(_0x1ccd64[_0xd693('0x48')]['id']){delete _0x1ccd64[_0xd693('0x48')]['id'];}return db[_0xd693('0x2b')][_0xd693('0x46')]({'where':{'id':_0x1ccd64[_0xd693('0x49')]['id']}})[_0xd693('0x25')](handleEntityNotFound(_0x3ee0cf,null))[_0xd693('0x25')](saveUpdates(_0x1ccd64[_0xd693('0x48')],null))[_0xd693('0x25')](respondWithResult(_0x3ee0cf,null))[_0xd693('0x44')](handleError(_0x3ee0cf,null));};exports[_0xd693('0x4a')]=function(_0x1f7836,_0x361f87){return db[_0xd693('0x2b')][_0xd693('0x46')]({'where':{'id':_0x1f7836[_0xd693('0x49')]['id']}})['then'](handleEntityNotFound(_0x361f87,null))[_0xd693('0x25')](removeEntity(_0x361f87,null))['catch'](handleError(_0x361f87,null));};exports[_0xd693('0x4b')]=function(_0x222ba8,_0x1cf01b){return db[_0xd693('0x2b')][_0xd693('0x4b')]()['then'](respondWithResult(_0x1cf01b,null))[_0xd693('0x44')](handleError(_0x1cf01b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 7303e5b..6e5ded7 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 _0x865d=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x865d,0xa2));var _0xd865=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x865d[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xd865('0x0'));var util=require(_0xd865('0x1'));var logger=require(_0xd865('0x2'))(_0xd865('0x3'));var moment=require(_0xd865('0x4'));var BPromise=require(_0xd865('0x5'));var rp=require(_0xd865('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd865('0x7'));var config=require(_0xd865('0x8'));var attributes=require(_0xd865('0x9'));module[_0xd865('0xa')]=function(_0x381134,_0x1dd7aa){return _0x381134[_0xd865('0xb')](_0xd865('0xc'),attributes,{'tableName':_0xd865('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc9a3=['util','../../config/logger','api','path','exports','define','report_call_transfer','lodash'];(function(_0x5b9b6,_0x26aa24){var _0x2b498f=function(_0x1592ff){while(--_0x1592ff){_0x5b9b6['push'](_0x5b9b6['shift']());}};_0x2b498f(++_0x26aa24);}(_0xc9a3,0x167));var _0x3c9a=function(_0x17695e,_0x452a8c){_0x17695e=_0x17695e-0x0;var _0x140631=_0xc9a3[_0x17695e];return _0x140631;};'use strict';var _=require(_0x3c9a('0x0'));var util=require(_0x3c9a('0x1'));var logger=require(_0x3c9a('0x2'))(_0x3c9a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c9a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0x3c9a('0x5')]=function(_0x38a2b8,_0xaac1aa){return _0x38a2b8[_0x3c9a('0x6')]('VoiceTransferReport',attributes,{'tableName':_0x3c9a('0x7'),'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 c178511..96a864c 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 _0x9fe5=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','debug'];(function(_0x1c5164,_0x3556a4){var _0x12e023=function(_0x334429){while(--_0x334429){_0x1c5164['push'](_0x1c5164['shift']());}};_0x12e023(++_0x3556a4);}(_0x9fe5,0x138));var _0x59fe=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x9fe5[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x59fe('0x0'));var moment=require(_0x59fe('0x1'));var BPromise=require(_0x59fe('0x2'));var rs=require(_0x59fe('0x3'));var fs=require('fs');var Redis=require(_0x59fe('0x4'));var db=require(_0x59fe('0x5'))['db'];var utils=require(_0x59fe('0x6'));var logger=require('../../config/logger')(_0x59fe('0x7'));var config=require(_0x59fe('0x8'));var jayson=require(_0x59fe('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1af3f0,_0x5005b4,_0x559362){return new BPromise(function(_0x285358,_0x2030a7){return client['request'](_0x1af3f0,_0x559362)['then'](function(_0x4ea7af){logger[_0x59fe('0xa')](_0x59fe('0xb'),_0x5005b4,_0x59fe('0xc'));logger['debug'](_0x59fe('0xd'),_0x5005b4,'request\x20sent',JSON[_0x59fe('0xe')](_0x4ea7af));if(_0x4ea7af[_0x59fe('0xf')]){if(_0x4ea7af[_0x59fe('0xf')][_0x59fe('0x10')]===0x1f4){logger[_0x59fe('0xf')](_0x59fe('0xb'),_0x5005b4,_0x4ea7af[_0x59fe('0xf')][_0x59fe('0x11')]);return _0x2030a7(_0x4ea7af[_0x59fe('0xf')]['message']);}logger[_0x59fe('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x5005b4,_0x4ea7af['error'][_0x59fe('0x11')]);return _0x285358(_0x4ea7af['error'][_0x59fe('0x11')]);}else{logger[_0x59fe('0xa')](_0x59fe('0xb'),_0x5005b4,_0x59fe('0xc'));_0x285358(_0x4ea7af['result'][_0x59fe('0x11')]);}})[_0x59fe('0x12')](function(_0xbd21cc){logger['error'](_0x59fe('0xb'),_0x5005b4,_0xbd21cc);_0x2030a7(_0xbd21cc);});});}exports[_0x59fe('0x13')]=function(_0x5218c3){var _0x55e3aa=this;return new Promise(function(_0x53a60b,_0x2569b9){return db[_0x59fe('0x14')][_0x59fe('0x15')](_0x5218c3['body'],{'raw':_0x5218c3[_0x59fe('0x16')]?_0x5218c3['options'][_0x59fe('0x17')]===undefined?!![]:![]:!![]})[_0x59fe('0x18')](function(_0x45727b){logger['info']('CreateVoiceTransferReport',_0x5218c3);logger[_0x59fe('0x19')](_0x59fe('0x13'),_0x5218c3,JSON[_0x59fe('0xe')](_0x45727b));_0x53a60b(_0x45727b);})[_0x59fe('0x12')](function(_0x21ca46){logger[_0x59fe('0xf')](_0x59fe('0x13'),_0x21ca46[_0x59fe('0x11')],_0x5218c3);_0x2569b9(_0x55e3aa['error'](0x1f4,_0x21ca46[_0x59fe('0x11')]));});});}; \ No newline at end of file +var _0xeda4=['request\x20sent','debug','stringify','code','message','error','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0xeda4,0x1f4));var _0x4eda=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xeda4[_0x2d4661];return _0x42ed1e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4eda('0x0'));var BPromise=require(_0x4eda('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4eda('0x2'));var db=require(_0x4eda('0x3'))['db'];var utils=require(_0x4eda('0x4'));var logger=require('../../config/logger')(_0x4eda('0x5'));var config=require(_0x4eda('0x6'));var jayson=require(_0x4eda('0x7'));var client=jayson[_0x4eda('0x8')][_0x4eda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbf0f4a,_0x419b20,_0x2e6059){return new BPromise(function(_0x3c6ea4,_0x155e87){return client['request'](_0xbf0f4a,_0x2e6059)[_0x4eda('0xa')](function(_0x18bbbd){logger[_0x4eda('0xb')](_0x4eda('0xc'),_0x419b20,_0x4eda('0xd'));logger[_0x4eda('0xe')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x419b20,_0x4eda('0xd'),JSON[_0x4eda('0xf')](_0x18bbbd));if(_0x18bbbd['error']){if(_0x18bbbd['error'][_0x4eda('0x10')]===0x1f4){logger['error'](_0x4eda('0xc'),_0x419b20,_0x18bbbd['error'][_0x4eda('0x11')]);return _0x155e87(_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);}logger[_0x4eda('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x419b20,_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);return _0x3c6ea4(_0x18bbbd[_0x4eda('0x12')][_0x4eda('0x11')]);}else{logger[_0x4eda('0xb')](_0x4eda('0xc'),_0x419b20,'request\x20sent');_0x3c6ea4(_0x18bbbd[_0x4eda('0x13')][_0x4eda('0x11')]);}})[_0x4eda('0x14')](function(_0x4ce221){logger[_0x4eda('0x12')](_0x4eda('0xc'),_0x419b20,_0x4ce221);_0x155e87(_0x4ce221);});});}exports[_0x4eda('0x15')]=function(_0x5b547a){var _0x1f6e8d=this;return new Promise(function(_0x192f31,_0x2fe041){return db[_0x4eda('0x16')][_0x4eda('0x17')](_0x5b547a[_0x4eda('0x18')],{'raw':_0x5b547a[_0x4eda('0x19')]?_0x5b547a['options'][_0x4eda('0x1a')]===undefined?!![]:![]:!![]})[_0x4eda('0xa')](function(_0x25fa5f){logger['info']('CreateVoiceTransferReport',_0x5b547a);logger['debug'](_0x4eda('0x15'),_0x5b547a,JSON[_0x4eda('0xf')](_0x25fa5f));_0x192f31(_0x25fa5f);})['catch'](function(_0x4cda3d){logger[_0x4eda('0x12')](_0x4eda('0x15'),_0x4cda3d['message'],_0x5b547a);_0x2fe041(_0x1f6e8d[_0x4eda('0x12')](0x1f4,_0x4cda3d[_0x4eda('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index c39dbf4..3b05b1b 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 _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x287993,_0x1df7c0){var _0x12d353=function(_0x38b7f9){while(--_0x38b7f9){_0x287993['push'](_0x287993['shift']());}};_0x12d353(++_0x1df7c0);}(_0x9f62,0x154));var _0x29f6=function(_0x509238,_0x24e9ab){_0x509238=_0x509238-0x0;var _0x5b576b=_0x9f62[_0x509238];return _0x5b576b;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file +var _0xf109=['/transfer','transfer','express','Router','../../components/auth/service','isAuthenticated','isWebrtcLicence','originate','post','/hangup','hangup','/answer','answer','/hold','/unhold','/calls','calls'];(function(_0x4a12cd,_0x570626){var _0x47bc3e=function(_0x3ee936){while(--_0x3ee936){_0x4a12cd['push'](_0x4a12cd['shift']());}};_0x47bc3e(++_0x570626);}(_0xf109,0xce));var _0x9f10=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xf109[_0x20ef64];return _0x3707d8;};'use strict';var express=require(_0x9f10('0x0'));var router=express[_0x9f10('0x1')]();var auth=require(_0x9f10('0x2'));var controller=require('./webbar.controller');router['post']('/originate',auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x5')]);router[_0x9f10('0x6')](_0x9f10('0x7'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x8')]);router[_0x9f10('0x6')](_0x9f10('0x9'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xa')]);router[_0x9f10('0x6')](_0x9f10('0xb'),auth[_0x9f10('0x3')](),auth[_0x9f10('0x4')](),controller['hold']);router[_0x9f10('0x6')](_0x9f10('0xc'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller['unhold']);router[_0x9f10('0x6')](_0x9f10('0xd'),auth[_0x9f10('0x3')](),auth['isWebrtcLicence'](),controller[_0x9f10('0xe')]);router[_0x9f10('0x6')](_0x9f10('0xf'),auth['isAuthenticated'](),auth[_0x9f10('0x4')](),controller[_0x9f10('0x10')]);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 5da31c9..e02362e 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 _0x76dc=['agent','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','originate','info','body','length','json','userId','callerId','format','user:%s','webbar:originate','originate\x20executed!','hangup','entityFound:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','calls','filter','conference\x20fired:','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','ioredis','redis','defaults','socket.io-emitter','validate','string','callNumber\x20is\x20required','userId\x20is\x20required','number','sessionId\x20is\x20required','transferNumber\x20is\x20required','emit','log','handleError:','stack','name','status','send','NotFound','request','then','error','code','message','catch','User','findOne'];(function(_0x3bf508,_0x3ed90d){var _0x166502=function(_0x4acc8b){while(--_0x4acc8b){_0x3bf508['push'](_0x3bf508['shift']());}};_0x166502(++_0x3ed90d);}(_0x76dc,0x1f2));var _0xc76d=function(_0x50d145,_0x4bab6e){_0x50d145=_0x50d145-0x0;var _0x549748=_0x76dc[_0x50d145];return _0x549748;};'use strict';var path=require(_0xc76d('0x0'));var fs=require('fs');var _=require(_0xc76d('0x1'));var db=require(_0xc76d('0x2'))['db'];var config=require(_0xc76d('0x3'));var util=require('util');var BPromise=require(_0xc76d('0x4'));var jayson=require(_0xc76d('0x5'));var amiClient=jayson['client'][_0xc76d('0x6')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require(_0xc76d('0x7'));config[_0xc76d('0x8')]=_[_0xc76d('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc76d('0xa'))(new Redis(config[_0xc76d('0x8')]));var Schema=require(_0xc76d('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0xd')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xc76d('0xc')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x10')]},'transferNumber':{'type':_0xc76d('0xc'),'required':[!![],_0xc76d('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]},'sessionId':{'type':_0xc76d('0xc'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc76d('0xe')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc76d('0xf'),'required':[!![],_0xc76d('0xe')]}});function emit(_0x6f94e,_0x5c680c,_0x32e0a8){logger['info'](_0x6f94e,_0x5c680c,JSON['stringify'](_0x32e0a8));io['to'](_0x6f94e)[_0xc76d('0x12')](_0x5c680c,_0x32e0a8);}function handleError(_0x31b032){return function(_0x339623){console[_0xc76d('0x13')](_0xc76d('0x14'),_0x339623,_0x339623 instanceof RangeError);logger['error'](_0x339623[_0xc76d('0x15')]);if(_0x339623 instanceof RangeError){if(_0x339623[_0xc76d('0x16')]){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x194)[_0xc76d('0x18')](_0x339623);}else{if(_0x339623['name']){delete _0x339623[_0xc76d('0x16')];}_0x31b032[_0xc76d('0x17')](0x1f4)['send'](_0x339623);}};}function checkError(){return function(_0x455371){if(!_0x455371){throw new RangeError(_0xc76d('0x19'));}return _0x455371;};}function respondWithRpcPromise(_0x191e97,_0xb89876){return new BPromise(function(_0x18f546,_0x3d357b){var _0x42b89c=amiClient;return _0x42b89c[_0xc76d('0x1a')](_0x191e97,_0xb89876)[_0xc76d('0x1b')](function(_0x20e09c){if(_0x20e09c[_0xc76d('0x1c')]){if(_0x20e09c['error'][_0xc76d('0x1d')]===0x1f4){return _0x3d357b(_0x20e09c[_0xc76d('0x1c')]['message']);}return _0x18f546(_0x20e09c[_0xc76d('0x1c')][_0xc76d('0x1e')]);}else{_0x18f546(_0x20e09c['result']);}})[_0xc76d('0x1f')](function(_0x476aee){_0x3d357b(_0x476aee);});});}function getAgent(_0x2cd06e){return db[_0xc76d('0x20')][_0xc76d('0x21')]({'where':{'id':_0x2cd06e,'role':_0xc76d('0x22')}})[_0xc76d('0x1b')](checkError());}function getAgentCheckSession(_0x59ebd1,_0x59dabf){return new BPromise(function(_0x285430,_0x287ae4){var _0x5069ea=respondWithRpcPromise(_0xc76d('0x23'));var _0x52a79a=getAgent(_0x59ebd1);Promise[_0xc76d('0x24')]([_0x5069ea,_0x52a79a])['then'](function(_0x2039f4){var _0x5cf2e4=_0x2039f4[0x0];var _0x13b468=_0x2039f4[0x1];var _0x18a7fa=_['filter'](_0x5cf2e4[_0xc76d('0x25')],function(_0x1c68f3){return _0x1c68f3[_0xc76d('0x26')]==_0x13b468['id']&&_0x1c68f3[_0xc76d('0x27')]==_0x59dabf;});if(_0x18a7fa['length']==0x1){_0x285430(_0x13b468);}else{_0x287ae4(new RangeError(_0xc76d('0x28')+_0x59dabf+'\x20not\x20found!'));}});});}exports[_0xc76d('0x29')]=function(_0x5e9233,_0x30769f){logger[_0xc76d('0x2a')]('originate\x20fired:',_0x5e9233['body']);var _0x5eca19=originateValidation['validate'](_0x5e9233[_0xc76d('0x2b')]);if(_0x5eca19[_0xc76d('0x2c')]>0x0){return _0x30769f[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x5eca19);}var _0x1b2ed1=_0x5e9233['body'][_0xc76d('0x2e')];var _0x55e825=_0x5e9233[_0xc76d('0x2b')]['callNumber'];var _0x1bef44=_0x5e9233[_0xc76d('0x2b')][_0xc76d('0x2f')];var _0x20fe33=_0x5e9233[_0xc76d('0x2b')]['callbackUrl'];return getAgent(_0x1b2ed1)[_0xc76d('0x1b')](function(_0x371306){logger[_0xc76d('0x2a')]('entityFound:',_0x371306[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x371306['name']),_0xc76d('0x32'),{'callNumber':_0x55e825,'callerId':_0x1bef44,'callbackUrl':_0x20fe33});return _0x30769f[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x33')});})[_0xc76d('0x1f')](handleError(_0x30769f));};exports[_0xc76d('0x34')]=function(_0x579d93,_0x518945){logger[_0xc76d('0x2a')]('hangup\x20fired:',_0x579d93[_0xc76d('0x2b')]);var _0x359f38=hangupValidation[_0xc76d('0xb')](_0x579d93[_0xc76d('0x2b')]);if(_0x359f38['length']>0x0){return _0x518945['status'](0x190)[_0xc76d('0x2d')](_0x359f38);}var _0x20a456=_0x579d93[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x410029=_0x579d93['body'][_0xc76d('0x27')];return getAgent(_0x20a456)[_0xc76d('0x1b')](function(_0x321989){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x321989[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x321989[_0xc76d('0x16')]),_0xc76d('0x36'),{'sessionId':_0x410029});return _0x518945['status'](0xc8)['json']({'error':![],'message':_0xc76d('0x37')});})[_0xc76d('0x1f')](handleError(_0x518945));};exports[_0xc76d('0x38')]=function(_0x27bdff,_0x4ae994){logger['info'](_0xc76d('0x39'),_0x27bdff[_0xc76d('0x2b')]);var _0x3e471e=answerValidation[_0xc76d('0xb')](_0x27bdff[_0xc76d('0x2b')]);if(_0x3e471e[_0xc76d('0x2c')]>0x0){return _0x4ae994[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x3e471e);}var _0x50e922=_0x27bdff[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x1bf8a0=_0x27bdff[_0xc76d('0x2b')]['sessionId'];return getAgent(_0x50e922)['then'](function(_0x4bf591){logger['info']('entityFound:',_0x4bf591['name']);emit(util['format'](_0xc76d('0x31'),_0x4bf591[_0xc76d('0x16')]),_0xc76d('0x3a'),{'sessionId':_0x1bf8a0});return _0x4ae994[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3b')});})[_0xc76d('0x1f')](handleError(_0x4ae994));};exports[_0xc76d('0x3c')]=function(_0x555f14,_0x462214){logger[_0xc76d('0x2a')](_0xc76d('0x3d'),_0x555f14[_0xc76d('0x2b')]);var _0xb9cca2=holdValidation[_0xc76d('0xb')](_0x555f14[_0xc76d('0x2b')]);if(_0xb9cca2[_0xc76d('0x2c')]>0x0){return _0x462214[_0xc76d('0x17')](0x190)['json'](_0xb9cca2);}var _0x5b41d3=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x2e')];var _0x2fa905=_0x555f14[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x5b41d3)['then'](function(_0x25fc9d){logger[_0xc76d('0x2a')]('entityFound:',_0x25fc9d['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x25fc9d['name']),_0xc76d('0x3e'),{'sessionId':_0x2fa905});return _0x462214[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x3f')});})[_0xc76d('0x1f')](handleError(_0x462214));};exports[_0xc76d('0x40')]=function(_0x25a549,_0x10b1b0){logger[_0xc76d('0x2a')](_0xc76d('0x41'),_0x25a549['body']);var _0x4efd83=unholdValidation[_0xc76d('0xb')](_0x25a549[_0xc76d('0x2b')]);if(_0x4efd83['length']>0x0){return _0x10b1b0[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x4efd83);}var _0x506b03=_0x25a549[_0xc76d('0x2b')]['userId'];var _0xe90d83=_0x25a549[_0xc76d('0x2b')][_0xc76d('0x27')];return getAgent(_0x506b03)[_0xc76d('0x1b')](function(_0x14ef42){logger['info']('entityFound:',_0x14ef42['name']);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x14ef42[_0xc76d('0x16')]),_0xc76d('0x42'),{'sessionId':_0xe90d83});return _0x10b1b0[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0xc76d('0x1f')](handleError(_0x10b1b0));};exports[_0xc76d('0x43')]=function(_0x5e66d9,_0x1a49d5){logger[_0xc76d('0x2a')]('calls\x20fired:',_0x1a49d5[_0xc76d('0x2b')]);var _0x463cbe=callsValidation[_0xc76d('0xb')](_0x5e66d9[_0xc76d('0x2b')]);if(_0x463cbe[_0xc76d('0x2c')]>0x0){return _0x1a49d5[_0xc76d('0x17')](0x190)['json'](_0x463cbe);}var _0x91b25b=_0x5e66d9[_0xc76d('0x2b')]['userId'];var _0x5f3973=respondWithRpcPromise(_0xc76d('0x23'));var _0x5ddcc6=getAgent(_0x91b25b);return Promise[_0xc76d('0x24')]([_0x5f3973,_0x5ddcc6])[_0xc76d('0x1b')](function(_0x12b287){var _0xfe2be1=_0x12b287[0x0];var _0x254128=_0x12b287[0x1];var _0x4746a5=_[_0xc76d('0x44')](_0xfe2be1[_0xc76d('0x25')],function(_0x3ada89){return _0x3ada89[_0xc76d('0x26')]==_0x254128['id'];});return _0x1a49d5[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'count':_0x4746a5[_0xc76d('0x2c')],'rows':_0x4746a5});})[_0xc76d('0x1f')](handleError(_0x1a49d5));};exports['conference']=function(_0x3054e0,_0xa0aa45){logger[_0xc76d('0x2a')](_0xc76d('0x45'),_0x3054e0[_0xc76d('0x2b')]);var _0x5ce99d=conferenceValidation[_0xc76d('0xb')](_0x3054e0[_0xc76d('0x2b')]);if(_0x5ce99d['length']>0x0){return _0xa0aa45['status'](0x190)['json'](_0x5ce99d);}var _0x382db6=_0x3054e0[_0xc76d('0x2b')][_0xc76d('0x2e')];return getAgent(_0x382db6)[_0xc76d('0x1b')](function(_0x2ba812){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x2ba812[_0xc76d('0x16')]);emit(util['format'](_0xc76d('0x31'),_0x2ba812['name']),'webbar:conference');return _0xa0aa45[_0xc76d('0x17')](0xc8)[_0xc76d('0x2d')]({'error':![],'message':_0xc76d('0x46')});})['catch'](handleError(_0xa0aa45));};exports[_0xc76d('0x47')]=function(_0x57068d,_0x48ccf7){logger['info'](_0xc76d('0x48'),_0x57068d[_0xc76d('0x2b')]);var _0x513623=transferValidation[_0xc76d('0xb')](_0x57068d[_0xc76d('0x2b')]);if(_0x513623[_0xc76d('0x2c')]>0x0){return _0x48ccf7[_0xc76d('0x17')](0x190)[_0xc76d('0x2d')](_0x513623);}var _0xa81af6=_0x57068d[_0xc76d('0x2b')]['userId'];var _0x5035fd=_0x57068d['body'][_0xc76d('0x27')];var _0x2e742f=_0x57068d[_0xc76d('0x2b')][_0xc76d('0x49')];return getAgent(_0xa81af6)[_0xc76d('0x1b')](function(_0x49f876){logger[_0xc76d('0x2a')](_0xc76d('0x35'),_0x49f876[_0xc76d('0x16')]);emit(util[_0xc76d('0x30')](_0xc76d('0x31'),_0x49f876[_0xc76d('0x16')]),_0xc76d('0x4a'),{'sessionId':_0x5035fd,'transferNumber':_0x2e742f});return _0x48ccf7[_0xc76d('0x17')](0xc8)['json']({'error':![],'message':_0xc76d('0x4b')});})['catch'](handleError(_0x48ccf7));}; \ No newline at end of file +var _0x4c6d=['webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','webbarapi','ioredis','defaults','redis','localhost','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','stack','name','send','status','request','then','error','code','message','result','User','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','body','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','catch','hangup','hangup\x20fired:','hangup\x20executed!','answer\x20fired:','webbar:answer','hold','hold\x20fired:'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4c6d,0x1d0));var _0xd4c6=function(_0x52e3d2,_0x21558d){_0x52e3d2=_0x52e3d2-0x0;var _0x367531=_0x4c6d[_0x52e3d2];return _0x367531;};'use strict';var path=require(_0xd4c6('0x0'));var fs=require('fs');var _=require(_0xd4c6('0x1'));var db=require(_0xd4c6('0x2'))['db'];var config=require(_0xd4c6('0x3'));var util=require(_0xd4c6('0x4'));var BPromise=require('bluebird');var jayson=require(_0xd4c6('0x5'));var amiClient=jayson[_0xd4c6('0x6')][_0xd4c6('0x7')]({'port':0x232a});var logger=require('../../config/logger')(_0xd4c6('0x8'));var Redis=require(_0xd4c6('0x9'));config['redis']=_[_0xd4c6('0xa')](config[_0xd4c6('0xb')],{'host':_0xd4c6('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd4c6('0xb')]));var Schema=require(_0xd4c6('0xd'));var originateValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x10')]},'callerId':{'type':_0xd4c6('0xf')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd4c6('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd4c6('0xf'),'required':[!![],_0xd4c6('0x12')]}});var holdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':_0xd4c6('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xd4c6('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':_0xd4c6('0xe'),'required':[!![],_0xd4c6('0x11')]}});function emit(_0x25204d,_0x3cb95c,_0x3da1f4){logger[_0xd4c6('0x13')](_0x25204d,_0x3cb95c,JSON['stringify'](_0x3da1f4));io['to'](_0x25204d)[_0xd4c6('0x14')](_0x3cb95c,_0x3da1f4);}function handleError(_0x44126c){return function(_0x23a16f){console[_0xd4c6('0x15')](_0xd4c6('0x16'),_0x23a16f,_0x23a16f instanceof RangeError);logger['error'](_0x23a16f[_0xd4c6('0x17')]);if(_0x23a16f instanceof RangeError){if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c['status'](0x194)[_0xd4c6('0x19')](_0x23a16f);}else{if(_0x23a16f[_0xd4c6('0x18')]){delete _0x23a16f[_0xd4c6('0x18')];}_0x44126c[_0xd4c6('0x1a')](0x1f4)['send'](_0x23a16f);}};}function checkError(){return function(_0x1c8427){if(!_0x1c8427){throw new RangeError('NotFound');}return _0x1c8427;};}function respondWithRpcPromise(_0x37f552,_0x150e28){return new BPromise(function(_0x2750c9,_0x222813){var _0xf536e0=amiClient;return _0xf536e0[_0xd4c6('0x1b')](_0x37f552,_0x150e28)[_0xd4c6('0x1c')](function(_0x3f99e8){if(_0x3f99e8[_0xd4c6('0x1d')]){if(_0x3f99e8[_0xd4c6('0x1d')][_0xd4c6('0x1e')]===0x1f4){return _0x222813(_0x3f99e8[_0xd4c6('0x1d')]['message']);}return _0x2750c9(_0x3f99e8['error'][_0xd4c6('0x1f')]);}else{_0x2750c9(_0x3f99e8[_0xd4c6('0x20')]);}})['catch'](function(_0x1dee19){_0x222813(_0x1dee19);});});}function getAgent(_0x3a2c50){return db[_0xd4c6('0x21')]['findOne']({'where':{'id':_0x3a2c50,'role':_0xd4c6('0x22')}})[_0xd4c6('0x1c')](checkError());}function getAgentCheckSession(_0x5614f3,_0x406ed0){return new BPromise(function(_0x8ce066,_0x25ea15){var _0x488e7e=respondWithRpcPromise(_0xd4c6('0x23'));var _0x3b656d=getAgent(_0x5614f3);Promise[_0xd4c6('0x24')]([_0x488e7e,_0x3b656d])[_0xd4c6('0x1c')](function(_0x2e8c34){var _0x160330=_0x2e8c34[0x0];var _0x41a8d2=_0x2e8c34[0x1];var _0x1f32d8=_[_0xd4c6('0x25')](_0x160330[_0xd4c6('0x26')],function(_0x441119){return _0x441119[_0xd4c6('0x27')]==_0x41a8d2['id']&&_0x441119[_0xd4c6('0x28')]==_0x406ed0;});if(_0x1f32d8[_0xd4c6('0x29')]==0x1){_0x8ce066(_0x41a8d2);}else{_0x25ea15(new RangeError('sessionId\x20'+_0x406ed0+_0xd4c6('0x2a')));}});});}exports[_0xd4c6('0x2b')]=function(_0x32deb7,_0x38d423){logger['info']('originate\x20fired:',_0x32deb7['body']);var _0x103ac3=originateValidation[_0xd4c6('0xd')](_0x32deb7[_0xd4c6('0x2c')]);if(_0x103ac3[_0xd4c6('0x29')]>0x0){return _0x38d423[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x103ac3);}var _0x1615ff=_0x32deb7['body'][_0xd4c6('0x2e')];var _0x3ae596=_0x32deb7[_0xd4c6('0x2c')]['callNumber'];var _0x24a716=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x2f')];var _0x4c69af=_0x32deb7[_0xd4c6('0x2c')][_0xd4c6('0x30')];return getAgent(_0x1615ff)[_0xd4c6('0x1c')](function(_0xe5aa2d){logger['info'](_0xd4c6('0x31'),_0xe5aa2d[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0xe5aa2d[_0xd4c6('0x18')]),'webbar:originate',{'callNumber':_0x3ae596,'callerId':_0x24a716,'callbackUrl':_0x4c69af});return _0x38d423[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x34')});})[_0xd4c6('0x35')](handleError(_0x38d423));};exports[_0xd4c6('0x36')]=function(_0x2cdb9d,_0x554666){logger[_0xd4c6('0x13')](_0xd4c6('0x37'),_0x2cdb9d[_0xd4c6('0x2c')]);var _0x5f4060=hangupValidation[_0xd4c6('0xd')](_0x2cdb9d[_0xd4c6('0x2c')]);if(_0x5f4060[_0xd4c6('0x29')]>0x0){return _0x554666[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5f4060);}var _0x20a4e8=_0x2cdb9d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x2e1768=_0x2cdb9d['body'][_0xd4c6('0x28')];return getAgent(_0x20a4e8)['then'](function(_0x55063c){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x55063c[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')](_0xd4c6('0x33'),_0x55063c['name']),'webbar:hangup',{'sessionId':_0x2e1768});return _0x554666[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x38')});})[_0xd4c6('0x35')](handleError(_0x554666));};exports['answer']=function(_0x211d47,_0x494811){logger[_0xd4c6('0x13')](_0xd4c6('0x39'),_0x211d47[_0xd4c6('0x2c')]);var _0x51585c=answerValidation[_0xd4c6('0xd')](_0x211d47[_0xd4c6('0x2c')]);if(_0x51585c[_0xd4c6('0x29')]>0x0){return _0x494811[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x51585c);}var _0x3ef1b0=_0x211d47[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x343d94=_0x211d47['body'][_0xd4c6('0x28')];return getAgent(_0x3ef1b0)[_0xd4c6('0x1c')](function(_0xefcd5){logger['info'](_0xd4c6('0x31'),_0xefcd5[_0xd4c6('0x18')]);emit(util[_0xd4c6('0x32')]('user:%s',_0xefcd5['name']),_0xd4c6('0x3a'),{'sessionId':_0x343d94});return _0x494811[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'answer\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x494811));};exports[_0xd4c6('0x3b')]=function(_0x1a53e9,_0x258a95){logger[_0xd4c6('0x13')](_0xd4c6('0x3c'),_0x1a53e9['body']);var _0x22298a=holdValidation[_0xd4c6('0xd')](_0x1a53e9[_0xd4c6('0x2c')]);if(_0x22298a[_0xd4c6('0x29')]>0x0){return _0x258a95[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x22298a);}var _0x34fb42=_0x1a53e9[_0xd4c6('0x2c')]['userId'];var _0x4f26fc=_0x1a53e9[_0xd4c6('0x2c')][_0xd4c6('0x28')];return getAgent(_0x34fb42)[_0xd4c6('0x1c')](function(_0x5bb875){logger[_0xd4c6('0x13')](_0xd4c6('0x31'),_0x5bb875[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x5bb875[_0xd4c6('0x18')]),_0xd4c6('0x3d'),{'sessionId':_0x4f26fc});return _0x258a95[_0xd4c6('0x1a')](0xc8)['json']({'error':![],'message':_0xd4c6('0x3e')});})[_0xd4c6('0x35')](handleError(_0x258a95));};exports[_0xd4c6('0x3f')]=function(_0x14279d,_0x291837){logger[_0xd4c6('0x13')](_0xd4c6('0x40'),_0x14279d['body']);var _0x304f96=unholdValidation[_0xd4c6('0xd')](_0x14279d[_0xd4c6('0x2c')]);if(_0x304f96['length']>0x0){return _0x291837[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x304f96);}var _0x46bf10=_0x14279d[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x3e6df8=_0x14279d[_0xd4c6('0x2c')]['sessionId'];return getAgent(_0x46bf10)[_0xd4c6('0x1c')](function(_0x4a3092){logger['info'](_0xd4c6('0x31'),_0x4a3092['name']);emit(util[_0xd4c6('0x32')]('user:%s',_0x4a3092[_0xd4c6('0x18')]),'webbar:unhold',{'sessionId':_0x3e6df8});return _0x291837['status'](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x41')});})[_0xd4c6('0x35')](handleError(_0x291837));};exports[_0xd4c6('0x42')]=function(_0x5639b6,_0x241e6c){logger[_0xd4c6('0x13')](_0xd4c6('0x43'),_0x241e6c[_0xd4c6('0x2c')]);var _0x5e52db=callsValidation[_0xd4c6('0xd')](_0x5639b6[_0xd4c6('0x2c')]);if(_0x5e52db[_0xd4c6('0x29')]>0x0){return _0x241e6c[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5e52db);}var _0x1525a4=_0x5639b6[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x106710=respondWithRpcPromise(_0xd4c6('0x23'));var _0xe07a2d=getAgent(_0x1525a4);return Promise['all']([_0x106710,_0xe07a2d])['then'](function(_0x2dab4a){var _0x11c37d=_0x2dab4a[0x0];var _0x558ce2=_0x2dab4a[0x1];var _0x5179af=_['filter'](_0x11c37d[_0xd4c6('0x26')],function(_0x218250){return _0x218250['UserId']==_0x558ce2['id'];});return _0x241e6c['status'](0xc8)[_0xd4c6('0x2d')]({'count':_0x5179af[_0xd4c6('0x29')],'rows':_0x5179af});})[_0xd4c6('0x35')](handleError(_0x241e6c));};exports[_0xd4c6('0x44')]=function(_0x226549,_0x516e12){logger[_0xd4c6('0x13')](_0xd4c6('0x45'),_0x226549[_0xd4c6('0x2c')]);var _0x26cff1=conferenceValidation[_0xd4c6('0xd')](_0x226549[_0xd4c6('0x2c')]);if(_0x26cff1[_0xd4c6('0x29')]>0x0){return _0x516e12[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x26cff1);}var _0x20b5b9=_0x226549[_0xd4c6('0x2c')][_0xd4c6('0x2e')];return getAgent(_0x20b5b9)[_0xd4c6('0x1c')](function(_0x5a0400){logger['info'](_0xd4c6('0x31'),_0x5a0400['name']);emit(util['format']('user:%s',_0x5a0400[_0xd4c6('0x18')]),_0xd4c6('0x46'));return _0x516e12[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':'conference\x20executed!'});})[_0xd4c6('0x35')](handleError(_0x516e12));};exports[_0xd4c6('0x47')]=function(_0x53dcea,_0x705041){logger[_0xd4c6('0x13')](_0xd4c6('0x48'),_0x53dcea[_0xd4c6('0x2c')]);var _0x5cf823=transferValidation[_0xd4c6('0xd')](_0x53dcea[_0xd4c6('0x2c')]);if(_0x5cf823['length']>0x0){return _0x705041[_0xd4c6('0x1a')](0x190)[_0xd4c6('0x2d')](_0x5cf823);}var _0x5ae295=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x2e')];var _0x4cdf5f=_0x53dcea[_0xd4c6('0x2c')]['sessionId'];var _0x7aef4=_0x53dcea[_0xd4c6('0x2c')][_0xd4c6('0x49')];return getAgent(_0x5ae295)[_0xd4c6('0x1c')](function(_0x2a8448){logger[_0xd4c6('0x13')]('entityFound:',_0x2a8448[_0xd4c6('0x18')]);emit(util['format'](_0xd4c6('0x33'),_0x2a8448[_0xd4c6('0x18')]),'webbar:transfer',{'sessionId':_0x4cdf5f,'transferNumber':_0x7aef4});return _0x705041[_0xd4c6('0x1a')](0xc8)[_0xd4c6('0x2d')]({'error':![],'message':_0xd4c6('0x4a')});})['catch'](handleError(_0x705041));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7e8b568..0bcb8d3 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 _0x5b80=['get','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','post','/:id/dispositions','addDisposition','/:id/notify','notify','send','update','delete','removeDispositions','removeAnswers','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x5b80,0x1b8));var _0x05b8=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x5b80[_0x3de8a4];return _0x4635cf;};'use strict';var multer=require(_0x05b8('0x0'));var util=require(_0x05b8('0x1'));var path=require(_0x05b8('0x2'));var timeout=require(_0x05b8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x05b8('0x4'));var auth=require(_0x05b8('0x5'));var interaction=require(_0x05b8('0x6'));var config=require(_0x05b8('0x7'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x05b8('0x8')](),controller[_0x05b8('0x9')]);router[_0x05b8('0xa')](_0x05b8('0xb'),auth['isAuthenticated'](),controller[_0x05b8('0xc')]);router[_0x05b8('0xa')](_0x05b8('0xd'),auth[_0x05b8('0x8')](),controller[_0x05b8('0xe')]);router[_0x05b8('0xa')]('/:id/dispositions',auth[_0x05b8('0x8')](),controller[_0x05b8('0xf')]);router[_0x05b8('0xa')](_0x05b8('0x10'),auth[_0x05b8('0x8')](),controller['getAnswers']);router[_0x05b8('0xa')](_0x05b8('0x11'),auth[_0x05b8('0x8')](),controller[_0x05b8('0x12')]);router[_0x05b8('0xa')](_0x05b8('0x13'),auth['isAuthenticated'](),controller['getApplications']);router[_0x05b8('0x14')]('/',auth['isAuthenticated'](),controller['create']);router[_0x05b8('0x14')](_0x05b8('0x15'),auth[_0x05b8('0x8')](),controller[_0x05b8('0x16')]);router[_0x05b8('0x14')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x05b8('0x14')](_0x05b8('0x11'),auth[_0x05b8('0x8')](),controller['addAgents']);router[_0x05b8('0x14')]('/:id/applications',auth[_0x05b8('0x8')](),controller['addApplications']);router[_0x05b8('0x14')](_0x05b8('0x17'),controller[_0x05b8('0x18')]);router[_0x05b8('0x14')]('/:id/send',auth[_0x05b8('0x8')](),controller[_0x05b8('0x19')]);router['put'](_0x05b8('0xd'),auth[_0x05b8('0x8')](),controller[_0x05b8('0x1a')]);router[_0x05b8('0x1b')](_0x05b8('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x05b8('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x05b8('0x1c')]);router[_0x05b8('0x1b')]('/:id/canned_answers',auth[_0x05b8('0x8')](),controller[_0x05b8('0x1d')]);router['delete'](_0x05b8('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x74e4=['/:id/applications','getApplications','post','create','addAnswer','addApplications','/:id/notify','notify','send','put','/:id','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents'];(function(_0x147a9d,_0x342c27){var _0x190285=function(_0x4e70bc){while(--_0x4e70bc){_0x147a9d['push'](_0x147a9d['shift']());}};_0x190285(++_0x342c27);}(_0x74e4,0x1ed));var _0x474e=function(_0x340ac7,_0x410c73){_0x340ac7=_0x340ac7-0x0;var _0x49c15f=_0x74e4[_0x340ac7];return _0x49c15f;};'use strict';var multer=require(_0x474e('0x0'));var util=require(_0x474e('0x1'));var path=require(_0x474e('0x2'));var timeout=require('connect-timeout');var express=require(_0x474e('0x3'));var router=express[_0x474e('0x4')]();var fs_extra=require(_0x474e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x474e('0x6'));var config=require(_0x474e('0x7'));var controller=require('./whatsappAccount.controller');router[_0x474e('0x8')]('/',auth[_0x474e('0x9')](),controller['index']);router[_0x474e('0x8')](_0x474e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x474e('0x8')]('/:id',auth[_0x474e('0x9')](),controller[_0x474e('0xb')]);router[_0x474e('0x8')](_0x474e('0xc'),auth[_0x474e('0x9')](),controller['getDispositions']);router['get'](_0x474e('0xd'),auth[_0x474e('0x9')](),controller[_0x474e('0xe')]);router[_0x474e('0x8')](_0x474e('0xf'),auth[_0x474e('0x9')](),controller[_0x474e('0x10')]);router[_0x474e('0x8')](_0x474e('0x11'),auth[_0x474e('0x9')](),controller[_0x474e('0x12')]);router[_0x474e('0x13')]('/',auth['isAuthenticated'](),controller[_0x474e('0x14')]);router['post']('/:id/dispositions',auth[_0x474e('0x9')](),controller['addDisposition']);router[_0x474e('0x13')](_0x474e('0xd'),auth[_0x474e('0x9')](),controller[_0x474e('0x15')]);router[_0x474e('0x13')](_0x474e('0xf'),auth[_0x474e('0x9')](),controller['addAgents']);router[_0x474e('0x13')]('/:id/applications',auth[_0x474e('0x9')](),controller[_0x474e('0x16')]);router[_0x474e('0x13')](_0x474e('0x17'),controller[_0x474e('0x18')]);router[_0x474e('0x13')]('/:id/send',auth[_0x474e('0x9')](),controller[_0x474e('0x19')]);router[_0x474e('0x1a')](_0x474e('0x1b'),auth[_0x474e('0x9')](),controller['update']);router[_0x474e('0x1c')](_0x474e('0x1b'),auth['isAuthenticated'](),controller[_0x474e('0x1d')]);router[_0x474e('0x1c')](_0x474e('0xc'),auth[_0x474e('0x9')](),controller[_0x474e('0x1e')]);router[_0x474e('0x1c')](_0x474e('0xd'),auth['isAuthenticated'](),controller[_0x474e('0x1f')]);router[_0x474e('0x1c')](_0x474e('0xf'),auth[_0x474e('0x9')](),controller[_0x474e('0x20')]);module[_0x474e('0x21')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index d3795ad..fbf2240 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 _0x9cbc=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','generate','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xc36487,_0x3c81cd){var _0x4b5d91=function(_0x128f15){while(--_0x128f15){_0xc36487['push'](_0xc36487['shift']());}};_0x4b5d91(++_0x3c81cd);}(_0x9cbc,0x1f2));var _0xc9cb=function(_0x11908c,_0x547af6){_0x11908c=_0x11908c-0x0;var _0x10cd4e=_0x9cbc[_0x11908c];return _0x10cd4e;};'use strict';var Sequelize=require(_0xc9cb('0x0'));var rs=require('randomstring');module[_0xc9cb('0x1')]={'name':{'type':Sequelize[_0xc9cb('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xc9cb('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc9cb('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc9cb('0x2')],'defaultValue':function(){return rs[_0xc9cb('0x3')]();}},'phone':{'type':Sequelize[_0xc9cb('0x2')]},'type':{'type':Sequelize['ENUM']('twilio',_0xc9cb('0x4'))},'accountSid':{'type':Sequelize[_0xc9cb('0x2')]},'baseUrl':{'type':Sequelize[_0xc9cb('0x2')]},'authToken':{'type':Sequelize[_0xc9cb('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc9cb('0x5')],'defaultValue':function(){return _0xc9cb('0x6');}},'notificationSound':{'type':Sequelize[_0xc9cb('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc9cb('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc9cb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc9cb('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc9cb('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc9cb('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc9cb('0x8')],'comment':_0xc9cb('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xc9cb('0x7')],'defaultValue':![],'comment':_0xc9cb('0xa'),'set':function(_0x93073){if(!_0x93073){this[_0xc9cb('0xb')]('mandatoryDispositionPauseId',null);}this[_0xc9cb('0xb')](_0xc9cb('0xc'),_0x93073);}},'description':{'type':Sequelize[_0xc9cb('0x2')]}}; \ No newline at end of file +var _0xf3a7=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','sinch'];(function(_0x2bb1c8,_0x41ed91){var _0x396999=function(_0x2397e4){while(--_0x2397e4){_0x2bb1c8['push'](_0x2bb1c8['shift']());}};_0x396999(++_0x41ed91);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7f3a('0x0'));module[_0x7f3a('0x1')]={'name':{'type':Sequelize[_0x7f3a('0x2')],'unique':_0x7f3a('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x7f3a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x7f3a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x7f3a('0x2')],'defaultValue':function(){return rs[_0x7f3a('0x4')]();}},'phone':{'type':Sequelize[_0x7f3a('0x2')]},'type':{'type':Sequelize[_0x7f3a('0x5')]('twilio',_0x7f3a('0x6'))},'accountSid':{'type':Sequelize[_0x7f3a('0x2')]},'baseUrl':{'type':Sequelize[_0x7f3a('0x2')]},'authToken':{'type':Sequelize[_0x7f3a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x7f3a('0x7')],'defaultValue':function(){return _0x7f3a('0x8');}},'notificationSound':{'type':Sequelize[_0x7f3a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7f3a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7f3a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7f3a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7f3a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x7f3a('0xb')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7f3a('0xc'),'set':function(_0x4d74ea){if(!_0x4d74ea){this[_0x7f3a('0xd')](_0x7f3a('0xe'),null);}this[_0x7f3a('0xd')](_0x7f3a('0xf'),_0x4d74ea);}},'description':{'type':Sequelize[_0x7f3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 810863d..42df5f7 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 _0x85f4=['Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','get','WhatsappAccounts','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','type','key','query','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','describe','addDisposition','WhatsappAccountId','getDispositions','findOne','keys','hasOwnProperty','Disposition','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','statuses','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','MessageSid','sinch','notifications','messageId','isNil','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','omit','contact','WhatsappInteraction','interaction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','UserId','waitForTheAssignedAgent','queueId','unshift','queue','Start','startRouting','receiveMessage','entity\x20found','Content-Type','text/xml','List','out'];(function(_0x4dcc2d,_0x422839){var _0x1bbd79=function(_0x173341){while(--_0x173341){_0x4dcc2d['push'](_0x4dcc2d['shift']());}};_0x1bbd79(++_0x422839);}(_0x85f4,0xc3));var _0x485f=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x85f4[_0x279d37];return _0x530173;};'use strict';var emlformat=require(_0x485f('0x0'));var rimraf=require(_0x485f('0x1'));var zipdir=require(_0x485f('0x2'));var jsonpatch=require(_0x485f('0x3'));var rp=require(_0x485f('0x4'));var moment=require(_0x485f('0x5'));var BPromise=require(_0x485f('0x6'));var Mustache=require(_0x485f('0x7'));var util=require(_0x485f('0x8'));var path=require(_0x485f('0x9'));var sox=require('sox');var csv=require(_0x485f('0xa'));var ejs=require(_0x485f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x485f('0xc'));var squel=require(_0x485f('0xd'));var crypto=require('crypto');var jsforce=require(_0x485f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x485f('0xa'));var querystring=require(_0x485f('0xf'));var Papa=require(_0x485f('0x10'));var Redis=require(_0x485f('0x11'));var authService=require(_0x485f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x485f('0x13'));var hardwareService=require(_0x485f('0x14'));var logger=require(_0x485f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x485f('0x16'))['db'];config[_0x485f('0x17')]=_[_0x485f('0x18')](config[_0x485f('0x17')],{'host':_0x485f('0x19'),'port':0x18eb});var socket=require(_0x485f('0x1a'))(new Redis(config[_0x485f('0x17')]));require('./whatsappAccount.socket')[_0x485f('0x1b')](socket);var jayson=require(_0x485f('0x1c'));var client=jayson['client'][_0x485f('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xf30362,_0xf4cbe0,_0x28a795,_0x286646){return new BPromise(function(_0x3870a5,_0x15f7f5){var _0x564ff6=_0x286646||client;return _0x564ff6['request'](_0xf30362,_0x28a795)[_0x485f('0x1e')](function(_0x9fa32){logger[_0x485f('0x1f')]('WhatsappAccount,\x20%s,\x20%s',_0xf4cbe0,_0x485f('0x20'));logger[_0x485f('0x21')](_0x485f('0x22'),_0xf4cbe0,'request\x20sent',JSON[_0x485f('0x23')](_0x9fa32));if(_0x9fa32[_0x485f('0x24')]){if(_0x9fa32[_0x485f('0x24')]['code']===0x1f4){logger[_0x485f('0x24')](_0x485f('0x25'),_0xf4cbe0,_0x9fa32['error'][_0x485f('0x26')]);return _0x15f7f5(_0x9fa32[_0x485f('0x24')][_0x485f('0x26')]);}logger[_0x485f('0x24')]('WhatsappAccount,\x20%s,\x20%s',_0xf4cbe0,_0x9fa32['error']['message']);return _0x3870a5(_0x9fa32[_0x485f('0x24')][_0x485f('0x26')]);}else{logger[_0x485f('0x1f')](_0x485f('0x25'),_0xf4cbe0,_0x485f('0x20'));_0x3870a5(_0x9fa32[_0x485f('0x27')][_0x485f('0x26')]);}})[_0x485f('0x28')](function(_0x80b2c0){logger[_0x485f('0x24')](_0x485f('0x25'),_0xf4cbe0,_0x80b2c0);_0x15f7f5(_0x80b2c0);});});}function respondWithStatusCode(_0x33c48a,_0x51d094){_0x51d094=_0x51d094||0xcc;return function(_0x33ede4){if(_0x33ede4){return _0x33c48a[_0x485f('0x29')](_0x51d094);}return _0x33c48a[_0x485f('0x2a')](_0x51d094)[_0x485f('0x2b')]();};}function respondWithResult(_0xd6182,_0x43855f){_0x43855f=_0x43855f||0xc8;return function(_0x2525be){if(_0x2525be){return _0xd6182['status'](_0x43855f)[_0x485f('0x2c')](_0x2525be);}};}function respondWithFilteredResult(_0x3a223b,_0x4a2db5){return function(_0x4789c2){if(_0x4789c2){var _0x2820d0=typeof _0x4a2db5[_0x485f('0x2d')]===_0x485f('0x2e')&&typeof _0x4a2db5[_0x485f('0x2f')]===_0x485f('0x2e');var _0x3847a7=_0x4789c2[_0x485f('0x30')];var _0x3fe70a=_0x2820d0?0x0:_0x4a2db5['offset'];var _0x466778=_0x2820d0?_0x4789c2[_0x485f('0x30')]:_0x4a2db5[_0x485f('0x2d')]+_0x4a2db5['limit'];var _0x3685c0;if(_0x466778>=_0x3847a7){_0x466778=_0x3847a7;_0x3685c0=0xc8;}else{_0x3685c0=0xce;}_0x3a223b[_0x485f('0x2a')](_0x3685c0);return _0x3a223b['set'](_0x485f('0x31'),_0x3fe70a+'-'+_0x466778+'/'+_0x3847a7)['json'](_0x4789c2);}return null;};}function patchUpdates(_0x5524b1){return function(_0x39f422){try{jsonpatch[_0x485f('0x32')](_0x39f422,_0x5524b1,!![]);}catch(_0x1bec79){return BPromise['reject'](_0x1bec79);}return _0x39f422[_0x485f('0x33')]();};}function saveUpdates(_0x5adf22,_0x59f132){return function(_0x5d6eb0){if(_0x5d6eb0){return _0x5d6eb0[_0x485f('0x34')](_0x5adf22)[_0x485f('0x1e')](function(_0x1d3717){return _0x1d3717;});}return null;};}function removeEntity(_0x939247,_0x1d6c7d){return function(_0x4e26b5){if(_0x4e26b5){return _0x4e26b5['destroy']()[_0x485f('0x1e')](function(){var _0x5d4d9f=_0x4e26b5[_0x485f('0x35')]({'plain':!![]});var _0x461b98=_0x485f('0x36');return db['UserProfileResource'][_0x485f('0x37')]({'where':{'type':_0x461b98,'resourceId':_0x5d4d9f['id']}})[_0x485f('0x1e')](function(){return _0x4e26b5;});})[_0x485f('0x1e')](function(){_0x939247['status'](0xcc)[_0x485f('0x2b')]();});}};}function handleEntityNotFound(_0x21141e,_0x15a27b){return function(_0x118816){if(!_0x118816){_0x21141e[_0x485f('0x29')](0x194);}return _0x118816;};}function handleError(_0x15189c,_0x11f4a){_0x11f4a=_0x11f4a||0x1f4;return function(_0x4083f4){logger[_0x485f('0x24')](_0x4083f4[_0x485f('0x38')]);if(_0x4083f4[_0x485f('0x39')]){delete _0x4083f4['name'];}_0x15189c[_0x485f('0x2a')](_0x11f4a)[_0x485f('0x3a')](_0x4083f4);};}exports[_0x485f('0x3b')]=function(_0x3fd477,_0x22f475){var _0x2c6232={'include':[{'model':db[_0x485f('0x3c')],'as':_0x485f('0x3d')}]},_0x3bbfd5={},_0xad46ed={'count':0x0,'rows':[]};var _0x5f2cde=_[_0x485f('0x3e')](db[_0x485f('0x3f')][_0x485f('0x40')],function(_0x347119){return{'name':_0x347119['fieldName'],'type':_0x347119[_0x485f('0x41')][_0x485f('0x42')]};});_0x3bbfd5['model']=_[_0x485f('0x3e')](_0x5f2cde,_0x485f('0x39'));_0x3bbfd5[_0x485f('0x43')]=_['keys'](_0x3fd477[_0x485f('0x43')]);_0x3bbfd5[_0x485f('0x44')]=_[_0x485f('0x45')](_0x3bbfd5[_0x485f('0x46')],_0x3bbfd5['query']);_0x2c6232[_0x485f('0x47')]=_['intersection'](_0x3bbfd5['model'],qs[_0x485f('0x48')](_0x3fd477[_0x485f('0x43')][_0x485f('0x48')]));_0x2c6232[_0x485f('0x47')]=_0x2c6232['attributes']['length']?_0x2c6232[_0x485f('0x47')]:_0x3bbfd5[_0x485f('0x46')];if(!_0x3fd477['query']['hasOwnProperty'](_0x485f('0x49'))){_0x2c6232['limit']=qs[_0x485f('0x2f')](_0x3fd477['query'][_0x485f('0x2f')]);_0x2c6232[_0x485f('0x2d')]=qs[_0x485f('0x2d')](_0x3fd477[_0x485f('0x43')][_0x485f('0x2d')]);}_0x2c6232[_0x485f('0x4a')]=qs['sort'](_0x3fd477[_0x485f('0x43')][_0x485f('0x4b')]);_0x2c6232[_0x485f('0x4c')]=qs[_0x485f('0x44')](_[_0x485f('0x4d')](_0x3fd477[_0x485f('0x43')],_0x3bbfd5['filters']),_0x5f2cde);if(_0x3fd477[_0x485f('0x43')][_0x485f('0x4e')]){_0x2c6232[_0x485f('0x4c')]=_[_0x485f('0x4f')](_0x2c6232['where'],{'$or':_['map'](_0x5f2cde,function(_0x4c3807){if(_0x4c3807[_0x485f('0x41')]!=='VIRTUAL'){var _0x5dd843={};_0x5dd843[_0x4c3807['name']]={'$like':'%'+_0x3fd477['query']['filter']+'%'};return _0x5dd843;}})});}_0x2c6232=_['merge']({},_0x2c6232,_0x3fd477[_0x485f('0x50')]);var _0x42347b={'where':_0x2c6232['where']};return db[_0x485f('0x3f')][_0x485f('0x30')](_0x42347b)[_0x485f('0x1e')](function(_0x164880){_0xad46ed[_0x485f('0x30')]=_0x164880;if(_0x3fd477[_0x485f('0x43')][_0x485f('0x51')]){_0x2c6232[_0x485f('0x52')]=[{'all':!![]}];}return db[_0x485f('0x3f')][_0x485f('0x53')](_0x2c6232);})['then'](function(_0x3002f7){_0xad46ed['rows']=_0x3002f7;return _0xad46ed;})[_0x485f('0x1e')](respondWithFilteredResult(_0x22f475,_0x2c6232))['catch'](handleError(_0x22f475,null));};exports[_0x485f('0x54')]=function(_0x55eaac,_0x469ef9){var _0x149e45={'raw':![],'where':{'id':_0x55eaac[_0x485f('0x55')]['id']},'include':[{'model':db[_0x485f('0x3c')],'as':_0x485f('0x3d')}]},_0xdf60b8={};_0xdf60b8[_0x485f('0x46')]=_['keys'](db[_0x485f('0x3f')][_0x485f('0x40')]);_0xdf60b8[_0x485f('0x43')]=_['keys'](_0x55eaac[_0x485f('0x43')]);_0xdf60b8[_0x485f('0x44')]=_[_0x485f('0x45')](_0xdf60b8[_0x485f('0x46')],_0xdf60b8[_0x485f('0x43')]);_0x149e45[_0x485f('0x47')]=_[_0x485f('0x45')](_0xdf60b8['model'],qs[_0x485f('0x48')](_0x55eaac[_0x485f('0x43')][_0x485f('0x48')]));_0x149e45[_0x485f('0x47')]=_0x149e45[_0x485f('0x47')][_0x485f('0x56')]?_0x149e45[_0x485f('0x47')]:_0xdf60b8['model'];if(_0x55eaac[_0x485f('0x43')][_0x485f('0x51')]){_0x149e45[_0x485f('0x52')]=[{'all':!![]}];}_0x149e45=_['merge']({},_0x149e45,_0x55eaac[_0x485f('0x50')]);return db['WhatsappAccount']['find'](_0x149e45)[_0x485f('0x1e')](handleEntityNotFound(_0x469ef9,null))[_0x485f('0x1e')](respondWithResult(_0x469ef9,null))['catch'](handleError(_0x469ef9,null));};exports[_0x485f('0x57')]=function(_0xb814f2,_0x7737a4){return db['WhatsappAccount'][_0x485f('0x57')](_0xb814f2[_0x485f('0x58')],{})[_0x485f('0x1e')](function(_0x18c841){var _0x35d56f=_0xb814f2[_0x485f('0x59')][_0x485f('0x35')]({'plain':!![]});if(!_0x35d56f)throw new Error(_0x485f('0x5a'));if(_0x35d56f['role']===_0x485f('0x59')){var _0x2979dd=_0x18c841[_0x485f('0x35')]({'plain':!![]});var _0x4da3f8=_0x485f('0x36');return db[_0x485f('0x5b')][_0x485f('0x5c')]({'where':{'name':_0x4da3f8,'userProfileId':_0x35d56f[_0x485f('0x5d')]},'raw':!![]})['then'](function(_0x45d061){if(_0x45d061&&_0x45d061[_0x485f('0x5e')]===0x0){return db[_0x485f('0x5f')][_0x485f('0x57')]({'name':_0x2979dd[_0x485f('0x39')],'resourceId':_0x2979dd['id'],'type':_0x45d061[_0x485f('0x39')],'sectionId':_0x45d061['id']},{})[_0x485f('0x1e')](function(){return _0x18c841;});}else{return _0x18c841;}})[_0x485f('0x28')](function(_0x587ea9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x587ea9);throw _0x587ea9;});}return _0x18c841;})[_0x485f('0x1e')](respondWithResult(_0x7737a4,0xc9))['catch'](handleError(_0x7737a4,null));};exports['update']=function(_0x24bc2b,_0x43e061){if(_0x24bc2b['body']['id']){delete _0x24bc2b[_0x485f('0x58')]['id'];}return db[_0x485f('0x3f')][_0x485f('0x5c')]({'where':{'id':_0x24bc2b['params']['id']},'include':[{'model':db[_0x485f('0x3c')],'as':_0x485f('0x3d')}]})[_0x485f('0x1e')](handleEntityNotFound(_0x43e061,null))['then'](saveUpdates(_0x24bc2b[_0x485f('0x58')],null))['then'](respondWithResult(_0x43e061,null))['catch'](handleError(_0x43e061,null));};exports[_0x485f('0x37')]=function(_0x3aa7f4,_0x31a214){return db[_0x485f('0x3f')][_0x485f('0x5c')]({'where':{'id':_0x3aa7f4[_0x485f('0x55')]['id']}})['then'](handleEntityNotFound(_0x31a214,null))[_0x485f('0x1e')](removeEntity(_0x31a214,null))[_0x485f('0x28')](handleError(_0x31a214,null));};exports[_0x485f('0x60')]=function(_0x522792,_0x1a888a){return db[_0x485f('0x3f')][_0x485f('0x60')]()[_0x485f('0x1e')](respondWithResult(_0x1a888a,null))[_0x485f('0x28')](handleError(_0x1a888a,null));};exports[_0x485f('0x61')]=function(_0x54b7aa,_0x207fa2,_0x17d631){if(_0x54b7aa['body']['id']){delete _0x54b7aa[_0x485f('0x58')]['id'];}return db[_0x485f('0x3f')]['find']({'where':{'id':_0x54b7aa[_0x485f('0x55')]['id']}})['then'](handleEntityNotFound(_0x207fa2,null))[_0x485f('0x1e')](function(_0x4ab812){if(_0x4ab812){_0x54b7aa[_0x485f('0x58')][_0x485f('0x62')]=_0x4ab812['id'];return db['Disposition'][_0x485f('0x57')](_0x54b7aa['body']);}})[_0x485f('0x1e')](respondWithResult(_0x207fa2,null))['catch'](handleError(_0x207fa2,null));};exports[_0x485f('0x63')]=function(_0x42d224,_0x3d110a,_0x336eec){var _0x140cb7={'raw':![],'where':{}};var _0x3298c0={};var _0x4b1bfb={'count':0x0,'rows':[]};return db[_0x485f('0x3f')][_0x485f('0x64')]({'where':{'id':_0x42d224['params']['id']}})[_0x485f('0x1e')](handleEntityNotFound(_0x3d110a,null))[_0x485f('0x1e')](function(_0x45e50b){if(_0x45e50b){_0x3298c0[_0x485f('0x46')]=_[_0x485f('0x65')](db['Disposition']['rawAttributes']);_0x3298c0[_0x485f('0x43')]=_['keys'](_0x42d224[_0x485f('0x43')]);_0x3298c0[_0x485f('0x44')]=_[_0x485f('0x45')](_0x3298c0['model'],_0x3298c0['query']);_0x140cb7[_0x485f('0x47')]=_[_0x485f('0x45')](_0x3298c0[_0x485f('0x46')],qs['fields'](_0x42d224[_0x485f('0x43')][_0x485f('0x48')]));_0x140cb7[_0x485f('0x47')]=_0x140cb7[_0x485f('0x47')][_0x485f('0x56')]?_0x140cb7['attributes']:_0x3298c0[_0x485f('0x46')];if(!_0x42d224[_0x485f('0x43')][_0x485f('0x66')](_0x485f('0x49'))){_0x140cb7[_0x485f('0x2f')]=qs[_0x485f('0x2f')](_0x42d224[_0x485f('0x43')][_0x485f('0x2f')]);_0x140cb7[_0x485f('0x2d')]=qs[_0x485f('0x2d')](_0x42d224[_0x485f('0x43')]['offset']);}_0x140cb7[_0x485f('0x4a')]=qs[_0x485f('0x4b')](_0x42d224['query'][_0x485f('0x4b')]);_0x140cb7['where']=qs[_0x485f('0x44')](_[_0x485f('0x4d')](_0x42d224[_0x485f('0x43')],_0x3298c0[_0x485f('0x44')]));_0x140cb7['where'][_0x485f('0x62')]=_0x45e50b['id'];if(_0x42d224[_0x485f('0x43')][_0x485f('0x4e')]){_0x140cb7[_0x485f('0x4c')]=_['merge'](_0x140cb7[_0x485f('0x4c')],{'$or':_['map'](_0x140cb7[_0x485f('0x47')],function(_0x1271fb){var _0x56e1d0={};_0x56e1d0[_0x1271fb]={'$like':'%'+_0x42d224[_0x485f('0x43')][_0x485f('0x4e')]+'%'};return _0x56e1d0;})});}_0x140cb7=_[_0x485f('0x4f')]({},_0x140cb7,_0x42d224[_0x485f('0x50')]);return db[_0x485f('0x67')][_0x485f('0x30')]({'where':_0x140cb7['where']})[_0x485f('0x1e')](function(_0x34b012){_0x4b1bfb[_0x485f('0x30')]=_0x34b012;if(_0x42d224['query']['includeAll']){_0x140cb7[_0x485f('0x52')]=[{'all':!![]}];}return db[_0x485f('0x67')][_0x485f('0x53')](_0x140cb7);})[_0x485f('0x1e')](function(_0x42a6da){_0x4b1bfb[_0x485f('0x68')]=_0x42a6da;return _0x4b1bfb;});}})[_0x485f('0x1e')](respondWithFilteredResult(_0x3d110a,_0x140cb7))[_0x485f('0x28')](handleError(_0x3d110a,null));};exports[_0x485f('0x69')]=function(_0x35d910,_0x14a431,_0x32f0ae){return db[_0x485f('0x3f')][_0x485f('0x5c')]({'where':{'id':_0x35d910['params']['id']}})['then'](handleEntityNotFound(_0x14a431,null))[_0x485f('0x1e')](function(_0xa489dc){if(_0xa489dc){return _0xa489dc[_0x485f('0x69')](_0x35d910[_0x485f('0x43')][_0x485f('0x6a')]);}})[_0x485f('0x1e')](respondWithStatusCode(_0x14a431,null))[_0x485f('0x28')](handleError(_0x14a431,null));};exports['addAnswer']=function(_0x48c7f4,_0x5d35ee,_0x581871){if(_0x48c7f4[_0x485f('0x58')]['id']){delete _0x48c7f4['body']['id'];}return db['WhatsappAccount'][_0x485f('0x5c')]({'where':{'id':_0x48c7f4['params']['id']}})['then'](handleEntityNotFound(_0x5d35ee,null))[_0x485f('0x1e')](function(_0x2b13d5){if(_0x2b13d5){_0x48c7f4[_0x485f('0x58')][_0x485f('0x62')]=_0x2b13d5['id'];return db[_0x485f('0x6b')][_0x485f('0x57')](_0x48c7f4[_0x485f('0x58')]);}})[_0x485f('0x1e')](respondWithResult(_0x5d35ee,null))[_0x485f('0x28')](handleError(_0x5d35ee,null));};exports[_0x485f('0x6c')]=function(_0x5a094a,_0x2b8e84,_0x554644){var _0x9690db={'raw':![],'where':{}};var _0xe5f5e3={};var _0x43a728={'count':0x0,'rows':[]};return db[_0x485f('0x3f')][_0x485f('0x64')]({'where':{'id':_0x5a094a[_0x485f('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b8e84,null))[_0x485f('0x1e')](function(_0x250e2a){if(_0x250e2a){_0xe5f5e3[_0x485f('0x46')]=_[_0x485f('0x65')](db[_0x485f('0x6b')]['rawAttributes']);_0xe5f5e3['query']=_['keys'](_0x5a094a[_0x485f('0x43')]);_0xe5f5e3[_0x485f('0x44')]=_[_0x485f('0x45')](_0xe5f5e3[_0x485f('0x46')],_0xe5f5e3[_0x485f('0x43')]);_0x9690db['attributes']=_[_0x485f('0x45')](_0xe5f5e3[_0x485f('0x46')],qs['fields'](_0x5a094a[_0x485f('0x43')][_0x485f('0x48')]));_0x9690db[_0x485f('0x47')]=_0x9690db[_0x485f('0x47')][_0x485f('0x56')]?_0x9690db[_0x485f('0x47')]:_0xe5f5e3[_0x485f('0x46')];if(!_0x5a094a[_0x485f('0x43')][_0x485f('0x66')]('nolimit')){_0x9690db[_0x485f('0x2f')]=qs[_0x485f('0x2f')](_0x5a094a[_0x485f('0x43')][_0x485f('0x2f')]);_0x9690db[_0x485f('0x2d')]=qs['offset'](_0x5a094a[_0x485f('0x43')]['offset']);}_0x9690db[_0x485f('0x4a')]=qs[_0x485f('0x4b')](_0x5a094a['query'][_0x485f('0x4b')]);_0x9690db[_0x485f('0x4c')]=qs[_0x485f('0x44')](_[_0x485f('0x4d')](_0x5a094a[_0x485f('0x43')],_0xe5f5e3[_0x485f('0x44')]));_0x9690db[_0x485f('0x4c')][_0x485f('0x62')]=_0x250e2a['id'];if(_0x5a094a[_0x485f('0x43')][_0x485f('0x4e')]){_0x9690db[_0x485f('0x4c')]=_[_0x485f('0x4f')](_0x9690db[_0x485f('0x4c')],{'$or':_[_0x485f('0x3e')](_0x9690db[_0x485f('0x47')],function(_0xfa5009){var _0x2abd96={};_0x2abd96[_0xfa5009]={'$like':'%'+_0x5a094a[_0x485f('0x43')][_0x485f('0x4e')]+'%'};return _0x2abd96;})});}_0x9690db=_[_0x485f('0x4f')]({},_0x9690db,_0x5a094a[_0x485f('0x50')]);return db['CannedAnswer'][_0x485f('0x30')]({'where':_0x9690db['where']})['then'](function(_0x44b8a1){_0x43a728['count']=_0x44b8a1;if(_0x5a094a[_0x485f('0x43')]['includeAll']){_0x9690db[_0x485f('0x52')]=[{'all':!![]}];}return db[_0x485f('0x6b')][_0x485f('0x53')](_0x9690db);})[_0x485f('0x1e')](function(_0x9ba409){_0x43a728[_0x485f('0x68')]=_0x9ba409;return _0x43a728;});}})[_0x485f('0x1e')](respondWithFilteredResult(_0x2b8e84,_0x9690db))['catch'](handleError(_0x2b8e84,null));};exports[_0x485f('0x6d')]=function(_0x8852a5,_0x1aa830,_0x179800){return db['WhatsappAccount'][_0x485f('0x5c')]({'where':{'id':_0x8852a5['params']['id']}})['then'](handleEntityNotFound(_0x1aa830,null))[_0x485f('0x1e')](function(_0x320a44){if(_0x320a44){return _0x320a44[_0x485f('0x6d')](_0x8852a5[_0x485f('0x43')][_0x485f('0x6a')]);}})[_0x485f('0x1e')](respondWithStatusCode(_0x1aa830,null))[_0x485f('0x28')](handleError(_0x1aa830,null));};exports[_0x485f('0x6e')]=function(_0x4f1411,_0x229d1b,_0x26e85b){return db['WhatsappAccount'][_0x485f('0x5c')]({'where':{'id':_0x4f1411[_0x485f('0x55')]['id']}})[_0x485f('0x1e')](handleEntityNotFound(_0x229d1b,null))[_0x485f('0x1e')](function(_0x3a4779){if(_0x3a4779){return _0x3a4779['addAgents'](_0x4f1411[_0x485f('0x58')][_0x485f('0x6a')],_['omit'](_0x4f1411[_0x485f('0x58')],[_0x485f('0x6a'),'id'])||{})[_0x485f('0x6f')](function(_0x1441bb){for(var _0x41b932=0x0;_0x41b932<_0x4f1411[_0x485f('0x58')][_0x485f('0x6a')][_0x485f('0x56')];_0x41b932+=0x1){socket[_0x485f('0x70')](_0x485f('0x71'),{'UserId':Number(_0x4f1411[_0x485f('0x58')][_0x485f('0x6a')][_0x41b932]),'WhatsappAccountId':Number(_0x4f1411[_0x485f('0x55')]['id'])});}return _0x1441bb;});}})[_0x485f('0x1e')](respondWithResult(_0x229d1b,null))[_0x485f('0x28')](handleError(_0x229d1b,null));};exports[_0x485f('0x72')]=function(_0x59ccc7,_0x49b3e1,_0x237bd8){return db['WhatsappAccount']['find']({'where':{'id':_0x59ccc7[_0x485f('0x55')]['id']}})[_0x485f('0x1e')](handleEntityNotFound(_0x49b3e1,null))[_0x485f('0x1e')](function(_0x59baea){if(_0x59baea){return _0x59baea[_0x485f('0x72')](_0x59ccc7['query']['ids'])[_0x485f('0x1e')](function(){if(_['isArray'](_0x59ccc7['query'][_0x485f('0x6a')])){for(var _0x3c8420=0x0;_0x3c8420<_0x59ccc7['query'][_0x485f('0x6a')][_0x485f('0x56')];_0x3c8420+=0x1){socket[_0x485f('0x70')](_0x485f('0x73'),{'UserId':Number(_0x59ccc7[_0x485f('0x43')][_0x485f('0x6a')][_0x3c8420]),'WhatsappAccountId':Number(_0x59ccc7[_0x485f('0x55')]['id'])});}}else{socket[_0x485f('0x70')](_0x485f('0x73'),{'UserId':Number(_0x59ccc7[_0x485f('0x43')]['ids']),'WhatsappAccountId':Number(_0x59ccc7[_0x485f('0x55')]['id'])});}});}})[_0x485f('0x1e')](respondWithStatusCode(_0x49b3e1,null))[_0x485f('0x28')](handleError(_0x49b3e1,null));};exports[_0x485f('0x74')]=function(_0x3e9e29,_0x9caa0e,_0x1c53e8){var _0x754654={};var _0x5c9018={};var _0x57fb8d;var _0x2b8497;return db[_0x485f('0x3f')]['findOne']({'where':{'id':_0x3e9e29['params']['id']}})[_0x485f('0x1e')](handleEntityNotFound(_0x9caa0e,null))['then'](function(_0x15c05c){if(_0x15c05c){_0x57fb8d=_0x15c05c;_0x5c9018[_0x485f('0x46')]=_['keys'](db[_0x485f('0x75')][_0x485f('0x40')]);_0x5c9018['query']=_['keys'](_0x3e9e29[_0x485f('0x43')]);_0x5c9018[_0x485f('0x44')]=_[_0x485f('0x45')](_0x5c9018[_0x485f('0x46')],_0x5c9018['query']);_0x754654[_0x485f('0x47')]=_[_0x485f('0x45')](_0x5c9018[_0x485f('0x46')],qs['fields'](_0x3e9e29[_0x485f('0x43')][_0x485f('0x48')]));_0x754654[_0x485f('0x47')]=_0x754654['attributes'][_0x485f('0x56')]?_0x754654['attributes']:_0x5c9018[_0x485f('0x46')];_0x754654[_0x485f('0x4a')]=qs[_0x485f('0x4b')](_0x3e9e29[_0x485f('0x43')][_0x485f('0x4b')]);_0x754654[_0x485f('0x4c')]=qs['filters'](_['pick'](_0x3e9e29[_0x485f('0x43')],_0x5c9018[_0x485f('0x44')]));if(_0x3e9e29['query'][_0x485f('0x4e')]){_0x754654[_0x485f('0x4c')]=_['merge'](_0x754654[_0x485f('0x4c')],{'$or':_[_0x485f('0x3e')](_0x754654[_0x485f('0x47')],function(_0x516dc2){var _0x388a64={};_0x388a64[_0x516dc2]={'$like':'%'+_0x3e9e29[_0x485f('0x43')][_0x485f('0x4e')]+'%'};return _0x388a64;})});}_0x754654=_[_0x485f('0x4f')]({},_0x754654,_0x3e9e29[_0x485f('0x50')]);return _0x57fb8d[_0x485f('0x74')](_0x754654);}})[_0x485f('0x1e')](function(_0x2db28c){if(_0x2db28c){_0x2b8497=_0x2db28c[_0x485f('0x56')];if(!_0x3e9e29[_0x485f('0x43')]['hasOwnProperty'](_0x485f('0x49'))){_0x754654[_0x485f('0x2f')]=qs[_0x485f('0x2f')](_0x3e9e29[_0x485f('0x43')][_0x485f('0x2f')]);_0x754654[_0x485f('0x2d')]=qs[_0x485f('0x2d')](_0x3e9e29['query']['offset']);}return _0x57fb8d[_0x485f('0x74')](_0x754654);}})[_0x485f('0x1e')](function(_0x3876b6){if(_0x3876b6){return _0x3876b6?{'count':_0x2b8497,'rows':_0x3876b6}:null;}})[_0x485f('0x1e')](respondWithResult(_0x9caa0e,null))[_0x485f('0x28')](handleError(_0x9caa0e,null));};exports[_0x485f('0x76')]=function(_0x8cd313,_0x52d44a){var _0x57da51=_0x8cd313[_0x485f('0x55')]['id'];var _0x57b4d2=_0x8cd313[_0x485f('0x58')];var _0x2f12b4=0xc8;var _0x1d514a=null;return db[_0x485f('0x77')]['transaction']({'isolationLevel':db[_0x485f('0x77')][_0x485f('0x78')][_0x485f('0x79')][_0x485f('0x7a')]},function(_0x552b41){return db[_0x485f('0x3f')]['findOne']({'where':{'id':_0x57da51},'transaction':_0x552b41})['then'](function(_0x5bce9c){if(_0x5bce9c){return db[_0x485f('0x7b')][_0x485f('0x37')]({'where':{'WhatsappAccountId':_0x57da51},'transaction':_0x552b41})['then'](function(){var _0x4bc830=_['map'](_0x57b4d2,function(_0x963331){_0x963331[_0x485f('0x62')]=_0x57da51;return _0x963331;});return db['WhatsappApplication'][_0x485f('0x7c')](_0x4bc830,{'transaction':_0x552b41});});}else{_0x2f12b4=0x194;_0x1d514a=[];}});})[_0x485f('0x1e')](function(){if(_0x2f12b4!==0x194){return db[_0x485f('0x7b')][_0x485f('0x7d')]({'where':{'WhatsappAccountId':_0x57da51},'order':_0x485f('0x7e')})[_0x485f('0x1e')](function(_0xa55bb6){_0x1d514a=_0xa55bb6;});}})[_0x485f('0x28')](function(_0x30ac34){_0x2f12b4=0x1f4;logger[_0x485f('0x24')](_0x30ac34[_0x485f('0x38')]);if(_0x30ac34[_0x485f('0x39')]){delete _0x30ac34['name'];}_0x1d514a=_0x30ac34;})[_0x485f('0x7f')](function(){if(_0x1d514a===null){_0x52d44a[_0x485f('0x29')](_0x2f12b4);}else{if(_0x2f12b4===0x1f4){_0x52d44a[_0x485f('0x2a')](_0x2f12b4)[_0x485f('0x3a')](_0x1d514a);}else{_0x52d44a['status'](_0x2f12b4)['json'](_0x1d514a);}}});};exports[_0x485f('0x80')]=function(_0x5512a5,_0x25967e,_0xf07c54){var _0x3ef844={};var _0x5a667e={};var _0x30435d;var _0x44e1d4;return db['WhatsappAccount'][_0x485f('0x64')]({'where':{'id':_0x5512a5[_0x485f('0x55')]['id']}})['then'](handleEntityNotFound(_0x25967e,null))['then'](function(_0x588bc5){if(_0x588bc5){_0x30435d=_0x588bc5;_0x5a667e[_0x485f('0x46')]=_[_0x485f('0x65')](db[_0x485f('0x7b')][_0x485f('0x40')]);_0x5a667e[_0x485f('0x43')]=_['keys'](_0x5512a5[_0x485f('0x43')]);_0x5a667e[_0x485f('0x44')]=_[_0x485f('0x45')](_0x5a667e[_0x485f('0x46')],_0x5a667e[_0x485f('0x43')]);_0x3ef844[_0x485f('0x47')]=_[_0x485f('0x45')](_0x5a667e['model'],qs[_0x485f('0x48')](_0x5512a5[_0x485f('0x43')][_0x485f('0x48')]));_0x3ef844[_0x485f('0x47')]=_0x3ef844[_0x485f('0x47')]['length']?_0x3ef844[_0x485f('0x47')]:_0x5a667e[_0x485f('0x46')];_0x3ef844[_0x485f('0x4a')]=qs[_0x485f('0x4b')](_0x5512a5[_0x485f('0x43')][_0x485f('0x4b')]);_0x3ef844[_0x485f('0x4c')]=qs[_0x485f('0x44')](_[_0x485f('0x4d')](_0x5512a5[_0x485f('0x43')],_0x5a667e[_0x485f('0x44')]));if(_0x5512a5[_0x485f('0x43')][_0x485f('0x4e')]){_0x3ef844[_0x485f('0x4c')]=_[_0x485f('0x4f')](_0x3ef844[_0x485f('0x4c')],{'$or':_['map'](_0x3ef844[_0x485f('0x47')],function(_0x356216){var _0x3011be={};_0x3011be[_0x356216]={'$like':'%'+_0x5512a5[_0x485f('0x43')][_0x485f('0x4e')]+'%'};return _0x3011be;})});}_0x3ef844=_[_0x485f('0x4f')]({},_0x3ef844,_0x5512a5[_0x485f('0x50')]);return _0x30435d['getApplications'](_0x3ef844);}})[_0x485f('0x1e')](function(_0x3a68fb){if(_0x3a68fb){_0x44e1d4=_0x3a68fb[_0x485f('0x56')];if(!_0x5512a5[_0x485f('0x43')][_0x485f('0x66')](_0x485f('0x49'))){_0x3ef844['limit']=qs[_0x485f('0x2f')](_0x5512a5['query'][_0x485f('0x2f')]);_0x3ef844[_0x485f('0x2d')]=qs[_0x485f('0x2d')](_0x5512a5[_0x485f('0x43')]['offset']);}return _0x30435d['getApplications'](_0x3ef844);}})['then'](function(_0x10bdec){if(_0x10bdec){return _0x10bdec?{'count':_0x44e1d4,'rows':_0x10bdec}:null;}})[_0x485f('0x1e')](respondWithResult(_0x25967e,null))[_0x485f('0x28')](handleError(_0x25967e,null));};exports[_0x485f('0x81')]=function(_0xcd9cad,_0x2bfe52,_0x2c8b2b){var _0x401bd7={'channel':'whatsapp'};var _0x3c29d0=[];var _0x543bed=[];var _0x3689fa={};return db['WhatsappAccount'][_0x485f('0x5c')]({'where':{'id':_0xcd9cad['params']['id']},'include':[{'model':db[_0x485f('0x7b')],'as':_0x485f('0x82')}]})[_0x485f('0x1e')](handleEntityNotFound(_0x2bfe52,null))[_0x485f('0x1e')](function(_0x5ce243){_0x401bd7['account']=_0x5ce243;if(_0x401bd7[_0x485f('0x83')]&&_0x401bd7[_0x485f('0x83')][_0x485f('0x41')]==='sinch'&&_0xcd9cad[_0x485f('0x58')]['statuses']){if(_0xcd9cad[_0x485f('0x58')][_0x485f('0x84')][_0x485f('0x56')]===0x0)return;if(_0xcd9cad['body'][_0x485f('0x84')][0x0]['state']!=='read')return;return db[_0x485f('0x85')][_0x485f('0x34')]({'read':!![],'readAt':_0xcd9cad[_0x485f('0x58')][_0x485f('0x84')][0x0][_0x485f('0x86')]},{'where':{'messageId':_0xcd9cad[_0x485f('0x58')][_0x485f('0x84')][0x0][_0x485f('0x87')]},'individualHooks':!![]})[_0x485f('0x1e')](function(_0x4cdeaa){return _0x2bfe52['status'](0xc8)['json'](_0x4cdeaa);});}_0x401bd7[_0x485f('0x88')]=_[_0x485f('0x89')](_0x5ce243['Applications'],[_0x485f('0x7e')],[_0x485f('0x8a')]);if(_0x401bd7['account'][_0x485f('0x82')]){delete _0x401bd7[_0x485f('0x83')][_0x485f('0x82')];}return db['CmContact'][_0x485f('0x60')]()['then'](function(_0x5c039d){if(!_0x5c039d){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x3c29d0=_[_0x485f('0x8b')](_[_0x485f('0x65')](_0x5c039d),['createdAt',_0x485f('0x8c')]);_0x543bed=_[_0x485f('0x8b')](_['keys'](_0x5c039d),[_0x485f('0x8d'),_0x485f('0x8c'),_0x485f('0x8e'),_0x485f('0x8f')]);_0x401bd7['body']={'mapKey':_0x485f('0x90')};if(_0x401bd7[_0x485f('0x83')]&&_0x401bd7[_0x485f('0x83')]['type']===_0x485f('0x91')){_0x401bd7[_0x485f('0x58')][_0x485f('0x92')]=_0xcd9cad[_0x485f('0x58')]['From'][_0x485f('0x93')](_0x485f('0x94'),'');_0x401bd7[_0x485f('0x58')][_0x485f('0x58')]=_0xcd9cad[_0x485f('0x58')][_0x485f('0x95')];_0x401bd7[_0x485f('0x58')]['messageId']=_0xcd9cad[_0x485f('0x58')][_0x485f('0x96')];}if(_0x401bd7[_0x485f('0x83')]&&_0x401bd7[_0x485f('0x83')]['type']===_0x485f('0x97')){_0x401bd7[_0x485f('0x58')][_0x485f('0x92')]=_0xcd9cad[_0x485f('0x58')]['notifications'][0x0]['from'];_0x401bd7[_0x485f('0x58')][_0x485f('0x58')]=_0xcd9cad[_0x485f('0x58')][_0x485f('0x98')][0x0][_0x485f('0x26')][_0x485f('0x58')];_0x401bd7[_0x485f('0x58')][_0x485f('0x99')]=_0xcd9cad[_0x485f('0x58')][_0x485f('0x98')][0x0][_0x485f('0x87')];}if(_0x401bd7[_0x485f('0x58')]['id']){delete _0x401bd7[_0x485f('0x58')]['id'];}if(_[_0x485f('0x9a')](_0x401bd7['body'][_0x485f('0x92')])){throw new db['Sequelize'][(_0x485f('0x9b'))](_0x485f('0x9c'));}if(_[_0x485f('0x9a')](_0x401bd7[_0x485f('0x58')][_0x485f('0x58')])||_0x401bd7[_0x485f('0x58')][_0x485f('0x58')]===''){throw new db[(_0x485f('0x9d'))]['ValidationError'](_0x485f('0x9e'));}if(_[_0x485f('0x9a')](_0x401bd7[_0x485f('0x58')][_0x485f('0x9f')])){throw new db[(_0x485f('0x9d'))][(_0x485f('0x9b'))](_0x485f('0xa0')+_0x543bed);}if(!_[_0x485f('0xa1')](_0x543bed,_0x401bd7['body'][_0x485f('0x9f')])){throw new db[(_0x485f('0x9d'))]['ValidationError'](_0x485f('0xa2')+_0x543bed);}_0x3689fa[_0x401bd7[_0x485f('0x58')][_0x485f('0x9f')]]=_0x401bd7[_0x485f('0x58')][_0x485f('0x92')];return db[_0x485f('0xa3')]['find']({'where':{'id':_0x401bd7[_0x485f('0x83')][_0x485f('0x8f')]},'include':[{'model':db[_0x485f('0xa4')],'as':_0x485f('0xa5'),'where':_0x3689fa,'limit':0x1,'order':[[_0x485f('0x8c'),_0x485f('0xa6')]]}]});})[_0x485f('0x1e')](handleEntityNotFound(_0x2bfe52,null))[_0x485f('0x1e')](function(_0x2ec3e8){if(_0x2ec3e8){_0x401bd7['list']=_[_0x485f('0xa7')](_0x2ec3e8,[_0x485f('0xa5')]);if(_0x2ec3e8['Contacts'][_0x485f('0x56')]){return _0x2ec3e8[_0x485f('0xa5')][0x0];}var _0x42f23b=_[_0x485f('0x18')](_0x401bd7[_0x485f('0x58')],{'firstName':_0x401bd7[_0x485f('0x58')]['from'],'ListId':_0x2ec3e8['id']});_0x42f23b[_0x401bd7[_0x485f('0x58')]['mapKey']]=_0x401bd7[_0x485f('0x58')][_0x485f('0x92')];return db[_0x485f('0xa4')][_0x485f('0x57')](_0x42f23b,{'fields':_0x3c29d0,'raw':!![]});}})[_0x485f('0x1e')](handleEntityNotFound(_0x2bfe52,null))[_0x485f('0x1e')](function(_0x2c4343){if(_0x2c4343){_0x401bd7[_0x485f('0xa8')]=_0x2c4343;var _0x552654={'ContactId':_0x2c4343['id'],'phone':_0x401bd7[_0x485f('0x58')]['from'],'WhatsappAccountId':_0xcd9cad['params']['id']};var _0x5e2595={'ContactId':_0x2c4343['id'],'WhatsappAccountId':_0xcd9cad[_0x485f('0x55')]['id'],'closed':![]};return db[_0x485f('0xa9')]['find']({'where':_0x5e2595})[_0x485f('0x1e')](function(_0x2fbb59){if(_0x2fbb59){return[_0x2fbb59,![]];}return db['WhatsappInteraction'][_0x485f('0x57')](_0x552654)['then'](function(_0x4fa480){return[_0x4fa480,!![]];});});}})[_0x485f('0x6f')](function(_0xc5f056,_0x4c9a60){_0x401bd7[_0x485f('0xaa')]=_0xc5f056[_0x485f('0x35')]({'plain':!![]});_0x401bd7['interaction']['created']=![];if(_0x4c9a60){if(_0x401bd7[_0x485f('0x83')][_0x485f('0xab')]){_0x401bd7['applications'][_0x485f('0xac')]({'id':0x0,'priority':_0x401bd7[_0x485f('0x88')][_0x485f('0x56')]+0x1,'app':_0x485f('0xad'),'appdata':_0x485f('0xae'),'interval':_0x485f('0xaf')});}_0x401bd7[_0x485f('0xaa')][_0x485f('0xb0')]=!![];}return db[_0x485f('0x85')][_0x485f('0x57')]({'phone':_0x401bd7['body'][_0x485f('0x92')],'messageId':_0x401bd7[_0x485f('0x58')][_0x485f('0x99')],'body':_0x401bd7['body'][_0x485f('0x58')],'WhatsappAccountId':_0xcd9cad[_0x485f('0x55')]['id'],'WhatsappInteractionId':_0xc5f056['id'],'direction':'in','ContactId':_0xc5f056[_0x485f('0xb1')],'AttachmentId':_0x401bd7[_0x485f('0x58')]['AttachmentId']});})[_0x485f('0x1e')](function(_0x27dc63){_0x401bd7[_0x485f('0x26')]=_0x27dc63;if(!_0x401bd7[_0x485f('0xaa')][_0x485f('0xb2')])return;return db[_0x485f('0x75')]['find']({'attributes':['id',_0x485f('0x39')],'where':{'id':_0x401bd7[_0x485f('0xaa')][_0x485f('0xb2')]}});})[_0x485f('0x1e')](function(_0x132eea){if(_0x132eea){_0x401bd7['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x132eea[_0x485f('0x39')]+','+(_0x401bd7[_0x485f('0x83')][_0x485f('0xb3')]||0xa),'interval':_0x485f('0xaf')});}if(!_0x401bd7[_0x485f('0xaa')]['queueId'])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x485f('0x39')],'where':{'id':_0x401bd7[_0x485f('0xaa')][_0x485f('0xb4')]}});})[_0x485f('0x1e')](function(_0x431e9a){if(_0x431e9a){_0x401bd7[_0x485f('0x88')][_0x485f('0xb5')]({'id':0x0,'priority':0x1,'app':_0x485f('0xb6'),'appdata':_0x431e9a[_0x485f('0x39')]+','+(_0x401bd7[_0x485f('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0x485f('0xaf')});}return respondWithRpcPromise(_0x485f('0xb7'),_0x485f('0xb8'),_0x401bd7);})[_0x485f('0x1e')](function(_0x47cb17){if(_0x47cb17){var _0x4f3f8a=0xc8;var _0x23afce=_0x485f('0xb9');logger[_0x485f('0x1f')](_0x485f('0x22'),_0x23afce,_0x4f3f8a,'entity\x20found');logger[_0x485f('0x21')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x23afce,_0x4f3f8a,_0x485f('0xba'),JSON[_0x485f('0x23')](_0x47cb17));if(_0x401bd7[_0x485f('0x83')]['type']===_0x485f('0x91')){return _0x2bfe52[_0x485f('0x2a')](_0x4f3f8a)['set'](_0x485f('0xbb'),_0x485f('0xbc'))['send']('\x0a');}else{return _0x2bfe52[_0x485f('0x2a')](_0x4f3f8a)[_0x485f('0x2c')](_0x47cb17);}}});})['catch'](handleError(_0x2bfe52,null));};exports[_0x485f('0x3a')]=function(_0x348185,_0x11fef9,_0x9522c5){var _0x3a3a44,_0x303eed,_0x5f3321;if(_['isNil'](_0x348185['body']['body'])||_0x348185['body'][_0x485f('0x58')]===''){throw new db['Sequelize'][(_0x485f('0x9b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x485f('0x9a')](_0x348185[_0x485f('0x58')]['to'])){throw new db[(_0x485f('0x9d'))][(_0x485f('0x9b'))]('to\x20is\x20mandatory');}_0x3a3a44=_0x348185[_0x485f('0x58')]['to'];return db['WhatsappAccount'][_0x485f('0x5c')]({'where':{'id':_0x348185[_0x485f('0x55')]['id']},'include':[{'model':db[_0x485f('0xa3')],'as':_0x485f('0xbd'),'include':[{'model':db['CmContact'],'as':_0x485f('0xa5'),'where':{'mobile':_0x3a3a44},'limit':0x1,'order':[[_0x485f('0x8c'),_0x485f('0xa6')]]}]}]})[_0x485f('0x1e')](handleEntityNotFound(_0x11fef9,null))['then'](function(_0xf824d0){if(_0xf824d0&&_0xf824d0[_0x485f('0xbd')]){_0x303eed=_0xf824d0[_0x485f('0x35')]({'plain':!![]});if(_0x303eed[_0x485f('0xbd')]&&_0x303eed[_0x485f('0xbd')][_0x485f('0xa5')][_0x485f('0x56')]){return _0x303eed['List'][_0x485f('0xa5')][0x0];}return db[_0x485f('0xa4')][_0x485f('0x57')](_[_0x485f('0x18')](_0x348185[_0x485f('0x58')],{'firstName':_0x3a3a44,'mobile':_0x3a3a44,'phone':_0x3a3a44,'ListId':_0x303eed[_0x485f('0x8f')]}));}})['then'](handleEntityNotFound(_0x11fef9,null))['then'](function(_0x724ee){if(_0x724ee){_0x5f3321=_0x724ee;return db[_0x485f('0xa9')]['find']({'where':{'ContactId':_0x5f3321['id'],'closed':![],'WhatsappAccountId':_0x303eed['id']}})[_0x485f('0x1e')](function(_0x5abd2b){if(_0x5abd2b){return[_0x5abd2b,![]];}return db[_0x485f('0xa9')][_0x485f('0x57')]({'UserId':_0x348185[_0x485f('0x59')]['id'],'ContactId':_0x5f3321['id'],'WhatsappAccountId':_0x303eed['id'],'phone':_0x3a3a44,'firstMsgDirection':_0x485f('0xbe'),'Messages':[_[_0x485f('0x4f')](_0x348185[_0x485f('0x58')],{'read':![],'body':_0x348185[_0x485f('0x58')]['body'],'phone':_0x3a3a44,'WhatsappAccountId':_0x303eed['id'],'UserId':_0x348185[_0x485f('0x59')]['id'],'ContactId':_0x5f3321['id']})]},{'include':[{'model':db[_0x485f('0x85')],'as':'Messages'}]})['then'](function(_0x1a845f){return[_0x1a845f,!![]];});});}})['spread'](function(_0x79d042,_0x31b24d){if(_0x31b24d){return _0x79d042;}return db[_0x485f('0x85')]['create'](_[_0x485f('0x4f')](_0x348185[_0x485f('0x58')],{'read':![],'body':_0x348185['body'][_0x485f('0x58')],'phone':_0x3a3a44,'WhatsappAccountId':_0x303eed['id'],'WhatsappInteractionId':_0x79d042['id'],'UserId':_0x348185['user']['id'],'ContactId':_0x5f3321['id']}))[_0x485f('0x1e')](function(_0x93db8f){_0x79d042['dataValues'][_0x485f('0xbf')]=[];_0x79d042[_0x485f('0xc0')][_0x485f('0xbf')][_0x485f('0xac')](_0x93db8f[_0x485f('0xc0')]);return _0x79d042;});})[_0x485f('0x1e')](respondWithResult(_0x11fef9,null))['catch'](handleError(_0x11fef9,null));}; \ No newline at end of file +var _0xb2a6=['Disposition','findAll','removeDispositions','addAnswer','CannedAnswer','getAnswers','includeAll','removeAnswers','ids','addAgents','omit','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','WhatsappMessage','timestamp','message_id','applications','orderBy','CmContact','Sequelize','no\x20available\x20attributes','createdAt','difference','CompanyId','ListId','mobile','twilio','From','Body','messageId','MessageSid','sinch','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','updatedAt','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','waitForTheAssignedAgent','WhatsappQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','DESC','List','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappAccount.socket','register','jayson/promise','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','send','index','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','rows','show','params','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','Pause','describe','WhatsappAccountId','getDispositions','findOne'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb2a6,0x12c));var _0x6b2a=function(_0x57a734,_0xab6c46){_0x57a734=_0x57a734-0x0;var _0x3c8aff=_0xb2a6[_0x57a734];return _0x3c8aff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6b2a('0x0'));var zipdir=require(_0x6b2a('0x1'));var jsonpatch=require(_0x6b2a('0x2'));var rp=require(_0x6b2a('0x3'));var moment=require(_0x6b2a('0x4'));var BPromise=require(_0x6b2a('0x5'));var Mustache=require(_0x6b2a('0x6'));var util=require('util');var path=require(_0x6b2a('0x7'));var sox=require(_0x6b2a('0x8'));var csv=require('to-csv');var ejs=require(_0x6b2a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b2a('0xa'));var squel=require(_0x6b2a('0xb'));var crypto=require(_0x6b2a('0xc'));var jsforce=require(_0x6b2a('0xd'));var deskjs=require(_0x6b2a('0xe'));var toCsv=require(_0x6b2a('0xf'));var querystring=require('querystring');var Papa=require(_0x6b2a('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6b2a('0x11'));var as=require(_0x6b2a('0x12'));var hardwareService=require(_0x6b2a('0x13'));var logger=require(_0x6b2a('0x14'))(_0x6b2a('0x15'));var utils=require(_0x6b2a('0x16'));var config=require(_0x6b2a('0x17'));var licenseUtil=require(_0x6b2a('0x18'));var db=require(_0x6b2a('0x19'))['db'];config[_0x6b2a('0x1a')]=_[_0x6b2a('0x1b')](config[_0x6b2a('0x1a')],{'host':_0x6b2a('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b2a('0x1a')]));require(_0x6b2a('0x1d'))[_0x6b2a('0x1e')](socket);var jayson=require(_0x6b2a('0x1f'));var client=jayson['client'][_0x6b2a('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4893e9,_0x22f8f8,_0x8ef9d8,_0x83c384){return new BPromise(function(_0x3fa5a5,_0x51b193){var _0x296cab=_0x83c384||client;return _0x296cab['request'](_0x4893e9,_0x8ef9d8)[_0x6b2a('0x21')](function(_0x3b51b9){logger[_0x6b2a('0x22')](_0x6b2a('0x23'),_0x22f8f8,_0x6b2a('0x24'));logger[_0x6b2a('0x25')](_0x6b2a('0x26'),_0x22f8f8,_0x6b2a('0x24'),JSON[_0x6b2a('0x27')](_0x3b51b9));if(_0x3b51b9['error']){if(_0x3b51b9[_0x6b2a('0x28')][_0x6b2a('0x29')]===0x1f4){logger[_0x6b2a('0x28')](_0x6b2a('0x23'),_0x22f8f8,_0x3b51b9['error']['message']);return _0x51b193(_0x3b51b9[_0x6b2a('0x28')]['message']);}logger[_0x6b2a('0x28')](_0x6b2a('0x23'),_0x22f8f8,_0x3b51b9[_0x6b2a('0x28')]['message']);return _0x3fa5a5(_0x3b51b9[_0x6b2a('0x28')][_0x6b2a('0x2a')]);}else{logger[_0x6b2a('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x22f8f8,_0x6b2a('0x24'));_0x3fa5a5(_0x3b51b9['result'][_0x6b2a('0x2a')]);}})[_0x6b2a('0x2b')](function(_0x351945){logger['error'](_0x6b2a('0x23'),_0x22f8f8,_0x351945);_0x51b193(_0x351945);});});}function respondWithStatusCode(_0x4c1ed4,_0x3a2826){_0x3a2826=_0x3a2826||0xcc;return function(_0x5370ef){if(_0x5370ef){return _0x4c1ed4[_0x6b2a('0x2c')](_0x3a2826);}return _0x4c1ed4['status'](_0x3a2826)['end']();};}function respondWithResult(_0x1f4069,_0x300cb6){_0x300cb6=_0x300cb6||0xc8;return function(_0x38231d){if(_0x38231d){return _0x1f4069[_0x6b2a('0x2d')](_0x300cb6)[_0x6b2a('0x2e')](_0x38231d);}};}function respondWithFilteredResult(_0x1f128b,_0x49da5d){return function(_0x54ee08){if(_0x54ee08){var _0x420c5e=typeof _0x49da5d['offset']===_0x6b2a('0x2f')&&typeof _0x49da5d[_0x6b2a('0x30')]===_0x6b2a('0x2f');var _0x41eb84=_0x54ee08[_0x6b2a('0x31')];var _0xbf826=_0x420c5e?0x0:_0x49da5d[_0x6b2a('0x32')];var _0x32458c=_0x420c5e?_0x54ee08[_0x6b2a('0x31')]:_0x49da5d[_0x6b2a('0x32')]+_0x49da5d[_0x6b2a('0x30')];var _0xa2ae4;if(_0x32458c>=_0x41eb84){_0x32458c=_0x41eb84;_0xa2ae4=0xc8;}else{_0xa2ae4=0xce;}_0x1f128b[_0x6b2a('0x2d')](_0xa2ae4);return _0x1f128b[_0x6b2a('0x33')]('Content-Range',_0xbf826+'-'+_0x32458c+'/'+_0x41eb84)['json'](_0x54ee08);}return null;};}function patchUpdates(_0x38f801){return function(_0x526cd2){try{jsonpatch[_0x6b2a('0x34')](_0x526cd2,_0x38f801,!![]);}catch(_0x3bc29f){return BPromise[_0x6b2a('0x35')](_0x3bc29f);}return _0x526cd2[_0x6b2a('0x36')]();};}function saveUpdates(_0x2e6fed,_0x58c083){return function(_0x10c690){if(_0x10c690){return _0x10c690[_0x6b2a('0x37')](_0x2e6fed)[_0x6b2a('0x21')](function(_0x478704){return _0x478704;});}return null;};}function removeEntity(_0x4e6871,_0x4e02b1){return function(_0x48d0d4){if(_0x48d0d4){return _0x48d0d4[_0x6b2a('0x38')]()[_0x6b2a('0x21')](function(){var _0x40dbb0=_0x48d0d4[_0x6b2a('0x39')]({'plain':!![]});var _0x276775=_0x6b2a('0x3a');return db[_0x6b2a('0x3b')][_0x6b2a('0x38')]({'where':{'type':_0x276775,'resourceId':_0x40dbb0['id']}})[_0x6b2a('0x21')](function(){return _0x48d0d4;});})[_0x6b2a('0x21')](function(){_0x4e6871['status'](0xcc)[_0x6b2a('0x3c')]();});}};}function handleEntityNotFound(_0x55574e,_0xb69c08){return function(_0x102540){if(!_0x102540){_0x55574e[_0x6b2a('0x2c')](0x194);}return _0x102540;};}function handleError(_0xe84b9a,_0x3cc400){_0x3cc400=_0x3cc400||0x1f4;return function(_0x3e02b9){logger[_0x6b2a('0x28')](_0x3e02b9[_0x6b2a('0x3d')]);if(_0x3e02b9[_0x6b2a('0x3e')]){delete _0x3e02b9['name'];}_0xe84b9a[_0x6b2a('0x2d')](_0x3cc400)[_0x6b2a('0x3f')](_0x3e02b9);};}exports[_0x6b2a('0x40')]=function(_0x1f1714,_0x4687c5){var _0x401938={'include':[{'model':db['Pause'],'as':_0x6b2a('0x41')}]},_0x252536={},_0x5aaa41={'count':0x0,'rows':[]};var _0x1a48f2=_[_0x6b2a('0x42')](db[_0x6b2a('0x43')][_0x6b2a('0x44')],function(_0x1aca39){return{'name':_0x1aca39[_0x6b2a('0x45')],'type':_0x1aca39[_0x6b2a('0x46')][_0x6b2a('0x47')]};});_0x252536[_0x6b2a('0x48')]=_[_0x6b2a('0x42')](_0x1a48f2,_0x6b2a('0x3e'));_0x252536[_0x6b2a('0x49')]=_[_0x6b2a('0x4a')](_0x1f1714[_0x6b2a('0x49')]);_0x252536[_0x6b2a('0x4b')]=_['intersection'](_0x252536[_0x6b2a('0x48')],_0x252536['query']);_0x401938[_0x6b2a('0x4c')]=_[_0x6b2a('0x4d')](_0x252536[_0x6b2a('0x48')],qs[_0x6b2a('0x4e')](_0x1f1714['query'][_0x6b2a('0x4e')]));_0x401938[_0x6b2a('0x4c')]=_0x401938[_0x6b2a('0x4c')][_0x6b2a('0x4f')]?_0x401938[_0x6b2a('0x4c')]:_0x252536['model'];if(!_0x1f1714[_0x6b2a('0x49')][_0x6b2a('0x50')](_0x6b2a('0x51'))){_0x401938[_0x6b2a('0x30')]=qs[_0x6b2a('0x30')](_0x1f1714[_0x6b2a('0x49')][_0x6b2a('0x30')]);_0x401938[_0x6b2a('0x32')]=qs[_0x6b2a('0x32')](_0x1f1714[_0x6b2a('0x49')][_0x6b2a('0x32')]);}_0x401938[_0x6b2a('0x52')]=qs[_0x6b2a('0x53')](_0x1f1714[_0x6b2a('0x49')][_0x6b2a('0x53')]);_0x401938['where']=qs[_0x6b2a('0x4b')](_[_0x6b2a('0x54')](_0x1f1714[_0x6b2a('0x49')],_0x252536[_0x6b2a('0x4b')]),_0x1a48f2);if(_0x1f1714[_0x6b2a('0x49')][_0x6b2a('0x55')]){_0x401938[_0x6b2a('0x56')]=_['merge'](_0x401938['where'],{'$or':_['map'](_0x1a48f2,function(_0x580514){if(_0x580514[_0x6b2a('0x46')]!=='VIRTUAL'){var _0x455983={};_0x455983[_0x580514[_0x6b2a('0x3e')]]={'$like':'%'+_0x1f1714['query'][_0x6b2a('0x55')]+'%'};return _0x455983;}})});}_0x401938=_[_0x6b2a('0x57')]({},_0x401938,_0x1f1714[_0x6b2a('0x58')]);var _0x2b9d15={'where':_0x401938[_0x6b2a('0x56')]};return db['WhatsappAccount'][_0x6b2a('0x31')](_0x2b9d15)['then'](function(_0x18af7f){_0x5aaa41['count']=_0x18af7f;if(_0x1f1714[_0x6b2a('0x49')]['includeAll']){_0x401938[_0x6b2a('0x59')]=[{'all':!![]}];}return db[_0x6b2a('0x43')]['findAll'](_0x401938);})['then'](function(_0x5c5902){_0x5aaa41[_0x6b2a('0x5a')]=_0x5c5902;return _0x5aaa41;})[_0x6b2a('0x21')](respondWithFilteredResult(_0x4687c5,_0x401938))[_0x6b2a('0x2b')](handleError(_0x4687c5,null));};exports[_0x6b2a('0x5b')]=function(_0x8f3abe,_0x4508e1){var _0x42de8a={'raw':![],'where':{'id':_0x8f3abe[_0x6b2a('0x5c')]['id']},'include':[{'model':db['Pause'],'as':_0x6b2a('0x41')}]},_0x1aee12={};_0x1aee12[_0x6b2a('0x48')]=_[_0x6b2a('0x4a')](db['WhatsappAccount']['rawAttributes']);_0x1aee12['query']=_[_0x6b2a('0x4a')](_0x8f3abe[_0x6b2a('0x49')]);_0x1aee12[_0x6b2a('0x4b')]=_[_0x6b2a('0x4d')](_0x1aee12[_0x6b2a('0x48')],_0x1aee12[_0x6b2a('0x49')]);_0x42de8a[_0x6b2a('0x4c')]=_[_0x6b2a('0x4d')](_0x1aee12['model'],qs[_0x6b2a('0x4e')](_0x8f3abe[_0x6b2a('0x49')][_0x6b2a('0x4e')]));_0x42de8a[_0x6b2a('0x4c')]=_0x42de8a['attributes'][_0x6b2a('0x4f')]?_0x42de8a[_0x6b2a('0x4c')]:_0x1aee12[_0x6b2a('0x48')];if(_0x8f3abe[_0x6b2a('0x49')]['includeAll']){_0x42de8a[_0x6b2a('0x59')]=[{'all':!![]}];}_0x42de8a=_[_0x6b2a('0x57')]({},_0x42de8a,_0x8f3abe[_0x6b2a('0x58')]);return db[_0x6b2a('0x43')][_0x6b2a('0x5d')](_0x42de8a)['then'](handleEntityNotFound(_0x4508e1,null))['then'](respondWithResult(_0x4508e1,null))[_0x6b2a('0x2b')](handleError(_0x4508e1,null));};exports[_0x6b2a('0x5e')]=function(_0x408590,_0x45c74b){return db['WhatsappAccount'][_0x6b2a('0x5e')](_0x408590[_0x6b2a('0x5f')],{})[_0x6b2a('0x21')](function(_0x3152c4){var _0x567d6b=_0x408590[_0x6b2a('0x60')][_0x6b2a('0x39')]({'plain':!![]});if(!_0x567d6b)throw new Error(_0x6b2a('0x61'));if(_0x567d6b[_0x6b2a('0x62')]==='user'){var _0x3c7d03=_0x3152c4[_0x6b2a('0x39')]({'plain':!![]});var _0x761854=_0x6b2a('0x3a');return db[_0x6b2a('0x63')][_0x6b2a('0x5d')]({'where':{'name':_0x761854,'userProfileId':_0x567d6b[_0x6b2a('0x64')]},'raw':!![]})[_0x6b2a('0x21')](function(_0x142554){if(_0x142554&&_0x142554[_0x6b2a('0x65')]===0x0){return db[_0x6b2a('0x3b')]['create']({'name':_0x3c7d03[_0x6b2a('0x3e')],'resourceId':_0x3c7d03['id'],'type':_0x142554[_0x6b2a('0x3e')],'sectionId':_0x142554['id']},{})[_0x6b2a('0x21')](function(){return _0x3152c4;});}else{return _0x3152c4;}})[_0x6b2a('0x2b')](function(_0x5e9d4e){logger[_0x6b2a('0x28')](_0x6b2a('0x66'),_0x5e9d4e);throw _0x5e9d4e;});}return _0x3152c4;})['then'](respondWithResult(_0x45c74b,0xc9))[_0x6b2a('0x2b')](handleError(_0x45c74b,null));};exports[_0x6b2a('0x37')]=function(_0x524fc0,_0xecd8e6){if(_0x524fc0[_0x6b2a('0x5f')]['id']){delete _0x524fc0[_0x6b2a('0x5f')]['id'];}return db['WhatsappAccount'][_0x6b2a('0x5d')]({'where':{'id':_0x524fc0['params']['id']},'include':[{'model':db[_0x6b2a('0x67')],'as':_0x6b2a('0x41')}]})[_0x6b2a('0x21')](handleEntityNotFound(_0xecd8e6,null))['then'](saveUpdates(_0x524fc0[_0x6b2a('0x5f')],null))[_0x6b2a('0x21')](respondWithResult(_0xecd8e6,null))[_0x6b2a('0x2b')](handleError(_0xecd8e6,null));};exports[_0x6b2a('0x38')]=function(_0xb1a0e9,_0x451382){return db[_0x6b2a('0x43')][_0x6b2a('0x5d')]({'where':{'id':_0xb1a0e9['params']['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0x451382,null))[_0x6b2a('0x21')](removeEntity(_0x451382,null))[_0x6b2a('0x2b')](handleError(_0x451382,null));};exports[_0x6b2a('0x68')]=function(_0x454736,_0x3c6c81){return db['WhatsappAccount'][_0x6b2a('0x68')]()[_0x6b2a('0x21')](respondWithResult(_0x3c6c81,null))[_0x6b2a('0x2b')](handleError(_0x3c6c81,null));};exports['addDisposition']=function(_0x28a31d,_0x3f98fe,_0x5c30b4){if(_0x28a31d[_0x6b2a('0x5f')]['id']){delete _0x28a31d[_0x6b2a('0x5f')]['id'];}return db[_0x6b2a('0x43')]['find']({'where':{'id':_0x28a31d[_0x6b2a('0x5c')]['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0x3f98fe,null))['then'](function(_0xb596ef){if(_0xb596ef){_0x28a31d[_0x6b2a('0x5f')][_0x6b2a('0x69')]=_0xb596ef['id'];return db['Disposition'][_0x6b2a('0x5e')](_0x28a31d[_0x6b2a('0x5f')]);}})['then'](respondWithResult(_0x3f98fe,null))['catch'](handleError(_0x3f98fe,null));};exports[_0x6b2a('0x6a')]=function(_0x18ed46,_0x5c6f2d,_0x4ea3bf){var _0x30cb67={'raw':![],'where':{}};var _0x5a6e2a={};var _0x84c3ca={'count':0x0,'rows':[]};return db[_0x6b2a('0x43')][_0x6b2a('0x6b')]({'where':{'id':_0x18ed46[_0x6b2a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5c6f2d,null))[_0x6b2a('0x21')](function(_0xb9748d){if(_0xb9748d){_0x5a6e2a[_0x6b2a('0x48')]=_[_0x6b2a('0x4a')](db[_0x6b2a('0x6c')][_0x6b2a('0x44')]);_0x5a6e2a[_0x6b2a('0x49')]=_['keys'](_0x18ed46[_0x6b2a('0x49')]);_0x5a6e2a[_0x6b2a('0x4b')]=_[_0x6b2a('0x4d')](_0x5a6e2a[_0x6b2a('0x48')],_0x5a6e2a[_0x6b2a('0x49')]);_0x30cb67[_0x6b2a('0x4c')]=_[_0x6b2a('0x4d')](_0x5a6e2a[_0x6b2a('0x48')],qs[_0x6b2a('0x4e')](_0x18ed46[_0x6b2a('0x49')][_0x6b2a('0x4e')]));_0x30cb67['attributes']=_0x30cb67[_0x6b2a('0x4c')]['length']?_0x30cb67[_0x6b2a('0x4c')]:_0x5a6e2a['model'];if(!_0x18ed46['query'][_0x6b2a('0x50')](_0x6b2a('0x51'))){_0x30cb67['limit']=qs[_0x6b2a('0x30')](_0x18ed46['query'][_0x6b2a('0x30')]);_0x30cb67[_0x6b2a('0x32')]=qs[_0x6b2a('0x32')](_0x18ed46[_0x6b2a('0x49')][_0x6b2a('0x32')]);}_0x30cb67[_0x6b2a('0x52')]=qs[_0x6b2a('0x53')](_0x18ed46[_0x6b2a('0x49')]['sort']);_0x30cb67[_0x6b2a('0x56')]=qs[_0x6b2a('0x4b')](_[_0x6b2a('0x54')](_0x18ed46[_0x6b2a('0x49')],_0x5a6e2a[_0x6b2a('0x4b')]));_0x30cb67[_0x6b2a('0x56')]['WhatsappAccountId']=_0xb9748d['id'];if(_0x18ed46[_0x6b2a('0x49')][_0x6b2a('0x55')]){_0x30cb67[_0x6b2a('0x56')]=_[_0x6b2a('0x57')](_0x30cb67[_0x6b2a('0x56')],{'$or':_[_0x6b2a('0x42')](_0x30cb67['attributes'],function(_0x18fd33){var _0x45086a={};_0x45086a[_0x18fd33]={'$like':'%'+_0x18ed46[_0x6b2a('0x49')][_0x6b2a('0x55')]+'%'};return _0x45086a;})});}_0x30cb67=_[_0x6b2a('0x57')]({},_0x30cb67,_0x18ed46[_0x6b2a('0x58')]);return db['Disposition']['count']({'where':_0x30cb67['where']})[_0x6b2a('0x21')](function(_0x5c37bf){_0x84c3ca[_0x6b2a('0x31')]=_0x5c37bf;if(_0x18ed46[_0x6b2a('0x49')]['includeAll']){_0x30cb67[_0x6b2a('0x59')]=[{'all':!![]}];}return db['Disposition'][_0x6b2a('0x6d')](_0x30cb67);})[_0x6b2a('0x21')](function(_0x5c14f4){_0x84c3ca['rows']=_0x5c14f4;return _0x84c3ca;});}})[_0x6b2a('0x21')](respondWithFilteredResult(_0x5c6f2d,_0x30cb67))[_0x6b2a('0x2b')](handleError(_0x5c6f2d,null));};exports[_0x6b2a('0x6e')]=function(_0x35c825,_0x3871d1,_0x491477){return db[_0x6b2a('0x43')]['find']({'where':{'id':_0x35c825['params']['id']}})['then'](handleEntityNotFound(_0x3871d1,null))[_0x6b2a('0x21')](function(_0x47588c){if(_0x47588c){return _0x47588c[_0x6b2a('0x6e')](_0x35c825['query']['ids']);}})['then'](respondWithStatusCode(_0x3871d1,null))[_0x6b2a('0x2b')](handleError(_0x3871d1,null));};exports[_0x6b2a('0x6f')]=function(_0x360d4f,_0x16176c,_0x2427b3){if(_0x360d4f['body']['id']){delete _0x360d4f['body']['id'];}return db[_0x6b2a('0x43')][_0x6b2a('0x5d')]({'where':{'id':_0x360d4f[_0x6b2a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x16176c,null))[_0x6b2a('0x21')](function(_0x48a7cf){if(_0x48a7cf){_0x360d4f[_0x6b2a('0x5f')][_0x6b2a('0x69')]=_0x48a7cf['id'];return db[_0x6b2a('0x70')][_0x6b2a('0x5e')](_0x360d4f['body']);}})[_0x6b2a('0x21')](respondWithResult(_0x16176c,null))[_0x6b2a('0x2b')](handleError(_0x16176c,null));};exports[_0x6b2a('0x71')]=function(_0xed38a4,_0x727fd5,_0x458a15){var _0xb3be1d={'raw':![],'where':{}};var _0x36e550={};var _0x27cb6e={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x6b2a('0x6b')]({'where':{'id':_0xed38a4[_0x6b2a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x727fd5,null))[_0x6b2a('0x21')](function(_0x53dda9){if(_0x53dda9){_0x36e550[_0x6b2a('0x48')]=_[_0x6b2a('0x4a')](db[_0x6b2a('0x70')][_0x6b2a('0x44')]);_0x36e550[_0x6b2a('0x49')]=_[_0x6b2a('0x4a')](_0xed38a4[_0x6b2a('0x49')]);_0x36e550[_0x6b2a('0x4b')]=_[_0x6b2a('0x4d')](_0x36e550[_0x6b2a('0x48')],_0x36e550[_0x6b2a('0x49')]);_0xb3be1d[_0x6b2a('0x4c')]=_[_0x6b2a('0x4d')](_0x36e550[_0x6b2a('0x48')],qs[_0x6b2a('0x4e')](_0xed38a4[_0x6b2a('0x49')][_0x6b2a('0x4e')]));_0xb3be1d[_0x6b2a('0x4c')]=_0xb3be1d[_0x6b2a('0x4c')][_0x6b2a('0x4f')]?_0xb3be1d[_0x6b2a('0x4c')]:_0x36e550[_0x6b2a('0x48')];if(!_0xed38a4['query'][_0x6b2a('0x50')](_0x6b2a('0x51'))){_0xb3be1d[_0x6b2a('0x30')]=qs[_0x6b2a('0x30')](_0xed38a4[_0x6b2a('0x49')][_0x6b2a('0x30')]);_0xb3be1d['offset']=qs[_0x6b2a('0x32')](_0xed38a4[_0x6b2a('0x49')][_0x6b2a('0x32')]);}_0xb3be1d[_0x6b2a('0x52')]=qs['sort'](_0xed38a4['query'][_0x6b2a('0x53')]);_0xb3be1d['where']=qs['filters'](_[_0x6b2a('0x54')](_0xed38a4[_0x6b2a('0x49')],_0x36e550[_0x6b2a('0x4b')]));_0xb3be1d[_0x6b2a('0x56')][_0x6b2a('0x69')]=_0x53dda9['id'];if(_0xed38a4['query'][_0x6b2a('0x55')]){_0xb3be1d[_0x6b2a('0x56')]=_[_0x6b2a('0x57')](_0xb3be1d['where'],{'$or':_['map'](_0xb3be1d[_0x6b2a('0x4c')],function(_0x67c1b5){var _0x53f722={};_0x53f722[_0x67c1b5]={'$like':'%'+_0xed38a4[_0x6b2a('0x49')]['filter']+'%'};return _0x53f722;})});}_0xb3be1d=_[_0x6b2a('0x57')]({},_0xb3be1d,_0xed38a4['options']);return db[_0x6b2a('0x70')][_0x6b2a('0x31')]({'where':_0xb3be1d['where']})['then'](function(_0x53785f){_0x27cb6e[_0x6b2a('0x31')]=_0x53785f;if(_0xed38a4[_0x6b2a('0x49')][_0x6b2a('0x72')]){_0xb3be1d[_0x6b2a('0x59')]=[{'all':!![]}];}return db[_0x6b2a('0x70')][_0x6b2a('0x6d')](_0xb3be1d);})[_0x6b2a('0x21')](function(_0x3bc1e9){_0x27cb6e['rows']=_0x3bc1e9;return _0x27cb6e;});}})[_0x6b2a('0x21')](respondWithFilteredResult(_0x727fd5,_0xb3be1d))['catch'](handleError(_0x727fd5,null));};exports[_0x6b2a('0x73')]=function(_0x287993,_0x472440,_0x5cf720){return db[_0x6b2a('0x43')][_0x6b2a('0x5d')]({'where':{'id':_0x287993[_0x6b2a('0x5c')]['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0x472440,null))[_0x6b2a('0x21')](function(_0x412aed){if(_0x412aed){return _0x412aed[_0x6b2a('0x73')](_0x287993[_0x6b2a('0x49')][_0x6b2a('0x74')]);}})[_0x6b2a('0x21')](respondWithStatusCode(_0x472440,null))[_0x6b2a('0x2b')](handleError(_0x472440,null));};exports[_0x6b2a('0x75')]=function(_0x1eeea7,_0x8425f9,_0x36b536){return db[_0x6b2a('0x43')][_0x6b2a('0x5d')]({'where':{'id':_0x1eeea7[_0x6b2a('0x5c')]['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0x8425f9,null))['then'](function(_0x45b695){if(_0x45b695){return _0x45b695[_0x6b2a('0x75')](_0x1eeea7['body']['ids'],_[_0x6b2a('0x76')](_0x1eeea7['body'],['ids','id'])||{})[_0x6b2a('0x77')](function(_0x37954f){for(var _0x9ca541=0x0;_0x9ca541<_0x1eeea7[_0x6b2a('0x5f')]['ids'][_0x6b2a('0x4f')];_0x9ca541+=0x1){socket[_0x6b2a('0x78')](_0x6b2a('0x79'),{'UserId':Number(_0x1eeea7[_0x6b2a('0x5f')][_0x6b2a('0x74')][_0x9ca541]),'WhatsappAccountId':Number(_0x1eeea7['params']['id'])});}return _0x37954f;});}})['then'](respondWithResult(_0x8425f9,null))['catch'](handleError(_0x8425f9,null));};exports[_0x6b2a('0x7a')]=function(_0x1d28e8,_0x5d8e42,_0x35a264){return db[_0x6b2a('0x43')][_0x6b2a('0x5d')]({'where':{'id':_0x1d28e8[_0x6b2a('0x5c')]['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0x5d8e42,null))[_0x6b2a('0x21')](function(_0x3f21b0){if(_0x3f21b0){return _0x3f21b0[_0x6b2a('0x7a')](_0x1d28e8[_0x6b2a('0x49')]['ids'])[_0x6b2a('0x21')](function(){if(_[_0x6b2a('0x7b')](_0x1d28e8[_0x6b2a('0x49')][_0x6b2a('0x74')])){for(var _0x3c5bc2=0x0;_0x3c5bc2<_0x1d28e8[_0x6b2a('0x49')]['ids'][_0x6b2a('0x4f')];_0x3c5bc2+=0x1){socket[_0x6b2a('0x78')](_0x6b2a('0x7c'),{'UserId':Number(_0x1d28e8['query'][_0x6b2a('0x74')][_0x3c5bc2]),'WhatsappAccountId':Number(_0x1d28e8[_0x6b2a('0x5c')]['id'])});}}else{socket[_0x6b2a('0x78')](_0x6b2a('0x7c'),{'UserId':Number(_0x1d28e8[_0x6b2a('0x49')][_0x6b2a('0x74')]),'WhatsappAccountId':Number(_0x1d28e8['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5d8e42,null))[_0x6b2a('0x2b')](handleError(_0x5d8e42,null));};exports[_0x6b2a('0x7d')]=function(_0x4f062b,_0xfd89eb,_0x18f655){var _0x339ee9={};var _0x58c403={};var _0xd30a58;var _0x60e805;return db['WhatsappAccount'][_0x6b2a('0x6b')]({'where':{'id':_0x4f062b[_0x6b2a('0x5c')]['id']}})[_0x6b2a('0x21')](handleEntityNotFound(_0xfd89eb,null))[_0x6b2a('0x21')](function(_0x27420b){if(_0x27420b){_0xd30a58=_0x27420b;_0x58c403[_0x6b2a('0x48')]=_[_0x6b2a('0x4a')](db[_0x6b2a('0x7e')]['rawAttributes']);_0x58c403['query']=_['keys'](_0x4f062b[_0x6b2a('0x49')]);_0x58c403['filters']=_['intersection'](_0x58c403[_0x6b2a('0x48')],_0x58c403[_0x6b2a('0x49')]);_0x339ee9[_0x6b2a('0x4c')]=_[_0x6b2a('0x4d')](_0x58c403[_0x6b2a('0x48')],qs[_0x6b2a('0x4e')](_0x4f062b[_0x6b2a('0x49')][_0x6b2a('0x4e')]));_0x339ee9[_0x6b2a('0x4c')]=_0x339ee9[_0x6b2a('0x4c')][_0x6b2a('0x4f')]?_0x339ee9['attributes']:_0x58c403['model'];_0x339ee9[_0x6b2a('0x52')]=qs[_0x6b2a('0x53')](_0x4f062b['query']['sort']);_0x339ee9[_0x6b2a('0x56')]=qs[_0x6b2a('0x4b')](_['pick'](_0x4f062b['query'],_0x58c403[_0x6b2a('0x4b')]));if(_0x4f062b[_0x6b2a('0x49')][_0x6b2a('0x55')]){_0x339ee9[_0x6b2a('0x56')]=_['merge'](_0x339ee9['where'],{'$or':_['map'](_0x339ee9['attributes'],function(_0x16d5ff){var _0x198e06={};_0x198e06[_0x16d5ff]={'$like':'%'+_0x4f062b['query']['filter']+'%'};return _0x198e06;})});}_0x339ee9=_['merge']({},_0x339ee9,_0x4f062b['options']);return _0xd30a58[_0x6b2a('0x7d')](_0x339ee9);}})[_0x6b2a('0x21')](function(_0x167edd){if(_0x167edd){_0x60e805=_0x167edd[_0x6b2a('0x4f')];if(!_0x4f062b[_0x6b2a('0x49')][_0x6b2a('0x50')]('nolimit')){_0x339ee9[_0x6b2a('0x30')]=qs[_0x6b2a('0x30')](_0x4f062b[_0x6b2a('0x49')][_0x6b2a('0x30')]);_0x339ee9[_0x6b2a('0x32')]=qs[_0x6b2a('0x32')](_0x4f062b['query'][_0x6b2a('0x32')]);}return _0xd30a58[_0x6b2a('0x7d')](_0x339ee9);}})[_0x6b2a('0x21')](function(_0x49d89f){if(_0x49d89f){return _0x49d89f?{'count':_0x60e805,'rows':_0x49d89f}:null;}})[_0x6b2a('0x21')](respondWithResult(_0xfd89eb,null))[_0x6b2a('0x2b')](handleError(_0xfd89eb,null));};exports['addApplications']=function(_0x5e632,_0x48b514){var _0x28bdce=_0x5e632[_0x6b2a('0x5c')]['id'];var _0x49888d=_0x5e632[_0x6b2a('0x5f')];var _0x195695=0xc8;var _0x464e62=null;return db[_0x6b2a('0x7f')][_0x6b2a('0x80')]({'isolationLevel':db[_0x6b2a('0x7f')]['Transaction'][_0x6b2a('0x81')][_0x6b2a('0x82')]},function(_0x43da03){return db[_0x6b2a('0x43')][_0x6b2a('0x6b')]({'where':{'id':_0x28bdce},'transaction':_0x43da03})['then'](function(_0x3eee0f){if(_0x3eee0f){return db['WhatsappApplication']['destroy']({'where':{'WhatsappAccountId':_0x28bdce},'transaction':_0x43da03})[_0x6b2a('0x21')](function(){var _0xb8fea5=_[_0x6b2a('0x42')](_0x49888d,function(_0x3d9e89){_0x3d9e89[_0x6b2a('0x69')]=_0x28bdce;return _0x3d9e89;});return db[_0x6b2a('0x83')][_0x6b2a('0x84')](_0xb8fea5,{'transaction':_0x43da03});});}else{_0x195695=0x194;_0x464e62=[];}});})[_0x6b2a('0x21')](function(){if(_0x195695!==0x194){return db[_0x6b2a('0x83')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x28bdce},'order':_0x6b2a('0x85')})[_0x6b2a('0x21')](function(_0xcffaba){_0x464e62=_0xcffaba;});}})[_0x6b2a('0x2b')](function(_0x1c8587){_0x195695=0x1f4;logger['error'](_0x1c8587[_0x6b2a('0x3d')]);if(_0x1c8587[_0x6b2a('0x3e')]){delete _0x1c8587['name'];}_0x464e62=_0x1c8587;})[_0x6b2a('0x86')](function(){if(_0x464e62===null){_0x48b514[_0x6b2a('0x2c')](_0x195695);}else{if(_0x195695===0x1f4){_0x48b514['status'](_0x195695)['send'](_0x464e62);}else{_0x48b514[_0x6b2a('0x2d')](_0x195695)['json'](_0x464e62);}}});};exports[_0x6b2a('0x87')]=function(_0x52cdc4,_0x48af73,_0x3f77b7){var _0x23fe77={};var _0x1d7448={};var _0x570dc6;var _0x149d89;return db['WhatsappAccount'][_0x6b2a('0x6b')]({'where':{'id':_0x52cdc4[_0x6b2a('0x5c')]['id']}})['then'](handleEntityNotFound(_0x48af73,null))[_0x6b2a('0x21')](function(_0x513bd3){if(_0x513bd3){_0x570dc6=_0x513bd3;_0x1d7448[_0x6b2a('0x48')]=_[_0x6b2a('0x4a')](db[_0x6b2a('0x83')][_0x6b2a('0x44')]);_0x1d7448['query']=_[_0x6b2a('0x4a')](_0x52cdc4[_0x6b2a('0x49')]);_0x1d7448[_0x6b2a('0x4b')]=_[_0x6b2a('0x4d')](_0x1d7448[_0x6b2a('0x48')],_0x1d7448[_0x6b2a('0x49')]);_0x23fe77[_0x6b2a('0x4c')]=_['intersection'](_0x1d7448[_0x6b2a('0x48')],qs[_0x6b2a('0x4e')](_0x52cdc4['query'][_0x6b2a('0x4e')]));_0x23fe77[_0x6b2a('0x4c')]=_0x23fe77[_0x6b2a('0x4c')][_0x6b2a('0x4f')]?_0x23fe77[_0x6b2a('0x4c')]:_0x1d7448[_0x6b2a('0x48')];_0x23fe77['order']=qs[_0x6b2a('0x53')](_0x52cdc4[_0x6b2a('0x49')][_0x6b2a('0x53')]);_0x23fe77[_0x6b2a('0x56')]=qs[_0x6b2a('0x4b')](_[_0x6b2a('0x54')](_0x52cdc4[_0x6b2a('0x49')],_0x1d7448[_0x6b2a('0x4b')]));if(_0x52cdc4[_0x6b2a('0x49')]['filter']){_0x23fe77[_0x6b2a('0x56')]=_[_0x6b2a('0x57')](_0x23fe77[_0x6b2a('0x56')],{'$or':_[_0x6b2a('0x42')](_0x23fe77[_0x6b2a('0x4c')],function(_0x1fad9a){var _0x1a36e3={};_0x1a36e3[_0x1fad9a]={'$like':'%'+_0x52cdc4[_0x6b2a('0x49')][_0x6b2a('0x55')]+'%'};return _0x1a36e3;})});}_0x23fe77=_['merge']({},_0x23fe77,_0x52cdc4[_0x6b2a('0x58')]);return _0x570dc6['getApplications'](_0x23fe77);}})[_0x6b2a('0x21')](function(_0x186de6){if(_0x186de6){_0x149d89=_0x186de6[_0x6b2a('0x4f')];if(!_0x52cdc4[_0x6b2a('0x49')]['hasOwnProperty'](_0x6b2a('0x51'))){_0x23fe77[_0x6b2a('0x30')]=qs[_0x6b2a('0x30')](_0x52cdc4[_0x6b2a('0x49')][_0x6b2a('0x30')]);_0x23fe77[_0x6b2a('0x32')]=qs[_0x6b2a('0x32')](_0x52cdc4['query'][_0x6b2a('0x32')]);}return _0x570dc6['getApplications'](_0x23fe77);}})[_0x6b2a('0x21')](function(_0x2eb374){if(_0x2eb374){return _0x2eb374?{'count':_0x149d89,'rows':_0x2eb374}:null;}})[_0x6b2a('0x21')](respondWithResult(_0x48af73,null))['catch'](handleError(_0x48af73,null));};exports[_0x6b2a('0x88')]=function(_0x42cc3e,_0x582b23,_0x1ff12e){var _0x34fc56={'channel':_0x6b2a('0x89')};var _0x575848=[];var _0xb347d1=[];var _0x5ea55b={};return db[_0x6b2a('0x43')]['find']({'where':{'id':_0x42cc3e['params']['id']},'include':[{'model':db[_0x6b2a('0x83')],'as':_0x6b2a('0x8a')}]})[_0x6b2a('0x21')](handleEntityNotFound(_0x582b23,null))[_0x6b2a('0x21')](function(_0x14cdc1){_0x34fc56[_0x6b2a('0x8b')]=_0x14cdc1;if(_0x34fc56['account']&&_0x34fc56['account']['type']==='sinch'&&_0x42cc3e['body'][_0x6b2a('0x8c')]){if(_0x42cc3e[_0x6b2a('0x5f')]['statuses'][_0x6b2a('0x4f')]===0x0)return;if(_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0x8c')][0x0]['state']!==_0x6b2a('0x8d'))return;return db[_0x6b2a('0x8e')][_0x6b2a('0x37')]({'read':!![],'readAt':_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0x8c')][0x0][_0x6b2a('0x8f')]},{'where':{'messageId':_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0x8c')][0x0][_0x6b2a('0x90')]},'individualHooks':!![]})[_0x6b2a('0x21')](function(_0x5aeefe){return _0x582b23[_0x6b2a('0x2d')](0xc8)['json'](_0x5aeefe);});}_0x34fc56[_0x6b2a('0x91')]=_[_0x6b2a('0x92')](_0x14cdc1[_0x6b2a('0x8a')],[_0x6b2a('0x85')],['asc']);if(_0x34fc56[_0x6b2a('0x8b')]['Applications']){delete _0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0x8a')];}return db[_0x6b2a('0x93')][_0x6b2a('0x68')]()[_0x6b2a('0x21')](function(_0x3f3ef0){if(!_0x3f3ef0){throw new db[(_0x6b2a('0x94'))]['ValidationError'](_0x6b2a('0x95'));}_0x575848=_['difference'](_[_0x6b2a('0x4a')](_0x3f3ef0),[_0x6b2a('0x96'),'updatedAt']);_0xb347d1=_[_0x6b2a('0x97')](_[_0x6b2a('0x4a')](_0x3f3ef0),[_0x6b2a('0x96'),'updatedAt',_0x6b2a('0x98'),_0x6b2a('0x99')]);_0x34fc56[_0x6b2a('0x5f')]={'mapKey':_0x6b2a('0x9a')};if(_0x34fc56['account']&&_0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0x46')]===_0x6b2a('0x9b')){_0x34fc56['body']['from']=_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0x9c')]['replace']('whatsapp:','');_0x34fc56['body'][_0x6b2a('0x5f')]=_0x42cc3e['body'][_0x6b2a('0x9d')];_0x34fc56['body'][_0x6b2a('0x9e')]=_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0x9f')];}if(_0x34fc56[_0x6b2a('0x8b')]&&_0x34fc56[_0x6b2a('0x8b')]['type']===_0x6b2a('0xa0')){_0x34fc56[_0x6b2a('0x5f')]['from']=_0x42cc3e[_0x6b2a('0x5f')][_0x6b2a('0xa1')][0x0]['from'];_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0x5f')]=_0x42cc3e[_0x6b2a('0x5f')]['notifications'][0x0][_0x6b2a('0x2a')][_0x6b2a('0x5f')];_0x34fc56['body'][_0x6b2a('0x9e')]=_0x42cc3e['body']['notifications'][0x0][_0x6b2a('0x90')];}if(_0x34fc56['body']['id']){delete _0x34fc56[_0x6b2a('0x5f')]['id'];}if(_[_0x6b2a('0xa2')](_0x34fc56[_0x6b2a('0x5f')]['from'])){throw new db['Sequelize'][(_0x6b2a('0xa3'))](_0x6b2a('0xa4'));}if(_['isNil'](_0x34fc56['body'][_0x6b2a('0x5f')])||_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0x5f')]===''){throw new db[(_0x6b2a('0x94'))]['ValidationError'](_0x6b2a('0xa5'));}if(_[_0x6b2a('0xa2')](_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xa6')])){throw new db[(_0x6b2a('0x94'))]['ValidationError'](_0x6b2a('0xa7')+_0xb347d1);}if(!_[_0x6b2a('0xa8')](_0xb347d1,_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xa6')])){throw new db[(_0x6b2a('0x94'))][(_0x6b2a('0xa3'))](_0x6b2a('0xa9')+_0xb347d1);}_0x5ea55b[_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xa6')]]=_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xaa')];return db[_0x6b2a('0xab')][_0x6b2a('0x5d')]({'where':{'id':_0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0x99')]},'include':[{'model':db['CmContact'],'as':_0x6b2a('0xac'),'where':_0x5ea55b,'limit':0x1,'order':[[_0x6b2a('0xad'),'DESC']]}]});})['then'](handleEntityNotFound(_0x582b23,null))[_0x6b2a('0x21')](function(_0x482ffe){if(_0x482ffe){_0x34fc56['list']=_[_0x6b2a('0x76')](_0x482ffe,['Contacts']);if(_0x482ffe[_0x6b2a('0xac')][_0x6b2a('0x4f')]){return _0x482ffe[_0x6b2a('0xac')][0x0];}var _0x1fd080=_[_0x6b2a('0x1b')](_0x34fc56[_0x6b2a('0x5f')],{'firstName':_0x34fc56[_0x6b2a('0x5f')]['from'],'ListId':_0x482ffe['id']});_0x1fd080[_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xa6')]]=_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xaa')];return db[_0x6b2a('0x93')][_0x6b2a('0x5e')](_0x1fd080,{'fields':_0x575848,'raw':!![]});}})[_0x6b2a('0x21')](handleEntityNotFound(_0x582b23,null))[_0x6b2a('0x21')](function(_0x8e3201){if(_0x8e3201){_0x34fc56[_0x6b2a('0xae')]=_0x8e3201;var _0x37efc0={'ContactId':_0x8e3201['id'],'phone':_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0xaa')],'WhatsappAccountId':_0x42cc3e['params']['id']};var _0x47c37f={'ContactId':_0x8e3201['id'],'WhatsappAccountId':_0x42cc3e['params']['id'],'closed':![]};return db['WhatsappInteraction'][_0x6b2a('0x5d')]({'where':_0x47c37f})[_0x6b2a('0x21')](function(_0x2eb014){if(_0x2eb014){return[_0x2eb014,![]];}return db[_0x6b2a('0xaf')][_0x6b2a('0x5e')](_0x37efc0)['then'](function(_0x35b398){return[_0x35b398,!![]];});});}})['spread'](function(_0xbbd94a,_0x575ad8){_0x34fc56[_0x6b2a('0xb0')]=_0xbbd94a['get']({'plain':!![]});_0x34fc56[_0x6b2a('0xb0')][_0x6b2a('0xb1')]=![];if(_0x575ad8){if(_0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0xb2')]){_0x34fc56[_0x6b2a('0x91')][_0x6b2a('0xb3')]({'id':0x0,'priority':_0x34fc56[_0x6b2a('0x91')]['length']+0x1,'app':'close','appdata':_0x6b2a('0xb4'),'interval':_0x6b2a('0xb5')});}_0x34fc56[_0x6b2a('0xb0')][_0x6b2a('0xb1')]=!![];}return db[_0x6b2a('0x8e')][_0x6b2a('0x5e')]({'phone':_0x34fc56['body'][_0x6b2a('0xaa')],'messageId':_0x34fc56[_0x6b2a('0x5f')][_0x6b2a('0x9e')],'body':_0x34fc56[_0x6b2a('0x5f')]['body'],'WhatsappAccountId':_0x42cc3e[_0x6b2a('0x5c')]['id'],'WhatsappInteractionId':_0xbbd94a['id'],'direction':'in','ContactId':_0xbbd94a['ContactId'],'AttachmentId':_0x34fc56['body'][_0x6b2a('0xb6')]});})['then'](function(_0x4d7d55){_0x34fc56['message']=_0x4d7d55;if(!_0x34fc56[_0x6b2a('0xb0')][_0x6b2a('0xb7')])return;return db[_0x6b2a('0x7e')][_0x6b2a('0x5d')]({'attributes':['id',_0x6b2a('0x3e')],'where':{'id':_0x34fc56[_0x6b2a('0xb0')][_0x6b2a('0xb7')]}});})[_0x6b2a('0x21')](function(_0x27a93e){if(_0x27a93e){_0x34fc56['applications'][_0x6b2a('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x27a93e[_0x6b2a('0x3e')]+','+(_0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0xb9')]||0xa),'interval':_0x6b2a('0xb5')});}if(!_0x34fc56['interaction']['queueId'])return;return db[_0x6b2a('0xba')]['find']({'attributes':['id',_0x6b2a('0x3e')],'where':{'id':_0x34fc56[_0x6b2a('0xb0')][_0x6b2a('0xbb')]}});})['then'](function(_0x3ece94){if(_0x3ece94){_0x34fc56[_0x6b2a('0x91')][_0x6b2a('0xb8')]({'id':0x0,'priority':0x1,'app':_0x6b2a('0xbc'),'appdata':_0x3ece94[_0x6b2a('0x3e')]+','+(_0x34fc56[_0x6b2a('0x8b')][_0x6b2a('0xbd')]||0x12c),'interval':_0x6b2a('0xb5')});}return respondWithRpcPromise(_0x6b2a('0xbe'),_0x6b2a('0xbf'),_0x34fc56);})[_0x6b2a('0x21')](function(_0x1887cd){if(_0x1887cd){var _0x51c366=0xc8;var _0x508ac8=_0x6b2a('0xc0');logger[_0x6b2a('0x22')](_0x6b2a('0x26'),_0x508ac8,_0x51c366,_0x6b2a('0xc1'));logger[_0x6b2a('0x25')](_0x6b2a('0xc2'),_0x508ac8,_0x51c366,_0x6b2a('0xc1'),JSON[_0x6b2a('0x27')](_0x1887cd));if(_0x34fc56['account'][_0x6b2a('0x46')]===_0x6b2a('0x9b')){return _0x582b23[_0x6b2a('0x2d')](_0x51c366)[_0x6b2a('0x33')](_0x6b2a('0xc3'),_0x6b2a('0xc4'))[_0x6b2a('0x3f')](_0x6b2a('0xc5'));}else{return _0x582b23[_0x6b2a('0x2d')](_0x51c366)[_0x6b2a('0x2e')](_0x1887cd);}}});})[_0x6b2a('0x2b')](handleError(_0x582b23,null));};exports['send']=function(_0x3d9cb3,_0x3b9402,_0x4e20ca){var _0x271b43,_0x4a71f6,_0x2eef22;if(_['isNil'](_0x3d9cb3[_0x6b2a('0x5f')][_0x6b2a('0x5f')])||_0x3d9cb3[_0x6b2a('0x5f')][_0x6b2a('0x5f')]===''){throw new db[(_0x6b2a('0x94'))][(_0x6b2a('0xa3'))](_0x6b2a('0xa5'));}if(_['isNil'](_0x3d9cb3[_0x6b2a('0x5f')]['to'])){throw new db[(_0x6b2a('0x94'))]['ValidationError'](_0x6b2a('0xc6'));}_0x271b43=_0x3d9cb3[_0x6b2a('0x5f')]['to'];return db[_0x6b2a('0x43')]['find']({'where':{'id':_0x3d9cb3['params']['id']},'include':[{'model':db[_0x6b2a('0xab')],'as':'List','include':[{'model':db[_0x6b2a('0x93')],'as':'Contacts','where':{'mobile':_0x271b43},'limit':0x1,'order':[[_0x6b2a('0xad'),_0x6b2a('0xc7')]]}]}]})[_0x6b2a('0x21')](handleEntityNotFound(_0x3b9402,null))[_0x6b2a('0x21')](function(_0x157127){if(_0x157127&&_0x157127[_0x6b2a('0xc8')]){_0x4a71f6=_0x157127['get']({'plain':!![]});if(_0x4a71f6['List']&&_0x4a71f6[_0x6b2a('0xc8')]['Contacts'][_0x6b2a('0x4f')]){return _0x4a71f6[_0x6b2a('0xc8')][_0x6b2a('0xac')][0x0];}return db[_0x6b2a('0x93')][_0x6b2a('0x5e')](_[_0x6b2a('0x1b')](_0x3d9cb3[_0x6b2a('0x5f')],{'firstName':_0x271b43,'mobile':_0x271b43,'phone':_0x271b43,'ListId':_0x4a71f6[_0x6b2a('0x99')]}));}})['then'](handleEntityNotFound(_0x3b9402,null))[_0x6b2a('0x21')](function(_0x5da476){if(_0x5da476){_0x2eef22=_0x5da476;return db[_0x6b2a('0xaf')][_0x6b2a('0x5d')]({'where':{'ContactId':_0x2eef22['id'],'closed':![],'WhatsappAccountId':_0x4a71f6['id']}})['then'](function(_0x3daf3f){if(_0x3daf3f){return[_0x3daf3f,![]];}return db[_0x6b2a('0xaf')][_0x6b2a('0x5e')]({'UserId':_0x3d9cb3[_0x6b2a('0x60')]['id'],'ContactId':_0x2eef22['id'],'WhatsappAccountId':_0x4a71f6['id'],'phone':_0x271b43,'firstMsgDirection':_0x6b2a('0xc9'),'Messages':[_[_0x6b2a('0x57')](_0x3d9cb3[_0x6b2a('0x5f')],{'read':![],'body':_0x3d9cb3[_0x6b2a('0x5f')][_0x6b2a('0x5f')],'phone':_0x271b43,'WhatsappAccountId':_0x4a71f6['id'],'UserId':_0x3d9cb3['user']['id'],'ContactId':_0x2eef22['id']})]},{'include':[{'model':db[_0x6b2a('0x8e')],'as':_0x6b2a('0xca')}]})[_0x6b2a('0x21')](function(_0x433f66){return[_0x433f66,!![]];});});}})[_0x6b2a('0x77')](function(_0x11f41a,_0x15cf1c){if(_0x15cf1c){return _0x11f41a;}return db['WhatsappMessage'][_0x6b2a('0x5e')](_[_0x6b2a('0x57')](_0x3d9cb3[_0x6b2a('0x5f')],{'read':![],'body':_0x3d9cb3[_0x6b2a('0x5f')][_0x6b2a('0x5f')],'phone':_0x271b43,'WhatsappAccountId':_0x4a71f6['id'],'WhatsappInteractionId':_0x11f41a['id'],'UserId':_0x3d9cb3[_0x6b2a('0x60')]['id'],'ContactId':_0x2eef22['id']}))[_0x6b2a('0x21')](function(_0x1f8dbd){_0x11f41a['dataValues'][_0x6b2a('0xca')]=[];_0x11f41a['dataValues'][_0x6b2a('0xca')][_0x6b2a('0xb3')](_0x1f8dbd[_0x6b2a('0xcb')]);return _0x11f41a;});})[_0x6b2a('0x21')](respondWithResult(_0x3b9402,null))[_0x6b2a('0x2b')](handleError(_0x3b9402,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 3d02cd0..e3aaae1 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 _0x1017=['exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','hasOwnProperty','hook'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1017,0xc7));var _0x7101=function(_0x13deb5,_0x34d407){_0x13deb5=_0x13deb5-0x0;var _0x164ced=_0x1017[_0x13deb5];return _0x164ced;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x7101('0x0'))['db'][_0x7101('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x7101('0x2')](0x0);var events={'afterCreate':_0x7101('0x3'),'afterUpdate':_0x7101('0x4'),'afterDestroy':_0x7101('0x5')};function emitEvent(_0x212227){return function(_0x5d754f,_0x5522c8,_0x155367){WhatsappAccountEvents['emit'](_0x212227+':'+_0x5d754f['id'],_0x5d754f);WhatsappAccountEvents['emit'](_0x212227,_0x5d754f);_0x155367(null);};}for(var e in events){if(events[_0x7101('0x6')](e)){var event=events[e];WhatsappAccount[_0x7101('0x7')](e,emitEvent(event));}}module[_0x7101('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd0c8=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0xd0c8,0x112));var _0x8d0c=function(_0x32559d,_0x227525){_0x32559d=_0x32559d-0x0;var _0x56c5ea=_0xd0c8[_0x32559d];return _0x56c5ea;};'use strict';var EventEmitter=require(_0x8d0c('0x0'));var WhatsappAccount=require(_0x8d0c('0x1'))['db'][_0x8d0c('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x8d0c('0x3')](0x0);var events={'afterCreate':_0x8d0c('0x4'),'afterUpdate':_0x8d0c('0x5'),'afterDestroy':_0x8d0c('0x6')};function emitEvent(_0x334a69){return function(_0x170493,_0x4382e4,_0xc0582b){WhatsappAccountEvents[_0x8d0c('0x7')](_0x334a69+':'+_0x170493['id'],_0x170493);WhatsappAccountEvents[_0x8d0c('0x7')](_0x334a69,_0x170493);_0xc0582b(null);};}for(var e in events){if(events[_0x8d0c('0x8')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x8d0c('0x9')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 6b2e24b..8736318 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 _0xcfe5=['request-promise','path','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x235b34,_0x57e73d){var _0x423dec=function(_0x3b358d){while(--_0x3b358d){_0x235b34['push'](_0x235b34['shift']());}};_0x423dec(++_0x57e73d);}(_0xcfe5,0x19e));var _0x5cfe=function(_0x993f24,_0x227b78){_0x993f24=_0x993f24-0x0;var _0x3064db=_0xcfe5[_0x993f24];return _0x3064db;};'use strict';var _=require(_0x5cfe('0x0'));var util=require(_0x5cfe('0x1'));var logger=require(_0x5cfe('0x2'))(_0x5cfe('0x3'));var moment=require(_0x5cfe('0x4'));var BPromise=require(_0x5cfe('0x5'));var rp=require(_0x5cfe('0x6'));var fs=require('fs');var path=require(_0x5cfe('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x5cfe('0x8')]=function(_0x5dba77,_0xdcb5c9){return _0x5dba77[_0x5cfe('0x9')](_0x5cfe('0xa'),attributes,{'tableName':_0x5cfe('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20da=['rimraf','../../config/environment','exports','define','api','moment','bluebird','request-promise','path'];(function(_0x6782c1,_0x539047){var _0x52d22b=function(_0x47dc09){while(--_0x47dc09){_0x6782c1['push'](_0x6782c1['shift']());}};_0x52d22b(++_0x539047);}(_0x20da,0x1e1));var _0xa20d=function(_0x160bb3,_0xc98bd0){_0x160bb3=_0x160bb3-0x0;var _0x4e1313=_0x20da[_0x160bb3];return _0x4e1313;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa20d('0x0'));var moment=require(_0xa20d('0x1'));var BPromise=require(_0xa20d('0x2'));var rp=require(_0xa20d('0x3'));var fs=require('fs');var path=require(_0xa20d('0x4'));var rimraf=require(_0xa20d('0x5'));var config=require(_0xa20d('0x6'));var attributes=require('./whatsappAccount.attributes');module[_0xa20d('0x7')]=function(_0x63b1d,_0xf19dcc){return _0x63b1d[_0xa20d('0x8')]('WhatsappAccount',attributes,{'tableName':'whatsapp_accounts','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 26282b0..6e841be 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 _0x36d4=['defaults','localhost','socket.io-emitter','redis','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','map','include','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x413b62,_0x740bd3){var _0x19bad0=function(_0x419a1b){while(--_0x419a1b){_0x413b62['push'](_0x413b62['shift']());}};_0x19bad0(++_0x740bd3);}(_0x36d4,0x171));var _0x436d=function(_0x402565,_0x431efa){_0x402565=_0x402565-0x0;var _0x2ed987=_0x36d4[_0x402565];return _0x2ed987;};'use strict';var _=require('lodash');var util=require(_0x436d('0x0'));var moment=require(_0x436d('0x1'));var BPromise=require(_0x436d('0x2'));var rs=require(_0x436d('0x3'));var fs=require('fs');var Redis=require(_0x436d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x436d('0x5'));var logger=require('../../config/logger')(_0x436d('0x6'));var config=require(_0x436d('0x7'));var jayson=require(_0x436d('0x8'));var client=jayson[_0x436d('0x9')][_0x436d('0xa')]({'port':0x232a});config['redis']=_[_0x436d('0xb')](config['redis'],{'host':_0x436d('0xc'),'port':0x18eb});var socket=require(_0x436d('0xd'))(new Redis(config[_0x436d('0xe')]));require(_0x436d('0xf'))[_0x436d('0x10')](socket);function respondWithRpcPromise(_0x2479b4,_0x143942,_0x566755){return new BPromise(function(_0x8deef3,_0x3392dc){return client[_0x436d('0x11')](_0x2479b4,_0x566755)[_0x436d('0x12')](function(_0x219eae){logger['info'](_0x436d('0x13'),_0x143942,_0x436d('0x14'));logger[_0x436d('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x143942,'request\x20sent',JSON[_0x436d('0x16')](_0x219eae));if(_0x219eae['error']){if(_0x219eae['error'][_0x436d('0x17')]===0x1f4){logger['error'](_0x436d('0x13'),_0x143942,_0x219eae[_0x436d('0x18')][_0x436d('0x19')]);return _0x3392dc(_0x219eae[_0x436d('0x18')][_0x436d('0x19')]);}logger[_0x436d('0x18')](_0x436d('0x13'),_0x143942,_0x219eae[_0x436d('0x18')]['message']);return _0x8deef3(_0x219eae[_0x436d('0x18')][_0x436d('0x19')]);}else{logger[_0x436d('0x1a')](_0x436d('0x13'),_0x143942,_0x436d('0x14'));_0x8deef3(_0x219eae[_0x436d('0x1b')][_0x436d('0x19')]);}})[_0x436d('0x1c')](function(_0x224954){logger[_0x436d('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x143942,_0x224954);_0x3392dc(_0x224954);});});}exports[_0x436d('0x1d')]=function(_0x19b39c){var _0x20eea9=this;return new Promise(function(_0x1c39a6,_0x381b73){return db[_0x436d('0x1e')]['find']({'raw':_0x19b39c[_0x436d('0x1f')]?_0x19b39c[_0x436d('0x1f')][_0x436d('0x20')]===undefined?!![]:![]:!![],'where':_0x19b39c[_0x436d('0x1f')]?_0x19b39c[_0x436d('0x1f')][_0x436d('0x21')]||null:null,'attributes':_0x19b39c['options']?_0x19b39c[_0x436d('0x1f')][_0x436d('0x22')]||null:null,'include':_0x19b39c['options']?_0x19b39c[_0x436d('0x1f')]['include']?_[_0x436d('0x23')](_0x19b39c[_0x436d('0x1f')][_0x436d('0x24')],function(_0x184941){return{'model':db[_0x184941[_0x436d('0x25')]],'as':_0x184941['as'],'attributes':_0x184941['attributes'],'include':_0x184941[_0x436d('0x24')]?_[_0x436d('0x23')](_0x184941[_0x436d('0x24')],function(_0x1206f5){return{'model':db[_0x1206f5[_0x436d('0x25')]],'as':_0x1206f5['as'],'attributes':_0x1206f5[_0x436d('0x22')],'include':_0x1206f5[_0x436d('0x24')]?_[_0x436d('0x23')](_0x1206f5[_0x436d('0x24')],function(_0x56d540){return{'model':db[_0x56d540['model']],'as':_0x56d540['as'],'attributes':_0x56d540[_0x436d('0x22')]};}):[]};}):[]};}):[]:[]})[_0x436d('0x12')](function(_0x58fba4){logger[_0x436d('0x1a')](_0x436d('0x1d'),_0x19b39c);logger['debug']('ShowWhatsappAccount',_0x19b39c,JSON['stringify'](_0x58fba4));_0x1c39a6(_0x58fba4);})['catch'](function(_0x1c7ccc){logger[_0x436d('0x18')](_0x436d('0x1d'),_0x1c7ccc['message'],_0x19b39c);_0x381b73(_0x20eea9[_0x436d('0x18')](0x1f4,_0x1c7ccc[_0x436d('0x19')]));});});}; \ No newline at end of file +var _0x0a5f=['rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','debug','request\x20sent','stringify','code','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','options','raw','attributes','include','map','model','lodash','util','moment','ioredis','../../config/utils','../../config/logger'];(function(_0x314ad3,_0xdb5c76){var _0x151819=function(_0x218962){while(--_0x218962){_0x314ad3['push'](_0x314ad3['shift']());}};_0x151819(++_0xdb5c76);}(_0x0a5f,0x192));var _0xf0a5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a5f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xf0a5('0x0'));var util=require(_0xf0a5('0x1'));var moment=require(_0xf0a5('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0a5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0a5('0x4'));var logger=require(_0xf0a5('0x5'))(_0xf0a5('0x6'));var config=require('../../config/environment');var jayson=require(_0xf0a5('0x7'));var client=jayson[_0xf0a5('0x8')][_0xf0a5('0x9')]({'port':0x232a});config['redis']=_[_0xf0a5('0xa')](config[_0xf0a5('0xb')],{'host':_0xf0a5('0xc'),'port':0x18eb});var socket=require(_0xf0a5('0xd'))(new Redis(config[_0xf0a5('0xb')]));require(_0xf0a5('0xe'))[_0xf0a5('0xf')](socket);function respondWithRpcPromise(_0xadbd86,_0x22238,_0x21e037){return new BPromise(function(_0x2ab86e,_0x5c0c70){return client['request'](_0xadbd86,_0x21e037)[_0xf0a5('0x10')](function(_0x14b2dc){logger[_0xf0a5('0x11')]('WhatsappAccount,\x20%s,\x20%s',_0x22238,'request\x20sent');logger[_0xf0a5('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x22238,_0xf0a5('0x13'),JSON[_0xf0a5('0x14')](_0x14b2dc));if(_0x14b2dc['error']){if(_0x14b2dc['error'][_0xf0a5('0x15')]===0x1f4){logger[_0xf0a5('0x16')](_0xf0a5('0x17'),_0x22238,_0x14b2dc[_0xf0a5('0x16')]['message']);return _0x5c0c70(_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);}logger[_0xf0a5('0x16')](_0xf0a5('0x17'),_0x22238,_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);return _0x2ab86e(_0x14b2dc[_0xf0a5('0x16')][_0xf0a5('0x18')]);}else{logger[_0xf0a5('0x11')](_0xf0a5('0x17'),_0x22238,_0xf0a5('0x13'));_0x2ab86e(_0x14b2dc[_0xf0a5('0x19')]['message']);}})[_0xf0a5('0x1a')](function(_0x16c654){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x22238,_0x16c654);_0x5c0c70(_0x16c654);});});}exports[_0xf0a5('0x1b')]=function(_0x4a7c0b){var _0x3abfd8=this;return new Promise(function(_0x321484,_0x23b64a){return db['WhatsappAccount']['find']({'raw':_0x4a7c0b['options']?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1d')]===undefined?!![]:![]:!![],'where':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b['options']['where']||null:null,'attributes':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1e')]||null:null,'include':_0x4a7c0b[_0xf0a5('0x1c')]?_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1f')]?_[_0xf0a5('0x20')](_0x4a7c0b[_0xf0a5('0x1c')][_0xf0a5('0x1f')],function(_0x32901e){return{'model':db[_0x32901e[_0xf0a5('0x21')]],'as':_0x32901e['as'],'attributes':_0x32901e['attributes'],'include':_0x32901e['include']?_[_0xf0a5('0x20')](_0x32901e[_0xf0a5('0x1f')],function(_0x2924bb){return{'model':db[_0x2924bb[_0xf0a5('0x21')]],'as':_0x2924bb['as'],'attributes':_0x2924bb['attributes'],'include':_0x2924bb['include']?_[_0xf0a5('0x20')](_0x2924bb[_0xf0a5('0x1f')],function(_0x10a156){return{'model':db[_0x10a156[_0xf0a5('0x21')]],'as':_0x10a156['as'],'attributes':_0x10a156[_0xf0a5('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf0a5('0x10')](function(_0x361ab2){logger[_0xf0a5('0x11')]('ShowWhatsappAccount',_0x4a7c0b);logger[_0xf0a5('0x12')](_0xf0a5('0x1b'),_0x4a7c0b,JSON[_0xf0a5('0x14')](_0x361ab2));_0x321484(_0x361ab2);})[_0xf0a5('0x1a')](function(_0x1f8360){logger[_0xf0a5('0x16')]('ShowWhatsappAccount',_0x1f8360[_0xf0a5('0x18')],_0x4a7c0b);_0x23b64a(_0x3abfd8[_0xf0a5('0x16')](0x1f4,_0x1f8360[_0xf0a5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 2f1c649..beb92bf 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 _0xce9d=['removeListener','register','./whatsappAccount.events','save','update','emit'];(function(_0x39fa5c,_0x30706f){var _0x2fceff=function(_0xd8e497){while(--_0xd8e497){_0x39fa5c['push'](_0x39fa5c['shift']());}};_0x2fceff(++_0x30706f);}(_0xce9d,0x12e));var _0xdce9=function(_0x569c69,_0x23a7dd){_0x569c69=_0x569c69-0x0;var _0x47dad4=_0xce9d[_0x569c69];return _0x47dad4;};'use strict';var WhatsappAccountEvents=require(_0xdce9('0x0'));var events=[_0xdce9('0x1'),'remove',_0xdce9('0x2')];function createListener(_0x13bfc7,_0x2369a3){return function(_0x25cb9e){_0x2369a3[_0xdce9('0x3')](_0x13bfc7,_0x25cb9e);};}function removeListener(_0x11878b,_0x45b148){return function(){WhatsappAccountEvents[_0xdce9('0x4')](_0x11878b,_0x45b148);};}exports[_0xdce9('0x5')]=function(_0x20d4f2){for(var _0x220f58=0x0,_0x67b86d=events['length'];_0x220f58<_0x67b86d;_0x220f58++){var _0x59a00c=events[_0x220f58];var _0x1842a1=createListener('whatsappAccount:'+_0x59a00c,_0x20d4f2);WhatsappAccountEvents['on'](_0x59a00c,_0x1842a1);}}; \ No newline at end of file +var _0x5d82=['register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit'];(function(_0x212ffb,_0x292bbb){var _0x111b03=function(_0x293296){while(--_0x293296){_0x212ffb['push'](_0x212ffb['shift']());}};_0x111b03(++_0x292bbb);}(_0x5d82,0xb3));var _0x25d8=function(_0xffb9ba,_0x9c1d04){_0xffb9ba=_0xffb9ba-0x0;var _0x2b1e20=_0x5d82[_0xffb9ba];return _0x2b1e20;};'use strict';var WhatsappAccountEvents=require(_0x25d8('0x0'));var events=[_0x25d8('0x1'),_0x25d8('0x2'),_0x25d8('0x3')];function createListener(_0x10f0fd,_0x5d0277){return function(_0x59264c){_0x5d0277[_0x25d8('0x4')](_0x10f0fd,_0x59264c);};}function removeListener(_0x144237,_0x3f0b95){return function(){WhatsappAccountEvents['removeListener'](_0x144237,_0x3f0b95);};}exports[_0x25d8('0x5')]=function(_0x1b40e3){for(var _0xacd28f=0x0,_0xcfec92=events[_0x25d8('0x6')];_0xacd28f<_0xcfec92;_0xacd28f++){var _0x5c7f4d=events[_0xacd28f];var _0x354ff4=createListener(_0x25d8('0x7')+_0x5c7f4d,_0x1b40e3);WhatsappAccountEvents['on'](_0x5c7f4d,_0x354ff4);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 862c3f1..0978557 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 _0x0888=['../../config/environment','get','isAuthenticated','index','/:id','put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x45096e,_0x17e82d){var _0xba1fa3=function(_0x29f43c){while(--_0x29f43c){_0x45096e['push'](_0x45096e['shift']());}};_0xba1fa3(++_0x17e82d);}(_0x0888,0x19f));var _0x8088=function(_0x5d9770,_0x3e5df2){_0x5d9770=_0x5d9770-0x0;var _0x158df4=_0x0888[_0x5d9770];return _0x158df4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8088('0x0'));var timeout=require(_0x8088('0x1'));var express=require(_0x8088('0x2'));var router=express['Router']();var fs_extra=require(_0x8088('0x3'));var auth=require(_0x8088('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8088('0x5'));var controller=require('./whatsappApplication.controller');router[_0x8088('0x6')]('/',auth[_0x8088('0x7')](),controller[_0x8088('0x8')]);router[_0x8088('0x6')](_0x8088('0x9'),auth[_0x8088('0x7')](),controller['show']);router['post']('/',auth[_0x8088('0x7')](),controller['create']);router[_0x8088('0xa')](_0x8088('0x9'),auth[_0x8088('0x7')](),controller[_0x8088('0xb')]);router[_0x8088('0xc')](_0x8088('0x9'),auth[_0x8088('0x7')](),controller[_0x8088('0xd')]);module[_0x8088('0xe')]=router; \ No newline at end of file +var _0xc787=['create','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','post'];(function(_0x467e7b,_0x19d1b9){var _0x3d89c0=function(_0x324f10){while(--_0x324f10){_0x467e7b['push'](_0x467e7b['shift']());}};_0x3d89c0(++_0x19d1b9);}(_0xc787,0x1c6));var _0x7c78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc787[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x7c78('0x0'));var util=require(_0x7c78('0x1'));var path=require('path');var timeout=require(_0x7c78('0x2'));var express=require(_0x7c78('0x3'));var router=express[_0x7c78('0x4')]();var fs_extra=require(_0x7c78('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c78('0x6'));var config=require(_0x7c78('0x7'));var controller=require(_0x7c78('0x8'));router[_0x7c78('0x9')]('/',auth[_0x7c78('0xa')](),controller[_0x7c78('0xb')]);router[_0x7c78('0x9')](_0x7c78('0xc'),auth[_0x7c78('0xa')](),controller['show']);router[_0x7c78('0xd')]('/',auth[_0x7c78('0xa')](),controller[_0x7c78('0xe')]);router['put'](_0x7c78('0xc'),auth['isAuthenticated'](),controller[_0x7c78('0xf')]);router[_0x7c78('0x10')](_0x7c78('0xc'),auth[_0x7c78('0xa')](),controller['destroy']);module[_0x7c78('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 786b7ad..7ecb625 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 _0x3884=['INTEGER','noop','TEXT','STRING','*,*,*,*','sequelize','exports'];(function(_0x326e9c,_0x522d02){var _0x3e4873=function(_0x303049){while(--_0x303049){_0x326e9c['push'](_0x326e9c['shift']());}};_0x3e4873(++_0x522d02);}(_0x3884,0x186));var _0x4388=function(_0x406053,_0x3366c7){_0x406053=_0x406053-0x0;var _0x2d1875=_0x3884[_0x406053];return _0x2d1875;};'use strict';var Sequelize=require(_0x4388('0x0'));module[_0x4388('0x1')]={'priority':{'type':Sequelize[_0x4388('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4388('0x3')},'appdata':{'type':Sequelize[_0x4388('0x4')]()},'description':{'type':Sequelize[_0x4388('0x5')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x4388('0x6')}}; \ No newline at end of file +var _0x439f=['*,*,*,*','exports','INTEGER','STRING','noop','TEXT'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x439f,0x175));var _0xf439=function(_0x51c726,_0x332b95){_0x51c726=_0x51c726-0x0;var _0x23fe86=_0x439f[_0x51c726];return _0x23fe86;};'use strict';var Sequelize=require('sequelize');module[_0xf439('0x0')]={'priority':{'type':Sequelize[_0xf439('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf439('0x2')],'allowNull':![],'defaultValue':_0xf439('0x3')},'appdata':{'type':Sequelize[_0xf439('0x4')]()},'description':{'type':Sequelize[_0xf439('0x2')]},'interval':{'type':Sequelize[_0xf439('0x2')],'defaultValue':_0xf439('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 1648a24..33ce7ef 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 _0x5464=['../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','map','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','WhatsappApplication','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','destroy','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils'];(function(_0x22071a,_0x4bcf62){var _0x5c6c85=function(_0x4c531b){while(--_0x4c531b){_0x22071a['push'](_0x22071a['shift']());}};_0x5c6c85(++_0x4bcf62);}(_0x5464,0x15d));var _0x4546=function(_0x5dcdf0,_0x1afb64){_0x5dcdf0=_0x5dcdf0-0x0;var _0x5200ed=_0x5464[_0x5dcdf0];return _0x5200ed;};'use strict';var emlformat=require(_0x4546('0x0'));var rimraf=require(_0x4546('0x1'));var zipdir=require(_0x4546('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4546('0x3'));var moment=require('moment');var BPromise=require(_0x4546('0x4'));var Mustache=require('mustache');var util=require(_0x4546('0x5'));var path=require(_0x4546('0x6'));var sox=require(_0x4546('0x7'));var csv=require(_0x4546('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4546('0x9'));var crypto=require(_0x4546('0xa'));var jsforce=require(_0x4546('0xb'));var deskjs=require(_0x4546('0xc'));var toCsv=require(_0x4546('0x8'));var querystring=require(_0x4546('0xd'));var Papa=require(_0x4546('0xe'));var Redis=require(_0x4546('0xf'));var authService=require(_0x4546('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4546('0x11'));var hardwareService=require(_0x4546('0x12'));var logger=require(_0x4546('0x13'))('api');var utils=require(_0x4546('0x14'));var config=require(_0x4546('0x15'));var licenseUtil=require(_0x4546('0x16'));var db=require(_0x4546('0x17'))['db'];function respondWithStatusCode(_0x4d31a7,_0x4f2641){_0x4f2641=_0x4f2641||0xcc;return function(_0x3e6622){if(_0x3e6622){return _0x4d31a7['sendStatus'](_0x4f2641);}return _0x4d31a7['status'](_0x4f2641)['end']();};}function respondWithResult(_0x5b64b7,_0x598516){_0x598516=_0x598516||0xc8;return function(_0x4f5571){if(_0x4f5571){return _0x5b64b7[_0x4546('0x18')](_0x598516)['json'](_0x4f5571);}};}function respondWithFilteredResult(_0x363a17,_0x54581c){return function(_0x26fc0e){if(_0x26fc0e){var _0x564f3e=typeof _0x54581c[_0x4546('0x19')]===_0x4546('0x1a')&&typeof _0x54581c[_0x4546('0x1b')]===_0x4546('0x1a');var _0x2a294b=_0x26fc0e[_0x4546('0x1c')];var _0x57d8de=_0x564f3e?0x0:_0x54581c['offset'];var _0x5780a7=_0x564f3e?_0x26fc0e[_0x4546('0x1c')]:_0x54581c[_0x4546('0x19')]+_0x54581c[_0x4546('0x1b')];var _0x3d95c2;if(_0x5780a7>=_0x2a294b){_0x5780a7=_0x2a294b;_0x3d95c2=0xc8;}else{_0x3d95c2=0xce;}_0x363a17[_0x4546('0x18')](_0x3d95c2);return _0x363a17[_0x4546('0x1d')](_0x4546('0x1e'),_0x57d8de+'-'+_0x5780a7+'/'+_0x2a294b)[_0x4546('0x1f')](_0x26fc0e);}return null;};}function patchUpdates(_0x4034a5){return function(_0xceb1d6){try{jsonpatch['apply'](_0xceb1d6,_0x4034a5,!![]);}catch(_0x2d689f){return BPromise[_0x4546('0x20')](_0x2d689f);}return _0xceb1d6['save']();};}function saveUpdates(_0x3067ab,_0x437f55){return function(_0x1a1984){if(_0x1a1984){return _0x1a1984[_0x4546('0x21')](_0x3067ab)[_0x4546('0x22')](function(_0x15b013){return _0x15b013;});}return null;};}function removeEntity(_0x53e402,_0x3dab5c){return function(_0x2cca8b){if(_0x2cca8b){return _0x2cca8b['destroy']()[_0x4546('0x22')](function(){_0x53e402[_0x4546('0x18')](0xcc)[_0x4546('0x23')]();});}};}function handleEntityNotFound(_0x4467ee,_0x23084b){return function(_0x53ae5e){if(!_0x53ae5e){_0x4467ee[_0x4546('0x24')](0x194);}return _0x53ae5e;};}function handleError(_0x3796fe,_0x831fa5){_0x831fa5=_0x831fa5||0x1f4;return function(_0x48fc36){logger['error'](_0x48fc36[_0x4546('0x25')]);if(_0x48fc36[_0x4546('0x26')]){delete _0x48fc36[_0x4546('0x26')];}_0x3796fe[_0x4546('0x18')](_0x831fa5)[_0x4546('0x27')](_0x48fc36);};}exports[_0x4546('0x28')]=function(_0xcea7da,_0x586ff1){var _0x367b23={},_0x52c546={},_0x3a2d12={'count':0x0,'rows':[]};var _0x161815=_['map'](db['WhatsappApplication'][_0x4546('0x29')],function(_0x5af997){return{'name':_0x5af997[_0x4546('0x2a')],'type':_0x5af997[_0x4546('0x2b')]['key']};});_0x52c546['model']=_[_0x4546('0x2c')](_0x161815,_0x4546('0x26'));_0x52c546[_0x4546('0x2d')]=_['keys'](_0xcea7da[_0x4546('0x2d')]);_0x52c546[_0x4546('0x2e')]=_['intersection'](_0x52c546[_0x4546('0x2f')],_0x52c546['query']);_0x367b23[_0x4546('0x30')]=_[_0x4546('0x31')](_0x52c546[_0x4546('0x2f')],qs[_0x4546('0x32')](_0xcea7da['query'][_0x4546('0x32')]));_0x367b23[_0x4546('0x30')]=_0x367b23[_0x4546('0x30')][_0x4546('0x33')]?_0x367b23[_0x4546('0x30')]:_0x52c546[_0x4546('0x2f')];if(!_0xcea7da['query'][_0x4546('0x34')](_0x4546('0x35'))){_0x367b23['limit']=qs['limit'](_0xcea7da[_0x4546('0x2d')][_0x4546('0x1b')]);_0x367b23['offset']=qs[_0x4546('0x19')](_0xcea7da[_0x4546('0x2d')]['offset']);}_0x367b23['order']=qs[_0x4546('0x36')](_0xcea7da[_0x4546('0x2d')][_0x4546('0x36')]);_0x367b23[_0x4546('0x37')]=qs[_0x4546('0x2e')](_[_0x4546('0x38')](_0xcea7da['query'],_0x52c546[_0x4546('0x2e')]),_0x161815);if(_0xcea7da[_0x4546('0x2d')]['filter']){_0x367b23[_0x4546('0x37')]=_['merge'](_0x367b23[_0x4546('0x37')],{'$or':_[_0x4546('0x2c')](_0x161815,function(_0x53683e){if(_0x53683e['type']!==_0x4546('0x39')){var _0x453593={};_0x453593[_0x53683e[_0x4546('0x26')]]={'$like':'%'+_0xcea7da['query'][_0x4546('0x3a')]+'%'};return _0x453593;}})});}_0x367b23=_[_0x4546('0x3b')]({},_0x367b23,_0xcea7da[_0x4546('0x3c')]);var _0x1f815e={'where':_0x367b23[_0x4546('0x37')]};return db[_0x4546('0x3d')][_0x4546('0x1c')](_0x1f815e)[_0x4546('0x22')](function(_0x4b67d4){_0x3a2d12[_0x4546('0x1c')]=_0x4b67d4;if(_0xcea7da[_0x4546('0x2d')]['includeAll']){_0x367b23['include']=[{'all':!![]}];}return db[_0x4546('0x3d')][_0x4546('0x3e')](_0x367b23);})[_0x4546('0x22')](function(_0x1ea5c4){_0x3a2d12[_0x4546('0x3f')]=_0x1ea5c4;return _0x3a2d12;})['then'](respondWithFilteredResult(_0x586ff1,_0x367b23))[_0x4546('0x40')](handleError(_0x586ff1,null));};exports[_0x4546('0x41')]=function(_0x1060d1,_0x185b76){var _0x236fc0={'raw':!![],'where':{'id':_0x1060d1[_0x4546('0x42')]['id']}},_0x3fabf0={};_0x3fabf0[_0x4546('0x2f')]=_[_0x4546('0x43')](db['WhatsappApplication'][_0x4546('0x29')]);_0x3fabf0[_0x4546('0x2d')]=_[_0x4546('0x43')](_0x1060d1[_0x4546('0x2d')]);_0x3fabf0[_0x4546('0x2e')]=_[_0x4546('0x31')](_0x3fabf0[_0x4546('0x2f')],_0x3fabf0[_0x4546('0x2d')]);_0x236fc0[_0x4546('0x30')]=_[_0x4546('0x31')](_0x3fabf0[_0x4546('0x2f')],qs['fields'](_0x1060d1[_0x4546('0x2d')][_0x4546('0x32')]));_0x236fc0['attributes']=_0x236fc0[_0x4546('0x30')][_0x4546('0x33')]?_0x236fc0[_0x4546('0x30')]:_0x3fabf0['model'];if(_0x1060d1[_0x4546('0x2d')][_0x4546('0x44')]){_0x236fc0[_0x4546('0x45')]=[{'all':!![]}];}_0x236fc0=_[_0x4546('0x3b')]({},_0x236fc0,_0x1060d1[_0x4546('0x3c')]);return db[_0x4546('0x3d')][_0x4546('0x46')](_0x236fc0)[_0x4546('0x22')](handleEntityNotFound(_0x185b76,null))[_0x4546('0x22')](respondWithResult(_0x185b76,null))[_0x4546('0x40')](handleError(_0x185b76,null));};exports['create']=function(_0x395c43,_0x24a637){return db['WhatsappApplication'][_0x4546('0x47')](_0x395c43[_0x4546('0x48')],{})[_0x4546('0x22')](respondWithResult(_0x24a637,0xc9))[_0x4546('0x40')](handleError(_0x24a637,null));};exports['update']=function(_0x329566,_0x57bb39){if(_0x329566[_0x4546('0x48')]['id']){delete _0x329566[_0x4546('0x48')]['id'];}return db[_0x4546('0x3d')]['find']({'where':{'id':_0x329566[_0x4546('0x42')]['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x57bb39,null))[_0x4546('0x22')](saveUpdates(_0x329566[_0x4546('0x48')],null))[_0x4546('0x22')](respondWithResult(_0x57bb39,null))[_0x4546('0x40')](handleError(_0x57bb39,null));};exports[_0x4546('0x49')]=function(_0x325181,_0x43f630){return db[_0x4546('0x3d')][_0x4546('0x46')]({'where':{'id':_0x325181['params']['id']}})[_0x4546('0x22')](handleEntityNotFound(_0x43f630,null))[_0x4546('0x22')](removeEntity(_0x43f630,null))['catch'](handleError(_0x43f630,null));}; \ No newline at end of file +var _0xa880=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','fieldName','type','key','model','keys','query','filters'];(function(_0x211736,_0x726340){var _0x34c415=function(_0x27dbe5){while(--_0x27dbe5){_0x211736['push'](_0x211736['shift']());}};_0x34c415(++_0x726340);}(_0xa880,0x106));var _0x0a88=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xa880[_0xc8db6b];return _0x12cb81;};'use strict';var emlformat=require(_0x0a88('0x0'));var rimraf=require(_0x0a88('0x1'));var zipdir=require(_0x0a88('0x2'));var jsonpatch=require(_0x0a88('0x3'));var rp=require(_0x0a88('0x4'));var moment=require(_0x0a88('0x5'));var BPromise=require(_0x0a88('0x6'));var Mustache=require(_0x0a88('0x7'));var util=require(_0x0a88('0x8'));var path=require(_0x0a88('0x9'));var sox=require(_0x0a88('0xa'));var csv=require('to-csv');var ejs=require(_0x0a88('0xb'));var fs=require('fs');var fs_extra=require(_0x0a88('0xc'));var _=require(_0x0a88('0xd'));var squel=require(_0x0a88('0xe'));var crypto=require('crypto');var jsforce=require(_0x0a88('0xf'));var deskjs=require(_0x0a88('0x10'));var toCsv=require(_0x0a88('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0a88('0x12'));var qs=require(_0x0a88('0x13'));var as=require(_0x0a88('0x14'));var hardwareService=require(_0x0a88('0x15'));var logger=require(_0x0a88('0x16'))(_0x0a88('0x17'));var utils=require(_0x0a88('0x18'));var config=require(_0x0a88('0x19'));var licenseUtil=require(_0x0a88('0x1a'));var db=require(_0x0a88('0x1b'))['db'];function respondWithStatusCode(_0x4fc185,_0x30339a){_0x30339a=_0x30339a||0xcc;return function(_0x56ed91){if(_0x56ed91){return _0x4fc185[_0x0a88('0x1c')](_0x30339a);}return _0x4fc185[_0x0a88('0x1d')](_0x30339a)['end']();};}function respondWithResult(_0x189880,_0x2f4e7f){_0x2f4e7f=_0x2f4e7f||0xc8;return function(_0x27103d){if(_0x27103d){return _0x189880['status'](_0x2f4e7f)[_0x0a88('0x1e')](_0x27103d);}};}function respondWithFilteredResult(_0x3bce0a,_0x623e2){return function(_0x371834){if(_0x371834){var _0x15ea01=typeof _0x623e2['offset']===_0x0a88('0x1f')&&typeof _0x623e2[_0x0a88('0x20')]===_0x0a88('0x1f');var _0x4ce28d=_0x371834[_0x0a88('0x21')];var _0x3da111=_0x15ea01?0x0:_0x623e2[_0x0a88('0x22')];var _0x5ce88e=_0x15ea01?_0x371834[_0x0a88('0x21')]:_0x623e2[_0x0a88('0x22')]+_0x623e2[_0x0a88('0x20')];var _0x3bb6b9;if(_0x5ce88e>=_0x4ce28d){_0x5ce88e=_0x4ce28d;_0x3bb6b9=0xc8;}else{_0x3bb6b9=0xce;}_0x3bce0a[_0x0a88('0x1d')](_0x3bb6b9);return _0x3bce0a['set'](_0x0a88('0x23'),_0x3da111+'-'+_0x5ce88e+'/'+_0x4ce28d)[_0x0a88('0x1e')](_0x371834);}return null;};}function patchUpdates(_0x2aa1e1){return function(_0x29b488){try{jsonpatch[_0x0a88('0x24')](_0x29b488,_0x2aa1e1,!![]);}catch(_0x3565ae){return BPromise[_0x0a88('0x25')](_0x3565ae);}return _0x29b488[_0x0a88('0x26')]();};}function saveUpdates(_0x412bde,_0x3f7ec0){return function(_0xf9fe78){if(_0xf9fe78){return _0xf9fe78[_0x0a88('0x27')](_0x412bde)[_0x0a88('0x28')](function(_0x5c9424){return _0x5c9424;});}return null;};}function removeEntity(_0xd34bdb,_0x3a296f){return function(_0x514ef4){if(_0x514ef4){return _0x514ef4[_0x0a88('0x29')]()[_0x0a88('0x28')](function(){_0xd34bdb[_0x0a88('0x1d')](0xcc)[_0x0a88('0x2a')]();});}};}function handleEntityNotFound(_0x2cd66d,_0x50f032){return function(_0x47ec65){if(!_0x47ec65){_0x2cd66d[_0x0a88('0x1c')](0x194);}return _0x47ec65;};}function handleError(_0x4f5add,_0x53af1a){_0x53af1a=_0x53af1a||0x1f4;return function(_0x51e8ff){logger['error'](_0x51e8ff['stack']);if(_0x51e8ff[_0x0a88('0x2b')]){delete _0x51e8ff[_0x0a88('0x2b')];}_0x4f5add['status'](_0x53af1a)[_0x0a88('0x2c')](_0x51e8ff);};}exports[_0x0a88('0x2d')]=function(_0x5e40e7,_0xf29ba5){var _0x4deb90={},_0x4d8044={},_0x1d0d66={'count':0x0,'rows':[]};var _0x5656b0=_[_0x0a88('0x2e')](db['WhatsappApplication']['rawAttributes'],function(_0x4248c5){return{'name':_0x4248c5[_0x0a88('0x2f')],'type':_0x4248c5[_0x0a88('0x30')][_0x0a88('0x31')]};});_0x4d8044[_0x0a88('0x32')]=_[_0x0a88('0x2e')](_0x5656b0,'name');_0x4d8044['query']=_[_0x0a88('0x33')](_0x5e40e7[_0x0a88('0x34')]);_0x4d8044[_0x0a88('0x35')]=_[_0x0a88('0x36')](_0x4d8044[_0x0a88('0x32')],_0x4d8044[_0x0a88('0x34')]);_0x4deb90[_0x0a88('0x37')]=_[_0x0a88('0x36')](_0x4d8044[_0x0a88('0x32')],qs[_0x0a88('0x38')](_0x5e40e7[_0x0a88('0x34')]['fields']));_0x4deb90[_0x0a88('0x37')]=_0x4deb90['attributes'][_0x0a88('0x39')]?_0x4deb90[_0x0a88('0x37')]:_0x4d8044[_0x0a88('0x32')];if(!_0x5e40e7[_0x0a88('0x34')][_0x0a88('0x3a')](_0x0a88('0x3b'))){_0x4deb90[_0x0a88('0x20')]=qs[_0x0a88('0x20')](_0x5e40e7[_0x0a88('0x34')][_0x0a88('0x20')]);_0x4deb90['offset']=qs[_0x0a88('0x22')](_0x5e40e7[_0x0a88('0x34')][_0x0a88('0x22')]);}_0x4deb90[_0x0a88('0x3c')]=qs[_0x0a88('0x3d')](_0x5e40e7['query'][_0x0a88('0x3d')]);_0x4deb90[_0x0a88('0x3e')]=qs['filters'](_[_0x0a88('0x3f')](_0x5e40e7['query'],_0x4d8044[_0x0a88('0x35')]),_0x5656b0);if(_0x5e40e7[_0x0a88('0x34')][_0x0a88('0x40')]){_0x4deb90[_0x0a88('0x3e')]=_[_0x0a88('0x41')](_0x4deb90[_0x0a88('0x3e')],{'$or':_[_0x0a88('0x2e')](_0x5656b0,function(_0x4269fa){if(_0x4269fa['type']!==_0x0a88('0x42')){var _0x25747a={};_0x25747a[_0x4269fa[_0x0a88('0x2b')]]={'$like':'%'+_0x5e40e7['query'][_0x0a88('0x40')]+'%'};return _0x25747a;}})});}_0x4deb90=_[_0x0a88('0x41')]({},_0x4deb90,_0x5e40e7[_0x0a88('0x43')]);var _0x44af0f={'where':_0x4deb90[_0x0a88('0x3e')]};return db[_0x0a88('0x44')]['count'](_0x44af0f)[_0x0a88('0x28')](function(_0x5d5c42){_0x1d0d66[_0x0a88('0x21')]=_0x5d5c42;if(_0x5e40e7['query'][_0x0a88('0x45')]){_0x4deb90[_0x0a88('0x46')]=[{'all':!![]}];}return db[_0x0a88('0x44')][_0x0a88('0x47')](_0x4deb90);})[_0x0a88('0x28')](function(_0x1dcba2){_0x1d0d66[_0x0a88('0x48')]=_0x1dcba2;return _0x1d0d66;})[_0x0a88('0x28')](respondWithFilteredResult(_0xf29ba5,_0x4deb90))[_0x0a88('0x49')](handleError(_0xf29ba5,null));};exports[_0x0a88('0x4a')]=function(_0x2f049a,_0x1dd95e){var _0x1d3145={'raw':!![],'where':{'id':_0x2f049a[_0x0a88('0x4b')]['id']}},_0x131a8e={};_0x131a8e['model']=_[_0x0a88('0x33')](db[_0x0a88('0x44')]['rawAttributes']);_0x131a8e[_0x0a88('0x34')]=_[_0x0a88('0x33')](_0x2f049a['query']);_0x131a8e['filters']=_['intersection'](_0x131a8e[_0x0a88('0x32')],_0x131a8e[_0x0a88('0x34')]);_0x1d3145[_0x0a88('0x37')]=_['intersection'](_0x131a8e[_0x0a88('0x32')],qs[_0x0a88('0x38')](_0x2f049a[_0x0a88('0x34')]['fields']));_0x1d3145['attributes']=_0x1d3145[_0x0a88('0x37')][_0x0a88('0x39')]?_0x1d3145[_0x0a88('0x37')]:_0x131a8e[_0x0a88('0x32')];if(_0x2f049a[_0x0a88('0x34')][_0x0a88('0x45')]){_0x1d3145[_0x0a88('0x46')]=[{'all':!![]}];}_0x1d3145=_[_0x0a88('0x41')]({},_0x1d3145,_0x2f049a[_0x0a88('0x43')]);return db['WhatsappApplication'][_0x0a88('0x4c')](_0x1d3145)[_0x0a88('0x28')](handleEntityNotFound(_0x1dd95e,null))[_0x0a88('0x28')](respondWithResult(_0x1dd95e,null))[_0x0a88('0x49')](handleError(_0x1dd95e,null));};exports[_0x0a88('0x4d')]=function(_0x5670a9,_0x57ca02){return db[_0x0a88('0x44')][_0x0a88('0x4d')](_0x5670a9[_0x0a88('0x4e')],{})['then'](respondWithResult(_0x57ca02,0xc9))[_0x0a88('0x49')](handleError(_0x57ca02,null));};exports[_0x0a88('0x27')]=function(_0x120b2e,_0x16cea1){if(_0x120b2e['body']['id']){delete _0x120b2e[_0x0a88('0x4e')]['id'];}return db[_0x0a88('0x44')][_0x0a88('0x4c')]({'where':{'id':_0x120b2e[_0x0a88('0x4b')]['id']}})['then'](handleEntityNotFound(_0x16cea1,null))[_0x0a88('0x28')](saveUpdates(_0x120b2e['body'],null))['then'](respondWithResult(_0x16cea1,null))['catch'](handleError(_0x16cea1,null));};exports[_0x0a88('0x29')]=function(_0x202206,_0x455dad){return db['WhatsappApplication']['find']({'where':{'id':_0x202206[_0x0a88('0x4b')]['id']}})[_0x0a88('0x28')](handleEntityNotFound(_0x455dad,null))[_0x0a88('0x28')](removeEntity(_0x455dad,null))[_0x0a88('0x49')](handleError(_0x455dad,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 34acacc..f775393 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 _0xae1c=['WhatsappApplication','whatsapp_applications','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define'];(function(_0x5c5c6d,_0x470a07){var _0x6a3c31=function(_0x5a3d51){while(--_0x5a3d51){_0x5c5c6d['push'](_0x5c5c6d['shift']());}};_0x6a3c31(++_0x470a07);}(_0xae1c,0xff));var _0xcae1=function(_0x1b93dd,_0x71b75f){_0x1b93dd=_0x1b93dd-0x0;var _0x232d89=_0xae1c[_0x1b93dd];return _0x232d89;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcae1('0x0'));var BPromise=require(_0xcae1('0x1'));var rp=require(_0xcae1('0x2'));var fs=require('fs');var path=require(_0xcae1('0x3'));var rimraf=require(_0xcae1('0x4'));var config=require(_0xcae1('0x5'));var attributes=require(_0xcae1('0x6'));module[_0xcae1('0x7')]=function(_0x3513e5,_0x40fcec){return _0x3513e5[_0xcae1('0x8')](_0xcae1('0x9'),attributes,{'tableName':_0xcae1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf3cd=['whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','WhatsappApplication'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a8f86,_0x5ed9c4){_0x1a8f86=_0x1a8f86-0x0;var _0x20d876=_0xf3cd[_0x1a8f86];return _0x20d876;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var logger=require(_0xdf3c('0x2'))(_0xdf3c('0x3'));var moment=require(_0xdf3c('0x4'));var BPromise=require(_0xdf3c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf3c('0x6'));var rimraf=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var attributes=require('./whatsappApplication.attributes');module[_0xdf3c('0x9')]=function(_0x17d42a,_0x1313d5){return _0x17d42a[_0xdf3c('0xa')](_0xdf3c('0xb'),attributes,{'tableName':_0xdf3c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xdf3c('0xd')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index be3e9bf..b88349f 100644 --- a/server/api/whatsappApplication/whatsappApplication.rpc.js +++ b/server/api/whatsappApplication/whatsappApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54ef=['result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x33efc5,_0x287468){var _0x5c21dc=function(_0x50416e){while(--_0x50416e){_0x33efc5['push'](_0x33efc5['shift']());}};_0x5c21dc(++_0x287468);}(_0x54ef,0x112));var _0xf54e=function(_0x275c5d,_0x2087ef){_0x275c5d=_0x275c5d-0x0;var _0x3fcc73=_0x54ef[_0x275c5d];return _0x3fcc73;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var moment=require(_0xf54e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf54e('0x3'));var fs=require('fs');var Redis=require(_0xf54e('0x4'));var db=require(_0xf54e('0x5'))['db'];var utils=require(_0xf54e('0x6'));var logger=require(_0xf54e('0x7'))(_0xf54e('0x8'));var config=require(_0xf54e('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf54e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x99cf9,_0x2464ae,_0x561870){return new BPromise(function(_0x27e69b,_0x57a1ce){return client[_0xf54e('0xb')](_0x99cf9,_0x561870)[_0xf54e('0xc')](function(_0x47c5e1){logger[_0xf54e('0xd')](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));logger[_0xf54e('0x10')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x2464ae,_0xf54e('0xf'),JSON[_0xf54e('0x11')](_0x47c5e1));if(_0x47c5e1[_0xf54e('0x12')]){if(_0x47c5e1[_0xf54e('0x12')]['code']===0x1f4){logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1['error'][_0xf54e('0x13')]);return _0x57a1ce(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}logger[_0xf54e('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2464ae,_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);return _0x27e69b(_0x47c5e1[_0xf54e('0x12')][_0xf54e('0x13')]);}else{logger['info'](_0xf54e('0xe'),_0x2464ae,_0xf54e('0xf'));_0x27e69b(_0x47c5e1[_0xf54e('0x14')]['message']);}})['catch'](function(_0xd87020){logger[_0xf54e('0x12')](_0xf54e('0xe'),_0x2464ae,_0xd87020);_0x57a1ce(_0xd87020);});});} \ No newline at end of file +var _0x4ea3=['WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x4ea3,0x70));var _0x34ea=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x4ea3[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40434e,_0x18b461,_0x22b09e){return new BPromise(function(_0x5bec7c,_0x341727){return client[_0x34ea('0xa')](_0x40434e,_0x22b09e)[_0x34ea('0xb')](function(_0x5132c4){logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,'request\x20sent');logger['debug'](_0x34ea('0xe'),_0x18b461,_0x34ea('0xf'),JSON[_0x34ea('0x10')](_0x5132c4));if(_0x5132c4['error']){if(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x12')]===0x1f4){logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);return _0x341727(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}logger[_0x34ea('0x11')](_0x34ea('0xd'),_0x18b461,_0x5132c4[_0x34ea('0x11')]['message']);return _0x5bec7c(_0x5132c4[_0x34ea('0x11')][_0x34ea('0x13')]);}else{logger[_0x34ea('0xc')](_0x34ea('0xd'),_0x18b461,_0x34ea('0xf'));_0x5bec7c(_0x5132c4['result'][_0x34ea('0x13')]);}})[_0x34ea('0x14')](function(_0x3fa3b0){logger[_0x34ea('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 03ae6f9..8eb8af1 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 _0x6eed=['put','update','/:id','whatsappinteraction:destroy','delete','removeTags','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0x6eed,0xff));var _0xd6ee=function(_0x2b217f,_0x2351e2){_0x2b217f=_0x2b217f-0x0;var _0x5ebea5=_0x6eed[_0x2b217f];return _0x5ebea5;};'use strict';var multer=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var path=require(_0xd6ee('0x2'));var timeout=require(_0xd6ee('0x3'));var express=require(_0xd6ee('0x4'));var router=express['Router']();var fs_extra=require(_0xd6ee('0x5'));var auth=require(_0xd6ee('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd6ee('0x7'));router[_0xd6ee('0x8')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xa')]);router[_0xd6ee('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd6ee('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xd6ee('0xc')]);router[_0xd6ee('0x8')]('/:id/messages',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0xd')]);router[_0xd6ee('0x8')](_0xd6ee('0xe'),auth['isAuthenticated'](),controller[_0xd6ee('0xf')]);router[_0xd6ee('0x10')]('/',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x11')]);router[_0xd6ee('0x10')](_0xd6ee('0x12'),auth['isAuthenticated'](),controller[_0xd6ee('0x13')]);router[_0xd6ee('0x10')]('/:id/tags',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),_0xd6ee('0x16')),controller[_0xd6ee('0x17')]);router[_0xd6ee('0x18')]('/:id',auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')](_0xd6ee('0x15'),'whatsappinteraction:update'),controller[_0xd6ee('0x19')]);router['delete'](_0xd6ee('0x1a'),auth[_0xd6ee('0x9')](),interaction[_0xd6ee('0x14')]('whatsapp',_0xd6ee('0x1b')),controller['destroy']);router[_0xd6ee('0x1c')]('/:id/tags',auth[_0xd6ee('0x9')](),controller[_0xd6ee('0x1d')]);module[_0xd6ee('0x1e')]=router; \ No newline at end of file +var _0xfc46=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','whatsappinteraction:addtags','addTags','put','/:id','tracked','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x16a38,_0x28ed73){var _0x92dd97=function(_0x40bce6){while(--_0x40bce6){_0x16a38['push'](_0x16a38['shift']());}};_0x92dd97(++_0x28ed73);}(_0xfc46,0x9a));var _0x6fc4=function(_0x35a140,_0x3aeac6){_0x35a140=_0x35a140-0x0;var _0x30ab82=_0xfc46[_0x35a140];return _0x30ab82;};'use strict';var multer=require(_0x6fc4('0x0'));var util=require('util');var path=require(_0x6fc4('0x1'));var timeout=require(_0x6fc4('0x2'));var express=require(_0x6fc4('0x3'));var router=express['Router']();var fs_extra=require(_0x6fc4('0x4'));var auth=require(_0x6fc4('0x5'));var interaction=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var controller=require('./whatsappInteraction.controller');router[_0x6fc4('0x8')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xa')]);router[_0x6fc4('0x8')](_0x6fc4('0xb'),auth[_0x6fc4('0x9')](),controller['describe']);router[_0x6fc4('0x8')]('/:id',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xc')]);router['get'](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0xe')]);router[_0x6fc4('0x8')](_0x6fc4('0xf'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x10')]);router[_0x6fc4('0x11')]('/',auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x12')]);router[_0x6fc4('0x11')](_0x6fc4('0xd'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x13')]);router[_0x6fc4('0x11')](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x15')),controller[_0x6fc4('0x16')]);router[_0x6fc4('0x17')](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction[_0x6fc4('0x19')](_0x6fc4('0x1a'),_0x6fc4('0x1b')),controller[_0x6fc4('0x1c')]);router['delete'](_0x6fc4('0x18'),auth[_0x6fc4('0x9')](),interaction['tracked']('whatsapp',_0x6fc4('0x1d')),controller[_0x6fc4('0x1e')]);router['delete'](_0x6fc4('0x14'),auth[_0x6fc4('0x9')](),controller[_0x6fc4('0x1f')]);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 3356a88..a10dc51 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 _0xcd2f=['ENUM','INTEGER','BOOLEAN','DATE','STRING','out'];(function(_0x569e0a,_0x408e5e){var _0x17818e=function(_0x4c9231){while(--_0x4c9231){_0x569e0a['push'](_0x569e0a['shift']());}};_0x17818e(++_0x408e5e);}(_0xcd2f,0xf8));var _0xfcd2=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xcd2f[_0x4d8ed9];return _0x1e2140;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xfcd2('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xfcd2('0x1')]},'disposition':{'type':Sequelize[_0xfcd2('0x2')]},'secondDisposition':{'type':Sequelize[_0xfcd2('0x2')]},'thirdDisposition':{'type':Sequelize[_0xfcd2('0x2')]},'note':{'type':Sequelize[_0xfcd2('0x2')]},'phone':{'type':Sequelize[_0xfcd2('0x2')]},'read1stAt':{'type':Sequelize[_0xfcd2('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfcd2('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfcd2('0x1')]},'lastMsgDirection':{'type':Sequelize[_0xfcd2('0x4')]('in',_0xfcd2('0x3')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xfcd2('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xfcd2('0x5')]}}; \ No newline at end of file +var _0x988c=['DATE','STRING','ENUM','out','sequelize'];(function(_0xa9ac8b,_0x3a3b85){var _0x51c5cd=function(_0x3b2fac){while(--_0x3b2fac){_0xa9ac8b['push'](_0xa9ac8b['shift']());}};_0x51c5cd(++_0x3a3b85);}(_0x988c,0x19e));var _0xc988=function(_0x3569d3,_0x287fb7){_0x3569d3=_0x3569d3-0x0;var _0x174499=_0x988c[_0x3569d3];return _0x174499;};'use strict';var Sequelize=require(_0xc988('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc988('0x1')]},'disposition':{'type':Sequelize[_0xc988('0x2')]},'secondDisposition':{'type':Sequelize[_0xc988('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xc988('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xc988('0x3')]('in',_0xc988('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xc988('0x3')]('in',_0xc988('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 307869c..d355f05 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 _0xd8d3=['unix','toString','root','server','files','join','attachments','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','createdAt','direction','secret','read','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closedAt','disposition','Messages','createReadStream','pipe','basename','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','destroy','end','error','send','index','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','name','color','emit','whatsappInteractionTags:save','removeTags','download'];(function(_0x5a1d97,_0x265b5a){var _0x401646=function(_0x4dd898){while(--_0x4dd898){_0x5a1d97['push'](_0x5a1d97['shift']());}};_0x401646(++_0x265b5a);}(_0xd8d3,0xa8));var _0x3d8d=function(_0x579ea9,_0x57d133){_0x579ea9=_0x579ea9-0x0;var _0x4e043d=_0xd8d3[_0x579ea9];return _0x4e043d;};'use strict';var rimraf=require(_0x3d8d('0x0'));var zipdir=require('zip-dir');var moment=require(_0x3d8d('0x1'));var BPromise=require(_0x3d8d('0x2'));var util=require(_0x3d8d('0x3'));var path=require(_0x3d8d('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x3d8d('0x5'));var interaction=require(_0x3d8d('0x6'));var qs=require(_0x3d8d('0x7'));var pdf=require(_0x3d8d('0x8'));var logger=require(_0x3d8d('0x9'))(_0x3d8d('0xa'));var config=require(_0x3d8d('0xb'));var db=require(_0x3d8d('0xc'))['db'];config[_0x3d8d('0xd')]=_[_0x3d8d('0xe')](config[_0x3d8d('0xd')],{'host':_0x3d8d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3d8d('0x10'))[_0x3d8d('0x11')](socket);function respondWithStatusCode(_0x1ed2f0,_0x350e40){_0x350e40=_0x350e40||0xcc;return function(_0x1e3785){if(_0x1e3785){return _0x1ed2f0[_0x3d8d('0x12')](_0x350e40);}return _0x1ed2f0[_0x3d8d('0x13')](_0x350e40)['end']();};}function respondWithResult(_0x12e0dd,_0x358cf5){_0x358cf5=_0x358cf5||0xc8;return function(_0x597c73){if(_0x597c73){return _0x12e0dd[_0x3d8d('0x13')](_0x358cf5)[_0x3d8d('0x14')](_0x597c73);}};}function respondWithFilteredResult(_0x4e2f1b,_0x55e4c3){return function(_0x1e26cb){if(_0x1e26cb){var _0x482a55=typeof _0x55e4c3[_0x3d8d('0x15')]===_0x3d8d('0x16')&&typeof _0x55e4c3[_0x3d8d('0x17')]==='undefined';var _0x1017b6=_0x1e26cb[_0x3d8d('0x18')];var _0x52ef40=_0x482a55?0x0:_0x55e4c3[_0x3d8d('0x15')];var _0xe7a124=_0x482a55?_0x1e26cb[_0x3d8d('0x18')]:_0x55e4c3[_0x3d8d('0x15')]+_0x55e4c3[_0x3d8d('0x17')];var _0x509052;if(_0xe7a124>=_0x1017b6){_0xe7a124=_0x1017b6;_0x509052=0xc8;}else{_0x509052=0xce;}_0x4e2f1b['status'](_0x509052);return _0x4e2f1b[_0x3d8d('0x19')](_0x3d8d('0x1a'),_0x52ef40+'-'+_0xe7a124+'/'+_0x1017b6)['json'](_0x1e26cb);}return null;};}function saveUpdates(_0x3318e0){return function(_0x4be6dd){if(_0x4be6dd){return _0x4be6dd['update'](_0x3318e0)[_0x3d8d('0x1b')](function(_0x29eacc){return _0x29eacc;});}return null;};}function removeEntity(_0xd6bc81){return function(_0x54a995){if(_0x54a995){return _0x54a995[_0x3d8d('0x1c')]()[_0x3d8d('0x1b')](function(){_0xd6bc81[_0x3d8d('0x13')](0xcc)[_0x3d8d('0x1d')]();});}};}function handleEntityNotFound(_0xdd07){return function(_0x42ea5e){if(!_0x42ea5e){_0xdd07[_0x3d8d('0x12')](0x194);}return _0x42ea5e;};}function handleError(_0x505176,_0x17b57c){_0x17b57c=_0x17b57c||0x1f4;return function(_0x3c3af4){logger[_0x3d8d('0x1e')](_0x3c3af4['stack']);if(_0x3c3af4['name']){delete _0x3c3af4['name'];}_0x505176['status'](_0x17b57c)[_0x3d8d('0x1f')](_0x3c3af4);};}exports[_0x3d8d('0x20')]=function(_0x152c68,_0x11ead4){var _0x1ae9b6={};var _0x364086=_['map'](db[_0x3d8d('0x21')][_0x3d8d('0x22')],function(_0x2d6f9c){return{'name':_0x2d6f9c[_0x3d8d('0x23')],'type':_0x2d6f9c[_0x3d8d('0x24')][_0x3d8d('0x25')]};});_0x1ae9b6=qs['getOptions'](_0x364086,_0x152c68);return interaction[_0x3d8d('0x26')](_0x3d8d('0x27'),_0x152c68[_0x3d8d('0x28')],_0x152c68[_0x3d8d('0x29')],_0x1ae9b6,_0x364086)[_0x3d8d('0x1b')](respondWithFilteredResult(_0x11ead4,_0x1ae9b6))[_0x3d8d('0x2a')](handleError(_0x11ead4,null));};exports[_0x3d8d('0x2b')]=function(_0x43ce8f,_0x271283){var _0x2a0741={'raw':![],'where':{'id':_0x43ce8f[_0x3d8d('0x2c')]['id']}},_0xf855e4={};_0xf855e4[_0x3d8d('0x2d')]=_['keys'](db[_0x3d8d('0x21')][_0x3d8d('0x22')]);_0xf855e4['query']=_[_0x3d8d('0x2e')](_0x43ce8f[_0x3d8d('0x28')]);_0xf855e4[_0x3d8d('0x2f')]=_[_0x3d8d('0x30')](_0xf855e4[_0x3d8d('0x2d')],_0xf855e4['query']);_0x2a0741['attributes']=_[_0x3d8d('0x30')](_0xf855e4[_0x3d8d('0x2d')],qs[_0x3d8d('0x31')](_0x43ce8f[_0x3d8d('0x28')][_0x3d8d('0x31')]));_0x2a0741[_0x3d8d('0x32')]=_0x2a0741[_0x3d8d('0x32')][_0x3d8d('0x33')]?_0x2a0741[_0x3d8d('0x32')]:_0xf855e4[_0x3d8d('0x2d')];if(_0x43ce8f[_0x3d8d('0x28')][_0x3d8d('0x34')]){_0x2a0741[_0x3d8d('0x35')]=[{'all':!![]}];}_0x2a0741=_[_0x3d8d('0x36')]({},_0x2a0741,_0x43ce8f['options']);return db[_0x3d8d('0x21')][_0x3d8d('0x37')](_0x2a0741)['then'](handleEntityNotFound(_0x271283,null))[_0x3d8d('0x1b')](respondWithResult(_0x271283,null))[_0x3d8d('0x2a')](handleError(_0x271283,null));};exports[_0x3d8d('0x38')]=function(_0x2aefc6,_0x6c5105){return db[_0x3d8d('0x21')][_0x3d8d('0x38')](_0x2aefc6[_0x3d8d('0x39')],{})[_0x3d8d('0x1b')](respondWithResult(_0x6c5105,0xc9))[_0x3d8d('0x2a')](handleError(_0x6c5105,null));};exports['update']=function(_0x19ba2f,_0x4334b6){if(_0x19ba2f[_0x3d8d('0x39')]['id']){delete _0x19ba2f[_0x3d8d('0x39')]['id'];}return db[_0x3d8d('0x21')][_0x3d8d('0x37')]({'where':{'id':_0x19ba2f['params']['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0x4334b6,null))[_0x3d8d('0x1b')](saveUpdates(_0x19ba2f['body'],null))[_0x3d8d('0x1b')](respondWithResult(_0x4334b6,null))[_0x3d8d('0x2a')](handleError(_0x4334b6,null));};exports['destroy']=function(_0x375840,_0x48cdbf){return db[_0x3d8d('0x21')][_0x3d8d('0x37')]({'where':{'id':_0x375840[_0x3d8d('0x2c')]['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0x48cdbf,null))[_0x3d8d('0x1b')](removeEntity(_0x48cdbf,null))[_0x3d8d('0x2a')](handleError(_0x48cdbf,null));};exports[_0x3d8d('0x3a')]=function(_0x343508,_0x3a88e1){return db[_0x3d8d('0x21')][_0x3d8d('0x3a')]()[_0x3d8d('0x1b')](respondWithResult(_0x3a88e1,null))[_0x3d8d('0x2a')](handleError(_0x3a88e1,null));};exports[_0x3d8d('0x3b')]=function(_0x296412,_0x10b9ee){return db[_0x3d8d('0x3c')][_0x3d8d('0x37')]({'where':{'id':_0x296412['params']['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0x10b9ee,null))[_0x3d8d('0x1b')](function(_0x3dbcd1){if(_0x3dbcd1){return _0x3dbcd1['addMessage'](_0x296412[_0x3d8d('0x39')][_0x3d8d('0x3d')],_[_0x3d8d('0x3e')](_0x296412[_0x3d8d('0x39')],['ids','id'])||{});}})[_0x3d8d('0x1b')](respondWithResult(_0x10b9ee,null))[_0x3d8d('0x2a')](handleError(_0x10b9ee,null));};exports[_0x3d8d('0x3f')]=function(_0x98c948,_0xc83921){var _0x51c862={'raw':![],'where':{}};var _0x290f5c={};var _0x1432cd={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x3d8d('0x40')]({'where':{'id':_0x98c948[_0x3d8d('0x2c')]['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0xc83921,null))[_0x3d8d('0x1b')](function(_0x3f3181){if(_0x3f3181){_0x290f5c[_0x3d8d('0x2d')]=_[_0x3d8d('0x2e')](db[_0x3d8d('0x3c')]['rawAttributes']);_0x290f5c['query']=_['keys'](_0x98c948[_0x3d8d('0x28')]);_0x290f5c['filters']=_['intersection'](_0x290f5c[_0x3d8d('0x2d')],_0x290f5c[_0x3d8d('0x28')]);_0x51c862[_0x3d8d('0x32')]=_[_0x3d8d('0x30')](_0x290f5c[_0x3d8d('0x2d')],qs[_0x3d8d('0x31')](_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x31')]));_0x51c862[_0x3d8d('0x32')]=_0x51c862[_0x3d8d('0x32')][_0x3d8d('0x33')]?_0x51c862[_0x3d8d('0x32')]:_0x290f5c[_0x3d8d('0x2d')];if(!_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x41')](_0x3d8d('0x42'))){_0x51c862[_0x3d8d('0x17')]=qs[_0x3d8d('0x17')](_0x98c948[_0x3d8d('0x28')]['limit']);_0x51c862[_0x3d8d('0x15')]=qs[_0x3d8d('0x15')](_0x98c948['query'][_0x3d8d('0x15')]);}_0x51c862['order']=qs[_0x3d8d('0x43')](_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x43')]);_0x51c862[_0x3d8d('0x44')]=qs[_0x3d8d('0x2f')](_['pick'](_0x98c948[_0x3d8d('0x28')],_0x290f5c[_0x3d8d('0x2f')]));_0x51c862[_0x3d8d('0x44')][_0x3d8d('0x45')]=_0x3f3181['id'];if(_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x46')]){_0x51c862[_0x3d8d('0x44')]=_[_0x3d8d('0x36')](_0x51c862['where'],{'$or':_[_0x3d8d('0x47')](_0x51c862[_0x3d8d('0x32')],function(_0x59665a){var _0x36a8df={};_0x36a8df[_0x59665a]={'$like':'%'+_0x98c948['query'][_0x3d8d('0x46')]+'%'};return _0x36a8df;})});}if(_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x48')]){var _0x1128f5=_0x98c948[_0x3d8d('0x28')]['$gte'][_0x3d8d('0x49')](',');var _0x5317be={};_0x5317be[_0x1128f5[0x0]]={'$gte':moment(_0x1128f5[0x1])[_0x3d8d('0x4a')](_0x3d8d('0x4b'))};_0x51c862['where']=_['merge'](_0x51c862[_0x3d8d('0x44')],_0x5317be);}_0x51c862=_[_0x3d8d('0x36')]({},_0x51c862,_0x98c948['options']);return db[_0x3d8d('0x3c')][_0x3d8d('0x18')]({'where':_0x51c862['where']})[_0x3d8d('0x1b')](function(_0x168f90){_0x1432cd[_0x3d8d('0x18')]=_0x168f90;if(_0x98c948[_0x3d8d('0x28')][_0x3d8d('0x34')]){_0x51c862[_0x3d8d('0x35')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x3d8d('0x26')](_0x51c862);})[_0x3d8d('0x1b')](function(_0x1f71b4){_0x1432cd[_0x3d8d('0x4c')]=_0x1f71b4;return _0x1432cd;});}})[_0x3d8d('0x1b')](respondWithFilteredResult(_0xc83921,_0x51c862))['catch'](handleError(_0xc83921,null));};exports[_0x3d8d('0x4d')]=function(_0x46dd5d,_0x560924){return db[_0x3d8d('0x21')][_0x3d8d('0x37')]({'where':{'id':_0x46dd5d[_0x3d8d('0x2c')]['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0x560924,null))[_0x3d8d('0x1b')](function(_0x69e1ff){if(_0x69e1ff){return _0x69e1ff['setTags'](_0x46dd5d[_0x3d8d('0x39')][_0x3d8d('0x3d')],_[_0x3d8d('0x3e')](_0x46dd5d[_0x3d8d('0x39')],[_0x3d8d('0x3d'),'id'])||{})[_0x3d8d('0x4e')](function(){return db[_0x3d8d('0x4f')][_0x3d8d('0x26')]({'attributes':['id',_0x3d8d('0x50'),_0x3d8d('0x51')],'where':{'id':_0x46dd5d[_0x3d8d('0x39')][_0x3d8d('0x3d')]}});})[_0x3d8d('0x1b')](function(_0x288e3f){socket[_0x3d8d('0x52')](_0x3d8d('0x53'),{'id':Number(_0x46dd5d[_0x3d8d('0x2c')]['id']),'tags':_0x288e3f||[]});return{'id':Number(_0x46dd5d[_0x3d8d('0x2c')]['id']),'tags':_0x288e3f||[]};});}})['then'](respondWithResult(_0x560924,null))[_0x3d8d('0x2a')](handleError(_0x560924,null));};exports[_0x3d8d('0x54')]=function(_0x3625fa,_0x4eca0e){return db[_0x3d8d('0x21')]['find']({'where':{'id':_0x3625fa[_0x3d8d('0x2c')]['id']}})[_0x3d8d('0x1b')](handleEntityNotFound(_0x4eca0e,null))[_0x3d8d('0x1b')](function(_0x45e742){if(_0x45e742){return _0x45e742[_0x3d8d('0x54')](_0x3625fa[_0x3d8d('0x28')]['ids']);}})[_0x3d8d('0x1b')](respondWithStatusCode(_0x4eca0e,null))[_0x3d8d('0x2a')](handleError(_0x4eca0e,null));};exports[_0x3d8d('0x55')]=function(_0x298b53,_0x1ccc9d){var _0x16a0d5=moment()[_0x3d8d('0x56')]()[_0x3d8d('0x57')]();var _0x365d67=path['join'](config[_0x3d8d('0x58')],_0x3d8d('0x59'),_0x3d8d('0x5a'),'tmp');var _0x121451=path[_0x3d8d('0x5b')](config['root'],_0x3d8d('0x59'),'files',_0x3d8d('0x5c'));var _0x5a5dff=path[_0x3d8d('0x5b')](_0x365d67,_0x16a0d5);var _0x16398a=util[_0x3d8d('0x4a')](_0x3d8d('0x5d'),_0x298b53[_0x3d8d('0x2c')]['id'],_0x16a0d5);var _0x2c66d1=path[_0x3d8d('0x5b')](_0x365d67,_0x16398a);var _0x3b89e8=[];_0x3b89e8['push']({'model':db[_0x3d8d('0x5e')],'as':_0x3d8d('0x5e'),'attributes':['id',_0x3d8d('0x5f')],'raw':!![]});_0x3b89e8[_0x3d8d('0x60')]({'model':db[_0x3d8d('0x61')],'as':_0x3d8d('0x62'),'attributes':['id',_0x3d8d('0x63'),_0x3d8d('0x64')],'raw':!![]});if(_0x298b53[_0x3d8d('0x28')][_0x3d8d('0x5c')]){_0x3b89e8['push']({'model':db[_0x3d8d('0x65')],'as':'Attachment','raw':!![]});}var _0x2b5209=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id','body',_0x3d8d('0x66'),_0x3d8d('0x67'),_0x3d8d('0x68'),_0x3d8d('0x69')],'include':_0x3b89e8}];_0x2b5209[_0x3d8d('0x60')]({'model':db['WhatsappAccount'],'as':_0x3d8d('0x6a'),'attributes':['id','name']});_0x2b5209[_0x3d8d('0x60')]({'model':db['User'],'as':_0x3d8d('0x6b'),'attributes':['id',_0x3d8d('0x5f')]});return db['WhatsappInteraction'][_0x3d8d('0x37')]({'where':{'id':_0x298b53[_0x3d8d('0x2c')]['id']},'include':_0x2b5209})[_0x3d8d('0x1b')](handleEntityNotFound(_0x1ccc9d,null))[_0x3d8d('0x1b')](function(_0xe5cfda){if(_0xe5cfda){var _0x5ed0ac=_0xe5cfda[_0x3d8d('0x6c')]({'plain':!![]});fs[_0x3d8d('0x6d')](_0x5a5dff);var _0xcca167={'channel':_0x3d8d('0x6e'),'account':_0x5ed0ac['Account'][_0x3d8d('0x50')],'agent':_0x5ed0ac[_0x3d8d('0x6b')]?_0x5ed0ac['Owner']['fullname']:_0x3d8d('0x6f'),'createdAt':moment(_0x5ed0ac[_0x3d8d('0x66')])[_0x3d8d('0x4a')](_0x3d8d('0x4b'))['toString'](),'closedAt':_0x5ed0ac['closed']?moment(_0x5ed0ac[_0x3d8d('0x70')])[_0x3d8d('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5ed0ac[_0x3d8d('0x71')],'messages':_(_0x5ed0ac[_0x3d8d('0x72')])[_0x3d8d('0x46')]({'secret':![]})[_0x3d8d('0x47')](function(_0xa65128){if(_0xa65128[_0x3d8d('0x65')]){var _0x27fa31=path[_0x3d8d('0x5b')](_0x121451,_0xa65128[_0x3d8d('0x65')]['basename']);if(fs['existsSync'](_0x27fa31)){fs[_0x3d8d('0x73')](_0x27fa31)[_0x3d8d('0x74')](fs['createWriteStream'](path[_0x3d8d('0x5b')](_0x5a5dff,_0xa65128[_0x3d8d('0x65')][_0x3d8d('0x75')])));}}return{'date':moment(_0xa65128['createdAt'])['format'](_0x3d8d('0x4b'))['toString'](),'sender':_0xa65128[_0x3d8d('0x67')]==='out'?_0xa65128[_0x3d8d('0x5e')]?_0xa65128[_0x3d8d('0x5e')][_0x3d8d('0x5f')]:'System':_0xa65128[_0x3d8d('0x62')][_0x3d8d('0x63')]+(_0xa65128['Contact'][_0x3d8d('0x64')]?'\x20'+_0xa65128[_0x3d8d('0x62')][_0x3d8d('0x64')]:''),'body':_0xa65128[_0x3d8d('0x65')]?_0xa65128['Attachment'][_0x3d8d('0x75')]:_0xa65128[_0x3d8d('0x39')],'direction':_0xa65128['direction']===_0x3d8d('0x76')?'A':'C','secret':_0xa65128[_0x3d8d('0x68')],'read':_0xa65128[_0x3d8d('0x69')],'attachment':_0xa65128[_0x3d8d('0x65')]};})['value']()};return ejs[_0x3d8d('0x77')](path[_0x3d8d('0x5b')](config[_0x3d8d('0x58')],_0x3d8d('0x59'),_0x3d8d('0x78'),_0x3d8d('0x79')),{'interaction':_0xcca167})[_0x3d8d('0x1b')](function(_0x1e8ed6){var _0x29ec4c=path[_0x3d8d('0x5b')](_0x5a5dff,_0x3d8d('0x7a')+_0x5ed0ac['id']+'-'+_0x16a0d5+_0x3d8d('0x7b'));var _0x579bdb={'path':_0x29ec4c,'channel':_0x3d8d('0x6e'),'interactionId':_0x5ed0ac['id']};return pdf[_0x3d8d('0x7c')](_0x1e8ed6,_0x579bdb);})['then'](function(){return new BPromise(function(_0x43284d,_0x57f2c0){zipdir(_0x5a5dff,{'saveTo':_0x2c66d1},function(_0x47f608,_0x1a1836){if(_0x47f608)return _0x57f2c0(_0x47f608);return _0x43284d(_0x1a1836);});})[_0x3d8d('0x1b')](function(){return new BPromise(function(_0x35a642,_0x596788){rimraf(_0x5a5dff,function(_0x386fed){if(_0x386fed)_0x596788(_0x386fed);return _0x35a642();});});})[_0x3d8d('0x1b')](function(){return _0x1ccc9d[_0x3d8d('0x55')](_0x2c66d1,_0x16398a,function(_0x210e9c){if(_0x210e9c){console[_0x3d8d('0x7d')](_0x3d8d('0x7e'),_0x210e9c);}else{fs['unlinkSync'](_0x2c66d1);}});});});}else{return _0x1ccc9d[_0x3d8d('0x12')](0xc8);}})[_0x3d8d('0x2a')](handleError(_0x1ccc9d,null));}; \ No newline at end of file +var _0x22a5=['downloadInteraction.ejs','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','then','error','stack','name','index','map','WhatsappInteraction','fieldName','type','key','findAll','whatsapp','user','catch','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','create','body','find','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','nolimit','sort','where','WhatsappInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','rows','addTags','setTags','spread','Tag','color','emit','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','push','User','fullname','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','get','Whatsapp','Account','Owner','N.A.','closedAt','basename','existsSync','createReadStream','pipe','System','lastName','out','value','renderFile','views'];(function(_0x49be84,_0x17546a){var _0x434e3f=function(_0xa4667a){while(--_0xa4667a){_0x49be84['push'](_0x49be84['shift']());}};_0x434e3f(++_0x17546a);}(_0x22a5,0x181));var _0x522a=function(_0x343138,_0x386c81){_0x343138=_0x343138-0x0;var _0x4e40d8=_0x22a5[_0x343138];return _0x4e40d8;};'use strict';var rimraf=require(_0x522a('0x0'));var zipdir=require(_0x522a('0x1'));var moment=require(_0x522a('0x2'));var BPromise=require(_0x522a('0x3'));var util=require(_0x522a('0x4'));var path=require('path');var ejs=require(_0x522a('0x5'));var fs=require('fs');var _=require(_0x522a('0x6'));var Redis=require('ioredis');var interaction=require(_0x522a('0x7'));var qs=require(_0x522a('0x8'));var pdf=require(_0x522a('0x9'));var logger=require(_0x522a('0xa'))(_0x522a('0xb'));var config=require('../../config/environment');var db=require(_0x522a('0xc'))['db'];config[_0x522a('0xd')]=_[_0x522a('0xe')](config['redis'],{'host':_0x522a('0xf'),'port':0x18eb});var socket=require(_0x522a('0x10'))(new Redis(config[_0x522a('0xd')]));require(_0x522a('0x11'))[_0x522a('0x12')](socket);function respondWithStatusCode(_0x145d61,_0x1966c8){_0x1966c8=_0x1966c8||0xcc;return function(_0x44f7be){if(_0x44f7be){return _0x145d61[_0x522a('0x13')](_0x1966c8);}return _0x145d61[_0x522a('0x14')](_0x1966c8)[_0x522a('0x15')]();};}function respondWithResult(_0x133350,_0x2cc22f){_0x2cc22f=_0x2cc22f||0xc8;return function(_0x203dee){if(_0x203dee){return _0x133350['status'](_0x2cc22f)[_0x522a('0x16')](_0x203dee);}};}function respondWithFilteredResult(_0xf112a8,_0x29a4c7){return function(_0x571d6){if(_0x571d6){var _0x23558f=typeof _0x29a4c7[_0x522a('0x17')]==='undefined'&&typeof _0x29a4c7[_0x522a('0x18')]===_0x522a('0x19');var _0x56fc48=_0x571d6[_0x522a('0x1a')];var _0x3f78c3=_0x23558f?0x0:_0x29a4c7['offset'];var _0x1f0657=_0x23558f?_0x571d6[_0x522a('0x1a')]:_0x29a4c7['offset']+_0x29a4c7[_0x522a('0x18')];var _0x395081;if(_0x1f0657>=_0x56fc48){_0x1f0657=_0x56fc48;_0x395081=0xc8;}else{_0x395081=0xce;}_0xf112a8[_0x522a('0x14')](_0x395081);return _0xf112a8[_0x522a('0x1b')](_0x522a('0x1c'),_0x3f78c3+'-'+_0x1f0657+'/'+_0x56fc48)[_0x522a('0x16')](_0x571d6);}return null;};}function saveUpdates(_0x2487d6){return function(_0x5e4d2b){if(_0x5e4d2b){return _0x5e4d2b[_0x522a('0x1d')](_0x2487d6)['then'](function(_0x601b7e){return _0x601b7e;});}return null;};}function removeEntity(_0xfd46f8){return function(_0x7f929d){if(_0x7f929d){return _0x7f929d['destroy']()[_0x522a('0x1e')](function(){_0xfd46f8[_0x522a('0x14')](0xcc)[_0x522a('0x15')]();});}};}function handleEntityNotFound(_0x2bac0e){return function(_0x2b830f){if(!_0x2b830f){_0x2bac0e[_0x522a('0x13')](0x194);}return _0x2b830f;};}function handleError(_0x3b876b,_0x584f6c){_0x584f6c=_0x584f6c||0x1f4;return function(_0x171acd){logger[_0x522a('0x1f')](_0x171acd[_0x522a('0x20')]);if(_0x171acd[_0x522a('0x21')]){delete _0x171acd[_0x522a('0x21')];}_0x3b876b[_0x522a('0x14')](_0x584f6c)['send'](_0x171acd);};}exports[_0x522a('0x22')]=function(_0x4282a5,_0x511fd4){var _0xc664c2={};var _0x4b56d6=_[_0x522a('0x23')](db[_0x522a('0x24')]['rawAttributes'],function(_0x4d92f0){return{'name':_0x4d92f0[_0x522a('0x25')],'type':_0x4d92f0[_0x522a('0x26')][_0x522a('0x27')]};});_0xc664c2=qs['getOptions'](_0x4b56d6,_0x4282a5);return interaction[_0x522a('0x28')](_0x522a('0x29'),_0x4282a5['query'],_0x4282a5[_0x522a('0x2a')],_0xc664c2,_0x4b56d6)['then'](respondWithFilteredResult(_0x511fd4,_0xc664c2))[_0x522a('0x2b')](handleError(_0x511fd4,null));};exports['show']=function(_0x585d64,_0x502007){var _0x24bc57={'raw':![],'where':{'id':_0x585d64[_0x522a('0x2c')]['id']}},_0x3dc214={};_0x3dc214[_0x522a('0x2d')]=_[_0x522a('0x2e')](db[_0x522a('0x24')][_0x522a('0x2f')]);_0x3dc214[_0x522a('0x30')]=_[_0x522a('0x2e')](_0x585d64['query']);_0x3dc214[_0x522a('0x31')]=_[_0x522a('0x32')](_0x3dc214[_0x522a('0x2d')],_0x3dc214[_0x522a('0x30')]);_0x24bc57['attributes']=_[_0x522a('0x32')](_0x3dc214[_0x522a('0x2d')],qs[_0x522a('0x33')](_0x585d64[_0x522a('0x30')][_0x522a('0x33')]));_0x24bc57[_0x522a('0x34')]=_0x24bc57[_0x522a('0x34')][_0x522a('0x35')]?_0x24bc57[_0x522a('0x34')]:_0x3dc214[_0x522a('0x2d')];if(_0x585d64[_0x522a('0x30')][_0x522a('0x36')]){_0x24bc57[_0x522a('0x37')]=[{'all':!![]}];}_0x24bc57=_[_0x522a('0x38')]({},_0x24bc57,_0x585d64['options']);return db[_0x522a('0x24')]['find'](_0x24bc57)[_0x522a('0x1e')](handleEntityNotFound(_0x502007,null))[_0x522a('0x1e')](respondWithResult(_0x502007,null))['catch'](handleError(_0x502007,null));};exports[_0x522a('0x39')]=function(_0x161df6,_0x5e8677){return db[_0x522a('0x24')]['create'](_0x161df6[_0x522a('0x3a')],{})[_0x522a('0x1e')](respondWithResult(_0x5e8677,0xc9))[_0x522a('0x2b')](handleError(_0x5e8677,null));};exports['update']=function(_0x54e709,_0x366bd4){if(_0x54e709[_0x522a('0x3a')]['id']){delete _0x54e709[_0x522a('0x3a')]['id'];}return db[_0x522a('0x24')][_0x522a('0x3b')]({'where':{'id':_0x54e709[_0x522a('0x2c')]['id']}})['then'](handleEntityNotFound(_0x366bd4,null))[_0x522a('0x1e')](saveUpdates(_0x54e709['body'],null))[_0x522a('0x1e')](respondWithResult(_0x366bd4,null))[_0x522a('0x2b')](handleError(_0x366bd4,null));};exports[_0x522a('0x3c')]=function(_0x162371,_0x1d969d){return db[_0x522a('0x24')][_0x522a('0x3b')]({'where':{'id':_0x162371['params']['id']}})[_0x522a('0x1e')](handleEntityNotFound(_0x1d969d,null))['then'](removeEntity(_0x1d969d,null))[_0x522a('0x2b')](handleError(_0x1d969d,null));};exports[_0x522a('0x3d')]=function(_0x279622,_0x28368e){return db[_0x522a('0x24')][_0x522a('0x3d')]()[_0x522a('0x1e')](respondWithResult(_0x28368e,null))[_0x522a('0x2b')](handleError(_0x28368e,null));};exports['addMessage']=function(_0xc54930,_0x556ff4){return db[_0x522a('0x3e')][_0x522a('0x3b')]({'where':{'id':_0xc54930['params']['id']}})[_0x522a('0x1e')](handleEntityNotFound(_0x556ff4,null))[_0x522a('0x1e')](function(_0x46fc6c){if(_0x46fc6c){return _0x46fc6c[_0x522a('0x3f')](_0xc54930[_0x522a('0x3a')][_0x522a('0x40')],_[_0x522a('0x41')](_0xc54930[_0x522a('0x3a')],['ids','id'])||{});}})[_0x522a('0x1e')](respondWithResult(_0x556ff4,null))['catch'](handleError(_0x556ff4,null));};exports[_0x522a('0x42')]=function(_0x551f06,_0x2991dd){var _0x78e396={'raw':![],'where':{}};var _0x3b7bf9={};var _0x16dd26={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x522a('0x43')]({'where':{'id':_0x551f06['params']['id']}})[_0x522a('0x1e')](handleEntityNotFound(_0x2991dd,null))[_0x522a('0x1e')](function(_0x261194){if(_0x261194){_0x3b7bf9['model']=_[_0x522a('0x2e')](db[_0x522a('0x3e')]['rawAttributes']);_0x3b7bf9['query']=_[_0x522a('0x2e')](_0x551f06[_0x522a('0x30')]);_0x3b7bf9[_0x522a('0x31')]=_[_0x522a('0x32')](_0x3b7bf9[_0x522a('0x2d')],_0x3b7bf9[_0x522a('0x30')]);_0x78e396[_0x522a('0x34')]=_[_0x522a('0x32')](_0x3b7bf9[_0x522a('0x2d')],qs[_0x522a('0x33')](_0x551f06[_0x522a('0x30')]['fields']));_0x78e396[_0x522a('0x34')]=_0x78e396[_0x522a('0x34')][_0x522a('0x35')]?_0x78e396[_0x522a('0x34')]:_0x3b7bf9[_0x522a('0x2d')];if(!_0x551f06[_0x522a('0x30')]['hasOwnProperty'](_0x522a('0x44'))){_0x78e396[_0x522a('0x18')]=qs[_0x522a('0x18')](_0x551f06['query']['limit']);_0x78e396[_0x522a('0x17')]=qs['offset'](_0x551f06[_0x522a('0x30')]['offset']);}_0x78e396['order']=qs['sort'](_0x551f06['query'][_0x522a('0x45')]);_0x78e396[_0x522a('0x46')]=qs[_0x522a('0x31')](_['pick'](_0x551f06[_0x522a('0x30')],_0x3b7bf9[_0x522a('0x31')]));_0x78e396['where'][_0x522a('0x47')]=_0x261194['id'];if(_0x551f06[_0x522a('0x30')][_0x522a('0x48')]){_0x78e396[_0x522a('0x46')]=_[_0x522a('0x38')](_0x78e396[_0x522a('0x46')],{'$or':_[_0x522a('0x23')](_0x78e396[_0x522a('0x34')],function(_0x26df79){var _0x9c7369={};_0x9c7369[_0x26df79]={'$like':'%'+_0x551f06['query'][_0x522a('0x48')]+'%'};return _0x9c7369;})});}if(_0x551f06[_0x522a('0x30')]['$gte']){var _0x126e86=_0x551f06[_0x522a('0x30')][_0x522a('0x49')]['split'](',');var _0x2d873f={};_0x2d873f[_0x126e86[0x0]]={'$gte':moment(_0x126e86[0x1])[_0x522a('0x4a')](_0x522a('0x4b'))};_0x78e396[_0x522a('0x46')]=_['merge'](_0x78e396[_0x522a('0x46')],_0x2d873f);}_0x78e396=_[_0x522a('0x38')]({},_0x78e396,_0x551f06[_0x522a('0x4c')]);return db[_0x522a('0x3e')][_0x522a('0x1a')]({'where':_0x78e396[_0x522a('0x46')]})['then'](function(_0x304623){_0x16dd26[_0x522a('0x1a')]=_0x304623;if(_0x551f06[_0x522a('0x30')][_0x522a('0x36')]){_0x78e396[_0x522a('0x37')]=[{'all':!![]}];}return db[_0x522a('0x3e')]['findAll'](_0x78e396);})['then'](function(_0x1a1b93){_0x16dd26[_0x522a('0x4d')]=_0x1a1b93;return _0x16dd26;});}})[_0x522a('0x1e')](respondWithFilteredResult(_0x2991dd,_0x78e396))[_0x522a('0x2b')](handleError(_0x2991dd,null));};exports[_0x522a('0x4e')]=function(_0x8252d4,_0x27e69e){return db[_0x522a('0x24')]['find']({'where':{'id':_0x8252d4[_0x522a('0x2c')]['id']}})[_0x522a('0x1e')](handleEntityNotFound(_0x27e69e,null))['then'](function(_0x44a0b0){if(_0x44a0b0){return _0x44a0b0[_0x522a('0x4f')](_0x8252d4[_0x522a('0x3a')][_0x522a('0x40')],_[_0x522a('0x41')](_0x8252d4[_0x522a('0x3a')],[_0x522a('0x40'),'id'])||{})[_0x522a('0x50')](function(){return db[_0x522a('0x51')]['findAll']({'attributes':['id',_0x522a('0x21'),_0x522a('0x52')],'where':{'id':_0x8252d4['body'][_0x522a('0x40')]}});})[_0x522a('0x1e')](function(_0x1cd6f9){socket[_0x522a('0x53')](_0x522a('0x54'),{'id':Number(_0x8252d4[_0x522a('0x2c')]['id']),'tags':_0x1cd6f9||[]});return{'id':Number(_0x8252d4['params']['id']),'tags':_0x1cd6f9||[]};});}})[_0x522a('0x1e')](respondWithResult(_0x27e69e,null))[_0x522a('0x2b')](handleError(_0x27e69e,null));};exports[_0x522a('0x55')]=function(_0x598665,_0x17eaa8){return db['WhatsappInteraction'][_0x522a('0x3b')]({'where':{'id':_0x598665['params']['id']}})[_0x522a('0x1e')](handleEntityNotFound(_0x17eaa8,null))['then'](function(_0x20967a){if(_0x20967a){return _0x20967a['removeTags'](_0x598665[_0x522a('0x30')][_0x522a('0x40')]);}})[_0x522a('0x1e')](respondWithStatusCode(_0x17eaa8,null))[_0x522a('0x2b')](handleError(_0x17eaa8,null));};exports[_0x522a('0x56')]=function(_0x4a3573,_0x58bd52){var _0x288fca=moment()[_0x522a('0x57')]()[_0x522a('0x58')]();var _0x5a4465=path[_0x522a('0x59')](config[_0x522a('0x5a')],_0x522a('0x5b'),_0x522a('0x5c'),_0x522a('0x5d'));var _0x1a06fb=path[_0x522a('0x59')](config[_0x522a('0x5a')],'server',_0x522a('0x5c'),_0x522a('0x5e'));var _0x5442af=path['join'](_0x5a4465,_0x288fca);var _0x1761b0=util[_0x522a('0x4a')]('transcript-%d-%s.zip',_0x4a3573[_0x522a('0x2c')]['id'],_0x288fca);var _0x23e0ba=path[_0x522a('0x59')](_0x5a4465,_0x1761b0);var _0xe8c84a=[];_0xe8c84a[_0x522a('0x5f')]({'model':db['User'],'as':_0x522a('0x60'),'attributes':['id',_0x522a('0x61')],'raw':!![]});_0xe8c84a[_0x522a('0x5f')]({'model':db['CmContact'],'as':_0x522a('0x62'),'attributes':['id',_0x522a('0x63'),'lastName'],'raw':!![]});if(_0x4a3573[_0x522a('0x30')][_0x522a('0x5e')]){_0xe8c84a[_0x522a('0x5f')]({'model':db[_0x522a('0x64')],'as':_0x522a('0x64'),'raw':!![]});}var _0x5c36d7=[{'model':db['WhatsappMessage'],'as':_0x522a('0x65'),'attributes':['id','body',_0x522a('0x66'),_0x522a('0x67'),_0x522a('0x68'),_0x522a('0x69')],'include':_0xe8c84a}];_0x5c36d7['push']({'model':db[_0x522a('0x6a')],'as':'Account','attributes':['id',_0x522a('0x21')]});_0x5c36d7[_0x522a('0x5f')]({'model':db['User'],'as':'Owner','attributes':['id',_0x522a('0x61')]});return db[_0x522a('0x24')][_0x522a('0x3b')]({'where':{'id':_0x4a3573[_0x522a('0x2c')]['id']},'include':_0x5c36d7})[_0x522a('0x1e')](handleEntityNotFound(_0x58bd52,null))[_0x522a('0x1e')](function(_0x5ca68e){if(_0x5ca68e){var _0x27e593=_0x5ca68e[_0x522a('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x5442af);var _0x583283={'channel':_0x522a('0x6c'),'account':_0x27e593[_0x522a('0x6d')][_0x522a('0x21')],'agent':_0x27e593[_0x522a('0x6e')]?_0x27e593['Owner'][_0x522a('0x61')]:_0x522a('0x6f'),'createdAt':moment(_0x27e593[_0x522a('0x66')])['format'](_0x522a('0x4b'))[_0x522a('0x58')](),'closedAt':_0x27e593['closed']?moment(_0x27e593[_0x522a('0x70')])['format'](_0x522a('0x4b'))[_0x522a('0x58')]():'','disposition':_0x27e593['disposition'],'messages':_(_0x27e593[_0x522a('0x65')])['filter']({'secret':![]})[_0x522a('0x23')](function(_0x4631b9){if(_0x4631b9[_0x522a('0x64')]){var _0x5f540a=path[_0x522a('0x59')](_0x1a06fb,_0x4631b9[_0x522a('0x64')][_0x522a('0x71')]);if(fs[_0x522a('0x72')](_0x5f540a)){fs[_0x522a('0x73')](_0x5f540a)[_0x522a('0x74')](fs['createWriteStream'](path[_0x522a('0x59')](_0x5442af,_0x4631b9['Attachment']['basename'])));}}return{'date':moment(_0x4631b9[_0x522a('0x66')])[_0x522a('0x4a')](_0x522a('0x4b'))[_0x522a('0x58')](),'sender':_0x4631b9[_0x522a('0x67')]==='out'?_0x4631b9[_0x522a('0x60')]?_0x4631b9[_0x522a('0x60')][_0x522a('0x61')]:_0x522a('0x75'):_0x4631b9[_0x522a('0x62')][_0x522a('0x63')]+(_0x4631b9[_0x522a('0x62')][_0x522a('0x76')]?'\x20'+_0x4631b9['Contact'][_0x522a('0x76')]:''),'body':_0x4631b9['Attachment']?_0x4631b9[_0x522a('0x64')][_0x522a('0x71')]:_0x4631b9['body'],'direction':_0x4631b9[_0x522a('0x67')]===_0x522a('0x77')?'A':'C','secret':_0x4631b9[_0x522a('0x68')],'read':_0x4631b9[_0x522a('0x69')],'attachment':_0x4631b9[_0x522a('0x64')]};})[_0x522a('0x78')]()};return ejs[_0x522a('0x79')](path['join'](config[_0x522a('0x5a')],'server',_0x522a('0x7a'),_0x522a('0x7b')),{'interaction':_0x583283})['then'](function(_0x30994b){var _0x3dc354=path[_0x522a('0x59')](_0x5442af,'transcript-'+_0x27e593['id']+'-'+_0x288fca+'.pdf');var _0x4176eb={'path':_0x3dc354,'channel':'Whatsapp','interactionId':_0x27e593['id']};return pdf[_0x522a('0x7c')](_0x30994b,_0x4176eb);})[_0x522a('0x1e')](function(){return new BPromise(function(_0x2b2212,_0x1ad8c5){zipdir(_0x5442af,{'saveTo':_0x23e0ba},function(_0x10245e,_0x4dbc7d){if(_0x10245e)return _0x1ad8c5(_0x10245e);return _0x2b2212(_0x4dbc7d);});})[_0x522a('0x1e')](function(){return new BPromise(function(_0x150d02,_0x597ea5){rimraf(_0x5442af,function(_0x161758){if(_0x161758)_0x597ea5(_0x161758);return _0x150d02();});});})[_0x522a('0x1e')](function(){return _0x58bd52[_0x522a('0x56')](_0x23e0ba,_0x1761b0,function(_0x5f0ee0){if(_0x5f0ee0){console[_0x522a('0x7d')](_0x522a('0x7e'),_0x5f0ee0);}else{fs['unlinkSync'](_0x23e0ba);}});});});}else{return _0x58bd52['sendStatus'](0xc8);}})[_0x522a('0x2b')](handleError(_0x58bd52,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index a01fee0..9fda33f 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 _0x574d=['remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save'];(function(_0x3b67fe,_0x3307a8){var _0x3ee0ae=function(_0x93188f){while(--_0x93188f){_0x3b67fe['push'](_0x3b67fe['shift']());}};_0x3ee0ae(++_0x3307a8);}(_0x574d,0xc0));var _0xd574=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x574d[_0x5c2e3e];return _0x53f64a;};'use strict';var EventEmitter=require(_0xd574('0x0'));var WhatsappInteraction=require(_0xd574('0x1'))['db'][_0xd574('0x2')];var WhatsappMessage=require(_0xd574('0x1'))['db'][_0xd574('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xd574('0x4')](0x0);var events={'afterCreate':_0xd574('0x5'),'afterUpdate':'update','afterDestroy':_0xd574('0x6')};function emitEvent(_0x1be154){return function(_0x469ad7,_0x3e2e7d,_0x56ecee){_0x469ad7[_0xd574('0x7')]({'attributes':['id'],'raw':!![]})[_0xd574('0x8')](function(_0x3ce54f){_0x469ad7[_0xd574('0x9')](_0xd574('0xa'),_0x3ce54f[_0xd574('0xb')](function(_0x54fe4f){return{'id':_0x54fe4f['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x469ad7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd574('0x8')](function(_0x11ef21){_0x469ad7[_0xd574('0x9')](_0xd574('0xc'),_0x11ef21[_0xd574('0xd')]);WhatsappInteractionEvents[_0xd574('0xe')](_0x1be154+':'+_0x469ad7['id'],_0x469ad7);WhatsappInteractionEvents[_0xd574('0xe')](_0x1be154,_0x469ad7);_0x56ecee(null);})['catch'](_0x56ecee(null));};}for(var e in events){if(events[_0xd574('0xf')](e)){var event=events[e];WhatsappInteraction[_0xd574('0x10')](e,emitEvent(event));}}module[_0xd574('0x11')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xcd31=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x59ce87,_0x122e3b){var _0x514f8c=function(_0x189a53){while(--_0x189a53){_0x59ce87['push'](_0x59ce87['shift']());}};_0x514f8c(++_0x122e3b);}(_0xcd31,0x15d));var _0x1cd3=function(_0x32369e,_0x2fbc0c){_0x32369e=_0x32369e-0x0;var _0x4f3ae6=_0xcd31[_0x32369e];return _0x4f3ae6;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x1cd3('0x0'))['db'][_0x1cd3('0x1')];var WhatsappMessage=require(_0x1cd3('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1cd3('0x2')](0x0);var events={'afterCreate':_0x1cd3('0x3'),'afterUpdate':_0x1cd3('0x4'),'afterDestroy':_0x1cd3('0x5')};function emitEvent(_0x295933){return function(_0xf9f49b,_0x5bc77d,_0x26ffcb){_0xf9f49b[_0x1cd3('0x6')]({'attributes':['id'],'raw':!![]})[_0x1cd3('0x7')](function(_0x49d849){_0xf9f49b[_0x1cd3('0x8')](_0x1cd3('0x9'),_0x49d849[_0x1cd3('0xa')](function(_0x4a2204){return{'id':_0x4a2204['id']};}));return WhatsappMessage[_0x1cd3('0xb')]({'where':{'WhatsappInteractionId':_0xf9f49b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1cd3('0x7')](function(_0x17d5c8){_0xf9f49b[_0x1cd3('0x8')](_0x1cd3('0xc'),_0x17d5c8[_0x1cd3('0xd')]);WhatsappInteractionEvents[_0x1cd3('0xe')](_0x295933+':'+_0xf9f49b['id'],_0xf9f49b);WhatsappInteractionEvents['emit'](_0x295933,_0xf9f49b);_0x26ffcb(null);})[_0x1cd3('0xf')](_0x26ffcb(null));};}for(var e in events){if(events[_0x1cd3('0x10')](e)){var event=events[e];WhatsappInteraction[_0x1cd3('0x11')](e,emitEvent(event));}}module[_0x1cd3('0x12')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 338a601..f4320df 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 _0x29f4=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','define','WhatsappInteraction','closed','format'];(function(_0x297c3c,_0x56c669){var _0x4badaa=function(_0x1094f5){while(--_0x1094f5){_0x297c3c['push'](_0x297c3c['shift']());}};_0x4badaa(++_0x56c669);}(_0x29f4,0x1d1));var _0x429f=function(_0xcb3620,_0x48de03){_0xcb3620=_0xcb3620-0x0;var _0x69a88c=_0x29f4[_0xcb3620];return _0x69a88c;};'use strict';var _=require(_0x429f('0x0'));var util=require(_0x429f('0x1'));var logger=require(_0x429f('0x2'))(_0x429f('0x3'));var moment=require(_0x429f('0x4'));var BPromise=require(_0x429f('0x5'));var rp=require(_0x429f('0x6'));var fs=require('fs');var path=require(_0x429f('0x7'));var rimraf=require(_0x429f('0x8'));var config=require(_0x429f('0x9'));var attributes=require(_0x429f('0xa'));module['exports']=function(_0x219012,_0x1341ee){return _0x219012[_0x429f('0xb')](_0x429f('0xc'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x31780f,_0x550aeb,_0x1f3a3e){if(_0x31780f['changed'](_0x429f('0xd'))){_0x31780f['closedAt']=moment()[_0x429f('0xe')](_0x429f('0xf'));}_0x1f3a3e(null,_0x31780f);}}});}; \ No newline at end of file +var _0xb329=['moment','bluebird','rimraf','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x343c0f,_0x5944a3){var _0x2cfca4=function(_0x3ffbff){while(--_0x3ffbff){_0x343c0f['push'](_0x343c0f['shift']());}};_0x2cfca4(++_0x5944a3);}(_0xb329,0x119));var _0x9b32=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0xb329[_0x254b22];return _0x1279db;};'use strict';var _=require(_0x9b32('0x0'));var util=require(_0x9b32('0x1'));var logger=require(_0x9b32('0x2'))(_0x9b32('0x3'));var moment=require(_0x9b32('0x4'));var BPromise=require(_0x9b32('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9b32('0x6'));var config=require('../../config/environment');var attributes=require(_0x9b32('0x7'));module[_0x9b32('0x8')]=function(_0x204f96,_0x246734){return _0x204f96[_0x9b32('0x9')](_0x9b32('0xa'),attributes,{'tableName':_0x9b32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5f1263,_0x5c2d55,_0x2f3067){if(_0x5f1263[_0x9b32('0xc')]('closed')){_0x5f1263['closedAt']=moment()[_0x9b32('0xd')](_0x9b32('0xe'));}_0x2f3067(null,_0x5f1263);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 7bdba96..51fe4af 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 _0xaa16=['../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','attributes','limit','find','then','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x466def,_0x1a34f1){var _0x3737c5=function(_0x36133d){while(--_0x36133d){_0x466def['push'](_0x466def['shift']());}};_0x3737c5(++_0x1a34f1);}(_0xaa16,0x1ba));var _0x6aa1=function(_0x5ee0ef,_0x34f2b1){_0x5ee0ef=_0x5ee0ef-0x0;var _0x144aab=_0xaa16[_0x5ee0ef];return _0x144aab;};'use strict';var _=require(_0x6aa1('0x0'));var util=require(_0x6aa1('0x1'));var moment=require(_0x6aa1('0x2'));var BPromise=require(_0x6aa1('0x3'));var rs=require(_0x6aa1('0x4'));var fs=require('fs');var Redis=require(_0x6aa1('0x5'));var db=require(_0x6aa1('0x6'))['db'];var utils=require(_0x6aa1('0x7'));var logger=require('../../config/logger')(_0x6aa1('0x8'));var config=require(_0x6aa1('0x9'));var jayson=require(_0x6aa1('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x6aa1('0xb')],{'host':_0x6aa1('0xc'),'port':0x18eb});var socket=require(_0x6aa1('0xd'))(new Redis(config[_0x6aa1('0xb')]));require(_0x6aa1('0xe'))[_0x6aa1('0xf')](socket);function respondWithRpcPromise(_0x1c966c,_0x540fc6,_0x589f71){return new BPromise(function(_0x1a3925,_0x5578ab){return client[_0x6aa1('0x10')](_0x1c966c,_0x589f71)['then'](function(_0x4468f6){logger[_0x6aa1('0x11')](_0x6aa1('0x12'),_0x540fc6,_0x6aa1('0x13'));logger[_0x6aa1('0x14')](_0x6aa1('0x15'),_0x540fc6,_0x6aa1('0x13'),JSON[_0x6aa1('0x16')](_0x4468f6));if(_0x4468f6[_0x6aa1('0x17')]){if(_0x4468f6['error'][_0x6aa1('0x18')]===0x1f4){logger['error'](_0x6aa1('0x12'),_0x540fc6,_0x4468f6[_0x6aa1('0x17')]['message']);return _0x5578ab(_0x4468f6['error'][_0x6aa1('0x19')]);}logger[_0x6aa1('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x540fc6,_0x4468f6['error'][_0x6aa1('0x19')]);return _0x1a3925(_0x4468f6[_0x6aa1('0x17')]['message']);}else{logger[_0x6aa1('0x11')]('WhatsappInteraction,\x20%s,\x20%s',_0x540fc6,'request\x20sent');_0x1a3925(_0x4468f6['result'][_0x6aa1('0x19')]);}})[_0x6aa1('0x1a')](function(_0x28db3e){logger['error'](_0x6aa1('0x12'),_0x540fc6,_0x28db3e);_0x5578ab(_0x28db3e);});});}exports[_0x6aa1('0x1b')]=function(_0x2acea7){var _0x785bbe=this;return new Promise(function(_0x5aacac,_0x5575d2){return db[_0x6aa1('0x1c')][_0x6aa1('0x1d')](_0x2acea7[_0x6aa1('0x1e')],{'raw':_0x2acea7[_0x6aa1('0x1f')]?_0x2acea7[_0x6aa1('0x1f')][_0x6aa1('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acea7[_0x6aa1('0x1f')]?_0x2acea7[_0x6aa1('0x1f')]['where']||null:null,'attributes':_0x2acea7['options']?_0x2acea7[_0x6aa1('0x1f')][_0x6aa1('0x21')]||null:null,'limit':_0x2acea7[_0x6aa1('0x1f')]?_0x2acea7[_0x6aa1('0x1f')][_0x6aa1('0x22')]||null:null})['then'](function(_0x14ba3){logger[_0x6aa1('0x11')](_0x6aa1('0x1b'),_0x2acea7);logger[_0x6aa1('0x14')](_0x6aa1('0x1b'),_0x2acea7,JSON[_0x6aa1('0x16')](_0x14ba3));_0x5aacac(_0x14ba3);})[_0x6aa1('0x1a')](function(_0x4b8727){logger[_0x6aa1('0x17')](_0x6aa1('0x1b'),_0x4b8727['message'],_0x2acea7);_0x5575d2(_0x785bbe[_0x6aa1('0x17')](0x1f4,_0x4b8727['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x4224b5){return new Promise(function(_0x4d93c2,_0xef495d){return db[_0x6aa1('0x1c')][_0x6aa1('0x23')]({'where':_0x4224b5[_0x6aa1('0x1f')]?_0x4224b5[_0x6aa1('0x1f')]['where']||null:null})[_0x6aa1('0x24')](function(_0x53e7ec){if(_0x53e7ec){return _0x53e7ec['addTags'](_0x4224b5[_0x6aa1('0x1e')][_0x6aa1('0x25')],_[_0x6aa1('0x26')](_0x4224b5[_0x6aa1('0x1e')],[_0x6aa1('0x25'),'id'])||{});}})[_0x6aa1('0x27')](function(_0x234322){logger[_0x6aa1('0x11')](_0x6aa1('0x28'),_0x4224b5);logger[_0x6aa1('0x14')]('AddTags',_0x4224b5,JSON['stringify'](_0x234322));_0x4d93c2(_0x234322);})['catch'](function(_0x47e702){logger[_0x6aa1('0x17')]('AddTags',_0x47e702[_0x6aa1('0x19')],_0x4224b5);_0xef495d(_this['error'](0x1f4,_0x47e702['message']));});});}; \ No newline at end of file +var _0x1c4d=['addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateWhatsappInteraction','update','body','options','raw','attributes','limit','AddTagsToWhatsappInteraction','where'];(function(_0x246a98,_0xdf59a8){var _0x3b8b79=function(_0x2d0a7b){while(--_0x2d0a7b){_0x246a98['push'](_0x246a98['shift']());}};_0x3b8b79(++_0xdf59a8);}(_0x1c4d,0xa9));var _0xd1c4=function(_0x835a38,_0x4cde34){_0x835a38=_0x835a38-0x0;var _0x50e539=_0x1c4d[_0x835a38];return _0x50e539;};'use strict';var _=require(_0xd1c4('0x0'));var util=require(_0xd1c4('0x1'));var moment=require(_0xd1c4('0x2'));var BPromise=require(_0xd1c4('0x3'));var rs=require(_0xd1c4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd1c4('0x5'));var logger=require(_0xd1c4('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd1c4('0x7'));var client=jayson[_0xd1c4('0x8')][_0xd1c4('0x9')]({'port':0x232a});config[_0xd1c4('0xa')]=_[_0xd1c4('0xb')](config[_0xd1c4('0xa')],{'host':_0xd1c4('0xc'),'port':0x18eb});var socket=require(_0xd1c4('0xd'))(new Redis(config[_0xd1c4('0xa')]));require('./whatsappInteraction.socket')[_0xd1c4('0xe')](socket);function respondWithRpcPromise(_0x106907,_0x5dacc6,_0x5431f2){return new BPromise(function(_0x30cf5d,_0x585fcf){return client[_0xd1c4('0xf')](_0x106907,_0x5431f2)[_0xd1c4('0x10')](function(_0x5a9db5){logger[_0xd1c4('0x11')](_0xd1c4('0x12'),_0x5dacc6,_0xd1c4('0x13'));logger[_0xd1c4('0x14')](_0xd1c4('0x15'),_0x5dacc6,_0xd1c4('0x13'),JSON[_0xd1c4('0x16')](_0x5a9db5));if(_0x5a9db5[_0xd1c4('0x17')]){if(_0x5a9db5[_0xd1c4('0x17')][_0xd1c4('0x18')]===0x1f4){logger['error'](_0xd1c4('0x12'),_0x5dacc6,_0x5a9db5[_0xd1c4('0x17')][_0xd1c4('0x19')]);return _0x585fcf(_0x5a9db5[_0xd1c4('0x17')]['message']);}logger[_0xd1c4('0x17')](_0xd1c4('0x12'),_0x5dacc6,_0x5a9db5[_0xd1c4('0x17')][_0xd1c4('0x19')]);return _0x30cf5d(_0x5a9db5[_0xd1c4('0x17')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x5dacc6,'request\x20sent');_0x30cf5d(_0x5a9db5['result'][_0xd1c4('0x19')]);}})[_0xd1c4('0x1a')](function(_0x1be6f1){logger['error'](_0xd1c4('0x12'),_0x5dacc6,_0x1be6f1);_0x585fcf(_0x1be6f1);});});}exports[_0xd1c4('0x1b')]=function(_0x4bcb81){var _0x46e1f3=this;return new Promise(function(_0x95a875,_0x1affe7){return db['WhatsappInteraction'][_0xd1c4('0x1c')](_0x4bcb81[_0xd1c4('0x1d')],{'raw':_0x4bcb81[_0xd1c4('0x1e')]?_0x4bcb81[_0xd1c4('0x1e')][_0xd1c4('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bcb81[_0xd1c4('0x1e')]?_0x4bcb81['options']['where']||null:null,'attributes':_0x4bcb81[_0xd1c4('0x1e')]?_0x4bcb81['options'][_0xd1c4('0x20')]||null:null,'limit':_0x4bcb81['options']?_0x4bcb81['options'][_0xd1c4('0x21')]||null:null})[_0xd1c4('0x10')](function(_0x256bba){logger[_0xd1c4('0x11')](_0xd1c4('0x1b'),_0x4bcb81);logger[_0xd1c4('0x14')]('UpdateWhatsappInteraction',_0x4bcb81,JSON[_0xd1c4('0x16')](_0x256bba));_0x95a875(_0x256bba);})[_0xd1c4('0x1a')](function(_0x511844){logger['error'](_0xd1c4('0x1b'),_0x511844[_0xd1c4('0x19')],_0x4bcb81);_0x1affe7(_0x46e1f3['error'](0x1f4,_0x511844['message']));});});};exports[_0xd1c4('0x22')]=function(_0x14e6e4){return new Promise(function(_0x103776,_0x5b2e3e){return db['WhatsappInteraction']['find']({'where':_0x14e6e4['options']?_0x14e6e4['options'][_0xd1c4('0x23')]||null:null})[_0xd1c4('0x10')](function(_0x4eaafe){if(_0x4eaafe){return _0x4eaafe[_0xd1c4('0x24')](_0x14e6e4[_0xd1c4('0x1d')][_0xd1c4('0x25')],_[_0xd1c4('0x26')](_0x14e6e4['body'],[_0xd1c4('0x25'),'id'])||{});}})[_0xd1c4('0x27')](function(_0x5d97f2){logger[_0xd1c4('0x11')](_0xd1c4('0x28'),_0x14e6e4);logger[_0xd1c4('0x14')](_0xd1c4('0x28'),_0x14e6e4,JSON[_0xd1c4('0x16')](_0x5d97f2));_0x103776(_0x5d97f2);})['catch'](function(_0x35362d){logger[_0xd1c4('0x17')](_0xd1c4('0x28'),_0x35362d[_0xd1c4('0x19')],_0x14e6e4);_0x5b2e3e(_this[_0xd1c4('0x17')](0x1f4,_0x35362d[_0xd1c4('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index fe7281b..70688c2 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 _0x061a=['./whatsappInteraction.events','save','remove','emit','removeListener','whatsappInteraction:'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x061a,0x6c));var _0xa061=function(_0x124699,_0x5cec58){_0x124699=_0x124699-0x0;var _0x1ea1d7=_0x061a[_0x124699];return _0x1ea1d7;};'use strict';var WhatsappInteractionEvents=require(_0xa061('0x0'));var events=[_0xa061('0x1'),_0xa061('0x2'),'update'];function createListener(_0x10d745,_0x22701b){return function(_0x5cdb86){_0x22701b[_0xa061('0x3')](_0x10d745,_0x5cdb86);};}function removeListener(_0x16edd2,_0x31d219){return function(){WhatsappInteractionEvents[_0xa061('0x4')](_0x16edd2,_0x31d219);};}exports['register']=function(_0xf9eb34){for(var _0x12a3ea=0x0,_0x2c2aef=events['length'];_0x12a3ea<_0x2c2aef;_0x12a3ea++){var _0xac4be=events[_0x12a3ea];var _0xc330b9=createListener(_0xa061('0x5')+_0xac4be,_0xf9eb34);WhatsappInteractionEvents['on'](_0xac4be,_0xc330b9);}}; \ No newline at end of file +var _0x746d=['save','remove','emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x6ef71c,_0x597370){var _0x472693=function(_0x29feca){while(--_0x29feca){_0x6ef71c['push'](_0x6ef71c['shift']());}};_0x472693(++_0x597370);}(_0x746d,0xd1));var _0xd746=function(_0x29d891,_0x36778e){_0x29d891=_0x29d891-0x0;var _0x36d7a1=_0x746d[_0x29d891];return _0x36d7a1;};'use strict';var WhatsappInteractionEvents=require(_0xd746('0x0'));var events=[_0xd746('0x1'),_0xd746('0x2'),'update'];function createListener(_0x2883f7,_0x5b3363){return function(_0x399b42){_0x5b3363[_0xd746('0x3')](_0x2883f7,_0x399b42);};}function removeListener(_0x1dee84,_0x226e3b){return function(){WhatsappInteractionEvents[_0xd746('0x4')](_0x1dee84,_0x226e3b);};}exports['register']=function(_0x333b9f){for(var _0x5487b0=0x0,_0x31dc1c=events[_0xd746('0x5')];_0x5487b0<_0x31dc1c;_0x5487b0++){var _0x20d442=events[_0x5487b0];var _0x47c28f=createListener(_0xd746('0x6')+_0x20d442,_0x333b9f);WhatsappInteractionEvents['on'](_0x20d442,_0x47c28f);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index b2caed2..72a5866 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 _0xc714=['/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x59da7e,_0x4cb59e){var _0x38bc59=function(_0x335a04){while(--_0x335a04){_0x59da7e['push'](_0x59da7e['shift']());}};_0x38bc59(++_0x4cb59e);}(_0xc714,0x67));var _0x4c71=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc714[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0x4c71('0x0'));var util=require(_0x4c71('0x1'));var path=require(_0x4c71('0x2'));var timeout=require(_0x4c71('0x3'));var express=require(_0x4c71('0x4'));var router=express['Router']();var fs_extra=require(_0x4c71('0x5'));var auth=require(_0x4c71('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4c71('0x7'));var controller=require(_0x4c71('0x8'));router[_0x4c71('0x9')]('/',auth[_0x4c71('0xa')](),controller[_0x4c71('0xb')]);router['get'](_0x4c71('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x4c71('0x9')](_0x4c71('0xd'),auth['isAuthenticated'](),controller[_0x4c71('0xe')]);router[_0x4c71('0xf')]('/',auth[_0x4c71('0xa')](),interaction[_0x4c71('0x10')](_0x4c71('0x11'),_0x4c71('0x12')),controller[_0x4c71('0x13')]);router[_0x4c71('0xf')](_0x4c71('0x14'),controller[_0x4c71('0x15')]);router[_0x4c71('0x16')]('/:id',auth[_0x4c71('0xa')](),controller[_0x4c71('0x17')]);router[_0x4c71('0x16')](_0x4c71('0x18'),auth[_0x4c71('0xa')](),controller[_0x4c71('0x19')]);router[_0x4c71('0x16')](_0x4c71('0x1a'),auth[_0x4c71('0xa')](),controller[_0x4c71('0x1b')]);router[_0x4c71('0x1c')](_0x4c71('0xd'),auth[_0x4c71('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1b01=['get','/:id','show','post','whatsappmessage:create','create','/:id/status','status','update','put','accept','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappMessage.controller','/describe','isAuthenticated'];(function(_0x17c416,_0x68c5ff){var _0x21d1a4=function(_0x1d6b1b){while(--_0x1d6b1b){_0x17c416['push'](_0x17c416['shift']());}};_0x21d1a4(++_0x68c5ff);}(_0x1b01,0xc5));var _0x11b0=function(_0x26542e,_0x37d665){_0x26542e=_0x26542e-0x0;var _0x5c8f2c=_0x1b01[_0x26542e];return _0x5c8f2c;};'use strict';var multer=require('multer');var util=require(_0x11b0('0x0'));var path=require(_0x11b0('0x1'));var timeout=require(_0x11b0('0x2'));var express=require(_0x11b0('0x3'));var router=express[_0x11b0('0x4')]();var fs_extra=require(_0x11b0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x11b0('0x6'));var controller=require(_0x11b0('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x11b0('0x8'),auth[_0x11b0('0x9')](),controller['describe']);router[_0x11b0('0xa')](_0x11b0('0xb'),auth['isAuthenticated'](),controller[_0x11b0('0xc')]);router[_0x11b0('0xd')]('/',auth['isAuthenticated'](),interaction['tracked']('whatsapp',_0x11b0('0xe')),controller[_0x11b0('0xf')]);router[_0x11b0('0xd')](_0x11b0('0x10'),controller[_0x11b0('0x11')]);router['put'](_0x11b0('0xb'),auth['isAuthenticated'](),controller[_0x11b0('0x12')]);router[_0x11b0('0x13')]('/:id/accept',auth[_0x11b0('0x9')](),controller[_0x11b0('0x14')]);router['put']('/:id/reject',auth[_0x11b0('0x9')](),controller['reject']);router['delete'](_0x11b0('0xb'),auth[_0x11b0('0x9')](),controller[_0x11b0('0x15')]);module[_0x11b0('0x16')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 8c148c1..779ced1 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 _0x39f0=['medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39f0,0x1d1));var _0x039f=function(_0x4ba8d0,_0x57b866){_0x4ba8d0=_0x4ba8d0-0x0;var _0x3266c8=_0x39f0[_0x4ba8d0];return _0x3266c8;};'use strict';var Sequelize=require(_0x039f('0x0'));module[_0x039f('0x1')]={'body':{'type':Sequelize[_0x039f('0x2')](_0x039f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x039f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x039f('0x5')]('in','out'),'defaultValue':_0x039f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x039f('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x039f('0x8')]},'secret':{'type':Sequelize[_0x039f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x039f('0x7')]},'providerResponse':{'type':Sequelize[_0x039f('0x2')]}}; \ No newline at end of file +var _0xf582=['BOOLEAN','ENUM','out','STRING','DATE','TEXT','medium'];(function(_0x302de5,_0xf22d11){var _0x4cc7d5=function(_0x2638b0){while(--_0x2638b0){_0x302de5['push'](_0x302de5['shift']());}};_0x4cc7d5(++_0xf22d11);}(_0xf582,0x1c5));var _0x2f58=function(_0x27237c,_0x36f1d4){_0x27237c=_0x27237c-0x0;var _0x1f412e=_0xf582[_0x27237c];return _0x1f412e;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x2f58('0x0')](_0x2f58('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2f58('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2f58('0x3')]('in','out'),'defaultValue':_0x2f58('0x4'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x2f58('0x5')]},'readAt':{'type':Sequelize[_0x2f58('0x6')]},'secret':{'type':Sequelize[_0x2f58('0x2')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x2f58('0x5')]},'providerResponse':{'type':Sequelize[_0x2f58('0x0')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a367df2..5046210 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 _0xa9ea=['inspect','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','twilio','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','defaults','localhost','redis','./whatsappMessage.socket','jayson/promise','client','http','request','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappMessage,\x20%s,\x20%s','info','result','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','reject','destroy','stack','name','send','map','WhatsappMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','show','params','options','find','create','body','catch','update','describe','whatsapp-interactions','accept','whatsapp','read','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from'];(function(_0x13ce0c,_0x3f2a0d){var _0x4388fb=function(_0x27db4b){while(--_0x27db4b){_0x13ce0c['push'](_0x13ce0c['shift']());}};_0x4388fb(++_0x3f2a0d);}(_0xa9ea,0x11d));var _0xaa9e=function(_0x2bf1d6,_0x410efd){_0x2bf1d6=_0x2bf1d6-0x0;var _0x1be08a=_0xa9ea[_0x2bf1d6];return _0x1be08a;};'use strict';var emlformat=require(_0xaa9e('0x0'));var rimraf=require(_0xaa9e('0x1'));var zipdir=require(_0xaa9e('0x2'));var jsonpatch=require(_0xaa9e('0x3'));var rp=require(_0xaa9e('0x4'));var moment=require(_0xaa9e('0x5'));var BPromise=require(_0xaa9e('0x6'));var Mustache=require('mustache');var util=require(_0xaa9e('0x7'));var path=require(_0xaa9e('0x8'));var sox=require('sox');var csv=require(_0xaa9e('0x9'));var ejs=require(_0xaa9e('0xa'));var fs=require('fs');var fs_extra=require(_0xaa9e('0xb'));var _=require(_0xaa9e('0xc'));var squel=require(_0xaa9e('0xd'));var crypto=require('crypto');var jsforce=require(_0xaa9e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaa9e('0x9'));var querystring=require(_0xaa9e('0xf'));var Papa=require('papaparse');var Redis=require(_0xaa9e('0x10'));var authService=require(_0xaa9e('0x11'));var qs=require(_0xaa9e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa9e('0x13'));var logger=require(_0xaa9e('0x14'))(_0xaa9e('0x15'));var utils=require('../../config/utils');var config=require(_0xaa9e('0x16'));var licenseUtil=require(_0xaa9e('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xaa9e('0x18')](config['redis'],{'host':_0xaa9e('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xaa9e('0x1a')]));require(_0xaa9e('0x1b'))['register'](socket);var jayson=require(_0xaa9e('0x1c'));var client=jayson[_0xaa9e('0x1d')][_0xaa9e('0x1e')]({'port':0x232c});var client9002=jayson['client'][_0xaa9e('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x569e94,_0xf1dbcf,_0x5abaad,_0xe08489){return new BPromise(function(_0x3f8993,_0x15a551){var _0x21023f=_0xe08489||client;return _0x21023f[_0xaa9e('0x1f')](_0x569e94,_0x5abaad)[_0xaa9e('0x20')](function(_0x272a8b){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0xf1dbcf,_0xaa9e('0x21'));logger['debug'](_0xaa9e('0x22'),_0xf1dbcf,_0xaa9e('0x21'),JSON[_0xaa9e('0x23')](_0x272a8b));if(_0x272a8b[_0xaa9e('0x24')]){if(_0x272a8b[_0xaa9e('0x24')][_0xaa9e('0x25')]===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0xf1dbcf,_0x272a8b[_0xaa9e('0x24')][_0xaa9e('0x26')]);return _0x15a551(_0x272a8b[_0xaa9e('0x24')][_0xaa9e('0x26')]);}logger[_0xaa9e('0x24')](_0xaa9e('0x27'),_0xf1dbcf,_0x272a8b[_0xaa9e('0x24')][_0xaa9e('0x26')]);return _0x3f8993(_0x272a8b[_0xaa9e('0x24')][_0xaa9e('0x26')]);}else{logger[_0xaa9e('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0xf1dbcf,_0xaa9e('0x21'));_0x3f8993(_0x272a8b[_0xaa9e('0x29')]['message']);}})['catch'](function(_0x572611){logger[_0xaa9e('0x24')](_0xaa9e('0x27'),_0xf1dbcf,_0x572611);_0x15a551(_0x572611);});});}function respondWithStatusCode(_0x2a844f,_0x12081f){_0x12081f=_0x12081f||0xcc;return function(_0x3a09e2){if(_0x3a09e2){return _0x2a844f[_0xaa9e('0x2a')](_0x12081f);}return _0x2a844f[_0xaa9e('0x2b')](_0x12081f)[_0xaa9e('0x2c')]();};}function respondWithResult(_0xabddc6,_0x56ec9e){_0x56ec9e=_0x56ec9e||0xc8;return function(_0x50c092){if(_0x50c092){return _0xabddc6[_0xaa9e('0x2b')](_0x56ec9e)[_0xaa9e('0x2d')](_0x50c092);}};}function respondWithFilteredResult(_0x13f822,_0x1005c6){return function(_0x2b2734){if(_0x2b2734){var _0x52c090=typeof _0x1005c6[_0xaa9e('0x2e')]===_0xaa9e('0x2f')&&typeof _0x1005c6['limit']==='undefined';var _0x2ef292=_0x2b2734[_0xaa9e('0x30')];var _0x3829a1=_0x52c090?0x0:_0x1005c6[_0xaa9e('0x2e')];var _0x460ef0=_0x52c090?_0x2b2734['count']:_0x1005c6[_0xaa9e('0x2e')]+_0x1005c6['limit'];var _0x5a9163;if(_0x460ef0>=_0x2ef292){_0x460ef0=_0x2ef292;_0x5a9163=0xc8;}else{_0x5a9163=0xce;}_0x13f822[_0xaa9e('0x2b')](_0x5a9163);return _0x13f822[_0xaa9e('0x31')](_0xaa9e('0x32'),_0x3829a1+'-'+_0x460ef0+'/'+_0x2ef292)[_0xaa9e('0x2d')](_0x2b2734);}return null;};}function patchUpdates(_0x347208){return function(_0x16f77a){try{jsonpatch['apply'](_0x16f77a,_0x347208,!![]);}catch(_0x339540){return BPromise[_0xaa9e('0x33')](_0x339540);}return _0x16f77a['save']();};}function saveUpdates(_0x52c386,_0xa0aab8){return function(_0x437e27){if(_0x437e27){return _0x437e27['update'](_0x52c386)['then'](function(_0x465d97){return _0x465d97;});}return null;};}function removeEntity(_0x36f5ea,_0x491f17){return function(_0x9e4468){if(_0x9e4468){return _0x9e4468[_0xaa9e('0x34')]()['then'](function(){_0x36f5ea[_0xaa9e('0x2b')](0xcc)[_0xaa9e('0x2c')]();});}};}function handleEntityNotFound(_0x256a52,_0x186e8a){return function(_0x392a2d){if(!_0x392a2d){_0x256a52['sendStatus'](0x194);}return _0x392a2d;};}function handleError(_0x54a2f0,_0x35b408){_0x35b408=_0x35b408||0x1f4;return function(_0x37eac1){logger[_0xaa9e('0x24')](_0x37eac1[_0xaa9e('0x35')]);if(_0x37eac1[_0xaa9e('0x36')]){delete _0x37eac1[_0xaa9e('0x36')];}_0x54a2f0['status'](_0x35b408)[_0xaa9e('0x37')](_0x37eac1);};}exports['index']=function(_0xd22e51,_0x1d0d0a){var _0x51fe70={},_0x438f1d={},_0x4fead6={'count':0x0,'rows':[]};var _0x318e68=_[_0xaa9e('0x38')](db[_0xaa9e('0x39')][_0xaa9e('0x3a')],function(_0x3c3117){return{'name':_0x3c3117['fieldName'],'type':_0x3c3117[_0xaa9e('0x3b')][_0xaa9e('0x3c')]};});_0x438f1d[_0xaa9e('0x3d')]=_['map'](_0x318e68,_0xaa9e('0x36'));_0x438f1d['query']=_[_0xaa9e('0x3e')](_0xd22e51[_0xaa9e('0x3f')]);_0x438f1d[_0xaa9e('0x40')]=_[_0xaa9e('0x41')](_0x438f1d[_0xaa9e('0x3d')],_0x438f1d[_0xaa9e('0x3f')]);_0x51fe70[_0xaa9e('0x42')]=_[_0xaa9e('0x41')](_0x438f1d[_0xaa9e('0x3d')],qs[_0xaa9e('0x43')](_0xd22e51[_0xaa9e('0x3f')][_0xaa9e('0x43')]));_0x51fe70[_0xaa9e('0x42')]=_0x51fe70[_0xaa9e('0x42')][_0xaa9e('0x44')]?_0x51fe70[_0xaa9e('0x42')]:_0x438f1d[_0xaa9e('0x3d')];if(!_0xd22e51[_0xaa9e('0x3f')][_0xaa9e('0x45')](_0xaa9e('0x46'))){_0x51fe70[_0xaa9e('0x47')]=qs['limit'](_0xd22e51['query'][_0xaa9e('0x47')]);_0x51fe70[_0xaa9e('0x2e')]=qs[_0xaa9e('0x2e')](_0xd22e51[_0xaa9e('0x3f')][_0xaa9e('0x2e')]);}_0x51fe70[_0xaa9e('0x48')]=qs[_0xaa9e('0x49')](_0xd22e51[_0xaa9e('0x3f')][_0xaa9e('0x49')]);_0x51fe70[_0xaa9e('0x4a')]=qs[_0xaa9e('0x40')](_[_0xaa9e('0x4b')](_0xd22e51[_0xaa9e('0x3f')],_0x438f1d[_0xaa9e('0x40')]),_0x318e68);if(_0xd22e51[_0xaa9e('0x3f')]['filter']){_0x51fe70['where']=_[_0xaa9e('0x4c')](_0x51fe70[_0xaa9e('0x4a')],{'$or':_['map'](_0x318e68,function(_0x4a85a6){if(_0x4a85a6[_0xaa9e('0x3b')]!=='VIRTUAL'){var _0xd8a154={};_0xd8a154[_0x4a85a6[_0xaa9e('0x36')]]={'$like':'%'+_0xd22e51['query'][_0xaa9e('0x4d')]+'%'};return _0xd8a154;}})});}_0x51fe70=_['merge']({},_0x51fe70,_0xd22e51['options']);var _0x4e50f6={'where':_0x51fe70[_0xaa9e('0x4a')]};return db['WhatsappMessage'][_0xaa9e('0x30')](_0x4e50f6)[_0xaa9e('0x20')](function(_0x4728ca){_0x4fead6[_0xaa9e('0x30')]=_0x4728ca;if(_0xd22e51[_0xaa9e('0x3f')][_0xaa9e('0x4e')]){_0x51fe70[_0xaa9e('0x4f')]=[{'all':!![]}];}return db[_0xaa9e('0x39')][_0xaa9e('0x50')](_0x51fe70);})['then'](function(_0x34e7c2){_0x4fead6[_0xaa9e('0x51')]=_0x34e7c2;return _0x4fead6;})['then'](respondWithFilteredResult(_0x1d0d0a,_0x51fe70))['catch'](handleError(_0x1d0d0a,null));};exports[_0xaa9e('0x52')]=function(_0x729ea6,_0xd972c4){var _0x535155={'raw':!![],'where':{'id':_0x729ea6[_0xaa9e('0x53')]['id']}},_0x2ddcac={};_0x2ddcac[_0xaa9e('0x3d')]=_[_0xaa9e('0x3e')](db[_0xaa9e('0x39')][_0xaa9e('0x3a')]);_0x2ddcac[_0xaa9e('0x3f')]=_[_0xaa9e('0x3e')](_0x729ea6[_0xaa9e('0x3f')]);_0x2ddcac[_0xaa9e('0x40')]=_[_0xaa9e('0x41')](_0x2ddcac['model'],_0x2ddcac[_0xaa9e('0x3f')]);_0x535155[_0xaa9e('0x42')]=_['intersection'](_0x2ddcac[_0xaa9e('0x3d')],qs[_0xaa9e('0x43')](_0x729ea6['query']['fields']));_0x535155[_0xaa9e('0x42')]=_0x535155[_0xaa9e('0x42')][_0xaa9e('0x44')]?_0x535155[_0xaa9e('0x42')]:_0x2ddcac[_0xaa9e('0x3d')];if(_0x729ea6['query']['includeAll']){_0x535155[_0xaa9e('0x4f')]=[{'all':!![]}];}_0x535155=_[_0xaa9e('0x4c')]({},_0x535155,_0x729ea6[_0xaa9e('0x54')]);return db['WhatsappMessage'][_0xaa9e('0x55')](_0x535155)[_0xaa9e('0x20')](handleEntityNotFound(_0xd972c4,null))['then'](respondWithResult(_0xd972c4,null))['catch'](handleError(_0xd972c4,null));};exports['create']=function(_0x319bd6,_0x2511cb){return db[_0xaa9e('0x39')][_0xaa9e('0x56')](_0x319bd6[_0xaa9e('0x57')],{})[_0xaa9e('0x20')](respondWithResult(_0x2511cb,0xc9))[_0xaa9e('0x58')](handleError(_0x2511cb,null));};exports[_0xaa9e('0x59')]=function(_0x869317,_0x4cd16f){if(_0x869317[_0xaa9e('0x57')]['id']){delete _0x869317[_0xaa9e('0x57')]['id'];}return db[_0xaa9e('0x39')]['find']({'where':{'id':_0x869317[_0xaa9e('0x53')]['id']}})[_0xaa9e('0x20')](handleEntityNotFound(_0x4cd16f,null))['then'](saveUpdates(_0x869317[_0xaa9e('0x57')],null))[_0xaa9e('0x20')](respondWithResult(_0x4cd16f,null))[_0xaa9e('0x58')](handleError(_0x4cd16f,null));};exports['destroy']=function(_0x10be17,_0x3cb457){return db[_0xaa9e('0x39')][_0xaa9e('0x55')]({'where':{'id':_0x10be17[_0xaa9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x3cb457,null))['then'](removeEntity(_0x3cb457,null))[_0xaa9e('0x58')](handleError(_0x3cb457,null));};exports[_0xaa9e('0x5a')]=function(_0x9d48c8,_0x11cab9){return db[_0xaa9e('0x39')][_0xaa9e('0x5a')]()[_0xaa9e('0x20')](respondWithResult(_0x11cab9,null))[_0xaa9e('0x58')](handleError(_0x11cab9,null));};var interaction_log=require(_0xaa9e('0x14'))(_0xaa9e('0x5b'));exports[_0xaa9e('0x5c')]=function(_0x28d57a,_0x550631,_0x4d54ad){var _0x31e02e={'agent':{},'channel':_0xaa9e('0x5d')};if(_0x28d57a[_0xaa9e('0x57')]['id']){delete _0x28d57a[_0xaa9e('0x57')]['id'];}_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x5e')]=!![];_0x28d57a[_0xaa9e('0x57')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x5f')]=_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x5f')]||_0x28d57a[_0xaa9e('0x60')]['id'];_0x31e02e[_0xaa9e('0x61')]['id']=_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x28d57a[_0xaa9e('0x53')]['id'],'UserId':null}})[_0xaa9e('0x20')](handleEntityNotFound(_0x550631,null))[_0xaa9e('0x20')](saveUpdates(_0x28d57a[_0xaa9e('0x57')],null))[_0xaa9e('0x20')](function(_0x113248){if(_0x113248){_0x31e02e[_0xaa9e('0x26')]=_0x113248[_0xaa9e('0x62')]({'plain':!![]});return db[_0xaa9e('0x63')][_0xaa9e('0x55')]({'where':{'id':_0x113248[_0xaa9e('0x64')]}});}return null;})[_0xaa9e('0x20')](handleEntityNotFound(_0x550631,null))['then'](function(_0x238790){if(_0x238790){return _0x238790[_0xaa9e('0x59')]({'UserId':_0x28d57a['body'][_0xaa9e('0x5f')],'read1stAt':_[_0xaa9e('0x65')](_0x238790[_0xaa9e('0x66')])?moment()[_0xaa9e('0x67')](_0xaa9e('0x68')):undefined});}return null;})[_0xaa9e('0x20')](function(_0x414dd9){if(_0x414dd9){_0x31e02e[_0xaa9e('0x69')]=_0x414dd9[_0xaa9e('0x62')]({'plain':!![]});interaction_log['info'](_0xaa9e('0x6a'),_0x28d57a[_0xaa9e('0x60')]['id'],_0x28d57a[_0xaa9e('0x60')]['name'],_0x28d57a[_0xaa9e('0x60')]['role'],_0x31e02e[_0xaa9e('0x69')]['id'],_0x28d57a[_0xaa9e('0x57')]?JSON[_0xaa9e('0x23')](_0x28d57a[_0xaa9e('0x57')]):_0xaa9e('0x6b'));return respondWithRpcPromise(_0xaa9e('0x6c'),_0xaa9e('0x6d'),_0x31e02e);}return null;})[_0xaa9e('0x20')](function(_0x4f5f4e){var _0x1a187d=_0xaa9e('0x6e')+_0x4f5f4e[_0xaa9e('0x26')][_0xaa9e('0x6f')];return db['sequelize'][_0xaa9e('0x3f')](_0x1a187d,{'type':db[_0xaa9e('0x70')][_0xaa9e('0x71')][_0xaa9e('0x72')],'raw':!![]})[_0xaa9e('0x20')](function(_0x3ba60c){return _0x3ba60c;});})['then'](function(_0x1a092b){if(_0x1a092b){_0x31e02e['message'][_0xaa9e('0x73')]=_0x1a092b[0x0];if(!_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x5f')])return;return db[_0xaa9e('0x74')][_0xaa9e('0x55')]({'where':{'id':_0x28d57a['body'][_0xaa9e('0x5f')],'role':_0xaa9e('0x61')},'attributes':['id','name',_0xaa9e('0x75'),_0xaa9e('0x76'),_0xaa9e('0x77')],'raw':!![]});}return null;})[_0xaa9e('0x20')](function(_0x297b88){if(!_0x297b88)return null;_0x31e02e[_0xaa9e('0x26')][_0xaa9e('0x61')]=_0x297b88;return _0x31e02e;})[_0xaa9e('0x20')](function(_0x3267f2){if(_0x3267f2){if(_0x28d57a[_0xaa9e('0x57')][_0xaa9e('0x78')]){_0x31e02e['message'][_0xaa9e('0x79')]=util[_0xaa9e('0x67')](_0xaa9e('0x7a'),_0x28d57a['user'][_0xaa9e('0x36')]);_0x31e02e[_0xaa9e('0x26')][_0xaa9e('0x7b')]=_0x31e02e[_0xaa9e('0x7b')];_0x31e02e['message'][_0xaa9e('0x7c')]=_0x31e02e[_0xaa9e('0x7b')];_0x31e02e[_0xaa9e('0x26')][_0xaa9e('0x7d')]=_0xaa9e('0x5c');return respondWithRpcPromise(_0xaa9e('0x7e'),_0xaa9e('0x7e'),{'event':_0xaa9e('0x7f'),'message':_0x31e02e[_0xaa9e('0x26')]},client9002)[_0xaa9e('0x20')](function(){return _0x31e02e;});}return _0x31e02e;}return null;})[_0xaa9e('0x20')](respondWithResult(_0x550631,null))[_0xaa9e('0x58')](handleError(_0x550631,null));};var interaction_log=require(_0xaa9e('0x14'))(_0xaa9e('0x5b'));exports['reject']=function(_0x3b68f4,_0x1296ad,_0x325ebb){var _0x4f85b1={'agent':{},'channel':'whatsapp'};if(_0x3b68f4[_0xaa9e('0x57')]['id']){delete _0x3b68f4[_0xaa9e('0x57')]['id'];}_0x3b68f4[_0xaa9e('0x57')]['UserId']=_0x3b68f4[_0xaa9e('0x57')][_0xaa9e('0x5f')]||_0x3b68f4[_0xaa9e('0x60')]['id'];_0x4f85b1[_0xaa9e('0x61')]['id']=_0x3b68f4[_0xaa9e('0x57')][_0xaa9e('0x5f')];return db['WhatsappMessage']['find']({'where':{'id':_0x3b68f4[_0xaa9e('0x53')]['id'],'UserId':null}})[_0xaa9e('0x20')](handleEntityNotFound(_0x1296ad,null))[_0xaa9e('0x20')](function(_0x103ddc){if(_0x103ddc){_0x4f85b1[_0xaa9e('0x26')]=_0x103ddc['get']({'plain':!![]});return db[_0xaa9e('0x63')][_0xaa9e('0x55')]({'where':{'id':_0x103ddc[_0xaa9e('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x1296ad,null))[_0xaa9e('0x20')](function(_0x5cb410){if(_0x5cb410){_0x4f85b1[_0xaa9e('0x69')]=_0x5cb410[_0xaa9e('0x62')]({'plain':!![]});interaction_log[_0xaa9e('0x28')](_0xaa9e('0x80'),_0x3b68f4[_0xaa9e('0x60')]['id'],_0x3b68f4[_0xaa9e('0x60')][_0xaa9e('0x36')],_0x3b68f4[_0xaa9e('0x60')]['role'],_0x4f85b1[_0xaa9e('0x69')]['id'],_0x3b68f4['body']?JSON[_0xaa9e('0x23')](_0x3b68f4[_0xaa9e('0x57')]):_0xaa9e('0x6b'));return respondWithRpcPromise(_0xaa9e('0x81'),_0xaa9e('0x82'),_0x4f85b1);}return null;})['then'](function(_0x54b888){var _0xf75305='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54b888[_0xaa9e('0x26')][_0xaa9e('0x6f')];return db['sequelize'][_0xaa9e('0x3f')](_0xf75305,{'type':db['Sequelize']['QueryTypes'][_0xaa9e('0x72')],'raw':!![]})[_0xaa9e('0x20')](function(_0x2df63b){return _0x2df63b;});})[_0xaa9e('0x20')](function(_0x11a7cb){if(_0x11a7cb){_0x4f85b1['message'][_0xaa9e('0x73')]=_0x11a7cb[0x0];if(!_0x3b68f4['body']['UserId'])return;return db[_0xaa9e('0x74')][_0xaa9e('0x55')]({'where':{'id':_0x3b68f4[_0xaa9e('0x57')][_0xaa9e('0x5f')],'role':_0xaa9e('0x61')},'attributes':['id','name','fullname',_0xaa9e('0x76'),_0xaa9e('0x77')],'raw':!![]});}return null;})[_0xaa9e('0x20')](function(_0x15865b){if(!_0x15865b)return null;_0x4f85b1['message'][_0xaa9e('0x61')]=_0x15865b;return _0x4f85b1;})[_0xaa9e('0x20')](function(_0x273265){if(_0x273265){_0x273265[_0xaa9e('0x26')][_0xaa9e('0x79')]=util['format']('SIP/%s',_0x3b68f4[_0xaa9e('0x60')]['name']);_0x273265[_0xaa9e('0x26')][_0xaa9e('0x7b')]=_0x4f85b1[_0xaa9e('0x7b')];_0x273265['message'][_0xaa9e('0x7c')]=_0x4f85b1['channel'];_0x273265[_0xaa9e('0x26')]['event']=_0xaa9e('0x33');respondWithRpcPromise(_0xaa9e('0x7e'),_0xaa9e('0x7e'),{'event':_0xaa9e('0x83'),'message':_0x273265[_0xaa9e('0x26')]},client9002);return _0x4f85b1;}return null;})[_0xaa9e('0x20')](respondWithResult(_0x1296ad,null))[_0xaa9e('0x58')](handleError(_0x1296ad,null));};exports['status']=function(_0x4e0dd3,_0x46c2e5,_0x25dd11){if(_0x4e0dd3[_0xaa9e('0x57')]['id']){delete _0x4e0dd3['body']['id'];}var _0x4835dd;return db[_0xaa9e('0x39')][_0xaa9e('0x55')]({'where':{'id':_0x4e0dd3[_0xaa9e('0x53')]['id']}})['then'](handleEntityNotFound(_0x46c2e5,null))['then'](function(_0x187b35){if(_0x187b35){_0x4835dd=_0x187b35;return db[_0xaa9e('0x84')][_0xaa9e('0x55')]({'where':{'id':_0x187b35['WhatsappAccountId']}});}})[_0xaa9e('0x20')](handleEntityNotFound(_0x46c2e5,null))[_0xaa9e('0x20')](function(_0x51e0e7){if(_0x51e0e7){logger['debug'](_0xaa9e('0x85'),_0xaa9e('0x2b'),_0xaa9e('0x86'),_0x51e0e7[_0xaa9e('0x3b')],util[_0xaa9e('0x87')](_0x4e0dd3[_0xaa9e('0x57')],{'showHidden':![],'depth':null}));switch(_0x51e0e7[_0xaa9e('0x3b')]){case'twilio':if(_0x4e0dd3['body']['MessageSid']&&_0x4e0dd3['body']['MessageSid']===_0x4835dd[_0xaa9e('0x88')]&&_0x4e0dd3[_0xaa9e('0x57')][_0xaa9e('0x89')]&&_0x4e0dd3[_0xaa9e('0x57')]['MessageStatus']==='read'){return _0x4835dd['update']({'read':!![]});}else{logger[_0xaa9e('0x24')](_0xaa9e('0x8a'),_0xaa9e('0x2b'),_0xaa9e('0x8b'),util[_0xaa9e('0x87')](_0x4e0dd3[_0xaa9e('0x57')],{'showHidden':![],'depth':null}));}break;}return _0x4835dd;}})[_0xaa9e('0x20')](respondWithResult(_0x46c2e5,null))[_0xaa9e('0x58')](handleError(_0x46c2e5,null));}; \ No newline at end of file +var _0x685e=['received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','offset','limit','undefined','count','json','apply','reject','save','update','destroy','end','stack','name','index','map','WhatsappMessage','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','whatsapp-interactions','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','manual','channel','motionChannel','event','accept','EventManager','acceptmessage','WhatsappInteraction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','Sequelize','email','interface','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s'];(function(_0x2fa164,_0x489302){var _0x5e9ae5=function(_0x37aa75){while(--_0x37aa75){_0x2fa164['push'](_0x2fa164['shift']());}};_0x5e9ae5(++_0x489302);}(_0x685e,0x93));var _0xe685=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x685e[_0x3f6e26];return _0x474345;};'use strict';var emlformat=require(_0xe685('0x0'));var rimraf=require(_0xe685('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe685('0x2'));var moment=require(_0xe685('0x3'));var BPromise=require(_0xe685('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe685('0x5'));var sox=require(_0xe685('0x6'));var csv=require(_0xe685('0x7'));var ejs=require(_0xe685('0x8'));var fs=require('fs');var fs_extra=require(_0xe685('0x9'));var _=require(_0xe685('0xa'));var squel=require(_0xe685('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe685('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe685('0xd'));var Papa=require(_0xe685('0xe'));var Redis=require(_0xe685('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe685('0x10'));var as=require(_0xe685('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe685('0x12'))(_0xe685('0x13'));var utils=require(_0xe685('0x14'));var config=require(_0xe685('0x15'));var licenseUtil=require(_0xe685('0x16'));var db=require(_0xe685('0x17'))['db'];config[_0xe685('0x18')]=_[_0xe685('0x19')](config[_0xe685('0x18')],{'host':_0xe685('0x1a'),'port':0x18eb});var socket=require(_0xe685('0x1b'))(new Redis(config[_0xe685('0x18')]));require(_0xe685('0x1c'))[_0xe685('0x1d')](socket);var jayson=require(_0xe685('0x1e'));var client=jayson[_0xe685('0x1f')][_0xe685('0x20')]({'port':0x232c});var client9002=jayson[_0xe685('0x1f')][_0xe685('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1134c9,_0x70bfe0,_0x398caa,_0x37a3e2){return new BPromise(function(_0x58d388,_0x54b7c7){var _0x302242=_0x37a3e2||client;return _0x302242[_0xe685('0x21')](_0x1134c9,_0x398caa)[_0xe685('0x22')](function(_0x24550b){logger[_0xe685('0x23')](_0xe685('0x24'),_0x70bfe0,_0xe685('0x25'));logger[_0xe685('0x26')](_0xe685('0x27'),_0x70bfe0,_0xe685('0x25'),JSON[_0xe685('0x28')](_0x24550b));if(_0x24550b[_0xe685('0x29')]){if(_0x24550b[_0xe685('0x29')][_0xe685('0x2a')]===0x1f4){logger['error'](_0xe685('0x24'),_0x70bfe0,_0x24550b[_0xe685('0x29')][_0xe685('0x2b')]);return _0x54b7c7(_0x24550b[_0xe685('0x29')][_0xe685('0x2b')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x70bfe0,_0x24550b[_0xe685('0x29')]['message']);return _0x58d388(_0x24550b[_0xe685('0x29')][_0xe685('0x2b')]);}else{logger['info'](_0xe685('0x24'),_0x70bfe0,'request\x20sent');_0x58d388(_0x24550b['result'][_0xe685('0x2b')]);}})['catch'](function(_0x38428){logger[_0xe685('0x29')](_0xe685('0x24'),_0x70bfe0,_0x38428);_0x54b7c7(_0x38428);});});}function respondWithStatusCode(_0x162d5d,_0x103b2f){_0x103b2f=_0x103b2f||0xcc;return function(_0x4d3ae7){if(_0x4d3ae7){return _0x162d5d[_0xe685('0x2c')](_0x103b2f);}return _0x162d5d[_0xe685('0x2d')](_0x103b2f)['end']();};}function respondWithResult(_0x6f3b55,_0x537329){_0x537329=_0x537329||0xc8;return function(_0x2652f3){if(_0x2652f3){return _0x6f3b55[_0xe685('0x2d')](_0x537329)['json'](_0x2652f3);}};}function respondWithFilteredResult(_0x252592,_0x2524d3){return function(_0x161f88){if(_0x161f88){var _0x3813ba=typeof _0x2524d3[_0xe685('0x2e')]==='undefined'&&typeof _0x2524d3[_0xe685('0x2f')]===_0xe685('0x30');var _0x1dbcd6=_0x161f88[_0xe685('0x31')];var _0x58429f=_0x3813ba?0x0:_0x2524d3[_0xe685('0x2e')];var _0x4ce5a4=_0x3813ba?_0x161f88[_0xe685('0x31')]:_0x2524d3['offset']+_0x2524d3[_0xe685('0x2f')];var _0x116dd1;if(_0x4ce5a4>=_0x1dbcd6){_0x4ce5a4=_0x1dbcd6;_0x116dd1=0xc8;}else{_0x116dd1=0xce;}_0x252592[_0xe685('0x2d')](_0x116dd1);return _0x252592['set']('Content-Range',_0x58429f+'-'+_0x4ce5a4+'/'+_0x1dbcd6)[_0xe685('0x32')](_0x161f88);}return null;};}function patchUpdates(_0x279e40){return function(_0xe1d6b){try{jsonpatch[_0xe685('0x33')](_0xe1d6b,_0x279e40,!![]);}catch(_0x4469b1){return BPromise[_0xe685('0x34')](_0x4469b1);}return _0xe1d6b[_0xe685('0x35')]();};}function saveUpdates(_0xe473b8,_0x416d3a){return function(_0x1f8f90){if(_0x1f8f90){return _0x1f8f90[_0xe685('0x36')](_0xe473b8)[_0xe685('0x22')](function(_0x2216be){return _0x2216be;});}return null;};}function removeEntity(_0x49c811,_0x31806c){return function(_0x4d6dbb){if(_0x4d6dbb){return _0x4d6dbb[_0xe685('0x37')]()[_0xe685('0x22')](function(){_0x49c811[_0xe685('0x2d')](0xcc)[_0xe685('0x38')]();});}};}function handleEntityNotFound(_0x456f96,_0x41abf2){return function(_0x13da4f){if(!_0x13da4f){_0x456f96[_0xe685('0x2c')](0x194);}return _0x13da4f;};}function handleError(_0x4ca128,_0x4fdfff){_0x4fdfff=_0x4fdfff||0x1f4;return function(_0x5b1266){logger['error'](_0x5b1266[_0xe685('0x39')]);if(_0x5b1266[_0xe685('0x3a')]){delete _0x5b1266[_0xe685('0x3a')];}_0x4ca128['status'](_0x4fdfff)['send'](_0x5b1266);};}exports[_0xe685('0x3b')]=function(_0x4deee1,_0x2d398a){var _0x29baa1={},_0x485d8={},_0x4e744a={'count':0x0,'rows':[]};var _0x10d0f8=_[_0xe685('0x3c')](db[_0xe685('0x3d')]['rawAttributes'],function(_0x2a26a7){return{'name':_0x2a26a7[_0xe685('0x3e')],'type':_0x2a26a7['type'][_0xe685('0x3f')]};});_0x485d8[_0xe685('0x40')]=_['map'](_0x10d0f8,_0xe685('0x3a'));_0x485d8[_0xe685('0x41')]=_[_0xe685('0x42')](_0x4deee1[_0xe685('0x41')]);_0x485d8[_0xe685('0x43')]=_[_0xe685('0x44')](_0x485d8[_0xe685('0x40')],_0x485d8['query']);_0x29baa1[_0xe685('0x45')]=_[_0xe685('0x44')](_0x485d8[_0xe685('0x40')],qs[_0xe685('0x46')](_0x4deee1[_0xe685('0x41')][_0xe685('0x46')]));_0x29baa1[_0xe685('0x45')]=_0x29baa1[_0xe685('0x45')][_0xe685('0x47')]?_0x29baa1['attributes']:_0x485d8['model'];if(!_0x4deee1['query']['hasOwnProperty'](_0xe685('0x48'))){_0x29baa1[_0xe685('0x2f')]=qs['limit'](_0x4deee1[_0xe685('0x41')]['limit']);_0x29baa1[_0xe685('0x2e')]=qs[_0xe685('0x2e')](_0x4deee1[_0xe685('0x41')][_0xe685('0x2e')]);}_0x29baa1[_0xe685('0x49')]=qs['sort'](_0x4deee1[_0xe685('0x41')]['sort']);_0x29baa1[_0xe685('0x4a')]=qs[_0xe685('0x43')](_['pick'](_0x4deee1[_0xe685('0x41')],_0x485d8[_0xe685('0x43')]),_0x10d0f8);if(_0x4deee1[_0xe685('0x41')][_0xe685('0x4b')]){_0x29baa1[_0xe685('0x4a')]=_['merge'](_0x29baa1['where'],{'$or':_[_0xe685('0x3c')](_0x10d0f8,function(_0x49af99){if(_0x49af99[_0xe685('0x4c')]!==_0xe685('0x4d')){var _0x4249db={};_0x4249db[_0x49af99['name']]={'$like':'%'+_0x4deee1[_0xe685('0x41')][_0xe685('0x4b')]+'%'};return _0x4249db;}})});}_0x29baa1=_[_0xe685('0x4e')]({},_0x29baa1,_0x4deee1[_0xe685('0x4f')]);var _0x550c56={'where':_0x29baa1[_0xe685('0x4a')]};return db['WhatsappMessage'][_0xe685('0x31')](_0x550c56)[_0xe685('0x22')](function(_0x368933){_0x4e744a[_0xe685('0x31')]=_0x368933;if(_0x4deee1['query'][_0xe685('0x50')]){_0x29baa1[_0xe685('0x51')]=[{'all':!![]}];}return db[_0xe685('0x3d')][_0xe685('0x52')](_0x29baa1);})['then'](function(_0x231556){_0x4e744a['rows']=_0x231556;return _0x4e744a;})['then'](respondWithFilteredResult(_0x2d398a,_0x29baa1))[_0xe685('0x53')](handleError(_0x2d398a,null));};exports[_0xe685('0x54')]=function(_0x39348e,_0x1f914f){var _0x117c43={'raw':!![],'where':{'id':_0x39348e[_0xe685('0x55')]['id']}},_0x4e091f={};_0x4e091f['model']=_[_0xe685('0x42')](db[_0xe685('0x3d')][_0xe685('0x56')]);_0x4e091f['query']=_['keys'](_0x39348e['query']);_0x4e091f[_0xe685('0x43')]=_[_0xe685('0x44')](_0x4e091f[_0xe685('0x40')],_0x4e091f[_0xe685('0x41')]);_0x117c43['attributes']=_[_0xe685('0x44')](_0x4e091f[_0xe685('0x40')],qs[_0xe685('0x46')](_0x39348e[_0xe685('0x41')]['fields']));_0x117c43[_0xe685('0x45')]=_0x117c43[_0xe685('0x45')][_0xe685('0x47')]?_0x117c43[_0xe685('0x45')]:_0x4e091f[_0xe685('0x40')];if(_0x39348e['query'][_0xe685('0x50')]){_0x117c43[_0xe685('0x51')]=[{'all':!![]}];}_0x117c43=_[_0xe685('0x4e')]({},_0x117c43,_0x39348e[_0xe685('0x4f')]);return db[_0xe685('0x3d')]['find'](_0x117c43)[_0xe685('0x22')](handleEntityNotFound(_0x1f914f,null))['then'](respondWithResult(_0x1f914f,null))['catch'](handleError(_0x1f914f,null));};exports[_0xe685('0x57')]=function(_0x2b718a,_0x56585d){return db['WhatsappMessage'][_0xe685('0x57')](_0x2b718a[_0xe685('0x58')],{})[_0xe685('0x22')](respondWithResult(_0x56585d,0xc9))[_0xe685('0x53')](handleError(_0x56585d,null));};exports[_0xe685('0x36')]=function(_0x38bb54,_0x38ee36){if(_0x38bb54[_0xe685('0x58')]['id']){delete _0x38bb54['body']['id'];}return db[_0xe685('0x3d')][_0xe685('0x59')]({'where':{'id':_0x38bb54[_0xe685('0x55')]['id']}})[_0xe685('0x22')](handleEntityNotFound(_0x38ee36,null))[_0xe685('0x22')](saveUpdates(_0x38bb54[_0xe685('0x58')],null))[_0xe685('0x22')](respondWithResult(_0x38ee36,null))[_0xe685('0x53')](handleError(_0x38ee36,null));};exports[_0xe685('0x37')]=function(_0x3c2c41,_0x6ecf81){return db[_0xe685('0x3d')][_0xe685('0x59')]({'where':{'id':_0x3c2c41['params']['id']}})[_0xe685('0x22')](handleEntityNotFound(_0x6ecf81,null))[_0xe685('0x22')](removeEntity(_0x6ecf81,null))[_0xe685('0x53')](handleError(_0x6ecf81,null));};exports[_0xe685('0x5a')]=function(_0x413092,_0x48774c){return db['WhatsappMessage'][_0xe685('0x5a')]()[_0xe685('0x22')](respondWithResult(_0x48774c,null))[_0xe685('0x53')](handleError(_0x48774c,null));};var interaction_log=require(_0xe685('0x12'))(_0xe685('0x5b'));exports['accept']=function(_0x368b58,_0x1c36f5,_0x3b3286){var _0xda37dd={'agent':{},'channel':_0xe685('0x5c')};if(_0x368b58[_0xe685('0x58')]['id']){delete _0x368b58[_0xe685('0x58')]['id'];}_0x368b58[_0xe685('0x58')]['read']=!![];_0x368b58[_0xe685('0x58')][_0xe685('0x5d')]=moment()[_0xe685('0x5e')](_0xe685('0x5f'));_0x368b58[_0xe685('0x58')][_0xe685('0x60')]=_0x368b58[_0xe685('0x58')]['UserId']||_0x368b58[_0xe685('0x61')]['id'];_0xda37dd['agent']['id']=_0x368b58[_0xe685('0x58')][_0xe685('0x60')];return db['WhatsappMessage'][_0xe685('0x59')]({'where':{'id':_0x368b58['params']['id'],'UserId':null}})[_0xe685('0x22')](handleEntityNotFound(_0x1c36f5,null))['then'](saveUpdates(_0x368b58[_0xe685('0x58')],null))[_0xe685('0x22')](function(_0x30b1b5){if(_0x30b1b5){_0xda37dd[_0xe685('0x2b')]=_0x30b1b5[_0xe685('0x62')]({'plain':!![]});return db['WhatsappInteraction'][_0xe685('0x59')]({'where':{'id':_0x30b1b5[_0xe685('0x63')]}});}return null;})[_0xe685('0x22')](handleEntityNotFound(_0x1c36f5,null))[_0xe685('0x22')](function(_0x176ea1){if(_0x176ea1){return _0x176ea1[_0xe685('0x36')]({'UserId':_0x368b58[_0xe685('0x58')][_0xe685('0x60')],'read1stAt':_[_0xe685('0x64')](_0x176ea1[_0xe685('0x65')])?moment()[_0xe685('0x5e')](_0xe685('0x5f')):undefined});}return null;})['then'](function(_0x1c6dea){if(_0x1c6dea){_0xda37dd[_0xe685('0x66')]=_0x1c6dea[_0xe685('0x62')]({'plain':!![]});interaction_log[_0xe685('0x23')](_0xe685('0x67'),_0x368b58[_0xe685('0x61')]['id'],_0x368b58['user']['name'],_0x368b58[_0xe685('0x61')][_0xe685('0x68')],_0xda37dd[_0xe685('0x66')]['id'],_0x368b58[_0xe685('0x58')]?JSON[_0xe685('0x28')](_0x368b58['body']):_0xe685('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0xda37dd);}return null;})[_0xe685('0x22')](function(_0x46610e){var _0x161039=_0xe685('0x6a')+_0x46610e['message']['ContactId'];return db[_0xe685('0x6b')][_0xe685('0x41')](_0x161039,{'type':db['Sequelize'][_0xe685('0x6c')][_0xe685('0x6d')],'raw':!![]})[_0xe685('0x22')](function(_0x286283){return _0x286283;});})[_0xe685('0x22')](function(_0x2e24be){if(_0x2e24be){_0xda37dd['message'][_0xe685('0x6e')]=_0x2e24be[0x0];if(!_0x368b58[_0xe685('0x58')][_0xe685('0x60')])return;return db[_0xe685('0x6f')]['find']({'where':{'id':_0x368b58[_0xe685('0x58')][_0xe685('0x60')],'role':_0xe685('0x70')},'attributes':['id',_0xe685('0x3a'),_0xe685('0x71'),'email',_0xe685('0x72')],'raw':!![]});}return null;})[_0xe685('0x22')](function(_0x219f73){if(!_0x219f73)return null;_0xda37dd[_0xe685('0x2b')]['agent']=_0x219f73;return _0xda37dd;})[_0xe685('0x22')](function(_0x337c0d){if(_0x337c0d){if(_0x368b58[_0xe685('0x58')][_0xe685('0x73')]){_0xda37dd[_0xe685('0x2b')]['interface']=util[_0xe685('0x5e')]('SIP/%s',_0x368b58[_0xe685('0x61')][_0xe685('0x3a')]);_0xda37dd[_0xe685('0x2b')][_0xe685('0x74')]=_0xda37dd[_0xe685('0x74')];_0xda37dd['message'][_0xe685('0x75')]=_0xda37dd[_0xe685('0x74')];_0xda37dd[_0xe685('0x2b')][_0xe685('0x76')]=_0xe685('0x77');return respondWithRpcPromise(_0xe685('0x78'),_0xe685('0x78'),{'event':_0xe685('0x79'),'message':_0xda37dd[_0xe685('0x2b')]},client9002)[_0xe685('0x22')](function(){return _0xda37dd;});}return _0xda37dd;}return null;})[_0xe685('0x22')](respondWithResult(_0x1c36f5,null))[_0xe685('0x53')](handleError(_0x1c36f5,null));};var interaction_log=require(_0xe685('0x12'))(_0xe685('0x5b'));exports[_0xe685('0x34')]=function(_0x44cd97,_0x1fc231,_0x56ff89){var _0x5227c5={'agent':{},'channel':_0xe685('0x5c')};if(_0x44cd97[_0xe685('0x58')]['id']){delete _0x44cd97[_0xe685('0x58')]['id'];}_0x44cd97['body']['UserId']=_0x44cd97[_0xe685('0x58')][_0xe685('0x60')]||_0x44cd97['user']['id'];_0x5227c5['agent']['id']=_0x44cd97[_0xe685('0x58')]['UserId'];return db[_0xe685('0x3d')][_0xe685('0x59')]({'where':{'id':_0x44cd97[_0xe685('0x55')]['id'],'UserId':null}})[_0xe685('0x22')](handleEntityNotFound(_0x1fc231,null))[_0xe685('0x22')](function(_0x15bb2c){if(_0x15bb2c){_0x5227c5[_0xe685('0x2b')]=_0x15bb2c[_0xe685('0x62')]({'plain':!![]});return db[_0xe685('0x7a')]['find']({'where':{'id':_0x15bb2c[_0xe685('0x63')]}});}return null;})[_0xe685('0x22')](handleEntityNotFound(_0x1fc231,null))['then'](function(_0x534936){if(_0x534936){_0x5227c5[_0xe685('0x66')]=_0x534936[_0xe685('0x62')]({'plain':!![]});interaction_log['info'](_0xe685('0x7b'),_0x44cd97['user']['id'],_0x44cd97[_0xe685('0x61')]['name'],_0x44cd97[_0xe685('0x61')]['role'],_0x5227c5['interaction']['id'],_0x44cd97[_0xe685('0x58')]?JSON['stringify'](_0x44cd97['body']):_0xe685('0x69'));return respondWithRpcPromise(_0xe685('0x7c'),_0xe685('0x7d'),_0x5227c5);}return null;})['then'](function(_0x32c438){var _0x3542c6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x32c438['message'][_0xe685('0x7e')];return db[_0xe685('0x6b')][_0xe685('0x41')](_0x3542c6,{'type':db[_0xe685('0x7f')][_0xe685('0x6c')]['SELECT'],'raw':!![]})[_0xe685('0x22')](function(_0x229a77){return _0x229a77;});})[_0xe685('0x22')](function(_0x302c8f){if(_0x302c8f){_0x5227c5[_0xe685('0x2b')][_0xe685('0x6e')]=_0x302c8f[0x0];if(!_0x44cd97[_0xe685('0x58')][_0xe685('0x60')])return;return db['User']['find']({'where':{'id':_0x44cd97[_0xe685('0x58')][_0xe685('0x60')],'role':_0xe685('0x70')},'attributes':['id',_0xe685('0x3a'),_0xe685('0x71'),_0xe685('0x80'),_0xe685('0x72')],'raw':!![]});}return null;})['then'](function(_0x4ee5ad){if(!_0x4ee5ad)return null;_0x5227c5[_0xe685('0x2b')][_0xe685('0x70')]=_0x4ee5ad;return _0x5227c5;})[_0xe685('0x22')](function(_0x17779b){if(_0x17779b){_0x17779b['message'][_0xe685('0x81')]=util['format'](_0xe685('0x82'),_0x44cd97[_0xe685('0x61')]['name']);_0x17779b[_0xe685('0x2b')][_0xe685('0x74')]=_0x5227c5[_0xe685('0x74')];_0x17779b[_0xe685('0x2b')][_0xe685('0x75')]=_0x5227c5['channel'];_0x17779b['message'][_0xe685('0x76')]=_0xe685('0x34');respondWithRpcPromise(_0xe685('0x78'),_0xe685('0x78'),{'event':_0xe685('0x83'),'message':_0x17779b['message']},client9002);return _0x5227c5;}return null;})[_0xe685('0x22')](respondWithResult(_0x1fc231,null))[_0xe685('0x53')](handleError(_0x1fc231,null));};exports[_0xe685('0x2d')]=function(_0x36111e,_0x30bc65,_0x1afbf4){if(_0x36111e[_0xe685('0x58')]['id']){delete _0x36111e[_0xe685('0x58')]['id'];}var _0x3b68da;return db[_0xe685('0x3d')][_0xe685('0x59')]({'where':{'id':_0x36111e['params']['id']}})[_0xe685('0x22')](handleEntityNotFound(_0x30bc65,null))[_0xe685('0x22')](function(_0x24b4cd){if(_0x24b4cd){_0x3b68da=_0x24b4cd;return db[_0xe685('0x84')][_0xe685('0x59')]({'where':{'id':_0x24b4cd[_0xe685('0x85')]}});}})[_0xe685('0x22')](handleEntityNotFound(_0x30bc65,null))[_0xe685('0x22')](function(_0x16b856){if(_0x16b856){logger[_0xe685('0x26')](_0xe685('0x86'),_0xe685('0x2d'),_0xe685('0x87'),_0x16b856['type'],util[_0xe685('0x88')](_0x36111e['body'],{'showHidden':![],'depth':null}));switch(_0x16b856['type']){case _0xe685('0x89'):if(_0x36111e[_0xe685('0x58')][_0xe685('0x8a')]&&_0x36111e[_0xe685('0x58')][_0xe685('0x8a')]===_0x3b68da['messageId']&&_0x36111e[_0xe685('0x58')][_0xe685('0x8b')]&&_0x36111e[_0xe685('0x58')][_0xe685('0x8b')]==='read'){return _0x3b68da[_0xe685('0x36')]({'read':!![]});}else{logger[_0xe685('0x29')](_0xe685('0x8c'),_0xe685('0x2d'),'twilio',util[_0xe685('0x88')](_0x36111e[_0xe685('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3b68da;}})['then'](respondWithResult(_0x30bc65,null))[_0xe685('0x53')](handleError(_0x30bc65,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 9c2590c..f1f889c 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 _0xb574=['setMaxListeners','save','remove','hasOwnProperty','events','../../mysqldb'];(function(_0x1018ee,_0x243bc0){var _0x1d44e1=function(_0x530558){while(--_0x530558){_0x1018ee['push'](_0x1018ee['shift']());}};_0x1d44e1(++_0x243bc0);}(_0xb574,0x106));var _0x4b57=function(_0x524af2,_0x3009b5){_0x524af2=_0x524af2-0x0;var _0x3bfb8a=_0xb574[_0x524af2];return _0x3bfb8a;};'use strict';var EventEmitter=require(_0x4b57('0x0'));var WhatsappMessage=require(_0x4b57('0x1'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4b57('0x2')](0x0);var events={'afterCreate':_0x4b57('0x3'),'afterUpdate':'update','afterDestroy':_0x4b57('0x4')};function emitEvent(_0x1c9d28){return function(_0x168524,_0x919851,_0xe2ae86){WhatsappMessageEvents['emit'](_0x1c9d28+':'+_0x168524['id'],_0x168524);WhatsappMessageEvents['emit'](_0x1c9d28,_0x168524);_0xe2ae86(null);};}for(var e in events){if(events[_0x4b57('0x5')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0xa74f=['remove','hasOwnProperty','hook','exports','WhatsappMessage','update'];(function(_0x271116,_0x17d624){var _0x481788=function(_0x85bc98){while(--_0x85bc98){_0x271116['push'](_0x271116['shift']());}};_0x481788(++_0x17d624);}(_0xa74f,0x9a));var _0xfa74=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xa74f[_0x510c60];return _0x49c4aa;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require('../../mysqldb')['db'][_0xfa74('0x0')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xfa74('0x1'),'afterDestroy':_0xfa74('0x2')};function emitEvent(_0x394a1e){return function(_0x25a9b7,_0x5b367b,_0x141625){WhatsappMessageEvents['emit'](_0x394a1e+':'+_0x25a9b7['id'],_0x25a9b7);WhatsappMessageEvents['emit'](_0x394a1e,_0x25a9b7);_0x141625(null);};}for(var e in events){if(events[_0xfa74('0x3')](e)){var event=events[e];WhatsappMessage[_0xfa74('0x4')](e,emitEvent(event));}}module[_0xfa74('0x5')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 0732f3c..adefecf 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 _0x085f=['text','POST','application/json','statuses','message_id','err','finally','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','out','find','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','/whatsapp/v1/','/messages/'];(function(_0xe22173,_0x3e82ec){var _0x22db1a=function(_0x3199f7){while(--_0x3199f7){_0xe22173['push'](_0xe22173['shift']());}};_0x22db1a(++_0x3e82ec);}(_0x085f,0x74));var _0xf085=function(_0x459cdb,_0x45c950){_0x459cdb=_0x459cdb-0x0;var _0x58e331=_0x085f[_0x459cdb];return _0x58e331;};'use strict';var _=require(_0xf085('0x0'));var util=require('util');var logger=require(_0xf085('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf085('0x2'));var fetch=require(_0xf085('0x3'));var fs=require('fs');var path=require(_0xf085('0x4'));var rimraf=require(_0xf085('0x5'));var config=require(_0xf085('0x6'));var attributes=require(_0xf085('0x7'));module[_0xf085('0x8')]=function(_0x38ae48,_0x1f28d0){return _0x38ae48[_0xf085('0x9')](_0xf085('0xa'),attributes,{'tableName':_0xf085('0xb'),'paranoid':![],'indexes':[{'name':_0xf085('0xc'),'fields':[_0xf085('0xc')]},{'name':_0xf085('0xd'),'fields':['body'],'type':_0xf085('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51a6b8,_0x6c4bdd,_0x50a765){var _0x3a8b36=_0x38ae48[_0xf085('0xf')];var _0x2d33bc=_0x51a6b8['get']({'plain':!![]});if(_0x2d33bc[_0xf085('0x10')][_0xf085('0x11')]()==='in'||_0x2d33bc[_0xf085('0x10')][_0xf085('0x11')]()==='out'&&!_0x2d33bc[_0xf085('0x12')]&&!_[_0xf085('0x13')](_0x2d33bc[_0xf085('0x14')])){_0x3a8b36['WhatsappInteraction'][_0xf085('0x15')]({'where':{'id':_0x2d33bc[_0xf085('0x16')]}})[_0xf085('0x17')](function(_0x2e59c1){if(_0x2e59c1){_0x2e59c1[_0xf085('0x18')]({'lastMsgAt':_0x2d33bc[_0xf085('0x19')],'lastMsgDirection':_0x2d33bc[_0xf085('0x10')][_0xf085('0x11')]()});}})[_0xf085('0x1a')](function(_0x48dda8){console[_0xf085('0x1b')](_0x48dda8);});}if(_0x2d33bc[_0xf085('0x10')]===_0xf085('0x1c')&&!_0x2d33bc['secret']){var _0x136c75;_0x3a8b36['WhatsappAccount'][_0xf085('0x1d')]({'where':{'id':_0x2d33bc['WhatsappAccountId']},'raw':!![]})['then'](function(_0x376d75){_0x136c75=_0x376d75;if(_0x136c75&&_0x136c75['type']){switch(_0x136c75[_0xf085('0x1e')]){case _0xf085('0x1f'):var _0x7ff2e8=require('twilio');if(_0x136c75['accountSid']&&_0x136c75[_0xf085('0x20')]&&_0x136c75[_0xf085('0x21')]){var _0x6acb44=new _0x7ff2e8(_0x136c75[_0xf085('0x22')],_0x136c75[_0xf085('0x20')]);_0x6acb44[_0xf085('0x23')]['create']({'body':_0x2d33bc['body'],'to':_0xf085('0x24')+_0x2d33bc[_0xf085('0x21')],'from':_0xf085('0x24')+_0x136c75[_0xf085('0x21')],'statusCallback':_0x136c75[_0xf085('0x25')]+'/api/whatsapp/messages/'+_0x2d33bc['id']+'/status?token='+_0x136c75[_0xf085('0x26')]})[_0xf085('0x17')](function(_0x4c90e8){if(_0x4c90e8[_0xf085('0x27')]){return _0x51a6b8[_0xf085('0x18')]({'messageId':_0x4c90e8[_0xf085('0x27')]});}})[_0xf085('0x1a')](function(_0x44f283){logger['error'](_0xf085('0x28'),_0xf085('0x29'),_0xf085('0x1f'),util[_0xf085('0x2a')](_0x44f283,{'showHidden':![],'depth':null}));});}else{logger[_0xf085('0x1b')](_0xf085('0x28'),_0xf085('0x29'),'twilio',_0xf085('0x2b'));}break;case'sinch':var _0x296cd1=_0x136c75['accountSid'];var _0x5631d7=_0x136c75[_0xf085('0x20')];var _0x4d3050=_0x136c75['baseUrl']+_0xf085('0x2c')+_0x296cd1+_0xf085('0x2d');var _0x42e2d4={'to':[_0x2d33bc['phone']],'message':{'type':_0xf085('0x2e'),'text':_0x2d33bc['body']}};var _0x315d3c={'method':_0xf085('0x2f'),'uri':_0x4d3050,'headers':{'Authorization':'Bearer\x20'+_0x5631d7,'Content-Type':_0xf085('0x30')},'body':_0x42e2d4,'json':!![]};rp(_0x315d3c)[_0xf085('0x17')](function(_0x527fa8){if(_0x527fa8[_0xf085('0x31')][0x0]['message_id']){return _0x51a6b8[_0xf085('0x18')]({'messageId':_0x527fa8[_0xf085('0x31')][0x0][_0xf085('0x32')]});}})[_0xf085('0x1a')](function(_0x4af22d){logger[_0xf085('0x33')]('WhatsappMessage,\x20%s',_0x4af22d);});break;}}})[_0xf085('0x34')](function(){_0x50a765();});}else{_0x50a765();}}},'charset':'utf8mb4','collate':_0xf085('0x35')});}; \ No newline at end of file +var _0xd618=['find','WhatsappAccountId','type','twilio','authToken','phone','messages','create','whatsapp:','remote','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','accountSid','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','update','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','WhatsappInteraction','WhatsappInteractionId','then','createdAt','catch'];(function(_0x4737f4,_0x5c9310){var _0x43751d=function(_0x21f009){while(--_0x21f009){_0x4737f4['push'](_0x4737f4['shift']());}};_0x43751d(++_0x5c9310);}(_0xd618,0x9b));var _0x8d61=function(_0x1db803,_0x582d17){_0x1db803=_0x1db803-0x0;var _0x50aae9=_0xd618[_0x1db803];return _0x50aae9;};'use strict';var _=require(_0x8d61('0x0'));var util=require(_0x8d61('0x1'));var logger=require('../../config/logger')(_0x8d61('0x2'));var moment=require('moment');var BPromise=require(_0x8d61('0x3'));var rp=require(_0x8d61('0x4'));var fetch=require(_0x8d61('0x5'));var fs=require('fs');var path=require(_0x8d61('0x6'));var rimraf=require(_0x8d61('0x7'));var config=require(_0x8d61('0x8'));var attributes=require(_0x8d61('0x9'));module[_0x8d61('0xa')]=function(_0x32a95f,_0x231dc9){return _0x32a95f['define']('WhatsappMessage',attributes,{'tableName':_0x8d61('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x8d61('0xc')]},{'name':_0x8d61('0xd'),'fields':[_0x8d61('0xe')],'type':_0x8d61('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31c03c,_0x575a1c,_0x331664){var _0x5e330a=_0x32a95f[_0x8d61('0x10')];var _0x18ee5a=_0x31c03c[_0x8d61('0x11')]({'plain':!![]});if(_0x18ee5a[_0x8d61('0x12')]['toLowerCase']()==='in'||_0x18ee5a[_0x8d61('0x12')][_0x8d61('0x13')]()===_0x8d61('0x14')&&!_0x18ee5a[_0x8d61('0x15')]&&!_[_0x8d61('0x16')](_0x18ee5a['UserId'])){_0x5e330a[_0x8d61('0x17')]['findOne']({'where':{'id':_0x18ee5a[_0x8d61('0x18')]}})[_0x8d61('0x19')](function(_0x3bc026){if(_0x3bc026){_0x3bc026['update']({'lastMsgAt':_0x18ee5a[_0x8d61('0x1a')],'lastMsgDirection':_0x18ee5a[_0x8d61('0x12')]['toLowerCase']()});}})[_0x8d61('0x1b')](function(_0x52b0b6){console['error'](_0x52b0b6);});}if(_0x18ee5a[_0x8d61('0x12')]===_0x8d61('0x14')&&!_0x18ee5a[_0x8d61('0x15')]){var _0x5b6791;_0x5e330a['WhatsappAccount'][_0x8d61('0x1c')]({'where':{'id':_0x18ee5a[_0x8d61('0x1d')]},'raw':!![]})[_0x8d61('0x19')](function(_0x250ede){_0x5b6791=_0x250ede;if(_0x5b6791&&_0x5b6791[_0x8d61('0x1e')]){switch(_0x5b6791[_0x8d61('0x1e')]){case'twilio':var _0x309cee=require(_0x8d61('0x1f'));if(_0x5b6791['accountSid']&&_0x5b6791[_0x8d61('0x20')]&&_0x5b6791[_0x8d61('0x21')]){var _0x4a46f5=new _0x309cee(_0x5b6791['accountSid'],_0x5b6791[_0x8d61('0x20')]);_0x4a46f5[_0x8d61('0x22')][_0x8d61('0x23')]({'body':_0x18ee5a[_0x8d61('0xe')],'to':_0x8d61('0x24')+_0x18ee5a[_0x8d61('0x21')],'from':_0x8d61('0x24')+_0x5b6791[_0x8d61('0x21')],'statusCallback':_0x5b6791[_0x8d61('0x25')]+'/api/whatsapp/messages/'+_0x18ee5a['id']+_0x8d61('0x26')+_0x5b6791[_0x8d61('0x27')]})[_0x8d61('0x19')](function(_0x5abafd){if(_0x5abafd[_0x8d61('0x28')]){return _0x31c03c['update']({'messageId':_0x5abafd['sid']});}})[_0x8d61('0x1b')](function(_0x9ddc82){logger[_0x8d61('0x29')](_0x8d61('0x2a'),_0x8d61('0x2b'),_0x8d61('0x1f'),util[_0x8d61('0x2c')](_0x9ddc82,{'showHidden':![],'depth':null}));});}else{logger[_0x8d61('0x29')](_0x8d61('0x2a'),_0x8d61('0x2b'),'twilio',_0x8d61('0x2d'));}break;case'sinch':var _0x4f9137=_0x5b6791[_0x8d61('0x2e')];var _0x31d79e=_0x5b6791[_0x8d61('0x20')];var _0x1948dd=_0x5b6791[_0x8d61('0x2f')]+_0x8d61('0x30')+_0x4f9137+_0x8d61('0x31');var _0x27b8fe={'to':[_0x18ee5a[_0x8d61('0x21')]],'message':{'type':_0x8d61('0x32'),'text':_0x18ee5a[_0x8d61('0xe')]}};var _0x4cefe0={'method':_0x8d61('0x33'),'uri':_0x1948dd,'headers':{'Authorization':_0x8d61('0x34')+_0x31d79e,'Content-Type':_0x8d61('0x35')},'body':_0x27b8fe,'json':!![]};rp(_0x4cefe0)[_0x8d61('0x19')](function(_0x1c7d08){if(_0x1c7d08[_0x8d61('0x36')][0x0][_0x8d61('0x37')]){return _0x31c03c[_0x8d61('0x38')]({'messageId':_0x1c7d08[_0x8d61('0x36')][0x0][_0x8d61('0x37')]});}})['catch'](function(_0x538482){logger['err'](_0x8d61('0x39'),_0x538482);});break;}}})[_0x8d61('0x3a')](function(){_0x331664();});}else{_0x331664();}}},'charset':_0x8d61('0x3b'),'collate':_0x8d61('0x3c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ef49606..85ab374 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 _0x6292=['then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options'];(function(_0x4e6bd1,_0x18dc8a){var _0x47e0f3=function(_0x5177ca){while(--_0x5177ca){_0x4e6bd1['push'](_0x4e6bd1['shift']());}};_0x47e0f3(++_0x18dc8a);}(_0x6292,0x9d));var _0x2629=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x6292[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0x2629('0x0'));var util=require(_0x2629('0x1'));var moment=require(_0x2629('0x2'));var BPromise=require(_0x2629('0x3'));var rs=require(_0x2629('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2629('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2629('0x6'))('rpc');var config=require(_0x2629('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2629('0x8')][_0x2629('0x9')]({'port':0x232a});config['redis']=_[_0x2629('0xa')](config[_0x2629('0xb')],{'host':_0x2629('0xc'),'port':0x18eb});var socket=require(_0x2629('0xd'))(new Redis(config['redis']));require('./whatsappMessage.socket')[_0x2629('0xe')](socket);function respondWithRpcPromise(_0x5240bc,_0x4e52b1,_0x4c4df0){return new BPromise(function(_0x43822e,_0x4ffe6f){return client[_0x2629('0xf')](_0x5240bc,_0x4c4df0)['then'](function(_0x2b5f1b){logger[_0x2629('0x10')](_0x2629('0x11'),_0x4e52b1,_0x2629('0x12'));logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x4e52b1,'request\x20sent',JSON[_0x2629('0x13')](_0x2b5f1b));if(_0x2b5f1b['error']){if(_0x2b5f1b[_0x2629('0x14')]['code']===0x1f4){logger[_0x2629('0x14')](_0x2629('0x11'),_0x4e52b1,_0x2b5f1b['error']['message']);return _0x4ffe6f(_0x2b5f1b[_0x2629('0x14')]['message']);}logger[_0x2629('0x14')](_0x2629('0x11'),_0x4e52b1,_0x2b5f1b[_0x2629('0x14')][_0x2629('0x15')]);return _0x43822e(_0x2b5f1b[_0x2629('0x14')][_0x2629('0x15')]);}else{logger[_0x2629('0x10')](_0x2629('0x11'),_0x4e52b1,_0x2629('0x12'));_0x43822e(_0x2b5f1b[_0x2629('0x16')][_0x2629('0x15')]);}})[_0x2629('0x17')](function(_0x3cb91f){logger[_0x2629('0x14')](_0x2629('0x11'),_0x4e52b1,_0x3cb91f);_0x4ffe6f(_0x3cb91f);});});}exports[_0x2629('0x18')]=function(_0x13f3b0){var _0x2e98a8=this;return new Promise(function(_0x20d792,_0x47f4ee){return db[_0x2629('0x19')][_0x2629('0x1a')](_0x13f3b0[_0x2629('0x1b')],{'raw':_0x13f3b0[_0x2629('0x1c')]?_0x13f3b0[_0x2629('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x2629('0x1d')](function(_0x43eccb){logger[_0x2629('0x10')](_0x2629('0x18'),_0x13f3b0);logger[_0x2629('0x1e')](_0x2629('0x18'),_0x13f3b0,JSON[_0x2629('0x13')](_0x43eccb));_0x20d792(_0x43eccb);})[_0x2629('0x17')](function(_0x1be9a1){logger['error']('CreateWhatsappMessage',_0x1be9a1[_0x2629('0x15')],_0x13f3b0);_0x47f4ee(_0x2e98a8['error'](0x1f4,_0x1be9a1['message']));});});}; \ No newline at end of file +var _0xace4=['CreateWhatsappMessage','WhatsappMessage','create','options','raw','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x3e9b5c,_0x54ba4f){var _0x391e74=function(_0x39e3ef){while(--_0x39e3ef){_0x3e9b5c['push'](_0x3e9b5c['shift']());}};_0x391e74(++_0x54ba4f);}(_0xace4,0xe7));var _0x4ace=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xace4[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0x4ace('0x0'));var util=require(_0x4ace('0x1'));var moment=require(_0x4ace('0x2'));var BPromise=require('bluebird');var rs=require(_0x4ace('0x3'));var fs=require('fs');var Redis=require(_0x4ace('0x4'));var db=require(_0x4ace('0x5'))['db'];var utils=require(_0x4ace('0x6'));var logger=require('../../config/logger')(_0x4ace('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4ace('0x8')][_0x4ace('0x9')]({'port':0x232a});config[_0x4ace('0xa')]=_['defaults'](config[_0x4ace('0xa')],{'host':_0x4ace('0xb'),'port':0x18eb});var socket=require(_0x4ace('0xc'))(new Redis(config[_0x4ace('0xa')]));require(_0x4ace('0xd'))[_0x4ace('0xe')](socket);function respondWithRpcPromise(_0x4073ab,_0x115c65,_0x31180f){return new BPromise(function(_0x5b0805,_0x24f880){return client['request'](_0x4073ab,_0x31180f)['then'](function(_0x3ed287){logger[_0x4ace('0xf')](_0x4ace('0x10'),_0x115c65,_0x4ace('0x11'));logger[_0x4ace('0x12')](_0x4ace('0x13'),_0x115c65,_0x4ace('0x11'),JSON['stringify'](_0x3ed287));if(_0x3ed287[_0x4ace('0x14')]){if(_0x3ed287['error'][_0x4ace('0x15')]===0x1f4){logger[_0x4ace('0x14')](_0x4ace('0x10'),_0x115c65,_0x3ed287[_0x4ace('0x14')][_0x4ace('0x16')]);return _0x24f880(_0x3ed287['error'][_0x4ace('0x16')]);}logger[_0x4ace('0x14')](_0x4ace('0x10'),_0x115c65,_0x3ed287[_0x4ace('0x14')]['message']);return _0x5b0805(_0x3ed287['error'][_0x4ace('0x16')]);}else{logger['info'](_0x4ace('0x10'),_0x115c65,_0x4ace('0x11'));_0x5b0805(_0x3ed287[_0x4ace('0x17')][_0x4ace('0x16')]);}})[_0x4ace('0x18')](function(_0x1283b8){logger[_0x4ace('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x115c65,_0x1283b8);_0x24f880(_0x1283b8);});});}exports[_0x4ace('0x19')]=function(_0x28dc2d){var _0x4f1632=this;return new Promise(function(_0x4a5efd,_0x3e9330){return db[_0x4ace('0x1a')][_0x4ace('0x1b')](_0x28dc2d['body'],{'raw':_0x28dc2d[_0x4ace('0x1c')]?_0x28dc2d[_0x4ace('0x1c')][_0x4ace('0x1d')]===undefined?!![]:![]:!![]})[_0x4ace('0x1e')](function(_0x409c62){logger[_0x4ace('0xf')](_0x4ace('0x19'),_0x28dc2d);logger['debug'](_0x4ace('0x19'),_0x28dc2d,JSON[_0x4ace('0x1f')](_0x409c62));_0x4a5efd(_0x409c62);})['catch'](function(_0x50d82c){logger[_0x4ace('0x14')](_0x4ace('0x19'),_0x50d82c[_0x4ace('0x16')],_0x28dc2d);_0x3e9330(_0x4f1632[_0x4ace('0x14')](0x1f4,_0x50d82c[_0x4ace('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index e23adad..8f2e105 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 _0xf7e5=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x1ff528,_0x26caa4){var _0x5df0ab=function(_0x1a0f35){while(--_0x1a0f35){_0x1ff528['push'](_0x1ff528['shift']());}};_0x5df0ab(++_0x26caa4);}(_0xf7e5,0x159));var _0x5f7e=function(_0x56e693,_0x3e9c0b){_0x56e693=_0x56e693-0x0;var _0xff14d8=_0xf7e5[_0x56e693];return _0xff14d8;};'use strict';var WhatsappMessageEvents=require(_0x5f7e('0x0'));var events=[_0x5f7e('0x1'),_0x5f7e('0x2'),_0x5f7e('0x3')];function createListener(_0xd9e6ae,_0x323126){return function(_0xf49f84){_0x323126[_0x5f7e('0x4')](_0xd9e6ae,_0xf49f84);};}function removeListener(_0x4ac3fa,_0x5c91ec){return function(){WhatsappMessageEvents[_0x5f7e('0x5')](_0x4ac3fa,_0x5c91ec);};}exports[_0x5f7e('0x6')]=function(_0x3067d9){for(var _0x64618=0x0,_0x221ed4=events[_0x5f7e('0x7')];_0x64618<_0x221ed4;_0x64618++){var _0x115bfc=events[_0x64618];var _0x1ebc42=createListener(_0x5f7e('0x8')+_0x115bfc,_0x3067d9);WhatsappMessageEvents['on'](_0x115bfc,_0x1ebc42);}}; \ No newline at end of file +var _0x454e=['update','emit','length','whatsappMessage:','./whatsappMessage.events','save'];(function(_0x66c5d0,_0x28a69f){var _0x40680a=function(_0x3d4a9f){while(--_0x3d4a9f){_0x66c5d0['push'](_0x66c5d0['shift']());}};_0x40680a(++_0x28a69f);}(_0x454e,0xf4));var _0xe454=function(_0x22a7f5,_0x35a423){_0x22a7f5=_0x22a7f5-0x0;var _0x236ef6=_0x454e[_0x22a7f5];return _0x236ef6;};'use strict';var WhatsappMessageEvents=require(_0xe454('0x0'));var events=[_0xe454('0x1'),'remove',_0xe454('0x2')];function createListener(_0x295aa5,_0x1de3a9){return function(_0x24e69e){_0x1de3a9[_0xe454('0x3')](_0x295aa5,_0x24e69e);};}function removeListener(_0x35e8d3,_0x50abc2){return function(){WhatsappMessageEvents['removeListener'](_0x35e8d3,_0x50abc2);};}exports['register']=function(_0x42567a){for(var _0x28d840=0x0,_0x43f344=events[_0xe454('0x4')];_0x28d840<_0x43f344;_0x28d840++){var _0x5b79e5=events[_0x28d840];var _0x3a7af6=createListener(_0xe454('0x5')+_0x5b79e5,_0x42567a);WhatsappMessageEvents['on'](_0x5b79e5,_0x3a7af6);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 783eb9a..6349a46 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 _0x20de=['fs-extra','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','put','/:id','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x20de,0x1ad));var _0xe20d=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x20de[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0xe20d('0x0'));var util=require(_0xe20d('0x1'));var path=require(_0xe20d('0x2'));var timeout=require(_0xe20d('0x3'));var express=require(_0xe20d('0x4'));var router=express[_0xe20d('0x5')]();var fs_extra=require(_0xe20d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe20d('0x7'));var config=require('../../config/environment');var controller=require(_0xe20d('0x8'));router[_0xe20d('0x9')]('/',auth[_0xe20d('0xa')](),controller[_0xe20d('0xb')]);router['get'](_0xe20d('0xc'),auth['isAuthenticated'](),controller[_0xe20d('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xe20d('0xe')]);router[_0xe20d('0x9')](_0xe20d('0xf'),auth[_0xe20d('0xa')](),controller['getMembers']);router[_0xe20d('0x9')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe20d('0x10')]);router[_0xe20d('0x9')](_0xe20d('0x11'),auth[_0xe20d('0xa')](),controller[_0xe20d('0x12')]);router[_0xe20d('0x13')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0xe20d('0x14'),auth[_0xe20d('0xa')](),controller[_0xe20d('0x15')]);router[_0xe20d('0x13')](_0xe20d('0x11'),auth[_0xe20d('0xa')](),controller['addAgents']);router[_0xe20d('0x16')](_0xe20d('0x17'),auth[_0xe20d('0xa')](),controller[_0xe20d('0x18')]);router[_0xe20d('0x19')](_0xe20d('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0xe20d('0x19')](_0xe20d('0x14'),auth[_0xe20d('0xa')](),controller[_0xe20d('0x1a')]);router[_0xe20d('0x19')](_0xe20d('0x11'),auth[_0xe20d('0xa')](),controller[_0xe20d('0x1b')]);module[_0xe20d('0x1c')]=router; \ No newline at end of file +var _0xf364=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x5a5936,_0x1fef78){var _0x2d9112=function(_0x479e74){while(--_0x479e74){_0x5a5936['push'](_0x5a5936['shift']());}};_0x2d9112(++_0x1fef78);}(_0xf364,0x164));var _0x4f36=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xf364[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x4f36('0x0'));var util=require('util');var path=require(_0x4f36('0x1'));var timeout=require(_0x4f36('0x2'));var express=require('express');var router=express[_0x4f36('0x3')]();var fs_extra=require(_0x4f36('0x4'));var auth=require(_0x4f36('0x5'));var interaction=require(_0x4f36('0x6'));var config=require('../../config/environment');var controller=require(_0x4f36('0x7'));router[_0x4f36('0x8')]('/',auth[_0x4f36('0x9')](),controller[_0x4f36('0xa')]);router[_0x4f36('0x8')](_0x4f36('0xb'),auth[_0x4f36('0x9')](),controller[_0x4f36('0xc')]);router['get'](_0x4f36('0xd'),auth[_0x4f36('0x9')](),controller[_0x4f36('0xe')]);router[_0x4f36('0x8')](_0x4f36('0xf'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x10')]);router[_0x4f36('0x8')](_0x4f36('0x11'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x12')]);router['get'](_0x4f36('0x13'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x14')]);router[_0x4f36('0x15')]('/',auth[_0x4f36('0x9')](),controller[_0x4f36('0x16')]);router[_0x4f36('0x15')](_0x4f36('0x11'),auth['isAuthenticated'](),controller[_0x4f36('0x17')]);router[_0x4f36('0x15')](_0x4f36('0x13'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x18')]);router['put'](_0x4f36('0xd'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x19')]);router[_0x4f36('0x1a')](_0x4f36('0xd'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x1b')]);router[_0x4f36('0x1a')](_0x4f36('0x11'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x1c')]);router[_0x4f36('0x1a')](_0x4f36('0x13'),auth[_0x4f36('0x9')](),controller[_0x4f36('0x1d')]);module[_0x4f36('0x1e')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index d0a34e2..ada000f 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 _0xf3dc=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x3c858f,_0x235201){var _0x198090=function(_0xc4c406){while(--_0xc4c406){_0x3c858f['push'](_0x3c858f['shift']());}};_0x198090(++_0x235201);}(_0xf3dc,0x9c));var _0xcf3d=function(_0x404a11,_0x268dc0){_0x404a11=_0x404a11-0x0;var _0x435823=_0xf3dc[_0x404a11];return _0x435823;};'use strict';var Sequelize=require(_0xcf3d('0x0'));module[_0xcf3d('0x1')]={'name':{'type':Sequelize[_0xcf3d('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcf3d('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcf3d('0x4')](_0xcf3d('0x5'),_0xcf3d('0x6'),_0xcf3d('0x7'))},'description':{'type':Sequelize[_0xcf3d('0x2')]}}; \ No newline at end of file +var _0x8eeb=['beepall','roundrobin','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x8eeb,0x183));var _0xb8ee=function(_0x39d61e,_0x4a5e35){_0x39d61e=_0x39d61e-0x0;var _0x2a2467=_0x8eeb[_0x39d61e];return _0x2a2467;};'use strict';var Sequelize=require(_0xb8ee('0x0'));module['exports']={'name':{'type':Sequelize[_0xb8ee('0x1')],'unique':_0xb8ee('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb8ee('0x3')](_0xb8ee('0x4'),_0xb8ee('0x5'),_0xb8ee('0x6'))},'description':{'type':Sequelize[_0xb8ee('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index d8d8e85..e468222 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 _0x033c=['findOne','UserWhatsappQueue','hasOwnProperty','nolimit','order','sort','where','WhatsappQueueId','filter','map','User','findAndCountAll','UserId','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','options','addTeams','Agents','voicePause','interface','sequelize','transaction','each','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','union','compact','value','ids','isEmpty','removeAgents','forEach','emit','userWhatsappQueue:remove','addAgents','omit','spread','getAgents','util','lodash','squel','ioredis','../../components/parsers/qs','api','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','update','destroy','then','WhatsappQueues','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','key','include','query','WhatsappQueue','findAll','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','error','describe','getMembers'];(function(_0xea35d1,_0x302471){var _0x1d7a7c=function(_0x1bc101){while(--_0x1bc101){_0xea35d1['push'](_0xea35d1['shift']());}};_0x1d7a7c(++_0x302471);}(_0x033c,0x195));var _0xc033=function(_0x526cf8,_0x10674b){_0x526cf8=_0x526cf8-0x0;var _0x1c87f2=_0x033c[_0x526cf8];return _0x1c87f2;};'use strict';var BPromise=require('bluebird');var util=require(_0xc033('0x0'));var _=require(_0xc033('0x1'));var squel=require(_0xc033('0x2'));var Redis=require(_0xc033('0x3'));var qs=require(_0xc033('0x4'));var logger=require('../../config/logger')(_0xc033('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xc033('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0xc033('0x7'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0xc033('0x8')](socket);function respondWithStatusCode(_0x50ddc1,_0x380355){_0x380355=_0x380355||0xcc;return function(_0x3e7e7e){if(_0x3e7e7e){return _0x50ddc1[_0xc033('0x9')](_0x380355);}return _0x50ddc1[_0xc033('0xa')](_0x380355)[_0xc033('0xb')]();};}function respondWithResult(_0x430014,_0x5b0e31){_0x5b0e31=_0x5b0e31||0xc8;return function(_0x180442){if(_0x180442){return _0x430014[_0xc033('0xa')](_0x5b0e31)[_0xc033('0xc')](_0x180442);}};}function respondWithFilteredResult(_0x3ce0f3,_0x3819b8){return function(_0x4558c9){if(_0x4558c9){var _0x24771d=typeof _0x3819b8[_0xc033('0xd')]===_0xc033('0xe')&&typeof _0x3819b8[_0xc033('0xf')]===_0xc033('0xe');var _0x4931a4=_0x4558c9[_0xc033('0x10')];var _0x487e33=_0x24771d?0x0:_0x3819b8['offset'];var _0x107309=_0x24771d?_0x4558c9['count']:_0x3819b8[_0xc033('0xd')]+_0x3819b8[_0xc033('0xf')];var _0x6de192;if(_0x107309>=_0x4931a4){_0x107309=_0x4931a4;_0x6de192=0xc8;}else{_0x6de192=0xce;}_0x3ce0f3[_0xc033('0xa')](_0x6de192);return _0x3ce0f3['set']('Content-Range',_0x487e33+'-'+_0x107309+'/'+_0x4931a4)[_0xc033('0xc')](_0x4558c9);}return null;};}function saveUpdates(_0x1e4286){return function(_0x466704){if(_0x466704){return _0x466704[_0xc033('0x11')](_0x1e4286)['then'](function(_0x169b18){return _0x169b18;});}return null;};}function removeEntity(_0x561974){return function(_0x55e870){if(_0x55e870){return _0x55e870[_0xc033('0x12')]()[_0xc033('0x13')](function(){var _0x50476f=_0x55e870['get']({'plain':!![]});var _0x291c77=_0xc033('0x14');return db[_0xc033('0x15')][_0xc033('0x12')]({'where':{'type':_0x291c77,'resourceId':_0x50476f['id']}})['then'](function(){return _0x55e870;});})[_0xc033('0x13')](function(){_0x561974[_0xc033('0xa')](0xcc)[_0xc033('0xb')]();});}};}function handleEntityNotFound(_0x193a06){return function(_0x2a2573){if(!_0x2a2573){_0x193a06[_0xc033('0x9')](0x194);}return _0x2a2573;};}function handleError(_0x1fb4f4,_0x300e35){_0x300e35=_0x300e35||0x1f4;return function(_0x5cae9b){logger['error'](_0x5cae9b[_0xc033('0x16')]);if(_0x5cae9b[_0xc033('0x17')]){delete _0x5cae9b[_0xc033('0x17')];}_0x1fb4f4[_0xc033('0xa')](_0x300e35)['send'](_0x5cae9b);};}exports[_0xc033('0x18')]=function(_0x5d057d,_0x4ea545){var _0xca3d89={};var _0x1db576={'count':0x0,'rows':[]};var _0x2c8537=_['map'](db['WhatsappQueue'][_0xc033('0x19')],function(_0x3e7b47){return{'name':_0x3e7b47[_0xc033('0x1a')],'type':_0x3e7b47[_0xc033('0x1b')][_0xc033('0x1c')]};});_0xca3d89=qs['getOptions'](_0x2c8537,_0x5d057d);var _0x33cd45={'where':_0xca3d89['where']};return db['WhatsappQueue'][_0xc033('0x10')](_0x33cd45)[_0xc033('0x13')](function(_0x38342a){_0x1db576[_0xc033('0x10')]=_0x38342a;_0xca3d89[_0xc033('0x1d')]=qs[_0xc033('0x1d')](_0x5d057d[_0xc033('0x1e')]);return db[_0xc033('0x1f')][_0xc033('0x20')](_0xca3d89);})[_0xc033('0x13')](function(_0x46abf0){_0x1db576['rows']=_0x46abf0;return _0x1db576;})[_0xc033('0x13')](respondWithFilteredResult(_0x4ea545,_0xca3d89))[_0xc033('0x21')](handleError(_0x4ea545,null));};exports['show']=function(_0xeef9c6,_0x399e6f){var _0x5457e4={'raw':!![],'where':{'id':_0xeef9c6[_0xc033('0x22')]['id']}},_0x47ec9c={};_0x47ec9c[_0xc033('0x23')]=_[_0xc033('0x24')](db['WhatsappQueue'][_0xc033('0x19')]);_0x47ec9c[_0xc033('0x1e')]=_['keys'](_0xeef9c6[_0xc033('0x1e')]);_0x47ec9c[_0xc033('0x25')]=_[_0xc033('0x26')](_0x47ec9c[_0xc033('0x23')],_0x47ec9c[_0xc033('0x1e')]);_0x5457e4[_0xc033('0x27')]=_[_0xc033('0x26')](_0x47ec9c['model'],qs['fields'](_0xeef9c6[_0xc033('0x1e')][_0xc033('0x28')]));_0x5457e4[_0xc033('0x27')]=_0x5457e4[_0xc033('0x27')][_0xc033('0x29')]?_0x5457e4['attributes']:_0x47ec9c[_0xc033('0x23')];if(_0xeef9c6[_0xc033('0x1e')][_0xc033('0x2a')]){_0x5457e4['include']=[{'all':!![]}];}_0x5457e4=_[_0xc033('0x2b')]({},_0x5457e4,_0xeef9c6['options']);return db[_0xc033('0x1f')]['find'](_0x5457e4)[_0xc033('0x13')](handleEntityNotFound(_0x399e6f,null))[_0xc033('0x13')](respondWithResult(_0x399e6f,null))[_0xc033('0x21')](handleError(_0x399e6f,null));};exports['create']=function(_0xfdf42f,_0x380f5c){return db[_0xc033('0x1f')][_0xc033('0x2c')](_0xfdf42f[_0xc033('0x2d')],{})[_0xc033('0x13')](function(_0x588b19){var _0x575dff=_0xfdf42f[_0xc033('0x2e')]['get']({'plain':!![]});if(!_0x575dff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x575dff['role']==='user'){var _0x269ea5=_0x588b19[_0xc033('0x2f')]({'plain':!![]});var _0x54fb4c=_0xc033('0x14');return db[_0xc033('0x30')][_0xc033('0x31')]({'where':{'name':_0x54fb4c,'userProfileId':_0x575dff[_0xc033('0x32')]},'raw':!![]})['then'](function(_0x32ecb6){if(_0x32ecb6&&_0x32ecb6[_0xc033('0x33')]===0x0){return db['UserProfileResource'][_0xc033('0x2c')]({'name':_0x269ea5[_0xc033('0x17')],'resourceId':_0x269ea5['id'],'type':_0x32ecb6[_0xc033('0x17')],'sectionId':_0x32ecb6['id']},{})['then'](function(){return _0x588b19;});}else{return _0x588b19;}})['catch'](function(_0x537318){logger[_0xc033('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x537318);throw _0x537318;});}return _0x588b19;})[_0xc033('0x13')](respondWithResult(_0x380f5c,0xc9))['catch'](handleError(_0x380f5c,null));};exports['update']=function(_0x3496c2,_0x395563){if(_0x3496c2[_0xc033('0x2d')]['id']){delete _0x3496c2['body']['id'];}return db[_0xc033('0x1f')][_0xc033('0x31')]({'where':{'id':_0x3496c2['params']['id']}})[_0xc033('0x13')](handleEntityNotFound(_0x395563,null))[_0xc033('0x13')](saveUpdates(_0x3496c2[_0xc033('0x2d')],null))['then'](respondWithResult(_0x395563,null))['catch'](handleError(_0x395563,null));};exports[_0xc033('0x12')]=function(_0x1e57c8,_0x1da454){return db[_0xc033('0x1f')][_0xc033('0x31')]({'where':{'id':_0x1e57c8[_0xc033('0x22')]['id']}})[_0xc033('0x13')](handleEntityNotFound(_0x1da454,null))[_0xc033('0x13')](removeEntity(_0x1da454,null))[_0xc033('0x21')](handleError(_0x1da454,null));};exports[_0xc033('0x35')]=function(_0x1b888d,_0x1063fe){return db[_0xc033('0x1f')][_0xc033('0x35')]()[_0xc033('0x13')](respondWithResult(_0x1063fe,null))[_0xc033('0x21')](handleError(_0x1063fe,null));};exports[_0xc033('0x36')]=function(_0x2390ff,_0x5d1e0c){var _0x3266c1={'raw':!![],'where':{}},_0x2600d6={},_0x1f9362;return db[_0xc033('0x1f')][_0xc033('0x37')]({'where':{'id':_0x2390ff[_0xc033('0x22')]['id']}})[_0xc033('0x13')](handleEntityNotFound(_0x5d1e0c,null))[_0xc033('0x13')](function(_0x431e9e){if(_0x431e9e){_0x1f9362=_0x431e9e['get']({'plain':!![]});_0x2600d6['model']=_[_0xc033('0x24')](db[_0xc033('0x38')]['rawAttributes']);_0x2600d6[_0xc033('0x1e')]=_[_0xc033('0x24')](_0x2390ff[_0xc033('0x1e')]);_0x2600d6['filters']=_['intersection'](_0x2600d6[_0xc033('0x23')],_0x2600d6['query']);_0x3266c1[_0xc033('0x27')]=_[_0xc033('0x26')](_0x2600d6['model'],qs['fields'](_0x2390ff[_0xc033('0x1e')]['fields']));_0x3266c1[_0xc033('0x27')]=_0x3266c1[_0xc033('0x27')]['length']?_0x3266c1[_0xc033('0x27')]:_0x2600d6[_0xc033('0x23')];if(!_0x2390ff[_0xc033('0x1e')][_0xc033('0x39')](_0xc033('0x3a'))){_0x3266c1[_0xc033('0xf')]=qs[_0xc033('0xf')](_0x2390ff[_0xc033('0x1e')]['limit']);_0x3266c1['offset']=qs['offset'](_0x2390ff[_0xc033('0x1e')][_0xc033('0xd')]);}_0x3266c1[_0xc033('0x3b')]=qs[_0xc033('0x3c')](_0x2390ff[_0xc033('0x1e')][_0xc033('0x3c')]);_0x3266c1[_0xc033('0x3d')]=qs[_0xc033('0x25')](_['pick'](_0x2390ff[_0xc033('0x1e')],_0x2600d6[_0xc033('0x25')]));_0x3266c1[_0xc033('0x3d')][_0xc033('0x3e')]=_0x431e9e['id'];if(_0x2390ff[_0xc033('0x1e')][_0xc033('0x3f')]){_0x3266c1['where']=_['merge'](_0x3266c1[_0xc033('0x3d')],{'$or':_[_0xc033('0x40')](_0x3266c1[_0xc033('0x27')],function(_0x308774){var _0x2824f5={};_0x2824f5[_0x308774]={'$like':'%'+_0x2390ff['query'][_0xc033('0x3f')]+'%'};return _0x2824f5;})});}_0x3266c1=_['merge']({},_0x3266c1,_0x2390ff['options']);return db[_0xc033('0x38')]['findAll'](_0x3266c1);}})['then'](function(_0x5dca17){if(_0x5dca17){return db[_0xc033('0x41')][_0xc033('0x42')]({'where':{'id':_[_0xc033('0x40')](_0x5dca17,_0xc033('0x43')),'role':'agent'},'attributes':['id',_0xc033('0x17'),_0xc033('0x44'),_0xc033('0x45'),_0xc033('0x46')]});}})[_0xc033('0x13')](function(_0x4914f9){if(_0x4914f9){return{'count':_0x4914f9[_0xc033('0x10')],'rows':_[_0xc033('0x40')](_0x4914f9[_0xc033('0x47')],function(_0x4bed6c){return{'membername':_0x4bed6c['name'],'UserId':_0x4bed6c['id'],'queue_name':_0x1f9362[_0xc033('0x17')],'WhatsappQueueId':_0x1f9362['id'],'interface':util[_0xc033('0x48')](_0xc033('0x49'),_0xc033('0x4a'),_0x4bed6c[_0xc033('0x17')]),'penalty':0x0,'paused':_0x4bed6c[_0xc033('0x44')],'createdAt':_0x4bed6c[_0xc033('0x46')],'updatedAt':_0x4bed6c[_0xc033('0x45')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc033('0x13')](respondWithFilteredResult(_0x5d1e0c,_0x3266c1))[_0xc033('0x21')](handleError(_0x5d1e0c,null));};exports[_0xc033('0x4b')]=function(_0x2f9bfb,_0x163065){var _0x70161a={};var _0x9f6379={};var _0x1c1a99;var _0x479d7e;return db[_0xc033('0x1f')][_0xc033('0x37')]({'where':{'id':_0x2f9bfb[_0xc033('0x22')]['id']}})['then'](handleEntityNotFound(_0x163065,null))[_0xc033('0x13')](function(_0x54af78){if(_0x54af78){_0x1c1a99=_0x54af78;_0x9f6379[_0xc033('0x23')]=_[_0xc033('0x24')](db[_0xc033('0x4c')][_0xc033('0x19')]);_0x9f6379[_0xc033('0x1e')]=_['keys'](_0x2f9bfb[_0xc033('0x1e')]);_0x9f6379[_0xc033('0x25')]=_['intersection'](_0x9f6379[_0xc033('0x23')],_0x9f6379[_0xc033('0x1e')]);_0x70161a[_0xc033('0x27')]=_[_0xc033('0x26')](_0x9f6379[_0xc033('0x23')],qs[_0xc033('0x28')](_0x2f9bfb[_0xc033('0x1e')]['fields']));_0x70161a[_0xc033('0x27')]=_0x70161a[_0xc033('0x27')][_0xc033('0x29')]?_0x70161a[_0xc033('0x27')]:_0x9f6379[_0xc033('0x23')];_0x70161a['order']=qs[_0xc033('0x3c')](_0x2f9bfb[_0xc033('0x1e')][_0xc033('0x3c')]);_0x70161a[_0xc033('0x3d')]=qs[_0xc033('0x25')](_[_0xc033('0x4d')](_0x2f9bfb[_0xc033('0x1e')],_0x9f6379[_0xc033('0x25')]));if(_0x2f9bfb[_0xc033('0x1e')][_0xc033('0x3f')]){_0x70161a['where']=_['merge'](_0x70161a[_0xc033('0x3d')],{'$or':_[_0xc033('0x40')](_0x70161a[_0xc033('0x27')],function(_0x16be22){var _0x14e004={};_0x14e004[_0x16be22]={'$like':'%'+_0x2f9bfb[_0xc033('0x1e')][_0xc033('0x3f')]+'%'};return _0x14e004;})});}_0x70161a=_[_0xc033('0x2b')]({},_0x70161a,_0x2f9bfb[_0xc033('0x4e')]);return _0x1c1a99['getTeams'](_0x70161a);}})[_0xc033('0x13')](function(_0x12db0e){if(_0x12db0e){_0x479d7e=_0x12db0e['length'];if(!_0x2f9bfb[_0xc033('0x1e')][_0xc033('0x39')](_0xc033('0x3a'))){_0x70161a[_0xc033('0xf')]=qs['limit'](_0x2f9bfb[_0xc033('0x1e')]['limit']);_0x70161a['offset']=qs[_0xc033('0xd')](_0x2f9bfb['query'][_0xc033('0xd')]);}return _0x1c1a99[_0xc033('0x4b')](_0x70161a);}})[_0xc033('0x13')](function(_0x5471d1){if(_0x5471d1){return _0x5471d1?{'count':_0x479d7e,'rows':_0x5471d1}:null;}})[_0xc033('0x13')](respondWithResult(_0x163065,null))['catch'](handleError(_0x163065,null));};exports[_0xc033('0x4f')]=function(_0x16a480,_0x10be79){var _0x158af2=_0x16a480[_0xc033('0x2d')]['ids'];return db[_0xc033('0x4c')][_0xc033('0x20')]({'where':{'id':_0x158af2},'attributes':['id'],'include':[{'model':db[_0xc033('0x41')],'as':_0xc033('0x50'),'attributes':['id',_0xc033('0x17'),'online',_0xc033('0x51'),_0xc033('0x52')],'raw':!![]}]})[_0xc033('0x13')](function(_0x53908c){if(_0x53908c){var _0x15cd94=_['flatMap'](_0x53908c,function(_0x26544b){var _0x2b925a=_0x26544b[_0xc033('0x2f')]({'plain':!![]});return _0x2b925a['Agents'];});return db[_0xc033('0x1f')][_0xc033('0x31')]({'where':{'id':_0x16a480[_0xc033('0x22')]['id']}})[_0xc033('0x13')](function(_0x4ee778){return db[_0xc033('0x53')][_0xc033('0x54')](function(_0x59dc09){return _0x4ee778[_0xc033('0x4f')](_0x158af2,{'transaction':_0x59dc09})[_0xc033('0x13')](function(){return BPromise[_0xc033('0x55')](_0x15cd94,function(_0x166543){return db[_0xc033('0x38')]['findOrCreate']({'where':{'UserId':_0x166543['id'],'WhatsappQueueId':_0x16a480[_0xc033('0x22')]['id']},'transaction':_0x59dc09});});})['then'](function(){_0x15cd94['forEach'](function(_0x234346){socket['emit'](_0xc033('0x56'),{'UserId':_0x234346['id'],'WhatsappQueueId':_0x4ee778['id']});});});});});}})[_0xc033('0x13')](respondWithStatusCode(_0x10be79,null))[_0xc033('0x21')](handleError(_0x10be79,null));};exports[_0xc033('0x57')]=function(_0x504c49,_0x105833){return db['Team'][_0xc033('0x20')]({'where':{'id':_0x504c49['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xc033('0x41')],'as':_0xc033('0x50'),'attributes':['id'],'raw':!![]}]})[_0xc033('0x13')](handleEntityNotFound(_0x105833,null))['then'](function(_0x3d351f){var _0x16baab=_[_0xc033('0x40')](_0x3d351f,'id');var _0x4be412=[];var _0x1a7567=[];var _0xd3717c=squel[_0xc033('0x58')]();_0xd3717c[_0xc033('0x59')](_0xc033('0x5a'))['from'](_0xc033('0x5b'),'tq')[_0xc033('0x5c')]('user_has_teams','ut',_0xc033('0x5d'))['where']('WhatsappQueueId\x20=\x20?',_0x504c49[_0xc033('0x22')]['id']);for(var _0x5494c0=0x0;_0x5494c0<_0x3d351f[_0xc033('0x29')];_0x5494c0+=0x1){let _0x17dd8c=_0x3d351f[_0x5494c0];for(var _0x7c5c10=0x0;_0x7c5c10<_0x17dd8c[_0xc033('0x50')][_0xc033('0x29')];_0x7c5c10+=0x1){let _0x82631b=_0x17dd8c[_0xc033('0x50')][_0x7c5c10];var _0x511276=_0xd3717c[_0xc033('0x5e')]();_0x511276[_0xc033('0x3d')](_0xc033('0x5f'),_0x82631b['id']);_0x1a7567[_0xc033('0x60')](db['sequelize'][_0xc033('0x1e')](_0x511276[_0xc033('0x61')](),{'type':db[_0xc033('0x53')][_0xc033('0x62')][_0xc033('0x63')]})[_0xc033('0x13')](function(_0x23533d){if(_0x23533d[_0xc033('0x29')]===0x1){return _0x82631b['id'];}else{var _0x1fe72b=_['every'](_[_0xc033('0x40')](_0x23533d,_0xc033('0x64')),function(_0x2cace1){return _[_0xc033('0x65')](_0x16baab,_0x2cace1);});if(_0x1fe72b){return _0x82631b['id'];}}}));}}return BPromise['all'](_0x1a7567)[_0xc033('0x13')](function(_0x579ff4){_0x4be412=_(_0x4be412)[_0xc033('0x66')](_0x579ff4)[_0xc033('0x67')]()[_0xc033('0x68')]();return db[_0xc033('0x1f')]['find']({'where':{'id':_0x504c49['params']['id']}})[_0xc033('0x13')](function(_0xa8f888){return db['sequelize'][_0xc033('0x54')](function(_0x2e9e3e){return _0xa8f888[_0xc033('0x57')](_0x504c49[_0xc033('0x1e')][_0xc033('0x69')],{'transaction':_0x2e9e3e})[_0xc033('0x13')](function(){if(!_[_0xc033('0x6a')](_0x4be412)){return _0xa8f888[_0xc033('0x6b')](_0x4be412,{'transaction':_0x2e9e3e});}})['then'](function(){_0x4be412[_0xc033('0x6c')](function(_0x149b38){socket[_0xc033('0x6d')](_0xc033('0x6e'),{'UserId':_0x149b38,'WhatsappQueueId':_0xa8f888['id']});});});});});});})[_0xc033('0x13')](respondWithStatusCode(_0x105833,null))[_0xc033('0x21')](handleError(_0x105833,null));};exports['addAgents']=function(_0x13acbe,_0x1f41b4){return db[_0xc033('0x1f')][_0xc033('0x31')]({'where':{'id':_0x13acbe[_0xc033('0x22')]['id']}})[_0xc033('0x13')](handleEntityNotFound(_0x1f41b4,null))[_0xc033('0x13')](function(_0x47ed55){if(_0x47ed55){return _0x47ed55[_0xc033('0x6f')](_0x13acbe[_0xc033('0x2d')][_0xc033('0x69')],_[_0xc033('0x70')](_0x13acbe['body'],[_0xc033('0x69'),'id'])||{})[_0xc033('0x71')](function(_0x578c31){for(var _0xdec03f=0x0;_0xdec03f<_0x13acbe['body'][_0xc033('0x69')][_0xc033('0x29')];_0xdec03f+=0x1){socket[_0xc033('0x6d')](_0xc033('0x56'),{'UserId':Number(_0x13acbe[_0xc033('0x2d')]['ids'][_0xdec03f]),'WhatsappQueueId':Number(_0x13acbe['params']['id'])});}return _0x578c31;});}})[_0xc033('0x13')](respondWithResult(_0x1f41b4,null))[_0xc033('0x21')](handleError(_0x1f41b4,null));};exports[_0xc033('0x6b')]=function(_0x35942d,_0x11ac2c){return db[_0xc033('0x1f')][_0xc033('0x31')]({'where':{'id':_0x35942d[_0xc033('0x22')]['id']}})[_0xc033('0x13')](handleEntityNotFound(_0x11ac2c,null))[_0xc033('0x13')](function(_0x45610d){if(_0x45610d){return _0x45610d['removeAgents'](_0x35942d['query'][_0xc033('0x69')])[_0xc033('0x13')](function(){if(_['isArray'](_0x35942d[_0xc033('0x1e')][_0xc033('0x69')])){for(var _0x4874ec=0x0;_0x4874ec<_0x35942d[_0xc033('0x1e')][_0xc033('0x69')]['length'];_0x4874ec+=0x1){socket[_0xc033('0x6d')](_0xc033('0x6e'),{'UserId':Number(_0x35942d[_0xc033('0x1e')][_0xc033('0x69')][_0x4874ec]),'WhatsappQueueId':Number(_0x35942d[_0xc033('0x22')]['id'])});}}else{socket[_0xc033('0x6d')](_0xc033('0x6e'),{'UserId':Number(_0x35942d['query']['ids']),'WhatsappQueueId':Number(_0x35942d[_0xc033('0x22')]['id'])});}});}})[_0xc033('0x13')](respondWithStatusCode(_0x11ac2c,null))[_0xc033('0x21')](handleError(_0x11ac2c,null));};exports[_0xc033('0x72')]=function(_0x105b57,_0x52c8a0){var _0x663a4b={};var _0x522599={};var _0x351508;var _0xf148c;return db[_0xc033('0x1f')][_0xc033('0x37')]({'where':{'id':_0x105b57[_0xc033('0x22')]['id']}})['then'](handleEntityNotFound(_0x52c8a0,null))[_0xc033('0x13')](function(_0x51f9a8){if(_0x51f9a8){_0x351508=_0x51f9a8;_0x522599[_0xc033('0x23')]=_[_0xc033('0x24')](db[_0xc033('0x41')]['rawAttributes']);_0x522599[_0xc033('0x1e')]=_['keys'](_0x105b57[_0xc033('0x1e')]);_0x522599[_0xc033('0x25')]=_[_0xc033('0x26')](_0x522599[_0xc033('0x23')],_0x522599[_0xc033('0x1e')]);_0x663a4b['attributes']=_[_0xc033('0x26')](_0x522599[_0xc033('0x23')],qs['fields'](_0x105b57[_0xc033('0x1e')][_0xc033('0x28')]));_0x663a4b[_0xc033('0x27')]=_0x663a4b[_0xc033('0x27')]['length']?_0x663a4b[_0xc033('0x27')]:_0x522599[_0xc033('0x23')];_0x663a4b[_0xc033('0x3b')]=qs[_0xc033('0x3c')](_0x105b57[_0xc033('0x1e')][_0xc033('0x3c')]);_0x663a4b[_0xc033('0x3d')]=qs[_0xc033('0x25')](_[_0xc033('0x4d')](_0x105b57['query'],_0x522599[_0xc033('0x25')]));if(_0x105b57[_0xc033('0x1e')][_0xc033('0x3f')]){_0x663a4b[_0xc033('0x3d')]=_['merge'](_0x663a4b[_0xc033('0x3d')],{'$or':_[_0xc033('0x40')](_0x663a4b[_0xc033('0x27')],function(_0x2f8c18){var _0x17b551={};_0x17b551[_0x2f8c18]={'$like':'%'+_0x105b57['query']['filter']+'%'};return _0x17b551;})});}_0x663a4b=_['merge']({},_0x663a4b,_0x105b57[_0xc033('0x4e')]);return _0x351508[_0xc033('0x72')](_0x663a4b);}})[_0xc033('0x13')](function(_0x37df92){if(_0x37df92){_0xf148c=_0x37df92['length'];if(!_0x105b57[_0xc033('0x1e')]['hasOwnProperty']('nolimit')){_0x663a4b[_0xc033('0xf')]=qs[_0xc033('0xf')](_0x105b57['query'][_0xc033('0xf')]);_0x663a4b[_0xc033('0xd')]=qs[_0xc033('0xd')](_0x105b57['query']['offset']);}return _0x351508[_0xc033('0x72')](_0x663a4b);}})[_0xc033('0x13')](function(_0x422b63){if(_0x422b63){return _0x422b63?{'count':_0xf148c,'rows':_0x422b63}:null;}})[_0xc033('0x13')](respondWithResult(_0x52c8a0,null))[_0xc033('0x21')](handleError(_0x52c8a0,null));}; \ No newline at end of file +var _0xe730=['online','voicePause','interface','sequelize','transaction','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','Agents','select','field','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','error','name','send','map','WhatsappQueue','rawAttributes','fieldName','getOptions','where','include','query','findAll','catch','show','params','model','keys','intersection','fields','attributes','includeAll','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','filters','pick','WhatsappQueueId','filter','options','UserId','agent','whatsappPause','createdAt','rows','%s/%s','updatedAt','getTeams','addTeams','ids','Team','User'];(function(_0xc4ca37,_0x2eff7f){var _0x5db11f=function(_0x377f2a){while(--_0x377f2a){_0xc4ca37['push'](_0xc4ca37['shift']());}};_0x5db11f(++_0x2eff7f);}(_0xe730,0x96));var _0x0e73=function(_0x48e644,_0x5754d2){_0x48e644=_0x48e644-0x0;var _0x5c8efc=_0xe730[_0x48e644];return _0x5c8efc;};'use strict';var BPromise=require(_0x0e73('0x0'));var util=require(_0x0e73('0x1'));var _=require(_0x0e73('0x2'));var squel=require(_0x0e73('0x3'));var Redis=require(_0x0e73('0x4'));var qs=require(_0x0e73('0x5'));var logger=require('../../config/logger')(_0x0e73('0x6'));var config=require(_0x0e73('0x7'));var db=require(_0x0e73('0x8'))['db'];config[_0x0e73('0x9')]=_[_0x0e73('0xa')](config[_0x0e73('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x0e73('0xb'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x0e73('0xc')](socket);function respondWithStatusCode(_0x31f751,_0x10de76){_0x10de76=_0x10de76||0xcc;return function(_0x5c61f7){if(_0x5c61f7){return _0x31f751[_0x0e73('0xd')](_0x10de76);}return _0x31f751[_0x0e73('0xe')](_0x10de76)['end']();};}function respondWithResult(_0x10538b,_0x3d08f2){_0x3d08f2=_0x3d08f2||0xc8;return function(_0x56b8cb){if(_0x56b8cb){return _0x10538b['status'](_0x3d08f2)[_0x0e73('0xf')](_0x56b8cb);}};}function respondWithFilteredResult(_0x322256,_0x183b53){return function(_0x5f3822){if(_0x5f3822){var _0x16d5e2=typeof _0x183b53[_0x0e73('0x10')]===_0x0e73('0x11')&&typeof _0x183b53[_0x0e73('0x12')]===_0x0e73('0x11');var _0x4dc093=_0x5f3822[_0x0e73('0x13')];var _0x4855bf=_0x16d5e2?0x0:_0x183b53[_0x0e73('0x10')];var _0x19742b=_0x16d5e2?_0x5f3822[_0x0e73('0x13')]:_0x183b53[_0x0e73('0x10')]+_0x183b53[_0x0e73('0x12')];var _0x46eaa2;if(_0x19742b>=_0x4dc093){_0x19742b=_0x4dc093;_0x46eaa2=0xc8;}else{_0x46eaa2=0xce;}_0x322256[_0x0e73('0xe')](_0x46eaa2);return _0x322256[_0x0e73('0x14')]('Content-Range',_0x4855bf+'-'+_0x19742b+'/'+_0x4dc093)[_0x0e73('0xf')](_0x5f3822);}return null;};}function saveUpdates(_0x3ecfa2){return function(_0x5a6f42){if(_0x5a6f42){return _0x5a6f42[_0x0e73('0x15')](_0x3ecfa2)[_0x0e73('0x16')](function(_0x52ecc8){return _0x52ecc8;});}return null;};}function removeEntity(_0x580261){return function(_0x32a610){if(_0x32a610){return _0x32a610['destroy']()[_0x0e73('0x16')](function(){var _0x285758=_0x32a610['get']({'plain':!![]});var _0xa96af7='WhatsappQueues';return db['UserProfileResource'][_0x0e73('0x17')]({'where':{'type':_0xa96af7,'resourceId':_0x285758['id']}})[_0x0e73('0x16')](function(){return _0x32a610;});})[_0x0e73('0x16')](function(){_0x580261[_0x0e73('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4925b5){return function(_0x50322e){if(!_0x50322e){_0x4925b5[_0x0e73('0xd')](0x194);}return _0x50322e;};}function handleError(_0x45ff63,_0x87f2b3){_0x87f2b3=_0x87f2b3||0x1f4;return function(_0xc49d3e){logger[_0x0e73('0x18')](_0xc49d3e['stack']);if(_0xc49d3e[_0x0e73('0x19')]){delete _0xc49d3e[_0x0e73('0x19')];}_0x45ff63['status'](_0x87f2b3)[_0x0e73('0x1a')](_0xc49d3e);};}exports['index']=function(_0x480cdb,_0x4c8c07){var _0x1090f9={};var _0x275d6a={'count':0x0,'rows':[]};var _0x5a59ba=_[_0x0e73('0x1b')](db[_0x0e73('0x1c')][_0x0e73('0x1d')],function(_0xa1a832){return{'name':_0xa1a832[_0x0e73('0x1e')],'type':_0xa1a832['type']['key']};});_0x1090f9=qs[_0x0e73('0x1f')](_0x5a59ba,_0x480cdb);var _0x48d221={'where':_0x1090f9[_0x0e73('0x20')]};return db[_0x0e73('0x1c')][_0x0e73('0x13')](_0x48d221)['then'](function(_0x17dbed){_0x275d6a[_0x0e73('0x13')]=_0x17dbed;_0x1090f9[_0x0e73('0x21')]=qs['include'](_0x480cdb[_0x0e73('0x22')]);return db['WhatsappQueue'][_0x0e73('0x23')](_0x1090f9);})['then'](function(_0x3511ca){_0x275d6a['rows']=_0x3511ca;return _0x275d6a;})[_0x0e73('0x16')](respondWithFilteredResult(_0x4c8c07,_0x1090f9))[_0x0e73('0x24')](handleError(_0x4c8c07,null));};exports[_0x0e73('0x25')]=function(_0x2563d4,_0x270db4){var _0x421957={'raw':!![],'where':{'id':_0x2563d4[_0x0e73('0x26')]['id']}},_0x410d16={};_0x410d16[_0x0e73('0x27')]=_['keys'](db[_0x0e73('0x1c')][_0x0e73('0x1d')]);_0x410d16[_0x0e73('0x22')]=_[_0x0e73('0x28')](_0x2563d4[_0x0e73('0x22')]);_0x410d16['filters']=_['intersection'](_0x410d16[_0x0e73('0x27')],_0x410d16[_0x0e73('0x22')]);_0x421957['attributes']=_[_0x0e73('0x29')](_0x410d16['model'],qs[_0x0e73('0x2a')](_0x2563d4['query'][_0x0e73('0x2a')]));_0x421957[_0x0e73('0x2b')]=_0x421957['attributes']['length']?_0x421957[_0x0e73('0x2b')]:_0x410d16[_0x0e73('0x27')];if(_0x2563d4[_0x0e73('0x22')][_0x0e73('0x2c')]){_0x421957[_0x0e73('0x21')]=[{'all':!![]}];}_0x421957=_[_0x0e73('0x2d')]({},_0x421957,_0x2563d4['options']);return db[_0x0e73('0x1c')][_0x0e73('0x2e')](_0x421957)[_0x0e73('0x16')](handleEntityNotFound(_0x270db4,null))['then'](respondWithResult(_0x270db4,null))[_0x0e73('0x24')](handleError(_0x270db4,null));};exports[_0x0e73('0x2f')]=function(_0x3834d6,_0x199cff){return db[_0x0e73('0x1c')][_0x0e73('0x2f')](_0x3834d6[_0x0e73('0x30')],{})[_0x0e73('0x16')](function(_0x1fc552){var _0x44d281=_0x3834d6[_0x0e73('0x31')][_0x0e73('0x32')]({'plain':!![]});if(!_0x44d281)throw new Error(_0x0e73('0x33'));if(_0x44d281['role']==='user'){var _0x40343c=_0x1fc552[_0x0e73('0x32')]({'plain':!![]});var _0x441590=_0x0e73('0x34');return db[_0x0e73('0x35')][_0x0e73('0x2e')]({'where':{'name':_0x441590,'userProfileId':_0x44d281[_0x0e73('0x36')]},'raw':!![]})[_0x0e73('0x16')](function(_0x3b31db){if(_0x3b31db&&_0x3b31db[_0x0e73('0x37')]===0x0){return db[_0x0e73('0x38')]['create']({'name':_0x40343c[_0x0e73('0x19')],'resourceId':_0x40343c['id'],'type':_0x3b31db[_0x0e73('0x19')],'sectionId':_0x3b31db['id']},{})[_0x0e73('0x16')](function(){return _0x1fc552;});}else{return _0x1fc552;}})[_0x0e73('0x24')](function(_0x5dc8d8){logger['error'](_0x0e73('0x39'),_0x5dc8d8);throw _0x5dc8d8;});}return _0x1fc552;})[_0x0e73('0x16')](respondWithResult(_0x199cff,0xc9))[_0x0e73('0x24')](handleError(_0x199cff,null));};exports['update']=function(_0x54d7fa,_0x11217f){if(_0x54d7fa[_0x0e73('0x30')]['id']){delete _0x54d7fa[_0x0e73('0x30')]['id'];}return db[_0x0e73('0x1c')][_0x0e73('0x2e')]({'where':{'id':_0x54d7fa[_0x0e73('0x26')]['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x11217f,null))['then'](saveUpdates(_0x54d7fa[_0x0e73('0x30')],null))['then'](respondWithResult(_0x11217f,null))[_0x0e73('0x24')](handleError(_0x11217f,null));};exports[_0x0e73('0x17')]=function(_0x36d917,_0x39ee47){return db['WhatsappQueue'][_0x0e73('0x2e')]({'where':{'id':_0x36d917[_0x0e73('0x26')]['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x39ee47,null))['then'](removeEntity(_0x39ee47,null))[_0x0e73('0x24')](handleError(_0x39ee47,null));};exports[_0x0e73('0x3a')]=function(_0x80d487,_0x373f3a){return db[_0x0e73('0x1c')][_0x0e73('0x3a')]()['then'](respondWithResult(_0x373f3a,null))['catch'](handleError(_0x373f3a,null));};exports[_0x0e73('0x3b')]=function(_0x2028b1,_0x159657){var _0x471eb1={'raw':!![],'where':{}},_0x52ae69={},_0x3607ab;return db['WhatsappQueue'][_0x0e73('0x3c')]({'where':{'id':_0x2028b1[_0x0e73('0x26')]['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x159657,null))[_0x0e73('0x16')](function(_0x4fbac0){if(_0x4fbac0){_0x3607ab=_0x4fbac0[_0x0e73('0x32')]({'plain':!![]});_0x52ae69[_0x0e73('0x27')]=_[_0x0e73('0x28')](db[_0x0e73('0x3d')]['rawAttributes']);_0x52ae69['query']=_[_0x0e73('0x28')](_0x2028b1['query']);_0x52ae69['filters']=_[_0x0e73('0x29')](_0x52ae69['model'],_0x52ae69['query']);_0x471eb1['attributes']=_[_0x0e73('0x29')](_0x52ae69[_0x0e73('0x27')],qs[_0x0e73('0x2a')](_0x2028b1['query'][_0x0e73('0x2a')]));_0x471eb1[_0x0e73('0x2b')]=_0x471eb1[_0x0e73('0x2b')][_0x0e73('0x3e')]?_0x471eb1[_0x0e73('0x2b')]:_0x52ae69[_0x0e73('0x27')];if(!_0x2028b1['query'][_0x0e73('0x3f')](_0x0e73('0x40'))){_0x471eb1[_0x0e73('0x12')]=qs['limit'](_0x2028b1[_0x0e73('0x22')][_0x0e73('0x12')]);_0x471eb1[_0x0e73('0x10')]=qs[_0x0e73('0x10')](_0x2028b1[_0x0e73('0x22')]['offset']);}_0x471eb1[_0x0e73('0x41')]=qs[_0x0e73('0x42')](_0x2028b1[_0x0e73('0x22')][_0x0e73('0x42')]);_0x471eb1[_0x0e73('0x20')]=qs[_0x0e73('0x43')](_[_0x0e73('0x44')](_0x2028b1['query'],_0x52ae69[_0x0e73('0x43')]));_0x471eb1['where'][_0x0e73('0x45')]=_0x4fbac0['id'];if(_0x2028b1['query']['filter']){_0x471eb1[_0x0e73('0x20')]=_['merge'](_0x471eb1[_0x0e73('0x20')],{'$or':_[_0x0e73('0x1b')](_0x471eb1[_0x0e73('0x2b')],function(_0x47506e){var _0x516b4d={};_0x516b4d[_0x47506e]={'$like':'%'+_0x2028b1[_0x0e73('0x22')][_0x0e73('0x46')]+'%'};return _0x516b4d;})});}_0x471eb1=_[_0x0e73('0x2d')]({},_0x471eb1,_0x2028b1[_0x0e73('0x47')]);return db[_0x0e73('0x3d')][_0x0e73('0x23')](_0x471eb1);}})[_0x0e73('0x16')](function(_0x3f3354){if(_0x3f3354){return db['User']['findAndCountAll']({'where':{'id':_[_0x0e73('0x1b')](_0x3f3354,_0x0e73('0x48')),'role':_0x0e73('0x49')},'attributes':['id',_0x0e73('0x19'),_0x0e73('0x4a'),'updatedAt',_0x0e73('0x4b')]});}})[_0x0e73('0x16')](function(_0x1c4fed){if(_0x1c4fed){return{'count':_0x1c4fed[_0x0e73('0x13')],'rows':_['map'](_0x1c4fed[_0x0e73('0x4c')],function(_0x555b41){return{'membername':_0x555b41[_0x0e73('0x19')],'UserId':_0x555b41['id'],'queue_name':_0x3607ab[_0x0e73('0x19')],'WhatsappQueueId':_0x3607ab['id'],'interface':util['format'](_0x0e73('0x4d'),'SIP',_0x555b41[_0x0e73('0x19')]),'penalty':0x0,'paused':_0x555b41['whatsappPause'],'createdAt':_0x555b41[_0x0e73('0x4b')],'updatedAt':_0x555b41[_0x0e73('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0e73('0x16')](respondWithFilteredResult(_0x159657,_0x471eb1))[_0x0e73('0x24')](handleError(_0x159657,null));};exports[_0x0e73('0x4f')]=function(_0x190328,_0x4df6f9){var _0x4756e0={};var _0x1cdd49={};var _0x7992f8;var _0x255df1;return db['WhatsappQueue'][_0x0e73('0x3c')]({'where':{'id':_0x190328['params']['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x4df6f9,null))[_0x0e73('0x16')](function(_0x2a8363){if(_0x2a8363){_0x7992f8=_0x2a8363;_0x1cdd49[_0x0e73('0x27')]=_[_0x0e73('0x28')](db['Team']['rawAttributes']);_0x1cdd49[_0x0e73('0x22')]=_[_0x0e73('0x28')](_0x190328[_0x0e73('0x22')]);_0x1cdd49[_0x0e73('0x43')]=_['intersection'](_0x1cdd49[_0x0e73('0x27')],_0x1cdd49[_0x0e73('0x22')]);_0x4756e0[_0x0e73('0x2b')]=_[_0x0e73('0x29')](_0x1cdd49[_0x0e73('0x27')],qs[_0x0e73('0x2a')](_0x190328[_0x0e73('0x22')]['fields']));_0x4756e0[_0x0e73('0x2b')]=_0x4756e0[_0x0e73('0x2b')][_0x0e73('0x3e')]?_0x4756e0[_0x0e73('0x2b')]:_0x1cdd49['model'];_0x4756e0[_0x0e73('0x41')]=qs[_0x0e73('0x42')](_0x190328[_0x0e73('0x22')][_0x0e73('0x42')]);_0x4756e0[_0x0e73('0x20')]=qs[_0x0e73('0x43')](_[_0x0e73('0x44')](_0x190328[_0x0e73('0x22')],_0x1cdd49[_0x0e73('0x43')]));if(_0x190328[_0x0e73('0x22')]['filter']){_0x4756e0[_0x0e73('0x20')]=_[_0x0e73('0x2d')](_0x4756e0[_0x0e73('0x20')],{'$or':_[_0x0e73('0x1b')](_0x4756e0[_0x0e73('0x2b')],function(_0x55e692){var _0x167139={};_0x167139[_0x55e692]={'$like':'%'+_0x190328[_0x0e73('0x22')][_0x0e73('0x46')]+'%'};return _0x167139;})});}_0x4756e0=_[_0x0e73('0x2d')]({},_0x4756e0,_0x190328[_0x0e73('0x47')]);return _0x7992f8[_0x0e73('0x4f')](_0x4756e0);}})['then'](function(_0x607865){if(_0x607865){_0x255df1=_0x607865[_0x0e73('0x3e')];if(!_0x190328['query'][_0x0e73('0x3f')](_0x0e73('0x40'))){_0x4756e0[_0x0e73('0x12')]=qs[_0x0e73('0x12')](_0x190328[_0x0e73('0x22')]['limit']);_0x4756e0[_0x0e73('0x10')]=qs['offset'](_0x190328['query'][_0x0e73('0x10')]);}return _0x7992f8[_0x0e73('0x4f')](_0x4756e0);}})[_0x0e73('0x16')](function(_0x2d96fe){if(_0x2d96fe){return _0x2d96fe?{'count':_0x255df1,'rows':_0x2d96fe}:null;}})[_0x0e73('0x16')](respondWithResult(_0x4df6f9,null))[_0x0e73('0x24')](handleError(_0x4df6f9,null));};exports[_0x0e73('0x50')]=function(_0x21e8c,_0x5d4db5){var _0x47d222=_0x21e8c[_0x0e73('0x30')][_0x0e73('0x51')];return db[_0x0e73('0x52')][_0x0e73('0x23')]({'where':{'id':_0x47d222},'attributes':['id'],'include':[{'model':db[_0x0e73('0x53')],'as':'Agents','attributes':['id',_0x0e73('0x19'),_0x0e73('0x54'),_0x0e73('0x55'),_0x0e73('0x56')],'raw':!![]}]})['then'](function(_0x416201){if(_0x416201){var _0x1185dc=_['flatMap'](_0x416201,function(_0x380518){var _0x249a07=_0x380518[_0x0e73('0x32')]({'plain':!![]});return _0x249a07['Agents'];});return db['WhatsappQueue']['find']({'where':{'id':_0x21e8c['params']['id']}})[_0x0e73('0x16')](function(_0x34b9fa){return db[_0x0e73('0x57')][_0x0e73('0x58')](function(_0x37bb78){return _0x34b9fa[_0x0e73('0x50')](_0x47d222,{'transaction':_0x37bb78})[_0x0e73('0x16')](function(){return BPromise['each'](_0x1185dc,function(_0x27a358){return db['UserWhatsappQueue'][_0x0e73('0x59')]({'where':{'UserId':_0x27a358['id'],'WhatsappQueueId':_0x21e8c[_0x0e73('0x26')]['id']},'transaction':_0x37bb78});});})[_0x0e73('0x16')](function(){_0x1185dc[_0x0e73('0x5a')](function(_0x29444c){socket[_0x0e73('0x5b')](_0x0e73('0x5c'),{'UserId':_0x29444c['id'],'WhatsappQueueId':_0x34b9fa['id']});});});});});}})[_0x0e73('0x16')](respondWithStatusCode(_0x5d4db5,null))['catch'](handleError(_0x5d4db5,null));};exports[_0x0e73('0x5d')]=function(_0x47b257,_0x364f10){return db[_0x0e73('0x52')]['findAll']({'where':{'id':_0x47b257[_0x0e73('0x22')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0e73('0x53')],'as':_0x0e73('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x364f10,null))[_0x0e73('0x16')](function(_0x1057d1){var _0x287650=_[_0x0e73('0x1b')](_0x1057d1,'id');var _0x43cada=[];var _0x36359a=[];var _0x2be4b3=squel[_0x0e73('0x5f')]();_0x2be4b3[_0x0e73('0x60')]('tq.TeamId')[_0x0e73('0x61')](_0x0e73('0x62'),'tq')['join']('user_has_teams','ut',_0x0e73('0x63'))[_0x0e73('0x20')](_0x0e73('0x64'),_0x47b257[_0x0e73('0x26')]['id']);for(var _0x255d89=0x0;_0x255d89<_0x1057d1['length'];_0x255d89+=0x1){let _0x3b3639=_0x1057d1[_0x255d89];for(var _0x31684c=0x0;_0x31684c<_0x3b3639[_0x0e73('0x5e')]['length'];_0x31684c+=0x1){let _0x50ca27=_0x3b3639[_0x0e73('0x5e')][_0x31684c];var _0x392a0b=_0x2be4b3[_0x0e73('0x65')]();_0x392a0b[_0x0e73('0x20')](_0x0e73('0x66'),_0x50ca27['id']);_0x36359a[_0x0e73('0x67')](db['sequelize'][_0x0e73('0x22')](_0x392a0b['toString'](),{'type':db[_0x0e73('0x57')][_0x0e73('0x68')][_0x0e73('0x69')]})[_0x0e73('0x16')](function(_0x29337d){if(_0x29337d[_0x0e73('0x3e')]===0x1){return _0x50ca27['id'];}else{var _0x147c37=_['every'](_[_0x0e73('0x1b')](_0x29337d,_0x0e73('0x6a')),function(_0x59c741){return _[_0x0e73('0x6b')](_0x287650,_0x59c741);});if(_0x147c37){return _0x50ca27['id'];}}}));}}return BPromise['all'](_0x36359a)[_0x0e73('0x16')](function(_0x47991e){_0x43cada=_(_0x43cada)[_0x0e73('0x6c')](_0x47991e)[_0x0e73('0x6d')]()[_0x0e73('0x6e')]();return db[_0x0e73('0x1c')][_0x0e73('0x2e')]({'where':{'id':_0x47b257[_0x0e73('0x26')]['id']}})['then'](function(_0x32a477){return db[_0x0e73('0x57')]['transaction'](function(_0x1639a1){return _0x32a477[_0x0e73('0x5d')](_0x47b257[_0x0e73('0x22')][_0x0e73('0x51')],{'transaction':_0x1639a1})['then'](function(){if(!_[_0x0e73('0x6f')](_0x43cada)){return _0x32a477[_0x0e73('0x70')](_0x43cada,{'transaction':_0x1639a1});}})['then'](function(){_0x43cada[_0x0e73('0x5a')](function(_0x409cd3){socket[_0x0e73('0x5b')](_0x0e73('0x71'),{'UserId':_0x409cd3,'WhatsappQueueId':_0x32a477['id']});});});});});});})[_0x0e73('0x16')](respondWithStatusCode(_0x364f10,null))[_0x0e73('0x24')](handleError(_0x364f10,null));};exports['addAgents']=function(_0x34f08a,_0x140b34){return db[_0x0e73('0x1c')][_0x0e73('0x2e')]({'where':{'id':_0x34f08a[_0x0e73('0x26')]['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x140b34,null))[_0x0e73('0x16')](function(_0x59b750){if(_0x59b750){return _0x59b750['addAgents'](_0x34f08a['body'][_0x0e73('0x51')],_['omit'](_0x34f08a[_0x0e73('0x30')],['ids','id'])||{})[_0x0e73('0x72')](function(_0x1b5427){for(var _0xe8c462=0x0;_0xe8c462<_0x34f08a[_0x0e73('0x30')][_0x0e73('0x51')]['length'];_0xe8c462+=0x1){socket[_0x0e73('0x5b')](_0x0e73('0x5c'),{'UserId':Number(_0x34f08a[_0x0e73('0x30')]['ids'][_0xe8c462]),'WhatsappQueueId':Number(_0x34f08a['params']['id'])});}return _0x1b5427;});}})[_0x0e73('0x16')](respondWithResult(_0x140b34,null))[_0x0e73('0x24')](handleError(_0x140b34,null));};exports[_0x0e73('0x70')]=function(_0x3bbd61,_0x2822e6){return db[_0x0e73('0x1c')][_0x0e73('0x2e')]({'where':{'id':_0x3bbd61['params']['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x2822e6,null))[_0x0e73('0x16')](function(_0x5bec75){if(_0x5bec75){return _0x5bec75[_0x0e73('0x70')](_0x3bbd61[_0x0e73('0x22')][_0x0e73('0x51')])[_0x0e73('0x16')](function(){if(_[_0x0e73('0x73')](_0x3bbd61['query'][_0x0e73('0x51')])){for(var _0x121054=0x0;_0x121054<_0x3bbd61[_0x0e73('0x22')][_0x0e73('0x51')][_0x0e73('0x3e')];_0x121054+=0x1){socket[_0x0e73('0x5b')]('userWhatsappQueue:remove',{'UserId':Number(_0x3bbd61['query']['ids'][_0x121054]),'WhatsappQueueId':Number(_0x3bbd61[_0x0e73('0x26')]['id'])});}}else{socket['emit'](_0x0e73('0x71'),{'UserId':Number(_0x3bbd61[_0x0e73('0x22')][_0x0e73('0x51')]),'WhatsappQueueId':Number(_0x3bbd61[_0x0e73('0x26')]['id'])});}});}})[_0x0e73('0x16')](respondWithStatusCode(_0x2822e6,null))[_0x0e73('0x24')](handleError(_0x2822e6,null));};exports[_0x0e73('0x74')]=function(_0x17ce91,_0x68a802){var _0x3b10ed={};var _0x1af126={};var _0x24f815;var _0x298875;return db[_0x0e73('0x1c')][_0x0e73('0x3c')]({'where':{'id':_0x17ce91[_0x0e73('0x26')]['id']}})[_0x0e73('0x16')](handleEntityNotFound(_0x68a802,null))[_0x0e73('0x16')](function(_0x3813c5){if(_0x3813c5){_0x24f815=_0x3813c5;_0x1af126[_0x0e73('0x27')]=_[_0x0e73('0x28')](db[_0x0e73('0x53')][_0x0e73('0x1d')]);_0x1af126[_0x0e73('0x22')]=_[_0x0e73('0x28')](_0x17ce91[_0x0e73('0x22')]);_0x1af126[_0x0e73('0x43')]=_[_0x0e73('0x29')](_0x1af126[_0x0e73('0x27')],_0x1af126['query']);_0x3b10ed[_0x0e73('0x2b')]=_[_0x0e73('0x29')](_0x1af126['model'],qs[_0x0e73('0x2a')](_0x17ce91['query'][_0x0e73('0x2a')]));_0x3b10ed[_0x0e73('0x2b')]=_0x3b10ed['attributes'][_0x0e73('0x3e')]?_0x3b10ed['attributes']:_0x1af126[_0x0e73('0x27')];_0x3b10ed[_0x0e73('0x41')]=qs['sort'](_0x17ce91['query'][_0x0e73('0x42')]);_0x3b10ed[_0x0e73('0x20')]=qs[_0x0e73('0x43')](_[_0x0e73('0x44')](_0x17ce91[_0x0e73('0x22')],_0x1af126[_0x0e73('0x43')]));if(_0x17ce91['query'][_0x0e73('0x46')]){_0x3b10ed[_0x0e73('0x20')]=_[_0x0e73('0x2d')](_0x3b10ed[_0x0e73('0x20')],{'$or':_[_0x0e73('0x1b')](_0x3b10ed[_0x0e73('0x2b')],function(_0x23991b){var _0x239c6b={};_0x239c6b[_0x23991b]={'$like':'%'+_0x17ce91['query']['filter']+'%'};return _0x239c6b;})});}_0x3b10ed=_[_0x0e73('0x2d')]({},_0x3b10ed,_0x17ce91[_0x0e73('0x47')]);return _0x24f815[_0x0e73('0x74')](_0x3b10ed);}})['then'](function(_0x4a04db){if(_0x4a04db){_0x298875=_0x4a04db[_0x0e73('0x3e')];if(!_0x17ce91['query'][_0x0e73('0x3f')](_0x0e73('0x40'))){_0x3b10ed['limit']=qs[_0x0e73('0x12')](_0x17ce91[_0x0e73('0x22')][_0x0e73('0x12')]);_0x3b10ed[_0x0e73('0x10')]=qs[_0x0e73('0x10')](_0x17ce91[_0x0e73('0x22')][_0x0e73('0x10')]);}return _0x24f815[_0x0e73('0x74')](_0x3b10ed);}})[_0x0e73('0x16')](function(_0x32bfe6){if(_0x32bfe6){return _0x32bfe6?{'count':_0x298875,'rows':_0x32bfe6}:null;}})[_0x0e73('0x16')](respondWithResult(_0x68a802,null))['catch'](handleError(_0x68a802,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index c1d73c3..7b3bf79 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 _0xa496=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0xa496,0xa1));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x6a49('0x0'))['db'][_0x6a49('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x6a49('0x2')](0x0);var events={'afterCreate':_0x6a49('0x3'),'afterUpdate':_0x6a49('0x4'),'afterDestroy':_0x6a49('0x5')};function emitEvent(_0x5b6f94){return function(_0x13fe6d,_0x2e7180,_0x5bbca1){WhatsappQueueEvents[_0x6a49('0x6')](_0x5b6f94+':'+_0x13fe6d['id'],_0x13fe6d);WhatsappQueueEvents['emit'](_0x5b6f94,_0x13fe6d);_0x5bbca1(null);};}for(var e in events){if(events[_0x6a49('0x7')](e)){var event=events[e];WhatsappQueue[_0x6a49('0x8')](e,emitEvent(event));}}module[_0x6a49('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0xf03e=['hook','exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf03e,0xe3));var _0xef03=function(_0x2b2438,_0x2f0a66){_0x2b2438=_0x2b2438-0x0;var _0x1b29da=_0xf03e[_0x2b2438];return _0x1b29da;};'use strict';var EventEmitter=require(_0xef03('0x0'));var WhatsappQueue=require(_0xef03('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xef03('0x2'),'afterUpdate':_0xef03('0x3'),'afterDestroy':_0xef03('0x4')};function emitEvent(_0x4fbfd4){return function(_0x5effb5,_0x19ea93,_0x1970bd){WhatsappQueueEvents[_0xef03('0x5')](_0x4fbfd4+':'+_0x5effb5['id'],_0x5effb5);WhatsappQueueEvents[_0xef03('0x5')](_0x4fbfd4,_0x5effb5);_0x1970bd(null);};}for(var e in events){if(events[_0xef03('0x6')](e)){var event=events[e];WhatsappQueue[_0xef03('0x7')](e,emitEvent(event));}}module[_0xef03('0x8')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 8014454..1d56c48 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 _0xf5fb=['rimraf','../../config/environment','exports','whatsapp_queues','lodash','util','api','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5fb,0x163));var _0xbf5f=function(_0x58cd92,_0x59311d){_0x58cd92=_0x58cd92-0x0;var _0x108413=_0xf5fb[_0x58cd92];return _0x108413;};'use strict';var _=require(_0xbf5f('0x0'));var util=require(_0xbf5f('0x1'));var logger=require('../../config/logger')(_0xbf5f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbf5f('0x3'));var fs=require('fs');var path=require(_0xbf5f('0x4'));var rimraf=require(_0xbf5f('0x5'));var config=require(_0xbf5f('0x6'));var attributes=require('./whatsappQueue.attributes');module[_0xbf5f('0x7')]=function(_0x90f174,_0x342a9b){return _0x90f174['define']('WhatsappQueue',attributes,{'tableName':_0xbf5f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe202=['request-promise','../../config/environment','./whatsappQueue.attributes','exports','whatsapp_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x4b0491,_0x434f3f){var _0x2c2e37=function(_0x5f2bdd){while(--_0x5f2bdd){_0x4b0491['push'](_0x4b0491['shift']());}};_0x2c2e37(++_0x434f3f);}(_0xe202,0xeb));var _0x2e20=function(_0xedd460,_0x1c1a2f){_0xedd460=_0xedd460-0x0;var _0x3528d5=_0xe202[_0xedd460];return _0x3528d5;};'use strict';var _=require('lodash');var util=require(_0x2e20('0x0'));var logger=require(_0x2e20('0x1'))(_0x2e20('0x2'));var moment=require(_0x2e20('0x3'));var BPromise=require(_0x2e20('0x4'));var rp=require(_0x2e20('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2e20('0x6'));var attributes=require(_0x2e20('0x7'));module[_0x2e20('0x8')]=function(_0x73560,_0x7122a1){return _0x73560['define']('WhatsappQueue',attributes,{'tableName':_0x2e20('0x9'),'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 86bebd9..58f85d4 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 _0x4107=['attributes','limit','include','map','model','ShowWhatsappQueue','WhatsappQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./whatsappQueue.socket','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','WhatsappQueue,\x20%s,\x20%s','result','GetWhatsappQueue','findAll','options','raw'];(function(_0x5c9f89,_0x3cbcd2){var _0x5b7c7e=function(_0x4d5e69){while(--_0x4d5e69){_0x5c9f89['push'](_0x5c9f89['shift']());}};_0x5b7c7e(++_0x3cbcd2);}(_0x4107,0xcc));var _0x7410=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x4107[_0x23f8c8];return _0x3dc718;};'use strict';var _=require(_0x7410('0x0'));var util=require(_0x7410('0x1'));var moment=require(_0x7410('0x2'));var BPromise=require(_0x7410('0x3'));var rs=require(_0x7410('0x4'));var fs=require('fs');var Redis=require(_0x7410('0x5'));var db=require(_0x7410('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7410('0x7'))(_0x7410('0x8'));var config=require(_0x7410('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7410('0xa')]({'port':0x232a});config[_0x7410('0xb')]=_[_0x7410('0xc')](config[_0x7410('0xb')],{'host':_0x7410('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7410('0xb')]));require(_0x7410('0xe'))['register'](socket);function respondWithRpcPromise(_0x2a3a43,_0x34701e,_0x2c17ed){return new BPromise(function(_0x48dac2,_0x1eec7b){return client[_0x7410('0xf')](_0x2a3a43,_0x2c17ed)[_0x7410('0x10')](function(_0x230345){logger[_0x7410('0x11')]('WhatsappQueue,\x20%s,\x20%s',_0x34701e,_0x7410('0x12'));logger[_0x7410('0x13')](_0x7410('0x14'),_0x34701e,'request\x20sent',JSON[_0x7410('0x15')](_0x230345));if(_0x230345[_0x7410('0x16')]){if(_0x230345[_0x7410('0x16')]['code']===0x1f4){logger[_0x7410('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x34701e,_0x230345[_0x7410('0x16')][_0x7410('0x17')]);return _0x1eec7b(_0x230345['error'][_0x7410('0x17')]);}logger[_0x7410('0x16')](_0x7410('0x18'),_0x34701e,_0x230345[_0x7410('0x16')][_0x7410('0x17')]);return _0x48dac2(_0x230345[_0x7410('0x16')][_0x7410('0x17')]);}else{logger[_0x7410('0x11')](_0x7410('0x18'),_0x34701e,_0x7410('0x12'));_0x48dac2(_0x230345[_0x7410('0x19')][_0x7410('0x17')]);}})['catch'](function(_0x4170b6){logger[_0x7410('0x16')](_0x7410('0x18'),_0x34701e,_0x4170b6);_0x1eec7b(_0x4170b6);});});}exports[_0x7410('0x1a')]=function(_0x70ba3f){var _0x369252=this;return new Promise(function(_0x5ca328,_0x40a5be){return db['WhatsappQueue'][_0x7410('0x1b')]({'raw':_0x70ba3f[_0x7410('0x1c')]?_0x70ba3f[_0x7410('0x1c')][_0x7410('0x1d')]===undefined?!![]:![]:!![],'where':_0x70ba3f[_0x7410('0x1c')]?_0x70ba3f[_0x7410('0x1c')]['where']||null:null,'attributes':_0x70ba3f[_0x7410('0x1c')]?_0x70ba3f['options'][_0x7410('0x1e')]||null:null,'limit':_0x70ba3f[_0x7410('0x1c')]?_0x70ba3f[_0x7410('0x1c')][_0x7410('0x1f')]||null:null,'include':_0x70ba3f['options']?_0x70ba3f[_0x7410('0x1c')][_0x7410('0x20')]?_[_0x7410('0x21')](_0x70ba3f[_0x7410('0x1c')][_0x7410('0x20')],function(_0x4e59b9){return{'model':db[_0x4e59b9[_0x7410('0x22')]],'as':_0x4e59b9['as'],'attributes':_0x4e59b9[_0x7410('0x1e')],'include':_0x4e59b9['include']?_['map'](_0x4e59b9[_0x7410('0x20')],function(_0x4cee4d){return{'model':db[_0x4cee4d['model']],'as':_0x4cee4d['as'],'attributes':_0x4cee4d[_0x7410('0x1e')],'include':_0x4cee4d['include']?_[_0x7410('0x21')](_0x4cee4d[_0x7410('0x20')],function(_0x59961c){return{'model':db[_0x59961c[_0x7410('0x22')]],'as':_0x59961c['as'],'attributes':_0x59961c['attributes']};}):[]};}):[]};}):[]:[]})[_0x7410('0x10')](function(_0x58a89a){logger[_0x7410('0x11')](_0x7410('0x1a'),_0x70ba3f);logger['debug'](_0x7410('0x1a'),_0x70ba3f,JSON['stringify'](_0x58a89a));_0x5ca328(_0x58a89a);})['catch'](function(_0x5d5afc){logger['error'](_0x7410('0x1a'),_0x5d5afc['message'],_0x70ba3f);_0x40a5be(_0x369252['error'](0x1f4,_0x5d5afc['message']));});});};exports[_0x7410('0x23')]=function(_0x749848){var _0x8095ce=this;return new Promise(function(_0x454115,_0x3c4d50){return db[_0x7410('0x24')][_0x7410('0x25')]({'raw':_0x749848[_0x7410('0x1c')]?_0x749848[_0x7410('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x749848[_0x7410('0x1c')]?_0x749848[_0x7410('0x1c')][_0x7410('0x26')]||null:null,'attributes':_0x749848['options']?_0x749848[_0x7410('0x1c')]['attributes']||null:null,'include':_0x749848[_0x7410('0x1c')]?_0x749848[_0x7410('0x1c')][_0x7410('0x20')]?_['map'](_0x749848[_0x7410('0x1c')]['include'],function(_0x4e542b){return{'model':db[_0x4e542b['model']],'as':_0x4e542b['as'],'attributes':_0x4e542b[_0x7410('0x1e')],'include':_0x4e542b[_0x7410('0x20')]?_[_0x7410('0x21')](_0x4e542b[_0x7410('0x20')],function(_0x41ed33){return{'model':db[_0x41ed33[_0x7410('0x22')]],'as':_0x41ed33['as'],'attributes':_0x41ed33[_0x7410('0x1e')],'include':_0x41ed33['include']?_[_0x7410('0x21')](_0x41ed33[_0x7410('0x20')],function(_0x6c81f){return{'model':db[_0x6c81f['model']],'as':_0x6c81f['as'],'attributes':_0x6c81f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e5069){logger['info']('ShowWhatsappQueue',_0x749848);logger[_0x7410('0x13')](_0x7410('0x23'),_0x749848,JSON[_0x7410('0x15')](_0x3e5069));_0x454115(_0x3e5069);})['catch'](function(_0x18ae06){logger[_0x7410('0x16')](_0x7410('0x23'),_0x18ae06[_0x7410('0x17')],_0x749848);_0x3c4d50(_0x8095ce[_0x7410('0x16')](0x1f4,_0x18ae06[_0x7410('0x17')]));});});}; \ No newline at end of file +var _0x77d9=['include','map','model','then','ShowWhatsappQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','request','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit'];(function(_0x412cac,_0x4f910b){var _0x18c1f1=function(_0x5dc294){while(--_0x5dc294){_0x412cac['push'](_0x412cac['shift']());}};_0x18c1f1(++_0x4f910b);}(_0x77d9,0x80));var _0x977d=function(_0x3a84a5,_0x238da3){_0x3a84a5=_0x3a84a5-0x0;var _0x1f1e6a=_0x77d9[_0x3a84a5];return _0x1f1e6a;};'use strict';var _=require(_0x977d('0x0'));var util=require(_0x977d('0x1'));var moment=require(_0x977d('0x2'));var BPromise=require(_0x977d('0x3'));var rs=require(_0x977d('0x4'));var fs=require('fs');var Redis=require(_0x977d('0x5'));var db=require(_0x977d('0x6'))['db'];var utils=require(_0x977d('0x7'));var logger=require(_0x977d('0x8'))('rpc');var config=require(_0x977d('0x9'));var jayson=require(_0x977d('0xa'));var client=jayson[_0x977d('0xb')][_0x977d('0xc')]({'port':0x232a});config[_0x977d('0xd')]=_[_0x977d('0xe')](config['redis'],{'host':_0x977d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x24988e,_0x361646,_0x4dd417){return new BPromise(function(_0xf6dde1,_0x4955d9){return client[_0x977d('0x10')](_0x24988e,_0x4dd417)['then'](function(_0x10b95f){logger['info'](_0x977d('0x11'),_0x361646,_0x977d('0x12'));logger[_0x977d('0x13')](_0x977d('0x14'),_0x361646,_0x977d('0x12'),JSON[_0x977d('0x15')](_0x10b95f));if(_0x10b95f[_0x977d('0x16')]){if(_0x10b95f['error'][_0x977d('0x17')]===0x1f4){logger[_0x977d('0x16')](_0x977d('0x11'),_0x361646,_0x10b95f['error'][_0x977d('0x18')]);return _0x4955d9(_0x10b95f[_0x977d('0x16')]['message']);}logger[_0x977d('0x16')](_0x977d('0x11'),_0x361646,_0x10b95f[_0x977d('0x16')][_0x977d('0x18')]);return _0xf6dde1(_0x10b95f[_0x977d('0x16')][_0x977d('0x18')]);}else{logger[_0x977d('0x19')](_0x977d('0x11'),_0x361646,_0x977d('0x12'));_0xf6dde1(_0x10b95f[_0x977d('0x1a')][_0x977d('0x18')]);}})[_0x977d('0x1b')](function(_0x22bd66){logger[_0x977d('0x16')](_0x977d('0x11'),_0x361646,_0x22bd66);_0x4955d9(_0x22bd66);});});}exports[_0x977d('0x1c')]=function(_0x3c0fd0){var _0x7179fe=this;return new Promise(function(_0x152877,_0x1f6061){return db[_0x977d('0x1d')][_0x977d('0x1e')]({'raw':_0x3c0fd0[_0x977d('0x1f')]?_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x20')]===undefined?!![]:![]:!![],'where':_0x3c0fd0[_0x977d('0x1f')]?_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x21')]||null:null,'attributes':_0x3c0fd0[_0x977d('0x1f')]?_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x22')]||null:null,'limit':_0x3c0fd0[_0x977d('0x1f')]?_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x23')]||null:null,'include':_0x3c0fd0[_0x977d('0x1f')]?_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x24')]?_['map'](_0x3c0fd0[_0x977d('0x1f')][_0x977d('0x24')],function(_0x14c0ce){return{'model':db[_0x14c0ce['model']],'as':_0x14c0ce['as'],'attributes':_0x14c0ce['attributes'],'include':_0x14c0ce[_0x977d('0x24')]?_[_0x977d('0x25')](_0x14c0ce[_0x977d('0x24')],function(_0x12035c){return{'model':db[_0x12035c['model']],'as':_0x12035c['as'],'attributes':_0x12035c[_0x977d('0x22')],'include':_0x12035c[_0x977d('0x24')]?_[_0x977d('0x25')](_0x12035c[_0x977d('0x24')],function(_0x412690){return{'model':db[_0x412690[_0x977d('0x26')]],'as':_0x412690['as'],'attributes':_0x412690['attributes']};}):[]};}):[]};}):[]:[]})[_0x977d('0x27')](function(_0x493046){logger[_0x977d('0x19')]('GetWhatsappQueue',_0x3c0fd0);logger[_0x977d('0x13')](_0x977d('0x1c'),_0x3c0fd0,JSON[_0x977d('0x15')](_0x493046));_0x152877(_0x493046);})['catch'](function(_0x5384da){logger['error'](_0x977d('0x1c'),_0x5384da[_0x977d('0x18')],_0x3c0fd0);_0x1f6061(_0x7179fe[_0x977d('0x16')](0x1f4,_0x5384da[_0x977d('0x18')]));});});};exports[_0x977d('0x28')]=function(_0xb6331a){var _0x14c3b8=this;return new Promise(function(_0x1596eb,_0x5b2ec5){return db['WhatsappQueue']['find']({'raw':_0xb6331a[_0x977d('0x1f')]?_0xb6331a[_0x977d('0x1f')][_0x977d('0x20')]===undefined?!![]:![]:!![],'where':_0xb6331a['options']?_0xb6331a[_0x977d('0x1f')]['where']||null:null,'attributes':_0xb6331a[_0x977d('0x1f')]?_0xb6331a[_0x977d('0x1f')][_0x977d('0x22')]||null:null,'include':_0xb6331a[_0x977d('0x1f')]?_0xb6331a[_0x977d('0x1f')][_0x977d('0x24')]?_[_0x977d('0x25')](_0xb6331a['options'][_0x977d('0x24')],function(_0x334704){return{'model':db[_0x334704[_0x977d('0x26')]],'as':_0x334704['as'],'attributes':_0x334704[_0x977d('0x22')],'include':_0x334704['include']?_[_0x977d('0x25')](_0x334704['include'],function(_0x4208ad){return{'model':db[_0x4208ad[_0x977d('0x26')]],'as':_0x4208ad['as'],'attributes':_0x4208ad['attributes'],'include':_0x4208ad['include']?_[_0x977d('0x25')](_0x4208ad[_0x977d('0x24')],function(_0x3f6bd5){return{'model':db[_0x3f6bd5[_0x977d('0x26')]],'as':_0x3f6bd5['as'],'attributes':_0x3f6bd5['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x461cbe){logger[_0x977d('0x19')](_0x977d('0x28'),_0xb6331a);logger[_0x977d('0x13')]('ShowWhatsappQueue',_0xb6331a,JSON[_0x977d('0x15')](_0x461cbe));_0x1596eb(_0x461cbe);})[_0x977d('0x1b')](function(_0x45f755){logger[_0x977d('0x16')]('ShowWhatsappQueue',_0x45f755[_0x977d('0x18')],_0xb6331a);_0x5b2ec5(_0x14c3b8['error'](0x1f4,_0x45f755['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b215649..3e222a8 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 _0x8fc0=['update','emit','removeListener','register','length','whatsappQueue:','remove'];(function(_0x2e124d,_0x1fda78){var _0x30786a=function(_0x2ae531){while(--_0x2ae531){_0x2e124d['push'](_0x2e124d['shift']());}};_0x30786a(++_0x1fda78);}(_0x8fc0,0x1e9));var _0x08fc=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x8fc0[_0x42bdad];return _0x122626;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=['save',_0x08fc('0x0'),_0x08fc('0x1')];function createListener(_0x477eb5,_0x409c6c){return function(_0x373218){_0x409c6c[_0x08fc('0x2')](_0x477eb5,_0x373218);};}function removeListener(_0x197f7a,_0x1c75bc){return function(){WhatsappQueueEvents[_0x08fc('0x3')](_0x197f7a,_0x1c75bc);};}exports[_0x08fc('0x4')]=function(_0x5c6997){for(var _0x53ecdd=0x0,_0x37abd2=events[_0x08fc('0x5')];_0x53ecdd<_0x37abd2;_0x53ecdd++){var _0x1c14ba=events[_0x53ecdd];var _0x35ec91=createListener(_0x08fc('0x6')+_0x1c14ba,_0x5c6997);WhatsappQueueEvents['on'](_0x1c14ba,_0x35ec91);}}; \ No newline at end of file +var _0x3c26=['save','remove','update','emit','removeListener','register','./whatsappQueue.events'];(function(_0x4d0810,_0x13e15f){var _0x3e47e0=function(_0x202853){while(--_0x202853){_0x4d0810['push'](_0x4d0810['shift']());}};_0x3e47e0(++_0x13e15f);}(_0x3c26,0x1aa));var _0x63c2=function(_0x1a8c2e,_0x2a0734){_0x1a8c2e=_0x1a8c2e-0x0;var _0x188e33=_0x3c26[_0x1a8c2e];return _0x188e33;};'use strict';var WhatsappQueueEvents=require(_0x63c2('0x0'));var events=[_0x63c2('0x1'),_0x63c2('0x2'),_0x63c2('0x3')];function createListener(_0x20fce2,_0x4de36f){return function(_0x1f8261){_0x4de36f[_0x63c2('0x4')](_0x20fce2,_0x1f8261);};}function removeListener(_0x5940c6,_0x549c50){return function(){WhatsappQueueEvents[_0x63c2('0x5')](_0x5940c6,_0x549c50);};}exports[_0x63c2('0x6')]=function(_0x196770){for(var _0x28046d=0x0,_0x1a168c=events['length'];_0x28046d<_0x1a168c;_0x28046d++){var _0x3258fd=events[_0x28046d];var _0x2142f0=createListener('whatsappQueue:'+_0x3258fd,_0x196770);WhatsappQueueEvents['on'](_0x3258fd,_0x2142f0);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index efcd2cf..8117e9a 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 _0xfe66=['get','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','index','describe'];(function(_0x289ccb,_0x3e4c5e){var _0x29df89=function(_0x2b49b8){while(--_0x2b49b8){_0x289ccb['push'](_0x289ccb['shift']());}};_0x29df89(++_0x3e4c5e);}(_0xfe66,0xe6));var _0x6fe6=function(_0x257a28,_0x2cd00d){_0x257a28=_0x257a28-0x0;var _0x13bccc=_0xfe66[_0x257a28];return _0x13bccc;};'use strict';var multer=require(_0x6fe6('0x0'));var util=require(_0x6fe6('0x1'));var path=require(_0x6fe6('0x2'));var timeout=require(_0x6fe6('0x3'));var express=require(_0x6fe6('0x4'));var router=express[_0x6fe6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6fe6('0x6'));var interaction=require(_0x6fe6('0x7'));var config=require(_0x6fe6('0x8'));var controller=require(_0x6fe6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x6fe6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6fe6('0xb')]);router[_0x6fe6('0xc')](_0x6fe6('0xd'),auth[_0x6fe6('0xe')](),controller[_0x6fe6('0xf')]);router[_0x6fe6('0x10')]('/',auth['isAuthenticated'](),controller[_0x6fe6('0x11')]);router[_0x6fe6('0x12')](_0x6fe6('0xd'),auth[_0x6fe6('0xe')](),controller[_0x6fe6('0x13')]);router['delete'](_0x6fe6('0xd'),auth[_0x6fe6('0xe')](),controller[_0x6fe6('0x14')]);module[_0x6fe6('0x15')]=router; \ No newline at end of file +var _0x08a3=['../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','connect-timeout','Router','../../components/interaction/service'];(function(_0x5ce17e,_0x1a6dd4){var _0x2ed753=function(_0x4bd044){while(--_0x4bd044){_0x5ce17e['push'](_0x5ce17e['shift']());}};_0x2ed753(++_0x1a6dd4);}(_0x08a3,0x1ad));var _0x308a=function(_0x21717a,_0x33f542){_0x21717a=_0x21717a-0x0;var _0x396c2f=_0x08a3[_0x21717a];return _0x396c2f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x308a('0x0'));var express=require('express');var router=express[_0x308a('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x308a('0x2'));var config=require(_0x308a('0x3'));var controller=require(_0x308a('0x4'));router[_0x308a('0x5')]('/',auth[_0x308a('0x6')](),controller[_0x308a('0x7')]);router[_0x308a('0x5')](_0x308a('0x8'),auth[_0x308a('0x6')](),controller[_0x308a('0x9')]);router[_0x308a('0x5')](_0x308a('0xa'),auth['isAuthenticated'](),controller[_0x308a('0xb')]);router[_0x308a('0xc')]('/',auth['isAuthenticated'](),controller[_0x308a('0xd')]);router[_0x308a('0xe')](_0x308a('0xa'),auth[_0x308a('0x6')](),controller['update']);router[_0x308a('0xf')](_0x308a('0xa'),auth[_0x308a('0x6')](),controller[_0x308a('0x10')]);module[_0x308a('0x11')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index bcefd7a..1da7cce 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(_0x245c40,_0x2bfc74){var _0x501748=function(_0x406a2c){while(--_0x406a2c){_0x245c40['push'](_0x245c40['shift']());}};_0x501748(++_0x2bfc74);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x44139e,_0x4119ff){var _0x56eb5a=function(_0x8d40ba){while(--_0x8d40ba){_0x44139e['push'](_0x44139e['shift']());}};_0x56eb5a(++_0x4119ff);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 89f6026..6f96e31 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe511=['destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','save','update','then','error','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','WhatsappQueueReport','findAll','catch','show','params','rawAttributes','find','create','body'];(function(_0x4f19f9,_0x2ad048){var _0x2f2233=function(_0x51e210){while(--_0x51e210){_0x4f19f9['push'](_0x4f19f9['shift']());}};_0x2f2233(++_0x2ad048);}(_0xe511,0x16f));var _0x1e51=function(_0x1c74db,_0x474b8a){_0x1c74db=_0x1c74db-0x0;var _0x47b019=_0xe511[_0x1c74db];return _0x47b019;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];function respondWithStatusCode(_0x3c5330,_0x5544eb){_0x5544eb=_0x5544eb||0xcc;return function(_0x408a77){if(_0x408a77){return _0x3c5330[_0x1e51('0x18')](_0x5544eb);}return _0x3c5330[_0x1e51('0x19')](_0x5544eb)[_0x1e51('0x1a')]();};}function respondWithResult(_0x21bcbd,_0x32945d){_0x32945d=_0x32945d||0xc8;return function(_0x441c70){if(_0x441c70){return _0x21bcbd[_0x1e51('0x19')](_0x32945d)[_0x1e51('0x1b')](_0x441c70);}};}function respondWithFilteredResult(_0xd76fba,_0x5a5c07){return function(_0x3b01b7){if(_0x3b01b7){var _0x24db4f=typeof _0x5a5c07[_0x1e51('0x1c')]==='undefined'&&typeof _0x5a5c07[_0x1e51('0x1d')]==='undefined';var _0x53d222=_0x3b01b7[_0x1e51('0x1e')];var _0x27dcad=_0x24db4f?0x0:_0x5a5c07[_0x1e51('0x1c')];var _0x4785a5=_0x24db4f?_0x3b01b7[_0x1e51('0x1e')]:_0x5a5c07[_0x1e51('0x1c')]+_0x5a5c07['limit'];var _0x39449b;if(_0x4785a5>=_0x53d222){_0x4785a5=_0x53d222;_0x39449b=0xc8;}else{_0x39449b=0xce;}_0xd76fba['status'](_0x39449b);return _0xd76fba[_0x1e51('0x1f')](_0x1e51('0x20'),_0x27dcad+'-'+_0x4785a5+'/'+_0x53d222)[_0x1e51('0x1b')](_0x3b01b7);}return null;};}function patchUpdates(_0x183a95){return function(_0x506f40){try{jsonpatch['apply'](_0x506f40,_0x183a95,!![]);}catch(_0x4e6a49){return BPromise['reject'](_0x4e6a49);}return _0x506f40[_0x1e51('0x21')]();};}function saveUpdates(_0x4f1f56,_0x3f7340){return function(_0x28aacb){if(_0x28aacb){return _0x28aacb[_0x1e51('0x22')](_0x4f1f56)[_0x1e51('0x23')](function(_0x23c85a){return _0x23c85a;});}return null;};}function removeEntity(_0xf9298,_0x270adf){return function(_0x461d3d){if(_0x461d3d){return _0x461d3d['destroy']()['then'](function(){_0xf9298[_0x1e51('0x19')](0xcc)[_0x1e51('0x1a')]();});}};}function handleEntityNotFound(_0x2e42b1,_0x1386db){return function(_0x505d79){if(!_0x505d79){_0x2e42b1['sendStatus'](0x194);}return _0x505d79;};}function handleError(_0x486ad6,_0x1eb83f){_0x1eb83f=_0x1eb83f||0x1f4;return function(_0x2a1561){logger[_0x1e51('0x24')](_0x2a1561['stack']);if(_0x2a1561[_0x1e51('0x25')]){delete _0x2a1561['name'];}_0x486ad6['status'](_0x1eb83f)[_0x1e51('0x26')](_0x2a1561);};}exports['index']=function(_0x170ec6,_0x1eb79f){var _0x56722f={},_0x3e6ef2={},_0x10ee23={'count':0x0,'rows':[]};var _0x71c7af=_[_0x1e51('0x27')](db['WhatsappQueueReport']['rawAttributes'],function(_0x4f67d3){return{'name':_0x4f67d3[_0x1e51('0x28')],'type':_0x4f67d3[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x3e6ef2[_0x1e51('0x2b')]=_[_0x1e51('0x27')](_0x71c7af,_0x1e51('0x25'));_0x3e6ef2[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x170ec6[_0x1e51('0x2c')]);_0x3e6ef2[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x3e6ef2['model'],_0x3e6ef2[_0x1e51('0x2c')]);_0x56722f[_0x1e51('0x30')]=_[_0x1e51('0x2f')](_0x3e6ef2[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x170ec6['query'][_0x1e51('0x31')]));_0x56722f['attributes']=_0x56722f[_0x1e51('0x30')][_0x1e51('0x32')]?_0x56722f[_0x1e51('0x30')]:_0x3e6ef2['model'];if(!_0x170ec6[_0x1e51('0x2c')]['hasOwnProperty'](_0x1e51('0x33'))){_0x56722f['limit']=qs['limit'](_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x1d')]);_0x56722f[_0x1e51('0x1c')]=qs['offset'](_0x170ec6[_0x1e51('0x2c')]['offset']);}_0x56722f[_0x1e51('0x34')]=qs[_0x1e51('0x35')](_0x170ec6['query'][_0x1e51('0x35')]);_0x56722f[_0x1e51('0x36')]=qs[_0x1e51('0x2e')](_[_0x1e51('0x37')](_0x170ec6[_0x1e51('0x2c')],_0x3e6ef2[_0x1e51('0x2e')]),_0x71c7af);if(_0x170ec6['query']['filter']){_0x56722f[_0x1e51('0x36')]=_['merge'](_0x56722f[_0x1e51('0x36')],{'$or':_[_0x1e51('0x27')](_0x71c7af,function(_0x32c41b){if(_0x32c41b[_0x1e51('0x29')]!==_0x1e51('0x38')){var _0x174a24={};_0x174a24[_0x32c41b[_0x1e51('0x25')]]={'$like':'%'+_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x39')]+'%'};return _0x174a24;}})});}_0x56722f=_[_0x1e51('0x3a')]({},_0x56722f,_0x170ec6[_0x1e51('0x3b')]);var _0x5360b3={'where':_0x56722f[_0x1e51('0x36')]};return db['WhatsappQueueReport'][_0x1e51('0x1e')](_0x5360b3)[_0x1e51('0x23')](function(_0x2b287e){_0x10ee23[_0x1e51('0x1e')]=_0x2b287e;if(_0x170ec6[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x56722f[_0x1e51('0x3d')]=[{'all':!![]}];}return db[_0x1e51('0x3e')][_0x1e51('0x3f')](_0x56722f);})[_0x1e51('0x23')](function(_0xc40fce){_0x10ee23['rows']=_0xc40fce;return _0x10ee23;})['then'](respondWithFilteredResult(_0x1eb79f,_0x56722f))[_0x1e51('0x40')](handleError(_0x1eb79f,null));};exports[_0x1e51('0x41')]=function(_0x3be495,_0x4650e4){var _0x1ef3d3={'raw':!![],'where':{'id':_0x3be495[_0x1e51('0x42')]['id']}},_0x1a9e0d={};_0x1a9e0d[_0x1e51('0x2b')]=_['keys'](db[_0x1e51('0x3e')][_0x1e51('0x43')]);_0x1a9e0d[_0x1e51('0x2c')]=_[_0x1e51('0x2d')](_0x3be495[_0x1e51('0x2c')]);_0x1a9e0d[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1a9e0d['model'],_0x1a9e0d[_0x1e51('0x2c')]);_0x1ef3d3[_0x1e51('0x30')]=_['intersection'](_0x1a9e0d[_0x1e51('0x2b')],qs[_0x1e51('0x31')](_0x3be495[_0x1e51('0x2c')]['fields']));_0x1ef3d3[_0x1e51('0x30')]=_0x1ef3d3[_0x1e51('0x30')][_0x1e51('0x32')]?_0x1ef3d3[_0x1e51('0x30')]:_0x1a9e0d[_0x1e51('0x2b')];if(_0x3be495[_0x1e51('0x2c')][_0x1e51('0x3c')]){_0x1ef3d3[_0x1e51('0x3d')]=[{'all':!![]}];}_0x1ef3d3=_[_0x1e51('0x3a')]({},_0x1ef3d3,_0x3be495['options']);return db[_0x1e51('0x3e')][_0x1e51('0x44')](_0x1ef3d3)['then'](handleEntityNotFound(_0x4650e4,null))[_0x1e51('0x23')](respondWithResult(_0x4650e4,null))[_0x1e51('0x40')](handleError(_0x4650e4,null));};exports[_0x1e51('0x45')]=function(_0x4f6405,_0x44468a){return db[_0x1e51('0x3e')][_0x1e51('0x45')](_0x4f6405['body'],{})[_0x1e51('0x23')](respondWithResult(_0x44468a,0xc9))['catch'](handleError(_0x44468a,null));};exports['update']=function(_0x54688b,_0x169e6c){if(_0x54688b[_0x1e51('0x46')]['id']){delete _0x54688b['body']['id'];}return db['WhatsappQueueReport'][_0x1e51('0x44')]({'where':{'id':_0x54688b[_0x1e51('0x42')]['id']}})[_0x1e51('0x23')](handleEntityNotFound(_0x169e6c,null))[_0x1e51('0x23')](saveUpdates(_0x54688b[_0x1e51('0x46')],null))[_0x1e51('0x23')](respondWithResult(_0x169e6c,null))['catch'](handleError(_0x169e6c,null));};exports[_0x1e51('0x47')]=function(_0x48a2d0,_0xf6bd35){return db[_0x1e51('0x3e')]['find']({'where':{'id':_0x48a2d0['params']['id']}})['then'](handleEntityNotFound(_0xf6bd35,null))[_0x1e51('0x23')](removeEntity(_0xf6bd35,null))[_0x1e51('0x40')](handleError(_0xf6bd35,null));};exports[_0x1e51('0x48')]=function(_0x4cdfe3,_0x2fdee1){return db[_0x1e51('0x3e')][_0x1e51('0x48')]()[_0x1e51('0x23')](respondWithResult(_0x2fdee1,null))[_0x1e51('0x40')](handleError(_0x2fdee1,null));}; \ No newline at end of file +var _0xe820=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','WhatsappQueueReport','rawAttributes','key','map','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0x327653,_0x2c0154){var _0x28448f=function(_0x1df0d2){while(--_0x1df0d2){_0x327653['push'](_0x327653['shift']());}};_0x28448f(++_0x2c0154);}(_0xe820,0xd2));var _0x0e82=function(_0x4cb66c,_0x3a9117){_0x4cb66c=_0x4cb66c-0x0;var _0x43ce82=_0xe820[_0x4cb66c];return _0x43ce82;};'use strict';var emlformat=require(_0x0e82('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0e82('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e82('0x2'));var BPromise=require(_0x0e82('0x3'));var Mustache=require(_0x0e82('0x4'));var util=require('util');var path=require(_0x0e82('0x5'));var sox=require('sox');var csv=require(_0x0e82('0x6'));var ejs=require(_0x0e82('0x7'));var fs=require('fs');var fs_extra=require(_0x0e82('0x8'));var _=require(_0x0e82('0x9'));var squel=require(_0x0e82('0xa'));var crypto=require('crypto');var jsforce=require(_0x0e82('0xb'));var deskjs=require(_0x0e82('0xc'));var toCsv=require(_0x0e82('0x6'));var querystring=require(_0x0e82('0xd'));var Papa=require(_0x0e82('0xe'));var Redis=require('ioredis');var authService=require(_0x0e82('0xf'));var qs=require(_0x0e82('0x10'));var as=require(_0x0e82('0x11'));var hardwareService=require(_0x0e82('0x12'));var logger=require(_0x0e82('0x13'))(_0x0e82('0x14'));var utils=require(_0x0e82('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e82('0x16'));var db=require(_0x0e82('0x17'))['db'];function respondWithStatusCode(_0x21c40b,_0x1da28a){_0x1da28a=_0x1da28a||0xcc;return function(_0x166dc2){if(_0x166dc2){return _0x21c40b[_0x0e82('0x18')](_0x1da28a);}return _0x21c40b['status'](_0x1da28a)[_0x0e82('0x19')]();};}function respondWithResult(_0x5c161c,_0x48d99b){_0x48d99b=_0x48d99b||0xc8;return function(_0x1e4ddb){if(_0x1e4ddb){return _0x5c161c['status'](_0x48d99b)['json'](_0x1e4ddb);}};}function respondWithFilteredResult(_0x5a2d28,_0x3298c7){return function(_0x4d1aa0){if(_0x4d1aa0){var _0x585b9b=typeof _0x3298c7[_0x0e82('0x1a')]==='undefined'&&typeof _0x3298c7[_0x0e82('0x1b')]===_0x0e82('0x1c');var _0x233c6d=_0x4d1aa0[_0x0e82('0x1d')];var _0x53622b=_0x585b9b?0x0:_0x3298c7[_0x0e82('0x1a')];var _0x310aac=_0x585b9b?_0x4d1aa0[_0x0e82('0x1d')]:_0x3298c7[_0x0e82('0x1a')]+_0x3298c7[_0x0e82('0x1b')];var _0x1230e6;if(_0x310aac>=_0x233c6d){_0x310aac=_0x233c6d;_0x1230e6=0xc8;}else{_0x1230e6=0xce;}_0x5a2d28[_0x0e82('0x1e')](_0x1230e6);return _0x5a2d28[_0x0e82('0x1f')](_0x0e82('0x20'),_0x53622b+'-'+_0x310aac+'/'+_0x233c6d)[_0x0e82('0x21')](_0x4d1aa0);}return null;};}function patchUpdates(_0x5903c){return function(_0x493280){try{jsonpatch['apply'](_0x493280,_0x5903c,!![]);}catch(_0x294696){return BPromise[_0x0e82('0x22')](_0x294696);}return _0x493280[_0x0e82('0x23')]();};}function saveUpdates(_0xb0a31,_0xd48046){return function(_0x1bdad4){if(_0x1bdad4){return _0x1bdad4[_0x0e82('0x24')](_0xb0a31)[_0x0e82('0x25')](function(_0x56b3ad){return _0x56b3ad;});}return null;};}function removeEntity(_0x1b71b4,_0x13f023){return function(_0x3d6c28){if(_0x3d6c28){return _0x3d6c28[_0x0e82('0x26')]()['then'](function(){_0x1b71b4[_0x0e82('0x1e')](0xcc)[_0x0e82('0x19')]();});}};}function handleEntityNotFound(_0x7a9399,_0x16e11c){return function(_0x4900d3){if(!_0x4900d3){_0x7a9399[_0x0e82('0x18')](0x194);}return _0x4900d3;};}function handleError(_0x51dbcd,_0x595319){_0x595319=_0x595319||0x1f4;return function(_0x384f88){logger[_0x0e82('0x27')](_0x384f88['stack']);if(_0x384f88[_0x0e82('0x28')]){delete _0x384f88[_0x0e82('0x28')];}_0x51dbcd[_0x0e82('0x1e')](_0x595319)['send'](_0x384f88);};}exports[_0x0e82('0x29')]=function(_0x25fa4e,_0x4ee65a){var _0xabc536={},_0x59a5b6={},_0x4300f9={'count':0x0,'rows':[]};var _0x3ec302=_['map'](db[_0x0e82('0x2a')][_0x0e82('0x2b')],function(_0x661718){return{'name':_0x661718['fieldName'],'type':_0x661718['type'][_0x0e82('0x2c')]};});_0x59a5b6['model']=_[_0x0e82('0x2d')](_0x3ec302,'name');_0x59a5b6[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x25fa4e[_0x0e82('0x2e')]);_0x59a5b6['filters']=_[_0x0e82('0x30')](_0x59a5b6['model'],_0x59a5b6[_0x0e82('0x2e')]);_0xabc536[_0x0e82('0x31')]=_[_0x0e82('0x30')](_0x59a5b6[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x25fa4e[_0x0e82('0x2e')]['fields']));_0xabc536[_0x0e82('0x31')]=_0xabc536[_0x0e82('0x31')][_0x0e82('0x34')]?_0xabc536[_0x0e82('0x31')]:_0x59a5b6[_0x0e82('0x32')];if(!_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x35')](_0x0e82('0x36'))){_0xabc536[_0x0e82('0x1b')]=qs[_0x0e82('0x1b')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x1b')]);_0xabc536[_0x0e82('0x1a')]=qs[_0x0e82('0x1a')](_0x25fa4e[_0x0e82('0x2e')]['offset']);}_0xabc536[_0x0e82('0x37')]=qs[_0x0e82('0x38')](_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x38')]);_0xabc536['where']=qs[_0x0e82('0x39')](_[_0x0e82('0x3a')](_0x25fa4e['query'],_0x59a5b6[_0x0e82('0x39')]),_0x3ec302);if(_0x25fa4e['query']['filter']){_0xabc536[_0x0e82('0x3b')]=_[_0x0e82('0x3c')](_0xabc536[_0x0e82('0x3b')],{'$or':_[_0x0e82('0x2d')](_0x3ec302,function(_0x61a5ce){if(_0x61a5ce[_0x0e82('0x3d')]!==_0x0e82('0x3e')){var _0x50fed8={};_0x50fed8[_0x61a5ce['name']]={'$like':'%'+_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x3f')]+'%'};return _0x50fed8;}})});}_0xabc536=_[_0x0e82('0x3c')]({},_0xabc536,_0x25fa4e[_0x0e82('0x40')]);var _0x265872={'where':_0xabc536[_0x0e82('0x3b')]};return db[_0x0e82('0x2a')][_0x0e82('0x1d')](_0x265872)['then'](function(_0x3ba181){_0x4300f9[_0x0e82('0x1d')]=_0x3ba181;if(_0x25fa4e[_0x0e82('0x2e')][_0x0e82('0x41')]){_0xabc536[_0x0e82('0x42')]=[{'all':!![]}];}return db[_0x0e82('0x2a')][_0x0e82('0x43')](_0xabc536);})['then'](function(_0x311cb8){_0x4300f9[_0x0e82('0x44')]=_0x311cb8;return _0x4300f9;})[_0x0e82('0x25')](respondWithFilteredResult(_0x4ee65a,_0xabc536))[_0x0e82('0x45')](handleError(_0x4ee65a,null));};exports[_0x0e82('0x46')]=function(_0x423b14,_0x453cd3){var _0x50322b={'raw':!![],'where':{'id':_0x423b14['params']['id']}},_0x581764={};_0x581764['model']=_['keys'](db['WhatsappQueueReport'][_0x0e82('0x2b')]);_0x581764[_0x0e82('0x2e')]=_[_0x0e82('0x2f')](_0x423b14[_0x0e82('0x2e')]);_0x581764[_0x0e82('0x39')]=_[_0x0e82('0x30')](_0x581764[_0x0e82('0x32')],_0x581764[_0x0e82('0x2e')]);_0x50322b['attributes']=_['intersection'](_0x581764[_0x0e82('0x32')],qs[_0x0e82('0x33')](_0x423b14[_0x0e82('0x2e')][_0x0e82('0x33')]));_0x50322b[_0x0e82('0x31')]=_0x50322b[_0x0e82('0x31')][_0x0e82('0x34')]?_0x50322b[_0x0e82('0x31')]:_0x581764['model'];if(_0x423b14[_0x0e82('0x2e')]['includeAll']){_0x50322b[_0x0e82('0x42')]=[{'all':!![]}];}_0x50322b=_['merge']({},_0x50322b,_0x423b14[_0x0e82('0x40')]);return db['WhatsappQueueReport'][_0x0e82('0x47')](_0x50322b)[_0x0e82('0x25')](handleEntityNotFound(_0x453cd3,null))[_0x0e82('0x25')](respondWithResult(_0x453cd3,null))['catch'](handleError(_0x453cd3,null));};exports['create']=function(_0x331668,_0x132c45){return db[_0x0e82('0x2a')]['create'](_0x331668[_0x0e82('0x48')],{})['then'](respondWithResult(_0x132c45,0xc9))[_0x0e82('0x45')](handleError(_0x132c45,null));};exports[_0x0e82('0x24')]=function(_0x162890,_0x64406e){if(_0x162890[_0x0e82('0x48')]['id']){delete _0x162890[_0x0e82('0x48')]['id'];}return db[_0x0e82('0x2a')][_0x0e82('0x47')]({'where':{'id':_0x162890[_0x0e82('0x49')]['id']}})[_0x0e82('0x25')](handleEntityNotFound(_0x64406e,null))[_0x0e82('0x25')](saveUpdates(_0x162890[_0x0e82('0x48')],null))['then'](respondWithResult(_0x64406e,null))[_0x0e82('0x45')](handleError(_0x64406e,null));};exports[_0x0e82('0x26')]=function(_0x576726,_0x360858){return db['WhatsappQueueReport']['find']({'where':{'id':_0x576726[_0x0e82('0x49')]['id']}})['then'](handleEntityNotFound(_0x360858,null))[_0x0e82('0x25')](removeEntity(_0x360858,null))[_0x0e82('0x45')](handleError(_0x360858,null));};exports[_0x0e82('0x4a')]=function(_0x149100,_0xdbb813){return db['WhatsappQueueReport'][_0x0e82('0x4a')]()['then'](respondWithResult(_0xdbb813,null))[_0x0e82('0x45')](handleError(_0xdbb813,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1412b80..90f1fee 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 _0xef6c=['request-promise','path','rimraf','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x8df2bf,_0x42b29b){var _0x267fc3=function(_0x334709){while(--_0x334709){_0x8df2bf['push'](_0x8df2bf['shift']());}};_0x267fc3(++_0x42b29b);}(_0xef6c,0x1a0));var _0xcef6=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0xef6c[_0x3ccdf8];return _0x243dab;};'use strict';var _=require(_0xcef6('0x0'));var util=require('util');var logger=require(_0xcef6('0x1'))(_0xcef6('0x2'));var moment=require(_0xcef6('0x3'));var BPromise=require('bluebird');var rp=require(_0xcef6('0x4'));var fs=require('fs');var path=require(_0xcef6('0x5'));var rimraf=require(_0xcef6('0x6'));var config=require('../../config/environment');var attributes=require(_0xcef6('0x7'));module[_0xcef6('0x8')]=function(_0x4d4968,_0x3e6e5a){return _0x4d4968[_0xcef6('0x9')](_0xcef6('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xcef6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xaee7=['WhatsappQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0xaee7,0x16e));var _0x7aee=function(_0x31aa68,_0x56c65c){_0x31aa68=_0x31aa68-0x0;var _0x40415b=_0xaee7[_0x31aa68];return _0x40415b;};'use strict';var _=require('lodash');var util=require(_0x7aee('0x0'));var logger=require(_0x7aee('0x1'))(_0x7aee('0x2'));var moment=require('moment');var BPromise=require(_0x7aee('0x3'));var rp=require(_0x7aee('0x4'));var fs=require('fs');var path=require(_0x7aee('0x5'));var rimraf=require(_0x7aee('0x6'));var config=require(_0x7aee('0x7'));var attributes=require(_0x7aee('0x8'));module[_0x7aee('0x9')]=function(_0x1aacc3,_0x160863){return _0x1aacc3[_0x7aee('0xa')](_0x7aee('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7aee('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 d71a151..bc1ace8 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 _0x7cc9=['../../config/logger','rpc','../../config/environment','jayson/promise','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','attributes','limit','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7cc9,0x16d));var _0x97cc=function(_0x21aa5b,_0x2c808f){_0x21aa5b=_0x21aa5b-0x0;var _0x2ca4c8=_0x7cc9[_0x21aa5b];return _0x2ca4c8;};'use strict';var _=require(_0x97cc('0x0'));var util=require('util');var moment=require(_0x97cc('0x1'));var BPromise=require(_0x97cc('0x2'));var rs=require(_0x97cc('0x3'));var fs=require('fs');var Redis=require(_0x97cc('0x4'));var db=require(_0x97cc('0x5'))['db'];var utils=require(_0x97cc('0x6'));var logger=require(_0x97cc('0x7'))(_0x97cc('0x8'));var config=require(_0x97cc('0x9'));var jayson=require(_0x97cc('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1796de,_0xf17ed2,_0x3f1d94){return new BPromise(function(_0x454a8a,_0x24dec2){return client['request'](_0x1796de,_0x3f1d94)[_0x97cc('0xb')](function(_0x3eefd9){logger[_0x97cc('0xc')](_0x97cc('0xd'),_0xf17ed2,_0x97cc('0xe'));logger[_0x97cc('0xf')](_0x97cc('0x10'),_0xf17ed2,_0x97cc('0xe'),JSON[_0x97cc('0x11')](_0x3eefd9));if(_0x3eefd9[_0x97cc('0x12')]){if(_0x3eefd9[_0x97cc('0x12')]['code']===0x1f4){logger['error'](_0x97cc('0xd'),_0xf17ed2,_0x3eefd9[_0x97cc('0x12')][_0x97cc('0x13')]);return _0x24dec2(_0x3eefd9[_0x97cc('0x12')][_0x97cc('0x13')]);}logger['error'](_0x97cc('0xd'),_0xf17ed2,_0x3eefd9[_0x97cc('0x12')][_0x97cc('0x13')]);return _0x454a8a(_0x3eefd9['error'][_0x97cc('0x13')]);}else{logger['info'](_0x97cc('0xd'),_0xf17ed2,_0x97cc('0xe'));_0x454a8a(_0x3eefd9[_0x97cc('0x14')][_0x97cc('0x13')]);}})['catch'](function(_0x4f8526){logger[_0x97cc('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0xf17ed2,_0x4f8526);_0x24dec2(_0x4f8526);});});}exports[_0x97cc('0x15')]=function(_0x390b71){var _0x5cca65=this;return new Promise(function(_0x38fdf5,_0x3985c2){return db[_0x97cc('0x16')][_0x97cc('0x17')](_0x390b71[_0x97cc('0x18')],{'raw':_0x390b71[_0x97cc('0x19')]?_0x390b71[_0x97cc('0x19')][_0x97cc('0x1a')]===undefined?!![]:![]:!![]})[_0x97cc('0xb')](function(_0x225b48){logger[_0x97cc('0xc')](_0x97cc('0x15'),_0x390b71);logger[_0x97cc('0xf')]('CreateWhatsappQueueReport',_0x390b71,JSON[_0x97cc('0x11')](_0x225b48));_0x38fdf5(_0x225b48);})['catch'](function(_0x23ab4a){logger[_0x97cc('0x12')](_0x97cc('0x15'),_0x23ab4a[_0x97cc('0x13')],_0x390b71);_0x3985c2(_0x5cca65[_0x97cc('0x12')](0x1f4,_0x23ab4a[_0x97cc('0x13')]));});});};exports[_0x97cc('0x1b')]=function(_0x1e4496){var _0x33c932=this;return new Promise(function(_0x2ba4fa,_0xac2f4a){return db[_0x97cc('0x16')]['update'](_0x1e4496[_0x97cc('0x18')],{'raw':_0x1e4496[_0x97cc('0x19')]?_0x1e4496[_0x97cc('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e4496[_0x97cc('0x19')]?_0x1e4496[_0x97cc('0x19')]['where']||null:null,'attributes':_0x1e4496[_0x97cc('0x19')]?_0x1e4496[_0x97cc('0x19')][_0x97cc('0x1c')]||null:null,'limit':_0x1e4496[_0x97cc('0x19')]?_0x1e4496['options'][_0x97cc('0x1d')]||null:null})[_0x97cc('0xb')](function(_0xdc394c){logger['info'](_0x97cc('0x1b'),_0x1e4496);logger['debug']('UpdateWhatsappQueueReport',_0x1e4496,JSON[_0x97cc('0x11')](_0xdc394c));_0x2ba4fa(_0xdc394c);})[_0x97cc('0x1e')](function(_0x31c941){logger[_0x97cc('0x12')](_0x97cc('0x1b'),_0x31c941[_0x97cc('0x13')],_0x1e4496);_0xac2f4a(_0x33c932[_0x97cc('0x12')](0x1f4,_0x31c941[_0x97cc('0x13')]));});});}; \ No newline at end of file +var _0x2e35=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','stringify','raw','where','attributes','UpdateWhatsappQueueReport','lodash','bluebird'];(function(_0x36613c,_0x39680e){var _0x16daf3=function(_0xd82cd8){while(--_0xd82cd8){_0x36613c['push'](_0x36613c['shift']());}};_0x16daf3(++_0x39680e);}(_0x2e35,0x166));var _0x52e3=function(_0xeb35e3,_0x48e58e){_0xeb35e3=_0xeb35e3-0x0;var _0x365553=_0x2e35[_0xeb35e3];return _0x365553;};'use strict';var _=require(_0x52e3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x52e3('0x1'));var rs=require(_0x52e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e3('0x3'))['db'];var utils=require(_0x52e3('0x4'));var logger=require('../../config/logger')(_0x52e3('0x5'));var config=require('../../config/environment');var jayson=require(_0x52e3('0x6'));var client=jayson[_0x52e3('0x7')][_0x52e3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x28a1e0,_0x3c8aa6,_0x4fce91){return new BPromise(function(_0xf3c667,_0x4f70ba){return client[_0x52e3('0x9')](_0x28a1e0,_0x4fce91)['then'](function(_0x134672){logger[_0x52e3('0xa')](_0x52e3('0xb'),_0x3c8aa6,_0x52e3('0xc'));logger[_0x52e3('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x3c8aa6,_0x52e3('0xc'),JSON['stringify'](_0x134672));if(_0x134672[_0x52e3('0xe')]){if(_0x134672[_0x52e3('0xe')][_0x52e3('0xf')]===0x1f4){logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x134672[_0x52e3('0xe')]['message']);return _0x4f70ba(_0x134672[_0x52e3('0xe')][_0x52e3('0x10')]);}logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x134672[_0x52e3('0xe')][_0x52e3('0x10')]);return _0xf3c667(_0x134672[_0x52e3('0xe')]['message']);}else{logger[_0x52e3('0xa')](_0x52e3('0xb'),_0x3c8aa6,_0x52e3('0xc'));_0xf3c667(_0x134672[_0x52e3('0x11')][_0x52e3('0x10')]);}})[_0x52e3('0x12')](function(_0x52e956){logger[_0x52e3('0xe')](_0x52e3('0xb'),_0x3c8aa6,_0x52e956);_0x4f70ba(_0x52e956);});});}exports[_0x52e3('0x13')]=function(_0xe06cd){var _0x46f711=this;return new Promise(function(_0x103f8c,_0x490fbe){return db[_0x52e3('0x14')][_0x52e3('0x15')](_0xe06cd[_0x52e3('0x16')],{'raw':_0xe06cd[_0x52e3('0x17')]?_0xe06cd[_0x52e3('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x52e3('0x18')](function(_0x1f7edd){logger[_0x52e3('0xa')](_0x52e3('0x13'),_0xe06cd);logger[_0x52e3('0xd')](_0x52e3('0x13'),_0xe06cd,JSON[_0x52e3('0x19')](_0x1f7edd));_0x103f8c(_0x1f7edd);})[_0x52e3('0x12')](function(_0x4089c5){logger[_0x52e3('0xe')]('CreateWhatsappQueueReport',_0x4089c5[_0x52e3('0x10')],_0xe06cd);_0x490fbe(_0x46f711[_0x52e3('0xe')](0x1f4,_0x4089c5[_0x52e3('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x2d66bd){var _0x2f55ac=this;return new Promise(function(_0x1c8505,_0x10dd4d){return db['WhatsappQueueReport']['update'](_0x2d66bd[_0x52e3('0x16')],{'raw':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1b')]||null:null,'attributes':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')][_0x52e3('0x1c')]||null:null,'limit':_0x2d66bd[_0x52e3('0x17')]?_0x2d66bd[_0x52e3('0x17')]['limit']||null:null})['then'](function(_0x172ade){logger[_0x52e3('0xa')]('UpdateWhatsappQueueReport',_0x2d66bd);logger[_0x52e3('0xd')](_0x52e3('0x1d'),_0x2d66bd,JSON[_0x52e3('0x19')](_0x172ade));_0x1c8505(_0x172ade);})[_0x52e3('0x12')](function(_0x510fc3){logger[_0x52e3('0xe')](_0x52e3('0x1d'),_0x510fc3[_0x52e3('0x10')],_0x2d66bd);_0x10dd4d(_0x2f55ac[_0x52e3('0xe')](0x1f4,_0x510fc3[_0x52e3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 1117a57..35f503c 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 _0x1491=['post','update','delete','destroy','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','isAuthenticated','describe','/:id','show'];(function(_0x4c1694,_0x23fd10){var _0x5e4212=function(_0x40fe66){while(--_0x40fe66){_0x4c1694['push'](_0x4c1694['shift']());}};_0x5e4212(++_0x23fd10);}(_0x1491,0x77));var _0x1149=function(_0x387f6d,_0x2f2d93){_0x387f6d=_0x387f6d-0x0;var _0x29d8d5=_0x1491[_0x387f6d];return _0x29d8d5;};'use strict';var multer=require('multer');var util=require(_0x1149('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1149('0x1'));var router=express[_0x1149('0x2')]();var fs_extra=require(_0x1149('0x3'));var auth=require(_0x1149('0x4'));var interaction=require(_0x1149('0x5'));var config=require(_0x1149('0x6'));var controller=require(_0x1149('0x7'));router[_0x1149('0x8')]('/',auth['isAuthenticated'](),controller[_0x1149('0x9')]);router[_0x1149('0x8')]('/describe',auth[_0x1149('0xa')](),controller[_0x1149('0xb')]);router['get'](_0x1149('0xc'),auth[_0x1149('0xa')](),controller[_0x1149('0xd')]);router[_0x1149('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1149('0xc'),auth['isAuthenticated'](),controller[_0x1149('0xf')]);router[_0x1149('0x10')](_0x1149('0xc'),auth[_0x1149('0xa')](),controller[_0x1149('0x11')]);module[_0x1149('0x12')]=router; \ No newline at end of file +var _0xbd30=['describe','/:id','show','post','create','put','update','destroy','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0xbd30,0x1d5));var _0x0bd3=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbd30[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require(_0x0bd3('0x0'));var path=require('path');var timeout=require(_0x0bd3('0x1'));var express=require(_0x0bd3('0x2'));var router=express['Router']();var fs_extra=require(_0x0bd3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0bd3('0x4'));var config=require(_0x0bd3('0x5'));var controller=require(_0x0bd3('0x6'));router[_0x0bd3('0x7')]('/',auth[_0x0bd3('0x8')](),controller[_0x0bd3('0x9')]);router[_0x0bd3('0x7')](_0x0bd3('0xa'),auth[_0x0bd3('0x8')](),controller[_0x0bd3('0xb')]);router[_0x0bd3('0x7')](_0x0bd3('0xc'),auth['isAuthenticated'](),controller[_0x0bd3('0xd')]);router[_0x0bd3('0xe')]('/',auth[_0x0bd3('0x8')](),controller[_0x0bd3('0xf')]);router[_0x0bd3('0x10')](_0x0bd3('0xc'),auth[_0x0bd3('0x8')](),controller[_0x0bd3('0x11')]);router['delete'](_0x0bd3('0xc'),auth[_0x0bd3('0x8')](),controller[_0x0bd3('0x12')]);module[_0x0bd3('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 10dcbd6..b01bf08 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 _0x5706=['queue','DATE','sequelize','exports','STRING','account'];(function(_0x54ad4a,_0x34f064){var _0x5877de=function(_0x7f183a){while(--_0x7f183a){_0x54ad4a['push'](_0x54ad4a['shift']());}};_0x5877de(++_0x34f064);}(_0x5706,0xb0));var _0x6570=function(_0x231b2a,_0x5d62c4){_0x231b2a=_0x231b2a-0x0;var _0x3b674a=_0x5706[_0x231b2a];return _0x3b674a;};'use strict';var Sequelize=require(_0x6570('0x0'));module[_0x6570('0x1')]={'uniqueid':{'type':Sequelize[_0x6570('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x6570('0x3'),'agent',_0x6570('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x6570('0x5')]}}; \ No newline at end of file +var _0xb4f4=['agent','queue','sequelize','exports','ENUM','account'];(function(_0x2d088c,_0x539a1b){var _0x4b9713=function(_0x32b1f6){while(--_0x32b1f6){_0x2d088c['push'](_0x2d088c['shift']());}};_0x4b9713(++_0x539a1b);}(_0xb4f4,0xda));var _0x4b4f=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xb4f4[_0x4ae6ef];return _0x3cbb4e;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4b4f('0x2')](_0x4b4f('0x3'),_0x4b4f('0x4'),_0x4b4f('0x5')),'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 147bcfb..48ab411 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 _0x2c67=['where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','find','catch','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x243ac6,_0x105d5f){var _0x27e3e9=function(_0x11e455){while(--_0x11e455){_0x243ac6['push'](_0x243ac6['shift']());}};_0x27e3e9(++_0x105d5f);}(_0x2c67,0x1ba));var _0x72c6=function(_0x391af3,_0x3acf9b){_0x391af3=_0x391af3-0x0;var _0x3dec70=_0x2c67[_0x391af3];return _0x3dec70;};'use strict';var emlformat=require(_0x72c6('0x0'));var rimraf=require(_0x72c6('0x1'));var zipdir=require(_0x72c6('0x2'));var jsonpatch=require(_0x72c6('0x3'));var rp=require('request-promise');var moment=require(_0x72c6('0x4'));var BPromise=require(_0x72c6('0x5'));var Mustache=require('mustache');var util=require(_0x72c6('0x6'));var path=require('path');var sox=require(_0x72c6('0x7'));var csv=require(_0x72c6('0x8'));var ejs=require(_0x72c6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x72c6('0xa'));var squel=require('squel');var crypto=require(_0x72c6('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x72c6('0xc'));var toCsv=require('to-csv');var querystring=require(_0x72c6('0xd'));var Papa=require(_0x72c6('0xe'));var Redis=require('ioredis');var authService=require(_0x72c6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x72c6('0x10'));var hardwareService=require(_0x72c6('0x11'));var logger=require(_0x72c6('0x12'))('api');var utils=require(_0x72c6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x72c6('0x14'));var db=require(_0x72c6('0x15'))['db'];function respondWithStatusCode(_0x3302a8,_0x3c1c08){_0x3c1c08=_0x3c1c08||0xcc;return function(_0x1098e5){if(_0x1098e5){return _0x3302a8[_0x72c6('0x16')](_0x3c1c08);}return _0x3302a8[_0x72c6('0x17')](_0x3c1c08)[_0x72c6('0x18')]();};}function respondWithResult(_0x43a0f4,_0x344726){_0x344726=_0x344726||0xc8;return function(_0x2b11f3){if(_0x2b11f3){return _0x43a0f4[_0x72c6('0x17')](_0x344726)['json'](_0x2b11f3);}};}function respondWithFilteredResult(_0x449240,_0x24ba6f){return function(_0x199ed4){if(_0x199ed4){var _0x12b535=typeof _0x24ba6f[_0x72c6('0x19')]===_0x72c6('0x1a')&&typeof _0x24ba6f[_0x72c6('0x1b')]===_0x72c6('0x1a');var _0x3985fa=_0x199ed4[_0x72c6('0x1c')];var _0x3c97ff=_0x12b535?0x0:_0x24ba6f[_0x72c6('0x19')];var _0x4e84f8=_0x12b535?_0x199ed4[_0x72c6('0x1c')]:_0x24ba6f[_0x72c6('0x19')]+_0x24ba6f[_0x72c6('0x1b')];var _0x261ed6;if(_0x4e84f8>=_0x3985fa){_0x4e84f8=_0x3985fa;_0x261ed6=0xc8;}else{_0x261ed6=0xce;}_0x449240[_0x72c6('0x17')](_0x261ed6);return _0x449240[_0x72c6('0x1d')](_0x72c6('0x1e'),_0x3c97ff+'-'+_0x4e84f8+'/'+_0x3985fa)['json'](_0x199ed4);}return null;};}function patchUpdates(_0x986304){return function(_0x4bee25){try{jsonpatch['apply'](_0x4bee25,_0x986304,!![]);}catch(_0x3ac7b9){return BPromise[_0x72c6('0x1f')](_0x3ac7b9);}return _0x4bee25[_0x72c6('0x20')]();};}function saveUpdates(_0x54742f,_0x19ea72){return function(_0x2b7634){if(_0x2b7634){return _0x2b7634['update'](_0x54742f)[_0x72c6('0x21')](function(_0x2a25c0){return _0x2a25c0;});}return null;};}function removeEntity(_0x1916d4,_0x57add6){return function(_0x18ca3b){if(_0x18ca3b){return _0x18ca3b[_0x72c6('0x22')]()[_0x72c6('0x21')](function(){_0x1916d4[_0x72c6('0x17')](0xcc)[_0x72c6('0x18')]();});}};}function handleEntityNotFound(_0x378f1f,_0x30271){return function(_0x18e9ad){if(!_0x18e9ad){_0x378f1f[_0x72c6('0x16')](0x194);}return _0x18e9ad;};}function handleError(_0x29ed9f,_0x1fd70f){_0x1fd70f=_0x1fd70f||0x1f4;return function(_0x1400c2){logger['error'](_0x1400c2[_0x72c6('0x23')]);if(_0x1400c2['name']){delete _0x1400c2[_0x72c6('0x24')];}_0x29ed9f[_0x72c6('0x17')](_0x1fd70f)[_0x72c6('0x25')](_0x1400c2);};}exports[_0x72c6('0x26')]=function(_0x49f200,_0x29d7b3){var _0x1dcf53={},_0x4fa9b7={},_0x37870d={'count':0x0,'rows':[]};var _0x1bedbf=_[_0x72c6('0x27')](db[_0x72c6('0x28')][_0x72c6('0x29')],function(_0x4a2f3d){return{'name':_0x4a2f3d['fieldName'],'type':_0x4a2f3d[_0x72c6('0x2a')][_0x72c6('0x2b')]};});_0x4fa9b7[_0x72c6('0x2c')]=_[_0x72c6('0x27')](_0x1bedbf,_0x72c6('0x24'));_0x4fa9b7[_0x72c6('0x2d')]=_[_0x72c6('0x2e')](_0x49f200[_0x72c6('0x2d')]);_0x4fa9b7[_0x72c6('0x2f')]=_[_0x72c6('0x30')](_0x4fa9b7[_0x72c6('0x2c')],_0x4fa9b7[_0x72c6('0x2d')]);_0x1dcf53[_0x72c6('0x31')]=_[_0x72c6('0x30')](_0x4fa9b7[_0x72c6('0x2c')],qs['fields'](_0x49f200[_0x72c6('0x2d')][_0x72c6('0x32')]));_0x1dcf53[_0x72c6('0x31')]=_0x1dcf53[_0x72c6('0x31')][_0x72c6('0x33')]?_0x1dcf53[_0x72c6('0x31')]:_0x4fa9b7[_0x72c6('0x2c')];if(!_0x49f200[_0x72c6('0x2d')][_0x72c6('0x34')](_0x72c6('0x35'))){_0x1dcf53[_0x72c6('0x1b')]=qs['limit'](_0x49f200[_0x72c6('0x2d')][_0x72c6('0x1b')]);_0x1dcf53[_0x72c6('0x19')]=qs['offset'](_0x49f200[_0x72c6('0x2d')][_0x72c6('0x19')]);}_0x1dcf53['order']=qs[_0x72c6('0x36')](_0x49f200[_0x72c6('0x2d')][_0x72c6('0x36')]);_0x1dcf53[_0x72c6('0x37')]=qs[_0x72c6('0x2f')](_[_0x72c6('0x38')](_0x49f200[_0x72c6('0x2d')],_0x4fa9b7[_0x72c6('0x2f')]),_0x1bedbf);if(_0x49f200['query'][_0x72c6('0x39')]){_0x1dcf53[_0x72c6('0x37')]=_[_0x72c6('0x3a')](_0x1dcf53[_0x72c6('0x37')],{'$or':_[_0x72c6('0x27')](_0x1bedbf,function(_0x313d32){if(_0x313d32[_0x72c6('0x2a')]!==_0x72c6('0x3b')){var _0x50ff3c={};_0x50ff3c[_0x313d32['name']]={'$like':'%'+_0x49f200[_0x72c6('0x2d')][_0x72c6('0x39')]+'%'};return _0x50ff3c;}})});}_0x1dcf53=_[_0x72c6('0x3a')]({},_0x1dcf53,_0x49f200['options']);var _0x396520={'where':_0x1dcf53['where']};return db[_0x72c6('0x28')][_0x72c6('0x1c')](_0x396520)[_0x72c6('0x21')](function(_0x5ce8c4){_0x37870d[_0x72c6('0x1c')]=_0x5ce8c4;if(_0x49f200[_0x72c6('0x2d')][_0x72c6('0x3c')]){_0x1dcf53[_0x72c6('0x3d')]=[{'all':!![]}];}return db[_0x72c6('0x28')][_0x72c6('0x3e')](_0x1dcf53);})[_0x72c6('0x21')](function(_0x52b7f3){_0x37870d['rows']=_0x52b7f3;return _0x37870d;})[_0x72c6('0x21')](respondWithFilteredResult(_0x29d7b3,_0x1dcf53))['catch'](handleError(_0x29d7b3,null));};exports[_0x72c6('0x3f')]=function(_0x22cf0f,_0x17aa90){var _0x30d2ee={'raw':!![],'where':{'id':_0x22cf0f[_0x72c6('0x40')]['id']}},_0x5166d1={};_0x5166d1['model']=_[_0x72c6('0x2e')](db[_0x72c6('0x28')][_0x72c6('0x29')]);_0x5166d1[_0x72c6('0x2d')]=_[_0x72c6('0x2e')](_0x22cf0f[_0x72c6('0x2d')]);_0x5166d1[_0x72c6('0x2f')]=_[_0x72c6('0x30')](_0x5166d1[_0x72c6('0x2c')],_0x5166d1[_0x72c6('0x2d')]);_0x30d2ee['attributes']=_[_0x72c6('0x30')](_0x5166d1[_0x72c6('0x2c')],qs[_0x72c6('0x32')](_0x22cf0f[_0x72c6('0x2d')][_0x72c6('0x32')]));_0x30d2ee['attributes']=_0x30d2ee['attributes']['length']?_0x30d2ee['attributes']:_0x5166d1[_0x72c6('0x2c')];if(_0x22cf0f[_0x72c6('0x2d')][_0x72c6('0x3c')]){_0x30d2ee['include']=[{'all':!![]}];}_0x30d2ee=_['merge']({},_0x30d2ee,_0x22cf0f['options']);return db[_0x72c6('0x28')][_0x72c6('0x41')](_0x30d2ee)[_0x72c6('0x21')](handleEntityNotFound(_0x17aa90,null))[_0x72c6('0x21')](respondWithResult(_0x17aa90,null))[_0x72c6('0x42')](handleError(_0x17aa90,null));};exports[_0x72c6('0x43')]=function(_0x57adb4,_0x201c41){return db[_0x72c6('0x28')][_0x72c6('0x43')](_0x57adb4[_0x72c6('0x44')],{})[_0x72c6('0x21')](respondWithResult(_0x201c41,0xc9))['catch'](handleError(_0x201c41,null));};exports[_0x72c6('0x45')]=function(_0x351a74,_0x1700e5){if(_0x351a74[_0x72c6('0x44')]['id']){delete _0x351a74[_0x72c6('0x44')]['id'];}return db[_0x72c6('0x28')][_0x72c6('0x41')]({'where':{'id':_0x351a74[_0x72c6('0x40')]['id']}})[_0x72c6('0x21')](handleEntityNotFound(_0x1700e5,null))[_0x72c6('0x21')](saveUpdates(_0x351a74[_0x72c6('0x44')],null))[_0x72c6('0x21')](respondWithResult(_0x1700e5,null))[_0x72c6('0x42')](handleError(_0x1700e5,null));};exports[_0x72c6('0x22')]=function(_0x5aa891,_0x4f0164){return db['WhatsappTransferReport']['find']({'where':{'id':_0x5aa891['params']['id']}})['then'](handleEntityNotFound(_0x4f0164,null))[_0x72c6('0x21')](removeEntity(_0x4f0164,null))[_0x72c6('0x42')](handleError(_0x4f0164,null));};exports[_0x72c6('0x46')]=function(_0x39b660,_0x16b874){return db['WhatsappTransferReport'][_0x72c6('0x46')]()[_0x72c6('0x21')](respondWithResult(_0x16b874,null))[_0x72c6('0x42')](handleError(_0x16b874,null));}; \ No newline at end of file +var _0x2ed4=['model','keys','query','filters','intersection','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','sendStatus','error','stack','name','map','WhatsappTransferReport','rawAttributes','type','key'];(function(_0x170a91,_0x1e7f80){var _0x610fa3=function(_0x45e64f){while(--_0x45e64f){_0x170a91['push'](_0x170a91['shift']());}};_0x610fa3(++_0x1e7f80);}(_0x2ed4,0xe6));var _0x42ed=function(_0x576266,_0x4002b0){_0x576266=_0x576266-0x0;var _0x18234f=_0x2ed4[_0x576266];return _0x18234f;};'use strict';var emlformat=require(_0x42ed('0x0'));var rimraf=require(_0x42ed('0x1'));var zipdir=require(_0x42ed('0x2'));var jsonpatch=require(_0x42ed('0x3'));var rp=require(_0x42ed('0x4'));var moment=require(_0x42ed('0x5'));var BPromise=require(_0x42ed('0x6'));var Mustache=require('mustache');var util=require(_0x42ed('0x7'));var path=require(_0x42ed('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x42ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42ed('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42ed('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x42ed('0xc'));var querystring=require(_0x42ed('0xd'));var Papa=require(_0x42ed('0xe'));var Redis=require(_0x42ed('0xf'));var authService=require(_0x42ed('0x10'));var qs=require(_0x42ed('0x11'));var as=require(_0x42ed('0x12'));var hardwareService=require(_0x42ed('0x13'));var logger=require('../../config/logger')(_0x42ed('0x14'));var utils=require(_0x42ed('0x15'));var config=require(_0x42ed('0x16'));var licenseUtil=require(_0x42ed('0x17'));var db=require(_0x42ed('0x18'))['db'];function respondWithStatusCode(_0x1e1050,_0xc06898){_0xc06898=_0xc06898||0xcc;return function(_0x52e652){if(_0x52e652){return _0x1e1050['sendStatus'](_0xc06898);}return _0x1e1050[_0x42ed('0x19')](_0xc06898)['end']();};}function respondWithResult(_0x49b245,_0x3a65d5){_0x3a65d5=_0x3a65d5||0xc8;return function(_0x1019b0){if(_0x1019b0){return _0x49b245[_0x42ed('0x19')](_0x3a65d5)[_0x42ed('0x1a')](_0x1019b0);}};}function respondWithFilteredResult(_0x22cb6d,_0x11ccda){return function(_0x3adc7d){if(_0x3adc7d){var _0x12e40c=typeof _0x11ccda[_0x42ed('0x1b')]===_0x42ed('0x1c')&&typeof _0x11ccda[_0x42ed('0x1d')]===_0x42ed('0x1c');var _0x444bc2=_0x3adc7d[_0x42ed('0x1e')];var _0x436827=_0x12e40c?0x0:_0x11ccda[_0x42ed('0x1b')];var _0x465782=_0x12e40c?_0x3adc7d[_0x42ed('0x1e')]:_0x11ccda[_0x42ed('0x1b')]+_0x11ccda[_0x42ed('0x1d')];var _0x33336a;if(_0x465782>=_0x444bc2){_0x465782=_0x444bc2;_0x33336a=0xc8;}else{_0x33336a=0xce;}_0x22cb6d['status'](_0x33336a);return _0x22cb6d[_0x42ed('0x1f')](_0x42ed('0x20'),_0x436827+'-'+_0x465782+'/'+_0x444bc2)[_0x42ed('0x1a')](_0x3adc7d);}return null;};}function patchUpdates(_0x3ddd86){return function(_0x506193){try{jsonpatch[_0x42ed('0x21')](_0x506193,_0x3ddd86,!![]);}catch(_0x14d458){return BPromise['reject'](_0x14d458);}return _0x506193[_0x42ed('0x22')]();};}function saveUpdates(_0x4ab52b,_0x23c9f0){return function(_0x2f3268){if(_0x2f3268){return _0x2f3268[_0x42ed('0x23')](_0x4ab52b)[_0x42ed('0x24')](function(_0x444e9a){return _0x444e9a;});}return null;};}function removeEntity(_0xf0fc43,_0x501ddf){return function(_0x39a9d1){if(_0x39a9d1){return _0x39a9d1['destroy']()[_0x42ed('0x24')](function(){_0xf0fc43[_0x42ed('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b9e30,_0x459abc){return function(_0x4d405f){if(!_0x4d405f){_0x2b9e30[_0x42ed('0x25')](0x194);}return _0x4d405f;};}function handleError(_0x4dd9af,_0x39aa06){_0x39aa06=_0x39aa06||0x1f4;return function(_0x93cd08){logger[_0x42ed('0x26')](_0x93cd08[_0x42ed('0x27')]);if(_0x93cd08[_0x42ed('0x28')]){delete _0x93cd08[_0x42ed('0x28')];}_0x4dd9af[_0x42ed('0x19')](_0x39aa06)['send'](_0x93cd08);};}exports['index']=function(_0x1b66ce,_0x350411){var _0x49bc93={},_0x3ddbc6={},_0x47765f={'count':0x0,'rows':[]};var _0x478cf9=_[_0x42ed('0x29')](db[_0x42ed('0x2a')][_0x42ed('0x2b')],function(_0x4ff735){return{'name':_0x4ff735['fieldName'],'type':_0x4ff735[_0x42ed('0x2c')][_0x42ed('0x2d')]};});_0x3ddbc6[_0x42ed('0x2e')]=_['map'](_0x478cf9,_0x42ed('0x28'));_0x3ddbc6['query']=_[_0x42ed('0x2f')](_0x1b66ce[_0x42ed('0x30')]);_0x3ddbc6[_0x42ed('0x31')]=_[_0x42ed('0x32')](_0x3ddbc6['model'],_0x3ddbc6[_0x42ed('0x30')]);_0x49bc93[_0x42ed('0x33')]=_[_0x42ed('0x32')](_0x3ddbc6['model'],qs[_0x42ed('0x34')](_0x1b66ce[_0x42ed('0x30')][_0x42ed('0x34')]));_0x49bc93['attributes']=_0x49bc93[_0x42ed('0x33')]['length']?_0x49bc93['attributes']:_0x3ddbc6[_0x42ed('0x2e')];if(!_0x1b66ce[_0x42ed('0x30')]['hasOwnProperty']('nolimit')){_0x49bc93['limit']=qs[_0x42ed('0x1d')](_0x1b66ce['query'][_0x42ed('0x1d')]);_0x49bc93[_0x42ed('0x1b')]=qs[_0x42ed('0x1b')](_0x1b66ce['query'][_0x42ed('0x1b')]);}_0x49bc93['order']=qs[_0x42ed('0x35')](_0x1b66ce['query']['sort']);_0x49bc93[_0x42ed('0x36')]=qs[_0x42ed('0x31')](_[_0x42ed('0x37')](_0x1b66ce[_0x42ed('0x30')],_0x3ddbc6[_0x42ed('0x31')]),_0x478cf9);if(_0x1b66ce[_0x42ed('0x30')][_0x42ed('0x38')]){_0x49bc93[_0x42ed('0x36')]=_[_0x42ed('0x39')](_0x49bc93[_0x42ed('0x36')],{'$or':_[_0x42ed('0x29')](_0x478cf9,function(_0x4f51fd){if(_0x4f51fd[_0x42ed('0x2c')]!==_0x42ed('0x3a')){var _0x476f4a={};_0x476f4a[_0x4f51fd[_0x42ed('0x28')]]={'$like':'%'+_0x1b66ce['query'][_0x42ed('0x38')]+'%'};return _0x476f4a;}})});}_0x49bc93=_['merge']({},_0x49bc93,_0x1b66ce['options']);var _0x3b3567={'where':_0x49bc93['where']};return db[_0x42ed('0x2a')][_0x42ed('0x1e')](_0x3b3567)['then'](function(_0x4dc034){_0x47765f[_0x42ed('0x1e')]=_0x4dc034;if(_0x1b66ce[_0x42ed('0x30')][_0x42ed('0x3b')]){_0x49bc93[_0x42ed('0x3c')]=[{'all':!![]}];}return db['WhatsappTransferReport']['findAll'](_0x49bc93);})['then'](function(_0x54d69f){_0x47765f['rows']=_0x54d69f;return _0x47765f;})[_0x42ed('0x24')](respondWithFilteredResult(_0x350411,_0x49bc93))[_0x42ed('0x3d')](handleError(_0x350411,null));};exports['show']=function(_0x3c63a9,_0x48b224){var _0x457628={'raw':!![],'where':{'id':_0x3c63a9[_0x42ed('0x3e')]['id']}},_0x2c5d69={};_0x2c5d69['model']=_[_0x42ed('0x2f')](db[_0x42ed('0x2a')]['rawAttributes']);_0x2c5d69[_0x42ed('0x30')]=_[_0x42ed('0x2f')](_0x3c63a9[_0x42ed('0x30')]);_0x2c5d69[_0x42ed('0x31')]=_[_0x42ed('0x32')](_0x2c5d69[_0x42ed('0x2e')],_0x2c5d69[_0x42ed('0x30')]);_0x457628['attributes']=_[_0x42ed('0x32')](_0x2c5d69[_0x42ed('0x2e')],qs[_0x42ed('0x34')](_0x3c63a9['query']['fields']));_0x457628[_0x42ed('0x33')]=_0x457628[_0x42ed('0x33')][_0x42ed('0x3f')]?_0x457628[_0x42ed('0x33')]:_0x2c5d69[_0x42ed('0x2e')];if(_0x3c63a9[_0x42ed('0x30')][_0x42ed('0x3b')]){_0x457628[_0x42ed('0x3c')]=[{'all':!![]}];}_0x457628=_['merge']({},_0x457628,_0x3c63a9['options']);return db[_0x42ed('0x2a')][_0x42ed('0x40')](_0x457628)[_0x42ed('0x24')](handleEntityNotFound(_0x48b224,null))[_0x42ed('0x24')](respondWithResult(_0x48b224,null))[_0x42ed('0x3d')](handleError(_0x48b224,null));};exports[_0x42ed('0x41')]=function(_0xe28f52,_0x2c3bd6){return db[_0x42ed('0x2a')][_0x42ed('0x41')](_0xe28f52['body'],{})['then'](respondWithResult(_0x2c3bd6,0xc9))[_0x42ed('0x3d')](handleError(_0x2c3bd6,null));};exports[_0x42ed('0x23')]=function(_0x2a54aa,_0x3dcad9){if(_0x2a54aa['body']['id']){delete _0x2a54aa[_0x42ed('0x42')]['id'];}return db[_0x42ed('0x2a')][_0x42ed('0x40')]({'where':{'id':_0x2a54aa[_0x42ed('0x3e')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x3dcad9,null))[_0x42ed('0x24')](saveUpdates(_0x2a54aa[_0x42ed('0x42')],null))[_0x42ed('0x24')](respondWithResult(_0x3dcad9,null))[_0x42ed('0x3d')](handleError(_0x3dcad9,null));};exports[_0x42ed('0x43')]=function(_0x543b68,_0x222528){return db[_0x42ed('0x2a')][_0x42ed('0x40')]({'where':{'id':_0x543b68[_0x42ed('0x3e')]['id']}})[_0x42ed('0x24')](handleEntityNotFound(_0x222528,null))[_0x42ed('0x24')](removeEntity(_0x222528,null))[_0x42ed('0x3d')](handleError(_0x222528,null));};exports[_0x42ed('0x44')]=function(_0xd7d92b,_0x466057){return db[_0x42ed('0x2a')][_0x42ed('0x44')]()[_0x42ed('0x24')](respondWithResult(_0x466057,null))['catch'](handleError(_0x466057,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 4a54427..1734eb2 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 _0xaddf=['report_whatsapp_transfer','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappTransferReport'];(function(_0x45aa73,_0xaed92){var _0x38d922=function(_0x29f718){while(--_0x29f718){_0x45aa73['push'](_0x45aa73['shift']());}};_0x38d922(++_0xaed92);}(_0xaddf,0xb6));var _0xfadd=function(_0x70a65d,_0x1c3597){_0x70a65d=_0x70a65d-0x0;var _0x44d26d=_0xaddf[_0x70a65d];return _0x44d26d;};'use strict';var _=require('lodash');var util=require(_0xfadd('0x0'));var logger=require(_0xfadd('0x1'))(_0xfadd('0x2'));var moment=require('moment');var BPromise=require(_0xfadd('0x3'));var rp=require(_0xfadd('0x4'));var fs=require('fs');var path=require(_0xfadd('0x5'));var rimraf=require(_0xfadd('0x6'));var config=require(_0xfadd('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0xfadd('0x8')]=function(_0x432a66,_0x3db9b2){return _0x432a66['define'](_0xfadd('0x9'),attributes,{'tableName':_0xfadd('0xa'),'paranoid':![],'indexes':[{'name':_0xfadd('0xb'),'fields':[_0xfadd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x52e5=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','util','api'];(function(_0x4773cd,_0x118f7b){var _0x2dc3b4=function(_0x4e8213){while(--_0x4e8213){_0x4773cd['push'](_0x4773cd['shift']());}};_0x2dc3b4(++_0x118f7b);}(_0x52e5,0xa8));var _0x552e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x52e5[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x552e('0x0'));var logger=require('../../config/logger')(_0x552e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x552e('0x2'));var fs=require('fs');var path=require(_0x552e('0x3'));var rimraf=require(_0x552e('0x4'));var config=require(_0x552e('0x5'));var attributes=require(_0x552e('0x6'));module['exports']=function(_0x4d2f35,_0x4fd5c5){return _0x4d2f35[_0x552e('0x7')](_0x552e('0x8'),attributes,{'tableName':_0x552e('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 22228ab..04d7fd4 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 _0x1c23=['request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','WhatsappTransferReport,\x20%s,\x20%s','WhatsappTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1c23,0x1c0));var _0x31c2=function(_0x351c49,_0x4740bb){_0x351c49=_0x351c49-0x0;var _0x4e1a5f=_0x1c23[_0x351c49];return _0x4e1a5f;};'use strict';var _=require(_0x31c2('0x0'));var util=require('util');var moment=require(_0x31c2('0x1'));var BPromise=require(_0x31c2('0x2'));var rs=require(_0x31c2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x31c2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x31c2('0x5'))(_0x31c2('0x6'));var config=require(_0x31c2('0x7'));var jayson=require(_0x31c2('0x8'));var client=jayson['client'][_0x31c2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x496b14,_0x2330c0,_0x340249){return new BPromise(function(_0x21bb22,_0x27d5ac){return client['request'](_0x496b14,_0x340249)[_0x31c2('0xa')](function(_0x132487){logger[_0x31c2('0xb')](_0x31c2('0xc'),_0x2330c0,'request\x20sent');logger['debug'](_0x31c2('0xd'),_0x2330c0,_0x31c2('0xe'),JSON[_0x31c2('0xf')](_0x132487));if(_0x132487[_0x31c2('0x10')]){if(_0x132487['error'][_0x31c2('0x11')]===0x1f4){logger[_0x31c2('0x10')](_0x31c2('0xc'),_0x2330c0,_0x132487[_0x31c2('0x10')][_0x31c2('0x12')]);return _0x27d5ac(_0x132487['error'][_0x31c2('0x12')]);}logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2330c0,_0x132487[_0x31c2('0x10')]['message']);return _0x21bb22(_0x132487[_0x31c2('0x10')][_0x31c2('0x12')]);}else{logger[_0x31c2('0xb')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2330c0,_0x31c2('0xe'));_0x21bb22(_0x132487[_0x31c2('0x13')][_0x31c2('0x12')]);}})[_0x31c2('0x14')](function(_0x98834d){logger[_0x31c2('0x10')](_0x31c2('0xc'),_0x2330c0,_0x98834d);_0x27d5ac(_0x98834d);});});} \ No newline at end of file +var _0xd238=['debug','stringify','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','request\x20sent'];(function(_0x7c7662,_0x3f0ef6){var _0x99250c=function(_0x68f47a){while(--_0x68f47a){_0x7c7662['push'](_0x7c7662['shift']());}};_0x99250c(++_0x3f0ef6);}(_0xd238,0x106));var _0x8d23=function(_0x37b530,_0x15be84){_0x37b530=_0x37b530-0x0;var _0x551028=_0xd238[_0x37b530];return _0x551028;};'use strict';var _=require(_0x8d23('0x0'));var util=require('util');var moment=require(_0x8d23('0x1'));var BPromise=require(_0x8d23('0x2'));var rs=require(_0x8d23('0x3'));var fs=require('fs');var Redis=require(_0x8d23('0x4'));var db=require(_0x8d23('0x5'))['db'];var utils=require(_0x8d23('0x6'));var logger=require(_0x8d23('0x7'))(_0x8d23('0x8'));var config=require(_0x8d23('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8d23('0xa')][_0x8d23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a037c,_0x49f271,_0x11f651){return new BPromise(function(_0x9c4295,_0x3289c1){return client[_0x8d23('0xc')](_0x3a037c,_0x11f651)['then'](function(_0x29138e){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x49f271,_0x8d23('0xd'));logger[_0x8d23('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x49f271,'request\x20sent',JSON[_0x8d23('0xf')](_0x29138e));if(_0x29138e[_0x8d23('0x10')]){if(_0x29138e[_0x8d23('0x10')][_0x8d23('0x11')]===0x1f4){logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x29138e['error'][_0x8d23('0x13')]);return _0x3289c1(_0x29138e[_0x8d23('0x10')]['message']);}logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x29138e['error'][_0x8d23('0x13')]);return _0x9c4295(_0x29138e[_0x8d23('0x10')][_0x8d23('0x13')]);}else{logger[_0x8d23('0x14')](_0x8d23('0x12'),_0x49f271,'request\x20sent');_0x9c4295(_0x29138e[_0x8d23('0x15')][_0x8d23('0x13')]);}})[_0x8d23('0x16')](function(_0x10f6ef){logger[_0x8d23('0x10')](_0x8d23('0x12'),_0x49f271,_0x10f6ef);_0x3289c1(_0x10f6ef);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7fa34f3..30e5491 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b83=['./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','default','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','name','online','Offline\x20apps:','status','join','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','exit','lodash','./mysqldb','./config/seedDB','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat'];(function(_0x2b3c9d,_0x1c8c0c){var _0x4b8037=function(_0x225327){while(--_0x225327){_0x2b3c9d['push'](_0x2b3c9d['shift']());}};_0x4b8037(++_0x1c8c0c);}(_0x7b83,0xa1));var _0x37b8=function(_0x5e03b5,_0x4820f3){_0x5e03b5=_0x5e03b5-0x0;var _0x818e7d=_0x7b83[_0x5e03b5];return _0x818e7d;};'use strict';var _=require(_0x37b8('0x0'));var db=require(_0x37b8('0x1'))['db'];var seedDb=require(_0x37b8('0x2'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x37b8('0x3'));var logger=require(_0x37b8('0x4'))(_0x37b8('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x37b8('0x6'));var schedule=require(_0x37b8('0x7'));var chat=require(_0x37b8('0x8'));var whatsapp=require(_0x37b8('0x9'));var transcribe=require(_0x37b8('0xa'));var provider=require(_0x37b8('0xb'));function main(){return db['sequelize'][_0x37b8('0xc')]()[_0x37b8('0xd')](function(){if(config['seedDB']){return seedDb[_0x37b8('0xe')]();}})['then'](function(){return checkLicense['default']();})['then'](function(){return rpc['listen']();})[_0x37b8('0xd')](function(_0xa1526a){logger[_0x37b8('0xf')](_0xa1526a);return chat[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(){return whatsapp['start']();})[_0x37b8('0xd')](function(){return schedule['start']();})[_0x37b8('0xd')](function(){return transcribe['start']();})[_0x37b8('0xd')](function(){return provider[_0x37b8('0x10')]();})[_0x37b8('0xd')](function(_0xf737ae){logger[_0x37b8('0xf')](_0xf737ae);return pm2['start'](pm2Config);})['then'](function(_0x316229){var _0x35fe29=_0x316229[_0x37b8('0x11')](function(_0x4ab58e){return typeof _0x4ab58e['exitCode']===_0x37b8('0x12')&&_0x4ab58e[_0x37b8('0x13')]>=0x0;});if(_0x35fe29[_0x37b8('0x14')]>0x0){throw new Error(_0x35fe29[_0x37b8('0x14')]+_0x37b8('0x15')+_[_0x37b8('0x16')](_0x35fe29,function(_0x286cf3){return'\x22'+_0x286cf3['pm2_env'][_0x37b8('0x17')]+'\x22';}));}logger['info']('Online\x20apps:',_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,{'status':_0x37b8('0x18')}),_0x37b8('0x17'))['join']());logger[_0x37b8('0xf')](_0x37b8('0x19'),_[_0x37b8('0x16')](_[_0x37b8('0x11')](_0x316229,function(_0x497623){return _0x497623[_0x37b8('0x1a')]!==_0x37b8('0x18');}),_0x37b8('0x17'))[_0x37b8('0x1b')]()||'None');console[_0x37b8('0x1c')](_0x37b8('0x1d'));})[_0x37b8('0x1e')](function(_0x1cf84a){console[_0x37b8('0x1c')](_0x37b8('0x1f'),_0x1cf84a);logger[_0x37b8('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x1cf84a);process[_0x37b8('0x21')](0x1);});}main(); \ No newline at end of file +var _0xbea5=['./config/license','./rpc','./config/environment','./config/logger','app','./config/schedule','./config/schedule/whatsapp','sequelize','seedDB','default','then','info','start','filter','exitCode','length','map','pm2_env','Online\x20apps:','name','join','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb'];(function(_0x8ecc41,_0x449804){var _0x579f8c=function(_0x4cc77d){while(--_0x4cc77d){_0x8ecc41['push'](_0x8ecc41['shift']());}};_0x579f8c(++_0x449804);}(_0xbea5,0x177));var _0x5bea=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xbea5[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x5bea('0x0'));var db=require(_0x5bea('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0x5bea('0x2'));var rpc=require(_0x5bea('0x3'));var config=require(_0x5bea('0x4'));var logger=require(_0x5bea('0x5'))(_0x5bea('0x6'));var pm2=require('./config/pm2');var pm2Config=require('./config/pm2/config');var schedule=require(_0x5bea('0x7'));var chat=require('./config/schedule/chat');var whatsapp=require(_0x5bea('0x8'));var transcribe=require('./config/schedule/transcribe');var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x5bea('0x9')]['sync']()['then'](function(){if(config[_0x5bea('0xa')]){return seedDb[_0x5bea('0xb')]();}})[_0x5bea('0xc')](function(){return checkLicense['default']();})[_0x5bea('0xc')](function(){return rpc['listen']();})['then'](function(_0x2af7af){logger[_0x5bea('0xd')](_0x2af7af);return chat[_0x5bea('0xe')]();})[_0x5bea('0xc')](function(){return whatsapp[_0x5bea('0xe')]();})[_0x5bea('0xc')](function(){return schedule['start']();})[_0x5bea('0xc')](function(){return transcribe[_0x5bea('0xe')]();})['then'](function(){return provider[_0x5bea('0xe')]();})[_0x5bea('0xc')](function(_0x4fdefd){logger[_0x5bea('0xd')](_0x4fdefd);return pm2[_0x5bea('0xe')](pm2Config);})[_0x5bea('0xc')](function(_0xda336a){var _0x1e2861=_0xda336a[_0x5bea('0xf')](function(_0x14d46c){return typeof _0x14d46c['exitCode']==='number'&&_0x14d46c[_0x5bea('0x10')]>=0x0;});if(_0x1e2861[_0x5bea('0x11')]>0x0){throw new Error(_0x1e2861[_0x5bea('0x11')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x5bea('0x12')](_0x1e2861,function(_0x18d13f){return'\x22'+_0x18d13f[_0x5bea('0x13')]['name']+'\x22';}));}logger[_0x5bea('0xd')](_0x5bea('0x14'),_['map'](_[_0x5bea('0xf')](_0xda336a,{'status':'online'}),_0x5bea('0x15'))[_0x5bea('0x16')]());logger[_0x5bea('0xd')]('Offline\x20apps:',_['map'](_[_0x5bea('0xf')](_0xda336a,function(_0x2bf974){return _0x2bf974[_0x5bea('0x17')]!=='online';}),_0x5bea('0x15'))[_0x5bea('0x16')]()||_0x5bea('0x18'));console[_0x5bea('0x19')]('App\x20Ready!');})[_0x5bea('0x1a')](function(_0xad55b1){console[_0x5bea('0x19')](_0x5bea('0x1b'),_0xad55b1);logger['error'](_0x5bea('0x1c'),_0xad55b1);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 1355adb..222c6ed 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 _0xa571=['verify','randomBytes','toString','hex','floor','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','basic-auth','bluebird','util','moment','secrets','session','role','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','Forbidden.','catch','headers','authorization','Basic','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','Invalid\x20API\x20access\x20key','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','retrieveApiKey','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','decryptString','split','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','promisify','secret','payload','options'];(function(_0x5c5164,_0x13f007){var _0x1ef244=function(_0x4697f9){while(--_0x4697f9){_0x5c5164['push'](_0x5c5164['shift']());}};_0x1ef244(++_0x13f007);}(_0xa571,0x107));var _0x1a57=function(_0x5a851c,_0x472438){_0x5a851c=_0x5a851c-0x0;var _0x27b461=_0xa571[_0x5a851c];return _0x27b461;};'use strict';var db=require(_0x1a57('0x0'))['db'];var config=require(_0x1a57('0x1'));var hardwareConf=require(_0x1a57('0x2'));var licenseUtil=require(_0x1a57('0x3'));var encryptor=require('../encryptor');var _=require(_0x1a57('0x4'));var jwt=require(_0x1a57('0x5'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x1a57('0x6'));var crypto=require('crypto');var BPromise=require(_0x1a57('0x7'));var util=require(_0x1a57('0x8'));var moment=require(_0x1a57('0x9'));var validateJwt=expressJwt({'secret':config[_0x1a57('0xa')][_0x1a57('0xb')]});var userAttributes=['id',_0x1a57('0xc'),'fullname',_0x1a57('0xd'),_0x1a57('0xe'),_0x1a57('0xf'),'userpic',_0x1a57('0x10'),_0x1a57('0x11'),_0x1a57('0x12'),_0x1a57('0x13'),_0x1a57('0x14'),_0x1a57('0x15'),_0x1a57('0x16'),_0x1a57('0x17'),'pauseType','showWebBar',_0x1a57('0x18'),_0x1a57('0x19'),_0x1a57('0x1a'),'allowmessenger',_0x1a57('0x1b'),_0x1a57('0x1c'),'phoneBarAutoAnswer',_0x1a57('0x1d'),'phoneBarDnd',_0x1a57('0x1e'),_0x1a57('0x1f'),_0x1a57('0x20'),_0x1a57('0x21'),'phoneBarPrefixRequired',_0x1a57('0x22'),'phoneBarRemoteControlPort','hotdesk',_0x1a57('0x23'),_0x1a57('0x24'),_0x1a57('0x25'),'settingsEnabled',_0x1a57('0x26'),_0x1a57('0x27'),_0x1a57('0x28'),'downloadAttachments',_0x1a57('0x29'),_0x1a57('0x2a'),_0x1a57('0x2b'),_0x1a57('0x2c'),_0x1a57('0x2d'),'emailAutoanswerDelay','smsAutoanswer',_0x1a57('0x2e'),_0x1a57('0x2f'),_0x1a57('0x30'),'faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer',_0x1a57('0x31'),_0x1a57('0x32')];exports[_0x1a57('0x33')]=function(){return this[_0x1a57('0x34')](!![])[_0x1a57('0x35')](function(_0x39d3ce,_0x2efa49,_0x2f8b00){if(_0x39d3ce[_0x1a57('0x36')]){_0x2f8b00();}else{return db[_0x1a57('0x37')][_0x1a57('0x38')]({'where':{'id':_0x39d3ce[_0x1a57('0x39')]['id']},'attributes':['id',_0x1a57('0x3a'),_0x1a57('0x3b')],'raw':!![]})[_0x1a57('0x3c')](function(_0x182649){if(_0x182649&&_0x182649[_0x1a57('0x3a')]){return _0x2efa49[_0x1a57('0x3d')](_0x182649[_0x1a57('0x3b')]===_0x1a57('0x3e')?0x195:0x193)[_0x1a57('0x3f')]({'message':_0x182649[_0x1a57('0x3b')]==='unmanaged'?'Unmanaged.':_0x1a57('0x40')});}else{_0x2f8b00();}})[_0x1a57('0x41')](function(_0x545041){_0x2f8b00(_0x545041);});}});};exports[_0x1a57('0x34')]=function isAuthenticated(_0x54f6a5){return compose()[_0x1a57('0x35')](function(_0x4a2901,_0x53bf6e,_0x8179a4){var _0x274fe6;if(_0x4a2901[_0x1a57('0x42')][_0x1a57('0x43')]){if(_['startsWith'](_0x4a2901[_0x1a57('0x42')][_0x1a57('0x43')],_0x1a57('0x44'))){var _0x160536=basicAuth(_0x4a2901);db['User'][_0x1a57('0x45')]({'where':{'name':_0x160536[_0x1a57('0xd')]}})[_0x1a57('0x3c')](function(_0x32f79f){if(!_0x32f79f||!_0x32f79f[_0x1a57('0x46')](_0x160536[_0x1a57('0x47')])){return _0x53bf6e[_0x1a57('0x3d')](0x191)[_0x1a57('0x3f')]({'message':_0x1a57('0x48')});}_0x4a2901['user']={'id':_0x32f79f['id']};_0x8179a4();})[_0x1a57('0x41')](function(_0x1e27b4){_0x8179a4(_0x1e27b4);});}else if(_['startsWith'](_0x4a2901['headers'][_0x1a57('0x43')],_0x1a57('0x49'))){validateJwt(_0x4a2901,_0x53bf6e,_0x8179a4);}else{if(_0x54f6a5){_0x8179a4();}else{return _0x53bf6e[_0x1a57('0x3d')](0x193)[_0x1a57('0x3f')]({'message':_0x1a57('0x4a')});}}}else if(_0x4a2901[_0x1a57('0x4b')][_0x1a57('0x4c')]){try{var _0x41e466={'audience':hardwareConf[_0x1a57('0x4d')](),'issuer':hardwareConf[_0x1a57('0x4d')]()};verifyJwt(_0x4a2901[_0x1a57('0x4b')][_0x1a57('0x4c')],_0x41e466)[_0x1a57('0x3c')](function(_0x1a6231){return db[_0x1a57('0x4e')][_0x1a57('0x45')]({'where':{'id':_0x1a6231[_0x1a57('0x4f')]}})[_0x1a57('0x3c')](function(_0x53432f){_0x274fe6=_0x53432f;return db[_0x1a57('0x50')][_0x1a57('0x38')]({'where':{'id':0x1},'attributes':[_0x1a57('0x51'),_0x1a57('0x52')],'raw':!![]});})[_0x1a57('0x3c')](function(_0xf64cb5){if(!_0x274fe6||!_[_0x1a57('0x53')](_0x274fe6[_0x1a57('0x54')],_0x1a6231[_0x1a57('0x55')])){return _0x53bf6e['status'](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x274fe6['disabled']){return _0x53bf6e[_0x1a57('0x3d')](0x191)[_0x1a57('0x3f')]({'message':_0x1a57('0x56')});}if(_0x274fe6['blocked']){if(_0xf64cb5[_0x1a57('0x52')]>0x0){if(moment(_0x274fe6[_0x1a57('0x57')])[_0x1a57('0x58')](_0xf64cb5[_0x1a57('0x52')],'minutes')>moment()){return _0x53bf6e[_0x1a57('0x3d')](0x191)['json']({'message':_0x1a57('0x56')});}}else{return _0x53bf6e[_0x1a57('0x3d')](0x191)[_0x1a57('0x3f')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4a2901[_0x1a57('0x36')]={'id':_0x274fe6['id']};_0x8179a4();});})[_0x1a57('0x41')](function(){return _0x53bf6e[_0x1a57('0x3d')](0x191)[_0x1a57('0x3f')]({'message':_0x1a57('0x56')});});}catch(_0x528ed3){_0x8179a4(_0x528ed3);}}else if(_0x54f6a5){_0x8179a4();}else{return _0x53bf6e[_0x1a57('0x3d')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x1a57('0x35')](function(_0x5b42bd,_0x433878,_0x398c59){if(_0x5b42bd[_0x1a57('0x36')]){db['User'][_0x1a57('0x45')]({'where':{'id':_0x5b42bd[_0x1a57('0x36')]['id']},'attributes':userAttributes})[_0x1a57('0x3c')](function(_0x392217){if(!_0x392217){return _0x433878['status'](0x194)[_0x1a57('0x3f')]({'message':_0x1a57('0x59')});}_0x5b42bd['user']=_0x392217;_0x398c59();})[_0x1a57('0x41')](function(_0x4c0759){_0x398c59(_0x4c0759);});}else if(_0x54f6a5){_0x398c59();}else{return _0x433878['status'](0x194)[_0x1a57('0x3f')]({'message':_0x1a57('0x5a')});}});};exports[_0x1a57('0x5b')]=function canUpdate(){return compose()[_0x1a57('0x35')](function(_0x5c0f5d,_0x44167e,_0xec234d){return licenseUtil[_0x1a57('0x5c')]()[_0x1a57('0x3c')](function(_0x473524){if(_0x473524['update']){_0xec234d();}else{return _0x44167e[_0x1a57('0x3d')](0x193)[_0x1a57('0x3f')]({'message':_0x1a57('0x5d')});}})[_0x1a57('0x41')](function(_0x4e540d){_0xec234d(_0x4e540d);});});};exports[_0x1a57('0x5e')]=function isWebrtcLicence(){return compose()['use'](function(_0x4bbfc3,_0x36f8dc,_0x167b40){return licenseUtil[_0x1a57('0x5c')]()[_0x1a57('0x3c')](function(_0x445df1){if(_0x445df1[_0x1a57('0x5f')]){_0x167b40();}else{return _0x36f8dc[_0x1a57('0x3d')](0x193)[_0x1a57('0x3f')]({'message':_0x1a57('0x5d')});}})[_0x1a57('0x41')](function(_0x136335){_0x167b40(_0x136335);});});};exports[_0x1a57('0x60')]=function(_0x47f9da,_0xf4d056,_0x480aff){_0x47f9da[_0x1a57('0x60')]=!![];return _0x480aff();};exports[_0x1a57('0x61')]=function signToken(_0x38b334){return signJwt(_0x38b334);};exports[_0x1a57('0x62')]=function(_0x323af1,_0x3cbb9e){if(!_0x323af1[_0x1a57('0x36')]){return _0x3cbb9e[_0x1a57('0x3d')](0x194)[_0x1a57('0x3f')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x193b77={'payload':{'id':_0x323af1[_0x1a57('0x36')]['id'],'role':_0x323af1['user'][_0x1a57('0xc')]},'options':{'expiresIn':0x15180}};return signJwt(_0x193b77)[_0x1a57('0x3c')](function(_0x594f94){_0x3cbb9e[_0x1a57('0x63')](_0x1a57('0x64'),_0x594f94);_0x3cbb9e['redirect']('/dashboards/general');})['catch'](function(_0x2c1bac){return _0x3cbb9e[_0x1a57('0x3d')](0x1f4)['send'](_0x2c1bac);});};exports[_0x1a57('0x65')]=function(_0x18267c){if(_['isNil'](_0x18267c['apiKeyNonce'])||_['isNil'](_0x18267c[_0x1a57('0x66')])){return null;}else{return createJwt(_0x18267c);}};exports[_0x1a57('0x67')]=function(_0x431cf5){_0x431cf5[_0x1a57('0x54')]=generateNonce();_0x431cf5[_0x1a57('0x66')]=generateIssuedAt();return createJwt(_0x431cf5);};exports[_0x1a57('0x68')]=function(_0xd64b3a,_0x1f705b){var _0x516aff=_0xd64b3a['query']['apikey'];if(_0x516aff){var _0x5ef58d={'nonce':_0x1f705b['apiKeyNonce'],'iat':_0x1f705b[_0x1a57('0x66')],'audience':hardwareConf[_0x1a57('0x4d')](),'issuer':hardwareConf[_0x1a57('0x4d')]()};return verifyJwt(_0x516aff,_0x5ef58d)[_0x1a57('0x3c')](function(){return generateApiKey(_0x1f705b);});}else{throw{'message':_0x1a57('0x69')};}};exports[_0x1a57('0x6a')]=function(_0xe710e){var _0x3bf7f0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x3bf7f0['test'](_0xe710e))throw new db['Sequelize']['ValidationError'](_0x1a57('0x6b'));return;};exports['validatePasswordHistory']=function(_0x301db9,_0x10c058,_0x408e67){var _0x352aca=encryptor[_0x1a57('0x6c')](_0x10c058)[_0x1a57('0x6d')](',');for(var _0x5a80be=0x0;_0x5a80be<_0x408e67;_0x5a80be++){if(!_0x352aca[_0x5a80be])break;if(_0x301db9['toLowerCase']()===_0x352aca[_0x5a80be]['toLowerCase']()){var _0x4d5b1d=util[_0x1a57('0x6e')](_0x1a57('0x6f'),_0x408e67);if(_0x408e67===0x1){_0x4d5b1d=_0x1a57('0x70');}throw new db[(_0x1a57('0x71'))][(_0x1a57('0x72'))](_0x4d5b1d);}}return;};exports[_0x1a57('0x73')]=function(_0x2ca029,_0x4ab246){var _0x5b691c=_0x4ab246?encryptor[_0x1a57('0x6c')](_0x4ab246)[_0x1a57('0x6d')](','):[];if(_0x5b691c[_0x1a57('0x74')]===0x5){_0x5b691c[_0x1a57('0x75')](-0x1,0x1);}_0x5b691c[_0x1a57('0x76')](_0x2ca029);return encryptor[_0x1a57('0x77')](_0x5b691c['join'](','));};function signJwt(_0x47db75){var _0x3bf6dd=BPromise[_0x1a57('0x78')](jwt['sign'],{'context':jwt});var _0x55c89e=_0x47db75[_0x1a57('0x79')]||config[_0x1a57('0xa')][_0x1a57('0xb')];return new BPromise(function(_0x10ceb8,_0x3ddc7e){_0x3bf6dd(_0x47db75[_0x1a57('0x7a')],_0x55c89e,_0x47db75[_0x1a57('0x7b')])['then'](function(_0x5913cf){_0x10ceb8(_0x5913cf);})[_0x1a57('0x41')](function(_0x69da3c){_0x3ddc7e(_0x69da3c);});});}function verifyJwt(_0x299fb7,_0x2e0ba6,_0x5d92dc){var _0x33092d=BPromise[_0x1a57('0x78')](jwt[_0x1a57('0x7c')],{'context':jwt});var _0x33c8d4=_0x5d92dc||config[_0x1a57('0xa')]['session'];return new BPromise(function(_0x4aa36d,_0x59d0b0){_0x33092d(_0x299fb7,_0x33c8d4,_0x2e0ba6)[_0x1a57('0x3c')](function(_0x223ba5){_0x4aa36d(_0x223ba5);})[_0x1a57('0x41')](function(_0x33ffe5){_0x59d0b0(_0x33ffe5);});});}function generateNonce(){return crypto[_0x1a57('0x7d')](0x10)[_0x1a57('0x7e')](_0x1a57('0x7f'));}function generateIssuedAt(){return Math[_0x1a57('0x80')](Date['now']()/0x3e8)[_0x1a57('0x7e')]();}function createJwt(_0x39399b){var _0x50ff89={'payload':{'iat':_0x39399b['apiKeyIat'],'nonce':_0x39399b[_0x1a57('0x54')]},'options':{'algorithm':'HS512','subject':_0x39399b['id'][_0x1a57('0x7e')](),'issuer':hardwareConf[_0x1a57('0x4d')](),'audience':hardwareConf[_0x1a57('0x4d')]()}};return signJwt(_0x50ff89)[_0x1a57('0x3c')](function(_0x3e7603){return{'iat':_0x39399b[_0x1a57('0x66')],'nonce':_0x39399b[_0x1a57('0x54')],'token':_0x3e7603};});} \ No newline at end of file +var _0x9348=['payload','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','basic-auth','crypto','bluebird','util','moment','secrets','role','fullname','name','md5secret','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','userProfileId','privacyEnabled','settingsEnabled','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','findOne','params','closed','then','status','disposition','json','unmanaged','Unmanaged.','catch','isAuthenticated','headers','startsWith','Basic','User','find','authenticate','pass','Wrong\x20credentials.','authorization','Unknown\x20authorization\x20format','query','apikey','getUuid','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','disabled','Invalid\x20API\x20access\x20key','blocked','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','update','Forbidden','isWebrtcLicence','getLicense','webrtc','isMiddleware','signToken','setTokenCookie','motion.token','send','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','length','unshift','encryptString','promisify','secret','session'];(function(_0x4514aa,_0x24825e){var _0x28d52a=function(_0x40edbd){while(--_0x40edbd){_0x4514aa['push'](_0x4514aa['shift']());}};_0x28d52a(++_0x24825e);}(_0x9348,0x10d));var _0x8934=function(_0x9209b,_0x514299){_0x9209b=_0x9209b-0x0;var _0x24bd5c=_0x9348[_0x9209b];return _0x24bd5c;};'use strict';var db=require(_0x8934('0x0'))['db'];var config=require(_0x8934('0x1'));var hardwareConf=require(_0x8934('0x2'));var licenseUtil=require(_0x8934('0x3'));var encryptor=require(_0x8934('0x4'));var _=require('lodash');var jwt=require(_0x8934('0x5'));var expressJwt=require(_0x8934('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x8934('0x7'));var crypto=require(_0x8934('0x8'));var BPromise=require(_0x8934('0x9'));var util=require(_0x8934('0xa'));var moment=require(_0x8934('0xb'));var validateJwt=expressJwt({'secret':config[_0x8934('0xc')]['session']});var userAttributes=['id',_0x8934('0xd'),_0x8934('0xe'),_0x8934('0xf'),'internal','email','userpic','permissions',_0x8934('0x10'),'voicePause',_0x8934('0x11'),_0x8934('0x12'),_0x8934('0x13'),_0x8934('0x14'),_0x8934('0x15'),_0x8934('0x16'),_0x8934('0x17'),_0x8934('0x18'),'lastPauseAt',_0x8934('0x19'),_0x8934('0x1a'),_0x8934('0x1b'),_0x8934('0x1c'),_0x8934('0x1d'),_0x8934('0x1e'),'phoneBarDnd',_0x8934('0x1f'),_0x8934('0x20'),_0x8934('0x21'),_0x8934('0x22'),_0x8934('0x23'),_0x8934('0x24'),_0x8934('0x25'),_0x8934('0x26'),'interface',_0x8934('0x27'),_0x8934('0x28'),_0x8934('0x29'),'wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions',_0x8934('0x2a'),'ignorePauseForPreviewCalls',_0x8934('0x2b'),_0x8934('0x2c'),_0x8934('0x2d'),_0x8934('0x2e'),_0x8934('0x2f'),'smsAutoanswer',_0x8934('0x30'),'openchannelAutoanswer',_0x8934('0x31'),_0x8934('0x32'),_0x8934('0x33'),_0x8934('0x34'),_0x8934('0x35'),_0x8934('0x36')];exports[_0x8934('0x37')]=function(){return this['isAuthenticated'](!![])[_0x8934('0x38')](function(_0x2a5e67,_0x32020a,_0x343e09){if(_0x2a5e67[_0x8934('0x39')]){_0x343e09();}else{return db['ChatInteraction'][_0x8934('0x3a')]({'where':{'id':_0x2a5e67[_0x8934('0x3b')]['id']},'attributes':['id',_0x8934('0x3c'),'disposition'],'raw':!![]})[_0x8934('0x3d')](function(_0x561df2){if(_0x561df2&&_0x561df2[_0x8934('0x3c')]){return _0x32020a[_0x8934('0x3e')](_0x561df2[_0x8934('0x3f')]==='unmanaged'?0x195:0x193)[_0x8934('0x40')]({'message':_0x561df2[_0x8934('0x3f')]===_0x8934('0x41')?_0x8934('0x42'):'Forbidden.'});}else{_0x343e09();}})[_0x8934('0x43')](function(_0x249031){_0x343e09(_0x249031);});}});};exports[_0x8934('0x44')]=function isAuthenticated(_0x3d93c7){return compose()[_0x8934('0x38')](function(_0x20d448,_0x3f328a,_0x457634){var _0x9c6a71;if(_0x20d448[_0x8934('0x45')]['authorization']){if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')]['authorization'],_0x8934('0x47'))){var _0x3d60f9=basicAuth(_0x20d448);db[_0x8934('0x48')][_0x8934('0x49')]({'where':{'name':_0x3d60f9['name']}})[_0x8934('0x3d')](function(_0x18e881){if(!_0x18e881||!_0x18e881[_0x8934('0x4a')](_0x3d60f9[_0x8934('0x4b')])){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x4c')});}_0x20d448['user']={'id':_0x18e881['id']};_0x457634();})['catch'](function(_0xff95be){_0x457634(_0xff95be);});}else if(_[_0x8934('0x46')](_0x20d448[_0x8934('0x45')][_0x8934('0x4d')],'Bearer')){validateJwt(_0x20d448,_0x3f328a,_0x457634);}else{if(_0x3d93c7){_0x457634();}else{return _0x3f328a[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x4e')});}}}else if(_0x20d448[_0x8934('0x4f')][_0x8934('0x50')]){try{var _0x4cd282={'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf[_0x8934('0x51')]()};verifyJwt(_0x20d448['query']['apikey'],_0x4cd282)[_0x8934('0x3d')](function(_0x2a790f){return db['User']['find']({'where':{'id':_0x2a790f[_0x8934('0x52')]}})[_0x8934('0x3d')](function(_0x2f710a){_0x9c6a71=_0x2f710a;return db[_0x8934('0x53')][_0x8934('0x3a')]({'where':{'id':0x1},'attributes':[_0x8934('0x54'),_0x8934('0x55')],'raw':!![]});})[_0x8934('0x3d')](function(_0x27920e){if(!_0x9c6a71||!_[_0x8934('0x56')](_0x9c6a71[_0x8934('0x57')],_0x2a790f['nonce'])){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x9c6a71[_0x8934('0x58')]){return _0x3f328a[_0x8934('0x3e')](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});}if(_0x9c6a71[_0x8934('0x5a')]){if(_0x27920e['blockDuration']>0x0){if(moment(_0x9c6a71['blockedAt'])['add'](_0x27920e[_0x8934('0x55')],_0x8934('0x5b'))>moment()){return _0x3f328a[_0x8934('0x3e')](0x191)['json']({'message':_0x8934('0x59')});}}else{return _0x3f328a['status'](0x191)['json']({'message':_0x8934('0x59')});}}_0x20d448[_0x8934('0x39')]={'id':_0x9c6a71['id']};_0x457634();});})['catch'](function(){return _0x3f328a['status'](0x191)[_0x8934('0x40')]({'message':_0x8934('0x59')});});}catch(_0x3d2b14){_0x457634(_0x3d2b14);}}else if(_0x3d93c7){_0x457634();}else{return _0x3f328a['status'](0x193)[_0x8934('0x40')]({'message':'Unknown\x20authorization\x20format'});}})[_0x8934('0x38')](function(_0x58559d,_0x3cd028,_0x476ed9){if(_0x58559d[_0x8934('0x39')]){db['User'][_0x8934('0x49')]({'where':{'id':_0x58559d[_0x8934('0x39')]['id']},'attributes':userAttributes})[_0x8934('0x3d')](function(_0x1e339a){if(!_0x1e339a){return _0x3cd028['status'](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5c')});}_0x58559d[_0x8934('0x39')]=_0x1e339a;_0x476ed9();})[_0x8934('0x43')](function(_0x6e63ff){_0x476ed9(_0x6e63ff);});}else if(_0x3d93c7){_0x476ed9();}else{return _0x3cd028[_0x8934('0x3e')](0x194)[_0x8934('0x40')]({'message':_0x8934('0x5d')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x510152,_0x1daae2,_0x44dfe2){return licenseUtil['getLicense']()[_0x8934('0x3d')](function(_0x4f0a90){if(_0x4f0a90[_0x8934('0x5e')]){_0x44dfe2();}else{return _0x1daae2[_0x8934('0x3e')](0x193)['json']({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x3f7562){_0x44dfe2(_0x3f7562);});});};exports[_0x8934('0x60')]=function isWebrtcLicence(){return compose()['use'](function(_0x2adb63,_0xa35ac9,_0x5991fc){return licenseUtil[_0x8934('0x61')]()[_0x8934('0x3d')](function(_0x27a98c){if(_0x27a98c[_0x8934('0x62')]){_0x5991fc();}else{return _0xa35ac9[_0x8934('0x3e')](0x193)[_0x8934('0x40')]({'message':_0x8934('0x5f')});}})[_0x8934('0x43')](function(_0x76684){_0x5991fc(_0x76684);});});};exports[_0x8934('0x63')]=function(_0x1e2175,_0xe212bc,_0x2c322d){_0x1e2175[_0x8934('0x63')]=!![];return _0x2c322d();};exports[_0x8934('0x64')]=function signToken(_0x245176){return signJwt(_0x245176);};exports[_0x8934('0x65')]=function(_0x248d88,_0x53d058){if(!_0x248d88[_0x8934('0x39')]){return _0x53d058[_0x8934('0x3e')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a52c0={'payload':{'id':_0x248d88['user']['id'],'role':_0x248d88[_0x8934('0x39')][_0x8934('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a52c0)[_0x8934('0x3d')](function(_0x4d1433){_0x53d058['cookie'](_0x8934('0x66'),_0x4d1433);_0x53d058['redirect']('/dashboards/general');})[_0x8934('0x43')](function(_0x2778f9){return _0x53d058[_0x8934('0x3e')](0x1f4)[_0x8934('0x67')](_0x2778f9);});};exports[_0x8934('0x68')]=function(_0x1b66d8){if(_[_0x8934('0x69')](_0x1b66d8['apiKeyNonce'])||_[_0x8934('0x69')](_0x1b66d8['apiKeyIat'])){return null;}else{return createJwt(_0x1b66d8);}};exports[_0x8934('0x6a')]=function(_0x3f2ee0){_0x3f2ee0[_0x8934('0x57')]=generateNonce();_0x3f2ee0[_0x8934('0x6b')]=generateIssuedAt();return createJwt(_0x3f2ee0);};exports[_0x8934('0x6c')]=function(_0x265b0a,_0x1f6c5f){var _0x251cfe=_0x265b0a['query'][_0x8934('0x50')];if(_0x251cfe){var _0x345a95={'nonce':_0x1f6c5f[_0x8934('0x57')],'iat':_0x1f6c5f[_0x8934('0x6b')],'audience':hardwareConf[_0x8934('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x251cfe,_0x345a95)[_0x8934('0x3d')](function(){return generateApiKey(_0x1f6c5f);});}else{throw{'message':_0x8934('0x6d')};}};exports[_0x8934('0x6e')]=function(_0x4c2a52){var _0x447110=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x447110[_0x8934('0x6f')](_0x4c2a52))throw new db[(_0x8934('0x70'))]['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports['validatePasswordHistory']=function(_0x3d5b45,_0x8e3e85,_0x3aab00){var _0x4ceb9b=encryptor[_0x8934('0x71')](_0x8e3e85)[_0x8934('0x72')](',');for(var _0x5f447c=0x0;_0x5f447c<_0x3aab00;_0x5f447c++){if(!_0x4ceb9b[_0x5f447c])break;if(_0x3d5b45['toLowerCase']()===_0x4ceb9b[_0x5f447c][_0x8934('0x73')]()){var _0x429769=util[_0x8934('0x74')](_0x8934('0x75'),_0x3aab00);if(_0x3aab00===0x1){_0x429769='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize']['ValidationError'](_0x429769);}}return;};exports['updatePasswordsHistory']=function(_0x43933f,_0x2b8837){var _0x18d08e=_0x2b8837?encryptor[_0x8934('0x71')](_0x2b8837)[_0x8934('0x72')](','):[];if(_0x18d08e[_0x8934('0x76')]===0x5){_0x18d08e['splice'](-0x1,0x1);}_0x18d08e[_0x8934('0x77')](_0x43933f);return encryptor[_0x8934('0x78')](_0x18d08e['join'](','));};function signJwt(_0x41e6b4){var _0x5abde1=BPromise[_0x8934('0x79')](jwt['sign'],{'context':jwt});var _0x29acc9=_0x41e6b4[_0x8934('0x7a')]||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x458895,_0x3cae46){_0x5abde1(_0x41e6b4[_0x8934('0x7c')],_0x29acc9,_0x41e6b4['options'])['then'](function(_0x321dad){_0x458895(_0x321dad);})[_0x8934('0x43')](function(_0x181a07){_0x3cae46(_0x181a07);});});}function verifyJwt(_0x458aaf,_0x511ac6,_0x18850a){var _0x35c437=BPromise[_0x8934('0x79')](jwt[_0x8934('0x7d')],{'context':jwt});var _0x2b1888=_0x18850a||config[_0x8934('0xc')][_0x8934('0x7b')];return new BPromise(function(_0x5bcb09,_0x143d9e){_0x35c437(_0x458aaf,_0x2b1888,_0x511ac6)['then'](function(_0x5c2819){_0x5bcb09(_0x5c2819);})[_0x8934('0x43')](function(_0x11b2c6){_0x143d9e(_0x11b2c6);});});}function generateNonce(){return crypto[_0x8934('0x7e')](0x10)[_0x8934('0x7f')](_0x8934('0x80'));}function generateIssuedAt(){return Math[_0x8934('0x81')](Date[_0x8934('0x82')]()/0x3e8)['toString']();}function createJwt(_0x1ccd22){var _0x3f51dc={'payload':{'iat':_0x1ccd22['apiKeyIat'],'nonce':_0x1ccd22[_0x8934('0x57')]},'options':{'algorithm':'HS512','subject':_0x1ccd22['id'][_0x8934('0x7f')](),'issuer':hardwareConf[_0x8934('0x51')](),'audience':hardwareConf[_0x8934('0x51')]()}};return signJwt(_0x3f51dc)['then'](function(_0x2e1b40){return{'iat':_0x1ccd22[_0x8934('0x6b')],'nonce':_0x1ccd22['apiKeyNonce'],'token':_0x2e1b40};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 188afdc..6ae13be 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 _0xa930=['lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','tag','countFilteredContacts','User','buildContactsQuery','getFilteredContacts','catch','describe','CmContact','keys','cf_','map','slice','all','fieldType','type'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa930,0x132));var _0x0a93=function(_0x420f93,_0xa65797){_0x420f93=_0x420f93-0x0;var _0x4333f3=_0xa930[_0x420f93];return _0x4333f3;};'use strict';var _=require(_0x0a93('0x0'));var sqlUtils=require(_0x0a93('0x1'));var db=require(_0x0a93('0x2'))['db'];exports['findAll']=function(_0x129ae0,_0x26f122,_0x4fc162,_0x20a5ec){var _0x2d4417={'count':0x0,'rows':[]};var _0xeefccb=sqlUtils[_0x0a93('0x3')](_0x26f122,_0x129ae0);if(_0xeefccb){return Promise[_0x0a93('0x4')](_0x2d4417);}var _0x1ae8e2=sqlUtils[_0x0a93('0x5')]();var _0x280530={};var _0x14a348=![];var _0x58495b=![];return Promise[_0x0a93('0x4')]()[_0x0a93('0x6')](function(){if(_0x129ae0[_0x0a93('0x7')]){return sqlUtils[_0x0a93('0x8')](_0x129ae0[_0x0a93('0x7')],_0x20a5ec);}else{return sqlUtils[_0x0a93('0x9')](_0x129ae0,_0x20a5ec);}})[_0x0a93('0x6')](function(_0x5a2e4d){_0x1ae8e2[_0x0a93('0xa')](_0x5a2e4d['default']);_0x1ae8e2[_0x0a93('0xa')](_0x5a2e4d[_0x0a93('0xb')]);_0x1ae8e2[_0x0a93('0xa')](_0x5a2e4d[_0x0a93('0xc')]);_0x1ae8e2[_0x0a93('0xa')](_0x5a2e4d[_0x0a93('0xd')][_0x0a93('0xe')]);_0x280530=_0x5a2e4d[_0x0a93('0xf')];_0x58495b=_0x5a2e4d[_0x0a93('0xd')][_0x0a93('0x10')];return sqlUtils[_0x0a93('0x11')](_0x26f122,_0x129ae0,_0x58495b);})[_0x0a93('0x6')](function(_0x1001df){_0x1ae8e2[_0x0a93('0xa')](_0x1001df);var _0x2d7fd2=_0x129ae0[_0x0a93('0x7')]?_0x280530[_0x0a93('0x12')]:_0x129ae0[_0x0a93('0x13')];_0x14a348=_0x2d7fd2?!![]:![];return sqlUtils[_0x0a93('0x14')](_0x1ae8e2,_0x2d7fd2);})[_0x0a93('0x6')](function(_0x256eb6){_0x2d4417['count']=_0x256eb6;if(_0x2d4417['count']===0x0){return;}if(_0x129ae0[_0x0a93('0x15')]){_0x58495b=!![];}return sqlUtils[_0x0a93('0x16')](_0x1ae8e2,_0x129ae0['fields'],_0x4fc162,_0x14a348,_0x280530[_0x0a93('0xe')],_0x58495b);})[_0x0a93('0x6')](function(_0x3c0468){if(!_0x3c0468){return[];}return sqlUtils[_0x0a93('0x17')](_0x3c0468,_0x129ae0,_0x4fc162);})['then'](function(_0x546b9e){_0x2d4417['rows']=_0x546b9e;return _0x2d4417;})[_0x0a93('0x18')](function(_0x12acaa){throw _0x12acaa;});};exports[_0x0a93('0x19')]=function(){var _0x12b4e3={};var _0x24fa47=[];return db[_0x0a93('0x1a')]['describe']()[_0x0a93('0x6')](function(_0x43dc7a){_0x12b4e3=_0x43dc7a;var _0x27c2ff=Object[_0x0a93('0x1b')](_0x12b4e3)['filter'](function(_0x7f18bc){return _['startsWith'](_0x7f18bc,_0x0a93('0x1c'))?_0x7f18bc:undefined;});var _0x58287e=_0x27c2ff[_0x0a93('0x1d')](function(_0x7b5ef7){return db['CmCustomField']['findOne']({'where':{'id':_0x7b5ef7[_0x0a93('0x1e')](0x3)},'raw':!![]});});return Promise[_0x0a93('0x1f')](_0x58287e);})[_0x0a93('0x6')](function(_0x39f7cc){for(var _0x46d73e=0x0;_0x46d73e<_0x39f7cc['length'];_0x46d73e++){if(_0x39f7cc[_0x46d73e]){var _0x17d420=_0x0a93('0x1c')+_0x39f7cc[_0x46d73e]['id'];_0x12b4e3[_0x17d420][_0x0a93('0x20')]=_0x39f7cc[_0x46d73e][_0x0a93('0x21')];}}_0x24fa47=_['map'](Object[_0x0a93('0x1b')](_0x12b4e3),function(_0x1d988b){return{'name':_0x1d988b,'type':_0x12b4e3[_0x1d988b][_0x0a93('0x21')]};});return _0x24fa47;})[_0x0a93('0x18')](function(_0x9ced96){throw _0x9ced96;});}; \ No newline at end of file +var _0xe587=['skipContactsQuery','resolve','getContactsSubquery','search','parseAdvancedSearchFilter','parseQueryParameters','then','default','where','fields','user','clause','tags','ids','tag','countFilteredContacts','count','buildContactsQuery','getFilteredContacts','rows','catch','CmContact','describe','keys','filter','startsWith','cf_','CmCustomField','findOne','slice','fieldType','type','map','lodash','../../mysqldb','findAll'];(function(_0x55fc25,_0x5f93bc){var _0x5cc353=function(_0x2794cb){while(--_0x2794cb){_0x55fc25['push'](_0x55fc25['shift']());}};_0x5cc353(++_0x5f93bc);}(_0xe587,0x189));var _0x7e58=function(_0x51b23a,_0x5cca81){_0x51b23a=_0x51b23a-0x0;var _0xac0204=_0xe587[_0x51b23a];return _0xac0204;};'use strict';var _=require(_0x7e58('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x7e58('0x1'))['db'];exports[_0x7e58('0x2')]=function(_0x46ccc6,_0x38f2a2,_0x308200,_0x33a1ec){var _0x3fa042={'count':0x0,'rows':[]};var _0x2bca86=sqlUtils[_0x7e58('0x3')](_0x38f2a2,_0x46ccc6);if(_0x2bca86){return Promise[_0x7e58('0x4')](_0x3fa042);}var _0xd374f3=sqlUtils[_0x7e58('0x5')]();var _0x53a709={};var _0x12ab58=![];var _0x5316f7=![];return Promise[_0x7e58('0x4')]()['then'](function(){if(_0x46ccc6[_0x7e58('0x6')]){return sqlUtils[_0x7e58('0x7')](_0x46ccc6['search'],_0x33a1ec);}else{return sqlUtils[_0x7e58('0x8')](_0x46ccc6,_0x33a1ec);}})[_0x7e58('0x9')](function(_0x5bbc0a){_0xd374f3['where'](_0x5bbc0a[_0x7e58('0xa')]);_0xd374f3[_0x7e58('0xb')](_0x5bbc0a[_0x7e58('0xc')]);_0xd374f3[_0x7e58('0xb')](_0x5bbc0a['filter']);_0xd374f3['where'](_0x5bbc0a[_0x7e58('0xd')][_0x7e58('0xe')]);_0x53a709=_0x5bbc0a[_0x7e58('0xf')];_0x5316f7=_0x5bbc0a[_0x7e58('0xd')]['skip'];return sqlUtils['checkListsRestrictions'](_0x38f2a2,_0x46ccc6,_0x5316f7);})[_0x7e58('0x9')](function(_0x3705b5){_0xd374f3['where'](_0x3705b5);var _0x3e5778=_0x46ccc6['search']?_0x53a709[_0x7e58('0x10')]:_0x46ccc6[_0x7e58('0x11')];_0x12ab58=_0x3e5778?!![]:![];return sqlUtils[_0x7e58('0x12')](_0xd374f3,_0x3e5778);})[_0x7e58('0x9')](function(_0x4d2397){_0x3fa042[_0x7e58('0x13')]=_0x4d2397;if(_0x3fa042[_0x7e58('0x13')]===0x0){return;}if(_0x46ccc6['User']){_0x5316f7=!![];}return sqlUtils[_0x7e58('0x14')](_0xd374f3,_0x46ccc6[_0x7e58('0xc')],_0x308200,_0x12ab58,_0x53a709[_0x7e58('0xe')],_0x5316f7);})[_0x7e58('0x9')](function(_0x419db2){if(!_0x419db2){return[];}return sqlUtils[_0x7e58('0x15')](_0x419db2,_0x46ccc6,_0x308200);})[_0x7e58('0x9')](function(_0x36689b){_0x3fa042[_0x7e58('0x16')]=_0x36689b;return _0x3fa042;})[_0x7e58('0x17')](function(_0xa400cc){throw _0xa400cc;});};exports['describe']=function(){var _0x459140={};var _0x352af1=[];return db[_0x7e58('0x18')][_0x7e58('0x19')]()[_0x7e58('0x9')](function(_0x5cc9e5){_0x459140=_0x5cc9e5;var _0x30f8b9=Object[_0x7e58('0x1a')](_0x459140)[_0x7e58('0x1b')](function(_0x5241fe){return _[_0x7e58('0x1c')](_0x5241fe,_0x7e58('0x1d'))?_0x5241fe:undefined;});var _0x1d1124=_0x30f8b9['map'](function(_0x5ea8b9){return db[_0x7e58('0x1e')][_0x7e58('0x1f')]({'where':{'id':_0x5ea8b9[_0x7e58('0x20')](0x3)},'raw':!![]});});return Promise['all'](_0x1d1124);})['then'](function(_0x3316cc){for(var _0x1e462d=0x0;_0x1e462d<_0x3316cc['length'];_0x1e462d++){if(_0x3316cc[_0x1e462d]){var _0xdd35f=_0x7e58('0x1d')+_0x3316cc[_0x1e462d]['id'];_0x459140[_0xdd35f][_0x7e58('0x21')]=_0x3316cc[_0x1e462d][_0x7e58('0x22')];}}_0x352af1=_[_0x7e58('0x23')](Object[_0x7e58('0x1a')](_0x459140),function(_0x199015){return{'name':_0x199015,'type':_0x459140[_0x199015][_0x7e58('0x22')]};});return _0x352af1;})['catch'](function(_0xb8a9b8){throw _0xb8a9b8;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index b73664b..809546d 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 _0xfa1b=['compact','Contact','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','tag','filter','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','squel','../parsers/advancedSearch','../interaction/utils','role','agent','search','ListId','autocomplete','true','select','cm_contacts','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.phone\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','fieldType','datetime','castTo','DATE','buildExpression','text','value','end','Tag','map','clause','and','tags','ids','user','uc.UserId\x20=\x20?','skip','keys'];(function(_0x277a61,_0x65cfa7){var _0x187b36=function(_0x47288d){while(--_0x47288d){_0x277a61['push'](_0x277a61['shift']());}};_0x187b36(++_0x65cfa7);}(_0xfa1b,0xfa));var _0xbfa1=function(_0x37f266,_0x245e7d){_0x37f266=_0x37f266-0x0;var _0x2a6251=_0xfa1b[_0x37f266];return _0x2a6251;};'use strict';var _=require('lodash');var squel=require(_0xbfa1('0x0'));var as=require(_0xbfa1('0x1'));var qs=require('../parsers/qs');var utils=require(_0xbfa1('0x2'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x4c1056,_0x7ee8){var _0x4c55c2=![];if(_0x4c1056[_0xbfa1('0x3')]===_0xbfa1('0x4')&&!_0x7ee8[_0xbfa1('0x5')]&&!_0x7ee8[_0xbfa1('0x6')]&&_0x7ee8[_0xbfa1('0x7')]!==_0xbfa1('0x8')){_0x4c55c2=!![];}return _0x4c55c2;}function getContactsSubquery(){return squel[_0xbfa1('0x9')]()['from'](_0xbfa1('0xa'),'c')['where'](_0xbfa1('0xb'));}function applyJoinClauses(_0x653b25,_0x58a482){var _0x5248f8=_0x58a482?'c':_0xbfa1('0xc');_0x653b25[_0xbfa1('0xd')](_0xbfa1('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x5248f8+_0xbfa1('0xf'))[_0xbfa1('0xd')](_0xbfa1('0x10'),'ct',_0xbfa1('0x11')+_0x5248f8+_0xbfa1('0xf'))[_0xbfa1('0xd')]('tools_tags','t',_0xbfa1('0x12'));return _0x653b25;}function addFieldsToQuery(_0xf74e48,_0xc6f2c8,_0x59e2c6,_0x17ecfa,_0x15980f){var _0x1ca7d1=_0x15980f?'c':_0xbfa1('0xc');if(!_0xc6f2c8){_0xc6f2c8=['id','firstName','lastName',_0xbfa1('0x13'),_0xbfa1('0x14'),_0xbfa1('0x15'),'email',_0xbfa1('0x6'),_0xbfa1('0x16'),_0xbfa1('0x17'),_0xbfa1('0x18'),_0xbfa1('0x19'),_0xbfa1('0x1a')];}else if(!_0xc6f2c8[_0xbfa1('0x1b')]('id')){_0xc6f2c8[_0xbfa1('0x1c')]('id');}var _0x230588=_0x59e2c6&&_0x15980f||!_0x59e2c6&&!_0x15980f;if(_0x17ecfa){_0x230588=_0x17ecfa&&_0x15980f||!_0x17ecfa&&!_0x15980f;}_0xc6f2c8[_0xbfa1('0x1d')](function(_0x3a079e){if(_0x3a079e===_0xbfa1('0x1a')){if(_0x230588){_0xf74e48[_0xbfa1('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x3a079e);}else if(_0x59e2c6||_0x17ecfa){_0xf74e48[_0xbfa1('0x1e')](_0x1ca7d1+'.'+_0x3a079e);}}else{_0xf74e48['field'](_0x1ca7d1+'.'+_0x3a079e);}});return _0xf74e48;}function getSqlClauses(){var _0xa070c0={'default':squel[_0xbfa1('0x1f')](),'fields':squel['expr'](),'filter':squel[_0xbfa1('0x1f')](),'tags':{'clause':squel[_0xbfa1('0x1f')](),'ids':null},'user':{'clause':squel[_0xbfa1('0x1f')](),'skip':![]}};return _0xa070c0;}function parseTagParameter(_0x479561){var _0xe11ac7=squel[_0xbfa1('0x1f')]();if(_0x479561){var _0x392c4f=utils[_0xbfa1('0x20')](_0x479561);_0x392c4f[_0xbfa1('0x1d')](function(_0x4a1aea){_0xe11ac7['or'](_0xbfa1('0x21'),'%,'+_0x4a1aea+',%');});}return _0xe11ac7;}function parseSearchFilter(_0x5e2dc7){var _0x6bad9a=squel[_0xbfa1('0x1f')]();if(_0x5e2dc7){var _0x30e9de=_0x5e2dc7[_0xbfa1('0x22')]('\x5c','\x5c\x5c')[_0xbfa1('0x22')](/'/g,'\x27\x27');if(_0x30e9de[_0xbfa1('0x23')]('\x20')[_0xbfa1('0x24')]>0x1){_0x6bad9a['or'](_0xbfa1('0x25'),qs[_0xbfa1('0x26')](_0x30e9de,!![]),null);}else{if(qs[_0xbfa1('0x27')](_0x30e9de)){_0x6bad9a['or']('c.id\x20LIKE\x20?',_0x30e9de+'%');_0x6bad9a['or'](_0xbfa1('0x28'),_0x30e9de+'%');_0x6bad9a['or']('c.mobile\x20LIKE\x20?',_0x30e9de+'%');_0x6bad9a['or'](_0xbfa1('0x29'),_0x30e9de+'%');}else if(qs['isEmail'](_0x30e9de)){_0x6bad9a['or'](_0xbfa1('0x2a'),_0x30e9de+'%');}else{_0x6bad9a['or'](_0xbfa1('0x2b'),'%'+_0x30e9de+'%');_0x6bad9a['or'](_0xbfa1('0x2c'),'%'+_0x30e9de+'%');_0x6bad9a['or'](_0xbfa1('0x2a'),'%'+_0x30e9de+'%');}}}return _0x6bad9a;}function parseAdvancedSearchFilter(_0x50258d,_0x4aac14){var _0x3e3d43=getSqlClauses();var _0x76cf3a=as[_0xbfa1('0x2d')](_0x50258d);var _0x1dfda0=_0x76cf3a[_0xbfa1('0x2e')];for(var _0x20d8f9=0x0;_0x20d8f9<_0x76cf3a['conditions'][_0xbfa1('0x24')];_0x20d8f9++){var _0x1fdad0=_0x76cf3a[_0xbfa1('0x2f')][_0x20d8f9];var _0x1de0dd='c';var _0x38a625=_[_0xbfa1('0x30')](_0x4aac14,[_0xbfa1('0x31'),_0x1fdad0[_0xbfa1('0x1e')]]);if(_0x38a625){if(_0x1fdad0[_0xbfa1('0x1e')]==='dateOfBirth'||_0x38a625[_0xbfa1('0x32')]===_0xbfa1('0x33')){_0x1fdad0[_0xbfa1('0x34')]=_0xbfa1('0x35');}var _0x109afb=as[_0xbfa1('0x36')](_0x1de0dd,_0x38a625['type'],_0x1fdad0);_0x3e3d43['default'][_0x1dfda0](_0x109afb[_0xbfa1('0x37')],_0x109afb['value']['start'],_0x109afb[_0xbfa1('0x38')][_0xbfa1('0x39')]);}else{if(_0x1fdad0[_0xbfa1('0x1e')]===_0xbfa1('0x3a')){var _0x537dcb=_0x1fdad0['value'][_0xbfa1('0x23')](',')[_0xbfa1('0x3b')](function(_0x57005a){return Number(_0x57005a);});var _0x344178=parseTagParameter(_0x537dcb);_0x3e3d43['tags'][_0xbfa1('0x3c')][_0xbfa1('0x3d')](_0x344178);_0x3e3d43[_0xbfa1('0x3e')][_0xbfa1('0x3f')]=_0x537dcb;}else if(_0x1fdad0[_0xbfa1('0x1e')]==='User'){_0x3e3d43[_0xbfa1('0x40')][_0xbfa1('0x3c')]['and'](_0xbfa1('0x41'),_0x1fdad0[_0xbfa1('0x38')]);_0x3e3d43[_0xbfa1('0x40')][_0xbfa1('0x42')]=!![];}}}return _0x3e3d43;}function parseModelFields(_0x4a473d,_0x68fa7c){var _0x1f3f7f=squel[_0xbfa1('0x1f')]();var _0x52e9ad=_(_0x4a473d)[_0xbfa1('0x43')]()[_0xbfa1('0x3b')](function(_0x243b68){return _['some'](_0x68fa7c,[_0xbfa1('0x31'),_0x243b68])?_0x243b68:undefined;})[_0xbfa1('0x44')]()[_0xbfa1('0x38')]();if(_0x4a473d['Contact']){_0x52e9ad[_0xbfa1('0x1c')](_0xbfa1('0x45'));}if(_0x4a473d[_0xbfa1('0x46')]){_0x52e9ad[_0xbfa1('0x1c')](_0xbfa1('0x46'));}if(_0x52e9ad[_0xbfa1('0x24')]>0x0){_0x52e9ad[_0xbfa1('0x1d')](function(_0x144b8a){if(_0x144b8a==='ListId'){_0x1f3f7f[_0xbfa1('0x3d')](_0xbfa1('0x47'),[][_0xbfa1('0x48')](_0x4a473d[_0x144b8a]));}else if(_0x144b8a===_0xbfa1('0x45')){var _0x12829d='%'+_0x4a473d[_0x144b8a]+'%';_0x1f3f7f[_0xbfa1('0x3d')](_0xbfa1('0x49'),_0x12829d);}else if(_0x144b8a===_0xbfa1('0x46')){_0x1f3f7f[_0xbfa1('0x3d')](_0xbfa1('0x41'),_0x4a473d[_0x144b8a]);}else{_0x1f3f7f[_0xbfa1('0x3d')]('c.'+_0x144b8a+_0xbfa1('0x4a'),_0x4a473d[_0x144b8a]);}});}return _0x1f3f7f;}function parseQueryParameters(_0x20b73e,_0x2ddb7b){var _0x2b8607=getSqlClauses();return Promise[_0xbfa1('0x4b')]()[_0xbfa1('0x4c')](function(){return parseModelFields(_0x20b73e,_0x2ddb7b);})['then'](function(_0x4f2939){_0x2b8607['fields'][_0xbfa1('0x3d')](_0x4f2939);return parseTagParameter(_0x20b73e[_0xbfa1('0x4d')]);})[_0xbfa1('0x4c')](function(_0x38cade){_0x2b8607[_0xbfa1('0x3e')][_0xbfa1('0x3c')]['and'](_0x38cade);return parseSearchFilter(_0x20b73e[_0xbfa1('0x4e')]);})[_0xbfa1('0x4c')](function(_0x30aa03){_0x2b8607[_0xbfa1('0x4e')]=_0x30aa03;return _0x2b8607;});}function checkListsRestrictions(_0x18b1c1,_0x4209e9,_0x520265){var _0x155049=squel[_0xbfa1('0x1f')]();return Promise['resolve']()[_0xbfa1('0x4c')](function(){if(_0x4209e9['search']&&_0x18b1c1[_0xbfa1('0x3')]===_0xbfa1('0x4')&&!_0x520265){return _0x18b1c1['getLists']({'attributes':['id'],'raw':!![]});}})['then'](function(_0x263e58){if(_0x263e58){if(_0x263e58[_0xbfa1('0x24')]===0x0){_0x155049[_0xbfa1('0x3d')](_0xbfa1('0x4f'));}else{_0x155049[_0xbfa1('0x3d')](_0xbfa1('0x47'),_['map'](_0x263e58,'id'));}}})[_0xbfa1('0x4c')](function(){return _0x155049;});}function buildContactsQuery(_0x2517d9,_0x20742b,_0x487067,_0x218343,_0x521b93,_0x4ed4a3){if(_0x20742b){_0x20742b=_0x487067[_0xbfa1('0x50')];}_0x2517d9=addFieldsToQuery(_0x2517d9,_0x20742b,_0x218343,_0x4ed4a3,!![]);var _0x24f66b=squel[_0xbfa1('0x9')]();_0x24f66b=addFieldsToQuery(_0x24f66b,_0x20742b,_0x218343,_0x4ed4a3,![]);if(_0x218343||_0x4ed4a3){_0x2517d9=applyJoinClauses(_0x2517d9,!![]);_0x2517d9[_0xbfa1('0x51')](_0xbfa1('0x52'));if(_0x487067[_0xbfa1('0x53')]){_0x24f66b['limit'](_0x487067[_0xbfa1('0x53')]);}if(_0x487067['offset']){_0x24f66b[_0xbfa1('0x54')](_0x487067[_0xbfa1('0x54')]);}}else{_0x24f66b=applyJoinClauses(_0x24f66b,![]);_0x24f66b[_0xbfa1('0x51')](_0xbfa1('0x55'));if(_0x487067[_0xbfa1('0x53')]){_0x2517d9[_0xbfa1('0x53')](_0x487067[_0xbfa1('0x53')]);}if(_0x487067[_0xbfa1('0x54')]){_0x2517d9[_0xbfa1('0x54')](_0x487067[_0xbfa1('0x54')]);}}_0x24f66b[_0xbfa1('0x56')](_0x521b93);if(_0x487067['order']){_0x487067[_0xbfa1('0x57')]['forEach'](function(_0xde48f4){_0x2517d9['order']('c.'+_0xde48f4[0x0],_0xde48f4[0x1]===_0xbfa1('0x58')?![]:!![]);_0x24f66b[_0xbfa1('0x57')](_0xbfa1('0x59')+_0xde48f4[0x0],_0xde48f4[0x1]==='DESC'?![]:!![]);});}_0x24f66b[_0xbfa1('0x5a')](_0x2517d9,_0xbfa1('0xc'));return _0x24f66b;}function getFilteredContacts(_0x3de8a9){var _0x50e7b4=[];return db[_0xbfa1('0x3a')][_0xbfa1('0x5b')]({'attributes':['id',_0xbfa1('0x31'),_0xbfa1('0x5c')],'raw':!![]})[_0xbfa1('0x4c')](function(_0x541dab){_0x50e7b4=_[_0xbfa1('0x5d')](_0x541dab,'id');var _0x216f31={'type':db[_0xbfa1('0x5e')][_0xbfa1('0x5f')][_0xbfa1('0x60')],'model':db[_0xbfa1('0x61')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xbfa1('0x62')][_0xbfa1('0x63')](_0x3de8a9[_0xbfa1('0x64')](),_0x216f31);})['then'](function(_0x439661){_0x439661['forEach'](function(_0x3d01b5){if(_0x3d01b5[_0xbfa1('0x1a')]){_0x3d01b5['Tags']=[];_0x3d01b5[_0xbfa1('0x1a')][_0xbfa1('0x23')](',')['forEach'](function(_0x16986a){_0x3d01b5['Tags'][_0xbfa1('0x1c')](_0x50e7b4[_0x16986a]);});}delete _0x3d01b5['TagIds'];});return _0x439661;});}function countFilteredContacts(_0x52cf16,_0x4f6160){var _0x5215e6=_0x52cf16[_0xbfa1('0x65')]();_0x5215e6[_0xbfa1('0x1e')](_0xbfa1('0x66'));_0x5215e6=applyJoinClauses(_0x5215e6,!![]);_0x52cf16[_0xbfa1('0x51')](_0xbfa1('0x52'));var _0x2c5ef0=utils[_0xbfa1('0x20')](_0x4f6160);if(!_[_0xbfa1('0x67')](_0x2c5ef0)){_0x5215e6[_0xbfa1('0x68')](_0xbfa1('0x69'),_0x2c5ef0);}var _0x2b1d28={'type':db[_0xbfa1('0x5e')][_0xbfa1('0x5f')]['SELECT'],'raw':!![]};return db[_0xbfa1('0x62')][_0xbfa1('0x63')](_0x5215e6['toString'](),_0x2b1d28)['then'](function(_0x54453b){return _0x54453b[0x0][_0xbfa1('0x66')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x3d82=['Contact','and','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','resolve','then','fields','tag','filter','search','agent','getLists','c.ListId\x20IS\x20NULL','attributes','limit','offset','having','order','subqry.','DESC','findAll','color','keyBy','Sequelize','QueryTypes','CmContact','sequelize','toString','Tags','COUNT(*)','group','c.id','isEmpty','where','t.id\x20IN\x20?','SELECT','query','exports','lodash','squel','../parsers/advancedSearch','../interaction/utils','role','ListId','autocomplete','true','select','from','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','cm_contact_has_tags','firstName','lastName','phone','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','parseSearch','sqlOperator','conditions','length','find','name','dateOfBirth','fieldType','datetime','DATE','default','text','start','end','Tag','value','map','tags','clause','ids','User','user','keys','some'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_0x3d82,0x8f));var _0x23d8=function(_0x707d21,_0x28d345){_0x707d21=_0x707d21-0x0;var _0x1bae5f=_0x3d82[_0x707d21];return _0x1bae5f;};'use strict';var _=require(_0x23d8('0x0'));var squel=require(_0x23d8('0x1'));var as=require(_0x23d8('0x2'));var qs=require('../parsers/qs');var utils=require(_0x23d8('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x47fc28,_0x201c26){var _0x5f18d1=![];if(_0x47fc28[_0x23d8('0x4')]==='agent'&&!_0x201c26['search']&&!_0x201c26[_0x23d8('0x5')]&&_0x201c26[_0x23d8('0x6')]!==_0x23d8('0x7')){_0x5f18d1=!![];}return _0x5f18d1;}function getContactsSubquery(){return squel[_0x23d8('0x8')]()[_0x23d8('0x9')]('cm_contacts','c')['where'](_0x23d8('0xa'));}function applyJoinClauses(_0x140f50,_0x5cce2f){var _0x3c2f1b=_0x5cce2f?'c':_0x23d8('0xb');_0x140f50['left_join'](_0x23d8('0xc'),'uc',_0x23d8('0xd')+_0x3c2f1b+'.id')['left_join'](_0x23d8('0xe'),'ct','ct.CmContactId\x20=\x20'+_0x3c2f1b+'.id')['left_join']('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x140f50;}function addFieldsToQuery(_0x7c790b,_0x466a8e,_0x305814,_0x39f894,_0x40243e){var _0x243e65=_0x40243e?'c':_0x23d8('0xb');if(!_0x466a8e){_0x466a8e=['id',_0x23d8('0xf'),_0x23d8('0x10'),_0x23d8('0x11'),'mobile',_0x23d8('0x12'),'email',_0x23d8('0x5'),_0x23d8('0x13'),_0x23d8('0x14'),_0x23d8('0x15'),_0x23d8('0x16'),_0x23d8('0x17')];}else if(!_0x466a8e['includes']('id')){_0x466a8e[_0x23d8('0x18')]('id');}var _0x4e629b=_0x305814&&_0x40243e||!_0x305814&&!_0x40243e;if(_0x39f894){_0x4e629b=_0x39f894&&_0x40243e||!_0x39f894&&!_0x40243e;}_0x466a8e[_0x23d8('0x19')](function(_0x477746){if(_0x477746===_0x23d8('0x17')){if(_0x4e629b){_0x7c790b[_0x23d8('0x1a')](_0x23d8('0x1b'),_0x477746);}else if(_0x305814||_0x39f894){_0x7c790b['field'](_0x243e65+'.'+_0x477746);}}else{_0x7c790b[_0x23d8('0x1a')](_0x243e65+'.'+_0x477746);}});return _0x7c790b;}function getSqlClauses(){var _0x45b8f8={'default':squel[_0x23d8('0x1c')](),'fields':squel[_0x23d8('0x1c')](),'filter':squel[_0x23d8('0x1c')](),'tags':{'clause':squel[_0x23d8('0x1c')](),'ids':null},'user':{'clause':squel[_0x23d8('0x1c')](),'skip':![]}};return _0x45b8f8;}function parseTagParameter(_0x1081c2){var _0x3b712c=squel[_0x23d8('0x1c')]();if(_0x1081c2){var _0x23570a=utils[_0x23d8('0x1d')](_0x1081c2);_0x23570a['forEach'](function(_0x49b9f1){_0x3b712c['or'](_0x23d8('0x1e'),'%,'+_0x49b9f1+',%');});}return _0x3b712c;}function parseSearchFilter(_0x2f0a5e){var _0x2c20fd=squel[_0x23d8('0x1c')]();if(_0x2f0a5e){var _0x411806=_0x2f0a5e[_0x23d8('0x1f')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x411806[_0x23d8('0x20')]('\x20')['length']>0x1){_0x2c20fd['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x411806,!![]),null);}else{if(qs[_0x23d8('0x21')](_0x411806)){_0x2c20fd['or'](_0x23d8('0x22'),_0x411806+'%');_0x2c20fd['or'](_0x23d8('0x23'),_0x411806+'%');_0x2c20fd['or'](_0x23d8('0x24'),_0x411806+'%');_0x2c20fd['or'](_0x23d8('0x25'),_0x411806+'%');}else if(qs[_0x23d8('0x26')](_0x411806)){_0x2c20fd['or']('c.email\x20LIKE\x20?',_0x411806+'%');}else{_0x2c20fd['or']('c.firstName\x20LIKE\x20?','%'+_0x411806+'%');_0x2c20fd['or']('c.lastName\x20LIKE\x20?','%'+_0x411806+'%');_0x2c20fd['or']('c.email\x20LIKE\x20?','%'+_0x411806+'%');}}}return _0x2c20fd;}function parseAdvancedSearchFilter(_0xc41637,_0x3a9a03){var _0x8a6f70=getSqlClauses();var _0x5b54e1=as[_0x23d8('0x27')](_0xc41637);var _0x231278=_0x5b54e1[_0x23d8('0x28')];for(var _0x10c9c5=0x0;_0x10c9c5<_0x5b54e1[_0x23d8('0x29')][_0x23d8('0x2a')];_0x10c9c5++){var _0x170cc1=_0x5b54e1[_0x23d8('0x29')][_0x10c9c5];var _0x3461c0='c';var _0x4317e5=_[_0x23d8('0x2b')](_0x3a9a03,[_0x23d8('0x2c'),_0x170cc1[_0x23d8('0x1a')]]);if(_0x4317e5){if(_0x170cc1[_0x23d8('0x1a')]===_0x23d8('0x2d')||_0x4317e5[_0x23d8('0x2e')]===_0x23d8('0x2f')){_0x170cc1['castTo']=_0x23d8('0x30');}var _0xac5cce=as['buildExpression'](_0x3461c0,_0x4317e5['type'],_0x170cc1);_0x8a6f70[_0x23d8('0x31')][_0x231278](_0xac5cce[_0x23d8('0x32')],_0xac5cce['value'][_0x23d8('0x33')],_0xac5cce['value'][_0x23d8('0x34')]);}else{if(_0x170cc1[_0x23d8('0x1a')]===_0x23d8('0x35')){var _0x1f6a0d=_0x170cc1[_0x23d8('0x36')]['split'](',')[_0x23d8('0x37')](function(_0x1a323d){return Number(_0x1a323d);});var _0x3ed64a=parseTagParameter(_0x1f6a0d);_0x8a6f70[_0x23d8('0x38')][_0x23d8('0x39')]['and'](_0x3ed64a);_0x8a6f70[_0x23d8('0x38')][_0x23d8('0x3a')]=_0x1f6a0d;}else if(_0x170cc1['field']===_0x23d8('0x3b')){_0x8a6f70['user'][_0x23d8('0x39')]['and']('uc.UserId\x20=\x20?',_0x170cc1[_0x23d8('0x36')]);_0x8a6f70[_0x23d8('0x3c')]['skip']=!![];}}}return _0x8a6f70;}function parseModelFields(_0x36e15b,_0x177dc6){var _0x300e75=squel['expr']();var _0x660800=_(_0x36e15b)[_0x23d8('0x3d')]()[_0x23d8('0x37')](function(_0x48a88d){return _[_0x23d8('0x3e')](_0x177dc6,[_0x23d8('0x2c'),_0x48a88d])?_0x48a88d:undefined;})['compact']()[_0x23d8('0x36')]();if(_0x36e15b[_0x23d8('0x3f')]){_0x660800[_0x23d8('0x18')](_0x23d8('0x3f'));}if(_0x36e15b[_0x23d8('0x3b')]){_0x660800['push'](_0x23d8('0x3b'));}if(_0x660800[_0x23d8('0x2a')]>0x0){_0x660800[_0x23d8('0x19')](function(_0x2264f2){if(_0x2264f2==='ListId'){_0x300e75[_0x23d8('0x40')](_0x23d8('0x41'),[][_0x23d8('0x42')](_0x36e15b[_0x2264f2]));}else if(_0x2264f2===_0x23d8('0x3f')){var _0x13f5e1='%'+_0x36e15b[_0x2264f2]+'%';_0x300e75[_0x23d8('0x40')](_0x23d8('0x43'),_0x13f5e1);}else if(_0x2264f2===_0x23d8('0x3b')){_0x300e75[_0x23d8('0x40')](_0x23d8('0x44'),_0x36e15b[_0x2264f2]);}else{_0x300e75[_0x23d8('0x40')]('c.'+_0x2264f2+'\x20=\x20?',_0x36e15b[_0x2264f2]);}});}return _0x300e75;}function parseQueryParameters(_0x140ad6,_0x50e0bf){var _0x437528=getSqlClauses();return Promise[_0x23d8('0x45')]()[_0x23d8('0x46')](function(){return parseModelFields(_0x140ad6,_0x50e0bf);})[_0x23d8('0x46')](function(_0x2d8652){_0x437528[_0x23d8('0x47')][_0x23d8('0x40')](_0x2d8652);return parseTagParameter(_0x140ad6[_0x23d8('0x48')]);})[_0x23d8('0x46')](function(_0x9901b1){_0x437528['tags']['clause']['and'](_0x9901b1);return parseSearchFilter(_0x140ad6[_0x23d8('0x49')]);})[_0x23d8('0x46')](function(_0x2c61fa){_0x437528[_0x23d8('0x49')]=_0x2c61fa;return _0x437528;});}function checkListsRestrictions(_0x1e3302,_0x27d177,_0x50ea6a){var _0x50cbd4=squel[_0x23d8('0x1c')]();return Promise['resolve']()[_0x23d8('0x46')](function(){if(_0x27d177[_0x23d8('0x4a')]&&_0x1e3302[_0x23d8('0x4')]===_0x23d8('0x4b')&&!_0x50ea6a){return _0x1e3302[_0x23d8('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x23d8('0x46')](function(_0x586bda){if(_0x586bda){if(_0x586bda[_0x23d8('0x2a')]===0x0){_0x50cbd4[_0x23d8('0x40')](_0x23d8('0x4d'));}else{_0x50cbd4[_0x23d8('0x40')](_0x23d8('0x41'),_[_0x23d8('0x37')](_0x586bda,'id'));}}})['then'](function(){return _0x50cbd4;});}function buildContactsQuery(_0x5700f1,_0x1791f2,_0x138f02,_0x42493a,_0x2c72e8,_0x53f3ea){if(_0x1791f2){_0x1791f2=_0x138f02[_0x23d8('0x4e')];}_0x5700f1=addFieldsToQuery(_0x5700f1,_0x1791f2,_0x42493a,_0x53f3ea,!![]);var _0x5b661c=squel[_0x23d8('0x8')]();_0x5b661c=addFieldsToQuery(_0x5b661c,_0x1791f2,_0x42493a,_0x53f3ea,![]);if(_0x42493a||_0x53f3ea){_0x5700f1=applyJoinClauses(_0x5700f1,!![]);_0x5700f1['group']('c.id');if(_0x138f02[_0x23d8('0x4f')]){_0x5b661c[_0x23d8('0x4f')](_0x138f02[_0x23d8('0x4f')]);}if(_0x138f02[_0x23d8('0x50')]){_0x5b661c[_0x23d8('0x50')](_0x138f02[_0x23d8('0x50')]);}}else{_0x5b661c=applyJoinClauses(_0x5b661c,![]);_0x5b661c['group']('subqry.id');if(_0x138f02['limit']){_0x5700f1[_0x23d8('0x4f')](_0x138f02[_0x23d8('0x4f')]);}if(_0x138f02['offset']){_0x5700f1[_0x23d8('0x50')](_0x138f02[_0x23d8('0x50')]);}}_0x5b661c[_0x23d8('0x51')](_0x2c72e8);if(_0x138f02['order']){_0x138f02[_0x23d8('0x52')][_0x23d8('0x19')](function(_0x1d2c39){_0x5700f1[_0x23d8('0x52')]('c.'+_0x1d2c39[0x0],_0x1d2c39[0x1]==='DESC'?![]:!![]);_0x5b661c['order'](_0x23d8('0x53')+_0x1d2c39[0x0],_0x1d2c39[0x1]===_0x23d8('0x54')?![]:!![]);});}_0x5b661c['from'](_0x5700f1,'subqry');return _0x5b661c;}function getFilteredContacts(_0xa99e55){var _0x589fdf=[];return db[_0x23d8('0x35')][_0x23d8('0x55')]({'attributes':['id',_0x23d8('0x2c'),_0x23d8('0x56')],'raw':!![]})[_0x23d8('0x46')](function(_0x453948){_0x589fdf=_[_0x23d8('0x57')](_0x453948,'id');var _0x5b8fae={'type':db[_0x23d8('0x58')][_0x23d8('0x59')]['SELECT'],'model':db[_0x23d8('0x5a')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x23d8('0x5b')]['query'](_0xa99e55[_0x23d8('0x5c')](),_0x5b8fae);})[_0x23d8('0x46')](function(_0x45483d){_0x45483d[_0x23d8('0x19')](function(_0x44aeff){if(_0x44aeff[_0x23d8('0x17')]){_0x44aeff[_0x23d8('0x5d')]=[];_0x44aeff[_0x23d8('0x17')][_0x23d8('0x20')](',')[_0x23d8('0x19')](function(_0x177699){_0x44aeff[_0x23d8('0x5d')]['push'](_0x589fdf[_0x177699]);});}delete _0x44aeff[_0x23d8('0x17')];});return _0x45483d;});}function countFilteredContacts(_0x501a6d,_0x50d391){var _0x334a39=_0x501a6d['clone']();_0x334a39['field'](_0x23d8('0x5e'));_0x334a39=applyJoinClauses(_0x334a39,!![]);_0x501a6d[_0x23d8('0x5f')](_0x23d8('0x60'));var _0x1e8971=utils['getSelectedTags'](_0x50d391);if(!_[_0x23d8('0x61')](_0x1e8971)){_0x334a39[_0x23d8('0x62')](_0x23d8('0x63'),_0x1e8971);}var _0x5916bc={'type':db['Sequelize'][_0x23d8('0x59')][_0x23d8('0x64')],'raw':!![]};return db[_0x23d8('0x5b')][_0x23d8('0x65')](_0x334a39[_0x23d8('0x5c')](),_0x5916bc)[_0x23d8('0x46')](function(_0xad72e9){return _0xad72e9[0x0][_0x23d8('0x5e')];});}module[_0x23d8('0x66')]={'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 ce96eba..350a17a 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 _0x3c4a=['encryptFile','createReadStream','createWriteStream','data','update','binary','write','end','final','unlink','decryptFile','close','encryptString','createCipher','utf8','base64','secret','createDecipher','crypto','bluebird','lodash','../../config/environment','app','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x29eec4,_0xa6e66){var _0xee5587=function(_0x4a7dd5){while(--_0x4a7dd5){_0x29eec4['push'](_0x29eec4['shift']());}};_0xee5587(++_0xa6e66);}(_0x3c4a,0x15c));var _0xa3c4=function(_0x5e4a4c,_0x1b8d7e){_0x5e4a4c=_0x5e4a4c-0x0;var _0x1afefb=_0x3c4a[_0x5e4a4c];return _0x1afefb;};'use strict';var crypto=require(_0xa3c4('0x0'));var fs=require('fs');var BPromise=require(_0xa3c4('0x1'));var _=require(_0xa3c4('0x2'));var config=require(_0xa3c4('0x3'));var logger=require('../../config/logger')(_0xa3c4('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets']['session'],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0xa3c4('0x5')};if(config[_0xa3c4('0x6')]&&config[_0xa3c4('0x6')][_0xa3c4('0x7')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xa3c4('0x7')]);if(isSupported){fileOptions[_0xa3c4('0x7')]=config[_0xa3c4('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xa3c4('0x8')](',\x20');logger[_0xa3c4('0x9')](config[_0xa3c4('0x6')][_0xa3c4('0x7')],_0xa3c4('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x5582cc){return AES_SUPPORTED_RX['test'](_0x5582cc);}function getSupportedCiphers(){return crypto[_0xa3c4('0xb')]()[_0xa3c4('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x5656c3){return getSupportedCiphers()[_0xa3c4('0xd')](_0x5656c3)>-0x1;}function combineOptions(_0x370424){var _0x300c55={};for(var _0x666151 in fileOptions){if(fileOptions['hasOwnProperty'](_0x666151)){_0x300c55[_0x666151]=fileOptions[_0x666151];}}if(_0x370424){for(var _0x47f3e8 in _0x370424){if(_0x370424[_0xa3c4('0xe')](_0x47f3e8)){_0x300c55[_0x47f3e8]=_0x370424[_0x47f3e8];}}}return _0x300c55;}exports[_0xa3c4('0xf')]=function(_0x5529c7,_0x165e2f,_0x22aadc,_0x49fe1d){return new BPromise(function(_0x38ceb1,_0x50e76d){_0x49fe1d=combineOptions(_0x49fe1d);var _0x34ef84=new Buffer(_0x22aadc);var _0x289841=fs[_0xa3c4('0x10')](_0x5529c7);var _0x4d8671=fs[_0xa3c4('0x11')](_0x165e2f);var _0x3f1208=crypto['createCipher'](_0x49fe1d['algorithm'],_0x34ef84);_0x289841['on'](_0xa3c4('0x12'),function(_0x10eb18){var _0x50c001=new Buffer(_0x3f1208[_0xa3c4('0x13')](_0x10eb18),_0xa3c4('0x14'));_0x4d8671[_0xa3c4('0x15')](_0x50c001);});_0x289841['on'](_0xa3c4('0x16'),function(){try{var _0x79d095=new Buffer(_0x3f1208[_0xa3c4('0x17')](_0xa3c4('0x14')),_0xa3c4('0x14'));_0x4d8671[_0xa3c4('0x15')](_0x79d095);_0x4d8671['end']();_0x4d8671['on']('close',function(){return _0x38ceb1(_0x165e2f);});}catch(_0x167a4d){fs[_0xa3c4('0x18')](_0x165e2f);return _0x50e76d(_0x167a4d);}});});};exports[_0xa3c4('0x19')]=function(_0x19069b,_0x393fc4,_0x40e967,_0x12b179){return new BPromise(function(_0x3d5573,_0x507f8b){_0x12b179=combineOptions(_0x12b179);var _0x4bddea=new Buffer(_0x40e967);var _0x5d14b1=fs[_0xa3c4('0x10')](_0x19069b);var _0x4188cf=fs[_0xa3c4('0x11')](_0x393fc4);var _0x3477a1=crypto['createDecipher'](_0x12b179[_0xa3c4('0x7')],_0x4bddea);_0x5d14b1['on']('data',function(_0x36fa85){var _0x5b9c4e=new Buffer(_0x3477a1[_0xa3c4('0x13')](_0x36fa85),_0xa3c4('0x14'));_0x4188cf[_0xa3c4('0x15')](_0x5b9c4e);});_0x5d14b1['on']('end',function(){try{var _0x4640d1=new Buffer(_0x3477a1['final'](_0xa3c4('0x14')),_0xa3c4('0x14'));_0x4188cf['write'](_0x4640d1);_0x4188cf[_0xa3c4('0x16')]();_0x4188cf['on'](_0xa3c4('0x1a'),function(){return _0x3d5573(_0x393fc4);});}catch(_0xebf6c){fs[_0xa3c4('0x18')](_0x393fc4);return _0x507f8b(_0xebf6c);}});});};exports[_0xa3c4('0x1b')]=function(_0x1e68bb,_0x10c697,_0x5e5ce8){var _0x27eda3=_0x5e5ce8||stringOptions[_0xa3c4('0x7')];var _0x5cd05c=_0x10c697||stringOptions['secret'];var _0x223416=crypto[_0xa3c4('0x1c')](_0x27eda3,_0x5cd05c);var _0x149ba0=_0x223416[_0xa3c4('0x13')](_0x1e68bb,_0xa3c4('0x1d'),_0xa3c4('0x1e'));_0x149ba0+=_0x223416['final']('base64');return _0x149ba0;};exports['decryptString']=function(_0x4158e1,_0x167352,_0x5f1400){var _0x6d0d02=_0x5f1400||stringOptions[_0xa3c4('0x7')];var _0x59b8d5=_0x167352||stringOptions[_0xa3c4('0x1f')];var _0x3aa381=crypto[_0xa3c4('0x20')](_0x6d0d02,_0x59b8d5);var _0x211f22=_0x3aa381[_0xa3c4('0x13')](_0x4158e1,_0xa3c4('0x1e'),_0xa3c4('0x1d'));_0x211f22+=_0x3aa381[_0xa3c4('0x17')](_0xa3c4('0x1d'));return _0x211f22;}; \ No newline at end of file +var _0x87d6=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','close','unlink','decryptFile','createDecipher','update','utf8','base64','final','decryptString','secret','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192'];(function(_0xb9a43a,_0x14b436){var _0xedabd8=function(_0x4142fe){while(--_0x4142fe){_0xb9a43a['push'](_0xb9a43a['shift']());}};_0xedabd8(++_0x14b436);}(_0x87d6,0xbe));var _0x687d=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x87d6[_0x3740fe];return _0x55492b;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x687d('0x0'));var config=require(_0x687d('0x1'));var logger=require(_0x687d('0x2'))(_0x687d('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x687d('0x4')][_0x687d('0x5')],'algorithm':_0x687d('0x6')};const fileOptions={'algorithm':_0x687d('0x7')};if(config[_0x687d('0x8')]&&config[_0x687d('0x8')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0x687d('0x8')]['algorithm']);if(isSupported){fileOptions[_0x687d('0x9')]=config[_0x687d('0x8')][_0x687d('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x687d('0xa')](',\x20');logger[_0x687d('0xb')](config[_0x687d('0x8')][_0x687d('0x9')],_0x687d('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0xc3ddbe){return AES_SUPPORTED_RX['test'](_0xc3ddbe);}function getSupportedCiphers(){return crypto['getCiphers']()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x3c4078){return getSupportedCiphers()[_0x687d('0xd')](_0x3c4078)>-0x1;}function combineOptions(_0xb29b25){var _0x5c3823={};for(var _0x5338ea in fileOptions){if(fileOptions['hasOwnProperty'](_0x5338ea)){_0x5c3823[_0x5338ea]=fileOptions[_0x5338ea];}}if(_0xb29b25){for(var _0x399cbc in _0xb29b25){if(_0xb29b25[_0x687d('0xe')](_0x399cbc)){_0x5c3823[_0x399cbc]=_0xb29b25[_0x399cbc];}}}return _0x5c3823;}exports[_0x687d('0xf')]=function(_0x4d0f06,_0x18bfdb,_0x3645e0,_0x4903a8){return new BPromise(function(_0x10a2a5,_0x3a55a2){_0x4903a8=combineOptions(_0x4903a8);var _0x5e933a=new Buffer(_0x3645e0);var _0x48bd8a=fs[_0x687d('0x10')](_0x4d0f06);var _0x1c2bdc=fs[_0x687d('0x11')](_0x18bfdb);var _0xbf03b7=crypto[_0x687d('0x12')](_0x4903a8[_0x687d('0x9')],_0x5e933a);_0x48bd8a['on'](_0x687d('0x13'),function(_0x4cc976){var _0xe6fa35=new Buffer(_0xbf03b7['update'](_0x4cc976),_0x687d('0x14'));_0x1c2bdc[_0x687d('0x15')](_0xe6fa35);});_0x48bd8a['on'](_0x687d('0x16'),function(){try{var _0xf7d52f=new Buffer(_0xbf03b7['final'](_0x687d('0x14')),_0x687d('0x14'));_0x1c2bdc[_0x687d('0x15')](_0xf7d52f);_0x1c2bdc[_0x687d('0x16')]();_0x1c2bdc['on'](_0x687d('0x17'),function(){return _0x10a2a5(_0x18bfdb);});}catch(_0xaa59d5){fs[_0x687d('0x18')](_0x18bfdb);return _0x3a55a2(_0xaa59d5);}});});};exports[_0x687d('0x19')]=function(_0x452a30,_0x9acc13,_0x17d578,_0x2cd74b){return new BPromise(function(_0x584749,_0x3c6900){_0x2cd74b=combineOptions(_0x2cd74b);var _0x5ab64e=new Buffer(_0x17d578);var _0x59d30d=fs[_0x687d('0x10')](_0x452a30);var _0x3d5582=fs[_0x687d('0x11')](_0x9acc13);var _0x4f6a7e=crypto[_0x687d('0x1a')](_0x2cd74b[_0x687d('0x9')],_0x5ab64e);_0x59d30d['on']('data',function(_0x2bdbc9){var _0x26faaa=new Buffer(_0x4f6a7e[_0x687d('0x1b')](_0x2bdbc9),_0x687d('0x14'));_0x3d5582['write'](_0x26faaa);});_0x59d30d['on'](_0x687d('0x16'),function(){try{var _0x2cdce3=new Buffer(_0x4f6a7e['final'](_0x687d('0x14')),_0x687d('0x14'));_0x3d5582[_0x687d('0x15')](_0x2cdce3);_0x3d5582['end']();_0x3d5582['on'](_0x687d('0x17'),function(){return _0x584749(_0x9acc13);});}catch(_0xd4605d){fs['unlink'](_0x9acc13);return _0x3c6900(_0xd4605d);}});});};exports['encryptString']=function(_0x51f608,_0x28c620,_0x539a30){var _0x21e1d5=_0x539a30||stringOptions[_0x687d('0x9')];var _0x1591f1=_0x28c620||stringOptions['secret'];var _0x1118fc=crypto[_0x687d('0x12')](_0x21e1d5,_0x1591f1);var _0x5da1cf=_0x1118fc[_0x687d('0x1b')](_0x51f608,_0x687d('0x1c'),_0x687d('0x1d'));_0x5da1cf+=_0x1118fc[_0x687d('0x1e')](_0x687d('0x1d'));return _0x5da1cf;};exports[_0x687d('0x1f')]=function(_0x3602c1,_0x5c8845,_0x289085){var _0x199f84=_0x289085||stringOptions[_0x687d('0x9')];var _0x740452=_0x5c8845||stringOptions[_0x687d('0x20')];var _0x2656a5=crypto['createDecipher'](_0x199f84,_0x740452);var _0x3c5741=_0x2656a5['update'](_0x3602c1,_0x687d('0x1d'),_0x687d('0x1c'));_0x3c5741+=_0x2656a5[_0x687d('0x1e')](_0x687d('0x1c'));return _0x3c5741;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 4afecb4..79720c8 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 _0xd61e=['CSV','Setting','find','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','info','format'];(function(_0x3506e5,_0x3bc1bc){var _0x21c033=function(_0xf88597){while(--_0xf88597){_0x3506e5['push'](_0x3506e5['shift']());}};_0x21c033(++_0x3bc1bc);}(_0xd61e,0x1da));var _0xed61=function(_0x1bcd0a,_0xd65baf){_0x1bcd0a=_0x1bcd0a-0x0;var _0x47f9bb=_0xd61e[_0x1bcd0a];return _0x47f9bb;};'use strict';var util=require(_0xed61('0x0'));var path=require(_0xed61('0x1'));var _=require(_0xed61('0x2'));var csv=require(_0xed61('0x3'));var fs=require('fs');var BPromise=require(_0xed61('0x4'));var zipdir=require(_0xed61('0x5'));var rimraf=require(_0xed61('0x6'));var db=require(_0xed61('0x7'))['db'];var dbH=require('../../mysqldb')[_0xed61('0x8')];var logger=require(_0xed61('0x9'))(_0xed61('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xed61('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xed61('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4642bb,_0x1b973a){var _0x3947ee={'status':_0x4642bb};var _0x491699={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b973a){_0x3947ee[_0xed61('0xc')]=_0x1b973a;}return db['AnalyticExtractedReport'][_0xed61('0xd')](_0x3947ee,_0x491699);}function main(){var _0x247c3b=0x1388;var _0xa7ec3a;logger[_0xed61('0xe')](util[_0xed61('0xf')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xed61('0x10')));return db[_0xed61('0x11')][_0xed61('0x12')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xed61('0x13')]})['then'](function(_0x1f4120){if(_0x1f4120){_0xa7ec3a=_0x1f4120;_0x247c3b=_0xa7ec3a[_0xed61('0x13')]||0x1388;}})[_0xed61('0x14')](function(){return dbH[_0xed61('0x15')][_0xed61('0x16')](util['format'](_0xed61('0x17'),QUERY),{'type':dbH[_0xed61('0x15')]['QueryTypes']['SELECT']});})[_0xed61('0x14')](function(_0x339f50){if(!_0x339f50[0x0][_0xed61('0x18')]){return analyticExtractedReport('Empty');}var _0x1f70ff=[];var _0x32e38a=0x0;if(_0xa7ec3a[_0xed61('0x19')]){if(_0x339f50&&_0x339f50[_0xed61('0x1a')]){var _0x20652c=_[_0xed61('0x1b')](_0x339f50[0x0][_0xed61('0x18')]/_0x247c3b);var _0x4d83a2=Number[_0xed61('0x1c')](_0x339f50[0x0]['num']/_0x247c3b)?_0x339f50[0x0][_0xed61('0x18')]%_0x247c3b:0x0;_0x20652c['forEach'](function(_0x26f6b0){if(_0x26f6b0>0x0){_0x32e38a+=_0x247c3b;}_0x1f70ff[_0xed61('0x1d')](dbH['sequelize'][_0xed61('0x16')](util[_0xed61('0xf')](_0xed61('0x1e'),QUERY,_0x247c3b,_0x32e38a),{'type':dbH[_0xed61('0x15')][_0xed61('0x1f')][_0xed61('0x20')]}));});if(_0x4d83a2>0x0){_0x32e38a+=_0x247c3b;_0x1f70ff[_0xed61('0x1d')](dbH[_0xed61('0x15')][_0xed61('0x16')](util[_0xed61('0xf')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4d83a2,_0x32e38a),{'type':dbH[_0xed61('0x15')]['QueryTypes'][_0xed61('0x20')]}));}}}else{_0x1f70ff['push'](dbH[_0xed61('0x15')][_0xed61('0x16')](QUERY,{'type':dbH[_0xed61('0x15')][_0xed61('0x1f')][_0xed61('0x20')]}));}var _0x2f688c=path[_0xed61('0x21')](PATH);var _0x2b28a2=path[_0xed61('0x22')](PATH,_0xed61('0x23'));var _0x4a7302=_0xa7ec3a[_0xed61('0x19')]&&_0x1f70ff[_0xed61('0x1a')]>0x1;var _0x2049a5=[];if(!fs[_0xed61('0x24')](path[_0xed61('0x25')](_0x2f688c,_0x2b28a2))&&_0x4a7302){fs[_0xed61('0x26')](path['join'](_0x2f688c,_0x2b28a2));}return BPromise[_0xed61('0x27')](_0x1f70ff,function(_0x56a51e){_0x2049a5[_0xed61('0x1d')](_0x56a51e);})[_0xed61('0x14')](function(){for(var _0x45fcee=0x0;_0x45fcee<_0x2049a5['length'];_0x45fcee+=0x1){var _0x438600;var _0x536185=_0x2049a5[_0x45fcee];if(_0x4a7302){_0x438600=path[_0xed61('0x25')](_0x2f688c,_0x2b28a2,util[_0xed61('0xf')](_0xed61('0x28'),_0x2b28a2,_0x45fcee,_0xed61('0x29')));}else{_0x438600=path[_0xed61('0x25')](_0x2f688c,util[_0xed61('0xf')](_0xed61('0x2a'),_0x2b28a2,'csv'));}fs[_0xed61('0x2b')](_0x438600,csv(_0x536185));}})[_0xed61('0x14')](function(){if(_0x4a7302){return new Promise(function(_0x559b77){zipdir(path[_0xed61('0x25')](_0x2f688c,_0x2b28a2),{'saveTo':path['join'](_0x2f688c,util['format'](_0xed61('0x2a'),_0x2b28a2,_0xed61('0x2c')))},function(_0x1e20fe,_0x295587){rimraf(path['join'](_0x2f688c,_0x2b28a2),function(){});_0x559b77(_0xed61('0x2d'));});});}})[_0xed61('0x14')](function(){logger[_0xed61('0xe')](util['format'](_0xed61('0x2e'),EXTRACTED_REPORT_ID,_0xed61('0x10')));return analyticExtractedReport('Completed',_0x4a7302?util['format'](_0xed61('0x2a'),_0x2b28a2,_0x4a7302?_0xed61('0x2c'):_0xed61('0x29')):null);});})['catch'](function(_0xb5d004){logger['info'](util[_0xed61('0xf')](_0xed61('0x2f'),EXTRACTED_REPORT_ID,_0xed61('0x10')),util['inspect'](_0xb5d004,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xed61('0x30')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0721=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','util','lodash','to-csv','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','then','num','Empty','range','forEach','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.csv','length','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch'];(function(_0x34902a,_0x4a3fb0){var _0xae1fc1=function(_0x4c736c){while(--_0x4c736c){_0x34902a['push'](_0x34902a['shift']());}};_0xae1fc1(++_0x4a3fb0);}(_0x0721,0x17a));var _0x1072=function(_0x4d934b,_0x52f8e9){_0x4d934b=_0x4d934b-0x0;var _0xc0338b=_0x0721[_0x4d934b];return _0xc0338b;};'use strict';var util=require(_0x1072('0x0'));var path=require('path');var _=require(_0x1072('0x1'));var csv=require(_0x1072('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x1072('0x3'));var db=require(_0x1072('0x4'))['db'];var dbH=require(_0x1072('0x4'))[_0x1072('0x5')];var logger=require(_0x1072('0x6'))(_0x1072('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0x1072('0x8')][0x2]);var QUERY=process[_0x1072('0x8')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x56c303,_0x149bd6){var _0x47869e={'status':_0x56c303};var _0x26413e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x149bd6){_0x47869e[_0x1072('0x9')]=_0x149bd6;}return db[_0x1072('0xa')][_0x1072('0xb')](_0x47869e,_0x26413e);}function main(){var _0x4356a0=0x1388;var _0x4366fb;logger[_0x1072('0xc')](util[_0x1072('0xd')](_0x1072('0xe'),EXTRACTED_REPORT_ID,_0x1072('0xf')));return db[_0x1072('0x10')][_0x1072('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1072('0x12'),_0x1072('0x13')]})['then'](function(_0xf15e8e){if(_0xf15e8e){_0x4366fb=_0xf15e8e;_0x4356a0=_0x4366fb[_0x1072('0x13')]||0x1388;}})['then'](function(){return dbH[_0x1072('0x14')][_0x1072('0x15')](util['format'](_0x1072('0x16'),QUERY),{'type':dbH[_0x1072('0x14')]['QueryTypes'][_0x1072('0x17')]});})[_0x1072('0x18')](function(_0x302f05){if(!_0x302f05[0x0][_0x1072('0x19')]){return analyticExtractedReport(_0x1072('0x1a'));}var _0x3ad41e=[];var _0x5aca51=0x0;if(_0x4366fb[_0x1072('0x12')]){if(_0x302f05&&_0x302f05['length']){var _0x407874=_[_0x1072('0x1b')](_0x302f05[0x0][_0x1072('0x19')]/_0x4356a0);var _0x10f369=Number['isInteger'](_0x302f05[0x0]['num']/_0x4356a0)?_0x302f05[0x0][_0x1072('0x19')]%_0x4356a0:0x0;_0x407874[_0x1072('0x1c')](function(_0x4e2a5c){if(_0x4e2a5c>0x0){_0x5aca51+=_0x4356a0;}_0x3ad41e[_0x1072('0x1d')](dbH[_0x1072('0x14')]['query'](util[_0x1072('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4356a0,_0x5aca51),{'type':dbH[_0x1072('0x14')][_0x1072('0x1e')]['SELECT']}));});if(_0x10f369>0x0){_0x5aca51+=_0x4356a0;_0x3ad41e[_0x1072('0x1d')](dbH['sequelize'][_0x1072('0x15')](util[_0x1072('0xd')](_0x1072('0x1f'),QUERY,_0x10f369,_0x5aca51),{'type':dbH[_0x1072('0x14')][_0x1072('0x1e')][_0x1072('0x17')]}));}}}else{_0x3ad41e[_0x1072('0x1d')](dbH[_0x1072('0x14')][_0x1072('0x15')](QUERY,{'type':dbH[_0x1072('0x14')][_0x1072('0x1e')][_0x1072('0x17')]}));}var _0x3848a2=path['dirname'](PATH);var _0x3b3f51=path[_0x1072('0x20')](PATH,_0x1072('0x21'));var _0x1a0429=_0x4366fb[_0x1072('0x12')]&&_0x3ad41e[_0x1072('0x22')]>0x1;var _0xce89c4=[];if(!fs['existsSync'](path[_0x1072('0x23')](_0x3848a2,_0x3b3f51))&&_0x1a0429){fs[_0x1072('0x24')](path[_0x1072('0x23')](_0x3848a2,_0x3b3f51));}return BPromise[_0x1072('0x25')](_0x3ad41e,function(_0x3a84ce){_0xce89c4[_0x1072('0x1d')](_0x3a84ce);})[_0x1072('0x18')](function(){for(var _0x2e1d63=0x0;_0x2e1d63<_0xce89c4[_0x1072('0x22')];_0x2e1d63+=0x1){var _0x113b68;var _0x17c65a=_0xce89c4[_0x2e1d63];if(_0x1a0429){_0x113b68=path[_0x1072('0x23')](_0x3848a2,_0x3b3f51,util['format'](_0x1072('0x26'),_0x3b3f51,_0x2e1d63,_0x1072('0x27')));}else{_0x113b68=path['join'](_0x3848a2,util['format'](_0x1072('0x28'),_0x3b3f51,_0x1072('0x27')));}fs[_0x1072('0x29')](_0x113b68,csv(_0x17c65a));}})[_0x1072('0x18')](function(){if(_0x1a0429){return new Promise(function(_0x28ba61){zipdir(path[_0x1072('0x23')](_0x3848a2,_0x3b3f51),{'saveTo':path['join'](_0x3848a2,util['format']('%s.%s',_0x3b3f51,_0x1072('0x2a')))},function(_0x3c44da,_0x4d845a){rimraf(path[_0x1072('0x23')](_0x3848a2,_0x3b3f51),function(){});_0x28ba61('zip\x20finished');});});}})[_0x1072('0x18')](function(){logger[_0x1072('0xc')](util[_0x1072('0xd')](_0x1072('0x2b'),EXTRACTED_REPORT_ID,_0x1072('0xf')));return analyticExtractedReport('Completed',_0x1a0429?util[_0x1072('0xd')](_0x1072('0x28'),_0x3b3f51,_0x1a0429?_0x1072('0x2a'):_0x1072('0x27')):null);});})[_0x1072('0x2c')](function(_0x3adb68){logger[_0x1072('0xc')](util['format'](_0x1072('0x2d'),EXTRACTED_REPORT_ID,_0x1072('0xf')),util['inspect'](_0x3adb68,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x1072('0x2e')](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 8e1f3ff..10da7b1 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 _0xc0d4=['jsdom','JSDOM','window','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','update','tableHeader','map','toString','value','fill','length','auto','push','body','concat','keys','forEach','startDate','format','endDate','pageBreak','before','landscape','\x20/\x20','footer','Arial','right','num','Empty','Setting','find','split','splitSizePdf','then','range','isInteger','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','query','QueryTypes','dirname','basename','.pdf','join','mkdirSync','each','%s%d.%s','pdf','%s.%s','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','header','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer'];(function(_0x5da016,_0x268421){var _0x384902=function(_0x19f6b1){while(--_0x19f6b1){_0x5da016['push'](_0x5da016['shift']());}};_0x384902(++_0x268421);}(_0xc0d4,0x10b));var _0x4c0d=function(_0x446e61,_0x27e680){_0x446e61=_0x446e61-0x0;var _0x4160a8=_0xc0d4[_0x446e61];return _0x4160a8;};'use strict';var _=require(_0x4c0d('0x0'));var fs=require('fs');var util=require(_0x4c0d('0x1'));var path=require(_0x4c0d('0x2'));var moment=require(_0x4c0d('0x3'));var htmlToPdfmake=require(_0x4c0d('0x4'));var PdfPrinter=require(_0x4c0d('0x5'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var JSDOM=require(_0x4c0d('0x6'))[_0x4c0d('0x7')];var window=new JSDOM('')[_0x4c0d('0x8')];var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var dbH=require(_0x4c0d('0x9'))['dbH'];var logger=require(_0x4c0d('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x4c0d('0xb')][0x2]);var QUERY=process[_0x4c0d('0xb')][0x3];var PATH=process[_0x4c0d('0xb')][0x4];var NAME=process[_0x4c0d('0xb')][0x5];var FORMAT=_0x4c0d('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x231777,_0x126624){var _0x24f347={'status':_0x231777};var _0x1d18a8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x126624){_0x24f347[_0x4c0d('0xd')]=_0x126624;}return db['AnalyticExtractedReport'][_0x4c0d('0xe')](_0x24f347,_0x1d18a8);}function getHeaders(_0x3e787d){return _['map'](_0x3e787d,function(_0x21d33f){return{'text':_0x21d33f,'style':_0x4c0d('0xf')};});}function getRows(_0x5e513d,_0x5f1a6b){return _[_0x4c0d('0x10')](_0x5f1a6b,function(_0x7f54fc){return _(_0x7f54fc)['pick'](_0x5e513d)['map'](function(_0x1889d8){return _0x1889d8?_[_0x4c0d('0x11')](_0x1889d8):'';})[_0x4c0d('0x12')]();});}function createTable(_0x51c14d,_0xc4c7ae){var _0x4865fc={'widths':_[_0x4c0d('0x13')](Array(_0x51c14d[_0x4c0d('0x14')]),0x91),'heights':function(_0x83e6bb){return _0x83e6bb===0x0?_0x4c0d('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2e41ac=getHeaders(_0x51c14d);_0x4865fc['body'][_0x4c0d('0x16')](_0x2e41ac);var _0x3527f7=getRows(_0x51c14d,_0xc4c7ae);_0x4865fc[_0x4c0d('0x17')]=_0x4865fc['body'][_0x4c0d('0x18')](_0x3527f7);return _0x4865fc;}function createTables(_0x3da614){var _0x46dd69=[];var _0x3c44ca=_['chunk'](Object[_0x4c0d('0x19')](_0x3da614[0x0]),0x5);_0x3c44ca[_0x4c0d('0x1a')](function(_0x59b1ed){_0x46dd69[_0x4c0d('0x16')](createTable(_0x59b1ed,_0x3da614));});return _0x46dd69;}function getPDFDocDefinition(_0x3f0cf4){var _0x5effff=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x4c0d('0x1b')])[_0x4c0d('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0x4c0d('0x1d')])[_0x4c0d('0x1c')](FORMAT));var _0xf9d6ac=[];for(var _0x3d3159=0x0;_0x3d3159<_0x3f0cf4[_0x4c0d('0x14')];_0x3d3159++){var _0x44356=[];if(_0x3d3159===0x0){_0x44356[_0x4c0d('0x16')]({'text':_0x5effff,'style':'header'});}var _0x30696={'table':_0x3f0cf4[_0x3d3159]};if(_0x3d3159>0x0){_0x30696[_0x4c0d('0x1e')]=_0x4c0d('0x1f');_0x30696['margin']=[0x0,0x46,0x0,0x0];}_0x44356[_0x4c0d('0x16')](_0x30696);_0xf9d6ac[_0x4c0d('0x16')](_0x44356);}return{'pageSize':'A4','pageOrientation':_0x4c0d('0x20'),'content':_0xf9d6ac,'footer':function(_0x17036f,_0x511a64){return{'text':_0x17036f[_0x4c0d('0x11')]()+_0x4c0d('0x21')+_0x511a64,'style':_0x4c0d('0x22')};},'defaultStyle':{'font':_0x4c0d('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x4c0d('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xdc471e){var _0x41c1c9=0x1388;var _0xf604b1;if(!_0xdc471e[0x0][_0x4c0d('0x25')]){return analyticExtractedReport(_0x4c0d('0x26'));}return db[_0x4c0d('0x27')][_0x4c0d('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4c0d('0x29'),_0x4c0d('0x2a')]})[_0x4c0d('0x2b')](function(_0xe67237){if(_0xe67237){_0xf604b1=_0xe67237;_0x41c1c9=_0xf604b1[_0x4c0d('0x2a')]||0x3e8;}})[_0x4c0d('0x2b')](function(){var _0x297313=[];var _0x4a6538=0x0;if(_0xf604b1[_0x4c0d('0x29')]){if(_0xdc471e&&_0xdc471e[_0x4c0d('0x14')]){var _0x250014=_[_0x4c0d('0x2c')](_0xdc471e[0x0][_0x4c0d('0x25')]/_0x41c1c9);var _0x582e88=Number[_0x4c0d('0x2d')](_0xdc471e[0x0][_0x4c0d('0x25')]/_0x41c1c9)?_0xdc471e[0x0][_0x4c0d('0x25')]%_0x41c1c9:0x0;_0x250014[_0x4c0d('0x1a')](function(_0xac117e){if(_0xac117e>0x0){_0x4a6538+=_0x41c1c9;}_0x297313[_0x4c0d('0x16')](dbH[_0x4c0d('0x2e')]['query'](util[_0x4c0d('0x1c')](_0x4c0d('0x2f'),QUERY,_0x41c1c9,_0x4a6538),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));});if(_0x582e88>0x0){_0x4a6538+=_0x41c1c9;_0x297313['push'](dbH[_0x4c0d('0x2e')][_0x4c0d('0x30')](util[_0x4c0d('0x1c')](_0x4c0d('0x2f'),QUERY,_0x582e88,_0x4a6538),{'type':dbH[_0x4c0d('0x2e')][_0x4c0d('0x31')]['SELECT']}));}}}else{_0x297313[_0x4c0d('0x16')](dbH[_0x4c0d('0x2e')][_0x4c0d('0x30')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x45fbdb=path[_0x4c0d('0x32')](PATH);var _0x3ed533=path[_0x4c0d('0x33')](PATH,_0x4c0d('0x34'));var _0x4a166b=_0xf604b1[_0x4c0d('0x29')]&&_0x297313[_0x4c0d('0x14')]>0x1;var _0x4a1061=[];if(!fs['existsSync'](path[_0x4c0d('0x35')](_0x45fbdb,_0x3ed533))&&_0x4a166b){fs[_0x4c0d('0x36')](path['join'](_0x45fbdb,_0x3ed533));}return BPromise[_0x4c0d('0x37')](_0x297313,function(_0x3216bb){_0x4a1061[_0x4c0d('0x16')](_0x3216bb);})[_0x4c0d('0x2b')](function(){var _0x2ab4ea=[];for(var _0x743243=0x0;_0x743243<_0x4a1061[_0x4c0d('0x14')];_0x743243+=0x1){var _0x1d2fd5=_0x4a1061[_0x743243];var _0x24af7e=createTables(_['flatten'](_0x1d2fd5));var _0x51a058;var _0x9c7b11=getPDFDocDefinition(_0x24af7e);var _0x2b4428=getPDFPrinter();var _0x2220ec=_0x2b4428['createPdfKitDocument'](_0x9c7b11);if(_0x4a166b){_0x51a058=path['join'](_0x45fbdb,_0x3ed533,util[_0x4c0d('0x1c')](_0x4c0d('0x38'),_0x3ed533,_0x743243,_0x4c0d('0x39')));}else{_0x51a058=path[_0x4c0d('0x35')](_0x45fbdb,util[_0x4c0d('0x1c')](_0x4c0d('0x3a'),_0x3ed533,'pdf'));}_0x2ab4ea[_0x4c0d('0x16')](writePDFDocument(_0x2220ec,_0x51a058));}return Promise['all'](_0x2ab4ea);})['then'](function(){if(_0x4a166b){return new Promise(function(_0x5cc363){zipdir(path[_0x4c0d('0x35')](_0x45fbdb,_0x3ed533),{'saveTo':path[_0x4c0d('0x35')](_0x45fbdb,util[_0x4c0d('0x1c')]('%s.%s',_0x3ed533,'zip'))},function(){rimraf(path[_0x4c0d('0x35')](_0x45fbdb,_0x3ed533),function(){});_0x5cc363(_0x4c0d('0x3b'));});});}})[_0x4c0d('0x2b')](function(){if(!_0x4a166b)return;rimraf(path[_0x4c0d('0x35')](_0x45fbdb,_0x3ed533),function(){});})[_0x4c0d('0x2b')](function(){logger[_0x4c0d('0x3c')](util[_0x4c0d('0x1c')](_0x4c0d('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x4c0d('0x3e'),_0x4a166b?util[_0x4c0d('0x1c')]('%s.%s',_0x3ed533,_0x4a166b?'zip':_0x4c0d('0x39')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x4c0d('0x3c')](util[_0x4c0d('0x1c')](_0x4c0d('0x3f'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x4c0d('0x40')][_0x4c0d('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x4c0d('0x2b')](function(_0x3dd90f){EXTRACTED_REPORT=_0x3dd90f;return dbH[_0x4c0d('0x2e')][_0x4c0d('0x30')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4c0d('0x2e')]['QueryTypes'][_0x4c0d('0x42')]});})['then'](extractReport)[_0x4c0d('0x43')](function(_0x591365){logger['info'](util[_0x4c0d('0x1c')](_0x4c0d('0x44'),EXTRACTED_REPORT_ID,_0x4c0d('0x45')),util[_0x4c0d('0x46')](_0x591365,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4c0d('0x47'));})[_0x4c0d('0x48')](function(){process[_0x4c0d('0x49')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5d6f03=new PdfPrinter({'Arial':{'normal':__dirname+_0x4c0d('0x4a'),'bold':__dirname+_0x4c0d('0x4b'),'italics':__dirname+_0x4c0d('0x4c'),'bolditalics':__dirname+_0x4c0d('0x4d')}});return _0x5d6f03;}function getPDFDocDefinitionFromHTML(_0x508524,_0x46d1e3){var _0x468254=util[_0x4c0d('0x1c')](_0x4c0d('0x4e'),_0x46d1e3[_0x4c0d('0x4f')],_0x46d1e3[_0x4c0d('0x50')]);var _0x55bcbc=moment()[_0x4c0d('0x1c')](_0x4c0d('0x51'))['toString']();var _0x1e9d05=htmlToPdfmake(_0x508524,{'window':window,'tableAutoSize':!![]});return{'content':[_0x1e9d05],'defaultStyle':{'font':_0x4c0d('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4c0d('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4c0d('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4c0d('0x52')}},'header':function(){return[{'text':_0x4c0d('0x53'),'style':_0x4c0d('0x54')}];},'footer':function(_0x47ebef,_0x585242){return[{'text':util[_0x4c0d('0x1c')](_0x4c0d('0x55'),_0x468254,_0x47ebef,_0x585242,_0x55bcbc),'style':'footer'}];}};}function writePDFDocument(_0x1951b8,_0x660ea){return new Promise(function(_0xf28b76,_0xd74e3e){var _0x99cf35=_0x1951b8['pipe'](fs[_0x4c0d('0x56')](_0x660ea));_0x99cf35['on']('finish',function(){_0xf28b76(_0x4c0d('0x57'));});_0x99cf35['on'](_0x4c0d('0x58'),function(_0x11b945){_0xd74e3e(_0x11b945);});_0x1951b8['end']();});}exports[_0x4c0d('0x59')]=function(_0x2d0515,_0x1ec608){var _0x54fe07=getPDFPrinter();var _0x48f738=getPDFDocDefinitionFromHTML(_0x2d0515,_0x1ec608);var _0x3194e0=_0x54fe07[_0x4c0d('0x5a')](_0x48f738);return writePDFDocument(_0x3194e0,_0x1ec608[_0x4c0d('0x2')])['catch'](function(_0x217dfb){throw _0x217dfb;});}; \ No newline at end of file +var _0x0d67=['findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','push','body','chunk','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','format','header','pageBreak','landscape','\x20/\x20','Arial','black','right','num','find','split','splitSizePdf','then','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed'];(function(_0x5095c9,_0x192b0a){var _0x2d207f=function(_0x437939){while(--_0x437939){_0x5095c9['push'](_0x5095c9['shift']());}};_0x2d207f(++_0x192b0a);}(_0x0d67,0x116));var _0x70d6=function(_0x5b5e06,_0x4aa5ef){_0x5b5e06=_0x5b5e06-0x0;var _0x482b18=_0x0d67[_0x5b5e06];return _0x482b18;};'use strict';var _=require(_0x70d6('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x70d6('0x1'));var moment=require(_0x70d6('0x2'));var htmlToPdfmake=require(_0x70d6('0x3'));var PdfPrinter=require(_0x70d6('0x4'));var zipdir=require(_0x70d6('0x5'));var rimraf=require(_0x70d6('0x6'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0x70d6('0x7')];var BPromise=require('bluebird');var db=require(_0x70d6('0x8'))['db'];var dbH=require(_0x70d6('0x8'))[_0x70d6('0x9')];var logger=require('../../config/logger')(_0x70d6('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x70d6('0xb')][0x2]);var QUERY=process[_0x70d6('0xb')][0x3];var PATH=process[_0x70d6('0xb')][0x4];var NAME=process[_0x70d6('0xb')][0x5];var FORMAT=_0x70d6('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x10a833,_0x47b270){var _0xbaab0d={'status':_0x10a833};var _0x758211={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47b270){_0xbaab0d[_0x70d6('0xd')]=_0x47b270;}return db[_0x70d6('0xe')][_0x70d6('0xf')](_0xbaab0d,_0x758211);}function getHeaders(_0x2a1b82){return _[_0x70d6('0x10')](_0x2a1b82,function(_0x196302){return{'text':_0x196302,'style':_0x70d6('0x11')};});}function getRows(_0x40374a,_0x2acafa){return _[_0x70d6('0x10')](_0x2acafa,function(_0x5a9c28){return _(_0x5a9c28)['pick'](_0x40374a)[_0x70d6('0x10')](function(_0x51555b){return _0x51555b?_[_0x70d6('0x12')](_0x51555b):'';})[_0x70d6('0x13')]();});}function createTable(_0x118594,_0x185e22){var _0x457cb5={'widths':_[_0x70d6('0x14')](Array(_0x118594[_0x70d6('0x15')]),0x91),'heights':function(_0x2025d3){return _0x2025d3===0x0?_0x70d6('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x585414=getHeaders(_0x118594);_0x457cb5['body'][_0x70d6('0x17')](_0x585414);var _0x230702=getRows(_0x118594,_0x185e22);_0x457cb5[_0x70d6('0x18')]=_0x457cb5[_0x70d6('0x18')]['concat'](_0x230702);return _0x457cb5;}function createTables(_0x118cb1){var _0x56ae20=[];var _0x354095=_[_0x70d6('0x19')](Object[_0x70d6('0x1a')](_0x118cb1[0x0]),0x5);_0x354095[_0x70d6('0x1b')](function(_0x1d6264){_0x56ae20[_0x70d6('0x17')](createTable(_0x1d6264,_0x118cb1));});return _0x56ae20;}function getPDFDocDefinition(_0x2d0fe6){var _0x542849=util['format'](_0x70d6('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT['startDate'])[_0x70d6('0x1d')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x70d6('0x1d')](FORMAT));var _0x475865=[];for(var _0x2ac7f1=0x0;_0x2ac7f1<_0x2d0fe6[_0x70d6('0x15')];_0x2ac7f1++){var _0x28de07=[];if(_0x2ac7f1===0x0){_0x28de07[_0x70d6('0x17')]({'text':_0x542849,'style':_0x70d6('0x1e')});}var _0xc62137={'table':_0x2d0fe6[_0x2ac7f1]};if(_0x2ac7f1>0x0){_0xc62137[_0x70d6('0x1f')]='before';_0xc62137['margin']=[0x0,0x46,0x0,0x0];}_0x28de07[_0x70d6('0x17')](_0xc62137);_0x475865[_0x70d6('0x17')](_0x28de07);}return{'pageSize':'A4','pageOrientation':_0x70d6('0x20'),'content':_0x475865,'footer':function(_0x26d49d,_0x5de13f){return{'text':_0x26d49d['toString']()+_0x70d6('0x21')+_0x5de13f,'style':'footer'};},'defaultStyle':{'font':_0x70d6('0x22')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x70d6('0x23')},'footer':{'alignment':_0x70d6('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x192035){var _0x24daff=0x1388;var _0x5566b8;if(!_0x192035[0x0][_0x70d6('0x25')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x70d6('0x26')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x70d6('0x27'),_0x70d6('0x28')]})['then'](function(_0x4ba4ff){if(_0x4ba4ff){_0x5566b8=_0x4ba4ff;_0x24daff=_0x5566b8[_0x70d6('0x28')]||0x3e8;}})[_0x70d6('0x29')](function(){var _0x393632=[];var _0x38f51b=0x0;if(_0x5566b8['split']){if(_0x192035&&_0x192035['length']){var _0x2109ed=_[_0x70d6('0x2a')](_0x192035[0x0][_0x70d6('0x25')]/_0x24daff);var _0x2e79d1=Number[_0x70d6('0x2b')](_0x192035[0x0][_0x70d6('0x25')]/_0x24daff)?_0x192035[0x0]['num']%_0x24daff:0x0;_0x2109ed['forEach'](function(_0x3f40b8){if(_0x3f40b8>0x0){_0x38f51b+=_0x24daff;}_0x393632[_0x70d6('0x17')](dbH[_0x70d6('0x2c')][_0x70d6('0x2d')](util[_0x70d6('0x1d')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x24daff,_0x38f51b),{'type':dbH[_0x70d6('0x2c')][_0x70d6('0x2e')][_0x70d6('0x2f')]}));});if(_0x2e79d1>0x0){_0x38f51b+=_0x24daff;_0x393632[_0x70d6('0x17')](dbH[_0x70d6('0x2c')][_0x70d6('0x2d')](util[_0x70d6('0x1d')](_0x70d6('0x30'),QUERY,_0x2e79d1,_0x38f51b),{'type':dbH[_0x70d6('0x2c')]['QueryTypes'][_0x70d6('0x2f')]}));}}}else{_0x393632[_0x70d6('0x17')](dbH[_0x70d6('0x2c')][_0x70d6('0x2d')](QUERY,{'type':dbH['sequelize'][_0x70d6('0x2e')][_0x70d6('0x2f')]}));}var _0x325576=path['dirname'](PATH);var _0x5be3ce=path[_0x70d6('0x31')](PATH,_0x70d6('0x32'));var _0x556338=_0x5566b8['split']&&_0x393632[_0x70d6('0x15')]>0x1;var _0x2b455f=[];if(!fs[_0x70d6('0x33')](path[_0x70d6('0x34')](_0x325576,_0x5be3ce))&&_0x556338){fs[_0x70d6('0x35')](path['join'](_0x325576,_0x5be3ce));}return BPromise[_0x70d6('0x36')](_0x393632,function(_0x345bf9){_0x2b455f[_0x70d6('0x17')](_0x345bf9);})[_0x70d6('0x29')](function(){var _0x43845e=[];for(var _0x59e9de=0x0;_0x59e9de<_0x2b455f[_0x70d6('0x15')];_0x59e9de+=0x1){var _0x33803e=_0x2b455f[_0x59e9de];var _0x31688f=createTables(_[_0x70d6('0x37')](_0x33803e));var _0x4e468f;var _0x24e29b=getPDFDocDefinition(_0x31688f);var _0x5e5f67=getPDFPrinter();var _0x478f00=_0x5e5f67['createPdfKitDocument'](_0x24e29b);if(_0x556338){_0x4e468f=path[_0x70d6('0x34')](_0x325576,_0x5be3ce,util[_0x70d6('0x1d')](_0x70d6('0x38'),_0x5be3ce,_0x59e9de,'pdf'));}else{_0x4e468f=path[_0x70d6('0x34')](_0x325576,util[_0x70d6('0x1d')](_0x70d6('0x39'),_0x5be3ce,_0x70d6('0x3a')));}_0x43845e[_0x70d6('0x17')](writePDFDocument(_0x478f00,_0x4e468f));}return Promise[_0x70d6('0x3b')](_0x43845e);})[_0x70d6('0x29')](function(){if(_0x556338){return new Promise(function(_0x42213c){zipdir(path[_0x70d6('0x34')](_0x325576,_0x5be3ce),{'saveTo':path[_0x70d6('0x34')](_0x325576,util[_0x70d6('0x1d')]('%s.%s',_0x5be3ce,_0x70d6('0x3c')))},function(){rimraf(path[_0x70d6('0x34')](_0x325576,_0x5be3ce),function(){});_0x42213c(_0x70d6('0x3d'));});});}})[_0x70d6('0x29')](function(){if(!_0x556338)return;rimraf(path[_0x70d6('0x34')](_0x325576,_0x5be3ce),function(){});})[_0x70d6('0x29')](function(){logger[_0x70d6('0x3e')](util['format'](_0x70d6('0x3f'),EXTRACTED_REPORT_ID,_0x70d6('0x40')));return analyticExtractedReport(_0x70d6('0x41'),_0x556338?util[_0x70d6('0x1d')]('%s.%s',_0x5be3ce,_0x556338?_0x70d6('0x3c'):_0x70d6('0x3a')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x70d6('0x3e')](util[_0x70d6('0x1d')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x70d6('0x40')));return db[_0x70d6('0xe')][_0x70d6('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x70d6('0x29')](function(_0x21b89e){EXTRACTED_REPORT=_0x21b89e;return dbH[_0x70d6('0x2c')][_0x70d6('0x2d')](util[_0x70d6('0x1d')](_0x70d6('0x43'),QUERY),{'type':dbH[_0x70d6('0x2c')][_0x70d6('0x2e')][_0x70d6('0x2f')]});})[_0x70d6('0x29')](extractReport)['catch'](function(_0x45105b){logger[_0x70d6('0x3e')](util[_0x70d6('0x1d')](_0x70d6('0x44'),EXTRACTED_REPORT_ID,'PDF'),util[_0x70d6('0x45')](_0x45105b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x70d6('0x46')](function(){process[_0x70d6('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x354136=new PdfPrinter({'Arial':{'normal':__dirname+_0x70d6('0x48'),'bold':__dirname+_0x70d6('0x49'),'italics':__dirname+_0x70d6('0x4a'),'bolditalics':__dirname+_0x70d6('0x4b')}});return _0x354136;}function getPDFDocDefinitionFromHTML(_0xb26e73,_0xeb69a6){var _0x286805=util[_0x70d6('0x1d')]('%s\x20#%d',_0xeb69a6[_0x70d6('0x4c')],_0xeb69a6['interactionId']);var _0x395740=moment()['format']('YYYY-MM-DD')['toString']();var _0x37c5d6=htmlToPdfmake(_0xb26e73,{'window':window,'tableAutoSize':!![]});return{'content':[_0x37c5d6],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x70d6('0x4d'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x70d6('0x4d'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x70d6('0x4d')}},'header':function(){return[{'text':_0x70d6('0x4e'),'style':_0x70d6('0x1e')}];},'footer':function(_0x54c27f,_0x3bc657){return[{'text':util[_0x70d6('0x1d')](_0x70d6('0x4f'),_0x286805,_0x54c27f,_0x3bc657,_0x395740),'style':'footer'}];}};}function writePDFDocument(_0x26a7c3,_0x14114a){return new Promise(function(_0x457cca,_0x204c25){var _0x509a3d=_0x26a7c3['pipe'](fs[_0x70d6('0x50')](_0x14114a));_0x509a3d['on'](_0x70d6('0x51'),function(){_0x457cca(_0x70d6('0x51'));});_0x509a3d['on'](_0x70d6('0x52'),function(_0x344816){_0x204c25(_0x344816);});_0x26a7c3[_0x70d6('0x53')]();});}exports[_0x70d6('0x54')]=function(_0x14dc98,_0x1fc442){var _0x293ba9=getPDFPrinter();var _0x8695e8=getPDFDocDefinitionFromHTML(_0x14dc98,_0x1fc442);var _0x11e2e7=_0x293ba9[_0x70d6('0x55')](_0x8695e8);return writePDFDocument(_0x11e2e7,_0x1fc442[_0x70d6('0x1')])['catch'](function(_0x3ab308){throw _0x3ab308;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 2203de8..02b0b5a 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 _0x15bf=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','forEach','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','mkdirSync','each','join','%s%d.%s','xlsx','writeFileSync','binary','zip\x20finished','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Failed','exit','util','path','json2xls','rimraf','../../mysqldb','../../config/logger','argv','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','query'];(function(_0x196fc5,_0x35f429){var _0x1b340d=function(_0x4922c4){while(--_0x4922c4){_0x196fc5['push'](_0x196fc5['shift']());}};_0x1b340d(++_0x35f429);}(_0x15bf,0x18e));var _0xf15b=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x15bf[_0x209941];return _0x1e8729;};'use strict';var util=require(_0xf15b('0x0'));var path=require(_0xf15b('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0xf15b('0x2'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xf15b('0x3'));var db=require(_0xf15b('0x4'))['db'];var dbH=require(_0xf15b('0x4'))['dbH'];var logger=require(_0xf15b('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xf15b('0x6')][0x2]);var QUERY=process[_0xf15b('0x6')][0x3];var PATH=process[_0xf15b('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5e8b8a,_0x26b19c){var _0x155bdc={'status':_0x5e8b8a};var _0xbbbbe8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x26b19c){_0x155bdc['savename']=_0x26b19c;}return db['AnalyticExtractedReport']['update'](_0x155bdc,_0xbbbbe8);}function main(){var _0x19e9ca=0x1388;var _0x3581b3;logger[_0xf15b('0x7')](util['format'](_0xf15b('0x8'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xf15b('0x9')][_0xf15b('0xa')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf15b('0xb'),_0xf15b('0xc')]})[_0xf15b('0xd')](function(_0x3de16e){if(_0x3de16e){_0x3581b3=_0x3de16e;_0x19e9ca=_0x3581b3['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xf15b('0xe')][_0xf15b('0xf')](util['format'](_0xf15b('0x10'),QUERY),{'type':dbH[_0xf15b('0xe')][_0xf15b('0x11')][_0xf15b('0x12')]});})['then'](function(_0x50cff7){if(!_0x50cff7[0x0]['num']){return analyticExtractedReport(_0xf15b('0x13'));}var _0x36937e=[];var _0x6545d8=0x0;if(_0x3581b3['split']){if(_0x50cff7&&_0x50cff7[_0xf15b('0x14')]){var _0x121ae4=_[_0xf15b('0x15')](_0x50cff7[0x0][_0xf15b('0x16')]/_0x19e9ca);var _0x5959d0=Number['isInteger'](_0x50cff7[0x0][_0xf15b('0x16')]/_0x19e9ca)?_0x50cff7[0x0][_0xf15b('0x16')]%_0x19e9ca:0x0;_0x121ae4[_0xf15b('0x17')](function(_0x177a3){if(_0x177a3>0x0){_0x6545d8+=_0x19e9ca;}_0x36937e[_0xf15b('0x18')](dbH[_0xf15b('0xe')][_0xf15b('0xf')](util[_0xf15b('0x19')](_0xf15b('0x1a'),QUERY,_0x19e9ca,_0x6545d8),{'type':dbH[_0xf15b('0xe')][_0xf15b('0x11')][_0xf15b('0x12')]}));});if(_0x5959d0>0x0){_0x6545d8+=_0x19e9ca;_0x36937e[_0xf15b('0x18')](dbH[_0xf15b('0xe')][_0xf15b('0xf')](util['format'](_0xf15b('0x1a'),QUERY,_0x5959d0,_0x6545d8),{'type':dbH[_0xf15b('0xe')][_0xf15b('0x11')][_0xf15b('0x12')]}));}}}else{_0x36937e[_0xf15b('0x18')](dbH['sequelize'][_0xf15b('0xf')](QUERY,{'type':dbH[_0xf15b('0xe')]['QueryTypes'][_0xf15b('0x12')]}));}var _0x4faef7=path[_0xf15b('0x1b')](PATH);var _0x3039e0=path[_0xf15b('0x1c')](PATH,_0xf15b('0x1d'));var _0x516235=_0x3581b3[_0xf15b('0xb')]&&_0x36937e[_0xf15b('0x14')]>0x1;var _0xd77145=[];if(!fs[_0xf15b('0x1e')](path['join'](_0x4faef7,_0x3039e0))&&_0x516235){fs[_0xf15b('0x1f')](path['join'](_0x4faef7,_0x3039e0));}return BPromise[_0xf15b('0x20')](_0x36937e,function(_0x9d0564){_0xd77145['push'](_0x9d0564);})['then'](function(){for(var _0x4f105b=0x0;_0x4f105b<_0xd77145[_0xf15b('0x14')];_0x4f105b+=0x1){var _0x1512b0;var _0x4d799a=_0xd77145[_0x4f105b];if(_0x516235){_0x1512b0=path[_0xf15b('0x21')](_0x4faef7,_0x3039e0,util[_0xf15b('0x19')](_0xf15b('0x22'),_0x3039e0,_0x4f105b,_0xf15b('0x23')));}else{_0x1512b0=path[_0xf15b('0x21')](_0x4faef7,util[_0xf15b('0x19')]('%s.%s',_0x3039e0,'xlsx'));}fs[_0xf15b('0x24')](_0x1512b0,json2xls(_0x4d799a),_0xf15b('0x25'));}})[_0xf15b('0xd')](function(){if(_0x516235){return new Promise(function(_0x33ba73){zipdir(path[_0xf15b('0x21')](_0x4faef7,_0x3039e0),{'saveTo':path['join'](_0x4faef7,util[_0xf15b('0x19')]('%s.%s',_0x3039e0,'zip'))},function(_0x5ef1c6,_0x2410b4){rimraf(path[_0xf15b('0x21')](_0x4faef7,_0x3039e0),function(){});_0x33ba73(_0xf15b('0x26'));});});}})[_0xf15b('0xd')](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xf15b('0x27'),_0x516235?util[_0xf15b('0x19')]('%s.%s',_0x3039e0,_0x516235?_0xf15b('0x28'):_0xf15b('0x23')):null);});})[_0xf15b('0x29')](function(_0x5b273b){logger[_0xf15b('0x7')](util[_0xf15b('0x19')](_0xf15b('0x2a'),EXTRACTED_REPORT_ID,_0xf15b('0x2b')),util['inspect'](_0x5b273b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf15b('0x2c'));})['finally'](function(){process[_0xf15b('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x61c0=['query','format','sequelize','QueryTypes','SELECT','num','length','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','.xlsx','each','join','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','exit','util','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info','Setting','split','splitSizeXlsx','then'];(function(_0xea343d,_0x311197){var _0x2c6e9c=function(_0x454bd6){while(--_0x454bd6){_0xea343d['push'](_0xea343d['shift']());}};_0x2c6e9c(++_0x311197);}(_0x61c0,0x1b1));var _0x061c=function(_0x1a550a,_0x238578){_0x1a550a=_0x1a550a-0x0;var _0xee8d93=_0x61c0[_0x1a550a];return _0xee8d93;};'use strict';var util=require(_0x061c('0x0'));var path=require('path');var _=require(_0x061c('0x1'));var fs=require('fs');var json2xls=require(_0x061c('0x2'));var BPromise=require(_0x061c('0x3'));var zipdir=require(_0x061c('0x4'));var rimraf=require(_0x061c('0x5'));var db=require(_0x061c('0x6'))['db'];var dbH=require(_0x061c('0x6'))[_0x061c('0x7')];var logger=require('../../config/logger')(_0x061c('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x061c('0x9')][0x3];var PATH=process[_0x061c('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4c2c49,_0x5a12bc){var _0x331246={'status':_0x4c2c49};var _0x366e51={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a12bc){_0x331246[_0x061c('0xa')]=_0x5a12bc;}return db['AnalyticExtractedReport'][_0x061c('0xb')](_0x331246,_0x366e51);}function main(){var _0x275825=0x1388;var _0x562d74;logger[_0x061c('0xc')](util['format']('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'));return db[_0x061c('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x061c('0xe'),_0x061c('0xf')]})[_0x061c('0x10')](function(_0xe3b2be){if(_0xe3b2be){_0x562d74=_0xe3b2be;_0x275825=_0x562d74[_0x061c('0xf')]||0x1388;}})[_0x061c('0x10')](function(){return dbH['sequelize'][_0x061c('0x11')](util[_0x061c('0x12')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x061c('0x13')][_0x061c('0x14')][_0x061c('0x15')]});})['then'](function(_0x2f601e){if(!_0x2f601e[0x0][_0x061c('0x16')]){return analyticExtractedReport('Empty');}var _0x4d9cc0=[];var _0x57daf5=0x0;if(_0x562d74['split']){if(_0x2f601e&&_0x2f601e[_0x061c('0x17')]){var _0x12551c=_['range'](_0x2f601e[0x0][_0x061c('0x16')]/_0x275825);var _0x26e192=Number[_0x061c('0x18')](_0x2f601e[0x0]['num']/_0x275825)?_0x2f601e[0x0][_0x061c('0x16')]%_0x275825:0x0;_0x12551c[_0x061c('0x19')](function(_0x3d608e){if(_0x3d608e>0x0){_0x57daf5+=_0x275825;}_0x4d9cc0['push'](dbH['sequelize'][_0x061c('0x11')](util[_0x061c('0x12')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x275825,_0x57daf5),{'type':dbH[_0x061c('0x13')][_0x061c('0x14')]['SELECT']}));});if(_0x26e192>0x0){_0x57daf5+=_0x275825;_0x4d9cc0[_0x061c('0x1a')](dbH[_0x061c('0x13')][_0x061c('0x11')](util['format'](_0x061c('0x1b'),QUERY,_0x26e192,_0x57daf5),{'type':dbH['sequelize'][_0x061c('0x14')]['SELECT']}));}}}else{_0x4d9cc0[_0x061c('0x1a')](dbH[_0x061c('0x13')][_0x061c('0x11')](QUERY,{'type':dbH[_0x061c('0x13')][_0x061c('0x14')]['SELECT']}));}var _0x39aaf1=path[_0x061c('0x1c')](PATH);var _0xfc1378=path['basename'](PATH,_0x061c('0x1d'));var _0x42871f=_0x562d74[_0x061c('0xe')]&&_0x4d9cc0[_0x061c('0x17')]>0x1;var _0x325a15=[];if(!fs['existsSync'](path['join'](_0x39aaf1,_0xfc1378))&&_0x42871f){fs['mkdirSync'](path['join'](_0x39aaf1,_0xfc1378));}return BPromise[_0x061c('0x1e')](_0x4d9cc0,function(_0x389e5e){_0x325a15[_0x061c('0x1a')](_0x389e5e);})[_0x061c('0x10')](function(){for(var _0x51a0a3=0x0;_0x51a0a3<_0x325a15['length'];_0x51a0a3+=0x1){var _0x4938bd;var _0x530e1f=_0x325a15[_0x51a0a3];if(_0x42871f){_0x4938bd=path[_0x061c('0x1f')](_0x39aaf1,_0xfc1378,util['format'](_0x061c('0x20'),_0xfc1378,_0x51a0a3,_0x061c('0x21')));}else{_0x4938bd=path['join'](_0x39aaf1,util[_0x061c('0x12')]('%s.%s',_0xfc1378,_0x061c('0x21')));}fs[_0x061c('0x22')](_0x4938bd,json2xls(_0x530e1f),_0x061c('0x23'));}})['then'](function(){if(_0x42871f){return new Promise(function(_0x58eb6f){zipdir(path['join'](_0x39aaf1,_0xfc1378),{'saveTo':path[_0x061c('0x1f')](_0x39aaf1,util[_0x061c('0x12')](_0x061c('0x24'),_0xfc1378,_0x061c('0x25')))},function(_0xaa6847,_0x16e8e9){rimraf(path[_0x061c('0x1f')](_0x39aaf1,_0xfc1378),function(){});_0x58eb6f(_0x061c('0x26'));});});}})[_0x061c('0x10')](function(){logger[_0x061c('0xc')](util[_0x061c('0x12')](_0x061c('0x27'),EXTRACTED_REPORT_ID,_0x061c('0x28')));return analyticExtractedReport('Completed',_0x42871f?util[_0x061c('0x12')](_0x061c('0x24'),_0xfc1378,_0x42871f?_0x061c('0x25'):_0x061c('0x21')):null);});})[_0x061c('0x29')](function(_0x534bda){logger[_0x061c('0xc')](util[_0x061c('0x12')](_0x061c('0x2a'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x534bda,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x061c('0x2b')](function(){process[_0x061c('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 03bf827..f912aa7 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 _0xd817=['intervals','models','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','hasOwnProperty','priority','extensions','extension','format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','push','Set','CDR(routeid)=','outbound','CDR(destination)=','${EXTEN:','cutdigits','ExecIf','):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','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','toLowerCase','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','Interval','findAll','then'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xd817,0xd4));var _0x7d81=function(_0x57fa7e,_0xd0b5ce){_0x57fa7e=_0x57fa7e-0x0;var _0x320671=_0xd817[_0x57fa7e];return _0x320671;};'use strict';var _=require(_0x7d81('0x0'));var util=require('util');function rewrite(_0xbaa86d,_0x427586){var _0x28b01e=this;return _0xbaa86d['models'][_0x7d81('0x1')][_0x7d81('0x2')]({'raw':!![]})[_0x7d81('0x3')](function(_0x3f9e42){_0x28b01e[_0x7d81('0x4')]=_0x3f9e42;return _0xbaa86d[_0x7d81('0x5')][_0x7d81('0x6')][_0x7d81('0x2')]({'where':{'IntervalId':_0x427586['IntervalId']},'raw':!![]});})[_0x7d81('0x3')](function(_0xd27c99){return _0xbaa86d[_0x7d81('0x5')][_0x7d81('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x7d81('0x7')](_[_0x7d81('0x8')](_0xd27c99,_0x7d81('0x9')))}},'order':[{'raw':_0x7d81('0xa')}],'raw':!![]});})[_0x7d81('0x3')](function(_0x343f90){var _0x23c810=_[_0x7d81('0xb')](_0x343f90,{'priority':'1'});var _0x4d3e08=_[_0x7d81('0xb')](_0x343f90,{'isApp':0x1});var _0x3adacc=_['groupBy'](_0x4d3e08,_0x7d81('0x9'));var _0x292ecb=['queue','playback'];var _0x383b85=[];var _0x1f21cf=[];for(var _0x37f8fd in _0x3adacc){if(_0x3adacc[_0x7d81('0xc')](_0x37f8fd)){_0x28b01e[_0x7d81('0xd')]=0x2;_0x28b01e[_0x7d81('0xe')]=[];_0x28b01e[_0x7d81('0xf')]=_['find'](_0x23c810,{'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')]});_0x28b01e[_0x7d81('0xe')]['push']({'type':_0x3adacc[_0x37f8fd][0x0]['type'],'app':'Set','appdata':util[_0x7d81('0x10')](_0x7d81('0x11'),_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')]),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});if(_0x3adacc[_0x37f8fd][0x0]['type']===_0x7d81('0x15')){_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0]['type'],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x18')+_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')],'context':_0x3adacc[_0x37f8fd][0x0]['context'],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e['priority']++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});}else if(_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')]===_0x7d81('0x19')){if(_0x28b01e[_0x7d81('0xf')]){_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0]['type'],'app':'Set','appdata':_0x7d81('0x1a')+(_0x28b01e['extension']['cutdigits']?_0x7d81('0x1b')+_0x28b01e[_0x7d81('0xf')][_0x7d81('0x1c')]+'}':'${EXTEN}'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});}_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x18')+_0x3adacc[_0x37f8fd][0x0]['VoiceExtensionId'],'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x28b01e['priority']++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});var _0x36c3d5=_0x28b01e[_0x7d81('0xd')]++;_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x36c3d5+0x2)+_0x7d81('0x1e')+(_0x36c3d5+0x1)+')','context':_0x3adacc[_0x37f8fd][0x0]['context'],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x36c3d5,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});if(_0x28b01e['extension']){_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x28b01e[_0x7d81('0xf')][_0x7d81('0x1c')]?_0x7d81('0x1f')+_0x28b01e[_0x7d81('0xf')]['cutdigits']+'}':_0x7d81('0x20'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x28b01e['priority']++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});}_0x28b01e['extensions'][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0]['type'],'app':'Set','appdata':_0x7d81('0x21')+_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')],'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});if(_0x28b01e[_0x7d81('0xf')]&&_0x28b01e['extension'][_0x7d81('0xc')](_0x7d81('0x22'))&&_0x28b01e['extension']['recordingFormat']!==_0x7d81('0x23')){_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x24'),'context':_0x3adacc[_0x37f8fd][0x0]['context'],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0]['VoiceExtensionId']});_0x28b01e['extensions'][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x25')+_0x28b01e[_0x7d81('0xf')][_0x7d81('0x22')]||_0x7d81('0x26'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});}}_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x27'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e[_0x7d81('0xd')]++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});_0x28b01e[_0x7d81('0xe')]['push']({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x28'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'priority':_0x28b01e['priority']++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0]['VoiceExtensionId']});_0x28b01e[_0x7d81('0xe')][_0x7d81('0x16')]({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x29'),'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'exten':_0x3adacc[_0x37f8fd][0x0]['exten'],'priority':_0x28b01e['priority']++,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});for(var _0x4d4919=0x0,_0x486cd2=0x0;_0x4d4919<_0x3adacc[_0x37f8fd][_0x7d81('0x2a')];_0x4d4919+=0x1,_0x486cd2=0x0){var _0x64bacf=_0x3adacc[_0x37f8fd][_0x4d4919];if(_0x64bacf[_0x7d81('0x12')]){_0x64bacf[_0x7d81('0x12')]=_0x64bacf[_0x7d81('0x12')]['toLowerCase']();}var _0x28cd69=[];var _0x47f91f=[];delete _0x64bacf['id'];delete _0x64bacf[_0x7d81('0x2b')];delete _0x64bacf[_0x7d81('0x2c')];var _0x40cc36=_0x64bacf[_0x7d81('0x2d')]!==_0x7d81('0x2e')?[_0x64bacf[_0x7d81('0x2d')]]:_0x64bacf[_0x7d81('0x2f')]?_['map'](_[_0x7d81('0xb')](_0x28b01e[_0x7d81('0x4')],{'IntervalId':_0x64bacf[_0x7d81('0x2f')]}),_0x7d81('0x2d')):[];if(_0x64bacf['hasOwnProperty'](_0x7d81('0x30'))){if(_0x64bacf[_0x7d81('0x30')]&&_0x64bacf[_0x7d81('0x30')]!=='--'){_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':'CDR(tag)='+_0x64bacf['tag'],'context':_0x64bacf[_0x7d81('0x13')],'exten':_0x64bacf[_0x7d81('0x9')],'priority':_0x40cc36['length']+_0x28b01e[_0x7d81('0xd')]+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});}}if(_0x64bacf[_0x7d81('0x12')]===_0x7d81('0x19')&&_0x64bacf[_0x7d81('0xc')]('callerID')){if(_0x64bacf[_0x7d81('0x31')]){_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x1d'),'appdata':_0x7d81('0x32')+_0x64bacf[_0x7d81('0x31')]+')','context':_0x64bacf['context'],'exten':_0x64bacf[_0x7d81('0x9')],'priority':_0x40cc36[_0x7d81('0x2a')]+_0x28b01e[_0x7d81('0xd')]+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});}else{_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf['type'],'app':_0x7d81('0x1d'),'appdata':_0x7d81('0x33'),'context':_0x64bacf[_0x7d81('0x13')],'exten':_0x64bacf[_0x7d81('0x9')],'priority':_0x40cc36[_0x7d81('0x2a')]+_0x28b01e['priority']+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});}}if(_0x64bacf[_0x7d81('0xc')]('answer')){if(_0x292ecb[_0x7d81('0x34')](_0x64bacf[_0x7d81('0x35')][_0x7d81('0x36')]())>=0x0&&_0x64bacf['appType']!==_0x7d81('0x37')){if(_0x64bacf[_0x7d81('0x38')]){_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x1d'),'appdata':_0x7d81('0x39'),'context':_0x64bacf[_0x7d81('0x13')],'exten':_0x64bacf[_0x7d81('0x9')],'priority':_0x40cc36[_0x7d81('0x2a')]+_0x28b01e[_0x7d81('0xd')]+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});_0x28cd69['push']({'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x3a'),'context':_0x64bacf['context'],'exten':_0x64bacf['exten'],'priority':_0x40cc36['length']+_0x28b01e['priority']+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});}else{_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x1d'),'appdata':_0x7d81('0x3b'),'context':_0x64bacf[_0x7d81('0x13')],'exten':_0x64bacf['exten'],'priority':_0x40cc36['length']+_0x28b01e[_0x7d81('0xd')]+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});_0x28cd69[_0x7d81('0x16')]({'type':_0x64bacf['type'],'app':_0x7d81('0x17'),'appdata':_0x7d81('0x3c'),'context':_0x64bacf[_0x7d81('0x13')],'exten':_0x64bacf[_0x7d81('0x9')],'priority':_0x40cc36['length']+_0x28b01e[_0x7d81('0xd')]+_0x486cd2++,'VoiceExtensionId':_0x64bacf[_0x7d81('0x14')]});}}}for(var _0x5456ee=0x0;_0x5456ee<_0x40cc36['length'];_0x5456ee+=0x1){var _0x2400fa=_0x28b01e[_0x7d81('0xd')]+_0x40cc36['length'];var _0x1071d6=_0x5456ee===_0x40cc36[_0x7d81('0x2a')]-0x1?_0x28b01e[_0x7d81('0xd')]+_0x28cd69[_0x7d81('0x2a')]+_0x47f91f['length']+0x2:_0x28b01e['priority']+_0x5456ee+0x1;_0x28cd69[_0x7d81('0x3d')](_0x5456ee,0x0,{'type':_0x64bacf[_0x7d81('0x12')],'app':_0x7d81('0x3e'),'appdata':_0x40cc36[_0x5456ee]+'?'+_0x64bacf['context']+',${EXTEN},'+_0x2400fa+':'+_0x64bacf['context']+',${EXTEN},'+_0x1071d6,'exten':_0x64bacf[_0x7d81('0x9')],'context':_0x64bacf['context'],'priority':_0x28b01e['priority']+_0x5456ee,'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0]['VoiceExtensionId']});}_0x64bacf['priority']=_0x28cd69['length']?_[_0x7d81('0x3f')](_0x28cd69)[_0x7d81('0xd')]+0x1:_0x28b01e[_0x7d81('0xd')];_0x28b01e[_0x7d81('0xd')]=(_0x47f91f['length']?_[_0x7d81('0x3f')](_0x47f91f)[_0x7d81('0xd')]:_0x64bacf[_0x7d81('0xd')])+0x1;_0x28b01e[_0x7d81('0xe')]=_[_0x7d81('0x40')](_0x28b01e['extensions'],_0x28cd69,[_0x64bacf],_0x47f91f);}_0x28b01e['extensions']['push']({'type':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x12')],'app':_0x7d81('0x41'),'exten':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x9')],'context':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x13')],'priority':_0x28b01e[_0x7d81('0xd')],'VoiceExtensionId':_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]});_0x383b85[_0x7d81('0x16')](_0x3adacc[_0x37f8fd][0x0][_0x7d81('0x14')]);_0x1f21cf=_[_0x7d81('0x40')](_0x1f21cf,_0x28b01e[_0x7d81('0xe')]);}}return _0xbaa86d['transaction'](function(_0x1292c8){return _0xbaa86d[_0x7d81('0x5')][_0x7d81('0x6')][_0x7d81('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x383b85}},'transaction':_0x1292c8})[_0x7d81('0x3')](function(_0x1100bc){return _0xbaa86d[_0x7d81('0x5')][_0x7d81('0x6')][_0x7d81('0x43')](_[_0x7d81('0x44')](_0x1f21cf,'priority'),{'transaction':_0x1292c8});});});})[_0x7d81('0x45')](function(_0x3311e2){console[_0x7d81('0x46')](_0x3311e2);});}exports[_0x7d81('0x47')]=rewrite; \ No newline at end of file +var _0x0bed=['models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','rewrite','lodash','util'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0x0bed,0xd3));var _0xd0be=function(_0x4d0146,_0x31f115){_0x4d0146=_0x4d0146-0x0;var _0x367086=_0x0bed[_0x4d0146];return _0x367086;};'use strict';var _=require(_0xd0be('0x0'));var util=require(_0xd0be('0x1'));function rewrite(_0x5d95b9,_0x2222c8){var _0x4eee3e=this;return _0x5d95b9[_0xd0be('0x2')][_0xd0be('0x3')][_0xd0be('0x4')]({'raw':!![]})[_0xd0be('0x5')](function(_0x5e5575){_0x4eee3e[_0xd0be('0x6')]=_0x5e5575;return _0x5d95b9[_0xd0be('0x2')][_0xd0be('0x7')][_0xd0be('0x4')]({'where':{'IntervalId':_0x2222c8[_0xd0be('0x8')]},'raw':!![]});})[_0xd0be('0x5')](function(_0x4e3ceb){return _0x5d95b9[_0xd0be('0x2')]['VoiceExtension'][_0xd0be('0x4')]({'where':{'exten':{'$in':_[_0xd0be('0x9')](_[_0xd0be('0xa')](_0x4e3ceb,_0xd0be('0xb')))}},'order':[{'raw':_0xd0be('0xc')}],'raw':!![]});})[_0xd0be('0x5')](function(_0x24aff5){var _0x1a454e=_[_0xd0be('0xd')](_0x24aff5,{'priority':'1'});var _0x25dd7b=_[_0xd0be('0xd')](_0x24aff5,{'isApp':0x1});var _0xfa0797=_[_0xd0be('0xe')](_0x25dd7b,_0xd0be('0xb'));var _0x48af50=['queue',_0xd0be('0xf')];var _0x2c8017=[];var _0x3ae417=[];for(var _0x1ecb9c in _0xfa0797){if(_0xfa0797[_0xd0be('0x10')](_0x1ecb9c)){_0x4eee3e[_0xd0be('0x11')]=0x2;_0x4eee3e['extensions']=[];_0x4eee3e[_0xd0be('0x12')]=_[_0xd0be('0x13')](_0x1a454e,{'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')]});_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':_0xd0be('0x17'),'appdata':util[_0xd0be('0x18')](_0xd0be('0x19'),_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')]),'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});if(_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')]===_0xd0be('0x1c')){_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x1d')+_0xfa0797[_0x1ecb9c][0x0]['VoiceExtensionId'],'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0]['VoiceExtensionId']});}else if(_0xfa0797[_0x1ecb9c][0x0]['type']===_0xd0be('0x1e')){if(_0x4eee3e[_0xd0be('0x12')]){_0x4eee3e['extensions'][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':'CDR(destination)='+(_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x1f')]?_0xd0be('0x20')+_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x1f')]+'}':_0xd0be('0x21')),'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0]['VoiceExtensionId']});}_0x4eee3e[_0xd0be('0x14')]['push']({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':'Set','appdata':_0xd0be('0x1d')+_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')],'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});var _0x437c90=_0x4eee3e[_0xd0be('0x11')]++;_0x4eee3e[_0xd0be('0x14')]['push']({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x22'),'appdata':_0xd0be('0x23')+(_0x437c90+0x2)+'):Goto('+(_0x437c90+0x1)+')','context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x437c90,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0]['VoiceExtensionId']});if(_0x4eee3e['extension']){_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':_0xd0be('0x17'),'appdata':_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x1f')]?_0xd0be('0x24')+_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x1f')]+'}':'CDR(prefix)=noprefix','context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0]['exten'],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});}_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':'outboundrouteid='+_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')],'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});if(_0x4eee3e['extension']&&_0x4eee3e[_0xd0be('0x12')]['hasOwnProperty'](_0xd0be('0x25'))&&_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x25')]!==_0xd0be('0x26')){_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':_0xd0be('0x17'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xfa0797[_0x1ecb9c][0x0]['context'],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});_0x4eee3e[_0xd0be('0x14')]['push']({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x27')+_0x4eee3e[_0xd0be('0x12')][_0xd0be('0x25')]||'wav','context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0]['exten'],'priority':_0x4eee3e['priority']++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});}}_0x4eee3e['extensions'][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x28'),'context':_0xfa0797[_0x1ecb9c][0x0]['context'],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e['priority']++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0]['type'],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x29'),'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e['priority']++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x2a'),'context':_0xfa0797[_0x1ecb9c][0x0]['context'],'exten':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0xb')],'priority':_0x4eee3e[_0xd0be('0x11')]++,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});for(var _0x5731ef=0x0,_0x340008=0x0;_0x5731ef<_0xfa0797[_0x1ecb9c]['length'];_0x5731ef+=0x1,_0x340008=0x0){var _0x5d94ec=_0xfa0797[_0x1ecb9c][_0x5731ef];if(_0x5d94ec[_0xd0be('0x16')]){_0x5d94ec[_0xd0be('0x16')]=_0x5d94ec[_0xd0be('0x16')][_0xd0be('0x2b')]();}var _0x5e3028=[];var _0x448222=[];delete _0x5d94ec['id'];delete _0x5d94ec[_0xd0be('0x2c')];delete _0x5d94ec[_0xd0be('0x2d')];var _0x4e0b9c=_0x5d94ec[_0xd0be('0x2e')]!==_0xd0be('0x2f')?[_0x5d94ec['interval']]:_0x5d94ec[_0xd0be('0x8')]?_[_0xd0be('0xa')](_[_0xd0be('0xd')](_0x4eee3e[_0xd0be('0x6')],{'IntervalId':_0x5d94ec[_0xd0be('0x8')]}),'interval'):[];if(_0x5d94ec['hasOwnProperty'](_0xd0be('0x30'))){if(_0x5d94ec[_0xd0be('0x30')]&&_0x5d94ec[_0xd0be('0x30')]!=='--'){_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec[_0xd0be('0x16')],'app':'Set','appdata':_0xd0be('0x31')+_0x5d94ec['tag'],'context':_0x5d94ec['context'],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c[_0xd0be('0x32')]+_0x4eee3e[_0xd0be('0x11')]+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});}}if(_0x5d94ec[_0xd0be('0x16')]===_0xd0be('0x1e')&&_0x5d94ec[_0xd0be('0x10')](_0xd0be('0x33'))){if(_0x5d94ec[_0xd0be('0x33')]){_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec['type'],'app':_0xd0be('0x22'),'appdata':_0xd0be('0x34')+_0x5d94ec[_0xd0be('0x33')]+')','context':_0x5d94ec[_0xd0be('0x1a')],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c[_0xd0be('0x32')]+_0x4eee3e[_0xd0be('0x11')]+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});}else{_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec[_0xd0be('0x16')],'app':_0xd0be('0x22'),'appdata':_0xd0be('0x35'),'context':_0x5d94ec[_0xd0be('0x1a')],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c['length']+_0x4eee3e[_0xd0be('0x11')]+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});}}if(_0x5d94ec[_0xd0be('0x10')]('answer')){if(_0x48af50[_0xd0be('0x36')](_0x5d94ec[_0xd0be('0x37')][_0xd0be('0x2b')]())>=0x0&&_0x5d94ec[_0xd0be('0x38')]!==_0xd0be('0x39')){if(_0x5d94ec[_0xd0be('0x3a')]){_0x5e3028['push']({'type':_0x5d94ec['type'],'app':_0xd0be('0x22'),'appdata':_0xd0be('0x3b'),'context':_0x5d94ec[_0xd0be('0x1a')],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c[_0xd0be('0x32')]+_0x4eee3e[_0xd0be('0x11')]+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec[_0xd0be('0x16')],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x3c'),'context':_0x5d94ec[_0xd0be('0x1a')],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c[_0xd0be('0x32')]+_0x4eee3e['priority']+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});}else{_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec['type'],'app':_0xd0be('0x22'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x5d94ec[_0xd0be('0x1a')],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c[_0xd0be('0x32')]+_0x4eee3e['priority']+_0x340008++,'VoiceExtensionId':_0x5d94ec[_0xd0be('0x1b')]});_0x5e3028[_0xd0be('0x15')]({'type':_0x5d94ec['type'],'app':_0xd0be('0x17'),'appdata':_0xd0be('0x3d'),'context':_0x5d94ec['context'],'exten':_0x5d94ec[_0xd0be('0xb')],'priority':_0x4e0b9c['length']+_0x4eee3e[_0xd0be('0x11')]+_0x340008++,'VoiceExtensionId':_0x5d94ec['VoiceExtensionId']});}}}for(var _0x479a6d=0x0;_0x479a6d<_0x4e0b9c['length'];_0x479a6d+=0x1){var _0x18ceb3=_0x4eee3e[_0xd0be('0x11')]+_0x4e0b9c[_0xd0be('0x32')];var _0x1b03b6=_0x479a6d===_0x4e0b9c['length']-0x1?_0x4eee3e['priority']+_0x5e3028['length']+_0x448222[_0xd0be('0x32')]+0x2:_0x4eee3e[_0xd0be('0x11')]+_0x479a6d+0x1;_0x5e3028['splice'](_0x479a6d,0x0,{'type':_0x5d94ec[_0xd0be('0x16')],'app':_0xd0be('0x3e'),'appdata':_0x4e0b9c[_0x479a6d]+'?'+_0x5d94ec[_0xd0be('0x1a')]+',${EXTEN},'+_0x18ceb3+':'+_0x5d94ec['context']+_0xd0be('0x3f')+_0x1b03b6,'exten':_0x5d94ec['exten'],'context':_0x5d94ec['context'],'priority':_0x4eee3e[_0xd0be('0x11')]+_0x479a6d,'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0]['VoiceExtensionId']});}_0x5d94ec[_0xd0be('0x11')]=_0x5e3028[_0xd0be('0x32')]?_['last'](_0x5e3028)[_0xd0be('0x11')]+0x1:_0x4eee3e[_0xd0be('0x11')];_0x4eee3e[_0xd0be('0x11')]=(_0x448222[_0xd0be('0x32')]?_[_0xd0be('0x40')](_0x448222)['priority']:_0x5d94ec[_0xd0be('0x11')])+0x1;_0x4eee3e['extensions']=_[_0xd0be('0x41')](_0x4eee3e[_0xd0be('0x14')],_0x5e3028,[_0x5d94ec],_0x448222);}_0x4eee3e[_0xd0be('0x14')][_0xd0be('0x15')]({'type':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x16')],'app':'Hangup','exten':_0xfa0797[_0x1ecb9c][0x0]['exten'],'context':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1a')],'priority':_0x4eee3e[_0xd0be('0x11')],'VoiceExtensionId':_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]});_0x2c8017[_0xd0be('0x15')](_0xfa0797[_0x1ecb9c][0x0][_0xd0be('0x1b')]);_0x3ae417=_['concat'](_0x3ae417,_0x4eee3e[_0xd0be('0x14')]);}}return _0x5d95b9[_0xd0be('0x42')](function(_0x105ee8){return _0x5d95b9[_0xd0be('0x2')][_0xd0be('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x2c8017}},'transaction':_0x105ee8})[_0xd0be('0x5')](function(_0x52f5fc){return _0x5d95b9[_0xd0be('0x2')][_0xd0be('0x7')][_0xd0be('0x43')](_[_0xd0be('0x44')](_0x3ae417,'priority'),{'transaction':_0x105ee8});});});})[_0xd0be('0x45')](function(_0x1f4aee){console['error'](_0x1f4aee);});}exports[_0xd0be('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index be79485..7c3da0b 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 _0xbaca=['updatedAt','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','\x20=\x20?','insert','cm_hopper_black','VoiceQueue','outbound','CmList','dialCheckDuplicateType','always','query','VoiceQueueId','catch','onlyIfOpen','sequelize','all','findAll','BlackLists','Lists','get','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','message','finally','contact:csv_','resume','resolve','emit','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','lodash','papaparse','ioredis','../../../mysqldb','../../../config/environment','api','localhost','redis','../../../api/cmContact/cmContact.socket','undefined','argv','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','length','errors','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','ListId','CompanyId','duplicate','Duplicate\x20Contact','then','push','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','ContactId'];(function(_0x1c8943,_0x3b52e9){var _0x1e3862=function(_0x5b6f2a){while(--_0x5b6f2a){_0x1c8943['push'](_0x1c8943['shift']());}};_0x1e3862(++_0x3b52e9);}(_0xbaca,0x15d));var _0xabac=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xbaca[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xabac('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xabac('0x1'));var Redis=require(_0xabac('0x2'));var db=require(_0xabac('0x3'))['db'];var config=require(_0xabac('0x4'));var logger=require('../../../config/logger')(_0xabac('0x5'));config['redis']=_['defaults'](config['redis'],{'host':_0xabac('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabac('0x7')]));require(_0xabac('0x8'))['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xabac('0x9')||process[_0xabac('0xa')][0x2]===_0xabac('0xb')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xabac('0xa')][0x2];if(!process[_0xabac('0xa')][0x3]||process[_0xabac('0xa')][0x3]===_0xabac('0x9')||process[_0xabac('0xa')][0x3]===_0xabac('0xb')||!process['argv'][0x4]||process['argv'][0x4]==='undefined'||process[_0xabac('0xa')][0x4]===_0xabac('0xb')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0xabac('0xc')](process[_0xabac('0xa')][0x3][_0xabac('0xd')](','),process['argv'][0x4][_0xabac('0xd')](','));if(!process['argv'][0x5]||process['argv'][0x5]===_0xabac('0x9')||process[_0xabac('0xa')][0x5]===_0xabac('0xb')){throw new Error(_0xabac('0xe'));}var LISTID=process[_0xabac('0xa')][0x5];var COMPANYID=process[_0xabac('0xa')][0x6]&&process[_0xabac('0xa')][0x6]!==_0xabac('0x9')&&process['argv'][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process[_0xabac('0xa')][0x7]&&process[_0xabac('0xa')][0x7]!=='undefined'&&process[_0xabac('0xa')][0x7]!=='null'?process[_0xabac('0xa')][0x7]:null;if(!process[_0xabac('0xa')][0x8]||process[_0xabac('0xa')][0x8]==='undefined'||process[_0xabac('0xa')][0x8]===_0xabac('0xb')){throw new Error(_0xabac('0xf'));}var SOCKET_TIMESTAMP=process[_0xabac('0xa')][0x8];}catch(_0x4bdcd1){logger[_0xabac('0x10')](_0x4bdcd1);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(_0x347248,_0x33016b,_0x3babec,_0x327692){var _0x5ecfa0={'message':_0x33016b};_0x5ecfa0[_0x347248]=!![];if(_0x3babec){_0x5ecfa0[_0xabac('0x11')]=_0x3babec;}if(_0x327692){_0x5ecfa0['index']=_0x327692;}return _0x5ecfa0;}function isEmail(_0x3399fe){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x3399fe);}function checkRow(_0x1c6580,_0x461917,_0x6f26f7){return new BPromise(function(_0x5581b6,_0xf2082b){if(_[_0xabac('0x12')](_0x1c6580)){return _0xf2082b(handleCheckRowError('error',_0xabac('0x13'),null,_0x6f26f7));}if(_0x1c6580['errors']&&_0x1c6580['errors'][_0xabac('0x14')]){var _0xb051eb=_['map'](_0x1c6580[_0xabac('0x15')],'message')['join'](';');return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xb051eb,null,_0x6f26f7));}var _0x2d6cfa={};for(var _0x32b1a3 in FIELDS){if(FIELDS[_0xabac('0x16')](_0x32b1a3)&&FIELDS[_0x32b1a3]){_0x2d6cfa[_0x32b1a3]=_0x1c6580[_0xabac('0x17')][0x0][FIELDS[_0x32b1a3]]||_0x1c6580['data'][0x0]['\ufeff'+FIELDS[_0x32b1a3]];}}if(!_0x2d6cfa[_0xabac('0x18')]){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x19'),null,_0x6f26f7));}if(!_0x2d6cfa[_0xabac('0x1a')]){return _0xf2082b(handleCheckRowError('error',_0xabac('0x1b'),null,_0x6f26f7));}if(_0x2d6cfa['birthDate']){var _0x286baa=moment(_0x2d6cfa[_0xabac('0x1c')],_0xabac('0x1d'));if(!_0x286baa['isValid']()){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x1e'),null,_0x6f26f7));}}if(_0x2d6cfa['email']){if(!isEmail(_0x2d6cfa[_0xabac('0x1f')])){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),'email\x20format\x20is\x20not\x20valid!',null,_0x6f26f7));}}_0x2d6cfa[_0xabac('0x20')]=LISTID;_0x2d6cfa[_0xabac('0x21')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xabac('0x14')]&&_0x461917){var _0x4cc1b1={};for(var _0xd490cc=0x0,_0x1f8b10=DUPLICATES[_0xabac('0x14')];_0xd490cc<_0x1f8b10;_0xd490cc+=0x1){_0x4cc1b1[DUPLICATES[_0xd490cc]]=_0x2d6cfa[DUPLICATES[_0xd490cc]];}var _0x4e35dd=_['find'](_0x461917,_0x4cc1b1);if(_0x4e35dd){return _0xf2082b(handleCheckRowError(_0xabac('0x22'),_0xabac('0x23'),_0x4e35dd,_0x6f26f7));}}return db['CmContact']['create'](_0x2d6cfa,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2d6cfa)})[_0xabac('0x24')](function(_0x9da1f){if(DUPLICATES&&DUPLICATES[_0xabac('0x14')]&&_0x461917){_0x461917[_0xabac('0x25')](_['pick'](_0x2d6cfa,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9da1f['id'];return _0x5581b6();})['catch'](function(_0x5a0267){return _0xf2082b(handleCheckRowError(_0xabac('0x10'),_0xabac('0x26')+(_0x5a0267['message']||JSON[_0xabac('0x27')](_0x5a0267)),null,_0x6f26f7));});});}function checkHopper(){function _0x224d09(){return function(_0x2db1a9){logger[_0xabac('0x10')](_0xabac('0x28'),_0xabac('0x29'),util['inspect'](_0x2db1a9,{'showHidden':![],'depth':null}));};}var _0xe7c73e=function(_0x352201,_0x130210){var _0x11d3a8=squel['insert']()[_0xabac('0x2a')](_0xabac('0x2b'))[_0xabac('0x2c')]([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),_0xabac('0x20'),_0x130210,'createdAt',_0xabac('0x2f')],squel['select']()[_0xabac('0x30')](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2d'))[_0xabac('0x30')]('id',_0xabac('0x2e'))['field'](LISTID[_0xabac('0x32')](),'ListId')['field'](_0x352201['id'][_0xabac('0x32')](),_0x130210)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))['field'](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')](_0xabac('0x38'),LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x39'))[_0xabac('0x36')]('phone\x20NOT\x20IN\x20(?)',squel[_0xabac('0x3a')]()['field'](_0xabac('0x1a'))[_0xabac('0x34')](_0xabac('0x2b'))[_0xabac('0x36')](_0x130210+'\x20=\x20?',_0x352201['id']['toString']())))[_0xabac('0x32')]();return _0x11d3a8;};var _0x20c657=function(_0x5ed830,_0xa49722){var _0xc88ab8=squel['insert']()[_0xabac('0x2a')](_0xabac('0x2b'))['fromQuery']([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),_0xabac('0x20'),_0xa49722,_0xabac('0x33'),_0xabac('0x2f')],squel[_0xabac('0x3a')]()[_0xabac('0x30')]('phone',_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2d'))[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID[_0xabac('0x32')](),_0xabac('0x20'))['field'](_0x5ed830['id'][_0xabac('0x32')](),_0xa49722)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))['field'](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')]('ListId\x20=\x20?',LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x3b'),squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')](_0xabac('0x39'))[_0xabac('0x36')](_0xabac('0x3d'),squel['select']()['field'](_0xabac('0x3e'))[_0xabac('0x34')]('cm_hopper_final')[_0xabac('0x36')](_0xa49722+_0xabac('0x3f'),_0x5ed830['id'][_0xabac('0x32')]()))['where'](_0xabac('0x3d'),squel['select']()[_0xabac('0x30')](_0xabac('0x1a'))['from']('cm_hopper')[_0xabac('0x36')](_0xa49722+'\x20=\x20?',_0x5ed830['id']['toString']())))[_0xabac('0x32')]();return _0xc88ab8;};function _0x32a598(_0x779ec9,_0x19fdd4){var _0x5c1afd=squel[_0xabac('0x40')]()[_0xabac('0x2a')](_0xabac('0x2b'))[_0xabac('0x2c')]([_0xabac('0x1a'),_0xabac('0x2d'),_0xabac('0x2e'),'ListId',_0x19fdd4,_0xabac('0x33'),_0xabac('0x2f')],squel['select']()['field'](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')](_0xabac('0x31'),'scheduledAt')[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID['toString'](),_0xabac('0x20'))['field'](_0x779ec9['id'][_0xabac('0x32')](),_0x19fdd4)[_0xabac('0x30')]('NOW()',_0xabac('0x33'))[_0xabac('0x30')](_0xabac('0x31'),'updatedAt')['from'](_0xabac('0x35'))[_0xabac('0x36')](_0xabac('0x37'))[_0xabac('0x36')](_0xabac('0x38'),LISTID['toString']())[_0xabac('0x36')]('id\x20IN\x20?',squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')](_0xabac('0x39')))[_0xabac('0x32')]();return _0x5c1afd;}function _0x1030cb(_0x28fa6e,_0xa63259){var _0x3a6ef7=squel[_0xabac('0x40')]()[_0xabac('0x2a')](_0xabac('0x41'))[_0xabac('0x2c')]([_0xabac('0x1a'),'ContactId',_0xabac('0x20'),_0xa63259,_0xabac('0x33'),'updatedAt'],squel[_0xabac('0x3a')]()[_0xabac('0x30')](_0xabac('0x1a'),_0xabac('0x1a'))[_0xabac('0x30')]('id',_0xabac('0x2e'))[_0xabac('0x30')](LISTID['toString'](),'ListId')[_0xabac('0x30')](_0x28fa6e['id'][_0xabac('0x32')](),_0xa63259)[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x33'))[_0xabac('0x30')](_0xabac('0x31'),_0xabac('0x2f'))[_0xabac('0x34')](_0xabac('0x35'))[_0xabac('0x36')]('deletedAt\x20IS\x20NULL')[_0xabac('0x36')](_0xabac('0x38'),LISTID[_0xabac('0x32')]())[_0xabac('0x36')](_0xabac('0x3b'),squel[_0xabac('0x3c')](hopperContacts))[_0xabac('0x36')]('phone\x20IS\x20NOT\x20NULL'))[_0xabac('0x32')]();return _0x3a6ef7;}return db[_0xabac('0x42')]['findAll']({'where':{'type':_0xabac('0x43')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabac('0x44')],'as':'Lists','where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x235c78){var _0x2e532a=[];if(_0x235c78){var _0xf7d810;for(var _0x5875ac=0x0,_0x277459;_0x5875ac<_0x235c78[_0xabac('0x14')];_0x5875ac+=0x1){_0x277459=_0x235c78[_0x5875ac]['get']({'plain':!![]});switch(_0x277459[_0xabac('0x45')]){case _0xabac('0x46'):_0x2e532a[_0xabac('0x25')](db['sequelize'][_0xabac('0x47')](_0x20c657(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));break;case _0xabac('0x4a'):_0x2e532a[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0xe7c73e(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})['catch'](_0x224d09()));break;default:_0x2e532a[_0xabac('0x25')](db[_0xabac('0x4b')][_0xabac('0x47')](_0x32a598(_0x277459,_0xabac('0x48')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));}}}return _0x2e532a;})[_0xabac('0x4c')]()['then'](function(){return db[_0xabac('0x42')][_0xabac('0x4d')]({'where':{'type':_0xabac('0x43')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xabac('0x4e'),'where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x14a12b){var _0x309b4c=[];if(_0x14a12b){var _0x121b3e;for(var _0x1fe8f2=0x0,_0x10f91a;_0x1fe8f2<_0x14a12b[_0xabac('0x14')];_0x1fe8f2+=0x1){_0x10f91a=_0x14a12b[_0x1fe8f2]['get']({'plain':!![]});_0x309b4c['push'](db[_0xabac('0x4b')][_0xabac('0x47')](_0x1030cb(_0x10f91a,_0xabac('0x48')))[_0xabac('0x24')](function(){})['catch'](_0x224d09()));}}return _0x309b4c;})[_0xabac('0x4c')]();})['then'](function(){return db['Campaign']['findAll']({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xabac('0x44')],'as':_0xabac('0x4f'),'where':{'id':LISTID}}]})[_0xabac('0x24')](function(_0x283790){var _0x371d79=[];if(_0x283790){for(var _0x431799=0x0,_0x5ea8ae;_0x431799<_0x283790['length'];_0x431799+=0x1){_0x5ea8ae=_0x283790[_0x431799][_0xabac('0x50')]({'plain':!![]});switch(_0x5ea8ae[_0xabac('0x45')]){case _0xabac('0x46'):_0x371d79[_0xabac('0x25')](db['sequelize'][_0xabac('0x47')](_0x20c657(_0x5ea8ae,_0xabac('0x51')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));break;case _0xabac('0x4a'):_0x371d79[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0xe7c73e(_0x5ea8ae,'CampaignId'))['then'](function(){})['catch'](_0x224d09()));break;default:_0x371d79[_0xabac('0x25')](db['sequelize']['query'](_0x32a598(_0x5ea8ae,_0xabac('0x51')))[_0xabac('0x24')](function(){})[_0xabac('0x49')](_0x224d09()));}}}return _0x371d79;})[_0xabac('0x4c')]();})[_0xabac('0x24')](function(){return db['Campaign'][_0xabac('0x4d')]({'attributes':['id'],'include':[{'model':db[_0xabac('0x44')],'as':_0xabac('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x1996ab){var _0x59d311=[];if(_0x1996ab){for(var _0x34527b=0x0,_0x99ee6a;_0x34527b<_0x1996ab[_0xabac('0x14')];_0x34527b+=0x1){_0x99ee6a=_0x1996ab[_0x34527b]['get']({'plain':!![]});_0x59d311[_0xabac('0x25')](db[_0xabac('0x4b')]['query'](_0x1030cb(_0x99ee6a,_0xabac('0x51')))['then'](function(){})[_0xabac('0x49')](_0x224d09()));}}return _0x59d311;})[_0xabac('0x4c')]();})['catch'](function(_0xe1f569){logger[_0xabac('0x10')](_0xabac('0x52'),_0xabac('0x53'),_0xe1f569[_0xabac('0x54')]);});}var processPromises=function(_0x19413b){return BPromise['all'](promises)[_0xabac('0x24')](function(_0x35cf97){})['catch'](function(_0x1e5a42){logger[_0xabac('0x10')]('Error\x20processing\x20rows\x20block:',JSON[_0xabac('0x27')](_0x1e5a42));})[_0xabac('0x55')](function(){socket['emit'](_0xabac('0x56')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x19413b){return _0x19413b[_0xabac('0x57')]();}});};var endCsv=function(){return BPromise[_0xabac('0x58')]()[_0xabac('0x24')](function(){if(hopperContacts){return checkHopper();}})[_0xabac('0x24')](function(){socket[_0xabac('0x59')](_0xabac('0x56')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xabac('0x5a')](FILEPATH);}catch(_0x5ec270){logger[_0xabac('0x10')](_0xabac('0x5b'),JSON[_0xabac('0x27')](_0x5ec270));}finally{process['exit'](0x0);}});};process['on'](_0xabac('0x5c'),function(){logger[_0xabac('0x5d')](_0xabac('0x5e'));endCsv();});function main(){return BPromise[_0xabac('0x58')]()[_0xabac('0x24')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xabac('0xd')](',');return db[_0xabac('0x5f')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x98e4ac){var _0x2cbd46=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2cbd46,{'header':!![],'skipEmptyLines':!![],'step':function(_0xb02eca,_0x432956){total+=0x1;var _0x16fa57=total;promises[_0xabac('0x25')](checkRow(_0xb02eca,_0x98e4ac,_0x16fa57)[_0xabac('0x24')](function(){success+=0x1;})[_0xabac('0x49')](function(_0x31b29a){if(_0x31b29a['error']){errors+=0x1;delete _0x31b29a['error'];}else if(_0x31b29a['duplicate']){duplicates+=0x1;delete _0x31b29a[_0xabac('0x22')];}rows[_0xabac('0x25')](_0x31b29a);}));if(total%0xc8===0x0){_0x432956[_0xabac('0x60')]();return processPromises(_0x432956);}},'complete':function(){return processPromises()[_0xabac('0x24')](function(){logger[_0xabac('0x5d')](_0xabac('0x61'));endCsv();});},'error':function(_0x59d23f,_0x27ab1b){logger[_0xabac('0x5d')](_0xabac('0x62'),JSON[_0xabac('0x27')](_0x59d23f));endCsv();}});})[_0xabac('0x49')](function(_0x8301b3){logger[_0xabac('0x10')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xabac('0x27')](_0x8301b3));});}main(); \ No newline at end of file +var _0xc2f2=['Campaign','CmList','Lists','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','emit','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','Duplicate\x20Contact','CmContact','create','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','insert','into','cm_hopper','fromQuery','scheduledAt','createdAt','updatedAt','field','ContactId','toString','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','id\x20IN\x20?','calleridnum','cm_hopper_final','\x20=\x20?','str','cm_hopper_black','findAll','dialCheckDuplicateType','length','get','always','query','onlyIfOpen','sequelize','VoiceQueueId','all','VoiceQueue','outbound','BlackLists'];(function(_0x558e53,_0x56ffc4){var _0x1fd3a2=function(_0x5c2d13){while(--_0x5c2d13){_0x558e53['push'](_0x558e53['shift']());}};_0x1fd3a2(++_0x56ffc4);}(_0xc2f2,0x169));var _0x2c2f=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0xc2f2[_0x5af97c];return _0x3472ae;};'use strict';var BPromise=require(_0x2c2f('0x0'));var util=require('util');var _=require(_0x2c2f('0x1'));var fs=require('fs');var squel=require(_0x2c2f('0x2'));var Papa=require(_0x2c2f('0x3'));var Redis=require(_0x2c2f('0x4'));var db=require(_0x2c2f('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x2c2f('0x6'))(_0x2c2f('0x7'));config[_0x2c2f('0x8')]=_[_0x2c2f('0x9')](config[_0x2c2f('0x8')],{'host':_0x2c2f('0xa'),'port':0x18eb});var socket=require(_0x2c2f('0xb'))(new Redis(config[_0x2c2f('0x8')]));require(_0x2c2f('0xc'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x2c2f('0xd')][0x2]===_0x2c2f('0xe')||process[_0x2c2f('0xd')][0x2]===_0x2c2f('0xf')){throw new Error(_0x2c2f('0x10'));}var FILEPATH=process[_0x2c2f('0xd')][0x2];if(!process[_0x2c2f('0xd')][0x3]||process[_0x2c2f('0xd')][0x3]===_0x2c2f('0xe')||process[_0x2c2f('0xd')][0x3]===_0x2c2f('0xf')||!process[_0x2c2f('0xd')][0x4]||process[_0x2c2f('0xd')][0x4]==='undefined'||process[_0x2c2f('0xd')][0x4]===_0x2c2f('0xf')){throw new Error(_0x2c2f('0x11'));}var FIELDS=_[_0x2c2f('0x12')](process[_0x2c2f('0xd')][0x3][_0x2c2f('0x13')](','),process[_0x2c2f('0xd')][0x4][_0x2c2f('0x13')](','));if(!process['argv'][0x5]||process[_0x2c2f('0xd')][0x5]==='undefined'||process[_0x2c2f('0xd')][0x5]===_0x2c2f('0xf')){throw new Error(_0x2c2f('0x14'));}var LISTID=process[_0x2c2f('0xd')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x2c2f('0xd')][0x6]!=='undefined'&&process[_0x2c2f('0xd')][0x6]!==_0x2c2f('0xf')?process[_0x2c2f('0xd')][0x6]:null;var DUPLICATES=process[_0x2c2f('0xd')][0x7]&&process['argv'][0x7]!==_0x2c2f('0xe')&&process['argv'][0x7]!=='null'?process[_0x2c2f('0xd')][0x7]:null;if(!process[_0x2c2f('0xd')][0x8]||process[_0x2c2f('0xd')][0x8]===_0x2c2f('0xe')||process[_0x2c2f('0xd')][0x8]===_0x2c2f('0xf')){throw new Error(_0x2c2f('0x15'));}var SOCKET_TIMESTAMP=process[_0x2c2f('0xd')][0x8];}catch(_0xdf0efa){logger[_0x2c2f('0x16')](_0xdf0efa);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(_0x128abe,_0x1afcba,_0x1984a4,_0x109517){var _0xbbcd79={'message':_0x1afcba};_0xbbcd79[_0x128abe]=!![];if(_0x1984a4){_0xbbcd79[_0x2c2f('0x17')]=_0x1984a4;}if(_0x109517){_0xbbcd79['index']=_0x109517;}return _0xbbcd79;}function isEmail(_0x5cfe89){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))*$/[_0x2c2f('0x18')](_0x5cfe89);}function checkRow(_0x27863f,_0x103e4f,_0x512434){return new BPromise(function(_0x17f75a,_0x10aee3){if(_[_0x2c2f('0x19')](_0x27863f)){return _0x10aee3(handleCheckRowError('error',_0x2c2f('0x1a'),null,_0x512434));}if(_0x27863f[_0x2c2f('0x1b')]&&_0x27863f[_0x2c2f('0x1b')]['length']){var _0x53259d=_[_0x2c2f('0x1c')](_0x27863f['errors'],_0x2c2f('0x1d'))[_0x2c2f('0x1e')](';');return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x53259d,null,_0x512434));}var _0x8c772f={};for(var _0x442d84 in FIELDS){if(FIELDS['hasOwnProperty'](_0x442d84)&&FIELDS[_0x442d84]){_0x8c772f[_0x442d84]=_0x27863f['data'][0x0][FIELDS[_0x442d84]]||_0x27863f[_0x2c2f('0x1f')][0x0]['\ufeff'+FIELDS[_0x442d84]];}}if(!_0x8c772f['firstName']){return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x2c2f('0x20'),null,_0x512434));}if(!_0x8c772f[_0x2c2f('0x21')]){return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x2c2f('0x22'),null,_0x512434));}if(_0x8c772f['birthDate']){var _0x3c447b=moment(_0x8c772f[_0x2c2f('0x23')],_0x2c2f('0x24'));if(!_0x3c447b['isValid']()){return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x2c2f('0x25'),null,_0x512434));}}if(_0x8c772f[_0x2c2f('0x26')]){if(!isEmail(_0x8c772f[_0x2c2f('0x26')])){return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x2c2f('0x27'),null,_0x512434));}}_0x8c772f[_0x2c2f('0x28')]=LISTID;_0x8c772f[_0x2c2f('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x103e4f){var _0x299249={};for(var _0x38043d=0x0,_0x56d297=DUPLICATES['length'];_0x38043d<_0x56d297;_0x38043d+=0x1){_0x299249[DUPLICATES[_0x38043d]]=_0x8c772f[DUPLICATES[_0x38043d]];}var _0x7ff074=_[_0x2c2f('0x2a')](_0x103e4f,_0x299249);if(_0x7ff074){return _0x10aee3(handleCheckRowError(_0x2c2f('0x2b'),_0x2c2f('0x2c'),_0x7ff074,_0x512434));}}return db[_0x2c2f('0x2d')][_0x2c2f('0x2e')](_0x8c772f,{'raw':!![],'hooks':![],'fields':_['keys'](_0x8c772f)})[_0x2c2f('0x2f')](function(_0x5c7a33){if(DUPLICATES&&DUPLICATES['length']&&_0x103e4f){_0x103e4f[_0x2c2f('0x30')](_[_0x2c2f('0x31')](_0x8c772f,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5c7a33['id'];return _0x17f75a();})[_0x2c2f('0x32')](function(_0x2b6de1){return _0x10aee3(handleCheckRowError(_0x2c2f('0x16'),_0x2c2f('0x33')+(_0x2b6de1[_0x2c2f('0x1d')]||JSON['stringify'](_0x2b6de1)),null,_0x512434));});});}function checkHopper(){function _0x2fe209(){return function(_0x46ffb4){logger['error'](_0x2c2f('0x34'),'checkHopper',util['inspect'](_0x46ffb4,{'showHidden':![],'depth':null}));};}var _0x1bfdd2=function(_0x522d94,_0x5da945){var _0x5aa76b=squel[_0x2c2f('0x35')]()[_0x2c2f('0x36')](_0x2c2f('0x37'))[_0x2c2f('0x38')](['phone',_0x2c2f('0x39'),'ContactId',_0x2c2f('0x28'),_0x5da945,_0x2c2f('0x3a'),_0x2c2f('0x3b')],squel['select']()[_0x2c2f('0x3c')](_0x2c2f('0x21'),_0x2c2f('0x21'))['field']('NOW()',_0x2c2f('0x39'))[_0x2c2f('0x3c')]('id',_0x2c2f('0x3d'))[_0x2c2f('0x3c')](LISTID[_0x2c2f('0x3e')](),'ListId')[_0x2c2f('0x3c')](_0x522d94['id'][_0x2c2f('0x3e')](),_0x5da945)['field']('NOW()',_0x2c2f('0x3a'))[_0x2c2f('0x3c')](_0x2c2f('0x3f'),_0x2c2f('0x3b'))[_0x2c2f('0x40')](_0x2c2f('0x41'))[_0x2c2f('0x42')](_0x2c2f('0x43'))['where'](_0x2c2f('0x44'),LISTID[_0x2c2f('0x3e')]())[_0x2c2f('0x42')](_0x2c2f('0x45'))[_0x2c2f('0x42')](_0x2c2f('0x46'),squel[_0x2c2f('0x47')]()[_0x2c2f('0x3c')](_0x2c2f('0x21'))['from'](_0x2c2f('0x37'))['where'](_0x5da945+'\x20=\x20?',_0x522d94['id'][_0x2c2f('0x3e')]())))['toString']();return _0x5aa76b;};var _0x42be21=function(_0x3f360e,_0xf7ee88){var _0x3d6220=squel[_0x2c2f('0x35')]()[_0x2c2f('0x36')]('cm_hopper')['fromQuery']([_0x2c2f('0x21'),_0x2c2f('0x39'),_0x2c2f('0x3d'),_0x2c2f('0x28'),_0xf7ee88,_0x2c2f('0x3a'),_0x2c2f('0x3b')],squel[_0x2c2f('0x47')]()[_0x2c2f('0x3c')](_0x2c2f('0x21'),_0x2c2f('0x21'))['field'](_0x2c2f('0x3f'),_0x2c2f('0x39'))['field']('id','ContactId')['field'](LISTID[_0x2c2f('0x3e')](),_0x2c2f('0x28'))[_0x2c2f('0x3c')](_0x3f360e['id']['toString'](),_0xf7ee88)[_0x2c2f('0x3c')]('NOW()','createdAt')[_0x2c2f('0x3c')]('NOW()',_0x2c2f('0x3b'))[_0x2c2f('0x40')](_0x2c2f('0x41'))['where'](_0x2c2f('0x43'))['where']('ListId\x20=\x20?',LISTID[_0x2c2f('0x3e')]())[_0x2c2f('0x42')](_0x2c2f('0x48'),squel['str'](hopperContacts))[_0x2c2f('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x2c2f('0x42')](_0x2c2f('0x46'),squel['select']()[_0x2c2f('0x3c')](_0x2c2f('0x49'))[_0x2c2f('0x40')](_0x2c2f('0x4a'))[_0x2c2f('0x42')](_0xf7ee88+_0x2c2f('0x4b'),_0x3f360e['id']['toString']()))['where'](_0x2c2f('0x46'),squel[_0x2c2f('0x47')]()['field'](_0x2c2f('0x21'))[_0x2c2f('0x40')]('cm_hopper')[_0x2c2f('0x42')](_0xf7ee88+_0x2c2f('0x4b'),_0x3f360e['id']['toString']())))[_0x2c2f('0x3e')]();return _0x3d6220;};function _0x510563(_0xeaefc7,_0x2da4b0){var _0x282b05=squel['insert']()[_0x2c2f('0x36')](_0x2c2f('0x37'))[_0x2c2f('0x38')]([_0x2c2f('0x21'),'scheduledAt','ContactId',_0x2c2f('0x28'),_0x2da4b0,'createdAt',_0x2c2f('0x3b')],squel[_0x2c2f('0x47')]()[_0x2c2f('0x3c')](_0x2c2f('0x21'),'phone')[_0x2c2f('0x3c')](_0x2c2f('0x3f'),'scheduledAt')[_0x2c2f('0x3c')]('id',_0x2c2f('0x3d'))[_0x2c2f('0x3c')](LISTID[_0x2c2f('0x3e')](),_0x2c2f('0x28'))[_0x2c2f('0x3c')](_0xeaefc7['id']['toString'](),_0x2da4b0)['field'](_0x2c2f('0x3f'),'createdAt')[_0x2c2f('0x3c')](_0x2c2f('0x3f'),'updatedAt')[_0x2c2f('0x40')](_0x2c2f('0x41'))[_0x2c2f('0x42')]('deletedAt\x20IS\x20NULL')[_0x2c2f('0x42')]('ListId\x20=\x20?',LISTID[_0x2c2f('0x3e')]())[_0x2c2f('0x42')]('id\x20IN\x20?',squel[_0x2c2f('0x4c')](hopperContacts))[_0x2c2f('0x42')](_0x2c2f('0x45')))['toString']();return _0x282b05;}function _0x4de468(_0x1ed398,_0xbd7bd9){var _0x400430=squel['insert']()[_0x2c2f('0x36')](_0x2c2f('0x4d'))['fromQuery']([_0x2c2f('0x21'),_0x2c2f('0x3d'),_0x2c2f('0x28'),_0xbd7bd9,'createdAt',_0x2c2f('0x3b')],squel['select']()['field'](_0x2c2f('0x21'),_0x2c2f('0x21'))[_0x2c2f('0x3c')]('id',_0x2c2f('0x3d'))[_0x2c2f('0x3c')](LISTID[_0x2c2f('0x3e')](),_0x2c2f('0x28'))[_0x2c2f('0x3c')](_0x1ed398['id'][_0x2c2f('0x3e')](),_0xbd7bd9)['field'](_0x2c2f('0x3f'),_0x2c2f('0x3a'))[_0x2c2f('0x3c')](_0x2c2f('0x3f'),_0x2c2f('0x3b'))[_0x2c2f('0x40')]('cm_contacts')[_0x2c2f('0x42')](_0x2c2f('0x43'))['where'](_0x2c2f('0x44'),LISTID[_0x2c2f('0x3e')]())[_0x2c2f('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x2c2f('0x42')](_0x2c2f('0x45')))[_0x2c2f('0x3e')]();return _0x400430;}return db['VoiceQueue'][_0x2c2f('0x4e')]({'where':{'type':'outbound'},'attributes':['id',_0x2c2f('0x4f')],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x2c2f('0x2f')](function(_0x503744){var _0x559977=[];if(_0x503744){var _0x48bb32;for(var _0x2b78f5=0x0,_0x195313;_0x2b78f5<_0x503744[_0x2c2f('0x50')];_0x2b78f5+=0x1){_0x195313=_0x503744[_0x2b78f5][_0x2c2f('0x51')]({'plain':!![]});switch(_0x195313[_0x2c2f('0x4f')]){case _0x2c2f('0x52'):_0x559977['push'](db['sequelize'][_0x2c2f('0x53')](_0x42be21(_0x195313,'VoiceQueueId'))[_0x2c2f('0x2f')](function(){})[_0x2c2f('0x32')](_0x2fe209()));break;case _0x2c2f('0x54'):_0x559977[_0x2c2f('0x30')](db[_0x2c2f('0x55')][_0x2c2f('0x53')](_0x1bfdd2(_0x195313,_0x2c2f('0x56')))[_0x2c2f('0x2f')](function(){})['catch'](_0x2fe209()));break;default:_0x559977['push'](db['sequelize'][_0x2c2f('0x53')](_0x510563(_0x195313,'VoiceQueueId'))[_0x2c2f('0x2f')](function(){})[_0x2c2f('0x32')](_0x2fe209()));}}}return _0x559977;})[_0x2c2f('0x57')]()[_0x2c2f('0x2f')](function(){return db[_0x2c2f('0x58')][_0x2c2f('0x4e')]({'where':{'type':_0x2c2f('0x59')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x2c2f('0x5a'),'where':{'id':LISTID}}]})['then'](function(_0x5db28b){var _0x40a200=[];if(_0x5db28b){var _0x478a2f;for(var _0x43fc07=0x0,_0x50778b;_0x43fc07<_0x5db28b[_0x2c2f('0x50')];_0x43fc07+=0x1){_0x50778b=_0x5db28b[_0x43fc07][_0x2c2f('0x51')]({'plain':!![]});_0x40a200[_0x2c2f('0x30')](db[_0x2c2f('0x55')][_0x2c2f('0x53')](_0x4de468(_0x50778b,_0x2c2f('0x56')))[_0x2c2f('0x2f')](function(){})['catch'](_0x2fe209()));}}return _0x40a200;})[_0x2c2f('0x57')]();})[_0x2c2f('0x2f')](function(){return db[_0x2c2f('0x5b')][_0x2c2f('0x4e')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x2c2f('0x5c')],'as':_0x2c2f('0x5d'),'where':{'id':LISTID}}]})[_0x2c2f('0x2f')](function(_0x189667){var _0x1f40a7=[];if(_0x189667){for(var _0x504d02=0x0,_0x587108;_0x504d02<_0x189667[_0x2c2f('0x50')];_0x504d02+=0x1){_0x587108=_0x189667[_0x504d02][_0x2c2f('0x51')]({'plain':!![]});switch(_0x587108[_0x2c2f('0x4f')]){case _0x2c2f('0x52'):_0x1f40a7[_0x2c2f('0x30')](db[_0x2c2f('0x55')]['query'](_0x42be21(_0x587108,'CampaignId'))['then'](function(){})[_0x2c2f('0x32')](_0x2fe209()));break;case'onlyIfOpen':_0x1f40a7[_0x2c2f('0x30')](db[_0x2c2f('0x55')][_0x2c2f('0x53')](_0x1bfdd2(_0x587108,_0x2c2f('0x5e')))['then'](function(){})[_0x2c2f('0x32')](_0x2fe209()));break;default:_0x1f40a7[_0x2c2f('0x30')](db['sequelize'][_0x2c2f('0x53')](_0x510563(_0x587108,_0x2c2f('0x5e')))['then'](function(){})[_0x2c2f('0x32')](_0x2fe209()));}}}return _0x1f40a7;})[_0x2c2f('0x57')]();})[_0x2c2f('0x2f')](function(){return db['Campaign'][_0x2c2f('0x4e')]({'attributes':['id'],'include':[{'model':db[_0x2c2f('0x5c')],'as':'BlackLists','where':{'id':LISTID}}]})[_0x2c2f('0x2f')](function(_0x4f3139){var _0x4fb7eb=[];if(_0x4f3139){for(var _0x3a36f4=0x0,_0x17a776;_0x3a36f4<_0x4f3139[_0x2c2f('0x50')];_0x3a36f4+=0x1){_0x17a776=_0x4f3139[_0x3a36f4]['get']({'plain':!![]});_0x4fb7eb[_0x2c2f('0x30')](db[_0x2c2f('0x55')][_0x2c2f('0x53')](_0x4de468(_0x17a776,'CampaignId'))['then'](function(){})[_0x2c2f('0x32')](_0x2fe209()));}}return _0x4fb7eb;})[_0x2c2f('0x57')]();})[_0x2c2f('0x32')](function(_0x54e826){logger[_0x2c2f('0x16')](_0x2c2f('0x5f'),_0x2c2f('0x60'),_0x54e826[_0x2c2f('0x1d')]);});}var processPromises=function(_0x4f9466){return BPromise[_0x2c2f('0x57')](promises)['then'](function(_0x51fa88){})['catch'](function(_0x7cfe2){logger[_0x2c2f('0x16')](_0x2c2f('0x61'),JSON[_0x2c2f('0x62')](_0x7cfe2));})[_0x2c2f('0x63')](function(){socket[_0x2c2f('0x64')](_0x2c2f('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4f9466){return _0x4f9466['resume']();}});};var endCsv=function(){return BPromise[_0x2c2f('0x66')]()[_0x2c2f('0x2f')](function(){if(hopperContacts){return checkHopper();}})[_0x2c2f('0x2f')](function(){socket[_0x2c2f('0x64')](_0x2c2f('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x2c2f('0x67')](FILEPATH);}catch(_0x1b400f){logger[_0x2c2f('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x2c2f('0x62')](_0x1b400f));}finally{process[_0x2c2f('0x68')](0x0);}});};process['on'](_0x2c2f('0x69'),function(){logger[_0x2c2f('0x6a')](_0x2c2f('0x6b'));endCsv();});function main(){return BPromise[_0x2c2f('0x66')]()[_0x2c2f('0x2f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x2c2f('0x13')](',');return db['CmContact'][_0x2c2f('0x4e')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x2c2f('0x2f')](function(_0x35312a){var _0x2fb8cf=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x2c2f('0x6c')](_0x2fb8cf,{'header':!![],'skipEmptyLines':!![],'step':function(_0xed8f42,_0x1f7338){total+=0x1;var _0x4dcf59=total;promises[_0x2c2f('0x30')](checkRow(_0xed8f42,_0x35312a,_0x4dcf59)['then'](function(){success+=0x1;})[_0x2c2f('0x32')](function(_0x43f9f0){if(_0x43f9f0['error']){errors+=0x1;delete _0x43f9f0[_0x2c2f('0x16')];}else if(_0x43f9f0[_0x2c2f('0x2b')]){duplicates+=0x1;delete _0x43f9f0['duplicate'];}rows[_0x2c2f('0x30')](_0x43f9f0);}));if(total%0xc8===0x0){_0x1f7338[_0x2c2f('0x6d')]();return processPromises(_0x1f7338);}},'complete':function(){return processPromises()[_0x2c2f('0x2f')](function(){logger['info'](_0x2c2f('0x6e'));endCsv();});},'error':function(_0x4da1f9,_0x346e61){logger['info'](_0x2c2f('0x6f'),JSON[_0x2c2f('0x62')](_0x4da1f9));endCsv();}});})[_0x2c2f('0x32')](function(_0xe6d644){logger[_0x2c2f('0x16')](_0x2c2f('0x70'),JSON[_0x2c2f('0x62')](_0xe6d644));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 184a1ff..517a59b 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 _0x5b97=['then','split','isNil','CmContactHasItem','updated','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','createdAt','priority','UserId','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_hopper_black','ListId','updatedAt','from','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','scheduledAt','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','main','send','start','root','server/files/tmp','.csv','includes','header','findAll','name','createReadStream','data','rows','find','_description','hasOwnProperty','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','trim','description','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','each','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','affectedRows','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','select','phone','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','CmContact','AdditionalPhones','length','push','all'];(function(_0x5f0a51,_0x20c147){var _0x3d6ecc=function(_0x1ba66c){while(--_0x1ba66c){_0x5f0a51['push'](_0x5f0a51['shift']());}};_0x3d6ecc(++_0x20c147);}(_0x5b97,0x155));var _0x75b9=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x5b97[_0x386525];return _0x14d015;};'use strict';var fs=require('fs');var path=require(_0x75b9('0x0'));var _=require(_0x75b9('0x1'));var Papa=require(_0x75b9('0x2'));var util=require(_0x75b9('0x3'));var BPromise=require(_0x75b9('0x4'));var moment=require(_0x75b9('0x5'));var squel=require(_0x75b9('0x6'));var Redis=require(_0x75b9('0x7'));var db=require('../../../mysqldb')['db'];var config=require(_0x75b9('0x8'));var shared=require(_0x75b9('0x9'));var logger=require(_0x75b9('0xa'))(_0x75b9('0xb'));config[_0x75b9('0xc')]=_[_0x75b9('0xd')](config['redis'],{'host':_0x75b9('0xe'),'port':0x18eb});var socket=require(_0x75b9('0xf'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0x75b9('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x75b9('0x11')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x41e5b2){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))*$/[_0x75b9('0x12')](_0x41e5b2);}function selectNotIn(_0x158b83,_0x59f21e,_0x11dcbd,_0x3c03fe,_0x5ed2d0){return squel[_0x75b9('0x13')]()['field'](_0x75b9('0x14'))['from'](_0x3c03fe)[_0x75b9('0x15')](_0x59f21e,null,_0x59f21e+_0x75b9('0x16')+_0x3c03fe+'.'+_0x11dcbd)['where'](_0x3c03fe+'.'+_0x11dcbd+_0x75b9('0x17')+_0x158b83+'.'+_0x11dcbd)[_0x75b9('0x18')](_0x59f21e+_0x75b9('0x19')+_0x5ed2d0[_0x75b9('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x5f484b,_0x242bcb){promisesAdditionalPhones=[];return db[_0x75b9('0x1a')]['findAll']({'raw':!![],'attributes':['id',_0x75b9('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0xb668e7){if(_0xb668e7!==null){var _0x4ad606=[];for(var _0x210913=0x0;_0x210913<_0xb668e7[_0x75b9('0x1c')];_0x210913++){var _0x2e163a=_0xb668e7[_0x210913];_0x4ad606[_0x75b9('0x1d')](insertAdditionalPhones(_0x2e163a));}}Promise[_0x75b9('0x1e')](_0x4ad606)[_0x75b9('0x1f')](function(){_0x5f484b({'val':0x1});});});});}function insertAdditionalPhones(_0x5e20b0){return new Promise(function(_0x4226d0,_0x201530){var _0x2b80e1=_0x5e20b0[_0x75b9('0x1b')];var _0x2488fd=_0x2b80e1['split'](';');var _0x172aa2=[];orderBy=0x0;for(var _0x54c231=0x0;_0x54c231<_0x2488fd['length'];_0x54c231++){_0x172aa2[_0x75b9('0x1d')](splitAdditionalPhone(_0x5e20b0['id'],_0x2488fd[_0x54c231]));}Promise[_0x75b9('0x1e')](_0x172aa2)['then'](function(){_0x4226d0({'val':_0x2488fd['length']});});});}function splitAdditionalPhone(_0x3aadd2,_0x3276db){return new Promise(function(_0x439883,_0x21369e){var _0x6a07b8=_0x3276db[_0x75b9('0x20')](':');var _0x178ae0=_0x6a07b8[0x0];var _0x4d85e8=_0x6a07b8[0x1];if(!_[_0x75b9('0x21')](_0x4d85e8)){var _0x23c235=_0x4d85e8[_0x75b9('0x20')]('|');var _0x2ed00f=[];for(var _0x3f2b7e=0x0;_0x3f2b7e<_0x23c235[_0x75b9('0x1c')];_0x3f2b7e++){if(_0x23c235[_0x3f2b7e]!==''){var _0x5870b2=_['filter'](promisesAdditionalPhones,{'contactId':_0x3aadd2,'phone':_0x23c235[_0x3f2b7e]});if(_0x5870b2['length']==0x0){orderBy++;promisesAdditionalPhones[_0x75b9('0x1d')]({'contactId':_0x3aadd2,'contactTypeId':_0x178ae0,'phone':_0x23c235[_0x3f2b7e],'orderBy':orderBy});}}}_0x439883({'ok':0x1});}else _0x439883({'res':0x0});});}function createAdditionalPhone(_0x33166d,_0x56d231,_0x163549,_0x4763c4){var _0x48ec2c='';var _0x2c65f7='';var _0x2b1ba3=_0x163549['split']('§');_0x48ec2c=_0x2b1ba3[0x0];if(_0x2b1ba3['length']==0x2)_0x2c65f7=_0x2b1ba3[0x1];return new Promise(function(_0x11619f,_0xae5ea8){return db[_0x75b9('0x22')]['findOne']({'where':{'CmContactId':_0x33166d,'item':_0x48ec2c}})[_0x75b9('0x1f')](function(_0xf27996){if(_0xf27996){return db['CmContactHasItem']['update']({'ItemTypeId':_0x56d231,'description':_0x2c65f7,'OrderBy':_0x4763c4},{'where':{'CmContactId':_0x33166d,'item':_0x48ec2c}})[_0x75b9('0x1f')](function(_0x5b3bc7){_0x11619f({'res':_0x75b9('0x23')});});}else{return db[_0x75b9('0x22')]['create']({'CmContactId':_0x33166d,'item':_0x48ec2c,'description':_0x2c65f7,'ItemTypeId':_0x56d231,'OrderBy':_0x4763c4,'ItemClass':_0x75b9('0x24')})[_0x75b9('0x1f')](function(_0x43ca9d){_0x11619f({'res':_0x75b9('0x25')});});}});});}function insertCmHopper(_0x4a30b6,_0x31c5bc,_0x3a6110,_0x4a3356,_0xd31fb){var _0x461cd9=[_0x75b9('0x26'),_0x75b9('0x27'),_0x75b9('0x28'),_0x75b9('0x29'),_0x31c5bc+'.'+_0x4a3356,_0x75b9('0x2a'),_0x75b9('0x2b'),_0x75b9('0x2c'),_0x75b9('0x2d'),'\x22'+_0xd31fb+'\x22'];return squel[_0x75b9('0x2e')]()[_0x75b9('0x2f')]('cm_hopper')[_0x75b9('0x30')]([_0x75b9('0x14'),_0x75b9('0x31'),_0x75b9('0x32'),'ListId',_0x4a3356,_0x75b9('0x33'),'updatedAt',_0x75b9('0x34'),_0x75b9('0x35'),_0x75b9('0x36')],squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x461cd9)['from'](_0x31c5bc)[_0x75b9('0x15')](_0x75b9('0x38'),null,_0x75b9('0x39')+_0x31c5bc+_0x75b9('0x3a'))[_0x75b9('0x15')](_0x3a6110,null,_0x3a6110+_0x75b9('0x16')+_0x31c5bc+'.'+_0x4a3356)[_0x75b9('0x18')](_0x31c5bc+_0x75b9('0x3b'),_0x4a30b6)[_0x75b9('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x75b9('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x31c5bc,_0x3a6110,_0x4a3356,_0x75b9('0x3c'),[_0x75b9('0x3d'),_0x75b9('0x3e')]))['where'](_0x75b9('0x3f'),selectNotIn(_0x31c5bc,_0x3a6110,_0x4a3356,_0x75b9('0x3c'),[_0x75b9('0x3d')])))[_0x75b9('0x40')]();}function insertCmHopperBlack(_0x253045,_0x4cb68e,_0xb52af9,_0x3eb634){var _0x1bc1b0=[_0x75b9('0x26'),'cm_contacts.id','cm_contacts.ListId',_0x4cb68e+'.'+_0x3eb634,_0x75b9('0x2a'),_0x75b9('0x2b')];return squel[_0x75b9('0x2e')]()[_0x75b9('0x2f')](_0x75b9('0x41'))['fromQuery']([_0x75b9('0x14'),'ContactId',_0x75b9('0x42'),_0x3eb634,'createdAt',_0x75b9('0x43')],squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x1bc1b0)[_0x75b9('0x44')](_0x4cb68e)[_0x75b9('0x15')](_0x75b9('0x38'),null,_0x75b9('0x39')+_0x4cb68e+_0x75b9('0x3a'))[_0x75b9('0x15')](_0xb52af9,null,_0xb52af9+_0x75b9('0x16')+_0x4cb68e+'.'+_0x3eb634)[_0x75b9('0x18')](_0x4cb68e+'.CmListId\x20=\x20?',_0x253045)[_0x75b9('0x18')](_0x75b9('0x45'),NOW)[_0x75b9('0x18')](_0x75b9('0x3f'),squel['select']()[_0x75b9('0x46')]('phone')[_0x75b9('0x44')](_0x75b9('0x41'))[_0x75b9('0x18')](_0x75b9('0x47'),_0x253045)[_0x75b9('0x18')](_0x3eb634+_0x75b9('0x17')+_0x4cb68e+'.'+_0x3eb634)))['toString']();}function insertTzCmHopper(_0xc4f69d,_0x5a58cb,_0x27124b,_0x1df56c,_0x1359a5,_0x519d8c){var _0x11c566=['cm_contacts.phone','date_add(cm_contacts.scheduledat,interval\x20'+_0x519d8c+_0x75b9('0x48'),_0x75b9('0x28'),_0x75b9('0x29'),_0x5a58cb+'.'+_0x1df56c,'cm_contacts.createdAt',_0x75b9('0x2b'),_0x75b9('0x2c'),_0x75b9('0x2d'),'\x22'+_0x1359a5+'\x22'];var _0x256ec6=squel[_0x75b9('0x2e')]()[_0x75b9('0x2f')](_0x75b9('0x3c'))['fromQuery'](['phone',_0x75b9('0x31'),'ContactId','ListId',_0x1df56c,'createdAt',_0x75b9('0x43'),_0x75b9('0x34'),_0x75b9('0x35'),'recallme'],squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x11c566)[_0x75b9('0x44')](_0x5a58cb)[_0x75b9('0x15')](_0x75b9('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x5a58cb+_0x75b9('0x3a'))['join'](_0x27124b,null,_0x27124b+_0x75b9('0x16')+_0x5a58cb+'.'+_0x1df56c)[_0x75b9('0x15')](_0x519d8c,null,_0x519d8c+_0x75b9('0x16')+_0x5a58cb+'.'+_0x1df56c)[_0x75b9('0x18')](_0x5a58cb+_0x75b9('0x3b'),_0xc4f69d)[_0x75b9('0x18')](_0x75b9('0x45'),NOW)['where'](_0x75b9('0x3f'),selectNotIn(_0x5a58cb,_0x27124b,_0x1df56c,_0x75b9('0x3c'),[_0x75b9('0x3d'),'\x22onlyIfOpen\x22']))['where'](_0x75b9('0x3f'),selectNotIn(_0x5a58cb,_0x27124b,_0x1df56c,_0x75b9('0x3c'),[_0x75b9('0x3d')])))['toString']();return _0x256ec6;}function insertTzCmHopperBlack(_0x1a2fa6,_0x3eaab5,_0x1e6925,_0x230db4){var _0x21586a=[_0x75b9('0x26'),'cm_contacts.id',_0x75b9('0x29'),_0x3eaab5+'.'+_0x230db4,_0x75b9('0x2a'),_0x75b9('0x2b')];return squel[_0x75b9('0x2e')]()['into'](_0x75b9('0x41'))['fromQuery'](['phone','ContactId',_0x75b9('0x42'),_0x230db4,_0x75b9('0x33'),_0x75b9('0x43')],squel[_0x75b9('0x13')]()['fields'](_0x21586a)['from'](_0x3eaab5)[_0x75b9('0x15')](_0x75b9('0x38'),null,_0x75b9('0x39')+_0x3eaab5+_0x75b9('0x3a'))['join'](_0x1e6925,null,_0x1e6925+_0x75b9('0x16')+_0x3eaab5+'.'+_0x230db4)[_0x75b9('0x18')](_0x3eaab5+_0x75b9('0x3b'),_0x1a2fa6)[_0x75b9('0x18')](_0x75b9('0x45'),NOW)[_0x75b9('0x18')](_0x75b9('0x3f'),squel[_0x75b9('0x13')]()[_0x75b9('0x46')](_0x75b9('0x14'))[_0x75b9('0x44')](_0x75b9('0x41'))['where']('ListId\x20=\x20?',_0x1a2fa6)[_0x75b9('0x18')](_0x230db4+'\x20=\x20'+_0x3eaab5+'.'+_0x230db4)))[_0x75b9('0x40')]();}function insertCmHopperAdditionalPhones(_0x3e3e06){var _0x54ffd4=[_0x75b9('0x49'),'cm_contact_has_items.item',_0x75b9('0x4a'),_0x75b9('0x4b'),_0x75b9('0x4c')];return squel[_0x75b9('0x2e')]()[_0x75b9('0x2f')]('cm_hopper_additional_phones')['fromQuery']([_0x75b9('0x4d'),_0x75b9('0x14'),_0x75b9('0x4e'),_0x75b9('0x33'),'updatedAt'],squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x54ffd4)['from'](_0x75b9('0x3c'))[_0x75b9('0x15')](_0x75b9('0x38'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x75b9('0x15')](_0x75b9('0x4f'),null,_0x75b9('0x50'))[_0x75b9('0x18')](_0x75b9('0x51'),_0x3e3e06)[_0x75b9('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x209662,_0x1b8b28,_0x29a3b8,_0xe6142b){var _0x1e9a46=_[_0x75b9('0x52')](_[_0x75b9('0x53')](_0xe6142b),[_0x75b9('0x42'),'CompanyId',_0x75b9('0x33'),_0x75b9('0x43'),_0x75b9('0x54')]);return squel[_0x75b9('0x2e')]()[_0x75b9('0x2f')](_0x75b9('0x38'))[_0x75b9('0x30')](_0x1e9a46,squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x1e9a46)[_0x75b9('0x44')](_0x1b8b28)[_0x75b9('0x18')]('('+_0x29a3b8['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x75b9('0x13')]()[_0x75b9('0x37')](_0x29a3b8)[_0x75b9('0x44')](_0x75b9('0x38'))[_0x75b9('0x18')](_0x75b9('0x47'),_0x209662)[_0x75b9('0x18')](_0x75b9('0x55')))[_0x75b9('0x18')](_0x75b9('0x56'),squel[_0x75b9('0x13')]()[_0x75b9('0x46')](_0x75b9('0x57'),'min_id')[_0x75b9('0x44')](_0x1b8b28)[_0x75b9('0x58')](_0x29a3b8[_0x75b9('0x15')](','))))[_0x75b9('0x40')]();}function handleStop(){logger[_0x75b9('0x59')](_0x75b9('0x5a'));stopped=!![];}function handleUncaughtException(_0x3630ea){logger[_0x75b9('0x5b')](_0x3630ea['message']);process[_0x75b9('0x5c')](0x1);}function handleError(_0x12b9e8,_0x50a1ca){stats[_0x75b9('0x5d')][_0x75b9('0x1d')]({'name':_0x50a1ca[_0x75b9('0x5e')],'message':_0x50a1ca[_0x75b9('0x5f')],'row':_0x12b9e8});}function handleQuery(_0x13ab94){logger['info'](_0x13ab94);return db[_0x75b9('0x60')][_0x75b9('0x61')](_0x13ab94)[_0x75b9('0x62')](function(_0x49773f){results[_0x75b9('0x1d')](_0x49773f);})['catch'](function(_0x4c7ce9){logger[_0x75b9('0x5b')](_0x4c7ce9['message']);});}function updateTzCampaigns(_0x4386f7){return new Promise(function(_0x3cddce,_0x30016e){var _0xd5469=squel[_0x75b9('0x13')]()[_0x75b9('0x37')]([_0x75b9('0x63'),_0x75b9('0x64')])[_0x75b9('0x44')]('campaigns')[_0x75b9('0x15')]('campaigns_has_cm_lists',null,_0x75b9('0x65'))[_0x75b9('0x18')]('campaigns_has_cm_lists.CmListId='+_0x4386f7);db[_0x75b9('0x60')][_0x75b9('0x61')](_0xd5469[_0x75b9('0x40')]())[_0x75b9('0x62')](function(_0x42a113){var _0x432bf1=[];for(var _0x3a1332=0x0;_0x3a1332<_0x42a113['length'];_0x3a1332++){_0x432bf1[_0x75b9('0x1d')](getTimezoneData(_0x42a113[_0x3a1332],tmp_campaigns));}BPromise['all'](_0x432bf1)['then'](function(){_0x3cddce({'val':0x1});});})[_0x75b9('0x66')](function(_0x1f1986){logger[_0x75b9('0x5b')](_0x1f1986[_0x75b9('0x5f')]);_0x3cddce({'val':0x0});});});}function updateTzVoiceQueues(_0x1638ae){return new Promise(function(_0x2d7438,_0x5ae640){var _0x1a9727=squel[_0x75b9('0x13')]()[_0x75b9('0x37')]([_0x75b9('0x67'),_0x75b9('0x68')])[_0x75b9('0x44')](_0x75b9('0x69'))['join'](_0x75b9('0x6a'),null,_0x75b9('0x6b'))[_0x75b9('0x18')](_0x75b9('0x6c')+_0x1638ae);db['sequelize'][_0x75b9('0x61')](_0x1a9727[_0x75b9('0x40')]())[_0x75b9('0x62')](function(_0x213f58){var _0x296bad=[];for(var _0x5df8da=0x0;_0x5df8da<_0x213f58[_0x75b9('0x1c')];_0x5df8da++){_0x296bad[_0x75b9('0x1d')](getTimezoneData(_0x213f58[_0x5df8da],tmp_voice_queues));}BPromise[_0x75b9('0x1e')](_0x296bad)[_0x75b9('0x1f')](function(){_0x2d7438({'val':0x1});});})['catch'](function(_0x561d72){logger['error'](_0x561d72[_0x75b9('0x5f')]);_0x2d7438({'val':0x0});});});}function getTimezoneData(_0x2c7917,_0x501ec3){return new Promise(function(_0x5cbb65,_0x252993){var _0x2c456b=shared[_0x75b9('0x6d')];var _0x1b8724=_0x2c456b[_0x2c7917[_0x75b9('0x6e')]];if(_[_0x75b9('0x21')](_0x1b8724)){_0x5cbb65({'ret':0x1});}else{var _0x3a7409=_0x1b8724[_0x75b9('0x6f')];var _0x14af6c=squel[_0x75b9('0x2e')]()['into'](_0x501ec3)[_0x75b9('0x70')]('id',_0x2c7917['id'])['set'](_0x75b9('0x71'),_0x3a7409)['set'](_0x75b9('0x6e'),_0x2c7917[_0x75b9('0x6e')])[_0x75b9('0x40')]();return db[_0x75b9('0x60')][_0x75b9('0x61')](_0x14af6c)[_0x75b9('0x62')](function(_0x3cdd75){_0x5cbb65({'ret':0x1});})[_0x75b9('0x66')](function(_0x273c35){logger[_0x75b9('0x5b')](_0x273c35['message']);_0x252993({'ret':0x1});});}});}function handleTZQuery(_0x5d6972){logger[_0x75b9('0x59')](_0x5d6972);return db[_0x75b9('0x60')][_0x75b9('0x61')](_0x5d6972)[_0x75b9('0x62')](function(_0x5981a7){})[_0x75b9('0x66')](function(_0x319470){logger[_0x75b9('0x5b')](_0x319470[_0x75b9('0x5f')]);});}function main(_0x2d6cb6,_0x1de266,_0x3953b1,_0x9d8365){logger[_0x75b9('0x59')](_0x75b9('0x72'),_0x2d6cb6,JSON['stringify'](_0x1de266));process[_0x75b9('0x73')](_0x75b9('0x74'));var _0x4ef5db=_0x1de266['binding'];var _0x10652b=_['clone'](_0x4ef5db);var _0x48ae42=_0x1de266['socket_timestamp'];var _0x451133=path[_0x75b9('0x15')](config[_0x75b9('0x75')],_0x75b9('0x76'),_0x48ae42+_0x75b9('0x77'));hasTZ=_['keys'](_0x4ef5db)[_0x75b9('0x78')]('dialTimezone');var _0x412f1b=_[_0x75b9('0x53')](_0x4ef5db)[_0x75b9('0x15')]();logger[_0x75b9('0x59')](_0x75b9('0x79'),_0x412f1b);db['ContactItemType'][_0x75b9('0x7a')]({'raw':!![],'attributes':['id',_0x75b9('0x7b')]})[_0x75b9('0x1f')](function(_0x6614fe){for(var _0x205460=0x0;_0x205460<_0x6614fe[_0x75b9('0x1c')];_0x205460++){if(_0x6614fe[_0x205460][_0x75b9('0x7b')]in _0x4ef5db){contactItemTypes[_0x75b9('0x1d')](_0x6614fe[_0x205460]);delete _0x10652b[_0x6614fe[_0x205460][_0x75b9('0x7b')]];hasAdditionalPhones=!![];}for(var _0x454bdf in _0x4ef5db){if(_0x6614fe[_0x205460]['name']+'_description'===_0x454bdf){phoneDescriptions[_0x75b9('0x1d')]({'itemTypeId':_0x6614fe[_0x205460]['id'],'description':_0x454bdf});delete _0x10652b[_0x454bdf];}}}if(hasAdditionalPhones)_0x10652b[_0x75b9('0x1b')]='';var _0x328062=_['keys'](_0x10652b)['join']();logger[_0x75b9('0x59')](_0x75b9('0x79'),_0x328062);fs['writeFileSync'](_0x451133,_0x328062+'\x0a');Papa['parse'](fs[_0x75b9('0x7c')](_0x2d6cb6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5a1eeb,_0x2c866e){try{for(var _0x533236=0x0,_0x3fe258=[];_0x533236<_0x5a1eeb[_0x75b9('0x7d')][_0x75b9('0x1c')];_0x533236++){stats[_0x75b9('0x7e')]+=0x1;if(_0x5a1eeb[_0x75b9('0x5d')][_0x533236]){handleError(_0x5a1eeb['data'][_0x533236],_0x5a1eeb['errors'][_0x533236]);}else{var _0x4da35d=[];var _0x241269=[];var _0x2e348b={};for(var _0x296b8d in _0x4ef5db){let _0x27f5d4=contactItemTypes[_0x75b9('0x7f')](_0x254ed3=>_0x254ed3[_0x75b9('0x7b')]===_0x296b8d);let _0x563093=contactItemTypes[_0x75b9('0x7f')](_0x51244d=>_0x51244d['name']+_0x75b9('0x80')===_0x296b8d);if(_[_0x75b9('0x21')](_0x27f5d4)&&_['isNil'](_0x563093)){if(_0x4ef5db[_0x75b9('0x81')](_0x296b8d)){if(_0x5a1eeb[_0x75b9('0x7d')][_0x533236][_0x4ef5db[_0x296b8d]]){var _0x50b57e=_['trim'](_0x5a1eeb[_0x75b9('0x7d')][_0x533236][_0x4ef5db[_0x296b8d]]['replace'](/"/g,'\x27'));switch(_0x296b8d){case _0x75b9('0x31'):var _0xc33477=moment(_0x50b57e,_0x75b9('0x10'),!![]);if(_0xc33477[_0x75b9('0x82')]()){_0x3fe258['push']('\x22'+_0x50b57e+'\x22');}else{_0x4da35d[_0x75b9('0x1d')](_0x75b9('0x83'));}break;case _0x75b9('0x34'):var _0x202bb5=parseInt(_0x50b57e);_0x50b57e=_[_0x75b9('0x84')](_0x202bb5)||_0x202bb5<0x0||_0x202bb5>0x4?_0x9d8365?0x3:0x2:_0x202bb5;_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x50b57e+'\x22');break;case _0x75b9('0x35'):var _0x2783cf=parseInt(_0x50b57e);if(_[_0x75b9('0x85')](_0x2783cf)&&_[_0x75b9('0x78')](_0x3953b1,_0x2783cf)){_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x2783cf+'\x22');}else{_0x4da35d['push'](_0x75b9('0x86'));}break;case _0x75b9('0x87'):if(isEmail(_0x50b57e)){_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x50b57e+'\x22');}else{_0x4da35d['push']('email\x20wrong\x20format');}break;case _0x75b9('0x88'):var _0x4e1bfd=moment(_0x50b57e,_0x75b9('0x89'),!![]);if(_0x4e1bfd[_0x75b9('0x82')]()){_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x50b57e+'\x22');}else{_0x4da35d['push'](_0x75b9('0x8a'));}break;case _0x75b9('0x6e'):var _0x28ac8d=shared[_0x75b9('0x6d')];var _0x46218e=_0x28ac8d[_0x50b57e];if(!_[_0x75b9('0x21')](_0x46218e)){var _0xc9816e=_0x46218e[_0x75b9('0x6f')];_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x50b57e+'\x22');_0x3fe258['push']('\x22'+_0xc9816e+'\x22');}break;default:_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x50b57e+'\x22');}}else{switch(_0x296b8d){case _0x75b9('0x8b'):case _0x75b9('0x14'):_0x4da35d[_0x75b9('0x1d')](_0x296b8d+_0x75b9('0x8c'));break;default:_0x3fe258[_0x75b9('0x1d')]('\x22\x22');}}}}else{var _0x3ffe0c='';if(!_[_0x75b9('0x21')](_0x27f5d4)){if(!_0x2e348b['hasOwnProperty'](_0x27f5d4['id'])){if(!_[_0x75b9('0x21')](_0x5a1eeb[_0x75b9('0x7d')][_0x533236][_0x4ef5db[_0x296b8d]])){var _0x50b57e=_['trim'](_0x5a1eeb[_0x75b9('0x7d')][_0x533236][_0x4ef5db[_0x296b8d]][_0x75b9('0x8d')](/"/g,'\x27'));var _0x5cbdd7=phoneDescriptions[_0x75b9('0x7f')](_0x3977a1=>_0x3977a1[_0x75b9('0x8e')]===_0x27f5d4['id']);if(!_[_0x75b9('0x21')](_0x5cbdd7)){var _0x522fe8=_[_0x75b9('0x8f')](_0x5a1eeb['data'][_0x533236][_0x4ef5db[_0x5cbdd7[_0x75b9('0x90')]]][_0x75b9('0x8d')](/"/g,'\x27'));if(!_[_0x75b9('0x21')](_0x522fe8))_0x50b57e=_0x50b57e+'§'+_0x522fe8;}if(_0x3ffe0c=='')_0x3ffe0c=_0x50b57e;else _0x3ffe0c+='|'+_0x50b57e;}_0x241269[_0x75b9('0x1d')](_0x27f5d4['id']+':'+_0x3ffe0c);_0x2e348b[_0x27f5d4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3fe258[_0x75b9('0x1d')]('\x22'+_0x241269[_0x75b9('0x15')](';')+'\x22');}if(_0x4da35d[_0x75b9('0x1c')]){handleError(_0x5a1eeb[_0x75b9('0x7d')][_0x533236],{'code':'SystemRow','message':_0x4da35d[_0x75b9('0x15')]()});}else{fs[_0x75b9('0x91')](_0x451133,_0x3fe258[_0x75b9('0x15')]()+'\x0a');}_0x3fe258=[];}if(!(stats['rows']%0xc8)){socket[_0x75b9('0x92')](_0x75b9('0x93')+_0x48ae42,stats);stats[_0x75b9('0x5d')]=[];}}if(stopped){logger[_0x75b9('0x59')](_0x75b9('0x94'));_0x2c866e[_0x75b9('0x95')]();}}catch(_0x5ebc13){handleError(_0x5a1eeb['data'][_0x533236],{'code':_0x75b9('0x96'),'message':_0x5ebc13['message']});logger[_0x75b9('0x5b')](_0x75b9('0x97'),_0x5ebc13[_0x75b9('0x5f')]);}},'complete':function(){try{var _0xee8dc2=[];var _0x29b471=[];var _0x5619f9='cm_contacts';if(_0x1de266[_0x75b9('0x98')]&&_0x1de266[_0x75b9('0x98')][_0x75b9('0x1c')]){_0x5619f9=_0x75b9('0x99')+_0x48ae42;_0xee8dc2[_0x75b9('0x1d')]('CREATE\x20TABLE\x20'+_0x5619f9+_0x75b9('0x9a'));}tmp_campaigns=_0x75b9('0x9b')+_0x48ae42;tmp_voice_queues=_0x75b9('0x9c')+_0x48ae42;_0x29b471[_0x75b9('0x1d')](_0x75b9('0x9d')+tmp_campaigns+_0x75b9('0x9e'));_0x29b471[_0x75b9('0x1d')](_0x75b9('0x9d')+tmp_voice_queues+_0x75b9('0x9e'));BPromise['each'](_0x29b471,handleTZQuery)[_0x75b9('0x1f')](function(_0x11cce3){updateTzCampaigns(_0x1de266[_0x75b9('0x42')])[_0x75b9('0x1f')](function(_0x3e3818){updateTzVoiceQueues(_0x1de266[_0x75b9('0x42')])['then'](function(_0x3c836b){if(hasTZ)_0x328062=_0x328062[_0x75b9('0x8d')](_0x75b9('0x6e'),_0x75b9('0x9f'));var _0x47bb5f=util[_0x75b9('0x11')](_0x75b9('0xa0'),_0x451133,_0x5619f9,_0x328062,_0x1de266[_0x75b9('0x42')],_0x1de266[_0x75b9('0xa1')]||null,NOW,NOW);if(_['isNil'](_0x4ef5db['scheduledat'])){_0x47bb5f+=_0x75b9('0xa2');}_0xee8dc2[_0x75b9('0x1d')](_0x47bb5f);if(_0x1de266[_0x75b9('0x98')]&&_0x1de266[_0x75b9('0x98')]['length']){_0xee8dc2[_0x75b9('0x1d')](insertCmContact(_0x1de266[_0x75b9('0x42')],_0x5619f9,_0x1de266['duplicates'],_0x4ef5db));_0xee8dc2['push'](_0x75b9('0xa3')+_0x5619f9+';');}BPromise[_0x75b9('0xa4')](_0xee8dc2,handleQuery)[_0x75b9('0x1f')](function(_0x411880){BPromise[_0x75b9('0x1e')]([handleAdditionalPhones()])[_0x75b9('0x1f')](function(){_0xee8dc2=[];for(var _0x17865c=0x0;_0x17865c\x20\x20');}var _0x59660b=path[_0x75b9('0x15')](config[_0x75b9('0x75')],_0x75b9('0x76'),process[_0x75b9('0xb0')][0x2]);if(!fs[_0x75b9('0xb1')](_0x59660b)){throw new Error(_0x75b9('0xb2'));}var _0x2e88d6={};try{_0x2e88d6=JSON[_0x75b9('0xb3')](process['argv'][0x3]);if(!_0x2e88d6['binding']){throw new Error(_0x75b9('0xb4'));}if(!_0x2e88d6[_0x75b9('0xb5')][_0x75b9('0x14')]){throw new Error(_0x75b9('0xb6'));}if(!_0x2e88d6[_0x75b9('0xb5')][_0x75b9('0x8b')]){throw new Error(_0x75b9('0xb7'));}var _0x3cdb80=0x0;if(_0x2e88d6[_0x75b9('0xb5')][_0x75b9('0x35')]){_0x3cdb80=0x1;}if(!_0x2e88d6['ListId']){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x43988a){throw new Error('body\x20id\x20mandatory');}var _0x1e9236=[];try{_0x1e9236=_['map'](JSON[_0x75b9('0xb3')](process[_0x75b9('0xb0')][0x4]),'id');}catch(_0x1365b0){logger[_0x75b9('0x59')](_0x75b9('0xb8'));}main(_0x59660b,_0x2e88d6,_0x1e9236,_0x3cdb80);}validate();process['on'](_0x75b9('0xb9'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x88dc=['start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','header','ContactItemType','name','writeFileSync','parse','createReadStream','data','rows','find','_description','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','agent\x20not\x20exists','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','emit','contact:import:','errors','Abort\x20parser','abort','SystemError','duplicates','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','CompanyId',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','phone','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','CmContact','findAll','AdditionalPhones','then','length','push','split','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','scheduledat','ContactId','ListId','createdAt','updatedAt','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_hopper_black','fromQuery','from','cm_contacts','cm_contacts.createdAt\x20=\x20?','field','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','cm_contacts.UserId','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','CmHopperId','OrderBy','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)','group','info','Received\x20SIGINT','error','message','exit','sequelize','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','query','all','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','utcOffset','set','offset','spread','main','stringify','send'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x88dc,0xfa));var _0xc88d=function(_0x33aecf,_0x395c5e){_0x33aecf=_0x33aecf-0x0;var _0x151d3c=_0x88dc[_0x33aecf];return _0x151d3c;};'use strict';var fs=require('fs');var path=require(_0xc88d('0x0'));var _=require(_0xc88d('0x1'));var Papa=require(_0xc88d('0x2'));var util=require(_0xc88d('0x3'));var BPromise=require('bluebird');var moment=require(_0xc88d('0x4'));var squel=require(_0xc88d('0x5'));var Redis=require(_0xc88d('0x6'));var db=require(_0xc88d('0x7'))['db'];var config=require(_0xc88d('0x8'));var shared=require(_0xc88d('0x9'));var logger=require(_0xc88d('0xa'))('import');config[_0xc88d('0xb')]=_[_0xc88d('0xc')](config[_0xc88d('0xb')],{'host':_0xc88d('0xd'),'port':0x18eb});var socket=require(_0xc88d('0xe'))(new Redis(config[_0xc88d('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0xc88d('0xf')](_0xc88d('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format'](_0xc88d('0x10'));function isEmail(_0x20e6ec){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x20e6ec);}function selectNotIn(_0x5bc546,_0x14c369,_0x5db3fa,_0x2cec9b,_0x5b8b86){return squel[_0xc88d('0x11')]()['field'](_0xc88d('0x12'))['from'](_0x2cec9b)['join'](_0x14c369,null,_0x14c369+_0xc88d('0x13')+_0x2cec9b+'.'+_0x5db3fa)[_0xc88d('0x14')](_0x2cec9b+'.'+_0x5db3fa+_0xc88d('0x15')+_0x5bc546+'.'+_0x5db3fa)[_0xc88d('0x14')](_0x14c369+_0xc88d('0x16')+_0x5b8b86[_0xc88d('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x225e54,_0x470ec4){promisesAdditionalPhones=[];return db[_0xc88d('0x18')][_0xc88d('0x19')]({'raw':!![],'attributes':['id',_0xc88d('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xc88d('0x1b')](function(_0x129a65){if(_0x129a65!==null){var _0x7ad48c=[];for(var _0x54a678=0x0;_0x54a678<_0x129a65[_0xc88d('0x1c')];_0x54a678++){var _0x4f5fcd=_0x129a65[_0x54a678];_0x7ad48c[_0xc88d('0x1d')](insertAdditionalPhones(_0x4f5fcd));}}Promise['all'](_0x7ad48c)[_0xc88d('0x1b')](function(){_0x225e54({'val':0x1});});});});}function insertAdditionalPhones(_0x336a73){return new Promise(function(_0x400acd,_0x4d3e81){var _0x3c847c=_0x336a73[_0xc88d('0x1a')];var _0x5488b3=_0x3c847c[_0xc88d('0x1e')](';');var _0x886229=[];orderBy=0x0;for(var _0x17ff73=0x0;_0x17ff73<_0x5488b3[_0xc88d('0x1c')];_0x17ff73++){_0x886229[_0xc88d('0x1d')](splitAdditionalPhone(_0x336a73['id'],_0x5488b3[_0x17ff73]));}Promise['all'](_0x886229)[_0xc88d('0x1b')](function(){_0x400acd({'val':_0x5488b3['length']});});});}function splitAdditionalPhone(_0x17a55a,_0x516666){return new Promise(function(_0x599c28,_0x14ba57){var _0x5eaada=_0x516666['split'](':');var _0x4775e5=_0x5eaada[0x0];var _0xa15a1a=_0x5eaada[0x1];if(!_[_0xc88d('0x1f')](_0xa15a1a)){var _0x1743e2=_0xa15a1a[_0xc88d('0x1e')]('|');var _0x151ece=[];for(var _0x2ae284=0x0;_0x2ae284<_0x1743e2['length'];_0x2ae284++){if(_0x1743e2[_0x2ae284]!==''){var _0x3c00f8=_[_0xc88d('0x20')](promisesAdditionalPhones,{'contactId':_0x17a55a,'phone':_0x1743e2[_0x2ae284]});if(_0x3c00f8[_0xc88d('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0xc88d('0x1d')]({'contactId':_0x17a55a,'contactTypeId':_0x4775e5,'phone':_0x1743e2[_0x2ae284],'orderBy':orderBy});}}}_0x599c28({'ok':0x1});}else _0x599c28({'res':0x0});});}function createAdditionalPhone(_0x4f3839,_0x10a834,_0x26e16d,_0x1cecdb){var _0x20737d='';var _0x1f0fb9='';var _0x284585=_0x26e16d['split']('§');_0x20737d=_0x284585[0x0];if(_0x284585['length']==0x2)_0x1f0fb9=_0x284585[0x1];return new Promise(function(_0x58d2cf,_0x1558d4){return db[_0xc88d('0x21')][_0xc88d('0x22')]({'where':{'CmContactId':_0x4f3839,'item':_0x20737d}})[_0xc88d('0x1b')](function(_0x556b96){if(_0x556b96){return db[_0xc88d('0x21')][_0xc88d('0x23')]({'ItemTypeId':_0x10a834,'description':_0x1f0fb9,'OrderBy':_0x1cecdb},{'where':{'CmContactId':_0x4f3839,'item':_0x20737d}})[_0xc88d('0x1b')](function(_0x3b317f){_0x58d2cf({'res':'updated'});});}else{return db[_0xc88d('0x21')][_0xc88d('0x24')]({'CmContactId':_0x4f3839,'item':_0x20737d,'description':_0x1f0fb9,'ItemTypeId':_0x10a834,'OrderBy':_0x1cecdb,'ItemClass':_0xc88d('0x25')})[_0xc88d('0x1b')](function(_0x80fa47){_0x58d2cf({'res':'inserted'});});}});});}function insertCmHopper(_0xbd07db,_0x30de62,_0x5bd55c,_0x33cb6b,_0x691aaf){var _0x1150bd=[_0xc88d('0x26'),'cm_contacts.scheduledat',_0xc88d('0x27'),_0xc88d('0x28'),_0x30de62+'.'+_0x33cb6b,_0xc88d('0x29'),_0xc88d('0x2a'),_0xc88d('0x2b'),'cm_contacts.UserId','\x22'+_0x691aaf+'\x22'];return squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')](_0xc88d('0x2e'))['fromQuery']([_0xc88d('0x12'),_0xc88d('0x2f'),_0xc88d('0x30'),_0xc88d('0x31'),_0x33cb6b,_0xc88d('0x32'),_0xc88d('0x33'),'priority',_0xc88d('0x34'),_0xc88d('0x35')],squel[_0xc88d('0x11')]()[_0xc88d('0x36')](_0x1150bd)['from'](_0x30de62)['join']('cm_contacts',null,_0xc88d('0x37')+_0x30de62+_0xc88d('0x38'))['join'](_0x5bd55c,null,_0x5bd55c+'.id\x20=\x20'+_0x30de62+'.'+_0x33cb6b)[_0xc88d('0x14')](_0x30de62+_0xc88d('0x39'),_0xbd07db)[_0xc88d('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xc88d('0x3a'),selectNotIn(_0x30de62,_0x5bd55c,_0x33cb6b,_0xc88d('0x2e'),[_0xc88d('0x3b'),_0xc88d('0x3c')]))[_0xc88d('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x30de62,_0x5bd55c,_0x33cb6b,_0xc88d('0x2e'),[_0xc88d('0x3b')])))[_0xc88d('0x3d')]();}function insertCmHopperBlack(_0x35fbc8,_0x57634f,_0x263d43,_0x5d0be6){var _0x584bd6=[_0xc88d('0x26'),_0xc88d('0x27'),_0xc88d('0x28'),_0x57634f+'.'+_0x5d0be6,_0xc88d('0x29'),'cm_contacts.updatedAt'];return squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')](_0xc88d('0x3e'))[_0xc88d('0x3f')](['phone',_0xc88d('0x30'),_0xc88d('0x31'),_0x5d0be6,_0xc88d('0x32'),'updatedAt'],squel[_0xc88d('0x11')]()[_0xc88d('0x36')](_0x584bd6)[_0xc88d('0x40')](_0x57634f)[_0xc88d('0x17')](_0xc88d('0x41'),null,_0xc88d('0x37')+_0x57634f+_0xc88d('0x38'))['join'](_0x263d43,null,_0x263d43+_0xc88d('0x13')+_0x57634f+'.'+_0x5d0be6)[_0xc88d('0x14')](_0x57634f+_0xc88d('0x39'),_0x35fbc8)[_0xc88d('0x14')](_0xc88d('0x42'),NOW)[_0xc88d('0x14')](_0xc88d('0x3a'),squel[_0xc88d('0x11')]()[_0xc88d('0x43')]('phone')[_0xc88d('0x40')]('cm_hopper_black')[_0xc88d('0x14')](_0xc88d('0x44'),_0x35fbc8)[_0xc88d('0x14')](_0x5d0be6+_0xc88d('0x15')+_0x57634f+'.'+_0x5d0be6)))['toString']();}function insertTzCmHopper(_0x119f0c,_0x4e4472,_0x37c001,_0x14df14,_0x23d8c1,_0x26bf56){var _0x198e88=[_0xc88d('0x26'),_0xc88d('0x45')+_0x26bf56+'.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.id','cm_contacts.ListId',_0x4e4472+'.'+_0x14df14,_0xc88d('0x29'),'cm_contacts.updatedAt','cm_contacts.priority',_0xc88d('0x46'),'\x22'+_0x23d8c1+'\x22'];var _0x2a8bc5=squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')](_0xc88d('0x2e'))[_0xc88d('0x3f')]([_0xc88d('0x12'),_0xc88d('0x2f'),_0xc88d('0x30'),'ListId',_0x14df14,_0xc88d('0x32'),_0xc88d('0x33'),'priority',_0xc88d('0x34'),_0xc88d('0x35')],squel['select']()[_0xc88d('0x36')](_0x198e88)['from'](_0x4e4472)[_0xc88d('0x17')](_0xc88d('0x41'),null,'cm_contacts.ListId\x20=\x20'+_0x4e4472+_0xc88d('0x38'))['join'](_0x37c001,null,_0x37c001+_0xc88d('0x13')+_0x4e4472+'.'+_0x14df14)['join'](_0x26bf56,null,_0x26bf56+_0xc88d('0x13')+_0x4e4472+'.'+_0x14df14)['where'](_0x4e4472+'.CmListId\x20=\x20?',_0x119f0c)[_0xc88d('0x14')](_0xc88d('0x42'),NOW)['where'](_0xc88d('0x3a'),selectNotIn(_0x4e4472,_0x37c001,_0x14df14,_0xc88d('0x2e'),[_0xc88d('0x3b'),_0xc88d('0x3c')]))[_0xc88d('0x14')](_0xc88d('0x3a'),selectNotIn(_0x4e4472,_0x37c001,_0x14df14,'cm_hopper',[_0xc88d('0x3b')])))[_0xc88d('0x3d')]();return _0x2a8bc5;}function insertTzCmHopperBlack(_0x4326ac,_0x2f01c9,_0x19c2ff,_0x520488){var _0x2dcc48=[_0xc88d('0x26'),_0xc88d('0x27'),_0xc88d('0x28'),_0x2f01c9+'.'+_0x520488,'cm_contacts.createdAt',_0xc88d('0x2a')];return squel['insert']()['into'](_0xc88d('0x3e'))['fromQuery']([_0xc88d('0x12'),_0xc88d('0x30'),_0xc88d('0x31'),_0x520488,_0xc88d('0x32'),_0xc88d('0x33')],squel[_0xc88d('0x11')]()['fields'](_0x2dcc48)[_0xc88d('0x40')](_0x2f01c9)[_0xc88d('0x17')](_0xc88d('0x41'),null,_0xc88d('0x37')+_0x2f01c9+_0xc88d('0x38'))[_0xc88d('0x17')](_0x19c2ff,null,_0x19c2ff+_0xc88d('0x13')+_0x2f01c9+'.'+_0x520488)[_0xc88d('0x14')](_0x2f01c9+'.CmListId\x20=\x20?',_0x4326ac)[_0xc88d('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xc88d('0x3a'),squel['select']()['field'](_0xc88d('0x12'))[_0xc88d('0x40')](_0xc88d('0x3e'))[_0xc88d('0x14')]('ListId\x20=\x20?',_0x4326ac)[_0xc88d('0x14')](_0x520488+_0xc88d('0x15')+_0x2f01c9+'.'+_0x520488)))['toString']();}function insertCmHopperAdditionalPhones(_0xeb3a94){var _0xc31d8e=['cm_hopper.id',_0xc88d('0x47'),_0xc88d('0x48'),_0xc88d('0x49'),_0xc88d('0x4a')];return squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')]('cm_hopper_additional_phones')[_0xc88d('0x3f')]([_0xc88d('0x4b'),'phone',_0xc88d('0x4c'),_0xc88d('0x32'),'updatedAt'],squel[_0xc88d('0x11')]()[_0xc88d('0x36')](_0xc31d8e)[_0xc88d('0x40')](_0xc88d('0x2e'))[_0xc88d('0x17')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xc88d('0x17')](_0xc88d('0x4d'),null,_0xc88d('0x4e'))[_0xc88d('0x14')](_0xc88d('0x4f'),_0xeb3a94)['where']('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0x9ab3dd,_0x222bba,_0x207f7b,_0x32aee8){var _0x4c4e80=_[_0xc88d('0x50')](_[_0xc88d('0x51')](_0x32aee8),[_0xc88d('0x31'),'CompanyId',_0xc88d('0x32'),_0xc88d('0x33'),_0xc88d('0x52')]);return squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')](_0xc88d('0x41'))[_0xc88d('0x3f')](_0x4c4e80,squel[_0xc88d('0x11')]()[_0xc88d('0x36')](_0x4c4e80)[_0xc88d('0x40')](_0x222bba)['where']('('+_0x207f7b['join'](',')+_0xc88d('0x53'),squel['select']()[_0xc88d('0x36')](_0x207f7b)[_0xc88d('0x40')](_0xc88d('0x41'))['where'](_0xc88d('0x44'),_0x9ab3dd)[_0xc88d('0x14')](_0xc88d('0x54')))['where'](_0xc88d('0x55'),squel[_0xc88d('0x11')]()[_0xc88d('0x43')](_0xc88d('0x56'),'min_id')[_0xc88d('0x40')](_0x222bba)[_0xc88d('0x57')](_0x207f7b[_0xc88d('0x17')](','))))['toString']();}function handleStop(){logger[_0xc88d('0x58')](_0xc88d('0x59'));stopped=!![];}function handleUncaughtException(_0x4ea1bd){logger[_0xc88d('0x5a')](_0x4ea1bd[_0xc88d('0x5b')]);process[_0xc88d('0x5c')](0x1);}function handleError(_0x1bd5e3,_0x4e7f2b){stats['errors'][_0xc88d('0x1d')]({'name':_0x4e7f2b['code'],'message':_0x4e7f2b[_0xc88d('0x5b')],'row':_0x1bd5e3});}function handleQuery(_0x16f55b){logger[_0xc88d('0x58')](_0x16f55b);return db[_0xc88d('0x5d')]['query'](_0x16f55b)['spread'](function(_0x13d586){results[_0xc88d('0x1d')](_0x13d586);})[_0xc88d('0x5e')](function(_0xcf848d){logger[_0xc88d('0x5a')](_0xcf848d[_0xc88d('0x5b')]);});}function updateTzCampaigns(_0xb4a10a){return new Promise(function(_0x4ded19,_0x24ae6e){var _0x56cddd=squel[_0xc88d('0x11')]()[_0xc88d('0x36')]([_0xc88d('0x5f'),_0xc88d('0x60')])[_0xc88d('0x40')](_0xc88d('0x61'))['join'](_0xc88d('0x62'),null,_0xc88d('0x63'))['where'](_0xc88d('0x64')+_0xb4a10a);db[_0xc88d('0x5d')][_0xc88d('0x65')](_0x56cddd['toString']())['spread'](function(_0x1c7316){var _0x159779=[];for(var _0x1918ff=0x0;_0x1918ff<_0x1c7316[_0xc88d('0x1c')];_0x1918ff++){_0x159779[_0xc88d('0x1d')](getTimezoneData(_0x1c7316[_0x1918ff],tmp_campaigns));}BPromise[_0xc88d('0x66')](_0x159779)[_0xc88d('0x1b')](function(){_0x4ded19({'val':0x1});});})[_0xc88d('0x5e')](function(_0xe2e35e){logger[_0xc88d('0x5a')](_0xe2e35e['message']);_0x4ded19({'val':0x0});});});}function updateTzVoiceQueues(_0x3a913a){return new Promise(function(_0xe2660a,_0x3d0d5b){var _0x346ed1=squel[_0xc88d('0x11')]()[_0xc88d('0x36')](['voice_queues.id',_0xc88d('0x67')])[_0xc88d('0x40')](_0xc88d('0x68'))[_0xc88d('0x17')]('voice_queues_has_cm_lists',null,_0xc88d('0x69'))[_0xc88d('0x14')](_0xc88d('0x6a')+_0x3a913a);db[_0xc88d('0x5d')][_0xc88d('0x65')](_0x346ed1['toString']())['spread'](function(_0x9507c7){var _0xd28a0c=[];for(var _0x4c282c=0x0;_0x4c282c<_0x9507c7['length'];_0x4c282c++){_0xd28a0c[_0xc88d('0x1d')](getTimezoneData(_0x9507c7[_0x4c282c],tmp_voice_queues));}BPromise['all'](_0xd28a0c)[_0xc88d('0x1b')](function(){_0xe2660a({'val':0x1});});})[_0xc88d('0x5e')](function(_0x16a8b1){logger[_0xc88d('0x5a')](_0x16a8b1[_0xc88d('0x5b')]);_0xe2660a({'val':0x0});});});}function getTimezoneData(_0x32da29,_0x1d4fe9){return new Promise(function(_0x351258,_0xaa66d5){var _0x493a5c=shared[_0xc88d('0x6b')];var _0x5b5c21=_0x493a5c[_0x32da29[_0xc88d('0x6c')]];if(_[_0xc88d('0x1f')](_0x5b5c21)){_0x351258({'ret':0x1});}else{var _0x114c47=_0x5b5c21[_0xc88d('0x6d')];var _0x14cc88=squel[_0xc88d('0x2c')]()[_0xc88d('0x2d')](_0x1d4fe9)[_0xc88d('0x6e')]('id',_0x32da29['id'])[_0xc88d('0x6e')](_0xc88d('0x6f'),_0x114c47)[_0xc88d('0x6e')]('dialTimezone',_0x32da29[_0xc88d('0x6c')])['toString']();return db[_0xc88d('0x5d')]['query'](_0x14cc88)[_0xc88d('0x70')](function(_0x57836d){_0x351258({'ret':0x1});})[_0xc88d('0x5e')](function(_0x2bbb62){logger[_0xc88d('0x5a')](_0x2bbb62['message']);_0xaa66d5({'ret':0x1});});}});}function handleTZQuery(_0x359aaf){logger[_0xc88d('0x58')](_0x359aaf);return db[_0xc88d('0x5d')][_0xc88d('0x65')](_0x359aaf)[_0xc88d('0x70')](function(_0x27723c){})[_0xc88d('0x5e')](function(_0x1bb49e){logger[_0xc88d('0x5a')](_0x1bb49e[_0xc88d('0x5b')]);});}function main(_0x3f4bc2,_0xf8f2fd,_0x55ada0,_0x3dae3d){logger[_0xc88d('0x58')](_0xc88d('0x71'),_0x3f4bc2,JSON[_0xc88d('0x72')](_0xf8f2fd));process[_0xc88d('0x73')](_0xc88d('0x74'));var _0x4e86ac=_0xf8f2fd[_0xc88d('0x75')];var _0x6bc1b8=_[_0xc88d('0x76')](_0x4e86ac);var _0x2176c5=_0xf8f2fd[_0xc88d('0x77')];var _0x5c6130=path[_0xc88d('0x17')](config[_0xc88d('0x78')],_0xc88d('0x79'),_0x2176c5+_0xc88d('0x7a'));hasTZ=_[_0xc88d('0x51')](_0x4e86ac)[_0xc88d('0x7b')]('dialTimezone');var _0x2935fb=_[_0xc88d('0x51')](_0x4e86ac)[_0xc88d('0x17')]();logger[_0xc88d('0x58')](_0xc88d('0x7c'),_0x2935fb);db[_0xc88d('0x7d')][_0xc88d('0x19')]({'raw':!![],'attributes':['id',_0xc88d('0x7e')]})[_0xc88d('0x1b')](function(_0x5bc930){for(var _0x206893=0x0;_0x206893<_0x5bc930[_0xc88d('0x1c')];_0x206893++){if(_0x5bc930[_0x206893][_0xc88d('0x7e')]in _0x4e86ac){contactItemTypes[_0xc88d('0x1d')](_0x5bc930[_0x206893]);delete _0x6bc1b8[_0x5bc930[_0x206893][_0xc88d('0x7e')]];hasAdditionalPhones=!![];}for(var _0x2b2e5f in _0x4e86ac){if(_0x5bc930[_0x206893][_0xc88d('0x7e')]+'_description'===_0x2b2e5f){phoneDescriptions['push']({'itemTypeId':_0x5bc930[_0x206893]['id'],'description':_0x2b2e5f});delete _0x6bc1b8[_0x2b2e5f];}}}if(hasAdditionalPhones)_0x6bc1b8[_0xc88d('0x1a')]='';var _0x4b8e2e=_[_0xc88d('0x51')](_0x6bc1b8)[_0xc88d('0x17')]();logger['info'](_0xc88d('0x7c'),_0x4b8e2e);fs[_0xc88d('0x7f')](_0x5c6130,_0x4b8e2e+'\x0a');Papa[_0xc88d('0x80')](fs[_0xc88d('0x81')](_0x3f4bc2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x232ca2,_0x1a59dd){try{for(var _0x3753bf=0x0,_0x2ff16c=[];_0x3753bf<_0x232ca2[_0xc88d('0x82')][_0xc88d('0x1c')];_0x3753bf++){stats[_0xc88d('0x83')]+=0x1;if(_0x232ca2['errors'][_0x3753bf]){handleError(_0x232ca2[_0xc88d('0x82')][_0x3753bf],_0x232ca2['errors'][_0x3753bf]);}else{var _0x151d94=[];var _0x16b115=[];var _0x528892={};for(var _0x15aea8 in _0x4e86ac){let _0x49a66b=contactItemTypes['find'](_0x386529=>_0x386529[_0xc88d('0x7e')]===_0x15aea8);let _0x789221=contactItemTypes[_0xc88d('0x84')](_0x40cf01=>_0x40cf01[_0xc88d('0x7e')]+_0xc88d('0x85')===_0x15aea8);if(_[_0xc88d('0x1f')](_0x49a66b)&&_[_0xc88d('0x1f')](_0x789221)){if(_0x4e86ac['hasOwnProperty'](_0x15aea8)){if(_0x232ca2[_0xc88d('0x82')][_0x3753bf][_0x4e86ac[_0x15aea8]]){var _0x420010=_[_0xc88d('0x86')](_0x232ca2['data'][_0x3753bf][_0x4e86ac[_0x15aea8]][_0xc88d('0x87')](/"/g,'\x27'));switch(_0x15aea8){case _0xc88d('0x2f'):var _0xc68636=moment(_0x420010,_0xc88d('0x10'),!![]);if(_0xc68636[_0xc88d('0x88')]()){_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x420010+'\x22');}else{_0x151d94[_0xc88d('0x1d')](_0xc88d('0x89'));}break;case _0xc88d('0x8a'):var _0x335e7e=parseInt(_0x420010);_0x420010=_['isNaN'](_0x335e7e)||_0x335e7e<0x0||_0x335e7e>0x4?_0x3dae3d?0x3:0x2:_0x335e7e;_0x2ff16c['push']('\x22'+_0x420010+'\x22');break;case'UserId':var _0x2cb0f6=parseInt(_0x420010);if(_['isNumber'](_0x2cb0f6)&&_[_0xc88d('0x7b')](_0x55ada0,_0x2cb0f6)){_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x2cb0f6+'\x22');}else{_0x151d94[_0xc88d('0x1d')](_0xc88d('0x8b'));}break;case'email':if(isEmail(_0x420010)){_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x420010+'\x22');}else{_0x151d94['push']('email\x20wrong\x20format');}break;case _0xc88d('0x8c'):var _0xec4b0f=moment(_0x420010,'YYYY-MM-DD',!![]);if(_0xec4b0f[_0xc88d('0x88')]()){_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x420010+'\x22');}else{_0x151d94['push'](_0xc88d('0x8d'));}break;case'dialTimezone':var _0x2a4bba=shared[_0xc88d('0x6b')];var _0x52121e=_0x2a4bba[_0x420010];if(!_[_0xc88d('0x1f')](_0x52121e)){var _0x51f251=_0x52121e['utcOffset'];_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x420010+'\x22');_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x51f251+'\x22');}break;default:_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x420010+'\x22');}}else{switch(_0x15aea8){case _0xc88d('0x8e'):case _0xc88d('0x12'):_0x151d94['push'](_0x15aea8+_0xc88d('0x8f'));break;default:_0x2ff16c[_0xc88d('0x1d')]('\x22\x22');}}}}else{var _0x2eceeb='';if(!_['isNil'](_0x49a66b)){if(!_0x528892['hasOwnProperty'](_0x49a66b['id'])){if(!_[_0xc88d('0x1f')](_0x232ca2[_0xc88d('0x82')][_0x3753bf][_0x4e86ac[_0x15aea8]])){var _0x420010=_[_0xc88d('0x86')](_0x232ca2[_0xc88d('0x82')][_0x3753bf][_0x4e86ac[_0x15aea8]][_0xc88d('0x87')](/"/g,'\x27'));var _0xa10f80=phoneDescriptions[_0xc88d('0x84')](_0x2f271a=>_0x2f271a[_0xc88d('0x90')]===_0x49a66b['id']);if(!_[_0xc88d('0x1f')](_0xa10f80)){var _0xf69063=_[_0xc88d('0x86')](_0x232ca2['data'][_0x3753bf][_0x4e86ac[_0xa10f80[_0xc88d('0x91')]]][_0xc88d('0x87')](/"/g,'\x27'));if(!_[_0xc88d('0x1f')](_0xf69063))_0x420010=_0x420010+'§'+_0xf69063;}if(_0x2eceeb=='')_0x2eceeb=_0x420010;else _0x2eceeb+='|'+_0x420010;}_0x16b115[_0xc88d('0x1d')](_0x49a66b['id']+':'+_0x2eceeb);_0x528892[_0x49a66b['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2ff16c[_0xc88d('0x1d')]('\x22'+_0x16b115['join'](';')+'\x22');}if(_0x151d94[_0xc88d('0x1c')]){handleError(_0x232ca2[_0xc88d('0x82')][_0x3753bf],{'code':_0xc88d('0x92'),'message':_0x151d94[_0xc88d('0x17')]()});}else{fs['appendFileSync'](_0x5c6130,_0x2ff16c[_0xc88d('0x17')]()+'\x0a');}_0x2ff16c=[];}if(!(stats[_0xc88d('0x83')]%0xc8)){socket[_0xc88d('0x93')](_0xc88d('0x94')+_0x2176c5,stats);stats[_0xc88d('0x95')]=[];}}if(stopped){logger[_0xc88d('0x58')](_0xc88d('0x96'));_0x1a59dd[_0xc88d('0x97')]();}}catch(_0x4881c6){handleError(_0x232ca2[_0xc88d('0x82')][_0x3753bf],{'code':_0xc88d('0x98'),'message':_0x4881c6[_0xc88d('0x5b')]});logger[_0xc88d('0x5a')]('step',_0x4881c6[_0xc88d('0x5b')]);}},'complete':function(){try{var _0x4178c0=[];var _0x2fe037=[];var _0x1037f5='cm_contacts';if(_0xf8f2fd[_0xc88d('0x99')]&&_0xf8f2fd[_0xc88d('0x99')][_0xc88d('0x1c')]){_0x1037f5='cm_contacts_'+_0x2176c5;_0x4178c0[_0xc88d('0x1d')]('CREATE\x20TABLE\x20'+_0x1037f5+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xc88d('0x9a')+_0x2176c5;tmp_voice_queues='voice_queues_'+_0x2176c5;_0x2fe037['push'](_0xc88d('0x9b')+tmp_campaigns+_0xc88d('0x9c'));_0x2fe037[_0xc88d('0x1d')](_0xc88d('0x9b')+tmp_voice_queues+_0xc88d('0x9c'));BPromise[_0xc88d('0x9d')](_0x2fe037,handleTZQuery)[_0xc88d('0x1b')](function(_0x478777){updateTzCampaigns(_0xf8f2fd[_0xc88d('0x31')])[_0xc88d('0x1b')](function(_0xf0b07d){updateTzVoiceQueues(_0xf8f2fd[_0xc88d('0x31')])[_0xc88d('0x1b')](function(_0x56d057){if(hasTZ)_0x4b8e2e=_0x4b8e2e[_0xc88d('0x87')](_0xc88d('0x6c'),_0xc88d('0x9e'));var _0x516ab0=util[_0xc88d('0xf')](_0xc88d('0x9f'),_0x5c6130,_0x1037f5,_0x4b8e2e,_0xf8f2fd['ListId'],_0xf8f2fd[_0xc88d('0xa0')]||null,NOW,NOW);if(_[_0xc88d('0x1f')](_0x4e86ac[_0xc88d('0x2f')])){_0x516ab0+=_0xc88d('0xa1');}_0x4178c0[_0xc88d('0x1d')](_0x516ab0);if(_0xf8f2fd[_0xc88d('0x99')]&&_0xf8f2fd[_0xc88d('0x99')][_0xc88d('0x1c')]){_0x4178c0[_0xc88d('0x1d')](insertCmContact(_0xf8f2fd[_0xc88d('0x31')],_0x1037f5,_0xf8f2fd[_0xc88d('0x99')],_0x4e86ac));_0x4178c0[_0xc88d('0x1d')](_0xc88d('0xa2')+_0x1037f5+';');}BPromise[_0xc88d('0x9d')](_0x4178c0,handleQuery)[_0xc88d('0x1b')](function(_0x341888){BPromise[_0xc88d('0x66')]([handleAdditionalPhones()])[_0xc88d('0x1b')](function(){_0x4178c0=[];for(var _0x4d6ca9=0x0;_0x4d6ca9\x20\x20');}var _0x405ed6=path[_0xc88d('0x17')](config[_0xc88d('0x78')],_0xc88d('0x79'),process['argv'][0x2]);if(!fs[_0xc88d('0xaf')](_0x405ed6)){throw new Error(_0xc88d('0xb0'));}var _0x30e32b={};try{_0x30e32b=JSON[_0xc88d('0x80')](process['argv'][0x3]);if(!_0x30e32b[_0xc88d('0x75')]){throw new Error(_0xc88d('0xb1'));}if(!_0x30e32b[_0xc88d('0x75')][_0xc88d('0x12')]){throw new Error(_0xc88d('0xb2'));}if(!_0x30e32b[_0xc88d('0x75')][_0xc88d('0x8e')]){throw new Error('firstName\x20is\x20mandatory');}var _0x4c0e49=0x0;if(_0x30e32b[_0xc88d('0x75')][_0xc88d('0x34')]){_0x4c0e49=0x1;}if(!_0x30e32b['ListId']){throw new Error(_0xc88d('0xb3'));}}catch(_0x49a260){throw new Error(_0xc88d('0xb4'));}var _0x364e44=[];try{_0x364e44=_['map'](JSON['parse'](process['argv'][0x4]),'id');}catch(_0x3caea0){logger[_0xc88d('0x58')](_0xc88d('0xb5'));}main(_0x405ed6,_0x30e32b,_0x364e44,_0x4c0e49);}validate();process['on']('SIGINT',handleStop);process['on'](_0xc88d('0xb6'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 323b90c..9936475 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0bb4=['updated','PHONE','inserted','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','insert','cm_hopper','fromQuery','scheduledat','updatedAt','priority','recallme','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','into','cm_hopper_black','ContactId','ListId','createdAt','.CmListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_hopper_additional_phones','CmHopperId','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','CompanyId',')\x20NOT\x20IN\x20?','ListId\x20=\x20?','id\x20IN\x20?','min_id','group','info','Received\x20SIGINT','exit','main','stringify','send','start','binding','clone','socket_timestamp','root','.csv','ContactItemType','findAll','name','_description','writeFileSync','parse','data','errors','find','hasOwnProperty','trim','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','appendFileSync','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contactId','contactTypeId','finish','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','../../../mysqldb','../../../config/logger','redis','defaults','localhost','socket.io-emitter','format','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','catch','error','message','split','filter','CmContactHasItem','update'];(function(_0x5f1e07,_0x59acfe){var _0x549c2f=function(_0x385d6f){while(--_0x385d6f){_0x5f1e07['push'](_0x5f1e07['shift']());}};_0x549c2f(++_0x59acfe);}(_0x0bb4,0x77));var _0x40bb=function(_0x40a1c7,_0xb174b8){_0x40a1c7=_0x40a1c7-0x0;var _0x51b5ce=_0x0bb4[_0x40a1c7];return _0x51b5ce;};'use strict';var fs=require('fs');var path=require(_0x40bb('0x0'));var _=require(_0x40bb('0x1'));var Papa=require('papaparse');var util=require(_0x40bb('0x2'));var BPromise=require(_0x40bb('0x3'));var moment=require(_0x40bb('0x4'));var squel=require(_0x40bb('0x5'));var Redis=require('ioredis');var db=require(_0x40bb('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x40bb('0x7'))('import');config[_0x40bb('0x8')]=_[_0x40bb('0x9')](config['redis'],{'host':_0x40bb('0xa'),'port':0x18eb});var socket=require(_0x40bb('0xb'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x40bb('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x40bb('0xd')+moment()[_0x40bb('0xc')](_0x40bb('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x35095d){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))*$/[_0x40bb('0xf')](_0x35095d);}function selectNotIn(_0x3ee596,_0x3a86c3,_0x1ad45c,_0x46e534,_0x388c95){return squel[_0x40bb('0x10')]()[_0x40bb('0x11')](_0x40bb('0x12'))[_0x40bb('0x13')](_0x46e534)[_0x40bb('0x14')](_0x3a86c3,null,_0x3a86c3+_0x40bb('0x15')+_0x46e534+'.'+_0x1ad45c)[_0x40bb('0x16')](_0x46e534+'.'+_0x1ad45c+'\x20=\x20'+_0x3ee596+'.'+_0x1ad45c)['where'](_0x3a86c3+_0x40bb('0x17')+_0x388c95[_0x40bb('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x32e886,_0x27f68d){promisesAdditionalPhones=[];promisesContact=[];return db[_0x40bb('0x18')][_0x40bb('0x19')](_0x40bb('0x1a')+tempTableName)[_0x40bb('0x1b')](function(_0x4a177c){if(_0x4a177c!==null){var _0x3b28a2=[];for(var _0x3edc83=0x0;_0x3edc83<_0x4a177c[_0x40bb('0x1c')];_0x3edc83++){var _0x2072b7=_0x4a177c[_0x3edc83];if(!_[_0x40bb('0x1d')](_0x2072b7['phone'])){if(!_[_0x40bb('0x1d')](_0x2072b7[_0x40bb('0x1e')]))_0x3b28a2[_0x40bb('0x1f')](insertAdditionalPhones(_0x2072b7));promisesContact[_0x40bb('0x1f')]({'contact':_0x2072b7});}}}Promise[_0x40bb('0x20')](_0x3b28a2)[_0x40bb('0x21')](function(){_0x32e886({'val':0x1});});})[_0x40bb('0x22')](function(_0x5acab8){logger[_0x40bb('0x23')](_0x5acab8[_0x40bb('0x24')]);});});}function insertAdditionalPhones(_0x27586c){return new Promise(function(_0x229619,_0x289338){var _0x2ee7df=_0x27586c[_0x40bb('0x1e')];if(_[_0x40bb('0x1d')](_0x2ee7df))_0x289338({'val':0x0});else{var _0x1e12c4=_0x2ee7df[_0x40bb('0x25')](';');var _0x4699a3=[];orderBy=0x0;for(var _0x2c372d=0x0;_0x2c372d<_0x1e12c4['length'];_0x2c372d++){_0x4699a3[_0x40bb('0x1f')](splitAdditionalPhone(_0x27586c['id'],_0x1e12c4[_0x2c372d]));}Promise[_0x40bb('0x20')](_0x4699a3)[_0x40bb('0x21')](function(){_0x229619({'val':_0x1e12c4[_0x40bb('0x1c')]});});}});}function splitAdditionalPhone(_0x1c8cd2,_0x3afda5){return new Promise(function(_0x3ab03b,_0x2a0278){var _0x37e51f=_0x3afda5[_0x40bb('0x25')](':');var _0x8ee5e5=_0x37e51f[0x0];var _0x558cd6=_0x37e51f[0x1];if(_0x558cd6!==''){var _0x4c443c=_0x558cd6[_0x40bb('0x25')]('|');var _0x1a16c1=[];for(var _0x8592b6=0x0;_0x8592b6<_0x4c443c['length'];_0x8592b6++){if(_0x4c443c[_0x8592b6]!==''){var _0xc1b76f=_[_0x40bb('0x26')](promisesAdditionalPhones,{'contactId':_0x1c8cd2,'phone':_0x4c443c[_0x8592b6]});if(_0xc1b76f[_0x40bb('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x40bb('0x1f')]({'contactId':_0x1c8cd2,'contactTypeId':_0x8ee5e5,'phone':_0x4c443c[_0x8592b6],'orderBy':orderBy});}}}_0x3ab03b({'ok':0x1});}else _0x3ab03b({'res':0x0});});}function createAdditionalPhone(_0x28cd48,_0x1e8ac0,_0x1b0ad6,_0x39766a){var _0x418834='';var _0x510ea9='';var _0x293c54=_0x1b0ad6[_0x40bb('0x25')]('§');_0x418834=_0x293c54[0x0];if(_0x293c54['length']==0x2)_0x510ea9=_0x293c54[0x1];return new Promise(function(_0x8bf716,_0x5884ed){return db[_0x40bb('0x27')]['findOne']({'where':{'CmContactId':_0x28cd48,'item':_0x418834}})['then'](function(_0x4538e5){if(_0x4538e5){return db[_0x40bb('0x27')][_0x40bb('0x28')]({'ItemTypeId':_0x1e8ac0,'description':_0x510ea9,'OrderBy':_0x39766a},{'where':{'CmContactId':_0x28cd48,'item':_0x418834}})['then'](function(_0x1ce1fe){_0x8bf716({'res':_0x40bb('0x29')});});}else{return db[_0x40bb('0x27')]['create']({'CmContactId':_0x28cd48,'item':_0x418834,'ItemTypeId':_0x1e8ac0,'description':_0x510ea9,'OrderBy':_0x39766a,'ItemClass':_0x40bb('0x2a')})[_0x40bb('0x21')](function(_0x2ec0c3){_0x8bf716({'res':_0x40bb('0x2b')});});}});});}function updateContact(_0xd31b22){return new Promise(function(_0x3eca00,_0x3bc259){var _0x57f58b=_0xd31b22['id'];delete _0xd31b22['id'];return db['CmContact'][_0x40bb('0x28')](_0xd31b22,{'where':{'id':_0x57f58b}})['then'](function(_0x423dba){updatedRows+=0x1;return db[_0x40bb('0x2c')][_0x40bb('0x28')]({'phone':_0xd31b22['phone']},{'where':{'ContactId':_0x57f58b}})[_0x40bb('0x21')](function(_0x509817){_0x3eca00({'ret':'OK'});});});});}function insertCmHopper(_0x2a59bb,_0x200d33,_0x529e28,_0x441f59,_0x494935){var _0x491dce=[_0x40bb('0x2d'),_0x40bb('0x2e'),_0x40bb('0x2f'),'cm_contacts.ListId',_0x200d33+'.'+_0x441f59,_0x40bb('0x30'),_0x40bb('0x31'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x494935+'\x22'];return squel[_0x40bb('0x32')]()['into'](_0x40bb('0x33'))[_0x40bb('0x34')]([_0x40bb('0x12'),_0x40bb('0x35'),'ContactId','ListId',_0x441f59,'createdAt',_0x40bb('0x36'),_0x40bb('0x37'),'UserId',_0x40bb('0x38')],squel[_0x40bb('0x10')]()[_0x40bb('0x39')](_0x491dce)[_0x40bb('0x13')](_0x200d33)['join'](_0x40bb('0x3a'),null,_0x40bb('0x3b')+_0x200d33+_0x40bb('0x3c'))[_0x40bb('0x14')](_0x529e28,null,_0x529e28+_0x40bb('0x15')+_0x200d33+'.'+_0x441f59)['where'](_0x200d33+'.CmListId\x20=\x20?',_0x2a59bb)['where'](_0x40bb('0x3d'),NOW)[_0x40bb('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x200d33,_0x529e28,_0x441f59,'cm_hopper',[_0x40bb('0x3e'),_0x40bb('0x3f')]))[_0x40bb('0x16')](_0x40bb('0x40'),selectNotIn(_0x200d33,_0x529e28,_0x441f59,_0x40bb('0x33'),[_0x40bb('0x3e')])))['toString']();}function insertCmHopperBlack(_0x471faf,_0x1cbf76,_0x4cfac1,_0x571d87){var _0x571a98=['cm_contacts.phone',_0x40bb('0x2f'),_0x40bb('0x41'),_0x1cbf76+'.'+_0x571d87,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x40bb('0x32')]()[_0x40bb('0x42')](_0x40bb('0x43'))['fromQuery'](['phone',_0x40bb('0x44'),_0x40bb('0x45'),_0x571d87,_0x40bb('0x46'),'updatedAt'],squel[_0x40bb('0x10')]()[_0x40bb('0x39')](_0x571a98)[_0x40bb('0x13')](_0x1cbf76)[_0x40bb('0x14')]('cm_contacts',null,_0x40bb('0x3b')+_0x1cbf76+_0x40bb('0x3c'))[_0x40bb('0x14')](_0x4cfac1,null,_0x4cfac1+_0x40bb('0x15')+_0x1cbf76+'.'+_0x571d87)['where'](_0x1cbf76+_0x40bb('0x47'),_0x471faf)[_0x40bb('0x16')](_0x40bb('0x3d'),NOW)['where'](_0x40bb('0x40'),squel[_0x40bb('0x10')]()[_0x40bb('0x11')](_0x40bb('0x12'))[_0x40bb('0x13')](_0x40bb('0x43'))['where']('ListId\x20=\x20?',_0x471faf)[_0x40bb('0x16')](_0x571d87+_0x40bb('0x48'),_0x1cbf76+'.'+_0x571d87)))[_0x40bb('0x49')]();}function insertCmHopperAdditionalPhones(_0x577c05){var _0x21c211=[_0x40bb('0x4a'),_0x40bb('0x4b'),_0x40bb('0x4c'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel['insert']()['into'](_0x40bb('0x4d'))[_0x40bb('0x34')]([_0x40bb('0x4e'),'phone','OrderBy',_0x40bb('0x46'),_0x40bb('0x36')],squel[_0x40bb('0x10')]()[_0x40bb('0x39')](_0x21c211)[_0x40bb('0x13')](_0x40bb('0x33'))['join'](_0x40bb('0x3a'),null,_0x40bb('0x4f'))['join'](_0x40bb('0x50'),null,_0x40bb('0x51'))[_0x40bb('0x16')](_0x40bb('0x52'),_0x577c05)[_0x40bb('0x16')](_0x40bb('0x3d'),NOW))['toString']();}function insertCmContact(_0x42e8f7,_0x12bb06,_0x317890,_0x422c87){var _0x4bb91b=_[_0x40bb('0x53')](_[_0x40bb('0x54')](_0x422c87),[_0x40bb('0x45'),_0x40bb('0x55'),'createdAt','updatedAt']);return squel[_0x40bb('0x32')]()[_0x40bb('0x42')](_0x40bb('0x3a'))[_0x40bb('0x34')](_0x4bb91b,squel[_0x40bb('0x10')]()[_0x40bb('0x39')](_0x4bb91b)['from'](_0x12bb06)[_0x40bb('0x16')]('('+_0x317890[_0x40bb('0x14')](',')+_0x40bb('0x56'),squel[_0x40bb('0x10')]()[_0x40bb('0x39')](_0x317890)[_0x40bb('0x13')]('cm_contacts')[_0x40bb('0x16')](_0x40bb('0x57'),_0x42e8f7))[_0x40bb('0x16')](_0x40bb('0x58'),squel[_0x40bb('0x10')]()[_0x40bb('0x11')]('MIN(id)',_0x40bb('0x59'))['from'](_0x12bb06)[_0x40bb('0x5a')](_0x317890[_0x40bb('0x14')](','))))[_0x40bb('0x49')]();}function handleStop(){logger[_0x40bb('0x5b')](_0x40bb('0x5c'));stopped=!![];}function handleUncaughtException(_0x52a2cc){logger[_0x40bb('0x23')](_0x52a2cc[_0x40bb('0x24')]);process[_0x40bb('0x5d')](0x1);}function handleError(_0x7a581,_0x13ede5){stats['errors'][_0x40bb('0x1f')]({'name':_0x13ede5['code'],'message':_0x13ede5['message'],'row':_0x7a581});}function handleQuery(_0x413fe8){logger[_0x40bb('0x5b')](_0x413fe8);return db[_0x40bb('0x18')][_0x40bb('0x19')](_0x413fe8)[_0x40bb('0x1b')](function(_0x4617a9){results['push'](_0x4617a9);})['catch'](function(_0x183127){logger[_0x40bb('0x23')](_0x183127[_0x40bb('0x24')]);});}function main(_0x3eef2d,_0x208de3,_0x490d33,_0x351788){logger[_0x40bb('0x5b')](_0x40bb('0x5e'),_0x3eef2d,JSON[_0x40bb('0x5f')](_0x208de3));process[_0x40bb('0x60')](_0x40bb('0x61'));var _0x539edb=_0x208de3[_0x40bb('0x62')];var _0x248821=_[_0x40bb('0x63')](_0x539edb);var _0x1bceb3=_0x208de3[_0x40bb('0x64')];var _0x5bbb8a=path['join'](config[_0x40bb('0x65')],'server/files/tmp',_0x1bceb3+_0x40bb('0x66'));logger[_0x40bb('0x5b')]('body',_0x208de3);db[_0x40bb('0x67')][_0x40bb('0x68')]({'raw':!![],'attributes':['id',_0x40bb('0x69')]})[_0x40bb('0x21')](function(_0x5bbafd){for(var _0x23a755=0x0;_0x23a755<_0x5bbafd[_0x40bb('0x1c')];_0x23a755++){if(_0x5bbafd[_0x23a755][_0x40bb('0x69')]in _0x539edb){contactItemTypes[_0x40bb('0x1f')](_0x5bbafd[_0x23a755]);delete _0x248821[_0x5bbafd[_0x23a755]['name']];hasAdditionalPhones=!![];}for(var _0xb6a620 in _0x539edb){if(_0x5bbafd[_0x23a755][_0x40bb('0x69')]+_0x40bb('0x6a')===_0xb6a620){phoneDescriptions[_0x40bb('0x1f')]({'itemTypeId':_0x5bbafd[_0x23a755]['id'],'description':_0xb6a620});delete _0x248821[_0xb6a620];}}}if(hasAdditionalPhones)_0x248821['AdditionalPhones']='';var _0x34ca86=_[_0x40bb('0x54')](_0x248821)['join']();logger[_0x40bb('0x5b')]('header',_0x34ca86);fs[_0x40bb('0x6b')](_0x5bbb8a,_0x34ca86+'\x0a');Papa[_0x40bb('0x6c')](fs['createReadStream'](_0x3eef2d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x37a359,_0x2e10b1){try{for(var _0x57fcc0=0x0,_0x245d92=[];_0x57fcc0<_0x37a359[_0x40bb('0x6d')][_0x40bb('0x1c')];_0x57fcc0++){stats['rows']+=0x1;if(_0x37a359[_0x40bb('0x6e')][_0x57fcc0]){handleError(_0x37a359[_0x40bb('0x6d')][_0x57fcc0],_0x37a359[_0x40bb('0x6e')][_0x57fcc0]);}else{var _0x512553=[];var _0x41919c=[];var _0xa2e0e5={};for(var _0x2e29fd in _0x539edb){let _0x20173c=contactItemTypes['find'](_0x2eb7cc=>_0x2eb7cc[_0x40bb('0x69')]===_0x2e29fd);let _0x4e763a=contactItemTypes[_0x40bb('0x6f')](_0x5423dd=>_0x5423dd[_0x40bb('0x69')]+'_description'===_0x2e29fd);if(_[_0x40bb('0x1d')](_0x20173c)&&_['isNil'](_0x4e763a)){if(_0x539edb[_0x40bb('0x70')](_0x2e29fd)){if(_0x37a359[_0x40bb('0x6d')][_0x57fcc0][_0x539edb[_0x2e29fd]]){var _0x159725=_[_0x40bb('0x71')](_0x37a359[_0x40bb('0x6d')][_0x57fcc0][_0x539edb[_0x2e29fd]]['replace'](/"/g,'\x27'));switch(_0x2e29fd){case _0x40bb('0x35'):var _0x4287be=moment(_0x159725,_0x40bb('0x72'),!![]);if(_0x4287be[_0x40bb('0x73')]()){_0x245d92[_0x40bb('0x1f')]('\x22'+_0x159725+'\x22');}else{_0x512553[_0x40bb('0x1f')](_0x40bb('0x74'));}break;case _0x40bb('0x37'):var _0x22329e=parseInt(_0x159725);_0x159725=_[_0x40bb('0x75')](_0x22329e)||_0x22329e<0x0||_0x22329e>0x4?_0x351788?0x3:0x2:_0x22329e;_0x245d92['push']('\x22'+_0x159725+'\x22');break;case _0x40bb('0x76'):var _0x5c79a4=parseInt(_0x159725);if(_[_0x40bb('0x77')](_0x5c79a4)&&_[_0x40bb('0x78')](_0x490d33,_0x5c79a4)){_0x245d92[_0x40bb('0x1f')]('\x22'+_0x5c79a4+'\x22');}else{_0x512553[_0x40bb('0x1f')](_0x40bb('0x79'));}break;case _0x40bb('0x7a'):if(isEmail(_0x159725)){_0x245d92[_0x40bb('0x1f')]('\x22'+_0x159725+'\x22');}else{_0x512553[_0x40bb('0x1f')](_0x40bb('0x7b'));}break;case _0x40bb('0x7c'):var _0xd66131=moment(_0x159725,_0x40bb('0x7d'),!![]);if(_0xd66131[_0x40bb('0x73')]()){_0x245d92[_0x40bb('0x1f')]('\x22'+_0x159725+'\x22');}else{_0x512553[_0x40bb('0x1f')](_0x40bb('0x7e'));}break;default:_0x245d92[_0x40bb('0x1f')]('\x22'+_0x159725+'\x22');}}else{switch(_0x2e29fd){case _0x40bb('0x7f'):case _0x40bb('0x12'):_0x512553[_0x40bb('0x1f')](_0x2e29fd+_0x40bb('0x80'));break;default:_0x245d92[_0x40bb('0x1f')]('\x22\x22');}}}}else{var _0x233cc3='';if(!_[_0x40bb('0x1d')](_0x20173c)){if(!_0xa2e0e5['hasOwnProperty'](_0x20173c['id'])){for(var _0x3f3310=0x0;_0x3f3310<_0x539edb[_0x2e29fd][_0x40bb('0x1c')];_0x3f3310++){var _0x159725=_[_0x40bb('0x71')](_0x37a359['data'][_0x57fcc0][_0x539edb[_0x2e29fd][_0x3f3310]][_0x40bb('0x81')](/"/g,'\x27'));var _0x2c963e=phoneDescriptions[_0x40bb('0x6f')](_0x14bf6e=>_0x14bf6e[_0x40bb('0x82')]===_0x20173c['id']);if(!_[_0x40bb('0x1d')](_0x2c963e)){var _0x3b150d=_[_0x40bb('0x71')](_0x37a359[_0x40bb('0x6d')][_0x57fcc0][_0x539edb[_0x2c963e[_0x40bb('0x83')]][0x0]][_0x40bb('0x81')](/"/g,'\x27'));if(!_[_0x40bb('0x1d')](_0x3b150d))_0x159725=_0x159725+'§'+_0x3b150d;}if(_0x233cc3=='')_0x233cc3=_0x159725;else _0x233cc3+='|'+_0x159725;}_0x41919c['push'](_0x20173c['id']+':'+_0x233cc3);_0xa2e0e5[_0x20173c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x245d92[_0x40bb('0x1f')]('\x22'+_0x41919c['join'](';')+'\x22');}if(_0x512553['length']){handleError(_0x37a359[_0x40bb('0x6d')][_0x57fcc0],{'code':'SystemRow','message':_0x512553[_0x40bb('0x14')]()});}else{fs[_0x40bb('0x84')](_0x5bbb8a,_0x245d92[_0x40bb('0x14')]()+'\x0a');}_0x245d92=[];}if(!(stats[_0x40bb('0x85')]%0xc8)){socket[_0x40bb('0x86')](_0x40bb('0x87')+_0x1bceb3,stats);stats[_0x40bb('0x6e')]=[];}}if(stopped){logger[_0x40bb('0x5b')](_0x40bb('0x88'));_0x2e10b1[_0x40bb('0x89')]();}}catch(_0x13ceab){handleError(_0x37a359[_0x40bb('0x6d')][_0x57fcc0],{'code':_0x40bb('0x8a'),'message':_0x13ceab[_0x40bb('0x24')]});logger[_0x40bb('0x23')](_0x40bb('0x8b'),_0x13ceab[_0x40bb('0x24')]);}},'complete':function(){try{var _0x4a45bd=[];var _0x46aab1=tempTableName;_0x4a45bd[_0x40bb('0x1f')](_0x40bb('0x8c')+_0x46aab1+'\x20LIKE\x20cm_contacts;');logger[_0x40bb('0x5b')](_0x40bb('0x8d'),contactItemTypes[_0x40bb('0x1c')]);var _0x1e5fd0=util[_0x40bb('0xc')](_0x40bb('0x8e'),_0x5bbb8a,_0x46aab1,_0x34ca86,_0x208de3[_0x40bb('0x45')],_0x208de3[_0x40bb('0x55')]||null,NOW,NOW);if(_[_0x40bb('0x1d')](_0x539edb[_0x40bb('0x35')])){_0x1e5fd0+=_0x40bb('0x8f');}_0x4a45bd[_0x40bb('0x1f')](_0x1e5fd0);BPromise[_0x40bb('0x90')](_0x4a45bd,handleQuery)[_0x40bb('0x21')](function(_0x454660){BPromise[_0x40bb('0x20')]([handleAdditionalPhones()])['then'](function(){_0x4a45bd=[];for(var _0x5e5fca=0x0;_0x5e5fca\x20\x20');}var _0x7542a9=path[_0x40bb('0x14')](config[_0x40bb('0x65')],_0x40bb('0x98'),process['argv'][0x2]);if(!fs[_0x40bb('0x99')](_0x7542a9)){throw new Error(_0x40bb('0x9a'));}var _0x14449f={};try{_0x14449f=JSON[_0x40bb('0x6c')](process[_0x40bb('0x97')][0x3]);if(!_0x14449f[_0x40bb('0x62')]){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x446137=0x0;if(_0x14449f[_0x40bb('0x62')][_0x40bb('0x76')]){_0x446137=0x1;}if(!_0x14449f[_0x40bb('0x45')]){throw new Error(_0x40bb('0x9b'));}}catch(_0x5bde17){throw new Error(_0x40bb('0x9c'));}var _0x2b8265=[];try{_0x2b8265=_[_0x40bb('0x9d')](JSON[_0x40bb('0x6c')](process['argv'][0x4]),'id');}catch(_0x8b7d0f){logger[_0x40bb('0x5b')](_0x40bb('0x9e'));}main(_0x7542a9,_0x14449f,_0x2b8265,_0x446137);}validate();process['on'](_0x40bb('0x9f'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x6002=['cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','fromQuery','field','cm_hopper_black','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','createdAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','message','send','clone','socket_timestamp','root','server/files/tmp','ContactItemType','findAll','name','_description','writeFileSync','createReadStream','data','rows','find','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','each','contact','contactTypeId','orderBy','finish','affectedRows','emit','unlink','complete','arguments\x20\x20\x20','argv','existsSync','parse','binding','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','path','lodash','papaparse','util','bluebird','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYYMMDDHHmmss','test','select','phone','from','join','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','catch','error','split','then','filter','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ContactId','ListId','updatedAt','priority','UserId','fields','cm_contacts'];(function(_0x5774af,_0x411c94){var _0x480589=function(_0x414114){while(--_0x414114){_0x5774af['push'](_0x5774af['shift']());}};_0x480589(++_0x411c94);}(_0x6002,0xfe));var _0x2600=function(_0x14c58d,_0x4cb706){_0x14c58d=_0x14c58d-0x0;var _0x4c440c=_0x6002[_0x14c58d];return _0x4c440c;};'use strict';var fs=require('fs');var path=require(_0x2600('0x0'));var _=require(_0x2600('0x1'));var Papa=require(_0x2600('0x2'));var util=require(_0x2600('0x3'));var BPromise=require(_0x2600('0x4'));var moment=require('moment');var squel=require('squel');var Redis=require(_0x2600('0x5'));var db=require(_0x2600('0x6'))['db'];var config=require(_0x2600('0x7'));var logger=require(_0x2600('0x8'))('import');config['redis']=_[_0x2600('0x9')](config[_0x2600('0xa')],{'host':_0x2600('0xb'),'port':0x18eb});var socket=require(_0x2600('0xc'))(new Redis(config[_0x2600('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0x2600('0xd')](_0x2600('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x6569d2){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))*$/[_0x2600('0xf')](_0x6569d2);}function selectNotIn(_0xf25b93,_0x3ffeda,_0x2540f6,_0x2f3910,_0x2a5cd5){return squel[_0x2600('0x10')]()['field'](_0x2600('0x11'))[_0x2600('0x12')](_0x2f3910)[_0x2600('0x13')](_0x3ffeda,null,_0x3ffeda+_0x2600('0x14')+_0x2f3910+'.'+_0x2540f6)[_0x2600('0x15')](_0x2f3910+'.'+_0x2540f6+'\x20=\x20'+_0xf25b93+'.'+_0x2540f6)[_0x2600('0x15')](_0x3ffeda+_0x2600('0x16')+_0x2a5cd5[_0x2600('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1b0fa3,_0x585b23){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x2600('0x17')](_0x2600('0x18')+tempTableName)[_0x2600('0x19')](function(_0x5be78c){if(_0x5be78c!==null){var _0x462ffb=[];for(var _0x1423f1=0x0;_0x1423f1<_0x5be78c[_0x2600('0x1a')];_0x1423f1++){var _0x12d08b=_0x5be78c[_0x1423f1];if(!_[_0x2600('0x1b')](_0x12d08b['phone'])){if(!_[_0x2600('0x1b')](_0x12d08b[_0x2600('0x1c')]))_0x462ffb['push'](insertAdditionalPhones(_0x12d08b));promisesContact[_0x2600('0x1d')]({'contact':_0x12d08b});}}}Promise[_0x2600('0x1e')](_0x462ffb)['then'](function(){_0x1b0fa3({'val':0x1});});})[_0x2600('0x1f')](function(_0x209f73){logger[_0x2600('0x20')](_0x209f73['message']);});});}function insertAdditionalPhones(_0x48735d){return new Promise(function(_0xe07271,_0x2f6030){var _0x29b63f=_0x48735d['AdditionalPhones'];if(_[_0x2600('0x1b')](_0x29b63f))_0x2f6030({'val':0x0});else{var _0x371bb4=_0x29b63f[_0x2600('0x21')](';');var _0x497e96=[];orderBy=0x0;for(var _0xf89141=0x0;_0xf89141<_0x371bb4['length'];_0xf89141++){_0x497e96[_0x2600('0x1d')](splitAdditionalPhone(_0x48735d['id'],_0x371bb4[_0xf89141]));}Promise['all'](_0x497e96)[_0x2600('0x22')](function(){_0xe07271({'val':_0x371bb4[_0x2600('0x1a')]});});}});}function splitAdditionalPhone(_0x4303c0,_0x2e4be9){return new Promise(function(_0x482ba3,_0x4ee8c7){var _0x5b2840=_0x2e4be9[_0x2600('0x21')](':');var _0xdaa9d9=_0x5b2840[0x0];var _0x37047e=_0x5b2840[0x1];if(_0x37047e!==''){var _0x301da4=_0x37047e[_0x2600('0x21')]('|');var _0x112d05=[];for(var _0x637fd2=0x0;_0x637fd2<_0x301da4[_0x2600('0x1a')];_0x637fd2++){if(_0x301da4[_0x637fd2]!==''){var _0x1f1fe7=_[_0x2600('0x23')](promisesAdditionalPhones,{'contactId':_0x4303c0,'phone':_0x301da4[_0x637fd2]});if(_0x1f1fe7[_0x2600('0x1a')]==0x0){orderBy++;promisesAdditionalPhones[_0x2600('0x1d')]({'contactId':_0x4303c0,'contactTypeId':_0xdaa9d9,'phone':_0x301da4[_0x637fd2],'orderBy':orderBy});}}}_0x482ba3({'ok':0x1});}else _0x482ba3({'res':0x0});});}function createAdditionalPhone(_0x214c8d,_0x18bd0f,_0x2e4466,_0x32e22f){var _0x24c4ed='';var _0x1b2c98='';var _0x4077a0=_0x2e4466[_0x2600('0x21')]('§');_0x24c4ed=_0x4077a0[0x0];if(_0x4077a0[_0x2600('0x1a')]==0x2)_0x1b2c98=_0x4077a0[0x1];return new Promise(function(_0x5f572a,_0x5db721){return db[_0x2600('0x24')]['findOne']({'where':{'CmContactId':_0x214c8d,'item':_0x24c4ed}})['then'](function(_0x246bf4){if(_0x246bf4){return db[_0x2600('0x24')][_0x2600('0x25')]({'ItemTypeId':_0x18bd0f,'description':_0x1b2c98,'OrderBy':_0x32e22f},{'where':{'CmContactId':_0x214c8d,'item':_0x24c4ed}})[_0x2600('0x22')](function(_0x303316){_0x5f572a({'res':_0x2600('0x26')});});}else{return db[_0x2600('0x24')][_0x2600('0x27')]({'CmContactId':_0x214c8d,'item':_0x24c4ed,'ItemTypeId':_0x18bd0f,'description':_0x1b2c98,'OrderBy':_0x32e22f,'ItemClass':'PHONE'})[_0x2600('0x22')](function(_0x243b9e){_0x5f572a({'res':_0x2600('0x28')});});}});});}function updateContact(_0x3db609){return new Promise(function(_0x33bd37,_0x9d2753){var _0x45dd9a=_0x3db609['id'];delete _0x3db609['id'];return db[_0x2600('0x29')][_0x2600('0x25')](_0x3db609,{'where':{'id':_0x45dd9a}})['then'](function(_0x56acbe){updatedRows+=0x1;return db[_0x2600('0x2a')][_0x2600('0x25')]({'phone':_0x3db609[_0x2600('0x11')]},{'where':{'ContactId':_0x45dd9a}})[_0x2600('0x22')](function(_0x5c6b52){_0x33bd37({'ret':'OK'});});});});}function insertCmHopper(_0x5efb88,_0x277825,_0x28042c,_0x7d9748,_0x102e7b){var _0x495cab=[_0x2600('0x2b'),_0x2600('0x2c'),_0x2600('0x2d'),_0x2600('0x2e'),_0x277825+'.'+_0x7d9748,_0x2600('0x2f'),'cm_contacts.updatedAt','cm_contacts.priority',_0x2600('0x30'),'\x22'+_0x102e7b+'\x22'];return squel[_0x2600('0x31')]()[_0x2600('0x32')](_0x2600('0x33'))['fromQuery']([_0x2600('0x11'),_0x2600('0x34'),_0x2600('0x35'),_0x2600('0x36'),_0x7d9748,'createdAt',_0x2600('0x37'),_0x2600('0x38'),_0x2600('0x39'),'recallme'],squel[_0x2600('0x10')]()[_0x2600('0x3a')](_0x495cab)[_0x2600('0x12')](_0x277825)['join'](_0x2600('0x3b'),null,_0x2600('0x3c')+_0x277825+_0x2600('0x3d'))['join'](_0x28042c,null,_0x28042c+'.id\x20=\x20'+_0x277825+'.'+_0x7d9748)[_0x2600('0x15')](_0x277825+_0x2600('0x3e'),_0x5efb88)[_0x2600('0x15')](_0x2600('0x3f'),NOW)[_0x2600('0x15')](_0x2600('0x40'),selectNotIn(_0x277825,_0x28042c,_0x7d9748,'cm_hopper',['\x22always\x22',_0x2600('0x41')]))[_0x2600('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x277825,_0x28042c,_0x7d9748,'cm_hopper',[_0x2600('0x42')])))['toString']();}function insertCmHopperBlack(_0x5f1f5f,_0x2e2c9e,_0x1564c8,_0x2c00ae){var _0x4e164e=[_0x2600('0x2b'),_0x2600('0x2d'),_0x2600('0x2e'),_0x2e2c9e+'.'+_0x2c00ae,_0x2600('0x2f'),'cm_contacts.updatedAt'];return squel['insert']()[_0x2600('0x32')]('cm_hopper_black')[_0x2600('0x43')]([_0x2600('0x11'),'ContactId',_0x2600('0x36'),_0x2c00ae,'createdAt',_0x2600('0x37')],squel[_0x2600('0x10')]()[_0x2600('0x3a')](_0x4e164e)['from'](_0x2e2c9e)[_0x2600('0x13')]('cm_contacts',null,_0x2600('0x3c')+_0x2e2c9e+'.CmListId')[_0x2600('0x13')](_0x1564c8,null,_0x1564c8+_0x2600('0x14')+_0x2e2c9e+'.'+_0x2c00ae)[_0x2600('0x15')](_0x2e2c9e+_0x2600('0x3e'),_0x5f1f5f)[_0x2600('0x15')](_0x2600('0x3f'),NOW)[_0x2600('0x15')](_0x2600('0x40'),squel[_0x2600('0x10')]()[_0x2600('0x44')](_0x2600('0x11'))['from'](_0x2600('0x45'))[_0x2600('0x15')](_0x2600('0x46'),_0x5f1f5f)[_0x2600('0x15')](_0x2c00ae+_0x2600('0x47'),_0x2e2c9e+'.'+_0x2c00ae)))[_0x2600('0x48')]();}function insertCmHopperAdditionalPhones(_0x4779ab){var _0x5a5a88=[_0x2600('0x49'),_0x2600('0x4a'),_0x2600('0x4b'),_0x2600('0x4c'),_0x2600('0x4d')];return squel['insert']()[_0x2600('0x32')](_0x2600('0x4e'))['fromQuery'](['CmHopperId',_0x2600('0x11'),_0x2600('0x4f'),'createdAt',_0x2600('0x37')],squel[_0x2600('0x10')]()[_0x2600('0x3a')](_0x5a5a88)[_0x2600('0x12')]('cm_hopper')[_0x2600('0x13')](_0x2600('0x3b'),null,_0x2600('0x50'))[_0x2600('0x13')](_0x2600('0x51'),null,_0x2600('0x52'))['where'](_0x2600('0x53'),_0x4779ab)[_0x2600('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x2600('0x48')]();}function insertCmContact(_0x3622af,_0x38b7e9,_0x37c399,_0x32d79a){var _0x532d85=_[_0x2600('0x54')](_['keys'](_0x32d79a),[_0x2600('0x36'),_0x2600('0x55'),_0x2600('0x56'),_0x2600('0x37')]);return squel[_0x2600('0x31')]()['into'](_0x2600('0x3b'))['fromQuery'](_0x532d85,squel['select']()[_0x2600('0x3a')](_0x532d85)[_0x2600('0x12')](_0x38b7e9)[_0x2600('0x15')]('('+_0x37c399[_0x2600('0x13')](',')+_0x2600('0x57'),squel[_0x2600('0x10')]()[_0x2600('0x3a')](_0x37c399)[_0x2600('0x12')](_0x2600('0x3b'))[_0x2600('0x15')](_0x2600('0x46'),_0x3622af))['where'](_0x2600('0x58'),squel[_0x2600('0x10')]()['field'](_0x2600('0x59'),_0x2600('0x5a'))['from'](_0x38b7e9)[_0x2600('0x5b')](_0x37c399[_0x2600('0x13')](','))))[_0x2600('0x48')]();}function handleStop(){logger[_0x2600('0x5c')](_0x2600('0x5d'));stopped=!![];}function handleUncaughtException(_0x47c6f2){logger[_0x2600('0x20')](_0x47c6f2['message']);process[_0x2600('0x5e')](0x1);}function handleError(_0x5b16ee,_0xd527e0){stats[_0x2600('0x5f')][_0x2600('0x1d')]({'name':_0xd527e0[_0x2600('0x60')],'message':_0xd527e0[_0x2600('0x61')],'row':_0x5b16ee});}function handleQuery(_0xdc299a){logger['info'](_0xdc299a);return db['sequelize'][_0x2600('0x17')](_0xdc299a)[_0x2600('0x19')](function(_0x5c619f){results[_0x2600('0x1d')](_0x5c619f);})['catch'](function(_0x515cf7){logger['error'](_0x515cf7[_0x2600('0x61')]);});}function main(_0xfc6892,_0x415850,_0x554192,_0x70b4cd){logger[_0x2600('0x5c')]('main',_0xfc6892,JSON['stringify'](_0x415850));process[_0x2600('0x62')]('start');var _0xca5a2=_0x415850['binding'];var _0x36c6d5=_[_0x2600('0x63')](_0xca5a2);var _0x21a4d1=_0x415850[_0x2600('0x64')];var _0x37f313=path['join'](config[_0x2600('0x65')],_0x2600('0x66'),_0x21a4d1+'.csv');logger[_0x2600('0x5c')]('body',_0x415850);db[_0x2600('0x67')][_0x2600('0x68')]({'raw':!![],'attributes':['id',_0x2600('0x69')]})[_0x2600('0x22')](function(_0x14924c){for(var _0xa68bac=0x0;_0xa68bac<_0x14924c[_0x2600('0x1a')];_0xa68bac++){if(_0x14924c[_0xa68bac][_0x2600('0x69')]in _0xca5a2){contactItemTypes['push'](_0x14924c[_0xa68bac]);delete _0x36c6d5[_0x14924c[_0xa68bac][_0x2600('0x69')]];hasAdditionalPhones=!![];}for(var _0x6dc320 in _0xca5a2){if(_0x14924c[_0xa68bac][_0x2600('0x69')]+_0x2600('0x6a')===_0x6dc320){phoneDescriptions[_0x2600('0x1d')]({'itemTypeId':_0x14924c[_0xa68bac]['id'],'description':_0x6dc320});delete _0x36c6d5[_0x6dc320];}}}if(hasAdditionalPhones)_0x36c6d5[_0x2600('0x1c')]='';var _0x640c1a=_['keys'](_0x36c6d5)[_0x2600('0x13')]();logger[_0x2600('0x5c')]('header',_0x640c1a);fs[_0x2600('0x6b')](_0x37f313,_0x640c1a+'\x0a');Papa['parse'](fs[_0x2600('0x6c')](_0xfc6892),{'header':!![],'skipEmptyLines':!![],'step':function(_0xb442d6,_0x42a92c){try{for(var _0x4265a5=0x0,_0x3616c0=[];_0x4265a5<_0xb442d6[_0x2600('0x6d')][_0x2600('0x1a')];_0x4265a5++){stats[_0x2600('0x6e')]+=0x1;if(_0xb442d6[_0x2600('0x5f')][_0x4265a5]){handleError(_0xb442d6[_0x2600('0x6d')][_0x4265a5],_0xb442d6[_0x2600('0x5f')][_0x4265a5]);}else{var _0x54d060=[];var _0x4ac56a=[];var _0x516537={};for(var _0x3b3015 in _0xca5a2){let _0x186c13=contactItemTypes[_0x2600('0x6f')](_0x505d8a=>_0x505d8a[_0x2600('0x69')]===_0x3b3015);let _0x1f8fe9=contactItemTypes[_0x2600('0x6f')](_0x1e102e=>_0x1e102e[_0x2600('0x69')]+_0x2600('0x6a')===_0x3b3015);if(_[_0x2600('0x1b')](_0x186c13)&&_['isNil'](_0x1f8fe9)){if(_0xca5a2['hasOwnProperty'](_0x3b3015)){if(_0xb442d6['data'][_0x4265a5][_0xca5a2[_0x3b3015]]){var _0x13d77e=_[_0x2600('0x70')](_0xb442d6[_0x2600('0x6d')][_0x4265a5][_0xca5a2[_0x3b3015]][_0x2600('0x71')](/"/g,'\x27'));switch(_0x3b3015){case _0x2600('0x34'):var _0x8a3103=moment(_0x13d77e,_0x2600('0x72'),!![]);if(_0x8a3103[_0x2600('0x73')]()){_0x3616c0[_0x2600('0x1d')]('\x22'+_0x13d77e+'\x22');}else{_0x54d060[_0x2600('0x1d')](_0x2600('0x74'));}break;case _0x2600('0x38'):var _0x387729=parseInt(_0x13d77e);_0x13d77e=_[_0x2600('0x75')](_0x387729)||_0x387729<0x0||_0x387729>0x4?_0x70b4cd?0x3:0x2:_0x387729;_0x3616c0[_0x2600('0x1d')]('\x22'+_0x13d77e+'\x22');break;case _0x2600('0x39'):var _0x2f031b=parseInt(_0x13d77e);if(_[_0x2600('0x76')](_0x2f031b)&&_[_0x2600('0x77')](_0x554192,_0x2f031b)){_0x3616c0['push']('\x22'+_0x2f031b+'\x22');}else{_0x54d060[_0x2600('0x1d')](_0x2600('0x78'));}break;case _0x2600('0x79'):if(isEmail(_0x13d77e)){_0x3616c0[_0x2600('0x1d')]('\x22'+_0x13d77e+'\x22');}else{_0x54d060[_0x2600('0x1d')]('email\x20wrong\x20format');}break;case _0x2600('0x7a'):var _0x29cf94=moment(_0x13d77e,_0x2600('0x7b'),!![]);if(_0x29cf94['isValid']()){_0x3616c0[_0x2600('0x1d')]('\x22'+_0x13d77e+'\x22');}else{_0x54d060['push'](_0x2600('0x7c'));}break;default:_0x3616c0['push']('\x22'+_0x13d77e+'\x22');}}else{switch(_0x3b3015){case _0x2600('0x7d'):case _0x2600('0x11'):_0x54d060[_0x2600('0x1d')](_0x3b3015+_0x2600('0x7e'));break;default:_0x3616c0[_0x2600('0x1d')]('\x22\x22');}}}}else{var _0x625b0c='';if(!_['isNil'](_0x186c13)){if(!_0x516537[_0x2600('0x7f')](_0x186c13['id'])){for(var _0x4821ee=0x0;_0x4821ee<_0xca5a2[_0x3b3015][_0x2600('0x1a')];_0x4821ee++){var _0x13d77e=_[_0x2600('0x70')](_0xb442d6[_0x2600('0x6d')][_0x4265a5][_0xca5a2[_0x3b3015][_0x4821ee]][_0x2600('0x71')](/"/g,'\x27'));var _0xec3ee1=phoneDescriptions['find'](_0x9ea0a5=>_0x9ea0a5[_0x2600('0x80')]===_0x186c13['id']);if(!_[_0x2600('0x1b')](_0xec3ee1)){var _0x3de445=_[_0x2600('0x70')](_0xb442d6['data'][_0x4265a5][_0xca5a2[_0xec3ee1[_0x2600('0x81')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x2600('0x1b')](_0x3de445))_0x13d77e=_0x13d77e+'§'+_0x3de445;}if(_0x625b0c=='')_0x625b0c=_0x13d77e;else _0x625b0c+='|'+_0x13d77e;}_0x4ac56a[_0x2600('0x1d')](_0x186c13['id']+':'+_0x625b0c);_0x516537[_0x186c13['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3616c0['push']('\x22'+_0x4ac56a[_0x2600('0x13')](';')+'\x22');}if(_0x54d060[_0x2600('0x1a')]){handleError(_0xb442d6[_0x2600('0x6d')][_0x4265a5],{'code':_0x2600('0x82'),'message':_0x54d060[_0x2600('0x13')]()});}else{fs[_0x2600('0x83')](_0x37f313,_0x3616c0[_0x2600('0x13')]()+'\x0a');}_0x3616c0=[];}if(!(stats[_0x2600('0x6e')]%0xc8)){socket['emit'](_0x2600('0x84')+_0x21a4d1,stats);stats['errors']=[];}}if(stopped){logger[_0x2600('0x5c')](_0x2600('0x85'));_0x42a92c[_0x2600('0x86')]();}}catch(_0x53038f){handleError(_0xb442d6['data'][_0x4265a5],{'code':_0x2600('0x87'),'message':_0x53038f[_0x2600('0x61')]});logger[_0x2600('0x20')](_0x2600('0x88'),_0x53038f[_0x2600('0x61')]);}},'complete':function(){try{var _0x4e3843=[];var _0x4fe8a0=tempTableName;_0x4e3843[_0x2600('0x1d')](_0x2600('0x89')+_0x4fe8a0+_0x2600('0x8a'));logger[_0x2600('0x5c')]('CIS\x20len',contactItemTypes[_0x2600('0x1a')]);var _0x1a912c=util[_0x2600('0xd')](_0x2600('0x8b'),_0x37f313,_0x4fe8a0,_0x640c1a,_0x415850[_0x2600('0x36')],_0x415850[_0x2600('0x55')]||null,NOW,NOW);if(_['isNil'](_0xca5a2[_0x2600('0x34')])){_0x1a912c+=',\x20scheduledAt\x20=\x20NOW()';}_0x4e3843['push'](_0x1a912c);BPromise[_0x2600('0x8c')](_0x4e3843,handleQuery)[_0x2600('0x22')](function(_0x648f4f){BPromise[_0x2600('0x1e')]([handleAdditionalPhones()])[_0x2600('0x22')](function(){_0x4e3843=[];for(var _0xd64bda=0x0;_0xd64bda\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.updatedAt','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.secondDisposition','i.to','i.ContactId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','agent','search','field','name','color','from','getInteractionFK','select','u.id','ui.','left_join','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','interactionsTags','tools_tags','t.id\x20=\x20it.TagId','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','type','default','text','value','unreadMessages','read','and','$substring','contact','ContactId','buildExpression','start','end','split','tags','clause','ids','operator','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','some','compact','length','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','get','capitalize','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','merge','a.key','a.mandatoryDisposition'];(function(_0x1f9414,_0x47086a){var _0x42ffc9=function(_0x45253f){while(--_0x45253f){_0x1f9414['push'](_0x1f9414['shift']());}};_0x42ffc9(++_0x47086a);}(_0xcb46,0x162));var _0x6cb4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb46[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6cb4('0x0'));var squel=require(_0x6cb4('0x1'));var as=require(_0x6cb4('0x2'));var qs=require(_0x6cb4('0x3'));var updateInteraction=require(_0x6cb4('0x4'))[_0x6cb4('0x5')];var utils=require(_0x6cb4('0x6'));var db=require(_0x6cb4('0x7'))['db'];function skipInteractionsQuery(_0x50d525,_0x3c52da,_0x21cde8){var _0x5424a8=![];var _0x30e8b7=utils['getAccountFK'](_0x50d525);if(_0x3c52da['role']===_0x6cb4('0x8')&&!_0x21cde8[_0x6cb4('0x9')]&&!_0x21cde8[_0x30e8b7]){_0x5424a8=!![];}return _0x5424a8;}function getTagsQuery(){return squel['select']()[_0x6cb4('0xa')]('id')[_0x6cb4('0xa')](_0x6cb4('0xb'))[_0x6cb4('0xa')](_0x6cb4('0xc'))[_0x6cb4('0xd')]('tools_tags');}function getUsersQuery(_0x19898a,_0x2ebf1c){var _0x42020b=utils[_0x6cb4('0xe')](_0x19898a);var _0x20c2b8='user_has_'+_0x19898a+'_interactions';var _0x3d45f8=squel[_0x6cb4('0xf')]()[_0x6cb4('0xa')](_0x6cb4('0x10'))[_0x6cb4('0xa')]('u.fullname')[_0x6cb4('0xa')](_0x6cb4('0x11')+_0x42020b)[_0x6cb4('0xd')](_0x20c2b8,'ui')[_0x6cb4('0x12')]('users','u',_0x6cb4('0x13'));if(_0x2ebf1c['length']>0x0){_0x3d45f8[_0x6cb4('0x14')](_0x6cb4('0x11')+_0x42020b+_0x6cb4('0x15'),_[_0x6cb4('0x16')](_0x2ebf1c,'id'));}return _0x3d45f8;}function getInteractionsQuery(_0x393185){var _0x362ea0=utils[_0x6cb4('0x17')](_0x393185);var _0x49a097=utils[_0x6cb4('0x18')](_0x393185);var _0x37d44d=utils[_0x6cb4('0xe')](_0x393185);return squel[_0x6cb4('0xf')]()[_0x6cb4('0xd')](_0x362ea0['interactions'],'i')[_0x6cb4('0x12')]('cm_contacts','c',_0x6cb4('0x19'))[_0x6cb4('0x12')](_0x6cb4('0x1a'),'o',_0x6cb4('0x1b'))[_0x6cb4('0x12')](_0x362ea0[_0x6cb4('0x1c')],'a',_0x6cb4('0x1d')+_0x49a097)[_0x6cb4('0x12')](_0x362ea0[_0x6cb4('0x1e')],'me','me.'+_0x37d44d+'\x20=\x20i.id')['left_join'](_0x362ea0[_0x6cb4('0x1f')],'it','it.'+_0x37d44d+'\x20=\x20i.id')[_0x6cb4('0x12')](_0x6cb4('0x20'),'t',_0x6cb4('0x21'));}function getSqlClauses(){var _0x2bc7b7={'body':squel[_0x6cb4('0x22')](),'contact':squel['expr'](),'default':squel[_0x6cb4('0x22')](),'fields':squel[_0x6cb4('0x22')](),'filter':squel[_0x6cb4('0x22')](),'read':squel[_0x6cb4('0x22')](),'tags':{'clause':squel[_0x6cb4('0x22')](),'ids':null},'user':squel[_0x6cb4('0x22')]()};return _0x2bc7b7;}function parseTagParameter(_0x808759){var _0x4d4ca0=squel[_0x6cb4('0x22')]();if(_0x808759){var _0x2ce451=utils['getSelectedTags'](_0x808759);_0x2ce451[_0x6cb4('0x23')](function(_0x996e2d){_0x4d4ca0['or'](_0x6cb4('0x24'),'%,'+_0x996e2d+',%');});}return _0x4d4ca0;}function parseReadParameter(_0x5e2650){var _0x368cdd='';if(_0x5e2650){_0x368cdd=_0x6cb4('0x25');if(_0x5e2650==='1'){_0x368cdd=_0x368cdd[_0x6cb4('0x26')]('{OPERATOR}','=');}else{_0x368cdd=_0x368cdd[_0x6cb4('0x26')](_0x6cb4('0x27'),'>');}}return _0x368cdd;}function parseSearchFilter(_0x15629f,_0x237035){var _0x531f15=squel[_0x6cb4('0x22')]();if(_0x237035){var _0x3d83a5=_0x237035[_0x6cb4('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6cb4('0x28')](_0x3d83a5)){_0x531f15['or']('i.id\x20LIKE\x20?',_0x3d83a5+'%');if([_0x6cb4('0x29'),_0x6cb4('0x2a')][_0x6cb4('0x2b')](_0x15629f)){_0x531f15['or'](_0x6cb4('0x2c'),_0x3d83a5+'%');}else if(_0x15629f===_0x6cb4('0x2d')){_0x531f15['or'](_0x6cb4('0x2e'),_0x3d83a5+'%');}else if(_0x15629f===_0x6cb4('0x2f')){_0x531f15['or'](_0x6cb4('0x30'),_0x3d83a5+'%');}}else if(_0x15629f==='mail'&&qs[_0x6cb4('0x31')](_0x3d83a5)){_0x531f15['or'](_0x6cb4('0x32'),_0x3d83a5+'%');}else{if(_0x15629f===_0x6cb4('0x33')){_0x531f15['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6cb4('0x34')](_0x3d83a5,!![]))['or'](_0x6cb4('0x35'),qs[_0x6cb4('0x34')](_0x3d83a5));}else if(_0x15629f!=='fax'){_0x531f15['or'](_0x6cb4('0x36'),qs[_0x6cb4('0x34')](_0x3d83a5));}_0x531f15['or'](_0x6cb4('0x37'),qs[_0x6cb4('0x34')](_0x3d83a5,!![]),null);}}return _0x531f15;}function parseAdvancedSearchFilter(_0x459bc6,_0x5517a5){var _0x33ca46=getSqlClauses();var _0x4389e1=as[_0x6cb4('0x38')](_0x459bc6);var _0x3c4330=_0x4389e1['sqlOperator'];for(var _0x21c86f=0x0;_0x21c86f<_0x4389e1[_0x6cb4('0x39')]['length'];_0x21c86f++){var _0x57f276=_0x4389e1[_0x6cb4('0x39')][_0x21c86f];var _0x4c2b5c='i';var _0x1fc0ad=_[_0x6cb4('0x3a')](_0x5517a5,[_0x6cb4('0xb'),_0x57f276[_0x6cb4('0xa')]]);if(_0x1fc0ad){var _0x47c1c1=as['buildExpression'](_0x4c2b5c,_0x1fc0ad[_0x6cb4('0x3b')],_0x57f276);_0x33ca46[_0x6cb4('0x3c')][_0x3c4330](_0x47c1c1[_0x6cb4('0x3d')],_0x47c1c1[_0x6cb4('0x3e')]['start'],_0x47c1c1[_0x6cb4('0x3e')]['end']);}else{switch(_0x57f276['field']){case _0x6cb4('0x3f'):var _0x2fe38e=parseReadParameter(_0x57f276[_0x6cb4('0x3e')]);_0x33ca46[_0x6cb4('0x40')][_0x6cb4('0x41')](_0x2fe38e);break;case'Contact':if(_0x57f276['operator']===_0x6cb4('0x42')){if(_0x57f276['value']['split']('\x20')['length']>0x1){_0x33ca46[_0x6cb4('0x43')][_0x3c4330](_0x6cb4('0x37'),qs[_0x6cb4('0x34')](_0x57f276[_0x6cb4('0x3e')],!![]),null);}else{var _0x517b49='%'+_0x57f276['value']+'%';_0x33ca46['contact'][_0x3c4330]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x517b49,_0x517b49,_0x517b49);}}else{_0x1fc0ad=_['find'](_0x5517a5,[_0x6cb4('0xb'),_0x6cb4('0x44')]);_0x57f276[_0x6cb4('0xa')]='ContactId';_0x47c1c1=as[_0x6cb4('0x45')](_0x4c2b5c,_0x1fc0ad[_0x6cb4('0x3b')],_0x57f276);_0x33ca46[_0x6cb4('0x43')][_0x3c4330](_0x47c1c1[_0x6cb4('0x3d')],_0x47c1c1[_0x6cb4('0x3e')][_0x6cb4('0x46')],_0x47c1c1[_0x6cb4('0x3e')][_0x6cb4('0x47')]);}break;case'Tag':var _0x3ae36e=_0x57f276['value'][_0x6cb4('0x48')](',')[_0x6cb4('0x16')](function(_0x8d9262){return Number(_0x8d9262);});var _0x2b6d9c=parseTagParameter(_0x3ae36e);_0x33ca46[_0x6cb4('0x49')][_0x6cb4('0x4a')][_0x6cb4('0x41')](_0x2b6d9c);_0x33ca46['tags'][_0x6cb4('0x4b')]=_0x3ae36e;break;case'User':if(_0x57f276[_0x6cb4('0x4c')]===_0x6cb4('0x42')){_0x33ca46[_0x6cb4('0x4d')][_0x3c4330](_0x6cb4('0x4e'),'%'+_0x57f276[_0x6cb4('0x3e')]+'%',null);}else{_0x1fc0ad=_[_0x6cb4('0x3a')](_0x5517a5,['name',_0x6cb4('0x4f')]);_0x57f276[_0x6cb4('0xa')]=_0x6cb4('0x4f');_0x47c1c1=as['buildExpression'](_0x4c2b5c,_0x1fc0ad[_0x6cb4('0x3b')],_0x57f276);_0x33ca46[_0x6cb4('0x4d')][_0x3c4330](_0x47c1c1['text'],_0x47c1c1[_0x6cb4('0x3e')][_0x6cb4('0x46')],_0x47c1c1[_0x6cb4('0x3e')]['end']);}break;case _0x6cb4('0x50'):case _0x6cb4('0x51'):_0x47c1c1=as[_0x6cb4('0x45')]('me',null,_0x57f276);_0x33ca46[_0x6cb4('0x50')][_0x3c4330](_0x47c1c1[_0x6cb4('0x3d')],_0x47c1c1[_0x6cb4('0x3e')][_0x6cb4('0x46')],_0x47c1c1['value'][_0x6cb4('0x47')]);break;}}}return _0x33ca46;}function parseModelFields(_0x511731,_0x5c1041,_0x2a773c){var _0x1d4727=utils['getAccountFK'](_0x511731);var _0x438562=squel[_0x6cb4('0x22')]();var _0x4fb085=_(_0x5c1041)['keys']()[_0x6cb4('0x16')](function(_0x5177c0){return _[_0x6cb4('0x52')](_0x2a773c,[_0x6cb4('0xb'),_0x5177c0])?_0x5177c0:undefined;})[_0x6cb4('0x53')]()[_0x6cb4('0x3e')]();if(_0x4fb085[_0x6cb4('0x54')]>0x0){_0x4fb085[_0x6cb4('0x23')](function(_0x42a97e){if(_0x42a97e===_0x1d4727){_0x438562[_0x6cb4('0x41')]('i.'+_0x1d4727+'\x20IN\x20?',[][_0x6cb4('0x55')](_0x5c1041[_0x42a97e]));}else if(_0x42a97e===_0x6cb4('0x56')){var _0x52ec58=JSON[_0x6cb4('0x57')](_0x5c1041[_0x42a97e])[_0x6cb4('0x58')];var _0x2801c0=JSON[_0x6cb4('0x57')](_0x5c1041[_0x42a97e])[_0x6cb4('0x59')];_0x438562[_0x6cb4('0x41')](_0x6cb4('0x5a'),_0x52ec58,_0x2801c0);}else{if(_0x5c1041[_0x42a97e]===_0x6cb4('0x5b')){_0x438562[_0x6cb4('0x41')]('i.'+_0x42a97e+_0x6cb4('0x5c'));}else{_0x438562[_0x6cb4('0x41')]('i.'+_0x42a97e+_0x6cb4('0x5d'),_0x5c1041[_0x42a97e]);}}});}return _0x438562;}function parseQueryParameters(_0x4730f4,_0x5ccae7,_0x2dc72c){var _0x31b8da=getSqlClauses();return Promise[_0x6cb4('0x5e')]()[_0x6cb4('0x5f')](function(){return parseModelFields(_0x4730f4,_0x5ccae7,_0x2dc72c);})[_0x6cb4('0x5f')](function(_0x3ab6d7){_0x31b8da[_0x6cb4('0x60')][_0x6cb4('0x41')](_0x3ab6d7);return parseReadParameter(_0x5ccae7[_0x6cb4('0x40')]);})[_0x6cb4('0x5f')](function(_0x179ade){_0x31b8da[_0x6cb4('0x40')][_0x6cb4('0x41')](_0x179ade);return parseTagParameter(_0x5ccae7[_0x6cb4('0x61')]);})[_0x6cb4('0x5f')](function(_0x106c33){_0x31b8da[_0x6cb4('0x49')][_0x6cb4('0x4a')][_0x6cb4('0x41')](_0x106c33);return parseSearchFilter(_0x4730f4,_0x5ccae7['filter']);})[_0x6cb4('0x5f')](function(_0x3921d0){_0x31b8da[_0x6cb4('0x62')]=_0x3921d0;return _0x31b8da;});}function checkAccountsRestrictions(_0x53b01a,_0x21e234,_0x5c1a60){var _0x4dd52e=utils[_0x6cb4('0x18')](_0x53b01a);var _0x3a7fcc=_0x6cb4('0x63')+_[_0x6cb4('0x64')](_0x53b01a)+(_0x53b01a==='chat'?'Websites':_0x6cb4('0x65'));var _0x5c776d=squel[_0x6cb4('0x22')]();return Promise[_0x6cb4('0x5e')]()[_0x6cb4('0x5f')](function(){if(_0x5c1a60[_0x6cb4('0x9')]&&_0x21e234[_0x6cb4('0x66')]===_0x6cb4('0x8')){return _0x21e234[_0x3a7fcc]({'attributes':['id'],'raw':!![]});}})[_0x6cb4('0x5f')](function(_0x82aecd){if(_0x82aecd){if(_0x82aecd[_0x6cb4('0x54')]===0x0){_0x5c776d['and']('i.'+_0x4dd52e+'\x20IS\x20NULL');}else{_0x5c776d[_0x6cb4('0x41')]('i.'+_0x4dd52e+_0x6cb4('0x15'),_[_0x6cb4('0x16')](_0x82aecd,'id'));}}else if(!_0x5c1a60[_0x4dd52e]){_0x5c776d['and']('i.'+_0x4dd52e+_0x6cb4('0x67'));}})[_0x6cb4('0x5f')](function(){return _0x5c776d;});}function getClosedOrderClause(_0x1ce130,_0x48053a){var _0x38912e='';var _0x1140f2=[_0x6cb4('0x68'),'i.secondDisposition',_0x6cb4('0x69')];if(_0x1ce130==='mail'){_0x1140f2['unshift'](_0x6cb4('0x6a'));}if(_0x48053a[_0x6cb4('0x6b')]==='0'&&_0x1ce130==='mail'){_0x38912e=_0x6cb4('0x6a');}else{if(_0x48053a[_0x6cb4('0x6b')]==='1'){_0x1140f2[_0x6cb4('0x6c')]();}_0x38912e=_0x6cb4('0x6d')+_0x1140f2[_0x6cb4('0x6e')](',\x20')+')';}return _0x38912e;}function getFilteredInteractions(_0x3a44e8,_0xdd6035,_0x58b27c,_0x507d96){var _0x1c38ef=utils[_0x6cb4('0xe')](_0x3a44e8);var _0x540f09=_['capitalize'](_0x3a44e8)+_0x6cb4('0x6f');var _0x415842=[];var _0x4f64e6=getTagsQuery();var _0x3b396e={'type':db[_0x6cb4('0x70')][_0x6cb4('0x71')][_0x6cb4('0x72')],'raw':!![]};var _0x5a8ba9=[];var _0x32b8ae=[];return db[_0x6cb4('0x73')][_0x6cb4('0x74')](_0x4f64e6['toString'](),_0x3b396e)[_0x6cb4('0x5f')](function(_0x31142c){_0x415842=_['keyBy'](_0x31142c,'id');_0x3b396e=_[_0x6cb4('0x75')](_0x3b396e,{'model':db[_0x540f09],'mapToModel':!![],'nest':!![]});if(_0x58b27c['fields']){_0x507d96['attributes']['forEach'](function(_0x1bed43){_0xdd6035[_0x6cb4('0xa')]('i.'+_0x1bed43);});}else{_0xdd6035[_0x6cb4('0xa')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x6cb4('0x3f'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x76'),'Account.key');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x77'),'Account.mandatoryDisposition');if(_0x3a44e8==='mail'){_0xdd6035['field'](_0x6cb4('0x78'),_0x6cb4('0x79'));_0xdd6035['field'](_0x6cb4('0x7a'),_0x6cb4('0x7b'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x7c'));_0xdd6035[_0x6cb4('0xa')]('i.createdAt');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x7d'));_0xdd6035[_0x6cb4('0xa')]('i.closed');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x7e'));_0xdd6035['field'](_0x6cb4('0x7f'));_0xdd6035['field']('i.lastMsgAt');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x80'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x81'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x69'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x82'));_0xdd6035[_0x6cb4('0xa')]('i.thirdDisposition');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x6a'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x83'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x84'));_0xdd6035[_0x6cb4('0xa')]('i.MailAccountId');_0xdd6035['field'](_0x6cb4('0x85'));}else if(_0x3a44e8==='openchannel'){_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x86'),_0x6cb4('0x7b'));}else{_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x87'),_0x6cb4('0x7b'));}if(_0x3a44e8!==_0x6cb4('0x33')){_0xdd6035['field'](_0x6cb4('0x88'));}_0xdd6035['field']('c.firstName','Contact.firstName');_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x89'),_0x6cb4('0x8a'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x8b'),_0x6cb4('0x8c'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x8d'),_0x6cb4('0x8e'));_0xdd6035['field']('c.mobile',_0x6cb4('0x8f'));_0xdd6035['field'](_0x6cb4('0x90'),'Contact.fax');_0xdd6035[_0x6cb4('0xa')]('o.fullname','Owner.fullname');_0xdd6035['field'](_0x6cb4('0x91'),_0x6cb4('0x92'));_0xdd6035[_0x6cb4('0xa')](_0x6cb4('0x93'),_0x6cb4('0x94'));}if(_0x507d96[_0x6cb4('0x95')]){_0xdd6035['limit'](_0x507d96[_0x6cb4('0x95')]);}if(_0x507d96[_0x6cb4('0x96')]){_0xdd6035['offset'](_0x507d96[_0x6cb4('0x96')]);}return db[_0x6cb4('0x73')][_0x6cb4('0x74')](_0xdd6035[_0x6cb4('0x97')](),_0x3b396e);})[_0x6cb4('0x5f')](function(_0x30bc0a){_0x5a8ba9=_0x30bc0a;var _0x2a840b=getUsersQuery(_0x3a44e8,_0x5a8ba9);return db[_0x6cb4('0x73')][_0x6cb4('0x74')](_0x2a840b['toString'](),_0x3b396e);})[_0x6cb4('0x5f')](function(_0x4dcea4){_0x32b8ae=_['groupBy'](_0x4dcea4,_0x1c38ef);if(_0x3a44e8==='mail'){return db['Setting']['findOne']({'attributes':[_0x6cb4('0x98')],'raw':!![]});}})[_0x6cb4('0x5f')](function(_0x4f2cfc){var _0xa2b19f=_0x4f2cfc?_0x4f2cfc[_0x6cb4('0x98')]:undefined;var _0x5caa43=_0x5a8ba9[_0x6cb4('0x16')](function(_0x1c6c09){return updateInteraction(_0x1c6c09,_0x415842,_0x32b8ae,_0xa2b19f);});return Promise['all'](_0x5caa43);});}function countFilteredInteractions(_0x58555e,_0x14a0b6){var _0x50f3e2=_0x58555e[_0x6cb4('0x99')]();_0x50f3e2[_0x6cb4('0xa')](_0x6cb4('0x9a'));_0x50f3e2[_0x6cb4('0xa')](_0x6cb4('0x9b'),_0x6cb4('0x3f'));var _0x4cee79=utils[_0x6cb4('0x9c')](_0x14a0b6);if(!_['isEmpty'](_0x4cee79)){_0x50f3e2[_0x6cb4('0x14')]('t.id\x20IN\x20?',_0x4cee79);}var _0x1bdd5d={'type':db[_0x6cb4('0x70')][_0x6cb4('0x71')][_0x6cb4('0x72')],'raw':!![]};return db[_0x6cb4('0x73')]['query'](_0x50f3e2[_0x6cb4('0x97')](),_0x1bdd5d);}module[_0x6cb4('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x1259=['GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','toString','groupBy','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','from','tools_tags','getInteractionFK','_interactions','u.fullname','ui.','left_join','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','a.id\x20=\x20i.','messages','me.','interactionsTags','\x20=\x20i.id','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','sms','whatsapp','includes','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(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','conditions','length','find','buildExpression','default','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?','ContactId','type','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','body','keys','concat','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','role','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','sequelize','query','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.subject','i.thirdDisposition','i.to','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','Owner.internal'];(function(_0x338117,_0x47190e){var _0x24a637=function(_0xdfb157){while(--_0xdfb157){_0x338117['push'](_0x338117['shift']());}};_0x24a637(++_0x47190e);}(_0x1259,0xb2));var _0x9125=function(_0x274ac2,_0x4093a9){_0x274ac2=_0x274ac2-0x0;var _0x3facdc=_0x1259[_0x274ac2];return _0x3facdc;};'use strict';var _=require(_0x9125('0x0'));var squel=require(_0x9125('0x1'));var as=require(_0x9125('0x2'));var qs=require(_0x9125('0x3'));var updateInteraction=require(_0x9125('0x4'))[_0x9125('0x5')];var utils=require(_0x9125('0x6'));var db=require(_0x9125('0x7'))['db'];function skipInteractionsQuery(_0x2672c0,_0x259f10,_0x9981b8){var _0xc5bcfd=![];var _0x5ca0e4=utils[_0x9125('0x8')](_0x2672c0);if(_0x259f10['role']===_0x9125('0x9')&&!_0x9981b8[_0x9125('0xa')]&&!_0x9981b8[_0x5ca0e4]){_0xc5bcfd=!![];}return _0xc5bcfd;}function getTagsQuery(){return squel[_0x9125('0xb')]()[_0x9125('0xc')]('id')['field'](_0x9125('0xd'))[_0x9125('0xc')]('color')[_0x9125('0xe')](_0x9125('0xf'));}function getUsersQuery(_0x137033,_0x5b8271){var _0x22d308=utils[_0x9125('0x10')](_0x137033);var _0x3f131f='user_has_'+_0x137033+_0x9125('0x11');var _0x5a71dd=squel['select']()[_0x9125('0xc')]('u.id')[_0x9125('0xc')](_0x9125('0x12'))['field'](_0x9125('0x13')+_0x22d308)[_0x9125('0xe')](_0x3f131f,'ui')[_0x9125('0x14')]('users','u',_0x9125('0x15'));if(_0x5b8271['length']>0x0){_0x5a71dd[_0x9125('0x16')](_0x9125('0x13')+_0x22d308+_0x9125('0x17'),_[_0x9125('0x18')](_0x5b8271,'id'));}return _0x5a71dd;}function getInteractionsQuery(_0x2542f1){var _0x4da341=utils[_0x9125('0x19')](_0x2542f1);var _0x5f54c9=utils[_0x9125('0x8')](_0x2542f1);var _0x1b211a=utils[_0x9125('0x10')](_0x2542f1);return squel['select']()['from'](_0x4da341[_0x9125('0x1a')],'i')[_0x9125('0x14')](_0x9125('0x1b'),'c',_0x9125('0x1c'))[_0x9125('0x14')](_0x9125('0x1d'),'o',_0x9125('0x1e'))['left_join'](_0x4da341['accounts'],'a',_0x9125('0x1f')+_0x5f54c9)[_0x9125('0x14')](_0x4da341[_0x9125('0x20')],'me',_0x9125('0x21')+_0x1b211a+'\x20=\x20i.id')[_0x9125('0x14')](_0x4da341[_0x9125('0x22')],'it','it.'+_0x1b211a+_0x9125('0x23'))[_0x9125('0x14')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3b52fc={'body':squel[_0x9125('0x24')](),'contact':squel[_0x9125('0x24')](),'default':squel[_0x9125('0x24')](),'fields':squel[_0x9125('0x24')](),'filter':squel[_0x9125('0x24')](),'read':squel[_0x9125('0x24')](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x9125('0x24')]()};return _0x3b52fc;}function parseTagParameter(_0x44778e){var _0x5bc24b=squel[_0x9125('0x24')]();if(_0x44778e){var _0x10be33=utils[_0x9125('0x25')](_0x44778e);_0x10be33[_0x9125('0x26')](function(_0x556e3d){_0x5bc24b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x556e3d+',%');});}return _0x5bc24b;}function parseReadParameter(_0x1f4070){var _0x356230='';if(_0x1f4070){_0x356230=_0x9125('0x27');if(_0x1f4070==='1'){_0x356230=_0x356230[_0x9125('0x28')](_0x9125('0x29'),'=');}else{_0x356230=_0x356230[_0x9125('0x28')]('{OPERATOR}','>');}}return _0x356230;}function parseSearchFilter(_0x4bec92,_0xfa99){var _0x5c2c6b=squel[_0x9125('0x24')]();if(_0xfa99){var _0x1bb65f=_0xfa99[_0x9125('0x28')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1bb65f)){_0x5c2c6b['or']('i.id\x20LIKE\x20?',_0x1bb65f+'%');if([_0x9125('0x2a'),_0x9125('0x2b')][_0x9125('0x2c')](_0x4bec92)){_0x5c2c6b['or']('i.phone\x20LIKE\x20?',_0x1bb65f+'%');}else if(_0x4bec92===_0x9125('0x2d')){_0x5c2c6b['or'](_0x9125('0x2e'),_0x1bb65f+'%');}else if(_0x4bec92===_0x9125('0x2f')){_0x5c2c6b['or'](_0x9125('0x30'),_0x1bb65f+'%');}}else if(_0x4bec92===_0x9125('0x31')&&qs[_0x9125('0x32')](_0x1bb65f)){_0x5c2c6b['or'](_0x9125('0x33'),_0x1bb65f+'%');}else{if(_0x4bec92==='mail'){_0x5c2c6b['or'](_0x9125('0x34'),qs['getFullTextValue'](_0x1bb65f,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9125('0x35')](_0x1bb65f));}else if(_0x4bec92!==_0x9125('0x2d')){_0x5c2c6b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x9125('0x35')](_0x1bb65f));}_0x5c2c6b['or'](_0x9125('0x36'),qs['getFullTextValue'](_0x1bb65f,!![]),null);}}return _0x5c2c6b;}function parseAdvancedSearchFilter(_0x153712,_0x51aa30){var _0x4a5b45=getSqlClauses();var _0x3c958b=as['parseSearch'](_0x153712);var _0x37a4d9=_0x3c958b['sqlOperator'];for(var _0x585bee=0x0;_0x585bee<_0x3c958b[_0x9125('0x37')][_0x9125('0x38')];_0x585bee++){var _0x18fed3=_0x3c958b[_0x9125('0x37')][_0x585bee];var _0x36e6d6='i';var _0x5e1335=_[_0x9125('0x39')](_0x51aa30,[_0x9125('0xd'),_0x18fed3['field']]);if(_0x5e1335){var _0x26e553=as[_0x9125('0x3a')](_0x36e6d6,_0x5e1335['type'],_0x18fed3);_0x4a5b45[_0x9125('0x3b')][_0x37a4d9](_0x26e553[_0x9125('0x3c')],_0x26e553[_0x9125('0x3d')][_0x9125('0x3e')],_0x26e553[_0x9125('0x3d')][_0x9125('0x3f')]);}else{switch(_0x18fed3[_0x9125('0xc')]){case _0x9125('0x40'):var _0x440dba=parseReadParameter(_0x18fed3[_0x9125('0x3d')]);_0x4a5b45[_0x9125('0x41')][_0x9125('0x42')](_0x440dba);break;case _0x9125('0x43'):if(_0x18fed3[_0x9125('0x44')]==='$substring'){if(_0x18fed3[_0x9125('0x3d')][_0x9125('0x45')]('\x20')[_0x9125('0x38')]>0x1){_0x4a5b45[_0x9125('0x46')][_0x37a4d9](_0x9125('0x36'),qs[_0x9125('0x35')](_0x18fed3[_0x9125('0x3d')],!![]),null);}else{var _0x1ceff7='%'+_0x18fed3[_0x9125('0x3d')]+'%';_0x4a5b45[_0x9125('0x46')][_0x37a4d9](_0x9125('0x47'),_0x1ceff7,_0x1ceff7,_0x1ceff7);}}else{_0x5e1335=_[_0x9125('0x39')](_0x51aa30,[_0x9125('0xd'),_0x9125('0x48')]);_0x18fed3['field']=_0x9125('0x48');_0x26e553=as[_0x9125('0x3a')](_0x36e6d6,_0x5e1335[_0x9125('0x49')],_0x18fed3);_0x4a5b45[_0x9125('0x46')][_0x37a4d9](_0x26e553['text'],_0x26e553[_0x9125('0x3d')][_0x9125('0x3e')],_0x26e553[_0x9125('0x3d')][_0x9125('0x3f')]);}break;case'Tag':var _0x29f4ec=_0x18fed3[_0x9125('0x3d')][_0x9125('0x45')](',')[_0x9125('0x18')](function(_0x10bee2){return Number(_0x10bee2);});var _0x5641f4=parseTagParameter(_0x29f4ec);_0x4a5b45[_0x9125('0x4a')][_0x9125('0x4b')][_0x9125('0x42')](_0x5641f4);_0x4a5b45[_0x9125('0x4a')][_0x9125('0x4c')]=_0x29f4ec;break;case _0x9125('0x4d'):if(_0x18fed3[_0x9125('0x44')]===_0x9125('0x4e')){_0x4a5b45[_0x9125('0x4f')][_0x37a4d9](_0x9125('0x50'),'%'+_0x18fed3[_0x9125('0x3d')]+'%',null);}else{_0x5e1335=_['find'](_0x51aa30,[_0x9125('0xd'),_0x9125('0x51')]);_0x18fed3[_0x9125('0xc')]=_0x9125('0x51');_0x26e553=as['buildExpression'](_0x36e6d6,_0x5e1335[_0x9125('0x49')],_0x18fed3);_0x4a5b45[_0x9125('0x4f')][_0x37a4d9](_0x26e553[_0x9125('0x3c')],_0x26e553['value']['start'],_0x26e553['value'][_0x9125('0x3f')]);}break;case'body':case _0x9125('0x52'):_0x26e553=as[_0x9125('0x3a')]('me',null,_0x18fed3);_0x4a5b45[_0x9125('0x53')][_0x37a4d9](_0x26e553[_0x9125('0x3c')],_0x26e553['value'][_0x9125('0x3e')],_0x26e553[_0x9125('0x3d')][_0x9125('0x3f')]);break;}}}return _0x4a5b45;}function parseModelFields(_0x37f304,_0x3ddda5,_0x1647cd){var _0x1203c3=utils[_0x9125('0x8')](_0x37f304);var _0x4c66fd=squel[_0x9125('0x24')]();var _0x1c3f5d=_(_0x3ddda5)[_0x9125('0x54')]()[_0x9125('0x18')](function(_0x46e742){return _['some'](_0x1647cd,[_0x9125('0xd'),_0x46e742])?_0x46e742:undefined;})['compact']()['value']();if(_0x1c3f5d[_0x9125('0x38')]>0x0){_0x1c3f5d[_0x9125('0x26')](function(_0x13a032){if(_0x13a032===_0x1203c3){_0x4c66fd[_0x9125('0x42')]('i.'+_0x1203c3+_0x9125('0x17'),[][_0x9125('0x55')](_0x3ddda5[_0x13a032]));}else if(_0x13a032===_0x9125('0x56')){var _0xea883e=JSON['parse'](_0x3ddda5[_0x13a032])[_0x9125('0x57')];var _0x4ee279=JSON['parse'](_0x3ddda5[_0x13a032])[_0x9125('0x58')];_0x4c66fd['and'](_0x9125('0x59'),_0xea883e,_0x4ee279);}else{if(_0x3ddda5[_0x13a032]===_0x9125('0x5a')){_0x4c66fd['and']('i.'+_0x13a032+_0x9125('0x5b'));}else{_0x4c66fd[_0x9125('0x42')]('i.'+_0x13a032+_0x9125('0x5c'),_0x3ddda5[_0x13a032]);}}});}return _0x4c66fd;}function parseQueryParameters(_0x46f5e2,_0x277dc5,_0x4e19f7){var _0x4ccf80=getSqlClauses();return Promise[_0x9125('0x5d')]()[_0x9125('0x5e')](function(){return parseModelFields(_0x46f5e2,_0x277dc5,_0x4e19f7);})['then'](function(_0xffa14a){_0x4ccf80[_0x9125('0x5f')]['and'](_0xffa14a);return parseReadParameter(_0x277dc5[_0x9125('0x41')]);})[_0x9125('0x5e')](function(_0x41066c){_0x4ccf80[_0x9125('0x41')][_0x9125('0x42')](_0x41066c);return parseTagParameter(_0x277dc5[_0x9125('0x60')]);})[_0x9125('0x5e')](function(_0x5994f1){_0x4ccf80['tags']['clause'][_0x9125('0x42')](_0x5994f1);return parseSearchFilter(_0x46f5e2,_0x277dc5[_0x9125('0x61')]);})[_0x9125('0x5e')](function(_0x511725){_0x4ccf80[_0x9125('0x61')]=_0x511725;return _0x4ccf80;});}function checkAccountsRestrictions(_0x51c87b,_0x40a0e4,_0x2ba861){var _0x55046f=utils[_0x9125('0x8')](_0x51c87b);var _0x5ceca7='get'+_[_0x9125('0x62')](_0x51c87b)+(_0x51c87b===_0x9125('0x63')?_0x9125('0x64'):_0x9125('0x65'));var _0x2aab32=squel['expr']();return Promise['resolve']()[_0x9125('0x5e')](function(){if(_0x2ba861[_0x9125('0xa')]&&_0x40a0e4[_0x9125('0x66')]===_0x9125('0x9')){return _0x40a0e4[_0x5ceca7]({'attributes':['id'],'raw':!![]});}})[_0x9125('0x5e')](function(_0x1d9eb0){if(_0x1d9eb0){if(_0x1d9eb0['length']===0x0){_0x2aab32['and']('i.'+_0x55046f+_0x9125('0x5b'));}else{_0x2aab32['and']('i.'+_0x55046f+_0x9125('0x17'),_[_0x9125('0x18')](_0x1d9eb0,'id'));}}else if(!_0x2ba861[_0x55046f]){_0x2aab32[_0x9125('0x42')]('i.'+_0x55046f+'\x20IS\x20NOT\x20NULL');}})[_0x9125('0x5e')](function(){return _0x2aab32;});}function getClosedOrderClause(_0x569c7d,_0x4b28b3){var _0x335fc7='';var _0x5c55ed=['i.thirdDisposition',_0x9125('0x67'),_0x9125('0x68')];if(_0x569c7d==='mail'){_0x5c55ed[_0x9125('0x69')](_0x9125('0x6a'));}if(_0x4b28b3[_0x9125('0x6b')]==='0'&&_0x569c7d===_0x9125('0x31')){_0x335fc7=_0x9125('0x6a');}else{if(_0x4b28b3['closed']==='1'){_0x5c55ed['shift']();}_0x335fc7='CONCAT_WS(\x27\x27,\x20'+_0x5c55ed[_0x9125('0x6c')](',\x20')+')';}return _0x335fc7;}function getFilteredInteractions(_0x531d77,_0xa76d27,_0xae61b2,_0x33e2e9){var _0x34e783=utils['getInteractionFK'](_0x531d77);var _0x598f83=_[_0x9125('0x62')](_0x531d77)+_0x9125('0x6d');var _0x2b7f13=[];var _0x38ba6a=getTagsQuery();var _0x472780={'type':db[_0x9125('0x6e')]['QueryTypes']['SELECT'],'raw':!![]};var _0x495d59=[];var _0x218ec5=[];return db[_0x9125('0x6f')][_0x9125('0x70')](_0x38ba6a['toString'](),_0x472780)['then'](function(_0x6c8947){_0x2b7f13=_[_0x9125('0x71')](_0x6c8947,'id');_0x472780=_[_0x9125('0x72')](_0x472780,{'model':db[_0x598f83],'mapToModel':!![],'nest':!![]});if(_0xae61b2[_0x9125('0x5f')]){_0x33e2e9['attributes'][_0x9125('0x26')](function(_0x5411c4){_0xa76d27['field']('i.'+_0x5411c4);});}else{_0xa76d27['field'](_0x9125('0x73'),_0x9125('0x40'));_0xa76d27[_0x9125('0xc')](_0x9125('0x74'),'Account.key');_0xa76d27[_0x9125('0xc')](_0x9125('0x75'),_0x9125('0x76'));if(_0x531d77===_0x9125('0x31')){_0xa76d27['field'](_0x9125('0x77'),_0x9125('0x78'));_0xa76d27['field'](_0x9125('0x79'),_0x9125('0x7a'));_0xa76d27[_0x9125('0xc')](_0x9125('0x7b'));_0xa76d27[_0x9125('0xc')](_0x9125('0x7c'));_0xa76d27[_0x9125('0xc')](_0x9125('0x7d'));_0xa76d27[_0x9125('0xc')](_0x9125('0x7e'));_0xa76d27[_0x9125('0xc')](_0x9125('0x7f'));_0xa76d27[_0x9125('0xc')]('i.attach');_0xa76d27[_0x9125('0xc')](_0x9125('0x80'));_0xa76d27[_0x9125('0xc')]('i.lastMsgDirection');_0xa76d27[_0x9125('0xc')](_0x9125('0x81'));_0xa76d27[_0x9125('0xc')](_0x9125('0x68'));_0xa76d27[_0x9125('0xc')](_0x9125('0x67'));_0xa76d27[_0x9125('0xc')](_0x9125('0x82'));_0xa76d27['field'](_0x9125('0x6a'));_0xa76d27['field'](_0x9125('0x83'));_0xa76d27[_0x9125('0xc')](_0x9125('0x84'));_0xa76d27[_0x9125('0xc')]('i.MailAccountId');_0xa76d27[_0x9125('0xc')]('i.UserId');}else if(_0x531d77===_0x9125('0x2f')){_0xa76d27[_0x9125('0xc')](_0x9125('0x85'),_0x9125('0x7a'));}else{_0xa76d27['field'](_0x9125('0x86'),_0x9125('0x7a'));}if(_0x531d77!==_0x9125('0x31')){_0xa76d27[_0x9125('0xc')](_0x9125('0x87'));}_0xa76d27['field']('c.firstName',_0x9125('0x88'));_0xa76d27[_0x9125('0xc')](_0x9125('0x89'),_0x9125('0x8a'));_0xa76d27[_0x9125('0xc')](_0x9125('0x8b'),'Contact.email');_0xa76d27['field'](_0x9125('0x8c'),_0x9125('0x8d'));_0xa76d27['field'](_0x9125('0x8e'),_0x9125('0x8f'));_0xa76d27[_0x9125('0xc')]('c.fax',_0x9125('0x90'));_0xa76d27[_0x9125('0xc')](_0x9125('0x91'),_0x9125('0x92'));_0xa76d27[_0x9125('0xc')]('o.internal',_0x9125('0x93'));_0xa76d27[_0x9125('0xc')](_0x9125('0x94'),'TagIds');}if(_0x33e2e9['limit']){_0xa76d27[_0x9125('0x95')](_0x33e2e9[_0x9125('0x95')]);}if(_0x33e2e9['offset']){_0xa76d27[_0x9125('0x96')](_0x33e2e9[_0x9125('0x96')]);}return db[_0x9125('0x6f')]['query'](_0xa76d27[_0x9125('0x97')](),_0x472780);})['then'](function(_0x1739d1){_0x495d59=_0x1739d1;var _0x57fd93=getUsersQuery(_0x531d77,_0x495d59);return db[_0x9125('0x6f')][_0x9125('0x70')](_0x57fd93[_0x9125('0x97')](),_0x472780);})['then'](function(_0x29223d){_0x218ec5=_[_0x9125('0x98')](_0x29223d,_0x34e783);if(_0x531d77===_0x9125('0x31')){return db['Setting'][_0x9125('0x99')]({'attributes':[_0x9125('0x9a')],'raw':!![]});}})['then'](function(_0x3aa79c){var _0x27a52f=_0x3aa79c?_0x3aa79c[_0x9125('0x9a')]:undefined;var _0xf588bd=_0x495d59[_0x9125('0x18')](function(_0x463f80){return updateInteraction(_0x463f80,_0x2b7f13,_0x218ec5,_0x27a52f);});return Promise[_0x9125('0x9b')](_0xf588bd);});}function countFilteredInteractions(_0x1cf267,_0x40ee28){var _0x55e456=_0x1cf267[_0x9125('0x9c')]();_0x55e456[_0x9125('0xc')](_0x9125('0x9d'));_0x55e456[_0x9125('0xc')](_0x9125('0x73'),_0x9125('0x40'));var _0x44f769=utils[_0x9125('0x25')](_0x40ee28);if(!_[_0x9125('0x9e')](_0x44f769)){_0x55e456[_0x9125('0x16')](_0x9125('0x9f'),_0x44f769);}var _0x579720={'type':db[_0x9125('0x6e')][_0x9125('0xa0')][_0x9125('0xa1')],'raw':!![]};return db[_0x9125('0x6f')]['query'](_0x55e456['toString'](),_0x579720);}module[_0x9125('0xa2')]={'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 3bda669..41385f2 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 _0xc0f9=['waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','findOne','-id','then','plainBody','lastMsgText','catch','TagIds','Tags','lodash','../../mysqldb','fullname','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc0f9,0x176));var _0x9c0f=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xc0f9[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x9c0f('0x0'));var db=require(_0x9c0f('0x1'))['db'];function getInteractionUsers(_0x11f4a4,_0x5f3501){return new Promise(function(_0x383d6f,_0x5562de){try{var _0x26839a=[];if(_0x5f3501[_0x11f4a4]){_0x26839a=_0x5f3501[_0x11f4a4]['map'](function(_0x3e10c9){return{'id':_0x3e10c9['id'],'fullname':_0x3e10c9[_0x9c0f('0x2')]};});}return _0x383d6f(_0x26839a);}catch(_0x14964f){_0x5562de(_0x14964f);}});}function getInteractionTags(_0x8a0167,_0x2a3932){var _0x58e7c7=[];if(_0x8a0167){_0x8a0167['split'](',')['forEach'](function(_0x50cb36){_0x58e7c7[_0x9c0f('0x3')](_0x2a3932[_0x50cb36]);});}return _0x58e7c7;}function updateWaitingCounter(_0x3bb22b){if(_0x3bb22b[_0x9c0f('0x4')]){_0x3bb22b['waiting']-=0x1;}}function updateInteractionCounters(_0x88c383){_0x88c383[_0x9c0f('0x4')]=0x0;_0x88c383[_0x9c0f('0x5')]=0x0;_0x88c383[_0x9c0f('0x6')]=0x0;_0x88c383[_0x9c0f('0x7')]=0x0;_0x88c383[_0x9c0f('0x8')]=0x0;_0x88c383[_0x9c0f('0x9')]=0x0;if(_0x88c383[_0x9c0f('0xa')]){if(_0x88c383[_0x9c0f('0xb')]==='abandoned'){_0x88c383[_0x9c0f('0x8')]+=0x1;updateWaitingCounter(_0x88c383);}if(_0x88c383[_0x9c0f('0xc')]){_0x88c383[_0x9c0f('0x6')]+=0x1;if(_0x88c383[_0x9c0f('0x5')]){_0x88c383[_0x9c0f('0x5')]-=0x1;}}else{if(_0x88c383[_0x9c0f('0xb')]){_0x88c383[_0x9c0f('0x7')]+=0x1;updateWaitingCounter(_0x88c383);}}}else{if(!_0x88c383[_0x9c0f('0xc')]){_0x88c383['waiting']+=0x1;}if(_0x88c383[_0x9c0f('0xc')]){_0x88c383[_0x9c0f('0x5')]+=0x1;updateWaitingCounter(_0x88c383);}}_0x88c383[_0x9c0f('0x9')]+=0x1;return _0x88c383;}function getLastMessageText(_0x38fc5c){return db['MailMessage'][_0x9c0f('0xd')]({'where':{'$and':[{'MailInteractionId':_0x38fc5c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x9c0f('0xe'),'raw':!![]})[_0x9c0f('0xf')](function(_0xf51cba){if(_0xf51cba&&_0xf51cba[_0x9c0f('0x10')]){_0x38fc5c[_0x9c0f('0x11')]=_['trimStart'](_0xf51cba[_0x9c0f('0x10')]);}return _0x38fc5c;})[_0x9c0f('0x12')](function(_0x358b19){throw _0x358b19;});}exports['updateInteraction']=function(_0x11df7e,_0x425b78,_0x57f696,_0x458384){return new Promise(function(_0x574f73,_0x16d803){return getInteractionUsers(_0x11df7e['id'],_0x57f696)[_0x9c0f('0xf')](function(_0xa04f2e){_0x11df7e['Users']=_0xa04f2e;return getInteractionTags(_0x11df7e[_0x9c0f('0x13')],_0x425b78);})[_0x9c0f('0xf')](function(_0x21a636){_0x11df7e[_0x9c0f('0x14')]=_0x21a636;delete _0x11df7e[_0x9c0f('0x13')];return updateInteractionCounters(_0x11df7e);})[_0x9c0f('0xf')](function(_0x50cbd3){if(_0x458384){return getLastMessageText(_0x50cbd3);}else{return _0x50cbd3;}})[_0x9c0f('0xf')](function(_0x42d2f4){_0x574f73(_0x42d2f4);})[_0x9c0f('0x12')](function(_0x4ded6e){_0x16d803(_0x4ded6e);});});}; \ No newline at end of file +var _0xeb91=['UserId','MailMessage','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','catch','lodash','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','disposition'];(function(_0x4ecd8f,_0x2aceb7){var _0x579f24=function(_0x45b431){while(--_0x45b431){_0x4ecd8f['push'](_0x4ecd8f['shift']());}};_0x579f24(++_0x2aceb7);}(_0xeb91,0x12b));var _0x1eb9=function(_0x3ca879,_0x2e88ee){_0x3ca879=_0x3ca879-0x0;var _0x1f0bae=_0xeb91[_0x3ca879];return _0x1f0bae;};'use strict';var _=require(_0x1eb9('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x270e05,_0x405939){return new Promise(function(_0x49d851,_0x318628){try{var _0x446059=[];if(_0x405939[_0x270e05]){_0x446059=_0x405939[_0x270e05][_0x1eb9('0x1')](function(_0x2180ef){return{'id':_0x2180ef['id'],'fullname':_0x2180ef[_0x1eb9('0x2')]};});}return _0x49d851(_0x446059);}catch(_0x35d5ab){_0x318628(_0x35d5ab);}});}function getInteractionTags(_0x17dd89,_0x70de57){var _0x22da98=[];if(_0x17dd89){_0x17dd89[_0x1eb9('0x3')](',')[_0x1eb9('0x4')](function(_0x18d15c){_0x22da98[_0x1eb9('0x5')](_0x70de57[_0x18d15c]);});}return _0x22da98;}function updateWaitingCounter(_0x5da943){if(_0x5da943[_0x1eb9('0x6')]){_0x5da943[_0x1eb9('0x6')]-=0x1;}}function updateInteractionCounters(_0x5b86b6){_0x5b86b6['waiting']=0x0;_0x5b86b6[_0x1eb9('0x7')]=0x0;_0x5b86b6[_0x1eb9('0x8')]=0x0;_0x5b86b6[_0x1eb9('0x9')]=0x0;_0x5b86b6[_0x1eb9('0xa')]=0x0;_0x5b86b6[_0x1eb9('0xb')]=0x0;if(_0x5b86b6['closed']){if(_0x5b86b6[_0x1eb9('0xc')]===_0x1eb9('0xa')){_0x5b86b6[_0x1eb9('0xa')]+=0x1;updateWaitingCounter(_0x5b86b6);}if(_0x5b86b6[_0x1eb9('0xd')]){_0x5b86b6[_0x1eb9('0x8')]+=0x1;if(_0x5b86b6[_0x1eb9('0x7')]){_0x5b86b6[_0x1eb9('0x7')]-=0x1;}}else{if(_0x5b86b6[_0x1eb9('0xc')]){_0x5b86b6['unmanaged']+=0x1;updateWaitingCounter(_0x5b86b6);}}}else{if(!_0x5b86b6[_0x1eb9('0xd')]){_0x5b86b6[_0x1eb9('0x6')]+=0x1;}if(_0x5b86b6[_0x1eb9('0xd')]){_0x5b86b6[_0x1eb9('0x7')]+=0x1;updateWaitingCounter(_0x5b86b6);}}_0x5b86b6[_0x1eb9('0xb')]+=0x1;return _0x5b86b6;}function getLastMessageText(_0x363b27){return db[_0x1eb9('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x363b27['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1eb9('0xf')],'order':_0x1eb9('0x10'),'raw':!![]})[_0x1eb9('0x11')](function(_0x1ad88d){if(_0x1ad88d&&_0x1ad88d[_0x1eb9('0xf')]){_0x363b27[_0x1eb9('0x12')]=_[_0x1eb9('0x13')](_0x1ad88d[_0x1eb9('0xf')]);}return _0x363b27;})['catch'](function(_0x5cfadf){throw _0x5cfadf;});}exports[_0x1eb9('0x14')]=function(_0x147942,_0x4f62a8,_0x421c38,_0x40e8ac){return new Promise(function(_0x2a371a,_0x130a63){return getInteractionUsers(_0x147942['id'],_0x421c38)[_0x1eb9('0x11')](function(_0x35b42f){_0x147942[_0x1eb9('0x15')]=_0x35b42f;return getInteractionTags(_0x147942[_0x1eb9('0x16')],_0x4f62a8);})[_0x1eb9('0x11')](function(_0xfcd357){_0x147942['Tags']=_0xfcd357;delete _0x147942['TagIds'];return updateInteractionCounters(_0x147942);})[_0x1eb9('0x11')](function(_0x3ca638){if(_0x40e8ac){return getLastMessageText(_0x3ca638);}else{return _0x3ca638;}})[_0x1eb9('0x11')](function(_0x421acf){_0x2a371a(_0x421acf);})[_0x1eb9('0x17')](function(_0xe6f3f){_0x130a63(_0xe6f3f);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index cad865f..35f1b91 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 _0xcdbc=['name','stringify','null','Interaction','findOne','then','update','catch','error','exports','lodash','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','accounts','_interactions','_messages','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcdbc,0x1bd));var _0xccdb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcdbc[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xccdb('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xccdb('0x1'))(_0xccdb('0x2')),'mail':require(_0xccdb('0x1'))('mail-interactions'),'fax':require(_0xccdb('0x1'))(_0xccdb('0x3')),'sms':require(_0xccdb('0x1'))('sms-interactions'),'chat':require(_0xccdb('0x1'))(_0xccdb('0x4')),'whatsapp':require(_0xccdb('0x1'))(_0xccdb('0x5'))};function getAccountFK(_0x1fdc40){return _[_0xccdb('0x6')](_0x1fdc40)+(_0x1fdc40===_0xccdb('0x7')?_0xccdb('0x8'):_0xccdb('0x9'))+'Id';}function getInteractionFK(_0x2b48a4){return _[_0xccdb('0x6')](_0x2b48a4)+'InteractionId';}function getInteractionId(_0x28ef70,_0x3b4fce,_0x2f07e9){if(_0x28ef70&&_0x28ef70[_[_0xccdb('0xa')](_0x2f07e9)+_0xccdb('0xb')]){return _0x28ef70[_[_0xccdb('0xa')](_0x2f07e9)+'InteractionId'];}else if(_0x28ef70&&_0x28ef70['id']){return _0x28ef70['id'];}else if(_0x3b4fce&&_0x3b4fce['id']){return _0x3b4fce['id'];}else{return _0xccdb('0xc');}}function getInteractionsTables(_0x4e53b4){return{'accounts':_0x4e53b4+'_'+(_0x4e53b4==='chat'?_0xccdb('0xd'):_0xccdb('0xe')),'interactions':_0x4e53b4+_0xccdb('0xf'),'interactionsTags':_0x4e53b4+'_interaction_has_tags','messages':_0x4e53b4+_0xccdb('0x10'),'userInteractions':'user_has_'+_0x4e53b4+_0xccdb('0xf')};}function getSelectedTags(_0x399f6a){var _0x218c98=[];if(_0x399f6a){_0x218c98=Array[_0xccdb('0x11')](_0x399f6a)?_0x399f6a:[_0x399f6a];}return _0x218c98;}function log(_0x36bfe1,_0x50f579,_0x5ed9c3,_0x5eef82,_0x56e40c,_0x11b3b5){loggers[_0x56e40c['toLowerCase']()][_0x36bfe1](_0xccdb('0x12'),_0x11b3b5['toUpperCase'](),_0x50f579?_0x50f579['id']:null,_0x50f579?_0x50f579[_0xccdb('0x13')]:null,_0x50f579?_0x50f579['role']:null,getInteractionId(_0x5ed9c3,_0x5eef82,_0x56e40c),_0x5ed9c3?JSON[_0xccdb('0x14')](_0x5ed9c3):_0xccdb('0x15'));}function updateUser(_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0){db[_['upperFirst'](_0xa8d08b)+_0xccdb('0x16')][_0xccdb('0x17')]({'where':{'id':getInteractionId(_0x4acb40,_0x4216c4,_0xa8d08b)}})[_0xccdb('0x18')](function(_0x1cf573){if(_0x1cf573){return _0x1cf573[_0xccdb('0x19')]({'UserId':_0x375d88?_0x375d88['id']:null});}})[_0xccdb('0x18')](function(_0x56d504){if(_0x56d504){log('info',_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0);}})[_0xccdb('0x1a')](function(){log(_0xccdb('0x1b'),_0x375d88,_0x4acb40,_0x4216c4,_0xa8d08b,_0x20a8a0);});}module[_0xccdb('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe042=['openchannel-interactions','mail-interactions','../../config/logger','chat-interactions','whatsapp-interactions','capitalize','Website','Account','upperFirst','InteractionId','unknown','chat','websites','_interaction_has_tags','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','Interaction','update','info','error','exports','lodash','../../mysqldb'];(function(_0x37a4bc,_0x288035){var _0x12b0b5=function(_0xc5351f){while(--_0xc5351f){_0x37a4bc['push'](_0x37a4bc['shift']());}};_0x12b0b5(++_0x288035);}(_0xe042,0x8a));var _0x2e04=function(_0x35c5a8,_0x8ecb48){_0x35c5a8=_0x35c5a8-0x0;var _0x34782c=_0xe042[_0x35c5a8];return _0x34782c;};'use strict';var _=require(_0x2e04('0x0'));var db=require(_0x2e04('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x2e04('0x2')),'mail':require('../../config/logger')(_0x2e04('0x3')),'fax':require(_0x2e04('0x4'))('fax-interactions'),'sms':require(_0x2e04('0x4'))('sms-interactions'),'chat':require(_0x2e04('0x4'))(_0x2e04('0x5')),'whatsapp':require(_0x2e04('0x4'))(_0x2e04('0x6'))};function getAccountFK(_0x57962a){return _[_0x2e04('0x7')](_0x57962a)+(_0x57962a==='chat'?_0x2e04('0x8'):_0x2e04('0x9'))+'Id';}function getInteractionFK(_0x2f5e1b){return _['capitalize'](_0x2f5e1b)+'InteractionId';}function getInteractionId(_0x1f8039,_0x59252c,_0x42f278){if(_0x1f8039&&_0x1f8039[_[_0x2e04('0xa')](_0x42f278)+_0x2e04('0xb')]){return _0x1f8039[_['upperFirst'](_0x42f278)+'InteractionId'];}else if(_0x1f8039&&_0x1f8039['id']){return _0x1f8039['id'];}else if(_0x59252c&&_0x59252c['id']){return _0x59252c['id'];}else{return _0x2e04('0xc');}}function getInteractionsTables(_0x4d2ef6){return{'accounts':_0x4d2ef6+'_'+(_0x4d2ef6===_0x2e04('0xd')?_0x2e04('0xe'):'accounts'),'interactions':_0x4d2ef6+'_interactions','interactionsTags':_0x4d2ef6+_0x2e04('0xf'),'messages':_0x4d2ef6+'_messages','userInteractions':_0x2e04('0x10')+_0x4d2ef6+'_interactions'};}function getSelectedTags(_0x1ad819){var _0xffa04d=[];if(_0x1ad819){_0xffa04d=Array[_0x2e04('0x11')](_0x1ad819)?_0x1ad819:[_0x1ad819];}return _0xffa04d;}function log(_0x386ea9,_0x464126,_0x41e0b4,_0x1599ba,_0x4f9004,_0x1a5b13){loggers[_0x4f9004[_0x2e04('0x12')]()][_0x386ea9](_0x2e04('0x13'),_0x1a5b13[_0x2e04('0x14')](),_0x464126?_0x464126['id']:null,_0x464126?_0x464126[_0x2e04('0x15')]:null,_0x464126?_0x464126['role']:null,getInteractionId(_0x41e0b4,_0x1599ba,_0x4f9004),_0x41e0b4?JSON[_0x2e04('0x16')](_0x41e0b4):'null');}function updateUser(_0x45ef70,_0x16bfb7,_0xbbae6e,_0x2f41cb,_0x2128c3){db[_[_0x2e04('0xa')](_0x2f41cb)+_0x2e04('0x17')]['findOne']({'where':{'id':getInteractionId(_0x16bfb7,_0xbbae6e,_0x2f41cb)}})['then'](function(_0xaf1a13){if(_0xaf1a13){return _0xaf1a13[_0x2e04('0x18')]({'UserId':_0x45ef70?_0x45ef70['id']:null});}})['then'](function(_0x2bdacd){if(_0x2bdacd){log(_0x2e04('0x19'),_0x45ef70,_0x16bfb7,_0xbbae6e,_0x2f41cb,_0x2128c3);}})['catch'](function(){log(_0x2e04('0x1a'),_0x45ef70,_0x16bfb7,_0xbbae6e,_0x2f41cb,_0x2128c3);});}module[_0x2e04('0x1b')]={'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 2bc1506..326b7db 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 _0xda3c=['use','then','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','crypto','util','composable-middleware','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','parse','hasOwnProperty'];(function(_0x1216f7,_0x443714){var _0x1a1850=function(_0x2081eb){while(--_0x2081eb){_0x1216f7['push'](_0x1216f7['shift']());}};_0x1a1850(++_0x443714);}(_0xda3c,0x1d1));var _0xcda3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xda3c[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0xcda3('0x0'));var util=require(_0xcda3('0x1'));var compose=require(_0xcda3('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xcda3('0x3'));function getValueFromLicense(_0x3661c3,_0x49cb57){if(_0x3661c3&&_0x49cb57){if(_0x49cb57[_0xcda3('0x4')]&&_0x49cb57['license']){var _0x884a02=_0x49cb57[_0xcda3('0x4')];var _0x455b81=_0x49cb57[_0xcda3('0x5')];var _0x226c4e=_0x884a02['split']('-')[0x4];var _0x2e568c=_0x884a02[_0xcda3('0x6')]('-')[0x0];var _0x311fa7=crypto['createDecipher'](_0xcda3('0x7'),util[_0xcda3('0x8')](_0xcda3('0x9'),_0x226c4e,_0x884a02,_0x2e568c));var _0x3ce395=_0x311fa7[_0xcda3('0xa')](_0x455b81,_0xcda3('0xb'),_0xcda3('0xc'));_0x3ce395+=_0x311fa7['final'](_0xcda3('0xc'));var _0xe18d69=JSON[_0xcda3('0xd')](_0x3ce395);return _0xe18d69[_0xcda3('0xe')](_0x3661c3)?_0xe18d69[_0x3661c3]:null;}}return null;}function isLimit(_0x490ee7,_0x40246a,_0xee4bc,_0x2a3fa4){var _0x3a4470=_0x40246a;return compose()[_0xcda3('0xf')](function(_0x30cd69,_0x1e4f62,_0xa62158){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0xcda3('0x10')](function(_0x1cc848){var _0x589b3b=getValueFromLicense(_0x490ee7,_0x1cc848);return _0x589b3b?_0x589b3b:_0x3a4470;})[_0xcda3('0x10')](function(_0x2c275e){_0x3a4470=_0x2c275e;return _0xee4bc['count'](_0x2a3fa4);})['then'](function(_0x4f2e03){if(_0x4f2e03>=_0x3a4470){return _0x1e4f62[_0xcda3('0x11')](0x193)[_0xcda3('0x12')]({'message':util[_0xcda3('0x8')](_0xcda3('0x13'),_0x490ee7)});}_0xa62158();})[_0xcda3('0x14')](function(_0x1e676f){_0xa62158(_0x1e676f);});});}function isUserLimit(){return isLimit(_0xcda3('0x15'),0x1,db[_0xcda3('0x16')],{'where':{'$or':[{'role':_0xcda3('0x17')},{'role':'user'}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x0f09=['status','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','isUserLimit','crypto','util','composable-middleware','data1','split','aes-256-ctr','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','count'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x0f09,0x84));var _0x90f0=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x0f09[_0x565c49];return _0x20ca34;};'use strict';var crypto=require(_0x90f0('0x0'));var util=require(_0x90f0('0x1'));var compose=require(_0x90f0('0x2'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x410897,_0x1362a7){if(_0x410897&&_0x1362a7){if(_0x1362a7[_0x90f0('0x3')]&&_0x1362a7['license']){var _0x208005=_0x1362a7[_0x90f0('0x3')];var _0x22f6d4=_0x1362a7['license'];var _0x545a92=_0x208005[_0x90f0('0x4')]('-')[0x4];var _0x16d494=_0x208005['split']('-')[0x0];var _0x4457ca=crypto['createDecipher'](_0x90f0('0x5'),util['format'](_0x90f0('0x6'),_0x545a92,_0x208005,_0x16d494));var _0x58d367=_0x4457ca[_0x90f0('0x7')](_0x22f6d4,_0x90f0('0x8'),'utf8');_0x58d367+=_0x4457ca[_0x90f0('0x9')](_0x90f0('0xa'));var _0x593257=JSON[_0x90f0('0xb')](_0x58d367);return _0x593257[_0x90f0('0xc')](_0x410897)?_0x593257[_0x410897]:null;}}return null;}function isLimit(_0x328850,_0x2b6701,_0x3eed72,_0x5220cf){var _0x38d5d3=_0x2b6701;return compose()[_0x90f0('0xd')](function(_0x27df2e,_0x3e8af3,_0x44fddf){return db[_0x90f0('0xe')][_0x90f0('0xf')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x2731ab){var _0x454dc5=getValueFromLicense(_0x328850,_0x2731ab);return _0x454dc5?_0x454dc5:_0x38d5d3;})[_0x90f0('0x10')](function(_0x194a66){_0x38d5d3=_0x194a66;return _0x3eed72[_0x90f0('0x11')](_0x5220cf);})['then'](function(_0x5c662a){if(_0x5c662a>=_0x38d5d3){return _0x3e8af3[_0x90f0('0x12')](0x193)['json']({'message':util[_0x90f0('0x13')](_0x90f0('0x14'),_0x328850)});}_0x44fddf();})[_0x90f0('0x15')](function(_0x33b274){_0x44fddf(_0x33b274);});});}function isUserLimit(){return isLimit(_0x90f0('0x16'),0x1,db['User'],{'where':{'$or':[{'role':_0x90f0('0x17')},{'role':'user'}]}});}exports[_0x90f0('0x18')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 9abd0e4..b25201c 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 _0x7692=['[$or]','replace','[$and]','split','length','slice','forEach','shift','match','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','hours','minutes','seconds','lodash','parseSearch','sqlOperator','startsWith'];(function(_0x32f571,_0x4e7961){var _0x31e1ae=function(_0x5f0cce){while(--_0x5f0cce){_0x32f571['push'](_0x32f571['shift']());}};_0x31e1ae(++_0x4e7961);}(_0x7692,0xa1));var _0x2769=function(_0x332c1b,_0x28d711){_0x332c1b=_0x332c1b-0x0;var _0x21b49b=_0x7692[_0x332c1b];return _0x21b49b;};'use strict';var _=require(_0x2769('0x0'));var moment=require('moment');exports[_0x2769('0x1')]=function(_0x353ae4){var _0x57a0de={'conditions':[]};_0x57a0de[_0x2769('0x2')]=_[_0x2769('0x3')](_0x353ae4,_0x2769('0x4'))?'or':'and';var _0x15aed5=_0x353ae4[_0x2769('0x5')](_0x2769('0x6'),'')[_0x2769('0x5')]('[$or]','')[_0x2769('0x7')]('||');for(var _0x46e6b9=0x0;_0x46e6b9<_0x15aed5[_0x2769('0x8')];_0x46e6b9++){var _0x5cd983=_0x15aed5[_0x46e6b9][_0x2769('0x7')](':=');var _0xe49c60=_0x5cd983[0x0];var _0x177e5c=_0x5cd983[_0x2769('0x9')](0x1);_0x177e5c[_0x2769('0xa')](function(_0x28d7e8){var _0x3ae101=_0x28d7e8[_0x2769('0x7')]('[')[_0x2769('0xb')]();var _0x498153=_0x28d7e8[_0x2769('0xc')](/\[(.*?)\]/g);_0x498153[_0x2769('0xa')](function(_0x3b14f6){var _0x5d6df8=_0x3b14f6['split']('[')['filter'](function(_0x95c742){return _0x95c742['indexOf'](']')>-0x1;})[_0x2769('0xd')](function(_0x5100e0){return _0x5100e0[_0x2769('0x7')](']')[0x0];})[0x0];_0x57a0de[_0x2769('0xe')][_0x2769('0xf')]({'field':_0xe49c60,'operator':_0x3ae101,'value':_0x5d6df8});});});}return _0x57a0de;};exports[_0x2769('0x10')]=function(_0x5b94c0,_0x3c0626,_0x5e6986){var _0x4e872d={};if(_0x3c0626===_0x2769('0x11')){if(_0x5e6986[_0x2769('0x12')]===_0x2769('0x13')){_0x5e6986['operator']=_0x2769('0x14');_0x5e6986['value']+=','+_0x5e6986[_0x2769('0x15')];}else if(_[_0x2769('0x16')]([_0x2769('0x17'),_0x2769('0x18')],_0x5e6986['operator'])){_0x5e6986[_0x2769('0x15')]=moment(_0x5e6986[_0x2769('0x15')])[_0x2769('0x19')](0x1,'days')[_0x2769('0x1a')](_0x2769('0x1b'));}}if(_0x5e6986[_0x2769('0x1c')]){_0x3c0626=_0x5e6986[_0x2769('0x1c')];_0x4e872d[_0x2769('0x1d')]=_0x2769('0x1e')+_0x5b94c0+'.'+_0x5e6986[_0x2769('0x1f')]+'\x20AS\x20'+_0x5e6986[_0x2769('0x1c')]+')\x20'+parseOperator(_0x5e6986[_0x2769('0x12')]);}else{_0x4e872d[_0x2769('0x1d')]=_0x5b94c0+'.'+_0x5e6986[_0x2769('0x1f')]+'\x20'+parseOperator(_0x5e6986[_0x2769('0x12')]);}if(_[_0x2769('0x16')]([_0x2769('0x20'),_0x2769('0x21')],_0x5e6986[_0x2769('0x12')]))_0x4e872d[_0x2769('0x1d')]='('+_0x4e872d[_0x2769('0x1d')]+'\x20OR\x20'+_0x5b94c0+'.'+_0x5e6986[_0x2769('0x1f')]+_0x2769('0x22');_0x4e872d[_0x2769('0x15')]=parseValue(_0x3c0626,_0x5e6986[_0x2769('0x12')],_0x5e6986[_0x2769('0x15')]);return _0x4e872d;};function parseOperator(_0x1b0856){var _0x26902f;switch(_0x1b0856){case _0x2769('0x23'):_0x26902f=_0x2769('0x24');break;case _0x2769('0x21'):_0x26902f=_0x2769('0x25');break;case _0x2769('0x13'):_0x26902f=_0x2769('0x26');break;case _0x2769('0x20'):_0x26902f='<>\x20?';break;case _0x2769('0x27'):case _0x2769('0x28'):case _0x2769('0x29'):_0x26902f=_0x2769('0x2a');break;case _0x2769('0x2b'):_0x26902f=_0x2769('0x2c');break;case _0x2769('0x17'):_0x26902f=_0x2769('0x2d');break;case'$lte':_0x26902f='<=\x20?';break;case _0x2769('0x2e'):_0x26902f=_0x2769('0x2f');break;case _0x2769('0x14'):_0x26902f=_0x2769('0x30');break;}return _0x26902f;}function parseValue(_0x4d25a9,_0x2b0fc1,_0x5c0bcc){var _0x1cf7fe={'start':undefined,'end':undefined};switch(_0x2b0fc1){case'$in':case _0x2769('0x21'):_0x1cf7fe['start']=_0x5c0bcc[_0x2769('0x7')](',');break;case'$substring':_0x1cf7fe[_0x2769('0x31')]='%'+_0x5c0bcc+'%';break;case'$startsWith':_0x1cf7fe[_0x2769('0x31')]=_0x5c0bcc+'%';break;case'$endsWith':_0x1cf7fe[_0x2769('0x31')]='%'+_0x5c0bcc;break;case'$between':var _0x44821f=_0x5c0bcc[_0x2769('0x7')](',');var _0x5c0bcc=_0x44821f[_0x2769('0xb')]();var _0x15dad5=_0x44821f[_0x2769('0x32')]();if(_0x4d25a9==='DATE'){_0x5c0bcc=moment(_0x5c0bcc)[_0x2769('0x33')](0x0,!![])[_0x2769('0x1a')]();_0x15dad5=moment(_0x15dad5)[_0x2769('0x33')](0x0,!![])['add'](0x17,_0x2769('0x34'))['add'](0x3b,_0x2769('0x35'))[_0x2769('0x19')](0x3b,_0x2769('0x36'))[_0x2769('0x1a')]();}_0x1cf7fe={'start':_0x5c0bcc,'end':_0x15dad5};break;default:_0x1cf7fe['start']=_0x5c0bcc;break;}return _0x1cf7fe;} \ No newline at end of file +var _0x5da8=['BETWEEN\x20?\x20AND\x20?','start','$between','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','replace','[$and]','split','length','forEach','shift','match','indexOf','push','buildExpression','DATE','$eq','operator','value','$lte','days','format','YYYY-MM-DD','castTo','text','CAST(','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x5da8,0xe1));var _0x85da=function(_0x16bddd,_0x34c589){_0x16bddd=_0x16bddd-0x0;var _0x33fc0c=_0x5da8[_0x16bddd];return _0x33fc0c;};'use strict';var _=require(_0x85da('0x0'));var moment=require(_0x85da('0x1'));exports[_0x85da('0x2')]=function(_0x43cb4c){var _0x5a566d={'conditions':[]};_0x5a566d['sqlOperator']=_[_0x85da('0x3')](_0x43cb4c,_0x85da('0x4'))?'or':'and';var _0x15ea1c=_0x43cb4c[_0x85da('0x5')](_0x85da('0x6'),'')[_0x85da('0x5')]('[$or]','')[_0x85da('0x7')]('||');for(var _0x58ef22=0x0;_0x58ef22<_0x15ea1c[_0x85da('0x8')];_0x58ef22++){var _0x2d9f4d=_0x15ea1c[_0x58ef22][_0x85da('0x7')](':=');var _0x2b990b=_0x2d9f4d[0x0];var _0x5029cd=_0x2d9f4d['slice'](0x1);_0x5029cd[_0x85da('0x9')](function(_0x27d378){var _0x1087cc=_0x27d378[_0x85da('0x7')]('[')[_0x85da('0xa')]();var _0x2e77c1=_0x27d378[_0x85da('0xb')](/\[(.*?)\]/g);_0x2e77c1[_0x85da('0x9')](function(_0x57f6ca){var _0x1df68c=_0x57f6ca[_0x85da('0x7')]('[')['filter'](function(_0x234205){return _0x234205[_0x85da('0xc')](']')>-0x1;})['map'](function(_0x3cbc42){return _0x3cbc42[_0x85da('0x7')](']')[0x0];})[0x0];_0x5a566d['conditions'][_0x85da('0xd')]({'field':_0x2b990b,'operator':_0x1087cc,'value':_0x1df68c});});});}return _0x5a566d;};exports[_0x85da('0xe')]=function(_0x4423f0,_0x1981c2,_0xe04937){var _0x4e3b6a={};if(_0x1981c2===_0x85da('0xf')){if(_0xe04937['operator']===_0x85da('0x10')){_0xe04937[_0x85da('0x11')]='$between';_0xe04937[_0x85da('0x12')]+=','+_0xe04937[_0x85da('0x12')];}else if(_['includes'](['$gt',_0x85da('0x13')],_0xe04937[_0x85da('0x11')])){_0xe04937[_0x85da('0x12')]=moment(_0xe04937[_0x85da('0x12')])['add'](0x1,_0x85da('0x14'))[_0x85da('0x15')](_0x85da('0x16'));}}if(_0xe04937['castTo']){_0x1981c2=_0xe04937[_0x85da('0x17')];_0x4e3b6a[_0x85da('0x18')]=_0x85da('0x19')+_0x4423f0+'.'+_0xe04937[_0x85da('0x1a')]+_0x85da('0x1b')+_0xe04937['castTo']+')\x20'+parseOperator(_0xe04937[_0x85da('0x11')]);}else{_0x4e3b6a[_0x85da('0x18')]=_0x4423f0+'.'+_0xe04937[_0x85da('0x1a')]+'\x20'+parseOperator(_0xe04937[_0x85da('0x11')]);}if(_['includes']([_0x85da('0x1c'),'$notIn'],_0xe04937[_0x85da('0x11')]))_0x4e3b6a[_0x85da('0x18')]='('+_0x4e3b6a[_0x85da('0x18')]+_0x85da('0x1d')+_0x4423f0+'.'+_0xe04937[_0x85da('0x1a')]+_0x85da('0x1e');_0x4e3b6a[_0x85da('0x12')]=parseValue(_0x1981c2,_0xe04937['operator'],_0xe04937[_0x85da('0x12')]);return _0x4e3b6a;};function parseOperator(_0x41ba5d){var _0x283579;switch(_0x41ba5d){case _0x85da('0x1f'):_0x283579=_0x85da('0x20');break;case _0x85da('0x21'):_0x283579=_0x85da('0x22');break;case _0x85da('0x10'):_0x283579='=\x20?';break;case _0x85da('0x1c'):_0x283579=_0x85da('0x23');break;case _0x85da('0x24'):case _0x85da('0x25'):case _0x85da('0x26'):_0x283579=_0x85da('0x27');break;case'$lt':_0x283579=_0x85da('0x28');break;case'$gt':_0x283579=_0x85da('0x29');break;case _0x85da('0x13'):_0x283579=_0x85da('0x2a');break;case _0x85da('0x2b'):_0x283579=_0x85da('0x2c');break;case'$between':_0x283579=_0x85da('0x2d');break;}return _0x283579;}function parseValue(_0x45ff06,_0xa10c72,_0x558a5e){var _0xfe2509={'start':undefined,'end':undefined};switch(_0xa10c72){case _0x85da('0x1f'):case'$notIn':_0xfe2509[_0x85da('0x2e')]=_0x558a5e[_0x85da('0x7')](',');break;case _0x85da('0x24'):_0xfe2509[_0x85da('0x2e')]='%'+_0x558a5e+'%';break;case _0x85da('0x25'):_0xfe2509['start']=_0x558a5e+'%';break;case _0x85da('0x26'):_0xfe2509[_0x85da('0x2e')]='%'+_0x558a5e;break;case _0x85da('0x2f'):var _0x571bb6=_0x558a5e[_0x85da('0x7')](',');var _0x558a5e=_0x571bb6[_0x85da('0xa')]();var _0x2d4d0a=_0x571bb6[_0x85da('0x30')]();if(_0x45ff06==='DATE'){_0x558a5e=moment(_0x558a5e)[_0x85da('0x31')](0x0,!![])['format']();_0x2d4d0a=moment(_0x2d4d0a)['utcOffset'](0x0,!![])[_0x85da('0x32')](0x17,_0x85da('0x33'))[_0x85da('0x32')](0x3b,_0x85da('0x34'))[_0x85da('0x32')](0x3b,_0x85da('0x35'))['format']();}_0xfe2509={'start':_0x558a5e,'end':_0x2d4d0a};break;default:_0xfe2509['start']=_0x558a5e;break;}return _0xfe2509;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index c920b82..248e3f3 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 _0xdd73=['VIRTUAL','lower','options','include','includeAll','lodash','sequelize','moment','parse','keys','includes','model','alias','fields','raw','split','find','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','name','uniqueid','isArray','limit','offset','map','indexOf','priority','col','substr','DESC','cast','unsigned','ASC','omit','isObject','isString','length','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','push','$id','query','filters','attributes','intersection','order','sort','where','pick','filter','object','value','merge','type'];(function(_0x16e917,_0x1299a8){var _0x1fba51=function(_0x5dd818){while(--_0x5dd818){_0x16e917['push'](_0x16e917['shift']());}};_0x1fba51(++_0x1299a8);}(_0xdd73,0x14a));var _0x3dd7=function(_0x21046f,_0x51694e){_0x21046f=_0x21046f-0x0;var _0x3f8262=_0xdd73[_0x21046f];return _0x3f8262;};'use strict';var _=require(_0x3dd7('0x0'));var sequelize=require(_0x3dd7('0x1'));var moment=require(_0x3dd7('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x182349){var _0x1deb14=['ne'];try{var _0x1667b2=JSON[_0x3dd7('0x3')](_0x182349);var _0x527539=Object[_0x3dd7('0x4')](_0x1667b2)[0x0];return _0x1deb14[_0x3dd7('0x5')](_0x527539);}catch(_0x88ce77){return![];}}function getOperatorValue(_0x251289){var _0x29ca21=JSON[_0x3dd7('0x3')](_0x251289);var _0x244c2a=Object[_0x3dd7('0x4')](_0x29ca21)[0x0];var _0x4d3d2c=_0x29ca21[_0x244c2a];return{['$'+_0x244c2a]:_0x4d3d2c};}function parseIncludeModel(_0x21b90e){var _0x195629=JSON[_0x3dd7('0x3')](_0x21b90e);return{'model':db[_0x195629[_0x3dd7('0x6')]],'as':_0x195629[_0x3dd7('0x7')],'attributes':_0x195629[_0x3dd7('0x8')],'raw':_0x195629[_0x3dd7('0x9')]};}exports[_0x3dd7('0x8')]=function(_0x288461){var _0x446682=null;if(_0x288461){_0x446682=_0x288461[_0x3dd7('0xa')](',');}return _0x446682;};exports['filters']=function(_0x4ac6bd,_0x212270){var _0x3bcb7a={};if(!_['isEmpty'](_0x4ac6bd)){_['forOwn'](_0x4ac6bd,function(_0x1fef9a,_0x374da3){try{if(_0x212270){var _0x1c0ad2=_[_0x3dd7('0xb')](_0x212270,{'name':_0x374da3})||{};if(hasSequelizeOperator(_0x1fef9a)){_0x3bcb7a[_0x374da3]=getOperatorValue(_0x1fef9a);}else if(_0x1c0ad2['type']===_0x3dd7('0xc')&&_[_0x3dd7('0xd')](_0x1fef9a)){var _0x29c076=JSON[_0x3dd7('0x3')](_0x1fef9a);var _0x4662b6={'$gte':moment(moment(_0x29c076[_0x3dd7('0xe')])[_0x3dd7('0xf')](_0x3dd7('0x10')))[_0x3dd7('0x11')]()[_0x3dd7('0xf')](),'$lte':moment(moment(_0x29c076[_0x3dd7('0x12')])[_0x3dd7('0xf')](_0x3dd7('0x10')))[_0x3dd7('0x11')]()['subtract'](0x1,'s')[_0x3dd7('0xf')]()};_0x3bcb7a[_0x374da3]=_0x4662b6;}else if(_0x1c0ad2[_0x3dd7('0x13')]===_0x3dd7('0x14')){_0x3bcb7a[_0x374da3]=_0x1fef9a;}else{_0x3bcb7a[_0x374da3]=_[_0x3dd7('0x15')](_0x1fef9a)?_0x1fef9a:JSON[_0x3dd7('0x3')](_0x1fef9a);}}else{_0x3bcb7a[_0x374da3]=_['isArray'](_0x1fef9a)?_0x1fef9a:JSON['parse'](_0x1fef9a);}}catch(_0x56e870){_0x3bcb7a[_0x374da3]=_0x1fef9a['split'](',');}});}return _0x3bcb7a;};exports[_0x3dd7('0x16')]=function(_0x3afcfc){_0x3afcfc=parseInt(_0x3afcfc,0xa);if(!_0x3afcfc||_0x3afcfc<0x0){_0x3afcfc=LIMIT_VALUE;}return _0x3afcfc;};exports[_0x3dd7('0x17')]=function(_0x3e2311){_0x3e2311=parseInt(_0x3e2311,0xa);if(!_0x3e2311||_0x3e2311<0x0){_0x3e2311=0x0;}return _0x3e2311;};exports['sort']=function(_0x40049c){var _0x133db9,_0x191aef=null;if(_0x40049c){_0x133db9=_0x40049c[_0x3dd7('0xa')](',');_0x191aef=_[_0x3dd7('0x18')](_0x133db9,function(_0x3ede5a){if(_0x3ede5a[_0x3dd7('0x19')]('-')===0x0){return[_0x3ede5a===_0x3dd7('0x1a')?sequelize['cast'](sequelize[_0x3dd7('0x1b')](_0x3dd7('0x1a')),'unsigned'):_0x3ede5a[_0x3dd7('0x1c')](0x1),_0x3dd7('0x1d')];}else{return[_0x3ede5a===_0x3dd7('0x1a')?sequelize[_0x3dd7('0x1e')](sequelize[_0x3dd7('0x1b')](_0x3dd7('0x1a')),_0x3dd7('0x1f')):_0x3ede5a,_0x3dd7('0x20')];}});}return _0x191aef;};exports[_0x3dd7('0x21')]=function(_0x5645e1,_0x270c57){if(_['isEmpty'](_0x5645e1)){return _0x5645e1;}if(_[_0x3dd7('0x15')](_0x5645e1)){for(var _0x22f52a=0x0;_0x22f52a<_0x5645e1['length'];_0x22f52a+=0x1){_0x5645e1[_0x22f52a]=this[_0x3dd7('0x21')](_0x5645e1[_0x22f52a],_0x270c57);}return _0x5645e1;}if(!_[_0x3dd7('0x22')](_0x5645e1)){return _0x5645e1;}if(_[_0x3dd7('0x23')](_0x270c57)){_0x270c57=[_0x270c57];}if(!_['isArray'](_0x270c57)){return _0x5645e1;}for(var _0x17f91b=0x0;_0x17f91b<_0x270c57[_0x3dd7('0x24')];_0x17f91b+=0x1){_['unset'](_0x5645e1,_0x270c57[_0x17f91b]);}for(var _0x4dcad8 in _0x5645e1){if(_0x5645e1[_0x3dd7('0x25')](_0x4dcad8)){_0x5645e1[_0x4dcad8]=this[_0x3dd7('0x21')](_0x5645e1[_0x4dcad8],_0x270c57);}}return _0x5645e1;};exports[_0x3dd7('0x26')]=function(_0x519a3e){return _0x519a3e['match'](RegExp(_0x3dd7('0x27')))?!![]:![];};exports[_0x3dd7('0x28')]=function(_0x1b2f13){return _0x1b2f13[_0x3dd7('0x29')](/^\S+@\S+$/)?!![]:![];};exports[_0x3dd7('0x2a')]=function(_0x323387,_0x581890){var _0x657c49=[];var _0x40f92d=/[ `!@#$%^&*()_\-?~]/;var _0x2fe7e6=_0x581890?_0x3dd7('0x2b'):_0x3dd7('0x2c');_0x323387['split'](/[ ,]+/)['forEach'](function(_0x3b71f7){_0x3b71f7=_0x3b71f7['replace'](/([^:]")"+/g,'$1');_0x3b71f7='+'+_0x3b71f7+'*';var _0x294e1a=_0x3b71f7['match'](_0x40f92d);if(_0x294e1a){_0x3b71f7='\x22'+_0x3b71f7+'\x22';}_0x657c49[_0x3dd7('0x2d')](_0x3b71f7);});_0x2fe7e6=_0x2fe7e6['replace'](_0x3dd7('0x2c'),_0x657c49['join']('\x20'));return _0x2fe7e6;};exports['getOptions']=function(_0x432567,_0x288265,_0x49b160){var _0xab58b9={},_0x49dfa9={};if(_0x288265['query'][_0x3dd7('0x2e')]){_0x288265[_0x3dd7('0x2f')]['id']=_0x288265['query'][_0x3dd7('0x2e')];delete _0x288265[_0x3dd7('0x2f')][_0x3dd7('0x2e')];}_0xab58b9['model']=_[_0x3dd7('0x18')](_0x432567,'name');_0xab58b9[_0x3dd7('0x2f')]=_[_0x3dd7('0x4')](_0x288265[_0x3dd7('0x2f')]);_0xab58b9[_0x3dd7('0x30')]=_['intersection'](_0xab58b9[_0x3dd7('0x6')],_0xab58b9[_0x3dd7('0x2f')]);_0x49dfa9[_0x3dd7('0x31')]=_[_0x3dd7('0x32')](_0xab58b9[_0x3dd7('0x6')],this[_0x3dd7('0x8')](_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x8')]));_0x49dfa9['attributes']=_0x49dfa9[_0x3dd7('0x31')][_0x3dd7('0x24')]?_0x49dfa9[_0x3dd7('0x31')]:_0xab58b9[_0x3dd7('0x6')];if(!_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x25')]('nolimit')){_0x49dfa9[_0x3dd7('0x16')]=this['limit'](_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x16')]);_0x49dfa9[_0x3dd7('0x17')]=this[_0x3dd7('0x17')](_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x17')]);}_0x49dfa9[_0x3dd7('0x33')]=this[_0x3dd7('0x34')](_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x34')]);_0x49dfa9[_0x3dd7('0x35')]=this['filters'](_[_0x3dd7('0x36')](_0x288265[_0x3dd7('0x2f')],_0xab58b9[_0x3dd7('0x30')]),_0x432567);if(_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x37')]){var _0x3784cf=_0x432567;var _0x11093f=_0x288265[_0x3dd7('0x2f')][_0x3dd7('0x37')];if(typeof _0x11093f===_0x3dd7('0x38')){_0x3784cf=_[_0x3dd7('0x37')](_0x432567,function(_0x41cfd0){return _['includes'](_0x11093f['columns'],_0x41cfd0[_0x3dd7('0x13')]);});_0x11093f=_0x11093f[_0x3dd7('0x39')];}_0x49dfa9[_0x3dd7('0x35')]=_[_0x3dd7('0x3a')](_0x49dfa9[_0x3dd7('0x35')],{'$or':_[_0x3dd7('0x18')](_0x3784cf,function(_0x37bcfd){if(_0x37bcfd[_0x3dd7('0x3b')]!==_0x3dd7('0x3c')){if(_0x49b160){return sequelize[_0x3dd7('0x35')](sequelize['fn'](_0x3dd7('0x3d'),sequelize['col'](_0x37bcfd[_0x3dd7('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x288265['query'][_0x3dd7('0x37')]+'%')});}else{var _0xb59fe5={};_0xb59fe5[_0x37bcfd[_0x3dd7('0x13')]]={'$like':'%'+_0x288265['query'][_0x3dd7('0x37')]+'%'};return _0xb59fe5;}}})});}_0x49dfa9=_['merge']({},_0x49dfa9,_0x288265[_0x3dd7('0x3e')]);return _0x49dfa9;};exports[_0x3dd7('0x3f')]=function(_0x3541c3){var _0x3f8058=[];if(_0x3541c3[_0x3dd7('0x40')]){_0x3f8058[_0x3dd7('0x2d')]({'all':!![]});}else if(_0x3541c3[_0x3dd7('0x3f')]){if(Array[_0x3dd7('0x15')](_0x3541c3[_0x3dd7('0x3f')])){_0x3f8058=Object[_0x3dd7('0x4')](_0x3541c3[_0x3dd7('0x3f')])['map'](function(_0x33e08f){return parseIncludeModel(_0x3541c3['include'][_0x33e08f]);});}else{var _0x45a63b=parseIncludeModel(_0x3541c3[_0x3dd7('0x3f')]);_0x3f8058['push'](_0x45a63b);}}return _0x3f8058;}; \ No newline at end of file +var _0x26d1=['includeAll','push','lodash','moment','../../mysqldb','includes','parse','keys','model','alias','raw','fields','split','isEmpty','forOwn','find','isPlainObject','$gte','format','utc','$lte','YYYY-MM-DD','uniqueid','limit','offset','sort','indexOf','priority','cast','unsigned','substr','DESC','isArray','length','omit','isObject','isString','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','join','getOptions','query','$id','map','name','filters','intersection','attributes','nolimit','order','where','pick','filter','object','columns','value','merge','type','VIRTUAL','lower','options','include'];(function(_0x355aa3,_0x48bd30){var _0x1c0c3d=function(_0x3e71dc){while(--_0x3e71dc){_0x355aa3['push'](_0x355aa3['shift']());}};_0x1c0c3d(++_0x48bd30);}(_0x26d1,0x8e));var _0x126d=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x26d1[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x126d('0x0'));var sequelize=require('sequelize');var moment=require(_0x126d('0x1'));var db=require(_0x126d('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x37ff4c){var _0x2a20fc=['ne'];try{var _0x59d0a0=JSON['parse'](_0x37ff4c);var _0x3a3fb4=Object['keys'](_0x59d0a0)[0x0];return _0x2a20fc[_0x126d('0x3')](_0x3a3fb4);}catch(_0x7f89d4){return![];}}function getOperatorValue(_0x442e04){var _0x449ed0=JSON[_0x126d('0x4')](_0x442e04);var _0x4e5e87=Object[_0x126d('0x5')](_0x449ed0)[0x0];var _0x25ccc2=_0x449ed0[_0x4e5e87];return{['$'+_0x4e5e87]:_0x25ccc2};}function parseIncludeModel(_0x7d6e4c){var _0x2680a1=JSON[_0x126d('0x4')](_0x7d6e4c);return{'model':db[_0x2680a1[_0x126d('0x6')]],'as':_0x2680a1[_0x126d('0x7')],'attributes':_0x2680a1['fields'],'raw':_0x2680a1[_0x126d('0x8')]};}exports[_0x126d('0x9')]=function(_0x2e7a25){var _0x83f657=null;if(_0x2e7a25){_0x83f657=_0x2e7a25[_0x126d('0xa')](',');}return _0x83f657;};exports['filters']=function(_0x34d2e2,_0x51b929){var _0x1477a6={};if(!_[_0x126d('0xb')](_0x34d2e2)){_[_0x126d('0xc')](_0x34d2e2,function(_0x55bf88,_0xdcb472){try{if(_0x51b929){var _0x161b26=_[_0x126d('0xd')](_0x51b929,{'name':_0xdcb472})||{};if(hasSequelizeOperator(_0x55bf88)){_0x1477a6[_0xdcb472]=getOperatorValue(_0x55bf88);}else if(_0x161b26['type']==='DATE'&&_[_0x126d('0xe')](_0x55bf88)){var _0x43c755=JSON[_0x126d('0x4')](_0x55bf88);var _0x138223={'$gte':moment(moment(_0x43c755[_0x126d('0xf')])[_0x126d('0x10')]('YYYY-MM-DD'))[_0x126d('0x11')]()['format'](),'$lte':moment(moment(_0x43c755[_0x126d('0x12')])['format'](_0x126d('0x13')))[_0x126d('0x11')]()['subtract'](0x1,'s')[_0x126d('0x10')]()};_0x1477a6[_0xdcb472]=_0x138223;}else if(_0x161b26['name']===_0x126d('0x14')){_0x1477a6[_0xdcb472]=_0x55bf88;}else{_0x1477a6[_0xdcb472]=_['isArray'](_0x55bf88)?_0x55bf88:JSON['parse'](_0x55bf88);}}else{_0x1477a6[_0xdcb472]=_['isArray'](_0x55bf88)?_0x55bf88:JSON[_0x126d('0x4')](_0x55bf88);}}catch(_0xe15af5){_0x1477a6[_0xdcb472]=_0x55bf88[_0x126d('0xa')](',');}});}return _0x1477a6;};exports[_0x126d('0x15')]=function(_0x50ced7){_0x50ced7=parseInt(_0x50ced7,0xa);if(!_0x50ced7||_0x50ced7<0x0){_0x50ced7=LIMIT_VALUE;}return _0x50ced7;};exports[_0x126d('0x16')]=function(_0x27f656){_0x27f656=parseInt(_0x27f656,0xa);if(!_0x27f656||_0x27f656<0x0){_0x27f656=0x0;}return _0x27f656;};exports[_0x126d('0x17')]=function(_0x571f65){var _0x4cdfd6,_0x1c2a07=null;if(_0x571f65){_0x4cdfd6=_0x571f65[_0x126d('0xa')](',');_0x1c2a07=_['map'](_0x4cdfd6,function(_0x31a061){if(_0x31a061[_0x126d('0x18')]('-')===0x0){return[_0x31a061===_0x126d('0x19')?sequelize[_0x126d('0x1a')](sequelize['col'](_0x126d('0x19')),_0x126d('0x1b')):_0x31a061[_0x126d('0x1c')](0x1),_0x126d('0x1d')];}else{return[_0x31a061===_0x126d('0x19')?sequelize[_0x126d('0x1a')](sequelize['col']('priority'),_0x126d('0x1b')):_0x31a061,'ASC'];}});}return _0x1c2a07;};exports['omit']=function(_0x269588,_0x2f7889){if(_[_0x126d('0xb')](_0x269588)){return _0x269588;}if(_[_0x126d('0x1e')](_0x269588)){for(var _0xaf0d5a=0x0;_0xaf0d5a<_0x269588[_0x126d('0x1f')];_0xaf0d5a+=0x1){_0x269588[_0xaf0d5a]=this[_0x126d('0x20')](_0x269588[_0xaf0d5a],_0x2f7889);}return _0x269588;}if(!_[_0x126d('0x21')](_0x269588)){return _0x269588;}if(_[_0x126d('0x22')](_0x2f7889)){_0x2f7889=[_0x2f7889];}if(!_[_0x126d('0x1e')](_0x2f7889)){return _0x269588;}for(var _0x288868=0x0;_0x288868<_0x2f7889[_0x126d('0x1f')];_0x288868+=0x1){_['unset'](_0x269588,_0x2f7889[_0x288868]);}for(var _0x1f555b in _0x269588){if(_0x269588[_0x126d('0x23')](_0x1f555b)){_0x269588[_0x1f555b]=this[_0x126d('0x20')](_0x269588[_0x1f555b],_0x2f7889);}}return _0x269588;};exports[_0x126d('0x24')]=function(_0x42f905){return _0x42f905[_0x126d('0x25')](RegExp(_0x126d('0x26')))?!![]:![];};exports[_0x126d('0x27')]=function(_0x5c88a0){return _0x5c88a0[_0x126d('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0x126d('0x28')]=function(_0x38138d,_0x363bcd){var _0x38436a=[];var _0x444f02=/[ `!@#$%^&*()_\-?~]/;var _0x4c16b3=_0x363bcd?_0x126d('0x29'):_0x126d('0x2a');_0x38138d[_0x126d('0xa')](/[ ,]+/)[_0x126d('0x2b')](function(_0x1e9117){_0x1e9117=_0x1e9117['replace'](/([^:]")"+/g,'$1');_0x1e9117='+'+_0x1e9117+'*';var _0x4e1f8=_0x1e9117[_0x126d('0x25')](_0x444f02);if(_0x4e1f8){_0x1e9117='\x22'+_0x1e9117+'\x22';}_0x38436a['push'](_0x1e9117);});_0x4c16b3=_0x4c16b3[_0x126d('0x2c')](_0x126d('0x2a'),_0x38436a[_0x126d('0x2d')]('\x20'));return _0x4c16b3;};exports[_0x126d('0x2e')]=function(_0x13d7ae,_0x112c0a,_0x2cf5e9){var _0x4f32ac={},_0x4e19ee={};if(_0x112c0a[_0x126d('0x2f')][_0x126d('0x30')]){_0x112c0a[_0x126d('0x2f')]['id']=_0x112c0a[_0x126d('0x2f')]['$id'];delete _0x112c0a[_0x126d('0x2f')][_0x126d('0x30')];}_0x4f32ac[_0x126d('0x6')]=_[_0x126d('0x31')](_0x13d7ae,_0x126d('0x32'));_0x4f32ac[_0x126d('0x2f')]=_['keys'](_0x112c0a[_0x126d('0x2f')]);_0x4f32ac[_0x126d('0x33')]=_[_0x126d('0x34')](_0x4f32ac[_0x126d('0x6')],_0x4f32ac[_0x126d('0x2f')]);_0x4e19ee[_0x126d('0x35')]=_['intersection'](_0x4f32ac[_0x126d('0x6')],this[_0x126d('0x9')](_0x112c0a[_0x126d('0x2f')][_0x126d('0x9')]));_0x4e19ee[_0x126d('0x35')]=_0x4e19ee['attributes'][_0x126d('0x1f')]?_0x4e19ee[_0x126d('0x35')]:_0x4f32ac['model'];if(!_0x112c0a[_0x126d('0x2f')][_0x126d('0x23')](_0x126d('0x36'))){_0x4e19ee[_0x126d('0x15')]=this[_0x126d('0x15')](_0x112c0a[_0x126d('0x2f')][_0x126d('0x15')]);_0x4e19ee['offset']=this['offset'](_0x112c0a[_0x126d('0x2f')][_0x126d('0x16')]);}_0x4e19ee[_0x126d('0x37')]=this[_0x126d('0x17')](_0x112c0a[_0x126d('0x2f')][_0x126d('0x17')]);_0x4e19ee[_0x126d('0x38')]=this[_0x126d('0x33')](_[_0x126d('0x39')](_0x112c0a['query'],_0x4f32ac[_0x126d('0x33')]),_0x13d7ae);if(_0x112c0a[_0x126d('0x2f')][_0x126d('0x3a')]){var _0x447960=_0x13d7ae;var _0x3ad108=_0x112c0a[_0x126d('0x2f')][_0x126d('0x3a')];if(typeof _0x3ad108===_0x126d('0x3b')){_0x447960=_[_0x126d('0x3a')](_0x13d7ae,function(_0x3a82ff){return _[_0x126d('0x3')](_0x3ad108[_0x126d('0x3c')],_0x3a82ff[_0x126d('0x32')]);});_0x3ad108=_0x3ad108[_0x126d('0x3d')];}_0x4e19ee['where']=_[_0x126d('0x3e')](_0x4e19ee[_0x126d('0x38')],{'$or':_['map'](_0x447960,function(_0x469300){if(_0x469300[_0x126d('0x3f')]!==_0x126d('0x40')){if(_0x2cf5e9){return sequelize[_0x126d('0x38')](sequelize['fn'](_0x126d('0x41'),sequelize['col'](_0x469300[_0x126d('0x32')])),{'$like':sequelize['fn'](_0x126d('0x41'),'%'+_0x112c0a[_0x126d('0x2f')][_0x126d('0x3a')]+'%')});}else{var _0x30670e={};_0x30670e[_0x469300[_0x126d('0x32')]]={'$like':'%'+_0x112c0a['query'][_0x126d('0x3a')]+'%'};return _0x30670e;}}})});}_0x4e19ee=_['merge']({},_0x4e19ee,_0x112c0a[_0x126d('0x42')]);return _0x4e19ee;};exports[_0x126d('0x43')]=function(_0x445a20){var _0x16cb45=[];if(_0x445a20[_0x126d('0x44')]){_0x16cb45['push']({'all':!![]});}else if(_0x445a20[_0x126d('0x43')]){if(Array[_0x126d('0x1e')](_0x445a20[_0x126d('0x43')])){_0x16cb45=Object[_0x126d('0x5')](_0x445a20[_0x126d('0x43')])[_0x126d('0x31')](function(_0x14d4cf){return parseIncludeModel(_0x445a20['include'][_0x14d4cf]);});}else{var _0x2e373e=parseIncludeModel(_0x445a20[_0x126d('0x43')]);_0x16cb45[_0x126d('0x45')](_0x2e373e);}}return _0x16cb45;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 95ddeeb..0c0e4cc 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 _0xd61a=['phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','value','filterAgentAttributes','lodash','jayson/promise','../../mysqldb','client','chatPause','faxPause','smsPause','voicePause','every','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','openchannelStatus','smsStatus','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','request','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','isArray','Queue','map','findOne','getAgents','all','flatten','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','findAll','name','fullname','mailPause','openchannelPause','whatsappPause','pauseType','find','globalStatus','catch','order','startsWith','ASC','getUpdatedSortOptions','substring','indexOf','validateSortParameter','DESC','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','internal','address','chatCapacity','mailCapacity','smsCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','whatsappStatus','faxStatus','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','screenrecording'];(function(_0x3ac69a,_0x3263ad){var _0x2f403b=function(_0x1cd460){while(--_0x1cd460){_0x3ac69a['push'](_0x3ac69a['shift']());}};_0x2f403b(++_0x3263ad);}(_0xd61a,0x1c8));var _0xad61=function(_0x4d04d6,_0x38ae19){_0x4d04d6=_0x4d04d6-0x0;var _0x2e937a=_0xd61a[_0x4d04d6];return _0x2e937a;};'use strict';var _=require(_0xad61('0x0'));var jayson=require(_0xad61('0x1'));var db=require(_0xad61('0x2'))['db'];var amiClient=jayson[_0xad61('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0xad61('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x17b6a2,_0x38c2f4){var _0x452603=[_0x17b6a2[_0xad61('0x4')],_0x17b6a2[_0xad61('0x5')],_0x17b6a2['mailPause'],_0x17b6a2['openchannelPause'],_0x17b6a2[_0xad61('0x6')],_0x17b6a2[_0xad61('0x7')],_0x17b6a2['whatsappPause']];if(!_0x38c2f4)return _[_0xad61('0x8')](_0x452603);var _0x319f70=_[_0xad61('0x9')](_0x452603);return _0x319f70[_0xad61('0xa')]>0x0&&_0x319f70[_0xad61('0xa')]<_0x452603[_0xad61('0xa')]?!![]:![];}function isIdle(_0x3b6d84){return _0x3b6d84===_0xad61('0xb')||_0x3b6d84==='unknown'||_0x3b6d84===_0xad61('0xc')||_0x3b6d84===_0xad61('0xd')||_[_0xad61('0xe')](_0x3b6d84);}function isAgentIdle(_0x471c33){if(_0x471c33[_0xad61('0xf')]!==_0xad61('0xb')&&_0x471c33['voicePause']){_0x471c33[_0xad61('0xf')]=_0xad61('0x10');return![];}return _['every']([_0x471c33[_0xad61('0x11')],_0x471c33['faxStatus'],_0x471c33['mailStatus'],_0x471c33[_0xad61('0x12')],_0x471c33[_0xad61('0x13')],_0x471c33[_0xad61('0xf')],_0x471c33['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xad61('0x14'),{})[_0xad61('0x15')](function(_0x44a960){if(_0x44a960[_0xad61('0x16')]){throw new Error(_0xad61('0x17'));}var _0x1e482b=_0x44a960['result'];return routingClient[_0xad61('0x18')](_0xad61('0x14'),{})[_0xad61('0x15')](function(_0xc9b86a){if(_0xc9b86a[_0xad61('0x16')]){throw new Error(_0xad61('0x19'));}var _0x348b4a=_0xc9b86a['result'];return _[_0xad61('0x1a')]({},_0x1e482b,_0x348b4a);});})['catch'](function(_0x7229ba){throw _0x7229ba;});}exports[_0xad61('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x2003e2){var _0x1c9518='unknown';if(isAgentPaused(_0x2003e2))_0x1c9518=_0xad61('0x10');else if(isAgentPaused(_0x2003e2,!![]))_0x1c9518='*pause';else if(isAgentIdle(_0x2003e2))_0x1c9518=_0xad61('0xb');else _0x1c9518='busy';return _0x1c9518;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x1834a9,_0x125b4a){var _0x2b0d70=_[_0xad61('0x1c')](_0x1834a9)?_0x1834a9:[_0x1834a9];var _0x4f06af=_['startCase'](_0x125b4a)+_0xad61('0x1d');var _0x1842e5=_[_0xad61('0x1e')](_0x2b0d70,function(_0x5c769c){return db[_0x4f06af][_0xad61('0x1f')]({'where':{'id':_0x5c769c}})[_0xad61('0x15')](function(_0x4fd163){if(!_0x4fd163)return[];return _0x4fd163[_0xad61('0x20')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xad61('0x21')](_0x1842e5)[_0xad61('0x15')](function(_0x2bf8cd){var _0x22fddd=_(_0x2bf8cd)[_0xad61('0x22')]()[_0xad61('0x1e')]('id')['uniq']()['value']();return _0x22fddd;});}exports[_0xad61('0x23')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x44669d,_0x5a4e2f,_0x166fa7){try{if(_0x5a4e2f[_0xad61('0xa')]>0x0){_0x44669d=_0x44669d[_0xad61('0x9')](function(_0x4d36ff){return _0x5a4e2f[_0xad61('0x24')](_0x4d36ff['id']);});}var _0x14c42a=_0x44669d[_0xad61('0x9')](function(_0x522241){var _0x3b1ebd='busy';if(isAgentIdle(_0x522241)){_0x3b1ebd=_0xad61('0xb');}return _0x3b1ebd===_0x166fa7;});return _[_0xad61('0x1e')](_0x14c42a,'id');}catch(_0x448d02){throw _0x448d02;}}exports[_0xad61('0x25')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x22333d,_0x257144,_0x1c1c52){return Promise[_0xad61('0x26')]()[_0xad61('0x15')](function(){if(_0x257144[_0xad61('0xa')]>0x0){_0x22333d=_0x22333d['filter'](function(_0x4d1212){return _0x257144['includes'](_0x4d1212['id']);});}return _0x22333d;})[_0xad61('0x15')](function(){return db[_0xad61('0x27')][_0xad61('0x28')]({'attributes':['id',_0xad61('0x29'),_0xad61('0x2a'),_0xad61('0x4'),_0xad61('0x5'),_0xad61('0x2b'),_0xad61('0x2c'),_0xad61('0x6'),_0xad61('0x7'),_0xad61('0x2d'),_0xad61('0x2e')],'where':{'id':{'$in':_[_0xad61('0x1e')](_0x22333d,'id')}},'raw':!![]});})[_0xad61('0x15')](function(_0x113a06){return _0x113a06[_0xad61('0x1e')](function(_0x96e50d){var _0x1023be=_[_0xad61('0x2f')](_0x22333d,['id',_0x96e50d['id']]);var _0x115e69=filterAgentAttributes(_0x1023be);_['merge'](_0x96e50d,_0x115e69);_0x96e50d[_0xad61('0x30')]=getAgentStatus(_0x96e50d);return _0x96e50d;});})['then'](function(_0x23342d){var _0x16e980=sortAgentsByStatus(_0x23342d,_0x1c1c52);return _['map'](_0x16e980,'id');})[_0xad61('0x31')](function(_0x45c212){throw _0x45c212;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x54c95c){var _0x41e846={'fields':[],'order':null};var _0x33849c=_0x54c95c['split'](',');_0x41e846['fields']=_[_0xad61('0x9')](_0x33849c,function(_0x41e509){if(!_0x41e509[_0xad61('0x24')](_0xad61('0x30'))){return!![];}_0x41e846[_0xad61('0x32')]=_[_0xad61('0x33')](_0x41e509,'-')?'DESC':_0xad61('0x34');return![];});return _0x41e846;}exports[_0xad61('0x35')]=getUpdatedSortOptions;function validateSortParameter(_0xb50ffe){if(!_0xb50ffe){_0xb50ffe='fullname,internal';}if(_0xb50ffe[_0xad61('0x24')](_0xad61('0x2a'))&&!_0xb50ffe[_0xad61('0x24')]('internal')){var _0x2fd1e5=_0xb50ffe[_0xad61('0x36')](0x0,_0xb50ffe[_0xad61('0x37')](_0xad61('0x2a')));_0xb50ffe+=','+_0x2fd1e5+'internal';}return _0xb50ffe;}exports[_0xad61('0x38')]=validateSortParameter;function sortAgentsByStatus(_0x4e0370,_0x6dfa72){var _0x2da8b5=_0x4e0370['sort'](function(_0x62af16,_0x455f92){if(_0x62af16[_0xad61('0x30')]===_0x455f92[_0xad61('0x30')]){if(_0x62af16[_0xad61('0x30')]==='pause'){if(_0x6dfa72===_0xad61('0x39')){return(_0x62af16['pauseType']||'')<(_0x455f92[_0xad61('0x2e')]||'')||_0x62af16[_0xad61('0x2a')][_0xad61('0x3a')]()>_0x455f92[_0xad61('0x2a')][_0xad61('0x3a')]()?0x1:-0x1;}else{return(_0x62af16[_0xad61('0x2e')]||'')<(_0x455f92[_0xad61('0x2e')]||'')||_0x62af16[_0xad61('0x2a')]['toLowerCase']()>_0x455f92[_0xad61('0x2a')][_0xad61('0x3a')]()?-0x1:0x1;}}else{if(_0x6dfa72===_0xad61('0x39')){return _0x62af16[_0xad61('0x2a')][_0xad61('0x3a')]()<_0x455f92[_0xad61('0x2a')][_0xad61('0x3a')]()?0x1:-0x1;}else{return _0x62af16['fullname'][_0xad61('0x3a')]()<_0x455f92[_0xad61('0x2a')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x6dfa72===_0xad61('0x39')){return _0x62af16[_0xad61('0x30')]<_0x455f92[_0xad61('0x30')]?0x1:-0x1;}else{return _0x62af16['globalStatus']<_0x455f92['globalStatus']?-0x1:0x1;}}});return _0x2da8b5;}exports[_0xad61('0x3b')]=sortAgentsByStatus;function filterAgentAttributes(_0x565d86){var _0x4014a0=['userpic',_0xad61('0x3c'),_0xad61('0x3d'),_0xad61('0x3e'),_0xad61('0x2e'),_0xad61('0x3e'),_0xad61('0x3f'),_0xad61('0x40'),_0xad61('0x4'),_0xad61('0x2c'),_0xad61('0x2b'),'smsPause','whatsappPause',_0xad61('0x5'),_0xad61('0x7'),_0xad61('0x41'),'openchannelCapacity',_0xad61('0x42'),_0xad61('0x43'),'whatsappCapacity',_0xad61('0x44'),_0xad61('0x45'),_0xad61('0x46'),_0xad61('0x47'),_0xad61('0x48'),'whatsappCurrentCapacity',_0xad61('0x49'),_0xad61('0x11'),_0xad61('0x12'),'mailStatus','smsStatus',_0xad61('0x4a'),_0xad61('0x4b'),_0xad61('0xf'),'chatStatusTime',_0xad61('0x4c'),_0xad61('0x4d'),_0xad61('0x4e'),_0xad61('0x4f'),_0xad61('0x50'),'voiceStatusTime',_0xad61('0x51'),_0xad61('0x52'),_0xad61('0x53'),'phoneBarEnableScreenRecordingByAgent',_0xad61('0x54'),_0xad61('0x55')];var _0x52e358=[_0xad61('0x4'),_0xad61('0x2c'),_0xad61('0x2b'),_0xad61('0x6'),_0xad61('0x2d'),'faxPause',_0xad61('0x7'),_0xad61('0x3c')];var _0xd0d3cc=_(_0x565d86)[_0xad61('0x56')](_0x52e358)[_0xad61('0x57')](_0x4014a0)[_0xad61('0x58')]();return _0xd0d3cc;}exports[_0xad61('0x59')]=filterAgentAttributes; \ No newline at end of file +var _0x097a=['openchannelPause','smsPause','voicePause','whatsappPause','every','length','unknown','ringing','voiceStatus','idle','pause','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','flatten','uniq','value','filter','getAgentIdsByStatus','resolve','includes','User','findAll','fullname','faxPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','mailStatus','smsStatus','openchannelStatusTime','whatsappStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','routealias','omit','pick','jayson/promise','client','http','chatPause','mailPause'];(function(_0x19e537,_0x2be7cc){var _0x280dd8=function(_0x5df98b){while(--_0x5df98b){_0x19e537['push'](_0x19e537['shift']());}};_0x280dd8(++_0x2be7cc);}(_0x097a,0x10c));var _0xa097=function(_0x1a5249,_0x4c5457){_0x1a5249=_0x1a5249-0x0;var _0x31838e=_0x097a[_0x1a5249];return _0x31838e;};'use strict';var _=require('lodash');var jayson=require(_0xa097('0x0'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xa097('0x1')][_0xa097('0x2')]({'port':0x232a});var routingClient=jayson[_0xa097('0x1')][_0xa097('0x2')]({'port':0x232c});function isAgentPaused(_0x4694b5,_0x3fbf6d){var _0x3f32bb=[_0x4694b5[_0xa097('0x3')],_0x4694b5['faxPause'],_0x4694b5[_0xa097('0x4')],_0x4694b5[_0xa097('0x5')],_0x4694b5[_0xa097('0x6')],_0x4694b5[_0xa097('0x7')],_0x4694b5[_0xa097('0x8')]];if(!_0x3fbf6d)return _[_0xa097('0x9')](_0x3f32bb);var _0x46f72e=_['filter'](_0x3f32bb);return _0x46f72e['length']>0x0&&_0x46f72e[_0xa097('0xa')]<_0x3f32bb[_0xa097('0xa')]?!![]:![];}function isIdle(_0x36641a){return _0x36641a==='idle'||_0x36641a===_0xa097('0xb')||_0x36641a==='unavailable'||_0x36641a===_0xa097('0xc')||_['isNil'](_0x36641a);}function isAgentIdle(_0x4b92a5){if(_0x4b92a5[_0xa097('0xd')]!==_0xa097('0xe')&&_0x4b92a5[_0xa097('0x7')]){_0x4b92a5[_0xa097('0xd')]=_0xa097('0xf');return![];}return _[_0xa097('0x9')]([_0x4b92a5['chatStatus'],_0x4b92a5[_0xa097('0x10')],_0x4b92a5['mailStatus'],_0x4b92a5[_0xa097('0x11')],_0x4b92a5['smsStatus'],_0x4b92a5[_0xa097('0xd')],_0x4b92a5[_0xa097('0x12')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xa097('0x13')](_0xa097('0x14'),{})[_0xa097('0x15')](function(_0x54bbaf){if(_0x54bbaf[_0xa097('0x16')]){throw new Error(_0xa097('0x17'));}var _0x4b02f5=_0x54bbaf[_0xa097('0x18')];return routingClient['request'](_0xa097('0x14'),{})[_0xa097('0x15')](function(_0x3c045e){if(_0x3c045e[_0xa097('0x16')]){throw new Error(_0xa097('0x19'));}var _0x274201=_0x3c045e['result'];return _[_0xa097('0x1a')]({},_0x4b02f5,_0x274201);});})['catch'](function(_0x3baf5f){throw _0x3baf5f;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x4416cf){var _0x574633=_0xa097('0xb');if(isAgentPaused(_0x4416cf))_0x574633=_0xa097('0xf');else if(isAgentPaused(_0x4416cf,!![]))_0x574633='*pause';else if(isAgentIdle(_0x4416cf))_0x574633=_0xa097('0xe');else _0x574633=_0xa097('0x1b');return _0x574633;}exports[_0xa097('0x1c')]=getAgentStatus;function getAgentIdsByQueues(_0x5bdf40,_0x1f0dba){var _0x4b670e=_['isArray'](_0x5bdf40)?_0x5bdf40:[_0x5bdf40];var _0x29373e=_[_0xa097('0x1d')](_0x1f0dba)+_0xa097('0x1e');var _0x274470=_[_0xa097('0x1f')](_0x4b670e,function(_0x169b8a){return db[_0x29373e][_0xa097('0x20')]({'where':{'id':_0x169b8a}})['then'](function(_0x3f7931){if(!_0x3f7931)return[];return _0x3f7931[_0xa097('0x21')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x274470)[_0xa097('0x15')](function(_0x486852){var _0x1cf615=_(_0x486852)[_0xa097('0x22')]()[_0xa097('0x1f')]('id')[_0xa097('0x23')]()[_0xa097('0x24')]();return _0x1cf615;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x8b7912,_0x51d018,_0xcdd965){try{if(_0x51d018[_0xa097('0xa')]>0x0){_0x8b7912=_0x8b7912[_0xa097('0x25')](function(_0x951eb8){return _0x51d018['includes'](_0x951eb8['id']);});}var _0x29daa7=_0x8b7912['filter'](function(_0x5b66e7){var _0x4c1e52=_0xa097('0x1b');if(isAgentIdle(_0x5b66e7)){_0x4c1e52=_0xa097('0xe');}return _0x4c1e52===_0xcdd965;});return _[_0xa097('0x1f')](_0x29daa7,'id');}catch(_0x4ecce9){throw _0x4ecce9;}}exports[_0xa097('0x26')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x1345b5,_0x5be7f5,_0x54ee02){return Promise[_0xa097('0x27')]()['then'](function(){if(_0x5be7f5[_0xa097('0xa')]>0x0){_0x1345b5=_0x1345b5[_0xa097('0x25')](function(_0x253578){return _0x5be7f5[_0xa097('0x28')](_0x253578['id']);});}return _0x1345b5;})[_0xa097('0x15')](function(){return db[_0xa097('0x29')][_0xa097('0x2a')]({'attributes':['id','name',_0xa097('0x2b'),'chatPause',_0xa097('0x2c'),'mailPause',_0xa097('0x5'),_0xa097('0x6'),'voicePause',_0xa097('0x8'),_0xa097('0x2d')],'where':{'id':{'$in':_[_0xa097('0x1f')](_0x1345b5,'id')}},'raw':!![]});})[_0xa097('0x15')](function(_0x47f8a3){return _0x47f8a3[_0xa097('0x1f')](function(_0x331796){var _0xf44e00=_[_0xa097('0x2e')](_0x1345b5,['id',_0x331796['id']]);var _0x64e22b=filterAgentAttributes(_0xf44e00);_[_0xa097('0x1a')](_0x331796,_0x64e22b);_0x331796[_0xa097('0x2f')]=getAgentStatus(_0x331796);return _0x331796;});})[_0xa097('0x15')](function(_0x5ea07c){var _0x1774bb=sortAgentsByStatus(_0x5ea07c,_0x54ee02);return _['map'](_0x1774bb,'id');})[_0xa097('0x30')](function(_0x4e2d56){throw _0x4e2d56;});}exports[_0xa097('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x1fb6b9){var _0x5dffc7={'fields':[],'order':null};var _0x108c22=_0x1fb6b9['split'](',');_0x5dffc7[_0xa097('0x32')]=_[_0xa097('0x25')](_0x108c22,function(_0x4a7419){if(!_0x4a7419[_0xa097('0x28')](_0xa097('0x2f'))){return!![];}_0x5dffc7[_0xa097('0x33')]=_[_0xa097('0x34')](_0x4a7419,'-')?_0xa097('0x35'):_0xa097('0x36');return![];});return _0x5dffc7;}exports[_0xa097('0x37')]=getUpdatedSortOptions;function validateSortParameter(_0xf7b54c){if(!_0xf7b54c){_0xf7b54c='fullname,internal';}if(_0xf7b54c[_0xa097('0x28')](_0xa097('0x2b'))&&!_0xf7b54c[_0xa097('0x28')](_0xa097('0x38'))){var _0x49c56f=_0xf7b54c[_0xa097('0x39')](0x0,_0xf7b54c[_0xa097('0x3a')](_0xa097('0x2b')));_0xf7b54c+=','+_0x49c56f+'internal';}return _0xf7b54c;}exports[_0xa097('0x3b')]=validateSortParameter;function sortAgentsByStatus(_0x4c8165,_0x95c2d1){var _0x5158bd=_0x4c8165[_0xa097('0x3c')](function(_0x12963d,_0x14f19a){if(_0x12963d[_0xa097('0x2f')]===_0x14f19a['globalStatus']){if(_0x12963d[_0xa097('0x2f')]===_0xa097('0xf')){if(_0x95c2d1==='DESC'){return(_0x12963d[_0xa097('0x2d')]||'')<(_0x14f19a[_0xa097('0x2d')]||'')||_0x12963d[_0xa097('0x2b')][_0xa097('0x3d')]()>_0x14f19a[_0xa097('0x2b')]['toLowerCase']()?0x1:-0x1;}else{return(_0x12963d[_0xa097('0x2d')]||'')<(_0x14f19a[_0xa097('0x2d')]||'')||_0x12963d[_0xa097('0x2b')][_0xa097('0x3d')]()>_0x14f19a[_0xa097('0x2b')][_0xa097('0x3d')]()?-0x1:0x1;}}else{if(_0x95c2d1==='DESC'){return _0x12963d['fullname'][_0xa097('0x3d')]()<_0x14f19a[_0xa097('0x2b')][_0xa097('0x3d')]()?0x1:-0x1;}else{return _0x12963d[_0xa097('0x2b')][_0xa097('0x3d')]()<_0x14f19a[_0xa097('0x2b')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x95c2d1===_0xa097('0x35')){return _0x12963d[_0xa097('0x2f')]<_0x14f19a[_0xa097('0x2f')]?0x1:-0x1;}else{return _0x12963d['globalStatus']<_0x14f19a['globalStatus']?-0x1:0x1;}}});return _0x5158bd;}exports[_0xa097('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x35aade){var _0x284389=[_0xa097('0x3f'),_0xa097('0x40'),_0xa097('0x41'),_0xa097('0x42'),_0xa097('0x2d'),'lastPauseAt',_0xa097('0x38'),_0xa097('0x43'),_0xa097('0x3'),_0xa097('0x5'),_0xa097('0x4'),_0xa097('0x6'),_0xa097('0x8'),_0xa097('0x2c'),'voicePause','chatCapacity',_0xa097('0x44'),_0xa097('0x45'),_0xa097('0x46'),_0xa097('0x47'),_0xa097('0x48'),_0xa097('0x49'),_0xa097('0x4a'),_0xa097('0x4b'),_0xa097('0x4c'),_0xa097('0x4d'),_0xa097('0x4e'),_0xa097('0x4f'),_0xa097('0x11'),_0xa097('0x50'),_0xa097('0x51'),_0xa097('0x12'),_0xa097('0x10'),'voiceStatus','chatStatusTime',_0xa097('0x52'),'mailStatusTime','smsStatusTime',_0xa097('0x53'),'faxStatusTime',_0xa097('0x54'),_0xa097('0x55'),_0xa097('0x56'),_0xa097('0x57'),'phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xa097('0x58')];var _0x480048=[_0xa097('0x3'),_0xa097('0x5'),_0xa097('0x4'),_0xa097('0x6'),_0xa097('0x8'),_0xa097('0x2c'),_0xa097('0x7'),_0xa097('0x40')];var _0x3ccbe4=_(_0x35aade)[_0xa097('0x59')](_0x480048)[_0xa097('0x5a')](_0x284389)[_0xa097('0x24')]();return _0x3ccbe4;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 2f9b98a..de8744d 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 _0x8508=['erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','inbound','concat','outbound','get','loggedIn','talking','find','merge','pick','lodash','jayson/promise','util','http','available','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive','dialMethod','startPredictive','startProgressive','erlangAbandonmentRate'];(function(_0x1d1994,_0x502d95){var _0x1a8597=function(_0xf07a0e){while(--_0xf07a0e){_0x1d1994['push'](_0x1d1994['shift']());}};_0x1a8597(++_0x502d95);}(_0x8508,0x81));var _0x8850=function(_0x15142f,_0x567b64){_0x15142f=_0x15142f-0x0;var _0x274859=_0x8508[_0x15142f];return _0x274859;};'use strict';var _=require(_0x8850('0x0'));var jayson=require(_0x8850('0x1'));var util=require(_0x8850('0x2'));var amiClient=jayson['client'][_0x8850('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x8850('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x8850('0x4'),'loggedIn',_0x8850('0x5'),_0x8850('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x8850('0x7'),'inUse',_0x8850('0x8'),_0x8850('0x9'),_0x8850('0xa'),_0x8850('0xb'),_0x8850('0xc'),'ringInUse','talking',_0x8850('0xd'),_0x8850('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8850('0xf'),_0x8850('0x10'),_0x8850('0x11'),_0x8850('0x12'),_0x8850('0x13'),_0x8850('0x14'),'Trunk',_0x8850('0x15'),_0x8850('0x16'),'erlangCalls','erlangCallToSecond',_0x8850('0x17'),_0x8850('0x18'),_0x8850('0x19'),_0x8850('0x1a'),_0x8850('0x1b'),_0x8850('0x1c'),_0x8850('0x1d'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0x8850('0x1e'),_0x8850('0x1f'),_0x8850('0x20')];function getRealtimeQueues(_0x43f268,_0x261477){var _0x6609f0=_0x261477===_0x8850('0x21')?amiClient:routingClient;return _0x6609f0[_0x8850('0x22')](_[_0x8850('0x23')](_0x261477)+_0x8850('0x24'),_0x43f268)[_0x8850('0x25')](function(_0x328e4c){if(_0x328e4c[_0x8850('0x26')])throw new Error(util[_0x8850('0x27')](_0x8850('0x28'),_0x261477));return _0x328e4c['result'];})[_0x8850('0x29')](function(_0x5b3e94){throw _0x5b3e94;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1b9186,_0x556f2d,_0x4195b2,_0x654469){var _0x5aa62d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4195b2==='voice'){if(_0x654469===_0x8850('0x2a')){_0x5aa62d=_0x5aa62d[_0x8850('0x2b')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x654469===_0x8850('0x2c')){_0x5aa62d=_0x5aa62d['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1b9186['map'](function(_0x2a4f74){var _0x94d7bf=_0x2a4f74[_0x8850('0x2d')]({'plain':!![]});_0x94d7bf[_0x8850('0x5')]=0x0;_0x94d7bf[_0x8850('0x9')]=0x0;_0x94d7bf[_0x8850('0x2e')]=0x0;_0x94d7bf['available']=0x0;_0x94d7bf[_0x8850('0x6')]=0x0;if(_0x4195b2===_0x8850('0x21')){_0x94d7bf[_0x8850('0x2f')]=0x0;_0x94d7bf[_0x8850('0x7')]=0x0;if(_0x654469===_0x8850('0x2c')){_0x94d7bf[_0x8850('0xf')]=0x0;_0x94d7bf[_0x8850('0x10')]=0x0;}}var _0x2ca8af=_[_0x8850('0x30')](_0x556f2d,['id',_0x94d7bf['id']]);if(_0x2ca8af){_[_0x8850('0x31')](_0x94d7bf,_[_0x8850('0x32')](_0x2ca8af,_0x5aa62d));}return _0x94d7bf;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0xad0b=['pTalking','originated','message','statusMessage','dialActive','dialMethod','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','then','error','format','result','catch','getRealtimeQueues','concat','map','get','waiting','merge','pick','initializeQueues','lodash','util','client','http','loggedIn','paused','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringInUse','talking','unknown'];(function(_0x5c2da4,_0xf4a329){var _0x708e40=function(_0x1cedf2){while(--_0x1cedf2){_0x5c2da4['push'](_0x5c2da4['shift']());}};_0x708e40(++_0xf4a329);}(_0xad0b,0xa9));var _0xbad0=function(_0x4736c9,_0x3ac90c){_0x4736c9=_0x4736c9-0x0;var _0x2c2e80=_0xad0b[_0x4736c9];return _0x2c2e80;};'use strict';var _=require(_0xbad0('0x0'));var jayson=require('jayson/promise');var util=require(_0xbad0('0x1'));var amiClient=jayson[_0xbad0('0x2')][_0xbad0('0x3')]({'port':0x232a});var routingClient=jayson['client']['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0xbad0('0x4'),_0xbad0('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0xbad0('0x6'),_0xbad0('0x7'),_0xbad0('0x8'),_0xbad0('0x9'),_0xbad0('0xa'),_0xbad0('0xb'),'ringing',_0xbad0('0xc'),_0xbad0('0xd'),'unavailable',_0xbad0('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xbad0('0xf'),_0xbad0('0x10'),_0xbad0('0x11'),_0xbad0('0x12'),_0xbad0('0x13'),_0xbad0('0x14'),'Trunk','startPredictive','startProgressive',_0xbad0('0x15'),_0xbad0('0x16'),_0xbad0('0x17'),'erlangBusyFactor',_0xbad0('0x18'),_0xbad0('0x19'),_0xbad0('0x1a'),'predictiveIntervalAvailable',_0xbad0('0x1b'),'predictiveIntervalAnsweredCalls',_0xbad0('0x1c'),'predictiveIntervalDroppedCallsCallersExit',_0xbad0('0x1d'),_0xbad0('0x1e')];function getRealtimeQueues(_0x5ac50e,_0x18b07a){var _0x3fcbca=_0x18b07a===_0xbad0('0x1f')?amiClient:routingClient;return _0x3fcbca[_0xbad0('0x20')](_['startCase'](_0x18b07a)+'Queues',_0x5ac50e)[_0xbad0('0x21')](function(_0x382450){if(_0x382450[_0xbad0('0x22')])throw new Error(util[_0xbad0('0x23')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x18b07a));return _0x382450[_0xbad0('0x24')];})[_0xbad0('0x25')](function(_0x4ab611){throw _0x4ab611;});}exports[_0xbad0('0x26')]=getRealtimeQueues;function initializeQueues(_0x16f0f4,_0x39b7b6,_0x6a9603,_0x1b130f){var _0x587e20=DEFAULT_QUEUE_ATTRIBUTES;if(_0x6a9603==='voice'){if(_0x1b130f==='inbound'){_0x587e20=_0x587e20[_0xbad0('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x1b130f==='outbound'){_0x587e20=_0x587e20[_0xbad0('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x16f0f4[_0xbad0('0x28')](function(_0x5917ed){var _0x808c4c=_0x5917ed[_0xbad0('0x29')]({'plain':!![]});_0x808c4c[_0xbad0('0x5')]=0x0;_0x808c4c[_0xbad0('0x9')]=0x0;_0x808c4c['loggedIn']=0x0;_0x808c4c['available']=0x0;_0x808c4c[_0xbad0('0x2a')]=0x0;if(_0x6a9603===_0xbad0('0x1f')){_0x808c4c['talking']=0x0;_0x808c4c['busy']=0x0;if(_0x1b130f==='outbound'){_0x808c4c['pTalking']=0x0;_0x808c4c[_0xbad0('0x10')]=0x0;}}var _0x34065d=_['find'](_0x39b7b6,['id',_0x808c4c['id']]);if(_0x34065d){_[_0xbad0('0x2b')](_0x808c4c,_[_0xbad0('0x2c')](_0x34065d,_0x587e20));}return _0x808c4c;});}exports[_0xbad0('0x2d')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 98d4424..900f5b7 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x9a28d6,_0x5e2125){var _0x438c21=function(_0x434ab8){while(--_0x434ab8){_0x9a28d6['push'](_0x9a28d6['shift']());}};_0x438c21(++_0x5e2125);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _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(_0x14a862,_0x2b559d){var _0x245eb5=function(_0x6e014c){while(--_0x6e014c){_0x14a862['push'](_0x14a862['shift']());}};_0x245eb5(++_0x2b559d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d96f767..cea5cb7 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 _0x76a1=['platform','licenseToken','test','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','ipAddress','digest','substring','lodash','child_process','networkInterfaces','orderBy','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','cpus','map','createHash','md5','update','hex'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x76a1,0x1ea));var _0x176a=function(_0x2bc6f2,_0x347a99){_0x2bc6f2=_0x2bc6f2-0x0;var _0x5c65e9=_0x76a1[_0x2bc6f2];return _0x5c65e9;};'use strict';var _=require(_0x176a('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x176a('0x1'))['execSync'];var config=require('../environment');function getInterfaces(){var _0x4b3f30=[];var _0x392286=os[_0x176a('0x2')]();var _0x1331ce=_[_0x176a('0x3')](_['keys'](_0x392286));for(var _0x5e564b=0x0;_0x5e564b<_0x1331ce[_0x176a('0x4')];_0x5e564b++){var _0x302f1b=_0x392286[_0x1331ce[_0x5e564b]][_0x176a('0x5')](function(_0x24251d){return _0x24251d['family']===_0x176a('0x6')&&_0x24251d[_0x176a('0x7')]===![];});_0x4b3f30=_0x4b3f30[_0x176a('0x8')](_0x302f1b);}return _0x4b3f30;}function getFirstInterface(){var _0x3a0a76=_[_0x176a('0x9')](getInterfaces());return{'macAddress':_0x3a0a76&&_0x3a0a76['mac']?_0x3a0a76[_0x176a('0xa')]:_0x176a('0xb'),'ipAddress':_0x3a0a76&&_0x3a0a76['address']?_0x3a0a76['address']:_0x176a('0xc')};}exports[_0x176a('0xd')]=getFirstInterface;function getCPUhash(){var _0x5b7836=_[_0x176a('0x3')](os[_0x176a('0xe')]()[_0x176a('0xf')](function(_0x390c8b){return _0x390c8b['model'];}))['join'](':');return crypto[_0x176a('0x10')](_0x176a('0x11'))[_0x176a('0x12')](_0x5b7836)['digest'](_0x176a('0x13'));}exports['getUuid']=function(){var _0x544298=os[_0x176a('0x14')]();var _0x5823f9=/[0-9a-f-]{36}/;if(config[_0x176a('0x15')]&&_0x5823f9[_0x176a('0x16')](config[_0x176a('0x15')])){return config[_0x176a('0x15')];}else if(_0x544298==='win32'){return exec(_0x176a('0x17'),{'encoding':_0x176a('0x18')})[_0x176a('0x19')]('\x0d\x0a','');}else{var _0x1e57ba=getFirstInterface();var _0xadf8a7=getCPUhash();var _0x245966=_0xadf8a7+'|'+os[_0x176a('0x1a')]()+'|'+_0x1e57ba['macAddress']+'|'+_0x1e57ba[_0x176a('0x1b')];var _0xbf9a48=crypto['createHash'](_0x176a('0x11'))[_0x176a('0x12')](_0x245966)[_0x176a('0x1c')](_0x176a('0x13'));return _0xbf9a48[_0x176a('0x1d')](0x0,0x8)+'-'+_0xbf9a48[_0x176a('0x1d')](0x8,0xc)+'-'+_0xbf9a48['substring'](0xc,0x10)+'-'+_0xbf9a48[_0x176a('0x1d')](0x10,0x14)+'-'+_0xbf9a48[_0x176a('0x1d')](0x14);}}; \ No newline at end of file +var _0x68ac=['hostname','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','join','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8'];(function(_0x3f5f50,_0x4e0077){var _0x5ed608=function(_0x160360){while(--_0x160360){_0x3f5f50['push'](_0x3f5f50['shift']());}};_0x5ed608(++_0x4e0077);}(_0x68ac,0x18a));var _0xc68a=function(_0x41ab7c,_0x1a0a4a){_0x41ab7c=_0x41ab7c-0x0;var _0x779998=_0x68ac[_0x41ab7c];return _0x779998;};'use strict';var _=require(_0xc68a('0x0'));var os=require('os');var crypto=require(_0xc68a('0x1'));var machine=require(_0xc68a('0x2'));var exec=require(_0xc68a('0x3'))[_0xc68a('0x4')];var config=require('../environment');function getInterfaces(){var _0x1e91ae=[];var _0x9fbf22=os[_0xc68a('0x5')]();var _0x73b436=_[_0xc68a('0x6')](_[_0xc68a('0x7')](_0x9fbf22));for(var _0x157750=0x0;_0x157750<_0x73b436[_0xc68a('0x8')];_0x157750++){var _0x59b3a7=_0x9fbf22[_0x73b436[_0x157750]][_0xc68a('0x9')](function(_0x57db61){return _0x57db61[_0xc68a('0xa')]==='IPv4'&&_0x57db61[_0xc68a('0xb')]===![];});_0x1e91ae=_0x1e91ae[_0xc68a('0xc')](_0x59b3a7);}return _0x1e91ae;}function getFirstInterface(){var _0x380bdc=_[_0xc68a('0xd')](getInterfaces());return{'macAddress':_0x380bdc&&_0x380bdc['mac']?_0x380bdc[_0xc68a('0xe')]:_0xc68a('0xf'),'ipAddress':_0x380bdc&&_0x380bdc[_0xc68a('0x10')]?_0x380bdc[_0xc68a('0x10')]:_0xc68a('0x11')};}exports[_0xc68a('0x12')]=getFirstInterface;function getCPUhash(){var _0x2d7665=_[_0xc68a('0x6')](os[_0xc68a('0x13')]()[_0xc68a('0x14')](function(_0x8b79bd){return _0x8b79bd[_0xc68a('0x15')];}))[_0xc68a('0x16')](':');return crypto[_0xc68a('0x17')](_0xc68a('0x18'))[_0xc68a('0x19')](_0x2d7665)[_0xc68a('0x1a')](_0xc68a('0x1b'));}exports[_0xc68a('0x1c')]=function(){var _0x517f10=os[_0xc68a('0x1d')]();var _0x3ca80f=/[0-9a-f-]{36}/;if(config[_0xc68a('0x1e')]&&_0x3ca80f[_0xc68a('0x1f')](config[_0xc68a('0x1e')])){return config[_0xc68a('0x1e')];}else if(_0x517f10===_0xc68a('0x20')){return exec(_0xc68a('0x21'),{'encoding':_0xc68a('0x22')})['replace']('\x0d\x0a','');}else{var _0x21f05e=getFirstInterface();var _0x6f36be=getCPUhash();var _0x20b940=_0x6f36be+'|'+os[_0xc68a('0x23')]()+'|'+_0x21f05e[_0xc68a('0x24')]+'|'+_0x21f05e[_0xc68a('0x25')];var _0x32ff05=crypto[_0xc68a('0x17')](_0xc68a('0x18'))['update'](_0x20b940)[_0xc68a('0x1a')]('hex');return _0x32ff05[_0xc68a('0x26')](0x0,0x8)+'-'+_0x32ff05[_0xc68a('0x26')](0x8,0xc)+'-'+_0x32ff05[_0xc68a('0x26')](0xc,0x10)+'-'+_0x32ff05[_0xc68a('0x26')](0x10,0x14)+'-'+_0x32ff05['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c3c8734..71e1548 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 _0x6630=['SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','../logger','license','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','getUuid','License','findOrCreate','spread'];(function(_0xb8f92d,_0x541380){var _0x2616ed=function(_0x2f6809){while(--_0x2f6809){_0xb8f92d['push'](_0xb8f92d['shift']());}};_0x2616ed(++_0x541380);}(_0x6630,0x1a7));var _0x0663=function(_0x167c4e,_0x2d4423){_0x167c4e=_0x167c4e-0x0;var _0x3f6782=_0x6630[_0x167c4e];return _0x3f6782;};'use strict';var util=require(_0x0663('0x0'));var moment=require('moment');var rp=require(_0x0663('0x1'));var BPromise=require(_0x0663('0x2'));var pkginfo=require(_0x0663('0x3'))(module,_0x0663('0x4'));var db=require(_0x0663('0x5'))['db'];var encryptor=require(_0x0663('0x6'));var hardware=require(_0x0663('0x7'));var logger=require(_0x0663('0x8'))(_0x0663('0x9'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x4d9f30){return new BPromise(function(_0x10cc31,_0x252051){var _0x4dfdc5=util[_0x0663('0xa')](_0x0663('0xb'),HOST,_0x4d9f30,module[_0x0663('0xc')][_0x0663('0x4')]);if(oldToken){_0x4dfdc5=util[_0x0663('0xa')](_0x0663('0xd'),HOST,_0x4d9f30,module[_0x0663('0xc')][_0x0663('0x4')],oldToken);}var _0x3db352={'uri':_0x4dfdc5,'method':_0x0663('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x3db352)[_0x0663('0xf')](function(_0x2334fc){_0x10cc31(_0x2334fc);})[_0x0663('0x10')](function(_0x509e4f){_0x252051(_0x509e4f);});});}function manageLicense(_0x5829cf,_0x19e434){var _0x4731cf=_0x19e434[_0x0663('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x4731cf[_0x0663('0x12')]!==_0x5829cf&&!_0x4731cf['data2']){oldToken=_0x4731cf[_0x0663('0x12')];}httpRequest(_0x5829cf)[_0x0663('0xf')](function(_0x1264d0){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1264d0[_0x0663('0x13')]){isOldTokenSent=![];if(!_0x4731cf[_0x0663('0x9')]&&_0x4731cf[_0x0663('0x9')]!=_0x1264d0[_0x0663('0x9')]||_0x4731cf[_0x0663('0x9')]&&_0x4731cf[_0x0663('0x14')]){logger[_0x0663('0x15')](_0x0663('0x16'));}if(_0x4731cf['license']&&!_0x4731cf[_0x0663('0x14')]&&_0x4731cf[_0x0663('0x9')]!=_0x1264d0[_0x0663('0x9')]){logger[_0x0663('0x15')]('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4731cf[_0x0663('0x9')]&&!_0x4731cf[_0x0663('0x14')]&&_0x4731cf[_0x0663('0x9')]==_0x1264d0[_0x0663('0x9')]){return _0x19e434;}return _0x19e434[_0x0663('0x17')]({'data1':_0x5829cf,'data2':null,'license':_0x1264d0[_0x0663('0x9')]});}else{if(_0x1264d0[_0x0663('0x9')]||_0x4731cf[_0x0663('0x9')]){if(!_0x4731cf[_0x0663('0x14')]){if(_0x4731cf[_0x0663('0x12')]==_0x5829cf){GRAY_PERIOD_REASON='Disabled';logger['info'](_0x0663('0x18'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x0663('0x15')](_0x0663('0x19'),_0x4731cf[_0x0663('0x12')],_0x5829cf);}logger[_0x0663('0x15')](_0x0663('0x1a'),GRAY_PERIOD_REASON[_0x0663('0x1b')](),moment()[_0x0663('0xa')](_0x0663('0x1c')));return _0x19e434[_0x0663('0x17')]({'data2':encryptor[_0x0663('0x1d')](moment()[_0x0663('0xa')](_0x0663('0x1c')))});}else{if(moment()[_0x0663('0x1e')](encryptor[_0x0663('0x1f')](_0x4731cf[_0x0663('0x14')]),_0x0663('0x20'))>DAYS){logger['info'](_0x0663('0x21'),moment()[_0x0663('0xa')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x19e434[_0x0663('0x17')]({'data1':_0x5829cf,'data2':null,'license':null});}}}else{if(_0x4731cf[_0x0663('0x12')]!=_0x5829cf){logger[_0x0663('0x15')](_0x0663('0x19'),_0x4731cf[_0x0663('0x12')],_0x5829cf);return _0x19e434['update']({'data1':_0x5829cf,'data2':null,'license':null});}}}return _0x19e434;})[_0x0663('0xf')](function(_0xdda3e5){_0x19e434=_0xdda3e5;})['catch'](function(_0x4d9a4e){logger['error'](_0x4d9a4e[_0x0663('0x22')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x19e434);},TIME);});}function defaultLicense(){var _0x551845=hardware[_0x0663('0x23')]();if(_0x551845){return db[_0x0663('0x24')][_0x0663('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x551845}})[_0x0663('0x26')](function(_0x44a05b,_0x52069c){logger[_0x0663('0x15')](_0x0663('0x27'),_0x551845);manageLicense(_0x551845,_0x44a05b);})['catch'](function(_0x6f6008){logger[_0x0663('0x28')](_0x6f6008[_0x0663('0x22')]);});}}exports[_0x0663('0x29')]=defaultLicense; \ No newline at end of file +var _0x4fba=['toUpperCase','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','finally','getUuid','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','then','catch','get','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x4fba,0x134));var _0xa4fb=function(_0x4b3230,_0x1afbb1){_0x4b3230=_0x4b3230-0x0;var _0x3dde7e=_0x4fba[_0x4b3230];return _0x3dde7e;};'use strict';var util=require(_0xa4fb('0x0'));var moment=require(_0xa4fb('0x1'));var rp=require(_0xa4fb('0x2'));var BPromise=require(_0xa4fb('0x3'));var pkginfo=require(_0xa4fb('0x4'))(module,_0xa4fb('0x5'));var db=require(_0xa4fb('0x6'))['db'];var encryptor=require(_0xa4fb('0x7'));var hardware=require('./hardware');var logger=require(_0xa4fb('0x8'))(_0xa4fb('0x9'));var HOST=_0xa4fb('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x45b9d3){return new BPromise(function(_0x1975d2,_0x209b9e){var _0x534273=util[_0xa4fb('0xb')](_0xa4fb('0xc'),HOST,_0x45b9d3,module['exports'][_0xa4fb('0x5')]);if(oldToken){_0x534273=util[_0xa4fb('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x45b9d3,module[_0xa4fb('0xd')]['version'],oldToken);}var _0x2e2b72={'uri':_0x534273,'method':_0xa4fb('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x2e2b72)[_0xa4fb('0xf')](function(_0x26382a){_0x1975d2(_0x26382a);})[_0xa4fb('0x10')](function(_0x3d7123){_0x209b9e(_0x3d7123);});});}function manageLicense(_0x49dd21,_0x25c958){var _0x28015d=_0x25c958[_0xa4fb('0x11')]({'plain':!![]});if(!isOldTokenSent&&_0x28015d[_0xa4fb('0x12')]!==_0x49dd21&&!_0x28015d[_0xa4fb('0x13')]){oldToken=_0x28015d['data1'];}httpRequest(_0x49dd21)['then'](function(_0x52f442){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x52f442[_0xa4fb('0x14')]){isOldTokenSent=![];if(!_0x28015d[_0xa4fb('0x9')]&&_0x28015d[_0xa4fb('0x9')]!=_0x52f442[_0xa4fb('0x9')]||_0x28015d[_0xa4fb('0x9')]&&_0x28015d[_0xa4fb('0x13')]){logger[_0xa4fb('0x15')](_0xa4fb('0x16'));}if(_0x28015d[_0xa4fb('0x9')]&&!_0x28015d[_0xa4fb('0x13')]&&_0x28015d[_0xa4fb('0x9')]!=_0x52f442['license']){logger[_0xa4fb('0x15')](_0xa4fb('0x17'));}if(_0x28015d['license']&&!_0x28015d['data2']&&_0x28015d[_0xa4fb('0x9')]==_0x52f442['license']){return _0x25c958;}return _0x25c958[_0xa4fb('0x18')]({'data1':_0x49dd21,'data2':null,'license':_0x52f442['license']});}else{if(_0x52f442[_0xa4fb('0x9')]||_0x28015d[_0xa4fb('0x9')]){if(!_0x28015d[_0xa4fb('0x13')]){if(_0x28015d[_0xa4fb('0x12')]==_0x49dd21){GRAY_PERIOD_REASON=_0xa4fb('0x19');logger[_0xa4fb('0x15')](_0xa4fb('0x1a'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xa4fb('0x15')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x28015d[_0xa4fb('0x12')],_0x49dd21);}logger['info'](_0xa4fb('0x1b'),GRAY_PERIOD_REASON[_0xa4fb('0x1c')](),moment()[_0xa4fb('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x25c958[_0xa4fb('0x18')]({'data2':encryptor[_0xa4fb('0x1d')](moment()[_0xa4fb('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xa4fb('0x1e')](encryptor[_0xa4fb('0x1f')](_0x28015d[_0xa4fb('0x13')]),_0xa4fb('0x20'))>DAYS){logger[_0xa4fb('0x15')](_0xa4fb('0x21'),moment()[_0xa4fb('0xb')](_0xa4fb('0x22')));isOldTokenSent=![];return _0x25c958[_0xa4fb('0x18')]({'data1':_0x49dd21,'data2':null,'license':null});}}}else{if(_0x28015d[_0xa4fb('0x12')]!=_0x49dd21){logger[_0xa4fb('0x15')](_0xa4fb('0x23'),_0x28015d[_0xa4fb('0x12')],_0x49dd21);return _0x25c958[_0xa4fb('0x18')]({'data1':_0x49dd21,'data2':null,'license':null});}}}return _0x25c958;})[_0xa4fb('0xf')](function(_0x2977a3){_0x25c958=_0x2977a3;})[_0xa4fb('0x10')](function(_0x45835d){logger[_0xa4fb('0x24')](_0x45835d['message']);})[_0xa4fb('0x25')](function(){setTimeout(function(){manageLicense(hardware[_0xa4fb('0x26')](),_0x25c958);},TIME);});}function defaultLicense(){var _0x449a6d=hardware[_0xa4fb('0x26')]();if(_0x449a6d){return db['License'][_0xa4fb('0x27')]({'where':{'id':0x1},'defaults':{'data1':_0x449a6d}})['spread'](function(_0x53830c,_0x5b6ad2){logger['info'](_0xa4fb('0x28'),_0x449a6d);manageLicense(_0x449a6d,_0x53830c);})[_0xa4fb('0x10')](function(_0xc4f973){logger[_0xa4fb('0x24')](_0xc4f973[_0xa4fb('0x29')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 47903e5..2e55353 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 _0xb270=['find','defaults','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','demo','machineUuid','gray','deadline','add','days','format','disabled','message','User','findAll','role','sequelize','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','catch','util','lodash','bluebird','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License'];(function(_0x4cf5f5,_0x218a3f){var _0x2d36a7=function(_0x533e82){while(--_0x533e82){_0x4cf5f5['push'](_0x4cf5f5['shift']());}};_0x2d36a7(++_0x218a3f);}(_0xb270,0x105));var _0x0b27=function(_0x18d191,_0x49d54d){_0x18d191=_0x18d191-0x0;var _0x11dd16=_0xb270[_0x18d191];return _0x11dd16;};'use strict';var util=require(_0x0b27('0x0'));var _=require(_0x0b27('0x1'));var moment=require('moment');var BPromise=require(_0x0b27('0x2'));var hardware=require('./hardware');var encryptor=require(_0x0b27('0x3'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0b27('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x0b27('0x5'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x0b27('0x4'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x0b27('0x6'),'machineUuid':hardware[_0x0b27('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x35e0b8){return new BPromise(function(_0x13a15c,_0x15d32c){return db[_0x0b27('0x8')][_0x0b27('0x9')](_[_0x0b27('0xa')](_0x35e0b8,{'raw':!![],'where':{'id':0x1}}))[_0x0b27('0xb')](function(_0x38df65){return checkLicense(_0x38df65,null);})['then'](function(_0x2dc665){_0x13a15c(_0x2dc665);return;})['catch'](function(_0x40a5a4){_0x15d32c(_0x40a5a4);});});}function checkLicense(_0x164668,_0x1aa155){if(!_0x164668){demoLicense[_0x0b27('0xc')]=_0x164668[_0x0b27('0xd')];return demoLicense;}try{var _0x1caaa5=_0x1aa155||_0x164668[_0x0b27('0xe')];if(_[_0x0b27('0xf')](_0x1caaa5)){throw new Error(_0x0b27('0x10'));}var _0x1cb60f=_0x164668[_0x0b27('0xd')];var _0x45dfdd=_0x164668[_0x0b27('0x11')];var _0x3228d2=_0x1cb60f[_0x0b27('0x12')]('-')[0x4];var _0x43d3da=_0x1cb60f[_0x0b27('0x12')]('-')[0x0];var _0x133af2=encryptor[_0x0b27('0x13')](_0x1caaa5,util['format']('%s:%s:%s',_0x3228d2,_0x1cb60f,_0x43d3da));var _0x493dcb=JSON['parse'](_0x133af2);_0x493dcb[_0x0b27('0x14')]=![];_0x493dcb[_0x0b27('0xc')]=_0x1cb60f;_0x493dcb[_0x0b27('0x15')]=hardware['getUuid']();if(_0x45dfdd){var _0x55ac94=encryptor['decryptString'](_0x45dfdd);_0x493dcb[_0x0b27('0x16')]=_0x55ac94;_0x493dcb[_0x0b27('0x17')]=moment(_0x55ac94)[_0x0b27('0x18')](0x7,_0x0b27('0x19'))[_0x0b27('0x1a')]();_0x493dcb['grayReason']=_0x493dcb[_0x0b27('0xc')]!=_0x493dcb[_0x0b27('0x15')]?'changed':_0x0b27('0x1b');}return _0x493dcb;}catch(_0x33c9f5){breakingLicense['uuid']=_0x164668[_0x0b27('0xd')];breakingLicense[_0x0b27('0x1c')]=_0x33c9f5[_0x0b27('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4bdd79,_0x32caa9){getLicense()[_0x0b27('0xb')](function(_0x9e9391){return db[_0x0b27('0x1d')][_0x0b27('0x1e')]({'attributes':[_0x0b27('0x1f'),[db['sequelize']['fn']('COUNT',db[_0x0b27('0x20')]['col']('role')),_0x0b27('0x21')]],'group':'role','where':{'role':{'$or':[_0x0b27('0x22'),_0x0b27('0x23'),_0x0b27('0x24')]}},'raw':!![]})[_0x0b27('0xb')](function(_0x18e985){var _0x3fa8d4={'user':_0x9e9391[_0x0b27('0x25')]||0x0,'telephone':_0x9e9391[_0x0b27('0x26')]||0x0};_0x18e985[_0x0b27('0x27')](function(_0x952bbc){var _0x5a5f10=_0x952bbc[_0x0b27('0x1f')]===_0x0b27('0x22')?_0x0b27('0x23'):_0x952bbc[_0x0b27('0x1f')];_0x3fa8d4[_0x5a5f10]-=_0x952bbc[_0x0b27('0x21')];if(_0x3fa8d4[_0x5a5f10]<0x0)_0x3fa8d4[_0x5a5f10]=0x0;});_0x4bdd79(_0x3fa8d4);return;});})['catch'](function(_0x512e6f){_0x32caa9(_0x512e6f);});});}function checkUserLimits(_0x3eb279){return new BPromise(function(_0x6c0fe0,_0x5ccb69){getLimits()[_0x0b27('0xb')](function(_0xe775cd){var _0x1fe1db=_[_0x0b27('0x28')](_[_0x0b27('0x29')](_0x3eb279,_0x0b27('0x1f')),[_0x0b27('0x22'),'user','telephone']);var _0x359184=(_0x1fe1db[_0x0b27('0x22')]||0x0)+(_0x1fe1db[_0x0b27('0x23')]||0x0);var _0x4c0913=_0x1fe1db[_0x0b27('0x24')]||0x0;if(_0x359184>_0xe775cd['user'])return _0x5ccb69(_0x0b27('0x2a'));if(_0x4c0913>_0xe775cd[_0x0b27('0x24')])return _0x5ccb69(_0x0b27('0x2b'));return _0x6c0fe0();})[_0x0b27('0x2c')](function(_0x46ffdd){_0x5ccb69(_0x46ffdd);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x4d4e=['decryptString','gray','deadline','add','days','grayReason','machineUuid','changed','disabled','message','User','findAll','role','sequelize','COUNT','col','count','user','telephone','users','telephones','forEach','pick','countBy','admin','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','then','catch','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','parse','demo'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4d4e,0xb4));var _0xe4d4=function(_0x8212b9,_0x4b8686){_0x8212b9=_0x8212b9-0x0;var _0x10184c=_0x4d4e[_0x8212b9];return _0x10184c;};'use strict';var util=require(_0xe4d4('0x0'));var _=require(_0xe4d4('0x1'));var moment=require(_0xe4d4('0x2'));var BPromise=require('bluebird');var hardware=require(_0xe4d4('0x3'));var encryptor=require(_0xe4d4('0x4'));var db=require(_0xe4d4('0x5'))['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':_0xe4d4('0x6'),'machineUuid':hardware[_0xe4d4('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe4d4('0x8'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe4d4('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x234872){return new BPromise(function(_0x396bbb,_0x35ca20){return db[_0xe4d4('0xa')][_0xe4d4('0xb')](_['defaults'](_0x234872,{'raw':!![],'where':{'id':0x1}}))[_0xe4d4('0xc')](function(_0x35ceb5){return checkLicense(_0x35ceb5,null);})[_0xe4d4('0xc')](function(_0x4c9236){_0x396bbb(_0x4c9236);return;})[_0xe4d4('0xd')](function(_0x3d5d8c){_0x35ca20(_0x3d5d8c);});});}function checkLicense(_0x2712b0,_0x3f3250){if(!_0x2712b0){demoLicense[_0xe4d4('0xe')]=_0x2712b0[_0xe4d4('0xf')];return demoLicense;}try{var _0x59ffde=_0x3f3250||_0x2712b0[_0xe4d4('0x10')];if(_[_0xe4d4('0x11')](_0x59ffde)){throw new Error(_0xe4d4('0x12'));}var _0x19e6f4=_0x2712b0['data1'];var _0x179521=_0x2712b0[_0xe4d4('0x13')];var _0x4241cb=_0x19e6f4['split']('-')[0x4];var _0x284148=_0x19e6f4[_0xe4d4('0x14')]('-')[0x0];var _0xf155fd=encryptor['decryptString'](_0x59ffde,util[_0xe4d4('0x15')]('%s:%s:%s',_0x4241cb,_0x19e6f4,_0x284148));var _0x18f1a6=JSON[_0xe4d4('0x16')](_0xf155fd);_0x18f1a6[_0xe4d4('0x17')]=![];_0x18f1a6[_0xe4d4('0xe')]=_0x19e6f4;_0x18f1a6['machineUuid']=hardware[_0xe4d4('0x7')]();if(_0x179521){var _0x51db8f=encryptor[_0xe4d4('0x18')](_0x179521);_0x18f1a6[_0xe4d4('0x19')]=_0x51db8f;_0x18f1a6[_0xe4d4('0x1a')]=moment(_0x51db8f)[_0xe4d4('0x1b')](0x7,_0xe4d4('0x1c'))[_0xe4d4('0x15')]();_0x18f1a6[_0xe4d4('0x1d')]=_0x18f1a6[_0xe4d4('0xe')]!=_0x18f1a6[_0xe4d4('0x1e')]?_0xe4d4('0x1f'):_0xe4d4('0x20');}return _0x18f1a6;}catch(_0x592bda){breakingLicense[_0xe4d4('0xe')]=_0x2712b0[_0xe4d4('0xf')];breakingLicense[_0xe4d4('0x21')]=_0x592bda[_0xe4d4('0x21')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4af145,_0x43d4be){getLicense()[_0xe4d4('0xc')](function(_0x4f7e53){return db[_0xe4d4('0x22')][_0xe4d4('0x23')]({'attributes':[_0xe4d4('0x24'),[db[_0xe4d4('0x25')]['fn'](_0xe4d4('0x26'),db[_0xe4d4('0x25')][_0xe4d4('0x27')]('role')),_0xe4d4('0x28')]],'group':'role','where':{'role':{'$or':['admin',_0xe4d4('0x29'),_0xe4d4('0x2a')]}},'raw':!![]})['then'](function(_0x28c642){var _0x1696b2={'user':_0x4f7e53[_0xe4d4('0x2b')]||0x0,'telephone':_0x4f7e53[_0xe4d4('0x2c')]||0x0};_0x28c642[_0xe4d4('0x2d')](function(_0x14b0bc){var _0x2b9db3=_0x14b0bc[_0xe4d4('0x24')]==='admin'?'user':_0x14b0bc[_0xe4d4('0x24')];_0x1696b2[_0x2b9db3]-=_0x14b0bc[_0xe4d4('0x28')];if(_0x1696b2[_0x2b9db3]<0x0)_0x1696b2[_0x2b9db3]=0x0;});_0x4af145(_0x1696b2);return;});})['catch'](function(_0x13abd2){_0x43d4be(_0x13abd2);});});}function checkUserLimits(_0x367a4c){return new BPromise(function(_0x1a9e84,_0x4c86b5){getLimits()['then'](function(_0x576e54){var _0x5757f4=_[_0xe4d4('0x2e')](_[_0xe4d4('0x2f')](_0x367a4c,_0xe4d4('0x24')),[_0xe4d4('0x30'),_0xe4d4('0x29'),_0xe4d4('0x2a')]);var _0x579c8e=(_0x5757f4[_0xe4d4('0x30')]||0x0)+(_0x5757f4[_0xe4d4('0x29')]||0x0);var _0x19b2f1=_0x5757f4[_0xe4d4('0x2a')]||0x0;if(_0x579c8e>_0x576e54['user'])return _0x4c86b5('License\x20limit\x20reached\x20for\x20users');if(_0x19b2f1>_0x576e54[_0xe4d4('0x2a')])return _0x4c86b5(_0xe4d4('0x31'));return _0x1a9e84();})[_0xe4d4('0xd')](function(_0x1d4493){_0x4c86b5(_0x1d4493);});});}module[_0xe4d4('0x32')]={'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 b8a47f8..301093c 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 _0x2da6=['app-id','secret','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x51b48b,_0x2feeb0){var _0x4bb672=function(_0x4ab45f){while(--_0x4ab45f){_0x51b48b['push'](_0x51b48b['shift']());}};_0x4bb672(++_0x2feeb0);}(_0x2da6,0x1dd));var _0x62da=function(_0x3f57,_0x6bcc0a){_0x3f57=_0x3f57-0x0;var _0x6b6240=_0x2da6[_0x3f57];return _0x6b6240;};'use strict';module[_0x62da('0x0')]={'DOMAIN':_0x62da('0x1'),'SESSION_SECRET':_0x62da('0x2'),'GOOGLE_ID':_0x62da('0x3'),'GOOGLE_SECRET':_0x62da('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x4325=['app-id','secret','exports','http://localhost:9000'];(function(_0x4a4bc9,_0xd8cbdb){var _0x3589ca=function(_0x11e401){while(--_0x11e401){_0x4a4bc9['push'](_0x4a4bc9['shift']());}};_0x3589ca(++_0xd8cbdb);}(_0x4325,0x1da));var _0x5432=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4325[_0x3ab51d];return _0x29a04e;};'use strict';module[_0x5432('0x0')]={'DOMAIN':_0x5432('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x5432('0x2'),'GOOGLE_SECRET':_0x5432('0x3'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 11b8697..e364531 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8124=['../utils/loggers','fileLogger'];(function(_0x4b174a,_0x33a017){var _0x3cd7bf=function(_0x44ccd9){while(--_0x44ccd9){_0x4b174a['push'](_0x4b174a['shift']());}};_0x3cd7bf(++_0x33a017);}(_0x8124,0xf4));var _0x4812=function(_0xfaf455,_0x13c0a9){_0xfaf455=_0xfaf455-0x0;var _0x5aaa60=_0x8124[_0xfaf455];return _0x5aaa60;};'use strict';var fileLogger=require(_0x4812('0x0'))[_0x4812('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x2666=['fileLogger','exports','../utils/loggers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2666,0xe6));var _0x6266=function(_0x43269b,_0xa49bc){_0x43269b=_0x43269b-0x0;var _0x23c40f=_0x2666[_0x43269b];return _0x23c40f;};'use strict';var fileLogger=require(_0x6266('0x0'))[_0x6266('0x1')];module[_0x6266('0x2')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2d12e4e..b76c57c 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 _0x0a0b=['email','../../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(_0x47abba,_0x5f30e6){var _0x1d8a97=function(_0x53ff9a){while(--_0x53ff9a){_0x47abba['push'](_0x47abba['shift']());}};_0x1d8a97(++_0x5f30e6);}(_0x0a0b,0x86));var _0xb0a0=function(_0x4b398e,_0x161863){_0x4b398e=_0x4b398e-0x0;var _0x59613e=_0x0a0b[_0x4b398e];return _0x59613e;};'use strict';var path=require(_0xb0a0('0x0'));var cfg=require(_0xb0a0('0x1'));var env={'NODE_PATH':path[_0xb0a0('0x2')](path[_0xb0a0('0x3')](cfg[_0xb0a0('0x4')],_0xb0a0('0x5')))};var pm2config={'apps':[{'name':'express','script':path['join'](__dirname,_0xb0a0('0x6')),'env':env},{'name':'ami','script':path[_0xb0a0('0x3')](__dirname,_0xb0a0('0x7')),'env':env},{'name':_0xb0a0('0x8'),'script':path[_0xb0a0('0x3')](__dirname,_0xb0a0('0x9')),'env':env},{'name':_0xb0a0('0xa'),'script':path[_0xb0a0('0x3')](__dirname,_0xb0a0('0xb')),'env':env},{'name':_0xb0a0('0xc'),'script':path[_0xb0a0('0x3')](__dirname,_0xb0a0('0xd')),'env':env},{'name':_0xb0a0('0xe'),'script':path[_0xb0a0('0x3')](__dirname,_0xb0a0('0xf')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xdd84=['routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','resolve','join','root','legacy-libs','../../services/express/index.js','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js'];(function(_0xebd01,_0x241259){var _0x1d5a92=function(_0x208657){while(--_0x208657){_0xebd01['push'](_0xebd01['shift']());}};_0x1d5a92(++_0x241259);}(_0xdd84,0xe5));var _0x4dd8=function(_0x3e1f6b,_0x3fffd8){_0x3e1f6b=_0x3e1f6b-0x0;var _0x52478b=_0xdd84[_0x3e1f6b];return _0x52478b;};'use strict';var path=require(_0x4dd8('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x4dd8('0x1')](path[_0x4dd8('0x2')](cfg[_0x4dd8('0x3')],_0x4dd8('0x4')))};var pm2config={'apps':[{'name':'express','script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0x5')),'env':env},{'name':'ami','script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0x6')),'env':env},{'name':_0x4dd8('0x7'),'script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0x8')),'env':env},{'name':_0x4dd8('0x9'),'script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0xa')),'env':env},{'name':_0x4dd8('0xb'),'script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0xc')),'env':env},{'name':_0x4dd8('0xd'),'script':path[_0x4dd8('0x2')](__dirname,_0x4dd8('0xe')),'env':env}]};module[_0x4dd8('0xf')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 83cdfb1..8096d8b 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 _0x5f4f=['connect','connected','start','disconnect','stop','then','list','describe','delete','dump','saved','bluebird'];(function(_0x537053,_0x6f32e7){var _0x98674f=function(_0x5e7ba7){while(--_0x5e7ba7){_0x537053['push'](_0x537053['shift']());}};_0x98674f(++_0x6f32e7);}(_0x5f4f,0x6b));var _0xf5f4=function(_0x528497,_0x147e87){_0x528497=_0x528497-0x0;var _0x392d59=_0x5f4f[_0x528497];return _0x392d59;};'use strict';var pm2=require('pm2');var BPromise=require(_0xf5f4('0x0'));var config=require('./config');function connect(){return new BPromise(function(_0x4ce399,_0x45e349){return pm2[_0xf5f4('0x1')](function(_0x41c74e){if(_0x41c74e){return _0x45e349(_0x41c74e);}return _0x4ce399(_0xf5f4('0x2'));});});};exports[_0xf5f4('0x3')]=function(_0x18e971){return connect()['then'](function(){return new BPromise(function(_0x1b554e,_0x11c78a){return pm2[_0xf5f4('0x3')](_0x18e971,function(_0x2618ef,_0x4edd4c){if(_0x2618ef){return _0x11c78a(_0x2618ef);}pm2[_0xf5f4('0x4')]();return _0x1b554e(_0x4edd4c);});});});};exports[_0xf5f4('0x5')]=function(_0x222666){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x31e3f3,_0x20a618){return pm2[_0xf5f4('0x5')](_0x222666,function(_0x18b2e9,_0x16b78e){if(_0x18b2e9){return _0x20a618(_0x18b2e9);}pm2[_0xf5f4('0x4')]();return _0x31e3f3(_0x16b78e);});});});};exports['restart']=function(_0x370bc7){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x552946,_0x1d92c0){return pm2['restart'](_0x370bc7,function(_0x53d282,_0x586a74){if(_0x53d282){return _0x1d92c0(_0x53d282);}pm2[_0xf5f4('0x4')]();return _0x552946(_0x586a74);});});});};exports[_0xf5f4('0x7')]=function(){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x572c72,_0x1082d8){return pm2[_0xf5f4('0x7')](function(_0x5dd017,_0x125321){if(_0x5dd017){return _0x1082d8(_0x5dd017);}pm2[_0xf5f4('0x4')]();return _0x572c72(_0x125321);});});});};exports[_0xf5f4('0x8')]=function(_0x105afe){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x4e37b1,_0x7490de){return pm2[_0xf5f4('0x8')](_0x105afe,function(_0x2d85af,_0x236425){if(_0x2d85af){return _0x7490de(_0x2d85af);}pm2[_0xf5f4('0x4')]();return _0x4e37b1(_0x236425);});});});};exports[_0xf5f4('0x9')]=function(_0x558c7e){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x342478,_0x397ca8){return pm2['delete'](_0x558c7e,function(_0xf64b74,_0x4083b0){if(_0xf64b74){return _0x397ca8(_0xf64b74);}pm2[_0xf5f4('0x4')]();return _0x342478(_0x4083b0);});});});};exports[_0xf5f4('0xa')]=function(){return connect()[_0xf5f4('0x6')](function(){return new BPromise(function(_0x28f0c4,_0x2df0b8){return pm2['dump'](function(_0x3641d7){if(_0x3641d7){return _0x2df0b8(_0x3641d7);}return _0x28f0c4(_0xf5f4('0xb'));});});});}; \ No newline at end of file +var _0x610f=['disconnect','stop','then','restart','list','describe','delete','dump','saved','pm2','bluebird','connected','start'];(function(_0x40e174,_0x56f057){var _0x3e3098=function(_0x49ae49){while(--_0x49ae49){_0x40e174['push'](_0x40e174['shift']());}};_0x3e3098(++_0x56f057);}(_0x610f,0xd9));var _0xf610=function(_0x1b35b6,_0x57c933){_0x1b35b6=_0x1b35b6-0x0;var _0x5e0e18=_0x610f[_0x1b35b6];return _0x5e0e18;};'use strict';var pm2=require(_0xf610('0x0'));var BPromise=require(_0xf610('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2f9a5e,_0x3c51b6){return pm2['connect'](function(_0x322c78){if(_0x322c78){return _0x3c51b6(_0x322c78);}return _0x2f9a5e(_0xf610('0x2'));});});};exports[_0xf610('0x3')]=function(_0x45d1b5){return connect()['then'](function(){return new BPromise(function(_0x75c30b,_0x3c8691){return pm2['start'](_0x45d1b5,function(_0x4fc3c7,_0xcfaaaf){if(_0x4fc3c7){return _0x3c8691(_0x4fc3c7);}pm2[_0xf610('0x4')]();return _0x75c30b(_0xcfaaaf);});});});};exports[_0xf610('0x5')]=function(_0xbe35c6){return connect()[_0xf610('0x6')](function(){return new BPromise(function(_0x3a1fa0,_0xa718ec){return pm2[_0xf610('0x5')](_0xbe35c6,function(_0x5bac41,_0x28e150){if(_0x5bac41){return _0xa718ec(_0x5bac41);}pm2[_0xf610('0x4')]();return _0x3a1fa0(_0x28e150);});});});};exports[_0xf610('0x7')]=function(_0x5b1637){return connect()['then'](function(){return new BPromise(function(_0x269a58,_0x3cc85c){return pm2[_0xf610('0x7')](_0x5b1637,function(_0x2b5820,_0x166525){if(_0x2b5820){return _0x3cc85c(_0x2b5820);}pm2[_0xf610('0x4')]();return _0x269a58(_0x166525);});});});};exports[_0xf610('0x8')]=function(){return connect()[_0xf610('0x6')](function(){return new BPromise(function(_0xb814a,_0x31e32d){return pm2[_0xf610('0x8')](function(_0xe31f56,_0x5f4e07){if(_0xe31f56){return _0x31e32d(_0xe31f56);}pm2[_0xf610('0x4')]();return _0xb814a(_0x5f4e07);});});});};exports[_0xf610('0x9')]=function(_0x33f04b){return connect()[_0xf610('0x6')](function(){return new BPromise(function(_0x479149,_0x39ffc9){return pm2[_0xf610('0x9')](_0x33f04b,function(_0x1b25ad,_0x5805ce){if(_0x1b25ad){return _0x39ffc9(_0x1b25ad);}pm2[_0xf610('0x4')]();return _0x479149(_0x5805ce);});});});};exports[_0xf610('0xa')]=function(_0x5859a6){return connect()['then'](function(){return new BPromise(function(_0x2017cf,_0x4eb001){return pm2[_0xf610('0xa')](_0x5859a6,function(_0x312c82,_0x1d8868){if(_0x312c82){return _0x4eb001(_0x312c82);}pm2[_0xf610('0x4')]();return _0x2017cf(_0x1d8868);});});});};exports[_0xf610('0xb')]=function(){return connect()[_0xf610('0x6')](function(){return new BPromise(function(_0x2b1dad,_0xdbe3b4){return pm2[_0xf610('0xb')](function(_0x4e4977){if(_0x4e4977){return _0xdbe3b4(_0x4e4977);}return _0x2b1dad(_0xf610('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 5216887..b24f3bb 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 _0x652a=['YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','inspect','start','lodash','ioredis','util','../../config/environment','schedule','redis','defaults','localhost','Setting','chatTimeout','ChatInteraction','then','length','map','info','join','update','format'];(function(_0x30f806,_0x3bd0d8){var _0xddbfc7=function(_0x1ed34f){while(--_0x1ed34f){_0x30f806['push'](_0x30f806['shift']());}};_0xddbfc7(++_0x3bd0d8);}(_0x652a,0x1b6));var _0xa652=function(_0x25d7f4,_0x25f79f){_0x25d7f4=_0x25d7f4-0x0;var _0x4112d8=_0x652a[_0x25d7f4];return _0x4112d8;};'use strict';var _=require(_0xa652('0x0'));var moment=require('moment');var Redis=require(_0xa652('0x1'));var util=require(_0xa652('0x2'));var config=require(_0xa652('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xa652('0x4'));config[_0xa652('0x5')]=_[_0xa652('0x6')](config[_0xa652('0x5')],{'host':_0xa652('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa652('0x5')]));function closeInteractions(){var _0x25e206=0x0;var _0xc0bfb8=[];return db[_0xa652('0x8')]['find']({'raw':!![],'attributes':['id',_0xa652('0x9')],'where':{'id':0x1}})['then'](function(_0x4f35dd){_0x25e206=_0x4f35dd[_0xa652('0x9')];if(_0x25e206){return db[_0xa652('0xa')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4f35dd[_0xa652('0x9')],'minutes')}}});}else{return[];}})[_0xa652('0xb')](function(_0x3f0f88){if(_0x3f0f88&&_0x3f0f88[_0xa652('0xc')]){_0xc0bfb8=_[_0xa652('0xd')](_0x3f0f88||[],'id');logger[_0xa652('0xe')]('[CHAT]\x20Interactions\x20to\x20close:',_0xc0bfb8[_0xa652('0xf')]());return db[_0xa652('0xa')][_0xa652('0x10')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xa652('0x11')](_0xa652('0x12'))},{'where':{'id':_0xc0bfb8}});}})[_0xa652('0xb')](function(){if(_0xc0bfb8&&_0xc0bfb8['length']){logger['info'](_0xa652('0x13'),_0xc0bfb8[_0xa652('0xf')]());for(var _0x578b23=0x0;_0x578b23<_0xc0bfb8[_0xa652('0xc')];_0x578b23++){io[_0xa652('0x14')](_0xa652('0x15'),{'id':_0xc0bfb8[_0x578b23],'closed':!![]});}}})['catch'](function(_0x1291ee){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x1291ee?util[_0xa652('0x16')](_0x1291ee,{'showHidden':![],'depth':null}):'');});}exports[_0xa652('0x17')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa719=['ioredis','util','../../mysqldb','../logger','schedule','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','then','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','inspect','start','lodash','moment'];(function(_0x9ffdd8,_0x414bbd){var _0x222710=function(_0x500ff3){while(--_0x500ff3){_0x9ffdd8['push'](_0x9ffdd8['shift']());}};_0x222710(++_0x414bbd);}(_0xa719,0x1ab));var _0x9a71=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xa719[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x9a71('0x0'));var moment=require(_0x9a71('0x1'));var Redis=require(_0x9a71('0x2'));var util=require(_0x9a71('0x3'));var config=require('../../config/environment');var db=require(_0x9a71('0x4'))['db'];var logger=require(_0x9a71('0x5'))(_0x9a71('0x6'));config['redis']=_[_0x9a71('0x7')](config[_0x9a71('0x8')],{'host':_0x9a71('0x9'),'port':0x18eb});var io=require(_0x9a71('0xa'))(new Redis(config[_0x9a71('0x8')]));function closeInteractions(){var _0xa3823e=0x0;var _0x1b326b=[];return db[_0x9a71('0xb')][_0x9a71('0xc')]({'raw':!![],'attributes':['id',_0x9a71('0xd')],'where':{'id':0x1}})['then'](function(_0xe3050){_0xa3823e=_0xe3050[_0x9a71('0xd')];if(_0xa3823e){return db[_0x9a71('0xe')][_0x9a71('0xf')]({'raw':!![],'attributes':['id',_0x9a71('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x9a71('0x11')](_0xe3050[_0x9a71('0xd')],_0x9a71('0x12'))}}});}else{return[];}})[_0x9a71('0x13')](function(_0x28e2ad){if(_0x28e2ad&&_0x28e2ad[_0x9a71('0x14')]){_0x1b326b=_['map'](_0x28e2ad||[],'id');logger[_0x9a71('0x15')](_0x9a71('0x16'),_0x1b326b[_0x9a71('0x17')]());return db[_0x9a71('0xe')][_0x9a71('0x18')]({'closeReason':'system','disposition':_0x9a71('0x19'),'closed':!![],'closedAt':moment()['format'](_0x9a71('0x1a'))},{'where':{'id':_0x1b326b}});}})[_0x9a71('0x13')](function(){if(_0x1b326b&&_0x1b326b['length']){logger[_0x9a71('0x15')](_0x9a71('0x1b'),_0x1b326b[_0x9a71('0x17')]());for(var _0x5e1a6e=0x0;_0x5e1a6e<_0x1b326b[_0x9a71('0x14')];_0x5e1a6e++){io[_0x9a71('0x1c')](_0x9a71('0x1d'),{'id':_0x1b326b[_0x5e1a6e],'closed':!![]});}}})['catch'](function(_0x2cde79){logger[_0x9a71('0x1e')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2cde79?util[_0x9a71('0x1f')](_0x2cde79,{'showHidden':![],'depth':null}):'');});}exports[_0x9a71('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index a3b35d5..f92c6e6 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 _0xe21f=['exports'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xe21f,0x10c));var _0xfe21=function(_0x240c1b,_0x1c0af4){_0x240c1b=_0x240c1b-0x0;var _0x495181=_0xe21f[_0x240c1b];return _0x495181;};'use strict';function start(){var _0x463719=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x463719['startAllRefreshIntervals']();}module[_0xfe21('0x0')]={'intervals':{},'start':start}; \ No newline at end of file +var _0x4f7d=['exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x4f7d,0x1c1));var _0xd4f7=function(_0x314674,_0x55cc2f){_0x314674=_0x314674-0x0;var _0x598f62=_0x4f7d[_0x314674];return _0x598f62;};'use strict';function start(){var _0x5bde44=require(_0xd4f7('0x0'));return _0x5bde44['startAllRefreshIntervals']();}module[_0xd4f7('0x1')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index bb07fec..27d5e69 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 _0xb7eb=['runReport','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','jobs','map','toString','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','start','add\x20cron','stop\x20cron','update\x20cron','run','util','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','attachments','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','info','SendMail','then','error','stringify','email\x20sent','catch','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s'];(function(_0x3010ac,_0x439bdf){var _0x50c290=function(_0x2068af){while(--_0x2068af){_0x3010ac['push'](_0x3010ac['shift']());}};_0x50c290(++_0x439bdf);}(_0xb7eb,0x124));var _0xbb7e=function(_0x17d6e3,_0x562811){_0x17d6e3=_0x17d6e3-0x0;var _0x17a10a=_0xb7eb[_0x17d6e3];return _0x17a10a;};'use strict';var fs=require('fs');var util=require(_0xbb7e('0x0'));var path=require(_0xbb7e('0x1'));var _=require(_0xbb7e('0x2'));var moment=require(_0xbb7e('0x3'));var CronJobManager=require(_0xbb7e('0x4'));var jayson=require(_0xbb7e('0x5'));var BPromise=require(_0xbb7e('0x6'));var logger=require(_0xbb7e('0x7'))(_0xbb7e('0x8'));var db=require(_0xbb7e('0x9'))['db'];var analyticCustomReportController=require(_0xbb7e('0xa'));var analyticDefaultReportController=require(_0xbb7e('0xb'));var client=jayson[_0xbb7e('0xc')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x5429ac,_0x4f65b8){return function(){logger['info'](_0xbb7e('0xd'),_0x5429ac[_0xbb7e('0xe')]);var _0xde1af8=!![];var _0x18247c=_0x5429ac[_0xbb7e('0xf')][_0xbb7e('0x10')]();var _0x8e255d={'account':_0x18247c,'message':{'from':util[_0xbb7e('0x11')]('\x22%s\x22\x20<%s>',_0x5429ac[_0xbb7e('0xf')][_0xbb7e('0x12')],_0x5429ac[_0xbb7e('0xf')][_0xbb7e('0xe')]||_0x5429ac['MailAccount'][_0xbb7e('0x13')]['user']),'to':_0x5429ac[_0xbb7e('0xe')],'cc':_0x5429ac['cc'],'bcc':_0x5429ac[_0xbb7e('0x14')],'subject':util[_0xbb7e('0x11')](_0xbb7e('0x15'),_0x4f65b8['name'],_0x5429ac[_0xbb7e('0x16')],_0x5429ac['subtractUnit'])}};var _0x46dc20=path['join'](__dirname,_0xbb7e('0x17'));var _0x4e0db2=_0x4f65b8[_0xbb7e('0x18')];var _0x30f4d9=util[_0xbb7e('0x11')](_0xbb7e('0x19'),path[_0xbb7e('0x1a')](_0x4f65b8[_0xbb7e('0x18')],path[_0xbb7e('0x1b')](_0x4f65b8[_0xbb7e('0x18')])),_0xbb7e('0x1c'));var _0x12556d=path[_0xbb7e('0x1d')](_0x46dc20,_0x4e0db2);var _0x44e6b0=path[_0xbb7e('0x1d')](_0x46dc20,_0x30f4d9);if(fs[_0xbb7e('0x1e')](_0x12556d)){_0x4f65b8[_0xbb7e('0x1f')]=_0xbb7e('0x20');_0x8e255d['message'][_0xbb7e('0x21')]=[{'filename':_0x4e0db2,'path':_0x12556d}];_0x8e255d[_0xbb7e('0x22')][_0xbb7e('0x23')]=util[_0xbb7e('0x11')](_0xbb7e('0x24'),JSON['stringify'](_0x4f65b8,null,0x2));}else if(fs['existsSync'](_0x44e6b0)){_0x4f65b8['status']=_0xbb7e('0x20');_0x8e255d['message']['attachments']=[{'filename':_0x30f4d9,'path':_0x44e6b0}];}else{_0x8e255d['message'][_0xbb7e('0x23')]=_0xbb7e('0x25');if(!_0x5429ac['sendIfEmpty']){_0xde1af8=![];logger[_0xbb7e('0x26')]('empty\x20file,\x20email\x20not\x20sent');}}if(_0xde1af8){return client['request'](_0xbb7e('0x27'),_0x8e255d)[_0xbb7e('0x28')](function(_0x436d95){if(_0x436d95['error']){return logger[_0xbb7e('0x29')]('error\x20mail',JSON[_0xbb7e('0x2a')](_0x436d95));}return logger[_0xbb7e('0x26')](_0xbb7e('0x2b'));})[_0xbb7e('0x2c')](function(_0xc79d28){return logger[_0xbb7e('0x29')](_0xbb7e('0x2d'),JSON[_0xbb7e('0x2a')](_0xc79d28));});}};}function handleError(){return function(_0x537ab1){return logger[_0xbb7e('0x29')](JSON[_0xbb7e('0x2a')](_0x537ab1));};}function handleResult(_0x310880){return function(_0x1babc3){logger[_0xbb7e('0x26')](_0xbb7e('0x2e'),JSON['stringify'](_0x1babc3));if(_0x310880['MailAccount']&&_0x310880[_0xbb7e('0xf')]['Smtp']&&!_[_0xbb7e('0x2f')](_0x310880['email'])){setTimeout(handleSendEmail(_0x310880,_0x1babc3),0x3c*0x3e8);}};}function handleJob(_0x223b45){return function(){try{if(_[_0xbb7e('0x2f')](_0x223b45[_0xbb7e('0x16')])){return logger['info'](_0xbb7e('0x30'));}if(_[_0xbb7e('0x2f')](_0x223b45[_0xbb7e('0x31')])){return logger[_0xbb7e('0x26')](_0xbb7e('0x32'));}var _0x7dbfca={'startDate':moment()['subtract'](_0x223b45[_0xbb7e('0x16')],_0x223b45[_0xbb7e('0x31')])[_0xbb7e('0x11')](_0xbb7e('0x33')),'endDate':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xbb7e('0x34'),'output':_0x223b45[_0xbb7e('0x35')],'name':_0x223b45[_0xbb7e('0x12')]};if(!_[_0xbb7e('0x2f')](_0x223b45[_0xbb7e('0x36')])){logger[_0xbb7e('0x26')](_0xbb7e('0x37'),_0x223b45[_0xbb7e('0x36')]);return analyticDefaultReportController[_0xbb7e('0x38')]({'id':_0x223b45[_0xbb7e('0x36')]},_0x7dbfca)['then'](handleResult(_0x223b45))[_0xbb7e('0x2c')](handleError());}if(!_[_0xbb7e('0x2f')](_0x223b45[_0xbb7e('0x39')])){logger[_0xbb7e('0x26')](_0xbb7e('0x3a'),_0x223b45['CustomReportId']);return analyticCustomReportController[_0xbb7e('0x38')]({'id':_0x223b45[_0xbb7e('0x39')]},_0x7dbfca)[_0xbb7e('0x28')](handleResult(_0x223b45))[_0xbb7e('0x2c')](handleError());}}catch(_0x45ce9c){logger[_0xbb7e('0x29')](JSON['stringify'](_0x45ce9c));}return logger[_0xbb7e('0x26')](_0xbb7e('0x3b'));};}function getJobs(_0x52a64e){var _0x501a13={};if(_0x52a64e){_0x501a13['id']=_0x52a64e;}return db['Schedule'][_0xbb7e('0x3c')]({'where':_0x501a13,'include':[{'model':db['MailAccount'],'attributes':['id',_0xbb7e('0x12'),_0xbb7e('0xe')],'include':[{'model':db[_0xbb7e('0x3d')],'as':_0xbb7e('0x13'),'include':[{'model':db[_0xbb7e('0x3e')],'as':_0xbb7e('0x3e')}]}]}]})['then'](function(_0x208306){var _0x2435de=_['keys'](manager[_0xbb7e('0x3f')]);var _0x3f8ecf=_[_0xbb7e('0x40')](_0x208306,function(_0x4d450e){return _0x4d450e['id']['toString']();});var _0x1a3524=_['keyBy'](_0x208306,function(_0x16fe2d){return _0x16fe2d['id'][_0xbb7e('0x41')]();});var _0x4e59fa=_0x52a64e?_0x3f8ecf:_[_0xbb7e('0x42')](_0x3f8ecf,_0x2435de);var _0xe28321=_['intersection'](_0x3f8ecf,_0x2435de);var _0x1fa3db=_[_0xbb7e('0x42')](_0x2435de,_0x3f8ecf);var _0x1ce61a;var _0x1a1f23;for(_0x1ce61a=0x0;_0x1ce61a<_0x1fa3db[_0xbb7e('0x43')]&&!_0x52a64e;_0x1ce61a+=0x1){_0x1a1f23=_0x1fa3db[_0x1ce61a][_0xbb7e('0x41')]();if(manager[_0xbb7e('0x44')](_0x1a1f23)){manager[_0xbb7e('0x45')](_0x1a1f23);manager[_0xbb7e('0x46')](_0x1a1f23);logger['info'](_0xbb7e('0x47'),_0x1a1f23);}}logger['info'](_0xbb7e('0x48'),JSON[_0xbb7e('0x2a')](_0x4e59fa));for(_0x1ce61a=0x0;_0x1ce61a<_0x4e59fa[_0xbb7e('0x43')];_0x1ce61a+=0x1){_0x1a1f23=_0x4e59fa[_0x1ce61a]['toString']();logger['info'](_0xbb7e('0x49'),_0x1a1f23);if(_0x52a64e){logger[_0xbb7e('0x26')](_0xbb7e('0x4a'),_0x52a64e);logger[_0xbb7e('0x26')](JSON[_0xbb7e('0x2a')](_0x1a3524[_0x1a1f23]));BPromise[_0xbb7e('0x4b')]()[_0xbb7e('0x28')](handleJob(_0x1a3524[_0x1a1f23]));logger['info'](_0xbb7e('0x4c'),_0x1a3524[_0x1a1f23][_0xbb7e('0x12')],_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]);}else if(_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]&&_0x1a3524[_0x1a1f23][_0xbb7e('0x4e')]&&moment()[_0xbb7e('0x4f')](_0x1a3524[_0x1a1f23][_0xbb7e('0x50')],_0x1a3524[_0x1a1f23][_0xbb7e('0x51')])){manager['add'](_0x1a1f23,_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')],handleJob(_0x1a3524[_0x1a1f23]));manager[_0xbb7e('0x52')](_0x1a1f23);logger[_0xbb7e('0x26')](_0xbb7e('0x53'),_0x1a3524[_0x1a1f23][_0xbb7e('0x12')],_0x1a3524[_0x1a1f23]['cron']);}else if(manager[_0xbb7e('0x44')](_0x1a1f23)){manager[_0xbb7e('0x45')](_0x1a1f23);manager[_0xbb7e('0x46')](_0x1a1f23);logger['info'](_0xbb7e('0x54'),_0x1a3524[_0x1a1f23]['name'],_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]);}}for(_0x1ce61a=0x0,_0x1a1f23;_0x1ce61a<_0xe28321[_0xbb7e('0x43')]&&!_0x52a64e;_0x1ce61a+=0x1){_0x1a1f23=_0xe28321[_0x1ce61a]['toString']();if(manager['exists'](_0x1a1f23)){if(_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]&&_0x1a3524[_0x1a1f23][_0xbb7e('0x4e')]&&moment()[_0xbb7e('0x4f')](_0x1a3524[_0x1a1f23]['startAt'],_0x1a3524[_0x1a1f23]['endAt'])){manager['update'](_0x1a1f23,_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')],handleJob(_0x1a3524[_0x1a1f23]));logger[_0xbb7e('0x26')](_0xbb7e('0x55'),_0x1a3524[_0x1a1f23][_0xbb7e('0x12')],_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]);}else{manager[_0xbb7e('0x45')](_0x1a1f23);manager['deleteJob'](_0x1a1f23);logger[_0xbb7e('0x26')](_0xbb7e('0x54'),_0x1a3524[_0x1a1f23][_0xbb7e('0x12')],_0x1a3524[_0x1a1f23][_0xbb7e('0x4d')]);}}}})['catch'](function(_0x5c3032){logger[_0xbb7e('0x29')](JSON[_0xbb7e('0x2a')](_0x5c3032));});}exports[_0xbb7e('0x56')]=function(_0x1601b9){return getJobs(_0x1601b9);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x62e8=['keys','jobs','map','toString','difference','intersection','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add','start','add\x20cron','exists','stop\x20cron','update','update\x20cron','run','util','path','jayson/promise','bluebird','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','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','status','Sent','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','error','email\x20sent','error\x20mail','data','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','exec\x20custom\x20report\x20id:%s','catch','no\x20report\x20id','Schedule','findAll','MailServerOut'];(function(_0x459e46,_0x526e8a){var _0x3748d8=function(_0x2eaea0){while(--_0x2eaea0){_0x459e46['push'](_0x459e46['shift']());}};_0x3748d8(++_0x526e8a);}(_0x62e8,0x1ba));var _0x862e=function(_0x3263c1,_0x3f58f0){_0x3263c1=_0x3263c1-0x0;var _0x322cee=_0x62e8[_0x3263c1];return _0x322cee;};'use strict';var fs=require('fs');var util=require(_0x862e('0x0'));var path=require(_0x862e('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x862e('0x2'));var BPromise=require(_0x862e('0x3'));var logger=require('../logger')(_0x862e('0x4'));var db=require(_0x862e('0x5'))['db'];var analyticCustomReportController=require(_0x862e('0x6'));var analyticDefaultReportController=require(_0x862e('0x7'));var client=jayson[_0x862e('0x8')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x30dcff,_0x580c4a){return function(){logger[_0x862e('0x9')](_0x862e('0xa'),_0x30dcff[_0x862e('0xb')]);var _0x198dcb=!![];var _0x24b44b=_0x30dcff[_0x862e('0xc')][_0x862e('0xd')]();var _0x4b5fa4={'account':_0x24b44b,'message':{'from':util[_0x862e('0xe')]('\x22%s\x22\x20<%s>',_0x30dcff[_0x862e('0xc')][_0x862e('0xf')],_0x30dcff['MailAccount'][_0x862e('0xb')]||_0x30dcff[_0x862e('0xc')][_0x862e('0x10')][_0x862e('0x11')]),'to':_0x30dcff[_0x862e('0xb')],'cc':_0x30dcff['cc'],'bcc':_0x30dcff['bcc'],'subject':util['format'](_0x862e('0x12'),_0x580c4a[_0x862e('0xf')],_0x30dcff[_0x862e('0x13')],_0x30dcff[_0x862e('0x14')])}};var _0x30c5f5=path['join'](__dirname,_0x862e('0x15'));var _0x361976=_0x580c4a[_0x862e('0x16')];var _0x457346=util[_0x862e('0xe')](_0x862e('0x17'),path[_0x862e('0x18')](_0x580c4a[_0x862e('0x16')],path[_0x862e('0x19')](_0x580c4a[_0x862e('0x16')])),_0x862e('0x1a'));var _0x52e325=path['join'](_0x30c5f5,_0x361976);var _0x1109bb=path['join'](_0x30c5f5,_0x457346);if(fs[_0x862e('0x1b')](_0x52e325)){_0x580c4a['status']='Sent';_0x4b5fa4[_0x862e('0x1c')][_0x862e('0x1d')]=[{'filename':_0x361976,'path':_0x52e325}];_0x4b5fa4[_0x862e('0x1c')][_0x862e('0x1e')]=util[_0x862e('0xe')](_0x862e('0x1f'),JSON[_0x862e('0x20')](_0x580c4a,null,0x2));}else if(fs[_0x862e('0x1b')](_0x1109bb)){_0x580c4a[_0x862e('0x21')]=_0x862e('0x22');_0x4b5fa4['message'][_0x862e('0x1d')]=[{'filename':_0x457346,'path':_0x1109bb}];}else{_0x4b5fa4[_0x862e('0x1c')][_0x862e('0x1e')]=_0x862e('0x23');if(!_0x30dcff['sendIfEmpty']){_0x198dcb=![];logger[_0x862e('0x9')](_0x862e('0x24'));}}if(_0x198dcb){return client[_0x862e('0x25')]('SendMail',_0x4b5fa4)['then'](function(_0x299c55){if(_0x299c55[_0x862e('0x26')]){return logger[_0x862e('0x26')]('error\x20mail',JSON['stringify'](_0x299c55));}return logger[_0x862e('0x9')](_0x862e('0x27'));})['catch'](function(_0x115592){return logger[_0x862e('0x26')](_0x862e('0x28'),JSON[_0x862e('0x20')](_0x115592));});}};}function handleError(){return function(_0x5b5bc3){return logger[_0x862e('0x26')](JSON[_0x862e('0x20')](_0x5b5bc3));};}function handleResult(_0x346426){return function(_0x110044){logger[_0x862e('0x9')](_0x862e('0x29'),JSON[_0x862e('0x20')](_0x110044));if(_0x346426[_0x862e('0xc')]&&_0x346426[_0x862e('0xc')]['Smtp']&&!_[_0x862e('0x2a')](_0x346426['email'])){setTimeout(handleSendEmail(_0x346426,_0x110044),0x3c*0x3e8);}};}function handleJob(_0xb72b38){return function(){try{if(_['isNil'](_0xb72b38['subtractNumber'])){return logger[_0x862e('0x9')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x862e('0x2a')](_0xb72b38[_0x862e('0x14')])){return logger[_0x862e('0x9')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3eaba8={'startDate':moment()['subtract'](_0xb72b38['subtractNumber'],_0xb72b38[_0x862e('0x14')])[_0x862e('0xe')](_0x862e('0x2b')),'endDate':moment()[_0x862e('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x862e('0x2c'),'output':_0xb72b38[_0x862e('0x2d')],'name':_0xb72b38['name']};if(!_[_0x862e('0x2a')](_0xb72b38[_0x862e('0x2e')])){logger[_0x862e('0x9')]('exec\x20defaul\x20report\x20id:%s',_0xb72b38[_0x862e('0x2e')]);return analyticDefaultReportController[_0x862e('0x2f')]({'id':_0xb72b38[_0x862e('0x2e')]},_0x3eaba8)[_0x862e('0x30')](handleResult(_0xb72b38))['catch'](handleError());}if(!_['isNil'](_0xb72b38[_0x862e('0x31')])){logger[_0x862e('0x9')](_0x862e('0x32'),_0xb72b38[_0x862e('0x31')]);return analyticCustomReportController[_0x862e('0x2f')]({'id':_0xb72b38[_0x862e('0x31')]},_0x3eaba8)[_0x862e('0x30')](handleResult(_0xb72b38))[_0x862e('0x33')](handleError());}}catch(_0x536f24){logger[_0x862e('0x26')](JSON[_0x862e('0x20')](_0x536f24));}return logger[_0x862e('0x9')](_0x862e('0x34'));};}function getJobs(_0x2eb16a){var _0x2f1796={};if(_0x2eb16a){_0x2f1796['id']=_0x2eb16a;}return db[_0x862e('0x35')][_0x862e('0x36')]({'where':_0x2f1796,'include':[{'model':db[_0x862e('0xc')],'attributes':['id',_0x862e('0xf'),_0x862e('0xb')],'include':[{'model':db[_0x862e('0x37')],'as':_0x862e('0x10'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x862e('0x30')](function(_0x4503a1){var _0x32ff04=_[_0x862e('0x38')](manager[_0x862e('0x39')]);var _0x3e899e=_[_0x862e('0x3a')](_0x4503a1,function(_0x5ecc98){return _0x5ecc98['id']['toString']();});var _0x988dae=_['keyBy'](_0x4503a1,function(_0x2c168b){return _0x2c168b['id'][_0x862e('0x3b')]();});var _0x1cd01d=_0x2eb16a?_0x3e899e:_[_0x862e('0x3c')](_0x3e899e,_0x32ff04);var _0x1a4084=_[_0x862e('0x3d')](_0x3e899e,_0x32ff04);var _0x227490=_['difference'](_0x32ff04,_0x3e899e);var _0x3c309e;var _0x87d7c9;for(_0x3c309e=0x0;_0x3c309e<_0x227490['length']&&!_0x2eb16a;_0x3c309e+=0x1){_0x87d7c9=_0x227490[_0x3c309e][_0x862e('0x3b')]();if(manager['exists'](_0x87d7c9)){manager[_0x862e('0x3e')](_0x87d7c9);manager[_0x862e('0x3f')](_0x87d7c9);logger[_0x862e('0x9')](_0x862e('0x40'),_0x87d7c9);}}logger[_0x862e('0x9')](_0x862e('0x41'),JSON[_0x862e('0x20')](_0x1cd01d));for(_0x3c309e=0x0;_0x3c309e<_0x1cd01d[_0x862e('0x42')];_0x3c309e+=0x1){_0x87d7c9=_0x1cd01d[_0x3c309e]['toString']();logger[_0x862e('0x9')](_0x862e('0x43'),_0x87d7c9);if(_0x2eb16a){logger[_0x862e('0x9')](_0x862e('0x44'),_0x2eb16a);logger[_0x862e('0x9')](JSON[_0x862e('0x20')](_0x988dae[_0x87d7c9]));BPromise[_0x862e('0x45')]()['then'](handleJob(_0x988dae[_0x87d7c9]));logger[_0x862e('0x9')](_0x862e('0x46'),_0x988dae[_0x87d7c9][_0x862e('0xf')],_0x988dae[_0x87d7c9][_0x862e('0x47')]);}else if(_0x988dae[_0x87d7c9][_0x862e('0x47')]&&_0x988dae[_0x87d7c9][_0x862e('0x48')]&&moment()[_0x862e('0x49')](_0x988dae[_0x87d7c9]['startAt'],_0x988dae[_0x87d7c9][_0x862e('0x4a')])){manager[_0x862e('0x4b')](_0x87d7c9,_0x988dae[_0x87d7c9][_0x862e('0x47')],handleJob(_0x988dae[_0x87d7c9]));manager[_0x862e('0x4c')](_0x87d7c9);logger[_0x862e('0x9')](_0x862e('0x4d'),_0x988dae[_0x87d7c9]['name'],_0x988dae[_0x87d7c9]['cron']);}else if(manager[_0x862e('0x4e')](_0x87d7c9)){manager[_0x862e('0x3e')](_0x87d7c9);manager['deleteJob'](_0x87d7c9);logger[_0x862e('0x9')](_0x862e('0x4f'),_0x988dae[_0x87d7c9][_0x862e('0xf')],_0x988dae[_0x87d7c9][_0x862e('0x47')]);}}for(_0x3c309e=0x0,_0x87d7c9;_0x3c309e<_0x1a4084[_0x862e('0x42')]&&!_0x2eb16a;_0x3c309e+=0x1){_0x87d7c9=_0x1a4084[_0x3c309e][_0x862e('0x3b')]();if(manager[_0x862e('0x4e')](_0x87d7c9)){if(_0x988dae[_0x87d7c9][_0x862e('0x47')]&&_0x988dae[_0x87d7c9][_0x862e('0x48')]&&moment()[_0x862e('0x49')](_0x988dae[_0x87d7c9]['startAt'],_0x988dae[_0x87d7c9][_0x862e('0x4a')])){manager[_0x862e('0x50')](_0x87d7c9,_0x988dae[_0x87d7c9][_0x862e('0x47')],handleJob(_0x988dae[_0x87d7c9]));logger[_0x862e('0x9')](_0x862e('0x51'),_0x988dae[_0x87d7c9]['name'],_0x988dae[_0x87d7c9][_0x862e('0x47')]);}else{manager[_0x862e('0x3e')](_0x87d7c9);manager[_0x862e('0x3f')](_0x87d7c9);logger[_0x862e('0x9')](_0x862e('0x4f'),_0x988dae[_0x87d7c9][_0x862e('0xf')],_0x988dae[_0x87d7c9][_0x862e('0x47')]);}}}})[_0x862e('0x33')](function(_0x3b398e){logger['error'](JSON[_0x862e('0x20')](_0x3b398e));});}exports[_0x862e('0x52')]=function(_0x5866ab){return getJobs(_0x5866ab);};exports[_0x862e('0x4c')]=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 5d654cc..da29ce5 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 _0x7cda=['TranscriptionJob','fileText','TranscriptionJobStatus','Transcript','TranscriptFileUri','then','transcripts','length','results','tempSentiment','Sequelize','sentimentAccountId','language','bucket','ValidationError','CloudProvider','Cloud\x20Provider\x20not\x20available','sentimentRegion','update','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','findOne','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Negative','COMPLETED','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','Setting','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','forEach','all','inspect','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','getTranscriptionJob','substring','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','info'];(function(_0x28fbbf,_0x11f896){var _0x543af6=function(_0x27fa74){while(--_0x27fa74){_0x28fbbf['push'](_0x28fbbf['shift']());}};_0x543af6(++_0x11f896);}(_0x7cda,0xf6));var _0xa7cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cda[_0x3dd15e];return _0x231fd0;};var _=require('lodash');var AWS=require(_0xa7cd('0x0'));var rp=require(_0xa7cd('0x1'));var util=require(_0xa7cd('0x2'));var BPromise=require('bluebird');var db=require(_0xa7cd('0x3'))['db'];var logger=require(_0xa7cd('0x4'))('transcribe');function getTranscriptionJob(_0x232be5,_0xdb8470,_0x5560e0,_0x37990d){return new Promise(function(_0x5f20a2,_0x3d43e6){var _0x5c2b39=new AWS['TranscribeService']({'accessKeyId':_0xdb8470,'secretAccessKey':_0x232be5,'region':_0x5560e0});_0x5c2b39[_0xa7cd('0x5')]({'TranscriptionJobName':_0x37990d},function(_0x4a9e39,_0x2554e8){if(_0x4a9e39){return _0x3d43e6(_0x4a9e39);}else{return _0x5f20a2(_0x2554e8);}});});}function sentiment(_0x205075,_0x108be3,_0x6d21d3,_0x31879f,_0x372273){return new Promise(function(_0x39d8c4,_0x1a66f7){var _0xd20e5d=new AWS['Comprehend']({'accessKeyId':_0x108be3,'secretAccessKey':_0x205075,'region':_0x6d21d3});_0xd20e5d['detectSentiment']({'Text':_0x31879f,'LanguageCode':_0x372273[_0xa7cd('0x6')](0x0,0x2)},function(_0xf902eb,_0x53cf92){if(_0xf902eb){return _0x1a66f7(_0xf902eb);}else{return _0x39d8c4(_0x53cf92);}});});}function checkTranscribeJob(_0xc60cec,_0x4056ee,_0x57fb93){var _0x3bbf3b;return new BPromise(function(_0x3f72f8,_0x136aae){logger['info'](util[_0xa7cd('0x7')](_0xa7cd('0x8'),_0xc60cec['id'],_0xc60cec[_0xa7cd('0x9')]));return getTranscriptionJob(_0x57fb93[_0xa7cd('0xa')],_0x57fb93[_0xa7cd('0xb')],_0x4056ee[_0xa7cd('0xc')],_0xc60cec['transcribeName'])['then'](function(_0x44d991){logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0xc60cec['id'],_0xc60cec[_0xa7cd('0x9')],_0x44d991[_0xa7cd('0xe')]['TranscriptionJobStatus']));if(!_0xc60cec[_0xa7cd('0xf')]){switch(_0x44d991[_0xa7cd('0xe')][_0xa7cd('0x10')]){case'COMPLETED':var _0x111774={'transcribeStatus':_0x44d991[_0xa7cd('0xe')]['TranscriptionJobStatus'],'fileUri':_0x44d991[_0xa7cd('0xe')][_0xa7cd('0x11')][_0xa7cd('0x12')]};logger['info'](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0xc60cec['id']));return rp({'uri':_0x44d991[_0xa7cd('0xe')]['Transcript']['TranscriptFileUri'],'json':!![]})[_0xa7cd('0x13')](function(_0x4dc29b){logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0xc60cec['id']));if(_0x4dc29b&&_0x4dc29b['results']&&_0x4dc29b['results'][_0xa7cd('0x14')]&&_0x4dc29b['results'][_0xa7cd('0x14')][_0xa7cd('0x15')]){_0x111774['fileText']='';for(var _0x39f093=0x0;_0x39f093<_0x4dc29b['results'][_0xa7cd('0x14')][_0xa7cd('0x15')];_0x39f093++){_0x111774['fileText']+=_0x4dc29b[_0xa7cd('0x16')][_0xa7cd('0x14')][_0x39f093]['transcript']+'';}}return _0xc60cec['update'](_0x111774);})[_0xa7cd('0x13')](function(){logger['info'](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xc60cec['id']));if(!_0xc60cec[_0xa7cd('0x17')]){throw new db[(_0xa7cd('0x18'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4056ee['sentiment']||!_0x4056ee[_0xa7cd('0x19')]||!_0x4056ee['sentimentRegion']||!_0x4056ee[_0xa7cd('0x1a')]||!_0x4056ee[_0xa7cd('0x1b')]){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x111774[_0xa7cd('0xf')]){throw new Error('Transcript\x20not\x20available');}if(_0x4056ee[_0xa7cd('0x19')]===_0x57fb93['id']){return _0x57fb93;}else{return db[_0xa7cd('0x1d')]['findOne']({'where':{'id':_settings[_0xa7cd('0x19')]}});}})[_0xa7cd('0x13')](function(_0xb4cfa){if(!_0xb4cfa){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))](_0xa7cd('0x1e'));}if(!_0xb4cfa[_0xa7cd('0xa')]||!_0xb4cfa[_0xa7cd('0xb')]){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))]('Cloud\x20Provider\x20not\x20configured');}_0x3bbf3b=_0xb4cfa;logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0xc60cec['id']));return sentiment(_0x3bbf3b['data1'],_0x3bbf3b[_0xa7cd('0xb')],_0x4056ee[_0xa7cd('0x1f')],_0x111774['fileText'],_0x4056ee[_0xa7cd('0x1a')]);})[_0xa7cd('0x13')](function(_0x29c3d2){logger['info'](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xc60cec['id']));return _0xc60cec[_0xa7cd('0x20')]({'sentiment':_0x29c3d2[_0xa7cd('0x21')],'sPositive':_0x29c3d2[_0xa7cd('0x22')][_0xa7cd('0x23')],'sNegative':_0x29c3d2['SentimentScore']['Negative'],'sMixed':_0x29c3d2[_0xa7cd('0x22')][_0xa7cd('0x24')],'sNeutral':_0x29c3d2[_0xa7cd('0x22')][_0xa7cd('0x25')]});})[_0xa7cd('0x13')](function(){logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xc60cec['id']));_0x3f72f8();});case _0xa7cd('0x26'):return _0xc60cec[_0xa7cd('0x20')]({'transcribeStatus':_0xa7cd('0x26'),'failureReason':_0x44d991[_0xa7cd('0xe')][_0xa7cd('0x27')]})[_0xa7cd('0x13')](function(){logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xc60cec['id']));_0x3f72f8();});default:logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')](_0xa7cd('0x28'),_0xc60cec['id']));break;}}else{return BPromise[_0xa7cd('0x29')]()[_0xa7cd('0x13')](function(){if(!_0xc60cec[_0xa7cd('0x17')]){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x4056ee['sentiment']||!_0x4056ee[_0xa7cd('0x19')]||!_0x4056ee[_0xa7cd('0x1f')]||!_0x4056ee[_0xa7cd('0x1a')]||!_0x4056ee['bucket']){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))](_0xa7cd('0x2a'));}if(!_0xc60cec[_0xa7cd('0xf')]){throw new Error('Transcript\x20not\x20available');}if(_0x4056ee[_0xa7cd('0x19')]===_0x57fb93['id']){return _0x57fb93;}else{return db[_0xa7cd('0x1d')][_0xa7cd('0x2b')]({'where':{'id':_settings[_0xa7cd('0x19')]}});}})['then'](function(_0x5d2b48){if(!_0x5d2b48){throw new db['Sequelize'][(_0xa7cd('0x1c'))](_0xa7cd('0x1e'));}if(!_0x5d2b48[_0xa7cd('0xa')]||!_0x5d2b48['data2']){throw new db['Sequelize'][(_0xa7cd('0x1c'))](_0xa7cd('0x2c'));}_0x3bbf3b=_0x5d2b48;logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')](_0xa7cd('0x2d'),_0xc60cec['id']));return sentiment(_0x3bbf3b[_0xa7cd('0xa')],_0x3bbf3b[_0xa7cd('0xb')],_0x4056ee[_0xa7cd('0x1f')],_0xc60cec[_0xa7cd('0xf')],_0x4056ee[_0xa7cd('0x1a')]);})[_0xa7cd('0x13')](function(_0x31577f){logger[_0xa7cd('0xd')](util[_0xa7cd('0x7')](_0xa7cd('0x2e'),_0xc60cec['id']));return _0xc60cec[_0xa7cd('0x20')]({'sentiment':_0x31577f['Sentiment'],'sPositive':_0x31577f[_0xa7cd('0x22')][_0xa7cd('0x23')],'sNegative':_0x31577f[_0xa7cd('0x22')][_0xa7cd('0x2f')],'sMixed':_0x31577f[_0xa7cd('0x22')][_0xa7cd('0x24')],'sNeutral':_0x31577f[_0xa7cd('0x22')]['Neutral'],'transcribeStatus':_0xa7cd('0x30')});})[_0xa7cd('0x13')](function(){logger[_0xa7cd('0xd')](util['format'](_0xa7cd('0x31'),_0xc60cec['id']));_0x3f72f8();});}})[_0xa7cd('0x32')](function(_0x6ee082){if(_0x6ee082){if(!_0x6ee082[_0xa7cd('0x33')]||_0x6ee082[_0xa7cd('0x33')]!==_0xa7cd('0x34')){logger[_0xa7cd('0x35')](util[_0xa7cd('0x7')](_0xa7cd('0x36'),_0xc60cec['id']),util['inspect'](_0x6ee082,{'showHidden':![],'depth':null}));}}_0x3f72f8();});});}function checkTranscribe(){var _0x5d1d6d;var _0x54299b;var _0x35e023;return db[_0xa7cd('0x37')][_0xa7cd('0x38')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0xa7cd('0x13')](function(_0x2104fe){if(!_0x2104fe||!_0x2104fe['length']){throw new db['Sequelize']['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x5d1d6d=_0x2104fe;return db[_0xa7cd('0x39')][_0xa7cd('0x2b')]({'where':{'id':0x1}});})[_0xa7cd('0x13')](function(_0x11f0d0){if(!_0x11f0d0){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))](_0xa7cd('0x3a'));}_0x54299b=_0x11f0d0;if(!_0x54299b['transcribe']||!_0x54299b[_0xa7cd('0x3b')]||!_0x54299b['transcribeRegion']||!_0x54299b[_0xa7cd('0x1a')]||!_0x54299b[_0xa7cd('0x1b')]){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))](_0xa7cd('0x3c'));}return db[_0xa7cd('0x1d')][_0xa7cd('0x2b')]({'where':{'id':_0x54299b['transcribeAccountId']}});})[_0xa7cd('0x13')](function(_0x51c67f){if(!_0x51c67f){throw new db[(_0xa7cd('0x18'))][(_0xa7cd('0x1c'))](_0xa7cd('0x1e'));}if(!_0x51c67f[_0xa7cd('0xa')]||!_0x51c67f[_0xa7cd('0xb')]){throw new db['Sequelize']['ValidationError'](_0xa7cd('0x2c'));}_0x35e023=_0x51c67f;var _0x46b48a=[];_0x5d1d6d[_0xa7cd('0x3d')](function(_0x2101ea){_0x46b48a['push'](checkTranscribeJob(_0x2101ea,_0x54299b,_0x35e023));});return BPromise[_0xa7cd('0x3e')](_0x46b48a);})[_0xa7cd('0x32')](function(_0x2dd1a2){if(_0x2dd1a2){if(!_0x2dd1a2[_0xa7cd('0x33')]||_0x2dd1a2['name']!=='SequelizeValidationError'){logger['error'](util[_0xa7cd('0x3f')](_0x2dd1a2,{'showHidden':![],'depth':null}));}}});}exports[_0xa7cd('0x40')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xd3a8=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','findOne','Cloud\x20Provider\x20not\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','push','all','error','start','lodash','request-promise','util','bluebird','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','Comprehend','info','format','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','Transcript','results','transcripts','length','transcript','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','data2','Cloud\x20Provider\x20not\x20configured'];(function(_0x42c981,_0xc70202){var _0x1f43b4=function(_0x7a9225){while(--_0x7a9225){_0x42c981['push'](_0x42c981['shift']());}};_0x1f43b4(++_0xc70202);}(_0xd3a8,0x135));var _0x8d3a=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xd3a8[_0x19950b];return _0x3c6b41;};var _=require(_0x8d3a('0x0'));var AWS=require('aws-sdk');var rp=require(_0x8d3a('0x1'));var util=require(_0x8d3a('0x2'));var BPromise=require(_0x8d3a('0x3'));var db=require(_0x8d3a('0x4'))['db'];var logger=require('../../config/logger')(_0x8d3a('0x5'));function getTranscriptionJob(_0x2f2826,_0x478dee,_0x5e3983,_0x5ee2ca){return new Promise(function(_0x457b90,_0x59893d){var _0x588567=new AWS[(_0x8d3a('0x6'))]({'accessKeyId':_0x478dee,'secretAccessKey':_0x2f2826,'region':_0x5e3983});_0x588567[_0x8d3a('0x7')]({'TranscriptionJobName':_0x5ee2ca},function(_0x28b131,_0x40bc92){if(_0x28b131){return _0x59893d(_0x28b131);}else{return _0x457b90(_0x40bc92);}});});}function sentiment(_0x2a9a0a,_0x34bb5d,_0x3cd3e3,_0x472233,_0x87efcd){return new Promise(function(_0x117b56,_0x11aaf1){var _0x459c60=new AWS[(_0x8d3a('0x8'))]({'accessKeyId':_0x34bb5d,'secretAccessKey':_0x2a9a0a,'region':_0x3cd3e3});_0x459c60['detectSentiment']({'Text':_0x472233,'LanguageCode':_0x87efcd['substring'](0x0,0x2)},function(_0x527258,_0x222886){if(_0x527258){return _0x11aaf1(_0x527258);}else{return _0x117b56(_0x222886);}});});}function checkTranscribeJob(_0x880a06,_0xc834ec,_0x43b1ca){var _0x4759cd;return new BPromise(function(_0x29b7b9,_0x58b2b7){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x880a06['id'],_0x880a06['transcribeName']));return getTranscriptionJob(_0x43b1ca[_0x8d3a('0xb')],_0x43b1ca['data2'],_0xc834ec[_0x8d3a('0xc')],_0x880a06[_0x8d3a('0xd')])[_0x8d3a('0xe')](function(_0x4c915d){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0xf'),_0x880a06['id'],_0x880a06['transcribeName'],_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')]));if(!_0x880a06[_0x8d3a('0x12')]){switch(_0x4c915d['TranscriptionJob']['TranscriptionJobStatus']){case _0x8d3a('0x13'):var _0xc8208c={'transcribeStatus':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x11')],'fileUri':_0x4c915d[_0x8d3a('0x10')]['Transcript'][_0x8d3a('0x14')]};logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x15'),_0x880a06['id']));return rp({'uri':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x16')]['TranscriptFileUri'],'json':!![]})[_0x8d3a('0xe')](function(_0x3ca6a9){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x880a06['id']));if(_0x3ca6a9&&_0x3ca6a9[_0x8d3a('0x17')]&&_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')]&&_0x3ca6a9['results'][_0x8d3a('0x18')][_0x8d3a('0x19')]){_0xc8208c[_0x8d3a('0x12')]='';for(var _0x327d9a=0x0;_0x327d9a<_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x8d3a('0x19')];_0x327d9a++){_0xc8208c['fileText']+=_0x3ca6a9[_0x8d3a('0x17')][_0x8d3a('0x18')][_0x327d9a][_0x8d3a('0x1a')]+'';}}return _0x880a06[_0x8d3a('0x1b')](_0xc8208c);})[_0x8d3a('0xe')](function(){logger[_0x8d3a('0x9')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x1f'));}if(!_0xc834ec[_0x8d3a('0x20')]||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec['sentimentRegion']||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x24'));}if(!_0xc8208c[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec['sentimentAccountId']===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')]['findOne']({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x44dda3){if(!_0x44dda3){throw new db['Sequelize'][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x44dda3['data1']||!_0x44dda3[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x28'));}_0x4759cd=_0x44dda3;logger['info'](util['format'](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec[_0x8d3a('0x2a')],_0xc8208c[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x1a46b1){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x1a46b1[_0x8d3a('0x2c')],'sPositive':_0x1a46b1['SentimentScore'][_0x8d3a('0x2d')],'sNegative':_0x1a46b1[_0x8d3a('0x2e')]['Negative'],'sMixed':_0x1a46b1['SentimentScore'][_0x8d3a('0x2f')],'sNeutral':_0x1a46b1[_0x8d3a('0x2e')][_0x8d3a('0x30')]});})['then'](function(){logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x880a06['id']));_0x29b7b9();});case _0x8d3a('0x31'):return _0x880a06[_0x8d3a('0x1b')]({'transcribeStatus':_0x8d3a('0x31'),'failureReason':_0x4c915d[_0x8d3a('0x10')][_0x8d3a('0x32')]})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});default:logger[_0x8d3a('0x9')](util[_0x8d3a('0xa')](_0x8d3a('0x34'),_0x880a06['id']));break;}}else{return BPromise[_0x8d3a('0x35')]()[_0x8d3a('0xe')](function(){if(!_0x880a06[_0x8d3a('0x1c')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xc834ec['sentiment']||!_0xc834ec[_0x8d3a('0x21')]||!_0xc834ec[_0x8d3a('0x2a')]||!_0xc834ec[_0x8d3a('0x22')]||!_0xc834ec[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x880a06[_0x8d3a('0x12')]){throw new Error(_0x8d3a('0x25'));}if(_0xc834ec[_0x8d3a('0x21')]===_0x43b1ca['id']){return _0x43b1ca;}else{return db[_0x8d3a('0x26')][_0x8d3a('0x36')]({'where':{'id':_settings[_0x8d3a('0x21')]}});}})[_0x8d3a('0xe')](function(_0x3dd0fd){if(!_0x3dd0fd){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x37'));}if(!_0x3dd0fd[_0x8d3a('0xb')]||!_0x3dd0fd['data2']){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x4759cd=_0x3dd0fd;logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x29'),_0x880a06['id']));return sentiment(_0x4759cd[_0x8d3a('0xb')],_0x4759cd['data2'],_0xc834ec['sentimentRegion'],_0x880a06[_0x8d3a('0x12')],_0xc834ec[_0x8d3a('0x22')]);})[_0x8d3a('0xe')](function(_0x26296a){logger[_0x8d3a('0x9')](util['format'](_0x8d3a('0x2b'),_0x880a06['id']));return _0x880a06[_0x8d3a('0x1b')]({'sentiment':_0x26296a[_0x8d3a('0x2c')],'sPositive':_0x26296a[_0x8d3a('0x2e')]['Positive'],'sNegative':_0x26296a['SentimentScore']['Negative'],'sMixed':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x2f')],'sNeutral':_0x26296a[_0x8d3a('0x2e')][_0x8d3a('0x30')],'transcribeStatus':_0x8d3a('0x13')});})[_0x8d3a('0xe')](function(){logger['info'](util[_0x8d3a('0xa')](_0x8d3a('0x33'),_0x880a06['id']));_0x29b7b9();});}})['catch'](function(_0x234a0d){if(_0x234a0d){if(!_0x234a0d[_0x8d3a('0x38')]||_0x234a0d[_0x8d3a('0x38')]!==_0x8d3a('0x39')){logger['error'](util[_0x8d3a('0xa')](_0x8d3a('0x3a'),_0x880a06['id']),util[_0x8d3a('0x3b')](_0x234a0d,{'showHidden':![],'depth':null}));}}_0x29b7b9();});});}function checkTranscribe(){var _0x445595;var _0x178be8;var _0x45361c;return db[_0x8d3a('0x3c')][_0x8d3a('0x3d')]({'where':{'transcribeStatus':_0x8d3a('0x3e')}})[_0x8d3a('0xe')](function(_0x4df4d6){if(!_0x4df4d6||!_0x4df4d6[_0x8d3a('0x19')]){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x3f'));}_0x445595=_0x4df4d6;return db['Setting'][_0x8d3a('0x36')]({'where':{'id':0x1}});})[_0x8d3a('0xe')](function(_0x1ec81d){if(!_0x1ec81d){throw new db[(_0x8d3a('0x1d'))]['ValidationError'](_0x8d3a('0x40'));}_0x178be8=_0x1ec81d;if(!_0x178be8[_0x8d3a('0x5')]||!_0x178be8[_0x8d3a('0x41')]||!_0x178be8[_0x8d3a('0xc')]||!_0x178be8[_0x8d3a('0x22')]||!_0x178be8[_0x8d3a('0x23')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0x8d3a('0x36')]({'where':{'id':_0x178be8[_0x8d3a('0x41')]}});})[_0x8d3a('0xe')](function(_0x55dd25){if(!_0x55dd25){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x55dd25[_0x8d3a('0xb')]||!_0x55dd25[_0x8d3a('0x27')]){throw new db[(_0x8d3a('0x1d'))][(_0x8d3a('0x1e'))](_0x8d3a('0x28'));}_0x45361c=_0x55dd25;var _0x336c5a=[];_0x445595['forEach'](function(_0x38c946){_0x336c5a[_0x8d3a('0x42')](checkTranscribeJob(_0x38c946,_0x178be8,_0x45361c));});return BPromise[_0x8d3a('0x43')](_0x336c5a);})['catch'](function(_0x2100ee){if(_0x2100ee){if(!_0x2100ee[_0x8d3a('0x38')]||_0x2100ee['name']!=='SequelizeValidationError'){logger[_0x8d3a('0x44')](util[_0x8d3a('0x3b')](_0x2100ee,{'showHidden':![],'depth':null}));}}});}exports[_0x8d3a('0x45')]=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 db08ba7..bdd80f8 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 _0xc894=['localhost','socket.io-emitter','WhatsappInteraction','findAll','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','update','timeout','format','YYYY-MM-DD\x20HH:mm:ss','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','inspect','start','lodash','moment','ioredis','util','../logger','schedule','redis','defaults'];(function(_0x17c012,_0x581e0d){var _0x19e62c=function(_0x4fb47e){while(--_0x4fb47e){_0x17c012['push'](_0x17c012['shift']());}};_0x19e62c(++_0x581e0d);}(_0xc894,0xa6));var _0x4c89=function(_0x35ddb8,_0xa6d8e6){_0x35ddb8=_0x35ddb8-0x0;var _0x5dc721=_0xc894[_0x35ddb8];return _0x5dc721;};'use strict';var _=require(_0x4c89('0x0'));var moment=require(_0x4c89('0x1'));var Redis=require(_0x4c89('0x2'));var util=require(_0x4c89('0x3'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0x4c89('0x4'))(_0x4c89('0x5'));config[_0x4c89('0x6')]=_[_0x4c89('0x7')](config['redis'],{'host':_0x4c89('0x8'),'port':0x18eb});var io=require(_0x4c89('0x9'))(new Redis(config[_0x4c89('0x6')]));function closeInteractions(){var _0x501fc7=[];return db[_0x4c89('0xa')][_0x4c89('0xb')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x4c89('0xc')](0x18,_0x4c89('0xd'))}}})[_0x4c89('0xe')](function(_0x392a80){if(_0x392a80&&_0x392a80[_0x4c89('0xf')]){_0x501fc7=_[_0x4c89('0x10')](_0x392a80||[],'id');logger['info'](_0x4c89('0x11'),_0x501fc7['join']());return db[_0x4c89('0xa')][_0x4c89('0x12')]({'closeReason':'system','disposition':_0x4c89('0x13'),'closed':!![],'closedAt':moment()[_0x4c89('0x14')](_0x4c89('0x15'))},{'where':{'id':_0x501fc7}});}})[_0x4c89('0xe')](function(){if(_0x501fc7&&_0x501fc7[_0x4c89('0xf')]){logger[_0x4c89('0x16')](_0x4c89('0x17'),_0x501fc7[_0x4c89('0x18')]());for(var _0xc3e591=0x0;_0xc3e591<_0x501fc7['length'];_0xc3e591++){io[_0x4c89('0x19')]('whatsappInteraction:update',{'id':_0x501fc7[_0xc3e591],'closed':!![]});}}})[_0x4c89('0x1a')](function(_0x129a99){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x129a99?util[_0x4c89('0x1b')](_0x129a99,{'showHidden':![],'depth':null}):'');});}exports[_0x4c89('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x714b=['timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system'];(function(_0xa6aa71,_0x2a5f0c){var _0x3c02cb=function(_0x3b57e2){while(--_0x3b57e2){_0xa6aa71['push'](_0xa6aa71['shift']());}};_0x3c02cb(++_0x2a5f0c);}(_0x714b,0x17f));var _0xb714=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x714b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb714('0x0'));var moment=require('moment');var Redis=require(_0xb714('0x1'));var util=require('util');var config=require(_0xb714('0x2'));var db=require(_0xb714('0x3'))['db'];var logger=require(_0xb714('0x4'))('schedule');config[_0xb714('0x5')]=_['defaults'](config[_0xb714('0x5')],{'host':_0xb714('0x6'),'port':0x18eb});var io=require(_0xb714('0x7'))(new Redis(config[_0xb714('0x5')]));function closeInteractions(){var _0x2e9722=[];return db[_0xb714('0x8')][_0xb714('0x9')]({'raw':!![],'attributes':['id',_0xb714('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xb714('0xb')](0x18,_0xb714('0xc'))}}})['then'](function(_0x2cc9f3){if(_0x2cc9f3&&_0x2cc9f3[_0xb714('0xd')]){_0x2e9722=_[_0xb714('0xe')](_0x2cc9f3||[],'id');logger[_0xb714('0xf')](_0xb714('0x10'),_0x2e9722[_0xb714('0x11')]());return db[_0xb714('0x8')][_0xb714('0x12')]({'closeReason':_0xb714('0x13'),'disposition':_0xb714('0x14'),'closed':!![],'closedAt':moment()[_0xb714('0x15')](_0xb714('0x16'))},{'where':{'id':_0x2e9722}});}})[_0xb714('0x17')](function(){if(_0x2e9722&&_0x2e9722[_0xb714('0xd')]){logger[_0xb714('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x2e9722[_0xb714('0x11')]());for(var _0x2e237a=0x0;_0x2e237a<_0x2e9722[_0xb714('0xd')];_0x2e237a++){io[_0xb714('0x18')](_0xb714('0x19'),{'id':_0x2e9722[_0x2e237a],'closed':!![]});}}})[_0xb714('0x1a')](function(_0x398fb6){logger[_0xb714('0x1b')](_0xb714('0x1c'),_0x398fb6?util[_0xb714('0x1d')](_0x398fb6,{'showHidden':![],'depth':null}):'');});}exports[_0xb714('0x1e')]=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 52ceee3..cdde53e 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf12=['contacts1','CmHopper','finished\x20populating','hopper1','contacts2','hopper2','catch','Innocenzo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','bulkCreate','log'];(function(_0x845505,_0x19e5f3){var _0x2513b9=function(_0x10e7af){while(--_0x10e7af){_0x845505['push'](_0x845505['shift']());}};_0x2513b9(++_0x19e5f3);}(_0xdf12,0xa0));var _0x2df1=function(_0x18b9dc,_0x44a668){_0x18b9dc=_0x18b9dc-0x0;var _0x5793e3=_0xdf12[_0x18b9dc];return _0x5793e3;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x2df1('0x0')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2df1('0x1')+i+_0x2df1('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2df1('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x2df1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2df1('0x4')](),'updatedAt':Date[_0x2df1('0x4')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2df1('0x3')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2df1('0x1')+i+_0x2df1('0x2')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2df1('0x3')]({'id':i,'active':![],'scheduledat':Date[_0x2df1('0x4')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2df1('0x4')](),'updatedAt':Date['now']()});}db[_0x2df1('0x5')][_0x2df1('0x6')]({'where':{}})[_0x2df1('0x7')](function(){return db[_0x2df1('0x5')][_0x2df1('0x8')](contacts);})[_0x2df1('0x7')](function(){console[_0x2df1('0x9')]('finished\x20populating',_0x2df1('0xa'));return db[_0x2df1('0xb')][_0x2df1('0x6')]({'where':{}});})['then'](function(){return db['CmHopper'][_0x2df1('0x8')](hopper);})['then'](function(){console[_0x2df1('0x9')](_0x2df1('0xc'),_0x2df1('0xd'));return db[_0x2df1('0x5')][_0x2df1('0x8')](contacts2);})[_0x2df1('0x7')](function(){console[_0x2df1('0x9')](_0x2df1('0xc'),_0x2df1('0xe'));return db[_0x2df1('0xb')][_0x2df1('0x8')](hopper2);})[_0x2df1('0x7')](function(){console[_0x2df1('0x9')]('finished\x20populating',_0x2df1('0xf'));})[_0x2df1('0x10')](function(_0x19067f){console[_0x2df1('0x9')](_0x19067f);}); \ No newline at end of file +var _0x2115=['now','CmContact','then','bulkCreate','contacts1','CmHopper','destroy','log','finished\x20populating','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com'];(function(_0x44181c,_0x41b017){var _0x5804a9=function(_0x1db552){while(--_0x1db552){_0x44181c['push'](_0x44181c['shift']());}};_0x5804a9(++_0x41b017);}(_0x2115,0xa5));var _0x5211=function(_0x566168,_0x4c39af){_0x566168=_0x566168-0x0;var _0x4e1f7a=_0x2115[_0x566168];return _0x4e1f7a;};'use strict';var util=require(_0x5211('0x0'));var db=require(_0x5211('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5211('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5211('0x3')+i,'phone':0xf879fb460+i,'email':_0x5211('0x4')+i+_0x5211('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x5211('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x5211('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x5211('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5211('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x5211('0x4')+i+_0x5211('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x5211('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}db[_0x5211('0x7')]['destroy']({'where':{}})[_0x5211('0x8')](function(){return db[_0x5211('0x7')][_0x5211('0x9')](contacts);})[_0x5211('0x8')](function(){console['log']('finished\x20populating',_0x5211('0xa'));return db[_0x5211('0xb')][_0x5211('0xc')]({'where':{}});})[_0x5211('0x8')](function(){return db[_0x5211('0xb')][_0x5211('0x9')](hopper);})[_0x5211('0x8')](function(){console[_0x5211('0xd')](_0x5211('0xe'),_0x5211('0xf'));return db[_0x5211('0x7')][_0x5211('0x9')](contacts2);})[_0x5211('0x8')](function(){console['log'](_0x5211('0xe'),_0x5211('0x10'));return db[_0x5211('0xb')][_0x5211('0x9')](hopper2);})[_0x5211('0x8')](function(){console[_0x5211('0xd')]('finished\x20populating',_0x5211('0x11'));})[_0x5211('0x12')](function(_0x137d85){console[_0x5211('0xd')](_0x137d85);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 3d38290..79bc96e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe08f=['log','add\x20user','format','%s%s','agent','friend','udp','wss','all','ulaw','yes','actpass','bulkCreate'];(function(_0x297eea,_0x5060be){var _0x1c42d2=function(_0x3afff4){while(--_0x3afff4){_0x297eea['push'](_0x297eea['shift']());}};_0x1c42d2(++_0x5060be);}(_0xe08f,0xd2));var _0xfe08=function(_0x2da6a8,_0xeb2597){_0x2da6a8=_0x2da6a8-0x0;var _0xa0ba1d=_0xe08f[_0x2da6a8];return _0xa0ba1d;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xfe08('0x0')](_0xfe08('0x1'),_0xfe08('0x2'),i),'fullname':util['format'](_0xfe08('0x1'),_0xfe08('0x2'),i),'email':util[_0xfe08('0x0')]('%s%s@xcally.com',_0xfe08('0x2'),i),'role':_0xfe08('0x2'),'password':'password','internal':0xfa0+i,'type':_0xfe08('0x3'),'transport':[_0xfe08('0x4'),'ws',_0xfe08('0x5')],'disallow':[_0xfe08('0x6')],'allow':[_0xfe08('0x7')],'defaultuser':util[_0xfe08('0x0')](_0xfe08('0x1'),_0xfe08('0x2'),i),'encryption':'yes','avpf':_0xfe08('0x8'),'force_avp':_0xfe08('0x8'),'icesupport':_0xfe08('0x8'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xfe08('0x9'),'callerid':util['format']('\x22%s\x22\x20<%s>',util[_0xfe08('0x0')](_0xfe08('0x1'),_0xfe08('0x2'),i),0xfa0+i)});}db['User'][_0xfe08('0xa')](users)['then'](function(){console[_0xfe08('0xb')](_0xfe08('0xc'));})['catch'](function(_0xae629d){console['log'](_0xae629d);}); \ No newline at end of file +var _0x249b=['actpass','\x22%s\x22\x20<%s>','User','then','catch','log','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key'];(function(_0x3e2dd8,_0x43ad7a){var _0x4905fe=function(_0x95d102){while(--_0x95d102){_0x3e2dd8['push'](_0x3e2dd8['shift']());}};_0x4905fe(++_0x43ad7a);}(_0x249b,0x1aa));var _0xb249=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x249b[_0x432682];return _0x463d05;};'use strict';var util=require(_0xb249('0x0'));var db=require(_0xb249('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xb249('0x2')]({'name':util[_0xb249('0x3')](_0xb249('0x4'),'agent',i),'fullname':util[_0xb249('0x3')](_0xb249('0x4'),_0xb249('0x5'),i),'email':util['format'](_0xb249('0x6'),_0xb249('0x5'),i),'role':_0xb249('0x5'),'password':_0xb249('0x7'),'internal':0xfa0+i,'type':_0xb249('0x8'),'transport':['udp','ws',_0xb249('0x9')],'disallow':[_0xb249('0xa')],'allow':[_0xb249('0xb')],'defaultuser':util['format'](_0xb249('0x4'),_0xb249('0x5'),i),'encryption':_0xb249('0xc'),'avpf':_0xb249('0xc'),'force_avp':_0xb249('0xc'),'icesupport':_0xb249('0xc'),'dtlsenable':_0xb249('0xc'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xb249('0xd'),'dtlssetup':_0xb249('0xe'),'callerid':util[_0xb249('0x3')](_0xb249('0xf'),util['format'](_0xb249('0x4'),_0xb249('0x5'),i),0xfa0+i)});}db[_0xb249('0x10')]['bulkCreate'](users)[_0xb249('0x11')](function(){console['log']('add\x20user');})[_0xb249('0x12')](function(_0x879297){console[_0xb249('0x13')](_0x879297);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e202698..f1d6cfb 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x838a=['SocketIO\x20','nsp','disconnect','DISCONNECTED','bluebird','../mysqldb','./environment','name','Agents','User','role','agent','type','UserProfileSection','findOne','then','FaxQueues','MailQueues','OpenchannelQueues','Telephones','findAll','IvrCampaigns','resourceId','map','where','telephone','Campaign','ivr','format','%s:queue:%s','length','handshake','find','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','ChatQueues','FaxQueue','SmsQueues','OpenchannelQueue','WhatsappQueues','Trunks','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','removeChatInteractions','emit','leave','removeMailInteractions','removeFaxInteractions','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','remotePort'];(function(_0x24415c,_0x32df9c){var _0x547db7=function(_0x5a820c){while(--_0x5a820c){_0x24415c['push'](_0x24415c['shift']());}};_0x547db7(++_0x32df9c);}(_0x838a,0x65));var _0xa838=function(_0x3ee5df,_0x583073){_0x3ee5df=_0x3ee5df-0x0;var _0x446d24=_0x838a[_0x3ee5df];return _0x446d24;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xa838('0x0'));var db=require(_0xa838('0x1'))['db'];var config=require(_0xa838('0x2'));var queryQueues={'attributes':['id',_0xa838('0x3')],'include':[{'as':_0xa838('0x4'),'model':db[_0xa838('0x5')],'attributes':['id',_0xa838('0x3'),_0xa838('0x6')],'raw':!![],'where':{'role':_0xa838('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xa838('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xa838('0x3')],'where':{'role':_0xa838('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xa838('0x3'),_0xa838('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x50bcc5,_0xf71015,_0x506d96){return db[_0xa838('0x9')][_0xa838('0xa')]({'where':{'name':_0x50bcc5,'userProfileId':_0xf71015},'raw':!![]})[_0xa838('0xb')](function(_0x586591){if(_0x586591){if(_0x586591['autoAssociation']){switch(_0x50bcc5){case'VoiceQueues':case'ChatQueues':case _0xa838('0xc'):case'SmsQueues':case _0xa838('0xd'):case _0xa838('0xe'):case'WhatsappQueues':return db[_0x506d96]['findAll'](queryQueues);case _0xa838('0xf'):return db[_0x506d96][_0xa838('0x10')](queryTelephones);case'Trunks':return db[_0x506d96][_0xa838('0x10')](queryTrunks);case _0xa838('0x11'):return db[_0x506d96][_0xa838('0x10')](queryCampaigns);}}else{return db['UserProfileResource'][_0xa838('0x10')]({'attributes':[_0xa838('0x12')],'where':{'sectionId':_0x586591['id']},'raw':!![]})[_0xa838('0xb')](function(_0x4b8166){if(_0x4b8166){var _0x3b6bdc={'where':{'id':_[_0xa838('0x13')](_0x4b8166,_0xa838('0x12'))},'raw':!![]};switch(_0x506d96){case _0xa838('0x5'):_0x3b6bdc[_0xa838('0x14')]['role']=_0xa838('0x15');break;case _0xa838('0x16'):_0x3b6bdc[_0xa838('0x14')]['type']=_0xa838('0x17');break;}return db[_0x506d96][_0xa838('0x10')](_0x3b6bdc);}else{return[];}});}}else{return[];}})[_0xa838('0xb')](function(_0x6ed679){return _0x6ed679;});}function joinOrLeaveQueues(_0x1a3060,_0x1c4803,_0xa85514,_0x2981cb){_0x1a3060[_0x1c4803](util[_0xa838('0x18')](_0xa838('0x19'),_0xa85514,_0x2981cb[_0xa838('0x3')]));if(_0x2981cb['Agents']){for(var _0x1fbf7a=0x0;_0x1fbf7a<_0x2981cb[_0xa838('0x4')][_0xa838('0x1a')];_0x1fbf7a+=0x1){_0x1a3060[_0x1c4803](util['format']('user:%s',_0x2981cb[_0xa838('0x4')][_0x1fbf7a][_0xa838('0x3')]));}}}function joinOrLeave(_0x279f8e,_0x1e5f91,_0x48a997){var _0x4a5b1e;if(_0x279f8e[_0xa838('0x1b')]['query']['id']){db[_0xa838('0x5')][_0xa838('0x1c')]({'attributes':['id',_0xa838('0x3'),_0xa838('0x6'),'userProfileId'],'where':{'id':_0x279f8e[_0xa838('0x1b')][_0xa838('0x1d')]['id']},'include':[{'model':db[_0xa838('0x1e')],'as':_0xa838('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0xa838('0x20')],'as':_0xa838('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xa838('0x22')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xa838('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xa838('0x24')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0xa838('0xb')](function(_0x1a5ef5){if(_0x1a5ef5){_0x4a5b1e=_0x1a5ef5;_0x279f8e[_0x1e5f91](util['format'](_0xa838('0x25'),_0x1a5ef5['name']));var _0x549ef7=[];switch(_0x1a5ef5[_0xa838('0x6')]){case _0xa838('0x26'):_0x279f8e[_0x1e5f91](_0xa838('0x27'));_0x279f8e[_0x1e5f91](_0xa838('0x28'));if(queryQueues[_0xa838('0x29')](_0xa838('0x2a'))){delete queryQueues[_0xa838('0x2a')];}_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x2c')]['findAll'](queryQueues));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x2d')][_0xa838('0x10')](queryQueues));_0x549ef7[_0xa838('0x2b')](db['FaxQueue'][_0xa838('0x10')](queryQueues));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x2e')]['findAll'](queryQueues));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x2f')][_0xa838('0x10')](queryQueues));_0x549ef7[_0xa838('0x2b')](db['OpenchannelQueue'][_0xa838('0x10')](queryQueues));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x30')]['findAll'](queryQueues));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x5')][_0xa838('0x10')](queryTelephones));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x31')][_0xa838('0x10')](queryTrunks));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x16')][_0xa838('0x10')](queryCampaigns));_0x549ef7['push'](db[_0xa838('0x5')][_0xa838('0x10')](queryAgents));break;case _0xa838('0x32'):_0x279f8e[_0x1e5f91](_0xa838('0x27'));_0x279f8e[_0x1e5f91]('voice:outbound');_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0x33'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x2c')));_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0x35'),_0x1a5ef5['userProfileId'],'ChatQueue'));_0x549ef7[_0xa838('0x2b')](getAssociatedResources('FaxQueues',_0x1a5ef5[_0xa838('0x34')],_0xa838('0x36')));_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0x37'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x2e')));_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0xd'),_0x1a5ef5['userProfileId'],'MailQueue'));_0x549ef7['push'](getAssociatedResources(_0xa838('0xe'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x38')));_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0x39'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x30')));_0x549ef7['push'](getAssociatedResources(_0xa838('0xf'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x5')));_0x549ef7[_0xa838('0x2b')](getAssociatedResources(_0xa838('0x3a'),_0x1a5ef5[_0xa838('0x34')],'Trunk'));_0x549ef7['push'](getAssociatedResources(_0xa838('0x11'),_0x1a5ef5[_0xa838('0x34')],_0xa838('0x16')));_0x549ef7[_0xa838('0x2b')](db[_0xa838('0x5')][_0xa838('0x10')](queryAgents));break;case _0xa838('0x7'):_0x279f8e[_0x1e5f91]('voice:inbound');_0x279f8e[_0x1e5f91](_0xa838('0x28'));_0x549ef7[_0xa838('0x2b')](_0x1a5ef5[_0xa838('0x3b')]({'attributes':['id',_0xa838('0x3')]}));_0x549ef7['push'](_0x1a5ef5[_0xa838('0x3c')]({'attributes':['id',_0xa838('0x3')]}));_0x549ef7['push'](_0x1a5ef5[_0xa838('0x3d')]({'attributes':['id',_0xa838('0x3')]}));_0x549ef7['push'](_0x1a5ef5['getSmsQueues']({'attributes':['id',_0xa838('0x3')]}));_0x549ef7[_0xa838('0x2b')](_0x1a5ef5[_0xa838('0x3e')]({'attributes':['id',_0xa838('0x3')]}));_0x549ef7[_0xa838('0x2b')](_0x1a5ef5[_0xa838('0x3f')]({'attributes':['id',_0xa838('0x3')]}));_0x549ef7['push'](_0x1a5ef5[_0xa838('0x40')]({'attributes':['id',_0xa838('0x3')]}));break;}return BPromise[_0xa838('0x41')](_0x549ef7);}})[_0xa838('0xb')](function(_0x47657e){if(_0x47657e&&_0x47657e[_0xa838('0x1a')]){for(var _0x579a38=0x0;_0x579a38<_0x47657e[_0xa838('0x1a')];_0x579a38+=0x1){for(var _0x15feae=0x0;_0x15feae<_0x47657e[_0x579a38][_0xa838('0x1a')];_0x15feae+=0x1){switch(_0x579a38){case 0x0:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,'voice',_0x47657e[_0x579a38][_0x15feae]);break;case 0x1:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,_0xa838('0x42'),_0x47657e[_0x579a38][_0x15feae]);break;case 0x2:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,_0xa838('0x43'),_0x47657e[_0x579a38][_0x15feae]);break;case 0x3:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,_0xa838('0x44'),_0x47657e[_0x579a38][_0x15feae]);break;case 0x4:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,_0xa838('0x45'),_0x47657e[_0x579a38][_0x15feae]);break;case 0x5:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,_0xa838('0x46'),_0x47657e[_0x579a38][_0x15feae]);break;case 0x6:joinOrLeaveQueues(_0x279f8e,_0x1e5f91,'whatsapp',_0x47657e[_0x579a38][_0x15feae]);break;case 0x7:if(_0x4a5b1e['role']!=='agent')_0x279f8e[_0x1e5f91](util[_0xa838('0x18')](_0xa838('0x47'),_0x47657e[_0x579a38][_0x15feae][_0xa838('0x3')]));break;case 0x8:if(_0x4a5b1e[_0xa838('0x6')]!==_0xa838('0x7'))_0x279f8e[_0x1e5f91](util[_0xa838('0x18')](_0xa838('0x48'),_0x47657e[_0x579a38][_0x15feae][_0xa838('0x3')]));break;case 0x9:if(_0x4a5b1e[_0xa838('0x6')]!==_0xa838('0x7'))_0x279f8e[_0x1e5f91](util['format'](_0xa838('0x49'),_0x47657e[_0x579a38][_0x15feae]['type'],_0x47657e[_0x579a38][_0x15feae][_0xa838('0x3')]));break;case 0xa:_0x279f8e[_0x1e5f91](util['format']('user:%s',_0x47657e[_0x579a38][_0x15feae][_0xa838('0x3')]));break;}}}}})[_0xa838('0xb')](function(){if(_0x1e5f91==='leave'){var _0x191da8=_['map'](_0x4a5b1e[_0xa838('0x1f')],'id');return _0x4a5b1e[_0xa838('0x4a')](_0x191da8)[_0xa838('0xb')](function(){for(var _0x18803e=0x0;_0x18803e<_0x191da8[_0xa838('0x1a')];_0x18803e+=0x1){_0x48a997[_0xa838('0x4b')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x191da8[_0x18803e]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0xb')](function(){if(_0x1e5f91===_0xa838('0x4c')){var _0x1cd88f=_[_0xa838('0x13')](_0x4a5b1e[_0xa838('0x21')],'id');return _0x4a5b1e[_0xa838('0x4d')](_0x1cd88f)[_0xa838('0xb')](function(){for(var _0x70511f=0x0;_0x70511f<_0x1cd88f[_0xa838('0x1a')];_0x70511f+=0x1){_0x48a997['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x1cd88f[_0x70511f]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0xb')](function(){if(_0x1e5f91===_0xa838('0x4c')){var _0x2e1a7c=_['map'](_0x4a5b1e['FaxInteractions'],'id');return _0x4a5b1e[_0xa838('0x4e')](_0x2e1a7c)['then'](function(){for(var _0x15d6c6=0x0;_0x15d6c6<_0x2e1a7c[_0xa838('0x1a')];_0x15d6c6+=0x1){_0x48a997['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2e1a7c[_0x15d6c6]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0xb')](function(){if(_0x1e5f91==='leave'){var _0x3b1cf9=_[_0xa838('0x13')](_0x4a5b1e[_0xa838('0x4f')],'id');return _0x4a5b1e[_0xa838('0x50')](_0x3b1cf9)[_0xa838('0xb')](function(){for(var _0x5e7c57=0x0;_0x5e7c57<_0x3b1cf9[_0xa838('0x1a')];_0x5e7c57+=0x1){_0x48a997['emit'](_0xa838('0x51'),{'SmsInteractionId':Number(_0x3b1cf9[_0x5e7c57]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0xb')](function(){if(_0x1e5f91===_0xa838('0x4c')){var _0x2fdaeb=_[_0xa838('0x13')](_0x4a5b1e[_0xa838('0x23')],'id');return _0x4a5b1e[_0xa838('0x52')](_0x2fdaeb)[_0xa838('0xb')](function(){for(var _0x20d533=0x0;_0x20d533<_0x2fdaeb[_0xa838('0x1a')];_0x20d533+=0x1){_0x48a997[_0xa838('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2fdaeb[_0x20d533]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0xb')](function(){if(_0x1e5f91===_0xa838('0x4c')){var _0x24682c=_[_0xa838('0x13')](_0x4a5b1e['WhatsappInteractions'],'id');return _0x4a5b1e[_0xa838('0x53')](_0x24682c)[_0xa838('0xb')](function(){for(var _0x310ca0=0x0;_0x310ca0<_0x24682c[_0xa838('0x1a')];_0x310ca0+=0x1){_0x48a997[_0xa838('0x4b')]('user_has_whatsapp_interactions:remove',{'WhatsappInteractionId':Number(_0x24682c[_0x310ca0]),'UserId':Number(_0x4a5b1e['id'])});}});}})[_0xa838('0x54')](function(_0x2a5339){_0x279f8e[_0xa838('0x55')](_0x2a5339);});}}function onDisconnect(_0xeda99b,_0x2393e3){joinOrLeave(_0xeda99b,_0xa838('0x4c'),_0x2393e3);}function onConnect(_0x31ab5f){joinOrLeave(_0x31ab5f,_0xa838('0x56'));}exports['default']=function(_0x51f3a2){_0x51f3a2['on'](_0xa838('0x57'),function(_0x33af31){_0x33af31[_0xa838('0x58')](0x0);_0x33af31[_0xa838('0x59')]=_0x33af31[_0xa838('0x5a')][_0xa838('0x57')][_0xa838('0x5b')]+':'+_0x33af31['request']['connection'][_0xa838('0x5c')];_0x33af31['connectedAt']=new Date();_0x33af31[_0xa838('0x55')]=function(_0x1d18cf){console[_0xa838('0x55')](_0xa838('0x5d')+_0x33af31[_0xa838('0x5e')]['name']+'['+_0x33af31[_0xa838('0x59')]+']',_0x1d18cf);};_0x33af31['on'](_0xa838('0x5f'),function(){onDisconnect(_0x33af31,_0x51f3a2);_0x33af31['log'](_0xa838('0x60'));});onConnect(_0x33af31);_0x33af31[_0xa838('0x55')]('CONNECTED');});}; \ No newline at end of file +var _0x9790=['type','ivr','UserProfileSection','autoAssociation','VoiceQueues','FaxQueues','MailQueues','WhatsappQueues','findAll','IvrCampaigns','UserProfileResource','then','map','resourceId','User','where','role','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','ChatQueues','SmsQueues','OpenchannelQueues','Telephones','Trunks','Campaign','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','voice','fax','mail','openchannel','whatsapp','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','setMaxListeners','address','request','connection','remotePort','connectedAt','nsp','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','agent','telephone'];(function(_0x53a911,_0x4a48c1){var _0x19b3cd=function(_0x11a11d){while(--_0x11a11d){_0x53a911['push'](_0x53a911['shift']());}};_0x19b3cd(++_0x4a48c1);}(_0x9790,0xc1));var _0x0979=function(_0xa13dc2,_0x66440b){_0xa13dc2=_0xa13dc2-0x0;var _0x44b307=_0x9790[_0xa13dc2];return _0x44b307;};'use strict';var _=require(_0x0979('0x0'));var util=require(_0x0979('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0x0979('0x2'));var queryQueues={'attributes':['id',_0x0979('0x3')],'include':[{'as':_0x0979('0x4'),'model':db['User'],'attributes':['id',_0x0979('0x3'),'role'],'raw':!![],'where':{'role':_0x0979('0x5')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0979('0x3')],'where':{'role':_0x0979('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x0979('0x3')],'where':{'role':_0x0979('0x5')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0979('0x3'),_0x0979('0x7')],'where':{'type':_0x0979('0x8')}};function getAssociatedResources(_0x422504,_0x3f61ee,_0x5da5c6){return db[_0x0979('0x9')]['findOne']({'where':{'name':_0x422504,'userProfileId':_0x3f61ee},'raw':!![]})['then'](function(_0x5788a3){if(_0x5788a3){if(_0x5788a3[_0x0979('0xa')]){switch(_0x422504){case _0x0979('0xb'):case'ChatQueues':case _0x0979('0xc'):case'SmsQueues':case _0x0979('0xd'):case'OpenchannelQueues':case _0x0979('0xe'):return db[_0x5da5c6][_0x0979('0xf')](queryQueues);case'Telephones':return db[_0x5da5c6][_0x0979('0xf')](queryTelephones);case'Trunks':return db[_0x5da5c6][_0x0979('0xf')](queryTrunks);case _0x0979('0x10'):return db[_0x5da5c6]['findAll'](queryCampaigns);}}else{return db[_0x0979('0x11')][_0x0979('0xf')]({'attributes':['resourceId'],'where':{'sectionId':_0x5788a3['id']},'raw':!![]})[_0x0979('0x12')](function(_0x8dd21e){if(_0x8dd21e){var _0x4981a7={'where':{'id':_[_0x0979('0x13')](_0x8dd21e,_0x0979('0x14'))},'raw':!![]};switch(_0x5da5c6){case _0x0979('0x15'):_0x4981a7[_0x0979('0x16')][_0x0979('0x17')]='telephone';break;case'Campaign':_0x4981a7[_0x0979('0x16')][_0x0979('0x7')]=_0x0979('0x8');break;}return db[_0x5da5c6][_0x0979('0xf')](_0x4981a7);}else{return[];}});}}else{return[];}})[_0x0979('0x12')](function(_0x92f3a3){return _0x92f3a3;});}function joinOrLeaveQueues(_0x373bb5,_0x37c8aa,_0x19d222,_0x200fc8){_0x373bb5[_0x37c8aa](util[_0x0979('0x18')](_0x0979('0x19'),_0x19d222,_0x200fc8[_0x0979('0x3')]));if(_0x200fc8[_0x0979('0x4')]){for(var _0x19a9bb=0x0;_0x19a9bb<_0x200fc8[_0x0979('0x4')][_0x0979('0x1a')];_0x19a9bb+=0x1){_0x373bb5[_0x37c8aa](util[_0x0979('0x18')]('user:%s',_0x200fc8[_0x0979('0x4')][_0x19a9bb][_0x0979('0x3')]));}}}function joinOrLeave(_0x5654c0,_0x2a8b8b,_0xf5c90f){var _0x476d8f;if(_0x5654c0[_0x0979('0x1b')][_0x0979('0x1c')]['id']){db[_0x0979('0x15')][_0x0979('0x1d')]({'attributes':['id',_0x0979('0x3'),_0x0979('0x17'),_0x0979('0x1e')],'where':{'id':_0x5654c0['handshake'][_0x0979('0x1c')]['id']},'include':[{'model':db[_0x0979('0x1f')],'as':_0x0979('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x0979('0x21')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0979('0x22')],'as':_0x0979('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x0979('0x24')],'as':_0x0979('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x0979('0x26')],'as':_0x0979('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x0979('0x28')],'as':_0x0979('0x29'),'attributes':['id'],'raw':!![]}]})[_0x0979('0x12')](function(_0x32b52e){if(_0x32b52e){_0x476d8f=_0x32b52e;_0x5654c0[_0x2a8b8b](util[_0x0979('0x18')](_0x0979('0x2a'),_0x32b52e[_0x0979('0x3')]));var _0x4cc772=[];switch(_0x32b52e['role']){case'admin':_0x5654c0[_0x2a8b8b](_0x0979('0x2b'));_0x5654c0[_0x2a8b8b](_0x0979('0x2c'));if(queryQueues[_0x0979('0x2d')](_0x0979('0x2e'))){delete queryQueues[_0x0979('0x2e')];}_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x30')]['findAll'](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x31')][_0x0979('0xf')](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x32')][_0x0979('0xf')](queryQueues));_0x4cc772['push'](db[_0x0979('0x33')][_0x0979('0xf')](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x34')][_0x0979('0xf')](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x35')][_0x0979('0xf')](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x36')][_0x0979('0xf')](queryQueues));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x15')][_0x0979('0xf')](queryTelephones));_0x4cc772[_0x0979('0x2f')](db[_0x0979('0x37')]['findAll'](queryTrunks));_0x4cc772[_0x0979('0x2f')](db['Campaign'][_0x0979('0xf')](queryCampaigns));_0x4cc772['push'](db[_0x0979('0x15')][_0x0979('0xf')](queryAgents));break;case _0x0979('0x38'):_0x5654c0[_0x2a8b8b](_0x0979('0x2b'));_0x5654c0[_0x2a8b8b](_0x0979('0x2c'));_0x4cc772[_0x0979('0x2f')](getAssociatedResources('VoiceQueues',_0x32b52e[_0x0979('0x1e')],'VoiceQueue'));_0x4cc772['push'](getAssociatedResources(_0x0979('0x39'),_0x32b52e[_0x0979('0x1e')],_0x0979('0x31')));_0x4cc772[_0x0979('0x2f')](getAssociatedResources(_0x0979('0xc'),_0x32b52e[_0x0979('0x1e')],'FaxQueue'));_0x4cc772[_0x0979('0x2f')](getAssociatedResources(_0x0979('0x3a'),_0x32b52e['userProfileId'],'SmsQueue'));_0x4cc772[_0x0979('0x2f')](getAssociatedResources(_0x0979('0xd'),_0x32b52e[_0x0979('0x1e')],_0x0979('0x34')));_0x4cc772['push'](getAssociatedResources(_0x0979('0x3b'),_0x32b52e['userProfileId'],'OpenchannelQueue'));_0x4cc772['push'](getAssociatedResources(_0x0979('0xe'),_0x32b52e[_0x0979('0x1e')],'WhatsappQueue'));_0x4cc772['push'](getAssociatedResources(_0x0979('0x3c'),_0x32b52e[_0x0979('0x1e')],'User'));_0x4cc772['push'](getAssociatedResources(_0x0979('0x3d'),_0x32b52e[_0x0979('0x1e')],_0x0979('0x37')));_0x4cc772[_0x0979('0x2f')](getAssociatedResources(_0x0979('0x10'),_0x32b52e[_0x0979('0x1e')],_0x0979('0x3e')));_0x4cc772['push'](db[_0x0979('0x15')]['findAll'](queryAgents));break;case _0x0979('0x5'):_0x5654c0[_0x2a8b8b](_0x0979('0x2b'));_0x5654c0[_0x2a8b8b]('voice:outbound');_0x4cc772[_0x0979('0x2f')](_0x32b52e['getVoiceQueues']({'attributes':['id',_0x0979('0x3')]}));_0x4cc772[_0x0979('0x2f')](_0x32b52e[_0x0979('0x3f')]({'attributes':['id',_0x0979('0x3')]}));_0x4cc772[_0x0979('0x2f')](_0x32b52e[_0x0979('0x40')]({'attributes':['id',_0x0979('0x3')]}));_0x4cc772['push'](_0x32b52e[_0x0979('0x41')]({'attributes':['id','name']}));_0x4cc772[_0x0979('0x2f')](_0x32b52e[_0x0979('0x42')]({'attributes':['id',_0x0979('0x3')]}));_0x4cc772[_0x0979('0x2f')](_0x32b52e[_0x0979('0x43')]({'attributes':['id',_0x0979('0x3')]}));_0x4cc772[_0x0979('0x2f')](_0x32b52e['getWhatsappQueues']({'attributes':['id',_0x0979('0x3')]}));break;}return BPromise['all'](_0x4cc772);}})['then'](function(_0x43e31d){if(_0x43e31d&&_0x43e31d[_0x0979('0x1a')]){for(var _0x5f0f7c=0x0;_0x5f0f7c<_0x43e31d['length'];_0x5f0f7c+=0x1){for(var _0x226186=0x0;_0x226186<_0x43e31d[_0x5f0f7c][_0x0979('0x1a')];_0x226186+=0x1){switch(_0x5f0f7c){case 0x0:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,_0x0979('0x44'),_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x1:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,'chat',_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x2:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,_0x0979('0x45'),_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x3:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,'sms',_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x4:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,_0x0979('0x46'),_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x5:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,_0x0979('0x47'),_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x6:joinOrLeaveQueues(_0x5654c0,_0x2a8b8b,_0x0979('0x48'),_0x43e31d[_0x5f0f7c][_0x226186]);break;case 0x7:if(_0x476d8f[_0x0979('0x17')]!==_0x0979('0x5'))_0x5654c0[_0x2a8b8b](util[_0x0979('0x18')](_0x0979('0x49'),_0x43e31d[_0x5f0f7c][_0x226186]['name']));break;case 0x8:if(_0x476d8f['role']!==_0x0979('0x5'))_0x5654c0[_0x2a8b8b](util[_0x0979('0x18')]('trunk:%s',_0x43e31d[_0x5f0f7c][_0x226186]['name']));break;case 0x9:if(_0x476d8f['role']!==_0x0979('0x5'))_0x5654c0[_0x2a8b8b](util['format'](_0x0979('0x4a'),_0x43e31d[_0x5f0f7c][_0x226186][_0x0979('0x7')],_0x43e31d[_0x5f0f7c][_0x226186][_0x0979('0x3')]));break;case 0xa:_0x5654c0[_0x2a8b8b](util[_0x0979('0x18')](_0x0979('0x2a'),_0x43e31d[_0x5f0f7c][_0x226186]['name']));break;}}}}})['then'](function(){if(_0x2a8b8b===_0x0979('0x4b')){var _0x1af852=_[_0x0979('0x13')](_0x476d8f['ChatInteractions'],'id');return _0x476d8f[_0x0979('0x4c')](_0x1af852)[_0x0979('0x12')](function(){for(var _0x1b8075=0x0;_0x1b8075<_0x1af852[_0x0979('0x1a')];_0x1b8075+=0x1){_0xf5c90f[_0x0979('0x4d')](_0x0979('0x4e'),{'ChatInteractionId':Number(_0x1af852[_0x1b8075]),'UserId':Number(_0x476d8f['id'])});}});}})[_0x0979('0x12')](function(){if(_0x2a8b8b==='leave'){var _0x4c2810=_[_0x0979('0x13')](_0x476d8f['MailInteractions'],'id');return _0x476d8f[_0x0979('0x4f')](_0x4c2810)[_0x0979('0x12')](function(){for(var _0x19cd7d=0x0;_0x19cd7d<_0x4c2810['length'];_0x19cd7d+=0x1){_0xf5c90f[_0x0979('0x4d')](_0x0979('0x50'),{'MailInteractionId':Number(_0x4c2810[_0x19cd7d]),'UserId':Number(_0x476d8f['id'])});}});}})['then'](function(){if(_0x2a8b8b==='leave'){var _0x536a4e=_[_0x0979('0x13')](_0x476d8f[_0x0979('0x23')],'id');return _0x476d8f[_0x0979('0x51')](_0x536a4e)[_0x0979('0x12')](function(){for(var _0x54d4a4=0x0;_0x54d4a4<_0x536a4e[_0x0979('0x1a')];_0x54d4a4+=0x1){_0xf5c90f['emit']('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x536a4e[_0x54d4a4]),'UserId':Number(_0x476d8f['id'])});}});}})[_0x0979('0x12')](function(){if(_0x2a8b8b===_0x0979('0x4b')){var _0x114a49=_[_0x0979('0x13')](_0x476d8f['SmsInteractions'],'id');return _0x476d8f[_0x0979('0x52')](_0x114a49)[_0x0979('0x12')](function(){for(var _0x54977b=0x0;_0x54977b<_0x114a49[_0x0979('0x1a')];_0x54977b+=0x1){_0xf5c90f[_0x0979('0x4d')](_0x0979('0x53'),{'SmsInteractionId':Number(_0x114a49[_0x54977b]),'UserId':Number(_0x476d8f['id'])});}});}})[_0x0979('0x12')](function(){if(_0x2a8b8b==='leave'){var _0x448b0c=_[_0x0979('0x13')](_0x476d8f[_0x0979('0x27')],'id');return _0x476d8f[_0x0979('0x54')](_0x448b0c)[_0x0979('0x12')](function(){for(var _0x16125f=0x0;_0x16125f<_0x448b0c[_0x0979('0x1a')];_0x16125f+=0x1){_0xf5c90f[_0x0979('0x4d')](_0x0979('0x55'),{'OpenchannelInteractionId':Number(_0x448b0c[_0x16125f]),'UserId':Number(_0x476d8f['id'])});}});}})[_0x0979('0x12')](function(){if(_0x2a8b8b===_0x0979('0x4b')){var _0x342034=_[_0x0979('0x13')](_0x476d8f[_0x0979('0x29')],'id');return _0x476d8f[_0x0979('0x56')](_0x342034)['then'](function(){for(var _0x5e2575=0x0;_0x5e2575<_0x342034[_0x0979('0x1a')];_0x5e2575+=0x1){_0xf5c90f[_0x0979('0x4d')](_0x0979('0x57'),{'WhatsappInteractionId':Number(_0x342034[_0x5e2575]),'UserId':Number(_0x476d8f['id'])});}});}})[_0x0979('0x58')](function(_0x1091e9){_0x5654c0[_0x0979('0x59')](_0x1091e9);});}}function onDisconnect(_0x2b47cc,_0x14b0e5){joinOrLeave(_0x2b47cc,_0x0979('0x4b'),_0x14b0e5);}function onConnect(_0x3af8c8){joinOrLeave(_0x3af8c8,'join');}exports[_0x0979('0x5a')]=function(_0x594cec){_0x594cec['on']('connection',function(_0x279fe5){_0x279fe5[_0x0979('0x5b')](0x0);_0x279fe5[_0x0979('0x5c')]=_0x279fe5[_0x0979('0x5d')]['connection']['remoteAddress']+':'+_0x279fe5[_0x0979('0x5d')][_0x0979('0x5e')][_0x0979('0x5f')];_0x279fe5[_0x0979('0x60')]=new Date();_0x279fe5[_0x0979('0x59')]=function(_0x2b960f){console[_0x0979('0x59')]('SocketIO\x20'+_0x279fe5[_0x0979('0x61')][_0x0979('0x3')]+'['+_0x279fe5['address']+']',_0x2b960f);};_0x279fe5['on']('disconnect',function(){onDisconnect(_0x279fe5,_0x594cec);_0x279fe5[_0x0979('0x59')](_0x0979('0x62'));});onConnect(_0x279fe5);_0x279fe5['log'](_0x0979('0x63'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 48b4a37..b2f6ce5 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 _0x29ae=['name','agent','incomingmessage','outgoingmessage','offlineMessage','opened','resolve','QueryTypes','contact','format','SIP/%s','AfterCreate','changed','closed','User','find','email','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','condition','util','jayson/promise','client','http','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','ChatOfflineMessage','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','Whatsapp','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','error','code','catch','Trigger,\x20%s','get','channel','motionChannel','event','direction','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','UserId','interface'];(function(_0xcff28,_0x3f48e2){var _0x312ddc=function(_0x1ca0b8){while(--_0x1ca0b8){_0xcff28['push'](_0xcff28['shift']());}};_0x312ddc(++_0x3f48e2);}(_0x29ae,0x1cf));var _0xe29a=function(_0x4dc2df,_0x21b4e7){_0x4dc2df=_0x4dc2df-0x0;var _0x427035=_0x29ae[_0x4dc2df];return _0x427035;};'use strict';var util=require(_0xe29a('0x0'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe29a('0x1'));var logger=require('../logger')('triggers');var client=jayson[_0xe29a('0x2')][_0xe29a('0x3')]({'port':0x232a});var triggers=[{'channel':_0xe29a('0x4'),'model':_0xe29a('0x5'),'event':_0xe29a('0x6'),'condition':_0xe29a('0x7'),'callback':afterCreate},{'channel':_0xe29a('0x4'),'model':_0xe29a('0x5'),'event':_0xe29a('0x8'),'condition':_0xe29a('0x9'),'callback':afterUpdate},{'channel':_0xe29a('0x4'),'model':_0xe29a('0xa'),'event':_0xe29a('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xe29a('0x4'),'model':_0xe29a('0xb'),'event':_0xe29a('0x6'),'condition':_0xe29a('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xe29a('0xd'),'model':'SmsInteraction','event':_0xe29a('0x6'),'condition':_0xe29a('0x7'),'callback':afterCreate},{'channel':_0xe29a('0xd'),'model':_0xe29a('0xe'),'event':_0xe29a('0x8'),'condition':_0xe29a('0x9'),'callback':afterUpdate},{'channel':'Sms','model':_0xe29a('0xf'),'event':_0xe29a('0x6'),'condition':_0xe29a('0xc'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':'WhatsappInteraction','event':_0xe29a('0x6'),'condition':_0xe29a('0x7'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xe29a('0x10'),'event':_0xe29a('0x8'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xe29a('0x11'),'model':'WhatsappMessage','event':_0xe29a('0x6'),'condition':_0xe29a('0xc'),'callback':afterCreateMessage},{'channel':_0xe29a('0x12'),'model':'FaxInteraction','event':_0xe29a('0x6'),'condition':_0xe29a('0x7'),'callback':afterCreate},{'channel':'Fax','model':'FaxInteraction','event':_0xe29a('0x8'),'condition':_0xe29a('0x9'),'callback':afterUpdate},{'channel':_0xe29a('0x12'),'model':_0xe29a('0x13'),'event':_0xe29a('0x6'),'condition':'newmessage','callback':afterCreateMessage},{'channel':'Mail','model':_0xe29a('0x14'),'event':_0xe29a('0x6'),'condition':_0xe29a('0x7'),'callback':afterCreate},{'channel':_0xe29a('0x15'),'model':_0xe29a('0x14'),'event':'afterUpdate','condition':_0xe29a('0x9'),'callback':afterUpdate},{'channel':_0xe29a('0x15'),'model':_0xe29a('0x16'),'event':_0xe29a('0x6'),'condition':_0xe29a('0xc'),'callback':afterCreateMessage},{'channel':_0xe29a('0x17'),'model':_0xe29a('0x18'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xe29a('0x17'),'model':'OpenchannelInteraction','event':_0xe29a('0x8'),'condition':_0xe29a('0x9'),'callback':afterUpdate},{'channel':_0xe29a('0x17'),'model':_0xe29a('0x19'),'event':_0xe29a('0x6'),'condition':_0xe29a('0xc'),'callback':afterCreateMessage}];function request(_0x167828){return client[_0xe29a('0x1a')](_0xe29a('0x1b'),_0x167828)[_0xe29a('0x1c')](function(_0x44b49b){logger[_0xe29a('0x1d')]('Trigger,\x20%s',_0xe29a('0x1b'),_0x44b49b);if(_0x44b49b[_0xe29a('0x1e')]){if(_0x44b49b[_0xe29a('0x1e')][_0xe29a('0x1f')]===0x1f4){logger[_0xe29a('0x1e')]('Trigger,\x20%s',_0xe29a('0x1b'),_0x44b49b[_0xe29a('0x1e')]);}}})[_0xe29a('0x20')](function(_0x319582){logger[_0xe29a('0x1e')](_0xe29a('0x21'),'EventManager',_0x319582);});}function afterCreateMessage(_0x4b3ed9){return function(_0x4b93c3){_0x4b93c3=_0x4b93c3[_0xe29a('0x22')]({'plain':!![]});_0x4b93c3[_0xe29a('0x23')]=_0x4b3ed9;_0x4b93c3[_0xe29a('0x24')]=_0x4b3ed9;_0x4b93c3[_0xe29a('0x25')]=_0x4b93c3[_0xe29a('0x26')];Promise['resolve']()[_0xe29a('0x1c')](function(){if(typeof _0x4b93c3[_0xe29a('0x27')]===_0xe29a('0x28'))return null;var _0x6d4d34=_0xe29a('0x29')+_0x4b93c3[_0xe29a('0x27')];return db[_0xe29a('0x2a')][_0xe29a('0x2b')](_0x6d4d34,{'type':db[_0xe29a('0x2c')]['QueryTypes'][_0xe29a('0x2d')],'raw':!![]});})[_0xe29a('0x1c')](function(_0x162f64){if(_0x162f64){_0x4b93c3['contact']=_0x162f64[0x0];}if(typeof _0x4b93c3[_0xe29a('0x2e')]===_0xe29a('0x28'))return;return getAgent(_0x4b93c3[_0xe29a('0x2e')]);})['then'](function(_0x268bd4){if(_0x268bd4){_0x4b93c3[_0xe29a('0x2f')]=util['format']('SIP/%s',_0x268bd4[_0xe29a('0x30')]);_0x4b93c3[_0xe29a('0x31')]=_0x268bd4;_0x4b93c3['channel']=_0x4b3ed9;return request({'event':_0xe29a('0x32'),'message':_0x4b93c3});}else{return request({'event':_0xe29a('0x33'),'message':_0x4b93c3});}})[_0xe29a('0x20')](function(_0x3f4b5a){logger['error'](_0xe29a('0x21'),'AfterCreateMessage',_0x3f4b5a);});};}function afterCreateOfflineMessage(_0x352a06){return function(_0x4210f1){_0x4210f1=_0x4210f1['get']({'plain':!![]});_0x4210f1['channel']=_0x352a06;_0x4210f1['motionChannel']=_0x352a06;_0x4210f1[_0xe29a('0x25')]=_0xe29a('0x34');return request({'event':_0x4210f1[_0xe29a('0x25')],'message':_0x4210f1});};}function afterCreate(_0x50289e,_0x6507b){return function(_0x3d5fd6){_0x3d5fd6=_0x3d5fd6['get']({'plain':!![]});_0x3d5fd6[_0xe29a('0x23')]=_0x50289e;_0x3d5fd6['motionChannel']=_0x50289e;_0x3d5fd6['event']=_0xe29a('0x35');Promise[_0xe29a('0x36')]()['then'](function(){var _0x1921bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3d5fd6['ContactId'];return db[_0xe29a('0x2a')][_0xe29a('0x2b')](_0x1921bb,{'type':db['Sequelize'][_0xe29a('0x37')]['SELECT'],'raw':!![]});})[_0xe29a('0x1c')](function(_0x3fa9a2){if(_0x3fa9a2){_0x3d5fd6[_0xe29a('0x38')]=_0x3fa9a2[0x0];}if(typeof _0x3d5fd6[_0xe29a('0x2e')]===_0xe29a('0x28'))return;return getAgent(_0x3d5fd6[_0xe29a('0x2e')]);})['then'](function(_0x145a2c){if(_0x145a2c){_0x3d5fd6[_0xe29a('0x2f')]=util[_0xe29a('0x39')](_0xe29a('0x3a'),_0x145a2c[_0xe29a('0x30')]);_0x3d5fd6['agent']=_0x145a2c;}return request({'event':_0x6507b,'message':_0x3d5fd6});})['catch'](function(_0x1e1d19){logger[_0xe29a('0x1e')](_0xe29a('0x21'),_0xe29a('0x3b'),_0x1e1d19);});};}function afterUpdate(_0x5313a2){return function(_0x14edcf){var _0x473fb7=_0x14edcf[_0xe29a('0x3c')](_0xe29a('0x3d'))&&_0x14edcf['closed'];var _0x4f0d6a=_0x14edcf['changed']('substatus');if(_0x473fb7||_0x4f0d6a){var _0x56d3c2=_0x473fb7?_0xe29a('0x9'):'substatus';var _0x1591eb=_0x14edcf[_0xe29a('0x22')]({'plain':!![]});_0x1591eb[_0xe29a('0x23')]=_0x5313a2;_0x1591eb[_0xe29a('0x24')]=_0x5313a2;_0x1591eb[_0xe29a('0x25')]=_0x473fb7?_0xe29a('0x3d'):'substatus';var _0x2df38c=_0xe29a('0x29')+_0x1591eb[_0xe29a('0x27')];return db[_0xe29a('0x2a')][_0xe29a('0x2b')](_0x2df38c,{'type':db[_0xe29a('0x2c')][_0xe29a('0x37')]['SELECT'],'raw':!![]})[_0xe29a('0x1c')](function(_0x54f4ad){if(_0x54f4ad){_0x1591eb[_0xe29a('0x38')]=_0x54f4ad[0x0];}if(typeof _0x1591eb[_0xe29a('0x2e')]===_0xe29a('0x28'))return;return getAgent(_0x1591eb[_0xe29a('0x2e')]);})[_0xe29a('0x1c')](function(_0x5ab62e){if(_0x5ab62e){_0x1591eb[_0xe29a('0x2f')]=util[_0xe29a('0x39')](_0xe29a('0x3a'),_0x5ab62e[_0xe29a('0x30')]);_0x1591eb[_0xe29a('0x31')]=_0x5ab62e;}return request({'event':_0x56d3c2,'message':_0x1591eb});})[_0xe29a('0x20')](function(_0x518dc1){logger['error']('Trigger,\x20%s','AfterUpdate',_0x518dc1);});}};}function getAgent(_0x7e2e26){return db[_0xe29a('0x3e')][_0xe29a('0x3f')]({'where':{'id':_0x7e2e26},'attributes':['id',_0xe29a('0x30'),'fullname',_0xe29a('0x40'),_0xe29a('0x41')],'raw':!![]})[_0xe29a('0x1c')](function(_0x1f6fe7){return _0x1f6fe7;});}exports['default']=function(){for(var _0x43dfd9=0x0;_0x43dfd9=_0x19d623[_0x9a62('0x12')]){throw Error(_0x9a62('0x13'));}_0x144dff(_0x179fea);})[_0x9a62('0x14')](function(_0x5f1b66){_0x431f85(_0x5f1b66);});});}; \ No newline at end of file +var _0xf552=['agent','User','then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','bluebird','./license/util','voice','mail','chat','sms','whatsapp','openchannel','isValidChannel','toLowerCase','includes','clearBlockUser','blockedAt'];(function(_0x364b28,_0x12628a){var _0x56263e=function(_0x4ec03b){while(--_0x4ec03b){_0x364b28['push'](_0x364b28['shift']());}};_0x56263e(++_0x12628a);}(_0xf552,0x15a));var _0x2f55=function(_0x3e7bb8,_0x11f26c){_0x3e7bb8=_0x3e7bb8-0x0;var _0x160bf4=_0xf552[_0x3e7bb8];return _0x160bf4;};'use strict';var _=require(_0x2f55('0x0'));var BPromise=require(_0x2f55('0x1'));var db=require('../mysqldb')['db'];var util=require(_0x2f55('0x2'));var channels=[_0x2f55('0x3'),_0x2f55('0x4'),_0x2f55('0x5'),'fax',_0x2f55('0x6'),_0x2f55('0x7'),_0x2f55('0x8')];exports['getChannels']=function(){return channels;};exports[_0x2f55('0x9')]=function(_0x2e6864){_0x2e6864=_0x2e6864[_0x2f55('0xa')]();return _[_0x2f55('0xb')](channels,_0x2e6864);};exports[_0x2f55('0xc')]=function(_0x336e4a,_0x48bc8e,_0x5bb72,_0x2279d8){var _0x3d3d90={'loginAttempts':_0x48bc8e,'blocked':_0x5bb72};if(!_['isUndefined'](_0x2279d8)){_0x3d3d90[_0x2f55('0xd')]=_0x2279d8;}return _0x336e4a['updateAttributes'](_0x3d3d90);};exports['getLicense']=function(_0x2f255e){return new BPromise(function(_0x48b681,_0x102d54){var _0x6898c=0x0;if(_0x2f255e['role']!==_0x2f55('0xe')){_0x48b681(_0x2f255e);}db[_0x2f55('0xf')]['count']({'where':{'role':_0x2f55('0xe'),'online':!![],'id':{'$ne':_0x2f255e['id']}}})[_0x2f55('0x10')](function(_0x476a60){_0x6898c=_0x476a60;return util[_0x2f55('0x11')]();})[_0x2f55('0x10')](function(_0x846425){if(_0x846425&&_0x846425[_0x2f55('0x12')]&&_0x6898c>=_0x846425[_0x2f55('0x12')]){throw Error(_0x2f55('0x13'));}_0x48b681(_0x2f255e);})['catch'](function(_0x18205d){_0x102d54(_0x18205d);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 6b1de7f..e32b5e4 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','statusMessage','status','send','exports','../config/logger','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found'];(function(_0x43ec25,_0x22baa9){var _0x23fe70=function(_0x171e6a){while(--_0x171e6a){_0x43ec25['push'](_0x43ec25['shift']());}};_0x23fe70(++_0x22baa9);}(_0xadb5,0xad));var _0x5adb=function(_0x172ae0,_0x2b8a4c){_0x172ae0=_0x172ae0-0x0;var _0x5d0713=_0xadb5[_0x172ae0];return _0x5d0713;};'use strict';var util=require('util');var logger=require(_0x5adb('0x0'))('api');var APIError=function(_0x3d6340,_0x38f67f){this[_0x5adb('0x1')]=_0x3d6340||'Internal\x20Server\x20Error';this[_0x5adb('0x2')]=_0x38f67f||_0x5adb('0x3');util[_0x5adb('0x4')](APIError,Error);};var APIBadRequestError=function(_0x4cb1d1){this[_0x5adb('0x1')]=_0x4cb1d1||_0x5adb('0x5');this[_0x5adb('0x2')]=_0x5adb('0x5');util[_0x5adb('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x353885){this[_0x5adb('0x1')]=_0x353885||_0x5adb('0x6');this[_0x5adb('0x2')]=_0x5adb('0x7');util[_0x5adb('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x336bad){this[_0x5adb('0x1')]=_0x336bad||_0x5adb('0x8');this['name']='Out\x20Of\x20Interval';util[_0x5adb('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1ea238){switch(_0x1ea238){case _0x5adb('0x5'):return 0x190;case'Forbidden',_0x5adb('0x9'):return 0x193;case'Not\x20Found':return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x2a0b70){if(_0x2a0b70==='Out\x20Of\x20Interval')return _0x2a0b70;return null;}function handleError(_0x8cfcc6){return function(_0x39a0b3){logger[_0x5adb('0xa')](_0x39a0b3['stack']);var _0x2a545b=getStatusCode(_0x39a0b3[_0x5adb('0x2')]);var _0xf82f72=getCustomStatusMessage(_0x39a0b3['name']);if(_0x39a0b3[_0x5adb('0x2')])delete _0x39a0b3['name'];if(_0xf82f72)_0x8cfcc6[_0x5adb('0xb')]=_0xf82f72;return _0x8cfcc6[_0x5adb('0xc')](_0x2a545b)[_0x5adb('0xd')](_0x39a0b3);};}module[_0x5adb('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0x7a54=['Bad\x20Request','Forbidden','Out\x20Of\x20Interval','Not\x20Found','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Entity\x20not\x20found'];(function(_0x520cbe,_0x15a44b){var _0x52f57b=function(_0x19ad3a){while(--_0x19ad3a){_0x520cbe['push'](_0x520cbe['shift']());}};_0x52f57b(++_0x15a44b);}(_0x7a54,0x106));var _0x47a5=function(_0x3f4d9c,_0x37cdee){_0x3f4d9c=_0x3f4d9c-0x0;var _0x187b76=_0x7a54[_0x3f4d9c];return _0x187b76;};'use strict';var util=require(_0x47a5('0x0'));var logger=require(_0x47a5('0x1'))(_0x47a5('0x2'));var APIError=function(_0x58157c,_0x1d33e){this[_0x47a5('0x3')]=_0x58157c||'Internal\x20Server\x20Error';this[_0x47a5('0x4')]=_0x1d33e||_0x47a5('0x5');util[_0x47a5('0x6')](APIError,Error);};var APIBadRequestError=function(_0x3717e1){this[_0x47a5('0x3')]=_0x3717e1||'Bad\x20Request';this[_0x47a5('0x4')]='Bad\x20Request';util[_0x47a5('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x30e405){this['message']=_0x30e405||_0x47a5('0x7');this['name']='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x2a0e98){this[_0x47a5('0x3')]=_0x2a0e98||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x47a5('0x4')]='Out\x20Of\x20Interval';util['inherits'](APIOutOfIntervalError,APIError);};function getStatusCode(_0x1f47f4){switch(_0x1f47f4){case _0x47a5('0x8'):return 0x190;case _0x47a5('0x9'),_0x47a5('0xa'):return 0x193;case _0x47a5('0xb'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0xd308b8){if(_0xd308b8===_0x47a5('0xa'))return _0xd308b8;return null;}function handleError(_0x5beb89){return function(_0x44bd3e){logger[_0x47a5('0xc')](_0x44bd3e[_0x47a5('0xd')]);var _0x711793=getStatusCode(_0x44bd3e[_0x47a5('0x4')]);var _0x620ee9=getCustomStatusMessage(_0x44bd3e[_0x47a5('0x4')]);if(_0x44bd3e[_0x47a5('0x4')])delete _0x44bd3e['name'];if(_0x620ee9)_0x5beb89[_0x47a5('0xe')]=_0x620ee9;return _0x5beb89[_0x47a5('0xf')](_0x711793)[_0x47a5('0x10')](_0x44bd3e);};}module[_0x47a5('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index ec24f27..c945683 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x13b6=['send','exports','404','status','render'];(function(_0x4d900b,_0x3c793f){var _0x166220=function(_0x4b07b0){while(--_0x4b07b0){_0x4d900b['push'](_0x4d900b['shift']());}};_0x166220(++_0x3c793f);}(_0x13b6,0x97));var _0x613b=function(_0x3d635e,_0x55cfeb){_0x3d635e=_0x3d635e-0x0;var _0x10d415=_0x13b6[_0x3d635e];return _0x10d415;};'use strict';module[_0x613b('0x0')][0x194]=function pageNotFound(_0x55a1a6,_0x46234e){var _0x409275=_0x613b('0x1');var _0x390318=0x194;var _0x5d0f72={'status':_0x390318};_0x46234e[_0x613b('0x2')](_0x5d0f72[_0x613b('0x2')]);_0x46234e[_0x613b('0x3')](_0x409275,{},function(_0x50fb84,_0x44d5d8){if(_0x50fb84){return _0x46234e[_0x613b('0x2')](_0x5d0f72[_0x613b('0x2')])['json'](_0x5d0f72);}_0x46234e[_0x613b('0x4')](_0x44d5d8);});}; \ No newline at end of file +var _0x3533=['404','status','render','send'];(function(_0x1cc627,_0x4134d6){var _0x1bae19=function(_0x54e5c5){while(--_0x54e5c5){_0x1cc627['push'](_0x1cc627['shift']());}};_0x1bae19(++_0x4134d6);}(_0x3533,0x198));var _0x3353=function(_0x4b4533,_0x398ac1){_0x4b4533=_0x4b4533-0x0;var _0x22ee51=_0x3533[_0x4b4533];return _0x22ee51;};'use strict';module['exports'][0x194]=function pageNotFound(_0x20a898,_0x3f1d7b){var _0xbab4cb=_0x3353('0x0');var _0x4ecd7e=0x194;var _0x485543={'status':_0x4ecd7e};_0x3f1d7b[_0x3353('0x1')](_0x485543['status']);_0x3f1d7b[_0x3353('0x2')](_0xbab4cb,{},function(_0x22abbc,_0x1eb058){if(_0x22abbc){return _0x3f1d7b[_0x3353('0x1')](_0x485543['status'])['json'](_0x485543);}_0x3f1d7b[_0x3353('0x3')](_0x1eb058);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index b67a8fd..e67a3c8 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(_0x32a767,_0x4e3e76){var _0x2b4e6d=function(_0x5e0702){while(--_0x5e0702){_0x32a767['push'](_0x32a767['shift']());}};_0x2b4e6d(++_0x4e3e76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_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 diff --git a/server/routes.js b/server/routes.js index 9e47924..0a9058b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba6c=['/demo','/snippet','3.5.0','/plugins','/server/files/plugins','get','route','resolve','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','/api/users','./api/user','use','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/accounts','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/dashboards','/api/dashboards/items','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/custom_fields','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','./api/cdr','./api/voiceQueuesLog','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareMessage','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','./api/authGoogle','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/webbar','./api/webbar','static','join','root','/apidoc','/www'];(function(_0x1a7ac3,_0x2c4134){var _0x507e9c=function(_0x481255){while(--_0x481255){_0x1a7ac3['push'](_0x1a7ac3['shift']());}};_0x507e9c(++_0x2c4134);}(_0xba6c,0x113));var _0xcba6=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xba6c[_0x37d0bc];return _0x170e60;};'use strict';var path=require(_0xcba6('0x0'));var express=require('express');var errors=require(_0xcba6('0x1'));var config=require(_0xcba6('0x2'));var setupLoggers=require(_0xcba6('0x3'))[_0xcba6('0x4')];var clientSideLogs=require(_0xcba6('0x5'));exports[_0xcba6('0x6')]=function(_0x2b34a3){return setupLoggers(_0x2b34a3)['then'](function(){_0x2b34a3['use'](_0xcba6('0x7'),require(_0xcba6('0x8')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xa'),require(_0xcba6('0xb')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xc'),require(_0xcba6('0xd')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xe'),require(_0xcba6('0xf')));_0x2b34a3['use'](_0xcba6('0x10'),require(_0xcba6('0x11')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x12'),require('./api/voiceQueue'));_0x2b34a3[_0xcba6('0x9')]('/api/voice/recordings',require(_0xcba6('0x13')));_0x2b34a3[_0xcba6('0x9')]('/api/screen/recordings',require(_0xcba6('0x14')));_0x2b34a3['use'](_0xcba6('0x15'),require('./api/voiceMail'));_0x2b34a3['use']('/api/voice/mails/messages',require(_0xcba6('0x16')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x17'),require(_0xcba6('0x18')));_0x2b34a3[_0xcba6('0x9')]('/api/voice/dials/reports',require(_0xcba6('0x19')));_0x2b34a3['use'](_0xcba6('0x1a'),require(_0xcba6('0x1b')));_0x2b34a3['use'](_0xcba6('0x1c'),require(_0xcba6('0x1d')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x1e'),require(_0xcba6('0x1f')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x20'),require(_0xcba6('0x21')));_0x2b34a3[_0xcba6('0x9')]('/api/voice/transfers/reports',require(_0xcba6('0x22')));_0x2b34a3['use']('/api/mail/out_servers',require('./api/mailServerOut'));_0x2b34a3['use'](_0xcba6('0x23'),require('./api/mailAccount'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x24'),require(_0xcba6('0x25')));_0x2b34a3['use'](_0xcba6('0x26'),require(_0xcba6('0x27')));_0x2b34a3[_0xcba6('0x9')]('/api/mail/interactions',require(_0xcba6('0x28')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x29'),require('./api/mailMessage'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x2a'),require(_0xcba6('0x2b')));_0x2b34a3[_0xcba6('0x9')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x2b34a3['use'](_0xcba6('0x2c'),require('./api/dashboard'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x2d'),require('./api/dashboardItem'));_0x2b34a3['use'](_0xcba6('0x2e'),require('./api/faxAccount'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x2f'),require(_0xcba6('0x30')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x31'),require(_0xcba6('0x32')));_0x2b34a3['use'](_0xcba6('0x33'),require(_0xcba6('0x34')));_0x2b34a3['use']('/api/fax/queues',require(_0xcba6('0x35')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x36'),require(_0xcba6('0x37')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x38'),require(_0xcba6('0x39')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x3a'),require(_0xcba6('0x3b')));_0x2b34a3['use']('/api/sms/interactions',require(_0xcba6('0x3c')));_0x2b34a3[_0xcba6('0x9')]('/api/sms/messages',require(_0xcba6('0x3d')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x3e'),require(_0xcba6('0x3f')));_0x2b34a3[_0xcba6('0x9')]('/api/openchannel/accounts',require(_0xcba6('0x40')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x41'),require(_0xcba6('0x42')));_0x2b34a3[_0xcba6('0x9')]('/api/openchannel/interactions',require(_0xcba6('0x43')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x44'),require(_0xcba6('0x45')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x46'),require('./api/openchannelQueue'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x47'),require(_0xcba6('0x48')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x49'),require('./api/openchannelQueueReport'));_0x2b34a3['use']('/api/chat/applications',require(_0xcba6('0x4a')));_0x2b34a3[_0xcba6('0x9')]('/api/chat/interactions',require(_0xcba6('0x4b')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x4c'),require(_0xcba6('0x4d')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x4e'),require(_0xcba6('0x4f')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x50'),require(_0xcba6('0x51')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x52'),require(_0xcba6('0x53')));_0x2b34a3['use'](_0xcba6('0x54'),require(_0xcba6('0x55')));_0x2b34a3['use'](_0xcba6('0x56'),require('./api/cmCompany'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x57'),require(_0xcba6('0x58')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x59'),require(_0xcba6('0x5a')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x5b'),require(_0xcba6('0x5c')));_0x2b34a3[_0xcba6('0x9')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x2b34a3[_0xcba6('0x9')]('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x5d'),require('./api/cmCustomField'));_0x2b34a3['use']('/api/actions',require(_0xcba6('0x5e')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x5f'),require(_0xcba6('0x60')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x61'),require(_0xcba6('0x62')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x63'),require(_0xcba6('0x64')));_0x2b34a3['use'](_0xcba6('0x65'),require(_0xcba6('0x66')));_0x2b34a3[_0xcba6('0x9')]('/api/intervals',require(_0xcba6('0x67')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x68'),require(_0xcba6('0x69')));_0x2b34a3[_0xcba6('0x9')]('/api/cdr',require(_0xcba6('0x6a')));_0x2b34a3[_0xcba6('0x9')]('/api/voiceQueuesLog',require(_0xcba6('0x6b')));_0x2b34a3['use']('/api/schedules',require('./api/schedule'));_0x2b34a3[_0xcba6('0x9')]('/api/sounds',require(_0xcba6('0x6c')));_0x2b34a3['use'](_0xcba6('0x6d'),require('./api/tag'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x6e'),require(_0xcba6('0x6f')));_0x2b34a3[_0xcba6('0x9')]('/api/cm_contact_has_items',require(_0xcba6('0x70')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x71'),require(_0xcba6('0x72')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x73'),require(_0xcba6('0x74')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x75'),require(_0xcba6('0x76')));_0x2b34a3['use'](_0xcba6('0x77'),require(_0xcba6('0x78')));_0x2b34a3['use'](_0xcba6('0x79'),require(_0xcba6('0x7a')));_0x2b34a3['use'](_0xcba6('0x7b'),require('./api/integrationReport'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x7c'),require('./api/analyticCustomReport'));_0x2b34a3[_0xcba6('0x9')]('/api/analytics/default_reports',require(_0xcba6('0x7d')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x7e'),require(_0xcba6('0x7f')));_0x2b34a3['use'](_0xcba6('0x80'),require('./api/analyticMetric'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x81'),require(_0xcba6('0x82')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x83'),require(_0xcba6('0x84')));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x85'),require(_0xcba6('0x86')));_0x2b34a3['use'](_0xcba6('0x87'),require(_0xcba6('0x88')));_0x2b34a3['use'](_0xcba6('0x89'),require('./api/intSugarcrmAccount'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x8a'),require(_0xcba6('0x8b')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x8c'),require('./api/intSugarcrmField'));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/desk/accounts',require(_0xcba6('0x8d')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x8e'),require(_0xcba6('0x8f')));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/desk/fields',require('./api/intDeskField'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x90'),require(_0xcba6('0x91')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x92'),require('./api/intZohoConfiguration'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x93'),require(_0xcba6('0x94')));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/zendesk/accounts',require(_0xcba6('0x95')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x96'),require(_0xcba6('0x97')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x98'),require(_0xcba6('0x99')));_0x2b34a3['use'](_0xcba6('0x9a'),require(_0xcba6('0x9b')));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/freshdesk/configurations',require(_0xcba6('0x9c')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x9d'),require('./api/intFreshdeskField'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x9e'),require(_0xcba6('0x9f')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xa0'),require(_0xcba6('0xa1')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xa2'),require(_0xcba6('0xa3')));_0x2b34a3['use']('/api/integrations/servicenow/accounts',require(_0xcba6('0xa4')));_0x2b34a3[_0xcba6('0x9')]('/api/integrations/servicenow/configurations',require(_0xcba6('0xa5')));_0x2b34a3['use'](_0xcba6('0xa6'),require('./api/intServicenowField'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xa7'),require('./api/intDynamics365Account'));_0x2b34a3['use'](_0xcba6('0xa8'),require('./api/intDynamics365Configuration'));_0x2b34a3['use'](_0xcba6('0xa9'),require(_0xcba6('0xaa')));_0x2b34a3['use'](_0xcba6('0xab'),require(_0xcba6('0xac')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xad'),require(_0xcba6('0xae')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xaf'),require(_0xcba6('0xb0')));_0x2b34a3[_0xcba6('0x9')]('/api/networks',require(_0xcba6('0xb1')));_0x2b34a3['use'](_0xcba6('0xb2'),require('./api/chatQueueReport'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xb3'),require('./api/chatInternalMessage'));_0x2b34a3['use'](_0xcba6('0xb4'),require('./api/jscriptyAnswerReport'));_0x2b34a3['use'](_0xcba6('0xb5'),require(_0xcba6('0xb6')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xb7'),require(_0xcba6('0xb8')));_0x2b34a3['use'](_0xcba6('0xb9'),require('./api/smsQueueReport'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xba'),require(_0xcba6('0xbb')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xbc'),require(_0xcba6('0xbd')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xbe'),require('./api/jscriptyProject'));_0x2b34a3['use']('/api/settings',require(_0xcba6('0xbf')));_0x2b34a3['use'](_0xcba6('0xc0'),require('./api/squareOdbc'));_0x2b34a3['use'](_0xcba6('0xc1'),require(_0xcba6('0xc2')));_0x2b34a3[_0xcba6('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x2b34a3[_0xcba6('0x9')]('/api/square/messages',require(_0xcba6('0xc3')));_0x2b34a3['use']('/api/teams',require('./api/team'));_0x2b34a3[_0xcba6('0x9')]('/api/license',require(_0xcba6('0xc4')));_0x2b34a3[_0xcba6('0x9')]('/api/campaigns',require(_0xcba6('0xc5')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xc6'),require(_0xcba6('0xc7')));_0x2b34a3['use']('/api/attachments',require(_0xcba6('0xc8')));_0x2b34a3['use'](_0xcba6('0xc9'),require(_0xcba6('0xca')));_0x2b34a3['use']('/api/mail/reports/transfer',require(_0xcba6('0xcb')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xcc'),require(_0xcba6('0xcd')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xce'),require(_0xcba6('0xcf')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xd0'),require(_0xcba6('0xd1')));_0x2b34a3['use']('/api/sms/reports/transfer',require(_0xcba6('0xd2')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xd3'),require(_0xcba6('0xd4')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xd5'),require(_0xcba6('0xd6')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xd7'),require(_0xcba6('0xd8')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xd9'),require(_0xcba6('0xda')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xdb'),require(_0xcba6('0xdc')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xdd'),require(_0xcba6('0xde')));_0x2b34a3[_0xcba6('0x9')]('/api/whatsapp/accounts',require(_0xcba6('0xdf')));_0x2b34a3['use'](_0xcba6('0xe0'),require(_0xcba6('0xe1')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xe2'),require('./api/whatsappInteraction'));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xe3'),require(_0xcba6('0xe4')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xe5'),require(_0xcba6('0xe6')));_0x2b34a3[_0xcba6('0x9')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x2b34a3['use'](_0xcba6('0xe7'),require(_0xcba6('0xe8')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xe9'),require(_0xcba6('0xea')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xeb'),require(_0xcba6('0xec')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xed'),require(_0xcba6('0xee')));_0x2b34a3[_0xcba6('0x9')]('/api/auth/local',require(_0xcba6('0xef')));_0x2b34a3[_0xcba6('0x9')]('/api/auth/google',require(_0xcba6('0xf0')));_0x2b34a3[_0xcba6('0x9')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x2b34a3[_0xcba6('0x9')]('/api/jira',require(_0xcba6('0xf1')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xf2'),require(_0xcba6('0xf3')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xf4'),require(_0xcba6('0xf5')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xf6'),require(_0xcba6('0xf7')));_0x2b34a3[_0xcba6('0x9')]('/api/pm2',require('./api/pm2'));_0x2b34a3['use'](_0xcba6('0xf8'),require(_0xcba6('0xf9')));_0x2b34a3[_0xcba6('0x9')]('/api/logs',clientSideLogs);_0x2b34a3[_0xcba6('0x9')]('/apidoc',express[_0xcba6('0xfa')](path[_0xcba6('0xfb')](config[_0xcba6('0xfc')],_0xcba6('0xfd'))));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xfe'),express[_0xcba6('0xfa')](path[_0xcba6('0xfb')](config['root'],'/www')));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0xff'),express['static'](path['join'](config['root'],_0xcba6('0xff'))));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x100'),express[_0xcba6('0xfa')](path[_0xcba6('0xfb')](config[_0xcba6('0xfc')],'snippet',_0xcba6('0x101'))));_0x2b34a3[_0xcba6('0x9')](_0xcba6('0x102'),express[_0xcba6('0xfa')](path['join'](config['root'],_0xcba6('0x103'))));_0x2b34a3['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0xcba6('0x104')](errors[0x194]);_0x2b34a3[_0xcba6('0x105')]('/*')[_0xcba6('0x104')](function(_0x352623,_0x4eabd7){_0x4eabd7['sendFile'](path[_0xcba6('0x106')](_0x2b34a3[_0xcba6('0x104')](_0xcba6('0x107'))+_0xcba6('0x108')));});return _0x2b34a3;});}; \ No newline at end of file +var _0x5ed2=['sendFile','appPath','/index.html','path','./errors','./config/environment','setupLoggers','./api/client-side-logs','then','use','/api/users','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./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/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/schedules','/api/tags','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./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/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/attachments','./api/attachment','/api/mail/reports/transfer','./api/mailTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/snippet','snippet','3.5.0','/plugins','/server/files/plugins','get','route'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x5ed2,0x114));var _0x25ed=function(_0x110ea8,_0xacb6fa){_0x110ea8=_0x110ea8-0x0;var _0x4073cf=_0x5ed2[_0x110ea8];return _0x4073cf;};'use strict';var path=require(_0x25ed('0x0'));var express=require('express');var errors=require(_0x25ed('0x1'));var config=require(_0x25ed('0x2'));var setupLoggers=require('./utils/client-side-logger')[_0x25ed('0x3')];var clientSideLogs=require(_0x25ed('0x4'));exports['default']=function(_0x1ce8d8){return setupLoggers(_0x1ce8d8)[_0x25ed('0x5')](function(){_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x7'),require('./api/user'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x8'),require(_0x25ed('0x9')));_0x1ce8d8[_0x25ed('0x6')]('/api/voice/contexts',require('./api/voiceContext'));_0x1ce8d8['use']('/api/voice/extensions',require(_0x25ed('0xa')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xb'),require(_0x25ed('0xc')));_0x1ce8d8['use'](_0x25ed('0xd'),require(_0x25ed('0xe')));_0x1ce8d8[_0x25ed('0x6')]('/api/voice/recordings',require('./api/voiceRecording'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xf'),require(_0x25ed('0x10')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x11'),require(_0x25ed('0x12')));_0x1ce8d8['use'](_0x25ed('0x13'),require(_0x25ed('0x14')));_0x1ce8d8[_0x25ed('0x6')]('/api/voice/calls/reports',require(_0x25ed('0x15')));_0x1ce8d8['use'](_0x25ed('0x16'),require(_0x25ed('0x17')));_0x1ce8d8[_0x25ed('0x6')]('/api/voice/agents/reports',require(_0x25ed('0x18')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x19'),require(_0x25ed('0x1a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x1b'),require('./api/memberReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x1c'),require('./api/trunk'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x1d'),require(_0x25ed('0x1e')));_0x1ce8d8['use'](_0x25ed('0x1f'),require(_0x25ed('0x20')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x21'),require(_0x25ed('0x22')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x23'),require(_0x25ed('0x24')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x25'),require(_0x25ed('0x26')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x27'),require(_0x25ed('0x28')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x29'),require(_0x25ed('0x2a')));_0x1ce8d8['use'](_0x25ed('0x2b'),require(_0x25ed('0x2c')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x2d'),require('./api/mailQueueReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x2e'),require(_0x25ed('0x2f')));_0x1ce8d8['use']('/api/dashboards/items',require(_0x25ed('0x30')));_0x1ce8d8['use'](_0x25ed('0x31'),require(_0x25ed('0x32')));_0x1ce8d8['use'](_0x25ed('0x33'),require(_0x25ed('0x34')));_0x1ce8d8['use'](_0x25ed('0x35'),require(_0x25ed('0x36')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x37'),require(_0x25ed('0x38')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x39'),require('./api/faxQueue'));_0x1ce8d8[_0x25ed('0x6')]('/api/fax/reports/queue',require(_0x25ed('0x3a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x3b'),require('./api/smsAccount'));_0x1ce8d8[_0x25ed('0x6')]('/api/sms/applications',require(_0x25ed('0x3c')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x3d'),require(_0x25ed('0x3e')));_0x1ce8d8['use'](_0x25ed('0x3f'),require(_0x25ed('0x40')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x41'),require(_0x25ed('0x42')));_0x1ce8d8['use'](_0x25ed('0x43'),require(_0x25ed('0x44')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x45'),require(_0x25ed('0x46')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x47'),require(_0x25ed('0x48')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x49'),require(_0x25ed('0x4a')));_0x1ce8d8[_0x25ed('0x6')]('/api/openchannel/queues',require(_0x25ed('0x4b')));_0x1ce8d8['use'](_0x25ed('0x4c'),require(_0x25ed('0x4d')));_0x1ce8d8['use'](_0x25ed('0x4e'),require(_0x25ed('0x4f')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x50'),require(_0x25ed('0x51')));_0x1ce8d8[_0x25ed('0x6')]('/api/chat/interactions',require(_0x25ed('0x52')));_0x1ce8d8['use'](_0x25ed('0x53'),require('./api/chatMessage'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x54'),require(_0x25ed('0x55')));_0x1ce8d8['use'](_0x25ed('0x56'),require(_0x25ed('0x57')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x58'),require('./api/chatGroup'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x59'),require(_0x25ed('0x5a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x5b'),require(_0x25ed('0x5c')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x5d'),require(_0x25ed('0x5e')));_0x1ce8d8[_0x25ed('0x6')]('/api/cm/hopper',require('./api/cmHopper'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x5f'),require('./api/cmHopperBlack'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x60'),require(_0x25ed('0x61')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x62'),require('./api/cmHopperHistory'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x63'),require(_0x25ed('0x64')));_0x1ce8d8['use'](_0x25ed('0x65'),require('./api/action'));_0x1ce8d8['use'](_0x25ed('0x66'),require(_0x25ed('0x67')));_0x1ce8d8[_0x25ed('0x6')]('/api/canned_answers',require(_0x25ed('0x68')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x69'),require(_0x25ed('0x6a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x6b'),require(_0x25ed('0x6c')));_0x1ce8d8['use']('/api/intervals',require(_0x25ed('0x6d')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x6e'),require(_0x25ed('0x6f')));_0x1ce8d8['use'](_0x25ed('0x70'),require(_0x25ed('0x71')));_0x1ce8d8['use'](_0x25ed('0x72'),require('./api/voiceQueuesLog'));_0x1ce8d8['use'](_0x25ed('0x73'),require('./api/schedule'));_0x1ce8d8[_0x25ed('0x6')]('/api/sounds',require('./api/sound'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x74'),require('./api/tag'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x75'),require('./api/contactItemType'));_0x1ce8d8['use'](_0x25ed('0x76'),require(_0x25ed('0x77')));_0x1ce8d8['use'](_0x25ed('0x78'),require(_0x25ed('0x79')));_0x1ce8d8[_0x25ed('0x6')]('/api/templates',require(_0x25ed('0x7a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x7b'),require(_0x25ed('0x7c')));_0x1ce8d8['use'](_0x25ed('0x7d'),require(_0x25ed('0x7e')));_0x1ce8d8['use'](_0x25ed('0x7f'),require(_0x25ed('0x80')));_0x1ce8d8['use']('/api/integrations/reports',require(_0x25ed('0x81')));_0x1ce8d8['use'](_0x25ed('0x82'),require('./api/analyticCustomReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x83'),require(_0x25ed('0x84')));_0x1ce8d8[_0x25ed('0x6')]('/api/analytics/extracted_reports',require(_0x25ed('0x85')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x86'),require('./api/analyticMetric'));_0x1ce8d8[_0x25ed('0x6')]('/api/analytics/field_reports',require(_0x25ed('0x87')));_0x1ce8d8[_0x25ed('0x6')]('/api/analytics/tree_reports',require(_0x25ed('0x88')));_0x1ce8d8['use'](_0x25ed('0x89'),require(_0x25ed('0x8a')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x8b'),require(_0x25ed('0x8c')));_0x1ce8d8['use'](_0x25ed('0x8d'),require(_0x25ed('0x8e')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x8f'),require(_0x25ed('0x90')));_0x1ce8d8['use'](_0x25ed('0x91'),require(_0x25ed('0x92')));_0x1ce8d8['use'](_0x25ed('0x93'),require(_0x25ed('0x94')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x95'),require(_0x25ed('0x96')));_0x1ce8d8[_0x25ed('0x6')]('/api/integrations/desk/configurations',require(_0x25ed('0x97')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x98'),require(_0x25ed('0x99')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x9a'),require(_0x25ed('0x9b')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x9c'),require(_0x25ed('0x9d')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x9e'),require('./api/intZohoField'));_0x1ce8d8[_0x25ed('0x6')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x1ce8d8['use'](_0x25ed('0x9f'),require(_0x25ed('0xa0')));_0x1ce8d8['use'](_0x25ed('0xa1'),require('./api/intZendeskField'));_0x1ce8d8['use'](_0x25ed('0xa2'),require(_0x25ed('0xa3')));_0x1ce8d8[_0x25ed('0x6')]('/api/integrations/freshdesk/configurations',require(_0x25ed('0xa4')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xa5'),require(_0x25ed('0xa6')));_0x1ce8d8['use'](_0x25ed('0xa7'),require(_0x25ed('0xa8')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xa9'),require(_0x25ed('0xaa')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xab'),require(_0x25ed('0xac')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xad'),require(_0x25ed('0xae')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xaf'),require(_0x25ed('0xb0')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xb1'),require('./api/intServicenowField'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xb2'),require(_0x25ed('0xb3')));_0x1ce8d8['use']('/api/integrations/dynamics365/configurations',require(_0x25ed('0xb4')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xb5'),require(_0x25ed('0xb6')));_0x1ce8d8['use'](_0x25ed('0xb7'),require(_0x25ed('0xb8')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xb9'),require('./api/intFreshsalesConfiguration'));_0x1ce8d8['use']('/api/integrations/freshsales/fields',require('./api/intFreshsalesField'));_0x1ce8d8[_0x25ed('0x6')]('/api/networks',require(_0x25ed('0xba')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xbb'),require('./api/chatQueueReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xbc'),require(_0x25ed('0xbd')));_0x1ce8d8['use'](_0x25ed('0xbe'),require(_0x25ed('0xbf')));_0x1ce8d8['use'](_0x25ed('0xc0'),require('./api/jscriptyQuestionReport'));_0x1ce8d8[_0x25ed('0x6')]('/api/jscripty/sessions/reports',require('./api/jscriptySessionReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xc1'),require('./api/smsQueueReport'));_0x1ce8d8['use'](_0x25ed('0xc2'),require(_0x25ed('0xc3')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xc4'),require(_0x25ed('0xc5')));_0x1ce8d8[_0x25ed('0x6')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xc6'),require('./api/setting'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xc7'),require('./api/squareOdbc'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xc8'),require(_0x25ed('0xc9')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xca'),require('./api/squareRecording'));_0x1ce8d8[_0x25ed('0x6')]('/api/square/messages',require(_0x25ed('0xcb')));_0x1ce8d8['use']('/api/teams',require(_0x25ed('0xcc')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xcd'),require(_0x25ed('0xce')));_0x1ce8d8['use'](_0x25ed('0xcf'),require(_0x25ed('0xd0')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xd1'),require('./api/migration'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xd2'),require(_0x25ed('0xd3')));_0x1ce8d8[_0x25ed('0x6')]('/api/plugins',require('./api/plugin'));_0x1ce8d8['use'](_0x25ed('0xd4'),require(_0x25ed('0xd5')));_0x1ce8d8[_0x25ed('0x6')]('/api/chat/reports/transfer',require('./api/chatTransferReport'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xd6'),require(_0x25ed('0xd7')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xd8'),require(_0x25ed('0xd9')));_0x1ce8d8[_0x25ed('0x6')]('/api/sms/reports/transfer',require(_0x25ed('0xda')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xdb'),require(_0x25ed('0xdc')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xdd'),require(_0x25ed('0xde')));_0x1ce8d8['use'](_0x25ed('0xdf'),require('./api/userProfile'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xe0'),require(_0x25ed('0xe1')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xe2'),require(_0x25ed('0xe3')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xe4'),require(_0x25ed('0xe5')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xe6'),require('./api/whatsappAccount'));_0x1ce8d8[_0x25ed('0x6')]('/api/whatsapp/applications',require(_0x25ed('0xe7')));_0x1ce8d8[_0x25ed('0x6')]('/api/whatsapp/interactions',require(_0x25ed('0xe8')));_0x1ce8d8['use'](_0x25ed('0xe9'),require(_0x25ed('0xea')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xeb'),require('./api/whatsappQueueReport'));_0x1ce8d8['use']('/api/whatsapp/reports/transfer',require(_0x25ed('0xec')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xed'),require(_0x25ed('0xee')));_0x1ce8d8[_0x25ed('0x6')]('/api/cloudProviders',require('./api/cloudProvider'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xef'),require(_0x25ed('0xf0')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xf1'),require(_0x25ed('0xf2')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xf3'),require(_0x25ed('0xf4')));_0x1ce8d8['use'](_0x25ed('0xf5'),require(_0x25ed('0xf6')));_0x1ce8d8['use'](_0x25ed('0xf7'),require(_0x25ed('0xf8')));_0x1ce8d8[_0x25ed('0x6')]('/api/jira',require('./api/jira'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xf9'),require('./api/rpc'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xfa'),require(_0x25ed('0xfb')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xfc'),require('./api/system'));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0xfd'),require(_0x25ed('0xfe')));_0x1ce8d8['use'](_0x25ed('0xff'),require(_0x25ed('0x100')));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x101'),clientSideLogs);_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x102'),express[_0x25ed('0x103')](path[_0x25ed('0x104')](config[_0x25ed('0x105')],_0x25ed('0x102'))));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x106'),express['static'](path[_0x25ed('0x104')](config[_0x25ed('0x105')],_0x25ed('0x106'))));_0x1ce8d8[_0x25ed('0x6')]('/demo',express[_0x25ed('0x103')](path[_0x25ed('0x104')](config['root'],'/demo')));_0x1ce8d8['use'](_0x25ed('0x107'),express['static'](path[_0x25ed('0x104')](config[_0x25ed('0x105')],_0x25ed('0x108'),_0x25ed('0x109'))));_0x1ce8d8[_0x25ed('0x6')](_0x25ed('0x10a'),express['static'](path['join'](config[_0x25ed('0x105')],_0x25ed('0x10b'))));_0x1ce8d8['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x25ed('0x10c')](errors[0x194]);_0x1ce8d8[_0x25ed('0x10d')]('/*')['get'](function(_0x1ad12f,_0x2b7900){_0x2b7900[_0x25ed('0x10e')](path['resolve'](_0x1ce8d8[_0x25ed('0x10c')](_0x25ed('0x10f'))+_0x25ed('0x110')));});return _0x1ce8d8;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 79a1f9f..1e33f1c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeed=['../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.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/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','rpc','error','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xdeed,0x1cd));var _0xddee=function(_0x109751,_0x1c8c21){_0x109751=_0x109751-0x0;var _0x44fd3d=_0xdeed[_0x109751];return _0x44fd3d;};'use strict';var jayson=require(_0xddee('0x0'));var _=require(_0xddee('0x1'));var config=require('../config/environment');exports['listen']=function(){return new Promise(function(_0x3b4fc6,_0xae1add){var _0x37d18f={};_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x3')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x4')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x5')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x6')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x7')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x8')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x9')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0xa')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0xb')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0xc')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0xd')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/mailServerIn/mailServerIn.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0xe')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0xf')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x10')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x11')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x12')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x13')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x14')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x15')));_0x37d18f=_['merge'](_0x37d18f,require('../api/faxInteraction/faxInteraction.rpc'));_0x37d18f=_['merge'](_0x37d18f,require('../api/faxMessage/faxMessage.rpc'));_0x37d18f=_['merge'](_0x37d18f,require('../api/faxQueue/faxQueue.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/smsAccount/smsAccount.rpc'));_0x37d18f=_['merge'](_0x37d18f,require('../api/smsInteraction/smsInteraction.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x16')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x17')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x18')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x19')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x1a')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x1b')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x1c')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x1d')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x1e')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x1f')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x20')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x21')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x22')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x23')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x24')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x25')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x26')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/sound/sound.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x27')));_0x37d18f=_['merge'](_0x37d18f,require('../api/trigger/trigger.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x28')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x29')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x2a')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x2b')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x2c')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x2d')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x2e')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x2f')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x30')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x31')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x32')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x33')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x34')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/squareReport/squareReport.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x35')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x36')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/squareOdbc/squareOdbc.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x37')));_0x37d18f=_['merge'](_0x37d18f,require('../api/squareRecording/squareRecording.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x38')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require('../api/campaign/campaign.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x39')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x3a')));_0x37d18f=_['merge'](_0x37d18f,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x3b')));_0x37d18f=_[_0xddee('0x2')](_0x37d18f,require(_0xddee('0x3c')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x3d')));_0x37d18f=_['merge'](_0x37d18f,require(_0xddee('0x3e')));var _0x369239=jayson[_0xddee('0x3f')](_0x37d18f)['http']();var _0x1f2568=config['rpc'][_0xddee('0x40')]||config['port']+0x1;var _0x195076=config[_0xddee('0x41')]['ip']||'localhost';_0x369239['on'](_0xddee('0x42'),function(_0xfd1768){return _0xae1add(_0xfd1768);});_0x369239[_0xddee('0x43')](_0x1f2568,_0x195076,function(){console['log'](_0xddee('0x44'),_0x195076,_0x1f2568);require(_0xddee('0x45'))[_0xddee('0x46')]();return _0x3b4fc6('RPC\x20listening\x20on\x20'+_0x195076+':'+_0x1f2568);});});}; \ No newline at end of file +var _0x23fa=['../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','http','port','rpc','localhost','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc'];(function(_0x475dce,_0x1754ff){var _0x40687a=function(_0xdfa78a){while(--_0xdfa78a){_0x475dce['push'](_0x475dce['shift']());}};_0x40687a(++_0x1754ff);}(_0x23fa,0x183));var _0xa23f=function(_0x95cd68,_0x565e70){_0x95cd68=_0x95cd68-0x0;var _0x4d97b6=_0x23fa[_0x95cd68];return _0x4d97b6;};'use strict';var jayson=require(_0xa23f('0x0'));var _=require(_0xa23f('0x1'));var config=require('../config/environment');exports[_0xa23f('0x2')]=function(){return new Promise(function(_0x353533,_0x21234c){var _0x3b124e={};_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/user/user.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x4')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x5')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/voiceRecording/voiceRecording.rpc'));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x6')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x7')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x8')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x9')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0xa')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0xb')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0xc')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0xd')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/mailAccount/mailAccount.rpc'));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0xe')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0xf')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x10')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/mailApplication/mailApplication.rpc'));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x11')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x12')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x13')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/faxInteraction/faxInteraction.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x14')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x15')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x16')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x17')));_0x3b124e=_['merge'](_0x3b124e,require('../api/smsInteraction/smsInteraction.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/smsMessage/smsMessage.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x18')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x19')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1a')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1b')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1c')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1d')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1e')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x1f')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/chatQueue/chatQueue.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/cmContact/cmContact.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/cmHopper/cmHopper.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x20')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x21')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x22')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x23')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x24')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x25')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x26')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x27')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/variable/variable.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x28')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x29')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2a')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2b')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2c')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2d')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2e')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x2f')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x30')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x31')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x32')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x33')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x34')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/setting/setting.rpc'));_0x3b124e=_['merge'](_0x3b124e,require('../api/squareOdbc/squareOdbc.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x35')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/squareRecording/squareRecording.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x36')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x37')));_0x3b124e=_['merge'](_0x3b124e,require(_0xa23f('0x38')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x39')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x3a')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require(_0xa23f('0x3b')));_0x3b124e=_[_0xa23f('0x3')](_0x3b124e,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x3b124e=_['merge'](_0x3b124e,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x24cf86=jayson['server'](_0x3b124e)[_0xa23f('0x3c')]();var _0x676f46=config['rpc']['port']||config[_0xa23f('0x3d')]+0x1;var _0x5ff27c=config[_0xa23f('0x3e')]['ip']||_0xa23f('0x3f');_0x24cf86['on']('error',function(_0x1db8c8){return _0x21234c(_0x1db8c8);});_0x24cf86[_0xa23f('0x2')](_0x676f46,_0x5ff27c,function(){console[_0xa23f('0x40')](_0xa23f('0x41'),_0x5ff27c,_0x676f46);require(_0xa23f('0x42'))[_0xa23f('0x43')]();return _0x353533(_0xa23f('0x44')+_0x5ff27c+':'+_0x676f46);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 493f3c4..66534ef 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 _0x4fda=['util','events','EventEmitter','call','setTimeout','setEncoding','headers','ready','line','toLowerCase','hangup','emit','search','function','substring','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','NO\x20MESSAGE','exec','isArray','EXEC\x20%s\x20%s','setContext','SET\x20CONTEXT\x20%s','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','continueAt','extension','setExtension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','noop','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label'];(function(_0x58e424,_0x3c9352){var _0x369a23=function(_0x3c44df){while(--_0x3c44df){_0x58e424['push'](_0x58e424['shift']());}};_0x369a23(++_0x3c9352);}(_0x4fda,0x9a));var _0xa4fd=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0x4fda[_0x4d7a70];return _0x3aafbb;};'use strict';var util=require(_0xa4fd('0x0'));var _=require('lodash');var EventEmitter=require(_0xa4fd('0x1'))[_0xa4fd('0x2')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x9308ab){var _0x2677dd=this,_0x40f85d=new AGIReply(),_0x169b4e=![],_0x48e16d={};EventEmitter[_0xa4fd('0x3')](_0x2677dd);_0x9308ab['setEncoding']('utf8');_0x9308ab[_0xa4fd('0x4')](0x8*0x3c*0x3c*0x3e8);_0x40f85d[_0xa4fd('0x5')]('utf8');_0x40f85d['on'](_0xa4fd('0x6'),function(_0x3b0019){for(var _0x54295d in _0x3b0019){_0x2677dd[_0x54295d]=_0x3b0019[_0x54295d];}_0x2677dd['emit'](_0xa4fd('0x7'));});_0x40f85d['on'](_0xa4fd('0x8'),function(_0x1e44a8){if(_0x1e44a8[_0xa4fd('0x9')]()==_0xa4fd('0xa')){_0x2677dd[_0xa4fd('0xb')](_0xa4fd('0xa'));return;}if(_0x1e44a8['substring'](0x0,0xb)=='520-Invalid'){_0x169b4e=!![];}if(_0x169b4e){_0x48e16d['rx']+=_0x1e44a8+'\x0a';if(_0x1e44a8[_0xa4fd('0xc')]('520\x20End\x20of\x20proper')!=-0x1){_0x169b4e=![];}}else{_0x48e16d['rx']=_0x1e44a8;}if(_0x169b4e){return;}if(typeof _0x48e16d['cb']==_0xa4fd('0xd')){var _0x2bb57f=_0x48e16d['rx']['substring'](0x0,0x3),_0x2102a2=null,_0x26fc24=null;_0x2bb57f=parseInt(_0x2bb57f);if(isNaN(_0x2bb57f)){_0x48e16d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x2bb57f!=0xc8){_0x48e16d['cb'](null,{'code':_0x2bb57f,'result':-0x1,'extra':'KO'});return;}_0x2102a2=_0x48e16d['rx'][_0xa4fd('0xe')](0x4)['replace'](_0xa4fd('0xf'),'');if(_0x2102a2[_0xa4fd('0x10')]('\x20')!=-0x1){_0x2102a2=_0x2102a2[_0xa4fd('0x11')](0x0,_0x2102a2[_0xa4fd('0x10')]('\x20'));}if(_['startsWith'](_0x2102a2,'-1')){_0x2102a2=parseInt(_0x2102a2);}_0x26fc24=_0x48e16d['rx'][_0xa4fd('0x12')]('\x20');if(_0x26fc24[_0xa4fd('0x13')]==0x3){_0x26fc24=_0x26fc24[0x2][_0xa4fd('0xe')](0x1,_0x26fc24[0x2][_0xa4fd('0x13')]-0x1);}else if(_0x26fc24[_0xa4fd('0x13')]>0x3){var _0x4f321e=/\((.+)\)/;var _0x10f564=_0x48e16d['rx'][_0xa4fd('0x14')](_0x4f321e);if(_0x10f564){_0x26fc24=_0x10f564[0x1];}else{_0x26fc24=null;}}else{_0x26fc24=null;}_0x48e16d['cb'](null,{'code':_0x2bb57f,'result':_0x2102a2,'extra':_0x26fc24});}});_0x9308ab['on'](_0xa4fd('0x15'),function(_0x13c2f8){_0x2677dd[_0xa4fd('0xb')](_0xa4fd('0x15'),new AGIError(_0xa4fd('0x16'),_0x13c2f8[_0xa4fd('0x17')]));});_0x9308ab['on'](_0xa4fd('0x18'),function(){_0x2677dd['emit'](_0xa4fd('0x18'),new AGIError(_0xa4fd('0x19')));});_0x9308ab['on'](_0xa4fd('0x1a'),function(){_0x2677dd[_0xa4fd('0xb')](_0xa4fd('0x1a'),new AGIError(_0xa4fd('0x1b')));_0x9308ab['destroy']();});_0x9308ab[_0xa4fd('0x1c')](_0x40f85d);this[_0xa4fd('0x1d')]=function(_0x12886f,_0xcdf8d9){var _0x12886f=_0x12886f||'',_0xcdf8d9=typeof _0xcdf8d9==_0xa4fd('0xd')?_0xcdf8d9:new Function();_0x48e16d={'tx':_0x12886f,'rx':'','cb':_0xcdf8d9};_0x9308ab[_0xa4fd('0x1e')](_0x12886f+'\x0a');},this[_0xa4fd('0x18')]=function(){_0x9308ab['destroy']();};}util[_0xa4fd('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x21')]=function(_0x2c471f){return this[_0xa4fd('0x1d')][_0xa4fd('0x22')](this,_0x2c471f);};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x23')]=function(){return this[_0xa4fd('0x21')](_0xa4fd('0x24'));};AGIChannel['prototype'][_0xa4fd('0x25')]=function(_0x4456d7,_0x49259f,_0x2e86c5){_0x4456d7=_0x4456d7===undefined?'beep':_0x4456d7;_0x49259f=_0x49259f===undefined?'5':_0x49259f;_0x2e86c5=_0x2e86c5===undefined?'1':_0x2e86c5;return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x27'),_0x4456d7,_0x49259f*0x3e8,_0x2e86c5));};AGIChannel['prototype']['noop']=function(_0x5be8c0){_0x5be8c0=_0x5be8c0||_0xa4fd('0x28');return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')]('VERBOSE\x20\x22%s\x22',_0x5be8c0));};AGIChannel['prototype'][_0xa4fd('0x29')]=function(_0x185cae,_0x191f3c){if(_[_0xa4fd('0x2a')](_0x191f3c)){return this['sendRequest'](util[_0xa4fd('0x26')]('EXEC\x20%s\x20%s',_0x185cae,_0x191f3c['join'](',')));}return this[_0xa4fd('0x21')](util['format'](_0xa4fd('0x2b'),_0x185cae,_0x191f3c));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x2c')]=function(_0x4912fa){return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x2d'),_0x4912fa));};AGIChannel[_0xa4fd('0x20')]['setExtension']=function(_0x328324){return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x2e'),_0x328324));};AGIChannel['prototype'][_0xa4fd('0x2f')]=function(_0x13b31b){return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x30'),_0x13b31b));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0xa')]=function(){return this[_0xa4fd('0x21')](_0xa4fd('0x31'));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x32')]=function(_0x247cbb,_0x107f76){var _0x401844=_[_0xa4fd('0x33')](_0x107f76)||_['isNumber'](_0x107f76)?_0x107f76[_0xa4fd('0x34')]():_0x107f76;return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x35'),_0x247cbb,_0x401844?_0x401844[_0xa4fd('0x34')]()[_0xa4fd('0x36')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x37')]=function(_0x474ce4,_0x41c053){return this[_0xa4fd('0x21')](util['format'](_0xa4fd('0x38'),_0x474ce4,_0x41c053));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x39')]=function(_0x87ad6e,_0x34b1ed){return this['sendRequest'](util[_0xa4fd('0x26')](_0xa4fd('0x3a'),_0x87ad6e,_0x34b1ed));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x3b')]=function(_0x4fd733,_0x76efd9){return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x4fd733,_0x76efd9));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x3c')]=function(_0x4e701a,_0x229836,_0x5a8c54){_0x229836=_0x229836||this[_0xa4fd('0x3d')];_0x5a8c54=_0x5a8c54||0x1;this[_0xa4fd('0x2c')](_0x4e701a);this[_0xa4fd('0x3e')](_0x229836);this[_0xa4fd('0x2f')](_0x5a8c54);return this['noop'](util[_0xa4fd('0x26')](_0xa4fd('0x3f'),_0x4e701a,_0x229836,_0x5a8c54));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x40')]=function(_0xe5e90){return this['sendRequest'](util[_0xa4fd('0x26')](_0xa4fd('0x41'),_0xe5e90));};AGIChannel['prototype'][_0xa4fd('0x42')]=function(_0x56015d,_0x2b4461,_0x2a0342,_0x28c94d,_0x12ba9d,_0x3d7354){_0x2b4461=_0x2b4461||_0xa4fd('0x43');_0x2a0342=_0x2a0342||'';_0x28c94d=_0x28c94d===undefined?-0x1:_0x28c94d==='-1'?-0x1:_0x28c94d*0x3e8;_0x12ba9d=_0x12ba9d===undefined?'':'s='+_0x12ba9d;_0x3d7354=_0x3d7354?_0xa4fd('0x44'):'';return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x45'),_0x56015d,_0x2b4461,_0x2a0342,_0x28c94d,_0x3d7354,_0x12ba9d));};AGIChannel[_0xa4fd('0x20')]['streamFile']=function(_0x5f2078,_0x35b524){_0x35b524=_0x35b524||'';return this[_0xa4fd('0x21')](util[_0xa4fd('0x26')](_0xa4fd('0x46'),_0x5f2078,_0x35b524));};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x47')]=function(_0x30dcea){return this[_0xa4fd('0x29')](_0xa4fd('0x48'),_0x30dcea);};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x49')]=function(_0x4480e9){return this[_0xa4fd('0x29')]('WAIT',_0x4480e9);};AGIChannel[_0xa4fd('0x20')][_0xa4fd('0x15')]=function(_0x16e1b9,_0x2fd161){this[_0xa4fd('0x4a')](util[_0xa4fd('0x26')](_0xa4fd('0x4b'),_0x16e1b9['id'],_0x16e1b9[_0xa4fd('0x4c')],_0x2fd161));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0xb3a4=['startsWith','length','error','E_AGI_SOCKET_ERROR','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','answer','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setExtension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','events','EventEmitter','./error','setEncoding','utf8','setTimeout','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xb3a4,0x77));var _0x4b3a=function(_0x211f75,_0x4ba6ae){_0x211f75=_0x211f75-0x0;var _0x51f5b6=_0xb3a4[_0x211f75];return _0x51f5b6;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x4b3a('0x0'))[_0x4b3a('0x1')];var AGIReply=require('./reply');var AGIError=require(_0x4b3a('0x2'));function AGIChannel(_0x229ab0){var _0x44d691=this,_0x11a96e=new AGIReply(),_0x51814a=![],_0x29eb4d={};EventEmitter['call'](_0x44d691);_0x229ab0[_0x4b3a('0x3')](_0x4b3a('0x4'));_0x229ab0[_0x4b3a('0x5')](0x8*0x3c*0x3c*0x3e8);_0x11a96e['setEncoding'](_0x4b3a('0x4'));_0x11a96e['on'](_0x4b3a('0x6'),function(_0x39f1cf){for(var _0x3688f2 in _0x39f1cf){_0x44d691[_0x3688f2]=_0x39f1cf[_0x3688f2];}_0x44d691[_0x4b3a('0x7')](_0x4b3a('0x8'));});_0x11a96e['on'](_0x4b3a('0x9'),function(_0x27962b){if(_0x27962b[_0x4b3a('0xa')]()==_0x4b3a('0xb')){_0x44d691['emit'](_0x4b3a('0xb'));return;}if(_0x27962b[_0x4b3a('0xc')](0x0,0xb)==_0x4b3a('0xd')){_0x51814a=!![];}if(_0x51814a){_0x29eb4d['rx']+=_0x27962b+'\x0a';if(_0x27962b[_0x4b3a('0xe')](_0x4b3a('0xf'))!=-0x1){_0x51814a=![];}}else{_0x29eb4d['rx']=_0x27962b;}if(_0x51814a){return;}if(typeof _0x29eb4d['cb']==_0x4b3a('0x10')){var _0x247ddf=_0x29eb4d['rx'][_0x4b3a('0xc')](0x0,0x3),_0x34b950=null,_0x446cb7=null;_0x247ddf=parseInt(_0x247ddf);if(isNaN(_0x247ddf)){_0x29eb4d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x247ddf!=0xc8){_0x29eb4d['cb'](null,{'code':_0x247ddf,'result':-0x1,'extra':'KO'});return;}_0x34b950=_0x29eb4d['rx']['substring'](0x4)[_0x4b3a('0x11')](_0x4b3a('0x12'),'');if(_0x34b950[_0x4b3a('0x13')]('\x20')!=-0x1){_0x34b950=_0x34b950[_0x4b3a('0x14')](0x0,_0x34b950[_0x4b3a('0x13')]('\x20'));}if(_[_0x4b3a('0x15')](_0x34b950,'-1')){_0x34b950=parseInt(_0x34b950);}_0x446cb7=_0x29eb4d['rx']['split']('\x20');if(_0x446cb7[_0x4b3a('0x16')]==0x3){_0x446cb7=_0x446cb7[0x2]['substring'](0x1,_0x446cb7[0x2]['length']-0x1);}else if(_0x446cb7[_0x4b3a('0x16')]>0x3){var _0x40c443=/\((.+)\)/;var _0x403d05=_0x29eb4d['rx']['match'](_0x40c443);if(_0x403d05){_0x446cb7=_0x403d05[0x1];}else{_0x446cb7=null;}}else{_0x446cb7=null;}_0x29eb4d['cb'](null,{'code':_0x247ddf,'result':_0x34b950,'extra':_0x446cb7});}});_0x229ab0['on'](_0x4b3a('0x17'),function(_0x59d1b2){_0x44d691[_0x4b3a('0x7')](_0x4b3a('0x17'),new AGIError(_0x4b3a('0x18'),_0x59d1b2['code']));});_0x229ab0['on']('close',function(){_0x44d691['emit']('close',new AGIError(_0x4b3a('0x19')));});_0x229ab0['on'](_0x4b3a('0x1a'),function(){_0x44d691[_0x4b3a('0x7')]('timeout',new AGIError(_0x4b3a('0x1b')));_0x229ab0[_0x4b3a('0x1c')]();});_0x229ab0[_0x4b3a('0x1d')](_0x11a96e);this[_0x4b3a('0x1e')]=function(_0x2ae9c2,_0x30d794){var _0x2ae9c2=_0x2ae9c2||'',_0x30d794=typeof _0x30d794=='function'?_0x30d794:new Function();_0x29eb4d={'tx':_0x2ae9c2,'rx':'','cb':_0x30d794};_0x229ab0[_0x4b3a('0x1f')](_0x2ae9c2+'\x0a');},this['close']=function(){_0x229ab0[_0x4b3a('0x1c')]();};}util[_0x4b3a('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x22')]=function(_0x5dfacf){return this[_0x4b3a('0x1e')]['sync'](this,_0x5dfacf);};AGIChannel['prototype'][_0x4b3a('0x23')]=function(){return this[_0x4b3a('0x22')]('ANSWER');};AGIChannel['prototype']['getData']=function(_0x4ab600,_0x504858,_0x4892ea){_0x4ab600=_0x4ab600===undefined?_0x4b3a('0x24'):_0x4ab600;_0x504858=_0x504858===undefined?'5':_0x504858;_0x4892ea=_0x4892ea===undefined?'1':_0x4892ea;return this['sendRequest'](util[_0x4b3a('0x25')](_0x4b3a('0x26'),_0x4ab600,_0x504858*0x3e8,_0x4892ea));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x27')]=function(_0x538f6b){_0x538f6b=_0x538f6b||_0x4b3a('0x28');return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')](_0x4b3a('0x29'),_0x538f6b));};AGIChannel['prototype'][_0x4b3a('0x2a')]=function(_0x50e31b,_0x174424){if(_[_0x4b3a('0x2b')](_0x174424)){return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')](_0x4b3a('0x2c'),_0x50e31b,_0x174424[_0x4b3a('0x2d')](',')));}return this[_0x4b3a('0x22')](util['format'](_0x4b3a('0x2c'),_0x50e31b,_0x174424));};AGIChannel['prototype'][_0x4b3a('0x2e')]=function(_0x37b54a){return this[_0x4b3a('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x37b54a));};AGIChannel[_0x4b3a('0x21')]['setExtension']=function(_0x2b4ab1){return this[_0x4b3a('0x22')](util['format'](_0x4b3a('0x2f'),_0x2b4ab1));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x30')]=function(_0x2afcab){return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')](_0x4b3a('0x31'),_0x2afcab));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0xb')]=function(){return this[_0x4b3a('0x22')](_0x4b3a('0x32'));};AGIChannel['prototype'][_0x4b3a('0x33')]=function(_0x1967d4,_0x1f3180){var _0x32f8d8=_['isBoolean'](_0x1f3180)||_[_0x4b3a('0x34')](_0x1f3180)?_0x1f3180[_0x4b3a('0x35')]():_0x1f3180;return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x1967d4,_0x32f8d8?_0x32f8d8[_0x4b3a('0x35')]()[_0x4b3a('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype']['sayNumber']=function(_0x57db3e,_0x125fda){return this['sendRequest'](util[_0x4b3a('0x25')]('SAY\x20NUMBER\x20%s\x20%s',_0x57db3e,_0x125fda));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x36')]=function(_0x497995,_0x275429){return this['sendRequest'](util[_0x4b3a('0x25')](_0x4b3a('0x37'),_0x497995,_0x275429));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x38')]=function(_0x9c3dd,_0x3bc552){return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')](_0x4b3a('0x39'),_0x9c3dd,_0x3bc552));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x3a')]=function(_0x1af7bf,_0x306beb,_0x1d44bd){_0x306beb=_0x306beb||this['extension'];_0x1d44bd=_0x1d44bd||0x1;this[_0x4b3a('0x2e')](_0x1af7bf);this[_0x4b3a('0x3b')](_0x306beb);this[_0x4b3a('0x30')](_0x1d44bd);return this[_0x4b3a('0x27')](util[_0x4b3a('0x25')]('GOTO\x20%s\x20%s\x20%s',_0x1af7bf,_0x306beb,_0x1d44bd));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x3c')]=function(_0x532d7c){return this['sendRequest'](util[_0x4b3a('0x25')](_0x4b3a('0x3d'),_0x532d7c));};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x3e')]=function(_0x208436,_0x1f7d10,_0x1db2f4,_0x273eb0,_0x461a73,_0x4b1e42){_0x1f7d10=_0x1f7d10||'wav';_0x1db2f4=_0x1db2f4||'';_0x273eb0=_0x273eb0===undefined?-0x1:_0x273eb0==='-1'?-0x1:_0x273eb0*0x3e8;_0x461a73=_0x461a73===undefined?'':'s='+_0x461a73;_0x4b1e42=_0x4b1e42?_0x4b3a('0x3f'):'';return this[_0x4b3a('0x22')](util[_0x4b3a('0x25')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x208436,_0x1f7d10,_0x1db2f4,_0x273eb0,_0x4b1e42,_0x461a73));};AGIChannel[_0x4b3a('0x21')]['streamFile']=function(_0x797572,_0x17125c){_0x17125c=_0x17125c||'';return this['sendRequest'](util[_0x4b3a('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x797572,_0x17125c));};AGIChannel['prototype']['agi']=function(_0x2a6d3a){return this['exec'](_0x4b3a('0x40'),_0x2a6d3a);};AGIChannel[_0x4b3a('0x21')][_0x4b3a('0x41')]=function(_0x236402){return this[_0x4b3a('0x2a')](_0x4b3a('0x42'),_0x236402);};AGIChannel[_0x4b3a('0x21')]['error']=function(_0x2399fe,_0x42003e){this[_0x4b3a('0x27')](util[_0x4b3a('0x25')](_0x4b3a('0x43'),_0x2399fe['id'],_0x2399fe[_0x4b3a('0x44')],_0x42003e));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b3a('0x45')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 0394b08..5526dec 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 _0x3072=['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.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','message','name','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3072,0x99));var _0x2307=function(_0x5717d0,_0x53aab0){_0x5717d0=_0x5717d0-0x0;var _0xd920cf=_0x3072[_0x5717d0];return _0xd920cf;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x2307('0x0'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x2307('0x1'),'E_AGI_SERVER_CLOSE':_0x2307('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x2307('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x2307('0x4'),'E_AGI_SOCKET_ERROR':_0x2307('0x5'),'E_AGI_SOCKET_CLOSE':_0x2307('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x2307('0x7'),'E_AGI_COMMAND_EMPTY':_0x2307('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x2307('0x9'),'E_AGI_IVR_ENTRY':_0x2307('0xa')};function AGIError(_0x2c825b){var _0x2c825b=_0x2c825b||null,_0x258661=_0x258661||[],_0x213468=0x1,_0x1ea232='';if(!error[_0x2c825b]){_0x2c825b=_0x2307('0xb');}_0x258661['push'](error[_0x2c825b]);while(arguments[_0x213468]){_0x258661[_0x2307('0xc')](arguments[_0x213468]);_0x213468++;}_0x1ea232=util[_0x2307('0xd')]['apply'](util,_0x258661);this[_0x2307('0xe')]=_0x1ea232;this[_0x2307('0xf')]=_0x2c825b;}module[_0x2307('0x10')]=AGIError; \ No newline at end of file +var _0x2c77=['Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Empty\x20command.'];(function(_0x11ba83,_0xd5611a){var _0x3f3925=function(_0x3d7cb0){while(--_0x3d7cb0){_0x11ba83['push'](_0x11ba83['shift']());}};_0x3f3925(++_0xd5611a);}(_0x2c77,0x1e7));var _0x72c7=function(_0x3182f5,_0x483b18){_0x3182f5=_0x3182f5-0x0;var _0x1c92d7=_0x2c77[_0x3182f5];return _0x1c92d7;};'use strict';var util=require(_0x72c7('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x72c7('0x1'),'E_AGI_SERVER_ERROR':_0x72c7('0x2'),'E_AGI_SERVER_CLOSE':_0x72c7('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x72c7('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x72c7('0x5'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x72c7('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x72c7('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x72c7('0x8')};function AGIError(_0x329a0b){var _0x329a0b=_0x329a0b||null,_0x781d7f=_0x781d7f||[],_0x10bdd9=0x1,_0x4bebb9='';if(!error[_0x329a0b]){_0x329a0b=_0x72c7('0x9');}_0x781d7f['push'](error[_0x329a0b]);while(arguments[_0x10bdd9]){_0x781d7f[_0x72c7('0xa')](arguments[_0x10bdd9]);_0x10bdd9++;}_0x4bebb9=util['format'][_0x72c7('0xb')](util,_0x781d7f);this[_0x72c7('0xc')]=_0x4bebb9;this[_0x72c7('0xd')]=_0x329a0b;}module[_0x72c7('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 43f8f16..d409d9a 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 _0x12f9=['subscribe','agi','emit','E_AGI_SERVER_ERROR','projectUpdate','error','EventEmitter','./error','../../config/environment','redis'];(function(_0x12810c,_0x3bd5db){var _0x352e66=function(_0x3f0a74){while(--_0x3f0a74){_0x12810c['push'](_0x12810c['shift']());}};_0x352e66(++_0x3bd5db);}(_0x12f9,0x114));var _0x912f=function(_0x29fddd,_0x5c5a80){_0x29fddd=_0x29fddd-0x0;var _0x462bbd=_0x12f9[_0x29fddd];return _0x462bbd;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x912f('0x0')];var Redis=require('ioredis');var AGIError=require(_0x912f('0x1'));var config=require(_0x912f('0x2'));config[_0x912f('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x912f('0x3')]);sub[_0x912f('0x4')](_0x912f('0x5'),function(_0x55da9a){if(_0x55da9a)return eventEmitter[_0x912f('0x6')]('error',new AGIError(_0x912f('0x7'),_0x55da9a));});sub['on']('message',function(_0x3a09de,_0x3ca6fb){if(_0x3a09de!=='agi')return;try{var _0xaa1537=JSON['parse'](_0x3ca6fb);eventEmitter[_0x912f('0x6')](_0x912f('0x8'),_0xaa1537);}catch(_0x11e993){eventEmitter[_0x912f('0x6')](_0x912f('0x9'),new AGIError(_0x912f('0x7'),_0x11e993));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xe6db=['error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','EventEmitter','ioredis','./error','../../config/environment','redis','subscribe','agi','emit'];(function(_0x2c4ce7,_0x480539){var _0x28be47=function(_0x10a478){while(--_0x10a478){_0x2c4ce7['push'](_0x2c4ce7['shift']());}};_0x28be47(++_0x480539);}(_0xe6db,0x171));var _0xbe6d=function(_0x1e7cb1,_0x3efb28){_0x1e7cb1=_0x1e7cb1-0x0;var _0xd5681=_0xe6db[_0x1e7cb1];return _0xd5681;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0xbe6d('0x0')];var Redis=require(_0xbe6d('0x1'));var AGIError=require(_0xbe6d('0x2'));var config=require(_0xbe6d('0x3'));config[_0xbe6d('0x4')]=_['defaults'](config[_0xbe6d('0x4')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xbe6d('0x4')]);sub[_0xbe6d('0x5')](_0xbe6d('0x6'),function(_0x423c0d){if(_0x423c0d)return eventEmitter[_0xbe6d('0x7')](_0xbe6d('0x8'),new AGIError(_0xbe6d('0x9'),_0x423c0d));});sub['on'](_0xbe6d('0xa'),function(_0x19dd35,_0x55cc01){if(_0x19dd35!=='agi')return;try{var _0x41b850=JSON[_0xbe6d('0xb')](_0x55cc01);eventEmitter[_0xbe6d('0x7')](_0xbe6d('0xc'),_0x41b850);}catch(_0x5044d5){eventEmitter[_0xbe6d('0x7')](_0xbe6d('0x8'),new AGIError(_0xbe6d('0x9'),_0x5044d5));}});module['exports']={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5824ffe..2076c6a 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 _0x323d=['max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','numberOfEdges','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','agicommand','vswitch','default','target','invalid','includes'];(function(_0x4647e0,_0x5770f8){var _0x431b9a=function(_0x1ca993){while(--_0x1ca993){_0x4647e0['push'](_0x4647e0['shift']());}};_0x431b9a(++_0x5770f8);}(_0x323d,0x1f0));var _0xd323=function(_0x4012b0,_0x1a6169){_0x4012b0=_0x4012b0-0x0;var _0x43ac67=_0x323d[_0x4012b0];return _0x43ac67;};'use strict';var _=require(_0xd323('0x0'));var logger=require(_0xd323('0x1'))(_0xd323('0x2'));var verticesWithRetry=[_0xd323('0x3'),_0xd323('0x4'),_0xd323('0x5')];var Graph=function(){this[_0xd323('0x6')]={};this[_0xd323('0x7')]={};this['numberOfEdges']=0x0;};Graph[_0xd323('0x8')][_0xd323('0x9')]=function(_0x356802){this[_0xd323('0x6')][_0x356802['id']]=_0x356802;this[_0xd323('0x7')][_0x356802['id']]=[];};Graph[_0xd323('0x8')]['addEdge']=function(_0x103048,_0x5e6157,_0x2b1ed3){this[_0xd323('0x7')][_0x103048]['push']({'target':_0x5e6157,'condition':_0x2b1ed3});this[_0xd323('0xa')]+=0x1;};Graph[_0xd323('0x8')][_0xd323('0xb')]=function(){return _[_0xd323('0xb')](this[_0xd323('0x6')]);};Graph['prototype'][_0xd323('0xc')]=function(){return this['numberOfEdges'];};Graph[_0xd323('0x8')][_0xd323('0xd')]=function(_0x2eacb5){return this[_0xd323('0x6')][_0x2eacb5];};Graph[_0xd323('0x8')][_0xd323('0xe')]=function(_0x4d1e61,_0x1ec0fe){if(!this['vertices'][_0x4d1e61]){return logger[_0xd323('0xf')](_0xd323('0x10'));}var _0x538330=_0x1ec0fe(this['vertices'][_0x4d1e61]);if(!_0x538330){return logger[_0xd323('0xf')](_0xd323('0x11'));}if(this[_0xd323('0x7')][_0x4d1e61][_0xd323('0x12')]===0x0){return logger['info'](_0xd323('0x13'));}for(var _0x3f1682=0x0,_0x47ce91=[],_0x54716e=![];_0x3f1682\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','hasOwnProperty','indexOf','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','find','production','initialize','voice','callysquare'];(function(_0x28a91b,_0x47acb5){var _0x39a46c=function(_0x412b60){while(--_0x412b60){_0x28a91b['push'](_0x28a91b['shift']());}};_0x39a46c(++_0x47acb5);}(_0x5145,0x1ac));var _0x5514=function(_0x922c24,_0x149ee1){_0x922c24=_0x922c24-0x0;var _0x2590b7=_0x5145[_0x922c24];return _0x2590b7;};'use strict';var _=require(_0x5514('0x0'));var syncho=require(_0x5514('0x1'));var util=require(_0x5514('0x2'));var config=require(_0x5514('0x3'));var logger=require(_0x5514('0x4'))(_0x5514('0x5'));var utilLicense=require(_0x5514('0x6'));var rpc=require('./rpc');var Project=require(_0x5514('0x7'));var AGIEmitter=require(_0x5514('0x8'))['EventEmitter'];var projects=[];config[_0x5514('0x5')]=_[_0x5514('0x9')](config[_0x5514('0x5')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x5514('0xa'),projectUpdateHandler);function connectionHandler(_0x42006c){process[_0x5514('0xb')](function(){syncho(function(){try{setChannelVariables(_0x42006c);agiHandler(_0x42006c);}catch(_0xb12cc6){logger['error'](_0xb12cc6['stack']);}});});}function projectUpdateHandler(_0x29d0f0){try{var _0x4efa20=_[_0x5514('0xc')](projects,['id',_0x29d0f0['id']]);if(_0x4efa20>-0x1){if(_0x29d0f0[_0x5514('0xd')]===!![]){projects[_0x5514('0xe')](_0x4efa20,0x1);}else{projects[_0x4efa20]=_0x29d0f0;}}else{projects[_0x5514('0xf')](_0x29d0f0);}}catch(_0x1d22ea){logger[_0x5514('0x10')](_0x1d22ea[_0x5514('0x11')]);}}function listeningHandler(){console[_0x5514('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5514('0x5')][_0x5514('0x13')]);logger[_0x5514('0x14')](util[_0x5514('0x15')](_0x5514('0x16'),config[_0x5514('0x5')]['ip'],config[_0x5514('0x5')][_0x5514('0x13')]));}function errorHandler(_0x19f9d9){if(_0x19f9d9&&_0x19f9d9[_0x5514('0x17')]&&_0x19f9d9[_0x5514('0x18')]){logger[_0x5514('0x10')](util[_0x5514('0x15')](_0x5514('0x19'),_0x19f9d9[_0x5514('0x17')],_0x19f9d9[_0x5514('0x18')]));}else{logger[_0x5514('0x10')](util['format'](_0x5514('0x1a'),_0x19f9d9['stack']));}}function closeHandler(){logger[_0x5514('0x14')](util[_0x5514('0x15')](_0x5514('0x1b'),this[_0x5514('0x1c')],this[_0x5514('0x1d')],this[_0x5514('0x1e')],this['dnid'],this[_0x5514('0x1f')]));try{createSquareReport(this);}catch(_0x4f39a1){logger['error'](_0x4f39a1['stack']);}}function timeoutHandler(){logger[_0x5514('0x14')](util[_0x5514('0x15')](_0x5514('0x20'),this[_0x5514('0x1c')],this[_0x5514('0x1d')],this[_0x5514('0x1e')],this[_0x5514('0x21')],this[_0x5514('0x1f')]));}function hangupHandler(){logger[_0x5514('0x14')](util[_0x5514('0x15')](_0x5514('0x22'),this[_0x5514('0x1c')],this[_0x5514('0x1d')],this['callerid'],this[_0x5514('0x21')],this[_0x5514('0x1f')]));this[_0x5514('0x23')]=!![];}function createSquareReport(_0x2bf01d,_0x45a0b4){rpc[_0x5514('0x24')](_0x2bf01d)[_0x5514('0x25')](function(_0x40158d){if(_0x45a0b4){_0x45a0b4(null,_0x40158d);}})['catch'](function(_0x11a0e4){if(_0x45a0b4){_0x45a0b4(null,_0x11a0e4);}});}function setChannelVariables(_0x21fb8d){for(var _0x73fe3 in _0x21fb8d){if(_0x21fb8d[_0x5514('0x26')](_0x73fe3)){if(_0x73fe3[_0x5514('0x27')](_0x5514('0x28'))===0x0){_0x21fb8d[_0x73fe3['substring'](0x4)]=_0x21fb8d[_0x73fe3];delete _0x21fb8d[_0x73fe3];}}}}function agiHandler(_0x4b79e5){logger[_0x5514('0x29')](_0x5514('0x2a'),JSON[_0x5514('0x2b')](_0x4b79e5,null,0x2));logger[_0x5514('0x14')](util['format'](_0x5514('0x2c'),_0x4b79e5[_0x5514('0x1c')],_0x4b79e5[_0x5514('0x1d')],_0x4b79e5[_0x5514('0x1e')],_0x4b79e5[_0x5514('0x21')],_0x4b79e5[_0x5514('0x1f')]));_0x4b79e5['on']('error',errorHandler);_0x4b79e5['on'](_0x5514('0x2d'),closeHandler);_0x4b79e5['on'](_0x5514('0x2e'),timeoutHandler);_0x4b79e5[_0x5514('0x23')]=![];_0x4b79e5['on']('hangup',hangupHandler);var _0x4ebbc3=_[_0x5514('0x2f')](projects,[_0x5514('0x17'),_0x4b79e5[_0x5514('0x1c')]]);if(!_0x4ebbc3)return Project['handleNotFound'](_0x4b79e5);if(!_0x4ebbc3[_0x5514('0x30')])return Project['handleUnpublished'](_0x4b79e5);return Project[_0x5514('0x31')](_0x4ebbc3,_0x4b79e5);}function main(){var _0xb2a37e;return utilLicense['getLicense']()[_0x5514('0x25')](function(_0x2521f7){if(!_0x2521f7)return;if(_0x2521f7[_0x5514('0x32')]){if(_0x2521f7[_0x5514('0x33')]&&_0x2521f7[_0x5514('0x33')]>0x0){logger[_0x5514('0x14')](util[_0x5514('0x15')](_0x5514('0x34'),_0x2521f7[_0x5514('0x33')]));_0xb2a37e=_0x2521f7[_0x5514('0x33')];}else{logger[_0x5514('0x14')](_0x5514('0x35'));}}else{logger[_0x5514('0x14')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0xb2a37e=-0x1;}})[_0x5514('0x25')](function(){return Project['getAll']();})['then'](function(_0x270e83){projects=_0x270e83;return;})[_0x5514('0x36')](function(_0x33a90b){logger[_0x5514('0x10')](_0x5514('0x37'),_0x33a90b['stack']);})[_0x5514('0x38')](function(){var _0x5dab9b=require(_0x5514('0x39'))(config[_0x5514('0x5')][_0x5514('0x13')],config[_0x5514('0x5')]['ip'],_0xb2a37e);_0x5dab9b['on']('error',errorHandler);_0x5dab9b['on'](_0x5514('0x3a'),listeningHandler);_0x5dab9b['on'](_0x5514('0x3b'),connectionHandler);_0x5dab9b['on'](_0x5514('0x2d'),closeHandler);});}main(); \ No newline at end of file +var _0xba36=['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','then','catch','hasOwnProperty','agi_','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','name','production','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','listening','connection','syncho','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','projectUpdate','stack','findIndex','deleted','splice','error','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','message','format','[%s]\x20%s','[ERROR]\x20%s'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0xba36,0x162));var _0x6ba3=function(_0x4e05fc,_0x19ab18){_0x4e05fc=_0x4e05fc-0x0;var _0x5df9f5=_0xba36[_0x4e05fc];return _0x5df9f5;};'use strict';var _=require('lodash');var syncho=require(_0x6ba3('0x0'));var util=require('util');var config=require(_0x6ba3('0x1'));var logger=require(_0x6ba3('0x2'))(_0x6ba3('0x3'));var utilLicense=require(_0x6ba3('0x4'));var rpc=require(_0x6ba3('0x5'));var Project=require('./project');var AGIEmitter=require(_0x6ba3('0x6'))[_0x6ba3('0x7')];var projects=[];config[_0x6ba3('0x3')]=_[_0x6ba3('0x8')](config[_0x6ba3('0x3')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x6ba3('0x9'),projectUpdateHandler);function connectionHandler(_0x1874b3){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x1874b3);agiHandler(_0x1874b3);}catch(_0x544d79){logger['error'](_0x544d79[_0x6ba3('0xa')]);}});});}function projectUpdateHandler(_0x2bf94a){try{var _0x192274=_[_0x6ba3('0xb')](projects,['id',_0x2bf94a['id']]);if(_0x192274>-0x1){if(_0x2bf94a[_0x6ba3('0xc')]===!![]){projects[_0x6ba3('0xd')](_0x192274,0x1);}else{projects[_0x192274]=_0x2bf94a;}}else{projects['push'](_0x2bf94a);}}catch(_0xb6b44f){logger[_0x6ba3('0xe')](_0xb6b44f[_0x6ba3('0xa')]);}}function listeningHandler(){console[_0x6ba3('0xf')](_0x6ba3('0x10'),config[_0x6ba3('0x3')][_0x6ba3('0x11')]);logger[_0x6ba3('0x12')](util['format'](_0x6ba3('0x13'),config[_0x6ba3('0x3')]['ip'],config[_0x6ba3('0x3')][_0x6ba3('0x11')]));}function errorHandler(_0x234d92){if(_0x234d92&&_0x234d92['name']&&_0x234d92[_0x6ba3('0x14')]){logger[_0x6ba3('0xe')](util[_0x6ba3('0x15')](_0x6ba3('0x16'),_0x234d92['name'],_0x234d92[_0x6ba3('0x14')]));}else{logger['error'](util[_0x6ba3('0x15')](_0x6ba3('0x17'),_0x234d92[_0x6ba3('0xa')]));}}function closeHandler(){logger[_0x6ba3('0x12')](util[_0x6ba3('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x6ba3('0x18')],this['calleridname'],this[_0x6ba3('0x19')],this[_0x6ba3('0x1a')],this[_0x6ba3('0x1b')]));try{createSquareReport(this);}catch(_0x1fd123){logger[_0x6ba3('0xe')](_0x1fd123[_0x6ba3('0xa')]);}}function timeoutHandler(){logger['info'](util[_0x6ba3('0x15')](_0x6ba3('0x1c'),this[_0x6ba3('0x18')],this[_0x6ba3('0x1d')],this[_0x6ba3('0x19')],this[_0x6ba3('0x1a')],this[_0x6ba3('0x1b')]));}function hangupHandler(){logger[_0x6ba3('0x12')](util[_0x6ba3('0x15')](_0x6ba3('0x1e'),this[_0x6ba3('0x18')],this['calleridname'],this['callerid'],this[_0x6ba3('0x1a')],this[_0x6ba3('0x1b')]));this[_0x6ba3('0x1f')]=!![];}function createSquareReport(_0x2eea9e,_0x2a5b25){rpc[_0x6ba3('0x20')](_0x2eea9e)[_0x6ba3('0x21')](function(_0xa12670){if(_0x2a5b25){_0x2a5b25(null,_0xa12670);}})[_0x6ba3('0x22')](function(_0x20011d){if(_0x2a5b25){_0x2a5b25(null,_0x20011d);}});}function setChannelVariables(_0x55d2f5){for(var _0x92bfd5 in _0x55d2f5){if(_0x55d2f5[_0x6ba3('0x23')](_0x92bfd5)){if(_0x92bfd5['indexOf'](_0x6ba3('0x24'))===0x0){_0x55d2f5[_0x92bfd5[_0x6ba3('0x25')](0x4)]=_0x55d2f5[_0x92bfd5];delete _0x55d2f5[_0x92bfd5];}}}}function agiHandler(_0x1fae9f){logger[_0x6ba3('0x26')](_0x6ba3('0x27'),JSON['stringify'](_0x1fae9f,null,0x2));logger[_0x6ba3('0x12')](util[_0x6ba3('0x15')](_0x6ba3('0x28'),_0x1fae9f[_0x6ba3('0x18')],_0x1fae9f[_0x6ba3('0x1d')],_0x1fae9f[_0x6ba3('0x19')],_0x1fae9f[_0x6ba3('0x1a')],_0x1fae9f[_0x6ba3('0x1b')]));_0x1fae9f['on']('error',errorHandler);_0x1fae9f['on']('close',closeHandler);_0x1fae9f['on'](_0x6ba3('0x29'),timeoutHandler);_0x1fae9f[_0x6ba3('0x1f')]=![];_0x1fae9f['on']('hangup',hangupHandler);var _0x1d1577=_['find'](projects,[_0x6ba3('0x2a'),_0x1fae9f[_0x6ba3('0x18')]]);if(!_0x1d1577)return Project['handleNotFound'](_0x1fae9f);if(!_0x1d1577[_0x6ba3('0x2b')])return Project['handleUnpublished'](_0x1fae9f);return Project['initialize'](_0x1d1577,_0x1fae9f);}function main(){var _0x448fb9;return utilLicense['getLicense']()['then'](function(_0x2b8167){if(!_0x2b8167)return;if(_0x2b8167[_0x6ba3('0x2c')]){if(_0x2b8167[_0x6ba3('0x2d')]&&_0x2b8167[_0x6ba3('0x2d')]>0x0){logger['info'](util[_0x6ba3('0x15')](_0x6ba3('0x2e'),_0x2b8167[_0x6ba3('0x2d')]));_0x448fb9=_0x2b8167[_0x6ba3('0x2d')];}else{logger[_0x6ba3('0x12')](_0x6ba3('0x2f'));}}else{logger['info'](_0x6ba3('0x30'));_0x448fb9=-0x1;}})['then'](function(){return Project[_0x6ba3('0x31')]();})[_0x6ba3('0x21')](function(_0x37bf03){projects=_0x37bf03;return;})[_0x6ba3('0x22')](function(_0x41eba8){logger['error'](_0x6ba3('0x32'),_0x41eba8[_0x6ba3('0xa')]);})[_0x6ba3('0x33')](function(){var _0x3ade43=require('./server')(config['agi'][_0x6ba3('0x11')],config['agi']['ip'],_0x448fb9);_0x3ade43['on'](_0x6ba3('0xe'),errorHandler);_0x3ade43['on'](_0x6ba3('0x34'),listeningHandler);_0x3ade43['on'](_0x6ba3('0x35'),connectionHandler);_0x3ade43['on']('close',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 593bdfc..865aa0b 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 _0xdb11=['error','catch','SendMail','jayson/promise','client','http','request'];(function(_0x3888eb,_0x491f7d){var _0x15a319=function(_0x56f4b0){while(--_0x56f4b0){_0x3888eb['push'](_0x3888eb['shift']());}};_0x15a319(++_0x491f7d);}(_0xdb11,0x1b5));var _0x1db1=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0xdb11[_0xaa0309];return _0x5de7ce;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1db1('0x0'));var client=jayson[_0x1db1('0x1')][_0x1db1('0x2')]({'port':0x232b});function request(_0x54c9da,_0x18240c){return new BPromise(function(_0x3458a4,_0x57d131){return client[_0x1db1('0x3')](_0x54c9da,_0x18240c)['then'](function(_0xf255f3){if(_0xf255f3[_0x1db1('0x4')]){return _0x57d131(_0xf255f3['error']['message']);}else{return _0x3458a4(_0xf255f3['result']);}})[_0x1db1('0x5')](function(_0x3e4c0b){return _0x57d131(_0x3e4c0b);});});}exports['sendMailMessage']=function(_0x261cd2,_0x1dfc1f){return request(_0x1db1('0x6'),{'account':_0x261cd2,'message':_0x1dfc1f});}; \ No newline at end of file +var _0xf4f7=['http','request','error','message','result','sendMailMessage','SendMail'];(function(_0x36d703,_0x55b354){var _0x12c909=function(_0x5e846a){while(--_0x5e846a){_0x36d703['push'](_0x36d703['shift']());}};_0x12c909(++_0x55b354);}(_0xf4f7,0x85));var _0x7f4f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xf4f7[_0xd1d19a];return _0x52a79d;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson['client'][_0x7f4f('0x0')]({'port':0x232b});function request(_0x382d29,_0x561ba7){return new BPromise(function(_0x423d97,_0x4cef3b){return client[_0x7f4f('0x1')](_0x382d29,_0x561ba7)['then'](function(_0x61c873){if(_0x61c873[_0x7f4f('0x2')]){return _0x4cef3b(_0x61c873[_0x7f4f('0x2')][_0x7f4f('0x3')]);}else{return _0x423d97(_0x61c873[_0x7f4f('0x4')]);}})['catch'](function(_0xc8be89){return _0x4cef3b(_0xc8be89);});});}exports[_0x7f4f('0x5')]=function(_0x12a411,_0x1ba855){return request(_0x7f4f('0x6'),{'account':_0x12a411,'message':_0x1ba855});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 534a277..2caf09b 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 _0x4911=['hasOwnProperty','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','traverseBFS','clear','debug','vertex','agicommand','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','evtHangup','isUndefined','result','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','moment','xml2json','../../config/logger','agi','./mailRpc','./graph','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','retry','omit','mxCell'];(function(_0x1dbb52,_0x17df00){var _0x1a3ab7=function(_0x36e21b){while(--_0x36e21b){_0x1dbb52['push'](_0x1dbb52['shift']());}};_0x1a3ab7(++_0x17df00);}(_0x4911,0x160));var _0x1491=function(_0x184a95,_0x500731){_0x184a95=_0x184a95-0x0;var _0x55eadf=_0x4911[_0x184a95];return _0x55eadf;};'use strict';var _=require('lodash');var moment=require(_0x1491('0x0'));var parser=require(_0x1491('0x1'));var util=require('util');var logger=require(_0x1491('0x2'))(_0x1491('0x3'));var rpc=require('./rpc');var mailRpc=require(_0x1491('0x4'));var Graph=require(_0x1491('0x5'));var Vertices=require('./vertices');var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1491('0x6')]()[_0x1491('0x7')](function(_0x3b6250){logger[_0x1491('0x8')](_0x1491('0x9'),_0x3b6250[_0x1491('0xa')]);return[];});}function addVertex(_0x102996,_0x173bdb,_0x412c3b){_0x173bdb['agicommand']=_0x412c3b;if(_0x173bdb['hasOwnProperty'](_0x1491('0xb'))){_0x173bdb['maxRetry']=parseInt(_0x173bdb[_0x1491('0xb')],0xa);}_0x102996['addVertex'](_[_0x1491('0xc')](_0x173bdb,_0x1491('0xd')));}function initGraph(_0xe904e,_0x3233bc){var _0x301062=new Graph();for(var _0x56abbc in _0xe904e){if(_0xe904e[_0x1491('0xe')](_0x56abbc)){if(_[_0x1491('0xf')](_0xe904e[_0x56abbc])){for(var _0x269450=0x0;_0x269450<_0xe904e[_0x56abbc][_0x1491('0x10')];_0x269450+=0x1){addVertex(_0x301062,_0xe904e[_0x56abbc][_0x269450],_0x56abbc);}}else{addVertex(_0x301062,_0xe904e[_0x56abbc],_0x56abbc);}}}for(var _0x5666da=0x0;_0x5666da<_0x3233bc[_0x1491('0x10')];_0x5666da+=0x1){if(_0x3233bc[_0x5666da][_0x1491('0x11')]&&_0x3233bc[_0x5666da][_0x1491('0x12')]){_0x301062[_0x1491('0x13')](_0x3233bc[_0x5666da][_0x1491('0x11')],_0x3233bc[_0x5666da][_0x1491('0x12')],_0x3233bc[_0x5666da][_0x1491('0x14')]);}}return _0x301062;}function getRoot(_0x2577a6){return parser[_0x1491('0x15')](_0x2577a6,{'object':!![]})[_0x1491('0x16')]['root'];}function inspect(_0x22c806){return util[_0x1491('0x17')](_0x22c806,{'showHidden':![],'depth':null});}function initialize(_0x17c672,_0x10531f){var _0x3f27d3=getRoot(_0x17c672[_0x1491('0x18')]);if(!_0x3f27d3||!_0x3f27d3[_0x1491('0x19')])return;var _0x1ef9be,_0xe7659e,_0x30508b;logger['debug'](_0x1491('0x1a'),JSON[_0x1491('0x1b')](_0x3f27d3,null,0x2));_0x10531f[_0x1491('0x1c')]=moment()[_0x1491('0x1d')](_0x1491('0x1e'));_0x1ef9be=initGraph(_[_0x1491('0xc')](_0x3f27d3,_0x1491('0xd')),_0x3f27d3[_0x1491('0xd')]);_0xe7659e=new Vertices(_0x10531f,rpc,mailRpc);logger['info'](util[_0x1491('0x1d')](_0x1491('0x1f'),_0x10531f[_0x1491('0x20')],_0x10531f[_0x1491('0x21')],_0x10531f[_0x1491('0x22')],_0x10531f[_0x1491('0x23')],_0x10531f[_0x1491('0x24')]));_0x1ef9be[_0x1491('0x25')](_0x3f27d3[_0x1491('0x19')]['id'],function(_0x2ea284){try{_0x2ea284=_0xe7659e[_0x1491('0x26')](_0x2ea284);logger[_0x1491('0x27')](_0x1491('0x28'),JSON[_0x1491('0x1b')](_0x2ea284,null,0x2));if(_0x2ea284[_0x1491('0x29')]==='gotoc'){logger[_0x1491('0x2a')](_0x1491('0x2b'));_0x10531f[_0x1491('0x2c')]=_0x2ea284[_0x1491('0x2c')]||_0x10531f[_0x1491('0x2c')];_0x10531f[_0x1491('0x2d')]=_0x2ea284[_0x1491('0x2d')];_0x10531f[_0x1491('0x2e')]=_0x2ea284[_0x1491('0x2e')]?_0x2ea284[_0x1491('0x2e')]-0x1:0x1;return null;}else if(_0x2ea284&&_0xe7659e[_0x2ea284[_0x1491('0x29')]]){_0x30508b=_0xe7659e[_0x2ea284[_0x1491('0x29')]](_0x2ea284);logger[_0x1491('0x2a')](_0x1491('0x2f'),JSON[_0x1491('0x1b')](_0x30508b,null,0x2));if(_0x30508b&&_0x30508b[_0x1491('0x30')]===AGI_CODE_SUCCESS&&_0x30508b['result']!==AGI_RESULT_ERROR&&!_0x10531f[_0x1491('0x31')]){logger['debug'](_0x1491('0x2f'),inspect(_0x30508b));return _[_0x1491('0x32')](_0x30508b[_0x1491('0x33')])?null:_0x30508b[_0x1491('0x33')][_0x1491('0x34')]();}else{logger[_0x1491('0x8')](_0x1491('0x2f'),inspect(_0x30508b));return null;}}else{logger[_0x1491('0x8')](_0x1491('0x35'));return null;}}catch(_0x243754){logger['error'](_0x243754[_0x1491('0xa')]);return null;}});if(_0x3f27d3['finally']){logger[_0x1491('0x2a')](util[_0x1491('0x1d')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x10531f[_0x1491('0x20')],_0x10531f[_0x1491('0x21')],_0x10531f[_0x1491('0x22')],_0x10531f[_0x1491('0x23')],_0x10531f[_0x1491('0x24')]));_0x1ef9be[_0x1491('0x25')](_0x3f27d3['finally']['id'],function(_0x515996){try{_0x515996=_0xe7659e[_0x1491('0x26')](_0x515996);logger[_0x1491('0x27')](_0x1491('0x28'),JSON[_0x1491('0x1b')](_0x515996,null,0x2));if(_0x515996&&_0xe7659e[_0x515996[_0x1491('0x29')]]){_0x30508b=_0xe7659e[_0x515996['agicommand']](_0x515996);if(_0x30508b){logger[_0x1491('0x27')](_0x1491('0x2f'),inspect(_0x30508b));return _[_0x1491('0x32')](_0x30508b['result'])?null:_0x30508b[_0x1491('0x33')]['toString']();}else{logger[_0x1491('0x8')](_0x1491('0x2f'),inspect(_0x30508b));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x10dc39){logger[_0x1491('0x8')](_0x10dc39[_0x1491('0xa')]);return null;}});}logger[_0x1491('0x2a')](util[_0x1491('0x1d')](_0x1491('0x36'),_0x10531f['arg_1'],_0x10531f[_0x1491('0x21')],_0x10531f[_0x1491('0x22')],_0x10531f[_0x1491('0x23')],_0x10531f[_0x1491('0x24')]));logger['info'](util[_0x1491('0x1d')](_0x1491('0x37'),_0x10531f[_0x1491('0x2c')],_0x10531f[_0x1491('0x2d')],parseInt(_0x10531f[_0x1491('0x2e')],0xa)+0x1));_0x10531f['continueAt'](_0x10531f[_0x1491('0x2c')],_0x10531f[_0x1491('0x2d')],parseInt(_0x10531f[_0x1491('0x2e')],0xa)+0x1);_0x10531f[_0x1491('0x38')]();}function handleNotFound(_0x4051cb){logger['error'](util[_0x1491('0x1d')](_0x1491('0x39'),_0x4051cb['arg_1']));_0x4051cb[_0x1491('0x3a')](_0x4051cb[_0x1491('0x2c')],_0x4051cb[_0x1491('0x2d')],parseInt(_0x4051cb['priority'],0xa)+0x1);_0x4051cb[_0x1491('0x38')]();}function handleUnpublished(_0x26dc07){logger[_0x1491('0x8')](util[_0x1491('0x1d')](_0x1491('0x3b'),_0x26dc07['arg_1']));_0x26dc07[_0x1491('0x3a')](_0x26dc07[_0x1491('0x2c')],_0x26dc07[_0x1491('0x2d')],parseInt(_0x26dc07[_0x1491('0x2e')],0xa)+0x1);_0x26dc07[_0x1491('0x38')]();}module[_0x1491('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x1f5b=['finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','mxGraphModel','inspect','production','start','debug','root','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','clear','vertex','agicommand','gotoc','info','context','extension','priority','response','result','evtHangup','isUndefined','toString'];(function(_0x5011da,_0x698ce0){var _0xd0cd45=function(_0x523d55){while(--_0x523d55){_0x5011da['push'](_0x5011da['shift']());}};_0xd0cd45(++_0x698ce0);}(_0x1f5b,0xc1));var _0xb1f5=function(_0x446a5f,_0x490261){_0x446a5f=_0x446a5f-0x0;var _0x3922f7=_0x1f5b[_0x446a5f];return _0x3922f7;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require('xml2json');var util=require('util');var logger=require(_0xb1f5('0x0'))(_0xb1f5('0x1'));var rpc=require(_0xb1f5('0x2'));var mailRpc=require(_0xb1f5('0x3'));var Graph=require(_0xb1f5('0x4'));var Vertices=require(_0xb1f5('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xb1f5('0x6')]()[_0xb1f5('0x7')](function(_0x33493f){logger[_0xb1f5('0x8')](_0xb1f5('0x9'),_0x33493f[_0xb1f5('0xa')]);return[];});}function addVertex(_0x7e98bc,_0x296c91,_0x4190fd){_0x296c91['agicommand']=_0x4190fd;if(_0x296c91[_0xb1f5('0xb')](_0xb1f5('0xc'))){_0x296c91[_0xb1f5('0xd')]=parseInt(_0x296c91[_0xb1f5('0xc')],0xa);}_0x7e98bc[_0xb1f5('0xe')](_[_0xb1f5('0xf')](_0x296c91,_0xb1f5('0x10')));}function initGraph(_0x4e5166,_0x373a33){var _0xc12fc9=new Graph();for(var _0x68f334 in _0x4e5166){if(_0x4e5166['hasOwnProperty'](_0x68f334)){if(_[_0xb1f5('0x11')](_0x4e5166[_0x68f334])){for(var _0x29bd58=0x0;_0x29bd58<_0x4e5166[_0x68f334]['length'];_0x29bd58+=0x1){addVertex(_0xc12fc9,_0x4e5166[_0x68f334][_0x29bd58],_0x68f334);}}else{addVertex(_0xc12fc9,_0x4e5166[_0x68f334],_0x68f334);}}}for(var _0x13908c=0x0;_0x13908c<_0x373a33[_0xb1f5('0x12')];_0x13908c+=0x1){if(_0x373a33[_0x13908c][_0xb1f5('0x13')]&&_0x373a33[_0x13908c][_0xb1f5('0x14')]){_0xc12fc9[_0xb1f5('0x15')](_0x373a33[_0x13908c][_0xb1f5('0x13')],_0x373a33[_0x13908c][_0xb1f5('0x14')],_0x373a33[_0x13908c][_0xb1f5('0x16')]);}}return _0xc12fc9;}function getRoot(_0x34c6f2){return parser[_0xb1f5('0x17')](_0x34c6f2,{'object':!![]})[_0xb1f5('0x18')]['root'];}function inspect(_0x432563){return util[_0xb1f5('0x19')](_0x432563,{'showHidden':![],'depth':null});}function initialize(_0x5c677c,_0x5cff05){var _0x3afb1a=getRoot(_0x5c677c[_0xb1f5('0x1a')]);if(!_0x3afb1a||!_0x3afb1a[_0xb1f5('0x1b')])return;var _0x4ea179,_0xd99879,_0x43e3eb;logger[_0xb1f5('0x1c')](_0xb1f5('0x1d'),JSON[_0xb1f5('0x1e')](_0x3afb1a,null,0x2));_0x5cff05[_0xb1f5('0x1f')]=moment()[_0xb1f5('0x20')](_0xb1f5('0x21'));_0x4ea179=initGraph(_[_0xb1f5('0xf')](_0x3afb1a,'mxCell'),_0x3afb1a[_0xb1f5('0x10')]);_0xd99879=new Vertices(_0x5cff05,rpc,mailRpc);logger['info'](util[_0xb1f5('0x20')](_0xb1f5('0x22'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05['calleridname'],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05['uniqueid']));_0x4ea179['traverseBFS'](_0x3afb1a['start']['id'],function(_0x1f12f6){try{_0x1f12f6=_0xd99879[_0xb1f5('0x26')](_0x1f12f6);logger[_0xb1f5('0x1c')](_0xb1f5('0x27'),JSON[_0xb1f5('0x1e')](_0x1f12f6,null,0x2));if(_0x1f12f6[_0xb1f5('0x28')]===_0xb1f5('0x29')){logger[_0xb1f5('0x2a')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x5cff05['context']=_0x1f12f6[_0xb1f5('0x2b')]||_0x5cff05[_0xb1f5('0x2b')];_0x5cff05[_0xb1f5('0x2c')]=_0x1f12f6[_0xb1f5('0x2c')];_0x5cff05[_0xb1f5('0x2d')]=_0x1f12f6[_0xb1f5('0x2d')]?_0x1f12f6[_0xb1f5('0x2d')]-0x1:0x1;return null;}else if(_0x1f12f6&&_0xd99879[_0x1f12f6[_0xb1f5('0x28')]]){_0x43e3eb=_0xd99879[_0x1f12f6[_0xb1f5('0x28')]](_0x1f12f6);logger['info'](_0xb1f5('0x2e'),JSON[_0xb1f5('0x1e')](_0x43e3eb,null,0x2));if(_0x43e3eb&&_0x43e3eb['code']===AGI_CODE_SUCCESS&&_0x43e3eb[_0xb1f5('0x2f')]!==AGI_RESULT_ERROR&&!_0x5cff05[_0xb1f5('0x30')]){logger[_0xb1f5('0x1c')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return _[_0xb1f5('0x31')](_0x43e3eb[_0xb1f5('0x2f')])?null:_0x43e3eb[_0xb1f5('0x2f')][_0xb1f5('0x32')]();}else{logger[_0xb1f5('0x8')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x274789){logger['error'](_0x274789[_0xb1f5('0xa')]);return null;}});if(_0x3afb1a[_0xb1f5('0x33')]){logger[_0xb1f5('0x2a')](util[_0xb1f5('0x20')](_0xb1f5('0x34'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05['calleridname'],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05[_0xb1f5('0x35')]));_0x4ea179['traverseBFS'](_0x3afb1a[_0xb1f5('0x33')]['id'],function(_0x260553){try{_0x260553=_0xd99879[_0xb1f5('0x26')](_0x260553);logger['debug']('vertex',JSON[_0xb1f5('0x1e')](_0x260553,null,0x2));if(_0x260553&&_0xd99879[_0x260553[_0xb1f5('0x28')]]){_0x43e3eb=_0xd99879[_0x260553[_0xb1f5('0x28')]](_0x260553);if(_0x43e3eb){logger[_0xb1f5('0x1c')](_0xb1f5('0x2e'),inspect(_0x43e3eb));return _[_0xb1f5('0x31')](_0x43e3eb[_0xb1f5('0x2f')])?null:_0x43e3eb[_0xb1f5('0x2f')][_0xb1f5('0x32')]();}else{logger[_0xb1f5('0x8')]('response',inspect(_0x43e3eb));return null;}}else{logger[_0xb1f5('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x33043e){logger[_0xb1f5('0x8')](_0x33043e[_0xb1f5('0xa')]);return null;}});}logger[_0xb1f5('0x2a')](util[_0xb1f5('0x20')](_0xb1f5('0x36'),_0x5cff05[_0xb1f5('0x23')],_0x5cff05[_0xb1f5('0x37')],_0x5cff05[_0xb1f5('0x24')],_0x5cff05[_0xb1f5('0x25')],_0x5cff05[_0xb1f5('0x35')]));logger[_0xb1f5('0x2a')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5cff05['context'],_0x5cff05[_0xb1f5('0x2c')],parseInt(_0x5cff05[_0xb1f5('0x2d')],0xa)+0x1));_0x5cff05[_0xb1f5('0x38')](_0x5cff05[_0xb1f5('0x2b')],_0x5cff05['extension'],parseInt(_0x5cff05[_0xb1f5('0x2d')],0xa)+0x1);_0x5cff05[_0xb1f5('0x39')]();}function handleNotFound(_0xe2103f){logger[_0xb1f5('0x8')](util[_0xb1f5('0x20')](_0xb1f5('0x3a'),_0xe2103f[_0xb1f5('0x23')]));_0xe2103f[_0xb1f5('0x38')](_0xe2103f[_0xb1f5('0x2b')],_0xe2103f[_0xb1f5('0x2c')],parseInt(_0xe2103f[_0xb1f5('0x2d')],0xa)+0x1);_0xe2103f[_0xb1f5('0x39')]();}function handleUnpublished(_0xfb95f3){logger['error'](util['format'](_0xb1f5('0x3b'),_0xfb95f3[_0xb1f5('0x23')]));_0xfb95f3[_0xb1f5('0x38')](_0xfb95f3[_0xb1f5('0x2b')],_0xfb95f3[_0xb1f5('0x2c')],parseInt(_0xfb95f3['priority'],0xa)+0x1);_0xfb95f3['close']();}module[_0xb1f5('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index baf3edd..f629341 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 _0x88c8=['prototype','_localBuffer','toString','_inBody','substring','length','split','indexOf','slice','trim','emit','headers','line','exports','util','stream','call','inherits'];(function(_0x12cb49,_0x51d44e){var _0x38238e=function(_0x570832){while(--_0x570832){_0x12cb49['push'](_0x12cb49['shift']());}};_0x38238e(++_0x51d44e);}(_0x88c8,0x7a));var _0x888c=function(_0x25e68d,_0x310135){_0x25e68d=_0x25e68d-0x0;var _0x4e004e=_0x88c8[_0x25e68d];return _0x4e004e;};'use strict';var util=require(_0x888c('0x0'));var Transform=require(_0x888c('0x1'))['Transform'];function AGIReply(_0x4dbc16){Transform[_0x888c('0x2')](this,_0x4dbc16);this['_localBuffer']='';this['_inBody']=![];}util[_0x888c('0x3')](AGIReply,Transform);AGIReply[_0x888c('0x4')]['_transform']=function(_0x18f3cd,_0x43b662,_0x1e3a1a){var _0x284f52='\x0a',_0x35de38=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x21f3e9=-0x1,_0x214da9=-0x1,_0x467a97='',_0x1a625d=0x0,_0xfd035f='',_0x5988f5='';this[_0x888c('0x5')]+=_0x18f3cd[_0x888c('0x6')]();_0xfd035f=this['_localBuffer'];if(!this[_0x888c('0x7')]){_0x1a625d=0x0;while(_0x35de38[_0x1a625d]){while((_0x214da9=_0xfd035f['indexOf'](_0x35de38[_0x1a625d]))!=-0x1){_0x467a97=_0x35de38[_0x1a625d];_0x5988f5=_0xfd035f[_0x888c('0x8')](0x0,_0x214da9);_0xfd035f=_0xfd035f[_0x888c('0x8')](_0x214da9+_0x467a97[_0x888c('0x9')]);var _0x4900f3=_0x5988f5[_0x888c('0xa')](_0x284f52),_0x2351a5=0x0,_0x1ecced={},_0x29a7fb='',_0x2018a4='',_0xe8b4f9=-0x1;while(_0x4900f3[_0x2351a5]){_0xe8b4f9=_0x4900f3[_0x2351a5][_0x888c('0xb')](':');if(_0xe8b4f9!=-0x1){_0x29a7fb=_0x4900f3[_0x2351a5]['slice'](0x0,_0xe8b4f9)['trim']();_0x2018a4=_0x4900f3[_0x2351a5][_0x888c('0xc')](_0xe8b4f9+0x1)[_0x888c('0xd')]();if(_0x29a7fb[_0x888c('0x9')]>0x0){_0x1ecced[_0x29a7fb]=_0x2018a4;}}else{}_0x2351a5++;}this[_0x888c('0xe')](_0x888c('0xf'),_0x1ecced);this[_0x888c('0x7')]=!![];}_0x1a625d++;}this[_0x888c('0x5')]=_0xfd035f;}else{while((_0x21f3e9=_0xfd035f[_0x888c('0xb')](_0x284f52))!=-0x1){_0x5988f5=_0xfd035f[_0x888c('0x8')](0x0,_0x21f3e9);this[_0x888c('0xe')](_0x888c('0x10'),_0x5988f5);_0xfd035f=_0xfd035f[_0x888c('0x8')](_0x21f3e9+_0x284f52[_0x888c('0x9')]);}this['_localBuffer']=_0xfd035f;}_0x1e3a1a();};module[_0x888c('0x11')]=AGIReply; \ No newline at end of file +var _0x3715=['_inBody','inherits','prototype','_transform','toString','substring','length','split','slice','trim','emit','headers','indexOf','line','exports','util','stream','Transform','call','_localBuffer'];(function(_0x158443,_0x1f4a35){var _0x282e59=function(_0xd72bee){while(--_0xd72bee){_0x158443['push'](_0x158443['shift']());}};_0x282e59(++_0x1f4a35);}(_0x3715,0xc3));var _0x5371=function(_0x51ad88,_0x43bb82){_0x51ad88=_0x51ad88-0x0;var _0x336eef=_0x3715[_0x51ad88];return _0x336eef;};'use strict';var util=require(_0x5371('0x0'));var Transform=require(_0x5371('0x1'))[_0x5371('0x2')];function AGIReply(_0x17bbf9){Transform[_0x5371('0x3')](this,_0x17bbf9);this[_0x5371('0x4')]='';this[_0x5371('0x5')]=![];}util[_0x5371('0x6')](AGIReply,Transform);AGIReply[_0x5371('0x7')][_0x5371('0x8')]=function(_0x13c458,_0x368886,_0x50a759){var _0x1ffdcb='\x0a',_0x340e44=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5edddc=-0x1,_0x426a2a=-0x1,_0x16c64a='',_0x41d142=0x0,_0x56debd='',_0xdbc695='';this['_localBuffer']+=_0x13c458[_0x5371('0x9')]();_0x56debd=this[_0x5371('0x4')];if(!this[_0x5371('0x5')]){_0x41d142=0x0;while(_0x340e44[_0x41d142]){while((_0x426a2a=_0x56debd['indexOf'](_0x340e44[_0x41d142]))!=-0x1){_0x16c64a=_0x340e44[_0x41d142];_0xdbc695=_0x56debd[_0x5371('0xa')](0x0,_0x426a2a);_0x56debd=_0x56debd[_0x5371('0xa')](_0x426a2a+_0x16c64a[_0x5371('0xb')]);var _0x55653f=_0xdbc695[_0x5371('0xc')](_0x1ffdcb),_0x4df51b=0x0,_0x2207f2={},_0x1faac2='',_0x1b0a8a='',_0x5b4adf=-0x1;while(_0x55653f[_0x4df51b]){_0x5b4adf=_0x55653f[_0x4df51b]['indexOf'](':');if(_0x5b4adf!=-0x1){_0x1faac2=_0x55653f[_0x4df51b][_0x5371('0xd')](0x0,_0x5b4adf)[_0x5371('0xe')]();_0x1b0a8a=_0x55653f[_0x4df51b]['slice'](_0x5b4adf+0x1)[_0x5371('0xe')]();if(_0x1faac2[_0x5371('0xb')]>0x0){_0x2207f2[_0x1faac2]=_0x1b0a8a;}}else{}_0x4df51b++;}this[_0x5371('0xf')](_0x5371('0x10'),_0x2207f2);this[_0x5371('0x5')]=!![];}_0x41d142++;}this[_0x5371('0x4')]=_0x56debd;}else{while((_0x5edddc=_0x56debd[_0x5371('0x11')](_0x1ffdcb))!=-0x1){_0xdbc695=_0x56debd['substring'](0x0,_0x5edddc);this[_0x5371('0xf')](_0x5371('0x12'),_0xdbc695);_0x56debd=_0x56debd[_0x5371('0xa')](_0x5edddc+_0x1ffdcb[_0x5371('0xb')]);}this[_0x5371('0x4')]=_0x56debd;}_0x50a759();};module[_0x5371('0x13')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c2c14bd..e86119b 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 _0xe489=['dsn','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getIntervalById','ShowInterval','Interval','Intervals','ShowSmsAccount','createSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','client','http','then','error','message','result','getSquareProjects','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc'];(function(_0x21edfe,_0x11e3cd){var _0x160d96=function(_0x26ed65){while(--_0x26ed65){_0x21edfe['push'](_0x21edfe['shift']());}};_0x160d96(++_0x11e3cd);}(_0xe489,0x9e));var _0x9e48=function(_0x223f9d,_0x20217f){_0x223f9d=_0x223f9d-0x0;var _0x2b9641=_0xe489[_0x223f9d];return _0x2b9641;};'use strict';var _=require(_0x9e48('0x0'));var moment=require(_0x9e48('0x1'));var jayson=require('jayson/promise');var client=jayson[_0x9e48('0x2')][_0x9e48('0x3')]({'port':0x2329});function request(_0x13d19c,_0x1e9e0b){return new Promise(function(_0x1c874c,_0x5f372b){return client['request'](_0x13d19c,_0x1e9e0b)[_0x9e48('0x4')](function(_0x5beede){if(_0x5beede[_0x9e48('0x5')]){return _0x5f372b(_0x5beede[_0x9e48('0x5')][_0x9e48('0x6')]);}else{return _0x1c874c(_0x5beede[_0x9e48('0x7')]);}})['catch'](function(_0xe2bf21){return _0x5f372b(_0xe2bf21);});});}exports[_0x9e48('0x8')]=function(){return request(_0x9e48('0x9'),{'options':{'raw':![],'attributes':['id',_0x9e48('0xa'),_0x9e48('0xb')]}});};exports['getSquareProject']=function(_0x3980d2){return request(_0x9e48('0xc'),{'options':{'raw':![],'where':{'name':_0x3980d2},'attributes':[_0x9e48('0xb')]}});};exports[_0x9e48('0xd')]=function(_0x5b4697){return request(_0x9e48('0xe'),{'options':{'raw':![],'where':{'id':_0x5b4697},'include':[{'model':_0x9e48('0xf'),'as':_0x9e48('0x10'),'include':[{'model':_0x9e48('0x11'),'as':_0x9e48('0x11')}]}],'attributes':['id',_0x9e48('0xa'),_0x9e48('0x12')],'smtp':!![]}});};exports[_0x9e48('0x13')]=function(_0x438ff5){return request('ShowSquareProject',{'options':{'where':{'id':_0x438ff5},'attributes':['name']}});};exports[_0x9e48('0x14')]=function(_0x4613d0){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x4613d0},'attributes':['name']}});};exports[_0x9e48('0x15')]=function(_0x57d7b6){return request(_0x9e48('0x16'),{'options':{'where':{'id':_0x57d7b6},'attributes':['name']}});};exports[_0x9e48('0x17')]=function(_0x4239b2){return request(_0x9e48('0x18'),{'options':{'where':{'id':_0x4239b2},'attributes':[_0x9e48('0x19')]}});};exports['getUserById']=function(_0x359dbe){return request(_0x9e48('0x1a'),{'options':{'where':{'id':_0x359dbe},'attributes':['name']}});};exports[_0x9e48('0x1b')]=function(_0x882523){return request(_0x9e48('0x1c'),{'options':{'where':{'phone':_0x882523['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x10a39a){return request(_0x9e48('0x1d'),{'options':{'where':{'id':_0x10a39a},'attributes':[_0x9e48('0xa')]}});};exports['getSoundById']=function(_0xfb47aa){return request('ShowSound',{'options':{'where':{'id':_0xfb47aa},'attributes':['save_name']}});};exports[_0x9e48('0x1e')]=function(_0x3df5ee){return request(_0x9e48('0x1f'),{'options':{'raw':![],'where':{'id':_0x3df5ee},'include':[{'model':_0x9e48('0x20'),'as':_0x9e48('0x21')}]}});};exports['getSmsAccountById']=function(_0x1a8eca){return request(_0x9e48('0x22'),{'options':{'where':{'id':_0x1a8eca},'attributes':['id',_0x9e48('0xa')]}});};exports[_0x9e48('0x23')]=function(_0x43e733){return request('CreateSmsMessage',{'body':_0x43e733});};exports[_0x9e48('0x24')]=function(_0x1060bc){return request(_0x9e48('0x25'),{'body':_0x1060bc});};exports[_0x9e48('0x26')]=function(_0x1e3df7){return request(_0x9e48('0x27'),{'body':_['merge'](_0x1e3df7,{'project_name':_0x1e3df7[_0x9e48('0x28')],'prev_project_name':_0x1e3df7['arg_2']||'','is_subproject':_0x1e3df7[_0x9e48('0x29')]?!![]:![],'leaveAt':moment()[_0x9e48('0x2a')](_0x9e48('0x2b'))})});};exports[_0x9e48('0x2c')]=function(_0x5d7636){return request(_0x9e48('0x2d'),{'body':_0x5d7636});};exports[_0x9e48('0x2e')]=function(_0x1924c3){return request(_0x9e48('0x2f'),{'body':_0x1924c3});};exports[_0x9e48('0x30')]=function(_0x32a207){return request(_0x9e48('0x31'),{'options':{'raw':![],'where':{'phone':_0x32a207[_0x9e48('0x32')],'ListId':_0x32a207[_0x9e48('0x33')]}}})[_0x9e48('0x4')](function(_0x20d224){if(_0x20d224){return _0x20d224;}return request(_0x9e48('0x34'),{'body':_0x32a207});});};exports['getPauseById']=function(_0x37ad38){return request(_0x9e48('0x35'),{'options':{'where':{'id':_0x37ad38},'attributes':[_0x9e48('0xa')]}});};exports[_0x9e48('0x36')]=function(_0x4c3b05,_0x50854a){return request(_0x9e48('0x37'),{'body':{'interface':_0x50854a},'options':{'where':_0x4c3b05}});};exports[_0x9e48('0x38')]=function(_0xe28be,_0x242208,_0x22017c){return request(_0x9e48('0x39'),{'body':{'type':_0x242208,'uniqueid':_0x22017c},'options':{'where':_0xe28be}});};exports['agentUnpause']=function(_0x2535c5){return request(_0x9e48('0x3a'),{'body':{},'options':{'where':_0x2535c5}});};exports[_0x9e48('0x3b')]=function(_0xcfad14){return request(_0x9e48('0x3c'),{'body':{},'options':{'where':_0xcfad14}});}; \ No newline at end of file +var _0xa3e6=['ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','getPauseById','agentLogin','LoginUser','agentPause','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','jayson/promise','http','then','error','message','catch','name','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','getIntervalById','ShowInterval','Interval'];(function(_0x5edf65,_0x87b4fd){var _0x4e30c7=function(_0x2dce6f){while(--_0x2dce6f){_0x5edf65['push'](_0x5edf65['shift']());}};_0x4e30c7(++_0x87b4fd);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x1b9c42,_0x3d08a2){_0x1b9c42=_0x1b9c42-0x0;var _0x3572ff=_0xa3e6[_0x1b9c42];return _0x3572ff;};'use strict';var _=require(_0x6a3e('0x0'));var moment=require('moment');var jayson=require(_0x6a3e('0x1'));var client=jayson['client'][_0x6a3e('0x2')]({'port':0x2329});function request(_0x111a5d,_0x3e5620){return new Promise(function(_0x56e3f4,_0xe03261){return client['request'](_0x111a5d,_0x3e5620)[_0x6a3e('0x3')](function(_0x23599b){if(_0x23599b[_0x6a3e('0x4')]){return _0xe03261(_0x23599b[_0x6a3e('0x4')][_0x6a3e('0x5')]);}else{return _0x56e3f4(_0x23599b['result']);}})[_0x6a3e('0x6')](function(_0x3d2a86){return _0xe03261(_0x3d2a86);});});}exports['getSquareProjects']=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x6a3e('0x7'),'production']}});};exports['getSquareProject']=function(_0xef2185){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0xef2185},'attributes':[_0x6a3e('0x8')]}});};exports['getMailAccountById']=function(_0xd21a09){return request(_0x6a3e('0x9'),{'options':{'raw':![],'where':{'id':_0xd21a09},'include':[{'model':_0x6a3e('0xa'),'as':_0x6a3e('0xb'),'include':[{'model':_0x6a3e('0xc'),'as':_0x6a3e('0xc')}]}],'attributes':['id','name',_0x6a3e('0xd')],'smtp':!![]}});};exports[_0x6a3e('0xe')]=function(_0x1a1893){return request(_0x6a3e('0xf'),{'options':{'where':{'id':_0x1a1893},'attributes':[_0x6a3e('0x7')]}});};exports[_0x6a3e('0x10')]=function(_0x222f7c){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x222f7c},'attributes':[_0x6a3e('0x7')]}});};exports[_0x6a3e('0x11')]=function(_0x8ed74b){return request(_0x6a3e('0x12'),{'options':{'where':{'id':_0x8ed74b},'attributes':['name']}});};exports[_0x6a3e('0x13')]=function(_0x24666d){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x24666d},'attributes':['dsn']}});};exports['getUserById']=function(_0x58b221){return request('ShowUser',{'options':{'where':{'id':_0x58b221},'attributes':[_0x6a3e('0x7')]}});};exports[_0x6a3e('0x14')]=function(_0x31a190){return request(_0x6a3e('0x15'),{'options':{'where':{'phone':_0x31a190[_0x6a3e('0x16')]},'attributes':['id']}});};exports[_0x6a3e('0x17')]=function(_0x1d6ccc){return request(_0x6a3e('0x18'),{'options':{'where':{'id':_0x1d6ccc},'attributes':['name']}});};exports[_0x6a3e('0x19')]=function(_0x58b7b9){return request(_0x6a3e('0x1a'),{'options':{'where':{'id':_0x58b7b9},'attributes':['save_name']}});};exports[_0x6a3e('0x1b')]=function(_0x131d80){return request(_0x6a3e('0x1c'),{'options':{'raw':![],'where':{'id':_0x131d80},'include':[{'model':_0x6a3e('0x1d'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x215ac1){return request(_0x6a3e('0x1e'),{'options':{'where':{'id':_0x215ac1},'attributes':['id',_0x6a3e('0x7')]}});};exports[_0x6a3e('0x1f')]=function(_0x4e5a25){return request(_0x6a3e('0x20'),{'body':_0x4e5a25});};exports[_0x6a3e('0x21')]=function(_0x4436ac){return request(_0x6a3e('0x22'),{'body':_0x4436ac});};exports[_0x6a3e('0x23')]=function(_0x32ef88){return request(_0x6a3e('0x24'),{'body':_[_0x6a3e('0x25')](_0x32ef88,{'project_name':_0x32ef88[_0x6a3e('0x26')],'prev_project_name':_0x32ef88[_0x6a3e('0x27')]||'','is_subproject':_0x32ef88['arg_2']?!![]:![],'leaveAt':moment()['format'](_0x6a3e('0x28'))})});};exports[_0x6a3e('0x29')]=function(_0x13bdc3){return request(_0x6a3e('0x2a'),{'body':_0x13bdc3});};exports[_0x6a3e('0x2b')]=function(_0x2d0ec1){return request(_0x6a3e('0x2c'),{'body':_0x2d0ec1});};exports[_0x6a3e('0x2d')]=function(_0xd87198){return request(_0x6a3e('0x2e'),{'options':{'raw':![],'where':{'phone':_0xd87198[_0x6a3e('0x16')],'ListId':_0xd87198['ListId']}}})['then'](function(_0x2a2b2a){if(_0x2a2b2a){return _0x2a2b2a;}return request('CreateCmContact',{'body':_0xd87198});});};exports[_0x6a3e('0x2f')]=function(_0x5db820){return request('ShowPause',{'options':{'where':{'id':_0x5db820},'attributes':[_0x6a3e('0x7')]}});};exports[_0x6a3e('0x30')]=function(_0x57bdd1,_0x51cf3a){return request(_0x6a3e('0x31'),{'body':{'interface':_0x51cf3a},'options':{'where':_0x57bdd1}});};exports[_0x6a3e('0x32')]=function(_0x19a8c3,_0x44951e,_0x584d44){return request('PauseUser',{'body':{'type':_0x44951e,'uniqueid':_0x584d44},'options':{'where':_0x19a8c3}});};exports[_0x6a3e('0x33')]=function(_0x44f9ad){return request(_0x6a3e('0x34'),{'body':{},'options':{'where':_0x44f9ad}});};exports[_0x6a3e('0x35')]=function(_0x576400){return request(_0x6a3e('0x36'),{'body':{},'options':{'where':_0x576400}});}; \ 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 bea319c..fbc11ec 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 _0x9b8e=['./polly','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9b8e,0x158));var _0xe9b8=function(_0x2edbf5,_0x43a892){_0x2edbf5=_0x2edbf5-0x0;var _0x4b8509=_0x9b8e[_0x2edbf5];return _0x4b8509;};var polly=require(_0xe9b8('0x0'));var lex=require('./lex');module[_0xe9b8('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xb0df=['exports','./lex'];(function(_0x5020cc,_0x1112f9){var _0x236e35=function(_0x31b6e1){while(--_0x31b6e1){_0x5020cc['push'](_0x5020cc['shift']());}};_0x236e35(++_0x1112f9);}(_0xb0df,0x85));var _0xfb0d=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0xb0df[_0x8cb2f9];return _0x164887;};var polly=require('./polly');var lex=require(_0xfb0d('0x0'));module[_0xfb0d('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index a9ec881..4739197 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ No newline at end of file +var _0x3c81=['./lib/api','exports'];(function(_0x4067fa,_0x5baeee){var _0xad9252=function(_0x2113b3){while(--_0x2113b3){_0x4067fa['push'](_0x4067fa['shift']());}};_0xad9252(++_0x5baeee);}(_0x3c81,0x102));var _0x13c8=function(_0x3113ce,_0x412b81){_0x3113ce=_0x3113ce-0x0;var _0x25178e=_0x3c81[_0x3113ce];return _0x25178e;};'use strict';var lex=require(_0x13c8('0x0'));module[_0x13c8('0x1')]=function(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4){return lex(_0x48c35b,_0x252f26,_0x131d0b,_0x4954c2,_0x5913e9,_0x5c3ba4);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/lib/api.js b/server/services/agi/scripts/aws/lex/lib/api.js index 6bf4aa2..ad5a1b3 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(_0xab10cc,_0x50dba2){var _0x30bd31=function(_0x4b0273){while(--_0x4b0273){_0xab10cc['push'](_0xab10cc['shift']());}};_0x30bd31(++_0x50dba2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x4f5a94,_0x298900){var _0x4010ad=function(_0x3fbe8a){while(--_0x3fbe8a){_0x4f5a94['push'](_0x4f5a94['shift']());}};_0x4010ad(++_0x298900);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 43ae418..f30865a 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 _0x699b=['exports','./lib/api'];(function(_0xc63d49,_0x48e9f9){var _0x4ff3d9=function(_0x405098){while(--_0x405098){_0xc63d49['push'](_0xc63d49['shift']());}};_0x4ff3d9(++_0x48e9f9);}(_0x699b,0x1ad));var _0xb699=function(_0x39b9a3,_0xd95bba){_0x39b9a3=_0x39b9a3-0x0;var _0x64cd58=_0x699b[_0x39b9a3];return _0x64cd58;};'use strict';var polly=require(_0xb699('0x0'));module[_0xb699('0x1')]=function(_0x1e42e0,_0x38af7e,_0x239e6c,_0x22672a,_0x410f05,_0x491869,_0x4cee56){return polly(_0x1e42e0,_0x38af7e,_0x239e6c,_0x22672a,_0x410f05,_0x491869,_0x4cee56);}; \ No newline at end of file +var _0x7f46=['./lib/api'];(function(_0x5257f3,_0x136573){var _0x211811=function(_0x4c3fde){while(--_0x4c3fde){_0x5257f3['push'](_0x5257f3['shift']());}};_0x211811(++_0x136573);}(_0x7f46,0xa4));var _0x67f4=function(_0x213ba,_0x2427e0){_0x213ba=_0x213ba-0x0;var _0x3598e7=_0x7f46[_0x213ba];return _0x3598e7;};'use strict';var polly=require(_0x67f4('0x0'));module['exports']=function(_0x5cfa28,_0x56adbb,_0x5550cb,_0x323b0f,_0x4013f6,_0x79259c,_0x17a249){return polly(_0x5cfa28,_0x56adbb,_0x5550cb,_0x323b0f,_0x4013f6,_0x79259c,_0x17a249);}; \ 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 230eb86..e5825d8 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 _0xf4fd=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','bluebird','randomstring','aws-sdk','AudioStream'];(function(_0x20b8d,_0x471e78){var _0x44b833=function(_0xcfc880){while(--_0xcfc880){_0x20b8d['push'](_0x20b8d['shift']());}};_0x44b833(++_0x471e78);}(_0xf4fd,0xe2));var _0xdf4f=function(_0x3e2cd5,_0x3b5dc3){_0x3e2cd5=_0x3e2cd5-0x0;var _0x550e8b=_0xf4fd[_0x3e2cd5];return _0x550e8b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xdf4f('0x0'));var rs=require(_0xdf4f('0x1'));var AWS=require(_0xdf4f('0x2'));function pollyResult(_0xdc59a2,_0x357cb0,_0x4e3219){return new BPromise(function(_0xa1cd0a,_0x3e2e7a){_0xdc59a2['synthesizeSpeech'](_0x357cb0,function(_0x3cb26f,_0x2767dc){if(_0x3cb26f){_0x3e2e7a(_0x3cb26f);}else if(_0x2767dc){if(_0x2767dc[_0xdf4f('0x3')]instanceof Buffer){fs[_0xdf4f('0x4')](_0x4e3219,_0x2767dc[_0xdf4f('0x3')],function(_0x16102b){if(_0x16102b){_0x3e2e7a(_0x16102b);}else{_0xa1cd0a();}});}else{_0x3e2e7a(new Error(_0xdf4f('0x5')));}}else{_0x3e2e7a(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xdf4f('0x6')]=function(_0x810574,_0x46e34a,_0x26babe,_0x579048,_0x4c2ae3,_0x586f5e,_0x181ea7){var _0x6b3278=new AWS[(_0xdf4f('0x7'))]({'accessKeyId':_0x810574,'secretAccessKey':_0x46e34a,'region':_0x26babe});var _0x38cdea={'Text':_0x4c2ae3,'TextType':_0x586f5e||_0xdf4f('0x8'),'OutputFormat':_0xdf4f('0x9'),'VoiceId':_0x579048};return pollyResult(_0x6b3278,_0x38cdea,_0x181ea7);}; \ No newline at end of file +var _0x3742=['AudioStream','writeFile','exports','Polly','mp3','randomstring','aws-sdk','synthesizeSpeech'];(function(_0x4f763f,_0x46cb59){var _0x3396db=function(_0x199c63){while(--_0x199c63){_0x4f763f['push'](_0x4f763f['shift']());}};_0x3396db(++_0x46cb59);}(_0x3742,0x155));var _0x2374=function(_0x23e30d,_0x58e65f){_0x23e30d=_0x23e30d-0x0;var _0x37ab78=_0x3742[_0x23e30d];return _0x37ab78;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x2374('0x0'));var AWS=require(_0x2374('0x1'));function pollyResult(_0x57b62b,_0x25b382,_0x2fba11){return new BPromise(function(_0x52cbb0,_0x608a92){_0x57b62b[_0x2374('0x2')](_0x25b382,function(_0x3f6c2c,_0x14b826){if(_0x3f6c2c){_0x608a92(_0x3f6c2c);}else if(_0x14b826){if(_0x14b826[_0x2374('0x3')]instanceof Buffer){fs[_0x2374('0x4')](_0x2fba11,_0x14b826[_0x2374('0x3')],function(_0x4ad143){if(_0x4ad143){_0x608a92(_0x4ad143);}else{_0x52cbb0();}});}else{_0x608a92(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x608a92(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x2374('0x5')]=function(_0x5c2dc1,_0x1d94dd,_0x1d7f33,_0x33d345,_0x3b591c,_0x6d8e28,_0x52b32b){var _0x5c9a93=new AWS[(_0x2374('0x6'))]({'accessKeyId':_0x5c2dc1,'secretAccessKey':_0x1d94dd,'region':_0x1d7f33});var _0xf48b88={'Text':_0x3b591c,'TextType':_0x6d8e28||'text','OutputFormat':_0x2374('0x7'),'VoiceId':_0x33d345};return pollyResult(_0x5c9a93,_0xf48b88,_0x52b32b);}; \ 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 42725d6..3b60543 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(_0x4524ce,_0x52a568,_0x16f959,_0x4a410f){return asr(_0x4524ce,_0x52a568,_0x16f959);}; \ No newline at end of file +var _0xbc51=['exports'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbc51,0x1d1));var _0x1bc5=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xbc51[_0x1443eb];return _0x2b8810;};'use strict';var asr=require('./lib/api');module[_0x1bc5('0x0')]=function(_0x1de5c4,_0x4f95de,_0x1c49bf,_0x29fc41){return asr(_0x1de5c4,_0x4f95de,_0x1c49bf);}; \ 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 739bc25..b0e0938 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 _0x3f19=['key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','length','filepath\x20should\x20be\x20a\x20string','string'];(function(_0x3c4052,_0x401023){var _0x41f72b=function(_0x4df419){while(--_0x4df419){_0x3c4052['push'](_0x3c4052['shift']());}};_0x41f72b(++_0x401023);}(_0x3f19,0xc0));var _0x93f1=function(_0xff780c,_0x3c94eb){_0xff780c=_0xff780c-0x0;var _0x1f0861=_0x3f19[_0xff780c];return _0x1f0861;};'use strict';var url=require(_0x93f1('0x0'));var BPromise=require('bluebird');var fs=require('fs');var host='https://speech.googleapis.com';module['exports']=function(_0x33bddc,_0x4d1cac,_0x452cf9){return new BPromise(function(_0x9a0ee0,_0x3bd3fa){var _0x2057aa;if(typeof _0x33bddc!=='string'||_0x33bddc[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x2'));}if(typeof _0x4d1cac!==_0x93f1('0x3')||_0x4d1cac[_0x93f1('0x1')]===0x0){return _0x3bd3fa(_0x93f1('0x4'));}if(typeof _0x452cf9!==_0x93f1('0x5')&&(typeof _0x452cf9!=='string'||_0x452cf9[_0x93f1('0x1')]===0x0)){return _0x3bd3fa(_0x93f1('0x6'));}try{_0x2057aa=fs[_0x93f1('0x7')](_0x33bddc)[_0x93f1('0x8')](_0x93f1('0x9'));}catch(_0x558623){return _0x3bd3fa(_0x558623);}return _0x9a0ee0({'method':_0x93f1('0xa'),'uri':host+_0x93f1('0xb')+_0x4d1cac,'body':{'config':{'encoding':_0x93f1('0xc'),'sampleRateHertz':_0x93f1('0xd'),'languageCode':_0x452cf9},'audio':{'content':_0x2057aa}},'json':!![]});});}; \ No newline at end of file +var _0x0a9a=['POST','8000','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x0a9a,0x183));var _0xa0a9=function(_0x31abe3,_0x3ce2e9){_0x31abe3=_0x31abe3-0x0;var _0xf43acd=_0x0a9a[_0x31abe3];return _0xf43acd;};'use strict';var url=require('url');var BPromise=require(_0xa0a9('0x0'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0xa0a9('0x1')]=function(_0x3cff22,_0x34801b,_0x49162f){return new BPromise(function(_0x4ba993,_0x317a94){var _0x360be5;if(typeof _0x3cff22!=='string'||_0x3cff22[_0xa0a9('0x2')]===0x0){return _0x317a94(_0xa0a9('0x3'));}if(typeof _0x34801b!==_0xa0a9('0x4')||_0x34801b[_0xa0a9('0x2')]===0x0){return _0x317a94('key\x20should\x20be\x20a\x20string');}if(typeof _0x49162f!==_0xa0a9('0x5')&&(typeof _0x49162f!=='string'||_0x49162f[_0xa0a9('0x2')]===0x0)){return _0x317a94(_0xa0a9('0x6'));}try{_0x360be5=fs[_0xa0a9('0x7')](_0x3cff22)[_0xa0a9('0x8')]('base64');}catch(_0x2ba0ac){return _0x317a94(_0x2ba0ac);}return _0x4ba993({'method':_0xa0a9('0x9'),'uri':host+'/v1/speech:recognize?key='+_0x34801b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xa0a9('0xa'),'languageCode':_0x49162f},'audio':{'content':_0x360be5}},'json':!![]});});}; \ No newline at end of file diff --git a/server/services/agi/scripts/google/index.js b/server/services/agi/scripts/google/index.js index 10cb4be..56b7f06 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 asr=require('./asr');module['exports']={'asr':asr}; \ No newline at end of file +var _0xdc77=['./asr','exports'];(function(_0x5de8bf,_0x24e115){var _0x2be3e3=function(_0x385e2c){while(--_0x385e2c){_0x5de8bf['push'](_0x5de8bf['shift']());}};_0x2be3e3(++_0x24e115);}(_0xdc77,0x136));var _0x7dc7=function(_0xcffa2a,_0x3bdbe9){_0xcffa2a=_0xcffa2a-0x0;var _0x25852c=_0xdc77[_0xcffa2a];return _0x25852c;};var asr=require(_0x7dc7('0x0'));module[_0x7dc7('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 0a7b6d9..d945829 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 _0xff28=['languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','model=%s','freeform=3','nda','channelData','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','close','download\x20error','pipe','error','end','path','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','split','readFileSync','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','POST','.mp3','from','audioContent','777','googleCloudTTS\x20path','googleTTS','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','goggleTTS\x20path','googleASR','results','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','actionIncomplete','fulfillment','speech','score','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','fulfillmentText','name','intent','isFallback'];(function(_0x532423,_0x1919fb){var _0x36f29b=function(_0x2e0ccb){while(--_0x2e0ccb){_0x532423['push'](_0x532423['shift']());}};_0x36f29b(++_0x1919fb);}(_0xff28,0x116));var _0x8ff2=function(_0x4d7a70,_0x2d3bfa){_0x4d7a70=_0x4d7a70-0x0;var _0x3aafbb=_0xff28[_0x4d7a70];return _0x3aafbb;};'use strict';var apiai=require(_0x8ff2('0x0'));var BPromise=require(_0x8ff2('0x1'));var dialogflow=require(_0x8ff2('0x2'));var fs=require('fs');var http=require(_0x8ff2('0x3'));var https=require(_0x8ff2('0x4'));var md5=require(_0x8ff2('0x5'));var path=require('path');var querystring=require('querystring');var rp=require(_0x8ff2('0x6'));var rs=require(_0x8ff2('0x7'));var sox=require(_0x8ff2('0x8'));var tts=require(_0x8ff2('0x9'));var urlParse=require(_0x8ff2('0xa'))[_0x8ff2('0xb')];var util=require(_0x8ff2('0xc'));var aws=require(_0x8ff2('0xd'));var google=require('./google');var sestek=require(_0x8ff2('0xe'));var tilde=require(_0x8ff2('0xf'));var logger=require(_0x8ff2('0x10'))(_0x8ff2('0x11'));var ISPEECH_API=_0x8ff2('0x12');function downloadFile(_0x3cbaf3,_0x2f0790){return new BPromise(function(_0x3dbcb6,_0x456c23){var _0x47d033=urlParse(_0x3cbaf3);var _0x369f72=_0x47d033[_0x8ff2('0x13')]===_0x8ff2('0x14')?https:http;var _0x3478be={'host':_0x47d033[_0x8ff2('0x15')],'path':_0x47d033['path'],'headers':{'user-agent':_0x8ff2('0x16')}};_0x369f72[_0x8ff2('0x17')](_0x3478be,function(_0x1dd6a5){if(_0x1dd6a5[_0x8ff2('0x18')]!==0xc8){logger['error'](_0x8ff2('0x19')+_0x3cbaf3+_0x8ff2('0x1a')+_0x1dd6a5[_0x8ff2('0x18')]+'\x20('+_0x1dd6a5[_0x8ff2('0x1b')]+')');_0x456c23(new Error('request\x20to\x20'+_0x3cbaf3+_0x8ff2('0x1a')+_0x1dd6a5[_0x8ff2('0x18')]+'\x20('+_0x1dd6a5[_0x8ff2('0x1b')]+')'));return;}var _0x25c676=fs[_0x8ff2('0x1c')](_0x2f0790);_0x25c676['on'](_0x8ff2('0x1d'),function(){logger[_0x8ff2('0x1e')](_0x8ff2('0x1f'));_0x25c676[_0x8ff2('0x20')](_0x3dbcb6);});_0x25c676['on']('error',function(_0x332bc9){fs['unlink'](_0x2f0790);logger['error'](_0x8ff2('0x21'),_0x332bc9);_0x456c23(_0x332bc9);});_0x1dd6a5[_0x8ff2('0x22')](_0x25c676);})['on'](_0x8ff2('0x23'),function(_0x5696fa){logger[_0x8ff2('0x23')](_0x5696fa);_0x456c23(_0x5696fa);})[_0x8ff2('0x24')]();});}function uploadFile(_0x21dbeb){return new BPromise(function(_0x45e382,_0x1eedd7){var _0x2ac32f=urlParse(_0x21dbeb);var _0x563dfc=_0x2ac32f[_0x8ff2('0x13')]===_0x8ff2('0x14')?https:http;var _0x2d3e98={'host':_0x2ac32f['host'],'path':_0x2ac32f[_0x8ff2('0x25')],'headers':{'user-agent':_0x8ff2('0x16')}};_0x563dfc[_0x8ff2('0x17')](_0x2d3e98,function(_0x11ab09){if(_0x11ab09[_0x8ff2('0x18')]!==0xc8){_0x1eedd7(new Error(_0x8ff2('0x19')+_0x21dbeb+'\x20failed,\x20status\x20code\x20=\x20'+_0x11ab09[_0x8ff2('0x18')]+'\x20('+_0x11ab09[_0x8ff2('0x1b')]+')'));return;}var _0x21b7a5='';_0x11ab09['on']('data',function(_0x1075ba){_0x21b7a5+=_0x1075ba;});_0x11ab09['on'](_0x8ff2('0x24'),function(){_0x45e382(_0x21b7a5);});})['on'](_0x8ff2('0x23'),function(_0x39d5b8){_0x1eedd7(_0x39d5b8);})[_0x8ff2('0x24')]();});}function convertFile(_0x56cfbb,_0x376b49){return new BPromise(function(_0x49df26,_0x44b5cf){var _0x5cd776=sox['transcode'](_0x56cfbb,_0x376b49,{'sampleRate':0x1f40,'format':_0x8ff2('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5cd776['on']('error',function(_0x3708bb){logger['error'](_0x8ff2('0x27'),_0x3708bb);_0x44b5cf(_0x3708bb);});_0x5cd776['on'](_0x8ff2('0x24'),function(){logger[_0x8ff2('0x1e')](_0x8ff2('0x28'));_0x49df26();});_0x5cd776[_0x8ff2('0x29')]();});}function base64Decode(_0x5d3f43,_0x12b43f){var _0x40a40e=path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x2d'));fs[_0x8ff2('0x2e')](_0x40a40e,_0x5d3f43,_0x8ff2('0x2f'));return convertFile(_0x40a40e,_0x12b43f)[_0x8ff2('0x30')](function(){try{fs[_0x8ff2('0x31')](_0x40a40e);fs[_0x8ff2('0x32')](_0x12b43f,'777');}catch(_0x3eb62c){logger['error'](_0x3eb62c);}return _0x12b43f[_0x8ff2('0x33')]('.')[0x0];});}function base64Encode(_0x45505c){var _0x23c6ea=fs[_0x8ff2('0x34')](_0x45505c);return new Buffer(_0x23c6ea)['toString'](_0x8ff2('0x2f'));}exports[_0x8ff2('0x35')]=function(_0x5808f7,_0x2e2b28,_0x37de2b,_0x58e640,_0x64cb32,_0x11ced1){var _0x6948fd,_0x4bdfa0;var _0x1b8b29=_0x8ff2('0x36');var _0x14acb9=_0x8ff2('0x37')+_0x5808f7;var _0x377773={};if(_0x2e2b28==='ssml'){_0x377773[_0x8ff2('0x38')]={'ssml':_0x37de2b};}else{_0x377773['input']={'text':_0x37de2b};};_0x377773[_0x8ff2('0x39')]={'languageCode':_0x58e640,'ssmlGender':_0x64cb32};_0x377773['audioConfig']={'audioEncoding':_0x8ff2('0x3a'),'sampleRateHertz':0x1f40};var _0x563c83={'url':_0x1b8b29+'text:synthesize'+_0x14acb9,'method':_0x8ff2('0x3b'),'json':!![],'body':_0x377773};return rp(_0x563c83)[_0x8ff2('0x30')](function(_0x12fcdd){return new BPromise(function(_0x1f2b36,_0x17e968){_0x6948fd=path['resolve'](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x3c'));var _0x35acf9=Buffer[_0x8ff2('0x3d')](_0x12fcdd[_0x8ff2('0x3e')],_0x8ff2('0x2f'));return fs['writeFile'](_0x6948fd,_0x35acf9,function(_0x29f572){_0x17e968(_0x29f572);},function(_0x55d540){fs[_0x8ff2('0x32')](_0x6948fd,_0x8ff2('0x3f'));_0x1f2b36(_0x55d540);});});})[_0x8ff2('0x30')](function(_0x4d307a){_0x4bdfa0=path[_0x8ff2('0x2a')](__dirname,'tmp',rs[_0x8ff2('0x2c')](0x4)+'.wav');return convertFile(_0x6948fd,_0x4bdfa0);})[_0x8ff2('0x30')](function(){try{fs[_0x8ff2('0x31')](_0x6948fd);fs[_0x8ff2('0x32')](_0x4bdfa0,'777');}catch(_0x208997){logger[_0x8ff2('0x23')](_0x208997);}logger[_0x8ff2('0x1e')](_0x8ff2('0x40'),_0x4bdfa0[_0x8ff2('0x33')]('.')[0x0]);return _0x4bdfa0['split']('.')[0x0];});};exports[_0x8ff2('0x41')]=function(_0x5c7c88,_0x43bc53){var _0x322d4f='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x23dacc,_0x1f617d;var _0x50cfe2;var _0xee70e9={'encoding':_0x8ff2('0x42'),'method':_0x8ff2('0x3b'),'timeout':0x2710,'url':_0x322d4f,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x8ff2('0x43')+encodeURIComponent(JSON[_0x8ff2('0x44')]([[[_0x8ff2('0x45'),JSON[_0x8ff2('0x44')]([_0x5c7c88,_0x43bc53||'en',![],_0x8ff2('0x46')]),null,_0x8ff2('0x47')]]]))};return rp(_0xee70e9)[_0x8ff2('0x30')](function(_0x5d442e){try{_0x50cfe2=eval(_0x5d442e[_0x8ff2('0x48')](0x5))[0x0][0x2];}catch(_0x3619ee){throw new Error(_0x8ff2('0x49')+_0x5d442e[_0x8ff2('0x4a')]);}if(!_0x50cfe2){if(_0x5c7c88[_0x8ff2('0x4b')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x8ff2('0x4c')+_0x43bc53+'\x22\x20might\x20not\x20exist');}}try{_0x50cfe2=eval(_0x50cfe2)[0x0];}catch(_0x45c084){throw new Error(_0x8ff2('0x49')+res[_0x8ff2('0x4a')]);}const _0x3ef131=_0x50cfe2;_0x23dacc=path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x3c'));fs[_0x8ff2('0x2e')](_0x23dacc,_0x50cfe2,{'encoding':_0x8ff2('0x2f')});_0x1f617d=path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x2d'));return convertFile(_0x23dacc,_0x1f617d);})['then'](function(){try{fs[_0x8ff2('0x31')](_0x23dacc);fs[_0x8ff2('0x32')](_0x1f617d,_0x8ff2('0x3f'));}catch(_0x59bc44){logger[_0x8ff2('0x23')](_0x59bc44);}logger['info'](_0x8ff2('0x4d'),_0x1f617d[_0x8ff2('0x33')]('.')[0x0]);return _0x1f617d[_0x8ff2('0x33')]('.')[0x0];});};exports[_0x8ff2('0x4e')]=function(_0x75de75,_0x5a74b1,_0x35c1e7){return google['asr'](_0x75de75,_0x5a74b1,_0x35c1e7)[_0x8ff2('0x30')](function(_0x43aa51){logger[_0x8ff2('0x1e')](_0x43aa51['uri']);return rp(_0x43aa51);})[_0x8ff2('0x30')](function(_0x1ee0c3){var _0x2335c7='';var _0x18496=0x0;try{fs[_0x8ff2('0x31')](_0x75de75);}catch(_0x216140){logger[_0x8ff2('0x23')](_0x216140);}if(_0x1ee0c3&&_0x1ee0c3[_0x8ff2('0x4f')]){_0x2335c7=_0x1ee0c3[_0x8ff2('0x4f')]['map'](function(_0x500f51){return _0x500f51&&_0x500f51[_0x8ff2('0x50')][0x0]&&_0x500f51[_0x8ff2('0x50')][0x0][_0x8ff2('0x51')]?_0x500f51[_0x8ff2('0x50')][0x0]['transcript']:'';})[_0x8ff2('0x52')]('\x0a');_0x18496=_0x1ee0c3[_0x8ff2('0x4f')]['map'](function(_0x3346ef){return _0x3346ef&&_0x3346ef[_0x8ff2('0x50')][0x0]&&_0x3346ef[_0x8ff2('0x50')][0x0][_0x8ff2('0x53')]?_0x3346ef['alternatives'][0x0][_0x8ff2('0x53')]:0x0;})[_0x8ff2('0x52')]('\x0a');}logger[_0x8ff2('0x1e')](_0x8ff2('0x54'),_0x2335c7);logger[_0x8ff2('0x1e')](_0x8ff2('0x55'),_0x18496);return{'transcript':_0x2335c7,'confidence':_0x18496};})[_0x8ff2('0x56')](function(_0x21276a){logger[_0x8ff2('0x23')](_0x8ff2('0x57'),_0x21276a[_0x8ff2('0x18')],_0x21276a['name'],_0x21276a[_0x8ff2('0x58')]);});};exports[_0x8ff2('0x59')]=function(_0x2250fc,_0x55efb4,_0x105714,_0x2b0cd8){var _0x361f9e=apiai(_0x55efb4,{'language':_0x2b0cd8||'en'});return _0x361f9e[_0x8ff2('0x5a')](_0x105714,{'sessionId':md5(_0x2250fc)})[_0x8ff2('0x30')](function(_0x2cb706){logger[_0x8ff2('0x1e')](JSON[_0x8ff2('0x44')](_0x2cb706));return{'source':_0x2cb706['result'][_0x8ff2('0x5b')],'resolvedQuery':_0x2cb706['result']['resolvedQuery'],'action':_0x2cb706['result']['action'],'actionIncomplete':_0x2cb706[_0x8ff2('0x5c')][_0x8ff2('0x5d')],'speech':_0x2cb706[_0x8ff2('0x5c')][_0x8ff2('0x5e')][_0x8ff2('0x5f')],'score':_0x2cb706[_0x8ff2('0x5c')][_0x8ff2('0x60')],'statusCode':_0x2cb706['status']['code'],'endConversation':_0x2cb706['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x2cb706[_0x8ff2('0x5c')][_0x8ff2('0x61')][_0x8ff2('0x62')]};});};exports[_0x8ff2('0x63')]=function(_0x346a91,_0x517e1c,_0x4c6535,_0x2d84d1,_0x137726,_0x2a101f){var _0x4417ad=_0x2d84d1['replace'](/\\n/g,'\x0a');var _0x3647e9={'credentials':{'private_key':_0x4417ad,'client_email':_0x4c6535}};var _0x4f8fac=new dialogflow[(_0x8ff2('0x64'))](_0x3647e9);var _0x119d8c=_0x4f8fac['sessionPath'](_0x517e1c,md5(_0x346a91));var _0x3a8ef4={'session':_0x119d8c,'queryInput':{'text':{'text':_0x137726,'languageCode':_0x2a101f}}};return _0x4f8fac[_0x8ff2('0x65')](_0x3a8ef4)[_0x8ff2('0x30')](function(_0x24b461){if(_0x24b461&&_0x24b461[_0x8ff2('0x4b')]){logger[_0x8ff2('0x1e')](_0x8ff2('0x66'),JSON[_0x8ff2('0x44')](_0x24b461));var _0x32f939=_0x24b461[0x0];if(_0x32f939){var _0x5c8a0b={'action':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x68')],'allRequiredParamsPresent':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x69')],'endConversation':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x6a')]&&_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x6a')]['fields']?_0x32f939[_0x8ff2('0x67')]['diagnosticInfo'][_0x8ff2('0x6b')]['end_conversation']['boolValue']:![],'fulfillmentText':_0x32f939['queryResult'][_0x8ff2('0x6c')],'intentName':_0x32f939[_0x8ff2('0x67')]['intent'][_0x8ff2('0x6d')],'intentDisplayName':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x6e')]['displayName'],'isFallbackIntent':_0x32f939[_0x8ff2('0x67')]['intent'][_0x8ff2('0x6f')],'languageCode':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x70')],'queryText':_0x32f939[_0x8ff2('0x67')]['queryText'],'responseId':_0x32f939[_0x8ff2('0x71')],'score':_0x32f939[_0x8ff2('0x67')]['intentDetectionConfidence'],'speech':_0x32f939[_0x8ff2('0x67')][_0x8ff2('0x6c')],'providerResponse':JSON[_0x8ff2('0x44')](_0x24b461)};return _0x5c8a0b;}}});};exports[_0x8ff2('0x72')]=function(_0x45c086,_0xe1e2d0,_0x451603,_0x234f87){return tilde['asr'](_0x45c086,_0xe1e2d0,_0x451603,_0x234f87)[_0x8ff2('0x30')](function(_0x3d268f){try{fs[_0x8ff2('0x31')](_0x45c086);}catch(_0x1bcda0){logger['error'](_0x1bcda0);}logger[_0x8ff2('0x1e')](_0x8ff2('0x73'),_0x3d268f[_0x8ff2('0x51')]);logger[_0x8ff2('0x1e')](_0x8ff2('0x74'),_0x3d268f[_0x8ff2('0x53')]);return _0x3d268f;});};exports[_0x8ff2('0x75')]=function(_0x13053c,_0x4cfe14,_0x783649,_0x30a587,_0x2e89ff,_0x1dd0ab){var _0x367822=path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+'.mp3');var _0x49a01c;return aws[_0x8ff2('0x76')](_0x13053c,_0x4cfe14,_0x783649,_0x30a587,_0x2e89ff,_0x1dd0ab,_0x367822)[_0x8ff2('0x30')](function(){_0x49a01c=path['resolve'](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+'.wav');return convertFile(_0x367822,_0x49a01c);})[_0x8ff2('0x30')](function(){try{fs[_0x8ff2('0x31')](_0x367822);fs[_0x8ff2('0x32')](_0x49a01c,'777');}catch(_0x224ee6){logger[_0x8ff2('0x23')](_0x224ee6);}return _0x49a01c[_0x8ff2('0x33')]('.')[0x0];});};exports['awsLex']=function(_0x52acc6,_0x3e0e82,_0x115eac,_0x333b1f,_0x440021,_0x256f85){return aws[_0x8ff2('0x77')](_0x52acc6,_0x3e0e82,_0x115eac,_0x333b1f,_0x440021,_0x256f85)['then'](function(_0x57db87){logger[_0x8ff2('0x1e')](JSON['stringify'](_0x57db87));return _0x57db87;});};exports[_0x8ff2('0x78')]=function(_0x9e1d0b,_0x4faf70,_0x26fa0e,_0x9eb741){var _0x4cb819=util[_0x8ff2('0x79')](_0x8ff2('0x7a'),ISPEECH_API,_0x9e1d0b,encodeURIComponent(_0x4faf70),_0x26fa0e,_0x9eb741);var _0x413ddb=path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs['generate'](0x4)+_0x8ff2('0x3c'));var _0x2ca16a;return downloadFile(_0x4cb819,_0x413ddb)[_0x8ff2('0x30')](function(){_0x2ca16a=path['resolve'](__dirname,'tmp',rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x2d'));return convertFile(_0x413ddb,_0x2ca16a);})[_0x8ff2('0x30')](function(){try{fs[_0x8ff2('0x31')](_0x413ddb);fs[_0x8ff2('0x32')](_0x2ca16a,_0x8ff2('0x3f'));}catch(_0x5252e9){logger[_0x8ff2('0x23')](_0x5252e9);}return _0x2ca16a[_0x8ff2('0x33')]('.')[0x0];});};exports['ispeechASR']=function(_0x1e298d,_0x1c8f8e,_0x5220a9,_0x522f2d){var _0x1afe8b=util[_0x8ff2('0x79')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1c8f8e,_0x5220a9,base64Encode(_0x1e298d),_0x522f2d?util['format'](_0x8ff2('0x7b'),encodeURIComponent(_0x522f2d)):_0x8ff2('0x7c'));return uploadFile(_0x1afe8b)[_0x8ff2('0x30')](function(_0x44fa8b){return querystring[_0x8ff2('0xb')](_0x44fa8b);});};exports['sestekNDA']=function(_0x679986,_0x4b3c2d){return sestek[_0x8ff2('0x7d')](_0x679986,_0x4b3c2d)[_0x8ff2('0x30')](function(_0x250553){logger['info'](JSON[_0x8ff2('0x44')](_0x250553));var _0xed9272={'speech':_0x250553['text'],'action':_0x250553[_0x8ff2('0x7e')]?_0x250553[_0x8ff2('0x7e')]['CustomAction']:undefined,'actiondata':_0x250553[_0x8ff2('0x7e')]?_0x250553[_0x8ff2('0x7e')]['CustomActionData']:undefined};if(_0x250553['channelData']&&_0x250553[_0x8ff2('0x7e')]['AudioFromTts']){return base64Decode(_0x250553[_0x8ff2('0x7e')]['AudioFromTts'][_0x8ff2('0x7f')],path[_0x8ff2('0x2a')](__dirname,_0x8ff2('0x2b'),rs[_0x8ff2('0x2c')](0x4)+_0x8ff2('0x2d')))[_0x8ff2('0x30')](function(_0x411fa5){_0xed9272[_0x8ff2('0x80')]=_0x411fa5;return _0xed9272;});}return _0xed9272;});};exports[_0x8ff2('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x3474=['host','WHAT_EVER','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','info','finish\x20download\x20file','close','unlink','pipe','end','data','error\x20convert','finish\x20to\x20convert','start','tmp','generate','.wav','writeFileSync','base64','then','777','split','readFileSync','googleCloudTTS','?key=','ssml','input','audioConfig','MP3','text:synthesize','resolve','.mp3','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','POST','application/x-www-form-urlencoded','jQ1olc','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','googleASR','asr','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','result','resolvedQuery','action','actionIncomplete','fulfillment','score','status','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','fulfillmentText','intent','queryText','intentDetectionConfidence','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./sestek','../../../config/logger','agi','protocol','https:'];(function(_0xd0fd73,_0x248ec8){var _0x5b0240=function(_0x3f7c65){while(--_0x3f7c65){_0xd0fd73['push'](_0xd0fd73['shift']());}};_0x5b0240(++_0x248ec8);}(_0x3474,0x6e));var _0x4347=function(_0x2be5d3,_0x278ef2){_0x2be5d3=_0x2be5d3-0x0;var _0xbaaea8=_0x3474[_0x2be5d3];return _0xbaaea8;};'use strict';var apiai=require(_0x4347('0x0'));var BPromise=require(_0x4347('0x1'));var dialogflow=require(_0x4347('0x2'));var fs=require('fs');var http=require(_0x4347('0x3'));var https=require('https');var md5=require(_0x4347('0x4'));var path=require(_0x4347('0x5'));var querystring=require(_0x4347('0x6'));var rp=require(_0x4347('0x7'));var rs=require('randomstring');var sox=require(_0x4347('0x8'));var tts=require(_0x4347('0x9'));var urlParse=require(_0x4347('0xa'))[_0x4347('0xb')];var util=require(_0x4347('0xc'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x4347('0xd'));var tilde=require('./tilde');var logger=require(_0x4347('0xe'))(_0x4347('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x1c6339,_0x18a2a8){return new BPromise(function(_0x1168e8,_0x52a097){var _0x20d1fd=urlParse(_0x1c6339);var _0x51db1a=_0x20d1fd[_0x4347('0x10')]===_0x4347('0x11')?https:http;var _0x363fa6={'host':_0x20d1fd[_0x4347('0x12')],'path':_0x20d1fd['path'],'headers':{'user-agent':_0x4347('0x13')}};_0x51db1a[_0x4347('0x14')](_0x363fa6,function(_0x3efc7b){if(_0x3efc7b[_0x4347('0x15')]!==0xc8){logger[_0x4347('0x16')](_0x4347('0x17')+_0x1c6339+_0x4347('0x18')+_0x3efc7b[_0x4347('0x15')]+'\x20('+_0x3efc7b['statusMessage']+')');_0x52a097(new Error('request\x20to\x20'+_0x1c6339+_0x4347('0x18')+_0x3efc7b[_0x4347('0x15')]+'\x20('+_0x3efc7b[_0x4347('0x19')]+')'));return;}var _0x47666d=fs['createWriteStream'](_0x18a2a8);_0x47666d['on']('finish',function(){logger[_0x4347('0x1a')](_0x4347('0x1b'));_0x47666d[_0x4347('0x1c')](_0x1168e8);});_0x47666d['on']('error',function(_0xd46529){fs[_0x4347('0x1d')](_0x18a2a8);logger['error']('download\x20error',_0xd46529);_0x52a097(_0xd46529);});_0x3efc7b[_0x4347('0x1e')](_0x47666d);})['on'](_0x4347('0x16'),function(_0x3aefbd){logger[_0x4347('0x16')](_0x3aefbd);_0x52a097(_0x3aefbd);})[_0x4347('0x1f')]();});}function uploadFile(_0x5ae740){return new BPromise(function(_0x167019,_0x4b9f6f){var _0x245c61=urlParse(_0x5ae740);var _0x35a1fb=_0x245c61['protocol']===_0x4347('0x11')?https:http;var _0x4dc78e={'host':_0x245c61['host'],'path':_0x245c61[_0x4347('0x5')],'headers':{'user-agent':_0x4347('0x13')}};_0x35a1fb[_0x4347('0x14')](_0x4dc78e,function(_0x439730){if(_0x439730['statusCode']!==0xc8){_0x4b9f6f(new Error('request\x20to\x20'+_0x5ae740+_0x4347('0x18')+_0x439730[_0x4347('0x15')]+'\x20('+_0x439730[_0x4347('0x19')]+')'));return;}var _0x5cfd39='';_0x439730['on'](_0x4347('0x20'),function(_0x32b923){_0x5cfd39+=_0x32b923;});_0x439730['on'](_0x4347('0x1f'),function(){_0x167019(_0x5cfd39);});})['on']('error',function(_0x2daeba){_0x4b9f6f(_0x2daeba);})[_0x4347('0x1f')]();});}function convertFile(_0x4794f0,_0x4cc69f){return new BPromise(function(_0x34ebca,_0x3ea2a7){var _0xf48814=sox['transcode'](_0x4794f0,_0x4cc69f,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xf48814['on'](_0x4347('0x16'),function(_0x250501){logger[_0x4347('0x16')](_0x4347('0x21'),_0x250501);_0x3ea2a7(_0x250501);});_0xf48814['on']('end',function(){logger[_0x4347('0x1a')](_0x4347('0x22'));_0x34ebca();});_0xf48814[_0x4347('0x23')]();});}function base64Decode(_0x165d58,_0x4ae863){var _0x2f9a63=path['resolve'](__dirname,_0x4347('0x24'),rs[_0x4347('0x25')](0x4)+_0x4347('0x26'));fs[_0x4347('0x27')](_0x2f9a63,_0x165d58,_0x4347('0x28'));return convertFile(_0x2f9a63,_0x4ae863)[_0x4347('0x29')](function(){try{fs[_0x4347('0x1d')](_0x2f9a63);fs['chmodSync'](_0x4ae863,_0x4347('0x2a'));}catch(_0x5de600){logger[_0x4347('0x16')](_0x5de600);}return _0x4ae863[_0x4347('0x2b')]('.')[0x0];});}function base64Encode(_0x41db49){var _0x3e9a49=fs[_0x4347('0x2c')](_0x41db49);return new Buffer(_0x3e9a49)['toString'](_0x4347('0x28'));}exports[_0x4347('0x2d')]=function(_0x559c2f,_0x1877f8,_0x285f1b,_0x4b8191,_0x12da17,_0x55682b){var _0xcd372f,_0x3a547d;var _0xa42389='https://texttospeech.googleapis.com/v1/';var _0x420c7c=_0x4347('0x2e')+_0x559c2f;var _0xe942a8={};if(_0x1877f8===_0x4347('0x2f')){_0xe942a8['input']={'ssml':_0x285f1b};}else{_0xe942a8[_0x4347('0x30')]={'text':_0x285f1b};};_0xe942a8['voice']={'languageCode':_0x4b8191,'ssmlGender':_0x12da17};_0xe942a8[_0x4347('0x31')]={'audioEncoding':_0x4347('0x32'),'sampleRateHertz':0x1f40};var _0x3cf49a={'url':_0xa42389+_0x4347('0x33')+_0x420c7c,'method':'POST','json':!![],'body':_0xe942a8};return rp(_0x3cf49a)[_0x4347('0x29')](function(_0x274ede){return new BPromise(function(_0xe558e,_0x3a0689){_0xcd372f=path[_0x4347('0x34')](__dirname,_0x4347('0x24'),rs[_0x4347('0x25')](0x4)+_0x4347('0x35'));var _0x2a2e2f=Buffer[_0x4347('0x36')](_0x274ede[_0x4347('0x37')],_0x4347('0x28'));return fs[_0x4347('0x38')](_0xcd372f,_0x2a2e2f,function(_0x4da84f){_0x3a0689(_0x4da84f);},function(_0x6ff57){fs[_0x4347('0x39')](_0xcd372f,_0x4347('0x2a'));_0xe558e(_0x6ff57);});});})['then'](function(_0x210ab2){_0x3a547d=path[_0x4347('0x34')](__dirname,_0x4347('0x24'),rs[_0x4347('0x25')](0x4)+_0x4347('0x26'));return convertFile(_0xcd372f,_0x3a547d);})[_0x4347('0x29')](function(){try{fs[_0x4347('0x1d')](_0xcd372f);fs[_0x4347('0x39')](_0x3a547d,_0x4347('0x2a'));}catch(_0x65d850){logger[_0x4347('0x16')](_0x65d850);}logger['info'](_0x4347('0x3a'),_0x3a547d[_0x4347('0x2b')]('.')[0x0]);return _0x3a547d[_0x4347('0x2b')]('.')[0x0];});};exports[_0x4347('0x3b')]=function(_0x3f33c6,_0x2cbdf0){var _0x3a3b08='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x208d1b,_0x4a8a9f;var _0x1167a6;var _0x1c4fa1={'encoding':'utf8','method':_0x4347('0x3c'),'timeout':0x2710,'url':_0x3a3b08,'headers':{'Content-Type':_0x4347('0x3d')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0x4347('0x3e'),JSON[_0x4347('0x3f')]([_0x3f33c6,_0x2cbdf0||'en',![],_0x4347('0x40')]),null,_0x4347('0x41')]]]))};return rp(_0x1c4fa1)['then'](function(_0x37e8d9){try{_0x1167a6=eval(_0x37e8d9[_0x4347('0x42')](0x5))[0x0][0x2];}catch(_0x59ed92){throw new Error(_0x4347('0x43')+_0x37e8d9[_0x4347('0x20')]);}if(!_0x1167a6){if(_0x3f33c6[_0x4347('0x44')]>0xc8){throw new Error(_0x4347('0x45'));}else{throw new Error(_0x4347('0x46')+_0x2cbdf0+_0x4347('0x47'));}}try{_0x1167a6=eval(_0x1167a6)[0x0];}catch(_0x473549){throw new Error(_0x4347('0x43')+res[_0x4347('0x20')]);}const _0x1d1f33=_0x1167a6;_0x208d1b=path['resolve'](__dirname,_0x4347('0x24'),rs['generate'](0x4)+_0x4347('0x35'));fs['writeFileSync'](_0x208d1b,_0x1167a6,{'encoding':_0x4347('0x28')});_0x4a8a9f=path[_0x4347('0x34')](__dirname,'tmp',rs['generate'](0x4)+_0x4347('0x26'));return convertFile(_0x208d1b,_0x4a8a9f);})[_0x4347('0x29')](function(){try{fs['unlink'](_0x208d1b);fs['chmodSync'](_0x4a8a9f,_0x4347('0x2a'));}catch(_0x39948e){logger[_0x4347('0x16')](_0x39948e);}logger['info']('goggleTTS\x20path',_0x4a8a9f[_0x4347('0x2b')]('.')[0x0]);return _0x4a8a9f[_0x4347('0x2b')]('.')[0x0];});};exports[_0x4347('0x48')]=function(_0x5b5b08,_0x22c39b,_0x45832b){return google[_0x4347('0x49')](_0x5b5b08,_0x22c39b,_0x45832b)['then'](function(_0x160e4f){logger[_0x4347('0x1a')](_0x160e4f['uri']);return rp(_0x160e4f);})[_0x4347('0x29')](function(_0x4bb5d2){var _0x1794ee='';var _0x165f22=0x0;try{fs[_0x4347('0x1d')](_0x5b5b08);}catch(_0x27f8ee){logger[_0x4347('0x16')](_0x27f8ee);}if(_0x4bb5d2&&_0x4bb5d2[_0x4347('0x4a')]){_0x1794ee=_0x4bb5d2[_0x4347('0x4a')][_0x4347('0x4b')](function(_0x34c971){return _0x34c971&&_0x34c971[_0x4347('0x4c')][0x0]&&_0x34c971[_0x4347('0x4c')][0x0]['transcript']?_0x34c971[_0x4347('0x4c')][0x0][_0x4347('0x4d')]:'';})[_0x4347('0x4e')]('\x0a');_0x165f22=_0x4bb5d2[_0x4347('0x4a')][_0x4347('0x4b')](function(_0xe05408){return _0xe05408&&_0xe05408[_0x4347('0x4c')][0x0]&&_0xe05408[_0x4347('0x4c')][0x0][_0x4347('0x4f')]?_0xe05408[_0x4347('0x4c')][0x0][_0x4347('0x4f')]:0x0;})['join']('\x0a');}logger[_0x4347('0x1a')](_0x4347('0x50'),_0x1794ee);logger[_0x4347('0x1a')](_0x4347('0x51'),_0x165f22);return{'transcript':_0x1794ee,'confidence':_0x165f22};})[_0x4347('0x52')](function(_0x3253ec){logger[_0x4347('0x16')](_0x4347('0x53'),_0x3253ec[_0x4347('0x15')],_0x3253ec[_0x4347('0x54')],_0x3253ec[_0x4347('0x55')]);});};exports['googleDialogflow']=function(_0x288ec0,_0x4a37b5,_0x576a2a,_0x117cf8){var _0x39c831=apiai(_0x4a37b5,{'language':_0x117cf8||'en'});return _0x39c831['textRequest'](_0x576a2a,{'sessionId':md5(_0x288ec0)})[_0x4347('0x29')](function(_0x174f99){logger[_0x4347('0x1a')](JSON['stringify'](_0x174f99));return{'source':_0x174f99['result']['source'],'resolvedQuery':_0x174f99[_0x4347('0x56')][_0x4347('0x57')],'action':_0x174f99[_0x4347('0x56')][_0x4347('0x58')],'actionIncomplete':_0x174f99[_0x4347('0x56')][_0x4347('0x59')],'speech':_0x174f99['result'][_0x4347('0x5a')]['speech'],'score':_0x174f99['result'][_0x4347('0x5b')],'statusCode':_0x174f99[_0x4347('0x5c')]['code'],'endConversation':_0x174f99[_0x4347('0x56')][_0x4347('0x5d')][_0x4347('0x5e')]||![],'isFallbackIntent':_0x174f99[_0x4347('0x56')][_0x4347('0x5d')]['isFallbackIntent']};});};exports[_0x4347('0x5f')]=function(_0x353293,_0x58cd67,_0x5a6028,_0xc586d,_0x2736ee,_0x89add1){var _0x1cacf4=_0xc586d[_0x4347('0x60')](/\\n/g,'\x0a');var _0x3673fa={'credentials':{'private_key':_0x1cacf4,'client_email':_0x5a6028}};var _0x5950af=new dialogflow['SessionsClient'](_0x3673fa);var _0x23edee=_0x5950af[_0x4347('0x61')](_0x58cd67,md5(_0x353293));var _0x27cefa={'session':_0x23edee,'queryInput':{'text':{'text':_0x2736ee,'languageCode':_0x89add1}}};return _0x5950af[_0x4347('0x62')](_0x27cefa)['then'](function(_0x58b44f){if(_0x58b44f&&_0x58b44f[_0x4347('0x44')]){logger[_0x4347('0x1a')](_0x4347('0x63'),JSON[_0x4347('0x3f')](_0x58b44f));var _0x10cfe9=_0x58b44f[0x0];if(_0x10cfe9){var _0xe0c58e={'action':_0x10cfe9[_0x4347('0x64')][_0x4347('0x58')],'allRequiredParamsPresent':_0x10cfe9['queryResult']['allRequiredParamsPresent'],'endConversation':_0x10cfe9[_0x4347('0x64')][_0x4347('0x65')]&&_0x10cfe9[_0x4347('0x64')]['diagnosticInfo'][_0x4347('0x66')]?_0x10cfe9[_0x4347('0x64')][_0x4347('0x65')][_0x4347('0x66')][_0x4347('0x67')]['boolValue']:![],'fulfillmentText':_0x10cfe9[_0x4347('0x64')][_0x4347('0x68')],'intentName':_0x10cfe9[_0x4347('0x64')][_0x4347('0x69')][_0x4347('0x54')],'intentDisplayName':_0x10cfe9[_0x4347('0x64')][_0x4347('0x69')]['displayName'],'isFallbackIntent':_0x10cfe9[_0x4347('0x64')][_0x4347('0x69')]['isFallback'],'languageCode':_0x10cfe9[_0x4347('0x64')]['languageCode'],'queryText':_0x10cfe9['queryResult'][_0x4347('0x6a')],'responseId':_0x10cfe9['responseId'],'score':_0x10cfe9[_0x4347('0x64')][_0x4347('0x6b')],'speech':_0x10cfe9[_0x4347('0x64')][_0x4347('0x68')],'providerResponse':JSON['stringify'](_0x58b44f)};return _0xe0c58e;}}});};exports['tildeASR']=function(_0x6eac24,_0x404ca1,_0x5bf0af,_0x4d915e){return tilde[_0x4347('0x49')](_0x6eac24,_0x404ca1,_0x5bf0af,_0x4d915e)[_0x4347('0x29')](function(_0x4f811f){try{fs[_0x4347('0x1d')](_0x6eac24);}catch(_0x47a0bc){logger[_0x4347('0x16')](_0x47a0bc);}logger[_0x4347('0x1a')](_0x4347('0x6c'),_0x4f811f[_0x4347('0x4d')]);logger['info']('Tilde\x20ASR\x20confidence',_0x4f811f['confidence']);return _0x4f811f;});};exports[_0x4347('0x6d')]=function(_0x22d743,_0x25eda2,_0xc16964,_0x3d432f,_0x4e24cb,_0x4ad0e6){var _0xa5d518=path['resolve'](__dirname,'tmp',rs[_0x4347('0x25')](0x4)+_0x4347('0x35'));var _0x574bc3;return aws[_0x4347('0x6e')](_0x22d743,_0x25eda2,_0xc16964,_0x3d432f,_0x4e24cb,_0x4ad0e6,_0xa5d518)[_0x4347('0x29')](function(){_0x574bc3=path['resolve'](__dirname,'tmp',rs[_0x4347('0x25')](0x4)+_0x4347('0x26'));return convertFile(_0xa5d518,_0x574bc3);})[_0x4347('0x29')](function(){try{fs[_0x4347('0x1d')](_0xa5d518);fs[_0x4347('0x39')](_0x574bc3,'777');}catch(_0x227618){logger[_0x4347('0x16')](_0x227618);}return _0x574bc3['split']('.')[0x0];});};exports[_0x4347('0x6f')]=function(_0x314d9b,_0x2dbac8,_0x411b96,_0x5f11a7,_0x4a2afb,_0x5a5d39){return aws[_0x4347('0x70')](_0x314d9b,_0x2dbac8,_0x411b96,_0x5f11a7,_0x4a2afb,_0x5a5d39)[_0x4347('0x29')](function(_0x2aeb9e){logger[_0x4347('0x1a')](JSON[_0x4347('0x3f')](_0x2aeb9e));return _0x2aeb9e;});};exports[_0x4347('0x71')]=function(_0x4ed72d,_0x13717b,_0x5ad7d0,_0x42ce08){var _0x2d4fe0=util['format'](_0x4347('0x72'),ISPEECH_API,_0x4ed72d,encodeURIComponent(_0x13717b),_0x5ad7d0,_0x42ce08);var _0x44a3cb=path['resolve'](__dirname,_0x4347('0x24'),rs[_0x4347('0x25')](0x4)+_0x4347('0x35'));var _0x78439b;return downloadFile(_0x2d4fe0,_0x44a3cb)[_0x4347('0x29')](function(){_0x78439b=path['resolve'](__dirname,'tmp',rs[_0x4347('0x25')](0x4)+_0x4347('0x26'));return convertFile(_0x44a3cb,_0x78439b);})[_0x4347('0x29')](function(){try{fs[_0x4347('0x1d')](_0x44a3cb);fs[_0x4347('0x39')](_0x78439b,_0x4347('0x2a'));}catch(_0x172bfb){logger['error'](_0x172bfb);}return _0x78439b['split']('.')[0x0];});};exports[_0x4347('0x73')]=function(_0x565afc,_0x1e9bbd,_0x36a833,_0x4fc60e){var _0x3b91a4=util['format']('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1e9bbd,_0x36a833,base64Encode(_0x565afc),_0x4fc60e?util[_0x4347('0x74')]('model=%s',encodeURIComponent(_0x4fc60e)):_0x4347('0x75'));return uploadFile(_0x3b91a4)[_0x4347('0x29')](function(_0xef7dd0){return querystring[_0x4347('0xb')](_0xef7dd0);});};exports[_0x4347('0x76')]=function(_0xce98e3,_0x1d44b5){return sestek[_0x4347('0x77')](_0xce98e3,_0x1d44b5)[_0x4347('0x29')](function(_0x303334){logger[_0x4347('0x1a')](JSON[_0x4347('0x3f')](_0x303334));var _0x177f69={'speech':_0x303334[_0x4347('0x78')],'action':_0x303334[_0x4347('0x79')]?_0x303334['channelData'][_0x4347('0x7a')]:undefined,'actiondata':_0x303334[_0x4347('0x79')]?_0x303334[_0x4347('0x79')][_0x4347('0x7b')]:undefined};if(_0x303334['channelData']&&_0x303334[_0x4347('0x79')][_0x4347('0x7c')]){return base64Decode(_0x303334[_0x4347('0x79')][_0x4347('0x7c')][_0x4347('0x7d')],path[_0x4347('0x34')](__dirname,_0x4347('0x24'),rs[_0x4347('0x25')](0x4)+'.wav'))['then'](function(_0x16ffce){_0x177f69[_0x4347('0x7e')]=_0x16ffce;return _0x177f69;});}return _0x177f69;});};exports[_0x4347('0x7f')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index bb97182..3163a7e 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 _0xdabf=['exports'];(function(_0x4d0677,_0x2a36a7){var _0x5d14dd=function(_0x201e7f){while(--_0x201e7f){_0x4d0677['push'](_0x4d0677['shift']());}};_0x5d14dd(++_0x2a36a7);}(_0xdabf,0x107));var _0xfdab=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xdabf[_0x2f5ac5];return _0x37c9a8;};var nda=require('./nda');module[_0xfdab('0x0')]={'nda':nda}; \ No newline at end of file +var _0x2871=['exports','./nda'];(function(_0x19af51,_0x3834ac){var _0x997581=function(_0x4ba64c){while(--_0x4ba64c){_0x19af51['push'](_0x19af51['shift']());}};_0x997581(++_0x3834ac);}(_0x2871,0x1b1));var _0x1287=function(_0x1befaf,_0x11caa4){_0x1befaf=_0x1befaf-0x0;var _0x3d34b3=_0x2871[_0x1befaf];return _0x3d34b3;};var nda=require(_0x1287('0x0'));module[_0x1287('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index fb9addd..25feedf 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 _0xdf0c=['username','password','then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','AudioOutputSettings','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','/token'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xdf0c,0x1ab));var _0xcdf0=function(_0x1ea015,_0x5e416a){_0x1ea015=_0x1ea015-0x0;var _0x5ed37f=_0xdf0c[_0x1ea015];return _0x5ed37f;};'use strict';var rp=require(_0xcdf0('0x0'));var url=require('url');var logger=require(_0xcdf0('0x1'))(_0xcdf0('0x2'));module[_0xcdf0('0x3')]=function(_0x436e7e,_0x27f933){var _0xcd76d6={'method':_0xcdf0('0x4'),'uri':url['resolve'](_0x27f933[_0xcdf0('0x5')],_0xcdf0('0x6')),'form':{'grant_type':'password','username':_0x27f933[_0xcdf0('0x7')],'password':_0x27f933[_0xcdf0('0x8')]},'json':!![]};return rp(_0xcd76d6)[_0xcdf0('0x9')](function(_0x5b39b8){var _0x62e18={'method':_0xcdf0('0x4'),'uri':url[_0xcdf0('0xa')](_0x27f933[_0xcdf0('0xb')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x27f933[_0xcdf0('0xc')]||_0xcdf0('0xd'),'channelId':_0xcdf0('0xe'),'conversation':{'id':_0x436e7e[_0xcdf0('0xf')]},'from':{'id':_0x436e7e['callerid'],'name':_0x436e7e[_0xcdf0('0x10')]},'recipient':{'id':_0x436e7e[_0xcdf0('0x11')],'name':_0x436e7e[_0xcdf0('0x12')]},'text':_0x27f933[_0xcdf0('0x13')],'channelData':{}},'headers':{'Authorization':_0xcdf0('0x14')+_0x5b39b8['access_token']},'json':!![]};if(_0x27f933[_0xcdf0('0x15')]){_0x62e18[_0xcdf0('0x16')][_0xcdf0('0x17')]['ProjectName']=_0x27f933[_0xcdf0('0x15')];}if(_0x27f933['ndagenerate_audio']=='1'){_0x62e18['body'][_0xcdf0('0x17')][_0xcdf0('0x18')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x27f933[_0xcdf0('0x19')]){_0x62e18[_0xcdf0('0x16')][_0xcdf0('0x17')][_0xcdf0('0x1a')]=_0x27f933[_0xcdf0('0x19')];if(_0x27f933[_0xcdf0('0x1b')]){_0x62e18[_0xcdf0('0x16')][_0xcdf0('0x17')][_0xcdf0('0x1c')]=_0x27f933[_0xcdf0('0x1b')];}}logger[_0xcdf0('0x1d')](JSON[_0xcdf0('0x1e')](_0x62e18));return rp(_0x62e18);});}; \ No newline at end of file +var _0x9f94=['body','CustomAction','custom_action','CustomActionData','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','POST','resolve','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','calleridname','extension','text','Bearer\x20','access_token','channelData','ProjectName','project','ndagenerate_audio','audio/wav'];(function(_0x11c2e9,_0x43bd7c){var _0x3cb030=function(_0x5e3842){while(--_0x5e3842){_0x11c2e9['push'](_0x11c2e9['shift']());}};_0x3cb030(++_0x43bd7c);}(_0x9f94,0x1e7));var _0x49f9=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9f94[_0x413feb];return _0x40ee88;};'use strict';var rp=require(_0x49f9('0x0'));var url=require(_0x49f9('0x1'));var logger=require(_0x49f9('0x2'))('agi');module['exports']=function(_0x342097,_0x435860){var _0xb643ef={'method':_0x49f9('0x3'),'uri':url[_0x49f9('0x4')](_0x435860['ndauth_url'],_0x49f9('0x5')),'form':{'grant_type':_0x49f9('0x6'),'username':_0x435860[_0x49f9('0x7')],'password':_0x435860[_0x49f9('0x6')]},'json':!![]};return rp(_0xb643ef)[_0x49f9('0x8')](function(_0x2e0928){var _0x355683={'method':_0x49f9('0x3'),'uri':url['resolve'](_0x435860['ndassistant_url'],_0x49f9('0x9')),'body':{'type':_0x435860['ndaactivity_type']||_0x49f9('0xa'),'channelId':_0x49f9('0xb'),'conversation':{'id':_0x342097[_0x49f9('0xc')]},'from':{'id':_0x342097['callerid'],'name':_0x342097[_0x49f9('0xd')]},'recipient':{'id':_0x342097['dnid'],'name':_0x342097[_0x49f9('0xe')]},'text':_0x435860[_0x49f9('0xf')],'channelData':{}},'headers':{'Authorization':_0x49f9('0x10')+_0x2e0928[_0x49f9('0x11')]},'json':!![]};if(_0x435860['project']){_0x355683['body'][_0x49f9('0x12')][_0x49f9('0x13')]=_0x435860[_0x49f9('0x14')];}if(_0x435860[_0x49f9('0x15')]=='1'){_0x355683['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x49f9('0x16')};}if(_0x435860['custom_action']){_0x355683[_0x49f9('0x17')]['channelData'][_0x49f9('0x18')]=_0x435860[_0x49f9('0x19')];if(_0x435860['custom_action_data']){_0x355683[_0x49f9('0x17')][_0x49f9('0x12')][_0x49f9('0x1a')]=_0x435860[_0x49f9('0x1b')];}}logger[_0x49f9('0x1c')](JSON[_0x49f9('0x1d')](_0x355683));return rp(_0x355683);});}; \ 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 2945882..23e1b4f 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 _0x26ad=['exports','./lib/api'];(function(_0x2074db,_0x10b81b){var _0x27324c=function(_0x5c3d5c){while(--_0x5c3d5c){_0x2074db['push'](_0x2074db['shift']());}};_0x27324c(++_0x10b81b);}(_0x26ad,0x199));var _0xd26a=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x26ad[_0x39096d];return _0x13da4f;};'use strict';var asr=require(_0xd26a('0x0'));module[_0xd26a('0x1')]=function(_0x218203,_0x20edf3,_0x35ede9,_0x416160){return asr(_0x218203,_0x20edf3,_0x35ede9,_0x416160);}; \ No newline at end of file +var _0xef91=['exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xef91,0xb9));var _0x1ef9=function(_0x1b515d,_0x3bb1ac){_0x1b515d=_0x1b515d-0x0;var _0x133bee=_0xef91[_0x1b515d];return _0x133bee;};'use strict';var asr=require('./lib/api');module[_0x1ef9('0x0')]=function(_0x566775,_0x241bea,_0x2a8652,_0x1cb543){return asr(_0x566775,_0x241bea,_0x2a8652,_0x1cb543);}; \ 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 f6d7fa2..7b7e5d6 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 _0x9104=['crypto','../../../../../../config/logger','agi','exports','info','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','hex','unix','createReadStream','data','send','close','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message'];(function(_0x50f392,_0x1d8441){var _0x5926f2=function(_0x17df32){while(--_0x17df32){_0x50f392['push'](_0x50f392['shift']());}};_0x5926f2(++_0x1d8441);}(_0x9104,0x6f));var _0x4910=function(_0x2a3dd8,_0x5bd5f0){_0x2a3dd8=_0x2a3dd8-0x0;var _0x51703d=_0x9104[_0x2a3dd8];return _0x51703d;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x4910('0x0'));var logger=require(_0x4910('0x1'))(_0x4910('0x2'));module[_0x4910('0x3')]=function(_0x34b08e,_0x1518a6,_0x3684f8,_0x27bc61){return new BPromise(function(_0xbefbbd,_0x216287){logger[_0x4910('0x4')]('Tilde\x20URI',_0x27bc61||_0x4910('0x5'));var _0x5c37c1=new WebSocket(_0x27bc61||_0x4910('0x5'),{'perMessageDeflate':![]});var _0x5272e2='';var _0x35e3bb='0';var _0x438a82='1';var _0x34f9b3=_0x4910('0x6');function _0x3eebdd(_0x37f922){var _0x356dfb=crypto['createHash']('sha1');_0x356dfb['update'](_0x37f922);return _0x356dfb['digest'](_0x4910('0x7'));}function _0x185cb6(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x22ad6d=moment()[_0x4910('0x8')]();var _0x2084ba=_0x3eebdd(_0x22ad6d+_0x1518a6+_0x3684f8);_0x5c37c1['send'](JSON['stringify']({'appID':_0x1518a6,'timestamp':_0x22ad6d,'appKey':_0x2084ba}));var _0x56dd0d=fs[_0x4910('0x9')](_0x34b08e);_0x56dd0d['on'](_0x4910('0xa'),function(_0x5abccd){_0x5c37c1[_0x4910('0xb')](_0x5abccd);});_0x56dd0d['on'](_0x4910('0xc'),function(){_0x5c37c1['send'](_0x4910('0xd'));});}catch(_0x52c191){logger[_0x4910('0xe')](_0x4910('0xf'),JSON[_0x4910('0x10')](_0x52c191));_0x5c37c1['terminate']();}}function _0x3d1167(_0x40b470){try{if(_0x40b470){var _0xcaabe7=JSON['parse'](_0x40b470);switch(_0xcaabe7[_0x4910('0x11')]){case 0x0:if(_0xcaabe7['result']){if(_0xcaabe7[_0x4910('0x12')][_0x4910('0x13')]){logger[_0x4910('0x4')](_0x4910('0x14'),JSON[_0x4910('0x10')](_0xcaabe7[_0x4910('0x12')][_0x4910('0x15')]));_0x5272e2=_0xcaabe7[_0x4910('0x12')]['hypotheses'][0x0][_0x4910('0x16')];_0x35e3bb=_0xcaabe7[_0x4910('0x12')][_0x4910('0x15')][0x0][_0x4910('0x17')];_0x438a82='0';_0x34f9b3=_0x4910('0x18');_0x5c37c1['terminate']();}}break;case 0x1:logger['info'](_0x4910('0x6'));_0x438a82='1';_0x34f9b3=_0x4910('0x6');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x438a82='2';_0x34f9b3=_0x4910('0x19');break;case 0x9:logger['info'](_0x4910('0x1a'));_0x438a82='9';_0x34f9b3=_0x4910('0x1a');break;case 0xa:logger['info']('Authentication\x20failed.');_0x438a82='10';_0x34f9b3=_0x4910('0x1b');break;case 0xb:logger[_0x4910('0x4')](_0x4910('0x1c'));_0x438a82='11';_0x34f9b3=_0x4910('0x1c');}}}catch(_0x413b1c){logger[_0x4910('0xe')](_0x4910('0x1d'),JSON[_0x4910('0x10')](_0x413b1c));_0x5c37c1[_0x4910('0x1e')]();}}function _0x182f6a(){logger[_0x4910('0x4')](_0x4910('0x1f'));_0xbefbbd({'transcript':_0x5272e2,'confidence':_0x35e3bb,'status':_0x438a82,'status_message':_0x34f9b3});}function _0x8874fc(_0x19fc2b){logger[_0x4910('0xe')](_0x4910('0x20'));if(!_[_0x4910('0x21')](_0x19fc2b)){logger['error'](_[_0x4910('0x22')](_0x19fc2b)?JSON['stringify'](_0x19fc2b):_0x19fc2b);}}_0x5c37c1['on'](_0x4910('0x23'),_0x185cb6);_0x5c37c1['on'](_0x4910('0x24'),_0x3d1167);_0x5c37c1['on']('close',_0x182f6a);_0x5c37c1['on']('error',_0x8874fc);});}; \ No newline at end of file +var _0x9213=['Success.','terminate','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isObject','open','bluebird','lodash','moment','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','sha1','update','digest','hex','send','stringify','createReadStream','data','close','error','Tilde\x20ASR\x20send\x20error','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood'];(function(_0x181fb8,_0x415dc8){var _0x3e7ba8=function(_0x3457c6){while(--_0x3457c6){_0x181fb8['push'](_0x181fb8['shift']());}};_0x3e7ba8(++_0x415dc8);}(_0x9213,0x9a));var _0x3921=function(_0x411e71,_0xf9652){_0x411e71=_0x411e71-0x0;var _0x226ae3=_0x9213[_0x411e71];return _0x226ae3;};'use strict';var BPromise=require(_0x3921('0x0'));var _=require(_0x3921('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x3921('0x2'));var crypto=require('crypto');var logger=require(_0x3921('0x3'))('agi');module[_0x3921('0x4')]=function(_0x5d1afc,_0x4e5a99,_0x4873b0,_0x1994a8){return new BPromise(function(_0x2bf3a9,_0xfbf8f){logger[_0x3921('0x5')](_0x3921('0x6'),_0x1994a8||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3af882=new WebSocket(_0x1994a8||_0x3921('0x7'),{'perMessageDeflate':![]});var _0x4bde9c='';var _0x17f9ed='0';var _0x4f49a6='1';var _0x43fad9='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x348ee8(_0x37075f){var _0x52a2ca=crypto['createHash'](_0x3921('0x8'));_0x52a2ca[_0x3921('0x9')](_0x37075f);return _0x52a2ca[_0x3921('0xa')](_0x3921('0xb'));}function _0x3af427(){try{logger[_0x3921('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0xa80802=moment()['unix']();var _0x573445=_0x348ee8(_0xa80802+_0x4e5a99+_0x4873b0);_0x3af882[_0x3921('0xc')](JSON[_0x3921('0xd')]({'appID':_0x4e5a99,'timestamp':_0xa80802,'appKey':_0x573445}));var _0x4ee524=fs[_0x3921('0xe')](_0x5d1afc);_0x4ee524['on'](_0x3921('0xf'),function(_0x9701c1){_0x3af882[_0x3921('0xc')](_0x9701c1);});_0x4ee524['on'](_0x3921('0x10'),function(){_0x3af882[_0x3921('0xc')]('EOS');});}catch(_0xf5d98c){logger[_0x3921('0x11')](_0x3921('0x12'),JSON[_0x3921('0xd')](_0xf5d98c));_0x3af882['terminate']();}}function _0xd7fd68(_0x5a49a6){try{if(_0x5a49a6){var _0x2eac44=JSON[_0x3921('0x13')](_0x5a49a6);switch(_0x2eac44[_0x3921('0x14')]){case 0x0:if(_0x2eac44[_0x3921('0x15')]){if(_0x2eac44[_0x3921('0x15')]['final']){logger[_0x3921('0x5')](_0x3921('0x16'),JSON['stringify'](_0x2eac44['result'][_0x3921('0x17')]));_0x4bde9c=_0x2eac44[_0x3921('0x15')][_0x3921('0x17')][0x0][_0x3921('0x18')];_0x17f9ed=_0x2eac44['result'][_0x3921('0x17')][0x0][_0x3921('0x19')];_0x4f49a6='0';_0x43fad9=_0x3921('0x1a');_0x3af882[_0x3921('0x1b')]();}}break;case 0x1:logger[_0x3921('0x5')](_0x3921('0x1c'));_0x4f49a6='1';_0x43fad9=_0x3921('0x1c');break;case 0x2:logger[_0x3921('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x4f49a6='2';_0x43fad9=_0x3921('0x1d');break;case 0x9:logger[_0x3921('0x5')](_0x3921('0x1e'));_0x4f49a6='9';_0x43fad9=_0x3921('0x1e');break;case 0xa:logger[_0x3921('0x5')](_0x3921('0x1f'));_0x4f49a6='10';_0x43fad9=_0x3921('0x1f');break;case 0xb:logger[_0x3921('0x5')](_0x3921('0x20'));_0x4f49a6='11';_0x43fad9=_0x3921('0x20');}}}catch(_0xdabb63){logger[_0x3921('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x3921('0xd')](_0xdabb63));_0x3af882[_0x3921('0x1b')]();}}function _0x1c84f3(){logger[_0x3921('0x5')](_0x3921('0x21'));_0x2bf3a9({'transcript':_0x4bde9c,'confidence':_0x17f9ed,'status':_0x4f49a6,'status_message':_0x43fad9});}function _0x2adf51(_0x2683da){logger[_0x3921('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x2683da)){logger[_0x3921('0x11')](_[_0x3921('0x22')](_0x2683da)?JSON[_0x3921('0xd')](_0x2683da):_0x2683da);}}_0x3af882['on'](_0x3921('0x23'),_0x3af427);_0x3af882['on']('message',_0xd7fd68);_0x3af882['on']('close',_0x1c84f3);_0x3af882['on'](_0x3921('0x11'),_0x2adf51);});}; \ 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 e4a76b2..a38e6b9 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 _0x4344=['exports'];(function(_0xf91672,_0x1b7de1){var _0x3e6c9b=function(_0x1f4781){while(--_0x1f4781){_0xf91672['push'](_0xf91672['shift']());}};_0x3e6c9b(++_0x1b7de1);}(_0x4344,0xd1));var _0x4434=function(_0x33b31e,_0x3dbc96){_0x33b31e=_0x33b31e-0x0;var _0x1011f9=_0x4344[_0x33b31e];return _0x1011f9;};var asr=require('./asr');module[_0x4434('0x0')]={'asr':asr}; \ No newline at end of file +var _0x8643=['./asr','exports'];(function(_0x36cca2,_0x17a3a4){var _0x2fe771=function(_0x1d9468){while(--_0x1d9468){_0x36cca2['push'](_0x36cca2['shift']());}};_0x2fe771(++_0x17a3a4);}(_0x8643,0xf2));var _0x3864=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x8643[_0x4154a6];return _0x3b2786;};var asr=require(_0x3864('0x0'));module[_0x3864('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index c1fef62..65c1437 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 _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x18156c,_0x58da5a){var _0x45fd59=function(_0x5d6e82){while(--_0x5d6e82){_0x18156c['push'](_0x18156c['shift']());}};_0x45fd59(++_0x58da5a);}(_0x34e8,0x12c));var _0x834e=function(_0x12f88a,_0x1c4268){_0x12f88a=_0x12f88a-0x0;var _0x2f4163=_0x34e8[_0x12f88a];return _0x2f4163;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9c44[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index b2e9b9d..0556e7f 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 _0x81bd=['Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','operation','no\x20variable\x20found','forEach','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','no\x20find\x20by\x20configured','getPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','sendMailMessage','smtpOptions','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','command','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','catch','getVoiceQueue','getVoiceQueueById','name','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','getUser','getTrunk','getTrunkById','getSound','save_name','getMailAccount','getMailAccountById','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','callback','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','method','timeout','number','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','url','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','googleASR','google_asr_language','tildeASR','clear','includes','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','saveRestApiResult','%s.%s','length','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','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','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','response','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','Trying\x20Amazon\x20Lex:\x20%s','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','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appid','no\x20appid\x20configured','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s'];(function(_0x613696,_0x78f92e){var _0x25834c=function(_0x87ee60){while(--_0x87ee60){_0x613696['push'](_0x613696['shift']());}};_0x25834c(++_0x78f92e);}(_0x81bd,0x7c));var _0xd81b=function(_0x1e33fd,_0x12d3a5){_0x1e33fd=_0x1e33fd-0x0;var _0x4f4ea7=_0x81bd[_0x1e33fd];return _0x4f4ea7;};'use strict';var fs=require('fs');var util=require(_0xd81b('0x0'));var _=require(_0xd81b('0x1'));var sh=require(_0xd81b('0x2'));var odbc=require(_0xd81b('0x3'))();var rs=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var Mustache=require(_0xd81b('0x6'));var rp=require('request-promise');var logger=require(_0xd81b('0x7'))(_0xd81b('0x8'));var config=require(_0xd81b('0x9'));var scripts=require('./scripts');var FILES_PATH=_0xd81b('0xa');var recursiveMapAttributes=[_0xd81b('0xb'),_0xd81b('0xc')];var verticesWithRetry=['menu','getdigits',_0xd81b('0xd')];var AGIVertices=function(_0x5468d5,_0x223515,_0x3ed380){this[_0xd81b('0xe')]=_0x5468d5;this[_0xd81b('0xf')]=_0x223515;this[_0xd81b('0x10')]=_0x3ed380;};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12')]=function(_0x17e09f,_0x2090e1){this[_0xd81b('0xf')][_0xd81b('0x13')](_0x17e09f)[_0xd81b('0x14')](function(_0x1afb8f){_0x2090e1(null,_0x1afb8f?_0x1afb8f['name']:![]);})[_0xd81b('0x15')](function(_0x57f71d){_0x2090e1(_0x57f71d);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x16')]=function(_0x5f0b6b,_0x35a053){this['rpc'][_0xd81b('0x17')](_0x5f0b6b)[_0xd81b('0x14')](function(_0x6c6041){_0x35a053(null,_0x6c6041?_0x6c6041[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x552215){_0x35a053(_0x552215);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x19')]=function(_0x5c2863,_0x2abef4){this[_0xd81b('0xf')][_0xd81b('0x1a')](_0x5c2863)[_0xd81b('0x14')](function(_0x5f7db6){_0x2abef4(null,_0x5f7db6?_0x5f7db6[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x3d4d34){_0x2abef4(_0x3d4d34);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b')]=function(_0x1ff3c6,_0x453952){this[_0xd81b('0xf')][_0xd81b('0x1c')](_0x1ff3c6)[_0xd81b('0x14')](function(_0x4f8c0b){_0x453952(null,_0x4f8c0b?_0x4f8c0b['dsn']:![]);})['catch'](function(_0xc16ad0){_0x453952(_0xc16ad0);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1d')]=function(_0x543fbc,_0x19ed0e){this[_0xd81b('0xf')]['getUserById'](_0x543fbc)[_0xd81b('0x14')](function(_0x13d687){_0x19ed0e(null,_0x13d687?_0x13d687[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0x279176){_0x19ed0e(_0x279176);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1e')]=function(_0x5ecba9,_0x341aec){this[_0xd81b('0xf')][_0xd81b('0x1f')](_0x5ecba9)[_0xd81b('0x14')](function(_0x596389){_0x341aec(null,_0x596389?_0x596389[_0xd81b('0x18')]:![]);})[_0xd81b('0x15')](function(_0xe3637a){_0x341aec(_0xe3637a);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x20')]=function(_0x2d0d02,_0x3e28dd){var _0x73dc09=this;this[_0xd81b('0xf')]['getSoundById'](_0x2d0d02)[_0xd81b('0x14')](function(_0x4e2eff){_0x3e28dd(null,_0x4e2eff?_0x73dc09['getSoundPath'](_0x4e2eff[_0xd81b('0x21')]):![]);})[_0xd81b('0x15')](function(_0x5141e6){_0x3e28dd(_0x5141e6);});};AGIVertices['prototype'][_0xd81b('0x22')]=function(_0xf10fe0,_0x1b1434){this[_0xd81b('0xf')][_0xd81b('0x23')](_0xf10fe0)[_0xd81b('0x14')](function(_0x5527ed){_0x1b1434(null,_0x5527ed?_0x5527ed:![]);})[_0xd81b('0x15')](function(_0x26f629){_0x1b1434(_0x26f629);});};AGIVertices['prototype']['sendMailMessage']=function(_0x165892,_0x1966b1,_0x50472a){this['mailRpc']['sendMailMessage'](_0x165892,_0x1966b1)[_0xd81b('0x14')](function(){_0x50472a(null);})[_0xd81b('0x15')](function(_0x1d2f46){_0x50472a(_0x1d2f46);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x24')]=function(_0x12ee8f,_0x29aabf){this['rpc'][_0xd81b('0x25')](_0x12ee8f)['then'](function(_0x34634a){if(_0x34634a){if(_0x34634a[_0xd81b('0x26')]){_0x29aabf(null,[_0x34634a[_0xd81b('0x27')]]);}else{_0x29aabf(null,_[_0xd81b('0x28')](_0x34634a[_0xd81b('0x29')],_0xd81b('0x27')));}}else{_0x29aabf(null,![]);}})[_0xd81b('0x15')](function(_0x2d23b9){_0x29aabf(_0x2d23b9);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x2a')]=function(_0x1be4e2){return util[_0xd81b('0x2b')](_0xd81b('0x2c'),FILES_PATH,_0x1be4e2);};AGIVertices['prototype']['getQueryOdbc']=function(_0x413bf6,_0x46119e,_0x401430){odbc['open'](_0x413bf6,function(_0x362ebc){if(_0x362ebc){logger[_0xd81b('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x362ebc);_0x401430(_0x362ebc);}else{logger[_0xd81b('0x2e')](_0xd81b('0x2f'));odbc['query'](_0x46119e,function(_0xed5272,_0x5a48e8){if(_0xed5272){logger[_0xd81b('0x2e')](_0xd81b('0x30'),_0x46119e);_0x401430(_0xed5272);}else{logger[_0xd81b('0x2e')](_0xd81b('0x31'),_0x46119e);odbc['close'](function(_0x77bec8){if(_0x77bec8){logger[_0xd81b('0x2d')](_0xd81b('0x32'),_0x77bec8);}_0x401430(null,_0x5a48e8);});}});}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x33')]=function(_0x466e98,_0x3976fc){this['rpc'][_0xd81b('0x34')](_0x466e98)[_0xd81b('0x14')](function(_0x5185fe){_0x3976fc(null,_0x5185fe?_0x5185fe:![]);})['catch'](function(_0x3bea7d){_0x3976fc(_0x3bea7d);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x35')]=function(_0x1cd745,_0x29bddd){this['rpc'][_0xd81b('0x35')](_0x1cd745)[_0xd81b('0x14')](function(_0x448e24){_0x29bddd(null,_0x448e24);})[_0xd81b('0x15')](function(_0x3a51e6){_0x29bddd(_0x3a51e6);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x36')]=function(_0x486f0d,_0x4405a8,_0x3ba339){this[_0xd81b('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'node':_0x486f0d[_0xd81b('0x38')],'application':_0x486f0d[_0xd81b('0x39')],'data':_0x4405a8||null,'project_name':this[_0xd81b('0xe')][_0xd81b('0x3a')],'callerid':this[_0xd81b('0xe')][_0xd81b('0x3b')]})['then'](function(_0x4ea161){if(_0x3ba339){_0x3ba339(null,_0x4ea161);}})[_0xd81b('0x15')](function(_0x31eb63){if(_0x3ba339){_0x3ba339(_0x31eb63);}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x3c')]=function(_0x1f5d84,_0x37031b,_0x334bd0,_0x2e44f3){this[_0xd81b('0xf')][_0xd81b('0x3c')]({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'callerid':this['channel'][_0xd81b('0x3b')],'calleridname':this[_0xd81b('0xe')][_0xd81b('0x3d')],'context':this[_0xd81b('0xe')][_0xd81b('0x3e')],'extension':this[_0xd81b('0xe')][_0xd81b('0x3f')],'priority':this[_0xd81b('0xe')][_0xd81b('0x40')],'accountcode':this['channel'][_0xd81b('0x41')],'dnid':this[_0xd81b('0xe')][_0xd81b('0x42')],'projectName':this[_0xd81b('0xe')]['arg_1'],'saveName':_0x37031b,'filename':_0x1f5d84[_0xd81b('0x43')]||_0x37031b,'savePath':_0x334bd0})[_0xd81b('0x14')](function(_0x15030b){_0x2e44f3(null,_0x15030b);})[_0xd81b('0x15')](function(_0x2699e6){_0x2e44f3(_0x2699e6);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x44')]=function(_0x43d7ce,_0x133a76,_0x49cba6,_0x534d10,_0x328fd7){this[_0xd81b('0xf')][_0xd81b('0x44')]({'uniqueid':this[_0xd81b('0xe')][_0xd81b('0x37')],'body':_0x43d7ce,'direction':_0x133a76,'providerName':_0x49cba6,'providerResponse':_0x534d10})[_0xd81b('0x14')](function(_0x75bcfb){if(_0x328fd7){_0x328fd7(null,_0x75bcfb);}})[_0xd81b('0x15')](function(_0x4e039e){if(_0x328fd7){_0x328fd7(_0x4e039e);}});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x45')]=function(_0x1b523c,_0x3d171a){this[_0xd81b('0xf')]['createCmContact']({'firstName':_[_0xd81b('0x46')](_0x1b523c[_0xd81b('0x18')])||_['isNil'](_0x1b523c[_0xd81b('0x18')])?_0xd81b('0x47')+Math[_0xd81b('0x48')]():_0x1b523c[_0xd81b('0x18')],'lastName':_[_0xd81b('0x46')](_0x1b523c[_0xd81b('0x49')])||_[_0xd81b('0x4a')](_0x1b523c[_0xd81b('0x49')])?null:_0x1b523c[_0xd81b('0x49')],'phone':_0x1b523c[_0xd81b('0x4b')],'ListId':_0x1b523c[_0xd81b('0x4c')],'scheduledat':_0x1b523c['scheduledAt'],'callbackUniqueid':this[_0xd81b('0xe')]['uniqueid'],'tags':_0xd81b('0x4d'),'description':_0xd81b('0x4e')+_0x1b523c[_0xd81b('0x4f')][_0xd81b('0x50')](),'priority':_0x1b523c[_0xd81b('0x51')]})[_0xd81b('0x14')](function(_0x5c196a){_0x3d171a(null,_0x5c196a);})[_0xd81b('0x15')](function(_0xe0c9c6){_0x3d171a(_0xe0c9c6);});};AGIVertices['prototype']['getPause']=function(_0x470d40,_0x59e018){this[_0xd81b('0xf')]['getPauseById'](_0x470d40)[_0xd81b('0x14')](function(_0x315a66){_0x59e018(null,_0x315a66?_0x315a66[_0xd81b('0x18')]:![]);})['catch'](function(_0x27415d){_0x59e018(_0x27415d);});};AGIVertices[_0xd81b('0x11')]['agentPause']=function(_0x3ea4d5,_0x108aaf,_0x5951ec){var _0x1ba5d6={'role':'agent'};_0x1ba5d6[_0x3ea4d5]=this[_0xd81b('0xe')][_0xd81b('0x3b')];this[_0xd81b('0xf')][_0xd81b('0x52')](_0x1ba5d6,_0x108aaf,this[_0xd81b('0xe')][_0xd81b('0x37')])[_0xd81b('0x14')](function(_0x24dfce){_0x5951ec(null,_[_0xd81b('0x4a')](_0x24dfce)?![]:!![]);})[_0xd81b('0x15')](function(_0x5c4533){logger[_0xd81b('0x2d')](_0x5c4533);_0x5951ec(null,![]);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x53')]=function(_0x3e4c33,_0x1bdf37){var _0x15416a={'role':_0xd81b('0x54')};_0x15416a[_0x3e4c33]=this['channel']['callerid'];this['rpc'][_0xd81b('0x53')](_0x15416a)[_0xd81b('0x14')](function(_0x37507e){_0x1bdf37(null,_[_0xd81b('0x4a')](_0x37507e)?![]:!![]);})[_0xd81b('0x15')](function(_0x448a99){logger[_0xd81b('0x2d')](_0x448a99);_0x1bdf37(null,![]);});};AGIVertices['prototype'][_0xd81b('0x55')]=function(_0x29a824,_0x35c9cf){var _0x2090e9={'role':_0xd81b('0x54')};_0x2090e9[_0x29a824]=this[_0xd81b('0xe')][_0xd81b('0x3b')];this['rpc'][_0xd81b('0x55')](_0x2090e9)[_0xd81b('0x14')](function(_0x12b2a7){_0x35c9cf(null,_[_0xd81b('0x4a')](_0x12b2a7)?![]:!![]);})[_0xd81b('0x15')](function(_0x1cbd4a){logger[_0xd81b('0x2d')](_0x1cbd4a);_0x35c9cf(null,![]);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x56')]=function(_0x3174ca,_0x462d12){var _0x43d40d={'role':'agent'};_0x43d40d[_0x3174ca]=this[_0xd81b('0xe')]['callerid'];var _0x2e7141=_0x3174ca!=_0xd81b('0x57')?util[_0xd81b('0x2b')](_0xd81b('0x58'),_0xd81b('0x59'),this[_0xd81b('0xe')][_0xd81b('0x3b')]):undefined;this[_0xd81b('0xf')][_0xd81b('0x56')](_0x43d40d,_0x2e7141)[_0xd81b('0x14')](function(_0x5bcfd7){_0x462d12(null,_[_0xd81b('0x4a')](_0x5bcfd7)?![]:!![]);})[_0xd81b('0x15')](function(_0x3e6457){logger[_0xd81b('0x2d')](_0x3e6457);_0x462d12(null,![]);});};AGIVertices[_0xd81b('0x11')]['shellCommand']=function(_0x582ca1,_0x3274d2){sh[_0xd81b('0x5a')](_[_0xd81b('0x5b')](_0x582ca1),function(_0x45b5a2,_0x2b0730){var _0x1a95d5=_0x2b0730[_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'');_0x3274d2(null,_0x1a95d5);});};AGIVertices['prototype'][_0xd81b('0x5d')]=function(_0x41ac46,_0x9fd6d){scripts[_0xd81b('0x5d')](_0x41ac46[_0xd81b('0x5e')],_0x41ac46[_0xd81b('0x5f')]||_0xd81b('0x60'),_0x41ac46[_0xd81b('0x60')],_0x41ac46[_0xd81b('0x61')]||'en-US',_0x41ac46[_0xd81b('0x62')]||_0xd81b('0x63'),_0x41ac46[_0xd81b('0x64')]||_0xd81b('0x65'))[_0xd81b('0x14')](function(_0x5bbc49){_0x9fd6d(null,_0x5bbc49);})[_0xd81b('0x15')](function(_0x16b2c2){_0x9fd6d(_0x16b2c2);});};AGIVertices['prototype'][_0xd81b('0x66')]=function(_0x43e593,_0x490ab9){scripts[_0xd81b('0x66')](_0x43e593[_0xd81b('0x60')],_0x43e593[_0xd81b('0x67')]||'en',0x1)['then'](function(_0x2aff4b){_0x490ab9(null,_0x2aff4b);})[_0xd81b('0x15')](function(_0x9eee46){_0x490ab9(_0x9eee46);});};AGIVertices['prototype']['restAPI']=function(_0xdd970d,_0x950cc3){var _0x36c694={'uri':_0xdd970d['url'],'method':_0xdd970d[_0xd81b('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xdd970d[_0xd81b('0x69')])===_0xd81b('0x6a')&&parseInt(_0xdd970d[_0xd81b('0x69')])>=0x1?parseInt(_0xdd970d['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0xd81b('0x6b'),_0xd81b('0x6c')],_0x36c694[_0xd81b('0x68')][_0xd81b('0x6d')]())){try{_0x36c694['body']=_0xdd970d[_0xd81b('0xc')]?JSON[_0xd81b('0x6e')](_0xdd970d['rawBody']):{};}catch(_0x46e36b){logger['error'](_0xd81b('0x6f'),_0x46e36b);}}try{_0x36c694[_0xd81b('0x70')]=_0xdd970d['rawHeaders']?JSON[_0xd81b('0x6e')](_0xdd970d[_0xd81b('0xb')]):{};}catch(_0xb96f2f){logger[_0xd81b('0x2d')](_0xd81b('0x71'),_0xb96f2f);}if(_0xdd970d['computedVariables']){try{var _0x2cea52=require(_0xdd970d[_0xd81b('0x72')])[_0xd81b('0x73')](this,_0x36c694);_0x36c694[_0xd81b('0x74')]=Mustache[_0xd81b('0x75')](_0xdd970d[_0xd81b('0x76')],_0x2cea52,{},['$$','$$']);if(_0x36c694['headers']){_0x36c694['headers']=JSON[_0xd81b('0x6e')](Mustache[_0xd81b('0x75')](JSON[_0xd81b('0x77')](_0x36c694[_0xd81b('0x70')]),_0x2cea52,{},['$$','$$']));}if(_0x36c694['body']){_0x36c694[_0xd81b('0x78')]=JSON[_0xd81b('0x6e')](Mustache[_0xd81b('0x75')](JSON[_0xd81b('0x77')](_0x36c694[_0xd81b('0x78')]),_0x2cea52,{},['$$','$$']));}}catch(_0x589882){logger[_0xd81b('0x2d')](_0xd81b('0x79'),_0x589882);}}rp(_0x36c694)[_0xd81b('0x14')](function(_0x40b468){var _0x1d596c={'statusCode':_0x40b468[_0xd81b('0x7a')]||0xc8,'statusMessage':_0x40b468[_0xd81b('0x7b')]||'OK','headers':_0x40b468['headers']||{},'body':_0x40b468[_0xd81b('0x78')]||{}};_0x950cc3(null,_0x1d596c);})[_0xd81b('0x15')](function(_0x19cfaf){var _0x346184={'statusCode':_0x19cfaf[_0xd81b('0x7a')]||0x1f4,'statusMessage':_0x19cfaf[_0xd81b('0x7c')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x19cfaf[_0xd81b('0x7d')]['headers']||{},'body':_0x19cfaf[_0xd81b('0x7d')][_0xd81b('0x78')]||{}};_0x950cc3(null,_0x346184);});};AGIVertices[_0xd81b('0x11')]['googleDialogflow']=function(_0x197529,_0x27f848){scripts[_0xd81b('0x7e')](this[_0xd81b('0xe')][_0xd81b('0x37')],_0x197529[_0xd81b('0x7f')],_0x197529['text'],_0x197529[_0xd81b('0x80')]||'en')['then'](function(_0x5f5514){_0x27f848(null,_0x5f5514);})[_0xd81b('0x15')](function(_0x428317){_0x27f848(_0x428317);});};AGIVertices[_0xd81b('0x11')]['googleDialogflowV2']=function(_0x270d32,_0x31c206){scripts[_0xd81b('0x81')](this[_0xd81b('0xe')][_0xd81b('0x37')],_0x270d32[_0xd81b('0x82')],_0x270d32['client_email'],_0x270d32[_0xd81b('0x83')],_0x270d32[_0xd81b('0x60')],_0x270d32[_0xd81b('0x84')]||'en')[_0xd81b('0x14')](function(_0x19792d){_0x31c206(null,_0x19792d);})[_0xd81b('0x15')](function(_0x977603){_0x31c206(_0x977603);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x85')]=function(_0x3162dc,_0x2fea95){scripts[_0xd81b('0x85')](this[_0xd81b('0xe')],_0x3162dc)[_0xd81b('0x14')](function(_0x36d8fd){_0x2fea95(null,_0x36d8fd);})['catch'](function(_0x1c61e5){_0x2fea95(_0x1c61e5);});};AGIVertices['prototype'][_0xd81b('0x86')]=function(_0x265013,_0x1ca94b){scripts[_0xd81b('0x86')](_0x265013[_0xd81b('0x7f')],_0x265013[_0xd81b('0x60')],_0x265013['ispeech_tts_language']||_0xd81b('0x87'),_0x265013[_0xd81b('0x88')])[_0xd81b('0x14')](function(_0x3ebb20){_0x1ca94b(null,_0x3ebb20);})[_0xd81b('0x15')](function(_0x6e4c25){_0x1ca94b(_0x6e4c25);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x89')]=function(_0x132a3d,_0xfacc8f,_0xc2782c){scripts[_0xd81b('0x89')](_0xfacc8f,_0x132a3d['key'],_0x132a3d[_0xd81b('0x8a')]||_0xd81b('0x87'),this[_0xd81b('0x8b')](_0x132a3d[_0xd81b('0x8c')])?_0x132a3d[_0xd81b('0x8c')]:undefined)['then'](function(_0x421c2b){_0xc2782c(null,_0x421c2b);})[_0xd81b('0x15')](function(_0x1c9e9a){_0xc2782c(_0x1c9e9a);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x8d')]=function(_0x423f9c,_0x4e4919){scripts[_0xd81b('0x8d')](_0x423f9c['aws_access_key_id'],_0x423f9c[_0xd81b('0x8e')],_0x423f9c[_0xd81b('0x8f')],_0x423f9c[_0xd81b('0x90')]||_0xd81b('0x91'),_0x423f9c['text'],_0x423f9c[_0xd81b('0x92')]||_0xd81b('0x60'))['then'](function(_0x62dddb){_0x4e4919(null,_0x62dddb);})[_0xd81b('0x15')](function(_0x2c1a0e){_0x4e4919(_0x2c1a0e);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x93')]=function(_0x4c8925,_0x53f368){scripts[_0xd81b('0x93')](this['channel'][_0xd81b('0x37')],_0x4c8925['aws_access_key_id'],_0x4c8925['aws_secret_access_key'],_0x4c8925[_0xd81b('0x94')],_0x4c8925[_0xd81b('0x60')],_0x4c8925['aws_bot_name'])['then'](function(_0x2ea82d){_0x53f368(null,_0x2ea82d);})[_0xd81b('0x15')](function(_0x553ed4){_0x53f368(_0x553ed4);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x95')]=function(_0x45f720,_0x2e780d,_0x58c4e9){scripts[_0xd81b('0x95')](_0x2e780d,_0x45f720[_0xd81b('0x7f')],_0x45f720[_0xd81b('0x96')]||'en-US')['then'](function(_0x1fa66c){_0x58c4e9(null,_0x1fa66c);})[_0xd81b('0x15')](function(_0x451ae5){_0x58c4e9(_0x451ae5);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x97')]=function(_0x4c28f5,_0x5c612a,_0x380b4f){scripts[_0xd81b('0x97')](_0x5c612a,_0x4c28f5['appid'],_0x4c28f5['appsecret'],_0x4c28f5[_0xd81b('0x74')])[_0xd81b('0x14')](function(_0x207072){_0x380b4f(null,_0x207072);})[_0xd81b('0x15')](function(_0x168c15){_0x380b4f(_0x168c15);});};AGIVertices[_0xd81b('0x11')][_0xd81b('0x98')]=function(_0x35d8ce){var _0x183aba=_[_0xd81b('0x99')](verticesWithRetry,_0x35d8ce['agicommand'])?_0x35d8ce:_['clone'](_0x35d8ce);for(var _0x1d8280 in _0x183aba){if(_0x183aba[_0xd81b('0x9a')](_0x1d8280)){if(_0x183aba[_0x1d8280]&&_[_0xd81b('0x9b')](_0x183aba[_0x1d8280])){if(_[_0xd81b('0x99')](recursiveMapAttributes,_0x1d8280)){_0x183aba[_0x1d8280]=this[_0xd81b('0x9c')](_0x183aba[_0x1d8280]);}else{_0x183aba[_0x1d8280]=this[_0xd81b('0x9d')](_0x183aba[_0x1d8280]);}}}}return _0x183aba;};AGIVertices[_0xd81b('0x11')][_0xd81b('0x9e')]=function(_0x45f607){for(var _0x179218 in _0x45f607){if(_0x45f607[_0xd81b('0x9a')](_0x179218)){if(_[_0xd81b('0x9f')](_0x45f607[_0x179218])){this[_0xd81b('0x9e')](_0x45f607[_0x179218]);}else if(_[_0xd81b('0xa0')](_0x45f607[_0x179218])){for(var _0x1d8acf=0x0;_0x1d8acf<_0x45f607[_0x179218]['length'];_0x1d8acf++){this[_0xd81b('0x9e')](_0x45f607[_0x179218][_0x1d8acf]);}}else if(_[_0xd81b('0x9b')](_0x45f607[_0x179218])){_0x45f607[_0x179218]=this[_0xd81b('0x9d')](_0x45f607[_0x179218]);}}}};AGIVertices['prototype'][_0xd81b('0xa1')]=function(_0x3bd28c,_0x38acb7){for(var _0xc336b5 in _0x3bd28c){if(_0x3bd28c[_0xd81b('0x9a')](_0xc336b5)){if(_['isPlainObject'](_0x3bd28c[_0xc336b5])){if(!_[_0xd81b('0x46')](_0x3bd28c[_0xc336b5])){this[_0xd81b('0xa1')](_0x3bd28c[_0xc336b5],util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5));}}else if(_[_0xd81b('0xa0')](_0x3bd28c[_0xc336b5])){for(var _0x19feb5=0x0;_0x19feb5<_0x3bd28c[_0xc336b5][_0xd81b('0xa3')];_0x19feb5++){this[_0xd81b('0xa1')](_0x3bd28c[_0xc336b5][_0x19feb5],util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5+'['+_0x19feb5+']'));}}else{if(!_[_0xd81b('0x4a')](_0x3bd28c[_0xc336b5])){this[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x38acb7,_0xc336b5),_0x3bd28c[_0xc336b5]);}}}}};AGIVertices[_0xd81b('0x11')]['replaceObjectAllVariables']=function(_0x32cd46){try{var _0x1f1b84=JSON[_0xd81b('0x6e')](_0x32cd46);this[_0xd81b('0x9e')](_0x1f1b84);return JSON['stringify'](_0x1f1b84);}catch(_0x1e5f94){return this['replaceAllVariables'](_0x32cd46);}};AGIVertices['prototype'][_0xd81b('0x9d')]=function(_0x26548a){var _0x22e737=_0x26548a[_0xd81b('0xa4')]('{');for(var _0x5866ca=0x1;_0x5866ca<_0x22e737['length'];_0x5866ca+=0x1){var _0x5cfc2e=_0x22e737[_0x5866ca][_0xd81b('0xa4')]('}');if(_0x5cfc2e[_0xd81b('0xa3')]>0x1){_0x26548a=_0x26548a[_0xd81b('0xa5')]('{'+_0x5cfc2e[0x0]+'}',this[_0xd81b('0xe')][_0xd81b('0x12')](_0x5cfc2e[0x0])[_0xd81b('0xa6')]||_0x5cfc2e[0x0]);}}if(_0x22e737[_0xd81b('0xa3')]===0x1){return _0x26548a[_0xd81b('0x50')]();}return this[_0xd81b('0x9d')](_0x26548a);};AGIVertices[_0xd81b('0x11')][_0xd81b('0xa7')]=function(_0xe1a24f,_0x45fa1d){var _0x19d57e=this[_0xd81b('0xe')][_0xd81b('0x12')](_0xe1a24f);if(_0x19d57e[_0xd81b('0xa8')]===-0x1){return _0x19d57e;}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xa9'),_0x45fa1d,_0x19d57e['extra']));return this[_0xd81b('0xe')][_0xd81b('0xaa')](_0x45fa1d,_0x19d57e[_0xd81b('0xa6')]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x8b')]=function(_0x56d83d){return _0x56d83d&&_0x56d83d!=='0'&&_0x56d83d!=='-1'&&_0x56d83d!=='';};AGIVertices[_0xd81b('0x11')][_0xd81b('0xab')]=function(_0x59a51a){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x59a51a,'-');_0x59a51a[_0xd81b('0xac')]=_0x59a51a[_0xd81b('0xab')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd81b('0x11')][_0xd81b('0xad')]=function(_0x22e808){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xae'),_0x22e808[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x22e808[_0xd81b('0x60')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xaf'));}var _0x5aacc3='\x22'+_0x22e808[_0xd81b('0x60')]+'\x22';if(this[_0xd81b('0x8b')](_0x22e808[_0xd81b('0x7d')])){_0x5aacc3+=','+_0x22e808['options'];}var _0xf13081=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xb0'),_0x5aacc3);if(_0xf13081['result']===-0x1){return _0xf13081;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x5aacc3));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xb3')]=function(_0x1fb144){logger['info'](util['format'](_0xd81b('0xb4'),_0x1fb144[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x1fb144['grammar'])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x56e8e1=_0x1fb144[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0x1fb144[_0xd81b('0x7d')])){_0x56e8e1+=','+_0x1fb144[_0xd81b('0x7d')];}var _0x150ac8=this[_0xd81b('0xe')][_0xd81b('0x5a')]('MRCPRecog',_0x56e8e1);if(_0x150ac8[_0xd81b('0xa8')]===-0x1){return _0x150ac8;}var _0x4265c2=this[_0xd81b('0xa7')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x4265c2[_0xd81b('0xa8')]===-0x1){return _0x4265c2;}var _0x3c5ea6=this[_0xd81b('0xa7')](_0xd81b('0xb7'),_0xd81b('0xb8'));if(_0x3c5ea6[_0xd81b('0xa8')]===-0x1){return _0x3c5ea6;}var _0x151693=this[_0xd81b('0xa7')]('RECOG_INSTANCE()',_0xd81b('0xb9'));if(_0x151693[_0xd81b('0xa8')]===-0x1){return _0x151693;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0xba'),_0x56e8e1));};AGIVertices['prototype'][_0xd81b('0x8')]=function(_0xecf9c6){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0xbb'),_0xecf9c6[_0xd81b('0x38')]));return this['channel'][_0xd81b('0x8')]([_0xecf9c6['command'],_0xecf9c6[_0xd81b('0xbc')]]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0xbd')]=function(_0x539668){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xbe'),_0x539668[_0xd81b('0x38')]));if(this[_0xd81b('0x8b')](_0x539668[_0xd81b('0x69')])){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xbf'),_0x539668[_0xd81b('0x69')]));var _0x535de5=this[_0xd81b('0xe')][_0xd81b('0xc0')](_0x539668[_0xd81b('0x69')]);if(_0x535de5[_0xd81b('0xa8')]===-0x1){return _0x535de5;}}return this[_0xd81b('0xe')][_0xd81b('0xbd')]();};AGIVertices[_0xd81b('0x11')]['callback']=function(_0x4bb34f){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xc1'),_0x4bb34f['label']));if(!this[_0xd81b('0x8b')](_0x4bb34f['list_id'])){return this['channel'][_0xd81b('0x2d')](_0x4bb34f,_0xd81b('0xc2'));}_0x4bb34f[_0xd81b('0x4f')]=moment();if(this[_0xd81b('0x8b')](_0x4bb34f[_0xd81b('0xc3')])){_0x4bb34f[_0xd81b('0x4f')]=moment()[_0xd81b('0xc4')](_0x4bb34f[_0xd81b('0xc3')],_0xd81b('0xc5'));}if(!this[_0xd81b('0x8b')](_0x4bb34f[_0xd81b('0x51')])){_0x4bb34f[_0xd81b('0x51')]=0x2;}this[_0xd81b('0x45')][_0xd81b('0x73')](this,_0x4bb34f);return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xc6'),_0x4bb34f['phone'],_0x4bb34f[_0xd81b('0x4c')],_0x4bb34f['scheduledAt']));};AGIVertices[_0xd81b('0x11')]['custom_app']=function(_0x1698c6){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xc7'),_0x1698c6[_0xd81b('0x38')]));var _0x2164d4=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0x1698c6[_0xd81b('0xc8')],_0x1698c6[_0xd81b('0x7d')]);if(_0x2164d4[_0xd81b('0xa8')]===-0x1){return _0x2164d4;}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0x1698c6[_0xd81b('0xc8')],_0x1698c6[_0xd81b('0x7d')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xca')]=function(_0x1f11b8){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xcb'),_0x1f11b8['label']));if(!this[_0xd81b('0x8b')](_0x1f11b8[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')]('no\x20text\x20configured');}var _0x1e57a7='\x22'+_0x1f11b8[_0xd81b('0x60')]+'\x22';if(this['isConfigured'](_0x1f11b8[_0xd81b('0x7d')])){_0x1e57a7+=','+_0x1f11b8[_0xd81b('0x7d')];}var _0x3255bd=this[_0xd81b('0xe')]['exec'](_0xd81b('0xb0'),_0x1e57a7);if(_0x3255bd[_0xd81b('0xa8')]===-0x1){return _0x3255bd;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x1e57a7));};AGIVertices['prototype'][_0xd81b('0xcc')]=function(_0xd8b792){logger[_0xd81b('0x2e')](util['format']('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0xd8b792[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0xd8b792[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}var _0x3458f9='\x22'+_0xd8b792[_0xd81b('0x60')]+'\x22';if(this[_0xd81b('0x8b')](_0xd8b792[_0xd81b('0x7d')])){_0x3458f9+=','+_0xd8b792['options'];}var _0xae5c8a=this[_0xd81b('0xe')]['exec'](_0xd81b('0xb0'),_0x3458f9);if(_0xae5c8a[_0xd81b('0xa8')]===-0x1){return _0xae5c8a;}return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xb2'),_0x3458f9));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xcd')]=function(_0xbb5c88){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0xce'),_0xbb5c88[_0xd81b('0x38')]));if(!this['isConfigured'](_0xbb5c88[_0xd81b('0xb6')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x41ebdb=_0xbb5c88[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0xbb5c88[_0xd81b('0x7d')])){_0x41ebdb+=','+_0xbb5c88['options'];}var _0x359de7=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xcf'),_0x41ebdb);if(_0x359de7[_0xd81b('0xa8')]===-0x1){return _0x359de7;}var _0x3fe936=this[_0xd81b('0xa7')](_0xd81b('0xd0'),_0xd81b('0xd1'));if(_0x3fe936[_0xd81b('0xa8')]===-0x1){return _0x3fe936;}var _0x35a758=this['getAndSetVariable']('RECOG_INPUT()',_0xd81b('0xd2'));if(_0x35a758[_0xd81b('0xa8')]===-0x1){return _0x35a758;}var _0x344de5=this['getAndSetVariable'](_0xd81b('0xd3'),_0xd81b('0xd4'));if(_0x344de5[_0xd81b('0xa8')]===-0x1){return _0x344de5;}return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('Executed\x20command\x20MRCPRecog\x20%s',_0x41ebdb));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xd5')]=function(_0x201251){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xd6'),_0x201251[_0xd81b('0x38')]));if(!this['isConfigured'](_0x201251[_0xd81b('0xb6')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xb5'));}var _0x4cc13f=_0x201251[_0xd81b('0xb6')];if(this[_0xd81b('0x8b')](_0x201251[_0xd81b('0x7d')])){_0x4cc13f+=','+_0x201251[_0xd81b('0x7d')];}var _0x3a6e15=this[_0xd81b('0xe')][_0xd81b('0x5a')]('MRCPRecog',_0x4cc13f);if(_0x3a6e15[_0xd81b('0xa8')]===-0x1){return _0x3a6e15;}var _0x5aa337=this['getAndSetVariable'](_0xd81b('0xd0'),'SESTEK_ASR_CONFIDENCE');if(_0x5aa337[_0xd81b('0xa8')]===-0x1){return _0x5aa337;}var _0xcc186c=this[_0xd81b('0xa7')](_0xd81b('0xb7'),'SESTEK_ASR_TRANSCRIPT');if(_0xcc186c['result']===-0x1){return _0xcc186c;}var _0x3a331c=this[_0xd81b('0xa7')]('RECOG_INSTANCE()',_0xd81b('0xd7'));if(_0x3a331c[_0xd81b('0xa8')]===-0x1){return _0x3a331c;}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0xba'),_0x4cc13f));};AGIVertices['prototype'][_0xd81b('0xd8')]=function(_0x38e584){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xd9'),_0x38e584['label']));if(!this['isConfigured'](_0x38e584[_0xd81b('0xda')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x38e584,_0xd81b('0xdb'));}var _0x4cdfd6=this[_0xd81b('0x1b')]['sync'](this,_0x38e584[_0xd81b('0xda')]);if(!_0x4cdfd6){return this[_0xd81b('0xe')]['error'](_0x38e584,_0xd81b('0xdc'));}if(!this[_0xd81b('0x8b')](_0x38e584[_0xd81b('0xdd')])){return this['channel'][_0xd81b('0x2d')](_0x38e584,_0xd81b('0xde'));}var _0x807068=_0x38e584['query'][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xdf'),_0x807068));var _0x5b6a62=this['getQueryOdbc'][_0xd81b('0x73')](this,_0x4cdfd6,_0x807068);this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x38e584,_0x807068);if(!this[_0xd81b('0x8b')](_0x38e584['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xe0'));}var _0x47e47e=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x38e584[_0xd81b('0xe1')]);if(!_0x47e47e){return this['channel']['error'](_0x38e584,'no\x20variable\x20found');}var _0x2a40ac=this;_0x5b6a62['forEach'](function(_0x2a3be5,_0x3d7a57){Object[_0xd81b('0xe2')](_0x2a3be5)['forEach'](function(_0x5c04ec){_0x2a40ac[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xe3'),_0x47e47e,_0x3d7a57,_0x5c04ec),_0x2a3be5[_0x5c04ec]);});});this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format'](_0xd81b('0xe4'),_0x47e47e),_0x5b6a62[_0xd81b('0xa3')]);return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')]('variable\x20%s\x20set',_0x47e47e));};AGIVertices[_0xd81b('0x11')][_0xd81b('0xe5')]=function(_0x5ceeb0){logger[_0xd81b('0xe6')](util[_0xd81b('0x2b')](_0xd81b('0xe7'),_0x5ceeb0['label']));if(!this['isConfigured'](_0x5ceeb0[_0xd81b('0xe8')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x5ceeb0,_0xd81b('0xe9'));}var _0x2e611d=this[_0xd81b('0x1d')][_0xd81b('0x73')](this,_0x5ceeb0['sip_id']);if(!_0x2e611d){return this['channel'][_0xd81b('0x2d')](_0x5ceeb0,_0xd81b('0xea'));}var _0x35cfba=this[_0xd81b('0xe')]['exec'](_0xd81b('0xeb'),[util[_0xd81b('0x2b')](_0xd81b('0xec'),_0x2e611d),_0x5ceeb0[_0xd81b('0x69')],_0x5ceeb0[_0xd81b('0xed')],_0x5ceeb0['url']]);if(_0x35cfba['result']===-0x1){return _0x35cfba;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xee'),_0xd81b('0xeb')));};AGIVertices['prototype']['dialogflow']=function(_0x30ddbd){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0xef'),_0x30ddbd[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x30ddbd[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}if(!this[_0xd81b('0x8b')](_0x30ddbd[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')][_0xd81b('0xf1')]=!![];this[_0xd81b('0x36')](_0x30ddbd);this['createSquareMessage'](_0x30ddbd[_0xd81b('0x60')],'in','','');this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xf2'),_0x30ddbd[_0xd81b('0x60')]));var _0x518c27=this[_0xd81b('0x7e')]['sync'](this,_0x30ddbd);if(_0x518c27){for(var _0xbe831f in _0x518c27){if(_0x518c27[_0xd81b('0x9a')](_0xbe831f)){this['channel'][_0xd81b('0xaa')](util['format'](_0xd81b('0xf3'),_0xbe831f[_0xd81b('0x6d')]()),_0x518c27[_0xbe831f]);}}this[_0xd81b('0x44')](_0x518c27[_0xd81b('0xf4')],_0xd81b('0xf5'),_0xd81b('0xf6'),'');return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xf7'),_0x518c27[_0xd81b('0xf4')]));}return this[_0xd81b('0xe')]['error'](_0x30ddbd,_0xd81b('0xf8'));};AGIVertices['prototype'][_0xd81b('0xf9')]=function(_0x911652){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0xfa'),_0x911652[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x911652['dialogflowV2_project_id'])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0xfb'));}if(!this['isConfigured'](_0x911652[_0xd81b('0xfc')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xfd'));}if(!this[_0xd81b('0x8b')](_0x911652[_0xd81b('0x83')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xfe'));}if(!this['isConfigured'](_0x911652['dialogflowV2_language'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xff'));}if(!this[_0xd81b('0x8b')](_0x911652[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xf1')]=!![];this['createSquareDetailsReport'](_0x911652);this[_0xd81b('0x44')](_0x911652[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x100'),_0x911652[_0xd81b('0x60')]));var _0x44f52d=this[_0xd81b('0x81')][_0xd81b('0x73')](this,_0x911652);if(_0x44f52d){for(var _0x139127 in _0x44f52d){if(_0x44f52d[_0xd81b('0x9a')](_0x139127)){if(_0x139127!==_0xd81b('0x101')){this[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')](_0xd81b('0xf3'),_0x139127[_0xd81b('0x6d')]()),_0x44f52d[_0x139127]);}}}this[_0xd81b('0x44')](_0x44f52d[_0xd81b('0xf4')],'out',_0xd81b('0xf9'),_0x44f52d['providerResponse']);return this['channel'][_0xd81b('0xb1')](util['format'](_0xd81b('0x102'),_0x44f52d[_0xd81b('0xf4')]));}return this[_0xd81b('0xe')]['error'](_0x911652,_0xd81b('0x103'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x104')]=function(_0x576d9d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x105'),_0x576d9d[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x106')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x107'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x108')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x109'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x10a')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x10b'));}if(!this[_0xd81b('0x8b')](_0x576d9d[_0xd81b('0x10c')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')]['bot']=!![];this[_0xd81b('0x36')](_0x576d9d);this[_0xd81b('0x44')](_0x576d9d[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x10d'),_0x576d9d[_0xd81b('0x60')]));var _0x1ece61=this['sestekNDA'][_0xd81b('0x73')](this,_0x576d9d);if(_0x1ece61){for(var _0x4f0ae9 in _0x1ece61){if(_0x1ece61['hasOwnProperty'](_0x4f0ae9)){this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format'](_0xd81b('0x10e'),_0x4f0ae9['toUpperCase']()),_0x1ece61[_0x4f0ae9]);}}this[_0xd81b('0x44')](_0x1ece61[_0xd81b('0xf4')],_0xd81b('0xf5'),_0xd81b('0x104'),'');if(_0x1ece61['audiofile']){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x10f'),_0x1ece61[_0xd81b('0x110')]));var _0x315ff2=this['channel'][_0xd81b('0x111')](_0x1ece61['audiofile']);try{fs['unlink'](_0x1ece61[_0xd81b('0x110')]+_0xd81b('0x112'));}catch(_0xb2d684){logger['error'](_0xb2d684);}return _0x315ff2;}else{return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format']('SestekNDA\x20Result\x20%s',_0x1ece61[_0xd81b('0xf4')]));}}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x576d9d,_0xd81b('0x113'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x114')]=function(_0x462925){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x115'),_0x462925[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x114'));};AGIVertices['prototype'][_0xd81b('0x116')]=function(_0x2afc53){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x117'),_0x2afc53[_0xd81b('0x38')]));var _0x280659='';if(_0x2afc53['trunk_id']){if(!this[_0xd81b('0x8b')](_0x2afc53[_0xd81b('0x118')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,_0xd81b('0x119'));}else{var _0x349a3a=parseInt(_0x2afc53['trunk_id'],0xa);if(isNaN(_0x349a3a)){_0x280659=_0x2afc53[_0xd81b('0x118')];}else{_0x280659=this[_0xd81b('0x1e')][_0xd81b('0x73')](this,_0x2afc53[_0xd81b('0x118')]);if(!_0x280659){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,'no\x20trunk\x20found');}}}}else if(_0x2afc53['trunk_name']){_0x280659=_0x2afc53[_0xd81b('0x11a')];}else{return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2afc53,_0xd81b('0x119'));}var _0x4dcfc5=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0xeb'),[util[_0xd81b('0x2b')](_0xd81b('0x11b'),_0x280659,_0x2afc53['phone']),_0x2afc53[_0xd81b('0x69')],_0x2afc53['opts'],_0x2afc53[_0xd81b('0x76')]]);if(_0x4dcfc5[_0xd81b('0xa8')]===-0x1){return _0x4dcfc5;}return this['channel']['noop'](util[_0xd81b('0x2b')]('Executed\x20command\x20%s','DIAL'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x11c')]=function(_0x644bfa){logger['info'](util['format'](_0xd81b('0x11d'),_0x644bfa[_0xd81b('0x38')]));return this[_0xd81b('0xe')]['noop'](_0xd81b('0x11c'));};AGIVertices[_0xd81b('0x11')]['getdigits']=function(_0x578042){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x11e'),_0x578042['label']));if(_0x578042[_0xd81b('0xac')]===0x0){return this[_0xd81b('0xab')](_0x578042);}_0x578042['retry']-=0x1;if(!this[_0xd81b('0x8b')](_0x578042[_0xd81b('0x11f')])){return this[_0xd81b('0xe')]['error'](_0x578042,'no\x20file\x20audio\x20selected');}var _0x446347=this[_0xd81b('0x20')][_0xd81b('0x73')](this,_0x578042[_0xd81b('0x11f')]);if(!_0x446347){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x578042,_0xd81b('0x120'));}if(!this[_0xd81b('0x8b')](_0x578042['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0xd81b('0xe0'));}var _0x597a04=this[_0xd81b('0xe')]['getData'](_0x446347,_0x578042[_0xd81b('0x121')],_0x578042['maxdigit']);var _0x3611b7=_0x597a04[_0xd81b('0xa8')]?_0x597a04[_0xd81b('0xa8')][_0xd81b('0x50')]():'';logger[_0xd81b('0x2e')](_0xd81b('0x122'),JSON['stringify'](_0x597a04));if(_0x597a04['result']===-0x1){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x578042,_0x3611b7);return _0x597a04;}else if(_0x597a04[_0xd81b('0xa6')]===_0xd81b('0x69')){_0x597a04[_0xd81b('0xa8')]=_0x3611b7[_0xd81b('0xa3')]>=parseInt(_0x578042[_0xd81b('0x123')])?'x':'i';}else{_0x597a04[_0xd81b('0xa8')]=_0x3611b7['length']>=parseInt(_0x578042[_0xd81b('0x123')])&&_0x3611b7[_0xd81b('0xa3')]<=parseInt(_0x578042[_0xd81b('0x124')])?'x':'i';}var _0x13ff41=this['getVariable'][_0xd81b('0x73')](this,_0x578042[_0xd81b('0xe1')]);if(!_0x13ff41){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x578042,'no\x20variable\x20found');}this[_0xd81b('0xe')]['setVariable'](_0x13ff41,_0x3611b7);if(this['isConfigured'](_0x578042[_0xd81b('0x125')])){var _0x402139=parseInt(_0x578042[_0xd81b('0x125')],0xa);var _0xd93765=rs[_0xd81b('0x126')]({'charset':'*','length':_0x402139});var _0x47302d=_0x3611b7[_0xd81b('0xa3')];if(_0x47302d>0x0){if(_0x47302d>_0x402139){this['createSquareDetailsReport'][_0xd81b('0x73')](this,_0x578042,_0x578042[_0xd81b('0x127')]===_0xd81b('0x128')?_0xd93765+_0x3611b7[_0xd81b('0x129')](_0x402139):_0x3611b7['substr'](0x0,_0x47302d-_0x402139)+_0xd93765);}else{this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x578042,rs['generate']({'charset':'*','length':_0x47302d}));}}else{this[_0xd81b('0x36')]['sync'](this,_0x578042,'');}}else{this[_0xd81b('0x36')]['sync'](this,_0x578042,_0x3611b7);}return _0x597a04;};AGIVertices['prototype'][_0xd81b('0xd')]=function(_0x23637d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x23637d[_0xd81b('0x38')]));return this['getdigits'](_0x23637d);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12a')]=function(_0x1ce30a){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x12b'),_0x1ce30a[_0xd81b('0x38')]));this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x1ce30a,_0x1ce30a['goalname']);return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x12c'),_0x1ce30a[_0xd81b('0x12d')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x12e')]=function(_0x23139c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x23139c[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x12f')])||!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x8e')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x130'));}if(!this[_0xd81b('0x8b')](_0x23139c[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x131'),_0x23139c['text']));var _0x16ccac=this['awsPolly'][_0xd81b('0x73')](this,_0x23139c);if(_0x16ccac){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x132'),_0x16ccac));var _0x4e6c6d=this[_0xd81b('0xe')][_0xd81b('0x111')](_0x16ccac);try{fs[_0xd81b('0x133')](_0x16ccac+'.wav');}catch(_0x4cfe08){logger[_0xd81b('0x2d')](_0x4cfe08);}return _0x4e6c6d;}return this[_0xd81b('0xe')]['error'](_0x23139c,_0xd81b('0x134'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x135')]=function(_0x442777){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x136'),_0x442777[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x442777[_0xd81b('0x12f')])||!this[_0xd81b('0x8b')](_0x442777[_0xd81b('0x8e')])){return this[_0xd81b('0xe')]['noop'](_0xd81b('0x130'));}if(!this['isConfigured'](_0x442777[_0xd81b('0x137')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20bot\x20name\x20configured');}if(!this[_0xd81b('0x8b')](_0x442777['text'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this['channel']['bot']=!![];this[_0xd81b('0x36')](_0x442777);this[_0xd81b('0x44')](_0x442777[_0xd81b('0x60')],'in','','');this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x138'),_0x442777[_0xd81b('0x60')]));var _0x1e63ed=this[_0xd81b('0x93')]['sync'](this,_0x442777);if(_0x1e63ed){for(var _0x549d83 in _0x1e63ed){if(_0x1e63ed[_0xd81b('0x9a')](_0x549d83)&&_[_0xd81b('0x9b')](_0x1e63ed[_0x549d83])){this[_0xd81b('0xe')][_0xd81b('0xaa')](util[_0xd81b('0x2b')](_0xd81b('0x139'),_0x549d83['toUpperCase']()),_0x1e63ed[_0x549d83]);}}if(_[_0xd81b('0x4a')](_0x1e63ed[_0xd81b('0x7c')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0x13a'));}else{this[_0xd81b('0x44')](_0x1e63ed[_0xd81b('0x7c')],'out',_0xd81b('0x13b'),'');return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x13c'),_0x1e63ed[_0xd81b('0x7c')]));}}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x442777,_0xd81b('0x13d'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x13e')]=function(_0x5d1635){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x13f'),_0x5d1635[_0xd81b('0x38')],_0x5d1635[_0xd81b('0x69')]));if(!this[_0xd81b('0x8b')](_0x5d1635[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}var _0x4eae4a=_0xd81b('0x140');var _0x388752=util['format'](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x350116=util[_0xd81b('0x2b')]('%s.%s',_0x388752,_0x4eae4a);var _0x14ab05=!![];if(_0x5d1635[_0xd81b('0x142')]===_0xd81b('0x143')){_0x14ab05=![];}var _0x1cdadd=this[_0xd81b('0xe')][_0xd81b('0x144')](_0x388752,_0x4eae4a,_0x5d1635[_0xd81b('0x145')],_0x5d1635[_0xd81b('0x69')],undefined,_0x14ab05);if(_0x1cdadd[_0xd81b('0xa8')]!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x146'),_0x350116));var _0xd66831=this[_0xd81b('0x95')]['sync'](this,_0x5d1635,_0x350116);if(_0xd66831){for(var _0x428f8a in _0xd66831){if(_0xd66831[_0xd81b('0x9a')](_0x428f8a)){this[_0xd81b('0xe')]['setVariable'](util['format'](_0xd81b('0x147'),_0x428f8a['toUpperCase']()),_0xd66831[_0x428f8a]);}}return this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x148'),JSON[_0xd81b('0x77')](_0xd66831)));}}return _0x1cdadd;};AGIVertices[_0xd81b('0x11')]['tildeasr']=function(_0x5d1f6d){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x149'),_0x5d1f6d[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x5d1f6d[_0xd81b('0x14a')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x14b'));}if(!this['isConfigured'](_0x5d1f6d['appsecret'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20appsecret\x20configured');}var _0x28e08c=_0xd81b('0x140');var _0x33513f=util[_0xd81b('0x2b')](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x54b2ed=util['format'](_0xd81b('0xa2'),_0x33513f,_0x28e08c);var _0x2b2473=!![];if(_0x5d1f6d['beep']==='NOBEEP'){_0x2b2473=![];}var _0x4259fc=this[_0xd81b('0xe')]['recordFile'](_0x33513f,_0x28e08c,_0x5d1f6d[_0xd81b('0x145')],_0x5d1f6d[_0xd81b('0x69')],undefined,_0x2b2473);if(_0x4259fc['result']!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('tilde\x20%s\x20file\x20created',_0x54b2ed));var _0x3312ad=this[_0xd81b('0x97')][_0xd81b('0x73')](this,_0x5d1f6d,_0x54b2ed);if(_0x3312ad){for(var _0x12bfd9 in _0x3312ad){if(_0x3312ad[_0xd81b('0x9a')](_0x12bfd9)){this['channel'][_0xd81b('0xaa')](util[_0xd81b('0x2b')](_0xd81b('0x14c'),_0x12bfd9[_0xd81b('0x6d')]()),_0x3312ad[_0x12bfd9]);}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x14d'),JSON[_0xd81b('0x77')](_0x3312ad)));}}return _0x4259fc;};AGIVertices[_0xd81b('0x11')]['gotoc']=function(_0x407136){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x14e'),_0x407136[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x14f')](_0x407136['context'],_0x407136['extension'],_0x407136[_0xd81b('0x40')]);};AGIVertices[_0xd81b('0x11')][_0xd81b('0x150')]=function(_0x4b671e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x151'),_0x4b671e[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x4b671e['condition'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x4b671e,_0xd81b('0x152'));}try{var _0x344d8b=eval(_0x4b671e[_0xd81b('0x153')])?_0xd81b('0x154'):_0xd81b('0x155');this['channel']['noop'](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4b671e['condition'],_0x344d8b));return{'code':0xc8,'result':_0x344d8b};}catch(_0x1c6d38){return{'code':0xc8,'result':_0xd81b('0x155')};}};AGIVertices[_0xd81b('0x11')]['gotoiftime']=function(_0x19c078){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x156'),_0x19c078[_0xd81b('0x38')]));if(!this['isConfigured'](_0x19c078[_0xd81b('0x157')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x19c078,_0xd81b('0x158'));}var _0x251bf4=this[_0xd81b('0x24')]['sync'](this,_0x19c078['interval_id']);if(!_0x251bf4){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x19c078,_0xd81b('0x159'));}for(var _0x78978b=0x0;_0x78978b<_0x251bf4['length'];_0x78978b+=0x1){var _0x295677=this['channel'][_0xd81b('0x12')](util[_0xd81b('0x2b')](_0xd81b('0x15a'),_0x251bf4[_0x78978b]));if(_0x295677[_0xd81b('0xa8')]===-0x1){return _0x295677;}logger['info'](util['format'](_0xd81b('0x15b'),_0x251bf4[_0x78978b],_0x295677[_0xd81b('0xa6')]));if(_0x295677[_0xd81b('0xa6')]===_0xd81b('0x154')){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'true'));this[_0xd81b('0xe')]['noop'](util['format']('IFTIME\x20%s\x20%s',_0x251bf4[_0x78978b],_0xd81b('0x154')));return{'code':0xc8,'result':_0xd81b('0x154')};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'false'));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x15b'),_0x251bf4[_0x78978b],'false'));}}return{'code':0xc8,'result':'false'};};AGIVertices[_0xd81b('0x11')][_0xd81b('0x15c')]=function(_0x50226c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x15d'),_0x50226c[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x15c')]();};AGIVertices[_0xd81b('0x11')]['ispeechasr']=function(_0x5af74d){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x15e'),_0x5af74d['label']));if(!this[_0xd81b('0x8b')](_0x5af74d[_0xd81b('0x7f')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0xf0'));}var _0x142028=_0xd81b('0x140');var _0x3f08ec=util['format'](_0xd81b('0x141'),FILES_PATH,rs[_0xd81b('0x126')](0x4));var _0x1329dc=util[_0xd81b('0x2b')](_0xd81b('0xa2'),_0x3f08ec,_0x142028);var _0x583de6=!![];if(_0x5af74d[_0xd81b('0x142')]==='NOBEEP'){_0x583de6=![];}var _0x29e4f7=this[_0xd81b('0xe')][_0xd81b('0x144')](_0x3f08ec,_0x142028,_0x5af74d[_0xd81b('0x145')],_0x5af74d['timeout'],undefined,_0x583de6);if(_0x29e4f7[_0xd81b('0xa8')]!==-0x1){this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x15f'),_0x1329dc));var _0x3aeb44=this['ispeechASR'][_0xd81b('0x73')](this,_0x5af74d,_0x1329dc);if(_0x3aeb44){for(var _0x48b2d0 in _0x3aeb44){if(_0x3aeb44[_0xd81b('0x9a')](_0x48b2d0)){this['channel']['setVariable'](util['format'](_0xd81b('0x160'),_0x48b2d0['toUpperCase']()),_0x3aeb44[_0x48b2d0]);}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x161'),JSON[_0xd81b('0x77')](_0x3aeb44)));}}return _0x29e4f7;};AGIVertices[_0xd81b('0x11')]['ispeechtts']=function(_0x5f10b0){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x162'),_0x5f10b0[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x5f10b0['key'])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xf0'));}if(!this[_0xd81b('0x8b')](_0x5f10b0[_0xd81b('0x60')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x163'),_0x5f10b0[_0xd81b('0x60')]));var _0x478d3a=this[_0xd81b('0x86')]['sync'](this,_0x5f10b0);if(_0x478d3a){this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x15f'),_0x478d3a));var _0x2a5068=this['channel'][_0xd81b('0x111')](_0x478d3a,_0x5f10b0[_0xd81b('0x145')]);try{fs[_0xd81b('0x133')](_0x478d3a+_0xd81b('0x112'));}catch(_0x3807b6){logger[_0xd81b('0x2d')](_0x3807b6);}return _0x2a5068;}return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x5f10b0,_0xd81b('0x164'));};AGIVertices['prototype'][_0xd81b('0x165')]=function(_0x37aceb){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x166'),_0x37aceb[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x37aceb[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x37aceb,'no\x20find\x20by\x20configured');}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x37aceb[_0xd81b('0x167')]));var _0x2d927c=this[_0xd81b('0x56')][_0xd81b('0x73')](this,_0x37aceb['findBy']);if(_0x2d927c){logger['info'](util[_0xd81b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x37aceb[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this[_0xd81b('0xe')]['callerid'],_0x37aceb[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this['channel']['callerid'],_0x37aceb[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')]['callerid'],_0x37aceb[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x16d')]=function(_0x207681){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16e'),_0x207681[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x207681[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x207681,'no\x20find\x20by\x20configured');}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681[_0xd81b('0x167')]));var _0xd6d130=this['agentLogout'][_0xd81b('0x73')](this,_0x207681[_0xd81b('0x167')]);if(_0xd6d130){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681['findBy']));this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this['channel'][_0xd81b('0x3b')],_0x207681['findBy']));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x16b'),this['channel'][_0xd81b('0x3b')],_0x207681['findBy']));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x207681[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices[_0xd81b('0x11')][_0xd81b('0x16f')]=function(_0x2f9752){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x170'),_0x2f9752['label']));if(!this['isConfigured'](_0x2f9752['operation'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2f9752,_0xd81b('0x171'));}this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('math\x20%s',_0x2f9752[_0xd81b('0x172')]));var _0x36fa37=eval(_0x2f9752[_0xd81b('0x172')]);if(!this[_0xd81b('0x8b')](_0x2f9752[_0xd81b('0xe1')])){return this['channel'][_0xd81b('0xb1')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x391945=this['getVariable'][_0xd81b('0x73')](this,_0x2f9752['variable_id']);if(!_0x391945){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x2f9752,_0xd81b('0x173'));}if(_['isArray'](_0x36fa37)){var _0x34012b=this;_0x36fa37[_0xd81b('0x174')](function(_0x155ad6,_0x5e8fc4){_0x34012b[_0xd81b('0xe')]['setVariable'](util[_0xd81b('0x2b')]('%s[%s]',_0x391945,_0x5e8fc4),_0x155ad6);});return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x175'),_0x391945));}else{return this[_0xd81b('0xe')][_0xd81b('0xaa')](_0x391945,_0x36fa37);}};AGIVertices['prototype'][_0xd81b('0x176')]=function(_0x40582c){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x177'),_0x40582c[_0xd81b('0x38')]));if(_0x40582c[_0xd81b('0xac')]===0x0){return this[_0xd81b('0xab')](_0x40582c);}_0x40582c[_0xd81b('0xac')]-=0x1;if(!this[_0xd81b('0x8b')](_0x40582c['file_id'])){return this[_0xd81b('0xe')]['error'](_0x40582c,_0xd81b('0x178'));}var _0x5e493e=this[_0xd81b('0x20')][_0xd81b('0x73')](this,_0x40582c[_0xd81b('0x11f')]);if(!_0x5e493e){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40582c,_0xd81b('0x120'));}var _0xca844a=this['channel'][_0xd81b('0x179')](_0x5e493e,_0x40582c[_0xd81b('0x121')],_0x40582c[_0xd81b('0x17a')]);var _0x21906c=_0xca844a['result'];if(_0xca844a[_0xd81b('0xa8')]===-0x1){this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x40582c,'-1');return _0xca844a;}else if(_0xca844a[_0xd81b('0xa6')]==='timeout'){_0xca844a['result']=_0xca844a[_0xd81b('0xa8')][_0xd81b('0xa3')]>0x0?_0xca844a[_0xd81b('0xa8')]:'t';}else if(_[_0xd81b('0x46')](_0xca844a[_0xd81b('0xa8')])){_0xca844a[_0xd81b('0xa8')]='#';_0x21906c='#';}if(!this[_0xd81b('0x8b')](_0x40582c['variable_id'])){this[_0xd81b('0xe')]['noop'](_0xd81b('0xe0'));}else{var _0x189e1e=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x40582c[_0xd81b('0xe1')]);if(!_0x189e1e){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40582c,_0xd81b('0x173'));}this[_0xd81b('0xe')]['setVariable'](_0x189e1e,_0x21906c);}this[_0xd81b('0x36')]['sync'](this,_0x40582c,_0x21906c);return _0xca844a;};AGIVertices[_0xd81b('0x11')][_0xd81b('0xb1')]=function(_0x221fb8){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x17b'),_0x221fb8['label']));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0x221fb8[_0xd81b('0x17c')]||_0x221fb8['label']);};AGIVertices[_0xd81b('0x11')]['pause']=function(_0x40969c){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x17d'),_0x40969c[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x40969c['findBy'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x40969c,_0xd81b('0x17e'));}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));var _0x577e2d=this[_0xd81b('0x17f')][_0xd81b('0x73')](this,_0x40969c['pause_id']);var _0x25fd90=this[_0xd81b('0x52')]['sync'](this,_0x40969c['findBy'],_0x577e2d);if(_0x25fd90){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x40969c[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')]['callerid'],_0x40969c[_0xd81b('0x167')]));this[_0xd81b('0xe')]['noop'](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x40969c[_0xd81b('0x167')]));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x180')]=function(_0x24118e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x181'),_0x24118e[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x24118e['file_id'])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x24118e,_0xd81b('0x178'));}var _0x9d89a3=this['getSound']['sync'](this,_0x24118e[_0xd81b('0x11f')]);if(!_0x9d89a3){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x24118e,'no\x20file\x20audio\x20found');}var _0xc760e6=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0x182'),[_0x9d89a3,_0x24118e[_0xd81b('0xed')]]);if(_0xc760e6[_0xd81b('0xa8')]===-0x1){return _0xc760e6;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x182'),_0x9d89a3));};AGIVertices[_0xd81b('0x11')]['queue']=function(_0x9effad){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x183'),_0x9effad['label']));if(!this[_0xd81b('0x8b')](_0x9effad[_0xd81b('0x184')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x9effad,'no\x20queue\x20selected');}var _0xacc35a='';var _0x4de77c=parseInt(_0x9effad[_0xd81b('0x184')],0xa);if(isNaN(_0x4de77c)){_0xacc35a=_0x9effad[_0xd81b('0x184')];}else{_0xacc35a=this[_0xd81b('0x16')]['sync'](this,_0x9effad['queue_id']);if(!_0xacc35a){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x9effad,'no\x20queue\x20found');}}var _0x383fba='';if(this[_0xd81b('0x8b')](_0x9effad[_0xd81b('0x11f')])){var _0x4ea8a3=this['getSound'][_0xd81b('0x73')](this,_0x9effad['file_id']);if(_0x4ea8a3){_0x383fba=_0x4ea8a3;}}this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x9effad,_0xacc35a);if(_0x9effad[_0xd81b('0xed')]['indexOf']('x')<0x0){_0x9effad[_0xd81b('0xed')]+='x';}if(_0x9effad[_0xd81b('0xed')][_0xd81b('0x185')]('X')<0x0){_0x9effad['opts']+='X';}this[_0xd81b('0xe')][_0xd81b('0xaa')](_0xd81b('0x186'),_0xacc35a?_0xacc35a[_0xd81b('0x187')]():'');var _0x1c47bb=this['channel']['exec'](_0xd81b('0x188'),[_0xacc35a,_0x9effad[_0xd81b('0xed')],_0x9effad[_0xd81b('0x76')],_0x383fba,_0x9effad[_0xd81b('0x69')],_0x9effad[_0xd81b('0x8')],_0x9effad[_0xd81b('0x189')],_0x9effad[_0xd81b('0x18a')],'',_0x9effad[_0xd81b('0x18b')]]);if(_0x1c47bb[_0xd81b('0xa8')]===-0x1){return _0x1c47bb;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x188'),_0xacc35a));};AGIVertices['prototype'][_0xd81b('0x18c')]=function(_0x264076){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x18d'),_0x264076[_0xd81b('0x38')]));var _0x1da395=_0x264076['recordingFormat']||_0xd81b('0x140');var _0x30b506=util['format'](_0xd81b('0x18e'),this[_0xd81b('0xe')][_0xd81b('0x37')],rs[_0xd81b('0x126')](0x5));var _0x3d6d7a=util[_0xd81b('0x2b')]('%s/recordings/%s.%s',FILES_PATH,_0x30b506,_0x1da395);var _0x1f7604=util[_0xd81b('0x2b')](_0xd81b('0x141'),FILES_PATH,_0x30b506);this[_0xd81b('0x3c')][_0xd81b('0x73')](this,_0x264076,_0x30b506,_0x3d6d7a);this[_0xd81b('0xe')]['setVariable'](_0xd81b('0x18f'),_0x30b506);logger['info'](_0xd81b('0x190'),_0x1f7604,_0x1da395,_0x264076[_0xd81b('0x191')],_0x264076['timeout']);return this[_0xd81b('0xe')][_0xd81b('0x144')](_0x1f7604,_0x1da395,_0x264076['escape_digits'],_0x264076['timeout'],undefined,!![]);};AGIVertices['prototype'][_0xd81b('0x192')]=function(_0x25d01d){logger['info'](util['format'](_0xd81b('0x193'),_0x25d01d['label']));if(!this['isConfigured'](_0x25d01d[_0xd81b('0x76')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')]('no\x20url\x20configured');}var _0x427d4c=this[_0xd81b('0x194')][_0xd81b('0x73')](this,_0x25d01d);logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x195'),util[_0xd81b('0x196')](_0x427d4c,{'showHidden':![],'depth':null})));if(!this[_0xd81b('0x8b')](_0x25d01d['variable_id'])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x197'));}var _0x5987bf=this['getVariable'][_0xd81b('0x73')](this,_0x25d01d[_0xd81b('0xe1')]);if(!_0x5987bf){return this['channel']['error'](_0x25d01d,_0xd81b('0x173'));}this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format']('%s_STATUS_CODE',_0x5987bf),_0x427d4c[_0xd81b('0x7a')]?_0x427d4c['statusCode']:_0xd81b('0x198'));this[_0xd81b('0xe')][_0xd81b('0xaa')](util['format']('%s_STATUS_MESSAGE',_0x5987bf),_0x427d4c[_0xd81b('0x7b')]?_0x427d4c[_0xd81b('0x7b')]:'OK');if(_0x427d4c[_0xd81b('0x78')]){try{this['saveRestApiResult'](_0x427d4c[_0xd81b('0x78')],_0x5987bf);}catch(_0x163d08){logger[_0xd81b('0x2d')](util[_0xd81b('0x2b')](_0xd81b('0x199'),_0x5987bf));}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x19a'),_0x5987bf));};AGIVertices['prototype'][_0xd81b('0x19b')]=function(_0x303ecc){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x19c'),_0x303ecc[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0x19d')](_0x303ecc[_0xd81b('0x19e')][_0xd81b('0x5c')](/\s+/g,''),_0x303ecc[_0xd81b('0x191')]);};AGIVertices['prototype'][_0xd81b('0x19f')]=function(_0x243190){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x1a0'),_0x243190['label']));return this['channel'][_0xd81b('0x1a1')](_0x243190[_0xd81b('0x6a')][_0xd81b('0x5c')](/\s+/g,''),_0x243190['escape_digits']);};AGIVertices[_0xd81b('0x11')]['sayphonetic']=function(_0x201ecc){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1a2'),_0x201ecc[_0xd81b('0x38')]));return this['channel'][_0xd81b('0x1a3')](_0x201ecc[_0xd81b('0x60')],_0x201ecc[_0xd81b('0x191')]);};AGIVertices[_0xd81b('0x11')]['sendMail']=function(_0x57531b){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x1a4'),_0x57531b[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x57531b[_0xd81b('0x1a5')])){return this['channel']['noop']('no\x20mail\x20account\x20configured');}var _0x5bf32b=this[_0xd81b('0x22')][_0xd81b('0x73')](this,_0x57531b['account_id']);if(!_0x5bf32b||!_0x5bf32b[_0xd81b('0x1a6')]){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x57531b,_0xd81b('0x1a7'));}var _0x4f6ad4={'from':util[_0xd81b('0x2b')](_0xd81b('0x1a8'),_0x5bf32b['name'],_0x5bf32b['email']||_0x5bf32b[_0xd81b('0x1a6')]['user']),'to':_0x57531b['to']||'','cc':_0x57531b['cc']||'','bcc':_0x57531b['bcc']||'','subject':_0x57531b[_0xd81b('0x1a9')],'html':_0x57531b[_0xd81b('0x60')],'text':_0x57531b[_0xd81b('0x60')]};if(this['isConfigured'](_0x57531b[_0xd81b('0x1aa')])){}logger[_0xd81b('0xe6')]('sendMail\x20message',JSON[_0xd81b('0x77')](_0x4f6ad4));this[_0xd81b('0x36')]['sync'](this,_0x57531b,_0x57531b['account_id']);this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1ab'),_0x5bf32b[_0xd81b('0x18')]));this[_0xd81b('0x1ac')]['sync'](this,_0x5bf32b[_0xd81b('0x1ad')],_0x4f6ad4);return this[_0xd81b('0xe')][_0xd81b('0xb1')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1ae')]=function(_0x521ad2){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1af'),_0x521ad2[_0xd81b('0x38')]));return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1b0'));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b1')]=function(_0x33addc){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1b2'),_0x33addc['label']));if(!this[_0xd81b('0x8b')](_0x33addc[_0xd81b('0x1b3')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1b4'));}var _0x52530c=this['getSmsAccount'][_0xd81b('0x73')](this,_0x33addc[_0xd81b('0x1b3')]);if(!_0x52530c){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x33addc,_0xd81b('0x1b5'));}var _0x5c2f40={'body':_0x33addc[_0xd81b('0x1b6')],'phone':_0x33addc['to']||'','SmsAccountId':_0x52530c['id']};logger[_0xd81b('0xe6')](_0xd81b('0x1b7'),JSON['stringify'](_0x5c2f40));this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x33addc,_0x33addc[_0xd81b('0x1b3')]);this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1b8'),_0x52530c[_0xd81b('0x18')]));this[_0xd81b('0x35')][_0xd81b('0x73')](this,_0x5c2f40);return this['channel']['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1b9')]=function(_0x561fe7){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1ba'),_0x561fe7[_0xd81b('0x38')]));if(!this['isConfigured'](_0x561fe7[_0xd81b('0xe1')])){return this[_0xd81b('0xe')]['error'](_0x561fe7,_0xd81b('0x1bb'));}var _0x3d8b1b=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x561fe7['variable_id']);if(!_0x3d8b1b){return this['channel'][_0xd81b('0x2d')](_0x561fe7,_0xd81b('0x173'));}return this['channel'][_0xd81b('0xaa')](_0x3d8b1b,_0x561fe7[_0xd81b('0x1bc')]);};AGIVertices[_0xd81b('0x11')]['start']=function(_0x25fb51){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1bd'),_0x25fb51['label']));this['channel'][_0xd81b('0xb1')](_0xd81b('0x1be'));var _0x1e04ef=this[_0xd81b('0xe')][_0xd81b('0x12')](_0xd81b('0x1bf'));if(!_['isEmpty'](_0x1e04ef[_0xd81b('0xa6')])){this[_0xd81b('0xe')][_0xd81b('0x37')]=_0x1e04ef['extra'];}if(_0x25fb51['answer']===_0xd81b('0x1c0')){this[_0xd81b('0xe')]['noop']('Answer');return this[_0xd81b('0xe')][_0xd81b('0xbd')]();}return this['channel']['noop'](_0xd81b('0x1c1'));};AGIVertices[_0xd81b('0x11')]['subproject']=function(_0x122877){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1c2'),_0x122877[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x122877[_0xd81b('0x1c3')])){return this[_0xd81b('0xe')]['error'](_0x122877,_0xd81b('0x1c4'));}var _0x32608a=this[_0xd81b('0x19')][_0xd81b('0x73')](this,_0x122877[_0xd81b('0x1c3')]);if(!this[_0xd81b('0x8b')](_0x32608a)){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x122877,util[_0xd81b('0x2b')](_0xd81b('0x1c5'),_0x122877[_0xd81b('0x1c3')]));}if(_0x32608a===this['channel'][_0xd81b('0x3a')]){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x122877,_0xd81b('0x1c6'));}this['createSquareDetailsReport'][_0xd81b('0x73')](this,_0x122877,_0x32608a);var _0x475291=this[_0xd81b('0xe')][_0xd81b('0x5a')](_0xd81b('0x1c7'),util[_0xd81b('0x2b')](_0xd81b('0x1c8'),config[_0xd81b('0x8')]['host']||'127.0.0.1',_0x32608a,this[_0xd81b('0xe')][_0xd81b('0x3a')]));if(_0x475291['result']===-0x1){return _0x475291;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0xc9'),_0xd81b('0x1c7'),_0x32608a));};AGIVertices['prototype']['system']=function(_0x2b778b){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1c9'),_0x2b778b['label']));var _0x191c32=this['shellCommand'][_0xd81b('0x73')](this,_0x2b778b['command']);this[_0xd81b('0x36')][_0xd81b('0x73')](this,_0x2b778b,_0x2b778b['command']);if(this[_0xd81b('0x8b')](_0x2b778b[_0xd81b('0xe1')])){var _0xc8d345=this[_0xd81b('0x12')][_0xd81b('0x73')](this,_0x2b778b['variable_id']);if(_0xc8d345){this[_0xd81b('0xe')]['setVariable'](_0xc8d345,_0x191c32);return this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1ca'),_0x2b778b[_0xd81b('0x1cb')],_0xc8d345));}}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1cc'),_0x2b778b[_0xd81b('0x1cb')]));};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1cd')]=function(_0x54966e){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1ce'),_0x54966e['label']));_0x54966e[_0xd81b('0x60')]=_0x54966e[_0xd81b('0x60')][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x54966e[_0xd81b('0x5e')])){return this[_0xd81b('0xe')][_0xd81b('0xb1')](_0xd81b('0x1cf'));}if(!this[_0xd81b('0x8b')](_0x54966e[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')]('no\x20text\x20configured');}this['channel'][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x1d0'),_0x54966e[_0xd81b('0x60')]));var _0x425b71=this[_0xd81b('0x5d')][_0xd81b('0x73')](this,_0x54966e);if(_0x425b71){this[_0xd81b('0xe')]['noop'](util['format'](_0xd81b('0x1d1'),_0x425b71));var _0x4d9351=this[_0xd81b('0xe')][_0xd81b('0x111')](_0x425b71);try{fs[_0xd81b('0x133')](_0x425b71+_0xd81b('0x112'));}catch(_0x3044f9){logger[_0xd81b('0x2d')](_0x3044f9);}return _0x4d9351;}return this[_0xd81b('0xe')]['error'](_0x54966e,_0xd81b('0x1d2'));};AGIVertices['prototype']['tts']=function(_0x464168){logger['info'](util[_0xd81b('0x2b')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x464168['label']));_0x464168['text']=_0x464168[_0xd81b('0x60')][_0xd81b('0x5c')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd81b('0x8b')](_0x464168[_0xd81b('0x60')])){return this['channel'][_0xd81b('0xb1')](_0xd81b('0xaf'));}this[_0xd81b('0xe')]['noop'](util[_0xd81b('0x2b')](_0xd81b('0x1d3'),_0x464168[_0xd81b('0x60')]));var _0x192fe2=this[_0xd81b('0x66')][_0xd81b('0x73')](this,_0x464168);if(_0x192fe2){this[_0xd81b('0xe')][_0xd81b('0xb1')](util['format'](_0xd81b('0x1d4'),_0x192fe2));var _0x243039=this['channel'][_0xd81b('0x111')](_0x192fe2);try{fs[_0xd81b('0x133')](_0x192fe2+'.wav');}catch(_0x1255a3){logger[_0xd81b('0x2d')](_0x1255a3);}return _0x243039;}return this['channel']['error'](_0x464168,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd81b('0x11')][_0xd81b('0x1d5')]=function(_0x4dfe25){logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x1d6'),_0x4dfe25[_0xd81b('0x38')]));if(!this[_0xd81b('0x8b')](_0x4dfe25[_0xd81b('0x167')])){return this[_0xd81b('0xe')][_0xd81b('0x2d')](_0x4dfe25,_0xd81b('0x17e'));}logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x168'),this['channel'][_0xd81b('0x3b')],_0x4dfe25['findBy']));var _0x2bf63f=this[_0xd81b('0x53')][_0xd81b('0x73')](this,_0x4dfe25[_0xd81b('0x167')]);if(_0x2bf63f){logger[_0xd81b('0x2e')](util['format'](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25['findBy']));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x169'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25['findBy']));return{'code':0xc8,'result':_0xd81b('0x16a')};}else{logger[_0xd81b('0x2e')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this[_0xd81b('0xe')][_0xd81b('0x3b')],_0x4dfe25[_0xd81b('0x167')]));this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')](_0xd81b('0x16b'),this['channel'][_0xd81b('0x3b')],_0x4dfe25['findBy']));return{'code':0xc8,'result':_0xd81b('0x16c')};}};AGIVertices['prototype'][_0xd81b('0x1d7')]=function(_0x5ee3d1){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1d8'),_0x5ee3d1[_0xd81b('0x38')]));var _0x36f356=this['channel'][_0xd81b('0x5a')](_0xd81b('0x1d9'),[_0x5ee3d1[_0xd81b('0x1da')],_0x5ee3d1[_0xd81b('0x7d')]]);if(_0x36f356[_0xd81b('0xa8')]===-0x1){return _0x36f356;}return this[_0xd81b('0xe')][_0xd81b('0xb1')](util[_0xd81b('0x2b')]('Executed\x20command\x20%s\x20%s','VOICEMAIL',_0x5ee3d1['mailbox']));};AGIVertices[_0xd81b('0x11')]['vswitch']=function(_0x3d22a0){logger['info'](util[_0xd81b('0x2b')](_0xd81b('0x1db'),_0x3d22a0['label']));if(!this['isConfigured'](_0x3d22a0[_0xd81b('0xe1')])){return this[_0xd81b('0xe')]['error'](_0x3d22a0,_0xd81b('0x1bb'));}var _0x2a71ae=this['getVariable'][_0xd81b('0x73')](this,_0x3d22a0[_0xd81b('0xe1')]);if(!_0x2a71ae){return this[_0xd81b('0xe')]['error'](_0x3d22a0,_0xd81b('0x173'));}var _0x2475b8=this[_0xd81b('0xe')]['getVariable'](_0x2a71ae);return{'code':0xc8,'result':_0x2475b8[_0xd81b('0xa6')]?_0x2475b8[_0xd81b('0xa6')]:'-'};};String['prototype']['replaceAll']=function(_0x49ca5f,_0x45aa91){return this['split'](_0x49ca5f)[_0xd81b('0x1dc')](_0x45aa91);};module[_0xd81b('0x1dd')]=AGIVertices; \ No newline at end of file +var _0xe5b3=['format','%s.%s','length','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','application','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','variable_id','keys','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','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','Trying\x20Dialogflow:\x20%s','speech','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','SESTEK_NDA_%s','sesteknda','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','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','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','awslex','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','response','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause_id','agentPause','playback','PLAYBACK','queue','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','host','127.0.0.1','AGI','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','getSoundPath','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','%s/sounds/converted/%s','getQueryOdbc','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','channel','arg_1','callerid','createSquareRecording','calleridname','context','accountcode','dnid','file','createSquareMessage','createCmContact','isNil','callback_','random','isEmpty','lastName','list_id','callback','Callback\x20scheduled\x20at\x20','getPause','getPauseById','agent','agentUnpause','error','agentLogout','agentLogin','internal','shellCommand','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','PUT','method','toUpperCase','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','body','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','sestekNDA','ispeechTTS','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','isString','replaceObjectAllVariables','replaceAllVariables','hasOwnProperty','isPlainObject','recursiveNodeIndex','isArray','saveRestApiResult'];(function(_0x3c9468,_0x5f8405){var _0x41df93=function(_0x3d7f6e){while(--_0x3d7f6e){_0x3c9468['push'](_0x3c9468['shift']());}};_0x41df93(++_0x5f8405);}(_0xe5b3,0x133));var _0x3e5b=function(_0x43b0d5,_0x499afb){_0x43b0d5=_0x43b0d5-0x0;var _0x25909e=_0xe5b3[_0x43b0d5];return _0x25909e;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x3e5b('0x0'));var sh=require(_0x3e5b('0x1'));var odbc=require(_0x3e5b('0x2'))();var rs=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var Mustache=require(_0x3e5b('0x5'));var rp=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var scripts=require(_0x3e5b('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x3e5b('0xb'),_0x3e5b('0xc')];var verticesWithRetry=['menu',_0x3e5b('0xd'),_0x3e5b('0xe')];var AGIVertices=function(_0x3c7c2e,_0x113d38,_0x5282fd){this['channel']=_0x3c7c2e;this[_0x3e5b('0xf')]=_0x113d38;this[_0x3e5b('0x10')]=_0x5282fd;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x12')]=function(_0xeeaabc,_0x522e9e){this[_0x3e5b('0xf')]['getVariableById'](_0xeeaabc)[_0x3e5b('0x13')](function(_0x382273){_0x522e9e(null,_0x382273?_0x382273[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x20b97b){_0x522e9e(_0x20b97b);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x16')]=function(_0x560010,_0x39a2a1){this['rpc']['getVoiceQueueById'](_0x560010)['then'](function(_0x3754e3){_0x39a2a1(null,_0x3754e3?_0x3754e3[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x4fb471){_0x39a2a1(_0x4fb471);});};AGIVertices[_0x3e5b('0x11')]['getSquareProject']=function(_0x56a453,_0x258d6a){this[_0x3e5b('0xf')]['getSquareProjectById'](_0x56a453)[_0x3e5b('0x13')](function(_0x143040){_0x258d6a(null,_0x143040?_0x143040['name']:![]);})[_0x3e5b('0x15')](function(_0x3365dd){_0x258d6a(_0x3365dd);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x144fa7,_0x20806a){this[_0x3e5b('0xf')][_0x3e5b('0x17')](_0x144fa7)[_0x3e5b('0x13')](function(_0x1564b5){_0x20806a(null,_0x1564b5?_0x1564b5[_0x3e5b('0x18')]:![]);})[_0x3e5b('0x15')](function(_0x36c988){_0x20806a(_0x36c988);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x19')]=function(_0x11e5cf,_0x2d77cc){this[_0x3e5b('0xf')]['getUserById'](_0x11e5cf)[_0x3e5b('0x13')](function(_0x86f19c){_0x2d77cc(null,_0x86f19c?_0x86f19c[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x50039b){_0x2d77cc(_0x50039b);});};AGIVertices[_0x3e5b('0x11')]['getTrunk']=function(_0x2f9e42,_0x36d960){this['rpc'][_0x3e5b('0x1a')](_0x2f9e42)[_0x3e5b('0x13')](function(_0x42d7e9){_0x36d960(null,_0x42d7e9?_0x42d7e9[_0x3e5b('0x14')]:![]);})[_0x3e5b('0x15')](function(_0x26c7f2){_0x36d960(_0x26c7f2);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b')]=function(_0x4c4b89,_0x1c7278){var _0x505f40=this;this[_0x3e5b('0xf')]['getSoundById'](_0x4c4b89)[_0x3e5b('0x13')](function(_0x1f6473){_0x1c7278(null,_0x1f6473?_0x505f40[_0x3e5b('0x1c')](_0x1f6473[_0x3e5b('0x1d')]):![]);})[_0x3e5b('0x15')](function(_0x3cfaf6){_0x1c7278(_0x3cfaf6);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1e')]=function(_0x221718,_0x112dc0){this[_0x3e5b('0xf')]['getMailAccountById'](_0x221718)[_0x3e5b('0x13')](function(_0x1882aa){_0x112dc0(null,_0x1882aa?_0x1882aa:![]);})[_0x3e5b('0x15')](function(_0x2a14eb){_0x112dc0(_0x2a14eb);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1f')]=function(_0x345927,_0x4c4e01,_0x33f089){this['mailRpc']['sendMailMessage'](_0x345927,_0x4c4e01)[_0x3e5b('0x13')](function(){_0x33f089(null);})[_0x3e5b('0x15')](function(_0x51ea0d){_0x33f089(_0x51ea0d);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x20')]=function(_0x9d01c4,_0x33e356){this[_0x3e5b('0xf')][_0x3e5b('0x21')](_0x9d01c4)[_0x3e5b('0x13')](function(_0x26c9ab){if(_0x26c9ab){if(_0x26c9ab[_0x3e5b('0x22')]){_0x33e356(null,[_0x26c9ab[_0x3e5b('0x23')]]);}else{_0x33e356(null,_[_0x3e5b('0x24')](_0x26c9ab[_0x3e5b('0x25')],'interval'));}}else{_0x33e356(null,![]);}})[_0x3e5b('0x15')](function(_0xec45c5){_0x33e356(_0xec45c5);});};AGIVertices['prototype']['getSoundPath']=function(_0x471196){return util['format'](_0x3e5b('0x26'),FILES_PATH,_0x471196);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x27')]=function(_0x32594a,_0x5389e3,_0x18b07f){odbc['open'](_0x32594a,function(_0x42b970){if(_0x42b970){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x42b970);_0x18b07f(_0x42b970);}else{logger['info'](_0x3e5b('0x28'));odbc[_0x3e5b('0x29')](_0x5389e3,function(_0x2eaa30,_0x35cfcd){if(_0x2eaa30){logger[_0x3e5b('0x2a')](_0x3e5b('0x2b'),_0x5389e3);_0x18b07f(_0x2eaa30);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x5389e3);odbc['close'](function(_0x565319){if(_0x565319){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x565319);}_0x18b07f(null,_0x35cfcd);});}});}});};AGIVertices['prototype'][_0x3e5b('0x2c')]=function(_0x349de0,_0x13a48d){this[_0x3e5b('0xf')][_0x3e5b('0x2d')](_0x349de0)[_0x3e5b('0x13')](function(_0x2c56bc){_0x13a48d(null,_0x2c56bc?_0x2c56bc:![]);})[_0x3e5b('0x15')](function(_0x222d0f){_0x13a48d(_0x222d0f);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x2e')]=function(_0x4ee160,_0x28362c){this[_0x3e5b('0xf')][_0x3e5b('0x2e')](_0x4ee160)[_0x3e5b('0x13')](function(_0xa262e0){_0x28362c(null,_0xa262e0);})[_0x3e5b('0x15')](function(_0x2253f2){_0x28362c(_0x2253f2);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x2f')]=function(_0x39da3f,_0x13c8d5,_0x559056){this['rpc']['createSquareDetailsReport']({'uniqueid':this['channel'][_0x3e5b('0x30')],'node':_0x39da3f[_0x3e5b('0x31')],'application':_0x39da3f[_0x3e5b('0x32')],'data':_0x13c8d5||null,'project_name':this[_0x3e5b('0x33')][_0x3e5b('0x34')],'callerid':this[_0x3e5b('0x33')][_0x3e5b('0x35')]})[_0x3e5b('0x13')](function(_0x40ae05){if(_0x559056){_0x559056(null,_0x40ae05);}})[_0x3e5b('0x15')](function(_0x5d318a){if(_0x559056){_0x559056(_0x5d318a);}});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x36')]=function(_0x28f92a,_0x22d495,_0xd5d8b8,_0x4f0c2c){this['rpc']['createSquareRecording']({'uniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'callerid':this[_0x3e5b('0x33')]['callerid'],'calleridname':this['channel'][_0x3e5b('0x37')],'context':this[_0x3e5b('0x33')][_0x3e5b('0x38')],'extension':this['channel']['extension'],'priority':this[_0x3e5b('0x33')]['priority'],'accountcode':this[_0x3e5b('0x33')][_0x3e5b('0x39')],'dnid':this[_0x3e5b('0x33')][_0x3e5b('0x3a')],'projectName':this[_0x3e5b('0x33')][_0x3e5b('0x34')],'saveName':_0x22d495,'filename':_0x28f92a[_0x3e5b('0x3b')]||_0x22d495,'savePath':_0xd5d8b8})[_0x3e5b('0x13')](function(_0x339852){_0x4f0c2c(null,_0x339852);})['catch'](function(_0x223185){_0x4f0c2c(_0x223185);});};AGIVertices['prototype'][_0x3e5b('0x3c')]=function(_0x2e7047,_0x26e11e,_0x3d51fa,_0x291e4d,_0x3a4f26){this[_0x3e5b('0xf')][_0x3e5b('0x3c')]({'uniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'body':_0x2e7047,'direction':_0x26e11e,'providerName':_0x3d51fa,'providerResponse':_0x291e4d})[_0x3e5b('0x13')](function(_0x18ba31){if(_0x3a4f26){_0x3a4f26(null,_0x18ba31);}})[_0x3e5b('0x15')](function(_0x59d311){if(_0x3a4f26){_0x3a4f26(_0x59d311);}});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x3d')]=function(_0x2ca33b,_0xfd37fb){this[_0x3e5b('0xf')][_0x3e5b('0x3d')]({'firstName':_['isEmpty'](_0x2ca33b[_0x3e5b('0x14')])||_[_0x3e5b('0x3e')](_0x2ca33b[_0x3e5b('0x14')])?_0x3e5b('0x3f')+Math[_0x3e5b('0x40')]():_0x2ca33b[_0x3e5b('0x14')],'lastName':_[_0x3e5b('0x41')](_0x2ca33b[_0x3e5b('0x42')])||_['isNil'](_0x2ca33b[_0x3e5b('0x42')])?null:_0x2ca33b['lastName'],'phone':_0x2ca33b['phone'],'ListId':_0x2ca33b[_0x3e5b('0x43')],'scheduledat':_0x2ca33b['scheduledAt'],'callbackUniqueid':this[_0x3e5b('0x33')][_0x3e5b('0x30')],'tags':_0x3e5b('0x44'),'description':_0x3e5b('0x45')+_0x2ca33b['scheduledAt']['toString'](),'priority':_0x2ca33b['callback_priority']})['then'](function(_0x2ab5f3){_0xfd37fb(null,_0x2ab5f3);})[_0x3e5b('0x15')](function(_0x1ea02a){_0xfd37fb(_0x1ea02a);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x46')]=function(_0x5b4c6c,_0x5ac379){this[_0x3e5b('0xf')][_0x3e5b('0x47')](_0x5b4c6c)[_0x3e5b('0x13')](function(_0x325f7b){_0x5ac379(null,_0x325f7b?_0x325f7b[_0x3e5b('0x14')]:![]);})['catch'](function(_0x4f7337){_0x5ac379(_0x4f7337);});};AGIVertices['prototype']['agentPause']=function(_0x3563b0,_0x3e3115,_0x3088d4){var _0x80b4={'role':_0x3e5b('0x48')};_0x80b4[_0x3563b0]=this[_0x3e5b('0x33')][_0x3e5b('0x35')];this[_0x3e5b('0xf')]['agentPause'](_0x80b4,_0x3e3115,this[_0x3e5b('0x33')][_0x3e5b('0x30')])[_0x3e5b('0x13')](function(_0x3e784a){_0x3088d4(null,_[_0x3e5b('0x3e')](_0x3e784a)?![]:!![]);})['catch'](function(_0xd45159){logger['error'](_0xd45159);_0x3088d4(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x49')]=function(_0x58c41e,_0x4a7d8e){var _0x570303={'role':_0x3e5b('0x48')};_0x570303[_0x58c41e]=this['channel'][_0x3e5b('0x35')];this[_0x3e5b('0xf')][_0x3e5b('0x49')](_0x570303)[_0x3e5b('0x13')](function(_0x14f187){_0x4a7d8e(null,_['isNil'](_0x14f187)?![]:!![]);})['catch'](function(_0x226f61){logger[_0x3e5b('0x4a')](_0x226f61);_0x4a7d8e(null,![]);});};AGIVertices[_0x3e5b('0x11')]['agentLogout']=function(_0x8fb7a1,_0x3c5293){var _0x32a42f={'role':_0x3e5b('0x48')};_0x32a42f[_0x8fb7a1]=this[_0x3e5b('0x33')][_0x3e5b('0x35')];this[_0x3e5b('0xf')][_0x3e5b('0x4b')](_0x32a42f)[_0x3e5b('0x13')](function(_0x52e98f){_0x3c5293(null,_[_0x3e5b('0x3e')](_0x52e98f)?![]:!![]);})[_0x3e5b('0x15')](function(_0x33bbb8){logger[_0x3e5b('0x4a')](_0x33bbb8);_0x3c5293(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x4c')]=function(_0x39f1f2,_0x32d3df){var _0x4d2234={'role':_0x3e5b('0x48')};_0x4d2234[_0x39f1f2]=this[_0x3e5b('0x33')]['callerid'];var _0x177144=_0x39f1f2!=_0x3e5b('0x4d')?util['format']('%s/%s@from-sip/n','LOCAL',this[_0x3e5b('0x33')][_0x3e5b('0x35')]):undefined;this['rpc'][_0x3e5b('0x4c')](_0x4d2234,_0x177144)[_0x3e5b('0x13')](function(_0x47b810){_0x32d3df(null,_[_0x3e5b('0x3e')](_0x47b810)?![]:!![]);})[_0x3e5b('0x15')](function(_0x43f28f){logger[_0x3e5b('0x4a')](_0x43f28f);_0x32d3df(null,![]);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x4e')]=function(_0x5891fe,_0x410c7a){sh[_0x3e5b('0x4f')](_['trim'](_0x5891fe),function(_0x310238,_0x3aad97){var _0x2d5685=_0x3aad97[_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'');_0x410c7a(null,_0x2d5685);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x51')]=function(_0x12c93d,_0x4efdbe){scripts['googleCloudTTS'](_0x12c93d[_0x3e5b('0x52')],_0x12c93d[_0x3e5b('0x53')]||'text',_0x12c93d[_0x3e5b('0x54')],_0x12c93d[_0x3e5b('0x55')]||_0x3e5b('0x56'),_0x12c93d[_0x3e5b('0x57')]||_0x3e5b('0x58'),_0x12c93d[_0x3e5b('0x59')]||_0x3e5b('0x5a'))['then'](function(_0x27dd0f){_0x4efdbe(null,_0x27dd0f);})[_0x3e5b('0x15')](function(_0x4a179f){_0x4efdbe(_0x4a179f);});};AGIVertices['prototype']['googleTTS']=function(_0x8d164e,_0x141393){scripts[_0x3e5b('0x5b')](_0x8d164e[_0x3e5b('0x54')],_0x8d164e[_0x3e5b('0x5c')]||'en',0x1)[_0x3e5b('0x13')](function(_0x53e05d){_0x141393(null,_0x53e05d);})[_0x3e5b('0x15')](function(_0x48e1c){_0x141393(_0x48e1c);});};AGIVertices['prototype'][_0x3e5b('0x5d')]=function(_0x4da39d,_0x4f62fb){var _0x211e73={'uri':_0x4da39d[_0x3e5b('0x5e')],'method':_0x4da39d['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4da39d[_0x3e5b('0x5f')])===_0x3e5b('0x60')&&parseInt(_0x4da39d['timeout'])>=0x1?parseInt(_0x4da39d[_0x3e5b('0x5f')])*0x3e8:0x5*0x3e8};if(_[_0x3e5b('0x61')]([_0x3e5b('0x62'),_0x3e5b('0x63')],_0x211e73[_0x3e5b('0x64')][_0x3e5b('0x65')]())){try{_0x211e73['body']=_0x4da39d['rawBody']?JSON[_0x3e5b('0x66')](_0x4da39d['rawBody']):{};}catch(_0x568890){logger[_0x3e5b('0x4a')](_0x3e5b('0x67'),_0x568890);}}try{_0x211e73[_0x3e5b('0x68')]=_0x4da39d['rawHeaders']?JSON[_0x3e5b('0x66')](_0x4da39d['rawHeaders']):{};}catch(_0x13c806){logger['error'](_0x3e5b('0x69'),_0x13c806);}if(_0x4da39d[_0x3e5b('0x6a')]){try{var _0x14941b=require(_0x4da39d[_0x3e5b('0x6a')])['sync'](this,_0x211e73);_0x211e73[_0x3e5b('0x6b')]=Mustache['render'](_0x4da39d[_0x3e5b('0x5e')],_0x14941b,{},['$$','$$']);if(_0x211e73[_0x3e5b('0x68')]){_0x211e73['headers']=JSON[_0x3e5b('0x66')](Mustache[_0x3e5b('0x6c')](JSON[_0x3e5b('0x6d')](_0x211e73['headers']),_0x14941b,{},['$$','$$']));}if(_0x211e73[_0x3e5b('0x6e')]){_0x211e73[_0x3e5b('0x6e')]=JSON[_0x3e5b('0x66')](Mustache['render'](JSON[_0x3e5b('0x6d')](_0x211e73[_0x3e5b('0x6e')]),_0x14941b,{},['$$','$$']));}}catch(_0x4b9774){logger[_0x3e5b('0x4a')](_0x3e5b('0x6f'),_0x4b9774);}}rp(_0x211e73)[_0x3e5b('0x13')](function(_0x5b2014){var _0x3b3306={'statusCode':_0x5b2014[_0x3e5b('0x70')]||0xc8,'statusMessage':_0x5b2014[_0x3e5b('0x71')]||'OK','headers':_0x5b2014[_0x3e5b('0x68')]||{},'body':_0x5b2014['body']||{}};_0x4f62fb(null,_0x3b3306);})[_0x3e5b('0x15')](function(_0x5683de){var _0xbe6415={'statusCode':_0x5683de['statusCode']||0x1f4,'statusMessage':_0x5683de[_0x3e5b('0x72')]||_0x3e5b('0x73'),'headers':_0x5683de['options'][_0x3e5b('0x68')]||{},'body':_0x5683de[_0x3e5b('0x74')]['body']||{}};_0x4f62fb(null,_0xbe6415);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x75')]=function(_0x2907dd,_0x46ce2b){scripts['googleDialogflow'](this['channel'][_0x3e5b('0x30')],_0x2907dd[_0x3e5b('0x76')],_0x2907dd[_0x3e5b('0x54')],_0x2907dd[_0x3e5b('0x77')]||'en')[_0x3e5b('0x13')](function(_0x3d1193){_0x46ce2b(null,_0x3d1193);})['catch'](function(_0x5d6aae){_0x46ce2b(_0x5d6aae);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x78')]=function(_0x902bb8,_0x25dec7){scripts[_0x3e5b('0x78')](this[_0x3e5b('0x33')][_0x3e5b('0x30')],_0x902bb8[_0x3e5b('0x79')],_0x902bb8['client_email'],_0x902bb8['private_key'],_0x902bb8[_0x3e5b('0x54')],_0x902bb8['dialogflowV2_language']||'en')[_0x3e5b('0x13')](function(_0x44300d){_0x25dec7(null,_0x44300d);})[_0x3e5b('0x15')](function(_0x27fa74){_0x25dec7(_0x27fa74);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x7a')]=function(_0x150bdf,_0x350bd7){scripts[_0x3e5b('0x7a')](this[_0x3e5b('0x33')],_0x150bdf)[_0x3e5b('0x13')](function(_0x199fa4){_0x350bd7(null,_0x199fa4);})[_0x3e5b('0x15')](function(_0x4b025f){_0x350bd7(_0x4b025f);});};AGIVertices['prototype'][_0x3e5b('0x7b')]=function(_0x3602da,_0x3ceb03){scripts[_0x3e5b('0x7b')](_0x3602da['key'],_0x3602da[_0x3e5b('0x54')],_0x3602da['ispeech_tts_language']||_0x3e5b('0x56'),_0x3602da['speed'])[_0x3e5b('0x13')](function(_0x3f28cc){_0x3ceb03(null,_0x3f28cc);})[_0x3e5b('0x15')](function(_0x5bc994){_0x3ceb03(_0x5bc994);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x7c')]=function(_0xd93aed,_0x17242b,_0x94e765){scripts['ispeechASR'](_0x17242b,_0xd93aed[_0x3e5b('0x76')],_0xd93aed[_0x3e5b('0x7d')]||'en-US',this[_0x3e5b('0x7e')](_0xd93aed[_0x3e5b('0x7f')])?_0xd93aed[_0x3e5b('0x7f')]:undefined)[_0x3e5b('0x13')](function(_0x41de83){_0x94e765(null,_0x41de83);})[_0x3e5b('0x15')](function(_0x441890){_0x94e765(_0x441890);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x80')]=function(_0x40306d,_0x107e07){scripts[_0x3e5b('0x80')](_0x40306d['aws_access_key_id'],_0x40306d[_0x3e5b('0x81')],_0x40306d[_0x3e5b('0x82')],_0x40306d['aws_polly_voice']||'Amy',_0x40306d[_0x3e5b('0x54')],_0x40306d[_0x3e5b('0x83')]||_0x3e5b('0x54'))[_0x3e5b('0x13')](function(_0x280e43){_0x107e07(null,_0x280e43);})['catch'](function(_0xc78d12){_0x107e07(_0xc78d12);});};AGIVertices[_0x3e5b('0x11')]['awsLex']=function(_0x53913d,_0x310429){scripts[_0x3e5b('0x84')](this['channel']['uniqueid'],_0x53913d[_0x3e5b('0x85')],_0x53913d[_0x3e5b('0x81')],_0x53913d['aws_lex_region'],_0x53913d[_0x3e5b('0x54')],_0x53913d[_0x3e5b('0x86')])[_0x3e5b('0x13')](function(_0x19cbd7){_0x310429(null,_0x19cbd7);})[_0x3e5b('0x15')](function(_0x580c82){_0x310429(_0x580c82);});};AGIVertices['prototype'][_0x3e5b('0x87')]=function(_0x39dc3c,_0x253dfa,_0x34ea6b){scripts[_0x3e5b('0x87')](_0x253dfa,_0x39dc3c[_0x3e5b('0x76')],_0x39dc3c[_0x3e5b('0x88')]||_0x3e5b('0x56'))[_0x3e5b('0x13')](function(_0x1cdc38){_0x34ea6b(null,_0x1cdc38);})[_0x3e5b('0x15')](function(_0x8efc1b){_0x34ea6b(_0x8efc1b);});};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x89')]=function(_0x1aab9a,_0x3ca1fb,_0x34edb6){scripts[_0x3e5b('0x89')](_0x3ca1fb,_0x1aab9a[_0x3e5b('0x8a')],_0x1aab9a[_0x3e5b('0x8b')],_0x1aab9a[_0x3e5b('0x6b')])[_0x3e5b('0x13')](function(_0x2464f3){_0x34edb6(null,_0x2464f3);})[_0x3e5b('0x15')](function(_0x408070){_0x34edb6(_0x408070);});};AGIVertices['prototype']['clear']=function(_0x2c1efd){var _0x15577d=_[_0x3e5b('0x61')](verticesWithRetry,_0x2c1efd[_0x3e5b('0x32')])?_0x2c1efd:_['clone'](_0x2c1efd);for(var _0x17a736 in _0x15577d){if(_0x15577d['hasOwnProperty'](_0x17a736)){if(_0x15577d[_0x17a736]&&_[_0x3e5b('0x8c')](_0x15577d[_0x17a736])){if(_[_0x3e5b('0x61')](recursiveMapAttributes,_0x17a736)){_0x15577d[_0x17a736]=this[_0x3e5b('0x8d')](_0x15577d[_0x17a736]);}else{_0x15577d[_0x17a736]=this[_0x3e5b('0x8e')](_0x15577d[_0x17a736]);}}}}return _0x15577d;};AGIVertices[_0x3e5b('0x11')]['recursiveNodeIndex']=function(_0x1795a0){for(var _0x64fbf9 in _0x1795a0){if(_0x1795a0[_0x3e5b('0x8f')](_0x64fbf9)){if(_[_0x3e5b('0x90')](_0x1795a0[_0x64fbf9])){this[_0x3e5b('0x91')](_0x1795a0[_0x64fbf9]);}else if(_[_0x3e5b('0x92')](_0x1795a0[_0x64fbf9])){for(var _0x5db7b6=0x0;_0x5db7b6<_0x1795a0[_0x64fbf9]['length'];_0x5db7b6++){this[_0x3e5b('0x91')](_0x1795a0[_0x64fbf9][_0x5db7b6]);}}else if(_['isString'](_0x1795a0[_0x64fbf9])){_0x1795a0[_0x64fbf9]=this[_0x3e5b('0x8e')](_0x1795a0[_0x64fbf9]);}}}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x93')]=function(_0x28d461,_0x574fb3){for(var _0x5e789a in _0x28d461){if(_0x28d461[_0x3e5b('0x8f')](_0x5e789a)){if(_[_0x3e5b('0x90')](_0x28d461[_0x5e789a])){if(!_[_0x3e5b('0x41')](_0x28d461[_0x5e789a])){this[_0x3e5b('0x93')](_0x28d461[_0x5e789a],util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a));}}else if(_['isArray'](_0x28d461[_0x5e789a])){for(var _0x4c6d02=0x0;_0x4c6d02<_0x28d461[_0x5e789a][_0x3e5b('0x96')];_0x4c6d02++){this[_0x3e5b('0x93')](_0x28d461[_0x5e789a][_0x4c6d02],util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a+'['+_0x4c6d02+']'));}}else{if(!_[_0x3e5b('0x3e')](_0x28d461[_0x5e789a])){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x574fb3,_0x5e789a),_0x28d461[_0x5e789a]);}}}}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8d')]=function(_0x3e0f6f){try{var _0x283452=JSON[_0x3e5b('0x66')](_0x3e0f6f);this[_0x3e5b('0x91')](_0x283452);return JSON['stringify'](_0x283452);}catch(_0x3d381b){return this[_0x3e5b('0x8e')](_0x3e0f6f);}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8e')]=function(_0x19e016){var _0x3c509d=_0x19e016[_0x3e5b('0x98')]('{');for(var _0x5456f6=0x1;_0x5456f6<_0x3c509d[_0x3e5b('0x96')];_0x5456f6+=0x1){var _0x3be9d4=_0x3c509d[_0x5456f6][_0x3e5b('0x98')]('}');if(_0x3be9d4[_0x3e5b('0x96')]>0x1){_0x19e016=_0x19e016['replaceAll']('{'+_0x3be9d4[0x0]+'}',this[_0x3e5b('0x33')][_0x3e5b('0x12')](_0x3be9d4[0x0])[_0x3e5b('0x99')]||_0x3be9d4[0x0]);}}if(_0x3c509d[_0x3e5b('0x96')]===0x1){return _0x19e016[_0x3e5b('0x9a')]();}return this[_0x3e5b('0x8e')](_0x19e016);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x9b')]=function(_0x276caa,_0x5a988d){var _0x163c14=this[_0x3e5b('0x33')]['getVariable'](_0x276caa);if(_0x163c14[_0x3e5b('0x9c')]===-0x1){return _0x163c14;}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x9d'),_0x5a988d,_0x163c14[_0x3e5b('0x99')]));return this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0x5a988d,_0x163c14[_0x3e5b('0x99')]);};AGIVertices[_0x3e5b('0x11')]['isConfigured']=function(_0x5df21b){return _0x5df21b&&_0x5df21b!=='0'&&_0x5df21b!=='-1'&&_0x5df21b!=='';};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x9e')]=function(_0x229221){this['createSquareDetailsReport'][_0x3e5b('0x9f')](this,_0x229221,'-');_0x229221[_0x3e5b('0xa0')]=_0x229221['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xa1')]=function(_0x3e6f62){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xa2'),_0x3e6f62[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3e6f62[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0xa3'));}var _0x482dd1='\x22'+_0x3e6f62[_0x3e5b('0x54')]+'\x22';if(this[_0x3e5b('0x7e')](_0x3e6f62[_0x3e5b('0x74')])){_0x482dd1+=','+_0x3e6f62[_0x3e5b('0x74')];}var _0x272aab=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0xa4'),_0x482dd1);if(_0x272aab[_0x3e5b('0x9c')]===-0x1){return _0x272aab;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x482dd1));};AGIVertices['prototype'][_0x3e5b('0xa7')]=function(_0x36e032){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0xa8'),_0x36e032['label']));if(!this['isConfigured'](_0x36e032['grammar'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x54bf44=_0x36e032['grammar'];if(this[_0x3e5b('0x7e')](_0x36e032[_0x3e5b('0x74')])){_0x54bf44+=','+_0x36e032['options'];}var _0x513be2=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x54bf44);if(_0x513be2[_0x3e5b('0x9c')]===-0x1){return _0x513be2;}var _0x21a068=this['getAndSetVariable'](_0x3e5b('0xab'),_0x3e5b('0xac'));if(_0x21a068[_0x3e5b('0x9c')]===-0x1){return _0x21a068;}var _0x5c7523=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),_0x3e5b('0xae'));if(_0x5c7523['result']===-0x1){return _0x5c7523;}var _0x4ecbeb=this[_0x3e5b('0x9b')](_0x3e5b('0xaf'),_0x3e5b('0xb0'));if(_0x4ecbeb[_0x3e5b('0x9c')]===-0x1){return _0x4ecbeb;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x54bf44));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x8')]=function(_0x31d5c2){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xb2'),_0x31d5c2[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['agi']([_0x31d5c2[_0x3e5b('0xb3')],_0x31d5c2[_0x3e5b('0xb4')]]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xb5')]=function(_0x44b54b){logger['info'](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x44b54b['label']));if(this['isConfigured'](_0x44b54b[_0x3e5b('0x5f')])){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x44b54b[_0x3e5b('0x5f')]));var _0x5548d3=this['channel'][_0x3e5b('0xb6')](_0x44b54b[_0x3e5b('0x5f')]);if(_0x5548d3['result']===-0x1){return _0x5548d3;}}return this[_0x3e5b('0x33')]['answer']();};AGIVertices[_0x3e5b('0x11')]['callback']=function(_0x3c41fa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xb7'),_0x3c41fa['label']));if(!this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0x43')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3c41fa,_0x3e5b('0xb8'));}_0x3c41fa['scheduledAt']=moment();if(this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0xb9')])){_0x3c41fa['scheduledAt']=moment()[_0x3e5b('0xba')](_0x3c41fa['delay'],_0x3e5b('0xbb'));}if(!this[_0x3e5b('0x7e')](_0x3c41fa[_0x3e5b('0xbc')])){_0x3c41fa['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x3c41fa);return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xbd'),_0x3c41fa[_0x3e5b('0xbe')],_0x3c41fa['list_id'],_0x3c41fa['scheduledAt']));};AGIVertices['prototype'][_0x3e5b('0xbf')]=function(_0x1575f3){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xc0'),_0x1575f3[_0x3e5b('0x31')]));var _0x25a910=this['channel'][_0x3e5b('0x4f')](_0x1575f3['application'],_0x1575f3[_0x3e5b('0x74')]);if(_0x25a910['result']===-0x1){return _0x25a910;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x1575f3[_0x3e5b('0xc2')],_0x1575f3[_0x3e5b('0x74')]));};AGIVertices[_0x3e5b('0x11')]['lumenvoxtts']=function(_0x400e7e){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x400e7e[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x400e7e[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}var _0x7e7710='\x22'+_0x400e7e[_0x3e5b('0x54')]+'\x22';if(this[_0x3e5b('0x7e')](_0x400e7e['options'])){_0x7e7710+=','+_0x400e7e['options'];}var _0x196090=this[_0x3e5b('0x33')][_0x3e5b('0x4f')]('MRCPSynth',_0x7e7710);if(_0x196090['result']===-0x1){return _0x196090;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x7e7710));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xc3')]=function(_0x1f5247){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xc4'),_0x1f5247[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x1f5247[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0xa3'));}var _0x1d273f='\x22'+_0x1f5247['text']+'\x22';if(this[_0x3e5b('0x7e')](_0x1f5247[_0x3e5b('0x74')])){_0x1d273f+=','+_0x1f5247['options'];}var _0x29d3aa=this['channel'][_0x3e5b('0x4f')]('MRCPSynth',_0x1d273f);if(_0x29d3aa[_0x3e5b('0x9c')]===-0x1){return _0x29d3aa;}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xa6'),_0x1d273f));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xc5')]=function(_0x244eb2){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xc6'),_0x244eb2[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x244eb2[_0x3e5b('0xc7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x2cd43a=_0x244eb2[_0x3e5b('0xc7')];if(this[_0x3e5b('0x7e')](_0x244eb2[_0x3e5b('0x74')])){_0x2cd43a+=','+_0x244eb2[_0x3e5b('0x74')];}var _0x34d587=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x2cd43a);if(_0x34d587[_0x3e5b('0x9c')]===-0x1){return _0x34d587;}var _0x3cb9a2=this[_0x3e5b('0x9b')](_0x3e5b('0xab'),_0x3e5b('0xc8'));if(_0x3cb9a2[_0x3e5b('0x9c')]===-0x1){return _0x3cb9a2;}var _0x37f16b=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x37f16b['result']===-0x1){return _0x37f16b;}var _0x55a6eb=this[_0x3e5b('0x9b')](_0x3e5b('0xaf'),_0x3e5b('0xc9'));if(_0x55a6eb[_0x3e5b('0x9c')]===-0x1){return _0x55a6eb;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x2cd43a));};AGIVertices['prototype'][_0x3e5b('0xca')]=function(_0x2d0419){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xcb'),_0x2d0419[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2d0419[_0x3e5b('0xc7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa9'));}var _0x38130d=_0x2d0419[_0x3e5b('0xc7')];if(this[_0x3e5b('0x7e')](_0x2d0419['options'])){_0x38130d+=','+_0x2d0419[_0x3e5b('0x74')];}var _0x42b8dc=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xaa'),_0x38130d);if(_0x42b8dc[_0x3e5b('0x9c')]===-0x1){return _0x42b8dc;}var _0x3130cc=this['getAndSetVariable'](_0x3e5b('0xab'),_0x3e5b('0xcc'));if(_0x3130cc['result']===-0x1){return _0x3130cc;}var _0x479e5f=this[_0x3e5b('0x9b')](_0x3e5b('0xad'),_0x3e5b('0xcd'));if(_0x479e5f[_0x3e5b('0x9c')]===-0x1){return _0x479e5f;}var _0x44786f=this['getAndSetVariable'](_0x3e5b('0xaf'),_0x3e5b('0xce'));if(_0x44786f[_0x3e5b('0x9c')]===-0x1){return _0x44786f;}return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xb1'),_0x38130d));};AGIVertices[_0x3e5b('0x11')]['database']=function(_0x3d5e39){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xcf'),_0x3d5e39[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3d5e39[_0x3e5b('0xd0')])){return this[_0x3e5b('0x33')]['error'](_0x3d5e39,_0x3e5b('0xd1'));}var _0x2ea32e=this[_0x3e5b('0xd2')]['sync'](this,_0x3d5e39[_0x3e5b('0xd0')]);if(!_0x2ea32e){return this[_0x3e5b('0x33')]['error'](_0x3d5e39,'no\x20odbc\x20database\x20found');}if(!this[_0x3e5b('0x7e')](_0x3d5e39[_0x3e5b('0x29')])){return this['channel'][_0x3e5b('0x4a')](_0x3d5e39,'no\x20query\x20configured');}var _0x5b07ce=_0x3d5e39['query'][_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'\x20');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('query:\x20%s',_0x5b07ce));var _0x596968=this[_0x3e5b('0x27')][_0x3e5b('0x9f')](this,_0x2ea32e,_0x5b07ce);this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x3d5e39,_0x5b07ce);if(!this['isConfigured'](_0x3d5e39[_0x3e5b('0xd3')])){return this['channel'][_0x3e5b('0xa5')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x54d961=this[_0x3e5b('0x12')]['sync'](this,_0x3d5e39[_0x3e5b('0xd3')]);if(!_0x54d961){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3d5e39,'no\x20variable\x20found');}var _0x5dd4c5=this;_0x596968['forEach'](function(_0x539c2b,_0x5d655f){Object[_0x3e5b('0xd4')](_0x539c2b)[_0x3e5b('0xd5')](function(_0x31463e){_0x5dd4c5[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')](_0x3e5b('0xd6'),_0x54d961,_0x5d655f,_0x31463e),_0x539c2b[_0x31463e]);});});this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0xd7'),_0x54d961),_0x596968['length']);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xd8'),_0x54d961));};AGIVertices[_0x3e5b('0x11')]['dial']=function(_0x106f92){logger[_0x3e5b('0xd9')](util['format'](_0x3e5b('0xda'),_0x106f92[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x106f92[_0x3e5b('0xdb')])){return this['channel']['error'](_0x106f92,_0x3e5b('0xdc'));}var _0x255a6b=this[_0x3e5b('0x19')]['sync'](this,_0x106f92['sip_id']);if(!_0x255a6b){return this['channel'][_0x3e5b('0x4a')](_0x106f92,_0x3e5b('0xdd'));}var _0x4904f4=this[_0x3e5b('0x33')]['exec'](_0x3e5b('0xde'),[util[_0x3e5b('0x94')](_0x3e5b('0xdf'),_0x255a6b),_0x106f92[_0x3e5b('0x5f')],_0x106f92[_0x3e5b('0xe0')],_0x106f92['url']]);if(_0x4904f4['result']===-0x1){return _0x4904f4;}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xe1'),_0x3e5b('0xde')));};AGIVertices['prototype'][_0x3e5b('0xe2')]=function(_0x1d50f7){logger['info'](util['format'](_0x3e5b('0xe3'),_0x1d50f7['label']));if(!this['isConfigured'](_0x1d50f7[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}if(!this[_0x3e5b('0x7e')](_0x1d50f7[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this['channel'][_0x3e5b('0xe5')]=!![];this['createSquareDetailsReport'](_0x1d50f7);this['createSquareMessage'](_0x1d50f7[_0x3e5b('0x54')],'in','','');this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xe6'),_0x1d50f7[_0x3e5b('0x54')]));var _0x17445f=this[_0x3e5b('0x75')][_0x3e5b('0x9f')](this,_0x1d50f7);if(_0x17445f){for(var _0x6e795d in _0x17445f){if(_0x17445f[_0x3e5b('0x8f')](_0x6e795d)){this[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')]('DIALOGFLOW_%s',_0x6e795d['toUpperCase']()),_0x17445f[_0x6e795d]);}}this[_0x3e5b('0x3c')](_0x17445f[_0x3e5b('0xe7')],'out',_0x3e5b('0xe2'),'');return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Dialogflow\x20Result\x20%s',_0x17445f[_0x3e5b('0xe7')]));}return this['channel'][_0x3e5b('0x4a')](_0x1d50f7,_0x3e5b('0xe8'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0xe9')]=function(_0x5f1053){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0xea'),_0x5f1053[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x5f1053['dialogflowV2_project_id'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xeb'));}if(!this[_0x3e5b('0x7e')](_0x5f1053['client_email'])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xec'));}if(!this[_0x3e5b('0x7e')](_0x5f1053[_0x3e5b('0xed')])){return this['channel'][_0x3e5b('0xa5')]('no\x20private_key\x20configured');}if(!this[_0x3e5b('0x7e')](_0x5f1053['dialogflowV2_language'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xee'));}if(!this[_0x3e5b('0x7e')](_0x5f1053[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xe5')]=!![];this[_0x3e5b('0x2f')](_0x5f1053);this[_0x3e5b('0x3c')](_0x5f1053[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20DialogflowV2:\x20%s',_0x5f1053['text']));var _0x5d0ad1=this[_0x3e5b('0x78')][_0x3e5b('0x9f')](this,_0x5f1053);if(_0x5d0ad1){for(var _0x4383d7 in _0x5d0ad1){if(_0x5d0ad1['hasOwnProperty'](_0x4383d7)){if(_0x4383d7!==_0x3e5b('0xef')){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0xf0'),_0x4383d7[_0x3e5b('0x65')]()),_0x5d0ad1[_0x4383d7]);}}}this[_0x3e5b('0x3c')](_0x5d0ad1[_0x3e5b('0xe7')],_0x3e5b('0xf1'),_0x3e5b('0xe9'),_0x5d0ad1['providerResponse']);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xf2'),_0x5d0ad1[_0x3e5b('0xe7')]));}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x5f1053,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x3e5b('0x11')]['sesteknda']=function(_0x3e907b){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0xf3'),_0x3e907b[_0x3e5b('0x31')]));if(!this['isConfigured'](_0x3e907b['ndauth_url'])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xf4'));}if(!this[_0x3e5b('0x7e')](_0x3e907b[_0x3e5b('0xf5')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xf6'));}if(!this[_0x3e5b('0x7e')](_0x3e907b[_0x3e5b('0xf7')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xf8'));}if(!this[_0x3e5b('0x7e')](_0x3e907b['ndassistant_url'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0x3e5b('0x2f')](_0x3e907b);this['createSquareMessage'](_0x3e907b[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20SestekNDA:\x20%s',_0x3e907b['text']));var _0x7b5fd5=this[_0x3e5b('0x7a')][_0x3e5b('0x9f')](this,_0x3e907b);if(_0x7b5fd5){for(var _0x464c92 in _0x7b5fd5){if(_0x7b5fd5[_0x3e5b('0x8f')](_0x464c92)){this[_0x3e5b('0x33')]['setVariable'](util['format'](_0x3e5b('0xf9'),_0x464c92[_0x3e5b('0x65')]()),_0x7b5fd5[_0x464c92]);}}this['createSquareMessage'](_0x7b5fd5['speech'],_0x3e5b('0xf1'),_0x3e5b('0xfa'),'');if(_0x7b5fd5[_0x3e5b('0xfb')]){this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0xfc'),_0x7b5fd5[_0x3e5b('0xfb')]));var _0x153d8f=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x7b5fd5[_0x3e5b('0xfb')]);try{fs[_0x3e5b('0xfe')](_0x7b5fd5[_0x3e5b('0xfb')]+'.wav');}catch(_0x5756f9){logger['error'](_0x5756f9);}return _0x153d8f;}else{return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xff'),_0x7b5fd5[_0x3e5b('0xe7')]));}}return this[_0x3e5b('0x33')]['error'](_0x3e907b,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x100')]=function(_0x180906){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x101'),_0x180906[_0x3e5b('0x31')]));return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0x100'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x102')]=function(_0x13f8c5){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x103'),_0x13f8c5[_0x3e5b('0x31')]));var _0x440970='';if(_0x13f8c5[_0x3e5b('0x104')]){if(!this['isConfigured'](_0x13f8c5[_0x3e5b('0x104')])){return this['channel']['error'](_0x13f8c5,_0x3e5b('0x105'));}else{var _0xe62d5=parseInt(_0x13f8c5[_0x3e5b('0x104')],0xa);if(isNaN(_0xe62d5)){_0x440970=_0x13f8c5[_0x3e5b('0x104')];}else{_0x440970=this[_0x3e5b('0x106')]['sync'](this,_0x13f8c5['trunk_id']);if(!_0x440970){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x13f8c5,_0x3e5b('0x107'));}}}}else if(_0x13f8c5['trunk_name']){_0x440970=_0x13f8c5[_0x3e5b('0x108')];}else{return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x13f8c5,'no\x20trunk\x20selected');}var _0x8cf63f=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0xde'),[util[_0x3e5b('0x94')](_0x3e5b('0x109'),_0x440970,_0x13f8c5[_0x3e5b('0xbe')]),_0x13f8c5[_0x3e5b('0x5f')],_0x13f8c5[_0x3e5b('0xe0')],_0x13f8c5[_0x3e5b('0x5e')]]);if(_0x8cf63f[_0x3e5b('0x9c')]===-0x1){return _0x8cf63f;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xe1'),'DIAL'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x10a')]=function(_0x36187a){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x10b'),_0x36187a[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x10a'));};AGIVertices[_0x3e5b('0x11')]['getdigits']=function(_0x323af8){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x10c'),_0x323af8[_0x3e5b('0x31')]));if(_0x323af8[_0x3e5b('0xa0')]===0x0){return this[_0x3e5b('0x9e')](_0x323af8);}_0x323af8[_0x3e5b('0xa0')]-=0x1;if(!this[_0x3e5b('0x7e')](_0x323af8[_0x3e5b('0x10d')])){return this[_0x3e5b('0x33')]['error'](_0x323af8,'no\x20file\x20audio\x20selected');}var _0x49d18c=this[_0x3e5b('0x1b')]['sync'](this,_0x323af8[_0x3e5b('0x10d')]);if(!_0x49d18c){return this['channel'][_0x3e5b('0x4a')](_0x323af8,_0x3e5b('0x10e'));}if(!this[_0x3e5b('0x7e')](_0x323af8[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')]['error'](_0x3e5b('0x10f'));}var _0x522cca=this['channel'][_0x3e5b('0x110')](_0x49d18c,_0x323af8['response'],_0x323af8[_0x3e5b('0x111')]);var _0x55aa26=_0x522cca[_0x3e5b('0x9c')]?_0x522cca[_0x3e5b('0x9c')]['toString']():'';logger[_0x3e5b('0x2a')](_0x3e5b('0x112'),JSON[_0x3e5b('0x6d')](_0x522cca));if(_0x522cca[_0x3e5b('0x9c')]===-0x1){this[_0x3e5b('0x2f')]['sync'](this,_0x323af8,_0x55aa26);return _0x522cca;}else if(_0x522cca['extra']===_0x3e5b('0x5f')){_0x522cca[_0x3e5b('0x9c')]=_0x55aa26[_0x3e5b('0x96')]>=parseInt(_0x323af8[_0x3e5b('0x113')])?'x':'i';}else{_0x522cca['result']=_0x55aa26['length']>=parseInt(_0x323af8['mindigit'])&&_0x55aa26[_0x3e5b('0x96')]<=parseInt(_0x323af8[_0x3e5b('0x111')])?'x':'i';}var _0xab4390=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x323af8[_0x3e5b('0xd3')]);if(!_0xab4390){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x323af8,_0x3e5b('0x114'));}this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0xab4390,_0x55aa26);if(this[_0x3e5b('0x7e')](_0x323af8['hiddendigitsnum'])){var _0x46e9bf=parseInt(_0x323af8[_0x3e5b('0x115')],0xa);var _0x4d54e9=rs[_0x3e5b('0x116')]({'charset':'*','length':_0x46e9bf});var _0x34eb0c=_0x55aa26['length'];if(_0x34eb0c>0x0){if(_0x34eb0c>_0x46e9bf){this[_0x3e5b('0x2f')]['sync'](this,_0x323af8,_0x323af8[_0x3e5b('0x117')]==='first'?_0x4d54e9+_0x55aa26[_0x3e5b('0x118')](_0x46e9bf):_0x55aa26[_0x3e5b('0x118')](0x0,_0x34eb0c-_0x46e9bf)+_0x4d54e9);}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,rs[_0x3e5b('0x116')]({'charset':'*','length':_0x34eb0c}));}}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,'');}}else{this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x323af8,_0x55aa26);}return _0x522cca;};AGIVertices['prototype'][_0x3e5b('0xe')]=function(_0x20defc){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x119'),_0x20defc[_0x3e5b('0x31')]));return this['getdigits'](_0x20defc);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x11a')]=function(_0x279e4d){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x11b'),_0x279e4d[_0x3e5b('0x31')]));this['createSquareDetailsReport'][_0x3e5b('0x9f')](this,_0x279e4d,_0x279e4d[_0x3e5b('0x11c')]);return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x11d'),_0x279e4d[_0x3e5b('0x11c')]));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x11e')]=function(_0x3fb849){logger['info'](util['format']('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x3fb849[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x3fb849['aws_access_key_id'])||!this[_0x3e5b('0x7e')](_0x3fb849[_0x3e5b('0x81')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x11f'));}if(!this['isConfigured'](_0x3fb849[_0x3e5b('0x54')])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20aws\x20Polly\x20%s',_0x3fb849[_0x3e5b('0x54')]));var _0x145d81=this[_0x3e5b('0x80')]['sync'](this,_0x3fb849);if(_0x145d81){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x120'),_0x145d81));var _0x101f78=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x145d81);try{fs[_0x3e5b('0xfe')](_0x145d81+_0x3e5b('0x121'));}catch(_0x173a18){logger[_0x3e5b('0x4a')](_0x173a18);}return _0x101f78;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3fb849,_0x3e5b('0x122'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x123')]=function(_0x22ceca){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x22ceca[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x85')])||!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x81')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x11f'));}if(!this[_0x3e5b('0x7e')](_0x22ceca[_0x3e5b('0x86')])){return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x124'));}if(!this[_0x3e5b('0x7e')](_0x22ceca['text'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')][_0x3e5b('0xe5')]=!![];this[_0x3e5b('0x2f')](_0x22ceca);this['createSquareMessage'](_0x22ceca[_0x3e5b('0x54')],'in','','');this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x125'),_0x22ceca['text']));var _0x3b21f1=this[_0x3e5b('0x84')][_0x3e5b('0x9f')](this,_0x22ceca);if(_0x3b21f1){for(var _0x279916 in _0x3b21f1){if(_0x3b21f1[_0x3e5b('0x8f')](_0x279916)&&_[_0x3e5b('0x8c')](_0x3b21f1[_0x279916])){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x126'),_0x279916[_0x3e5b('0x65')]()),_0x3b21f1[_0x279916]);}}if(_[_0x3e5b('0x3e')](_0x3b21f1['message'])){return this[_0x3e5b('0x33')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x3e5b('0x3c')](_0x3b21f1['message'],_0x3e5b('0xf1'),_0x3e5b('0x127'),'');return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x128'),_0x3b21f1[_0x3e5b('0x72')]));}}return this['channel'][_0x3e5b('0x4a')](_0x22ceca,_0x3e5b('0x129'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x12a')]=function(_0x3e2fda){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x12b'),_0x3e2fda[_0x3e5b('0x31')],_0x3e2fda[_0x3e5b('0x5f')]));if(!this['isConfigured'](_0x3e2fda[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}var _0x53e2d0=_0x3e5b('0x12c');var _0x33c246=util[_0x3e5b('0x94')](_0x3e5b('0x12d'),FILES_PATH,rs[_0x3e5b('0x116')](0x4));var _0xa7ffe0=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x33c246,_0x53e2d0);var _0x17f2a7=!![];if(_0x3e2fda['beep']===_0x3e5b('0x12e')){_0x17f2a7=![];}var _0x3f7373=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x33c246,_0x53e2d0,_0x3e2fda[_0x3e5b('0x130')],_0x3e2fda[_0x3e5b('0x5f')],undefined,_0x17f2a7);if(_0x3f7373[_0x3e5b('0x9c')]!==-0x1){this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x131'),_0xa7ffe0));var _0x10bd68=this['googleASR'][_0x3e5b('0x9f')](this,_0x3e2fda,_0xa7ffe0);if(_0x10bd68){for(var _0x4e7ab8 in _0x10bd68){if(_0x10bd68[_0x3e5b('0x8f')](_0x4e7ab8)){this['channel'][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x132'),_0x4e7ab8['toUpperCase']()),_0x10bd68[_0x4e7ab8]);}}return this['channel'][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x133'),JSON[_0x3e5b('0x6d')](_0x10bd68)));}}return _0x3f7373;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x134')]=function(_0x455ec0){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x135'),_0x455ec0['label']));if(!this[_0x3e5b('0x7e')](_0x455ec0[_0x3e5b('0x8a')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x136'));}if(!this[_0x3e5b('0x7e')](_0x455ec0[_0x3e5b('0x8b')])){return this['channel'][_0x3e5b('0xa5')]('no\x20appsecret\x20configured');}var _0x4321c4=_0x3e5b('0x12c');var _0x4b2ed7=util[_0x3e5b('0x94')](_0x3e5b('0x12d'),FILES_PATH,rs[_0x3e5b('0x116')](0x4));var _0x4a67eb=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x4b2ed7,_0x4321c4);var _0x4d7ae7=!![];if(_0x455ec0[_0x3e5b('0x137')]==='NOBEEP'){_0x4d7ae7=![];}var _0x3d1172=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x4b2ed7,_0x4321c4,_0x455ec0[_0x3e5b('0x130')],_0x455ec0[_0x3e5b('0x5f')],undefined,_0x4d7ae7);if(_0x3d1172[_0x3e5b('0x9c')]!==-0x1){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('tilde\x20%s\x20file\x20created',_0x4a67eb));var _0x29579f=this[_0x3e5b('0x89')][_0x3e5b('0x9f')](this,_0x455ec0,_0x4a67eb);if(_0x29579f){for(var _0x1a3dca in _0x29579f){if(_0x29579f[_0x3e5b('0x8f')](_0x1a3dca)){this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x138'),_0x1a3dca[_0x3e5b('0x65')]()),_0x29579f[_0x1a3dca]);}}return this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x139'),JSON[_0x3e5b('0x6d')](_0x29579f)));}}return _0x3d1172;};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x13a')]=function(_0x4c94ea){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x4c94ea[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')]['continueAt'](_0x4c94ea[_0x3e5b('0x38')],_0x4c94ea[_0x3e5b('0x13b')],_0x4c94ea[_0x3e5b('0x13c')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x13d')]=function(_0x39a0ec){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x13e'),_0x39a0ec[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x39a0ec[_0x3e5b('0x13f')])){return this['channel'][_0x3e5b('0x4a')](_0x39a0ec,_0x3e5b('0x140'));}try{var _0xfd374f=eval(_0x39a0ec[_0x3e5b('0x13f')])?_0x3e5b('0x141'):_0x3e5b('0x142');this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x143'),_0x39a0ec['condition'],_0xfd374f));return{'code':0xc8,'result':_0xfd374f};}catch(_0x221103){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x144')]=function(_0x524a38){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x145'),_0x524a38[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x524a38[_0x3e5b('0x146')])){return this[_0x3e5b('0x33')]['error'](_0x524a38,'no\x20interval\x20configured');}var _0x2d5599=this['getIntervals'][_0x3e5b('0x9f')](this,_0x524a38['interval_id']);if(!_0x2d5599){return this['channel'][_0x3e5b('0x4a')](_0x524a38,'no\x20intervals\x20found');}for(var _0x568836=0x0;_0x568836<_0x2d5599[_0x3e5b('0x96')];_0x568836+=0x1){var _0x200092=this[_0x3e5b('0x33')][_0x3e5b('0x12')](util[_0x3e5b('0x94')](_0x3e5b('0x147'),_0x2d5599[_0x568836]));if(_0x200092[_0x3e5b('0x9c')]===-0x1){return _0x200092;}logger[_0x3e5b('0x2a')](util['format']('IFTIME\x20%s\x20%s',_0x2d5599[_0x568836],_0x200092[_0x3e5b('0x99')]));if(_0x200092[_0x3e5b('0x99')]==='true'){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],'true'));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],_0x3e5b('0x141')));return{'code':0xc8,'result':_0x3e5b('0x141')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x148'),_0x2d5599[_0x568836],_0x3e5b('0x142')));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('IFTIME\x20%s\x20%s',_0x2d5599[_0x568836],'false'));}}return{'code':0xc8,'result':_0x3e5b('0x142')};};AGIVertices['prototype'][_0x3e5b('0x149')]=function(_0x55a9c3){logger['info'](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x55a9c3['label']));return this['channel'][_0x3e5b('0x149')]();};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x14a')]=function(_0x534f4c){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x14b'),_0x534f4c[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x534f4c['key'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}var _0x10941c=_0x3e5b('0x12c');var _0x12641a=util['format'](_0x3e5b('0x12d'),FILES_PATH,rs['generate'](0x4));var _0x5119e4=util[_0x3e5b('0x94')](_0x3e5b('0x95'),_0x12641a,_0x10941c);var _0x2798bd=!![];if(_0x534f4c[_0x3e5b('0x137')]===_0x3e5b('0x12e')){_0x2798bd=![];}var _0x279207=this[_0x3e5b('0x33')][_0x3e5b('0x12f')](_0x12641a,_0x10941c,_0x534f4c['intKey'],_0x534f4c['timeout'],undefined,_0x2798bd);if(_0x279207[_0x3e5b('0x9c')]!==-0x1){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x14c'),_0x5119e4));var _0x340f37=this[_0x3e5b('0x7c')][_0x3e5b('0x9f')](this,_0x534f4c,_0x5119e4);if(_0x340f37){for(var _0xf45a3a in _0x340f37){if(_0x340f37[_0x3e5b('0x8f')](_0xf45a3a)){this[_0x3e5b('0x33')]['setVariable'](util[_0x3e5b('0x94')](_0x3e5b('0x14d'),_0xf45a3a['toUpperCase']()),_0x340f37[_0xf45a3a]);}}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x14e'),JSON['stringify'](_0x340f37)));}}return _0x279207;};AGIVertices[_0x3e5b('0x11')]['ispeechtts']=function(_0x1fe8da){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x14f'),_0x1fe8da['label']));if(!this['isConfigured'](_0x1fe8da[_0x3e5b('0x76')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xe4'));}if(!this[_0x3e5b('0x7e')](_0x1fe8da[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0xa3'));}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('Trying\x20ispeech\x20TTS\x20%s',_0x1fe8da[_0x3e5b('0x54')]));var _0x4e586b=this[_0x3e5b('0x7b')][_0x3e5b('0x9f')](this,_0x1fe8da);if(_0x4e586b){this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x14c'),_0x4e586b));var _0x415dad=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x4e586b,_0x1fe8da[_0x3e5b('0x130')]);try{fs['unlink'](_0x4e586b+'.wav');}catch(_0x31efa7){logger['error'](_0x31efa7);}return _0x415dad;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x1fe8da,_0x3e5b('0x150'));};AGIVertices[_0x3e5b('0x11')]['login']=function(_0xdf9061){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x151'),_0xdf9061[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0xdf9061[_0x3e5b('0x152')])){return this['channel'][_0x3e5b('0x4a')](_0xdf9061,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this['channel'][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));var _0x203a85=this[_0x3e5b('0x4c')][_0x3e5b('0x9f')](this,_0xdf9061[_0x3e5b('0x152')]);if(_0x203a85){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061['findBy']));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0xdf9061[_0x3e5b('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x158')]=function(_0x1e909b){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x159'),_0x1e909b[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x1e909b[_0x3e5b('0x152')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x1e909b,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));var _0x4a2afa=this[_0x3e5b('0x4b')][_0x3e5b('0x9f')](this,_0x1e909b[_0x3e5b('0x152')]);if(_0x4a2afa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x3e5b('0x157'),this['channel'][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x1e909b[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x15a')};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x15b')]=function(_0xa29ce4){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0xa29ce4[_0x3e5b('0x31')]));if(!this['isConfigured'](_0xa29ce4[_0x3e5b('0x15c')])){return this[_0x3e5b('0x33')]['error'](_0xa29ce4,_0x3e5b('0x15d'));}this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x15e'),_0xa29ce4['operation']));var _0x5a52a3=eval(_0xa29ce4[_0x3e5b('0x15c')]);if(!this[_0x3e5b('0x7e')](_0xa29ce4[_0x3e5b('0xd3')])){return this['channel'][_0x3e5b('0xa5')](_0x3e5b('0x10f'));}var _0x1c3872=this['getVariable'][_0x3e5b('0x9f')](this,_0xa29ce4[_0x3e5b('0xd3')]);if(!_0x1c3872){return this[_0x3e5b('0x33')]['error'](_0xa29ce4,_0x3e5b('0x114'));}if(_[_0x3e5b('0x92')](_0x5a52a3)){var _0x190d8e=this;_0x5a52a3[_0x3e5b('0xd5')](function(_0x2b3ed4,_0x7849f7){_0x190d8e[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x15f'),_0x1c3872,_0x7849f7),_0x2b3ed4);});return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('variable\x20%s[key]\x20set',_0x1c3872));}else{return this[_0x3e5b('0x33')][_0x3e5b('0x97')](_0x1c3872,_0x5a52a3);}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x160')]=function(_0x3eae7e){logger['info'](util['format'](_0x3e5b('0x161'),_0x3eae7e[_0x3e5b('0x31')]));if(_0x3eae7e[_0x3e5b('0xa0')]===0x0){return this[_0x3e5b('0x9e')](_0x3eae7e);}_0x3eae7e['retry']-=0x1;if(!this['isConfigured'](_0x3eae7e[_0x3e5b('0x10d')])){return this[_0x3e5b('0x33')]['error'](_0x3eae7e,_0x3e5b('0x162'));}var _0x2ff312=this[_0x3e5b('0x1b')][_0x3e5b('0x9f')](this,_0x3eae7e['file_id']);if(!_0x2ff312){return this[_0x3e5b('0x33')]['error'](_0x3eae7e,'no\x20file\x20audio\x20found');}var _0x29fb7e=this[_0x3e5b('0x33')]['getData'](_0x2ff312,_0x3eae7e[_0x3e5b('0x163')],_0x3eae7e['digit']);var _0x43e02b=_0x29fb7e[_0x3e5b('0x9c')];if(_0x29fb7e['result']===-0x1){this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x3eae7e,'-1');return _0x29fb7e;}else if(_0x29fb7e[_0x3e5b('0x99')]===_0x3e5b('0x5f')){_0x29fb7e[_0x3e5b('0x9c')]=_0x29fb7e[_0x3e5b('0x9c')][_0x3e5b('0x96')]>0x0?_0x29fb7e[_0x3e5b('0x9c')]:'t';}else if(_['isEmpty'](_0x29fb7e[_0x3e5b('0x9c')])){_0x29fb7e['result']='#';_0x43e02b='#';}if(!this[_0x3e5b('0x7e')](_0x3eae7e[_0x3e5b('0xd3')])){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x10f'));}else{var _0x2fcbd8=this['getVariable'][_0x3e5b('0x9f')](this,_0x3eae7e[_0x3e5b('0xd3')]);if(!_0x2fcbd8){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x3eae7e,_0x3e5b('0x114'));}this['channel'][_0x3e5b('0x97')](_0x2fcbd8,_0x43e02b);}this['createSquareDetailsReport']['sync'](this,_0x3eae7e,_0x43e02b);return _0x29fb7e;};AGIVertices[_0x3e5b('0x11')]['noop']=function(_0x9b4e60){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x164'),_0x9b4e60['label']));return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x9b4e60[_0x3e5b('0x165')]||_0x9b4e60[_0x3e5b('0x31')]);};AGIVertices[_0x3e5b('0x11')]['pause']=function(_0x2284d7){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2284d7['label']));if(!this[_0x3e5b('0x7e')](_0x2284d7[_0x3e5b('0x152')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2284d7,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x154'),this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x2284d7[_0x3e5b('0x152')]));var _0x42c87b=this[_0x3e5b('0x46')][_0x3e5b('0x9f')](this,_0x2284d7[_0x3e5b('0x166')]);var _0x1d556a=this[_0x3e5b('0x167')][_0x3e5b('0x9f')](this,_0x2284d7[_0x3e5b('0x152')],_0x42c87b);if(_0x1d556a){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x155'),this['channel']['callerid'],_0x2284d7[_0x3e5b('0x152')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x155'),this[_0x3e5b('0x33')]['callerid'],_0x2284d7['findBy']));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x157'),this[_0x3e5b('0x33')]['callerid'],_0x2284d7['findBy']));this['channel'][_0x3e5b('0xa5')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x2284d7[_0x3e5b('0x152')]));return{'code':0xc8,'result':_0x3e5b('0x15a')};}};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x168')]=function(_0x16a569){logger[_0x3e5b('0x2a')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x16a569['label']));if(!this[_0x3e5b('0x7e')](_0x16a569['file_id'])){return this['channel'][_0x3e5b('0x4a')](_0x16a569,_0x3e5b('0x162'));}var _0x1d3249=this[_0x3e5b('0x1b')][_0x3e5b('0x9f')](this,_0x16a569[_0x3e5b('0x10d')]);if(!_0x1d3249){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x16a569,_0x3e5b('0x10e'));}var _0x36a41b=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0x169'),[_0x1d3249,_0x16a569[_0x3e5b('0xe0')]]);if(_0x36a41b['result']===-0x1){return _0x36a41b;}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x169'),_0x1d3249));};AGIVertices['prototype'][_0x3e5b('0x16a')]=function(_0x2b221e){logger['info'](util[_0x3e5b('0x94')]('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x2b221e[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2b221e[_0x3e5b('0x16b')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2b221e,_0x3e5b('0x16c'));}var _0x5845f1='';var _0x5df44d=parseInt(_0x2b221e[_0x3e5b('0x16b')],0xa);if(isNaN(_0x5df44d)){_0x5845f1=_0x2b221e[_0x3e5b('0x16b')];}else{_0x5845f1=this[_0x3e5b('0x16')]['sync'](this,_0x2b221e['queue_id']);if(!_0x5845f1){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2b221e,_0x3e5b('0x16d'));}}var _0x2e8920='';if(this[_0x3e5b('0x7e')](_0x2b221e['file_id'])){var _0x5e8a36=this['getSound'][_0x3e5b('0x9f')](this,_0x2b221e['file_id']);if(_0x5e8a36){_0x2e8920=_0x5e8a36;}}this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x2b221e,_0x5845f1);if(_0x2b221e[_0x3e5b('0xe0')][_0x3e5b('0x16e')]('x')<0x0){_0x2b221e['opts']+='x';}if(_0x2b221e['opts'][_0x3e5b('0x16e')]('X')<0x0){_0x2b221e[_0x3e5b('0xe0')]+='X';}this['channel'][_0x3e5b('0x97')](_0x3e5b('0x16f'),_0x5845f1?_0x5845f1[_0x3e5b('0x170')]():'');var _0x1ffff6=this[_0x3e5b('0x33')][_0x3e5b('0x4f')](_0x3e5b('0x171'),[_0x5845f1,_0x2b221e[_0x3e5b('0xe0')],_0x2b221e[_0x3e5b('0x5e')],_0x2e8920,_0x2b221e[_0x3e5b('0x5f')],_0x2b221e[_0x3e5b('0x8')],_0x2b221e['macro'],_0x2b221e[_0x3e5b('0x172')],'',_0x2b221e[_0x3e5b('0x173')]]);if(_0x1ffff6[_0x3e5b('0x9c')]===-0x1){return _0x1ffff6;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x171'),_0x5845f1));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x174')]=function(_0x1565e3){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x175'),_0x1565e3['label']));var _0x1a01f2=_0x1565e3[_0x3e5b('0x176')]||_0x3e5b('0x12c');var _0xb8565a=util[_0x3e5b('0x94')](_0x3e5b('0x177'),this[_0x3e5b('0x33')][_0x3e5b('0x30')],rs[_0x3e5b('0x116')](0x5));var _0xbaa631=util['format'](_0x3e5b('0x178'),FILES_PATH,_0xb8565a,_0x1a01f2);var _0x22cf28=util['format']('%s/recordings/%s',FILES_PATH,_0xb8565a);this[_0x3e5b('0x36')][_0x3e5b('0x9f')](this,_0x1565e3,_0xb8565a,_0xbaa631);this[_0x3e5b('0x33')][_0x3e5b('0x97')]('RECORDING_SAVENAME',_0xb8565a);logger[_0x3e5b('0x2a')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x22cf28,_0x1a01f2,_0x1565e3[_0x3e5b('0x179')],_0x1565e3[_0x3e5b('0x5f')]);return this['channel']['recordFile'](_0x22cf28,_0x1a01f2,_0x1565e3[_0x3e5b('0x179')],_0x1565e3['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x3e5b('0x17a')]=function(_0x42f144){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x17b'),_0x42f144[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x42f144['url'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x17c'));}var _0x749ca9=this[_0x3e5b('0x5d')]['sync'](this,_0x42f144);logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x17d'),util[_0x3e5b('0x17e')](_0x749ca9,{'showHidden':![],'depth':null})));if(!this[_0x3e5b('0x7e')](_0x42f144[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x17f'));}var _0x2eb9c2=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x42f144[_0x3e5b('0xd3')]);if(!_0x2eb9c2){return this['channel'][_0x3e5b('0x4a')](_0x42f144,_0x3e5b('0x114'));}this[_0x3e5b('0x33')][_0x3e5b('0x97')](util[_0x3e5b('0x94')]('%s_STATUS_CODE',_0x2eb9c2),_0x749ca9[_0x3e5b('0x70')]?_0x749ca9[_0x3e5b('0x70')]:_0x3e5b('0x180'));this['channel'][_0x3e5b('0x97')](util[_0x3e5b('0x94')](_0x3e5b('0x181'),_0x2eb9c2),_0x749ca9[_0x3e5b('0x71')]?_0x749ca9[_0x3e5b('0x71')]:'OK');if(_0x749ca9[_0x3e5b('0x6e')]){try{this[_0x3e5b('0x93')](_0x749ca9[_0x3e5b('0x6e')],_0x2eb9c2);}catch(_0x44ebf8){logger['error'](util[_0x3e5b('0x94')](_0x3e5b('0x182'),_0x2eb9c2));}}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0xd8'),_0x2eb9c2));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x183')]=function(_0x53601a){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x184'),_0x53601a['label']));return this[_0x3e5b('0x33')]['sayDigits'](_0x53601a['digits'][_0x3e5b('0x50')](/\s+/g,''),_0x53601a['escape_digits']);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x185')]=function(_0x7cc87c){logger['info'](util[_0x3e5b('0x94')](_0x3e5b('0x186'),_0x7cc87c[_0x3e5b('0x31')]));return this[_0x3e5b('0x33')][_0x3e5b('0x187')](_0x7cc87c[_0x3e5b('0x60')]['replace'](/\s+/g,''),_0x7cc87c['escape_digits']);};AGIVertices['prototype'][_0x3e5b('0x188')]=function(_0x5011d4){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x189'),_0x5011d4['label']));return this[_0x3e5b('0x33')][_0x3e5b('0x18a')](_0x5011d4[_0x3e5b('0x54')],_0x5011d4[_0x3e5b('0x179')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x18b')]=function(_0x71ac75){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x18c'),_0x71ac75['label']));if(!this[_0x3e5b('0x7e')](_0x71ac75[_0x3e5b('0x18d')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x18e'));}var _0x1f7d3d=this['getMailAccount'][_0x3e5b('0x9f')](this,_0x71ac75[_0x3e5b('0x18d')]);if(!_0x1f7d3d||!_0x1f7d3d['Smtp']){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x71ac75,_0x3e5b('0x18f'));}var _0x46cb69={'from':util['format'](_0x3e5b('0x190'),_0x1f7d3d['name'],_0x1f7d3d[_0x3e5b('0x191')]||_0x1f7d3d[_0x3e5b('0x192')]['user']),'to':_0x71ac75['to']||'','cc':_0x71ac75['cc']||'','bcc':_0x71ac75[_0x3e5b('0x193')]||'','subject':_0x71ac75[_0x3e5b('0x194')],'html':_0x71ac75['text'],'text':_0x71ac75[_0x3e5b('0x54')]};if(this['isConfigured'](_0x71ac75[_0x3e5b('0x195')])){}logger['debug'](_0x3e5b('0x196'),JSON['stringify'](_0x46cb69));this[_0x3e5b('0x2f')]['sync'](this,_0x71ac75,_0x71ac75['account_id']);this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x197'),_0x1f7d3d[_0x3e5b('0x14')]));this[_0x3e5b('0x1f')][_0x3e5b('0x9f')](this,_0x1f7d3d[_0x3e5b('0x198')],_0x46cb69);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x199'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x19a')]=function(_0x28c797){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x19b'),_0x28c797[_0x3e5b('0x31')]));return this['channel']['noop'](_0x3e5b('0x19c'));};AGIVertices['prototype'][_0x3e5b('0x19d')]=function(_0x2f09ff){logger['info'](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x2f09ff[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x2f09ff[_0x3e5b('0x19e')])){return this['channel']['noop'](_0x3e5b('0x19f'));}var _0x17ad80=this['getSmsAccount'][_0x3e5b('0x9f')](this,_0x2f09ff[_0x3e5b('0x19e')]);if(!_0x17ad80){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2f09ff,_0x3e5b('0x1a0'));}var _0x380fa7={'body':_0x2f09ff[_0x3e5b('0x1a1')],'phone':_0x2f09ff['to']||'','SmsAccountId':_0x17ad80['id']};logger['debug'](_0x3e5b('0x1a2'),JSON['stringify'](_0x380fa7));this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x2f09ff,_0x2f09ff[_0x3e5b('0x19e')]);this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util['format'](_0x3e5b('0x1a3'),_0x17ad80['name']));this[_0x3e5b('0x2e')][_0x3e5b('0x9f')](this,_0x380fa7);return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x3e5b('0x1a4')]=function(_0x2d57c8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x2d57c8['label']));if(!this[_0x3e5b('0x7e')](_0x2d57c8['variable_id'])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x2d57c8,_0x3e5b('0x1a5'));}var _0x5c7b05=this[_0x3e5b('0x12')]['sync'](this,_0x2d57c8[_0x3e5b('0xd3')]);if(!_0x5c7b05){return this[_0x3e5b('0x33')]['error'](_0x2d57c8,_0x3e5b('0x114'));}return this['channel'][_0x3e5b('0x97')](_0x5c7b05,_0x2d57c8[_0x3e5b('0x1a6')]);};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1a7')]=function(_0x2045aa){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1a8'),_0x2045aa[_0x3e5b('0x31')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('START\x20CALLY\x20SQUARE');var _0x4b4b4c=this[_0x3e5b('0x33')][_0x3e5b('0x12')](_0x3e5b('0x1a9'));if(!_[_0x3e5b('0x41')](_0x4b4b4c['extra'])){this[_0x3e5b('0x33')]['uniqueid']=_0x4b4b4c[_0x3e5b('0x99')];}if(_0x2045aa['answer']==='yes'){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x1aa'));return this[_0x3e5b('0x33')][_0x3e5b('0xb5')]();}return this[_0x3e5b('0x33')]['noop'](_0x3e5b('0x1ab'));};AGIVertices[_0x3e5b('0x11')]['subproject']=function(_0x221175){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1ac'),_0x221175[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x221175[_0x3e5b('0x1ad')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x221175,'no\x20subproject\x20selected');}var _0x14c3b4=this[_0x3e5b('0x1ae')][_0x3e5b('0x9f')](this,_0x221175[_0x3e5b('0x1ad')]);if(!this[_0x3e5b('0x7e')](_0x14c3b4)){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x221175,util[_0x3e5b('0x94')](_0x3e5b('0x1af'),_0x221175[_0x3e5b('0x1ad')]));}if(_0x14c3b4===this[_0x3e5b('0x33')][_0x3e5b('0x34')]){return this[_0x3e5b('0x33')]['error'](_0x221175,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x3e5b('0x2f')][_0x3e5b('0x9f')](this,_0x221175,_0x14c3b4);var _0x3b55ef=this[_0x3e5b('0x33')][_0x3e5b('0x4f')]('AGI',util[_0x3e5b('0x94')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x3e5b('0x8')][_0x3e5b('0x1b0')]||_0x3e5b('0x1b1'),_0x14c3b4,this[_0x3e5b('0x33')][_0x3e5b('0x34')]));if(_0x3b55ef[_0x3e5b('0x9c')]===-0x1){return _0x3b55ef;}return this['channel'][_0x3e5b('0xa5')](util['format']('Executed\x20command\x20%s\x20%s',_0x3e5b('0x1b2'),_0x14c3b4));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b3')]=function(_0x2ef84e){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1b4'),_0x2ef84e[_0x3e5b('0x31')]));var _0x236550=this[_0x3e5b('0x4e')][_0x3e5b('0x9f')](this,_0x2ef84e[_0x3e5b('0xb3')]);this[_0x3e5b('0x2f')]['sync'](this,_0x2ef84e,_0x2ef84e[_0x3e5b('0xb3')]);if(this[_0x3e5b('0x7e')](_0x2ef84e['variable_id'])){var _0x448a36=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x2ef84e[_0x3e5b('0xd3')]);if(_0x448a36){this['channel'][_0x3e5b('0x97')](_0x448a36,_0x236550);return this['channel']['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x1b5'),_0x2ef84e['command'],_0x448a36));}}return this['channel'][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2ef84e['command']));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1b6')]=function(_0x13a7f8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1b7'),_0x13a7f8[_0x3e5b('0x31')]));_0x13a7f8['text']=_0x13a7f8[_0x3e5b('0x54')][_0x3e5b('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3e5b('0x7e')](_0x13a7f8[_0x3e5b('0x52')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](_0x3e5b('0x1b8'));}if(!this[_0x3e5b('0x7e')](_0x13a7f8['text'])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x1b9'),_0x13a7f8[_0x3e5b('0x54')]));var _0x5dd58f=this[_0x3e5b('0x51')]['sync'](this,_0x13a7f8);if(_0x5dd58f){this[_0x3e5b('0x33')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x5dd58f));var _0x58a574=this[_0x3e5b('0x33')]['streamFile'](_0x5dd58f);try{fs[_0x3e5b('0xfe')](_0x5dd58f+'.wav');}catch(_0x210072){logger[_0x3e5b('0x4a')](_0x210072);}return _0x58a574;}return this['channel'][_0x3e5b('0x4a')](_0x13a7f8,_0x3e5b('0x1ba'));};AGIVertices[_0x3e5b('0x11')][_0x3e5b('0x1bb')]=function(_0x37c357){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1bc'),_0x37c357[_0x3e5b('0x31')]));_0x37c357['text']=_0x37c357[_0x3e5b('0x54')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x3e5b('0x7e')](_0x37c357[_0x3e5b('0x54')])){return this[_0x3e5b('0x33')][_0x3e5b('0xa5')]('no\x20text\x20configured');}this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')](_0x3e5b('0x1bd'),_0x37c357[_0x3e5b('0x54')]));var _0x6b5af5=this['googleTTS'][_0x3e5b('0x9f')](this,_0x37c357);if(_0x6b5af5){this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0x1be'),_0x6b5af5));var _0x2ac021=this[_0x3e5b('0x33')][_0x3e5b('0xfd')](_0x6b5af5);try{fs[_0x3e5b('0xfe')](_0x6b5af5+_0x3e5b('0x121'));}catch(_0x346812){logger[_0x3e5b('0x4a')](_0x346812);}return _0x2ac021;}return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x37c357,_0x3e5b('0x1bf'));};AGIVertices[_0x3e5b('0x11')]['unpause']=function(_0x21f3f8){logger[_0x3e5b('0x2a')](util['format'](_0x3e5b('0x1c0'),_0x21f3f8[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x21f3f8['findBy'])){return this[_0x3e5b('0x33')]['error'](_0x21f3f8,_0x3e5b('0x153'));}logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));var _0x422555=this[_0x3e5b('0x49')][_0x3e5b('0x9f')](this,_0x21f3f8[_0x3e5b('0x152')]);if(_0x422555){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));this[_0x3e5b('0x33')]['noop'](util[_0x3e5b('0x94')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8['findBy']));return{'code':0xc8,'result':_0x3e5b('0x156')};}else{logger['info'](util['format'](_0x3e5b('0x157'),this['channel'][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x3e5b('0x33')][_0x3e5b('0x35')],_0x21f3f8[_0x3e5b('0x152')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x3e5b('0x11')]['voicemail']=function(_0x1b1dc8){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1c1'),_0x1b1dc8['label']));var _0x297ebc=this['channel'][_0x3e5b('0x4f')](_0x3e5b('0x1c2'),[_0x1b1dc8[_0x3e5b('0x1c3')],_0x1b1dc8[_0x3e5b('0x74')]]);if(_0x297ebc[_0x3e5b('0x9c')]===-0x1){return _0x297ebc;}return this[_0x3e5b('0x33')][_0x3e5b('0xa5')](util[_0x3e5b('0x94')](_0x3e5b('0xc1'),_0x3e5b('0x1c2'),_0x1b1dc8[_0x3e5b('0x1c3')]));};AGIVertices[_0x3e5b('0x11')]['vswitch']=function(_0x5656f7){logger[_0x3e5b('0x2a')](util[_0x3e5b('0x94')](_0x3e5b('0x1c4'),_0x5656f7[_0x3e5b('0x31')]));if(!this[_0x3e5b('0x7e')](_0x5656f7[_0x3e5b('0xd3')])){return this[_0x3e5b('0x33')][_0x3e5b('0x4a')](_0x5656f7,'no\x20variable\x20selected');}var _0x558fa7=this[_0x3e5b('0x12')][_0x3e5b('0x9f')](this,_0x5656f7[_0x3e5b('0xd3')]);if(!_0x558fa7){return this['channel'][_0x3e5b('0x4a')](_0x5656f7,_0x3e5b('0x114'));}var _0x22e457=this[_0x3e5b('0x33')]['getVariable'](_0x558fa7);return{'code':0xc8,'result':_0x22e457['extra']?_0x22e457[_0x3e5b('0x99')]:'-'};};String[_0x3e5b('0x11')]['replaceAll']=function(_0x514438,_0x49b50c){return this[_0x3e5b('0x98')](_0x514438)[_0x3e5b('0x1c5')](_0x49b50c);};module[_0x3e5b('0x1c6')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 673966c..0ee1492 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(_0x4db46b,_0xadcb1a){var _0x565be8=function(_0x5d2e50){while(--_0x5d2e50){_0x4db46b['push'](_0x4db46b['shift']());}};_0x565be8(++_0xadcb1a);}(_0x71ab,0x64));var _0xb71a=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x71ab[_0x2f5ac5];return _0x37c9a8;};'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 _0xb4c7=['custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','seconds','prototype','updateAcw','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','acwTimeout','format','YYYY-MM-DD\x20HH:mm:ss','[ACW][START]\x20%s','message','stopAcw','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','stringify','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2f208f,_0x54978c){_0x2f208f=_0x2f208f-0x0;var _0x4d3a12=_0xb4c7[_0x2f208f];return _0x4d3a12;};'use strict';var _=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var ami=require(_0x7b4c('0x2'));var logger=require(_0x7b4c('0x3'))(_0x7b4c('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x7b4c('0x5'));function Acw(_0x149d55){this[_0x7b4c('0x6')]=_0x149d55[_0x7b4c('0x6')];this[_0x7b4c('0x7')]=_0x149d55['agents'];this[_0x7b4c('0x8')]=_0x149d55[_0x7b4c('0x8')];this[_0x7b4c('0x9')]={};ami['on']('agentconnect',this[_0x7b4c('0xa')][_0x7b4c('0xb')](this));ami['on']('hanguprequest',this[_0x7b4c('0xc')][_0x7b4c('0xb')](this));ami['on'](_0x7b4c('0xd'),this[_0x7b4c('0xe')][_0x7b4c('0xb')](this));ami['on'](_0x7b4c('0xf'),this[_0x7b4c('0x10')][_0x7b4c('0xb')](this));ami['on'](_0x7b4c('0x11'),this[_0x7b4c('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x7b4c('0x13')][_0x7b4c('0xb')](this));ami['on'](_0x7b4c('0x14'),this[_0x7b4c('0x15')][_0x7b4c('0xb')](this));}function getDiff(_0x341d36){var _0x3ea0da=moment()[_0x7b4c('0x16')](0x0);var _0x25b90b=moment(_0x341d36)[_0x7b4c('0x16')](0x0);return _0x3ea0da['diff'](_0x25b90b,_0x7b4c('0x17'));}Acw[_0x7b4c('0x18')][_0x7b4c('0x19')]=function(_0x2a0e2f,_0xa0a812){var _0x2471b3=this;var _0x1642e1=getDiff(_0x2471b3[_0x7b4c('0x8')][_0x2a0e2f]['lastPauseAt']);clearTimeout(_0x2471b3[_0x7b4c('0x8')][_0x2a0e2f][_0x7b4c('0x1a')]);_0x2471b3[_0x7b4c('0x8')][_0x2a0e2f][_0x7b4c('0x1a')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x1642e1},_0x2471b3[_0x7b4c('0x8')][_0x2a0e2f][_0x7b4c('0x1b')],_0x2a0e2f)[_0x7b4c('0x1c')](function(_0x380b79){logger[_0x7b4c('0x1d')](_0x7b4c('0x1e'),_0xa0a812,_0x1642e1,_0x380b79);})[_0x7b4c('0x1f')](function(_0x445281){logger[_0x7b4c('0x20')]('[%s][UPDATE][ERRORS:%s]',_0xa0a812,_0x445281);})[_0x7b4c('0x21')](function(){delete _0x2471b3[_0x7b4c('0x8')][_0x2a0e2f];});};Acw[_0x7b4c('0x18')][_0x7b4c('0x22')]=function(_0x148a79){try{var _0x168ac9=this;var _0x176704=this[_0x7b4c('0x9')][_0x148a79][_0x7b4c('0x23')];var _0x2c267c=this['channels'][_0x148a79][_0x7b4c('0x24')];var _0x4350c9=this[_0x7b4c('0x6')][_0x2c267c];var _0x3157b8=![];var _0x3124e7=_0x7b4c('0x25');if(_0x4350c9[_0x7b4c('0x26')]&&_0x4350c9[_0x7b4c('0x27')][_0x7b4c('0x28')]){_0x3157b8=!![];_0x3124e7=_0x4350c9[_0x7b4c('0x27')][_0x7b4c('0x28')];}if(!_0x168ac9[_0x7b4c('0x7')][_0x176704]){return Promise[_0x7b4c('0x29')]();}return RpcUser['getAgent'](_0x168ac9[_0x7b4c('0x7')][_0x176704]['id'])[_0x7b4c('0x1c')](function(_0x1fe0f5){if(!_0x1fe0f5||_0x1fe0f5[_0x7b4c('0x2a')]){logger[_0x7b4c('0x1d')](_0x7b4c('0x2b'),_0x148a79,_0x176704,_0x2c267c);return;}logger[_0x7b4c('0x1d')](_0x7b4c('0x2c'),_0x148a79,_0x176704,_0x2c267c);var _0x3e4a46=_0x168ac9[_0x7b4c('0x9')][_0x148a79][_0x7b4c('0x2d')]&&_0x168ac9[_0x7b4c('0x9')][_0x148a79][_0x7b4c('0x2e')]?_0x168ac9[_0x7b4c('0x9')][_0x148a79][_0x7b4c('0x2e')]:_0x148a79;return RpcUser[_0x7b4c('0x2f')](_0x168ac9[_0x7b4c('0x7')][_0x176704],_0x3124e7,_0x3e4a46);})[_0x7b4c('0x1c')](function(_0x9d3d31){if(_0x3157b8||!_0x9d3d31){return;}_0x168ac9['timers'][_0x176704]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x148a79,_0x168ac9[_0x7b4c('0x6')][_0x2c267c][_0x7b4c('0x30')],_0x176704,_0x2c267c);_0x168ac9[_0x7b4c('0x8')][_0x176704][_0x7b4c('0x1a')]=setTimeout(_0x168ac9['stopAcw'][_0x7b4c('0xb')](_0x168ac9,_0x176704),_0x168ac9[_0x7b4c('0x6')][_0x2c267c]['acwTimeout']*0x3e8);_0x168ac9[_0x7b4c('0x8')][_0x176704]['lastPauseAt']=moment()[_0x7b4c('0x31')](_0x7b4c('0x32'));_0x168ac9[_0x7b4c('0x8')][_0x176704]['uniqueid']=_0x148a79;_0x168ac9[_0x7b4c('0x8')][_0x176704][_0x7b4c('0x24')]=_0x2c267c;_0x168ac9['timers'][_0x176704][_0x7b4c('0x19')]=_0x168ac9[_0x7b4c('0x19')][_0x7b4c('0xb')](_0x168ac9,_0x176704,_0x148a79);})[_0x7b4c('0x1f')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x148a79,_0x168ac9[_0x7b4c('0x6')][_0x2c267c][_0x7b4c('0x30')],_0x176704,_0x2c267c);})['finally'](function(){delete _0x168ac9[_0x7b4c('0x9')][_0x148a79];});}catch(_0x4a451f){logger['error'](_0x7b4c('0x33'),_0x4a451f[_0x7b4c('0x34')]);}};Acw[_0x7b4c('0x18')][_0x7b4c('0x35')]=function(_0x5ba56a){try{var _0x81ddf4=this;if(_0x81ddf4[_0x7b4c('0x8')][_0x5ba56a]){_0x81ddf4[_0x7b4c('0x8')][_0x5ba56a][_0x7b4c('0x1a')]=![];var _0x346e0c=_0x81ddf4[_0x7b4c('0x8')][_0x5ba56a][_0x7b4c('0x1b')];var _0x4c23cc=_0x81ddf4['timers'][_0x5ba56a][_0x7b4c('0x24')];var _0x37f136=_0x81ddf4[_0x7b4c('0x6')][_0x4c23cc][_0x7b4c('0x30')];logger[_0x7b4c('0x1d')]('[%s][TIMER][STOP][AGENT:%s]',_0x346e0c,_0x5ba56a);RpcUser[_0x7b4c('0x36')](this[_0x7b4c('0x7')][_0x5ba56a]);RpcVoiceAgentReport[_0x7b4c('0x37')]({'acwtime':_0x37f136,'agentacw':!![]},_0x346e0c,_0x5ba56a)[_0x7b4c('0x1c')](function(_0x22f71b){logger[_0x7b4c('0x1d')](_0x7b4c('0x1e'),_0x346e0c,_0x37f136,_0x22f71b);})[_0x7b4c('0x1f')](function(_0x3d8126){logger['error'](_0x7b4c('0x38'),_0x346e0c,_0x3d8126);});}else{logger['error'](_0x7b4c('0x39'),_0x5ba56a);if(_0x81ddf4['timers']){logger[_0x7b4c('0x1d')](_0x7b4c('0x3a'),JSON['stringify'](_0x81ddf4['timers']));}}}catch(_0x354578){logger[_0x7b4c('0x20')](_0x7b4c('0x3b'),_0x354578[_0x7b4c('0x34')]);}};Acw['prototype'][_0x7b4c('0xa')]=function(_0x2ed731){try{if(this[_0x7b4c('0x6')][_0x2ed731['queue']]&&(this[_0x7b4c('0x6')][_0x2ed731['queue']]['acw']||this[_0x7b4c('0x6')][_0x2ed731['queue']][_0x7b4c('0x26')])){if(this[_0x7b4c('0x7')][_0x2ed731[_0x7b4c('0x23')]]){this[_0x7b4c('0x9')][_0x2ed731[_0x7b4c('0x1b')]]={'queue':_0x2ed731[_0x7b4c('0x24')],'interface':_0x2ed731[_0x7b4c('0x23')],'destlinkedid':_0x2ed731[_0x7b4c('0x2e')]};}}}catch(_0x3f3d46){logger['error'](_0x7b4c('0x3c'),_0x3f3d46['message']);}};Acw['prototype'][_0x7b4c('0x15')]=function(_0x1f1653){try{if(this['voiceQueues'][_0x1f1653['queue']]&&(this[_0x7b4c('0x6')][_0x1f1653[_0x7b4c('0x24')]][_0x7b4c('0x4')]||this[_0x7b4c('0x6')][_0x1f1653[_0x7b4c('0x24')]][_0x7b4c('0x26')])){if(this[_0x7b4c('0x7')][_0x1f1653[_0x7b4c('0x23')]]){this['channels'][_0x1f1653[_0x7b4c('0x1b')]]={'queue':_0x1f1653[_0x7b4c('0x24')],'interface':_0x1f1653[_0x7b4c('0x23')]};}}}catch(_0x387efd){logger[_0x7b4c('0x20')](_0x7b4c('0x3d'),_0x387efd[_0x7b4c('0x34')]);}};Acw[_0x7b4c('0x18')][_0x7b4c('0xc')]=function(_0x5a1262){try{if(this['channels'][_0x5a1262[_0x7b4c('0x1b')]]&&_[_0x7b4c('0x3e')](this[_0x7b4c('0x9')][_0x5a1262['uniqueid']][_0x7b4c('0x2d')])){logger[_0x7b4c('0x1d')]('[%s][HANGUP:UNIQUEID]',_0x5a1262[_0x7b4c('0x1b')]);this['startAcw'](_0x5a1262[_0x7b4c('0x1b')]);}else if(this['channels'][_0x5a1262[_0x7b4c('0x3f')]]&&_['isUndefined'](this[_0x7b4c('0x9')][_0x5a1262[_0x7b4c('0x3f')]]['attended'])){logger['info'](_0x7b4c('0x40'),_0x5a1262[_0x7b4c('0x3f')]);this[_0x7b4c('0x22')](_0x5a1262['linkedid']);}}catch(_0x56233b){logger[_0x7b4c('0x20')](_0x7b4c('0x41'),_0x56233b['message']);}};Acw['prototype'][_0x7b4c('0xe')]=function(_0x2a1442){try{if(this[_0x7b4c('0x9')][_0x2a1442['uniqueid']]&&this[_0x7b4c('0x9')][_0x2a1442[_0x7b4c('0x1b')]]['attended']){logger['info'](_0x7b4c('0x42'),_0x2a1442['uniqueid']);this['startAcw'](_0x2a1442[_0x7b4c('0x1b')]);}else if(this['channels'][_0x2a1442['linkedid']]&&this[_0x7b4c('0x9')][_0x2a1442[_0x7b4c('0x3f')]][_0x7b4c('0x2d')]){logger[_0x7b4c('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x2a1442['linkedid']);this[_0x7b4c('0x22')](_0x2a1442[_0x7b4c('0x3f')]);}}catch(_0x30a7e3){logger['error'](_0x7b4c('0x43'),_0x30a7e3[_0x7b4c('0x34')]);}};Acw[_0x7b4c('0x18')]['syncAttendedTransfer']=function(_0x451675){try{if(!_[_0x7b4c('0x44')](this['channels'][_0x451675[_0x7b4c('0x45')]])){this[_0x7b4c('0x22')](_0x451675[_0x7b4c('0x45')]);if(this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x46')]]){this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x46')]]['attended']=!![];this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x47')]]=this['channels'][_0x451675[_0x7b4c('0x46')]];delete this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x46')]];}}else if(!_[_0x7b4c('0x44')](this['channels'][_0x451675[_0x7b4c('0x47')]])){this['startAcw'](_0x451675['transfertargetuniqueid']);if(this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x48')]]){this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x48')]][_0x7b4c('0x2d')]=!![];this['channels'][_0x451675['transfereeuniqueid']]=this[_0x7b4c('0x9')][_0x451675[_0x7b4c('0x48')]];delete this[_0x7b4c('0x9')][_0x451675['origtransfereruniqueid']];}}}catch(_0xade53c){logger[_0x7b4c('0x20')](_0x7b4c('0x49'),_0xade53c['message']);}};Acw[_0x7b4c('0x18')][_0x7b4c('0x13')]=function(_0xf6f913){try{if(this['channels'][_0xf6f913[_0x7b4c('0x4a')]]){logger[_0x7b4c('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x7b4c('0x4b')](_0xf6f913['transfereruniqueid']));this[_0x7b4c('0x22')](_0xf6f913[_0x7b4c('0x4a')]);}else if(this[_0x7b4c('0x9')][_0xf6f913['transfererlinkedid']]){logger['info'](_0x7b4c('0x4c'),JSON[_0x7b4c('0x4b')](_0xf6f913[_0x7b4c('0x4d')]));this['startAcw'](_0xf6f913[_0x7b4c('0x4d')]);}}catch(_0x49b068){logger[_0x7b4c('0x20')](_0x7b4c('0x4e'),_0x49b068[_0x7b4c('0x34')]);}};Acw[_0x7b4c('0x18')][_0x7b4c('0x10')]=function(_0x57c52b){try{if(this[_0x7b4c('0x6')][_0x57c52b[_0x7b4c('0x24')]]&&this['voiceQueues'][_0x57c52b[_0x7b4c('0x24')]][_0x7b4c('0x4f')]===_0x7b4c('0x50')){if(this[_0x7b4c('0x7')][_0x57c52b[_0x7b4c('0x23')]]){logger[_0x7b4c('0x1d')](_0x7b4c('0x51'),_0x57c52b[_0x7b4c('0x1b')],_0x57c52b['interface'],_0x57c52b[_0x7b4c('0x24')]);return RpcUser[_0x7b4c('0x2f')](this[_0x7b4c('0x7')][_0x57c52b[_0x7b4c('0x23')]],_0x7b4c('0x52'),_0x57c52b[_0x7b4c('0x1b')]);}}}catch(_0x2f3ba9){logger[_0x7b4c('0x20')](_0x7b4c('0x53'),_0x2f3ba9[_0x7b4c('0x34')]);}};module[_0x7b4c('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index ff85c1c..6f389b3 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 _0x34ea=['close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','once','exports','asterisk-manager','bluebird','util','../../config/logger','ami','../../config/environment','port','asterisk','username','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x34ea,0x18a));var _0xa34e=function(_0x52c6e8,_0x5e5692){_0x52c6e8=_0x52c6e8-0x0;var _0x335328=_0x34ea[_0x52c6e8];return _0x335328;};'use strict';var Manager=require(_0xa34e('0x0'));var BPromise=require(_0xa34e('0x1'));var util=require(_0xa34e('0x2'));var logger=require(_0xa34e('0x3'))(_0xa34e('0x4'));var config=require(_0xa34e('0x5'));var ami=new Manager(config['asterisk'][_0xa34e('0x6')],config[_0xa34e('0x7')]['ip'],config[_0xa34e('0x7')][_0xa34e('0x8')],config[_0xa34e('0x7')]['password'],!![]);ami['keepConnected']();ami[_0xa34e('0x9')]=BPromise[_0xa34e('0xa')](ami['action']);function error(_0xf4be19){logger['error'](util[_0xa34e('0xb')](_0xa34e('0xc'),config[_0xa34e('0x7')][_0xa34e('0x8')],config[_0xa34e('0x7')]['ip'],config[_0xa34e('0x7')][_0xa34e('0x6')],util[_0xa34e('0xd')](_0xf4be19,![],null)));}function close(){logger[_0xa34e('0xe')](util[_0xa34e('0xb')](_0xa34e('0xf'),config[_0xa34e('0x7')][_0xa34e('0x8')],config[_0xa34e('0x7')]['ip'],config[_0xa34e('0x7')][_0xa34e('0x6')]));}ami[_0xa34e('0x10')]=function(){return function(){return ami[_0xa34e('0x9')]({'action':_0xa34e('0x11')});};};ami[_0xa34e('0x12')]=function(){return function(){return ami[_0xa34e('0x9')]({'action':_0xa34e('0x13')});};};ami[_0xa34e('0x14')]=function(){return function(){return ami[_0xa34e('0x9')]({'action':_0xa34e('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xa34e('0x9')]({'action':_0xa34e('0x16')});};};ami[_0xa34e('0x17')]=function(){return function(){return ami[_0xa34e('0x9')]({'action':'coreshowchannels'});};};function connect(){logger[_0xa34e('0x18')](util[_0xa34e('0xb')](_0xa34e('0x19'),config[_0xa34e('0x7')][_0xa34e('0x8')],config[_0xa34e('0x7')]['ip'],config['asterisk'][_0xa34e('0x6')]));ami['once'](_0xa34e('0xe'),error);ami['once'](_0xa34e('0x1a'),close);}ami['on']('connect',connect);ami['on'](_0xa34e('0x1b'),function(_0x18b0eb){logger[_0xa34e('0x18')](util[_0xa34e('0xb')](_0xa34e('0x1c'),config[_0xa34e('0x7')][_0xa34e('0x8')],config[_0xa34e('0x7')]['ip'],config[_0xa34e('0x7')]['port'],util[_0xa34e('0xd')](_0x18b0eb,![],null)));});ami['on'](_0xa34e('0x1d'),function(){logger[_0xa34e('0x18')](util['format'](_0xa34e('0x1e'),config[_0xa34e('0x7')]['username'],config['asterisk']['ip'],config['asterisk'][_0xa34e('0x6')]));return Promise['resolve']()[_0xa34e('0x1f')](ami['actionSipShowRegistry']())[_0xa34e('0x1f')](ami[_0xa34e('0x12')]())[_0xa34e('0x1f')](ami[_0xa34e('0x14')]())['then'](ami[_0xa34e('0x20')]())['then'](ami[_0xa34e('0x17')]())['catch'](function(_0x32634e){logger[_0xa34e('0xe')]('[ami.js][fullybooted]',util[_0xa34e('0xd')](_0x32634e,{'showHidden':![],'depth':null}));});});ami[_0xa34e('0x21')](_0xa34e('0xe'),error);ami['once'](_0xa34e('0x1a'),close);module[_0xa34e('0x22')]=ami; \ No newline at end of file +var _0xeabe=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','[ami.js][fullybooted]','bluebird','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','port','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels'];(function(_0x497672,_0x12ffe6){var _0x392c0b=function(_0x52de72){while(--_0x52de72){_0x497672['push'](_0x497672['shift']());}};_0x392c0b(++_0x12ffe6);}(_0xeabe,0xdd));var _0xeeab=function(_0x1c8b26,_0x2b1211){_0x1c8b26=_0x1c8b26-0x0;var _0x52e32b=_0xeabe[_0x1c8b26];return _0x52e32b;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xeeab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xeeab('0x1'));var config=require(_0xeeab('0x2'));var ami=new Manager(config[_0xeeab('0x3')]['port'],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')][_0xeeab('0x4')],config[_0xeeab('0x3')][_0xeeab('0x5')],!![]);ami[_0xeeab('0x6')]();ami[_0xeeab('0x7')]=BPromise[_0xeeab('0x8')](ami[_0xeeab('0x9')]);function error(_0x3dac4a){logger[_0xeeab('0xa')](util[_0xeeab('0xb')](_0xeeab('0xc'),config['asterisk']['username'],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')]['port'],util[_0xeeab('0xd')](_0x3dac4a,![],null)));}function close(){logger[_0xeeab('0xa')](util[_0xeeab('0xb')](_0xeeab('0xe'),config['asterisk'][_0xeeab('0x4')],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')][_0xeeab('0xf')]));}ami[_0xeeab('0x10')]=function(){return function(){return ami[_0xeeab('0x7')]({'action':_0xeeab('0x11')});};};ami[_0xeeab('0x12')]=function(){return function(){return ami[_0xeeab('0x7')]({'action':'devicestatelist'});};};ami[_0xeeab('0x13')]=function(){return function(){return ami[_0xeeab('0x7')]({'action':'sippeerstatus'});};};ami[_0xeeab('0x14')]=function(){return function(){return ami[_0xeeab('0x7')]({'action':_0xeeab('0x15')});};};ami[_0xeeab('0x16')]=function(){return function(){return ami[_0xeeab('0x7')]({'action':_0xeeab('0x17')});};};function connect(){logger[_0xeeab('0x18')](util[_0xeeab('0xb')](_0xeeab('0x19'),config['asterisk'][_0xeeab('0x4')],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')][_0xeeab('0xf')]));ami[_0xeeab('0x1a')](_0xeeab('0xa'),error);ami[_0xeeab('0x1a')](_0xeeab('0x1b'),close);}ami['on'](_0xeeab('0x1c'),connect);ami['on']('shutdown',function(_0x42e629){logger['info'](util[_0xeeab('0xb')](_0xeeab('0x1d'),config[_0xeeab('0x3')][_0xeeab('0x4')],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')][_0xeeab('0xf')],util[_0xeeab('0xd')](_0x42e629,![],null)));});ami['on'](_0xeeab('0x1e'),function(){logger[_0xeeab('0x18')](util['format'](_0xeeab('0x1f'),config[_0xeeab('0x3')][_0xeeab('0x4')],config[_0xeeab('0x3')]['ip'],config[_0xeeab('0x3')][_0xeeab('0xf')]));return Promise[_0xeeab('0x20')]()[_0xeeab('0x21')](ami[_0xeeab('0x10')]())['then'](ami[_0xeeab('0x12')]())['then'](ami[_0xeeab('0x13')]())[_0xeeab('0x21')](ami[_0xeeab('0x14')]())[_0xeeab('0x21')](ami['actionCoreShowChannels']())['catch'](function(_0x522148){logger['error'](_0xeeab('0x22'),util[_0xeeab('0xd')](_0x522148,{'showHidden':![],'depth':null}));});});ami[_0xeeab('0x1a')]('error',error);ami[_0xeeab('0x1a')](_0xeeab('0x1b'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index c7ffe43..7cc2654 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(_0x151381,_0x97b314){var _0x2afab6=function(_0x4b3941){while(--_0x4b3941){_0x151381['push'](_0x151381['shift']());}};_0x2afab6(++_0x97b314);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'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 _0x9c44=['ami','client','http','Request','then','debug','rpc','memberReport','error','message','result','exports','../../config/logger'];(function(_0x511e61,_0xdcb9c4){var _0x515a1b=function(_0x1fc1e1){while(--_0x1fc1e1){_0x511e61['push'](_0x511e61['shift']());}};_0x515a1b(++_0xdcb9c4);}(_0x9c44,0x178));var _0x49c4=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0x9c44[_0x6cf19c];return _0xce14f3;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x49c4('0x0'))(_0x49c4('0x1'));var client=jayson[_0x49c4('0x2')][_0x49c4('0x3')]({'port':0x2329});client[_0x49c4('0x4')]=function(_0x2ad237,_0x4e0313){return new BPromise(function(_0x4941f1,_0x41a183){return client['request'](_0x2ad237,_0x4e0313)[_0x49c4('0x5')](function(_0x6030ae){logger[_0x49c4('0x6')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x4e0313,_0x6030ae);if(_0x6030ae['error']){logger[_0x49c4('0x9')](_0x49c4('0x7'),_0x49c4('0x8'),_0x2ad237,_0x6030ae[_0x49c4('0x9')]['message'],_0x4e0313);return _0x41a183(_0x6030ae['error'][_0x49c4('0xa')]);}else{return _0x4941f1(_0x6030ae[_0x49c4('0xb')]);}})['catch'](function(_0xb611a1){logger[_0x49c4('0x9')]('rpc','memberReport',_0x2ad237,_0xb611a1,_0x4e0313);return _0x41a183(_0xb611a1);});});};module[_0x49c4('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 5b1cecc..cade73f 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 _0x5aae=['dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','entity\x20is\x20undefine','[callProgressDetecting]','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','custom:agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','startProgressive','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','predictiveIntervalPauses','loggedIn','startMethodPredictive','milliseconds','[handlePredictive]','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','Blacklist','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','checkIsBlackList','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','redis','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','queueBooked','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','then','isUndefined','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive','debug','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','Error','active','SIP/%s','reachable','status','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','checkIfTime','ifTimeIvr','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','ifTime','isArray','length','push','Action','command','iftime\x20%s,%s','interval','content','indexOf','catch','true','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialTimezone','checkIfTimeIntervals','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower','Queue','method\x20not\x20recognized','dialGlobalInterval','silly','Dialer::ifTime()','isGlobal','[ifTime][Action]','queue','uniqueId','uniqueid','updateOriginated','answertime','ivr','outboundAnswerCallsDay','reason','agent','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','Drop','dropreason','TIMEOUT','agiafterat','countdropretry','callAdditionalPhoneAfterMin','voiceQueue','additional','queueCallerAbandonCreateState','rescheduleContact','add','dialDropRetryFrequency','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','verifyAdditionalPhones','dialAbandonedRetryFrequency','minutes','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','actionid','rrmemory','roundrobin','locked','paused','stateinterface','isNil','syncQueueStatusComplete','strategy','preview','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','idHopper','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','responsetime','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','outboundAnswerAgiCallsDay','HangupInAMD','emit','buildObj','amd','saveInDb','[syncHangupInAMD]','MACHINE','Machine','AMD','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[rescheduleContact][Machine]','HANGUP','membername','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','value','createStateFinal','dialMachineRetryFrequency','ivrAnswerCallsDay','moveContactManagedDialer','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','INACTIVE','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','launchHandleIvr','actionOriginate','object','originate','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','isTrunkReachable','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','checkRetriveMax','countagentrejectretry','dialNoAnswerMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry'];(function(_0x5dfc25,_0x123317){var _0x3a21d0=function(_0x29c234){while(--_0x29c234){_0x5dfc25['push'](_0x5dfc25['shift']());}};_0x3a21d0(++_0x123317);}(_0x5aae,0x87));var _0xe5aa=function(_0x5d9be4,_0x5df4b6){_0x5d9be4=_0x5d9be4-0x0;var _0x44650b=_0x5aae[_0x5d9be4];return _0x44650b;};'use strict';var util=require(_0xe5aa('0x0'));var _=require('lodash');var uuid=require(_0xe5aa('0x1'));var moment=require(_0xe5aa('0x2'));var rr=require('rr');var Redis=require(_0xe5aa('0x3'));var utils=require(_0xe5aa('0x4'));var hopperUtils=require(_0xe5aa('0x5'));var ut=require(_0xe5aa('0x6'));var config=require(_0xe5aa('0x7'));var logger=require(_0xe5aa('0x8'))('dialer');var loggerBooked=require(_0xe5aa('0x8'))(_0xe5aa('0x9'));var loggerPredictive=require(_0xe5aa('0x8'))(_0xe5aa('0xa'));var loggerPredictiveCalls=require(_0xe5aa('0x8'))(_0xe5aa('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0xe5aa('0xc'));var ami=require('../ami');config[_0xe5aa('0xd')]=_['defaults'](config[_0xe5aa('0xd')],{'host':'localhost','port':0x18eb});var io=require(_0xe5aa('0xe'))(new Redis(config[_0xe5aa('0xd')]));var cmHopper=require(_0xe5aa('0xf'));var voiceQueueRt=require(_0xe5aa('0x10'));var RpcSetting=require(_0xe5aa('0x11'));var Interval=require(_0xe5aa('0x12'));var Action=require('./models/action');var History=require(_0xe5aa('0x13'));var Final=require(_0xe5aa('0x14'));var AgentComplete=require(_0xe5aa('0x15'));var QueueCallerAbandon=require(_0xe5aa('0x16'));var Hangup=require(_0xe5aa('0x17'));var ipAgi=process['env'][_0xe5aa('0x18')]||_0xe5aa('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xe5aa('0x1a')][_0xe5aa('0x1b')]=function(_0x17d7e9){this[_0xe5aa('0x1c')]=this['tail']?this[_0xe5aa('0x1c')][_0xe5aa('0x1d')](_0x17d7e9):_0x17d7e9();};function Dialer(_0x149336,_0x5469d5){this[_0xe5aa('0x1e')]=new Sequence();this['preview']=_0x5469d5;this[_0xe5aa('0x1f')]=_0x149336[_0xe5aa('0x1f')];this[_0xe5aa('0x20')]=_0x149336['campaigns'];this[_0xe5aa('0x21')]=_0x149336['agents'];this[_0xe5aa('0x22')]=_0x149336[_0xe5aa('0x22')];this[_0xe5aa('0x23')]=config[_0xe5aa('0x23')]||0x2;this['channels']={};this['actions']={};this[_0xe5aa('0x24')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this['startProgressive']={};this['ivrOriginated']={};this[_0xe5aa('0x25')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0xe5aa('0x26')][_0xe5aa('0x27')](this));ami['on'](_0xe5aa('0x28'),this[_0xe5aa('0x29')][_0xe5aa('0x27')](this));ami['on']('originateresponse',this[_0xe5aa('0x2a')]['bind'](this));ami['on'](_0xe5aa('0x2b'),this[_0xe5aa('0x2c')]['bind'](this));ami['on'](_0xe5aa('0x2d'),this[_0xe5aa('0xc')][_0xe5aa('0x27')](this));ami['on'](_0xe5aa('0x2e'),this[_0xe5aa('0x2f')][_0xe5aa('0x27')](this));ami['on'](_0xe5aa('0x30'),this[_0xe5aa('0x31')]['bind'](this));ami['on'](_0xe5aa('0x32'),this[_0xe5aa('0x33')]['bind'](this));ami['on'](_0xe5aa('0x34'),this[_0xe5aa('0x35')][_0xe5aa('0x27')](this));ami['on']('queuemember',this[_0xe5aa('0x36')][_0xe5aa('0x27')](this));ami['on'](_0xe5aa('0x37'),this['syncQueueStatusComplete'][_0xe5aa('0x27')](this));this[_0xe5aa('0x38')]();this['loopClearZombieChannels']();RpcSetting[_0xe5aa('0x39')]()[_0xe5aa('0x3a')](function(_0x15233e){previewRecallmeReminderInterval=_0x15233e['previewRecallmeReminderInterval'];});}function isNotNull(_0xc500b2){return _0xc500b2!==null&&!_[_0xe5aa('0x3b')](_0xc500b2);}function msgResponse(_0x2a4d7d,_0x152487,_0x3347eb){return{'action':_0x2a4d7d,'response':_0x152487,'message':_0x3347eb,'stack':_0x3347eb};}function emit(_0x412c28,_0x3e774c,_0xdf7513){io['to'](_0x412c28)['emit'](_0x3e774c,_0xdf7513);}function emitOutboundVoiceQueueSummary(_0x4bb794){if(_0x4bb794[_0xe5aa('0x3c')]===_0xe5aa('0x3d')){logger['debug'](_0xe5aa('0x3e'),util[_0xe5aa('0x3f')](_0x4bb794,{'showHidden':![],'depth':null}));emit(util[_0xe5aa('0x40')]('voice:queue:%s',_0x4bb794[_0xe5aa('0x41')]),_0xe5aa('0x42'),_0x4bb794);}}function checkGetDataPredictive(_0x4ac073){if(isNotNull(_0x4ac073)&&!_[_0xe5aa('0x43')](_0x4ac073)){loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x45'));loggerPredictive[_0xe5aa('0x44')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ac073[_0xe5aa('0x46')]);loggerPredictive['info'](_0xe5aa('0x47'),_0x4ac073[_0xe5aa('0x48')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x49'),_0x4ac073[_0xe5aa('0x4a')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x4b'),_0x4ac073[_0xe5aa('0x4c')]);loggerPredictive[_0xe5aa('0x44')]('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ac073[_0xe5aa('0x4d')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x4e'),_0x4ac073[_0xe5aa('0x4f')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x50'));if(_0x4ac073['predictiveIntervalTotalCalls']>0x0){if(!_[_0xe5aa('0x3b')](_0x4ac073['predictiveIntervalAvgTalktime'])&&_0x4ac073[_0xe5aa('0x4f')]>0x0){return!![];}loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x51'));if(!_[_0xe5aa('0x3b')](_0x4ac073[_0xe5aa('0x4d')])&&_0x4ac073['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x52'));}else{loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x53'));}}else{loggerPredictive[_0xe5aa('0x44')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5b3e85){return function(_0xf332ff){loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x54'));loggerPredictive['info']('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf332ff[_0xe5aa('0x55')]);loggerPredictive[_0xe5aa('0x44')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf332ff[_0xe5aa('0x56')]);loggerPredictive[_0xe5aa('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf332ff[_0xe5aa('0x57')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x58'),_0xf332ff[_0xe5aa('0x59')]);loggerPredictive[_0xe5aa('0x44')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xf332ff[_0xe5aa('0x57')]);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x50'));_[_0xe5aa('0x5a')](_0x5b3e85,_0xf332ff);};}function ifInterval(_0x29a428,_0x2a40e3){if(_['isUndefined'](_0x2a40e3)){return![];}return utils[_0xe5aa('0x5b')](undefined,_0x2a40e3)<_0x29a428*0x3c;}function clearPredictiveAttributes(_0x5c1e2c){if(_0x5c1e2c['startProgressive']){_0x5c1e2c['startProgressive']=undefined;loggerPredictive['debug'](_0x5c1e2c[_0xe5aa('0x41')],_0xe5aa('0x5c'));}if(_0x5c1e2c[_0xe5aa('0x5d')]){_0x5c1e2c[_0xe5aa('0x5d')]=undefined;loggerPredictive[_0xe5aa('0x5e')](_0x5c1e2c[_0xe5aa('0x41')],_0xe5aa('0x5f'));}if(_0x5c1e2c[_0xe5aa('0x60')]){clearInterval(_0x5c1e2c['handlePredictive']);_0x5c1e2c[_0xe5aa('0x60')]=undefined;loggerPredictive[_0xe5aa('0x5e')](_0x5c1e2c[_0xe5aa('0x41')],_0xe5aa('0x61'));}}function loggerCatchPredictive(_0x1e8de5,_0x11d8e6){return function(_0x399736){loggerPredictive['error'](_0x11d8e6[_0xe5aa('0x41')],_0x1e8de5);loggerPredictive[_0xe5aa('0x62')](_0x399736[_0xe5aa('0x63')]);clearPredictiveAttributes(_0x11d8e6);};}function loggerCatch(_0x5b8c89){return function(_0x6e5d4e){logger[_0xe5aa('0x62')](_0x5b8c89,util[_0xe5aa('0x3f')](_0x6e5d4e,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x489be2,_0x6573d5,_0x34c82e){return function(_0xb4fd3c){utils[_0xe5aa('0x64')](_0x6573d5,_0x34c82e,0x0);_0x6573d5[_0xe5aa('0x65')]=0x0;logger[_0xe5aa('0x62')](_0x489be2,util[_0xe5aa('0x3f')](_0xb4fd3c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x33bae7){return function(_0x42fac8){if(isNotNull(_0x42fac8)&&isNotNull(_0x42fac8[0x0])){if(_0x42fac8[0x0]['contactsRescheduled']>0x0){_0x33bae7[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')][_0xe5aa('0x68')];logger[_0xe5aa('0x44')]('[getContactDialer2][ReScheduled]'+_0x33bae7['name'],_0x42fac8[0x0][_0xe5aa('0x69')],_0xe5aa('0x6a'));}else{_0x33bae7[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')][_0xe5aa('0x6b')];logger[_0xe5aa('0x44')]('[getContactDialer2][Empty]'+_0x33bae7[_0xe5aa('0x41')]);}}};}function createObjHistory(_0x44757b,_0x29d071,_0x5de979,_0x4b00d7,_0xdd3ba4){_0x44757b[_0xe5aa('0x66')]=_0x5de979;var _0xa09874=new Action(_0x44757b,_0x29d071);var _0x374620=new History(_0xa09874);_0x374620['state']=_0x4b00d7;_0x374620[_0xe5aa('0x6c')]=_0xdd3ba4;_0x374620[_0xe5aa('0x6d')]=_0xa09874[_0xe5aa('0x6e')];return _0x374620;}function unlockQueueStatus(_0x2cc2f0,_0x1b8a65){setTimeout(function(){if(_[_0xe5aa('0x3b')](_0x2cc2f0[_0xe5aa('0x6f')])){loggerBooked[_0xe5aa('0x62')](_0xe5aa('0x70'),_0x1b8a65);}_0x2cc2f0['queueStatusComplete']=!![];loggerBooked[_0xe5aa('0x44')](_0xe5aa('0x71'),_0x1b8a65,JSON[_0xe5aa('0x72')](_[_0xe5aa('0x73')](_0x2cc2f0,['name',_0xe5aa('0x6f')])));},0x1f3);}function checkInterval(_0x47cec2){return function(){if(!isNotNull(_0x47cec2[_0xe5aa('0x74')])){_0x47cec2[_0xe5aa('0x66')]=utils['CAMPAIGN_STATUS'][_0xe5aa('0x75')];throw _0x47cec2['name']+_0xe5aa('0x76');}if(!isNotNull(_0x47cec2[_0xe5aa('0x74')][_0xe5aa('0x77')])){_0x47cec2[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')][_0xe5aa('0x75')];throw _0x47cec2[_0xe5aa('0x41')]+_0xe5aa('0x76');}if(!isNotNull(_[_0xe5aa('0x43')](_0x47cec2[_0xe5aa('0x74')][_0xe5aa('0x77')]))){_0x47cec2['message']=utils[_0xe5aa('0x67')][_0xe5aa('0x75')];throw _0x47cec2['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x9545fb){return function(){if(!utils[_0xe5aa('0x78')](_0x9545fb)){_0x9545fb['message']=utils[_0xe5aa('0x67')]['INACTIVE'];throw _0x9545fb[_0xe5aa('0x41')]+_0xe5aa('0x79');}};}function emitCampaignSummary(_0x21f4f4){if(utils['isIVRCampaign'](_0x21f4f4)){emit(util[_0xe5aa('0x40')](_0xe5aa('0x7a'),_0x21f4f4['name']),_0xe5aa('0x7b'),_0x21f4f4);}}function loggerCatchQueueSummary(_0x158162,_0x245cce){return function(_0xa90624){clearPredictiveAttributes(_0x245cce);emitCampaignSummary(_0x245cce);loggerSyncQueueSummary[_0xe5aa('0x5e')](_0x158162,util[_0xe5aa('0x3f')](_0xa90624,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x808857){if(_0x808857['sendMessageOneNotActive']){if(_0x808857[_0xe5aa('0x7c')]===0x0){_0x808857[_0xe5aa('0x7d')]=![];_0x808857[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')]['INACTIVE'];loggerSyncQueueSummary[_0xe5aa('0x5e')](_0xe5aa('0x7e'),_0x808857[_0xe5aa('0x41')],'is\x20not\x20active');}else{_0x808857['message']=utils[_0xe5aa('0x67')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xe5aa('0x7e'),_0x808857[_0xe5aa('0x41')],_0xe5aa('0x7f'));}emitCampaignSummary(_0x808857);}}function myreject(_0x16ba9d){return function(_0xfe5f0){return _0x16ba9d(msgResponse('[ifTime][Action]',_0xe5aa('0x80'),JSON[_0xe5aa('0x72')](_0xfe5f0)));};}Dialer[_0xe5aa('0x1a')]['isTrunkReachable']=function(_0x2beb00){return!_[_0xe5aa('0x3b')](_0x2beb00)&&_0x2beb00&&!_[_0xe5aa('0x3b')](_0x2beb00['name'])&&!_[_0xe5aa('0x3b')](_0x2beb00[_0xe5aa('0x81')])&&_0x2beb00[_0xe5aa('0x81')]&&(this[_0xe5aa('0x22')][util['format'](_0xe5aa('0x82'),_0x2beb00[_0xe5aa('0x41')])]['status']===_0xe5aa('0x83')||this['trunks'][util[_0xe5aa('0x40')](_0xe5aa('0x82'),_0x2beb00[_0xe5aa('0x41')])][_0xe5aa('0x84')]===_0xe5aa('0x85'));};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x86')]=function(_0x7cd11d){var _0x5ed153=this;return function(){if(!_0x5ed153['isTrunkReachable'](_0x7cd11d[_0xe5aa('0x87')])){if(!_0x5ed153['isTrunkReachable'](_0x7cd11d[_0xe5aa('0x88')])){_0x7cd11d[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')][_0xe5aa('0x89')];throw _0x7cd11d[_0xe5aa('0x41')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer['prototype'][_0xe5aa('0x8a')]=function(_0x3ee783,_0x4cce3b,_0x5d7fc3,_0x2db644){var _0x3c2533=this;return function(){var _0x40aa42=!![];return _0x3c2533[_0xe5aa('0x8b')](_0x3ee783,_0x4cce3b,_0x5d7fc3,_0x2db644,_0x40aa42);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0x241bcb,_0x2a473f,_0x2b34fc,_0x45a1f0){var _0x2e2d38=this;return function(){var _0x4d3669=![];return _0x2e2d38['ifTimeIvr'](_0x241bcb[_0xe5aa('0x77')],_0x2a473f,_0x2b34fc,_0x45a1f0,_0x4d3669);};};Dialer['prototype'][_0xe5aa('0x8b')]=function(_0x4e7b2a,_0x40f225,_0x259105,_0x1be89a,_0x127e87){var _0x5ab856=[];return new Promise(function(_0x3478ae,_0x5616d3){if(!isNotNull(_0x4e7b2a)){_0x1be89a[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')]['NULL_INTERVAL'];return _0x5616d3(msgResponse('ifTime',_0xe5aa('0x8c'),_0x259105+_0xe5aa('0x8d')));}if(_['isEmpty'](_0x4e7b2a)){_0x1be89a[_0xe5aa('0x66')]=utils['CAMPAIGN_STATUS'][_0xe5aa('0x8e')];return _0x5616d3(msgResponse('ifTime',_0xe5aa('0x8c'),_0x259105+_0xe5aa('0x8f')));}if(_0x40f225&&_[_0xe5aa('0x3b')](config[_0xe5aa('0x90')][_0x40f225])){_0x1be89a['message']=utils[_0xe5aa('0x67')][_0xe5aa('0x91')];return _0x5616d3(msgResponse(_0xe5aa('0x92'),_0xe5aa('0x8c'),_0x259105+'\x20Timezone\x20unknow\x20'+_0x40f225));}if(_[_0xe5aa('0x93')](_0x4e7b2a)){for(var _0x491c2a=0x0;_0x491c2a<_0x4e7b2a[_0xe5aa('0x94')];_0x491c2a+=0x1){_0x5ab856[_0xe5aa('0x95')](ami[_0xe5aa('0x96')]({'action':_0xe5aa('0x97'),'command':util[_0xe5aa('0x40')](_0xe5aa('0x98'),_0x4e7b2a[_0x491c2a][_0xe5aa('0x99')],!_['isUndefined'](config[_0xe5aa('0x90')][_0x40f225])?_0x40f225:'')})[_0xe5aa('0x3a')](function(_0x264415){return _0x264415[_0xe5aa('0x9a')][_0xe5aa('0x9b')]('true')>=0x0;})[_0xe5aa('0x9c')](myreject(_0x5616d3)));}}else{_0x5ab856[_0xe5aa('0x95')](ami['Action']({'action':_0xe5aa('0x97'),'command':util[_0xe5aa('0x40')](_0xe5aa('0x98'),_0x4e7b2a,!_[_0xe5aa('0x3b')](config[_0xe5aa('0x90')][_0x40f225])?_0x40f225:'')})[_0xe5aa('0x3a')](function(_0x353386){return _0x353386[_0xe5aa('0x9a')][_0xe5aa('0x9b')](_0xe5aa('0x9d'))>=0x0;})[_0xe5aa('0x9c')](myreject(_0x5616d3)));}Promise['all'](_0x5ab856)[_0xe5aa('0x3a')](function(_0x18cdfe){var _0x7ff88a=_[_0xe5aa('0x9e')](_0x18cdfe);if(_0x7ff88a){return _0x3478ae(_0x7ff88a);}else{_0x1be89a[_0xe5aa('0x66')]=_0x127e87?utils[_0xe5aa('0x67')][_0xe5aa('0x9f')]:utils[_0xe5aa('0x67')][_0xe5aa('0xa0')];return _0x5616d3(msgResponse(_0xe5aa('0xa1'),'Failure',_0xe5aa('0xa2')+_0x127e87+'\x20'+_0x259105+'\x20Interval\x20is\x20overtime:\x20'+util[_0xe5aa('0x3f')](_0x4e7b2a,{'showHidden':![],'depth':null})+_0xe5aa('0xa3')+_0x40f225));}})[_0xe5aa('0x9c')](function(_0x3bb13e){return _0x5616d3(msgResponse('ifTime',_0xe5aa('0x8c'),JSON[_0xe5aa('0x72')](_0x3bb13e)));});});};Dialer[_0xe5aa('0x1a')]['loopCampaigns']=function(){var _0x31294c=this;return cmHopper[_0xe5aa('0xa4')]({'active':![]},{'where':{'active':!![]}})[_0xe5aa('0x3a')](function(){setInterval(function(){_0x31294c['syncCampaigns']();},0x3e8);});};Dialer[_0xe5aa('0x1a')][_0xe5aa('0xa5')]=function(){var _0x1cd5f3=this;var _0x48fc16;for(var _0x2909ca in this['campaigns']){if(typeof this[_0xe5aa('0x20')][_0x2909ca]!==_0xe5aa('0xa6')){_0x48fc16=this[_0xe5aa('0x20')][_0x2909ca];if(utils[_0xe5aa('0xa7')](_0x48fc16)&&utils[_0xe5aa('0x78')](_0x48fc16)){_0x48fc16['sendMessageOneNotActive']=!![];Promise[_0xe5aa('0xa8')]()[_0xe5aa('0x3a')](checkIsIVRCampaignActive(_0x48fc16))[_0xe5aa('0x3a')](checkInterval(_0x48fc16))['then'](_0x1cd5f3['checkIsTrunkReachable'](_0x48fc16))[_0xe5aa('0x3a')](_0x1cd5f3[_0xe5aa('0x8a')](_0x48fc16['dialGlobalInterval'],_0x48fc16[_0xe5aa('0xa9')],_0x48fc16[_0xe5aa('0x41')],_0x48fc16))[_0xe5aa('0x3a')](_0x1cd5f3[_0xe5aa('0xaa')](_0x48fc16[_0xe5aa('0x74')],_0x48fc16[_0xe5aa('0xa9')],_0x48fc16[_0xe5aa('0x41')],_0x48fc16))[_0xe5aa('0x3a')](_0x1cd5f3['launchHandleIvr'](_0x48fc16))[_0xe5aa('0x9c')](loggerCatchQueueSummary(_0xe5aa('0xab'),_0x48fc16));}else{notSendMessagesCampaign(_0x48fc16);}}}};Dialer['prototype'][_0xe5aa('0xac')]=function(_0xaa474){if(_0xaa474['dialMethod']!==_0xe5aa('0xa')){clearPredictiveAttributes(_0xaa474);}switch(_0xaa474[_0xe5aa('0xad')]){case'progressive':this['handlePower'](_0xaa474,0x1);break;case _0xe5aa('0xae'):this[_0xe5aa('0xaf')](_0xaa474,_0xaa474['dialPowerLevel']);break;case _0xe5aa('0xa'):this[_0xe5aa('0xa')](_0xaa474);break;case _0xe5aa('0x9'):this[_0xe5aa('0xaf')](_0xaa474,0x1);break;default:logger['error'](_0xe5aa('0xb0'),_0xaa474[_0xe5aa('0x41')],_0xe5aa('0xb1'));}};Dialer['prototype']['ifTime']=function(_0x16dce1,_0x4b2565){var _0x19f1c8=_0x16dce1['dialTimezone'];var _0x9c59f5=_0x4b2565?_0x16dce1[_0xe5aa('0xb2')]:_0x16dce1[_0xe5aa('0x74')][_0xe5aa('0x77')];logger[_0xe5aa('0xb3')](_0xe5aa('0xb4'),_0x9c59f5,_0x19f1c8,_0x16dce1[_0xe5aa('0x41')],util[_0xe5aa('0x40')]('Voice\x20Queue\x20%s\x20$s',_0x16dce1[_0xe5aa('0x41')],_0x16dce1['id']));var _0x45c1b1=null;return Interval['intervalIftime'](_0x9c59f5,_0x19f1c8)['then'](function(_0x481a94){if(_0x481a94===!![]){return _0x481a94;}else{_0x16dce1['message']=_0x4b2565?utils[_0xe5aa('0x67')][_0xe5aa('0x9f')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x45c1b1=msgResponse(_0xe5aa('0xa1'),_0xe5aa('0x8c'),_0xe5aa('0xa2')+_0x4b2565+'\x20'+_0x16dce1['name']+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x9c59f5,{'showHidden':![],'depth':null})+_0xe5aa('0xa3')+_0x19f1c8);}if(_0x45c1b1!==null){logger[_0xe5aa('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x45c1b1);_0x45c1b1[_0xe5aa('0xb5')]=_0x4b2565;throw _0x45c1b1;}})['catch'](function(_0x309dfb){logger['error']('AMI\x20IfTime',_0x309dfb);throw msgResponse(_0xe5aa('0xb6'),_0xe5aa('0x80'),util[_0xe5aa('0x3f')](_0x309dfb,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0xe5aa('0x26')]=function(_0x58c6bd){if(this[_0xe5aa('0x1f')][_0x58c6bd[_0xe5aa('0xb7')]]){if(this[_0xe5aa('0xb8')][_0x58c6bd[_0xe5aa('0xb9')]]&&this[_0xe5aa('0xb8')][_0x58c6bd['uniqueid']][_0xe5aa('0x3c')]!=='ivr'){this[_0xe5aa('0xba')](this[_0xe5aa('0x1f')][_0x58c6bd[_0xe5aa('0xb7')]]);this[_0xe5aa('0xb8')][_0x58c6bd[_0xe5aa('0xb9')]][_0xe5aa('0xbb')]=moment()[_0xe5aa('0x40')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0xe5aa('0x2c')]=function(_0x5aa1c7){var _0x3de7c2=this[_0xe5aa('0xb8')][_0x5aa1c7[_0xe5aa('0xb9')]];if(this['voiceQueues'][_0x5aa1c7[_0xe5aa('0xb7')]]){if(_0x3de7c2&&_0x3de7c2[_0xe5aa('0x3c')]!==_0xe5aa('0xbc')){delete this[_0xe5aa('0xb8')][_0x5aa1c7[_0xe5aa('0xb9')]];this[_0xe5aa('0x1f')][_0x5aa1c7[_0xe5aa('0xb7')]][_0xe5aa('0xbd')]+=0x1;var _0x5902ba=new AgentComplete(_0x3de7c2,_0x5aa1c7);if(_0x5aa1c7[_0xe5aa('0xbe')]===_0xe5aa('0xbf')){_0x5902ba['agiafterat']=this['voiceQueues'][_0x5aa1c7[_0xe5aa('0xb7')]][_0xe5aa('0xc0')]&&this[_0xe5aa('0x1f')][_0x5aa1c7['queue']]['dialAgiAfterHangupAgent']?moment()[_0xe5aa('0x40')](_0xe5aa('0xc1')):undefined;}hopperUtils[_0xe5aa('0xc2')](_0x5902ba)['catch'](loggerCatch(_0xe5aa('0xc3')));hopperUtils['moveContactManagedDialer'](_0x5902ba)[_0xe5aa('0x9c')](loggerCatch('[syncAgentComplete]'));}}};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x29')]=function(_0x1432ac){var _0x48c783=this['uniqueId'][_0x1432ac['uniqueid']];var _0x5c8ffe=this;var _0x546669=![];var _0x135a77;var _0xf79418;if(this[_0xe5aa('0x1f')][_0x1432ac['queue']]){if(_0x48c783&&_0x48c783['type']!==_0xe5aa('0xbc')){delete this[_0xe5aa('0xb8')][_0x1432ac[_0xe5aa('0xb9')]];this['updateOriginated'](this[_0xe5aa('0x1f')][_0x1432ac['queue']]);_0x48c783['droptime']=moment()[_0xe5aa('0x40')]('YYYY-MM-DD\x20HH:mm:ss');var _0x10753b=new QueueCallerAbandon(_0x48c783,_0x1432ac);if(utils[_0xe5aa('0x5b')](_0x48c783['droptime'],_0x48c783['responsetime'])>=_0x48c783[_0xe5aa('0xc4')]){this['voiceQueues'][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0x4a')]+=0x1;this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xc5')]+=0x1;this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xc6')]+=0x1;_0x10753b[_0xe5aa('0xc7')]=0xa;_0x10753b[_0xe5aa('0x6c')]=_0xe5aa('0xc8');_0x10753b[_0xe5aa('0xc9')]=_0xe5aa('0xca');_0x10753b[_0xe5aa('0xcb')]=this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xc0')]?moment()['format'](_0xe5aa('0xc1')):undefined;_0x10753b[_0xe5aa('0xcc')]+=0x1;_0x10753b['countglobal']+=0x1;_0x135a77=this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]]['dialDropRetryFrequency'];_0xf79418=this[_0xe5aa('0x1f')][_0x1432ac['queue']][_0xe5aa('0xcd')];hopperUtils['verifyAdditionalPhones'](_0x10753b,_0x10753b[_0xe5aa('0xc7')],_0x48c783[_0xe5aa('0xce')])[_0xe5aa('0x3a')](function(_0x59f030){_0x546669=_0x59f030[_0xe5aa('0xcf')]==0x1;if(_0x10753b[_0xe5aa('0xcc')]>=_0x5c8ffe[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]]['dialDropMaxRetry']){_0x5c8ffe[_0xe5aa('0xd0')](_0x10753b,_0x59f030[_0xe5aa('0xcf')]);}else{hopperUtils[_0xe5aa('0xd1')]({'active':![],'countdropretry':_0x10753b[_0xe5aa('0xcc')],'scheduledat':moment()[_0xe5aa('0xd2')](_0x5c8ffe[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xd3')],'minutes')[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x48c783['ContactId'],'ListId':_0x48c783[_0xe5aa('0xd4')],'VoiceQueueId':_0x48c783[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x48c783[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xd7')));var _0x2ec8f1=new History(_0x10753b);_0x2ec8f1['state']=0xa;_0x2ec8f1[_0xe5aa('0x6c')]='Drop';_0x2ec8f1[_0xe5aa('0x6e')]=moment()['format'](_0xe5aa('0xc1'));_0x2ec8f1[_0xe5aa('0x6d')]=_0x2ec8f1[_0xe5aa('0x6e')];_0x2ec8f1[_0xe5aa('0xd8')]=_0x10753b[_0xe5aa('0xd8')];_0x2ec8f1['calleridnum']=_0x10753b[_0xe5aa('0xd9')];hopperUtils[_0xe5aa('0xc2')](_0x2ec8f1)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xda')));}})[_0xe5aa('0x3a')](function(){if(_0x546669)hopperUtils[_0xe5aa('0xdb')](_0x10753b,_0x135a77,_0xf79418)[_0xe5aa('0x3a')](function(){return 0x1;});});}else{this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0x4c')]+=0x1;this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xdc')]+=0x1;_0x10753b[_0xe5aa('0xc7')]=0xb;_0x10753b[_0xe5aa('0x6c')]=_0xe5aa('0xdd');_0x10753b[_0xe5aa('0xc9')]=_0xe5aa('0xde');_0x10753b[_0xe5aa('0xdf')]+=0x1;_0x10753b[_0xe5aa('0xe0')]+=0x1;_0x135a77=this[_0xe5aa('0x1f')][_0x1432ac['queue']]['dialAbandonedRetryFrequency'];_0xf79418=this[_0xe5aa('0x1f')][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xcd')];hopperUtils[_0xe5aa('0xe1')](_0x10753b,_0x10753b[_0xe5aa('0xc7')],_0x48c783['voiceQueue'])[_0xe5aa('0x3a')](function(_0x303198){if(_0x10753b[_0xe5aa('0xdf')]>=_0x5c8ffe['voiceQueues'][_0x1432ac[_0xe5aa('0xb7')]]['dialAbandonedMaxRetry']){_0x5c8ffe[_0xe5aa('0xd0')](_0x10753b,_0x303198[_0xe5aa('0xcf')]);}else{hopperUtils[_0xe5aa('0xd1')]({'active':![],'countabandonedretry':_0x10753b[_0xe5aa('0xdf')],'scheduledat':moment()[_0xe5aa('0xd2')](_0x5c8ffe['voiceQueues'][_0x1432ac[_0xe5aa('0xb7')]][_0xe5aa('0xe2')],_0xe5aa('0xe3'))[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x48c783[_0xe5aa('0xe4')],'ListId':_0x48c783[_0xe5aa('0xd4')],'VoiceQueueId':_0x48c783[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x48c783[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xe5')));var _0x370867=new History(_0x10753b);_0x370867['state']=0xb;_0x370867[_0xe5aa('0x6c')]=_0xe5aa('0xdd');_0x370867['starttime']=moment()[_0xe5aa('0x40')](_0xe5aa('0xc1'));_0x370867['endtime']=_0x370867['starttime'];_0x370867[_0xe5aa('0xd8')]=_0x10753b[_0xe5aa('0xd8')];_0x370867[_0xe5aa('0xd9')]=_0x10753b[_0xe5aa('0xd9')];hopperUtils[_0xe5aa('0xc2')](_0x370867)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xe6')));}})[_0xe5aa('0x3a')](function(){if(_0x546669)hopperUtils[_0xe5aa('0xdb')](_0x10753b,_0x135a77,_0xf79418)[_0xe5aa('0x3a')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xe5aa('0x33')]=function(_0xfc4c7c){if(this['actions'][_0xfc4c7c['uniqueid']]){this[_0xe5aa('0xe7')][_0xfc4c7c[_0xe5aa('0xb9')]]['channel']=_0xfc4c7c[_0xe5aa('0xe8')];}if(this[_0xe5aa('0xb8')][_0xfc4c7c[_0xe5aa('0xb9')]]){this[_0xe5aa('0xb8')][_0xfc4c7c[_0xe5aa('0xb9')]]['channel']=_0xfc4c7c[_0xe5aa('0xe8')];}};Dialer[_0xe5aa('0x1a')]['syncQueueMember']=function(_0x7b30ba){if(!this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]]){return;}var _0x2692bb=this[_0xe5aa('0x1f')][this[_0xe5aa('0xe7')][_0x7b30ba['actionid']]['queue']]['strategy']||_0xe5aa('0xea');if(_0x2692bb===_0xe5aa('0xeb')){if(this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]]&&_['isNil'](this['actions'][_0x7b30ba[_0xe5aa('0xe9')]][_0xe5aa('0xec')])&&_0x7b30ba['status']==='1'&&_0x7b30ba[_0xe5aa('0xed')]==='0'){if(this[_0xe5aa('0x21')][_0x7b30ba[_0xe5aa('0xee')]]){if(!this[_0xe5aa('0x21')][_0x7b30ba[_0xe5aa('0xee')]]['locked']){this[_0xe5aa('0x21')][_0x7b30ba[_0xe5aa('0xee')]]['locked']=!![];this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]]['locked']=!![];this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]]['stateinterface']=_0x7b30ba[_0xe5aa('0xee')];}}}}else if(_0x2692bb==='rrmemory'){if(this[_0xe5aa('0xe7')][_0x7b30ba['actionid']]){if(this[_0xe5aa('0x21')][_0x7b30ba['stateinterface']]){this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]][_0xe5aa('0xee')]=_0x7b30ba[_0xe5aa('0xee')];if(_[_0xe5aa('0xef')](this[_0xe5aa('0x25')][this[_0xe5aa('0xe7')][_0x7b30ba['actionid']]['queue']])){this['queueBooked'][this['actions'][_0x7b30ba[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]=[];}this[_0xe5aa('0x25')][this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]][_0xe5aa('0x95')](_[_0xe5aa('0x5a')](_[_0xe5aa('0x73')](this[_0xe5aa('0xe7')][_0x7b30ba[_0xe5aa('0xe9')]],['idHopper',_0xe5aa('0xee')]),{'status':_0x7b30ba[_0xe5aa('0x84')],'paused':_0x7b30ba[_0xe5aa('0xed')]}));}}}};Dialer['prototype'][_0xe5aa('0xf0')]=function(_0x530078){if(!this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]]){return;}var _0x247498=this;var _0x514d79=this[_0xe5aa('0x1f')][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]];var _0x129baa=_0x514d79[_0xe5aa('0xf1')]||'rrmemory';if(_0x129baa===_0xe5aa('0xeb')){if(this['actions'][_0x530078[_0xe5aa('0xe9')]]&&this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xee')]){this[_0xe5aa('0xf2')][_0xe5aa('0xf3')](this[_0xe5aa('0xe7')][_0x530078['actionid']]['idHopper'],this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xee')])[_0xe5aa('0x9c')](function(_0x35bc9f){logger[_0xe5aa('0x62')](_0xe5aa('0xf4'),util[_0xe5aa('0x3f')](_0x35bc9f,{'showHidden':![],'depth':null}));})[_0xe5aa('0x1d')](function(){_0x247498['updateOriginated'](_0x247498[_0xe5aa('0x1f')][_0x247498[_0xe5aa('0xe7')][_0x530078['actionid']][_0xe5aa('0xb7')]]);_0x247498[_0xe5aa('0x21')][_0x247498[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xee')]][_0xe5aa('0xec')]=![];delete _0x247498[_0xe5aa('0xe7')][_0x530078['actionid']];unlockQueueStatus(_0x514d79);});}else{this[_0xe5aa('0xba')](this[_0xe5aa('0x1f')][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]);hopperUtils[_0xe5aa('0xd1')]({'active':![],'ContactId':this[_0xe5aa('0xe7')][_0x530078['actionid']]['ContactId'],'ListId':this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]]['ListId'],'VoiceQueueId':this[_0xe5aa('0xe7')][_0x530078['actionid']][_0xe5aa('0xd5')]||undefined,'CampaignId':this['actions'][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xd6')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x530078[_0xe5aa('0xe9')]];unlockQueueStatus(_0x514d79);}}else if(_0x129baa===_0xe5aa('0xea')){var _0x33a47f;if(this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]]&&!_[_0xe5aa('0x43')](this[_0xe5aa('0x25')][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]]['queue']])){if(this['queueBookedRR'][_0x247498['actions'][_0x530078['actionid']][_0xe5aa('0xb7')]]){this[_0xe5aa('0xf5')][_0x247498['actions'][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]=this['queueBookedRR'][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]?this['queueBookedRR'][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]:this[_0xe5aa('0x25')][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]]?this[_0xe5aa('0x25')][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]][_0xe5aa('0xf6')]||0x0:0x0;}this[_0xe5aa('0x25')][this['actions'][_0x530078[_0xe5aa('0xe9')]]['queue']]['_rr']=this['queueBookedRR'][this[_0xe5aa('0xe7')][_0x530078[_0xe5aa('0xe9')]][_0xe5aa('0xb7')]];for(var _0x3715ea=0x0;_0x3715ea=_0x4553b0[_0xe5aa('0x11d')]){_0x5b0237[_0xe5aa('0x11e')](_0x5d109e,_0x85db07,_0x27431d,_0xe5aa('0x11f'));}else{if(_0x5d109e['countmachineretry']>=_0x4553b0[_0xe5aa('0x120')]){_0x5b0237['createStateFinal'](_0x5d109e,_0x85db07,_0x27431d,_0xe5aa('0x121'));}else{hopperUtils[_0xe5aa('0xd1')]({'active':![],'countmachineretry':_0x5d109e[_0xe5aa('0x116')],'scheduledat':moment()[_0xe5aa('0xd2')](_0x4553b0['dialMachineRetryFrequency'],_0xe5aa('0xe3'))[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x5d109e['ContactId'],'ListId':_0x5d109e['ListId'],'VoiceQueueId':_0x5d109e[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x5d109e['CampaignId']||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x122')));_0x85db07({'reschedule':0x1});}}});}if(_0x340346[_0xe5aa('0x3c')]===_0xe5aa('0xbc')&&this[_0xe5aa('0x20')][_0x340346[_0xe5aa('0xb7')]][_0xe5aa('0x10b')]&&_0x534023['value']===_0xe5aa('0x123')){delete this[_0xe5aa('0xb8')][_0x534023[_0xe5aa('0xb9')]];this[_0xe5aa('0xba')](this[_0xe5aa('0x20')][_0x340346['queue']]);_0x22f7ba=new Hangup(_0x340346,_0x534023);_0x22f7ba['state']=0x12;_0x22f7ba[_0xe5aa('0x6c')]='HangupInAMD';_0x22f7ba[_0xe5aa('0x124')]=_0xe5aa('0x115');ami[_0xe5aa('0x10e')]('custom:amd',ut[_0xe5aa('0x10f')](_0x22f7ba,_0xe5aa('0x110')));this['saveInDb'](_0x22f7ba,_0xe5aa('0x125'),_0xe5aa('0x126'));}if(_0x340346[_0xe5aa('0x3c')]===_0xe5aa('0xbc')&&this['campaigns'][_0x340346[_0xe5aa('0xb7')]][_0xe5aa('0x10b')]&&_0x534023[_0xe5aa('0x127')]==='MACHINE'){return new Promise(function(_0x16d8ca,_0xa4b59d){delete _0x5b0237[_0xe5aa('0xb8')][_0x534023[_0xe5aa('0xb9')]];_0x5b0237[_0xe5aa('0xba')](_0x5b0237[_0xe5aa('0x20')][_0x340346[_0xe5aa('0xb7')]]);_0x5b0237[_0xe5aa('0x20')][_0x340346[_0xe5aa('0xb7')]][_0xe5aa('0xbd')]+=0x1;_0x5b0237[_0xe5aa('0x20')][_0x340346[_0xe5aa('0xb7')]][_0xe5aa('0x10c')]+=0x1;var _0x417003=_0x5b0237[_0xe5aa('0x20')][_0x340346[_0xe5aa('0xb7')]];var _0x469797=new Hangup(_0x340346,_0x534023);_0x469797['state']=0x13;_0x469797[_0xe5aa('0x6c')]=_0xe5aa('0x114');_0x469797[_0xe5aa('0x124')]=_0xe5aa('0x115');_0x469797['countmachineretry']+=0x1;_0x469797[_0xe5aa('0xe0')]+=0x1;_0x469797[_0xe5aa('0x110')]=!![];ami[_0xe5aa('0x10e')]('custom:amd',ut[_0xe5aa('0x10f')](_0x469797,_0xe5aa('0x110')));hopperUtils['createHistory'](_0x469797)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x118')));if(_0x469797['countbusyretry']+_0x469797[_0xe5aa('0x11a')]+_0x469797['countnoanswerretry']+_0x469797[_0xe5aa('0x11c')]+_0x469797['countdropretry']+_0x469797[_0xe5aa('0xdf')]+_0x469797[_0xe5aa('0x116')]+_0x469797['countagentrejectretry']>=_0x417003['dialGlobalMaxRetry']){_0x5b0237[_0xe5aa('0x11e')](_0x469797,_0x16d8ca,_0xa4b59d,_0xe5aa('0x11f'));}else{if(_0x469797[_0xe5aa('0x116')]>=_0x417003['dialMachineMaxRetry']){_0x5b0237[_0xe5aa('0x128')](_0x469797,_0x16d8ca,_0xa4b59d,'reason\x2019\x20machine....');}else{hopperUtils[_0xe5aa('0xd1')]({'active':![],'countmachineretry':_0x469797[_0xe5aa('0x116')],'scheduledat':moment()[_0xe5aa('0xd2')](_0x417003[_0xe5aa('0x129')],_0xe5aa('0xe3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x469797[_0xe5aa('0xe4')],'ListId':_0x469797[_0xe5aa('0xd4')],'VoiceQueueId':_0x469797[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x469797[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x122')));_0x16d8ca({'reschedule':0x1});}}});}}};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x31')]=function(_0x5c06aa){var _0x30eb80=this[_0xe5aa('0xb8')][_0x5c06aa[_0xe5aa('0xb9')]];var _0x4faa78;if(_0x30eb80&&_0x30eb80[_0xe5aa('0x3c')]===_0xe5aa('0xbc')){delete this[_0xe5aa('0xb8')][_0x5c06aa[_0xe5aa('0xb9')]];this['updateOriginated'](this[_0xe5aa('0x20')][_0x30eb80['queue']]);this[_0xe5aa('0x20')][_0x30eb80[_0xe5aa('0xb7')]][_0xe5aa('0x12a')]+=0x1;_0x4faa78=new Hangup(_0x30eb80,_0x5c06aa);hopperUtils[_0xe5aa('0xc2')](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xe5aa('0x12b')](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x12c')));}if(_0x30eb80&&_0x30eb80[_0xe5aa('0x3c')]!==_0xe5aa('0xbc')&&isNotNull(this[_0xe5aa('0x1f')][_0x30eb80[_0xe5aa('0xb7')]][_0xe5aa('0x12d')])){delete this[_0xe5aa('0xb8')][_0x5c06aa['uniqueid']];this[_0xe5aa('0xba')](this['voiceQueues'][_0x30eb80[_0xe5aa('0xb7')]]);this[_0xe5aa('0x1f')][_0x30eb80[_0xe5aa('0xb7')]][_0xe5aa('0xbd')]+=0x1;this['voiceQueues'][_0x30eb80['queue']][_0xe5aa('0x10c')]+=0x1;_0x4faa78=new Hangup(_0x30eb80,_0x5c06aa);_0x4faa78[_0xe5aa('0xc7')]=0x10;_0x4faa78['statedesc']='AnswerAGI';_0x4faa78['membername']=_0xe5aa('0x12e');hopperUtils[_0xe5aa('0xc2')](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x12f')));hopperUtils[_0xe5aa('0x12b')](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch('[syncHangupIvr]'));}if(_0x30eb80&&_0x30eb80[_0xe5aa('0x3c')]!==_0xe5aa('0xbc')&&!isNotNull(this[_0xe5aa('0x1f')][_0x30eb80['queue']][_0xe5aa('0x12d')])){delete this[_0xe5aa('0xb8')][_0x5c06aa[_0xe5aa('0xb9')]];this['updateOriginated'](this[_0xe5aa('0x1f')][_0x30eb80[_0xe5aa('0xb7')]]);this[_0xe5aa('0x1f')][_0x30eb80[_0xe5aa('0xb7')]][_0xe5aa('0x130')]+=0x1;_0x4faa78=new Hangup(_0x30eb80,_0x5c06aa);_0x4faa78['state']=0xc;_0x4faa78[_0xe5aa('0x6c')]=_0x5c06aa[_0xe5aa('0x131')];_0x4faa78['membername']=_0xe5aa('0x132');hopperUtils['createHistory'](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x12f')));hopperUtils[_0xe5aa('0x12b')](_0x4faa78)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x12c')));}};Dialer['prototype'][_0xe5aa('0xc')]=function(_0x1010b7){var _0x363453=this;if(!_0x363453[_0xe5aa('0x133')][_0x1010b7['name']]){_0x363453[_0xe5aa('0x133')][_0x1010b7['name']]={'running':![]};}else if(_0x363453['queuesSummary'][_0x1010b7[_0xe5aa('0x41')]]['running']===!![]){return;}else if(_0x363453['queuesSummary'][_0x1010b7[_0xe5aa('0x41')]]['running']===![]){_0x363453[_0xe5aa('0x133')][_0x1010b7[_0xe5aa('0x41')]][_0xe5aa('0x134')]=!![];}var _0x53db2a=_0x363453[_0xe5aa('0x1f')][_0x1010b7['name']];var _0x39ec58=_0x53db2a[_0xe5aa('0x66')]!==utils[_0xe5aa('0x67')][_0xe5aa('0x135')];var _0x1ac3f4=utils[_0xe5aa('0x136')](_0x53db2a);_0x53db2a[_0xe5aa('0x137')]=utils[_0xe5aa('0x138')](_0x53db2a,_0x363453[_0xe5aa('0x22')]);Promise[_0xe5aa('0xa8')]()[_0xe5aa('0x3a')](function(){if(_0x53db2a[_0xe5aa('0x137')]===utils['CAMPAIGN_STATUS'][_0xe5aa('0x135')]){if(_0x39ec58){clearPredictiveAttributes(_0x53db2a);_0x1010b7[_0xe5aa('0x5d')]=undefined;_0x1010b7['startProgressive']=undefined;}if(_0x53db2a[_0xe5aa('0x137')]===utils[_0xe5aa('0x67')]['INACTIVE']){_0x1010b7[_0xe5aa('0x139')]=0x0;_0x1010b7[_0xe5aa('0xed')]=0x0;_0x1010b7[_0xe5aa('0x13a')]=0x0;_0x1010b7['talking']=0x0;_0x1010b7[_0xe5aa('0x13b')]=0x0;}}else if(_0x53db2a[_0xe5aa('0x137')]===utils[_0xe5aa('0x67')]['ACTIVE']&&!_0x1ac3f4){return _0x363453[_0xe5aa('0x92')](_0x53db2a,!![])[_0xe5aa('0x3a')](function(){return _0x363453[_0xe5aa('0x92')](_0x53db2a,![]);})[_0xe5aa('0x3a')](function(){return _0x363453['checkDialMethod'](_0x53db2a);})[_0xe5aa('0x9c')](function(_0x5d4ced){loggerSyncQueueSummary['debug'](_0xe5aa('0x13c'),util[_0xe5aa('0x3f')](_0x5d4ced,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x53db2a);});}else{clearPredictiveAttributes(_0x53db2a);}})[_0xe5aa('0x3a')](function(){var _0x5f3b59=_0x1010b7[_0xe5aa('0x13d')](_0x53db2a);if(_0x5f3b59||_0x53db2a[_0xe5aa('0x13e')]){_0x53db2a[_0xe5aa('0x13e')]=![];_0x1010b7[_0xe5aa('0x13f')](_0x53db2a);Object['assign'](_0x53db2a,_0x1010b7);emitOutboundVoiceQueueSummary(_0x1010b7);}_0x363453[_0xe5aa('0x133')][_0x53db2a[_0xe5aa('0x41')]][_0xe5aa('0x134')]=![];})['catch'](function(_0x189351){logger[_0xe5aa('0x62')]('[syncQueueSummary]',util[_0xe5aa('0x3f')](_0x189351,{'showHidden':![],'depth':null}));_0x363453[_0xe5aa('0x133')][_0x53db2a[_0xe5aa('0x41')]][_0xe5aa('0x134')]=![];});};Dialer['prototype'][_0xe5aa('0x2f')]=_[_0xe5aa('0x140')](function(){var _0x5c1920=_[_0xe5aa('0x141')](this[_0xe5aa('0x1f')],function(_0x55527b){return _0x55527b[_0xe5aa('0x142')];});var _0x5a45f4=_['filter'](this[_0xe5aa('0x21')],function(_0x440ac5){return _0x440ac5['online']&&_0x440ac5[_0xe5aa('0x84')]===_0xe5aa('0x83');});if(_0x5c1920['length']>0x0&&_0x5a45f4['length']>0x0){return Promise[_0xe5aa('0xa8')]()[_0xe5aa('0x3a')](cmHopper[_0xe5aa('0x143')](_[_0xe5aa('0x144')](_0x5c1920,'id'),previewRecallmeReminderInterval,_['map'](_0x5a45f4,'id')))[_0xe5aa('0x3a')](function(_0x5f060b){for(var _0x313784=0x0;_0x313784<_0x5f060b[_0xe5aa('0x94')];_0x313784++){var _0x2f83ef=_0x5f060b[_0x313784][_0xe5aa('0x145')]['name'];if(_0x2f83ef)io['to'](util['format'](_0xe5aa('0x146'),_0x2f83ef))['emit'](_0xe5aa('0x147'),{'hopper':_0x5f060b[_0x313784]});}})[_0xe5aa('0x9c')](function(_0xe0544){logger[_0xe5aa('0x62')](_0xe5aa('0x148'),_0xe0544);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xe5aa('0x1a')]['loopClearZombieChannels']=function(){var _0x59b731=this;setInterval(function(){_0x59b731['clearZombieChannels'](_0x59b731[_0xe5aa('0xb8')],_0xe5aa('0x149'));_0x59b731[_0xe5aa('0x14a')](_0x59b731[_0xe5aa('0xe7')],'[actions]');},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x4cece3,_0x25767c){var _0x5c4d49=this;for(var _0x4f39f7 in _0x4cece3){if(typeof _0x4cece3[_0x4f39f7]!==_0xe5aa('0xa6')){this['sequence'][_0xe5aa('0x1b')](function(){if(!_['isNil'](_0x4cece3[_0x4f39f7])){return ami['Action']({'action':_0xe5aa('0x84'),'channel':_0x4cece3[_0x4f39f7][_0xe5aa('0xe8')]})[_0xe5aa('0x9c')](function(_0x367600){if(_0x367600[_0xe5aa('0x66')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x4cece3[_0x4f39f7]&&_0x4cece3[_0x4f39f7][_0xe5aa('0x3c')]!==_0xe5aa('0xbc')){_0x5c4d49[_0xe5aa('0xba')](_0x5c4d49[_0xe5aa('0x1f')][_0x4cece3[_0x4f39f7][_0xe5aa('0xb7')]]);logger[_0xe5aa('0x62')]('[Dialer][checkChannel]',_0x25767c,_0x4f39f7,_0x4cece3[_0x4f39f7][_0xe5aa('0xb7')]);delete _0x4cece3[_0x4f39f7];}if(_0x4cece3[_0x4f39f7]&&_0x4cece3[_0x4f39f7][_0xe5aa('0x3c')]===_0xe5aa('0xbc')){_0x5c4d49['updateOriginated'](_0x5c4d49[_0xe5aa('0x20')][_0x4cece3[_0x4f39f7][_0xe5aa('0xb7')]]);logger[_0xe5aa('0x62')]('[Dialer][checkChannel][ivr]',_0x25767c,_0x4f39f7,_0x4cece3[_0x4f39f7][_0xe5aa('0xb7')]);delete _0x4cece3[_0x4f39f7];}},0x2328);}});}});}}};Dialer['prototype']['getVoiceQueueRtPauses']=function(_0xc2ff82){return Promise[_0xe5aa('0xa8')]()[_0xe5aa('0x3a')](voiceQueueRt[_0xe5aa('0x14b')](_0xc2ff82))['catch'](loggerCatch(_0xe5aa('0x14c')));};Dialer['prototype'][_0xe5aa('0xba')]=function(_0x3888c0){if(!_[_0xe5aa('0x3b')](_0x3888c0)&&_0x3888c0!==null){if(typeof _0x3888c0[_0xe5aa('0x7c')]!==_0xe5aa('0xa6')){if(_0x3888c0[_0xe5aa('0x7c')]>0x0){_0x3888c0[_0xe5aa('0x7c')]-=0x1;}else{logger['error'](_0xe5aa('0x14d'));}}}else{logger[_0xe5aa('0x62')](_0xe5aa('0x14e'));}};Dialer[_0xe5aa('0x1a')]['loggerHandler']=function(_0x2604b7,_0x627160){var _0x27b5da=this;return function(_0x55695b){_0x27b5da[_0xe5aa('0xba')](_0x627160);logger[_0xe5aa('0x62')](_0x2604b7,util[_0xe5aa('0x3f')](_0x55695b,{'showHidden':![],'depth':null}));};};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x14f')]=function(_0x513efa,_0x264197,_0x1655d7){var _0x260f37={'state':0x19,'statedesc':_0xe5aa('0x150')};this[_0xe5aa('0xba')](_0x264197);this['saveInDb'](_[_0xe5aa('0x5a')](_0x260f37,_[_0xe5aa('0x73')](_0x1655d7,[_0xe5aa('0xe4'),_0xe5aa('0xd4'),_0xe5aa('0x151'),_0xe5aa('0xd5'),'CampaignId'])),_0xe5aa('0x152'),'[emptyContact]');logger['error'](_0x513efa);};Dialer[_0xe5aa('0x1a')]['saveInDb']=function(_0x5371cc,_0xab44bd,_0x40303c){hopperUtils[_0xe5aa('0xc2')](_0x5371cc)[_0xe5aa('0x9c')](loggerCatch(_0xab44bd));hopperUtils[_0xe5aa('0x12b')](_0x5371cc)[_0xe5aa('0x9c')](loggerCatch(_0x40303c));};Dialer[_0xe5aa('0x1a')][_0xe5aa('0xd0')]=function(_0x468a65,_0x1df76c){hopperUtils[_0xe5aa('0xc2')](_0x468a65)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xc3')));if(_0x1df76c==0x0){hopperUtils['moveContactManagedDialer'](_0x468a65)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x153')));}};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x148')]=function(_0x5730f8){return Promise['resolve']()[_0xe5aa('0x3a')](cmHopper[_0xe5aa('0x143')](_0x5730f8['id'],previewRecallmeReminderInterval))[_0xe5aa('0x3a')](function(_0x27e93c){for(var _0xc186fd=0x0;_0xc186fd<_0x27e93c[_0xe5aa('0x94')];_0xc186fd++){var _0x4468ac=_0x27e93c[_0xc186fd][_0xe5aa('0x145')]['name'];if(_0x4468ac)io['to'](util[_0xe5aa('0x40')](_0xe5aa('0x146'),_0x4468ac))[_0xe5aa('0x10e')](_0xe5aa('0x147'),{'hopper':_0x27e93c[_0xc186fd]});}})[_0xe5aa('0x9c')](function(){});};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x154')]=function(_0x3c4989){var _0x27b3b1=this;return function(){_0x27b3b1['handleIvr'](_0x3c4989);};};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x155')]=function(_0x4c807f,_0x89d533){var _0x535e90=this;var _0x461cfd=uuid['v4']();this[_0xe5aa('0xe7')][_0x461cfd]=new Action(_0x4c807f,_0x89d533,_0x461cfd);return new Promise(function(_0x33a3ad,_0x268768){if(_[_0xe5aa('0x3b')](_0x4c807f)&&typeof _0x4c807f!==_0xe5aa('0x156')){return _0x268768(msgResponse(_0xe5aa('0x157'),_0xe5aa('0x8c'),'voiceQueue\x20is\x20undefine'));}if(_[_0xe5aa('0x3b')](_0x89d533[_0xe5aa('0x158')])||_0x89d533[_0xe5aa('0x158')]===null){return _0x268768(msgResponse('originate',_0xe5aa('0x8c'),_0xe5aa('0x159')));}var _0xd457c7={'XMD-CALLERID':_0x535e90[_0xe5aa('0xe7')][_0x461cfd][_0xe5aa('0x15a')](),'XMD-AGI':_0x4c807f['dialQueueProject']?util[_0xe5aa('0x40')](_0xe5aa('0x15b'),ipAgi,_0x4c807f['dialQueueProject']):_0xe5aa('0x15c'),'XMD-AGIAFTER':_0x4c807f[_0xe5aa('0xc0')]?util[_0xe5aa('0x40')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4c807f['dialQueueProject2']):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x4c807f)?util[_0xe5aa('0x40')](_0xe5aa('0x15d'),_0x4c807f[_0xe5aa('0x41')],_0x4c807f[_0xe5aa('0x15e')]||'',_0x4c807f['dialAgiAfterHangupAgent']?'c':'',_0x4c807f[_0xe5aa('0xc4')]||0x3):_0xe5aa('0x15c'),'XMD-CONTACTID':_0x89d533['ContactId'],'XMD-CDRTYPE':_0xe5aa('0x15f'),'CALLERID(all)':_0x535e90['actions'][_0x461cfd]['getCaller'](),'XMD-AMD':_0x4c807f[_0xe5aa('0x10b')]?_0xe5aa('0x160'):_0xe5aa('0x15c'),'XMD-DESTINATION':_0xe5aa('0x10a')};if(_0x4c807f['dialAMDActive']){_0xd457c7[_0xe5aa('0x161')]=_0x4c807f[_0xe5aa('0x162')]||0x9c4;_0xd457c7[_0xe5aa('0x163')]=_0x4c807f[_0xe5aa('0x164')]||0x5dc;_0xd457c7['XMD-AMDAFTERGREETINGSILENCE']=_0x4c807f[_0xe5aa('0x165')]||0x320;_0xd457c7[_0xe5aa('0x166')]=_0x4c807f[_0xe5aa('0x167')]||0x1388;_0xd457c7['XMD-AMDMINWORDLENGTH']=_0x4c807f[_0xe5aa('0x168')]||0x64;_0xd457c7[_0xe5aa('0x169')]=_0x4c807f[_0xe5aa('0x16a')]||0x32;_0xd457c7['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x4c807f[_0xe5aa('0x16b')]||0x3;_0xd457c7[_0xe5aa('0x16c')]=_0x4c807f[_0xe5aa('0x16d')]||0x100;_0xd457c7[_0xe5aa('0x16e')]=_0x4c807f[_0xe5aa('0x16f')]||0x1388;}if(utils['isOutboundQueue'](_0x4c807f)){_0xd457c7[_0xe5aa('0x170')]=_0x89d533['VoiceQueueId'];}else{_0xd457c7[_0xe5aa('0x171')]=_0x89d533[_0xe5aa('0xd6')];}var _0x3df094=utils[_0xe5aa('0x172')](_0x89d533[_0xe5aa('0x173')]);Object['assign'](_0xd457c7,_0x3df094);var _0x1a9f90=_0x535e90[_0xe5aa('0x174')](_0x4c807f[_0xe5aa('0x87')])?utils['getCallerId'](_0x4c807f['Trunk']['callerid'],_0x4c807f[_0xe5aa('0x175')],_0x4c807f[_0xe5aa('0x176')]>0x0?utils[_0xe5aa('0x177')](_0x4c807f['dialOriginateCallerIdNumber'],_0x4c807f['dialRandomLastDigitCallerIdNumber']):_0x4c807f[_0xe5aa('0x178')]):utils[_0xe5aa('0x179')](_['isNil'](_0x4c807f['TrunkBackup'])?_0x4c807f[_0xe5aa('0x87')]['callerid']:_0x4c807f[_0xe5aa('0x88')][_0xe5aa('0x17a')],_0x4c807f[_0xe5aa('0x175')],_0x4c807f[_0xe5aa('0x176')]>0x0?utils[_0xe5aa('0x177')](_0x4c807f[_0xe5aa('0x178')],_0x4c807f[_0xe5aa('0x176')]):_0x4c807f[_0xe5aa('0x178')]);if(_0x1a9f90){_0xd457c7['XMD-ORIGINATECALLERIDNAME']=_0x535e90['actions'][_0x461cfd][_0xe5aa('0x17b')]=utils['extractCalleridName'](_0x1a9f90);_0xd457c7[_0xe5aa('0x17c')]=_0x89d533['phone'];}_0x4c807f['variables']=_0xd457c7;return ami[_0xe5aa('0x96')]({'actionid':_0x461cfd,'action':_0xe5aa('0x157'),'channel':_0x535e90[_0xe5aa('0x174')](_0x4c807f['Trunk'])?util['format'](_0xe5aa('0x17d'),_0x4c807f[_0xe5aa('0x87')][_0xe5aa('0x41')],isNotNull(_0x4c807f['dialPrefix'])?_0x4c807f[_0xe5aa('0x17e')][_0xe5aa('0x17f')]()||'':'',_0x4c807f['dialCutDigit']>0x0?_0x89d533[_0xe5aa('0x158')][_0xe5aa('0x180')](_0x4c807f['dialCutDigit']):_0x89d533['phone']):util['format'](_0xe5aa('0x17d'),_[_0xe5aa('0xef')](_0x4c807f[_0xe5aa('0x88')])?_0x4c807f['Trunk']['name']:_0x4c807f['TrunkBackup'][_0xe5aa('0x41')],isNotNull(_0x4c807f['dialPrefix'])?_0x4c807f[_0xe5aa('0x17e')][_0xe5aa('0x17f')]()||'':'',_0x4c807f[_0xe5aa('0x181')]>0x0?_0x89d533[_0xe5aa('0x158')][_0xe5aa('0x180')](_0x4c807f[_0xe5aa('0x181')]):_0x89d533['phone']),'callerid':_0x1a9f90,'Exten':'xcally-motion-dialer','Context':_0xe5aa('0x182'),'Priority':'1','variable':_0xd457c7,'timeout':(_0x4c807f['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x461cfd})['then'](function(_0x5f311e){return _0x33a3ad(_0x5f311e);})['catch'](function(_0x32269e){_0x4c807f[_0xe5aa('0x183')]+=0x1;var _0x283e51=new History(_0x535e90[_0xe5aa('0xe7')][_0x461cfd]);logger[_0xe5aa('0x62')](util[_0xe5aa('0x40')]('[originateError]:\x20%s',JSON[_0xe5aa('0x72')](_0x32269e)));_0x283e51['state']=0xe;_0x283e51[_0xe5aa('0x6c')]=_0xe5aa('0x184');_0x283e51[_0xe5aa('0x6e')]=moment()['format'](_0xe5aa('0xc1'));_0x283e51[_0xe5aa('0x6d')]=_0x283e51[_0xe5aa('0x6e')];hopperUtils[_0xe5aa('0xc2')](_0x283e51)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x185')));_0x535e90[_0xe5aa('0x12b')](_0x283e51)[_0xe5aa('0x9c')](loggerCatch('[originate][error]'))['finally'](function(){delete _0x535e90[_0xe5aa('0xe7')][_0x461cfd];return _0x268768(msgResponse(_0xe5aa('0x157'),_0xe5aa('0x80'),'originate\x20action\x20Error'));});});});};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x186')]=function(_0x5c424f,_0x15d282,_0x4a3ff6){var _0x12bae2=new History(_0x15d282);if(_0x12bae2[_0xe5aa('0x119')]+_0x12bae2[_0xe5aa('0x11a')]+_0x12bae2[_0xe5aa('0x11b')]+_0x12bae2[_0xe5aa('0x11c')]+_0x12bae2[_0xe5aa('0xcc')]+_0x12bae2[_0xe5aa('0xdf')]+_0x12bae2[_0xe5aa('0x116')]+_0x12bae2[_0xe5aa('0x187')]>=_0x4a3ff6['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x5c424f){case 0x3:if(_0x12bae2[_0xe5aa('0x11b')]>=_0x4a3ff6[_0xe5aa('0x188')]-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countnoanswerretry':_0x12bae2['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6['dialNoAnswerRetryFrequency'],_0xe5aa('0xe3'))[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x12bae2[_0xe5aa('0x119')]>=_0x4a3ff6['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countbusyretry':_0x12bae2['countbusyretry']+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0x189')],_0xe5aa('0xe3'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x18a')));break;case 0x8:if(_0x12bae2[_0xe5aa('0x11a')]>=_0x4a3ff6[_0xe5aa('0x18b')]-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countcongestionretry':_0x12bae2[_0xe5aa('0x11a')]+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0x18c')],'minutes')[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2['ListId'],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x18d')));break;case 0x0:if(_0x12bae2['countnosuchnumberretry']>=_0x4a3ff6[_0xe5aa('0x18e')]-0x1){return!![];}else{hopperUtils[_0xe5aa('0xd1')]({'active':![],'countnosuchnumberretry':_0x12bae2[_0xe5aa('0x11c')]+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0x18f')],_0xe5aa('0xe3'))[_0xe5aa('0x40')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x190')));}break;case 0xa:if(_0x12bae2[_0xe5aa('0xcc')]>=_0x4a3ff6['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countdropretry':_0x12bae2['countdropretry']+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0xd3')],'minutes')[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2['VoiceQueueId']||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xd7')));break;case 0xb:if(_0x12bae2[_0xe5aa('0xdf')]>=_0x4a3ff6[_0xe5aa('0x191')]-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countabandonedretry':_0x12bae2[_0xe5aa('0xdf')]+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0xe2')],_0xe5aa('0xe3'))['format'](_0xe5aa('0xc1')),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2['ListId'],'VoiceQueueId':_0x12bae2['VoiceQueueId']||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x12bae2[_0xe5aa('0x116')]>=_0x4a3ff6[_0xe5aa('0x120')]-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countmachineretry':_0x12bae2[_0xe5aa('0x116')]+=0x1,'scheduledat':moment()['add'](_0x4a3ff6[_0xe5aa('0x129')],'minutes')[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x12bae2['ContactId'],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x122')));break;case 0x14:if(_0x12bae2[_0xe5aa('0x187')]>=_0x4a3ff6['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0xe5aa('0xd1')]({'active':![],'countagentrejectretry':_0x12bae2['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xe5aa('0xd2')](_0x4a3ff6[_0xe5aa('0x192')],_0xe5aa('0xe3'))[_0xe5aa('0x40')](_0xe5aa('0xc1')),'ContactId':_0x12bae2[_0xe5aa('0xe4')],'ListId':_0x12bae2[_0xe5aa('0xd4')],'VoiceQueueId':_0x12bae2[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x12bae2['CampaignId']||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x193')));break;default:return!![];}};Dialer['prototype'][_0xe5aa('0x105')]=function(_0x4711fa,_0x1e2230,_0x32b9f9){var _0x182ee0=this;var _0x5bf5b5=new History(_0x4711fa);var _0x444bca=![];var _0x2607e6;var _0x55926e;return new Promise(function(_0x204923,_0x696b4b){if(_[_0xe5aa('0x3b')](_0x1e2230)&&typeof _0x1e2230!==_0xe5aa('0x156')){return _0x696b4b(msgResponse('[callProgressDetecting]','Failure',_0xe5aa('0x194')));}if(_[_0xe5aa('0x3b')](_0x32b9f9)&&typeof _0x32b9f9!==_0xe5aa('0x156')){return _0x696b4b(msgResponse(_0xe5aa('0x195'),_0xe5aa('0x8c'),'evt\x20is\x20undefine'));}hopperUtils[_0xe5aa('0xe1')](_0x5bf5b5,_0x32b9f9[_0xe5aa('0xbe')],_0x1e2230)['then'](function(_0x3a83a4){if(_0x3a83a4['additional']==0x1)_0x444bca=!![];switch(_0x32b9f9[_0xe5aa('0xbe')]){case'0':_0x1e2230['outboundNoSuchCallsDay']+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0x0;_0x5bf5b5[_0xe5aa('0x6c')]=_0xe5aa('0x196');_0x5bf5b5['countnosuchnumberretry']+=0x1;_0x5bf5b5['countglobal']+=0x1;ami['emit'](_0xe5aa('0x197'),ut['buildObj'](_0x4711fa,'nosuchnumber'));_0x2607e6=_0x1e2230[_0xe5aa('0x18f')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];hopperUtils[_0xe5aa('0xc2')](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x118')));if(_0x182ee0[_0xe5aa('0x186')](0x0,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0x11c')]>=_0x1e2230[_0xe5aa('0x18e')]){_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x198'));}else{_0x182ee0[_0xe5aa('0x11e')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x198'));}}break;case'3':_0x1e2230[_0xe5aa('0x199')]+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0x3;_0x5bf5b5[_0xe5aa('0x6c')]=_0xe5aa('0x19a');_0x5bf5b5[_0xe5aa('0x11b')]+=0x1;_0x5bf5b5['countglobal']+=0x1;var _0x1c7784=ut[_0xe5aa('0x19b')](_0x4711fa,_0x1e2230);ami[_0xe5aa('0x10e')]('custom:agentnoanswer',_0x1c7784);_0x2607e6=_0x1e2230[_0xe5aa('0x19c')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];hopperUtils[_0xe5aa('0xc2')](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x19d')));if(_0x182ee0[_0xe5aa('0x186')](0x3,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0x11b')]>=_0x1e2230[_0xe5aa('0x188')]){_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x19e'));}else{_0x182ee0['stateGlobal'](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x19e'));}}break;case'5':_0x1e2230[_0xe5aa('0x19f')]+=0x1;_0x5bf5b5['state']=0x5;_0x5bf5b5[_0xe5aa('0x6c')]=_0xe5aa('0x1a0');_0x5bf5b5[_0xe5aa('0x119')]+=0x1;_0x5bf5b5[_0xe5aa('0xe0')]+=0x1;ami[_0xe5aa('0x10e')](_0xe5aa('0x1a1'),ut['buildObj'](_0x4711fa,_0xe5aa('0x1a2')));_0x2607e6=_0x1e2230[_0xe5aa('0x189')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];hopperUtils['createHistory'](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x1a3')));if(_0x182ee0[_0xe5aa('0x186')](0x5,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0x119')]>=_0x1e2230[_0xe5aa('0x1a4')]){_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1a5'));}else{_0x182ee0[_0xe5aa('0x11e')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1a5'));}}break;case'8':_0x1e2230[_0xe5aa('0x1a6')]+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0x8;_0x5bf5b5[_0xe5aa('0x6c')]='Congestion';_0x5bf5b5[_0xe5aa('0x11a')]+=0x1;_0x5bf5b5[_0xe5aa('0xe0')]+=0x1;_0x2607e6=_0x1e2230[_0xe5aa('0x18c')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];ami[_0xe5aa('0x10e')]('custom:agentcongestion',ut[_0xe5aa('0x10f')](_0x4711fa,'congestion'));hopperUtils[_0xe5aa('0xc2')](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x1a7')));if(_0x182ee0[_0xe5aa('0x186')](0x8,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5['countcongestionretry']>=_0x1e2230['dialCongestionMaxRetry']){_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1a8'));}else{_0x182ee0[_0xe5aa('0x11e')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1a8'));}}break;case'11':_0x1e2230[_0xe5aa('0x1a9')]+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0xb;_0x5bf5b5[_0xe5aa('0x6c')]=_0xe5aa('0xdd');_0x5bf5b5[_0xe5aa('0xdf')]+=0x1;_0x5bf5b5[_0xe5aa('0xe0')]+=0x1;_0x2607e6=_0x1e2230[_0xe5aa('0xe2')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];hopperUtils[_0xe5aa('0xc2')](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0xe6')));if(_0x182ee0[_0xe5aa('0x186')](0xb,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0xdf')]>=_0x1e2230[_0xe5aa('0x191')]){_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1aa'));}else{_0x182ee0['stateGlobal'](_0x5bf5b5,_0x204923,_0x696b4b,'reason\x2011\x20abandoned');}}break;case'20':_0x1e2230['outboundRejectCallsDay']+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0x14;_0x5bf5b5[_0xe5aa('0x6c')]='AgentReject';_0x5bf5b5[_0xe5aa('0x187')]+=0x1;_0x5bf5b5['countglobal']+=0x1;_0x2607e6=_0x1e2230[_0xe5aa('0x192')];_0x55926e=_0x1e2230['callAdditionalPhoneAfterMin'];ami[_0xe5aa('0x10e')](_0xe5aa('0x1ab'),ut[_0xe5aa('0x10f')](_0x4711fa,'agentreject'));hopperUtils['createHistory'](_0x5bf5b5)['catch'](loggerCatch(_0xe5aa('0x1ac')));if(_0x182ee0[_0xe5aa('0x186')](0x14,_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0x187')]>=_0x1e2230[_0xe5aa('0x1ad')]){_0x182ee0['createStateFinal'](_0x5bf5b5,_0x204923,_0x696b4b,'reason\x2020\x20agentreject');}else{_0x182ee0[_0xe5aa('0x11e')](_0x5bf5b5,_0x204923,_0x696b4b,_0xe5aa('0x1ae'));}}break;default:_0x1e2230['outboundUnknownCallsDay']+=0x1;_0x5bf5b5[_0xe5aa('0xc7')]=0xc;_0x5bf5b5[_0xe5aa('0x6c')]=_0x32b9f9['reason'];_0x2607e6=_0x1e2230[_0xe5aa('0x192')];_0x55926e=_0x1e2230[_0xe5aa('0xcd')];hopperUtils[_0xe5aa('0xc2')](_0x5bf5b5)[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x1af')));if(_0x182ee0[_0xe5aa('0x186')](_0x32b9f9['reason'],_0x4711fa,_0x1e2230)&&!_0x444bca){if(_0x5bf5b5[_0xe5aa('0x119')]+_0x5bf5b5[_0xe5aa('0x11a')]+_0x5bf5b5[_0xe5aa('0x11b')]+_0x5bf5b5['countnosuchnumberretry']+_0x5bf5b5[_0xe5aa('0xcc')]+_0x5bf5b5[_0xe5aa('0xdf')]+_0x5bf5b5[_0xe5aa('0x116')]+_0x5bf5b5[_0xe5aa('0x187')]>=_0x1e2230[_0xe5aa('0x11d')]){_0x182ee0['stateGlobal'](_0x5bf5b5,_0x204923,_0x696b4b,_0x32b9f9[_0xe5aa('0xbe')]);}else{_0x182ee0[_0xe5aa('0x128')](_0x5bf5b5,_0x204923,_0x696b4b,_0x32b9f9[_0xe5aa('0xbe')]);}}}})[_0xe5aa('0x3a')](function(){if(_0x444bca){hopperUtils[_0xe5aa('0xdb')](_0x5bf5b5,_0x2607e6,_0x55926e)[_0xe5aa('0x3a')](function(){return _0x204923(0x1);});}});});};Dialer['prototype'][_0xe5aa('0x11e')]=function(_0x4058bf,_0x104a51,_0x4d5f73,_0x1a0922){var _0x1597c8=new Final(_0x4058bf);_0x1597c8[_0xe5aa('0xc7')]=0xf;_0x1597c8[_0xe5aa('0x6c')]='Global';this[_0xe5aa('0x128')](_0x1597c8,_0x104a51,_0x4d5f73,_0x1a0922);};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x128')]=function(_0x4ce8b0,_0x2ec1f4,_0x19006d,_0x5a6900){hopperUtils['moveContactManagedDialer'](_0x4ce8b0)[_0xe5aa('0x3a')](function(){return _0x2ec1f4(msgResponse(_0xe5aa('0x195'),_0xe5aa('0x104'),_0x5a6900));})['catch'](function(){return _0x19006d(msgResponse(_0xe5aa('0x1b0'),_0xe5aa('0x8c'),_0xe5aa('0x1b1')));});};Dialer[_0xe5aa('0x1a')]['predictive']=function(_0x4fb1cf){var _0x3ae8e9=_0x4fb1cf[_0xe5aa('0x1b2')]/0x64;var _0x579bd9=_0x4fb1cf[_0xe5aa('0xc5')]/(_0x4fb1cf[_0xe5aa('0xc5')]+_0x4fb1cf[_0xe5aa('0xbd')]);var _0x2177ad=Math[_0xe5aa('0x1b3')](_0x4fb1cf[_0xe5aa('0x1b4')]*(_0x4fb1cf[_0xe5aa('0x1b5')]/0x64));var _0x67e865=Math['round'](_0x4fb1cf[_0xe5aa('0x1b4')]*(_0x4fb1cf[_0xe5aa('0x1b6')]/0x64));var _0x2458a8=_0x4fb1cf['available']+_0x4fb1cf[_0xe5aa('0x1b7')];var _0x20783f=Math[_0xe5aa('0x1b8')](_0x4fb1cf[_0xe5aa('0x55')]*_0x4fb1cf[_0xe5aa('0x57')]*_0x4fb1cf[_0xe5aa('0x1b9')]*_0x4fb1cf[_0xe5aa('0x1ba')]);if(_['isUndefined'](_0x4fb1cf[_0xe5aa('0x1bb')])){if(!_[_0xe5aa('0x3b')](_0x4fb1cf[_0xe5aa('0x5d')])){_0x4fb1cf[_0xe5aa('0x5d')]=undefined;loggerPredictive[_0xe5aa('0x62')](_0xe5aa('0x1bc'),_0xe5aa('0x1bd'));}if(!_['isUndefined'](_0x4fb1cf[_0xe5aa('0x60')])){loggerPredictive['error'](_0xe5aa('0x1bc'),_0xe5aa('0x1be'));clearInterval(_0x4fb1cf[_0xe5aa('0x60')]);_0x4fb1cf['handlePredictive']=undefined;}_0x4fb1cf[_0xe5aa('0x1bb')]=moment()[_0xe5aa('0x40')](_0xe5aa('0xc1'));loggerPredictive['info'](_0x4fb1cf[_0xe5aa('0x41')],'collection\x20data\x20in\x20progressive\x20at',_0x4fb1cf[_0xe5aa('0x1bb')]);this[_0xe5aa('0xaf')](_0x4fb1cf,0x1);}else if(ifInterval(_0x4fb1cf[_0xe5aa('0x1bf')],_0x4fb1cf[_0xe5aa('0x1bb')])){this['handlePower'](_0x4fb1cf,0x1);loggerPredictiveCalls[_0xe5aa('0x44')](_0xe5aa('0x1c0'),_0x4fb1cf[_0xe5aa('0x1bb')],_0x4fb1cf[_0xe5aa('0x41')]);_0x4fb1cf[_0xe5aa('0x55')]=0x0;_0x4fb1cf[_0xe5aa('0xc6')]=0x0;}else if(_0x3ae8e9<_0x579bd9&&_0x4fb1cf[_0xe5aa('0x1c1')]===_0xe5aa('0x1c2')){clearPredictiveAttributes(_0x4fb1cf);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x1c3'),_0xe5aa('0x1c4'),_0x579bd9,_0xe5aa('0x1bb'),_0x4fb1cf[_0xe5aa('0x41')]);}else if(_0x20783f<_0x4fb1cf[_0xe5aa('0xc6')]&&_0x4fb1cf['dialPredictiveOptimization']===_0xe5aa('0x1c2')){clearPredictiveAttributes(_0x4fb1cf);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x1c5'),_0xe5aa('0x1c6'),_0x20783f,_0xe5aa('0x1c7'),_0x4fb1cf[_0xe5aa('0xc6')],_0xe5aa('0x1bb'),_0x4fb1cf[_0xe5aa('0x41')]);}else if(!ifInterval(_0x4fb1cf[_0xe5aa('0x1bf')],_0x4fb1cf[_0xe5aa('0x1bb')])&&_[_0xe5aa('0x3b')](_0x4fb1cf['startPredictive'])&&!_['isUndefined'](_0x4fb1cf[_0xe5aa('0x1bb')])){_0x4fb1cf['startPredictive']=moment()[_0xe5aa('0x40')](_0xe5aa('0xc1'));loggerPredictive['info'](_0x4fb1cf[_0xe5aa('0x41')],_0xe5aa('0x1c8'),_0x4fb1cf[_0xe5aa('0x5d')]);hopperUtils[_0xe5aa('0x1c9')](_0x4fb1cf[_0xe5aa('0x1bf')])[_0xe5aa('0x3a')](this[_0xe5aa('0x1ca')](_0x4fb1cf))[_0xe5aa('0x3a')](mergeDataErlangB(_0x4fb1cf))['then'](this['startMethodPredictive'](_0x4fb1cf))[_0xe5aa('0x9c')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x4fb1cf));}else if(!ifInterval(_0x4fb1cf[_0xe5aa('0x1bf')],_0x4fb1cf['startPredictive'])){_0x4fb1cf['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x4fb1cf['startPredictive']=moment()[_0xe5aa('0x40')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0xe5aa('0x44')](_0x4fb1cf['name'],_0xe5aa('0x1cb'),_0x4fb1cf['startPredictive']);clearInterval(_0x4fb1cf[_0xe5aa('0x60')]);_0x4fb1cf[_0xe5aa('0x60')]=undefined;hopperUtils[_0xe5aa('0x1c9')](_0x4fb1cf[_0xe5aa('0x1bf')])[_0xe5aa('0x3a')](this['getDataPredictive'](_0x4fb1cf))['then'](mergeDataErlangB(_0x4fb1cf))[_0xe5aa('0x3a')](this['startMethodPredictive'](_0x4fb1cf))[_0xe5aa('0x9c')](loggerCatchPredictive(_0xe5aa('0x1cc'),_0x4fb1cf));}else if(_0x4fb1cf[_0xe5aa('0x1b4')]&&_0x2458a8<_0x4fb1cf[_0xe5aa('0x1b4')]-_0x67e865){clearPredictiveAttributes(_0x4fb1cf);loggerPredictive[_0xe5aa('0x44')](_0x4fb1cf[_0xe5aa('0x41')],_0xe5aa('0x1cd'),_0x2458a8,_0xe5aa('0x1ce'),_0x4fb1cf[_0xe5aa('0x1b4')],'-',_0x67e865,'=',_0x4fb1cf[_0xe5aa('0x1b4')]-_0x67e865,')');}else if(_0x4fb1cf['predictiveIntervalAvailable']&&_0x2458a8>_0x4fb1cf[_0xe5aa('0x1b4')]+_0x2177ad){clearPredictiveAttributes(_0x4fb1cf);loggerPredictive[_0xe5aa('0x44')](_0x4fb1cf[_0xe5aa('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2458a8,_0xe5aa('0x1cf'),_0x4fb1cf[_0xe5aa('0x1b4')],'+',_0x2177ad,'=',_0x4fb1cf['predictiveIntervalAvailable']+_0x2177ad,')');}};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x1ca')]=function(_0xfd75b8){var _0x2824a9=this;return function(_0x432177){return new Promise(function(_0x3b771e,_0x453e3e){_[_0xe5aa('0x5a')](_0xfd75b8,_0x432177[0x0]);if(checkGetDataPredictive(_0x432177[0x0])){var _0x133c99=_0xfd75b8['predictiveIntervalAvailable']=_0xfd75b8['talking']+_0xfd75b8[_0xe5aa('0x139')];var _0x15be73=_0xfd75b8['dialPredictiveInterval']*0x3c;var _0x2e2180=_0x432177[0x0][_0xe5aa('0x4f')]+_0x432177[0x0][_0xe5aa('0x4d')];var _0x5eb493=(_0x432177[0x0]['predictiveIntervalAnsweredCalls']+_0x432177[0x0][_0xe5aa('0x4a')]+_0x432177[0x0][_0xe5aa('0x4c')])/_0x432177[0x0][_0xe5aa('0x46')];_0xfd75b8['predictiveIntervalHitRate']=_0x5eb493>0x0?_0x5eb493:0x1;switch(_0xfd75b8[_0xe5aa('0x1c1')]){case _0xe5aa('0x1c2'):var _0x3c09bc=_0xfd75b8['dialPredictiveOptimizationPercentage']/0x64;return _0x2824a9[_0xe5aa('0x1d0')](_0x133c99,_0x15be73,_0x2e2180,_0x5eb493,_0x3c09bc)[_0xe5aa('0x3a')](function(_0x20865b){return _0x3b771e(_0x20865b);});case _0xe5aa('0x1d1'):var _0x507ee7=_0xfd75b8[_0xe5aa('0x1b2')]/0x64;return _0x2824a9[_0xe5aa('0x1d2')](_0x133c99,_0x15be73,_0x2e2180,_0x5eb493,_0x507ee7)[_0xe5aa('0x3a')](function(_0x555899){return _0x3b771e(_0x555899);});default:return _0x453e3e(msgResponse('[getDataPredictive]','Failure',_0xe5aa('0x1d3')));}}else{return _0x453e3e(msgResponse(_0xe5aa('0x1d4'),'Failure',_0xe5aa('0x1d5')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x114e38){var _0x2f8a19=this;return function(_0x11de0f){return new Promise(function(_0x2ecfca,_0xb88aed){_[_0xe5aa('0x5a')](_0x114e38,_0x11de0f[0x0]);if(checkGetDataPredictive(_0x11de0f[0x0])){loggerPredictive['info'](JSON[_0xe5aa('0x72')](_0x11de0f[0x0]));if(_0x114e38[_0xe5aa('0x1c1')]===_0xe5aa('0x1c2')){return _0x2f8a19[_0xe5aa('0x14b')](_0x114e38['id'])['then'](function(_0x56363f){var _0x4fffae=_0x114e38['loggedIn']-_0x56363f[0x0][_0xe5aa('0x1d6')];var _0x2cfdf8=_0x114e38[_0xe5aa('0x1bf')]*0x3c;var _0x15947c=_0x11de0f[0x0][_0xe5aa('0x4f')]+_0x11de0f[0x0][_0xe5aa('0x4d')];var _0x5e518f=(_0x11de0f[0x0][_0xe5aa('0x48')]+_0x11de0f[0x0][_0xe5aa('0x4a')]+_0x11de0f[0x0][_0xe5aa('0x4c')])/_0x11de0f[0x0]['predictiveIntervalTotalCalls'];var _0x5a5be2=_0x114e38[_0xe5aa('0x1b2')]/0x64;_0x114e38[_0xe5aa('0x1d7')]=_0x56363f[0x0][_0xe5aa('0x1d6')]||0x0;_0x114e38['predictiveIntervalHitRate']=_0x5e518f>0x0?_0x5e518f:0x1;return _0x2f8a19['abandonmentRate'](_0x4fffae,_0x2cfdf8,_0x15947c,_0x5e518f,_0x5a5be2);})[_0xe5aa('0x3a')](function(_0x3ee0f8){return _0x2ecfca(_0x3ee0f8);})['catch'](function(_0x56dbd3){return _0xb88aed(msgResponse('[CatchErlangB]',_0xe5aa('0x8c'),JSON[_0xe5aa('0x72')](_0x56dbd3)));});}if(_0x114e38[_0xe5aa('0x1c1')]===_0xe5aa('0x1d1')){return _0x2f8a19[_0xe5aa('0x14b')](_0x114e38['id'])[_0xe5aa('0x3a')](function(_0x4b5446){var _0x52cbd9=_0x114e38[_0xe5aa('0x1d8')]-_0x4b5446[0x0]['outboundQueuePauses'];var _0x5eb6f7=_0x114e38[_0xe5aa('0x1bf')]*0x3c;var _0x2005cb=_0x11de0f[0x0][_0xe5aa('0x4f')]+_0x11de0f[0x0][_0xe5aa('0x4d')];var _0x273ed2=(_0x11de0f[0x0][_0xe5aa('0x48')]+_0x11de0f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x11de0f[0x0][_0xe5aa('0x4c')])/_0x11de0f[0x0][_0xe5aa('0x46')];var _0x106501=_0x114e38['dialPredictiveOptimizationPercentage']/0x64;_0x114e38[_0xe5aa('0x1d7')]=_0x4b5446[0x0][_0xe5aa('0x1d6')]||0x0;_0x114e38[_0xe5aa('0x1b9')]=_0x273ed2>0x0?_0x273ed2:0x1;return _0x2f8a19[_0xe5aa('0x1d2')](_0x52cbd9,_0x5eb6f7,_0x2005cb,_0x273ed2,_0x106501);})[_0xe5aa('0x3a')](function(_0x3c9624){return _0x2ecfca(_0x3c9624);})['catch'](function(_0x1fad59){return _0xb88aed(msgResponse('[CatchErlangB]',_0xe5aa('0x8c'),JSON[_0xe5aa('0x72')](_0x1fad59)));});}}else{return _0xb88aed(msgResponse('[getDataPredictive]',_0xe5aa('0x8c'),_0xe5aa('0x1d5')));}});};};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x1d9')]=function(_0x30bf3e){var _0x133949=this;return function(){var _0x1f1bc8=0x0;var _0x3930aa=Math[_0xe5aa('0x1b8')](_0x30bf3e[_0xe5aa('0x56')]*0x3e8);if(_0x3930aa>0x0){_0x3930aa=_0x3930aa<0x64?0x64:_0x3930aa;loggerPredictive['info'](_0x30bf3e[_0xe5aa('0x41')],'one\x20call\x20every:',_0x3930aa,_0xe5aa('0x1da'));_0x30bf3e[_0xe5aa('0x60')]=setInterval(function(){_0x133949[_0xe5aa('0x60')](_0x30bf3e);loggerPredictiveCalls[_0xe5aa('0x44')](_0xe5aa('0x1db'),_0x1f1bc8+=0x1);},_0x3930aa);}else{loggerPredictive[_0xe5aa('0x44')](_0x30bf3e[_0xe5aa('0x41')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x1dc')]=function(_0x3d18fb,_0x542b11){var _0x4f4622=this;return function(_0x788c73){if(_['isEmpty'](_0x788c73)){if(_[_0xe5aa('0xef')](_0x542b11['UserId'])||!_0x542b11[_0xe5aa('0x1dd')]){if(_0x3d18fb[_0xe5aa('0xad')]===_0xe5aa('0x9')){_0x3d18fb[_0xe5aa('0x6f')]=_[_0xe5aa('0x3b')](_0x3d18fb['queueStatusComplete'])?!![]:_0x3d18fb['queueStatusComplete'];var _0x2c66a4=uuid['v4']();_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4]=new Action(_0x3d18fb,_0x542b11,_0x2c66a4);loggerBooked[_0xe5aa('0x44')]('[booked][checkContactBlack]',_0x2c66a4,'queueStatusComplete:\x20',JSON[_0xe5aa('0x72')](_0x3d18fb[_0xe5aa('0x6f')]),_0xe5aa('0x1de'),_0x3d18fb[_0xe5aa('0x41')]);if(_0x3d18fb['queueStatusComplete']){_0x3d18fb[_0xe5aa('0x6f')]=![];_0x4f4622[_0xe5aa('0x25')][_0x4f4622['actions'][_0x2c66a4][_0xe5aa('0xb7')]]=[];ami['Action']({'actionid':_0x2c66a4,'action':_0xe5aa('0x1df'),'queue':_0x3d18fb['name']})[_0xe5aa('0x9c')](function(){_0x4f4622[_0xe5aa('0xba')](_0x3d18fb);hopperUtils[_0xe5aa('0xd1')]({'active':![],'ContactId':_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4][_0xe5aa('0xe4')],'ListId':_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4][_0xe5aa('0xd4')],'VoiceQueueId':_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4][_0xe5aa('0xd5')]||undefined,'CampaignId':_0x4f4622['actions'][_0x2c66a4]['CampaignId']||undefined})[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x1e0')));delete _0x4f4622[_0xe5aa('0xe7')][_0x2c66a4];});}else{loggerBooked[_0xe5aa('0x44')](_0xe5aa('0x1e1'),JSON[_0xe5aa('0x72')](_0x3d18fb[_0xe5aa('0x6f')]),_0xe5aa('0x1de'),_0x3d18fb[_0xe5aa('0x41')]);_0x4f4622['updateOriginated'](_0x3d18fb);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x4f4622['actions'][_0x2c66a4][_0xe5aa('0xe4')],'ListId':_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4]['ListId'],'VoiceQueueId':_0x4f4622[_0xe5aa('0xe7')][_0x2c66a4][_0xe5aa('0xd5')]||undefined,'CampaignId':_0x4f4622['actions'][_0x2c66a4][_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x4f4622[_0xe5aa('0xe7')][_0x2c66a4];}}else{return _0x4f4622[_0xe5aa('0x155')](_0x3d18fb,_0x542b11);}}else{if(utils[_0xe5aa('0x5b')](undefined,_0x542b11[_0xe5aa('0x1e2')])<_0x3d18fb[_0xe5aa('0x1e3')]*0x3c){if(_0x542b11[_0xe5aa('0x145')]&&!_0x542b11[_0xe5aa('0x145')][_0xe5aa('0x1e4')]){_0x4f4622[_0xe5aa('0xf2')][_0xe5aa('0xf3')](_0x542b11['id'])[_0xe5aa('0x1d')](function(){_0x4f4622[_0xe5aa('0xba')](_0x3d18fb);});}else{hopperUtils[_0xe5aa('0x1e5')]({'active':![]},_0x542b11['id'],0x1)[_0xe5aa('0x1d')](function(){_0x4f4622[_0xe5aa('0xba')](_0x3d18fb);});}}else{_0x3d18fb[_0xe5aa('0x1e6')]+=0x1;_0x4f4622[_0xe5aa('0xba')](_0x3d18fb);if(_0x3d18fb[_0xe5aa('0x1e7')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x542b11[_0xe5aa('0xe4')],'ListId':_0x542b11['ListId'],'VoiceQueueId':_0x542b11[_0xe5aa('0xd5')]||undefined,'CampaignId':_0x542b11[_0xe5aa('0xd6')]||undefined})[_0xe5aa('0x9c')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils['createHistory'](createObjHistory(_0x3d18fb,_0x542b11,utils[_0xe5aa('0x67')][_0xe5aa('0x1e8')],0x17,_0xe5aa('0x1e9')))[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x1ea')));}else{_0x4f4622[_0xe5aa('0x111')](createObjHistory(_0x3d18fb,_0x542b11,utils[_0xe5aa('0x67')][_0xe5aa('0x1eb')],0x16,_0xe5aa('0x1ec')),_0xe5aa('0x1ed'),'[Originate][HistoryRecallClose]');}}}}else{_0x3d18fb[_0xe5aa('0x1ee')]+=0x1;_0x4f4622[_0xe5aa('0x111')](createObjHistory(_0x3d18fb,_0x542b11,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,_0xe5aa('0x1ef')),'[Originate][historyBlacklist]',_0xe5aa('0x1f0'));throw _0xe5aa('0x1f1');}};};Dialer[_0xe5aa('0x1a')]['handleIvr']=function(_0x24158f){var _0x3aebd3=this;var _0x225a3d=_0x24158f['limitCalls']-_0x24158f[_0xe5aa('0x7c')];emitCampaignSummary(_0x24158f);if(_0x225a3d>0x0&&_0x24158f[_0xe5aa('0x65')]==0x0){if(_0x225a3d>this['maxNumberOriginate']){_0x225a3d=this['maxNumberOriginate'];}_0x24158f[_0xe5aa('0x65')]=0x1;hopperUtils[_0xe5aa('0x1f2')](_0x24158f,_0x225a3d)['then'](function(_0x3a5eab){_0x24158f['temp']=0x0;if(_0x3a5eab){if(!utils[_0xe5aa('0x1f3')](_0x3a5eab)){_0x24158f[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0xe5aa('0x44')](_0xe5aa('0x1f4')+_0x24158f[_0xe5aa('0x41')]);}else{_0x24158f[_0xe5aa('0x7c')]+=_0x3a5eab[_0xe5aa('0x94')];_0x24158f[_0xe5aa('0x66')]=utils['CAMPAIGN_STATUS'][_0xe5aa('0x1f5')];for(var _0x36cb71=0x0;_0x36cb71<_0x3a5eab[_0xe5aa('0x94')];_0x36cb71+=0x1){_0x24158f[_0xe5aa('0x1f6')]+=0x1;if(_[_0xe5aa('0xef')](_0x3a5eab[_0x36cb71])||_[_0xe5aa('0xef')](_0x3a5eab[_0x36cb71]['Contact'])||_[_0xe5aa('0xef')](_0x3a5eab[_0x36cb71][_0xe5aa('0x158')])){_0x3aebd3['emptyContact'](_0xe5aa('0x1f7'),_0x24158f,_0x3a5eab[_0x36cb71]);}else{hopperUtils[_0xe5aa('0x1f8')](_[_0xe5aa('0x73')](_0x3a5eab[_0x36cb71],[_0xe5aa('0xd6'),_0xe5aa('0x158')]))['then'](_0x3aebd3[_0xe5aa('0x1dc')](_0x24158f,_0x3a5eab[_0x36cb71]))[_0xe5aa('0x9c')](_0x3aebd3[_0xe5aa('0x1f9')](_0xe5aa('0x1fa'),_0x24158f));}}}}})[_0xe5aa('0x9c')](loggerGetContactDialer(_0xe5aa('0x1fb'),_0x24158f,_0x225a3d));}};Dialer['prototype']['handlePower']=function(_0x283458,_0x444d20){var _0x58b212=this;var _0x22f762=[];if(_0x444d20<0x1||_0x283458['dialMethod']==='booked'){_0x444d20=0x1;}var _0x418c50=Math[_0xe5aa('0x1b8')](_0x283458[_0xe5aa('0x139')]*_0x444d20)-_0x283458[_0xe5aa('0x7c')];if(_0x283458[_0xe5aa('0x1fc')]>0x0){var _0x2bb695=_0x283458[_0xe5aa('0x1fc')]-_0x283458[_0xe5aa('0x7c')]-_0x283458[_0xe5aa('0x1b7')]-_0x283458[_0xe5aa('0x13b')];if(_0x418c50>_0x2bb695){_0x418c50=_0x2bb695;}}if(_0x418c50>0x0&&_0x283458[_0xe5aa('0x65')]==0x0){if(_0x283458[_0xe5aa('0xad')]===_0xe5aa('0x9')){_0x418c50=0x1;}if(_0x418c50>this['maxNumberOriginate']){_0x418c50=this[_0xe5aa('0x23')];}for(var _0x1f5dfe in this['agents']){if(typeof this['agents'][_0x1f5dfe]!==_0xe5aa('0xa6')){if(this[_0xe5aa('0x21')][_0x1f5dfe][_0xe5aa('0xc7')]===_0xe5aa('0x1fd')&&this['agents'][_0x1f5dfe][_0xe5aa('0x84')]===_0xe5aa('0x83')){_0x22f762[_0xe5aa('0x95')](this['agents'][_0x1f5dfe]['id']);}}}_0x283458[_0xe5aa('0x65')]=0x1;hopperUtils[_0xe5aa('0x1fe')](_0x283458,_0x22f762,_0x418c50)[_0xe5aa('0x3a')](function(_0x1890d8){_0x283458['temp']=0x0;if(_0x1890d8){if(!utils[_0xe5aa('0x1f3')](_0x1890d8)){hopperUtils[_0xe5aa('0x1ff')](_0x283458)[_0xe5aa('0x3a')](sendMessageReschedule(_0x283458))[_0xe5aa('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x283458['originated']+=_0x1890d8[_0xe5aa('0x94')];_0x283458[_0xe5aa('0x66')]=_0x283458[_0xe5aa('0xad')]===_0xe5aa('0x9')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0xe5aa('0x67')]['RUNNING'];for(var _0x5965c0=0x0;_0x5965c0<_0x1890d8[_0xe5aa('0x94')];_0x5965c0+=0x1){if(_[_0xe5aa('0xef')](_0x1890d8[_0x5965c0])||_[_0xe5aa('0xef')](_0x1890d8[_0x5965c0]['Contact'])||_[_0xe5aa('0xef')](_0x1890d8[_0x5965c0][_0xe5aa('0x158')])){_0x58b212[_0xe5aa('0x14f')](_0xe5aa('0x1f7'),_0x283458,_0x1890d8[_0x5965c0]);}else{hopperUtils[_0xe5aa('0x200')](_['pick'](_0x1890d8[_0x5965c0],[_0xe5aa('0xd5'),_0xe5aa('0x158')]))[_0xe5aa('0x3a')](_0x58b212[_0xe5aa('0x1dc')](_0x283458,_0x1890d8[_0x5965c0]))[_0xe5aa('0x9c')](_0x58b212[_0xe5aa('0x1f9')](_0xe5aa('0x1f7'),_0x283458));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x283458,_0x418c50));}};Dialer[_0xe5aa('0x1a')]['handlePredictive']=function(_0x451d74){if(_0x451d74[_0xe5aa('0x1fc')]>0x0){var _0x5690c0=_0x451d74['dialLimitQueue']-_0x451d74[_0xe5aa('0x7c')]-_0x451d74[_0xe5aa('0x1b7')];if(_0x5690c0>0x0&&_0x451d74[_0xe5aa('0x65')]==0x0){this[_0xe5aa('0x201')](_0x451d74);}else{loggerPredictiveCalls['info'](_0xe5aa('0x202'));}}else{this[_0xe5aa('0x201')](_0x451d74);}};Dialer[_0xe5aa('0x1a')]['tryOriginatePredictive']=function(_0x591107){var _0x50092d=this;var _0x3ebe63=[];_0x591107[_0xe5aa('0x7c')]+=0x1;for(var _0x1d2b6e in this['agents']){if(typeof this[_0xe5aa('0x21')][_0x1d2b6e]!=='undefined'){if(this[_0xe5aa('0x21')][_0x1d2b6e][_0xe5aa('0xc7')]===_0xe5aa('0x1fd')&&this[_0xe5aa('0x21')][_0x1d2b6e][_0xe5aa('0x84')]===_0xe5aa('0x83')){_0x3ebe63[_0xe5aa('0x95')](this[_0xe5aa('0x21')][_0x1d2b6e]['id']);}}}_0x591107[_0xe5aa('0x65')]=0x1;return this[_0xe5aa('0x1fe')](_0x591107['id'],_0x3ebe63,0x1,_0x591107[_0xe5aa('0x203')],_0x591107)[_0xe5aa('0x3a')](function(_0x129a79){_0x591107['temp']=0x1;if(_0x129a79){if(!utils['checkContactEmpty'](_0x129a79)){utils[_0xe5aa('0x64')](_0x591107,0x1,0x0);return hopperUtils[_0xe5aa('0x1ff')](_0x591107)[_0xe5aa('0x3a')](sendMessageReschedule(_0x591107))[_0xe5aa('0x9c')](loggerCatch(_0xe5aa('0x204')));}else{_0x591107[_0xe5aa('0x66')]=utils[_0xe5aa('0x67')][_0xe5aa('0x1f5')];if(_[_0xe5aa('0xef')](_0x129a79[0x0])||_['isNil'](_0x129a79[0x0][_0xe5aa('0x173')])||_[_0xe5aa('0xef')](_0x129a79[0x0]['phone'])){_0x50092d[_0xe5aa('0x14f')](_0xe5aa('0x1f7'),_0x591107,_0x129a79[0x0]);}else{return hopperUtils[_0xe5aa('0x200')](_[_0xe5aa('0x73')](_0x129a79[0x0],['VoiceQueueId',_0xe5aa('0x158')]))[_0xe5aa('0x3a')](_0x50092d['checkContactBlack'](_0x591107,_0x129a79[0x0]))['catch'](_0x50092d[_0xe5aa('0x1f9')](_0xe5aa('0x205'),_0x591107));}}}})['catch'](loggerGetContactDialer(_0xe5aa('0x206'),_0x591107,0x1));};Dialer[_0xe5aa('0x1a')][_0xe5aa('0x1d0')]=function(_0x467cf,_0x309f23,_0x3587e3,_0x4aaf4c,_0x3c400f,_0x4ce6c2){loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x207'));loggerPredictive[_0xe5aa('0x44')]('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',_0x467cf);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x208'),_0x309f23);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3587e3);loggerPredictive['info']('P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4aaf4c);loggerPredictive['info'](_0xe5aa('0x209'),_0x3c400f);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x50'));return new Promise(function(_0x1d8662,_0x33b001){if(_0x467cf<=0x0||isNaN(_0x467cf)){return _0x33b001(msgResponse(_0xe5aa('0x20a'),_0xe5aa('0x80'),_0xe5aa('0x20b')+_0x467cf));}if(_0x3587e3<=0x0||isNaN(_0x3587e3)){return _0x33b001(msgResponse(_0xe5aa('0x20a'),_0xe5aa('0x80'),_0xe5aa('0x20c')+_0x3587e3));}if(_0x4aaf4c<=0x0||isNaN(_0x4aaf4c)){return _0x33b001(msgResponse(_0xe5aa('0x20a'),_0xe5aa('0x80'),'p\x20=\x20'+_0x4aaf4c));}if(_0x309f23<=0x0||isNaN(_0x309f23)){return _0x33b001(msgResponse('[abandonmentRate]','Error',_0xe5aa('0x20d')+_0x309f23));}if(_0x3c400f<=0x0||isNaN(_0x3c400f)){return _0x33b001(msgResponse(_0xe5aa('0x20a'),_0xe5aa('0x80'),_0xe5aa('0x20e')+_0x3c400f));}_0x4ce6c2=_0x4ce6c2||0x0;var _0xbebd83=0x1/_0x3587e3;var _0x50a4dc=0x0;var _0x3090dc=0x0;var _0x1ff1d7=0x0;var _0x51f369=0x0;for(var _0x3fa712=0x0;_0x1ff1d7<_0x3c400f;_0x3fa712+=0x1){_0x3090dc=_0x3fa712/_0x309f23;_0x50a4dc=(_0x4aaf4c*_0x3090dc+_0x4ce6c2)/_0xbebd83;_0x1ff1d7=utils[_0xe5aa('0x20f')](_0x50a4dc,_0x467cf);_0x51f369=_0x50a4dc/_0x467cf*(0x1-utils[_0xe5aa('0x20f')](_0x50a4dc,_0x467cf));}return _0x1d8662({'erlangCalls':_0x3fa712,'erlangCallToSecond':_0x309f23/_0x3fa712,'erlangAbandonmentRate':_0x1ff1d7,'erlangBusyFactor':_0x51f369});});};Dialer[_0xe5aa('0x1a')]['busyFactor']=function(_0x73915e,_0x24b6b1,_0x54daed,_0x1fe2b4,_0x281bc6,_0x4aa4b3){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xe5aa('0x210'),_0x73915e);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x208'),_0x24b6b1);loggerPredictive['info'](_0xe5aa('0x211'),_0x54daed);loggerPredictive['info'](_0xe5aa('0x212'),_0x1fe2b4);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x213'),_0x281bc6);loggerPredictive[_0xe5aa('0x44')](_0xe5aa('0x50'));return new Promise(function(_0x2771fc,_0x1f2eb6){if(_0x73915e<=0x0||isNaN(_0x73915e)){return _0x1f2eb6(msgResponse(_0xe5aa('0x214'),_0xe5aa('0x80'),_0xe5aa('0x20b')+_0x73915e));}if(_0x54daed<=0x0||isNaN(_0x54daed)){return _0x1f2eb6(msgResponse(_0xe5aa('0x214'),'Error',_0xe5aa('0x20c')+_0x54daed));}if(_0x1fe2b4<=0x0||isNaN(_0x1fe2b4)){return _0x1f2eb6(msgResponse(_0xe5aa('0x214'),_0xe5aa('0x80'),'p\x20=\x20'+_0x1fe2b4));}if(_0x24b6b1<=0x0||isNaN(_0x24b6b1)){return _0x1f2eb6(msgResponse(_0xe5aa('0x214'),'Error',_0xe5aa('0x20d')+_0x24b6b1));}if(_0x281bc6<=0x0||isNaN(_0x281bc6)){return _0x1f2eb6(msgResponse(_0xe5aa('0x214'),_0xe5aa('0x80'),_0xe5aa('0x215')+_0x281bc6));}_0x4aa4b3=_0x4aa4b3||0x0;var _0x243f82=0x1/_0x54daed;var _0x1f3f44=0x0;var _0x253a4b=0x0;var _0x4d2c2d=0x0;var _0x128456=0x0;for(var _0x93f61b=0x0;_0x128456<_0x281bc6;_0x93f61b+=0x1){_0x253a4b=_0x93f61b/_0x24b6b1;_0x1f3f44=(_0x1fe2b4*_0x253a4b+_0x4aa4b3)/_0x243f82;_0x4d2c2d=utils[_0xe5aa('0x20f')](_0x1f3f44,_0x73915e);_0x128456=_0x1f3f44/_0x73915e*(0x1-utils[_0xe5aa('0x20f')](_0x1f3f44,_0x73915e));}return _0x2771fc({'erlangCalls':_0x93f61b,'erlangCallToSecond':_0x24b6b1/_0x93f61b,'erlangAbandonmentRate':_0x4d2c2d,'erlangBusyFactor':_0x128456});});};module['exports']=Dialer; \ No newline at end of file +var _0x3ded=['verifyAdditionalPhones','state','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','additional','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','voiceQueue','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','actionid','strategy','rrmemory','isNil','paused','stateinterface','locked','queueBooked','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','Success','callProgressDetecting','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','membername','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','AMD','countmachineretry','custom:amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','[rescheduleContact][Machine]','dialAMDActive','value','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countagentrejectretry','reason19\x20machine....','dialMachineRetryFrequency','syncHangup','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','moveContactManagedDialer','outboundUnknownCallsDay','cause-txt','Unknow','running','getQueueCampaignStatusMessage','statusMessage','inUse','talking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','available','floor','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalHitRate','predictiveIntervalPauses','busyFactor','[CatchErlangB]','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','Contact','[actionOriginate]\x20','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','Amax\x20=\x20','erlangb','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]','m\x20=\x20','interval\x20=\x20','util','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictiveCalls','../ami','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/hangup','env','XCALLY_IP_AGI','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','optionPredictive','startPredictive','startProgressive','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','getSettings','then','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalTotalCalls','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','getSeconds','startPredictive\x20value\x20cleared','handlePredictive','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','Error','prototype','isTrunkReachable','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','Trunk','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','true','catch','Action','indexOf','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','syncCampaigns','undefined','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','predictive','progressive','handlePower','power','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueId','uniqueid','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','ivr','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','agiafterat','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x4a3dc0,_0xfb849e){var _0x233760=function(_0x219c91){while(--_0x219c91){_0x4a3dc0['push'](_0x4a3dc0['shift']());}};_0x233760(++_0xfb849e);}(_0x3ded,0x14e));var _0xd3de=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x3ded[_0x1abb09];return _0xea1c07;};'use strict';var util=require(_0xd3de('0x0'));var _=require(_0xd3de('0x1'));var uuid=require(_0xd3de('0x2'));var moment=require(_0xd3de('0x3'));var rr=require('rr');var Redis=require(_0xd3de('0x4'));var utils=require(_0xd3de('0x5'));var hopperUtils=require(_0xd3de('0x6'));var ut=require(_0xd3de('0x7'));var config=require(_0xd3de('0x8'));var logger=require(_0xd3de('0x9'))(_0xd3de('0xa'));var loggerBooked=require(_0xd3de('0x9'))(_0xd3de('0xb'));var loggerPredictive=require(_0xd3de('0x9'))('predictive');var loggerPredictiveCalls=require(_0xd3de('0x9'))(_0xd3de('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require(_0xd3de('0xd'));config[_0xd3de('0xe')]=_[_0xd3de('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0xd3de('0x10'));var voiceQueueRt=require(_0xd3de('0x11'));var RpcSetting=require(_0xd3de('0x12'));var Interval=require(_0xd3de('0x13'));var Action=require(_0xd3de('0x14'));var History=require(_0xd3de('0x15'));var Final=require('./models/final');var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0xd3de('0x16'));var ipAgi=process[_0xd3de('0x17')][_0xd3de('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x1f9652){this[_0xd3de('0x19')]=this[_0xd3de('0x19')]?this[_0xd3de('0x19')][_0xd3de('0x1a')](_0x1f9652):_0x1f9652();};function Dialer(_0x4e2a8c,_0xda6ae5){this['sequence']=new Sequence();this[_0xd3de('0x1b')]=_0xda6ae5;this[_0xd3de('0x1c')]=_0x4e2a8c[_0xd3de('0x1c')];this[_0xd3de('0x1d')]=_0x4e2a8c[_0xd3de('0x1d')];this[_0xd3de('0x1e')]=_0x4e2a8c['agents'];this[_0xd3de('0x1f')]=_0x4e2a8c['trunks'];this[_0xd3de('0x20')]=config[_0xd3de('0x20')]||0x2;this['channels']={};this['actions']={};this[_0xd3de('0x21')]={};this['uniqueId']={};this[_0xd3de('0x22')]={};this[_0xd3de('0x23')]={};this[_0xd3de('0x24')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xd3de('0x25')]={};this[_0xd3de('0x26')]={};ami['on'](_0xd3de('0x27'),this[_0xd3de('0x28')][_0xd3de('0x29')](this));ami['on']('queuecallerabandon',this[_0xd3de('0x2a')][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x2b'),this[_0xd3de('0x2c')]['bind'](this));ami['on'](_0xd3de('0x2d'),this[_0xd3de('0x2e')][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x2f'),this['syncQueueSummary'][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x30'),this[_0xd3de('0x31')][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x32'),this['syncHangup'][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x33'),this['syncNewExten']['bind'](this));ami['on'](_0xd3de('0x34'),this[_0xd3de('0x35')][_0xd3de('0x29')](this));ami['on'](_0xd3de('0x36'),this[_0xd3de('0x37')][_0xd3de('0x29')](this));ami['on']('queuestatuscomplete',this[_0xd3de('0x38')]['bind'](this));this['loopCampaigns']();this[_0xd3de('0x39')]();RpcSetting[_0xd3de('0x3a')]()[_0xd3de('0x3b')](function(_0x396306){previewRecallmeReminderInterval=_0x396306['previewRecallmeReminderInterval'];});}function isNotNull(_0x39d4ff){return _0x39d4ff!==null&&!_[_0xd3de('0x3c')](_0x39d4ff);}function msgResponse(_0x184986,_0x4c22d5,_0x177052){return{'action':_0x184986,'response':_0x4c22d5,'message':_0x177052,'stack':_0x177052};}function emit(_0x5ef73d,_0x2942b7,_0x660976){io['to'](_0x5ef73d)[_0xd3de('0x3d')](_0x2942b7,_0x660976);}function emitOutboundVoiceQueueSummary(_0x3915af){if(_0x3915af[_0xd3de('0x3e')]===_0xd3de('0x3f')){logger[_0xd3de('0x40')](_0xd3de('0x41'),util[_0xd3de('0x42')](_0x3915af,{'showHidden':![],'depth':null}));emit(util[_0xd3de('0x43')](_0xd3de('0x44'),_0x3915af[_0xd3de('0x45')]),_0xd3de('0x46'),_0x3915af);}}function checkGetDataPredictive(_0xc858be){if(isNotNull(_0xc858be)&&!_[_0xd3de('0x47')](_0xc858be)){loggerPredictive['info'](_0xd3de('0x48'));loggerPredictive[_0xd3de('0x49')](_0xd3de('0x4a'),_0xc858be['predictiveIntervalTotalCalls']);loggerPredictive['info'](_0xd3de('0x4b'),_0xc858be[_0xd3de('0x4c')]);loggerPredictive['info']('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc858be[_0xd3de('0x4d')]);loggerPredictive[_0xd3de('0x49')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xc858be[_0xd3de('0x4e')]);loggerPredictive['info'](_0xd3de('0x4f'),_0xc858be[_0xd3de('0x50')]);loggerPredictive['info'](_0xd3de('0x51'),_0xc858be[_0xd3de('0x52')]);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x53'));if(_0xc858be[_0xd3de('0x54')]>0x0){if(!_[_0xd3de('0x3c')](_0xc858be[_0xd3de('0x52')])&&_0xc858be[_0xd3de('0x52')]>0x0){return!![];}loggerPredictive[_0xd3de('0x49')](_0xd3de('0x55'));if(!_[_0xd3de('0x3c')](_0xc858be['predictiveIntervalAvgHoldtime'])&&_0xc858be['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xd3de('0x49')](_0xd3de('0x56'));}else{loggerPredictive[_0xd3de('0x49')](_0xd3de('0x57'));}}else{loggerPredictive[_0xd3de('0x49')](_0xd3de('0x58'));}return![];}function mergeDataErlangB(_0x1b48a2){return function(_0x460af5){loggerPredictive['info'](_0xd3de('0x59'));loggerPredictive['info'](_0xd3de('0x5a'),_0x460af5['erlangCalls']);loggerPredictive[_0xd3de('0x49')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x460af5[_0xd3de('0x5b')]);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x5c'),_0x460af5['erlangAbandonmentRate']);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x5d'),_0x460af5[_0xd3de('0x5e')]);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x5c'),_0x460af5[_0xd3de('0x5f')]);loggerPredictive[_0xd3de('0x49')]('---------------------------');_['merge'](_0x1b48a2,_0x460af5);};}function ifInterval(_0x2526fd,_0x5a5c23){if(_[_0xd3de('0x3c')](_0x5a5c23)){return![];}return utils[_0xd3de('0x60')](undefined,_0x5a5c23)<_0x2526fd*0x3c;}function clearPredictiveAttributes(_0x360899){if(_0x360899[_0xd3de('0x24')]){_0x360899['startProgressive']=undefined;loggerPredictive[_0xd3de('0x40')](_0x360899[_0xd3de('0x45')],'startProgressive\x20value\x20cleared');}if(_0x360899[_0xd3de('0x23')]){_0x360899[_0xd3de('0x23')]=undefined;loggerPredictive[_0xd3de('0x40')](_0x360899[_0xd3de('0x45')],_0xd3de('0x61'));}if(_0x360899[_0xd3de('0x62')]){clearInterval(_0x360899[_0xd3de('0x62')]);_0x360899['handlePredictive']=undefined;loggerPredictive['debug'](_0x360899[_0xd3de('0x45')],'handlePredictive\x20interval\x20cleared');}}function loggerCatchPredictive(_0x1c6f75,_0x2c82f0){return function(_0xc5561a){loggerPredictive[_0xd3de('0x63')](_0x2c82f0['name'],_0x1c6f75);loggerPredictive[_0xd3de('0x63')](_0xc5561a[_0xd3de('0x64')]);clearPredictiveAttributes(_0x2c82f0);};}function loggerCatch(_0x485eee){return function(_0x2c4cde){logger[_0xd3de('0x63')](_0x485eee,util[_0xd3de('0x42')](_0x2c4cde,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x108bd8,_0x5d8294,_0x441de0){return function(_0x1b5331){utils[_0xd3de('0x65')](_0x5d8294,_0x441de0,0x0);_0x5d8294[_0xd3de('0x66')]=0x0;logger[_0xd3de('0x63')](_0x108bd8,util[_0xd3de('0x42')](_0x1b5331,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x55eb39){return function(_0x52bd49){if(isNotNull(_0x52bd49)&&isNotNull(_0x52bd49[0x0])){if(_0x52bd49[0x0][_0xd3de('0x67')]>0x0){_0x55eb39[_0xd3de('0x68')]=utils[_0xd3de('0x69')]['CONTACTS_RESCHEDULED'];logger[_0xd3de('0x49')](_0xd3de('0x6a')+_0x55eb39['name'],_0x52bd49[0x0][_0xd3de('0x67')],'contacts');}else{_0x55eb39[_0xd3de('0x68')]=utils['CAMPAIGN_STATUS'][_0xd3de('0x6b')];logger[_0xd3de('0x49')]('[getContactDialer2][Empty]'+_0x55eb39[_0xd3de('0x45')]);}}};}function createObjHistory(_0x5830d2,_0x49850b,_0x25d110,_0x568cef,_0x24935e){_0x5830d2[_0xd3de('0x68')]=_0x25d110;var _0x29f158=new Action(_0x5830d2,_0x49850b);var _0x5978e8=new History(_0x29f158);_0x5978e8['state']=_0x568cef;_0x5978e8[_0xd3de('0x6c')]=_0x24935e;_0x5978e8[_0xd3de('0x6d')]=_0x29f158[_0xd3de('0x6e')];return _0x5978e8;}function unlockQueueStatus(_0x1d36ae,_0xb50d6f){setTimeout(function(){if(_[_0xd3de('0x3c')](_0x1d36ae[_0xd3de('0x6f')])){loggerBooked[_0xd3de('0x63')](_0xd3de('0x70'),_0xb50d6f);}_0x1d36ae[_0xd3de('0x6f')]=!![];loggerBooked[_0xd3de('0x49')](_0xd3de('0x71'),_0xb50d6f,JSON[_0xd3de('0x72')](_[_0xd3de('0x73')](_0x1d36ae,['name',_0xd3de('0x6f')])));},0x1f3);}function checkInterval(_0x3a6111){return function(){if(!isNotNull(_0x3a6111[_0xd3de('0x74')])){_0x3a6111['message']=utils[_0xd3de('0x69')][_0xd3de('0x75')];throw _0x3a6111[_0xd3de('0x45')]+_0xd3de('0x76');}if(!isNotNull(_0x3a6111[_0xd3de('0x74')][_0xd3de('0x77')])){_0x3a6111[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x75')];throw _0x3a6111['name']+_0xd3de('0x76');}if(!isNotNull(_['isEmpty'](_0x3a6111[_0xd3de('0x74')]['Intervals']))){_0x3a6111[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x75')];throw _0x3a6111['name']+_0xd3de('0x76');}};}function checkIsIVRCampaignActive(_0x36f458){return function(){if(!utils[_0xd3de('0x78')](_0x36f458)){_0x36f458[_0xd3de('0x68')]=utils['CAMPAIGN_STATUS'][_0xd3de('0x79')];throw _0x36f458[_0xd3de('0x45')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x26df3f){if(utils[_0xd3de('0x7a')](_0x26df3f)){emit(util[_0xd3de('0x43')](_0xd3de('0x7b'),_0x26df3f[_0xd3de('0x45')]),'campaign:save',_0x26df3f);}}function loggerCatchQueueSummary(_0x9bf5cb,_0x57ceb9){return function(_0x3ea41c){clearPredictiveAttributes(_0x57ceb9);emitCampaignSummary(_0x57ceb9);loggerSyncQueueSummary['debug'](_0x9bf5cb,util[_0xd3de('0x42')](_0x3ea41c,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1ece32){if(_0x1ece32[_0xd3de('0x7c')]){if(_0x1ece32['originated']===0x0){_0x1ece32[_0xd3de('0x7c')]=![];_0x1ece32[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x79')];loggerSyncQueueSummary[_0xd3de('0x40')](_0xd3de('0x7d'),_0x1ece32[_0xd3de('0x45')],'is\x20not\x20active');}else{_0x1ece32[_0xd3de('0x68')]=utils[_0xd3de('0x69')]['DISACTIVED'];loggerSyncQueueSummary['debug'](_0xd3de('0x7d'),_0x1ece32[_0xd3de('0x45')],_0xd3de('0x7e'));}emitCampaignSummary(_0x1ece32);}}function myreject(_0x1940df){return function(_0x19b91a){return _0x1940df(msgResponse('[ifTime][Action]',_0xd3de('0x7f'),JSON['stringify'](_0x19b91a)));};}Dialer[_0xd3de('0x80')][_0xd3de('0x81')]=function(_0x254987){return!_[_0xd3de('0x3c')](_0x254987)&&_0x254987&&!_[_0xd3de('0x3c')](_0x254987[_0xd3de('0x45')])&&!_['isUndefined'](_0x254987[_0xd3de('0x82')])&&_0x254987['active']&&(this[_0xd3de('0x1f')][util[_0xd3de('0x43')]('SIP/%s',_0x254987[_0xd3de('0x45')])][_0xd3de('0x83')]===_0xd3de('0x84')||this[_0xd3de('0x1f')][util[_0xd3de('0x43')](_0xd3de('0x85'),_0x254987['name'])][_0xd3de('0x83')]===_0xd3de('0x86'));};Dialer[_0xd3de('0x80')][_0xd3de('0x87')]=function(_0x274a3f){var _0x3f8691=this;return function(){if(!_0x3f8691[_0xd3de('0x81')](_0x274a3f[_0xd3de('0x88')])){if(!_0x3f8691[_0xd3de('0x81')](_0x274a3f['TrunkBackup'])){_0x274a3f[_0xd3de('0x68')]=utils['CAMPAIGN_STATUS']['TRUNK_NOT_REACHABLE'];throw _0x274a3f[_0xd3de('0x45')]+_0xd3de('0x89');}}};};Dialer[_0xd3de('0x80')][_0xd3de('0x8a')]=function(_0x2772ed,_0x52349d,_0x20309b,_0x50b723){var _0x55373d=this;return function(){var _0x466d68=!![];return _0x55373d[_0xd3de('0x8b')](_0x2772ed,_0x52349d,_0x20309b,_0x50b723,_0x466d68);};};Dialer[_0xd3de('0x80')][_0xd3de('0x8c')]=function(_0x29767b,_0x288e06,_0x1739a5,_0x2cfd37){var _0x14b48a=this;return function(){var _0x2dc712=![];return _0x14b48a[_0xd3de('0x8b')](_0x29767b['Intervals'],_0x288e06,_0x1739a5,_0x2cfd37,_0x2dc712);};};Dialer[_0xd3de('0x80')]['ifTimeIvr']=function(_0x5ee087,_0x3d7522,_0x23c5b8,_0x354866,_0x2ea2cb){var _0x2fc739=[];return new Promise(function(_0x403547,_0xb79edb){if(!isNotNull(_0x5ee087)){_0x354866[_0xd3de('0x68')]=utils['CAMPAIGN_STATUS'][_0xd3de('0x75')];return _0xb79edb(msgResponse(_0xd3de('0x8d'),'Failure',_0x23c5b8+_0xd3de('0x8e')));}if(_['isEmpty'](_0x5ee087)){_0x354866[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x8f')];return _0xb79edb(msgResponse(_0xd3de('0x8d'),_0xd3de('0x90'),_0x23c5b8+_0xd3de('0x91')));}if(_0x3d7522&&_[_0xd3de('0x3c')](config[_0xd3de('0x92')][_0x3d7522])){_0x354866[_0xd3de('0x68')]=utils['CAMPAIGN_STATUS'][_0xd3de('0x93')];return _0xb79edb(msgResponse(_0xd3de('0x8d'),_0xd3de('0x90'),_0x23c5b8+_0xd3de('0x94')+_0x3d7522));}if(_[_0xd3de('0x95')](_0x5ee087)){for(var _0x1b1eea=0x0;_0x1b1eea<_0x5ee087[_0xd3de('0x96')];_0x1b1eea+=0x1){_0x2fc739[_0xd3de('0x97')](ami['Action']({'action':_0xd3de('0x98'),'command':util[_0xd3de('0x43')](_0xd3de('0x99'),_0x5ee087[_0x1b1eea][_0xd3de('0x9a')],!_[_0xd3de('0x3c')](config[_0xd3de('0x92')][_0x3d7522])?_0x3d7522:'')})[_0xd3de('0x3b')](function(_0x31a355){return _0x31a355[_0xd3de('0x9b')]['indexOf'](_0xd3de('0x9c'))>=0x0;})[_0xd3de('0x9d')](myreject(_0xb79edb)));}}else{_0x2fc739[_0xd3de('0x97')](ami[_0xd3de('0x9e')]({'action':_0xd3de('0x98'),'command':util['format']('iftime\x20%s,%s',_0x5ee087,!_[_0xd3de('0x3c')](config[_0xd3de('0x92')][_0x3d7522])?_0x3d7522:'')})['then'](function(_0x3aeaf3){return _0x3aeaf3[_0xd3de('0x9b')][_0xd3de('0x9f')]('true')>=0x0;})['catch'](myreject(_0xb79edb)));}Promise['all'](_0x2fc739)[_0xd3de('0x3b')](function(_0x18d049){var _0x53e31e=_[_0xd3de('0xa0')](_0x18d049);if(_0x53e31e){return _0x403547(_0x53e31e);}else{_0x354866['message']=_0x2ea2cb?utils[_0xd3de('0x69')][_0xd3de('0xa1')]:utils[_0xd3de('0x69')]['OVERTIME_INTERVAL'];return _0xb79edb(msgResponse(_0xd3de('0xa2'),_0xd3de('0x90'),_0xd3de('0xa3')+_0x2ea2cb+'\x20'+_0x23c5b8+_0xd3de('0xa4')+util[_0xd3de('0x42')](_0x5ee087,{'showHidden':![],'depth':null})+_0xd3de('0xa5')+_0x3d7522));}})[_0xd3de('0x9d')](function(_0x4891ca){return _0xb79edb(msgResponse(_0xd3de('0x8d'),_0xd3de('0x90'),JSON[_0xd3de('0x72')](_0x4891ca)));});});};Dialer['prototype'][_0xd3de('0xa6')]=function(){var _0x52686f=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})[_0xd3de('0x3b')](function(){setInterval(function(){_0x52686f[_0xd3de('0xa7')]();},0x3e8);});};Dialer[_0xd3de('0x80')][_0xd3de('0xa7')]=function(){var _0x3dba29=this;var _0x678470;for(var _0x259e30 in this[_0xd3de('0x1d')]){if(typeof this[_0xd3de('0x1d')][_0x259e30]!==_0xd3de('0xa8')){_0x678470=this[_0xd3de('0x1d')][_0x259e30];if(utils[_0xd3de('0x7a')](_0x678470)&&utils[_0xd3de('0x78')](_0x678470)){_0x678470[_0xd3de('0x7c')]=!![];Promise[_0xd3de('0xa9')]()['then'](checkIsIVRCampaignActive(_0x678470))[_0xd3de('0x3b')](checkInterval(_0x678470))[_0xd3de('0x3b')](_0x3dba29[_0xd3de('0x87')](_0x678470))['then'](_0x3dba29[_0xd3de('0x8a')](_0x678470[_0xd3de('0xaa')],_0x678470[_0xd3de('0xab')],_0x678470[_0xd3de('0x45')],_0x678470))[_0xd3de('0x3b')](_0x3dba29[_0xd3de('0x8c')](_0x678470[_0xd3de('0x74')],_0x678470[_0xd3de('0xab')],_0x678470[_0xd3de('0x45')],_0x678470))[_0xd3de('0x3b')](_0x3dba29[_0xd3de('0xac')](_0x678470))[_0xd3de('0x9d')](loggerCatchQueueSummary(_0xd3de('0xad'),_0x678470));}else{notSendMessagesCampaign(_0x678470);}}}};Dialer['prototype'][_0xd3de('0xae')]=function(_0x3bdd80){if(_0x3bdd80[_0xd3de('0xaf')]!==_0xd3de('0xb0')){clearPredictiveAttributes(_0x3bdd80);}switch(_0x3bdd80[_0xd3de('0xaf')]){case _0xd3de('0xb1'):this[_0xd3de('0xb2')](_0x3bdd80,0x1);break;case _0xd3de('0xb3'):this[_0xd3de('0xb2')](_0x3bdd80,_0x3bdd80['dialPowerLevel']);break;case _0xd3de('0xb0'):this[_0xd3de('0xb0')](_0x3bdd80);break;case'booked':this[_0xd3de('0xb2')](_0x3bdd80,0x1);break;default:logger[_0xd3de('0x63')]('Queue',_0x3bdd80[_0xd3de('0x45')],'method\x20not\x20recognized');}};Dialer[_0xd3de('0x80')][_0xd3de('0x8d')]=function(_0x8edc36,_0x565b95){var _0x10cbb8=_0x8edc36[_0xd3de('0xab')];var _0x1c3a20=_0x565b95?_0x8edc36[_0xd3de('0xaa')]:_0x8edc36['Interval'][_0xd3de('0x77')];logger[_0xd3de('0xb4')](_0xd3de('0xb5'),_0x1c3a20,_0x10cbb8,_0x8edc36[_0xd3de('0x45')],util[_0xd3de('0x43')](_0xd3de('0xb6'),_0x8edc36[_0xd3de('0x45')],_0x8edc36['id']));var _0x1c5ca2=null;return Interval[_0xd3de('0xb7')](_0x1c3a20,_0x10cbb8)['then'](function(_0x5dc672){if(_0x5dc672===!![]){return _0x5dc672;}else{_0x8edc36[_0xd3de('0x68')]=_0x565b95?utils[_0xd3de('0x69')][_0xd3de('0xa1')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x1c5ca2=msgResponse(_0xd3de('0xa2'),_0xd3de('0x90'),_0xd3de('0xa3')+_0x565b95+'\x20'+_0x8edc36[_0xd3de('0x45')]+_0xd3de('0xa4')+util[_0xd3de('0x42')](_0x1c3a20,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x10cbb8);}if(_0x1c5ca2!==null){logger[_0xd3de('0xb4')](_0xd3de('0xb8'),_0x1c5ca2);_0x1c5ca2[_0xd3de('0xb9')]=_0x565b95;throw _0x1c5ca2;}})[_0xd3de('0x9d')](function(_0x2704fb){logger['error'](_0xd3de('0xba'),_0x2704fb);throw msgResponse(_0xd3de('0xbb'),_0xd3de('0x7f'),util[_0xd3de('0x42')](_0x2704fb,{'showHidden':![],'depth':null}));});};Dialer[_0xd3de('0x80')]['syncAgentConnect']=function(_0x1e2eed){if(this[_0xd3de('0x1c')][_0x1e2eed[_0xd3de('0xbc')]]){if(this[_0xd3de('0xbd')][_0x1e2eed[_0xd3de('0xbe')]]&&this['uniqueId'][_0x1e2eed[_0xd3de('0xbe')]]['type']!=='ivr'){this[_0xd3de('0xbf')](this[_0xd3de('0x1c')][_0x1e2eed[_0xd3de('0xbc')]]);this[_0xd3de('0xbd')][_0x1e2eed[_0xd3de('0xbe')]]['answertime']=moment()['format'](_0xd3de('0xc0'));}}};Dialer[_0xd3de('0x80')][_0xd3de('0x2e')]=function(_0x369ebe){var _0x389aca=this[_0xd3de('0xbd')][_0x369ebe['uniqueid']];if(this['voiceQueues'][_0x369ebe[_0xd3de('0xbc')]]){if(_0x389aca&&_0x389aca[_0xd3de('0x3e')]!=='ivr'){delete this[_0xd3de('0xbd')][_0x369ebe[_0xd3de('0xbe')]];this[_0xd3de('0x1c')][_0x369ebe[_0xd3de('0xbc')]][_0xd3de('0xc1')]+=0x1;var _0x30241e=new AgentComplete(_0x389aca,_0x369ebe);if(_0x369ebe[_0xd3de('0xc2')]===_0xd3de('0xc3')){_0x30241e['agiafterat']=this[_0xd3de('0x1c')][_0x369ebe[_0xd3de('0xbc')]][_0xd3de('0xc4')]&&this['voiceQueues'][_0x369ebe[_0xd3de('0xbc')]][_0xd3de('0xc5')]?moment()[_0xd3de('0x43')](_0xd3de('0xc0')):undefined;}hopperUtils[_0xd3de('0xc6')](_0x30241e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xc7')));hopperUtils['moveContactManagedDialer'](_0x30241e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xc8')));}}};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x509932){var _0x2f2cbf=this['uniqueId'][_0x509932[_0xd3de('0xbe')]];var _0x5a01af=this;var _0x3712e4=![];var _0x36fb18;var _0x5f3f06;if(this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]]){if(_0x2f2cbf&&_0x2f2cbf[_0xd3de('0x3e')]!==_0xd3de('0xc9')){delete this['uniqueId'][_0x509932['uniqueid']];this[_0xd3de('0xbf')](this['voiceQueues'][_0x509932[_0xd3de('0xbc')]]);_0x2f2cbf['droptime']=moment()[_0xd3de('0x43')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5e28c1=new QueueCallerAbandon(_0x2f2cbf,_0x509932);if(utils[_0xd3de('0x60')](_0x2f2cbf[_0xd3de('0xca')],_0x2f2cbf[_0xd3de('0xcb')])>=_0x2f2cbf[_0xd3de('0xcc')]){this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0x4d')]+=0x1;this[_0xd3de('0x1c')][_0x509932['queue']][_0xd3de('0xcd')]+=0x1;this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xce')]+=0x1;_0x5e28c1['state']=0xa;_0x5e28c1[_0xd3de('0x6c')]=_0xd3de('0xcf');_0x5e28c1[_0xd3de('0xd0')]=_0xd3de('0xd1');_0x5e28c1[_0xd3de('0xd2')]=this['voiceQueues'][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xc4')]?moment()[_0xd3de('0x43')](_0xd3de('0xc0')):undefined;_0x5e28c1['countdropretry']+=0x1;_0x5e28c1[_0xd3de('0xd3')]+=0x1;_0x36fb18=this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xd4')];_0x5f3f06=this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xd5')];hopperUtils[_0xd3de('0xd6')](_0x5e28c1,_0x5e28c1[_0xd3de('0xd7')],_0x2f2cbf['voiceQueue'])[_0xd3de('0x3b')](function(_0x580fc4){_0x3712e4=_0x580fc4['additional']==0x1;if(_0x5e28c1[_0xd3de('0xd8')]>=_0x5a01af[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xd9')]){_0x5a01af[_0xd3de('0xda')](_0x5e28c1,_0x580fc4[_0xd3de('0xdb')]);}else{hopperUtils[_0xd3de('0xdc')]({'active':![],'countdropretry':_0x5e28c1[_0xd3de('0xd8')],'scheduledat':moment()[_0xd3de('0xdd')](_0x5a01af[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xd4')],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2f2cbf[_0xd3de('0xdf')],'ListId':_0x2f2cbf[_0xd3de('0xe0')],'VoiceQueueId':_0x2f2cbf[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2f2cbf[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xe3')));var _0x4946bc=new History(_0x5e28c1);_0x4946bc['state']=0xa;_0x4946bc[_0xd3de('0x6c')]=_0xd3de('0xcf');_0x4946bc[_0xd3de('0x6e')]=moment()[_0xd3de('0x43')](_0xd3de('0xc0'));_0x4946bc[_0xd3de('0x6d')]=_0x4946bc[_0xd3de('0x6e')];_0x4946bc[_0xd3de('0xe4')]=_0x5e28c1['calleridname'];_0x4946bc[_0xd3de('0xe5')]=_0x5e28c1[_0xd3de('0xe5')];hopperUtils['createHistory'](_0x4946bc)['catch'](loggerCatch(_0xd3de('0xe6')));}})[_0xd3de('0x3b')](function(){if(_0x3712e4)hopperUtils[_0xd3de('0xe7')](_0x5e28c1,_0x36fb18,_0x5f3f06)['then'](function(){return 0x1;});});}else{this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0x4e')]+=0x1;this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xe8')]+=0x1;_0x5e28c1[_0xd3de('0xd7')]=0xb;_0x5e28c1[_0xd3de('0x6c')]='Abandoned';_0x5e28c1['dropreason']=_0xd3de('0xe9');_0x5e28c1['countabandonedretry']+=0x1;_0x5e28c1[_0xd3de('0xd3')]+=0x1;_0x36fb18=this['voiceQueues'][_0x509932[_0xd3de('0xbc')]]['dialAbandonedRetryFrequency'];_0x5f3f06=this[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xd5')];hopperUtils['verifyAdditionalPhones'](_0x5e28c1,_0x5e28c1[_0xd3de('0xd7')],_0x2f2cbf[_0xd3de('0xea')])[_0xd3de('0x3b')](function(_0x5a8ce5){if(_0x5e28c1[_0xd3de('0xeb')]>=_0x5a01af[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xec')]){_0x5a01af[_0xd3de('0xda')](_0x5e28c1,_0x5a8ce5[_0xd3de('0xdb')]);}else{hopperUtils[_0xd3de('0xdc')]({'active':![],'countabandonedretry':_0x5e28c1[_0xd3de('0xeb')],'scheduledat':moment()[_0xd3de('0xdd')](_0x5a01af[_0xd3de('0x1c')][_0x509932[_0xd3de('0xbc')]][_0xd3de('0xed')],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2f2cbf[_0xd3de('0xdf')],'ListId':_0x2f2cbf[_0xd3de('0xe0')],'VoiceQueueId':_0x2f2cbf[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2f2cbf[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xee')));var _0x75f358=new History(_0x5e28c1);_0x75f358['state']=0xb;_0x75f358[_0xd3de('0x6c')]=_0xd3de('0xef');_0x75f358[_0xd3de('0x6e')]=moment()[_0xd3de('0x43')](_0xd3de('0xc0'));_0x75f358[_0xd3de('0x6d')]=_0x75f358[_0xd3de('0x6e')];_0x75f358[_0xd3de('0xe4')]=_0x5e28c1['calleridname'];_0x75f358['calleridnum']=_0x5e28c1[_0xd3de('0xe5')];hopperUtils[_0xd3de('0xc6')](_0x75f358)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xf0')));}})[_0xd3de('0x3b')](function(){if(_0x3712e4)hopperUtils[_0xd3de('0xe7')](_0x5e28c1,_0x36fb18,_0x5f3f06)['then'](function(){return 0x1;});});}}}};Dialer[_0xd3de('0x80')][_0xd3de('0xf1')]=function(_0xfbfe3e){if(this[_0xd3de('0xf2')][_0xfbfe3e[_0xd3de('0xbe')]]){this[_0xd3de('0xf2')][_0xfbfe3e['uniqueid']]['channel']=_0xfbfe3e[_0xd3de('0xf3')];}if(this[_0xd3de('0xbd')][_0xfbfe3e[_0xd3de('0xbe')]]){this['uniqueId'][_0xfbfe3e[_0xd3de('0xbe')]][_0xd3de('0xf3')]=_0xfbfe3e[_0xd3de('0xf3')];}};Dialer[_0xd3de('0x80')][_0xd3de('0x37')]=function(_0x34eb37){if(!this[_0xd3de('0xf2')][_0x34eb37[_0xd3de('0xf4')]]){return;}var _0x515c4e=this['voiceQueues'][this['actions'][_0x34eb37['actionid']][_0xd3de('0xbc')]][_0xd3de('0xf5')]||_0xd3de('0xf6');if(_0x515c4e==='roundrobin'){if(this[_0xd3de('0xf2')][_0x34eb37[_0xd3de('0xf4')]]&&_[_0xd3de('0xf7')](this[_0xd3de('0xf2')][_0x34eb37['actionid']]['locked'])&&_0x34eb37['status']==='1'&&_0x34eb37[_0xd3de('0xf8')]==='0'){if(this[_0xd3de('0x1e')][_0x34eb37['stateinterface']]){if(!this[_0xd3de('0x1e')][_0x34eb37[_0xd3de('0xf9')]]['locked']){this['agents'][_0x34eb37[_0xd3de('0xf9')]][_0xd3de('0xfa')]=!![];this['actions'][_0x34eb37[_0xd3de('0xf4')]][_0xd3de('0xfa')]=!![];this[_0xd3de('0xf2')][_0x34eb37[_0xd3de('0xf4')]][_0xd3de('0xf9')]=_0x34eb37[_0xd3de('0xf9')];}}}}else if(_0x515c4e==='rrmemory'){if(this['actions'][_0x34eb37[_0xd3de('0xf4')]]){if(this[_0xd3de('0x1e')][_0x34eb37[_0xd3de('0xf9')]]){this['actions'][_0x34eb37[_0xd3de('0xf4')]][_0xd3de('0xf9')]=_0x34eb37[_0xd3de('0xf9')];if(_[_0xd3de('0xf7')](this[_0xd3de('0xfb')][this['actions'][_0x34eb37['actionid']][_0xd3de('0xbc')]])){this['queueBooked'][this[_0xd3de('0xf2')][_0x34eb37[_0xd3de('0xf4')]][_0xd3de('0xbc')]]=[];}this[_0xd3de('0xfb')][this['actions'][_0x34eb37[_0xd3de('0xf4')]][_0xd3de('0xbc')]]['push'](_['merge'](_[_0xd3de('0x73')](this[_0xd3de('0xf2')][_0x34eb37['actionid']],['idHopper',_0xd3de('0xf9')]),{'status':_0x34eb37['status'],'paused':_0x34eb37[_0xd3de('0xf8')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x992563){if(!this['actions'][_0x992563[_0xd3de('0xf4')]]){return;}var _0xf0f107=this;var _0x3ed8d2=this[_0xd3de('0x1c')][this['actions'][_0x992563['actionid']]['queue']];var _0x264a00=_0x3ed8d2[_0xd3de('0xf5')]||_0xd3de('0xf6');if(_0x264a00==='roundrobin'){if(this['actions'][_0x992563[_0xd3de('0xf4')]]&&this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xf9')]){this[_0xd3de('0x1b')][_0xd3de('0xfc')](this['actions'][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xfd')],this['actions'][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xf9')])[_0xd3de('0x9d')](function(_0x43d9ff){logger[_0xd3de('0x63')](_0xd3de('0xfe'),util['inspect'](_0x43d9ff,{'showHidden':![],'depth':null}));})[_0xd3de('0x1a')](function(){_0xf0f107['updateOriginated'](_0xf0f107[_0xd3de('0x1c')][_0xf0f107[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xbc')]]);_0xf0f107[_0xd3de('0x1e')][_0xf0f107[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]]['stateinterface']][_0xd3de('0xfa')]=![];delete _0xf0f107[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]];unlockQueueStatus(_0x3ed8d2);});}else{this[_0xd3de('0xbf')](this[_0xd3de('0x1c')][this['actions'][_0x992563['actionid']][_0xd3de('0xbc')]]);hopperUtils[_0xd3de('0xdc')]({'active':![],'ContactId':this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xdf')],'ListId':this['actions'][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xe0')],'VoiceQueueId':this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xe1')]||undefined,'CampaignId':this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]];unlockQueueStatus(_0x3ed8d2);}}else if(_0x264a00===_0xd3de('0xf6')){var _0x1a8732;if(this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]]&&!_[_0xd3de('0x47')](this[_0xd3de('0xfb')][this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]]['queue']])){if(this[_0xd3de('0x25')][_0xf0f107[_0xd3de('0xf2')][_0x992563['actionid']][_0xd3de('0xbc')]]){this[_0xd3de('0x25')][_0xf0f107[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xbc')]]=this['queueBookedRR'][this[_0xd3de('0xf2')][_0x992563['actionid']][_0xd3de('0xbc')]]?this[_0xd3de('0x25')][this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]]['queue']]:this['queueBooked'][this[_0xd3de('0xf2')][_0x992563['actionid']][_0xd3de('0xbc')]]?this['queueBooked'][this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xbc')]]['_rr']||0x0:0x0;}this['queueBooked'][this['actions'][_0x992563['actionid']][_0xd3de('0xbc')]][_0xd3de('0xff')]=this[_0xd3de('0x25')][this[_0xd3de('0xf2')][_0x992563[_0xd3de('0xf4')]][_0xd3de('0xbc')]];for(var _0x14fc09=0x0;_0x14fc09=_0x23fe54[_0xd3de('0x121')]){_0x4bbb50[_0xd3de('0x122')](_0x13eca6,_0x38f496,_0x1989d1,'reason19\x20machine....');}else{if(_0x13eca6['countmachineretry']>=_0x23fe54[_0xd3de('0x123')]){_0x4bbb50[_0xd3de('0x124')](_0x13eca6,_0x38f496,_0x1989d1,_0xd3de('0x125'));}else{hopperUtils[_0xd3de('0xdc')]({'active':![],'countmachineretry':_0x13eca6[_0xd3de('0x11b')],'scheduledat':moment()['add'](_0x23fe54['dialMachineRetryFrequency'],_0xd3de('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x13eca6[_0xd3de('0xdf')],'ListId':_0x13eca6[_0xd3de('0xe0')],'VoiceQueueId':_0x13eca6[_0xd3de('0xe1')]||undefined,'CampaignId':_0x13eca6[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x126')));_0x38f496({'reschedule':0x1});}}});}if(_0x2e37af[_0xd3de('0x3e')]===_0xd3de('0xc9')&&this['campaigns'][_0x2e37af[_0xd3de('0xbc')]][_0xd3de('0x127')]&&_0x290e19[_0xd3de('0x128')]===_0xd3de('0x110')){delete this[_0xd3de('0xbd')][_0x290e19[_0xd3de('0xbe')]];this[_0xd3de('0xbf')](this[_0xd3de('0x1d')][_0x2e37af[_0xd3de('0xbc')]]);_0x251db1=new Hangup(_0x2e37af,_0x290e19);_0x251db1[_0xd3de('0xd7')]=0x12;_0x251db1[_0xd3de('0x6c')]=_0xd3de('0x129');_0x251db1['membername']='AMD';ami['emit'](_0xd3de('0x11c'),ut['buildObj'](_0x251db1,'amd'));this['saveInDb'](_0x251db1,_0xd3de('0x12a'),_0xd3de('0x12b'));}if(_0x2e37af[_0xd3de('0x3e')]===_0xd3de('0xc9')&&this[_0xd3de('0x1d')][_0x2e37af[_0xd3de('0xbc')]][_0xd3de('0x127')]&&_0x290e19[_0xd3de('0x128')]==='MACHINE'){return new Promise(function(_0xd73f30,_0x9a4d81){delete _0x4bbb50[_0xd3de('0xbd')][_0x290e19['uniqueid']];_0x4bbb50[_0xd3de('0xbf')](_0x4bbb50['campaigns'][_0x2e37af[_0xd3de('0xbc')]]);_0x4bbb50[_0xd3de('0x1d')][_0x2e37af[_0xd3de('0xbc')]][_0xd3de('0xc1')]+=0x1;_0x4bbb50['campaigns'][_0x2e37af[_0xd3de('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x43b758=_0x4bbb50['campaigns'][_0x2e37af[_0xd3de('0xbc')]];var _0x4a399f=new Hangup(_0x2e37af,_0x290e19);_0x4a399f[_0xd3de('0xd7')]=0x13;_0x4a399f[_0xd3de('0x6c')]=_0xd3de('0x119');_0x4a399f[_0xd3de('0x111')]=_0xd3de('0x11a');_0x4a399f[_0xd3de('0x11b')]+=0x1;_0x4a399f[_0xd3de('0xd3')]+=0x1;_0x4a399f[_0xd3de('0x113')]=!![];ami[_0xd3de('0x3d')](_0xd3de('0x11c'),ut[_0xd3de('0x112')](_0x4a399f,_0xd3de('0x113')));hopperUtils[_0xd3de('0xc6')](_0x4a399f)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x12c')));if(_0x4a399f['countbusyretry']+_0x4a399f['countcongestionretry']+_0x4a399f[_0xd3de('0x11f')]+_0x4a399f[_0xd3de('0x120')]+_0x4a399f[_0xd3de('0xd8')]+_0x4a399f[_0xd3de('0xeb')]+_0x4a399f['countmachineretry']+_0x4a399f[_0xd3de('0x12d')]>=_0x43b758[_0xd3de('0x121')]){_0x4bbb50['stateGlobal'](_0x4a399f,_0xd73f30,_0x9a4d81,_0xd3de('0x12e'));}else{if(_0x4a399f[_0xd3de('0x11b')]>=_0x43b758['dialMachineMaxRetry']){_0x4bbb50[_0xd3de('0x124')](_0x4a399f,_0xd73f30,_0x9a4d81,_0xd3de('0x125'));}else{hopperUtils[_0xd3de('0xdc')]({'active':![],'countmachineretry':_0x4a399f[_0xd3de('0x11b')],'scheduledat':moment()[_0xd3de('0xdd')](_0x43b758[_0xd3de('0x12f')],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x4a399f[_0xd3de('0xdf')],'ListId':_0x4a399f[_0xd3de('0xe0')],'VoiceQueueId':_0x4a399f[_0xd3de('0xe1')]||undefined,'CampaignId':_0x4a399f[_0xd3de('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0xd73f30({'reschedule':0x1});}}});}}};Dialer[_0xd3de('0x80')][_0xd3de('0x130')]=function(_0x27cb6e){var _0x41bb13=this[_0xd3de('0xbd')][_0x27cb6e[_0xd3de('0xbe')]];var _0x47ef9e;if(_0x41bb13&&_0x41bb13[_0xd3de('0x3e')]==='ivr'){delete this['uniqueId'][_0x27cb6e['uniqueid']];this[_0xd3de('0xbf')](this[_0xd3de('0x1d')][_0x41bb13['queue']]);this[_0xd3de('0x1d')][_0x41bb13[_0xd3de('0xbc')]]['ivrAnswerCallsDay']+=0x1;_0x47ef9e=new Hangup(_0x41bb13,_0x27cb6e);hopperUtils[_0xd3de('0xc6')](_0x47ef9e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x131')));hopperUtils['moveContactManagedDialer'](_0x47ef9e)['catch'](loggerCatch(_0xd3de('0x132')));}if(_0x41bb13&&_0x41bb13['type']!==_0xd3de('0xc9')&&isNotNull(this[_0xd3de('0x1c')][_0x41bb13[_0xd3de('0xbc')]]['dialQueueProject'])){delete this[_0xd3de('0xbd')][_0x27cb6e[_0xd3de('0xbe')]];this[_0xd3de('0xbf')](this['voiceQueues'][_0x41bb13[_0xd3de('0xbc')]]);this[_0xd3de('0x1c')][_0x41bb13[_0xd3de('0xbc')]][_0xd3de('0xc1')]+=0x1;this[_0xd3de('0x1c')][_0x41bb13[_0xd3de('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;_0x47ef9e=new Hangup(_0x41bb13,_0x27cb6e);_0x47ef9e['state']=0x10;_0x47ef9e[_0xd3de('0x6c')]=_0xd3de('0x133');_0x47ef9e['membername']=_0xd3de('0x134');hopperUtils[_0xd3de('0xc6')](_0x47ef9e)[_0xd3de('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xd3de('0x135')](_0x47ef9e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x132')));}if(_0x41bb13&&_0x41bb13['type']!==_0xd3de('0xc9')&&!isNotNull(this[_0xd3de('0x1c')][_0x41bb13[_0xd3de('0xbc')]]['dialQueueProject'])){delete this[_0xd3de('0xbd')][_0x27cb6e[_0xd3de('0xbe')]];this[_0xd3de('0xbf')](this[_0xd3de('0x1c')][_0x41bb13['queue']]);this['voiceQueues'][_0x41bb13[_0xd3de('0xbc')]][_0xd3de('0x136')]+=0x1;_0x47ef9e=new Hangup(_0x41bb13,_0x27cb6e);_0x47ef9e[_0xd3de('0xd7')]=0xc;_0x47ef9e[_0xd3de('0x6c')]=_0x27cb6e[_0xd3de('0x137')];_0x47ef9e[_0xd3de('0x111')]=_0xd3de('0x138');hopperUtils[_0xd3de('0xc6')](_0x47ef9e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x131')));hopperUtils[_0xd3de('0x135')](_0x47ef9e)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x132')));}};Dialer['prototype']['syncQueueSummary']=function(_0x343331){var _0x47fd7b=this;if(!_0x47fd7b[_0xd3de('0x26')][_0x343331['name']]){_0x47fd7b[_0xd3de('0x26')][_0x343331[_0xd3de('0x45')]]={'running':![]};}else if(_0x47fd7b[_0xd3de('0x26')][_0x343331[_0xd3de('0x45')]][_0xd3de('0x139')]===!![]){return;}else if(_0x47fd7b[_0xd3de('0x26')][_0x343331['name']]['running']===![]){_0x47fd7b[_0xd3de('0x26')][_0x343331[_0xd3de('0x45')]]['running']=!![];}var _0x3e7792=_0x47fd7b[_0xd3de('0x1c')][_0x343331['name']];var _0x28691e=_0x3e7792[_0xd3de('0x68')]!==utils[_0xd3de('0x69')][_0xd3de('0x79')];var _0x342bfc=utils['isPreviewCampaign'](_0x3e7792);_0x3e7792['statusMessage']=utils[_0xd3de('0x13a')](_0x3e7792,_0x47fd7b[_0xd3de('0x1f')]);Promise[_0xd3de('0xa9')]()[_0xd3de('0x3b')](function(){if(_0x3e7792['statusMessage']===utils['CAMPAIGN_STATUS'][_0xd3de('0x79')]){if(_0x28691e){clearPredictiveAttributes(_0x3e7792);_0x343331[_0xd3de('0x23')]=undefined;_0x343331[_0xd3de('0x24')]=undefined;}if(_0x3e7792[_0xd3de('0x13b')]===utils[_0xd3de('0x69')][_0xd3de('0x79')]){_0x343331['available']=0x0;_0x343331[_0xd3de('0xf8')]=0x0;_0x343331[_0xd3de('0x13c')]=0x0;_0x343331[_0xd3de('0x13d')]=0x0;_0x343331['pTalking']=0x0;}}else if(_0x3e7792['statusMessage']===utils[_0xd3de('0x69')]['ACTIVE']&&!_0x342bfc){return _0x47fd7b[_0xd3de('0x8d')](_0x3e7792,!![])[_0xd3de('0x3b')](function(){return _0x47fd7b[_0xd3de('0x8d')](_0x3e7792,![]);})[_0xd3de('0x3b')](function(){return _0x47fd7b[_0xd3de('0xae')](_0x3e7792);})[_0xd3de('0x9d')](function(_0x2bb559){loggerSyncQueueSummary[_0xd3de('0x40')](_0xd3de('0x13e'),util[_0xd3de('0x42')](_0x2bb559,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3e7792);});}else{clearPredictiveAttributes(_0x3e7792);}})[_0xd3de('0x3b')](function(){var _0x2f5b1f=_0x343331[_0xd3de('0x13f')](_0x3e7792);if(_0x2f5b1f||_0x3e7792[_0xd3de('0x140')]){_0x3e7792[_0xd3de('0x140')]=![];_0x343331[_0xd3de('0x141')](_0x3e7792);Object[_0xd3de('0x142')](_0x3e7792,_0x343331);emitOutboundVoiceQueueSummary(_0x343331);}_0x47fd7b[_0xd3de('0x26')][_0x3e7792[_0xd3de('0x45')]][_0xd3de('0x139')]=![];})[_0xd3de('0x9d')](function(_0x527c5f){logger['error'](_0xd3de('0x13e'),util[_0xd3de('0x42')](_0x527c5f,{'showHidden':![],'depth':null}));_0x47fd7b[_0xd3de('0x26')][_0x3e7792[_0xd3de('0x45')]][_0xd3de('0x139')]=![];});};Dialer[_0xd3de('0x80')][_0xd3de('0x31')]=_[_0xd3de('0x143')](function(){var _0x460793=_[_0xd3de('0x144')](this[_0xd3de('0x1c')],function(_0x195eb5){return _0x195eb5['dialPreviewRecallmeReminder'];});var _0x3bcc51=_[_0xd3de('0x144')](this[_0xd3de('0x1e')],function(_0x2e4c43){return _0x2e4c43[_0xd3de('0x145')]&&_0x2e4c43[_0xd3de('0x83')]==='reachable';});if(_0x460793[_0xd3de('0x96')]>0x0&&_0x3bcc51[_0xd3de('0x96')]>0x0){return Promise[_0xd3de('0xa9')]()['then'](cmHopper['handlePreviewRecallNotifications'](_[_0xd3de('0x146')](_0x460793,'id'),previewRecallmeReminderInterval,_[_0xd3de('0x146')](_0x3bcc51,'id')))[_0xd3de('0x3b')](function(_0x23d215){for(var _0x1ef83d=0x0;_0x1ef83d<_0x23d215[_0xd3de('0x96')];_0x1ef83d++){var _0x3d8973=_0x23d215[_0x1ef83d][_0xd3de('0x147')]['name'];if(_0x3d8973)io['to'](util[_0xd3de('0x43')](_0xd3de('0x148'),_0x3d8973))[_0xd3de('0x3d')](_0xd3de('0x149'),{'hopper':_0x23d215[_0x1ef83d]});}})['catch'](function(_0x1690f0){logger[_0xd3de('0x63')](_0xd3de('0x14a'),_0x1690f0);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xd3de('0x80')]['loopClearZombieChannels']=function(){var _0x256050=this;setInterval(function(){_0x256050[_0xd3de('0x14b')](_0x256050['uniqueId'],_0xd3de('0x14c'));_0x256050[_0xd3de('0x14b')](_0x256050[_0xd3de('0xf2')],_0xd3de('0x14d'));},0x32c8);};Dialer[_0xd3de('0x80')][_0xd3de('0x14b')]=function(_0x2682e7,_0x20d1c5){var _0x2d1c7a=this;for(var _0x58fd0a in _0x2682e7){if(typeof _0x2682e7[_0x58fd0a]!==_0xd3de('0xa8')){this[_0xd3de('0x14e')][_0xd3de('0x14f')](function(){if(!_[_0xd3de('0xf7')](_0x2682e7[_0x58fd0a])){return ami[_0xd3de('0x9e')]({'action':_0xd3de('0x83'),'channel':_0x2682e7[_0x58fd0a][_0xd3de('0xf3')]})[_0xd3de('0x9d')](function(_0x5979ab){if(_0x5979ab[_0xd3de('0x68')]===_0xd3de('0x150')){setTimeout(function(){if(_0x2682e7[_0x58fd0a]&&_0x2682e7[_0x58fd0a][_0xd3de('0x3e')]!=='ivr'){_0x2d1c7a[_0xd3de('0xbf')](_0x2d1c7a[_0xd3de('0x1c')][_0x2682e7[_0x58fd0a][_0xd3de('0xbc')]]);logger[_0xd3de('0x63')](_0xd3de('0x151'),_0x20d1c5,_0x58fd0a,_0x2682e7[_0x58fd0a][_0xd3de('0xbc')]);delete _0x2682e7[_0x58fd0a];}if(_0x2682e7[_0x58fd0a]&&_0x2682e7[_0x58fd0a]['type']===_0xd3de('0xc9')){_0x2d1c7a[_0xd3de('0xbf')](_0x2d1c7a[_0xd3de('0x1d')][_0x2682e7[_0x58fd0a][_0xd3de('0xbc')]]);logger['error'](_0xd3de('0x152'),_0x20d1c5,_0x58fd0a,_0x2682e7[_0x58fd0a]['queue']);delete _0x2682e7[_0x58fd0a];}},0x2328);}});}});}}};Dialer[_0xd3de('0x80')][_0xd3de('0x153')]=function(_0x37a11f){return Promise['resolve']()[_0xd3de('0x3b')](voiceQueueRt['getVoiceQueueRtPauses'](_0x37a11f))['catch'](loggerCatch(_0xd3de('0x154')));};Dialer[_0xd3de('0x80')][_0xd3de('0xbf')]=function(_0x16d5ad){if(!_[_0xd3de('0x3c')](_0x16d5ad)&&_0x16d5ad!==null){if(typeof _0x16d5ad['originated']!==_0xd3de('0xa8')){if(_0x16d5ad[_0xd3de('0x155')]>0x0){_0x16d5ad[_0xd3de('0x155')]-=0x1;}else{logger[_0xd3de('0x63')](_0xd3de('0x156'));}}}else{logger[_0xd3de('0x63')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer['prototype']['loggerHandler']=function(_0x535a5a,_0x3b6096){var _0x435821=this;return function(_0x470a30){_0x435821[_0xd3de('0xbf')](_0x3b6096);logger['error'](_0x535a5a,util[_0xd3de('0x42')](_0x470a30,{'showHidden':![],'depth':null}));};};Dialer[_0xd3de('0x80')][_0xd3de('0x157')]=function(_0x11956a,_0x4bc21e,_0x5828d9){var _0x46bfb8={'state':0x19,'statedesc':_0xd3de('0x158')};this[_0xd3de('0xbf')](_0x4bc21e);this['saveInDb'](_['merge'](_0x46bfb8,_[_0xd3de('0x73')](_0x5828d9,[_0xd3de('0xdf'),'ListId',_0xd3de('0x159'),'VoiceQueueId',_0xd3de('0xe2')])),_0xd3de('0x15a'),_0xd3de('0x15b'));logger[_0xd3de('0x63')](_0x11956a);};Dialer[_0xd3de('0x80')]['saveInDb']=function(_0x17f43c,_0x9464f4,_0x2067ff){hopperUtils[_0xd3de('0xc6')](_0x17f43c)[_0xd3de('0x9d')](loggerCatch(_0x9464f4));hopperUtils[_0xd3de('0x135')](_0x17f43c)[_0xd3de('0x9d')](loggerCatch(_0x2067ff));};Dialer[_0xd3de('0x80')]['queueCallerAbandonCreateState']=function(_0x760673,_0x2c2a6d){hopperUtils['createHistory'](_0x760673)['catch'](loggerCatch(_0xd3de('0xc7')));if(_0x2c2a6d==0x0){hopperUtils[_0xd3de('0x135')](_0x760673)['catch'](loggerCatch(_0xd3de('0x15c')));}};Dialer['prototype']['checkPreviewRecallReminder']=function(_0x5a2ad5){return Promise['resolve']()[_0xd3de('0x3b')](cmHopper[_0xd3de('0x15d')](_0x5a2ad5['id'],previewRecallmeReminderInterval))['then'](function(_0x3760b7){for(var _0x35a957=0x0;_0x35a957<_0x3760b7[_0xd3de('0x96')];_0x35a957++){var _0x48bd4a=_0x3760b7[_0x35a957]['Agent'][_0xd3de('0x45')];if(_0x48bd4a)io['to'](util[_0xd3de('0x43')](_0xd3de('0x148'),_0x48bd4a))['emit'](_0xd3de('0x149'),{'hopper':_0x3760b7[_0x35a957]});}})[_0xd3de('0x9d')](function(){});};Dialer[_0xd3de('0x80')][_0xd3de('0xac')]=function(_0x52585c){var _0x320d47=this;return function(){_0x320d47[_0xd3de('0x15e')](_0x52585c);};};Dialer[_0xd3de('0x80')][_0xd3de('0x15f')]=function(_0xcc79fa,_0x20157e){var _0x39c976=this;var _0x246fe6=uuid['v4']();this['actions'][_0x246fe6]=new Action(_0xcc79fa,_0x20157e,_0x246fe6);return new Promise(function(_0x4447c1,_0x413e79){if(_[_0xd3de('0x3c')](_0xcc79fa)&&typeof _0xcc79fa!=='object'){return _0x413e79(msgResponse(_0xd3de('0x160'),_0xd3de('0x90'),_0xd3de('0x161')));}if(_[_0xd3de('0x3c')](_0x20157e[_0xd3de('0x162')])||_0x20157e[_0xd3de('0x162')]===null){return _0x413e79(msgResponse(_0xd3de('0x160'),_0xd3de('0x90'),_0xd3de('0x163')));}var _0x409212={'XMD-CALLERID':_0x39c976['actions'][_0x246fe6]['getCaller'](),'XMD-AGI':_0xcc79fa[_0xd3de('0x164')]?util[_0xd3de('0x43')](_0xd3de('0x165'),ipAgi,_0xcc79fa[_0xd3de('0x164')]):_0xd3de('0x166'),'XMD-AGIAFTER':_0xcc79fa[_0xd3de('0xc4')]?util[_0xd3de('0x43')]('\x22agi://%s/square,%s\x22',ipAgi,_0xcc79fa[_0xd3de('0xc4')]):'NONE','XMD-QUEUE':utils[_0xd3de('0x167')](_0xcc79fa)?util[_0xd3de('0x43')](_0xd3de('0x168'),_0xcc79fa[_0xd3de('0x45')],_0xcc79fa[_0xd3de('0x169')]||'',_0xcc79fa['dialAgiAfterHangupAgent']?'c':'',_0xcc79fa['dialQueueTimeout']||0x3):_0xd3de('0x166'),'XMD-CONTACTID':_0x20157e[_0xd3de('0xdf')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x39c976[_0xd3de('0xf2')][_0x246fe6]['getCaller'](),'XMD-AMD':_0xcc79fa[_0xd3de('0x127')]?'ACTIVE':'NONE','XMD-DESTINATION':_0xd3de('0x10f')};if(_0xcc79fa[_0xd3de('0x127')]){_0x409212['XMD-AMDINITIALSILENCE']=_0xcc79fa['dialAMDInitialSilence']||0x9c4;_0x409212[_0xd3de('0x16a')]=_0xcc79fa[_0xd3de('0x16b')]||0x5dc;_0x409212[_0xd3de('0x16c')]=_0xcc79fa[_0xd3de('0x16d')]||0x320;_0x409212[_0xd3de('0x16e')]=_0xcc79fa[_0xd3de('0x16f')]||0x1388;_0x409212[_0xd3de('0x170')]=_0xcc79fa['dialAMDMinWordLength']||0x64;_0x409212[_0xd3de('0x171')]=_0xcc79fa[_0xd3de('0x172')]||0x32;_0x409212[_0xd3de('0x173')]=_0xcc79fa['dialAMDMaximumNumberOfWords']||0x3;_0x409212[_0xd3de('0x174')]=_0xcc79fa[_0xd3de('0x175')]||0x100;_0x409212[_0xd3de('0x176')]=_0xcc79fa['dialAMDMaximumWordLength']||0x1388;}if(utils[_0xd3de('0x167')](_0xcc79fa)){_0x409212[_0xd3de('0x177')]=_0x20157e['VoiceQueueId'];}else{_0x409212[_0xd3de('0x178')]=_0x20157e[_0xd3de('0xe2')];}var _0x1ae2fc=utils[_0xd3de('0x179')](_0x20157e['Contact']);Object[_0xd3de('0x142')](_0x409212,_0x1ae2fc);var _0x5292b8=_0x39c976['isTrunkReachable'](_0xcc79fa[_0xd3de('0x88')])?utils[_0xd3de('0x17a')](_0xcc79fa['Trunk'][_0xd3de('0x17b')],_0xcc79fa[_0xd3de('0x17c')],_0xcc79fa[_0xd3de('0x17d')]>0x0?utils['getCallerIdRandom'](_0xcc79fa[_0xd3de('0x17e')],_0xcc79fa[_0xd3de('0x17d')]):_0xcc79fa[_0xd3de('0x17e')]):utils[_0xd3de('0x17a')](_['isNil'](_0xcc79fa[_0xd3de('0x17f')])?_0xcc79fa[_0xd3de('0x88')]['callerid']:_0xcc79fa[_0xd3de('0x17f')][_0xd3de('0x17b')],_0xcc79fa[_0xd3de('0x17c')],_0xcc79fa['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0xd3de('0x180')](_0xcc79fa[_0xd3de('0x17e')],_0xcc79fa[_0xd3de('0x17d')]):_0xcc79fa[_0xd3de('0x17e')]);if(_0x5292b8){_0x409212[_0xd3de('0x181')]=_0x39c976[_0xd3de('0xf2')][_0x246fe6][_0xd3de('0x182')]=utils[_0xd3de('0x183')](_0x5292b8);_0x409212[_0xd3de('0x184')]=_0x20157e[_0xd3de('0x162')];}_0xcc79fa[_0xd3de('0x185')]=_0x409212;return ami[_0xd3de('0x9e')]({'actionid':_0x246fe6,'action':_0xd3de('0x160'),'channel':_0x39c976[_0xd3de('0x81')](_0xcc79fa[_0xd3de('0x88')])?util[_0xd3de('0x43')]('SIP/%s/%s%s',_0xcc79fa['Trunk'][_0xd3de('0x45')],isNotNull(_0xcc79fa['dialPrefix'])?_0xcc79fa[_0xd3de('0x186')][_0xd3de('0x187')]()||'':'',_0xcc79fa[_0xd3de('0x188')]>0x0?_0x20157e['phone'][_0xd3de('0x189')](_0xcc79fa[_0xd3de('0x188')]):_0x20157e[_0xd3de('0x162')]):util[_0xd3de('0x43')](_0xd3de('0x18a'),_[_0xd3de('0xf7')](_0xcc79fa[_0xd3de('0x17f')])?_0xcc79fa[_0xd3de('0x88')][_0xd3de('0x45')]:_0xcc79fa[_0xd3de('0x17f')]['name'],isNotNull(_0xcc79fa[_0xd3de('0x186')])?_0xcc79fa[_0xd3de('0x186')][_0xd3de('0x187')]()||'':'',_0xcc79fa[_0xd3de('0x188')]>0x0?_0x20157e['phone']['substring'](_0xcc79fa['dialCutDigit']):_0x20157e['phone']),'callerid':_0x5292b8,'Exten':_0xd3de('0x10f'),'Context':_0xd3de('0x18b'),'Priority':'1','variable':_0x409212,'timeout':(_0xcc79fa[_0xd3de('0x18c')]||0x1e)*0x3e8,'async':!![],'channelid':_0x246fe6})[_0xd3de('0x3b')](function(_0x3b4697){return _0x4447c1(_0x3b4697);})[_0xd3de('0x9d')](function(_0x4bb409){_0xcc79fa[_0xd3de('0x18d')]+=0x1;var _0x3a216d=new History(_0x39c976['actions'][_0x246fe6]);logger[_0xd3de('0x63')](util['format'](_0xd3de('0x18e'),JSON[_0xd3de('0x72')](_0x4bb409)));_0x3a216d[_0xd3de('0xd7')]=0xe;_0x3a216d['statedesc']=_0xd3de('0x18f');_0x3a216d['starttime']=moment()['format'](_0xd3de('0xc0'));_0x3a216d[_0xd3de('0x6d')]=_0x3a216d[_0xd3de('0x6e')];hopperUtils['createHistory'](_0x3a216d)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x190')));_0x39c976[_0xd3de('0x135')](_0x3a216d)[_0xd3de('0x9d')](loggerCatch('[originate][error]'))[_0xd3de('0x1a')](function(){delete _0x39c976[_0xd3de('0xf2')][_0x246fe6];return _0x413e79(msgResponse(_0xd3de('0x160'),'Error','originate\x20action\x20Error'));});});});};Dialer[_0xd3de('0x80')]['checkRetriveMax']=function(_0x46366b,_0x3ef715,_0x2954e1){var _0x2df1ea=new History(_0x3ef715);if(_0x2df1ea[_0xd3de('0x11d')]+_0x2df1ea['countcongestionretry']+_0x2df1ea[_0xd3de('0x11f')]+_0x2df1ea[_0xd3de('0x120')]+_0x2df1ea[_0xd3de('0xd8')]+_0x2df1ea[_0xd3de('0xeb')]+_0x2df1ea[_0xd3de('0x11b')]+_0x2df1ea[_0xd3de('0x12d')]>=_0x2954e1[_0xd3de('0x121')]-0x1){return!![];}switch(_0x46366b){case 0x3:if(_0x2df1ea[_0xd3de('0x11f')]>=_0x2954e1[_0xd3de('0x191')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countnoanswerretry':_0x2df1ea[_0xd3de('0x11f')]+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1[_0xd3de('0x192')],'minutes')[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea['ContactId'],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x193')));break;case 0x5:if(_0x2df1ea[_0xd3de('0x11d')]>=_0x2954e1[_0xd3de('0x194')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countbusyretry':_0x2df1ea[_0xd3de('0x11d')]+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1['dialBusyRetryFrequency'],'minutes')[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea[_0xd3de('0xdf')],'ListId':_0x2df1ea['ListId'],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x2df1ea[_0xd3de('0x11e')]>=_0x2954e1[_0xd3de('0x195')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countcongestionretry':_0x2df1ea['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x2954e1[_0xd3de('0x196')],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea[_0xd3de('0xdf')],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x197')));break;case 0x0:if(_0x2df1ea[_0xd3de('0x120')]>=_0x2954e1[_0xd3de('0x198')]-0x1){return!![];}else{hopperUtils[_0xd3de('0xdc')]({'active':![],'countnosuchnumberretry':_0x2df1ea[_0xd3de('0x120')]+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1['dialNoSuchNumberRetryFrequency'],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea['ContactId'],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea['VoiceQueueId']||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x199')));}break;case 0xa:if(_0x2df1ea['countdropretry']>=_0x2954e1[_0xd3de('0xd9')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countdropretry':_0x2df1ea[_0xd3de('0xd8')]+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1[_0xd3de('0xd4')],'minutes')[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea[_0xd3de('0xdf')],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x2df1ea['countabandonedretry']>=_0x2954e1[_0xd3de('0xec')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countabandonedretry':_0x2df1ea[_0xd3de('0xeb')]+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1[_0xd3de('0xed')],_0xd3de('0xde'))[_0xd3de('0x43')](_0xd3de('0xc0')),'ContactId':_0x2df1ea['ContactId'],'ListId':_0x2df1ea['ListId'],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0xee')));break;case 0x13:if(_0x2df1ea[_0xd3de('0x11b')]>=_0x2954e1[_0xd3de('0x123')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2df1ea['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x2954e1['dialMachineRetryFrequency'],_0xd3de('0xde'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2df1ea['ContactId'],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x126')));break;case 0x14:if(_0x2df1ea['countagentrejectretry']>=_0x2954e1[_0xd3de('0x19a')]-0x1){return!![];}hopperUtils[_0xd3de('0xdc')]({'active':![],'countagentrejectretry':_0x2df1ea['countagentrejectretry']+=0x1,'scheduledat':moment()[_0xd3de('0xdd')](_0x2954e1['dialAgentRejectRetryFrequency'],_0xd3de('0xde'))['format'](_0xd3de('0xc0')),'ContactId':_0x2df1ea[_0xd3de('0xdf')],'ListId':_0x2df1ea[_0xd3de('0xe0')],'VoiceQueueId':_0x2df1ea[_0xd3de('0xe1')]||undefined,'CampaignId':_0x2df1ea[_0xd3de('0xe2')]||undefined})['catch'](loggerCatch(_0xd3de('0x19b')));break;default:return!![];}};Dialer[_0xd3de('0x80')]['callProgressDetecting']=function(_0x2cd9d1,_0x5a0990,_0x173add){var _0x75793a=this;var _0x2a5681=new History(_0x2cd9d1);var _0x48fec5=![];var _0x28522b;var _0x2e6a59;return new Promise(function(_0x203582,_0x4f7626){if(_[_0xd3de('0x3c')](_0x5a0990)&&typeof _0x5a0990!==_0xd3de('0x19c')){return _0x4f7626(msgResponse(_0xd3de('0x19d'),_0xd3de('0x90'),'entity\x20is\x20undefine'));}if(_['isUndefined'](_0x173add)&&typeof _0x173add!==_0xd3de('0x19c')){return _0x4f7626(msgResponse(_0xd3de('0x19d'),'Failure','evt\x20is\x20undefine'));}hopperUtils[_0xd3de('0xd6')](_0x2a5681,_0x173add[_0xd3de('0xc2')],_0x5a0990)[_0xd3de('0x3b')](function(_0x28884a){if(_0x28884a['additional']==0x1)_0x48fec5=!![];switch(_0x173add[_0xd3de('0xc2')]){case'0':_0x5a0990[_0xd3de('0x19e')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0x0;_0x2a5681['statedesc']=_0xd3de('0x19f');_0x2a5681[_0xd3de('0x120')]+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;ami[_0xd3de('0x3d')](_0xd3de('0x1a0'),ut['buildObj'](_0x2cd9d1,'nosuchnumber'));_0x28522b=_0x5a0990[_0xd3de('0x1a1')];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];hopperUtils[_0xd3de('0xc6')](_0x2a5681)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x12c')));if(_0x75793a[_0xd3de('0x1a2')](0x0,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681['countnosuchnumberretry']>=_0x5a0990[_0xd3de('0x198')]){_0x75793a['createStateFinal'](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1a3'));}else{_0x75793a[_0xd3de('0x122')](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1a3'));}}break;case'3':_0x5a0990[_0xd3de('0x1a4')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0x3;_0x2a5681[_0xd3de('0x6c')]='NoAnswer';_0x2a5681['countnoanswerretry']+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;var _0x379a78=ut[_0xd3de('0x1a5')](_0x2cd9d1,_0x5a0990);ami['emit']('custom:agentnoanswer',_0x379a78);_0x28522b=_0x5a0990[_0xd3de('0x192')];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];hopperUtils[_0xd3de('0xc6')](_0x2a5681)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x1a6')));if(_0x75793a[_0xd3de('0x1a2')](0x3,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681['countnoanswerretry']>=_0x5a0990[_0xd3de('0x191')]){_0x75793a[_0xd3de('0x124')](_0x2a5681,_0x203582,_0x4f7626,'reason\x203\x20ringing\x20no\x20answer');}else{_0x75793a[_0xd3de('0x122')](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1a7'));}}break;case'5':_0x5a0990[_0xd3de('0x1a8')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0x5;_0x2a5681[_0xd3de('0x6c')]=_0xd3de('0x1a9');_0x2a5681['countbusyretry']+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;ami['emit'](_0xd3de('0x1aa'),ut['buildObj'](_0x2cd9d1,_0xd3de('0x1ab')));_0x28522b=_0x5a0990['dialBusyRetryFrequency'];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];hopperUtils[_0xd3de('0xc6')](_0x2a5681)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x1ac')));if(_0x75793a['checkRetriveMax'](0x5,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681[_0xd3de('0x11d')]>=_0x5a0990[_0xd3de('0x194')]){_0x75793a[_0xd3de('0x124')](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1ad'));}else{_0x75793a['stateGlobal'](_0x2a5681,_0x203582,_0x4f7626,'reason\x205\x20busy');}}break;case'8':_0x5a0990[_0xd3de('0x1ae')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0x8;_0x2a5681['statedesc']='Congestion';_0x2a5681[_0xd3de('0x11e')]+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;_0x28522b=_0x5a0990[_0xd3de('0x196')];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];ami['emit'](_0xd3de('0x1af'),ut[_0xd3de('0x112')](_0x2cd9d1,_0xd3de('0x1b0')));hopperUtils[_0xd3de('0xc6')](_0x2a5681)['catch'](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x75793a[_0xd3de('0x1a2')](0x8,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681['countcongestionretry']>=_0x5a0990[_0xd3de('0x195')]){_0x75793a[_0xd3de('0x124')](_0x2a5681,_0x203582,_0x4f7626,'reason\x208\x20congestion');}else{_0x75793a[_0xd3de('0x122')](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1b1'));}}break;case'11':_0x5a0990[_0xd3de('0x1b2')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0xb;_0x2a5681[_0xd3de('0x6c')]='Abandoned';_0x2a5681['countabandonedretry']+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;_0x28522b=_0x5a0990[_0xd3de('0xed')];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];hopperUtils[_0xd3de('0xc6')](_0x2a5681)[_0xd3de('0x9d')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x75793a[_0xd3de('0x1a2')](0xb,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681[_0xd3de('0xeb')]>=_0x5a0990[_0xd3de('0xec')]){_0x75793a['createStateFinal'](_0x2a5681,_0x203582,_0x4f7626,'reason\x2011\x20abandoned');}else{_0x75793a['stateGlobal'](_0x2a5681,_0x203582,_0x4f7626,'reason\x2011\x20abandoned');}}break;case'20':_0x5a0990[_0xd3de('0x1b3')]+=0x1;_0x2a5681[_0xd3de('0xd7')]=0x14;_0x2a5681['statedesc']=_0xd3de('0x1b4');_0x2a5681[_0xd3de('0x12d')]+=0x1;_0x2a5681[_0xd3de('0xd3')]+=0x1;_0x28522b=_0x5a0990['dialAgentRejectRetryFrequency'];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];ami[_0xd3de('0x3d')](_0xd3de('0x1b5'),ut[_0xd3de('0x112')](_0x2cd9d1,_0xd3de('0x1b6')));hopperUtils['createHistory'](_0x2a5681)[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x1b7')));if(_0x75793a[_0xd3de('0x1a2')](0x14,_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681[_0xd3de('0x12d')]>=_0x5a0990[_0xd3de('0x19a')]){_0x75793a[_0xd3de('0x124')](_0x2a5681,_0x203582,_0x4f7626,'reason\x2020\x20agentreject');}else{_0x75793a[_0xd3de('0x122')](_0x2a5681,_0x203582,_0x4f7626,_0xd3de('0x1b8'));}}break;default:_0x5a0990['outboundUnknownCallsDay']+=0x1;_0x2a5681[_0xd3de('0xd7')]=0xc;_0x2a5681[_0xd3de('0x6c')]=_0x173add[_0xd3de('0xc2')];_0x28522b=_0x5a0990[_0xd3de('0x1b9')];_0x2e6a59=_0x5a0990[_0xd3de('0xd5')];hopperUtils['createHistory'](_0x2a5681)['catch'](loggerCatch(_0xd3de('0x1ba')));if(_0x75793a['checkRetriveMax'](_0x173add[_0xd3de('0xc2')],_0x2cd9d1,_0x5a0990)&&!_0x48fec5){if(_0x2a5681[_0xd3de('0x11d')]+_0x2a5681[_0xd3de('0x11e')]+_0x2a5681[_0xd3de('0x11f')]+_0x2a5681['countnosuchnumberretry']+_0x2a5681[_0xd3de('0xd8')]+_0x2a5681[_0xd3de('0xeb')]+_0x2a5681['countmachineretry']+_0x2a5681[_0xd3de('0x12d')]>=_0x5a0990[_0xd3de('0x121')]){_0x75793a[_0xd3de('0x122')](_0x2a5681,_0x203582,_0x4f7626,_0x173add[_0xd3de('0xc2')]);}else{_0x75793a['createStateFinal'](_0x2a5681,_0x203582,_0x4f7626,_0x173add['reason']);}}}})['then'](function(){if(_0x48fec5){hopperUtils[_0xd3de('0xe7')](_0x2a5681,_0x28522b,_0x2e6a59)['then'](function(){return _0x203582(0x1);});}});});};Dialer[_0xd3de('0x80')][_0xd3de('0x122')]=function(_0x78d8fb,_0x2e4ba3,_0x293ce3,_0x2c0ccd){var _0x395488=new Final(_0x78d8fb);_0x395488[_0xd3de('0xd7')]=0xf;_0x395488[_0xd3de('0x6c')]=_0xd3de('0x1bb');this[_0xd3de('0x124')](_0x395488,_0x2e4ba3,_0x293ce3,_0x2c0ccd);};Dialer[_0xd3de('0x80')][_0xd3de('0x124')]=function(_0x4d3b73,_0x3b10f5,_0x516255,_0x126c19){hopperUtils[_0xd3de('0x135')](_0x4d3b73)[_0xd3de('0x3b')](function(){return _0x3b10f5(msgResponse(_0xd3de('0x19d'),_0xd3de('0x10a'),_0x126c19));})['catch'](function(){return _0x516255(msgResponse(_0xd3de('0x1bc'),_0xd3de('0x90'),'contact\x20not\x20moved'));});};Dialer[_0xd3de('0x80')][_0xd3de('0xb0')]=function(_0xd04837){var _0x11746d=_0xd04837['dialPredictiveOptimizationPercentage']/0x64;var _0x3b60f7=_0xd04837[_0xd3de('0xcd')]/(_0xd04837['outboundDropCallsDayTimeout']+_0xd04837[_0xd3de('0xc1')]);var _0x390217=Math[_0xd3de('0x1bd')](_0xd04837[_0xd3de('0x1be')]*(_0xd04837[_0xd3de('0x1bf')]/0x64));var _0x2e1c69=Math[_0xd3de('0x1bd')](_0xd04837['predictiveIntervalAvailable']*(_0xd04837[_0xd3de('0x1c0')]/0x64));var _0x2540a4=_0xd04837[_0xd3de('0x1c1')]+_0xd04837[_0xd3de('0x13d')];var _0x153cc6=Math[_0xd3de('0x1c2')](_0xd04837['erlangCalls']*_0xd04837[_0xd3de('0x5f')]*_0xd04837['predictiveIntervalHitRate']*_0xd04837[_0xd3de('0x1c3')]);if(_['isUndefined'](_0xd04837[_0xd3de('0x24')])){if(!_['isUndefined'](_0xd04837[_0xd3de('0x23')])){_0xd04837['startPredictive']=undefined;loggerPredictive[_0xd3de('0x63')]('[startMethodPredictive][StartProgressive]',_0xd3de('0x1c4'));}if(!_[_0xd3de('0x3c')](_0xd04837[_0xd3de('0x62')])){loggerPredictive[_0xd3de('0x63')]('[startMethodPredictive][StartProgressive]',_0xd3de('0x1c5'));clearInterval(_0xd04837['handlePredictive']);_0xd04837['handlePredictive']=undefined;}_0xd04837[_0xd3de('0x24')]=moment()[_0xd3de('0x43')](_0xd3de('0xc0'));loggerPredictive[_0xd3de('0x49')](_0xd04837['name'],_0xd3de('0x1c6'),_0xd04837[_0xd3de('0x24')]);this['handlePower'](_0xd04837,0x1);}else if(ifInterval(_0xd04837[_0xd3de('0x1c7')],_0xd04837[_0xd3de('0x24')])){this[_0xd3de('0xb2')](_0xd04837,0x1);loggerPredictiveCalls[_0xd3de('0x49')](_0xd3de('0x1c8'),_0xd04837[_0xd3de('0x24')],_0xd04837[_0xd3de('0x45')]);_0xd04837['erlangCalls']=0x0;_0xd04837['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x11746d<_0x3b60f7&&_0xd04837[_0xd3de('0x1c9')]===_0xd3de('0x1ca')){clearPredictiveAttributes(_0xd04837);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x1cb'),_0xd3de('0x1cc'),_0x3b60f7,_0xd3de('0x24'),_0xd04837[_0xd3de('0x45')]);}else if(_0x153cc6<_0xd04837[_0xd3de('0xce')]&&_0xd04837[_0xd3de('0x1c9')]===_0xd3de('0x1ca')){clearPredictiveAttributes(_0xd04837);loggerPredictive['info'](_0xd3de('0x1cd'),_0xd3de('0x1ce'),_0x153cc6,'Drop\x20in\x20this\x20interval',_0xd04837[_0xd3de('0xce')],_0xd3de('0x24'),_0xd04837['name']);}else if(!ifInterval(_0xd04837[_0xd3de('0x1c7')],_0xd04837['startProgressive'])&&_['isUndefined'](_0xd04837['startPredictive'])&&!_[_0xd3de('0x3c')](_0xd04837[_0xd3de('0x24')])){_0xd04837['startPredictive']=moment()[_0xd3de('0x43')](_0xd3de('0xc0'));loggerPredictive[_0xd3de('0x49')](_0xd04837[_0xd3de('0x45')],_0xd3de('0x1cf'),_0xd04837['startPredictive']);hopperUtils[_0xd3de('0x1d0')](_0xd04837[_0xd3de('0x1c7')])[_0xd3de('0x3b')](this[_0xd3de('0x1d1')](_0xd04837))['then'](mergeDataErlangB(_0xd04837))[_0xd3de('0x3b')](this[_0xd3de('0x1d2')](_0xd04837))['catch'](loggerCatchPredictive(_0xd3de('0x1d3'),_0xd04837));}else if(!ifInterval(_0xd04837[_0xd3de('0x1c7')],_0xd04837['startPredictive'])){_0xd04837[_0xd3de('0xce')]=0x0;_0xd04837[_0xd3de('0x23')]=moment()['format'](_0xd3de('0xc0'));loggerPredictive[_0xd3de('0x49')](_0xd04837[_0xd3de('0x45')],_0xd3de('0x1d4'),_0xd04837[_0xd3de('0x23')]);clearInterval(_0xd04837[_0xd3de('0x62')]);_0xd04837[_0xd3de('0x62')]=undefined;hopperUtils[_0xd3de('0x1d0')](_0xd04837[_0xd3de('0x1c7')])['then'](this[_0xd3de('0x1d1')](_0xd04837))[_0xd3de('0x3b')](mergeDataErlangB(_0xd04837))[_0xd3de('0x3b')](this[_0xd3de('0x1d2')](_0xd04837))['catch'](loggerCatchPredictive(_0xd3de('0x1d5'),_0xd04837));}else if(_0xd04837['predictiveIntervalAvailable']&&_0x2540a4<_0xd04837[_0xd3de('0x1be')]-_0x2e1c69){clearPredictiveAttributes(_0xd04837);loggerPredictive[_0xd3de('0x49')](_0xd04837['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x2540a4,_0xd3de('0x1d6'),_0xd04837[_0xd3de('0x1be')],'-',_0x2e1c69,'=',_0xd04837['predictiveIntervalAvailable']-_0x2e1c69,')');}else if(_0xd04837['predictiveIntervalAvailable']&&_0x2540a4>_0xd04837['predictiveIntervalAvailable']+_0x390217){clearPredictiveAttributes(_0xd04837);loggerPredictive[_0xd3de('0x49')](_0xd04837[_0xd3de('0x45')],_0xd3de('0x1d7'),_0x2540a4,_0xd3de('0x1d8'),_0xd04837['predictiveIntervalAvailable'],'+',_0x390217,'=',_0xd04837[_0xd3de('0x1be')]+_0x390217,')');}};Dialer[_0xd3de('0x80')][_0xd3de('0x1d1')]=function(_0x4b3a19){var _0x33d6f0=this;return function(_0x4d5bfa){return new Promise(function(_0x3364cf,_0x1b8d5d){_['merge'](_0x4b3a19,_0x4d5bfa[0x0]);if(checkGetDataPredictive(_0x4d5bfa[0x0])){var _0x464568=_0x4b3a19['predictiveIntervalAvailable']=_0x4b3a19[_0xd3de('0x13d')]+_0x4b3a19[_0xd3de('0x1c1')];var _0xe0ae4f=_0x4b3a19['dialPredictiveInterval']*0x3c;var _0x522e7e=_0x4d5bfa[0x0][_0xd3de('0x52')]+_0x4d5bfa[0x0][_0xd3de('0x50')];var _0xdca17c=(_0x4d5bfa[0x0]['predictiveIntervalAnsweredCalls']+_0x4d5bfa[0x0][_0xd3de('0x4d')]+_0x4d5bfa[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x4d5bfa[0x0]['predictiveIntervalTotalCalls'];_0x4b3a19['predictiveIntervalHitRate']=_0xdca17c>0x0?_0xdca17c:0x1;switch(_0x4b3a19[_0xd3de('0x1c9')]){case _0xd3de('0x1ca'):var _0x36d034=_0x4b3a19['dialPredictiveOptimizationPercentage']/0x64;return _0x33d6f0[_0xd3de('0x1d9')](_0x464568,_0xe0ae4f,_0x522e7e,_0xdca17c,_0x36d034)[_0xd3de('0x3b')](function(_0x5e902a){return _0x3364cf(_0x5e902a);});case _0xd3de('0x1da'):var _0x5029bf=_0x4b3a19[_0xd3de('0x1db')]/0x64;return _0x33d6f0['busyFactor'](_0x464568,_0xe0ae4f,_0x522e7e,_0xdca17c,_0x5029bf)[_0xd3de('0x3b')](function(_0x5adee1){return _0x3364cf(_0x5adee1);});default:return _0x1b8d5d(msgResponse(_0xd3de('0x1dc'),_0xd3de('0x90'),_0xd3de('0x1dd')));}}else{return _0x1b8d5d(msgResponse('[getDataPredictive]','Failure',_0xd3de('0x1de')));}});};};Dialer[_0xd3de('0x80')][_0xd3de('0x1df')]=function(_0x1477a5){var _0x1deff5=this;return function(_0x1ce759){return new Promise(function(_0xb0aff4,_0x4bc1db){_['merge'](_0x1477a5,_0x1ce759[0x0]);if(checkGetDataPredictive(_0x1ce759[0x0])){loggerPredictive['info'](JSON[_0xd3de('0x72')](_0x1ce759[0x0]));if(_0x1477a5[_0xd3de('0x1c9')]==='dropRate'){return _0x1deff5['getVoiceQueueRtPauses'](_0x1477a5['id'])[_0xd3de('0x3b')](function(_0x222b13){var _0x4ac3dc=_0x1477a5[_0xd3de('0x1e0')]-_0x222b13[0x0][_0xd3de('0x1e1')];var _0x2fd84e=_0x1477a5[_0xd3de('0x1c7')]*0x3c;var _0x5e17dd=_0x1ce759[0x0][_0xd3de('0x52')]+_0x1ce759[0x0][_0xd3de('0x50')];var _0x15ccb3=(_0x1ce759[0x0][_0xd3de('0x4c')]+_0x1ce759[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1ce759[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x1ce759[0x0]['predictiveIntervalTotalCalls'];var _0x353e21=_0x1477a5[_0xd3de('0x1db')]/0x64;_0x1477a5['predictiveIntervalPauses']=_0x222b13[0x0][_0xd3de('0x1e1')]||0x0;_0x1477a5[_0xd3de('0x1e2')]=_0x15ccb3>0x0?_0x15ccb3:0x1;return _0x1deff5[_0xd3de('0x1d9')](_0x4ac3dc,_0x2fd84e,_0x5e17dd,_0x15ccb3,_0x353e21);})[_0xd3de('0x3b')](function(_0x1dd627){return _0xb0aff4(_0x1dd627);})[_0xd3de('0x9d')](function(_0x59d4ba){return _0x4bc1db(msgResponse('[CatchErlangB]',_0xd3de('0x90'),JSON['stringify'](_0x59d4ba)));});}if(_0x1477a5[_0xd3de('0x1c9')]===_0xd3de('0x1da')){return _0x1deff5['getVoiceQueueRtPauses'](_0x1477a5['id'])[_0xd3de('0x3b')](function(_0x2f8c3a){var _0x3db188=_0x1477a5[_0xd3de('0x1e0')]-_0x2f8c3a[0x0]['outboundQueuePauses'];var _0x5927ab=_0x1477a5[_0xd3de('0x1c7')]*0x3c;var _0x596279=_0x1ce759[0x0]['predictiveIntervalAvgTalktime']+_0x1ce759[0x0][_0xd3de('0x50')];var _0xbd6074=(_0x1ce759[0x0][_0xd3de('0x4c')]+_0x1ce759[0x0][_0xd3de('0x4d')]+_0x1ce759[0x0][_0xd3de('0x4e')])/_0x1ce759[0x0][_0xd3de('0x54')];var _0xcf68c1=_0x1477a5['dialPredictiveOptimizationPercentage']/0x64;_0x1477a5[_0xd3de('0x1e3')]=_0x2f8c3a[0x0][_0xd3de('0x1e1')]||0x0;_0x1477a5[_0xd3de('0x1e2')]=_0xbd6074>0x0?_0xbd6074:0x1;return _0x1deff5[_0xd3de('0x1e4')](_0x3db188,_0x5927ab,_0x596279,_0xbd6074,_0xcf68c1);})[_0xd3de('0x3b')](function(_0x2916ec){return _0xb0aff4(_0x2916ec);})['catch'](function(_0x12afa7){return _0x4bc1db(msgResponse(_0xd3de('0x1e5'),'Failure',JSON['stringify'](_0x12afa7)));});}}else{return _0x4bc1db(msgResponse(_0xd3de('0x1dc'),_0xd3de('0x90'),_0xd3de('0x1de')));}});};};Dialer[_0xd3de('0x80')][_0xd3de('0x1d2')]=function(_0x2e6fb2){var _0x3de5eb=this;return function(){var _0x50b348=0x0;var _0x30465e=Math[_0xd3de('0x1c2')](_0x2e6fb2[_0xd3de('0x5b')]*0x3e8);if(_0x30465e>0x0){_0x30465e=_0x30465e<0x64?0x64:_0x30465e;loggerPredictive[_0xd3de('0x49')](_0x2e6fb2[_0xd3de('0x45')],_0xd3de('0x1e6'),_0x30465e,_0xd3de('0x1e7'));_0x2e6fb2['handlePredictive']=setInterval(function(){_0x3de5eb['handlePredictive'](_0x2e6fb2);loggerPredictiveCalls[_0xd3de('0x49')](_0xd3de('0x1e8'),_0x50b348+=0x1);},_0x30465e);}else{loggerPredictive[_0xd3de('0x49')](_0x2e6fb2[_0xd3de('0x45')],_0xd3de('0x1e9'));}};};Dialer[_0xd3de('0x80')][_0xd3de('0x1ea')]=function(_0x4f9ea9,_0x5c76e7){var _0x272f99=this;return function(_0x2649c7){if(_[_0xd3de('0x47')](_0x2649c7)){if(_[_0xd3de('0xf7')](_0x5c76e7[_0xd3de('0x159')])||!_0x5c76e7[_0xd3de('0x1eb')]){if(_0x4f9ea9[_0xd3de('0xaf')]===_0xd3de('0xb')){_0x4f9ea9[_0xd3de('0x6f')]=_[_0xd3de('0x3c')](_0x4f9ea9[_0xd3de('0x6f')])?!![]:_0x4f9ea9[_0xd3de('0x6f')];var _0x34d918=uuid['v4']();_0x272f99[_0xd3de('0xf2')][_0x34d918]=new Action(_0x4f9ea9,_0x5c76e7,_0x34d918);loggerBooked['info'](_0xd3de('0x1ec'),_0x34d918,_0xd3de('0x1ed'),JSON['stringify'](_0x4f9ea9[_0xd3de('0x6f')]),_0xd3de('0x1ee'),_0x4f9ea9[_0xd3de('0x45')]);if(_0x4f9ea9[_0xd3de('0x6f')]){_0x4f9ea9[_0xd3de('0x6f')]=![];_0x272f99[_0xd3de('0xfb')][_0x272f99[_0xd3de('0xf2')][_0x34d918]['queue']]=[];ami[_0xd3de('0x9e')]({'actionid':_0x34d918,'action':_0xd3de('0x1ef'),'queue':_0x4f9ea9[_0xd3de('0x45')]})[_0xd3de('0x9d')](function(){_0x272f99[_0xd3de('0xbf')](_0x4f9ea9);hopperUtils[_0xd3de('0xdc')]({'active':![],'ContactId':_0x272f99[_0xd3de('0xf2')][_0x34d918][_0xd3de('0xdf')],'ListId':_0x272f99[_0xd3de('0xf2')][_0x34d918]['ListId'],'VoiceQueueId':_0x272f99[_0xd3de('0xf2')][_0x34d918]['VoiceQueueId']||undefined,'CampaignId':_0x272f99[_0xd3de('0xf2')][_0x34d918][_0xd3de('0xe2')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x272f99[_0xd3de('0xf2')][_0x34d918];});}else{loggerBooked[_0xd3de('0x49')](_0xd3de('0x1f0'),JSON[_0xd3de('0x72')](_0x4f9ea9[_0xd3de('0x6f')]),_0xd3de('0x1ee'),_0x4f9ea9[_0xd3de('0x45')]);_0x272f99['updateOriginated'](_0x4f9ea9);hopperUtils[_0xd3de('0xdc')]({'active':![],'ContactId':_0x272f99[_0xd3de('0xf2')][_0x34d918]['ContactId'],'ListId':_0x272f99[_0xd3de('0xf2')][_0x34d918]['ListId'],'VoiceQueueId':_0x272f99[_0xd3de('0xf2')][_0x34d918][_0xd3de('0xe1')]||undefined,'CampaignId':_0x272f99[_0xd3de('0xf2')][_0x34d918][_0xd3de('0xe2')]||undefined})[_0xd3de('0x9d')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x272f99[_0xd3de('0xf2')][_0x34d918];}}else{return _0x272f99[_0xd3de('0x15f')](_0x4f9ea9,_0x5c76e7);}}else{if(utils[_0xd3de('0x60')](undefined,_0x5c76e7[_0xd3de('0x1f1')])<_0x4f9ea9[_0xd3de('0x1f2')]*0x3c){if(_0x5c76e7[_0xd3de('0x147')]&&!_0x5c76e7[_0xd3de('0x147')][_0xd3de('0x1f3')]){_0x272f99['preview'][_0xd3de('0xfc')](_0x5c76e7['id'])['finally'](function(){_0x272f99[_0xd3de('0xbf')](_0x4f9ea9);});}else{hopperUtils[_0xd3de('0x1f4')]({'active':![]},_0x5c76e7['id'],0x1)[_0xd3de('0x1a')](function(){_0x272f99[_0xd3de('0xbf')](_0x4f9ea9);});}}else{_0x4f9ea9['outboundReCallsDay']+=0x1;_0x272f99[_0xd3de('0xbf')](_0x4f9ea9);if(_0x4f9ea9[_0xd3de('0x1f5')]){hopperUtils[_0xd3de('0xdc')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5c76e7[_0xd3de('0xdf')],'ListId':_0x5c76e7[_0xd3de('0xe0')],'VoiceQueueId':_0x5c76e7['VoiceQueueId']||undefined,'CampaignId':_0x5c76e7[_0xd3de('0xe2')]||undefined})['catch'](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0xd3de('0xc6')](createObjHistory(_0x4f9ea9,_0x5c76e7,utils[_0xd3de('0x69')][_0xd3de('0x1f6')],0x17,'RecallInQueue'))[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x1f7')));}else{_0x272f99[_0xd3de('0x114')](createObjHistory(_0x4f9ea9,_0x5c76e7,utils[_0xd3de('0x69')]['RECALL_TIMEOUT'],0x16,_0xd3de('0x1f8')),_0xd3de('0x1f9'),'[Originate][HistoryRecallClose]');}}}}else{_0x4f9ea9[_0xd3de('0x1fa')]+=0x1;_0x272f99[_0xd3de('0x114')](createObjHistory(_0x4f9ea9,_0x5c76e7,utils['CAMPAIGN_STATUS'][_0xd3de('0x1fb')],0xd,_0xd3de('0x1fc')),_0xd3de('0x1fd'),_0xd3de('0x1fe'));throw _0xd3de('0x1ff');}};};Dialer['prototype'][_0xd3de('0x15e')]=function(_0x32e741){var _0x1245aa=this;var _0x32ee21=_0x32e741['limitCalls']-_0x32e741[_0xd3de('0x155')];emitCampaignSummary(_0x32e741);if(_0x32ee21>0x0&&_0x32e741[_0xd3de('0x66')]==0x0){if(_0x32ee21>this[_0xd3de('0x20')]){_0x32ee21=this[_0xd3de('0x20')];}_0x32e741[_0xd3de('0x66')]=0x1;hopperUtils[_0xd3de('0x200')](_0x32e741,_0x32ee21)[_0xd3de('0x3b')](function(_0x549fc7){_0x32e741['temp']=0x0;if(_0x549fc7){if(!utils[_0xd3de('0x201')](_0x549fc7)){_0x32e741[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x6b')];logger[_0xd3de('0x49')](_0xd3de('0x202')+_0x32e741['name']);}else{_0x32e741[_0xd3de('0x155')]+=_0x549fc7['length'];_0x32e741[_0xd3de('0x68')]=utils[_0xd3de('0x69')][_0xd3de('0x203')];for(var _0x516b00=0x0;_0x516b00<_0x549fc7[_0xd3de('0x96')];_0x516b00+=0x1){_0x32e741['ivrTotalCallsDays']+=0x1;if(_[_0xd3de('0xf7')](_0x549fc7[_0x516b00])||_[_0xd3de('0xf7')](_0x549fc7[_0x516b00][_0xd3de('0x204')])||_['isNil'](_0x549fc7[_0x516b00][_0xd3de('0x162')])){_0x1245aa[_0xd3de('0x157')](_0xd3de('0x205'),_0x32e741,_0x549fc7[_0x516b00]);}else{hopperUtils[_0xd3de('0x206')](_['pick'](_0x549fc7[_0x516b00],[_0xd3de('0xe2'),_0xd3de('0x162')]))['then'](_0x1245aa['checkContactBlack'](_0x32e741,_0x549fc7[_0x516b00]))[_0xd3de('0x9d')](_0x1245aa[_0xd3de('0x207')](_0xd3de('0x208'),_0x32e741));}}}}})[_0xd3de('0x9d')](loggerGetContactDialer('[getContactCampaign2]',_0x32e741,_0x32ee21));}};Dialer['prototype'][_0xd3de('0xb2')]=function(_0x2fc26e,_0x1888af){var _0x1f1bfa=this;var _0x41ab14=[];if(_0x1888af<0x1||_0x2fc26e[_0xd3de('0xaf')]==='booked'){_0x1888af=0x1;}var _0x9c96bc=Math[_0xd3de('0x1c2')](_0x2fc26e[_0xd3de('0x1c1')]*_0x1888af)-_0x2fc26e['originated'];if(_0x2fc26e[_0xd3de('0x209')]>0x0){var _0x530bf4=_0x2fc26e[_0xd3de('0x209')]-_0x2fc26e[_0xd3de('0x155')]-_0x2fc26e['talking']-_0x2fc26e[_0xd3de('0x20a')];if(_0x9c96bc>_0x530bf4){_0x9c96bc=_0x530bf4;}}if(_0x9c96bc>0x0&&_0x2fc26e[_0xd3de('0x66')]==0x0){if(_0x2fc26e[_0xd3de('0xaf')]===_0xd3de('0xb')){_0x9c96bc=0x1;}if(_0x9c96bc>this['maxNumberOriginate']){_0x9c96bc=this[_0xd3de('0x20')];}for(var _0x2c3a16 in this[_0xd3de('0x1e')]){if(typeof this[_0xd3de('0x1e')][_0x2c3a16]!==_0xd3de('0xa8')){if(this[_0xd3de('0x1e')][_0x2c3a16]['state']===_0xd3de('0x20b')&&this[_0xd3de('0x1e')][_0x2c3a16][_0xd3de('0x83')]===_0xd3de('0x84')){_0x41ab14[_0xd3de('0x97')](this[_0xd3de('0x1e')][_0x2c3a16]['id']);}}}_0x2fc26e['temp']=0x1;hopperUtils[_0xd3de('0x20c')](_0x2fc26e,_0x41ab14,_0x9c96bc)[_0xd3de('0x3b')](function(_0x5990d7){_0x2fc26e['temp']=0x0;if(_0x5990d7){if(!utils[_0xd3de('0x201')](_0x5990d7)){hopperUtils[_0xd3de('0x20d')](_0x2fc26e)[_0xd3de('0x3b')](sendMessageReschedule(_0x2fc26e))[_0xd3de('0x9d')](loggerCatch(_0xd3de('0x20e')));}else{_0x2fc26e[_0xd3de('0x155')]+=_0x5990d7[_0xd3de('0x96')];_0x2fc26e[_0xd3de('0x68')]=_0x2fc26e[_0xd3de('0xaf')]===_0xd3de('0xb')?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0xd3de('0x69')][_0xd3de('0x203')];for(var _0x5675b6=0x0;_0x5675b6<_0x5990d7['length'];_0x5675b6+=0x1){if(_[_0xd3de('0xf7')](_0x5990d7[_0x5675b6])||_[_0xd3de('0xf7')](_0x5990d7[_0x5675b6][_0xd3de('0x204')])||_[_0xd3de('0xf7')](_0x5990d7[_0x5675b6][_0xd3de('0x162')])){_0x1f1bfa['emptyContact']('[actionOriginate]\x20',_0x2fc26e,_0x5990d7[_0x5675b6]);}else{hopperUtils[_0xd3de('0x20f')](_['pick'](_0x5990d7[_0x5675b6],[_0xd3de('0xe1'),'phone']))[_0xd3de('0x3b')](_0x1f1bfa[_0xd3de('0x1ea')](_0x2fc26e,_0x5990d7[_0x5675b6]))[_0xd3de('0x9d')](_0x1f1bfa[_0xd3de('0x207')]('[actionOriginate]\x20',_0x2fc26e));}}}}})['catch'](loggerGetContactDialer(_0xd3de('0x210'),_0x2fc26e,_0x9c96bc));}};Dialer[_0xd3de('0x80')][_0xd3de('0x62')]=function(_0x394f25){if(_0x394f25[_0xd3de('0x209')]>0x0){var _0x38f2a4=_0x394f25[_0xd3de('0x209')]-_0x394f25[_0xd3de('0x155')]-_0x394f25[_0xd3de('0x13d')];if(_0x38f2a4>0x0&&_0x394f25['temp']==0x0){this[_0xd3de('0x211')](_0x394f25);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0xd3de('0x211')](_0x394f25);}};Dialer[_0xd3de('0x80')][_0xd3de('0x211')]=function(_0xe9a933){var _0xf876e6=this;var _0x4339ba=[];_0xe9a933['originated']+=0x1;for(var _0x45d62b in this[_0xd3de('0x1e')]){if(typeof this[_0xd3de('0x1e')][_0x45d62b]!==_0xd3de('0xa8')){if(this[_0xd3de('0x1e')][_0x45d62b][_0xd3de('0xd7')]===_0xd3de('0x20b')&&this['agents'][_0x45d62b][_0xd3de('0x83')]===_0xd3de('0x84')){_0x4339ba[_0xd3de('0x97')](this[_0xd3de('0x1e')][_0x45d62b]['id']);}}}_0xe9a933['temp']=0x1;return this[_0xd3de('0x20c')](_0xe9a933['id'],_0x4339ba,0x1,_0xe9a933[_0xd3de('0x212')],_0xe9a933)[_0xd3de('0x3b')](function(_0x42814f){_0xe9a933[_0xd3de('0x66')]=0x1;if(_0x42814f){if(!utils['checkContactEmpty'](_0x42814f)){utils['checkContactLowerLimitOriginate'](_0xe9a933,0x1,0x0);return hopperUtils[_0xd3de('0x20d')](_0xe9a933)[_0xd3de('0x3b')](sendMessageReschedule(_0xe9a933))['catch'](loggerCatch(_0xd3de('0x20e')));}else{_0xe9a933['message']=utils[_0xd3de('0x69')]['RUNNING'];if(_[_0xd3de('0xf7')](_0x42814f[0x0])||_[_0xd3de('0xf7')](_0x42814f[0x0][_0xd3de('0x204')])||_['isNil'](_0x42814f[0x0]['phone'])){_0xf876e6[_0xd3de('0x157')](_0xd3de('0x205'),_0xe9a933,_0x42814f[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0xd3de('0x73')](_0x42814f[0x0],[_0xd3de('0xe1'),_0xd3de('0x162')]))[_0xd3de('0x3b')](_0xf876e6[_0xd3de('0x1ea')](_0xe9a933,_0x42814f[0x0]))[_0xd3de('0x9d')](_0xf876e6[_0xd3de('0x207')](_0xd3de('0x213'),_0xe9a933));}}}})[_0xd3de('0x9d')](loggerGetContactDialer(_0xd3de('0x214'),_0xe9a933,0x1));};Dialer[_0xd3de('0x80')][_0xd3de('0x1d9')]=function(_0xbe3665,_0x151e03,_0x362e19,_0x5b3e7d,_0x2fa103,_0xab692c){loggerPredictive[_0xd3de('0x49')](_0xd3de('0x215'));loggerPredictive['info'](_0xd3de('0x216'),_0xbe3665);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x217'),_0x151e03);loggerPredictive[_0xd3de('0x49')]('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',_0x362e19);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x218'),_0x5b3e7d);loggerPredictive['info'](_0xd3de('0x219'),_0x2fa103);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1d3735,_0x36ba17){if(_0xbe3665<=0x0||isNaN(_0xbe3665)){return _0x36ba17(msgResponse(_0xd3de('0x21a'),_0xd3de('0x7f'),'m\x20=\x20'+_0xbe3665));}if(_0x362e19<=0x0||isNaN(_0x362e19)){return _0x36ba17(msgResponse(_0xd3de('0x21a'),'Error',_0xd3de('0x21b')+_0x362e19));}if(_0x5b3e7d<=0x0||isNaN(_0x5b3e7d)){return _0x36ba17(msgResponse(_0xd3de('0x21a'),_0xd3de('0x7f'),_0xd3de('0x21c')+_0x5b3e7d));}if(_0x151e03<=0x0||isNaN(_0x151e03)){return _0x36ba17(msgResponse(_0xd3de('0x21a'),_0xd3de('0x7f'),'interval\x20=\x20'+_0x151e03));}if(_0x2fa103<=0x0||isNaN(_0x2fa103)){return _0x36ba17(msgResponse(_0xd3de('0x21a'),_0xd3de('0x7f'),_0xd3de('0x21d')+_0x2fa103));}_0xab692c=_0xab692c||0x0;var _0x56302d=0x1/_0x362e19;var _0x28c5b1=0x0;var _0x3e573e=0x0;var _0x51da73=0x0;var _0x596ba4=0x0;for(var _0xb68042=0x0;_0x51da73<_0x2fa103;_0xb68042+=0x1){_0x3e573e=_0xb68042/_0x151e03;_0x28c5b1=(_0x5b3e7d*_0x3e573e+_0xab692c)/_0x56302d;_0x51da73=utils[_0xd3de('0x21e')](_0x28c5b1,_0xbe3665);_0x596ba4=_0x28c5b1/_0xbe3665*(0x1-utils[_0xd3de('0x21e')](_0x28c5b1,_0xbe3665));}return _0x1d3735({'erlangCalls':_0xb68042,'erlangCallToSecond':_0x151e03/_0xb68042,'erlangAbandonmentRate':_0x51da73,'erlangBusyFactor':_0x596ba4});});};Dialer[_0xd3de('0x80')][_0xd3de('0x1e4')]=function(_0x2e40ea,_0x1e867d,_0x3014b4,_0x50e784,_0x267215,_0x1cb5c4){loggerPredictive[_0xd3de('0x49')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0xd3de('0x216'),_0x2e40ea);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x217'),_0x1e867d);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x21f'),_0x3014b4);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x218'),_0x50e784);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x220'),_0x267215);loggerPredictive[_0xd3de('0x49')](_0xd3de('0x53'));return new Promise(function(_0x2a220c,_0x22d565){if(_0x2e40ea<=0x0||isNaN(_0x2e40ea)){return _0x22d565(msgResponse(_0xd3de('0x221'),'Error',_0xd3de('0x222')+_0x2e40ea));}if(_0x3014b4<=0x0||isNaN(_0x3014b4)){return _0x22d565(msgResponse(_0xd3de('0x221'),_0xd3de('0x7f'),'Ts\x20=\x20'+_0x3014b4));}if(_0x50e784<=0x0||isNaN(_0x50e784)){return _0x22d565(msgResponse(_0xd3de('0x221'),_0xd3de('0x7f'),_0xd3de('0x21c')+_0x50e784));}if(_0x1e867d<=0x0||isNaN(_0x1e867d)){return _0x22d565(msgResponse(_0xd3de('0x221'),_0xd3de('0x7f'),_0xd3de('0x223')+_0x1e867d));}if(_0x267215<=0x0||isNaN(_0x267215)){return _0x22d565(msgResponse(_0xd3de('0x221'),_0xd3de('0x7f'),'Umin\x20=\x20'+_0x267215));}_0x1cb5c4=_0x1cb5c4||0x0;var _0x21553c=0x1/_0x3014b4;var _0x4e33db=0x0;var _0x480726=0x0;var _0x3092db=0x0;var _0x50c35c=0x0;for(var _0x13f3ae=0x0;_0x50c35c<_0x267215;_0x13f3ae+=0x1){_0x480726=_0x13f3ae/_0x1e867d;_0x4e33db=(_0x50e784*_0x480726+_0x1cb5c4)/_0x21553c;_0x3092db=utils[_0xd3de('0x21e')](_0x4e33db,_0x2e40ea);_0x50c35c=_0x4e33db/_0x2e40ea*(0x1-utils[_0xd3de('0x21e')](_0x4e33db,_0x2e40ea));}return _0x2a220c({'erlangCalls':_0x13f3ae,'erlangCallToSecond':_0x1e867d/_0x13f3ae,'erlangAbandonmentRate':_0x3092db,'erlangBusyFactor':_0x50c35c});});};module['exports']=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 14202f0..e64c7b1 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 _0x3b79=['UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','util','moment','isNil','string','voiceQueue','uniqueid','Contact','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId'];(function(_0x1e1b22,_0x46e58c){var _0xdb2f91=function(_0x538055){while(--_0x538055){_0x1e1b22['push'](_0x1e1b22['shift']());}};_0xdb2f91(++_0x46e58c);}(_0x3b79,0x162));var _0x93b7=function(_0x500105,_0x341501){_0x500105=_0x500105-0x0;var _0x5ed0ce=_0x3b79[_0x500105];return _0x5ed0ce;};'use strict';var util=require(_0x93b7('0x0'));var _=require('lodash');var moment=require(_0x93b7('0x1'));function checkNameSurname(_0x4a8c1a,_0x5a98ee,_0x2f9cbb){var _0x1671f6='';if(!_[_0x93b7('0x2')](_0x5a98ee)&&_0x93b7('0x3')===typeof _0x5a98ee){_0x1671f6+=_0x5a98ee;}if(!_[_0x93b7('0x2')](_0x2f9cbb)&&'string'===typeof _0x2f9cbb){_0x1671f6+='\x20'+_0x2f9cbb;}if(_0x1671f6!==''){return _0x1671f6;}return _0x4a8c1a;}function Action(_0x201280,_0x3d3a97,_0x158242){this[_0x93b7('0x4')]=_0x201280;this[_0x93b7('0x5')]=_0x158242||undefined;this['name']=checkNameSurname(_0x3d3a97[_0x93b7('0x6')]['phone'],_0x3d3a97['Contact']['firstName'],_0x3d3a97[_0x93b7('0x6')][_0x93b7('0x7')]);this[_0x93b7('0x8')]=_0x3d3a97['phone'];this[_0x93b7('0x9')]=_0x201280[_0x93b7('0xa')];this[_0x93b7('0xb')]=_0x3d3a97['active']||![];this['type']=_0x201280[_0x93b7('0xc')];this[_0x93b7('0xd')]=_0x201280[_0x93b7('0xd')]||0x3;this[_0x93b7('0xe')]=_0x3d3a97[_0x93b7('0xe')];this[_0x93b7('0xf')]=_0x3d3a97[_0x93b7('0xf')];this[_0x93b7('0x10')]=_0x3d3a97[_0x93b7('0x10')];this[_0x93b7('0x11')]=_0x3d3a97[_0x93b7('0x11')];this['countnosuchnumberretry']=_0x3d3a97[_0x93b7('0x12')];this['countdropretry']=_0x3d3a97['countdropretry'];this['countabandonedretry']=_0x3d3a97[_0x93b7('0x13')];this[_0x93b7('0x14')]=_0x3d3a97['countmachineretry'];this[_0x93b7('0x15')]=_0x3d3a97[_0x93b7('0x15')];this['ContactId']=_0x3d3a97[_0x93b7('0x16')];this['ListId']=_0x3d3a97[_0x93b7('0x17')];this[_0x93b7('0x18')]=_0x3d3a97['UserId'];this['VoiceQueueId']=_0x3d3a97[_0x93b7('0x19')];this['CampaignId']=_0x3d3a97[_0x93b7('0x1a')];this[_0x93b7('0x1b')]=_0x3d3a97['id'];this[_0x93b7('0x1c')]=_0x3d3a97[_0x93b7('0x6')][_0x93b7('0x1d')]||'';this['starttime']=moment()[_0x93b7('0x1e')](_0x93b7('0x1f'));this[_0x93b7('0x20')]=_0x3d3a97['callback'];this['callbackuniqueid']=_0x3d3a97['callbackuniqueid'];this[_0x93b7('0x21')]=_0x3d3a97[_0x93b7('0x21')];this[_0x93b7('0x22')]=_0x3d3a97[_0x93b7('0x22')];this['originatecalleridnum']='';this[_0x93b7('0x23')]='';}Action[_0x93b7('0x24')][_0x93b7('0x25')]=function(){return util[_0x93b7('0x1e')](_0x93b7('0x26'),this[_0x93b7('0xa')],this[_0x93b7('0x4')][_0x93b7('0x27')]>0x0?this['number'][_0x93b7('0x28')](this['voiceQueue'][_0x93b7('0x27')]):this['number']);};Action[_0x93b7('0x24')]['getQueue']=function(){return this['queue'];};module[_0x93b7('0x29')]=Action; \ No newline at end of file +var _0x3f2c=['voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','queue','util','lodash','moment','isNil','string'];(function(_0x576bbd,_0x43608d){var _0x435579=function(_0x196f03){while(--_0x196f03){_0x576bbd['push'](_0x576bbd['shift']());}};_0x435579(++_0x43608d);}(_0x3f2c,0x175));var _0xc3f2=function(_0x222802,_0x22e197){_0x222802=_0x222802-0x0;var _0x26c770=_0x3f2c[_0x222802];return _0x26c770;};'use strict';var util=require(_0xc3f2('0x0'));var _=require(_0xc3f2('0x1'));var moment=require(_0xc3f2('0x2'));function checkNameSurname(_0x4cb6a9,_0x35a783,_0x1dd42e){var _0x3835b4='';if(!_[_0xc3f2('0x3')](_0x35a783)&&_0xc3f2('0x4')===typeof _0x35a783){_0x3835b4+=_0x35a783;}if(!_[_0xc3f2('0x3')](_0x1dd42e)&&_0xc3f2('0x4')===typeof _0x1dd42e){_0x3835b4+='\x20'+_0x1dd42e;}if(_0x3835b4!==''){return _0x3835b4;}return _0x4cb6a9;}function Action(_0x1abadd,_0x32379f,_0x2d53e3){this[_0xc3f2('0x5')]=_0x1abadd;this[_0xc3f2('0x6')]=_0x2d53e3||undefined;this[_0xc3f2('0x7')]=checkNameSurname(_0x32379f[_0xc3f2('0x8')][_0xc3f2('0x9')],_0x32379f[_0xc3f2('0x8')][_0xc3f2('0xa')],_0x32379f[_0xc3f2('0x8')][_0xc3f2('0xb')]);this[_0xc3f2('0xc')]=_0x32379f[_0xc3f2('0x9')];this['queue']=_0x1abadd[_0xc3f2('0x7')];this[_0xc3f2('0xd')]=_0x32379f[_0xc3f2('0xd')]||![];this[_0xc3f2('0xe')]=_0x1abadd['type'];this[_0xc3f2('0xf')]=_0x1abadd[_0xc3f2('0xf')]||0x3;this[_0xc3f2('0x10')]=_0x32379f[_0xc3f2('0x10')];this[_0xc3f2('0x11')]=_0x32379f[_0xc3f2('0x11')];this[_0xc3f2('0x12')]=_0x32379f[_0xc3f2('0x12')];this['countnoanswerretry']=_0x32379f[_0xc3f2('0x13')];this[_0xc3f2('0x14')]=_0x32379f[_0xc3f2('0x14')];this[_0xc3f2('0x15')]=_0x32379f[_0xc3f2('0x15')];this['countabandonedretry']=_0x32379f[_0xc3f2('0x16')];this[_0xc3f2('0x17')]=_0x32379f['countmachineretry'];this[_0xc3f2('0x18')]=_0x32379f[_0xc3f2('0x18')];this['ContactId']=_0x32379f['ContactId'];this[_0xc3f2('0x19')]=_0x32379f[_0xc3f2('0x19')];this['UserId']=_0x32379f['UserId'];this['VoiceQueueId']=_0x32379f['VoiceQueueId'];this['CampaignId']=_0x32379f[_0xc3f2('0x1a')];this[_0xc3f2('0x1b')]=_0x32379f['id'];this['ContactFirstName']=_0x32379f['Contact'][_0xc3f2('0xa')]||'';this[_0xc3f2('0x1c')]=moment()[_0xc3f2('0x1d')](_0xc3f2('0x1e'));this[_0xc3f2('0x1f')]=_0x32379f['callback'];this[_0xc3f2('0x20')]=_0x32379f[_0xc3f2('0x20')];this[_0xc3f2('0x21')]=_0x32379f['callbackat'];this[_0xc3f2('0x22')]=_0x32379f[_0xc3f2('0x22')];this['originatecalleridnum']='';this[_0xc3f2('0x23')]='';}Action[_0xc3f2('0x24')][_0xc3f2('0x25')]=function(){return util[_0xc3f2('0x1d')](_0xc3f2('0x26'),this['name'],this[_0xc3f2('0x5')][_0xc3f2('0x27')]>0x0?this[_0xc3f2('0xc')][_0xc3f2('0x28')](this[_0xc3f2('0x5')][_0xc3f2('0x27')]):this[_0xc3f2('0xc')]);};Action['prototype']['getQueue']=function(){return this[_0xc3f2('0x29')];};module['exports']=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 6d171e4..7f09409 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 _0xfd51=['scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','Answer'];(function(_0xb7708f,_0xc7240b){var _0x4756d0=function(_0x5ba269){while(--_0x5ba269){_0xb7708f['push'](_0xb7708f['shift']());}};_0x4756d0(++_0xc7240b);}(_0xfd51,0x1d6));var _0x1fd5=function(_0x3d1057,_0x439e98){_0x3d1057=_0x3d1057-0x0;var _0x4bb9ad=_0xfd51[_0x3d1057];return _0x4bb9ad;};'use strict';var moment=require(_0x1fd5('0x0'));var utils=require('../utils');function AgentComplete(_0x36706e,_0x460a17){this[_0x1fd5('0x1')]=0x4;this['statedesc']=_0x1fd5('0x2');this['scheduledat']=_0x36706e[_0x1fd5('0x3')];this[_0x1fd5('0x4')]=_0x36706e[_0x1fd5('0x4')];this[_0x1fd5('0x5')]=_0x36706e[_0x1fd5('0x4')]==='outbound'?_0x1fd5('0x6'):_0x36706e[_0x1fd5('0x4')];this['countbusyretry']=_0x36706e[_0x1fd5('0x7')];this[_0x1fd5('0x8')]=_0x36706e[_0x1fd5('0x8')];this['countnoanswerretry']=_0x36706e[_0x1fd5('0x9')];this[_0x1fd5('0xa')]=_0x36706e['countbusyretry']+_0x36706e[_0x1fd5('0x8')]+_0x36706e['countnoanswerretry']+_0x36706e['countnosuchnumberretry']+_0x36706e[_0x1fd5('0xb')]+_0x36706e[_0x1fd5('0xc')]+_0x36706e['countmachineretry']+_0x36706e[_0x1fd5('0xd')];this[_0x1fd5('0xe')]=_0x36706e[_0x1fd5('0xe')];this[_0x1fd5('0xb')]=_0x36706e[_0x1fd5('0xb')];this[_0x1fd5('0xc')]=_0x36706e[_0x1fd5('0xc')];this[_0x1fd5('0xf')]=_0x36706e['countmachineretry'];this[_0x1fd5('0xd')]=_0x36706e[_0x1fd5('0xd')];this[_0x1fd5('0x10')]=_0x460a17[_0x1fd5('0x10')];this[_0x1fd5('0x11')]=_0x36706e['name'];this['calleridnum']=_0x36706e[_0x1fd5('0x12')];this[_0x1fd5('0x13')]=_0x36706e[_0x1fd5('0x13')];this[_0x1fd5('0x14')]=_0x36706e[_0x1fd5('0x14')];this[_0x1fd5('0x15')]=_0x36706e['answertime'];this[_0x1fd5('0x16')]=moment()[_0x1fd5('0x17')](_0x1fd5('0x18'));this[_0x1fd5('0x19')]=utils['getSeconds'](_0x36706e[_0x1fd5('0x14')],_0x36706e[_0x1fd5('0x13')]);this['holdtime']=utils[_0x1fd5('0x1a')](_0x36706e['answertime'],_0x36706e[_0x1fd5('0x14')]);this[_0x1fd5('0x1b')]=utils[_0x1fd5('0x1a')](this['endtime'],_0x36706e['answertime']);this[_0x1fd5('0x6')]=_0x460a17[_0x1fd5('0x6')];this[_0x1fd5('0x1c')]=_0x460a17[_0x1fd5('0x1c')];this['reason']=_0x460a17[_0x1fd5('0x1d')];this[_0x1fd5('0x1e')]=_0x36706e['callback'];this[_0x1fd5('0x1f')]=_0x36706e[_0x1fd5('0x1f')];this['callbackat']=_0x36706e[_0x1fd5('0x20')];this[_0x1fd5('0x21')]=_0x36706e[_0x1fd5('0x21')];this[_0x1fd5('0x22')]=_0x36706e['ContactId'];this[_0x1fd5('0x23')]=_0x36706e[_0x1fd5('0x23')];this[_0x1fd5('0x24')]=_0x36706e['UserId'];this[_0x1fd5('0x25')]=_0x36706e[_0x1fd5('0x25')];this[_0x1fd5('0x26')]=_0x36706e[_0x1fd5('0x26')];this[_0x1fd5('0x27')]=_0x36706e['originatecalleridnum']||'';this[_0x1fd5('0x28')]=_0x36706e[_0x1fd5('0x28')]||'';this[_0x1fd5('0x29')]=_0x36706e['agiafterat'];}module[_0x1fd5('0x2a')]=AgentComplete; \ No newline at end of file +var _0x4d8b=['answertime','endtime','format','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x4d8b,0x101));var _0xb4d8=function(_0x514e38,_0x18958d){_0x514e38=_0x514e38-0x0;var _0x57305d=_0x4d8b[_0x514e38];return _0x57305d;};'use strict';var moment=require(_0xb4d8('0x0'));var utils=require(_0xb4d8('0x1'));function AgentComplete(_0x5d6d24,_0x49bc20){this[_0xb4d8('0x2')]=0x4;this[_0xb4d8('0x3')]=_0xb4d8('0x4');this[_0xb4d8('0x5')]=_0x5d6d24[_0xb4d8('0x5')];this['type']=_0x5d6d24[_0xb4d8('0x6')];this[_0xb4d8('0x7')]=_0x5d6d24['type']===_0xb4d8('0x8')?_0xb4d8('0x9'):_0x5d6d24[_0xb4d8('0x6')];this[_0xb4d8('0xa')]=_0x5d6d24[_0xb4d8('0xa')];this[_0xb4d8('0xb')]=_0x5d6d24['countcongestionretry'];this[_0xb4d8('0xc')]=_0x5d6d24[_0xb4d8('0xc')];this['countglobal']=_0x5d6d24[_0xb4d8('0xa')]+_0x5d6d24['countcongestionretry']+_0x5d6d24[_0xb4d8('0xc')]+_0x5d6d24[_0xb4d8('0xd')]+_0x5d6d24[_0xb4d8('0xe')]+_0x5d6d24[_0xb4d8('0xf')]+_0x5d6d24[_0xb4d8('0x10')]+_0x5d6d24[_0xb4d8('0x11')];this[_0xb4d8('0xd')]=_0x5d6d24[_0xb4d8('0xd')];this[_0xb4d8('0xe')]=_0x5d6d24[_0xb4d8('0xe')];this[_0xb4d8('0xf')]=_0x5d6d24[_0xb4d8('0xf')];this[_0xb4d8('0x10')]=_0x5d6d24[_0xb4d8('0x10')];this[_0xb4d8('0x11')]=_0x5d6d24[_0xb4d8('0x11')];this[_0xb4d8('0x12')]=_0x49bc20[_0xb4d8('0x12')];this[_0xb4d8('0x13')]=_0x5d6d24[_0xb4d8('0x14')];this[_0xb4d8('0x15')]=_0x5d6d24[_0xb4d8('0x16')];this[_0xb4d8('0x17')]=_0x5d6d24[_0xb4d8('0x17')];this[_0xb4d8('0x18')]=_0x5d6d24['responsetime'];this['answertime']=_0x5d6d24[_0xb4d8('0x19')];this[_0xb4d8('0x1a')]=moment()[_0xb4d8('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xb4d8('0x1c')]=utils[_0xb4d8('0x1d')](_0x5d6d24[_0xb4d8('0x18')],_0x5d6d24[_0xb4d8('0x17')]);this[_0xb4d8('0x1e')]=utils[_0xb4d8('0x1d')](_0x5d6d24[_0xb4d8('0x19')],_0x5d6d24['responsetime']);this[_0xb4d8('0x1f')]=utils['getSeconds'](this[_0xb4d8('0x1a')],_0x5d6d24['answertime']);this[_0xb4d8('0x9')]=_0x49bc20[_0xb4d8('0x9')];this[_0xb4d8('0x20')]=_0x49bc20['membername'];this[_0xb4d8('0x21')]=_0x49bc20[_0xb4d8('0x21')];this[_0xb4d8('0x22')]=_0x5d6d24[_0xb4d8('0x22')];this[_0xb4d8('0x23')]=_0x5d6d24[_0xb4d8('0x23')];this['callbackat']=_0x5d6d24[_0xb4d8('0x24')];this[_0xb4d8('0x25')]=_0x5d6d24['recallme'];this[_0xb4d8('0x26')]=_0x5d6d24[_0xb4d8('0x26')];this['ListId']=_0x5d6d24[_0xb4d8('0x27')];this[_0xb4d8('0x28')]=_0x5d6d24['UserId'];this['VoiceQueueId']=_0x5d6d24[_0xb4d8('0x29')];this[_0xb4d8('0x2a')]=_0x5d6d24[_0xb4d8('0x2a')];this[_0xb4d8('0x2b')]=_0x5d6d24[_0xb4d8('0x2b')]||'';this['originatecalleridname']=_0x5d6d24[_0xb4d8('0x2c')]||'';this[_0xb4d8('0x2d')]=_0x5d6d24[_0xb4d8('0x2d')];}module[_0xb4d8('0x2e')]=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 c1e68f7..006aa51 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 _0x4283=['countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','endtime','holdtime','talktime','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x4375ad,_0x327726){var _0x372124=function(_0xd6e60d){while(--_0xd6e60d){_0x4375ad['push'](_0x4375ad['shift']());}};_0x372124(++_0x327726);}(_0x4283,0x18f));var _0x3428=function(_0x4de27e,_0x3de5c8){_0x4de27e=_0x4de27e-0x0;var _0x2f36af=_0x4283[_0x4de27e];return _0x2f36af;};'use strict';function Final(_0x5651fc){this[_0x3428('0x0')]=_0x5651fc[_0x3428('0x0')];this['scheduledat']=_0x5651fc[_0x3428('0x1')];this[_0x3428('0x2')]=_0x5651fc[_0x3428('0x2')];this[_0x3428('0x3')]=_0x5651fc[_0x3428('0x2')]==='outbound'?'queue':_0x5651fc['type'];this[_0x3428('0x4')]=_0x5651fc[_0x3428('0x4')];this[_0x3428('0x5')]=_0x5651fc['countcongestionretry'];this[_0x3428('0x6')]=_0x5651fc[_0x3428('0x6')];this[_0x3428('0x7')]=_0x5651fc[_0x3428('0x4')]+_0x5651fc[_0x3428('0x5')]+_0x5651fc[_0x3428('0x6')]+_0x5651fc[_0x3428('0x8')]+_0x5651fc[_0x3428('0x9')]+_0x5651fc[_0x3428('0xa')]+_0x5651fc[_0x3428('0xb')]+_0x5651fc[_0x3428('0xc')];this[_0x3428('0x8')]=_0x5651fc[_0x3428('0x8')];this[_0x3428('0x9')]=_0x5651fc[_0x3428('0x9')];this[_0x3428('0xa')]=_0x5651fc[_0x3428('0xa')];this[_0x3428('0xb')]=_0x5651fc[_0x3428('0xb')];this[_0x3428('0xc')]=_0x5651fc[_0x3428('0xc')];this[_0x3428('0xd')]=_0x5651fc[_0x3428('0xd')];this['calleridname']=_0x5651fc[_0x3428('0xe')];this['calleridnum']=_0x5651fc[_0x3428('0xf')];this[_0x3428('0x10')]=_0x5651fc[_0x3428('0x10')];this[_0x3428('0x11')]=_0x5651fc[_0x3428('0x11')];this[_0x3428('0x12')]=_0x5651fc[_0x3428('0x11')];this['ringtime']=_0x5651fc['ringtime']||0x0;this[_0x3428('0x13')]=_0x5651fc[_0x3428('0x13')]||0x0;this['talktime']=_0x5651fc[_0x3428('0x14')]||0x0;this[_0x3428('0x15')]=_0x5651fc['callback'];this['callbackuniqueid']=_0x5651fc['callbackuniqueid'];this['callbackat']=_0x5651fc[_0x3428('0x16')];this[_0x3428('0x17')]=_0x5651fc['recallme'];this['ContactId']=_0x5651fc[_0x3428('0x18')];this[_0x3428('0x19')]=_0x5651fc[_0x3428('0x19')];this[_0x3428('0x1a')]=_0x5651fc[_0x3428('0x1a')];this[_0x3428('0x1b')]=_0x5651fc[_0x3428('0x1b')];this[_0x3428('0x1c')]=_0x5651fc[_0x3428('0x1c')];this[_0x3428('0x1d')]=_0x5651fc['originatecalleridnum']||'';this['originatecalleridname']=_0x5651fc[_0x3428('0x1e')]||'';this[_0x3428('0x1f')]=_0x5651fc['state'];this[_0x3428('0x20')]=_0x5651fc[_0x3428('0x20')];}module[_0x3428('0x21')]=Final; \ No newline at end of file +var _0x56b4=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','uniqueid','scheduledat','type','outbound','queue','countbusyretry'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x56b4,0x102));var _0x456b=function(_0x559f05,_0x473a4d){_0x559f05=_0x559f05-0x0;var _0x4566ff=_0x56b4[_0x559f05];return _0x4566ff;};'use strict';function Final(_0x1ca6ae){this[_0x456b('0x0')]=_0x1ca6ae['uniqueid'];this['scheduledat']=_0x1ca6ae[_0x456b('0x1')];this[_0x456b('0x2')]=_0x1ca6ae['type'];this['campaigntype']=_0x1ca6ae[_0x456b('0x2')]===_0x456b('0x3')?_0x456b('0x4'):_0x1ca6ae[_0x456b('0x2')];this[_0x456b('0x5')]=_0x1ca6ae['countbusyretry'];this[_0x456b('0x6')]=_0x1ca6ae['countcongestionretry'];this['countnoanswerretry']=_0x1ca6ae[_0x456b('0x7')];this[_0x456b('0x8')]=_0x1ca6ae['countbusyretry']+_0x1ca6ae[_0x456b('0x6')]+_0x1ca6ae['countnoanswerretry']+_0x1ca6ae[_0x456b('0x9')]+_0x1ca6ae[_0x456b('0xa')]+_0x1ca6ae['countabandonedretry']+_0x1ca6ae[_0x456b('0xb')]+_0x1ca6ae[_0x456b('0xc')];this[_0x456b('0x9')]=_0x1ca6ae[_0x456b('0x9')];this['countdropretry']=_0x1ca6ae[_0x456b('0xa')];this[_0x456b('0xd')]=_0x1ca6ae[_0x456b('0xd')];this[_0x456b('0xb')]=_0x1ca6ae[_0x456b('0xb')];this[_0x456b('0xc')]=_0x1ca6ae[_0x456b('0xc')];this['queue']=_0x1ca6ae['queue'];this[_0x456b('0xe')]=_0x1ca6ae[_0x456b('0xe')];this[_0x456b('0xf')]=_0x1ca6ae[_0x456b('0xf')];this['starttime']=_0x1ca6ae[_0x456b('0x10')];this['responsetime']=_0x1ca6ae[_0x456b('0x11')];this['endtime']=_0x1ca6ae['responsetime'];this[_0x456b('0x12')]=_0x1ca6ae[_0x456b('0x12')]||0x0;this[_0x456b('0x13')]=_0x1ca6ae[_0x456b('0x13')]||0x0;this['talktime']=_0x1ca6ae['talktime']||0x0;this[_0x456b('0x14')]=_0x1ca6ae[_0x456b('0x14')];this[_0x456b('0x15')]=_0x1ca6ae[_0x456b('0x15')];this[_0x456b('0x16')]=_0x1ca6ae['callbackat'];this[_0x456b('0x17')]=_0x1ca6ae[_0x456b('0x17')];this[_0x456b('0x18')]=_0x1ca6ae['ContactId'];this[_0x456b('0x19')]=_0x1ca6ae['ListId'];this[_0x456b('0x1a')]=_0x1ca6ae['UserId'];this[_0x456b('0x1b')]=_0x1ca6ae[_0x456b('0x1b')];this[_0x456b('0x1c')]=_0x1ca6ae[_0x456b('0x1c')];this[_0x456b('0x1d')]=_0x1ca6ae['originatecalleridnum']||'';this['originatecalleridname']=_0x1ca6ae['originatecalleridname']||'';this[_0x456b('0x1e')]=_0x1ca6ae[_0x456b('0x1e')];this[_0x456b('0x1f')]=_0x1ca6ae[_0x456b('0x1f')];}module[_0x456b('0x20')]=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 a4467d6..eff432b 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 _0x93eb=['Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','../utils','state','statedesc'];(function(_0x128a73,_0x26c676){var _0x210caa=function(_0x47ac0f){while(--_0x47ac0f){_0x128a73['push'](_0x128a73['shift']());}};_0x210caa(++_0x26c676);}(_0x93eb,0x1b5));var _0xb93e=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x93eb[_0x413feb];return _0x40ee88;};'use strict';var moment=require('moment');var utils=require(_0xb93e('0x0'));function Hangup(_0x9ae2c6,_0x3b955f){this[_0xb93e('0x1')]=0x4;this[_0xb93e('0x2')]=_0xb93e('0x3');this[_0xb93e('0x4')]=_0x9ae2c6[_0xb93e('0x4')];this[_0xb93e('0x5')]=_0x9ae2c6[_0xb93e('0x5')];this['campaigntype']=_0x9ae2c6[_0xb93e('0x5')]===_0xb93e('0x6')?'queue':_0x9ae2c6[_0xb93e('0x5')];this[_0xb93e('0x7')]=_0x9ae2c6[_0xb93e('0x7')]||![];this['countbusyretry']=_0x9ae2c6[_0xb93e('0x8')];this[_0xb93e('0x9')]=_0x9ae2c6['countcongestionretry'];this[_0xb93e('0xa')]=_0x9ae2c6[_0xb93e('0xa')];this[_0xb93e('0xb')]=_0x9ae2c6[_0xb93e('0x8')]+_0x9ae2c6[_0xb93e('0x9')]+_0x9ae2c6[_0xb93e('0xa')]+_0x9ae2c6['countnosuchnumberretry']+_0x9ae2c6[_0xb93e('0xc')]+_0x9ae2c6[_0xb93e('0xd')]+_0x9ae2c6[_0xb93e('0xe')]+_0x9ae2c6[_0xb93e('0xf')];this[_0xb93e('0x10')]=_0x9ae2c6[_0xb93e('0x10')];this['countdropretry']=_0x9ae2c6['countdropretry'];this[_0xb93e('0xd')]=_0x9ae2c6[_0xb93e('0xd')];this[_0xb93e('0xe')]=_0x9ae2c6['countmachineretry'];this[_0xb93e('0xf')]=_0x9ae2c6[_0xb93e('0xf')];this[_0xb93e('0x11')]=_0x3b955f['uniqueid'];this[_0xb93e('0x12')]=_0x9ae2c6['name'];this[_0xb93e('0x13')]=_0x9ae2c6[_0xb93e('0x14')];this[_0xb93e('0x15')]=_0x9ae2c6[_0xb93e('0x15')];this[_0xb93e('0x16')]=_0x9ae2c6[_0xb93e('0x16')];this[_0xb93e('0x17')]=moment()[_0xb93e('0x18')](_0xb93e('0x19'));this['ringtime']=utils[_0xb93e('0x1a')](_0x9ae2c6['responsetime'],_0x9ae2c6[_0xb93e('0x15')]);this[_0xb93e('0x1b')]=0x0;this['talktime']=utils['getSeconds'](this[_0xb93e('0x17')],_0x9ae2c6['responsetime']);this[_0xb93e('0x1c')]=_0x9ae2c6[_0xb93e('0x1c')];this[_0xb93e('0x1d')]=_0xb93e('0x1e');this[_0xb93e('0x1f')]=_0x3b955f['cause-txt'];this['callback']=_0x9ae2c6[_0xb93e('0x20')];this[_0xb93e('0x21')]=_0x9ae2c6[_0xb93e('0x21')];this[_0xb93e('0x22')]=_0x9ae2c6[_0xb93e('0x22')];this['recallme']=_0x9ae2c6[_0xb93e('0x23')];this[_0xb93e('0x24')]=_0x9ae2c6[_0xb93e('0x24')];this[_0xb93e('0x25')]=_0x9ae2c6['ListId'];this['UserId']=_0x9ae2c6['UserId'];this[_0xb93e('0x26')]=_0x9ae2c6[_0xb93e('0x26')];this[_0xb93e('0x27')]=_0x9ae2c6['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0xa187=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','name','calleridnum','starttime','responsetime'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa187,0x149));var _0x7a18=function(_0x1c445a,_0xea7543){_0x1c445a=_0x1c445a-0x0;var _0x33e4ad=_0xa187[_0x1c445a];return _0x33e4ad;};'use strict';var moment=require(_0x7a18('0x0'));var utils=require('../utils');function Hangup(_0x38d22d,_0x9c425b){this[_0x7a18('0x1')]=0x4;this[_0x7a18('0x2')]=_0x7a18('0x3');this[_0x7a18('0x4')]=_0x38d22d[_0x7a18('0x4')];this[_0x7a18('0x5')]=_0x38d22d[_0x7a18('0x5')];this[_0x7a18('0x6')]=_0x38d22d['type']===_0x7a18('0x7')?_0x7a18('0x8'):_0x38d22d[_0x7a18('0x5')];this['amd']=_0x38d22d[_0x7a18('0x9')]||![];this['countbusyretry']=_0x38d22d[_0x7a18('0xa')];this[_0x7a18('0xb')]=_0x38d22d[_0x7a18('0xb')];this['countnoanswerretry']=_0x38d22d[_0x7a18('0xc')];this['countglobal']=_0x38d22d['countbusyretry']+_0x38d22d[_0x7a18('0xb')]+_0x38d22d[_0x7a18('0xc')]+_0x38d22d[_0x7a18('0xd')]+_0x38d22d[_0x7a18('0xe')]+_0x38d22d['countabandonedretry']+_0x38d22d[_0x7a18('0xf')]+_0x38d22d[_0x7a18('0x10')];this[_0x7a18('0xd')]=_0x38d22d[_0x7a18('0xd')];this[_0x7a18('0xe')]=_0x38d22d[_0x7a18('0xe')];this[_0x7a18('0x11')]=_0x38d22d[_0x7a18('0x11')];this[_0x7a18('0xf')]=_0x38d22d['countmachineretry'];this['countagentrejectretry']=_0x38d22d[_0x7a18('0x10')];this[_0x7a18('0x12')]=_0x9c425b[_0x7a18('0x12')];this['calleridname']=_0x38d22d[_0x7a18('0x13')];this[_0x7a18('0x14')]=_0x38d22d['number'];this[_0x7a18('0x15')]=_0x38d22d[_0x7a18('0x15')];this[_0x7a18('0x16')]=_0x38d22d[_0x7a18('0x16')];this[_0x7a18('0x17')]=moment()[_0x7a18('0x18')](_0x7a18('0x19'));this[_0x7a18('0x1a')]=utils[_0x7a18('0x1b')](_0x38d22d[_0x7a18('0x16')],_0x38d22d[_0x7a18('0x15')]);this[_0x7a18('0x1c')]=0x0;this[_0x7a18('0x1d')]=utils[_0x7a18('0x1b')](this[_0x7a18('0x17')],_0x38d22d['responsetime']);this['queue']=_0x38d22d[_0x7a18('0x8')];this[_0x7a18('0x1e')]=_0x7a18('0x1f');this[_0x7a18('0x20')]=_0x9c425b[_0x7a18('0x21')];this[_0x7a18('0x22')]=_0x38d22d[_0x7a18('0x22')];this[_0x7a18('0x23')]=_0x38d22d['callbackuniqueid'];this[_0x7a18('0x24')]=_0x38d22d[_0x7a18('0x24')];this[_0x7a18('0x25')]=_0x38d22d[_0x7a18('0x25')];this['ContactId']=_0x38d22d[_0x7a18('0x26')];this[_0x7a18('0x27')]=_0x38d22d[_0x7a18('0x27')];this['UserId']=_0x38d22d[_0x7a18('0x28')];this[_0x7a18('0x29')]=_0x38d22d[_0x7a18('0x29')];this[_0x7a18('0x2a')]=_0x38d22d[_0x7a18('0x2a')];}module[_0x7a18('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 1b516e1..c7f9e78 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 _0x4d52=['countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4d52,0x1b4));var _0x24d5=function(_0x15173d,_0xe400fb){_0x15173d=_0x15173d-0x0;var _0x51064d=_0x4d52[_0x15173d];return _0x51064d;};'use strict';var utils=require(_0x24d5('0x0'));function History(_0xa9a765){this[_0x24d5('0x1')]=_0xa9a765[_0x24d5('0x1')];this[_0x24d5('0x2')]=_0xa9a765[_0x24d5('0x2')]||undefined;this[_0x24d5('0x3')]=_0xa9a765[_0x24d5('0x3')];this[_0x24d5('0x4')]=_0xa9a765['type']===_0x24d5('0x5')?_0x24d5('0x6'):_0xa9a765[_0x24d5('0x3')];this[_0x24d5('0x7')]=_0xa9a765[_0x24d5('0x7')];this[_0x24d5('0x8')]=_0xa9a765[_0x24d5('0x8')];this[_0x24d5('0x9')]=_0xa9a765['countnoanswerretry'];this[_0x24d5('0xa')]=_0xa9a765['countbusyretry']+_0xa9a765[_0x24d5('0x8')]+_0xa9a765['countnoanswerretry']+_0xa9a765[_0x24d5('0xb')]+_0xa9a765[_0x24d5('0xc')]+_0xa9a765[_0x24d5('0xd')]+_0xa9a765['countmachineretry']+_0xa9a765[_0x24d5('0xe')];this['countnosuchnumberretry']=_0xa9a765['countnosuchnumberretry'];this[_0x24d5('0xc')]=_0xa9a765[_0x24d5('0xc')];this[_0x24d5('0xd')]=_0xa9a765['countabandonedretry'];this[_0x24d5('0xf')]=_0xa9a765[_0x24d5('0xf')];this[_0x24d5('0xe')]=_0xa9a765[_0x24d5('0xe')];this[_0x24d5('0x6')]=_0xa9a765[_0x24d5('0x6')];this[_0x24d5('0x10')]=_0xa9a765[_0x24d5('0x11')];this[_0x24d5('0x12')]=_0xa9a765[_0x24d5('0x13')];this[_0x24d5('0x14')]=_0xa9a765[_0x24d5('0x14')];this[_0x24d5('0x15')]=_0xa9a765[_0x24d5('0x15')];this[_0x24d5('0x16')]=_0xa9a765[_0x24d5('0x15')];this['ringtime']=utils[_0x24d5('0x17')](_0xa9a765[_0x24d5('0x15')],_0xa9a765[_0x24d5('0x14')]);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0xa9a765[_0x24d5('0x18')];this['callbackuniqueid']=_0xa9a765[_0x24d5('0x19')];this[_0x24d5('0x1a')]=_0xa9a765[_0x24d5('0x1a')];this['recallme']=_0xa9a765['recallme'];this[_0x24d5('0x1b')]=_0xa9a765[_0x24d5('0x1b')];this[_0x24d5('0x1c')]=_0xa9a765[_0x24d5('0x1c')];this[_0x24d5('0x1d')]=_0xa9a765[_0x24d5('0x1d')];this[_0x24d5('0x1e')]=_0xa9a765[_0x24d5('0x1e')];this[_0x24d5('0x1f')]=_0xa9a765[_0x24d5('0x1f')];this[_0x24d5('0x20')]=_0xa9a765[_0x24d5('0x20')]||'';this[_0x24d5('0x21')]=_0xa9a765[_0x24d5('0x21')]||'';this['state']=_0xa9a765[_0x24d5('0x22')];this[_0x24d5('0x23')]=_0xa9a765[_0x24d5('0x23')];}module[_0x24d5('0x24')]=History; \ No newline at end of file +var _0x0a0a=['countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry'];(function(_0x30b159,_0x3fbb50){var _0x23c3f9=function(_0xa21305){while(--_0xa21305){_0x30b159['push'](_0x30b159['shift']());}};_0x23c3f9(++_0x3fbb50);}(_0x0a0a,0xc9));var _0xa0a0=function(_0x1bc4ac,_0x297a7f){_0x1bc4ac=_0x1bc4ac-0x0;var _0x42938f=_0x0a0a[_0x1bc4ac];return _0x42938f;};'use strict';var utils=require(_0xa0a0('0x0'));function History(_0x3b752e){this['uniqueid']=_0x3b752e[_0xa0a0('0x1')];this[_0xa0a0('0x2')]=_0x3b752e[_0xa0a0('0x2')]||undefined;this[_0xa0a0('0x3')]=_0x3b752e[_0xa0a0('0x3')];this[_0xa0a0('0x4')]=_0x3b752e['type']===_0xa0a0('0x5')?_0xa0a0('0x6'):_0x3b752e[_0xa0a0('0x3')];this[_0xa0a0('0x7')]=_0x3b752e[_0xa0a0('0x7')];this[_0xa0a0('0x8')]=_0x3b752e[_0xa0a0('0x8')];this['countnoanswerretry']=_0x3b752e[_0xa0a0('0x9')];this['countglobal']=_0x3b752e['countbusyretry']+_0x3b752e[_0xa0a0('0x8')]+_0x3b752e[_0xa0a0('0x9')]+_0x3b752e[_0xa0a0('0xa')]+_0x3b752e[_0xa0a0('0xb')]+_0x3b752e[_0xa0a0('0xc')]+_0x3b752e[_0xa0a0('0xd')]+_0x3b752e[_0xa0a0('0xe')];this[_0xa0a0('0xa')]=_0x3b752e[_0xa0a0('0xa')];this['countdropretry']=_0x3b752e[_0xa0a0('0xb')];this[_0xa0a0('0xc')]=_0x3b752e['countabandonedretry'];this[_0xa0a0('0xd')]=_0x3b752e[_0xa0a0('0xd')];this[_0xa0a0('0xe')]=_0x3b752e[_0xa0a0('0xe')];this[_0xa0a0('0x6')]=_0x3b752e[_0xa0a0('0x6')];this['calleridname']=_0x3b752e[_0xa0a0('0xf')];this[_0xa0a0('0x10')]=_0x3b752e[_0xa0a0('0x11')];this[_0xa0a0('0x12')]=_0x3b752e[_0xa0a0('0x12')];this[_0xa0a0('0x13')]=_0x3b752e[_0xa0a0('0x13')];this[_0xa0a0('0x14')]=_0x3b752e[_0xa0a0('0x13')];this[_0xa0a0('0x15')]=utils[_0xa0a0('0x16')](_0x3b752e[_0xa0a0('0x13')],_0x3b752e[_0xa0a0('0x12')]);this['holdtime']=0x0;this['talktime']=0x0;this[_0xa0a0('0x17')]=_0x3b752e[_0xa0a0('0x17')];this[_0xa0a0('0x18')]=_0x3b752e[_0xa0a0('0x18')];this[_0xa0a0('0x19')]=_0x3b752e['callbackat'];this[_0xa0a0('0x1a')]=_0x3b752e[_0xa0a0('0x1a')];this['ContactId']=_0x3b752e['ContactId'];this[_0xa0a0('0x1b')]=_0x3b752e['ListId'];this[_0xa0a0('0x1c')]=_0x3b752e['UserId'];this[_0xa0a0('0x1d')]=_0x3b752e['VoiceQueueId'];this[_0xa0a0('0x1e')]=_0x3b752e['CampaignId'];this[_0xa0a0('0x1f')]=_0x3b752e['originatecalleridnum']||'';this[_0xa0a0('0x20')]=_0x3b752e[_0xa0a0('0x20')]||'';this[_0xa0a0('0x21')]=_0x3b752e[_0xa0a0('0x21')];this[_0xa0a0('0x22')]=_0x3b752e['statedesc'];}module['exports']=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 65ef468..8a1bba4 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 _0xfc23=['state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xfc23,0x16b));var _0x3fc2=function(_0x5fe5ab,_0x5660b6){_0x5fe5ab=_0x5fe5ab-0x0;var _0x3eb945=_0xfc23[_0x5fe5ab];return _0x3eb945;};'use strict';var utils=require(_0x3fc2('0x0'));function QueueCallerAbandon(_0x255f1b,_0x213625){this[_0x3fc2('0x1')]=_0x255f1b[_0x3fc2('0x1')];this[_0x3fc2('0x2')]=_0x255f1b[_0x3fc2('0x2')];this[_0x3fc2('0x3')]=_0x255f1b[_0x3fc2('0x2')]===_0x3fc2('0x4')?_0x3fc2('0x5'):_0x255f1b[_0x3fc2('0x2')];this[_0x3fc2('0x6')]=_0x255f1b[_0x3fc2('0x6')];this['countcongestionretry']=_0x255f1b[_0x3fc2('0x7')];this['countnoanswerretry']=_0x255f1b[_0x3fc2('0x8')];this['countglobal']=_0x255f1b[_0x3fc2('0x6')]+_0x255f1b['countcongestionretry']+_0x255f1b[_0x3fc2('0x8')]+_0x255f1b[_0x3fc2('0x9')]+_0x255f1b[_0x3fc2('0xa')]+_0x255f1b[_0x3fc2('0xb')]+_0x255f1b[_0x3fc2('0xc')]+_0x255f1b[_0x3fc2('0xd')];this['countnosuchnumberretry']=_0x255f1b[_0x3fc2('0x9')];this[_0x3fc2('0xa')]=_0x255f1b[_0x3fc2('0xa')];this[_0x3fc2('0xb')]=_0x255f1b[_0x3fc2('0xb')];this[_0x3fc2('0xc')]=_0x255f1b[_0x3fc2('0xc')];this['countagentrejectretry']=_0x255f1b[_0x3fc2('0xd')];this[_0x3fc2('0xe')]=_0x213625['uniqueid'];this[_0x3fc2('0xf')]=_0x255f1b[_0x3fc2('0x10')];this[_0x3fc2('0x11')]=_0x255f1b[_0x3fc2('0x12')];this[_0x3fc2('0x13')]=_0x255f1b['starttime'];this[_0x3fc2('0x14')]=_0x255f1b[_0x3fc2('0x14')];this[_0x3fc2('0x15')]=_0x255f1b[_0x3fc2('0x15')];this[_0x3fc2('0x16')]=_0x255f1b['dropreason'];this[_0x3fc2('0x17')]=this['droptime'];this[_0x3fc2('0x18')]=utils[_0x3fc2('0x19')](_0x255f1b[_0x3fc2('0x14')],_0x255f1b['starttime']);this[_0x3fc2('0x1a')]=utils[_0x3fc2('0x19')](this[_0x3fc2('0x15')],_0x255f1b[_0x3fc2('0x14')]);this[_0x3fc2('0x1b')]=0x0;this['queue']=_0x213625[_0x3fc2('0x5')];this['membername']=_0x213625[_0x3fc2('0x1c')];this[_0x3fc2('0x1d')]=_0x213625['reason'];this[_0x3fc2('0x1e')]=_0x255f1b[_0x3fc2('0x1e')];this[_0x3fc2('0x1f')]=_0x255f1b[_0x3fc2('0x1f')];this[_0x3fc2('0x20')]=_0x255f1b[_0x3fc2('0x20')];this[_0x3fc2('0x21')]=_0x255f1b['recallme'];this[_0x3fc2('0x22')]=_0x255f1b[_0x3fc2('0x22')];this[_0x3fc2('0x23')]=_0x255f1b[_0x3fc2('0x23')];this[_0x3fc2('0x24')]=_0x255f1b[_0x3fc2('0x24')];this[_0x3fc2('0x25')]=_0x255f1b[_0x3fc2('0x25')];this['CampaignId']=_0x255f1b[_0x3fc2('0x26')];this['originatecalleridnum']=_0x255f1b[_0x3fc2('0x27')]||'';this[_0x3fc2('0x28')]=_0x255f1b[_0x3fc2('0x28')]||'';this['agiafterat']=_0x255f1b[_0x3fc2('0x29')];this[_0x3fc2('0x2a')]=_0x255f1b[_0x3fc2('0x2a')];this[_0x3fc2('0x2b')]=_0x255f1b['statedesc'];}module[_0x3fc2('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0xfe42=['countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry'];(function(_0x131916,_0x8eb089){var _0x283e61=function(_0x285d52){while(--_0x285d52){_0x131916['push'](_0x131916['shift']());}};_0x283e61(++_0x8eb089);}(_0xfe42,0x97));var _0x2fe4=function(_0x4183b1,_0x4698c6){_0x4183b1=_0x4183b1-0x0;var _0x56d716=_0xfe42[_0x4183b1];return _0x56d716;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x1b9e95,_0x46392e){this[_0x2fe4('0x0')]=_0x1b9e95['scheduledat'];this[_0x2fe4('0x1')]=_0x1b9e95[_0x2fe4('0x1')];this[_0x2fe4('0x2')]=_0x1b9e95[_0x2fe4('0x1')]===_0x2fe4('0x3')?_0x2fe4('0x4'):_0x1b9e95[_0x2fe4('0x1')];this['countbusyretry']=_0x1b9e95[_0x2fe4('0x5')];this[_0x2fe4('0x6')]=_0x1b9e95['countcongestionretry'];this['countnoanswerretry']=_0x1b9e95['countnoanswerretry'];this['countglobal']=_0x1b9e95[_0x2fe4('0x5')]+_0x1b9e95[_0x2fe4('0x6')]+_0x1b9e95[_0x2fe4('0x7')]+_0x1b9e95[_0x2fe4('0x8')]+_0x1b9e95[_0x2fe4('0x9')]+_0x1b9e95[_0x2fe4('0xa')]+_0x1b9e95['countmachineretry']+_0x1b9e95[_0x2fe4('0xb')];this[_0x2fe4('0x8')]=_0x1b9e95[_0x2fe4('0x8')];this[_0x2fe4('0x9')]=_0x1b9e95[_0x2fe4('0x9')];this[_0x2fe4('0xa')]=_0x1b9e95[_0x2fe4('0xa')];this[_0x2fe4('0xc')]=_0x1b9e95[_0x2fe4('0xc')];this[_0x2fe4('0xb')]=_0x1b9e95[_0x2fe4('0xb')];this[_0x2fe4('0xd')]=_0x46392e['uniqueid'];this['calleridname']=_0x1b9e95[_0x2fe4('0xe')];this[_0x2fe4('0xf')]=_0x1b9e95[_0x2fe4('0x10')];this[_0x2fe4('0x11')]=_0x1b9e95[_0x2fe4('0x11')];this[_0x2fe4('0x12')]=_0x1b9e95[_0x2fe4('0x12')];this[_0x2fe4('0x13')]=_0x1b9e95['droptime'];this[_0x2fe4('0x14')]=_0x1b9e95['dropreason'];this['endtime']=this[_0x2fe4('0x13')];this[_0x2fe4('0x15')]=utils[_0x2fe4('0x16')](_0x1b9e95[_0x2fe4('0x12')],_0x1b9e95[_0x2fe4('0x11')]);this[_0x2fe4('0x17')]=utils[_0x2fe4('0x16')](this[_0x2fe4('0x13')],_0x1b9e95['responsetime']);this['talktime']=0x0;this[_0x2fe4('0x4')]=_0x46392e[_0x2fe4('0x4')];this['membername']=_0x46392e['connectedlinename'];this[_0x2fe4('0x18')]=_0x46392e[_0x2fe4('0x18')];this[_0x2fe4('0x19')]=_0x1b9e95[_0x2fe4('0x19')];this[_0x2fe4('0x1a')]=_0x1b9e95['callbackuniqueid'];this[_0x2fe4('0x1b')]=_0x1b9e95[_0x2fe4('0x1b')];this[_0x2fe4('0x1c')]=_0x1b9e95[_0x2fe4('0x1c')];this[_0x2fe4('0x1d')]=_0x1b9e95[_0x2fe4('0x1d')];this['ListId']=_0x1b9e95[_0x2fe4('0x1e')];this[_0x2fe4('0x1f')]=_0x1b9e95[_0x2fe4('0x1f')];this[_0x2fe4('0x20')]=_0x1b9e95[_0x2fe4('0x20')];this[_0x2fe4('0x21')]=_0x1b9e95[_0x2fe4('0x21')];this['originatecalleridnum']=_0x1b9e95[_0x2fe4('0x22')]||'';this[_0x2fe4('0x23')]=_0x1b9e95[_0x2fe4('0x23')]||'';this[_0x2fe4('0x24')]=_0x1b9e95[_0x2fe4('0x24')];this[_0x2fe4('0x25')]=_0x1b9e95['state'];this[_0x2fe4('0x26')]=_0x1b9e95[_0x2fe4('0x26')];}module[_0x2fe4('0x27')]=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 968e639..492b94e 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 _0xfcf0=['[avgHandleTime]','createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime'];(function(_0xe7d6cc,_0x47ca49){var _0xb8a74d=function(_0x42b6c6){while(--_0x42b6c6){_0xe7d6cc['push'](_0xe7d6cc['shift']());}};_0xb8a74d(++_0x47ca49);}(_0xfcf0,0x138));var _0x0fcf=function(_0xdaab62,_0x2728ab){_0xdaab62=_0xdaab62-0x0;var _0x13d767=_0xfcf0[_0xdaab62];return _0x13d767;};'use strict';var util=require(_0x0fcf('0x0'));var logger=require(_0x0fcf('0x1'))('dialer');var cmHopper=require(_0x0fcf('0x2'));var cmHopperAdditionalPhone=require(_0x0fcf('0x3'));var cmHopperBlack=require(_0x0fcf('0x4'));var cmHopperHistory=require(_0x0fcf('0x5'));function inspectError(_0x5c865e){return util[_0x0fcf('0x6')](_0x5c865e,{'showHidden':![],'depth':null});}function getContactDialer(_0x265968,_0x3bd34d,_0x3af316){return cmHopper[_0x0fcf('0x7')](_0x265968['id'],_0x3bd34d,_0x3af316,_0x265968[_0x0fcf('0x8')])[_0x0fcf('0x9')](function(_0x2dfdf8){_0x265968['temp']=0x0;logger[_0x0fcf('0xa')](_0x0fcf('0xb'),inspectError(_0x2dfdf8));});}exports[_0x0fcf('0x7')]=getContactDialer;function getContactDialerIvr(_0x4de593,_0x69a840){return cmHopper[_0x0fcf('0xc')](_0x4de593['id'],_0x69a840,_0x4de593[_0x0fcf('0x8')])['catch'](function(_0x369959){_0x4de593['temp']=0x0;logger[_0x0fcf('0xa')](_0x0fcf('0xd'),inspectError(_0x369959));});}exports[_0x0fcf('0xc')]=getContactDialerIvr;function countReScheduled(_0x48619c){return cmHopper['countReScheduled'](_0x48619c)[_0x0fcf('0x9')](function(_0x3c999e){logger['error'](_0x0fcf('0xe'),inspectError(_0x3c999e));});}exports[_0x0fcf('0xf')]=countReScheduled;function rescheduleContact(_0x160d2c){return cmHopper[_0x0fcf('0x10')](_0x160d2c)[_0x0fcf('0x9')](function(_0x48bba6){logger[_0x0fcf('0xa')](_0x0fcf('0x11'),inspectError(_0x48bba6));});}exports[_0x0fcf('0x10')]=rescheduleContact;function unlockContact(_0x5e867f,_0x3c09c4,_0x610106){return cmHopper[_0x0fcf('0x12')](_0x5e867f,_0x3c09c4,_0x610106)[_0x0fcf('0x9')](function(_0x48dd53){logger[_0x0fcf('0xa')](_0x0fcf('0x13'),inspectError(_0x48dd53));});}exports[_0x0fcf('0x12')]=unlockContact;function moveContactManagedDialer(_0x8581bd){return cmHopper[_0x0fcf('0x14')](_0x8581bd)['catch'](function(_0x18ea32){logger[_0x0fcf('0xa')]('[moveContactManagedDialer]',inspectError(_0x18ea32));});}exports[_0x0fcf('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x1b9a90){return cmHopperBlack['checkIsBlackList'](_0x1b9a90)[_0x0fcf('0x9')](function(_0x50ac4a){logger[_0x0fcf('0xa')](_0x0fcf('0x15'),inspectError(_0x50ac4a));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x457880){return cmHopperBlack[_0x0fcf('0x16')](_0x457880)[_0x0fcf('0x9')](function(_0x5c459c){logger[_0x0fcf('0xa')](_0x0fcf('0x17'),inspectError(_0x5c459c));});}exports[_0x0fcf('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x41b20b,_0x18af5c,_0x30e1b0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x41b20b,_0x18af5c,_0x30e1b0)[_0x0fcf('0x9')](function(_0x253641){logger[_0x0fcf('0xa')](_0x0fcf('0x18'),inspectError(_0x253641));});}exports[_0x0fcf('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x3cf074,_0x2ce990,_0x18f269){return cmHopperAdditionalPhone[_0x0fcf('0x1a')](_0x3cf074,_0x2ce990,_0x18f269)['catch'](function(_0x18965e){logger[_0x0fcf('0xa')](_0x0fcf('0x1b'),inspectError(_0x18965e));});}exports[_0x0fcf('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x3876ed){return cmHopperHistory[_0x0fcf('0x1c')](_0x3876ed)[_0x0fcf('0x9')](function(_0x527d43){logger[_0x0fcf('0xa')](_0x0fcf('0x1d'),inspectError(_0x527d43));});}exports[_0x0fcf('0x1c')]=avgHandleTime;function createHistory(_0x35180d){return cmHopperHistory['createHistory'](_0x35180d)['catch'](function(_0x4af80d){logger[_0x0fcf('0xa')]('[createHistory]',inspectError(_0x4af80d));});}exports[_0x0fcf('0x1e')]=createHistory; \ No newline at end of file +var _0xa46e=['getContactDialerIvr','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime','createHistory','[createHistory]','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]'];(function(_0x2142ea,_0x5a8f39){var _0x53e2a9=function(_0xd6a441){while(--_0xd6a441){_0x2142ea['push'](_0x2142ea['shift']());}};_0x53e2a9(++_0x5a8f39);}(_0xa46e,0x8a));var _0xea46=function(_0x1ae31c,_0x8dcd2d){_0x1ae31c=_0x1ae31c-0x0;var _0x19519d=_0xa46e[_0x1ae31c];return _0x19519d;};'use strict';var util=require(_0xea46('0x0'));var logger=require(_0xea46('0x1'))('dialer');var cmHopper=require(_0xea46('0x2'));var cmHopperAdditionalPhone=require(_0xea46('0x3'));var cmHopperBlack=require(_0xea46('0x4'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x19f135){return util['inspect'](_0x19f135,{'showHidden':![],'depth':null});}function getContactDialer(_0x3a2209,_0x47d633,_0x3599fc){return cmHopper['getContactDialer'](_0x3a2209['id'],_0x47d633,_0x3599fc,_0x3a2209[_0xea46('0x5')])[_0xea46('0x6')](function(_0x5f1cd1){_0x3a2209[_0xea46('0x7')]=0x0;logger[_0xea46('0x8')](_0xea46('0x9'),inspectError(_0x5f1cd1));});}exports[_0xea46('0xa')]=getContactDialer;function getContactDialerIvr(_0x468322,_0x4cf206){return cmHopper['getContactDialerIvr'](_0x468322['id'],_0x4cf206,_0x468322['dialOrderByScheduledAt'])[_0xea46('0x6')](function(_0x45550a){_0x468322['temp']=0x0;logger[_0xea46('0x8')](_0xea46('0xb'),inspectError(_0x45550a));});}exports[_0xea46('0xc')]=getContactDialerIvr;function countReScheduled(_0x594694){return cmHopper[_0xea46('0xd')](_0x594694)[_0xea46('0x6')](function(_0x4e10f3){logger[_0xea46('0x8')](_0xea46('0xe'),inspectError(_0x4e10f3));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x20955e){return cmHopper['rescheduleContact'](_0x20955e)[_0xea46('0x6')](function(_0x42c328){logger[_0xea46('0x8')](_0xea46('0xf'),inspectError(_0x42c328));});}exports[_0xea46('0x10')]=rescheduleContact;function unlockContact(_0x2ef436,_0x81ee45,_0x20a79c){return cmHopper[_0xea46('0x11')](_0x2ef436,_0x81ee45,_0x20a79c)['catch'](function(_0x2fa2f9){logger[_0xea46('0x8')](_0xea46('0x12'),inspectError(_0x2fa2f9));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x58b4da){return cmHopper[_0xea46('0x13')](_0x58b4da)[_0xea46('0x6')](function(_0x5cf5dd){logger['error'](_0xea46('0x14'),inspectError(_0x5cf5dd));});}exports[_0xea46('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ff93d){return cmHopperBlack[_0xea46('0x15')](_0x4ff93d)[_0xea46('0x6')](function(_0x1adba1){logger[_0xea46('0x8')]('[checkIsBlackList]',inspectError(_0x1adba1));});}exports[_0xea46('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x4e220f){return cmHopperBlack['checkIsBlackListIvr'](_0x4e220f)[_0xea46('0x6')](function(_0x59e431){logger['error']('[checkIsBlackListIvr]',inspectError(_0x59e431));});}exports[_0xea46('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x36f982,_0x3d1850,_0x5beb44){return cmHopperAdditionalPhone[_0xea46('0x17')](_0x36f982,_0x3d1850,_0x5beb44)['catch'](function(_0x12e688){logger[_0xea46('0x8')]('[verifyAdditionalPhone]',inspectError(_0x12e688));});}exports[_0xea46('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5480eb,_0x2b3a8f,_0x114bf9){return cmHopperAdditionalPhone[_0xea46('0x18')](_0x5480eb,_0x2b3a8f,_0x114bf9)['catch'](function(_0x5d2de1){logger[_0xea46('0x8')](_0xea46('0x19'),inspectError(_0x5d2de1));});}exports['swapAdditionalPhones']=swapAdditionalPhones;function avgHandleTime(_0x3b3928){return cmHopperHistory['avgHandleTime'](_0x3b3928)[_0xea46('0x6')](function(_0x51ca27){logger[_0xea46('0x8')](_0xea46('0x1a'),inspectError(_0x51ca27));});}exports[_0xea46('0x1b')]=avgHandleTime;function createHistory(_0x44517d){return cmHopperHistory[_0xea46('0x1c')](_0x44517d)[_0xea46('0x6')](function(_0x4a5149){logger[_0xea46('0x8')](_0xea46('0x1d'),inspectError(_0x4a5149));});}exports[_0xea46('0x1c')]=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 249d460..9e071c5 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 _0x1b5c=['waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','updatedAt','undefined','XMD-','util','../../../../config/logger','dialer','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x1b5c,0x89));var _0xc1b5=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x1b5c[_0x187718];return _0x29ddf4;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xc1b5('0x0'));var logger=require(_0xc1b5('0x1'))(_0xc1b5('0x2'));var timezones=require('../../../../config/environment/shared')[_0xc1b5('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0xc1b5('0x4'),'BLACKLIST':_0xc1b5('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xc1b5('0x6'),'DISACTIVED':_0xc1b5('0x7'),'EMPTY_INTERVAL':_0xc1b5('0x8'),'INACTIVE':_0xc1b5('0x9'),'NO_AGENTS_LOGGED':_0xc1b5('0xa'),'NO_AVAILABLE_CONTACTS':_0xc1b5('0xb'),'NULL_INTERVAL':_0xc1b5('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xc1b5('0xd'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0xc1b5('0xe'),'RUNNING':_0xc1b5('0xf'),'UNKNOWN_TIMEZONE':_0xc1b5('0x10'),'UNREACHABLE_TRUNK':_0xc1b5('0x11')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x15eabc){return _0x15eabc[_0xc1b5('0x12')]===_0xc1b5('0x13');}exports[_0xc1b5('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x11b7e5){return _0x11b7e5[_0xc1b5('0x15')]===_0xc1b5('0x16');}exports[_0xc1b5('0x17')]=isIVRCampaign;function isOutboundQueue(_0x1df678){return _0x1df678[_0xc1b5('0x15')]===_0xc1b5('0x18');}exports[_0xc1b5('0x19')]=isOutboundQueue;function isQueueCampaignActive(_0x40d9ba){return _0x40d9ba['dialActive'];}exports[_0xc1b5('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2458ee){return _0x2458ee[_0xc1b5('0x1b')];}exports[_0xc1b5('0x1c')]=isIVRCampaignActive;function getSeconds(_0x2ba8c0,_0x50126e){var _0x423a17=moment(_0x2ba8c0)[_0xc1b5('0x1d')](0x0);var _0x431287=moment(_0x50126e)[_0xc1b5('0x1d')](0x0);return _0x423a17[_0xc1b5('0x1e')](_0x431287,'seconds');}exports[_0xc1b5('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x1c0930,_0x23adc4){var _0x5ab03e=![];var _0x5cbb0d=_0x1c0930[_0xc1b5('0x12')]!==_0x23adc4[_0xc1b5('0x12')]||_0x1c0930['dialActive']!==_0x23adc4['dialActive']||_0x1c0930[_0xc1b5('0x20')]!==_0x23adc4[_0xc1b5('0x20')];var _0xe0316d=_0x1c0930['available']!==_0x23adc4[_0xc1b5('0x21')]||_0x1c0930[_0xc1b5('0x22')]!==_0x23adc4[_0xc1b5('0x22')]||_0x1c0930[_0xc1b5('0x23')]!==_0x23adc4['loggedInDb']||_0x1c0930[_0xc1b5('0x24')]!==_0x23adc4[_0xc1b5('0x24')]||_0x1c0930[_0xc1b5('0x25')]!==_0x23adc4['talking']||_0x1c0930[_0xc1b5('0x26')]!==_0x23adc4[_0xc1b5('0x26')]||_0x1c0930[_0xc1b5('0x27')]!==_0x23adc4[_0xc1b5('0x27')]||_0x1c0930[_0xc1b5('0x28')]!==_0x23adc4[_0xc1b5('0x28')]||_0x1c0930[_0xc1b5('0x29')]!==_0x23adc4['originated'];if(_0x1c0930[_0xc1b5('0x2a')]&&_0x23adc4[_0xc1b5('0x2a')]){_0x5ab03e=_0x1c0930[_0xc1b5('0x2a')][_0xc1b5('0x2b')]!==_0x23adc4[_0xc1b5('0x2a')][_0xc1b5('0x2b')]||_0x1c0930[_0xc1b5('0x2a')][_0xc1b5('0x1b')]!==_0x23adc4[_0xc1b5('0x2a')][_0xc1b5('0x1b')];}return _0x5cbb0d||_0xe0316d||_0x5ab03e;}exports[_0xc1b5('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x25e6f7){var _0x1e1529=null;var _0x4e5ae8=_0x25e6f7[_0xc1b5('0x2d')];if(_[_0xc1b5('0x2e')](_0x25e6f7[_0xc1b5('0x2f')])||_[_0xc1b5('0x2e')](_0x25e6f7[_0xc1b5('0x30')])||_[_0xc1b5('0x2e')](_0x25e6f7['Interval'][_0xc1b5('0x31')])){_0x1e1529=CAMPAIGN_STATUS[_0xc1b5('0x32')];}else if(_[_0xc1b5('0x33')](_0x25e6f7[_0xc1b5('0x2f')])||_[_0xc1b5('0x33')](_0x25e6f7[_0xc1b5('0x30')][_0xc1b5('0x31')])){_0x1e1529=CAMPAIGN_STATUS[_0xc1b5('0x34')];}else if(_0x4e5ae8&&!timezones[_0x4e5ae8]){_0x1e1529=CAMPAIGN_STATUS[_0xc1b5('0x35')];}return _0x1e1529;}function checkAnyValidTrunk(_0x35cee5,_0x3ae8a7){var _0x4989ba=null;var _0x6c3dfd=_0xc1b5('0x36');var _0x59b584=[_0xc1b5('0x37'),'unmonitored'];var _0x4cdd34=!![];if(_0x35cee5['Trunk']&&_0x35cee5[_0xc1b5('0x2a')][_0xc1b5('0x1b')]){_0x6c3dfd+=_0x35cee5['Trunk'][_0xc1b5('0x2b')];_0x4989ba=_0x3ae8a7[_0x6c3dfd];_0x4cdd34=_0x59b584[_0xc1b5('0x38')](_0x4989ba[_0xc1b5('0x39')]);}else if(_0x35cee5[_0xc1b5('0x3a')]&&_0x35cee5['TrunkBackup'][_0xc1b5('0x1b')]){_0x6c3dfd+=_0x35cee5[_0xc1b5('0x3a')][_0xc1b5('0x2b')];_0x4989ba=_0x3ae8a7[_0x6c3dfd];_0x4cdd34=_0x59b584['includes'](_0x4989ba[_0xc1b5('0x39')]);}return _0x4cdd34;}function getQueueCampaignStatusMessage(_0x5dfed8,_0x15c59f){var _0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x4')];var _0x3f7e28=isPreviewCampaign(_0x5dfed8);if(!isQueueCampaignActive(_0x5dfed8)){if(_0x3f7e28){_0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x3b')];}else{if(_0x5dfed8['originated']===0x0&&_0x5dfed8[_0xc1b5('0x25')]===0x0&&_0x5dfed8['waiting']===0x0&&(_0x5dfed8[_0xc1b5('0x26')]||0x0)===0x0){_0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x3b')];}else{_0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x3c')];}}}else if(_0x5dfed8['loggedIn']===0x0){_0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x3d')];}else if(!checkAnyValidTrunk(_0x5dfed8,_0x15c59f)){_0x1843bd=CAMPAIGN_STATUS[_0xc1b5('0x3e')];}else if(!isPreviewCampaign(_0x5dfed8)){var _0x168127=checkAnyValidQueueCampaignInterval(_0x5dfed8);if(_0x168127){_0x1843bd=_0x168127;}}return _0x1843bd;}exports[_0xc1b5('0x3f')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x540523){var _0x15d199=CAMPAIGN_STATUS[_0xc1b5('0x3c')];if(_0x540523['originated']===0x0&&_0x540523[_0xc1b5('0x25')]===0x0&&_0x540523[_0xc1b5('0x27')]===0x0&&(_0x540523[_0xc1b5('0x26')]||0x0)===0x0){_0x15d199=CAMPAIGN_STATUS['INACTIVE'];}return _0x15d199;}exports[_0xc1b5('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x5d0908){var _0x112828=_0x5d0908[_0xc1b5('0x41')](/"(.*?)"/);return _0x112828?_0x112828[0x1]:_0x5d0908;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x192fc1,_0x4b34b4,_0xd755ae){if(!_['isUndefined'](_0xd755ae)&&typeof _0xd755ae===_0xc1b5('0x42')&&!_[_0xc1b5('0x33')](_0xd755ae)){if(!_[_0xc1b5('0x43')](_0x4b34b4)&&typeof _0x4b34b4===_0xc1b5('0x42')&&!_[_0xc1b5('0x33')](_0x4b34b4)){return util[_0xc1b5('0x44')](_0xc1b5('0x45'),_0x4b34b4,_0xd755ae);}return util['format'](_0xc1b5('0x45'),_0xd755ae,_0xd755ae);}if(!_['isUndefined'](_0x192fc1)&&typeof _0x192fc1===_0xc1b5('0x42')&&!_[_0xc1b5('0x33')](_0x192fc1)){return _0x192fc1;}return _0xc1b5('0x46');}exports[_0xc1b5('0x47')]=getCallerId;function getCallerIdRandom(_0x216ac0,_0xf17c8c){var _0x2b2c74;var _0x27f881;var _0x4e209b;if(_0xf17c8c<=0x0){_0xf17c8c=0x1;}_0x2b2c74=new RegExp(_0xc1b5('0x48')+_0xf17c8c+'}$');_0x27f881=Math[_0xc1b5('0x49')](0xa,_0xf17c8c-0x1);_0x4e209b=Math[_0xc1b5('0x49')](0xa,_0xf17c8c)-0x1;return util[_0xc1b5('0x44')]('%s',_[_0xc1b5('0x4a')](_0x216ac0,_0x2b2c74,_[_0xc1b5('0x4b')](_0x27f881,_0x4e209b)[_0xc1b5('0x4c')]()));}exports[_0xc1b5('0x4d')]=getCallerIdRandom;function decrementOriginate(_0x4bf2e4){if(_0x4bf2e4[_0xc1b5('0x29')]&&_0x4bf2e4[_0xc1b5('0x29')]>0x0){_0x4bf2e4[_0xc1b5('0x29')]-=0x1;}else{logger[_0xc1b5('0x4e')](_0xc1b5('0x4f'));}}exports[_0xc1b5('0x50')]=decrementOriginate;function checkContactEmpty(_0x109882){return _0x109882&&_0x109882['length']>0x0;}exports[_0xc1b5('0x51')]=checkContactEmpty;function erlangb(_0x16bf81,_0x20d6e5){if(_0x20d6e5===0x0){return 0x0;}var _0x3c26fe=0x1;for(var _0x182dc0=0x1;_0x182dc0<=_0x20d6e5;_0x182dc0+=0x1){_0x3c26fe=0x1+_0x3c26fe*_0x182dc0/_0x16bf81;}return 0x1/_0x3c26fe;}exports[_0xc1b5('0x52')]=erlangb;function checkContactLowerLimitOriginate(_0x59b364,_0x1394f1,_0x46b819){if(_0x1394f1>_0x46b819){for(var _0x3aae3b=0x0;_0x3aae3b<_0x1394f1-_0x46b819;_0x3aae3b+=0x1){decrementOriginate(_0x59b364);}}}exports[_0xc1b5('0x53')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4f3f48){var _0x448aea={};var _0x5b77bc=['id','createdAt','description',_0xc1b5('0x54'),_0xc1b5('0x55')];if(_0x4f3f48){for(var _0x48667c in _0x4f3f48){if(typeof _0x4f3f48[_0x48667c]!==_0xc1b5('0x56')){if(!_['isNil'](_0x4f3f48[_0x48667c])&&!_0x5b77bc['includes'](_0x48667c)){_0x448aea[util[_0xc1b5('0x44')]('%s%s',_0xc1b5('0x57'),_0x48667c['toUpperCase']())]=_0x4f3f48[_0x48667c];}}}}return _0x448aea;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0x9f45=['getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','%s%s','toUpperCase','moment','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','dialMethod','preview','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','active','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','SIP/','reachable','unmonitored','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK'];(function(_0x228ce2,_0x4d48f3){var _0x3bf15e=function(_0x3eaa78){while(--_0x3eaa78){_0x228ce2['push'](_0x228ce2['shift']());}};_0x3bf15e(++_0x4d48f3);}(_0x9f45,0x16b));var _0x59f4=function(_0x3d8b21,_0x32f40d){_0x3d8b21=_0x3d8b21-0x0;var _0x5889f8=_0x9f45[_0x3d8b21];return _0x5889f8;};'use strict';var _=require('lodash');var moment=require(_0x59f4('0x0'));var util=require('util');var logger=require(_0x59f4('0x1'))('dialer');var timezones=require(_0x59f4('0x2'))[_0x59f4('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x59f4('0x4'),'BLACKLIST':_0x59f4('0x5'),'CONTACTS_RESCHEDULED':_0x59f4('0x6'),'DEACTIVATED':_0x59f4('0x7'),'DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0x59f4('0x8'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x59f4('0x9'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x59f4('0xa'),'OVERTIME_INTERVAL':_0x59f4('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x59f4('0xc'),'UNKNOWN_TIMEZONE':_0x59f4('0xd'),'UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0xfee607){return _0xfee607[_0x59f4('0xe')]===_0x59f4('0xf');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x1608fb){return _0x1608fb[_0x59f4('0x10')]===_0x59f4('0x11');}exports[_0x59f4('0x12')]=isIVRCampaign;function isOutboundQueue(_0x11fc23){return _0x11fc23['type']===_0x59f4('0x13');}exports[_0x59f4('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x7e645c){return _0x7e645c[_0x59f4('0x15')];}exports[_0x59f4('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4f50d9){return _0x4f50d9['active'];}exports[_0x59f4('0x17')]=isIVRCampaignActive;function getSeconds(_0x169112,_0x1f5d5c){var _0x5a2796=moment(_0x169112)['milliseconds'](0x0);var _0x39a4ff=moment(_0x1f5d5c)[_0x59f4('0x18')](0x0);return _0x5a2796['diff'](_0x39a4ff,_0x59f4('0x19'));}exports[_0x59f4('0x1a')]=getSeconds;function hasQueueCampaignDataChanged(_0x4b3c66,_0x321905){var _0x26f1c4=![];var _0x242b0b=_0x4b3c66['dialMethod']!==_0x321905[_0x59f4('0xe')]||_0x4b3c66[_0x59f4('0x15')]!==_0x321905[_0x59f4('0x15')]||_0x4b3c66[_0x59f4('0x1b')]!==_0x321905[_0x59f4('0x1b')];var _0x107db9=_0x4b3c66[_0x59f4('0x1c')]!==_0x321905[_0x59f4('0x1c')]||_0x4b3c66[_0x59f4('0x1d')]!==_0x321905[_0x59f4('0x1d')]||_0x4b3c66[_0x59f4('0x1e')]!==_0x321905[_0x59f4('0x1e')]||_0x4b3c66[_0x59f4('0x1f')]!==_0x321905[_0x59f4('0x1f')]||_0x4b3c66[_0x59f4('0x20')]!==_0x321905['talking']||_0x4b3c66[_0x59f4('0x21')]!==_0x321905[_0x59f4('0x21')]||_0x4b3c66[_0x59f4('0x22')]!==_0x321905[_0x59f4('0x22')]||_0x4b3c66[_0x59f4('0x23')]!==_0x321905[_0x59f4('0x23')]||_0x4b3c66[_0x59f4('0x24')]!==_0x321905[_0x59f4('0x24')];if(_0x4b3c66['Trunk']&&_0x321905[_0x59f4('0x25')]){_0x26f1c4=_0x4b3c66[_0x59f4('0x25')][_0x59f4('0x26')]!==_0x321905[_0x59f4('0x25')][_0x59f4('0x26')]||_0x4b3c66[_0x59f4('0x25')][_0x59f4('0x27')]!==_0x321905[_0x59f4('0x25')][_0x59f4('0x27')];}return _0x242b0b||_0x107db9||_0x26f1c4;}exports[_0x59f4('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1a5749){var _0x3edee0=null;var _0x4c2b77=_0x1a5749[_0x59f4('0x29')];if(_[_0x59f4('0x2a')](_0x1a5749[_0x59f4('0x2b')])||_['isNil'](_0x1a5749[_0x59f4('0x2c')])||_[_0x59f4('0x2a')](_0x1a5749[_0x59f4('0x2c')][_0x59f4('0x2d')])){_0x3edee0=CAMPAIGN_STATUS[_0x59f4('0x2e')];}else if(_[_0x59f4('0x2f')](_0x1a5749[_0x59f4('0x2b')])||_[_0x59f4('0x2f')](_0x1a5749['Interval'][_0x59f4('0x2d')])){_0x3edee0=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4c2b77&&!timezones[_0x4c2b77]){_0x3edee0=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x3edee0;}function checkAnyValidTrunk(_0x573e5f,_0x54f532){var _0x49318b=null;var _0x4a2d96=_0x59f4('0x30');var _0xd8eaa6=[_0x59f4('0x31'),_0x59f4('0x32')];var _0x343ec7=!![];if(_0x573e5f[_0x59f4('0x25')]&&_0x573e5f[_0x59f4('0x25')][_0x59f4('0x27')]){_0x4a2d96+=_0x573e5f[_0x59f4('0x25')]['name'];_0x49318b=_0x54f532[_0x4a2d96];_0x343ec7=_0xd8eaa6[_0x59f4('0x33')](_0x49318b['status']);}else if(_0x573e5f['TrunkBackup']&&_0x573e5f['TrunkBackup'][_0x59f4('0x27')]){_0x4a2d96+=_0x573e5f[_0x59f4('0x34')][_0x59f4('0x26')];_0x49318b=_0x54f532[_0x4a2d96];_0x343ec7=_0xd8eaa6[_0x59f4('0x33')](_0x49318b[_0x59f4('0x35')]);}return _0x343ec7;}function getQueueCampaignStatusMessage(_0x40d99a,_0x164bdb){var _0x2c88e2=CAMPAIGN_STATUS[_0x59f4('0x4')];var _0x52bec9=isPreviewCampaign(_0x40d99a);if(!isQueueCampaignActive(_0x40d99a)){if(_0x52bec9){_0x2c88e2=CAMPAIGN_STATUS[_0x59f4('0x36')];}else{if(_0x40d99a[_0x59f4('0x24')]===0x0&&_0x40d99a[_0x59f4('0x20')]===0x0&&_0x40d99a['waiting']===0x0&&(_0x40d99a[_0x59f4('0x21')]||0x0)===0x0){_0x2c88e2=CAMPAIGN_STATUS['INACTIVE'];}else{_0x2c88e2=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x40d99a[_0x59f4('0x1d')]===0x0){_0x2c88e2=CAMPAIGN_STATUS[_0x59f4('0x37')];}else if(!checkAnyValidTrunk(_0x40d99a,_0x164bdb)){_0x2c88e2=CAMPAIGN_STATUS[_0x59f4('0x38')];}else if(!isPreviewCampaign(_0x40d99a)){var _0xe02c7f=checkAnyValidQueueCampaignInterval(_0x40d99a);if(_0xe02c7f){_0x2c88e2=_0xe02c7f;}}return _0x2c88e2;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x4ad768){var _0x50ea46=CAMPAIGN_STATUS['DISACTIVED'];if(_0x4ad768['originated']===0x0&&_0x4ad768['talking']===0x0&&_0x4ad768[_0x59f4('0x22')]===0x0&&(_0x4ad768[_0x59f4('0x21')]||0x0)===0x0){_0x50ea46=CAMPAIGN_STATUS['INACTIVE'];}return _0x50ea46;}exports[_0x59f4('0x39')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x9d3f35){var _0x15992b=_0x9d3f35[_0x59f4('0x3a')](/"(.*?)"/);return _0x15992b?_0x15992b[0x1]:_0x9d3f35;}exports[_0x59f4('0x3b')]=extractCalleridName;function getCallerId(_0x208fcd,_0x3daba6,_0x54696d){if(!_[_0x59f4('0x3c')](_0x54696d)&&typeof _0x54696d===_0x59f4('0x3d')&&!_[_0x59f4('0x2f')](_0x54696d)){if(!_[_0x59f4('0x3c')](_0x3daba6)&&typeof _0x3daba6===_0x59f4('0x3d')&&!_['isEmpty'](_0x3daba6)){return util[_0x59f4('0x3e')](_0x59f4('0x3f'),_0x3daba6,_0x54696d);}return util[_0x59f4('0x3e')]('\x22%s\x22\x20<%s>',_0x54696d,_0x54696d);}if(!_[_0x59f4('0x3c')](_0x208fcd)&&typeof _0x208fcd===_0x59f4('0x3d')&&!_[_0x59f4('0x2f')](_0x208fcd)){return _0x208fcd;}return'\x22\x22\x20<>';}exports[_0x59f4('0x40')]=getCallerId;function getCallerIdRandom(_0x137699,_0x10cf46){var _0x308343;var _0xe5b22e;var _0x4e306d;if(_0x10cf46<=0x0){_0x10cf46=0x1;}_0x308343=new RegExp(_0x59f4('0x41')+_0x10cf46+'}$');_0xe5b22e=Math[_0x59f4('0x42')](0xa,_0x10cf46-0x1);_0x4e306d=Math[_0x59f4('0x42')](0xa,_0x10cf46)-0x1;return util['format']('%s',_[_0x59f4('0x43')](_0x137699,_0x308343,_[_0x59f4('0x44')](_0xe5b22e,_0x4e306d)[_0x59f4('0x45')]()));}exports[_0x59f4('0x46')]=getCallerIdRandom;function decrementOriginate(_0x2a1b2e){if(_0x2a1b2e[_0x59f4('0x24')]&&_0x2a1b2e[_0x59f4('0x24')]>0x0){_0x2a1b2e[_0x59f4('0x24')]-=0x1;}else{logger[_0x59f4('0x47')](_0x59f4('0x48'));}}exports[_0x59f4('0x49')]=decrementOriginate;function checkContactEmpty(_0x184352){return _0x184352&&_0x184352[_0x59f4('0x4a')]>0x0;}exports[_0x59f4('0x4b')]=checkContactEmpty;function erlangb(_0x18188e,_0x41b939){if(_0x41b939===0x0){return 0x0;}var _0x420edf=0x1;for(var _0x11ecba=0x1;_0x11ecba<=_0x41b939;_0x11ecba+=0x1){_0x420edf=0x1+_0x420edf*_0x11ecba/_0x18188e;}return 0x1/_0x420edf;}exports[_0x59f4('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x133c4a,_0x70ca7c,_0x32b3ac){if(_0x70ca7c>_0x32b3ac){for(var _0x1f731a=0x0;_0x1f731a<_0x70ca7c-_0x32b3ac;_0x1f731a+=0x1){decrementOriginate(_0x133c4a);}}}exports[_0x59f4('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2d939f){var _0x59ef39={};var _0x21c4f9=['id',_0x59f4('0x4e'),_0x59f4('0x4f'),_0x59f4('0x50'),_0x59f4('0x51')];if(_0x2d939f){for(var _0x8b51b5 in _0x2d939f){if(typeof _0x2d939f[_0x8b51b5]!=='undefined'){if(!_['isNil'](_0x2d939f[_0x8b51b5])&&!_0x21c4f9[_0x59f4('0x33')](_0x8b51b5)){_0x59ef39[util[_0x59f4('0x3e')](_0x59f4('0x52'),'XMD-',_0x8b51b5[_0x59f4('0x53')]())]=_0x2d939f[_0x8b51b5];}}}}return _0x59ef39;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index db9f99c..52f0ac2 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(_0x450e32,_0x1f4f6a){var _0x3041e0=function(_0x42bba5){while(--_0x42bba5){_0x450e32['push'](_0x450e32['shift']());}};_0x3041e0(++_0x1f4f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'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(_0x6e2825,_0x446902){var _0x5eabea=function(_0x103e93){while(--_0x103e93){_0x6e2825['push'](_0x6e2825['shift']());}};_0x5eabea(++_0x446902);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 a2c12e6..7a2f6d1 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 _0x53a0=['../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','actions','syncNewchannel','bind','syncVarSet','newstate','syncNewState','faxstatus','syncFaxStatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','hasOwnProperty','exten','localstationid','uniqueid','name','info','\x20syncNewchannel\x20','channel','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','notify','catch','error','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','then','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','update','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','%s/%s.tif','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','ext','isNil','active','trunks','SIP/%s','reachable','unmonitored','checkTrunk','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','moment','path','tiff2pdf','../../../config/logger','fax'];(function(_0x15ebfd,_0xbc1af8){var _0x268375=function(_0x32992b){while(--_0x32992b){_0x15ebfd['push'](_0x15ebfd['shift']());}};_0x268375(++_0xbc1af8);}(_0x53a0,0x155));var _0x053a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x53a0[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var _=require(_0x053a('0x0'));var BPromise=require(_0x053a('0x1'));var uuid=require('uuid');var moment=require(_0x053a('0x2'));var path=require(_0x053a('0x3'));var tiff2pdf=require(_0x053a('0x4'));var gs=require('./util/gs');var logger=require(_0x053a('0x5'))(_0x053a('0x6'));var ami=require(_0x053a('0x7'));var rpcDb=require(_0x053a('0x8'));var Channel=require(_0x053a('0x9'));var ut=require('./util/util');var Action=require(_0x053a('0xa'));var faxAccount=require(_0x053a('0xb'));var attachment=require(_0x053a('0xc'));var faxMessage=require(_0x053a('0xd'));function Fax(_0x550173){this[_0x053a('0xe')]={};this[_0x053a('0xf')]=_0x550173['faxAccounts'];this['trunks']=_0x550173['trunks'];this[_0x053a('0x10')]={};ami['on']('newchannel',this[_0x053a('0x11')][_0x053a('0x12')](this));ami['on']('varset',this[_0x053a('0x13')][_0x053a('0x12')](this));ami['on'](_0x053a('0x14'),this[_0x053a('0x15')][_0x053a('0x12')](this));ami['on']('newexten',this['syncNewExten'][_0x053a('0x12')](this));ami['on'](_0x053a('0x16'),this[_0x053a('0x17')][_0x053a('0x12')](this));ami['on'](_0x053a('0x18'),this['syncReceiveFax']['bind'](this));ami['on'](_0x053a('0x19'),this[_0x053a('0x1a')][_0x053a('0x12')](this));ami['on'](_0x053a('0x1b'),this[_0x053a('0x1c')]['bind'](this));}Fax[_0x053a('0x1d')][_0x053a('0x11')]=function(_0x48d703){if(_0x48d703[_0x053a('0x1e')]==='from-voip-provider'){for(var _0x2762a5 in this[_0x053a('0xf')]){if(this[_0x053a('0xf')][_0x053a('0x1f')](_0x2762a5)){if(_0x48d703[_0x053a('0x20')]===this[_0x053a('0xf')][_0x2762a5][_0x053a('0x21')]){this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]={};this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]['channel']=_0x48d703['channel'];this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]['id']=this[_0x053a('0xf')][_0x2762a5]['id'];this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]['name']=this[_0x053a('0xf')][_0x2762a5][_0x053a('0x23')];logger[_0x053a('0x24')](_0x48d703['uniqueid'],_0x053a('0x25'));}}}}if(this[_0x053a('0x10')][_0x48d703['uniqueid']]){this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]={};this[_0x053a('0xe')][_0x48d703[_0x053a('0x22')]]['channel']=_0x48d703[_0x053a('0x26')];logger['info'](_0x48d703['uniqueid'],_0x053a('0x25'));}};Fax[_0x053a('0x1d')][_0x053a('0x13')]=function(_0x39cd9a){if(this[_0x053a('0xe')][_0x39cd9a['uniqueid']]){for(var _0x50095a in _0x39cd9a[_0x053a('0x27')]){if(_0x39cd9a[_0x053a('0x27')][_0x053a('0x1f')](_0x50095a)){this[_0x053a('0xe')][_0x39cd9a[_0x053a('0x22')]][_0x50095a]=_0x39cd9a[_0x053a('0x28')];}}}};Fax[_0x053a('0x1d')][_0x053a('0x15')]=function(_0x206668){if(this['channels'][_0x206668['uniqueid']]){this[_0x053a('0xe')][_0x206668['uniqueid']]['channelstate']=_0x206668[_0x053a('0x29')];this[_0x053a('0xe')][_0x206668[_0x053a('0x22')]][_0x053a('0x2a')]=_0x206668['channelstatedesc'];}};Fax[_0x053a('0x1d')]['syncNewExten']=function(_0x3ec692){if(this[_0x053a('0xe')][_0x3ec692[_0x053a('0x22')]]){for(var _0x18bbb5 in _0x3ec692['variable']){if(_0x3ec692[_0x053a('0x27')][_0x053a('0x1f')](_0x18bbb5)){this[_0x053a('0xe')][_0x3ec692[_0x053a('0x22')]][_0x18bbb5]=_0x3ec692[_0x053a('0x28')];}}}};Fax[_0x053a('0x1d')]['syncFaxStatus']=function(_0x14c30c){if(this[_0x053a('0xe')][_0x14c30c[_0x053a('0x22')]]){this['channels'][_0x14c30c[_0x053a('0x22')]][_0x053a('0x2b')]=_0x14c30c['operation'];this['channels'][_0x14c30c[_0x053a('0x22')]]['status']=_0x14c30c[_0x053a('0x2c')];this[_0x053a('0xe')][_0x14c30c[_0x053a('0x22')]][_0x053a('0x21')]=_0x14c30c[_0x053a('0x21')];this[_0x053a('0xe')][_0x14c30c['uniqueid']][_0x053a('0x2d')]=_0x14c30c[_0x053a('0x2d')];logger[_0x053a('0x24')](_0x14c30c[_0x053a('0x22')],_0x053a('0x2e'));}};Fax[_0x053a('0x1d')]['syncReceiveFax']=function(_0x33a4d5){var _0x4b7808=this;if(this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]]){var _0x5e6051=this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]]['id'];this['channels'][_0x33a4d5['uniqueid']][_0x053a('0x2f')]=_0x33a4d5['remotestationid'];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]]['pagestransferred']=_0x33a4d5[_0x053a('0x30')];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]][_0x053a('0x21')]=_0x33a4d5[_0x053a('0x21')];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]][_0x053a('0x31')]=_0x33a4d5[_0x053a('0x31')];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]]['transferrate']=_0x33a4d5[_0x053a('0x32')];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]][_0x053a('0x2d')]=_0x33a4d5['filename'];this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]][_0x053a('0x33')]=_0x33a4d5[_0x053a('0x33')];if(this[_0x053a('0xe')][_0x33a4d5[_0x053a('0x22')]][_0x053a('0x30')]>0x0){tiff2pdf(_0x33a4d5[_0x053a('0x2d')],'/var/opt/motion2/server/files/attachments/',function(_0x4beaf5){logger['info'](_0x33a4d5[_0x053a('0x22')],_0x053a('0x34'),_0x4beaf5[_0x053a('0x35')]);attachment[_0x053a('0x36')]({'name':path[_0x053a('0x37')](_0x33a4d5['filename'])[_0x053a('0x23')],'basename':path[_0x053a('0x37')](_0x33a4d5[_0x053a('0x2d')])['name']+_0x053a('0x38'),'type':'application/pdf'})['then'](function(_0x3bbc4f){faxAccount[_0x053a('0x39')](_0x5e6051,{'from':_0x33a4d5[_0x053a('0x33')],'mapKey':'fax','body':path['parse'](_0x33a4d5[_0x053a('0x2d')])[_0x053a('0x23')]+_0x053a('0x38'),'AttachmentId':_0x3bbc4f['id']})[_0x053a('0x3a')](function(_0x327670){logger[_0x053a('0x3b')](_0x33a4d5[_0x053a('0x22')],'\x20notify\x20',JSON[_0x053a('0x3c')](_0x327670));});})[_0x053a('0x3a')](function(_0x46867a){logger[_0x053a('0x3b')](_0x33a4d5[_0x053a('0x22')],_0x053a('0x3d'),JSON[_0x053a('0x3c')](_0x46867a));});});}logger['info'](_0x33a4d5[_0x053a('0x22')],'\x20receiveFax\x20');}};Fax[_0x053a('0x1d')][_0x053a('0x1c')]=function(_0x3c8043){if(this[_0x053a('0x10')][_0x3c8043['uniqueid']]){_[_0x053a('0x3e')](this['channels'][_0x3c8043['uniqueid']],_[_0x053a('0x3f')](_0x3c8043,[_0x053a('0x40'),_0x053a('0x41')]));}};function updateStatus(_0x2af7af){if(_0x2af7af[_0x053a('0x42')]){faxMessage['update'](_0x2af7af[_0x053a('0x42')],{'failMessage':_0x053a('0x43')})[_0x053a('0x44')](function(_0x184f6c){ut['logger'](_0x053a('0x45'),_0x184f6c);})[_0x053a('0x3a')](function(_0x3d99bf){ut[_0x053a('0x46')](_0x053a('0x47'),_0x3d99bf);});}else{ut[_0x053a('0x46')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x053a('0x1d')][_0x053a('0x48')]=function(_0x1a76ba,_0x430463,_0x3de3c9){var _0x587fe2=this;var _0x1fa3fb={};if(_0x430463){_0x1fa3fb={'read':_0x430463};}else{_0x1fa3fb={'failMessage':_0x3de3c9};}if(this[_0x053a('0x10')][_0x1a76ba][_0x053a('0x42')]){faxMessage[_0x053a('0x49')](this['actions'][_0x1a76ba]['AttachmentId'],_0x1fa3fb)['then'](function(_0x1ef6dc){ut[_0x053a('0x46')]('[Fax][Message][Updated]',_0x1ef6dc);})[_0x053a('0x3a')](function(_0x214563){ut[_0x053a('0x46')](_0x053a('0x4a'),_0x214563);})[_0x053a('0x4b')](function(){delete _0x587fe2[_0x053a('0xe')][_0x1a76ba];delete _0x587fe2[_0x053a('0x10')][_0x1a76ba];});}else{ut[_0x053a('0x46')](_0x053a('0x4c'));delete this[_0x053a('0xe')][_0x1a76ba];delete this[_0x053a('0x10')][_0x1a76ba];}};Fax[_0x053a('0x1d')][_0x053a('0x1a')]=function(_0x15a4dd){var _0x3f0126=this;if(this[_0x053a('0xe')][_0x15a4dd[_0x053a('0x22')]]){if(this[_0x053a('0x10')][_0x15a4dd[_0x053a('0x22')]]){this['channels'][_0x15a4dd['uniqueid']]['id']=this[_0x053a('0x10')][_0x15a4dd[_0x053a('0x22')]]['id'];this['channels'][_0x15a4dd[_0x053a('0x22')]][_0x053a('0x23')]=this['actions'][_0x15a4dd['uniqueid']][_0x053a('0x23')];}logger[_0x053a('0x24')](_0x15a4dd[_0x053a('0x22')],this[_0x053a('0x10')][_0x15a4dd['uniqueid']]?_0x053a('0x4d'):_0x053a('0x4e'),JSON['stringify'](this[_0x053a('0xe')][_0x15a4dd[_0x053a('0x22')]]));if(this[_0x053a('0x10')][_0x15a4dd[_0x053a('0x22')]]){if(this[_0x053a('0xe')][_0x15a4dd[_0x053a('0x22')]]['faxpages']>0x0&&this[_0x053a('0xe')][_0x15a4dd[_0x053a('0x22')]]['faxstatus']===_0x053a('0x4f')){this[_0x053a('0x48')](_0x15a4dd[_0x053a('0x22')],!![]);}else{this[_0x053a('0x48')](_0x15a4dd[_0x053a('0x22')],![],this[_0x053a('0xe')][_0x15a4dd['uniqueid']][_0x053a('0x50')]?_0x053a('0x51')+this['channels'][_0x15a4dd['uniqueid']][_0x053a('0x50')]:_0x053a('0x52'));}}}};Fax[_0x053a('0x1d')][_0x053a('0x53')]=function(_0x2638cd){var _0x4a5ec4=this;return new BPromise(function(_0x121a80,_0x2ea0e4){_0x4a5ec4['execOriginate'](_0x2638cd,_0x4a5ec4['faxAccounts'][_0x2638cd[_0x053a('0x54')]])[_0x053a('0x44')](function(_0x46c507){ut['logger'](_0x053a('0x55'),_0x46c507);_0x121a80(ut[_0x053a('0x35')]('Fax\x20received'));})[_0x053a('0x3a')](function(_0x12d657){ut[_0x053a('0x46')](_0x053a('0x56'),_0x12d657);updateStatus(_0x2638cd);_0x2ea0e4(ut[_0x053a('0x35')](_0x053a('0x57')));});});};Fax[_0x053a('0x1d')][_0x053a('0x58')]=function(_0x1a7d21){var _0x391d9b=this;return new BPromise(function(_0x4b266c,_0x2b1211){var _0x2cb65d=_0x391d9b['checkTrunk'](_0x391d9b['faxAccounts'][_0x1a7d21[_0x053a('0x54')]][_0x053a('0x59')],_0x1a7d21);if(_0x2cb65d[_0x053a('0x5a')]){_0x4b266c(ut[_0x053a('0x35')](_0x053a('0x5b')));}else{_0x2b1211(ut[_0x053a('0x35')](_0x2cb65d[_0x053a('0x35')]));}});};function originate(_0x54bcc7,_0x57c0b0,_0x584abb){return new BPromise(function(_0x346531,_0x515f2b){if(_0x584abb){var _0x102bd1=util[_0x053a('0x5c')](_0x053a('0x5d'),path['parse'](_0x54bcc7[_0x053a('0x3')])[_0x053a('0x23')],_0x54bcc7[_0x053a('0x3')]);gs['execute'](_0x102bd1)[_0x053a('0x44')](function(){_0x54bcc7[_0x053a('0x3')]=util[_0x053a('0x5c')](_0x053a('0x5e'),path[_0x053a('0x37')](_0x54bcc7[_0x053a('0x3')])[_0x053a('0x5f')],path[_0x053a('0x37')](_0x54bcc7['path'])[_0x053a('0x23')]);_0x57c0b0['XMF-PATH']=_0x54bcc7['path'];ut['logger'](_0x053a('0x60'),'');ami['Action'](ut['variablesAction'](_0x54bcc7,_0x57c0b0))[_0x053a('0x44')](function(_0xe502c){_0x346531(_0xe502c);})['catch'](function(_0xb96cca){_0x515f2b(_0xb96cca);});})[_0x053a('0x3a')](function(_0x3c2439){_0x515f2b(_0x3c2439);});}else{ami[_0x053a('0x61')](ut[_0x053a('0x62')](_0x54bcc7,_0x57c0b0))['then'](function(_0x11afb8){_0x346531(_0x11afb8);})[_0x053a('0x3a')](function(_0x52a306){_0x515f2b(_0x52a306);});}});}Fax['prototype']['execOriginate']=function(_0x2d770e,_0x1ec14a){var _0x1ee49a=this;return new BPromise(function(_0x26544e,_0x250124){var _0x56de0c=uuid['v4']();var _0x4fbf3d=ut[_0x053a('0x63')](_0x2d770e,_0x1ec14a);_0x1ee49a['actions'][_0x56de0c]=new Action(_0x56de0c,_0x1ec14a,_0x2d770e);var _0x543f6f=_0x1ee49a[_0x053a('0x10')][_0x56de0c];if(path[_0x053a('0x37')](_0x2d770e[_0x053a('0x3')])[_0x053a('0x64')]===_0x053a('0x38')){originate(_0x543f6f,_0x4fbf3d,!![])[_0x053a('0x44')](function(_0x46bc5f){_0x26544e(_0x46bc5f);})[_0x053a('0x3a')](function(_0x184201){_0x250124(_0x184201);});}else{originate(_0x543f6f,_0x4fbf3d,![])[_0x053a('0x44')](function(_0x49874d){_0x26544e(_0x49874d);})['catch'](function(_0x35c427){_0x250124(_0x35c427);});}});};Fax['prototype']['isTrunkReachable']=function(_0x462f08){return!_[_0x053a('0x65')](_0x462f08)&&!_[_0x053a('0x65')](_0x462f08[_0x053a('0x23')])&&!_['isNil'](_0x462f08[_0x053a('0x66')])&&_0x462f08[_0x053a('0x66')]&&!_[_0x053a('0x65')](this[_0x053a('0x67')][util['format'](_0x053a('0x68'),_0x462f08['name'])])&&!_[_0x053a('0x65')](this[_0x053a('0x67')][util[_0x053a('0x5c')]('SIP/%s',_0x462f08[_0x053a('0x23')])]['status'])&&(this[_0x053a('0x67')][util[_0x053a('0x5c')](_0x053a('0x68'),_0x462f08[_0x053a('0x23')])]['status']===_0x053a('0x69')||this[_0x053a('0x67')][util[_0x053a('0x5c')](_0x053a('0x68'),_0x462f08[_0x053a('0x23')])][_0x053a('0x2c')]===_0x053a('0x6a'));};Fax['prototype'][_0x053a('0x6b')]=function(_0x21d0ec,_0x24ee7e){if(!this[_0x053a('0x6c')](_0x21d0ec)){ut[_0x053a('0x46')](_0x053a('0x6d'),_[_0x053a('0x65')](_0x21d0ec)?'':_0x21d0ec[_0x053a('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x053a('0x6e')};}if(_[_0x053a('0x65')](_0x24ee7e[_0x053a('0x6')])){ut[_0x053a('0x46')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0x053a('0x3c')](_0x24ee7e));return{'isValid':![],'message':_0x053a('0x6f')};}if(_[_0x053a('0x65')](_0x24ee7e[_0x053a('0x3')])){ut['logger'](_0x053a('0x70'),JSON[_0x053a('0x3c')](_0x24ee7e));return{'isValid':![],'message':_0x053a('0x71')};}return{'isValid':!![],'message':_0x053a('0x72')};};module[_0x053a('0x73')]=Fax; \ No newline at end of file +var _0xe7e6=['../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','updateStatus','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','execute','dir','parse','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','.pdf','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','tiff2pdf','../../../config/logger','./channel','./util/util','../rpc/faxAccount'];(function(_0x1c8028,_0x383c02){var _0x128bb4=function(_0x412205){while(--_0x412205){_0x1c8028['push'](_0x1c8028['shift']());}};_0x128bb4(++_0x383c02);}(_0xe7e6,0x6c));var _0x6e7e=function(_0xad9551,_0x518a5b){_0xad9551=_0xad9551-0x0;var _0x3965ad=_0xe7e6[_0xad9551];return _0x3965ad;};'use strict';var util=require(_0x6e7e('0x0'));var _=require(_0x6e7e('0x1'));var BPromise=require(_0x6e7e('0x2'));var uuid=require(_0x6e7e('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x6e7e('0x4'));var gs=require('./util/gs');var logger=require(_0x6e7e('0x5'))('fax');var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x6e7e('0x6'));var ut=require(_0x6e7e('0x7'));var Action=require('./action');var faxAccount=require(_0x6e7e('0x8'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x6e7e('0x9'));function Fax(_0x42cc65){this[_0x6e7e('0xa')]={};this[_0x6e7e('0xb')]=_0x42cc65[_0x6e7e('0xb')];this['trunks']=_0x42cc65[_0x6e7e('0xc')];this[_0x6e7e('0xd')]={};ami['on']('newchannel',this[_0x6e7e('0xe')][_0x6e7e('0xf')](this));ami['on']('varset',this['syncVarSet'][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x10'),this[_0x6e7e('0x11')][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x12'),this[_0x6e7e('0x13')][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x14'),this[_0x6e7e('0x15')][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x16'),this[_0x6e7e('0x17')][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x18'),this[_0x6e7e('0x19')][_0x6e7e('0xf')](this));ami['on'](_0x6e7e('0x1a'),this[_0x6e7e('0x1b')][_0x6e7e('0xf')](this));}Fax[_0x6e7e('0x1c')][_0x6e7e('0xe')]=function(_0x380dc9){if(_0x380dc9[_0x6e7e('0x1d')]===_0x6e7e('0x1e')){for(var _0x4e0309 in this[_0x6e7e('0xb')]){if(this['faxAccounts'][_0x6e7e('0x1f')](_0x4e0309)){if(_0x380dc9[_0x6e7e('0x20')]===this[_0x6e7e('0xb')][_0x4e0309][_0x6e7e('0x21')]){this[_0x6e7e('0xa')][_0x380dc9['uniqueid']]={};this[_0x6e7e('0xa')][_0x380dc9[_0x6e7e('0x22')]]['channel']=_0x380dc9[_0x6e7e('0x23')];this[_0x6e7e('0xa')][_0x380dc9[_0x6e7e('0x22')]]['id']=this['faxAccounts'][_0x4e0309]['id'];this[_0x6e7e('0xa')][_0x380dc9['uniqueid']]['name']=this[_0x6e7e('0xb')][_0x4e0309][_0x6e7e('0x24')];logger[_0x6e7e('0x25')](_0x380dc9[_0x6e7e('0x22')],_0x6e7e('0x26'));}}}}if(this[_0x6e7e('0xd')][_0x380dc9[_0x6e7e('0x22')]]){this[_0x6e7e('0xa')][_0x380dc9[_0x6e7e('0x22')]]={};this[_0x6e7e('0xa')][_0x380dc9['uniqueid']]['channel']=_0x380dc9[_0x6e7e('0x23')];logger[_0x6e7e('0x25')](_0x380dc9[_0x6e7e('0x22')],_0x6e7e('0x26'));}};Fax[_0x6e7e('0x1c')][_0x6e7e('0x27')]=function(_0xd6a35d){if(this[_0x6e7e('0xa')][_0xd6a35d[_0x6e7e('0x22')]]){for(var _0x1c2f6a in _0xd6a35d[_0x6e7e('0x28')]){if(_0xd6a35d[_0x6e7e('0x28')][_0x6e7e('0x1f')](_0x1c2f6a)){this['channels'][_0xd6a35d['uniqueid']][_0x1c2f6a]=_0xd6a35d[_0x6e7e('0x29')];}}}};Fax[_0x6e7e('0x1c')][_0x6e7e('0x11')]=function(_0x541865){if(this[_0x6e7e('0xa')][_0x541865[_0x6e7e('0x22')]]){this[_0x6e7e('0xa')][_0x541865[_0x6e7e('0x22')]][_0x6e7e('0x2a')]=_0x541865['channelstate'];this[_0x6e7e('0xa')][_0x541865['uniqueid']][_0x6e7e('0x2b')]=_0x541865[_0x6e7e('0x2b')];}};Fax[_0x6e7e('0x1c')]['syncNewExten']=function(_0x15ab4f){if(this[_0x6e7e('0xa')][_0x15ab4f[_0x6e7e('0x22')]]){for(var _0x44b56b in _0x15ab4f[_0x6e7e('0x28')]){if(_0x15ab4f[_0x6e7e('0x28')][_0x6e7e('0x1f')](_0x44b56b)){this[_0x6e7e('0xa')][_0x15ab4f[_0x6e7e('0x22')]][_0x44b56b]=_0x15ab4f[_0x6e7e('0x29')];}}}};Fax['prototype'][_0x6e7e('0x15')]=function(_0x220d60){if(this['channels'][_0x220d60[_0x6e7e('0x22')]]){this[_0x6e7e('0xa')][_0x220d60[_0x6e7e('0x22')]][_0x6e7e('0x2c')]=_0x220d60[_0x6e7e('0x2c')];this[_0x6e7e('0xa')][_0x220d60[_0x6e7e('0x22')]]['status']=_0x220d60[_0x6e7e('0x2d')];this[_0x6e7e('0xa')][_0x220d60[_0x6e7e('0x22')]][_0x6e7e('0x21')]=_0x220d60[_0x6e7e('0x21')];this[_0x6e7e('0xa')][_0x220d60['uniqueid']][_0x6e7e('0x2e')]=_0x220d60[_0x6e7e('0x2e')];logger[_0x6e7e('0x25')](_0x220d60['uniqueid'],_0x6e7e('0x2f'));}};Fax[_0x6e7e('0x1c')][_0x6e7e('0x17')]=function(_0x3cca07){var _0xf6eff0=this;if(this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]]){var _0xbb1a9f=this[_0x6e7e('0xa')][_0x3cca07['uniqueid']]['id'];this[_0x6e7e('0xa')][_0x3cca07['uniqueid']][_0x6e7e('0x30')]=_0x3cca07[_0x6e7e('0x30')];this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]][_0x6e7e('0x31')]=_0x3cca07[_0x6e7e('0x31')];this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]]['localstationid']=_0x3cca07[_0x6e7e('0x21')];this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]][_0x6e7e('0x32')]=_0x3cca07[_0x6e7e('0x32')];this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]]['transferrate']=_0x3cca07['transferrate'];this['channels'][_0x3cca07[_0x6e7e('0x22')]]['filename']=_0x3cca07[_0x6e7e('0x2e')];this[_0x6e7e('0xa')][_0x3cca07['uniqueid']][_0x6e7e('0x33')]=_0x3cca07[_0x6e7e('0x33')];if(this[_0x6e7e('0xa')][_0x3cca07[_0x6e7e('0x22')]][_0x6e7e('0x31')]>0x0){tiff2pdf(_0x3cca07[_0x6e7e('0x2e')],_0x6e7e('0x34'),function(_0x5f8896){logger['info'](_0x3cca07[_0x6e7e('0x22')],_0x6e7e('0x35'),_0x5f8896[_0x6e7e('0x36')]);attachment[_0x6e7e('0x37')]({'name':path['parse'](_0x3cca07[_0x6e7e('0x2e')])[_0x6e7e('0x24')],'basename':path['parse'](_0x3cca07['filename'])['name']+'.pdf','type':_0x6e7e('0x38')})[_0x6e7e('0x39')](function(_0x482323){faxAccount[_0x6e7e('0x3a')](_0xbb1a9f,{'from':_0x3cca07[_0x6e7e('0x33')],'mapKey':_0x6e7e('0x3b'),'body':path['parse'](_0x3cca07['filename'])['name']+'.pdf','AttachmentId':_0x482323['id']})[_0x6e7e('0x3c')](function(_0x8b52df){logger[_0x6e7e('0x3d')](_0x3cca07[_0x6e7e('0x22')],_0x6e7e('0x3e'),JSON[_0x6e7e('0x3f')](_0x8b52df));});})[_0x6e7e('0x3c')](function(_0x4d89f2){logger[_0x6e7e('0x3d')](_0x3cca07[_0x6e7e('0x22')],_0x6e7e('0x40'),JSON[_0x6e7e('0x3f')](_0x4d89f2));});});}logger[_0x6e7e('0x25')](_0x3cca07[_0x6e7e('0x22')],_0x6e7e('0x40'));}};Fax[_0x6e7e('0x1c')]['syncOriginateResponse']=function(_0x317b0a){if(this[_0x6e7e('0xd')][_0x317b0a[_0x6e7e('0x22')]]){_[_0x6e7e('0x41')](this[_0x6e7e('0xa')][_0x317b0a[_0x6e7e('0x22')]],_['pick'](_0x317b0a,['response',_0x6e7e('0x42')]));}};function updateStatus(_0xa0452e){if(_0xa0452e['AttachmentId']){faxMessage[_0x6e7e('0x43')](_0xa0452e[_0x6e7e('0x44')],{'failMessage':_0x6e7e('0x45')})[_0x6e7e('0x39')](function(_0x1990c9){ut[_0x6e7e('0x46')]('[Fax][Message][Error][Updated]',_0x1990c9);})['catch'](function(_0x34421e){ut[_0x6e7e('0x46')](_0x6e7e('0x47'),_0x34421e);});}else{ut['logger'](_0x6e7e('0x48'));}}Fax[_0x6e7e('0x1c')]['updateStatus']=function(_0x1ec0b9,_0x4329c5,_0x1f0a15){var _0x2b9fe8=this;var _0x47ff8b={};if(_0x4329c5){_0x47ff8b={'read':_0x4329c5};}else{_0x47ff8b={'failMessage':_0x1f0a15};}if(this[_0x6e7e('0xd')][_0x1ec0b9][_0x6e7e('0x44')]){faxMessage[_0x6e7e('0x43')](this[_0x6e7e('0xd')][_0x1ec0b9][_0x6e7e('0x44')],_0x47ff8b)[_0x6e7e('0x39')](function(_0x294d99){ut[_0x6e7e('0x46')](_0x6e7e('0x49'),_0x294d99);})[_0x6e7e('0x3c')](function(_0x575e38){ut[_0x6e7e('0x46')](_0x6e7e('0x4a'),_0x575e38);})['finally'](function(){delete _0x2b9fe8['channels'][_0x1ec0b9];delete _0x2b9fe8[_0x6e7e('0xd')][_0x1ec0b9];});}else{ut[_0x6e7e('0x46')](_0x6e7e('0x4b'));delete this[_0x6e7e('0xa')][_0x1ec0b9];delete this['actions'][_0x1ec0b9];}};Fax[_0x6e7e('0x1c')][_0x6e7e('0x19')]=function(_0x5e22ae){var _0x440961=this;if(this[_0x6e7e('0xa')][_0x5e22ae['uniqueid']]){if(this[_0x6e7e('0xd')][_0x5e22ae[_0x6e7e('0x22')]]){this[_0x6e7e('0xa')][_0x5e22ae[_0x6e7e('0x22')]]['id']=this[_0x6e7e('0xd')][_0x5e22ae[_0x6e7e('0x22')]]['id'];this[_0x6e7e('0xa')][_0x5e22ae[_0x6e7e('0x22')]]['name']=this[_0x6e7e('0xd')][_0x5e22ae[_0x6e7e('0x22')]]['name'];}logger['info'](_0x5e22ae[_0x6e7e('0x22')],this['actions'][_0x5e22ae[_0x6e7e('0x22')]]?_0x6e7e('0x4c'):_0x6e7e('0x4d'),JSON['stringify'](this[_0x6e7e('0xa')][_0x5e22ae['uniqueid']]));if(this[_0x6e7e('0xd')][_0x5e22ae[_0x6e7e('0x22')]]){if(this[_0x6e7e('0xa')][_0x5e22ae[_0x6e7e('0x22')]][_0x6e7e('0x4e')]>0x0&&this['channels'][_0x5e22ae[_0x6e7e('0x22')]][_0x6e7e('0x14')]==='SUCCESS'){this[_0x6e7e('0x4f')](_0x5e22ae[_0x6e7e('0x22')],!![]);}else{this[_0x6e7e('0x4f')](_0x5e22ae[_0x6e7e('0x22')],![],this[_0x6e7e('0xa')][_0x5e22ae['uniqueid']]['faxstatusstring']?_0x6e7e('0x50')+this['channels'][_0x5e22ae[_0x6e7e('0x22')]][_0x6e7e('0x51')]:'SENDING\x20FAILED');}}}};Fax[_0x6e7e('0x1c')][_0x6e7e('0x52')]=function(_0x1d8358){var _0x1bd7ac=this;return new BPromise(function(_0x197a89,_0x755de2){_0x1bd7ac[_0x6e7e('0x53')](_0x1d8358,_0x1bd7ac[_0x6e7e('0xb')][_0x1d8358[_0x6e7e('0x54')]])[_0x6e7e('0x39')](function(_0x46231a){ut[_0x6e7e('0x46')](_0x6e7e('0x55'),_0x46231a);_0x197a89(ut['message'](_0x6e7e('0x56')));})[_0x6e7e('0x3c')](function(_0x47197f){ut[_0x6e7e('0x46')](_0x6e7e('0x57'),_0x47197f);updateStatus(_0x1d8358);_0x755de2(ut[_0x6e7e('0x36')](_0x6e7e('0x58')));});});};Fax[_0x6e7e('0x1c')][_0x6e7e('0x59')]=function(_0x467011){var _0x4d3a41=this;return new BPromise(function(_0x1e9378,_0x112e23){var _0x12599b=_0x4d3a41[_0x6e7e('0x5a')](_0x4d3a41['faxAccounts'][_0x467011['FaxAccountId']][_0x6e7e('0x5b')],_0x467011);if(_0x12599b[_0x6e7e('0x5c')]){_0x1e9378(ut[_0x6e7e('0x36')](_0x6e7e('0x5d')));}else{_0x112e23(ut[_0x6e7e('0x36')](_0x12599b[_0x6e7e('0x36')]));}});};function originate(_0x15cb00,_0x27e49d,_0x4d8432){return new BPromise(function(_0xf9228a,_0x1a7ea0){if(_0x4d8432){var _0x720024=util[_0x6e7e('0x5e')](_0x6e7e('0x5f'),path['parse'](_0x15cb00[_0x6e7e('0x60')])[_0x6e7e('0x24')],_0x15cb00[_0x6e7e('0x60')]);gs[_0x6e7e('0x61')](_0x720024)['then'](function(){_0x15cb00[_0x6e7e('0x60')]=util[_0x6e7e('0x5e')]('%s/%s.tif',path['parse'](_0x15cb00['path'])[_0x6e7e('0x62')],path[_0x6e7e('0x63')](_0x15cb00[_0x6e7e('0x60')])['name']);_0x27e49d[_0x6e7e('0x64')]=_0x15cb00[_0x6e7e('0x60')];ut['logger'](_0x6e7e('0x65'),'');ami[_0x6e7e('0x66')](ut[_0x6e7e('0x67')](_0x15cb00,_0x27e49d))[_0x6e7e('0x39')](function(_0x44c089){_0xf9228a(_0x44c089);})[_0x6e7e('0x3c')](function(_0xd28de9){_0x1a7ea0(_0xd28de9);});})[_0x6e7e('0x3c')](function(_0x54de49){_0x1a7ea0(_0x54de49);});}else{ami[_0x6e7e('0x66')](ut[_0x6e7e('0x67')](_0x15cb00,_0x27e49d))[_0x6e7e('0x39')](function(_0xbda0cc){_0xf9228a(_0xbda0cc);})[_0x6e7e('0x3c')](function(_0x4a0a9f){_0x1a7ea0(_0x4a0a9f);});}});}Fax[_0x6e7e('0x1c')][_0x6e7e('0x53')]=function(_0x2e1ce5,_0x59a38e){var _0x4427a6=this;return new BPromise(function(_0x182c6c,_0x4602f0){var _0x122c9a=uuid['v4']();var _0x1c9f74=ut['addVariables'](_0x2e1ce5,_0x59a38e);_0x4427a6['actions'][_0x122c9a]=new Action(_0x122c9a,_0x59a38e,_0x2e1ce5);var _0x551d8b=_0x4427a6[_0x6e7e('0xd')][_0x122c9a];if(path[_0x6e7e('0x63')](_0x2e1ce5[_0x6e7e('0x60')])[_0x6e7e('0x68')]===_0x6e7e('0x69')){originate(_0x551d8b,_0x1c9f74,!![])['then'](function(_0x1e4b1b){_0x182c6c(_0x1e4b1b);})[_0x6e7e('0x3c')](function(_0x371648){_0x4602f0(_0x371648);});}else{originate(_0x551d8b,_0x1c9f74,![])[_0x6e7e('0x39')](function(_0x348414){_0x182c6c(_0x348414);})[_0x6e7e('0x3c')](function(_0x1f1db2){_0x4602f0(_0x1f1db2);});}});};Fax[_0x6e7e('0x1c')][_0x6e7e('0x6a')]=function(_0x128e3e){return!_['isNil'](_0x128e3e)&&!_[_0x6e7e('0x6b')](_0x128e3e[_0x6e7e('0x24')])&&!_['isNil'](_0x128e3e['active'])&&_0x128e3e[_0x6e7e('0x6c')]&&!_[_0x6e7e('0x6b')](this[_0x6e7e('0xc')][util['format'](_0x6e7e('0x6d'),_0x128e3e[_0x6e7e('0x24')])])&&!_[_0x6e7e('0x6b')](this[_0x6e7e('0xc')][util[_0x6e7e('0x5e')]('SIP/%s',_0x128e3e['name'])][_0x6e7e('0x2d')])&&(this['trunks'][util[_0x6e7e('0x5e')](_0x6e7e('0x6d'),_0x128e3e[_0x6e7e('0x24')])]['status']===_0x6e7e('0x6e')||this['trunks'][util[_0x6e7e('0x5e')](_0x6e7e('0x6d'),_0x128e3e[_0x6e7e('0x24')])][_0x6e7e('0x2d')]===_0x6e7e('0x6f'));};Fax['prototype'][_0x6e7e('0x5a')]=function(_0x5a9852,_0x2fe4da){if(!this['isTrunkReachable'](_0x5a9852)){ut[_0x6e7e('0x46')]('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0x6e7e('0x6b')](_0x5a9852)?'':_0x5a9852[_0x6e7e('0x24')]+_0x6e7e('0x70'));return{'isValid':![],'message':_0x6e7e('0x71')};}if(_['isNil'](_0x2fe4da[_0x6e7e('0x3b')])){ut[_0x6e7e('0x46')](_0x6e7e('0x72'),JSON[_0x6e7e('0x3f')](_0x2fe4da));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2fe4da[_0x6e7e('0x60')])){ut[_0x6e7e('0x46')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x6e7e('0x3f')](_0x2fe4da));return{'isValid':![],'message':_0x6e7e('0x73')};}return{'isValid':!![],'message':_0x6e7e('0x74')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 382c347..4d1a88e 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 _0xb67d=['util','bluebird','../../../config/logger','lodash','../rpc/faxAccount','error','notify','catch','[Notify]\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb67d,0x168));var _0xdb67=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb67d[_0x167cc1];return _0x10bc4b;};'use strict';var util=require(_0xdb67('0x0'));var BPromise=require(_0xdb67('0x1'));var logger=require(_0xdb67('0x2'))('preview');var _=require(_0xdb67('0x3'));var faxAccount=require(_0xdb67('0x4'));function loggerCatch(_0x157ee3){return function(_0x278307){logger[_0xdb67('0x5')](_0x157ee3,util['inspect'](_0x278307,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4a8e15,_0x1bb8e1){return BPromise['resolve']()['then'](faxAccount[_0xdb67('0x6')](_0x4a8e15,_0x1bb8e1))[_0xdb67('0x7')](loggerCatch(_0xdb67('0x8')));}; \ No newline at end of file +var _0x1b34=['../../../config/logger','preview','../rpc/faxAccount','error','notify','resolve','then','catch','util'];(function(_0x4dbaad,_0x730318){var _0x226c72=function(_0x501972){while(--_0x501972){_0x4dbaad['push'](_0x4dbaad['shift']());}};_0x226c72(++_0x730318);}(_0x1b34,0x1a6));var _0x41b3=function(_0x1585a4,_0x19d0cb){_0x1585a4=_0x1585a4-0x0;var _0x5a9722=_0x1b34[_0x1585a4];return _0x5a9722;};'use strict';var util=require(_0x41b3('0x0'));var BPromise=require('bluebird');var logger=require(_0x41b3('0x1'))(_0x41b3('0x2'));var _=require('lodash');var faxAccount=require(_0x41b3('0x3'));function loggerCatch(_0x1cff19){return function(_0x2dec15){logger[_0x41b3('0x4')](_0x1cff19,util['inspect'](_0x2dec15,{'showHidden':![],'depth':null}));};}exports[_0x41b3('0x5')]=function(_0x382bf1,_0xf9cd14){return BPromise[_0x41b3('0x6')]()[_0x41b3('0x7')](faxAccount[_0x41b3('0x5')](_0x382bf1,_0xf9cd14))[_0x41b3('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index d60f542..f6bf2a8 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 _0xb5b4=['../../../../config/logger','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x3e668d,_0x1e1fad){var _0x2fe460=function(_0x335ac5){while(--_0x335ac5){_0x3e668d['push'](_0x3e668d['shift']());}};_0x2fe460(++_0x1e1fad);}(_0xb5b4,0x147));var _0x4b5b=function(_0x2b152a,_0x3dd988){_0x2b152a=_0x2b152a-0x0;var _0x2ad4c7=_0xb5b4[_0x2b152a];return _0x2ad4c7;};'use strict';var util=require(_0x4b5b('0x0'));var logger=require(_0x4b5b('0x1'))('fax');var BPromise=require(_0x4b5b('0x2'));var exec=require(_0x4b5b('0x3'))[_0x4b5b('0x4')];exports['execute']=function(_0x3f04ac){return new BPromise(function(_0x3ef428,_0x4df73a){exec(_0x3f04ac,function(_0x472262,_0x41aef4,_0x20d365){logger[_0x4b5b('0x5')](_0x4b5b('0x6'),_0x41aef4);if(_0x472262){logger[_0x4b5b('0x5')](_0x4b5b('0x6'),_0x4b5b('0x7'),util['inspect'](_0x472262,{'showHidden':![],'depth':null}),_0x41aef4,_0x20d365);_0x4df73a(_0x472262);}_0x3ef428(_0x41aef4);});});}; \ No newline at end of file +var _0x3c14=['../../../../config/logger','fax','child_process','execute','info','Exec\x20gs','inspect','util'];(function(_0x34f86d,_0x469a3b){var _0x1c457a=function(_0x102cd4){while(--_0x102cd4){_0x34f86d['push'](_0x34f86d['shift']());}};_0x1c457a(++_0x469a3b);}(_0x3c14,0x15f));var _0x43c1=function(_0x25701b,_0x2a6976){_0x25701b=_0x25701b-0x0;var _0x3a8a2c=_0x3c14[_0x25701b];return _0x3a8a2c;};'use strict';var util=require(_0x43c1('0x0'));var logger=require(_0x43c1('0x1'))(_0x43c1('0x2'));var BPromise=require('bluebird');var exec=require(_0x43c1('0x3'))['exec'];exports[_0x43c1('0x4')]=function(_0x5eef6a){return new BPromise(function(_0x2716b2,_0x13b4e9){exec(_0x5eef6a,function(_0x8857b4,_0x34e560,_0x53c1d6){logger[_0x43c1('0x5')](_0x43c1('0x6'),_0x34e560);if(_0x8857b4){logger[_0x43c1('0x5')](_0x43c1('0x6'),'\x20Error\x20:',util[_0x43c1('0x7')](_0x8857b4,{'showHidden':![],'depth':null}),_0x34e560,_0x53c1d6);_0x13b4e9(_0x8857b4);}_0x2716b2(_0x34e560);});});}; \ 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 870c6c7..b59caa5 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 _0xe1bc=['variablesAction','channel','from-sip','uniqueid','lodash','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe1bc,0xf4));var _0xce1b=function(_0x1a15a0,_0x559e1b){_0x1a15a0=_0x1a15a0-0x0;var _0x5deed7=_0xe1bc[_0x1a15a0];return _0x5deed7;};'use strict';var util=require('util');var _=require(_0xce1b('0x0'));var moment=require(_0xce1b('0x1'));var logger=require(_0xce1b('0x2'))(_0xce1b('0x3'));exports[_0xce1b('0x4')]=function(_0xe35efe){return{'message':_0xe35efe};};exports[_0xce1b('0x5')]=function(_0x1bc15d,_0x208d53){logger[_0xce1b('0x6')](_0x1bc15d,util[_0xce1b('0x7')](_0x208d53,{'showHidden':![],'depth':null}));};exports[_0xce1b('0x8')]=function(_0x286300,_0x5dd7aa){var _0x4c6f5d={'XMF-ECM':_0x5dd7aa[_0xce1b('0x9')],'XMF-HEADERINFO':_0x5dd7aa[_0xce1b('0xa')],'XMF-MINRATE':_0x5dd7aa[_0xce1b('0xb')],'XMF-MAXRATE':_0x5dd7aa['maxrate'],'XMF-MODEM':util[_0xce1b('0xc')](_0xce1b('0xd'),_0x5dd7aa[_0xce1b('0xe')]),'XMF-GATEWAY':_0x5dd7aa[_0xce1b('0xf')],'XMF-FAXDETECT':_0x5dd7aa[_0xce1b('0x10')],'XMF-T38TIMEOUT':_0x5dd7aa[_0xce1b('0x11')],'XMF-LOCALSTATIONID':_0x5dd7aa[_0xce1b('0x12')],'XMF-PATH':_0x286300[_0xce1b('0x13')]};return _0x4c6f5d;};exports[_0xce1b('0x14')]=function(_0x363fd8,_0x52d544){return{'actionid':_0x363fd8['uniqueid'],'action':'originate','channel':_0x363fd8[_0xce1b('0x15')],'Exten':'xcally-motion-fax','Context':_0xce1b('0x16'),'Priority':'1','callerid':util[_0xce1b('0xc')]('\x22%s\x22\x20<%s>',_0x363fd8[_0xce1b('0xa')]?_0x363fd8[_0xce1b('0xa')]:'',_0x363fd8[_0xce1b('0x12')]),'variable':_0x52d544,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x363fd8[_0xce1b('0x17')]};}; \ No newline at end of file +var _0x64f2=['headerinfo','localstationid','moment','../../../../config/logger','fax','message','inspect','addVariables','ecm','minrate','maxrate','gateway','faxdetect','t38timeout','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip'];(function(_0x3d2d2d,_0xcbc2fa){var _0x5325e4=function(_0xcb1b4f){while(--_0xcb1b4f){_0x3d2d2d['push'](_0x3d2d2d['shift']());}};_0x5325e4(++_0xcbc2fa);}(_0x64f2,0xad));var _0x264f=function(_0x19f7c5,_0x382820){_0x19f7c5=_0x19f7c5-0x0;var _0x169121=_0x64f2[_0x19f7c5];return _0x169121;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x264f('0x0'));var logger=require(_0x264f('0x1'))(_0x264f('0x2'));exports[_0x264f('0x3')]=function(_0x3f569c){return{'message':_0x3f569c};};exports['logger']=function(_0x444807,_0x44f6db){logger['info'](_0x444807,util[_0x264f('0x4')](_0x44f6db,{'showHidden':![],'depth':null}));};exports[_0x264f('0x5')]=function(_0x385962,_0x154930){var _0x411d0={'XMF-ECM':_0x154930[_0x264f('0x6')],'XMF-HEADERINFO':_0x154930['headerinfo'],'XMF-MINRATE':_0x154930[_0x264f('0x7')],'XMF-MAXRATE':_0x154930[_0x264f('0x8')],'XMF-MODEM':util['format']('\x22%s\x22',_0x154930['modem']),'XMF-GATEWAY':_0x154930[_0x264f('0x9')],'XMF-FAXDETECT':_0x154930[_0x264f('0xa')],'XMF-T38TIMEOUT':_0x154930[_0x264f('0xb')],'XMF-LOCALSTATIONID':_0x154930['localstationid'],'XMF-PATH':_0x385962['path']};return _0x411d0;};exports[_0x264f('0xc')]=function(_0x255150,_0x1a6bc9){return{'actionid':_0x255150[_0x264f('0xd')],'action':'originate','channel':_0x255150[_0x264f('0xe')],'Exten':_0x264f('0xf'),'Context':_0x264f('0x10'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x255150[_0x264f('0x11')]?_0x255150[_0x264f('0x11')]:'',_0x255150[_0x264f('0x12')]),'variable':_0x1a6bc9,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x255150[_0x264f('0xd')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 129046c..6f1be2f 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 _0x170d=['./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','getTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','[index.js][main]','moment','./realtime','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x170d,0x88));var _0xd170=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x170d[_0x122ef9];return _0x42fba0;};'use strict';var util=require('util');var moment=require(_0xd170('0x0'));var server=require('./server');var Realtime=require(_0xd170('0x1'));var Report=require(_0xd170('0x2'));var Acw=require(_0xd170('0x3'));var Trigger=require(_0xd170('0x4'));var Dialer=require(_0xd170('0x5'));var Preview=require('./preview');var Fax=require(_0xd170('0x6'));var user=require(_0xd170('0x7'));var voiceQueue=require(_0xd170('0x8'));var voiceQueueReport=require(_0xd170('0x9'));var voiceCallReport=require(_0xd170('0xa'));var trunk=require(_0xd170('0xb'));var trigger=require(_0xd170('0xc'));var template=require(_0xd170('0xd'));var cmHopperHistory=require(_0xd170('0xe'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0xd170('0xf'));var faxAccount=require(_0xd170('0x10'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0xd170('0x11'));var sugarcrm=require(_0xd170('0x12'));var freshdesk=require(_0xd170('0x13'));var desk=require(_0xd170('0x14'));var zoho=require(_0xd170('0x15'));var vtiger=require(_0xd170('0x16'));var freshsales=require(_0xd170('0x17'));var servicenow=require(_0xd170('0x18'));var dynamics365=require(_0xd170('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(_0xd170('0x1a'))(_0xd170('0x1b'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd170('0x1c')](_0xd170('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xd170('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd170('0x1e')]()[_0xd170('0x1f')](user[_0xd170('0x20')]())['then'](realtime['initAgents']())[_0xd170('0x1f')](user[_0xd170('0x21')]())['then'](realtime['initTelephones']())[_0xd170('0x1f')](trunk[_0xd170('0x22')]())[_0xd170('0x1f')](realtime[_0xd170('0x23')]())[_0xd170('0x1f')](voiceQueue[_0xd170('0x24')]())[_0xd170('0x1f')](realtime[_0xd170('0x25')]())[_0xd170('0x1f')](trigger['getTriggers']())[_0xd170('0x1f')](realtime[_0xd170('0x26')]())[_0xd170('0x1f')](template[_0xd170('0x27')]())['then'](realtime[_0xd170('0x28')]())['then'](zendesk[_0xd170('0x29')]())[_0xd170('0x1f')](realtime['initZendeskAccounts']())['then'](salesforce[_0xd170('0x2a')]())['then'](realtime[_0xd170('0x2b')]())[_0xd170('0x1f')](sugarcrm[_0xd170('0x2c')]())[_0xd170('0x1f')](realtime[_0xd170('0x2d')]())[_0xd170('0x1f')](freshdesk[_0xd170('0x2e')]())[_0xd170('0x1f')](realtime[_0xd170('0x2f')]())[_0xd170('0x1f')](desk[_0xd170('0x30')]())[_0xd170('0x1f')](realtime[_0xd170('0x31')]())[_0xd170('0x1f')](zoho[_0xd170('0x32')]())[_0xd170('0x1f')](realtime['initZohoAccounts']())['then'](vtiger[_0xd170('0x33')]())[_0xd170('0x1f')](realtime[_0xd170('0x34')]())[_0xd170('0x1f')](freshsales[_0xd170('0x35')]())[_0xd170('0x1f')](realtime[_0xd170('0x36')]())[_0xd170('0x1f')](servicenow[_0xd170('0x37')]())['then'](realtime[_0xd170('0x38')]())[_0xd170('0x1f')](dynamics365['getDynamics365Accounts']())[_0xd170('0x1f')](realtime[_0xd170('0x39')]())['then'](campaign[_0xd170('0x3a')]())[_0xd170('0x1f')](realtime[_0xd170('0x3b')]())[_0xd170('0x1f')](voiceExtension[_0xd170('0x3c')]())[_0xd170('0x1f')](realtime['initVoiceExtensions']())[_0xd170('0x1f')](faxAccount[_0xd170('0x3d')]())['then'](realtime[_0xd170('0x3e')]())[_0xd170('0x1f')](function(){return realtime;});}function initParams(){return Promise[_0xd170('0x1e')]()[_0xd170('0x1f')](voiceQueueReport['getVoiceQueueReports']())[_0xd170('0x1f')](realtime[_0xd170('0x3f')]())[_0xd170('0x1f')](cmHopperHistory[_0xd170('0x40')]())[_0xd170('0x1f')](realtime['initVoiceQueueHopperHistory']())['then'](cmHopperHistory[_0xd170('0x41')]())['then'](realtime['initCampaignHopperHistory']())[_0xd170('0x1f')](voiceCallReport[_0xd170('0x42')]())[_0xd170('0x1f')](realtime[_0xd170('0x43')]())[_0xd170('0x44')](function(_0x5286d0){logger[_0xd170('0x45')](_0xd170('0x46'),util['inspect'](_0x5286d0,{'showHidden':![],'depth':null}));});}function main(){return server[_0xd170('0x47')](realtime,preview,fax)[_0xd170('0x1f')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xd170('0x1f')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x2db67d){logger[_0xd170('0x45')](_0xd170('0x48'),util['inspect'](_0x2db67d,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x19bc=['./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','initAgents','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','error','[index.js][initParams]','inspect','[index.js][main]','util','moment','./server','./realtime','./report','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x19bc,0x105));var _0xc19b=function(_0xb98547,_0x2cf263){_0xb98547=_0xb98547-0x0;var _0x37583d=_0x19bc[_0xb98547];return _0x37583d;};'use strict';var util=require(_0xc19b('0x0'));var moment=require(_0xc19b('0x1'));var server=require(_0xc19b('0x2'));var Realtime=require(_0xc19b('0x3'));var Report=require(_0xc19b('0x4'));var Acw=require('./acw');var Trigger=require(_0xc19b('0x5'));var Dialer=require(_0xc19b('0x6'));var Preview=require(_0xc19b('0x7'));var Fax=require(_0xc19b('0x8'));var user=require(_0xc19b('0x9'));var voiceQueue=require(_0xc19b('0xa'));var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0xc19b('0xb'));var trunk=require(_0xc19b('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xc19b('0xd'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xc19b('0xe'));var voiceExtension=require(_0xc19b('0xf'));var faxAccount=require(_0xc19b('0x10'));var zendesk=require(_0xc19b('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xc19b('0x12'));var freshdesk=require(_0xc19b('0x13'));var desk=require('./rpc/integrations/desk');var zoho=require(_0xc19b('0x14'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require(_0xc19b('0x15'));var servicenow=require(_0xc19b('0x16'));var dynamics365=require(_0xc19b('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xc19b('0x18'))(_0xc19b('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xc19b('0x1a')](_0xc19b('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xc19b('0x1a')](_0xc19b('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xc19b('0x1c')]()[_0xc19b('0x1d')](user['getAgents']())[_0xc19b('0x1d')](realtime[_0xc19b('0x1e')]())[_0xc19b('0x1d')](user['getTelephones']())['then'](realtime[_0xc19b('0x1f')]())[_0xc19b('0x1d')](trunk['getTrunks']())[_0xc19b('0x1d')](realtime[_0xc19b('0x20')]())[_0xc19b('0x1d')](voiceQueue['getVoiceQueues']())[_0xc19b('0x1d')](realtime[_0xc19b('0x21')]())[_0xc19b('0x1d')](trigger[_0xc19b('0x22')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x23')]())[_0xc19b('0x1d')](template[_0xc19b('0x24')]())['then'](realtime[_0xc19b('0x25')]())[_0xc19b('0x1d')](zendesk[_0xc19b('0x26')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x27')]())[_0xc19b('0x1d')](salesforce['getSalesforceAccounts']())[_0xc19b('0x1d')](realtime[_0xc19b('0x28')]())[_0xc19b('0x1d')](sugarcrm[_0xc19b('0x29')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x2a')]())[_0xc19b('0x1d')](freshdesk[_0xc19b('0x2b')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x2c')]())[_0xc19b('0x1d')](desk[_0xc19b('0x2d')]())[_0xc19b('0x1d')](realtime['initDeskAccounts']())[_0xc19b('0x1d')](zoho['getZohoAccounts']())['then'](realtime[_0xc19b('0x2e')]())[_0xc19b('0x1d')](vtiger[_0xc19b('0x2f')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x30')]())[_0xc19b('0x1d')](freshsales['getFreshsalesAccounts']())['then'](realtime[_0xc19b('0x31')]())['then'](servicenow[_0xc19b('0x32')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x33')]())['then'](dynamics365[_0xc19b('0x34')]())[_0xc19b('0x1d')](realtime['initDynamics365Accounts']())[_0xc19b('0x1d')](campaign[_0xc19b('0x35')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x36')]())[_0xc19b('0x1d')](voiceExtension[_0xc19b('0x37')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x38')]())[_0xc19b('0x1d')](faxAccount[_0xc19b('0x39')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x3a')]())[_0xc19b('0x1d')](function(){return realtime;});}function initParams(){return Promise[_0xc19b('0x1c')]()['then'](voiceQueueReport[_0xc19b('0x3b')]())[_0xc19b('0x1d')](realtime['initVoiceQueueReports']())[_0xc19b('0x1d')](cmHopperHistory[_0xc19b('0x3c')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x3d')]())[_0xc19b('0x1d')](cmHopperHistory[_0xc19b('0x3e')]())[_0xc19b('0x1d')](realtime[_0xc19b('0x3f')]())[_0xc19b('0x1d')](voiceCallReport[_0xc19b('0x40')]())[_0xc19b('0x1d')](realtime['initVoiceCallReports']())['catch'](function(_0x1ce716){logger[_0xc19b('0x41')](_0xc19b('0x42'),util[_0xc19b('0x43')](_0x1ce716,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0xc19b('0x1d')](function(){return initRealtime();})[_0xc19b('0x1d')](function(){return initParams();})[_0xc19b('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x464a5c){logger[_0xc19b('0x41')](_0xc19b('0x44'),util[_0xc19b('0x43')](_0x464a5c,{'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 1550697..676e755 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 _0x13c0=['user:ami:update','emit','user:presence','exports','lodash','util','moment','ioredis','redis','localhost','socket.io-emitter','name','email','fullname','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','not_inuse','idle','inuse','talking','voiceStatus','statePause','toNumber','format','user:%s'];(function(_0xb54b31,_0x4ac97c){var _0x49d88b=function(_0x3da58a){while(--_0x3da58a){_0xb54b31['push'](_0xb54b31['shift']());}};_0x49d88b(++_0x4ac97c);}(_0x13c0,0x79));var _0x013c=function(_0x430f44,_0x4ae21b){_0x430f44=_0x430f44-0x0;var _0x1f6b0f=_0x13c0[_0x430f44];return _0x1f6b0f;};'use strict';var _=require(_0x013c('0x0'));var util=require(_0x013c('0x1'));var moment=require(_0x013c('0x2'));var Redis=require(_0x013c('0x3'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x013c('0x4')],{'host':_0x013c('0x5'),'port':0x18eb});var io=require(_0x013c('0x6'))(new Redis(config[_0x013c('0x4')]));function Agent(_0x129de9){this['id']=_0x129de9['id']||0x0;this[_0x013c('0x7')]=_0x129de9[_0x013c('0x7')]||'';this[_0x013c('0x8')]=_0x129de9['email']||'';this['accountcode']=_0x129de9['accountcode']||'';this[_0x013c('0x9')]=_0x129de9[_0x013c('0x9')]||'';this['state']=_0x013c('0xa');this[_0x013c('0xb')]=0x0;this[_0x013c('0xc')]=_0x013c('0xa');this[_0x013c('0xd')]='';this[_0x013c('0xe')]='';this[_0x013c('0xf')]='';this[_0x013c('0x10')]='';this[_0x013c('0x11')]=_0x129de9[_0x013c('0x11')]||![];this['voiceStatus']='unknown';this[_0x013c('0x12')]=0x0;this[_0x013c('0x13')]='';this[_0x013c('0x14')]='';this[_0x013c('0x15')]=![];this['local']=![];}Agent[_0x013c('0x16')][_0x013c('0x17')]=function(_0xcfe81a){if(!_0xcfe81a[_0x013c('0x18')]){return;}var _0x424437=null;var _0x57f017=_0xcfe81a[_0x013c('0x18')][_0x013c('0x19')]();switch(_0x57f017){case _0x013c('0x1a'):_0x57f017=_0x013c('0x1b');break;case _0x013c('0x1c'):_0x57f017=_0x013c('0x1d');break;}if(this[_0x013c('0x1e')]!==_0x57f017||_0xcfe81a[_0x013c('0x1f')]){_0x424437=_[_0x013c('0x20')](moment()[_0x013c('0x21')]('x'));}var _0x34d59f={'id':this['id'],'name':this[_0x013c('0x7')],'email':this[_0x013c('0x8')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x013c('0x18')],'stateTime':this[_0x013c('0xb')],'status':this['status'],'address':this[_0x013c('0xd')],'voiceStatus':_0x57f017||this[_0x013c('0x1e')],'voiceStatusTime':_0x424437||this[_0x013c('0x12')],'voiceStatusCallerIdNumber':this[_0x013c('0x13')],'voiceStatusQueue':this[_0x013c('0x14')],'interface':this['interface'],'onhold':this[_0x013c('0x15')]};if(this[_0x013c('0x1e')]!==_0x57f017){this['voiceStatus']=_0x57f017;io['to'](util[_0x013c('0x21')](_0x013c('0x22'),_0x34d59f['name']))['emit'](_0x013c('0x23'),_0x34d59f);io[_0x013c('0x24')](_0x013c('0x25'),_0x34d59f);}};module[_0x013c('0x26')]=Agent; \ No newline at end of file +var _0xa8a8=['updateStatusRealtime','state','not_inuse','inuse','talking','statePause','toNumber','voiceStatusQueue','format','user:%s','emit','user:ami:update','user:presence','exports','lodash','util','moment','ioredis','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','stateTime','unknown','address','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','prototype'];(function(_0x2b58f8,_0x14f865){var _0x2af05b=function(_0x2c2bf3){while(--_0x2c2bf3){_0x2b58f8['push'](_0x2b58f8['shift']());}};_0x2af05b(++_0x14f865);}(_0xa8a8,0xec));var _0x8a8a=function(_0x2c94b2,_0x40bc91){_0x2c94b2=_0x2c94b2-0x0;var _0x12c6b6=_0xa8a8[_0x2c94b2];return _0x12c6b6;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var Redis=require(_0x8a8a('0x3'));var config=require('../../../config/environment');config[_0x8a8a('0x4')]=_[_0x8a8a('0x5')](config[_0x8a8a('0x4')],{'host':_0x8a8a('0x6'),'port':0x18eb});var io=require(_0x8a8a('0x7'))(new Redis(config[_0x8a8a('0x4')]));function Agent(_0x3184a3){this['id']=_0x3184a3['id']||0x0;this[_0x8a8a('0x8')]=_0x3184a3[_0x8a8a('0x8')]||'';this[_0x8a8a('0x9')]=_0x3184a3[_0x8a8a('0x9')]||'';this[_0x8a8a('0xa')]=_0x3184a3[_0x8a8a('0xa')]||'';this[_0x8a8a('0xb')]=_0x3184a3[_0x8a8a('0xb')]||'';this['state']='unknown';this[_0x8a8a('0xc')]=0x0;this['status']=_0x8a8a('0xd');this[_0x8a8a('0xe')]='';this['phone']='';this[_0x8a8a('0xf')]='';this[_0x8a8a('0x10')]='';this[_0x8a8a('0x11')]=_0x3184a3['online']||![];this[_0x8a8a('0x12')]=_0x8a8a('0xd');this[_0x8a8a('0x13')]=0x0;this[_0x8a8a('0x14')]='';this['voiceStatusQueue']='';this[_0x8a8a('0x15')]=![];this['local']=![];}Agent[_0x8a8a('0x16')][_0x8a8a('0x17')]=function(_0x787eec){if(!_0x787eec[_0x8a8a('0x18')]){return;}var _0x2ac893=null;var _0x78b0f0=_0x787eec[_0x8a8a('0x18')]['toLowerCase']();switch(_0x78b0f0){case _0x8a8a('0x19'):_0x78b0f0='idle';break;case _0x8a8a('0x1a'):_0x78b0f0=_0x8a8a('0x1b');break;}if(this[_0x8a8a('0x12')]!==_0x78b0f0||_0x787eec[_0x8a8a('0x1c')]){_0x2ac893=_[_0x8a8a('0x1d')](moment()['format']('x'));}var _0x9d55f9={'id':this['id'],'name':this[_0x8a8a('0x8')],'email':this[_0x8a8a('0x9')],'accountcode':this[_0x8a8a('0xa')],'fullname':this[_0x8a8a('0xb')],'state':this[_0x8a8a('0x18')],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'voiceStatus':_0x78b0f0||this['voiceStatus'],'voiceStatusTime':_0x2ac893||this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0x8a8a('0x14')],'voiceStatusQueue':this[_0x8a8a('0x1e')],'interface':this[_0x8a8a('0x10')],'onhold':this[_0x8a8a('0x15')]};if(this[_0x8a8a('0x12')]!==_0x78b0f0){this[_0x8a8a('0x12')]=_0x78b0f0;io['to'](util[_0x8a8a('0x1f')](_0x8a8a('0x20'),_0x9d55f9[_0x8a8a('0x8')]))[_0x8a8a('0x21')](_0x8a8a('0x22'),_0x9d55f9);io[_0x8a8a('0x21')](_0x8a8a('0x23'),_0x9d55f9);}};module[_0x8a8a('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ac94607..d115cbb 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 _0x36e2=['dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone'];(function(_0x23fbf0,_0x505f60){var _0x443648=function(_0x310c10){while(--_0x310c10){_0x23fbf0['push'](_0x23fbf0['shift']());}};_0x443648(++_0x505f60);}(_0x36e2,0x1f3));var _0x236e=function(_0x2d89af,_0x7d918f){_0x2d89af=_0x2d89af-0x0;var _0x581ecc=_0x36e2[_0x2d89af];return _0x581ecc;};'use strict';function Campaign(_0x2f9407){this['id']=_0x2f9407['id']||0x0;this['name']=_0x2f9407[_0x236e('0x0')]||'';this[_0x236e('0x1')]=_0x2f9407['type']||'campaign';this[_0x236e('0x2')]=0x0;this[_0x236e('0x3')]=0x0;this[_0x236e('0x4')]=0x0;this[_0x236e('0x5')]=0x0;this[_0x236e('0x6')]='';this[_0x236e('0x7')]=!![];this[_0x236e('0x8')]=_0x2f9407['active'];this[_0x236e('0x9')]=_0x2f9407['limitCalls'];this['dialTimezone']=_0x2f9407[_0x236e('0xa')]||null;this[_0x236e('0xb')]=_0x2f9407['dialGlobalInterval']?_0x2f9407[_0x236e('0xb')]:null;this[_0x236e('0xc')]=_0x2f9407[_0x236e('0xc')];this[_0x236e('0xd')]=_0x2f9407[_0x236e('0xd')];this[_0x236e('0xe')]=_0x2f9407[_0x236e('0xe')]||0x1e;this[_0x236e('0xf')]=_0x2f9407['dialCongestionMaxRetry'];this[_0x236e('0x10')]=_0x2f9407[_0x236e('0x10')];this[_0x236e('0x11')]=_0x2f9407[_0x236e('0x11')];this[_0x236e('0x12')]=_0x2f9407[_0x236e('0x12')];this[_0x236e('0x13')]=_0x2f9407['dialNoAnswerMaxRetry'];this[_0x236e('0x14')]=_0x2f9407['dialNoAnswerRetryFrequency'];this[_0x236e('0x15')]=_0x2f9407[_0x236e('0x15')];this['dialNoSuchNumberMaxRetry']=_0x2f9407[_0x236e('0x16')]||0x3;this[_0x236e('0x17')]=_0x2f9407['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x2f9407[_0x236e('0x18')]||0x3;this['dialDropRetryFrequency']=_0x2f9407[_0x236e('0x19')]||0x96;this[_0x236e('0x1a')]=_0x2f9407['dialAbandonedMaxRetry']||0x3;this[_0x236e('0x1b')]=_0x2f9407['dialAbandonedRetryFrequency']||0x96;this[_0x236e('0x1c')]=_0x2f9407[_0x236e('0x1c')]||0x3;this[_0x236e('0x1d')]=_0x2f9407[_0x236e('0x1d')]||0x96;this[_0x236e('0x1e')]=_0x2f9407[_0x236e('0x1e')]||0x3;this['dialAgentRejectRetryFrequency']=_0x2f9407[_0x236e('0x1f')]||0x96;this[_0x236e('0x20')]=_0x2f9407['dialOrderByScheduledAt']||'DESC';this[_0x236e('0x21')]=_0x2f9407[_0x236e('0x21')]||undefined;this[_0x236e('0x22')]=_0x2f9407[_0x236e('0x22')]||undefined;this['dialCutDigit']=_0x2f9407[_0x236e('0x23')]||undefined;this['TrunkBackup']=_0x2f9407['TrunkBackup']?_0x2f9407[_0x236e('0x24')]:undefined;this['Trunk']=_0x2f9407['Trunk']?_0x2f9407['Trunk']:undefined;this[_0x236e('0x25')]=_0x2f9407['Interval']?_0x2f9407[_0x236e('0x25')]:undefined;this[_0x236e('0x26')]=_0x2f9407[_0x236e('0x26')]?_0x2f9407[_0x236e('0x26')]:undefined;this[_0x236e('0x27')]=_0x2f9407['SquareProject']?_0x2f9407['SquareProject'][_0x236e('0x0')]:undefined;this[_0x236e('0x28')]=_0x2f9407[_0x236e('0x28')]||![];this[_0x236e('0x29')]=_0x2f9407[_0x236e('0x29')];this[_0x236e('0x2a')]=_0x2f9407[_0x236e('0x2a')];this[_0x236e('0x2b')]=_0x2f9407[_0x236e('0x2b')];this[_0x236e('0x2c')]=_0x2f9407[_0x236e('0x2c')];this[_0x236e('0x2d')]=_0x2f9407[_0x236e('0x2d')];this[_0x236e('0x2e')]=_0x2f9407[_0x236e('0x2e')];this[_0x236e('0x2f')]=_0x2f9407[_0x236e('0x2f')];this[_0x236e('0x30')]=_0x2f9407[_0x236e('0x30')];this[_0x236e('0x31')]=_0x2f9407[_0x236e('0x31')];}module[_0x236e('0x32')]=Campaign; \ No newline at end of file +var _0x7d3b=['dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','exports','name','type','campaign','originated','message','active','limitCalls'];(function(_0x223cc4,_0x338a1f){var _0x6543c4=function(_0x5b9e19){while(--_0x5b9e19){_0x223cc4['push'](_0x223cc4['shift']());}};_0x6543c4(++_0x338a1f);}(_0x7d3b,0xb5));var _0xb7d3=function(_0x5aaa70,_0x2e54af){_0x5aaa70=_0x5aaa70-0x0;var _0xe8a5b=_0x7d3b[_0x5aaa70];return _0xe8a5b;};'use strict';function Campaign(_0x2ef8c4){this['id']=_0x2ef8c4['id']||0x0;this[_0xb7d3('0x0')]=_0x2ef8c4[_0xb7d3('0x0')]||'';this[_0xb7d3('0x1')]=_0x2ef8c4[_0xb7d3('0x1')]||_0xb7d3('0x2');this[_0xb7d3('0x3')]=0x0;this['temp']=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0xb7d3('0x4')]='';this['sendMessageOneNotActive']=!![];this['active']=_0x2ef8c4[_0xb7d3('0x5')];this[_0xb7d3('0x6')]=_0x2ef8c4[_0xb7d3('0x6')];this[_0xb7d3('0x7')]=_0x2ef8c4[_0xb7d3('0x7')]||null;this[_0xb7d3('0x8')]=_0x2ef8c4[_0xb7d3('0x8')]?_0x2ef8c4['dialGlobalInterval']:null;this[_0xb7d3('0x9')]=_0x2ef8c4[_0xb7d3('0x9')];this[_0xb7d3('0xa')]=_0x2ef8c4[_0xb7d3('0xa')];this[_0xb7d3('0xb')]=_0x2ef8c4['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x2ef8c4['dialCongestionMaxRetry'];this[_0xb7d3('0xc')]=_0x2ef8c4[_0xb7d3('0xc')];this[_0xb7d3('0xd')]=_0x2ef8c4[_0xb7d3('0xd')];this[_0xb7d3('0xe')]=_0x2ef8c4['dialBusyRetryFrequency'];this[_0xb7d3('0xf')]=_0x2ef8c4[_0xb7d3('0xf')];this[_0xb7d3('0x10')]=_0x2ef8c4[_0xb7d3('0x10')];this['dialGlobalMaxRetry']=_0x2ef8c4['dialGlobalMaxRetry'];this[_0xb7d3('0x11')]=_0x2ef8c4['dialNoSuchNumberMaxRetry']||0x3;this[_0xb7d3('0x12')]=_0x2ef8c4[_0xb7d3('0x12')]||0x96;this[_0xb7d3('0x13')]=_0x2ef8c4[_0xb7d3('0x13')]||0x3;this[_0xb7d3('0x14')]=_0x2ef8c4[_0xb7d3('0x14')]||0x96;this['dialAbandonedMaxRetry']=_0x2ef8c4[_0xb7d3('0x15')]||0x3;this[_0xb7d3('0x16')]=_0x2ef8c4[_0xb7d3('0x16')]||0x96;this[_0xb7d3('0x17')]=_0x2ef8c4[_0xb7d3('0x17')]||0x3;this[_0xb7d3('0x18')]=_0x2ef8c4[_0xb7d3('0x18')]||0x96;this[_0xb7d3('0x19')]=_0x2ef8c4[_0xb7d3('0x19')]||0x3;this[_0xb7d3('0x1a')]=_0x2ef8c4[_0xb7d3('0x1a')]||0x96;this[_0xb7d3('0x1b')]=_0x2ef8c4[_0xb7d3('0x1b')]||_0xb7d3('0x1c');this[_0xb7d3('0x1d')]=_0x2ef8c4[_0xb7d3('0x1d')]||undefined;this[_0xb7d3('0x1e')]=_0x2ef8c4[_0xb7d3('0x1e')]||undefined;this[_0xb7d3('0x1f')]=_0x2ef8c4['dialCutDigit']||undefined;this[_0xb7d3('0x20')]=_0x2ef8c4[_0xb7d3('0x20')]?_0x2ef8c4[_0xb7d3('0x20')]:undefined;this[_0xb7d3('0x21')]=_0x2ef8c4[_0xb7d3('0x21')]?_0x2ef8c4[_0xb7d3('0x21')]:undefined;this[_0xb7d3('0x22')]=_0x2ef8c4[_0xb7d3('0x22')]?_0x2ef8c4[_0xb7d3('0x22')]:undefined;this[_0xb7d3('0x23')]=_0x2ef8c4['SquareProject']?_0x2ef8c4[_0xb7d3('0x23')]:undefined;this[_0xb7d3('0x24')]=_0x2ef8c4[_0xb7d3('0x23')]?_0x2ef8c4[_0xb7d3('0x23')][_0xb7d3('0x0')]:undefined;this[_0xb7d3('0x25')]=_0x2ef8c4[_0xb7d3('0x25')]||![];this[_0xb7d3('0x26')]=_0x2ef8c4['dialAMDInitialSilence'];this[_0xb7d3('0x27')]=_0x2ef8c4[_0xb7d3('0x27')];this[_0xb7d3('0x28')]=_0x2ef8c4[_0xb7d3('0x28')];this[_0xb7d3('0x29')]=_0x2ef8c4[_0xb7d3('0x29')];this['dialAMDMinWordLength']=_0x2ef8c4[_0xb7d3('0x2a')];this[_0xb7d3('0x2b')]=_0x2ef8c4['dialAMDBetweenWordsSilence'];this[_0xb7d3('0x2c')]=_0x2ef8c4[_0xb7d3('0x2c')];this[_0xb7d3('0x2d')]=_0x2ef8c4[_0xb7d3('0x2d')];this['dialAMDMaximumWordLength']=_0x2ef8c4['dialAMDMaximumWordLength'];}module[_0xb7d3('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 c8229ea..503c2c3 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 _0xfb0b=['lastdata','duration','billableseconds','monitor','monitorFilename','queue','transfercalleridnum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinenum','context','linkedid','exten','answered','answertime','endtime','unmanaged','lastapplication'];(function(_0x542d0c,_0x56f1b3){var _0x391db0=function(_0x22eb74){while(--_0x22eb74){_0x542d0c['push'](_0x542d0c['shift']());}};_0x391db0(++_0x56f1b3);}(_0xfb0b,0x94));var _0xbfb0=function(_0x43d634,_0x6b8dcd){_0x43d634=_0x43d634-0x0;var _0x1d80de=_0xfb0b[_0x43d634];return _0x1d80de;};'use strict';function Channel(){this[_0xbfb0('0x0')]=null;this[_0xbfb0('0x1')]='';this[_0xbfb0('0x2')]='';this['calleridnum']=0x0;this[_0xbfb0('0x3')]='';this[_0xbfb0('0x4')]=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this[_0xbfb0('0x5')]='';this['uniqueid']=0x0;this[_0xbfb0('0x6')]=0x0;this[_0xbfb0('0x7')]=0x0;this[_0xbfb0('0x8')]=![];this[_0xbfb0('0x9')]=null;this[_0xbfb0('0xa')]=null;this[_0xbfb0('0xb')]=![];this['abandoned']=![];this[_0xbfb0('0xc')]='';this[_0xbfb0('0xd')]='';this[_0xbfb0('0xe')]=0x0;this[_0xbfb0('0xf')]=0x0;this['holdtime']=0x0;this['type']=null;this['tag']=null;this['disposition']=null;this[_0xbfb0('0x10')]=![];this[_0xbfb0('0x11')]=null;this[_0xbfb0('0x12')]=null;this['monitors']=[];this[_0xbfb0('0x13')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xbfb0('0x14')]=undefined;this[_0xbfb0('0x15')]=0x0;}module[_0xbfb0('0x16')]=Channel; \ No newline at end of file +var _0x4f7a=['tag','disposition','monitor','monitorFilename','queue','monitors','transferType','mohtime','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','linkedid','answered','answertime','abandoned','lastapplication','lastdata','duration','billableseconds','type'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x4f7a,0x105));var _0xa4f7=function(_0x2db942,_0x59fae2){_0x2db942=_0x2db942-0x0;var _0x47e838=_0x4f7a[_0x2db942];return _0x47e838;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xa4f7('0x0')]='';this[_0xa4f7('0x1')]=0x0;this[_0xa4f7('0x2')]='';this['connectedlinenum']=undefined;this[_0xa4f7('0x3')]=undefined;this['accountcode']=0x0;this[_0xa4f7('0x4')]='';this[_0xa4f7('0x5')]=0x0;this[_0xa4f7('0x6')]=0x0;this['exten']=0x0;this[_0xa4f7('0x7')]=![];this[_0xa4f7('0x8')]=null;this['endtime']=null;this['unmanaged']=![];this[_0xa4f7('0x9')]=![];this[_0xa4f7('0xa')]='';this[_0xa4f7('0xb')]='';this[_0xa4f7('0xc')]=0x0;this[_0xa4f7('0xd')]=0x0;this['holdtime']=0x0;this[_0xa4f7('0xe')]=null;this[_0xa4f7('0xf')]=null;this[_0xa4f7('0x10')]=null;this[_0xa4f7('0x11')]=![];this[_0xa4f7('0x12')]=null;this[_0xa4f7('0x13')]=null;this[_0xa4f7('0x14')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0xa4f7('0x15')]=undefined;this[_0xa4f7('0x16')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 781bf33..a060a82 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 _0xa319=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0xdc37a1,_0x53ebb9){var _0x99b4fe=function(_0x2811e3){while(--_0x2811e3){_0xdc37a1['push'](_0xdc37a1['shift']());}};_0x99b4fe(++_0x53ebb9);}(_0xa319,0x8f));var _0x9a31=function(_0x595a10,_0x29c5cc){_0x595a10=_0x595a10-0x0;var _0x2c3df6=_0xa319[_0x595a10];return _0x2c3df6;};'use strict';function DeskAccount(_0x35e5f5){this['id']=_0x35e5f5['id']||0x0;this[_0x9a31('0x0')]=_0x35e5f5[_0x9a31('0x0')]||'';this['username']=_0x35e5f5['username']||'';this[_0x9a31('0x1')]=_0x35e5f5[_0x9a31('0x1')]||'';this[_0x9a31('0x2')]=_0x35e5f5[_0x9a31('0x2')]||'';this['password']=_0x35e5f5[_0x9a31('0x3')]||'';this[_0x9a31('0x4')]=_0x35e5f5[_0x9a31('0x4')]||'';this[_0x9a31('0x5')]=_0x35e5f5[_0x9a31('0x5')]||'';this[_0x9a31('0x6')]=_0x35e5f5[_0x9a31('0x6')]||'';this[_0x9a31('0x7')]=_0x35e5f5[_0x9a31('0x7')]||'';this['type']=_0x35e5f5[_0x9a31('0x8')]||'';this[_0x9a31('0x9')]=_0x35e5f5['serverUrl']||'';this[_0x9a31('0xa')]=_0x35e5f5[_0x9a31('0xa')]||{};}module[_0x9a31('0xb')]=DeskAccount; \ No newline at end of file +var _0x6c69=['authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri'];(function(_0x178e68,_0x3998fc){var _0x501363=function(_0x29c29c){while(--_0x29c29c){_0x178e68['push'](_0x178e68['shift']());}};_0x501363(++_0x3998fc);}(_0x6c69,0xa5));var _0x96c6=function(_0x855b1c,_0x131bc8){_0x855b1c=_0x855b1c-0x0;var _0x5b4c9e=_0x6c69[_0x855b1c];return _0x5b4c9e;};'use strict';function DeskAccount(_0x3cd4ed){this['id']=_0x3cd4ed['id']||0x0;this[_0x96c6('0x0')]=_0x3cd4ed[_0x96c6('0x0')]||'';this[_0x96c6('0x1')]=_0x3cd4ed[_0x96c6('0x1')]||'';this[_0x96c6('0x2')]=_0x3cd4ed[_0x96c6('0x2')]||'';this[_0x96c6('0x3')]=_0x3cd4ed['authType']||'';this[_0x96c6('0x4')]=_0x3cd4ed[_0x96c6('0x4')]||'';this[_0x96c6('0x5')]=_0x3cd4ed[_0x96c6('0x5')]||'';this[_0x96c6('0x6')]=_0x3cd4ed[_0x96c6('0x6')]||'';this[_0x96c6('0x7')]=_0x3cd4ed[_0x96c6('0x7')]||'';this[_0x96c6('0x8')]=_0x3cd4ed[_0x96c6('0x8')]||'';this[_0x96c6('0x9')]=_0x3cd4ed[_0x96c6('0x9')]||'';this[_0x96c6('0xa')]=_0x3cd4ed['serverUrl']||'';this[_0x96c6('0xb')]=_0x3cd4ed[_0x96c6('0xb')]||{};}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 28768ff..979388b 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 _0x682a=['Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x682a,0xbe));var _0xa682=function(_0x55c8cc,_0x1a559b){_0x55c8cc=_0x55c8cc-0x0;var _0x2e20cc=_0x682a[_0x55c8cc];return _0x2e20cc;};'use strict';function Dynamics365Account(_0x9828a9){this['id']=_0x9828a9['id']||0x0;this[_0xa682('0x0')]=_0x9828a9[_0xa682('0x0')]||'';this[_0xa682('0x1')]=_0x9828a9[_0xa682('0x1')]||'';this['password']=_0x9828a9[_0xa682('0x2')]||'';this['remoteUri']=_0x9828a9[_0xa682('0x3')]||'';this[_0xa682('0x4')]=_0x9828a9[_0xa682('0x4')]||'';this[_0xa682('0x5')]=_0x9828a9[_0xa682('0x5')]||'';this[_0xa682('0x6')]=_0x9828a9[_0xa682('0x6')]||{};this[_0xa682('0x7')]=_0x9828a9[_0xa682('0x7')]||'';this['modernAuthentication']=_0x9828a9['modernAuthentication']||![];this[_0xa682('0x8')]=_0x9828a9[_0xa682('0x8')]||{};this[_0xa682('0x9')]=_0x9828a9[_0xa682('0x9')]||{};}module[_0xa682('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x24d3=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x47b927,_0x280e4b){var _0x4bac41=function(_0x22b5b3){while(--_0x22b5b3){_0x47b927['push'](_0x47b927['shift']());}};_0x4bac41(++_0x280e4b);}(_0x24d3,0x140));var _0x324d=function(_0xd38d53,_0x17d20e){_0xd38d53=_0xd38d53-0x0;var _0x2ceeda=_0x24d3[_0xd38d53];return _0x2ceeda;};'use strict';function Dynamics365Account(_0x2468eb){this['id']=_0x2468eb['id']||0x0;this[_0x324d('0x0')]=_0x2468eb['name']||'';this[_0x324d('0x1')]=_0x2468eb['username']||'';this[_0x324d('0x2')]=_0x2468eb[_0x324d('0x2')]||'';this[_0x324d('0x3')]=_0x2468eb[_0x324d('0x3')]||'';this[_0x324d('0x4')]=_0x2468eb[_0x324d('0x4')]||'';this[_0x324d('0x5')]=_0x2468eb['clientId']||'';this[_0x324d('0x6')]=_0x2468eb['clientSecret']||{};this[_0x324d('0x7')]=_0x2468eb[_0x324d('0x7')]||'';this[_0x324d('0x8')]=_0x2468eb['modernAuthentication']||![];this[_0x324d('0x9')]=_0x2468eb[_0x324d('0x9')]||{};this[_0x324d('0xa')]=_0x2468eb['CloudProvider']||{};}module[_0x324d('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 17e5d0e..8079bd0 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 _0x4bf5=['tech','SIP','Trunk','key','exports','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0xd8b86f,_0x544db1){var _0x417622=function(_0x39efd8){while(--_0x39efd8){_0xd8b86f['push'](_0xd8b86f['shift']());}};_0x417622(++_0x544db1);}(_0x4bf5,0xe6));var _0x54bf=function(_0x2ddbff,_0x4cad9d){_0x2ddbff=_0x2ddbff-0x0;var _0x47dc7b=_0x4bf5[_0x2ddbff];return _0x47dc7b;};'use strict';function FaxAccount(_0x6132d3){this['id']=_0x6132d3['id']||0x0;this['name']=_0x6132d3['name']||'';this[_0x54bf('0x0')]=_0x6132d3[_0x54bf('0x0')];this[_0x54bf('0x1')]=_0x6132d3['ecm'];this['headerinfo']=_0x6132d3[_0x54bf('0x2')];this[_0x54bf('0x3')]=_0x6132d3['localstationid'];this[_0x54bf('0x4')]=_0x6132d3[_0x54bf('0x4')]||0x960;this['maxrate']=_0x6132d3[_0x54bf('0x5')]||0x3840;this['modem']=_0x6132d3[_0x54bf('0x6')]||'v17,v27,v29';this[_0x54bf('0x7')]=_0x6132d3[_0x54bf('0x7')]||'no';this['faxdetect']=_0x6132d3[_0x54bf('0x8')]||'no';this[_0x54bf('0x9')]=_0x6132d3[_0x54bf('0x9')]||0x1388;this['tech']=_0x6132d3[_0x54bf('0xa')]||_0x54bf('0xb');this[_0x54bf('0xc')]=_0x6132d3[_0x54bf('0xc')]?_0x6132d3['Trunk']:undefined;this['ListId']=_0x6132d3['ListId'];this[_0x54bf('0xd')]=_0x6132d3['key'];}module[_0x54bf('0xe')]=FaxAccount; \ No newline at end of file +var _0x9f8b=['ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk'];(function(_0x277afb,_0x1bfca8){var _0x3dae86=function(_0x540015){while(--_0x540015){_0x277afb['push'](_0x277afb['shift']());}};_0x3dae86(++_0x1bfca8);}(_0x9f8b,0x1f0));var _0xb9f8=function(_0x11b3bf,_0xca12c){_0x11b3bf=_0x11b3bf-0x0;var _0x2eeb8b=_0x9f8b[_0x11b3bf];return _0x2eeb8b;};'use strict';function FaxAccount(_0x30cbc4){this['id']=_0x30cbc4['id']||0x0;this[_0xb9f8('0x0')]=_0x30cbc4[_0xb9f8('0x0')]||'';this[_0xb9f8('0x1')]=_0x30cbc4[_0xb9f8('0x1')];this[_0xb9f8('0x2')]=_0x30cbc4['ecm'];this[_0xb9f8('0x3')]=_0x30cbc4[_0xb9f8('0x3')];this[_0xb9f8('0x4')]=_0x30cbc4['localstationid'];this[_0xb9f8('0x5')]=_0x30cbc4[_0xb9f8('0x5')]||0x960;this[_0xb9f8('0x6')]=_0x30cbc4[_0xb9f8('0x6')]||0x3840;this[_0xb9f8('0x7')]=_0x30cbc4[_0xb9f8('0x7')]||_0xb9f8('0x8');this['gateway']=_0x30cbc4[_0xb9f8('0x9')]||'no';this[_0xb9f8('0xa')]=_0x30cbc4[_0xb9f8('0xa')]||'no';this['t38timeout']=_0x30cbc4['t38timeout']||0x1388;this[_0xb9f8('0xb')]=_0x30cbc4[_0xb9f8('0xb')]||_0xb9f8('0xc');this[_0xb9f8('0xd')]=_0x30cbc4[_0xb9f8('0xd')]?_0x30cbc4[_0xb9f8('0xd')]:undefined;this[_0xb9f8('0xe')]=_0x30cbc4[_0xb9f8('0xe')];this[_0xb9f8('0xf')]=_0x30cbc4[_0xb9f8('0xf')];}module[_0xb9f8('0x10')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 5855c76..8c0643e 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 _0x2474=['name','username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x2441f0,_0x433b79){var _0x3f8141=function(_0x11935b){while(--_0x11935b){_0x2441f0['push'](_0x2441f0['shift']());}};_0x3f8141(++_0x433b79);}(_0x2474,0xbd));var _0x4247=function(_0x234886,_0x822145){_0x234886=_0x234886-0x0;var _0x5da9a4=_0x2474[_0x234886];return _0x5da9a4;};'use strict';function FreshdeskAccount(_0x48f455){this['id']=_0x48f455['id']||0x0;this[_0x4247('0x0')]=_0x48f455['name']||'';this[_0x4247('0x1')]=_0x48f455[_0x4247('0x1')]||'';this[_0x4247('0x2')]=_0x48f455[_0x4247('0x3')]||'';this[_0x4247('0x4')]=_0x48f455['remoteUri']||'';this['serverUrl']=_0x48f455['serverUrl']||'';this[_0x4247('0x5')]=_0x48f455[_0x4247('0x5')]||{};}module[_0x4247('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xd463=['exports','username','apiKey','token','serverUrl','Configurations'];(function(_0x28802d,_0x1792ac){var _0x52b6b5=function(_0x377f1c){while(--_0x377f1c){_0x28802d['push'](_0x28802d['shift']());}};_0x52b6b5(++_0x1792ac);}(_0xd463,0x7f));var _0x3d46=function(_0x216428,_0x5d20ea){_0x216428=_0x216428-0x0;var _0x313dd4=_0xd463[_0x216428];return _0x313dd4;};'use strict';function FreshdeskAccount(_0x5cb270){this['id']=_0x5cb270['id']||0x0;this['name']=_0x5cb270['name']||'';this[_0x3d46('0x0')]=_0x5cb270[_0x3d46('0x0')]||'';this[_0x3d46('0x1')]=_0x5cb270[_0x3d46('0x2')]||'';this['remoteUri']=_0x5cb270['remoteUri']||'';this['serverUrl']=_0x5cb270[_0x3d46('0x3')]||'';this['Configurations']=_0x5cb270[_0x3d46('0x4')]||{};}module[_0x3d46('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7f1fbf1..844f377 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 _0x3bd7=['serverUrl','Configurations','exports','name','username','token','remoteUri'];(function(_0x1f097d,_0x511f64){var _0x5e2cf9=function(_0x27200a){while(--_0x27200a){_0x1f097d['push'](_0x1f097d['shift']());}};_0x5e2cf9(++_0x511f64);}(_0x3bd7,0x199));var _0x73bd=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x3bd7[_0x1034bb];return _0x453fdb;};'use strict';function FreshsalesAccount(_0x5a1636){this['id']=_0x5a1636['id']||0x0;this['name']=_0x5a1636[_0x73bd('0x0')]||'';this[_0x73bd('0x1')]=_0x5a1636[_0x73bd('0x1')]||'';this['apiKey']=_0x5a1636[_0x73bd('0x2')]||'';this[_0x73bd('0x3')]=_0x5a1636[_0x73bd('0x3')]||'';this['serverUrl']=_0x5a1636[_0x73bd('0x4')]||'';this['Configurations']=_0x5a1636[_0x73bd('0x5')]||{};}module[_0x73bd('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x35d0=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x39bc80,_0x18f609){var _0x350050=function(_0x318e71){while(--_0x318e71){_0x39bc80['push'](_0x39bc80['shift']());}};_0x350050(++_0x18f609);}(_0x35d0,0xf9));var _0x035d=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0x35d0[_0x489b87];return _0x1823b6;};'use strict';function FreshsalesAccount(_0x5dadff){this['id']=_0x5dadff['id']||0x0;this[_0x035d('0x0')]=_0x5dadff['name']||'';this[_0x035d('0x1')]=_0x5dadff[_0x035d('0x1')]||'';this[_0x035d('0x2')]=_0x5dadff[_0x035d('0x3')]||'';this[_0x035d('0x4')]=_0x5dadff[_0x035d('0x4')]||'';this['serverUrl']=_0x5dadff[_0x035d('0x5')]||'';this[_0x035d('0x6')]=_0x5dadff[_0x035d('0x6')]||{};}module[_0x035d('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 5c77b00..81ae2f4 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 _0xf5aa=['accountcode','context','exten','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridname','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename'];(function(_0x331f21,_0x451d42){var _0x4da807=function(_0x55df7f){while(--_0x55df7f){_0x331f21['push'](_0x331f21['shift']());}};_0x4da807(++_0x451d42);}(_0xf5aa,0xc1));var _0xaf5a=function(_0x50e225,_0x39484d){_0x50e225=_0x50e225-0x0;var _0x112da6=_0xf5aa[_0x50e225];return _0x112da6;};'use strict';function QueueReport(){this[_0xaf5a('0x0')]=_0xaf5a('0x1');this[_0xaf5a('0x2')]='';this['calleridnum']='';this[_0xaf5a('0x3')]='';this['queue']='';this[_0xaf5a('0x4')]=null;this[_0xaf5a('0x5')]=null;this['position']=0x1;this['count']=0x1;this[_0xaf5a('0x6')]=![];this[_0xaf5a('0x7')]=null;this[_0xaf5a('0x8')]=![];this[_0xaf5a('0x9')]=null;this[_0xaf5a('0xa')]=![];this[_0xaf5a('0xb')]=null;this[_0xaf5a('0xc')]=0x1;this['channel']='';this[_0xaf5a('0xd')]='';this[_0xaf5a('0xe')]='';this[_0xaf5a('0xf')]='';this[_0xaf5a('0x10')]='';this[_0xaf5a('0x11')]='';this['priority']='';this['holdtime']=0x0;this[_0xaf5a('0x12')]=![];this[_0xaf5a('0x13')]='';this[_0xaf5a('0x14')]=_0xaf5a('0x15');this[_0xaf5a('0x16')]=null;this[_0xaf5a('0x17')]=0x0;this[_0xaf5a('0x18')]={};}module[_0xaf5a('0x19')]=QueueReport; \ No newline at end of file +var _0x57a4=['queuecallerexitAt','channel','connectedlinename','holdtime','assigned','lastAssignedTo','motionChannel','voice','routealias','mohtime','variables','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57a4,0x106));var _0x457a=function(_0x355fb1,_0x7b9ceb){_0x355fb1=_0x355fb1-0x0;var _0x4ee0f9=_0x57a4[_0x355fb1];return _0x4ee0f9;};'use strict';function QueueReport(){this[_0x457a('0x0')]=_0x457a('0x1');this[_0x457a('0x2')]='';this[_0x457a('0x3')]='';this[_0x457a('0x4')]='';this[_0x457a('0x5')]='';this[_0x457a('0x6')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0x457a('0x7')]=0x1;this[_0x457a('0x8')]=![];this[_0x457a('0x9')]=null;this[_0x457a('0xa')]=![];this[_0x457a('0xb')]=null;this[_0x457a('0xc')]=![];this[_0x457a('0xd')]=null;this['originalposition']=0x1;this[_0x457a('0xe')]='';this['connectedlinenum']='';this[_0x457a('0xf')]='';this['accountcode']='';this['context']='';this['exten']='';this['priority']='';this[_0x457a('0x10')]=0x0;this[_0x457a('0x11')]=![];this[_0x457a('0x12')]='';this[_0x457a('0x13')]=_0x457a('0x14');this[_0x457a('0x15')]=null;this[_0x457a('0x16')]=0x0;this[_0x457a('0x17')]={};}module[_0x457a('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index be49077..50ae547 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 _0x4e52=['clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x5ec65a,_0x2d3d58){var _0x54aa32=function(_0x2018ba){while(--_0x2018ba){_0x5ec65a['push'](_0x5ec65a['shift']());}};_0x54aa32(++_0x2d3d58);}(_0x4e52,0x1b8));var _0x24e5=function(_0x1fca54,_0x40a8e3){_0x1fca54=_0x1fca54-0x0;var _0x453ac5=_0x4e52[_0x1fca54];return _0x453ac5;};'use strict';function SalesforceAccount(_0x3794df){this['id']=_0x3794df['id']||0x0;this[_0x24e5('0x0')]=_0x3794df['name']||'';this[_0x24e5('0x1')]=_0x3794df[_0x24e5('0x1')]||'';this[_0x24e5('0x2')]=_0x3794df[_0x24e5('0x2')]||'';this[_0x24e5('0x3')]=_0x3794df[_0x24e5('0x3')]||'';this['clientId']=_0x3794df[_0x24e5('0x4')]||'';this[_0x24e5('0x5')]=_0x3794df[_0x24e5('0x5')]||'';this[_0x24e5('0x6')]=_0x3794df['securityToken']||'';this['type']=_0x3794df[_0x24e5('0x7')]||_0x24e5('0x8');this[_0x24e5('0x9')]=_0x3794df['serverUrl']||'';this[_0x24e5('0xa')]=_0x3794df[_0x24e5('0xa')]||{};}module[_0x24e5('0xb')]=SalesforceAccount; \ No newline at end of file +var _0xcdcb=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0x4c6b4f,_0x291ab7){var _0x1a254f=function(_0x46f67a){while(--_0x46f67a){_0x4c6b4f['push'](_0x4c6b4f['shift']());}};_0x1a254f(++_0x291ab7);}(_0xcdcb,0x75));var _0xbcdc=function(_0x54ade5,_0x205b0c){_0x54ade5=_0x54ade5-0x0;var _0x6973dc=_0xcdcb[_0x54ade5];return _0x6973dc;};'use strict';function SalesforceAccount(_0x26620d){this['id']=_0x26620d['id']||0x0;this[_0xbcdc('0x0')]=_0x26620d[_0xbcdc('0x0')]||'';this[_0xbcdc('0x1')]=_0x26620d[_0xbcdc('0x1')]||'';this[_0xbcdc('0x2')]=_0x26620d['remoteUri']||'';this[_0xbcdc('0x3')]=_0x26620d[_0xbcdc('0x3')]||'';this['clientId']=_0x26620d['clientId']||'';this[_0xbcdc('0x4')]=_0x26620d['clientSecret']||'';this['securityToken']=_0x26620d[_0xbcdc('0x5')]||'';this[_0xbcdc('0x6')]=_0x26620d['type']||_0xbcdc('0x7');this[_0xbcdc('0x8')]=_0x26620d[_0xbcdc('0x8')]||'';this[_0xbcdc('0x9')]=_0x26620d[_0xbcdc('0x9')]||{};}module[_0xbcdc('0xa')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 385226b..050f8a0 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 _0xec8e=['password','remoteUri','Configurations','name','username'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xec8e,0x1a2));var _0xeec8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec8e[_0x321bb2];return _0x9c12ed;};'use strict';function ServicenowAccount(_0x329137){this['id']=_0x329137['id']||0x0;this['name']=_0x329137[_0xeec8('0x0')]||'';this[_0xeec8('0x1')]=_0x329137[_0xeec8('0x1')]||'';this['password']=_0x329137[_0xeec8('0x2')]||'';this[_0xeec8('0x3')]=_0x329137[_0xeec8('0x3')]||'';this['serverUrl']=_0x329137['serverUrl']||'';this['Configurations']=_0x329137[_0xeec8('0x4')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0x7c02=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x119e7a,_0x3949d3){var _0x1fb90a=function(_0x57eb3f){while(--_0x57eb3f){_0x119e7a['push'](_0x119e7a['shift']());}};_0x1fb90a(++_0x3949d3);}(_0x7c02,0x175));var _0x27c0=function(_0x447f6f,_0xd57148){_0x447f6f=_0x447f6f-0x0;var _0x4d5aa3=_0x7c02[_0x447f6f];return _0x4d5aa3;};'use strict';function ServicenowAccount(_0x463ed7){this['id']=_0x463ed7['id']||0x0;this['name']=_0x463ed7[_0x27c0('0x0')]||'';this[_0x27c0('0x1')]=_0x463ed7[_0x27c0('0x1')]||'';this['password']=_0x463ed7[_0x27c0('0x2')]||'';this[_0x27c0('0x3')]=_0x463ed7[_0x27c0('0x3')]||'';this[_0x27c0('0x4')]=_0x463ed7['serverUrl']||'';this['Configurations']=_0x463ed7[_0x27c0('0x5')]||{};}module[_0x27c0('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 2d0c383..e854e0e 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 _0xeee1=['username','password','remoteUri','Configurations','exports','name'];(function(_0x2628ff,_0x4912ed){var _0x4f42bf=function(_0x461767){while(--_0x461767){_0x2628ff['push'](_0x2628ff['shift']());}};_0x4f42bf(++_0x4912ed);}(_0xeee1,0x77));var _0x1eee=function(_0x2c1114,_0x338ab3){_0x2c1114=_0x2c1114-0x0;var _0x2944e0=_0xeee1[_0x2c1114];return _0x2944e0;};'use strict';function SugarcrmAccount(_0x45c12c){this['id']=_0x45c12c['id']||0x0;this['name']=_0x45c12c[_0x1eee('0x0')]||'';this[_0x1eee('0x1')]=_0x45c12c[_0x1eee('0x1')]||'';this[_0x1eee('0x2')]=_0x45c12c[_0x1eee('0x2')]||'';this[_0x1eee('0x3')]=_0x45c12c[_0x1eee('0x3')]||'';this['serverUrl']=_0x45c12c['serverUrl']||'';this[_0x1eee('0x4')]=_0x45c12c[_0x1eee('0x4')]||{};}module[_0x1eee('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x58ec=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x58ec,0xbf));var _0xc58e=function(_0xc0493e,_0x9ab1fe){_0xc0493e=_0xc0493e-0x0;var _0x27b2a9=_0x58ec[_0xc0493e];return _0x27b2a9;};'use strict';function SugarcrmAccount(_0xd8a0de){this['id']=_0xd8a0de['id']||0x0;this['name']=_0xd8a0de[_0xc58e('0x0')]||'';this[_0xc58e('0x1')]=_0xd8a0de[_0xc58e('0x1')]||'';this[_0xc58e('0x2')]=_0xd8a0de[_0xc58e('0x2')]||'';this[_0xc58e('0x3')]=_0xd8a0de['remoteUri']||'';this[_0xc58e('0x4')]=_0xd8a0de[_0xc58e('0x4')]||'';this[_0xc58e('0x5')]=_0xd8a0de['Configurations']||{};}module[_0xc58e('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 e6500dd..b2eff62 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 _0x8960=['address','name','accountcode','state','unknown','status'];(function(_0x13c583,_0x4d28d1){var _0x15ae45=function(_0x9a968d){while(--_0x9a968d){_0x13c583['push'](_0x13c583['shift']());}};_0x15ae45(++_0x4d28d1);}(_0x8960,0x17b));var _0x0896=function(_0x14e88f,_0x5e4e57){_0x14e88f=_0x14e88f-0x0;var _0x2822a6=_0x8960[_0x14e88f];return _0x2822a6;};'use strict';function Telephone(_0x1f3dc8){this['id']=_0x1f3dc8['id']||0x0;this[_0x0896('0x0')]=_0x1f3dc8[_0x0896('0x0')]||'';this[_0x0896('0x1')]=_0x1f3dc8[_0x0896('0x1')]||'';this[_0x0896('0x2')]=_0x0896('0x3');this['stateTime']=0x0;this[_0x0896('0x4')]=_0x0896('0x3');this[_0x0896('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0xc359=['unknown','stateTime','address','name','accountcode','state'];(function(_0x3dca81,_0x5c65cd){var _0x1b4ab4=function(_0x540046){while(--_0x540046){_0x3dca81['push'](_0x3dca81['shift']());}};_0x1b4ab4(++_0x5c65cd);}(_0xc359,0x93));var _0x9c35=function(_0x39f34f,_0x298f45){_0x39f34f=_0x39f34f-0x0;var _0x59fee1=_0xc359[_0x39f34f];return _0x59fee1;};'use strict';function Telephone(_0x15c127){this['id']=_0x15c127['id']||0x0;this['name']=_0x15c127[_0x9c35('0x0')]||'';this[_0x9c35('0x1')]=_0x15c127[_0x9c35('0x1')]||'';this[_0x9c35('0x2')]=_0x9c35('0x3');this[_0x9c35('0x4')]=0x0;this['status']=_0x9c35('0x3');this[_0x9c35('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 0377bd6..fc7bfa3 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 _0xb10b=['name','html'];(function(_0x428313,_0x5a3b5e){var _0x45b834=function(_0x51be39){while(--_0x51be39){_0x428313['push'](_0x428313['shift']());}};_0x45b834(++_0x5a3b5e);}(_0xb10b,0x12a));var _0xbb10=function(_0x1cac87,_0x369e25){_0x1cac87=_0x1cac87-0x0;var _0xf6ed36=_0xb10b[_0x1cac87];return _0xf6ed36;};'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 +var _0xb10b=['name','html'];(function(_0x4ab1a2,_0x3de0e5){var _0x5dea61=function(_0xd5e50a){while(--_0xd5e50a){_0x4ab1a2['push'](_0x4ab1a2['shift']());}};_0x5dea61(++_0x3de0e5);}(_0xb10b,0x12a));var _0xbb10=function(_0x2008ee,_0xe5f904){_0x2008ee=_0x2008ee-0x0;var _0x25dede=_0xb10b[_0x2008ee];return _0x25dede;};'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 9274176..7a312b3 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 _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0xd72d83,_0x114be1){var _0x485937=function(_0x55f060){while(--_0x55f060){_0xd72d83['push'](_0xd72d83['shift']());}};_0x485937(++_0x114be1);}(_0x5f2f,0x73));var _0xf5f2=function(_0x11bb54,_0x597a23){_0x11bb54=_0x11bb54-0x0;var _0x3e8cd7=_0x5f2f[_0x11bb54];return _0x3e8cd7;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0x5f66=['AllConditions','AnyConditions','Actions','name','channel','voice','status'];(function(_0x2650e9,_0xb91cc){var _0x3511c8=function(_0x5069cf){while(--_0x5069cf){_0x2650e9['push'](_0x2650e9['shift']());}};_0x3511c8(++_0xb91cc);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';function Trigger(_0x253044){this['id']=_0x253044['id']||0x0;this[_0x65f6('0x0')]=_0x253044['name']||'';this[_0x65f6('0x1')]=_0x253044[_0x65f6('0x1')]||_0x65f6('0x2');this[_0x65f6('0x3')]=_0x253044[_0x65f6('0x3')]||![];this['AllConditions']=_0x253044[_0x65f6('0x4')]||[];this['AnyConditions']=_0x253044[_0x65f6('0x5')]||[];this[_0x65f6('0x6')]=_0x253044['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 8a00877..98357da 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 _0x4451=['split','host','port','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf'];(function(_0x4b3c60,_0x116784){var _0x2b7eda=function(_0x2dc3b3){while(--_0x2dc3b3){_0x4b3c60['push'](_0x4b3c60['shift']());}};_0x2b7eda(++_0x116784);}(_0x4451,0x12a));var _0x1445=function(_0x36349e,_0x2badb0){_0x36349e=_0x36349e-0x0;var _0x4adb95=_0x4451[_0x36349e];return _0x4adb95;};'use strict';function Trunk(_0x2d8627){this['id']=_0x2d8627['id']||0x0;this[_0x1445('0x0')]=_0x2d8627[_0x1445('0x0')]||![];this[_0x1445('0x1')]=_0x2d8627[_0x1445('0x1')]||'';this[_0x1445('0x2')]=_0x1445('0x3');this[_0x1445('0x4')]=0x0;this[_0x1445('0x5')]=_0x1445('0x3');this['registry']=_0x2d8627[_0x1445('0x6')]&&_0x2d8627['registry'][_0x1445('0x7')](':')?_0x2d8627[_0x1445('0x6')][_0x1445('0x8')](':')[0x0]:'';this[_0x1445('0x9')]='';this[_0x1445('0xa')]='';this['domain']='';this[_0x1445('0xb')]='';this[_0x1445('0xc')]='';this[_0x1445('0xd')]=_0x1445('0x3');this[_0x1445('0xe')]='';this[_0x1445('0xf')]='';this[_0x1445('0x10')]=_0x2d8627[_0x1445('0x10')]||'';}module['exports']=Trunk; \ No newline at end of file +var _0xbef3=['domainport','refresh','stateRegistry','registrationtime','address','defaultuser','active','name','unknown','stateTime','status','registry','indexOf','host','port','domain'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbef3,0x126));var _0x3bef=function(_0x28ad74,_0x202e99){_0x28ad74=_0x28ad74-0x0;var _0x2541c3=_0xbef3[_0x28ad74];return _0x2541c3;};'use strict';function Trunk(_0x24559a){this['id']=_0x24559a['id']||0x0;this[_0x3bef('0x0')]=_0x24559a[_0x3bef('0x0')]||![];this['name']=_0x24559a[_0x3bef('0x1')]||'';this['state']=_0x3bef('0x2');this[_0x3bef('0x3')]=0x0;this[_0x3bef('0x4')]=_0x3bef('0x2');this[_0x3bef('0x5')]=_0x24559a['registry']&&_0x24559a[_0x3bef('0x5')][_0x3bef('0x6')](':')?_0x24559a[_0x3bef('0x5')]['split'](':')[0x0]:'';this[_0x3bef('0x7')]='';this[_0x3bef('0x8')]='';this[_0x3bef('0x9')]='';this[_0x3bef('0xa')]='';this[_0x3bef('0xb')]='';this[_0x3bef('0xc')]=_0x3bef('0x2');this[_0x3bef('0xd')]='';this[_0x3bef('0xe')]='';this[_0x3bef('0xf')]=_0x24559a[_0x3bef('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 4593fb7..e9d43dd 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 _0x521c=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x4f3949,_0x1b28b5){var _0x2bbb60=function(_0x137b51){while(--_0x137b51){_0x4f3949['push'](_0x4f3949['shift']());}};_0x2bbb60(++_0x1b28b5);}(_0x521c,0xa8));var _0xc521=function(_0xcf2fa2,_0x4f629f){_0xcf2fa2=_0xcf2fa2-0x0;var _0x137268=_0x521c[_0xcf2fa2];return _0x137268;};'use strict';function voiceExtension(_0x421150){this['id']=_0x421150['id']||0x0;this[_0xc521('0x0')]=_0x421150[_0xc521('0x0')]||'';this[_0xc521('0x1')]=_0x421150[_0xc521('0x1')]||_0xc521('0x2');this['mandatoryDisposition']=_0x421150[_0xc521('0x3')]||![];}module[_0xc521('0x4')]=voiceExtension; \ No newline at end of file +var _0x135d=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x4c65aa,_0x2db86a){var _0xbd7c8d=function(_0x5a7dd0){while(--_0x5a7dd0){_0x4c65aa['push'](_0x4c65aa['shift']());}};_0xbd7c8d(++_0x2db86a);}(_0x135d,0x1f3));var _0xd135=function(_0x69c1a6,_0x2a13fb){_0x69c1a6=_0x69c1a6-0x0;var _0x8e58e=_0x135d[_0x69c1a6];return _0x8e58e;};'use strict';function voiceExtension(_0x17534f){this['id']=_0x17534f['id']||0x0;this[_0xd135('0x0')]=_0x17534f['exten']||'';this[_0xd135('0x1')]=_0x17534f[_0xd135('0x1')]||_0xd135('0x2');this[_0xd135('0x3')]=_0x17534f[_0xd135('0x3')]||![];}module[_0xd135('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index b25a08c..97d307a 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 _0x652a=['predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','random','ringall','roundrobin','rrmemory','rrordered','name','monitor_format','inbound','waiting','total','answered','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','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','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor'];(function(_0x2ea9cb,_0x4fdbbe){var _0x2e619a=function(_0x3d1bd3){while(--_0x3d1bd3){_0x2ea9cb['push'](_0x2ea9cb['shift']());}};_0x2e619a(++_0x4fdbbe);}(_0x652a,0x1ae));var _0xa652=function(_0x14c802,_0x3f8d50){_0x14c802=_0x14c802-0x0;var _0x16371b=_0x652a[_0x14c802];return _0x16371b;};'use strict';var monitorFormat={'wav':_0xa652('0x0'),'wav49':_0xa652('0x1'),'gsm':_0xa652('0x2')};var strategy={'fewestcalls':_0xa652('0x3'),'leastrecent':'leastrecent','linear':'linear','random':_0xa652('0x4'),'ringall':_0xa652('0x5'),'rr':_0xa652('0x6'),'rrmemory':_0xa652('0x7'),'rrordered':_0xa652('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x3be4a7){this['id']=_0x3be4a7['id']||0x0;this[_0xa652('0x9')]=_0x3be4a7[_0xa652('0x9')]||'';this[_0xa652('0xa')]=_0x3be4a7[_0xa652('0xa')]||'';this['type']=_0x3be4a7['type']||_0xa652('0xb');this[_0xa652('0xc')]=0x0;this[_0xa652('0xd')]=0x0;this[_0xa652('0xe')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xa652('0xf')]=0x0;this[_0xa652('0x10')]=0x0;this[_0xa652('0x11')]=0x0;this[_0xa652('0x12')]=0x0;this[_0xa652('0x13')]=0x0;this[_0xa652('0x14')]=0x0;this[_0xa652('0x15')]=0x0;this[_0xa652('0x16')]=0x0;this[_0xa652('0x17')]=0x0;this[_0xa652('0x18')]=0x0;this[_0xa652('0x19')]=0x0;this[_0xa652('0x1a')]=0x0;this['ringInUse']=0x0;this[_0xa652('0x1b')]=0x0;this['unavailable']=0x0;this[_0xa652('0x1c')]=0x0;this[_0xa652('0x1d')]=_0x3be4a7[_0xa652('0x1d')]||![];this[_0xa652('0x1e')]=_0x3be4a7[_0xa652('0x1e')]||0xa;this['autopause']=_0x3be4a7[_0xa652('0x1f')]||'no';this[_0xa652('0x20')]=!![];this[_0xa652('0x21')]='';this[_0xa652('0x22')]='';this[_0xa652('0x23')]=0x0;this[_0xa652('0x24')]=0x0;this[_0xa652('0x25')]=_0x3be4a7['dialTimezone']||null;this[_0xa652('0x26')]=_0x3be4a7[_0xa652('0x26')]?_0x3be4a7[_0xa652('0x26')]:null;this[_0xa652('0x27')]=_0x3be4a7[_0xa652('0x27')];this['dialMethod']=_0x3be4a7['dialMethod']||_0xa652('0x28');this[_0xa652('0x29')]=_0x3be4a7['dialLimitChannel']||0x0;this[_0xa652('0x2a')]=_0x3be4a7[_0xa652('0x2a')]||0x0;this[_0xa652('0x2b')]=_0x3be4a7[_0xa652('0x2b')]||0x1;this[_0xa652('0x2c')]=_0x3be4a7[_0xa652('0x2c')]||'dropRate';this[_0xa652('0x2d')]=_0x3be4a7[_0xa652('0x2d')]||0.03;this[_0xa652('0x2e')]=_0x3be4a7['dialPredictiveInterval']||0x258;this[_0xa652('0x2f')]=_0x3be4a7[_0xa652('0x2f')]||_0xa652('0x30');this[_0xa652('0x31')]=_0x3be4a7[_0xa652('0x31')]||_0xa652('0x30');this['dialOriginateTimeout']=_0x3be4a7[_0xa652('0x32')]||0x1e;this[_0xa652('0x33')]=_0x3be4a7[_0xa652('0x33')]||'tTxX';this['dialQueueTimeout']=_0x3be4a7['dialQueueTimeout']||0x3;this['dialQueueProject']=_0x3be4a7['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x3be4a7[_0xa652('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x3be4a7[_0xa652('0x35')]||0x96;this[_0xa652('0x36')]=_0x3be4a7['dialBusyMaxRetry']||0x3;this[_0xa652('0x37')]=_0x3be4a7[_0xa652('0x37')]||0x96;this[_0xa652('0x38')]=_0x3be4a7[_0xa652('0x38')]||0x3;this[_0xa652('0x39')]=_0x3be4a7[_0xa652('0x39')]||0x96;this[_0xa652('0x3a')]=_0x3be4a7[_0xa652('0x3a')]||0x3;this[_0xa652('0x3b')]=_0x3be4a7[_0xa652('0x3b')]||0x96;this[_0xa652('0x3c')]=_0x3be4a7['dialDropMaxRetry']||0x3;this[_0xa652('0x3d')]=_0x3be4a7[_0xa652('0x3d')]||0x96;this[_0xa652('0x3e')]=_0x3be4a7[_0xa652('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x3be4a7[_0xa652('0x3f')]||0x96;this['dialMachineMaxRetry']=_0x3be4a7[_0xa652('0x40')]||0x3;this[_0xa652('0x41')]=_0x3be4a7[_0xa652('0x41')]||0x96;this[_0xa652('0x42')]=_0x3be4a7[_0xa652('0x42')]||0x3;this['dialAgentRejectRetryFrequency']=_0x3be4a7[_0xa652('0x43')]||0x96;this[_0xa652('0x44')]=_0x3be4a7[_0xa652('0x44')]||0x3;this['dialGlobalMaxRetry']=_0x3be4a7[_0xa652('0x45')]||0x4;this[_0xa652('0x46')]=_0x3be4a7['Trunk']?_0x3be4a7[_0xa652('0x46')]:undefined;this[_0xa652('0x47')]=_0x3be4a7[_0xa652('0x47')]?_0x3be4a7[_0xa652('0x47')]:undefined;this[_0xa652('0x48')]=_0x3be4a7[_0xa652('0x48')]||undefined;this[_0xa652('0x49')]=_0x3be4a7[_0xa652('0x49')]?_0x3be4a7[_0xa652('0x49')]:undefined;this['dialOrderByScheduledAt']=_0x3be4a7[_0xa652('0x4a')]||'DESC';this[_0xa652('0x4b')]=_0x3be4a7[_0xa652('0x4b')]||undefined;this[_0xa652('0x4c')]=_0x3be4a7[_0xa652('0x4c')]||undefined;this[_0xa652('0x4d')]=strategy[_0x3be4a7['strategy']];this[_0xa652('0x4e')]=!![];this[_0xa652('0x4f')]=_0x3be4a7[_0xa652('0x4f')]||![];this[_0xa652('0x50')]=_0x3be4a7[_0xa652('0x50')];this[_0xa652('0x51')]=_0x3be4a7[_0xa652('0x51')];this[_0xa652('0x52')]=_0x3be4a7[_0xa652('0x52')];this[_0xa652('0x53')]=_0x3be4a7[_0xa652('0x53')];this['dialAMDMinWordLength']=_0x3be4a7[_0xa652('0x54')];this[_0xa652('0x55')]=_0x3be4a7['dialAMDBetweenWordsSilence'];this[_0xa652('0x56')]=_0x3be4a7[_0xa652('0x56')];this[_0xa652('0x57')]=_0x3be4a7[_0xa652('0x57')];this['dialAMDMaximumWordLength']=_0x3be4a7[_0xa652('0x58')];this[_0xa652('0x59')]=0x0;this[_0xa652('0x5a')]=0x0;this['timeout']=_0x3be4a7[_0xa652('0x5b')];this['outboundAnswerCallsDay']=0x0;this[_0xa652('0x5c')]=0x0;this[_0xa652('0x5d')]=0x0;this[_0xa652('0x5e')]=0x0;this[_0xa652('0x5f')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0xa652('0x60')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa652('0x61')]=0x0;this[_0xa652('0x62')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xa652('0x63')]=0x0;this[_0xa652('0x64')]=0x0;this[_0xa652('0x65')]=0x0;this[_0xa652('0x66')]=undefined;this[_0xa652('0x67')]=undefined;this[_0xa652('0x68')]=undefined;this[_0xa652('0x69')]=1.05;this[_0xa652('0x6a')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa652('0x6b')]=0x0;this[_0xa652('0x6c')]=0x0;this[_0xa652('0x6d')]=0x0;this[_0xa652('0x6e')]=0x0;this[_0xa652('0x6f')]=0x0;this[_0xa652('0x70')]=0x0;this[_0xa652('0x71')]=_0x3be4a7['dialPredictiveIntervalMaxThreshold']||0x14;this[_0xa652('0x72')]=_0x3be4a7[_0xa652('0x73')]||0xa;this[_0xa652('0x74')]=0x0;this[_0xa652('0x75')]=0x0;this[_0xa652('0x76')]=0x1;this[_0xa652('0x77')]=0x0;this[_0xa652('0x78')]=0x0;this[_0xa652('0x79')]=0x0;this[_0xa652('0x7a')]=0x0;this[_0xa652('0x7b')]=_0x3be4a7[_0xa652('0x7b')]||0x1e;this[_0xa652('0x7c')]=_0x3be4a7[_0xa652('0x7c')]||![];this['dialPreviewAutoRecallMe']=!!_0x3be4a7[_0xa652('0x7d')]||![];this[_0xa652('0x7e')]=!!_0x3be4a7['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0x3be4a7[_0xa652('0x7f')]||undefined;this[_0xa652('0x80')]=_0x3be4a7[_0xa652('0x80')]||![];this['dialAgiAfterHangupAgent']=_0x3be4a7[_0xa652('0x81')]||![];this[_0xa652('0xa')]=monitorFormat[_0x3be4a7[_0xa652('0xa')]]?monitorFormat[_0x3be4a7[_0xa652('0xa')]]:undefined;this[_0xa652('0x82')]=_0x3be4a7[_0xa652('0x82')]||![];this[_0xa652('0x83')]=_0x3be4a7[_0xa652('0x83')]?_0x3be4a7[_0xa652('0x83')]:undefined;this[_0xa652('0x84')]=![];}module[_0xa652('0x85')]=VoiceQueue; \ No newline at end of file +var _0x9494=['dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','wav','wav49','fewestcalls','leastrecent','ringall','rrmemory','wrandom','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','unmanaged','abandoned','available','inUse','loggedIn','onHold','paused','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence'];(function(_0x561b0b,_0xc0eb37){var _0x349218=function(_0x11635d){while(--_0x11635d){_0x561b0b['push'](_0x561b0b['shift']());}};_0x349218(++_0xc0eb37);}(_0x9494,0x1a7));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var monitorFormat={'wav':_0x4949('0x0'),'wav49':_0x4949('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x4949('0x2'),'leastrecent':_0x4949('0x3'),'linear':'linear','random':'random','ringall':_0x4949('0x4'),'rr':'roundrobin','rrmemory':_0x4949('0x5'),'rrordered':'rrordered','wrandom':_0x4949('0x6')};function VoiceQueue(_0x186052){this['id']=_0x186052['id']||0x0;this['name']=_0x186052['name']||'';this[_0x4949('0x7')]=_0x186052[_0x4949('0x7')]||'';this[_0x4949('0x8')]=_0x186052[_0x4949('0x8')]||_0x4949('0x9');this[_0x4949('0xa')]=0x0;this[_0x4949('0xb')]=0x0;this[_0x4949('0xc')]=0x0;this['sumDuration']=0x0;this[_0x4949('0xd')]=0x0;this['sumBillable']=0x0;this[_0x4949('0xe')]=0x0;this[_0x4949('0xf')]=0x0;this[_0x4949('0x10')]=0x0;this['busy']=0x0;this[_0x4949('0x11')]=0x0;this['invalid']=0x0;this[_0x4949('0x12')]=0x0;this['notInUse']=0x0;this[_0x4949('0x13')]=0x0;this[_0x4949('0x14')]=0x0;this['ringing']=0x0;this[_0x4949('0x15')]=0x0;this[_0x4949('0x16')]=0x0;this[_0x4949('0x17')]=0x0;this[_0x4949('0x18')]=0x0;this[_0x4949('0x19')]=_0x186052['acw']||![];this[_0x4949('0x1a')]=_0x186052[_0x4949('0x1a')]||0xa;this[_0x4949('0x1b')]=_0x186052[_0x4949('0x1b')]||'no';this['sendMessageOneNotActive']=!![];this['message']='';this[_0x4949('0x1c')]='';this[_0x4949('0x1d')]=0x0;this[_0x4949('0x1e')]=0x0;this[_0x4949('0x1f')]=_0x186052[_0x4949('0x1f')]||null;this[_0x4949('0x20')]=_0x186052[_0x4949('0x20')]?_0x186052[_0x4949('0x20')]:null;this['dialActive']=_0x186052[_0x4949('0x21')];this[_0x4949('0x22')]=_0x186052[_0x4949('0x22')]||_0x4949('0x23');this[_0x4949('0x24')]=_0x186052['dialLimitChannel']||0x0;this[_0x4949('0x25')]=_0x186052[_0x4949('0x25')]||0x0;this[_0x4949('0x26')]=_0x186052['dialPowerLevel']||0x1;this[_0x4949('0x27')]=_0x186052['dialPredictiveOptimization']||_0x4949('0x28');this[_0x4949('0x29')]=_0x186052[_0x4949('0x29')]||0.03;this[_0x4949('0x2a')]=_0x186052[_0x4949('0x2a')]||0x258;this[_0x4949('0x2b')]=_0x186052[_0x4949('0x2b')]||_0x4949('0x2c');this['dialOriginateCallerIdNumber']=_0x186052[_0x4949('0x2d')]||_0x4949('0x2c');this[_0x4949('0x2e')]=_0x186052[_0x4949('0x2e')]||0x1e;this[_0x4949('0x2f')]=_0x186052[_0x4949('0x2f')]||_0x4949('0x30');this[_0x4949('0x31')]=_0x186052['dialQueueTimeout']||0x3;this[_0x4949('0x32')]=_0x186052[_0x4949('0x32')]||undefined;this[_0x4949('0x33')]=_0x186052[_0x4949('0x33')]||0x3;this['dialCongestionRetryFrequency']=_0x186052[_0x4949('0x34')]||0x96;this['dialBusyMaxRetry']=_0x186052['dialBusyMaxRetry']||0x3;this[_0x4949('0x35')]=_0x186052[_0x4949('0x35')]||0x96;this[_0x4949('0x36')]=_0x186052['dialNoAnswerMaxRetry']||0x3;this[_0x4949('0x37')]=_0x186052[_0x4949('0x37')]||0x96;this[_0x4949('0x38')]=_0x186052[_0x4949('0x38')]||0x3;this[_0x4949('0x39')]=_0x186052[_0x4949('0x39')]||0x96;this[_0x4949('0x3a')]=_0x186052['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x186052[_0x4949('0x3b')]||0x96;this[_0x4949('0x3c')]=_0x186052['dialAbandonedMaxRetry']||0x3;this[_0x4949('0x3d')]=_0x186052[_0x4949('0x3d')]||0x96;this['dialMachineMaxRetry']=_0x186052['dialMachineMaxRetry']||0x3;this[_0x4949('0x3e')]=_0x186052[_0x4949('0x3e')]||0x96;this[_0x4949('0x3f')]=_0x186052[_0x4949('0x3f')]||0x3;this['dialAgentRejectRetryFrequency']=_0x186052[_0x4949('0x40')]||0x96;this[_0x4949('0x41')]=_0x186052[_0x4949('0x41')]||0x3;this['dialGlobalMaxRetry']=_0x186052['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x186052[_0x4949('0x42')]?_0x186052[_0x4949('0x42')]:undefined;this[_0x4949('0x43')]=_0x186052[_0x4949('0x43')]?_0x186052[_0x4949('0x43')]:undefined;this[_0x4949('0x44')]=_0x186052[_0x4949('0x44')]||undefined;this[_0x4949('0x45')]=_0x186052[_0x4949('0x45')]?_0x186052[_0x4949('0x45')]:undefined;this[_0x4949('0x46')]=_0x186052['dialOrderByScheduledAt']||'DESC';this[_0x4949('0x47')]=_0x186052[_0x4949('0x47')]||undefined;this[_0x4949('0x48')]=_0x186052[_0x4949('0x48')]||undefined;this[_0x4949('0x49')]=strategy[_0x186052[_0x4949('0x49')]];this[_0x4949('0x4a')]=!![];this[_0x4949('0x4b')]=_0x186052[_0x4949('0x4b')]||![];this[_0x4949('0x4c')]=_0x186052[_0x4949('0x4c')];this['dialAMDGreeting']=_0x186052[_0x4949('0x4d')];this[_0x4949('0x4e')]=_0x186052[_0x4949('0x4e')];this[_0x4949('0x4f')]=_0x186052['dialAMDTotalAnalysisTime'];this['dialAMDMinWordLength']=_0x186052[_0x4949('0x50')];this[_0x4949('0x51')]=_0x186052[_0x4949('0x51')];this[_0x4949('0x52')]=_0x186052[_0x4949('0x52')];this[_0x4949('0x53')]=_0x186052['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x186052[_0x4949('0x54')];this[_0x4949('0x55')]=0x0;this[_0x4949('0x56')]=0x0;this[_0x4949('0x57')]=_0x186052[_0x4949('0x57')];this[_0x4949('0x58')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x4949('0x59')]=0x0;this[_0x4949('0x5a')]=0x0;this[_0x4949('0x5b')]=0x0;this[_0x4949('0x5c')]=0x0;this[_0x4949('0x5d')]=0x0;this[_0x4949('0x5e')]=0x0;this[_0x4949('0x5f')]=0x0;this[_0x4949('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x4949('0x61')]=0x0;this[_0x4949('0x62')]=0x0;this[_0x4949('0x63')]=0x0;this['startProgressive']=undefined;this[_0x4949('0x64')]=undefined;this[_0x4949('0x65')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0x4949('0x66')]=0x0;this[_0x4949('0x67')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x4949('0x68')]=0x0;this[_0x4949('0x69')]=0x0;this[_0x4949('0x6a')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x4949('0x6b')]=_0x186052[_0x4949('0x6c')]||0x14;this[_0x4949('0x6d')]=_0x186052['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x4949('0x6e')]=0x0;this[_0x4949('0x6f')]=0x0;this[_0x4949('0x70')]=0x1;this['erlangCalls']=0x0;this[_0x4949('0x71')]=0x0;this[_0x4949('0x72')]=0x0;this[_0x4949('0x73')]=0x0;this['dialRecallMeTimeout']=_0x186052['dialRecallMeTimeout']||0x1e;this[_0x4949('0x74')]=_0x186052['dialRecallInQueue']||![];this[_0x4949('0x75')]=!!_0x186052[_0x4949('0x75')]||![];this[_0x4949('0x76')]=!!_0x186052[_0x4949('0x76')]||![];this['dialQueueProject2']=_0x186052[_0x4949('0x77')]||undefined;this[_0x4949('0x78')]=_0x186052[_0x4949('0x78')]||![];this[_0x4949('0x79')]=_0x186052[_0x4949('0x79')]||![];this[_0x4949('0x7')]=monitorFormat[_0x186052[_0x4949('0x7')]]?monitorFormat[_0x186052[_0x4949('0x7')]]:undefined;this['mandatoryDisposition']=_0x186052[_0x4949('0x7a')]||![];this[_0x4949('0x7b')]=_0x186052[_0x4949('0x7b')]?_0x186052[_0x4949('0x7b')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x4949('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 9648c23..47b720f 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 _0x5b20=['outboundAnswerCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','incall','includes','status','booked','keys','length','queue','dialer','exten','compareToInboundQueue','some','compareToOutboundQueue','dialActive','active','updateReportFromOutboundQueue','preview','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','answered','inUse','originated','outboundAbandonedCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay'];(function(_0x5b6cbf,_0x11fc17){var _0x4be9ff=function(_0x1f77ba){while(--_0x1f77ba){_0x5b6cbf['push'](_0x5b6cbf['shift']());}};_0x4be9ff(++_0x11fc17);}(_0x5b20,0x86));var _0x05b2=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5b20[_0x178e48];return _0x440d7e;};'use strict';var INBOUND_COUNTERS=[_0x05b2('0x0'),_0x05b2('0x1'),_0x05b2('0x2'),_0x05b2('0x3'),_0x05b2('0x4'),_0x05b2('0x5'),_0x05b2('0x6')];var OUTBOUND_COUNTERS=[_0x05b2('0x0'),_0x05b2('0x7'),_0x05b2('0x8'),_0x05b2('0x1'),'loggedInDb',_0x05b2('0x9'),_0x05b2('0xa'),'outboundAnswerCallsDay',_0x05b2('0xb'),_0x05b2('0xc'),_0x05b2('0xd'),_0x05b2('0xe'),_0x05b2('0xf'),_0x05b2('0x10'),_0x05b2('0x11'),_0x05b2('0x12'),_0x05b2('0x3'),_0x05b2('0x13'),_0x05b2('0x5'),_0x05b2('0x14'),_0x05b2('0x15'),_0x05b2('0x16'),_0x05b2('0x6')];function VoiceQueueSummary(_0x3d3ef0){this['id']=_0x3d3ef0['id'];this['name']=_0x3d3ef0[_0x05b2('0x17')];this[_0x05b2('0x18')]=_0x3d3ef0[_0x05b2('0x18')];this[_0x05b2('0x19')]=_0x3d3ef0['abandoned']||0x0;this[_0x05b2('0x7')]=_0x3d3ef0[_0x05b2('0x7')]||0x0;this[_0x05b2('0x0')]=_0x3d3ef0['available']||0x0;this['busy']=_0x3d3ef0[_0x05b2('0x1a')]||0x0;this[_0x05b2('0x8')]=_0x3d3ef0['inUse']||0x0;this['invalid']=_0x3d3ef0[_0x05b2('0x1b')]||0x0;this[_0x05b2('0x1')]=_0x3d3ef0[_0x05b2('0x1')]||0x0;this[_0x05b2('0x2')]=_0x3d3ef0[_0x05b2('0x2')]||0x0;this[_0x05b2('0x1c')]=_0x3d3ef0[_0x05b2('0x1c')]||0x0;this[_0x05b2('0x1d')]=_0x3d3ef0[_0x05b2('0x1d')]||0x0;this[_0x05b2('0x3')]=_0x3d3ef0[_0x05b2('0x3')]||0x0;this[_0x05b2('0x4')]=_0x3d3ef0[_0x05b2('0x4')]||0x0;this[_0x05b2('0x1e')]=_0x3d3ef0[_0x05b2('0x1e')];this[_0x05b2('0x14')]=_0x3d3ef0['sumBillable'];this[_0x05b2('0x15')]=_0x3d3ef0[_0x05b2('0x15')];this[_0x05b2('0x1f')]=_0x3d3ef0[_0x05b2('0x1f')]||0x0;this[_0x05b2('0x5')]=_0x3d3ef0[_0x05b2('0x5')]||0x0;this[_0x05b2('0x16')]=_0x3d3ef0['total']||0x0;this[_0x05b2('0x20')]=_0x3d3ef0['type'];this[_0x05b2('0x21')]=_0x3d3ef0[_0x05b2('0x21')]||0x0;this['unknown']=_0x3d3ef0[_0x05b2('0x22')]||0x0;this[_0x05b2('0x23')]=_0x3d3ef0[_0x05b2('0x23')]||0x0;this[_0x05b2('0x6')]=_0x3d3ef0[_0x05b2('0x6')]||0x0;if(_0x3d3ef0[_0x05b2('0x20')]===_0x05b2('0x24')){this[_0x05b2('0x13')]=_0x3d3ef0['pTalking']||0x0;this['dialActive']=_0x3d3ef0['dialActive'];this[_0x05b2('0x25')]=_0x3d3ef0['dialMethod'];this['dialOriginateCallerIdName']=_0x3d3ef0[_0x05b2('0x26')];this[_0x05b2('0x27')]=_0x3d3ef0[_0x05b2('0x27')];this[_0x05b2('0x28')]=_0x3d3ef0[_0x05b2('0x28')];this[_0x05b2('0x29')]=_0x3d3ef0[_0x05b2('0x29')];this['temp']=_0x3d3ef0[_0x05b2('0x2a')];this[_0x05b2('0x2b')]=_0x3d3ef0[_0x05b2('0x2b')];this[_0x05b2('0x2c')]=_0x3d3ef0['outboundAnswerCallsDay'];this[_0x05b2('0xb')]=_0x3d3ef0['outboundBlacklistCallsDay'];this[_0x05b2('0xc')]=_0x3d3ef0[_0x05b2('0xc')];this[_0x05b2('0xd')]=_0x3d3ef0[_0x05b2('0xd')];this['outboundDropCallsDayACS']=_0x3d3ef0[_0x05b2('0x2d')];this['outboundDropCallsDayCallersExit']=_0x3d3ef0[_0x05b2('0x2e')];this['outboundDropCallsDayTimeout']=_0x3d3ef0[_0x05b2('0x2f')];this[_0x05b2('0xe')]=_0x3d3ef0[_0x05b2('0xe')];this['outboundNoSuchCallsDay']=_0x3d3ef0['outboundNoSuchCallsDay'];this[_0x05b2('0x30')]=_0x3d3ef0[_0x05b2('0x30')];this[_0x05b2('0x10')]=_0x3d3ef0[_0x05b2('0x10')];this['outboundRejectCallsDay']=_0x3d3ef0[_0x05b2('0x11')];this['outboundUnknownCallsDay']=_0x3d3ef0[_0x05b2('0x12')];this[_0x05b2('0x31')]=_0x3d3ef0['predictiveIntervalAnsweredCalls'];this[_0x05b2('0x32')]=_0x3d3ef0[_0x05b2('0x32')];this['predictiveIntervalAvgTalktime']=_0x3d3ef0['predictiveIntervalAvgTalktime'];this[_0x05b2('0x33')]=_0x3d3ef0[_0x05b2('0x33')];this['predictiveIntervalDroppedCallsTimeout']=_0x3d3ef0[_0x05b2('0x34')];this[_0x05b2('0x35')]=_0x3d3ef0[_0x05b2('0x35')];this[_0x05b2('0x36')]=_0x3d3ef0['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x3d3ef0['predictiveIntervalHitRate'];this[_0x05b2('0x37')]=_0x3d3ef0[_0x05b2('0x37')];this['predictiveIntervalPauses']=_0x3d3ef0[_0x05b2('0x38')];this[_0x05b2('0x39')]=_0x3d3ef0[_0x05b2('0x39')];this[_0x05b2('0x3a')]=_0x3d3ef0[_0x05b2('0x3a')];this[_0x05b2('0x9')]=_0x3d3ef0[_0x05b2('0x9')];this['erlangCalls']=_0x3d3ef0[_0x05b2('0x3b')];this[_0x05b2('0x3c')]=_0x3d3ef0[_0x05b2('0x3c')];this[_0x05b2('0x3d')]=_0x3d3ef0['erlangAbandonmentRate'];this[_0x05b2('0x3e')]=_0x3d3ef0[_0x05b2('0x3e')];this['startPredictive']=_0x3d3ef0['startPredictive'];this[_0x05b2('0x3f')]=_0x3d3ef0[_0x05b2('0x3f')];this[_0x05b2('0x40')]=_0x3d3ef0[_0x05b2('0x40')];this[_0x05b2('0x41')]=_0x3d3ef0[_0x05b2('0x41')];}if(_0x3d3ef0[_0x05b2('0x42')]){this[_0x05b2('0x42')]={'id':_0x3d3ef0['Trunk']['id'],'name':_0x3d3ef0['Trunk'][_0x05b2('0x17')],'active':_0x3d3ef0[_0x05b2('0x42')]['active'],'callerid':_0x3d3ef0[_0x05b2('0x42')][_0x05b2('0x43')]};}}VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x45')]=function(_0x3c526c,_0x44476a,_0x1a656c,_0x4cea0b){this[_0x05b2('0x2')]=0x0;this['talking']=0x0;this[_0x05b2('0x3')]=0x0;this[_0x05b2('0x22')]=0x0;this['notInUse']=0x0;this[_0x05b2('0x8')]=0x0;this[_0x05b2('0x1a')]=0x0;this['invalid']=0x0;this[_0x05b2('0x21')]=0x0;this[_0x05b2('0x4')]=0x0;this[_0x05b2('0x1e')]=0x0;this[_0x05b2('0x1c')]=0x0;if(_0x1a656c){if(_0x1a656c[_0x05b2('0x0')]){this[_0x05b2('0x0')]=Number(_0x1a656c[_0x05b2('0x0')]);}if(_0x1a656c[_0x05b2('0x46')]){this['loggedIn']=Number(_0x1a656c['loggedin']);}if(_0x1a656c[_0x05b2('0x47')]){this[_0x05b2('0x6')]=Number(_0x1a656c['callers']);}}for(var _0x597d6a=0x0;_0x597d6a<_0x3c526c['length'];_0x597d6a++){var _0x40afb3=_0x44476a['SIP/'+_0x3c526c[_0x597d6a][_0x05b2('0x17')]];if(_0x40afb3&&_0x40afb3['online']){this[_0x05b2('0x2')]+=0x1;}if(_0x3c526c[_0x597d6a][_0x05b2('0x48')]==='1'){this[_0x05b2('0x5')]+=0x1;}if(_0x3c526c[_0x597d6a][_0x05b2('0x3')]==='1'&&!['2','7','8'][_0x05b2('0x49')](_0x3c526c[_0x597d6a][_0x05b2('0x4a')])){this[_0x05b2('0x3')]+=0x1;}switch(_0x3c526c[_0x597d6a][_0x05b2('0x4a')]){case'0':this[_0x05b2('0x22')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x05b2('0x8')]+=0x1;break;case'3':this[_0x05b2('0x1a')]+=0x1;break;case'4':this[_0x05b2('0x1b')]+=0x1;break;case'5':this[_0x05b2('0x21')]+=0x1;break;case'6':this[_0x05b2('0x4')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x05b2('0x25')]===_0x05b2('0x4b')){var _0x1566c9=Object[_0x05b2('0x4c')](_0x4cea0b);for(var _0xb7ab8e=0x0;_0xb7ab8e<_0x1566c9[_0x05b2('0x4d')];_0xb7ab8e++){var _0x569bad=_0x1566c9[_0xb7ab8e];var _0x43b436=_0x4cea0b[_0x569bad];if(_0x43b436[_0x05b2('0x4e')]===this[_0x05b2('0x17')]&&_0x43b436[_0x05b2('0x20')]===_0x05b2('0x4f')&&_0x43b436[_0x05b2('0x50')]==='xcally-motion-preview'){this[_0x05b2('0x5')]+=0x1;}}if(this[_0x05b2('0x5')]>this[_0x05b2('0x8')]){this[_0x05b2('0x5')]=this[_0x05b2('0x8')];}this[_0x05b2('0x13')]=0x0;}return this;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x51')]=function(_0x367ab1){var _0x577e41=![];if(_0x367ab1){_0x577e41=INBOUND_COUNTERS[_0x05b2('0x52')](function(_0x35f2bb){return this[_0x35f2bb]!==_0x367ab1[_0x35f2bb];},this);}return _0x577e41;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x53')]=function(_0xe65a2a){var _0x43cea0=![];var _0x464aeb=![];var _0x124bc4=![];if(_0xe65a2a){_0x43cea0=this[_0x05b2('0x25')]!==_0xe65a2a['dialMethod']||this['dialActive']!==_0xe65a2a[_0x05b2('0x54')]||this[_0x05b2('0x40')]!==_0xe65a2a[_0x05b2('0x40')]||this[_0x05b2('0x41')]!==_0xe65a2a[_0x05b2('0x41')];_0x464aeb=OUTBOUND_COUNTERS[_0x05b2('0x52')](function(_0x3ff46a){return this[_0x3ff46a]!==_0xe65a2a[_0x3ff46a];},this);if(this['Trunk']&&_0xe65a2a[_0x05b2('0x42')]){_0x124bc4=this['Trunk']['name']!==_0xe65a2a[_0x05b2('0x42')][_0x05b2('0x17')]||this[_0x05b2('0x42')][_0x05b2('0x55')]!==_0xe65a2a[_0x05b2('0x42')][_0x05b2('0x55')];}}return _0x43cea0||_0x464aeb||_0x124bc4;};VoiceQueueSummary[_0x05b2('0x44')][_0x05b2('0x56')]=function(_0x5c09c6){this[_0x05b2('0x7')]=_0x5c09c6[_0x05b2('0x7')];this[_0x05b2('0x40')]=_0x5c09c6[_0x05b2('0x40')];this[_0x05b2('0x41')]=_0x5c09c6[_0x05b2('0x41')];this[_0x05b2('0x9')]=_0x5c09c6['originated'];this[_0x05b2('0xa')]=_0x5c09c6[_0x05b2('0xa')];this[_0x05b2('0x2c')]=_0x5c09c6['outboundAnswerCallsDay'];this[_0x05b2('0xb')]=_0x5c09c6['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x5c09c6[_0x05b2('0xc')];this['outboundCongestionCallsDay']=_0x5c09c6[_0x05b2('0xd')];this[_0x05b2('0xe')]=_0x5c09c6['outboundNoAnswerCallsDay'];this[_0x05b2('0xf')]=_0x5c09c6[_0x05b2('0xf')];this['outboundReCallsDay']=_0x5c09c6[_0x05b2('0x10')];this['outboundRejectCallsDay']=_0x5c09c6[_0x05b2('0x11')];this['outboundUnknownCallsDay']=_0x5c09c6[_0x05b2('0x12')];this[_0x05b2('0x14')]=_0x5c09c6[_0x05b2('0x14')];this[_0x05b2('0x15')]=_0x5c09c6['sumDuration'];this[_0x05b2('0x16')]=_0x5c09c6[_0x05b2('0x16')];if(this[_0x05b2('0x25')]===_0x05b2('0x57')){this[_0x05b2('0x13')]=_0x5c09c6[_0x05b2('0x13')];}};module[_0x05b2('0x58')]=VoiceQueueSummary; \ No newline at end of file +var _0x0ec6=['unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','active','callerid','prototype','unavailable','loggedin','callers','length','SIP/','name','online','incall','status','booked','keys','queue','dialer','exten','some','updateReportFromOutboundQueue','preview','exports','available','paused','ringing','talking','waiting','answered','inUse','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','strategy','abandoned','busy','invalid','loggedIn','onHold','notInUse','ringInUse','sumHoldTime','type','unknown'];(function(_0xaa8a12,_0x4b02fa){var _0xe8546e=function(_0x4b90bd){while(--_0x4b90bd){_0xaa8a12['push'](_0xaa8a12['shift']());}};_0xe8546e(++_0x4b02fa);}(_0x0ec6,0x1f1));var _0x60ec=function(_0x5997aa,_0x2fb3ed){_0x5997aa=_0x5997aa-0x0;var _0x4e970=_0x0ec6[_0x5997aa];return _0x4e970;};'use strict';var INBOUND_COUNTERS=[_0x60ec('0x0'),'loggedIn','loggedInDb',_0x60ec('0x1'),_0x60ec('0x2'),_0x60ec('0x3'),_0x60ec('0x4')];var OUTBOUND_COUNTERS=[_0x60ec('0x0'),_0x60ec('0x5'),_0x60ec('0x6'),'loggedIn',_0x60ec('0x7'),_0x60ec('0x8'),_0x60ec('0x9'),_0x60ec('0xa'),'outboundBlacklistCallsDay',_0x60ec('0xb'),'outboundCongestionCallsDay',_0x60ec('0xc'),_0x60ec('0xd'),_0x60ec('0xe'),_0x60ec('0xf'),_0x60ec('0x10'),_0x60ec('0x1'),'pTalking','talking',_0x60ec('0x11'),_0x60ec('0x12'),_0x60ec('0x13'),_0x60ec('0x4')];function VoiceQueueSummary(_0x10ec80){this['id']=_0x10ec80['id'];this['name']=_0x10ec80['name'];this[_0x60ec('0x14')]=_0x10ec80[_0x60ec('0x14')];this[_0x60ec('0x15')]=_0x10ec80[_0x60ec('0x15')]||0x0;this[_0x60ec('0x5')]=_0x10ec80['answered']||0x0;this[_0x60ec('0x0')]=_0x10ec80[_0x60ec('0x0')]||0x0;this[_0x60ec('0x16')]=_0x10ec80[_0x60ec('0x16')]||0x0;this[_0x60ec('0x6')]=_0x10ec80[_0x60ec('0x6')]||0x0;this[_0x60ec('0x17')]=_0x10ec80[_0x60ec('0x17')]||0x0;this[_0x60ec('0x18')]=_0x10ec80['loggedIn']||0x0;this[_0x60ec('0x7')]=_0x10ec80[_0x60ec('0x7')]||0x0;this[_0x60ec('0x19')]=_0x10ec80[_0x60ec('0x19')]||0x0;this[_0x60ec('0x1a')]=_0x10ec80[_0x60ec('0x1a')]||0x0;this[_0x60ec('0x1')]=_0x10ec80[_0x60ec('0x1')]||0x0;this[_0x60ec('0x2')]=_0x10ec80[_0x60ec('0x2')]||0x0;this[_0x60ec('0x1b')]=_0x10ec80[_0x60ec('0x1b')];this['sumBillable']=_0x10ec80[_0x60ec('0x11')];this[_0x60ec('0x12')]=_0x10ec80[_0x60ec('0x12')];this[_0x60ec('0x1c')]=_0x10ec80['sumHoldTime']||0x0;this[_0x60ec('0x3')]=_0x10ec80[_0x60ec('0x3')]||0x0;this[_0x60ec('0x13')]=_0x10ec80[_0x60ec('0x13')]||0x0;this[_0x60ec('0x1d')]=_0x10ec80[_0x60ec('0x1d')];this['unavailable']=_0x10ec80['unavailable']||0x0;this['unknown']=_0x10ec80[_0x60ec('0x1e')]||0x0;this[_0x60ec('0x1f')]=_0x10ec80[_0x60ec('0x1f')]||0x0;this[_0x60ec('0x4')]=_0x10ec80['waiting']||0x0;if(_0x10ec80['type']==='outbound'){this['pTalking']=_0x10ec80[_0x60ec('0x20')]||0x0;this[_0x60ec('0x21')]=_0x10ec80[_0x60ec('0x21')];this[_0x60ec('0x22')]=_0x10ec80[_0x60ec('0x22')];this[_0x60ec('0x23')]=_0x10ec80[_0x60ec('0x23')];this[_0x60ec('0x24')]=_0x10ec80[_0x60ec('0x24')];this['dialOriginateTimeout']=_0x10ec80[_0x60ec('0x25')];this[_0x60ec('0x26')]=_0x10ec80[_0x60ec('0x26')];this[_0x60ec('0x27')]=_0x10ec80[_0x60ec('0x27')];this[_0x60ec('0x28')]=_0x10ec80[_0x60ec('0x28')];this[_0x60ec('0xa')]=_0x10ec80[_0x60ec('0xa')];this[_0x60ec('0x29')]=_0x10ec80['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0x10ec80[_0x60ec('0xb')];this[_0x60ec('0x2a')]=_0x10ec80['outboundCongestionCallsDay'];this['outboundDropCallsDayACS']=_0x10ec80[_0x60ec('0x2b')];this['outboundDropCallsDayCallersExit']=_0x10ec80[_0x60ec('0x2c')];this[_0x60ec('0x2d')]=_0x10ec80[_0x60ec('0x2d')];this[_0x60ec('0xc')]=_0x10ec80[_0x60ec('0xc')];this['outboundNoSuchCallsDay']=_0x10ec80[_0x60ec('0xd')];this[_0x60ec('0x2e')]=_0x10ec80[_0x60ec('0x2e')];this[_0x60ec('0xe')]=_0x10ec80[_0x60ec('0xe')];this[_0x60ec('0xf')]=_0x10ec80['outboundRejectCallsDay'];this[_0x60ec('0x10')]=_0x10ec80[_0x60ec('0x10')];this['predictiveIntervalAnsweredCalls']=_0x10ec80[_0x60ec('0x2f')];this[_0x60ec('0x30')]=_0x10ec80[_0x60ec('0x30')];this[_0x60ec('0x31')]=_0x10ec80['predictiveIntervalAvgTalktime'];this[_0x60ec('0x32')]=_0x10ec80[_0x60ec('0x32')];this[_0x60ec('0x33')]=_0x10ec80[_0x60ec('0x33')];this[_0x60ec('0x34')]=_0x10ec80[_0x60ec('0x34')];this[_0x60ec('0x35')]=_0x10ec80[_0x60ec('0x35')];this[_0x60ec('0x36')]=_0x10ec80[_0x60ec('0x36')];this[_0x60ec('0x37')]=_0x10ec80[_0x60ec('0x37')];this[_0x60ec('0x38')]=_0x10ec80[_0x60ec('0x38')];this[_0x60ec('0x39')]=_0x10ec80[_0x60ec('0x39')];this[_0x60ec('0x3a')]=_0x10ec80['predictiveIntervalTotalCalls'];this[_0x60ec('0x8')]=_0x10ec80[_0x60ec('0x8')];this['erlangCalls']=_0x10ec80[_0x60ec('0x3b')];this['erlangCallToSecond']=_0x10ec80[_0x60ec('0x3c')];this[_0x60ec('0x3d')]=_0x10ec80[_0x60ec('0x3d')];this[_0x60ec('0x3e')]=_0x10ec80[_0x60ec('0x3e')];this[_0x60ec('0x3f')]=_0x10ec80[_0x60ec('0x3f')];this['startProgressive']=_0x10ec80['startProgressive'];this['message']=_0x10ec80[_0x60ec('0x40')];this['statusMessage']=_0x10ec80[_0x60ec('0x41')];}if(_0x10ec80[_0x60ec('0x42')]){this['Trunk']={'id':_0x10ec80[_0x60ec('0x42')]['id'],'name':_0x10ec80['Trunk']['name'],'active':_0x10ec80['Trunk'][_0x60ec('0x43')],'callerid':_0x10ec80[_0x60ec('0x42')][_0x60ec('0x44')]};}}VoiceQueueSummary[_0x60ec('0x45')]['createReport']=function(_0x3bb831,_0x1bee8d,_0xdaf11b,_0x2de1d6){this[_0x60ec('0x7')]=0x0;this[_0x60ec('0x3')]=0x0;this[_0x60ec('0x1')]=0x0;this[_0x60ec('0x1e')]=0x0;this[_0x60ec('0x1a')]=0x0;this[_0x60ec('0x6')]=0x0;this[_0x60ec('0x16')]=0x0;this[_0x60ec('0x17')]=0x0;this[_0x60ec('0x46')]=0x0;this[_0x60ec('0x2')]=0x0;this['ringInUse']=0x0;this[_0x60ec('0x19')]=0x0;if(_0xdaf11b){if(_0xdaf11b[_0x60ec('0x0')]){this['available']=Number(_0xdaf11b[_0x60ec('0x0')]);}if(_0xdaf11b['loggedin']){this[_0x60ec('0x18')]=Number(_0xdaf11b[_0x60ec('0x47')]);}if(_0xdaf11b[_0x60ec('0x48')]){this[_0x60ec('0x4')]=Number(_0xdaf11b[_0x60ec('0x48')]);}}for(var _0x52a668=0x0;_0x52a668<_0x3bb831[_0x60ec('0x49')];_0x52a668++){var _0x5bb833=_0x1bee8d[_0x60ec('0x4a')+_0x3bb831[_0x52a668][_0x60ec('0x4b')]];if(_0x5bb833&&_0x5bb833[_0x60ec('0x4c')]){this[_0x60ec('0x7')]+=0x1;}if(_0x3bb831[_0x52a668][_0x60ec('0x4d')]==='1'){this['talking']+=0x1;}if(_0x3bb831[_0x52a668][_0x60ec('0x1')]==='1'&&!['2','7','8']['includes'](_0x3bb831[_0x52a668][_0x60ec('0x4e')])){this[_0x60ec('0x1')]+=0x1;}switch(_0x3bb831[_0x52a668]['status']){case'0':this['unknown']+=0x1;break;case'1':this[_0x60ec('0x1a')]+=0x1;break;case'2':this[_0x60ec('0x6')]+=0x1;break;case'3':this[_0x60ec('0x16')]+=0x1;break;case'4':this[_0x60ec('0x17')]+=0x1;break;case'5':this[_0x60ec('0x46')]+=0x1;break;case'6':this[_0x60ec('0x2')]+=0x1;break;case'7':this[_0x60ec('0x1b')]+=0x1;break;case'8':this[_0x60ec('0x19')]+=0x1;break;}}if(this[_0x60ec('0x22')]===_0x60ec('0x4f')){var _0xc3c51d=Object[_0x60ec('0x50')](_0x2de1d6);for(var _0x43bfcf=0x0;_0x43bfcf<_0xc3c51d[_0x60ec('0x49')];_0x43bfcf++){var _0x327401=_0xc3c51d[_0x43bfcf];var _0x4f6653=_0x2de1d6[_0x327401];if(_0x4f6653[_0x60ec('0x51')]===this[_0x60ec('0x4b')]&&_0x4f6653[_0x60ec('0x1d')]===_0x60ec('0x52')&&_0x4f6653[_0x60ec('0x53')]==='xcally-motion-preview'){this[_0x60ec('0x3')]+=0x1;}}if(this['talking']>this[_0x60ec('0x6')]){this[_0x60ec('0x3')]=this['inUse'];}this[_0x60ec('0x20')]=0x0;}return this;};VoiceQueueSummary[_0x60ec('0x45')]['compareToInboundQueue']=function(_0x572450){var _0x17f085=![];if(_0x572450){_0x17f085=INBOUND_COUNTERS['some'](function(_0x4a5c57){return this[_0x4a5c57]!==_0x572450[_0x4a5c57];},this);}return _0x17f085;};VoiceQueueSummary[_0x60ec('0x45')]['compareToOutboundQueue']=function(_0x31aa1b){var _0x41a87f=![];var _0x4874f0=![];var _0x2af33e=![];if(_0x31aa1b){_0x41a87f=this[_0x60ec('0x22')]!==_0x31aa1b[_0x60ec('0x22')]||this['dialActive']!==_0x31aa1b[_0x60ec('0x21')]||this[_0x60ec('0x40')]!==_0x31aa1b[_0x60ec('0x40')]||this[_0x60ec('0x41')]!==_0x31aa1b[_0x60ec('0x41')];_0x4874f0=OUTBOUND_COUNTERS[_0x60ec('0x54')](function(_0x33458c){return this[_0x33458c]!==_0x31aa1b[_0x33458c];},this);if(this[_0x60ec('0x42')]&&_0x31aa1b['Trunk']){_0x2af33e=this[_0x60ec('0x42')][_0x60ec('0x4b')]!==_0x31aa1b[_0x60ec('0x42')][_0x60ec('0x4b')]||this['Trunk'][_0x60ec('0x43')]!==_0x31aa1b[_0x60ec('0x42')][_0x60ec('0x43')];}}return _0x41a87f||_0x4874f0||_0x2af33e;};VoiceQueueSummary['prototype'][_0x60ec('0x55')]=function(_0x3c233e){this[_0x60ec('0x5')]=_0x3c233e[_0x60ec('0x5')];this['message']=_0x3c233e[_0x60ec('0x40')];this['statusMessage']=_0x3c233e[_0x60ec('0x41')];this['originated']=_0x3c233e['originated'];this[_0x60ec('0x9')]=_0x3c233e[_0x60ec('0x9')];this['outboundAnswerCallsDay']=_0x3c233e[_0x60ec('0xa')];this[_0x60ec('0x29')]=_0x3c233e[_0x60ec('0x29')];this[_0x60ec('0xb')]=_0x3c233e[_0x60ec('0xb')];this[_0x60ec('0x2a')]=_0x3c233e[_0x60ec('0x2a')];this['outboundNoAnswerCallsDay']=_0x3c233e['outboundNoAnswerCallsDay'];this[_0x60ec('0xd')]=_0x3c233e[_0x60ec('0xd')];this[_0x60ec('0xe')]=_0x3c233e['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x3c233e[_0x60ec('0xf')];this['outboundUnknownCallsDay']=_0x3c233e[_0x60ec('0x10')];this[_0x60ec('0x11')]=_0x3c233e[_0x60ec('0x11')];this[_0x60ec('0x12')]=_0x3c233e[_0x60ec('0x12')];this[_0x60ec('0x13')]=_0x3c233e['total'];if(this[_0x60ec('0x22')]===_0x60ec('0x56')){this['pTalking']=_0x3c233e['pTalking'];}};module[_0x60ec('0x57')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index ddfa644..6bc6907 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 _0x781c=['remoteUri','serverUrl','Configurations','exports','username','accessKey'];(function(_0x5047fa,_0x374909){var _0x2cac71=function(_0x16d3ba){while(--_0x16d3ba){_0x5047fa['push'](_0x5047fa['shift']());}};_0x2cac71(++_0x374909);}(_0x781c,0x1d2));var _0xc781=function(_0xbf5d32,_0x3ce3e8){_0xbf5d32=_0xbf5d32-0x0;var _0x4f4b9e=_0x781c[_0xbf5d32];return _0x4f4b9e;};'use strict';function VtigerAccount(_0x43285f){this['id']=_0x43285f['id']||0x0;this['name']=_0x43285f['name']||'';this['username']=_0x43285f[_0xc781('0x0')]||'';this[_0xc781('0x1')]=_0x43285f['accessKey']||'';this[_0xc781('0x2')]=_0x43285f[_0xc781('0x2')]||'';this[_0xc781('0x3')]=_0x43285f[_0xc781('0x3')]||'';this[_0xc781('0x4')]=_0x43285f[_0xc781('0x4')]||{};}module[_0xc781('0x5')]=VtigerAccount; \ No newline at end of file +var _0x185d=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x5cdd86,_0x2d683e){var _0x400fa4=function(_0x14ccf4){while(--_0x14ccf4){_0x5cdd86['push'](_0x5cdd86['shift']());}};_0x400fa4(++_0x2d683e);}(_0x185d,0xe1));var _0xd185=function(_0x343090,_0x433a80){_0x343090=_0x343090-0x0;var _0x3ff3e8=_0x185d[_0x343090];return _0x3ff3e8;};'use strict';function VtigerAccount(_0x46903c){this['id']=_0x46903c['id']||0x0;this[_0xd185('0x0')]=_0x46903c[_0xd185('0x0')]||'';this[_0xd185('0x1')]=_0x46903c[_0xd185('0x1')]||'';this[_0xd185('0x2')]=_0x46903c[_0xd185('0x2')]||'';this[_0xd185('0x3')]=_0x46903c[_0xd185('0x3')]||'';this[_0xd185('0x4')]=_0x46903c[_0xd185('0x4')]||'';this[_0xd185('0x5')]=_0x46903c[_0xd185('0x5')]||{};}module[_0xd185('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 df7100a..fd764f6 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 _0xd056=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x223a3e,_0x2da798){var _0x582005=function(_0x4adba8){while(--_0x4adba8){_0x223a3e['push'](_0x223a3e['shift']());}};_0x582005(++_0x2da798);}(_0xd056,0x1f3));var _0x6d05=function(_0x45d15b,_0x2db689){_0x45d15b=_0x45d15b-0x0;var _0x5a211d=_0xd056[_0x45d15b];return _0x5a211d;};'use strict';function ZendeskAccount(_0x9a16c4){this['id']=_0x9a16c4['id']||0x0;this['name']=_0x9a16c4[_0x6d05('0x0')]||'';this[_0x6d05('0x1')]=_0x9a16c4['username']||'';this[_0x6d05('0x2')]=_0x9a16c4[_0x6d05('0x2')]||'';this['token']=_0x9a16c4[_0x6d05('0x3')]||'';this[_0x6d05('0x4')]=_0x9a16c4['remoteUri']||'';this['authType']=_0x9a16c4[_0x6d05('0x5')]||'';this['type']=_0x9a16c4[_0x6d05('0x6')]||_0x6d05('0x7');this[_0x6d05('0x8')]=_0x9a16c4[_0x6d05('0x8')]||'';this[_0x6d05('0x9')]=_0x9a16c4[_0x6d05('0x9')]||{};}module[_0x6d05('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xca1d=['Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0xca1d,0x18e));var _0xdca1=function(_0x5cf7b4,_0x1b924b){_0x5cf7b4=_0x5cf7b4-0x0;var _0x4de774=_0xca1d[_0x5cf7b4];return _0x4de774;};'use strict';function ZendeskAccount(_0x1ee494){this['id']=_0x1ee494['id']||0x0;this[_0xdca1('0x0')]=_0x1ee494[_0xdca1('0x0')]||'';this[_0xdca1('0x1')]=_0x1ee494[_0xdca1('0x1')]||'';this[_0xdca1('0x2')]=_0x1ee494[_0xdca1('0x2')]||'';this[_0xdca1('0x3')]=_0x1ee494[_0xdca1('0x3')]||'';this['remoteUri']=_0x1ee494[_0xdca1('0x4')]||'';this[_0xdca1('0x5')]=_0x1ee494[_0xdca1('0x5')]||'';this[_0xdca1('0x6')]=_0x1ee494[_0xdca1('0x6')]||_0xdca1('0x7');this[_0xdca1('0x8')]=_0x1ee494[_0xdca1('0x8')]||'';this[_0xdca1('0x9')]=_0x1ee494['Configurations']||{};}module[_0xdca1('0xa')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 1297a17..b121e9b 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 _0x4fd0=['name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports'];(function(_0xb314a6,_0x3e9b41){var _0x1a5c11=function(_0x2203c4){while(--_0x2203c4){_0xb314a6['push'](_0xb314a6['shift']());}};_0x1a5c11(++_0x3e9b41);}(_0x4fd0,0x18c));var _0x04fd=function(_0x4ef11c,_0x387510){_0x4ef11c=_0x4ef11c-0x0;var _0x1c3026=_0x4fd0[_0x4ef11c];return _0x1c3026;};'use strict';function ZohoAccount(_0x5a0f19){this['id']=_0x5a0f19['id']||0x0;this[_0x04fd('0x0')]=_0x5a0f19['name']||'';this[_0x04fd('0x1')]=_0x5a0f19['description']||'';this[_0x04fd('0x2')]=_0x5a0f19['host']||'';this['zone']=_0x5a0f19[_0x04fd('0x3')]||'';this[_0x04fd('0x4')]=_0x5a0f19[_0x04fd('0x4')]||'';this['clientSecret']=_0x5a0f19[_0x04fd('0x5')]||'';this[_0x04fd('0x6')]=_0x5a0f19[_0x04fd('0x6')]||'';this[_0x04fd('0x7')]=_0x5a0f19[_0x04fd('0x7')]||'';this['refreshToken']=_0x5a0f19[_0x04fd('0x8')]||'';this[_0x04fd('0x9')]=_0x5a0f19[_0x04fd('0x9')]||{};}module[_0x04fd('0xa')]=ZohoAccount; \ No newline at end of file +var _0xa7d0=['Configurations','exports','name','description','host','zone','clientSecret','serverUrl','code','refreshToken'];(function(_0x19bd3e,_0x2dc333){var _0x39720b=function(_0x563850){while(--_0x563850){_0x19bd3e['push'](_0x19bd3e['shift']());}};_0x39720b(++_0x2dc333);}(_0xa7d0,0x1ec));var _0x0a7d=function(_0x2c9c9b,_0x4dfa97){_0x2c9c9b=_0x2c9c9b-0x0;var _0x4ff01d=_0xa7d0[_0x2c9c9b];return _0x4ff01d;};'use strict';function ZohoAccount(_0x2cb93f){this['id']=_0x2cb93f['id']||0x0;this[_0x0a7d('0x0')]=_0x2cb93f['name']||'';this[_0x0a7d('0x1')]=_0x2cb93f[_0x0a7d('0x1')]||'';this[_0x0a7d('0x2')]=_0x2cb93f[_0x0a7d('0x2')]||'';this['zone']=_0x2cb93f[_0x0a7d('0x3')]||'';this['clientId']=_0x2cb93f['clientId']||'';this[_0x0a7d('0x4')]=_0x2cb93f[_0x0a7d('0x4')]||'';this['serverUrl']=_0x2cb93f[_0x0a7d('0x5')]||'';this['code']=_0x2cb93f[_0x0a7d('0x6')]||'';this[_0x0a7d('0x7')]=_0x2cb93f['refreshToken']||'';this[_0x0a7d('0x8')]=_0x2cb93f['Configurations']||{};}module[_0x0a7d('0x9')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index d1b3c36..1d78f36 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 _0xefda=['countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','calleridname','number','exports','util','isNil','string','uniqueid','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry'];(function(_0x382e00,_0x48d28a){var _0x237357=function(_0x5a3bff){while(--_0x5a3bff){_0x382e00['push'](_0x382e00['shift']());}};_0x237357(++_0x48d28a);}(_0xefda,0x96));var _0xaefd=function(_0x3b380d,_0x33cbdf){_0x3b380d=_0x3b380d-0x0;var _0x381379=_0xefda[_0x3b380d];return _0x381379;};'use strict';var util=require(_0xaefd('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x3d1b8d,_0x2ccc67,_0x4ae272){var _0x24c204='';if(!_[_0xaefd('0x1')](_0x2ccc67)&&_0xaefd('0x2')===typeof _0x2ccc67){_0x24c204+=_0x2ccc67;}if(!_[_0xaefd('0x1')](_0x4ae272)&&_0xaefd('0x2')===typeof _0x4ae272){_0x24c204+='\x20'+_0x4ae272;}if(_0x24c204!==''){return _0x24c204;}return _0x3d1b8d;}function Action(_0x3288f9,_0x497258,_0x3677ea,_0x3b9736,_0x24d10c){this[_0xaefd('0x3')]=_0x3677ea||undefined;this['idContact']=_0x3288f9['id'];this[_0xaefd('0x4')]=_0x497258[_0xaefd('0x5')];this[_0xaefd('0x6')]=_0x497258['type'];this['campaigntype']='queue';this[_0xaefd('0x7')]=![];this[_0xaefd('0x8')]=_[_0xaefd('0x1')](_0x3288f9[_0xaefd('0x9')])?undefined:_0x3288f9[_0xaefd('0x9')][_0xaefd('0x5')];this[_0xaefd('0xa')]=this[_0xaefd('0x8')]?util[_0xaefd('0xb')](_0xaefd('0xc'),this[_0xaefd('0x8')]):_0x3b9736||undefined;this['calleridname']=checkNameSurname(_0x3288f9[_0xaefd('0xd')]['phone'],_0x3288f9[_0xaefd('0xd')][_0xaefd('0xe')],_0x3288f9[_0xaefd('0xd')][_0xaefd('0xf')]);this['active']=_0x3288f9[_0xaefd('0x10')]||![];this[_0xaefd('0x11')]=_0x3288f9[_0xaefd('0x12')];this[_0xaefd('0x13')]=_0x3288f9[_0xaefd('0x13')];this[_0xaefd('0x14')]=_0x3288f9[_0xaefd('0x14')]||0x0;this[_0xaefd('0x15')]=_0x3288f9['countcongestionretry']||0x0;this[_0xaefd('0x16')]=_0x3288f9[_0xaefd('0x16')]||0x0;this[_0xaefd('0x17')]=(_0x3288f9[_0xaefd('0x14')]||0x0)+(_0x3288f9[_0xaefd('0x15')]||0x0)+(_0x3288f9[_0xaefd('0x16')]||0x0)+(_0x3288f9['countnosuchnumberretry']||0x0)+(_0x3288f9[_0xaefd('0x18')]||0x0)+(_0x3288f9[_0xaefd('0x19')]||0x0)+(_0x3288f9[_0xaefd('0x1a')]||0x0)+(_0x3288f9[_0xaefd('0x1b')]||0x0);this[_0xaefd('0x1c')]=_0x3288f9[_0xaefd('0x1c')]||0x0;this['countdropretry']=_0x3288f9[_0xaefd('0x18')]||0x0;this[_0xaefd('0x19')]=_0x3288f9[_0xaefd('0x19')]||0x0;this[_0xaefd('0x1a')]=_0x3288f9[_0xaefd('0x1a')]||0x0;this['countagentrejectretry']=_0x3288f9['countagentrejectretry']||0x0;this['callback']=_0x3288f9[_0xaefd('0x1d')];this[_0xaefd('0x1e')]=_0x3288f9[_0xaefd('0x1e')];this['callbackat']=_0x3288f9[_0xaefd('0x1f')];this['recallme']=_0x3288f9[_0xaefd('0x20')];this[_0xaefd('0x21')]=_0x3288f9[_0xaefd('0x21')];this['ListId']=_0x3288f9[_0xaefd('0x22')];this[_0xaefd('0x23')]=_[_0xaefd('0x1')](_0x3288f9[_0xaefd('0x9')])?_0x3288f9[_0xaefd('0x23')]:_0x3288f9['Agent']['id'];this[_0xaefd('0x24')]=_0x3288f9['VoiceQueueId'];this[_0xaefd('0x25')]='';this[_0xaefd('0x26')]='';}Action['prototype'][_0xaefd('0x27')]=function(){return util[_0xaefd('0xb')]('\x22%s\x22\x20<%s>',this[_0xaefd('0x28')],this[_0xaefd('0x29')]);};module[_0xaefd('0x2a')]=Action; \ No newline at end of file +var _0x4b17=['callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','number','exports','util','moment','isNil','string','uniqueid','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','calleridname','Contact','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback'];(function(_0x29a90d,_0x5828a3){var _0x3bb082=function(_0x2749d0){while(--_0x2749d0){_0x29a90d['push'](_0x29a90d['shift']());}};_0x3bb082(++_0x5828a3);}(_0x4b17,0x10f));var _0x74b1=function(_0x1af5b2,_0x1b82fe){_0x1af5b2=_0x1af5b2-0x0;var _0xf1aa2d=_0x4b17[_0x1af5b2];return _0xf1aa2d;};'use strict';var util=require(_0x74b1('0x0'));var _=require('lodash');var moment=require(_0x74b1('0x1'));function checkNameSurname(_0x5483a2,_0xd14270,_0x356a31){var _0x547636='';if(!_[_0x74b1('0x2')](_0xd14270)&&'string'===typeof _0xd14270){_0x547636+=_0xd14270;}if(!_['isNil'](_0x356a31)&&_0x74b1('0x3')===typeof _0x356a31){_0x547636+='\x20'+_0x356a31;}if(_0x547636!==''){return _0x547636;}return _0x5483a2;}function Action(_0x30d910,_0x379dcc,_0x3873a6,_0x371c3b,_0x191d2b){this[_0x74b1('0x4')]=_0x3873a6||undefined;this['idContact']=_0x30d910['id'];this[_0x74b1('0x5')]=_0x379dcc[_0x74b1('0x6')];this[_0x74b1('0x7')]=_0x379dcc[_0x74b1('0x7')];this[_0x74b1('0x8')]='queue';this[_0x74b1('0x9')]=![];this[_0x74b1('0xa')]=_['isNil'](_0x30d910[_0x74b1('0xb')])?undefined:_0x30d910[_0x74b1('0xb')][_0x74b1('0x6')];this[_0x74b1('0xc')]=this['membername']?util[_0x74b1('0xd')]('SIP/%s',this['membername']):_0x371c3b||undefined;this[_0x74b1('0xe')]=checkNameSurname(_0x30d910[_0x74b1('0xf')]['phone'],_0x30d910['Contact']['firstName'],_0x30d910[_0x74b1('0xf')]['lastName']);this['active']=_0x30d910[_0x74b1('0x10')]||![];this[_0x74b1('0x11')]=_0x30d910[_0x74b1('0x12')];this[_0x74b1('0x13')]=_0x30d910[_0x74b1('0x13')];this[_0x74b1('0x14')]=_0x30d910['countbusyretry']||0x0;this[_0x74b1('0x15')]=_0x30d910[_0x74b1('0x15')]||0x0;this[_0x74b1('0x16')]=_0x30d910[_0x74b1('0x16')]||0x0;this[_0x74b1('0x17')]=(_0x30d910[_0x74b1('0x14')]||0x0)+(_0x30d910[_0x74b1('0x15')]||0x0)+(_0x30d910['countnoanswerretry']||0x0)+(_0x30d910[_0x74b1('0x18')]||0x0)+(_0x30d910[_0x74b1('0x19')]||0x0)+(_0x30d910['countabandonedretry']||0x0)+(_0x30d910[_0x74b1('0x1a')]||0x0)+(_0x30d910[_0x74b1('0x1b')]||0x0);this[_0x74b1('0x18')]=_0x30d910[_0x74b1('0x18')]||0x0;this[_0x74b1('0x19')]=_0x30d910[_0x74b1('0x19')]||0x0;this[_0x74b1('0x1c')]=_0x30d910[_0x74b1('0x1c')]||0x0;this['countmachineretry']=_0x30d910[_0x74b1('0x1a')]||0x0;this['countagentrejectretry']=_0x30d910['countagentrejectretry']||0x0;this['callback']=_0x30d910[_0x74b1('0x1d')];this[_0x74b1('0x1e')]=_0x30d910[_0x74b1('0x1e')];this[_0x74b1('0x1f')]=_0x30d910[_0x74b1('0x1f')];this['recallme']=_0x30d910[_0x74b1('0x20')];this['ContactId']=_0x30d910[_0x74b1('0x21')];this[_0x74b1('0x22')]=_0x30d910[_0x74b1('0x22')];this[_0x74b1('0x23')]=_[_0x74b1('0x2')](_0x30d910[_0x74b1('0xb')])?_0x30d910[_0x74b1('0x23')]:_0x30d910[_0x74b1('0xb')]['id'];this['VoiceQueueId']=_0x30d910[_0x74b1('0x24')];this[_0x74b1('0x25')]='';this[_0x74b1('0x26')]='';}Action['prototype'][_0x74b1('0x27')]=function(){return util[_0x74b1('0xd')](_0x74b1('0x28'),this[_0x74b1('0xe')],this[_0x74b1('0x29')]);};module[_0x74b1('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 06fc30d..affc720 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 _0x521e=['originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','toLowerVariables','variables','variablesAction','[originateFailure][logOriginateFailure]','syncOriginateResponse','lookAgent','clone','isFailure','response','custom:agentringnoanswer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','[syncHangup][talking][cause]','syncDialEnd','destuniqueid','addVariable','filterKey','keys','variable','value','error','inspect','transfertargetlinkedid','transfererlinkedid','exports','lodash','uuid','moment','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','dialend','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','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','\x20is\x20not\x20active','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','clearZombieChannel','isNil','info','[clearZombieChannels][talking]','queue','pTalking:\x20','dialAnswer','pick','contactId','VoiceQueueId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','agents','then','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','createCustomerFinal','[HistoryRecallClose]','[getContactRecallMe]','setMessage','NO_AGENTS_LOGGED','isActive','dialActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','logCustomer','buildObj','nosuchnumber','createCustomerHistory','verifyAdditionalPhones','additional','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','responsetime','answertime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','connect','acw','buildAcw','complete','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','uniqueid','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','dialNoAnswerMaxRetry','swapAdditionalPhones','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','CANCEL','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','dialAgentRejectMaxRetry','countabandonedretry','Abandoned','dialAbandonedRetryFrequency','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','phone','Contact\x20is\x20undefined','Queue','isEmpty','execCall','[Preview][execCall][success]','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','outboundBlacklistCallsDay','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','status','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','originatecalleridname','extractCalleridName'];(function(_0x17df24,_0x521621){var _0x343884=function(_0xf150d8){while(--_0xf150d8){_0x17df24['push'](_0x17df24['shift']());}};_0x343884(++_0x521621);}(_0x521e,0x162));var _0xe521=function(_0x100808,_0x105106){_0x100808=_0x100808-0x0;var _0x280229=_0x521e[_0x100808];return _0x280229;};'use strict';var util=require('util');var _=require(_0xe521('0x0'));var uuid=require(_0xe521('0x1'));var moment=require(_0xe521('0x2'));var Redis=require(_0xe521('0x3'));var config=require(_0xe521('0x4'));var logger=require(_0xe521('0x5'))(_0xe521('0x6'));var loggerAction=require(_0xe521('0x5'))(_0xe521('0x7'));var ami=require('../ami');var rpcDb=require(_0xe521('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xe521('0x9'));var ut=require(_0xe521('0xa'));var utils=require('../dialer/utils');config[_0xe521('0xb')]=_[_0xe521('0xc')](config[_0xe521('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0xe521('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xe521('0xe')][_0xe521('0xf')]=function(_0x1a6a46){this[_0xe521('0x10')]=this[_0xe521('0x10')]?this[_0xe521('0x10')][_0xe521('0x11')](_0x1a6a46):_0x1a6a46();};function Preview(_0x4a6e5b){this[_0xe521('0x12')]=new Sequence();this[_0xe521('0x13')]=_0x4a6e5b[_0xe521('0x14')];this[_0xe521('0x15')]=_0x4a6e5b[_0xe521('0x15')];this[_0xe521('0x16')]={};this['agents']=_0x4a6e5b['agents'];this[_0xe521('0x17')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse'][_0xe521('0x18')](this));ami['on'](_0xe521('0x19'),this[_0xe521('0x1a')]['bind'](this));ami['on'](_0xe521('0x1b'),this[_0xe521('0x1c')][_0xe521('0x18')](this));ami['on'](_0xe521('0x1d'),this['syncDialEnd'][_0xe521('0x18')](this));ami['on'](_0xe521('0x1e'),this[_0xe521('0x1f')][_0xe521('0x18')](this));ami['on']('varset',this[_0xe521('0x20')][_0xe521('0x18')](this));ami['on']('attendedtransfer',this[_0xe521('0x21')][_0xe521('0x18')](this));ami['on'](_0xe521('0x22'),this[_0xe521('0x23')][_0xe521('0x18')](this));this[_0xe521('0x24')](this[_0xe521('0x13')]);}function emit(_0x1a6bd4,_0x34335e,_0x39df02){io['to'](_0x1a6bd4)['emit'](_0x34335e,_0x39df02);}function emitVoiceQueueChannelRemove(_0x4c01c5){logger['info'](_0xe521('0x25'),JSON[_0xe521('0x26')](_0x4c01c5));emit(util[_0xe521('0x27')](_0xe521('0x28'),_0x4c01c5[_0xe521('0x29')]),_0xe521('0x2a'),_0x4c01c5);io[_0xe521('0x2b')](_0xe521('0x2c'),_0x4c01c5);}function notSendMessagesQueue(_0x5a2bd6){if(_0x5a2bd6[_0xe521('0x2d')]){if(_0x5a2bd6[_0xe521('0x2e')]===0x0&&_0x5a2bd6[_0xe521('0x2f')]===0x0){_0x5a2bd6['sendMessageOneNotActive']=![];_0x5a2bd6[_0xe521('0x30')]=0x0;_0x5a2bd6[_0xe521('0x31')]=0x0;_0x5a2bd6[_0xe521('0x32')]=utils[_0xe521('0x33')][_0xe521('0x34')];ut[_0xe521('0x35')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x5a2bd6[_0xe521('0x29')]+_0xe521('0x36'));}else{_0x5a2bd6[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x37')];ut[_0xe521('0x35')](_0xe521('0x38'),_0x5a2bd6[_0xe521('0x29')]+_0xe521('0x39'));}}}Preview[_0xe521('0xe')][_0xe521('0x24')]=function(){var _0x5b6836=this;setInterval(function(){_0x5b6836[_0xe521('0x3a')]();},0x7cf);};Preview[_0xe521('0xe')][_0xe521('0x3a')]=function(){var _0xb9d7c3=this[_0xe521('0x13')];this['clockClearZombieChannels']+=0x1;for(var _0x300b96 in _0xb9d7c3){if(_0xb9d7c3['hasOwnProperty'](_0x300b96)&&(_0xb9d7c3[_0x300b96][_0xe521('0x3b')]===_0xe521('0x6')||_0xb9d7c3[_0x300b96][_0xe521('0x3b')]===_0xe521('0x3c'))&&_0xb9d7c3[_0x300b96][_0xe521('0x3d')]===_0xe521('0x3e')){if(this[_0xe521('0x17')]>0x7){this[_0xe521('0x17')]=0x0;this[_0xe521('0x3f')]();}}if(_0xb9d7c3[_0xe521('0x40')](_0x300b96)&&_0xb9d7c3[_0x300b96]['dialMethod']==='preview'&&_0xb9d7c3[_0x300b96][_0xe521('0x3d')]===_0xe521('0x3e')){if(_0xb9d7c3[_0x300b96]['dialActive']){this['setMessage'](_0xb9d7c3[_0x300b96]);if(_0xb9d7c3[_0x300b96]['dialPreviewAutoRecallMe'])this['recallMe'](_0xb9d7c3[_0x300b96]);}else{notSendMessagesQueue(_0xb9d7c3[_0x300b96]);}}}};Preview[_0xe521('0xe')][_0xe521('0x41')]=function(_0x1114e1){var _0x56a388=this;this['sequence'][_0xe521('0xf')](function(){if(!_[_0xe521('0x42')](_0x56a388[_0xe521('0x16')][_0x1114e1])){loggerAction[_0xe521('0x43')](_0xe521('0x44'),_0x1114e1,'Queue',_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')],'originated:\x20',JSON[_0xe521('0x26')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]][_0xe521('0x2e')]),_0xe521('0x46'),JSON['stringify'](_0x56a388[_0xe521('0x13')][_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]]['pTalking']),JSON[_0xe521('0x26')](_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x47')]),JSON[_0xe521('0x26')](_[_0xe521('0x48')](_0x56a388['actions'][_0x1114e1],[_0xe521('0x49'),'UserId',_0xe521('0x4a'),_0xe521('0x4b')])));return ami[_0xe521('0x4c')]({'action':'status','channel':_0x56a388['actions'][_0x1114e1][_0xe521('0x4d')]})[_0xe521('0x4e')](function(_0x1fa6a9){if(_0x1fa6a9[_0xe521('0x32')]===_0xe521('0x4f')){setTimeout(function(){if(_0x56a388['actions'][_0x1114e1]){ut[_0xe521('0x50')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]],_0xe521('0x51'));if(_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x47')]===!![]){ut[_0xe521('0x52')](_0x56a388[_0xe521('0x13')][_0x56a388[_0xe521('0x16')][_0x1114e1][_0xe521('0x45')]],_0xe521('0x51'));ut[_0xe521('0x53')]('[Dialer][checkChannel][pTalking][Preview]'+_0x1114e1,_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]);}ut[_0xe521('0x53')](_0xe521('0x54')+_0x1114e1,_0x56a388['actions'][_0x1114e1][_0xe521('0x45')]);delete _0x56a388[_0xe521('0x16')][_0x1114e1];}},0x2328);}});}});};Preview[_0xe521('0xe')][_0xe521('0x3f')]=function(){var _0x54dfab=this;loggerAction[_0xe521('0x43')](_0xe521('0x55'),_[_0xe521('0x56')](this[_0xe521('0x16')]));for(var _0x56ebb5 in this[_0xe521('0x16')]){if(_0x54dfab['actions'][_0xe521('0x40')](_0x56ebb5)){_0x54dfab['clearZombieChannel'](_0x56ebb5);}}};Preview[_0xe521('0xe')]['recallMe']=function(_0x29a289){var _0x3ca9f0=this;rpcDb[_0xe521('0x57')](_0x29a289['id'],ut[_0xe521('0x58')](this[_0xe521('0x59')]))[_0xe521('0x5a')](function(_0x2d1c00){if(!_[_0xe521('0x42')](_0x2d1c00)){for(var _0x5b858f=0x0;_0x5b858f<_0x2d1c00['length'];_0x5b858f+=0x1){if(ut['getDiff'](_0x2d1c00[_0x5b858f][_0xe521('0x5b')])<_0x29a289[_0xe521('0x5c')]*0x3c){if(_0x2d1c00[_0x5b858f]['Agent']&&!_0x2d1c00[_0x5b858f][_0xe521('0x5d')][_0xe521('0x5e')]){_0x3ca9f0[_0xe521('0x5f')](_0x2d1c00[_0x5b858f]['id'])[_0xe521('0x5a')](ut[_0xe521('0x60')](_0xe521('0x61')))[_0xe521('0x4e')](ut['logger2'](_0xe521('0x61')));}else{rpcDb[_0xe521('0x62')](_0x2d1c00[_0x5b858f]['id']);}}else{var _0x39f9a8=new Action(_0x2d1c00[_0x5b858f],_0x29a289);_0x39f9a8[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));_0x29a289[_0xe521('0x65')]+=0x1;ut['logCustomer'](_0x39f9a8,0x17,_0xe521('0x66'));if(_0x29a289[_0xe521('0x67')]){rpcDb[_0xe521('0x68')](ut[_0xe521('0x69')](_0x2d1c00[_0x5b858f]));rpcDb['createCustomerHistory'](_0x39f9a8,_0xe521('0x6a'));}else{ut['logCustomer'](_0x39f9a8,0x16,'RecallFailedTimeout');rpcDb['createCustomerHistory'](_0x39f9a8,'[HistoryRecallClose]');rpcDb[_0xe521('0x6b')](_0x39f9a8,_0xe521('0x6c'));}}}}})[_0xe521('0x4e')](ut[_0xe521('0x60')](_0xe521('0x6d')));};Preview[_0xe521('0xe')][_0xe521('0x6e')]=function(_0x484a10){_0x484a10[_0xe521('0x2d')]=!![];if(ut['IsNotLoggedIn'](_0x484a10['loggedIn'])){_0x484a10[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x6f')];}else if(!ut[_0xe521('0x70')](_0x484a10[_0xe521('0x71')])){_0x484a10[_0xe521('0x32')]=utils[_0xe521('0x33')][_0xe521('0x34')];}else if(!this[_0xe521('0x72')](_0x484a10['Trunk'])){if(!this[_0xe521('0x72')](_0x484a10[_0xe521('0x73')])){_0x484a10[_0xe521('0x32')]=utils[_0xe521('0x33')]['UNREACHABLE_TRUNK'];}else{_0x484a10['message']=utils['CAMPAIGN_STATUS'][_0xe521('0x74')];}}else{_0x484a10[_0xe521('0x32')]=utils['CAMPAIGN_STATUS'][_0xe521('0x74')];}};Preview['prototype'][_0xe521('0x75')]=function(_0xa7f0da,_0x29fc2d,_0x1c713d){var _0x199aec=this;var _0x889b=this[_0xe521('0x16')][_0x29fc2d];var _0x3de0db=this['campaignsPreview'][_0x889b[_0xe521('0x45')]];var _0x5533f5;var _0xad4b3b=![];var _0x372d5e=0x2;var _0x3e3f95=0x3;if(_0x3de0db){switch(_0x1c713d){case'1':_0x3de0db[_0xe521('0x76')]+=0x1;_0x889b[_0xe521('0x77')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x0,'NoSuchNumber');ami[_0xe521('0x2b')]('custom:agentnosuchnumber',ut[_0xe521('0x7b')](_0x889b,_0xe521('0x7c')));rpcDb[_0xe521('0x7d')](_0x889b,'[callProgressDetectingCustomer][logNoSuch]');_0x199aec[_0xe521('0x7e')](_0x889b,'0',_0x3de0db)[_0xe521('0x5a')](function(_0x2d52b6){_0xad4b3b=_0x2d52b6[_0xe521('0x7f')]==0x1;_0x372d5e=_0x3de0db['dialNoSuchNumberRetryFrequency'];_0x3e3f95=_0x3de0db[_0xe521('0x80')];if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0x84'));}else{if(_0x889b[_0xe521('0x77')]>=_0x3de0db[_0xe521('0x85')]){rpcDb['createCustomerFinal'](_0x889b,_0xe521('0x84'));}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,'countnosuchnumberretry',_0x3de0db[_0xe521('0x88')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0x8b')]];}else{_0x889b['countnosuchnumberretry']++;logger[_0xe521('0x43')](_0xe521('0x8c'),_0x889b[_0xe521('0x77')]);logger['info']('id',_0x889b[_0xe521('0x8d')]);_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnosuchnumberretry':_0x889b[_0xe521('0x77')]}})[_0xe521('0x5a')](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case'ANSWER':var _0x402137=moment()[_0xe521('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0x889b[_0xe521('0x8f')]=_0x402137;_0x889b[_0xe521('0x90')]=_0x402137;_0x889b['dialAnswer']=!![];_0x3de0db[_0xe521('0x2f')]+=0x1;logger[_0xe521('0x43')](_0xe521('0x91'),_0x889b['uniqueid'],_0xe521('0x92'),_0x3de0db['name'],'pTalking:\x20',_0x3de0db[_0xe521('0x2f')]);ami[_0xe521('0x2b')](_0xe521('0x93'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0x94'),this[_0xe521('0x13')][_0x889b[_0xe521('0x45')]]));if(_0x3de0db[_0xe521('0x95')]){ami[_0xe521('0x2b')]('custom:agentConnectPreview',ut[_0xe521('0x96')](_0x889b));}break;case'16':ami[_0xe521('0x2b')]('custom:agentcomplete',ut[_0xe521('0x7b')](_0x889b,_0xe521('0x97'),this[_0xe521('0x13')][_0x889b[_0xe521('0x45')]]));emitVoiceQueueChannelRemove(ut[_0xe521('0x7b')](_0x889b,_0xe521('0x97')));_0x3de0db['outboundAnswerCallsDay']+=0x1;_0x3de0db[_0xe521('0x98')]+=0x1;_0x3de0db[_0xe521('0x99')]+=0x1;ut[_0xe521('0x52')](_0x3de0db,_0xe521('0x9a'));_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x4,_0xe521('0x9b'));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0x9c'));rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe521('0x9d')](_0x889b);_0x3de0db['sumDuration']+=_0x889b[_0xe521('0x9e')];_0x3de0db[_0xe521('0x9f')]+=_0x889b[_0xe521('0x9e')];logger[_0xe521('0x43')](_0xe521('0xa0'),_0x889b[_0xe521('0xa1')],_0xe521('0x92'),_0x3de0db[_0xe521('0x29')],_0xe521('0x46'),_0x3de0db[_0xe521('0x2f')]);delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];break;case'BUSY':_0x3de0db[_0xe521('0xa2')]+=0x1;_0x889b[_0xe521('0xa3')]+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x5,_0xe521('0xa4'));_0x372d5e=_0x3de0db[_0xe521('0xa5')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami['emit'](_0xe521('0xa6'),ut[_0xe521('0x7b')](_0x889b,'busy'));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xa7'));_0x199aec[_0xe521('0x7e')](_0x889b,'5',_0x3de0db)[_0xe521('0x5a')](function(_0x644955){_0xad4b3b=_0x644955[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db['dialGlobalMaxRetry']){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xa8'));}else{if(_0x889b['countbusyretry']>=_0x3de0db[_0xe521('0xa9')]){rpcDb[_0xe521('0x6b')](_0x889b,_0xe521('0xa7'));}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,_0xe521('0xa3'),_0x3de0db['dialBusyRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b['countbusyretry']++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countbusyretry':_0x889b[_0xe521('0xa3')]}})[_0xe521('0x5a')](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case _0xe521('0xaa'):_0x3de0db[_0xe521('0xab')]+=0x1;_0x889b['countnoanswerretry']+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x3,_0xe521('0xac'));_0x372d5e=_0x3de0db['dialNoAnswerRetryFrequency'];_0x3e3f95=_0x3de0db['callAdditionalPhoneAfterMin'];var _0x498ebd=ut[_0xe521('0xad')](_0x889b,_0x3de0db);ami[_0xe521('0x2b')](_0xe521('0xae'),_0x498ebd);rpcDb['createCustomerHistory'](_0x889b,_0xe521('0xaf'));_0x199aec['verifyAdditionalPhones'](_0x889b,'3',_0x3de0db)['then'](function(_0x14fba9){_0xad4b3b=_0x14fba9[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db['dialGlobalMaxRetry']){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xb0'));}else{if(_0x889b[_0xe521('0xb1')]>=_0x3de0db[_0xe521('0xb2')]){rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb['rescheduleContact'](ut[_0xe521('0x87')](_0x889b,_0xe521('0xb1'),_0x3de0db['dialNoAnswerRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b['activeContact']);}}}else{_0x889b['countnoanswerretry']++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case _0xe521('0xb4'):_0x3de0db[_0xe521('0xb5')]+=0x1;_0x889b[_0xe521('0xb6')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x8,_0xe521('0xb7'));_0x372d5e=_0x3de0db[_0xe521('0xb8')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami[_0xe521('0x2b')](_0xe521('0xb9'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0xba')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xbb'));_0x199aec[_0xe521('0x7e')](_0x889b,'8',_0x3de0db)[_0xe521('0x5a')](function(_0x5b7ee5){_0xad4b3b=_0x5b7ee5[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xbc'));}else{if(_0x889b['countcongestionretry']>=_0x3de0db['dialCongestionMaxRetry']){rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,_0xe521('0xb6'),_0x3de0db['dialBusyRetryFrequency']),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb6')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countcongestionretry':_0x889b['countcongestionretry']}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case _0xe521('0xbd'):_0x3de0db['outboundRejectCallsDay']+=0x1;_0x889b['countagentrejectretry']+=0x1;_0x889b['countglobal']=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x14,_0xe521('0xbe'));_0x372d5e=_0x3de0db[_0xe521('0xbf')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];ami[_0xe521('0x2b')]('custom:agentreject',ut[_0xe521('0x7b')](_0x889b,_0xe521('0xc0')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xc1'));_0x199aec[_0xe521('0x7e')](_0x889b,'20',_0x3de0db)[_0xe521('0x5a')](function(_0x577931){_0xad4b3b=_0x577931[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut['cloneAction'](_0x889b,0x14,'AgentReject');rpcDb[_0xe521('0x6b')](_0x5533f5,'[callProgressDetectingCustomer][logAgentReject]');}else{if(_0x889b['countagentrejectretry']>=_0x3de0db[_0xe521('0xc2')]){rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0xe521('0x86')](ut[_0xe521('0x87')](_0x889b,'countagentrejectretry',_0x3de0db[_0xe521('0xbf')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec['swapAdditionalPhones'](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});break;case'ABANDONED':_0x3de0db['outboundAbandonedCallsDay']+=0x1;_0x889b[_0xe521('0xc3')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut['logCustomer'](_0x889b,0xb,_0xe521('0xc4'));rpcDb[_0xe521('0x7d')](_0x889b,'[callProgressDetectingCustomer][logAbandoned]');_0x199aec[_0xe521('0x7e')](_0x889b,'11',_0x3de0db)[_0xe521('0x5a')](function(_0x2f830d){_0xad4b3b=_0x2f830d[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x889b['countabandonedetry']>=_0x3de0db['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0xe521('0x87')](_0x889b,_0xe521('0xc3'),_0x3de0db[_0xe521('0xc5')]),_0x889b[_0xe521('0x89')],_0x889b[_0xe521('0x8a')]);}}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b[_0xe521('0x8d')],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})['then'](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});break;case'18':_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b[_0xe521('0xc7')]+=0x1;_0x889b[_0xe521('0x78')]=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x12,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);ami[_0xe521('0x2b')](_0xe521('0xca'),ut[_0xe521('0x7b')](_0x889b,_0xe521('0xcb')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xcc'));_0x199aec[_0xe521('0x7e')](_0x889b,'18',_0x3de0db)[_0xe521('0x5a')](function(_0x460aa5){_0xad4b3b=_0x460aa5[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0x12,'Global');rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xcc'));}else{rpcDb[_0xe521('0x6b')](_0x889b,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});});}});delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0x8b')]];break;case'19':_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b[_0xe521('0x78')]=ut['totalGlobal'](_0x889b);ut[_0xe521('0x7a')](_0x889b,0x13,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);ami[_0xe521('0x2b')](_0xe521('0xca'),ut['buildObj'](_0x889b,_0xe521('0xcb')));rpcDb[_0xe521('0x7d')](_0x889b,_0xe521('0xcd'));_0x199aec[_0xe521('0x7e')](_0x889b,'18',_0x3de0db)[_0xe521('0x5a')](function(_0x146b48){_0xad4b3b=_0x146b48[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut['totalGlobal'](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb['createCustomerFinal'](_0x5533f5,_0xe521('0xcd'));}else{rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][machine]');}}else{_0x889b[_0xe521('0xb1')]++;_0x199aec[_0xe521('0x8e')]({'id':_0x889b['idContact'],'field':{'countnoanswerretry':_0x889b[_0xe521('0xb1')]}})[_0xe521('0x5a')](function(){_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)['then'](function(){});});}});delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];break;default:if(_0x889b[_0xe521('0x47')]){ut[_0xe521('0x52')](_0x3de0db,_0xe521('0xce'));ut[_0xe521('0x53')](_0xe521('0xcf')+_0x3de0db[_0xe521('0x29')],_0xa7f0da);}_0x3de0db[_0xe521('0xc6')]+=0x1;_0x889b['countglobal']=ut[_0xe521('0x79')](_0x889b);ut[_0xe521('0x7a')](_0x889b,0xc,_0xa7f0da[_0xe521('0xc8')]||_0xa7f0da[_0xe521('0xc9')]);_0x372d5e=_0x3de0db[_0xe521('0xbf')];_0x3e3f95=_0x3de0db[_0xe521('0x80')];rpcDb['createCustomerHistory'](_0x889b,_0xe521('0xd0'));_0x199aec['verifyAdditionalPhones'](_0x889b,'20',_0x3de0db)[_0xe521('0x5a')](function(_0x369054){_0xad4b3b=_0x369054[_0xe521('0x7f')]==0x1;if(!_0xad4b3b){if(ut[_0xe521('0x79')](_0x889b)>=_0x3de0db[_0xe521('0x81')]){_0x5533f5=ut[_0xe521('0x82')](_0x889b,0xf,_0xe521('0x83'));rpcDb[_0xe521('0x6b')](_0x5533f5,_0xe521('0xd1'));}else{rpcDb['createCustomerFinal'](_0x889b,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];}else{_0x199aec[_0xe521('0xb3')](_0x889b,_0x372d5e,_0x3e3f95)[_0xe521('0x5a')](function(){});}});}if(!(_0x889b[_0xe521('0x47')]&&_0x1c713d==='16')){ut[_0xe521('0x50')](_0x3de0db,'[callProgressDetectingCustomer]');logger[_0xe521('0x43')](_0xe521('0xd2'),_0x889b['uniqueid'],_0xe521('0x92'),_0x3de0db['name'],_0xe521('0xd3'),_0x3de0db[_0xe521('0x2e')]);}if(_0x1c713d!==_0xe521('0xd4')){delete this[_0xe521('0x16')][_0xa7f0da['linkedid']];delete this[_0xe521('0x16')][_0xa7f0da[_0xe521('0xd5')]];}_0x3de0db[_0xe521('0xd6')]=!![];}};Preview[_0xe521('0xe')][_0xe521('0xd7')]=function(_0x27b695,_0x59e5f4,_0x6fec03){if(_[_0xe521('0xd8')](_0x59e5f4)&&'object'!==typeof _0x59e5f4){return;}if(_[_0xe521('0xd8')](_0x6fec03)&&_0xe521('0xd9')!==typeof _0x6fec03){return;}switch(_0x6fec03['reason']){case'0':ut[_0xe521('0xda')](_0x27b695,0x0,_0xe521('0xdb'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xdd'));break;case'3':ut['logAgent'](_0x27b695,0x3,_0xe521('0xac'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xde'));break;case'5':ut['logAgent'](_0x27b695,0x5,_0xe521('0xa4'));rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xdf'));break;case'8':ut['logAgent'](_0x27b695,0x8,_0xe521('0xb7'));rpcDb[_0xe521('0xdc')](_0x27b695,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut['logAgent'](_0x27b695,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x27b695,_0xe521('0xe0'));break;default:ut[_0xe521('0xda')](_0x27b695,0xc,_0x6fec03[_0xe521('0xe1')]);rpcDb[_0xe521('0xdc')](_0x27b695,_0xe521('0xe2'));}ut['updateOriginated'](_0x59e5f4,_0xe521('0xe3'));logger[_0xe521('0x43')](_0xe521('0xe4'),_0x27b695[_0xe521('0xa1')],_0xe521('0x92'),_0x59e5f4[_0xe521('0x29')],_0xe521('0xd3'),_0x59e5f4[_0xe521('0x2e')]);delete this[_0xe521('0x16')][_0x27b695['uniqueid']];};Preview[_0xe521('0xe')][_0xe521('0x7e')]=function(_0x2fcd0f,_0x3d94aa,_0x44a64c){return cmHopperAdditionalPhone[_0xe521('0x7e')](_0x2fcd0f,_0x3d94aa,_0x44a64c)[_0xe521('0x4e')](logger[_0xe521('0x43')](_0xe521('0xe5')));};Preview['prototype'][_0xe521('0xb3')]=function(_0x2cf1c6,_0x347f3a,_0x1b402e){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x2cf1c6,_0x347f3a,_0x1b402e)[_0xe521('0x4e')](logger['info'](_0xe521('0xe6')));};Preview[_0xe521('0xe')][_0xe521('0x8e')]=function(_0x5f3e07){return Promise[_0xe521('0xe7')]()[_0xe521('0x5a')](cmHopperAdditionalPhone[_0xe521('0x8e')](_0x5f3e07))[_0xe521('0x4e')](logger['info'](_0xe521('0xe8')));};Preview[_0xe521('0xe')][_0xe521('0xe9')]=function(_0x27f224,_0x5a61f0,_0x11c786,_0x5d808b,_0x2f9e0b){var _0x51717e=this;return new Promise(function(_0x108f25,_0x188d00){if(_[_0xe521('0x42')](_0x5a61f0)||_[_0xe521('0x42')](_0x5a61f0[_0xe521('0xea')])||_[_0xe521('0x42')](_0x5a61f0[_0xe521('0xeb')])||_['isNil'](_0x5a61f0[_0xe521('0x4a')])){_0x188d00(ut[_0xe521('0x32')](_0xe521('0xec'),_0x5d808b,_0x2f9e0b));return;}var _0x11364d=uuid['v4']();var _0x37a92e=_0x51717e[_0xe521('0x13')][_0x5a61f0[_0xe521('0xed')][_0xe521('0x29')]];var _0x34d5b5=_0x11c786?_0x51717e['agents'][_0x11c786]['id']:undefined;_0x51717e[_0xe521('0x16')][_0x11364d]=new Action(_0x5a61f0,_0x37a92e,_0x11364d,_0x11c786,_0x34d5b5);var _0x1529aa=_0x51717e['actions'][_0x11364d];_0x1529aa['unlockAgent']=_0x5d808b;_0x1529aa['activeContact']=_0x2f9e0b;_0x1529aa['lookAgent']=_0x11c786;if(_[_0xe521('0xee')](_0x27f224)){_0x51717e[_0xe521('0xef')](_0x1529aa,_0x37a92e,_0x5a61f0,_0x11c786)[_0xe521('0x5a')](function(_0xabe5ac){logger[_0xe521('0x43')](_0xe521('0xf0'),'Queue:\x20'+_0x1529aa[_0xe521('0x45')]+_0xe521('0xf1')+_0x1529aa[_0xe521('0x8d')],JSON[_0xe521('0x26')](_0xabe5ac));ami[_0xe521('0x2b')](_0xe521('0xf2'),ut[_0xe521('0x7b')](_0x1529aa,_0xe521('0xf3'),_0x51717e['campaignsPreview'][_0x1529aa[_0xe521('0x45')]]));_0x108f25(ut[_0xe521('0x32')](_0xe521('0xf4')));})['catch'](function(_0xff5c20){ut[_0xe521('0x35')](_0xe521('0xf5'),_0xff5c20);_0x188d00(ut['message'](_0xe521('0xf6'),_0x5d808b,_0x2f9e0b));});}else{_0x37a92e[_0xe521('0xf7')]+=0x1;ut['logBlacklist'](_0x1529aa);rpcDb[_0xe521('0xf8')](_0x1529aa,'[Blacklist][error]');delete _0x51717e[_0xe521('0x16')][_0x11364d];_0x188d00(ut['message'](_0xe521('0xf9'),_0x5d808b,_0x2f9e0b));}});};Preview['prototype'][_0xe521('0x72')]=function(_0x583548){return!_[_0xe521('0x42')](_0x583548)&&!_[_0xe521('0x42')](_0x583548[_0xe521('0x29')])&&!_[_0xe521('0x42')](_0x583548[_0xe521('0xfa')])&&_0x583548[_0xe521('0xfa')]&&!_['isNil'](this[_0xe521('0x15')][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])])&&!_[_0xe521('0x42')](this['trunks'][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])]['status'])&&(this[_0xe521('0x15')][util['format'](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])][_0xe521('0xfc')]==='reachable'||this['trunks'][util[_0xe521('0x27')](_0xe521('0xfb'),_0x583548[_0xe521('0x29')])][_0xe521('0xfc')]===_0xe521('0xfd'));};Preview[_0xe521('0xe')][_0xe521('0x5f')]=function(_0x5ad96b,_0x61303b){return this['execRun'](_0x5ad96b,_0x61303b)[_0xe521('0x5a')](function(_0x29acc7){return _[_0xe521('0x48')](_0x29acc7,[_0xe521('0x32')]);})['catch'](function(_0xc13f){if(_0xc13f[_0xe521('0xfe')]){rpcDb[_0xe521('0xff')](_0x5ad96b);}if(_0xc13f[_0xe521('0xfa')]){rpcDb['disableContact'](_0x5ad96b);}throw _['pick'](_0xc13f,[_0xe521('0x32')]);});};Preview['prototype'][_0xe521('0x100')]=function(_0x20a558,_0xf0bd7b){var _0x2d5636=this;var _0x2005b7,_0x25de1f;return rpcDb[_0xe521('0x101')](_0x20a558)['then'](function(_0x11adab){if(!_[_0xe521('0x42')](_0x11adab[0x0])){_0x25de1f=_0x11adab[0x0]['recallme']?![]:!![];_0x2005b7=_0x11adab[0x0][_0xe521('0x102')]?!![]:![];_0x2005b7=_0xf0bd7b?!![]:_0x2005b7;}var _0x3a3319=_0x2d5636[_0xe521('0x103')](_0x11adab);if(_0x3a3319[_0xe521('0x104')]){rpcDb[_0xe521('0x105')](_[_0xe521('0x48')](_0x11adab[0x0],[_0xe521('0x4a'),_0xe521('0xeb')]))['then'](function(_0x8a25f7){_0x2d5636['checkInBlack'](_0x8a25f7,_0x11adab[0x0],_0xf0bd7b,_0x25de1f,_0x2005b7)['then'](function(_0x5c1cd9){return _0x5c1cd9;})['catch'](function(_0x5da60e){throw _0x5da60e;});})[_0xe521('0x4e')](function(_0x515fdb){ut[_0xe521('0x35')](_0xe521('0x106'),_0x515fdb);throw ut[_0xe521('0x32')]('Call\x20unsuccessful',_0x25de1f,_0x2005b7);});}else{throw ut[_0xe521('0x32')](_0x3a3319[_0xe521('0x32')],_0x25de1f,_0x2005b7);}})[_0xe521('0x4e')](function(_0xfd3317){ut['logger'](_0xe521('0x107'),_0xfd3317);throw ut[_0xe521('0x32')]('Call\x20unsuccessful',![],!![]);});};Preview[_0xe521('0xe')][_0xe521('0x103')]=function(_0x15a069){if(_[_0xe521('0x42')](_0x15a069)||_[_0xe521('0xee')](_0x15a069)||!_[_0xe521('0x42')](_0x15a069[0x0][_0xe521('0x5d')])&&_[_0xe521('0x42')](_0x15a069[0x0]['Agent']['name'])){ut[_0xe521('0x35')]('[Preview][validateContact][Empty\x20Contact]',_0x15a069);return{'isValid':![],'message':_0xe521('0x108')};}var _0x572b6a=this[_0xe521('0x13')][_0x15a069[0x0][_0xe521('0xed')]['name']];_0x572b6a[_0xe521('0x32')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xe521('0x42')](_0x572b6a)){ut['logger'](_0xe521('0x109'),_0x572b6a);return{'isValid':![],'message':_0xe521('0x10a')};}if(!this[_0xe521('0x72')](_0x572b6a[_0xe521('0x10b')])){ut[_0xe521('0x35')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20'+_0x572b6a[_0xe521('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xe521('0x72')](_0x572b6a[_0xe521('0x73')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x572b6a[_0xe521('0x29')]+_0xe521('0x10c'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0xe521('0x70')](_0x572b6a[_0xe521('0x71')])){ut[_0xe521('0x35')](_0xe521('0x10d'),_0x572b6a[_0xe521('0x29')]+_0xe521('0x10e'));return{'isValid':![],'message':_0xe521('0x10f')+_0x572b6a[_0xe521('0x29')]+_0xe521('0x10e')};}return{'isValid':!![],'message':_0xe521('0x110')};};Preview[_0xe521('0xe')][_0xe521('0xef')]=function(_0x2aa5e5,_0x33afbf,_0x250f48,_0x33ce3){var _0x4b5223=this;return new Promise(function(_0x53c2da,_0x5d3b46){var _0x1834e9=_0x2aa5e5[_0xe521('0xa1')];var _0xb05d6c=_0x4b5223[_0xe521('0x72')](_0x33afbf['Trunk'])?util[_0xe521('0x27')](_0xe521('0x111'),_0x33afbf[_0xe521('0x10b')][_0xe521('0x29')],_[_0xe521('0x42')](_0x33afbf[_0xe521('0x112')])?'':_0x33afbf[_0xe521('0x112')][_0xe521('0x113')]()||'',_0x33afbf[_0xe521('0x114')]>0x0?_0x250f48[_0xe521('0xeb')][_0xe521('0x115')](_0x33afbf[_0xe521('0x114')]):_0x250f48[_0xe521('0xeb')]):util[_0xe521('0x27')](_0xe521('0x111'),_[_0xe521('0x42')](_0x33afbf['TrunkBackup'])?_0x33afbf[_0xe521('0x10b')][_0xe521('0x29')]:_0x33afbf[_0xe521('0x73')][_0xe521('0x29')],_[_0xe521('0x42')](_0x33afbf[_0xe521('0x112')])?'':_0x33afbf[_0xe521('0x112')][_0xe521('0x113')]()||'',_0x33afbf['dialCutDigit']>0x0?_0x250f48[_0xe521('0xeb')][_0xe521('0x115')](_0x33afbf[_0xe521('0x114')]):_0x250f48[_0xe521('0xeb')]);var _0x17a669=_0x4b5223['isTrunkReachable'](_0x33afbf[_0xe521('0x10b')])?ut['getCallerId'](_0x33afbf[_0xe521('0x10b')][_0xe521('0x116')],_0x33afbf[_0xe521('0x117')],_0x33afbf[_0xe521('0x118')]>0x0?ut[_0xe521('0x119')](_0x33afbf['dialOriginateCallerIdNumber'],_0x33afbf['dialRandomLastDigitCallerIdNumber']):_0x33afbf[_0xe521('0x11a')]):ut[_0xe521('0x11b')](_[_0xe521('0x42')](_0x33afbf[_0xe521('0x73')])?_0x33afbf[_0xe521('0x10b')][_0xe521('0x116')]:_0x33afbf[_0xe521('0x73')][_0xe521('0x116')],_0x33afbf[_0xe521('0x117')],_0x33afbf[_0xe521('0x118')]>0x0?ut[_0xe521('0x119')](_0x33afbf[_0xe521('0x11a')],_0x33afbf['dialRandomLastDigitCallerIdNumber']):_0x33afbf[_0xe521('0x11a')]);if(_0x17a669){_0x2aa5e5[_0xe521('0x11c')]=ut[_0xe521('0x11d')](_0x17a669);_0x2aa5e5[_0xe521('0x11e')]=ut[_0xe521('0x11f')](_0x17a669);}var _0x191910=ut[_0xe521('0x120')](_0x33afbf,_0x250f48,_0xb05d6c,_0x17a669,_0x1834e9,_0x2aa5e5);var _0x3cf388=utils[_0xe521('0x121')](_0x250f48[_0xe521('0xea')]);Object['assign'](_0x191910,_0x3cf388);_['merge'](_0x2aa5e5,ut[_0xe521('0x122')](_0x191910));_0x2aa5e5[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));_0x33afbf[_0xe521('0x123')]=_0x191910;var _0x37bcbf=ut[_0xe521('0x124')](_0x2aa5e5,_0x33afbf,_0x191910,_0x2aa5e5['activeContact'],_0x33ce3);return ami[_0xe521('0x4c')](_0x37bcbf)[_0xe521('0x5a')](function(_0xc3626c){_0x33afbf[_0xe521('0x2e')]+=0x1;logger[_0xe521('0x43')]('[originated][increment]',_0x1834e9,_0xe521('0x92'),_0x33afbf[_0xe521('0x29')],_0xe521('0xd3'),_0x33afbf['originated']);_0x53c2da(_0xc3626c);})[_0xe521('0x4e')](function(_0x4adc81){ut[_0xe521('0xda')](_0x2aa5e5,0xe,'OriginateError');rpcDb[_0xe521('0xdc')](_0x2aa5e5,_0xe521('0x125'));_0x5d3b46(_0x4adc81);});});};Preview[_0xe521('0xe')]['syncNewExten']=function(_0x2ac963){if(this['actions'][_0x2ac963[_0xe521('0x8b')]]){this[_0xe521('0x16')][_0x2ac963['linkedid']]['channel']=_0x2ac963[_0xe521('0x4d')];}};Preview[_0xe521('0xe')][_0xe521('0x126')]=function(_0xb03d9){var _0x4e1b66=this;var _0x4c31ee=this['actions'][_0xb03d9['actionid']];if(_0x4c31ee){if(_0x4c31ee[_0xe521('0x127')]&&this[_0xe521('0x59')][_0x4c31ee[_0xe521('0x127')]]){ut['logLookAgent'](_0x4c31ee,this['agents'][_0x4c31ee[_0xe521('0x127')]][_0xe521('0x29')],this['agents'][_0x4c31ee[_0xe521('0x127')]]['id']);}var _0x47cb7c=_[_0xe521('0x128')](_0x4c31ee);_0x47cb7c[_0xe521('0x8f')]=moment()[_0xe521('0x27')](_0xe521('0x64'));var _0x3da2a9=_0x4e1b66[_0xe521('0x13')][_0x4c31ee['queue']];if(ut[_0xe521('0x129')](_0xb03d9[_0xe521('0x12a')])){if(_0x4c31ee[_0xe521('0x89')]){rpcDb['unlockContact'](_0x4c31ee[_0xe521('0x8d')]);}if(_0x4c31ee[_0xe521('0x8a')]){rpcDb['disableContact'](_0x4c31ee[_0xe521('0x8d')]);}ami[_0xe521('0x2b')](_0xe521('0x12b'),ut[_0xe521('0x7b')](_0x4c31ee,'rejected',this['campaignsPreview'][_0x4c31ee[_0xe521('0x45')]]));this[_0xe521('0xd7')](_0x47cb7c,_0x3da2a9,_0xb03d9);}else{_0x4c31ee[_0xe521('0x63')]=moment()[_0xe521('0x27')](_0xe521('0x64'));ut['logAgent'](_0x47cb7c,0x4,'Answer');rpcDb[_0xe521('0xdc')](_0x47cb7c,_0xe521('0x12c'));}}};Preview[_0xe521('0xe')][_0xe521('0x1a')]=function(_0x5cb6bc){var _0xe26682=this[_0xe521('0x16')][_0x5cb6bc[_0xe521('0x8b')]];var _0x48178d;if(_0xe26682){_0x48178d=this[_0xe521('0x13')][_0xe26682[_0xe521('0x45')]];logger[_0xe521('0x43')](_0xe521('0x12d'),_0x5cb6bc[_0xe521('0x8b')],'\x20Queue',_0x48178d['name'],_0xe521('0x46'),_0x48178d[_0xe521('0x2f')]);}if(this[_0xe521('0x16')][_0x5cb6bc['linkedid']]&&_0x5cb6bc['linkedid']!==_0x5cb6bc[_0xe521('0xa1')]){if(_0x5cb6bc[_0xe521('0x12e')]==='16'&&this['actions'][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}else if(this['actions'][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){logger[_0xe521('0x43')]('[syncHangup][talking][cause]',_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],'\x20Queue',_0x48178d[_0xe521('0x29')],'pTalking:\x20',_0x48178d['pTalking']);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}}else if(_0xe26682&&_[_0xe521('0x42')](_0xe26682['statedesc'])&&_0x48178d[_0xe521('0x12f')]&&_0x5cb6bc['linkedid']===_0x5cb6bc[_0xe521('0xa1')]&&_[_0xe521('0x42')](_0x5cb6bc[_0xe521('0xe1')])&&_0x5cb6bc[_0xe521('0x12e')]==='16'&&_0x5cb6bc[_0xe521('0x130')]==='6'&&_[_0xe521('0xd8')](_0xe26682[_0xe521('0x131')])){if(_0xe26682['unlockAgent']){rpcDb[_0xe521('0xff')](_0xe26682[_0xe521('0x8d')]);}if(_0xe26682[_0xe521('0x8a')]){rpcDb[_0xe521('0x62')](_0xe26682[_0xe521('0x8d')]);}_0x5cb6bc['reason']='22';this[_0xe521('0xd7')](_0xe26682,_0x48178d,_0x5cb6bc);}else if(_0xe26682&&_0xe26682[_0xe521('0x131')]){if(_0x5cb6bc[_0xe521('0x12e')]==='16'&&this[_0xe521('0x16')][_0x5cb6bc['linkedid']][_0xe521('0x47')]){logger[_0xe521('0x43')](_0xe521('0x132'),_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],'\x20Queue',_0x48178d[_0xe521('0x29')],_0xe521('0x46'),_0x48178d[_0xe521('0x2f')]);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}else if(this[_0xe521('0x16')][_0x5cb6bc[_0xe521('0x8b')]][_0xe521('0x47')]){logger[_0xe521('0x43')](_0xe521('0x133'),_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')],_0xe521('0x92'),_0x48178d['name'],'pTalking:\x20',_0x48178d[_0xe521('0x2f')]);this[_0xe521('0x75')](_0x5cb6bc,_0x5cb6bc[_0xe521('0x8b')],_0x5cb6bc[_0xe521('0x12e')]);}}};Preview[_0xe521('0xe')][_0xe521('0x134')]=function(_0x1318c1){if(this[_0xe521('0x16')][_0x1318c1['destlinkedid']]&&_0x1318c1[_0xe521('0xd5')]!==_0x1318c1[_0xe521('0x135')]){this[_0xe521('0x75')](_0x1318c1,_0x1318c1[_0xe521('0xd5')],_0x1318c1['dialstatus']);}};Preview['prototype'][_0xe521('0x1c')]=function(_0x4d2d9b){if(this[_0xe521('0x16')][_0x4d2d9b[_0xe521('0x8b')]]&&_0x4d2d9b[_0xe521('0x8b')]!==_0x4d2d9b[_0xe521('0xa1')]&&!this[_0xe521('0x16')][_0x4d2d9b[_0xe521('0x8b')]][_0xe521('0x47')]){if(_0x4d2d9b[_0xe521('0x12e')]==='1'){this[_0xe521('0x75')](_0x4d2d9b,_0x4d2d9b['linkedid'],_0x4d2d9b[_0xe521('0x12e')]);}}};Preview[_0xe521('0xe')][_0xe521('0x136')]=function(_0x2c4fd4,_0x344503,_0x2c1f3d){if(this[_0xe521('0x16')][_0x2c4fd4]){if(_[_0xe521('0x42')](this[_0xe521('0x16')][_0x2c4fd4][_0xe521('0x123')])){this[_0xe521('0x16')][_0x2c4fd4][_0xe521('0x123')]={};}this['actions'][_0x2c4fd4][_0xe521('0x123')][_0x344503]=_0x2c1f3d;}};Preview[_0xe521('0xe')]['syncVarSet']=function(_0x29e603){try{if(!_[_0xe521('0x42')](_0x29e603)){if(ut[_0xe521('0x137')](_[_0xe521('0x138')](_0x29e603[_0xe521('0x139')])[0x0])){this['addVariable'](_0x29e603[_0xe521('0xa1')],_['keys'](_0x29e603[_0xe521('0x139')])[0x0],_0x29e603[_0xe521('0x13a')]);}}}catch(_0x10f4ad){logger[_0xe521('0x13b')]('[syncVarSet][Preview]',util[_0xe521('0x13c')](_0x10f4ad,{'showHidden':![],'depth':null}));}};Preview[_0xe521('0xe')][_0xe521('0x21')]=function(_0x1449a1){if(_0x1449a1){if(this[_0xe521('0x16')][_0x1449a1[_0xe521('0x13d')]]){this[_0xe521('0x16')][_0x1449a1[_0xe521('0x13d')]][_0xe521('0x131')]=!![];}}};Preview[_0xe521('0xe')]['syncBlindTransfer']=function(_0x54897a){if(_0x54897a){if(this[_0xe521('0x16')][_0x54897a[_0xe521('0x13e')]]){this[_0xe521('0x16')][_0x54897a[_0xe521('0x13e')]][_0xe521('0x131')]=!![];}}};module[_0xe521('0x13f')]=Preview; \ No newline at end of file +var _0x2c5e=['dialRandomLastDigitCallerIdNumber','getCallerId','callerid','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','setXMDContactVariables','Contact','assign','toLowerVariables','variables','variablesAction','[originated][increment]','[originateFailure][logOriginateFailure]','actionid','lookAgent','logLookAgent','isFailure','response','custom:agentringnoanswer','rejected','callProgressDetectingAgent','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destlinkedid','keys','variable','addVariable','error','inspect','transfertargetlinkedid','transfererlinkedid','lodash','uuid','moment','../../../config/environment','../../../config/logger','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','localhost','socket.io-emitter','enqueue','tail','sequence','campaignsPreview','actions','agents','originateresponse','syncOriginateResponse','hangup','syncHangup','hanguprequest','bind','dialend','syncDialEnd','syncNewExten','varset','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','format','voice:queue:%s','name','voice_queue_channel:remove','emit','sendMessageOneNotActive','originated','pTalking','paused','message','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','\x20is\x20deactivated','prototype','syncCampaigns','clockClearZombieChannels','hasOwnProperty','dialMethod','booked','type','outbound','clearZombieChannels','dialActive','recallMe','isNil','[clearZombieChannels][talking]','Queue','stringify','queue','pTalking:\x20','contactId','UserId','ListId','Action','channel','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','clearZombieChannel','getContactRecallMe','agentReadyId','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','additional','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','dialAnswer','[syncHangup][talking][increment]','uniqueid','custom:agentconnect','connect','acw','complete','outboundAnswerCallsDay','answered','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','sumBillable','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','cloneAction','Global','[callProgressDetectingCustomer][logBusyGlobal]','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','[callProgressDetectingCustomer][logNoAnswer]','dialGlobalMaxRetry','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','incrementPreviewCounters','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','outboundUnknownCallsDay','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','\x20Queue','originated:\x20','queueSummaryCountersUpdated','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','phone','VoiceQueueId','Contact\x20is\x20undefined','isEmpty','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','reachable','unmonitored','execRun','pick','unlockContact','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Campaign','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','substring','dialCutDigit','SIP/%s/%s%s','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2c5e,0x165));var _0xe2c5=function(_0x387c65,_0x2fd251){_0x387c65=_0x387c65-0x0;var _0x4d24b7=_0x2c5e[_0x387c65];return _0x4d24b7;};'use strict';var util=require('util');var _=require(_0xe2c5('0x0'));var uuid=require(_0xe2c5('0x1'));var moment=require(_0xe2c5('0x2'));var Redis=require('ioredis');var config=require(_0xe2c5('0x3'));var logger=require(_0xe2c5('0x4'))('preview');var loggerAction=require('../../../config/logger')('actionPreview');var ami=require(_0xe2c5('0x5'));var rpcDb=require(_0xe2c5('0x6'));var cmHopperAdditionalPhone=require(_0xe2c5('0x7'));var Action=require(_0xe2c5('0x8'));var ut=require(_0xe2c5('0x9'));var utils=require(_0xe2c5('0xa'));config[_0xe2c5('0xb')]=_['defaults'](config['redis'],{'host':_0xe2c5('0xc'),'port':0x18eb});var io=require(_0xe2c5('0xd'))(new Redis(config[_0xe2c5('0xb')]));var Sequence=function(){};Sequence['prototype'][_0xe2c5('0xe')]=function(_0x5a4f21){this[_0xe2c5('0xf')]=this[_0xe2c5('0xf')]?this['tail']['finally'](_0x5a4f21):_0x5a4f21();};function Preview(_0x18f99a){this[_0xe2c5('0x10')]=new Sequence();this[_0xe2c5('0x11')]=_0x18f99a['voiceQueues'];this['trunks']=_0x18f99a['trunks'];this[_0xe2c5('0x12')]={};this['agents']=_0x18f99a[_0xe2c5('0x13')];this['clockClearZombieChannels']=0x0;ami['on'](_0xe2c5('0x14'),this[_0xe2c5('0x15')]['bind'](this));ami['on'](_0xe2c5('0x16'),this[_0xe2c5('0x17')]['bind'](this));ami['on'](_0xe2c5('0x18'),this['syncHangupRequest'][_0xe2c5('0x19')](this));ami['on'](_0xe2c5('0x1a'),this[_0xe2c5('0x1b')][_0xe2c5('0x19')](this));ami['on']('newexten',this[_0xe2c5('0x1c')][_0xe2c5('0x19')](this));ami['on'](_0xe2c5('0x1d'),this['syncVarSet'][_0xe2c5('0x19')](this));ami['on'](_0xe2c5('0x1e'),this[_0xe2c5('0x1f')]['bind'](this));ami['on'](_0xe2c5('0x20'),this[_0xe2c5('0x21')][_0xe2c5('0x19')](this));this[_0xe2c5('0x22')](this[_0xe2c5('0x11')]);}function emit(_0xb161d0,_0x156323,_0x11a629){io['to'](_0xb161d0)['emit'](_0x156323,_0x11a629);}function emitVoiceQueueChannelRemove(_0x2ecf3e){logger[_0xe2c5('0x23')](_0xe2c5('0x24'),JSON['stringify'](_0x2ecf3e));emit(util[_0xe2c5('0x25')](_0xe2c5('0x26'),_0x2ecf3e[_0xe2c5('0x27')]),_0xe2c5('0x28'),_0x2ecf3e);io[_0xe2c5('0x29')]('voice_queue_presence:remove',_0x2ecf3e);}function notSendMessagesQueue(_0xd149a3){if(_0xd149a3[_0xe2c5('0x2a')]){if(_0xd149a3[_0xe2c5('0x2b')]===0x0&&_0xd149a3[_0xe2c5('0x2c')]===0x0){_0xd149a3[_0xe2c5('0x2a')]=![];_0xd149a3['available']=0x0;_0xd149a3[_0xe2c5('0x2d')]=0x0;_0xd149a3[_0xe2c5('0x2e')]=utils['CAMPAIGN_STATUS'][_0xe2c5('0x2f')];ut[_0xe2c5('0x30')](_0xe2c5('0x31'),_0xd149a3[_0xe2c5('0x27')]+_0xe2c5('0x32'));}else{_0xd149a3[_0xe2c5('0x2e')]=utils[_0xe2c5('0x33')]['DEACTIVATED'];ut['logger'](_0xe2c5('0x31'),_0xd149a3['name']+_0xe2c5('0x34'));}}}Preview[_0xe2c5('0x35')][_0xe2c5('0x22')]=function(){var _0x5b2135=this;setInterval(function(){_0x5b2135[_0xe2c5('0x36')]();},0x7cf);};Preview[_0xe2c5('0x35')][_0xe2c5('0x36')]=function(){var _0x34b666=this['campaignsPreview'];this[_0xe2c5('0x37')]+=0x1;for(var _0x4d7bf8 in _0x34b666){if(_0x34b666[_0xe2c5('0x38')](_0x4d7bf8)&&(_0x34b666[_0x4d7bf8]['dialMethod']==='preview'||_0x34b666[_0x4d7bf8][_0xe2c5('0x39')]===_0xe2c5('0x3a'))&&_0x34b666[_0x4d7bf8][_0xe2c5('0x3b')]===_0xe2c5('0x3c')){if(this['clockClearZombieChannels']>0x7){this[_0xe2c5('0x37')]=0x0;this[_0xe2c5('0x3d')]();}}if(_0x34b666[_0xe2c5('0x38')](_0x4d7bf8)&&_0x34b666[_0x4d7bf8]['dialMethod']==='preview'&&_0x34b666[_0x4d7bf8][_0xe2c5('0x3b')]===_0xe2c5('0x3c')){if(_0x34b666[_0x4d7bf8][_0xe2c5('0x3e')]){this['setMessage'](_0x34b666[_0x4d7bf8]);if(_0x34b666[_0x4d7bf8]['dialPreviewAutoRecallMe'])this[_0xe2c5('0x3f')](_0x34b666[_0x4d7bf8]);}else{notSendMessagesQueue(_0x34b666[_0x4d7bf8]);}}}};Preview[_0xe2c5('0x35')]['clearZombieChannel']=function(_0x5d433f){var _0x248f57=this;this['sequence'][_0xe2c5('0xe')](function(){if(!_[_0xe2c5('0x40')](_0x248f57[_0xe2c5('0x12')][_0x5d433f])){loggerAction[_0xe2c5('0x23')](_0xe2c5('0x41'),_0x5d433f,_0xe2c5('0x42'),_0x248f57[_0xe2c5('0x12')][_0x5d433f]['queue'],'originated:\x20',JSON[_0xe2c5('0x43')](_0x248f57[_0xe2c5('0x11')][_0x248f57[_0xe2c5('0x12')][_0x5d433f][_0xe2c5('0x44')]]['originated']),_0xe2c5('0x45'),JSON[_0xe2c5('0x43')](_0x248f57[_0xe2c5('0x11')][_0x248f57[_0xe2c5('0x12')][_0x5d433f]['queue']][_0xe2c5('0x2c')]),JSON[_0xe2c5('0x43')](_0x248f57['actions'][_0x5d433f]['dialAnswer']),JSON[_0xe2c5('0x43')](_['pick'](_0x248f57[_0xe2c5('0x12')][_0x5d433f],[_0xe2c5('0x46'),_0xe2c5('0x47'),'VoiceQueueId',_0xe2c5('0x48')])));return ami[_0xe2c5('0x49')]({'action':'status','channel':_0x248f57['actions'][_0x5d433f][_0xe2c5('0x4a')]})[_0xe2c5('0x4b')](function(_0x55315c){if(_0x55315c[_0xe2c5('0x2e')]===_0xe2c5('0x4c')){setTimeout(function(){if(_0x248f57['actions'][_0x5d433f]){ut[_0xe2c5('0x4d')](_0x248f57['campaignsPreview'][_0x248f57[_0xe2c5('0x12')][_0x5d433f][_0xe2c5('0x44')]],_0xe2c5('0x4e'));if(_0x248f57['actions'][_0x5d433f]['dialAnswer']===!![]){ut[_0xe2c5('0x4f')](_0x248f57[_0xe2c5('0x11')][_0x248f57[_0xe2c5('0x12')][_0x5d433f][_0xe2c5('0x44')]],_0xe2c5('0x4e'));ut[_0xe2c5('0x50')](_0xe2c5('0x51')+_0x5d433f,_0x248f57[_0xe2c5('0x12')][_0x5d433f][_0xe2c5('0x44')]);}ut[_0xe2c5('0x50')](_0xe2c5('0x52')+_0x5d433f,_0x248f57[_0xe2c5('0x12')][_0x5d433f]['queue']);delete _0x248f57[_0xe2c5('0x12')][_0x5d433f];}},0x2328);}});}});};Preview[_0xe2c5('0x35')][_0xe2c5('0x3d')]=function(){var _0x5dc06c=this;loggerAction[_0xe2c5('0x23')](_0xe2c5('0x53'),_[_0xe2c5('0x54')](this[_0xe2c5('0x12')]));for(var _0x5527a1 in this[_0xe2c5('0x12')]){if(_0x5dc06c[_0xe2c5('0x12')][_0xe2c5('0x38')](_0x5527a1)){_0x5dc06c[_0xe2c5('0x55')](_0x5527a1);}}};Preview[_0xe2c5('0x35')]['recallMe']=function(_0x297169){var _0x15f623=this;rpcDb[_0xe2c5('0x56')](_0x297169['id'],ut[_0xe2c5('0x57')](this['agents']))[_0xe2c5('0x58')](function(_0x123c74){if(!_[_0xe2c5('0x40')](_0x123c74)){for(var _0x2b6a55=0x0;_0x2b6a55<_0x123c74[_0xe2c5('0x59')];_0x2b6a55+=0x1){if(ut[_0xe2c5('0x5a')](_0x123c74[_0x2b6a55]['scheduledat'])<_0x297169[_0xe2c5('0x5b')]*0x3c){if(_0x123c74[_0x2b6a55][_0xe2c5('0x5c')]&&!_0x123c74[_0x2b6a55]['Agent'][_0xe2c5('0x5d')]){_0x15f623[_0xe2c5('0x5e')](_0x123c74[_0x2b6a55]['id'])['then'](ut[_0xe2c5('0x5f')](_0xe2c5('0x60')))[_0xe2c5('0x4b')](ut['logger2'](_0xe2c5('0x60')));}else{rpcDb[_0xe2c5('0x61')](_0x123c74[_0x2b6a55]['id']);}}else{var _0x10a577=new Action(_0x123c74[_0x2b6a55],_0x297169);_0x10a577[_0xe2c5('0x62')]=moment()['format'](_0xe2c5('0x63'));_0x297169[_0xe2c5('0x64')]+=0x1;ut[_0xe2c5('0x65')](_0x10a577,0x17,_0xe2c5('0x66'));if(_0x297169[_0xe2c5('0x67')]){rpcDb[_0xe2c5('0x68')](ut['createBody'](_0x123c74[_0x2b6a55]));rpcDb[_0xe2c5('0x69')](_0x10a577,_0xe2c5('0x6a'));}else{ut[_0xe2c5('0x65')](_0x10a577,0x16,_0xe2c5('0x6b'));rpcDb[_0xe2c5('0x69')](_0x10a577,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x10a577,'[HistoryRecallClose]');}}}}})[_0xe2c5('0x4b')](ut[_0xe2c5('0x5f')](_0xe2c5('0x6c')));};Preview[_0xe2c5('0x35')][_0xe2c5('0x6d')]=function(_0x37ec3a){_0x37ec3a[_0xe2c5('0x2a')]=!![];if(ut[_0xe2c5('0x6e')](_0x37ec3a[_0xe2c5('0x6f')])){_0x37ec3a[_0xe2c5('0x2e')]=utils[_0xe2c5('0x33')]['NO_AGENTS_LOGGED'];}else if(!ut[_0xe2c5('0x70')](_0x37ec3a[_0xe2c5('0x3e')])){_0x37ec3a['message']=utils[_0xe2c5('0x33')][_0xe2c5('0x2f')];}else if(!this[_0xe2c5('0x71')](_0x37ec3a[_0xe2c5('0x72')])){if(!this[_0xe2c5('0x71')](_0x37ec3a[_0xe2c5('0x73')])){_0x37ec3a[_0xe2c5('0x2e')]=utils[_0xe2c5('0x33')][_0xe2c5('0x74')];}else{_0x37ec3a[_0xe2c5('0x2e')]=utils[_0xe2c5('0x33')][_0xe2c5('0x75')];}}else{_0x37ec3a[_0xe2c5('0x2e')]=utils[_0xe2c5('0x33')][_0xe2c5('0x75')];}};Preview[_0xe2c5('0x35')]['callProgressDetectingCustomer']=function(_0x2cce28,_0x4ed7de,_0x58ff07){var _0x3ca192=this;var _0xa4d36d=this[_0xe2c5('0x12')][_0x4ed7de];var _0x43cc50=this[_0xe2c5('0x11')][_0xa4d36d[_0xe2c5('0x44')]];var _0x5c3cd3;var _0x579fd0=![];var _0x1bd2b0=0x2;var _0xafc951=0x3;if(_0x43cc50){switch(_0x58ff07){case'1':_0x43cc50['outboundNoSuchCallsDay']+=0x1;_0xa4d36d[_0xe2c5('0x76')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x0,_0xe2c5('0x79'));ami['emit'](_0xe2c5('0x7a'),ut[_0xe2c5('0x7b')](_0xa4d36d,_0xe2c5('0x7c')));rpcDb[_0xe2c5('0x69')](_0xa4d36d,'[callProgressDetectingCustomer][logNoSuch]');_0x3ca192['verifyAdditionalPhones'](_0xa4d36d,'0',_0x43cc50)[_0xe2c5('0x58')](function(_0xfffcc4){_0x579fd0=_0xfffcc4[_0xe2c5('0x7d')]==0x1;_0x1bd2b0=_0x43cc50['dialNoSuchNumberRetryFrequency'];_0xafc951=_0x43cc50['callAdditionalPhoneAfterMin'];if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50['dialGlobalMaxRetry']){_0x5c3cd3=ut['cloneAction'](_0xa4d36d,0xf,'Global');rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0x7f'));}else{if(_0xa4d36d['countnosuchnumberretry']>=_0x43cc50[_0xe2c5('0x80')]){rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0x7f'));}else{rpcDb[_0xe2c5('0x81')](ut[_0xe2c5('0x82')](_0xa4d36d,_0xe2c5('0x76'),_0x43cc50[_0xe2c5('0x83')]),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}delete this['actions'][_0x2cce28[_0xe2c5('0x86')]];}else{_0xa4d36d[_0xe2c5('0x76')]++;logger[_0xe2c5('0x23')](_0xe2c5('0x87'),_0xa4d36d['countnosuchnumberretry']);logger[_0xe2c5('0x23')]('id',_0xa4d36d[_0xe2c5('0x88')]);_0x3ca192['incrementPreviewCounters']({'id':_0xa4d36d['idContact'],'field':{'countnosuchnumberretry':_0xa4d36d[_0xe2c5('0x76')]}})['then'](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});break;case _0xe2c5('0x8a'):var _0x48d3c4=moment()[_0xe2c5('0x25')](_0xe2c5('0x63'));_0xa4d36d[_0xe2c5('0x8b')]=_0x48d3c4;_0xa4d36d['answertime']=_0x48d3c4;_0xa4d36d[_0xe2c5('0x8c')]=!![];_0x43cc50[_0xe2c5('0x2c')]+=0x1;logger['info'](_0xe2c5('0x8d'),_0xa4d36d[_0xe2c5('0x8e')],'\x20Queue',_0x43cc50[_0xe2c5('0x27')],_0xe2c5('0x45'),_0x43cc50['pTalking']);ami[_0xe2c5('0x29')](_0xe2c5('0x8f'),ut[_0xe2c5('0x7b')](_0xa4d36d,_0xe2c5('0x90'),this['campaignsPreview'][_0xa4d36d[_0xe2c5('0x44')]]));if(_0x43cc50[_0xe2c5('0x91')]){ami[_0xe2c5('0x29')]('custom:agentConnectPreview',ut['buildAcw'](_0xa4d36d));}break;case'16':ami[_0xe2c5('0x29')]('custom:agentcomplete',ut['buildObj'](_0xa4d36d,_0xe2c5('0x92'),this[_0xe2c5('0x11')][_0xa4d36d['queue']]));emitVoiceQueueChannelRemove(ut['buildObj'](_0xa4d36d,_0xe2c5('0x92')));_0x43cc50[_0xe2c5('0x93')]+=0x1;_0x43cc50['total']+=0x1;_0x43cc50[_0xe2c5('0x94')]+=0x1;ut[_0xe2c5('0x4f')](_0x43cc50,'[16]');_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x4,_0xe2c5('0x95'));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0x96'));rpcDb[_0xe2c5('0x7e')](_0xa4d36d,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xe2c5('0x97')](_0xa4d36d);_0x43cc50[_0xe2c5('0x98')]+=_0xa4d36d['talktime'];_0x43cc50[_0xe2c5('0x99')]+=_0xa4d36d[_0xe2c5('0x9a')];logger['info'](_0xe2c5('0x9b'),_0xa4d36d[_0xe2c5('0x8e')],'\x20Queue',_0x43cc50[_0xe2c5('0x27')],_0xe2c5('0x45'),_0x43cc50[_0xe2c5('0x2c')]);delete this[_0xe2c5('0x12')][_0x2cce28[_0xe2c5('0x86')]];break;case _0xe2c5('0x9c'):_0x43cc50['outboundBusyCallsDay']+=0x1;_0xa4d36d[_0xe2c5('0x9d')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x5,_0xe2c5('0x9e'));_0x1bd2b0=_0x43cc50[_0xe2c5('0x9f')];_0xafc951=_0x43cc50[_0xe2c5('0xa0')];ami[_0xe2c5('0x29')](_0xe2c5('0xa1'),ut['buildObj'](_0xa4d36d,_0xe2c5('0xa2')));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xa3'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'5',_0x43cc50)['then'](function(_0x4cf723){_0x579fd0=_0x4cf723[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50['dialGlobalMaxRetry']){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0xf,_0xe2c5('0xa6'));rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0xa7'));}else{if(_0xa4d36d[_0xe2c5('0x9d')]>=_0x43cc50['dialBusyMaxRetry']){rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0xa3'));}else{rpcDb[_0xe2c5('0x81')](ut[_0xe2c5('0x82')](_0xa4d36d,_0xe2c5('0x9d'),_0x43cc50[_0xe2c5('0x9f')]),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}}else{_0xa4d36d['countbusyretry']++;_0x3ca192['incrementPreviewCounters']({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countbusyretry':_0xa4d36d[_0xe2c5('0x9d')]}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});break;case'NOANSWER':_0x43cc50['outboundNoAnswerCallsDay']+=0x1;_0xa4d36d[_0xe2c5('0xa8')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut['totalGlobal'](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x3,_0xe2c5('0xa9'));_0x1bd2b0=_0x43cc50[_0xe2c5('0xaa')];_0xafc951=_0x43cc50[_0xe2c5('0xa0')];var _0x3ea5ed=ut['buildNoAnswerEventPayload'](_0xa4d36d,_0x43cc50);ami['emit']('custom:agentnoanswer',_0x3ea5ed);rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xab'));_0x3ca192['verifyAdditionalPhones'](_0xa4d36d,'3',_0x43cc50)['then'](function(_0x59c63c){_0x579fd0=_0x59c63c[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50[_0xe2c5('0xac')]){_0x5c3cd3=ut['cloneAction'](_0xa4d36d,0xf,_0xe2c5('0xa6'));rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0xa4d36d[_0xe2c5('0xa8')]>=_0x43cc50[_0xe2c5('0xad')]){rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0xab'));}else{rpcDb[_0xe2c5('0x81')](ut['scheduledAt'](_0xa4d36d,'countnoanswerretry',_0x43cc50[_0xe2c5('0xaa')]),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}}else{_0xa4d36d[_0xe2c5('0xa8')]++;_0x3ca192['incrementPreviewCounters']({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countnoanswerretry':_0xa4d36d['countnoanswerretry']}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});break;case _0xe2c5('0xae'):_0x43cc50[_0xe2c5('0xaf')]+=0x1;_0xa4d36d[_0xe2c5('0xb0')]+=0x1;_0xa4d36d['countglobal']=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x8,_0xe2c5('0xb1'));_0x1bd2b0=_0x43cc50[_0xe2c5('0xb2')];_0xafc951=_0x43cc50[_0xe2c5('0xa0')];ami[_0xe2c5('0x29')](_0xe2c5('0xb3'),ut['buildObj'](_0xa4d36d,_0xe2c5('0xb4')));rpcDb['createCustomerHistory'](_0xa4d36d,_0xe2c5('0xb5'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'8',_0x43cc50)[_0xe2c5('0x58')](function(_0x957be8){_0x579fd0=_0x957be8[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50[_0xe2c5('0xac')]){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0xf,_0xe2c5('0xa6'));rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0xa4d36d['countcongestionretry']>=_0x43cc50['dialCongestionMaxRetry']){rpcDb['createCustomerFinal'](_0xa4d36d,_0xe2c5('0xb5'));}else{rpcDb[_0xe2c5('0x81')](ut[_0xe2c5('0x82')](_0xa4d36d,_0xe2c5('0xb0'),_0x43cc50[_0xe2c5('0x9f')]),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}}else{_0xa4d36d[_0xe2c5('0xb0')]++;_0x3ca192[_0xe2c5('0xb6')]({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countcongestionretry':_0xa4d36d[_0xe2c5('0xb0')]}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});break;case _0xe2c5('0xb7'):_0x43cc50[_0xe2c5('0xb8')]+=0x1;_0xa4d36d[_0xe2c5('0xb9')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x14,_0xe2c5('0xba'));_0x1bd2b0=_0x43cc50[_0xe2c5('0xbb')];_0xafc951=_0x43cc50[_0xe2c5('0xa0')];ami[_0xe2c5('0x29')](_0xe2c5('0xbc'),ut[_0xe2c5('0x7b')](_0xa4d36d,_0xe2c5('0xbd')));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xbe'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'20',_0x43cc50)[_0xe2c5('0x58')](function(_0x4eefb9){_0x579fd0=_0x4eefb9['additional']==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50[_0xe2c5('0xac')]){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0x14,_0xe2c5('0xba'));rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0xbf'));}else{if(_0xa4d36d[_0xe2c5('0xb9')]>=_0x43cc50['dialAgentRejectMaxRetry']){rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0xbf'));}else{rpcDb[_0xe2c5('0x81')](ut[_0xe2c5('0x82')](_0xa4d36d,_0xe2c5('0xb9'),_0x43cc50[_0xe2c5('0xbb')]),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}}else{_0xa4d36d[_0xe2c5('0xa8')]++;_0x3ca192[_0xe2c5('0xb6')]({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countnoanswerretry':_0xa4d36d[_0xe2c5('0xa8')]}})[_0xe2c5('0x58')](function(){_0x3ca192['swapAdditionalPhones'](_0xa4d36d,_0x1bd2b0,_0xafc951)['then'](function(){});});}});break;case'ABANDONED':_0x43cc50[_0xe2c5('0xc0')]+=0x1;_0xa4d36d[_0xe2c5('0xc1')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0xb,_0xe2c5('0xc2'));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xc3'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'11',_0x43cc50)[_0xe2c5('0x58')](function(_0x479a80){_0x579fd0=_0x479a80['additional']==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50[_0xe2c5('0xac')]){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0xf,'Global');rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0xc3'));}else{if(_0xa4d36d[_0xe2c5('0xc4')]>=_0x43cc50[_0xe2c5('0xc5')]){rpcDb['createCustomerFinal'](_0xa4d36d,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xe2c5('0x81')](ut[_0xe2c5('0x82')](_0xa4d36d,_0xe2c5('0xc1'),_0x43cc50['dialAbandonedRetryFrequency']),_0xa4d36d[_0xe2c5('0x84')],_0xa4d36d[_0xe2c5('0x85')]);}}}else{_0xa4d36d['countnoanswerretry']++;_0x3ca192[_0xe2c5('0xb6')]({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countnoanswerretry':_0xa4d36d[_0xe2c5('0xa8')]}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});break;case'18':_0x43cc50['outboundUnknownCallsDay']+=0x1;_0xa4d36d[_0xe2c5('0xc6')]+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0x12,_0x2cce28[_0xe2c5('0xc7')]||_0x2cce28['dialstatus']);ami[_0xe2c5('0x29')](_0xe2c5('0xc8'),ut[_0xe2c5('0x7b')](_0xa4d36d,'amd'));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xc9'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'18',_0x43cc50)[_0xe2c5('0x58')](function(_0x28c896){_0x579fd0=_0x28c896[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50['dialGlobalMaxRetry']){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0x12,'Global');rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0xc9'));}else{rpcDb[_0xe2c5('0x7e')](_0xa4d36d,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0xa4d36d[_0xe2c5('0xa8')]++;_0x3ca192[_0xe2c5('0xb6')]({'id':_0xa4d36d['idContact'],'field':{'countnoanswerretry':_0xa4d36d['countnoanswerretry']}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});delete this[_0xe2c5('0x12')][_0x2cce28['linkedid']];break;case'19':_0x43cc50['outboundUnknownCallsDay']+=0x1;_0xa4d36d[_0xe2c5('0x77')]=ut[_0xe2c5('0x78')](_0xa4d36d);ut['logCustomer'](_0xa4d36d,0x13,_0x2cce28[_0xe2c5('0xc7')]||_0x2cce28[_0xe2c5('0xca')]);ami[_0xe2c5('0x29')](_0xe2c5('0xc8'),ut['buildObj'](_0xa4d36d,_0xe2c5('0xcb')));rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xcc'));_0x3ca192['verifyAdditionalPhones'](_0xa4d36d,'18',_0x43cc50)['then'](function(_0x4df08f){_0x579fd0=_0x4df08f[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50['dialGlobalMaxRetry']){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0xf,'Global');rpcDb['createCustomerFinal'](_0x5c3cd3,_0xe2c5('0xcc'));}else{rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0xcc'));}}else{_0xa4d36d[_0xe2c5('0xa8')]++;_0x3ca192[_0xe2c5('0xb6')]({'id':_0xa4d36d[_0xe2c5('0x88')],'field':{'countnoanswerretry':_0xa4d36d[_0xe2c5('0xa8')]}})[_0xe2c5('0x58')](function(){_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});});}});delete this['actions'][_0x2cce28[_0xe2c5('0x86')]];break;default:if(_0xa4d36d[_0xe2c5('0x8c')]){ut[_0xe2c5('0x4f')](_0x43cc50,_0xe2c5('0xcd'));ut[_0xe2c5('0x50')](_0xe2c5('0xce')+_0x43cc50[_0xe2c5('0x27')],_0x2cce28);}_0x43cc50[_0xe2c5('0xcf')]+=0x1;_0xa4d36d['countglobal']=ut[_0xe2c5('0x78')](_0xa4d36d);ut[_0xe2c5('0x65')](_0xa4d36d,0xc,_0x2cce28[_0xe2c5('0xc7')]||_0x2cce28[_0xe2c5('0xca')]);_0x1bd2b0=_0x43cc50[_0xe2c5('0xbb')];_0xafc951=_0x43cc50[_0xe2c5('0xa0')];rpcDb[_0xe2c5('0x69')](_0xa4d36d,_0xe2c5('0xd0'));_0x3ca192[_0xe2c5('0xa4')](_0xa4d36d,'20',_0x43cc50)[_0xe2c5('0x58')](function(_0x7edd18){_0x579fd0=_0x7edd18[_0xe2c5('0x7d')]==0x1;if(!_0x579fd0){if(ut[_0xe2c5('0x78')](_0xa4d36d)>=_0x43cc50['dialGlobalMaxRetry']){_0x5c3cd3=ut[_0xe2c5('0xa5')](_0xa4d36d,0xf,_0xe2c5('0xa6'));rpcDb[_0xe2c5('0x7e')](_0x5c3cd3,_0xe2c5('0xd1'));}else{rpcDb[_0xe2c5('0x7e')](_0xa4d36d,_0xe2c5('0xd1'));}delete this[_0xe2c5('0x12')][_0x2cce28[_0xe2c5('0x86')]];}else{_0x3ca192[_0xe2c5('0x89')](_0xa4d36d,_0x1bd2b0,_0xafc951)[_0xe2c5('0x58')](function(){});}});}if(!(_0xa4d36d[_0xe2c5('0x8c')]&&_0x58ff07==='16')){ut[_0xe2c5('0x4d')](_0x43cc50,_0xe2c5('0xd2'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0xa4d36d[_0xe2c5('0x8e')],_0xe2c5('0xd3'),_0x43cc50[_0xe2c5('0x27')],_0xe2c5('0xd4'),_0x43cc50[_0xe2c5('0x2b')]);}if(_0x58ff07!=='ANSWER'){delete this[_0xe2c5('0x12')][_0x2cce28[_0xe2c5('0x86')]];delete this[_0xe2c5('0x12')][_0x2cce28['destlinkedid']];}_0x43cc50[_0xe2c5('0xd5')]=!![];}};Preview[_0xe2c5('0x35')]['callProgressDetectingAgent']=function(_0x1970a6,_0x497136,_0x1fecaa){if(_[_0xe2c5('0xd6')](_0x497136)&&'object'!==typeof _0x497136){return;}if(_['isUndefined'](_0x1fecaa)&&'object'!==typeof _0x1fecaa){return;}switch(_0x1fecaa[_0xe2c5('0xd7')]){case'0':ut[_0xe2c5('0xd8')](_0x1970a6,0x0,_0xe2c5('0x79'));rpcDb[_0xe2c5('0xd9')](_0x1970a6,_0xe2c5('0xda'));break;case'3':ut[_0xe2c5('0xd8')](_0x1970a6,0x3,_0xe2c5('0xa9'));rpcDb['createAgentHistory'](_0x1970a6,_0xe2c5('0xdb'));break;case'5':ut['logAgent'](_0x1970a6,0x5,_0xe2c5('0x9e'));rpcDb[_0xe2c5('0xd9')](_0x1970a6,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0x1970a6,0x8,_0xe2c5('0xb1'));rpcDb['createAgentHistory'](_0x1970a6,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xe2c5('0xd8')](_0x1970a6,0x16,'AnswerAGI');rpcDb[_0xe2c5('0xd9')](_0x1970a6,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0xe2c5('0xd8')](_0x1970a6,0xc,_0x1fecaa[_0xe2c5('0xd7')]);rpcDb['createAgentHistory'](_0x1970a6,_0xe2c5('0xdc'));}ut[_0xe2c5('0x4d')](_0x497136,_0xe2c5('0xdd'));logger[_0xe2c5('0x23')](_0xe2c5('0xde'),_0x1970a6[_0xe2c5('0x8e')],'\x20Queue',_0x497136[_0xe2c5('0x27')],'originated:\x20',_0x497136['originated']);delete this[_0xe2c5('0x12')][_0x1970a6[_0xe2c5('0x8e')]];};Preview[_0xe2c5('0x35')][_0xe2c5('0xa4')]=function(_0x56ed84,_0x5f0fd2,_0x4e55a3){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x56ed84,_0x5f0fd2,_0x4e55a3)[_0xe2c5('0x4b')](logger[_0xe2c5('0x23')](_0xe2c5('0xdf')));};Preview[_0xe2c5('0x35')]['swapAdditionalPhones']=function(_0x149ca9,_0x123b1a,_0x3634f0){return cmHopperAdditionalPhone[_0xe2c5('0x89')](_0x149ca9,_0x123b1a,_0x3634f0)[_0xe2c5('0x4b')](logger[_0xe2c5('0x23')](_0xe2c5('0xe0')));};Preview[_0xe2c5('0x35')]['incrementPreviewCounters']=function(_0x2189c3){return Promise[_0xe2c5('0xe1')]()[_0xe2c5('0x58')](cmHopperAdditionalPhone[_0xe2c5('0xb6')](_0x2189c3))[_0xe2c5('0x4b')](logger[_0xe2c5('0x23')](_0xe2c5('0xe2')));};Preview[_0xe2c5('0x35')][_0xe2c5('0xe3')]=function(_0x29d356,_0x19efdb,_0x129b93,_0x4f7b41,_0x3a9281){var _0x58db5b=this;return new Promise(function(_0x44c9a4,_0x390579){if(_[_0xe2c5('0x40')](_0x19efdb)||_[_0xe2c5('0x40')](_0x19efdb['Contact'])||_[_0xe2c5('0x40')](_0x19efdb[_0xe2c5('0xe4')])||_['isNil'](_0x19efdb[_0xe2c5('0xe5')])){_0x390579(ut[_0xe2c5('0x2e')](_0xe2c5('0xe6'),_0x4f7b41,_0x3a9281));return;}var _0x3e3051=uuid['v4']();var _0x535179=_0x58db5b[_0xe2c5('0x11')][_0x19efdb[_0xe2c5('0x42')][_0xe2c5('0x27')]];var _0x2f95e6=_0x129b93?_0x58db5b[_0xe2c5('0x13')][_0x129b93]['id']:undefined;_0x58db5b[_0xe2c5('0x12')][_0x3e3051]=new Action(_0x19efdb,_0x535179,_0x3e3051,_0x129b93,_0x2f95e6);var _0x2b8520=_0x58db5b[_0xe2c5('0x12')][_0x3e3051];_0x2b8520['unlockAgent']=_0x4f7b41;_0x2b8520['activeContact']=_0x3a9281;_0x2b8520['lookAgent']=_0x129b93;if(_[_0xe2c5('0xe7')](_0x29d356)){_0x58db5b['execCall'](_0x2b8520,_0x535179,_0x19efdb,_0x129b93)[_0xe2c5('0x58')](function(_0x1c3d9f){logger['info'](_0xe2c5('0xe8'),_0xe2c5('0xe9')+_0x2b8520['queue']+_0xe2c5('0xea')+_0x2b8520[_0xe2c5('0x88')],JSON['stringify'](_0x1c3d9f));ami['emit'](_0xe2c5('0xeb'),ut[_0xe2c5('0x7b')](_0x2b8520,'called',_0x58db5b[_0xe2c5('0x11')][_0x2b8520[_0xe2c5('0x44')]]));_0x44c9a4(ut[_0xe2c5('0x2e')]('Calling'));})[_0xe2c5('0x4b')](function(_0x1e6498){ut[_0xe2c5('0x30')]('[Preview][execCall][failure]',_0x1e6498);_0x390579(ut['message'](_0xe2c5('0xec'),_0x4f7b41,_0x3a9281));});}else{_0x535179['outboundBlacklistCallsDay']+=0x1;ut[_0xe2c5('0xed')](_0x2b8520);rpcDb[_0xe2c5('0xee')](_0x2b8520,_0xe2c5('0xef'));delete _0x58db5b[_0xe2c5('0x12')][_0x3e3051];_0x390579(ut[_0xe2c5('0x2e')](_0xe2c5('0xf0'),_0x4f7b41,_0x3a9281));}});};Preview[_0xe2c5('0x35')][_0xe2c5('0x71')]=function(_0x2f9158){return!_['isNil'](_0x2f9158)&&!_['isNil'](_0x2f9158[_0xe2c5('0x27')])&&!_[_0xe2c5('0x40')](_0x2f9158[_0xe2c5('0xf1')])&&_0x2f9158[_0xe2c5('0xf1')]&&!_[_0xe2c5('0x40')](this[_0xe2c5('0xf2')][util['format'](_0xe2c5('0xf3'),_0x2f9158[_0xe2c5('0x27')])])&&!_[_0xe2c5('0x40')](this[_0xe2c5('0xf2')][util[_0xe2c5('0x25')](_0xe2c5('0xf3'),_0x2f9158[_0xe2c5('0x27')])]['status'])&&(this[_0xe2c5('0xf2')][util['format']('SIP/%s',_0x2f9158[_0xe2c5('0x27')])]['status']===_0xe2c5('0xf4')||this[_0xe2c5('0xf2')][util[_0xe2c5('0x25')]('SIP/%s',_0x2f9158[_0xe2c5('0x27')])]['status']===_0xe2c5('0xf5'));};Preview[_0xe2c5('0x35')]['run']=function(_0x45fe68,_0x39966a){return this[_0xe2c5('0xf6')](_0x45fe68,_0x39966a)['then'](function(_0x59a18a){return _[_0xe2c5('0xf7')](_0x59a18a,['message']);})[_0xe2c5('0x4b')](function(_0x65f132){if(_0x65f132['unlock']){rpcDb[_0xe2c5('0xf8')](_0x45fe68);}if(_0x65f132['active']){rpcDb['disableContact'](_0x45fe68);}throw _[_0xe2c5('0xf7')](_0x65f132,[_0xe2c5('0x2e')]);});};Preview[_0xe2c5('0x35')][_0xe2c5('0xf6')]=function(_0x18ea09,_0x3f460b){var _0x44790b=this;var _0x3d4c7e,_0x18e6e8;return rpcDb['getContactPreview'](_0x18ea09)[_0xe2c5('0x58')](function(_0x3711c1){if(!_[_0xe2c5('0x40')](_0x3711c1[0x0])){_0x18e6e8=_0x3711c1[0x0][_0xe2c5('0xf9')]?![]:!![];_0x3d4c7e=_0x3711c1[0x0][_0xe2c5('0xf9')]?!![]:![];_0x3d4c7e=_0x3f460b?!![]:_0x3d4c7e;}var _0x32fef9=_0x44790b[_0xe2c5('0xfa')](_0x3711c1);if(_0x32fef9[_0xe2c5('0xfb')]){rpcDb[_0xe2c5('0xfc')](_[_0xe2c5('0xf7')](_0x3711c1[0x0],['VoiceQueueId',_0xe2c5('0xe4')]))['then'](function(_0x8fa01c){_0x44790b[_0xe2c5('0xe3')](_0x8fa01c,_0x3711c1[0x0],_0x3f460b,_0x18e6e8,_0x3d4c7e)['then'](function(_0xcc494f){return _0xcc494f;})[_0xe2c5('0x4b')](function(_0x2521cf){throw _0x2521cf;});})[_0xe2c5('0x4b')](function(_0x9ad252){ut['logger'](_0xe2c5('0xfd'),_0x9ad252);throw ut[_0xe2c5('0x2e')]('Call\x20unsuccessful',_0x18e6e8,_0x3d4c7e);});}else{throw ut[_0xe2c5('0x2e')](_0x32fef9[_0xe2c5('0x2e')],_0x18e6e8,_0x3d4c7e);}})[_0xe2c5('0x4b')](function(_0x16f11c){ut['logger'](_0xe2c5('0xfe'),_0x16f11c);throw ut[_0xe2c5('0x2e')](_0xe2c5('0xff'),![],!![]);});};Preview[_0xe2c5('0x35')][_0xe2c5('0xfa')]=function(_0x1a371d){if(_[_0xe2c5('0x40')](_0x1a371d)||_[_0xe2c5('0xe7')](_0x1a371d)||!_[_0xe2c5('0x40')](_0x1a371d[0x0][_0xe2c5('0x5c')])&&_[_0xe2c5('0x40')](_0x1a371d[0x0][_0xe2c5('0x5c')][_0xe2c5('0x27')])){ut[_0xe2c5('0x30')](_0xe2c5('0x100'),_0x1a371d);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x5a0f1c=this[_0xe2c5('0x11')][_0x1a371d[0x0][_0xe2c5('0x42')][_0xe2c5('0x27')]];_0x5a0f1c[_0xe2c5('0x2e')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0xe2c5('0x40')](_0x5a0f1c)){ut[_0xe2c5('0x30')]('[Preview][validateContact][Empty\x20Campaign]',_0x5a0f1c);return{'isValid':![],'message':_0xe2c5('0x101')};}if(!this[_0xe2c5('0x71')](_0x5a0f1c[_0xe2c5('0x72')])){ut[_0xe2c5('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0xe2c5('0x102')+_0x5a0f1c[_0xe2c5('0x27')]+_0xe2c5('0x103'));if(!this[_0xe2c5('0x71')](_0x5a0f1c[_0xe2c5('0x73')])){ut[_0xe2c5('0x30')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x5a0f1c[_0xe2c5('0x27')]+_0xe2c5('0x104'));return{'isValid':![],'message':_0xe2c5('0x105')};}}if(!ut[_0xe2c5('0x70')](_0x5a0f1c[_0xe2c5('0x3e')])){ut['logger'](_0xe2c5('0x106'),_0x5a0f1c[_0xe2c5('0x27')]+_0xe2c5('0x107'));return{'isValid':![],'message':_0xe2c5('0x102')+_0x5a0f1c[_0xe2c5('0x27')]+_0xe2c5('0x107')};}return{'isValid':!![],'message':_0xe2c5('0x108')};};Preview[_0xe2c5('0x35')]['execCall']=function(_0x132692,_0x188b07,_0x1fe8de,_0x4e7168){var _0x282248=this;return new Promise(function(_0x35a1c1,_0x6f30a){var _0x7fed5f=_0x132692[_0xe2c5('0x8e')];var _0x259ef2=_0x282248['isTrunkReachable'](_0x188b07['Trunk'])?util[_0xe2c5('0x25')]('SIP/%s/%s%s',_0x188b07['Trunk'][_0xe2c5('0x27')],_[_0xe2c5('0x40')](_0x188b07[_0xe2c5('0x109')])?'':_0x188b07['dialPrefix'][_0xe2c5('0x10a')]()||'',_0x188b07['dialCutDigit']>0x0?_0x1fe8de[_0xe2c5('0xe4')][_0xe2c5('0x10b')](_0x188b07[_0xe2c5('0x10c')]):_0x1fe8de['phone']):util[_0xe2c5('0x25')](_0xe2c5('0x10d'),_[_0xe2c5('0x40')](_0x188b07[_0xe2c5('0x73')])?_0x188b07[_0xe2c5('0x72')]['name']:_0x188b07['TrunkBackup'][_0xe2c5('0x27')],_[_0xe2c5('0x40')](_0x188b07['dialPrefix'])?'':_0x188b07[_0xe2c5('0x109')]['trim']()||'',_0x188b07['dialCutDigit']>0x0?_0x1fe8de['phone'][_0xe2c5('0x10b')](_0x188b07[_0xe2c5('0x10c')]):_0x1fe8de[_0xe2c5('0xe4')]);var _0x165a55=_0x282248[_0xe2c5('0x71')](_0x188b07[_0xe2c5('0x72')])?ut['getCallerId'](_0x188b07[_0xe2c5('0x72')]['callerid'],_0x188b07[_0xe2c5('0x10e')],_0x188b07['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xe2c5('0x10f')](_0x188b07[_0xe2c5('0x110')],_0x188b07[_0xe2c5('0x111')]):_0x188b07[_0xe2c5('0x110')]):ut[_0xe2c5('0x112')](_[_0xe2c5('0x40')](_0x188b07[_0xe2c5('0x73')])?_0x188b07[_0xe2c5('0x72')]['callerid']:_0x188b07[_0xe2c5('0x73')][_0xe2c5('0x113')],_0x188b07['dialOriginateCallerIdName'],_0x188b07[_0xe2c5('0x111')]>0x0?ut[_0xe2c5('0x10f')](_0x188b07['dialOriginateCallerIdNumber'],_0x188b07[_0xe2c5('0x111')]):_0x188b07[_0xe2c5('0x110')]);if(_0x165a55){_0x132692[_0xe2c5('0x114')]=ut[_0xe2c5('0x115')](_0x165a55);_0x132692[_0xe2c5('0x116')]=ut[_0xe2c5('0x117')](_0x165a55);}var _0x117841=ut[_0xe2c5('0x118')](_0x188b07,_0x1fe8de,_0x259ef2,_0x165a55,_0x7fed5f,_0x132692);var _0x32f06d=utils[_0xe2c5('0x119')](_0x1fe8de[_0xe2c5('0x11a')]);Object[_0xe2c5('0x11b')](_0x117841,_0x32f06d);_['merge'](_0x132692,ut[_0xe2c5('0x11c')](_0x117841));_0x132692['starttime']=moment()['format'](_0xe2c5('0x63'));_0x188b07[_0xe2c5('0x11d')]=_0x117841;var _0x448230=ut[_0xe2c5('0x11e')](_0x132692,_0x188b07,_0x117841,_0x132692['activeContact'],_0x4e7168);return ami['Action'](_0x448230)['then'](function(_0x2a1850){_0x188b07[_0xe2c5('0x2b')]+=0x1;logger['info'](_0xe2c5('0x11f'),_0x7fed5f,_0xe2c5('0xd3'),_0x188b07[_0xe2c5('0x27')],_0xe2c5('0xd4'),_0x188b07[_0xe2c5('0x2b')]);_0x35a1c1(_0x2a1850);})[_0xe2c5('0x4b')](function(_0x27771d){ut[_0xe2c5('0xd8')](_0x132692,0xe,'OriginateError');rpcDb['createAgentHistory'](_0x132692,_0xe2c5('0x120'));_0x6f30a(_0x27771d);});});};Preview['prototype'][_0xe2c5('0x1c')]=function(_0x4fcee9){if(this[_0xe2c5('0x12')][_0x4fcee9[_0xe2c5('0x86')]]){this[_0xe2c5('0x12')][_0x4fcee9[_0xe2c5('0x86')]][_0xe2c5('0x4a')]=_0x4fcee9[_0xe2c5('0x4a')];}};Preview[_0xe2c5('0x35')][_0xe2c5('0x15')]=function(_0x2c2489){var _0x172298=this;var _0x2a3cd6=this[_0xe2c5('0x12')][_0x2c2489[_0xe2c5('0x121')]];if(_0x2a3cd6){if(_0x2a3cd6[_0xe2c5('0x122')]&&this[_0xe2c5('0x13')][_0x2a3cd6['lookAgent']]){ut[_0xe2c5('0x123')](_0x2a3cd6,this[_0xe2c5('0x13')][_0x2a3cd6['lookAgent']][_0xe2c5('0x27')],this['agents'][_0x2a3cd6[_0xe2c5('0x122')]]['id']);}var _0x25c603=_['clone'](_0x2a3cd6);_0x25c603[_0xe2c5('0x8b')]=moment()[_0xe2c5('0x25')](_0xe2c5('0x63'));var _0x40ae66=_0x172298[_0xe2c5('0x11')][_0x2a3cd6['queue']];if(ut[_0xe2c5('0x124')](_0x2c2489[_0xe2c5('0x125')])){if(_0x2a3cd6[_0xe2c5('0x84')]){rpcDb['unlockContact'](_0x2a3cd6[_0xe2c5('0x88')]);}if(_0x2a3cd6[_0xe2c5('0x85')]){rpcDb[_0xe2c5('0x61')](_0x2a3cd6[_0xe2c5('0x88')]);}ami['emit'](_0xe2c5('0x126'),ut[_0xe2c5('0x7b')](_0x2a3cd6,_0xe2c5('0x127'),this['campaignsPreview'][_0x2a3cd6[_0xe2c5('0x44')]]));this[_0xe2c5('0x128')](_0x25c603,_0x40ae66,_0x2c2489);}else{_0x2a3cd6['starttime']=moment()[_0xe2c5('0x25')](_0xe2c5('0x63'));ut['logAgent'](_0x25c603,0x4,_0xe2c5('0x95'));rpcDb[_0xe2c5('0xd9')](_0x25c603,_0xe2c5('0x129'));}}};Preview[_0xe2c5('0x35')][_0xe2c5('0x17')]=function(_0xdc504b){var _0x5561b2=this[_0xe2c5('0x12')][_0xdc504b['linkedid']];var _0x4ec710;if(_0x5561b2){_0x4ec710=this[_0xe2c5('0x11')][_0x5561b2['queue']];logger[_0xe2c5('0x23')](_0xe2c5('0x12a'),_0xdc504b[_0xe2c5('0x86')],_0xe2c5('0xd3'),_0x4ec710[_0xe2c5('0x27')],_0xe2c5('0x45'),_0x4ec710[_0xe2c5('0x2c')]);}if(this['actions'][_0xdc504b[_0xe2c5('0x86')]]&&_0xdc504b['linkedid']!==_0xdc504b[_0xe2c5('0x8e')]){if(_0xdc504b[_0xe2c5('0x12b')]==='16'&&this[_0xe2c5('0x12')][_0xdc504b['linkedid']][_0xe2c5('0x8c')]){this['callProgressDetectingCustomer'](_0xdc504b,_0xdc504b[_0xe2c5('0x86')],_0xdc504b[_0xe2c5('0x12b')]);}else if(this[_0xe2c5('0x12')][_0xdc504b[_0xe2c5('0x86')]][_0xe2c5('0x8c')]){logger[_0xe2c5('0x23')](_0xe2c5('0x12c'),_0xdc504b['linkedid'],_0xdc504b[_0xe2c5('0x12b')],_0xe2c5('0xd3'),_0x4ec710['name'],_0xe2c5('0x45'),_0x4ec710[_0xe2c5('0x2c')]);this[_0xe2c5('0x12d')](_0xdc504b,_0xdc504b[_0xe2c5('0x86')],_0xdc504b[_0xe2c5('0x12b')]);}}else if(_0x5561b2&&_[_0xe2c5('0x40')](_0x5561b2[_0xe2c5('0x12e')])&&_0x4ec710[_0xe2c5('0x12f')]&&_0xdc504b[_0xe2c5('0x86')]===_0xdc504b[_0xe2c5('0x8e')]&&_[_0xe2c5('0x40')](_0xdc504b['reason'])&&_0xdc504b['cause']==='16'&&_0xdc504b[_0xe2c5('0x130')]==='6'&&_[_0xe2c5('0xd6')](_0x5561b2[_0xe2c5('0x131')])){if(_0x5561b2[_0xe2c5('0x84')]){rpcDb[_0xe2c5('0xf8')](_0x5561b2['idContact']);}if(_0x5561b2['activeContact']){rpcDb['disableContact'](_0x5561b2[_0xe2c5('0x88')]);}_0xdc504b['reason']='22';this[_0xe2c5('0x128')](_0x5561b2,_0x4ec710,_0xdc504b);}else if(_0x5561b2&&_0x5561b2['transfer']){if(_0xdc504b[_0xe2c5('0x12b')]==='16'&&this[_0xe2c5('0x12')][_0xdc504b['linkedid']][_0xe2c5('0x8c')]){logger[_0xe2c5('0x23')](_0xe2c5('0x132'),_0xdc504b['linkedid'],_0xdc504b[_0xe2c5('0x12b')],_0xe2c5('0xd3'),_0x4ec710[_0xe2c5('0x27')],'pTalking:\x20',_0x4ec710[_0xe2c5('0x2c')]);this['callProgressDetectingCustomer'](_0xdc504b,_0xdc504b[_0xe2c5('0x86')],_0xdc504b[_0xe2c5('0x12b')]);}else if(this[_0xe2c5('0x12')][_0xdc504b[_0xe2c5('0x86')]][_0xe2c5('0x8c')]){logger['info'](_0xe2c5('0x12c'),_0xdc504b[_0xe2c5('0x86')],_0xdc504b[_0xe2c5('0x12b')],_0xe2c5('0xd3'),_0x4ec710[_0xe2c5('0x27')],_0xe2c5('0x45'),_0x4ec710[_0xe2c5('0x2c')]);this[_0xe2c5('0x12d')](_0xdc504b,_0xdc504b[_0xe2c5('0x86')],_0xdc504b[_0xe2c5('0x12b')]);}}};Preview[_0xe2c5('0x35')][_0xe2c5('0x1b')]=function(_0x1e70fd){if(this[_0xe2c5('0x12')][_0x1e70fd[_0xe2c5('0x133')]]&&_0x1e70fd['destlinkedid']!==_0x1e70fd['destuniqueid']){this['callProgressDetectingCustomer'](_0x1e70fd,_0x1e70fd[_0xe2c5('0x133')],_0x1e70fd[_0xe2c5('0xca')]);}};Preview['prototype']['syncHangupRequest']=function(_0x4e193d){if(this[_0xe2c5('0x12')][_0x4e193d['linkedid']]&&_0x4e193d['linkedid']!==_0x4e193d[_0xe2c5('0x8e')]&&!this['actions'][_0x4e193d['linkedid']][_0xe2c5('0x8c')]){if(_0x4e193d[_0xe2c5('0x12b')]==='1'){this[_0xe2c5('0x12d')](_0x4e193d,_0x4e193d[_0xe2c5('0x86')],_0x4e193d[_0xe2c5('0x12b')]);}}};Preview[_0xe2c5('0x35')]['addVariable']=function(_0x3cef1f,_0x17b0fd,_0x4add77){if(this[_0xe2c5('0x12')][_0x3cef1f]){if(_['isNil'](this[_0xe2c5('0x12')][_0x3cef1f][_0xe2c5('0x11d')])){this['actions'][_0x3cef1f][_0xe2c5('0x11d')]={};}this[_0xe2c5('0x12')][_0x3cef1f][_0xe2c5('0x11d')][_0x17b0fd]=_0x4add77;}};Preview[_0xe2c5('0x35')]['syncVarSet']=function(_0xde9df7){try{if(!_[_0xe2c5('0x40')](_0xde9df7)){if(ut['filterKey'](_[_0xe2c5('0x134')](_0xde9df7[_0xe2c5('0x135')])[0x0])){this[_0xe2c5('0x136')](_0xde9df7['uniqueid'],_['keys'](_0xde9df7['variable'])[0x0],_0xde9df7['value']);}}}catch(_0x1f5e93){logger[_0xe2c5('0x137')]('[syncVarSet][Preview]',util[_0xe2c5('0x138')](_0x1f5e93,{'showHidden':![],'depth':null}));}};Preview[_0xe2c5('0x35')][_0xe2c5('0x1f')]=function(_0x2b0216){if(_0x2b0216){if(this[_0xe2c5('0x12')][_0x2b0216[_0xe2c5('0x139')]]){this[_0xe2c5('0x12')][_0x2b0216[_0xe2c5('0x139')]][_0xe2c5('0x131')]=!![];}}};Preview[_0xe2c5('0x35')][_0xe2c5('0x21')]=function(_0x5209b6){if(_0x5209b6){if(this[_0xe2c5('0x12')][_0x5209b6[_0xe2c5('0x13a')]]){this[_0xe2c5('0x12')][_0x5209b6['transfererlinkedid']][_0xe2c5('0x131')]=!![];}}};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 10ae3b9..8954313 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 _0xb5d5=['answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','then','[getContactPreview]\x20','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt'];(function(_0x4730bd,_0x1e9541){var _0x1b2849=function(_0x1fc5a8){while(--_0x1fc5a8){_0x4730bd['push'](_0x4730bd['shift']());}};_0x1b2849(++_0x1e9541);}(_0xb5d5,0xaf));var _0x5b5d=function(_0x378722,_0xfd8413){_0x378722=_0x378722-0x0;var _0x48ae1a=_0xb5d5[_0x378722];return _0x48ae1a;};'use strict';var util=require(_0x5b5d('0x0'));var BPromise=require('bluebird');var logger=require(_0x5b5d('0x1'))(_0x5b5d('0x2'));var cmHopper=require(_0x5b5d('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5b5d('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x5b5d('0x5'));function loggerCatch(_0x2e723a){return function(_0x30e8c1){logger['error'](_0x2e723a,util['inspect'](_0x30e8c1,{'showHidden':![],'depth':null}));};}function create(_0x8b9b22){return cmHopperHistory[_0x5b5d('0x6')](_0x8b9b22)[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x8')));}function createAgent(_0x27054a){return BPromise[_0x5b5d('0x9')]()['then'](agentReportPreview[_0x5b5d('0x6')](_0x27054a))[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x8')));}function moveContact(_0x46e6cb){return cmHopper['moveContactManagedDialer'](_0x46e6cb,!![])[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0xa')));}exports[_0x5b5d('0xb')]=function(_0x580b13){return cmHopperBlack['checkIsBlackList'](_0x580b13)[_0x5b5d('0x7')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x5b5d('0xc')]=function(_0x49fd3f){return BPromise[_0x5b5d('0x9')]()[_0x5b5d('0xd')](cmHopper['getContactPreview'](_0x49fd3f))[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0xe')));};exports[_0x5b5d('0x6')]=function(_0x15b074,_0x32acef){create(_0x15b074)[_0x5b5d('0x7')](loggerCatch(_0x32acef));moveContact(_0x15b074)[_0x5b5d('0x7')](loggerCatch(_0x32acef));};exports['createAgentHistory']=function(_0x44ccea,_0x27f162){createAgent(_0x44ccea)[_0x5b5d('0x7')](loggerCatch(_0x27f162));};exports['createCustomerHistory']=function(_0x41cdbb,_0x186643){create(_0x41cdbb)[_0x5b5d('0x7')](loggerCatch(_0x186643));};exports[_0x5b5d('0xf')]=function(_0x12d975,_0x5540de){moveContact(_0x12d975)[_0x5b5d('0x7')](loggerCatch(_0x5540de));};exports[_0x5b5d('0x10')]=function(_0x352f7a,_0x209176,_0x473c29){if(_0x209176){_0x352f7a[_0x5b5d('0x11')]=null;}if(_0x473c29){_0x352f7a[_0x5b5d('0x12')]=![];}return cmHopper[_0x5b5d('0x10')](_0x352f7a)[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x13')));};exports['countReScheduled']=function(_0x52ba8a){return cmHopper[_0x5b5d('0x14')](_0x52ba8a)[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x15')));};exports[_0x5b5d('0x16')]=function(_0x52ee70){return cmHopper['unlockContact']({'UserId':null},_0x52ee70,0x1)['catch'](loggerCatch(_0x5b5d('0x17')));};exports[_0x5b5d('0x18')]=function(_0x224557){return cmHopper['unlockContact']({'active':![]},_0x224557,0x1)[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x19')));};exports[_0x5b5d('0x1a')]=function(_0x369a93){var _0x49fbbb={};_0x49fbbb[_0x5b5d('0x1b')]=_0x369a93[_0x5b5d('0x1b')];_0x49fbbb[_0x5b5d('0x1c')]=_0x369a93[_0x5b5d('0x1c')];_0x49fbbb[_0x5b5d('0x1d')]=_0x369a93['calleridnum'];_0x49fbbb[_0x5b5d('0x1e')]=_0x369a93['calleridname'];_0x49fbbb[_0x5b5d('0x1f')]=_0x369a93[_0x5b5d('0x1f')];_0x49fbbb[_0x5b5d('0x20')]=_0x369a93[_0x5b5d('0x21')];_0x49fbbb['queuecallerleaveAt']=_0x369a93[_0x5b5d('0x21')];_0x49fbbb[_0x5b5d('0x22')]=0x1;_0x49fbbb[_0x5b5d('0x23')]=_0x369a93[_0x5b5d('0x24')];_0x49fbbb[_0x5b5d('0x25')]=_0x369a93[_0x5b5d('0x26')];_0x49fbbb[_0x5b5d('0x27')]=_0x5b5d('0x28');_0x49fbbb[_0x5b5d('0x29')]=_0x5b5d('0x2a');_0x49fbbb[_0x5b5d('0x2b')]=0x0;_0x49fbbb[_0x5b5d('0x2c')]=0x1;_0x49fbbb[_0x5b5d('0x2d')]=_0x369a93['membername'];_0x49fbbb[_0x5b5d('0x2e')]='COMPLETED';return BPromise[_0x5b5d('0x9')]()[_0x5b5d('0xd')](voiceQueueReport[_0x5b5d('0x2f')](_0x49fbbb))[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x30')));};exports['getContactRecallMe']=function(_0x52f6c2,_0x2c5244){return BPromise[_0x5b5d('0x9')]()['then'](cmHopper['getContactRecallMe'](_0x52f6c2,_0x2c5244))[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x31')));};exports[_0x5b5d('0x32')]=function(_0x506a21){return cmHopper[_0x5b5d('0x10')](_0x506a21,!![],!![])[_0x5b5d('0x7')](loggerCatch(_0x5b5d('0x33')));}; \ No newline at end of file +var _0x0131=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled'];(function(_0x4db7db,_0x25b95f){var _0x44139b=function(_0x198d16){while(--_0x198d16){_0x4db7db['push'](_0x4db7db['shift']());}};_0x44139b(++_0x25b95f);}(_0x0131,0x160));var _0x1013=function(_0xdeefbd,_0x9e1b3d){_0xdeefbd=_0xdeefbd-0x0;var _0x4ff63f=_0x0131[_0xdeefbd];return _0x4ff63f;};'use strict';var util=require(_0x1013('0x0'));var BPromise=require(_0x1013('0x1'));var logger=require(_0x1013('0x2'))(_0x1013('0x3'));var cmHopper=require(_0x1013('0x4'));var cmHopperHistory=require(_0x1013('0x5'));var cmHopperBlack=require(_0x1013('0x6'));var agentReportPreview=require(_0x1013('0x7'));var voiceQueueReport=require(_0x1013('0x8'));function loggerCatch(_0x4ddb45){return function(_0x425e62){logger['error'](_0x4ddb45,util[_0x1013('0x9')](_0x425e62,{'showHidden':![],'depth':null}));};}function create(_0x52aef2){return cmHopperHistory[_0x1013('0xa')](_0x52aef2)[_0x1013('0xb')](loggerCatch(_0x1013('0xc')));}function createAgent(_0x1bd5b4){return BPromise['resolve']()[_0x1013('0xd')](agentReportPreview[_0x1013('0xa')](_0x1bd5b4))['catch'](loggerCatch(_0x1013('0xc')));}function moveContact(_0x3a327c){return cmHopper[_0x1013('0xe')](_0x3a327c,!![])[_0x1013('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x1013('0xf')]=function(_0x3924e8){return cmHopperBlack[_0x1013('0xf')](_0x3924e8)[_0x1013('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x1013('0x10')]=function(_0x50bb41){return BPromise[_0x1013('0x11')]()[_0x1013('0xd')](cmHopper[_0x1013('0x10')](_0x50bb41))[_0x1013('0xb')](loggerCatch(_0x1013('0x12')));};exports[_0x1013('0xa')]=function(_0x4ba3c1,_0x3faaea){create(_0x4ba3c1)['catch'](loggerCatch(_0x3faaea));moveContact(_0x4ba3c1)['catch'](loggerCatch(_0x3faaea));};exports[_0x1013('0x13')]=function(_0x5c0cc6,_0x36b9ec){createAgent(_0x5c0cc6)[_0x1013('0xb')](loggerCatch(_0x36b9ec));};exports[_0x1013('0x14')]=function(_0x38e00a,_0x2777b6){create(_0x38e00a)[_0x1013('0xb')](loggerCatch(_0x2777b6));};exports['createCustomerFinal']=function(_0x359a49,_0x176c2a){moveContact(_0x359a49)[_0x1013('0xb')](loggerCatch(_0x176c2a));};exports[_0x1013('0x15')]=function(_0x5bf8e9,_0x990d74,_0x4f91f1){if(_0x990d74){_0x5bf8e9[_0x1013('0x16')]=null;}if(_0x4f91f1){_0x5bf8e9[_0x1013('0x17')]=![];}return cmHopper[_0x1013('0x15')](_0x5bf8e9)['catch'](loggerCatch(_0x1013('0x18')));};exports[_0x1013('0x19')]=function(_0x26f66c){return cmHopper[_0x1013('0x19')](_0x26f66c)[_0x1013('0xb')](loggerCatch(_0x1013('0x1a')));};exports[_0x1013('0x1b')]=function(_0x9fd86c){return cmHopper[_0x1013('0x1b')]({'UserId':null},_0x9fd86c,0x1)[_0x1013('0xb')](loggerCatch(_0x1013('0x1c')));};exports[_0x1013('0x1d')]=function(_0x4e376b){return cmHopper[_0x1013('0x1b')]({'active':![]},_0x4e376b,0x1)[_0x1013('0xb')](loggerCatch('[activeContact]\x20'));};exports[_0x1013('0x1e')]=function(_0x312274){var _0xbac899={};_0xbac899[_0x1013('0x1f')]=_0x312274[_0x1013('0x1f')];_0xbac899['uniqueid']=_0x312274[_0x1013('0x20')];_0xbac899[_0x1013('0x21')]=_0x312274[_0x1013('0x21')];_0xbac899[_0x1013('0x22')]=_0x312274[_0x1013('0x22')];_0xbac899['queue']=_0x312274[_0x1013('0x23')];_0xbac899[_0x1013('0x24')]=_0x312274[_0x1013('0x25')];_0xbac899[_0x1013('0x26')]=_0x312274['answertime'];_0xbac899[_0x1013('0x27')]=0x1;_0xbac899[_0x1013('0x28')]=_0x312274[_0x1013('0x29')];_0xbac899[_0x1013('0x2a')]=_0x312274['membername'];_0xbac899['context']='from-sip';_0xbac899['exten']=_0x1013('0x2b');_0xbac899[_0x1013('0x2c')]=0x0;_0xbac899['assigned']=0x1;_0xbac899[_0x1013('0x2d')]=_0x312274['membername'];_0xbac899[_0x1013('0x2e')]=_0x1013('0x2f');return BPromise['resolve']()[_0x1013('0xd')](voiceQueueReport[_0x1013('0x30')](_0xbac899))[_0x1013('0xb')](loggerCatch(_0x1013('0x31')));};exports[_0x1013('0x32')]=function(_0x5ab329,_0x2efd2f){return BPromise['resolve']()['then'](cmHopper[_0x1013('0x32')](_0x5ab329,_0x2efd2f))['catch'](loggerCatch(_0x1013('0x33')));};exports[_0x1013('0x34')]=function(_0x217e3d){return cmHopper['rescheduleContact'](_0x217e3d,!![],!![])[_0x1013('0xb')](loggerCatch(_0x1013('0x35')));}; \ 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 11bc74c..0b17559 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 _0xcc30=['totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','ListId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','interface','mandatoryDisposition','buildObj','queue','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','type','dialAnswer','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','logger','info','inspect','error','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','isActive','isNil','Queue','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','logAgent','getSeconds','logLookAgent','membername','UserId','logCustomer','endtime','ringtime','answertime','Failure','variablesAction','calleridname','uniqueid','originate','channelAgent','calleridnum','from-sip','timeout'];(function(_0x44bd3a,_0x2d3b79){var _0x1ed9d6=function(_0x159880){while(--_0x159880){_0x44bd3a['push'](_0x44bd3a['shift']());}};_0x1ed9d6(++_0x2d3b79);}(_0xcc30,0xcd));var _0x0cc3=function(_0x2cc711,_0x300328){_0x2cc711=_0x2cc711-0x0;var _0x31a52e=_0xcc30[_0x2cc711];return _0x31a52e;};'use strict';var util=require(_0x0cc3('0x0'));var _=require(_0x0cc3('0x1'));var moment=require(_0x0cc3('0x2'));var logger=require(_0x0cc3('0x3'))(_0x0cc3('0x4'));var ipAgi=process[_0x0cc3('0x5')][_0x0cc3('0x6')]||_0x0cc3('0x7');var utils=require(_0x0cc3('0x8'));exports[_0x0cc3('0x9')]=function(_0x34a579){return function(_0x58af23){logger['error'](_0x34a579,util['inspect'](_0x58af23,{'showHidden':![],'depth':null}));};};exports[_0x0cc3('0xa')]=function(_0x225cab,_0x3015de){logger[_0x0cc3('0xb')](_0x225cab,util[_0x0cc3('0xc')](_0x3015de,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x377f32,_0x5958aa){logger[_0x0cc3('0xd')](_0x377f32,util[_0x0cc3('0xc')](_0x5958aa,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x4519fb){return function(_0x398fba){logger['info'](_0x4519fb,util['inspect'](_0x398fba,{'showHidden':![],'depth':null}));};};exports[_0x0cc3('0xe')]=function(_0x19a0cc,_0x9cc817,_0x496174){return{'message':_0x19a0cc,'unlock':_0x9cc817,'active':_0x496174};};exports[_0x0cc3('0xf')]=function(_0x13f0d8,_0xee3ed2,_0x3fd5c6){if(!_[_0x0cc3('0x10')](_0x3fd5c6)&&_0x0cc3('0x11')===typeof _0x3fd5c6&&!_[_0x0cc3('0x12')](_0x3fd5c6)){if(!_[_0x0cc3('0x10')](_0xee3ed2)&&_0x0cc3('0x11')===typeof _0xee3ed2&&!_['isEmpty'](_0xee3ed2)){return util['format'](_0x0cc3('0x13'),_0xee3ed2,_0x3fd5c6);}return util[_0x0cc3('0x14')]('\x22%s\x22\x20<%s>',_0x3fd5c6,_0x3fd5c6);}if(!_[_0x0cc3('0x10')](_0x13f0d8)&&'string'===typeof _0x13f0d8&&!_['isEmpty'](_0x13f0d8)){return _0x13f0d8;}return'\x22\x22\x20<>';};exports[_0x0cc3('0x15')]=function(_0x5c1898){if(_[_0x0cc3('0x16')](_0x5c1898)){return![];}return _0x5c1898;};exports['addVariables']=function(_0x14a8d9,_0x3d004c,_0x17df4a,_0x54ca94,_0x1581fd,_0x526111){var _0x3acefb={'XMD-QUEUE':_0x3d004c[_0x0cc3('0x17')]?_0x3d004c['Queue']['name']:'','XMD-CALLERID':_0x54ca94,'XMD-CALLERID-PREVIEW':_0x526111?util[_0x0cc3('0x14')](_0x0cc3('0x13'),_0x526111['calleridname'],_0x526111['calleridnum']):_0x54ca94,'XMD-DIALID':_0x1581fd,'XMD-CONTACTID':_0x3d004c[_0x0cc3('0x18')],'XMD-CDRTYPE':_0x0cc3('0x19'),'CALLERID(all)':_0x54ca94,'XMD-VOICEQUEUEID':_0x3d004c[_0x0cc3('0x1a')],'XMD-DIALCHANNEL':_0x17df4a,'XMD-DIALTIMEOUT':_0x14a8d9[_0x0cc3('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x0cc3('0x14')](_0x0cc3('0x1c'),_0x14a8d9[_0x0cc3('0x1d')]?'g':'',_[_0x0cc3('0x12')](_0x14a8d9[_0x0cc3('0x1e')])?'':_0x0cc3('0x1f')),'XMD-DIALURL':_0x14a8d9['dialPreviewUrl']||'','XMD-AGI':_0x14a8d9[_0x0cc3('0x20')]?util[_0x0cc3('0x14')](_0x0cc3('0x21'),ipAgi,_0x14a8d9[_0x0cc3('0x20')]):_0x0cc3('0x22'),'XMD-AGIAFTER':_0x14a8d9[_0x0cc3('0x1d')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x14a8d9['dialQueueProject2']):_0x0cc3('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x526111?_0x526111[_0x0cc3('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x526111?_0x526111['originatecalleridname']:'','XMD-DESTINATION':_0x0cc3('0x24'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x0cc3('0x12')](_0x14a8d9['monitor_format'])){_0x3acefb[util[_0x0cc3('0x14')]('%s',_0x0cc3('0x25'))]=_0x14a8d9[_0x0cc3('0x1e')];_0x3acefb[util['format']('%s',_0x0cc3('0x26'))]=_0x1581fd;}return _0x3acefb;};exports[_0x0cc3('0x27')]=function(_0x3004f6){var _0x54e7b0={};for(var _0x2fff67 in _0x3004f6){if(_0x3004f6[_0x0cc3('0x28')](_0x2fff67)){_0x54e7b0[util[_0x0cc3('0x14')]('%s',_[_0x0cc3('0x29')](_0x2fff67))]=_0x3004f6[_0x2fff67];}}return{'variables':_0x54e7b0};};exports['updateOriginated']=function(_0x20ad34,_0x4b1dc8){if(!_[_0x0cc3('0x16')](_0x20ad34)){if(_0x20ad34['hasOwnProperty'](_0x0cc3('0x2a'))){if(_0x20ad34[_0x0cc3('0x2a')]>0x0){_0x20ad34[_0x0cc3('0x2a')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4b1dc8);}}}else{logger[_0x0cc3('0xd')](_0x0cc3('0x2b'),_0x4b1dc8);}};exports[_0x0cc3('0x2c')]=function(_0x292560){var _0x5a07bb=moment()['format'](_0x0cc3('0x2d'));_0x292560[_0x0cc3('0x2e')]=0xd;_0x292560[_0x0cc3('0x2f')]=_0x0cc3('0x30');_0x292560[_0x0cc3('0x31')]=_0x5a07bb;_0x292560[_0x0cc3('0x32')]=_0x5a07bb;_0x292560['endtime']=_0x5a07bb;};exports[_0x0cc3('0x33')]=function(_0x1ec48d,_0x48ec90,_0x453fd5){var _0x20f210=moment()[_0x0cc3('0x14')](_0x0cc3('0x2d'));_0x1ec48d[_0x0cc3('0x2e')]=_0x48ec90;_0x1ec48d['statedesc']=_0x453fd5;_0x1ec48d['responsetime']=_0x20f210;_0x1ec48d['ringtime']=utils[_0x0cc3('0x34')](_0x1ec48d[_0x0cc3('0x32')],_0x1ec48d[_0x0cc3('0x31')]);};exports[_0x0cc3('0x35')]=function(_0x52b00b,_0xedd715,_0x57ca7a){_0x52b00b[_0x0cc3('0x36')]=_0xedd715;_0x52b00b[_0x0cc3('0x37')]=_0x57ca7a;};exports[_0x0cc3('0x38')]=function(_0x3eba9a,_0x3d2e00,_0x530793){var _0x4eea9f=moment()['format'](_0x0cc3('0x2d'));_0x3eba9a[_0x0cc3('0x2e')]=_0x3d2e00;_0x3eba9a[_0x0cc3('0x2f')]=_0x530793;_0x3eba9a[_0x0cc3('0x32')]=_0x3eba9a['responsetime']?_0x3eba9a['responsetime']:_0x4eea9f;_0x3eba9a[_0x0cc3('0x39')]=_0x3eba9a[_0x0cc3('0x39')]?_0x3eba9a[_0x0cc3('0x39')]:_0x4eea9f;_0x3eba9a[_0x0cc3('0x3a')]=utils[_0x0cc3('0x34')](_0x3eba9a[_0x0cc3('0x32')]||0x0,_0x3eba9a['starttime']||0x0);_0x3eba9a['talktime']=_0x3eba9a[_0x0cc3('0x3b')]?utils[_0x0cc3('0x34')](_0x3eba9a[_0x0cc3('0x39')],_0x3eba9a[_0x0cc3('0x3b')]):0x0;};exports['isFailure']=function(_0x2d1768){return _0x2d1768===_0x0cc3('0x3c');};exports[_0x0cc3('0x3d')]=function(_0x3999b1,_0x59db8f,_0x467ed0,_0x4abd35,_0x154ce9){var _0x5db511=_0x4abd35?'RECALL':_0x3999b1[_0x0cc3('0x3e')];_0x5db511=_0x154ce9?'BOOKED':_0x5db511;return{'actionid':_0x3999b1[_0x0cc3('0x3f')],'action':_0x0cc3('0x40'),'channel':_0x3999b1[_0x0cc3('0x41')],'callerid':util['format'](_0x0cc3('0x13'),_0x5db511,_0x3999b1[_0x0cc3('0x42')]),'Exten':'xcally-motion-preview','Context':_0x0cc3('0x43'),'Priority':'1','variable':_0x467ed0,'timeout':(_0x59db8f[_0x0cc3('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3999b1[_0x0cc3('0x3f')]};};exports[_0x0cc3('0x45')]=function(_0x3aea3e){return _0x3aea3e[_0x0cc3('0x46')]+_0x3aea3e[_0x0cc3('0x47')]+_0x3aea3e[_0x0cc3('0x48')]+_0x3aea3e[_0x0cc3('0x49')]+_0x3aea3e[_0x0cc3('0x4a')];};exports[_0x0cc3('0x4b')]=function(_0x96ba4b){var _0x17f42d=_[_0x0cc3('0x4c')](_0x96ba4b);_0x17f42d[_0x0cc3('0x2e')]=0xf;_0x17f42d['statedesc']=_0x0cc3('0x4d');return _0x17f42d;};exports['scheduledAt']=function(_0x5b3125,_0x160106,_0x142c25){var _0x5eb070={};_0x5eb070[_0x160106]=_0x5b3125[_0x160106];_0x5eb070[_0x0cc3('0x4e')]=![];_0x5eb070[_0x0cc3('0x4f')]=moment()[_0x0cc3('0x50')](_0x142c25,'minutes')[_0x0cc3('0x14')]('YYYY-MM-DD\x20HH:mm:ss');_0x5eb070[_0x0cc3('0x18')]=_0x5b3125['ContactId'];_0x5eb070[_0x0cc3('0x51')]=_0x5b3125['ListId'];_0x5eb070['VoiceQueueId']=_0x5b3125[_0x0cc3('0x1a')]||undefined;return _0x5eb070;};exports['decrementTalkink']=function(_0x35931f,_0x5bcff5){if(!_[_0x0cc3('0x16')](_0x35931f)){if(_0x35931f[_0x0cc3('0x52')]>0x0){_0x35931f[_0x0cc3('0x52')]-=0x1;}else{logger[_0x0cc3('0xd')](_0x5bcff5,_0x0cc3('0x53'));}}else{logger['error'](_0x5bcff5,_0x0cc3('0x54'));}};exports[_0x0cc3('0x55')]=function(_0x111371){if(_0x111371<=0x0){return!![];}return![];};function buildObj(_0x821f2,_0x24b6eb,_0x59d548){_0x821f2[_0x0cc3('0x56')]=_0x24b6eb;_0x821f2[_0x0cc3('0x57')]=_0x821f2['queue'];_0x821f2[_0x0cc3('0x58')]=_0x821f2[_0x0cc3('0x41')];_0x821f2['motionChannel']='voice';if(_0x59d548){_0x821f2[_0x0cc3('0x59')]=_0x59d548['mandatoryDisposition'];}return _0x821f2;}exports[_0x0cc3('0x5a')]=buildObj;exports['buildAcw']=function(_0x6786a1){var _0x2a1b8d={};_0x2a1b8d[_0x0cc3('0x5b')]=_0x6786a1[_0x0cc3('0x5b')];_0x2a1b8d[_0x0cc3('0x58')]=_0x6786a1[_0x0cc3('0x41')];_0x2a1b8d[_0x0cc3('0x3f')]=_0x6786a1['uniqueid'];return _0x2a1b8d;};exports[_0x0cc3('0x5c')]=function(_0x46f4ef){var _0x44a982=[];for(var _0x5624ca in _0x46f4ef){if(_0x46f4ef[_0x0cc3('0x28')](_0x5624ca)){if(!_[_0x0cc3('0x16')](_0x46f4ef[_0x5624ca])&&_0x46f4ef[_0x5624ca][_0x0cc3('0x2e')]===_0x0cc3('0x5d')&&_0x46f4ef[_0x5624ca]['status']===_0x0cc3('0x5e')){_0x44a982[_0x0cc3('0x5f')](_0x46f4ef[_0x5624ca]['id']);}}}return _0x44a982;};exports[_0x0cc3('0x60')]=function(_0x13c266){var _0x4176e3=moment()[_0x0cc3('0x61')](0x0);var _0x5cb08f=moment(_0x13c266)['milliseconds'](0x0);return _0x4176e3[_0x0cc3('0x62')](_0x5cb08f,_0x0cc3('0x63'));};exports[_0x0cc3('0x64')]=function(_0x58ac31){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x58ac31['ContactId'],'ListId':_0x58ac31['ListId'],'VoiceQueueId':_0x58ac31[_0x0cc3('0x1a')]||undefined,'CampaignId':_0x58ac31[_0x0cc3('0x65')]||undefined};};exports[_0x0cc3('0x66')]=function(_0x419202){if(_0x419202===_0x0cc3('0x3f')||_0x419202==='idContact'||_0x419202===_0x0cc3('0x5b')||_0x419202===_0x0cc3('0x67')||_0x419202==='campaigntype'||_0x419202===_0x0cc3('0x68')||_0x419202==='membername'||_0x419202==='channelAgent'||_0x419202===_0x0cc3('0x3e')||_0x419202==='active'||_0x419202==='calleridnum'||_0x419202===_0x0cc3('0x4f')||_0x419202===_0x0cc3('0x46')||_0x419202===_0x0cc3('0x47')||_0x419202===_0x0cc3('0x48')||_0x419202===_0x0cc3('0x69')||_0x419202===_0x0cc3('0x6a')||_0x419202===_0x0cc3('0x6b')||_0x419202==='callbackat'||_0x419202===_0x0cc3('0x6c')||_0x419202==='ContactId'||_0x419202==='ListId'||_0x419202===_0x0cc3('0x37')||_0x419202===_0x0cc3('0x1a')||_0x419202===_0x0cc3('0x6d')||_0x419202===_0x0cc3('0x6e')||_0x419202===_0x0cc3('0x6f')||_0x419202==='xmd-phone'||_0x419202==='xmd-listid'||_0x419202==='xmd-dialurl'||_0x419202===_0x0cc3('0x70')||_0x419202===_0x0cc3('0x71')||_0x419202===_0x0cc3('0x72')||_0x419202===_0x0cc3('0x73')||_0x419202==='xmd-contactid'||_0x419202===_0x0cc3('0x74')||_0x419202==='xmd-callerid'||_0x419202===_0x0cc3('0x75')||_0x419202==='xmd-agi'||_0x419202===_0x0cc3('0x76')||_0x419202===_0x0cc3('0x77')||_0x419202===_0x0cc3('0x78')||_0x419202===_0x0cc3('0x79')||_0x419202==='rtpaudioqosloss'||_0x419202===_0x0cc3('0x7a')||_0x419202===_0x0cc3('0x7b')||_0x419202===_0x0cc3('0x7c')||_0x419202===_0x0cc3('0x76')||_0x419202===_0x0cc3('0x77')||_0x419202===_0x0cc3('0x78')||_0x419202===_0x0cc3('0x79')||_0x419202===_0x0cc3('0x7d')||_0x419202===_0x0cc3('0x7a')||_0x419202===_0x0cc3('0x7b')||_0x419202===_0x0cc3('0x7c')||_0x419202===_0x0cc3('0x7e')||_0x419202==='bridgepvtcallid'||_0x419202===_0x0cc3('0x2e')||_0x419202==='statedesc'){return![];}return!![];};exports[_0x0cc3('0x7f')]=function(_0x27e75c,_0x2c3fce){var _0xc95ae9,_0xe41f82,_0x49cc8f;if(_0x2c3fce<=0x0){_0x2c3fce=0x1;}_0xc95ae9=new RegExp(_0x0cc3('0x80')+_0x2c3fce+'}$');_0xe41f82=Math[_0x0cc3('0x81')](0xa,_0x2c3fce-0x1);_0x49cc8f=Math['pow'](0xa,_0x2c3fce)-0x1;return util[_0x0cc3('0x14')]('%s',_['replace'](_0x27e75c,_0xc95ae9,_['random'](_0xe41f82,_0x49cc8f)));};exports[_0x0cc3('0x82')]=function(_0x411fa6){var _0x595720=_0x411fa6[_0x0cc3('0x83')](/"(.*?)"/);return _0x595720?_0x595720[0x1]:_0x411fa6;};exports[_0x0cc3('0x84')]=function(_0x110382){var _0x5c859d=_0x110382['match'](/<(.*?)>/);return _0x5c859d?_0x5c859d[0x1]:_0x110382;};function buildNoAnswerEventPayload(_0x257977,_0x38e6c7){var _0xab9b3e=buildObj(_0x257977,_0x0cc3('0x85'));if(!_[_0x0cc3('0x12')](_0x38e6c7[_0x0cc3('0x86')])){Object[_0x0cc3('0x87')](_0x38e6c7['variables'])[_0x0cc3('0x88')](function(_0x36de15){_0xab9b3e[_0x36de15['toLowerCase']()]=_0x38e6c7[_0x0cc3('0x86')][_0x36de15];});}return _0xab9b3e;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x36b0=['buildNoAnswerEventPayload','lodash','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','loggerCatch','inspect','logger','info','loggerError','error','logger2','message','string','isEmpty','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','name','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','logLookAgent','membername','logCustomer','starttime','talktime','answertime','variablesAction','RECALL','uniqueid','channelAgent','from-sip','timeout','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','active','scheduledat','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','agentReadyId','status','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackat','UserId','sipcallid','xmd-phone','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase'];(function(_0x2a609e,_0x21a49f){var _0x35589c=function(_0x654ded){while(--_0x654ded){_0x2a609e['push'](_0x2a609e['shift']());}};_0x35589c(++_0x21a49f);}(_0x36b0,0x1b4));var _0x036b=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x36b0[_0x16d10f];return _0x50c823;};'use strict';var util=require('util');var _=require(_0x036b('0x0'));var moment=require(_0x036b('0x1'));var logger=require(_0x036b('0x2'))(_0x036b('0x3'));var ipAgi=process[_0x036b('0x4')]['XCALLY_IP_AGI']||_0x036b('0x5');var utils=require(_0x036b('0x6'));exports[_0x036b('0x7')]=function(_0x5bd6a8){return function(_0x5385cb){logger['error'](_0x5bd6a8,util[_0x036b('0x8')](_0x5385cb,{'showHidden':![],'depth':null}));};};exports[_0x036b('0x9')]=function(_0x37aae9,_0x16d174){logger[_0x036b('0xa')](_0x37aae9,util[_0x036b('0x8')](_0x16d174,{'showHidden':![],'depth':null}));};exports[_0x036b('0xb')]=function(_0x4da6ed,_0x221ae5){logger[_0x036b('0xc')](_0x4da6ed,util[_0x036b('0x8')](_0x221ae5,{'showHidden':![],'depth':null}));};exports[_0x036b('0xd')]=function(_0x50287f){return function(_0x55bc65){logger[_0x036b('0xa')](_0x50287f,util[_0x036b('0x8')](_0x55bc65,{'showHidden':![],'depth':null}));};};exports[_0x036b('0xe')]=function(_0x48b5b7,_0x37fe26,_0x305bb7){return{'message':_0x48b5b7,'unlock':_0x37fe26,'active':_0x305bb7};};exports['getCallerId']=function(_0x2c5986,_0x172792,_0x138a7e){if(!_['isUndefined'](_0x138a7e)&&_0x036b('0xf')===typeof _0x138a7e&&!_[_0x036b('0x10')](_0x138a7e)){if(!_[_0x036b('0x11')](_0x172792)&&'string'===typeof _0x172792&&!_[_0x036b('0x10')](_0x172792)){return util[_0x036b('0x12')](_0x036b('0x13'),_0x172792,_0x138a7e);}return util['format'](_0x036b('0x13'),_0x138a7e,_0x138a7e);}if(!_[_0x036b('0x11')](_0x2c5986)&&_0x036b('0xf')===typeof _0x2c5986&&!_[_0x036b('0x10')](_0x2c5986)){return _0x2c5986;}return _0x036b('0x14');};exports[_0x036b('0x15')]=function(_0x4c095c){if(_[_0x036b('0x16')](_0x4c095c)){return![];}return _0x4c095c;};exports[_0x036b('0x17')]=function(_0xb692f0,_0x4119e9,_0x1cf6d4,_0x5989a9,_0x221ce8,_0x4fc2be){var _0xc87707={'XMD-QUEUE':_0x4119e9['Queue']?_0x4119e9['Queue'][_0x036b('0x18')]:'','XMD-CALLERID':_0x5989a9,'XMD-CALLERID-PREVIEW':_0x4fc2be?util['format'](_0x036b('0x13'),_0x4fc2be['calleridname'],_0x4fc2be[_0x036b('0x19')]):_0x5989a9,'XMD-DIALID':_0x221ce8,'XMD-CONTACTID':_0x4119e9['ContactId'],'XMD-CDRTYPE':_0x036b('0x1a'),'CALLERID(all)':_0x5989a9,'XMD-VOICEQUEUEID':_0x4119e9[_0x036b('0x1b')],'XMD-DIALCHANNEL':_0x1cf6d4,'XMD-DIALTIMEOUT':_0xb692f0[_0x036b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x036b('0x1d'),_0xb692f0[_0x036b('0x1e')]?'g':'',_[_0x036b('0x10')](_0xb692f0[_0x036b('0x1f')])?'':_0x036b('0x20')),'XMD-DIALURL':_0xb692f0[_0x036b('0x21')]||'','XMD-AGI':_0xb692f0[_0x036b('0x22')]?util['format'](_0x036b('0x23'),ipAgi,_0xb692f0[_0x036b('0x22')]):_0x036b('0x24'),'XMD-AGIAFTER':_0xb692f0[_0x036b('0x1e')]?util[_0x036b('0x12')](_0x036b('0x23'),ipAgi,_0xb692f0[_0x036b('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4fc2be?_0x4fc2be[_0x036b('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x4fc2be?_0x4fc2be[_0x036b('0x26')]:'','XMD-DESTINATION':_0x036b('0x27'),'SIPADDHEADER':_0x036b('0x28')};if(!_[_0x036b('0x10')](_0xb692f0[_0x036b('0x1f')])){_0xc87707[util[_0x036b('0x12')]('%s',_0x036b('0x29'))]=_0xb692f0[_0x036b('0x1f')];_0xc87707[util[_0x036b('0x12')]('%s',_0x036b('0x2a'))]=_0x221ce8;}return _0xc87707;};exports[_0x036b('0x2b')]=function(_0x4b4c82){var _0x41afa0={};for(var _0x562fe4 in _0x4b4c82){if(_0x4b4c82[_0x036b('0x2c')](_0x562fe4)){_0x41afa0[util[_0x036b('0x12')]('%s',_[_0x036b('0x2d')](_0x562fe4))]=_0x4b4c82[_0x562fe4];}}return{'variables':_0x41afa0};};exports['updateOriginated']=function(_0x25b404,_0x4f19ac){if(!_[_0x036b('0x16')](_0x25b404)){if(_0x25b404[_0x036b('0x2c')](_0x036b('0x2e'))){if(_0x25b404['originated']>0x0){_0x25b404[_0x036b('0x2e')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x4f19ac);}}}else{logger[_0x036b('0xc')](_0x036b('0x2f'),_0x4f19ac);}};exports[_0x036b('0x30')]=function(_0x2de7f0){var _0x421c44=moment()[_0x036b('0x12')](_0x036b('0x31'));_0x2de7f0[_0x036b('0x32')]=0xd;_0x2de7f0['statedesc']='Blacklist';_0x2de7f0['starttime']=_0x421c44;_0x2de7f0[_0x036b('0x33')]=_0x421c44;_0x2de7f0[_0x036b('0x34')]=_0x421c44;};exports[_0x036b('0x35')]=function(_0x3706de,_0xafdfa5,_0x18f6b1){var _0x13d158=moment()[_0x036b('0x12')](_0x036b('0x31'));_0x3706de['state']=_0xafdfa5;_0x3706de[_0x036b('0x36')]=_0x18f6b1;_0x3706de[_0x036b('0x33')]=_0x13d158;_0x3706de[_0x036b('0x37')]=utils[_0x036b('0x38')](_0x3706de['responsetime'],_0x3706de['starttime']);};exports[_0x036b('0x39')]=function(_0x133839,_0x2f09ed,_0x5a8e10){_0x133839[_0x036b('0x3a')]=_0x2f09ed;_0x133839['UserId']=_0x5a8e10;};exports[_0x036b('0x3b')]=function(_0x19d72a,_0x2068ca,_0x5d3331){var _0x42ebaf=moment()[_0x036b('0x12')](_0x036b('0x31'));_0x19d72a['state']=_0x2068ca;_0x19d72a[_0x036b('0x36')]=_0x5d3331;_0x19d72a['responsetime']=_0x19d72a[_0x036b('0x33')]?_0x19d72a[_0x036b('0x33')]:_0x42ebaf;_0x19d72a[_0x036b('0x34')]=_0x19d72a[_0x036b('0x34')]?_0x19d72a[_0x036b('0x34')]:_0x42ebaf;_0x19d72a['ringtime']=utils[_0x036b('0x38')](_0x19d72a['responsetime']||0x0,_0x19d72a[_0x036b('0x3c')]||0x0);_0x19d72a[_0x036b('0x3d')]=_0x19d72a[_0x036b('0x3e')]?utils[_0x036b('0x38')](_0x19d72a[_0x036b('0x34')],_0x19d72a['answertime']):0x0;};exports['isFailure']=function(_0x14500d){return _0x14500d==='Failure';};exports[_0x036b('0x3f')]=function(_0x153d57,_0x2500c5,_0x4e922c,_0xcb41b2,_0x467733){var _0x272640=_0xcb41b2?_0x036b('0x40'):_0x153d57['calleridname'];_0x272640=_0x467733?'BOOKED':_0x272640;return{'actionid':_0x153d57[_0x036b('0x41')],'action':'originate','channel':_0x153d57[_0x036b('0x42')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x272640,_0x153d57[_0x036b('0x19')]),'Exten':_0x036b('0x27'),'Context':_0x036b('0x43'),'Priority':'1','variable':_0x4e922c,'timeout':(_0x2500c5[_0x036b('0x44')]||0x1e)*0x3e8,'async':!![],'channelid':_0x153d57[_0x036b('0x41')]};};exports[_0x036b('0x45')]=function(_0x106957){return _0x106957['countbusyretry']+_0x106957[_0x036b('0x46')]+_0x106957[_0x036b('0x47')]+_0x106957[_0x036b('0x48')]+_0x106957[_0x036b('0x49')];};exports[_0x036b('0x4a')]=function(_0x482629){var _0x32b645=_[_0x036b('0x4b')](_0x482629);_0x32b645['state']=0xf;_0x32b645['statedesc']=_0x036b('0x4c');return _0x32b645;};exports['scheduledAt']=function(_0xd50986,_0x1021b2,_0x39dd24){var _0x54c44e={};_0x54c44e[_0x1021b2]=_0xd50986[_0x1021b2];_0x54c44e[_0x036b('0x4d')]=![];_0x54c44e[_0x036b('0x4e')]=moment()[_0x036b('0x4f')](_0x39dd24,_0x036b('0x50'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x54c44e['ContactId']=_0xd50986[_0x036b('0x51')];_0x54c44e[_0x036b('0x52')]=_0xd50986['ListId'];_0x54c44e[_0x036b('0x1b')]=_0xd50986[_0x036b('0x1b')]||undefined;return _0x54c44e;};exports[_0x036b('0x53')]=function(_0x250b6a,_0x1039f3){if(!_['isNil'](_0x250b6a)){if(_0x250b6a[_0x036b('0x54')]>0x0){_0x250b6a[_0x036b('0x54')]-=0x1;}else{logger[_0x036b('0xc')](_0x1039f3,_0x036b('0x55'));}}else{logger['error'](_0x1039f3,_0x036b('0x56'));}};exports[_0x036b('0x57')]=function(_0x565be3){if(_0x565be3<=0x0){return!![];}return![];};function buildObj(_0x5723fe,_0xfb43f7,_0xa6e49e){_0x5723fe['lastevent']=_0xfb43f7;_0x5723fe[_0x036b('0x18')]=_0x5723fe[_0x036b('0x58')];_0x5723fe[_0x036b('0x59')]=_0x5723fe[_0x036b('0x42')];_0x5723fe[_0x036b('0x5a')]=_0x036b('0x5b');if(_0xa6e49e){_0x5723fe[_0x036b('0x5c')]=_0xa6e49e[_0x036b('0x5c')];}return _0x5723fe;}exports[_0x036b('0x5d')]=buildObj;exports[_0x036b('0x5e')]=function(_0x282d81){var _0x5e3814={};_0x5e3814['queue']=_0x282d81[_0x036b('0x58')];_0x5e3814[_0x036b('0x59')]=_0x282d81[_0x036b('0x42')];_0x5e3814['uniqueid']=_0x282d81['uniqueid'];return _0x5e3814;};exports[_0x036b('0x5f')]=function(_0x1e3a4d){var _0x4c3a22=[];for(var _0xa2b608 in _0x1e3a4d){if(_0x1e3a4d['hasOwnProperty'](_0xa2b608)){if(!_[_0x036b('0x16')](_0x1e3a4d[_0xa2b608])&&_0x1e3a4d[_0xa2b608][_0x036b('0x32')]==='not_inuse'&&_0x1e3a4d[_0xa2b608][_0x036b('0x60')]==='reachable'){_0x4c3a22[_0x036b('0x61')](_0x1e3a4d[_0xa2b608]['id']);}}}return _0x4c3a22;};exports[_0x036b('0x62')]=function(_0xf881d8){var _0x5a5545=moment()[_0x036b('0x63')](0x0);var _0x5af39a=moment(_0xf881d8)[_0x036b('0x63')](0x0);return _0x5a5545[_0x036b('0x64')](_0x5af39a,_0x036b('0x65'));};exports[_0x036b('0x66')]=function(_0x30224b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x30224b[_0x036b('0x51')],'ListId':_0x30224b[_0x036b('0x52')],'VoiceQueueId':_0x30224b[_0x036b('0x1b')]||undefined,'CampaignId':_0x30224b[_0x036b('0x67')]||undefined};};exports[_0x036b('0x68')]=function(_0x31bd69){if(_0x31bd69===_0x036b('0x41')||_0x31bd69===_0x036b('0x69')||_0x31bd69==='queue'||_0x31bd69===_0x036b('0x6a')||_0x31bd69===_0x036b('0x6b')||_0x31bd69===_0x036b('0x6c')||_0x31bd69===_0x036b('0x3a')||_0x31bd69==='channelAgent'||_0x31bd69==='calleridname'||_0x31bd69==='active'||_0x31bd69===_0x036b('0x19')||_0x31bd69==='scheduledat'||_0x31bd69==='countbusyretry'||_0x31bd69==='countcongestionretry'||_0x31bd69===_0x036b('0x47')||_0x31bd69===_0x036b('0x6d')||_0x31bd69===_0x036b('0x6e')||_0x31bd69==='callbackuniqueid'||_0x31bd69===_0x036b('0x6f')||_0x31bd69==='recallme'||_0x31bd69===_0x036b('0x51')||_0x31bd69===_0x036b('0x52')||_0x31bd69===_0x036b('0x70')||_0x31bd69==='VoiceQueueId'||_0x31bd69===_0x036b('0x71')||_0x31bd69==='xmd-voicequeueid'||_0x31bd69==='xmd-queue'||_0x31bd69===_0x036b('0x72')||_0x31bd69==='xmd-listid'||_0x31bd69===_0x036b('0x73')||_0x31bd69==='xmd-dialtimeout'||_0x31bd69===_0x036b('0x74')||_0x31bd69==='xmd-dialid'||_0x31bd69===_0x036b('0x75')||_0x31bd69===_0x036b('0x76')||_0x31bd69==='xmd-cdrtype'||_0x31bd69===_0x036b('0x77')||_0x31bd69===_0x036b('0x78')||_0x31bd69===_0x036b('0x79')||_0x31bd69===_0x036b('0x7a')||_0x31bd69===_0x036b('0x7b')||_0x31bd69===_0x036b('0x7c')||_0x31bd69===_0x036b('0x7d')||_0x31bd69==='rtpaudioqosloss'||_0x31bd69==='rtpaudioqoslossbridged'||_0x31bd69===_0x036b('0x7e')||_0x31bd69==='rtpaudioqosrttbridged'||_0x31bd69==='rtpaudioqos'||_0x31bd69===_0x036b('0x7b')||_0x31bd69===_0x036b('0x7c')||_0x31bd69===_0x036b('0x7d')||_0x31bd69===_0x036b('0x7f')||_0x31bd69===_0x036b('0x80')||_0x31bd69==='rtpaudioqosrtt'||_0x31bd69==='rtpaudioqosrttbridged'||_0x31bd69===_0x036b('0x81')||_0x31bd69===_0x036b('0x82')||_0x31bd69===_0x036b('0x32')||_0x31bd69===_0x036b('0x36')){return![];}return!![];};exports[_0x036b('0x83')]=function(_0x370ce0,_0xa8d0d6){var _0x62c7ea,_0x305131,_0x4592cb;if(_0xa8d0d6<=0x0){_0xa8d0d6=0x1;}_0x62c7ea=new RegExp(_0x036b('0x84')+_0xa8d0d6+'}$');_0x305131=Math[_0x036b('0x85')](0xa,_0xa8d0d6-0x1);_0x4592cb=Math[_0x036b('0x85')](0xa,_0xa8d0d6)-0x1;return util['format']('%s',_[_0x036b('0x86')](_0x370ce0,_0x62c7ea,_[_0x036b('0x87')](_0x305131,_0x4592cb)));};exports[_0x036b('0x88')]=function(_0x211aaf){var _0x1e55fe=_0x211aaf[_0x036b('0x89')](/"(.*?)"/);return _0x1e55fe?_0x1e55fe[0x1]:_0x211aaf;};exports[_0x036b('0x8a')]=function(_0x57b5c3){var _0x30bf33=_0x57b5c3['match'](/<(.*?)>/);return _0x30bf33?_0x30bf33[0x1]:_0x57b5c3;};function buildNoAnswerEventPayload(_0x3e1884,_0x373358){var _0x3d8304=buildObj(_0x3e1884,_0x036b('0x8b'));if(!_[_0x036b('0x10')](_0x373358[_0x036b('0x8c')])){Object[_0x036b('0x8d')](_0x373358[_0x036b('0x8c')])[_0x036b('0x8e')](function(_0x595f93){_0x3d8304[_0x595f93[_0x036b('0x8f')]()]=_0x373358[_0x036b('0x8c')][_0x595f93];});}return _0x3d8304;}exports[_0x036b('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 45dfce5..b8ff60f 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 _0x06e3=['number','queueremove','queuepause','boolean','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x14a12c,_0x28026f){var _0x5038bc=function(_0x170702){while(--_0x170702){_0x14a12c['push'](_0x14a12c['shift']());}};_0x5038bc(++_0x28026f);}(_0x06e3,0x7c));var _0x306e=function(_0x537889,_0x15150f){_0x537889=_0x537889-0x0;var _0x127c2f=_0x06e3[_0x537889];return _0x127c2f;};'use strict';exports[_0x306e('0x0')]={'queue':{'type':_0x306e('0x1'),'required':!![]},'interface':{'type':_0x306e('0x1'),'required':!![]},'membername':{'type':_0x306e('0x1'),'required':!![]},'penalty':{'type':_0x306e('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x306e('0x3')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x306e('0x1'),'required':!![]}};exports[_0x306e('0x4')]={'interface':{'type':_0x306e('0x1'),'required':!![]},'paused':{'type':_0x306e('0x5')},'reason':{'type':'string','required':![]}};exports[_0x306e('0x6')]={'module':{'type':_0x306e('0x1'),'required':![]}};exports[_0x306e('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x306e('0x1'),'required':!![]},'filename':{'type':_0x306e('0x1')},'format':{'type':_0x306e('0x1')},'mixmonitorid':{'type':_0x306e('0x1')}};exports[_0x306e('0x8')]={'uniqueid':{'type':_0x306e('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x306e('0x1'),'required':!![]},'exten':{'type':_0x306e('0x1'),'required':!![]},'context':{'type':_0x306e('0x1')}}; \ No newline at end of file +var _0x6a0e=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queuepause','boolean'];(function(_0x438997,_0x3c047d){var _0x42db64=function(_0x343e87){while(--_0x343e87){_0x438997['push'](_0x438997['shift']());}};_0x42db64(++_0x3c047d);}(_0x6a0e,0x7d));var _0xe6a0=function(_0x38537f,_0x252124){_0x38537f=_0x38537f-0x0;var _0x141e23=_0x6a0e[_0x38537f];return _0x141e23;};'use strict';exports[_0xe6a0('0x0')]={'queue':{'type':_0xe6a0('0x1'),'required':!![]},'interface':{'type':_0xe6a0('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0xe6a0('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports['queueremove']={'queue':{'type':_0xe6a0('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xe6a0('0x3')]={'interface':{'type':_0xe6a0('0x1'),'required':!![]},'paused':{'type':_0xe6a0('0x4')},'reason':{'type':_0xe6a0('0x1'),'required':![]}};exports[_0xe6a0('0x5')]={'module':{'type':'string','required':![]}};exports[_0xe6a0('0x6')]={'uniqueid':{'type':_0xe6a0('0x1'),'required':!![]}};exports[_0xe6a0('0x7')]={'uniqueid':{'type':_0xe6a0('0x1'),'required':!![]},'filename':{'type':_0xe6a0('0x1')},'format':{'type':_0xe6a0('0x1')},'mixmonitorid':{'type':_0xe6a0('0x1')}};exports[_0xe6a0('0x8')]={'uniqueid':{'type':_0xe6a0('0x1'),'required':!![]}};exports[_0xe6a0('0x9')]={'uniqueid':{'type':_0xe6a0('0x1'),'required':!![]},'exten':{'type':_0xe6a0('0x1'),'required':!![]},'context':{'type':_0xe6a0('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 7981dbc..5c9c387 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x56825b,_0x172b8d){_0x56825b=_0x56825b-0x0;var _0x69ce77=_0x0b0e[_0x56825b];return _0x69ce77;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=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(_0x18656a,_0x4a79a8){var _0x2c2464=function(_0x4ec076){while(--_0x4ec076){_0x18656a['push'](_0x18656a['shift']());}};_0x2c2464(++_0x4a79a8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x50fd4c,_0x2abeb9){_0x50fd4c=_0x50fd4c-0x0;var _0x54c545=_0x5f2f[_0x50fd4c];return _0x54c545;};'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 23b951b..ef0a031 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 _0x061e=['mergeDBDataToRealtime'];(function(_0x39ba00,_0x369bfb){var _0x50488=function(_0x19b46d){while(--_0x19b46d){_0x39ba00['push'](_0x39ba00['shift']());}};_0x50488(++_0x369bfb);}(_0x061e,0x191));var _0xe061=function(_0x1f2a8b,_0x2c23b9){_0x1f2a8b=_0x1f2a8b-0x0;var _0x280cd9=_0x061e[_0x1f2a8b];return _0x280cd9;};'use strict';function mergeDBDataToRealtime(_0x1608ff,_0x126f61){var _0x23b10b=Object['assign']({},_0x1608ff);for(var _0x364342 in _0x126f61){if(_0x23b10b['hasOwnProperty'](_0x364342)){_0x23b10b[_0x364342]=_0x126f61[_0x364342];}}return _0x23b10b;}exports[_0xe061('0x0')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x5d15=['assign','hasOwnProperty'];(function(_0x2d5314,_0x463a88){var _0x37cc44=function(_0x381c51){while(--_0x381c51){_0x2d5314['push'](_0x2d5314['shift']());}};_0x37cc44(++_0x463a88);}(_0x5d15,0x64));var _0x55d1=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x5d15[_0x1ebc6c];return _0x3a826d;};'use strict';function mergeDBDataToRealtime(_0x50e83c,_0x1708ef){var _0x1bbdb5=Object[_0x55d1('0x0')]({},_0x50e83c);for(var _0x32eaf5 in _0x1708ef){if(_0x1bbdb5[_0x55d1('0x1')](_0x32eaf5)){_0x1bbdb5[_0x32eaf5]=_0x1708ef[_0x32eaf5];}}return _0x1bbdb5;}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 23693fe..c3a3c53 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 _0x025d=['blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','find','accountcode','name','isNil','format','length','findAgent','connectedlinenum','lastAssignedTo','interface','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','channel','split','outbound','internal','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','calleridpreview','originatecalleridnum','destinationchannel','callerid','calleridnum','disposition','ANSWERED','transfers','linkedid','getCallType','UserId','membername','monitor','monitors','monitorFilename','calleridname','connectedlinename','voiceAgentReport','forEach','substring','indexOf','mobile','phone','lastIndexOf','SIP/%s','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','disabled','voiceQueueReport','custom:voiceAgentReport','bind','custom:voiceDialReport'];(function(_0x1c04e8,_0x5deb6c){var _0x55e516=function(_0x1d163a){while(--_0x1d163a){_0x1c04e8['push'](_0x1c04e8['shift']());}};_0x55e516(++_0x5deb6c);}(_0x025d,0x141));var _0xd025=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x025d[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xd025('0x0'));var moment=require('moment');var util=require(_0xd025('0x1'));var config=require(_0xd025('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xd025('0x3'));var RpcVoiceCallReport=require(_0xd025('0x4'));var RpcVoiceDialReport=require(_0xd025('0x5'));var RpcMemberReport=require(_0xd025('0x6'));var RpcVoiceQueueReport=require(_0xd025('0x7'));var RpcVoiceRecording=require(_0xd025('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xd025('0x9'));var VoiceAgentReport=require(_0xd025('0xa'));var VoiceDialReport=require(_0xd025('0xb'));var UserReport=require(_0xd025('0xc'));function Report(_0x4e44fc){this[_0xd025('0xd')]=_0x4e44fc;this[_0xd025('0xe')]=_0x4e44fc[_0xd025('0xe')];this[_0xd025('0xf')]=_0x4e44fc[_0xd025('0xf')];}Report[_0xd025('0x10')][_0xd025('0x11')]=function(_0x191730){var _0x324375=new VoiceQueueReport(this['realtime']);var _0x4bffb1=new VoiceAgentReport(this[_0xd025('0xd')]);var _0x5044cd=new VoiceDialReport(this['realtime']);var _0xf15ac1=new VoiceCallReport(this[_0xd025('0xd')]);var _0x44ff6c=new UserReport(this[_0xd025('0xd')]);if(config['xdr']&&config['xdr'][_0xd025('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xd025('0x13')]['bind'](this));ami['on']('custom:voiceCallReport',this['voiceCallReport']['bind'](this));ami['on'](_0xd025('0x14'),this['voiceAgentReport'][_0xd025('0x15')](this));ami['on'](_0xd025('0x16'),this['voiceDialReport'][_0xd025('0x15')](this));ami['on'](_0xd025('0x17'),this[_0xd025('0x18')][_0xd025('0x15')](this));ami['on'](_0xd025('0x19'),this[_0xd025('0x1a')]['bind'](this));}};Report[_0xd025('0x10')]['findAgent']=function(_0x41f5a1){var _0x589efa;_0x589efa=_[_0xd025('0x1b')](this[_0xd025('0xe')],function(_0x1fa489){return _0x1fa489[_0xd025('0x1c')]==_0x41f5a1||_0x1fa489[_0xd025('0x1d')]==_0x41f5a1;});if(_[_0xd025('0x1e')](_0x589efa)){var _0x121f14=_[_0xd025('0x1b')](this[_0xd025('0xf')],function(_0x15bec0){return _0x15bec0['accountcode']==_0x41f5a1||_0x15bec0[_0xd025('0x1d')]==_0x41f5a1;});if(_0x121f14){_0x589efa=_[_0xd025('0x1b')](this[_0xd025('0xe')],function(_0x200f85){return _0x200f85['interface']==util[_0xd025('0x1f')]('SIP/%s',_0x121f14[_0xd025('0x1d')]);});}}return _0x589efa;};Report[_0xd025('0x10')][_0xd025('0x13')]=function(_0x54083c){for(var _0x11e4e1=0x0;_0x11e4e1<_0x54083c[_0xd025('0x20')];_0x11e4e1+=0x1){var _0x14121f=this[_0xd025('0x21')](_0x54083c[_0x11e4e1][_0xd025('0x22')]);if(_0x14121f){_0x54083c[_0x11e4e1][_0xd025('0x1c')]=_0x14121f['accountcode'];_0x54083c[_0x11e4e1]['assigned']=!![];_0x54083c[_0x11e4e1][_0xd025('0x23')]=_0x14121f['name'];_0x54083c[_0x11e4e1][_0xd025('0x24')]=_[_0xd025('0x1e')](_0x14121f['interface'])?util[_0xd025('0x1f')]('SIP/%s',_0x14121f[_0xd025('0x1d')]):_0x14121f[_0xd025('0x24')];if(_0x54083c[_0x11e4e1][_0xd025('0x25')]){_0x54083c[_0x11e4e1]['queuecallercompleteAt']=moment()[_0xd025('0x1f')](_0xd025('0x26'));}if(_0x54083c[_0x11e4e1][_0xd025('0x27')]){_0x54083c[_0x11e4e1][_0xd025('0x28')]=moment()['format'](_0xd025('0x26'));}RpcMemberReport[_0xd025('0x13')](_0x54083c[_0x11e4e1]);}RpcVoiceQueueReport[_0xd025('0x29')](_0x54083c[_0x11e4e1]);}};function extractCalleridNumber(_0x4dffa9){var _0x41580e=_0x4dffa9['match'](/<(.*?)>/);return _0x41580e?_0x41580e[0x1]:_0x4dffa9;}Report[_0xd025('0x10')][_0xd025('0x2a')]=function(_0x3f24c6){for(var _0x5a5588=0x0;_0x5a5588',_0x1d0206['calleridname'],_0x1d0206[_0xd025('0x40')]);}if(RpcVoiceTransferReport[_0xd025('0x43')][_0x1d0206[_0xd025('0x44')]]){var _0x2ee63b=RpcVoiceTransferReport['transfers'][_0x1d0206[_0xd025('0x44')]];_0x2ee63b['transfereelinkedid']=_0x1d0206['uniqueid'];RpcVoiceTransferReport[_0xd025('0x18')](_0x2ee63b);delete RpcVoiceTransferReport[_0xd025('0x43')][_0x1d0206[_0xd025('0x44')]];}if(_[_0xd025('0x1e')](_0x1d0206['type'])){_0x1d0206['type']=this[_0xd025('0x45')](_0x1d0206);}if(_[_0xd025('0x1e')](_0x1d0206[_0xd025('0x46')])){var _0x2388de=_0x1d0206[_0xd025('0x2c')][_0xd025('0x2d')]('-')[0x0];var _0x22b748=this[_0xd025('0xe')][_0x2388de];if(!_0x22b748)_0x22b748=this[_0xd025('0x2a')](_0x1d0206[_0xd025('0x1c')]);if(_0x22b748){_0x1d0206[_0xd025('0x46')]=_0x22b748['id'];_0x1d0206[_0xd025('0x47')]=_0x22b748[_0xd025('0x1d')];}}RpcVoiceCallReport[_0xd025('0x29')](_0x1d0206);if(_0x1d0206[_0xd025('0x48')]){for(var _0xb4d678=0x0;_0xb4d678<_0x1d0206[_0xd025('0x49')]['length'];_0xb4d678+=0x1){_0x1d0206[_0xd025('0x4a')]=_0x1d0206['monitors'][_0xb4d678]['filename'];_0x1d0206['createdAt']=_0x1d0206[_0xd025('0x49')][_0xb4d678]['createdAt'];if(_0x1d0206[_0xd025('0x32')]=='xcally-motion-preview'){_0x1d0206[_0xd025('0x40')]=_0x1d0206[_0xd025('0x22')];_0x1d0206[_0xd025('0x4b')]=_0x1d0206[_0xd025('0x4c')];_0x1d0206[_0xd025('0x22')]=_0x1d0206[_0xd025('0x1c')];_0x1d0206['connectedlinename']=_0x1d0206[_0xd025('0x47')];_0x1d0206[_0xd025('0x32')]=_0x1d0206[_0xd025('0x3d')];}else if(_0x1d0206[_0xd025('0x32')]=='xcally-motion-dialer'){_0x1d0206[_0xd025('0x40')]=_0x1d0206[_0xd025('0x31')];_0x1d0206[_0xd025('0x32')]=_0x1d0206[_0xd025('0x3d')];}RpcVoiceRecording[_0xd025('0x29')](_0x1d0206);}}};Report[_0xd025('0x10')][_0xd025('0x4d')]=function(_0x58c52d){if(_['isArray'](_0x58c52d)){_0x58c52d[_0xd025('0x4e')](function(_0x381743){RpcVoiceAgentReport[_0xd025('0x29')](_0x381743);});}else{RpcVoiceAgentReport[_0xd025('0x29')](_0x58c52d);}};Report[_0xd025('0x10')]['voiceDialReport']=function(_0x264ba6){RpcVoiceDialReport[_0xd025('0x29')](_0x264ba6);var _0xa6140c;var _0x2b80f7;var _0x6806ce=_0x264ba6['channel'];if(_['startsWith'](_0x6806ce,'Local')){_0x2b80f7=_0x6806ce[_0xd025('0x4f')](_0x6806ce['indexOf']('/')+0x1,_0x6806ce[_0xd025('0x50')]('@'));_0xa6140c=_['find'](this['agents'],function(_0x1ffbd8){return _0x1ffbd8[_0xd025('0x51')]==_0x2b80f7||_0x1ffbd8[_0xd025('0x52')]==_0x2b80f7||_0x1ffbd8[_0xd025('0x1c')]==_0x2b80f7;});}else{_0x2b80f7=_0x6806ce['substring'](_0x6806ce[_0xd025('0x50')]('/')+0x1,_0x6806ce[_0xd025('0x53')]('-'));_0xa6140c=this[_0xd025('0x21')](_0x2b80f7);}if(_0xa6140c){_0x264ba6[_0xd025('0x24')]=_[_0xd025('0x1e')](_0xa6140c[_0xd025('0x24')])?util['format'](_0xd025('0x54'),_0xa6140c[_0xd025('0x1d')]):_0xa6140c['interface'];_0x264ba6[_0xd025('0x47')]=_0xa6140c['name'];_0x264ba6[_0xd025('0x1c')]=_0xa6140c[_0xd025('0x1c')];RpcMemberReport['voiceDialReport'](_0x264ba6);}};Report[_0xd025('0x10')][_0xd025('0x18')]=function(_0x4498c2){RpcVoiceTransferReport['transfers'][_0x4498c2['transfererlinkedid']]=_0x4498c2;};Report[_0xd025('0x10')][_0xd025('0x1a')]=function(_0x47ef0b){RpcVoiceTransferReport[_0xd025('0x1a')](_0x47ef0b);};module[_0xd025('0x55')]=Report; \ No newline at end of file +var _0xd194=['monitorFilename','monitors','filename','createdAt','connectedlinename','originatecalleridnum','xcally-motion-dialer','isArray','forEach','startsWith','substring','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','prototype','realtime','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','voiceCallReport','voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','find','accountcode','name','isNil','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','destination','exten','dialer','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','disposition','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','type','UserId','membername','monitor'];(function(_0x3bb072,_0x34d725){var _0x11025e=function(_0x126c47){while(--_0x126c47){_0x3bb072['push'](_0x3bb072['shift']());}};_0x11025e(++_0x34d725);}(_0xd194,0x70));var _0x4d19=function(_0x2d0431,_0x293c98){_0x2d0431=_0x2d0431-0x0;var _0x3cc056=_0xd194[_0x2d0431];return _0x3cc056;};'use strict';var _=require(_0x4d19('0x0'));var moment=require(_0x4d19('0x1'));var util=require(_0x4d19('0x2'));var config=require(_0x4d19('0x3'));var ami=require(_0x4d19('0x4'));var RpcVoiceAgentReport=require(_0x4d19('0x5'));var RpcVoiceCallReport=require(_0x4d19('0x6'));var RpcVoiceDialReport=require(_0x4d19('0x7'));var RpcMemberReport=require(_0x4d19('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x4d19('0x9'));var VoiceCallReport=require(_0x4d19('0xa'));var VoiceAgentReport=require(_0x4d19('0xb'));var VoiceDialReport=require(_0x4d19('0xc'));var UserReport=require('./userReport');function Report(_0x43bf63){this['realtime']=_0x43bf63;this[_0x4d19('0xd')]=_0x43bf63[_0x4d19('0xd')];this[_0x4d19('0xe')]=_0x43bf63['telephones'];}Report[_0x4d19('0xf')]['sync']=function(_0x407d3a){var _0x3a18ca=new VoiceQueueReport(this[_0x4d19('0x10')]);var _0x50599d=new VoiceAgentReport(this[_0x4d19('0x10')]);var _0x26ceb7=new VoiceDialReport(this['realtime']);var _0x5bbbd8=new VoiceCallReport(this['realtime']);var _0xadcf6a=new UserReport(this['realtime']);if(config[_0x4d19('0x11')]&&config[_0x4d19('0x11')][_0x4d19('0x12')]){ami['on'](_0x4d19('0x13'),this[_0x4d19('0x14')][_0x4d19('0x15')](this));ami['on']('custom:voiceCallReport',this[_0x4d19('0x16')][_0x4d19('0x15')](this));ami['on']('custom:voiceAgentReport',this[_0x4d19('0x17')][_0x4d19('0x15')](this));ami['on']('custom:voiceDialReport',this[_0x4d19('0x18')][_0x4d19('0x15')](this));ami['on'](_0x4d19('0x19'),this[_0x4d19('0x1a')][_0x4d19('0x15')](this));ami['on'](_0x4d19('0x1b'),this[_0x4d19('0x1c')]['bind'](this));}};Report[_0x4d19('0xf')][_0x4d19('0x1d')]=function(_0x4b2e40){var _0x2422fd;_0x2422fd=_[_0x4d19('0x1e')](this[_0x4d19('0xd')],function(_0xe075eb){return _0xe075eb[_0x4d19('0x1f')]==_0x4b2e40||_0xe075eb[_0x4d19('0x20')]==_0x4b2e40;});if(_[_0x4d19('0x21')](_0x2422fd)){var _0x5692b2=_[_0x4d19('0x1e')](this[_0x4d19('0xe')],function(_0x25856f){return _0x25856f['accountcode']==_0x4b2e40||_0x25856f[_0x4d19('0x20')]==_0x4b2e40;});if(_0x5692b2){_0x2422fd=_[_0x4d19('0x1e')](this[_0x4d19('0xd')],function(_0x5b58d3){return _0x5b58d3[_0x4d19('0x22')]==util[_0x4d19('0x23')](_0x4d19('0x24'),_0x5692b2[_0x4d19('0x20')]);});}}return _0x2422fd;};Report[_0x4d19('0xf')][_0x4d19('0x14')]=function(_0x241906){for(var _0x5c9152=0x0;_0x5c9152<_0x241906[_0x4d19('0x25')];_0x5c9152+=0x1){var _0x13b5a2=this[_0x4d19('0x1d')](_0x241906[_0x5c9152][_0x4d19('0x26')]);if(_0x13b5a2){_0x241906[_0x5c9152][_0x4d19('0x1f')]=_0x13b5a2[_0x4d19('0x1f')];_0x241906[_0x5c9152][_0x4d19('0x27')]=!![];_0x241906[_0x5c9152][_0x4d19('0x28')]=_0x13b5a2[_0x4d19('0x20')];_0x241906[_0x5c9152][_0x4d19('0x22')]=_[_0x4d19('0x21')](_0x13b5a2[_0x4d19('0x22')])?util[_0x4d19('0x23')](_0x4d19('0x24'),_0x13b5a2['name']):_0x13b5a2[_0x4d19('0x22')];if(_0x241906[_0x5c9152][_0x4d19('0x29')]){_0x241906[_0x5c9152][_0x4d19('0x2a')]=moment()['format'](_0x4d19('0x2b'));}if(_0x241906[_0x5c9152][_0x4d19('0x2c')]){_0x241906[_0x5c9152][_0x4d19('0x2d')]=moment()[_0x4d19('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0x4d19('0x14')](_0x241906[_0x5c9152]);}RpcVoiceQueueReport[_0x4d19('0x2e')](_0x241906[_0x5c9152]);}};function extractCalleridNumber(_0x492790){var _0x26c7f3=_0x492790['match'](/<(.*?)>/);return _0x26c7f3?_0x26c7f3[0x1]:_0x492790;}Report[_0x4d19('0xf')][_0x4d19('0x2f')]=function(_0x143ff2){for(var _0x303ba0=0x0;_0x303ba00x0?!![]:![];if(!_0x943b5f){return this[_0x6e7e('0x1a')](this['summary']['completeEvent']);}};VoiceQueueReport[_0x6e7e('0xb')][_0x6e7e('0x1c')]=function(_0x3e9ef2){var _0x2abc3f=this[_0x6e7e('0x15')]['id'];if(this[_0x6e7e('0x15')][_0x6e7e('0x5e')][_0x2abc3f]&&this[_0x6e7e('0x15')][_0x6e7e('0x5e')][_0x2abc3f][_0x3e9ef2['actionid']]){this[_0x6e7e('0x15')][_0x6e7e('0x5e')][_0x2abc3f][_0x3e9ef2[_0x6e7e('0x5f')]][_0x6e7e('0x10')][_0x6e7e('0x6a')](_0x3e9ef2);}};VoiceQueueReport[_0x6e7e('0xb')]['syncQueueSummary']=function(_0x46c491){var _0x2b8606=this;try{if(this[_0x6e7e('0x6b')](_0x46c491)&&this[_0x6e7e('0x6b')](_0x46c491['queue'])){logger[_0x6e7e('0x50')](_0x6e7e('0x6c'),util[_0x6e7e('0x43')](_0x46c491,{'showHidden':![],'depth':null}));var _0x3387d1=this['voiceQueues'][_0x46c491[_0x6e7e('0x4d')]];if(_0x3387d1){logger[_0x6e7e('0x50')](_0x6e7e('0x6d'),_0x3387d1['name']);this[_0x6e7e('0x15')]['queues'][_0x3387d1[_0x6e7e('0x57')]]={'summaryEvent':_0x46c491};this['summary']['statusRequests']+=0x1;return ami[_0x6e7e('0x5a')]({'action':_0x6e7e('0x5e'),'queue':_0x3387d1[_0x6e7e('0x57')]})[_0x6e7e('0x6e')](function(_0x325593){if(!_0x2b8606[_0x6e7e('0x15')][_0x6e7e('0x5e')][_0x46c491[_0x6e7e('0x5f')]]){_0x2b8606[_0x6e7e('0x15')]['queuestatus'][_0x46c491['actionid']]={};}_0x2b8606[_0x6e7e('0x15')]['queuestatus'][_0x46c491[_0x6e7e('0x5f')]][_0x325593[_0x6e7e('0x5f')]]={'queue':_0x3387d1[_0x6e7e('0x57')],'agents':[]};})[_0x6e7e('0x60')](function(_0x2d7a54){throw _0x2d7a54;});}}}catch(_0x2f2c03){logger['error'](_0x6e7e('0x61'),util['inspect'](_0x2f2c03,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e7e('0xb')]['syncQueueSummaryComplete']=function(_0x366ac9){if(this[_0x6e7e('0x15')][_0x6e7e('0x69')]>0x0){this[_0x6e7e('0x15')][_0x6e7e('0x6f')]=_0x366ac9;return;}logger[_0x6e7e('0x50')](_0x6e7e('0x70'),util[_0x6e7e('0x43')](_0x366ac9,{'showHidden':![],'depth':null}));this[_0x6e7e('0x15')]=initializeSummary();ami[_0x6e7e('0x48')](_0x6e7e('0x71'),{});};VoiceQueueReport[_0x6e7e('0xb')][_0x6e7e('0x1e')]=function(_0x220ec5){try{if(this[_0x6e7e('0x6b')](_0x220ec5)){logger[_0x6e7e('0x50')](_0x6e7e('0x72'),_0x220ec5[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x220ec5,{'showHidden':![],'depth':null}));if(_[_0x6e7e('0x73')](this[_0x6e7e('0x41')][_0x220ec5[_0x6e7e('0x4b')]])){this[_0x6e7e('0x41')][_0x220ec5[_0x6e7e('0x4b')]]=[];}if(_[_0x6e7e('0x73')](this[_0x6e7e('0x11')][_0x220ec5['uniqueid']])){this['channels'][_0x220ec5['uniqueid']]={};}var _0x5ca6a6=new QueueReport();_0x5ca6a6[_0x6e7e('0x4d')]=_0x220ec5[_0x6e7e('0x4d')];_0x5ca6a6[_0x6e7e('0x54')]=this[_0x6e7e('0x13')][_0x5ca6a6[_0x6e7e('0x4d')]]&&this['voiceQueues'][_0x5ca6a6['queue']][_0x6e7e('0x54')]?this[_0x6e7e('0x13')][_0x5ca6a6['queue']]['type']||'inbound':_0x6e7e('0x74');_0x5ca6a6[_0x6e7e('0x75')]=moment()[_0x6e7e('0x56')](_0x6e7e('0x76'));_0x5ca6a6[_0x6e7e('0x77')]=_0x220ec5['position'];_0x5ca6a6['count']=_0x220ec5[_0x6e7e('0x78')];_0x5ca6a6['uniqueid']=_0x220ec5[_0x6e7e('0x4b')];_0x5ca6a6[_0x6e7e('0x79')]=this[_0x6e7e('0x11')][_0x220ec5[_0x6e7e('0x4b')]][_0x6e7e('0x79')];logger[_0x6e7e('0x7a')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x5ca6a6['queue'],_0x5ca6a6[_0x6e7e('0x54')]);Object[_0x6e7e('0x66')](_0x5ca6a6,_['pick'](_0x220ec5,_[_0x6e7e('0x7b')](_0x5ca6a6)));this[_0x6e7e('0x41')][_0x220ec5['uniqueid']]['push'](_0x5ca6a6);this[_0x6e7e('0x11')][_0x220ec5[_0x6e7e('0x4b')]]=_0x5ca6a6;this['emitVoiceQueueChannelSave'](_0x5ca6a6,_0x6e7e('0x7c'));}}catch(_0x5ac7db){logger[_0x6e7e('0x3f')](_0x6e7e('0x72'),_0x220ec5[_0x6e7e('0x4b')],util['inspect'](_0x5ac7db,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6e7e('0x1f')]=function(_0x5a23fd){try{if(this[_0x6e7e('0x6b')](_0x5a23fd)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x5a23fd[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x5a23fd,{'showHidden':![],'depth':null}));if(this[_0x6e7e('0x41')][_0x5a23fd['uniqueid']]){var _0xe76d3b=_[_0x6e7e('0x7d')](this[_0x6e7e('0x41')][_0x5a23fd[_0x6e7e('0x4b')]]);_0xe76d3b['queuecallercomplete']=![];_0xe76d3b[_0x6e7e('0x7e')]=null;_0xe76d3b[_0x6e7e('0x7f')]=_0x5a23fd[_0x6e7e('0x7f')];_0xe76d3b[_0x6e7e('0x80')]=_0x5a23fd[_0x6e7e('0x80')];_0xe76d3b[_0x6e7e('0x81')]=!![];_0xe76d3b[_0x6e7e('0x82')]=moment()['format'](_0x6e7e('0x76'));_0xe76d3b[_0x6e7e('0x83')]='ABANDONED';_0xe76d3b[_0x6e7e('0x84')]=null;logger['info']('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0xe76d3b[_0x6e7e('0x4d')],_0xe76d3b[_0x6e7e('0x54')]);this[_0x6e7e('0x11')][_0x5a23fd['uniqueid']]=_0xe76d3b;this[_0x6e7e('0x46')](_0xe76d3b,'queuecallerabandon');}}}catch(_0x4357c9){logger[_0x6e7e('0x3f')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5a23fd[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x4357c9,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6e7e('0x21')]=function(_0xc0f5){try{if(this[_0x6e7e('0x6b')](_0xc0f5)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0xc0f5[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0xc0f5,{'showHidden':![],'depth':null}));if(this[_0x6e7e('0x41')][_0xc0f5[_0x6e7e('0x4b')]]){var _0x4725d5=_['last'](this['queueReports'][_0xc0f5[_0x6e7e('0x4b')]]);_0x4725d5['queuecallerleaveAt']=moment()[_0x6e7e('0x56')]('YYYY-MM-DD\x20HH:mm:ss');_0x4725d5['connectedlinenum']=_0xc0f5[_0x6e7e('0x85')];_0x4725d5['connectedlinename']=_0xc0f5[_0x6e7e('0x86')];logger[_0x6e7e('0x7a')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4725d5['queue'],_0x4725d5[_0x6e7e('0x54')],_0xc0f5['connectedlinenum'],_0xc0f5[_0x6e7e('0x86')]);this[_0x6e7e('0x11')][_0xc0f5[_0x6e7e('0x4b')]]=_0x4725d5;this[_0x6e7e('0x49')](_0x4725d5,_0x6e7e('0x20'));}}}catch(_0x62b8dc){logger[_0x6e7e('0x3f')](_0x6e7e('0x87'),_0xc0f5[_0x6e7e('0x4b')],util['inspect'](_0x62b8dc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e7e('0xb')][_0x6e7e('0x25')]=function(_0xc8e77){try{if(this['isNotNull'](_0xc8e77)){logger[_0x6e7e('0x50')](_0x6e7e('0x88'),_0xc8e77[_0x6e7e('0x4b')],util['inspect'](_0xc8e77,{'showHidden':![],'depth':null}));if(this[_0x6e7e('0x41')][_0xc8e77[_0x6e7e('0x4b')]]){var _0x27adeb=_[_0x6e7e('0x7d')](this[_0x6e7e('0x41')][_0xc8e77['uniqueid']]);_0x27adeb[_0x6e7e('0x89')]=!![];_0x27adeb['queuecallerexitreason']=_0x6e7e('0x8a');logger['info'](_0x6e7e('0x8b'),_0x27adeb[_0x6e7e('0x4d')],_0x27adeb['type']);}}}catch(_0x3e1ddd){logger[_0x6e7e('0x3f')]('[%s][voiceQueueReport][agentconnect]',_0xc8e77[_0x6e7e('0x4b')],util['inspect'](_0x3e1ddd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e7e('0xb')]['syncAgentComplete']=function(_0x551880){try{if(this[_0x6e7e('0x6b')](_0x551880)){logger[_0x6e7e('0x50')](_0x6e7e('0x8c'),_0x551880[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x551880,{'showHidden':![],'depth':null}));if(this[_0x6e7e('0x41')][_0x551880[_0x6e7e('0x4b')]]){var _0x4284b2=_['last'](this[_0x6e7e('0x41')][_0x551880[_0x6e7e('0x4b')]]);_0x4284b2[_0x6e7e('0x81')]=![];_0x4284b2[_0x6e7e('0x82')]=null;_0x4284b2['assigned']=!![];_0x4284b2[_0x6e7e('0x84')]=_0x551880[_0x6e7e('0x8d')];_0x4284b2['holdtime']=_0x551880[_0x6e7e('0x7f')];_0x4284b2['queuecallercomplete']=!![];_0x4284b2[_0x6e7e('0x37')]=![];_0x4284b2[_0x6e7e('0x8e')]=null;if(!_0x4284b2[_0x6e7e('0x8f')]){if(_0x551880[_0x6e7e('0x90')]==_0x6e7e('0x8f')){_0x4284b2['queuecallerexitreason']='COMPLETED';logger[_0x6e7e('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4284b2['queue'],_0x4284b2[_0x6e7e('0x54')]);}else{if(_['startsWith'](_0x551880[_0x6e7e('0x3c')]['toLowerCase'](),'local/')){if(this[_0x6e7e('0x41')][_0x551880['linkedid']]){var _0x114715=_[_0x6e7e('0x7d')](this['queueReports'][_0x551880['linkedid']]);_0x114715[_0x6e7e('0x89')]=![];_0x114715[_0x6e7e('0x37')]=!![];_0x114715['queuecallerexitAt']=moment(_0x4284b2['queuecallerjoinAt'])[_0x6e7e('0x91')](_0x551880['holdtime'],_0x6e7e('0x92'))[_0x6e7e('0x56')](_0x6e7e('0x76'));_0x114715[_0x6e7e('0x83')]=_0x6e7e('0x93');_0x114715[_0x6e7e('0x8f')]=!![];_0x114715[_0x6e7e('0x94')]=_0x6e7e('0x95');_0x114715[_0x6e7e('0x96')]=_0x551880['destexten'];_0x114715[_0x6e7e('0x97')]=_0x551880[_0x6e7e('0x4b')];logger[_0x6e7e('0x7a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x114715[_0x6e7e('0x4d')],_0x114715[_0x6e7e('0x54')]);var _0x6e031a=this[_0x6e7e('0x41')][_0x551880['linkedid']];this['queueReports'][_0x551880[_0x6e7e('0x98')]]=this['queueReports'][_0x551880[_0x6e7e('0x4b')]];this[_0x6e7e('0x41')][_0x551880[_0x6e7e('0x4b')]]=_0x6e031a;}}else{_0x4284b2[_0x6e7e('0x83')]=_0x6e7e('0x99')+_0x551880[_0x6e7e('0x90')][_0x6e7e('0x9a')]();logger[_0x6e7e('0x7a')](_0x6e7e('0x9b'),_0x4284b2[_0x6e7e('0x4d')],_0x4284b2[_0x6e7e('0x54')],_0x4284b2[_0x6e7e('0x83')]);}}}this[_0x6e7e('0x11')][_0x551880[_0x6e7e('0x4b')]]=_0x4284b2;}}}catch(_0xd9db82){logger[_0x6e7e('0x3f')](_0x6e7e('0x8c'),_0x551880[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0xd9db82,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e7e('0xb')][_0x6e7e('0x27')]=function(_0x4339ff){try{if(this[_0x6e7e('0x6b')](_0x4339ff)){logger[_0x6e7e('0x50')](_0x6e7e('0x9c'),_0x4339ff[_0x6e7e('0x4b')],util['inspect'](_0x4339ff,{'showHidden':![],'depth':null}));this['addVariable'](_0x4339ff['uniqueid'],_['keys'](_0x4339ff['variable'])[0x0],_0x4339ff[_0x6e7e('0x9d')]);if(this[_0x6e7e('0x41')][_0x4339ff[_0x6e7e('0x4b')]]){var _0x5cb084=_[_0x6e7e('0x7d')](this[_0x6e7e('0x41')][_0x4339ff[_0x6e7e('0x4b')]]);if(_0x5cb084){if(this['isNotNull'](_0x4339ff[_0x6e7e('0x9e')])&&this[_0x6e7e('0x6b')](_0x4339ff[_0x6e7e('0x9e')][_0x6e7e('0x5e')])){switch(_0x4339ff[_0x6e7e('0x9d')]){case _0x6e7e('0x9f'):_0x5cb084[_0x6e7e('0x37')]=![];_0x5cb084[_0x6e7e('0x8e')]=null;break;case _0x6e7e('0xa0'):_0x5cb084[_0x6e7e('0xa1')]=_0x6e7e('0xa2');_0x5cb084[_0x6e7e('0x37')]=!![];_0x5cb084[_0x6e7e('0x8e')]=moment()[_0x6e7e('0x56')](_0x6e7e('0x76'));_0x5cb084[_0x6e7e('0xa3')]=moment()[_0x6e7e('0x56')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x6e7e('0x50')](_0x6e7e('0xa4'),_0x4339ff[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x5cb084,{'showHidden':![],'depth':null}));ami['emit'](_0x6e7e('0xa5'),_0x5cb084);break;default:_0x5cb084[_0x6e7e('0x37')]=!![];_0x5cb084['queuecallerexitAt']=moment()[_0x6e7e('0x56')](_0x6e7e('0x76'));_0x5cb084[_0x6e7e('0xa3')]=moment()[_0x6e7e('0x56')](_0x6e7e('0x76'));}_0x5cb084[_0x6e7e('0x81')]=![];_0x5cb084[_0x6e7e('0x82')]=null;_0x5cb084[_0x6e7e('0x83')]=_0x4339ff[_0x6e7e('0x9d')];this[_0x6e7e('0x11')][_0x4339ff['uniqueid']]=_0x5cb084;this[_0x6e7e('0x46')](_0x5cb084,_0x6e7e('0x26'));}else if(this['isNotNull'](_0x4339ff[_0x6e7e('0x9e')])&&this['isNotNull'](_0x4339ff[_0x6e7e('0x9e')][_0x6e7e('0xa6')])){if(!_0x5cb084['queuecallerabandon']){_0x5cb084[_0x6e7e('0x37')]=!![];_0x5cb084[_0x6e7e('0x8e')]=moment()[_0x6e7e('0x56')](_0x6e7e('0x76'));_0x5cb084[_0x6e7e('0x83')]='EXITWITHKEY';_0x5cb084[_0x6e7e('0xa3')]=moment()[_0x6e7e('0x56')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x6e7e('0x11')][_0x4339ff[_0x6e7e('0x4b')]]=_0x5cb084;}}logger['info'](_0x6e7e('0xa7'),_0x4339ff[_0x6e7e('0x4b')],_0x5cb084[_0x6e7e('0x4d')],_0x5cb084[_0x6e7e('0x54')],_['keys'](_0x4339ff['variable'])[0x0],_0x4339ff[_0x6e7e('0x9d')]);_0x5cb084[_0x6e7e('0x16')]=this[_0x6e7e('0x16')][_0x4339ff['uniqueid']];}}}}catch(_0x447431){logger[_0x6e7e('0x3f')](_0x6e7e('0x9c'),_0x4339ff[_0x6e7e('0x4b')],util[_0x6e7e('0x43')](_0x447431,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6e7e('0xb')]['addVariable']=function(_0x169c53,_0x3c6296,_0x4596dc){var _0x344228=[_0x6e7e('0xa8'),'rtpaudioqosbridged','rtpaudioqosjitter',_0x6e7e('0xa9'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x6e7e('0xaa'),'rtpaudioqosrttbridged',_0x6e7e('0xab'),'sipuri',_0x6e7e('0xac'),_0x6e7e('0xad'),_0x6e7e('0xae'),_0x6e7e('0xaf'),'memberinterface',_0x6e7e('0xb0'),_0x6e7e('0x8d'),'memberpenalty',_0x6e7e('0xb1')];if(!_[_0x6e7e('0x3a')](_0x3c6296)&&!_[_0x6e7e('0xb2')](_0x344228,_0x3c6296)){if(_[_0x6e7e('0x73')](this[_0x6e7e('0x16')][_0x169c53])){this[_0x6e7e('0x16')][_0x169c53]={};}this[_0x6e7e('0x16')][_0x169c53][_0x3c6296]=_0x4596dc;}};VoiceQueueReport[_0x6e7e('0xb')][_0x6e7e('0xb3')]=function(_0x2fb531,_0x50f580,_0x77a13e){try{var _0x3d6848={};if(this[_0x6e7e('0x41')][_0x2fb531]){for(var _0x44e246=0x0;_0x44e2460x0?!![]:![];if(!_0x3bcbb9){return this[_0x0b2b('0x19')](this[_0x0b2b('0x15')][_0x0b2b('0x6b')]);}};VoiceQueueReport[_0x0b2b('0xa')][_0x0b2b('0x6c')]=function(_0x582c62){var _0x8d3c5f=this['summary']['id'];if(this[_0x0b2b('0x15')][_0x0b2b('0x5d')][_0x8d3c5f]&&this[_0x0b2b('0x15')][_0x0b2b('0x5d')][_0x8d3c5f][_0x582c62['actionid']]){this['summary'][_0x0b2b('0x5d')][_0x8d3c5f][_0x582c62['actionid']][_0x0b2b('0x11')][_0x0b2b('0x6d')](_0x582c62);}};VoiceQueueReport[_0x0b2b('0xa')]['syncQueueSummary']=function(_0x1adb4f){var _0x197d80=this;try{if(this['isNotNull'](_0x1adb4f)&&this[_0x0b2b('0x55')](_0x1adb4f[_0x0b2b('0x49')])){logger[_0x0b2b('0x4b')](_0x0b2b('0x6e'),util[_0x0b2b('0x3c')](_0x1adb4f,{'showHidden':![],'depth':null}));var _0x17a3f4=this[_0x0b2b('0x13')][_0x1adb4f['queue']];if(_0x17a3f4){logger[_0x0b2b('0x4b')](_0x0b2b('0x6f'),_0x17a3f4[_0x0b2b('0x54')]);this[_0x0b2b('0x15')][_0x0b2b('0x57')][_0x17a3f4[_0x0b2b('0x54')]]={'summaryEvent':_0x1adb4f};this[_0x0b2b('0x15')][_0x0b2b('0x6a')]+=0x1;return ami[_0x0b2b('0x36')]({'action':_0x0b2b('0x5d'),'queue':_0x17a3f4[_0x0b2b('0x54')]})['then'](function(_0x55fbb3){if(!_0x197d80['summary'][_0x0b2b('0x5d')][_0x1adb4f[_0x0b2b('0x5c')]]){_0x197d80[_0x0b2b('0x15')]['queuestatus'][_0x1adb4f['actionid']]={};}_0x197d80['summary'][_0x0b2b('0x5d')][_0x1adb4f[_0x0b2b('0x5c')]][_0x55fbb3[_0x0b2b('0x5c')]]={'queue':_0x17a3f4['name'],'agents':[]};})['catch'](function(_0xb02d15){throw _0xb02d15;});}}}catch(_0x40ce9f){logger[_0x0b2b('0x3d')](_0x0b2b('0x5e'),util['inspect'](_0x40ce9f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b2b('0x19')]=function(_0x955376){if(this[_0x0b2b('0x15')]['statusRequests']>0x0){this[_0x0b2b('0x15')][_0x0b2b('0x6b')]=_0x955376;return;}logger['debug'](_0x0b2b('0x70'),util['inspect'](_0x955376,{'showHidden':![],'depth':null}));this[_0x0b2b('0x15')]=initializeSummary();ami[_0x0b2b('0x45')](_0x0b2b('0x71'),{});};VoiceQueueReport[_0x0b2b('0xa')][_0x0b2b('0x72')]=function(_0x3ae799){try{if(this['isNotNull'](_0x3ae799)){logger[_0x0b2b('0x4b')](_0x0b2b('0x73'),_0x3ae799['uniqueid'],util[_0x0b2b('0x3c')](_0x3ae799,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x0b2b('0xf')][_0x3ae799[_0x0b2b('0x4d')]])){this[_0x0b2b('0xf')][_0x3ae799[_0x0b2b('0x4d')]]=[];}if(_[_0x0b2b('0x56')](this[_0x0b2b('0x35')][_0x3ae799[_0x0b2b('0x4d')]])){this['channels'][_0x3ae799['uniqueid']]={};}var _0x1e9ae5=new QueueReport();_0x1e9ae5['queue']=_0x3ae799[_0x0b2b('0x49')];_0x1e9ae5[_0x0b2b('0x66')]=this[_0x0b2b('0x13')][_0x1e9ae5[_0x0b2b('0x49')]]&&this['voiceQueues'][_0x1e9ae5[_0x0b2b('0x49')]][_0x0b2b('0x66')]?this[_0x0b2b('0x13')][_0x1e9ae5[_0x0b2b('0x49')]]['type']||_0x0b2b('0x67'):'inbound';_0x1e9ae5[_0x0b2b('0x74')]=moment()[_0x0b2b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x1e9ae5[_0x0b2b('0x75')]=_0x3ae799['position'];_0x1e9ae5[_0x0b2b('0x76')]=_0x3ae799[_0x0b2b('0x76')];_0x1e9ae5[_0x0b2b('0x4d')]=_0x3ae799['uniqueid'];_0x1e9ae5['routealias']=this[_0x0b2b('0x35')][_0x3ae799['uniqueid']]['routealias'];logger[_0x0b2b('0x77')](_0x0b2b('0x78'),_0x1e9ae5[_0x0b2b('0x49')],_0x1e9ae5[_0x0b2b('0x66')]);Object['assign'](_0x1e9ae5,_[_0x0b2b('0x79')](_0x3ae799,_['keys'](_0x1e9ae5)));this[_0x0b2b('0xf')][_0x3ae799[_0x0b2b('0x4d')]][_0x0b2b('0x6d')](_0x1e9ae5);this[_0x0b2b('0x35')][_0x3ae799[_0x0b2b('0x4d')]]=_0x1e9ae5;this[_0x0b2b('0x7a')](_0x1e9ae5,_0x0b2b('0x1b'));}}catch(_0x17a139){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x3ae799[_0x0b2b('0x4d')],util['inspect'](_0x17a139,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b2b('0xa')]['syncQueueCallerAbandon']=function(_0x185588){try{if(this[_0x0b2b('0x55')](_0x185588)){logger[_0x0b2b('0x4b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x185588['uniqueid'],util[_0x0b2b('0x3c')](_0x185588,{'showHidden':![],'depth':null}));if(this[_0x0b2b('0xf')][_0x185588[_0x0b2b('0x4d')]]){var _0x11a56f=_[_0x0b2b('0x7b')](this[_0x0b2b('0xf')][_0x185588['uniqueid']]);_0x11a56f[_0x0b2b('0x33')]=![];_0x11a56f[_0x0b2b('0x7c')]=null;_0x11a56f[_0x0b2b('0x7d')]=_0x185588[_0x0b2b('0x7d')];_0x11a56f[_0x0b2b('0x7e')]=_0x185588[_0x0b2b('0x7e')];_0x11a56f[_0x0b2b('0x1c')]=!![];_0x11a56f[_0x0b2b('0x7f')]=moment()[_0x0b2b('0x47')](_0x0b2b('0x80'));_0x11a56f[_0x0b2b('0x4e')]=_0x0b2b('0x81');_0x11a56f[_0x0b2b('0x82')]=null;logger[_0x0b2b('0x77')](_0x0b2b('0x83'),_0x11a56f['queue'],_0x11a56f[_0x0b2b('0x66')]);this['channels'][_0x185588[_0x0b2b('0x4d')]]=_0x11a56f;this[_0x0b2b('0x43')](_0x11a56f,_0x0b2b('0x1c'));}}}catch(_0x2279a0){logger['error']('[%s][voiceQueueReport][queuecallerabandon]',_0x185588[_0x0b2b('0x4d')],util[_0x0b2b('0x3c')](_0x2279a0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b2b('0xa')]['syncQueueCallerLeave']=function(_0x417323){try{if(this['isNotNull'](_0x417323)){logger['debug'](_0x0b2b('0x84'),_0x417323[_0x0b2b('0x4d')],util[_0x0b2b('0x3c')](_0x417323,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x417323['uniqueid']]){var _0x362819=_[_0x0b2b('0x7b')](this['queueReports'][_0x417323[_0x0b2b('0x4d')]]);_0x362819[_0x0b2b('0x85')]=moment()[_0x0b2b('0x47')](_0x0b2b('0x80'));_0x362819[_0x0b2b('0x86')]=_0x417323[_0x0b2b('0x86')];_0x362819[_0x0b2b('0x87')]=_0x417323[_0x0b2b('0x87')];logger[_0x0b2b('0x77')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x362819['queue'],_0x362819['type'],_0x417323[_0x0b2b('0x86')],_0x417323[_0x0b2b('0x87')]);this[_0x0b2b('0x35')][_0x417323[_0x0b2b('0x4d')]]=_0x362819;this[_0x0b2b('0x7a')](_0x362819,_0x0b2b('0x1e'));}}}catch(_0x2f5b16){logger[_0x0b2b('0x3d')](_0x0b2b('0x84'),_0x417323['uniqueid'],util['inspect'](_0x2f5b16,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x0b2b('0x88')]=function(_0x3e7384){try{if(this['isNotNull'](_0x3e7384)){logger[_0x0b2b('0x4b')](_0x0b2b('0x89'),_0x3e7384[_0x0b2b('0x4d')],util[_0x0b2b('0x3c')](_0x3e7384,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3e7384[_0x0b2b('0x4d')]]){var _0x534dc0=_[_0x0b2b('0x7b')](this[_0x0b2b('0xf')][_0x3e7384[_0x0b2b('0x4d')]]);_0x534dc0[_0x0b2b('0x33')]=!![];_0x534dc0[_0x0b2b('0x4e')]=_0x0b2b('0x8a');logger[_0x0b2b('0x77')](_0x0b2b('0x8b'),_0x534dc0[_0x0b2b('0x49')],_0x534dc0[_0x0b2b('0x66')]);}}}catch(_0xbfba8e){logger[_0x0b2b('0x3d')](_0x0b2b('0x89'),_0x3e7384[_0x0b2b('0x4d')],util[_0x0b2b('0x3c')](_0xbfba8e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b2b('0xa')][_0x0b2b('0x8c')]=function(_0x4ba56f){try{if(this[_0x0b2b('0x55')](_0x4ba56f)){logger[_0x0b2b('0x4b')](_0x0b2b('0x8d'),_0x4ba56f['uniqueid'],util[_0x0b2b('0x3c')](_0x4ba56f,{'showHidden':![],'depth':null}));if(this[_0x0b2b('0xf')][_0x4ba56f[_0x0b2b('0x4d')]]){var _0x5f3caf=_[_0x0b2b('0x7b')](this[_0x0b2b('0xf')][_0x4ba56f[_0x0b2b('0x4d')]]);_0x5f3caf[_0x0b2b('0x1c')]=![];_0x5f3caf['queuecallerabandonAt']=null;_0x5f3caf['assigned']=!![];_0x5f3caf[_0x0b2b('0x82')]=_0x4ba56f['membername'];_0x5f3caf[_0x0b2b('0x7d')]=_0x4ba56f[_0x0b2b('0x7d')];_0x5f3caf[_0x0b2b('0x33')]=!![];_0x5f3caf[_0x0b2b('0x32')]=![];_0x5f3caf[_0x0b2b('0x8e')]=null;if(!_0x5f3caf[_0x0b2b('0x8f')]){if(_0x4ba56f[_0x0b2b('0x90')]==_0x0b2b('0x8f')){_0x5f3caf[_0x0b2b('0x4e')]=_0x0b2b('0x91');logger[_0x0b2b('0x77')](_0x0b2b('0x92'),_0x5f3caf['queue'],_0x5f3caf['type']);}else{if(_[_0x0b2b('0x93')](_0x4ba56f[_0x0b2b('0x38')][_0x0b2b('0x94')](),_0x0b2b('0x95'))){if(this[_0x0b2b('0xf')][_0x4ba56f[_0x0b2b('0x96')]]){var _0x1b3bad=_[_0x0b2b('0x7b')](this[_0x0b2b('0xf')][_0x4ba56f['linkedid']]);_0x1b3bad[_0x0b2b('0x33')]=![];_0x1b3bad[_0x0b2b('0x32')]=!![];_0x1b3bad['queuecallerexitAt']=moment(_0x5f3caf[_0x0b2b('0x74')])['add'](_0x4ba56f[_0x0b2b('0x7d')],'seconds')[_0x0b2b('0x47')](_0x0b2b('0x80'));_0x1b3bad[_0x0b2b('0x4e')]=_0x0b2b('0x97');_0x1b3bad['transfer']=!![];_0x1b3bad[_0x0b2b('0x98')]=_0x0b2b('0x99');_0x1b3bad[_0x0b2b('0x9a')]=_0x4ba56f[_0x0b2b('0x9b')];_0x1b3bad[_0x0b2b('0x9c')]=_0x4ba56f['uniqueid'];logger[_0x0b2b('0x77')](_0x0b2b('0x9d'),_0x1b3bad[_0x0b2b('0x49')],_0x1b3bad[_0x0b2b('0x66')]);var _0x7693c8=this['queueReports'][_0x4ba56f['linkedid']];this['queueReports'][_0x4ba56f[_0x0b2b('0x96')]]=this[_0x0b2b('0xf')][_0x4ba56f[_0x0b2b('0x4d')]];this['queueReports'][_0x4ba56f[_0x0b2b('0x4d')]]=_0x7693c8;}}else{_0x5f3caf['queuecallerexitreason']=_0x0b2b('0x9e')+_0x4ba56f[_0x0b2b('0x90')][_0x0b2b('0x9f')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x5f3caf['queue'],_0x5f3caf[_0x0b2b('0x66')],_0x5f3caf[_0x0b2b('0x4e')]);}}}this[_0x0b2b('0x35')][_0x4ba56f['uniqueid']]=_0x5f3caf;}}}catch(_0x3db38e){logger[_0x0b2b('0x3d')]('[%s][voiceQueueReport][agentcomplete]',_0x4ba56f[_0x0b2b('0x4d')],util['inspect'](_0x3db38e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b2b('0xa')][_0x0b2b('0x22')]=function(_0x121717){try{if(this[_0x0b2b('0x55')](_0x121717)){logger['debug']('[%s][voiceQueueReport][varset]',_0x121717[_0x0b2b('0x4d')],util['inspect'](_0x121717,{'showHidden':![],'depth':null}));this[_0x0b2b('0xa0')](_0x121717[_0x0b2b('0x4d')],_[_0x0b2b('0xa1')](_0x121717['variable'])[0x0],_0x121717[_0x0b2b('0xa2')]);if(this[_0x0b2b('0xf')][_0x121717[_0x0b2b('0x4d')]]){var _0x5a6a2e=_[_0x0b2b('0x7b')](this[_0x0b2b('0xf')][_0x121717['uniqueid']]);if(_0x5a6a2e){if(this[_0x0b2b('0x55')](_0x121717['variable'])&&this[_0x0b2b('0x55')](_0x121717[_0x0b2b('0xa3')]['queuestatus'])){switch(_0x121717[_0x0b2b('0xa2')]){case _0x0b2b('0xa4'):_0x5a6a2e[_0x0b2b('0x32')]=![];_0x5a6a2e[_0x0b2b('0x8e')]=null;break;case _0x0b2b('0xa5'):_0x5a6a2e[_0x0b2b('0xa6')]='timeout';_0x5a6a2e[_0x0b2b('0x32')]=!![];_0x5a6a2e[_0x0b2b('0x8e')]=moment()[_0x0b2b('0x47')](_0x0b2b('0x80'));_0x5a6a2e[_0x0b2b('0x85')]=moment()[_0x0b2b('0x47')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0x0b2b('0x4b')](_0x0b2b('0xa7'),_0x121717[_0x0b2b('0x4d')],util[_0x0b2b('0x3c')](_0x5a6a2e,{'showHidden':![],'depth':null}));ami[_0x0b2b('0x45')](_0x0b2b('0xa8'),_0x5a6a2e);break;default:_0x5a6a2e['queuecallerexit']=!![];_0x5a6a2e['queuecallerexitAt']=moment()[_0x0b2b('0x47')](_0x0b2b('0x80'));_0x5a6a2e[_0x0b2b('0x85')]=moment()['format'](_0x0b2b('0x80'));}_0x5a6a2e['queuecallerabandon']=![];_0x5a6a2e[_0x0b2b('0x7f')]=null;_0x5a6a2e[_0x0b2b('0x4e')]=_0x121717[_0x0b2b('0xa2')];this['channels'][_0x121717['uniqueid']]=_0x5a6a2e;this['emitVoiceQueueChannelRemove'](_0x5a6a2e,_0x0b2b('0x21'));}else if(this[_0x0b2b('0x55')](_0x121717[_0x0b2b('0xa3')])&&this[_0x0b2b('0x55')](_0x121717[_0x0b2b('0xa3')]['queueposition'])){if(!_0x5a6a2e[_0x0b2b('0x1c')]){_0x5a6a2e[_0x0b2b('0x32')]=!![];_0x5a6a2e[_0x0b2b('0x8e')]=moment()['format'](_0x0b2b('0x80'));_0x5a6a2e[_0x0b2b('0x4e')]='EXITWITHKEY';_0x5a6a2e[_0x0b2b('0x85')]=moment()[_0x0b2b('0x47')](_0x0b2b('0x80'));this[_0x0b2b('0x35')][_0x121717[_0x0b2b('0x4d')]]=_0x5a6a2e;}}logger[_0x0b2b('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x121717['uniqueid'],_0x5a6a2e[_0x0b2b('0x49')],_0x5a6a2e[_0x0b2b('0x66')],_[_0x0b2b('0xa1')](_0x121717['variable'])[0x0],_0x121717[_0x0b2b('0xa2')]);_0x5a6a2e[_0x0b2b('0x16')]=this[_0x0b2b('0x16')][_0x121717[_0x0b2b('0x4d')]];}}}}catch(_0x3547f0){logger[_0x0b2b('0x3d')](_0x0b2b('0xa9'),_0x121717[_0x0b2b('0x4d')],util['inspect'](_0x3547f0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x0b2b('0xa')][_0x0b2b('0xa0')]=function(_0x362ce2,_0x573112,_0x3d4e76){var _0x2d6f52=[_0x0b2b('0xaa'),_0x0b2b('0xab'),_0x0b2b('0xac'),'rtpaudioqosjitterbridged',_0x0b2b('0xad'),_0x0b2b('0xae'),_0x0b2b('0xaf'),'rtpaudioqosrttbridged',_0x0b2b('0xb0'),_0x0b2b('0xb1'),_0x0b2b('0xb2'),_0x0b2b('0xb3'),'membercalls','memberdynamic',_0x0b2b('0xb4'),_0x0b2b('0xb5'),_0x0b2b('0xb6'),_0x0b2b('0xb7'),'memberrealtime'];if(!_[_0x0b2b('0xb8')](_0x573112)&&!_[_0x0b2b('0xb9')](_0x2d6f52,_0x573112)){if(_[_0x0b2b('0x56')](this[_0x0b2b('0x16')][_0x362ce2])){this[_0x0b2b('0x16')][_0x362ce2]={};}this[_0x0b2b('0x16')][_0x362ce2][_0x573112]=_0x3d4e76;}};VoiceQueueReport['prototype']['handleHangup']=function(_0x2e8149,_0x4ce2a5,_0x3e299f){try{var _0xe9ddb={};if(this[_0x0b2b('0xf')][_0x2e8149]){for(var _0x2aab18=0x0;_0x2aab18=0x0?moment(_0x34a867[_0x8004('0x1b')])['diff'](_0x34a867[_0x8004('0x1a')],_0x8004('0x1c')):null,'data1':_0x8004('0x1d'),'data2':_0x34a867['accountcode'],'data3':_0x34a867['exten'],'data4':_0x34a867[_0x8004('0x1e')]||null,'role':_0x8004('0x14'),'internal':_0x34a867[_0x8004('0x15')]?_[_0x8004('0x1f')](_0x34a867[_0x8004('0x15')]):undefined,'uniqueid':_0x34a867[_0x8004('0x16')]},'log':_0x8004('0x7')});}; \ No newline at end of file +var _0x7f5b=['voiceDialReport','starttime','endtime','outbound','dialstring','agent','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','accountcode','toNumber','uniqueid'];(function(_0xc26b63,_0x15d609){var _0x5595b0=function(_0x395b65){while(--_0x395b65){_0xc26b63['push'](_0xc26b63['shift']());}};_0x5595b0(++_0x15d609);}(_0x7f5b,0x82));var _0xb7f5=function(_0x105278,_0x774ed2){_0x105278=_0x105278-0x0;var _0x47b1f=_0x7f5b[_0x105278];return _0x47b1f;};'use strict';var moment=require(_0xb7f5('0x0'));var _=require(_0xb7f5('0x1'));var util=require(_0xb7f5('0x2'));var client=require(_0xb7f5('0x3'));exports[_0xb7f5('0x4')]=function(_0x4f678a){var _0x3b6650=_0x4f678a[_0xb7f5('0x5')]||_0x4f678a[_0xb7f5('0x6')];return client[_0xb7f5('0x7')](_0xb7f5('0x8'),{'body':{'channel':'voice','membername':_0x4f678a[_0xb7f5('0x9')],'interface':_[_0xb7f5('0xa')](_0x4f678a[_0xb7f5('0xb')])?util[_0xb7f5('0xc')](_0xb7f5('0xd'),_0x4f678a['lastAssignedTo']):_0x4f678a['interface'],'type':_0xb7f5('0xe'),'enterAt':_0x4f678a['queuecallerleaveAt'],'exitAt':_0x3b6650,'duration':moment(_0x3b6650)[_0xb7f5('0xf')](_0x4f678a[_0xb7f5('0x10')],_0xb7f5('0x11')),'data1':_0xb7f5('0x12'),'data2':_0x4f678a[_0xb7f5('0x13')],'data3':_0x4f678a[_0xb7f5('0x14')],'data4':null,'data5':_0x4f678a[_0xb7f5('0x15')],'role':'agent','internal':_0x4f678a[_0xb7f5('0x16')]?_[_0xb7f5('0x17')](_0x4f678a[_0xb7f5('0x16')]):undefined,'uniqueid':_0x4f678a[_0xb7f5('0x18')]},'log':'CreateMemberReport'});};exports[_0xb7f5('0x19')]=function(_0x14de48){return client[_0xb7f5('0x7')](_0xb7f5('0x8'),{'body':{'channel':'voice','membername':_0x14de48['membername'],'interface':_0x14de48['interface'],'type':_0xb7f5('0xe'),'enterAt':_0x14de48[_0xb7f5('0x1a')],'exitAt':_0x14de48[_0xb7f5('0x1b')],'duration':moment(_0x14de48[_0xb7f5('0x1b')])[_0xb7f5('0xf')](_0x14de48[_0xb7f5('0x1a')],_0xb7f5('0x11'))>=0x0?moment(_0x14de48[_0xb7f5('0x1b')])[_0xb7f5('0xf')](_0x14de48[_0xb7f5('0x1a')],_0xb7f5('0x11')):null,'data1':_0xb7f5('0x1c'),'data2':_0x14de48[_0xb7f5('0x16')],'data3':_0x14de48['exten'],'data4':_0x14de48[_0xb7f5('0x1d')]||null,'role':_0xb7f5('0x1e'),'internal':_0x14de48[_0xb7f5('0x16')]?_[_0xb7f5('0x17')](_0x14de48['accountcode']):undefined,'uniqueid':_0x14de48[_0xb7f5('0x18')]},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index f2fedc4..1a299ec 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 _0xdacc=['Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','getSettings'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var client=require('../client');exports[_0xcdac('0x0')]=function(){return client[_0xcdac('0x1')](_0xcdac('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xcdac('0x3'),_0xcdac('0x4')]},'log':_0xcdac('0x5')});}; \ No newline at end of file +var _0x8829=['../client','Request','ShowSetting','previewRecallmeReminderInterval','GetSettings'];(function(_0x234545,_0x17b059){var _0x46159b=function(_0xd4536b){while(--_0xd4536b){_0x234545['push'](_0x234545['shift']());}};_0x46159b(++_0x17b059);}(_0x8829,0x195));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x9882('0x0'));exports['getSettings']=function(){return client[_0x9882('0x1')](_0x9882('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x9882('0x3')]},'log':_0x9882('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2658e2a..536363d 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 _0x8102=['html','../client','getTemplates','Request','GetTemplate'];(function(_0x2b6a9b,_0x1ad658){var _0x5be05e=function(_0x5df437){while(--_0x5df437){_0x2b6a9b['push'](_0x2b6a9b['shift']());}};_0x5be05e(++_0x1ad658);}(_0x8102,0x9c));var _0x2810=function(_0x6be491,_0x3a7fc9){_0x6be491=_0x6be491-0x0;var _0x34a643=_0x8102[_0x6be491];return _0x34a643;};'use strict';var client=require(_0x2810('0x0'));exports[_0x2810('0x1')]=function(_0x5ad42e){return function(_0x317be0){return client[_0x2810('0x2')](_0x2810('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x2810('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file +var _0x39be=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x39be,0x19a));var _0xe39b=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x39be[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0xe39b('0x0'));exports[_0xe39b('0x1')]=function(_0x386194){return function(_0x482024){return client[_0xe39b('0x2')](_0xe39b('0x3'),{'options':{'raw':!![],'attributes':['id',_0xe39b('0x4'),_0xe39b('0x5')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 0e0b8ac..81cffab 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 _0x82d8=['GetTrigger','name','channel','Condition','AllConditions','field','operator','value','AnyConditions','Actions','data1','data2','data3','data5','data6','data7','../client','getTriggers','Request'];(function(_0x37eba8,_0x1d5705){var _0x5133d2=function(_0x7db42e){while(--_0x7db42e){_0x37eba8['push'](_0x37eba8['shift']());}};_0x5133d2(++_0x1d5705);}(_0x82d8,0x140));var _0x882d=function(_0x5baa1a,_0x5c1421){_0x5baa1a=_0x5baa1a-0x0;var _0x52bf00=_0x82d8[_0x5baa1a];return _0x52bf00;};'use strict';var client=require(_0x882d('0x0'));exports[_0x882d('0x1')]=function(_0xc3162f){return function(_0x50d801){return client[_0x882d('0x2')](_0x882d('0x3'),{'options':{'raw':![],'attributes':['id',_0x882d('0x4'),_0x882d('0x5'),'status'],'include':[{'model':_0x882d('0x6'),'as':_0x882d('0x7'),'attributes':['id',_0x882d('0x8'),_0x882d('0x9'),_0x882d('0xa')]},{'model':_0x882d('0x6'),'as':_0x882d('0xb'),'attributes':['id',_0x882d('0x8'),_0x882d('0x9'),_0x882d('0xa')]},{'model':'Action','as':_0x882d('0xc'),'attributes':['id','action',_0x882d('0xd'),_0x882d('0xe'),_0x882d('0xf'),'data4',_0x882d('0x10'),_0x882d('0x11'),_0x882d('0x12')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x5bc9=['operator','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','GetTrigger','name','Condition','AllConditions','field','value'];(function(_0x385ca8,_0x3a1d42){var _0x202b9f=function(_0x275cb2){while(--_0x275cb2){_0x385ca8['push'](_0x385ca8['shift']());}};_0x202b9f(++_0x3a1d42);}(_0x5bc9,0x161));var _0x95bc=function(_0x3c4a10,_0x19cf73){_0x3c4a10=_0x3c4a10-0x0;var _0x14f56d=_0x5bc9[_0x3c4a10];return _0x14f56d;};'use strict';var client=require(_0x95bc('0x0'));exports[_0x95bc('0x1')]=function(_0x3255dc){return function(_0x35e5b1){return client['Request'](_0x95bc('0x2'),{'options':{'raw':![],'attributes':['id',_0x95bc('0x3'),'channel','status'],'include':[{'model':_0x95bc('0x4'),'as':_0x95bc('0x5'),'attributes':['id',_0x95bc('0x6'),'operator',_0x95bc('0x7')]},{'model':_0x95bc('0x4'),'as':'AnyConditions','attributes':['id',_0x95bc('0x6'),_0x95bc('0x8'),_0x95bc('0x7')]},{'model':_0x95bc('0x9'),'as':_0x95bc('0xa'),'attributes':['id',_0x95bc('0xb'),_0x95bc('0xc'),_0x95bc('0xd'),_0x95bc('0xe'),_0x95bc('0xf'),_0x95bc('0x10'),_0x95bc('0x11'),_0x95bc('0x12')]}]},'log':_0x95bc('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 136980e..c13e929 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 _0x9bf9=['GetTrunk','name','registry','defaultuser','../client'];(function(_0x55e0e3,_0x1081a6){var _0x97dab=function(_0x14087a){while(--_0x14087a){_0x55e0e3['push'](_0x55e0e3['shift']());}};_0x97dab(++_0x1081a6);}(_0x9bf9,0xe5));var _0x99bf=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9bf9[_0x550d12];return _0x12103d;};'use strict';var client=require(_0x99bf('0x0'));exports['getTrunks']=function(_0x3907eb){return function(_0x17ccb9){return client['Request'](_0x99bf('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x99bf('0x2'),_0x99bf('0x3'),_0x99bf('0x4')]},'log':_0x99bf('0x1')});};}; \ No newline at end of file +var _0xbf94=['GetTrunk','registry','../client','getTrunks'];(function(_0x2eca40,_0x113232){var _0x482e92=function(_0x368982){while(--_0x368982){_0x2eca40['push'](_0x2eca40['shift']());}};_0x482e92(++_0x113232);}(_0xbf94,0x146));var _0x4bf9=function(_0x31fbc2,_0x432efd){_0x31fbc2=_0x31fbc2-0x0;var _0xf5d06a=_0xbf94[_0x31fbc2];return _0xf5d06a;};'use strict';var client=require(_0x4bf9('0x0'));exports[_0x4bf9('0x1')]=function(_0x9cb451){return function(_0x1a74dc){return client['Request'](_0x4bf9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x4bf9('0x3'),'defaultuser']},'log':_0x4bf9('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index f9a3235..a27da53 100644 --- a/server/services/ami/rpc/user.js +++ b/server/services/ami/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x30e2ac,_0x337f0f){var _0x3e56e9=function(_0x4a7322){while(--_0x4a7322){_0x30e2ac['push'](_0x30e2ac['shift']());}};_0x3e56e9(++_0x337f0f);}(_0x70e0,0x17b));var _0x070e=function(_0x1d3bfb,_0x3cc617){_0x1d3bfb=_0x1d3bfb-0x0;var _0x31469e=_0x70e0[_0x1d3bfb];return _0x31469e;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 0ca3aad..afc1d67 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 _0x7417=['Request','UpdateVoiceAgentReport','../client','CreateVoiceAgentReport','update'];(function(_0x109946,_0x3494b7){var _0x4ed20b=function(_0x578aa4){while(--_0x578aa4){_0x109946['push'](_0x109946['shift']());}};_0x4ed20b(++_0x3494b7);}(_0x7417,0x1d8));var _0x7741=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7417[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x7741('0x0'));exports['create']=function(_0x581438){return client['Request'](_0x7741('0x1'),{'body':_0x581438,'log':_0x7741('0x1')});};exports[_0x7741('0x2')]=function(_0x10193d,_0xc32a03,_0x37979f){return client[_0x7741('0x3')](_0x7741('0x4'),{'body':_0x10193d,'options':{'where':{'uniqueid':_0xc32a03,'interface':_0x37979f,'agentcomplete':!![]}},'log':_0x7741('0x4')});}; \ No newline at end of file +var _0xa8b6=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0x4a1e77,_0x67f54c){var _0x154b3a=function(_0x299114){while(--_0x299114){_0x4a1e77['push'](_0x4a1e77['shift']());}};_0x154b3a(++_0x67f54c);}(_0xa8b6,0x1ec));var _0x6a8b=function(_0x39ac67,_0x50a474){_0x39ac67=_0x39ac67-0x0;var _0x4e3649=_0xa8b6[_0x39ac67];return _0x4e3649;};'use strict';var client=require(_0x6a8b('0x0'));exports[_0x6a8b('0x1')]=function(_0x3bd631){return client[_0x6a8b('0x2')](_0x6a8b('0x3'),{'body':_0x3bd631,'log':_0x6a8b('0x3')});};exports['update']=function(_0x20308f,_0x338174,_0x20cc71){return client[_0x6a8b('0x2')](_0x6a8b('0x4'),{'body':_0x20308f,'options':{'where':{'uniqueid':_0x338174,'interface':_0x20cc71,'agentcomplete':!![]}},'log':_0x6a8b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2025a55..c2d7c70 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 _0x074b=['getVoiceCallReports','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','duration','billableseconds','GetVoiceCallReports','moment','create','CreateVoiceCallReport','merge','calleridnum','context','callerid'];(function(_0x35d60f,_0x1995b7){var _0x2a43db=function(_0x54b6dd){while(--_0x54b6dd){_0x35d60f['push'](_0x35d60f['shift']());}};_0x2a43db(++_0x1995b7);}(_0x074b,0x1df));var _0xb074=function(_0x6635d2,_0x202128){_0x6635d2=_0x6635d2-0x0;var _0x34ae8f=_0x074b[_0x6635d2];return _0x34ae8f;};'use strict';var moment=require(_0xb074('0x0'));var util=require('util');var _=require('lodash');var client=require('../client');exports[_0xb074('0x1')]=function(_0x5dc3a1){return client['Request'](_0xb074('0x2'),{'body':_[_0xb074('0x3')](_0x5dc3a1,{'source':_0x5dc3a1[_0xb074('0x4')],'destinationcontext':_0x5dc3a1[_0xb074('0x5')],'callerid':_0x5dc3a1[_0xb074('0x6')],'amaflags':'DOCUMENTATION'}),'log':_0xb074('0x2')});};exports[_0xb074('0x7')]=function(){return function(){return client[_0xb074('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0xb074('0x9')],'createdAt':{'$between':[moment()[_0xb074('0xa')](_0xb074('0xb'))[_0xb074('0xc')](_0xb074('0xd')),moment()['endOf'](_0xb074('0xb'))[_0xb074('0xc')](_0xb074('0xd'))]}},'attributes':[_0xb074('0xe'),'disposition',_0xb074('0xf'),_0xb074('0x10')]},'log':_0xb074('0x11')});};}; \ No newline at end of file +var _0xbec3=['util','lodash','../client','create','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','GetVoiceCallReports','moment'];(function(_0x2bfa61,_0x3dca75){var _0x321ba0=function(_0x9291a1){while(--_0x9291a1){_0x2bfa61['push'](_0x2bfa61['shift']());}};_0x321ba0(++_0x3dca75);}(_0xbec3,0x68));var _0x3bec=function(_0x357b23,_0x2d30e5){_0x357b23=_0x357b23-0x0;var _0x5c11a9=_0xbec3[_0x357b23];return _0x5c11a9;};'use strict';var moment=require(_0x3bec('0x0'));var util=require(_0x3bec('0x1'));var _=require(_0x3bec('0x2'));var client=require(_0x3bec('0x3'));exports[_0x3bec('0x4')]=function(_0x21f7fc){return client['Request']('CreateVoiceCallReport',{'body':_[_0x3bec('0x5')](_0x21f7fc,{'source':_0x21f7fc[_0x3bec('0x6')],'destinationcontext':_0x21f7fc['context'],'callerid':_0x21f7fc['callerid'],'amaflags':_0x3bec('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x3bec('0x8')]=function(){return function(){return client[_0x3bec('0x9')](_0x3bec('0xa'),{'options':{'where':{'type':[_0x3bec('0xb')],'createdAt':{'$between':[moment()[_0x3bec('0xc')](_0x3bec('0xd'))[_0x3bec('0xe')](_0x3bec('0xf')),moment()[_0x3bec('0x10')](_0x3bec('0xd'))['format'](_0x3bec('0xf'))]}},'attributes':[_0x3bec('0x11'),_0x3bec('0x12'),_0x3bec('0x13'),'billableseconds']},'log':_0x3bec('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index fe3f5e6..9b5f4bc 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 _0x53ad=['../client','create','Request'];(function(_0x326a44,_0x41c393){var _0x218e10=function(_0x4ef0a6){while(--_0x4ef0a6){_0x326a44['push'](_0x326a44['shift']());}};_0x218e10(++_0x41c393);}(_0x53ad,0x1e0));var _0xd53a=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x53ad[_0x23e7c1];return _0x1add43;};'use strict';var client=require(_0xd53a('0x0'));exports[_0xd53a('0x1')]=function(_0x4296dd){return client[_0xd53a('0x2')]('CreateVoiceDialReport',{'body':_0x4296dd,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0xeaf3=['create','Request','CreateVoiceDialReport'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xeaf3,0xde));var _0x3eaf=function(_0x48a0f6,_0x97bf10){_0x48a0f6=_0x48a0f6-0x0;var _0x59d3d9=_0xeaf3[_0x48a0f6];return _0x59d3d9;};'use strict';var client=require('../client');exports[_0x3eaf('0x0')]=function(_0x4377be){return client[_0x3eaf('0x1')](_0x3eaf('0x2'),{'body':_0x4377be,'log':_0x3eaf('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index e8fa43d..01bab9d 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 _0x1123=['Request','exten','recordingFormat','getVoiceExtensions'];(function(_0x44aad3,_0xaef2a){var _0x257efd=function(_0x47dadd){while(--_0x47dadd){_0x44aad3['push'](_0x44aad3['shift']());}};_0x257efd(++_0xaef2a);}(_0x1123,0x118));var _0x3112=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x1123[_0x138adb];return _0x1b27f2;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x3112('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3112('0x1'),_0x3112('0x2')],'where':{'VoiceExtensionId':null}},'log':_0x3112('0x3')});};}; \ No newline at end of file +var _0xc686=['getVoiceExtensions','Request','exten'];(function(_0x27374e,_0x2c5cb3){var _0x5065f8=function(_0x5627a9){while(--_0x5627a9){_0x27374e['push'](_0x27374e['shift']());}};_0x5065f8(++_0x2c5cb3);}(_0xc686,0x148));var _0x6c68=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xc686[_0x491a7f];return _0x3d8f44;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x6c68('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x6c68('0x1'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x6c68('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index bc4c7b0..ae9ee30 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 _0xbf5c=['dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','Pause','TrunkBackup','active','Interval','Intervals','interval','../client','getVoiceQueues','Request','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDSilenceThreshold','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold'];(function(_0x2924d3,_0x43216b){var _0x4be4e4=function(_0x57446b){while(--_0x57446b){_0x2924d3['push'](_0x2924d3['shift']());}};_0x4be4e4(++_0x43216b);}(_0xbf5c,0xb8));var _0xcbf5=function(_0x56af27,_0x4331fe){_0x56af27=_0x56af27-0x0;var _0x12e0a7=_0xbf5c[_0x56af27];return _0x12e0a7;};'use strict';var client=require(_0xcbf5('0x0'));exports[_0xcbf5('0x1')]=function(){return function(){return client[_0xcbf5('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xcbf5('0x3'),_0xcbf5('0x4'),_0xcbf5('0x5'),'autopause',_0xcbf5('0x6'),_0xcbf5('0x7'),'dialActive',_0xcbf5('0x8'),_0xcbf5('0x9'),_0xcbf5('0xa'),'dialPowerLevel',_0xcbf5('0xb'),_0xcbf5('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0xcbf5('0xd'),_0xcbf5('0xe'),_0xcbf5('0xf'),'dialQueueTimeout',_0xcbf5('0x10'),_0xcbf5('0x11'),_0xcbf5('0x12'),_0xcbf5('0x13'),_0xcbf5('0x14'),_0xcbf5('0x15'),'dialNoAnswerRetryFrequency',_0xcbf5('0x16'),_0xcbf5('0x17'),_0xcbf5('0x18'),'dialPrefix','dialCheckDuplicateType',_0xcbf5('0x19'),'dialAMDInitialSilence',_0xcbf5('0x1a'),_0xcbf5('0x1b'),_0xcbf5('0x1c'),_0xcbf5('0x1d'),'dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xcbf5('0x1e'),'dialAMDMaximumWordLength',_0xcbf5('0x1f'),'dialRecallMeTimeout','dialRecallInQueue',_0xcbf5('0x20'),_0xcbf5('0x21'),_0xcbf5('0x22'),_0xcbf5('0x23'),_0xcbf5('0x6'),_0xcbf5('0x24'),_0xcbf5('0x25'),'dialCutDigit',_0xcbf5('0x26'),_0xcbf5('0x27'),_0xcbf5('0x28'),_0xcbf5('0x29'),_0xcbf5('0x2a'),_0xcbf5('0x2b'),_0xcbf5('0x2c'),_0xcbf5('0x2d'),'dialAgentRejectMaxRetry',_0xcbf5('0x2e'),'mandatoryDisposition',_0xcbf5('0x2f'),'dialPredictiveIntervalMinThreshold',_0xcbf5('0x30'),_0xcbf5('0x31')],'include':[{'model':_0xcbf5('0x32'),'as':_0xcbf5('0x32'),'attributes':['id',_0xcbf5('0x3'),_0xcbf5('0x33'),'active']},{'model':_0xcbf5('0x34'),'as':'mandatoryDispositionPause','attributes':['id',_0xcbf5('0x3')]},{'model':_0xcbf5('0x32'),'as':_0xcbf5('0x35'),'attributes':['id',_0xcbf5('0x3'),'callerid',_0xcbf5('0x36')]},{'model':_0xcbf5('0x37'),'as':_0xcbf5('0x37'),'attributes':['id',_0xcbf5('0x3')],'include':[{'model':_0xcbf5('0x37'),'as':_0xcbf5('0x38'),'attributes':['id',_0xcbf5('0x3'),_0xcbf5('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x74a8=['Trunk','callerid','active','Pause','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','monitor_format','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74a8,0x135));var _0x874a=function(_0x35a070,_0x99e0c1){_0x35a070=_0x35a070-0x0;var _0x28438c=_0x74a8[_0x35a070];return _0x28438c;};'use strict';var client=require(_0x874a('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x874a('0x1')](_0x874a('0x2'),{'options':{'raw':![],'attributes':['id',_0x874a('0x3'),_0x874a('0x4'),_0x874a('0x5'),'autopause',_0x874a('0x6'),'type',_0x874a('0x7'),_0x874a('0x8'),_0x874a('0x9'),'dialLimitQueue',_0x874a('0xa'),_0x874a('0xb'),_0x874a('0xc'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x874a('0xd'),_0x874a('0xe'),_0x874a('0xf'),_0x874a('0x10'),_0x874a('0x11'),_0x874a('0x12'),_0x874a('0x13'),'dialBusyMaxRetry',_0x874a('0x14'),_0x874a('0x15'),'dialNoAnswerRetryFrequency',_0x874a('0x16'),_0x874a('0x17'),_0x874a('0x18'),_0x874a('0x19'),_0x874a('0x1a'),'dialAMDActive',_0x874a('0x1b'),_0x874a('0x1c'),_0x874a('0x1d'),'dialAMDTotalAnalysisTime',_0x874a('0x1e'),_0x874a('0x1f'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x874a('0x20'),_0x874a('0x21'),'dialRecallMeTimeout','dialRecallInQueue',_0x874a('0x22'),_0x874a('0x23'),_0x874a('0x24'),_0x874a('0x25'),_0x874a('0x6'),_0x874a('0x26'),'dialRandomLastDigitCallerIdNumber',_0x874a('0x27'),_0x874a('0x28'),_0x874a('0x29'),_0x874a('0x2a'),_0x874a('0x2b'),_0x874a('0x2c'),_0x874a('0x2d'),_0x874a('0x2e'),_0x874a('0x2f'),_0x874a('0x30'),'dialAgentRejectRetryFrequency',_0x874a('0x31'),'dialPredictiveIntervalMaxThreshold',_0x874a('0x32'),'dialPreviewAutoRecallMe','dialPreviewRecallmeReminder'],'include':[{'model':'Trunk','as':_0x874a('0x33'),'attributes':['id',_0x874a('0x3'),_0x874a('0x34'),_0x874a('0x35')]},{'model':_0x874a('0x36'),'as':'mandatoryDispositionPause','attributes':['id',_0x874a('0x3')]},{'model':_0x874a('0x33'),'as':_0x874a('0x37'),'attributes':['id',_0x874a('0x3'),'callerid',_0x874a('0x35')]},{'model':'Interval','as':_0x874a('0x38'),'attributes':['id','name'],'include':[{'model':_0x874a('0x38'),'as':_0x874a('0x39'),'attributes':['id',_0x874a('0x3'),_0x874a('0x3a')]}]}]},'log':_0x874a('0x3b')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index ad63166..6646737 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(_0x4b978a,_0x472e65){var _0x2dbd2c=function(_0x18be84){while(--_0x18be84){_0x4b978a['push'](_0x4b978a['shift']());}};_0x2dbd2c(++_0x472e65);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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(_0x4b8e01,_0x263f6a){var _0x240873=function(_0x2c6e76){while(--_0x2c6e76){_0x4b8e01['push'](_0x4b8e01['shift']());}};_0x240873(++_0x263f6a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 9e669b1..299e050 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 _0xcd1f=['../client','Request','GetVoiceQueueRtPauses'];(function(_0x5794c4,_0x309b7a){var _0x537506=function(_0x5d5009){while(--_0x5d5009){_0x5794c4['push'](_0x5794c4['shift']());}};_0x537506(++_0x309b7a);}(_0xcd1f,0x1cb));var _0xfcd1=function(_0x3df068,_0x2b6498){_0x3df068=_0x3df068-0x0;var _0x595863=_0xcd1f[_0x3df068];return _0x595863;};'use strict';var client=require(_0xfcd1('0x0'));exports['getVoiceQueueRtPauses']=function(_0x29538b){return function(){return client[_0xfcd1('0x1')](_0xfcd1('0x2'),{'options':{'where':{'VoiceQueueId':_0x29538b,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x66f8=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses','../client'];(function(_0x521897,_0x37a068){var _0x371b73=function(_0x289d71){while(--_0x289d71){_0x521897['push'](_0x521897['shift']());}};_0x371b73(++_0x37a068);}(_0x66f8,0xcb));var _0x866f=function(_0xac0ebc,_0x2265d5){_0xac0ebc=_0xac0ebc-0x0;var _0x3cae5b=_0x66f8[_0xac0ebc];return _0x3cae5b;};'use strict';var client=require(_0x866f('0x0'));exports['getVoiceQueueRtPauses']=function(_0x128327){return function(){return client[_0x866f('0x1')](_0x866f('0x2'),{'options':{'where':{'VoiceQueueId':_0x128327,'paused':!![]},'raw':!![]},'log':_0x866f('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 0c360da..be1f980 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x33f288,_0x29cf39){var _0x4a4236=function(_0x3efd44){while(--_0x3efd44){_0x33f288['push'](_0x33f288['shift']());}};_0x4a4236(++_0x29cf39);}(_0x7a54,0x106));var _0x47a5=function(_0xc9674,_0x1db652){_0xc9674=_0xc9674-0x0;var _0x462351=_0x7a54[_0xc9674];return _0x462351;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x872d10,_0x119013){var _0x13eb4a=function(_0x6339ab){while(--_0x6339ab){_0x872d10['push'](_0x872d10['shift']());}};_0x13eb4a(++_0x119013);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 364d09d..58d2048 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 _0x20f3=['transfereelinkedid','isexternal','context','extension','blind','attendedTransfer','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereeexten'];(function(_0x276d59,_0xf8c2e5){var _0xfc7a62=function(_0x422394){while(--_0x422394){_0x276d59['push'](_0x276d59['shift']());}};_0xfc7a62(++_0xf8c2e5);}(_0x20f3,0x68));var _0x320f=function(_0x26efac,_0x21ab8a){_0x26efac=_0x26efac-0x0;var _0x8482e4=_0x20f3[_0x26efac];return _0x8482e4;};'use strict';var client=require(_0x320f('0x0'));exports[_0x320f('0x1')]={};exports[_0x320f('0x2')]=function(_0x55b313){return client[_0x320f('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x55b313[_0x320f('0x4')],'transfererchannel':_0x55b313[_0x320f('0x5')],'transferercalleridnum':_0x55b313[_0x320f('0x6')],'transferercalleridname':_0x55b313[_0x320f('0x7')],'transfererconnectedlinenum':_0x55b313[_0x320f('0x8')],'transfererconnectedlinename':_0x55b313[_0x320f('0x9')],'transfereraccountcode':_0x55b313['transfereraccountcode'],'transferercontext':_0x55b313['transferercontext'],'transfererexten':_0x55b313[_0x320f('0xa')],'transfererlinkedid':_0x55b313[_0x320f('0xb')],'transfereechannel':_0x55b313[_0x320f('0xc')],'transfereecalleridnum':_0x55b313[_0x320f('0xd')],'transfereecalleridname':_0x55b313[_0x320f('0xe')],'transfereeconnectedlinenum':_0x55b313[_0x320f('0xf')],'transfereeconnectedlinename':_0x55b313[_0x320f('0x10')],'transfereeaccountcode':_0x55b313['transfereeaccountcode'],'transfereecontext':_0x55b313[_0x320f('0x11')],'transfereeexten':_0x55b313[_0x320f('0x12')],'transfereelinkedid':_0x55b313[_0x320f('0x13')],'isexternal':_0x55b313[_0x320f('0x14')],'context':_0x55b313[_0x320f('0x15')],'extension':_0x55b313[_0x320f('0x16')],'type':_0x320f('0x17')},'log':'CreateVoiceTransferReport'});};exports[_0x320f('0x18')]=function(_0x5b312c){return client[_0x320f('0x3')](_0x320f('0x19'),{'body':{'result':_0x5b312c['result'],'transfererchannel':_0x5b312c[_0x320f('0x1a')],'transferercalleridnum':_0x5b312c[_0x320f('0x1b')],'transferercalleridname':_0x5b312c[_0x320f('0x1c')],'transfererconnectedlinenum':_0x5b312c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x5b312c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x5b312c[_0x320f('0x1d')],'transferercontext':_0x5b312c[_0x320f('0x1e')],'transfererexten':_0x5b312c[_0x320f('0x1f')],'transfererlinkedid':_0x5b312c['origtransfererlinkedid'],'transfereechannel':_0x5b312c[_0x320f('0x20')],'transfereecalleridnum':_0x5b312c['transfertargetcalleridnum'],'transfereecalleridname':_0x5b312c[_0x320f('0x21')],'transfereeconnectedlinenum':_0x5b312c[_0x320f('0x22')],'transfereeconnectedlinename':_0x5b312c['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5b312c['transfertargetaccountcode'],'transfereecontext':_0x5b312c[_0x320f('0x23')],'transfereeexten':_0x5b312c[_0x320f('0x24')],'transfereelinkedid':_0x5b312c[_0x320f('0x25')],'isexternal':_0x5b312c[_0x320f('0x14')],'context':_0x5b312c[_0x320f('0x26')],'extension':_0x5b312c[_0x320f('0x27')],'type':_0x320f('0x28')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file +var _0x8447=['transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','blind','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum'];(function(_0x459df6,_0x41c5f5){var _0x487ac7=function(_0x5737a2){while(--_0x5737a2){_0x459df6['push'](_0x459df6['shift']());}};_0x487ac7(++_0x41c5f5);}(_0x8447,0x120));var _0x7844=function(_0x17e7ee,_0x5a726f){_0x17e7ee=_0x17e7ee-0x0;var _0x450106=_0x8447[_0x17e7ee];return _0x450106;};'use strict';var client=require(_0x7844('0x0'));exports[_0x7844('0x1')]={};exports[_0x7844('0x2')]=function(_0x4c9e9f){return client[_0x7844('0x3')](_0x7844('0x4'),{'body':{'result':_0x4c9e9f[_0x7844('0x5')],'transfererchannel':_0x4c9e9f['transfererchannel'],'transferercalleridnum':_0x4c9e9f['transferercalleridnum'],'transferercalleridname':_0x4c9e9f[_0x7844('0x6')],'transfererconnectedlinenum':_0x4c9e9f[_0x7844('0x7')],'transfererconnectedlinename':_0x4c9e9f[_0x7844('0x8')],'transfereraccountcode':_0x4c9e9f[_0x7844('0x9')],'transferercontext':_0x4c9e9f['transferercontext'],'transfererexten':_0x4c9e9f[_0x7844('0xa')],'transfererlinkedid':_0x4c9e9f[_0x7844('0xb')],'transfereechannel':_0x4c9e9f[_0x7844('0xc')],'transfereecalleridnum':_0x4c9e9f[_0x7844('0xd')],'transfereecalleridname':_0x4c9e9f[_0x7844('0xe')],'transfereeconnectedlinenum':_0x4c9e9f[_0x7844('0xf')],'transfereeconnectedlinename':_0x4c9e9f[_0x7844('0x10')],'transfereeaccountcode':_0x4c9e9f[_0x7844('0x11')],'transfereecontext':_0x4c9e9f[_0x7844('0x12')],'transfereeexten':_0x4c9e9f[_0x7844('0x13')],'transfereelinkedid':_0x4c9e9f[_0x7844('0x14')],'isexternal':_0x4c9e9f[_0x7844('0x15')],'context':_0x4c9e9f['context'],'extension':_0x4c9e9f['extension'],'type':_0x7844('0x16')},'log':'CreateVoiceTransferReport'});};exports[_0x7844('0x17')]=function(_0x441361){return client[_0x7844('0x3')](_0x7844('0x4'),{'body':{'result':_0x441361['result'],'transfererchannel':_0x441361['origtransfererchannel'],'transferercalleridnum':_0x441361[_0x7844('0x18')],'transferercalleridname':_0x441361[_0x7844('0x19')],'transfererconnectedlinenum':_0x441361['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x441361[_0x7844('0x1a')],'transfereraccountcode':_0x441361[_0x7844('0x1b')],'transferercontext':_0x441361['secondtransferercontext'],'transfererexten':_0x441361[_0x7844('0x1c')],'transfererlinkedid':_0x441361[_0x7844('0x1d')],'transfereechannel':_0x441361[_0x7844('0x1e')],'transfereecalleridnum':_0x441361[_0x7844('0x1f')],'transfereecalleridname':_0x441361[_0x7844('0x20')],'transfereeconnectedlinenum':_0x441361[_0x7844('0x21')],'transfereeconnectedlinename':_0x441361['transfertargetconnectedlinename'],'transfereeaccountcode':_0x441361[_0x7844('0x22')],'transfereecontext':_0x441361['transfertargetcontext'],'transfereeexten':_0x441361['transfertargetexten'],'transfereelinkedid':_0x441361[_0x7844('0x23')],'isexternal':_0x441361[_0x7844('0x15')],'context':_0x441361[_0x7844('0x24')],'extension':_0x441361[_0x7844('0x25')],'type':'attended'},'log':_0x7844('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 9d616a7..de9306c 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x4feaac,_0x11df12){var _0x5e5565=function(_0x200c05){while(--_0x200c05){_0x4feaac['push'](_0x4feaac['shift']());}};_0x5e5565(++_0x11df12);}(_0xb10b,0x12a));var _0xbb10=function(_0x13c5a9,_0x95fb6a){_0x13c5a9=_0x13c5a9-0x0;var _0x393ee6=_0xb10b[_0x13c5a9];return _0x393ee6;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x4c41f5,_0x5503ad){var _0x237d84=function(_0x4c1a66){while(--_0x4c1a66){_0x4c41f5['push'](_0x4c41f5['shift']());}};_0x237d84(++_0x5503ad);}(_0x7a54,0x106));var _0x47a5=function(_0xfe071c,_0x286ef0){_0xfe071c=_0xfe071c-0x0;var _0x115edc=_0x7a54[_0xfe071c];return _0x115edc;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index fcd9107..a950bc4 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 _0xea0c=['join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','action','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','stringify','emit','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','scheduledAt','updatedAt','union','resolve','then','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x45ccd2,_0x4ecb10){var _0x554dff=function(_0x2f9bea){while(--_0x2f9bea){_0x45ccd2['push'](_0x45ccd2['shift']());}};_0x554dff(++_0x4ecb10);}(_0xea0c,0x14e));var _0xcea0=function(_0x3f607e,_0x2648c5){_0x3f607e=_0x3f607e-0x0;var _0x2e1ad7=_0xea0c[_0x3f607e];return _0x2e1ad7;};'use strict';var _=require(_0xcea0('0x0'));var BPromise=require(_0xcea0('0x1'));var Redis=require(_0xcea0('0x2'));var util=require('util');var config=require(_0xcea0('0x3'));var logger=require(_0xcea0('0x4'))(_0xcea0('0x5'));var cmContactRpc=require(_0xcea0('0x6'));config[_0xcea0('0x7')]=_['defaults'](config['redis'],{'host':_0xcea0('0x8'),'port':0x18eb});var io=require(_0xcea0('0x9'))(new Redis(config['redis']));function emit(_0x2ee09f,_0x2a26cd,_0x91809e,_0xb88289,_0x37b0b6){logger[_0xcea0('0xa')]('[CM][%s][%s]',_0x2ee09f,_0x2a26cd['id'],_0x91809e,_0xb88289,JSON[_0xcea0('0xb')](_0x37b0b6));io['to'](_0x91809e)[_0xcea0('0xc')](_0xb88289,_0x37b0b6);}exports['exec']=function(_0x3d4709,_0x453a55,_0x33b56f,_0x15338a){var _0xd6b4c0,_0x269e8e;var _0x1f4b4e={};var _0x269832;var _0x41db96=Number(_0x33b56f[_0xcea0('0xd')]);var _0x1b2b01=_0x33b56f[_0xcea0('0xe')]?Boolean(Number(_0x33b56f[_0xcea0('0xe')])):![];var _0x2e93af;var _0x2b4b13=![];if(!_[_0xcea0('0xf')](_0x33b56f[_0xcea0('0x10')])){if(_0x33b56f[_0xcea0('0x10')]=='1')_0x2b4b13=!![];}if(!_0x2b4b13){if(_0x15338a[_0xcea0('0x11')]){_0x1f4b4e['id']=_0x15338a[_0xcea0('0x11')];}}if(!_0x1f4b4e['id']){_0x1f4b4e['ListId']=_0x41db96;_0x2e93af=_0x33b56f[_0xcea0('0x12')]&&_0x33b56f['data3']!=='0'?_0x33b56f[_0xcea0('0x12')][_0xcea0('0x13')](','):[_0xcea0('0x14')];_0x1f4b4e[_0xcea0('0x15')]=_[_0xcea0('0x16')](_0x2e93af,function(_0x4498c5){var _0x4add1c={};_0x4add1c[_0x4498c5]=_0x15338a[_0xcea0('0x17')]?_0x15338a[_0xcea0('0x18')]:_0x15338a[_0xcea0('0x19')];return _0x4add1c;});_0x269832=_0x15338a[_0xcea0('0x17')]?_0x15338a['destcalleridnum']:_0x15338a[_0xcea0('0x19')];}var _0x1f4db5=['id',_0xcea0('0x1a'),_0xcea0('0x1b'),_0xcea0('0x14'),'mobile','fax','ListId','createdAt',_0xcea0('0x1c'),_0xcea0('0x1d')];var _0x44a919=_[_0xcea0('0x1e')](_0x1f4db5,_0x2e93af);BPromise[_0xcea0('0x1f')]()[_0xcea0('0x20')](cmContactRpc['getContacts']({'attributes':_0x44a919,'where':_0x1f4b4e,'phone':_0x269832}))[_0xcea0('0x20')](function(_0x2ed2f0){_0x269e8e=_0x2ed2f0;if(!_['isEmpty'](_0x269e8e)){if(_0x269e8e[_0xcea0('0x21')]===0x1){_0xd6b4c0=_0x269e8e[0x0];logger[_0xcea0('0xa')](_0xcea0('0x22'),_0x15338a[_0xcea0('0x23')],_0x453a55['id'],_0xd6b4c0['id']);}else{logger[_0xcea0('0xa')](_0xcea0('0x24'),_0x15338a[_0xcea0('0x23')],_0x453a55['id'],_[_0xcea0('0x16')](_0x269e8e,'id')[_0xcea0('0x25')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x15338a[_0xcea0('0x23')],_0x453a55['id']);var _0x58aeb3={'ListId':_0x41db96};var _0x43f306=_0x33b56f[_0xcea0('0x26')]&&_0x33b56f[_0xcea0('0x26')]!=='0'?_0x33b56f['data4']:'phone';if(_0x1b2b01){logger[_0xcea0('0xa')](_0xcea0('0x27'),_0x15338a[_0xcea0('0x23')],_0x453a55['id']);_0x58aeb3[_0x43f306]=_[_0xcea0('0xf')](_0x15338a[_0xcea0('0x17')])?_0x15338a[_0xcea0('0x19')]:_0x15338a[_0xcea0('0x18')];if(_[_0xcea0('0xf')](_0x15338a[_0xcea0('0x17')])){_0x58aeb3[_0xcea0('0x1a')]=_0x15338a['calleridname']&&_0x15338a[_0xcea0('0x28')]!==_0xcea0('0x29')?_0x15338a['calleridname']:_0xcea0('0x2a');}else{_0x58aeb3[_0xcea0('0x1a')]=_0x15338a[_0xcea0('0x2b')]&&_0x15338a[_0xcea0('0x2b')]!==''?_0x15338a[_0xcea0('0x2b')]:'Unknown';}return BPromise[_0xcea0('0x1f')]()['then'](cmContactRpc[_0xcea0('0x2c')](_0x58aeb3))['then'](function(_0x1be70d){_0xd6b4c0=_0x1be70d;_0x269e8e[_0xcea0('0x2d')](_0x1be70d);if(_0xd6b4c0){logger['info'](_0xcea0('0x2e'),_0x15338a[_0xcea0('0x23')],_0x453a55['id'],_0xd6b4c0['id']);}return;});}else{logger[_0xcea0('0xa')](_0xcea0('0x2f'),_0x15338a[_0xcea0('0x23')],_0x453a55['id']);_0x58aeb3[_0x43f306]=_[_0xcea0('0xf')](_0x15338a[_0xcea0('0x17')])?_0x15338a['calleridnum']:_0x15338a[_0xcea0('0x18')];if(_[_0xcea0('0xf')](_0x15338a['routeId'])){_0x58aeb3[_0xcea0('0x1a')]=_0x15338a[_0xcea0('0x28')]&&_0x15338a['calleridname']!==_0xcea0('0x29')?_0x15338a[_0xcea0('0x28')]:_0xcea0('0x2a');}else{_0x58aeb3[_0xcea0('0x1a')]=_0x15338a['destcalleridname']&&_0x15338a[_0xcea0('0x2b')]!==_0xcea0('0x29')?_0x15338a[_0xcea0('0x2b')]:_0xcea0('0x2a');}_0xd6b4c0=_0x58aeb3;_0x269e8e[_0xcea0('0x2d')](_0x58aeb3);return;}}})['then'](function(){if(_0x3d4709){emit(_0x15338a[_0xcea0('0x23')],_0x453a55,util[_0xcea0('0x30')](_0xcea0('0x31'),_0x3d4709[_0xcea0('0x32')]),util[_0xcea0('0x30')](_0xcea0('0x33'),_0x33b56f[_0xcea0('0x34')]['toLowerCase']()),{'evt':_['merge'](_0x15338a,{'autoCreate':_0x1b2b01}),'contact':_0xd6b4c0===undefined?{}:_0xd6b4c0,'contacts':_0x269e8e[_0xcea0('0x21')]===0x0?undefined:_0x269e8e});}});}; \ No newline at end of file +var _0x6528=['then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','Unknown','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','action','toLowerCase','merge','lodash','bluebird','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','firstName','mobile','fax','createdAt','scheduledAt','union','resolve'];(function(_0x40b2ed,_0x2b1765){var _0x18397d=function(_0xc6a86f){while(--_0xc6a86f){_0x40b2ed['push'](_0x40b2ed['shift']());}};_0x18397d(++_0x2b1765);}(_0x6528,0x160));var _0x8652=function(_0x593567,_0x537f33){_0x593567=_0x593567-0x0;var _0x2e1562=_0x6528[_0x593567];return _0x2e1562;};'use strict';var _=require(_0x8652('0x0'));var BPromise=require(_0x8652('0x1'));var Redis=require(_0x8652('0x2'));var util=require('util');var config=require(_0x8652('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x8652('0x4'));config[_0x8652('0x5')]=_[_0x8652('0x6')](config['redis'],{'host':_0x8652('0x7'),'port':0x18eb});var io=require(_0x8652('0x8'))(new Redis(config[_0x8652('0x5')]));function emit(_0x41b9d0,_0x4a3479,_0xa77081,_0x350737,_0x3c9cad){logger[_0x8652('0x9')](_0x8652('0xa'),_0x41b9d0,_0x4a3479['id'],_0xa77081,_0x350737,JSON['stringify'](_0x3c9cad));io['to'](_0xa77081)[_0x8652('0xb')](_0x350737,_0x3c9cad);}exports[_0x8652('0xc')]=function(_0x15e2ae,_0x1836f1,_0x26fc2d,_0x4edbb4){var _0x2da864,_0x2afa1b;var _0x972f35={};var _0x13869d;var _0x148851=Number(_0x26fc2d['data1']);var _0x22700e=_0x26fc2d[_0x8652('0xd')]?Boolean(Number(_0x26fc2d[_0x8652('0xd')])):![];var _0x29544a;var _0x497423=![];if(!_[_0x8652('0xe')](_0x26fc2d[_0x8652('0xf')])){if(_0x26fc2d[_0x8652('0xf')]=='1')_0x497423=!![];}if(!_0x497423){if(_0x4edbb4['xmd-contactid']){_0x972f35['id']=_0x4edbb4[_0x8652('0x10')];}}if(!_0x972f35['id']){_0x972f35[_0x8652('0x11')]=_0x148851;_0x29544a=_0x26fc2d[_0x8652('0x12')]&&_0x26fc2d[_0x8652('0x12')]!=='0'?_0x26fc2d[_0x8652('0x12')][_0x8652('0x13')](','):[_0x8652('0x14')];_0x972f35[_0x8652('0x15')]=_[_0x8652('0x16')](_0x29544a,function(_0x4448fc){var _0x4bcfbd={};_0x4bcfbd[_0x4448fc]=_0x4edbb4[_0x8652('0x17')]?_0x4edbb4[_0x8652('0x18')]:_0x4edbb4[_0x8652('0x19')];return _0x4bcfbd;});_0x13869d=_0x4edbb4[_0x8652('0x17')]?_0x4edbb4[_0x8652('0x18')]:_0x4edbb4[_0x8652('0x19')];}var _0x506003=['id',_0x8652('0x1a'),'lastName',_0x8652('0x14'),_0x8652('0x1b'),_0x8652('0x1c'),_0x8652('0x11'),_0x8652('0x1d'),_0x8652('0x1e'),'updatedAt'];var _0x5c2d34=_[_0x8652('0x1f')](_0x506003,_0x29544a);BPromise[_0x8652('0x20')]()[_0x8652('0x21')](cmContactRpc[_0x8652('0x22')]({'attributes':_0x5c2d34,'where':_0x972f35,'phone':_0x13869d}))[_0x8652('0x21')](function(_0x251fcf){_0x2afa1b=_0x251fcf;if(!_[_0x8652('0x23')](_0x2afa1b)){if(_0x2afa1b[_0x8652('0x24')]===0x1){_0x2da864=_0x2afa1b[0x0];logger[_0x8652('0x9')](_0x8652('0x25'),_0x4edbb4[_0x8652('0x26')],_0x1836f1['id'],_0x2da864['id']);}else{logger[_0x8652('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x4edbb4['uniqueid'],_0x1836f1['id'],_[_0x8652('0x16')](_0x2afa1b,'id')['join'](','));}return;}else{logger[_0x8652('0x9')](_0x8652('0x27'),_0x4edbb4[_0x8652('0x26')],_0x1836f1['id']);var _0x5e6aa0={'ListId':_0x148851};var _0x48c895=_0x26fc2d[_0x8652('0x28')]&&_0x26fc2d['data4']!=='0'?_0x26fc2d[_0x8652('0x28')]:_0x8652('0x14');if(_0x22700e){logger[_0x8652('0x9')](_0x8652('0x29'),_0x4edbb4['uniqueid'],_0x1836f1['id']);_0x5e6aa0[_0x48c895]=_['isNil'](_0x4edbb4['routeId'])?_0x4edbb4[_0x8652('0x19')]:_0x4edbb4['destcalleridnum'];if(_[_0x8652('0xe')](_0x4edbb4[_0x8652('0x17')])){_0x5e6aa0[_0x8652('0x1a')]=_0x4edbb4[_0x8652('0x2a')]&&_0x4edbb4['calleridname']!==_0x8652('0x2b')?_0x4edbb4[_0x8652('0x2a')]:'Unknown';}else{_0x5e6aa0[_0x8652('0x1a')]=_0x4edbb4[_0x8652('0x2c')]&&_0x4edbb4[_0x8652('0x2c')]!==_0x8652('0x2b')?_0x4edbb4['destcalleridname']:_0x8652('0x2d');}return BPromise[_0x8652('0x20')]()[_0x8652('0x21')](cmContactRpc['createContact'](_0x5e6aa0))[_0x8652('0x21')](function(_0x1b1b49){_0x2da864=_0x1b1b49;_0x2afa1b[_0x8652('0x2e')](_0x1b1b49);if(_0x2da864){logger[_0x8652('0x9')](_0x8652('0x2f'),_0x4edbb4[_0x8652('0x26')],_0x1836f1['id'],_0x2da864['id']);}return;});}else{logger['info'](_0x8652('0x30'),_0x4edbb4[_0x8652('0x26')],_0x1836f1['id']);_0x5e6aa0[_0x48c895]=_['isNil'](_0x4edbb4[_0x8652('0x17')])?_0x4edbb4[_0x8652('0x19')]:_0x4edbb4[_0x8652('0x18')];if(_[_0x8652('0xe')](_0x4edbb4[_0x8652('0x17')])){_0x5e6aa0['firstName']=_0x4edbb4[_0x8652('0x2a')]&&_0x4edbb4[_0x8652('0x2a')]!==_0x8652('0x2b')?_0x4edbb4[_0x8652('0x2a')]:_0x8652('0x2d');}else{_0x5e6aa0['firstName']=_0x4edbb4[_0x8652('0x2c')]&&_0x4edbb4[_0x8652('0x2c')]!==_0x8652('0x2b')?_0x4edbb4['destcalleridname']:_0x8652('0x2d');}_0x2da864=_0x5e6aa0;_0x2afa1b[_0x8652('0x2e')](_0x5e6aa0);return;}}})[_0x8652('0x21')](function(){if(_0x15e2ae){emit(_0x4edbb4['uniqueid'],_0x1836f1,util[_0x8652('0x31')](_0x8652('0x32'),_0x15e2ae[_0x8652('0x33')]),util[_0x8652('0x31')]('trigger:%s',_0x26fc2d[_0x8652('0x34')][_0x8652('0x35')]()),{'evt':_[_0x8652('0x36')](_0x4edbb4,{'autoCreate':_0x22700e}),'contact':_0x2da864===undefined?{}:_0x2da864,'contacts':_0x2afa1b[_0x8652('0x24')]===0x0?undefined:_0x2afa1b});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index e1c52c3..a7ebcab 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 _0xc273=['AnyConditions','debug','inspect','evt','field','account','ChatWebsiteId','value','upperFirst','operator','AccountId','interaction','message','event','membername','lastevent','null','substatus','offlineMessage','equals','util','lodash','url','mustache','ioredis','./urlforward','./cmContact','./script','../../../config/environment','trigger','redis','defaults','localhost','socket.io-emitter','popup','winapp','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','vtigerAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','undefined','motionChannel','voice','checkTriggers','triggers','hasOwnProperty','checkTrigger','merge','Actions','interface','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','windowWidth','data5','800','data6','winApplication','winArguments','format','name','trigger:%s:%s','action','jscripty','user:%s','trigger:%s','exec','integration','accounts','queue','routeId','urlforward','script','parse','query','search','channel','length','checkConditions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc273,0x197));var _0x3c27=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xc273[_0x5f309e];return _0x487b5e;};'use strict';var util=require(_0x3c27('0x0'));var _=require(_0x3c27('0x1'));var url=require(_0x3c27('0x2'));var Mustache=require(_0x3c27('0x3'));var Redis=require(_0x3c27('0x4'));var urlforward=require(_0x3c27('0x5'));var integration=require('./integration');var cmContact=require(_0x3c27('0x6'));var script=require(_0x3c27('0x7'));var config=require(_0x3c27('0x8'));var logger=require('../../../config/logger')(_0x3c27('0x9'));var ami=require('../ami');config[_0x3c27('0xa')]=_[_0x3c27('0xb')](config[_0x3c27('0xa')],{'host':_0x3c27('0xc'),'port':0x18eb});var io=require(_0x3c27('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x1b3d5,_0x383925){return _0x1b3d5==_0x383925;},'not_equals':function(_0x4944d7,_0x226641){return _0x4944d7!=_0x226641;}};var barAndWebActions=[_0x3c27('0xe'),_0x3c27('0x2'),_0x3c27('0xf')];function Trigger(_0x2163cc){this['triggers']=_0x2163cc['triggers'];this['agents']=_0x2163cc[_0x3c27('0x10')];this[_0x3c27('0x11')]=_0x2163cc[_0x3c27('0x11')];this['templates']=_0x2163cc[_0x3c27('0x12')];this[_0x3c27('0x13')]=_0x2163cc['voiceExtensions'];this[_0x3c27('0x14')]=_0x2163cc[_0x3c27('0x14')];this[_0x3c27('0x15')]=_0x2163cc[_0x3c27('0x15')];this[_0x3c27('0x16')]=_0x2163cc[_0x3c27('0x16')];this['sugarcrmAccounts']=_0x2163cc[_0x3c27('0x17')];this[_0x3c27('0x18')]=_0x2163cc[_0x3c27('0x18')];this[_0x3c27('0x19')]=_0x2163cc[_0x3c27('0x19')];this['vtigerAccounts']=_0x2163cc['vtigerAccounts'];this[_0x3c27('0x1a')]=_0x2163cc[_0x3c27('0x1a')];this['dynamics365Accounts']=_0x2163cc[_0x3c27('0x1b')];this[_0x3c27('0x1c')]=_0x2163cc[_0x3c27('0x1c')];this['accounts']={'zendesk':this[_0x3c27('0x14')],'salesforce':this[_0x3c27('0x16')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x3c27('0x17')],'zoho':this[_0x3c27('0x18')],'desk':this['deskAccounts'],'vtiger':this[_0x3c27('0x1d')],'dynamics365':this['dynamics365Accounts'],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x3c27('0x1a')]};ami['on'](_0x3c27('0x1e'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x21'),this['syncCustomEvent'][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x22'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x23'),this[_0x3c27('0x1f')]['bind'](this));ami['on'](_0x3c27('0x24'),this['syncCustomEvent']['bind'](this));ami['on'](_0x3c27('0x25'),this['syncCustomEvent']['bind'](this));ami['on'](_0x3c27('0x26'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x27'),this[_0x3c27('0x1f')]['bind'](this));ami['on'](_0x3c27('0x28'),this['syncCustomEvent']['bind'](this));ami['on'](_0x3c27('0x29'),this['syncCustomEvent'][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x2a'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on']('custom:timeout',this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on']('custom:dialbegin',this[_0x3c27('0x2b')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x2c'),this[_0x3c27('0x2b')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x2d'),this[_0x3c27('0x2b')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x2e'),this['syncCustomEvent']['bind'](this));ami['on'](_0x3c27('0x2f'),this[_0x3c27('0x1f')]['bind'](this));ami['on']('custom:substatus',this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x30'),this[_0x3c27('0x1f')]['bind'](this));ami['on'](_0x3c27('0x31'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on']('custom:acceptmessage',this['syncCustomEvent'][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x32'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));ami['on'](_0x3c27('0x33'),this[_0x3c27('0x1f')][_0x3c27('0x20')](this));}Trigger[_0x3c27('0x34')]['emit']=function(_0x6fa02d,_0x3d2862,_0x4fd196){logger[_0x3c27('0x35')](_0x6fa02d,_0x3d2862,JSON[_0x3c27('0x36')](_0x4fd196));io['to'](_0x6fa02d)[_0x3c27('0x37')](_0x3d2862,_0x4fd196);};Trigger[_0x3c27('0x34')][_0x3c27('0x1f')]=function(_0x3c05e3){var _0x3783b2=_[_0x3c27('0x38')](_0x3c05e3);if(typeof _0x3783b2['motionChannel']===_0x3c27('0x39')){_0x3783b2[_0x3c27('0x3a')]=_0x3c27('0x3b');}logger['debug'](_0x3c27('0x1f'),util['inspect'](_0x3783b2,{'showHidden':!![],'depth':null}));this[_0x3c27('0x3c')](_0x3783b2);};Trigger[_0x3c27('0x34')][_0x3c27('0x2b')]=function(_0x2e5cb5){if(this[_0x3c27('0x10')][_0x2e5cb5['interface']]){this[_0x3c27('0x1f')](_0x2e5cb5);}};Trigger['prototype'][_0x3c27('0x3c')]=function(_0x4b3610){var _0x92574d;for(var _0x301d41 in this[_0x3c27('0x3d')]){if(this[_0x3c27('0x3d')][_0x3c27('0x3e')](_0x301d41)){if(this[_0x3c27('0x3d')][_0x301d41]['status']){_0x92574d=this[_0x3c27('0x3f')](this[_0x3c27('0x3d')][_0x301d41],_0x4b3610);if(_0x92574d){_[_0x3c27('0x40')](_0x4b3610,_0x4b3610['variables']);for(var _0x5200c1=0x0,_0xc9cf1,_0x5b28e7,_0x1055c5;_0x5200c10x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ No newline at end of file +var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x27287e,_0x2bb637){var _0xae2f40=function(_0x43b4a4){while(--_0x43b4a4){_0x27287e['push'](_0x27287e['shift']());}};_0xae2f40(++_0x2bb637);}(_0x55ca,0x126));var _0xa55c=function(_0x2c0abe,_0x2a14c4){_0x2c0abe=_0x2c0abe-0x0;var _0x1b0041=_0x55ca[_0x2c0abe];return _0x1b0041;};'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 9755e9a..60cf724 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 _0xc6eb=['headers','odata-entityid','substring','lastIndexOf','message','telephone1','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','enduserId','includes','string','picklist','type','nameField','idField','toLowerCase','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','tenantId','data2','POST','username','password','clientSecret','then','catch',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','outbound','destcalleridnum','calleridnum','contacts','Bearer\x20','body'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xc6eb,0x192));var _0xbc6e=function(_0x9658dc,_0x4b1905){_0x9658dc=_0x9658dc-0x0;var _0x2ad48e=_0xc6eb[_0x9658dc];return _0x2ad48e;};'use strict';var _=require(_0xbc6e('0x0'));var rp=require(_0xbc6e('0x1'));var util=require(_0xbc6e('0x2'));var intUtil=require(_0xbc6e('0x3'));var md5=require(_0xbc6e('0x4'));var Redis=require('ioredis');var logger=require(_0xbc6e('0x5'))(_0xbc6e('0x6'));var config=require(_0xbc6e('0x7'));config[_0xbc6e('0x8')]=_['defaults'](config[_0xbc6e('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xbc6e('0x9'))(new Redis(config[_0xbc6e('0x8')]));function getAuthToken(_0x5786ab,_0x461c9f,_0x1b285c){if(_0x5786ab[_0xbc6e('0xa')]){_0x5786ab[_0xbc6e('0xb')]=_0x5786ab[_0xbc6e('0xc')][_0xbc6e('0xd')];_0x5786ab[_0xbc6e('0xe')]=_0x5786ab[_0xbc6e('0xc')][_0xbc6e('0xf')];return Promise['resolve'](_0x5786ab[_0xbc6e('0xc')]['data5']);}var _0x38f4f8={'method':_0xbc6e('0x10'),'uri':_0x461c9f,'form':{'client_id':_0x5786ab['clientId'],'resource':_0x5786ab[_0xbc6e('0xb')],'username':_0x5786ab[_0xbc6e('0x11')],'password':_0x5786ab[_0xbc6e('0x12')],'grant_type':_0xbc6e('0x12'),'client_secret':_0x5786ab[_0xbc6e('0x13')]},'json':!![]};return rp(_0x38f4f8)[_0xbc6e('0x14')](function(_0x1cd187){return _0x1cd187['access_token'];})[_0xbc6e('0x15')](function(_0x43d4bc){logger['error']('['+[_0x1b285c['toUpperCase']()]+_0xbc6e('0x16'));return _0x43d4bc['message'];});}function getUser(_0x111ea4,_0x494179,_0x5b00bf,_0x1d6233,_0x4b273c,_0x45fce5){return new Promise(function(_0x14d791,_0x34d257){return getAuthToken(_0x494179,_0x1d6233,_0x45fce5)[_0xbc6e('0x14')](function(_0x1d1731){var _0x38f48c={'method':_0xbc6e('0x17'),'uri':_0x4b273c+_0xbc6e('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x1d1731,'OData-Version':_0xbc6e('0x19')},'json':!![]};return rp(_0x38f48c);})['then'](function(_0x2bc642){var _0x580194=_0x2bc642[_0xbc6e('0x1a')];var _0x5a070a=![];var _0x49afe0=null;if(!_[_0xbc6e('0x1b')](_0x5b00bf)){if(intUtil[_0xbc6e('0x1c')](_0x5b00bf['email'])){_0x111ea4[_0xbc6e('0x1d')]=_0x5b00bf[_0xbc6e('0x1e')];for(_0x49afe0=0x0;_0x49afe0<_0x580194[_0xbc6e('0x1f')];_0x49afe0++){if(_0x580194[_0x49afe0][_0xbc6e('0x20')]===_0x5b00bf[_0xbc6e('0x1e')]&&!_0x580194[_0x49afe0][_0xbc6e('0x21')]){_0x5a070a=!![];logger[_0xbc6e('0x22')]('['+[_0x45fce5[_0xbc6e('0x23')]()]+_0xbc6e('0x24')+_0x580194[_0x49afe0][_0xbc6e('0x25')]+'!');_0x111ea4['userId']=_0x580194[_0x49afe0]['systemuserid'];}}}}if(!_0x5a070a){logger[_0xbc6e('0x22')]('['+[_0x45fce5[_0xbc6e('0x23')]()]+_0xbc6e('0x26'));_0x111ea4['userEmail']=_0x494179[_0xbc6e('0x11')];for(_0x49afe0=0x0;_0x49afe0<_0x580194[_0xbc6e('0x1f')];_0x49afe0++){if(_0x580194[_0x49afe0][_0xbc6e('0x20')]===_0x494179[_0xbc6e('0x11')]){_0x111ea4[_0xbc6e('0x27')]=_0x580194[_0x49afe0][_0xbc6e('0x25')];}}}_0x14d791(_0x111ea4);})[_0xbc6e('0x15')](function(_0x4b4a3e){_0x34d257(_0x4b4a3e['message']);});});}function createEndUser(_0x3b3ae4,_0x1383f4,_0x329ebc,_0x3630a9,_0x8208a8,_0x1bb274,_0x52c3ab){return new Promise(function(_0x450ef6,_0x56e4e3){return getAuthToken(_0x1383f4,_0x329ebc,_0x1bb274)[_0xbc6e('0x14')](function(_0x37bebd){var _0x24b6a7=_0x1bb274['toLowerCase']()===_0xbc6e('0x28')?_0x8208a8[_0xbc6e('0x29')]:_0x8208a8[_0xbc6e('0x2a')];var _0x190c83={'method':_0xbc6e('0x10'),'uri':_0x3630a9+_0xbc6e('0x2b'),'body':{'fullname':_0x24b6a7,'firstname':_0x24b6a7,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3b3ae4[_0xbc6e('0x27')]+')'},'headers':{'Authorization':_0xbc6e('0x2c')+_0x37bebd,'OData-Version':_0xbc6e('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x190c83[_0xbc6e('0x2d')][_0x52c3ab]=_0x24b6a7;return rp(_0x190c83);})['then'](function(_0xef293f){var _0x5b0fcf=_0xef293f[_0xbc6e('0x2e')][_0xbc6e('0x2f')];var _0x3269e2=_0x5b0fcf[_0xbc6e('0x30')](_0x5b0fcf[_0xbc6e('0x31')]('(')+0x1,_0x5b0fcf[_0xbc6e('0x31')](')'));_0x3b3ae4['enduserId']=_0x3269e2;_0x450ef6(_0x3b3ae4);})['catch'](function(_0x1662ab){_0x56e4e3(_0x1662ab[_0xbc6e('0x32')]);});});}function getEndUser(_0x30d62f,_0x328938,_0x126152,_0x396398,_0x5c9306,_0x158c87,_0x363f76,_0x1b294d){var _0x97c9af=_0x158c87['toLowerCase']()===_0xbc6e('0x28')?_0x5c9306[_0xbc6e('0x29')]:_0x5c9306[_0xbc6e('0x2a')];return getAuthToken(_0x328938,_0x126152,_0x158c87)[_0xbc6e('0x14')](function(_0x50a597){_0x1b294d=_0x1b294d?_0x1b294d:_0xbc6e('0x33');var _0x2beb03={'method':_0xbc6e('0x17'),'uri':_0x396398+'contacts?$select='+_0x1b294d+_0xbc6e('0x34')+_0x1b294d+_0xbc6e('0x35')+_0x97c9af[_0xbc6e('0x36')]('+','%2b')+'\x27','headers':{'Authorization':_0xbc6e('0x2c')+_0x50a597,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x2beb03);})[_0xbc6e('0x14')](function(_0x4640b4){var _0x49cd17=![];if(!_0x4640b4)return _0x49cd17;var _0x55d30a=_0x4640b4['value'];for(var _0x5799d5=0x0;_0x5799d5<_0x55d30a[_0xbc6e('0x1f')];_0x5799d5++){if(_0x55d30a[_0x5799d5][_0x1b294d]===_0x97c9af){_0x49cd17=!![];_0x30d62f['enduserId']=_0x55d30a[_0x5799d5][_0xbc6e('0x37')];}}return _0x49cd17;})['then'](function(_0x2a2c27){if(_0x2a2c27)return _0x30d62f;if(_0x363f76===_0xbc6e('0x38')){logger[_0xbc6e('0x22')]('['+[_0x158c87[_0xbc6e('0x23')]()]+_0xbc6e('0x39'));return _0x30d62f;}return createEndUser(_0x30d62f,_0x328938,_0x126152,_0x396398,_0x5c9306,_0x158c87,_0x1b294d)[_0xbc6e('0x14')](function(_0x4fb89e){logger[_0xbc6e('0x22')]('['+[_0x158c87['toUpperCase']()]+']\x20Enduser\x20created!',_0x4fb89e[_0xbc6e('0x3a')]);return _0x4fb89e;});});}function getCustomFields(_0x1325d8,_0x114f66,_0x300292){var _0x2e7db6={};if(_0x1325d8['length']>0x0){_['forEach'](_0x1325d8,function(_0x1cf602){if(_[_0xbc6e('0x3b')]([_0xbc6e('0x3c'),_0xbc6e('0x3d')],_0x1cf602[_0xbc6e('0x3e')])&&_0x1cf602[_0xbc6e('0x3f')]&&!_0x1cf602['customField']){var _0x4ee824=_0x1cf602[_0xbc6e('0x40')][_0xbc6e('0x41')]();var _0x33870a=_0x4ee824[_0xbc6e('0x30')](0x0,_0x4ee824[_0xbc6e('0x42')]('_'));var _0x5d8c3f=_0x4ee824['substring'](_0x4ee824['indexOf']('_')+0x1);if(_0x33870a===_0x300292){_0x2e7db6[_0x5d8c3f]=_0x1cf602[_0xbc6e('0x43')];}}});}return _0x2e7db6;}function getTicket(_0x171601,_0x507637,_0x3a2c46,_0x46550b,_0x58bdd1,_0x1fa547,_0x2e64af){return new Promise(function(_0xcd9378,_0x3f1c30){var _0x43bbb3;return getAuthToken(_0x507637,_0x3a2c46,_0x2e64af)[_0xbc6e('0x14')](function(_0x3c314b){if(_0x1fa547[_0xbc6e('0x44')]===_0xbc6e('0x45')){_0x43bbb3={'method':_0xbc6e('0x10'),'uri':_0x46550b+_0xbc6e('0x46'),'body':Object[_0xbc6e('0x47')]({},{'title':intUtil[_0xbc6e('0x48')](_0x1fa547[_0xbc6e('0x49')],_0x58bdd1,'\x20'),'description':intUtil['getString'](_0x1fa547[_0xbc6e('0x4a')],_0x58bdd1,'\x0a'),'customerid_contact@odata.bind':_0x171601[_0xbc6e('0x3a')]?_0xbc6e('0x4b')+_0x171601['enduserId']+')':undefined,'ownerid@odata.bind':_0xbc6e('0x4c')+_0x171601[_0xbc6e('0x27')]+')','caseorigincode':'1'},getCustomFields(_0x1fa547[_0xbc6e('0x4d')],_0x58bdd1,_0x1fa547[_0xbc6e('0x44')])),'headers':{'Authorization':_0xbc6e('0x2c')+_0x3c314b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1fa547[_0xbc6e('0x44')]===_0xbc6e('0x4e')){var _0x60d01=_0x171601[_0xbc6e('0x3a')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x171601[_0xbc6e('0x27')]+')','participationtypemask':_0x171601[_0xbc6e('0x4f')]===_0xbc6e('0x50')?0x2:0x1},{'partyid_contact@odata.bind':_0xbc6e('0x4b')+_0x171601[_0xbc6e('0x3a')]+')','participationtypemask':_0x171601['callDirection']===_0xbc6e('0x50')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xbc6e('0x4c')+_0x171601['userId']+')','participationtypemask':_0x171601[_0xbc6e('0x4f')]===_0xbc6e('0x50')?0x2:0x1}];_0x43bbb3={'method':_0xbc6e('0x10'),'uri':_0x46550b+_0xbc6e('0x51'),'body':Object['assign']({},{'subject':intUtil[_0xbc6e('0x48')](_0x1fa547[_0xbc6e('0x49')],_0x58bdd1,'\x20'),'phonenumber':String(_0x58bdd1['calleridnum']),'description':intUtil[_0xbc6e('0x48')](_0x1fa547[_0xbc6e('0x4a')],_0x58bdd1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x171601[_0xbc6e('0x3a')]?_0xbc6e('0x4b')+_0x171601[_0xbc6e('0x3a')]+')':undefined,'ownerid@odata.bind':_0xbc6e('0x4c')+_0x171601[_0xbc6e('0x27')]+')','directioncode':_0x171601[_0xbc6e('0x4f')]==='queue'?![]:!![],'phonecall_activity_parties':_0x60d01},getCustomFields(_0x1fa547[_0xbc6e('0x4d')],_0x58bdd1,_0x1fa547[_0xbc6e('0x44')])),'headers':{'Authorization':_0xbc6e('0x2c')+_0x3c314b,'OData-Version':_0xbc6e('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x43bbb3);})['then'](function(_0x4617ff){var _0xf2e660=_0x4617ff[_0xbc6e('0x2e')][_0xbc6e('0x2f')];var _0x1a0f7e=_0xf2e660[_0xbc6e('0x30')](_0xf2e660[_0xbc6e('0x31')]('(')+0x1,_0xf2e660[_0xbc6e('0x31')](')'));_0x171601['ticketId']=_0x1a0f7e;_0xcd9378(_0x171601);})[_0xbc6e('0x15')](function(_0x49e150){_0x3f1c30(_0x49e150[_0xbc6e('0x32')]);});});}function emit(_0x304a32,_0x3f7309,_0x534467,_0xef6fd0){var _0x3cb8b5={'uri':util[_0xbc6e('0x52')](_0xbc6e('0x53'),_0x304a32,_0x534467,_0xef6fd0)};io['to'](util['format'](_0xbc6e('0x54'),_0x3f7309))[_0xbc6e('0x55')](_0xbc6e('0x56'),_0x3cb8b5);}exports['cs']=function(_0x487d7b,_0x2dab12,_0x29e06b,_0x109324,_0x4abecd,_0xea564,_0x5c7b0c,_0x37e8c2){var _0x35171e={};_0xea564['remoteUri']=_0xea564['modernAuthentication']?intUtil[_0xbc6e('0x57')](_0xea564[_0xbc6e('0xc')]['data7']):intUtil[_0xbc6e('0x57')](_0xea564['remoteUri']);_0xea564[_0xbc6e('0x58')]=intUtil[_0xbc6e('0x57')](_0xea564[_0xbc6e('0x58')]);_0x35171e[_0xbc6e('0x4f')]=_0x37e8c2==='queue'||_0x37e8c2===_0xbc6e('0x59')?_0xbc6e('0x50'):_0xbc6e('0x28');var _0x2450ea=_0xea564[_0xbc6e('0xa')]?util[_0xbc6e('0x52')]('%s/api/data/v9.0/',_0xea564['CloudProvider'][_0xbc6e('0xd')]):util[_0xbc6e('0x52')](_0xbc6e('0x5a'),_0xea564[_0xbc6e('0xb')]);var _0x133d69=util[_0xbc6e('0x52')](_0xbc6e('0x5b'),_0xea564[_0xbc6e('0xe')]);var _0x53d7e3=util[_0xbc6e('0x52')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xea564[_0xbc6e('0x58')],_0x2dab12['uniqueid'],md5(_0x2dab12[_0xbc6e('0x5c')]));if(_0x4abecd&&_0x4abecd[_0xbc6e('0x5d')]){logger[_0xbc6e('0x22')](_0xbc6e('0x5e'),_0xbc6e('0x5f'));_0x2dab12[_0xbc6e('0x60')]=_0x53d7e3;}else if(_0x5c7b0c&&_0x5c7b0c[_0xbc6e('0x61')]&&_0x5c7b0c[_0xbc6e('0x61')]!=='none'){logger[_0xbc6e('0x22')]('[OUTBOUND]',_0xbc6e('0x5f'));_0x2dab12[_0xbc6e('0x60')]=_0x53d7e3;}else{_0x2dab12[_0xbc6e('0x60')]='';}return getUser(_0x35171e,_0xea564,_0x109324,_0x133d69,_0x2450ea,_0x37e8c2)[_0xbc6e('0x14')](function(_0x487067){logger[_0xbc6e('0x22')]('['+_0x37e8c2[_0xbc6e('0x23')]()+']\x20The\x20User\x20ID\x20is:',_0x487067['userId']);logger[_0xbc6e('0x22')]('['+_0x37e8c2['toUpperCase']()+_0xbc6e('0x62'),_0x487067['userEmail']);return getEndUser(_0x487067,_0xea564,_0x133d69,_0x2450ea,_0x2dab12,_0x37e8c2,_0x29e06b[_0xbc6e('0x63')],_0x29e06b[_0xbc6e('0x64')]);})['then'](function(_0x4376b0){logger[_0xbc6e('0x22')]('['+_0x37e8c2[_0xbc6e('0x23')]()+_0xbc6e('0x65'),_0x4376b0[_0xbc6e('0x3a')]);logger[_0xbc6e('0x22')]('['+_0x37e8c2[_0xbc6e('0x23')]()+_0xbc6e('0x66'),_0x2dab12[_0xbc6e('0x2a')]);return getTicket(_0x4376b0,_0xea564,_0x133d69,_0x2450ea,_0x2dab12,_0x29e06b,_0x37e8c2);})[_0xbc6e('0x14')](function(_0x1f2389){logger[_0xbc6e('0x22')](util[_0xbc6e('0x52')]('['+_0x37e8c2[_0xbc6e('0x23')]()+_0xbc6e('0x67'),_0x29e06b[_0xbc6e('0x44')],_0x1f2389[_0xbc6e('0x68')]));logger[_0xbc6e('0x22')](util[_0xbc6e('0x52')]('['+_0x37e8c2['toUpperCase']()+_0xbc6e('0x69'),_0x37e8c2));if(_0x37e8c2!==_0xbc6e('0x59')&&_0x29e06b[_0xbc6e('0x6a')]){logger[_0xbc6e('0x22')]('['+_0x37e8c2[_0xbc6e('0x23')]()+']',_0xbc6e('0x6b'));emit(_0xea564[_0xbc6e('0xb')],_0x109324[_0xbc6e('0x6c')],_0x29e06b[_0xbc6e('0x44')],_0x1f2389[_0xbc6e('0x68')]);}})[_0xbc6e('0x15')](function(_0x2b314e){logger[_0xbc6e('0x6d')]('['+_0x37e8c2[_0xbc6e('0x23')]()+_0xbc6e('0x6e'),_0x2b314e[_0xbc6e('0x32')]);console[_0xbc6e('0x6d')](_0xbc6e('0x6f'),_0x2b314e);});}; \ No newline at end of file +var _0x286b=['recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:','userEmail','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','socket.io-emitter','modernAuthentication','data7','tenantId','CloudProvider','data2','resolve','data5','POST','clientId','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','isdisabled','info',']\x20Agent\x20found\x20','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','length','internalemailaddress','systemuserid','toLowerCase','outbound','destcalleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','calleridnum','telephone1','&$filter=','%2b','value','enduserId','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','nameField','indexOf','content','ticketType','incident','incidents','Subjects','getString','/contacts(','Fields','phonecall','callDirection','queue','assign','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','remoteUri','stripTrailingSlash','serverUrl','%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!'];(function(_0x41416e,_0x22e0a7){var _0x50fd9c=function(_0x157424){while(--_0x157424){_0x41416e['push'](_0x41416e['shift']());}};_0x50fd9c(++_0x22e0a7);}(_0x286b,0x164));var _0xb286=function(_0x355a6c,_0x4daec8){_0x355a6c=_0x355a6c-0x0;var _0x20f3a0=_0x286b[_0x355a6c];return _0x20f3a0;};'use strict';var _=require(_0xb286('0x0'));var rp=require('request-promise');var util=require(_0xb286('0x1'));var intUtil=require('./util');var md5=require(_0xb286('0x2'));var Redis=require(_0xb286('0x3'));var logger=require(_0xb286('0x4'))(_0xb286('0x5'));var config=require('../../../../config/environment');config[_0xb286('0x6')]=_[_0xb286('0x7')](config[_0xb286('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb286('0x8'))(new Redis(config[_0xb286('0x6')]));function getAuthToken(_0x113ea6,_0x1346a8,_0x4d0d82){if(_0x113ea6[_0xb286('0x9')]){_0x113ea6['remoteUri']=_0x113ea6['CloudProvider'][_0xb286('0xa')];_0x113ea6[_0xb286('0xb')]=_0x113ea6[_0xb286('0xc')][_0xb286('0xd')];return Promise[_0xb286('0xe')](_0x113ea6[_0xb286('0xc')][_0xb286('0xf')]);}var _0x2c07d3={'method':_0xb286('0x10'),'uri':_0x1346a8,'form':{'client_id':_0x113ea6[_0xb286('0x11')],'resource':_0x113ea6['remoteUri'],'username':_0x113ea6['username'],'password':_0x113ea6[_0xb286('0x12')],'grant_type':_0xb286('0x12'),'client_secret':_0x113ea6[_0xb286('0x13')]},'json':!![]};return rp(_0x2c07d3)[_0xb286('0x14')](function(_0x5e8721){return _0x5e8721[_0xb286('0x15')];})[_0xb286('0x16')](function(_0x1a5df2){logger['error']('['+[_0x4d0d82[_0xb286('0x17')]()]+_0xb286('0x18'));return _0x1a5df2[_0xb286('0x19')];});}function getUser(_0x55d91b,_0x150ebc,_0x3bd7c2,_0x4c2117,_0x442904,_0x3897fc){return new Promise(function(_0x361c91,_0x2dd885){return getAuthToken(_0x150ebc,_0x4c2117,_0x3897fc)[_0xb286('0x14')](function(_0x596ea3){var _0x2b2492={'method':_0xb286('0x1a'),'uri':_0x442904+_0xb286('0x1b'),'headers':{'Authorization':_0xb286('0x1c')+_0x596ea3,'OData-Version':_0xb286('0x1d')},'json':!![]};return rp(_0x2b2492);})[_0xb286('0x14')](function(_0x570049){var _0x2fac99=_0x570049['value'];var _0x5aa3aa=![];var _0x21ba4a=null;if(!_[_0xb286('0x1e')](_0x3bd7c2)){if(intUtil[_0xb286('0x1f')](_0x3bd7c2[_0xb286('0x20')])){_0x55d91b['userEmail']=_0x3bd7c2[_0xb286('0x20')];for(_0x21ba4a=0x0;_0x21ba4a<_0x2fac99['length'];_0x21ba4a++){if(_0x2fac99[_0x21ba4a]['internalemailaddress']===_0x3bd7c2['email']&&!_0x2fac99[_0x21ba4a][_0xb286('0x21')]){_0x5aa3aa=!![];logger[_0xb286('0x22')]('['+[_0x3897fc[_0xb286('0x17')]()]+_0xb286('0x23')+_0x2fac99[_0x21ba4a]['systemuserid']+'!');_0x55d91b[_0xb286('0x24')]=_0x2fac99[_0x21ba4a]['systemuserid'];}}}}if(!_0x5aa3aa){logger[_0xb286('0x22')]('['+[_0x3897fc[_0xb286('0x17')]()]+_0xb286('0x25'));_0x55d91b['userEmail']=_0x150ebc[_0xb286('0x26')];for(_0x21ba4a=0x0;_0x21ba4a<_0x2fac99[_0xb286('0x27')];_0x21ba4a++){if(_0x2fac99[_0x21ba4a][_0xb286('0x28')]===_0x150ebc[_0xb286('0x26')]){_0x55d91b[_0xb286('0x24')]=_0x2fac99[_0x21ba4a][_0xb286('0x29')];}}}_0x361c91(_0x55d91b);})['catch'](function(_0x4e59d3){_0x2dd885(_0x4e59d3[_0xb286('0x19')]);});});}function createEndUser(_0x4aedf6,_0x138821,_0x447c2f,_0x4051b3,_0x5b611b,_0x5a3ac8,_0x351d2a){return new Promise(function(_0x2509e9,_0x4d9472){return getAuthToken(_0x138821,_0x447c2f,_0x5a3ac8)[_0xb286('0x14')](function(_0x3ec6b5){var _0x16b0cb=_0x5a3ac8[_0xb286('0x2a')]()===_0xb286('0x2b')?_0x5b611b[_0xb286('0x2c')]:_0x5b611b['calleridnum'];var _0x1caa5e={'method':_0xb286('0x10'),'uri':_0x4051b3+_0xb286('0x2d'),'body':{'fullname':_0x16b0cb,'firstname':_0x16b0cb,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xb286('0x2e')+_0x4aedf6['userId']+')'},'headers':{'Authorization':_0xb286('0x1c')+_0x3ec6b5,'OData-Version':_0xb286('0x1d')},'json':!![],'resolveWithFullResponse':!![]};_0x1caa5e[_0xb286('0x2f')][_0x351d2a]=_0x16b0cb;return rp(_0x1caa5e);})[_0xb286('0x14')](function(_0x5894a3){var _0x2b7085=_0x5894a3[_0xb286('0x30')][_0xb286('0x31')];var _0x3a5417=_0x2b7085[_0xb286('0x32')](_0x2b7085['lastIndexOf']('(')+0x1,_0x2b7085[_0xb286('0x33')](')'));_0x4aedf6['enduserId']=_0x3a5417;_0x2509e9(_0x4aedf6);})[_0xb286('0x16')](function(_0x331509){_0x4d9472(_0x331509[_0xb286('0x19')]);});});}function getEndUser(_0x13fff1,_0x4279fa,_0x2638f3,_0x644efa,_0x3eccc5,_0x1177b8,_0x1df4ae,_0x851cd5){var _0x527a09=_0x1177b8['toLowerCase']()===_0xb286('0x2b')?_0x3eccc5[_0xb286('0x2c')]:_0x3eccc5[_0xb286('0x34')];return getAuthToken(_0x4279fa,_0x2638f3,_0x1177b8)[_0xb286('0x14')](function(_0x1fa75){_0x851cd5=_0x851cd5?_0x851cd5:_0xb286('0x35');var _0x4aa92b={'method':_0xb286('0x1a'),'uri':_0x644efa+'contacts?$select='+_0x851cd5+_0xb286('0x36')+_0x851cd5+'\x20eq\x20\x27'+_0x527a09['replace']('+',_0xb286('0x37'))+'\x27','headers':{'Authorization':_0xb286('0x1c')+_0x1fa75,'If-None-Match':null,'OData-Version':_0xb286('0x1d')},'json':!![]};return rp(_0x4aa92b);})[_0xb286('0x14')](function(_0x4f247c){var _0x3a79f3=![];if(!_0x4f247c)return _0x3a79f3;var _0x42fe45=_0x4f247c[_0xb286('0x38')];for(var _0x4c091b=0x0;_0x4c091b<_0x42fe45[_0xb286('0x27')];_0x4c091b++){if(_0x42fe45[_0x4c091b][_0x851cd5]===_0x527a09){_0x3a79f3=!![];_0x13fff1[_0xb286('0x39')]=_0x42fe45[_0x4c091b][_0xb286('0x3a')];}}return _0x3a79f3;})[_0xb286('0x14')](function(_0x583c40){if(_0x583c40)return _0x13fff1;if(_0x1df4ae===_0xb286('0x3b')){logger[_0xb286('0x22')]('['+[_0x1177b8[_0xb286('0x17')]()]+_0xb286('0x3c'));return _0x13fff1;}return createEndUser(_0x13fff1,_0x4279fa,_0x2638f3,_0x644efa,_0x3eccc5,_0x1177b8,_0x851cd5)['then'](function(_0x20197c){logger[_0xb286('0x22')]('['+[_0x1177b8[_0xb286('0x17')]()]+_0xb286('0x3d'),_0x20197c[_0xb286('0x39')]);return _0x20197c;});});}function getCustomFields(_0x3c888e,_0x991ab7,_0x3f34f8){var _0x341d62={};if(_0x3c888e[_0xb286('0x27')]>0x0){_[_0xb286('0x3e')](_0x3c888e,function(_0x44ed57){if(_[_0xb286('0x3f')]([_0xb286('0x40'),_0xb286('0x41')],_0x44ed57['type'])&&_0x44ed57[_0xb286('0x42')]&&!_0x44ed57['customField']){var _0x231525=_0x44ed57['idField'][_0xb286('0x2a')]();var _0x58770a=_0x231525[_0xb286('0x32')](0x0,_0x231525[_0xb286('0x43')]('_'));var _0x32cce1=_0x231525[_0xb286('0x32')](_0x231525['indexOf']('_')+0x1);if(_0x58770a===_0x3f34f8){_0x341d62[_0x32cce1]=_0x44ed57[_0xb286('0x44')];}}});}return _0x341d62;}function getTicket(_0x5b8c83,_0xae2b,_0x2d8ccf,_0x527462,_0x39172b,_0x1f116c,_0x315616){return new Promise(function(_0x20f434,_0x273640){var _0x20427e;return getAuthToken(_0xae2b,_0x2d8ccf,_0x315616)['then'](function(_0x5287cf){if(_0x1f116c[_0xb286('0x45')]===_0xb286('0x46')){_0x20427e={'method':'POST','uri':_0x527462+_0xb286('0x47'),'body':Object['assign']({},{'title':intUtil['getString'](_0x1f116c[_0xb286('0x48')],_0x39172b,'\x20'),'description':intUtil[_0xb286('0x49')](_0x1f116c['Descriptions'],_0x39172b,'\x0a'),'customerid_contact@odata.bind':_0x5b8c83['enduserId']?_0xb286('0x4a')+_0x5b8c83[_0xb286('0x39')]+')':undefined,'ownerid@odata.bind':_0xb286('0x2e')+_0x5b8c83['userId']+')','caseorigincode':'1'},getCustomFields(_0x1f116c[_0xb286('0x4b')],_0x39172b,_0x1f116c[_0xb286('0x45')])),'headers':{'Authorization':_0xb286('0x1c')+_0x5287cf,'OData-Version':_0xb286('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1f116c[_0xb286('0x45')]===_0xb286('0x4c')){var _0x241ead=_0x5b8c83[_0xb286('0x39')]?[{'partyid_systemuser@odata.bind':_0xb286('0x2e')+_0x5b8c83[_0xb286('0x24')]+')','participationtypemask':_0x5b8c83[_0xb286('0x4d')]===_0xb286('0x4e')?0x2:0x1},{'partyid_contact@odata.bind':_0xb286('0x4a')+_0x5b8c83['enduserId']+')','participationtypemask':_0x5b8c83[_0xb286('0x4d')]===_0xb286('0x4e')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xb286('0x2e')+_0x5b8c83[_0xb286('0x24')]+')','participationtypemask':_0x5b8c83[_0xb286('0x4d')]===_0xb286('0x4e')?0x2:0x1}];_0x20427e={'method':'POST','uri':_0x527462+'phonecalls','body':Object[_0xb286('0x4f')]({},{'subject':intUtil['getString'](_0x1f116c[_0xb286('0x48')],_0x39172b,'\x20'),'phonenumber':String(_0x39172b['calleridnum']),'description':intUtil[_0xb286('0x49')](_0x1f116c[_0xb286('0x50')],_0x39172b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x5b8c83[_0xb286('0x39')]?_0xb286('0x4a')+_0x5b8c83[_0xb286('0x39')]+')':undefined,'ownerid@odata.bind':_0xb286('0x2e')+_0x5b8c83[_0xb286('0x24')]+')','directioncode':_0x5b8c83[_0xb286('0x4d')]===_0xb286('0x4e')?![]:!![],'phonecall_activity_parties':_0x241ead},getCustomFields(_0x1f116c['Fields'],_0x39172b,_0x1f116c[_0xb286('0x45')])),'headers':{'Authorization':_0xb286('0x1c')+_0x5287cf,'OData-Version':_0xb286('0x1d')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x20427e);})['then'](function(_0x5ce191){var _0x4420a1=_0x5ce191[_0xb286('0x30')]['odata-entityid'];var _0x1012de=_0x4420a1[_0xb286('0x32')](_0x4420a1[_0xb286('0x33')]('(')+0x1,_0x4420a1[_0xb286('0x33')](')'));_0x5b8c83[_0xb286('0x51')]=_0x1012de;_0x20f434(_0x5b8c83);})['catch'](function(_0xc48542){_0x273640(_0xc48542[_0xb286('0x19')]);});});}function emit(_0x14d503,_0x155fa7,_0x27de9e,_0x49beae){var _0x3c5843={'uri':util[_0xb286('0x52')](_0xb286('0x53'),_0x14d503,_0x27de9e,_0x49beae)};io['to'](util[_0xb286('0x52')]('user:%s',_0x155fa7))[_0xb286('0x54')](_0xb286('0x55'),_0x3c5843);}exports['cs']=function(_0x5c2c70,_0x121437,_0x3b684c,_0x2ab83b,_0x2fe877,_0x3978e7,_0x2941b3,_0x5e16da){var _0x535928={};_0x3978e7[_0xb286('0x56')]=_0x3978e7[_0xb286('0x9')]?intUtil[_0xb286('0x57')](_0x3978e7['CloudProvider'][_0xb286('0xa')]):intUtil[_0xb286('0x57')](_0x3978e7[_0xb286('0x56')]);_0x3978e7[_0xb286('0x58')]=intUtil['stripTrailingSlash'](_0x3978e7['serverUrl']);_0x535928[_0xb286('0x4d')]=_0x5e16da===_0xb286('0x4e')||_0x5e16da==='unmanaged'?_0xb286('0x4e'):_0xb286('0x2b');var _0x4a6bad=_0x3978e7['modernAuthentication']?util[_0xb286('0x52')](_0xb286('0x59'),_0x3978e7[_0xb286('0xc')][_0xb286('0xa')]):util[_0xb286('0x52')](_0xb286('0x59'),_0x3978e7[_0xb286('0x56')]);var _0x155500=util[_0xb286('0x52')](_0xb286('0x5a'),_0x3978e7[_0xb286('0xb')]);var _0x5b9804=util[_0xb286('0x52')](_0xb286('0x5b'),_0x3978e7[_0xb286('0x58')],_0x121437[_0xb286('0x5c')],md5(_0x121437['uniqueid']));if(_0x2fe877&&_0x2fe877[_0xb286('0x5d')]){logger[_0xb286('0x22')](_0xb286('0x5e'),_0xb286('0x5f'));_0x121437['recordingURL']=_0x5b9804;}else if(_0x2941b3&&_0x2941b3[_0xb286('0x60')]&&_0x2941b3['recordingFormat']!=='none'){logger[_0xb286('0x22')](_0xb286('0x61'),_0xb286('0x5f'));_0x121437[_0xb286('0x62')]=_0x5b9804;}else{_0x121437['recordingURL']='';}return getUser(_0x535928,_0x3978e7,_0x2ab83b,_0x155500,_0x4a6bad,_0x5e16da)[_0xb286('0x14')](function(_0x5c9633){logger[_0xb286('0x22')]('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x63'),_0x5c9633[_0xb286('0x24')]);logger['info']('['+_0x5e16da[_0xb286('0x17')]()+']\x20The\x20User\x20email\x20is:',_0x5c9633[_0xb286('0x64')]);return getEndUser(_0x5c9633,_0x3978e7,_0x155500,_0x4a6bad,_0x121437,_0x5e16da,_0x3b684c[_0xb286('0x65')],_0x3b684c[_0xb286('0x66')]);})['then'](function(_0x41c6fe){logger[_0xb286('0x22')]('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x67'),_0x41c6fe[_0xb286('0x39')]);logger[_0xb286('0x22')]('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x68'),_0x121437['calleridnum']);return getTicket(_0x41c6fe,_0x3978e7,_0x155500,_0x4a6bad,_0x121437,_0x3b684c,_0x5e16da);})[_0xb286('0x14')](function(_0x308d09){logger['info'](util['format']('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x69'),_0x3b684c['ticketType'],_0x308d09[_0xb286('0x51')]));logger[_0xb286('0x22')](util[_0xb286('0x52')]('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x6a'),_0x5e16da));if(_0x5e16da!==_0xb286('0x6b')&&_0x3b684c['openNewTab']){logger[_0xb286('0x22')]('['+_0x5e16da['toUpperCase']()+']',_0xb286('0x6c'));emit(_0x3978e7[_0xb286('0x56')],_0x2ab83b[_0xb286('0x6d')],_0x3b684c[_0xb286('0x45')],_0x308d09[_0xb286('0x51')]);}})['catch'](function(_0x3b8de5){logger[_0xb286('0x6e')]('['+_0x5e16da[_0xb286('0x17')]()+_0xb286('0x6f'),_0x3b8de5[_0xb286('0x19')]);console[_0xb286('0x6e')](_0xb286('0x70'),_0x3b8de5);});}; \ 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 c63c8ec..eb3d4de 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 _0x3912=['Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','defaults','GET','forEach','includes','string','picklist','nameField','toLowerCase','toString','type','customField','push','content','variable','variableName','idField','customVariable','Variable','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','toUpperCase','lastevent','request-promise','md5','util','ioredis','./util','../../../../config/logger','freshdesk','redis','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridnum','getString','Subjects','Tags','name','custom_fields','mapValues','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x3912,0x95));var _0x2391=function(_0x335d86,_0x1782a2){_0x335d86=_0x335d86-0x0;var _0x36dfa1=_0x3912[_0x335d86];return _0x36dfa1;};'use strict';var _=require('lodash');var rp=require(_0x2391('0x0'));var md5=require(_0x2391('0x1'));var util=require(_0x2391('0x2'));var Redis=require(_0x2391('0x3'));var intUtil=require(_0x2391('0x4'));var config=require('../../../../config/environment');var logger=require(_0x2391('0x5'))(_0x2391('0x6'));config[_0x2391('0x7')]=_['defaults'](config[_0x2391('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x2391('0x8'))(new Redis(config[_0x2391('0x7')]));var headers={'Content-Type':_0x2391('0x9'),'Accept':_0x2391('0x9')};function emit(_0x12dd6f,_0x36f01a,_0x13a9d2){io['to'](_0x12dd6f)[_0x2391('0xa')](_0x36f01a,_0x13a9d2);}function getTicket(_0x9884c2,_0x48ddeb,_0x10f8fd,_0x44f89f,_0x458a26){logger[_0x2391('0xb')](_0x2391('0xc'));var _0x3d1045=_[_0x2391('0xd')]({'responder_id':_0x48ddeb['id'],'requester_id':_0x10f8fd['id'],'name':util[_0x2391('0xe')](_0x2391('0xf'),_0x458a26['calleridname']),'phone':_0x458a26[_0x2391('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2391('0x11')](_0x44f89f[_0x2391('0x12')],_0x458a26,'\x20'),'description':intUtil[_0x2391('0x11')](_0x44f89f['Descriptions'],_0x458a26,'
'),'tags':getTags(_0x44f89f[_0x2391('0x13')],_0x2391('0x14'))},getCustomFields(_0x44f89f['Fields'],_0x458a26));_0x3d1045[_0x2391('0x15')]=_[_0x2391('0x16')](_['keyBy'](_0x3d1045['custom_fields'],'id'),'value');return request({'uri':util['format'](_0x2391('0x17'),_0x9884c2[_0x2391('0x18')]),'method':_0x2391('0x19'),'body':_0x3d1045})[_0x2391('0x1a')](function(_0x50b470){logger[_0x2391('0xb')](_0x2391('0x1b'));return _0x50b470;});}function getUser(_0x39f20e,_0x5d1de7){if(intUtil[_0x2391('0x1c')](_0x5d1de7)){return request({'uri':util[_0x2391('0xe')]('%s/api/v2/agents',_0x39f20e[_0x2391('0x18')]),'qs':{'email':_0x5d1de7}})['then'](function(_0x3932b7){if(_0x3932b7[_0x2391('0x1d')]){logger[_0x2391('0xb')](_0x2391('0x1e'));return _[_0x2391('0x1f')](_0x3932b7,function(_0x25a33e){return _0x25a33e[_0x2391('0x20')]['email']===_0x5d1de7;});}else{logger[_0x2391('0xb')](_0x2391('0x21'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x39f20e[_0x2391('0x18')])})['then'](function(_0x4f8345){logger['info'](_0x2391('0x22'));return _0x4f8345;});}});}else{logger[_0x2391('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2391('0xe')]('%s/api/v2/agents/me',_0x39f20e[_0x2391('0x18')])})[_0x2391('0x1a')](function(_0x4468a3){logger['info']('Admin\x20account\x20selected.');return _0x4468a3;});}}function getEndUser(_0x4520d5,_0x21c422,_0x4c57ef){logger[_0x2391('0xb')](_0x2391('0x23'),_0x4c57ef);return request({'uri':util['format'](_0x2391('0x24'),_0x4520d5['remoteUri']),'qs':{'phone':_0x4c57ef}})[_0x2391('0x1a')](function(_0x21947c){if(_0x21947c[_0x2391('0x1d')]){logger[_0x2391('0xb')]('Enduser\x20found!');return _[_0x2391('0x1f')](_0x21947c,{'phone':_0x4c57ef});}else{logger['info'](_0x2391('0x25'));return request({'uri':util[_0x2391('0xe')](_0x2391('0x24'),_0x4520d5['remoteUri']),'method':_0x2391('0x19'),'body':{'name':_0x21c422,'phone':_0x4c57ef}})[_0x2391('0x1a')](function(_0x51cc47){logger[_0x2391('0xb')]('Enduser\x20created.');return _0x51cc47;});}});}function getAuth(_0x102438){return util[_0x2391('0xe')](_0x2391('0x26'),new Buffer(_0x102438[_0x2391('0x27')]+':X')['toString'](_0x2391('0x28')));}function request(_0x2e9b84){logger[_0x2391('0x29')](_0x2391('0x2a'),JSON[_0x2391('0x2b')](_0x2e9b84));return rp(_[_0x2391('0x2c')](_0x2e9b84,{'method':_0x2391('0x2d'),'headers':headers,'json':!![]}));}function getTags(_0x5ef921,_0x48c2cf){var _0x13fbe9=[];if(_0x5ef921&&_0x5ef921['length']>0x0){_0x13fbe9=_['map'](_0x5ef921,_0x48c2cf);}return _0x13fbe9;}function getCustomFields(_0x181a02,_0x1e9f25){var _0x37b27a=[];var _0x5ed6e3={'custom_fields':[]};if(_0x181a02[_0x2391('0x1d')]>0x0){_[_0x2391('0x2e')](_0x181a02,function(_0x517ac5){if(_[_0x2391('0x2f')]([_0x2391('0x30'),_0x2391('0x31')],_0x517ac5['type'])&&_0x517ac5[_0x2391('0x32')]&&!_0x517ac5['customField']){_0x5ed6e3[_0x517ac5['nameField'][_0x2391('0x33')]()]=_0x517ac5['content'][_0x2391('0x34')]();}else if(_[_0x2391('0x2f')]([_0x2391('0x30'),'picklist'],_0x517ac5[_0x2391('0x35')])&&_0x517ac5['idField']&&_0x517ac5[_0x2391('0x36')]){_0x5ed6e3[_0x2391('0x15')][_0x2391('0x37')]({'id':_0x517ac5['idField'],'value':_0x517ac5[_0x2391('0x38')][_0x2391('0x34')]()});}else if(_0x517ac5[_0x2391('0x35')]===_0x2391('0x39')&&_0x517ac5[_0x2391('0x3a')]&&_0x517ac5[_0x2391('0x3b')]&&_0x517ac5['customField']){_0x1e9f25[_0x517ac5[_0x2391('0x3a')]]&&_0x5ed6e3[_0x2391('0x15')][_0x2391('0x37')]({'id':_0x517ac5['idField'],'value':_0x1e9f25[_0x517ac5[_0x2391('0x3a')]][_0x2391('0x34')]()});}else if(_0x517ac5['type']===_0x2391('0x3c')&&_0x517ac5[_0x2391('0x3d')]&&_0x517ac5[_0x2391('0x3d')][_0x2391('0x14')]&&_0x517ac5[_0x2391('0x3b')]&&_0x517ac5[_0x2391('0x36')]){_0x1e9f25[_0x517ac5[_0x2391('0x3d')][_0x2391('0x14')]['toLowerCase']()]&&_0x5ed6e3[_0x2391('0x15')][_0x2391('0x37')]({'id':_0x517ac5[_0x2391('0x3b')],'value':_0x1e9f25[_0x517ac5[_0x2391('0x3d')][_0x2391('0x14')][_0x2391('0x33')]()]['toString']()});}});}return _0x5ed6e3;}exports[_0x2391('0x3e')]=function(_0x7a11ee,_0x6e6fde,_0x1dac11,_0xa9c837,_0x2ad330,_0xfb58ff){var _0x2dcf65,_0x1c8bbf;_0xfb58ff[_0x2391('0x18')]=intUtil['stripTrailingSlash'](_0xfb58ff[_0x2391('0x18')]);_0xfb58ff[_0x2391('0x3f')]=intUtil[_0x2391('0x40')](_0xfb58ff['serverUrl']);if(_0x2ad330&&_0x2ad330[_0x2391('0x41')]){logger['info']('[QUEUE]',_0x2391('0x42'));_0x6e6fde[_0x2391('0x43')]=util[_0x2391('0xe')](_0x2391('0x44'),_0xfb58ff['serverUrl'],_0x6e6fde[_0x2391('0x45')],md5(_0x6e6fde[_0x2391('0x45')]));}else{_0x6e6fde['recordingURL']='';}headers[_0x2391('0x46')]=getAuth(_0xfb58ff);return getUser(_0xfb58ff,_0xa9c837['email'])[_0x2391('0x1a')](function(_0x37aaa2){_0x2dcf65=_0x37aaa2;logger[_0x2391('0xb')](_0x2391('0x47'),_0x2dcf65['id']);return getEndUser(_0xfb58ff,_0x6e6fde[_0x2391('0x48')],_0x6e6fde[_0x2391('0x10')]);})[_0x2391('0x1a')](function(_0x5c7a01){_0x1c8bbf=_0x5c7a01;logger['info'](_0x2391('0x49'),_0x1c8bbf['id']);return getTicket(_0xfb58ff,_0x2dcf65,_0x1c8bbf,_0x1dac11,_0x6e6fde);})[_0x2391('0x1a')](function(_0x30c376){if(_0x30c376&&_0x30c376['id']){logger[_0x2391('0xb')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x30c376['id']);logger[_0x2391('0xb')](_0x2391('0x4a'),_0x2391('0x4b'));emit(util[_0x2391('0xe')](_0x2391('0x4c'),_0xa9c837[_0x2391('0x14')]),_0x2391('0x4d'),{'uri':util[_0x2391('0xe')](_0x2391('0x4e'),_0xfb58ff['remoteUri'],_0x30c376['id'])});}})[_0x2391('0x4f')](function(_0xeeb96b){logger[_0x2391('0x50')](_0x2391('0x4a'),JSON['stringify'](_0xeeb96b));});};exports[_0x2391('0x51')]=function(_0x594ed6,_0x1c8132,_0x431990,_0x145023,_0x83f839,_0x4725e9,_0x483b6f){var _0x438d63,_0x5a8761;_0x4725e9[_0x2391('0x18')]=intUtil[_0x2391('0x40')](_0x4725e9[_0x2391('0x18')]);_0x4725e9[_0x2391('0x3f')]=intUtil[_0x2391('0x40')](_0x4725e9[_0x2391('0x3f')]);if(_0x483b6f&&_0x483b6f['recordingFormat']&&_0x483b6f[_0x2391('0x52')]!==_0x2391('0x53')){logger[_0x2391('0xb')](_0x2391('0x54'),_0x2391('0x42'));_0x1c8132['recordingURL']=util[_0x2391('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4725e9['serverUrl'],_0x1c8132[_0x2391('0x45')],md5(_0x1c8132['uniqueid']));}headers[_0x2391('0x46')]=getAuth(_0x4725e9);return getUser(_0x4725e9,_0x145023[_0x2391('0x55')])['then'](function(_0x54223d){_0x438d63=_0x54223d;logger[_0x2391('0xb')]('The\x20User\x20ID\x20is:',_0x438d63['id']);return getEndUser(_0x4725e9,_0x1c8132[_0x2391('0x56')],_0x1c8132[_0x2391('0x57')]);})[_0x2391('0x1a')](function(_0x323912){_0x5a8761=_0x323912;logger['info'](_0x2391('0x49'),_0x5a8761['id']);return getTicket(_0x4725e9,_0x438d63,_0x5a8761,_0x431990,_0x1c8132);})[_0x2391('0x1a')](function(_0x3adcc5){if(_0x3adcc5&&_0x3adcc5['id']){logger[_0x2391('0xb')](_0x2391('0x1b'));logger['info'](_0x2391('0x58'),_0x3adcc5['id']);logger[_0x2391('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x2391('0xe')]('user:%s',_0x145023[_0x2391('0x14')]),_0x2391('0x4d'),{'uri':util[_0x2391('0xe')]('%s/helpdesk/tickets/%d',_0x4725e9[_0x2391('0x18')],_0x3adcc5['id'])});}})[_0x2391('0x4f')](function(_0x30bdc6){logger[_0x2391('0x50')](_0x2391('0x54'),JSON[_0x2391('0x2b')](_0x30bdc6));});};exports['unmanaged']=function(_0x399c3c,_0x376053,_0x40d7f3,_0x1674f3,_0x647cce,_0x698d48){var _0x1d70df,_0x3e6316;_0x698d48[_0x2391('0x18')]=intUtil[_0x2391('0x40')](_0x698d48[_0x2391('0x18')]);_0x698d48[_0x2391('0x3f')]=intUtil[_0x2391('0x40')](_0x698d48[_0x2391('0x3f')]);if(_0x647cce&&_0x647cce[_0x2391('0x41')]){logger['info']('['+_0x376053['lastevent'][_0x2391('0x59')]()+']',_0x2391('0x42'));_0x376053[_0x2391('0x43')]=util[_0x2391('0xe')](_0x2391('0x44'),_0x698d48['serverUrl'],_0x376053[_0x2391('0x45')],md5(_0x376053[_0x2391('0x45')]));}else{_0x376053['recordingURL']='';}headers[_0x2391('0x46')]=getAuth(_0x698d48);return getUser(_0x698d48,'')[_0x2391('0x1a')](function(_0x239370){_0x1d70df=_0x239370;logger['info'](_0x2391('0x47'),_0x1d70df['id']);return getEndUser(_0x698d48,_0x376053[_0x2391('0x48')],_0x376053[_0x2391('0x10')]);})[_0x2391('0x1a')](function(_0x3abded){_0x3e6316=_0x3abded;logger[_0x2391('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3e6316['id']);return getTicket(_0x698d48,_0x1d70df,_0x3e6316,_0x40d7f3,_0x376053);})[_0x2391('0x1a')](function(_0x4be44e){if(_0x4be44e){logger[_0x2391('0xb')](_0x2391('0x1b'));logger[_0x2391('0xb')](_0x2391('0x58'),_0x4be44e['id']);}})[_0x2391('0x4f')](function(_0x12ab0c){logger[_0x2391('0x50')]('['+_0x376053[_0x2391('0x5a')]['toUpperCase']()+']',JSON[_0x2391('0x2b')](_0x12ab0c));});}; \ No newline at end of file +var _0xc144=['Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','none','destcalleridnum','The\x20Ticket\x20ID\x20is:','[OUTBOUND]','lastevent','The\x20User\x20ID\x20is:','toUpperCase','stringify','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','application/json','info','merge','format','calleridname','calleridnum','getString','Subjects','
','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','POST','then','validateEmail','%s/api/v2/agents','remoteUri','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!','Searching\x20enduser\x20with\x20phone','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','base64','debug','defaults','GET','map','forEach','string','picklist','nameField','customField','toLowerCase','content','type','push','idField','variable','variableName','Variable','queue','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','Ticket\x20created!'];(function(_0x38b121,_0x561713){var _0x4fe806=function(_0x103045){while(--_0x103045){_0x38b121['push'](_0x38b121['shift']());}};_0x4fe806(++_0x561713);}(_0xc144,0x17b));var _0x4c14=function(_0x2940bf,_0x1a7281){_0x2940bf=_0x2940bf-0x0;var _0x4ca39e=_0xc144[_0x2940bf];return _0x4ca39e;};'use strict';var _=require(_0x4c14('0x0'));var rp=require('request-promise');var md5=require(_0x4c14('0x1'));var util=require(_0x4c14('0x2'));var Redis=require(_0x4c14('0x3'));var intUtil=require(_0x4c14('0x4'));var config=require(_0x4c14('0x5'));var logger=require(_0x4c14('0x6'))('freshdesk');config[_0x4c14('0x7')]=_['defaults'](config[_0x4c14('0x7')],{'host':_0x4c14('0x8'),'port':0x18eb});var io=require(_0x4c14('0x9'))(new Redis(config[_0x4c14('0x7')]));var headers={'Content-Type':_0x4c14('0xa'),'Accept':_0x4c14('0xa')};function emit(_0x162772,_0x5ba35d,_0x4c3469){io['to'](_0x162772)['emit'](_0x5ba35d,_0x4c3469);}function getTicket(_0x27807e,_0x6df13c,_0x1e065a,_0xeb98b2,_0x56aad3){logger[_0x4c14('0xb')]('Creating\x20new\x20ticket...');var _0x3182d8=_[_0x4c14('0xc')]({'responder_id':_0x6df13c['id'],'requester_id':_0x1e065a['id'],'name':util[_0x4c14('0xd')]('Caller\x20-\x20%s',_0x56aad3[_0x4c14('0xe')]),'phone':_0x56aad3[_0x4c14('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x4c14('0x10')](_0xeb98b2[_0x4c14('0x11')],_0x56aad3,'\x20'),'description':intUtil[_0x4c14('0x10')](_0xeb98b2['Descriptions'],_0x56aad3,_0x4c14('0x12')),'tags':getTags(_0xeb98b2['Tags'],_0x4c14('0x13'))},getCustomFields(_0xeb98b2[_0x4c14('0x14')],_0x56aad3));_0x3182d8[_0x4c14('0x15')]=_[_0x4c14('0x16')](_[_0x4c14('0x17')](_0x3182d8[_0x4c14('0x15')],'id'),_0x4c14('0x18'));return request({'uri':util['format'](_0x4c14('0x19'),_0x27807e['remoteUri']),'method':_0x4c14('0x1a'),'body':_0x3182d8})[_0x4c14('0x1b')](function(_0x5cd438){logger[_0x4c14('0xb')]('Ticket\x20created!');return _0x5cd438;});}function getUser(_0x3130de,_0x10898f){if(intUtil[_0x4c14('0x1c')](_0x10898f)){return request({'uri':util[_0x4c14('0xd')](_0x4c14('0x1d'),_0x3130de[_0x4c14('0x1e')]),'qs':{'email':_0x10898f}})[_0x4c14('0x1b')](function(_0x818e5){if(_0x818e5['length']){logger['info']('Agent\x20found!');return _[_0x4c14('0x1f')](_0x818e5,function(_0x1db5d6){return _0x1db5d6[_0x4c14('0x20')][_0x4c14('0x21')]===_0x10898f;});}else{logger['info'](_0x4c14('0x22'));return request({'uri':util['format'](_0x4c14('0x23'),_0x3130de['remoteUri'])})[_0x4c14('0x1b')](function(_0x42c1f9){logger[_0x4c14('0xb')](_0x4c14('0x24'));return _0x42c1f9;});}});}else{logger[_0x4c14('0xb')](_0x4c14('0x25'));return request({'uri':util[_0x4c14('0xd')](_0x4c14('0x23'),_0x3130de['remoteUri'])})[_0x4c14('0x1b')](function(_0x56ccbe){logger['info'](_0x4c14('0x24'));return _0x56ccbe;});}}function getEndUser(_0x1723c3,_0x47e307,_0x32688a){logger[_0x4c14('0xb')](_0x4c14('0x26'),_0x32688a);return request({'uri':util['format']('%s/api/v2/contacts',_0x1723c3[_0x4c14('0x1e')]),'qs':{'phone':_0x32688a}})['then'](function(_0x4d0b60){if(_0x4d0b60[_0x4c14('0x27')]){logger[_0x4c14('0xb')](_0x4c14('0x28'));return _[_0x4c14('0x1f')](_0x4d0b60,{'phone':_0x32688a});}else{logger['info'](_0x4c14('0x29'));return request({'uri':util['format'](_0x4c14('0x2a'),_0x1723c3['remoteUri']),'method':_0x4c14('0x1a'),'body':{'name':_0x47e307,'phone':_0x32688a}})[_0x4c14('0x1b')](function(_0x62fcf7){logger['info']('Enduser\x20created.');return _0x62fcf7;});}});}function getAuth(_0x25418b){return util[_0x4c14('0xd')](_0x4c14('0x2b'),new Buffer(_0x25418b[_0x4c14('0x2c')]+':X')[_0x4c14('0x2d')](_0x4c14('0x2e')));}function request(_0x1e7c26){logger[_0x4c14('0x2f')]('[HTTP]',JSON['stringify'](_0x1e7c26));return rp(_[_0x4c14('0x30')](_0x1e7c26,{'method':_0x4c14('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x6ff8a1,_0x191a12){var _0x15cc41=[];if(_0x6ff8a1&&_0x6ff8a1['length']>0x0){_0x15cc41=_[_0x4c14('0x32')](_0x6ff8a1,_0x191a12);}return _0x15cc41;}function getCustomFields(_0x351e40,_0x2068bb){var _0x8cdd21=[];var _0x573be9={'custom_fields':[]};if(_0x351e40[_0x4c14('0x27')]>0x0){_[_0x4c14('0x33')](_0x351e40,function(_0x1b52f6){if(_['includes']([_0x4c14('0x34'),_0x4c14('0x35')],_0x1b52f6['type'])&&_0x1b52f6[_0x4c14('0x36')]&&!_0x1b52f6[_0x4c14('0x37')]){_0x573be9[_0x1b52f6[_0x4c14('0x36')][_0x4c14('0x38')]()]=_0x1b52f6[_0x4c14('0x39')][_0x4c14('0x2d')]();}else if(_['includes']([_0x4c14('0x34'),_0x4c14('0x35')],_0x1b52f6[_0x4c14('0x3a')])&&_0x1b52f6['idField']&&_0x1b52f6[_0x4c14('0x37')]){_0x573be9[_0x4c14('0x15')][_0x4c14('0x3b')]({'id':_0x1b52f6[_0x4c14('0x3c')],'value':_0x1b52f6[_0x4c14('0x39')][_0x4c14('0x2d')]()});}else if(_0x1b52f6[_0x4c14('0x3a')]===_0x4c14('0x3d')&&_0x1b52f6['variableName']&&_0x1b52f6[_0x4c14('0x3c')]&&_0x1b52f6['customField']){_0x2068bb[_0x1b52f6[_0x4c14('0x3e')]]&&_0x573be9[_0x4c14('0x15')][_0x4c14('0x3b')]({'id':_0x1b52f6[_0x4c14('0x3c')],'value':_0x2068bb[_0x1b52f6['variableName']]['toString']()});}else if(_0x1b52f6[_0x4c14('0x3a')]==='customVariable'&&_0x1b52f6[_0x4c14('0x3f')]&&_0x1b52f6['Variable'][_0x4c14('0x13')]&&_0x1b52f6[_0x4c14('0x3c')]&&_0x1b52f6[_0x4c14('0x37')]){_0x2068bb[_0x1b52f6[_0x4c14('0x3f')][_0x4c14('0x13')][_0x4c14('0x38')]()]&&_0x573be9[_0x4c14('0x15')][_0x4c14('0x3b')]({'id':_0x1b52f6['idField'],'value':_0x2068bb[_0x1b52f6[_0x4c14('0x3f')]['name'][_0x4c14('0x38')]()][_0x4c14('0x2d')]()});}});}return _0x573be9;}exports[_0x4c14('0x40')]=function(_0x5e1346,_0x360ff7,_0x5b7a53,_0x2e72d7,_0x16b7d1,_0x5863a9){var _0x4e0a29,_0x28b608;_0x5863a9['remoteUri']=intUtil['stripTrailingSlash'](_0x5863a9[_0x4c14('0x1e')]);_0x5863a9['serverUrl']=intUtil[_0x4c14('0x41')](_0x5863a9['serverUrl']);if(_0x16b7d1&&_0x16b7d1[_0x4c14('0x42')]){logger[_0x4c14('0xb')](_0x4c14('0x43'),_0x4c14('0x44'));_0x360ff7[_0x4c14('0x45')]=util[_0x4c14('0xd')](_0x4c14('0x46'),_0x5863a9[_0x4c14('0x47')],_0x360ff7[_0x4c14('0x48')],md5(_0x360ff7[_0x4c14('0x48')]));}else{_0x360ff7[_0x4c14('0x45')]='';}headers[_0x4c14('0x49')]=getAuth(_0x5863a9);return getUser(_0x5863a9,_0x2e72d7[_0x4c14('0x21')])[_0x4c14('0x1b')](function(_0x8d0bf0){_0x4e0a29=_0x8d0bf0;logger[_0x4c14('0xb')]('The\x20User\x20ID\x20is:',_0x4e0a29['id']);return getEndUser(_0x5863a9,_0x360ff7[_0x4c14('0xe')],_0x360ff7[_0x4c14('0xf')]);})[_0x4c14('0x1b')](function(_0x54c2ba){_0x28b608=_0x54c2ba;logger[_0x4c14('0xb')](_0x4c14('0x4a'),_0x28b608['id']);return getTicket(_0x5863a9,_0x4e0a29,_0x28b608,_0x5b7a53,_0x360ff7);})[_0x4c14('0x1b')](function(_0x4978b6){if(_0x4978b6&&_0x4978b6['id']){logger[_0x4c14('0xb')](_0x4c14('0x4b'));logger[_0x4c14('0xb')]('The\x20Ticket\x20ID\x20is:',_0x4978b6['id']);logger[_0x4c14('0xb')](_0x4c14('0x43'),_0x4c14('0x4c'));emit(util[_0x4c14('0xd')](_0x4c14('0x4d'),_0x2e72d7[_0x4c14('0x13')]),_0x4c14('0x4e'),{'uri':util[_0x4c14('0xd')](_0x4c14('0x4f'),_0x5863a9[_0x4c14('0x1e')],_0x4978b6['id'])});}})[_0x4c14('0x50')](function(_0x4208fe){logger[_0x4c14('0x51')]('[QUEUE]',JSON['stringify'](_0x4208fe));});};exports[_0x4c14('0x52')]=function(_0x8b1513,_0x326711,_0x420893,_0x48cd73,_0x56b991,_0x5c9473,_0x29ddbb){var _0x5845d4,_0x18bae8;_0x5c9473[_0x4c14('0x1e')]=intUtil[_0x4c14('0x41')](_0x5c9473[_0x4c14('0x1e')]);_0x5c9473['serverUrl']=intUtil[_0x4c14('0x41')](_0x5c9473[_0x4c14('0x47')]);if(_0x29ddbb&&_0x29ddbb['recordingFormat']&&_0x29ddbb['recordingFormat']!==_0x4c14('0x53')){logger[_0x4c14('0xb')]('[OUTBOUND]',_0x4c14('0x44'));_0x326711[_0x4c14('0x45')]=util[_0x4c14('0xd')](_0x4c14('0x46'),_0x5c9473[_0x4c14('0x47')],_0x326711[_0x4c14('0x48')],md5(_0x326711[_0x4c14('0x48')]));}headers[_0x4c14('0x49')]=getAuth(_0x5c9473);return getUser(_0x5c9473,_0x48cd73[_0x4c14('0x21')])['then'](function(_0x2b563a){_0x5845d4=_0x2b563a;logger[_0x4c14('0xb')]('The\x20User\x20ID\x20is:',_0x5845d4['id']);return getEndUser(_0x5c9473,_0x326711['destcalleridname'],_0x326711[_0x4c14('0x54')]);})[_0x4c14('0x1b')](function(_0x9a06fa){_0x18bae8=_0x9a06fa;logger[_0x4c14('0xb')]('The\x20Enduser\x20ID\x20is:',_0x18bae8['id']);return getTicket(_0x5c9473,_0x5845d4,_0x18bae8,_0x420893,_0x326711);})[_0x4c14('0x1b')](function(_0x4711a8){if(_0x4711a8&&_0x4711a8['id']){logger[_0x4c14('0xb')]('Ticket\x20created!');logger[_0x4c14('0xb')](_0x4c14('0x55'),_0x4711a8['id']);logger['info'](_0x4c14('0x56'),_0x4c14('0x4c'));emit(util[_0x4c14('0xd')](_0x4c14('0x4d'),_0x48cd73['name']),_0x4c14('0x4e'),{'uri':util[_0x4c14('0xd')](_0x4c14('0x4f'),_0x5c9473['remoteUri'],_0x4711a8['id'])});}})[_0x4c14('0x50')](function(_0x45cfae){logger['error'](_0x4c14('0x56'),JSON['stringify'](_0x45cfae));});};exports['unmanaged']=function(_0x434d8c,_0x3eec8d,_0x1f192e,_0x4c77e3,_0xc0f25,_0x35c33c){var _0x3338aa,_0x58f0b6;_0x35c33c[_0x4c14('0x1e')]=intUtil[_0x4c14('0x41')](_0x35c33c[_0x4c14('0x1e')]);_0x35c33c[_0x4c14('0x47')]=intUtil[_0x4c14('0x41')](_0x35c33c[_0x4c14('0x47')]);if(_0xc0f25&&_0xc0f25[_0x4c14('0x42')]){logger[_0x4c14('0xb')]('['+_0x3eec8d[_0x4c14('0x57')]['toUpperCase']()+']',_0x4c14('0x44'));_0x3eec8d['recordingURL']=util['format'](_0x4c14('0x46'),_0x35c33c['serverUrl'],_0x3eec8d[_0x4c14('0x48')],md5(_0x3eec8d[_0x4c14('0x48')]));}else{_0x3eec8d[_0x4c14('0x45')]='';}headers[_0x4c14('0x49')]=getAuth(_0x35c33c);return getUser(_0x35c33c,'')[_0x4c14('0x1b')](function(_0x505c43){_0x3338aa=_0x505c43;logger[_0x4c14('0xb')](_0x4c14('0x58'),_0x3338aa['id']);return getEndUser(_0x35c33c,_0x3eec8d['calleridname'],_0x3eec8d[_0x4c14('0xf')]);})[_0x4c14('0x1b')](function(_0xa471d0){_0x58f0b6=_0xa471d0;logger[_0x4c14('0xb')](_0x4c14('0x4a'),_0x58f0b6['id']);return getTicket(_0x35c33c,_0x3338aa,_0x58f0b6,_0x1f192e,_0x3eec8d);})[_0x4c14('0x1b')](function(_0x1b53b3){if(_0x1b53b3){logger[_0x4c14('0xb')](_0x4c14('0x4b'));logger[_0x4c14('0xb')]('The\x20Ticket\x20ID\x20is:',_0x1b53b3['id']);}})['catch'](function(_0x3439ae){logger[_0x4c14('0x51')]('['+_0x3eec8d['lastevent'][_0x4c14('0x59')]()+']',JSON[_0x4c14('0x5a')](_0x3439ae));});}; \ 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 fc603d7..839b097 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 _0x12cd=['catch','message','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','add','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','apiKey','stripTrailingSlash','serverUrl','remoteUri','destcalleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','freshsales','defaults','socket.io-emitter','redis','GET','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','headers','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','email','userId','Admin\x20selected'];(function(_0x7a21da,_0x2a6cdf){var _0x44af7d=function(_0xbbc520){while(--_0xbbc520){_0x7a21da['push'](_0x7a21da['shift']());}};_0x44af7d(++_0x2a6cdf);}(_0x12cd,0x1c5));var _0xd12c=function(_0x66abf5,_0xa2ca54){_0x66abf5=_0x66abf5-0x0;var _0x431579=_0x12cd[_0x66abf5];return _0x431579;};'use strict';var _=require(_0xd12c('0x0'));var rp=require(_0xd12c('0x1'));var md5=require('md5');var util=require(_0xd12c('0x2'));var moment=require(_0xd12c('0x3'));var Promise=require(_0xd12c('0x4'));var Redis=require(_0xd12c('0x5'));var intUtil=require(_0xd12c('0x6'));var config=require(_0xd12c('0x7'));var logger=require('../../../../config/logger')(_0xd12c('0x8'));config['redis']=_[_0xd12c('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd12c('0xa'))(new Redis(config[_0xd12c('0xb')]));function getAdminId(_0x55592e,_0x43cff1,_0x31f5f5,_0x6ffe1){return new Promise(function(_0x51e401,_0x4223e6){var _0x5abad0=![];var _0x249c44={'method':_0xd12c('0xc'),'uri':_0x6ffe1+_0xd12c('0xd'),'json':!![]};_0x249c44['headers']=_0x31f5f5;logger[_0xd12c('0xe')](_0xd12c('0xf'));return rp(_0x249c44)[_0xd12c('0x10')](function(_0x6004ed){if(_0x6004ed){var _0x103af3=_0x6004ed[_0xd12c('0x11')];var _0x3b324f=null;for(_0x3b324f=0x0;_0x3b324f<_0x103af3[_0xd12c('0x12')];_0x3b324f++){if(_0x103af3[_0x3b324f]['email']===_0x55592e[_0xd12c('0x13')]){_0x55592e[_0xd12c('0x14')]=_0x103af3[_0x3b324f]['id'];_0x5abad0=!![];}}if(_0x5abad0){logger['info'](_0xd12c('0x15'),_0x55592e[_0xd12c('0x14')]);_0x51e401(_0x55592e);}else{_0x4223e6({'statusCode':0x194,'message':_0xd12c('0x16')});}}else{_0x4223e6({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1cb0dc){logger[_0xd12c('0x17')]('['+[_0x43cff1[_0xd12c('0x18')]()]+']',_0x1cb0dc['message']);_0x4223e6(_0x1cb0dc);});});}function getUser(_0x295f6,_0x252cd6,_0x4f75c4){return function(_0x206ab4){return new Promise(function(_0x4f0c1f,_0x2629ae){var _0x2a4073={'method':_0xd12c('0xc'),'uri':_0x4f75c4+_0xd12c('0xd'),'json':!![]};_0x2a4073[_0xd12c('0x19')]=_0x252cd6;logger[_0xd12c('0xe')](_0xd12c('0x1a'));return rp(_0x2a4073)[_0xd12c('0x10')](function(_0x1acbc2){if(_0x1acbc2){var _0xad48b1=_0x1acbc2['users'];var _0x235087=![];var _0x3d49ac=null;if(_0x206ab4['agentEmail']!==null){logger[_0xd12c('0xe')](_0xd12c('0x1b'),_0x206ab4[_0xd12c('0x1c')]);_0x206ab4[_0xd12c('0x1d')]=_0x206ab4[_0xd12c('0x1c')];for(_0x3d49ac=0x0;_0x3d49ac<_0xad48b1[_0xd12c('0x12')];_0x3d49ac++){if(_0xad48b1[_0x3d49ac][_0xd12c('0x1e')]===_0x206ab4[_0xd12c('0x1c')]){_0x235087=!![];_0x206ab4[_0xd12c('0x1f')]=_0xad48b1[_0x3d49ac]['id'];logger['info']('User\x20found:',_0x206ab4[_0xd12c('0x1f')]);}}}if(!_0x235087){logger[_0xd12c('0xe')](_0xd12c('0x20'));_0x206ab4[_0xd12c('0x1d')]=_0x206ab4[_0xd12c('0x13')];_0x206ab4[_0xd12c('0x1f')]=_0x206ab4[_0xd12c('0x14')];_0x235087=!![];}if(_0x235087){_0x4f0c1f(_0x206ab4);}else{_0x2629ae({'statusCode':0x194,'message':_0xd12c('0x16')});}}else{_0x2629ae({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0xd12c('0x21')](function(_0x17c897){logger[_0xd12c('0x17')]('['+[_0x295f6[_0xd12c('0x18')]()]+']',_0x17c897[_0xd12c('0x22')]);_0x2629ae(_0x17c897);});});};}function searchContact(_0x1fa54b,_0xa30b07,_0x502ca3,_0x5e8875){return new Promise(function(_0x1e8b82,_0x189d9d){var _0x49d2d6={'method':'GET','headers':_0xa30b07,'uri':_0x1fa54b+'/api/lookup?q='+_0x5e8875+_0xd12c('0x23')+_0x502ca3+_0xd12c('0x24'),'json':!![]};rp(_0x49d2d6)[_0xd12c('0x10')](function(_0x4c45eb){var _0x112465=_['find'](_0x4c45eb[_0xd12c('0x25')]['contacts'],[_0x502ca3,_0x5e8875]);_0x1e8b82(_0x112465);})[_0xd12c('0x21')](function(_0x45a0c5){_0x189d9d(_0x45a0c5);});});}function getEndUser(_0x3c5644,_0x5a8223,_0x188b63){return function(_0x2ca725){return new Promise(function(_0x5f151b,_0x518926){logger[_0xd12c('0xe')](util[_0xd12c('0x26')](_0xd12c('0x27'),_0x2ca725[_0xd12c('0x28')]));searchContact(_0x188b63,_0x5a8223,_0xd12c('0x29'),_0x2ca725[_0xd12c('0x28')])[_0xd12c('0x10')](function(_0x391da0){if(_0x391da0){_0x2ca725[_0xd12c('0x2a')]=_0x391da0['id'];logger[_0xd12c('0xe')](_0xd12c('0x2b'),_0x2ca725[_0xd12c('0x2a')]);return _0x5f151b(_0x2ca725);}searchContact(_0x188b63,_0x5a8223,'work_number',_0x2ca725['contactNumber'])[_0xd12c('0x10')](function(_0xa3bccc){if(_0xa3bccc){_0x2ca725[_0xd12c('0x2a')]=_0xa3bccc['id'];logger[_0xd12c('0xe')]('Contact\x20found\x20work_number:',_0x2ca725[_0xd12c('0x2a')]);return _0x5f151b(_0x2ca725);}createEndUser(_0x2ca725,_0x3c5644,_0x5a8223,_0x188b63)[_0xd12c('0x10')](function(_0x4bbb4b){logger['info'](_0xd12c('0x2c'),_0x4bbb4b[_0xd12c('0x2a')]);return _0x5f151b(_0x4bbb4b);});});})['catch'](function(_0x283333){_0x518926(_0x283333);});});};}function createEndUser(_0x4a6c72,_0x3fc360,_0x43c9be,_0x289432){return new Promise(function(_0x24c87f,_0x513d6f){var _0x5d9071=moment();var _0x267e10={'method':_0xd12c('0x2d'),'uri':_0x289432+_0xd12c('0x2e'),'body':{'contact':{'last_name':_0x4a6c72['contactNumber'],'work_number':_0x4a6c72[_0xd12c('0x28')],'mobile_number':_0x4a6c72[_0xd12c('0x28')],'owner_id':_0x4a6c72[_0xd12c('0x1f')],'created_at':_0x5d9071[_0xd12c('0x26')](_0xd12c('0x2f'))}},'json':!![]};_0x267e10[_0xd12c('0x19')]=_0x43c9be;logger['info']('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x267e10)[_0xd12c('0x10')](function(_0x4dacf6){_0x4a6c72[_0xd12c('0x2a')]=_0x4dacf6[_0xd12c('0x30')]['id'];_0x24c87f(_0x4a6c72);})[_0xd12c('0x21')](function(_0x110096){logger['error']('['+[_0x3fc360['toUpperCase']()]+']',_0x110096[_0xd12c('0x22')]);_0x513d6f(_0x110096[_0xd12c('0x22')]);});});}function getTicket(_0x452ca8,_0x5859fa,_0x36a5f0,_0x5c504c,_0x4279bf){return function(_0x446c04){logger[_0xd12c('0xe')](_0xd12c('0x31'));return new Promise(function(_0x5189d5,_0x26825a){var _0x1126ca=moment();var _0x281d75={'method':'POST','uri':_0x36a5f0+_0xd12c('0x32'),'body':{'title':intUtil[_0xd12c('0x33')](_0x5c504c['Subjects'],_0x4279bf,'\x20'),'description':intUtil[_0xd12c('0x33')](_0x5c504c[_0xd12c('0x34')],_0x4279bf,'\x0a'),'owner_id':_0x446c04[_0xd12c('0x1f')],'creater_id':_0x446c04['adminId'],'targetable_id':_0x446c04[_0xd12c('0x2a')],'targetable_type':'Contact','created_at':_0x1126ca['format'](_0xd12c('0x2f')),'due_date':_0x1126ca[_0xd12c('0x35')](0x1e,'m')['format'](_0xd12c('0x2f'))},'json':!![]};_0x281d75[_0xd12c('0x19')]=_0x5859fa;return rp(_0x281d75)[_0xd12c('0x10')](function(_0x4d9b6e){_0x446c04[_0xd12c('0x36')]=_0x4d9b6e[_0xd12c('0x37')]['id'];logger[_0xd12c('0xe')](_0xd12c('0x38'),_0x446c04[_0xd12c('0x36')]);_0x5189d5(_0x446c04);})[_0xd12c('0x21')](function(_0x432e8f){logger[_0xd12c('0x17')]('['+[_0x452ca8[_0xd12c('0x18')]()]+']',_0x432e8f['message']);_0x26825a(_0x432e8f['message']);});});};}function emit(_0x37d690,_0x5d8ffd,_0x4b581f){var _0x37cc3e={'uri':_0x37d690+_0xd12c('0x39')+_0x4b581f};io['to'](util[_0xd12c('0x26')](_0xd12c('0x3a'),_0x5d8ffd))[_0xd12c('0x3b')](_0xd12c('0x3c'),_0x37cc3e);}exports['cs']=function(_0x17df93,_0x402241,_0x10bbdd,_0x5b917e,_0x522895,_0x27a278,_0x3dff2f,_0x447021){var _0x2ee12f={};var _0x2b4858={'Authorization':'Token\x20token='+_0x27a278[_0xd12c('0x3d')]};_0x27a278['remoteUri']=intUtil[_0xd12c('0x3e')](_0x27a278['remoteUri']);_0x27a278[_0xd12c('0x3f')]=intUtil['stripTrailingSlash'](_0x27a278['serverUrl']);var _0x5df048=_0x27a278[_0xd12c('0x40')];_0x2ee12f[_0xd12c('0x13')]=_0x27a278['username'];_0x2ee12f[_0xd12c('0x28')]=_0x447021['toLowerCase']()==='outbound'?_0x402241[_0xd12c('0x41')]:_0x402241['calleridnum'];_0x2ee12f[_0xd12c('0x42')]=_0x447021===_0xd12c('0x43')||_0x447021===_0xd12c('0x44')?_0xd12c('0x43'):'outbound';if(_0x5b917e){_0x2ee12f[_0xd12c('0x1c')]=_0x5b917e[_0xd12c('0x1e')];}var _0x4fc280=util[_0xd12c('0x26')](_0xd12c('0x45'),_0x27a278['serverUrl'],_0x402241[_0xd12c('0x46')],md5(_0x402241[_0xd12c('0x46')]));if(_0x522895&&_0x522895[_0xd12c('0x47')]){logger[_0xd12c('0xe')]('[QUEUE]',_0xd12c('0x48'));_0x402241[_0xd12c('0x49')]=_0x4fc280;}else if(_0x3dff2f&&_0x3dff2f['recordingFormat']&&_0x3dff2f[_0xd12c('0x4a')]!=='none'){logger['info'](_0xd12c('0x4b'),_0xd12c('0x48'));_0x402241[_0xd12c('0x49')]=_0x4fc280;}else{_0x402241['recordingURL']='';}return getAdminId(_0x2ee12f,_0x447021,_0x2b4858,_0x5df048)['then'](getUser(_0x447021,_0x2b4858,_0x5df048))[_0xd12c('0x10')](getEndUser(_0x447021,_0x2b4858,_0x5df048))[_0xd12c('0x10')](getTicket(_0x447021,_0x2b4858,_0x5df048,_0x10bbdd,_0x402241))[_0xd12c('0x10')](function(_0x386463){logger['info'](util['format'](_0xd12c('0x4c'),_0x386463[_0xd12c('0x36')]));if(_0x447021!==_0xd12c('0x44')){logger[_0xd12c('0xe')]('['+[_0x447021[_0xd12c('0x18')]()]+']',_0xd12c('0x4d'));emit(_0x5df048,_0x5b917e[_0xd12c('0x4e')],_0x386463[_0xd12c('0x2a')]);}})[_0xd12c('0x21')](function(_0x1eed97){logger[_0xd12c('0x17')]('['+[_0x447021[_0xd12c('0x18')]()]+_0xd12c('0x4f'),util[_0xd12c('0x50')](_0x1eed97,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfc8b=['user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','destcalleridnum','calleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','name','lodash','request-promise','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','GET','Getting\x20user\x20list','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','email','User\x20found:','userId','adminEmail','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','message','Creating\x20new\x20task','/api/tasks','Subjects','getString','Descriptions','Contact','add','ticketId','task','Task\x20created:'];(function(_0x124d74,_0x18eda2){var _0x46418e=function(_0x75f580){while(--_0x75f580){_0x124d74['push'](_0x124d74['shift']());}};_0x46418e(++_0x18eda2);}(_0xfc8b,0xbb));var _0xbfc8=function(_0x8e98e6,_0x55b4bd){_0x8e98e6=_0x8e98e6-0x0;var _0x1d4063=_0xfc8b[_0x8e98e6];return _0x1d4063;};'use strict';var _=require(_0xbfc8('0x0'));var rp=require(_0xbfc8('0x1'));var md5=require('md5');var util=require(_0xbfc8('0x2'));var moment=require(_0xbfc8('0x3'));var Promise=require('bluebird');var Redis=require(_0xbfc8('0x4'));var intUtil=require(_0xbfc8('0x5'));var config=require(_0xbfc8('0x6'));var logger=require(_0xbfc8('0x7'))(_0xbfc8('0x8'));config[_0xbfc8('0x9')]=_[_0xbfc8('0xa')](config[_0xbfc8('0x9')],{'host':_0xbfc8('0xb'),'port':0x18eb});var io=require(_0xbfc8('0xc'))(new Redis(config[_0xbfc8('0x9')]));function getAdminId(_0x21c417,_0x311487,_0x5a4783,_0x4916d9){return new Promise(function(_0x5a044a,_0x2af829){var _0xdd4afc=![];var _0x15825c={'method':'GET','uri':_0x4916d9+_0xbfc8('0xd'),'json':!![]};_0x15825c[_0xbfc8('0xe')]=_0x5a4783;logger[_0xbfc8('0xf')](_0xbfc8('0x10'));return rp(_0x15825c)[_0xbfc8('0x11')](function(_0x2bdf9d){if(_0x2bdf9d){var _0x109e07=_0x2bdf9d['users'];var _0x28d3db=null;for(_0x28d3db=0x0;_0x28d3db<_0x109e07['length'];_0x28d3db++){if(_0x109e07[_0x28d3db]['email']===_0x21c417['adminEmail']){_0x21c417[_0xbfc8('0x12')]=_0x109e07[_0x28d3db]['id'];_0xdd4afc=!![];}}if(_0xdd4afc){logger[_0xbfc8('0xf')](_0xbfc8('0x13'),_0x21c417['adminId']);_0x5a044a(_0x21c417);}else{_0x2af829({'statusCode':0x194,'message':_0xbfc8('0x14')});}}else{_0x2af829({'statusCode':0x194,'message':_0xbfc8('0x14')});}})[_0xbfc8('0x15')](function(_0x62437e){logger[_0xbfc8('0x16')]('['+[_0x311487[_0xbfc8('0x17')]()]+']',_0x62437e['message']);_0x2af829(_0x62437e);});});}function getUser(_0x30d0d6,_0x19a0fa,_0x530122){return function(_0x5b6279){return new Promise(function(_0x39ea0d,_0x5eee63){var _0x183084={'method':_0xbfc8('0x18'),'uri':_0x530122+_0xbfc8('0xd'),'json':!![]};_0x183084[_0xbfc8('0xe')]=_0x19a0fa;logger['info'](_0xbfc8('0x19'));return rp(_0x183084)[_0xbfc8('0x11')](function(_0xa46d8){if(_0xa46d8){var _0x4e1914=_0xa46d8[_0xbfc8('0x1a')];var _0x44e4f8=![];var _0x6fa5df=null;if(_0x5b6279[_0xbfc8('0x1b')]!==null){logger[_0xbfc8('0xf')](_0xbfc8('0x1c'),_0x5b6279['agentEmail']);_0x5b6279[_0xbfc8('0x1d')]=_0x5b6279[_0xbfc8('0x1b')];for(_0x6fa5df=0x0;_0x6fa5df<_0x4e1914[_0xbfc8('0x1e')];_0x6fa5df++){if(_0x4e1914[_0x6fa5df][_0xbfc8('0x1f')]===_0x5b6279['agentEmail']){_0x44e4f8=!![];_0x5b6279['userId']=_0x4e1914[_0x6fa5df]['id'];logger[_0xbfc8('0xf')](_0xbfc8('0x20'),_0x5b6279[_0xbfc8('0x21')]);}}}if(!_0x44e4f8){logger[_0xbfc8('0xf')]('Admin\x20selected');_0x5b6279['userEmail']=_0x5b6279[_0xbfc8('0x22')];_0x5b6279[_0xbfc8('0x21')]=_0x5b6279[_0xbfc8('0x12')];_0x44e4f8=!![];}if(_0x44e4f8){_0x39ea0d(_0x5b6279);}else{_0x5eee63({'statusCode':0x194,'message':_0xbfc8('0x14')});}}else{_0x5eee63({'statusCode':0x194,'message':_0xbfc8('0x14')});}})[_0xbfc8('0x15')](function(_0x29fca9){logger[_0xbfc8('0x16')]('['+[_0x30d0d6['toUpperCase']()]+']',_0x29fca9['message']);_0x5eee63(_0x29fca9);});});};}function searchContact(_0x583d54,_0x2d3884,_0x4f02a0,_0x5df1ae){return new Promise(function(_0x413c45,_0x423953){var _0x3cce10={'method':'GET','headers':_0x2d3884,'uri':_0x583d54+_0xbfc8('0x23')+_0x5df1ae+_0xbfc8('0x24')+_0x4f02a0+_0xbfc8('0x25'),'json':!![]};rp(_0x3cce10)[_0xbfc8('0x11')](function(_0x361f12){var _0x3503e3=_['find'](_0x361f12[_0xbfc8('0x26')][_0xbfc8('0x26')],[_0x4f02a0,_0x5df1ae]);_0x413c45(_0x3503e3);})[_0xbfc8('0x15')](function(_0xa26e55){_0x423953(_0xa26e55);});});}function getEndUser(_0x2094ee,_0x15a97c,_0x3977af){return function(_0x1e3dcc){return new Promise(function(_0x17cfca,_0x40bd80){logger[_0xbfc8('0xf')](util[_0xbfc8('0x27')](_0xbfc8('0x28'),_0x1e3dcc[_0xbfc8('0x29')]));searchContact(_0x3977af,_0x15a97c,'mobile_number',_0x1e3dcc['contactNumber'])[_0xbfc8('0x11')](function(_0x54d854){if(_0x54d854){_0x1e3dcc[_0xbfc8('0x2a')]=_0x54d854['id'];logger[_0xbfc8('0xf')](_0xbfc8('0x2b'),_0x1e3dcc['endUserId']);return _0x17cfca(_0x1e3dcc);}searchContact(_0x3977af,_0x15a97c,'work_number',_0x1e3dcc['contactNumber'])[_0xbfc8('0x11')](function(_0x23304a){if(_0x23304a){_0x1e3dcc[_0xbfc8('0x2a')]=_0x23304a['id'];logger['info'](_0xbfc8('0x2c'),_0x1e3dcc[_0xbfc8('0x2a')]);return _0x17cfca(_0x1e3dcc);}createEndUser(_0x1e3dcc,_0x2094ee,_0x15a97c,_0x3977af)[_0xbfc8('0x11')](function(_0x1dab13){logger[_0xbfc8('0xf')](_0xbfc8('0x2d'),_0x1dab13[_0xbfc8('0x2a')]);return _0x17cfca(_0x1dab13);});});})[_0xbfc8('0x15')](function(_0x2dbe92){_0x40bd80(_0x2dbe92);});});};}function createEndUser(_0x2ebff2,_0x46dcbf,_0x318801,_0x306ebf){return new Promise(function(_0xb7cd38,_0x390610){var _0x24dbf2=moment();var _0x1c6e05={'method':_0xbfc8('0x2e'),'uri':_0x306ebf+_0xbfc8('0x2f'),'body':{'contact':{'last_name':_0x2ebff2[_0xbfc8('0x29')],'work_number':_0x2ebff2[_0xbfc8('0x29')],'mobile_number':_0x2ebff2['contactNumber'],'owner_id':_0x2ebff2[_0xbfc8('0x21')],'created_at':_0x24dbf2[_0xbfc8('0x27')](_0xbfc8('0x30'))}},'json':!![]};_0x1c6e05[_0xbfc8('0xe')]=_0x318801;logger[_0xbfc8('0xf')](_0xbfc8('0x31'));return rp(_0x1c6e05)[_0xbfc8('0x11')](function(_0x5d506a){_0x2ebff2[_0xbfc8('0x2a')]=_0x5d506a[_0xbfc8('0x32')]['id'];_0xb7cd38(_0x2ebff2);})[_0xbfc8('0x15')](function(_0x3ab6ea){logger[_0xbfc8('0x16')]('['+[_0x46dcbf[_0xbfc8('0x17')]()]+']',_0x3ab6ea['message']);_0x390610(_0x3ab6ea[_0xbfc8('0x33')]);});});}function getTicket(_0x385c69,_0x2afbac,_0x5c1449,_0x569943,_0x32ef79){return function(_0x54916c){logger[_0xbfc8('0xf')](_0xbfc8('0x34'));return new Promise(function(_0x3f461d,_0x46e908){var _0x1966f8=moment();var _0x5080ac={'method':_0xbfc8('0x2e'),'uri':_0x5c1449+_0xbfc8('0x35'),'body':{'title':intUtil['getString'](_0x569943[_0xbfc8('0x36')],_0x32ef79,'\x20'),'description':intUtil[_0xbfc8('0x37')](_0x569943[_0xbfc8('0x38')],_0x32ef79,'\x0a'),'owner_id':_0x54916c['userId'],'creater_id':_0x54916c[_0xbfc8('0x12')],'targetable_id':_0x54916c[_0xbfc8('0x2a')],'targetable_type':_0xbfc8('0x39'),'created_at':_0x1966f8[_0xbfc8('0x27')](_0xbfc8('0x30')),'due_date':_0x1966f8[_0xbfc8('0x3a')](0x1e,'m')['format'](_0xbfc8('0x30'))},'json':!![]};_0x5080ac['headers']=_0x2afbac;return rp(_0x5080ac)[_0xbfc8('0x11')](function(_0x58321b){_0x54916c[_0xbfc8('0x3b')]=_0x58321b[_0xbfc8('0x3c')]['id'];logger[_0xbfc8('0xf')](_0xbfc8('0x3d'),_0x54916c[_0xbfc8('0x3b')]);_0x3f461d(_0x54916c);})[_0xbfc8('0x15')](function(_0x3248dc){logger['error']('['+[_0x385c69[_0xbfc8('0x17')]()]+']',_0x3248dc[_0xbfc8('0x33')]);_0x46e908(_0x3248dc[_0xbfc8('0x33')]);});});};}function emit(_0x512001,_0x3d6fc2,_0x30042e){var _0x10d298={'uri':_0x512001+'/contacts/'+_0x30042e};io['to'](util[_0xbfc8('0x27')](_0xbfc8('0x3e'),_0x3d6fc2))[_0xbfc8('0x3f')](_0xbfc8('0x40'),_0x10d298);}exports['cs']=function(_0x42213e,_0x3fe18a,_0x3ad7d7,_0x32536f,_0x2800cb,_0x3509b2,_0x1a612c,_0x56b983){var _0x444756={};var _0x535e06={'Authorization':_0xbfc8('0x41')+_0x3509b2['apiKey']};_0x3509b2[_0xbfc8('0x42')]=intUtil[_0xbfc8('0x43')](_0x3509b2[_0xbfc8('0x42')]);_0x3509b2[_0xbfc8('0x44')]=intUtil[_0xbfc8('0x43')](_0x3509b2['serverUrl']);var _0x324e7e=_0x3509b2[_0xbfc8('0x42')];_0x444756[_0xbfc8('0x22')]=_0x3509b2['username'];_0x444756[_0xbfc8('0x29')]=_0x56b983[_0xbfc8('0x45')]()==='outbound'?_0x3fe18a[_0xbfc8('0x46')]:_0x3fe18a[_0xbfc8('0x47')];_0x444756[_0xbfc8('0x48')]=_0x56b983==='queue'||_0x56b983===_0xbfc8('0x49')?_0xbfc8('0x4a'):_0xbfc8('0x4b');if(_0x32536f){_0x444756['agentEmail']=_0x32536f['email'];}var _0x44fd1e=util[_0xbfc8('0x27')](_0xbfc8('0x4c'),_0x3509b2[_0xbfc8('0x44')],_0x3fe18a[_0xbfc8('0x4d')],md5(_0x3fe18a[_0xbfc8('0x4d')]));if(_0x2800cb&&_0x2800cb[_0xbfc8('0x4e')]){logger[_0xbfc8('0xf')]('[QUEUE]',_0xbfc8('0x4f'));_0x3fe18a[_0xbfc8('0x50')]=_0x44fd1e;}else if(_0x1a612c&&_0x1a612c['recordingFormat']&&_0x1a612c['recordingFormat']!=='none'){logger[_0xbfc8('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x3fe18a['recordingURL']=_0x44fd1e;}else{_0x3fe18a[_0xbfc8('0x50')]='';}return getAdminId(_0x444756,_0x56b983,_0x535e06,_0x324e7e)[_0xbfc8('0x11')](getUser(_0x56b983,_0x535e06,_0x324e7e))[_0xbfc8('0x11')](getEndUser(_0x56b983,_0x535e06,_0x324e7e))['then'](getTicket(_0x56b983,_0x535e06,_0x324e7e,_0x3ad7d7,_0x3fe18a))[_0xbfc8('0x11')](function(_0x58689a){logger[_0xbfc8('0xf')](util['format'](_0xbfc8('0x51'),_0x58689a[_0xbfc8('0x3b')]));if(_0x56b983!==_0xbfc8('0x49')){logger['info']('['+[_0x56b983['toUpperCase']()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x324e7e,_0x32536f[_0xbfc8('0x52')],_0x58689a[_0xbfc8('0x2a')]);}})[_0xbfc8('0x15')](function(_0x3c9261){logger[_0xbfc8('0x16')]('['+[_0x56b983['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x3c9261,{'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 b85e965..ecb7261 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 _0x8598=['zoho','dynamics365','servicenow','includes','data1','find','Configurations','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','toLowerCase','desk','vtiger','freshsales','unknown\x20integration','../../../../config/logger','error','format','data3','[EXEC]','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./servicenow','./dynamics365','zendesk','salesforce','sugarcrm','freshdesk'];(function(_0x1cf7ee,_0x21ed24){var _0x5d0a5d=function(_0x2617f1){while(--_0x2617f1){_0x1cf7ee['push'](_0x1cf7ee['shift']());}};_0x5d0a5d(++_0x21ed24);}(_0x8598,0x17f));var _0x8859=function(_0x5bda2c,_0x1cf31d){_0x5bda2c=_0x5bda2c-0x0;var _0x16b2bb=_0x8598[_0x5bda2c];return _0x16b2bb;};'use strict';var _=require(_0x8859('0x0'));var util=require(_0x8859('0x1'));var zendesk=require(_0x8859('0x2'));var salesforce=require(_0x8859('0x3'));var sugarcrm=require(_0x8859('0x4'));var freshdesk=require(_0x8859('0x5'));var zoho=require(_0x8859('0x6'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x8859('0x7'));var dynamics365=require(_0x8859('0x8'));var freshsales=require('./freshsales');var integrations=[_0x8859('0x9'),_0x8859('0xa'),_0x8859('0xb'),_0x8859('0xc'),_0x8859('0xd'),'desk','vtiger',_0x8859('0xe'),'freshsales',_0x8859('0xf')];exports['exec']=function(_0x5f212b,_0x86a3cb,_0x16da0b,_0x4f38a4,_0x25b3ac,_0xa31c74){if(_0x16da0b){if(_[_0x8859('0x10')](integrations,_0x5f212b['data1']['toLowerCase']())){try{var _0x6d0b57=null;var _0x3f0132='';var _0x3e6e57=_0x16da0b[_0x5f212b[_0x8859('0x11')]['toLowerCase']()];if(_0x3e6e57){var _0x4876f7=_0x3e6e57[_0x5f212b['data2']];if(_0x4876f7){var _0x138726=_[_0x8859('0x12')](_0x4876f7[_0x8859('0x13')],{'id':parseInt(_0x5f212b['data3'],0xa)});if(_0x138726){if(_0x4f38a4){if(_0x25b3ac&&_0x86a3cb[_0x8859('0x14')]){_0x3f0132=_0x8859('0x14');}else if(_0x86a3cb['routeId']){_0x3f0132=_0x8859('0x15');}else{console[_0x8859('0x16')](_0x8859('0x17'),_0x86a3cb);}}else{_0x3f0132=_0x8859('0x18');}switch(_0x5f212b[_0x8859('0x11')][_0x8859('0x19')]()){case _0x8859('0x9'):zendesk[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0xa'):salesforce[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case'sugarcrm':sugarcrm[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0xc'):freshdesk[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0xd'):zoho[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0x1a'):desk[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0x1b'):vtiger[_0x3f0132](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74);break;case _0x8859('0x1c'):freshsales['cs'](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74,_0x3f0132);break;case _0x8859('0xf'):servicenow['cs'](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74,_0x3f0132);break;case _0x8859('0xe'):dynamics365['cs'](_0x5f212b,_0x86a3cb,_0x138726,_0x4f38a4,_0x25b3ac,_0x4876f7,_0xa31c74,_0x3f0132);break;default:console['log'](_0x8859('0x1d'));}}else{_0x6d0b57=require(_0x8859('0x1e'))(_0x5f212b[_0x8859('0x11')][_0x8859('0x19')]());_0x6d0b57[_0x8859('0x1f')]('[EXEC]',util[_0x8859('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5f212b[_0x8859('0x11')][_0x8859('0x19')](),_0x5f212b[_0x8859('0x21')]));}}else{_0x6d0b57=require(_0x8859('0x1e'))(_0x5f212b[_0x8859('0x11')][_0x8859('0x19')]());_0x6d0b57['error'](_0x8859('0x22'),util[_0x8859('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x5f212b[_0x8859('0x11')][_0x8859('0x19')](),_0x5f212b[_0x8859('0x23')]));}}else{}}catch(_0xbbfca7){console[_0x8859('0x1f')](_0xbbfca7);}}}}; \ No newline at end of file +var _0x89b6=['%s\x20account\x20#%s\x20not\x20found','data2','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','zendesk','salesforce','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','toLowerCase','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','data1','sugarcrm','freshdesk','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x89b6,0x1ca));var _0x689b=function(_0x5dfcdf,_0x285e69){_0x5dfcdf=_0x5dfcdf-0x0;var _0xd97fa1=_0x89b6[_0x5dfcdf];return _0xd97fa1;};'use strict';var _=require(_0x689b('0x0'));var util=require(_0x689b('0x1'));var zendesk=require(_0x689b('0x2'));var salesforce=require(_0x689b('0x3'));var sugarcrm=require(_0x689b('0x4'));var freshdesk=require(_0x689b('0x5'));var zoho=require(_0x689b('0x6'));var desk=require(_0x689b('0x7'));var vtiger=require(_0x689b('0x8'));var servicenow=require(_0x689b('0x9'));var dynamics365=require(_0x689b('0xa'));var freshsales=require('./freshsales');var integrations=[_0x689b('0xb'),_0x689b('0xc'),'sugarcrm','freshdesk',_0x689b('0xd'),_0x689b('0xe'),_0x689b('0xf'),_0x689b('0x10'),_0x689b('0x11'),_0x689b('0x12')];exports[_0x689b('0x13')]=function(_0x55254a,_0x7911c6,_0x51b1c5,_0x3e76aa,_0x584a07,_0x55d2df){if(_0x51b1c5){if(_['includes'](integrations,_0x55254a['data1'][_0x689b('0x14')]())){try{var _0xef58a9=null;var _0x269d16='';var _0x3f3ab6=_0x51b1c5[_0x55254a['data1'][_0x689b('0x14')]()];if(_0x3f3ab6){var _0x566bdc=_0x3f3ab6[_0x55254a['data2']];if(_0x566bdc){var _0x436da5=_['find'](_0x566bdc[_0x689b('0x15')],{'id':parseInt(_0x55254a[_0x689b('0x16')],0xa)});if(_0x436da5){if(_0x3e76aa){if(_0x584a07&&_0x7911c6['queue']){_0x269d16=_0x689b('0x17');}else if(_0x7911c6[_0x689b('0x18')]){_0x269d16=_0x689b('0x19');}else{console[_0x689b('0x1a')](_0x689b('0x1b'),_0x7911c6);}}else{_0x269d16='unmanaged';}switch(_0x55254a[_0x689b('0x1c')][_0x689b('0x14')]()){case _0x689b('0xb'):zendesk[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0xc'):salesforce[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0x1d'):sugarcrm[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0x1e'):freshdesk[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0xd'):zoho[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0xe'):desk[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case'vtiger':vtiger[_0x269d16](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df);break;case _0x689b('0x11'):freshsales['cs'](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df,_0x269d16);break;case _0x689b('0x12'):servicenow['cs'](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df,_0x269d16);break;case'dynamics365':dynamics365['cs'](_0x55254a,_0x7911c6,_0x436da5,_0x3e76aa,_0x584a07,_0x566bdc,_0x55d2df,_0x269d16);break;default:console['log']('unknown\x20integration');}}else{_0xef58a9=require('../../../../config/logger')(_0x55254a[_0x689b('0x1c')]['toLowerCase']());_0xef58a9[_0x689b('0x1f')](_0x689b('0x20'),util[_0x689b('0x21')](_0x689b('0x22'),_0x55254a[_0x689b('0x1c')]['toLowerCase'](),_0x55254a[_0x689b('0x16')]));}}else{_0xef58a9=require(_0x689b('0x23'))(_0x55254a['data1']['toLowerCase']());_0xef58a9[_0x689b('0x1f')](_0x689b('0x20'),util['format'](_0x689b('0x24'),_0x55254a['data1'][_0x689b('0x14')](),_0x55254a[_0x689b('0x25')]));}}else{}}catch(_0x2b7f52){console[_0x689b('0x1f')](_0x2b7f52);}}}}; \ 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 040c96b..e73d2b3 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 _0xbb8b=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase','isNil',']\x20Ticket\x20%s\x20created.','lodash','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','utc','IsReminderSet','endUserType','WhoId','account','WhatId','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','identity','user_id','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','Name','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','create','forEach','picklist','idField','content','toString','type','variableName','customVariable','Variable','toLowerCase','password','concat','securityToken','Connection','https://login.salesforce.com','clientSecret','login','Connection\x20established.','queue','stripTrailingSlash','serverUrl','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','name','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat','[OUTBOUND]'];(function(_0xb61c63,_0x2d3ed9){var _0x899bc6=function(_0x16fdb3){while(--_0x16fdb3){_0xb61c63['push'](_0xb61c63['shift']());}};_0x899bc6(++_0x2d3ed9);}(_0xbb8b,0x10b));var _0xbbb8=function(_0xf28f5,_0x1672e0){_0xf28f5=_0xf28f5-0x0;var _0x55d2f4=_0xbb8b[_0xf28f5];return _0x55d2f4;};'use strict';var _=require(_0xbbb8('0x0'));var rp=require(_0xbbb8('0x1'));var moment=require(_0xbbb8('0x2'));var BPromise=require('bluebird');var md5=require(_0xbbb8('0x3'));var jsforce=require(_0xbbb8('0x4'));var util=require(_0xbbb8('0x5'));var Redis=require(_0xbbb8('0x6'));var intUtil=require(_0xbbb8('0x7'));var config=require(_0xbbb8('0x8'));var logger=require(_0xbbb8('0x9'))(_0xbbb8('0xa'));config[_0xbbb8('0xb')]=_[_0xbbb8('0xc')](config[_0xbbb8('0xb')],{'host':_0xbbb8('0xd'),'port':0x18eb});var io=require(_0xbbb8('0xe'))(new Redis(config[_0xbbb8('0xb')]));function emit(_0x36950b,_0xa5dc19,_0x2e6399){io['to'](_0x36950b)[_0xbbb8('0xf')](_0xa5dc19,_0x2e6399);}function getTicket(_0x4156e4,_0xcd28c4,_0x5477c9,_0x3ba342,_0x5e5bf5,_0x18451,_0x10906c,_0x6d2a4b){var _0x2d7c13=Object[_0xbbb8('0x10')]({},{'OwnerId':_0xcd28c4['id'],'Subject':intUtil[_0xbbb8('0x11')](_0x3ba342[_0xbbb8('0x12')],_0x5e5bf5,'\x20'),'Description':intUtil[_0xbbb8('0x11')](_0x3ba342['Descriptions'],_0x5e5bf5,'\x0a')},getCustomFields(_0x18451,_0x5e5bf5));if(_0x5477c9){if(_0x3ba342[_0xbbb8('0x13')]==='Task'){_0x2d7c13['ActivityDate']=moment[_0xbbb8('0x14')]();_0x2d7c13[_0xbbb8('0x15')]=![];_0x2d7c13['IsRecurrence']=![];if(_0x5477c9[_0xbbb8('0x16')]==='contact'||_0x5477c9[_0xbbb8('0x16')]==='lead'){_0x2d7c13[_0xbbb8('0x17')]=_0x5477c9['id'];}else if(_0x5477c9[_0xbbb8('0x16')]===_0xbbb8('0x18')){_0x2d7c13[_0xbbb8('0x19')]=_0x5477c9['id'];}}else if(_0x3ba342['ticketType']==='Case'){if(_0x5477c9['endUserType']===_0xbbb8('0x1a')){_0x2d7c13[_0xbbb8('0x1b')]=_0x5477c9['id'];}else if(_0x5477c9[_0xbbb8('0x16')]===_0xbbb8('0x18')){_0x2d7c13[_0xbbb8('0x1c')]=_0x5477c9['id'];}else if(_0x5477c9[_0xbbb8('0x16')]===_0xbbb8('0x1d')&&_0x3ba342['leadId']){_0x2d7c13[_0x3ba342[_0xbbb8('0x1e')]]=_0x5477c9['id'];}else{logger[_0xbbb8('0x1f')](_0xbbb8('0x20'));}}}return _0x10906c[_0xbbb8('0x21')](_0x3ba342[_0xbbb8('0x13')])['create'](_0x2d7c13);}function getUser(_0x5dcbf3,_0x13e266,_0x3f9db9){if(!_['isNil'](_0x13e266)&&intUtil[_0xbbb8('0x22')](_0x13e266)){var _0x1b2bb4={'Email':_0x13e266};var _0x1844fd={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3f9db9[_0xbbb8('0x21')](_0xbbb8('0x23'))[_0xbbb8('0x24')](_0x1b2bb4,_0x1844fd)[_0xbbb8('0x25')]()[_0xbbb8('0x26')](function(_0x292904){if(_0x292904[_0xbbb8('0x27')]){var _0x7ece19=_[_0xbbb8('0x24')](_0x292904,function(_0x5653e3){return _0x5653e3[_0xbbb8('0x28')]===_0x13e266;});if(_0x7ece19){logger[_0xbbb8('0x1f')](_0xbbb8('0x29'),_0x13e266);return BPromise[_0xbbb8('0x2a')]({'id':_0x7ece19['Id'],'name':_0x7ece19['Name']});}}else{logger[_0xbbb8('0x1f')](_0xbbb8('0x2b'),_0x13e266);return _0x3f9db9['identity']()[_0xbbb8('0x26')](function(_0x3289d2){return BPromise['resolve']({'id':_0x3289d2['user_id'],'name':_0x3289d2[_0xbbb8('0x2c')]});});}});}else{logger[_0xbbb8('0x1f')](_0xbbb8('0x2b'),_0x13e266);return _0x3f9db9[_0xbbb8('0x2d')]()['then'](function(_0x57e6f3){return BPromise['resolve']({'id':_0x57e6f3[_0xbbb8('0x2e')],'name':_0x57e6f3[_0xbbb8('0x2c')]});});}}function getEndUser(_0xd810c2,_0x5037dd,_0x2fb6aa,_0x28a384,_0xe78b60){var _0x30e037={'$or':{'Phone':_0x28a384}};var _0x28900a={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xbbb8('0x2a')]()[_0xbbb8('0x26')](function(){logger[_0xbbb8('0x1f')](_0xbbb8('0x2f'),_0x28a384,_0x5037dd[_0xbbb8('0x30')]);switch(_0x5037dd[_0xbbb8('0x30')]){case _0xbbb8('0x31'):var _0x272bf2=_[_0xbbb8('0x32')](_0x30e037);if(_0x5037dd[_0xbbb8('0x33')]){var _0x38662b={};_0x38662b[_0x5037dd[_0xbbb8('0x33')]]=_0x28a384;_[_0xbbb8('0x34')](_0x272bf2[_0xbbb8('0x35')],_0x38662b);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x36'))[_0xbbb8('0x24')](_0x272bf2,_0x28900a)[_0xbbb8('0x25')]()[_0xbbb8('0x26')](function(_0x522ab0){if(_0x522ab0&&_0x522ab0[_0xbbb8('0x27')]){return _0x522ab0;}else{var _0x1c648c=_[_0xbbb8('0x32')](_0x30e037);if(_0x5037dd[_0xbbb8('0x37')]){var _0xa56441={};_0xa56441[_0x5037dd['additionalSearchLead']]=_0x28a384;_[_0xbbb8('0x34')](_0x1c648c[_0xbbb8('0x35')],_0xa56441);}return _0xe78b60[_0xbbb8('0x21')]('Lead')[_0xbbb8('0x24')](_0x1c648c,_0x28900a);}});case _0xbbb8('0x38'):var _0x91fba3=_['cloneDeep'](_0x30e037);if(_0x5037dd[_0xbbb8('0x39')]){var _0x38662b={};_0x38662b[_0x5037dd['additionalSearchAccount']]=_0x28a384;_[_0xbbb8('0x34')](_0x91fba3[_0xbbb8('0x35')],_0x38662b);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x3a'))['find'](_0x91fba3,_0x28900a)[_0xbbb8('0x25')]()[_0xbbb8('0x26')](function(_0x1a0b4d){if(_0x1a0b4d&&_0x1a0b4d[_0xbbb8('0x27')]){return _0x1a0b4d;}else{var _0x823f0c=_[_0xbbb8('0x32')](_0x30e037);if(_0x5037dd['additionalSearchContact']){var _0x53042f={};_0x53042f[_0x5037dd[_0xbbb8('0x33')]]=_0x28a384;_[_0xbbb8('0x34')](_0x823f0c[_0xbbb8('0x35')],_0x53042f);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x36'))[_0xbbb8('0x24')](_0x823f0c,_0x28900a)[_0xbbb8('0x26')](function(_0x164cd5){if(_0x164cd5&&_0x164cd5['length']){return _0x164cd5;}else{var _0x10ba11=_['cloneDeep'](_0x30e037);if(_0x5037dd[_0xbbb8('0x37')]){var _0x367fd7={};_0x367fd7[_0x5037dd[_0xbbb8('0x37')]]=_0x28a384;_['merge'](_0x10ba11['$or'],_0x367fd7);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x3b'))[_0xbbb8('0x24')](_0x10ba11,_0x28900a);}});}});case _0xbbb8('0x1a'):var _0x272bf2=_[_0xbbb8('0x32')](_0x30e037);if(_0x5037dd['additionalSearchContact']){var _0x38662b={};_0x38662b[_0x5037dd[_0xbbb8('0x33')]]=_0x28a384;_[_0xbbb8('0x34')](_0x272bf2[_0xbbb8('0x35')],_0x38662b);}return _0xe78b60[_0xbbb8('0x21')]('Contact')[_0xbbb8('0x24')](_0x272bf2,_0x28900a)[_0xbbb8('0x25')]();case'lead':var _0x5bfdc1=_['cloneDeep'](_0x30e037);if(_0x5037dd[_0xbbb8('0x37')]){var _0x38662b={};_0x38662b[_0x5037dd[_0xbbb8('0x37')]]=_0x28a384;_[_0xbbb8('0x34')](_0x5bfdc1[_0xbbb8('0x35')],_0x38662b);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x3b'))[_0xbbb8('0x24')](_0x5bfdc1,_0x28900a);case'account':var _0x91fba3=_['cloneDeep'](_0x30e037);if(_0x5037dd[_0xbbb8('0x39')]){var _0x38662b={};_0x38662b[_0x5037dd[_0xbbb8('0x39')]]=_0x28a384;_[_0xbbb8('0x34')](_0x91fba3[_0xbbb8('0x35')],_0x38662b);}return _0xe78b60[_0xbbb8('0x21')](_0xbbb8('0x3a'))[_0xbbb8('0x24')](_0x91fba3,_0x28900a);default:return null;}})['then'](function(_0x49e8a6){if(_0x49e8a6&&_0x49e8a6[_0xbbb8('0x27')]){var _0x3605be=_[_0xbbb8('0x3c')](_0x49e8a6);if(_0x3605be){return BPromise['resolve']({'id':_0x3605be['Id'],'name':_0x3605be[_0xbbb8('0x3d')],'phone':_0x3605be[_0xbbb8('0x3e')],'endUserType':_0x3605be[_0xbbb8('0x3f')]['type']['toLowerCase']()});}}})[_0xbbb8('0x26')](function(_0x4cd6cf){if(_0x4cd6cf){logger['info'](_0xbbb8('0x40'),_0x4cd6cf[_0xbbb8('0x16')],_0x28a384);return BPromise[_0xbbb8('0x2a')](_0x4cd6cf);}else{logger['info'](_0xbbb8('0x41'),_0x28a384);var _0x2983df={'Phone':_0x28a384};if(_0x5037dd[_0xbbb8('0x42')]){if(_0x5037dd[_0xbbb8('0x42')]===_0xbbb8('0x1a')){logger[_0xbbb8('0x1f')](_0xbbb8('0x43'),_0x28a384,_0x5037dd[_0xbbb8('0x42')]);_0x2983df['LastName']=_0x2fb6aa!==_0xbbb8('0x44')?_0x2fb6aa:util[_0xbbb8('0x45')](_0xbbb8('0x46'),_0x28a384);}else if(_0x5037dd[_0xbbb8('0x42')]===_0xbbb8('0x1d')){logger[_0xbbb8('0x1f')](_0xbbb8('0x43'),_0x28a384,_0x5037dd[_0xbbb8('0x42')]);_0x2983df['LastName']=_0x2fb6aa!==''?_0x2fb6aa:util[_0xbbb8('0x45')](_0xbbb8('0x46'),_0x28a384);_0x2983df[_0xbbb8('0x47')]=_0xbbb8('0x48');}else if(_0x5037dd[_0xbbb8('0x42')]===_0xbbb8('0x18')){logger['info'](_0xbbb8('0x43'),_0x28a384,_0x5037dd[_0xbbb8('0x42')]);_0x2983df[_0xbbb8('0x3d')]=_0x2fb6aa!==_0xbbb8('0x44')?_0x2fb6aa:util['format'](_0xbbb8('0x46'),_0x28a384);}else{return null;}}return _0xe78b60['sobject'](_[_0xbbb8('0x49')](_0x5037dd[_0xbbb8('0x42')]))[_0xbbb8('0x4a')](_0x2983df)[_0xbbb8('0x26')](function(_0x552379){return BPromise[_0xbbb8('0x2a')]({'id':_0x552379['id'],'endUserType':_0x5037dd[_0xbbb8('0x42')]});});}});}function getCustomFields(_0x2f0547,_0x21055b){var _0x29f4df={};if(_0x2f0547[_0xbbb8('0x27')]>0x0){_[_0xbbb8('0x4b')](_0x2f0547,function(_0x501aeb){if(_['includes'](['string',_0xbbb8('0x4c')],_0x501aeb['type'])&&_0x501aeb[_0xbbb8('0x4d')]){_0x29f4df[_0x501aeb[_0xbbb8('0x4d')]]=_0x501aeb[_0xbbb8('0x4e')][_0xbbb8('0x4f')]();}else if(_0x501aeb[_0xbbb8('0x50')]==='variable'&&_0x501aeb[_0xbbb8('0x51')]&&_0x501aeb[_0xbbb8('0x4d')]){_0x21055b[_0x501aeb[_0xbbb8('0x51')]]&&(_0x29f4df[_0x501aeb['idField']]=_0x21055b[_0x501aeb[_0xbbb8('0x51')]][_0xbbb8('0x4f')]());}else if(_0x501aeb[_0xbbb8('0x50')]===_0xbbb8('0x52')&&_0x501aeb['Variable']&&_0x501aeb[_0xbbb8('0x53')]['name']&&_0x501aeb['idField']){_0x21055b[_0x501aeb[_0xbbb8('0x53')]['name'][_0xbbb8('0x54')]()]&&(_0x29f4df[_0x501aeb['idField']]=_0x21055b[_0x501aeb[_0xbbb8('0x53')]['name'][_0xbbb8('0x54')]()][_0xbbb8('0x4f')]());}});}return _0x29f4df;}function getConnection(_0x4066c8){var _0x3081de=_0x4066c8[_0xbbb8('0x55')][_0xbbb8('0x56')](_0x4066c8[_0xbbb8('0x57')]);var _0x33cd98=new jsforce[(_0xbbb8('0x58'))]({'oauth2':{'loginUrl':_0x4066c8['remoteUri']||_0xbbb8('0x59'),'clientId':_0x4066c8['clientId'],'clientSecret':_0x4066c8[_0xbbb8('0x5a')]}});return _0x33cd98[_0xbbb8('0x5b')](_0x4066c8['username'],_0x3081de)[_0xbbb8('0x26')](function(){logger[_0xbbb8('0x1f')](_0xbbb8('0x5c'));return _0x33cd98;});}exports[_0xbbb8('0x5d')]=function(_0x2c8196,_0x29ab67,_0x246d11,_0x126163,_0x3bc794,_0x3a16c5){var _0x2d7269,_0x2a8354,_0x3c4f74,_0x161058;_0x3a16c5['serverUrl']=intUtil[_0xbbb8('0x5e')](_0x3a16c5[_0xbbb8('0x5f')]);_0x3a16c5[_0xbbb8('0x60')]=intUtil[_0xbbb8('0x5e')](_0x3a16c5[_0xbbb8('0x60')]);if(_0x3bc794&&_0x3bc794[_0xbbb8('0x61')]){logger[_0xbbb8('0x1f')](_0xbbb8('0x62'),_0xbbb8('0x63'));_0x29ab67['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3a16c5[_0xbbb8('0x5f')],_0x29ab67['uniqueid'],md5(_0x29ab67[_0xbbb8('0x64')]));}else{_0x29ab67[_0xbbb8('0x65')]='';}return getConnection(_0x3a16c5)[_0xbbb8('0x26')](function(_0x22ba24){_0x161058=_0x22ba24;return getUser(_0x3a16c5,_0x126163[_0xbbb8('0x66')],_0x161058);})['then'](function(_0x26d629){_0x2d7269=_0x26d629;return getEndUser(_0x3a16c5,_0x246d11,_0x29ab67[_0xbbb8('0x67')],_0x29ab67['calleridnum'],_0x161058);})[_0xbbb8('0x26')](function(_0x3f1600){_0x2a8354=_0x3f1600;return getTicket(_0x3a16c5,_0x2d7269,_0x2a8354,_0x246d11,_0x29ab67,_0x246d11[_0xbbb8('0x68')],_0x161058,_0xbbb8('0x5d'));})[_0xbbb8('0x26')](function(_0x57f6f8){_0x3c4f74=_0x57f6f8;logger['info']('[QUEUE]\x20Ticket\x20%s\x20created',_0x3c4f74['id']);logger['info'](_0xbbb8('0x69'),_0x3c4f74['id'],_0x126163[_0xbbb8('0x6a')],_0x3a16c5[_0xbbb8('0x50')]);switch(_0x3a16c5['type']){case _0xbbb8('0x6b'):emit(util[_0xbbb8('0x45')](_0xbbb8('0x6c'),_0x126163['name']),_0xbbb8('0x6d'),{'recordId':_0x3c4f74['id']});break;case'newTab':emit(util['format']('user:%s',_0x126163[_0xbbb8('0x6a')]),'trigger:browser:url',{'uri':util[_0xbbb8('0x45')](_0xbbb8('0x6e'),_0x161058[_0xbbb8('0x6f')],_0x3c4f74['id'])});break;default:logger[_0xbbb8('0x70')](_0xbbb8('0x71'));}})[_0xbbb8('0x72')](function(_0x2c53ce){logger['error'](_0xbbb8('0x62'),_0x2c53ce);});};exports['outbound']=function(_0x127ffc,_0x458017,_0x5d13ae,_0x11a035,_0xd766b2,_0x3a36d4,_0x234dcf){var _0x42c17b,_0x370a03,_0x42babb,_0x32b4b5;_0x3a36d4['serverUrl']=intUtil[_0xbbb8('0x5e')](_0x3a36d4['serverUrl']);_0x3a36d4['remoteUri']=intUtil[_0xbbb8('0x5e')](_0x3a36d4[_0xbbb8('0x60')]);if(_0x234dcf&&_0x234dcf[_0xbbb8('0x73')]&&_0x234dcf[_0xbbb8('0x73')]!=='none'){logger['info'](_0xbbb8('0x74'),_0xbbb8('0x63'));_0x458017[_0xbbb8('0x65')]=util[_0xbbb8('0x45')](_0xbbb8('0x75'),_0x3a36d4[_0xbbb8('0x5f')],_0x458017['uniqueid'],md5(_0x458017[_0xbbb8('0x64')]));}return getConnection(_0x3a36d4)['then'](function(_0x4ea02c){_0x32b4b5=_0x4ea02c;return getUser(_0x3a36d4,_0x11a035['email'],_0x32b4b5);})[_0xbbb8('0x26')](function(_0x3cff70){_0x42c17b=_0x3cff70;return getEndUser(_0x3a36d4,_0x5d13ae,_0x458017[_0xbbb8('0x76')],_0x458017[_0xbbb8('0x77')],_0x32b4b5);})[_0xbbb8('0x26')](function(_0x2a713a){_0x370a03=_0x2a713a;return getTicket(_0x3a36d4,_0x42c17b,_0x370a03,_0x5d13ae,_0x458017,_0x5d13ae[_0xbbb8('0x68')],_0x32b4b5,'outbound');})[_0xbbb8('0x26')](function(_0x290690){_0x42babb=_0x290690;logger[_0xbbb8('0x1f')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x42babb['id']);logger[_0xbbb8('0x1f')](_0xbbb8('0x78'),_0x42babb['id'],_0x11a035[_0xbbb8('0x6a')],_0x3a36d4[_0xbbb8('0x50')]);switch(_0x3a36d4[_0xbbb8('0x50')]){case _0xbbb8('0x6b'):emit(util[_0xbbb8('0x45')](_0xbbb8('0x6c'),_0x11a035[_0xbbb8('0x6a')]),_0xbbb8('0x6d'),{'recordId':_0x42babb['id']});break;case _0xbbb8('0x79'):emit(util['format'](_0xbbb8('0x6c'),_0x11a035[_0xbbb8('0x6a')]),_0xbbb8('0x7a'),{'uri':util[_0xbbb8('0x45')](_0xbbb8('0x6e'),_0x32b4b5['instanceUrl'],_0x42babb['id'])});break;default:logger[_0xbbb8('0x70')](_0xbbb8('0x74'),_0xbbb8('0x7b'));}})[_0xbbb8('0x72')](function(_0x4df64e){logger[_0xbbb8('0x70')](_0xbbb8('0x74'),_0x4df64e);});};exports['unmanaged']=function(_0x271082,_0x15b6b9,_0x1a4e13,_0x4b8166,_0x54e598,_0x47f296){var _0x59d0cc,_0x3f4467,_0x22a981,_0x58a67d;_0x47f296['serverUrl']=intUtil[_0xbbb8('0x5e')](_0x47f296[_0xbbb8('0x5f')]);_0x47f296[_0xbbb8('0x60')]=intUtil[_0xbbb8('0x5e')](_0x47f296[_0xbbb8('0x60')]);if(_0x54e598&&_0x54e598[_0xbbb8('0x61')]){logger[_0xbbb8('0x1f')]('['+_0x15b6b9[_0xbbb8('0x7c')][_0xbbb8('0x7d')]()+']',_0xbbb8('0x63'));_0x15b6b9[_0xbbb8('0x65')]=util[_0xbbb8('0x45')](_0xbbb8('0x75'),_0x47f296[_0xbbb8('0x5f')],_0x15b6b9[_0xbbb8('0x64')],md5(_0x15b6b9[_0xbbb8('0x64')]));}else{_0x15b6b9['recordingURL']='';}return getConnection(_0x47f296)[_0xbbb8('0x26')](function(_0x332ca3){_0x58a67d=_0x332ca3;if(!_[_0xbbb8('0x7e')](_0x4b8166)){return getUser(_0x47f296,_0x4b8166['name'],_0x58a67d);}else{return getUser(_0x47f296,null,_0x58a67d);}})[_0xbbb8('0x26')](function(_0x3cadc7){_0x59d0cc=_0x3cadc7;return getEndUser(_0x47f296,_0x1a4e13,_0x15b6b9[_0xbbb8('0x67')],_0x15b6b9['calleridnum'],_0x58a67d);})['then'](function(_0x1959dc){_0x3f4467=_0x1959dc;return getTicket(_0x47f296,_0x59d0cc,_0x3f4467,_0x1a4e13,_0x15b6b9,_0x1a4e13[_0xbbb8('0x68')],_0x58a67d);})[_0xbbb8('0x26')](function(_0x30a7b7){_0x22a981=_0x30a7b7;logger[_0xbbb8('0x1f')]('['+_0x15b6b9[_0xbbb8('0x7c')][_0xbbb8('0x7d')]()+_0xbbb8('0x7f'),_0x22a981['id']);logger[_0xbbb8('0x1f')]('['+_0x15b6b9['lastevent'][_0xbbb8('0x7d')]()+']\x20Integration\x20account\x20type\x20%s.',_0x47f296[_0xbbb8('0x50')]);})[_0xbbb8('0x72')](function(_0x39a59b){logger[_0xbbb8('0x70')]('['+_0x15b6b9[_0xbbb8('0x7c')]['toUpperCase']()+']',_0x39a59b);});}; \ No newline at end of file +var _0x8eb9=['calleridname','calleridnum','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','trigger:browser:url','lastevent','toUpperCase','isNil',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','assign','Subjects','Descriptions','ticketType','Task','IsReminderSet','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','create','sobject','User','then','length','info','resolve','Name','identity','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','find','execute','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Account','Phone','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','forEach','includes','string','type','idField','content','variable','variableName','Variable','name','password','concat','securityToken','Connection','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','remoteUri','monitor_format','[QUEUE]','recordingURL','uniqueid'];(function(_0xf3ed10,_0xd38216){var _0x81f21f=function(_0x1f7927){while(--_0x1f7927){_0xf3ed10['push'](_0xf3ed10['shift']());}};_0x81f21f(++_0xd38216);}(_0x8eb9,0x90));var _0x98eb=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8eb9[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x98eb('0x0'));var rp=require(_0x98eb('0x1'));var moment=require(_0x98eb('0x2'));var BPromise=require(_0x98eb('0x3'));var md5=require(_0x98eb('0x4'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0x98eb('0x5'));var intUtil=require(_0x98eb('0x6'));var config=require(_0x98eb('0x7'));var logger=require(_0x98eb('0x8'))(_0x98eb('0x9'));config[_0x98eb('0xa')]=_[_0x98eb('0xb')](config[_0x98eb('0xa')],{'host':_0x98eb('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x98eb('0xa')]));function emit(_0x4d3b59,_0x54eddf,_0x206a99){io['to'](_0x4d3b59)['emit'](_0x54eddf,_0x206a99);}function getTicket(_0x369aeb,_0xb30bfb,_0xad8a66,_0x364734,_0x30e427,_0xff1724,_0x389993,_0x50c6b5){var _0x5df111=Object[_0x98eb('0xd')]({},{'OwnerId':_0xb30bfb['id'],'Subject':intUtil['getString'](_0x364734[_0x98eb('0xe')],_0x30e427,'\x20'),'Description':intUtil['getString'](_0x364734[_0x98eb('0xf')],_0x30e427,'\x0a')},getCustomFields(_0xff1724,_0x30e427));if(_0xad8a66){if(_0x364734[_0x98eb('0x10')]===_0x98eb('0x11')){_0x5df111['ActivityDate']=moment['utc']();_0x5df111[_0x98eb('0x12')]=![];_0x5df111['IsRecurrence']=![];if(_0xad8a66[_0x98eb('0x13')]===_0x98eb('0x14')||_0xad8a66['endUserType']===_0x98eb('0x15')){_0x5df111[_0x98eb('0x16')]=_0xad8a66['id'];}else if(_0xad8a66[_0x98eb('0x13')]===_0x98eb('0x17')){_0x5df111[_0x98eb('0x18')]=_0xad8a66['id'];}}else if(_0x364734[_0x98eb('0x10')]===_0x98eb('0x19')){if(_0xad8a66[_0x98eb('0x13')]===_0x98eb('0x14')){_0x5df111[_0x98eb('0x1a')]=_0xad8a66['id'];}else if(_0xad8a66['endUserType']==='account'){_0x5df111[_0x98eb('0x1b')]=_0xad8a66['id'];}else if(_0xad8a66[_0x98eb('0x13')]==='lead'&&_0x364734[_0x98eb('0x1c')]){_0x5df111[_0x364734[_0x98eb('0x1c')]]=_0xad8a66['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x389993['sobject'](_0x364734[_0x98eb('0x10')])[_0x98eb('0x1d')](_0x5df111);}function getUser(_0x426dd1,_0x4d8ee2,_0x3ac817){if(!_['isNil'](_0x4d8ee2)&&intUtil['validateEmail'](_0x4d8ee2)){var _0x226f03={'Email':_0x4d8ee2};var _0x29b18e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3ac817[_0x98eb('0x1e')](_0x98eb('0x1f'))['find'](_0x226f03,_0x29b18e)['execute']()[_0x98eb('0x20')](function(_0x56c9c4){if(_0x56c9c4[_0x98eb('0x21')]){var _0x56ab93=_['find'](_0x56c9c4,function(_0xa81302){return _0xa81302['Email']===_0x4d8ee2;});if(_0x56ab93){logger[_0x98eb('0x22')]('Agent\x20%s\x20found.',_0x4d8ee2);return BPromise[_0x98eb('0x23')]({'id':_0x56ab93['Id'],'name':_0x56ab93[_0x98eb('0x24')]});}}else{logger[_0x98eb('0x22')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4d8ee2);return _0x3ac817[_0x98eb('0x25')]()[_0x98eb('0x20')](function(_0x5b2644){return BPromise[_0x98eb('0x23')]({'id':_0x5b2644[_0x98eb('0x26')],'name':_0x5b2644[_0x98eb('0x27')]});});}});}else{logger['info'](_0x98eb('0x28'),_0x4d8ee2);return _0x3ac817['identity']()[_0x98eb('0x20')](function(_0x44e9c3){return BPromise[_0x98eb('0x23')]({'id':_0x44e9c3[_0x98eb('0x26')],'name':_0x44e9c3[_0x98eb('0x27')]});});}}function getEndUser(_0x50ccde,_0x3e361f,_0x2cbdd8,_0x3ba0ba,_0x2c076b){var _0x359857={'$or':{'Phone':_0x3ba0ba}};var _0x3e23ca={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x98eb('0x23')]()[_0x98eb('0x20')](function(){logger[_0x98eb('0x22')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x3ba0ba,_0x3e361f[_0x98eb('0x29')]);switch(_0x3e361f[_0x98eb('0x29')]){case'contact_lead':var _0x57b7cb=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f[_0x98eb('0x2b')]){var _0x38d1a1={};_0x38d1a1[_0x3e361f[_0x98eb('0x2b')]]=_0x3ba0ba;_[_0x98eb('0x2c')](_0x57b7cb[_0x98eb('0x2d')],_0x38d1a1);}return _0x2c076b[_0x98eb('0x1e')](_0x98eb('0x2e'))[_0x98eb('0x2f')](_0x57b7cb,_0x3e23ca)[_0x98eb('0x30')]()[_0x98eb('0x20')](function(_0x197181){if(_0x197181&&_0x197181[_0x98eb('0x21')]){return _0x197181;}else{var _0x26769c=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f[_0x98eb('0x31')]){var _0x382e05={};_0x382e05[_0x3e361f[_0x98eb('0x31')]]=_0x3ba0ba;_[_0x98eb('0x2c')](_0x26769c[_0x98eb('0x2d')],_0x382e05);}return _0x2c076b[_0x98eb('0x1e')]('Lead')['find'](_0x26769c,_0x3e23ca);}});case _0x98eb('0x32'):var _0xdd78c=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f[_0x98eb('0x33')]){var _0x38d1a1={};_0x38d1a1[_0x3e361f[_0x98eb('0x33')]]=_0x3ba0ba;_['merge'](_0xdd78c[_0x98eb('0x2d')],_0x38d1a1);}return _0x2c076b[_0x98eb('0x1e')]('Account')['find'](_0xdd78c,_0x3e23ca)['execute']()[_0x98eb('0x20')](function(_0x40bc4c){if(_0x40bc4c&&_0x40bc4c['length']){return _0x40bc4c;}else{var _0x13b05b=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f['additionalSearchContact']){var _0x467a2b={};_0x467a2b[_0x3e361f[_0x98eb('0x2b')]]=_0x3ba0ba;_[_0x98eb('0x2c')](_0x13b05b[_0x98eb('0x2d')],_0x467a2b);}return _0x2c076b[_0x98eb('0x1e')](_0x98eb('0x2e'))[_0x98eb('0x2f')](_0x13b05b,_0x3e23ca)['then'](function(_0x3505c2){if(_0x3505c2&&_0x3505c2[_0x98eb('0x21')]){return _0x3505c2;}else{var _0x16052c=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f[_0x98eb('0x31')]){var _0x1af535={};_0x1af535[_0x3e361f[_0x98eb('0x31')]]=_0x3ba0ba;_[_0x98eb('0x2c')](_0x16052c['$or'],_0x1af535);}return _0x2c076b[_0x98eb('0x1e')]('Lead')['find'](_0x16052c,_0x3e23ca);}});}});case'contact':var _0x57b7cb=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f[_0x98eb('0x2b')]){var _0x38d1a1={};_0x38d1a1[_0x3e361f[_0x98eb('0x2b')]]=_0x3ba0ba;_[_0x98eb('0x2c')](_0x57b7cb[_0x98eb('0x2d')],_0x38d1a1);}return _0x2c076b[_0x98eb('0x1e')](_0x98eb('0x2e'))[_0x98eb('0x2f')](_0x57b7cb,_0x3e23ca)[_0x98eb('0x30')]();case _0x98eb('0x15'):var _0x39acd7=_['cloneDeep'](_0x359857);if(_0x3e361f[_0x98eb('0x31')]){var _0x38d1a1={};_0x38d1a1[_0x3e361f[_0x98eb('0x31')]]=_0x3ba0ba;_['merge'](_0x39acd7[_0x98eb('0x2d')],_0x38d1a1);}return _0x2c076b[_0x98eb('0x1e')](_0x98eb('0x34'))[_0x98eb('0x2f')](_0x39acd7,_0x3e23ca);case _0x98eb('0x17'):var _0xdd78c=_[_0x98eb('0x2a')](_0x359857);if(_0x3e361f['additionalSearchAccount']){var _0x38d1a1={};_0x38d1a1[_0x3e361f['additionalSearchAccount']]=_0x3ba0ba;_[_0x98eb('0x2c')](_0xdd78c['$or'],_0x38d1a1);}return _0x2c076b[_0x98eb('0x1e')](_0x98eb('0x35'))[_0x98eb('0x2f')](_0xdd78c,_0x3e23ca);default:return null;}})[_0x98eb('0x20')](function(_0x4dddc2){if(_0x4dddc2&&_0x4dddc2[_0x98eb('0x21')]){var _0x508815=_['first'](_0x4dddc2);if(_0x508815){return BPromise[_0x98eb('0x23')]({'id':_0x508815['Id'],'name':_0x508815[_0x98eb('0x24')],'phone':_0x508815[_0x98eb('0x36')],'endUserType':_0x508815[_0x98eb('0x37')]['type'][_0x98eb('0x38')]()});}}})[_0x98eb('0x20')](function(_0x17ab63){if(_0x17ab63){logger[_0x98eb('0x22')](_0x98eb('0x39'),_0x17ab63['endUserType'],_0x3ba0ba);return BPromise[_0x98eb('0x23')](_0x17ab63);}else{logger['info']('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x3ba0ba);var _0x25e813={'Phone':_0x3ba0ba};if(_0x3e361f[_0x98eb('0x3a')]){if(_0x3e361f[_0x98eb('0x3a')]===_0x98eb('0x14')){logger[_0x98eb('0x22')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x3ba0ba,_0x3e361f['moduleCreate']);_0x25e813[_0x98eb('0x3b')]=_0x2cbdd8!==_0x98eb('0x3c')?_0x2cbdd8:util[_0x98eb('0x3d')](_0x98eb('0x3e'),_0x3ba0ba);}else if(_0x3e361f[_0x98eb('0x3a')]===_0x98eb('0x15')){logger[_0x98eb('0x22')](_0x98eb('0x3f'),_0x3ba0ba,_0x3e361f['moduleCreate']);_0x25e813['LastName']=_0x2cbdd8!==_0x98eb('0x3c')?_0x2cbdd8:util[_0x98eb('0x3d')](_0x98eb('0x3e'),_0x3ba0ba);_0x25e813[_0x98eb('0x40')]=_0x98eb('0x41');}else if(_0x3e361f[_0x98eb('0x3a')]===_0x98eb('0x17')){logger[_0x98eb('0x22')](_0x98eb('0x3f'),_0x3ba0ba,_0x3e361f[_0x98eb('0x3a')]);_0x25e813[_0x98eb('0x24')]=_0x2cbdd8!==''?_0x2cbdd8:util['format']('Caller\x20-\x20%s',_0x3ba0ba);}else{return null;}}return _0x2c076b['sobject'](_['upperFirst'](_0x3e361f[_0x98eb('0x3a')]))['create'](_0x25e813)['then'](function(_0x337eaf){return BPromise['resolve']({'id':_0x337eaf['id'],'endUserType':_0x3e361f['moduleCreate']});});}});}function getCustomFields(_0x49962f,_0x68b9b0){var _0x3238b7={};if(_0x49962f[_0x98eb('0x21')]>0x0){_[_0x98eb('0x42')](_0x49962f,function(_0x2b658f){if(_[_0x98eb('0x43')]([_0x98eb('0x44'),'picklist'],_0x2b658f[_0x98eb('0x45')])&&_0x2b658f[_0x98eb('0x46')]){_0x3238b7[_0x2b658f['idField']]=_0x2b658f[_0x98eb('0x47')]['toString']();}else if(_0x2b658f[_0x98eb('0x45')]===_0x98eb('0x48')&&_0x2b658f['variableName']&&_0x2b658f['idField']){_0x68b9b0[_0x2b658f['variableName']]&&(_0x3238b7[_0x2b658f[_0x98eb('0x46')]]=_0x68b9b0[_0x2b658f[_0x98eb('0x49')]]['toString']());}else if(_0x2b658f[_0x98eb('0x45')]==='customVariable'&&_0x2b658f[_0x98eb('0x4a')]&&_0x2b658f['Variable'][_0x98eb('0x4b')]&&_0x2b658f[_0x98eb('0x46')]){_0x68b9b0[_0x2b658f[_0x98eb('0x4a')][_0x98eb('0x4b')]['toLowerCase']()]&&(_0x3238b7[_0x2b658f[_0x98eb('0x46')]]=_0x68b9b0[_0x2b658f[_0x98eb('0x4a')][_0x98eb('0x4b')][_0x98eb('0x38')]()]['toString']());}});}return _0x3238b7;}function getConnection(_0x2a5c79){var _0x2accd6=_0x2a5c79[_0x98eb('0x4c')][_0x98eb('0x4d')](_0x2a5c79[_0x98eb('0x4e')]);var _0x4297c7=new jsforce[(_0x98eb('0x4f'))]({'oauth2':{'loginUrl':_0x2a5c79['remoteUri']||'https://login.salesforce.com','clientId':_0x2a5c79[_0x98eb('0x50')],'clientSecret':_0x2a5c79[_0x98eb('0x51')]}});return _0x4297c7[_0x98eb('0x52')](_0x2a5c79['username'],_0x2accd6)[_0x98eb('0x20')](function(){logger['info'](_0x98eb('0x53'));return _0x4297c7;});}exports[_0x98eb('0x54')]=function(_0x584ed7,_0x1693e2,_0x24a7dd,_0x3cd2fd,_0x852bf1,_0x346182){var _0x2911c4,_0x3b9e0b,_0x440a0b,_0x3a3a0e;_0x346182[_0x98eb('0x55')]=intUtil[_0x98eb('0x56')](_0x346182[_0x98eb('0x55')]);_0x346182[_0x98eb('0x57')]=intUtil[_0x98eb('0x56')](_0x346182[_0x98eb('0x57')]);if(_0x852bf1&&_0x852bf1[_0x98eb('0x58')]){logger[_0x98eb('0x22')](_0x98eb('0x59'),'Recording\x20is\x20enabled!');_0x1693e2[_0x98eb('0x5a')]=util[_0x98eb('0x3d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x346182[_0x98eb('0x55')],_0x1693e2['uniqueid'],md5(_0x1693e2[_0x98eb('0x5b')]));}else{_0x1693e2['recordingURL']='';}return getConnection(_0x346182)[_0x98eb('0x20')](function(_0x265ec2){_0x3a3a0e=_0x265ec2;return getUser(_0x346182,_0x3cd2fd['email'],_0x3a3a0e);})[_0x98eb('0x20')](function(_0x42a6c8){_0x2911c4=_0x42a6c8;return getEndUser(_0x346182,_0x24a7dd,_0x1693e2[_0x98eb('0x5c')],_0x1693e2[_0x98eb('0x5d')],_0x3a3a0e);})[_0x98eb('0x20')](function(_0x34dde9){_0x3b9e0b=_0x34dde9;return getTicket(_0x346182,_0x2911c4,_0x3b9e0b,_0x24a7dd,_0x1693e2,_0x24a7dd['Fields'],_0x3a3a0e,'queue');})[_0x98eb('0x20')](function(_0x3aa6af){_0x440a0b=_0x3aa6af;logger[_0x98eb('0x22')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x440a0b['id']);logger['info'](_0x98eb('0x5e'),_0x440a0b['id'],_0x3cd2fd[_0x98eb('0x4b')],_0x346182[_0x98eb('0x45')]);switch(_0x346182['type']){case _0x98eb('0x5f'):emit(util[_0x98eb('0x3d')](_0x98eb('0x60'),_0x3cd2fd[_0x98eb('0x4b')]),_0x98eb('0x61'),{'recordId':_0x440a0b['id']});break;case'newTab':emit(util[_0x98eb('0x3d')]('user:%s',_0x3cd2fd[_0x98eb('0x4b')]),'trigger:browser:url',{'uri':util[_0x98eb('0x3d')](_0x98eb('0x62'),_0x3a3a0e[_0x98eb('0x63')],_0x440a0b['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x98eb('0x64')](function(_0x38346a){logger[_0x98eb('0x65')](_0x98eb('0x59'),_0x38346a);});};exports[_0x98eb('0x66')]=function(_0x380504,_0x35c97a,_0xbbdf76,_0x5e0002,_0x4fb961,_0xc58121,_0x6a5850){var _0xf76ab9,_0x2e8705,_0x103cef,_0x31803b;_0xc58121[_0x98eb('0x55')]=intUtil[_0x98eb('0x56')](_0xc58121[_0x98eb('0x55')]);_0xc58121[_0x98eb('0x57')]=intUtil[_0x98eb('0x56')](_0xc58121['remoteUri']);if(_0x6a5850&&_0x6a5850[_0x98eb('0x67')]&&_0x6a5850[_0x98eb('0x67')]!==_0x98eb('0x68')){logger[_0x98eb('0x22')](_0x98eb('0x69'),_0x98eb('0x6a'));_0x35c97a['recordingURL']=util[_0x98eb('0x3d')](_0x98eb('0x6b'),_0xc58121['serverUrl'],_0x35c97a[_0x98eb('0x5b')],md5(_0x35c97a[_0x98eb('0x5b')]));}return getConnection(_0xc58121)[_0x98eb('0x20')](function(_0x43e59c){_0x31803b=_0x43e59c;return getUser(_0xc58121,_0x5e0002['email'],_0x31803b);})[_0x98eb('0x20')](function(_0x461f80){_0xf76ab9=_0x461f80;return getEndUser(_0xc58121,_0xbbdf76,_0x35c97a[_0x98eb('0x6c')],_0x35c97a[_0x98eb('0x6d')],_0x31803b);})[_0x98eb('0x20')](function(_0x32b9f2){_0x2e8705=_0x32b9f2;return getTicket(_0xc58121,_0xf76ab9,_0x2e8705,_0xbbdf76,_0x35c97a,_0xbbdf76[_0x98eb('0x6e')],_0x31803b,'outbound');})['then'](function(_0x3b173a){_0x103cef=_0x3b173a;logger[_0x98eb('0x22')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x103cef['id']);logger['info'](_0x98eb('0x6f'),_0x103cef['id'],_0x5e0002['name'],_0xc58121[_0x98eb('0x45')]);switch(_0xc58121[_0x98eb('0x45')]){case _0x98eb('0x5f'):emit(util['format'](_0x98eb('0x60'),_0x5e0002['name']),_0x98eb('0x61'),{'recordId':_0x103cef['id']});break;case _0x98eb('0x70'):emit(util[_0x98eb('0x3d')](_0x98eb('0x60'),_0x5e0002[_0x98eb('0x4b')]),_0x98eb('0x71'),{'uri':util[_0x98eb('0x3d')](_0x98eb('0x62'),_0x31803b[_0x98eb('0x63')],_0x103cef['id'])});break;default:logger[_0x98eb('0x65')]('[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x21572a){logger[_0x98eb('0x65')](_0x98eb('0x69'),_0x21572a);});};exports['unmanaged']=function(_0x20c52d,_0x4cad3c,_0x3be716,_0x5af692,_0x46af3a,_0xee4319){var _0x2ecdca,_0x3ac231,_0x5f37a2,_0x197462;_0xee4319[_0x98eb('0x55')]=intUtil[_0x98eb('0x56')](_0xee4319['serverUrl']);_0xee4319['remoteUri']=intUtil[_0x98eb('0x56')](_0xee4319[_0x98eb('0x57')]);if(_0x46af3a&&_0x46af3a[_0x98eb('0x58')]){logger[_0x98eb('0x22')]('['+_0x4cad3c[_0x98eb('0x72')][_0x98eb('0x73')]()+']',_0x98eb('0x6a'));_0x4cad3c[_0x98eb('0x5a')]=util[_0x98eb('0x3d')](_0x98eb('0x6b'),_0xee4319[_0x98eb('0x55')],_0x4cad3c[_0x98eb('0x5b')],md5(_0x4cad3c[_0x98eb('0x5b')]));}else{_0x4cad3c[_0x98eb('0x5a')]='';}return getConnection(_0xee4319)[_0x98eb('0x20')](function(_0x44a315){_0x197462=_0x44a315;if(!_[_0x98eb('0x74')](_0x5af692)){return getUser(_0xee4319,_0x5af692[_0x98eb('0x4b')],_0x197462);}else{return getUser(_0xee4319,null,_0x197462);}})['then'](function(_0x55da73){_0x2ecdca=_0x55da73;return getEndUser(_0xee4319,_0x3be716,_0x4cad3c[_0x98eb('0x5c')],_0x4cad3c[_0x98eb('0x5d')],_0x197462);})[_0x98eb('0x20')](function(_0x2957c8){_0x3ac231=_0x2957c8;return getTicket(_0xee4319,_0x2ecdca,_0x3ac231,_0x3be716,_0x4cad3c,_0x3be716[_0x98eb('0x6e')],_0x197462);})['then'](function(_0x57f9e0){_0x5f37a2=_0x57f9e0;logger['info']('['+_0x4cad3c[_0x98eb('0x72')][_0x98eb('0x73')]()+']\x20Ticket\x20%s\x20created.',_0x5f37a2['id']);logger[_0x98eb('0x22')]('['+_0x4cad3c[_0x98eb('0x72')][_0x98eb('0x73')]()+_0x98eb('0x75'),_0xee4319[_0x98eb('0x45')]);})[_0x98eb('0x64')](function(_0x35c6e0){logger[_0x98eb('0x65')]('['+_0x4cad3c['lastevent']['toUpperCase']()+']',_0x35c6e0);});}; \ 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 457360e..321fe8d 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 _0x2985=[']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','md5','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','sys_id','info','toUpperCase','catch','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','endUserId','error','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','customField','toLowerCase','toString','picklist','idField','content','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','Incident\x20-\x20','ticketNumber','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','username','sysparm_limit=1','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged'];(function(_0x3cbf4c,_0x3c5832){var _0x5e65b7=function(_0x2662ca){while(--_0x2662ca){_0x3cbf4c['push'](_0x3cbf4c['shift']());}};_0x5e65b7(++_0x3c5832);}(_0x2985,0x6a));var _0x5298=function(_0x1f17f7,_0x4e31c0){_0x1f17f7=_0x1f17f7-0x0;var _0x29772d=_0x2985[_0x1f17f7];return _0x29772d;};'use strict';var _=require('lodash');var Promise=require(_0x5298('0x0'));var rp=require(_0x5298('0x1'));var util=require('util');var md5=require(_0x5298('0x2'));var Redis=require(_0x5298('0x3'));var intUtil=require('./util');var config=require(_0x5298('0x4'));var logger=require('../../../../config/logger')('servicenow');config[_0x5298('0x5')]=_[_0x5298('0x6')](config[_0x5298('0x5')],{'host':_0x5298('0x7'),'port':0x18eb});var io=require(_0x5298('0x8'))(new Redis(config['redis']));function getAdminUser(_0x14205f,_0x97b90f,_0x4864ff,_0x2865bf,_0x43208a,_0x28e58e){return new Promise(function(_0x5017e5,_0x6929cc){var _0x42cdb7={'method':_0x5298('0x9'),'uri':_0x2865bf+_0x5298('0xa')+'&'+_0x43208a+'&'+_0x28e58e,'auth':_0x97b90f,'json':!![]};return rp(_0x42cdb7)[_0x5298('0xb')](function(_0x1c5fb6){if(_0x1c5fb6['result'][_0x5298('0xc')]>0x0){_0x4864ff[_0x5298('0xd')]=_0x1c5fb6[_0x5298('0xe')][0x0][_0x5298('0xf')];}logger[_0x5298('0x10')]('['+[_0x14205f[_0x5298('0x11')]()]+'],\x20getAdminUser\x20crm',_0x4864ff);_0x5017e5(_0x4864ff);})[_0x5298('0x12')](function(_0x3d8a3b){logger['error']('['+[_0x14205f[_0x5298('0x11')]()]+']',_0x3d8a3b[_0x5298('0x13')]);_0x6929cc(_0x3d8a3b['message']);});});}function getUser(_0x189e2d,_0x3bf8ff,_0xdff9f1,_0x1b4818,_0x3b6ae0){return function(_0x580150){logger['info']('['+[_0x189e2d['toUpperCase']()]+_0x5298('0x14'),_0x580150);return new Promise(function(_0x439149,_0x58419e){if(intUtil[_0x5298('0x15')](_0x580150[_0x5298('0x16')])){var _0x1aaea1={'method':_0x5298('0x9'),'uri':_0xdff9f1+_0x5298('0x17')+_0x580150[_0x5298('0x16')]+'&'+_0x1b4818+'&'+_0x3b6ae0,'auth':_0x3bf8ff,'json':!![]};logger['info']('['+[_0x189e2d[_0x5298('0x11')]()]+_0x5298('0x18'),_0x1aaea1);return rp(_0x1aaea1)[_0x5298('0xb')](function(_0x4cde30){logger['info']('['+[_0x189e2d[_0x5298('0x11')]()]+_0x5298('0x19'),_0x4cde30);if(_0x4cde30['result']['length']>0x0&&String(_0x4cde30[_0x5298('0xe')][0x0][_0x5298('0x1a')])===_0x5298('0x1b')){_0x580150['userId']=_0x4cde30[_0x5298('0xe')][0x0][_0x5298('0xf')];}else{_0x580150[_0x5298('0x1c')]=_0x580150['adminId'];_0x580150[_0x5298('0x16')]=_0x580150[_0x5298('0x1d')];}logger[_0x5298('0x10')]('['+[_0x189e2d[_0x5298('0x11')]()]+'],\x20getUser\x20crm',_0x580150);_0x439149(_0x580150);})[_0x5298('0x12')](function(_0x349aeb){logger['error']('['+[_0x189e2d[_0x5298('0x11')]()]+']',_0x349aeb['message']);_0x58419e(_0x349aeb['message']);});}else{logger['info']('['+[_0x189e2d[_0x5298('0x11')]()]+_0x5298('0x1e'));_0x580150['userId']=_0x580150[_0x5298('0xd')];_0x580150[_0x5298('0x16')]=_0x580150[_0x5298('0x1d')];_0x439149(_0x580150);}});};}function createEndUser(_0x1af7a6,_0x21ed69,_0x3e0568,_0x5af64d,_0x45de1f){logger[_0x5298('0x10')]('['+[_0x1af7a6[_0x5298('0x11')]()]+'],\x20createEndUser\x20input\x20crm',_0x3e0568);return new Promise(function(_0x432614,_0x33e0e4){var _0x24486d={'method':_0x5298('0x1f'),'uri':_0x5af64d+_0x5298('0x20')+_0x45de1f,'body':{'user_name':_0x3e0568[_0x5298('0x21')],'roles':_0x5298('0x22'),'first_name':_0x3e0568[_0x5298('0x21')],'active':_0x5298('0x1b'),'date_format':'System','phone':_0x3e0568[_0x5298('0x21')]},'auth':_0x21ed69,'json':!![]};return rp(_0x24486d)['then'](function(_0x15c551){logger[_0x5298('0x10')]('['+[_0x1af7a6[_0x5298('0x11')]()]+'],\x20EndUser\x20schema',_0x15c551[_0x5298('0xe')]);_0x3e0568[_0x5298('0x23')]=_0x15c551[_0x5298('0xe')][_0x5298('0xf')];_0x432614(_0x3e0568);})['catch'](function(_0x240280){logger[_0x5298('0x24')]('['+[_0x1af7a6[_0x5298('0x11')]()]+']',_0x240280['message']);_0x33e0e4(_0x240280[_0x5298('0x13')]);});});}function getEndUser(_0x42236f,_0x5271c2,_0x1d95fb,_0x35e38a,_0x4a5052){return function(_0x32a824){logger['info']('['+[_0x42236f[_0x5298('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x32a824);return new Promise(function(_0x26be55,_0x131f1f){var _0x1b4f68={'method':_0x5298('0x9'),'uri':_0x1d95fb+_0x5298('0x25')+_0x32a824['endUserNumber']+'&'+_0x35e38a+'&'+_0x4a5052,'auth':_0x5271c2,'json':!![]};return rp(_0x1b4f68)[_0x5298('0xb')](function(_0x13b668){if(_0x13b668[_0x5298('0xe')][_0x5298('0xc')]>0x0){_0x32a824[_0x5298('0x23')]=_0x13b668[_0x5298('0xe')][0x0][_0x5298('0xf')];logger['info']('['+[_0x42236f[_0x5298('0x11')]()]+_0x5298('0x26'),_0x32a824);_0x26be55(_0x32a824);}else{return createEndUser(_0x42236f,_0x5271c2,_0x32a824,_0x1d95fb,_0x35e38a)[_0x5298('0xb')](function(_0x36dd59){logger[_0x5298('0x10')]('['+[_0x42236f[_0x5298('0x11')]()]+_0x5298('0x27'),_0x36dd59);_0x26be55(_0x36dd59);});}})[_0x5298('0x12')](function(_0x2c1f45){logger[_0x5298('0x24')]('['+[_0x42236f[_0x5298('0x11')]()]+']',_0x2c1f45[_0x5298('0x13')]);_0x131f1f(_0x2c1f45[_0x5298('0x13')]);});});};}function getCustomFields(_0x46b522,_0x579aa6){var _0x5a7dc5={};if(_0x46b522['length']>0x0){_[_0x5298('0x28')](_0x46b522,function(_0x53c7e5){if(_[_0x5298('0x29')]([_0x5298('0x2a'),'picklist'],_0x53c7e5[_0x5298('0x2b')])&&_0x53c7e5[_0x5298('0x2c')]&&!_0x53c7e5[_0x5298('0x2d')]){_0x5a7dc5[_0x53c7e5[_0x5298('0x2c')][_0x5298('0x2e')]()]=_0x53c7e5['content'][_0x5298('0x2f')]();}else if(_['includes']([_0x5298('0x2a'),_0x5298('0x30')],_0x53c7e5[_0x5298('0x2b')])&&_0x53c7e5[_0x5298('0x31')]&&_0x53c7e5[_0x5298('0x2d')]){_0x5a7dc5[_0x53c7e5['idField']['toLowerCase']()]=_0x53c7e5[_0x5298('0x32')]['toString']();}else if(_0x53c7e5[_0x5298('0x2b')]==='variable'&&_0x53c7e5[_0x5298('0x33')]&&_0x53c7e5[_0x5298('0x31')]&&_0x53c7e5[_0x5298('0x2d')]){_0x5a7dc5[_0x53c7e5[_0x5298('0x31')][_0x5298('0x2e')]()]=_0x579aa6[_0x53c7e5['variableName']][_0x5298('0x2f')]();}else if(_0x53c7e5[_0x5298('0x2b')]===_0x5298('0x34')&&_0x53c7e5[_0x5298('0x35')]&&_0x53c7e5['Variable'][_0x5298('0x36')]&&_0x53c7e5['idField']&&_0x53c7e5['customField']){_0x5a7dc5[_0x53c7e5[_0x5298('0x31')][_0x5298('0x2e')]()]=_0x579aa6[_0x53c7e5[_0x5298('0x35')][_0x5298('0x36')][_0x5298('0x2e')]()][_0x5298('0x2f')]();}});}return _0x5a7dc5;}function getTicket(_0x4155dc,_0x1ac12d,_0x1af697,_0x443fa4,_0x24c275,_0x509189){return function(_0x2c6a57){logger[_0x5298('0x10')]('['+[_0x4155dc[_0x5298('0x11')]()]+_0x5298('0x37'),_0x2c6a57);return new Promise(function(_0x14458f,_0x57357e){var _0x722be0=_0x4155dc['toLowerCase']()===_0x5298('0x38')?_0x2c6a57['userId']:_0x2c6a57['endUserId'];var _0x5774e0={'method':_0x5298('0x1f'),'uri':_0x1af697+_0x5298('0x39')+'?'+_0x509189,'body':Object[_0x5298('0x3a')]({},{'active':_0x5298('0x1b'),'caller_id':_0x722be0,'assigned_to':_0x2c6a57[_0x5298('0x1c')],'short_description':intUtil[_0x5298('0x3b')](_0x443fa4[_0x5298('0x3c')],_0x24c275,'\x20'),'description':intUtil['getString'](_0x443fa4['Descriptions'],_0x24c275,'\x0a')},getCustomFields(_0x443fa4[_0x5298('0x3d')],_0x24c275)),'auth':_0x1ac12d,'json':!![]};return rp(_0x5774e0)['then'](function(_0x4b5106){logger[_0x5298('0x10')]('['+[_0x4155dc[_0x5298('0x11')]()]+_0x5298('0x3e'),_0x4b5106[_0x5298('0xe')]);_0x2c6a57[_0x5298('0x3f')]=_0x4b5106[_0x5298('0xe')][_0x5298('0xf')];_0x2c6a57['ticketNumber']=_0x4b5106[_0x5298('0xe')][_0x5298('0x40')];logger[_0x5298('0x10')]('['+[_0x4155dc[_0x5298('0x11')]()]+']\x20getTicket\x20crm',_0x2c6a57);_0x14458f(_0x2c6a57);})[_0x5298('0x12')](function(_0x26cd21){logger[_0x5298('0x24')]('['+[_0x4155dc[_0x5298('0x11')]()]+']',_0x26cd21[_0x5298('0x13')]);_0x57357e(_0x26cd21[_0x5298('0x13')]);});});};}function createRemoteTag(_0x3a24e9,_0x99681,_0x1c3507,_0x13aa06){return new Promise(function(_0x1d1b74,_0x5aa665){var _0x5f32f6={'method':'POST','uri':_0x1c3507+_0x5298('0x41')+'?'+_0x13aa06,'body':{'short_description':_0x3a24e9,'global':!![],'active':!![],'name':_0x3a24e9},'auth':_0x99681,'json':!![]};return rp(_0x5f32f6)[_0x5298('0xb')](function(_0x1339ac){var _0x546f89=_0x1339ac[_0x5298('0xe')][_0x5298('0xf')];_0x1d1b74(_0x546f89);});});}function getRemoteTag(_0x199657,_0x4c9161,_0x63d48b,_0x46d486,_0x15d2ff){return new Promise(function(_0x1bd72e,_0x5d6b05){var _0x404122={'method':_0x5298('0x9'),'uri':_0x63d48b+_0x5298('0x41')+_0x5298('0x42')+_0x199657+'&'+_0x46d486,'auth':_0x4c9161,'json':!![]};return rp(_0x404122)['then'](function(_0xcf416a){if(_0xcf416a[_0x5298('0xe')]['length']>0x0){var _0x14efeb=_0xcf416a['result'][0x0][_0x5298('0xf')];_0x1bd72e(_0x14efeb);}else{return createRemoteTag(_0x199657,_0x4c9161,_0x63d48b,_0x46d486)['then'](function(_0xcb6afc){_0x1bd72e(_0xcb6afc);});}});});}function assignTagToIncident(_0x100a3d,_0x3db62d,_0x31d5ba,_0x457948,_0x2ef7ed){return new Promise(function(_0x3c1f40,_0x55bce1){var _0x123821={'method':'POST','uri':_0x31d5ba+'label_entry'+'?'+_0x2ef7ed,'body':{'label':_0x100a3d,'table':'incident','id_type':'Incident','table_key':_0x457948['ticketId'],'title':_0x5298('0x43')+_0x457948[_0x5298('0x44')],'id_display':_0x457948[_0x5298('0x44')]},'auth':_0x3db62d,'json':!![]};return rp(_0x123821)[_0x5298('0xb')](function(_0x2afc09){_0x3c1f40();})[_0x5298('0x12')](function(){_0x3c1f40();});});}function manageTags(_0x303026,_0x31ff6c,_0x18bc26,_0x4c28ba,_0x30282c,_0x8b1217,_0x5385f0){return new Promise(function(_0x4f2699,_0x546177){var _0x594b6e=[];_0x31ff6c[_0x5298('0x28')](function(_0x2eec44){_0x594b6e[_0x5298('0x45')](getRemoteTag(_0x2eec44,_0x18bc26,_0x4c28ba,_0x8b1217,_0x5385f0));});return Promise['all'](_0x594b6e)[_0x5298('0xb')](function(_0x28c146){if(_0x28c146[_0x5298('0xc')]){logger['info']('['+[_0x303026[_0x5298('0x11')]()]+_0x5298('0x46'),_0x28c146);var _0x57bfa3=[];_0x28c146[_0x5298('0x28')](function(_0x5554b2){_0x57bfa3[_0x5298('0x45')](assignTagToIncident(_0x5554b2,_0x18bc26,_0x4c28ba,_0x30282c,_0x8b1217));});return Promise[_0x5298('0x47')](_0x57bfa3)[_0x5298('0xb')](function(){_0x4f2699();})[_0x5298('0x12')](function(){_0x4f2699();});}else{_0x4f2699();}});});}function getTags(_0x468336,_0x1cffe1,_0x1c5666,_0x50f05d,_0x9db7e,_0x967397){return function(_0x409711){return new Promise(function(_0x125192,_0x42e8f7){var _0x40456e=[];var _0x29ccf7=_0x50f05d['Tags'];if(_0x29ccf7&&_0x29ccf7[_0x5298('0xc')]>0x0){_0x40456e=_['map'](_0x29ccf7,_0x5298('0x36'));}if(_0x40456e['length']>0x0){return manageTags(_0x468336,_0x40456e,_0x1cffe1,_0x1c5666,_0x409711,_0x9db7e,_0x967397)[_0x5298('0xb')](function(){_0x125192(_0x409711);});}else{_0x125192(_0x409711);}});};}function emit(_0x119b59,_0x4963db,_0x2fe398){var _0x1094d8=_0x5298('0x48')+_0x5298('0x49')+_0x5298('0x4a')+'%255EORDERBYDESCnumber';var _0x1704b9={'uri':_0x119b59+_0x5298('0x4b')+_0x2fe398+_0x1094d8};io['to'](util[_0x5298('0x4c')](_0x5298('0x4d'),_0x4963db))[_0x5298('0x4e')]('trigger:browser:url',_0x1704b9);}exports['cs']=function(_0x36de31,_0x500ddf,_0xa207ba,_0x544a95,_0x5a55ea,_0x4a9450,_0x516f88,_0xd51055){var _0x13b0dc={};var _0x45896d={'user':_0x4a9450[_0x5298('0x4f')],'pass':_0x4a9450['password']};var _0x181c31=_0x5298('0x50');var _0x52a294='sysparm_display_value=true';_0x4a9450[_0x5298('0x51')]=intUtil['stripTrailingSlash'](_0x4a9450['remoteUri']);_0x4a9450[_0x5298('0x52')]=intUtil[_0x5298('0x53')](_0x4a9450['serverUrl']);var _0x101d05=util[_0x5298('0x4c')](_0x5298('0x54'),_0x4a9450[_0x5298('0x51')]);_0x13b0dc[_0x5298('0x16')]=!_[_0x5298('0x55')](_0x544a95)?_0x544a95[_0x5298('0x56')]:null;_0x13b0dc['adminEmail']=_0x4a9450[_0x5298('0x56')];_0x13b0dc[_0x5298('0x21')]=_0xd51055['toLowerCase']()===_0x5298('0x38')?_0x500ddf[_0x5298('0x57')]:_0x500ddf[_0x5298('0x58')];_0x13b0dc[_0x5298('0x59')]=_0xd51055===_0x5298('0x5a')||_0xd51055==='unmanaged'?_0x5298('0x5a'):_0x5298('0x38');var _0x991624=util['format'](_0x5298('0x5b'),_0x4a9450[_0x5298('0x52')],_0x500ddf['uniqueid'],md5(_0x500ddf[_0x5298('0x5c')]));if(_0x5a55ea&&_0x5a55ea[_0x5298('0x5d')]){logger[_0x5298('0x10')](_0x5298('0x5e'),_0x5298('0x5f'));_0x500ddf[_0x5298('0x60')]=_0x991624;}else if(_0x516f88&&_0x516f88['recordingFormat']&&_0x516f88[_0x5298('0x61')]!=='none'){logger[_0x5298('0x10')](_0x5298('0x62'),_0x5298('0x5f'));_0x500ddf[_0x5298('0x60')]=_0x991624;}else{_0x500ddf[_0x5298('0x60')]='';}return getAdminUser(_0xd51055,_0x45896d,_0x13b0dc,_0x101d05,_0x52a294,_0x181c31)['then'](getUser(_0xd51055,_0x45896d,_0x101d05,_0x52a294,_0x181c31))['then'](getEndUser(_0xd51055,_0x45896d,_0x101d05,_0x52a294,_0x181c31))[_0x5298('0xb')](getTicket(_0xd51055,_0x45896d,_0x101d05,_0xa207ba,_0x500ddf,_0x52a294))[_0x5298('0xb')](function(_0x4ed703){logger[_0x5298('0x10')](util[_0x5298('0x4c')](_0x5298('0x63'),_0x4ed703[_0x5298('0x3f')]));logger[_0x5298('0x10')](util['format'](_0x5298('0x64'),_0xd51055));if(_0xd51055!==_0x5298('0x65')){logger[_0x5298('0x10')]('['+[_0xd51055['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4a9450['remoteUri'],_0x544a95['name'],_0x4ed703[_0x5298('0x3f')]);}})[_0x5298('0x12')](function(_0x512de5){logger[_0x5298('0x24')]('['+[_0xd51055[_0x5298('0x11')]()]+_0x5298('0x66'),util[_0x5298('0x67')](_0x512de5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5411=['result','adminId','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','length','active','userId','sys_id','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20EndUser\x20schema','endUserId','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string','nameField','customField','toLowerCase','content','toString','picklist','type','idField','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','label_entry','Incident','forEach',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','emit','trigger:browser:url','password','sysparm_limit=1','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','calleridnum','callDirection','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','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','util','md5','ioredis','./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then'];(function(_0x40f3ed,_0x30a518){var _0x30fd3b=function(_0x1ddf73){while(--_0x1ddf73){_0x40f3ed['push'](_0x40f3ed['shift']());}};_0x30fd3b(++_0x30a518);}(_0x5411,0xce));var _0x1541=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5411[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0x1541('0x0'));var Promise=require(_0x1541('0x1'));var rp=require('request-promise');var util=require(_0x1541('0x2'));var md5=require(_0x1541('0x3'));var Redis=require(_0x1541('0x4'));var intUtil=require(_0x1541('0x5'));var config=require(_0x1541('0x6'));var logger=require('../../../../config/logger')(_0x1541('0x7'));config[_0x1541('0x8')]=_[_0x1541('0x9')](config['redis'],{'host':_0x1541('0xa'),'port':0x18eb});var io=require(_0x1541('0xb'))(new Redis(config[_0x1541('0x8')]));function getAdminUser(_0x39ca25,_0x459279,_0x284795,_0x37e69e,_0x1f59bc,_0x6695a9){return new Promise(function(_0x2a2c77,_0xede79){var _0x2cb792={'method':'GET','uri':_0x37e69e+_0x1541('0xc')+'&'+_0x1f59bc+'&'+_0x6695a9,'auth':_0x459279,'json':!![]};return rp(_0x2cb792)[_0x1541('0xd')](function(_0x1eefd1){if(_0x1eefd1[_0x1541('0xe')]['length']>0x0){_0x284795[_0x1541('0xf')]=_0x1eefd1[_0x1541('0xe')][0x0]['sys_id'];}logger[_0x1541('0x10')]('['+[_0x39ca25[_0x1541('0x11')]()]+_0x1541('0x12'),_0x284795);_0x2a2c77(_0x284795);})['catch'](function(_0x1a338a){logger[_0x1541('0x13')]('['+[_0x39ca25[_0x1541('0x11')]()]+']',_0x1a338a[_0x1541('0x14')]);_0xede79(_0x1a338a[_0x1541('0x14')]);});});}function getUser(_0x1b476c,_0x574398,_0x4d86c3,_0xc45aad,_0x99f889){return function(_0x17fee7){logger[_0x1541('0x10')]('['+[_0x1b476c[_0x1541('0x11')]()]+_0x1541('0x15'),_0x17fee7);return new Promise(function(_0x25efe2,_0x4ca793){if(intUtil[_0x1541('0x16')](_0x17fee7[_0x1541('0x17')])){var _0x15ed5e={'method':_0x1541('0x18'),'uri':_0x4d86c3+_0x1541('0x19')+_0x17fee7[_0x1541('0x17')]+'&'+_0xc45aad+'&'+_0x99f889,'auth':_0x574398,'json':!![]};logger[_0x1541('0x10')]('['+[_0x1b476c[_0x1541('0x11')]()]+_0x1541('0x1a'),_0x15ed5e);return rp(_0x15ed5e)[_0x1541('0xd')](function(_0x8ffd18){logger[_0x1541('0x10')]('['+[_0x1b476c['toUpperCase']()]+_0x1541('0x1b'),_0x8ffd18);if(_0x8ffd18[_0x1541('0xe')][_0x1541('0x1c')]>0x0&&String(_0x8ffd18['result'][0x0][_0x1541('0x1d')])==='true'){_0x17fee7[_0x1541('0x1e')]=_0x8ffd18[_0x1541('0xe')][0x0][_0x1541('0x1f')];}else{_0x17fee7['userId']=_0x17fee7[_0x1541('0xf')];_0x17fee7[_0x1541('0x17')]=_0x17fee7['adminEmail'];}logger[_0x1541('0x10')]('['+[_0x1b476c['toUpperCase']()]+_0x1541('0x20'),_0x17fee7);_0x25efe2(_0x17fee7);})['catch'](function(_0xb847ad){logger[_0x1541('0x13')]('['+[_0x1b476c[_0x1541('0x11')]()]+']',_0xb847ad[_0x1541('0x14')]);_0x4ca793(_0xb847ad['message']);});}else{logger[_0x1541('0x10')]('['+[_0x1b476c[_0x1541('0x11')]()]+_0x1541('0x21'));_0x17fee7[_0x1541('0x1e')]=_0x17fee7[_0x1541('0xf')];_0x17fee7[_0x1541('0x17')]=_0x17fee7[_0x1541('0x22')];_0x25efe2(_0x17fee7);}});};}function createEndUser(_0x1f0787,_0x580457,_0x45cde6,_0x2c9bd8,_0x29fe4d){logger[_0x1541('0x10')]('['+[_0x1f0787[_0x1541('0x11')]()]+_0x1541('0x23'),_0x45cde6);return new Promise(function(_0x477a2a,_0x43e31d){var _0x84950f={'method':_0x1541('0x24'),'uri':_0x2c9bd8+_0x1541('0x25')+_0x29fe4d,'body':{'user_name':_0x45cde6['endUserNumber'],'roles':_0x1541('0x26'),'first_name':_0x45cde6[_0x1541('0x27')],'active':_0x1541('0x28'),'date_format':_0x1541('0x29'),'phone':_0x45cde6[_0x1541('0x27')]},'auth':_0x580457,'json':!![]};return rp(_0x84950f)[_0x1541('0xd')](function(_0x7c776f){logger[_0x1541('0x10')]('['+[_0x1f0787[_0x1541('0x11')]()]+_0x1541('0x2a'),_0x7c776f[_0x1541('0xe')]);_0x45cde6[_0x1541('0x2b')]=_0x7c776f[_0x1541('0xe')][_0x1541('0x1f')];_0x477a2a(_0x45cde6);})[_0x1541('0x2c')](function(_0x109a95){logger[_0x1541('0x13')]('['+[_0x1f0787['toUpperCase']()]+']',_0x109a95[_0x1541('0x14')]);_0x43e31d(_0x109a95['message']);});});}function getEndUser(_0x7da88a,_0x4d375b,_0x325462,_0x38adb1,_0xeb204a){return function(_0x5baffd){logger['info']('['+[_0x7da88a[_0x1541('0x11')]()]+_0x1541('0x2d'),_0x5baffd);return new Promise(function(_0x2d8419,_0xed064){var _0x53ee51={'method':_0x1541('0x18'),'uri':_0x325462+_0x1541('0x2e')+_0x5baffd['endUserNumber']+'&'+_0x38adb1+'&'+_0xeb204a,'auth':_0x4d375b,'json':!![]};return rp(_0x53ee51)[_0x1541('0xd')](function(_0x1c1c5e){if(_0x1c1c5e[_0x1541('0xe')][_0x1541('0x1c')]>0x0){_0x5baffd[_0x1541('0x2b')]=_0x1c1c5e[_0x1541('0xe')][0x0][_0x1541('0x1f')];logger[_0x1541('0x10')]('['+[_0x7da88a[_0x1541('0x11')]()]+'],\x20getEndUser\x20crm',_0x5baffd);_0x2d8419(_0x5baffd);}else{return createEndUser(_0x7da88a,_0x4d375b,_0x5baffd,_0x325462,_0x38adb1)[_0x1541('0xd')](function(_0x147c2a){logger['info']('['+[_0x7da88a[_0x1541('0x11')]()]+_0x1541('0x2f'),_0x147c2a);_0x2d8419(_0x147c2a);});}})[_0x1541('0x2c')](function(_0x128649){logger[_0x1541('0x13')]('['+[_0x7da88a['toUpperCase']()]+']',_0x128649[_0x1541('0x14')]);_0xed064(_0x128649[_0x1541('0x14')]);});});};}function getCustomFields(_0x4ec26d,_0x1e8653){var _0x41a88={};if(_0x4ec26d['length']>0x0){_['forEach'](_0x4ec26d,function(_0x175b0a){if(_[_0x1541('0x30')]([_0x1541('0x31'),'picklist'],_0x175b0a['type'])&&_0x175b0a[_0x1541('0x32')]&&!_0x175b0a[_0x1541('0x33')]){_0x41a88[_0x175b0a[_0x1541('0x32')][_0x1541('0x34')]()]=_0x175b0a[_0x1541('0x35')][_0x1541('0x36')]();}else if(_['includes']([_0x1541('0x31'),_0x1541('0x37')],_0x175b0a[_0x1541('0x38')])&&_0x175b0a[_0x1541('0x39')]&&_0x175b0a['customField']){_0x41a88[_0x175b0a['idField'][_0x1541('0x34')]()]=_0x175b0a[_0x1541('0x35')]['toString']();}else if(_0x175b0a[_0x1541('0x38')]==='variable'&&_0x175b0a['variableName']&&_0x175b0a['idField']&&_0x175b0a[_0x1541('0x33')]){_0x41a88[_0x175b0a[_0x1541('0x39')]['toLowerCase']()]=_0x1e8653[_0x175b0a['variableName']][_0x1541('0x36')]();}else if(_0x175b0a[_0x1541('0x38')]===_0x1541('0x3a')&&_0x175b0a['Variable']&&_0x175b0a[_0x1541('0x3b')]['name']&&_0x175b0a['idField']&&_0x175b0a[_0x1541('0x33')]){_0x41a88[_0x175b0a[_0x1541('0x39')][_0x1541('0x34')]()]=_0x1e8653[_0x175b0a['Variable'][_0x1541('0x3c')]['toLowerCase']()][_0x1541('0x36')]();}});}return _0x41a88;}function getTicket(_0x4d1d92,_0x5c9c42,_0x420a76,_0x92fb16,_0x3128ba,_0x500170){return function(_0x129739){logger[_0x1541('0x10')]('['+[_0x4d1d92[_0x1541('0x11')]()]+_0x1541('0x3d'),_0x129739);return new Promise(function(_0x318b81,_0x36b68c){var _0x3c2d6c=_0x4d1d92[_0x1541('0x34')]()===_0x1541('0x3e')?_0x129739[_0x1541('0x1e')]:_0x129739['endUserId'];var _0x57d6fd={'method':_0x1541('0x24'),'uri':_0x420a76+_0x1541('0x3f')+'?'+_0x500170,'body':Object[_0x1541('0x40')]({},{'active':_0x1541('0x28'),'caller_id':_0x3c2d6c,'assigned_to':_0x129739[_0x1541('0x1e')],'short_description':intUtil[_0x1541('0x41')](_0x92fb16['Subjects'],_0x3128ba,'\x20'),'description':intUtil[_0x1541('0x41')](_0x92fb16['Descriptions'],_0x3128ba,'\x0a')},getCustomFields(_0x92fb16['Fields'],_0x3128ba)),'auth':_0x5c9c42,'json':!![]};return rp(_0x57d6fd)[_0x1541('0xd')](function(_0x2b4dc0){logger[_0x1541('0x10')]('['+[_0x4d1d92[_0x1541('0x11')]()]+_0x1541('0x42'),_0x2b4dc0[_0x1541('0xe')]);_0x129739[_0x1541('0x43')]=_0x2b4dc0['result'][_0x1541('0x1f')];_0x129739[_0x1541('0x44')]=_0x2b4dc0[_0x1541('0xe')]['number'];logger[_0x1541('0x10')]('['+[_0x4d1d92['toUpperCase']()]+_0x1541('0x45'),_0x129739);_0x318b81(_0x129739);})[_0x1541('0x2c')](function(_0x522e38){logger['error']('['+[_0x4d1d92['toUpperCase']()]+']',_0x522e38[_0x1541('0x14')]);_0x36b68c(_0x522e38[_0x1541('0x14')]);});});};}function createRemoteTag(_0x2e667e,_0x384768,_0xed1554,_0x4af4b1){return new Promise(function(_0x4cb0f0,_0x526625){var _0x12a15c={'method':_0x1541('0x24'),'uri':_0xed1554+_0x1541('0x46')+'?'+_0x4af4b1,'body':{'short_description':_0x2e667e,'global':!![],'active':!![],'name':_0x2e667e},'auth':_0x384768,'json':!![]};return rp(_0x12a15c)[_0x1541('0xd')](function(_0x223f85){var _0x36602=_0x223f85[_0x1541('0xe')][_0x1541('0x1f')];_0x4cb0f0(_0x36602);});});}function getRemoteTag(_0xbc3482,_0x285cf1,_0x4adbbf,_0x191634,_0x26db4d){return new Promise(function(_0x27bd2f,_0x1c8792){var _0x4f1b03={'method':'GET','uri':_0x4adbbf+'label'+'?sysparm_query=name%3D'+_0xbc3482+'&'+_0x191634,'auth':_0x285cf1,'json':!![]};return rp(_0x4f1b03)['then'](function(_0x3c470f){if(_0x3c470f[_0x1541('0xe')][_0x1541('0x1c')]>0x0){var _0x50be38=_0x3c470f[_0x1541('0xe')][0x0][_0x1541('0x1f')];_0x27bd2f(_0x50be38);}else{return createRemoteTag(_0xbc3482,_0x285cf1,_0x4adbbf,_0x191634)['then'](function(_0x350ce0){_0x27bd2f(_0x350ce0);});}});});}function assignTagToIncident(_0x4c6595,_0xb294e3,_0x271a07,_0x53a3de,_0x43e0c6){return new Promise(function(_0x8b0c64,_0x4453ed){var _0x3b7c85={'method':_0x1541('0x24'),'uri':_0x271a07+_0x1541('0x47')+'?'+_0x43e0c6,'body':{'label':_0x4c6595,'table':_0x1541('0x3f'),'id_type':_0x1541('0x48'),'table_key':_0x53a3de[_0x1541('0x43')],'title':'Incident\x20-\x20'+_0x53a3de[_0x1541('0x44')],'id_display':_0x53a3de[_0x1541('0x44')]},'auth':_0xb294e3,'json':!![]};return rp(_0x3b7c85)[_0x1541('0xd')](function(_0x97f4d7){_0x8b0c64();})[_0x1541('0x2c')](function(){_0x8b0c64();});});}function manageTags(_0x2a2e68,_0x355c88,_0x628ee3,_0x103337,_0xe20e33,_0x1acd93,_0x1005b1){return new Promise(function(_0x31d601,_0x2e9d06){var _0x106554=[];_0x355c88[_0x1541('0x49')](function(_0x50b8fb){_0x106554['push'](getRemoteTag(_0x50b8fb,_0x628ee3,_0x103337,_0x1acd93,_0x1005b1));});return Promise['all'](_0x106554)[_0x1541('0xd')](function(_0x35d86b){if(_0x35d86b[_0x1541('0x1c')]){logger[_0x1541('0x10')]('['+[_0x2a2e68[_0x1541('0x11')]()]+_0x1541('0x4a'),_0x35d86b);var _0x5b2538=[];_0x35d86b[_0x1541('0x49')](function(_0x5775f4){_0x5b2538['push'](assignTagToIncident(_0x5775f4,_0x628ee3,_0x103337,_0xe20e33,_0x1acd93));});return Promise[_0x1541('0x4b')](_0x5b2538)[_0x1541('0xd')](function(){_0x31d601();})[_0x1541('0x2c')](function(){_0x31d601();});}else{_0x31d601();}});});}function getTags(_0x47f624,_0x41f48c,_0x1f7d9b,_0x4f3c9e,_0x441665,_0x497dba){return function(_0x27d919){return new Promise(function(_0x2613db,_0x2ea50a){var _0x423500=[];var _0x3107a2=_0x4f3c9e['Tags'];if(_0x3107a2&&_0x3107a2[_0x1541('0x1c')]>0x0){_0x423500=_[_0x1541('0x4c')](_0x3107a2,_0x1541('0x3c'));}if(_0x423500[_0x1541('0x1c')]>0x0){return manageTags(_0x47f624,_0x423500,_0x41f48c,_0x1f7d9b,_0x27d919,_0x441665,_0x497dba)[_0x1541('0xd')](function(){_0x2613db(_0x27d919);});}else{_0x2613db(_0x27d919);}});};}function emit(_0x5bb6fc,_0x6ab805,_0x15cf3f){var _0x3cf155=_0x1541('0x4d')+_0x1541('0x4e')+_0x1541('0x4f')+_0x1541('0x50');var _0x5c30bc={'uri':_0x5bb6fc+_0x1541('0x51')+_0x15cf3f+_0x3cf155};io['to'](util[_0x1541('0x52')]('user:%s',_0x6ab805))[_0x1541('0x53')](_0x1541('0x54'),_0x5c30bc);}exports['cs']=function(_0x1bb251,_0x3fc959,_0x366bd7,_0x3e0d2c,_0x569175,_0x3a6dce,_0x4313d7,_0x417d52){var _0x14d7f2={};var _0x44a763={'user':_0x3a6dce['username'],'pass':_0x3a6dce[_0x1541('0x55')]};var _0x219a4b=_0x1541('0x56');var _0x1bef1f='sysparm_display_value=true';_0x3a6dce[_0x1541('0x57')]=intUtil[_0x1541('0x58')](_0x3a6dce[_0x1541('0x57')]);_0x3a6dce[_0x1541('0x59')]=intUtil[_0x1541('0x58')](_0x3a6dce[_0x1541('0x59')]);var _0x4ccc03=util[_0x1541('0x52')](_0x1541('0x5a'),_0x3a6dce[_0x1541('0x57')]);_0x14d7f2[_0x1541('0x17')]=!_[_0x1541('0x5b')](_0x3e0d2c)?_0x3e0d2c['email']:null;_0x14d7f2[_0x1541('0x22')]=_0x3a6dce['email'];_0x14d7f2[_0x1541('0x27')]=_0x417d52[_0x1541('0x34')]()===_0x1541('0x3e')?_0x3fc959['destcalleridnum']:_0x3fc959[_0x1541('0x5c')];_0x14d7f2[_0x1541('0x5d')]=_0x417d52===_0x1541('0x5e')||_0x417d52==='unmanaged'?_0x1541('0x5e'):_0x1541('0x3e');var _0x4f40e4=util['format'](_0x1541('0x5f'),_0x3a6dce['serverUrl'],_0x3fc959[_0x1541('0x60')],md5(_0x3fc959['uniqueid']));if(_0x569175&&_0x569175[_0x1541('0x61')]){logger[_0x1541('0x10')](_0x1541('0x62'),_0x1541('0x63'));_0x3fc959['recordingURL']=_0x4f40e4;}else if(_0x4313d7&&_0x4313d7[_0x1541('0x64')]&&_0x4313d7[_0x1541('0x64')]!==_0x1541('0x65')){logger[_0x1541('0x10')](_0x1541('0x66'),_0x1541('0x63'));_0x3fc959[_0x1541('0x67')]=_0x4f40e4;}else{_0x3fc959[_0x1541('0x67')]='';}return getAdminUser(_0x417d52,_0x44a763,_0x14d7f2,_0x4ccc03,_0x1bef1f,_0x219a4b)[_0x1541('0xd')](getUser(_0x417d52,_0x44a763,_0x4ccc03,_0x1bef1f,_0x219a4b))[_0x1541('0xd')](getEndUser(_0x417d52,_0x44a763,_0x4ccc03,_0x1bef1f,_0x219a4b))[_0x1541('0xd')](getTicket(_0x417d52,_0x44a763,_0x4ccc03,_0x366bd7,_0x3fc959,_0x1bef1f))[_0x1541('0xd')](function(_0x39deea){logger[_0x1541('0x10')](util[_0x1541('0x52')](_0x1541('0x68'),_0x39deea[_0x1541('0x43')]));logger['info'](util[_0x1541('0x52')](_0x1541('0x69'),_0x417d52));if(_0x417d52!==_0x1541('0x6a')){logger[_0x1541('0x10')]('['+[_0x417d52[_0x1541('0x11')]()]+']',_0x1541('0x6b'));emit(_0x3a6dce['remoteUri'],_0x3e0d2c[_0x1541('0x3c')],_0x39deea[_0x1541('0x43')]);}})[_0x1541('0x2c')](function(_0x5b6739){logger[_0x1541('0x13')]('['+[_0x417d52[_0x1541('0x11')]()]+_0x1541('0x6c'),util[_0x1541('0x6d')](_0x5b6739,{'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 51d6a14..3daea48 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 _0x24db=['catch','uri','recordingFormat','none','destcalleridname','Outbound','[OUTBOUND]','error','unmanaged','lastevent','toUpperCase','calleridname','The\x20Ticket\x20ID\x20is:','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','description','Descriptions','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','value','Agent\x20found!','name_value_list','resolve','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','entry_list','find','Enduser\x20found!','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','map','forEach','nameField','toLowerCase','content','type','string','customField','custom_fields','variable','Variable','login','username','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','serverUrl','stripTrailingSlash','%s/service/v4_1/rest.php','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0x24db,0x105));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb24d('0x0'));var rp=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var md5=require(_0xb24d('0x3'));var util=require(_0xb24d('0x4'));var Redis=require(_0xb24d('0x5'));var intUtil=require(_0xb24d('0x6'));var config=require(_0xb24d('0x7'));var logger=require(_0xb24d('0x8'))(_0xb24d('0x9'));config[_0xb24d('0xa')]=_[_0xb24d('0xb')](config[_0xb24d('0xa')],{'host':_0xb24d('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb24d('0xa')]));var def={'method':_0xb24d('0xd'),'json':!![]};function emit(_0x33d2bd,_0x2456e3,_0x5514da){io['to'](_0x33d2bd)[_0xb24d('0xe')](_0x2456e3,_0x5514da);}function getTicket(_0x285904,_0xa3d193,_0x10e59c,_0xc0cea,_0xbb909b,_0x48d348,_0x55900e,_0x42f9d8){logger[_0xb24d('0xf')](_0xb24d('0x10'));var _0x198bbb=new Date();var _0x5ec6bd=[{'name':_0xb24d('0x11'),'value':intUtil[_0xb24d('0x12')](_0xc0cea[_0xb24d('0x13')],_0xbb909b,'\x20')},{'name':'assigned_user_id','value':_0xa3d193['id']},{'name':'created_by','value':_0xa3d193['id']},{'name':_0xb24d('0x14'),'value':intUtil[_0xb24d('0x12')](_0xc0cea[_0xb24d('0x15')],_0xbb909b,'\x0a')},{'name':'date_start','value':_0x198bbb[_0xb24d('0x16')]()[_0xb24d('0x17')](0x0,0x13)[_0xb24d('0x18')]('T','\x20')},{'name':_0xb24d('0x19'),'value':'0'},{'name':_0xb24d('0x1a'),'value':'15'},{'name':_0xb24d('0x1b'),'value':_0x10e59c['id']},{'name':_0xb24d('0x1c'),'value':_0xb24d('0x1d')},{'name':_0xb24d('0x1e'),'value':_0x10e59c['name']},{'name':_0xb24d('0x1f'),'value':_0x42f9d8}];if(_0x48d348[_0xb24d('0x20')]){_['forEach'](_0x48d348,function(_0x99dbdc){if(_0xbb909b[_0x99dbdc[_0xb24d('0x21')]]){_0x5ec6bd[_0xb24d('0x22')]({'name':_0x99dbdc[_0xb24d('0x23')],'value':_0xbb909b[_0x99dbdc['variableName']]});}});}return request({'form':{'method':_0xb24d('0x24'),'input_type':_0xb24d('0x25'),'response_type':_0xb24d('0x25'),'rest_data':JSON[_0xb24d('0x26')]({'session':_0x55900e['id'],'module_name':_0xb24d('0x27'),'name_value_list':_0x5ec6bd})}});}function getAuth(_0x2bb01b){return util[_0xb24d('0x28')](_0xb24d('0x29'),new Buffer(_0x2bb01b['apiKey']+':X')[_0xb24d('0x2a')](_0xb24d('0x2b')));}function getServerInfo(_0x46b72b){return request({'form':{'method':_0xb24d('0x2c'),'input_type':_0xb24d('0x25'),'response_type':_0xb24d('0x25'),'rest_data':JSON['stringify']({'session':_0x46b72b['id']})}});}function getUser(_0x2d3fdb,_0x5373f3,_0x5cc0be){if(!_[_0xb24d('0x2d')](_0x5373f3)){logger[_0xb24d('0xf')](_0xb24d('0x2e'),_0x5373f3);return request({'form':{'method':_0xb24d('0x2f'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb24d('0x26')]({'session':_0x5cc0be['id'],'module_name':_0xb24d('0x30'),'query':util[_0xb24d('0x28')](_0xb24d('0x31'),_0x5373f3),'order_by':'','offset':'0','select_fields':['id','name',_0xb24d('0x32')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb24d('0x33')](function(_0xba3bd0){if(_0xba3bd0['entry_list'][_0xb24d('0x20')]){var _0x4beb1d=_['find'](_0xba3bd0['entry_list'],function(_0x25f349){return _0x25f349['name_value_list'][_0xb24d('0x32')][_0xb24d('0x34')]===_0x5373f3;});if(_0x4beb1d){logger['info'](_0xb24d('0x35'));return BPromise['resolve']({'id':_0x4beb1d['name_value_list']['id'][_0xb24d('0x34')],'name':_0x4beb1d[_0xb24d('0x36')][_0xb24d('0x11')][_0xb24d('0x34')]});}}logger[_0xb24d('0xf')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0xb24d('0x37')]({'id':_0x5cc0be[_0xb24d('0x36')][_0xb24d('0x38')][_0xb24d('0x34')],'name':_0x5cc0be['name_value_list'][_0xb24d('0x32')][_0xb24d('0x34')]});});}else{logger[_0xb24d('0xf')](_0xb24d('0x39'));return BPromise[_0xb24d('0x37')]({'id':_0x5cc0be[_0xb24d('0x36')][_0xb24d('0x38')][_0xb24d('0x34')],'name':_0x5cc0be['name_value_list'][_0xb24d('0x32')]['value']});}}function getEndUser(_0x5c2ebc,_0x4873b1,_0x14abaf,_0x2494eb){logger[_0xb24d('0xf')](_0xb24d('0x3a'),_0x14abaf);return request({'form':{'method':_0xb24d('0x2f'),'input_type':_0xb24d('0x25'),'response_type':'JSON','rest_data':JSON[_0xb24d('0x26')]({'session':_0x2494eb['id'],'module_name':_0xb24d('0x1d'),'query':util[_0xb24d('0x28')](_0xb24d('0x3b'),_0x14abaf),'order_by':'','offset':'0','select_fields':['id',_0xb24d('0x11'),_0xb24d('0x3c')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xb24d('0x33')](function(_0x1b9eec){if(_0x1b9eec[_0xb24d('0x3d')]['length']){var _0x5535fc=_[_0xb24d('0x3e')](_0x1b9eec['entry_list'],function(_0x5914a7){return _0x5914a7['name_value_list']['phone_home'][_0xb24d('0x34')]===_0x14abaf;});if(_0x5535fc){logger['info'](_0xb24d('0x3f'));return BPromise[_0xb24d('0x37')]({'id':_0x5535fc[_0xb24d('0x36')]['id'][_0xb24d('0x34')],'name':_0x5535fc[_0xb24d('0x36')][_0xb24d('0x11')][_0xb24d('0x34')],'phone':_0x5535fc['name_value_list'][_0xb24d('0x3c')][_0xb24d('0x34')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xb24d('0x24'),'input_type':_0xb24d('0x25'),'response_type':_0xb24d('0x25'),'rest_data':JSON[_0xb24d('0x26')]({'session':_0x2494eb['id'],'module_name':_0xb24d('0x1d'),'name_value_list':[{'name':_0xb24d('0x40'),'value':_0x4873b1!==_0xb24d('0x41')?_0x4873b1:util[_0xb24d('0x28')](_0xb24d('0x42'),_0x14abaf)},{'name':_0xb24d('0x3c'),'value':_0x14abaf}]})}})[_0xb24d('0x33')](function(_0x1bc75e){logger['info']('Enduser\x20created.');return BPromise[_0xb24d('0x37')]({'id':_0x1bc75e['id'],'name':_0x1bc75e[_0xb24d('0x3d')][_0xb24d('0x40')][_0xb24d('0x34')],'phone':_0x1bc75e['entry_list'][_0xb24d('0x3c')]['value']});});}});}function request(_0xcffc9b){logger[_0xb24d('0x43')](_0xb24d('0x44'),JSON[_0xb24d('0x26')](_0xcffc9b));return rp(_[_0xb24d('0x45')](def,_0xcffc9b));}function getTags(_0x11cafc,_0x1e09a6){var _0x4dd8eb=[];if(_0x11cafc&&_0x11cafc[_0xb24d('0x20')]>0x0){_0x4dd8eb=_[_0xb24d('0x46')](_0x11cafc,_0x1e09a6);}return _0x4dd8eb;}function getCustomFields(_0x16bd65,_0x56ba40){var _0x1c9cec=[];var _0x28cf51={'custom_fields':[]};if(_0x16bd65[_0xb24d('0x20')]>0x0){_[_0xb24d('0x47')](_0x16bd65,function(_0x541384){if(_0x541384['type']==='string'&&_0x541384[_0xb24d('0x48')]&&!_0x541384['customField']){_0x28cf51[_0x541384[_0xb24d('0x48')][_0xb24d('0x49')]()]=_0x541384[_0xb24d('0x4a')]['toString']();}else if(_0x541384[_0xb24d('0x4b')]===_0xb24d('0x4c')&&_0x541384[_0xb24d('0x23')]&&_0x541384[_0xb24d('0x4d')]){_0x28cf51[_0xb24d('0x4e')][_0xb24d('0x22')]({'id':_0x541384['idField'],'value':_0x541384['content'][_0xb24d('0x2a')]()});}else if(_0x541384[_0xb24d('0x4b')]===_0xb24d('0x4f')&&_0x541384[_0xb24d('0x21')]&&_0x541384[_0xb24d('0x23')]&&_0x541384['customField']){_0x56ba40[_0x541384[_0xb24d('0x21')]]&&_0x28cf51['custom_fields'][_0xb24d('0x22')]({'id':_0x541384[_0xb24d('0x23')],'value':_0x56ba40[_0x541384['variableName']][_0xb24d('0x2a')]()});}else if(_0x541384['type']==='customVariable'&&_0x541384[_0xb24d('0x50')]&&_0x541384[_0xb24d('0x50')][_0xb24d('0x11')]&&_0x541384[_0xb24d('0x23')]&&_0x541384[_0xb24d('0x4d')]){_0x56ba40[_0x541384[_0xb24d('0x50')][_0xb24d('0x11')][_0xb24d('0x49')]()]&&_0x28cf51[_0xb24d('0x4e')][_0xb24d('0x22')]({'id':_0x541384[_0xb24d('0x23')],'value':_0x56ba40[_0x541384[_0xb24d('0x50')][_0xb24d('0x11')]['toLowerCase']()][_0xb24d('0x2a')]()});}});}return _0x28cf51;}function getConnection(_0x4bcd43){return request({'method':_0xb24d('0xd'),'form':{'method':_0xb24d('0x51'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xb24d('0x26')]({'user_auth':{'user_name':_0x4bcd43[_0xb24d('0x52')],'password':_0x4bcd43['password'],'encryption':_0xb24d('0x53')},'application':_0xb24d('0x54')})}})[_0xb24d('0x33')](function(_0xf9c96f){var _0x56d8f8=_0xf9c96f;if(_0x56d8f8['id']){def[_0xb24d('0x55')]=_0x56d8f8['id'];return BPromise[_0xb24d('0x37')](_0x56d8f8);}else{throw new Error(util[_0xb24d('0x28')]('Account\x20%d\x20is\x20not\x20valid',_0x4bcd43['id']));}});}function setRelationship(_0x1d9be2,_0x1846fb,_0x525712,_0x3b410f){return request({'form':{'method':_0xb24d('0x56'),'input_type':_0xb24d('0x25'),'response_type':_0xb24d('0x25'),'rest_data':JSON[_0xb24d('0x26')]({'session':_0x1d9be2['id'],'module_name':'Calls','module_id':_0x525712['id'],'link_field_name':_0x3b410f,'related_ids':[_0x1846fb['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xb24d('0x57')]=function(_0x31cbb8,_0x2280f7,_0x50c09e,_0x406e5b,_0x5bf25d,_0x8b8fa){var _0x371147,_0x5d1c32,_0xc9acfa,_0x4b710f;_0x8b8fa['remoteUri']=intUtil['stripTrailingSlash'](_0x8b8fa['remoteUri']);_0x8b8fa[_0xb24d('0x58')]=intUtil[_0xb24d('0x59')](_0x8b8fa[_0xb24d('0x58')]);def['uri']=util[_0xb24d('0x28')](_0xb24d('0x5a'),_0x8b8fa[_0xb24d('0x5b')]);if(_0x5bf25d&&_0x5bf25d[_0xb24d('0x5c')]){logger[_0xb24d('0xf')](_0xb24d('0x5d'),_0xb24d('0x5e'));_0x2280f7[_0xb24d('0x5f')]=util[_0xb24d('0x28')](_0xb24d('0x60'),_0x8b8fa[_0xb24d('0x58')],_0x2280f7['uniqueid'],md5(_0x2280f7[_0xb24d('0x61')]));}else{_0x2280f7[_0xb24d('0x5f')]='';}return getConnection(_0x8b8fa)[_0xb24d('0x33')](function(_0x43e697){_0x4b710f=_0x43e697;return getUser(_0x8b8fa,_0x406e5b[_0xb24d('0x11')],_0x4b710f);})['then'](function(_0x3b3d7c){_0x371147=_0x3b3d7c;logger[_0xb24d('0xf')](_0xb24d('0x62'),_0x371147['id']);return getEndUser(_0x8b8fa,_0x2280f7['calleridname'],_0x2280f7[_0xb24d('0x63')],_0x4b710f);})[_0xb24d('0x33')](function(_0x351e02){_0x5d1c32=_0x351e02;logger[_0xb24d('0xf')](_0xb24d('0x64'),_0x5d1c32['id']);return getTicket(_0x8b8fa,_0x371147,_0x5d1c32,_0x50c09e,_0x2280f7,_0x50c09e[_0xb24d('0x65')],_0x4b710f,_0xb24d('0x66'));})['then'](function(_0x2037ec){_0xc9acfa=_0x2037ec;logger[_0xb24d('0xf')](_0xb24d('0x67'));logger[_0xb24d('0xf')]('The\x20Ticket\x20ID\x20is:',_0xc9acfa['id']);return setRelationship(_0x4b710f,_0x371147,_0xc9acfa,_0xb24d('0x68'));})['then'](function(){return setRelationship(_0x4b710f,_0x5d1c32,_0xc9acfa,_0xb24d('0x69'));})[_0xb24d('0x33')](function(){return getServerInfo(_0x4b710f);})[_0xb24d('0x33')](function(_0x2f4c52){var _0x1bc78b=parseInt(_0x2f4c52[_0xb24d('0x6a')][_0xb24d('0x6b')](0x0));var _0x1ec2ce=util[_0xb24d('0x28')](_0xb24d('0x6c'),_0x8b8fa[_0xb24d('0x5b')],_0xc9acfa['id']);if(_0x1bc78b>0x6){_0x1ec2ce=util[_0xb24d('0x28')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x8b8fa[_0xb24d('0x5b')],_0xc9acfa['id']);}logger[_0xb24d('0xf')]('[QUEUE]',_0xb24d('0x6d'));emit(util[_0xb24d('0x28')](_0xb24d('0x6e'),_0x406e5b['name']),'trigger:browser:url',{'uri':_0x1ec2ce});})[_0xb24d('0x6f')](function(_0x13a9cb){logger['error'](_0xb24d('0x5d'),JSON['stringify'](_0x13a9cb));});};exports['outbound']=function(_0x49b508,_0x4477d5,_0x7039ef,_0x52ee49,_0x4d113c,_0x19af7e,_0x4743a6){var _0x429cef,_0x145cd9,_0x1d12e6,_0x4c2c18;_0x19af7e[_0xb24d('0x5b')]=intUtil[_0xb24d('0x59')](_0x19af7e[_0xb24d('0x5b')]);_0x19af7e[_0xb24d('0x58')]=intUtil[_0xb24d('0x59')](_0x19af7e[_0xb24d('0x58')]);def[_0xb24d('0x70')]=util[_0xb24d('0x28')](_0xb24d('0x5a'),_0x19af7e[_0xb24d('0x5b')]);if(_0x4743a6&&_0x4743a6[_0xb24d('0x71')]&&_0x4743a6['recordingFormat']!==_0xb24d('0x72')){logger[_0xb24d('0xf')]('[OUTBOUND]',_0xb24d('0x5e'));_0x4477d5[_0xb24d('0x5f')]=util[_0xb24d('0x28')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19af7e['serverUrl'],_0x4477d5[_0xb24d('0x61')],md5(_0x4477d5[_0xb24d('0x61')]));}return getConnection(_0x19af7e)[_0xb24d('0x33')](function(_0xa24c11){_0x4c2c18=_0xa24c11;return getUser(_0x19af7e,_0x52ee49[_0xb24d('0x11')],_0x4c2c18);})[_0xb24d('0x33')](function(_0xefa9f0){_0x429cef=_0xefa9f0;logger['info'](_0xb24d('0x62'),_0x429cef['id']);return getEndUser(_0x19af7e,_0x4477d5[_0xb24d('0x73')],_0x4477d5['destcalleridnum'],_0x4c2c18);})[_0xb24d('0x33')](function(_0x3e1662){_0x145cd9=_0x3e1662;logger[_0xb24d('0xf')](_0xb24d('0x64'),_0x145cd9['id']);return getTicket(_0x19af7e,_0x429cef,_0x145cd9,_0x7039ef,_0x4477d5,_0x7039ef[_0xb24d('0x65')],_0x4c2c18,_0xb24d('0x74'));})[_0xb24d('0x33')](function(_0xe8de8f){_0x1d12e6=_0xe8de8f;logger['info'](_0xb24d('0x67'));logger[_0xb24d('0xf')]('The\x20Ticket\x20ID\x20is:',_0x1d12e6['id']);return setRelationship(_0x4c2c18,_0x429cef,_0x1d12e6,_0xb24d('0x68'));})[_0xb24d('0x33')](function(){return setRelationship(_0x4c2c18,_0x145cd9,_0x1d12e6,_0xb24d('0x69'));})['then'](function(){return getServerInfo(_0x4c2c18);})[_0xb24d('0x33')](function(_0x23b634){var _0x3c44da=parseInt(_0x23b634['version']['charAt'](0x0));var _0x1e6208=util[_0xb24d('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x19af7e[_0xb24d('0x5b')],_0x1d12e6['id']);if(_0x3c44da>0x6){_0x1e6208=util[_0xb24d('0x28')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x19af7e[_0xb24d('0x5b')],_0x1d12e6['id']);}logger[_0xb24d('0xf')](_0xb24d('0x75'),_0xb24d('0x6d'));emit(util[_0xb24d('0x28')](_0xb24d('0x6e'),_0x52ee49[_0xb24d('0x11')]),'trigger:browser:url',{'uri':_0x1e6208});})['catch'](function(_0x682720){logger[_0xb24d('0x76')](_0xb24d('0x75'),JSON[_0xb24d('0x26')](_0x682720));});};exports[_0xb24d('0x77')]=function(_0x404d6e,_0x25aa5c,_0x4b0eea,_0x440caf,_0x2e6456,_0xd7640b){var _0x5b477f,_0x3f3f52,_0x1292a0,_0x27388a;_0xd7640b[_0xb24d('0x5b')]=intUtil[_0xb24d('0x59')](_0xd7640b[_0xb24d('0x5b')]);_0xd7640b[_0xb24d('0x58')]=intUtil[_0xb24d('0x59')](_0xd7640b[_0xb24d('0x58')]);def[_0xb24d('0x70')]=util['format']('%s/service/v4_1/rest.php',_0xd7640b[_0xb24d('0x5b')]);if(_0x2e6456&&_0x2e6456[_0xb24d('0x5c')]){logger[_0xb24d('0xf')]('['+_0x25aa5c[_0xb24d('0x78')][_0xb24d('0x79')]()+']',_0xb24d('0x5e'));_0x25aa5c[_0xb24d('0x5f')]=util[_0xb24d('0x28')](_0xb24d('0x60'),_0xd7640b['serverUrl'],_0x25aa5c['uniqueid'],md5(_0x25aa5c[_0xb24d('0x61')]));}else{_0x25aa5c[_0xb24d('0x5f')]='';}return getConnection(_0xd7640b)[_0xb24d('0x33')](function(_0x39fa91){_0x27388a=_0x39fa91;if(!_[_0xb24d('0x2d')](_0x440caf)){return getUser(_0xd7640b,_0x440caf[_0xb24d('0x11')],_0x27388a);}else{return getUser(_0xd7640b,null,_0x27388a);}})['then'](function(_0x218a5d){_0x5b477f=_0x218a5d;logger[_0xb24d('0xf')]('The\x20User\x20ID\x20is:',_0x5b477f['id']);return getEndUser(_0xd7640b,_0x25aa5c[_0xb24d('0x7a')],_0x25aa5c['calleridnum'],_0x27388a);})[_0xb24d('0x33')](function(_0x279332){_0x3f3f52=_0x279332;logger['info'](_0xb24d('0x64'),_0x3f3f52['id']);return getTicket(_0xd7640b,_0x5b477f,_0x3f3f52,_0x4b0eea,_0x25aa5c,_0x4b0eea['Fields'],_0x27388a,'Inbound');})[_0xb24d('0x33')](function(_0x15c4d1){_0x1292a0=_0x15c4d1;logger[_0xb24d('0xf')](_0xb24d('0x67'));logger[_0xb24d('0xf')](_0xb24d('0x7b'),_0x1292a0['id']);return setRelationship(_0x27388a,_0x5b477f,_0x1292a0,_0xb24d('0x68'));})[_0xb24d('0x33')](function(){return setRelationship(_0x27388a,_0x3f3f52,_0x1292a0,_0xb24d('0x69'));})[_0xb24d('0x33')](function(){return getServerInfo(_0x27388a);})[_0xb24d('0x6f')](function(_0x105896){logger[_0xb24d('0x76')]('['+_0x25aa5c[_0xb24d('0x78')][_0xb24d('0x79')]()+']',JSON['stringify'](_0x105896));});}; \ No newline at end of file +var _0x39e0=['%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridnum','Ticket\x20created!','version','user:%s','trigger:browser:url','[OUTBOUND]','unmanaged','lastevent','toUpperCase','isNil','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','created_by','description','toISOString','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','direction','forEach','variableName','idField','set_entry','JSON','Calls','format','apiKey','toString','Getting\x20agent\x20with\x20name','get_entry_list','stringify','Employees','user_name','then','entry_list','length','find','name_value_list','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','customField','nameField','toLowerCase','content','custom_fields','variable','push','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','The\x20Ticket\x20ID\x20is:','users','contacts','charAt'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0x39e0,0x17c));var _0x039e=function(_0xe41760,_0x1db7a0){_0xe41760=_0xe41760-0x0;var _0x5a6ef6=_0x39e0[_0xe41760];return _0x5a6ef6;};'use strict';var _=require(_0x039e('0x0'));var rp=require(_0x039e('0x1'));var BPromise=require(_0x039e('0x2'));var md5=require(_0x039e('0x3'));var util=require(_0x039e('0x4'));var Redis=require(_0x039e('0x5'));var intUtil=require(_0x039e('0x6'));var config=require(_0x039e('0x7'));var logger=require(_0x039e('0x8'))('sugarcrm');config[_0x039e('0x9')]=_[_0x039e('0xa')](config[_0x039e('0x9')],{'host':_0x039e('0xb'),'port':0x18eb});var io=require(_0x039e('0xc'))(new Redis(config['redis']));var def={'method':'POST','json':!![]};function emit(_0x1f4910,_0x15c08b,_0x256f6d){io['to'](_0x1f4910)[_0x039e('0xd')](_0x15c08b,_0x256f6d);}function getTicket(_0x13c305,_0x276624,_0x403bde,_0x172de7,_0x45f9bd,_0x2e5226,_0x10017b,_0x4edbbb){logger[_0x039e('0xe')](_0x039e('0xf'));var _0x2b09e0=new Date();var _0x5278e6=[{'name':_0x039e('0x10'),'value':intUtil[_0x039e('0x11')](_0x172de7['Subjects'],_0x45f9bd,'\x20')},{'name':'assigned_user_id','value':_0x276624['id']},{'name':_0x039e('0x12'),'value':_0x276624['id']},{'name':_0x039e('0x13'),'value':intUtil['getString'](_0x172de7['Descriptions'],_0x45f9bd,'\x0a')},{'name':'date_start','value':_0x2b09e0[_0x039e('0x14')]()[_0x039e('0x15')](0x0,0x13)[_0x039e('0x16')]('T','\x20')},{'name':_0x039e('0x17'),'value':'0'},{'name':_0x039e('0x18'),'value':'15'},{'name':_0x039e('0x19'),'value':_0x403bde['id']},{'name':_0x039e('0x1a'),'value':_0x039e('0x1b')},{'name':'parent_name','value':_0x403bde[_0x039e('0x10')]},{'name':_0x039e('0x1c'),'value':_0x4edbbb}];if(_0x2e5226['length']){_[_0x039e('0x1d')](_0x2e5226,function(_0x2b5ca5){if(_0x45f9bd[_0x2b5ca5[_0x039e('0x1e')]]){_0x5278e6['push']({'name':_0x2b5ca5[_0x039e('0x1f')],'value':_0x45f9bd[_0x2b5ca5[_0x039e('0x1e')]]});}});}return request({'form':{'method':_0x039e('0x20'),'input_type':'JSON','response_type':_0x039e('0x21'),'rest_data':JSON['stringify']({'session':_0x10017b['id'],'module_name':_0x039e('0x22'),'name_value_list':_0x5278e6})}});}function getAuth(_0x2c6861){return util[_0x039e('0x23')]('Basic\x20%s',new Buffer(_0x2c6861[_0x039e('0x24')]+':X')[_0x039e('0x25')]('base64'));}function getServerInfo(_0x31d302){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':_0x039e('0x21'),'rest_data':JSON['stringify']({'session':_0x31d302['id']})}});}function getUser(_0x1c919c,_0x2852a8,_0x664d7){if(!_['isNil'](_0x2852a8)){logger['info'](_0x039e('0x26'),_0x2852a8);return request({'form':{'method':_0x039e('0x27'),'input_type':_0x039e('0x21'),'response_type':_0x039e('0x21'),'rest_data':JSON[_0x039e('0x28')]({'session':_0x664d7['id'],'module_name':_0x039e('0x29'),'query':util[_0x039e('0x23')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x2852a8),'order_by':'','offset':'0','select_fields':['id',_0x039e('0x10'),_0x039e('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x039e('0x2b')](function(_0x2d8c59){if(_0x2d8c59[_0x039e('0x2c')][_0x039e('0x2d')]){var _0x1e9c9f=_[_0x039e('0x2e')](_0x2d8c59[_0x039e('0x2c')],function(_0x2e0544){return _0x2e0544[_0x039e('0x2f')][_0x039e('0x2a')]['value']===_0x2852a8;});if(_0x1e9c9f){logger[_0x039e('0xe')](_0x039e('0x30'));return BPromise[_0x039e('0x31')]({'id':_0x1e9c9f['name_value_list']['id'][_0x039e('0x32')],'name':_0x1e9c9f[_0x039e('0x2f')][_0x039e('0x10')][_0x039e('0x32')]});}}logger[_0x039e('0xe')](_0x039e('0x33'));return BPromise[_0x039e('0x31')]({'id':_0x664d7[_0x039e('0x2f')]['user_id'][_0x039e('0x32')],'name':_0x664d7[_0x039e('0x2f')][_0x039e('0x2a')][_0x039e('0x32')]});});}else{logger['info'](_0x039e('0x34'));return BPromise['resolve']({'id':_0x664d7[_0x039e('0x2f')][_0x039e('0x35')][_0x039e('0x32')],'name':_0x664d7['name_value_list'][_0x039e('0x2a')][_0x039e('0x32')]});}}function getEndUser(_0x2b48f2,_0x2d5185,_0x5b516f,_0x4b9270){logger[_0x039e('0xe')](_0x039e('0x36'),_0x5b516f);return request({'form':{'method':_0x039e('0x27'),'input_type':_0x039e('0x21'),'response_type':_0x039e('0x21'),'rest_data':JSON[_0x039e('0x28')]({'session':_0x4b9270['id'],'module_name':_0x039e('0x1b'),'query':util[_0x039e('0x23')](_0x039e('0x37'),_0x5b516f),'order_by':'','offset':'0','select_fields':['id',_0x039e('0x10'),_0x039e('0x38')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x039e('0x2b')](function(_0x313bf4){if(_0x313bf4[_0x039e('0x2c')][_0x039e('0x2d')]){var _0x3c33e7=_['find'](_0x313bf4[_0x039e('0x2c')],function(_0x879213){return _0x879213['name_value_list'][_0x039e('0x38')][_0x039e('0x32')]===_0x5b516f;});if(_0x3c33e7){logger[_0x039e('0xe')](_0x039e('0x39'));return BPromise['resolve']({'id':_0x3c33e7[_0x039e('0x2f')]['id'][_0x039e('0x32')],'name':_0x3c33e7[_0x039e('0x2f')]['name'][_0x039e('0x32')],'phone':_0x3c33e7[_0x039e('0x2f')][_0x039e('0x38')][_0x039e('0x32')]});}}else{logger['info'](_0x039e('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x039e('0x21'),'response_type':_0x039e('0x21'),'rest_data':JSON[_0x039e('0x28')]({'session':_0x4b9270['id'],'module_name':_0x039e('0x1b'),'name_value_list':[{'name':_0x039e('0x3b'),'value':_0x2d5185!==''?_0x2d5185:util[_0x039e('0x23')](_0x039e('0x3c'),_0x5b516f)},{'name':_0x039e('0x38'),'value':_0x5b516f}]})}})[_0x039e('0x2b')](function(_0x5fb089){logger[_0x039e('0xe')](_0x039e('0x3d'));return BPromise[_0x039e('0x31')]({'id':_0x5fb089['id'],'name':_0x5fb089[_0x039e('0x2c')][_0x039e('0x3b')][_0x039e('0x32')],'phone':_0x5fb089[_0x039e('0x2c')]['phone_home'][_0x039e('0x32')]});});}});}function request(_0x1f130a){logger[_0x039e('0x3e')](_0x039e('0x3f'),JSON['stringify'](_0x1f130a));return rp(_[_0x039e('0x40')](def,_0x1f130a));}function getTags(_0x36c827,_0x4447c2){var _0x38632a=[];if(_0x36c827&&_0x36c827[_0x039e('0x2d')]>0x0){_0x38632a=_[_0x039e('0x41')](_0x36c827,_0x4447c2);}return _0x38632a;}function getCustomFields(_0x136526,_0x496afa){var _0x33ef50=[];var _0x347a50={'custom_fields':[]};if(_0x136526[_0x039e('0x2d')]>0x0){_['forEach'](_0x136526,function(_0x2d6235){if(_0x2d6235[_0x039e('0x42')]==='string'&&_0x2d6235['nameField']&&!_0x2d6235[_0x039e('0x43')]){_0x347a50[_0x2d6235[_0x039e('0x44')][_0x039e('0x45')]()]=_0x2d6235[_0x039e('0x46')]['toString']();}else if(_0x2d6235[_0x039e('0x42')]==='string'&&_0x2d6235['idField']&&_0x2d6235['customField']){_0x347a50[_0x039e('0x47')]['push']({'id':_0x2d6235['idField'],'value':_0x2d6235[_0x039e('0x46')]['toString']()});}else if(_0x2d6235['type']===_0x039e('0x48')&&_0x2d6235['variableName']&&_0x2d6235[_0x039e('0x1f')]&&_0x2d6235[_0x039e('0x43')]){_0x496afa[_0x2d6235[_0x039e('0x1e')]]&&_0x347a50[_0x039e('0x47')][_0x039e('0x49')]({'id':_0x2d6235[_0x039e('0x1f')],'value':_0x496afa[_0x2d6235[_0x039e('0x1e')]][_0x039e('0x25')]()});}else if(_0x2d6235[_0x039e('0x42')]===_0x039e('0x4a')&&_0x2d6235['Variable']&&_0x2d6235[_0x039e('0x4b')][_0x039e('0x10')]&&_0x2d6235[_0x039e('0x1f')]&&_0x2d6235[_0x039e('0x43')]){_0x496afa[_0x2d6235[_0x039e('0x4b')][_0x039e('0x10')][_0x039e('0x45')]()]&&_0x347a50[_0x039e('0x47')][_0x039e('0x49')]({'id':_0x2d6235['idField'],'value':_0x496afa[_0x2d6235[_0x039e('0x4b')][_0x039e('0x10')]['toLowerCase']()][_0x039e('0x25')]()});}});}return _0x347a50;}function getConnection(_0x4958bf){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':_0x039e('0x21'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4958bf['username'],'password':_0x4958bf[_0x039e('0x4c')],'encryption':_0x039e('0x4d')},'application':_0x039e('0x4e')})}})['then'](function(_0x2cf602){var _0x5e7b36=_0x2cf602;if(_0x5e7b36['id']){def['sessionID']=_0x5e7b36['id'];return BPromise['resolve'](_0x5e7b36);}else{throw new Error(util[_0x039e('0x23')](_0x039e('0x4f'),_0x4958bf['id']));}});}function setRelationship(_0xeb5bcb,_0x142ae5,_0x336b19,_0x5e3a7e){return request({'form':{'method':'set_relationship','input_type':_0x039e('0x21'),'response_type':_0x039e('0x21'),'rest_data':JSON[_0x039e('0x28')]({'session':_0xeb5bcb['id'],'module_name':_0x039e('0x22'),'module_id':_0x336b19['id'],'link_field_name':_0x5e3a7e,'related_ids':[_0x142ae5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x039e('0x50')]=function(_0x1a3348,_0x4f6d1d,_0x261932,_0x5d6c96,_0x4eb95e,_0x332e79){var _0x530e32,_0x32bf4f,_0x209531,_0x465b0d;_0x332e79[_0x039e('0x51')]=intUtil[_0x039e('0x52')](_0x332e79[_0x039e('0x51')]);_0x332e79[_0x039e('0x53')]=intUtil['stripTrailingSlash'](_0x332e79['serverUrl']);def[_0x039e('0x54')]=util[_0x039e('0x23')](_0x039e('0x55'),_0x332e79[_0x039e('0x51')]);if(_0x4eb95e&&_0x4eb95e[_0x039e('0x56')]){logger[_0x039e('0xe')]('[QUEUE]',_0x039e('0x57'));_0x4f6d1d[_0x039e('0x58')]=util[_0x039e('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x332e79[_0x039e('0x53')],_0x4f6d1d['uniqueid'],md5(_0x4f6d1d[_0x039e('0x59')]));}else{_0x4f6d1d[_0x039e('0x58')]='';}return getConnection(_0x332e79)[_0x039e('0x2b')](function(_0x4140e3){_0x465b0d=_0x4140e3;return getUser(_0x332e79,_0x5d6c96[_0x039e('0x10')],_0x465b0d);})['then'](function(_0x1b6971){_0x530e32=_0x1b6971;logger[_0x039e('0xe')](_0x039e('0x5a'),_0x530e32['id']);return getEndUser(_0x332e79,_0x4f6d1d[_0x039e('0x5b')],_0x4f6d1d[_0x039e('0x5c')],_0x465b0d);})['then'](function(_0x5997f4){_0x32bf4f=_0x5997f4;logger[_0x039e('0xe')](_0x039e('0x5d'),_0x32bf4f['id']);return getTicket(_0x332e79,_0x530e32,_0x32bf4f,_0x261932,_0x4f6d1d,_0x261932[_0x039e('0x5e')],_0x465b0d,_0x039e('0x5f'));})[_0x039e('0x2b')](function(_0x70ca4c){_0x209531=_0x70ca4c;logger[_0x039e('0xe')]('Ticket\x20created!');logger[_0x039e('0xe')](_0x039e('0x60'),_0x209531['id']);return setRelationship(_0x465b0d,_0x530e32,_0x209531,_0x039e('0x61'));})[_0x039e('0x2b')](function(){return setRelationship(_0x465b0d,_0x32bf4f,_0x209531,_0x039e('0x62'));})[_0x039e('0x2b')](function(){return getServerInfo(_0x465b0d);})[_0x039e('0x2b')](function(_0x3274fb){var _0x448082=parseInt(_0x3274fb['version'][_0x039e('0x63')](0x0));var _0x4e66b1=util[_0x039e('0x23')](_0x039e('0x64'),_0x332e79[_0x039e('0x51')],_0x209531['id']);if(_0x448082>0x6){_0x4e66b1=util[_0x039e('0x23')](_0x039e('0x65'),_0x332e79[_0x039e('0x51')],_0x209531['id']);}logger[_0x039e('0xe')](_0x039e('0x66'),_0x039e('0x67'));emit(util[_0x039e('0x23')]('user:%s',_0x5d6c96['name']),'trigger:browser:url',{'uri':_0x4e66b1});})[_0x039e('0x68')](function(_0x2f3391){logger[_0x039e('0x69')](_0x039e('0x66'),JSON[_0x039e('0x28')](_0x2f3391));});};exports[_0x039e('0x6a')]=function(_0x278c92,_0x1c7a9d,_0x24cb58,_0x3f4c31,_0x5566c2,_0x3ac102,_0x2f0cf3){var _0xb0c6d1,_0xd32e7e,_0x38bd7a,_0x4b9bce;_0x3ac102[_0x039e('0x51')]=intUtil[_0x039e('0x52')](_0x3ac102[_0x039e('0x51')]);_0x3ac102[_0x039e('0x53')]=intUtil['stripTrailingSlash'](_0x3ac102[_0x039e('0x53')]);def[_0x039e('0x54')]=util[_0x039e('0x23')](_0x039e('0x55'),_0x3ac102['remoteUri']);if(_0x2f0cf3&&_0x2f0cf3[_0x039e('0x6b')]&&_0x2f0cf3[_0x039e('0x6b')]!==_0x039e('0x6c')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1c7a9d['recordingURL']=util['format'](_0x039e('0x6d'),_0x3ac102[_0x039e('0x53')],_0x1c7a9d[_0x039e('0x59')],md5(_0x1c7a9d[_0x039e('0x59')]));}return getConnection(_0x3ac102)['then'](function(_0x5dcbac){_0x4b9bce=_0x5dcbac;return getUser(_0x3ac102,_0x3f4c31['name'],_0x4b9bce);})[_0x039e('0x2b')](function(_0x53a6bd){_0xb0c6d1=_0x53a6bd;logger['info'](_0x039e('0x5a'),_0xb0c6d1['id']);return getEndUser(_0x3ac102,_0x1c7a9d['destcalleridname'],_0x1c7a9d[_0x039e('0x6e')],_0x4b9bce);})[_0x039e('0x2b')](function(_0x4b7343){_0xd32e7e=_0x4b7343;logger[_0x039e('0xe')]('The\x20Enduser\x20ID\x20is:',_0xd32e7e['id']);return getTicket(_0x3ac102,_0xb0c6d1,_0xd32e7e,_0x24cb58,_0x1c7a9d,_0x24cb58[_0x039e('0x5e')],_0x4b9bce,'Outbound');})[_0x039e('0x2b')](function(_0x566c4d){_0x38bd7a=_0x566c4d;logger['info'](_0x039e('0x6f'));logger[_0x039e('0xe')](_0x039e('0x60'),_0x38bd7a['id']);return setRelationship(_0x4b9bce,_0xb0c6d1,_0x38bd7a,_0x039e('0x61'));})[_0x039e('0x2b')](function(){return setRelationship(_0x4b9bce,_0xd32e7e,_0x38bd7a,_0x039e('0x62'));})[_0x039e('0x2b')](function(){return getServerInfo(_0x4b9bce);})[_0x039e('0x2b')](function(_0x37e53d){var _0x41cacc=parseInt(_0x37e53d[_0x039e('0x70')][_0x039e('0x63')](0x0));var _0x574bd6=util[_0x039e('0x23')](_0x039e('0x64'),_0x3ac102[_0x039e('0x51')],_0x38bd7a['id']);if(_0x41cacc>0x6){_0x574bd6=util[_0x039e('0x23')](_0x039e('0x65'),_0x3ac102[_0x039e('0x51')],_0x38bd7a['id']);}logger[_0x039e('0xe')]('[OUTBOUND]',_0x039e('0x67'));emit(util['format'](_0x039e('0x71'),_0x3f4c31[_0x039e('0x10')]),_0x039e('0x72'),{'uri':_0x574bd6});})[_0x039e('0x68')](function(_0x107dd6){logger['error'](_0x039e('0x73'),JSON['stringify'](_0x107dd6));});};exports[_0x039e('0x74')]=function(_0xc1167e,_0x4f4fbf,_0x1a9214,_0x23696b,_0x2312e4,_0x2a4a81){var _0x2f6e1a,_0x402760,_0x1a3c87,_0x1e4839;_0x2a4a81[_0x039e('0x51')]=intUtil[_0x039e('0x52')](_0x2a4a81['remoteUri']);_0x2a4a81[_0x039e('0x53')]=intUtil[_0x039e('0x52')](_0x2a4a81[_0x039e('0x53')]);def[_0x039e('0x54')]=util[_0x039e('0x23')](_0x039e('0x55'),_0x2a4a81[_0x039e('0x51')]);if(_0x2312e4&&_0x2312e4[_0x039e('0x56')]){logger[_0x039e('0xe')]('['+_0x4f4fbf[_0x039e('0x75')][_0x039e('0x76')]()+']',_0x039e('0x57'));_0x4f4fbf['recordingURL']=util[_0x039e('0x23')](_0x039e('0x6d'),_0x2a4a81['serverUrl'],_0x4f4fbf[_0x039e('0x59')],md5(_0x4f4fbf[_0x039e('0x59')]));}else{_0x4f4fbf[_0x039e('0x58')]='';}return getConnection(_0x2a4a81)[_0x039e('0x2b')](function(_0x3d5f5c){_0x1e4839=_0x3d5f5c;if(!_[_0x039e('0x77')](_0x23696b)){return getUser(_0x2a4a81,_0x23696b[_0x039e('0x10')],_0x1e4839);}else{return getUser(_0x2a4a81,null,_0x1e4839);}})[_0x039e('0x2b')](function(_0x2c32d6){_0x2f6e1a=_0x2c32d6;logger[_0x039e('0xe')](_0x039e('0x5a'),_0x2f6e1a['id']);return getEndUser(_0x2a4a81,_0x4f4fbf[_0x039e('0x5b')],_0x4f4fbf[_0x039e('0x5c')],_0x1e4839);})['then'](function(_0x1dbc37){_0x402760=_0x1dbc37;logger[_0x039e('0xe')](_0x039e('0x5d'),_0x402760['id']);return getTicket(_0x2a4a81,_0x2f6e1a,_0x402760,_0x1a9214,_0x4f4fbf,_0x1a9214[_0x039e('0x5e')],_0x1e4839,_0x039e('0x5f'));})[_0x039e('0x2b')](function(_0x4b59f6){_0x1a3c87=_0x4b59f6;logger[_0x039e('0xe')](_0x039e('0x6f'));logger[_0x039e('0xe')](_0x039e('0x60'),_0x1a3c87['id']);return setRelationship(_0x1e4839,_0x2f6e1a,_0x1a3c87,'users');})[_0x039e('0x2b')](function(){return setRelationship(_0x1e4839,_0x402760,_0x1a3c87,_0x039e('0x62'));})[_0x039e('0x2b')](function(){return getServerInfo(_0x1e4839);})[_0x039e('0x68')](function(_0x26f9fa){logger[_0x039e('0x69')]('['+_0x4f4fbf[_0x039e('0x75')]['toUpperCase']()+']',JSON['stringify'](_0x26f9fa));});}; \ 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 2b0c772..baeeae5 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 _0x9f5b=['format','%s:\x20%s','key','join','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','toLowerCase','name','keyValue','keyType'];(function(_0x205e83,_0x2df5a4){var _0x10bb19=function(_0x41a375){while(--_0x41a375){_0x205e83['push'](_0x205e83['shift']());}};_0x10bb19(++_0x2df5a4);}(_0x9f5b,0x6e));var _0xb9f5=function(_0x493985,_0xabbee5){_0x493985=_0x493985-0x0;var _0x532b94=_0x9f5b[_0x493985];return _0x532b94;};'use strict';var _=require('lodash');var util=require('util');exports[_0xb9f5('0x0')]=function(_0x51cf5b,_0x516b56,_0x2a47f1){var _0x308a61=[];if(_0x51cf5b[_0xb9f5('0x1')]>0x0){var _0x52d056=_[_0xb9f5('0x2')](_0x51cf5b,['id']);for(var _0x559028=0x0;_0x559028<_0x52d056['length'];_0x559028++){var _0x3ff8a6=_0x52d056[_0x559028];if(_0x3ff8a6['type']==='string'){_0x308a61[_0xb9f5('0x3')](_0x3ff8a6[_0xb9f5('0x4')]);}else if(_0x3ff8a6[_0xb9f5('0x5')]===_0xb9f5('0x6')&&_0x3ff8a6[_0xb9f5('0x7')]){_0x516b56[_0x3ff8a6[_0xb9f5('0x7')]]&&_0x308a61[_0xb9f5('0x3')](_0x516b56[_0x3ff8a6[_0xb9f5('0x7')]][_0xb9f5('0x8')]());}else if(_0x3ff8a6[_0xb9f5('0x5')]===_0xb9f5('0x9')&&_0x3ff8a6[_0xb9f5('0xa')]&&_0x3ff8a6[_0xb9f5('0xa')]['name']){_0x516b56[_0x3ff8a6['Variable']['name'][_0xb9f5('0xb')]()]&&_0x308a61[_0xb9f5('0x3')](_0x516b56[_0x3ff8a6['Variable'][_0xb9f5('0xc')][_0xb9f5('0xb')]()][_0xb9f5('0x8')]());}else if(_0x3ff8a6[_0xb9f5('0x5')]===_0xb9f5('0xd')){if(_0x3ff8a6[_0xb9f5('0xe')]==='string'&&_0x3ff8a6['key']){_0x308a61[_0xb9f5('0x3')](util[_0xb9f5('0xf')](_0xb9f5('0x10'),_0x3ff8a6[_0xb9f5('0x11')],_0x3ff8a6['keyContent']));}else if(_0x3ff8a6[_0xb9f5('0xe')]===_0xb9f5('0x6')&&_0x3ff8a6['variableName']&&_0x3ff8a6[_0xb9f5('0x11')]){_0x516b56[_0x3ff8a6[_0xb9f5('0x7')]]&&_0x308a61['push'](util['format'](_0xb9f5('0x10'),_0x3ff8a6[_0xb9f5('0x11')],_0x516b56[_0x3ff8a6['variableName']]));}else if(_0x3ff8a6[_0xb9f5('0xe')]===_0xb9f5('0x9')&&_0x3ff8a6[_0xb9f5('0xa')]&&_0x3ff8a6[_0xb9f5('0xa')][_0xb9f5('0xc')]&&_0x3ff8a6[_0xb9f5('0x11')]){_0x516b56[_0x3ff8a6[_0xb9f5('0xa')][_0xb9f5('0xc')]['toLowerCase']()]&&_0x308a61[_0xb9f5('0x3')](util[_0xb9f5('0xf')](_0xb9f5('0x10'),_0x3ff8a6['key'],_0x516b56[_0x3ff8a6['Variable'][_0xb9f5('0xc')][_0xb9f5('0xb')]()]));}}}}return _0x308a61[_0xb9f5('0x12')](_0x2a47f1);};exports[_0xb9f5('0x13')]=function(_0x1f81a4){var _0x143713=_0x1f81a4['slice'](-0x1);if(_0x143713==='/'){_0x1f81a4=_0x1f81a4[_0xb9f5('0x14')](0x0,_0x1f81a4[_0xb9f5('0x15')](_0x143713));}return _0x1f81a4;};exports[_0xb9f5('0x16')]=function(_0x2ee1ba){if(!_[_0xb9f5('0x17')](_0x2ee1ba)&&_0x2ee1ba!==''){var _0x19d3ed=/^(([^<>()\[\]\\.,;:\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 _0x19d3ed[_0xb9f5('0x18')](String(_0x2ee1ba)[_0xb9f5('0xb')]());}else{return![];}}; \ No newline at end of file +var _0x5057=['%s:\x20%s','keyContent','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','push','content','variable','variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','keyType','string','key','format'];(function(_0x1f30fd,_0x25b081){var _0x3f6b6f=function(_0x23f321){while(--_0x23f321){_0x1f30fd['push'](_0x1f30fd['shift']());}};_0x3f6b6f(++_0x25b081);}(_0x5057,0x104));var _0x7505=function(_0x46ddbf,_0x2efab7){_0x46ddbf=_0x46ddbf-0x0;var _0xdacb86=_0x5057[_0x46ddbf];return _0xdacb86;};'use strict';var _=require(_0x7505('0x0'));var util=require(_0x7505('0x1'));exports[_0x7505('0x2')]=function(_0x52c99a,_0x421be8,_0x516ab4){var _0x34bb7d=[];if(_0x52c99a[_0x7505('0x3')]>0x0){var _0x1a44b3=_[_0x7505('0x4')](_0x52c99a,['id']);for(var _0x503658=0x0;_0x503658<_0x1a44b3['length'];_0x503658++){var _0x1c3297=_0x1a44b3[_0x503658];if(_0x1c3297[_0x7505('0x5')]==='string'){_0x34bb7d[_0x7505('0x6')](_0x1c3297[_0x7505('0x7')]);}else if(_0x1c3297[_0x7505('0x5')]===_0x7505('0x8')&&_0x1c3297['variableName']){_0x421be8[_0x1c3297[_0x7505('0x9')]]&&_0x34bb7d[_0x7505('0x6')](_0x421be8[_0x1c3297['variableName']]['toString']());}else if(_0x1c3297[_0x7505('0x5')]===_0x7505('0xa')&&_0x1c3297[_0x7505('0xb')]&&_0x1c3297[_0x7505('0xb')][_0x7505('0xc')]){_0x421be8[_0x1c3297[_0x7505('0xb')][_0x7505('0xc')][_0x7505('0xd')]()]&&_0x34bb7d['push'](_0x421be8[_0x1c3297[_0x7505('0xb')][_0x7505('0xc')]['toLowerCase']()][_0x7505('0xe')]());}else if(_0x1c3297[_0x7505('0x5')]===_0x7505('0xf')){if(_0x1c3297[_0x7505('0x10')]===_0x7505('0x11')&&_0x1c3297[_0x7505('0x12')]){_0x34bb7d[_0x7505('0x6')](util[_0x7505('0x13')](_0x7505('0x14'),_0x1c3297['key'],_0x1c3297[_0x7505('0x15')]));}else if(_0x1c3297[_0x7505('0x10')]==='variable'&&_0x1c3297[_0x7505('0x9')]&&_0x1c3297['key']){_0x421be8[_0x1c3297[_0x7505('0x9')]]&&_0x34bb7d[_0x7505('0x6')](util[_0x7505('0x13')](_0x7505('0x14'),_0x1c3297[_0x7505('0x12')],_0x421be8[_0x1c3297[_0x7505('0x9')]]));}else if(_0x1c3297[_0x7505('0x10')]===_0x7505('0xa')&&_0x1c3297[_0x7505('0xb')]&&_0x1c3297[_0x7505('0xb')][_0x7505('0xc')]&&_0x1c3297[_0x7505('0x12')]){_0x421be8[_0x1c3297[_0x7505('0xb')][_0x7505('0xc')][_0x7505('0xd')]()]&&_0x34bb7d[_0x7505('0x6')](util[_0x7505('0x13')]('%s:\x20%s',_0x1c3297[_0x7505('0x12')],_0x421be8[_0x1c3297['Variable']['name'][_0x7505('0xd')]()]));}}}}return _0x34bb7d['join'](_0x516ab4);};exports[_0x7505('0x16')]=function(_0x32b8d3){var _0x164727=_0x32b8d3['slice'](-0x1);if(_0x164727==='/'){_0x32b8d3=_0x32b8d3[_0x7505('0x17')](0x0,_0x32b8d3[_0x7505('0x18')](_0x164727));}return _0x32b8d3;};exports[_0x7505('0x19')]=function(_0x3329ec){if(!_[_0x7505('0x1a')](_0x3329ec)&&_0x3329ec!==''){var _0x4c2250=/^(([^<>()\[\]\\.,;:\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 _0x4c2250[_0x7505('0x1b')](String(_0x3329ec)[_0x7505('0xd')]());}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 9a4bdd2..e71d91f 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x392874,_0x42f2c6){var _0x25fc30=function(_0x4b7a67){while(--_0x4b7a67){_0x392874['push'](_0x392874['shift']());}};_0x25fc30(++_0x42f2c6);}(_0xe706,0xa3));var _0x6e70=function(_0x54b4a8,_0x3abef0){_0x54b4a8=_0x54b4a8-0x0;var _0x4c7a5f=_0xe706[_0x54b4a8];return _0x4c7a5f;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x44a3b0,_0x352810){var _0x39e6f6=function(_0x248002){while(--_0x248002){_0x44a3b0['push'](_0x44a3b0['shift']());}};_0x39e6f6(++_0x352810);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 7e7065c..9933936 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 _0x1652=['forEach','picklist','nameField','customField','toLowerCase','content','string','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','recordingFormat','none','[OUTBOUND]','destcalleridname','integrationTab','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','Fields','Ticket\x20created!','validateEmail','type:user\x20role:agent\x20email:%s','then','count','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','authType','token','toString','base64','debug','stringify','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1652,0x174));var _0x2165=function(_0x110ea8,_0xacb6fa){_0x110ea8=_0x110ea8-0x0;var _0x4073cf=_0x1652[_0x110ea8];return _0x4073cf;};'use strict';var _=require(_0x2165('0x0'));var rp=require(_0x2165('0x1'));var md5=require(_0x2165('0x2'));var util=require(_0x2165('0x3'));var Redis=require(_0x2165('0x4'));var intUtil=require(_0x2165('0x5'));var config=require(_0x2165('0x6'));var logger=require(_0x2165('0x7'))(_0x2165('0x8'));config[_0x2165('0x9')]=_[_0x2165('0xa')](config[_0x2165('0x9')],{'host':_0x2165('0xb'),'port':0x18eb});var io=require(_0x2165('0xc'))(new Redis(config[_0x2165('0x9')]));function emit(_0x38153d,_0x151733,_0x22f17b){io['to'](_0x38153d)['emit'](_0x151733,_0x22f17b);}var headers={'Content-Type':_0x2165('0xd'),'Accept':_0x2165('0xd')};function getTicket(_0x54fb9a,_0x1711cd,_0x2907d8,_0x456cc9,_0x4b4130){logger[_0x2165('0xe')](_0x2165('0xf'));return request({'uri':util[_0x2165('0x10')]('%s/tickets.json',_0x54fb9a[_0x2165('0x11')]),'method':_0x2165('0x12'),'body':{'ticket':_['merge']({'requester_id':_0x2907d8['id'],'submitter_id':_0x1711cd?_0x1711cd['id']:undefined,'assignee_id':_0x1711cd?_0x1711cd['id']:undefined,'tags':getTags(_0x456cc9[_0x2165('0x13')],_0x2165('0x14')),'subject':intUtil[_0x2165('0x15')](_0x456cc9[_0x2165('0x16')],_0x4b4130,'\x20'),'description':intUtil[_0x2165('0x15')](_0x456cc9[_0x2165('0x17')],_0x4b4130,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x456cc9[_0x2165('0x17')],_0x4b4130,'\x0a')}},getCustomFields(_0x456cc9[_0x2165('0x18')],_0x4b4130))}})['then'](function(_0x25b55d){logger['info'](_0x2165('0x19'));return _0x25b55d['ticket'];});}function getUser(_0x4d68a1,_0x5ebdb0){if(intUtil[_0x2165('0x1a')](_0x5ebdb0)){logger[_0x2165('0xe')]('Getting\x20agent\x20with\x20email',_0x5ebdb0);return request({'uri':util[_0x2165('0x10')]('%s/search.json',_0x4d68a1[_0x2165('0x11')]),'qs':{'query':util['format'](_0x2165('0x1b'),_0x5ebdb0)}})[_0x2165('0x1c')](function(_0x26e37b){if(_0x26e37b[_0x2165('0x1d')]){logger[_0x2165('0xe')]('Agent\x20found!');return _[_0x2165('0x1e')](_0x26e37b[_0x2165('0x1f')],{'email':_0x5ebdb0,'role':_0x2165('0x20')});}else{logger[_0x2165('0xe')](_0x2165('0x21'));return request({'uri':util[_0x2165('0x10')]('%s/users/me.json',_0x4d68a1[_0x2165('0x11')])})[_0x2165('0x1c')](function(_0x4bdee0){logger['info'](_0x2165('0x22'));return _0x4bdee0['user'];});}});}else{logger[_0x2165('0xe')](_0x2165('0x21'));return request({'uri':util[_0x2165('0x10')](_0x2165('0x23'),_0x4d68a1[_0x2165('0x11')])})[_0x2165('0x1c')](function(_0x1da019){logger['info'](_0x2165('0x22'));return _0x1da019[_0x2165('0x24')];});}}function getEndUser(_0x40fe26,_0x400333,_0x5146ba){logger['info'](_0x2165('0x25'),_0x5146ba);return request({'uri':util[_0x2165('0x10')]('%s/search.json',_0x40fe26['remoteUri']),'qs':{'query':util[_0x2165('0x10')](_0x2165('0x26'),_0x5146ba)}})['then'](function(_0xdb6f){var _0x4b24c2;if(_0xdb6f[_0x2165('0x1f')][_0x2165('0x27')]){_0xdb6f[_0x2165('0x1f')]=_['filter'](_0xdb6f['results'],{'suspended':![],'role':_0x2165('0x28')});if(_0xdb6f[_0x2165('0x1f')][_0x2165('0x27')]){_0x4b24c2=_[_0x2165('0x29')](_0xdb6f['results']);}}if(_0x4b24c2){logger['info'](_0x2165('0x2a'));return _0x4b24c2;}else{logger['info'](_0x2165('0x2b'));return request({'uri':util[_0x2165('0x10')](_0x2165('0x2c'),_0x40fe26[_0x2165('0x11')]),'method':_0x2165('0x12'),'body':{'user':{'role':_0x2165('0x28'),'name':util[_0x2165('0x10')](_0x2165('0x2d'),_0x400333||_0x5146ba),'phone':_0x5146ba}}})['then'](function(_0x123432){logger[_0x2165('0xe')](_0x2165('0x2e'));return _0x123432[_0x2165('0x24')];});}});}function getAuth(_0x52a477){var _0x2cc950;if(_0x52a477['authType']===_0x2165('0x2f')){_0x2cc950=util[_0x2165('0x10')](_0x2165('0x30'),_0x52a477['username'],_0x52a477[_0x2165('0x2f')]);}else if(_0x52a477[_0x2165('0x31')]===_0x2165('0x32')){_0x2cc950=util[_0x2165('0x10')]('%s/token:%s',_0x52a477['username'],_0x52a477[_0x2165('0x32')]);}return util[_0x2165('0x10')]('Basic\x20%s',new Buffer(_0x2cc950)[_0x2165('0x33')](_0x2165('0x34')));}function request(_0x260c83){logger[_0x2165('0x35')]('[HTTP]',JSON[_0x2165('0x36')](_0x260c83));return rp(_[_0x2165('0xa')](_0x260c83,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x3908dd,_0xe0171b){var _0x9fa8bb=[];if(_0x3908dd&&_0x3908dd[_0x2165('0x27')]>0x0){_0x9fa8bb=_[_0x2165('0x37')](_0x3908dd,_0xe0171b);}return _0x9fa8bb;}function getCustomFields(_0x4cf4dc,_0x3b1876){var _0x498666=[];var _0xef4a44={'custom_fields':[]};if(_0x4cf4dc['length']>0x0){_[_0x2165('0x38')](_0x4cf4dc,function(_0xe1bf7d){if(_['includes'](['string',_0x2165('0x39')],_0xe1bf7d['type'])&&_0xe1bf7d[_0x2165('0x3a')]&&!_0xe1bf7d[_0x2165('0x3b')]){_0xef4a44[_0xe1bf7d[_0x2165('0x3a')][_0x2165('0x3c')]()]=_0xe1bf7d[_0x2165('0x3d')][_0x2165('0x33')]();}else if(_['includes']([_0x2165('0x3e'),'picklist'],_0xe1bf7d[_0x2165('0x3f')])&&_0xe1bf7d[_0x2165('0x40')]&&_0xe1bf7d[_0x2165('0x3b')]){_0xef4a44[_0x2165('0x41')][_0x2165('0x42')]({'id':_0xe1bf7d[_0x2165('0x40')],'value':_0xe1bf7d['content'][_0x2165('0x33')]()});}else if(_0xe1bf7d[_0x2165('0x3f')]===_0x2165('0x43')&&_0xe1bf7d[_0x2165('0x44')]&&_0xe1bf7d[_0x2165('0x40')]&&_0xe1bf7d[_0x2165('0x3b')]){_0x3b1876[_0xe1bf7d[_0x2165('0x44')]]&&_0xef4a44[_0x2165('0x41')][_0x2165('0x42')]({'id':_0xe1bf7d['idField'],'value':_0x3b1876[_0xe1bf7d[_0x2165('0x44')]][_0x2165('0x33')]()});}else if(_0xe1bf7d['type']===_0x2165('0x45')&&_0xe1bf7d['Variable']&&_0xe1bf7d['Variable'][_0x2165('0x14')]&&_0xe1bf7d['idField']&&_0xe1bf7d[_0x2165('0x3b')]){_0x3b1876[_0xe1bf7d[_0x2165('0x46')]['name']['toLowerCase']()]&&_0xef4a44[_0x2165('0x41')][_0x2165('0x42')]({'id':_0xe1bf7d[_0x2165('0x40')],'value':_0x3b1876[_0xe1bf7d[_0x2165('0x46')][_0x2165('0x14')][_0x2165('0x3c')]()][_0x2165('0x33')]()});}});}return _0xef4a44;}exports[_0x2165('0x47')]=function(_0x2fce0a,_0x535656,_0x45e95b,_0x2b4e58,_0x173591,_0x574845){var _0x5c4aa,_0x4b53d5;_0x574845[_0x2165('0x11')]=intUtil['stripTrailingSlash'](_0x574845[_0x2165('0x11')]);_0x574845['serverUrl']=intUtil[_0x2165('0x48')](_0x574845[_0x2165('0x49')]);if(_0x173591&&_0x173591['monitor_format']){logger[_0x2165('0xe')](_0x2165('0x4a'),_0x2165('0x4b'));_0x535656[_0x2165('0x4c')]=util['format'](_0x2165('0x4d'),_0x574845[_0x2165('0x49')],_0x535656[_0x2165('0x4e')],md5(_0x535656[_0x2165('0x4e')]));}else{_0x535656[_0x2165('0x4c')]='';}headers[_0x2165('0x4f')]=getAuth(_0x574845);return getUser(_0x574845,_0x2b4e58['email'])['then'](function(_0x5bd1a3){_0x5c4aa=_0x5bd1a3;logger[_0x2165('0xe')](_0x2165('0x50'),_0x5c4aa['id']);return getEndUser(_0x574845,_0x535656[_0x2165('0x51')],_0x535656['calleridnum']);})[_0x2165('0x1c')](function(_0x1456dc){_0x4b53d5=_0x1456dc;logger[_0x2165('0xe')](_0x2165('0x52'),_0x4b53d5['id']);return getTicket(_0x574845,_0x5c4aa,_0x4b53d5,_0x45e95b,_0x535656);})[_0x2165('0x1c')](function(_0x4a3de2){if(_0x4a3de2){logger[_0x2165('0xe')](_0x2165('0x53'),_0x4a3de2['id']);switch(_0x574845[_0x2165('0x3f')]){case'integrationTab':logger['info'](_0x2165('0x4a'),_0x2165('0x54'));return request({'uri':util['format'](_0x2165('0x55'),_0x574845[_0x2165('0x11')],_0x5c4aa['id'],_0x4a3de2['id']),'method':_0x2165('0x12')});case _0x2165('0x56'):logger['info']('[QUEUE]',_0x2165('0x57'));emit(util['format'](_0x2165('0x58'),_0x2b4e58[_0x2165('0x14')]),_0x2165('0x59'),{'uri':util[_0x2165('0x10')](_0x2165('0x5a'),_0x574845[_0x2165('0x11')][_0x2165('0x5b')](_0x2165('0x5c'),''),_0x4a3de2['id'])});break;default:logger[_0x2165('0x5d')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x2165('0x5e')](function(_0xff47c5){logger[_0x2165('0x5d')](_0x2165('0x5f'),util[_0x2165('0x60')](_0xff47c5,{'showHidden':!![],'depth':null}));});};exports['outbound']=function(_0x294f1f,_0x51ee79,_0xf151a3,_0x2365dd,_0x32ead0,_0x338632,_0x45493c){var _0x580a30,_0x30e070;_0x338632['remoteUri']=intUtil['stripTrailingSlash'](_0x338632[_0x2165('0x11')]);_0x338632[_0x2165('0x49')]=intUtil[_0x2165('0x48')](_0x338632['serverUrl']);if(_0x45493c&&_0x45493c['recordingFormat']&&_0x45493c[_0x2165('0x61')]!==_0x2165('0x62')){logger[_0x2165('0xe')](_0x2165('0x63'),_0x2165('0x4b'));_0x51ee79[_0x2165('0x4c')]=util[_0x2165('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x338632[_0x2165('0x49')],_0x51ee79[_0x2165('0x4e')],md5(_0x51ee79[_0x2165('0x4e')]));}headers[_0x2165('0x4f')]=getAuth(_0x338632);return getUser(_0x338632,_0x2365dd['email'])[_0x2165('0x1c')](function(_0x24ad68){_0x580a30=_0x24ad68;logger['info']('The\x20User\x20ID\x20is:',_0x580a30['id']);return getEndUser(_0x338632,_0x51ee79[_0x2165('0x64')],_0x51ee79['destcalleridnum']);})['then'](function(_0x23ea83){_0x30e070=_0x23ea83;logger[_0x2165('0xe')](_0x2165('0x52'),_0x30e070['id']);return getTicket(_0x338632,_0x580a30,_0x30e070,_0xf151a3,_0x51ee79);})[_0x2165('0x1c')](function(_0x8d1718){if(_0x8d1718){logger[_0x2165('0xe')](_0x2165('0x53'),_0x8d1718['id']);switch(_0x338632[_0x2165('0x3f')]){case _0x2165('0x65'):logger[_0x2165('0xe')](_0x2165('0x63'),_0x2165('0x54'));return request({'uri':util[_0x2165('0x10')](_0x2165('0x55'),_0x338632['remoteUri'],_0x580a30['id'],_0x8d1718['id']),'method':'POST'});case _0x2165('0x56'):logger[_0x2165('0xe')](_0x2165('0x63'),_0x2165('0x57'));emit(util[_0x2165('0x10')]('user:%s',_0x2365dd['name']),_0x2165('0x59'),{'uri':util[_0x2165('0x10')](_0x2165('0x5a'),_0x338632[_0x2165('0x11')][_0x2165('0x5b')](_0x2165('0x5c'),''),_0x8d1718['id'])});break;default:logger['error'](_0x2165('0x63'),_0x2165('0x66'));}}})[_0x2165('0x5e')](function(_0x5945ba){logger[_0x2165('0x5d')](_0x2165('0x67'),util[_0x2165('0x60')](_0x5945ba,{'showHidden':!![],'depth':null}));});};exports[_0x2165('0x68')]=function(_0x5adb69,_0x3a43da,_0xc74eb6,_0x257f75,_0x50ff16,_0x47030e){var _0x56888e,_0x4e4631;_0x47030e[_0x2165('0x11')]=intUtil[_0x2165('0x48')](_0x47030e[_0x2165('0x11')]);_0x47030e['serverUrl']=intUtil[_0x2165('0x48')](_0x47030e[_0x2165('0x49')]);if(_0x50ff16&&_0x50ff16['monitor_format']){logger[_0x2165('0xe')]('['+_0x3a43da[_0x2165('0x69')]['toUpperCase']()+']',_0x2165('0x4b'));_0x3a43da[_0x2165('0x4c')]=util[_0x2165('0x10')](_0x2165('0x4d'),_0x47030e[_0x2165('0x49')],_0x3a43da[_0x2165('0x4e')],md5(_0x3a43da[_0x2165('0x4e')]));}else{_0x3a43da['recordingURL']='';}headers[_0x2165('0x4f')]=getAuth(_0x47030e);return getUser(_0x47030e)[_0x2165('0x1c')](function(_0x57efab){_0x56888e=_0x57efab;logger[_0x2165('0xe')]('The\x20User\x20ID\x20is:',_0x56888e['id']);return getEndUser(_0x47030e,_0x3a43da[_0x2165('0x51')],_0x3a43da['calleridnum']);})[_0x2165('0x1c')](function(_0x20a1ff){_0x4e4631=_0x20a1ff;logger[_0x2165('0xe')](_0x2165('0x52'),_0x4e4631['id']);return getTicket(_0x47030e,_0x56888e,_0x4e4631,_0xc74eb6,_0x3a43da);})[_0x2165('0x1c')](function(_0xa17016){if(_0xa17016){logger[_0x2165('0xe')](_0x2165('0x53'),_0xa17016['id']);}})[_0x2165('0x5e')](function(_0xfc4f3f){logger[_0x2165('0x5d')]('['+_0x3a43da['lastevent']['toUpperCase']()+']'+_0x2165('0x6a'),util[_0x2165('0x60')](_0xfc4f3f,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9fb7=['info','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','%s/users.json','Caller\x20-\x20%s','password','%s:%s','username','authType','token','%s/token:%s','toString','[HTTP]','GET','map','forEach','includes','string','picklist','type','nameField','toLowerCase','content','customField','custom_fields','idField','variable','variableName','push','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Authorization','email','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','trigger:browser:url','/api/v2','catch','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','./util','../../../../config/environment','zendesk','defaults','redis','emit','application/json'];(function(_0x2beb41,_0x38b319){var _0x87c8c8=function(_0x3e4b66){while(--_0x3e4b66){_0x2beb41['push'](_0x2beb41['shift']());}};_0x87c8c8(++_0x38b319);}(_0x9fb7,0x65));var _0x79fb=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x9fb7[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require(_0x79fb('0x0'));var rp=require(_0x79fb('0x1'));var md5=require(_0x79fb('0x2'));var util=require(_0x79fb('0x3'));var Redis=require('ioredis');var intUtil=require(_0x79fb('0x4'));var config=require(_0x79fb('0x5'));var logger=require('../../../../config/logger')(_0x79fb('0x6'));config['redis']=_[_0x79fb('0x7')](config[_0x79fb('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x79fb('0x8')]));function emit(_0x2de202,_0x207bad,_0x327ed0){io['to'](_0x2de202)[_0x79fb('0x9')](_0x207bad,_0x327ed0);}var headers={'Content-Type':_0x79fb('0xa'),'Accept':_0x79fb('0xa')};function getTicket(_0x52f209,_0x4060aa,_0x2b20ac,_0x126b1d,_0x54a39b){logger[_0x79fb('0xb')](_0x79fb('0xc'));return request({'uri':util[_0x79fb('0xd')](_0x79fb('0xe'),_0x52f209[_0x79fb('0xf')]),'method':_0x79fb('0x10'),'body':{'ticket':_[_0x79fb('0x11')]({'requester_id':_0x2b20ac['id'],'submitter_id':_0x4060aa?_0x4060aa['id']:undefined,'assignee_id':_0x4060aa?_0x4060aa['id']:undefined,'tags':getTags(_0x126b1d[_0x79fb('0x12')],_0x79fb('0x13')),'subject':intUtil['getString'](_0x126b1d[_0x79fb('0x14')],_0x54a39b,'\x20'),'description':intUtil[_0x79fb('0x15')](_0x126b1d[_0x79fb('0x16')],_0x54a39b,'\x0a'),'comment':{'public':![],'body':intUtil[_0x79fb('0x15')](_0x126b1d[_0x79fb('0x16')],_0x54a39b,'\x0a')}},getCustomFields(_0x126b1d[_0x79fb('0x17')],_0x54a39b))}})[_0x79fb('0x18')](function(_0x338b03){logger[_0x79fb('0xb')](_0x79fb('0x19'));return _0x338b03[_0x79fb('0x1a')];});}function getUser(_0x15f98c,_0x2e8c1c){if(intUtil[_0x79fb('0x1b')](_0x2e8c1c)){logger['info'](_0x79fb('0x1c'),_0x2e8c1c);return request({'uri':util['format'](_0x79fb('0x1d'),_0x15f98c['remoteUri']),'qs':{'query':util[_0x79fb('0xd')](_0x79fb('0x1e'),_0x2e8c1c)}})['then'](function(_0x3c08a9){if(_0x3c08a9['count']){logger[_0x79fb('0xb')](_0x79fb('0x1f'));return _[_0x79fb('0x20')](_0x3c08a9[_0x79fb('0x21')],{'email':_0x2e8c1c,'role':_0x79fb('0x22')});}else{logger[_0x79fb('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x79fb('0xd')](_0x79fb('0x23'),_0x15f98c['remoteUri'])})[_0x79fb('0x18')](function(_0x29c3fe){logger['info'](_0x79fb('0x24'));return _0x29c3fe[_0x79fb('0x25')];});}});}else{logger[_0x79fb('0xb')](_0x79fb('0x26'));return request({'uri':util['format'](_0x79fb('0x23'),_0x15f98c[_0x79fb('0xf')])})[_0x79fb('0x18')](function(_0x313f57){logger['info']('Admin\x20account\x20selected.');return _0x313f57['user'];});}}function getEndUser(_0x546001,_0x169f6a,_0x531a2f){logger[_0x79fb('0xb')]('Searching\x20enduser\x20with\x20phone',_0x531a2f);return request({'uri':util[_0x79fb('0xd')](_0x79fb('0x1d'),_0x546001['remoteUri']),'qs':{'query':util[_0x79fb('0xd')](_0x79fb('0x27'),_0x531a2f)}})[_0x79fb('0x18')](function(_0x34cd34){var _0x59fa11;if(_0x34cd34[_0x79fb('0x21')][_0x79fb('0x28')]){_0x34cd34['results']=_[_0x79fb('0x29')](_0x34cd34[_0x79fb('0x21')],{'suspended':![],'role':_0x79fb('0x2a')});if(_0x34cd34[_0x79fb('0x21')]['length']){_0x59fa11=_['first'](_0x34cd34[_0x79fb('0x21')]);}}if(_0x59fa11){logger[_0x79fb('0xb')]('Enduser\x20found!');return _0x59fa11;}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x79fb('0xd')](_0x79fb('0x2b'),_0x546001[_0x79fb('0xf')]),'method':'POST','body':{'user':{'role':_0x79fb('0x2a'),'name':util['format'](_0x79fb('0x2c'),_0x169f6a||_0x531a2f),'phone':_0x531a2f}}})['then'](function(_0x265339){logger[_0x79fb('0xb')]('Enduser\x20created.');return _0x265339[_0x79fb('0x25')];});}});}function getAuth(_0x10f3db){var _0xb5a3eb;if(_0x10f3db['authType']===_0x79fb('0x2d')){_0xb5a3eb=util[_0x79fb('0xd')](_0x79fb('0x2e'),_0x10f3db[_0x79fb('0x2f')],_0x10f3db[_0x79fb('0x2d')]);}else if(_0x10f3db[_0x79fb('0x30')]===_0x79fb('0x31')){_0xb5a3eb=util[_0x79fb('0xd')](_0x79fb('0x32'),_0x10f3db[_0x79fb('0x2f')],_0x10f3db[_0x79fb('0x31')]);}return util[_0x79fb('0xd')]('Basic\x20%s',new Buffer(_0xb5a3eb)[_0x79fb('0x33')]('base64'));}function request(_0x26d68a){logger['debug'](_0x79fb('0x34'),JSON['stringify'](_0x26d68a));return rp(_[_0x79fb('0x7')](_0x26d68a,{'method':_0x79fb('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x47b7af,_0x2fc7db){var _0x2391dc=[];if(_0x47b7af&&_0x47b7af[_0x79fb('0x28')]>0x0){_0x2391dc=_[_0x79fb('0x36')](_0x47b7af,_0x2fc7db);}return _0x2391dc;}function getCustomFields(_0xe51ad2,_0x46431f){var _0x338528=[];var _0x47c565={'custom_fields':[]};if(_0xe51ad2[_0x79fb('0x28')]>0x0){_[_0x79fb('0x37')](_0xe51ad2,function(_0x1d5250){if(_[_0x79fb('0x38')]([_0x79fb('0x39'),_0x79fb('0x3a')],_0x1d5250[_0x79fb('0x3b')])&&_0x1d5250[_0x79fb('0x3c')]&&!_0x1d5250['customField']){_0x47c565[_0x1d5250[_0x79fb('0x3c')][_0x79fb('0x3d')]()]=_0x1d5250[_0x79fb('0x3e')][_0x79fb('0x33')]();}else if(_[_0x79fb('0x38')](['string','picklist'],_0x1d5250[_0x79fb('0x3b')])&&_0x1d5250['idField']&&_0x1d5250[_0x79fb('0x3f')]){_0x47c565[_0x79fb('0x40')]['push']({'id':_0x1d5250[_0x79fb('0x41')],'value':_0x1d5250[_0x79fb('0x3e')][_0x79fb('0x33')]()});}else if(_0x1d5250['type']===_0x79fb('0x42')&&_0x1d5250[_0x79fb('0x43')]&&_0x1d5250[_0x79fb('0x41')]&&_0x1d5250[_0x79fb('0x3f')]){_0x46431f[_0x1d5250[_0x79fb('0x43')]]&&_0x47c565[_0x79fb('0x40')][_0x79fb('0x44')]({'id':_0x1d5250[_0x79fb('0x41')],'value':_0x46431f[_0x1d5250[_0x79fb('0x43')]][_0x79fb('0x33')]()});}else if(_0x1d5250['type']==='customVariable'&&_0x1d5250['Variable']&&_0x1d5250[_0x79fb('0x45')]['name']&&_0x1d5250['idField']&&_0x1d5250[_0x79fb('0x3f')]){_0x46431f[_0x1d5250['Variable'][_0x79fb('0x13')]['toLowerCase']()]&&_0x47c565[_0x79fb('0x40')][_0x79fb('0x44')]({'id':_0x1d5250[_0x79fb('0x41')],'value':_0x46431f[_0x1d5250['Variable'][_0x79fb('0x13')]['toLowerCase']()][_0x79fb('0x33')]()});}});}return _0x47c565;}exports[_0x79fb('0x46')]=function(_0x1c8e82,_0x4fa7bc,_0xd91bb1,_0x28a3f4,_0x3f3c79,_0x57e0c3){var _0xb931d8,_0x4ac103;_0x57e0c3[_0x79fb('0xf')]=intUtil[_0x79fb('0x47')](_0x57e0c3[_0x79fb('0xf')]);_0x57e0c3[_0x79fb('0x48')]=intUtil['stripTrailingSlash'](_0x57e0c3[_0x79fb('0x48')]);if(_0x3f3c79&&_0x3f3c79[_0x79fb('0x49')]){logger[_0x79fb('0xb')](_0x79fb('0x4a'),_0x79fb('0x4b'));_0x4fa7bc[_0x79fb('0x4c')]=util[_0x79fb('0xd')](_0x79fb('0x4d'),_0x57e0c3['serverUrl'],_0x4fa7bc[_0x79fb('0x4e')],md5(_0x4fa7bc[_0x79fb('0x4e')]));}else{_0x4fa7bc[_0x79fb('0x4c')]='';}headers['Authorization']=getAuth(_0x57e0c3);return getUser(_0x57e0c3,_0x28a3f4['email'])['then'](function(_0x1dfba3){_0xb931d8=_0x1dfba3;logger[_0x79fb('0xb')](_0x79fb('0x4f'),_0xb931d8['id']);return getEndUser(_0x57e0c3,_0x4fa7bc[_0x79fb('0x50')],_0x4fa7bc[_0x79fb('0x51')]);})[_0x79fb('0x18')](function(_0x2ac4f9){_0x4ac103=_0x2ac4f9;logger[_0x79fb('0xb')](_0x79fb('0x52'),_0x4ac103['id']);return getTicket(_0x57e0c3,_0xb931d8,_0x4ac103,_0xd91bb1,_0x4fa7bc);})[_0x79fb('0x18')](function(_0x4a2472){if(_0x4a2472){logger['info'](_0x79fb('0x53'),_0x4a2472['id']);switch(_0x57e0c3['type']){case _0x79fb('0x54'):logger[_0x79fb('0xb')](_0x79fb('0x4a'),_0x79fb('0x55'));return request({'uri':util[_0x79fb('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x57e0c3[_0x79fb('0xf')],_0xb931d8['id'],_0x4a2472['id']),'method':_0x79fb('0x10')});case _0x79fb('0x56'):logger[_0x79fb('0xb')]('[QUEUE]',_0x79fb('0x57'));emit(util[_0x79fb('0xd')]('user:%s',_0x28a3f4[_0x79fb('0x13')]),'trigger:browser:url',{'uri':util[_0x79fb('0xd')](_0x79fb('0x58'),_0x57e0c3[_0x79fb('0xf')][_0x79fb('0x59')]('/api/v2',''),_0x4a2472['id'])});break;default:logger[_0x79fb('0x5a')](_0x79fb('0x4a'),_0x79fb('0x5b'));}}})['catch'](function(_0xcd7e42){logger['error'](_0x79fb('0x5c'),util[_0x79fb('0x5d')](_0xcd7e42,{'showHidden':!![],'depth':null}));});};exports[_0x79fb('0x5e')]=function(_0x27aeea,_0x3d1f23,_0x499181,_0x50fb5d,_0x25a456,_0xb17460,_0x413b8a){var _0x1931e8,_0x2e2f58;_0xb17460[_0x79fb('0xf')]=intUtil['stripTrailingSlash'](_0xb17460[_0x79fb('0xf')]);_0xb17460[_0x79fb('0x48')]=intUtil[_0x79fb('0x47')](_0xb17460[_0x79fb('0x48')]);if(_0x413b8a&&_0x413b8a[_0x79fb('0x5f')]&&_0x413b8a[_0x79fb('0x5f')]!==_0x79fb('0x60')){logger[_0x79fb('0xb')]('[OUTBOUND]',_0x79fb('0x4b'));_0x3d1f23[_0x79fb('0x4c')]=util[_0x79fb('0xd')](_0x79fb('0x4d'),_0xb17460[_0x79fb('0x48')],_0x3d1f23['uniqueid'],md5(_0x3d1f23[_0x79fb('0x4e')]));}headers[_0x79fb('0x61')]=getAuth(_0xb17460);return getUser(_0xb17460,_0x50fb5d[_0x79fb('0x62')])[_0x79fb('0x18')](function(_0x4ab55e){_0x1931e8=_0x4ab55e;logger['info'](_0x79fb('0x4f'),_0x1931e8['id']);return getEndUser(_0xb17460,_0x3d1f23[_0x79fb('0x63')],_0x3d1f23[_0x79fb('0x64')]);})['then'](function(_0x21a827){_0x2e2f58=_0x21a827;logger['info'](_0x79fb('0x52'),_0x2e2f58['id']);return getTicket(_0xb17460,_0x1931e8,_0x2e2f58,_0x499181,_0x3d1f23);})[_0x79fb('0x18')](function(_0x17550d){if(_0x17550d){logger[_0x79fb('0xb')](_0x79fb('0x53'),_0x17550d['id']);switch(_0xb17460[_0x79fb('0x3b')]){case _0x79fb('0x54'):logger['info'](_0x79fb('0x65'),_0x79fb('0x55'));return request({'uri':util['format'](_0x79fb('0x66'),_0xb17460['remoteUri'],_0x1931e8['id'],_0x17550d['id']),'method':'POST'});case _0x79fb('0x56'):logger[_0x79fb('0xb')](_0x79fb('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x79fb('0xd')](_0x79fb('0x67'),_0x50fb5d[_0x79fb('0x13')]),_0x79fb('0x68'),{'uri':util[_0x79fb('0xd')]('%s/agent/tickets/%s',_0xb17460[_0x79fb('0xf')][_0x79fb('0x59')](_0x79fb('0x69'),''),_0x17550d['id'])});break;default:logger[_0x79fb('0x5a')](_0x79fb('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x79fb('0x6a')](function(_0x5c2639){logger[_0x79fb('0x5a')](_0x79fb('0x6b'),util[_0x79fb('0x5d')](_0x5c2639,{'showHidden':!![],'depth':null}));});};exports[_0x79fb('0x6c')]=function(_0x2ff2ad,_0x173465,_0x5500ac,_0x12918a,_0x557318,_0x272707){var _0x5646bb,_0x13d7e0;_0x272707['remoteUri']=intUtil[_0x79fb('0x47')](_0x272707['remoteUri']);_0x272707[_0x79fb('0x48')]=intUtil['stripTrailingSlash'](_0x272707['serverUrl']);if(_0x557318&&_0x557318[_0x79fb('0x49')]){logger['info']('['+_0x173465[_0x79fb('0x6d')][_0x79fb('0x6e')]()+']','Recording\x20is\x20enabled!');_0x173465['recordingURL']=util[_0x79fb('0xd')](_0x79fb('0x4d'),_0x272707[_0x79fb('0x48')],_0x173465[_0x79fb('0x4e')],md5(_0x173465[_0x79fb('0x4e')]));}else{_0x173465[_0x79fb('0x4c')]='';}headers[_0x79fb('0x61')]=getAuth(_0x272707);return getUser(_0x272707)[_0x79fb('0x18')](function(_0x273303){_0x5646bb=_0x273303;logger['info'](_0x79fb('0x4f'),_0x5646bb['id']);return getEndUser(_0x272707,_0x173465['calleridname'],_0x173465[_0x79fb('0x51')]);})['then'](function(_0x20eb0){_0x13d7e0=_0x20eb0;logger[_0x79fb('0xb')]('The\x20Enduser\x20ID\x20is:',_0x13d7e0['id']);return getTicket(_0x272707,_0x5646bb,_0x13d7e0,_0x5500ac,_0x173465);})[_0x79fb('0x18')](function(_0x25b873){if(_0x25b873){logger[_0x79fb('0xb')](_0x79fb('0x53'),_0x25b873['id']);}})[_0x79fb('0x6a')](function(_0x20198e){logger[_0x79fb('0x5a')]('['+_0x173465[_0x79fb('0x6d')][_0x79fb('0x6e')]()+']'+_0x79fb('0x6f'),util[_0x79fb('0x5d')](_0x20198e,{'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 cdd105f..5c66451 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 _0xbfc9=['Descriptions','Who_Id','Full_Name','First_Name','Last_Name','$se_module','talktime','utc','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','Call_Type','Inbound','Fields','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','lodash','request-promise','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','emit','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','https://accounts.zoho.eu','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','access_token','add','seconds','catch','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','error','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','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','Owner','administrator','Subject','getString','Subjects','Description'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xbfc9,0x173));var _0x9bfc=function(_0x40e21d,_0xe32def){_0x40e21d=_0x40e21d-0x0;var _0x30f13e=_0xbfc9[_0x40e21d];return _0x30f13e;};'use strict';var _=require(_0x9bfc('0x0'));var rp=require(_0x9bfc('0x1'));var md5=require('md5');var util=require(_0x9bfc('0x2'));var intUtil=require('./util');var moment=require(_0x9bfc('0x3'));var Redis=require('ioredis');var BPromise=require(_0x9bfc('0x4'));var config=require(_0x9bfc('0x5'));var logger=require(_0x9bfc('0x6'))(_0x9bfc('0x7'));config['redis']=_[_0x9bfc('0x8')](config[_0x9bfc('0x9')],{'host':_0x9bfc('0xa'),'port':0x18eb});var io=require(_0x9bfc('0xb'))(new Redis(config[_0x9bfc('0x9')]));function emit(_0x1a4789,_0x384dde,_0x3bbab4){io['to'](_0x1a4789)[_0x9bfc('0xc')](_0x384dde,_0x3bbab4);}function request(_0x82092){logger['debug'](_0x9bfc('0xd'),JSON[_0x9bfc('0xe')](_0x82092));return rp(_0x82092);}function getCustomFields(_0xbe23b4,_0x2b7333){var _0x1d9506={};if(_0xbe23b4[_0x9bfc('0xf')]>0x0){_['forEach'](_0xbe23b4,function(_0x32f083){if(_[_0x9bfc('0x10')]([_0x9bfc('0x11'),_0x9bfc('0x12')],_0x32f083[_0x9bfc('0x13')])&&_0x32f083[_0x9bfc('0x14')]){_0x1d9506[_0x32f083[_0x9bfc('0x14')]]=_0x32f083[_0x9bfc('0x15')][_0x9bfc('0x16')]();}else if(_0x32f083[_0x9bfc('0x13')]===_0x9bfc('0x17')&&_0x32f083['variableName']&&_0x32f083[_0x9bfc('0x14')]&&_0x2b7333[_0x32f083[_0x9bfc('0x18')]]){_0x1d9506[_0x32f083[_0x9bfc('0x14')]]=_0x2b7333[_0x32f083[_0x9bfc('0x18')]][_0x9bfc('0x16')]();}else if(_0x32f083[_0x9bfc('0x13')]===_0x9bfc('0x19')&&_0x32f083[_0x9bfc('0x1a')]&&_0x32f083['Variable'][_0x9bfc('0x1b')]&&_0x32f083[_0x9bfc('0x14')]&&_0x2b7333[_0x32f083[_0x9bfc('0x1a')]['name']['toLowerCase']()]){_0x1d9506[_0x32f083[_0x9bfc('0x14')]]=_0x2b7333[_0x32f083[_0x9bfc('0x1a')]['name'][_0x9bfc('0x1c')]()][_0x9bfc('0x16')]();}});}return _0x1d9506;}function getName(_0x32a350){if(_0x32a350[_0x9bfc('0x1d')]('\x20')>0x0){var _0xb771f3=_0x32a350[_0x9bfc('0x1e')](/ (.+)/);if(_0xb771f3[0x1]){return _0xb771f3;}}return[_0x32a350,_0x32a350];}var accountsTokens={};function getAccessToken(_0x3e1b4e){return new Promise(function(_0x32126d,_0x564633){if(!_['isNil'](accountsTokens[_0x3e1b4e['id']])&&!_[_0x9bfc('0x1f')](accountsTokens[_0x3e1b4e['id']]['access_token'])){if(moment()[_0x9bfc('0x20')](accountsTokens[_0x3e1b4e['id']][_0x9bfc('0x21')])){_0x32126d(accountsTokens[_0x3e1b4e['id']]['access_token']);}}var _0x181579;switch(_0x3e1b4e['zone']){case'US':_0x181579='https://accounts.zoho.com';break;case'AU':_0x181579='https://accounts.zoho.com.au';break;case'EU':_0x181579=_0x9bfc('0x22');break;case'IN':_0x181579='https://accounts.zoho.in';break;case'CN':_0x181579=_0x9bfc('0x23');break;default:_0x181579=_0x9bfc('0x22');break;}var _0x399a00={'method':'POST','uri':_0x181579+_0x9bfc('0x24'),'qs':{'refresh_token':_0x3e1b4e[_0x9bfc('0x25')],'client_id':_0x3e1b4e[_0x9bfc('0x26')],'client_secret':_0x3e1b4e[_0x9bfc('0x27')],'grant_type':_0x9bfc('0x28')},'json':!![]};return rp(_0x399a00)[_0x9bfc('0x29')](function(_0x32c09f){accountsTokens[_0x3e1b4e['id']]={'access_token':_0x32c09f[_0x9bfc('0x2a')],'expires_in':moment()[_0x9bfc('0x2b')](_0x32c09f[_0x9bfc('0x21')],_0x9bfc('0x2c'))};_0x32126d(_0x32c09f[_0x9bfc('0x2a')]);})[_0x9bfc('0x2d')](function(_0x28d823){logger['error'](_0x9bfc('0x2e'),_0x28d823[_0x9bfc('0x2f')]);_0x564633(_0x28d823);});});}function getUser(_0x295e69,_0x4b3b59,_0x35c7df,_0x2a346c){logger[_0x9bfc('0x30')](_0x9bfc('0x31'));return request({'method':_0x9bfc('0x32'),'uri':util[_0x9bfc('0x33')](_0x9bfc('0x34'),_0x4b3b59),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0x9bfc('0x35')+_0x295e69},'json':!![]})[_0x9bfc('0x29')](function(_0x5ad984){if(_0x5ad984[_0x9bfc('0x36')]){var _0x5ea0b5=-0x1;if(_[_0x9bfc('0x37')](_0x5ad984['users'])){if(!_[_0x9bfc('0x1f')](_0x2a346c)){_0x5ea0b5=_['findIndex'](_0x5ad984[_0x9bfc('0x36')],function(_0x4f2ec3){return _0x4f2ec3[_0x9bfc('0x38')]===_0x2a346c;});}if(_0x5ea0b5>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x9bfc('0x30')](_0x9bfc('0x39'));_0x5ea0b5=_[_0x9bfc('0x3a')](_0x5ad984['users'],function(_0xc353f9){return _0xc353f9[_0x9bfc('0x3b')][_0x9bfc('0x1b')]===_0x9bfc('0x3c');});}return _0x5ad984['users'][_0x5ea0b5];}else{if(_0x5ad984['user'][_0x9bfc('0x3b')]['name']===_0x9bfc('0x3c')){logger[_0x9bfc('0x30')](_0x9bfc('0x39'));user=_0x5ad984['user'];return user;}else{logger[_0x9bfc('0x3d')](_0x9bfc('0x3e'),JSON[_0x9bfc('0xe')](_0x5ad984));throw new Error(_0x9bfc('0x3f')+JSON[_0x9bfc('0xe')](_0x5ad984));}}}else{logger[_0x9bfc('0x3d')]('The\x20failing\x20result\x20is',JSON[_0x9bfc('0xe')](_0x5ad984));throw new Error(_0x9bfc('0x3f')+JSON['stringify'](_0x5ad984));}})[_0x9bfc('0x2d')](function(_0x5513b7){console[_0x9bfc('0x3d')](_0x5513b7);});}function getZohoUser(_0x5645fe,_0x17b5e4){return new BPromise(function(_0x31e8db,_0x2cd575){request(_0x5645fe)[_0x9bfc('0x29')](function(_0x5cc9b6){var _0x1759f5=null;if(_0x5cc9b6){_0x1759f5=_0x5cc9b6[_0x9bfc('0x40')][0x0];_0x1759f5[_0x9bfc('0x41')]=_0x17b5e4;}_0x31e8db(_0x1759f5);})['catch'](function(_0x310053){_0x2cd575(_0x310053);});});}function createEndUser(_0x33923e,_0xcd2afd,_0x20e583,_0x2b7791,_0x1e31b0,_0x1e3dd4){var _0x20e583=getName(_0x20e583);return request({'method':_0x9bfc('0x42'),'uri':_0x9bfc('0x43')+_0xcd2afd+'/crm/v2/'+_[_0x9bfc('0x44')](_0x1e3dd4[_0x9bfc('0x45')])+'s','body':{'data':[{'Last_Name':_0x20e583[0x1],'First_Name':_0x20e583[0x0],'Phone':_0x2b7791,'Owner':{'name':!_[_0x9bfc('0x1f')](_0x1e31b0[_0x9bfc('0x46')][_0x9bfc('0x1b')])?_0x1e31b0[_0x9bfc('0x46')]['name']:!_[_0x9bfc('0x1f')](_0x1e31b0[_0x9bfc('0x47')])?_0x1e31b0[_0x9bfc('0x47')]+'\x20'+_0x1e31b0[_0x9bfc('0x48')]:_0x1e31b0[_0x9bfc('0x48')],'id':_0x1e31b0['id']}}]},'headers':{'Authorization':_0x9bfc('0x35')+_0x33923e},'json':!![]})['then'](function(_0x56f876){if(_0x56f876&&_0x56f876[_0x9bfc('0x40')][0x0][_0x9bfc('0x49')]===_0x9bfc('0x4a')){var _0x30562e=_0x56f876[_0x9bfc('0x40')][0x0]['details'];_0x30562e[_0x9bfc('0x41')]=_[_0x9bfc('0x44')](_0x1e3dd4[_0x9bfc('0x45')])+'s';return _0x30562e;}logger[_0x9bfc('0x3d')](_0x9bfc('0x3e'),JSON[_0x9bfc('0xe')](data));throw new Error(_0x9bfc('0x4b')+JSON[_0x9bfc('0xe')](data));})[_0x9bfc('0x2d')](function(_0x591598){console[_0x9bfc('0x4c')](_0x9bfc('0x4d'),_0x591598);});}function getEndUser(_0x5a4b7e,_0x567580,_0xf55e08,_0x5b8eab,_0x4d833b,_0x4d6aed,_0x2b38d0){var _0x3187a6={'method':_0x9bfc('0x32'),'uri':'','headers':{'Authorization':_0x9bfc('0x35')+_0x5a4b7e},'json':!![]};switch(_0x2b38d0[_0x9bfc('0x4e')]){case _0x9bfc('0x4f'):_0x3187a6[_0x9bfc('0x50')]=_0x9bfc('0x43')+_0x567580+_0x9bfc('0x51')+_0x4d833b+'))';return getZohoUser(_0x3187a6,_0x9bfc('0x52'))[_0x9bfc('0x29')](function(_0x499915){if(_0x499915)return _0x499915;_0x3187a6[_0x9bfc('0x50')]=_0x9bfc('0x43')+_0x567580+_0x9bfc('0x53')+_0x4d833b+'))';return getZohoUser(_0x3187a6,_0x9bfc('0x54'))['then'](function(_0x378335){if(_0x378335)return _0x378335;if(_0x2b38d0[_0x9bfc('0x45')]!=_0x9bfc('0x55')){return createEndUser(_0x5a4b7e,_0x567580,_0x5b8eab,_0x4d833b,_0x4d6aed,_0x2b38d0);}else{return{};}});});break;case _0x9bfc('0x56'):_0x3187a6[_0x9bfc('0x50')]=_0x9bfc('0x43')+_0x567580+_0x9bfc('0x51')+_0x4d833b+'))';return getZohoUser(_0x3187a6,_0x9bfc('0x52'))[_0x9bfc('0x29')](function(_0x16a5e4){if(_0x16a5e4)return _0x16a5e4;if(_0x2b38d0[_0x9bfc('0x45')]!=_0x9bfc('0x55')){return createEndUser(_0x5a4b7e,_0x567580,_0x5b8eab,_0x4d833b,_0x4d6aed,_0x2b38d0);}else{return{};}});break;case _0x9bfc('0x57'):_0x3187a6[_0x9bfc('0x50')]='https://www.zohoapis.'+_0x567580+_0x9bfc('0x53')+_0x4d833b+'))';return getZohoUser(_0x3187a6,_0x9bfc('0x54'))['then'](function(_0x57c538){if(_0x57c538)return _0x57c538;if(_0x2b38d0[_0x9bfc('0x45')]!='nothing'){return createEndUser(_0x5a4b7e,_0x567580,_0x5b8eab,_0x4d833b,_0x4d6aed,_0x2b38d0);}else{return{};}});break;}}function getCall(_0x485821,_0x248095,_0x310440,_0x537cb9,_0x251323,_0x349997,_0x1feb2c,_0x5271a9){logger['info']('Creating\x20new\x20call...');var _0xf36f24={};_0xf36f24[_0x9bfc('0x58')]={'name':!_['isNil'](_0x537cb9['role'][_0x9bfc('0x1b')])&&!_[_0x9bfc('0x1f')](_0x537cb9[_0x9bfc('0x3b')][_0x9bfc('0x1b')])&&_0x537cb9[_0x9bfc('0x3b')][_0x9bfc('0x1b')]===_0x9bfc('0x59')?_0x537cb9[_0x9bfc('0x46')][_0x9bfc('0x1b')]:!_[_0x9bfc('0x1f')](_0x537cb9[_0x9bfc('0x47')])?_0x537cb9['first_name']+'\x20'+_0x537cb9[_0x9bfc('0x48')]:_0x537cb9[_0x9bfc('0x48')],'id':_0x537cb9['id']};_0xf36f24[_0x9bfc('0x5a')]=intUtil[_0x9bfc('0x5b')](_0x349997[_0x9bfc('0x5c')],_0x1feb2c,'\x20');_0xf36f24[_0x9bfc('0x5d')]=intUtil[_0x9bfc('0x5b')](_0x349997[_0x9bfc('0x5e')],_0x1feb2c,'\x0a');if(_0x251323[_0x9bfc('0x41')]===_0x9bfc('0x52')){_0xf36f24[_0x9bfc('0x5f')]={'name':!_[_0x9bfc('0x1f')](_0x251323[_0x9bfc('0x60')])?_0x251323[_0x9bfc('0x60')]:!_[_0x9bfc('0x1f')](_0x251323[_0x9bfc('0x61')])?_0x251323[_0x9bfc('0x61')]+'\x20'+_0x251323[_0x9bfc('0x62')]:_0x251323[_0x9bfc('0x62')],'id':_0x251323['id']};}if(_0x251323[_0x9bfc('0x41')]==='Leads'){_0xf36f24['What_Id']={'name':!_['isNil'](_0x251323[_0x9bfc('0x60')])?_0x251323[_0x9bfc('0x60')]:!_['isNil'](_0x251323[_0x9bfc('0x61')])?_0x251323[_0x9bfc('0x61')]+'\x20'+_0x251323[_0x9bfc('0x62')]:_0x251323[_0x9bfc('0x62')],'id':_0x251323['id']};_0xf36f24[_0x9bfc('0x63')]=_['startCase'](_0x251323[_0x9bfc('0x41')]);}if(_0x1feb2c[_0x9bfc('0x64')]){_0xf36f24['Call_Duration']=moment[_0x9bfc('0x65')](parseInt(_0x1feb2c[_0x9bfc('0x64')])*0x3e8)[_0x9bfc('0x33')](_0x9bfc('0x66'));}else if(_0x1feb2c['answertime']&&_0x1feb2c[_0x9bfc('0x67')]){_0xf36f24['Call_Duration']=moment[_0x9bfc('0x65')](moment(_0x1feb2c['endtime'],_0x9bfc('0x68'))[_0x9bfc('0x69')](moment(_0x1feb2c['starttime'],_0x9bfc('0x68'))))['format']('mm:ss');}switch(_0x1feb2c[_0x9bfc('0x6a')]){case'called':_0xf36f24['Call_Result']=_0x9bfc('0x6b');break;case _0x9bfc('0x6c'):case _0x9bfc('0x6d'):_0xf36f24['Call_Result']=_0x9bfc('0x6e');break;case _0x9bfc('0x6f'):_0xf36f24['Call_Result']=_0x9bfc('0x70');break;case _0x9bfc('0x71'):_0xf36f24['Call_Result']=_0x9bfc('0x72');break;case _0x9bfc('0x73'):_0xf36f24['Call_Result']=_0x9bfc('0x74');default:}_0xf36f24[_0x9bfc('0x75')]=(_0x5271a9===_0x9bfc('0x76')?moment(_0x1feb2c[_0x9bfc('0x77')])[_0x9bfc('0x33')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x1feb2c['agentcalledAt'])[_0x9bfc('0x33')](_0x9bfc('0x68')))||moment()[_0x9bfc('0x33')](_0x9bfc('0x68'));_0xf36f24[_0x9bfc('0x78')]=_0x5271a9||_0x9bfc('0x79');_0xf36f24=_['merge'](_0xf36f24,getCustomFields(_0x349997[_0x9bfc('0x7a')],_0x1feb2c));return request({'method':_0x9bfc('0x42'),'uri':_0x9bfc('0x43')+_0x248095+'/crm/v2/Calls','headers':{'Authorization':_0x9bfc('0x35')+_0x485821},'body':{'data':[_0xf36f24]},'json':!![]})['then'](function(_0x4d6725){if(_0x4d6725&&_0x4d6725[_0x9bfc('0x40')][0x0]['code']==='SUCCESS'){logger[_0x9bfc('0x30')](_0x9bfc('0x7b'));return{'id':_0x4d6725[_0x9bfc('0x40')][0x0][_0x9bfc('0x7c')]['id']};}})[_0x9bfc('0x2d')](function(_0x4f4962){logger[_0x9bfc('0x30')]('err',_0x4f4962[_0x9bfc('0x2f')]);console['log'](_0x9bfc('0x7d'),_0x4f4962);});}exports['queue']=function(_0x25d31b,_0x3b0822,_0x22dd8d,_0x272fe9,_0x5278da,_0x2f561a){var _0x9bc00f,_0x4e1436,_0x41440f;_0x2f561a[_0x9bfc('0x7e')]=intUtil[_0x9bfc('0x7f')](_0x2f561a['host']);_0x2f561a[_0x9bfc('0x80')]=intUtil[_0x9bfc('0x7f')](_0x2f561a[_0x9bfc('0x80')]);if(_0x5278da&&_0x5278da[_0x9bfc('0x81')]){logger[_0x9bfc('0x30')](_0x9bfc('0x82'),_0x9bfc('0x83'));_0x3b0822[_0x9bfc('0x84')]=_0x2f561a[_0x9bfc('0x80')]+_0x9bfc('0x85')+_0x3b0822[_0x9bfc('0x86')]+_0x9bfc('0x87')+md5(_0x3b0822[_0x9bfc('0x86')]);}else{_0x3b0822[_0x9bfc('0x84')]='';}var _0xf3ebdc=_0x2f561a[_0x9bfc('0x7e')]===_0x9bfc('0x88')?'eu':_0x9bfc('0x89');return getAccessToken(_0x2f561a)[_0x9bfc('0x29')](function(_0x2369b8){_0x41440f=_0x2369b8;return getUser(_0x41440f,_0xf3ebdc,_0x2f561a,_0x272fe9['email']);})['then'](function(_0xaef2e8){_0x9bc00f=_0xaef2e8;logger[_0x9bfc('0x30')](_0x9bfc('0x8a'),_0x9bc00f['id']);return getEndUser(_0x41440f,_0xf3ebdc,_0x2f561a,_0x3b0822[_0x9bfc('0x8b')],_0x3b0822[_0x9bfc('0x8c')],_0x9bc00f,_0x22dd8d);})[_0x9bfc('0x29')](function(_0x2d43a1){_0x4e1436=_0x2d43a1;return getCall(_0x41440f,_0xf3ebdc,_0x2f561a,_0x9bc00f,_0x4e1436,_0x22dd8d,_0x3b0822,'Inbound');})[_0x9bfc('0x29')](function(_0x43b986){if(_0x43b986){logger[_0x9bfc('0x30')]('The\x20Call\x20ID\x20is:',_0x43b986['id']);logger['info']('[QUEUE]',_0x9bfc('0x8d'));emit(util[_0x9bfc('0x33')](_0x9bfc('0x8e'),_0x272fe9[_0x9bfc('0x1b')]),_0x9bfc('0x8f'),{'uri':_0x9bfc('0x90')+_0x2f561a[_0x9bfc('0x7e')]+_0x9bfc('0x91')+_0x43b986['id']});}})['catch'](function(_0x381409){logger['error']('[QUEUE]',JSON[_0x9bfc('0xe')](_0x381409));});};exports[_0x9bfc('0x76')]=function(_0x347547,_0x2a4906,_0x237f55,_0x51a982,_0x137170,_0xd2c23c,_0x11aa8d){var _0x5853a4,_0x34e447,_0x45c43f;_0xd2c23c[_0x9bfc('0x7e')]=intUtil[_0x9bfc('0x7f')](_0xd2c23c[_0x9bfc('0x7e')]);_0xd2c23c[_0x9bfc('0x80')]=intUtil['stripTrailingSlash'](_0xd2c23c[_0x9bfc('0x80')]);if(_0x11aa8d&&_0x11aa8d[_0x9bfc('0x92')]&&_0x11aa8d[_0x9bfc('0x92')]!==_0x9bfc('0x93')){logger[_0x9bfc('0x30')](_0x9bfc('0x94'),_0x9bfc('0x83'));_0x2a4906[_0x9bfc('0x84')]=_0xd2c23c['serverUrl']+_0x9bfc('0x85')+_0x2a4906[_0x9bfc('0x86')]+_0x9bfc('0x87')+md5(_0x2a4906[_0x9bfc('0x86')]);}var _0x3ce619=_0xd2c23c['host']===_0x9bfc('0x88')?'eu':_0x9bfc('0x89');return getAccessToken(_0xd2c23c)[_0x9bfc('0x29')](function(_0x2112a9){_0x45c43f=_0x2112a9;return getUser(_0x45c43f,_0x3ce619,_0xd2c23c,_0x51a982[_0x9bfc('0x38')]);})['then'](function(_0xb0f12){_0x5853a4=_0xb0f12;logger['info'](_0x9bfc('0x8a'),_0x5853a4['id']);return getEndUser(_0x45c43f,_0x3ce619,_0xd2c23c,_0x2a4906[_0x9bfc('0x95')],_0x2a4906[_0x9bfc('0x96')],_0x5853a4,_0x237f55);})[_0x9bfc('0x29')](function(_0x74c8d2){_0x34e447=_0x74c8d2;return getCall(_0x45c43f,_0x3ce619,_0xd2c23c,_0x5853a4,_0x34e447,_0x237f55,_0x2a4906,_0x9bfc('0x97'));})[_0x9bfc('0x29')](function(_0x46c2ca){if(_0x46c2ca){logger[_0x9bfc('0x30')](_0x9bfc('0x98'),_0x46c2ca['id']);logger[_0x9bfc('0x30')](_0x9bfc('0x94'),_0x9bfc('0x8d'));emit(util[_0x9bfc('0x33')](_0x9bfc('0x8e'),_0x51a982[_0x9bfc('0x1b')]),_0x9bfc('0x8f'),{'uri':_0x9bfc('0x90')+_0xd2c23c['host']+_0x9bfc('0x91')+_0x46c2ca['id']});}})[_0x9bfc('0x2d')](function(_0x2ab775){logger[_0x9bfc('0x3d')](_0x9bfc('0x94'),JSON[_0x9bfc('0xe')](_0x2ab775));});};exports[_0x9bfc('0x99')]=function(_0x42deaf,_0x4740be,_0x175838,_0x412c53,_0x46d3b1,_0x461732){var _0x7302d,_0x24d2d7,_0x22b4f3;_0x461732[_0x9bfc('0x7e')]=intUtil['stripTrailingSlash'](_0x461732[_0x9bfc('0x7e')]);_0x461732[_0x9bfc('0x80')]=intUtil[_0x9bfc('0x7f')](_0x461732['serverUrl']);if(_0x46d3b1&&_0x46d3b1[_0x9bfc('0x81')]){logger[_0x9bfc('0x30')]('['+_0x4740be['lastevent'][_0x9bfc('0x9a')]()+']',_0x9bfc('0x83'));_0x4740be[_0x9bfc('0x84')]=_0x461732['serverUrl']+_0x9bfc('0x85')+_0x4740be['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4740be['uniqueid']);}else{_0x4740be[_0x9bfc('0x84')]='';}var _0x5cc9e7=_0x461732[_0x9bfc('0x7e')]===_0x9bfc('0x88')?'eu':_0x9bfc('0x89');return getAccessToken(_0x461732)['then'](function(_0x1f0ac2){_0x22b4f3=_0x1f0ac2;return getUser(_0x22b4f3,_0x5cc9e7,_0x461732);})['then'](function(_0x466498){_0x7302d=_0x466498;logger[_0x9bfc('0x30')](_0x9bfc('0x8a'),_0x7302d['id']);return getEndUser(_0x22b4f3,_0x5cc9e7,_0x461732,_0x4740be[_0x9bfc('0x8b')],_0x4740be[_0x9bfc('0x8c')],_0x7302d,_0x175838);})[_0x9bfc('0x29')](function(_0x977f27){_0x24d2d7=_0x977f27;return getCall(_0x22b4f3,_0x5cc9e7,_0x461732,_0x7302d,_0x24d2d7,_0x175838,_0x4740be,_0x9bfc('0x79'));})[_0x9bfc('0x29')](function(_0x1eda28){if(_0x1eda28){logger['info'](_0x9bfc('0x98'),_0x1eda28['id']);}})[_0x9bfc('0x2d')](function(_0x3ee740){logger['error']('['+_0x4740be[_0x9bfc('0x6a')][_0x9bfc('0x9a')]()+']',JSON[_0x9bfc('0xe')](_0x3ee740));});}; \ No newline at end of file +var _0x9b7e=['moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','localhost','redis','emit','debug','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','access_token','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','refreshToken','clientId','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','details','moduleCreate','Error:\x20','log','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Leads','contact','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','First_Name','Last_Name','What_Id','Full_Name','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','abandoned','Abandoned','Timeout','Call_Start_Time','YYYY-MM-DDTHH:mm:ss','agentcalledAt','Call_Type','Inbound','merge','code','SUCCESS','Call\x20created!','stack','err','queue','stripTrailingSlash','host','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','zoho.eu','Outbound','https://crm.','monitor_format','lastevent','toUpperCase','calleridnum','request-promise','md5','util','./util'];(function(_0x393845,_0x511081){var _0x3dfcdf=function(_0x55a88d){while(--_0x55a88d){_0x393845['push'](_0x393845['shift']());}};_0x3dfcdf(++_0x511081);}(_0x9b7e,0x12e));var _0xe9b7=function(_0x58dc25,_0x49b9d5){_0x58dc25=_0x58dc25-0x0;var _0x21b0a7=_0x9b7e[_0x58dc25];return _0x21b0a7;};'use strict';var _=require('lodash');var rp=require(_0xe9b7('0x0'));var md5=require(_0xe9b7('0x1'));var util=require(_0xe9b7('0x2'));var intUtil=require(_0xe9b7('0x3'));var moment=require(_0xe9b7('0x4'));var Redis=require(_0xe9b7('0x5'));var BPromise=require(_0xe9b7('0x6'));var config=require(_0xe9b7('0x7'));var logger=require(_0xe9b7('0x8'))(_0xe9b7('0x9'));config['redis']=_[_0xe9b7('0xa')](config['redis'],{'host':_0xe9b7('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe9b7('0xc')]));function emit(_0xce21a7,_0x46d7e6,_0x12aa52){io['to'](_0xce21a7)[_0xe9b7('0xd')](_0x46d7e6,_0x12aa52);}function request(_0x10b43e){logger[_0xe9b7('0xe')]('[HTTP]',JSON[_0xe9b7('0xf')](_0x10b43e));return rp(_0x10b43e);}function getCustomFields(_0x5e83e1,_0x5d605d){var _0x507207={};if(_0x5e83e1[_0xe9b7('0x10')]>0x0){_[_0xe9b7('0x11')](_0x5e83e1,function(_0x1725e0){if(_[_0xe9b7('0x12')]([_0xe9b7('0x13'),_0xe9b7('0x14')],_0x1725e0[_0xe9b7('0x15')])&&_0x1725e0[_0xe9b7('0x16')]){_0x507207[_0x1725e0[_0xe9b7('0x16')]]=_0x1725e0[_0xe9b7('0x17')][_0xe9b7('0x18')]();}else if(_0x1725e0[_0xe9b7('0x15')]==='variable'&&_0x1725e0[_0xe9b7('0x19')]&&_0x1725e0[_0xe9b7('0x16')]&&_0x5d605d[_0x1725e0[_0xe9b7('0x19')]]){_0x507207[_0x1725e0[_0xe9b7('0x16')]]=_0x5d605d[_0x1725e0[_0xe9b7('0x19')]][_0xe9b7('0x18')]();}else if(_0x1725e0['type']===_0xe9b7('0x1a')&&_0x1725e0[_0xe9b7('0x1b')]&&_0x1725e0[_0xe9b7('0x1b')][_0xe9b7('0x1c')]&&_0x1725e0[_0xe9b7('0x16')]&&_0x5d605d[_0x1725e0[_0xe9b7('0x1b')][_0xe9b7('0x1c')][_0xe9b7('0x1d')]()]){_0x507207[_0x1725e0['idField']]=_0x5d605d[_0x1725e0['Variable'][_0xe9b7('0x1c')][_0xe9b7('0x1d')]()][_0xe9b7('0x18')]();}});}return _0x507207;}function getName(_0x31de88){if(_0x31de88[_0xe9b7('0x1e')]('\x20')>0x0){var _0x3a3832=_0x31de88[_0xe9b7('0x1f')](/ (.+)/);if(_0x3a3832[0x1]){return _0x3a3832;}}return[_0x31de88,_0x31de88];}var accountsTokens={};function getAccessToken(_0xe1d64d){return new Promise(function(_0x303804,_0x11c1be){if(!_[_0xe9b7('0x20')](accountsTokens[_0xe1d64d['id']])&&!_[_0xe9b7('0x20')](accountsTokens[_0xe1d64d['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0xe1d64d['id']][_0xe9b7('0x21')])){_0x303804(accountsTokens[_0xe1d64d['id']][_0xe9b7('0x22')]);}}var _0x3e61d6;switch(_0xe1d64d[_0xe9b7('0x23')]){case'US':_0x3e61d6='https://accounts.zoho.com';break;case'AU':_0x3e61d6=_0xe9b7('0x24');break;case'EU':_0x3e61d6=_0xe9b7('0x25');break;case'IN':_0x3e61d6='https://accounts.zoho.in';break;case'CN':_0x3e61d6='https://accounts.zoho.com.cn';break;default:_0x3e61d6='https://accounts.zoho.eu';break;}var _0x179c17={'method':_0xe9b7('0x26'),'uri':_0x3e61d6+'/oauth/v2/token','qs':{'refresh_token':_0xe1d64d[_0xe9b7('0x27')],'client_id':_0xe1d64d[_0xe9b7('0x28')],'client_secret':_0xe1d64d[_0xe9b7('0x29')],'grant_type':_0xe9b7('0x2a')},'json':!![]};return rp(_0x179c17)[_0xe9b7('0x2b')](function(_0x34e70e){accountsTokens[_0xe1d64d['id']]={'access_token':_0x34e70e[_0xe9b7('0x22')],'expires_in':moment()['add'](_0x34e70e[_0xe9b7('0x21')],_0xe9b7('0x2c'))};_0x303804(_0x34e70e['access_token']);})[_0xe9b7('0x2d')](function(_0x567ebd){logger[_0xe9b7('0x2e')](_0xe9b7('0x2f'),_0x567ebd['stack']);_0x11c1be(_0x567ebd);});});}function getUser(_0x2b5f0e,_0x12fd60,_0x2bdd70,_0x183845){logger[_0xe9b7('0x30')]('Search\x20user');return request({'method':'GET','uri':util[_0xe9b7('0x31')]('https://www.zohoapis.%s/crm/v2/users',_0x12fd60),'qs':{'type':_0xe9b7('0x32')},'headers':{'Authorization':_0xe9b7('0x33')+_0x2b5f0e},'json':!![]})[_0xe9b7('0x2b')](function(_0x29446d){if(_0x29446d[_0xe9b7('0x34')]){var _0x567d00=-0x1;if(_[_0xe9b7('0x35')](_0x29446d[_0xe9b7('0x34')])){if(!_[_0xe9b7('0x20')](_0x183845)){_0x567d00=_[_0xe9b7('0x36')](_0x29446d['users'],function(_0x5ee09a){return _0x5ee09a[_0xe9b7('0x37')]===_0x183845;});}if(_0x567d00>=0x0){logger[_0xe9b7('0x30')](_0xe9b7('0x38'));}else{logger[_0xe9b7('0x30')](_0xe9b7('0x39'));_0x567d00=_[_0xe9b7('0x36')](_0x29446d[_0xe9b7('0x34')],function(_0x2a0619){return _0x2a0619['profile'][_0xe9b7('0x1c')]==='Administrator';});}return _0x29446d['users'][_0x567d00];}else{if(_0x29446d['user'][_0xe9b7('0x3a')]['name']===_0xe9b7('0x3b')){logger[_0xe9b7('0x30')]('Using\x20the\x20admin\x20account!');user=_0x29446d[_0xe9b7('0x3c')];return user;}else{logger[_0xe9b7('0x2e')](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](_0x29446d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x29446d));}}}else{logger['error'](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](_0x29446d));throw new Error(_0xe9b7('0x3e')+JSON['stringify'](_0x29446d));}})['catch'](function(_0x145f89){console[_0xe9b7('0x2e')](_0x145f89);});}function getZohoUser(_0x513b9f,_0x9bc738){return new BPromise(function(_0x5f3530,_0xee9605){request(_0x513b9f)[_0xe9b7('0x2b')](function(_0x24451c){var _0x5ebd7a=null;if(_0x24451c){_0x5ebd7a=_0x24451c[_0xe9b7('0x3f')][0x0];_0x5ebd7a[_0xe9b7('0x40')]=_0x9bc738;}_0x5f3530(_0x5ebd7a);})['catch'](function(_0x5bc9b7){_0xee9605(_0x5bc9b7);});});}function createEndUser(_0x3a7b3a,_0x461f02,_0x1953a0,_0x273349,_0x4ac629,_0x1efda4){var _0x1953a0=getName(_0x1953a0);return request({'method':_0xe9b7('0x26'),'uri':_0xe9b7('0x41')+_0x461f02+_0xe9b7('0x42')+_[_0xe9b7('0x43')](_0x1efda4['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x1953a0[0x1],'First_Name':_0x1953a0[0x0],'Phone':_0x273349,'Owner':{'name':!_[_0xe9b7('0x20')](_0x4ac629['role']['name'])?_0x4ac629[_0xe9b7('0x44')][_0xe9b7('0x1c')]:!_[_0xe9b7('0x20')](_0x4ac629[_0xe9b7('0x45')])?_0x4ac629[_0xe9b7('0x45')]+'\x20'+_0x4ac629[_0xe9b7('0x46')]:_0x4ac629[_0xe9b7('0x46')],'id':_0x4ac629['id']}}]},'headers':{'Authorization':_0xe9b7('0x33')+_0x3a7b3a},'json':!![]})[_0xe9b7('0x2b')](function(_0x236fe6){if(_0x236fe6&&_0x236fe6[_0xe9b7('0x3f')][0x0]['code']==='SUCCESS'){var _0xff7f58=_0x236fe6[_0xe9b7('0x3f')][0x0][_0xe9b7('0x47')];_0xff7f58[_0xe9b7('0x40')]=_[_0xe9b7('0x43')](_0x1efda4[_0xe9b7('0x48')])+'s';return _0xff7f58;}logger[_0xe9b7('0x2e')](_0xe9b7('0x3d'),JSON[_0xe9b7('0xf')](data));throw new Error(_0xe9b7('0x49')+JSON[_0xe9b7('0xf')](data));})[_0xe9b7('0x2d')](function(_0x3b220e){console[_0xe9b7('0x4a')]('CREATE\x20ERROR',_0x3b220e);});}function getEndUser(_0x1c002f,_0x3c8d90,_0x11d468,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6){var _0x1fb4d3={'method':_0xe9b7('0x4b'),'uri':'','headers':{'Authorization':_0xe9b7('0x33')+_0x1c002f},'json':!![]};switch(_0x2f5df6[_0xe9b7('0x4c')]){case _0xe9b7('0x4d'):_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+_0xe9b7('0x4f')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,'Contacts')[_0xe9b7('0x2b')](function(_0x254291){if(_0x254291)return _0x254291;_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,_0xe9b7('0x50'))[_0xe9b7('0x2b')](function(_0x523a17){if(_0x523a17)return _0x523a17;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});});break;case _0xe9b7('0x51'):_0x1fb4d3[_0xe9b7('0x4e')]='https://www.zohoapis.'+_0x3c8d90+_0xe9b7('0x4f')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,_0xe9b7('0x52'))[_0xe9b7('0x2b')](function(_0x37139b){if(_0x37139b)return _0x37139b;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});break;case'lead':_0x1fb4d3[_0xe9b7('0x4e')]=_0xe9b7('0x41')+_0x3c8d90+_0xe9b7('0x53')+_0x2a6336+'))';return getZohoUser(_0x1fb4d3,'Leads')['then'](function(_0x4ba9f2){if(_0x4ba9f2)return _0x4ba9f2;if(_0x2f5df6[_0xe9b7('0x48')]!='nothing'){return createEndUser(_0x1c002f,_0x3c8d90,_0x2c5aa4,_0x2a6336,_0x55a771,_0x2f5df6);}else{return{};}});break;}}function getCall(_0x34d4e2,_0x45b1a0,_0x2cca89,_0x9d862d,_0x40d60a,_0x507133,_0x5324a3,_0x1751b3){logger[_0xe9b7('0x30')](_0xe9b7('0x54'));var _0x636cd0={};_0x636cd0[_0xe9b7('0x55')]={'name':!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x44')]['name'])&&!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x3a')][_0xe9b7('0x1c')])&&_0x9d862d['profile'][_0xe9b7('0x1c')]===_0xe9b7('0x56')?_0x9d862d[_0xe9b7('0x44')][_0xe9b7('0x1c')]:!_[_0xe9b7('0x20')](_0x9d862d[_0xe9b7('0x45')])?_0x9d862d[_0xe9b7('0x45')]+'\x20'+_0x9d862d[_0xe9b7('0x46')]:_0x9d862d[_0xe9b7('0x46')],'id':_0x9d862d['id']};_0x636cd0[_0xe9b7('0x57')]=intUtil[_0xe9b7('0x58')](_0x507133[_0xe9b7('0x59')],_0x5324a3,'\x20');_0x636cd0['Description']=intUtil['getString'](_0x507133[_0xe9b7('0x5a')],_0x5324a3,'\x0a');if(_0x40d60a[_0xe9b7('0x40')]===_0xe9b7('0x52')){_0x636cd0['Who_Id']={'name':!_[_0xe9b7('0x20')](_0x40d60a['Full_Name'])?_0x40d60a['Full_Name']:!_[_0xe9b7('0x20')](_0x40d60a[_0xe9b7('0x5b')])?_0x40d60a[_0xe9b7('0x5b')]+'\x20'+_0x40d60a[_0xe9b7('0x5c')]:_0x40d60a['Last_Name'],'id':_0x40d60a['id']};}if(_0x40d60a[_0xe9b7('0x40')]===_0xe9b7('0x50')){_0x636cd0[_0xe9b7('0x5d')]={'name':!_[_0xe9b7('0x20')](_0x40d60a[_0xe9b7('0x5e')])?_0x40d60a[_0xe9b7('0x5e')]:!_['isNil'](_0x40d60a[_0xe9b7('0x5b')])?_0x40d60a[_0xe9b7('0x5b')]+'\x20'+_0x40d60a['Last_Name']:_0x40d60a[_0xe9b7('0x5c')],'id':_0x40d60a['id']};_0x636cd0[_0xe9b7('0x5f')]=_[_0xe9b7('0x43')](_0x40d60a[_0xe9b7('0x40')]);}if(_0x5324a3[_0xe9b7('0x60')]){_0x636cd0[_0xe9b7('0x61')]=moment[_0xe9b7('0x62')](parseInt(_0x5324a3[_0xe9b7('0x60')])*0x3e8)[_0xe9b7('0x31')](_0xe9b7('0x63'));}else if(_0x5324a3['answertime']&&_0x5324a3[_0xe9b7('0x64')]){_0x636cd0[_0xe9b7('0x61')]=moment[_0xe9b7('0x62')](moment(_0x5324a3[_0xe9b7('0x64')],'YYYY-MM-DDTHH:mm:ss')[_0xe9b7('0x65')](moment(_0x5324a3[_0xe9b7('0x66')],'YYYY-MM-DDTHH:mm:ss')))[_0xe9b7('0x31')](_0xe9b7('0x63'));}switch(_0x5324a3['lastevent']){case _0xe9b7('0x67'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x69');break;case _0xe9b7('0x6a'):case _0xe9b7('0x6b'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x6c');break;case _0xe9b7('0x6d'):_0x636cd0[_0xe9b7('0x68')]='Rejected';break;case _0xe9b7('0x6e'):_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x6f');break;case'timeout':_0x636cd0[_0xe9b7('0x68')]=_0xe9b7('0x70');default:}_0x636cd0[_0xe9b7('0x71')]=(_0x1751b3==='outbound'?moment(_0x5324a3['starttime'])[_0xe9b7('0x31')](_0xe9b7('0x72')):moment(_0x5324a3[_0xe9b7('0x73')])['format'](_0xe9b7('0x72')))||moment()['format']('YYYY-MM-DDTHH:mm:ss');_0x636cd0[_0xe9b7('0x74')]=_0x1751b3||_0xe9b7('0x75');_0x636cd0=_[_0xe9b7('0x76')](_0x636cd0,getCustomFields(_0x507133['Fields'],_0x5324a3));return request({'method':_0xe9b7('0x26'),'uri':_0xe9b7('0x41')+_0x45b1a0+'/crm/v2/Calls','headers':{'Authorization':_0xe9b7('0x33')+_0x34d4e2},'body':{'data':[_0x636cd0]},'json':!![]})[_0xe9b7('0x2b')](function(_0xd70e2c){if(_0xd70e2c&&_0xd70e2c[_0xe9b7('0x3f')][0x0][_0xe9b7('0x77')]===_0xe9b7('0x78')){logger[_0xe9b7('0x30')](_0xe9b7('0x79'));return{'id':_0xd70e2c[_0xe9b7('0x3f')][0x0][_0xe9b7('0x47')]['id']};}})['catch'](function(_0x3c3675){logger[_0xe9b7('0x30')]('err',_0x3c3675[_0xe9b7('0x7a')]);console['log'](_0xe9b7('0x7b'),_0x3c3675);});}exports[_0xe9b7('0x7c')]=function(_0x150400,_0x3162bf,_0x1fd7b7,_0x2315c7,_0x41b8ce,_0x59fb73){var _0x3c0fea,_0x29be42,_0x4e5b51;_0x59fb73['host']=intUtil[_0xe9b7('0x7d')](_0x59fb73[_0xe9b7('0x7e')]);_0x59fb73[_0xe9b7('0x7f')]=intUtil[_0xe9b7('0x7d')](_0x59fb73[_0xe9b7('0x7f')]);if(_0x41b8ce&&_0x41b8ce['monitor_format']){logger[_0xe9b7('0x30')](_0xe9b7('0x80'),_0xe9b7('0x81'));_0x3162bf[_0xe9b7('0x82')]=_0x59fb73[_0xe9b7('0x7f')]+_0xe9b7('0x83')+_0x3162bf[_0xe9b7('0x84')]+'/downloads?type=uniqueid&token='+md5(_0x3162bf['uniqueid']);}else{_0x3162bf[_0xe9b7('0x82')]='';}var _0x1d2b42=_0x59fb73[_0xe9b7('0x7e')]==='zoho.eu'?'eu':_0xe9b7('0x85');return getAccessToken(_0x59fb73)[_0xe9b7('0x2b')](function(_0x42d749){_0x4e5b51=_0x42d749;return getUser(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x2315c7[_0xe9b7('0x37')]);})[_0xe9b7('0x2b')](function(_0x54aa95){_0x3c0fea=_0x54aa95;logger[_0xe9b7('0x30')](_0xe9b7('0x86'),_0x3c0fea['id']);return getEndUser(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x3162bf[_0xe9b7('0x87')],_0x3162bf['calleridnum'],_0x3c0fea,_0x1fd7b7);})[_0xe9b7('0x2b')](function(_0x45d5b4){_0x29be42=_0x45d5b4;return getCall(_0x4e5b51,_0x1d2b42,_0x59fb73,_0x3c0fea,_0x29be42,_0x1fd7b7,_0x3162bf,_0xe9b7('0x75'));})[_0xe9b7('0x2b')](function(_0x136b3f){if(_0x136b3f){logger[_0xe9b7('0x30')](_0xe9b7('0x88'),_0x136b3f['id']);logger['info'](_0xe9b7('0x80'),_0xe9b7('0x89'));emit(util['format'](_0xe9b7('0x8a'),_0x2315c7['name']),_0xe9b7('0x8b'),{'uri':'https://crm.'+_0x59fb73[_0xe9b7('0x7e')]+_0xe9b7('0x8c')+_0x136b3f['id']});}})[_0xe9b7('0x2d')](function(_0x41ba85){logger[_0xe9b7('0x2e')](_0xe9b7('0x80'),JSON['stringify'](_0x41ba85));});};exports[_0xe9b7('0x8d')]=function(_0x2afc7b,_0x438db5,_0x593aa8,_0x3b85f2,_0x530d73,_0x1615ac,_0x40f6c8){var _0x39e682,_0x14c903,_0x101440;_0x1615ac[_0xe9b7('0x7e')]=intUtil[_0xe9b7('0x7d')](_0x1615ac[_0xe9b7('0x7e')]);_0x1615ac[_0xe9b7('0x7f')]=intUtil[_0xe9b7('0x7d')](_0x1615ac[_0xe9b7('0x7f')]);if(_0x40f6c8&&_0x40f6c8['recordingFormat']&&_0x40f6c8[_0xe9b7('0x8e')]!==_0xe9b7('0x8f')){logger[_0xe9b7('0x30')](_0xe9b7('0x90'),_0xe9b7('0x81'));_0x438db5[_0xe9b7('0x82')]=_0x1615ac[_0xe9b7('0x7f')]+'/api/voice/recordings/'+_0x438db5[_0xe9b7('0x84')]+_0xe9b7('0x91')+md5(_0x438db5[_0xe9b7('0x84')]);}var _0x2c04f9=_0x1615ac[_0xe9b7('0x7e')]===_0xe9b7('0x92')?'eu':'com';return getAccessToken(_0x1615ac)['then'](function(_0x22304b){_0x101440=_0x22304b;return getUser(_0x101440,_0x2c04f9,_0x1615ac,_0x3b85f2[_0xe9b7('0x37')]);})[_0xe9b7('0x2b')](function(_0x34c4fc){_0x39e682=_0x34c4fc;logger[_0xe9b7('0x30')]('The\x20User\x20ID\x20is:',_0x39e682['id']);return getEndUser(_0x101440,_0x2c04f9,_0x1615ac,_0x438db5['destcalleridname'],_0x438db5['destcalleridnum'],_0x39e682,_0x593aa8);})[_0xe9b7('0x2b')](function(_0x47c5b1){_0x14c903=_0x47c5b1;return getCall(_0x101440,_0x2c04f9,_0x1615ac,_0x39e682,_0x14c903,_0x593aa8,_0x438db5,_0xe9b7('0x93'));})[_0xe9b7('0x2b')](function(_0x4b2c64){if(_0x4b2c64){logger[_0xe9b7('0x30')]('The\x20Call\x20ID\x20is:',_0x4b2c64['id']);logger[_0xe9b7('0x30')](_0xe9b7('0x90'),_0xe9b7('0x89'));emit(util[_0xe9b7('0x31')]('user:%s',_0x3b85f2[_0xe9b7('0x1c')]),_0xe9b7('0x8b'),{'uri':_0xe9b7('0x94')+_0x1615ac[_0xe9b7('0x7e')]+_0xe9b7('0x8c')+_0x4b2c64['id']});}})[_0xe9b7('0x2d')](function(_0x1a8c3f){logger['error'](_0xe9b7('0x90'),JSON['stringify'](_0x1a8c3f));});};exports['unmanaged']=function(_0x598782,_0x3253a2,_0xd2b296,_0x27b701,_0x15f27b,_0x3948ee){var _0x2ec407,_0x518575,_0x615b99;_0x3948ee['host']=intUtil[_0xe9b7('0x7d')](_0x3948ee[_0xe9b7('0x7e')]);_0x3948ee[_0xe9b7('0x7f')]=intUtil['stripTrailingSlash'](_0x3948ee['serverUrl']);if(_0x15f27b&&_0x15f27b[_0xe9b7('0x95')]){logger[_0xe9b7('0x30')]('['+_0x3253a2[_0xe9b7('0x96')][_0xe9b7('0x97')]()+']',_0xe9b7('0x81'));_0x3253a2[_0xe9b7('0x82')]=_0x3948ee[_0xe9b7('0x7f')]+_0xe9b7('0x83')+_0x3253a2[_0xe9b7('0x84')]+_0xe9b7('0x91')+md5(_0x3253a2[_0xe9b7('0x84')]);}else{_0x3253a2[_0xe9b7('0x82')]='';}var _0x39d42d=_0x3948ee[_0xe9b7('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x3948ee)[_0xe9b7('0x2b')](function(_0x18d234){_0x615b99=_0x18d234;return getUser(_0x615b99,_0x39d42d,_0x3948ee);})[_0xe9b7('0x2b')](function(_0x40e0e9){_0x2ec407=_0x40e0e9;logger[_0xe9b7('0x30')]('The\x20User\x20ID\x20is:',_0x2ec407['id']);return getEndUser(_0x615b99,_0x39d42d,_0x3948ee,_0x3253a2['calleridname'],_0x3253a2[_0xe9b7('0x98')],_0x2ec407,_0xd2b296);})[_0xe9b7('0x2b')](function(_0x477e2e){_0x518575=_0x477e2e;return getCall(_0x615b99,_0x39d42d,_0x3948ee,_0x2ec407,_0x518575,_0xd2b296,_0x3253a2,_0xe9b7('0x75'));})['then'](function(_0x14d0b6){if(_0x14d0b6){logger[_0xe9b7('0x30')](_0xe9b7('0x88'),_0x14d0b6['id']);}})[_0xe9b7('0x2d')](function(_0xb385d){logger[_0xe9b7('0x2e')]('['+_0x3253a2[_0xe9b7('0x96')]['toUpperCase']()+']',JSON[_0xe9b7('0xf')](_0xb385d));});}; \ 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 f2ed260..d4a17a5 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 _0xaf44=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','data3'];(function(_0x59c3f6,_0x4889b0){var _0x51b314=function(_0x535e9a){while(--_0x535e9a){_0x59c3f6['push'](_0x59c3f6['shift']());}};_0x51b314(++_0x4889b0);}(_0xaf44,0x1f3));var _0x4af4=function(_0x117af1,_0x5cf953){_0x117af1=_0x117af1-0x0;var _0x23407e=_0xaf44[_0x117af1];return _0x23407e;};'use strict';var util=require(_0x4af4('0x0'));var sh=require(_0x4af4('0x1'));var Mustache=require(_0x4af4('0x2'));var logger=require(_0x4af4('0x3'))(_0x4af4('0x4'));exports[_0x4af4('0x5')]=function(_0x420b88,_0x3fce2c){var _0x43bffa=_0x420b88[_0x4af4('0x6')]?_0x420b88[_0x4af4('0x6')]:'Script';var _0x51b996=_0x420b88[_0x4af4('0x7')]?Mustache[_0x4af4('0x8')](_0x420b88[_0x4af4('0x7')],_0x3fce2c):_0x3fce2c;sh[_0x4af4('0x5')](_0x51b996,function(_0xfe9a81,_0x5665bf,_0x1e7e6c){if(_0xfe9a81!==0x0){logger[_0x4af4('0x9')](util[_0x4af4('0xa')](_0x4af4('0xb'),_0x43bffa,_0x51b996,_0xfe9a81,_0x1e7e6c));}else{logger[_0x4af4('0xc')](util[_0x4af4('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x43bffa,_0x51b996,_0x5665bf));}});}; \ No newline at end of file +var _0x9871=['Script','data3','render','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger','exec','data2'];(function(_0xe05e35,_0x44b74c){var _0x18dc18=function(_0x39aa04){while(--_0x39aa04){_0xe05e35['push'](_0xe05e35['shift']());}};_0x18dc18(++_0x44b74c);}(_0x9871,0x156));var _0x1987=function(_0x280f4a,_0x2ed8d6){_0x280f4a=_0x280f4a-0x0;var _0x1bb157=_0x9871[_0x280f4a];return _0x1bb157;};'use strict';var util=require(_0x1987('0x0'));var sh=require(_0x1987('0x1'));var Mustache=require(_0x1987('0x2'));var logger=require('../../../../config/logger')(_0x1987('0x3'));exports[_0x1987('0x4')]=function(_0x41eac1,_0x46ceb5){var _0x348d6f=_0x41eac1[_0x1987('0x5')]?_0x41eac1[_0x1987('0x5')]:_0x1987('0x6');var _0x156ca3=_0x41eac1[_0x1987('0x7')]?Mustache[_0x1987('0x8')](_0x41eac1[_0x1987('0x7')],_0x46ceb5):_0x46ceb5;sh[_0x1987('0x4')](_0x156ca3,function(_0x3db92,_0x10ef77,_0xae8ad6){if(_0x3db92!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x348d6f,_0x156ca3,_0x3db92,_0xae8ad6));}else{logger[_0x1987('0x9')](util[_0x1987('0xa')](_0x1987('0xb'),_0x348d6f,_0x156ca3,_0x10ef77));}});}; \ 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 4ec1ec1..5f352fb 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 _0xcce8=['data1','toUpperCase','render','data2','data5','number','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','trigger','exec'];(function(_0x330ac8,_0x3e5666){var _0x477062=function(_0x5ae4c3){while(--_0x5ae4c3){_0x330ac8['push'](_0x330ac8['shift']());}};_0x477062(++_0x3e5666);}(_0xcce8,0xf0));var _0x8cce=function(_0x2a2370,_0x375a9b){_0x2a2370=_0x2a2370-0x0;var _0x1c94c1=_0xcce8[_0x2a2370];return _0x1c94c1;};'use strict';var rp=require(_0x8cce('0x0'));var util=require(_0x8cce('0x1'));var _=require(_0x8cce('0x2'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x8cce('0x3'));exports[_0x8cce('0x4')]=function(_0x1e6875,_0x1c1941){var _0xe6bc0e,_0x26af80;var _0x4ecb1f={'method':_0x1e6875[_0x8cce('0x5')][_0x8cce('0x6')](),'uri':Mustache[_0x8cce('0x7')](_0x1e6875[_0x8cce('0x8')],_0x1c1941),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x1e6875[_0x8cce('0x9')])===_0x8cce('0xa')&&parseInt(_0x1e6875['data5'])>=0x1&&parseInt(_0x1e6875[_0x8cce('0x9')])<=0xa?parseInt(_0x1e6875[_0x8cce('0x9')])*0x3e8:0x5*0x3e8};try{_0x4ecb1f['headers']=_0x1e6875[_0x8cce('0xb')]?JSON[_0x8cce('0xc')](Mustache[_0x8cce('0x7')](_0x1e6875[_0x8cce('0xb')],_0x1c1941)):{};}catch(_0x47c0ff){logger[_0x8cce('0xd')](_0x47c0ff[_0x8cce('0xe')]);}switch(_0x1e6875[_0x8cce('0x5')][_0x8cce('0x6')]()){case _0x8cce('0xf'):case _0x8cce('0x10'):_0xe6bc0e=null;_0x4ecb1f['qs']=_0x1c1941;break;case _0x8cce('0x11'):case _0x8cce('0x12'):if(_0x1e6875[_0x8cce('0x13')]){try{_0xe6bc0e=JSON[_0x8cce('0xc')](Mustache[_0x8cce('0x7')](_0x1e6875[_0x8cce('0x13')],_0x1c1941));_0x4ecb1f[_0x8cce('0x14')]=_0xe6bc0e;}catch(_0x505c92){logger[_0x8cce('0xd')](_0x505c92[_0x8cce('0xe')]);logger[_0x8cce('0xd')](_0x8cce('0x15'));}}else{_0xe6bc0e=_0x1c1941;_0x4ecb1f[_0x8cce('0x14')]=_0xe6bc0e;}break;}logger[_0x8cce('0x16')](util[_0x8cce('0x17')](_0x8cce('0x18'),_0x1e6875['data1'],_0x1e6875['data2'],JSON[_0x8cce('0x19')](_0x4ecb1f)));rp(_0x4ecb1f)[_0x8cce('0x1a')](function(_0x3b0e5c){_0xe6bc0e=!_['isNil'](_0xe6bc0e)?_0x8cce('0x1b')+_0xe6bc0e:'';_0x26af80=typeof _0x3b0e5c[_0x8cce('0x14')]===_0x8cce('0x1c')?JSON[_0x8cce('0x19')](_0x3b0e5c[_0x8cce('0x14')]):_0x3b0e5c[_0x8cce('0x14')];logger[_0x8cce('0x16')](util['format'](_0x8cce('0x1d'),_0x1e6875[_0x8cce('0x5')],_0x1e6875[_0x8cce('0x8')],_0x3b0e5c['statusCode'],_0x26af80));})[_0x8cce('0x1e')](function(_0x1aad21){logger['error'](util[_0x8cce('0x17')](_0x8cce('0x1f'),_0x1e6875['data1'],_0x1e6875[_0x8cce('0x8')],_0x1aad21[_0x8cce('0x20')],_0x1aad21[_0x8cce('0x21')],_0x1aad21[_0x8cce('0x22')]));});}; \ No newline at end of file +var _0xb1ce=['trigger','exec','data1','toUpperCase','render','data2','data5','number','parse','error','GET','POST','PUT','data7','stack','body','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','util','lodash','mustache','../../../../config/logger'];(function(_0x11f8e9,_0x67f67f){var _0x3a04d7=function(_0x5a230c){while(--_0x5a230c){_0x11f8e9['push'](_0x11f8e9['shift']());}};_0x3a04d7(++_0x67f67f);}(_0xb1ce,0x87));var _0xeb1c=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xb1ce[_0x163691];return _0x543ae5;};'use strict';var rp=require(_0xeb1c('0x0'));var util=require(_0xeb1c('0x1'));var _=require(_0xeb1c('0x2'));var Mustache=require(_0xeb1c('0x3'));var logger=require(_0xeb1c('0x4'))(_0xeb1c('0x5'));exports[_0xeb1c('0x6')]=function(_0x495497,_0x3a6270){var _0x509b77,_0xaaf426;var _0x2df18c={'method':_0x495497[_0xeb1c('0x7')][_0xeb1c('0x8')](),'uri':Mustache[_0xeb1c('0x9')](_0x495497[_0xeb1c('0xa')],_0x3a6270),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x495497[_0xeb1c('0xb')])===_0xeb1c('0xc')&&parseInt(_0x495497[_0xeb1c('0xb')])>=0x1&&parseInt(_0x495497['data5'])<=0xa?parseInt(_0x495497[_0xeb1c('0xb')])*0x3e8:0x5*0x3e8};try{_0x2df18c['headers']=_0x495497['data6']?JSON[_0xeb1c('0xd')](Mustache[_0xeb1c('0x9')](_0x495497['data6'],_0x3a6270)):{};}catch(_0x4a8a74){logger[_0xeb1c('0xe')](_0x4a8a74['stack']);}switch(_0x495497[_0xeb1c('0x7')]['toUpperCase']()){case _0xeb1c('0xf'):case'DELETE':_0x509b77=null;_0x2df18c['qs']=_0x3a6270;break;case _0xeb1c('0x10'):case _0xeb1c('0x11'):if(_0x495497[_0xeb1c('0x12')]){try{_0x509b77=JSON[_0xeb1c('0xd')](Mustache[_0xeb1c('0x9')](_0x495497[_0xeb1c('0x12')],_0x3a6270));_0x2df18c['body']=_0x509b77;}catch(_0x54bc0c){logger['error'](_0x54bc0c[_0xeb1c('0x13')]);logger[_0xeb1c('0xe')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x509b77=_0x3a6270;_0x2df18c[_0xeb1c('0x14')]=_0x509b77;}break;}logger[_0xeb1c('0x15')](util[_0xeb1c('0x16')](_0xeb1c('0x17'),_0x495497[_0xeb1c('0x7')],_0x495497[_0xeb1c('0xa')],JSON[_0xeb1c('0x18')](_0x2df18c)));rp(_0x2df18c)[_0xeb1c('0x19')](function(_0x4d9cde){_0x509b77=!_[_0xeb1c('0x1a')](_0x509b77)?_0xeb1c('0x1b')+_0x509b77:'';_0xaaf426=typeof _0x4d9cde[_0xeb1c('0x14')]===_0xeb1c('0x1c')?JSON['stringify'](_0x4d9cde[_0xeb1c('0x14')]):_0x4d9cde[_0xeb1c('0x14')];logger[_0xeb1c('0x15')](util['format'](_0xeb1c('0x1d'),_0x495497[_0xeb1c('0x7')],_0x495497[_0xeb1c('0xa')],_0x4d9cde['statusCode'],_0xaaf426));})[_0xeb1c('0x1e')](function(_0x28cf06){logger[_0xeb1c('0xe')](util['format'](_0xeb1c('0x1f'),_0x495497[_0xeb1c('0x7')],_0x495497[_0xeb1c('0xa')],_0x28cf06[_0xeb1c('0x20')],_0x28cf06[_0xeb1c('0x21')],_0x28cf06[_0xeb1c('0x22')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 829f46d..00b864c 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 _0xedb2=['jayson/promise','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','exports'];(function(_0x1319d6,_0x227e84){var _0x5c0e98=function(_0x1169de){while(--_0x1169de){_0x1319d6['push'](_0x1319d6['shift']());}};_0x5c0e98(++_0x227e84);}(_0xedb2,0x180));var _0x2edb=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xedb2[_0x5c351c];return _0x26f3b3;};'use strict';var jayson=require(_0x2edb('0x0'));var BPromise=require('bluebird');var logger=require(_0x2edb('0x1'))(_0x2edb('0x2'));var client=jayson[_0x2edb('0x3')][_0x2edb('0x4')]({'port':0x2329});client[_0x2edb('0x5')]=function(_0xc09141,_0xfd8e2c){return new BPromise(function(_0x1d3f52,_0x2c0b43){return client['request'](_0xc09141,_0xfd8e2c)[_0x2edb('0x6')](function(_0x552cf6){logger[_0x2edb('0x7')](_0x2edb('0x8'),_0x2edb('0x2'),_0xc09141,_0xfd8e2c,_0x552cf6);if(_0x552cf6[_0x2edb('0x9')]){logger[_0x2edb('0x9')](_0x2edb('0x8'),'routing',_0xc09141,_0x552cf6['error']['message'],_0xfd8e2c);return _0x2c0b43(_0x552cf6['error'][_0x2edb('0xa')]);}else{return _0x1d3f52(_0x552cf6['result']);}})['catch'](function(_0x25acd7){logger[_0x2edb('0x9')]('rpc',_0x2edb('0x2'),_0xc09141,_0x25acd7,_0xfd8e2c);return _0x2c0b43(_0x25acd7);});});};module[_0x2edb('0xb')]=client; \ No newline at end of file +var _0x9ec7=['http','Request','request','then','debug','rpc','routing','error','result','catch','jayson/promise','bluebird','../../config/logger','client'];(function(_0x4612df,_0x37a8f7){var _0x2804c6=function(_0x2b1979){while(--_0x2b1979){_0x4612df['push'](_0x4612df['shift']());}};_0x2804c6(++_0x37a8f7);}(_0x9ec7,0x88));var _0x79ec=function(_0x8a4c2a,_0xb64761){_0x8a4c2a=_0x8a4c2a-0x0;var _0x5055cc=_0x9ec7[_0x8a4c2a];return _0x5055cc;};'use strict';var jayson=require(_0x79ec('0x0'));var BPromise=require(_0x79ec('0x1'));var logger=require(_0x79ec('0x2'))('routing');var client=jayson[_0x79ec('0x3')][_0x79ec('0x4')]({'port':0x2329});client[_0x79ec('0x5')]=function(_0xca3688,_0x184937){return new BPromise(function(_0x4fcdf8,_0x4b89f8){return client[_0x79ec('0x6')](_0xca3688,_0x184937)[_0x79ec('0x7')](function(_0x344b19){logger[_0x79ec('0x8')](_0x79ec('0x9'),_0x79ec('0xa'),_0xca3688,_0x184937,_0x344b19);if(_0x344b19['error']){logger[_0x79ec('0xb')](_0x79ec('0x9'),_0x79ec('0xa'),_0xca3688,_0x344b19[_0x79ec('0xb')]['message'],_0x184937);return _0x4b89f8(_0x344b19[_0x79ec('0xb')]['message']);}else{return _0x4fcdf8(_0x344b19[_0x79ec('0xc')]);}})[_0x79ec('0xd')](function(_0x2022e2){logger[_0x79ec('0xb')](_0x79ec('0x9'),_0x79ec('0xa'),_0xca3688,_0x2022e2,_0x184937);return _0x4b89f8(_0x2022e2);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6a5b2f9..32906fe 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 _0x1827=['initMailAccounts','mailAccounts','listen','loginMailFrequency','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','email','then','getMailAccounts'];(function(_0x5429fd,_0x456b33){var _0x577643=function(_0x5922a2){while(--_0x5922a2){_0x5429fd['push'](_0x5429fd['shift']());}};_0x577643(++_0x456b33);}(_0x1827,0xbc));var _0x7182=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x1827[_0x1d1779];return _0x2377e9;};'use strict';var server=require('./server');var Realtime=require(_0x7182('0x0'));var EmailChannel=require(_0x7182('0x1'));var mailAccount=require(_0x7182('0x2'));var setting=require('./rpc/setting');var logger=require(_0x7182('0x3'))(_0x7182('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x7182('0x5')](mailAccount[_0x7182('0x6')]())[_0x7182('0x5')](realtime[_0x7182('0x7')]())['then'](function(){email['refresh'](realtime[_0x7182('0x8')]);return realtime;});}function main(){return server[_0x7182('0x9')](realtime,email)['then'](function(){return initRealtime();})[_0x7182('0x5')](function(){return setting['getSettings']();})[_0x7182('0x5')](function(_0x590311){return setInterval(initRealtime,_0x590311[_0x7182('0xa')]*0x3e8);})['catch'](function(_0x211efe){logger[_0x7182('0xb')](_0x7182('0xc'),_0x211efe);});}main(); \ No newline at end of file +var _0x6423=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','../../config/logger','resolve','then','getMailAccounts','refresh','mailAccounts','listen','catch'];(function(_0x385500,_0x1265c7){var _0x50a59b=function(_0x26c317){while(--_0x26c317){_0x385500['push'](_0x385500['shift']());}};_0x50a59b(++_0x1265c7);}(_0x6423,0xb8));var _0x3642=function(_0x153317,_0x4ee9b6){_0x153317=_0x153317-0x0;var _0x340b94=_0x6423[_0x153317];return _0x340b94;};'use strict';var server=require(_0x3642('0x0'));var Realtime=require(_0x3642('0x1'));var EmailChannel=require(_0x3642('0x2'));var mailAccount=require(_0x3642('0x3'));var setting=require('./rpc/setting');var logger=require(_0x3642('0x4'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3642('0x5')]()[_0x3642('0x6')](mailAccount[_0x3642('0x7')]())[_0x3642('0x6')](realtime['initMailAccounts']())[_0x3642('0x6')](function(){email[_0x3642('0x8')](realtime[_0x3642('0x9')]);return realtime;});}function main(){return server[_0x3642('0xa')](realtime,email)[_0x3642('0x6')](function(){return initRealtime();})[_0x3642('0x6')](function(){return setting['getSettings']();})['then'](function(_0x131f9f){return setInterval(initRealtime,_0x131f9f['loginMailFrequency']*0x3e8);})[_0x3642('0xb')](function(_0xda3e03){logger[_0x3642('0xc')](_0x3642('0xd'),_0xda3e03);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 374f61a..ffa1fda 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 _0xea95=['info','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','status','messageStatus','total','stringify','md5','mailAccount:update','refresh','hasOwnProperty','provider','custom','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','isNil','connected','messages','firstName','lastName','from','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','sendMail','smtp','send','verifySmtp','Smtp','lastSync','verify','then','verified','catch','exports','lodash','moment','bluebird','ioredis','../../../config/environment','email','defaults','redis','localhost','socket.io-emitter','./imap','./smtp'];(function(_0x5f5059,_0x469cd8){var _0x2245e3=function(_0x5739b9){while(--_0x5739b9){_0x5f5059['push'](_0x5f5059['shift']());}};_0x2245e3(++_0x469cd8);}(_0xea95,0x18a));var _0x5ea9=function(_0x58e5a6,_0x2313f6){_0x58e5a6=_0x58e5a6-0x0;var _0x21f8a8=_0xea95[_0x58e5a6];return _0x21f8a8;};'use strict';var _=require(_0x5ea9('0x0'));var moment=require(_0x5ea9('0x1'));var BPromise=require(_0x5ea9('0x2'));var md5=require('md5');var Redis=require(_0x5ea9('0x3'));var config=require(_0x5ea9('0x4'));var logger=require('../../../config/logger')(_0x5ea9('0x5'));config['redis']=_[_0x5ea9('0x6')](config[_0x5ea9('0x7')],{'host':_0x5ea9('0x8'),'port':0x18eb});var io=require(_0x5ea9('0x9'))(new Redis(config[_0x5ea9('0x7')]));var EmailImap=require(_0x5ea9('0xa'));var EmailSmtp=require(_0x5ea9('0xb'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0xbfb520){logger[_0x5ea9('0xc')]('start\x20email\x20channel');this['mailAccounts']=_0xbfb520[_0x5ea9('0xd')];this[_0x5ea9('0xe')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x5ea9('0xf')][_0x5ea9('0x10')]=function(_0x1b2088){var _0x335973=this['mailAccounts'][_0x1b2088];var _0x276636={'id':_0x335973['id'],'name':_0x335973[_0x5ea9('0x11')],'key':_0x335973[_0x5ea9('0x12')],'active':_0x335973[_0x5ea9('0x13')],'Imap':{'status':_0x335973[_0x5ea9('0x14')][_0x5ea9('0x15')],'messageStatus':_0x335973['Imap'][_0x5ea9('0x16')],'total':_0x335973[_0x5ea9('0x14')][_0x5ea9('0x17')]}};if(_['isNil'](md5Accounts[_0x1b2088])){md5Accounts[_0x1b2088]={};}var _0x530346=md5(JSON[_0x5ea9('0x18')](_0x276636));if(md5Accounts[_0x1b2088][_0x5ea9('0x19')]!==_0x530346){md5Accounts[_0x1b2088][_0x5ea9('0x19')]=_0x530346;io[_0x5ea9('0x10')](_0x5ea9('0x1a'),_0x276636);}};EmailChannel[_0x5ea9('0xf')][_0x5ea9('0x1b')]=function(_0x4163ed){for(var _0x429154 in _0x4163ed){if(_0x4163ed[_0x5ea9('0x1c')](_0x429154)){if(_0x4163ed[_0x429154][_0x5ea9('0x14')]&&_0x4163ed[_0x429154][_0x5ea9('0x13')]){var _0x3f4b04=_0x4163ed[_0x429154][_0x5ea9('0x14')];if(!_0x3f4b04['service']&&_0x4163ed[_0x429154][_0x5ea9('0x1d')]!==_0x5ea9('0x1e'))_0x3f4b04['service']=_0x4163ed[_0x429154]['provider'];if(!this[_0x5ea9('0xe')]['hasOwnProperty'](_0x3f4b04['id'])){this[_0x5ea9('0xe')][_0x3f4b04['id']]=new EmailImap(_0x3f4b04,_0x4163ed[_0x429154][_0x5ea9('0x5')]);this['imapAccounts'][_0x3f4b04['id']]['on'](_0x5ea9('0x1f'),this[_0x5ea9('0x20')][_0x5ea9('0x21')](this,_0x429154));this[_0x5ea9('0xe')][_0x3f4b04['id']]['on']('email',this[_0x5ea9('0x22')][_0x5ea9('0x21')](this,_0x429154));this[_0x5ea9('0xe')][_0x3f4b04['id']]['on'](_0x5ea9('0x23'),this[_0x5ea9('0x24')][_0x5ea9('0x21')](this,_0x429154));this['imapAccounts'][_0x3f4b04['id']]['on'](_0x5ea9('0x25'),this[_0x5ea9('0x26')][_0x5ea9('0x21')](this,_0x429154));}}else{if(_[_0x5ea9('0x27')](this[_0x5ea9('0xd')][_0x429154][_0x5ea9('0x14')])){this[_0x5ea9('0xd')][_0x429154][_0x5ea9('0x14')]={};}this[_0x5ea9('0xd')][_0x429154]['Imap'][_0x5ea9('0x15')]='disabled';this[_0x5ea9('0xd')][_0x429154]['Imap'][_0x5ea9('0x16')]='';this['emit'](_0x429154);}}}};EmailChannel[_0x5ea9('0xf')][_0x5ea9('0x20')]=function(_0x552130,_0x24f0dc){if(this[_0x5ea9('0xd')][_0x552130]){this['mailAccounts'][_0x552130][_0x5ea9('0x14')][_0x5ea9('0x15')]=_0x5ea9('0x28');this[_0x5ea9('0xd')][_0x552130][_0x5ea9('0x14')][_0x5ea9('0x16')]=_0x24f0dc[_0x5ea9('0x11')];if(_0x24f0dc[_0x5ea9('0x29')]){this[_0x5ea9('0xd')][_0x552130]['Imap']['total']=_0x24f0dc[_0x5ea9('0x29')][_0x5ea9('0x17')];}return this[_0x5ea9('0x10')](_0x552130);}};EmailChannel[_0x5ea9('0xf')]['handleImapEmail']=function(_0x68a6fb,_0x15082d){logger[_0x5ea9('0xc')]('New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s',_0x15082d[_0x5ea9('0x2a')],_0x15082d[_0x5ea9('0x2b')],_0x15082d[_0x5ea9('0x2c')],_0x68a6fb);if(this[_0x5ea9('0xd')][_0x68a6fb]){return mailAccount['notify'](_0x68a6fb,_0x15082d)['then'](function(_0x8b31bf){if(_0x8b31bf){logger['info'](_0x5ea9('0x2d'));}})['catch'](function(_0x15f34e){logger[_0x5ea9('0x25')](_0x5ea9('0x2e'),JSON[_0x5ea9('0x18')](_0x15f34e));});}};EmailChannel[_0x5ea9('0xf')]['handleImapEnd']=function(_0x5c54ec){if(this['mailAccounts'][_0x5c54ec]&&this[_0x5ea9('0xd')][_0x5c54ec][_0x5ea9('0x14')]){if(this[_0x5ea9('0xe')][this[_0x5ea9('0xd')][_0x5c54ec][_0x5ea9('0x14')]['id']]){delete this[_0x5ea9('0xe')][this[_0x5ea9('0xd')][_0x5c54ec][_0x5ea9('0x14')]['id']];}this['mailAccounts'][_0x5c54ec]['Imap']['lastSync']=moment();this['emit'](_0x5c54ec);}};EmailChannel[_0x5ea9('0xf')][_0x5ea9('0x26')]=function(_0xcf5e09,_0x77f5a5){if(this[_0x5ea9('0xd')][_0xcf5e09]){this[_0x5ea9('0xd')][_0xcf5e09][_0x5ea9('0x14')]['status']='error';this['mailAccounts'][_0xcf5e09][_0x5ea9('0x14')]['messageStatus']=_0x77f5a5;return this[_0x5ea9('0x10')](_0xcf5e09);}};EmailChannel[_0x5ea9('0xf')][_0x5ea9('0x2f')]=function(_0x467bf6,_0x4e863f){return this[_0x5ea9('0x30')][_0x5ea9('0x31')](_0x467bf6,_0x4e863f);};EmailChannel['prototype'][_0x5ea9('0x32')]=function(_0x5be999){var _0x20f613=this;if(this[_0x5ea9('0xd')][_0x5be999['id']]){if(_[_0x5ea9('0x27')](this[_0x5ea9('0xd')][_0x5be999['id']]['Smtp'])){this[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')]={};}this[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')][_0x5ea9('0x34')]=moment();return new BPromise(function(_0x57d6b7,_0x5d79ba){return _0x20f613[_0x5ea9('0x30')][_0x5ea9('0x35')](_0x5be999)[_0x5ea9('0x36')](function(_0x6d3664){_0x20f613[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')][_0x5ea9('0x15')]=_0x5ea9('0x37');_0x20f613[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')]['messageStatus']='';_0x20f613[_0x5ea9('0x10')](_0x5be999['id']);_0x57d6b7(_0x6d3664);})[_0x5ea9('0x38')](function(_0x157b78){_0x20f613[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')][_0x5ea9('0x15')]=_0x5ea9('0x25');_0x20f613[_0x5ea9('0xd')][_0x5be999['id']][_0x5ea9('0x33')][_0x5ea9('0x16')]=_0x157b78;_0x20f613[_0x5ea9('0x10')](_0x5be999['id']);_0x5d79ba(_0x157b78);});});}return this['smtp']['verify'](_0x5be999);};module[_0x5ea9('0x39')]=EmailChannel; \ No newline at end of file +var _0x2972=['verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','name','key','Imap','status','total','isNil','stringify','emit','mailAccount:update','prototype','refresh','hasOwnProperty','active','provider','custom','service','imapAccounts','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','send','verifySmtp','Smtp','verify'];(function(_0xcfed91,_0x29b51b){var _0x42e245=function(_0x1a131c){while(--_0x1a131c){_0xcfed91['push'](_0xcfed91['shift']());}};_0x42e245(++_0x29b51b);}(_0x2972,0xb6));var _0x2297=function(_0x5b4abf,_0x8817d0){_0x5b4abf=_0x5b4abf-0x0;var _0x98cf37=_0x2972[_0x5b4abf];return _0x98cf37;};'use strict';var _=require(_0x2297('0x0'));var moment=require(_0x2297('0x1'));var BPromise=require(_0x2297('0x2'));var md5=require(_0x2297('0x3'));var Redis=require(_0x2297('0x4'));var config=require(_0x2297('0x5'));var logger=require(_0x2297('0x6'))(_0x2297('0x7'));config[_0x2297('0x8')]=_[_0x2297('0x9')](config[_0x2297('0x8')],{'host':_0x2297('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2297('0x8')]));var EmailImap=require(_0x2297('0xb'));var EmailSmtp=require(_0x2297('0xc'));var mailAccount=require(_0x2297('0xd'));var md5Accounts={};function EmailChannel(_0x509749){logger[_0x2297('0xe')](_0x2297('0xf'));this['mailAccounts']=_0x509749[_0x2297('0x10')];this['imapAccounts']={};this[_0x2297('0x11')]=new EmailSmtp();}EmailChannel['prototype']['emit']=function(_0x9d564a){var _0x1f8051=this['mailAccounts'][_0x9d564a];var _0x1316a8={'id':_0x1f8051['id'],'name':_0x1f8051[_0x2297('0x12')],'key':_0x1f8051[_0x2297('0x13')],'active':_0x1f8051['active'],'Imap':{'status':_0x1f8051[_0x2297('0x14')][_0x2297('0x15')],'messageStatus':_0x1f8051[_0x2297('0x14')]['messageStatus'],'total':_0x1f8051[_0x2297('0x14')][_0x2297('0x16')]}};if(_[_0x2297('0x17')](md5Accounts[_0x9d564a])){md5Accounts[_0x9d564a]={};}var _0x47e94d=md5(JSON[_0x2297('0x18')](_0x1316a8));if(md5Accounts[_0x9d564a][_0x2297('0x3')]!==_0x47e94d){md5Accounts[_0x9d564a]['md5']=_0x47e94d;io[_0x2297('0x19')](_0x2297('0x1a'),_0x1316a8);}};EmailChannel[_0x2297('0x1b')][_0x2297('0x1c')]=function(_0x28239f){for(var _0x24fada in _0x28239f){if(_0x28239f[_0x2297('0x1d')](_0x24fada)){if(_0x28239f[_0x24fada][_0x2297('0x14')]&&_0x28239f[_0x24fada][_0x2297('0x1e')]){var _0x350bb6=_0x28239f[_0x24fada][_0x2297('0x14')];if(!_0x350bb6['service']&&_0x28239f[_0x24fada][_0x2297('0x1f')]!==_0x2297('0x20'))_0x350bb6[_0x2297('0x21')]=_0x28239f[_0x24fada][_0x2297('0x1f')];if(!this[_0x2297('0x22')][_0x2297('0x1d')](_0x350bb6['id'])){this[_0x2297('0x22')][_0x350bb6['id']]=new EmailImap(_0x350bb6,_0x28239f[_0x24fada][_0x2297('0x7')]);this[_0x2297('0x22')][_0x350bb6['id']]['on']('box',this[_0x2297('0x23')][_0x2297('0x24')](this,_0x24fada));this[_0x2297('0x22')][_0x350bb6['id']]['on'](_0x2297('0x7'),this[_0x2297('0x25')]['bind'](this,_0x24fada));this[_0x2297('0x22')][_0x350bb6['id']]['on']('end',this[_0x2297('0x26')][_0x2297('0x24')](this,_0x24fada));this[_0x2297('0x22')][_0x350bb6['id']]['on'](_0x2297('0x27'),this[_0x2297('0x28')]['bind'](this,_0x24fada));}}else{if(_[_0x2297('0x17')](this[_0x2297('0x10')][_0x24fada]['Imap'])){this['mailAccounts'][_0x24fada]['Imap']={};}this[_0x2297('0x10')][_0x24fada][_0x2297('0x14')][_0x2297('0x15')]='disabled';this['mailAccounts'][_0x24fada][_0x2297('0x14')][_0x2297('0x29')]='';this[_0x2297('0x19')](_0x24fada);}}}};EmailChannel[_0x2297('0x1b')][_0x2297('0x23')]=function(_0x267cbc,_0x7a3958){if(this[_0x2297('0x10')][_0x267cbc]){this[_0x2297('0x10')][_0x267cbc][_0x2297('0x14')]['status']=_0x2297('0x2a');this[_0x2297('0x10')][_0x267cbc]['Imap'][_0x2297('0x29')]=_0x7a3958[_0x2297('0x12')];if(_0x7a3958[_0x2297('0x2b')]){this[_0x2297('0x10')][_0x267cbc][_0x2297('0x14')][_0x2297('0x16')]=_0x7a3958[_0x2297('0x2b')][_0x2297('0x16')];}return this[_0x2297('0x19')](_0x267cbc);}};EmailChannel['prototype'][_0x2297('0x25')]=function(_0x3c13c6,_0x158fe4){logger['info'](_0x2297('0x2c'),_0x158fe4[_0x2297('0x2d')],_0x158fe4[_0x2297('0x2e')],_0x158fe4['from'],_0x3c13c6);if(this[_0x2297('0x10')][_0x3c13c6]){return mailAccount[_0x2297('0x2f')](_0x3c13c6,_0x158fe4)[_0x2297('0x30')](function(_0x1c7ae3){if(_0x1c7ae3){logger[_0x2297('0xe')](_0x2297('0x31'));}})[_0x2297('0x32')](function(_0x4058eb){logger[_0x2297('0x27')](_0x2297('0x33'),JSON[_0x2297('0x18')](_0x4058eb));});}};EmailChannel[_0x2297('0x1b')][_0x2297('0x26')]=function(_0x394e59){if(this[_0x2297('0x10')][_0x394e59]&&this[_0x2297('0x10')][_0x394e59][_0x2297('0x14')]){if(this[_0x2297('0x22')][this[_0x2297('0x10')][_0x394e59][_0x2297('0x14')]['id']]){delete this['imapAccounts'][this['mailAccounts'][_0x394e59][_0x2297('0x14')]['id']];}this['mailAccounts'][_0x394e59][_0x2297('0x14')][_0x2297('0x34')]=moment();this['emit'](_0x394e59);}};EmailChannel[_0x2297('0x1b')]['handleImapError']=function(_0x551e1f,_0x1d8e2c){if(this[_0x2297('0x10')][_0x551e1f]){this[_0x2297('0x10')][_0x551e1f][_0x2297('0x14')][_0x2297('0x15')]=_0x2297('0x27');this[_0x2297('0x10')][_0x551e1f][_0x2297('0x14')][_0x2297('0x29')]=_0x1d8e2c;return this[_0x2297('0x19')](_0x551e1f);}};EmailChannel[_0x2297('0x1b')][_0x2297('0x35')]=function(_0x12e282,_0x14cbaf){return this[_0x2297('0x11')][_0x2297('0x36')](_0x12e282,_0x14cbaf);};EmailChannel[_0x2297('0x1b')][_0x2297('0x37')]=function(_0x5d8aad){var _0xd8178e=this;if(this[_0x2297('0x10')][_0x5d8aad['id']]){if(_['isNil'](this[_0x2297('0x10')][_0x5d8aad['id']]['Smtp'])){this[_0x2297('0x10')][_0x5d8aad['id']]['Smtp']={};}this[_0x2297('0x10')][_0x5d8aad['id']][_0x2297('0x38')]['lastSync']=moment();return new BPromise(function(_0xe2dac1,_0x185ee5){return _0xd8178e[_0x2297('0x11')][_0x2297('0x39')](_0x5d8aad)[_0x2297('0x30')](function(_0x226ddf){_0xd8178e['mailAccounts'][_0x5d8aad['id']][_0x2297('0x38')][_0x2297('0x15')]=_0x2297('0x3a');_0xd8178e[_0x2297('0x10')][_0x5d8aad['id']][_0x2297('0x38')][_0x2297('0x29')]='';_0xd8178e[_0x2297('0x19')](_0x5d8aad['id']);_0xe2dac1(_0x226ddf);})[_0x2297('0x32')](function(_0x1462bc){_0xd8178e[_0x2297('0x10')][_0x5d8aad['id']][_0x2297('0x38')][_0x2297('0x15')]=_0x2297('0x27');_0xd8178e['mailAccounts'][_0x5d8aad['id']][_0x2297('0x38')]['messageStatus']=_0x1462bc;_0xd8178e[_0x2297('0x19')](_0x5d8aad['id']);_0x185ee5(_0x1462bc);});});}return this[_0x2297('0x11')][_0x2297('0x39')](_0x5d8aad);};module[_0x2297('0x3b')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 21a3e20..a3bda29 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 _0xc5db=['required','handleOpenBox','emit','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','body','attributes','handleMessageAttributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleFetchEnd','closeBox','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','Iconv','events','EventEmitter','./utils','mailbox','account','getAccount','handleReady','once','end','bind','error','handleError','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','email','anonymous@xcally.com','port','tls','autotls'];(function(_0x5b3e5a,_0xf8648f){var _0x5e24fd=function(_0x970818){while(--_0x970818){_0x5b3e5a['push'](_0x5b3e5a['shift']());}};_0x5e24fd(++_0xf8648f);}(_0xc5db,0x1cf));var _0xbc5d=function(_0x19e910,_0x2f376b){_0x19e910=_0x19e910-0x0;var _0x5f0dd5=_0xc5db[_0x19e910];return _0x5f0dd5;};'use strict';var _=require(_0xbc5d('0x0'));var util=require(_0xbc5d('0x1'));var Imap=require(_0xbc5d('0x2'));var simpleParser=require('mailparser')['simpleParser'];var Iconv=require('iconv')[_0xbc5d('0x3')];var EventEmitter=require(_0xbc5d('0x4'))[_0xbc5d('0x5')];var utils=require(_0xbc5d('0x6'));var logger=require('../../../config/logger')('email');function EmailImap(_0x11101c,_0x1572b9){this['mailbox']=_0x11101c[_0xbc5d('0x7')];this[_0xbc5d('0x8')]=this[_0xbc5d('0x9')](_0x11101c,_0x1572b9);this['imap']=new Imap(this[_0xbc5d('0x8')]);this['imap']['once']('ready',this[_0xbc5d('0xa')]['bind'](this));this[_0xbc5d('0x2')][_0xbc5d('0xb')](_0xbc5d('0xc'),this['handleEnd'][_0xbc5d('0xd')](this));this[_0xbc5d('0x2')]['on'](_0xbc5d('0xe'),this[_0xbc5d('0xf')][_0xbc5d('0xd')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xbc5d('0x10')][_0xbc5d('0x9')]=function(_0x361299,_0x535e76){var _0x2aa56e={'connTimeout':_0x361299[_0xbc5d('0x11')]?_0x361299[_0xbc5d('0x11')]*0x3e8:0x2710,'authTimeout':_0x361299[_0xbc5d('0x12')]?_0x361299[_0xbc5d('0x12')]*0x3e8:0x1388};if(_0x361299[_0xbc5d('0x13')]){_0x2aa56e[_0xbc5d('0x14')]=_0x361299[_0xbc5d('0x14')];if(_0x361299[_0xbc5d('0x15')]){_0x2aa56e[_0xbc5d('0x16')]=utils[_0xbc5d('0x17')](_0x361299[_0xbc5d('0x18')][_0xbc5d('0x19')],_0x361299['user']);}else{_0x2aa56e['password']=_0x361299[_0xbc5d('0x1a')];}}else{if(_0x361299['authentication']){_0x2aa56e['user']=_0x361299[_0xbc5d('0x14')];_0x2aa56e[_0xbc5d('0x1a')]=_0x361299['password'];}}_0x2aa56e[_0xbc5d('0x1b')]=_0x535e76||_0x361299[_0xbc5d('0x14')]||_0xbc5d('0x1c');_0x2aa56e['host']=_0x361299['host'];_0x2aa56e[_0xbc5d('0x1d')]=_0x361299[_0xbc5d('0x1d')]||0x3e1;if(_0x361299['tls']){_0x2aa56e[_0xbc5d('0x1e')]=!![];}else{_0x2aa56e['tls']=![];_0x2aa56e[_0xbc5d('0x1f')]=_0xbc5d('0x20');}return _0x2aa56e;};EmailImap[_0xbc5d('0x10')]['handleReady']=function(){this[_0xbc5d('0x2')]['openBox'](this['mailbox'],![],this[_0xbc5d('0x21')][_0xbc5d('0xd')](this));};EmailImap[_0xbc5d('0x10')][_0xbc5d('0x21')]=function(_0xf65381,_0x4a866b){if(_0xf65381){this['handleError'](_0xf65381,!![]);}else{this[_0xbc5d('0x22')]('box',_0x4a866b);this[_0xbc5d('0x23')]();}};EmailImap[_0xbc5d('0x10')]['handleCloseBox']=function(_0x2d1969){if(_0x2d1969){this[_0xbc5d('0xf')](_0x2d1969,!![]);}else{this['imap'][_0xbc5d('0xc')]();}};EmailImap[_0xbc5d('0x10')][_0xbc5d('0x23')]=function(){this[_0xbc5d('0x2')][_0xbc5d('0x24')]([_0xbc5d('0x25')],this['handleReadUnseen'][_0xbc5d('0xd')](this));};EmailImap['prototype'][_0xbc5d('0x26')]=function(_0x1a43e1,_0x37c688){if(_0x1a43e1){this[_0xbc5d('0xf')](_0x1a43e1,!![]);}else{if(_0x37c688[_0xbc5d('0x27')]){try{var _0x48ef3e=this[_0xbc5d('0x2')][_0xbc5d('0x28')](_0x37c688,{'bodies':'','markSeen':!![]});_0x48ef3e['on']('message',this[_0xbc5d('0x29')]['bind'](this));_0x48ef3e[_0xbc5d('0xb')](_0xbc5d('0xe'),this[_0xbc5d('0x2a')][_0xbc5d('0xd')](this));_0x48ef3e[_0xbc5d('0xb')](_0xbc5d('0xc'),this['handleFetchEnd'][_0xbc5d('0xd')](this));}catch(_0x66c899){logger[_0xbc5d('0xe')](_0x66c899);}}else{this[_0xbc5d('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xbc5d('0xd')](this));}}};EmailImap[_0xbc5d('0x10')]['handleFetchMessage']=function(_0x5467f6){_0x5467f6['on'](_0xbc5d('0x2b'),this['handleMessageBody'][_0xbc5d('0xd')](this));_0x5467f6['once'](_0xbc5d('0x2c'),this[_0xbc5d('0x2d')][_0xbc5d('0xd')](this));_0x5467f6[_0xbc5d('0xb')](_0xbc5d('0xc'),this[_0xbc5d('0x2e')][_0xbc5d('0xd')](this));};EmailImap['prototype'][_0xbc5d('0x2f')]=function(_0x367951){simpleParser(_0x367951,{'Iconv':Iconv},this[_0xbc5d('0x30')][_0xbc5d('0xd')](this));};EmailImap[_0xbc5d('0x10')][_0xbc5d('0x2d')]=function(){};EmailImap[_0xbc5d('0x10')][_0xbc5d('0x2e')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x20b158,_0x8f12){if(_0x20b158){logger[_0xbc5d('0xe')](_0x20b158);}else{var _0x4992b1=this;utils['parser'](this[_0xbc5d('0x8')],_0x8f12,function(_0x18ccb4){_0x4992b1[_0xbc5d('0x22')](_0xbc5d('0x1b'),_0x18ccb4);});}};EmailImap[_0xbc5d('0x10')][_0xbc5d('0x31')]=function(){this[_0xbc5d('0x2')][_0xbc5d('0x32')](!![],this['handleCloseBox'][_0xbc5d('0xd')](this));};EmailImap['prototype'][_0xbc5d('0x2a')]=function(_0x165a4b){this[_0xbc5d('0xf')](_0x165a4b);this[_0xbc5d('0x2')]['closeBox'](!![],this['handleCloseBox'][_0xbc5d('0xd')](this));};EmailImap['prototype']['handleEnd']=function(){this[_0xbc5d('0x22')](_0xbc5d('0xc'));};EmailImap[_0xbc5d('0x10')]['handleError']=function(_0x10a785,_0x198901){logger[_0xbc5d('0xe')]('handleError',this[_0xbc5d('0x8')][_0xbc5d('0x1b')],JSON[_0xbc5d('0x33')](_0x10a785));var _0x32ce66='';if(_0x10a785){if(_0x10a785['textCode']){_0x32ce66=_0x10a785[_0xbc5d('0x34')];}else{for(var _0x32097f in _0x10a785){if(_0x10a785[_0xbc5d('0x35')](_0x32097f)){_0x32ce66+=_['upperFirst'](_0x32097f)+':\x20'+_0x10a785[_0x32097f]+'\x0a';}}}}if(_0x198901){this[_0xbc5d('0x2')][_0xbc5d('0xc')]();}else{this[_0xbc5d('0x22')](_0xbc5d('0xe'),_0x32ce66);this[_0xbc5d('0x22')](_0xbc5d('0xc'));}};module[_0xbc5d('0x36')]=EmailImap; \ No newline at end of file +var _0xb225=['Iconv','events','EventEmitter','../../../config/logger','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','prototype','connTimeout','authTimeout','user','modernAuthentication','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','port','tls','autotls','required','handleOpenBox','emit','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','parser','stringify','textCode','hasOwnProperty','lodash','imap','mailparser','simpleParser'];(function(_0x24379f,_0x3ba24d){var _0x532f13=function(_0x17a8a9){while(--_0x17a8a9){_0x24379f['push'](_0x24379f['shift']());}};_0x532f13(++_0x3ba24d);}(_0xb225,0x1c4));var _0x5b22=function(_0x3c2b2e,_0x3e6e53){_0x3c2b2e=_0x3c2b2e-0x0;var _0x27a338=_0xb225[_0x3c2b2e];return _0x27a338;};'use strict';var _=require(_0x5b22('0x0'));var util=require('util');var Imap=require(_0x5b22('0x1'));var simpleParser=require(_0x5b22('0x2'))[_0x5b22('0x3')];var Iconv=require('iconv')[_0x5b22('0x4')];var EventEmitter=require(_0x5b22('0x5'))[_0x5b22('0x6')];var utils=require('./utils');var logger=require(_0x5b22('0x7'))('email');function EmailImap(_0x1b2787,_0x189100){this[_0x5b22('0x8')]=_0x1b2787[_0x5b22('0x8')];this[_0x5b22('0x9')]=this[_0x5b22('0xa')](_0x1b2787,_0x189100);this[_0x5b22('0x1')]=new Imap(this[_0x5b22('0x9')]);this[_0x5b22('0x1')][_0x5b22('0xb')](_0x5b22('0xc'),this['handleReady'][_0x5b22('0xd')](this));this[_0x5b22('0x1')]['once'](_0x5b22('0xe'),this[_0x5b22('0xf')]['bind'](this));this['imap']['on'](_0x5b22('0x10'),this[_0x5b22('0x11')][_0x5b22('0xd')](this));this[_0x5b22('0x1')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0x5b22('0x12')]['getAccount']=function(_0x5b5d9a,_0x229339){var _0x33d6bb={'connTimeout':_0x5b5d9a[_0x5b22('0x13')]?_0x5b5d9a[_0x5b22('0x13')]*0x3e8:0x2710,'authTimeout':_0x5b5d9a['authTimeout']?_0x5b5d9a[_0x5b22('0x14')]*0x3e8:0x1388};if(_0x5b5d9a['service']){_0x33d6bb[_0x5b22('0x15')]=_0x5b5d9a[_0x5b22('0x15')];if(_0x5b5d9a[_0x5b22('0x16')]){_0x33d6bb['xoauth2']=utils['generateXOAuth2Token'](_0x5b5d9a[_0x5b22('0x17')][_0x5b22('0x18')],_0x5b5d9a[_0x5b22('0x15')]);}else{_0x33d6bb[_0x5b22('0x19')]=_0x5b5d9a[_0x5b22('0x19')];}}else{if(_0x5b5d9a[_0x5b22('0x1a')]){_0x33d6bb[_0x5b22('0x15')]=_0x5b5d9a[_0x5b22('0x15')];_0x33d6bb[_0x5b22('0x19')]=_0x5b5d9a[_0x5b22('0x19')];}}_0x33d6bb[_0x5b22('0x1b')]=_0x229339||_0x5b5d9a[_0x5b22('0x15')]||_0x5b22('0x1c');_0x33d6bb['host']=_0x5b5d9a[_0x5b22('0x1d')];_0x33d6bb[_0x5b22('0x1e')]=_0x5b5d9a[_0x5b22('0x1e')]||0x3e1;if(_0x5b5d9a[_0x5b22('0x1f')]){_0x33d6bb[_0x5b22('0x1f')]=!![];}else{_0x33d6bb[_0x5b22('0x1f')]=![];_0x33d6bb[_0x5b22('0x20')]=_0x5b22('0x21');}return _0x33d6bb;};EmailImap[_0x5b22('0x12')]['handleReady']=function(){this['imap']['openBox'](this[_0x5b22('0x8')],![],this[_0x5b22('0x22')]['bind'](this));};EmailImap[_0x5b22('0x12')][_0x5b22('0x22')]=function(_0x2e9d95,_0x217552){if(_0x2e9d95){this[_0x5b22('0x11')](_0x2e9d95,!![]);}else{this[_0x5b22('0x23')](_0x5b22('0x24'),_0x217552);this[_0x5b22('0x25')]();}};EmailImap[_0x5b22('0x12')][_0x5b22('0x26')]=function(_0x2bbeec){if(_0x2bbeec){this[_0x5b22('0x11')](_0x2bbeec,!![]);}else{this[_0x5b22('0x1')][_0x5b22('0xe')]();}};EmailImap['prototype'][_0x5b22('0x25')]=function(){this[_0x5b22('0x1')][_0x5b22('0x27')]([_0x5b22('0x28')],this[_0x5b22('0x29')]['bind'](this));};EmailImap[_0x5b22('0x12')]['handleReadUnseen']=function(_0x4e80d7,_0x254d54){if(_0x4e80d7){this[_0x5b22('0x11')](_0x4e80d7,!![]);}else{if(_0x254d54['length']){try{var _0x2eb88a=this[_0x5b22('0x1')][_0x5b22('0x2a')](_0x254d54,{'bodies':'','markSeen':!![]});_0x2eb88a['on'](_0x5b22('0x2b'),this[_0x5b22('0x2c')][_0x5b22('0xd')](this));_0x2eb88a[_0x5b22('0xb')]('error',this[_0x5b22('0x2d')][_0x5b22('0xd')](this));_0x2eb88a[_0x5b22('0xb')](_0x5b22('0xe'),this[_0x5b22('0x2e')][_0x5b22('0xd')](this));}catch(_0x15fada){logger[_0x5b22('0x10')](_0x15fada);}}else{this['imap'][_0x5b22('0x2f')](!![],this[_0x5b22('0x26')][_0x5b22('0xd')](this));}}};EmailImap[_0x5b22('0x12')][_0x5b22('0x2c')]=function(_0x477316){_0x477316['on'](_0x5b22('0x30'),this['handleMessageBody'][_0x5b22('0xd')](this));_0x477316[_0x5b22('0xb')](_0x5b22('0x31'),this[_0x5b22('0x32')]['bind'](this));_0x477316['once'](_0x5b22('0xe'),this['handleMessageEnd'][_0x5b22('0xd')](this));};EmailImap[_0x5b22('0x12')][_0x5b22('0x33')]=function(_0x4c6b75){simpleParser(_0x4c6b75,{'Iconv':Iconv},this[_0x5b22('0x34')][_0x5b22('0xd')](this));};EmailImap[_0x5b22('0x12')][_0x5b22('0x32')]=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x5b22('0x12')][_0x5b22('0x34')]=function(_0x36638b,_0xbfedb8){if(_0x36638b){logger[_0x5b22('0x10')](_0x36638b);}else{var _0x28beb1=this;utils[_0x5b22('0x35')](this[_0x5b22('0x9')],_0xbfedb8,function(_0x365623){_0x28beb1[_0x5b22('0x23')](_0x5b22('0x1b'),_0x365623);});}};EmailImap[_0x5b22('0x12')][_0x5b22('0x2e')]=function(){this[_0x5b22('0x1')][_0x5b22('0x2f')](!![],this[_0x5b22('0x26')][_0x5b22('0xd')](this));};EmailImap[_0x5b22('0x12')][_0x5b22('0x2d')]=function(_0x3f1c90){this['handleError'](_0x3f1c90);this[_0x5b22('0x1')]['closeBox'](!![],this[_0x5b22('0x26')][_0x5b22('0xd')](this));};EmailImap[_0x5b22('0x12')]['handleEnd']=function(){this[_0x5b22('0x23')](_0x5b22('0xe'));};EmailImap['prototype'][_0x5b22('0x11')]=function(_0x1a9c31,_0x16cf32){logger[_0x5b22('0x10')]('handleError',this[_0x5b22('0x9')][_0x5b22('0x1b')],JSON[_0x5b22('0x36')](_0x1a9c31));var _0x420f94='';if(_0x1a9c31){if(_0x1a9c31[_0x5b22('0x37')]){_0x420f94=_0x1a9c31[_0x5b22('0x37')];}else{for(var _0x15424d in _0x1a9c31){if(_0x1a9c31[_0x5b22('0x38')](_0x15424d)){_0x420f94+=_['upperFirst'](_0x15424d)+':\x20'+_0x1a9c31[_0x15424d]+'\x0a';}}}}if(_0x16cf32){this[_0x5b22('0x1')][_0x5b22('0xe')]();}else{this[_0x5b22('0x23')](_0x5b22('0x10'),_0x420f94);this[_0x5b22('0x23')]('end');}};module['exports']=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index e2e2994..66e8d8f 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 _0xffc7=['use','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xffc7,0x103));var _0x7ffc=function(_0x106b94,_0xe7696d){_0x106b94=_0x106b94-0x0;var _0x1e79ff=_0xffc7[_0x106b94];return _0x1e79ff;};'use strict';var nodemailer=require(_0x7ffc('0x0'));var inlineBase64=require(_0x7ffc('0x1'));function EmailSmtp(){}EmailSmtp[_0x7ffc('0x2')][_0x7ffc('0x3')]=function(_0x4af33d,_0x4660d1){return new Promise(function(_0x99e19c,_0x15e2bc){var _0x328bf3=nodemailer[_0x7ffc('0x4')](_0x4af33d);_0x328bf3[_0x7ffc('0x5')](_0x7ffc('0x6'),inlineBase64());_0x328bf3[_0x7ffc('0x7')](_0x4660d1,function(_0x38138a,_0x105ef3){if(_0x38138a){_0x15e2bc(_0x38138a[_0x7ffc('0x8')]());}else{_0x99e19c(_0x105ef3);}});});};EmailSmtp[_0x7ffc('0x2')][_0x7ffc('0x9')]=function(_0x459482){return new Promise(function(_0x2d01a0,_0x2315f0){var _0x2d3a1d=nodemailer[_0x7ffc('0x4')](_0x459482);_0x2d3a1d[_0x7ffc('0x9')](function(_0x4fd2a4,_0x520f7a){if(_0x4fd2a4){_0x2315f0(_0x4fd2a4[_0x7ffc('0x8')]());}else{if(_0x520f7a){_0x2d01a0(_0x520f7a);}else{_0x2315f0(_0x7ffc('0xa'));}}});});};module[_0x7ffc('0xb')]=EmailSmtp; \ No newline at end of file +var _0x07b2=['Not\x20verifired','exports','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString','prototype','createTransport','verify'];(function(_0x181a4c,_0x934992){var _0x35f26e=function(_0x381a72){while(--_0x381a72){_0x181a4c['push'](_0x181a4c['shift']());}};_0x35f26e(++_0x934992);}(_0x07b2,0x1af));var _0x207b=function(_0x270b53,_0x4da250){_0x270b53=_0x270b53-0x0;var _0x1cf703=_0x07b2[_0x270b53];return _0x1cf703;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x207b('0x0'));function EmailSmtp(){}EmailSmtp['prototype'][_0x207b('0x1')]=function(_0xf4b458,_0x9d9b78){return new Promise(function(_0x34fc3c,_0x3013a1){var _0x62e854=nodemailer['createTransport'](_0xf4b458);_0x62e854[_0x207b('0x2')](_0x207b('0x3'),inlineBase64());_0x62e854[_0x207b('0x4')](_0x9d9b78,function(_0x137ace,_0x37ea0f){if(_0x137ace){_0x3013a1(_0x137ace[_0x207b('0x5')]());}else{_0x34fc3c(_0x37ea0f);}});});};EmailSmtp[_0x207b('0x6')]['verify']=function(_0x4be9fa){return new Promise(function(_0x14290d,_0x58e230){var _0x1b19fd=nodemailer[_0x207b('0x7')](_0x4be9fa);_0x1b19fd[_0x207b('0x8')](function(_0x548955,_0x3982b3){if(_0x548955){_0x58e230(_0x548955[_0x207b('0x5')]());}else{if(_0x3982b3){_0x14290d(_0x3982b3);}else{_0x58e230(_0x207b('0x9'));}}});});};module[_0x207b('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9d9bdc5..e96d601 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 _0xe155=['YYYY-MM-DD\x20HH:mm:ss','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','node-tnef','../../../config/logger','email','../../../config/environment','head','address','@xcally.com','value','name','substring','indexOf','slice','Anonymous','split','length','isEmpty','anonymous','generate','test','html','replace','attachments','forEach','push','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','message','originTo','includes','attach','type','filename','format','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','headerLines','Precedence:\x20auto_reply','from','messageId','inReplyTo','date'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0xe155,0x1eb));var _0x5e15=function(_0xfecc5d,_0x550192){_0xfecc5d=_0xfecc5d-0x0;var _0x56cee2=_0xe155[_0xfecc5d];return _0x56cee2;};'use strict';var _=require(_0x5e15('0x0'));var moment=require(_0x5e15('0x1'));var random=require(_0x5e15('0x2'));var fs=require('fs');var path=require(_0x5e15('0x3'));var util=require('util');var tnef=require(_0x5e15('0x4'));var logger=require(_0x5e15('0x5'))(_0x5e15('0x6'));var config=require(_0x5e15('0x7'));function getAddress(_0x304a09){var _0x485899=_[_0x5e15('0x8')](_0x304a09['value']);return _0x485899&&_0x485899[_0x5e15('0x9')]?_0x485899[_0x5e15('0x9')]:'anonymous'+random['generate'](0x6)+_0x5e15('0xa');}function getFirstName(_0x399443){var _0x153e39=_[_0x5e15('0x8')](_0x399443[_0x5e15('0xb')]);if(_0x153e39&&_0x153e39[_0x5e15('0xc')]){if(_0x153e39[_0x5e15('0xc')]==_0x153e39[_0x5e15('0x9')]){return _0x153e39[_0x5e15('0xc')][_0x5e15('0xd')](0x0,_0x153e39[_0x5e15('0xc')][_0x5e15('0xe')]('@'));}var _0x2feab1=_0x153e39[_0x5e15('0xc')]['split'](/\s+/);return _0x2feab1['length']>0x1?_0x2feab1[_0x5e15('0xf')](0x0,-0x1)['join']('\x20'):_0x153e39[_0x5e15('0xc')];}return _0x5e15('0x10');}function getLastName(_0x348330){var _0x544e3f=_[_0x5e15('0x8')](_0x348330['value']);if(_0x544e3f&&_0x544e3f[_0x5e15('0xc')]){var _0xdec5cf=_0x544e3f[_0x5e15('0xc')][_0x5e15('0x11')](/\s+/);return _0xdec5cf[_0x5e15('0x12')]>0x1?_0xdec5cf['pop']():'';}return'';}function getMails(_0x4b8a5f,_0x2d0b99){var _0x164b88='';for(var _0x155704=0x0;_0x155704<_0x2d0b99[_0x5e15('0xb')][_0x5e15('0x12')];_0x155704+=0x1){if(_0x2d0b99['value'][_0x155704][_0x5e15('0x9')]!==_0x4b8a5f){if(!_[_0x5e15('0x13')](_0x164b88)){_0x164b88+=',';}_0x164b88+=_0x2d0b99['value'][_0x155704][_0x5e15('0xc')]||_0x2d0b99[_0x5e15('0xb')][_0x155704]['address']||'';_0x164b88+='\x20<';_0x164b88+=_0x2d0b99[_0x5e15('0xb')][_0x155704]['address']?_0x2d0b99[_0x5e15('0xb')][_0x155704][_0x5e15('0x9')]:_0x5e15('0x14')+random[_0x5e15('0x15')](0x6)+'@xcally.com';_0x164b88+='>';}}return _0x164b88;}function parseEmail(_0x50abed,_0x2f38ba,_0x1c96b4){if(_0x2f38ba['html']){var _0x590efd=/)<[^<]*)*<\/script>/gi;while(_0x590efd[_0x5e15('0x16')](_0x2f38ba[_0x5e15('0x17')])){_0x2f38ba[_0x5e15('0x17')]=_0x2f38ba['html'][_0x5e15('0x18')](_0x590efd,'');}if(_0x2f38ba[_0x5e15('0x17')]['includes']('{_0x5dad9a[_0x5e15('0x1b')](_0x4b4301['filename']);});var _0x1b74ce=/]+>/g;var _0x471cca=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xb6b6ad=_0x2f38ba['html'][_0x5e15('0x18')](_0x471cca,'_SRC');var _0x259128=_0xb6b6ad[_0x5e15('0x18')](_0x1b74ce,'_IMG');for(let _0x56cb52=0x0;_0x56cb52<_0x5dad9a[_0x5e15('0x12')];_0x56cb52++){var _0x3e5b99=_0x259128[_0x5e15('0x18')](_0x5e15('0x1c'),_0x5e15('0x1d')+_0x5dad9a[_0x56cb52]+_0x5e15('0x1e'));_0x259128=_0x3e5b99;}_0x2f38ba[_0x5e15('0x17')]=_0x259128;}_0x1c96b4[_0x5e15('0x1f')]=_0x2f38ba[_0x5e15('0x17')];}else{_0x1c96b4[_0x5e15('0x1f')]=_0x2f38ba[_0x5e15('0x20')];}if(_0x1c96b4[_0x5e15('0x1f')]){_0x1c96b4[_0x5e15('0x1f')]=_0x1c96b4[_0x5e15('0x1f')][_0x5e15('0x18')](/0x0){var _0x1bbe88=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All',_0x5e15('0x30')];for(var _0x296942=0x0;_0x296942<_0x2f38ba[_0x5e15('0x2f')][_0x5e15('0x12')];_0x296942++){var _0x503674=_['indexOf'](_0x1bbe88,_0x2f38ba[_0x5e15('0x2f')][_0x296942]['line']);if(_0x503674>=0x0){_0x1c96b4['isAutoreply']=!![];}}}return _0x1c96b4;}exports['parser']=function(_0x34421e,_0x58eb8d,_0xd7527c){var _0x26e8c6={'from':getAddress(_0x58eb8d[_0x5e15('0x31')]),'firstName':getFirstName(_0x58eb8d['from']),'lastName':getLastName(_0x58eb8d[_0x5e15('0x31')]),'mapKey':_0x5e15('0x6'),'message':{'from':getMails(_0x34421e[_0x5e15('0x6')],_0x58eb8d[_0x5e15('0x31')]),'to':_0x34421e['email'],'cc':'','subject':_0x58eb8d['subject']||'','messageId':_0x58eb8d[_0x5e15('0x32')],'inReplyTo':_0x58eb8d[_0x5e15('0x33')],'sentAt':moment(_0x58eb8d[_0x5e15('0x34')])[_0x5e15('0x27')](_0x5e15('0x35')),'attach':![],'attachments':[]}};if(!_0x58eb8d[_0x5e15('0x17')]&&!_0x58eb8d['textAsHtml']){var _0x56e906=_['filter'](_0x58eb8d[_0x5e15('0x19')],{'contentType':_0x5e15('0x36')});if(_0x56e906[_0x5e15('0x12')]){logger['info'](util[_0x5e15('0x27')](_0x5e15('0x37'),_0x58eb8d['messageId']));tnef['parseBuffer'](_[_0x5e15('0x38')](_0x56e906)[_0x5e15('0x2e')],function(_0x15bf0a,_0x36e197){if(_0x36e197){_0x58eb8d[_0x5e15('0x17')]=_0x36e197[_0x5e15('0x39')]||_0x5e15('0x3a');if(_0x36e197[_0x5e15('0x3b')]){for(var _0x1d11d6=0x0;_0x1d11d6<_0x36e197[_0x5e15('0x3b')][_0x5e15('0x12')];_0x1d11d6++){var _0x285b19=_0x36e197[_0x5e15('0x3b')][_0x1d11d6];_0x26e8c6[_0x5e15('0x21')][_0x5e15('0x19')][_0x5e15('0x1b')]({'filename':_0x285b19[_0x5e15('0x3c')],'content':Buffer[_0x5e15('0x31')](_0x285b19[_0x5e15('0x3d')])});}}}_0xd7527c(parseEmail(_0x34421e,_0x58eb8d,_0x26e8c6));});}else{_0x58eb8d[_0x5e15('0x17')]=_0x5e15('0x3a');_0xd7527c(parseEmail(_0x34421e,_0x58eb8d,_0x26e8c6));}}else{_0xd7527c(parseEmail(_0x34421e,_0x58eb8d,_0x26e8c6));}};exports[_0x5e15('0x3e')]=function(_0x4c00a8,_0x502dda){var _0x177bda=[_0x5e15('0x3f')+(_0x502dda||''),_0x5e15('0x40')+_0x4c00a8,'',''];return Buffer[_0x5e15('0x31')](_0x177bda[_0x5e15('0x2a')](''),_0x5e15('0x41'))[_0x5e15('0x42')](_0x5e15('0x43'));}; \ No newline at end of file +var _0x4bba=['messageId','BodyHTML','Attachments','Title','

Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','util','node-tnef','../../../config/logger','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x5ccde8[_0xa4bb('0x10')](0x0,-0x1)[_0xa4bb('0x11')]('\x20'):_0x32da14[_0xa4bb('0xb')];}return _0xa4bb('0x12');}function getLastName(_0x5b7832){var _0x5744ee=_[_0xa4bb('0x6')](_0x5b7832['value']);if(_0x5744ee&&_0x5744ee[_0xa4bb('0xb')]){var _0x466557=_0x5744ee[_0xa4bb('0xb')][_0xa4bb('0xe')](/\s+/);return _0x466557[_0xa4bb('0xf')]>0x1?_0x466557[_0xa4bb('0x13')]():'';}return'';}function getMails(_0x337716,_0x172d21){var _0xaceda4='';for(var _0x4f10e1=0x0;_0x4f10e1<_0x172d21[_0xa4bb('0x7')][_0xa4bb('0xf')];_0x4f10e1+=0x1){if(_0x172d21[_0xa4bb('0x7')][_0x4f10e1][_0xa4bb('0x8')]!==_0x337716){if(!_[_0xa4bb('0x14')](_0xaceda4)){_0xaceda4+=',';}_0xaceda4+=_0x172d21['value'][_0x4f10e1][_0xa4bb('0xb')]||_0x172d21[_0xa4bb('0x7')][_0x4f10e1]['address']||'';_0xaceda4+='\x20<';_0xaceda4+=_0x172d21[_0xa4bb('0x7')][_0x4f10e1][_0xa4bb('0x8')]?_0x172d21[_0xa4bb('0x7')][_0x4f10e1][_0xa4bb('0x8')]:_0xa4bb('0x9')+random['generate'](0x6)+_0xa4bb('0xa');_0xaceda4+='>';}}return _0xaceda4;}function parseEmail(_0xcf6ad8,_0x5719e4,_0x423ee1){if(_0x5719e4[_0xa4bb('0x15')]){var _0x16afdd=/)<[^<]*)*<\/script>/gi;while(_0x16afdd[_0xa4bb('0x16')](_0x5719e4[_0xa4bb('0x15')])){_0x5719e4[_0xa4bb('0x15')]=_0x5719e4[_0xa4bb('0x15')][_0xa4bb('0x17')](_0x16afdd,'');}if(_0x5719e4[_0xa4bb('0x15')]['includes'](_0xa4bb('0x18'))){var _0x5d3eaa=[];_0x5719e4[_0xa4bb('0x19')]['forEach'](_0x51926c=>{_0x5d3eaa[_0xa4bb('0x1a')](_0x51926c[_0xa4bb('0x1b')]);});var _0x3a955d=/]+>/g;var _0x599d84=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x55f6f5=_0x5719e4[_0xa4bb('0x15')][_0xa4bb('0x17')](_0x599d84,_0xa4bb('0x1c'));var _0xe4f681=_0x55f6f5['replace'](_0x3a955d,_0xa4bb('0x1d'));for(let _0x150e54=0x0;_0x150e54<_0x5d3eaa[_0xa4bb('0xf')];_0x150e54++){var _0x537864=_0xe4f681['replace'](_0xa4bb('0x1d'),_0xa4bb('0x1e')+_0x5d3eaa[_0x150e54]+_0xa4bb('0x1f'));_0xe4f681=_0x537864;}_0x5719e4[_0xa4bb('0x15')]=_0xe4f681;}_0x423ee1[_0xa4bb('0x20')]=_0x5719e4[_0xa4bb('0x15')];}else{_0x423ee1['body']=_0x5719e4[_0xa4bb('0x21')];}if(_0x423ee1['body']){_0x423ee1[_0xa4bb('0x20')]=_0x423ee1[_0xa4bb('0x20')][_0xa4bb('0x17')](/0x0){var _0x46309c=[_0xa4bb('0x33'),_0xa4bb('0x34'),_0xa4bb('0x35')];for(var _0x4a5338=0x0;_0x4a5338<_0x5719e4[_0xa4bb('0x32')][_0xa4bb('0xf')];_0x4a5338++){var _0x38bc86=_['indexOf'](_0x46309c,_0x5719e4[_0xa4bb('0x32')][_0x4a5338][_0xa4bb('0x36')]);if(_0x38bc86>=0x0){_0x423ee1[_0xa4bb('0x37')]=!![];}}}return _0x423ee1;}exports[_0xa4bb('0x38')]=function(_0x35f820,_0x339314,_0x2b8336){var _0x440335={'from':getAddress(_0x339314['from']),'firstName':getFirstName(_0x339314['from']),'lastName':getLastName(_0x339314[_0xa4bb('0x39')]),'mapKey':_0xa4bb('0x25'),'message':{'from':getMails(_0x35f820[_0xa4bb('0x25')],_0x339314['from']),'to':_0x35f820[_0xa4bb('0x25')],'cc':'','subject':_0x339314['subject']||'','messageId':_0x339314['messageId'],'inReplyTo':_0x339314[_0xa4bb('0x3a')],'sentAt':moment(_0x339314[_0xa4bb('0x3b')])[_0xa4bb('0x3c')](_0xa4bb('0x3d')),'attach':![],'attachments':[]}};if(!_0x339314[_0xa4bb('0x15')]&&!_0x339314[_0xa4bb('0x21')]){var _0x1c8187=_['filter'](_0x339314[_0xa4bb('0x19')],{'contentType':_0xa4bb('0x3e')});if(_0x1c8187['length']){logger[_0xa4bb('0x3f')](util['format'](_0xa4bb('0x40'),_0x339314[_0xa4bb('0x41')]));tnef['parseBuffer'](_['first'](_0x1c8187)[_0xa4bb('0x30')],function(_0x2d8857,_0x1bb092){if(_0x1bb092){_0x339314[_0xa4bb('0x15')]=_0x1bb092[_0xa4bb('0x42')]||'

Empty\x20message

';if(_0x1bb092['Attachments']){for(var _0x7de44=0x0;_0x7de44<_0x1bb092[_0xa4bb('0x43')][_0xa4bb('0xf')];_0x7de44++){var _0x1424bd=_0x1bb092[_0xa4bb('0x43')][_0x7de44];_0x440335[_0xa4bb('0x23')][_0xa4bb('0x19')][_0xa4bb('0x1a')]({'filename':_0x1424bd[_0xa4bb('0x44')],'content':Buffer['from'](_0x1424bd['Data'])});}}}_0x2b8336(parseEmail(_0x35f820,_0x339314,_0x440335));});}else{_0x339314[_0xa4bb('0x15')]=_0xa4bb('0x45');_0x2b8336(parseEmail(_0x35f820,_0x339314,_0x440335));}}else{_0x2b8336(parseEmail(_0x35f820,_0x339314,_0x440335));}};exports[_0xa4bb('0x46')]=function(_0x248ac7,_0x40484b){var _0x1af54b=[_0xa4bb('0x47')+(_0x40484b||''),_0xa4bb('0x48')+_0x248ac7,'',''];return Buffer[_0xa4bb('0x39')](_0x1af54b[_0xa4bb('0x11')](''),_0xa4bb('0x49'))[_0xa4bb('0x4a')](_0xa4bb('0x4b'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 8733198..a561795 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 _0x3580=['key','Imap','Smtp','exports','name'];(function(_0x3e63af,_0x4239ad){var _0x11c411=function(_0x320722){while(--_0x320722){_0x3e63af['push'](_0x3e63af['shift']());}};_0x11c411(++_0x4239ad);}(_0x3580,0xef));var _0x0358=function(_0x3252f7,_0x1678e5){_0x3252f7=_0x3252f7-0x0;var _0x591cf0=_0x3580[_0x3252f7];return _0x591cf0;};'use strict';var _=require('lodash');function MailAccount(_0x5a8d8f){this['id']=_0x5a8d8f['id']||0x0;this[_0x0358('0x0')]=_0x5a8d8f['name']||'Service';this['key']=_0x5a8d8f[_0x0358('0x1')]||'SERV';this['active']=_0x5a8d8f['active']||![];this[_0x0358('0x2')]=_0x5a8d8f[_0x0358('0x2')]||[];this[_0x0358('0x3')]=_0x5a8d8f[_0x0358('0x3')]||[];}module[_0x0358('0x4')]=MailAccount; \ No newline at end of file +var _0x2f9c=['key','active','Imap','Smtp','exports','lodash','name','Service'];(function(_0x4c1200,_0x3cc36b){var _0x3d6a48=function(_0x7149d8){while(--_0x7149d8){_0x4c1200['push'](_0x4c1200['shift']());}};_0x3d6a48(++_0x3cc36b);}(_0x2f9c,0x135));var _0xc2f9=function(_0x1048ba,_0x31e6fb){_0x1048ba=_0x1048ba-0x0;var _0x44df10=_0x2f9c[_0x1048ba];return _0x44df10;};'use strict';var _=require(_0xc2f9('0x0'));function MailAccount(_0x221a4d){this['id']=_0x221a4d['id']||0x0;this[_0xc2f9('0x1')]=_0x221a4d['name']||_0xc2f9('0x2');this[_0xc2f9('0x3')]=_0x221a4d['key']||'SERV';this[_0xc2f9('0x4')]=_0x221a4d[_0xc2f9('0x4')]||![];this['Imap']=_0x221a4d[_0xc2f9('0x5')]||[];this[_0xc2f9('0x6')]=_0x221a4d[_0xc2f9('0x6')]||[];}module[_0xc2f9('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index dacf7f7..e8b13bf 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 _0x1fbb=['../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty','prototype','initMailAccounts','isUndefined','exports','lodash'];(function(_0x35956a,_0x3fd43f){var _0x2f060c=function(_0x103e2c){while(--_0x103e2c){_0x35956a['push'](_0x35956a['shift']());}};_0x2f060c(++_0x3fd43f);}(_0x1fbb,0xdb));var _0xb1fb=function(_0x3ec9cd,_0x583fdb){_0x3ec9cd=_0x3ec9cd-0x0;var _0x9b02e8=_0x1fbb[_0x3ec9cd];return _0x9b02e8;};'use strict';var _=require(_0xb1fb('0x0'));var MailAccount=require(_0xb1fb('0x1'));var Realtime=function(){this[_0xb1fb('0x2')]={};};function freeIsNotKey(_0x55586b,_0x441489,_0x51756c){var _0x493d0f=_[_0xb1fb('0x3')](_0x55586b,function(_0x38be9f,_0x18433c){return _0x38be9f[_0x51756c];});for(var _0x5f3740 in _0x441489){if(_0x441489['hasOwnProperty'](_0x5f3740)){if(!_0x493d0f[_0x5f3740]){delete _0x441489[_0x5f3740];}}}}Realtime['prototype'][_0xb1fb('0x4')]=function(_0x4c21dd,_0x3d0bf8){for(var _0x12d40d in _0x3d0bf8){if(_0x4c21dd[_0xb1fb('0x5')](_0x12d40d)){_0x4c21dd[_0x12d40d]=_0x3d0bf8[_0x12d40d];}}};Realtime[_0xb1fb('0x6')][_0xb1fb('0x7')]=function(){var _0x311ae4=this;return function(_0x3e23d1){if(_0x3e23d1){freeIsNotKey(_0x3e23d1,_0x311ae4[_0xb1fb('0x2')],'id');for(var _0x136684=0x0,_0x517fcd={},_0x2d2af3={};_0x136684<_0x3e23d1['length'];_0x136684+=0x1){_0x517fcd=_0x3e23d1[_0x136684];if(_[_0xb1fb('0x8')](_0x311ae4[_0xb1fb('0x2')][_0x517fcd['id']])){_0x311ae4[_0xb1fb('0x2')][_0x517fcd['id']]=new MailAccount(_0x517fcd);}else{_['merge'](_0x311ae4[_0xb1fb('0x2')][_0x517fcd['id']],_0x517fcd);}}}return _0x311ae4[_0xb1fb('0x2')];};};module[_0xb1fb('0x9')]=Realtime; \ No newline at end of file +var _0xbfad=['lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','initMailAccounts','mailAccounts','isUndefined','exports'];(function(_0x4a7e98,_0x250137){var _0x27d10d=function(_0x378768){while(--_0x378768){_0x4a7e98['push'](_0x4a7e98['shift']());}};_0x27d10d(++_0x250137);}(_0xbfad,0xe6));var _0xdbfa=function(_0x291798,_0x40e87c){_0x291798=_0x291798-0x0;var _0x57665a=_0xbfad[_0x291798];return _0x57665a;};'use strict';var _=require(_0xdbfa('0x0'));var MailAccount=require(_0xdbfa('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x47f423,_0x2dfa79,_0x370e55){var _0x5a3908=_[_0xdbfa('0x2')](_0x47f423,function(_0x9441f3,_0x1a086e){return _0x9441f3[_0x370e55];});for(var _0x2cb201 in _0x2dfa79){if(_0x2dfa79['hasOwnProperty'](_0x2cb201)){if(!_0x5a3908[_0x2cb201]){delete _0x2dfa79[_0x2cb201];}}}}Realtime[_0xdbfa('0x3')][_0xdbfa('0x4')]=function(_0x5bb19d,_0x52e980){for(var _0xa3c2a6 in _0x52e980){if(_0x5bb19d[_0xdbfa('0x5')](_0xa3c2a6)){_0x5bb19d[_0xa3c2a6]=_0x52e980[_0xa3c2a6];}}};Realtime['prototype'][_0xdbfa('0x6')]=function(){var _0x2670e2=this;return function(_0x58ea36){if(_0x58ea36){freeIsNotKey(_0x58ea36,_0x2670e2[_0xdbfa('0x7')],'id');for(var _0x4e8d00=0x0,_0x1b4b72={},_0x2fb4b1={};_0x4e8d00<_0x58ea36['length'];_0x4e8d00+=0x1){_0x1b4b72=_0x58ea36[_0x4e8d00];if(_[_0xdbfa('0x8')](_0x2670e2[_0xdbfa('0x7')][_0x1b4b72['id']])){_0x2670e2['mailAccounts'][_0x1b4b72['id']]=new MailAccount(_0x1b4b72);}else{_['merge'](_0x2670e2[_0xdbfa('0x7')][_0x1b4b72['id']],_0x1b4b72);}}}return _0x2670e2[_0xdbfa('0x7')];};};module[_0xdbfa('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 1244d5f..233b180 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 _0x463e=['data5','MailServerOut','getMailAccount','Request','../client','GetMailAccount','provider','service','active','key','ListId','Imap','CloudProvider','name','type'];(function(_0x5466d3,_0x3e47ae){var _0x147302=function(_0x5087aa){while(--_0x5087aa){_0x5466d3['push'](_0x5466d3['shift']());}};_0x147302(++_0x3e47ae);}(_0x463e,0x13f));var _0xe463=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x463e[_0x2bf141];return _0x48277b;};'use strict';var client=require(_0xe463('0x0'));exports['getMailAccounts']=function(){return function(){return client['Request'](_0xe463('0x1'),{'options':{'attributes':['id','name',_0xe463('0x2'),_0xe463('0x3'),'email',_0xe463('0x4'),_0xe463('0x5'),_0xe463('0x6'),'TemplateId'],'raw':![],'include':[{'model':'MailServerIn','as':_0xe463('0x7'),'include':[{'model':_0xe463('0x8'),'attributes':['id',_0xe463('0x9'),_0xe463('0x3'),_0xe463('0xa'),_0xe463('0xb')],'as':'CloudProvider'}]},{'model':_0xe463('0xc'),'as':'Smtp','include':[{'model':_0xe463('0x8'),'attributes':['id',_0xe463('0x9'),_0xe463('0x3'),_0xe463('0xa'),_0xe463('0xb')],'as':_0xe463('0x8')}]}]},'log':_0xe463('0xd')});};};exports['notify']=function(_0x47fcc2,_0x2bc616){return client[_0xe463('0xe')]('NotifyMailAccount',{'account':{'id':_0x47fcc2},'body':_0x2bc616,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x9c63=['MailServerIn','Imap','CloudProvider','type','data5','MailServerOut','Smtp','getMailAccount','notify','../client','getMailAccounts','Request','GetMailAccount','name','service','email','ListId','TemplateId'];(function(_0x5a3458,_0x1f6268){var _0xc94d5d=function(_0x195d47){while(--_0x195d47){_0x5a3458['push'](_0x5a3458['shift']());}};_0xc94d5d(++_0x1f6268);}(_0x9c63,0x1a7));var _0x39c6=function(_0x5b1354,_0x57840c){_0x5b1354=_0x5b1354-0x0;var _0x10ed24=_0x9c63[_0x5b1354];return _0x10ed24;};'use strict';var client=require(_0x39c6('0x0'));exports[_0x39c6('0x1')]=function(){return function(){return client[_0x39c6('0x2')](_0x39c6('0x3'),{'options':{'attributes':['id',_0x39c6('0x4'),'provider',_0x39c6('0x5'),_0x39c6('0x6'),'active','key',_0x39c6('0x7'),_0x39c6('0x8')],'raw':![],'include':[{'model':_0x39c6('0x9'),'as':_0x39c6('0xa'),'include':[{'model':_0x39c6('0xb'),'attributes':['id',_0x39c6('0x4'),'service',_0x39c6('0xc'),_0x39c6('0xd')],'as':_0x39c6('0xb')}]},{'model':_0x39c6('0xe'),'as':_0x39c6('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0x39c6('0x4'),'service',_0x39c6('0xc'),'data5'],'as':_0x39c6('0xb')}]}]},'log':_0x39c6('0x10')});};};exports[_0x39c6('0x11')]=function(_0x231669,_0x47f33b){return client[_0x39c6('0x2')]('NotifyMailAccount',{'account':{'id':_0x231669},'body':_0x47f33b,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 840b88c..7529263 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 _0x1c0d=['getSettings','Request','ShowSetting','loginMailFrequency','../client'];(function(_0x52bfa5,_0x42cf21){var _0x26f80b=function(_0x73c5b0){while(--_0x73c5b0){_0x52bfa5['push'](_0x52bfa5['shift']());}};_0x26f80b(++_0x42cf21);}(_0x1c0d,0x1b7));var _0xd1c0=function(_0x3cbd5a,_0x57f97a){_0x3cbd5a=_0x3cbd5a-0x0;var _0x13d5ef=_0x1c0d[_0x3cbd5a];return _0x13d5ef;};'use strict';var client=require(_0xd1c0('0x0'));exports[_0xd1c0('0x1')]=function(){return client[_0xd1c0('0x2')](_0xd1c0('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd1c0('0x4')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xe03a=['ShowSetting','GetSettings','getSettings','Request'];(function(_0x28aa7c,_0x149625){var _0x5e86c3=function(_0x3b179e){while(--_0x3b179e){_0x28aa7c['push'](_0x28aa7c['shift']());}};_0x5e86c3(++_0x149625);}(_0xe03a,0x1ca));var _0xae03=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe03a[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xae03('0x0')]=function(){return client[_0xae03('0x1')](_0xae03('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xae03('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index a0b466a..25a8f4c 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'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 c99bd7e..4ea7368 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 _0x02ba=['socket.io-redis','default','../../config/socketio','../../config/express','once','listening','log','lodash','http','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','redis','localhost'];(function(_0x1bf45a,_0x22784a){var _0x900069=function(_0x5e8624){while(--_0x5e8624){_0x1bf45a['push'](_0x1bf45a['shift']());}};_0x900069(++_0x22784a);}(_0x02ba,0x1a9));var _0xa02b=function(_0x980038,_0x543c9b){_0x980038=_0x980038-0x0;var _0x34ee15=_0x02ba[_0x980038];return _0x34ee15;};'use strict';var _=require(_0xa02b('0x0'));var http=require(_0xa02b('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xa02b('0x2'));var app=express();var server=http[_0xa02b('0x3')](app);server[_0xa02b('0x4')]=0xdbba0;if(sticky[_0xa02b('0x5')](server,config[_0xa02b('0x6')])){var socketio=require(_0xa02b('0x7'))(server,{'transports':[_0xa02b('0x8'),_0xa02b('0x9')]});config[_0xa02b('0xa')]=_['defaults'](config[_0xa02b('0xa')],{'host':_0xa02b('0xb'),'port':0x18eb});socketio['adapter'](require(_0xa02b('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0xa02b('0xa')])}));require('../../config/triggers')[_0xa02b('0xd')]();require(_0xa02b('0xe'))[_0xa02b('0xd')](socketio);require(_0xa02b('0xf'))[_0xa02b('0xd')](app);require('../../routes')[_0xa02b('0xd')](app);}else{server[_0xa02b('0x10')](_0xa02b('0x11'),function(){console[_0xa02b('0x12')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xa02b('0x6')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x1a72=['adapter','../../config/socketio','../../config/express','default','../../routes','once','exports','lodash','http','express','createServer','timeout','listen','port','socket.io','polling','redis','defaults'];(function(_0x55ff14,_0x39e0e7){var _0x30ccd5=function(_0xc67173){while(--_0xc67173){_0x55ff14['push'](_0x55ff14['shift']());}};_0x30ccd5(++_0x39e0e7);}(_0x1a72,0x14b));var _0x21a7=function(_0x2626f9,_0x54aed0){_0x2626f9=_0x2626f9-0x0;var _0x43a4fd=_0x1a72[_0x2626f9];return _0x43a4fd;};'use strict';var _=require(_0x21a7('0x0'));var http=require(_0x21a7('0x1'));var express=require(_0x21a7('0x2'));var sticky=require('sticky-session');var Redis=require('ioredis');var config=require('../../config/environment');var app=express();var server=http[_0x21a7('0x3')](app);server[_0x21a7('0x4')]=0xdbba0;if(sticky[_0x21a7('0x5')](server,config[_0x21a7('0x6')])){var socketio=require(_0x21a7('0x7'))(server,{'transports':['websocket',_0x21a7('0x8')]});config[_0x21a7('0x9')]=_[_0x21a7('0xa')](config[_0x21a7('0x9')],{'host':'localhost','port':0x18eb});socketio[_0x21a7('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0x21a7('0x9')]),'subClient':new Redis(config[_0x21a7('0x9')])}));require('../../config/triggers')['default']();require(_0x21a7('0xc'))['default'](socketio);require(_0x21a7('0xd'))[_0x21a7('0xe')](app);require(_0x21a7('0xf'))['default'](app);}else{server[_0x21a7('0x10')]('listening',function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x21a7('0x6')]);});}exports=module[_0x21a7('0x11')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index fb4fad2..ca80817 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 _0x3d63=['bluebird','../../config/logger','http','then','debug','rpc','error','message','catch','routing','jayson/promise'];(function(_0x141486,_0x58ed56){var _0x1b5fb9=function(_0x273fc0){while(--_0x273fc0){_0x141486['push'](_0x141486['shift']());}};_0x1b5fb9(++_0x58ed56);}(_0x3d63,0xa4));var _0x33d6=function(_0x3c424d,_0x5e00cd){_0x3c424d=_0x3c424d-0x0;var _0x520127=_0x3d63[_0x3c424d];return _0x520127;};'use strict';var jayson=require(_0x33d6('0x0'));var BPromise=require(_0x33d6('0x1'));var logger=require(_0x33d6('0x2'))('routing');var client=jayson['client'][_0x33d6('0x3')]({'port':0x2329});client['Request']=function(_0x3e9382,_0x4d4f17){return new BPromise(function(_0x2a1a0f,_0x32c34d){return client['request'](_0x3e9382,_0x4d4f17)[_0x33d6('0x4')](function(_0x306c4a){logger[_0x33d6('0x5')](_0x33d6('0x6'),'routing',_0x3e9382,_0x4d4f17,_0x306c4a);if(_0x306c4a[_0x33d6('0x7')]){logger[_0x33d6('0x7')](_0x33d6('0x6'),'routing',_0x3e9382,_0x306c4a[_0x33d6('0x7')][_0x33d6('0x8')],_0x4d4f17);return _0x32c34d(_0x306c4a[_0x33d6('0x7')][_0x33d6('0x8')]);}else{return _0x2a1a0f(_0x306c4a['result']);}})[_0x33d6('0x9')](function(_0x4dd1d1){logger[_0x33d6('0x7')]('rpc',_0x33d6('0xa'),_0x3e9382,_0x4dd1d1,_0x4d4f17);return _0x32c34d(_0x4dd1d1);});});};module['exports']=client; \ No newline at end of file +var _0x8343=['jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','result'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8343,0x82));var _0x3834=function(_0x59ed8b,_0x10c192){_0x59ed8b=_0x59ed8b-0x0;var _0x405376=_0x8343[_0x59ed8b];return _0x405376;};'use strict';var jayson=require(_0x3834('0x0'));var BPromise=require(_0x3834('0x1'));var logger=require(_0x3834('0x2'))(_0x3834('0x3'));var client=jayson[_0x3834('0x4')][_0x3834('0x5')]({'port':0x2329});client[_0x3834('0x6')]=function(_0x21b3ab,_0xf953a2){return new BPromise(function(_0x1d7f35,_0x3822b2){return client['request'](_0x21b3ab,_0xf953a2)[_0x3834('0x7')](function(_0x2b12f5){logger[_0x3834('0x8')](_0x3834('0x9'),_0x3834('0x3'),_0x21b3ab,_0xf953a2,_0x2b12f5);if(_0x2b12f5[_0x3834('0xa')]){logger[_0x3834('0xa')](_0x3834('0x9'),_0x3834('0x3'),_0x21b3ab,_0x2b12f5[_0x3834('0xa')][_0x3834('0xb')],_0xf953a2);return _0x3822b2(_0x2b12f5[_0x3834('0xa')]['message']);}else{return _0x1d7f35(_0x2b12f5[_0x3834('0xc')]);}})['catch'](function(_0x113433){logger[_0x3834('0xa')](_0x3834('0x9'),'routing',_0x21b3ab,_0x113433,_0xf953a2);return _0x3822b2(_0x113433);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 814f224..cb44e68 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 _0x0db5=['getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','getAgents','then','initAgents','initOpenchannelQueues','initChatQueues','getSmsQueues','getMailQueues'];(function(_0x5470f7,_0x287c0f){var _0x416a91=function(_0x56110b){while(--_0x56110b){_0x5470f7['push'](_0x5470f7['shift']());}};_0x416a91(++_0x287c0f);}(_0x0db5,0x96));var _0x50db=function(_0x56d080,_0x5c0eb4){_0x56d080=_0x56d080-0x0;var _0x1db2f3=_0x0db5[_0x56d080];return _0x1db2f3;};'use strict';var BPromise=require(_0x50db('0x0'));var server=require('./server');var Realtime=require(_0x50db('0x1'));var user=require(_0x50db('0x2'));var interval=require(_0x50db('0x3'));var openchannelQueue=require(_0x50db('0x4'));var chatQueue=require(_0x50db('0x5'));var smsQueue=require(_0x50db('0x6'));var mailQueue=require(_0x50db('0x7'));var faxQueue=require(_0x50db('0x8'));var whatsappQueue=require(_0x50db('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x50db('0xa')]()['then'](user[_0x50db('0xb')]())[_0x50db('0xc')](realtime[_0x50db('0xd')]())['then'](interval['getIntervals']())[_0x50db('0xc')](realtime['initIntervals']())['then'](openchannelQueue['getOpenchannelQueues']())[_0x50db('0xc')](realtime[_0x50db('0xe')]())[_0x50db('0xc')](chatQueue['getChatQueues']())[_0x50db('0xc')](realtime[_0x50db('0xf')]())['then'](smsQueue[_0x50db('0x10')]())[_0x50db('0xc')](realtime['initSmsQueues']())[_0x50db('0xc')](mailQueue[_0x50db('0x11')]())[_0x50db('0xc')](realtime['initMailQueues']())['then'](faxQueue[_0x50db('0x12')]())[_0x50db('0xc')](realtime[_0x50db('0x13')]())[_0x50db('0xc')](whatsappQueue[_0x50db('0x14')]())[_0x50db('0xc')](realtime[_0x50db('0x15')]())['then'](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x50db('0xc')](function(_0x2370be){return initRealtime();})[_0x50db('0xc')](function(_0x277955){return setInterval(initRealtime,0x1388);})[_0x50db('0x16')](function(_0x516182){console[_0x50db('0x17')](_0x516182);});}main(); \ No newline at end of file +var _0xeb47=['getFaxQueues','initFaxQueues','getWhatsappQueues','listen','log','./server','./rpc/chatQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','initMailQueues'];(function(_0x52e257,_0x16442c){var _0x590908=function(_0x1041dd){while(--_0x1041dd){_0x52e257['push'](_0x52e257['shift']());}};_0x590908(++_0x16442c);}(_0xeb47,0x12b));var _0x7eb4=function(_0x3bdc7e,_0xd106f8){_0x3bdc7e=_0x3bdc7e-0x0;var _0x532758=_0xeb47[_0x3bdc7e];return _0x532758;};'use strict';var BPromise=require('bluebird');var server=require(_0x7eb4('0x0'));var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x7eb4('0x1'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0x7eb4('0x2'));var faxQueue=require(_0x7eb4('0x3'));var whatsappQueue=require(_0x7eb4('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x7eb4('0x5')]()[_0x7eb4('0x6')](user[_0x7eb4('0x7')]())['then'](realtime[_0x7eb4('0x8')]())['then'](interval['getIntervals']())[_0x7eb4('0x6')](realtime[_0x7eb4('0x9')]())[_0x7eb4('0x6')](openchannelQueue[_0x7eb4('0xa')]())[_0x7eb4('0x6')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0x7eb4('0xb')]())[_0x7eb4('0x6')](realtime[_0x7eb4('0xc')]())['then'](smsQueue[_0x7eb4('0xd')]())[_0x7eb4('0x6')](realtime['initSmsQueues']())[_0x7eb4('0x6')](mailQueue[_0x7eb4('0xe')]())[_0x7eb4('0x6')](realtime[_0x7eb4('0xf')]())[_0x7eb4('0x6')](faxQueue[_0x7eb4('0x10')]())[_0x7eb4('0x6')](realtime[_0x7eb4('0x11')]())[_0x7eb4('0x6')](whatsappQueue[_0x7eb4('0x12')]())[_0x7eb4('0x6')](realtime['initWhatsappQueues']())[_0x7eb4('0x6')](function(){return realtime;});}function main(){return server[_0x7eb4('0x13')](realtime)[_0x7eb4('0x6')](function(_0x8edfa5){return initRealtime();})[_0x7eb4('0x6')](function(_0x471f07){return setInterval(initRealtime,0x1388);})['catch'](function(_0x522fb5){console[_0x7eb4('0x14')](_0x522fb5);});}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 a1c6bc8..81df514 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(_0x66524f,_0x437009){var _0x1f1b8e=function(_0xc30b81){while(--_0xc30b81){_0x66524f['push'](_0x66524f['shift']());}};_0x1f1b8e(++_0x437009);}(_0x814b,0x1a2));var _0xb814=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x814b[_0x30c2ae];return _0x1ee1cc;};'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 _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0xadbaeb,_0x13c8c9){var _0x3bb7f2=function(_0x4b4eb8){while(--_0x4b4eb8){_0xadbaeb['push'](_0xadbaeb['shift']());}};_0x3bb7f2(++_0x13c8c9);}(_0x326f,0xd1));var _0xf326=function(_0x17534e,_0x3974b2){_0x17534e=_0x17534e-0x0;var _0xe8dc79=_0x326f[_0x17534e];return _0xe8dc79;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 99b9654..4b6ff91 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 _0x81da=['result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','error'];(function(_0x166951,_0xb19500){var _0x28f1a1=function(_0x3cacd4){while(--_0x3cacd4){_0x166951['push'](_0x166951['shift']());}};_0x28f1a1(++_0xb19500);}(_0x81da,0x15a));var _0xa81d=function(_0x5a6a97,_0x417442){_0x5a6a97=_0x5a6a97-0x0;var _0x22a084=_0x81da[_0x5a6a97];return _0x22a084;};'use strict';var BPromise=require(_0xa81d('0x0'));var jayson=require(_0xa81d('0x1'));var client=jayson['client'][_0xa81d('0x2')]({'port':0x232b});function request(_0x247156,_0x3f65cf){return new BPromise(function(_0x46b7cf,_0x291a6e){return client[_0xa81d('0x3')](_0x247156,_0x3f65cf)['then'](function(_0x29dbfc){if(_0x29dbfc['error']){return _0x291a6e(_0x29dbfc[_0xa81d('0x4')]['message']);}else{return _0x46b7cf(_0x29dbfc[_0xa81d('0x5')]);}})[_0xa81d('0x6')](function(_0x20ab49){return _0x291a6e(_0x20ab49);});});}exports[_0xa81d('0x7')]=function(_0x256601,_0x56a37b){return request(_0xa81d('0x8'),{'account':_0x256601,'message':_0x56a37b});}; \ No newline at end of file +var _0x83c2=['http','request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x58bac5,_0x36c57c){var _0x3ce755=function(_0x204498){while(--_0x204498){_0x58bac5['push'](_0x58bac5['shift']());}};_0x3ce755(++_0x36c57c);}(_0x83c2,0x110));var _0x283c=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0x83c2[_0x5b64a1];return _0x4b6f55;};'use strict';var BPromise=require(_0x283c('0x0'));var jayson=require(_0x283c('0x1'));var client=jayson[_0x283c('0x2')][_0x283c('0x3')]({'port':0x232b});function request(_0x3674b4,_0x4e318d){return new BPromise(function(_0x43c4e3,_0x2215c1){return client[_0x283c('0x4')](_0x3674b4,_0x4e318d)[_0x283c('0x5')](function(_0x3aeb5e){if(_0x3aeb5e['error']){return _0x2215c1(_0x3aeb5e[_0x283c('0x6')][_0x283c('0x7')]);}else{return _0x43c4e3(_0x3aeb5e['result']);}})[_0x283c('0x8')](function(_0x155704){return _0x2215c1(_0x155704);});});}exports[_0x283c('0x9')]=function(_0x499560,_0x5e1986){return request(_0x283c('0xa'),{'account':_0x499560,'message':_0x5e1986});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index a3d32c3..dcb8503 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 _0x0598=['Status','StatusTime','toNumber','format','openchannelPause','chatStatusTime','chatCapacity','faxStatus','faxStatusTime','smsStatus','smsStatusTime','whatsappStatusTime','openchannelWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','ioredis','defaults','redis','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','whatsapp'];(function(_0x12565d,_0x5da3b6){var _0x5c8322=function(_0x2e1080){while(--_0x2e1080){_0x12565d['push'](_0x12565d['shift']());}};_0x5c8322(++_0x5da3b6);}(_0x0598,0x92));var _0x8059=function(_0x27cdfe,_0x52e941){_0x27cdfe=_0x27cdfe-0x0;var _0x39058c=_0x0598[_0x27cdfe];return _0x39058c;};'use strict';var _=require(_0x8059('0x0'));var md5=require(_0x8059('0x1'));var moment=require('moment');var Redis=require(_0x8059('0x2'));var config=require('../../../config/environment');config['redis']=_[_0x8059('0x3')](config[_0x8059('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x467206){this['id']=_0x467206['id']||0x0;this[_0x8059('0x5')]=_0x467206['name']||'';this['online']=_0x467206[_0x8059('0x6')]||!![];this[_0x8059('0x7')]=_0x467206[_0x8059('0x7')]||![];this[_0x8059('0x8')]=_0x467206['chatPause']||![];this['mailPause']=_0x467206[_0x8059('0x9')]||![];this[_0x8059('0xa')]=_0x467206[_0x8059('0xa')]||![];this[_0x8059('0xb')]=_0x467206[_0x8059('0xb')]||![];this['openchannelPause']=_0x467206['openchannelPause']||![];this[_0x8059('0xc')]=_0x8059('0xd');this['chatStatusTime']=0x0;this['chatCapacity']=_0x467206['chatCapacity']||0x0;this[_0x8059('0xe')]=0x0;this[_0x8059('0xf')]=_0x8059('0xd');this[_0x8059('0x10')]=0x0;this[_0x8059('0x11')]=_0x467206['mailCapacity']||0x0;this[_0x8059('0x12')]=0x0;this['faxStatus']=_0x8059('0xd');this['faxStatusTime']=0x0;this[_0x8059('0x13')]=_0x467206[_0x8059('0x13')]||0x0;this[_0x8059('0x14')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0x8059('0x15')]=_0x467206[_0x8059('0x15')]||0x0;this[_0x8059('0x16')]=0x0;this[_0x8059('0x17')]=_0x8059('0xd');this['whatsappStatusTime']=0x0;this[_0x8059('0x18')]=_0x467206[_0x8059('0x18')]||0x0;this[_0x8059('0x19')]=0x0;this[_0x8059('0x1a')]='unknown';this[_0x8059('0x1b')]=0x0;this['openchannelCapacity']=_0x467206[_0x8059('0x1c')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x8059('0x1d')]=![];this['busyQueue']=undefined;this[_0x8059('0x1')]='';this[_0x8059('0x1e')]={};this[_0x8059('0x1f')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this[_0x8059('0x20')]={};this[_0x8059('0x21')]={};this[_0x8059('0x22')]();}Agent[_0x8059('0x23')]['getChannelStatus']=function(_0x3bc226){if(this[_0x3bc226+_0x8059('0x24')]>0x0){if(this[_0x3bc226+_0x8059('0x25')]>0x0&&this[_0x3bc226+'CurrentCapacity']>=this[_0x3bc226+_0x8059('0x25')]){return _0x8059('0x26');}else{return _0x8059('0x27');}}else{return _0x8059('0x28');}};Agent['prototype'][_0x8059('0x22')]=function(){var _0x2cd179=[_0x8059('0x29'),_0x8059('0x2a'),_0x8059('0x2b'),'fax',_0x8059('0x2c'),_0x8059('0x2d')];for(var _0xd1fa7e=0x0;_0xd1fa7e<_0x2cd179['length'];_0xd1fa7e+=0x1){var _0x582321=this['getChannelStatus'](_0x2cd179[_0xd1fa7e]);if(this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2e')]!==_0x582321){this[_0x2cd179[_0xd1fa7e]+_0x8059('0x2f')]=_[_0x8059('0x30')](moment()[_0x8059('0x31')]('x'));}this[_0x2cd179[_0xd1fa7e]+'Status']=_0x582321;}var _0x1eb71b={'id':this['id'],'name':this['name'],'online':this[_0x8059('0x6')],'voicePause':this[_0x8059('0x7')],'chatPause':this['chatPause'],'mailPause':this[_0x8059('0x9')],'smsPause':this[_0x8059('0xb')],'faxPause':this[_0x8059('0xa')],'openchannelPause':this[_0x8059('0x32')],'chatStatus':this[_0x8059('0xc')],'chatStatusTime':this[_0x8059('0x33')],'chatCapacity':this[_0x8059('0x34')],'chatCurrentCapacity':this[_0x8059('0xe')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x8059('0x10')],'mailCapacity':this[_0x8059('0x11')],'mailCurrentCapacity':this[_0x8059('0x12')],'faxStatus':this[_0x8059('0x35')],'faxStatusTime':this[_0x8059('0x36')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x8059('0x14')],'smsStatus':this[_0x8059('0x37')],'smsStatusTime':this[_0x8059('0x38')],'smsCapacity':this[_0x8059('0x15')],'smsCurrentCapacity':this[_0x8059('0x16')],'whatsappStatus':this[_0x8059('0x17')],'whatsappStatusTime':this[_0x8059('0x39')],'whatsappCapacity':this[_0x8059('0x18')],'whatsappCurrentCapacity':this[_0x8059('0x19')],'openchannelStatus':this[_0x8059('0x1a')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x8059('0x1c')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x8059('0x1d')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x8059('0x1f')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x8059('0x3a')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0x8059('0x21')]};var _0x55ddda=md5(JSON[_0x8059('0x3b')](_0x1eb71b));if(this[_0x8059('0x1')]!==_0x55ddda){this['md5']=_0x55ddda;io[_0x8059('0x3c')](_0x8059('0x3d'),_[_0x8059('0x3e')](_0x1eb71b,['online']));}};module[_0x8059('0x3f')]=Agent; \ No newline at end of file +var _0xb145=['smsStatusTime','smsCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime','toNumber','smsCurrentCapacity','whatsappStatusTime','busy','openchannelWaitingInteractions','emit','user:routing:update','exports','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb145,0xa3));var _0x5b14=function(_0x5dc893,_0x431ff2){_0x5dc893=_0x5dc893-0x0;var _0x375099=_0xb145[_0x5dc893];return _0x375099;};'use strict';var _=require('lodash');var md5=require(_0x5b14('0x0'));var moment=require(_0x5b14('0x1'));var Redis=require(_0x5b14('0x2'));var config=require(_0x5b14('0x3'));config[_0x5b14('0x4')]=_[_0x5b14('0x5')](config[_0x5b14('0x4')],{'host':_0x5b14('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5b14('0x4')]));function Agent(_0x15490e){this['id']=_0x15490e['id']||0x0;this[_0x5b14('0x7')]=_0x15490e[_0x5b14('0x7')]||'';this['online']=_0x15490e[_0x5b14('0x8')]||!![];this[_0x5b14('0x9')]=_0x15490e[_0x5b14('0x9')]||![];this[_0x5b14('0xa')]=_0x15490e[_0x5b14('0xa')]||![];this['mailPause']=_0x15490e[_0x5b14('0xb')]||![];this[_0x5b14('0xc')]=_0x15490e['faxPause']||![];this[_0x5b14('0xd')]=_0x15490e[_0x5b14('0xd')]||![];this[_0x5b14('0xe')]=_0x15490e[_0x5b14('0xe')]||![];this[_0x5b14('0xf')]='unknown';this[_0x5b14('0x10')]=0x0;this['chatCapacity']=_0x15490e[_0x5b14('0x11')]||0x0;this[_0x5b14('0x12')]=0x0;this[_0x5b14('0x13')]=_0x5b14('0x14');this[_0x5b14('0x15')]=0x0;this[_0x5b14('0x16')]=_0x15490e['mailCapacity']||0x0;this[_0x5b14('0x17')]=0x0;this[_0x5b14('0x18')]=_0x5b14('0x14');this[_0x5b14('0x19')]=0x0;this[_0x5b14('0x1a')]=_0x15490e[_0x5b14('0x1a')]||0x0;this[_0x5b14('0x1b')]=0x0;this[_0x5b14('0x1c')]=_0x5b14('0x14');this[_0x5b14('0x1d')]=0x0;this[_0x5b14('0x1e')]=_0x15490e[_0x5b14('0x1e')]||0x0;this['smsCurrentCapacity']=0x0;this[_0x5b14('0x1f')]='unknown';this['whatsappStatusTime']=0x0;this['whatsappCapacity']=_0x15490e[_0x5b14('0x20')]||0x0;this[_0x5b14('0x21')]=0x0;this[_0x5b14('0x22')]=_0x5b14('0x14');this[_0x5b14('0x23')]=0x0;this[_0x5b14('0x24')]=_0x15490e[_0x5b14('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x5b14('0x0')]='';this[_0x5b14('0x25')]={};this[_0x5b14('0x26')]={};this[_0x5b14('0x27')]={};this['openchannelWaitingInteractions']={};this[_0x5b14('0x28')]={};this[_0x5b14('0x29')]={};this['updateRealtime']();}Agent[_0x5b14('0x2a')][_0x5b14('0x2b')]=function(_0x50951f){if(this[_0x50951f+_0x5b14('0x2c')]>0x0){if(this[_0x50951f+'Capacity']>0x0&&this[_0x50951f+'CurrentCapacity']>=this[_0x50951f+'Capacity']){return'maxcapacity';}else{return _0x5b14('0x2d');}}else{return _0x5b14('0x2e');}};Agent[_0x5b14('0x2a')]['updateRealtime']=function(){var _0x46f86a=[_0x5b14('0x2f'),_0x5b14('0x30'),_0x5b14('0x31'),_0x5b14('0x32'),_0x5b14('0x33'),_0x5b14('0x34')];for(var _0x205842=0x0;_0x205842<_0x46f86a[_0x5b14('0x35')];_0x205842+=0x1){var _0x4e9609=this[_0x5b14('0x2b')](_0x46f86a[_0x205842]);if(this[_0x46f86a[_0x205842]+_0x5b14('0x36')]!==_0x4e9609){this[_0x46f86a[_0x205842]+_0x5b14('0x37')]=_[_0x5b14('0x38')](moment()['format']('x'));}this[_0x46f86a[_0x205842]+_0x5b14('0x36')]=_0x4e9609;}var _0x18a76d={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x5b14('0x9')],'chatPause':this[_0x5b14('0xa')],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this[_0x5b14('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x5b14('0xf')],'chatStatusTime':this[_0x5b14('0x10')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x5b14('0x13')],'mailStatusTime':this[_0x5b14('0x15')],'mailCapacity':this[_0x5b14('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x5b14('0x18')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x5b14('0x1a')],'faxCurrentCapacity':this[_0x5b14('0x1b')],'smsStatus':this[_0x5b14('0x1c')],'smsStatusTime':this[_0x5b14('0x1d')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x5b14('0x39')],'whatsappStatus':this[_0x5b14('0x1f')],'whatsappStatusTime':this[_0x5b14('0x3a')],'whatsappCapacity':this[_0x5b14('0x20')],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x5b14('0x22')],'openchannelStatusTime':this[_0x5b14('0x23')],'openchannelCapacity':this[_0x5b14('0x24')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x5b14('0x3b')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0x5b14('0x25')],'faxWaitingInteractions':this[_0x5b14('0x26')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0x5b14('0x3c')],'smsWaitingInteractions':this[_0x5b14('0x28')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x32f097=md5(JSON['stringify'](_0x18a76d));if(this[_0x5b14('0x0')]!==_0x32f097){this[_0x5b14('0x0')]=_0x32f097;io[_0x5b14('0x3d')](_0x5b14('0x3e'),_['omit'](_0x18a76d,[_0x5b14('0x8')]));}};module[_0x5b14('0x3f')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 96366d8..cd0eb81 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 _0xae00=['Agents','waiting','md5','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','length','online','paused','available','stringify','format','emit','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy'];(function(_0x257280,_0x2921df){var _0xc4550e=function(_0x35bcfd){while(--_0x35bcfd){_0x257280['push'](_0x257280['shift']());}};_0xc4550e(++_0x2921df);}(_0xae00,0x145));var _0x0ae0=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0xae00[_0x3e6d5d];return _0x238923;};'use strict';var _=require(_0x0ae0('0x0'));var md5=require('md5');var util=require(_0x0ae0('0x1'));var Redis=require(_0x0ae0('0x2'));var config=require(_0x0ae0('0x3'));config[_0x0ae0('0x4')]=_[_0x0ae0('0x5')](config[_0x0ae0('0x4')],{'host':_0x0ae0('0x6'),'port':0x18eb});var io=require(_0x0ae0('0x7'))(new Redis(config[_0x0ae0('0x4')]));function ChatQueue(_0x5d58ac){this['id']=_0x5d58ac['id']||0x0;this[_0x0ae0('0x8')]=_0x5d58ac[_0x0ae0('0x8')]||'';this['timeout']=_0x5d58ac[_0x0ae0('0x9')]||0xa;this[_0x0ae0('0xa')]=_0x5d58ac[_0x0ae0('0xa')]||'beepall';this['Agents']=_0x5d58ac[_0x0ae0('0xb')];this['mapAgentsId']={};this[_0x0ae0('0xc')]=0x0;this[_0x0ae0('0xd')]='';this[_0x0ae0('0xe')]();this['updateRealtime']();}ChatQueue[_0x0ae0('0xf')][_0x0ae0('0xe')]=function(){var _0x26d437=this[_0x0ae0('0x10')]['_rr'];this[_0x0ae0('0x10')]=_[_0x0ae0('0x11')](this[_0x0ae0('0xb')],'id');this['mapAgentsId'][_0x0ae0('0x12')]=_0x26d437;};ChatQueue[_0x0ae0('0xf')][_0x0ae0('0x13')]=function(){this[_0x0ae0('0x14')]=0x0;this['paused']=0x0;for(var _0x5251cf=0x0;_0x5251cf=0x0?this['available']:0x0;var _0x53a6f0={'id':this['id'],'available':this[_0x0ae0('0x18')],'loggedIn':this[_0x0ae0('0x14')],'name':this[_0x0ae0('0x8')],'paused':this[_0x0ae0('0x17')],'waiting':this['waiting']};var _0x5307f3=md5(JSON[_0x0ae0('0x19')](_0x53a6f0));if(this[_0x0ae0('0xd')]!==_0x5307f3){this[_0x0ae0('0xd')]=_0x5307f3;io['to'](util[_0x0ae0('0x1a')]('chat:queue:%s',_0x53a6f0['name']))[_0x0ae0('0x1b')]('chat_queue:save',_0x53a6f0);}};module['exports']=ChatQueue; \ No newline at end of file +var _0xa27d=['prototype','map','_rr','paused','length','loggedIn','chatPause','available','stringify','format','chat:queue:%s','emit','exports','lodash','util','../../../config/environment','redis','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime'];(function(_0x8de006,_0x58e930){var _0x1511b4=function(_0x98f524){while(--_0x98f524){_0x8de006['push'](_0x8de006['shift']());}};_0x1511b4(++_0x58e930);}(_0xa27d,0x109));var _0xda27=function(_0x2622f2,_0xeb6538){_0x2622f2=_0x2622f2-0x0;var _0x500f5b=_0xa27d[_0x2622f2];return _0x500f5b;};'use strict';var _=require(_0xda27('0x0'));var md5=require('md5');var util=require(_0xda27('0x1'));var Redis=require('ioredis');var config=require(_0xda27('0x2'));config['redis']=_['defaults'](config[_0xda27('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0xda27('0x4'))(new Redis(config[_0xda27('0x3')]));function ChatQueue(_0xb48224){this['id']=_0xb48224['id']||0x0;this[_0xda27('0x5')]=_0xb48224[_0xda27('0x5')]||'';this[_0xda27('0x6')]=_0xb48224['timeout']||0xa;this[_0xda27('0x7')]=_0xb48224[_0xda27('0x7')]||_0xda27('0x8');this['Agents']=_0xb48224[_0xda27('0x9')];this[_0xda27('0xa')]={};this[_0xda27('0xb')]=0x0;this[_0xda27('0xc')]='';this[_0xda27('0xd')]();this[_0xda27('0xe')]();}ChatQueue[_0xda27('0xf')][_0xda27('0xd')]=function(){var _0x36f366=this[_0xda27('0xa')]['_rr'];this[_0xda27('0xa')]=_[_0xda27('0x10')](this[_0xda27('0x9')],'id');this['mapAgentsId'][_0xda27('0x11')]=_0x36f366;};ChatQueue[_0xda27('0xf')][_0xda27('0xe')]=function(){this['loggedIn']=0x0;this[_0xda27('0x12')]=0x0;for(var _0x4d1df4=0x0;_0x4d1df4=0x0?this[_0xda27('0x16')]:0x0;var _0x36fa29={'id':this['id'],'available':this['available'],'loggedIn':this[_0xda27('0x14')],'name':this[_0xda27('0x5')],'paused':this[_0xda27('0x12')],'waiting':this[_0xda27('0xb')]};var _0x484ead=md5(JSON[_0xda27('0x17')](_0x36fa29));if(this[_0xda27('0xc')]!==_0x484ead){this[_0xda27('0xc')]=_0x484ead;io['to'](util[_0xda27('0x18')](_0xda27('0x19'),_0x36fa29['name']))[_0xda27('0x1a')]('chat_queue:save',_0x36fa29);}};module[_0xda27('0x1b')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 21b22e8..80f0c1d 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 _0x0469=['socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x109669,_0x171b55){var _0x3492fe=function(_0x40155a){while(--_0x40155a){_0x109669['push'](_0x109669['shift']());}};_0x3492fe(++_0x171b55);}(_0x0469,0xa1));var _0x9046=function(_0x46d6c4,_0x4158fa){_0x46d6c4=_0x46d6c4-0x0;var _0x245800=_0x0469[_0x46d6c4];return _0x245800;};'use strict';var _=require(_0x9046('0x0'));var md5=require(_0x9046('0x1'));var util=require('util');var Redis=require(_0x9046('0x2'));var config=require(_0x9046('0x3'));config[_0x9046('0x4')]=_[_0x9046('0x5')](config[_0x9046('0x4')],{'host':_0x9046('0x6'),'port':0x18eb});var io=require(_0x9046('0x7'))(new Redis(config['redis']));function FaxQueue(_0x3fc007){this['id']=_0x3fc007['id']||0x0;this[_0x9046('0x8')]=_0x3fc007[_0x9046('0x8')]||'';this[_0x9046('0x9')]=_0x3fc007['timeout']||0xa;this[_0x9046('0xa')]=_0x3fc007[_0x9046('0xa')]||'beepall';this[_0x9046('0xb')]=_0x3fc007[_0x9046('0xb')];this[_0x9046('0xc')]={};this[_0x9046('0xd')]=0x0;this[_0x9046('0x1')]='';this['updateRouting']();this[_0x9046('0xe')]();}FaxQueue['prototype'][_0x9046('0xf')]=function(){var _0x2d1e71=this[_0x9046('0xc')][_0x9046('0x10')];this[_0x9046('0xc')]=_[_0x9046('0x11')](this[_0x9046('0xb')],'id');this[_0x9046('0xc')][_0x9046('0x10')]=_0x2d1e71;};FaxQueue['prototype'][_0x9046('0xe')]=function(){this[_0x9046('0x12')]=0x0;this[_0x9046('0x13')]=0x0;for(var _0x54919a=0x0;_0x54919a=0x0?this['available']:0x0;var _0x2e7d05={'id':this['id'],'available':this[_0x9046('0x15')],'loggedIn':this[_0x9046('0x12')],'name':this[_0x9046('0x8')],'paused':this[_0x9046('0x13')],'waiting':this['waiting']};var _0x4d0946=md5(JSON[_0x9046('0x16')](_0x2e7d05));if(this[_0x9046('0x1')]!==_0x4d0946){this['md5']=_0x4d0946;io['to'](util[_0x9046('0x17')](_0x9046('0x18'),_0x2e7d05[_0x9046('0x8')]))[_0x9046('0x19')](_0x9046('0x1a'),_0x2e7d05);}};module[_0x9046('0x1b')]=FaxQueue; \ No newline at end of file +var _0xf59d=['util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','faxPause','available','stringify','format','fax:queue:%s','fax_queue:save','exports','md5'];(function(_0x39094b,_0x89d87){var _0xd07aea=function(_0x266c5b){while(--_0x266c5b){_0x39094b['push'](_0x39094b['shift']());}};_0xd07aea(++_0x89d87);}(_0xf59d,0x195));var _0xdf59=function(_0x2ce425,_0x1779a8){_0x2ce425=_0x2ce425-0x0;var _0x53e4cf=_0xf59d[_0x2ce425];return _0x53e4cf;};'use strict';var _=require('lodash');var md5=require(_0xdf59('0x0'));var util=require(_0xdf59('0x1'));var Redis=require(_0xdf59('0x2'));var config=require(_0xdf59('0x3'));config[_0xdf59('0x4')]=_[_0xdf59('0x5')](config['redis'],{'host':_0xdf59('0x6'),'port':0x18eb});var io=require(_0xdf59('0x7'))(new Redis(config[_0xdf59('0x4')]));function FaxQueue(_0x2e3d5d){this['id']=_0x2e3d5d['id']||0x0;this[_0xdf59('0x8')]=_0x2e3d5d[_0xdf59('0x8')]||'';this[_0xdf59('0x9')]=_0x2e3d5d[_0xdf59('0x9')]||0xa;this[_0xdf59('0xa')]=_0x2e3d5d[_0xdf59('0xa')]||'beepall';this[_0xdf59('0xb')]=_0x2e3d5d[_0xdf59('0xb')];this[_0xdf59('0xc')]={};this[_0xdf59('0xd')]=0x0;this[_0xdf59('0x0')]='';this[_0xdf59('0xe')]();this[_0xdf59('0xf')]();}FaxQueue[_0xdf59('0x10')]['updateRouting']=function(){var _0x249841=this['mapAgentsId'][_0xdf59('0x11')];this[_0xdf59('0xc')]=_[_0xdf59('0x12')](this['Agents'],'id');this['mapAgentsId'][_0xdf59('0x11')]=_0x249841;};FaxQueue[_0xdf59('0x10')][_0xdf59('0xf')]=function(){this[_0xdf59('0x13')]=0x0;this[_0xdf59('0x14')]=0x0;for(var _0x33487f=0x0;_0x33487f=0x0?this['available']:0x0;var _0x430daf={'id':this['id'],'available':this[_0xdf59('0x17')],'loggedIn':this[_0xdf59('0x13')],'name':this[_0xdf59('0x8')],'paused':this[_0xdf59('0x14')],'waiting':this[_0xdf59('0xd')]};var _0x3af178=md5(JSON[_0xdf59('0x18')](_0x430daf));if(this['md5']!==_0x3af178){this[_0xdf59('0x0')]=_0x3af178;io['to'](util[_0xdf59('0x19')](_0xdf59('0x1a'),_0x430daf[_0xdf59('0x8')]))['emit'](_0xdf59('0x1b'),_0x430daf);}};module[_0xdf59('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 9630982..92d8360 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 _0xa5c4=['Intervals','name'];(function(_0x529100,_0x1d7106){var _0x24fa64=function(_0x3dc1af){while(--_0x3dc1af){_0x529100['push'](_0x529100['shift']());}};_0x24fa64(++_0x1d7106);}(_0xa5c4,0x1b1));var _0x4a5c=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0xa5c4[_0x368e09];return _0x14b7df;};'use strict';function Interval(_0x518656){this['id']=_0x518656['id']||0x0;this[_0x4a5c('0x0')]=_0x518656[_0x4a5c('0x0')]||'';this[_0x4a5c('0x1')]=_0x518656['Intervals']||{};}module['exports']=Interval; \ No newline at end of file +var _0xe09c=['Intervals','name'];(function(_0x10ab10,_0x41f631){var _0x3bb60f=function(_0x4750e5){while(--_0x4750e5){_0x10ab10['push'](_0x10ab10['shift']());}};_0x3bb60f(++_0x41f631);}(_0xe09c,0xc3));var _0xce09=function(_0x8092dd,_0x3035d8){_0x8092dd=_0x8092dd-0x0;var _0x4d8c7f=_0xe09c[_0x8092dd];return _0x4d8c7f;};'use strict';function Interval(_0x2b7256){this['id']=_0x2b7256['id']||0x0;this[_0xce09('0x0')]=_0x2b7256['name']||'';this[_0xce09('0x1')]=_0x2b7256[_0xce09('0x1')]||{};}module['exports']=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 5047e40..a36102c 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 _0xafa7=['name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','mail:queue:%s','mail_queue:save','exports','lodash','util','ioredis','redis','localhost','socket.io-emitter'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xafa7,0x1bc));var _0x7afa=function(_0x5a7d5f,_0x5695cb){_0x5a7d5f=_0x5a7d5f-0x0;var _0x5dcded=_0xafa7[_0x5a7d5f];return _0x5dcded;};'use strict';var _=require(_0x7afa('0x0'));var md5=require('md5');var util=require(_0x7afa('0x1'));var Redis=require(_0x7afa('0x2'));var config=require('../../../config/environment');config[_0x7afa('0x3')]=_['defaults'](config['redis'],{'host':_0x7afa('0x4'),'port':0x18eb});var io=require(_0x7afa('0x5'))(new Redis(config['redis']));function MailQueue(_0x28d76e){this['id']=_0x28d76e['id']||0x0;this[_0x7afa('0x6')]=_0x28d76e['name']||'';this[_0x7afa('0x7')]=_0x28d76e['timeout']||0xa;this[_0x7afa('0x8')]=_0x28d76e[_0x7afa('0x8')]||_0x7afa('0x9');this[_0x7afa('0xa')]=_0x28d76e[_0x7afa('0xa')];this[_0x7afa('0xb')]={};this['waiting']=0x0;this[_0x7afa('0xc')]='';this[_0x7afa('0xd')]();this['updateRealtime']();}MailQueue[_0x7afa('0xe')]['updateRouting']=function(){var _0x46639a=this[_0x7afa('0xb')][_0x7afa('0xf')];this['mapAgentsId']=_[_0x7afa('0x10')](this['Agents'],'id');this[_0x7afa('0xb')][_0x7afa('0xf')]=_0x46639a;};MailQueue[_0x7afa('0xe')][_0x7afa('0x11')]=function(){this[_0x7afa('0x12')]=0x0;this['paused']=0x0;for(var _0x21880e=0x0;_0x21880e=0x0?this[_0x7afa('0x17')]:0x0;var _0x647ba8={'id':this['id'],'available':this[_0x7afa('0x17')],'loggedIn':this['loggedIn'],'name':this[_0x7afa('0x6')],'paused':this['paused'],'waiting':this[_0x7afa('0x18')]};var _0x4c9714=md5(JSON[_0x7afa('0x19')](_0x647ba8));if(this[_0x7afa('0xc')]!==_0x4c9714){this[_0x7afa('0xc')]=_0x4c9714;io['to'](util[_0x7afa('0x1a')](_0x7afa('0x1b'),_0x647ba8[_0x7afa('0x6')]))['emit'](_0x7afa('0x1c'),_0x647ba8);}};module[_0x7afa('0x1d')]=MailQueue; \ No newline at end of file +var _0x2ee2=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','length','online','loggedIn','mailPause','paused','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name'];(function(_0x3bb99f,_0x809eb6){var _0x1cfe1d=function(_0x1017e0){while(--_0x1017e0){_0x3bb99f['push'](_0x3bb99f['shift']());}};_0x1cfe1d(++_0x809eb6);}(_0x2ee2,0x160));var _0x22ee=function(_0x1fa760,_0x1bf063){_0x1fa760=_0x1fa760-0x0;var _0xd8eda1=_0x2ee2[_0x1fa760];return _0xd8eda1;};'use strict';var _=require(_0x22ee('0x0'));var md5=require(_0x22ee('0x1'));var util=require('util');var Redis=require(_0x22ee('0x2'));var config=require(_0x22ee('0x3'));config[_0x22ee('0x4')]=_[_0x22ee('0x5')](config[_0x22ee('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x22ee('0x6'))(new Redis(config[_0x22ee('0x4')]));function MailQueue(_0x15929b){this['id']=_0x15929b['id']||0x0;this['name']=_0x15929b[_0x22ee('0x7')]||'';this[_0x22ee('0x8')]=_0x15929b['timeout']||0xa;this[_0x22ee('0x9')]=_0x15929b[_0x22ee('0x9')]||_0x22ee('0xa');this[_0x22ee('0xb')]=_0x15929b[_0x22ee('0xb')];this[_0x22ee('0xc')]={};this[_0x22ee('0xd')]=0x0;this['md5']='';this[_0x22ee('0xe')]();this[_0x22ee('0xf')]();}MailQueue[_0x22ee('0x10')][_0x22ee('0xe')]=function(){var _0x5e29c8=this[_0x22ee('0xc')][_0x22ee('0x11')];this[_0x22ee('0xc')]=_[_0x22ee('0x12')](this[_0x22ee('0xb')],'id');this[_0x22ee('0xc')][_0x22ee('0x11')]=_0x5e29c8;};MailQueue[_0x22ee('0x10')][_0x22ee('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4edea9=0x0;_0x4edea9=0x0?this['available']:0x0;var _0x36fc10={'id':this['id'],'available':this[_0x22ee('0x18')],'loggedIn':this[_0x22ee('0x15')],'name':this['name'],'paused':this[_0x22ee('0x17')],'waiting':this[_0x22ee('0xd')]};var _0x7a10b1=md5(JSON['stringify'](_0x36fc10));if(this[_0x22ee('0x1')]!==_0x7a10b1){this[_0x22ee('0x1')]=_0x7a10b1;io['to'](util[_0x22ee('0x19')](_0x22ee('0x1a'),_0x36fc10[_0x22ee('0x7')]))[_0x22ee('0x1b')](_0x22ee('0x1c'),_0x36fc10);}};module[_0x22ee('0x1d')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 72f6dd0..d119a88 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(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x1261,0x144));var _0x1126=function(_0x13a094,_0x250688){_0x13a094=_0x13a094-0x0;var _0xa3d083=_0x1261[_0x13a094];return _0xa3d083;};'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 _0x2ef3=['stringify','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','timeout','strategy','beepall','Agents','mapAgentsId','waiting','prototype','updateRouting','_rr','paused','length','online','available','loggedIn','name'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0x2ef3,0xba));var _0x32ef=function(_0xad7b48,_0x4a0ca1){_0xad7b48=_0xad7b48-0x0;var _0x16cdd2=_0x2ef3[_0xad7b48];return _0x16cdd2;};'use strict';var _=require(_0x32ef('0x0'));var md5=require(_0x32ef('0x1'));var util=require(_0x32ef('0x2'));var Redis=require(_0x32ef('0x3'));var config=require(_0x32ef('0x4'));config[_0x32ef('0x5')]=_['defaults'](config[_0x32ef('0x5')],{'host':_0x32ef('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32ef('0x5')]));function OpenchannelQueue(_0x37dd1d){this['id']=_0x37dd1d['id']||0x0;this['name']=_0x37dd1d['name']||'';this[_0x32ef('0x7')]=_0x37dd1d[_0x32ef('0x7')]||0xa;this[_0x32ef('0x8')]=_0x37dd1d[_0x32ef('0x8')]||_0x32ef('0x9');this[_0x32ef('0xa')]=_0x37dd1d[_0x32ef('0xa')];this[_0x32ef('0xb')]={};this[_0x32ef('0xc')]=0x0;this[_0x32ef('0x1')]='';this['updateRouting']();this['updateRealtime']();}OpenchannelQueue[_0x32ef('0xd')][_0x32ef('0xe')]=function(){var _0x45bfd5=this[_0x32ef('0xb')]['_rr'];this[_0x32ef('0xb')]=_['map'](this[_0x32ef('0xa')],'id');this['mapAgentsId'][_0x32ef('0xf')]=_0x45bfd5;};OpenchannelQueue[_0x32ef('0xd')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x32ef('0x10')]=0x0;for(var _0x4d8009=0x0;_0x4d8009=0x0?this[_0x32ef('0x13')]:0x0;var _0x286bfb={'id':this['id'],'available':this['available'],'loggedIn':this[_0x32ef('0x14')],'name':this[_0x32ef('0x15')],'paused':this['paused'],'waiting':this[_0x32ef('0xc')]};var _0x314ef1=md5(JSON[_0x32ef('0x16')](_0x286bfb));if(this[_0x32ef('0x1')]!==_0x314ef1){this[_0x32ef('0x1')]=_0x314ef1;io['to'](util[_0x32ef('0x17')]('openchannel:queue:%s',_0x286bfb[_0x32ef('0x15')]))['emit'](_0x32ef('0x18'),_0x286bfb);}};module[_0x32ef('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7f50887..194585a 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 _0x063c=['paused','length','online','loggedIn','smsPause','available','waiting','stringify','format','emit','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','updateRealtime'];(function(_0x31fee1,_0x8d0b5){var _0x834e13=function(_0x16d2df){while(--_0x16d2df){_0x31fee1['push'](_0x31fee1['shift']());}};_0x834e13(++_0x8d0b5);}(_0x063c,0xba));var _0xc063=function(_0x176c9e,_0x2717f9){_0x176c9e=_0x176c9e-0x0;var _0xdee434=_0x063c[_0x176c9e];return _0xdee434;};'use strict';var _=require('lodash');var md5=require(_0xc063('0x0'));var util=require(_0xc063('0x1'));var Redis=require(_0xc063('0x2'));var config=require(_0xc063('0x3'));config[_0xc063('0x4')]=_[_0xc063('0x5')](config['redis'],{'host':_0xc063('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x59b81f){this['id']=_0x59b81f['id']||0x0;this[_0xc063('0x7')]=_0x59b81f[_0xc063('0x7')]||'';this['timeout']=_0x59b81f[_0xc063('0x8')]||0xa;this[_0xc063('0x9')]=_0x59b81f[_0xc063('0x9')]||_0xc063('0xa');this['Agents']=_0x59b81f[_0xc063('0xb')];this[_0xc063('0xc')]={};this['waiting']=0x0;this[_0xc063('0x0')]='';this[_0xc063('0xd')]();this['updateRealtime']();}SmsQueue[_0xc063('0xe')]['updateRouting']=function(){var _0x54c605=this['mapAgentsId'][_0xc063('0xf')];this[_0xc063('0xc')]=_['map'](this[_0xc063('0xb')],'id');this['mapAgentsId'][_0xc063('0xf')]=_0x54c605;};SmsQueue[_0xc063('0xe')][_0xc063('0x10')]=function(){this['loggedIn']=0x0;this[_0xc063('0x11')]=0x0;for(var _0x1249b2=0x0;_0x1249b2=0x0?this['available']:0x0;var _0x238ecb={'id':this['id'],'available':this[_0xc063('0x16')],'loggedIn':this[_0xc063('0x14')],'name':this[_0xc063('0x7')],'paused':this['paused'],'waiting':this[_0xc063('0x17')]};var _0x28d3ce=md5(JSON[_0xc063('0x18')](_0x238ecb));if(this['md5']!==_0x28d3ce){this[_0xc063('0x0')]=_0x28d3ce;io['to'](util[_0xc063('0x19')]('sms:queue:%s',_0x238ecb[_0xc063('0x7')]))[_0xc063('0x1a')](_0xc063('0x1b'),_0x238ecb);}};module[_0xc063('0x1c')]=SmsQueue; \ No newline at end of file +var _0x7764=['updateRealtime','prototype','_rr','map','paused','length','online','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting'];(function(_0x12fc36,_0x6530d3){var _0x55c667=function(_0x39ed70){while(--_0x39ed70){_0x12fc36['push'](_0x12fc36['shift']());}};_0x55c667(++_0x6530d3);}(_0x7764,0xa4));var _0x4776=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x7764[_0x221ba2];return _0x47d08e;};'use strict';var _=require(_0x4776('0x0'));var md5=require(_0x4776('0x1'));var util=require(_0x4776('0x2'));var Redis=require(_0x4776('0x3'));var config=require(_0x4776('0x4'));config[_0x4776('0x5')]=_[_0x4776('0x6')](config[_0x4776('0x5')],{'host':_0x4776('0x7'),'port':0x18eb});var io=require(_0x4776('0x8'))(new Redis(config['redis']));function SmsQueue(_0x5a1e38){this['id']=_0x5a1e38['id']||0x0;this[_0x4776('0x9')]=_0x5a1e38[_0x4776('0x9')]||'';this['timeout']=_0x5a1e38[_0x4776('0xa')]||0xa;this[_0x4776('0xb')]=_0x5a1e38['strategy']||'beepall';this[_0x4776('0xc')]=_0x5a1e38['Agents'];this[_0x4776('0xd')]={};this[_0x4776('0xe')]=0x0;this[_0x4776('0x1')]='';this[_0x4776('0xf')]();this[_0x4776('0x10')]();}SmsQueue[_0x4776('0x11')][_0x4776('0xf')]=function(){var _0x3fb889=this[_0x4776('0xd')][_0x4776('0x12')];this[_0x4776('0xd')]=_[_0x4776('0x13')](this[_0x4776('0xc')],'id');this[_0x4776('0xd')][_0x4776('0x12')]=_0x3fb889;};SmsQueue[_0x4776('0x11')]['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x4776('0x14')]=0x0;for(var _0x46429e=0x0;_0x46429e=0x0?this[_0x4776('0x19')]:0x0;var _0xed81b5={'id':this['id'],'available':this[_0x4776('0x19')],'loggedIn':this['loggedIn'],'name':this[_0x4776('0x9')],'paused':this[_0x4776('0x14')],'waiting':this['waiting']};var _0x3659fa=md5(JSON[_0x4776('0x1a')](_0xed81b5));if(this[_0x4776('0x1')]!==_0x3659fa){this[_0x4776('0x1')]=_0x3659fa;io['to'](util['format'](_0x4776('0x1b'),_0xed81b5[_0x4776('0x9')]))[_0x4776('0x1c')](_0x4776('0x1d'),_0xed81b5);}};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 944435f..a9cefed 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 _0xf45e=['loggedIn','paused','length','whatsappPause','available','stringify','format','whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr'];(function(_0x38e870,_0x3d2e6a){var _0x2dabbe=function(_0x3ddea3){while(--_0x3ddea3){_0x38e870['push'](_0x38e870['shift']());}};_0x2dabbe(++_0x3d2e6a);}(_0xf45e,0xa0));var _0xef45=function(_0x12ab8e,_0xe231cc){_0x12ab8e=_0x12ab8e-0x0;var _0x488cf3=_0xf45e[_0x12ab8e];return _0x488cf3;};'use strict';var _=require(_0xef45('0x0'));var md5=require(_0xef45('0x1'));var util=require(_0xef45('0x2'));var Redis=require(_0xef45('0x3'));var config=require(_0xef45('0x4'));config['redis']=_[_0xef45('0x5')](config['redis'],{'host':_0xef45('0x6'),'port':0x18eb});var io=require(_0xef45('0x7'))(new Redis(config[_0xef45('0x8')]));function WhatsappQueue(_0x266ced){this['id']=_0x266ced['id']||0x0;this[_0xef45('0x9')]=_0x266ced[_0xef45('0x9')]||'';this[_0xef45('0xa')]=_0x266ced[_0xef45('0xa')]||0xa;this[_0xef45('0xb')]=_0x266ced[_0xef45('0xb')]||'beepall';this[_0xef45('0xc')]=_0x266ced['Agents'];this['mapAgentsId']={};this[_0xef45('0xd')]=0x0;this[_0xef45('0x1')]='';this[_0xef45('0xe')]();this[_0xef45('0xf')]();}WhatsappQueue[_0xef45('0x10')][_0xef45('0xe')]=function(){var _0x418731=this[_0xef45('0x11')]['_rr'];this['mapAgentsId']=_[_0xef45('0x12')](this[_0xef45('0xc')],'id');this[_0xef45('0x11')][_0xef45('0x13')]=_0x418731;};WhatsappQueue[_0xef45('0x10')][_0xef45('0xf')]=function(){this[_0xef45('0x14')]=0x0;this[_0xef45('0x15')]=0x0;for(var _0xa21385=0x0;_0xa21385=0x0?this['available']:0x0;var _0x27067e={'id':this['id'],'available':this[_0xef45('0x18')],'loggedIn':this[_0xef45('0x14')],'name':this[_0xef45('0x9')],'paused':this[_0xef45('0x15')],'waiting':this[_0xef45('0xd')]};var _0x5de664=md5(JSON[_0xef45('0x19')](_0x27067e));if(this[_0xef45('0x1')]!==_0x5de664){this['md5']=_0x5de664;io['to'](util[_0xef45('0x1a')](_0xef45('0x1b'),_0x27067e[_0xef45('0x9')]))[_0xef45('0x1c')]('whatsapp_queue:save',_0x27067e);}};module[_0xef45('0x1d')]=WhatsappQueue; \ No newline at end of file +var _0xfb4d=['whatsapp:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','_rr','prototype','updateRealtime','loggedIn','paused','length','online','available','format'];(function(_0x214ff9,_0x4780da){var _0xdb0edc=function(_0x4f1b58){while(--_0x4f1b58){_0x214ff9['push'](_0x214ff9['shift']());}};_0xdb0edc(++_0x4780da);}(_0xfb4d,0x1f0));var _0xdfb4=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xfb4d[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xdfb4('0x0'));var md5=require(_0xdfb4('0x1'));var util=require(_0xdfb4('0x2'));var Redis=require(_0xdfb4('0x3'));var config=require(_0xdfb4('0x4'));config[_0xdfb4('0x5')]=_[_0xdfb4('0x6')](config[_0xdfb4('0x5')],{'host':_0xdfb4('0x7'),'port':0x18eb});var io=require(_0xdfb4('0x8'))(new Redis(config[_0xdfb4('0x5')]));function WhatsappQueue(_0x4bab08){this['id']=_0x4bab08['id']||0x0;this[_0xdfb4('0x9')]=_0x4bab08['name']||'';this[_0xdfb4('0xa')]=_0x4bab08[_0xdfb4('0xa')]||0xa;this[_0xdfb4('0xb')]=_0x4bab08[_0xdfb4('0xb')]||_0xdfb4('0xc');this[_0xdfb4('0xd')]=_0x4bab08[_0xdfb4('0xd')];this[_0xdfb4('0xe')]={};this[_0xdfb4('0xf')]=0x0;this[_0xdfb4('0x1')]='';this[_0xdfb4('0x10')]();this['updateRealtime']();}WhatsappQueue['prototype'][_0xdfb4('0x10')]=function(){var _0x2037c3=this[_0xdfb4('0xe')][_0xdfb4('0x11')];this['mapAgentsId']=_['map'](this[_0xdfb4('0xd')],'id');this[_0xdfb4('0xe')][_0xdfb4('0x11')]=_0x2037c3;};WhatsappQueue[_0xdfb4('0x12')][_0xdfb4('0x13')]=function(){this[_0xdfb4('0x14')]=0x0;this[_0xdfb4('0x15')]=0x0;for(var _0x73f1c9=0x0;_0x73f1c9=0x0?this['available']:0x0;var _0x54fc08={'id':this['id'],'available':this[_0xdfb4('0x18')],'loggedIn':this[_0xdfb4('0x14')],'name':this[_0xdfb4('0x9')],'paused':this[_0xdfb4('0x15')],'waiting':this[_0xdfb4('0xf')]};var _0x4cf112=md5(JSON['stringify'](_0x54fc08));if(this[_0xdfb4('0x1')]!==_0x4cf112){this[_0xdfb4('0x1')]=_0x4cf112;io['to'](util[_0xdfb4('0x19')](_0xdfb4('0x1a'),_0x54fc08[_0xdfb4('0x9')]))[_0xdfb4('0x1b')]('whatsapp_queue:save',_0x54fc08);}};module[_0xdfb4('0x1c')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 8435f95..8e87a7c 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0xe9268a,_0x288eca){var _0x4460fe=function(_0x31f522){while(--_0x31f522){_0xe9268a['push'](_0xe9268a['shift']());}};_0x4460fe(++_0x288eca);}(_0xb10b,0x12a));var _0xbb10=function(_0x1465dc,_0x4d684d){_0x1465dc=_0x1465dc-0x0;var _0x226206=_0xb10b[_0x1465dc];return _0x226206;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 6ea8f3c..688da99 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 _0x39e0=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x68fd48,_0x1e359f){var _0x4135c1=function(_0x47bb4b){while(--_0x47bb4b){_0x68fd48['push'](_0x68fd48['shift']());}};_0x4135c1(++_0x1e359f);}(_0x39e0,0x97));var _0x039e=function(_0x586b25,_0x50949a){_0x586b25=_0x586b25-0x0;var _0x945cb4=_0x39e0[_0x586b25];return _0x945cb4;};'use strict';var client=require(_0x039e('0x0'));exports[_0x039e('0x1')]=function(_0x86056b,_0x2892b6){return client[_0x039e('0x2')](_0x039e('0x3'),{'body':_0x2892b6,'options':{'where':{'id':_0x86056b}},'log':_0x039e('0x4')});};exports[_0x039e('0x5')]=function(_0x553a09,_0x2b2836){return client[_0x039e('0x2')](_0x039e('0x6'),{'body':_0x2b2836,'options':{'where':{'id':_0x553a09}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xeaf5=['addTags','../client','Request','updateChatInteraction'];(function(_0x196b93,_0x4a78a0){var _0x2eea5c=function(_0x2bcb37){while(--_0x2bcb37){_0x196b93['push'](_0x196b93['shift']());}};_0x2eea5c(++_0x4a78a0);}(_0xeaf5,0x175));var _0x5eaf=function(_0x21c23e,_0x1d33e3){_0x21c23e=_0x21c23e-0x0;var _0xa7b7e2=_0xeaf5[_0x21c23e];return _0xa7b7e2;};'use strict';var client=require(_0x5eaf('0x0'));exports['update']=function(_0x462ce4,_0x225b6f){return client[_0x5eaf('0x1')]('UpdateChatInteraction',{'body':_0x225b6f,'options':{'where':{'id':_0x462ce4}},'log':_0x5eaf('0x2')});};exports[_0x5eaf('0x3')]=function(_0xc7c46,_0x50df1b){return client[_0x5eaf('0x1')]('AddTagsToChatInteraction',{'body':_0x50df1b,'options':{'where':{'id':_0xc7c46}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 5bedc08..991b8a5 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 _0x108a=['../client','create','Request','createChatMessage'];(function(_0xfc406a,_0x4479e1){var _0x395473=function(_0x1fe8b6){while(--_0x1fe8b6){_0xfc406a['push'](_0xfc406a['shift']());}};_0x395473(++_0x4479e1);}(_0x108a,0x110));var _0xa108=function(_0x3aa0ab,_0x51f36e){_0x3aa0ab=_0x3aa0ab-0x0;var _0x3be662=_0x108a[_0x3aa0ab];return _0x3be662;};'use strict';var client=require(_0xa108('0x0'));exports[_0xa108('0x1')]=function(_0x3063b0){return client[_0xa108('0x2')]('CreateChatMessage',{'body':_0x3063b0,'log':_0xa108('0x3')});}; \ No newline at end of file +var _0xfc48=['../client','Request','CreateChatMessage'];(function(_0x102193,_0x55033b){var _0x386250=function(_0x3ce59d){while(--_0x3ce59d){_0x102193['push'](_0x102193['shift']());}};_0x386250(++_0x55033b);}(_0xfc48,0x6c));var _0x8fc4=function(_0x49d426,_0x14423c){_0x49d426=_0x49d426-0x0;var _0x1e7840=_0xfc48[_0x49d426];return _0x1e7840;};'use strict';var client=require(_0x8fc4('0x0'));exports['create']=function(_0x2d8c2a){return client[_0x8fc4('0x1')](_0x8fc4('0x2'),{'body':_0x2d8c2a,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 49f6d13..0165958 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 _0x8ad5=['chatPause','../client','getChatQueues','Request','GetChatQueue','strategy','User','Agents','name','online'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x8ad5,0xf1));var _0x58ad=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x8ad5[_0x46aff0];return _0x9d78cf;};'use strict';var client=require(_0x58ad('0x0'));exports[_0x58ad('0x1')]=function(){return function(){return client[_0x58ad('0x2')](_0x58ad('0x3'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x58ad('0x4')],'include':[{'model':_0x58ad('0x5'),'as':_0x58ad('0x6'),'attributes':['id',_0x58ad('0x7'),_0x58ad('0x8'),_0x58ad('0x9')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0xcea5=['User','Agents','chatPause','../client','getChatQueues','Request','GetChatQueue','name','strategy'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xcea5,0xed));var _0x5cea=function(_0x532e77,_0x41c8ac){_0x532e77=_0x532e77-0x0;var _0x49b76f=_0xcea5[_0x532e77];return _0x49b76f;};'use strict';var client=require(_0x5cea('0x0'));exports[_0x5cea('0x1')]=function(){return function(){return client[_0x5cea('0x2')](_0x5cea('0x3'),{'options':{'raw':![],'attributes':['id',_0x5cea('0x4'),'timeout',_0x5cea('0x5')],'include':[{'model':_0x5cea('0x6'),'as':_0x5cea('0x7'),'attributes':['id',_0x5cea('0x4'),'online',_0x5cea('0x8')]}]},'log':_0x5cea('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 6ae90ba..302a960 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 _0x777f=['CreateChatQueueReport','update','UpdateChatQueueReport','../client','create','Request'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x777f,0x9f));var _0xf777=function(_0x9a3e0f,_0x2f796d){_0x9a3e0f=_0x9a3e0f-0x0;var _0x3d2a9a=_0x777f[_0x9a3e0f];return _0x3d2a9a;};'use strict';var client=require(_0xf777('0x0'));exports[_0xf777('0x1')]=function(_0x41dd3a){return client[_0xf777('0x2')](_0xf777('0x3'),{'body':_0x41dd3a,'log':_0xf777('0x3')});};exports[_0xf777('0x4')]=function(_0x2612fe,_0x508470){return client[_0xf777('0x2')](_0xf777('0x5'),{'body':_0x508470,'options':{'where':{'uniqueid':_0x2612fe},'order':[['id','DESC']],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x9f3e=['UpdateChatQueueReport','DESC','../client','create','Request','CreateChatQueueReport'];(function(_0x1bd7c6,_0x2e6ad6){var _0x1acd29=function(_0x23b5ed){while(--_0x23b5ed){_0x1bd7c6['push'](_0x1bd7c6['shift']());}};_0x1acd29(++_0x2e6ad6);}(_0x9f3e,0x1c4));var _0xe9f3=function(_0x3d35ea,_0x9aa22a){_0x3d35ea=_0x3d35ea-0x0;var _0x4cdd47=_0x9f3e[_0x3d35ea];return _0x4cdd47;};'use strict';var client=require(_0xe9f3('0x0'));exports[_0xe9f3('0x1')]=function(_0x28c509){return client[_0xe9f3('0x2')](_0xe9f3('0x3'),{'body':_0x28c509,'log':'CreateChatQueueReport'});};exports['update']=function(_0x4c3a39,_0x1ea33c){return client['Request'](_0xe9f3('0x4'),{'body':_0x1ea33c,'options':{'where':{'uniqueid':_0x4c3a39},'order':[['id',_0xe9f3('0x5')]],'limit':0x1},'log':_0xe9f3('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index d7a303c..a38080c 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0x7a54,0x106));var _0x47a5=function(_0x47d190,_0x485e9e){_0x47d190=_0x47d190-0x0;var _0x296fa4=_0x7a54[_0x47d190];return _0x296fa4;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x10275b,_0x89c49a){var _0x5577e3=function(_0x590d18){while(--_0x590d18){_0x10275b['push'](_0x10275b['shift']());}};_0x5577e3(++_0x89c49a);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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 aad3a9a..ba21835 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 _0xed78=['Request','CreateFaxMessage','createFaxMessage'];(function(_0x1a8980,_0x529d3d){var _0x1dcf76=function(_0x5d4bd2){while(--_0x5d4bd2){_0x1a8980['push'](_0x1a8980['shift']());}};_0x1dcf76(++_0x529d3d);}(_0xed78,0x138));var _0x8ed7=function(_0x5cac03,_0x18674f){_0x5cac03=_0x5cac03-0x0;var _0xe0f3cf=_0xed78[_0x5cac03];return _0xe0f3cf;};'use strict';var client=require('../client');exports['create']=function(_0x1bb5e1){return client[_0x8ed7('0x0')](_0x8ed7('0x1'),{'body':_0x1bb5e1,'log':_0x8ed7('0x2')});}; \ No newline at end of file +var _0x2bd5=['Request','CreateFaxMessage','../client','create'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x2bd5,0xb2));var _0x52bd=function(_0x29ce14,_0x334166){_0x29ce14=_0x29ce14-0x0;var _0x48f289=_0x2bd5[_0x29ce14];return _0x48f289;};'use strict';var client=require(_0x52bd('0x0'));exports[_0x52bd('0x1')]=function(_0x59298b){return client[_0x52bd('0x2')](_0x52bd('0x3'),{'body':_0x59298b,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 58e8cf9..fca2bd5 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 _0x46bc=['Request','GetFaxQueue','name','timeout','strategy','Agents','online','getFaxQueues'];(function(_0x1f8435,_0x48696a){var _0x208958=function(_0x3f822d){while(--_0x3f822d){_0x1f8435['push'](_0x1f8435['shift']());}};_0x208958(++_0x48696a);}(_0x46bc,0xb7));var _0xc46b=function(_0x1646fa,_0x4e5bd7){_0x1646fa=_0x1646fa-0x0;var _0x5a47a5=_0x46bc[_0x1646fa];return _0x5a47a5;};'use strict';var client=require('../client');exports[_0xc46b('0x0')]=function(){return function(){return client[_0xc46b('0x1')](_0xc46b('0x2'),{'options':{'raw':![],'attributes':['id',_0xc46b('0x3'),_0xc46b('0x4'),_0xc46b('0x5')],'include':[{'model':'User','as':_0xc46b('0x6'),'attributes':['id',_0xc46b('0x3'),_0xc46b('0x7'),'faxPause']}]},'log':_0xc46b('0x0')});};}; \ No newline at end of file +var _0xc240=['strategy','User','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','timeout'];(function(_0x41d039,_0x5c55b8){var _0x35b0cd=function(_0x677e74){while(--_0x677e74){_0x41d039['push'](_0x41d039['shift']());}};_0x35b0cd(++_0x5c55b8);}(_0xc240,0x144));var _0x0c24=function(_0x2fb252,_0x50501f){_0x2fb252=_0x2fb252-0x0;var _0x55d04d=_0xc240[_0x2fb252];return _0x55d04d;};'use strict';var client=require(_0x0c24('0x0'));exports[_0x0c24('0x1')]=function(){return function(){return client[_0x0c24('0x2')](_0x0c24('0x3'),{'options':{'raw':![],'attributes':['id',_0x0c24('0x4'),_0x0c24('0x5'),_0x0c24('0x6')],'include':[{'model':_0x0c24('0x7'),'as':'Agents','attributes':['id',_0x0c24('0x4'),_0x0c24('0x8'),_0x0c24('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 8bcfdb3..4d31128 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 _0x6277=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create'];(function(_0x4aae29,_0x55b11c){var _0x6a2d63=function(_0x536e59){while(--_0x536e59){_0x4aae29['push'](_0x4aae29['shift']());}};_0x6a2d63(++_0x55b11c);}(_0x6277,0x7d));var _0x7627=function(_0x4150b6,_0x567c53){_0x4150b6=_0x4150b6-0x0;var _0x343920=_0x6277[_0x4150b6];return _0x343920;};'use strict';var client=require('../client');exports[_0x7627('0x0')]=function(_0x4d571d){return client[_0x7627('0x1')](_0x7627('0x2'),{'body':_0x4d571d,'log':_0x7627('0x2')});};exports[_0x7627('0x3')]=function(_0x5d7f49,_0x5d446e){return client[_0x7627('0x1')](_0x7627('0x4'),{'body':_0x5d446e,'options':{'where':{'uniqueid':_0x5d7f49},'order':[['id',_0x7627('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x18b9=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport','update'];(function(_0xe31f38,_0x6647f1){var _0x5ed4aa=function(_0x184814){while(--_0x184814){_0xe31f38['push'](_0xe31f38['shift']());}};_0x5ed4aa(++_0x6647f1);}(_0x18b9,0xb8));var _0x918b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x18b9[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x918b('0x0'));exports[_0x918b('0x1')]=function(_0x51ec2e){return client[_0x918b('0x2')](_0x918b('0x3'),{'body':_0x51ec2e,'log':'CreateFaxQueueReport'});};exports[_0x918b('0x4')]=function(_0x2243f8,_0x432603){return client['Request'](_0x918b('0x5'),{'body':_0x432603,'options':{'where':{'uniqueid':_0x2243f8},'order':[['id',_0x918b('0x6')]],'limit':0x1},'log':_0x918b('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 90a3287..194b39c 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 _0xe788=['../client','getIntervals','Request','GetInterval','Interval','name','interval'];(function(_0x34bc6c,_0x10d089){var _0x168820=function(_0xb058d9){while(--_0xb058d9){_0x34bc6c['push'](_0x34bc6c['shift']());}};_0x168820(++_0x10d089);}(_0xe788,0x70));var _0x8e78=function(_0x20dfb0,_0x4418d4){_0x20dfb0=_0x20dfb0-0x0;var _0xf6592e=_0xe788[_0x20dfb0];return _0xf6592e;};'use strict';var client=require(_0x8e78('0x0'));exports[_0x8e78('0x1')]=function(){return function(){return client[_0x8e78('0x2')](_0x8e78('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x8e78('0x4'),'as':'Intervals','attributes':['id',_0x8e78('0x5'),_0x8e78('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x2625=['GetInterval','name','Interval','Intervals','getIntervals','Request'];(function(_0x511fad,_0x26cf29){var _0x4b61bd=function(_0x543692){while(--_0x543692){_0x511fad['push'](_0x511fad['shift']());}};_0x4b61bd(++_0x26cf29);}(_0x2625,0x95));var _0x5262=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x2625[_0x4d8ed9];return _0x1e2140;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client[_0x5262('0x0')](_0x5262('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x5262('0x2')],'include':[{'model':_0x5262('0x3'),'as':_0x5262('0x4'),'attributes':['id',_0x5262('0x2'),'interval']}]},'log':_0x5262('0x5')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 33ec505..305f922 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 _0x1c9a=['updateMailInteraction','AddTagsToMailInteraction','../client','Request','UpdateMailInteraction'];(function(_0x52fd3d,_0x3af718){var _0x49b06d=function(_0x2f4a2b){while(--_0x2f4a2b){_0x52fd3d['push'](_0x52fd3d['shift']());}};_0x49b06d(++_0x3af718);}(_0x1c9a,0x98));var _0xa1c9=function(_0xd182d1,_0x55d59d){_0xd182d1=_0xd182d1-0x0;var _0xec0601=_0x1c9a[_0xd182d1];return _0xec0601;};'use strict';var client=require(_0xa1c9('0x0'));exports['update']=function(_0x470dcd,_0x5c45c5){return client[_0xa1c9('0x1')](_0xa1c9('0x2'),{'body':_0x5c45c5,'options':{'where':{'id':_0x470dcd}},'log':_0xa1c9('0x3')});};exports['addTags']=function(_0x21c0fc,_0x45d1f7){return client[_0xa1c9('0x1')](_0xa1c9('0x4'),{'body':_0x45d1f7,'options':{'where':{'id':_0x21c0fc}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x4bd3=['../client','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x205457,_0x427066){var _0x17442d=function(_0x37f822){while(--_0x37f822){_0x205457['push'](_0x205457['shift']());}};_0x17442d(++_0x427066);}(_0x4bd3,0x174));var _0x34bd=function(_0x25597f,_0x4a2b23){_0x25597f=_0x25597f-0x0;var _0xc5f584=_0x4bd3[_0x25597f];return _0xc5f584;};'use strict';var client=require(_0x34bd('0x0'));exports['update']=function(_0x415bd3,_0x22a9f9){return client['Request']('UpdateMailInteraction',{'body':_0x22a9f9,'options':{'where':{'id':_0x415bd3}},'log':'updateMailInteraction'});};exports[_0x34bd('0x1')]=function(_0x44854a,_0x1fc8eb){return client['Request'](_0x34bd('0x2'),{'body':_0x1fc8eb,'options':{'where':{'id':_0x44854a}},'log':_0x34bd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 4e21b15..b5043e0 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 _0x180d=['createMailMessage','CreateMailMessage'];(function(_0x35a730,_0x35610e){var _0xbe64fd=function(_0x23a778){while(--_0x23a778){_0x35a730['push'](_0x35a730['shift']());}};_0xbe64fd(++_0x35610e);}(_0x180d,0xdf));var _0xd180=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x180d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports['create']=function(_0xbdf73a){return client['Request'](_0xd180('0x0'),{'body':_0xbdf73a,'log':_0xd180('0x1')});}; \ No newline at end of file +var _0x0a22=['createMailMessage','../client','CreateMailMessage'];(function(_0x44474f,_0x431580){var _0x427d97=function(_0x53f7d4){while(--_0x53f7d4){_0x44474f['push'](_0x44474f['shift']());}};_0x427d97(++_0x431580);}(_0x0a22,0x1bd));var _0x20a2=function(_0x57f89e,_0x3a9a56){_0x57f89e=_0x57f89e-0x0;var _0x2489b0=_0x0a22[_0x57f89e];return _0x2489b0;};'use strict';var client=require(_0x20a2('0x0'));exports['create']=function(_0x1d3817){return client['Request'](_0x20a2('0x1'),{'body':_0x1d3817,'log':_0x20a2('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a758bfe..a2d7eda 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 _0x062d=['getMailQueues','Request','GetMailQueue','timeout','strategy','User','Agents','name','online','mailPause'];(function(_0x5cdee3,_0x563a7f){var _0x1316a2=function(_0x4abd05){while(--_0x4abd05){_0x5cdee3['push'](_0x5cdee3['shift']());}};_0x1316a2(++_0x563a7f);}(_0x062d,0x1ea));var _0xd062=function(_0x55a802,_0x10ab3a){_0x55a802=_0x55a802-0x0;var _0x1a0461=_0x062d[_0x55a802];return _0x1a0461;};'use strict';var client=require('../client');exports[_0xd062('0x0')]=function(){return function(){return client[_0xd062('0x1')](_0xd062('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xd062('0x3'),_0xd062('0x4')],'include':[{'model':_0xd062('0x5'),'as':_0xd062('0x6'),'attributes':['id',_0xd062('0x7'),_0xd062('0x8'),_0xd062('0x9')]}]},'log':_0xd062('0x0')});};}; \ No newline at end of file +var _0x8522=['Agents','name','getMailQueues','Request','timeout','strategy','User'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8522,0x18b));var _0x2852=function(_0x4c98b9,_0x1ad11b){_0x4c98b9=_0x4c98b9-0x0;var _0x3a257a=_0x8522[_0x4c98b9];return _0x3a257a;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x2852('0x0')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x2852('0x1'),_0x2852('0x2')],'include':[{'model':_0x2852('0x3'),'as':_0x2852('0x4'),'attributes':['id',_0x2852('0x5'),'online','mailPause']}]},'log':_0x2852('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 3d1374a..c47a901 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 _0x6631=['CreateMailQueueReport','update','Request','DESC','UpdateMailQueueReport','../client','create'];(function(_0x50e39e,_0x31b583){var _0x42797d=function(_0x322e9a){while(--_0x322e9a){_0x50e39e['push'](_0x50e39e['shift']());}};_0x42797d(++_0x31b583);}(_0x6631,0x147));var _0x1663=function(_0xbdc56,_0x2ab855){_0xbdc56=_0xbdc56-0x0;var _0x254d02=_0x6631[_0xbdc56];return _0x254d02;};'use strict';var client=require(_0x1663('0x0'));exports[_0x1663('0x1')]=function(_0x44057d){return client['Request'](_0x1663('0x2'),{'body':_0x44057d,'log':'CreateMailQueueReport'});};exports[_0x1663('0x3')]=function(_0x25a6ee,_0x5f2e3b){return client[_0x1663('0x4')]('UpdateMailQueueReport',{'body':_0x5f2e3b,'options':{'where':{'uniqueid':_0x25a6ee},'order':[['id',_0x1663('0x5')]],'limit':0x1},'log':_0x1663('0x6')});}; \ No newline at end of file +var _0xe22d=['UpdateMailQueueReport','../client','create','CreateMailQueueReport','update','Request'];(function(_0x3e85a4,_0x18c3a9){var _0x21e7d1=function(_0x48457d){while(--_0x48457d){_0x3e85a4['push'](_0x3e85a4['shift']());}};_0x21e7d1(++_0x18c3a9);}(_0xe22d,0x16f));var _0xde22=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe22d[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0xde22('0x0'));exports[_0xde22('0x1')]=function(_0x279fe3){return client['Request'](_0xde22('0x2'),{'body':_0x279fe3,'log':_0xde22('0x2')});};exports[_0xde22('0x3')]=function(_0x4d3524,_0x11b5f6){return client[_0xde22('0x4')](_0xde22('0x5'),{'body':_0x11b5f6,'options':{'where':{'uniqueid':_0x4d3524},'order':[['id','DESC']],'limit':0x1},'log':_0xde22('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 38395f1..3272d6d 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 _0x2519=['../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1444d1,_0x3d5ae9){var _0x37c45b=function(_0x57ba80){while(--_0x57ba80){_0x1444d1['push'](_0x1444d1['shift']());}};_0x37c45b(++_0x3d5ae9);}(_0x2519,0x1f1));var _0x9251=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2519[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x9251('0x0'));exports[_0x9251('0x1')]=function(_0xffed27,_0x5aae1b){return client[_0x9251('0x2')](_0x9251('0x3'),{'body':_0x5aae1b,'options':{'where':{'id':_0xffed27}},'log':_0x9251('0x4')});};exports['addTags']=function(_0x3e7be0,_0x53d25d){return client[_0x9251('0x2')](_0x9251('0x5'),{'body':_0x53d25d,'options':{'where':{'id':_0x3e7be0}},'log':_0x9251('0x6')});}; \ No newline at end of file +var _0x21e2=['addTagsToChatInteraction','../client','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x21e2,0x97));var _0x221e=function(_0x5f1488,_0x3788ba){_0x5f1488=_0x5f1488-0x0;var _0x290e51=_0x21e2[_0x5f1488];return _0x290e51;};'use strict';var client=require(_0x221e('0x0'));exports['update']=function(_0x4b182b,_0x4b2522){return client[_0x221e('0x1')](_0x221e('0x2'),{'body':_0x4b2522,'options':{'where':{'id':_0x4b182b}},'log':_0x221e('0x3')});};exports['addTags']=function(_0xfc5a56,_0x57280c){return client[_0x221e('0x1')](_0x221e('0x4'),{'body':_0x57280c,'options':{'where':{'id':_0xfc5a56}},'log':_0x221e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index c9f37aa..cd4b69f 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 _0x56ab=['../client','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x56ab,0x84));var _0xb56a=function(_0x1b9224,_0x3e4bc8){_0x1b9224=_0x1b9224-0x0;var _0x398c1e=_0x56ab[_0x1b9224];return _0x398c1e;};'use strict';var client=require(_0xb56a('0x0'));exports['create']=function(_0x50a40b){return client[_0xb56a('0x1')](_0xb56a('0x2'),{'body':_0x50a40b,'log':_0xb56a('0x3')});}; \ No newline at end of file +var _0x78e5=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x653b80,_0x60a948){var _0x26841d=function(_0x278b5a){while(--_0x278b5a){_0x653b80['push'](_0x653b80['shift']());}};_0x26841d(++_0x60a948);}(_0x78e5,0x1d0));var _0x578e=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x78e5[_0x4fde08];return _0x12e725;};'use strict';var client=require(_0x578e('0x0'));exports[_0x578e('0x1')]=function(_0xefdbcb){return client[_0x578e('0x2')](_0x578e('0x3'),{'body':_0xefdbcb,'log':_0x578e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 2b2be8d..2040658 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 _0x6aa7=['GetOpenchannelQueue','name','timeout','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x20c41c,_0x22d32e){var _0x4fd0a0=function(_0x397cf2){while(--_0x397cf2){_0x20c41c['push'](_0x20c41c['shift']());}};_0x4fd0a0(++_0x22d32e);}(_0x6aa7,0x165));var _0x76aa=function(_0x4063fa,_0x3c7f60){_0x4063fa=_0x4063fa-0x0;var _0x5c1972=_0x6aa7[_0x4063fa];return _0x5c1972;};'use strict';var client=require(_0x76aa('0x0'));exports[_0x76aa('0x1')]=function(){return function(){return client[_0x76aa('0x2')](_0x76aa('0x3'),{'options':{'raw':![],'attributes':['id',_0x76aa('0x4'),_0x76aa('0x5'),_0x76aa('0x6')],'include':[{'model':'User','as':_0x76aa('0x7'),'attributes':['id',_0x76aa('0x4'),_0x76aa('0x8'),_0x76aa('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x0bf4=['User','Agents','online','openchannelPause','../client','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0xef3c80,_0x36164f){var _0x27f054=function(_0xf82dda){while(--_0xf82dda){_0xef3c80['push'](_0xef3c80['shift']());}};_0x27f054(++_0x36164f);}(_0x0bf4,0x180));var _0x40bf=function(_0x3bee55,_0x4e25c8){_0x3bee55=_0x3bee55-0x0;var _0x5649d2=_0x0bf4[_0x3bee55];return _0x5649d2;};'use strict';var client=require(_0x40bf('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x40bf('0x1')](_0x40bf('0x2'),{'options':{'raw':![],'attributes':['id',_0x40bf('0x3'),_0x40bf('0x4'),_0x40bf('0x5')],'include':[{'model':_0x40bf('0x6'),'as':_0x40bf('0x7'),'attributes':['id','name',_0x40bf('0x8'),_0x40bf('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5cd569c..510441d 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 _0xa7d9=['update','Request','UpdateOpenchannelQueueReport','DESC','../client','create','CreateOpenchannelQueueReport'];(function(_0x5a1779,_0x24f20f){var _0x37eaaa=function(_0x3fd7c6){while(--_0x3fd7c6){_0x5a1779['push'](_0x5a1779['shift']());}};_0x37eaaa(++_0x24f20f);}(_0xa7d9,0x1d9));var _0x9a7d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xa7d9[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x9a7d('0x0'));exports[_0x9a7d('0x1')]=function(_0x30b077){return client['Request'](_0x9a7d('0x2'),{'body':_0x30b077,'log':_0x9a7d('0x2')});};exports[_0x9a7d('0x3')]=function(_0x48d183,_0x5d7334){return client[_0x9a7d('0x4')](_0x9a7d('0x5'),{'body':_0x5d7334,'options':{'where':{'uniqueid':_0x48d183},'order':[['id',_0x9a7d('0x6')]],'limit':0x1},'log':_0x9a7d('0x5')});}; \ No newline at end of file +var _0x0457=['Request','DESC','create','CreateOpenchannelQueueReport','update'];(function(_0x31db3a,_0x1a81bb){var _0x201c37=function(_0x54e7f3){while(--_0x54e7f3){_0x31db3a['push'](_0x31db3a['shift']());}};_0x201c37(++_0x1a81bb);}(_0x0457,0x11f));var _0x7045=function(_0x2d2258,_0x2ce510){_0x2d2258=_0x2d2258-0x0;var _0x18e155=_0x0457[_0x2d2258];return _0x18e155;};'use strict';var client=require('../client');exports[_0x7045('0x0')]=function(_0x2f6085){return client['Request'](_0x7045('0x1'),{'body':_0x2f6085,'log':_0x7045('0x1')});};exports[_0x7045('0x2')]=function(_0x2e3761,_0x1167ea){return client[_0x7045('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x1167ea,'options':{'where':{'uniqueid':_0x2e3761},'order':[['id',_0x7045('0x4')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9eaa83a..a60b8ea 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 _0x7cab=['Request','UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x5cb3dc,_0x1e7841){var _0x435aea=function(_0x4b4044){while(--_0x4b4044){_0x5cb3dc['push'](_0x5cb3dc['shift']());}};_0x435aea(++_0x1e7841);}(_0x7cab,0x91));var _0xb7ca=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x7cab[_0x209ec9];return _0x129b1b;};'use strict';var client=require(_0xb7ca('0x0'));exports[_0xb7ca('0x1')]=function(_0x246602,_0x5b0715){return client[_0xb7ca('0x2')](_0xb7ca('0x3'),{'body':_0x5b0715,'options':{'where':{'id':_0x246602}},'log':_0xb7ca('0x4')});};exports['addTags']=function(_0x37e571,_0x5014c1){return client['Request'](_0xb7ca('0x5'),{'body':_0x5014c1,'options':{'where':{'id':_0x37e571}},'log':_0xb7ca('0x6')});}; \ No newline at end of file +var _0x47c7=['Request','AddTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction'];(function(_0x59db34,_0x593726){var _0x568a53=function(_0x2bf3b4){while(--_0x2bf3b4){_0x59db34['push'](_0x59db34['shift']());}};_0x568a53(++_0x593726);}(_0x47c7,0x1ab));var _0x747c=function(_0x1bc013,_0x7771c6){_0x1bc013=_0x1bc013-0x0;var _0x55df36=_0x47c7[_0x1bc013];return _0x55df36;};'use strict';var client=require(_0x747c('0x0'));exports['update']=function(_0x1e4b3d,_0x63d85a){return client['Request'](_0x747c('0x1'),{'body':_0x63d85a,'options':{'where':{'id':_0x1e4b3d}},'log':_0x747c('0x2')});};exports['addTags']=function(_0x3313cd,_0x3c0c0){return client[_0x747c('0x3')](_0x747c('0x4'),{'body':_0x3c0c0,'options':{'where':{'id':_0x3313cd}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 4ab2beb..e43157b 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 _0x8d1a=['CreateSmsMessage','createSmsMessage','../client','create','Request'];(function(_0x52a076,_0x17ed42){var _0x44a61b=function(_0x56acf8){while(--_0x56acf8){_0x52a076['push'](_0x52a076['shift']());}};_0x44a61b(++_0x17ed42);}(_0x8d1a,0xb6));var _0xa8d1=function(_0x222a4e,_0x196ff3){_0x222a4e=_0x222a4e-0x0;var _0xfb2ff6=_0x8d1a[_0x222a4e];return _0xfb2ff6;};'use strict';var client=require(_0xa8d1('0x0'));exports[_0xa8d1('0x1')]=function(_0x2bc874){return client[_0xa8d1('0x2')](_0xa8d1('0x3'),{'body':_0x2bc874,'log':_0xa8d1('0x4')});}; \ No newline at end of file +var _0x1726=['create','CreateSmsMessage','createSmsMessage'];(function(_0xd0254e,_0x52f6da){var _0x4401e6=function(_0x55fe72){while(--_0x55fe72){_0xd0254e['push'](_0xd0254e['shift']());}};_0x4401e6(++_0x52f6da);}(_0x1726,0x1b0));var _0x6172=function(_0x1ab180,_0x382b2c){_0x1ab180=_0x1ab180-0x0;var _0xfb2c2d=_0x1726[_0x1ab180];return _0xfb2c2d;};'use strict';var client=require('../client');exports[_0x6172('0x0')]=function(_0x1fc114){return client['Request'](_0x6172('0x1'),{'body':_0x1fc114,'log':_0x6172('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index b5f5ca9..9717c3a 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0xd95ad3,_0x5b5aab){var _0x3f74f9=function(_0x36c8ec){while(--_0x36c8ec){_0xd95ad3['push'](_0xd95ad3['shift']());}};_0x3f74f9(++_0x5b5aab);}(_0x70e0,0x17b));var _0x070e=function(_0x585464,_0x13ff73){_0x585464=_0x585464-0x0;var _0x2035fe=_0x70e0[_0x585464];return _0x2035fe;};'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 +var _0xd8b0=['timeout','strategy','User','Agents','name','../client','getSmsQueues'];(function(_0x17ee1b,_0x2b7f1f){var _0x2060d2=function(_0x2f3f30){while(--_0x2f3f30){_0x17ee1b['push'](_0x17ee1b['shift']());}};_0x2060d2(++_0x2b7f1f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0x0d8b('0x0'));exports[_0x0d8b('0x1')]=function(){return function(){return client['Request']('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0d8b('0x2'),_0x0d8b('0x3')],'include':[{'model':_0x0d8b('0x4'),'as':_0x0d8b('0x5'),'attributes':['id',_0x0d8b('0x6'),'online','smsPause']}]},'log':_0x0d8b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index ef8199e..5214467 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x28d685,_0x20a8b0){var _0x5abd39=function(_0x2cd5f3){while(--_0x2cd5f3){_0x28d685['push'](_0x28d685['shift']());}};_0x5abd39(++_0x20a8b0);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3){return client[_0x7995('0x2')]('CreateSmsQueueReport',{'body':_0x2722a3,'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x1902b4,_0x462a03){return client['Request'](_0x7995('0x5'),{'body':_0x462a03,'options':{'where':{'uniqueid':_0x1902b4},'order':[['id',_0x7995('0x6')]],'limit':0x1},'log':_0x7995('0x5')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x18a8b3,_0x586653){var _0x373c74=function(_0x56a2d5){while(--_0x56a2d5){_0x18a8b3['push'](_0x18a8b3['shift']());}};_0x373c74(++_0x586653);}(_0x3e74,0x175));var _0x43e7=function(_0x65fa84,_0x11e1bc){_0x65fa84=_0x65fa84-0x0;var _0x466532=_0x3e74[_0x65fa84];return _0x466532;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 6d86026..e190877 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(_0x501e91,_0x1c21db){var _0x37daae=function(_0x216d7a){while(--_0x216d7a){_0x501e91['push'](_0x501e91['shift']());}};_0x37daae(++_0x1c21db);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x5a4aac,_0x3f5cfb){var _0x1e5ab2=function(_0x347cf6){while(--_0x347cf6){_0x5a4aac['push'](_0x5a4aac['shift']());}};_0x1e5ab2(++_0x3f5cfb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 8d265c8..5582d3a 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 _0xfcbe=['updateWhatsappInteraction','update','Request','UpdateWhatsappInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfcbe,0x1b1));var _0xefcb=function(_0x1446c8,_0x240e7e){_0x1446c8=_0x1446c8-0x0;var _0x20aae6=_0xfcbe[_0x1446c8];return _0x20aae6;};'use strict';var client=require('../client');exports[_0xefcb('0x0')]=function(_0x35eabe,_0x1dc3ed){return client[_0xefcb('0x1')](_0xefcb('0x2'),{'body':_0x1dc3ed,'options':{'where':{'id':_0x35eabe}},'log':_0xefcb('0x3')});};exports['addTags']=function(_0xbfb8c6,_0x14f3b5){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x14f3b5,'options':{'where':{'id':_0xbfb8c6}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xa23f=['updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction'];(function(_0x4b0f78,_0x19591e){var _0x23784f=function(_0x4f33a2){while(--_0x4f33a2){_0x4b0f78['push'](_0x4b0f78['shift']());}};_0x23784f(++_0x19591e);}(_0xa23f,0x7c));var _0xfa23=function(_0x3ef3ad,_0x493a17){_0x3ef3ad=_0x3ef3ad-0x0;var _0x1e4c35=_0xa23f[_0x3ef3ad];return _0x1e4c35;};'use strict';var client=require(_0xfa23('0x0'));exports[_0xfa23('0x1')]=function(_0x56a4e3,_0x48fd46){return client[_0xfa23('0x2')](_0xfa23('0x3'),{'body':_0x48fd46,'options':{'where':{'id':_0x56a4e3}},'log':_0xfa23('0x4')});};exports[_0xfa23('0x5')]=function(_0x5643b1,_0x86778e){return client['Request'](_0xfa23('0x6'),{'body':_0x86778e,'options':{'where':{'id':_0x5643b1}},'log':_0xfa23('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 0d7417d..509a183 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 _0xa5eb=['createWhatsappMessage','../client','create','Request'];(function(_0x49fb7c,_0x273107){var _0x539eb5=function(_0x135028){while(--_0x135028){_0x49fb7c['push'](_0x49fb7c['shift']());}};_0x539eb5(++_0x273107);}(_0xa5eb,0x199));var _0xba5e=function(_0x35bd15,_0x47cae6){_0x35bd15=_0x35bd15-0x0;var _0x1bd5a6=_0xa5eb[_0x35bd15];return _0x1bd5a6;};'use strict';var client=require(_0xba5e('0x0'));exports[_0xba5e('0x1')]=function(_0x3c742e){return client[_0xba5e('0x2')]('CreateWhatsappMessage',{'body':_0x3c742e,'log':_0xba5e('0x3')});}; \ No newline at end of file +var _0x8845=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x2f672c,_0x32478f){var _0x27f07b=function(_0x203554){while(--_0x203554){_0x2f672c['push'](_0x2f672c['shift']());}};_0x27f07b(++_0x32478f);}(_0x8845,0xd7));var _0x5884=function(_0x500e23,_0x51b03a){_0x500e23=_0x500e23-0x0;var _0x342ee8=_0x8845[_0x500e23];return _0x342ee8;};'use strict';var client=require(_0x5884('0x0'));exports[_0x5884('0x1')]=function(_0x2db169){return client[_0x5884('0x2')](_0x5884('0x3'),{'body':_0x2db169,'log':_0x5884('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 8a727cd..84d1886 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 _0xa299=['GetWhatsappQueue','name','timeout','strategy','Agents','online','whatsappPause','getWhatsappQueues','Request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa299,0x167));var _0x9a29=function(_0x44dee6,_0x77c530){_0x44dee6=_0x44dee6-0x0;var _0x5bb30a=_0xa299[_0x44dee6];return _0x5bb30a;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0x9a29('0x0')](_0x9a29('0x1'),{'options':{'raw':![],'attributes':['id',_0x9a29('0x2'),_0x9a29('0x3'),_0x9a29('0x4')],'include':[{'model':'User','as':_0x9a29('0x5'),'attributes':['id',_0x9a29('0x2'),_0x9a29('0x6'),_0x9a29('0x7')]}]},'log':_0x9a29('0x8')});};}; \ No newline at end of file +var _0x924d=['timeout','strategy','Agents','online','whatsappPause','getWhatsappQueues','../client','Request','name'];(function(_0x5a148f,_0x114dfa){var _0x5af2d4=function(_0x6a9ba4){while(--_0x6a9ba4){_0x5a148f['push'](_0x5a148f['shift']());}};_0x5af2d4(++_0x114dfa);}(_0x924d,0x11d));var _0xd924=function(_0x5d5373,_0x10cd97){_0x5d5373=_0x5d5373-0x0;var _0x360a4a=_0x924d[_0x5d5373];return _0x360a4a;};'use strict';var client=require(_0xd924('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0xd924('0x1')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xd924('0x2'),_0xd924('0x3'),_0xd924('0x4')],'include':[{'model':'User','as':_0xd924('0x5'),'attributes':['id','name',_0xd924('0x6'),_0xd924('0x7')]}]},'log':_0xd924('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 15ef67e..eb25dd4 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 _0xc6dc=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0xad14b2,_0x5942c6){var _0x565d60=function(_0x208987){while(--_0x208987){_0xad14b2['push'](_0xad14b2['shift']());}};_0x565d60(++_0x5942c6);}(_0xc6dc,0x1de));var _0xcc6d=function(_0x285390,_0x5b6fde){_0x285390=_0x285390-0x0;var _0x5021ed=_0xc6dc[_0x285390];return _0x5021ed;};'use strict';var client=require('../client');exports[_0xcc6d('0x0')]=function(_0x3ea3a){return client[_0xcc6d('0x1')](_0xcc6d('0x2'),{'body':_0x3ea3a,'log':_0xcc6d('0x2')});};exports['update']=function(_0x49499b,_0x1d7790){return client[_0xcc6d('0x1')](_0xcc6d('0x3'),{'body':_0x1d7790,'options':{'where':{'uniqueid':_0x49499b},'order':[['id',_0xcc6d('0x4')]],'limit':0x1},'log':_0xcc6d('0x3')});}; \ No newline at end of file +var _0xc481=['CreateWhatsappQueueReport','DESC','UpdateWhatsappQueueReport','../client','Request'];(function(_0x1c7682,_0x364e76){var _0x56aacc=function(_0x14950d){while(--_0x14950d){_0x1c7682['push'](_0x1c7682['shift']());}};_0x56aacc(++_0x364e76);}(_0xc481,0x1bb));var _0x1c48=function(_0x5c879e,_0xe58074){_0x5c879e=_0x5c879e-0x0;var _0x30942b=_0xc481[_0x5c879e];return _0x30942b;};'use strict';var client=require(_0x1c48('0x0'));exports['create']=function(_0x565130){return client[_0x1c48('0x1')](_0x1c48('0x2'),{'body':_0x565130,'log':_0x1c48('0x2')});};exports['update']=function(_0x8e89a6,_0x42d380){return client['Request']('UpdateWhatsappQueueReport',{'body':_0x42d380,'options':{'where':{'uniqueid':_0x8e89a6},'order':[['id',_0x1c48('0x3')]],'limit':0x1},'log':_0x1c48('0x4')});}; \ 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 822e727..bcb7af7 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 _0x2001=['stack','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','agents','timeout','createQueue','atimeout','channel','end','[%s][AGENT]\x20ROUTING\x20STOPPED','rules','stop','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s'];(function(_0x97741,_0x374e41){var _0xa17bfa=function(_0x48f0e6){while(--_0x48f0e6){_0x97741['push'](_0x97741['shift']());}};_0xa17bfa(++_0x374e41);}(_0x2001,0x145));var _0x1200=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x2001[_0x819464];return _0x49dcc0;};'use strict';var schema=require('validate');var _=require(_0x1200('0x0'));var util=require(_0x1200('0x1'));var seqqueue=require(_0x1200('0x2'));var logger=require(_0x1200('0x3'))(_0x1200('0x4'));var strategy=require(_0x1200('0x5'));var queue=schema({'name':{'type':_0x1200('0x6'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x1200('0x7'),'message':_0x1200('0x8')}});function writeLog(_0x47dd53,_0x3c92bb,_0x2ea0eb){return logger[_0x1200('0x9')](util[_0x1200('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x47dd53,_0x3c92bb[_0x1200('0xb')],_0x2ea0eb));}function handleFindAgent(_0x26a432){return function(_0x12e6ea){return _0x12e6ea['name'][_0x1200('0xc')]()===_0x26a432['toLowerCase']();};}exports[_0x1200('0xd')]=function(_0x4149da,_0x1fe15c,_0x401a9a,_0x3ca3b1){return function(_0x13e222){try{var _0x57a625={'name':_0x1fe15c[0x0],'timeout':_0x1fe15c[0x1]};var _0x4e82cd=queue[_0x1200('0xe')](_0x57a625,{'typecast':!![]});if(_0x4e82cd[_0x1200('0xf')]){logger[_0x1200('0x10')](_0x1200('0x11'),_0x4149da,_[_0x1200('0x12')](_0x4e82cd,_0x1200('0x13'))[_0x1200('0x14')](',\x20'));_0x13e222['stop']();}else{var _0x2a6920=_['find'](_0x401a9a[_0x1200('0x15')],handleFindAgent(_0x57a625[_0x1200('0xb')]));if(_0x2a6920){var _0x17c53d=(_0x57a625[_0x1200('0x16')]||0xa)*0x3e8;var _0x1359ef,_0x48c182;var _0x1122df=seqqueue[_0x1200('0x17')](_0x17c53d);_0x1122df['id']=_0x4149da;_0x1122df[_0x1200('0x18')]=_0x17c53d;_0x1122df[_0x1200('0x19')]=_0x3ca3b1[_0x1200('0x19')];writeLog(_0x4149da,_0x2a6920,util[_0x1200('0xa')]('START:%s',_0x17c53d));_0x401a9a['rules'][_0x4149da]['on'](_0x1200('0x1a'),function(){logger[_0x1200('0x9')](_0x1200('0x1b'),_0x4149da);clearTimeout(_0x48c182);_0x48c182=undefined;_0x1122df['close']();if(_0x401a9a[_0x1200('0x1c')][_0x4149da]){delete _0x401a9a[_0x1200('0x1c')][_0x4149da];}_0x13e222[_0x1200('0x1d')]();});_0x401a9a[_0x1200('0x1c')][_0x4149da]['on']('complete',function(){if(_0x401a9a[_0x1200('0x1c')][_0x4149da]){delete _0x401a9a[_0x1200('0x1c')][_0x4149da];}});_0x48c182=setTimeout(function(){logger['info'](_0x1200('0x1e'),_0x4149da);clearTimeout(_0x48c182);_0x1122df['close']();_0x13e222[_0x1200('0x1f')]();},_0x17c53d);strategy[_0x1200('0x20')](_0x1122df,_0x2a6920,_0x401a9a,_0x3ca3b1);}else{logger[_0x1200('0x10')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x4149da,_0x57a625['name']);_0x13e222[_0x1200('0x1d')]();}}}catch(_0x221cdf){console[_0x1200('0x21')](_0x221cdf);logger['error'](_0x1200('0x22'),_0x4149da,_0x221cdf[_0x1200('0x23')]);_0x13e222[_0x1200('0x1d')]();}};}; \ No newline at end of file +var _0xaa1c=['[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','message','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','close','complete'];(function(_0x491df4,_0x395c76){var _0x3202d1=function(_0x725c5){while(--_0x725c5){_0x491df4['push'](_0x491df4['shift']());}};_0x3202d1(++_0x395c76);}(_0xaa1c,0x19e));var _0xcaa1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xaa1c[_0x20a584];return _0x4b41a8;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xcaa1('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xcaa1('0x1'))(_0xcaa1('0x2'));var strategy=require(_0xcaa1('0x3'));var queue=schema({'name':{'type':'string','required':!![],'message':_0xcaa1('0x4')},'timeout':{'type':_0xcaa1('0x5'),'message':_0xcaa1('0x6')}});function writeLog(_0x3eeb25,_0x28412b,_0x57c3ed){return logger[_0xcaa1('0x7')](util[_0xcaa1('0x8')](_0xcaa1('0x9'),_0x3eeb25,_0x28412b[_0xcaa1('0xa')],_0x57c3ed));}function handleFindAgent(_0x4e7d7b){return function(_0x339cdb){return _0x339cdb['name'][_0xcaa1('0xb')]()===_0x4e7d7b[_0xcaa1('0xb')]();};}exports[_0xcaa1('0xc')]=function(_0xed99dd,_0x28da6b,_0xf5ed89,_0x1711a8){return function(_0x226e47){try{var _0x55aa04={'name':_0x28da6b[0x0],'timeout':_0x28da6b[0x1]};var _0x254197=queue[_0xcaa1('0xd')](_0x55aa04,{'typecast':!![]});if(_0x254197[_0xcaa1('0xe')]){logger[_0xcaa1('0xf')](_0xcaa1('0x10'),_0xed99dd,_['map'](_0x254197,_0xcaa1('0x11'))['join'](',\x20'));_0x226e47[_0xcaa1('0x12')]();}else{var _0xd3f658=_[_0xcaa1('0x13')](_0xf5ed89[_0xcaa1('0x14')],handleFindAgent(_0x55aa04[_0xcaa1('0xa')]));if(_0xd3f658){var _0x5529ae=(_0x55aa04[_0xcaa1('0x15')]||0xa)*0x3e8;var _0x5c7418,_0x51e99a;var _0x135af6=seqqueue[_0xcaa1('0x16')](_0x5529ae);_0x135af6['id']=_0xed99dd;_0x135af6[_0xcaa1('0x17')]=_0x5529ae;_0x135af6[_0xcaa1('0x18')]=_0x1711a8[_0xcaa1('0x18')];writeLog(_0xed99dd,_0xd3f658,util['format'](_0xcaa1('0x19'),_0x5529ae));_0xf5ed89[_0xcaa1('0x1a')][_0xed99dd]['on'](_0xcaa1('0x1b'),function(){logger[_0xcaa1('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0xed99dd);clearTimeout(_0x51e99a);_0x51e99a=undefined;_0x135af6[_0xcaa1('0x1c')]();if(_0xf5ed89[_0xcaa1('0x1a')][_0xed99dd]){delete _0xf5ed89[_0xcaa1('0x1a')][_0xed99dd];}_0x226e47['stop']();});_0xf5ed89[_0xcaa1('0x1a')][_0xed99dd]['on'](_0xcaa1('0x1d'),function(){if(_0xf5ed89[_0xcaa1('0x1a')][_0xed99dd]){delete _0xf5ed89[_0xcaa1('0x1a')][_0xed99dd];}});_0x51e99a=setTimeout(function(){logger[_0xcaa1('0x7')](_0xcaa1('0x1e'),_0xed99dd);clearTimeout(_0x51e99a);_0x135af6['close']();_0x226e47[_0xcaa1('0x1f')]();},_0x5529ae);strategy[_0xcaa1('0x20')](_0x135af6,_0xd3f658,_0xf5ed89,_0x1711a8);}else{logger[_0xcaa1('0xf')](_0xcaa1('0x21'),_0xed99dd,_0x55aa04[_0xcaa1('0xa')]);_0x226e47[_0xcaa1('0x12')]();}}}catch(_0x51f926){console[_0xcaa1('0x22')](_0x51f926);logger['error'](_0xcaa1('0x23'),_0xed99dd,_0x51f926[_0xcaa1('0x24')]);_0x226e47[_0xcaa1('0x12')]();}};}; \ 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 20c010f..ca41d90 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 _0xc36e=['sms','phone','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','create','then','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','postText','next','message','amazonlex','providerName','providerResponse','Message','dialogState','stringify','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0x314972,_0x557a0d){var _0x1dd1d6=function(_0x11a28e){while(--_0x11a28e){_0x314972['push'](_0x314972['shift']());}};_0x1dd1d6(++_0x557a0d);}(_0xc36e,0xe0));var _0xec36=function(_0x373522,_0x2437db){_0x373522=_0x373522-0x0;var _0x31c3c4=_0xc36e[_0x373522];return _0x31c3c4;};'use strict';var _=require(_0xec36('0x0'));var moment=require(_0xec36('0x1'));var AWS=require(_0xec36('0x2'));var utils=require(_0xec36('0x3'));var logger=require(_0xec36('0x4'))('routing');var rpc={'chatMessage':require(_0xec36('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xec36('0x6')),'smsMessage':require(_0xec36('0x7')),'faxMessage':require(_0xec36('0x8')),'whatsappMessage':require(_0xec36('0x9'))};exports[_0xec36('0xa')]=function(_0x521eb5,_0x497508){return function(_0x2332d3){try{if(!_[_0xec36('0xb')](this[_0xec36('0xc')][_0xec36('0xd')])){logger[_0xec36('0xe')](_0xec36('0xf'),_0x521eb5,_0xec36('0x10'));return _0x2332d3['next']();}var _0x42dd60={'ContactId':this[_0xec36('0x11')]['id'],'sentAt':moment()['format'](_0xec36('0x12')),'direction':_0xec36('0x13')};if(this[_0xec36('0x14')]===_0xec36('0x15')||this[_0xec36('0x14')]==='whatsapp'){_0x42dd60[_0xec36('0x16')]=this[_0xec36('0xc')]['phone'];}var _0x4574b0=this[_0xec36('0x14')];if(_0x4574b0==='chat'){_0x42dd60[_0xec36('0x17')]=this[_0xec36('0x18')]['id'];}else{_0x42dd60[_[_0xec36('0x19')](_0x4574b0)+_0xec36('0x1a')]=this[_0xec36('0x18')]['id'];}_0x42dd60[_[_0xec36('0x19')](_0x4574b0)+'InteractionId']=this[_0xec36('0xc')]['id'];if(this[_0xec36('0xc')][_0xec36('0x1b')]){var _0x48ce30=_0x497508[0x4];if(!_[_0xec36('0x1c')](_0x48ce30)){_0x42dd60[_0xec36('0x1d')]=utils[_0xec36('0x1e')](_0x48ce30,this);return rpc[_0x4574b0+'Message'][_0xec36('0x1f')](_0x42dd60)[_0xec36('0x20')](function(_0x169961){logger[_0xec36('0xe')](_0xec36('0xf'),_0x521eb5,_0x42dd60[_0xec36('0x1d')]);})[_0xec36('0x21')](function(_0x56e5f4){logger[_0xec36('0x22')]('[%s][AMAZONLEX]\x20%s',_0x521eb5,JSON['stringify'](_0x56e5f4));})['finally'](function(){logger[_0xec36('0xe')](_0xec36('0x23'),_0x521eb5);_0x2332d3[_0xec36('0x24')]();});}else{logger[_0xec36('0xe')](_0xec36('0x25'),_0x521eb5);_0x2332d3[_0xec36('0x24')]();}}else{var _0x157ba8=this;var _0x2dfd70=new AWS[(_0xec36('0x26'))]({'accessKeyId':_0x497508[0x0],'secretAccessKey':_0x497508[0x1],'region':_0x497508[0x2]});var _0x2dbdbc={'botAlias':_0xec36('0x27'),'botName':_0x497508[0x3],'inputText':this['message'][_0xec36('0x1d')],'userId':this[_0xec36('0x14')]+':'+this['interaction']['id']['toString']()};_0x2dfd70[_0xec36('0x28')](_0x2dbdbc,function(_0x1a55a5,_0x56745c){if(_0x1a55a5){logger[_0xec36('0x22')]('[%s][AMAZONLEX]\x20%s',_0x521eb5,_0x1a55a5['message']);_0x2332d3[_0xec36('0x29')]();}else if(_0x56745c&&_0x56745c[_0xec36('0x2a')]){_0x157ba8[_0xec36('0x1d')][_0xec36('0x2b')]=_0x56745c;_0x42dd60[_0xec36('0x1d')]=_0x56745c['message'];_0x42dd60[_0xec36('0x2c')]=_0xec36('0x2b');_0x42dd60[_0xec36('0x2d')]=JSON['stringify'](_0x56745c);return rpc[_0x4574b0+_0xec36('0x2e')][_0xec36('0x1f')](_0x42dd60)[_0xec36('0x20')](function(_0x59d5b1){logger[_0xec36('0xe')](_0xec36('0xf'),_0x521eb5,_0x42dd60[_0xec36('0x1d')]);if(_0x56745c[_0xec36('0x2f')]=='Failed'){_0x2332d3['next']();}else{_0x2332d3['stop']();}})[_0xec36('0x21')](function(_0x4522d8){logger[_0xec36('0x22')](_0xec36('0xf'),_0x521eb5,JSON[_0xec36('0x30')](_0x4522d8));_0x2332d3[_0xec36('0x29')]();});}else{_0x2332d3[_0xec36('0x29')]();}});}}catch(_0x482bbf){logger[_0xec36('0x22')](_0xec36('0xf'),_0x521eb5,JSON[_0xec36('0x30')](_0x482bbf));_0x2332d3['stop']();}};}; \ No newline at end of file +var _0x5525=['ChatWebsiteId','upperFirst','isEmpty','body','getMustacheRender','Message','create','then','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','error','amazonlex','providerResponse','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat'];(function(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0x5525,0xda));var _0x5552=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5525[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5552('0x0'));var moment=require(_0x5552('0x1'));var AWS=require(_0x5552('0x2'));var utils=require(_0x5552('0x3'));var logger=require(_0x5552('0x4'))(_0x5552('0x5'));var rpc={'chatMessage':require(_0x5552('0x6')),'openchannelMessage':require(_0x5552('0x7')),'mailMessage':require(_0x5552('0x8')),'smsMessage':require(_0x5552('0x9')),'faxMessage':require(_0x5552('0xa')),'whatsappMessage':require(_0x5552('0xb'))};exports[_0x5552('0xc')]=function(_0x139ea7,_0x11abb1){return function(_0x539e6b){try{if(!_[_0x5552('0xd')](this[_0x5552('0xe')][_0x5552('0xf')])){logger[_0x5552('0x10')](_0x5552('0x11'),_0x139ea7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x539e6b[_0x5552('0x12')]();}var _0x299709={'ContactId':this[_0x5552('0x13')]['id'],'sentAt':moment()['format'](_0x5552('0x14')),'direction':_0x5552('0x15')};if(this[_0x5552('0x16')]===_0x5552('0x17')||this['channel']===_0x5552('0x18')){_0x299709[_0x5552('0x19')]=this['interaction']['phone'];}var _0x3a784a=this[_0x5552('0x16')];if(_0x3a784a===_0x5552('0x1a')){_0x299709[_0x5552('0x1b')]=this['account']['id'];}else{_0x299709[_[_0x5552('0x1c')](_0x3a784a)+'AccountId']=this['account']['id'];}_0x299709[_[_0x5552('0x1c')](_0x3a784a)+'InteractionId']=this[_0x5552('0xe')]['id'];if(this[_0x5552('0xe')]['created']){var _0x1c31f8=_0x11abb1[0x4];if(!_[_0x5552('0x1d')](_0x1c31f8)){_0x299709[_0x5552('0x1e')]=utils[_0x5552('0x1f')](_0x1c31f8,this);return rpc[_0x3a784a+_0x5552('0x20')][_0x5552('0x21')](_0x299709)[_0x5552('0x22')](function(_0x5dc08d){logger[_0x5552('0x10')](_0x5552('0x11'),_0x139ea7,_0x299709['body']);})['catch'](function(_0x4ea8ab){logger['error'](_0x5552('0x11'),_0x139ea7,JSON[_0x5552('0x23')](_0x4ea8ab));})[_0x5552('0x24')](function(){logger[_0x5552('0x10')](_0x5552('0x25'),_0x139ea7);_0x539e6b[_0x5552('0x26')]();});}else{logger['info'](_0x5552('0x27'),_0x139ea7);_0x539e6b[_0x5552('0x26')]();}}else{var _0x41cc44=this;var _0x236b92=new AWS[(_0x5552('0x28'))]({'accessKeyId':_0x11abb1[0x0],'secretAccessKey':_0x11abb1[0x1],'region':_0x11abb1[0x2]});var _0x631cd2={'botAlias':_0x5552('0x29'),'botName':_0x11abb1[0x3],'inputText':this[_0x5552('0x2a')][_0x5552('0x1e')],'userId':this[_0x5552('0x16')]+':'+this[_0x5552('0xe')]['id'][_0x5552('0x2b')]()};_0x236b92[_0x5552('0x2c')](_0x631cd2,function(_0x515034,_0x227113){if(_0x515034){logger[_0x5552('0x2d')](_0x5552('0x11'),_0x139ea7,_0x515034['message']);_0x539e6b['next']();}else if(_0x227113&&_0x227113[_0x5552('0x2a')]){_0x41cc44[_0x5552('0x1e')][_0x5552('0x2e')]=_0x227113;_0x299709[_0x5552('0x1e')]=_0x227113[_0x5552('0x2a')];_0x299709['providerName']='amazonlex';_0x299709[_0x5552('0x2f')]=JSON[_0x5552('0x23')](_0x227113);return rpc[_0x3a784a+'Message']['create'](_0x299709)['then'](function(_0x58579c){logger['info'](_0x5552('0x11'),_0x139ea7,_0x299709['body']);if(_0x227113['dialogState']==_0x5552('0x30')){_0x539e6b[_0x5552('0x12')]();}else{_0x539e6b[_0x5552('0x26')]();}})['catch'](function(_0x10f512){logger[_0x5552('0x2d')](_0x5552('0x11'),_0x139ea7,JSON[_0x5552('0x23')](_0x10f512));_0x539e6b[_0x5552('0x12')]();});}else{_0x539e6b[_0x5552('0x12')]();}});}}catch(_0x54b0cd){logger[_0x5552('0x2d')]('[%s][AMAZONLEX]\x20%s',_0x139ea7,JSON[_0x5552('0x23')](_0x54b0cd));_0x539e6b[_0x5552('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 0ce73ce..d81aa7d 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 _0xdb81=['stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','autoreplyExecuted','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','create','Interaction','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','channel','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','','replace','','headers','auto-replied','All','auto_reply','then','[%s][AUTOREPLY]\x20SMTP\x20SENT'];(function(_0x47a273,_0x14a116){var _0x5a00f1=function(_0x41f657){while(--_0x41f657){_0x47a273['push'](_0x47a273['shift']());}};_0x5a00f1(++_0x14a116);}(_0xdb81,0x159));var _0x1db8=function(_0x29a5c3,_0x243328){_0x29a5c3=_0x29a5c3-0x0;var _0x34928a=_0xdb81[_0x29a5c3];return _0x34928a;};'use strict';var _=require('lodash');var moment=require(_0x1db8('0x0'));var utils=require(_0x1db8('0x1'));var logger=require(_0x1db8('0x2'))(_0x1db8('0x3'));var rpc={'chatMessage':require(_0x1db8('0x4')),'openchannelMessage':require(_0x1db8('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x1db8('0x6')),'whatsappMessage':require(_0x1db8('0x7')),'chatInteraction':require(_0x1db8('0x8')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1db8('0x9')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x1db8('0xa')),'whatsappInteraction':require(_0x1db8('0xb'))};var mailRpc=require('../../mailRpc');exports[_0x1db8('0xc')]=function(_0x48a55d,_0x1b3fb0,_0x4c8384,_0x878818){return function(_0x1fb124){try{var _0x119960=this[_0x1db8('0xd')];if(_0x119960===_0x1db8('0xe')&&_0x878818[_0x1db8('0xf')]['isAutoreply']){logger[_0x1db8('0x10')](_0x1db8('0x11'),_0x48a55d,_0x1db8('0x12'));return _0x1fb124['next']();}if(_0x1b3fb0[0x0]==='1'&&(_[_0x1db8('0x13')](this[_0x1db8('0x14')][_0x1db8('0x15')])||!this['interaction'][_0x1db8('0x15')])){logger['info'](_0x1db8('0x11'),_0x48a55d,_0x1db8('0x16'));return _0x1fb124['next']();}if(_0x1b3fb0[0x0]==='2'&&this[_0x1db8('0x14')]['autoreplyExecuted']){logger[_0x1db8('0x10')](_0x1db8('0x17'),_0x48a55d,_0x1db8('0x18'));return _0x1fb124[_0x1db8('0x19')]();}var _0x3a8554={'ContactId':this[_0x1db8('0x1a')]['id'],'sentAt':moment()[_0x1db8('0x1b')](_0x1db8('0x1c')),'direction':_0x1db8('0x1d')};if(this[_0x1db8('0xd')]==='mail'){_0x3a8554[_0x1db8('0xf')]=utils[_0x1db8('0x1e')](_0x1b3fb0[0x2],this);}else{_0x3a8554['body']=utils[_0x1db8('0x1e')](_0x1b3fb0[0x1],this);}if(this[_0x1db8('0x1f')]){_0x3a8554['to']=this[_0x1db8('0x1f')][_0x1db8('0x20')]||'';if(this['channel']===_0x1db8('0xe')&&_0x1b3fb0[0x1]==='1'){_0x3a8554['cc']=this[_0x1db8('0x1f')]['cc']||'';}_0x3a8554[_0x1db8('0x20')]=this[_0x1db8('0x1f')]['to']||'';_0x3a8554[_0x1db8('0x21')]=this[_0x1db8('0x1f')][_0x1db8('0x21')]||'';_0x3a8554[_0x1db8('0x22')]=!![];if(this[_0x1db8('0x1f')][_0x1db8('0x23')]){_0x3a8554[_0x1db8('0x23')]='';_0x3a8554[_0x1db8('0x23')]+=_[_0x1db8('0x24')](this[_0x1db8('0x1f')][_0x1db8('0x23')],_0x1db8('0x25'))?'':_0x1db8('0x26');_0x3a8554['subject']+=this[_0x1db8('0x1f')][_0x1db8('0x23')];}}if(this[_0x1db8('0xd')]===_0x1db8('0x27')){_0x3a8554['ChatWebsiteId']=this[_0x1db8('0x28')]['id'];}else{_0x3a8554[_[_0x1db8('0x29')](this[_0x1db8('0xd')])+_0x1db8('0x2a')]=this[_0x1db8('0x28')]['id'];}_0x3a8554[_[_0x1db8('0x29')](this[_0x1db8('0xd')])+_0x1db8('0x2b')]=this[_0x1db8('0x14')]['id'];var _0xa7dc63=this[_0x1db8('0x14')];if(rpc[this[_0x1db8('0xd')]+_0x1db8('0x2c')]){if(this[_0x1db8('0xd')]==='mail'){_0x3a8554[_0x1db8('0x2d')]=this['message'][_0x1db8('0x2e')];_0x3a8554['html']=_0x1db8('0x2f')+_[_0x1db8('0x30')](_0x3a8554[_0x1db8('0xf')],_0x1db8('0x31'),'','';_0xd63e85[_0x7471('0x36')]={'Auto-Submitted':_0x7471('0x37'),'X-Auto-Response-Suppress':'All','Precedence':_0x7471('0x38')};return mailRpc['sendMailMessage'](this['account'][_0x7471('0x39')],_0xd63e85)[_0x7471('0x3a')](function(_0x3f606e){logger[_0x7471('0x11')](_0x7471('0x3b'),_0x254352);_0xd63e85[_0x7471('0x31')]=_0x3f606e[_0x7471('0x22')][_0x7471('0x31')];return rpc[_0x426cfa+_0x7471('0x3c')][_0x7471('0x3d')](_0xd63e85);})[_0x7471('0x3a')](function(_0x3480e9){logger[_0x7471('0x11')](_0x7471('0x17'),_0x254352,JSON[_0x7471('0x3e')](_0x3480e9));})[_0x7471('0x3f')](function(_0x58d1e2){logger[_0x7471('0x40')](_0x7471('0x41'),_0x254352,JSON[_0x7471('0x3e')](_0x58d1e2));})['finally'](function(){Promise[_0x7471('0x42')]()['then'](function(){if(_0x671192[0x0]!=='2'||_0x467f93[_0x7471('0x19')])return;return rpc[_0x426cfa+'Interaction'][_0x7471('0x43')](_0x467f93['id'],{'autoreplyExecuted':!![]})[_0x7471('0x3a')](function(_0xb433b5){logger[_0x7471('0x11')](_0x7471('0x1a'),_0x254352,JSON[_0x7471('0x3e')](_0xb433b5));})['catch'](function(_0x328218){logger[_0x7471('0x40')](_0x7471('0x44'),_0x254352,JSON['stringify'](_0x328218));});})['then'](function(){_0x5a43ac[_0x7471('0x13')]();});});}else{return rpc[this[_0x7471('0x20')]+_0x7471('0x3c')][_0x7471('0x3d')](_0xd63e85)[_0x7471('0x3a')](function(){logger[_0x7471('0x11')]('[%s][AUTOREPLY]\x20%s',_0x254352,_0xd63e85['body']);})[_0x7471('0x3f')](function(_0x27d16d){logger[_0x7471('0x40')](_0x7471('0x17'),_0x254352,JSON[_0x7471('0x3e')](_0x27d16d));})[_0x7471('0x45')](function(){Promise['resolve']()[_0x7471('0x3a')](function(){if(_0x671192[0x0]!=='2'||_0x467f93['autoreplyExecuted'])return;return rpc[_0x426cfa+_0x7471('0x46')]['update'](_0x467f93['id'],{'autoreplyExecuted':!![]})[_0x7471('0x3a')](function(_0x3308b8){logger[_0x7471('0x11')](_0x7471('0x1a'),_0x254352,JSON[_0x7471('0x3e')](_0x3308b8));})[_0x7471('0x3f')](function(_0x3b3324){logger[_0x7471('0x40')](_0x7471('0x44'),_0x254352,JSON[_0x7471('0x3e')](_0x3b3324));});})['then'](function(){_0x5a43ac[_0x7471('0x13')]();});});}}}catch(_0x216c35){logger['error'](_0x7471('0x17'),_0x254352,JSON['stringify'](_0x216c35));_0x5a43ac[_0x7471('0x47')]();}};}; \ 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 9320bb1..ab4836e 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 _0xae74=['[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','finally','stringify','stop','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','consequence','info','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then'];(function(_0x25fd7f,_0x1fc310){var _0x558eac=function(_0x47c161){while(--_0x47c161){_0x25fd7f['push'](_0x25fd7f['shift']());}};_0x558eac(++_0x1fc310);}(_0xae74,0x1ea));var _0x4ae7=function(_0x5c85e3,_0xebef98){_0x5c85e3=_0x5c85e3-0x0;var _0x584def=_0xae74[_0x5c85e3];return _0x584def;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')('routing');var rpc={'chatInteraction':require(_0x4ae7('0x0')),'openchannelInteraction':require(_0x4ae7('0x1')),'smsInteraction':require(_0x4ae7('0x2')),'mailInteraction':require(_0x4ae7('0x3')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x4ae7('0x4'))};exports[_0x4ae7('0x5')]=function(_0x196451,_0x257b79,_0x52aa4d,_0x588544){return function(_0x3710db){try{logger[_0x4ae7('0x6')]('[%s][CLOSE]\x20reason\x20%s',_0x196451,_0x257b79[0x0]);var _0x5283bf={'closed':0x1,'closedAt':moment()[_0x4ae7('0x7')](_0x4ae7('0x8')),'closeReason':_0x4ae7('0x9'),'disposition':_0x257b79[0x0]};if(rpc[_0x588544[_0x4ae7('0xa')]+_0x4ae7('0xb')]){rpc[_0x588544[_0x4ae7('0xa')]+_0x4ae7('0xb')][_0x4ae7('0xc')](_0x588544['interaction']['id'],_0x5283bf)[_0x4ae7('0xd')](function(_0x28750b){logger[_0x4ae7('0x6')](_0x4ae7('0xe'),_0x196451,_0x588544[_0x4ae7('0xf')]['id']);})['catch'](function(_0x59fa19){logger[_0x4ae7('0x10')](_0x4ae7('0x11'),_0x196451,JSON['stringify'](_0x59fa19));})[_0x4ae7('0x12')](function(){_0x3710db['stop']();});}}catch(_0x20c160){logger[_0x4ae7('0x10')](_0x4ae7('0x11'),_0x196451,JSON[_0x4ae7('0x13')](_0x20c160));_0x3710db[_0x4ae7('0x14')]();}};}; \ No newline at end of file +var _0x031d=['[%s][CLOSE]\x20%s','stringify','finally','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x36feb2,_0x53abef){var _0x292b43=function(_0x52a460){while(--_0x52a460){_0x36feb2['push'](_0x36feb2['shift']());}};_0x292b43(++_0x53abef);}(_0x031d,0xcc));var _0xd031=function(_0x314a8c,_0x1c2e8d){_0x314a8c=_0x314a8c-0x0;var _0x1d4607=_0x031d[_0x314a8c];return _0x1d4607;};'use strict';var moment=require(_0xd031('0x0'));var logger=require('../../../../config/logger')(_0xd031('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xd031('0x2')),'smsInteraction':require(_0xd031('0x3')),'mailInteraction':require(_0xd031('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xd031('0x5')]=function(_0x1e83e2,_0x40d0c2,_0xd60dee,_0xee0998){return function(_0x2f43c6){try{logger['info'](_0xd031('0x6'),_0x1e83e2,_0x40d0c2[0x0]);var _0x452d84={'closed':0x1,'closedAt':moment()['format'](_0xd031('0x7')),'closeReason':_0xd031('0x8'),'disposition':_0x40d0c2[0x0]};if(rpc[_0xee0998[_0xd031('0x9')]+'Interaction']){rpc[_0xee0998[_0xd031('0x9')]+_0xd031('0xa')][_0xd031('0xb')](_0xee0998[_0xd031('0xc')]['id'],_0x452d84)['then'](function(_0x5a22ed){logger['info'](_0xd031('0xd'),_0x1e83e2,_0xee0998[_0xd031('0xc')]['id']);})[_0xd031('0xe')](function(_0x436339){logger[_0xd031('0xf')](_0xd031('0x10'),_0x1e83e2,JSON[_0xd031('0x11')](_0x436339));})[_0xd031('0x12')](function(){_0x2f43c6[_0xd031('0x13')]();});}}catch(_0x122619){logger[_0xd031('0xf')](_0xd031('0x10'),_0x1e83e2,JSON['stringify'](_0x122619));_0x2f43c6[_0xd031('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 923358f..ef74f76 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 _0xf02c=['consequence','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','sms','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','then','catch','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','Message','create','metadata','endConversation','error','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage'];(function(_0xe0e9ad,_0x5af9cf){var _0x1ae462=function(_0x3883af){while(--_0x3883af){_0xe0e9ad['push'](_0xe0e9ad['shift']());}};_0x1ae462(++_0x5af9cf);}(_0xf02c,0x92));var _0xcf02=function(_0x3bc395,_0x36b58a){_0x3bc395=_0x3bc395-0x0;var _0x6a48fa=_0xf02c[_0x3bc395];return _0x6a48fa;};'use strict';var _=require(_0xcf02('0x0'));var moment=require(_0xcf02('0x1'));var apiai=require(_0xcf02('0x2'));var md5=require(_0xcf02('0x3'));var utils=require(_0xcf02('0x4'));var logger=require(_0xcf02('0x5'))(_0xcf02('0x6'));var rpc={'chatMessage':require(_0xcf02('0x7')),'openchannelMessage':require(_0xcf02('0x8')),'mailMessage':require(_0xcf02('0x9')),'smsMessage':require(_0xcf02('0xa')),'faxMessage':require(_0xcf02('0xb')),'whatsappMessage':require(_0xcf02('0xc'))};exports[_0xcf02('0xd')]=function(_0x3569a1,_0x49ad8e){return function(_0x45745e){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0xcf02('0xe')](_0xcf02('0xf'),_0x3569a1,_0xcf02('0x10'));return _0x45745e[_0xcf02('0x11')]();}var _0x5bd27c={'ContactId':this[_0xcf02('0x12')]['id'],'sentAt':moment()[_0xcf02('0x13')](_0xcf02('0x14')),'direction':'out'};if(this['channel']===_0xcf02('0x15')||this[_0xcf02('0x16')]===_0xcf02('0x17')){_0x5bd27c[_0xcf02('0x18')]=this[_0xcf02('0x19')]['phone'];}var _0x4448c2=this[_0xcf02('0x16')];if(_0x4448c2===_0xcf02('0x1a')){_0x5bd27c[_0xcf02('0x1b')]=this[_0xcf02('0x1c')]['id'];}else{_0x5bd27c[_[_0xcf02('0x1d')](_0x4448c2)+_0xcf02('0x1e')]=this['account']['id'];}_0x5bd27c[_[_0xcf02('0x1d')](_0x4448c2)+_0xcf02('0x1f')]=this[_0xcf02('0x19')]['id'];if(this['interaction'][_0xcf02('0x20')]){var _0x419418=_0x49ad8e[0x2];if(!_[_0xcf02('0x21')](_0x419418)){_0x5bd27c[_0xcf02('0x22')]=utils['getMustacheRender'](_0x419418,this);return rpc[_0x4448c2+'Message']['create'](_0x5bd27c)[_0xcf02('0x23')](function(_0x53a97e){logger[_0xcf02('0xe')](_0xcf02('0xf'),_0x3569a1,_0x5bd27c[_0xcf02('0x22')]);})[_0xcf02('0x24')](function(_0x56c4e8){logger['error'](_0xcf02('0xf'),_0x3569a1,JSON[_0xcf02('0x25')](_0x56c4e8));})['finally'](function(){logger[_0xcf02('0xe')](_0xcf02('0x26'),_0x3569a1);_0x45745e[_0xcf02('0x27')]();});}else{logger[_0xcf02('0xe')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x3569a1);_0x45745e[_0xcf02('0x27')]();}}else{var _0x4260e2=this;var _0x3bf3f4=apiai(_0x49ad8e[0x0],{'language':_0x49ad8e[0x1]||'en'});return _0x3bf3f4[_0xcf02('0x28')](this[_0xcf02('0x29')][_0xcf02('0x22')],{'sessionId':md5(this[_0xcf02('0x19')]['id'])})[_0xcf02('0x23')](function(_0x4f651c){_0x4260e2['body']['dialogflow']=_0x4f651c;_0x5bd27c[_0xcf02('0x22')]=_0x4f651c[_0xcf02('0x2a')][_0xcf02('0x2b')][_0xcf02('0x2c')];_0x5bd27c[_0xcf02('0x2d')]=_0xcf02('0x2e');_0x5bd27c[_0xcf02('0x2f')]=JSON[_0xcf02('0x25')](_0x4f651c);return rpc[_0x4448c2+_0xcf02('0x30')][_0xcf02('0x31')](_0x5bd27c)[_0xcf02('0x23')](function(_0x58c2a3){logger['info'](_0xcf02('0xf'),_0x3569a1,_0x5bd27c[_0xcf02('0x22')]);if(_0x4f651c[_0xcf02('0x2a')][_0xcf02('0x32')][_0xcf02('0x33')]){_0x45745e[_0xcf02('0x11')]();}else{_0x45745e[_0xcf02('0x27')]();}})[_0xcf02('0x24')](function(_0x32edbf){logger['error'](_0xcf02('0xf'),_0x3569a1,JSON[_0xcf02('0x25')](_0x32edbf));_0x45745e[_0xcf02('0x11')]();});})['catch'](function(_0x2bef8e){logger[_0xcf02('0x34')]('[%s][DIALOGFLOW]\x20%s',_0x3569a1,_0x2bef8e[_0xcf02('0x29')]);_0x45745e[_0xcf02('0x11')]();});}}catch(_0x5bb15e){logger[_0xcf02('0x34')](_0xcf02('0xf'),_0x3569a1,JSON[_0xcf02('0x25')](_0x5bb15e));_0x45745e[_0xcf02('0x27')]();}};}; \ No newline at end of file +var _0xad40=['textRequest','message','then','dialogflow','result','providerName','stringify','metadata','endConversation','error','lodash','moment','apiai-promise','md5','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','account','AccountId','upperFirst','created','isEmpty','body','Message','create','info','catch','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!'];(function(_0x1a08cc,_0x1ff763){var _0x2ce2ec=function(_0x4c28a9){while(--_0x4c28a9){_0x1a08cc['push'](_0x1a08cc['shift']());}};_0x2ce2ec(++_0x1ff763);}(_0xad40,0xfa));var _0x0ad4=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xad40[_0x31e29a];return _0x32d892;};'use strict';var _=require(_0x0ad4('0x0'));var moment=require(_0x0ad4('0x1'));var apiai=require(_0x0ad4('0x2'));var md5=require(_0x0ad4('0x3'));var utils=require('./utils');var logger=require(_0x0ad4('0x4'))(_0x0ad4('0x5'));var rpc={'chatMessage':require(_0x0ad4('0x6')),'openchannelMessage':require(_0x0ad4('0x7')),'mailMessage':require(_0x0ad4('0x8')),'smsMessage':require(_0x0ad4('0x9')),'faxMessage':require(_0x0ad4('0xa')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x0ad4('0xb')]=function(_0x1ad5fc,_0x1fa7ac){return function(_0x3e738d){try{if(!_[_0x0ad4('0xc')](this[_0x0ad4('0xd')][_0x0ad4('0xe')])){logger['info'](_0x0ad4('0xf'),_0x1ad5fc,_0x0ad4('0x10'));return _0x3e738d[_0x0ad4('0x11')]();}var _0x2c5757={'ContactId':this[_0x0ad4('0x12')]['id'],'sentAt':moment()[_0x0ad4('0x13')](_0x0ad4('0x14')),'direction':'out'};if(this[_0x0ad4('0x15')]===_0x0ad4('0x16')||this[_0x0ad4('0x15')]===_0x0ad4('0x17')){_0x2c5757[_0x0ad4('0x18')]=this[_0x0ad4('0xd')][_0x0ad4('0x18')];}var _0x67f340=this[_0x0ad4('0x15')];if(_0x67f340===_0x0ad4('0x19')){_0x2c5757['ChatWebsiteId']=this[_0x0ad4('0x1a')]['id'];}else{_0x2c5757[_['upperFirst'](_0x67f340)+_0x0ad4('0x1b')]=this['account']['id'];}_0x2c5757[_[_0x0ad4('0x1c')](_0x67f340)+'InteractionId']=this[_0x0ad4('0xd')]['id'];if(this['interaction'][_0x0ad4('0x1d')]){var _0x5a611f=_0x1fa7ac[0x2];if(!_[_0x0ad4('0x1e')](_0x5a611f)){_0x2c5757[_0x0ad4('0x1f')]=utils['getMustacheRender'](_0x5a611f,this);return rpc[_0x67f340+_0x0ad4('0x20')][_0x0ad4('0x21')](_0x2c5757)['then'](function(_0x196d75){logger[_0x0ad4('0x22')](_0x0ad4('0xf'),_0x1ad5fc,_0x2c5757[_0x0ad4('0x1f')]);})[_0x0ad4('0x23')](function(_0x5a3460){logger['error'](_0x0ad4('0xf'),_0x1ad5fc,JSON['stringify'](_0x5a3460));})['finally'](function(){logger[_0x0ad4('0x22')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x1ad5fc);_0x3e738d[_0x0ad4('0x24')]();});}else{logger[_0x0ad4('0x22')](_0x0ad4('0x25'),_0x1ad5fc);_0x3e738d[_0x0ad4('0x24')]();}}else{var _0x34810e=this;var _0x327bf8=apiai(_0x1fa7ac[0x0],{'language':_0x1fa7ac[0x1]||'en'});return _0x327bf8[_0x0ad4('0x26')](this[_0x0ad4('0x27')][_0x0ad4('0x1f')],{'sessionId':md5(this[_0x0ad4('0xd')]['id'])})[_0x0ad4('0x28')](function(_0x2bd3f2){_0x34810e[_0x0ad4('0x1f')][_0x0ad4('0x29')]=_0x2bd3f2;_0x2c5757['body']=_0x2bd3f2[_0x0ad4('0x2a')]['fulfillment']['speech'];_0x2c5757[_0x0ad4('0x2b')]=_0x0ad4('0x29');_0x2c5757['providerResponse']=JSON[_0x0ad4('0x2c')](_0x2bd3f2);return rpc[_0x67f340+_0x0ad4('0x20')][_0x0ad4('0x21')](_0x2c5757)[_0x0ad4('0x28')](function(_0x53af91){logger[_0x0ad4('0x22')](_0x0ad4('0xf'),_0x1ad5fc,_0x2c5757[_0x0ad4('0x1f')]);if(_0x2bd3f2[_0x0ad4('0x2a')][_0x0ad4('0x2d')][_0x0ad4('0x2e')]){_0x3e738d['next']();}else{_0x3e738d[_0x0ad4('0x24')]();}})[_0x0ad4('0x23')](function(_0x529826){logger['error'](_0x0ad4('0xf'),_0x1ad5fc,JSON['stringify'](_0x529826));_0x3e738d['next']();});})[_0x0ad4('0x23')](function(_0x4df804){logger[_0x0ad4('0x2f')](_0x0ad4('0xf'),_0x1ad5fc,_0x4df804[_0x0ad4('0x27')]);_0x3e738d['next']();});}}catch(_0x2e8fed){logger[_0x0ad4('0x2f')](_0x0ad4('0xf'),_0x1ad5fc,JSON[_0x0ad4('0x2c')](_0x2e8fed));_0x3e738d[_0x0ad4('0x24')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index a6c1ec1..1146320 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 _0x2930=['detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','dialogflowV2','fulfillmentText','all','stack','lodash','dialogflow','md5','bluebird','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','error','consequence','isNil','interaction','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','then','catch','stringify','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','message'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x2930,0xa0));var _0x0293=function(_0x12f8ca,_0x38c845){_0x12f8ca=_0x12f8ca-0x0;var _0x222fce=_0x2930[_0x12f8ca];return _0x222fce;};'use strict';var _=require(_0x0293('0x0'));var dialogflow=require(_0x0293('0x1'));var md5=require(_0x0293('0x2'));var moment=require('moment');var Promise=require(_0x0293('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x0293('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x0293('0x5')),'whatsappMessage':require(_0x0293('0x6'))};function createMessage(_0x58c80b,_0x33fc4b,_0x52cb27,_0x2f0047){return new Promise(function(_0x1701cc,_0x1dad8f){var _0x40e860=_[_0x0293('0x7')](_0x52cb27);_0x40e860[_0x0293('0x8')]=_0x2f0047;return rpc[_0x33fc4b+_0x0293('0x9')][_0x0293('0xa')](_0x40e860)['then'](function(){logger[_0x0293('0xb')](_0x0293('0xc'),_0x58c80b,_0x40e860[_0x0293('0x8')]);_0x1701cc();})['catch'](function(_0x54a883){logger[_0x0293('0xd')](_0x0293('0xc'),_0x58c80b,JSON['stringify'](_0x54a883));_0x1dad8f(_0x54a883);});});}exports[_0x0293('0xe')]=function(_0x59d908,_0x17bb22){return function(_0x3732bd){try{if(!_[_0x0293('0xf')](this[_0x0293('0x10')]['UserId'])){logger[_0x0293('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x59d908,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x3732bd[_0x0293('0x11')]();}var _0x3dbfb5={'ContactId':this[_0x0293('0x12')]['id'],'sentAt':moment()[_0x0293('0x13')](_0x0293('0x14')),'direction':'out'};if(this[_0x0293('0x15')]==='sms'||this[_0x0293('0x15')]===_0x0293('0x16')){_0x3dbfb5[_0x0293('0x17')]=this[_0x0293('0x10')][_0x0293('0x17')];}var _0x31d2ce=this['channel'];if(_0x31d2ce==='chat'){_0x3dbfb5['ChatWebsiteId']=this[_0x0293('0x18')]['id'];}else{_0x3dbfb5[_[_0x0293('0x19')](_0x31d2ce)+_0x0293('0x1a')]=this[_0x0293('0x18')]['id'];}_0x3dbfb5[_[_0x0293('0x19')](_0x31d2ce)+_0x0293('0x1b')]=this[_0x0293('0x10')]['id'];if(this[_0x0293('0x10')][_0x0293('0x1c')]){var _0x5d91c1=_0x17bb22[0x4];if(!_[_0x0293('0x1d')](_0x5d91c1)){_0x3dbfb5[_0x0293('0x8')]=utils[_0x0293('0x1e')](_0x5d91c1,this);return rpc[_0x31d2ce+_0x0293('0x9')]['create'](_0x3dbfb5)[_0x0293('0x1f')](function(_0x1ce3da){logger[_0x0293('0xb')]('[%s][DIALOGFLOWV2]\x20%s',_0x59d908,_0x3dbfb5[_0x0293('0x8')]);})[_0x0293('0x20')](function(_0x5decf0){logger[_0x0293('0xd')](_0x0293('0xc'),_0x59d908,JSON[_0x0293('0x21')](_0x5decf0));})[_0x0293('0x22')](function(){logger[_0x0293('0xb')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x59d908);_0x3732bd['stop']();});}else{logger[_0x0293('0xb')](_0x0293('0x23'),_0x59d908);_0x3732bd[_0x0293('0x24')]();}}else{var _0x241cbd=this;var _0x34aae6=_0x17bb22[0x2]['replace'](/\\n/g,'\x0a');var _0x515e2e={'credentials':{'private_key':_0x34aae6,'client_email':_0x17bb22[0x1]}};var _0x2306a3=new dialogflow['SessionsClient'](_0x515e2e);var _0x57f645=_0x2306a3['sessionPath'](_0x17bb22[0x0],md5(_0x241cbd[_0x0293('0x10')]['id']));var _0x6d7f5a={'session':_0x57f645,'queryInput':{'text':{'text':_0x241cbd[_0x0293('0x25')][_0x0293('0x8')],'languageCode':_0x17bb22[0x3]||'en'}}};return _0x2306a3[_0x0293('0x26')](_0x6d7f5a)['then'](function(_0xbf32c5){if(_0xbf32c5&&_0xbf32c5[_0x0293('0x27')]){_0x241cbd[_0x0293('0x8')]['dialogflowV2']=_0xbf32c5;var _0x13b317=_0xbf32c5[0x0];var _0x3bb0b4=_0x13b317[_0x0293('0x28')][_0x0293('0x29')]&&_0x13b317[_0x0293('0x28')][_0x0293('0x29')][_0x0293('0x2a')]?_0x13b317[_0x0293('0x28')][_0x0293('0x29')][_0x0293('0x2a')][_0x0293('0x2b')][_0x0293('0x2c')]:![];_0x241cbd[_0x0293('0x8')][_0x0293('0x2d')]=_0x13b317['queryResult']['action'];_0x241cbd[_0x0293('0x8')][_0x0293('0x2e')]=_0x13b317['queryResult'][_0x0293('0x2f')];_0x241cbd[_0x0293('0x8')][_0x0293('0x30')]=_0x13b317[_0x0293('0x28')][_0x0293('0x29')]&&_0x13b317['queryResult'][_0x0293('0x29')]['fields']?_0x13b317[_0x0293('0x28')]['diagnosticInfo'][_0x0293('0x2a')][_0x0293('0x2b')][_0x0293('0x2c')]:![];_0x241cbd[_0x0293('0x8')][_0x0293('0x31')]=_0x13b317['queryResult'][_0x0293('0x32')][_0x0293('0x33')];_0x241cbd['body'][_0x0293('0x34')]=_0x13b317[_0x0293('0x28')][_0x0293('0x32')][_0x0293('0x35')];_0x241cbd['body'][_0x0293('0x36')]=_0x13b317[_0x0293('0x28')][_0x0293('0x32')][_0x0293('0x37')];_0x241cbd[_0x0293('0x8')][_0x0293('0x38')]=_0x13b317[_0x0293('0x28')][_0x0293('0x39')];_0x241cbd[_0x0293('0x8')][_0x0293('0x3a')]=_0x13b317[_0x0293('0x28')][_0x0293('0x3b')];_0x241cbd[_0x0293('0x8')][_0x0293('0x3c')]=_0x13b317[_0x0293('0x28')]['intentDetectionConfidence'];_0x3dbfb5[_0x0293('0x3d')]=_0x0293('0x3e');_0x3dbfb5['providerResponse']=JSON[_0x0293('0x21')](_0xbf32c5);var _0x13db66=[];for(var _0x576407=0x0;_0x576407<_0xbf32c5['length'];_0x576407++){var _0x2c672b=_0xbf32c5[_0x576407];if(_0x2c672b&&_0x2c672b['queryResult']&&_0x2c672b[_0x0293('0x28')][_0x0293('0x3f')]){_0x13db66['push'](createMessage(_0x59d908,_0x31d2ce,_0x3dbfb5,_0x2c672b[_0x0293('0x28')]['fulfillmentText']));}}return Promise[_0x0293('0x40')](_0x13db66)[_0x0293('0x1f')](function(){if(_0x3bb0b4){_0x3732bd[_0x0293('0x11')]();}else{_0x3732bd[_0x0293('0x24')]();}})[_0x0293('0x20')](function(_0x51350b){logger[_0x0293('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x59d908,JSON[_0x0293('0x21')](_0x51350b));_0x3732bd[_0x0293('0x11')]();});}})[_0x0293('0x20')](function(_0x39b6ce){logger[_0x0293('0xd')](_0x0293('0xc'),_0x59d908,_0x39b6ce[_0x0293('0x25')],_0x39b6ce[_0x0293('0x41')]);_0x3732bd[_0x0293('0x11')]();});}}catch(_0x30599f){logger[_0x0293('0xd')](_0x0293('0xc'),_0x59d908,JSON['stringify'](_0x30599f));_0x3732bd['stop']();}};}; \ No newline at end of file +var _0x8602=['catch','error','stringify','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','getMustacheRender','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','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','DIALOGFLOWV2_INTENTNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','all','next','lodash','md5','moment','bluebird','routing','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','[%s][DIALOGFLOWV2]\x20%s'];(function(_0x5d27a2,_0x289cb9){var _0x565990=function(_0x2866cd){while(--_0x2866cd){_0x5d27a2['push'](_0x5d27a2['shift']());}};_0x565990(++_0x289cb9);}(_0x8602,0x113));var _0x2860=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x8602[_0x246148];return _0x453d94;};'use strict';var _=require(_0x2860('0x0'));var dialogflow=require('dialogflow');var md5=require(_0x2860('0x1'));var moment=require(_0x2860('0x2'));var Promise=require(_0x2860('0x3'));var logger=require('../../../../config/logger')(_0x2860('0x4'));var utils=require(_0x2860('0x5'));var rpc={'chatMessage':require(_0x2860('0x6')),'openchannelMessage':require(_0x2860('0x7')),'mailMessage':require(_0x2860('0x8')),'smsMessage':require(_0x2860('0x9')),'faxMessage':require(_0x2860('0xa')),'whatsappMessage':require(_0x2860('0xb'))};function createMessage(_0x3e8a5a,_0x30f060,_0x329ea1,_0x3ed806){return new Promise(function(_0x1ab0e6,_0x30d35c){var _0x54187f=_['clone'](_0x329ea1);_0x54187f[_0x2860('0xc')]=_0x3ed806;return rpc[_0x30f060+_0x2860('0xd')][_0x2860('0xe')](_0x54187f)[_0x2860('0xf')](function(){logger['info'](_0x2860('0x10'),_0x3e8a5a,_0x54187f[_0x2860('0xc')]);_0x1ab0e6();})[_0x2860('0x11')](function(_0x3d1a17){logger[_0x2860('0x12')](_0x2860('0x10'),_0x3e8a5a,JSON[_0x2860('0x13')](_0x3d1a17));_0x30d35c(_0x3d1a17);});});}exports['consequence']=function(_0x4d090f,_0x5ce76e){return function(_0x8112e8){try{if(!_[_0x2860('0x14')](this[_0x2860('0x15')][_0x2860('0x16')])){logger[_0x2860('0x17')](_0x2860('0x10'),_0x4d090f,_0x2860('0x18'));return _0x8112e8['next']();}var _0x52c3ad={'ContactId':this[_0x2860('0x19')]['id'],'sentAt':moment()[_0x2860('0x1a')](_0x2860('0x1b')),'direction':'out'};if(this[_0x2860('0x1c')]==='sms'||this[_0x2860('0x1c')]===_0x2860('0x1d')){_0x52c3ad['phone']=this['interaction'][_0x2860('0x1e')];}var _0x510481=this[_0x2860('0x1c')];if(_0x510481===_0x2860('0x1f')){_0x52c3ad[_0x2860('0x20')]=this[_0x2860('0x21')]['id'];}else{_0x52c3ad[_[_0x2860('0x22')](_0x510481)+'AccountId']=this['account']['id'];}_0x52c3ad[_[_0x2860('0x22')](_0x510481)+_0x2860('0x23')]=this['interaction']['id'];if(this[_0x2860('0x15')][_0x2860('0x24')]){var _0x293cb5=_0x5ce76e[0x4];if(!_[_0x2860('0x25')](_0x293cb5)){_0x52c3ad[_0x2860('0xc')]=utils[_0x2860('0x26')](_0x293cb5,this);return rpc[_0x510481+_0x2860('0xd')][_0x2860('0xe')](_0x52c3ad)[_0x2860('0xf')](function(_0x465f18){logger['info'](_0x2860('0x10'),_0x4d090f,_0x52c3ad['body']);})[_0x2860('0x11')](function(_0x464f7d){logger[_0x2860('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x4d090f,JSON['stringify'](_0x464f7d));})[_0x2860('0x27')](function(){logger[_0x2860('0x17')](_0x2860('0x28'),_0x4d090f);_0x8112e8['stop']();});}else{logger[_0x2860('0x17')](_0x2860('0x29'),_0x4d090f);_0x8112e8[_0x2860('0x2a')]();}}else{var _0x1f3af6=this;var _0x242b92=_0x5ce76e[0x2][_0x2860('0x2b')](/\\n/g,'\x0a');var _0x337053={'credentials':{'private_key':_0x242b92,'client_email':_0x5ce76e[0x1]}};var _0x5b9c8b=new dialogflow[(_0x2860('0x2c'))](_0x337053);var _0x59a2f1=_0x5b9c8b[_0x2860('0x2d')](_0x5ce76e[0x0],md5(_0x1f3af6['interaction']['id']));var _0x2c7808={'session':_0x59a2f1,'queryInput':{'text':{'text':_0x1f3af6[_0x2860('0x2e')]['body'],'languageCode':_0x5ce76e[0x3]||'en'}}};return _0x5b9c8b[_0x2860('0x2f')](_0x2c7808)[_0x2860('0xf')](function(_0x52bf70){if(_0x52bf70&&_0x52bf70[_0x2860('0x30')]){_0x1f3af6['body'][_0x2860('0x31')]=_0x52bf70;var _0x3b6dee=_0x52bf70[0x0];var _0x3726b9=_0x3b6dee[_0x2860('0x32')][_0x2860('0x33')]&&_0x3b6dee['queryResult']['diagnosticInfo'][_0x2860('0x34')]?_0x3b6dee[_0x2860('0x32')][_0x2860('0x33')][_0x2860('0x34')]['end_conversation'][_0x2860('0x35')]:![];_0x1f3af6[_0x2860('0xc')]['DIALOGFLOWV2_ACTION']=_0x3b6dee[_0x2860('0x32')][_0x2860('0x36')];_0x1f3af6['body'][_0x2860('0x37')]=_0x3b6dee[_0x2860('0x32')]['allRequiredParamsPresent'];_0x1f3af6[_0x2860('0xc')][_0x2860('0x38')]=_0x3b6dee['queryResult'][_0x2860('0x33')]&&_0x3b6dee['queryResult'][_0x2860('0x33')][_0x2860('0x34')]?_0x3b6dee['queryResult'][_0x2860('0x33')][_0x2860('0x34')][_0x2860('0x39')][_0x2860('0x35')]:![];_0x1f3af6[_0x2860('0xc')][_0x2860('0x3a')]=_0x3b6dee['queryResult'][_0x2860('0x3b')]['name'];_0x1f3af6[_0x2860('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x3b6dee['queryResult'][_0x2860('0x3b')][_0x2860('0x3c')];_0x1f3af6['body'][_0x2860('0x3d')]=_0x3b6dee[_0x2860('0x32')]['intent'][_0x2860('0x3e')];_0x1f3af6[_0x2860('0xc')][_0x2860('0x3f')]=_0x3b6dee['queryResult'][_0x2860('0x40')];_0x1f3af6[_0x2860('0xc')][_0x2860('0x41')]=_0x3b6dee[_0x2860('0x32')][_0x2860('0x42')];_0x1f3af6[_0x2860('0xc')][_0x2860('0x43')]=_0x3b6dee['queryResult'][_0x2860('0x44')];_0x52c3ad[_0x2860('0x45')]='dialogflowV2';_0x52c3ad['providerResponse']=JSON['stringify'](_0x52bf70);var _0x13300c=[];for(var _0x2aaa25=0x0;_0x2aaa25<_0x52bf70['length'];_0x2aaa25++){var _0x22e9f5=_0x52bf70[_0x2aaa25];if(_0x22e9f5&&_0x22e9f5['queryResult']&&_0x22e9f5[_0x2860('0x32')]['fulfillmentText']){_0x13300c['push'](createMessage(_0x4d090f,_0x510481,_0x52c3ad,_0x22e9f5['queryResult'][_0x2860('0x46')]));}}return Promise[_0x2860('0x47')](_0x13300c)['then'](function(){if(_0x3726b9){_0x8112e8[_0x2860('0x48')]();}else{_0x8112e8['stop']();}})[_0x2860('0x11')](function(_0x1443dc){logger[_0x2860('0x12')](_0x2860('0x10'),_0x4d090f,JSON[_0x2860('0x13')](_0x1443dc));_0x8112e8[_0x2860('0x48')]();});}})[_0x2860('0x11')](function(_0x3ab1a0){logger[_0x2860('0x12')](_0x2860('0x10'),_0x4d090f,_0x3ab1a0['message'],_0x3ab1a0['stack']);_0x8112e8[_0x2860('0x48')]();});}}catch(_0x5bb192){logger[_0x2860('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x4d090f,JSON[_0x2860('0x13')](_0x5bb192));_0x8112e8['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index b70458f..afe74e4 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 _0x6c64=['info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules'];(function(_0x3822b1,_0x59a996){var _0xc31485=function(_0x5113e4){while(--_0x5113e4){_0x3822b1['push'](_0x3822b1['shift']());}};_0xc31485(++_0x59a996);}(_0x6c64,0x8a));var _0x46c6=function(_0x32ca64,_0x2bf03e){_0x32ca64=_0x32ca64-0x0;var _0x375492=_0x6c64[_0x32ca64];return _0x375492;};'use strict';var schema=require(_0x46c6('0x0'));var _=require('lodash');var htmlToText=require(_0x46c6('0x1'));var utils=require(_0x46c6('0x2'));var logger=require(_0x46c6('0x3'))(_0x46c6('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x46c6('0x5')},'priorityTrue':{'type':_0x46c6('0x6'),'message':_0x46c6('0x7')},'priorityFalse':{'type':_0x46c6('0x6'),'message':_0x46c6('0x8')}});exports['consequence']=function(_0x4deb8e,_0x190169){return function(_0x43db0d){try{var _0x3fad95={'condition':htmlToText['fromString'](utils[_0x46c6('0x9')](_0x190169[0x0],this),{'wordwrap':![]})[_0x46c6('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x190169[0x1],'priorityFalse':_0x190169[0x2]};var _0x60e7b6=gotoif[_0x46c6('0x0')](_0x3fad95,{'typecast':!![]});if(_0x60e7b6[_0x46c6('0xb')]){logger[_0x46c6('0xc')](_0x46c6('0xd'),_0x4deb8e,_[_0x46c6('0xe')](_0x60e7b6,_0x46c6('0xf'))['join'](',\x20'));_0x43db0d[_0x46c6('0x10')]();}else{try{var _0x45d718=eval('('+_0x3fad95[_0x46c6('0x11')]+')');var _0x2bbc4b=_0x45d718?_0x3fad95[_0x46c6('0x12')]:_0x3fad95[_0x46c6('0x13')];logger['info'](_0x46c6('0x14'),_0x4deb8e,_0x3fad95['condition'],_0x45d718,_0x2bbc4b||_0x46c6('0x15'));if(_0x2bbc4b){var _0x8b82a5=_[_0x46c6('0x16')](_0x43db0d[_0x46c6('0x17')](),{'p':_0x2bbc4b});if(_0x8b82a5>=0x0){logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x4deb8e,_0x2bbc4b||'next',_0x8b82a5);_0x43db0d['next'](_0x8b82a5);}else{logger[_0x46c6('0x18')](_0x46c6('0x19'),_0x4deb8e,_0x2bbc4b||_0x46c6('0x15'));_0x43db0d[_0x46c6('0x10')]();}}else{_0x43db0d[_0x46c6('0x15')]();}}catch(_0x14770f){logger[_0x46c6('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x4deb8e,_0x14770f[_0x46c6('0xf')]);_0x43db0d['stop']();}}}catch(_0x4b3e7a){logger[_0x46c6('0xc')](_0x46c6('0xd'),_0x4deb8e,JSON[_0x46c6('0x1a')](_0x4b3e7a));_0x43db0d['stop']();}};}; \ No newline at end of file +var _0x1b76=['[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','error','stringify','lodash','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','consequence','fromString','replace','validate','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','findIndex','rules'];(function(_0x5f3f60,_0x5623b3){var _0x3f0e96=function(_0x2cd826){while(--_0x2cd826){_0x5f3f60['push'](_0x5f3f60['shift']());}};_0x3f0e96(++_0x5623b3);}(_0x1b76,0x112));var _0x61b7=function(_0x75f869,_0x3690d6){_0x75f869=_0x75f869-0x0;var _0x10af8b=_0x1b76[_0x75f869];return _0x10af8b;};'use strict';var schema=require('validate');var _=require(_0x61b7('0x0'));var htmlToText=require(_0x61b7('0x1'));var utils=require(_0x61b7('0x2'));var logger=require(_0x61b7('0x3'))(_0x61b7('0x4'));var gotoif=schema({'condition':{'type':_0x61b7('0x5'),'required':!![],'message':_0x61b7('0x6')},'priorityTrue':{'type':'number','message':_0x61b7('0x7')},'priorityFalse':{'type':_0x61b7('0x8'),'message':_0x61b7('0x9')}});exports[_0x61b7('0xa')]=function(_0x38da25,_0x2de04a){return function(_0x17bce5){try{var _0x4dc881={'condition':htmlToText[_0x61b7('0xb')](utils['getMustacheRender'](_0x2de04a[0x0],this),{'wordwrap':![]})[_0x61b7('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x2de04a[0x1],'priorityFalse':_0x2de04a[0x2]};var _0x2ea83b=gotoif[_0x61b7('0xd')](_0x4dc881,{'typecast':!![]});if(_0x2ea83b[_0x61b7('0xe')]){logger['error'](_0x61b7('0xf'),_0x38da25,_[_0x61b7('0x10')](_0x2ea83b,_0x61b7('0x11'))[_0x61b7('0x12')](',\x20'));_0x17bce5[_0x61b7('0x13')]();}else{try{var _0x67183f=eval('('+_0x4dc881['condition']+')');var _0xb25e13=_0x67183f?_0x4dc881['priorityTrue']:_0x4dc881[_0x61b7('0x14')];logger[_0x61b7('0x15')](_0x61b7('0x16'),_0x38da25,_0x4dc881[_0x61b7('0x17')],_0x67183f,_0xb25e13||'next');if(_0xb25e13){var _0x5d66d1=_[_0x61b7('0x18')](_0x17bce5[_0x61b7('0x19')](),{'p':_0xb25e13});if(_0x5d66d1>=0x0){logger[_0x61b7('0x15')](_0x61b7('0x1a'),_0x38da25,_0xb25e13||'next',_0x5d66d1);_0x17bce5[_0x61b7('0x1b')](_0x5d66d1);}else{logger[_0x61b7('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x38da25,_0xb25e13||_0x61b7('0x1b'));_0x17bce5['stop']();}}else{_0x17bce5[_0x61b7('0x1b')]();}}catch(_0x1a0b33){logger[_0x61b7('0x1c')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x38da25,_0x1a0b33['message']);_0x17bce5['stop']();}}}catch(_0x3f3b9e){logger[_0x61b7('0x1c')](_0x61b7('0xf'),_0x38da25,JSON[_0x61b7('0x1d')](_0x3f3b9e));_0x17bce5[_0x61b7('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 45f952a..a1d1114 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 _0x7e25=['next','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules'];(function(_0x40c5f1,_0x11f611){var _0x32c500=function(_0x3679d8){while(--_0x3679d8){_0x40c5f1['push'](_0x40c5f1['shift']());}};_0x32c500(++_0x11f611);}(_0x7e25,0x158));var _0x57e2=function(_0xdf1858,_0x5692d0){_0xdf1858=_0xdf1858-0x0;var _0x3e64f0=_0x7e25[_0xdf1858];return _0x3e64f0;};'use strict';var schema=require(_0x57e2('0x0'));var _=require('lodash');var logger=require(_0x57e2('0x1'))(_0x57e2('0x2'));var gotop=schema({'priority':{'type':_0x57e2('0x3'),'required':!![],'message':_0x57e2('0x4')}});exports[_0x57e2('0x5')]=function(_0x148bbc,_0x2a4c93){return function(_0x1fb160){try{var _0x23c4bb={'priority':_0x2a4c93[0x0]};var _0x28c361=gotop[_0x57e2('0x0')](_0x23c4bb,{'typecast':!![]});if(_0x28c361[_0x57e2('0x6')]){logger[_0x57e2('0x7')](_0x57e2('0x8'),_0x148bbc,_['map'](_0x28c361,_0x57e2('0x9'))[_0x57e2('0xa')](',\x20'));_0x1fb160[_0x57e2('0xb')]();}else{logger[_0x57e2('0xc')](_0x57e2('0xd'),_0x148bbc,_0x23c4bb['priority']);if(_0x23c4bb[_0x57e2('0xe')]){var _0x111b47=_[_0x57e2('0xf')](_0x1fb160[_0x57e2('0x10')](),{'p':_0x23c4bb[_0x57e2('0xe')]});if(_0x111b47>=0x0){logger[_0x57e2('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x148bbc,_0x23c4bb['priority']||'next',_0x111b47);_0x1fb160[_0x57e2('0x11')](_0x111b47);}else{logger[_0x57e2('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x148bbc,_0x23c4bb[_0x57e2('0xe')]||_0x57e2('0x11'));_0x1fb160[_0x57e2('0xb')]();}}else{_0x1fb160['next']();}}}catch(_0x44e806){logger[_0x57e2('0x7')](_0x57e2('0x8'),_0x148bbc,JSON[_0x57e2('0x12')](_0x44e806));_0x1fb160[_0x57e2('0xb')]();}};}; \ No newline at end of file +var _0x2167=['routing','number','length','[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','priority','next','error','validate','lodash','../../../../config/logger'];(function(_0x340d66,_0x108a4e){var _0xd5c3cc=function(_0x7d205d){while(--_0x7d205d){_0x340d66['push'](_0x340d66['shift']());}};_0xd5c3cc(++_0x108a4e);}(_0x2167,0xc5));var _0x7216=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x2167[_0x37bd26];return _0xe83dc4;};'use strict';var schema=require(_0x7216('0x0'));var _=require(_0x7216('0x1'));var logger=require(_0x7216('0x2'))(_0x7216('0x3'));var gotop=schema({'priority':{'type':_0x7216('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x32c6f6,_0x66e2cd){return function(_0x563ece){try{var _0x58ae46={'priority':_0x66e2cd[0x0]};var _0x23ac30=gotop[_0x7216('0x0')](_0x58ae46,{'typecast':!![]});if(_0x23ac30[_0x7216('0x5')]){logger['error'](_0x7216('0x6'),_0x32c6f6,_[_0x7216('0x7')](_0x23ac30,_0x7216('0x8'))[_0x7216('0x9')](',\x20'));_0x563ece[_0x7216('0xa')]();}else{logger['info'](_0x7216('0xb'),_0x32c6f6,_0x58ae46['priority']);if(_0x58ae46['priority']){var _0x8b6544=_[_0x7216('0xc')](_0x563ece[_0x7216('0xd')](),{'p':_0x58ae46['priority']});if(_0x8b6544>=0x0){logger[_0x7216('0xe')](_0x7216('0xf'),_0x32c6f6,_0x58ae46['priority']||'next',_0x8b6544);_0x563ece['next'](_0x8b6544);}else{logger[_0x7216('0xe')](_0x7216('0x10'),_0x32c6f6,_0x58ae46[_0x7216('0x11')]||_0x7216('0x12'));_0x563ece[_0x7216('0xa')]();}}else{_0x563ece[_0x7216('0x12')]();}}}catch(_0x190a4f){logger[_0x7216('0x13')](_0x7216('0x6'),_0x32c6f6,JSON['stringify'](_0x190a4f));_0x563ece['stop']();}};}; \ 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 22c8bc2..bd09b4f 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 _0x6ccc=['account','upperFirst','channel','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','contact','chat','ChatWebsiteId'];(function(_0x5ec21d,_0x5d0772){var _0x43bde8=function(_0x1bfc7c){while(--_0x1bfc7c){_0x5ec21d['push'](_0x5ec21d['shift']());}};_0x43bde8(++_0x5d0772);}(_0x6ccc,0x197));var _0xc6cc=function(_0x3d6d80,_0x1689b7){_0x3d6d80=_0x3d6d80-0x0;var _0x30712a=_0x6ccc[_0x3d6d80];return _0x30712a;};'use strict';var _=require(_0xc6cc('0x0'));var utils=require(_0xc6cc('0x1'));var logger=require('../../../../config/logger')(_0xc6cc('0x2'));var rpc={'chatMessage':require(_0xc6cc('0x3')),'openchannelMessage':require(_0xc6cc('0x4')),'mailMessage':require(_0xc6cc('0x5')),'smsMessage':require(_0xc6cc('0x6')),'faxMessage':require(_0xc6cc('0x7')),'whatsappMessage':require(_0xc6cc('0x8'))};exports['consequence']=function(_0xaf2e1e,_0x343685){return function(_0x254a3a){try{var _0x15013d={'body':utils[_0xc6cc('0x9')](_0x343685[0x0],this),'ContactId':this[_0xc6cc('0xa')]['id']};if(this['channel']===_0xc6cc('0xb')){_0x15013d[_0xc6cc('0xc')]=this[_0xc6cc('0xd')]['id'];}else{_0x15013d[_[_0xc6cc('0xe')](this[_0xc6cc('0xf')])+_0xc6cc('0x10')]=this[_0xc6cc('0xd')]['id'];}_0x15013d[_[_0xc6cc('0xe')](this[_0xc6cc('0xf')])+_0xc6cc('0x11')]=this[_0xc6cc('0x12')]['id'];if(rpc[this[_0xc6cc('0xf')]+_0xc6cc('0x13')]){return rpc[this['channel']+_0xc6cc('0x13')][_0xc6cc('0x14')](_0x15013d)[_0xc6cc('0x15')](function(_0x111721){logger[_0xc6cc('0x16')](_0xc6cc('0x17'),_0xaf2e1e,_0x15013d[_0xc6cc('0x18')]);_0x254a3a[_0xc6cc('0x19')]();})[_0xc6cc('0x1a')](function(_0x3ede18){logger[_0xc6cc('0x1b')](_0xc6cc('0x17'),_0xaf2e1e,JSON[_0xc6cc('0x1c')](_0x3ede18));_0x254a3a[_0xc6cc('0x1d')]();});}}catch(_0xf56c7e){logger[_0xc6cc('0x1b')](_0xc6cc('0x17'),_0xaf2e1e,JSON[_0xc6cc('0x1c')](_0xf56c7e));_0x254a3a[_0xc6cc('0x1d')]();}};}; \ No newline at end of file +var _0xe6b6=['../../rpc/whatsappMessage','consequence','contact','ChatWebsiteId','account','upperFirst','channel','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/smsMessage'];(function(_0x20344b,_0x41d19f){var _0x1a47ec=function(_0xd43c49){while(--_0xd43c49){_0x20344b['push'](_0x20344b['shift']());}};_0x1a47ec(++_0x41d19f);}(_0xe6b6,0x150));var _0x6e6b=function(_0x39389d,_0x93fe6){_0x39389d=_0x39389d-0x0;var _0xab3c25=_0xe6b6[_0x39389d];return _0xab3c25;};'use strict';var _=require('lodash');var utils=require(_0x6e6b('0x0'));var logger=require(_0x6e6b('0x1'))('routing');var rpc={'chatMessage':require(_0x6e6b('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x6e6b('0x3')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x6e6b('0x4'))};exports[_0x6e6b('0x5')]=function(_0x3e591e,_0x5c0fdc){return function(_0x528f42){try{var _0x1bb636={'body':utils['getMustacheRender'](_0x5c0fdc[0x0],this),'ContactId':this[_0x6e6b('0x6')]['id']};if(this['channel']==='chat'){_0x1bb636[_0x6e6b('0x7')]=this[_0x6e6b('0x8')]['id'];}else{_0x1bb636[_[_0x6e6b('0x9')](this[_0x6e6b('0xa')])+'AccountId']=this[_0x6e6b('0x8')]['id'];}_0x1bb636[_[_0x6e6b('0x9')](this['channel'])+'InteractionId']=this[_0x6e6b('0xb')]['id'];if(rpc[this[_0x6e6b('0xa')]+'Message']){return rpc[this[_0x6e6b('0xa')]+_0x6e6b('0xc')][_0x6e6b('0xd')](_0x1bb636)[_0x6e6b('0xe')](function(_0xd37e20){logger[_0x6e6b('0xf')](_0x6e6b('0x10'),_0x3e591e,_0x1bb636[_0x6e6b('0x11')]);_0x528f42['next']();})[_0x6e6b('0x12')](function(_0x3921cd){logger['error']('[%s][MESSAGE]\x20%s',_0x3e591e,JSON['stringify'](_0x3921cd));_0x528f42['stop']();});}}catch(_0x3e9020){logger['error'](_0x6e6b('0x10'),_0x3e591e,JSON[_0x6e6b('0x13')](_0x3e9020));_0x528f42['stop']();}};}; \ 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 bb094b5..4321f9c 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 _0xfb28=['stop','./utils','../../../../config/logger','routing','info','getMustacheRender','next','[%s][NOOP]\x20%s','stringify'];(function(_0xfb3d34,_0x517515){var _0xb16c16=function(_0x19c417){while(--_0x19c417){_0xfb3d34['push'](_0xfb3d34['shift']());}};_0xb16c16(++_0x517515);}(_0xfb28,0x172));var _0x8fb2=function(_0x20073f,_0x51044d){_0x20073f=_0x20073f-0x0;var _0x3b79c9=_0xfb28[_0x20073f];return _0x3b79c9;};'use strict';var utils=require(_0x8fb2('0x0'));var logger=require(_0x8fb2('0x1'))(_0x8fb2('0x2'));exports['consequence']=function(_0x461936,_0x296978){return function(_0x2cb352){try{logger[_0x8fb2('0x3')]('[%s][NOOP]\x20%s',_0x461936,utils[_0x8fb2('0x4')](_0x296978[0x0],this));_0x2cb352[_0x8fb2('0x5')]();}catch(_0x5a4937){logger['error'](_0x8fb2('0x6'),_0x461936,JSON[_0x8fb2('0x7')](_0x5a4937));_0x2cb352[_0x8fb2('0x8')]();}};}; \ No newline at end of file +var _0x6889=['[%s][NOOP]\x20%s','getMustacheRender','next','error','stop','../../../../config/logger','routing','consequence','info'];(function(_0xf46ea,_0xd97598){var _0x363349=function(_0x405ad8){while(--_0x405ad8){_0xf46ea['push'](_0xf46ea['shift']());}};_0x363349(++_0xd97598);}(_0x6889,0x11c));var _0x9688=function(_0x4e668b,_0x35b443){_0x4e668b=_0x4e668b-0x0;var _0xba75aa=_0x6889[_0x4e668b];return _0xba75aa;};'use strict';var utils=require('./utils');var logger=require(_0x9688('0x0'))(_0x9688('0x1'));exports[_0x9688('0x2')]=function(_0x55934c,_0x5dcba5){return function(_0x119668){try{logger[_0x9688('0x3')](_0x9688('0x4'),_0x55934c,utils[_0x9688('0x5')](_0x5dcba5[0x0],this));_0x119668[_0x9688('0x6')]();}catch(_0x23b678){logger[_0x9688('0x7')](_0x9688('0x4'),_0x55934c,JSON['stringify'](_0x23b678));_0x119668[_0x9688('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index f59cf5b..e5f0821 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 _0x5460=['catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','error','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','[%s][QUEUE]\x20%s','join','Queues','createQueue','atimeout','end','close','rules','stop','complete','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','capitalize','InteractionId','format','pick','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','QueueId','upperFirst','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport'];(function(_0x50ad53,_0x21b87d){var _0x4c050c=function(_0x1c490b){while(--_0x1c490b){_0x50ad53['push'](_0x50ad53['shift']());}};_0x4c050c(++_0x21b87d);}(_0x5460,0x177));var _0x0546=function(_0x4b14bb,_0xe7b4d3){_0x4b14bb=_0x4b14bb-0x0;var _0x285200=_0x5460[_0x4b14bb];return _0x285200;};'use strict';var schema=require(_0x0546('0x0'));var _=require(_0x0546('0x1'));var util=require(_0x0546('0x2'));var seqqueue=require(_0x0546('0x3'));var moment=require(_0x0546('0x4'));var Redis=require(_0x0546('0x5'));var config=require(_0x0546('0x6'));var logger=require(_0x0546('0x7'))(_0x0546('0x8'));var strategy=require(_0x0546('0x9'));config[_0x0546('0xa')]=_['defaults'](config[_0x0546('0xa')],{'host':_0x0546('0xb'),'port':0x18eb});var io=require(_0x0546('0xc'))(new Redis(config[_0x0546('0xa')]));var attributes=['id',_0x0546('0xd'),_0x0546('0xe'),_0x0546('0xf'),_0x0546('0x10'),_0x0546('0x11')];function emit(_0x3fe53f,_0x17d878,_0x51c8a8){io['to'](_0x3fe53f)['emit'](_0x17d878,_0x51c8a8);}function emitChannelQueueInteraction(_0x4d05ec,_0x2731e4,_0x4f7780,_0x597f11,_0x2675dc,_0x3e1032,_0x4aad28,_0x19437c){var _0x16be76=_['clone'](_0x4f7780);_0x16be76[_0x0546('0xd')]=_0x19437c;_0x16be76['queue']=_0x2731e4;_0x16be76['account']=_0x597f11;_0x16be76['id']=_0x2675dc;if(_0x3e1032){attributes['push'](_[_0x0546('0x12')](_0x4d05ec)+_0x0546('0x13'));_0x4aad28[util[_0x0546('0x14')]('%sQueuesWaitingInteractions',_0x4d05ec)][_0x2675dc]=_[_0x0546('0x15')](_0x16be76,attributes);}else{delete _0x4aad28[util['format'](_0x0546('0x16'),_0x4d05ec)][_0x2675dc];}emit(util[_0x0546('0x14')](_0x0546('0x17'),_0x4d05ec,_0x2731e4),util[_0x0546('0x14')](_0x0546('0x18'),_0x4d05ec,_0x3e1032?_0x0546('0x19'):_0x0546('0x1a')),_[_0x0546('0x15')](_0x16be76,attributes));}var rpc={'openchannelQueueReport':require(_0x0546('0x1b')),'mailQueueReport':require(_0x0546('0x1c')),'chatQueueReport':require(_0x0546('0x1d')),'smsQueueReport':require(_0x0546('0x1e')),'faxQueueReport':require(_0x0546('0x1f')),'whatsappQueueReport':require(_0x0546('0x20')),'chatInteraction':require(_0x0546('0x21')),'faxInteraction':require(_0x0546('0x22')),'mailInteraction':require(_0x0546('0x23')),'openchannelInteraction':require(_0x0546('0x24')),'smsInteraction':require(_0x0546('0x25')),'whatsappInteraction':require(_0x0546('0x26'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0546('0x27')},'timeout':{'type':_0x0546('0x28'),'message':_0x0546('0x29')}});function startRouting(_0x74485c,_0x4ee637,_0x472714,_0xf96907){if(_0x74485c&&_0x4ee637&&_0x472714){_0x4ee637[_0x0546('0x2a')]+=0x1;var _0xf0324c={'uniqueid':_0x74485c,'from':_0x472714[_0x0546('0x2b')]?_0x472714[_0x0546('0x2b')][_0x0546('0x10')]:'','joinAt':moment()[_0x0546('0x14')](_0x0546('0x2c')),'ContactId':_0x472714[_0x0546('0x2d')]?_0x472714[_0x0546('0x2d')]['id']:null,'ListId':_0x472714['list']?_0x472714[_0x0546('0x2e')]['id']:null};_0xf0324c[_['upperFirst'](_0x472714['channel'])+_0x0546('0x2f')]=_0x4ee637['id']||null;_0xf0324c[_[_0x0546('0x30')](_0x472714['channel'])+_0x0546('0x13')]=_0x472714[_0x0546('0x31')]?_0x472714[_0x0546('0x31')]['id']:null;_0xf0324c[_[_0x0546('0x30')](_0x472714[_0x0546('0x32')])+_0x0546('0x33')]=_0x472714['message']?_0x472714[_0x0546('0x34')]['id']:null;_0xf0324c[_[_0x0546('0x30')](_0x472714['channel'])+(_0x472714[_0x0546('0x32')]!==_0x0546('0x35')?_0x0546('0x36'):_0x0546('0x37'))]=_0x472714[_0x0546('0xe')]?_0x472714[_0x0546('0xe')]['id']:null;logger[_0x0546('0x38')](util[_0x0546('0x14')](_0x0546('0x39'),_0x74485c,_0x4ee637[_0x0546('0x3a')]));emitChannelQueueInteraction(_0x472714[_0x0546('0x32')],_0x4ee637[_0x0546('0x3a')],_0xf0324c,_0x472714[_0x0546('0xe')][_0x0546('0x3a')],_0x472714[_0x0546('0x34')]['id'],!![],_0xf96907,_0x4ee637['id']);if(rpc[_0x472714[_0x0546('0x32')]+_0x0546('0x3b')]){return rpc[_0x472714[_0x0546('0x32')]+_0x0546('0x3b')]['create'](_0xf0324c)[_0x0546('0x3c')](function(_0x27eb7f){logger['error'](_0x0546('0x3d'),_0x27eb7f);});}}}function stopRouting(_0x2e7f70,_0x3eb6c6,_0x4f078a,_0x33c390){if(_0x2e7f70&&_0x3eb6c6){_0x3eb6c6[_0x0546('0x2a')]-=0x1;var _0x22ca6e={'leaveAt':moment()['format'](_0x0546('0x2c')),'acceptAt':moment()[_0x0546('0x14')](_0x0546('0x2c')),'reason':_0x0546('0x3e')};logger[_0x0546('0x38')](util['format'](_0x0546('0x3f'),_0x2e7f70,_0x3eb6c6['name']));emitChannelQueueInteraction(_0x4f078a[_0x0546('0x32')],_0x3eb6c6[_0x0546('0x3a')],_0x4f078a['body'],_0x4f078a[_0x0546('0xe')]['name'],_0x4f078a[_0x0546('0x34')]['id'],![],_0x33c390,_0x3eb6c6['id']);return rpc[_0x4f078a['channel']+_0x0546('0x40')][_0x0546('0x41')](_0x4f078a['interaction']['id'],{'queueId':_0x3eb6c6['id']})[_0x0546('0x42')](function(){if(rpc[_0x4f078a[_0x0546('0x32')]+_0x0546('0x3b')]){return rpc[_0x4f078a[_0x0546('0x32')]+_0x0546('0x3b')][_0x0546('0x41')](_0x2e7f70,_0x22ca6e)[_0x0546('0x3c')](function(_0x4e8e53){logger[_0x0546('0x43')](_0x0546('0x44'),_0x4e8e53);});}});}}function endRouting(_0x174c2a,_0xf1d19,_0x5cc97f,_0x575152){if(_0x174c2a&&_0xf1d19){_0xf1d19['waiting']-=0x1;var _0x1b7ede={'leaveAt':moment()[_0x0546('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x0546('0x14')](_0x0546('0x2c')),'reason':_0x0546('0x45')};logger['info'](util[_0x0546('0x14')](_0x0546('0x46'),_0x174c2a,_0xf1d19[_0x0546('0x3a')]));emitChannelQueueInteraction(_0x5cc97f[_0x0546('0x32')],_0xf1d19['name'],_0x5cc97f[_0x0546('0x2b')],_0x5cc97f[_0x0546('0xe')][_0x0546('0x3a')],_0x5cc97f[_0x0546('0x34')]['id'],![],_0x575152);if(rpc[_0x5cc97f[_0x0546('0x32')]+_0x0546('0x3b')]){return rpc[_0x5cc97f[_0x0546('0x32')]+_0x0546('0x3b')]['update'](_0x174c2a,_0x1b7ede)[_0x0546('0x3c')](function(_0x457084){logger[_0x0546('0x43')](_0x0546('0x44'),_0x457084);});}}}function handleFindQueue(_0x434b1f){return function(_0x3171ec){return _0x3171ec['name'][_0x0546('0x47')]()===_0x434b1f['toLowerCase']();};}exports['consequence']=function(_0xf05ccf,_0x3377ab,_0x51b83d,_0x2840b2){return function(_0x2cef68){try{var _0x2180ac={'name':_0x3377ab[0x0],'timeout':_0x3377ab[0x1]};var _0x53c840=queue[_0x0546('0x0')](_0x2180ac,{'typecast':!![]});if(_0x53c840['length']){logger[_0x0546('0x43')](_0x0546('0x48'),_0xf05ccf,_['map'](_0x53c840,_0x0546('0x34'))[_0x0546('0x49')](',\x20'));_0x2cef68['stop']();}else{var _0x3351b3=_['find'](_0x51b83d[_0x2840b2[_0x0546('0x32')]+_0x0546('0x4a')],handleFindQueue(_0x2180ac[_0x0546('0x3a')]));if(_0x3351b3){startRouting(_0xf05ccf,_0x3351b3,_0x2840b2,_0x51b83d);var _0x91b54e=(_0x3351b3[_0x0546('0x45')]||0xa)*0x3e8;var _0x468dfc=(_0x2180ac[_0x0546('0x45')]||0x14)*0x3e8;var _0x5eca68;if(_0x91b54e>_0x468dfc){_0x468dfc=_0x91b54e;}var _0x4644da=seqqueue[_0x0546('0x4b')](_0x91b54e);_0x4644da['id']=_0xf05ccf;_0x4644da[_0x0546('0x4c')]=_0x91b54e;_0x4644da['qtimeout']=_0x468dfc;_0x4644da[_0x0546('0x32')]=_0x2840b2['channel'];_0x51b83d['rules'][_0xf05ccf]['on'](_0x0546('0x4d'),function(){logger[_0x0546('0x38')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xf05ccf);stopRouting(_0xf05ccf,_0x3351b3,_0x2840b2,_0x51b83d);clearTimeout(_0x5eca68);_0x5eca68=undefined;_0x4644da[_0x0546('0x4e')](!![]);if(_0x51b83d[_0x0546('0x4f')][_0xf05ccf]){delete _0x51b83d[_0x0546('0x4f')][_0xf05ccf];}_0x2cef68[_0x0546('0x50')]();});_0x51b83d[_0x0546('0x4f')][_0xf05ccf]['on'](_0x0546('0x51'),function(){if(_0x51b83d[_0x0546('0x4f')][_0xf05ccf]){delete _0x51b83d[_0x0546('0x4f')][_0xf05ccf];}});_0x5eca68=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0xf05ccf);endRouting(_0xf05ccf,_0x3351b3,_0x2840b2,_0x51b83d);clearTimeout(_0x5eca68);_0x4644da[_0x0546('0x4e')](!![]);_0x2cef68[_0x0546('0x52')]();},_0x468dfc);switch(_0x3351b3['strategy']){case _0x0546('0x53'):strategy[_0x0546('0x53')](_0x4644da,_0x3351b3,_0x51b83d,_0x2840b2);break;default:strategy[_0x0546('0x54')](_0x4644da,_0x3351b3,_0x51b83d,_0x2840b2);}}else{logger[_0x0546('0x43')](_0x0546('0x55'),_0xf05ccf,_0x2180ac[_0x0546('0x3a')]);_0x2cef68[_0x0546('0x50')]();}}}catch(_0x34da68){logger[_0x0546('0x43')](_0x0546('0x48'),_0xf05ccf,_0x34da68[_0x0546('0x56')]);_0x2cef68[_0x0546('0x50')]();}};}; \ No newline at end of file +var _0xb9a0=['next','strategy','rrmemory','beepall','[%s][QUEUE]\x20%s','stack','validate','lodash','util','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','socket.io-emitter','queue_id','from','emit','clone','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','catch','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','error','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','map','join','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','stop','[%s][QUEUE]\x20APPLICATION\x20END','close'];(function(_0x3ef9b6,_0x5de4fe){var _0xc0b00c=function(_0x3a6a5b){while(--_0x3a6a5b){_0x3ef9b6['push'](_0x3ef9b6['shift']());}};_0xc0b00c(++_0x5de4fe);}(_0xb9a0,0x162));var _0x0b9a=function(_0x5630b7,_0x29f61d){_0x5630b7=_0x5630b7-0x0;var _0x30f03e=_0xb9a0[_0x5630b7];return _0x30f03e;};'use strict';var schema=require(_0x0b9a('0x0'));var _=require(_0x0b9a('0x1'));var util=require(_0x0b9a('0x2'));var seqqueue=require('seq-queue');var moment=require(_0x0b9a('0x3'));var Redis=require(_0x0b9a('0x4'));var config=require(_0x0b9a('0x5'));var logger=require(_0x0b9a('0x6'))(_0x0b9a('0x7'));var strategy=require(_0x0b9a('0x8'));config[_0x0b9a('0x9')]=_[_0x0b9a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x0b9a('0xb'))(new Redis(config['redis']));var attributes=['id',_0x0b9a('0xc'),'account','queue',_0x0b9a('0xd'),'joinAt'];function emit(_0x132f5e,_0x294782,_0x537f0d){io['to'](_0x132f5e)[_0x0b9a('0xe')](_0x294782,_0x537f0d);}function emitChannelQueueInteraction(_0x5a04e0,_0x19a06c,_0x16c927,_0x3a9f82,_0x1b8702,_0x22819d,_0x2a6041,_0x3a4135){var _0x451879=_[_0x0b9a('0xf')](_0x16c927);_0x451879[_0x0b9a('0xc')]=_0x3a4135;_0x451879[_0x0b9a('0x10')]=_0x19a06c;_0x451879[_0x0b9a('0x11')]=_0x3a9f82;_0x451879['id']=_0x1b8702;if(_0x22819d){attributes[_0x0b9a('0x12')](_[_0x0b9a('0x13')](_0x5a04e0)+_0x0b9a('0x14'));_0x2a6041[util[_0x0b9a('0x15')](_0x0b9a('0x16'),_0x5a04e0)][_0x1b8702]=_[_0x0b9a('0x17')](_0x451879,attributes);}else{delete _0x2a6041[util[_0x0b9a('0x15')](_0x0b9a('0x16'),_0x5a04e0)][_0x1b8702];}emit(util['format'](_0x0b9a('0x18'),_0x5a04e0,_0x19a06c),util[_0x0b9a('0x15')]('%s_queue_waiting_interaction:%s',_0x5a04e0,_0x22819d?_0x0b9a('0x19'):'remove'),_['pick'](_0x451879,attributes));}var rpc={'openchannelQueueReport':require(_0x0b9a('0x1a')),'mailQueueReport':require(_0x0b9a('0x1b')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0b9a('0x1c')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x0b9a('0x1d')),'chatInteraction':require(_0x0b9a('0x1e')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x0b9a('0x1f')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x0b9a('0x20')),'whatsappInteraction':require(_0x0b9a('0x21'))};var queue=schema({'name':{'type':_0x0b9a('0x22'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x0b9a('0x23'),'message':_0x0b9a('0x24')}});function startRouting(_0x7dd540,_0x11fc46,_0x448ee1,_0x360a02){if(_0x7dd540&&_0x11fc46&&_0x448ee1){_0x11fc46[_0x0b9a('0x25')]+=0x1;var _0x5d6424={'uniqueid':_0x7dd540,'from':_0x448ee1[_0x0b9a('0x26')]?_0x448ee1[_0x0b9a('0x26')]['from']:'','joinAt':moment()[_0x0b9a('0x15')](_0x0b9a('0x27')),'ContactId':_0x448ee1[_0x0b9a('0x28')]?_0x448ee1[_0x0b9a('0x28')]['id']:null,'ListId':_0x448ee1['list']?_0x448ee1[_0x0b9a('0x29')]['id']:null};_0x5d6424[_[_0x0b9a('0x2a')](_0x448ee1[_0x0b9a('0x2b')])+_0x0b9a('0x2c')]=_0x11fc46['id']||null;_0x5d6424[_[_0x0b9a('0x2a')](_0x448ee1[_0x0b9a('0x2b')])+'InteractionId']=_0x448ee1[_0x0b9a('0x2d')]?_0x448ee1['interaction']['id']:null;_0x5d6424[_[_0x0b9a('0x2a')](_0x448ee1[_0x0b9a('0x2b')])+_0x0b9a('0x2e')]=_0x448ee1[_0x0b9a('0x2f')]?_0x448ee1[_0x0b9a('0x2f')]['id']:null;_0x5d6424[_[_0x0b9a('0x2a')](_0x448ee1[_0x0b9a('0x2b')])+(_0x448ee1[_0x0b9a('0x2b')]!==_0x0b9a('0x30')?_0x0b9a('0x31'):_0x0b9a('0x32'))]=_0x448ee1[_0x0b9a('0x11')]?_0x448ee1[_0x0b9a('0x11')]['id']:null;logger[_0x0b9a('0x33')](util['format'](_0x0b9a('0x34'),_0x7dd540,_0x11fc46[_0x0b9a('0x35')]));emitChannelQueueInteraction(_0x448ee1[_0x0b9a('0x2b')],_0x11fc46[_0x0b9a('0x35')],_0x5d6424,_0x448ee1[_0x0b9a('0x11')][_0x0b9a('0x35')],_0x448ee1[_0x0b9a('0x2f')]['id'],!![],_0x360a02,_0x11fc46['id']);if(rpc[_0x448ee1[_0x0b9a('0x2b')]+_0x0b9a('0x36')]){return rpc[_0x448ee1['channel']+_0x0b9a('0x36')]['create'](_0x5d6424)[_0x0b9a('0x37')](function(_0x3e86da){logger['error'](_0x0b9a('0x38'),_0x3e86da);});}}}function stopRouting(_0x3b0383,_0x230856,_0x4cd161,_0x3e70ab){if(_0x3b0383&&_0x230856){_0x230856[_0x0b9a('0x25')]-=0x1;var _0x4145be={'leaveAt':moment()[_0x0b9a('0x15')](_0x0b9a('0x27')),'acceptAt':moment()[_0x0b9a('0x15')](_0x0b9a('0x27')),'reason':_0x0b9a('0x39')};logger[_0x0b9a('0x33')](util['format'](_0x0b9a('0x3a'),_0x3b0383,_0x230856[_0x0b9a('0x35')]));emitChannelQueueInteraction(_0x4cd161['channel'],_0x230856[_0x0b9a('0x35')],_0x4cd161['body'],_0x4cd161[_0x0b9a('0x11')][_0x0b9a('0x35')],_0x4cd161['message']['id'],![],_0x3e70ab,_0x230856['id']);return rpc[_0x4cd161[_0x0b9a('0x2b')]+'Interaction'][_0x0b9a('0x3b')](_0x4cd161[_0x0b9a('0x2d')]['id'],{'queueId':_0x230856['id']})[_0x0b9a('0x3c')](function(){if(rpc[_0x4cd161[_0x0b9a('0x2b')]+_0x0b9a('0x36')]){return rpc[_0x4cd161['channel']+_0x0b9a('0x36')][_0x0b9a('0x3b')](_0x3b0383,_0x4145be)[_0x0b9a('0x37')](function(_0x46c035){logger[_0x0b9a('0x3d')]('update\x20queue\x20report',_0x46c035);});}});}}function endRouting(_0x1e7b12,_0xb70e2a,_0x44e45d,_0x2d78d0){if(_0x1e7b12&&_0xb70e2a){_0xb70e2a[_0x0b9a('0x25')]-=0x1;var _0x41ff4c={'leaveAt':moment()[_0x0b9a('0x15')](_0x0b9a('0x27')),'exitAt':moment()[_0x0b9a('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x0b9a('0x33')](util[_0x0b9a('0x15')](_0x0b9a('0x3e'),_0x1e7b12,_0xb70e2a[_0x0b9a('0x35')]));emitChannelQueueInteraction(_0x44e45d['channel'],_0xb70e2a[_0x0b9a('0x35')],_0x44e45d[_0x0b9a('0x26')],_0x44e45d[_0x0b9a('0x11')][_0x0b9a('0x35')],_0x44e45d[_0x0b9a('0x2f')]['id'],![],_0x2d78d0);if(rpc[_0x44e45d[_0x0b9a('0x2b')]+'QueueReport']){return rpc[_0x44e45d['channel']+_0x0b9a('0x36')][_0x0b9a('0x3b')](_0x1e7b12,_0x41ff4c)['catch'](function(_0x3b5a5b){logger[_0x0b9a('0x3d')](_0x0b9a('0x3f'),_0x3b5a5b);});}}}function handleFindQueue(_0x104eb3){return function(_0x13d90a){return _0x13d90a[_0x0b9a('0x35')][_0x0b9a('0x40')]()===_0x104eb3[_0x0b9a('0x40')]();};}exports[_0x0b9a('0x41')]=function(_0x30c9c7,_0x48eed4,_0x296185,_0x584d9a){return function(_0x31bb01){try{var _0x189489={'name':_0x48eed4[0x0],'timeout':_0x48eed4[0x1]};var _0x3f89e1=queue[_0x0b9a('0x0')](_0x189489,{'typecast':!![]});if(_0x3f89e1[_0x0b9a('0x42')]){logger[_0x0b9a('0x3d')]('[%s][QUEUE]\x20%s',_0x30c9c7,_[_0x0b9a('0x43')](_0x3f89e1,_0x0b9a('0x2f'))[_0x0b9a('0x44')](',\x20'));_0x31bb01['stop']();}else{var _0x18d5ec=_[_0x0b9a('0x45')](_0x296185[_0x584d9a[_0x0b9a('0x2b')]+_0x0b9a('0x46')],handleFindQueue(_0x189489[_0x0b9a('0x35')]));if(_0x18d5ec){startRouting(_0x30c9c7,_0x18d5ec,_0x584d9a,_0x296185);var _0x163680=(_0x18d5ec[_0x0b9a('0x47')]||0xa)*0x3e8;var _0x51efea=(_0x189489[_0x0b9a('0x47')]||0x14)*0x3e8;var _0x420257;if(_0x163680>_0x51efea){_0x51efea=_0x163680;}var _0x4d5659=seqqueue[_0x0b9a('0x48')](_0x163680);_0x4d5659['id']=_0x30c9c7;_0x4d5659[_0x0b9a('0x49')]=_0x163680;_0x4d5659[_0x0b9a('0x4a')]=_0x51efea;_0x4d5659[_0x0b9a('0x2b')]=_0x584d9a[_0x0b9a('0x2b')];_0x296185[_0x0b9a('0x4b')][_0x30c9c7]['on'](_0x0b9a('0x4c'),function(){logger[_0x0b9a('0x33')](_0x0b9a('0x4d'),_0x30c9c7);stopRouting(_0x30c9c7,_0x18d5ec,_0x584d9a,_0x296185);clearTimeout(_0x420257);_0x420257=undefined;_0x4d5659['close'](!![]);if(_0x296185['rules'][_0x30c9c7]){delete _0x296185[_0x0b9a('0x4b')][_0x30c9c7];}_0x31bb01[_0x0b9a('0x4e')]();});_0x296185[_0x0b9a('0x4b')][_0x30c9c7]['on']('complete',function(){if(_0x296185[_0x0b9a('0x4b')][_0x30c9c7]){delete _0x296185['rules'][_0x30c9c7];}});_0x420257=setTimeout(function(){logger[_0x0b9a('0x33')](_0x0b9a('0x4f'),_0x30c9c7);endRouting(_0x30c9c7,_0x18d5ec,_0x584d9a,_0x296185);clearTimeout(_0x420257);_0x4d5659[_0x0b9a('0x50')](!![]);_0x31bb01[_0x0b9a('0x51')]();},_0x51efea);switch(_0x18d5ec[_0x0b9a('0x52')]){case _0x0b9a('0x53'):strategy[_0x0b9a('0x53')](_0x4d5659,_0x18d5ec,_0x296185,_0x584d9a);break;default:strategy[_0x0b9a('0x54')](_0x4d5659,_0x18d5ec,_0x296185,_0x584d9a);}}else{logger[_0x0b9a('0x3d')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x30c9c7,_0x189489[_0x0b9a('0x35')]);_0x31bb01[_0x0b9a('0x4e')]();}}}catch(_0x34ea28){logger['error'](_0x0b9a('0x55'),_0x30c9c7,_0x34ea28[_0x0b9a('0x56')]);_0x31bb01[_0x0b9a('0x4e')]();}};}; \ 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 6be0d1c..5b1f4c6 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 _0x50a6=['uuid','routing','squeue','push','handleRun','handleTimeout','timeout','bind','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','agent','forcedOwnership','isAgentAvailable','realtime','busy','busyQueue','channel','showNotification','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','hideNotification','removeWaitingNotification','STOP','exports','lodash'];(function(_0x42cfad,_0x5014c5){var _0x48b87d=function(_0x58f7e8){while(--_0x58f7e8){_0x42cfad['push'](_0x42cfad['shift']());}};_0x48b87d(++_0x5014c5);}(_0x50a6,0xa4));var _0x650a=function(_0x4eb6dc,_0x3dc261){_0x4eb6dc=_0x4eb6dc-0x0;var _0x3068b4=_0x50a6[_0x4eb6dc];return _0x3068b4;};'use strict';var _=require(_0x650a('0x0'));var uuid=require(_0x650a('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x650a('0x2'));var Agent=function(_0x4abe0c,_0x19ed86,_0x15dd02,_0x2c71ba){this['notificationId']=uuid['v4']();this[_0x650a('0x3')]=_0x4abe0c;this['agent']=_0x19ed86;this['realtime']=_0x15dd02;this[_0x650a('0x2')]=_0x2c71ba;this[_0x650a('0x3')][_0x650a('0x4')](this[_0x650a('0x5')]['bind'](this),this[_0x650a('0x6')]['bind'](this));this[_0x650a('0x3')]['on'](_0x650a('0x7'),this['handleTimeout'][_0x650a('0x8')](this));this[_0x650a('0x3')]['on']('drained',this[_0x650a('0x9')]['bind'](this));};Agent[_0x650a('0xa')]['push']=function(){this[_0x650a('0x3')]['push'](this[_0x650a('0x5')]['bind'](this),this[_0x650a('0x6')][_0x650a('0x8')](this));};Agent[_0x650a('0xa')]['handleDrained']=function(){this[_0x650a('0x6')](!![]);};Agent[_0x650a('0xa')][_0x650a('0x5')]=function(){logger[_0x650a('0xb')](_0x650a('0xc'),this[_0x650a('0x3')]['id'],this['agent']['id']);if(_[_0x650a('0xd')](this['realtime'][_0x650a('0xe')][this[_0x650a('0xf')]['id']])){logger[_0x650a('0xb')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x650a('0x8')](this),0x3e8);}else{if(this[_0x650a('0x2')][_0x650a('0x10')]||util[_0x650a('0x11')](this[_0x650a('0x3')]['id'],this['realtime']['agents'][this[_0x650a('0xf')]['id']],this[_0x650a('0x3')]['channel'],![])){this[_0x650a('0x12')][_0x650a('0xe')][this['agent']['id']][_0x650a('0x13')]=!![];this[_0x650a('0x12')][_0x650a('0xe')][this[_0x650a('0xf')]['id']][_0x650a('0x14')]=undefined;util['saveWaitingNotification'](this[_0x650a('0x12')],this['routing'],this[_0x650a('0xf')],this[_0x650a('0x3')][_0x650a('0x15')]);util[_0x650a('0x16')](this[_0x650a('0x17')],this[_0x650a('0x3')]['id'],this[_0x650a('0x12')][_0x650a('0xe')][this[_0x650a('0xf')]['id']],null,this[_0x650a('0x2')]);util[_0x650a('0x18')](this[_0x650a('0x3')]['id'],this[_0x650a('0x12')][_0x650a('0xe')][this[_0x650a('0xf')]['id']],_0x650a('0x19')+(this[_0x650a('0x2')][_0x650a('0x10')]?':FORCED':''));}else{logger[_0x650a('0xb')](_0x650a('0x1a'),this[_0x650a('0x3')]['id'],this['agent']['id']);setTimeout(this[_0x650a('0x4')][_0x650a('0x8')](this),0x3e8);}}};Agent[_0x650a('0xa')][_0x650a('0x6')]=function(_0x3c5bd4){if(_[_0x650a('0xd')](this['realtime'][_0x650a('0xe')][this[_0x650a('0xf')]['id']])){return logger[_0x650a('0xb')](_0x650a('0x1b'),this[_0x650a('0x3')]['id'],this[_0x650a('0xf')]['id']);}else{logger[_0x650a('0xb')](_0x650a('0x1c'),this['squeue']['id'],this[_0x650a('0xf')]['id']);util[_0x650a('0x1d')](this[_0x650a('0x17')],this['squeue']['id'],this[_0x650a('0x12')][_0x650a('0xe')][this['agent']['id']],null,this[_0x650a('0x2')]);this[_0x650a('0x12')][_0x650a('0xe')][this['agent']['id']]['busy']=![];this['realtime'][_0x650a('0xe')][this[_0x650a('0xf')]['id']][_0x650a('0x14')]=undefined;util[_0x650a('0x1e')](this['realtime'],this[_0x650a('0x2')],this[_0x650a('0xf')],this['squeue'][_0x650a('0x15')]);util[_0x650a('0x18')](this[_0x650a('0x3')]['id'],this[_0x650a('0x12')][_0x650a('0xe')][this['agent']['id']],_0x3c5bd4?_0x650a('0x1f'):'TIMEOUT');}if(!_0x3c5bd4){setTimeout(this[_0x650a('0x4')][_0x650a('0x8')](this),0x3e8);}};function agent(_0x5dbdf9,_0x43b91a,_0xa0e8ec,_0x4a0849){return new Agent(_0x5dbdf9,_0x43b91a,_0xa0e8ec,_0x4a0849);}module[_0x650a('0x20')]=agent; \ No newline at end of file +var _0xe015=['handleTimeout','timeout','drained','prototype','push','handleDrained','debug','agent','isNil','agents','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','notificationId','squeue','realtime','routing','handleRun','bind'];(function(_0x2356e2,_0x2489f8){var _0x16f73e=function(_0x29f7f7){while(--_0x29f7f7){_0x2356e2['push'](_0x2356e2['shift']());}};_0x16f73e(++_0x2489f8);}(_0xe015,0x13b));var _0x5e01=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xe015[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0x5e01('0x0'));var uuid=require(_0x5e01('0x1'));var util=require(_0x5e01('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x46ed0d,_0x4e3569,_0x2136cf,_0x420f00){this[_0x5e01('0x3')]=uuid['v4']();this[_0x5e01('0x4')]=_0x46ed0d;this['agent']=_0x4e3569;this[_0x5e01('0x5')]=_0x2136cf;this[_0x5e01('0x6')]=_0x420f00;this['squeue']['push'](this[_0x5e01('0x7')][_0x5e01('0x8')](this),this[_0x5e01('0x9')][_0x5e01('0x8')](this));this[_0x5e01('0x4')]['on'](_0x5e01('0xa'),this['handleTimeout'][_0x5e01('0x8')](this));this['squeue']['on'](_0x5e01('0xb'),this['handleDrained'][_0x5e01('0x8')](this));};Agent[_0x5e01('0xc')]['push']=function(){this[_0x5e01('0x4')][_0x5e01('0xd')](this['handleRun']['bind'](this),this[_0x5e01('0x9')][_0x5e01('0x8')](this));};Agent[_0x5e01('0xc')][_0x5e01('0xe')]=function(){this[_0x5e01('0x9')](!![]);};Agent[_0x5e01('0xc')]['handleRun']=function(){logger[_0x5e01('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0x5e01('0x10')]['id']);if(_[_0x5e01('0x11')](this['realtime'][_0x5e01('0x12')][this['agent']['id']])){logger[_0x5e01('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5e01('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x5e01('0xd')]['bind'](this),0x3e8);}else{if(this['routing'][_0x5e01('0x13')]||util[_0x5e01('0x14')](this['squeue']['id'],this[_0x5e01('0x5')][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']],this[_0x5e01('0x4')][_0x5e01('0x15')],![])){this[_0x5e01('0x5')][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']]['busy']=!![];this[_0x5e01('0x5')][_0x5e01('0x12')][this['agent']['id']][_0x5e01('0x16')]=undefined;util[_0x5e01('0x17')](this[_0x5e01('0x5')],this[_0x5e01('0x6')],this[_0x5e01('0x10')],this[_0x5e01('0x4')]['channel']);util[_0x5e01('0x18')](this[_0x5e01('0x3')],this[_0x5e01('0x4')]['id'],this[_0x5e01('0x5')]['agents'][this[_0x5e01('0x10')]['id']],null,this[_0x5e01('0x6')]);util[_0x5e01('0x19')](this['squeue']['id'],this[_0x5e01('0x5')][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']],_0x5e01('0x1a')+(this['routing']['forcedOwnership']?_0x5e01('0x1b'):''));}else{logger['debug'](_0x5e01('0x1c'),this[_0x5e01('0x4')]['id'],this[_0x5e01('0x10')]['id']);setTimeout(this[_0x5e01('0xd')]['bind'](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x51a98d){if(_[_0x5e01('0x11')](this['realtime'][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']])){return logger[_0x5e01('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5e01('0x4')]['id'],this[_0x5e01('0x10')]['id']);}else{logger[_0x5e01('0xf')](_0x5e01('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x5e01('0x1e')](this[_0x5e01('0x3')],this[_0x5e01('0x4')]['id'],this[_0x5e01('0x5')][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']],null,this[_0x5e01('0x6')]);this[_0x5e01('0x5')][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']][_0x5e01('0x1f')]=![];this[_0x5e01('0x5')]['agents'][this[_0x5e01('0x10')]['id']][_0x5e01('0x16')]=undefined;util[_0x5e01('0x20')](this['realtime'],this[_0x5e01('0x6')],this[_0x5e01('0x10')],this['squeue'][_0x5e01('0x15')]);util[_0x5e01('0x19')](this[_0x5e01('0x4')]['id'],this['realtime'][_0x5e01('0x12')][this[_0x5e01('0x10')]['id']],_0x51a98d?_0x5e01('0x21'):_0x5e01('0x22'));}if(!_0x51a98d){setTimeout(this[_0x5e01('0xd')][_0x5e01('0x8')](this),0x3e8);}};function agent(_0x1952fb,_0x26f5f7,_0x94d4ee,_0x2b052e){return new Agent(_0x1952fb,_0x26f5f7,_0x94d4ee,_0x2b052e);}module[_0x5e01('0x23')]=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 380a74c..63ab5c7 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 _0x2841=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','TIMEOUT','removeWaitingNotification','channel','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','timeout','handleTimeout','prototype','handleDrained','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','name','saveWaitingNotification','showNotification'];(function(_0x318f54,_0x4c5110){var _0x57092d=function(_0x53b19f){while(--_0x53b19f){_0x318f54['push'](_0x318f54['shift']());}};_0x57092d(++_0x4c5110);}(_0x2841,0x1cd));var _0x1284=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x2841[_0x2d3ab3];return _0x321f9e;};'use strict';var _=require(_0x1284('0x0'));var uuid=require(_0x1284('0x1'));var util=require(_0x1284('0x2'));var logger=require(_0x1284('0x3'))(_0x1284('0x4'));var Beepall=function(_0x333b94,_0x31a87b,_0x350458,_0x34de17){this[_0x1284('0x5')]=uuid['v4']();this[_0x1284('0x6')]=_0x333b94;this[_0x1284('0x7')]=_0x31a87b;this[_0x1284('0x8')]=_0x350458;this[_0x1284('0x4')]=_0x34de17;this[_0x1284('0x6')][_0x1284('0x9')](this[_0x1284('0xa')]['bind'](this),this['handleTimeout'][_0x1284('0xb')](this));this[_0x1284('0x6')]['on'](_0x1284('0xc'),this[_0x1284('0xd')][_0x1284('0xb')](this));this[_0x1284('0x6')]['on']('drained',this['handleDrained'][_0x1284('0xb')](this));};Beepall['prototype'][_0x1284('0x9')]=function(){this[_0x1284('0x6')][_0x1284('0x9')](this[_0x1284('0xa')][_0x1284('0xb')](this),this[_0x1284('0xd')][_0x1284('0xb')](this));};Beepall[_0x1284('0xe')][_0x1284('0xf')]=function(){this[_0x1284('0xd')](!![]);};Beepall['prototype']['handleRun']=function(){var _0x31a81b=!![];if(!_[_0x1284('0x10')](this[_0x1284('0x7')])&&!_[_0x1284('0x10')](this[_0x1284('0x7')][_0x1284('0x11')])&&this[_0x1284('0x7')]['Agents'][_0x1284('0x12')]>0x0){for(var _0x11528e=0x0,_0x52b129;_0x11528e0x0){for(var _0x295377=0x0,_0x4b4908;_0x2953770x0&&_0x3c6d3b[_0x1b2834+_0x4dcc('0x27')]>=_0x3c6d3b[_0x1b2834+'Capacity']){writeLog(_0x44ae9e,_0x3c6d3b,_0x1b2834[_0x4dcc('0x28')]()+_0x4dcc('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x3853ae,_0x2afff8,_0x4fb23c,_0x388cc2,_0x288514){return sendNotification(!![],_0x3853ae,_0x2afff8,_0x4fb23c,_0x388cc2,_0x288514);};exports['hideNotification']=function(_0x488bf3,_0x110911,_0x1aac81,_0x160805,_0x562d1f){return sendNotification(![],_0x488bf3,_0x110911,_0x1aac81,_0x160805,_0x562d1f);};exports[_0x4dcc('0x2a')]=function(_0x5c2464,_0x2ffac7,_0x279524){var _0x45b0d5=_0x2ffac7['interaction'][_0x4dcc('0x2b')];if(!_0x45b0d5&&_0x279524){_0x45b0d5=_0x279524['id'];}var _0x4dd2e6=_['some'](_0x5c2464[_0x2ffac7[_0x4dcc('0x2c')]+'QueuesWaitingInteractions'],function(_0x39ce82){var _0x213c95=_[_0x4dcc('0x2d')](_0x2ffac7[_0x4dcc('0x2c')])+_0x4dcc('0x2e');return _0x39ce82[_0x213c95]===_0x2ffac7[_0x4dcc('0x2f')]['id'];});if(!_0x4dd2e6&&_0x45b0d5&&_0x5c2464[_0x4dcc('0x30')][_0x45b0d5]){_0x4dd2e6=_[_0x4dcc('0x31')](_0x5c2464[_0x4dcc('0x30')][_0x45b0d5][_0x2ffac7[_0x4dcc('0x2c')]+_0x4dcc('0x32')],function(_0x5686a9){return _0x5686a9['id']===_0x2ffac7['interaction']['id'];});}return _0x4dd2e6;};exports[_0x4dcc('0x33')]=function(_0x53e80a,_0x3a88ac,_0x445087,_0x3656fe){if(_0x445087&&_0x445087['id']&&_0x53e80a[_0x4dcc('0x30')]&&_0x53e80a[_0x4dcc('0x30')][_0x445087['id']]){_0x53e80a[_0x4dcc('0x30')][_0x445087['id']][_0x3656fe+_0x4dcc('0x32')][_0x3a88ac[_0x4dcc('0x18')]['id']]={'id':_0x3a88ac['interaction']['id']};}};exports[_0x4dcc('0x34')]=function(_0x5698b8,_0x6722ca,_0x53b522,_0x333fb8){if(_0x53b522&&_0x53b522['id']&&_0x5698b8['agents']&&_0x5698b8[_0x4dcc('0x30')][_0x53b522['id']]){delete _0x5698b8[_0x4dcc('0x30')][_0x53b522['id']][_0x333fb8+_0x4dcc('0x32')][_0x6722ca[_0x4dcc('0x18')]['id']];}};exports[_0x4dcc('0x35')]=writeLog; \ No newline at end of file +var _0x5183=['remove','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','interaction','channel','capitalize','InteractionId','some','WaitingInteractions','saveWaitingNotification','agents','removeWaitingNotification','writeLog','lodash','util','../utils','../../../../../config/logger','routing','redis','defaults','socket.io-emitter','format','name','user:save','\x20interaction','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','message','user:%s','notification:%s','save'];(function(_0x1f02b2,_0x1a19f9){var _0x27354a=function(_0x23869e){while(--_0x23869e){_0x1f02b2['push'](_0x1f02b2['shift']());}};_0x27354a(++_0x1a19f9);}(_0x5183,0x13e));var _0x3518=function(_0x471866,_0x24f38c){_0x471866=_0x471866-0x0;var _0x7bdc1a=_0x5183[_0x471866];return _0x7bdc1a;};'use strict';var _=require(_0x3518('0x0'));var util=require(_0x3518('0x1'));var utils=require(_0x3518('0x2'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0x3518('0x3'))(_0x3518('0x4'));config[_0x3518('0x5')]=_[_0x3518('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3518('0x7'))(new Redis(config[_0x3518('0x5')]));function sendNotification(_0x2c019c,_0x482b2d,_0x5cd139,_0x488c52,_0x147b59,_0x33e66c){io['to'](util[_0x3518('0x8')]('user:%s',_0x488c52[_0x3518('0x9')]))['emit'](_0x3518('0xa'),_0x488c52);var _0x11784b=_0x33e66c||{};var _0x12429b=_0x5cd139['split']('.');var _0x3a60c7={'uniqueid':_0x482b2d,'channel':_0x12429b[0x0],'id':_0x12429b[0x1],'title':_0x12429b[0x0]+_0x3518('0xb'),'interactionId':_0x12429b[0x2],'queue':_0x147b59?_0x147b59['name']:null,'sound':_0x11784b[_0x3518('0xc')][_0x3518('0xd')],'shake':_0x11784b[_0x3518('0xc')][_0x3518('0xe')]};try{if(!_0x11784b['body']){_0x11784b['body']={};}if(_0x147b59){_0x11784b[_0x3518('0xf')][_0x3518('0x10')]=_0x147b59;}else if(_0x11784b[_0x3518('0xf')]['queue']){delete _0x11784b['body'][_0x3518('0x10')];}_0x3a60c7[_0x3518('0x11')]=utils[_0x3518('0x12')](_0x11784b['account'][_0x3518('0x13')],_0x11784b);}catch(_0x4ed175){_0x3a60c7[_0x3518('0x11')]=_0x3518('0x14');logger['error'](util[_0x3518('0x8')]('[%s][QUEUE]\x20%s',_0x482b2d,_0x4ed175[_0x3518('0x15')]));}io['to'](util['format'](_0x3518('0x16'),_0x488c52[_0x3518('0x9')]))['emit'](util[_0x3518('0x8')](_0x3518('0x17'),_0x2c019c?_0x3518('0x18'):_0x3518('0x19')),_0x3a60c7);}function writeLog(_0x1da94c,_0x596902,_0xef3f2e){return logger['debug'](util[_0x3518('0x8')](_0x3518('0x1a'),_0x1da94c,_0x596902[_0x3518('0x9')],_0xef3f2e));}exports['isAgentAvailable']=function(_0xa2dba8,_0x1646aa,_0x2a3b9a,_0x1e25a9){if(_0x1646aa[_0x3518('0x1b')]){writeLog(_0xa2dba8,_0x1646aa,'BUSY');return![];}if(!_0x1646aa[_0x3518('0x1c')]){writeLog(_0xa2dba8,_0x1646aa,_0x3518('0x1d'));return![];}if(_0x1646aa[_0x2a3b9a+_0x3518('0x1e')]){writeLog(_0xa2dba8,_0x1646aa,_0x3518('0x1f'));return![];}if(_0x1e25a9&&_0x1646aa[_0x3518('0x20')](_0x2a3b9a+_0x3518('0x21'))&&_0x1646aa[_0x3518('0x20')](_0x2a3b9a+_0x3518('0x22'))){if(_0x1646aa[_0x2a3b9a+_0x3518('0x21')]>0x0&&_0x1646aa[_0x2a3b9a+_0x3518('0x22')]>=_0x1646aa[_0x2a3b9a+_0x3518('0x21')]){writeLog(_0xa2dba8,_0x1646aa,_0x2a3b9a[_0x3518('0x23')]()+_0x3518('0x24'));return![];}}return!![];};exports[_0x3518('0x25')]=function(_0x319d89,_0x428b25,_0xc3cab2,_0x30ebce,_0x25917c){return sendNotification(!![],_0x319d89,_0x428b25,_0xc3cab2,_0x30ebce,_0x25917c);};exports[_0x3518('0x26')]=function(_0x34a6d6,_0x123230,_0x41e02b,_0x369d58,_0x4cfaa7){return sendNotification(![],_0x34a6d6,_0x123230,_0x41e02b,_0x369d58,_0x4cfaa7);};exports['checkWaitingNotifications']=function(_0x3f8b72,_0x1d1d76,_0x4c16d6){var _0xfb34d7=_0x1d1d76[_0x3518('0x27')]['UserId'];if(!_0xfb34d7&&_0x4c16d6){_0xfb34d7=_0x4c16d6['id'];}var _0x99b607=_['some'](_0x3f8b72[_0x1d1d76[_0x3518('0x28')]+'QueuesWaitingInteractions'],function(_0x6f3e96){var _0x8dc64b=_[_0x3518('0x29')](_0x1d1d76[_0x3518('0x28')])+_0x3518('0x2a');return _0x6f3e96[_0x8dc64b]===_0x1d1d76[_0x3518('0x27')]['id'];});if(!_0x99b607&&_0xfb34d7&&_0x3f8b72['agents'][_0xfb34d7]){_0x99b607=_[_0x3518('0x2b')](_0x3f8b72['agents'][_0xfb34d7][_0x1d1d76[_0x3518('0x28')]+_0x3518('0x2c')],function(_0x313be1){return _0x313be1['id']===_0x1d1d76[_0x3518('0x27')]['id'];});}return _0x99b607;};exports[_0x3518('0x2d')]=function(_0x3c587e,_0x297bcd,_0x1d774f,_0xd557ab){if(_0x1d774f&&_0x1d774f['id']&&_0x3c587e[_0x3518('0x2e')]&&_0x3c587e[_0x3518('0x2e')][_0x1d774f['id']]){_0x3c587e[_0x3518('0x2e')][_0x1d774f['id']][_0xd557ab+_0x3518('0x2c')][_0x297bcd['message']['id']]={'id':_0x297bcd[_0x3518('0x27')]['id']};}};exports[_0x3518('0x2f')]=function(_0x349b54,_0x39fecf,_0x59bbc2,_0x2f0095){if(_0x59bbc2&&_0x59bbc2['id']&&_0x349b54[_0x3518('0x2e')]&&_0x349b54['agents'][_0x59bbc2['id']]){delete _0x349b54[_0x3518('0x2e')][_0x59bbc2['id']][_0x2f0095+_0x3518('0x2c')][_0x39fecf[_0x3518('0x15')]['id']];}};exports[_0x3518('0x30')]=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 a553971..99e2a33 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 _0xbd3a=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','info','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','error','[%s][SYSTEM]\x20%s','isObject','stringify','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','map','join'];(function(_0x355677,_0x29057c){var _0xc583e8=function(_0x4ff513){while(--_0x4ff513){_0x355677['push'](_0x355677['shift']());}};_0xc583e8(++_0x29057c);}(_0xbd3a,0x1e5));var _0xabd3=function(_0x3be7de,_0x16a63d){_0x3be7de=_0x3be7de-0x0;var _0x99d03d=_0xbd3a[_0x3be7de];return _0x99d03d;};'use strict';var schema=require('validate');var sh=require(_0xabd3('0x0'));var _=require(_0xabd3('0x1'));var utils=require(_0xabd3('0x2'));var logger=require('../../../../config/logger')(_0xabd3('0x3'));var system=schema({'command':{'type':_0xabd3('0x4'),'required':!![],'message':_0xabd3('0x5')}});exports[_0xabd3('0x6')]=function(_0x4552b7,_0x2ee490){return function(_0x45f933){try{var _0x2d2001={'command':_0x2ee490[0x0]};var _0xf6590b=system['validate'](_0x2d2001,{'typecast':!![]});if(_0xf6590b['length']){logger['error']('[%s][SYSTEM]\x20%s',_0x4552b7,_[_0xabd3('0x7')](_0xf6590b,'message')[_0xabd3('0x8')](',\x20'));logger['info'](_0xabd3('0x9'),_0x4552b7);_0x45f933[_0xabd3('0xa')]();}else{var _0xd53540=this;var _0x1aa002=utils[_0xabd3('0xb')](_0x2ee490[0x0],this);logger['info'](_0xabd3('0xc'),_0x4552b7,_0x1aa002);sh[_0xabd3('0xd')](_[_0xabd3('0xe')](_0x1aa002),function(_0x418072,_0x5eb74a){logger[_0xabd3('0xf')](_0xabd3('0x10'),_0x4552b7,_0x418072);if(_0x418072==0x0){var _0x3f3498=_0x5eb74a[_0xabd3('0x11')](/(\r\n|\n|\r)/gm,'');if(_[_0xabd3('0x12')](_0x2ee490[0x1])||_[_0xabd3('0x13')](_0x2ee490[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x4552b7);_0xd53540['body'][_0x2ee490[0x1]]=_0x3f3498;}else{logger[_0xabd3('0xf')](_0xabd3('0x14'),_0x4552b7,_0x2ee490[0x1],_0x3f3498);_0xd53540[_0xabd3('0x15')][_0x2ee490[0x1]]=_0x3f3498;}}_0x45f933[_0xabd3('0xa')]();});}}catch(_0x1ad1fb){logger[_0xabd3('0x16')](_0xabd3('0x17'),_0x4552b7,_[_0xabd3('0x18')](_0x1ad1fb)?JSON[_0xabd3('0x19')](_0x1ad1fb):_0x1ad1fb);logger[_0xabd3('0xf')](_0xabd3('0x9'),_0x4552b7);_0x45f933['next']();}};}; \ No newline at end of file +var _0x20e7=['isObject','validate','shelljs','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s'];(function(_0xecf6d8,_0x5b5a1f){var _0x214777=function(_0x589dd2){while(--_0x589dd2){_0xecf6d8['push'](_0xecf6d8['shift']());}};_0x214777(++_0x5b5a1f);}(_0x20e7,0x178));var _0x720e=function(_0x325d47,_0x775a55){_0x325d47=_0x325d47-0x0;var _0x207924=_0x20e7[_0x325d47];return _0x207924;};'use strict';var schema=require(_0x720e('0x0'));var sh=require(_0x720e('0x1'));var _=require('lodash');var utils=require(_0x720e('0x2'));var logger=require(_0x720e('0x3'))('routing');var system=schema({'command':{'type':_0x720e('0x4'),'required':!![],'message':_0x720e('0x5')}});exports[_0x720e('0x6')]=function(_0x1cee97,_0x26731a){return function(_0x4f3ea9){try{var _0x14ff38={'command':_0x26731a[0x0]};var _0x2b2c47=system[_0x720e('0x0')](_0x14ff38,{'typecast':!![]});if(_0x2b2c47[_0x720e('0x7')]){logger[_0x720e('0x8')](_0x720e('0x9'),_0x1cee97,_['map'](_0x2b2c47,_0x720e('0xa'))[_0x720e('0xb')](',\x20'));logger[_0x720e('0xc')](_0x720e('0xd'),_0x1cee97);_0x4f3ea9[_0x720e('0xe')]();}else{var _0x3efaf3=this;var _0xfe59cc=utils[_0x720e('0xf')](_0x26731a[0x0],this);logger[_0x720e('0xc')](_0x720e('0x10'),_0x1cee97,_0xfe59cc);sh[_0x720e('0x11')](_[_0x720e('0x12')](_0xfe59cc),function(_0x33ca4a,_0x185f83){logger[_0x720e('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x1cee97,_0x33ca4a);if(_0x33ca4a==0x0){var _0x8c9be3=_0x185f83[_0x720e('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x26731a[0x1])||_[_0x720e('0x14')](_0x26731a[0x1])){logger['info'](_0x720e('0x15'),_0x1cee97);_0x3efaf3[_0x720e('0x16')][_0x26731a[0x1]]=_0x8c9be3;}else{logger[_0x720e('0xc')](_0x720e('0x17'),_0x1cee97,_0x26731a[0x1],_0x8c9be3);_0x3efaf3[_0x720e('0x16')][_0x26731a[0x1]]=_0x8c9be3;}}_0x4f3ea9[_0x720e('0xe')]();});}}catch(_0x120f72){logger['error']('[%s][SYSTEM]\x20%s',_0x1cee97,_[_0x720e('0x18')](_0x120f72)?JSON['stringify'](_0x120f72):_0x120f72);logger['info'](_0x720e('0xd'),_0x1cee97);_0x4f3ea9['next']();}};}; \ 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 421f49a..0ec90e2 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 _0xe1d3=['consequence','error','[%s][TAG]\x20%s','map','message','join','info','next','channel','Interaction','addTags','then','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'];(function(_0x1ae63f,_0x1db70a){var _0x4fbdb6=function(_0xf3680d){while(--_0xf3680d){_0x1ae63f['push'](_0x1ae63f['shift']());}};_0x4fbdb6(++_0x1db70a);}(_0xe1d3,0x16d));var _0x3e1d=function(_0x149ef7,_0x567ab3){_0x149ef7=_0x149ef7-0x0;var _0x2c849e=_0xe1d3[_0x149ef7];return _0x2c849e;};'use strict';var schema=require(_0x3e1d('0x0'));var _=require(_0x3e1d('0x1'));var rpc={'chatInteraction':require(_0x3e1d('0x2')),'openchannelInteraction':require(_0x3e1d('0x3')),'smsInteraction':require(_0x3e1d('0x4')),'mailInteraction':require(_0x3e1d('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3e1d('0x6'))};var logger=require(_0x3e1d('0x7'))(_0x3e1d('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x3e1d('0x9')}});exports[_0x3e1d('0xa')]=function(_0x5b2b87,_0xae3ba2,_0x2a1296,_0x148404){return function(_0x582c42){try{var _0x54f46e={'tag':_0xae3ba2[0x0]};var _0x381db3=tag[_0x3e1d('0x0')](_0x54f46e,{'typecast':!![]});if(_0x381db3['length']){logger[_0x3e1d('0xb')](_0x3e1d('0xc'),_0x5b2b87,_[_0x3e1d('0xd')](_0x381db3,_0x3e1d('0xe'))[_0x3e1d('0xf')](',\x20'));logger[_0x3e1d('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x5b2b87);_0x582c42[_0x3e1d('0x11')]();}else{var _0x46f332={'ids':[_0xae3ba2[0x0]]};if(rpc[_0x148404[_0x3e1d('0x12')]+_0x3e1d('0x13')]){rpc[_0x148404[_0x3e1d('0x12')]+_0x3e1d('0x13')][_0x3e1d('0x14')](_0x148404['interaction']['id'],_0x46f332)[_0x3e1d('0x15')](function(_0x137fc1){logger[_0x3e1d('0x10')]('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x5b2b87,_0xae3ba2[0x1],_0x148404['channel'],_0x148404['interaction']['id']);})['catch'](function(_0x19a8a6){logger[_0x3e1d('0xb')](_0x3e1d('0xc'),_0x5b2b87,JSON[_0x3e1d('0x16')](_0x19a8a6));logger['info'](_0x3e1d('0x17'),_0x5b2b87);})['finally'](function(){_0x582c42['next']();});}}}catch(_0x487544){logger[_0x3e1d('0xb')]('[%s][TAG]\x20%s',_0x5b2b87,_[_0x3e1d('0x18')](_0x487544)?JSON[_0x3e1d('0x16')](_0x487544):_0x487544);logger['info'](_0x3e1d('0x17'),_0x5b2b87);_0x582c42['next']();}};}; \ No newline at end of file +var _0xce20=['lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../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','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','finally','isObject','validate'];(function(_0x429adb,_0x285e05){var _0x175d9e=function(_0x5ec83c){while(--_0x5ec83c){_0x429adb['push'](_0x429adb['shift']());}};_0x175d9e(++_0x285e05);}(_0xce20,0x10d));var _0x0ce2=function(_0x4f9ff5,_0x2cad87){_0x4f9ff5=_0x4f9ff5-0x0;var _0x13988b=_0xce20[_0x4f9ff5];return _0x13988b;};'use strict';var schema=require(_0x0ce2('0x0'));var _=require(_0x0ce2('0x1'));var rpc={'chatInteraction':require(_0x0ce2('0x2')),'openchannelInteraction':require(_0x0ce2('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x0ce2('0x4')),'faxInteraction':require(_0x0ce2('0x5')),'whatsappInteraction':require(_0x0ce2('0x6'))};var logger=require(_0x0ce2('0x7'))(_0x0ce2('0x8'));var tag=schema({'tag':{'type':_0x0ce2('0x9'),'required':!![],'message':_0x0ce2('0xa')}});exports[_0x0ce2('0xb')]=function(_0xd81d11,_0x59cac4,_0x58fc79,_0x1b276b){return function(_0x481f4a){try{var _0x1f9d39={'tag':_0x59cac4[0x0]};var _0x1207bb=tag['validate'](_0x1f9d39,{'typecast':!![]});if(_0x1207bb[_0x0ce2('0xc')]){logger[_0x0ce2('0xd')](_0x0ce2('0xe'),_0xd81d11,_[_0x0ce2('0xf')](_0x1207bb,_0x0ce2('0x10'))[_0x0ce2('0x11')](',\x20'));logger[_0x0ce2('0x12')](_0x0ce2('0x13'),_0xd81d11);_0x481f4a[_0x0ce2('0x14')]();}else{var _0x3d842c={'ids':[_0x59cac4[0x0]]};if(rpc[_0x1b276b[_0x0ce2('0x15')]+_0x0ce2('0x16')]){rpc[_0x1b276b[_0x0ce2('0x15')]+_0x0ce2('0x16')]['addTags'](_0x1b276b[_0x0ce2('0x17')]['id'],_0x3d842c)[_0x0ce2('0x18')](function(_0x331dd8){logger[_0x0ce2('0x12')](_0x0ce2('0x19'),_0xd81d11,_0x59cac4[0x1],_0x1b276b[_0x0ce2('0x15')],_0x1b276b[_0x0ce2('0x17')]['id']);})[_0x0ce2('0x1a')](function(_0x389ff4){logger['error'](_0x0ce2('0xe'),_0xd81d11,JSON[_0x0ce2('0x1b')](_0x389ff4));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0xd81d11);})[_0x0ce2('0x1c')](function(){_0x481f4a['next']();});}}}catch(_0x476998){logger[_0x0ce2('0xd')]('[%s][TAG]\x20%s',_0xd81d11,_[_0x0ce2('0x1d')](_0x476998)?JSON[_0x0ce2('0x1b')](_0x476998):_0x476998);logger['info'](_0x0ce2('0x13'),_0xd81d11);_0x481f4a[_0x0ce2('0x14')]();}};}; \ 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 3a391b4..b50c2e6 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 _0x1bc0=['replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','login','params','utf8','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','&data=','stringify','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','[%s][TVOX]\x20%s','isObject','info','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence'];(function(_0xd4ceea,_0x1cd8f5){var _0xaf3d76=function(_0x4d86b1){while(--_0x4d86b1){_0xd4ceea['push'](_0xd4ceea['shift']());}};_0xaf3d76(++_0x1cd8f5);}(_0x1bc0,0x1cf));var _0x01bc=function(_0x2a9b9a,_0x4792c8){_0x2a9b9a=_0x2a9b9a-0x0;var _0x753892=_0x1bc0[_0x2a9b9a];return _0x753892;};'use strict';var rp=require(_0x01bc('0x0'));var logger=require(_0x01bc('0x1'))(_0x01bc('0x2'));var _=require(_0x01bc('0x3'));var arr=[];exports[_0x01bc('0x4')]=function(_0x4dfcfb,_0x31cf28){return function(_0x5f18e7){var _0x2a7510=_0x31cf28[0xa];var _0x5e2738=_0x31cf28[0xb];var _0x24dd45=_0x31cf28[0xc];var _0x59cd88=_0x31cf28[0xd];var _0x4aae4a=_0x31cf28[0xe];var _0xc87ccd=_0x31cf28[0xf][_0x01bc('0x5')](/\n/g,_0x01bc('0x6'));var _0x216c83=_0x31cf28[0x10][_0x01bc('0x5')](/\n/g,'\x20');if(!arr[_0x01bc('0x7')](_0x5e2738)){arr[_0x01bc('0x8')](_0x5e2738);var _0x4883f9=_0x31cf28[0x3];var _0x9ef235=_0x31cf28[0x4];var _0x4d5d89=_0x31cf28[0x1];var _0x1eb009=_0x31cf28[0x0];var _0x262dad={};_0x262dad[_0x01bc('0x9')]=_0x31cf28[0x8]+_0x01bc('0xa')+_0x24dd45+'|'+_0x2a7510+'|'+_0x59cd88+'|'+_0x5e2738+'|'+_0x4aae4a;_0x262dad[_0x01bc('0xb')]=_0x31cf28[0x7]+_0x01bc('0xa')+_0x24dd45+'|'+_0x2a7510+'|'+_0x59cd88+'|'+_0x5e2738+'|'+_0x4aae4a+'|'+_0xc87ccd+'|'+_0x216c83;_0x262dad[_0x01bc('0xc')]=_0x31cf28[0x9];var _0xac1856={};_0xac1856['jsonrpc']=_0x01bc('0xd');_0xac1856['method']=_0x01bc('0xe');var _0x5cb771=[];_0x5cb771[_0x01bc('0x8')](_0x31cf28[0x2]);_0x5cb771['push'](_0x31cf28[0x5]);_0x5cb771[_0x01bc('0x8')](_0x31cf28[0x6]);_0xac1856[_0x01bc('0xf')]=_0x5cb771;_0xac1856['id']=0x1;var _0x595e5d=JSON['stringify'](_0xac1856);var _0x1fd2ec={'encoding':_0x01bc('0x10'),'method':'POST','timeout':0x2710,'url':_0x4883f9,'headers':{'Content-Type':_0x01bc('0x11')},'body':_0x595e5d};return rp(_0x1fd2ec)[_0x01bc('0x12')](function(_0x390243){const _0x1bd0aa=JSON[_0x01bc('0x13')](_0x390243);if(!_0x1bd0aa[_0x01bc('0x14')][_0x01bc('0x15')]){throw new Error(_0x01bc('0x16'));}var _0x42ae4d=_0x5e2738;var _0x42356d=_0x01bc('0x17')+_0x4d5d89+_0x01bc('0x18')+_0x1eb009+_0x01bc('0x19')+_0x42ae4d+_0x01bc('0x1a')+JSON[_0x01bc('0x1b')](_0x262dad);var _0x4aa62b=_0x9ef235+'?'+_0x42356d;return rp(_0x4aa62b);})[_0x01bc('0x12')](function(_0x3b1dda){logger['info'](_0x01bc('0x1c'),_0x4dfcfb,_0x3b1dda);_0x5f18e7[_0x01bc('0x1d')]();})[_0x01bc('0x1e')](function(_0x2aeb63){logger['error'](_0x01bc('0x1f'),_0x4dfcfb,_[_0x01bc('0x20')](_0x2aeb63)?JSON[_0x01bc('0x1b')](_0x2aeb63):_0x2aeb63);_0x5f18e7[_0x01bc('0x1d')]();});}else{logger[_0x01bc('0x21')](_0x01bc('0x22'),_0x4dfcfb);_0x5f18e7[_0x01bc('0x23')]();}};}; \ No newline at end of file +var _0x49a9=['routing','lodash','consequence','\x20-\x20','replace','includes','push','urlOnAnswer','urlOnRing','?params=','title','jsonrpc','2.0','params','stringify','POST','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger'];(function(_0x25ebb2,_0x5c7993){var _0x4b893b=function(_0x207037){while(--_0x207037){_0x25ebb2['push'](_0x25ebb2['shift']());}};_0x4b893b(++_0x5c7993);}(_0x49a9,0x1c5));var _0x949a=function(_0x3f575a,_0x45f498){_0x3f575a=_0x3f575a-0x0;var _0x555f5e=_0x49a9[_0x3f575a];return _0x555f5e;};'use strict';var rp=require(_0x949a('0x0'));var logger=require(_0x949a('0x1'))(_0x949a('0x2'));var _=require(_0x949a('0x3'));var arr=[];exports[_0x949a('0x4')]=function(_0x23cdd4,_0x2b5524){return function(_0x102070){var _0x325445=_0x2b5524[0xa];var _0x4664d0=_0x2b5524[0xb];var _0x143099=_0x2b5524[0xc];var _0x19d7c4=_0x2b5524[0xd];var _0x302266=_0x2b5524[0xe];var _0x131f02=_0x2b5524[0xf]['replace'](/\n/g,_0x949a('0x5'));var _0x283b0e=_0x2b5524[0x10][_0x949a('0x6')](/\n/g,'\x20');if(!arr[_0x949a('0x7')](_0x4664d0)){arr[_0x949a('0x8')](_0x4664d0);var _0x2e3d8b=_0x2b5524[0x3];var _0x5ee74a=_0x2b5524[0x4];var _0x2d9302=_0x2b5524[0x1];var _0x5639a0=_0x2b5524[0x0];var _0x112855={};_0x112855[_0x949a('0x9')]=_0x2b5524[0x8]+'?params='+_0x143099+'|'+_0x325445+'|'+_0x19d7c4+'|'+_0x4664d0+'|'+_0x302266;_0x112855[_0x949a('0xa')]=_0x2b5524[0x7]+_0x949a('0xb')+_0x143099+'|'+_0x325445+'|'+_0x19d7c4+'|'+_0x4664d0+'|'+_0x302266+'|'+_0x131f02+'|'+_0x283b0e;_0x112855[_0x949a('0xc')]=_0x2b5524[0x9];var _0x4bd664={};_0x4bd664[_0x949a('0xd')]=_0x949a('0xe');_0x4bd664['method']='login';var _0x386628=[];_0x386628[_0x949a('0x8')](_0x2b5524[0x2]);_0x386628[_0x949a('0x8')](_0x2b5524[0x5]);_0x386628[_0x949a('0x8')](_0x2b5524[0x6]);_0x4bd664[_0x949a('0xf')]=_0x386628;_0x4bd664['id']=0x1;var _0x3bdc85=JSON[_0x949a('0x10')](_0x4bd664);var _0x3a6fd6={'encoding':'utf8','method':_0x949a('0x11'),'timeout':0x2710,'url':_0x2e3d8b,'headers':{'Content-Type':'application/json-rpc'},'body':_0x3bdc85};return rp(_0x3a6fd6)[_0x949a('0x12')](function(_0x4a4a51){const _0x57b221=JSON[_0x949a('0x13')](_0x4a4a51);if(!_0x57b221[_0x949a('0x14')][_0x949a('0x15')]){throw new Error(_0x949a('0x16'));}var _0x45632a=_0x4664d0;var _0x327c32=_0x949a('0x17')+_0x2d9302+_0x949a('0x18')+_0x5639a0+_0x949a('0x19')+_0x45632a+'&data='+JSON[_0x949a('0x10')](_0x112855);var _0x13c3a6=_0x5ee74a+'?'+_0x327c32;return rp(_0x13c3a6);})['then'](function(_0x48b4d2){logger[_0x949a('0x1a')](_0x949a('0x1b'),_0x23cdd4,_0x48b4d2);_0x102070[_0x949a('0x1c')]();})[_0x949a('0x1d')](function(_0x3e968e){logger[_0x949a('0x1e')](_0x949a('0x1f'),_0x23cdd4,_[_0x949a('0x20')](_0x3e968e)?JSON['stringify'](_0x3e968e):_0x3e968e);_0x102070['stop']();});}else{logger[_0x949a('0x1a')](_0x949a('0x21'),_0x23cdd4);_0x102070[_0x949a('0x22')]();}};}; \ 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 99080b3..d2b680f 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x1206eb,_0x2f1c1c){var _0x40b5ed=function(_0x165465){while(--_0x165465){_0x1206eb['push'](_0x1206eb['shift']());}};_0x40b5ed(++_0x2f1c1c);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x282642,_0x356129){var _0x9dd558=function(_0x4a4095){while(--_0x4a4095){_0x282642['push'](_0x282642['shift']());}};_0x9dd558(++_0x356129);}(_0x9c44,0x178));var _0x49c4=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x9c44[_0x279d37];return _0x530173;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 7877bbb..2ef4fee 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 _0xf66b=['agents','busy','end','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','loggedIn','paused','mailQueues','available','waiting','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','%s:%s:%s','condition','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','intervals','Please\x20create\x20a\x20new\x20file\x20under','.js','Applications\x20executed','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent'];(function(_0x214742,_0x51809d){var _0x54a1a4=function(_0x4cf9df){while(--_0x4cf9df){_0x214742['push'](_0x214742['shift']());}};_0x54a1a4(++_0x51809d);}(_0xf66b,0x1cc));var _0xbf66=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xf66b[_0x187ee1];return _0x388160;};'use strict';var _=require(_0xbf66('0x0'));var util=require(_0xbf66('0x1'));var path=require(_0xbf66('0x2'));var fs=require('fs');var jayson=require(_0xbf66('0x3'));var BPromise=require(_0xbf66('0x4'));var utils=require(_0xbf66('0x5'));var sUtils=require(_0xbf66('0x6'));var logger=require(_0xbf66('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xbf66('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xbf66('0x9')),'smsQueueReport':require(_0xbf66('0xa')),'faxQueueReport':require(_0xbf66('0xb')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xbf66('0xc'));function getId(_0x58ecb5,_0x3fe001,_0x12f222){return util[_0xbf66('0xd')](_0xbf66('0xe'),_0x58ecb5,_0x3fe001||0x0,_0x12f222||0x0);}function getIntervals(_0x409d9b,_0x143168){var _0x3c9b50=[];if(!_[_0xbf66('0xf')](_0x143168[_0xbf66('0x10')])&&!_[_0xbf66('0xf')](_0x409d9b[_0x143168['IntervalId']])&&!_[_0xbf66('0xf')](_0x409d9b[_0x143168['IntervalId']][_0xbf66('0x11')])){_0x3c9b50=_[_0xbf66('0x12')](_0x409d9b[_0x143168[_0xbf66('0x10')]]['Intervals'],_0xbf66('0x13'));}else if(!_[_0xbf66('0xf')](_0x143168[_0xbf66('0x13')])){_0x3c9b50=[_0x143168[_0xbf66('0x13')]];}return _0x3c9b50;}exports[_0xbf66('0x14')]=function(_0x15cd1e){_0x15cd1e[_0xbf66('0x15')]={};return new BPromise(function(_0x7fc574,_0x3f7c1a){var _0x155197={'Start':function(_0x2100e9){var _0xc916b4=this;return new Promise(function(_0xa793ba,_0x5e2ae3){if(_0x2100e9){try{var _0x190a42=[];var _0x5e976a=getId(_0x2100e9[_0xbf66('0x16')],_0x2100e9[_0xbf66('0x17')]?_0x2100e9[_0xbf66('0x17')]['id']:0x0,_0x2100e9[_0xbf66('0x18')]?_0x2100e9['interaction']['id']:0x0);var _0x1ee2e9=sUtils[_0xbf66('0x19')](_0x15cd1e,_0x2100e9);if(!_0x1ee2e9&&_0x2100e9[_0xbf66('0x1a')]&&_[_0xbf66('0x1b')](_0x2100e9[_0xbf66('0x1a')])&&_0x2100e9[_0xbf66('0x1a')][_0xbf66('0x1c')]){for(var _0x1775bb=0x0;_0x1775bb<_0x2100e9[_0xbf66('0x1a')][_0xbf66('0x1c')];_0x1775bb+=0x1){var _0x1c7f0e=_0x2100e9[_0xbf66('0x1a')][_0x1775bb];if(fs[_0xbf66('0x1d')](path[_0xbf66('0x1e')](__dirname,'applications',_0x1c7f0e[_0xbf66('0x1f')]+'.js'))){var _0x449927=[];switch(_0x1c7f0e[_0xbf66('0x1f')][_0xbf66('0x20')]()){case _0xbf66('0x21'):var _0x11fc1d=_0x1c7f0e[_0xbf66('0x22')][_0xbf66('0x23')](',');if(_0x2100e9['channel']===_0xbf66('0x24')){_0x449927[_0xbf66('0x25')](_0x11fc1d[0x0]);_0x449927[_0xbf66('0x25')](_0x11fc1d[0x1]);_0x449927['push'](_0x11fc1d[_0xbf66('0x26')](0x2,_0x11fc1d['length'])[_0xbf66('0x1e')](','));}else{_0x449927[_0xbf66('0x25')](_0x11fc1d[0x0]);_0x449927['push'](_0x11fc1d[_0xbf66('0x26')](0x1,_0x11fc1d['length'])[_0xbf66('0x1e')](','));}break;case _0xbf66('0x27'):var _0x375fd5=_0x1c7f0e['appdata'][_0xbf66('0x23')](',');_0x449927['push'](_0x375fd5[0x0]);_0x449927[_0xbf66('0x25')](_0x375fd5[0x1]);_0x449927['push'](_0x375fd5[_0xbf66('0x26')](0x2,_0x375fd5[_0xbf66('0x1c')])['join'](','));break;case _0xbf66('0x28'):var _0x39ab7b=_0x1c7f0e['appdata'][_0xbf66('0x23')](',');_0x449927[_0xbf66('0x25')](_0x39ab7b[0x0]);_0x449927[_0xbf66('0x25')](_0x39ab7b[0x1]);_0x449927[_0xbf66('0x25')](_0x39ab7b[0x2]);_0x449927[_0xbf66('0x25')](_0x39ab7b[0x3]);_0x449927['push'](_0x39ab7b[_0xbf66('0x26')](0x4,_0x39ab7b['length'])[_0xbf66('0x1e')](','));break;case _0xbf66('0x29'):var _0x25563e=_0x1c7f0e[_0xbf66('0x22')][_0xbf66('0x23')](',');_0x449927[_0xbf66('0x25')](_0x25563e[0x0]);_0x449927[_0xbf66('0x25')](_0x25563e[0x1]);_0x449927[_0xbf66('0x25')](_0x25563e[0x2]);_0x449927['push'](_0x25563e[0x3]);_0x449927[_0xbf66('0x25')](_0x25563e[_0xbf66('0x26')](0x4,_0x25563e[_0xbf66('0x1c')])[_0xbf66('0x1e')](','));break;case'message':_0x449927[_0xbf66('0x25')](_0x1c7f0e['appdata']);break;case _0xbf66('0x2a'):_0x449927[_0xbf66('0x25')](_0x1c7f0e[_0xbf66('0x2b')]);_0x449927[_0xbf66('0x25')](_0x1c7f0e[_0xbf66('0x22')]);break;case _0xbf66('0x2c'):var _0x16aec0=utils[_0xbf66('0x2d')](_0x2100e9[_0xbf66('0x2e')][_0xbf66('0x2f')],_0x2100e9);var _0x3c8ced=_0x1c7f0e[_0xbf66('0x22')][_0xbf66('0x23')](',');_0x449927[_0xbf66('0x25')](_0x3c8ced[0x0]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x1]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x2]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x3]);_0x449927['push'](_0x3c8ced[0x4]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x5]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x6]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x7]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x8]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0x9]);_0x449927[_0xbf66('0x25')](_0x3c8ced[0xa]);_0x449927[_0xbf66('0x25')](_0x2100e9[_0xbf66('0x18')]['id']);_0x449927[_0xbf66('0x25')](_0x2100e9[_0xbf66('0x17')]['id']);_0x449927[_0xbf66('0x25')](_0x1c7f0e[_0xbf66('0x30')]);_0x449927['push'](_0x2100e9[_0xbf66('0x18')]['ContactId']);_0x449927[_0xbf66('0x25')](_0x2100e9['body'][_0xbf66('0x31')]);_0x449927['push'](_0x16aec0);break;default:_0x449927=_['isNil'](_0x1c7f0e[_0xbf66('0x22')])?[]:_0x1c7f0e['appdata'][_0xbf66('0x23')](',');}var _0x189192={'id':util[_0xbf66('0xd')](_0xbf66('0x32'),_0x5e976a,_0x1c7f0e['id'],_0x1c7f0e[_0xbf66('0x1f')]),'condition':require('./interval')[_0xbf66('0x33')](_0x5e976a,getIntervals(_0x15cd1e['intervals'],_0x1c7f0e),_0x15cd1e),'consequence':require(_0xbf66('0x34')+_0x1c7f0e['app'])[_0xbf66('0x35')](_0x5e976a,_0x449927,_0x15cd1e,_0x2100e9),'p':_0x1c7f0e[_0xbf66('0x36')]||0x0};logger[_0xbf66('0x37')](_0xbf66('0x38'),_0x189192['id'],_0xbf66('0x39'),getIntervals(_0x15cd1e[_0xbf66('0x3a')],_0x1c7f0e)[_0xbf66('0x1e')]('\x20|\x20'));_0x190a42[_0xbf66('0x25')](_0x189192);}else{logger['error'](_0xbf66('0x3b'),path[_0xbf66('0x1e')](__dirname,_0xbf66('0x1a'),_0x1c7f0e[_0xbf66('0x1f')]+_0xbf66('0x3c')));}}_0x15cd1e['rules'][_0x5e976a]=new RuleEngine(_0x190a42);_0x15cd1e[_0xbf66('0x15')][_0x5e976a]['execute'](_0x2100e9,function(_0x2903a0){logger[_0xbf66('0x37')](_0xbf66('0x3d'),JSON['stringify'](_0x2903a0['matchPath']));if(_0x15cd1e[_0xbf66('0x15')][_0x5e976a]){_0x15cd1e['rules'][_0x5e976a][_0xbf66('0x3e')](_0xbf66('0x3f'));}});return _0xa793ba({'code':0xc8,'message':_0x2100e9});}else{if(_0x1ee2e9){logger[_0xbf66('0x37')](util[_0xbf66('0xd')](_0xbf66('0x40'),_0x5e976a));}else{logger[_0xbf66('0x37')](_0xbf66('0x41'));}return _0xa793ba({'code':0xc8,'message':_0x2100e9});}}catch(_0x35e225){logger[_0xbf66('0x42')](_0x35e225[_0xbf66('0x43')]);return _0x5e2ae3(_0xc916b4[_0xbf66('0x42')](0x1f4,_0x35e225));}}return _0x5e2ae3(_0xbf66('0x44'));});},'AcceptMessage':function(_0x3a6d02){var _0x5d30e6=this;return new Promise(function(_0x1282b9,_0x15114d){if(_0x3a6d02[_0xbf66('0x45')]&&_0x3a6d02['agent']['id']){if(_0x15cd1e[_0xbf66('0x46')][_0x3a6d02[_0xbf66('0x45')]['id']]){_0x15cd1e['agents'][_0x3a6d02[_0xbf66('0x45')]['id']][_0xbf66('0x47')]=![];_0x15cd1e[_0xbf66('0x46')][_0x3a6d02[_0xbf66('0x45')]['id']]['busyQueue']=undefined;}}if(_0x3a6d02[_0xbf66('0x17')]&&_0x3a6d02[_0xbf66('0x17')]['id']){try{var _0x549fd0=getId(_0x3a6d02[_0xbf66('0x16')],_0x3a6d02[_0xbf66('0x17')]?_0x3a6d02[_0xbf66('0x17')]['id']:0x0,_0x3a6d02['interaction']?_0x3a6d02[_0xbf66('0x18')]['id']:0x0);if(_0x15cd1e[_0xbf66('0x15')][_0x549fd0]){_0x15cd1e[_0xbf66('0x15')][_0x549fd0][_0xbf66('0x3e')](_0xbf66('0x48'));if(rpc[_0x3a6d02['channel']+_0xbf66('0x49')]){rpc[_0x3a6d02[_0xbf66('0x16')]+_0xbf66('0x49')]['update'](_0x549fd0,{'UserId':_0x3a6d02['message']['UserId']})[_0xbf66('0x4a')](function(){logger[_0xbf66('0x42')](_0xbf66('0x4b'));});}}return _0x1282b9({'code':0xc8,'message':_0x3a6d02});}catch(_0x1dc5c0){logger[_0xbf66('0x42')](_0x1dc5c0[_0xbf66('0x43')]);return _0x15114d(_0x5d30e6[_0xbf66('0x42')](0x1f4,_0x1dc5c0));}}logger[_0xbf66('0x42')](_0xbf66('0x4c'));return _0x15114d(_0x5d30e6['error'](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x1857cb){var _0x42ca37=this;return new Promise(function(_0x33b9e5,_0x257ea6){if(_0x1857cb['agent']&&_0x1857cb[_0xbf66('0x45')]['id']){try{if(_0x15cd1e['agents'][_0x1857cb[_0xbf66('0x45')]['id']]){_0x15cd1e[_0xbf66('0x46')][_0x1857cb['agent']['id']][_0xbf66('0x47')]=![];_0x15cd1e[_0xbf66('0x46')][_0x1857cb[_0xbf66('0x45')]['id']][_0xbf66('0x4d')]=undefined;}return _0x33b9e5({'code':0xc8,'message':_0x1857cb});}catch(_0x1f057d){logger['error'](_0x1f057d[_0xbf66('0x43')]);return _0x257ea6(_0x42ca37[_0xbf66('0x42')](0x1f4,_0x1f057d));}}logger['error']('message\x20is\x20empty');return _0x257ea6(_0x42ca37[_0xbf66('0x42')](0x1f4,_0xbf66('0x4c')));});},'AbandonInteraction':function(_0x4cd4a9){var _0x60b893=this;return new Promise(function(_0x5b5743,_0x5c60d5){if(_0x4cd4a9[_0xbf66('0x16')]&&_0x4cd4a9[_0xbf66('0x18')]&&_0x4cd4a9[_0xbf66('0x18')]['id']){try{var _0x1e53bd=getId(_0x4cd4a9[_0xbf66('0x16')],_0x4cd4a9['message']?_0x4cd4a9[_0xbf66('0x17')]['id']:0x0,_0x4cd4a9[_0xbf66('0x18')]?_0x4cd4a9[_0xbf66('0x18')]['id']:0x0);if(_0x15cd1e[_0xbf66('0x15')][_0x1e53bd]){_0x15cd1e[_0xbf66('0x15')][_0x1e53bd]['emit'](_0xbf66('0x48'));}return _0x5b5743({'code':0xc8,'message':_0x4cd4a9});}catch(_0x20f0e1){logger[_0xbf66('0x42')](_0x20f0e1['stack']);return _0x5c60d5(_0x60b893[_0xbf66('0x42')](0x1f4,_0x20f0e1));}}logger[_0xbf66('0x42')](_0xbf66('0x4c'));return _0x5c60d5(_0x60b893[_0xbf66('0x42')](0x1f4,_0xbf66('0x4c')));});},'AgentCapacity':function(_0x2d895e){var _0x4b2270=this;return new Promise(function(_0x46a2b7,_0x306a4d){if(_0x15cd1e[_0xbf66('0x46')][_0xbf66('0x4e')](_0x2d895e['id'])){for(var _0x4a1ce7 in _0x2d895e[_0xbf66('0x4f')]){if(_0x2d895e['capacity'][_0xbf66('0x4e')](_0x4a1ce7)){if(_0x15cd1e[_0xbf66('0x46')][_0x2d895e['id']]['hasOwnProperty'](_0x4a1ce7+_0xbf66('0x50'))){_0x15cd1e[_0xbf66('0x46')][_0x2d895e['id']][_0x4a1ce7+_0xbf66('0x50')]=parseInt(_0x2d895e[_0xbf66('0x4f')][_0x4a1ce7],0xa);}}}_0x15cd1e['agents'][_0x2d895e['id']][_0xbf66('0x51')]();return _0x46a2b7({'code':0xc8,'message':_0x15cd1e[_0xbf66('0x46')][_0x2d895e['id']]});}else{return _0x306a4d(_0x4b2270[_0xbf66('0x42')](0x1f4,_0xbf66('0x52')));}});},'Agents':function(_0x105324){return new Promise(function(_0x2feaeb){var _0x37d98c=_['values'](_0x15cd1e['agents']);if(_0x105324&&_0x105324['id']){var _0x50552f=_[_0xbf66('0x53')](_0x37d98c,function(_0x1ba00f){return _0x1ba00f['id']===_0x105324['id'];});_0x2feaeb(_0x50552f);}else{_0x2feaeb({'count':_0x37d98c[_0xbf66('0x1c')],'rows':_0x37d98c});}});},'ChatQueues':function(){return new Promise(function(_0x44f715){var _0x3b3ad3=[];for(var _0x5cd000 in _0x15cd1e['chatQueues']){if(_0x15cd1e[_0xbf66('0x54')]['hasOwnProperty'](_0x5cd000)){var _0x3bf42d=_0x15cd1e[_0xbf66('0x54')][_0x5cd000];var _0x47a332={'id':_0x3bf42d['id'],'available':_0x3bf42d['available'],'loggedIn':_0x3bf42d[_0xbf66('0x55')],'name':_0x3bf42d['name'],'paused':_0x3bf42d[_0xbf66('0x56')],'waiting':_0x3bf42d['waiting']};_0x3b3ad3[_0xbf66('0x25')](_0x47a332);}}_0x44f715({'count':_0x3b3ad3[_0xbf66('0x1c')],'rows':_0x3b3ad3});});},'MailQueues':function(){return new Promise(function(_0x1e0f69){var _0x4bd476=[];for(var _0x34a80e in _0x15cd1e[_0xbf66('0x57')]){if(_0x15cd1e['mailQueues'][_0xbf66('0x4e')](_0x34a80e)){var _0x378dac=_0x15cd1e['mailQueues'][_0x34a80e];var _0x196896={'id':_0x378dac['id'],'available':_0x378dac[_0xbf66('0x58')],'loggedIn':_0x378dac[_0xbf66('0x55')],'name':_0x378dac['name'],'paused':_0x378dac[_0xbf66('0x56')],'waiting':_0x378dac[_0xbf66('0x59')]};_0x4bd476['push'](_0x196896);}}_0x1e0f69({'count':_0x4bd476[_0xbf66('0x1c')],'rows':_0x4bd476});});},'OpenchannelQueues':function(){return new Promise(function(_0x18bc72){var _0x1ddfdb=[];for(var _0x2e5101 in _0x15cd1e[_0xbf66('0x5a')]){if(_0x15cd1e[_0xbf66('0x5a')][_0xbf66('0x4e')](_0x2e5101)){var _0x46fa6f=_0x15cd1e[_0xbf66('0x5a')][_0x2e5101];var _0x21cac0={'id':_0x46fa6f['id'],'available':_0x46fa6f['available'],'loggedIn':_0x46fa6f[_0xbf66('0x55')],'name':_0x46fa6f[_0xbf66('0x5b')],'paused':_0x46fa6f['paused'],'waiting':_0x46fa6f[_0xbf66('0x59')]};_0x1ddfdb[_0xbf66('0x25')](_0x21cac0);}}_0x18bc72({'count':_0x1ddfdb[_0xbf66('0x1c')],'rows':_0x1ddfdb});});},'SmsQueues':function(){return new Promise(function(_0x26bb25){var _0x1e0650=[];for(var _0xa726e1 in _0x15cd1e[_0xbf66('0x5c')]){if(_0x15cd1e[_0xbf66('0x5c')][_0xbf66('0x4e')](_0xa726e1)){var _0x121228=_0x15cd1e[_0xbf66('0x5c')][_0xa726e1];var _0x3e7ba5={'id':_0x121228['id'],'available':_0x121228['available'],'loggedIn':_0x121228[_0xbf66('0x55')],'name':_0x121228['name'],'paused':_0x121228['paused'],'waiting':_0x121228[_0xbf66('0x59')]};_0x1e0650[_0xbf66('0x25')](_0x3e7ba5);}}_0x26bb25({'count':_0x1e0650[_0xbf66('0x1c')],'rows':_0x1e0650});});},'FaxQueues':function(){return new Promise(function(_0x574a41){var _0x23413c=[];for(var _0x414e0a in _0x15cd1e[_0xbf66('0x5d')]){if(_0x15cd1e[_0xbf66('0x5d')][_0xbf66('0x4e')](_0x414e0a)){var _0x724710=_0x15cd1e[_0xbf66('0x5d')][_0x414e0a];var _0x20c1a4={'id':_0x724710['id'],'available':_0x724710['available'],'loggedIn':_0x724710[_0xbf66('0x55')],'name':_0x724710[_0xbf66('0x5b')],'paused':_0x724710[_0xbf66('0x56')],'waiting':_0x724710[_0xbf66('0x59')]};_0x23413c[_0xbf66('0x25')](_0x20c1a4);}}_0x574a41({'count':_0x23413c['length'],'rows':_0x23413c});});},'WhatsappQueues':function(){return new Promise(function(_0x304c42){var _0x28a30a=[];for(var _0x3c301f in _0x15cd1e[_0xbf66('0x5e')]){if(_0x15cd1e['whatsappQueues']['hasOwnProperty'](_0x3c301f)){var _0x91d8dd=_0x15cd1e[_0xbf66('0x5e')][_0x3c301f];var _0x1e3db6={'id':_0x91d8dd['id'],'available':_0x91d8dd[_0xbf66('0x58')],'loggedIn':_0x91d8dd[_0xbf66('0x55')],'name':_0x91d8dd[_0xbf66('0x5b')],'paused':_0x91d8dd['paused'],'waiting':_0x91d8dd[_0xbf66('0x59')]};_0x28a30a[_0xbf66('0x25')](_0x1e3db6);}}_0x304c42({'count':_0x28a30a[_0xbf66('0x1c')],'rows':_0x28a30a});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x12a647){var _0x5b913c=_['values'](_0x15cd1e[_0xbf66('0x5f')]);_0x12a647({'count':_0x5b913c['length'],'rows':_0x5b913c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5bb684){var _0x277592=_[_0xbf66('0x60')](_0x15cd1e[_0xbf66('0x61')]);_0x5bb684({'count':_0x277592[_0xbf66('0x1c')],'rows':_0x277592});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x368d21){var _0x5815aa=_[_0xbf66('0x60')](_0x15cd1e['openchannelQueuesWaitingInteractions']);_0x368d21({'count':_0x5815aa[_0xbf66('0x1c')],'rows':_0x5815aa});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x29e9ac){var _0x507dda=_[_0xbf66('0x60')](_0x15cd1e[_0xbf66('0x62')]);_0x29e9ac({'count':_0x507dda[_0xbf66('0x1c')],'rows':_0x507dda});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x5ac5bc){var _0x962628=_[_0xbf66('0x60')](_0x15cd1e[_0xbf66('0x63')]);_0x5ac5bc({'count':_0x962628['length'],'rows':_0x962628});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5fca78){var _0x24f4c9=_[_0xbf66('0x60')](_0x15cd1e[_0xbf66('0x64')]);_0x5fca78({'count':_0x24f4c9[_0xbf66('0x1c')],'rows':_0x24f4c9});});}};var _0x51c76a=jayson[_0xbf66('0x65')](_0x155197)[_0xbf66('0x66')]();_0x51c76a['on'](_0xbf66('0x42'),function(_0x22ce9d){logger[_0xbf66('0x42')](JSON[_0xbf66('0x67')](_0x22ce9d));return _0x3f7c1a(_0x22ce9d);});_0x51c76a[_0xbf66('0x14')](0x232c,'127.0.0.1',function(){console['log'](_0xbf66('0x68'),0x232c);return _0x7fc574(_0xbf66('0x69')+0x232c);});});}; \ No newline at end of file +var _0x804d=['checkWaitingNotifications','applications','isArray','length','existsSync','join','app','appdata','split','push','slice','dialogflowv2','amazonlex','tag','TagId','account','notificationTemplate','ContactId','body','./interval','condition','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','.js','execute','info','Applications\x20executed','stringify','emit','complete','error','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','loggedIn','paused','waiting','mailQueues','available','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','interval','rules','channel','message','interaction'];(function(_0x1289f9,_0x57b011){var _0x6edf7b=function(_0x172cfa){while(--_0x172cfa){_0x1289f9['push'](_0x1289f9['shift']());}};_0x6edf7b(++_0x57b011);}(_0x804d,0x116));var _0xd804=function(_0x291b77,_0x36b1c2){_0x291b77=_0x291b77-0x0;var _0x138495=_0x804d[_0x291b77];return _0x138495;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var path=require(_0xd804('0x2'));var fs=require('fs');var jayson=require(_0xd804('0x3'));var BPromise=require(_0xd804('0x4'));var utils=require(_0xd804('0x5'));var sUtils=require(_0xd804('0x6'));var logger=require(_0xd804('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xd804('0x8')),'mailQueueReport':require(_0xd804('0x9')),'chatQueueReport':require(_0xd804('0xa')),'smsQueueReport':require(_0xd804('0xb')),'faxQueueReport':require(_0xd804('0xc')),'whatsappQueueReport':require(_0xd804('0xd'))};var RuleEngine=require(_0xd804('0xe'));function getId(_0x391e2b,_0x2c3ae6,_0x2ff6a4){return util[_0xd804('0xf')](_0xd804('0x10'),_0x391e2b,_0x2c3ae6||0x0,_0x2ff6a4||0x0);}function getIntervals(_0x4d12bd,_0x321d86){var _0x2d2434=[];if(!_[_0xd804('0x11')](_0x321d86[_0xd804('0x12')])&&!_['isNil'](_0x4d12bd[_0x321d86['IntervalId']])&&!_[_0xd804('0x11')](_0x4d12bd[_0x321d86[_0xd804('0x12')]]['Intervals'])){_0x2d2434=_[_0xd804('0x13')](_0x4d12bd[_0x321d86[_0xd804('0x12')]]['Intervals'],_0xd804('0x14'));}else if(!_[_0xd804('0x11')](_0x321d86[_0xd804('0x14')])){_0x2d2434=[_0x321d86['interval']];}return _0x2d2434;}exports['listen']=function(_0x31b189){_0x31b189[_0xd804('0x15')]={};return new BPromise(function(_0xcec83,_0x1f8142){var _0x12359a={'Start':function(_0x5ee270){var _0x18c4a0=this;return new Promise(function(_0x30be96,_0x597be3){if(_0x5ee270){try{var _0x13116e=[];var _0x1a10c7=getId(_0x5ee270[_0xd804('0x16')],_0x5ee270['message']?_0x5ee270[_0xd804('0x17')]['id']:0x0,_0x5ee270['interaction']?_0x5ee270[_0xd804('0x18')]['id']:0x0);var _0x2a5170=sUtils[_0xd804('0x19')](_0x31b189,_0x5ee270);if(_0x5ee270['transfer']||!_0x2a5170&&_0x5ee270[_0xd804('0x1a')]&&_[_0xd804('0x1b')](_0x5ee270[_0xd804('0x1a')])&&_0x5ee270[_0xd804('0x1a')][_0xd804('0x1c')]){for(var _0x5d29d1=0x0;_0x5d29d1<_0x5ee270['applications'][_0xd804('0x1c')];_0x5d29d1+=0x1){var _0x5425f0=_0x5ee270[_0xd804('0x1a')][_0x5d29d1];if(fs[_0xd804('0x1d')](path[_0xd804('0x1e')](__dirname,'applications',_0x5425f0[_0xd804('0x1f')]+'.js'))){var _0x18d28c=[];switch(_0x5425f0['app']['toLowerCase']()){case'autoreply':var _0x51b191=_0x5425f0[_0xd804('0x20')][_0xd804('0x21')](',');if(_0x5ee270[_0xd804('0x16')]==='mail'){_0x18d28c[_0xd804('0x22')](_0x51b191[0x0]);_0x18d28c[_0xd804('0x22')](_0x51b191[0x1]);_0x18d28c[_0xd804('0x22')](_0x51b191[_0xd804('0x23')](0x2,_0x51b191['length'])[_0xd804('0x1e')](','));}else{_0x18d28c[_0xd804('0x22')](_0x51b191[0x0]);_0x18d28c['push'](_0x51b191[_0xd804('0x23')](0x1,_0x51b191[_0xd804('0x1c')])['join'](','));}break;case'dialogflow':var _0x4b040a=_0x5425f0[_0xd804('0x20')][_0xd804('0x21')](',');_0x18d28c[_0xd804('0x22')](_0x4b040a[0x0]);_0x18d28c['push'](_0x4b040a[0x1]);_0x18d28c[_0xd804('0x22')](_0x4b040a[_0xd804('0x23')](0x2,_0x4b040a[_0xd804('0x1c')])[_0xd804('0x1e')](','));break;case _0xd804('0x24'):var _0x26ffc8=_0x5425f0[_0xd804('0x20')][_0xd804('0x21')](',');_0x18d28c['push'](_0x26ffc8[0x0]);_0x18d28c[_0xd804('0x22')](_0x26ffc8[0x1]);_0x18d28c[_0xd804('0x22')](_0x26ffc8[0x2]);_0x18d28c[_0xd804('0x22')](_0x26ffc8[0x3]);_0x18d28c[_0xd804('0x22')](_0x26ffc8[_0xd804('0x23')](0x4,_0x26ffc8[_0xd804('0x1c')])[_0xd804('0x1e')](','));break;case _0xd804('0x25'):var _0x26a7f1=_0x5425f0[_0xd804('0x20')]['split'](',');_0x18d28c['push'](_0x26a7f1[0x0]);_0x18d28c[_0xd804('0x22')](_0x26a7f1[0x1]);_0x18d28c[_0xd804('0x22')](_0x26a7f1[0x2]);_0x18d28c['push'](_0x26a7f1[0x3]);_0x18d28c['push'](_0x26a7f1[_0xd804('0x23')](0x4,_0x26a7f1['length'])['join'](','));break;case _0xd804('0x17'):_0x18d28c[_0xd804('0x22')](_0x5425f0[_0xd804('0x20')]);break;case _0xd804('0x26'):_0x18d28c[_0xd804('0x22')](_0x5425f0[_0xd804('0x27')]);_0x18d28c[_0xd804('0x22')](_0x5425f0[_0xd804('0x20')]);break;case'tvox':var _0x329cab=utils['getMustacheRender'](_0x5ee270[_0xd804('0x28')][_0xd804('0x29')],_0x5ee270);var _0x22a785=_0x5425f0[_0xd804('0x20')][_0xd804('0x21')](',');_0x18d28c['push'](_0x22a785[0x0]);_0x18d28c['push'](_0x22a785[0x1]);_0x18d28c['push'](_0x22a785[0x2]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x3]);_0x18d28c['push'](_0x22a785[0x4]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x5]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x6]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x7]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x8]);_0x18d28c[_0xd804('0x22')](_0x22a785[0x9]);_0x18d28c['push'](_0x22a785[0xa]);_0x18d28c['push'](_0x5ee270[_0xd804('0x18')]['id']);_0x18d28c[_0xd804('0x22')](_0x5ee270[_0xd804('0x17')]['id']);_0x18d28c[_0xd804('0x22')](_0x5425f0['ChatWebsiteId']);_0x18d28c['push'](_0x5ee270[_0xd804('0x18')][_0xd804('0x2a')]);_0x18d28c[_0xd804('0x22')](_0x5ee270[_0xd804('0x2b')]['body']);_0x18d28c['push'](_0x329cab);break;default:_0x18d28c=_['isNil'](_0x5425f0[_0xd804('0x20')])?[]:_0x5425f0[_0xd804('0x20')][_0xd804('0x21')](',');}var _0x518beb={'id':util[_0xd804('0xf')]('%s:%s:%s',_0x1a10c7,_0x5425f0['id'],_0x5425f0[_0xd804('0x1f')]),'condition':require(_0xd804('0x2c'))[_0xd804('0x2d')](_0x1a10c7,getIntervals(_0x31b189['intervals'],_0x5425f0),_0x31b189),'consequence':require(_0xd804('0x2e')+_0x5425f0[_0xd804('0x1f')])[_0xd804('0x2f')](_0x1a10c7,_0x18d28c,_0x31b189,_0x5ee270),'p':_0x5425f0[_0xd804('0x30')]||0x0};logger['info'](_0xd804('0x31'),_0x518beb['id'],_0xd804('0x32'),getIntervals(_0x31b189[_0xd804('0x33')],_0x5425f0)[_0xd804('0x1e')](_0xd804('0x34')));_0x13116e[_0xd804('0x22')](_0x518beb);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xd804('0x1e')](__dirname,'applications',_0x5425f0[_0xd804('0x1f')]+_0xd804('0x35')));}}_0x31b189[_0xd804('0x15')][_0x1a10c7]=new RuleEngine(_0x13116e);_0x31b189[_0xd804('0x15')][_0x1a10c7][_0xd804('0x36')](_0x5ee270,function(_0x1f4da7){logger[_0xd804('0x37')](_0xd804('0x38'),JSON[_0xd804('0x39')](_0x1f4da7['matchPath']));if(_0x31b189['rules'][_0x1a10c7]){_0x31b189[_0xd804('0x15')][_0x1a10c7][_0xd804('0x3a')](_0xd804('0x3b'));}});return _0x30be96({'code':0xc8,'message':_0x5ee270});}else{if(_0x2a5170){logger[_0xd804('0x37')](util['format']('Skipped\x20routing\x20for\x20%s',_0x1a10c7));}else{logger[_0xd804('0x37')]('No\x20applications\x20to\x20execute');}return _0x30be96({'code':0xc8,'message':_0x5ee270});}}catch(_0x1ff4cc){logger[_0xd804('0x3c')](_0x1ff4cc[_0xd804('0x3d')]);return _0x597be3(_0x18c4a0[_0xd804('0x3c')](0x1f4,_0x1ff4cc));}}return _0x597be3(_0xd804('0x3e'));});},'AcceptMessage':function(_0x1d334d){var _0x38a454=this;return new Promise(function(_0x2bf040,_0x4cf155){if(_0x1d334d[_0xd804('0x3f')]&&_0x1d334d[_0xd804('0x3f')]['id']){if(_0x31b189['agents'][_0x1d334d[_0xd804('0x3f')]['id']]){_0x31b189[_0xd804('0x40')][_0x1d334d['agent']['id']][_0xd804('0x41')]=![];_0x31b189['agents'][_0x1d334d[_0xd804('0x3f')]['id']][_0xd804('0x42')]=undefined;}}if(_0x1d334d['message']&&_0x1d334d[_0xd804('0x17')]['id']){try{var _0x140b84=getId(_0x1d334d['channel'],_0x1d334d[_0xd804('0x17')]?_0x1d334d[_0xd804('0x17')]['id']:0x0,_0x1d334d[_0xd804('0x18')]?_0x1d334d[_0xd804('0x18')]['id']:0x0);if(_0x31b189[_0xd804('0x15')][_0x140b84]){_0x31b189[_0xd804('0x15')][_0x140b84][_0xd804('0x3a')](_0xd804('0x43'));if(rpc[_0x1d334d[_0xd804('0x16')]+'QueueReport']){rpc[_0x1d334d[_0xd804('0x16')]+'QueueReport'][_0xd804('0x44')](_0x140b84,{'UserId':_0x1d334d[_0xd804('0x17')][_0xd804('0x45')]})[_0xd804('0x46')](function(){logger[_0xd804('0x3c')](_0xd804('0x47'));});}}return _0x2bf040({'code':0xc8,'message':_0x1d334d});}catch(_0x4399fc){logger[_0xd804('0x3c')](_0x4399fc[_0xd804('0x3d')]);return _0x4cf155(_0x38a454['error'](0x1f4,_0x4399fc));}}logger[_0xd804('0x3c')](_0xd804('0x48'));return _0x4cf155(_0x38a454['error'](0x1f4,_0xd804('0x48')));});},'RejectMessage':function(_0x39fb9a){var _0x4584ea=this;return new Promise(function(_0x5139ee,_0x3d1e48){if(_0x39fb9a[_0xd804('0x3f')]&&_0x39fb9a[_0xd804('0x3f')]['id']){try{if(_0x31b189[_0xd804('0x40')][_0x39fb9a['agent']['id']]){_0x31b189['agents'][_0x39fb9a[_0xd804('0x3f')]['id']][_0xd804('0x41')]=![];_0x31b189[_0xd804('0x40')][_0x39fb9a[_0xd804('0x3f')]['id']][_0xd804('0x42')]=undefined;}return _0x5139ee({'code':0xc8,'message':_0x39fb9a});}catch(_0x212b6c){logger[_0xd804('0x3c')](_0x212b6c[_0xd804('0x3d')]);return _0x3d1e48(_0x4584ea[_0xd804('0x3c')](0x1f4,_0x212b6c));}}logger['error'](_0xd804('0x48'));return _0x3d1e48(_0x4584ea['error'](0x1f4,_0xd804('0x48')));});},'AbandonInteraction':function(_0x36514b){var _0x39b3f4=this;return new Promise(function(_0x9203e5,_0x4f710d){if(_0x36514b[_0xd804('0x16')]&&_0x36514b[_0xd804('0x18')]&&_0x36514b[_0xd804('0x18')]['id']){try{var _0x3c3405=getId(_0x36514b[_0xd804('0x16')],_0x36514b['message']?_0x36514b[_0xd804('0x17')]['id']:0x0,_0x36514b[_0xd804('0x18')]?_0x36514b[_0xd804('0x18')]['id']:0x0);if(_0x31b189[_0xd804('0x15')][_0x3c3405]){_0x31b189[_0xd804('0x15')][_0x3c3405][_0xd804('0x3a')](_0xd804('0x43'));}return _0x9203e5({'code':0xc8,'message':_0x36514b});}catch(_0x55eee9){logger['error'](_0x55eee9[_0xd804('0x3d')]);return _0x4f710d(_0x39b3f4[_0xd804('0x3c')](0x1f4,_0x55eee9));}}logger[_0xd804('0x3c')]('message\x20is\x20empty');return _0x4f710d(_0x39b3f4[_0xd804('0x3c')](0x1f4,_0xd804('0x48')));});},'AgentCapacity':function(_0x2ce7c8){var _0x29777c=this;return new Promise(function(_0x34d09f,_0x4786aa){if(_0x31b189[_0xd804('0x40')]['hasOwnProperty'](_0x2ce7c8['id'])){for(var _0xc8dc44 in _0x2ce7c8[_0xd804('0x49')]){if(_0x2ce7c8[_0xd804('0x49')]['hasOwnProperty'](_0xc8dc44)){if(_0x31b189[_0xd804('0x40')][_0x2ce7c8['id']][_0xd804('0x4a')](_0xc8dc44+_0xd804('0x4b'))){_0x31b189[_0xd804('0x40')][_0x2ce7c8['id']][_0xc8dc44+_0xd804('0x4b')]=parseInt(_0x2ce7c8['capacity'][_0xc8dc44],0xa);}}}_0x31b189[_0xd804('0x40')][_0x2ce7c8['id']][_0xd804('0x4c')]();return _0x34d09f({'code':0xc8,'message':_0x31b189[_0xd804('0x40')][_0x2ce7c8['id']]});}else{return _0x4786aa(_0x29777c['error'](0x1f4,_0xd804('0x4d')));}});},'Agents':function(_0x442c61){return new Promise(function(_0x5e004d){var _0x5eefc8=_[_0xd804('0x4e')](_0x31b189[_0xd804('0x40')]);if(_0x442c61&&_0x442c61['id']){var _0xa8b18=_[_0xd804('0x4f')](_0x5eefc8,function(_0xdbb0d5){return _0xdbb0d5['id']===_0x442c61['id'];});_0x5e004d(_0xa8b18);}else{_0x5e004d({'count':_0x5eefc8[_0xd804('0x1c')],'rows':_0x5eefc8});}});},'ChatQueues':function(){return new Promise(function(_0x37aa4d){var _0x1f5e02=[];for(var _0xa6e3d2 in _0x31b189['chatQueues']){if(_0x31b189[_0xd804('0x50')][_0xd804('0x4a')](_0xa6e3d2)){var _0x2d5013=_0x31b189[_0xd804('0x50')][_0xa6e3d2];var _0x31e9eb={'id':_0x2d5013['id'],'available':_0x2d5013['available'],'loggedIn':_0x2d5013[_0xd804('0x51')],'name':_0x2d5013['name'],'paused':_0x2d5013[_0xd804('0x52')],'waiting':_0x2d5013[_0xd804('0x53')]};_0x1f5e02[_0xd804('0x22')](_0x31e9eb);}}_0x37aa4d({'count':_0x1f5e02[_0xd804('0x1c')],'rows':_0x1f5e02});});},'MailQueues':function(){return new Promise(function(_0x57627a){var _0x3a413d=[];for(var _0x27e25d in _0x31b189[_0xd804('0x54')]){if(_0x31b189[_0xd804('0x54')][_0xd804('0x4a')](_0x27e25d)){var _0x821f3f=_0x31b189[_0xd804('0x54')][_0x27e25d];var _0x2fffee={'id':_0x821f3f['id'],'available':_0x821f3f[_0xd804('0x55')],'loggedIn':_0x821f3f[_0xd804('0x51')],'name':_0x821f3f[_0xd804('0x56')],'paused':_0x821f3f[_0xd804('0x52')],'waiting':_0x821f3f[_0xd804('0x53')]};_0x3a413d[_0xd804('0x22')](_0x2fffee);}}_0x57627a({'count':_0x3a413d[_0xd804('0x1c')],'rows':_0x3a413d});});},'OpenchannelQueues':function(){return new Promise(function(_0x3fce66){var _0x439e5e=[];for(var _0xf99bed in _0x31b189[_0xd804('0x57')]){if(_0x31b189[_0xd804('0x57')]['hasOwnProperty'](_0xf99bed)){var _0x5293a3=_0x31b189[_0xd804('0x57')][_0xf99bed];var _0x1c9b7c={'id':_0x5293a3['id'],'available':_0x5293a3[_0xd804('0x55')],'loggedIn':_0x5293a3[_0xd804('0x51')],'name':_0x5293a3[_0xd804('0x56')],'paused':_0x5293a3[_0xd804('0x52')],'waiting':_0x5293a3[_0xd804('0x53')]};_0x439e5e['push'](_0x1c9b7c);}}_0x3fce66({'count':_0x439e5e[_0xd804('0x1c')],'rows':_0x439e5e});});},'SmsQueues':function(){return new Promise(function(_0x1056f3){var _0x4e8e0c=[];for(var _0x192dc8 in _0x31b189['smsQueues']){if(_0x31b189['smsQueues']['hasOwnProperty'](_0x192dc8)){var _0x2a80e2=_0x31b189[_0xd804('0x58')][_0x192dc8];var _0x134973={'id':_0x2a80e2['id'],'available':_0x2a80e2['available'],'loggedIn':_0x2a80e2[_0xd804('0x51')],'name':_0x2a80e2[_0xd804('0x56')],'paused':_0x2a80e2[_0xd804('0x52')],'waiting':_0x2a80e2['waiting']};_0x4e8e0c[_0xd804('0x22')](_0x134973);}}_0x1056f3({'count':_0x4e8e0c['length'],'rows':_0x4e8e0c});});},'FaxQueues':function(){return new Promise(function(_0x412c5b){var _0x1507aa=[];for(var _0x1b641a in _0x31b189[_0xd804('0x59')]){if(_0x31b189[_0xd804('0x59')]['hasOwnProperty'](_0x1b641a)){var _0x5bf18c=_0x31b189[_0xd804('0x59')][_0x1b641a];var _0x561f3f={'id':_0x5bf18c['id'],'available':_0x5bf18c['available'],'loggedIn':_0x5bf18c[_0xd804('0x51')],'name':_0x5bf18c[_0xd804('0x56')],'paused':_0x5bf18c['paused'],'waiting':_0x5bf18c[_0xd804('0x53')]};_0x1507aa[_0xd804('0x22')](_0x561f3f);}}_0x412c5b({'count':_0x1507aa['length'],'rows':_0x1507aa});});},'WhatsappQueues':function(){return new Promise(function(_0xca392b){var _0x45da24=[];for(var _0x3a8e12 in _0x31b189['whatsappQueues']){if(_0x31b189[_0xd804('0x5a')]['hasOwnProperty'](_0x3a8e12)){var _0x502b72=_0x31b189[_0xd804('0x5a')][_0x3a8e12];var _0x357b6e={'id':_0x502b72['id'],'available':_0x502b72[_0xd804('0x55')],'loggedIn':_0x502b72[_0xd804('0x51')],'name':_0x502b72[_0xd804('0x56')],'paused':_0x502b72[_0xd804('0x52')],'waiting':_0x502b72[_0xd804('0x53')]};_0x45da24[_0xd804('0x22')](_0x357b6e);}}_0xca392b({'count':_0x45da24[_0xd804('0x1c')],'rows':_0x45da24});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x15225c){var _0x624aad=_[_0xd804('0x4e')](_0x31b189[_0xd804('0x5b')]);_0x15225c({'count':_0x624aad[_0xd804('0x1c')],'rows':_0x624aad});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xaf528f){var _0x464cf3=_['values'](_0x31b189['mailQueuesWaitingInteractions']);_0xaf528f({'count':_0x464cf3[_0xd804('0x1c')],'rows':_0x464cf3});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x21af3d){var _0x5a4a59=_['values'](_0x31b189[_0xd804('0x5c')]);_0x21af3d({'count':_0x5a4a59[_0xd804('0x1c')],'rows':_0x5a4a59});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4f6794){var _0xf7770e=_[_0xd804('0x4e')](_0x31b189['smsQueuesWaitingInteractions']);_0x4f6794({'count':_0xf7770e['length'],'rows':_0xf7770e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x583b08){var _0x45d779=_['values'](_0x31b189[_0xd804('0x5d')]);_0x583b08({'count':_0x45d779[_0xd804('0x1c')],'rows':_0x45d779});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5d28d6){var _0x105a37=_['values'](_0x31b189[_0xd804('0x5e')]);_0x5d28d6({'count':_0x105a37[_0xd804('0x1c')],'rows':_0x105a37});});}};var _0x1a1a2d=jayson[_0xd804('0x5f')](_0x12359a)[_0xd804('0x60')]();_0x1a1a2d['on'](_0xd804('0x3c'),function(_0xffde80){logger[_0xd804('0x3c')](JSON[_0xd804('0x39')](_0xffde80));return _0x1f8142(_0xffde80);});_0x1a1a2d[_0xd804('0x61')](0x232c,_0xd804('0x62'),function(){console[_0xd804('0x63')](_0xd804('0x64'),0x232c);return _0xcec83('RPC\x20listening\x20on\x20port:'+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index e2603f6..8bf3981 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 _0x441a=['join','\x20|\x20','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','routing','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','info','[%s][INTERVAL\x20VALID]\x20%s\x20%s'];(function(_0x15c04b,_0x154d0a){var _0x2f094d=function(_0x3877e9){while(--_0x3877e9){_0x15c04b['push'](_0x15c04b['shift']());}};_0x2f094d(++_0x154d0a);}(_0x441a,0x7c));var _0xa441=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x441a[_0x5c9307];return _0x373e29;};'use strict';var _=require(_0xa441('0x0'));var iftime=require('../../../utils/iftime')[_0xa441('0x1')];var logger=require('../../../config/logger')(_0xa441('0x2'));exports[_0xa441('0x3')]=function(_0x2bb211,_0xc8e953,_0x4fad7d){return function(_0x573d87){if(_0x4fad7d[_0xa441('0x4')]&&!_0x4fad7d['rules'][_0x2bb211]){logger['info'](_0xa441('0x5'),_0x2bb211);return _0x573d87['stop']();}var _0x55e976=_0xc8e953['map'](function(_0x24a571){return iftime(_0x24a571);});var _0x778f5=_['some'](_0x55e976);if(_0x778f5){logger[_0xa441('0x6')](_0xa441('0x7'),_0x2bb211,_0xc8e953[_0xa441('0x8')](_0xa441('0x9')),_0x778f5);_0x573d87['when'](_0x778f5);}else{logger['info'](_0xa441('0xa'),_0x2bb211,_0xc8e953['join'](_0xa441('0x9')));_0x573d87['stop']();}};}; \ No newline at end of file +var _0x74b9=['when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','lodash','iftime','../../../config/logger','condition','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','[%s][INTERVAL\x20VALID]\x20%s\x20%s','join'];(function(_0x496738,_0x3f1a9f){var _0xee1381=function(_0x4dc50c){while(--_0x4dc50c){_0x496738['push'](_0x496738['shift']());}};_0xee1381(++_0x3f1a9f);}(_0x74b9,0x1e6));var _0x974b=function(_0x2e57fd,_0x54f7a4){_0x2e57fd=_0x2e57fd-0x0;var _0x3b9e67=_0x74b9[_0x2e57fd];return _0x3b9e67;};'use strict';var _=require(_0x974b('0x0'));var iftime=require('../../../utils/iftime')[_0x974b('0x1')];var logger=require(_0x974b('0x2'))('routing');exports[_0x974b('0x3')]=function(_0x5da5a6,_0x40d63b,_0x207231){return function(_0x93749c){if(_0x207231['rules']&&!_0x207231['rules'][_0x5da5a6]){logger[_0x974b('0x4')](_0x974b('0x5'),_0x5da5a6);return _0x93749c[_0x974b('0x6')]();}var _0x1baf4f=_0x40d63b['map'](function(_0x3b3d73){return iftime(_0x3b3d73);});var _0x5bd09c=_['some'](_0x1baf4f);if(_0x5bd09c){logger[_0x974b('0x4')](_0x974b('0x7'),_0x5da5a6,_0x40d63b[_0x974b('0x8')]('\x20|\x20'),_0x5bd09c);_0x93749c[_0x974b('0x9')](_0x5bd09c);}else{logger[_0x974b('0x4')](_0x974b('0xa'),_0x5da5a6,_0x40d63b[_0x974b('0x8')]('\x20|\x20'));_0x93749c[_0x974b('0x6')]();}};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index dd2d150..94dcd7f 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 _0x0972=['clone','calleridname','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','util','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','lastevent','reason','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfertype','transferexten','extension','transferuniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','secondtransfereruniqueid','transfer','origtransfererexten','transfereeuniqueid','agententerreason','secondtransfererlinkedid','ATTENDED','secondtransfererexten','transfertargetuniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0972,0x64));var _0x2097=function(_0x2f33d9,_0xa78b1){_0x2f33d9=_0x2f33d9-0x0;var _0x3765ab=_0x0972[_0x2f33d9];return _0x3765ab;};'use strict';var _=require('lodash');var util=require(_0x2097('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x1c7a40,_0x4ec7aa){utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1c7a40[_0x2097('0x3')],_0x1c7a40[_0x2097('0x4')],_0x1c7a40[_0x2097('0x5')],_0x1c7a40[_0x2097('0x6')],_0x1c7a40[_0x2097('0x7')],_0x1c7a40[_0x2097('0x8')],_0x1c7a40[_0x2097('0x9')],_0x1c7a40['lastevent']));if(_0x1c7a40[_0x2097('0x5')]){utils[_0x2097('0xa')](_0x1c7a40[_0x2097('0x5')])[_0x2097('0xb')](function(_0x3b8fac){if(_0x3b8fac){_0x1c7a40['type']=_0x3b8fac[_0x2097('0xc')];_0x1c7a40[_0x2097('0xd')]=_0x1c7a40[_0x2097('0xe')]?_0x3b8fac[_0x2097('0xf')]:![];_0x1c7a40[_0x2097('0x10')]=_0x1c7a40[_0x2097('0xd')]?_0x3b8fac[_0x2097('0x11')]:0x0;}utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);});}else{utils[_0x2097('0x12')](_0x2097('0x13'),_0x1c7a40);}if(_0x4ec7aa){delete transfers[_0x1c7a40[_0x2097('0x3')]];}else{delete agents[_0x1c7a40[_0x2097('0x14')]];}}exports[_0x2097('0x15')]=function(_0x24ca42){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x24ca42);agents[_0x24ca42[_0x2097('0x14')]]=_0x24ca42;agents[_0x24ca42['destuniqueid']][_0x2097('0x18')]=utils[_0x2097('0x19')]();agents[_0x24ca42['destuniqueid']]['lastevent']='called';agents[_0x24ca42[_0x2097('0x14')]]['connectedlinenum']=null;agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x1a')]=null;utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x1b'),_0x24ca42['uniqueid'],agents[_0x24ca42[_0x2097('0x14')]][_0x2097('0x6')],_0x24ca42[_0x2097('0x14')]));}catch(_0x34654a){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x17'),_0x24ca42[_0x2097('0x3')]),_0x34654a);}};exports['agentringnoanswer']=function(_0x4d957e){try{if(!_[_0x2097('0x1d')](agents[_0x4d957e['destuniqueid']])){utils[_0x2097('0x16')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x4d957e);utils['info'](util[_0x2097('0x2')](_0x2097('0x1e'),_0x4d957e[_0x2097('0x3')],agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x6')],_0x4d957e[_0x2097('0x14')]));agents[_0x4d957e['destuniqueid']][_0x2097('0x1f')]=!![];agents[_0x4d957e['destuniqueid']][_0x2097('0x20')]=utils[_0x2097('0x19')]();agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x21')]='timeout';agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x22')]='timeout';agents[_0x4d957e[_0x2097('0x14')]]['holdtime']=_0x4d957e[_0x2097('0x23')]?parseInt(_0x4d957e['ringtime'])/0x3e8:0x0;agents[_0x4d957e[_0x2097('0x14')]][_0x2097('0x24')]=0x0;unanswered[_0x2097('0x25')](_0x4d957e[_0x2097('0x14')]);}}catch(_0x410afa){utils[_0x2097('0x1c')](util[_0x2097('0x2')]('[%s][agents][agentringnoanswer]',_0x4d957e[_0x2097('0x3')]),_0x410afa);}};exports[_0x2097('0x26')]=function(_0x5cce55){try{_[_0x2097('0x27')](agents,function(_0x41487d,_0x59fb84){if(_0x41487d['uniqueid']==_0x5cce55[_0x2097('0x3')]&&!_[_0x2097('0x28')](unanswered,_0x41487d[_0x2097('0x14')])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x5cce55);utils[_0x2097('0x1')](util['format'](_0x2097('0x2a'),_0x5cce55[_0x2097('0x3')],_0x41487d[_0x2097('0x6')],_0x41487d[_0x2097('0x14')]));_0x41487d[_0x2097('0x1f')]=!![];_0x41487d[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x41487d[_0x2097('0x21')]=_0x2097('0x2b');_0x41487d['reason']=_0x2097('0x2b');_0x41487d[_0x2097('0x2c')]=_0x5cce55[_0x2097('0x2c')];_0x41487d['talktime']=0x0;writeDB(_0x41487d);}});}catch(_0x3d97ee){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x29'),_0x5cce55['uniqueid']),_0x3d97ee);}};exports['agentconnect']=function(_0x5689f6){try{if(agents[_0x5689f6[_0x2097('0x14')]]){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x5689f6);utils[_0x2097('0x1')](util['format'](_0x2097('0x2e'),_0x5689f6[_0x2097('0x3')],agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x6')],_0x5689f6[_0x2097('0x14')]));agents[_0x5689f6[_0x2097('0x14')]]['agentconnectAt']=utils[_0x2097('0x19')]();agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x9')]=_0x5689f6['connectedlinenum'];agents[_0x5689f6['destuniqueid']][_0x2097('0x1a')]=_0x5689f6[_0x2097('0x1a')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x2c')]=_0x5689f6[_0x2097('0x23')];agents[_0x5689f6[_0x2097('0x14')]][_0x2097('0x21')]=_0x2097('0x2f');_[_0x2097('0x27')](agents,function(_0x3bfb5c,_0x337979){if(_0x3bfb5c[_0x2097('0x14')]!=_0x5689f6['destuniqueid']&&_0x3bfb5c[_0x2097('0x3')]==_0x5689f6[_0x2097('0x3')]){_0x3bfb5c[_0x2097('0x24')]=0x0;_0x3bfb5c['holdtime']=_0x5689f6[_0x2097('0x23')];_0x3bfb5c[_0x2097('0x1f')]=!![];_0x3bfb5c[_0x2097('0x20')]=utils[_0x2097('0x19')]();_0x3bfb5c[_0x2097('0x21')]=_0x2097('0x30');_0x3bfb5c[_0x2097('0x22')]=_0x2097('0x30');_0x3bfb5c['answeredelsewheredestinationuniqueid']=_0x5689f6[_0x2097('0x14')];_0x3bfb5c[_0x2097('0x31')]=_0x5689f6[_0x2097('0x6')];writeDB(_0x3bfb5c);}});}}catch(_0x3288ae){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x2d'),_0x5689f6[_0x2097('0x3')]),_0x3288ae);}};exports['agentcomplete']=function(_0x3fc3fe){try{if(!_['isNil'](agents[_0x3fc3fe[_0x2097('0x14')]])){utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x32'),_0x3fc3fe[_0x2097('0x3')]),_0x3fc3fe);utils['info'](util[_0x2097('0x2')](_0x2097('0x33'),_0x3fc3fe[_0x2097('0x3')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x6')],_0x3fc3fe['destuniqueid']));agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0xe')]=!![];agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x34')]=utils[_0x2097('0x19')]();agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x3fc3fe['destuniqueid']][_0x2097('0x34')],agents[_0x3fc3fe[_0x2097('0x14')]][_0x2097('0x36')]);agents[_0x3fc3fe[_0x2097('0x14')]]['reason']=_0x3fc3fe['reason'];agents[_0x3fc3fe['destuniqueid']][_0x2097('0x21')]=_0x2097('0x37');writeDB(agents[_0x3fc3fe['destuniqueid']]);}}catch(_0x10577d){utils[_0x2097('0x1c')](util['format']('[%s][agents][agentcomplete]',_0x3fc3fe[_0x2097('0x3')]),_0x10577d);}};exports[_0x2097('0x38')]=function(_0x1b4de6){try{if(!_['isNil'](agents[_0x1b4de6[_0x2097('0x39')]])){utils[_0x2097('0x16')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x1b4de6);utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x3b'),_0x1b4de6['uniqueid'],agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x6')],agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3')]));agents[_0x1b4de6['transfereruniqueid']]['transfer']=!![];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3c')]='blind';agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3d')]=_0x1b4de6[_0x2097('0x3e')];agents[_0x1b4de6[_0x2097('0x39')]][_0x2097('0x3f')]=agents[_0x1b4de6['transfereruniqueid']][_0x2097('0x3')];}}catch(_0x228b60){utils[_0x2097('0x1c')](util['format'](_0x2097('0x3a'),_0x1b4de6[_0x2097('0x3')]),_0x228b60);}};exports['attendedtransfer']=function(_0x12ba76){try{utils['debug'](util[_0x2097('0x2')]('[%s][agents][attendedtransfer]',_0x12ba76['origtransfereruniqueid']),_0x12ba76);if(_0x12ba76['origtransfereruniqueid']==_0x12ba76[_0x2097('0x40')]){if(!_['isNil'](agents[_0x12ba76['secondtransfereruniqueid']])){utils[_0x2097('0x1')](util['format'](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76['secondtransfereruniqueid']][_0x2097('0x6')]));agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3c')]='ATTENDED';agents[_0x12ba76[_0x2097('0x43')]]['transferexten']=_0x12ba76[_0x2097('0x45')];agents[_0x12ba76[_0x2097('0x43')]][_0x2097('0x3f')]=_0x12ba76['origtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x46')]&&agents[_0x12ba76[_0x2097('0x46')]]){agents[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x46')]]=_['clone'](agents[_0x12ba76['transfereeuniqueid']]);transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x8')]=agents[_0x12ba76['secondtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76['transfereeuniqueid']]['calleridname']=agents[_0x12ba76[_0x2097('0x43')]]['calleridname'];transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x2c')]=0x0;transfers[_0x12ba76[_0x2097('0x46')]][_0x2097('0x47')]=0x2;}}else if(_0x12ba76[_0x2097('0x43')]==_0x12ba76[_0x2097('0x48')]){if(!_['isNil'](agents[_0x12ba76[_0x2097('0x42')]])){utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x41'),_0x12ba76[_0x2097('0x42')],agents[_0x12ba76[_0x2097('0x42')]]['membername']));agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x44')]=!![];agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x3c')]=_0x2097('0x49');agents[_0x12ba76['origtransfereruniqueid']][_0x2097('0x3d')]=_0x12ba76[_0x2097('0x4a')];agents[_0x12ba76['origtransfereruniqueid']]['transferuniqueid']=_0x12ba76['secondtransfereruniqueid'];}if(_0x12ba76[_0x2097('0x4b')]&&agents[_0x12ba76[_0x2097('0x4b')]]){agents[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x47')]=0x1;transfers[_0x12ba76[_0x2097('0x4b')]]=_[_0x2097('0x4c')](agents[_0x12ba76[_0x2097('0x4b')]]);transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x8')]=agents[_0x12ba76['origtransfereruniqueid']]['calleridnum'];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x4d')]=agents[_0x12ba76[_0x2097('0x42')]][_0x2097('0x4d')];transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x18')]=utils['now']();transfers[_0x12ba76[_0x2097('0x4b')]][_0x2097('0x36')]=utils[_0x2097('0x19')]();transfers[_0x12ba76[_0x2097('0x4b')]]['holdtime']=0x0;transfers[_0x12ba76['transfertargetuniqueid']][_0x2097('0x47')]=0x2;}}}catch(_0x345a12){utils['error'](util[_0x2097('0x2')](_0x2097('0x4e'),_0x12ba76[_0x2097('0x42')]),_0x345a12);}};exports[_0x2097('0x4f')]=function(_0x1f824f){try{utils[_0x2097('0x16')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f['uniqueid']),_0x1f824f);if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f[_0x2097('0x3')]]['reason']===_0x2097('0x51')){if(_0x1f824f[_0x2097('0x52')]==='21'){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x53');agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x53');}utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f['uniqueid'],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f[_0x2097('0x3')]]);var _0x2a950f=unanswered[_0x2097('0x55')](_0x1f824f['uniqueid']);if(_0x2a950f>-0x1){unanswered[_0x2097('0x56')](_0x2a950f,0x1);}}if(transfers[_0x1f824f['uniqueid']]){transfers[_0x1f824f[_0x2097('0x3')]]['agentcomplete']=!![];transfers[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();transfers[_0x1f824f['uniqueid']][_0x2097('0x24')]=utils[_0x2097('0x35')](transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x34')],transfers[_0x1f824f[_0x2097('0x3')]]['agentconnectAt']);transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=_0x2097('0x57');transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')](_0x2097('0x54'),_0x1f824f[_0x2097('0x3')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],transfers[_0x1f824f[_0x2097('0x3')]][_0x2097('0x21')]));writeDB(transfers[_0x1f824f['uniqueid']],!![]);}if(agents[_0x1f824f[_0x2097('0x3')]]&&agents[_0x1f824f['uniqueid']]['agentconnectAt']){agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0xe')]=!![];agents[_0x1f824f[_0x2097('0x3')]]['agentcompleteAt']=utils[_0x2097('0x19')]();agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x24')]=utils[_0x2097('0x35')](agents[_0x1f824f['uniqueid']][_0x2097('0x34')],agents[_0x1f824f['uniqueid']][_0x2097('0x36')]);agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')]=agents[_0x1f824f[_0x2097('0x3')]]['transfer']?_0x2097('0x44'):_0x2097('0x57');agents[_0x1f824f[_0x2097('0x3')]]['lastevent']=_0x2097('0x37');utils[_0x2097('0x1')](util[_0x2097('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1f824f[_0x2097('0x3')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x6')],agents[_0x1f824f[_0x2097('0x3')]][_0x2097('0x22')],agents[_0x1f824f[_0x2097('0x3')]]['lastevent']));writeDB(agents[_0x1f824f['uniqueid']]);}}catch(_0xc7481d){utils[_0x2097('0x1c')](util[_0x2097('0x2')](_0x2097('0x50'),_0x1f824f[_0x2097('0x3')]),_0xc7481d);}}; \ No newline at end of file +var _0x4e81=['[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','transfertype','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','transfer','transfertargetuniqueid','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentcomplete','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','destuniqueid','agentcalledAt','now','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','talktime','[%s][agents][agentconnect]','agentconnectAt','connect','answeredelsewheremembername','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete'];(function(_0x455ac8,_0x127d7b){var _0x378798=function(_0xb7cf77){while(--_0xb7cf77){_0x455ac8['push'](_0x455ac8['shift']());}};_0x378798(++_0x127d7b);}(_0x4e81,0x1bc));var _0x14e8=function(_0x2f62aa,_0x108e95){_0x2f62aa=_0x2f62aa-0x0;var _0x1a341f=_0x4e81[_0x2f62aa];return _0x1a341f;};'use strict';var _=require(_0x14e8('0x0'));var util=require(_0x14e8('0x1'));var utils=require(_0x14e8('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x533fb3,_0x4b9800){utils['info'](util[_0x14e8('0x3')](_0x14e8('0x4'),_0x533fb3[_0x14e8('0x5')],_0x533fb3[_0x14e8('0x6')],_0x533fb3[_0x14e8('0x7')],_0x533fb3[_0x14e8('0x8')],_0x533fb3['interface'],_0x533fb3['calleridnum'],_0x533fb3[_0x14e8('0x9')],_0x533fb3[_0x14e8('0xa')]));if(_0x533fb3[_0x14e8('0x7')]){utils[_0x14e8('0xb')](_0x533fb3[_0x14e8('0x7')])[_0x14e8('0xc')](function(_0x39127a){if(_0x39127a){_0x533fb3[_0x14e8('0xd')]=_0x39127a[_0x14e8('0xd')];_0x533fb3['agentacw']=_0x533fb3[_0x14e8('0xe')]?_0x39127a[_0x14e8('0xf')]:![];_0x533fb3[_0x14e8('0x10')]=_0x533fb3[_0x14e8('0x11')]?_0x39127a[_0x14e8('0x12')]:0x0;}utils[_0x14e8('0x13')](_0x14e8('0x14'),_0x533fb3);});}else{utils[_0x14e8('0x13')]('CreateVoiceAgentReport',_0x533fb3);}if(_0x4b9800){delete transfers[_0x533fb3[_0x14e8('0x5')]];}else{delete agents[_0x533fb3['destuniqueid']];}}exports[_0x14e8('0x15')]=function(_0x341d40){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x17'),_0x341d40['uniqueid']),_0x341d40);agents[_0x341d40[_0x14e8('0x18')]]=_0x341d40;agents[_0x341d40['destuniqueid']][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0xa')]='called';agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x9')]=null;agents[_0x341d40[_0x14e8('0x18')]][_0x14e8('0x1b')]=null;utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x1d'),_0x341d40[_0x14e8('0x5')],agents[_0x341d40['destuniqueid']][_0x14e8('0x8')],_0x341d40[_0x14e8('0x18')]));}catch(_0x151f16){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][agentcalled]',_0x341d40[_0x14e8('0x5')]),_0x151f16);}};exports[_0x14e8('0x1f')]=function(_0x2abfec){try{if(!_['isNil'](agents[_0x2abfec[_0x14e8('0x18')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x20'),_0x2abfec[_0x14e8('0x5')]),_0x2abfec);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x2abfec[_0x14e8('0x5')],agents[_0x2abfec['destuniqueid']][_0x14e8('0x8')],_0x2abfec[_0x14e8('0x18')]));agents[_0x2abfec['destuniqueid']]['agentringnoanswer']=!![];agents[_0x2abfec['destuniqueid']][_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x22');agents[_0x2abfec['destuniqueid']][_0x14e8('0x23')]=_0x14e8('0x22');agents[_0x2abfec[_0x14e8('0x18')]][_0x14e8('0x24')]=_0x2abfec[_0x14e8('0x25')]?parseInt(_0x2abfec[_0x14e8('0x25')])/0x3e8:0x0;agents[_0x2abfec[_0x14e8('0x18')]]['talktime']=0x0;unanswered[_0x14e8('0x26')](_0x2abfec[_0x14e8('0x18')]);}}catch(_0x393ab0){utils['error'](util['format']('[%s][agents][agentringnoanswer]',_0x2abfec[_0x14e8('0x5')]),_0x393ab0);}};exports[_0x14e8('0x27')]=function(_0x567385){try{_[_0x14e8('0x28')](agents,function(_0x1d71ca,_0x176e8f){if(_0x1d71ca[_0x14e8('0x5')]==_0x567385['uniqueid']&&!_[_0x14e8('0x29')](unanswered,_0x1d71ca[_0x14e8('0x18')])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')](_0x14e8('0x2a'),_0x567385['uniqueid']),_0x567385);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x2b'),_0x567385[_0x14e8('0x5')],_0x1d71ca['membername'],_0x1d71ca[_0x14e8('0x18')]));_0x1d71ca['agentringnoanswer']=!![];_0x1d71ca[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1d71ca[_0x14e8('0xa')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x23')]=_0x14e8('0x2c');_0x1d71ca[_0x14e8('0x24')]=_0x567385[_0x14e8('0x24')];_0x1d71ca[_0x14e8('0x2d')]=0x0;writeDB(_0x1d71ca);}});}catch(_0x2acf6a){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')]('[%s][agents][queuecallerabandon]',_0x567385['uniqueid']),_0x2acf6a);}};exports['agentconnect']=function(_0x16ff09){try{if(agents[_0x16ff09['destuniqueid']]){utils[_0x14e8('0x16')](util['format'](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x16ff09);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x16ff09[_0x14e8('0x5')],agents[_0x16ff09['destuniqueid']][_0x14e8('0x8')],_0x16ff09[_0x14e8('0x18')]));agents[_0x16ff09[_0x14e8('0x18')]][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();agents[_0x16ff09[_0x14e8('0x18')]]['connectedlinenum']=_0x16ff09[_0x14e8('0x9')];agents[_0x16ff09['destuniqueid']][_0x14e8('0x1b')]=_0x16ff09[_0x14e8('0x1b')];agents[_0x16ff09[_0x14e8('0x18')]]['holdtime']=_0x16ff09[_0x14e8('0x25')];agents[_0x16ff09[_0x14e8('0x18')]]['lastevent']=_0x14e8('0x30');_[_0x14e8('0x28')](agents,function(_0x1f429a,_0x3a7aa7){if(_0x1f429a[_0x14e8('0x18')]!=_0x16ff09[_0x14e8('0x18')]&&_0x1f429a[_0x14e8('0x5')]==_0x16ff09[_0x14e8('0x5')]){_0x1f429a[_0x14e8('0x2d')]=0x0;_0x1f429a[_0x14e8('0x24')]=_0x16ff09[_0x14e8('0x25')];_0x1f429a[_0x14e8('0x1f')]=!![];_0x1f429a[_0x14e8('0x21')]=utils[_0x14e8('0x1a')]();_0x1f429a[_0x14e8('0xa')]='answered_elsewhere';_0x1f429a[_0x14e8('0x23')]='answered_elsewhere';_0x1f429a['answeredelsewheredestinationuniqueid']=_0x16ff09['destuniqueid'];_0x1f429a[_0x14e8('0x31')]=_0x16ff09['membername'];writeDB(_0x1f429a);}});}}catch(_0x46a3c4){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x2e'),_0x16ff09[_0x14e8('0x5')]),_0x46a3c4);}};exports[_0x14e8('0xe')]=function(_0x125af5){try{if(!_[_0x14e8('0x32')](agents[_0x125af5[_0x14e8('0x18')]])){utils[_0x14e8('0x16')](util[_0x14e8('0x3')]('[%s][agents][agentcomplete]',_0x125af5[_0x14e8('0x5')]),_0x125af5);utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x33'),_0x125af5['uniqueid'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x8')],_0x125af5['destuniqueid']));agents[_0x125af5['destuniqueid']][_0x14e8('0xe')]=!![];agents[_0x125af5['destuniqueid']]['agentcompleteAt']=utils[_0x14e8('0x1a')]();agents[_0x125af5[_0x14e8('0x18')]]['talktime']=utils[_0x14e8('0x34')](agents[_0x125af5[_0x14e8('0x18')]]['agentcompleteAt'],agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x2f')]);agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0x23')]=_0x125af5[_0x14e8('0x23')];agents[_0x125af5[_0x14e8('0x18')]][_0x14e8('0xa')]=_0x14e8('0x35');writeDB(agents[_0x125af5[_0x14e8('0x18')]]);}}catch(_0x42180d){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x36'),_0x125af5[_0x14e8('0x5')]),_0x42180d);}};exports[_0x14e8('0x37')]=function(_0x1f50bc){try{if(!_['isNil'](agents[_0x1f50bc[_0x14e8('0x38')]])){utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x1f50bc);utils[_0x14e8('0x1c')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x1f50bc['uniqueid'],agents[_0x1f50bc[_0x14e8('0x38')]]['membername'],agents[_0x1f50bc['transfereruniqueid']][_0x14e8('0x5')]));agents[_0x1f50bc[_0x14e8('0x38')]]['transfer']=!![];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3a')]=_0x14e8('0x3b');agents[_0x1f50bc[_0x14e8('0x38')]]['transferexten']=_0x1f50bc['extension'];agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x3c')]=agents[_0x1f50bc[_0x14e8('0x38')]][_0x14e8('0x5')];}}catch(_0x41b5ab){utils[_0x14e8('0x1e')](util['format'](_0x14e8('0x39'),_0x1f50bc[_0x14e8('0x5')]),_0x41b5ab);}};exports[_0x14e8('0x3d')]=function(_0xd5adc1){try{utils['debug'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0xd5adc1);if(_0xd5adc1[_0x14e8('0x3f')]==_0xd5adc1['origtransfererlinkedid']){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x40')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x41'),_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x8')]));agents[_0xd5adc1['secondtransfereruniqueid']]['transfer']=!![];agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x43')]=_0xd5adc1['origtransfererexten'];agents[_0xd5adc1['secondtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x3f')];}if(_0xd5adc1[_0x14e8('0x44')]&&agents[_0xd5adc1[_0x14e8('0x44')]]){agents[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x44')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfereeuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x47')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x48')]=agents[_0xd5adc1[_0x14e8('0x40')]][_0x14e8('0x48')];transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1['transfereeuniqueid']][_0x14e8('0x2f')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x44')]][_0x14e8('0x45')]=0x2;}}else if(_0xd5adc1[_0x14e8('0x40')]==_0xd5adc1[_0x14e8('0x49')]){if(!_[_0x14e8('0x32')](agents[_0xd5adc1[_0x14e8('0x3f')]])){utils[_0x14e8('0x1c')](util[_0x14e8('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0xd5adc1[_0x14e8('0x3f')],agents[_0xd5adc1[_0x14e8('0x3f')]]['membername']));agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x4a')]=!![];agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x3a')]=_0x14e8('0x42');agents[_0xd5adc1[_0x14e8('0x3f')]][_0x14e8('0x43')]=_0xd5adc1['secondtransfererexten'];agents[_0xd5adc1['origtransfereruniqueid']]['transferuniqueid']=_0xd5adc1[_0x14e8('0x40')];}if(_0xd5adc1[_0x14e8('0x4b')]&&agents[_0xd5adc1[_0x14e8('0x4b')]]){agents[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x1;transfers[_0xd5adc1[_0x14e8('0x4b')]]=_[_0x14e8('0x46')](agents[_0xd5adc1['transfertargetuniqueid']]);transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x47')]=agents[_0xd5adc1['origtransfereruniqueid']][_0x14e8('0x47')];transfers[_0xd5adc1[_0x14e8('0x4b')]]['calleridname']=agents[_0xd5adc1['origtransfereruniqueid']]['calleridname'];transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x19')]=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]]['agentconnectAt']=utils[_0x14e8('0x1a')]();transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x24')]=0x0;transfers[_0xd5adc1[_0x14e8('0x4b')]][_0x14e8('0x45')]=0x2;}}}catch(_0x36d0e5){utils['error'](util[_0x14e8('0x3')](_0x14e8('0x3e'),_0xd5adc1[_0x14e8('0x3f')]),_0x36d0e5);}};exports['hangup']=function(_0x5add74){try{utils[_0x14e8('0x16')](util['format'](_0x14e8('0x4c'),_0x5add74['uniqueid']),_0x5add74);if(agents[_0x5add74[_0x14e8('0x5')]]&&agents[_0x5add74['uniqueid']][_0x14e8('0x23')]===_0x14e8('0x22')){if(_0x5add74['cause']==='21'){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x4d');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x4d');}utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']]['lastevent']));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);var _0x52f0a7=unanswered[_0x14e8('0x4f')](_0x5add74['uniqueid']);if(_0x52f0a7>-0x1){unanswered[_0x14e8('0x50')](_0x52f0a7,0x1);}}if(transfers[_0x5add74['uniqueid']]){transfers[_0x5add74['uniqueid']]['agentcomplete']=!![];transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();transfers[_0x5add74['uniqueid']][_0x14e8('0x2d')]=utils['diffTime'](transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x51')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]);transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')]=_0x14e8('0x52');transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]='complete';utils[_0x14e8('0x1c')](util['format'](_0x14e8('0x4e'),_0x5add74[_0x14e8('0x5')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x23')],transfers[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]));writeDB(transfers[_0x5add74[_0x14e8('0x5')]],!![]);}if(agents[_0x5add74['uniqueid']]&&agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2f')]){agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xe')]=!![];agents[_0x5add74['uniqueid']][_0x14e8('0x51')]=utils[_0x14e8('0x1a')]();agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x2d')]=utils['diffTime'](agents[_0x5add74[_0x14e8('0x5')]]['agentcompleteAt'],agents[_0x5add74[_0x14e8('0x5')]]['agentconnectAt']);agents[_0x5add74['uniqueid']][_0x14e8('0x23')]=agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x4a')]?_0x14e8('0x4a'):_0x14e8('0x52');agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0xa')]=_0x14e8('0x35');utils[_0x14e8('0x1c')](util[_0x14e8('0x3')](_0x14e8('0x4e'),_0x5add74['uniqueid'],agents[_0x5add74[_0x14e8('0x5')]][_0x14e8('0x8')],agents[_0x5add74[_0x14e8('0x5')]]['reason'],agents[_0x5add74['uniqueid']][_0x14e8('0xa')]));writeDB(agents[_0x5add74[_0x14e8('0x5')]]);}}catch(_0xc3ebbc){utils[_0x14e8('0x1e')](util[_0x14e8('0x3')](_0x14e8('0x4c'),_0x5add74[_0x14e8('0x5')]),_0xc3ebbc);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 51f2587..1c64119 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 _0x9708=['context','exten','now','DOCUMENTATION','newstate','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','error','[%s][calls][newstate]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','[%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','queue','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','newexten','application','appdata','set','startsWith','toLowerCase','cdr','split','substring','includes','hangup','noop','execif','gotoif','[%s][calls][newexten]','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','then','UserId','CreateVoiceCallReport','request','debug','format','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s'];(function(_0x36b7dd,_0x3ed6e0){var _0x24d6da=function(_0x190a95){while(--_0x190a95){_0x36b7dd['push'](_0x36b7dd['shift']());}};_0x24d6da(++_0x3ed6e0);}(_0x9708,0x183));var _0x8970=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0x9708[_0x5302fb];return _0x43e6a4;};'use strict';var _=require(_0x8970('0x0'));var util=require(_0x8970('0x1'));var utils=require('./utils');var dispositions=[_0x8970('0x2'),_0x8970('0x3'),_0x8970('0x3'),_0x8970('0x2'),_0x8970('0x2'),_0x8970('0x2'),_0x8970('0x4'),'BUSY',_0x8970('0x3'),_0x8970('0x3'),_0x8970('0x3')];var channels={};function writeDB(_0x461e6){utils[_0x8970('0x5')](util['format'](_0x8970('0x6'),_0x461e6[_0x8970('0x7')],_0x461e6[_0x8970('0x8')],_0x461e6['queue'],_0x461e6[_0x8970('0x9')],_0x461e6[_0x8970('0xa')],_0x461e6[_0x8970('0xb')],_0x461e6[_0x8970('0xc')],_0x461e6[_0x8970('0xd')]));if(_0x461e6[_0x8970('0xe')]){utils['getUserByInternal'](_0x461e6[_0x8970('0xe')])[_0x8970('0xf')](function(_0x501cea){if(_0x501cea){_0x461e6[_0x8970('0x10')]=_0x501cea['id'];}utils['request'](_0x8970('0x11'),_0x461e6);});}else{utils[_0x8970('0x12')](_0x8970('0x11'),_0x461e6);}if(channels[_0x461e6['uniqueid']]){delete channels[_0x461e6['uniqueid']];}}exports['newchannel']=function(_0x59d915){try{utils[_0x8970('0x13')](util[_0x8970('0x14')](_0x8970('0x15'),_0x59d915[_0x8970('0x7')]),_0x59d915);if(_0x59d915[_0x8970('0x7')]==_0x59d915[_0x8970('0x16')]&&_0x59d915['channel']!=_0x8970('0x17')){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x18'),_0x59d915[_0x8970('0x7')],_0x59d915[_0x8970('0x19')],_0x59d915['exten']));channels[_0x59d915[_0x8970('0x7')]]={'uniqueid':_0x59d915[_0x8970('0x7')],'accountcode':_0x59d915[_0x8970('0xe')],'source':_0x59d915[_0x8970('0xb')],'destination':_0x59d915[_0x8970('0x1a')],'destinationcontext':_0x59d915[_0x8970('0x19')],'channel':_0x59d915[_0x8970('0x8')],'starttime':utils[_0x8970('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x8970('0x1c')};}}catch(_0x4544d8){utils['error'](util[_0x8970('0x14')]('[%s][calls][newchannel]',_0x59d915['uniqueid']),_0x4544d8);}};exports[_0x8970('0x1d')]=function(_0xcdde1d){try{utils['debug'](util['format']('[%s][calls][newstate]',_0xcdde1d[_0x8970('0x7')]),_0xcdde1d);if(!_['isNil'](channels[_0xcdde1d[_0x8970('0x7')]])&&_0xcdde1d[_0x8970('0x1e')]==0x6){utils['info'](util['format']('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xcdde1d['uniqueid'],_0xcdde1d[_0x8970('0x19')],_0xcdde1d[_0x8970('0x8')]));if(_[_0x8970('0x1f')](channels[_0xcdde1d[_0x8970('0x7')]]['systemanswertime'])){channels[_0xcdde1d[_0x8970('0x7')]][_0x8970('0x20')]=utils['now']();}}else if(!_[_0x8970('0x1f')](channels[_0xcdde1d[_0x8970('0x16')]])&&_0xcdde1d['channelstate']==0x6&&_0xcdde1d['context']!=_0x8970('0x21')){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x22'),_0xcdde1d[_0x8970('0x7')],_0xcdde1d[_0x8970('0x16')],_0xcdde1d[_0x8970('0x19')],_0xcdde1d[_0x8970('0x8')]));channels[_0xcdde1d[_0x8970('0x16')]][_0x8970('0xe')]=_0xcdde1d[_0x8970('0xe')];channels[_0xcdde1d['linkedid']][_0x8970('0x23')]=_0xcdde1d[_0x8970('0x8')];if(_[_0x8970('0x1f')](channels[_0xcdde1d[_0x8970('0x16')]][_0x8970('0x24')])){channels[_0xcdde1d[_0x8970('0x16')]][_0x8970('0x24')]=utils[_0x8970('0x1b')]();}channels[_0xcdde1d[_0x8970('0x16')]][_0x8970('0x25')]=dispositions[_[_0x8970('0x26')](_0xcdde1d[_0x8970('0x1e')])]||'ANSWERED';}}catch(_0x3cc16a){utils[_0x8970('0x27')](util[_0x8970('0x14')](_0x8970('0x28'),_0xcdde1d['uniqueid']),_0x3cc16a);}};exports['hangup']=function(_0x582a45){try{if(!_[_0x8970('0x1f')](channels[_0x582a45[_0x8970('0x7')]])){utils[_0x8970('0x13')](util[_0x8970('0x14')]('[%s][calls][hangup]',_0x582a45[_0x8970('0x7')]),_0x582a45);if(_[_0x8970('0x1f')](channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x29')])){channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x29')]=_0x582a45['calleridname']+'\x20<'+_0x582a45[_0x8970('0xb')]+'>';}utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x2a'),_0x582a45[_0x8970('0x7')],channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x29')],_0x582a45[_0x8970('0x2b')]));channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x2c')]=utils[_0x8970('0x1b')]();channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x2d')]=utils[_0x8970('0x2e')](channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x2c')],channels[_0x582a45[_0x8970('0x7')]]['starttime']);channels[_0x582a45['uniqueid']][_0x8970('0x2f')]=channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x24')]?utils[_0x8970('0x2e')](channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x2c')],channels[_0x582a45[_0x8970('0x7')]][_0x8970('0x24')]):0x0;writeDB(channels[_0x582a45[_0x8970('0x7')]]);}}catch(_0x17b818){utils[_0x8970('0x27')](util[_0x8970('0x14')](_0x8970('0x30'),_0x582a45[_0x8970('0x7')]),_0x17b818);}};exports[_0x8970('0x31')]=function(_0x721334){try{if(!_['isNil'](channels[_0x721334[_0x8970('0x32')]])){utils['debug'](util[_0x8970('0x14')](_0x8970('0x33'),_0x721334['origtransfereruniqueid']),_0x721334);if(channels[_0x721334['localtwolinkedid']]['channel']==_0x721334['transfereechannel']){utils[_0x8970('0x5')](util[_0x8970('0x14')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x721334['origtransfereruniqueid'],_0x721334[_0x8970('0x32')],_0x721334['secondtransfererchannel']));channels[_0x721334['localtwolinkedid']][_0x8970('0x23')]=_0x721334[_0x8970('0x34')];channels[_0x721334['localtwolinkedid']][_0x8970('0x35')]=_0x8970('0x36');}else if(channels[_0x721334['localtwolinkedid']]['channel']=_0x721334[_0x8970('0x37')]){utils[_0x8970('0x5')](util['format'](_0x8970('0x38'),_0x721334[_0x8970('0x39')],_0x721334[_0x8970('0x32')],_0x721334['origtransfererchannel']));channels[_0x721334[_0x8970('0x32')]]['destinationchannel']=_0x721334[_0x8970('0x3a')];channels[_0x721334[_0x8970('0x32')]][_0x8970('0x35')]=_0x8970('0x36');}}}catch(_0x3d5b7b){utils['error'](util[_0x8970('0x14')](_0x8970('0x33'),_0x721334[_0x8970('0x39')]),_0x3d5b7b);}};exports['musiconholdstart']=function(_0x5b20b3){try{if(!_[_0x8970('0x1f')](channels[_0x5b20b3[_0x8970('0x7')]])){utils[_0x8970('0x13')](util[_0x8970('0x14')]('[%s][calls][musiconholdstart]',_0x5b20b3[_0x8970('0x7')]),_0x5b20b3);channels[_0x5b20b3[_0x8970('0x7')]]['musiconholdstartAt']=utils['now']();utils[_0x8970('0x5')](util[_0x8970('0x14')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x5b20b3[_0x8970('0x7')],channels[_0x5b20b3['uniqueid']][_0x8970('0x3b')]));}}catch(_0x12f8f1){utils['error'](util[_0x8970('0x14')](_0x8970('0x3c'),_0x5b20b3[_0x8970('0x7')]),_0x12f8f1);}};exports['musiconholdstop']=function(_0x351f29){try{if(!_[_0x8970('0x1f')](channels[_0x351f29[_0x8970('0x7')]])){utils[_0x8970('0x13')](util[_0x8970('0x14')](_0x8970('0x3d'),_0x351f29['uniqueid']),_0x351f29);if(!_[_0x8970('0x1f')](channels[_0x351f29['uniqueid']]['musiconholdstartAt'])){channels[_0x351f29[_0x8970('0x7')]][_0x8970('0x3e')]+=utils[_0x8970('0x2e')](utils[_0x8970('0x1b')](),channels[_0x351f29[_0x8970('0x7')]][_0x8970('0x3b')]);utils[_0x8970('0x5')](util[_0x8970('0x14')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x351f29['uniqueid'],channels[_0x351f29[_0x8970('0x7')]][_0x8970('0x3e')]));delete channels[_0x351f29[_0x8970('0x7')]][_0x8970('0x3b')];}}}catch(_0x249626){utils['error'](util[_0x8970('0x14')](_0x8970('0x3d'),_0x351f29[_0x8970('0x7')]),_0x249626);}};exports['varset']=function(_0x190a8d){try{if(!_[_0x8970('0x1f')](channels[_0x190a8d['uniqueid']])){utils['debug'](util[_0x8970('0x14')](_0x8970('0x3f'),_0x190a8d[_0x8970('0x7')]),_0x190a8d);if(!_[_0x8970('0x1f')](_0x190a8d['variable'][_0x8970('0x40')])){utils['info'](util[_0x8970('0x14')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x190a8d['uniqueid'],_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x42')]=_0x190a8d[_0x8970('0x41')];}if(!_[_0x8970('0x1f')](_0x190a8d[_0x8970('0x43')]['xmd-phone'])){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x44'),_0x190a8d[_0x8970('0x7')],_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x45')]=_0x190a8d['value'];channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x29')]='\x22'+_0x190a8d[_0x8970('0x41')]+_0x8970('0x46')+_0x190a8d[_0x8970('0x41')]+'>';}if(!_[_0x8970('0x1f')](_0x190a8d['variable'][_0x8970('0x47')])||!_[_0x8970('0x1f')](_0x190a8d['variable'][_0x8970('0x48')])){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x49'),_0x190a8d['uniqueid'],!_['isNil'](_0x190a8d[_0x8970('0x43')]['xmd-callerid-preview'])?_0x8970('0x47'):_0x8970('0x48'),_0x190a8d['value']));channels[_0x190a8d[_0x8970('0x7')]]['callerid']=_0x190a8d[_0x8970('0x41')];}if(!_[_0x8970('0x1f')](_0x190a8d[_0x8970('0x43')][_0x8970('0x4a')])||!_[_0x8970('0x1f')](_0x190a8d[_0x8970('0x43')][_0x8970('0x4b')])){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x49'),_0x190a8d['uniqueid'],!_[_0x8970('0x1f')](_0x190a8d[_0x8970('0x43')][_0x8970('0x4a')])?_0x8970('0x4a'):_0x8970('0x4b'),_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x4c')]=_0x8970('0x4d');channels[_0x190a8d['uniqueid']][_0x8970('0x4e')]=_0x190a8d[_0x8970('0x41')];channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x4f')]=!![];}if(!_['isNil'](_0x190a8d[_0x8970('0x43')][_0x8970('0x50')])){utils[_0x8970('0x5')](util['format'](_0x8970('0x51'),_0x190a8d[_0x8970('0x7')],_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x52')]=_0x190a8d[_0x8970('0x41')];}if(!_[_0x8970('0x1f')](_0x190a8d['variable']['xmd-cdrtype'])){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x53'),_0x190a8d[_0x8970('0x7')],_0x190a8d['value']));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x54')]=_0x190a8d['value'];}if(!_['isNil'](_0x190a8d[_0x8970('0x43')][_0x8970('0x55')])){utils[_0x8970('0x5')](util[_0x8970('0x14')](_0x8970('0x56'),_0x190a8d[_0x8970('0x7')],_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]]['routeid']=_0x190a8d[_0x8970('0x41')];}if(!_['isNil'](_0x190a8d[_0x8970('0x43')][_0x8970('0x57')])){utils['info'](util[_0x8970('0x14')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x190a8d[_0x8970('0x7')],_0x190a8d[_0x8970('0x41')]));channels[_0x190a8d[_0x8970('0x7')]][_0x8970('0x57')]=_0x190a8d[_0x8970('0x41')];}}}catch(_0x1f9b8e){utils[_0x8970('0x27')](util['format']('[%s][calls][varset]',_0x190a8d[_0x8970('0x7')]),_0x1f9b8e);}};exports[_0x8970('0x58')]=function(_0x7decc1){try{if(!_[_0x8970('0x1f')](channels[_0x7decc1[_0x8970('0x7')]])){utils['debug'](util[_0x8970('0x14')]('[%s][calls][newexten]',_0x7decc1[_0x8970('0x7')]),_0x7decc1);utils[_0x8970('0x5')](util[_0x8970('0x14')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x7decc1[_0x8970('0x7')],_0x7decc1[_0x8970('0x59')],_0x7decc1[_0x8970('0x5a')]));if(_0x7decc1['application']['toLowerCase']()==_0x8970('0x5b')&&_[_0x8970('0x5c')](_0x7decc1[_0x8970('0x5a')][_0x8970('0x5d')](),_0x8970('0x5e'))){var _0x284f51=_0x7decc1['appdata'][_0x8970('0x5f')]('=');var _0x56178e=_0x284f51[0x0][_0x8970('0x60')](_0x284f51[0x0]['lastIndexOf']('(')+0x1,_0x284f51[0x0]['lastIndexOf'](')'));var _0x4ad1ae=_0x284f51[0x1];channels[_0x7decc1[_0x8970('0x7')]][_0x56178e]=_0x4ad1ae;}if(!_[_0x8970('0x61')]([_0x8970('0x62'),_0x8970('0x63'),_0x8970('0x64'),_0x8970('0x5b'),_0x8970('0x65')],_0x7decc1[_0x8970('0x59')][_0x8970('0x5d')]())){channels[_0x7decc1[_0x8970('0x7')]]['lastapplication']=_0x7decc1[_0x8970('0x59')];channels[_0x7decc1['uniqueid']]['lastdata']=_0x7decc1[_0x8970('0x5a')];}}}catch(_0x341abf){utils[_0x8970('0x27')](util[_0x8970('0x14')](_0x8970('0x66'),_0x7decc1[_0x8970('0x7')]),_0x341abf);}}; \ No newline at end of file +var _0x6338=['xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','lastapplication','Queue','lastdata','queue','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','includes','execif','gotoif','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','connectedlinenum','lastevent','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','accountcode','now','error','newstate','debug','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridnum','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','localtwolinkedid','secondtransfererchannel','destinationchannel','userfield','_attended','origtransfererchannel','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination'];(function(_0x362b52,_0x262808){var _0x267f13=function(_0x40beba){while(--_0x40beba){_0x362b52['push'](_0x362b52['shift']());}};_0x267f13(++_0x262808);}(_0x6338,0x15e));var _0x8633=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6338[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8633('0x0'));var util=require(_0x8633('0x1'));var utils=require(_0x8633('0x2'));var dispositions=[_0x8633('0x3'),'FAILED',_0x8633('0x4'),'NO\x20ANSWER',_0x8633('0x3'),_0x8633('0x3'),_0x8633('0x5'),'BUSY',_0x8633('0x4'),_0x8633('0x4'),_0x8633('0x4')];var channels={};function writeDB(_0x21994d){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x8'),_0x21994d[_0x8633('0x9')],_0x21994d[_0x8633('0xa')],_0x21994d['queue'],_0x21994d['membername'],_0x21994d['interface'],_0x21994d['calleridnum'],_0x21994d[_0x8633('0xb')],_0x21994d[_0x8633('0xc')]));if(_0x21994d['accountcode']){utils[_0x8633('0xd')](_0x21994d['accountcode'])[_0x8633('0xe')](function(_0x26dc85){if(_0x26dc85){_0x21994d[_0x8633('0xf')]=_0x26dc85['id'];}utils[_0x8633('0x10')](_0x8633('0x11'),_0x21994d);});}else{utils[_0x8633('0x10')](_0x8633('0x11'),_0x21994d);}if(channels[_0x21994d[_0x8633('0x9')]]){delete channels[_0x21994d[_0x8633('0x9')]];}}exports[_0x8633('0x12')]=function(_0x2bf764){try{utils['debug'](util[_0x8633('0x7')](_0x8633('0x13'),_0x2bf764[_0x8633('0x9')]),_0x2bf764);if(_0x2bf764['uniqueid']==_0x2bf764[_0x8633('0x14')]&&_0x2bf764[_0x8633('0xa')]!=_0x8633('0x15')){utils[_0x8633('0x6')](util['format']('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0x2bf764['uniqueid'],_0x2bf764[_0x8633('0x16')],_0x2bf764[_0x8633('0x17')]));channels[_0x2bf764[_0x8633('0x9')]]={'uniqueid':_0x2bf764[_0x8633('0x9')],'accountcode':_0x2bf764[_0x8633('0x18')],'source':_0x2bf764['calleridnum'],'destination':_0x2bf764[_0x8633('0x17')],'destinationcontext':_0x2bf764['context'],'channel':_0x2bf764[_0x8633('0xa')],'starttime':utils[_0x8633('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x8633('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x3afcf9){utils[_0x8633('0x1a')](util[_0x8633('0x7')](_0x8633('0x13'),_0x2bf764[_0x8633('0x9')]),_0x3afcf9);}};exports[_0x8633('0x1b')]=function(_0xb8471b){try{utils[_0x8633('0x1c')](util[_0x8633('0x7')]('[%s][calls][newstate]',_0xb8471b[_0x8633('0x9')]),_0xb8471b);if(!_[_0x8633('0x1d')](channels[_0xb8471b['uniqueid']])&&_0xb8471b[_0x8633('0x1e')]==0x6){utils[_0x8633('0x6')](util['format'](_0x8633('0x1f'),_0xb8471b['uniqueid'],_0xb8471b[_0x8633('0x16')],_0xb8471b['channel']));if(_['isNil'](channels[_0xb8471b[_0x8633('0x9')]][_0x8633('0x20')])){channels[_0xb8471b[_0x8633('0x9')]][_0x8633('0x20')]=utils[_0x8633('0x19')]();}}else if(!_['isNil'](channels[_0xb8471b['linkedid']])&&_0xb8471b[_0x8633('0x1e')]==0x6&&_0xb8471b[_0x8633('0x16')]!='transfer'){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x21'),_0xb8471b['uniqueid'],_0xb8471b[_0x8633('0x14')],_0xb8471b[_0x8633('0x16')],_0xb8471b[_0x8633('0xa')]));channels[_0xb8471b[_0x8633('0x14')]][_0x8633('0x18')]=_0xb8471b['accountcode'];channels[_0xb8471b[_0x8633('0x14')]]['destinationchannel']=_0xb8471b[_0x8633('0xa')];if(_['isNil'](channels[_0xb8471b[_0x8633('0x14')]][_0x8633('0x22')])){channels[_0xb8471b[_0x8633('0x14')]][_0x8633('0x22')]=utils[_0x8633('0x19')]();}channels[_0xb8471b[_0x8633('0x14')]][_0x8633('0x23')]=dispositions[_[_0x8633('0x24')](_0xb8471b['channelstate'])]||_0x8633('0x5');}}catch(_0x2bc3d2){utils[_0x8633('0x1a')](util[_0x8633('0x7')]('[%s][calls][newstate]',_0xb8471b[_0x8633('0x9')]),_0x2bc3d2);}};exports[_0x8633('0x25')]=function(_0x159c96){try{if(!_['isNil'](channels[_0x159c96[_0x8633('0x9')]])){utils[_0x8633('0x1c')](util['format'](_0x8633('0x26'),_0x159c96['uniqueid']),_0x159c96);if(_[_0x8633('0x1d')](channels[_0x159c96['uniqueid']]['callerid'])){channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x27')]=_0x159c96['calleridname']+'\x20<'+_0x159c96[_0x8633('0x28')]+'>';}utils['info'](util[_0x8633('0x7')](_0x8633('0x29'),_0x159c96[_0x8633('0x9')],channels[_0x159c96[_0x8633('0x9')]]['callerid'],_0x159c96[_0x8633('0x2a')]));channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x2b')]=utils[_0x8633('0x19')]();channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x2c')]=utils[_0x8633('0x2d')](channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x2b')],channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x2e')]);channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x2f')]=channels[_0x159c96[_0x8633('0x9')]]['answertime']?utils[_0x8633('0x2d')](channels[_0x159c96[_0x8633('0x9')]]['endtime'],channels[_0x159c96[_0x8633('0x9')]][_0x8633('0x22')]):0x0;writeDB(channels[_0x159c96[_0x8633('0x9')]]);}}catch(_0x1b7bda){utils[_0x8633('0x1a')](util[_0x8633('0x7')](_0x8633('0x26'),_0x159c96[_0x8633('0x9')]),_0x1b7bda);}};exports[_0x8633('0x30')]=function(_0x45f948){try{if(!_['isNil'](channels[_0x45f948['localtwolinkedid']])){utils[_0x8633('0x1c')](util[_0x8633('0x7')](_0x8633('0x31'),_0x45f948[_0x8633('0x32')]),_0x45f948);if(channels[_0x45f948['localtwolinkedid']][_0x8633('0xa')]==_0x45f948[_0x8633('0x33')]){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x34'),_0x45f948[_0x8633('0x32')],_0x45f948[_0x8633('0x35')],_0x45f948[_0x8633('0x36')]));channels[_0x45f948['localtwolinkedid']][_0x8633('0x37')]=_0x45f948['secondtransfererchannel'];channels[_0x45f948[_0x8633('0x35')]][_0x8633('0x38')]=_0x8633('0x39');}else if(channels[_0x45f948['localtwolinkedid']]['channel']=_0x45f948['transfertargetchannel']){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x34'),_0x45f948[_0x8633('0x32')],_0x45f948['localtwolinkedid'],_0x45f948[_0x8633('0x3a')]));channels[_0x45f948[_0x8633('0x35')]]['destinationchannel']=_0x45f948['origtransfererchannel'];channels[_0x45f948['localtwolinkedid']][_0x8633('0x38')]=_0x8633('0x39');}}}catch(_0x282cf6){utils[_0x8633('0x1a')](util['format'](_0x8633('0x31'),_0x45f948[_0x8633('0x32')]),_0x282cf6);}};exports['musiconholdstart']=function(_0x45a506){try{if(!_[_0x8633('0x1d')](channels[_0x45a506[_0x8633('0x9')]])){utils[_0x8633('0x1c')](util['format']('[%s][calls][musiconholdstart]',_0x45a506['uniqueid']),_0x45a506);channels[_0x45a506[_0x8633('0x9')]][_0x8633('0x3b')]=utils['now']();utils['info'](util[_0x8633('0x7')](_0x8633('0x3c'),_0x45a506[_0x8633('0x9')],channels[_0x45a506[_0x8633('0x9')]][_0x8633('0x3b')]));}}catch(_0x234442){utils['error'](util[_0x8633('0x7')](_0x8633('0x3d'),_0x45a506[_0x8633('0x9')]),_0x234442);}};exports[_0x8633('0x3e')]=function(_0x8c38b7){try{if(!_[_0x8633('0x1d')](channels[_0x8c38b7[_0x8633('0x9')]])){utils[_0x8633('0x1c')](util[_0x8633('0x7')](_0x8633('0x3f'),_0x8c38b7['uniqueid']),_0x8c38b7);if(!_[_0x8633('0x1d')](channels[_0x8c38b7[_0x8633('0x9')]][_0x8633('0x3b')])){channels[_0x8c38b7[_0x8633('0x9')]]['mohtime']+=utils[_0x8633('0x2d')](utils[_0x8633('0x19')](),channels[_0x8c38b7[_0x8633('0x9')]]['musiconholdstartAt']);utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x40'),_0x8c38b7[_0x8633('0x9')],channels[_0x8c38b7[_0x8633('0x9')]][_0x8633('0x41')]));delete channels[_0x8c38b7[_0x8633('0x9')]][_0x8633('0x3b')];}}}catch(_0x4b6b7a){utils[_0x8633('0x1a')](util[_0x8633('0x7')](_0x8633('0x3f'),_0x8c38b7[_0x8633('0x9')]),_0x4b6b7a);}};exports[_0x8633('0x42')]=function(_0xb24d1e){try{if(!_[_0x8633('0x1d')](channels[_0xb24d1e['uniqueid']])){utils[_0x8633('0x1c')](util[_0x8633('0x7')]('[%s][calls][varset]',_0xb24d1e[_0x8633('0x9')]),_0xb24d1e);if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x44')])){utils['info'](util[_0x8633('0x7')](_0x8633('0x45'),_0xb24d1e['uniqueid'],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e['uniqueid']][_0x8633('0x47')]=_0xb24d1e[_0x8633('0x46')];}if(!_['isNil'](_0xb24d1e[_0x8633('0x43')]['xmd-phone'])){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x48'),_0xb24d1e[_0x8633('0x9')],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e['uniqueid']][_0x8633('0x49')]=_0xb24d1e[_0x8633('0x46')];channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x27')]='\x22'+_0xb24d1e['value']+'\x22\x20<'+_0xb24d1e[_0x8633('0x46')]+'>';}if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x4a')])||!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x4b')])){utils[_0x8633('0x6')](util[_0x8633('0x7')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0xb24d1e[_0x8633('0x9')],!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')]['xmd-callerid-preview'])?_0x8633('0x4a'):_0x8633('0x4b'),_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x27')]=_0xb24d1e[_0x8633('0x46')];}if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')]['xmd-queue'])||!_[_0x8633('0x1d')](_0xb24d1e['variable'][_0x8633('0x4c')])){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x4d'),_0xb24d1e[_0x8633('0x9')],!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x4e')])?'xmd-queue':'xmcs-queue',_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x4f')]=_0x8633('0x50');channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x51')]=_0xb24d1e[_0x8633('0x46')];channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x52')]=!![];}if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')]['xmd-contactid'])){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x53'),_0xb24d1e[_0x8633('0x9')],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x54')]=_0xb24d1e[_0x8633('0x46')];}if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x55')])){utils[_0x8633('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0xb24d1e['uniqueid'],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x56')]=_0xb24d1e[_0x8633('0x46')];}if(!_[_0x8633('0x1d')](_0xb24d1e[_0x8633('0x43')][_0x8633('0x57')])){utils['info'](util[_0x8633('0x7')](_0x8633('0x58'),_0xb24d1e[_0x8633('0x9')],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]]['routeid']=_0xb24d1e[_0x8633('0x46')];}if(!_[_0x8633('0x1d')](_0xb24d1e['variable'][_0x8633('0x59')])){utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x5a'),_0xb24d1e[_0x8633('0x9')],_0xb24d1e[_0x8633('0x46')]));channels[_0xb24d1e[_0x8633('0x9')]][_0x8633('0x59')]=_0xb24d1e[_0x8633('0x46')];}}}catch(_0x82b8f8){utils[_0x8633('0x1a')](util[_0x8633('0x7')](_0x8633('0x5b'),_0xb24d1e[_0x8633('0x9')]),_0x82b8f8);}};exports[_0x8633('0x5c')]=function(_0x4abe17){try{if(!_['isNil'](channels[_0x4abe17['uniqueid']])){utils[_0x8633('0x1c')](util[_0x8633('0x7')](_0x8633('0x5d'),_0x4abe17[_0x8633('0x9')]),_0x4abe17);utils[_0x8633('0x6')](util[_0x8633('0x7')](_0x8633('0x5e'),_0x4abe17[_0x8633('0x9')],_0x4abe17[_0x8633('0x5f')],_0x4abe17[_0x8633('0x60')]));if(_0x4abe17[_0x8633('0x5f')][_0x8633('0x61')]()==_0x8633('0x62')&&_[_0x8633('0x63')](_0x4abe17[_0x8633('0x60')][_0x8633('0x61')](),'cdr')){var _0xa25b05=_0x4abe17['appdata'][_0x8633('0x64')]('=');var _0x2c4e69=_0xa25b05[0x0][_0x8633('0x65')](_0xa25b05[0x0][_0x8633('0x66')]('(')+0x1,_0xa25b05[0x0][_0x8633('0x66')](')'));var _0x4e77c7=_0xa25b05[0x1];channels[_0x4abe17[_0x8633('0x9')]][_0x2c4e69]=_0x4e77c7;}if(!_[_0x8633('0x67')](['hangup','noop',_0x8633('0x68'),_0x8633('0x62'),_0x8633('0x69')],_0x4abe17['application'][_0x8633('0x61')]())){channels[_0x4abe17[_0x8633('0x9')]][_0x8633('0x4f')]=_0x4abe17[_0x8633('0x5f')];channels[_0x4abe17['uniqueid']][_0x8633('0x51')]=_0x4abe17['appdata'];}}}catch(_0x2f75c6){utils[_0x8633('0x1a')](util[_0x8633('0x7')](_0x8633('0x5d'),_0x4abe17[_0x8633('0x9')]),_0x2f75c6);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 2f2fd5a..42dd1c5 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 _0x2868=['info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect'];(function(_0x3751d4,_0x58c1fe){var _0x1c32e4=function(_0x283cde){while(--_0x283cde){_0x3751d4['push'](_0x3751d4['shift']());}};_0x1c32e4(++_0x58c1fe);}(_0x2868,0x17e));var _0x8286=function(_0x4f29f4,_0x262f82){_0x4f29f4=_0x4f29f4-0x0;var _0x139c01=_0x2868[_0x4f29f4];return _0x139c01;};'use strict';var utils=require(_0x8286('0x0'));exports[_0x8286('0x1')]=function(){utils[_0x8286('0x2')](_0x8286('0x3'));};exports[_0x8286('0x4')]=function(){utils['info']('[core]\x20shutdown');};exports[_0x8286('0x5')]=function(){utils[_0x8286('0x2')](_0x8286('0x6'));};exports['error']=function(_0x3356f3){utils[_0x8286('0x7')](_0x8286('0x8'),_0x3356f3);};exports[_0x8286('0x9')]=function(){utils['info'](_0x8286('0xa'));};exports[_0x8286('0xb')]=function(_0x16dd47){}; \ No newline at end of file +var _0x9e58=['[core]\x20shutdown','error','[core]\x20error','close','connect','info','[core]\x20connected','shutdown'];(function(_0x2ed502,_0x3b7fab){var _0x191886=function(_0x446add){while(--_0x446add){_0x2ed502['push'](_0x2ed502['shift']());}};_0x191886(++_0x3b7fab);}(_0x9e58,0xec));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require('./utils');exports[_0x89e5('0x0')]=function(){utils[_0x89e5('0x1')](_0x89e5('0x2'));};exports[_0x89e5('0x3')]=function(){utils[_0x89e5('0x1')](_0x89e5('0x4'));};exports['fullybooted']=function(){utils[_0x89e5('0x1')]('[core]\x20fullybooted');};exports[_0x89e5('0x5')]=function(_0x1322fc){utils[_0x89e5('0x5')](_0x89e5('0x6'),_0x1322fc);};exports[_0x89e5('0x7')]=function(){utils[_0x89e5('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x517a39){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c297873..28f1399 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 _0x932d=['calleridnum','calleridname','cause-txt','duration','diffTime','endtime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','dialstatus','uniqueid','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','appdata','application','set','startsWith','toLowerCase','cdr(routeid)','split','error','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x932d,0xd7));var _0xd932=function(_0x10fe9e,_0x1bba66){_0x10fe9e=_0x10fe9e-0x0;var _0xae2c51=_0x932d[_0x10fe9e];return _0xae2c51;};'use strict';var _=require(_0xd932('0x0'));var util=require('util');var utils=require(_0xd932('0x1'));var dials={};function writeDB(_0x5d757a){utils[_0xd932('0x2')](util[_0xd932('0x3')](_0xd932('0x4'),_0x5d757a['uniqueid'],_0x5d757a[_0xd932('0x5')],_0x5d757a[_0xd932('0x6')],_0x5d757a['calleridnum'],_0x5d757a['connectedlinenum'],_0x5d757a[_0xd932('0x7')]));utils['request']('CreateVoiceDialReport',_0x5d757a);delete dials[_0x5d757a[_0xd932('0x8')]];}exports['newexten']=function(_0x33d7e7){try{utils[_0xd932('0x9')](util[_0xd932('0x3')](_0xd932('0xa'),_0x33d7e7[_0xd932('0x8')]),_0x33d7e7);utils[_0xd932('0x2')](util['format'](_0xd932('0xb'),_0x33d7e7['uniqueid'],_0x33d7e7['application'],_0x33d7e7[_0xd932('0xc')]));if(_0x33d7e7[_0xd932('0xd')]['toLowerCase']()==_0xd932('0xe')&&_[_0xd932('0xf')](_0x33d7e7[_0xd932('0xc')][_0xd932('0x10')](),_0xd932('0x11'))){var _0x390971=_0x33d7e7[_0xd932('0xc')][_0xd932('0x12')]('=');dials[_0x33d7e7['uniqueid']]={'routeId':_0x390971[0x1]};}}catch(_0x557f2f){utils[_0xd932('0x13')](util[_0xd932('0x3')](_0xd932('0xa'),_0x33d7e7['uniqueid']),_0x557f2f);}};exports[_0xd932('0x14')]=function(_0x98ceb2){try{utils['debug'](util['format']('[%s][dials][varset]',_0x98ceb2[_0xd932('0x8')]),_0x98ceb2);if(!_[_0xd932('0x15')](_0x98ceb2[_0xd932('0x16')][_0xd932('0x17')])){utils['info'](util[_0xd932('0x3')](_0xd932('0x18'),_0x98ceb2['uniqueid'],_0x98ceb2['value']));dials[_0x98ceb2[_0xd932('0x8')]]={'routeId':_0x98ceb2[_0xd932('0x19')]};}}catch(_0x2c9b1c){utils[_0xd932('0x13')](util[_0xd932('0x3')](_0xd932('0x1a'),_0x98ceb2['uniqueid']),_0x2c9b1c);}};exports[_0xd932('0x1b')]=function(_0x3dc213){try{if(!_[_0xd932('0x15')](dials[_0x3dc213[_0xd932('0x8')]])){utils[_0xd932('0x9')](util[_0xd932('0x3')](_0xd932('0x1c'),_0x3dc213[_0xd932('0x8')]),_0x3dc213);dials[_0x3dc213[_0xd932('0x8')]]=_[_0xd932('0x1d')](dials[_0x3dc213[_0xd932('0x8')]],_0x3dc213);dials[_0x3dc213['uniqueid']][_0xd932('0x1e')]=utils[_0xd932('0x1f')]();dials[_0x3dc213[_0xd932('0x8')]][_0xd932('0x20')]=_0xd932('0x21');utils[_0xd932('0x2')](util['format'](_0xd932('0x22'),_0x3dc213[_0xd932('0x8')],dials[_0x3dc213['uniqueid']][_0xd932('0x1e')]));}}catch(_0x1d73e1){utils['error'](util[_0xd932('0x3')](_0xd932('0x1c'),_0x3dc213[_0xd932('0x8')]),_0x1d73e1);}};exports[_0xd932('0x23')]=function(_0xc65d1){try{if(!_[_0xd932('0x15')](dials[_0xc65d1[_0xd932('0x8')]])){utils[_0xd932('0x9')](util[_0xd932('0x3')](_0xd932('0x24'),_0xc65d1[_0xd932('0x8')]),_0xc65d1);dials[_0xc65d1[_0xd932('0x8')]][_0xd932('0x7')]=_0xc65d1['dialstatus'];if(_0xc65d1[_0xd932('0x7')]==_0xd932('0x25')){dials[_0xc65d1[_0xd932('0x8')]]=_['assign'](dials[_0xc65d1[_0xd932('0x8')]],_0xc65d1);dials[_0xc65d1[_0xd932('0x8')]]['answertime']=utils[_0xd932('0x1f')]();dials[_0xc65d1[_0xd932('0x8')]][_0xd932('0x20')]=_0xd932('0x26');utils[_0xd932('0x2')](util[_0xd932('0x3')](_0xd932('0x27'),_0xc65d1[_0xd932('0x8')],_0xc65d1[_0xd932('0x7')],dials[_0xc65d1[_0xd932('0x8')]][_0xd932('0x28')]));}else{utils[_0xd932('0x2')](util[_0xd932('0x3')](_0xd932('0x29'),_0xc65d1[_0xd932('0x8')],_0xc65d1[_0xd932('0x7')]));}}}catch(_0x24a2d5){utils[_0xd932('0x13')](util[_0xd932('0x3')](_0xd932('0x24'),_0xc65d1[_0xd932('0x8')]),_0x24a2d5);}};exports[_0xd932('0x2a')]=function(_0x136e58){try{if(!_['isNil'](dials[_0x136e58[_0xd932('0x8')]])){utils['debug'](util[_0xd932('0x3')](_0xd932('0x2b'),_0x136e58[_0xd932('0x8')]),_0x136e58);utils[_0xd932('0x2')](util[_0xd932('0x3')](_0xd932('0x2c'),_0x136e58[_0xd932('0x8')],_0x136e58[_0xd932('0x2d')],_0x136e58[_0xd932('0x2e')],_0x136e58[_0xd932('0x2f')]));dials[_0x136e58['uniqueid']]=_[_0xd932('0x1d')](dials[_0x136e58[_0xd932('0x8')]],{'endtime':utils[_0xd932('0x1f')](),'lastevent':'complete'});dials[_0x136e58['uniqueid']][_0xd932('0x30')]=utils[_0xd932('0x31')](dials[_0x136e58[_0xd932('0x8')]][_0xd932('0x32')],dials[_0x136e58[_0xd932('0x8')]][_0xd932('0x1e')]);dials[_0x136e58[_0xd932('0x8')]][_0xd932('0x33')]=utils[_0xd932('0x31')](dials[_0x136e58['uniqueid']][_0xd932('0x28')]||dials[_0x136e58['uniqueid']][_0xd932('0x32')],dials[_0x136e58[_0xd932('0x8')]][_0xd932('0x1e')]);dials[_0x136e58[_0xd932('0x8')]]['billableseconds']=dials[_0x136e58[_0xd932('0x8')]]['answertime']?utils[_0xd932('0x31')](dials[_0x136e58[_0xd932('0x8')]][_0xd932('0x32')],dials[_0x136e58['uniqueid']]['answertime']):0x0;writeDB(dials[_0x136e58[_0xd932('0x8')]]);}}catch(_0x55b607){utils[_0xd932('0x13')](util[_0xd932('0x3')]('[%s][dials][hangup]',_0x136e58[_0xd932('0x8')]),_0x55b607);}}; \ No newline at end of file +var _0x2638=['starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','now','complete','duration','diffTime','endtime','holdtime','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','format','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','debug','assign','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2638,0x18e));var _0x8263=function(_0x5d10c2,_0x4b0a49){_0x5d10c2=_0x5d10c2-0x0;var _0x57c7c4=_0x2638[_0x5d10c2];return _0x57c7c4;};'use strict';var _=require(_0x8263('0x0'));var util=require(_0x8263('0x1'));var utils=require(_0x8263('0x2'));var dials={};function writeDB(_0x511d85){utils[_0x8263('0x3')](util['format'](_0x8263('0x4'),_0x511d85[_0x8263('0x5')],_0x511d85['channel'],_0x511d85[_0x8263('0x6')],_0x511d85[_0x8263('0x7')],_0x511d85[_0x8263('0x8')],_0x511d85[_0x8263('0x9')]));utils[_0x8263('0xa')](_0x8263('0xb'),_0x511d85);delete dials[_0x511d85[_0x8263('0x5')]];}exports[_0x8263('0xc')]=function(_0x3852ee){try{utils['debug'](util['format'](_0x8263('0xd'),_0x3852ee['uniqueid']),_0x3852ee);utils['info'](util[_0x8263('0xe')](_0x8263('0xf'),_0x3852ee[_0x8263('0x5')],_0x3852ee[_0x8263('0x10')],_0x3852ee[_0x8263('0x11')]));if(_0x3852ee[_0x8263('0x10')]['toLowerCase']()==_0x8263('0x12')&&_['startsWith'](_0x3852ee[_0x8263('0x11')][_0x8263('0x13')](),_0x8263('0x14'))){var _0x3de94f=_0x3852ee[_0x8263('0x11')][_0x8263('0x15')]('=');dials[_0x3852ee[_0x8263('0x5')]]={'routeId':_0x3de94f[0x1]};}}catch(_0x1a9661){utils['error'](util[_0x8263('0xe')](_0x8263('0xd'),_0x3852ee[_0x8263('0x5')]),_0x1a9661);}};exports[_0x8263('0x16')]=function(_0x54ee6d){try{utils['debug'](util[_0x8263('0xe')](_0x8263('0x17'),_0x54ee6d[_0x8263('0x5')]),_0x54ee6d);if(!_[_0x8263('0x18')](_0x54ee6d[_0x8263('0x19')]['outboundrouteid'])){utils['info'](util[_0x8263('0xe')](_0x8263('0x1a'),_0x54ee6d[_0x8263('0x5')],_0x54ee6d[_0x8263('0x1b')]));dials[_0x54ee6d[_0x8263('0x5')]]={'routeId':_0x54ee6d['value']};}}catch(_0x2e30ef){utils[_0x8263('0x1c')](util[_0x8263('0xe')](_0x8263('0x17'),_0x54ee6d[_0x8263('0x5')]),_0x2e30ef);}};exports[_0x8263('0x1d')]=function(_0x1ae457){try{if(!_[_0x8263('0x18')](dials[_0x1ae457[_0x8263('0x5')]])){utils[_0x8263('0x1e')](util['format']('[%s][dials][dialbegin]',_0x1ae457[_0x8263('0x5')]),_0x1ae457);dials[_0x1ae457[_0x8263('0x5')]]=_[_0x8263('0x1f')](dials[_0x1ae457['uniqueid']],_0x1ae457);dials[_0x1ae457[_0x8263('0x5')]]['starttime']=utils['now']();dials[_0x1ae457[_0x8263('0x5')]][_0x8263('0x20')]='called';utils[_0x8263('0x3')](util[_0x8263('0xe')](_0x8263('0x21'),_0x1ae457['uniqueid'],dials[_0x1ae457['uniqueid']][_0x8263('0x22')]));}}catch(_0x1d0c48){utils[_0x8263('0x1c')](util['format'](_0x8263('0x23'),_0x1ae457[_0x8263('0x5')]),_0x1d0c48);}};exports[_0x8263('0x24')]=function(_0x45ca27){try{if(!_[_0x8263('0x18')](dials[_0x45ca27['uniqueid']])){utils[_0x8263('0x1e')](util[_0x8263('0xe')](_0x8263('0x25'),_0x45ca27[_0x8263('0x5')]),_0x45ca27);dials[_0x45ca27[_0x8263('0x5')]]['dialstatus']=_0x45ca27[_0x8263('0x9')];if(_0x45ca27[_0x8263('0x9')]==_0x8263('0x26')){dials[_0x45ca27[_0x8263('0x5')]]=_['assign'](dials[_0x45ca27[_0x8263('0x5')]],_0x45ca27);dials[_0x45ca27[_0x8263('0x5')]][_0x8263('0x27')]=utils['now']();dials[_0x45ca27['uniqueid']]['lastevent']=_0x8263('0x28');utils[_0x8263('0x3')](util[_0x8263('0xe')](_0x8263('0x29'),_0x45ca27[_0x8263('0x5')],_0x45ca27[_0x8263('0x9')],dials[_0x45ca27[_0x8263('0x5')]]['answertime']));}else{utils[_0x8263('0x3')](util[_0x8263('0xe')](_0x8263('0x2a'),_0x45ca27[_0x8263('0x5')],_0x45ca27[_0x8263('0x9')]));}}}catch(_0x1e4fa4){utils[_0x8263('0x1c')](util[_0x8263('0xe')](_0x8263('0x25'),_0x45ca27[_0x8263('0x5')]),_0x1e4fa4);}};exports[_0x8263('0x2b')]=function(_0x593cc9){try{if(!_[_0x8263('0x18')](dials[_0x593cc9['uniqueid']])){utils[_0x8263('0x1e')](util[_0x8263('0xe')](_0x8263('0x2c'),_0x593cc9['uniqueid']),_0x593cc9);utils[_0x8263('0x3')](util[_0x8263('0xe')](_0x8263('0x2d'),_0x593cc9[_0x8263('0x5')],_0x593cc9[_0x8263('0x7')],_0x593cc9[_0x8263('0x2e')],_0x593cc9[_0x8263('0x2f')]));dials[_0x593cc9[_0x8263('0x5')]]=_[_0x8263('0x1f')](dials[_0x593cc9[_0x8263('0x5')]],{'endtime':utils[_0x8263('0x30')](),'lastevent':_0x8263('0x31')});dials[_0x593cc9['uniqueid']][_0x8263('0x32')]=utils[_0x8263('0x33')](dials[_0x593cc9['uniqueid']][_0x8263('0x34')],dials[_0x593cc9[_0x8263('0x5')]][_0x8263('0x22')]);dials[_0x593cc9[_0x8263('0x5')]][_0x8263('0x35')]=utils[_0x8263('0x33')](dials[_0x593cc9['uniqueid']]['answertime']||dials[_0x593cc9['uniqueid']][_0x8263('0x34')],dials[_0x593cc9[_0x8263('0x5')]]['starttime']);dials[_0x593cc9[_0x8263('0x5')]]['billableseconds']=dials[_0x593cc9[_0x8263('0x5')]][_0x8263('0x27')]?utils[_0x8263('0x33')](dials[_0x593cc9[_0x8263('0x5')]][_0x8263('0x34')],dials[_0x593cc9[_0x8263('0x5')]]['answertime']):0x0;writeDB(dials[_0x593cc9[_0x8263('0x5')]]);}}catch(_0x30bd6d){utils[_0x8263('0x1c')](util[_0x8263('0xe')]('[%s][dials][hangup]',_0x593cc9[_0x8263('0x5')]),_0x30bd6d);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 20a04cc..27bcfd9 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 _0x7ce2=['asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','keepConnected','info','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','format','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%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][index][dialend]','dialend'];(function(_0x3d2c84,_0x5f5a75){var _0x4f344e=function(_0x4f782f){while(--_0x4f782f){_0x3d2c84['push'](_0x3d2c84['shift']());}};_0x4f344e(++_0x5f5a75);}(_0x7ce2,0x154));var _0x27ce=function(_0x2e6012,_0x56ce8f){_0x2e6012=_0x2e6012-0x0;var _0x31a261=_0x7ce2[_0x2e6012];return _0x31a261;};var AsteriskManager=require(_0x27ce('0x0'));var config=require(_0x27ce('0x1'));var utils=require('./utils');var util=require(_0x27ce('0x2'));var isXDREnabled=config[_0x27ce('0x3')]&&config[_0x27ce('0x3')][_0x27ce('0x4')]?!config['xdr'][_0x27ce('0x4')]:!![];var isProduction=config[_0x27ce('0x5')]===_0x27ce('0x6')||![];var isLocalAsterisk=config[_0x27ce('0x3')]&&config['xdr'][_0x27ce('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x27ce('0x8')][_0x27ce('0x9')],config['asterisk']['ip'],config['asterisk'][_0x27ce('0xa')],config[_0x27ce('0x8')]['password'],!![]);ami[_0x27ce('0xb')]();if(!isXDREnabled){utils[_0x27ce('0xc')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x27ce('0xc')](_0x27ce('0xd'));}else{var agents=require(_0x27ce('0xe'));var calls=require('./calls.controller');var queues=require(_0x27ce('0xf'));var recordings=require(_0x27ce('0x10'));var members=require(_0x27ce('0x11'));var dials=require('./dials.controller');var transfers=require(_0x27ce('0x12'));var core=require(_0x27ce('0x13'));ami['on'](_0x27ce('0x14'),core[_0x27ce('0x14')]);ami['on'](_0x27ce('0x15'),core[_0x27ce('0x15')]);ami['on'](_0x27ce('0x16'),core[_0x27ce('0x16')]);ami['on'](_0x27ce('0x17'),core['error']);ami['on'](_0x27ce('0x18'),core['close']);ami['on']('managerevent',core[_0x27ce('0x19')]);ami['on'](_0x27ce('0x1a'),function(_0x550e2a){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x1c'),_0x550e2a['device']),_0x550e2a);members[_0x27ce('0x1a')](_0x550e2a);}catch(_0x5811f2){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x1c'),_0x550e2a[_0x27ce('0x1e')]),_0x5811f2);}});ami['on'](_0x27ce('0x1f'),function(_0x4f3ff9){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')](_0x27ce('0x20'),_0x4f3ff9[_0x27ce('0x21')]),_0x4f3ff9);agents[_0x27ce('0x1f')](_0x4f3ff9);}catch(_0x586ccc){utils['error'](util[_0x27ce('0x1d')](_0x27ce('0x20'),_0x4f3ff9['uniqueid']),_0x586ccc);}});ami['on']('agentringnoanswer',function(_0x62b4b8){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x22'),_0x62b4b8[_0x27ce('0x21')]),_0x62b4b8);agents[_0x27ce('0x23')](_0x62b4b8);}catch(_0x3f1617){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x22'),_0x62b4b8[_0x27ce('0x21')]),_0x3f1617);}});ami['on'](_0x27ce('0x24'),function(_0x1fe63c){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x25'),_0x1fe63c[_0x27ce('0x21')]),_0x1fe63c);agents['agentconnect'](_0x1fe63c);queues['agentconnect'](_0x1fe63c);}catch(_0x4bc8c9){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')]('[%s][index][agentconnect]',_0x1fe63c[_0x27ce('0x21')]),_0x4bc8c9);}});ami['on'](_0x27ce('0x26'),function(_0xad7843){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')](_0x27ce('0x27'),_0xad7843[_0x27ce('0x21')]),_0xad7843);agents[_0x27ce('0x26')](_0xad7843);queues['agentcomplete'](_0xad7843);members[_0x27ce('0x26')](_0xad7843);}catch(_0x54c0c3){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x27'),_0xad7843[_0x27ce('0x21')]),_0x54c0c3);}});ami['on'](_0x27ce('0x28'),function(_0xdc13ad){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')]('[%s][index][queuecallerabandon]',_0xdc13ad[_0x27ce('0x21')]),_0xdc13ad);agents[_0x27ce('0x28')](_0xdc13ad);queues[_0x27ce('0x28')](_0xdc13ad);}catch(_0x3ae51a){utils[_0x27ce('0x17')](util['format']('[%s][index][queuecallerabandon]',_0xdc13ad[_0x27ce('0x21')]),_0x3ae51a);}});ami['on'](_0x27ce('0x29'),function(_0x5587e9){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x2a'),_0x5587e9[_0x27ce('0x21')]),_0x5587e9);queues[_0x27ce('0x29')](_0x5587e9);recordings['queuecallerjoin'](_0x5587e9);}catch(_0x25b7fc){utils[_0x27ce('0x17')](util['format'](_0x27ce('0x2a'),_0x5587e9['uniqueid']),_0x25b7fc);}});ami['on'](_0x27ce('0x2b'),function(_0x43f214){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')]('[%s][index][queuecallerleave]',_0x43f214[_0x27ce('0x21')]),_0x43f214);queues[_0x27ce('0x2b')](_0x43f214);}catch(_0x33dba0){utils[_0x27ce('0x17')](util['format'](_0x27ce('0x2c'),_0x43f214[_0x27ce('0x21')]),_0x33dba0);}});ami['on'](_0x27ce('0x2d'),function(_0x1f3484){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x2e'),_0x1f3484[_0x27ce('0x21')]),_0x1f3484);queues[_0x27ce('0x2d')](_0x1f3484);calls[_0x27ce('0x2d')](_0x1f3484);}catch(_0x142f05){utils['error'](util[_0x27ce('0x1d')](_0x27ce('0x2e'),_0x1f3484['uniqueid']),_0x142f05);}});ami['on'](_0x27ce('0x2f'),function(_0x9d86f){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')]('[%s][index][musiconholdstop]',_0x9d86f[_0x27ce('0x21')]),_0x9d86f);queues[_0x27ce('0x2f')](_0x9d86f);calls['musiconholdstop'](_0x9d86f);}catch(_0xea28aa){utils[_0x27ce('0x17')](util['format'](_0x27ce('0x30'),_0x9d86f[_0x27ce('0x21')]),_0xea28aa);}});ami['on'](_0x27ce('0x31'),function(_0x471d41){try{utils['debug'](util[_0x27ce('0x1d')](_0x27ce('0x32'),_0x471d41[_0x27ce('0x21')]),_0x471d41);calls[_0x27ce('0x31')](_0x471d41);recordings[_0x27ce('0x31')](_0x471d41);}catch(_0x38cfde){utils[_0x27ce('0x17')](util['format'](_0x27ce('0x32'),_0x471d41[_0x27ce('0x21')]),_0x38cfde);}});ami['on'](_0x27ce('0x33'),function(_0x40a660){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')]('[%s][index][hangup]',_0x40a660[_0x27ce('0x21')]),_0x40a660);calls[_0x27ce('0x33')](_0x40a660);recordings[_0x27ce('0x33')](_0x40a660);dials['hangup'](_0x40a660);agents[_0x27ce('0x33')](_0x40a660);queues[_0x27ce('0x33')](_0x40a660);}catch(_0x13d91c){utils['error'](util[_0x27ce('0x1d')]('[%s][index][hangup]',_0x40a660[_0x27ce('0x21')]),_0x13d91c);}});ami['on']('cdr',function(_0x10a376){try{utils[_0x27ce('0x1b')](util['format']('[%s][index][cdr]',_0x10a376[_0x27ce('0x21')]),_0x10a376);members['cdr'](_0x10a376);}catch(_0x2b146b){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x34'),_0x10a376[_0x27ce('0x21')]),_0x2b146b);}});ami['on'](_0x27ce('0x35'),function(_0x5364c8){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')](_0x27ce('0x36'),_0x5364c8[_0x27ce('0x21')]),_0x5364c8);queues['blindtransfer'](_0x5364c8);agents[_0x27ce('0x35')](_0x5364c8);transfers[_0x27ce('0x35')](_0x5364c8);}catch(_0x5054af){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x36'),_0x5364c8[_0x27ce('0x21')]),_0x5054af);}});ami['on'](_0x27ce('0x37'),function(_0x1f91d4){try{utils['debug'](util['format'](_0x27ce('0x38'),_0x1f91d4[_0x27ce('0x39')]),_0x1f91d4);queues[_0x27ce('0x37')](_0x1f91d4);transfers[_0x27ce('0x37')](_0x1f91d4);agents[_0x27ce('0x37')](_0x1f91d4);calls[_0x27ce('0x37')](_0x1f91d4);}catch(_0x102aa3){utils['error'](util['format'](_0x27ce('0x38'),_0x1f91d4[_0x27ce('0x39')]),_0x102aa3);}});ami['on'](_0x27ce('0x3a'),function(_0x3865fa){try{utils['debug'](util[_0x27ce('0x1d')](_0x27ce('0x3b'),_0x3865fa['uniqueid']),_0x3865fa);queues[_0x27ce('0x3a')](_0x3865fa);recordings[_0x27ce('0x3a')](_0x3865fa);calls[_0x27ce('0x3a')](_0x3865fa);dials[_0x27ce('0x3a')](_0x3865fa);}catch(_0x128a10){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')]('[%s][index][varset]',_0x3865fa[_0x27ce('0x21')]),_0x128a10);}});ami['on'](_0x27ce('0x3c'),function(_0x307c24){try{utils['debug'](util[_0x27ce('0x1d')](_0x27ce('0x3d'),_0x307c24[_0x27ce('0x21')]),_0x307c24);calls[_0x27ce('0x3c')](_0x307c24);recordings[_0x27ce('0x3c')](_0x307c24);dials[_0x27ce('0x3c')](_0x307c24);}catch(_0x5e00f8){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x3d'),_0x307c24[_0x27ce('0x21')]),_0x5e00f8);}});ami['on'](_0x27ce('0x3e'),function(_0x4b3f3a){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')](_0x27ce('0x3f'),_0x4b3f3a[_0x27ce('0x21')]),_0x4b3f3a);calls[_0x27ce('0x3e')](_0x4b3f3a);recordings[_0x27ce('0x3e')](_0x4b3f3a);}catch(_0x1e6970){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')]('[%s][index][newchannel]',_0x4b3f3a[_0x27ce('0x21')]),_0x1e6970);}});ami['on'](_0x27ce('0x40'),function(_0x287160){try{utils[_0x27ce('0x1b')](util[_0x27ce('0x1d')](_0x27ce('0x41'),_0x287160['uniqueid']),_0x287160);dials['dialbegin'](_0x287160);}catch(_0x5ca60d){utils['error'](util[_0x27ce('0x1d')]('[%s]dialbegin',_0x287160['uniqueid']),_0x5ca60d);}});ami['on']('dialend',function(_0x3f650c){try{utils[_0x27ce('0x1b')](util['format'](_0x27ce('0x42'),_0x3f650c[_0x27ce('0x21')]),_0x3f650c);dials[_0x27ce('0x43')](_0x3f650c);}catch(_0x377667){utils[_0x27ce('0x17')](util[_0x27ce('0x1d')](_0x27ce('0x42'),_0x3f650c['uniqueid']),_0x377667);}});} \ No newline at end of file +var _0x5937=['./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','error','close','managerevent','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','[%s][index][dialend]','dialend','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./queues.controller'];(function(_0x4a1bc8,_0x3ecdcb){var _0x32fe63=function(_0x59f007){while(--_0x59f007){_0x4a1bc8['push'](_0x4a1bc8['shift']());}};_0x32fe63(++_0x3ecdcb);}(_0x5937,0x1bd));var _0x7593=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5937[_0x4a9fb1];return _0x348672;};var AsteriskManager=require(_0x7593('0x0'));var config=require(_0x7593('0x1'));var utils=require(_0x7593('0x2'));var util=require('util');var isXDREnabled=config[_0x7593('0x3')]&&config[_0x7593('0x3')][_0x7593('0x4')]?!config['xdr']['disabled']:!![];var isProduction=config['env']===_0x7593('0x5')||![];var isLocalAsterisk=config['xdr']&&config[_0x7593('0x3')][_0x7593('0x6')]===!![]||![];var ami=new AsteriskManager(config[_0x7593('0x7')][_0x7593('0x8')],config[_0x7593('0x7')]['ip'],config[_0x7593('0x7')][_0x7593('0x9')],config[_0x7593('0x7')][_0x7593('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x7593('0xb')](_0x7593('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0x7593('0xd'));}else{var agents=require(_0x7593('0xe'));var calls=require(_0x7593('0xf'));var queues=require(_0x7593('0x10'));var recordings=require(_0x7593('0x11'));var members=require(_0x7593('0x12'));var dials=require(_0x7593('0x13'));var transfers=require(_0x7593('0x14'));var core=require(_0x7593('0x15'));ami['on']('connect',core['connect']);ami['on'](_0x7593('0x16'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x7593('0x17'),core[_0x7593('0x17')]);ami['on'](_0x7593('0x18'),core[_0x7593('0x18')]);ami['on'](_0x7593('0x19'),core[_0x7593('0x19')]);ami['on']('devicestatechange',function(_0x44159d){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x1c'),_0x44159d[_0x7593('0x1d')]),_0x44159d);members['devicestatechange'](_0x44159d);}catch(_0x36374b){utils[_0x7593('0x17')](util['format']('[%s][index][devicestatechange]',_0x44159d['device']),_0x36374b);}});ami['on']('agentcalled',function(_0x28cde9){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x1e'),_0x28cde9['uniqueid']),_0x28cde9);agents[_0x7593('0x1f')](_0x28cde9);}catch(_0x4b0882){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x1e'),_0x28cde9[_0x7593('0x20')]),_0x4b0882);}});ami['on'](_0x7593('0x21'),function(_0x23f659){try{utils[_0x7593('0x1a')](util['format']('[%s][index][agentringnoanswer]',_0x23f659[_0x7593('0x20')]),_0x23f659);agents['agentringnoanswer'](_0x23f659);}catch(_0x32a2c0){utils[_0x7593('0x17')](util[_0x7593('0x1b')]('[%s][index][agentringnoanswer]',_0x23f659['uniqueid']),_0x32a2c0);}});ami['on'](_0x7593('0x22'),function(_0x31e5d9){try{utils[_0x7593('0x1a')](util['format']('[%s][index][agentconnect]',_0x31e5d9[_0x7593('0x20')]),_0x31e5d9);agents[_0x7593('0x22')](_0x31e5d9);queues[_0x7593('0x22')](_0x31e5d9);}catch(_0x2cef65){utils['error'](util[_0x7593('0x1b')]('[%s][index][agentconnect]',_0x31e5d9[_0x7593('0x20')]),_0x2cef65);}});ami['on'](_0x7593('0x23'),function(_0x1bbce8){try{utils['debug'](util['format'](_0x7593('0x24'),_0x1bbce8[_0x7593('0x20')]),_0x1bbce8);agents[_0x7593('0x23')](_0x1bbce8);queues[_0x7593('0x23')](_0x1bbce8);members['agentcomplete'](_0x1bbce8);}catch(_0x231832){utils['error'](util[_0x7593('0x1b')]('[%s][index][agentcomplete]',_0x1bbce8[_0x7593('0x20')]),_0x231832);}});ami['on']('queuecallerabandon',function(_0x3808dd){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x25'),_0x3808dd[_0x7593('0x20')]),_0x3808dd);agents[_0x7593('0x26')](_0x3808dd);queues[_0x7593('0x26')](_0x3808dd);}catch(_0x2f6ff7){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x25'),_0x3808dd[_0x7593('0x20')]),_0x2f6ff7);}});ami['on'](_0x7593('0x27'),function(_0x40f7fc){try{utils['debug'](util[_0x7593('0x1b')](_0x7593('0x28'),_0x40f7fc['uniqueid']),_0x40f7fc);queues[_0x7593('0x27')](_0x40f7fc);recordings[_0x7593('0x27')](_0x40f7fc);}catch(_0xe39399){utils['error'](util[_0x7593('0x1b')](_0x7593('0x28'),_0x40f7fc[_0x7593('0x20')]),_0xe39399);}});ami['on'](_0x7593('0x29'),function(_0x1acca2){try{utils['debug'](util[_0x7593('0x1b')]('[%s][index][queuecallerleave]',_0x1acca2[_0x7593('0x20')]),_0x1acca2);queues[_0x7593('0x29')](_0x1acca2);}catch(_0x188a77){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x2a'),_0x1acca2[_0x7593('0x20')]),_0x188a77);}});ami['on'](_0x7593('0x2b'),function(_0x296d98){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')]('[%s][index][musiconholdstart]',_0x296d98[_0x7593('0x20')]),_0x296d98);queues['musiconholdstart'](_0x296d98);calls[_0x7593('0x2b')](_0x296d98);}catch(_0xfeb609){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x2c'),_0x296d98[_0x7593('0x20')]),_0xfeb609);}});ami['on'](_0x7593('0x2d'),function(_0xfa700a){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x2e'),_0xfa700a[_0x7593('0x20')]),_0xfa700a);queues['musiconholdstop'](_0xfa700a);calls['musiconholdstop'](_0xfa700a);}catch(_0x23d6a8){utils[_0x7593('0x17')](util['format']('[%s][index][musiconholdstop]',_0xfa700a['uniqueid']),_0x23d6a8);}});ami['on'](_0x7593('0x2f'),function(_0x194985){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x30'),_0x194985[_0x7593('0x20')]),_0x194985);calls[_0x7593('0x2f')](_0x194985);recordings['newstate'](_0x194985);}catch(_0xdc6cc4){utils[_0x7593('0x17')](util[_0x7593('0x1b')]('[%s][index][newstate]',_0x194985[_0x7593('0x20')]),_0xdc6cc4);}});ami['on'](_0x7593('0x31'),function(_0x12ec9d){try{utils['debug'](util[_0x7593('0x1b')](_0x7593('0x32'),_0x12ec9d['uniqueid']),_0x12ec9d);calls[_0x7593('0x31')](_0x12ec9d);recordings['hangup'](_0x12ec9d);dials['hangup'](_0x12ec9d);agents[_0x7593('0x31')](_0x12ec9d);queues[_0x7593('0x31')](_0x12ec9d);}catch(_0x47f4dd){utils['error'](util[_0x7593('0x1b')](_0x7593('0x32'),_0x12ec9d['uniqueid']),_0x47f4dd);}});ami['on']('cdr',function(_0xd1173e){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')]('[%s][index][cdr]',_0xd1173e[_0x7593('0x20')]),_0xd1173e);members['cdr'](_0xd1173e);}catch(_0x19c8cd){utils[_0x7593('0x17')](util[_0x7593('0x1b')]('[%s][index][cdr]',_0xd1173e[_0x7593('0x20')]),_0x19c8cd);}});ami['on']('blindtransfer',function(_0x3b9fd2){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x33'),_0x3b9fd2[_0x7593('0x20')]),_0x3b9fd2);queues[_0x7593('0x34')](_0x3b9fd2);agents['blindtransfer'](_0x3b9fd2);transfers['blindtransfer'](_0x3b9fd2);}catch(_0x24f4d3){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x33'),_0x3b9fd2[_0x7593('0x20')]),_0x24f4d3);}});ami['on'](_0x7593('0x35'),function(_0xab16db){try{utils[_0x7593('0x1a')](util['format'](_0x7593('0x36'),_0xab16db['origtransfereruniqueid']),_0xab16db);queues[_0x7593('0x35')](_0xab16db);transfers[_0x7593('0x35')](_0xab16db);agents[_0x7593('0x35')](_0xab16db);calls[_0x7593('0x35')](_0xab16db);}catch(_0x512963){utils[_0x7593('0x17')](util['format'](_0x7593('0x36'),_0xab16db['origtransfereruniqueid']),_0x512963);}});ami['on']('varset',function(_0xb7e711){try{utils['debug'](util[_0x7593('0x1b')]('[%s][index][varset]',_0xb7e711[_0x7593('0x20')]),_0xb7e711);queues[_0x7593('0x37')](_0xb7e711);recordings[_0x7593('0x37')](_0xb7e711);calls[_0x7593('0x37')](_0xb7e711);dials['varset'](_0xb7e711);}catch(_0x45c85d){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x38'),_0xb7e711[_0x7593('0x20')]),_0x45c85d);}});ami['on'](_0x7593('0x39'),function(_0x4959e0){try{utils['debug'](util[_0x7593('0x1b')](_0x7593('0x3a'),_0x4959e0[_0x7593('0x20')]),_0x4959e0);calls[_0x7593('0x39')](_0x4959e0);recordings[_0x7593('0x39')](_0x4959e0);dials['newexten'](_0x4959e0);}catch(_0x45e877){utils['error'](util[_0x7593('0x1b')](_0x7593('0x3a'),_0x4959e0[_0x7593('0x20')]),_0x45e877);}});ami['on'](_0x7593('0x3b'),function(_0x4ab341){try{utils[_0x7593('0x1a')](util['format'](_0x7593('0x3c'),_0x4ab341[_0x7593('0x20')]),_0x4ab341);calls[_0x7593('0x3b')](_0x4ab341);recordings[_0x7593('0x3b')](_0x4ab341);}catch(_0xe0bc7a){utils[_0x7593('0x17')](util[_0x7593('0x1b')]('[%s][index][newchannel]',_0x4ab341[_0x7593('0x20')]),_0xe0bc7a);}});ami['on'](_0x7593('0x3d'),function(_0x2102e0){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x3e'),_0x2102e0[_0x7593('0x20')]),_0x2102e0);dials[_0x7593('0x3d')](_0x2102e0);}catch(_0x3da026){utils[_0x7593('0x17')](util[_0x7593('0x1b')](_0x7593('0x3f'),_0x2102e0[_0x7593('0x20')]),_0x3da026);}});ami['on']('dialend',function(_0xba1412){try{utils[_0x7593('0x1a')](util[_0x7593('0x1b')](_0x7593('0x40'),_0xba1412[_0x7593('0x20')]),_0xba1412);dials[_0x7593('0x41')](_0xba1412);}catch(_0x1ec2aa){utils[_0x7593('0x17')](util[_0x7593('0x1b')]('[%s][index][dialend]',_0xba1412[_0x7593('0x20')]),_0x1ec2aa);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index d1ab7d0..f188faf 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 _0x6a17=['now','agent','NOT_INUSE','exitAt','duration','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','cdr','debug','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','type','getUserByInterface','membername','name','internal','request','getUserByName','split','then','CreateMemberReport','catch','error','some','startsWith','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice'];(function(_0x3ad6c3,_0x2f99a7){var _0x4123b9=function(_0x1824ad){while(--_0x1824ad){_0x3ad6c3['push'](_0x3ad6c3['shift']());}};_0x4123b9(++_0x2f99a7);}(_0x6a17,0x1e8));var _0x76a1=function(_0x7d653b,_0x3f3341){_0x7d653b=_0x7d653b-0x0;var _0x3a30e7=_0x6a17[_0x7d653b];return _0x3a30e7;};'use strict';var _=require(_0x76a1('0x0'));var util=require(_0x76a1('0x1'));var utils=require(_0x76a1('0x2'));var members={};var exclude=[_0x76a1('0x3'),_0x76a1('0x4')];function writeDB(_0x171415){utils['info'](util[_0x76a1('0x5')](_0x76a1('0x6'),_0x171415[_0x76a1('0x7')],_0x171415[_0x76a1('0x8')],_0x171415[_0x76a1('0x9')],_0x171415[_0x76a1('0xa')],_0x171415['membername'],_0x171415[_0x76a1('0xb')]));if(_0x171415[_0x76a1('0x8')]){utils[_0x76a1('0xc')](_0x171415['interface'])['then'](function(_0x286f7e){if(_0x286f7e){_0x171415[_0x76a1('0xd')]=_0x286f7e[_0x76a1('0xe')];_0x171415[_0x76a1('0xf')]=_0x286f7e['internal'];utils[_0x76a1('0x10')]('CreateMemberReport',_0x171415);}else{utils[_0x76a1('0x11')](_0x171415[_0x76a1('0x8')][_0x76a1('0x12')]('/')[0x1])[_0x76a1('0x13')](function(_0x4e5fb2){if(_0x4e5fb2){_0x171415['membername']=_0x4e5fb2['name'];_0x171415['internal']=_0x4e5fb2['internal'];utils[_0x76a1('0x10')](_0x76a1('0x14'),_0x171415);}});}})[_0x76a1('0x15')](function(_0x3be788){utils[_0x76a1('0x16')](util[_0x76a1('0x5')]('[%s][members][writeDB]',_0x171415['uniqueid']),_0x3be788);});}delete members[_0x171415[_0x76a1('0x8')]];}function startsWith(_0x2885b0,_0x1942d3){return _[_0x76a1('0x17')](_0x2885b0,function(_0x36fd74){return _[_0x76a1('0x18')](_0x1942d3,_0x36fd74);});}exports['devicestatechange']=function(_0x3a243e){try{utils['debug'](util[_0x76a1('0x5')](_0x76a1('0x19'),members[_0x3a243e[_0x76a1('0x1a')]]?members[_0x3a243e['device']]['uniqueid']:_0x3a243e[_0x76a1('0x1a')]),_0x3a243e);utils[_0x76a1('0x1b')](util['format'](_0x76a1('0x1c'),members[_0x3a243e[_0x76a1('0x1a')]]?members[_0x3a243e[_0x76a1('0x1a')]]['uniqueid']:_0x3a243e[_0x76a1('0x1a')],_0x3a243e[_0x76a1('0x1d')],_0x3a243e[_0x76a1('0x1a')]));switch(_0x3a243e['state']){case _0x76a1('0x1e'):case'BUSY':if(!startsWith(exclude,_0x3a243e[_0x76a1('0x1a')])){members[_0x3a243e['device']]={'channel':_0x76a1('0x1f'),'interface':_0x3a243e[_0x76a1('0x1a')],'type':'TALKING','enterAt':utils[_0x76a1('0x20')](),'role':_0x76a1('0x21')};}break;case _0x76a1('0x22'):if(!_['isNil'](members[_0x3a243e[_0x76a1('0x1a')]])){members[_0x3a243e['device']][_0x76a1('0x23')]=utils[_0x76a1('0x20')]();members[_0x3a243e[_0x76a1('0x1a')]][_0x76a1('0x24')]=utils['diffTime'](members[_0x3a243e[_0x76a1('0x1a')]][_0x76a1('0x23')],members[_0x3a243e[_0x76a1('0x1a')]][_0x76a1('0x25')]);if(members[_0x3a243e[_0x76a1('0x1a')]][_0x76a1('0x7')]){writeDB(members[_0x3a243e[_0x76a1('0x1a')]]);}}break;default:break;}}catch(_0x1dff36){utils[_0x76a1('0x16')](util[_0x76a1('0x5')](_0x76a1('0x19'),members[_0x3a243e[_0x76a1('0x1a')]]?members[_0x3a243e['device']][_0x76a1('0x7')]:_0x3a243e[_0x76a1('0x1a')]),_0x1dff36);}};exports[_0x76a1('0x26')]=function(_0x2d4edd){try{if(!_[_0x76a1('0x27')](members[_0x2d4edd[_0x76a1('0x8')]])){utils['debug'](util[_0x76a1('0x5')](_0x76a1('0x28'),_0x2d4edd[_0x76a1('0x7')]),_0x2d4edd);utils[_0x76a1('0x1b')](util[_0x76a1('0x5')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x2d4edd[_0x76a1('0x7')],_0x2d4edd[_0x76a1('0x8')],_0x2d4edd[_0x76a1('0x29')]));members[_0x2d4edd[_0x76a1('0x8')]]=_[_0x76a1('0x2a')](members[_0x2d4edd[_0x76a1('0x8')]],{'data4':_0x2d4edd['queue'],'uniqueid':_0x2d4edd[_0x76a1('0x7')]});}}catch(_0x44b72c){utils['error'](util['format']('[%s][members][agentcomplete]',_0x2d4edd['uniqueid']),_0x44b72c);}};exports[_0x76a1('0x2b')]=function(_0x5330e5){try{utils[_0x76a1('0x2c')](util[_0x76a1('0x5')]('[%s][members][cdr]',_0x5330e5['uniqueid']),_0x5330e5);if(_0x5330e5[_0x76a1('0x9')]){var _0x35b6a4=_0x5330e5[_0x76a1('0x9')]['split']('-')[0x0];if(!_[_0x76a1('0x27')](members[_0x35b6a4])){members[_0x35b6a4]=_['assign'](members[_0x35b6a4],{'data1':members[_0x35b6a4]['data1']||_0x5330e5['type'],'data2':members[_0x35b6a4][_0x76a1('0xa')]||_0x5330e5[_0x76a1('0x2d')],'data3':members[_0x35b6a4][_0x76a1('0x2e')]||_0x5330e5[_0x76a1('0x2f')],'uniqueid':members[_0x35b6a4][_0x76a1('0x7')]||_0x5330e5[_0x76a1('0x7')]});utils['info'](util[_0x76a1('0x5')](_0x76a1('0x30'),_0x5330e5[_0x76a1('0x7')],members[_0x35b6a4][_0x76a1('0x31')],members[_0x35b6a4][_0x76a1('0xa')],members[_0x35b6a4]['data3']));if(members[_0x35b6a4][_0x76a1('0x23')]){writeDB(members[_0x35b6a4]);}}}if(_0x5330e5[_0x76a1('0x32')]){var _0x422efa=_0x5330e5['destinationchannel'][_0x76a1('0x12')]('-')[0x0];if(!_[_0x76a1('0x27')](members[_0x422efa])){members[_0x422efa]=_[_0x76a1('0x2a')](members[_0x422efa],{'data1':members[_0x422efa][_0x76a1('0x31')]||_0x5330e5[_0x76a1('0xb')],'data2':members[_0x422efa][_0x76a1('0xa')]||_0x5330e5['source'],'data3':members[_0x422efa][_0x76a1('0x2e')]||_0x5330e5[_0x76a1('0x2f')],'uniqueid':members[_0x422efa][_0x76a1('0x7')]||_0x5330e5[_0x76a1('0x7')]});utils[_0x76a1('0x1b')](util[_0x76a1('0x5')](_0x76a1('0x30'),_0x5330e5[_0x76a1('0x7')],members[_0x422efa][_0x76a1('0x31')],members[_0x422efa][_0x76a1('0xa')],members[_0x422efa][_0x76a1('0x2e')]));if(members[_0x422efa][_0x76a1('0x23')]){writeDB(members[_0x422efa]);}}}}catch(_0x5e9e72){utils[_0x76a1('0x16')](util[_0x76a1('0x5')](_0x76a1('0x33'),_0x5330e5['uniqueid']),_0x5e9e72);}}; \ No newline at end of file +var _0x05c6=['catch','uniqueid','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','TALKING','agent','exitAt','now','diffTime','error','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','cdr','split','assign','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','[%s][members][cdr]','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','then','name','internal','request','getUserByName','CreateMemberReport'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x05c6,0x125));var _0x605c=function(_0x529e17,_0x47f3e5){_0x529e17=_0x529e17-0x0;var _0x45c535=_0x05c6[_0x529e17];return _0x45c535;};'use strict';var _=require(_0x605c('0x0'));var util=require(_0x605c('0x1'));var utils=require(_0x605c('0x2'));var members={};var exclude=[_0x605c('0x3'),_0x605c('0x4')];function writeDB(_0xca2a45){utils[_0x605c('0x5')](util[_0x605c('0x6')](_0x605c('0x7'),_0xca2a45['uniqueid'],_0xca2a45['interface'],_0xca2a45[_0x605c('0x8')],_0xca2a45['data2'],_0xca2a45[_0x605c('0x9')],_0xca2a45[_0x605c('0xa')]));if(_0xca2a45[_0x605c('0xb')]){utils[_0x605c('0xc')](_0xca2a45[_0x605c('0xb')])[_0x605c('0xd')](function(_0x3db01d){if(_0x3db01d){_0xca2a45[_0x605c('0x9')]=_0x3db01d[_0x605c('0xe')];_0xca2a45[_0x605c('0xf')]=_0x3db01d[_0x605c('0xf')];utils[_0x605c('0x10')]('CreateMemberReport',_0xca2a45);}else{utils[_0x605c('0x11')](_0xca2a45[_0x605c('0xb')]['split']('/')[0x1])[_0x605c('0xd')](function(_0x5c1729){if(_0x5c1729){_0xca2a45['membername']=_0x5c1729[_0x605c('0xe')];_0xca2a45[_0x605c('0xf')]=_0x5c1729['internal'];utils[_0x605c('0x10')](_0x605c('0x12'),_0xca2a45);}});}})[_0x605c('0x13')](function(_0x450bc0){utils['error'](util[_0x605c('0x6')]('[%s][members][writeDB]',_0xca2a45[_0x605c('0x14')]),_0x450bc0);});}delete members[_0xca2a45['interface']];}function startsWith(_0x5e4b3c,_0x1659e2){return _['some'](_0x5e4b3c,function(_0x183dbd){return _[_0x605c('0x15')](_0x1659e2,_0x183dbd);});}exports['devicestatechange']=function(_0xf8acc7){try{utils['debug'](util[_0x605c('0x6')](_0x605c('0x16'),members[_0xf8acc7[_0x605c('0x17')]]?members[_0xf8acc7[_0x605c('0x17')]]['uniqueid']:_0xf8acc7[_0x605c('0x17')]),_0xf8acc7);utils['info'](util[_0x605c('0x6')](_0x605c('0x18'),members[_0xf8acc7[_0x605c('0x17')]]?members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]:_0xf8acc7['device'],_0xf8acc7[_0x605c('0x19')],_0xf8acc7[_0x605c('0x17')]));switch(_0xf8acc7[_0x605c('0x19')]){case _0x605c('0x1a'):case _0x605c('0x1b'):if(!startsWith(exclude,_0xf8acc7['device'])){members[_0xf8acc7['device']]={'channel':_0x605c('0x1c'),'interface':_0xf8acc7[_0x605c('0x17')],'type':_0x605c('0x1d'),'enterAt':utils['now'](),'role':_0x605c('0x1e')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0xf8acc7[_0x605c('0x17')]])){members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x1f')]=utils[_0x605c('0x20')]();members[_0xf8acc7[_0x605c('0x17')]]['duration']=utils[_0x605c('0x21')](members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x1f')],members[_0xf8acc7['device']]['enterAt']);if(members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]){writeDB(members[_0xf8acc7[_0x605c('0x17')]]);}}break;default:break;}}catch(_0x9c996b){utils[_0x605c('0x22')](util[_0x605c('0x6')](_0x605c('0x16'),members[_0xf8acc7['device']]?members[_0xf8acc7[_0x605c('0x17')]][_0x605c('0x14')]:_0xf8acc7[_0x605c('0x17')]),_0x9c996b);}};exports[_0x605c('0x23')]=function(_0xf2197){try{if(!_[_0x605c('0x24')](members[_0xf2197[_0x605c('0xb')]])){utils[_0x605c('0x25')](util[_0x605c('0x6')](_0x605c('0x26'),_0xf2197['uniqueid']),_0xf2197);utils['info'](util[_0x605c('0x6')](_0x605c('0x27'),_0xf2197[_0x605c('0x14')],_0xf2197[_0x605c('0xb')],_0xf2197[_0x605c('0x28')]));members[_0xf2197['interface']]=_['assign'](members[_0xf2197[_0x605c('0xb')]],{'data4':_0xf2197[_0x605c('0x28')],'uniqueid':_0xf2197[_0x605c('0x14')]});}}catch(_0x510746){utils[_0x605c('0x22')](util[_0x605c('0x6')]('[%s][members][agentcomplete]',_0xf2197[_0x605c('0x14')]),_0x510746);}};exports[_0x605c('0x29')]=function(_0x447b5a){try{utils['debug'](util[_0x605c('0x6')]('[%s][members][cdr]',_0x447b5a[_0x605c('0x14')]),_0x447b5a);if(_0x447b5a[_0x605c('0x8')]){var _0x107fb7=_0x447b5a[_0x605c('0x8')][_0x605c('0x2a')]('-')[0x0];if(!_[_0x605c('0x24')](members[_0x107fb7])){members[_0x107fb7]=_[_0x605c('0x2b')](members[_0x107fb7],{'data1':members[_0x107fb7]['data1']||_0x447b5a[_0x605c('0xa')],'data2':members[_0x107fb7][_0x605c('0x2c')]||_0x447b5a[_0x605c('0x2d')],'data3':members[_0x107fb7][_0x605c('0x2e')]||_0x447b5a[_0x605c('0x2f')],'uniqueid':members[_0x107fb7][_0x605c('0x14')]||_0x447b5a[_0x605c('0x14')]});utils[_0x605c('0x5')](util['format'](_0x605c('0x30'),_0x447b5a[_0x605c('0x14')],members[_0x107fb7][_0x605c('0x31')],members[_0x107fb7][_0x605c('0x2c')],members[_0x107fb7][_0x605c('0x2e')]));if(members[_0x107fb7][_0x605c('0x1f')]){writeDB(members[_0x107fb7]);}}}if(_0x447b5a[_0x605c('0x32')]){var _0x1671dd=_0x447b5a['destinationchannel'][_0x605c('0x2a')]('-')[0x0];if(!_[_0x605c('0x24')](members[_0x1671dd])){members[_0x1671dd]=_[_0x605c('0x2b')](members[_0x1671dd],{'data1':members[_0x1671dd][_0x605c('0x31')]||_0x447b5a['type'],'data2':members[_0x1671dd][_0x605c('0x2c')]||_0x447b5a[_0x605c('0x2d')],'data3':members[_0x1671dd]['data3']||_0x447b5a[_0x605c('0x2f')],'uniqueid':members[_0x1671dd]['uniqueid']||_0x447b5a['uniqueid']});utils[_0x605c('0x5')](util[_0x605c('0x6')](_0x605c('0x30'),_0x447b5a[_0x605c('0x14')],members[_0x1671dd][_0x605c('0x31')],members[_0x1671dd][_0x605c('0x2c')],members[_0x1671dd][_0x605c('0x2e')]));if(members[_0x1671dd]['exitAt']){writeDB(members[_0x1671dd]);}}}}catch(_0x1774dc){utils['error'](util['format'](_0x605c('0x33'),_0x447b5a[_0x605c('0x14')]),_0x1774dc);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 6a27887..d0c03bb 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 _0x2201=['[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][queuecallerabandon]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','diffTime','count','connectedlinenum','connectedlinename','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','calleridnum','accountcode','getVoiceQueueByName','then','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','position','assign','error','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0x2201,0x1dc));var _0x1220=function(_0x2273cf,_0x55c58e){_0x2273cf=_0x2273cf-0x0;var _0x5ebfc2=_0x2201[_0x2273cf];return _0x5ebfc2;};'use strict';var _=require(_0x1220('0x0'));var util=require(_0x1220('0x1'));var utils=require(_0x1220('0x2'));var queues={};function writeDB(_0x1b65bf){utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x5'),_0x1b65bf[_0x1220('0x6')],_0x1b65bf[_0x1220('0x7')],_0x1b65bf[_0x1220('0x8')],_0x1b65bf['lastAssignedTo'],_0x1b65bf[_0x1220('0x9')],_0x1b65bf[_0x1220('0xa')],_0x1b65bf['queuecallerexitreason']));if(_0x1b65bf[_0x1220('0x8')]){utils[_0x1220('0xb')](_0x1b65bf[_0x1220('0x8')])[_0x1220('0xc')](function(_0x26bbb5){if(_0x26bbb5){_0x1b65bf[_0x1220('0xd')]=_0x26bbb5[_0x1220('0xd')];}utils['request'](_0x1220('0xe'),_0x1b65bf);});}else{utils['request']('CreateVoiceQueueReport',_0x1b65bf);}if(_0x1b65bf['transfereduniqueid']){delete queues[_0x1b65bf[_0x1220('0xf')]];}else{delete queues[_0x1b65bf[_0x1220('0x6')]];}}exports[_0x1220('0x10')]=function(_0x1660f4){try{utils['debug'](util[_0x1220('0x4')](_0x1220('0x11'),_0x1660f4['uniqueid']),_0x1660f4);utils[_0x1220('0x3')](util['format']('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x1660f4[_0x1220('0x6')],_0x1660f4[_0x1220('0x8')],_0x1660f4[_0x1220('0x12')]));queues[_0x1660f4['uniqueid']]=_[_0x1220('0x13')](_0x1660f4,{'originalposition':_0x1660f4[_0x1220('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x5cdf6c){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x11'),_0x1660f4[_0x1220('0x6')]),_0x5cdf6c);}};exports['hangup']=function(_0x577abf){try{if(!_[_0x1220('0x15')](queues[_0x577abf[_0x1220('0x6')]])){utils[_0x1220('0x16')](util['format'](_0x1220('0x17'),_0x577abf['uniqueid']),_0x577abf);if(queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x18')]){if(!queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x19')]&&!queues[_0x577abf['uniqueid']][_0x1220('0x1a')]){queues[_0x577abf[_0x1220('0x6')]]['queuecallercomplete']=!![];queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x1b')]=utils[_0x1220('0x1c')]();queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x1d')]='COMPLETEDBYAGENT';}utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x1e'),_0x577abf[_0x1220('0x6')],queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x1f')],queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x1d')]));writeDB(queues[_0x577abf[_0x1220('0x6')]]);}else if(queues[_0x577abf[_0x1220('0x6')]]['transfereduniqueid']){utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x20'),_0x577abf['uniqueid'],queues[_0x577abf[_0x1220('0x6')]][_0x1220('0x1f')],queues[_0x577abf['uniqueid']][_0x1220('0xf')]));queues[queues[_0x577abf['uniqueid']][_0x1220('0xf')]]=queues[_0x577abf['uniqueid']];queues[queues[_0x577abf[_0x1220('0x6')]][_0x1220('0xf')]][_0x1220('0x21')]=0x2;delete queues[_0x577abf['uniqueid']];}}}catch(_0x506dde){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x17'),_0x577abf[_0x1220('0x6')]),_0x506dde);}};exports['varset']=function(_0x4133d3){try{utils[_0x1220('0x16')](util['format'](_0x1220('0x22'),_0x4133d3[_0x1220('0x6')]),_0x4133d3);if(!_['isNil'](_0x4133d3[_0x1220('0x23')][_0x1220('0x24')])&&_0x4133d3[_0x1220('0x25')]['toUpperCase']()!==_0x1220('0x26')){if(!_['isNil'](queues[_0x4133d3[_0x1220('0x6')]])){queues[_0x4133d3[_0x1220('0x6')]]['queuecallerabandon']=![];queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x27')]=null;queues[_0x4133d3['uniqueid']][_0x1220('0x1a')]=!![];queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x28')]=utils[_0x1220('0x1c')]();queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x1d')]=_0x4133d3[_0x1220('0x25')]['toUpperCase']();utils['info'](util[_0x1220('0x4')](_0x1220('0x29'),_0x4133d3[_0x1220('0x6')],queues[_0x4133d3['uniqueid']][_0x1220('0x1f')],_0x4133d3[_0x1220('0x25')],queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x1d')]));writeDB(queues[_0x4133d3['uniqueid']]);}}else if(!_[_0x1220('0x15')](_0x4133d3[_0x1220('0x23')][_0x1220('0x2a')])){if(!_['isNil'](queues[_0x4133d3[_0x1220('0x6')]])&&!queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x19')]){queues[_0x4133d3[_0x1220('0x6')]]['queuecallerabandon']=![];queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x27')]=null;queues[_0x4133d3['uniqueid']][_0x1220('0x1a')]=!![];queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x28')]=utils[_0x1220('0x1c')]();queues[_0x4133d3[_0x1220('0x6')]][_0x1220('0x1d')]=_0x1220('0x2b');utils[_0x1220('0x3')](util[_0x1220('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x4133d3[_0x1220('0x6')],queues[_0x4133d3[_0x1220('0x6')]]['name'],_0x4133d3[_0x1220('0x25')],queues[_0x4133d3[_0x1220('0x6')]]['queuecallerexitreason']));}}}catch(_0xda0554){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x22'),_0x4133d3[_0x1220('0x6')]),_0xda0554);}};exports['queuecallerabandon']=function(_0x30e350){try{if(!_[_0x1220('0x15')](queues[_0x30e350['uniqueid']])){utils[_0x1220('0x16')](util[_0x1220('0x4')](_0x1220('0x2c'),_0x30e350[_0x1220('0x6')]),_0x30e350);queues[_0x30e350[_0x1220('0x6')]][_0x1220('0x1a')]=![];queues[_0x30e350['uniqueid']][_0x1220('0x28')]=null;queues[_0x30e350['uniqueid']]['queuecallerabandon']=!![];queues[_0x30e350[_0x1220('0x6')]]['queuecallerabandonAt']=utils[_0x1220('0x1c')]();queues[_0x30e350[_0x1220('0x6')]][_0x1220('0x1d')]='ABANDONED';utils[_0x1220('0x3')](util['format'](_0x1220('0x2d'),_0x30e350['uniqueid'],queues[_0x30e350['uniqueid']][_0x1220('0x1f')],queues[_0x30e350[_0x1220('0x6')]][_0x1220('0x1d')]));}}catch(_0x57adf3){utils[_0x1220('0x14')](util['format'](_0x1220('0x2c'),_0x30e350[_0x1220('0x6')]),_0x57adf3);}};exports[_0x1220('0x2e')]=function(_0x338ed0){try{if(!_[_0x1220('0x15')](queues[_0x338ed0[_0x1220('0x6')]])){utils[_0x1220('0x16')](util[_0x1220('0x4')]('[%s][queues][queuecallerleave]',_0x338ed0[_0x1220('0x6')]),_0x338ed0);utils['info'](util[_0x1220('0x4')](_0x1220('0x2f'),_0x338ed0[_0x1220('0x6')],queues[_0x338ed0[_0x1220('0x6')]][_0x1220('0x1f')],_0x338ed0['connectedlinenum'],_0x338ed0['connectedlinename']));queues[_0x338ed0[_0x1220('0x6')]]['queuecallerleave']=!![];queues[_0x338ed0['uniqueid']][_0x1220('0x18')]=utils['now']();queues[_0x338ed0[_0x1220('0x6')]]['holdtime']=utils[_0x1220('0x30')](queues[_0x338ed0['uniqueid']][_0x1220('0x18')],queues[_0x338ed0[_0x1220('0x6')]]['queuecallerjoinAt']);queues[_0x338ed0[_0x1220('0x6')]]['position']=_0x338ed0[_0x1220('0x12')];queues[_0x338ed0[_0x1220('0x6')]]['count']=_0x338ed0[_0x1220('0x31')];queues[_0x338ed0['uniqueid']][_0x1220('0x32')]=_0x338ed0[_0x1220('0x32')];queues[_0x338ed0[_0x1220('0x6')]][_0x1220('0x33')]=_0x338ed0['connectedlinename'];}}catch(_0x214db5){utils[_0x1220('0x14')](util[_0x1220('0x4')]('[%s][queues][queuecallerleave]',_0x338ed0['uniqueid']),_0x214db5);}};exports[_0x1220('0x34')]=function(_0x2a4012){try{if(!_[_0x1220('0x15')](queues[_0x2a4012['uniqueid']])){utils[_0x1220('0x16')](util[_0x1220('0x4')](_0x1220('0x35'),_0x2a4012[_0x1220('0x6')]),_0x2a4012);utils[_0x1220('0x3')](util['format'](_0x1220('0x36'),_0x2a4012['uniqueid'],queues[_0x2a4012[_0x1220('0x6')]]['name'],_0x2a4012[_0x1220('0x37')],_0x2a4012[_0x1220('0x38')]));queues[_0x2a4012[_0x1220('0x6')]]['queuecallerabandon']=![];queues[_0x2a4012[_0x1220('0x6')]][_0x1220('0x19')]=![];queues[_0x2a4012['uniqueid']][_0x1220('0x27')]=null;queues[_0x2a4012[_0x1220('0x6')]][_0x1220('0x1a')]=![];queues[_0x2a4012[_0x1220('0x6')]][_0x1220('0x1d')]=null;queues[_0x2a4012[_0x1220('0x6')]][_0x1220('0x28')]=null;queues[_0x2a4012[_0x1220('0x6')]]['assigned']=!![];queues[_0x2a4012['uniqueid']]['accountcode']=_0x2a4012[_0x1220('0x38')];queues[_0x2a4012[_0x1220('0x6')]][_0x1220('0x39')]=_0x2a4012['membername'];}}catch(_0x4f9402){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x35'),_0x2a4012[_0x1220('0x6')]),_0x4f9402);}};exports[_0x1220('0x3a')]=function(_0x6e3a98){try{if(!_[_0x1220('0x15')](queues[_0x6e3a98[_0x1220('0x6')]])){if(queues[_0x6e3a98['uniqueid']][_0x1220('0x18')]){utils[_0x1220('0x16')](util[_0x1220('0x4')](_0x1220('0x3b'),_0x6e3a98['uniqueid']),_0x6e3a98);queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x19')]=![];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x19')]=![];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x27')]=null;queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x1a')]=![];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x28')]=null;queues[_0x6e3a98['uniqueid']]['assigned']=!![];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x39')]=_0x6e3a98[_0x1220('0x37')];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x3c')]=!![];queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x1b')]=utils[_0x1220('0x1c')]();if(_0x6e3a98[_0x1220('0x3d')]==_0x1220('0x3e')){if(!queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x3e')]){queues[_0x6e3a98['uniqueid']][_0x1220('0x1d')]=_0x1220('0x3f');}}else{queues[_0x6e3a98[_0x1220('0x6')]][_0x1220('0x1d')]=_0x1220('0x40')+_0x6e3a98[_0x1220('0x3d')][_0x1220('0x41')]();}utils[_0x1220('0x3')](util['format'](_0x1220('0x42'),_0x6e3a98['uniqueid'],queues[_0x6e3a98['uniqueid']][_0x1220('0x1f')],_0x6e3a98['membername'],queues[_0x6e3a98[_0x1220('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x6e3a98[_0x1220('0x6')]]);}}}catch(_0x1f8883){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x3b'),_0x6e3a98[_0x1220('0x6')]),_0x1f8883);}};exports[_0x1220('0x43')]=function(_0xb9df3f){try{if(!_[_0x1220('0x15')](queues[_0xb9df3f[_0x1220('0x44')]])){utils['debug'](util[_0x1220('0x4')](_0x1220('0x45'),_0xb9df3f[_0x1220('0x6')]),_0xb9df3f);queues[_0xb9df3f[_0x1220('0x44')]][_0x1220('0x3e')]=!![];queues[_0xb9df3f[_0x1220('0x44')]][_0x1220('0x46')]=_0x1220('0x47');queues[_0xb9df3f[_0x1220('0x44')]][_0x1220('0x48')]=_0xb9df3f[_0x1220('0x49')];queues[_0xb9df3f[_0x1220('0x44')]]['transferuniqueid']=_0xb9df3f[_0x1220('0x44')];queues[_0xb9df3f[_0x1220('0x44')]][_0x1220('0x1d')]=_0x1220('0x4a');utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x4b'),_0xb9df3f[_0x1220('0x6')],queues[_0xb9df3f['transfereeuniqueid']][_0x1220('0x1f')],_0xb9df3f[_0x1220('0x44')],_0xb9df3f[_0x1220('0x49')]));}}catch(_0x5ddbfe){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x45'),_0xb9df3f['uniqueid']),_0x5ddbfe);}};exports['attendedtransfer']=function(_0x384372){try{utils[_0x1220('0x16')](util['format']('[%s][queues][attendedtransfer]',_0x384372[_0x1220('0x4c')]),_0x384372);if(_0x384372[_0x1220('0x4c')]==_0x384372[_0x1220('0x4d')]){if(!_[_0x1220('0x15')](queues[_0x384372[_0x1220('0x4e')]])){utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x4f'),_0x384372[_0x1220('0x4c')],queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x1f')],_0x384372['origtransfererexten']));queues[_0x384372[_0x1220('0x4e')]]['transfer']=!![];queues[_0x384372[_0x1220('0x4e')]]['transfertype']=_0x1220('0x50');queues[_0x384372[_0x1220('0x4e')]]['transferexten']=_0x384372['origtransfererexten'];queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x51')]=_0x384372[_0x1220('0x4c')];queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x1d')]=_0x1220('0x52');}if(!_[_0x1220('0x15')](queues[_0x384372['origtransfererlinkedid']])){if(_0x384372[_0x1220('0x53')]&&queues[_0x384372[_0x1220('0x53')]]){queues[_0x384372[_0x1220('0x53')]]['queuecallerenterreason']=0x1;queues[_0x384372[_0x1220('0x44')]]=_[_0x1220('0x54')](queues[_0x384372[_0x1220('0x53')]]);queues[_0x384372['transfereeuniqueid']][_0x1220('0xf')]=_0x384372[_0x1220('0x55')];queues[_0x384372[_0x1220('0x44')]][_0x1220('0x21')]=0x2;queues[_0x384372[_0x1220('0x44')]][_0x1220('0x9')]=queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x9')];queues[_0x384372['transfereeuniqueid']][_0x1220('0x56')]=queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x56')];queues[_0x384372[_0x1220('0x44')]][_0x1220('0x57')]=utils[_0x1220('0x1c')]();queues[_0x384372[_0x1220('0x44')]][_0x1220('0x18')]=utils[_0x1220('0x1c')]();queues[_0x384372[_0x1220('0x44')]]['holdtime']=0x0;queues[_0x384372[_0x1220('0x44')]][_0x1220('0x58')]=0x0;utils['info'](util[_0x1220('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x384372[_0x1220('0x4c')],queues[_0x384372[_0x1220('0x44')]][_0x1220('0x1f')],queues[_0x384372[_0x1220('0x44')]][_0x1220('0x9')],queues[_0x384372['transfereeuniqueid']]['calleridname']));}else{utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x59'),_0x384372[_0x1220('0x4c')],queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x1f')],_0x384372[_0x1220('0x4e')]));queues[_0x384372[_0x1220('0x4d')]][_0x1220('0xf')]=_0x384372[_0x1220('0x4e')];}}}else if(_0x384372[_0x1220('0x5a')]==_0x384372[_0x1220('0x4e')]){if(!_[_0x1220('0x15')](queues[_0x384372[_0x1220('0x4d')]])){utils[_0x1220('0x3')](util[_0x1220('0x4')](_0x1220('0x5b'),_0x384372['origtransfereruniqueid'],queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x1f')],_0x384372[_0x1220('0x5a')],_0x384372[_0x1220('0x5c')]));queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x3e')]=!![];queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x46')]=_0x1220('0x50');queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x48')]=_0x384372[_0x1220('0x5c')];queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x51')]=_0x384372[_0x1220('0x5a')];queues[_0x384372['origtransfererlinkedid']][_0x1220('0x1d')]=_0x1220('0x52');}if(!_['isNil'](queues[_0x384372[_0x1220('0x4e')]])){if(_0x384372[_0x1220('0x5d')]&&queues[_0x384372[_0x1220('0x5d')]]){queues[_0x384372[_0x1220('0x5d')]][_0x1220('0x21')]=0x1;queues[_0x384372[_0x1220('0x55')]]=_[_0x1220('0x54')](queues[_0x384372['transfertargetlinkedid']]);queues[_0x384372[_0x1220('0x55')]][_0x1220('0xf')]=_0x384372[_0x1220('0x55')];queues[_0x384372[_0x1220('0x55')]][_0x1220('0x21')]=0x2;queues[_0x384372['transfertargetuniqueid']]['calleridnum']=queues[_0x384372[_0x1220('0x4d')]][_0x1220('0x9')];queues[_0x384372[_0x1220('0x55')]][_0x1220('0x56')]=queues[_0x384372[_0x1220('0x4d')]]['calleridname'];queues[_0x384372[_0x1220('0x55')]][_0x1220('0x57')]=utils['now']();queues[_0x384372[_0x1220('0x55')]]['queuecallerleaveAt']=utils[_0x1220('0x1c')]();queues[_0x384372[_0x1220('0x55')]][_0x1220('0x5e')]=0x0;queues[_0x384372['transfertargetuniqueid']][_0x1220('0x58')]=0x0;utils['info'](util[_0x1220('0x4')](_0x1220('0x5f'),_0x384372[_0x1220('0x4c')],queues[_0x384372[_0x1220('0x55')]][_0x1220('0x1f')],queues[_0x384372['transfertargetuniqueid']][_0x1220('0xf')],queues[_0x384372[_0x1220('0x55')]]['calleridnum'],queues[_0x384372[_0x1220('0x55')]]['calleridname']));}else{utils[_0x1220('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x384372[_0x1220('0x4c')],queues[_0x384372[_0x1220('0x4e')]][_0x1220('0x1f')],_0x384372['origtransfererlinkedid']));queues[_0x384372[_0x1220('0x4e')]][_0x1220('0xf')]=_0x384372[_0x1220('0x4d')];}}}}catch(_0x25f096){utils[_0x1220('0x14')](util[_0x1220('0x4')](_0x1220('0x60'),_0x384372[_0x1220('0x4c')]),_0x25f096);}};exports[_0x1220('0x61')]=function(_0x3c5453){try{if(!_[_0x1220('0x15')](queues[_0x3c5453['uniqueid']])){utils[_0x1220('0x16')](util[_0x1220('0x4')]('[%s][queues][musiconholdstart]',_0x3c5453[_0x1220('0x6')]),_0x3c5453);queues[_0x3c5453[_0x1220('0x6')]][_0x1220('0x62')]=utils[_0x1220('0x1c')]();utils[_0x1220('0x3')](util[_0x1220('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3c5453[_0x1220('0x6')],queues[_0x3c5453[_0x1220('0x6')]][_0x1220('0x1f')],queues[_0x3c5453[_0x1220('0x6')]][_0x1220('0x62')]));}}catch(_0xea43e7){utils['error'](util['format'](_0x1220('0x63'),_0x3c5453[_0x1220('0x6')]),_0xea43e7);}};exports[_0x1220('0x64')]=function(_0x356b79){try{if(!_['isNil'](queues[_0x356b79['uniqueid']])){if(!_[_0x1220('0x15')](queues[_0x356b79['uniqueid']][_0x1220('0x62')])){utils[_0x1220('0x16')](util[_0x1220('0x4')]('[%s][queues][musiconholdstop]',_0x356b79['uniqueid']),_0x356b79);queues[_0x356b79['uniqueid']]['mohtime']+=utils[_0x1220('0x30')](utils[_0x1220('0x1c')](),queues[_0x356b79[_0x1220('0x6')]][_0x1220('0x62')]);utils[_0x1220('0x3')](util[_0x1220('0x4')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x356b79['uniqueid'],queues[_0x356b79[_0x1220('0x6')]][_0x1220('0x1f')],queues[_0x356b79[_0x1220('0x6')]][_0x1220('0x58')]));delete queues[_0x356b79[_0x1220('0x6')]][_0x1220('0x62')];}}}catch(_0x46743e){utils[_0x1220('0x14')](util['format'](_0x1220('0x65'),_0x356b79['uniqueid']),_0x46743e);}}; \ No newline at end of file +var _0x34a8=['destaccountcode','assigned','lastAssignedTo','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','transfertype','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridnum','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','accountcode','queue','getVoiceQueueByName','then','type','CreateVoiceQueueReport','request','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','hangup','isNil','debug','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','now','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','[%s][queues][hangup]','varset','variable','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','name','error','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x34a8,0x9b));var _0x834a=function(_0x5864ef,_0x496812){_0x5864ef=_0x5864ef-0x0;var _0x21c244=_0x34a8[_0x5864ef];return _0x21c244;};'use strict';var _=require(_0x834a('0x0'));var util=require(_0x834a('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x2348a2){utils['info'](util[_0x834a('0x2')](_0x834a('0x3'),_0x2348a2['uniqueid'],_0x2348a2[_0x834a('0x4')],_0x2348a2['queue'],_0x2348a2['lastAssignedTo'],_0x2348a2['calleridnum'],_0x2348a2[_0x834a('0x5')],_0x2348a2['queuecallerexitreason']));if(_0x2348a2[_0x834a('0x6')]){utils[_0x834a('0x7')](_0x2348a2[_0x834a('0x6')])[_0x834a('0x8')](function(_0x3a1c8e){if(_0x3a1c8e){_0x2348a2[_0x834a('0x9')]=_0x3a1c8e['type'];}utils['request'](_0x834a('0xa'),_0x2348a2);});}else{utils[_0x834a('0xb')](_0x834a('0xa'),_0x2348a2);}if(_0x2348a2['transfereduniqueid']){delete queues[_0x2348a2[_0x834a('0xc')]];}else{delete queues[_0x2348a2[_0x834a('0xd')]];}}exports[_0x834a('0xe')]=function(_0x5ab188){try{utils['debug'](util[_0x834a('0x2')](_0x834a('0xf'),_0x5ab188[_0x834a('0xd')]),_0x5ab188);utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x11'),_0x5ab188['uniqueid'],_0x5ab188['queue'],_0x5ab188[_0x834a('0x12')]));queues[_0x5ab188['uniqueid']]=_[_0x834a('0x13')](_0x5ab188,{'originalposition':_0x5ab188[_0x834a('0x12')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x353312){utils['error'](util[_0x834a('0x2')](_0x834a('0xf'),_0x5ab188[_0x834a('0xd')]),_0x353312);}};exports[_0x834a('0x14')]=function(_0x3c085c){try{if(!_[_0x834a('0x15')](queues[_0x3c085c[_0x834a('0xd')]])){utils[_0x834a('0x16')](util[_0x834a('0x2')]('[%s][queues][hangup]',_0x3c085c[_0x834a('0xd')]),_0x3c085c);if(queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0x17')]){if(!queues[_0x3c085c['uniqueid']][_0x834a('0x18')]&&!queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0x19')]){queues[_0x3c085c[_0x834a('0xd')]]['queuecallercomplete']=!![];queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0x1a')]=utils[_0x834a('0x1b')]();queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0x1c')]='COMPLETEDBYAGENT';}utils['info'](util[_0x834a('0x2')](_0x834a('0x1d'),_0x3c085c[_0x834a('0xd')],queues[_0x3c085c['uniqueid']]['name'],queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0x1c')]));writeDB(queues[_0x3c085c['uniqueid']]);}else if(queues[_0x3c085c[_0x834a('0xd')]]['transfereduniqueid']){utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x1e'),_0x3c085c['uniqueid'],queues[_0x3c085c[_0x834a('0xd')]]['name'],queues[_0x3c085c['uniqueid']]['transfereduniqueid']));queues[queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0xc')]]=queues[_0x3c085c[_0x834a('0xd')]];queues[queues[_0x3c085c[_0x834a('0xd')]][_0x834a('0xc')]][_0x834a('0x1f')]=0x2;delete queues[_0x3c085c[_0x834a('0xd')]];}}}catch(_0x5573fe){utils['error'](util[_0x834a('0x2')](_0x834a('0x20'),_0x3c085c[_0x834a('0xd')]),_0x5573fe);}};exports[_0x834a('0x21')]=function(_0x24e4fb){try{utils[_0x834a('0x16')](util['format']('[%s][queues][varset]',_0x24e4fb[_0x834a('0xd')]),_0x24e4fb);if(!_[_0x834a('0x15')](_0x24e4fb[_0x834a('0x22')]['queuestatus'])&&_0x24e4fb[_0x834a('0x23')][_0x834a('0x24')]()!==_0x834a('0x25')){if(!_['isNil'](queues[_0x24e4fb[_0x834a('0xd')]])){queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x18')]=![];queues[_0x24e4fb[_0x834a('0xd')]]['queuecallerabandonAt']=null;queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x19')]=!![];queues[_0x24e4fb[_0x834a('0xd')]]['queuecallerexitAt']=utils[_0x834a('0x1b')]();queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x1c')]=_0x24e4fb[_0x834a('0x23')]['toUpperCase']();utils['info'](util[_0x834a('0x2')](_0x834a('0x26'),_0x24e4fb['uniqueid'],queues[_0x24e4fb['uniqueid']]['name'],_0x24e4fb[_0x834a('0x23')],queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x1c')]));writeDB(queues[_0x24e4fb[_0x834a('0xd')]]);}}else if(!_[_0x834a('0x15')](_0x24e4fb[_0x834a('0x22')][_0x834a('0x27')])){if(!_[_0x834a('0x15')](queues[_0x24e4fb[_0x834a('0xd')]])&&!queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x18')]){queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x18')]=![];queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x28')]=null;queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x19')]=!![];queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x29')]=utils[_0x834a('0x1b')]();queues[_0x24e4fb['uniqueid']]['queuecallerexitreason']=_0x834a('0x2a');utils[_0x834a('0x10')](util['format'](_0x834a('0x2b'),_0x24e4fb[_0x834a('0xd')],queues[_0x24e4fb[_0x834a('0xd')]][_0x834a('0x2c')],_0x24e4fb[_0x834a('0x23')],queues[_0x24e4fb[_0x834a('0xd')]]['queuecallerexitreason']));}}}catch(_0xc258d9){utils[_0x834a('0x2d')](util[_0x834a('0x2')](_0x834a('0x2e'),_0x24e4fb[_0x834a('0xd')]),_0xc258d9);}};exports[_0x834a('0x18')]=function(_0x5b0cde){try{if(!_[_0x834a('0x15')](queues[_0x5b0cde['uniqueid']])){utils[_0x834a('0x16')](util[_0x834a('0x2')]('[%s][queues][queuecallerabandon]',_0x5b0cde['uniqueid']),_0x5b0cde);queues[_0x5b0cde[_0x834a('0xd')]][_0x834a('0x19')]=![];queues[_0x5b0cde[_0x834a('0xd')]][_0x834a('0x29')]=null;queues[_0x5b0cde[_0x834a('0xd')]][_0x834a('0x18')]=!![];queues[_0x5b0cde[_0x834a('0xd')]][_0x834a('0x28')]=utils['now']();queues[_0x5b0cde[_0x834a('0xd')]][_0x834a('0x1c')]=_0x834a('0x2f');utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x30'),_0x5b0cde[_0x834a('0xd')],queues[_0x5b0cde['uniqueid']][_0x834a('0x2c')],queues[_0x5b0cde[_0x834a('0xd')]]['queuecallerexitreason']));}}catch(_0x3829bf){utils[_0x834a('0x2d')](util[_0x834a('0x2')](_0x834a('0x31'),_0x5b0cde[_0x834a('0xd')]),_0x3829bf);}};exports[_0x834a('0x32')]=function(_0x26a479){try{if(!_[_0x834a('0x15')](queues[_0x26a479[_0x834a('0xd')]])){utils[_0x834a('0x16')](util[_0x834a('0x2')](_0x834a('0x33'),_0x26a479['uniqueid']),_0x26a479);utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x34'),_0x26a479[_0x834a('0xd')],queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x2c')],_0x26a479[_0x834a('0x35')],_0x26a479[_0x834a('0x36')]));queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x32')]=!![];queues[_0x26a479[_0x834a('0xd')]]['queuecallerleaveAt']=utils[_0x834a('0x1b')]();queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x37')]=utils[_0x834a('0x38')](queues[_0x26a479[_0x834a('0xd')]]['queuecallerleaveAt'],queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x39')]);queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x12')]=_0x26a479[_0x834a('0x12')];queues[_0x26a479['uniqueid']][_0x834a('0x3a')]=_0x26a479[_0x834a('0x3a')];queues[_0x26a479[_0x834a('0xd')]][_0x834a('0x35')]=_0x26a479['connectedlinenum'];queues[_0x26a479[_0x834a('0xd')]]['connectedlinename']=_0x26a479[_0x834a('0x36')];}}catch(_0x4872a2){utils[_0x834a('0x2d')](util[_0x834a('0x2')](_0x834a('0x33'),_0x26a479[_0x834a('0xd')]),_0x4872a2);}};exports[_0x834a('0x3b')]=function(_0xf27df0){try{if(!_['isNil'](queues[_0xf27df0[_0x834a('0xd')]])){utils[_0x834a('0x16')](util[_0x834a('0x2')](_0x834a('0x3c'),_0xf27df0[_0x834a('0xd')]),_0xf27df0);utils[_0x834a('0x10')](util['format'](_0x834a('0x3d'),_0xf27df0[_0x834a('0xd')],queues[_0xf27df0[_0x834a('0xd')]][_0x834a('0x2c')],_0xf27df0[_0x834a('0x3e')],_0xf27df0[_0x834a('0x3f')]));queues[_0xf27df0[_0x834a('0xd')]][_0x834a('0x18')]=![];queues[_0xf27df0['uniqueid']][_0x834a('0x18')]=![];queues[_0xf27df0[_0x834a('0xd')]]['queuecallerabandonAt']=null;queues[_0xf27df0[_0x834a('0xd')]]['queuecallerexit']=![];queues[_0xf27df0[_0x834a('0xd')]][_0x834a('0x1c')]=null;queues[_0xf27df0[_0x834a('0xd')]][_0x834a('0x29')]=null;queues[_0xf27df0['uniqueid']][_0x834a('0x40')]=!![];queues[_0xf27df0['uniqueid']][_0x834a('0x5')]=_0xf27df0[_0x834a('0x3f')];queues[_0xf27df0[_0x834a('0xd')]][_0x834a('0x41')]=_0xf27df0['membername'];}}catch(_0x13a113){utils[_0x834a('0x2d')](util['format'](_0x834a('0x3c'),_0xf27df0[_0x834a('0xd')]),_0x13a113);}};exports[_0x834a('0x42')]=function(_0x1748de){try{if(!_[_0x834a('0x15')](queues[_0x1748de[_0x834a('0xd')]])){if(queues[_0x1748de[_0x834a('0xd')]]['queuecallerleaveAt']){utils[_0x834a('0x16')](util[_0x834a('0x2')](_0x834a('0x43'),_0x1748de[_0x834a('0xd')]),_0x1748de);queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x18')]=![];queues[_0x1748de[_0x834a('0xd')]]['queuecallerabandon']=![];queues[_0x1748de[_0x834a('0xd')]]['queuecallerabandonAt']=null;queues[_0x1748de['uniqueid']][_0x834a('0x19')]=![];queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x29')]=null;queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x40')]=!![];queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x41')]=_0x1748de[_0x834a('0x3e')];queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x44')]=!![];queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x1a')]=utils[_0x834a('0x1b')]();if(_0x1748de['reason']==_0x834a('0x45')){if(!queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x45')]){queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x1c')]='TRANSFER';}}else{queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x1c')]=_0x834a('0x46')+_0x1748de[_0x834a('0x47')][_0x834a('0x24')]();}utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x48'),_0x1748de['uniqueid'],queues[_0x1748de[_0x834a('0xd')]]['name'],_0x1748de['membername'],queues[_0x1748de[_0x834a('0xd')]][_0x834a('0x1c')]));writeDB(queues[_0x1748de['uniqueid']]);}}}catch(_0x355763){utils['error'](util[_0x834a('0x2')](_0x834a('0x43'),_0x1748de[_0x834a('0xd')]),_0x355763);}};exports[_0x834a('0x49')]=function(_0x59a498){try{if(!_['isNil'](queues[_0x59a498[_0x834a('0x4a')]])){utils[_0x834a('0x16')](util[_0x834a('0x2')]('[%s][queues][blindtransfer]',_0x59a498[_0x834a('0xd')]),_0x59a498);queues[_0x59a498['transfereeuniqueid']][_0x834a('0x45')]=!![];queues[_0x59a498[_0x834a('0x4a')]]['transfertype']=_0x834a('0x4b');queues[_0x59a498['transfereeuniqueid']][_0x834a('0x4c')]=_0x59a498[_0x834a('0x4d')];queues[_0x59a498['transfereeuniqueid']][_0x834a('0x4e')]=_0x59a498[_0x834a('0x4a')];queues[_0x59a498[_0x834a('0x4a')]][_0x834a('0x1c')]=_0x834a('0x4f');utils['info'](util['format']('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x59a498[_0x834a('0xd')],queues[_0x59a498[_0x834a('0x4a')]][_0x834a('0x2c')],_0x59a498['transfereeuniqueid'],_0x59a498[_0x834a('0x4d')]));}}catch(_0x60b51a){utils[_0x834a('0x2d')](util[_0x834a('0x2')](_0x834a('0x50'),_0x59a498['uniqueid']),_0x60b51a);}};exports[_0x834a('0x51')]=function(_0x5cb16d){try{utils['debug'](util[_0x834a('0x2')](_0x834a('0x52'),_0x5cb16d[_0x834a('0x53')]),_0x5cb16d);if(_0x5cb16d['origtransfereruniqueid']==_0x5cb16d[_0x834a('0x54')]){if(!_[_0x834a('0x15')](queues[_0x5cb16d[_0x834a('0x55')]])){utils[_0x834a('0x10')](util[_0x834a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x5cb16d[_0x834a('0x53')],queues[_0x5cb16d[_0x834a('0x55')]]['name'],_0x5cb16d[_0x834a('0x56')]));queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x45')]=!![];queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x57')]=_0x834a('0x58');queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x4c')]=_0x5cb16d[_0x834a('0x56')];queues[_0x5cb16d[_0x834a('0x55')]]['transferuniqueid']=_0x5cb16d[_0x834a('0x53')];queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x1c')]=_0x834a('0x59');}if(!_['isNil'](queues[_0x5cb16d[_0x834a('0x54')]])){if(_0x5cb16d[_0x834a('0x5a')]&&queues[_0x5cb16d[_0x834a('0x5a')]]){queues[_0x5cb16d['transfereelinkedid']][_0x834a('0x1f')]=0x1;queues[_0x5cb16d[_0x834a('0x4a')]]=_[_0x834a('0x5b')](queues[_0x5cb16d[_0x834a('0x5a')]]);queues[_0x5cb16d['transfereeuniqueid']]['transfereduniqueid']=_0x5cb16d['transfertargetuniqueid'];queues[_0x5cb16d[_0x834a('0x4a')]]['queuecallerenterreason']=0x2;queues[_0x5cb16d[_0x834a('0x4a')]][_0x834a('0x5c')]=queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x5c')];queues[_0x5cb16d[_0x834a('0x4a')]][_0x834a('0x5d')]=queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x5d')];queues[_0x5cb16d['transfereeuniqueid']][_0x834a('0x39')]=utils[_0x834a('0x1b')]();queues[_0x5cb16d['transfereeuniqueid']]['queuecallerleaveAt']=utils[_0x834a('0x1b')]();queues[_0x5cb16d[_0x834a('0x4a')]]['holdtime']=0x0;queues[_0x5cb16d['transfereeuniqueid']][_0x834a('0x5e')]=0x0;utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x5f'),_0x5cb16d['origtransfereruniqueid'],queues[_0x5cb16d[_0x834a('0x4a')]]['name'],queues[_0x5cb16d[_0x834a('0x4a')]]['calleridnum'],queues[_0x5cb16d[_0x834a('0x4a')]][_0x834a('0x5d')]));}else{utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x60'),_0x5cb16d[_0x834a('0x53')],queues[_0x5cb16d[_0x834a('0x54')]]['name'],_0x5cb16d[_0x834a('0x55')]));queues[_0x5cb16d['origtransfererlinkedid']]['transfereduniqueid']=_0x5cb16d[_0x834a('0x55')];}}}else if(_0x5cb16d[_0x834a('0x61')]==_0x5cb16d[_0x834a('0x55')]){if(!_['isNil'](queues[_0x5cb16d[_0x834a('0x54')]])){utils[_0x834a('0x10')](util['format'](_0x834a('0x62'),_0x5cb16d[_0x834a('0x53')],queues[_0x5cb16d[_0x834a('0x54')]]['name'],_0x5cb16d[_0x834a('0x61')],_0x5cb16d['secondtransfererexten']));queues[_0x5cb16d[_0x834a('0x54')]]['transfer']=!![];queues[_0x5cb16d['origtransfererlinkedid']][_0x834a('0x57')]=_0x834a('0x58');queues[_0x5cb16d[_0x834a('0x54')]]['transferexten']=_0x5cb16d[_0x834a('0x63')];queues[_0x5cb16d[_0x834a('0x54')]][_0x834a('0x4e')]=_0x5cb16d[_0x834a('0x61')];queues[_0x5cb16d[_0x834a('0x54')]][_0x834a('0x1c')]=_0x834a('0x59');}if(!_['isNil'](queues[_0x5cb16d[_0x834a('0x55')]])){if(_0x5cb16d[_0x834a('0x64')]&&queues[_0x5cb16d[_0x834a('0x64')]]){queues[_0x5cb16d[_0x834a('0x64')]][_0x834a('0x1f')]=0x1;queues[_0x5cb16d[_0x834a('0x65')]]=_[_0x834a('0x5b')](queues[_0x5cb16d[_0x834a('0x64')]]);queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0xc')]=_0x5cb16d[_0x834a('0x65')];queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x1f')]=0x2;queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x5c')]=queues[_0x5cb16d[_0x834a('0x54')]][_0x834a('0x5c')];queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x5d')]=queues[_0x5cb16d[_0x834a('0x54')]][_0x834a('0x5d')];queues[_0x5cb16d['transfertargetuniqueid']][_0x834a('0x39')]=utils[_0x834a('0x1b')]();queues[_0x5cb16d[_0x834a('0x65')]]['queuecallerleaveAt']=utils['now']();queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x37')]=0x0;queues[_0x5cb16d['transfertargetuniqueid']][_0x834a('0x5e')]=0x0;utils[_0x834a('0x10')](util['format'](_0x834a('0x66'),_0x5cb16d['origtransfereruniqueid'],queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x2c')],queues[_0x5cb16d['transfertargetuniqueid']][_0x834a('0xc')],queues[_0x5cb16d[_0x834a('0x65')]][_0x834a('0x5c')],queues[_0x5cb16d['transfertargetuniqueid']]['calleridname']));}else{utils[_0x834a('0x10')](util[_0x834a('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x5cb16d[_0x834a('0x53')],queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0x2c')],_0x5cb16d[_0x834a('0x54')]));queues[_0x5cb16d[_0x834a('0x55')]][_0x834a('0xc')]=_0x5cb16d['origtransfererlinkedid'];}}}}catch(_0x12a8d0){utils['error'](util[_0x834a('0x2')](_0x834a('0x52'),_0x5cb16d[_0x834a('0x53')]),_0x12a8d0);}};exports[_0x834a('0x67')]=function(_0x2959ac){try{if(!_[_0x834a('0x15')](queues[_0x2959ac[_0x834a('0xd')]])){utils['debug'](util[_0x834a('0x2')](_0x834a('0x68'),_0x2959ac[_0x834a('0xd')]),_0x2959ac);queues[_0x2959ac['uniqueid']][_0x834a('0x69')]=utils[_0x834a('0x1b')]();utils[_0x834a('0x10')](util[_0x834a('0x2')](_0x834a('0x6a'),_0x2959ac['uniqueid'],queues[_0x2959ac[_0x834a('0xd')]]['name'],queues[_0x2959ac[_0x834a('0xd')]][_0x834a('0x69')]));}}catch(_0x48a11d){utils[_0x834a('0x2d')](util[_0x834a('0x2')]('[%s][queues][musiconholdstart]',_0x2959ac[_0x834a('0xd')]),_0x48a11d);}};exports[_0x834a('0x6b')]=function(_0x5030b8){try{if(!_[_0x834a('0x15')](queues[_0x5030b8[_0x834a('0xd')]])){if(!_[_0x834a('0x15')](queues[_0x5030b8[_0x834a('0xd')]][_0x834a('0x69')])){utils[_0x834a('0x16')](util[_0x834a('0x2')](_0x834a('0x6c'),_0x5030b8[_0x834a('0xd')]),_0x5030b8);queues[_0x5030b8[_0x834a('0xd')]][_0x834a('0x5e')]+=utils[_0x834a('0x38')](utils[_0x834a('0x1b')](),queues[_0x5030b8[_0x834a('0xd')]]['musiconholdstartAt']);utils[_0x834a('0x10')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x5030b8['uniqueid'],queues[_0x5030b8[_0x834a('0xd')]][_0x834a('0x2c')],queues[_0x5030b8[_0x834a('0xd')]]['mohtime']));delete queues[_0x5030b8[_0x834a('0xd')]][_0x834a('0x69')];}}}catch(_0x17d5a0){utils[_0x834a('0x2d')](util[_0x834a('0x2')](_0x834a('0x6c'),_0x5030b8['uniqueid']),_0x17d5a0);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index a0dcfc7..e772c1c 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 _0xaeae=['[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channelstate','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','channel','varset','variable','[%s][recordings][varset]','value','endsWith','.wav49','.WAV','find','monitors','[%s][recordings][hangup]','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaeae,0x1eb));var _0xeaea=function(_0x2ff279,_0x493782){_0x2ff279=_0x2ff279-0x0;var _0x3d9842=_0xaeae[_0x2ff279];return _0x3d9842;};'use strict';var _=require(_0xeaea('0x0'));var util=require(_0xeaea('0x1'));var utils=require(_0xeaea('0x2'));var recordings={};function writeDB(_0x21b7bf){utils['info'](util[_0xeaea('0x3')](_0xeaea('0x4'),_0x21b7bf['uniqueid']));if(_0x21b7bf[_0xeaea('0x5')]){utils[_0xeaea('0x6')](_0x21b7bf[_0xeaea('0x5')])[_0xeaea('0x7')](function(_0x211e64){if(_0x211e64){_0x21b7bf['membername']=_0x211e64[_0xeaea('0x8')];_0x21b7bf[_0xeaea('0x9')]=_0x211e64['id'];}utils[_0xeaea('0xa')]('CreateVoiceRecording',_0x21b7bf);});}else{utils[_0xeaea('0xa')](_0xeaea('0xb'),_0x21b7bf);}}exports[_0xeaea('0xc')]=function(_0x5ed865){try{utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0xe'),_0x5ed865['uniqueid']),_0x5ed865);if(_0x5ed865[_0xeaea('0xf')]==_0x5ed865[_0xeaea('0x10')]){utils[_0xeaea('0x11')](util[_0xeaea('0x3')](_0xeaea('0x12'),_0x5ed865[_0xeaea('0xf')],_0x5ed865[_0xeaea('0x13')],_0x5ed865[_0xeaea('0x14')]));recordings[_0x5ed865[_0xeaea('0xf')]]={'uniqueid':_0x5ed865['uniqueid'],'accountcode':_0x5ed865[_0xeaea('0x5')],'exten':_0x5ed865[_0xeaea('0x14')],'context':_0x5ed865['context'],'channel':_0x5ed865['channel'],'monitors':[]};}}catch(_0x4a7ed0){utils[_0xeaea('0x15')](util[_0xeaea('0x3')]('[%s][recordings][newchannel]',_0x5ed865[_0xeaea('0xf')]),_0x4a7ed0);}};exports[_0xeaea('0x16')]=function(_0x1dd972){try{utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x17'),_0x1dd972[_0xeaea('0xf')]),_0x1dd972);if(!_[_0xeaea('0x18')](recordings[_0x1dd972[_0xeaea('0xf')]])&&_0x1dd972['channelstate']==0x6){utils['info'](util[_0xeaea('0x3')](_0xeaea('0x19'),_0x1dd972[_0xeaea('0xf')],_0x1dd972['context'],_0x1dd972['channel']));}else if(!_['isNil'](recordings[_0x1dd972['linkedid']])&&_0x1dd972[_0xeaea('0x1a')]==0x6&&_0x1dd972[_0xeaea('0x13')]!=_0xeaea('0x1b')){utils[_0xeaea('0x11')](util['format'](_0xeaea('0x1c'),_0x1dd972[_0xeaea('0xf')],_0x1dd972[_0xeaea('0x10')],_0x1dd972[_0xeaea('0x13')],_0x1dd972[_0xeaea('0x1d')]));recordings[_0x1dd972[_0xeaea('0x10')]][_0xeaea('0x5')]=_0x1dd972[_0xeaea('0x5')];}}catch(_0x3558d3){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x17'),_0x1dd972[_0xeaea('0xf')]),_0x3558d3);}};exports[_0xeaea('0x1e')]=function(_0x4908b0){try{if(!_[_0xeaea('0x18')](_0x4908b0[_0xeaea('0x1f')])&&!_[_0xeaea('0x18')](_0x4908b0[_0xeaea('0x1f')]['mixmonitor_filename'])){utils['debug'](util[_0xeaea('0x3')](_0xeaea('0x20'),_0x4908b0[_0xeaea('0xf')]),_0x4908b0);utils['info'](util[_0xeaea('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x4908b0['uniqueid'],_0x4908b0['variable'],_0x4908b0[_0xeaea('0x21')]));if(_[_0xeaea('0x22')](_0x4908b0[_0xeaea('0x21')],'.wav49')){_0x4908b0[_0xeaea('0x21')]=_0x4908b0[_0xeaea('0x21')]['replace'](_0xeaea('0x23'),_0xeaea('0x24'));}if(recordings[_0x4908b0[_0xeaea('0x10')]]){var _0x168df0=_[_0xeaea('0x25')](recordings[_0x4908b0[_0xeaea('0x10')]][_0xeaea('0x26')],{'value':_0x4908b0[_0xeaea('0x21')]});if(_[_0xeaea('0x18')](_0x168df0)){recordings[_0x4908b0[_0xeaea('0x10')]][_0xeaea('0x26')]['push']({'value':_0x4908b0[_0xeaea('0x21')]});}}}}catch(_0x4cc5eb){utils['error'](util[_0xeaea('0x3')](_0xeaea('0x20'),_0x4908b0['uniqueid']),_0x4cc5eb);}};exports['hangup']=function(_0x4ba67c){try{if(!_[_0xeaea('0x18')](recordings[_0x4ba67c['uniqueid']])){utils[_0xeaea('0xd')](util['format'](_0xeaea('0x27'),_0x4ba67c['uniqueid']),_0x4ba67c);utils[_0xeaea('0x11')](util[_0xeaea('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x4ba67c[_0xeaea('0xf')],_0x4ba67c['calleridnum'],_0x4ba67c[_0xeaea('0x28')],_0x4ba67c[_0xeaea('0x29')]));recordings[_0x4ba67c[_0xeaea('0xf')]]['calleridnum']=_0x4ba67c['calleridnum'];recordings[_0x4ba67c['uniqueid']][_0xeaea('0x28')]=_0x4ba67c[_0xeaea('0x28')];recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2a')]=_0x4ba67c[_0xeaea('0x2a')];recordings[_0x4ba67c[_0xeaea('0xf')]]['connectedlinename']=_0x4ba67c[_0xeaea('0x2b')];if(recordings[_0x4ba67c['uniqueid']][_0xeaea('0x2c')]==_0xeaea('0x2d')&&recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x5')]){recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2a')]=recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x5')];recordings[_0x4ba67c[_0xeaea('0xf')]][_0xeaea('0x2b')]='';}recordings[_0x4ba67c['uniqueid']][_0xeaea('0x26')][_0xeaea('0x2e')](function(_0x44f2d5){var _0x45a5eb=_['clone'](recordings[_0x4ba67c[_0xeaea('0xf')]]);_0x45a5eb[_0xeaea('0x21')]=_0x44f2d5[_0xeaea('0x21')];writeDB(_0x45a5eb);});delete recordings[_0x4ba67c['uniqueid']];}}catch(_0xecb27a){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x27'),_0x4ba67c['uniqueid']),_0xecb27a);}};exports['newexten']=function(_0x335afa){try{if(!_['isNil'](recordings[_0x335afa['uniqueid']])){utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x2f'),_0x335afa['uniqueid']),_0x335afa);utils[_0xeaea('0x11')](util[_0xeaea('0x3')](_0xeaea('0x30'),_0x335afa['uniqueid'],_0x335afa[_0xeaea('0x31')],_0x335afa[_0xeaea('0x32')]));if(_0x335afa[_0xeaea('0x31')][_0xeaea('0x33')]()==_0xeaea('0x34')&&_[_0xeaea('0x35')](_0x335afa[_0xeaea('0x32')][_0xeaea('0x33')](),_0xeaea('0x36'))){var _0x2c7081=_0x335afa[_0xeaea('0x32')][_0xeaea('0x37')]('=');var _0x997f6d=_0x2c7081[0x0][_0xeaea('0x38')](_0x2c7081[0x0][_0xeaea('0x39')]('(')+0x1,_0x2c7081[0x0][_0xeaea('0x39')](')'));var _0x5e45c9=_0x2c7081[0x1];recordings[_0x335afa[_0xeaea('0xf')]][_0x997f6d]=_0x5e45c9;}}}catch(_0x46d947){utils[_0xeaea('0x15')](util[_0xeaea('0x3')](_0xeaea('0x2f'),_0x335afa[_0xeaea('0xf')]),_0x46d947);}};exports['queuecallerjoin']=function(_0x10bc05){try{if(!_[_0xeaea('0x18')](recordings[_0x10bc05[_0xeaea('0xf')]])){utils[_0xeaea('0xd')](util[_0xeaea('0x3')](_0xeaea('0x3a'),_0x10bc05['uniqueid']),_0x10bc05);utils[_0xeaea('0x11')](util['format'](_0xeaea('0x3b'),_0x10bc05[_0xeaea('0xf')],_0x10bc05[_0xeaea('0x3c')]));recordings[_0x10bc05[_0xeaea('0xf')]]['queue']=_0x10bc05[_0xeaea('0x3c')];}}catch(_0x4fb1b9){utils[_0xeaea('0x15')](util['format'](_0xeaea('0x3a'),_0x10bc05[_0xeaea('0xf')]),_0x4fb1b9);}}; \ No newline at end of file +var _0x715a=['[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','UserId','request','CreateVoiceRecording','newchannel','debug','format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x715a,0x17d));var _0xa715=function(_0x4746c5,_0x2877eb){_0x4746c5=_0x4746c5-0x0;var _0x31a17c=_0x715a[_0x4746c5];return _0x31a17c;};'use strict';var _=require('lodash');var util=require(_0xa715('0x0'));var utils=require(_0xa715('0x1'));var recordings={};function writeDB(_0x113d47){utils[_0xa715('0x2')](util['format'](_0xa715('0x3'),_0x113d47[_0xa715('0x4')]));if(_0x113d47[_0xa715('0x5')]){utils[_0xa715('0x6')](_0x113d47[_0xa715('0x5')])[_0xa715('0x7')](function(_0x52a1af){if(_0x52a1af){_0x113d47[_0xa715('0x8')]=_0x52a1af['name'];_0x113d47[_0xa715('0x9')]=_0x52a1af['id'];}utils[_0xa715('0xa')](_0xa715('0xb'),_0x113d47);});}else{utils[_0xa715('0xa')](_0xa715('0xb'),_0x113d47);}}exports[_0xa715('0xc')]=function(_0x4974f2){try{utils[_0xa715('0xd')](util[_0xa715('0xe')](_0xa715('0xf'),_0x4974f2['uniqueid']),_0x4974f2);if(_0x4974f2[_0xa715('0x4')]==_0x4974f2[_0xa715('0x10')]){utils[_0xa715('0x2')](util['format'](_0xa715('0x11'),_0x4974f2[_0xa715('0x4')],_0x4974f2['context'],_0x4974f2[_0xa715('0x12')]));recordings[_0x4974f2[_0xa715('0x4')]]={'uniqueid':_0x4974f2[_0xa715('0x4')],'accountcode':_0x4974f2['accountcode'],'exten':_0x4974f2[_0xa715('0x12')],'context':_0x4974f2[_0xa715('0x13')],'channel':_0x4974f2[_0xa715('0x14')],'monitors':[]};}}catch(_0x564060){utils[_0xa715('0x15')](util[_0xa715('0xe')](_0xa715('0xf'),_0x4974f2['uniqueid']),_0x564060);}};exports['newstate']=function(_0x4c5f2c){try{utils['debug'](util[_0xa715('0xe')](_0xa715('0x16'),_0x4c5f2c[_0xa715('0x4')]),_0x4c5f2c);if(!_[_0xa715('0x17')](recordings[_0x4c5f2c[_0xa715('0x4')]])&&_0x4c5f2c[_0xa715('0x18')]==0x6){utils[_0xa715('0x2')](util[_0xa715('0xe')](_0xa715('0x19'),_0x4c5f2c[_0xa715('0x4')],_0x4c5f2c[_0xa715('0x13')],_0x4c5f2c[_0xa715('0x14')]));}else if(!_['isNil'](recordings[_0x4c5f2c[_0xa715('0x10')]])&&_0x4c5f2c[_0xa715('0x18')]==0x6&&_0x4c5f2c['context']!=_0xa715('0x1a')){utils[_0xa715('0x2')](util[_0xa715('0xe')](_0xa715('0x1b'),_0x4c5f2c[_0xa715('0x4')],_0x4c5f2c[_0xa715('0x10')],_0x4c5f2c['context'],_0x4c5f2c[_0xa715('0x14')]));recordings[_0x4c5f2c[_0xa715('0x10')]][_0xa715('0x5')]=_0x4c5f2c[_0xa715('0x5')];}}catch(_0x3dfeb2){utils['error'](util['format'](_0xa715('0x16'),_0x4c5f2c[_0xa715('0x4')]),_0x3dfeb2);}};exports['varset']=function(_0x14dd5a){try{if(!_[_0xa715('0x17')](_0x14dd5a['variable'])&&!_[_0xa715('0x17')](_0x14dd5a[_0xa715('0x1c')][_0xa715('0x1d')])){utils[_0xa715('0xd')](util[_0xa715('0xe')](_0xa715('0x1e'),_0x14dd5a[_0xa715('0x4')]),_0x14dd5a);utils[_0xa715('0x2')](util[_0xa715('0xe')](_0xa715('0x1f'),_0x14dd5a[_0xa715('0x4')],_0x14dd5a[_0xa715('0x1c')],_0x14dd5a[_0xa715('0x20')]));if(_[_0xa715('0x21')](_0x14dd5a[_0xa715('0x20')],_0xa715('0x22'))){_0x14dd5a[_0xa715('0x20')]=_0x14dd5a[_0xa715('0x20')][_0xa715('0x23')](_0xa715('0x22'),'.WAV');}if(recordings[_0x14dd5a[_0xa715('0x10')]]){var _0x3329ea=_[_0xa715('0x24')](recordings[_0x14dd5a[_0xa715('0x10')]][_0xa715('0x25')],{'value':_0x14dd5a[_0xa715('0x20')]});if(_[_0xa715('0x17')](_0x3329ea)){recordings[_0x14dd5a[_0xa715('0x10')]][_0xa715('0x25')][_0xa715('0x26')]({'value':_0x14dd5a[_0xa715('0x20')]});}}}}catch(_0x81b623){utils['error'](util['format'](_0xa715('0x1e'),_0x14dd5a[_0xa715('0x4')]),_0x81b623);}};exports[_0xa715('0x27')]=function(_0x42724d){try{if(!_['isNil'](recordings[_0x42724d[_0xa715('0x4')]])){utils['debug'](util[_0xa715('0xe')](_0xa715('0x28'),_0x42724d[_0xa715('0x4')]),_0x42724d);utils[_0xa715('0x2')](util[_0xa715('0xe')](_0xa715('0x29'),_0x42724d[_0xa715('0x4')],_0x42724d[_0xa715('0x2a')],_0x42724d[_0xa715('0x2b')],_0x42724d[_0xa715('0x2c')]));recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x2a')]=_0x42724d[_0xa715('0x2a')];recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x2b')]=_0x42724d['calleridname'];recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x2d')]=_0x42724d['connectedlinenum'];recordings[_0x42724d['uniqueid']]['connectedlinename']=_0x42724d[_0xa715('0x2e')];if(recordings[_0x42724d['uniqueid']]['type']==_0xa715('0x2f')&&recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x5')]){recordings[_0x42724d['uniqueid']]['connectedlinenum']=recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x5')];recordings[_0x42724d[_0xa715('0x4')]][_0xa715('0x2e')]='';}recordings[_0x42724d[_0xa715('0x4')]]['monitors'][_0xa715('0x30')](function(_0x5b1cb2){var _0x5ee92d=_[_0xa715('0x31')](recordings[_0x42724d[_0xa715('0x4')]]);_0x5ee92d[_0xa715('0x20')]=_0x5b1cb2[_0xa715('0x20')];writeDB(_0x5ee92d);});delete recordings[_0x42724d[_0xa715('0x4')]];}}catch(_0x44be30){utils[_0xa715('0x15')](util[_0xa715('0xe')](_0xa715('0x28'),_0x42724d['uniqueid']),_0x44be30);}};exports[_0xa715('0x32')]=function(_0xb5bec6){try{if(!_['isNil'](recordings[_0xb5bec6[_0xa715('0x4')]])){utils[_0xa715('0xd')](util['format'](_0xa715('0x33'),_0xb5bec6['uniqueid']),_0xb5bec6);utils['info'](util[_0xa715('0xe')](_0xa715('0x34'),_0xb5bec6['uniqueid'],_0xb5bec6[_0xa715('0x35')],_0xb5bec6[_0xa715('0x36')]));if(_0xb5bec6[_0xa715('0x35')][_0xa715('0x37')]()=='set'&&_[_0xa715('0x38')](_0xb5bec6[_0xa715('0x36')][_0xa715('0x37')](),_0xa715('0x39'))){var _0x3be710=_0xb5bec6['appdata'][_0xa715('0x3a')]('=');var _0x4bf373=_0x3be710[0x0]['substring'](_0x3be710[0x0]['lastIndexOf']('(')+0x1,_0x3be710[0x0][_0xa715('0x3b')](')'));var _0x2329e4=_0x3be710[0x1];recordings[_0xb5bec6[_0xa715('0x4')]][_0x4bf373]=_0x2329e4;}}}catch(_0x18206a){utils['error'](util[_0xa715('0xe')](_0xa715('0x33'),_0xb5bec6[_0xa715('0x4')]),_0x18206a);}};exports[_0xa715('0x3c')]=function(_0xb56479){try{if(!_[_0xa715('0x17')](recordings[_0xb56479['uniqueid']])){utils[_0xa715('0xd')](util[_0xa715('0xe')](_0xa715('0x3d'),_0xb56479['uniqueid']),_0xb56479);utils['info'](util['format'](_0xa715('0x3e'),_0xb56479[_0xa715('0x4')],_0xb56479['queue']));recordings[_0xb56479[_0xa715('0x4')]][_0xa715('0x3f')]=_0xb56479[_0xa715('0x3f')];}}catch(_0x4f5e7c){utils[_0xa715('0x15')](util[_0xa715('0xe')]('[%s][recordings][queuecallerjoin]',_0xb56479['uniqueid']),_0x4f5e7c);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index d704c55..8d28eb7 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 _0x7ac7=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','./utils','info','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','type','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridname'];(function(_0x2dcbf7,_0x2abfd1){var _0x49ee91=function(_0x206437){while(--_0x206437){_0x2dcbf7['push'](_0x2dcbf7['shift']());}};_0x49ee91(++_0x2abfd1);}(_0x7ac7,0xf6));var _0x77ac=function(_0x456c47,_0x256451){_0x456c47=_0x456c47-0x0;var _0xc7ec63=_0x7ac7[_0x456c47];return _0xc7ec63;};'use strict';var _=require(_0x77ac('0x0'));var util=require('util');var utils=require(_0x77ac('0x1'));function writeDB(_0x2749cd){utils[_0x77ac('0x2')](util['format'](_0x77ac('0x3'),_0x2749cd['type']===_0x77ac('0x4')?_0x2749cd['origtransfereruniqueid']:_0x2749cd[_0x77ac('0x5')],_0x2749cd[_0x77ac('0x6')]));utils['request']('CreateVoiceTransferReport',_0x2749cd);}exports['blindtransfer']=function(_0x555dbc){try{utils['debug'](util[_0x77ac('0x7')](_0x77ac('0x8'),_0x555dbc[_0x77ac('0x5')]),_0x555dbc);utils[_0x77ac('0x2')](util['format'](_0x77ac('0x9'),_0x555dbc[_0x77ac('0x5')],_0x555dbc[_0x77ac('0xa')],_0x555dbc[_0x77ac('0xb')],_0x555dbc[_0x77ac('0xc')],_0x555dbc[_0x77ac('0xd')]));_0x555dbc[_0x77ac('0x6')]=_0x77ac('0xe');writeDB(_0x555dbc);}catch(_0x20e544){utils[_0x77ac('0xf')](util['format'](_0x77ac('0x8'),_0x555dbc[_0x77ac('0x5')]),_0x20e544);}};exports[_0x77ac('0x10')]=function(_0x88f165){try{utils['debug'](util[_0x77ac('0x7')]('[%s][transfers][attendedtransfer]',_0x88f165[_0x77ac('0x11')]),_0x88f165);utils[_0x77ac('0x2')](util[_0x77ac('0x7')](_0x77ac('0x12'),_0x88f165['origtransfereruniqueid'],_0x88f165[_0x77ac('0x13')],_0x88f165[_0x77ac('0x14')],_0x88f165[_0x77ac('0x15')],_0x88f165['transfertargetcalleridname']));_0x88f165=_[_0x77ac('0x16')](_0x88f165,{'transfererchannel':_0x88f165[_0x77ac('0x17')],'transferercalleridnum':_0x88f165[_0x77ac('0x13')],'transferercalleridname':_0x88f165[_0x77ac('0x14')],'transfererconnectedlinenum':_0x88f165['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x88f165[_0x77ac('0x18')],'transfereraccountcode':_0x88f165['origtransfereraccountcode'],'transferercontext':_0x88f165[_0x77ac('0x19')],'transfererexten':_0x88f165[_0x77ac('0x1a')],'transfererlinkedid':_0x88f165[_0x77ac('0x1b')],'context':_0x88f165[_0x77ac('0x1c')],'extension':_0x88f165[_0x77ac('0x1d')],'type':_0x77ac('0x4')});if(_[_0x77ac('0x1e')](_0x88f165[_0x77ac('0x1f')])){_0x88f165=_['assign'](_0x88f165,{'transfereechannel':_0x88f165[_0x77ac('0x20')],'transfereecalleridnum':_0x88f165['transfertargetcalleridnum'],'transfereecalleridname':_0x88f165[_0x77ac('0x21')],'transfereeconnectedlinenum':_0x88f165[_0x77ac('0x22')],'transfereeconnectedlinename':_0x88f165[_0x77ac('0x23')],'transfereeaccountcode':_0x88f165[_0x77ac('0x24')],'transfereecontext':_0x88f165['transfertargetcontext'],'transfereeexten':_0x88f165[_0x77ac('0x25')],'transfereelinkedid':_0x88f165[_0x77ac('0x26')]});}writeDB(_0x88f165);}catch(_0x4ce926){utils[_0x77ac('0xf')](util['format'](_0x77ac('0x27'),_0x88f165['origtransfereruniqueid']),_0x4ce926);}}; \ No newline at end of file +var _0x09f2=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','request','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','lodash','util','./utils','info'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x09f2,0x1d5));var _0x209f=function(_0x374126,_0x4cbe46){_0x374126=_0x374126-0x0;var _0x2e5ad7=_0x09f2[_0x374126];return _0x2e5ad7;};'use strict';var _=require(_0x209f('0x0'));var util=require(_0x209f('0x1'));var utils=require(_0x209f('0x2'));function writeDB(_0x3b9775){utils[_0x209f('0x3')](util[_0x209f('0x4')](_0x209f('0x5'),_0x3b9775[_0x209f('0x6')]===_0x209f('0x7')?_0x3b9775['origtransfereruniqueid']:_0x3b9775['uniqueid'],_0x3b9775[_0x209f('0x6')]));utils[_0x209f('0x8')]('CreateVoiceTransferReport',_0x3b9775);}exports[_0x209f('0x9')]=function(_0x557a4f){try{utils[_0x209f('0xa')](util['format'](_0x209f('0xb'),_0x557a4f['uniqueid']),_0x557a4f);utils[_0x209f('0x3')](util['format'](_0x209f('0xc'),_0x557a4f[_0x209f('0xd')],_0x557a4f[_0x209f('0xe')],_0x557a4f[_0x209f('0xf')],_0x557a4f[_0x209f('0x10')],_0x557a4f[_0x209f('0x11')]));_0x557a4f['type']='blind';writeDB(_0x557a4f);}catch(_0x5c9b67){utils[_0x209f('0x12')](util[_0x209f('0x4')](_0x209f('0xb'),_0x557a4f[_0x209f('0xd')]),_0x5c9b67);}};exports[_0x209f('0x13')]=function(_0x73e1c8){try{utils[_0x209f('0xa')](util[_0x209f('0x4')](_0x209f('0x14'),_0x73e1c8[_0x209f('0x15')]),_0x73e1c8);utils[_0x209f('0x3')](util[_0x209f('0x4')](_0x209f('0x16'),_0x73e1c8['origtransfereruniqueid'],_0x73e1c8[_0x209f('0x17')],_0x73e1c8[_0x209f('0x18')],_0x73e1c8[_0x209f('0x19')],_0x73e1c8[_0x209f('0x1a')]));_0x73e1c8=_[_0x209f('0x1b')](_0x73e1c8,{'transfererchannel':_0x73e1c8['origtransfererchannel'],'transferercalleridnum':_0x73e1c8[_0x209f('0x17')],'transferercalleridname':_0x73e1c8['origtransferercalleridname'],'transfererconnectedlinenum':_0x73e1c8[_0x209f('0x1c')],'transfererconnectedlinename':_0x73e1c8[_0x209f('0x1d')],'transfereraccountcode':_0x73e1c8[_0x209f('0x1e')],'transferercontext':_0x73e1c8[_0x209f('0x1f')],'transfererexten':_0x73e1c8[_0x209f('0x20')],'transfererlinkedid':_0x73e1c8['origtransfererlinkedid'],'context':_0x73e1c8[_0x209f('0x21')],'extension':_0x73e1c8[_0x209f('0x22')],'type':'attended'});if(_[_0x209f('0x23')](_0x73e1c8[_0x209f('0x24')])){_0x73e1c8=_[_0x209f('0x1b')](_0x73e1c8,{'transfereechannel':_0x73e1c8[_0x209f('0x25')],'transfereecalleridnum':_0x73e1c8[_0x209f('0x19')],'transfereecalleridname':_0x73e1c8[_0x209f('0x1a')],'transfereeconnectedlinenum':_0x73e1c8[_0x209f('0x26')],'transfereeconnectedlinename':_0x73e1c8[_0x209f('0x27')],'transfereeaccountcode':_0x73e1c8[_0x209f('0x28')],'transfereecontext':_0x73e1c8[_0x209f('0x29')],'transfereeexten':_0x73e1c8[_0x209f('0x2a')],'transfereelinkedid':_0x73e1c8['transfertargetlinkedid']});}writeDB(_0x73e1c8);}catch(_0x2978f3){utils['error'](util[_0x209f('0x4')](_0x209f('0x14'),_0x73e1c8[_0x209f('0x15')]),_0x2978f3);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 4af8467..fa4f773 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 _0x6c20=['client','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','[utils][getUser]\x20where:%s','stringify','result','notfound','[utils][getUserByInternal]','getUserByInterface','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','format','subtractTime','subtract','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise'];(function(_0x4b4154,_0x38a122){var _0x340ed7=function(_0x1250b9){while(--_0x1250b9){_0x4b4154['push'](_0x4b4154['shift']());}};_0x340ed7(++_0x38a122);}(_0x6c20,0x88));var _0x06c2=function(_0xced98a,_0x5cb79a){_0xced98a=_0xced98a-0x0;var _0x2055db=_0x6c20[_0xced98a];return _0x2055db;};'use strict';var BPromise=require(_0x06c2('0x0'));var jayson=require(_0x06c2('0x1'));var moment=require('moment');var util=require('util');var client=jayson[_0x06c2('0x2')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0x06c2('0x3'));exports[_0x06c2('0x4')]=function(_0x169412,_0x2c7843){logger[_0x06c2('0x4')](_0x169412,_0x2c7843?util[_0x06c2('0x5')](_0x2c7843,{'showHidden':![],'depth':null}):'');};exports[_0x06c2('0x6')]=function(_0xb513a1,_0x164b3a){logger['debug'](_0xb513a1,_0x164b3a?util[_0x06c2('0x5')](_0x164b3a,{'showHidden':![],'depth':null}):'');};exports[_0x06c2('0x7')]=function(_0x4286d5,_0x5512e0){logger['error'](_0x4286d5,_0x5512e0?util['inspect'](_0x5512e0,{'showHidden':![],'depth':null}):'');};exports[_0x06c2('0x8')]=function(_0x2993fd,_0x740542){return client[_0x06c2('0x8')](_0x2993fd,{'body':_0x740542})[_0x06c2('0x9')](function(_0x15fde6){logger[_0x06c2('0x6')](_0x06c2('0xa'),_0x2993fd,_0x15fde6?util[_0x06c2('0x5')](_0x15fde6,{'showHidden':![],'depth':null}):'');})[_0x06c2('0xb')](function(_0x49e385){logger[_0x06c2('0x7')](_0x06c2('0xa'),_0x2993fd,_0x49e385?util[_0x06c2('0x5')](_0x49e385,{'showHidden':![],'depth':null}):'');});};function getUser(_0x17b7c3){return client['request'](_0x06c2('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0x06c2('0xd'),_0x06c2('0xe')],'where':_0x17b7c3,'limit':0x1}})[_0x06c2('0x9')](function(_0x3ca58e){logger['debug'](_0x06c2('0xf'),JSON[_0x06c2('0x10')](_0x17b7c3),_0x3ca58e?util[_0x06c2('0x5')](_0x3ca58e,{'showHidden':![],'depth':null}):'');return _0x3ca58e[_0x06c2('0x11')]['length']?_0x3ca58e['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x4bf48d){return new BPromise(function(_0x5649d2,_0x4bcba7){if(_0x4bf48d){return getUser({'internal':_0x4bf48d})[_0x06c2('0x9')](function(_0x303497){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4bf48d,_0x303497?'found':_0x06c2('0x12'));return _0x5649d2(_0x303497);})[_0x06c2('0xb')](function(_0x26ad55){logger[_0x06c2('0x7')](_0x06c2('0x13'),_0x26ad55?util[_0x06c2('0x5')](_0x26ad55,{'showHidden':![],'depth':null}):'');return _0x5649d2(null);});}return _0x5649d2(null);});};exports[_0x06c2('0x14')]=function(_0x5440ea){return new BPromise(function(_0x42cfd2,_0x1e6a10){if(_0x5440ea){return getUser({'interface':_0x5440ea})[_0x06c2('0x9')](function(_0x3a3056){logger['info']('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x5440ea,_0x3a3056?_0x06c2('0x15'):'notfound');return _0x42cfd2(_0x3a3056);})[_0x06c2('0xb')](function(_0x3026ae){logger[_0x06c2('0x7')](_0x06c2('0x16'),_0x3026ae?util['inspect'](_0x3026ae,{'showHidden':![],'depth':null}):'');return _0x42cfd2(null);});}return _0x42cfd2(null);});};exports[_0x06c2('0x17')]=function(_0x395b2e){return new BPromise(function(_0x128e64,_0xb56c17){if(_0x395b2e){return getUser({'name':_0x395b2e})[_0x06c2('0x9')](function(_0x30bece){logger[_0x06c2('0x4')](_0x06c2('0x18'),_0x395b2e,_0x30bece?_0x06c2('0x15'):_0x06c2('0x12'));return _0x128e64(_0x30bece);})[_0x06c2('0xb')](function(_0x4c12ca){logger[_0x06c2('0x7')](_0x06c2('0x19'),_0x4c12ca?util[_0x06c2('0x5')](_0x4c12ca,{'showHidden':![],'depth':null}):'');return _0x128e64(null);});}return _0x128e64(null);});};exports[_0x06c2('0x1a')]=function(_0xe2b961){return new BPromise(function(_0x2c6a15,_0x4330f0){if(_0xe2b961){return client['request'](_0x06c2('0x1b'),{'options':{'raw':!![],'attributes':['id',_0x06c2('0xd'),_0x06c2('0x1c'),_0x06c2('0x1d'),_0x06c2('0x1e')],'where':{'name':_0xe2b961},'limit':0x1}})['then'](function(_0x3e4d7f){logger[_0x06c2('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0xe2b961,_0x3e4d7f?util[_0x06c2('0x5')](_0x3e4d7f,{'showHidden':![],'depth':null}):'');logger['info'](_0x06c2('0x1f'),_0xe2b961,_0x3e4d7f?_0x06c2('0x15'):_0x06c2('0x12'));return _0x2c6a15(_0x3e4d7f['result'][_0x06c2('0x20')]?_0x3e4d7f[_0x06c2('0x11')][0x0]:null);})[_0x06c2('0xb')](function(_0x5be2cd){logger[_0x06c2('0x7')](_0x06c2('0x21'),_0x5be2cd?util['inspect'](_0x5be2cd,{'showHidden':![],'depth':null}):'');return _0x2c6a15(null);});}return _0x2c6a15(null);});};exports['addTime']=function(_0x286ba4,_0x4cc4d3){return moment(_0x286ba4)[_0x06c2('0x22')](_0x4cc4d3,_0x06c2('0x23'))[_0x06c2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x06c2('0x25')]=function(_0x31a790,_0x1fcba8){return moment(_0x31a790)[_0x06c2('0x26')](_0x1fcba8,_0x06c2('0x23'))['format'](_0x06c2('0x27'));};exports[_0x06c2('0x28')]=function(_0x1c933d,_0x1cd245){return moment(_0x1c933d)[_0x06c2('0x29')](moment(_0x1cd245),_0x06c2('0x23'));};exports[_0x06c2('0x2a')]=function(_0x1ad475,_0x1fe07a){return parseInt(_0x1ad475,0xa)+parseInt(_0x1fe07a,0xa);};exports[_0x06c2('0x2b')]=function(){return moment()['format'](_0x06c2('0x27'));};exports[_0x06c2('0x2c')]=function(_0x1e053f,_0x1a6ba7){if(_0x1a6ba7){return moment(_0x1e053f)[_0x06c2('0x2c')](_0x1a6ba7);}return!![];};exports[_0x06c2('0x2d')]=function(_0x507e63,_0x552982){if(_0x552982){return moment(_0x507e63)['isBefore'](_0x552982);}else if(_0x507e63){return!![];}return![];}; \ No newline at end of file +var _0xc926=['error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','notfound','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','seconds','diffTime','diff','now','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect'];(function(_0x11dc93,_0x54f49a){var _0x58680e=function(_0x326fd4){while(--_0x326fd4){_0x11dc93['push'](_0x11dc93['shift']());}};_0x58680e(++_0x54f49a);}(_0xc926,0x196));var _0x6c92=function(_0x47d52d,_0x3c9536){_0x47d52d=_0x47d52d-0x0;var _0x5f4986=_0xc926[_0x47d52d];return _0x5f4986;};'use strict';var BPromise=require(_0x6c92('0x0'));var jayson=require(_0x6c92('0x1'));var moment=require('moment');var util=require(_0x6c92('0x2'));var client=jayson['client'][_0x6c92('0x3')]({'port':0x2329});var logger=require(_0x6c92('0x4'))('xdr');exports['info']=function(_0x5c76d6,_0x157c27){logger[_0x6c92('0x5')](_0x5c76d6,_0x157c27?util['inspect'](_0x157c27,{'showHidden':![],'depth':null}):'');};exports[_0x6c92('0x6')]=function(_0x413407,_0x3833b4){logger['debug'](_0x413407,_0x3833b4?util[_0x6c92('0x7')](_0x3833b4,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x57eafb,_0x3b753c){logger[_0x6c92('0x8')](_0x57eafb,_0x3b753c?util[_0x6c92('0x7')](_0x3b753c,{'showHidden':![],'depth':null}):'');};exports[_0x6c92('0x9')]=function(_0x462764,_0x4930ad){return client['request'](_0x462764,{'body':_0x4930ad})[_0x6c92('0xa')](function(_0x191a41){logger[_0x6c92('0x6')]('[utils][request]\x20name:%s',_0x462764,_0x191a41?util[_0x6c92('0x7')](_0x191a41,{'showHidden':![],'depth':null}):'');})[_0x6c92('0xb')](function(_0x245633){logger['error'](_0x6c92('0xc'),_0x462764,_0x245633?util['inspect'](_0x245633,{'showHidden':![],'depth':null}):'');});};function getUser(_0x287bd6){return client[_0x6c92('0x9')](_0x6c92('0xd'),{'options':{'raw':!![],'attributes':['id',_0x6c92('0xe'),_0x6c92('0xf'),_0x6c92('0x10')],'where':_0x287bd6,'limit':0x1}})[_0x6c92('0xa')](function(_0x28e8b2){logger[_0x6c92('0x6')](_0x6c92('0x11'),JSON[_0x6c92('0x12')](_0x287bd6),_0x28e8b2?util[_0x6c92('0x7')](_0x28e8b2,{'showHidden':![],'depth':null}):'');return _0x28e8b2[_0x6c92('0x13')][_0x6c92('0x14')]?_0x28e8b2[_0x6c92('0x13')][0x0]:null;});}exports[_0x6c92('0x15')]=function(_0x446032){return new BPromise(function(_0x276196,_0x2a7571){if(_0x446032){return getUser({'internal':_0x446032})[_0x6c92('0xa')](function(_0x200f38){logger[_0x6c92('0x5')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x446032,_0x200f38?'found':_0x6c92('0x16'));return _0x276196(_0x200f38);})[_0x6c92('0xb')](function(_0xac1b65){logger['error']('[utils][getUserByInternal]',_0xac1b65?util[_0x6c92('0x7')](_0xac1b65,{'showHidden':![],'depth':null}):'');return _0x276196(null);});}return _0x276196(null);});};exports[_0x6c92('0x17')]=function(_0xf2e0b4){return new BPromise(function(_0x4da864,_0x2a73f3){if(_0xf2e0b4){return getUser({'interface':_0xf2e0b4})[_0x6c92('0xa')](function(_0x4164f1){logger[_0x6c92('0x5')](_0x6c92('0x18'),_0xf2e0b4,_0x4164f1?_0x6c92('0x19'):'notfound');return _0x4da864(_0x4164f1);})[_0x6c92('0xb')](function(_0x5d6eb6){logger['error'](_0x6c92('0x1a'),_0x5d6eb6?util[_0x6c92('0x7')](_0x5d6eb6,{'showHidden':![],'depth':null}):'');return _0x4da864(null);});}return _0x4da864(null);});};exports[_0x6c92('0x1b')]=function(_0x1c43bc){return new BPromise(function(_0x402eb9,_0x50333f){if(_0x1c43bc){return getUser({'name':_0x1c43bc})[_0x6c92('0xa')](function(_0x250f89){logger[_0x6c92('0x5')](_0x6c92('0x1c'),_0x1c43bc,_0x250f89?_0x6c92('0x19'):'notfound');return _0x402eb9(_0x250f89);})[_0x6c92('0xb')](function(_0x61bd6b){logger['error']('[utils][getUserByName]',_0x61bd6b?util[_0x6c92('0x7')](_0x61bd6b,{'showHidden':![],'depth':null}):'');return _0x402eb9(null);});}return _0x402eb9(null);});};exports[_0x6c92('0x1d')]=function(_0x19ceb1){return new BPromise(function(_0x3ea21c,_0x34353b){if(_0x19ceb1){return client[_0x6c92('0x9')](_0x6c92('0x1e'),{'options':{'raw':!![],'attributes':['id',_0x6c92('0xf'),_0x6c92('0x1f'),_0x6c92('0x20'),_0x6c92('0x21')],'where':{'name':_0x19ceb1},'limit':0x1}})[_0x6c92('0xa')](function(_0x1cbaf7){logger['debug'](_0x6c92('0x22'),_0x19ceb1,_0x1cbaf7?util[_0x6c92('0x7')](_0x1cbaf7,{'showHidden':![],'depth':null}):'');logger[_0x6c92('0x5')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x19ceb1,_0x1cbaf7?_0x6c92('0x19'):_0x6c92('0x16'));return _0x3ea21c(_0x1cbaf7[_0x6c92('0x13')][_0x6c92('0x14')]?_0x1cbaf7[_0x6c92('0x13')][0x0]:null);})[_0x6c92('0xb')](function(_0x2c8d84){logger['error'](_0x6c92('0x23'),_0x2c8d84?util[_0x6c92('0x7')](_0x2c8d84,{'showHidden':![],'depth':null}):'');return _0x3ea21c(null);});}return _0x3ea21c(null);});};exports[_0x6c92('0x24')]=function(_0x5122df,_0x2cd8ff){return moment(_0x5122df)[_0x6c92('0x25')](_0x2cd8ff,'seconds')[_0x6c92('0x26')](_0x6c92('0x27'));};exports[_0x6c92('0x28')]=function(_0x129996,_0x529b2e){return moment(_0x129996)['subtract'](_0x529b2e,_0x6c92('0x29'))[_0x6c92('0x26')](_0x6c92('0x27'));};exports[_0x6c92('0x2a')]=function(_0x4d3492,_0x164a22){return moment(_0x4d3492)[_0x6c92('0x2b')](moment(_0x164a22),_0x6c92('0x29'));};exports['sumTime']=function(_0x5d9969,_0x5e9ed6){return parseInt(_0x5d9969,0xa)+parseInt(_0x5e9ed6,0xa);};exports[_0x6c92('0x2c')]=function(){return moment()[_0x6c92('0x26')](_0x6c92('0x27'));};exports['isAfter']=function(_0x40a208,_0x27e471){if(_0x27e471){return moment(_0x40a208)['isAfter'](_0x27e471);}return!![];};exports[_0x6c92('0x2d')]=function(_0x3126ac,_0xd9ceee){if(_0xd9ceee){return moment(_0x3126ac)[_0x6c92('0x2d')](_0xd9ceee);}else if(_0x3126ac){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 f3a7614..b2ef155 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 _0x0e59=['timestamp','error','api','auth','set','client-side-logger','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','logger','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','url','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','/var','log','xcally','client','role','name','ensureDir','join','then','catch','user','data'];(function(_0x557701,_0x180f95){var _0x4c6d09=function(_0x241b67){while(--_0x241b67){_0x557701['push'](_0x557701['shift']());}};_0x4c6d09(++_0x180f95);}(_0x0e59,0x13c));var _0x90e5=function(_0x5530a1,_0x5edb41){_0x5530a1=_0x5530a1-0x0;var _0x4d5c58=_0x0e59[_0x5530a1];return _0x4d5c58;};var fs=require(_0x90e5('0x0'));var _=require(_0x90e5('0x1'));var ewinston=require(_0x90e5('0x2'));var path=require('path');var util=require(_0x90e5('0x3'));var fileLogger=require('./loggers')[_0x90e5('0x4')];var safeTemplate=require(_0x90e5('0x5'))[_0x90e5('0x6')];var maskSensitiveData=require(_0x90e5('0x7'))['maskSensitiveData'];function ClientSideLogger(){function _0x538cc5(_0x4cbcee){var _0x307fbc=path['join'](_0x90e5('0x8'),_0x90e5('0x9'),_0x90e5('0xa'));var _0x5e7ed2=path['join'](_0x90e5('0xb'),_0x4cbcee[_0x90e5('0xc')]+'-'+_0x4cbcee[_0x90e5('0xd')]);return fs[_0x90e5('0xe')](path[_0x90e5('0xf')](_0x307fbc,_0x5e7ed2))[_0x90e5('0x10')](function(){var _0x52091c=fileLogger(_0x90e5('0xb'),path[_0x90e5('0xf')](_0x307fbc,_0x5e7ed2));return _0x52091c;})[_0x90e5('0x11')](function(_0x3d758d){throw _0x3d758d;});}this[_0x90e5('0x9')]=function(_0x33ab2f,_0x13dc74,_0x58f4d4,_0x503840){return _0x538cc5(_0x33ab2f[_0x90e5('0x12')])[_0x90e5('0x10')](function(_0x2c8f31){var _0x323422=_0x2c8f31[_0x13dc74];return _0x323422;})[_0x90e5('0x10')](function(_0x411c34){var _0x1a05cb=_0x33ab2f[_0x90e5('0x12')]?_0x33ab2f[_0x90e5('0x12')]['id']:'no-user';var _0x4401de=_0x503840[_0x90e5('0x13')];var _0x285abb=_0x503840[_0x90e5('0x14')];var _0x45661d=new Date(Number(_0x285abb));return _0x411c34(_0x1a05cb,_0x45661d,_0x58f4d4,_0x4401de);})[_0x90e5('0x11')](function(_0x529f4b){fileLogger(_0x90e5('0xb'))[_0x90e5('0x15')](_0x529f4b);});};}function setupLoggers(_0x1c2f0a){return new Promise(function(_0x5b3f54){var _0x59c563=new ClientSideLogger();var _0x1b5aff=fileLogger(_0x90e5('0x16'));var _0xd89f7a=fileLogger(_0x90e5('0x17'));_0x1c2f0a[_0x90e5('0x18')](_0x90e5('0x19'),_0x59c563);_0x1c2f0a[_0x90e5('0x1a')](ewinston['logger']({'winstonInstance':_0x1b5aff,'meta':![],'statusLevels':!![],'msg':function(_0xcbb401,_0x38a3c8){var _0xb37bb5=_0x90e5('0x1b');if(!_[_0x90e5('0x1c')](_0xcbb401[_0x90e5('0x1d')])){_0xb37bb5+=_0x90e5('0x1e');var _0x57038e=_0xcbb401['body'];maskSensitiveData(_0x57038e);}return safeTemplate(util[_0x90e5('0x1f')](_0xb37bb5,_0xcbb401[_0x90e5('0x20')],_0xcbb401[_0x90e5('0x21')][_0x90e5('0x22')]?_0xcbb401[_0x90e5('0x21')]['x-forwarded-for']:_0xcbb401[_0x90e5('0x23')][_0x90e5('0x24')]||_0xcbb401['ip'],_0xcbb401['url'],_0x38a3c8[_0x90e5('0x25')],_0x38a3c8[_0x90e5('0x26')],_0xcbb401[_0x90e5('0x12')]?_0xcbb401[_0x90e5('0x12')]['id']:null,_0xcbb401[_0x90e5('0x12')]?_0xcbb401[_0x90e5('0x12')][_0x90e5('0xd')]:null,_0xcbb401[_0x90e5('0x12')]?_0xcbb401[_0x90e5('0x12')][_0x90e5('0xc')]:null,_0x57038e?util['inspect'](_0x57038e,![],null):''));}}));_0x1c2f0a[_0x90e5('0x1a')](ewinston[_0x90e5('0x27')]({'winstonInstance':_0xd89f7a,'meta':![],'statusLevels':!![],'msg':function(_0x3906fe,_0x67f5d1){var _0x4b1eb6='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x3906fe[_0x90e5('0x1d')]&&_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x28')]&&_0x3906fe['body']['agent_id']){_0x4b1eb6=_0x90e5('0x29');}return util['format'](_0x4b1eb6,_0x3906fe[_0x90e5('0x20')],_0x3906fe[_0x90e5('0x21')][_0x90e5('0x22')]?_0x3906fe[_0x90e5('0x21')][_0x90e5('0x22')]:_0x3906fe['connection'][_0x90e5('0x24')]||_0x3906fe['ip'],_0x3906fe[_0x90e5('0x2a')],_0x67f5d1['statusCode'],_0x67f5d1[_0x90e5('0x26')],_0x3906fe['user']?_0x3906fe[_0x90e5('0x12')]['id']:null,_0x3906fe[_0x90e5('0x12')]?_0x3906fe[_0x90e5('0x12')][_0x90e5('0xd')]:null,_0x3906fe[_0x90e5('0x12')]?_0x3906fe['user'][_0x90e5('0xc')]:null,_0x3906fe[_0x90e5('0x1d')]&&_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x28')]?_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x28')]:_0x90e5('0x2b'),_0x3906fe['body']&&_0x3906fe[_0x90e5('0x1d')]['agent_id']?_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x2c')]:'',_0x3906fe['body']&&_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x2d')]?_0x3906fe[_0x90e5('0x1d')][_0x90e5('0x2d')]:'');},'ignoreRoute':function(_0x1b9431){var _0x5f27e3=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5f27e3[_0x90e5('0x2e')](_0x1b9431[_0x90e5('0x2a')]);}}));return _0x5b3f54();});}exports[_0x90e5('0x2f')]=setupLoggers; \ No newline at end of file +var _0xf124=['join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','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','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','url','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData'];(function(_0x12ad92,_0x45ed40){var _0x5dd3e0=function(_0x17f1c7){while(--_0x17f1c7){_0x12ad92['push'](_0x12ad92['shift']());}};_0x5dd3e0(++_0x45ed40);}(_0xf124,0xf0));var _0x4f12=function(_0xbfc560,_0x311fba){_0xbfc560=_0xbfc560-0x0;var _0x47b022=_0xf124[_0xbfc560];return _0x47b022;};var fs=require(_0x4f12('0x0'));var _=require(_0x4f12('0x1'));var ewinston=require(_0x4f12('0x2'));var path=require(_0x4f12('0x3'));var util=require(_0x4f12('0x4'));var fileLogger=require('./loggers')[_0x4f12('0x5')];var safeTemplate=require(_0x4f12('0x6'))[_0x4f12('0x7')];var maskSensitiveData=require(_0x4f12('0x8'))[_0x4f12('0x9')];function ClientSideLogger(){function _0x1b4c0b(_0x2aa376){var _0x15bbbb=path[_0x4f12('0xa')](_0x4f12('0xb'),_0x4f12('0xc'),_0x4f12('0xd'));var _0x540e34=path['join'](_0x4f12('0xe'),_0x2aa376[_0x4f12('0xf')]+'-'+_0x2aa376[_0x4f12('0x10')]);return fs[_0x4f12('0x11')](path[_0x4f12('0xa')](_0x15bbbb,_0x540e34))[_0x4f12('0x12')](function(){var _0xcc0135=fileLogger(_0x4f12('0xe'),path[_0x4f12('0xa')](_0x15bbbb,_0x540e34));return _0xcc0135;})[_0x4f12('0x13')](function(_0x4624f4){throw _0x4624f4;});}this[_0x4f12('0xc')]=function(_0x5ce8e4,_0x463a27,_0x232dd2,_0x1425da){return _0x1b4c0b(_0x5ce8e4[_0x4f12('0x14')])['then'](function(_0x49c5f7){var _0x43e4ab=_0x49c5f7[_0x463a27];return _0x43e4ab;})[_0x4f12('0x12')](function(_0x4d1e2e){var _0x4cee12=_0x5ce8e4[_0x4f12('0x14')]?_0x5ce8e4[_0x4f12('0x14')]['id']:_0x4f12('0x15');var _0x37bc6b=_0x1425da['data'];var _0x40fd24=_0x1425da[_0x4f12('0x16')];var _0x45b529=new Date(Number(_0x40fd24));return _0x4d1e2e(_0x4cee12,_0x45b529,_0x232dd2,_0x37bc6b);})[_0x4f12('0x13')](function(_0x2545ce){fileLogger('client')[_0x4f12('0x17')](_0x2545ce);});};}function setupLoggers(_0x495be3){return new Promise(function(_0x1b7dc9){var _0x2187f4=new ClientSideLogger();var _0x93d617=fileLogger(_0x4f12('0x18'));var _0x11c9e9=fileLogger(_0x4f12('0x19'));_0x495be3[_0x4f12('0x1a')](_0x4f12('0x1b'),_0x2187f4);_0x495be3[_0x4f12('0x1c')](ewinston[_0x4f12('0x1d')]({'winstonInstance':_0x93d617,'meta':![],'statusLevels':!![],'msg':function(_0x1dabb6,_0x1d0ac3){var _0x3d991e=_0x4f12('0x1e');if(!_['isEmpty'](_0x1dabb6[_0x4f12('0x1f')])){_0x3d991e+=_0x4f12('0x20');var _0x1633cb=_0x1dabb6[_0x4f12('0x1f')];maskSensitiveData(_0x1633cb);}return safeTemplate(util[_0x4f12('0x21')](_0x3d991e,_0x1dabb6[_0x4f12('0x22')],_0x1dabb6[_0x4f12('0x23')]['x-forwarded-for']?_0x1dabb6[_0x4f12('0x23')][_0x4f12('0x24')]:_0x1dabb6[_0x4f12('0x25')][_0x4f12('0x26')]||_0x1dabb6['ip'],_0x1dabb6['url'],_0x1d0ac3[_0x4f12('0x27')],_0x1d0ac3[_0x4f12('0x28')],_0x1dabb6[_0x4f12('0x14')]?_0x1dabb6[_0x4f12('0x14')]['id']:null,_0x1dabb6[_0x4f12('0x14')]?_0x1dabb6['user']['name']:null,_0x1dabb6['user']?_0x1dabb6[_0x4f12('0x14')][_0x4f12('0xf')]:null,_0x1633cb?util[_0x4f12('0x29')](_0x1633cb,![],null):''));}}));_0x495be3['use'](ewinston[_0x4f12('0x1d')]({'winstonInstance':_0x11c9e9,'meta':![],'statusLevels':!![],'msg':function(_0x4ffd5e,_0x2df810){var _0x5772d2=_0x4f12('0x2a');if(_0x4ffd5e['body']&&_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2b')]&&_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2c')]){_0x5772d2='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4f12('0x21')](_0x5772d2,_0x4ffd5e[_0x4f12('0x22')],_0x4ffd5e[_0x4f12('0x23')][_0x4f12('0x24')]?_0x4ffd5e[_0x4f12('0x23')]['x-forwarded-for']:_0x4ffd5e[_0x4f12('0x25')]['remoteAddress']||_0x4ffd5e['ip'],_0x4ffd5e[_0x4f12('0x2d')],_0x2df810['statusCode'],_0x2df810[_0x4f12('0x28')],_0x4ffd5e[_0x4f12('0x14')]?_0x4ffd5e[_0x4f12('0x14')]['id']:null,_0x4ffd5e[_0x4f12('0x14')]?_0x4ffd5e[_0x4f12('0x14')][_0x4f12('0x10')]:null,_0x4ffd5e[_0x4f12('0x14')]?_0x4ffd5e[_0x4f12('0x14')]['role']:null,_0x4ffd5e[_0x4f12('0x1f')]&&_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2b')]?_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2b')]:_0x4f12('0x2e'),_0x4ffd5e[_0x4f12('0x1f')]&&_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2c')]?_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2c')]:'',_0x4ffd5e[_0x4f12('0x1f')]&&_0x4ffd5e['body']['agent_name']?_0x4ffd5e[_0x4f12('0x1f')][_0x4f12('0x2f')]:'');},'ignoreRoute':function(_0x1a107e){var _0x362f74=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x362f74[_0x4f12('0x30')](_0x1a107e[_0x4f12('0x2d')]);}}));return _0x1b7dc9();});}exports[_0x4f12('0x31')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index eb8f342..631e74d 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a2a=['join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','format','includes','dowCompare','date','daysInMonth','min','max','domCompare','MMM','monthCompare','test','isMoment','padStart','length','iftime','moment-timezone','map','source'];(function(_0xbb27b,_0x53edbe){var _0x5081fb=function(_0x187ba9){while(--_0x187ba9){_0xbb27b['push'](_0xbb27b['shift']());}};_0x5081fb(++_0x53edbe);}(_0x1a2a,0x183));var _0xa1a2=function(_0x408a02,_0x478ca0){_0x408a02=_0x408a02-0x0;var _0x579bce=_0x1a2a[_0x408a02];return _0x579bce;};var _=require('lodash');var moment=require(_0xa1a2('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][_0xa1a2('0x1')](function(_0x4a6c8e){return _0x4a6c8e[_0xa1a2('0x2')];})[_0xa1a2('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xa1a2('0x4');var EINVALID_DATE=_0xa1a2('0x5');function throwIfDateNotValid(_0x4bb7c5){if(!_0x4bb7c5[_0xa1a2('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xc2c994){var _0x410338=_0xc2c994[_0xa1a2('0x7')](':')[_0xa1a2('0x1')](function(_0x4917a5){return parseInt(_0x4917a5,0xa);});var _0xc370e1=_0x410338[0x0];var _0x3b4fc5=_0x410338[0x1];if(_0xc370e1<0x0||_0xc370e1>0x17||_0x3b4fc5<0x0||_0x3b4fc5>0x3b){throw new Error(EINVALID_DATE);}return[_0xc370e1,_0x3b4fc5];}function circularDoWInterval(_0x302865,_0x2f3168){if(_0x302865===_0x2f3168){return[_0x302865];}else{var _0x455c39=moment[_0xa1a2('0x8')]();moment['locale']('en');var _0x4fc502=moment[_0xa1a2('0x9')]()[_0xa1a2('0x1')](function(_0x4238b8){return _0x4238b8[_0xa1a2('0xa')]();});moment[_0xa1a2('0x8')](_0x455c39);var _0x1ee20c=_0x4fc502[_0xa1a2('0xb')](_0x302865);var _0x1cd6ad=_0x4fc502['indexOf'](_0x2f3168);if(_0x1cd6ad>_0x1ee20c){return _0x4fc502[_0xa1a2('0xc')](_0x1ee20c,_0x1cd6ad+0x1);}else{var _0x230321=_0x4fc502[_0xa1a2('0xc')](0x0,_0x1cd6ad+0x1);var _0x57b18f=_0x4fc502[_0xa1a2('0xc')](_0x1ee20c);return _0x57b18f[_0xa1a2('0xd')](_0x230321);}}}module[_0xa1a2('0xe')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x1fb3fa,_0xcfa5c3){if(_0x1fb3fa===_0xcfa5c3){return[_0x1fb3fa];}else{var _0x23f4e1=moment['locale']();moment[_0xa1a2('0x8')]('en');var _0x52f8b8=moment[_0xa1a2('0xf')]()[_0xa1a2('0x1')](function(_0x2b37d9){return _0x2b37d9[_0xa1a2('0xa')]();});moment[_0xa1a2('0x8')](_0x23f4e1);var _0x39ce1f=_0x52f8b8[_0xa1a2('0xb')](_0x1fb3fa);var _0x2179d7=_0x52f8b8[_0xa1a2('0xb')](_0xcfa5c3);if(_0x2179d7>_0x39ce1f){return _0x52f8b8['slice'](_0x39ce1f,_0x2179d7+0x1);}else{var _0x3e08fe=_0x52f8b8[_0xa1a2('0xc')](0x0,_0x2179d7+0x1);var _0x2edf71=_0x52f8b8['slice'](_0x39ce1f);return _0x2edf71[_0xa1a2('0xd')](_0x3e08fe);}}}module[_0xa1a2('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x1f90e7){var _0xe0bba0=parseInt(_0x1f90e7,0xa);if(_0xe0bba0<0x1||_0xe0bba0>0x1f){throw new Error(EINVALID_DATE);}return _0xe0bba0;}function timeCompare(_0x4b5f93,_0x203d85,_0x59f915){var _0x749bf0=_0x4b5f93[_0xa1a2('0x10')]();var _0x15e798=extractTime(_0x203d85);var _0xf9d9ed=_0x15e798[0x0];var _0x238c66=_0x15e798[0x1];var _0x5d9a4f=_0x4b5f93[_0xa1a2('0x10')]()[_0xa1a2('0x11')](_0xf9d9ed)[_0xa1a2('0x12')](_0x238c66);throwIfDateNotValid(_0x5d9a4f);var _0x12924d=extractTime(_0x59f915);var _0x6bd809=_0x12924d[0x0];var _0x54b8b7=_0x12924d[0x1];var _0x3165db=_0x4b5f93[_0xa1a2('0x10')]()['hours'](_0x6bd809)[_0xa1a2('0x12')](_0x54b8b7);throwIfDateNotValid(_0x3165db);if(_0x3165db[_0xa1a2('0x13')](_0x5d9a4f)){var _0x4d9f77=_0x749bf0['clone']()[_0xa1a2('0x14')](_0xa1a2('0x15'));var _0x5cee4b=_0x749bf0[_0xa1a2('0x10')]()[_0xa1a2('0x16')](_0xa1a2('0x15'));return _0x749bf0[_0xa1a2('0x17')](_0x5d9a4f,_0x5cee4b,undefined,'[]')||_0x749bf0['isBetween'](_0x4d9f77,_0x3165db,undefined,'[]');}else{return _0x749bf0[_0xa1a2('0x17')](_0x5d9a4f,_0x3165db,undefined,'[]');}}module[_0xa1a2('0xe')]['timeCompare']=timeCompare;function dowCompare(_0x2af888,_0x483681,_0x5cbfb6){var _0x1e5ce0=_0x2af888[_0xa1a2('0x8')]('en')[_0xa1a2('0x18')]('ddd')['toLowerCase']();return circularDoWInterval(_0x483681,_0x5cbfb6)[_0xa1a2('0x19')](_0x1e5ce0);}module[_0xa1a2('0xe')][_0xa1a2('0x1a')]=dowCompare;function domCompare(_0x4451e4,_0x3c5cfa,_0x7ca6e3){var _0x407bf5=_0x4451e4[_0xa1a2('0x1b')]();if(_0x3c5cfa===_0x7ca6e3){return _0x407bf5===_0x3c5cfa;}else{var _0x101756=_0x4451e4[_0xa1a2('0x1c')]();var _0x2dfbd5=_0x3c5cfa<_0x7ca6e3;let _0x52ab4d=![];var _0x17e9a2=0x0;var _0x3e01b8=0x0;if(_0x2dfbd5){_0x17e9a2=Math['max'](0x1,_0x3c5cfa);_0x3e01b8=Math['min'](_0x7ca6e3,_0x101756);_0x52ab4d=_0x407bf5>=_0x17e9a2&&_0x407bf5<=_0x3e01b8;}else{_0x17e9a2=Math[_0xa1a2('0x1d')](_0x3c5cfa,_0x101756);_0x3e01b8=Math[_0xa1a2('0x1e')](0x1,_0x7ca6e3);_0x52ab4d=_0x407bf5>=_0x17e9a2||_0x407bf5<=_0x3e01b8;}return _0x52ab4d;}}module[_0xa1a2('0xe')][_0xa1a2('0x1f')]=domCompare;function monthCompare(_0xd6837b,_0x3fe92f,_0x44b23c){var _0x1b8b2d=_0xd6837b['locale']('en')['format'](_0xa1a2('0x20'))[_0xa1a2('0xa')]();return circularMonthInterval(_0x3fe92f,_0x44b23c)['includes'](_0x1b8b2d);}module['exports'][_0xa1a2('0x21')]=monthCompare;function iftime(_0x48c91c,_0x3b8733=moment['tz']['guess'](),_0x15dc59=moment()){if(!validateRx[_0xa1a2('0x22')](_0x48c91c)){throw new Error(EINVALID_STRING);}else{var _0x23a82f=(moment[_0xa1a2('0x23')](_0x15dc59)?_0x15dc59[_0xa1a2('0x10')]():moment(_0x15dc59))['tz'](_0x3b8733)['locale']('en');throwIfDateNotValid(_0x23a82f);var _0x477fe8=_0x48c91c[_0xa1a2('0x7')](',');var _0x16cb8a=_0x477fe8[0x0];var _0x4c7d12=_0x477fe8[0x1];var _0x404f35=_0x477fe8[0x2];var _0x1f85d5=_0x477fe8[0x3];let _0x1b2f19=!![];if(_0x16cb8a!=='*'){var _0x2d27f8=_0x16cb8a[_0xa1a2('0x7')]('-');var _0x3c1b8a=_[_0xa1a2('0x24')](_0x2d27f8[0x0],0x5,'0');var _0x31ebc4=_0x2d27f8['length']===0x2?_[_0xa1a2('0x24')](_0x2d27f8[0x1],0x5,'0'):_0x3c1b8a;_0x1b2f19=timeCompare(_0x23a82f,_0x3c1b8a,_0x31ebc4);}let _0x5f5d03=!![];if(_0x4c7d12!=='*'){var _0x3513dc=_0x4c7d12[_0xa1a2('0x7')]('-');var _0x59f747=_0x3513dc[0x0];var _0x41cee0=_0x3513dc[_0xa1a2('0x25')]===0x2?_0x3513dc[0x1]:_0x59f747;_0x5f5d03=dowCompare(_0x23a82f,_0x59f747,_0x41cee0);}let _0x353fcf=!![];if(_0x404f35!=='*'){var _0x24a055=_0x404f35[_0xa1a2('0x7')]('-');var _0x2d53a0=parseDom(_0x24a055[0x0]);var _0x1a1540=_0x24a055['length']===0x2?parseDom(_0x24a055[0x1]):_0x2d53a0;_0x353fcf=domCompare(_0x23a82f,_0x2d53a0,_0x1a1540);}let _0x3f391f=!![];if(_0x1f85d5!=='*'){var _0x544801=_0x1f85d5[_0xa1a2('0x7')]('-');var _0x27513b=_0x544801[0x0];var _0x22fe9c=_0x544801[_0xa1a2('0x25')]===0x2?_0x544801[0x1]:_0x544801[0x0];_0x3f391f=monthCompare(_0x23a82f,_0x27513b,_0x22fe9c);}return _0x1b2f19&&_0x5f5d03&&_0x353fcf&&_0x3f391f;}}module[_0xa1a2('0xe')][_0xa1a2('0x26')]=iftime; \ No newline at end of file +var _0xf395=['lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','padStart','length','iftime'];(function(_0x3cbf7d,_0x317953){var _0x457b0d=function(_0x35592a){while(--_0x35592a){_0x3cbf7d['push'](_0x3cbf7d['shift']());}};_0x457b0d(++_0x317953);}(_0xf395,0x19a));var _0x5f39=function(_0x268186,_0x4dc3e4){_0x268186=_0x268186-0x0;var _0x3c3d1a=_0xf395[_0x268186];return _0x3c3d1a;};var _=require(_0x5f39('0x0'));var moment=require(_0x5f39('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][_0x5f39('0x2')](function(_0x41561a){return _0x41561a[_0x5f39('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x5f39('0x4');var EINVALID_DATE=_0x5f39('0x5');function throwIfDateNotValid(_0x1ce5e0){if(!_0x1ce5e0[_0x5f39('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0xf0b2f4){var _0x5165bd=_0xf0b2f4[_0x5f39('0x7')](':')[_0x5f39('0x2')](function(_0x3942d0){return parseInt(_0x3942d0,0xa);});var _0xaa849=_0x5165bd[0x0];var _0x1eb3c6=_0x5165bd[0x1];if(_0xaa849<0x0||_0xaa849>0x17||_0x1eb3c6<0x0||_0x1eb3c6>0x3b){throw new Error(EINVALID_DATE);}return[_0xaa849,_0x1eb3c6];}function circularDoWInterval(_0x3d6314,_0x3c9a78){if(_0x3d6314===_0x3c9a78){return[_0x3d6314];}else{var _0x582b7a=moment[_0x5f39('0x8')]();moment[_0x5f39('0x8')]('en');var _0x4440cb=moment[_0x5f39('0x9')]()[_0x5f39('0x2')](function(_0x40d7ae){return _0x40d7ae[_0x5f39('0xa')]();});moment[_0x5f39('0x8')](_0x582b7a);var _0x3948ce=_0x4440cb[_0x5f39('0xb')](_0x3d6314);var _0x6089f7=_0x4440cb[_0x5f39('0xb')](_0x3c9a78);if(_0x6089f7>_0x3948ce){return _0x4440cb[_0x5f39('0xc')](_0x3948ce,_0x6089f7+0x1);}else{var _0x240401=_0x4440cb[_0x5f39('0xc')](0x0,_0x6089f7+0x1);var _0x464ff1=_0x4440cb['slice'](_0x3948ce);return _0x464ff1[_0x5f39('0xd')](_0x240401);}}}module[_0x5f39('0xe')][_0x5f39('0xf')]=circularDoWInterval;function circularMonthInterval(_0x29253f,_0x296412){if(_0x29253f===_0x296412){return[_0x29253f];}else{var _0x1b32c0=moment[_0x5f39('0x8')]();moment['locale']('en');var _0x21232c=moment['monthsShort']()[_0x5f39('0x2')](function(_0x34c762){return _0x34c762[_0x5f39('0xa')]();});moment[_0x5f39('0x8')](_0x1b32c0);var _0x3e1432=_0x21232c[_0x5f39('0xb')](_0x29253f);var _0x445d3d=_0x21232c[_0x5f39('0xb')](_0x296412);if(_0x445d3d>_0x3e1432){return _0x21232c[_0x5f39('0xc')](_0x3e1432,_0x445d3d+0x1);}else{var _0x3ece58=_0x21232c[_0x5f39('0xc')](0x0,_0x445d3d+0x1);var _0x40e7ba=_0x21232c['slice'](_0x3e1432);return _0x40e7ba['concat'](_0x3ece58);}}}module[_0x5f39('0xe')][_0x5f39('0x10')]=circularMonthInterval;function parseDom(_0x270ac6){var _0x18a944=parseInt(_0x270ac6,0xa);if(_0x18a944<0x1||_0x18a944>0x1f){throw new Error(EINVALID_DATE);}return _0x18a944;}function timeCompare(_0x29f5d0,_0x5cc622,_0x364039){var _0x541879=_0x29f5d0['clone']();var _0x29c40e=extractTime(_0x5cc622);var _0x1771d3=_0x29c40e[0x0];var _0x1c6afa=_0x29c40e[0x1];var _0xe49942=_0x29f5d0[_0x5f39('0x11')]()[_0x5f39('0x12')](_0x1771d3)[_0x5f39('0x13')](_0x1c6afa);throwIfDateNotValid(_0xe49942);var _0x547ec7=extractTime(_0x364039);var _0x298bab=_0x547ec7[0x0];var _0x94f619=_0x547ec7[0x1];var _0x1fa11a=_0x29f5d0[_0x5f39('0x11')]()['hours'](_0x298bab)[_0x5f39('0x13')](_0x94f619);throwIfDateNotValid(_0x1fa11a);if(_0x1fa11a[_0x5f39('0x14')](_0xe49942)){var _0x35f4da=_0x541879['clone']()[_0x5f39('0x15')](_0x5f39('0x16'));var _0xf8593f=_0x541879[_0x5f39('0x11')]()[_0x5f39('0x17')]('day');return _0x541879['isBetween'](_0xe49942,_0xf8593f,undefined,'[]')||_0x541879[_0x5f39('0x18')](_0x35f4da,_0x1fa11a,undefined,'[]');}else{return _0x541879[_0x5f39('0x18')](_0xe49942,_0x1fa11a,undefined,'[]');}}module['exports'][_0x5f39('0x19')]=timeCompare;function dowCompare(_0x62266d,_0x4a22c6,_0x5018a0){var _0x23e5a3=_0x62266d['locale']('en')[_0x5f39('0x1a')](_0x5f39('0x1b'))[_0x5f39('0xa')]();return circularDoWInterval(_0x4a22c6,_0x5018a0)['includes'](_0x23e5a3);}module[_0x5f39('0xe')][_0x5f39('0x1c')]=dowCompare;function domCompare(_0xfccf39,_0x2e6951,_0x239727){var _0x32671c=_0xfccf39['date']();if(_0x2e6951===_0x239727){return _0x32671c===_0x2e6951;}else{var _0x135e76=_0xfccf39['daysInMonth']();var _0x3ddd8b=_0x2e6951<_0x239727;let _0x572b08=![];var _0x471893=0x0;var _0x200107=0x0;if(_0x3ddd8b){_0x471893=Math[_0x5f39('0x1d')](0x1,_0x2e6951);_0x200107=Math[_0x5f39('0x1e')](_0x239727,_0x135e76);_0x572b08=_0x32671c>=_0x471893&&_0x32671c<=_0x200107;}else{_0x471893=Math[_0x5f39('0x1e')](_0x2e6951,_0x135e76);_0x200107=Math[_0x5f39('0x1d')](0x1,_0x239727);_0x572b08=_0x32671c>=_0x471893||_0x32671c<=_0x200107;}return _0x572b08;}}module[_0x5f39('0xe')][_0x5f39('0x1f')]=domCompare;function monthCompare(_0x5527f0,_0xe206cc,_0x2d28c7){var _0x5050a9=_0x5527f0[_0x5f39('0x8')]('en')[_0x5f39('0x1a')](_0x5f39('0x20'))['toLowerCase']();return circularMonthInterval(_0xe206cc,_0x2d28c7)[_0x5f39('0x21')](_0x5050a9);}module[_0x5f39('0xe')][_0x5f39('0x22')]=monthCompare;function iftime(_0x46dedc,_0x46fdcc=moment['tz'][_0x5f39('0x23')](),_0x5b79cb=moment()){if(!validateRx[_0x5f39('0x24')](_0x46dedc)){throw new Error(EINVALID_STRING);}else{var _0x30ef7b=(moment[_0x5f39('0x25')](_0x5b79cb)?_0x5b79cb['clone']():moment(_0x5b79cb))['tz'](_0x46fdcc)[_0x5f39('0x8')]('en');throwIfDateNotValid(_0x30ef7b);var _0x3d6300=_0x46dedc[_0x5f39('0x7')](',');var _0x1688f7=_0x3d6300[0x0];var _0x4ab734=_0x3d6300[0x1];var _0x52e08b=_0x3d6300[0x2];var _0x368584=_0x3d6300[0x3];let _0x38015f=!![];if(_0x1688f7!=='*'){var _0x3f39af=_0x1688f7[_0x5f39('0x7')]('-');var _0x2f41dc=_[_0x5f39('0x26')](_0x3f39af[0x0],0x5,'0');var _0x5de0bc=_0x3f39af['length']===0x2?_[_0x5f39('0x26')](_0x3f39af[0x1],0x5,'0'):_0x2f41dc;_0x38015f=timeCompare(_0x30ef7b,_0x2f41dc,_0x5de0bc);}let _0x53317d=!![];if(_0x4ab734!=='*'){var _0x3374f1=_0x4ab734[_0x5f39('0x7')]('-');var _0x37f218=_0x3374f1[0x0];var _0x13cd3c=_0x3374f1[_0x5f39('0x27')]===0x2?_0x3374f1[0x1]:_0x37f218;_0x53317d=dowCompare(_0x30ef7b,_0x37f218,_0x13cd3c);}let _0x16b792=!![];if(_0x52e08b!=='*'){var _0x590be1=_0x52e08b[_0x5f39('0x7')]('-');var _0x299908=parseDom(_0x590be1[0x0]);var _0x2a4a0a=_0x590be1['length']===0x2?parseDom(_0x590be1[0x1]):_0x299908;_0x16b792=domCompare(_0x30ef7b,_0x299908,_0x2a4a0a);}let _0x258167=!![];if(_0x368584!=='*'){var _0x3678cc=_0x368584[_0x5f39('0x7')]('-');var _0x27a162=_0x3678cc[0x0];var _0x46e72f=_0x3678cc[_0x5f39('0x27')]===0x2?_0x3678cc[0x1]:_0x3678cc[0x0];_0x258167=monthCompare(_0x30ef7b,_0x27a162,_0x46e72f);}return _0x38015f&&_0x53317d&&_0x16b792&&_0x258167;}}module['exports'][_0x5f39('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 3b31409..d403bcc 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54d7=['white','bold\x20white','bold\x20magenta','bold\x20blue','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','warn','%s-%s','error','File','Console','path','util','moment','winston','debugLevel','toLowerCase','redBG\x20white','red','bold\x20yellow'];(function(_0x5f2a38,_0x388192){var _0x37aa6b=function(_0x4b263d){while(--_0x4b263d){_0x5f2a38['push'](_0x5f2a38['shift']());}};_0x37aa6b(++_0x388192);}(_0x54d7,0xc9));var _0x754d=function(_0x1842c3,_0x2963c5){_0x1842c3=_0x1842c3-0x0;var _0x17c2a9=_0x54d7[_0x1842c3];return _0x17c2a9;};'use strict';var path=require(_0x754d('0x0'));var util=require(_0x754d('0x1'));var moment=require(_0x754d('0x2'));var winston=require(_0x754d('0x3'));var config=require('../config/environment');var debugLevel=config[_0x754d('0x4')]?config['debugLevel'][_0x754d('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x754d('0x6'),'error':_0x754d('0x7'),'warn':_0x754d('0x8'),'info':_0x754d('0x9'),'print':_0x754d('0xa'),'success':'bold\x20green','http':'gray','verbose':_0x754d('0xb'),'debug':_0x754d('0xc'),'silly':'bold\x20cyan'};winston[_0x754d('0xd')](XC_LOG_COLORS);function getLogFileName(_0x248bbc,_0x56b5fa,_0x3b4bcf){var _0x2c9f2c=_0x248bbc||_0x754d('0xe');return path[_0x754d('0xf')](_0x2c9f2c,util['format'](_0x754d('0x10'),_0x56b5fa,_0x3b4bcf));}function formatter(_0x21d114,_0x4db94a){_0x4db94a[_0x754d('0x11')]=_0x4db94a[_0x754d('0x11')][_0x754d('0x12')](/@@{/g,_0x754d('0x13'))[_0x754d('0x12')](/}@@/g,_0x754d('0x14'))[_0x754d('0x12')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x754d('0x15')](_0x754d('0x16')),_0x4db94a[_0x754d('0x17')][_0x754d('0x18')](),_0x21d114,_0x4db94a[_0x754d('0x11')]);}function fileFormat(_0x37c39d,_0x492f67){_0x492f67[_0x754d('0x11')]=_0x492f67[_0x754d('0x11')][_0x754d('0x12')](/@@{/g,_0x754d('0x13'))['replace'](/}@@/g,'}}}')[_0x754d('0x12')](/@{/g,'{{')[_0x754d('0x12')](/}@/g,'}}');var _0x374ddc=_0x492f67[_0x754d('0x19')]&&Object[_0x754d('0x1a')](_0x492f67['meta'])['length']?'\x0a\x09'+JSON['stringify'](_0x492f67[_0x754d('0x19')]):'';return util[_0x754d('0x15')](_0x754d('0x1b'),moment()[_0x754d('0x15')](_0x754d('0x16')),_0x492f67['level'][_0x754d('0x18')](),_0x37c39d,_0x492f67[_0x754d('0x11')],_0x374ddc);}function consoleLogger(){var _0x351ba0=new winston[(_0x754d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x754d('0x1d'))]['Console']({'level':_0x754d('0x1e'),'json':![],'formatter':function(_0x4fe3d1){return formatter('',_0x4fe3d1);}})]});return _0x351ba0;}function fileLogger(_0x5a9944,_0x3decf4){var _0xff29dc=new winston[(_0x754d('0x1c'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x754d('0x1d'))]['File']({'name':util['format'](_0x754d('0x1f'),_0x5a9944,'error'),'filename':getLogFileName(_0x3decf4,_0x5a9944,_0x754d('0x20')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x548aab){return fileFormat(_0x5a9944,_0x548aab);}}),new winston[(_0x754d('0x1d'))][(_0x754d('0x21'))]({'name':util[_0x754d('0x15')]('%s-%s',_0x5a9944,debugLevel),'filename':getLogFileName(_0x3decf4,_0x5a9944,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5aa202){return fileFormat(_0x5a9944,_0x5aa202);}}),new winston[(_0x754d('0x1d'))][(_0x754d('0x22'))]({'level':'warn','json':![],'formatter':function(_0x344410){return fileFormat(_0x5a9944,_0x344410);}})]});return _0xff29dc;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x27c7=['error','%s-%s','warn','path','util','winston','../config/environment','debugLevel','toLowerCase','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','Logger','File'];(function(_0xc8009d,_0x1373fb){var _0x3ab60c=function(_0x2304f0){while(--_0x2304f0){_0xc8009d['push'](_0xc8009d['shift']());}};_0x3ab60c(++_0x1373fb);}(_0x27c7,0x78));var _0x727c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x27c7[_0xbca1b1];return _0x4e1686;};'use strict';var path=require(_0x727c('0x0'));var util=require(_0x727c('0x1'));var moment=require('moment');var winston=require(_0x727c('0x2'));var config=require(_0x727c('0x3'));var debugLevel=config[_0x727c('0x4')]?config[_0x727c('0x4')][_0x727c('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x727c('0x6'),'warn':_0x727c('0x7'),'info':_0x727c('0x8'),'print':_0x727c('0x9'),'success':_0x727c('0xa'),'http':_0x727c('0xb'),'verbose':_0x727c('0xc'),'debug':_0x727c('0xd'),'silly':_0x727c('0xe')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x55b882,_0x28b9e5,_0x45bff0){var _0x41b324=_0x55b882||_0x727c('0xf');return path[_0x727c('0x10')](_0x41b324,util[_0x727c('0x11')](_0x727c('0x12'),_0x28b9e5,_0x45bff0));}function formatter(_0x3dac65,_0x280269){_0x280269[_0x727c('0x13')]=_0x280269['message'][_0x727c('0x14')](/@@{/g,_0x727c('0x15'))[_0x727c('0x14')](/}@@/g,_0x727c('0x16'))[_0x727c('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0x727c('0x11')](_0x727c('0x17'),moment()['format'](_0x727c('0x18')),_0x280269[_0x727c('0x19')][_0x727c('0x1a')](),_0x3dac65,_0x280269[_0x727c('0x13')]);}function fileFormat(_0x2bb16e,_0x85fa9c){_0x85fa9c[_0x727c('0x13')]=_0x85fa9c['message'][_0x727c('0x14')](/@@{/g,'{{{')[_0x727c('0x14')](/}@@/g,_0x727c('0x16'))[_0x727c('0x14')](/@{/g,'{{')[_0x727c('0x14')](/}@/g,'}}');var _0x2d67d1=_0x85fa9c[_0x727c('0x1b')]&&Object[_0x727c('0x1c')](_0x85fa9c[_0x727c('0x1b')])[_0x727c('0x1d')]?'\x0a\x09'+JSON[_0x727c('0x1e')](_0x85fa9c['meta']):'';return util[_0x727c('0x11')](_0x727c('0x1f'),moment()[_0x727c('0x11')](_0x727c('0x18')),_0x85fa9c['level'][_0x727c('0x1a')](),_0x2bb16e,_0x85fa9c[_0x727c('0x13')],_0x2d67d1);}function consoleLogger(){var _0x3a615b=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x727c('0x20'))][(_0x727c('0x21'))]({'level':'warn','json':![],'formatter':function(_0x311d8d){return formatter('',_0x311d8d);}})]});return _0x3a615b;}function fileLogger(_0x2a1393,_0x48756b){var _0x2ccf7a=new winston[(_0x727c('0x22'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x727c('0x20'))][(_0x727c('0x23'))]({'name':util[_0x727c('0x11')]('%s-%s',_0x2a1393,_0x727c('0x24')),'filename':getLogFileName(_0x48756b,_0x2a1393,_0x727c('0x24')),'level':_0x727c('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30efb5){return fileFormat(_0x2a1393,_0x30efb5);}}),new winston[(_0x727c('0x20'))][(_0x727c('0x23'))]({'name':util[_0x727c('0x11')](_0x727c('0x25'),_0x2a1393,debugLevel),'filename':getLogFileName(_0x48756b,_0x2a1393,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x368b13){return fileFormat(_0x2a1393,_0x368b13);}}),new winston[(_0x727c('0x20'))][(_0x727c('0x21'))]({'level':_0x727c('0x26'),'json':![],'formatter':function(_0x57b084){return fileFormat(_0x2a1393,_0x57b084);}})]});return _0x2ccf7a;}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 ec84fc4..6d6a150 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0x1527c5,_0x3fe93f){var _0x100326=function(_0xb846c2){while(--_0xb846c2){_0x1527c5['push'](_0x1527c5['shift']());}};_0x100326(++_0x3fe93f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x27380a,_0x11b4db){_0x27380a=_0x27380a-0x0;var _0x49557d=_0x0b0e[_0x27380a];return _0x49557d;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file +var _0xadb5=['exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length','isString','replace','@@{','}@@','username','newPassword','apiKey','firstName','street','phone','mobile','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','calleridnum'];(function(_0x4b9477,_0x4605f2){var _0x510515=function(_0x15f29f){while(--_0x15f29f){_0x4b9477['push'](_0x4b9477['shift']());}};_0x510515(++_0x4605f2);}(_0xadb5,0xad));var _0x5adb=function(_0x3435bc,_0x4c763c){_0x3435bc=_0x3435bc-0x0;var _0xcf08b7=_0xadb5[_0x3435bc];return _0xcf08b7;};var _=require('lodash');var sensitiveFields=[_0x5adb('0x0'),'password',_0x5adb('0x1'),_0x5adb('0x2'),_0x5adb('0x3'),'lastName',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'fax',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'membername','calleridname',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'clientEmail',_0x5adb('0x18'),'accesskeyid',_0x5adb('0x19'),'key',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'localstationid',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'oldPassword'];function maskSensitiveData(_0x2312de){const _0x518823=/(?!^)[\s\S](?!$)/g;if(_[_0x5adb('0x20')](_0x2312de)){for(const _0x42a482 in _0x2312de){if(_[_0x5adb('0x21')](_0x2312de[_0x42a482])){for(let _0x304784=0x0;_0x304784<_0x2312de[_0x42a482][_0x5adb('0x22')];_0x304784++){maskSensitiveData(_0x2312de[_0x42a482][_0x304784]);}}else if(_[_0x5adb('0x20')](_0x2312de[_0x42a482])){maskSensitiveData(_0x2312de[_0x42a482]);}else if(_[_0x5adb('0x23')](_0x2312de[_0x42a482])){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](/{{{/g,_0x5adb('0x25'))['replace'](/}}}/g,_0x5adb('0x26'))['replace'](/{{/g,'@{')[_0x5adb('0x24')](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x42a482)){_0x2312de[_0x42a482]=_0x2312de[_0x42a482][_0x5adb('0x24')](_0x518823,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 34baef3..4d3c508 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 _0x4024=['exports','lodash','\x20}\x20}','string','isArray','map','keys','reduce'];(function(_0x2c0378,_0x35ce53){var _0x9f944b=function(_0x5eaaef){while(--_0x5eaaef){_0x2c0378['push'](_0x2c0378['shift']());}};_0x9f944b(++_0x35ce53);}(_0x4024,0x89));var _0x4402=function(_0x2ede43,_0x491ce6){_0x2ede43=_0x2ede43-0x0;var _0x1764fb=_0x4024[_0x2ede43];return _0x1764fb;};var _=require(_0x4402('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x10e0ef){return _0x10e0ef==='{{'?'{\x20{\x20':_0x4402('0x1');}function safeTemplate(_0x2b36c7){var _0x49a2e2=_0x2b36c7;if(typeof _0x2b36c7===_0x4402('0x2')){_0x49a2e2=_0x2b36c7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x4402('0x3')](_0x2b36c7)){_0x49a2e2=_0x2b36c7[_0x4402('0x4')](function(_0x5bdb3f){return safeTemplate(_0x5bdb3f);});}else if(_['isPlainObject'](_0x2b36c7)){_0x49a2e2=Object[_0x4402('0x5')](_0x2b36c7)[_0x4402('0x6')](function(_0x168acd,_0x4ed77d){_0x168acd[_0x4ed77d]=safeTemplate(_0x2b36c7[_0x4ed77d]);return _0x168acd;},{});}return _0x49a2e2;}module[_0x4402('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0x93e9=['string','map','isPlainObject','keys','reduce','exports','lodash','{\x20{\x20','\x20}\x20}'];(function(_0x1a7d60,_0x4a02f4){var _0x5e0bb8=function(_0x35dd30){while(--_0x35dd30){_0x1a7d60['push'](_0x1a7d60['shift']());}};_0x5e0bb8(++_0x4a02f4);}(_0x93e9,0xcc));var _0x993e=function(_0xb1ee0e,_0x2126df){_0xb1ee0e=_0xb1ee0e-0x0;var _0x376116=_0x93e9[_0xb1ee0e];return _0x376116;};var _=require(_0x993e('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0xcf3bfd){return _0xcf3bfd==='{{'?_0x993e('0x1'):_0x993e('0x2');}function safeTemplate(_0x43b7b0){var _0x2a63eb=_0x43b7b0;if(typeof _0x43b7b0===_0x993e('0x3')){_0x2a63eb=_0x43b7b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x43b7b0)){_0x2a63eb=_0x43b7b0[_0x993e('0x4')](function(_0x255045){return safeTemplate(_0x255045);});}else if(_[_0x993e('0x5')](_0x43b7b0)){_0x2a63eb=Object[_0x993e('0x6')](_0x43b7b0)[_0x993e('0x7')](function(_0x2366d9,_0x12ac94){_0x2366d9[_0x12ac94]=safeTemplate(_0x43b7b0[_0x12ac94]);return _0x2366d9;},{});}return _0x2a63eb;}module[_0x993e('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 93a6bdb..c42c1d6 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 _0x26c5=['apps','motion2','env','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','resolve','server/app.json','legacy-libs','isArray'];(function(_0x47694e,_0x7b34f1){var _0xaa6cef=function(_0xa25266){while(--_0xa25266){_0x47694e['push'](_0x47694e['shift']());}};_0xaa6cef(++_0x7b34f1);}(_0x26c5,0xd6));var _0x526c=function(_0x5140a4,_0x557d73){_0x5140a4=_0x5140a4-0x0;var _0x37238e=_0x26c5[_0x5140a4];return _0x37238e;};var fs=require(_0x526c('0x0'));var path=require(_0x526c('0x1'));var config=require('../config/environment');var root=config[_0x526c('0x2')];var APP_JSON_PATH=path[_0x526c('0x3')](root,_0x526c('0x4'));var NODEPATH=path[_0x526c('0x3')](root,_0x526c('0x5'));function setLegacyLibsNodeEnvPath(_0x40aaa0){let _0x125255=![];if(Array[_0x526c('0x6')](_0x40aaa0[_0x526c('0x7')])){var _0x2eeaa7=_0x40aaa0['apps']['findIndex'](function(_0x197af8){return _0x197af8['name']===_0x526c('0x8');});if(_0x2eeaa7>-0x1){var _0x1e3684=_0x40aaa0[_0x526c('0x7')][_0x2eeaa7];if(typeof _0x1e3684['env']['NODE_PATH']!=='string'){_0x1e3684[_0x526c('0x9')]['NODE_PATH']=NODEPATH;_0x125255=!![];}}return{'appConfig':_0x40aaa0,'updated':_0x125255};}}function updateAppConfig(_0x3affbc){return fs['pathExists'](APP_JSON_PATH)[_0x526c('0xa')](function(_0x4b6a00){if(_0x4b6a00){return fs[_0x526c('0xb')](APP_JSON_PATH)['then'](function(_0x3366f2){var _0x36398b=setLegacyLibsNodeEnvPath(_0x3366f2);if(_0x36398b[_0x526c('0xc')]){_0x3affbc[_0x526c('0xd')](_0x526c('0xe'));return fs[_0x526c('0xf')](APP_JSON_PATH,_0x3366f2,{'spaces':0x2});}else{return Promise[_0x526c('0x3')]();}});}else{return Promise[_0x526c('0x3')]();}});}module[_0x526c('0x10')]=updateAppConfig; \ No newline at end of file +var _0x3bb8=['apps','findIndex','name','motion2','NODE_PATH','string','pathExists','then','readJSON','info','Updating\x20app.json','writeJSON','resolve','fs-extra','../config/environment','root','server/app.json','legacy-libs'];(function(_0x58b2d1,_0x4db546){var _0x37744c=function(_0x51c41d){while(--_0x51c41d){_0x58b2d1['push'](_0x58b2d1['shift']());}};_0x37744c(++_0x4db546);}(_0x3bb8,0x8b));var _0x83bb=function(_0x5c585d,_0x69819f){_0x5c585d=_0x5c585d-0x0;var _0x3fdd3b=_0x3bb8[_0x5c585d];return _0x3fdd3b;};var fs=require(_0x83bb('0x0'));var path=require('path');var config=require(_0x83bb('0x1'));var root=config[_0x83bb('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x83bb('0x3'));var NODEPATH=path['resolve'](root,_0x83bb('0x4'));function setLegacyLibsNodeEnvPath(_0x32723e){let _0x207496=![];if(Array['isArray'](_0x32723e['apps'])){var _0x626132=_0x32723e[_0x83bb('0x5')][_0x83bb('0x6')](function(_0x18529f){return _0x18529f[_0x83bb('0x7')]===_0x83bb('0x8');});if(_0x626132>-0x1){var _0x132d16=_0x32723e[_0x83bb('0x5')][_0x626132];if(typeof _0x132d16['env'][_0x83bb('0x9')]!==_0x83bb('0xa')){_0x132d16['env'][_0x83bb('0x9')]=NODEPATH;_0x207496=!![];}}return{'appConfig':_0x32723e,'updated':_0x207496};}}function updateAppConfig(_0x38622f){return fs[_0x83bb('0xb')](APP_JSON_PATH)[_0x83bb('0xc')](function(_0x14b6f6){if(_0x14b6f6){return fs[_0x83bb('0xd')](APP_JSON_PATH)[_0x83bb('0xc')](function(_0x1d99fb){var _0x4c8ae5=setLegacyLibsNodeEnvPath(_0x1d99fb);if(_0x4c8ae5['updated']){_0x38622f[_0x83bb('0xe')](_0x83bb('0xf'));return fs[_0x83bb('0x10')](APP_JSON_PATH,_0x1d99fb,{'spaces':0x2});}else{return Promise[_0x83bb('0x11')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file diff --git a/snippet/3.5.0/index.html b/snippet/3.5.0/index.html index 28d2a15..c06e349 100644 --- a/snippet/3.5.0/index.html +++ b/snippet/3.5.0/index.html @@ -26,4 +26,4 @@ status != 'online' && status != 'offline' && status != 'unmanaged' - " ng-click="vm.close(); $event.stopPropagation();">
\ No newline at end of file + " ng-click="vm.close(); $event.stopPropagation();">